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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T11:41:18.021Z", "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 687efc2..80128b8 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 _0xee40=['STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','TEXT','sequelize','VIRTUAL','getDataValue','action'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee40,0x128));var _0x0ee4=function(_0x4f4a8c,_0x50d8f7){_0x4f4a8c=_0x4f4a8c-0x0;var _0x19d21b=_0xee40[_0x4f4a8c];return _0x19d21b;};'use strict';var Sequelize=require(_0x0ee4('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ee4('0x1')],'get':function(_0x3e61d1){return this[_0x0ee4('0x2')](_0x0ee4('0x3'));}},'action':{'type':Sequelize[_0x0ee4('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0ee4('0x5'),_0x0ee4('0x6'),_0x0ee4('0x7'),_0x0ee4('0x8'),_0x0ee4('0x9'),_0x0ee4('0xa'),'bot',_0x0ee4('0xb')]],'msg':_0x0ee4('0xc')}},'comment':_0x0ee4('0xc')},'data1':{'type':Sequelize[_0x0ee4('0x4')](0x1000),'comment':_0x0ee4('0xd')},'data2':{'type':Sequelize[_0x0ee4('0x4')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x0ee4('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x0ee4('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x0ee4('0xe')]}}; \ No newline at end of file +var _0x30b0=['STRING','contactManager','integration','urlForward','bot','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','action'];(function(_0x2f370a,_0x543460){var _0x49a7b9=function(_0x211782){while(--_0x211782){_0x2f370a['push'](_0x2f370a['shift']());}};_0x49a7b9(++_0x543460);}(_0x30b0,0xa2));var _0x030b=function(_0xbaee4f,_0x5bc8b4){_0xbaee4f=_0xbaee4f-0x0;var _0xa57eae=_0x30b0[_0xbaee4f];return _0xa57eae;};'use strict';var Sequelize=require(_0x030b('0x0'));module['exports']={'name':{'type':Sequelize[_0x030b('0x1')],'get':function(_0xb4a348){return this['getDataValue'](_0x030b('0x2'));}},'action':{'type':Sequelize[_0x030b('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x030b('0x4'),_0x030b('0x5'),'motionbar','jscripty',_0x030b('0x6'),'browser',_0x030b('0x7'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x030b('0x3')](0x1000),'comment':_0x030b('0x8')},'data2':{'type':Sequelize[_0x030b('0x3')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x030b('0x3')](0x1000),'comment':_0x030b('0x9')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x030b('0x3')](0x1000)},'data6':{'type':Sequelize[_0x030b('0x3')]},'data7':{'type':Sequelize[_0x030b('0xa')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index ef0a54c..f387bf9 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 _0x1158=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','body','Action','find','params','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel'];(function(_0x3e6c83,_0x595a7c){var _0x1159e2=function(_0x24b37d){while(--_0x24b37d){_0x3e6c83['push'](_0x3e6c83['shift']());}};_0x1159e2(++_0x595a7c);}(_0x1158,0xdf));var _0x8115=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x1158[_0x45783c];return _0x1161da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8115('0x0'));var jsonpatch=require(_0x8115('0x1'));var rp=require(_0x8115('0x2'));var moment=require(_0x8115('0x3'));var BPromise=require(_0x8115('0x4'));var Mustache=require(_0x8115('0x5'));var util=require('util');var path=require(_0x8115('0x6'));var sox=require(_0x8115('0x7'));var csv=require(_0x8115('0x8'));var ejs=require(_0x8115('0x9'));var fs=require('fs');var _=require(_0x8115('0xa'));var squel=require(_0x8115('0xb'));var crypto=require(_0x8115('0xc'));var jsforce=require(_0x8115('0xd'));var deskjs=require(_0x8115('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8115('0xf'));var Papa=require('papaparse');var Redis=require(_0x8115('0x10'));var authService=require(_0x8115('0x11'));var qs=require(_0x8115('0x12'));var as=require(_0x8115('0x13'));var hardwareService=require(_0x8115('0x14'));var logger=require(_0x8115('0x15'))(_0x8115('0x16'));var utils=require(_0x8115('0x17'));var config=require(_0x8115('0x18'));var db=require(_0x8115('0x19'))['db'];function respondWithStatusCode(_0x44b865,_0x4c62c8){_0x4c62c8=_0x4c62c8||0xcc;return function(_0xe7e20d){if(_0xe7e20d){return _0x44b865[_0x8115('0x1a')](_0x4c62c8);}return _0x44b865[_0x8115('0x1b')](_0x4c62c8)[_0x8115('0x1c')]();};}function respondWithResult(_0xb3dd14,_0x153609){_0x153609=_0x153609||0xc8;return function(_0x4928c2){if(_0x4928c2){return _0xb3dd14[_0x8115('0x1b')](_0x153609)[_0x8115('0x1d')](_0x4928c2);}};}function respondWithFilteredResult(_0x5b7da6,_0x32f077){return function(_0x34b9ff){if(_0x34b9ff){var _0x44a4c4=_0x34b9ff[_0x8115('0x1e')],_0x50e1da=_0x32f077[_0x8115('0x1f')],_0x2aa333=_0x32f077[_0x8115('0x1f')]+_0x32f077[_0x8115('0x20')],_0x44819e;if(_0x2aa333>=_0x44a4c4){_0x2aa333=_0x44a4c4;_0x44819e=0xc8;}else{_0x44819e=0xce;}_0x5b7da6[_0x8115('0x1b')](_0x44819e);return _0x5b7da6['set'](_0x8115('0x21'),_0x50e1da+'-'+_0x2aa333+'/'+_0x44a4c4)[_0x8115('0x1d')](_0x34b9ff);}return null;};}function patchUpdates(_0x338f59){return function(_0x242747){try{jsonpatch[_0x8115('0x22')](_0x242747,_0x338f59,!![]);}catch(_0x75181d){return BPromise['reject'](_0x75181d);}return _0x242747[_0x8115('0x23')]();};}function saveUpdates(_0x17a88b,_0x584019){return function(_0xa53a1f){if(_0xa53a1f){return _0xa53a1f[_0x8115('0x24')](_0x17a88b)[_0x8115('0x25')](function(_0x223e7e){return _0x223e7e;});}return null;};}function removeEntity(_0x19abdf,_0x551d28){return function(_0x5325db){if(_0x5325db){return _0x5325db[_0x8115('0x26')]()[_0x8115('0x25')](function(){_0x19abdf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b84c,_0xf7cbbb){return function(_0x2a2974){if(!_0x2a2974){_0x11b84c[_0x8115('0x1a')](0x194);}return _0x2a2974;};}function handleError(_0x4a4e7b,_0x1758af){_0x1758af=_0x1758af||0x1f4;return function(_0x5685c8){logger[_0x8115('0x27')](_0x5685c8[_0x8115('0x28')]);if(_0x5685c8[_0x8115('0x29')]){delete _0x5685c8[_0x8115('0x29')];}_0x4a4e7b[_0x8115('0x1b')](_0x1758af)['send'](_0x5685c8);};}exports[_0x8115('0x24')]=function(_0x36a507,_0x5f2c5c){if(_0x36a507[_0x8115('0x2a')]['id']){delete _0x36a507[_0x8115('0x2a')]['id'];}return db[_0x8115('0x2b')][_0x8115('0x2c')]({'where':{'id':_0x36a507[_0x8115('0x2d')]['id']}})[_0x8115('0x25')](handleEntityNotFound(_0x5f2c5c,null))[_0x8115('0x25')](saveUpdates(_0x36a507[_0x8115('0x2a')],null))[_0x8115('0x25')](respondWithResult(_0x5f2c5c,null))[_0x8115('0x2e')](handleError(_0x5f2c5c,null));};exports[_0x8115('0x26')]=function(_0x282abd,_0x4fa18a){return db[_0x8115('0x2b')][_0x8115('0x2c')]({'where':{'id':_0x282abd[_0x8115('0x2d')]['id']}})[_0x8115('0x25')](handleEntityNotFound(_0x4fa18a,null))[_0x8115('0x25')](removeEntity(_0x4fa18a,null))['catch'](handleError(_0x4fa18a,null));}; \ No newline at end of file +var _0x73df=['request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','name','send','body','Action','params','catch','html-pdf','eml-format','zip-dir'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x73df,0x180));var _0xf73d=function(_0x46a4b,_0x2bdc6d){_0x46a4b=_0x46a4b-0x0;var _0x3ab7bf=_0x73df[_0x46a4b];return _0x3ab7bf;};'use strict';var pdf=require(_0xf73d('0x0'));var emlformat=require(_0xf73d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf73d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf73d('0x3'));var moment=require('moment');var BPromise=require(_0xf73d('0x4'));var Mustache=require(_0xf73d('0x5'));var util=require(_0xf73d('0x6'));var path=require('path');var sox=require(_0xf73d('0x7'));var csv=require(_0xf73d('0x8'));var ejs=require(_0xf73d('0x9'));var fs=require('fs');var _=require(_0xf73d('0xa'));var squel=require(_0xf73d('0xb'));var crypto=require(_0xf73d('0xc'));var jsforce=require(_0xf73d('0xd'));var deskjs=require(_0xf73d('0xe'));var toCsv=require(_0xf73d('0x8'));var querystring=require(_0xf73d('0xf'));var Papa=require(_0xf73d('0x10'));var Redis=require(_0xf73d('0x11'));var authService=require(_0xf73d('0x12'));var qs=require(_0xf73d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf73d('0x14'));var logger=require(_0xf73d('0x15'))('api');var utils=require(_0xf73d('0x16'));var config=require('../../config/environment');var db=require(_0xf73d('0x17'))['db'];function respondWithStatusCode(_0x34fcf6,_0x1a3064){_0x1a3064=_0x1a3064||0xcc;return function(_0x249a96){if(_0x249a96){return _0x34fcf6[_0xf73d('0x18')](_0x1a3064);}return _0x34fcf6[_0xf73d('0x19')](_0x1a3064)[_0xf73d('0x1a')]();};}function respondWithResult(_0x36221e,_0x36dc80){_0x36dc80=_0x36dc80||0xc8;return function(_0x126d11){if(_0x126d11){return _0x36221e[_0xf73d('0x19')](_0x36dc80)['json'](_0x126d11);}};}function respondWithFilteredResult(_0x3f2f43,_0x59b909){return function(_0x1be14e){if(_0x1be14e){var _0x4794f3=_0x1be14e[_0xf73d('0x1b')],_0x16f64f=_0x59b909[_0xf73d('0x1c')],_0x51497f=_0x59b909['offset']+_0x59b909[_0xf73d('0x1d')],_0x5b2d77;if(_0x51497f>=_0x4794f3){_0x51497f=_0x4794f3;_0x5b2d77=0xc8;}else{_0x5b2d77=0xce;}_0x3f2f43[_0xf73d('0x19')](_0x5b2d77);return _0x3f2f43[_0xf73d('0x1e')](_0xf73d('0x1f'),_0x16f64f+'-'+_0x51497f+'/'+_0x4794f3)[_0xf73d('0x20')](_0x1be14e);}return null;};}function patchUpdates(_0xf24002){return function(_0x3cbba3){try{jsonpatch['apply'](_0x3cbba3,_0xf24002,!![]);}catch(_0x5c4f4e){return BPromise[_0xf73d('0x21')](_0x5c4f4e);}return _0x3cbba3[_0xf73d('0x22')]();};}function saveUpdates(_0x22c486,_0x5f374a){return function(_0x129df2){if(_0x129df2){return _0x129df2[_0xf73d('0x23')](_0x22c486)[_0xf73d('0x24')](function(_0xa217e0){return _0xa217e0;});}return null;};}function removeEntity(_0x1c72a5,_0x222f47){return function(_0x518d60){if(_0x518d60){return _0x518d60['destroy']()[_0xf73d('0x24')](function(){_0x1c72a5['status'](0xcc)[_0xf73d('0x1a')]();});}};}function handleEntityNotFound(_0x207b8f,_0x581039){return function(_0x9a2dfa){if(!_0x9a2dfa){_0x207b8f['sendStatus'](0x194);}return _0x9a2dfa;};}function handleError(_0x505c27,_0x500254){_0x500254=_0x500254||0x1f4;return function(_0x4f34c2){logger['error'](_0x4f34c2['stack']);if(_0x4f34c2[_0xf73d('0x25')]){delete _0x4f34c2[_0xf73d('0x25')];}_0x505c27[_0xf73d('0x19')](_0x500254)[_0xf73d('0x26')](_0x4f34c2);};}exports[_0xf73d('0x23')]=function(_0x3b606e,_0x2cae6b){if(_0x3b606e['body']['id']){delete _0x3b606e[_0xf73d('0x27')]['id'];}return db[_0xf73d('0x28')]['find']({'where':{'id':_0x3b606e[_0xf73d('0x29')]['id']}})[_0xf73d('0x24')](handleEntityNotFound(_0x2cae6b,null))[_0xf73d('0x24')](saveUpdates(_0x3b606e[_0xf73d('0x27')],null))[_0xf73d('0x24')](respondWithResult(_0x2cae6b,null))[_0xf73d('0x2a')](handleError(_0x2cae6b,null));};exports['destroy']=function(_0xb57335,_0x7a4b0f){return db[_0xf73d('0x28')]['find']({'where':{'id':_0xb57335['params']['id']}})[_0xf73d('0x24')](handleEntityNotFound(_0x7a4b0f,null))[_0xf73d('0x24')](removeEntity(_0x7a4b0f,null))[_0xf73d('0x2a')](handleError(_0x7a4b0f,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 0839d22..d755e56 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 _0x5cad=['path','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x530cb9,_0x54380a){var _0x28f667=function(_0x237006){while(--_0x237006){_0x530cb9['push'](_0x530cb9['shift']());}};_0x28f667(++_0x54380a);}(_0x5cad,0x166));var _0xd5ca=function(_0x4b869a,_0x1f993d){_0x4b869a=_0x4b869a-0x0;var _0x10d713=_0x5cad[_0x4b869a];return _0x10d713;};'use strict';var _=require('lodash');var util=require(_0xd5ca('0x0'));var logger=require(_0xd5ca('0x1'))(_0xd5ca('0x2'));var moment=require(_0xd5ca('0x3'));var BPromise=require(_0xd5ca('0x4'));var rp=require(_0xd5ca('0x5'));var fs=require('fs');var path=require(_0xd5ca('0x6'));var rimraf=require(_0xd5ca('0x7'));var config=require(_0xd5ca('0x8'));var attributes=require(_0xd5ca('0x9'));module[_0xd5ca('0xa')]=function(_0x38dd7b,_0x1aec16){return _0x38dd7b[_0xd5ca('0xb')]('Action',attributes,{'tableName':_0xd5ca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb81=['../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xeb81,0x1c8));var _0x1eb8=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0xeb81[_0xcd5a3d];return _0xd43207;};'use strict';var _=require(_0x1eb8('0x0'));var util=require(_0x1eb8('0x1'));var logger=require(_0x1eb8('0x2'))('api');var moment=require(_0x1eb8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1eb8('0x4'));var rimraf=require(_0x1eb8('0x5'));var config=require(_0x1eb8('0x6'));var attributes=require(_0x1eb8('0x7'));module[_0x1eb8('0x8')]=function(_0x189720,_0x344b66){return _0x189720['define'](_0x1eb8('0x9'),attributes,{'tableName':_0x1eb8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 5ecba93..71b906c 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4e9015,_0x2eb6ff){var _0x289dc3=function(_0xcae84d){while(--_0xcae84d){_0x4e9015['push'](_0x4e9015['shift']());}};_0x289dc3(++_0x2eb6ff);}(_0x70e0,0x17b));var _0x070e=function(_0x3d60ca,_0x58a3bd){_0x3d60ca=_0x3d60ca-0x0;var _0x103bc4=_0x70e0[_0x3d60ca];return _0x103bc4;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xe84dfb,_0x4a2fe8){var _0xa389b8=function(_0x4971ef){while(--_0x4971ef){_0xe84dfb['push'](_0xe84dfb['shift']());}};_0xa389b8(++_0x4a2fe8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6fedab1..d628814 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 _0x6bf9=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./action.controller','isAuthenticated','update','exports','multer','util','path'];(function(_0x2f6559,_0x5d94e9){var _0x56b523=function(_0x3c4807){while(--_0x3c4807){_0x2f6559['push'](_0x2f6559['shift']());}};_0x56b523(++_0x5d94e9);}(_0x6bf9,0x14d));var _0x96bf=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x6bf9[_0x29632e];return _0x426e04;};'use strict';var multer=require(_0x96bf('0x0'));var util=require(_0x96bf('0x1'));var path=require(_0x96bf('0x2'));var timeout=require(_0x96bf('0x3'));var express=require(_0x96bf('0x4'));var router=express[_0x96bf('0x5')]();var auth=require(_0x96bf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x96bf('0x7'));var controller=require(_0x96bf('0x8'));router['put']('/:id',auth[_0x96bf('0x9')](),controller[_0x96bf('0xa')]);router['delete']('/:id',auth[_0x96bf('0x9')](),controller['destroy']);module[_0x96bf('0xb')]=router; \ No newline at end of file +var _0x2f20=['update','delete','destroy','util','path','connect-timeout','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated'];(function(_0x105855,_0x414d97){var _0x487389=function(_0x4ea0e5){while(--_0x4ea0e5){_0x105855['push'](_0x105855['shift']());}};_0x487389(++_0x414d97);}(_0x2f20,0x1dc));var _0x02f2=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x2f20[_0x599f41];return _0x2e4d58;};'use strict';var multer=require('multer');var util=require(_0x02f2('0x0'));var path=require(_0x02f2('0x1'));var timeout=require(_0x02f2('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x02f2('0x3'));var config=require(_0x02f2('0x4'));var controller=require('./action.controller');router[_0x02f2('0x5')](_0x02f2('0x6'),auth[_0x02f2('0x7')](),controller[_0x02f2('0x8')]);router[_0x02f2('0x9')](_0x02f2('0x6'),auth[_0x02f2('0x7')](),controller[_0x02f2('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d88c028..e2b174a 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 _0xec99=['TEXT','sequelize','exports','STRING'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xec99,0xd5));var _0x9ec9=function(_0x4660e1,_0x1d863f){_0x4660e1=_0x4660e1-0x0;var _0x4b46a6=_0xec99[_0x4660e1];return _0x4b46a6;};'use strict';var Sequelize=require(_0x9ec9('0x0'));module[_0x9ec9('0x1')]={'name':{'type':Sequelize[_0x9ec9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9ec9('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x9ec9('0x2')]},'conditions':{'type':Sequelize[_0x9ec9('0x3')]},'joins':{'type':Sequelize[_0x9ec9('0x3')]}}; \ No newline at end of file +var _0x259b=['exports','STRING','TEXT'];(function(_0x20614d,_0x435e35){var _0x29d7b2=function(_0x561995){while(--_0x561995){_0x20614d['push'](_0x20614d['shift']());}};_0x29d7b2(++_0x435e35);}(_0x259b,0x81));var _0xb259=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x259b[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require('sequelize');module[_0xb259('0x0')]={'name':{'type':Sequelize[_0xb259('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb259('0x1')]},'parent':{'type':Sequelize[_0xb259('0x1')]},'table':{'type':Sequelize[_0xb259('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb259('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 8eba28d..81cd41c 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 _0x0b25=['alias','No\x20available\x20data','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','get','CustomReports','destroy','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','options','count','include','rows','catch','show','keys','length','includeAll','merge','find','user','role','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','operator','findAll','metric'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x0b25,0x155));var _0x50b2=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x0b25[_0x20fdc1];return _0x25397c;};'use strict';var pdf=require(_0x50b2('0x0'));var emlformat=require(_0x50b2('0x1'));var rimraf=require(_0x50b2('0x2'));var zipdir=require(_0x50b2('0x3'));var jsonpatch=require(_0x50b2('0x4'));var rp=require(_0x50b2('0x5'));var moment=require(_0x50b2('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50b2('0x7'));var path=require('path');var sox=require(_0x50b2('0x8'));var csv=require(_0x50b2('0x9'));var ejs=require(_0x50b2('0xa'));var fs=require('fs');var _=require(_0x50b2('0xb'));var squel=require(_0x50b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x50b2('0xd'));var deskjs=require(_0x50b2('0xe'));var toCsv=require(_0x50b2('0x9'));var querystring=require(_0x50b2('0xf'));var Papa=require('papaparse');var Redis=require(_0x50b2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x50b2('0x11'));var as=require(_0x50b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50b2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x50b2('0x14'));var db=require(_0x50b2('0x15'))['db'];var dbH=require(_0x50b2('0x15'))[_0x50b2('0x16')];function respondWithStatusCode(_0x3eda73,_0x3ab9e6){_0x3ab9e6=_0x3ab9e6||0xcc;return function(_0x36067a){if(_0x36067a){return _0x3eda73[_0x50b2('0x17')](_0x3ab9e6);}return _0x3eda73[_0x50b2('0x18')](_0x3ab9e6)[_0x50b2('0x19')]();};}function respondWithResult(_0x391255,_0x4d6650){_0x4d6650=_0x4d6650||0xc8;return function(_0x131cf1){if(_0x131cf1){return _0x391255[_0x50b2('0x18')](_0x4d6650)[_0x50b2('0x1a')](_0x131cf1);}};}function respondWithFilteredResult(_0x54cc61,_0x3c3fd6){return function(_0x112d57){if(_0x112d57){var _0x2f0f92=_0x112d57['count'],_0x1a4df6=_0x3c3fd6[_0x50b2('0x1b')],_0x1308dd=_0x3c3fd6[_0x50b2('0x1b')]+_0x3c3fd6['limit'],_0xb95d74;if(_0x1308dd>=_0x2f0f92){_0x1308dd=_0x2f0f92;_0xb95d74=0xc8;}else{_0xb95d74=0xce;}_0x54cc61[_0x50b2('0x18')](_0xb95d74);return _0x54cc61[_0x50b2('0x1c')]('Content-Range',_0x1a4df6+'-'+_0x1308dd+'/'+_0x2f0f92)[_0x50b2('0x1a')](_0x112d57);}return null;};}function patchUpdates(_0x106491){return function(_0x52aaf9){try{jsonpatch[_0x50b2('0x1d')](_0x52aaf9,_0x106491,!![]);}catch(_0x1119c6){return BPromise[_0x50b2('0x1e')](_0x1119c6);}return _0x52aaf9[_0x50b2('0x1f')]();};}function saveUpdates(_0x4b6005,_0x42aef5){return function(_0x41d435){if(_0x41d435){return _0x41d435[_0x50b2('0x20')](_0x4b6005)[_0x50b2('0x21')](function(_0x20d71e){return _0x20d71e;});}return null;};}function removeEntity(_0x459eaf,_0x51f7ae){return function(_0x57c697){if(_0x57c697){return _0x57c697['destroy']()[_0x50b2('0x21')](function(){var _0x34c3cb=_0x57c697[_0x50b2('0x22')]({'plain':!![]});var _0x28e515=_0x50b2('0x23');return db['UserProfileResource'][_0x50b2('0x24')]({'where':{'type':_0x28e515,'resourceId':_0x34c3cb['id']}})[_0x50b2('0x21')](function(){return _0x57c697;});})[_0x50b2('0x21')](function(){_0x459eaf[_0x50b2('0x18')](0xcc)[_0x50b2('0x19')]();});}};}function handleEntityNotFound(_0x412639,_0x21ae06){return function(_0x2a145a){if(!_0x2a145a){_0x412639[_0x50b2('0x17')](0x194);}return _0x2a145a;};}function handleError(_0x8e2403,_0x2d05f5){_0x2d05f5=_0x2d05f5||0x1f4;return function(_0x2c6fff){logger['error'](_0x2c6fff[_0x50b2('0x25')]);if(_0x2c6fff[_0x50b2('0x26')]){delete _0x2c6fff[_0x50b2('0x26')];}_0x8e2403[_0x50b2('0x18')](_0x2d05f5)[_0x50b2('0x27')](_0x2c6fff);};}exports['index']=function(_0x65ecbe,_0x24d967){var _0x1220e3={},_0x2cc4fe={},_0x508693={'count':0x0,'rows':[]};var _0x34309d=_[_0x50b2('0x28')](db[_0x50b2('0x29')][_0x50b2('0x2a')],function(_0x313b33){return{'name':_0x313b33[_0x50b2('0x2b')],'type':_0x313b33[_0x50b2('0x2c')][_0x50b2('0x2d')]};});_0x2cc4fe[_0x50b2('0x2e')]=_[_0x50b2('0x28')](_0x34309d,_0x50b2('0x26'));_0x2cc4fe[_0x50b2('0x2f')]=_['keys'](_0x65ecbe['query']);_0x2cc4fe[_0x50b2('0x30')]=_[_0x50b2('0x31')](_0x2cc4fe[_0x50b2('0x2e')],_0x2cc4fe[_0x50b2('0x2f')]);_0x1220e3['attributes']=_[_0x50b2('0x31')](_0x2cc4fe['model'],qs[_0x50b2('0x32')](_0x65ecbe[_0x50b2('0x2f')][_0x50b2('0x32')]));_0x1220e3['attributes']=_0x1220e3[_0x50b2('0x33')]['length']?_0x1220e3[_0x50b2('0x33')]:_0x2cc4fe[_0x50b2('0x2e')];if(!_0x65ecbe[_0x50b2('0x2f')][_0x50b2('0x34')](_0x50b2('0x35'))){_0x1220e3['limit']=qs[_0x50b2('0x36')](_0x65ecbe[_0x50b2('0x2f')][_0x50b2('0x36')]);_0x1220e3['offset']=qs['offset'](_0x65ecbe[_0x50b2('0x2f')]['offset']);}_0x1220e3[_0x50b2('0x37')]=qs[_0x50b2('0x38')](_0x65ecbe['query'][_0x50b2('0x38')]);_0x1220e3['where']=qs[_0x50b2('0x30')](_[_0x50b2('0x39')](_0x65ecbe[_0x50b2('0x2f')],_0x2cc4fe[_0x50b2('0x30')]),_0x34309d);if(_0x65ecbe[_0x50b2('0x2f')]['filter']){_0x1220e3[_0x50b2('0x3a')]=_['merge'](_0x1220e3['where'],{'$or':_['map'](_0x34309d,function(_0x177e69){if(_0x177e69[_0x50b2('0x2c')]!==_0x50b2('0x3b')){var _0x4dad2f={};_0x4dad2f[_0x177e69[_0x50b2('0x26')]]={'$like':'%'+_0x65ecbe['query']['filter']+'%'};return _0x4dad2f;}})});}_0x1220e3=_['merge']({},_0x1220e3,_0x65ecbe[_0x50b2('0x3c')]);var _0x40207c={'where':_0x1220e3['where']};return db[_0x50b2('0x29')][_0x50b2('0x3d')](_0x40207c)[_0x50b2('0x21')](function(_0x19cc7e){_0x508693['count']=_0x19cc7e;if(_0x65ecbe[_0x50b2('0x2f')]['includeAll']){_0x1220e3[_0x50b2('0x3e')]=[{'all':!![]}];}return db[_0x50b2('0x29')]['findAll'](_0x1220e3);})[_0x50b2('0x21')](function(_0x2e4781){_0x508693[_0x50b2('0x3f')]=_0x2e4781;return _0x508693;})['then'](respondWithFilteredResult(_0x24d967,_0x1220e3))[_0x50b2('0x40')](handleError(_0x24d967,null));};exports[_0x50b2('0x41')]=function(_0x7c5241,_0x3ade1a){var _0x330348={'raw':![],'where':{'id':_0x7c5241['params']['id']}},_0x27725a={};_0x27725a[_0x50b2('0x2e')]=_[_0x50b2('0x42')](db['AnalyticCustomReport'][_0x50b2('0x2a')]);_0x27725a[_0x50b2('0x2f')]=_[_0x50b2('0x42')](_0x7c5241[_0x50b2('0x2f')]);_0x27725a['filters']=_[_0x50b2('0x31')](_0x27725a[_0x50b2('0x2e')],_0x27725a[_0x50b2('0x2f')]);_0x330348[_0x50b2('0x33')]=_[_0x50b2('0x31')](_0x27725a['model'],qs[_0x50b2('0x32')](_0x7c5241[_0x50b2('0x2f')][_0x50b2('0x32')]));_0x330348[_0x50b2('0x33')]=_0x330348[_0x50b2('0x33')][_0x50b2('0x43')]?_0x330348[_0x50b2('0x33')]:_0x27725a[_0x50b2('0x2e')];if(_0x7c5241[_0x50b2('0x2f')][_0x50b2('0x44')]){_0x330348[_0x50b2('0x3e')]=[{'all':!![]}];}_0x330348=_[_0x50b2('0x45')]({},_0x330348,_0x7c5241[_0x50b2('0x3c')]);return db['AnalyticCustomReport'][_0x50b2('0x46')](_0x330348)['then'](handleEntityNotFound(_0x3ade1a,null))[_0x50b2('0x21')](respondWithResult(_0x3ade1a,null))['catch'](handleError(_0x3ade1a,null));};exports['create']=function(_0x3ba565,_0x550778){return db['AnalyticCustomReport']['create'](_0x3ba565['body'],{})['then'](function(_0x4cfa62){var _0x33fa98=_0x3ba565[_0x50b2('0x47')][_0x50b2('0x22')]({'plain':!![]});if(!_0x33fa98)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33fa98[_0x50b2('0x48')]==='user'){var _0x26c804=_0x4cfa62[_0x50b2('0x22')]({'plain':!![]});var _0x9f7672='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x9f7672,'userProfileId':_0x33fa98['userProfileId']},'raw':!![]})[_0x50b2('0x21')](function(_0x3dcd8d){if(_0x3dcd8d&&_0x3dcd8d[_0x50b2('0x49')]===0x0){return db['UserProfileResource'][_0x50b2('0x4a')]({'name':_0x26c804['name'],'resourceId':_0x26c804['id'],'type':'CustomReports','sectionId':_0x3dcd8d['id']},{})[_0x50b2('0x21')](function(){return _0x4cfa62;});}else{return _0x4cfa62;}})[_0x50b2('0x40')](function(_0x2d4f0e){logger[_0x50b2('0x4b')](_0x50b2('0x4c'),_0x2d4f0e);throw _0x2d4f0e;});}return _0x4cfa62;})[_0x50b2('0x21')](respondWithResult(_0x550778,0xc9))[_0x50b2('0x40')](handleError(_0x550778,null));};exports[_0x50b2('0x20')]=function(_0x34247b,_0x79b436){if(_0x34247b[_0x50b2('0x4d')]['id']){delete _0x34247b['body']['id'];}return db['AnalyticCustomReport'][_0x50b2('0x46')]({'where':{'id':_0x34247b[_0x50b2('0x4e')]['id']}})[_0x50b2('0x21')](handleEntityNotFound(_0x79b436,null))['then'](saveUpdates(_0x34247b[_0x50b2('0x4d')],null))[_0x50b2('0x21')](respondWithResult(_0x79b436,null))[_0x50b2('0x40')](handleError(_0x79b436,null));};exports[_0x50b2('0x24')]=function(_0x4fa58a,_0x5b9b0f){return db[_0x50b2('0x29')][_0x50b2('0x46')]({'where':{'id':_0x4fa58a[_0x50b2('0x4e')]['id']}})[_0x50b2('0x21')](handleEntityNotFound(_0x5b9b0f,null))[_0x50b2('0x21')](removeEntity(_0x5b9b0f,null))[_0x50b2('0x40')](handleError(_0x5b9b0f,null));};exports[_0x50b2('0x4f')]=function(_0x3e81e5,_0xfc6a64){var _0x1c9c2a=0xa;var _0x528cde=[_0x50b2('0x50'),_0x50b2('0x51'),_0x50b2('0x52'),_0x50b2('0x53')];var _0x4cb3d0={'SUM':_0x50b2('0x54'),'COUNT':_0x50b2('0x55'),'COUNT DISTINCT':_0x50b2('0x56'),'MAX':_0x50b2('0x57'),'MIN':_0x50b2('0x58'),'AVG':_0x50b2('0x59'),'GROUP_CONCAT':_0x50b2('0x5a'),'GROUP_CONCAT ASC':_0x50b2('0x5b'),'GROUP_CONCAT DESC':_0x50b2('0x5c')};var _0x21fece={'SEC_TO_TIME':_0x50b2('0x5d'),'DATE':_0x50b2('0x5e'),'HOUR':_0x50b2('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x30db39=function(_0x213ffb){return!_[_0x50b2('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x50b2('0x61')],_0x213ffb);};var _0x402596=function(_0xe9168e){if(!_0xe9168e||!_0xe9168e[_0x50b2('0x62')]['length']){return'';}for(var _0x250a8f='(',_0x287199=0x0;_0x287199<_0xe9168e['rules']['length'];_0x287199+=0x1){_0x287199>0x0&&(_0x250a8f+='\x20'+_0xe9168e['operator']+'\x20');_0x250a8f+=_0xe9168e[_0x50b2('0x62')][_0x287199][_0x50b2('0x63')]?_0x402596(_0xe9168e[_0x50b2('0x62')][_0x287199][_0x50b2('0x63')]):_0xe9168e[_0x50b2('0x62')][_0x287199]['field']+'\x20'+_0xe9168e['rules'][_0x287199][_0x50b2('0x64')]+(_0x30db39(_0xe9168e['rules'][_0x287199][_0x50b2('0x64')])?'\x20'+_0xe9168e['rules'][_0x287199][_0x50b2('0x65')]:'');}return _0x250a8f+')';};var _0x15a2f9={'where':{'id':_0x3e81e5[_0x50b2('0x4e')]['id']}},_0x3aea36,_0x1c3dbb,_0x288119,_0xf5da02,_0x19f5a7;_0x15a2f9=_[_0x50b2('0x45')]({},_0x15a2f9,_0x3e81e5['options']);return db[_0x50b2('0x29')][_0x50b2('0x46')](_0x15a2f9)[_0x50b2('0x21')](function(_0x43f5d8){if(_0x43f5d8){_0x3aea36=_0x43f5d8;return _0x43f5d8[_0x50b2('0x66')]();}return null;})[_0x50b2('0x21')](function(_0x5bdacf){if(_0x5bdacf){if(!_0x5bdacf[_0x50b2('0x43')]){throw new db[(_0x50b2('0x67'))][(_0x50b2('0x68'))](_0x50b2('0x69'),0x193);}_0x1c3dbb=_0x5bdacf;return db[_0x50b2('0x6a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x287ac3){if(_0x287ac3){_0x288119=_['keyBy'](_0x287ac3,'id');var _0x3f5214;var _0x36c8b4=squel[_0x50b2('0x6b')]();_0x36c8b4[_0x50b2('0x6c')](_0x3aea36[_0x50b2('0x6d')]);for(var _0x4f9af7=0x0;_0x4f9af7<_0x1c3dbb[_0x50b2('0x43')];_0x4f9af7+=0x1){_0x3f5214=_0x1c3dbb[_0x4f9af7][_0x50b2('0x6e')]?_0x288119[_0x1c3dbb[_0x4f9af7][_0x50b2('0x6e')]]['metric']:_0x1c3dbb[_0x4f9af7][_0x50b2('0x6f')];_0x3f5214=_0x1c3dbb[_0x4f9af7][_0x50b2('0x70')]?_[_0x50b2('0x71')](_0x4cb3d0[_0x1c3dbb[_0x4f9af7][_0x50b2('0x70')]],'%s',_0x3f5214):_0x3f5214;_0x3f5214=_0x1c3dbb[_0x4f9af7]['format']?_[_0x50b2('0x71')](_0x21fece[_0x1c3dbb[_0x4f9af7][_0x50b2('0x72')]],'%s',_0x3f5214):_0x3f5214;if(_0x1c3dbb[_0x4f9af7][_0x50b2('0x73')]){_0x36c8b4[_0x50b2('0x63')](_0x3f5214);}_0x1c3dbb[_0x4f9af7][_0x50b2('0x74')]&&_0x36c8b4[_0x50b2('0x37')](_0x3f5214,_0x1c3dbb[_0x4f9af7][_0x50b2('0x74')]===_0x50b2('0x75')?![]:!![]);_0x36c8b4[_0x50b2('0x6f')](_0x3f5214,_0x1c3dbb[_0x4f9af7]['alias']||_0x3f5214);}if(_0x3aea36[_0x50b2('0x76')]){_0x3aea36[_0x50b2('0x76')]=JSON[_0x50b2('0x77')](_0x3aea36[_0x50b2('0x76')]);for(var _0x469042=0x0;_0x469042<_0x3aea36[_0x50b2('0x76')][_0x50b2('0x43')];_0x469042+=0x1){if(_0x3aea36['joins'][_0x469042]['type']&&_[_0x50b2('0x60')](_0x528cde,_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x2c')])&&_0x3aea36[_0x50b2('0x76')][_0x469042]['parentKey']&&_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x78')]&&_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x79')]){_0x36c8b4[_0x3aea36[_0x50b2('0x76')][_0x469042]['type']](_0x3aea36[_0x50b2('0x76')][_0x469042]['foreignTable'],null,util[_0x50b2('0x72')](_0x50b2('0x7a'),_0x3aea36[_0x50b2('0x6d')],_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x7b')],_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x78')],_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x79')]));}}}if(_0x3aea36[_0x50b2('0x7c')]){_0x3aea36[_0x50b2('0x7c')]=JSON[_0x50b2('0x77')](_0x3aea36['conditions']);_0x36c8b4['where'](_0x402596(_0x3aea36[_0x50b2('0x7c')]['group']));}_0x19f5a7=_0x36c8b4[_0x50b2('0x7d')]();_0x36c8b4[_0x50b2('0x36')](_0x1c9c2a);_0x36c8b4[_0x50b2('0x1b')](0x0);logger[_0x50b2('0x7e')](_0x50b2('0x7f'),_0x36c8b4[_0x50b2('0x80')]());return db[_0x50b2('0x81')][_0x50b2('0x2f')](_0x36c8b4[_0x50b2('0x80')](),{'type':db['sequelize'][_0x50b2('0x82')][_0x50b2('0x83')]});}})[_0x50b2('0x21')](respondWithResult(_0xfc6a64,null))[_0x50b2('0x40')](handleError(_0xfc6a64,null));};function runReport(_0x427415,_0x1694f1,_0x423468){var _0x1cceff=_0x1694f1[_0x50b2('0x26')];var _0x661785=0xa;var _0xe81c02=[_0x50b2('0x50'),'left_join','right_join',_0x50b2('0x53')];var _0x4cf7e7={'SUM':_0x50b2('0x54'),'COUNT':_0x50b2('0x55'),'COUNT DISTINCT':_0x50b2('0x56'),'MAX':_0x50b2('0x57'),'MIN':'MIN(%s)','AVG':_0x50b2('0x59'),'GROUP_CONCAT':_0x50b2('0x5a'),'GROUP_CONCAT ASC':_0x50b2('0x5b'),'GROUP_CONCAT DESC':_0x50b2('0x5c')};var _0x2e8965={'SEC_TO_TIME':_0x50b2('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x50b2('0x84'),'UNIX_TIMESTAMP':_0x50b2('0x85')};var _0x350a70=function(_0x1a60f8){return!_[_0x50b2('0x60')]([_0x50b2('0x86'),'IS\x20NOT\x20NULL',_0x50b2('0x87'),'IS\x20NOT\x20EMPTY'],_0x1a60f8);};var _0x382c74=function(_0x5792e7){if(!_0x5792e7||!_0x5792e7[_0x50b2('0x62')]['length']){return'';}for(var _0xfea7b7='(',_0x43910a=0x0;_0x43910a<_0x5792e7[_0x50b2('0x62')][_0x50b2('0x43')];_0x43910a+=0x1){_0x43910a>0x0&&(_0xfea7b7+='\x20'+_0x5792e7[_0x50b2('0x88')]+'\x20');_0xfea7b7+=_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x63')]?_0x382c74(_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x63')]):_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x6f')]+'\x20'+_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x64')]+(_0x350a70(_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x64')])?'\x20'+_0x5792e7[_0x50b2('0x62')][_0x43910a]['value']:'');}return _0xfea7b7+')';};var _0xbe66c6={'where':{'id':_0x427415['id']}},_0x5ee380,_0xcde634,_0x19b392,_0x2698b7,_0x43ec67;_0xbe66c6=_[_0x50b2('0x45')]({},_0xbe66c6,_0x423468);return db['AnalyticCustomReport'][_0x50b2('0x46')](_0xbe66c6)[_0x50b2('0x21')](function(_0x3c06c1){if(_0x3c06c1){_0x5ee380=_0x3c06c1;return _0x3c06c1[_0x50b2('0x66')]();}return null;})[_0x50b2('0x21')](function(_0x50af09){if(_0x50af09){if(!_0x50af09[_0x50b2('0x43')]){throw new db[(_0x50b2('0x67'))][(_0x50b2('0x68'))](_0x50b2('0x69'),0x193);}_0xcde634=_0x50af09;return db[_0x50b2('0x6a')][_0x50b2('0x89')]({'raw':!![]});}return null;})[_0x50b2('0x21')](function(_0x2d72a1){if(_0x2d72a1){_0x19b392=_['keyBy'](_0x2d72a1,'id');var _0x2db0d1;var _0x3895c6=squel[_0x50b2('0x6b')]();_0x3895c6[_0x50b2('0x6c')](_0x5ee380[_0x50b2('0x6d')]);for(var _0x263b94=0x0;_0x263b94<_0xcde634[_0x50b2('0x43')];_0x263b94+=0x1){_0x2db0d1=_0xcde634[_0x263b94][_0x50b2('0x6e')]?_0x19b392[_0xcde634[_0x263b94]['MetricId']][_0x50b2('0x8a')]:_0xcde634[_0x263b94][_0x50b2('0x6f')];_0x2db0d1=_0xcde634[_0x263b94]['function']?_['replace'](_0x4cf7e7[_0xcde634[_0x263b94]['function']],'%s',_0x2db0d1):_0x2db0d1;_0x2db0d1=_0xcde634[_0x263b94][_0x50b2('0x72')]?_[_0x50b2('0x71')](_0x2e8965[_0xcde634[_0x263b94][_0x50b2('0x72')]],'%s',_0x2db0d1):_0x2db0d1;if(_0xcde634[_0x263b94]['groupBy']){_0x3895c6['group'](_0x2db0d1);}_0xcde634[_0x263b94]['orderBy']&&_0x3895c6[_0x50b2('0x37')](_0x2db0d1,_0xcde634[_0x263b94][_0x50b2('0x74')]==='DESC'?![]:!![]);_0x3895c6[_0x50b2('0x6f')](_0x2db0d1,_0xcde634[_0x263b94][_0x50b2('0x8b')]||_0x2db0d1);}if(_0x5ee380[_0x50b2('0x76')]){_0x5ee380[_0x50b2('0x76')]=JSON[_0x50b2('0x77')](_0x5ee380['joins']);for(var _0x5cc987=0x0;_0x5cc987<_0x5ee380[_0x50b2('0x76')][_0x50b2('0x43')];_0x5cc987+=0x1){if(_0x5ee380['joins'][_0x5cc987][_0x50b2('0x2c')]&&_['includes'](_0xe81c02,_0x5ee380[_0x50b2('0x76')][_0x5cc987]['type'])&&_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x7b')]&&_0x5ee380['joins'][_0x5cc987][_0x50b2('0x78')]&&_0x5ee380[_0x50b2('0x76')][_0x5cc987]['foreignKey']){_0x3895c6[_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x2c')]](_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x78')],null,util['format'](_0x50b2('0x7a'),_0x5ee380[_0x50b2('0x6d')],_0x5ee380[_0x50b2('0x76')][_0x5cc987]['parentKey'],_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x78')],_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x79')]));}}}if(_0x5ee380[_0x50b2('0x7c')]){_0x5ee380['conditions']=JSON[_0x50b2('0x77')](_0x5ee380[_0x50b2('0x7c')]);_0x3895c6[_0x50b2('0x3a')](_0x382c74(_0x5ee380['conditions']['group']));}_0x43ec67=_0x3895c6[_0x50b2('0x7d')]();_0x3895c6[_0x50b2('0x36')](_0x661785);_0x3895c6[_0x50b2('0x1b')](0x0);logger[_0x50b2('0x7e')](_0x50b2('0x7f'),_0x3895c6[_0x50b2('0x80')]());return db[_0x50b2('0x81')][_0x50b2('0x2f')](_0x3895c6[_0x50b2('0x80')](),{'type':db[_0x50b2('0x81')][_0x50b2('0x82')][_0x50b2('0x83')]});}})[_0x50b2('0x21')](function(_0xde6c9e){if(!_0xde6c9e['length']){throw new db[(_0x50b2('0x67'))][(_0x50b2('0x68'))](_0x50b2('0x8c'),0xcc);}if(_0x1694f1[_0x50b2('0x8d')]===_0x50b2('0x8e')){return null;}var _0x101165=_[_0x50b2('0x45')](_0x1694f1,{'name':_0x1694f1['fullPath']||_0x1694f1[_0x50b2('0x26')]||_0x5ee380['name'],'basename':_0x1cceff,'savename':util['format'](_0x50b2('0x8f'),_0x1694f1[_0x50b2('0x26')]||_0x5ee380[_0x50b2('0x26')],require(_0x50b2('0x90'))[_0x50b2('0x91')](0x4),_0x1694f1[_0x50b2('0x8d')]||_0x50b2('0x92')),'reportId':_0x5ee380['id'],'reportType':_0x50b2('0x93')});return db[_0x50b2('0x94')]['create'](_0x101165,{'raw':!![]});})[_0x50b2('0x21')](function(_0x5da4e0){if(_0x5ee380['table']===_0x50b2('0x95')){_0x43ec67[_0x50b2('0x3a')](_0x5ee380[_0x50b2('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1694f1[_0x50b2('0x96')],_0x1694f1[_0x50b2('0x97')]);}else{_0x43ec67[_0x50b2('0x3a')](_0x5ee380['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1694f1[_0x50b2('0x96')],_0x1694f1[_0x50b2('0x97')]);}if(_0x5da4e0){logger[_0x50b2('0x98')](_0x50b2('0x99'),_0x43ec67['toString']());require(_0x50b2('0x9a'))[_0x50b2('0x9b')](path['join'](__dirname,_0x50b2('0x9c'),_0x5da4e0[_0x50b2('0x8d')]),[_0x5da4e0['id'],_0x43ec67[_0x50b2('0x80')](),path[_0x50b2('0x50')](__dirname,_0x50b2('0x9d'),_0x5da4e0['savename']),_0x1cceff]);return _0x5da4e0;}else{var _0x392e48=squel[_0x50b2('0x6b')]();_0x392e48['from']('('+_0x43ec67['toString']()+')',_0x50b2('0x9e'));_0x392e48[_0x50b2('0x6f')](_0x50b2('0x9f'),_0x50b2('0x3d'));_0x43ec67[_0x50b2('0x36')](_0x1694f1['limit']||_0x661785);_0x43ec67[_0x50b2('0x1b')](_0x1694f1[_0x50b2('0x1b')]||0x0);return dbH['sequelize'][_0x50b2('0x2f')](_0x392e48[_0x50b2('0x80')](),{'type':dbH[_0x50b2('0x81')][_0x50b2('0x82')][_0x50b2('0x83')]})[_0x50b2('0x21')](function(_0x1b4840){if(!_0x1b4840[_0x50b2('0x43')]){_0x2698b7=0x0;}else{_0x2698b7=_0x1b4840[0x0][_0x50b2('0x3d')]||0x0;}return dbH['sequelize'][_0x50b2('0x2f')](_0x43ec67['toString'](),{'type':dbH[_0x50b2('0x81')]['QueryTypes'][_0x50b2('0x83')]});})[_0x50b2('0x21')](function(_0xf46d01){return{'rows':_0xf46d01||[],'count':_0x2698b7};});}});}exports['run']=function(_0x2b708c,_0x580d01){return runReport(_0x2b708c['params'],_0x2b708c['query'],_0x2b708c[_0x50b2('0x3c')])[_0x50b2('0x21')](respondWithResult(_0x580d01,null))[_0x50b2('0x40')](handleError(_0x580d01,null));};exports['runReport']=runReport;exports[_0x50b2('0x2f')]=function(_0x269158,_0x59a8d4){var _0x53edb2=0xa;var _0x4b86cb=[_0x50b2('0x50'),_0x50b2('0x51'),'right_join',_0x50b2('0x53')];var _0x550e94={'SUM':_0x50b2('0x54'),'COUNT':_0x50b2('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x50b2('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x50b2('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x50b2('0x5c')};var _0xa7f172={'SEC_TO_TIME':_0x50b2('0x5d'),'DATE':_0x50b2('0x5e'),'HOUR':_0x50b2('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x50b2('0x85')};var _0x419458=function(_0x468ebd){return!_['includes']([_0x50b2('0x86'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x468ebd);};var _0x15de59=function(_0x889ace){if(!_0x889ace||!_0x889ace['rules'][_0x50b2('0x43')]){return'';}for(var _0x15403a='(',_0x54a25f=0x0;_0x54a25f<_0x889ace[_0x50b2('0x62')][_0x50b2('0x43')];_0x54a25f+=0x1){_0x54a25f>0x0&&(_0x15403a+='\x20'+_0x889ace[_0x50b2('0x88')]+'\x20');_0x15403a+=_0x889ace['rules'][_0x54a25f]['group']?_0x15de59(_0x889ace[_0x50b2('0x62')][_0x54a25f]['group']):_0x889ace[_0x50b2('0x62')][_0x54a25f]['field']+'\x20'+_0x889ace[_0x50b2('0x62')][_0x54a25f]['condition']+(_0x419458(_0x889ace[_0x50b2('0x62')][_0x54a25f][_0x50b2('0x64')])?'\x20'+_0x889ace[_0x50b2('0x62')][_0x54a25f]['value']:'');}return _0x15403a+')';};var _0x519dfd={'where':{'id':_0x269158['params']['id']}},_0x4ca044,_0xa9de7,_0x29722e,_0xadd2d8,_0x5d4630;_0x519dfd=_[_0x50b2('0x45')]({},_0x519dfd,_0x269158[_0x50b2('0x3c')]);return db[_0x50b2('0x29')][_0x50b2('0x46')](_0x519dfd)[_0x50b2('0x21')](function(_0xa441b){if(_0xa441b){_0x4ca044=_0xa441b;return _0xa441b[_0x50b2('0x66')]();}return null;})[_0x50b2('0x21')](function(_0x4b9d29){if(_0x4b9d29){if(!_0x4b9d29[_0x50b2('0x43')]){throw new db[(_0x50b2('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa9de7=_0x4b9d29;return db[_0x50b2('0x6a')][_0x50b2('0x89')]({'raw':!![]});}return null;})[_0x50b2('0x21')](function(_0x51d28c){if(_0x51d28c){_0x29722e=_['keyBy'](_0x51d28c,'id');var _0x44303f;var _0x18c3e9=squel[_0x50b2('0x6b')]();_0x18c3e9['from'](_0x4ca044['table']);for(var _0x2a1f8d=0x0;_0x2a1f8d<_0xa9de7[_0x50b2('0x43')];_0x2a1f8d+=0x1){_0x44303f=_0xa9de7[_0x2a1f8d][_0x50b2('0x6e')]?_0x29722e[_0xa9de7[_0x2a1f8d][_0x50b2('0x6e')]]['metric']:_0xa9de7[_0x2a1f8d][_0x50b2('0x6f')];_0x44303f=_0xa9de7[_0x2a1f8d][_0x50b2('0x70')]?_[_0x50b2('0x71')](_0x550e94[_0xa9de7[_0x2a1f8d][_0x50b2('0x70')]],'%s',_0x44303f):_0x44303f;_0x44303f=_0xa9de7[_0x2a1f8d][_0x50b2('0x72')]?_[_0x50b2('0x71')](_0xa7f172[_0xa9de7[_0x2a1f8d][_0x50b2('0x72')]],'%s',_0x44303f):_0x44303f;if(_0xa9de7[_0x2a1f8d][_0x50b2('0x73')]){_0x18c3e9[_0x50b2('0x63')](_0x44303f);}_0xa9de7[_0x2a1f8d][_0x50b2('0x74')]&&_0x18c3e9[_0x50b2('0x37')](_0x44303f,_0xa9de7[_0x2a1f8d]['orderBy']===_0x50b2('0x75')?![]:!![]);_0x18c3e9['field'](_0x44303f,_0xa9de7[_0x2a1f8d][_0x50b2('0x8b')]||_0x44303f);}if(_0x4ca044[_0x50b2('0x76')]){_0x4ca044[_0x50b2('0x76')]=JSON['parse'](_0x4ca044['joins']);for(var _0x5a525e=0x0;_0x5a525e<_0x4ca044[_0x50b2('0x76')]['length'];_0x5a525e+=0x1){if(_0x4ca044['joins'][_0x5a525e][_0x50b2('0x2c')]&&_[_0x50b2('0x60')](_0x4b86cb,_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x2c')])&&_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x7b')]&&_0x4ca044[_0x50b2('0x76')][_0x5a525e]['foreignTable']&&_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x79')]){_0x18c3e9[_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x2c')]](_0x4ca044[_0x50b2('0x76')][_0x5a525e]['foreignTable'],null,util[_0x50b2('0x72')](_0x50b2('0x7a'),_0x4ca044[_0x50b2('0x6d')],_0x4ca044[_0x50b2('0x76')][_0x5a525e]['parentKey'],_0x4ca044['joins'][_0x5a525e][_0x50b2('0x78')],_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x79')]));}}}if(_0x4ca044[_0x50b2('0x7c')]){_0x4ca044[_0x50b2('0x7c')]=JSON[_0x50b2('0x77')](_0x4ca044[_0x50b2('0x7c')]);_0x18c3e9['where'](_0x15de59(_0x4ca044[_0x50b2('0x7c')]['group']));}_0x5d4630=_0x18c3e9['clone']();_0x18c3e9[_0x50b2('0x36')](_0x53edb2);_0x18c3e9['offset'](0x0);logger[_0x50b2('0x7e')](_0x50b2('0x7f'),_0x18c3e9['toString']());return db[_0x50b2('0x81')][_0x50b2('0x2f')](_0x18c3e9[_0x50b2('0x80')](),{'type':db['sequelize'][_0x50b2('0x82')][_0x50b2('0x83')]});}})[_0x50b2('0x21')](function(){return{'sql':_0x5d4630[_0x50b2('0x80')]()};})[_0x50b2('0x21')](respondWithResult(_0x59a8d4,null))['catch'](handleError(_0x59a8d4,null));}; \ No newline at end of file +var _0x6822=['rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','toString','sequelize','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','getFields','AnalyticMetric','function','alias','QueryTypes','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','runReport','IS\x20NOT\x20NULL','clone','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','length','includeAll','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL'];(function(_0x3cc6df,_0x23e15b){var _0x53a5bb=function(_0x197f96){while(--_0x197f96){_0x3cc6df['push'](_0x3cc6df['shift']());}};_0x53a5bb(++_0x23e15b);}(_0x6822,0x18c));var _0x2682=function(_0x27aad0,_0x639ce7){_0x27aad0=_0x27aad0-0x0;var _0x4d9ace=_0x6822[_0x27aad0];return _0x4d9ace;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2682('0x0'));var rimraf=require(_0x2682('0x1'));var zipdir=require(_0x2682('0x2'));var jsonpatch=require(_0x2682('0x3'));var rp=require('request-promise');var moment=require(_0x2682('0x4'));var BPromise=require(_0x2682('0x5'));var Mustache=require(_0x2682('0x6'));var util=require(_0x2682('0x7'));var path=require(_0x2682('0x8'));var sox=require(_0x2682('0x9'));var csv=require(_0x2682('0xa'));var ejs=require(_0x2682('0xb'));var fs=require('fs');var _=require(_0x2682('0xc'));var squel=require(_0x2682('0xd'));var crypto=require(_0x2682('0xe'));var jsforce=require(_0x2682('0xf'));var deskjs=require(_0x2682('0x10'));var toCsv=require(_0x2682('0xa'));var querystring=require('querystring');var Papa=require(_0x2682('0x11'));var Redis=require(_0x2682('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2682('0x13'));var logger=require(_0x2682('0x14'))('api');var utils=require(_0x2682('0x15'));var config=require(_0x2682('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2682('0x17'))[_0x2682('0x18')];function respondWithStatusCode(_0x1feca6,_0x2cd01f){_0x2cd01f=_0x2cd01f||0xcc;return function(_0x3227f9){if(_0x3227f9){return _0x1feca6[_0x2682('0x19')](_0x2cd01f);}return _0x1feca6[_0x2682('0x1a')](_0x2cd01f)[_0x2682('0x1b')]();};}function respondWithResult(_0xfb9e0c,_0x18dab9){_0x18dab9=_0x18dab9||0xc8;return function(_0x4a7e21){if(_0x4a7e21){return _0xfb9e0c[_0x2682('0x1a')](_0x18dab9)[_0x2682('0x1c')](_0x4a7e21);}};}function respondWithFilteredResult(_0x1ac17b,_0x212aaf){return function(_0x545ba8){if(_0x545ba8){var _0x52a80d=_0x545ba8['count'],_0x2ce295=_0x212aaf[_0x2682('0x1d')],_0x2b1ed2=_0x212aaf['offset']+_0x212aaf[_0x2682('0x1e')],_0x602eec;if(_0x2b1ed2>=_0x52a80d){_0x2b1ed2=_0x52a80d;_0x602eec=0xc8;}else{_0x602eec=0xce;}_0x1ac17b[_0x2682('0x1a')](_0x602eec);return _0x1ac17b[_0x2682('0x1f')](_0x2682('0x20'),_0x2ce295+'-'+_0x2b1ed2+'/'+_0x52a80d)[_0x2682('0x1c')](_0x545ba8);}return null;};}function patchUpdates(_0x34cf1d){return function(_0x554b57){try{jsonpatch[_0x2682('0x21')](_0x554b57,_0x34cf1d,!![]);}catch(_0x516525){return BPromise[_0x2682('0x22')](_0x516525);}return _0x554b57[_0x2682('0x23')]();};}function saveUpdates(_0x348924,_0x20ae5b){return function(_0x23641e){if(_0x23641e){return _0x23641e[_0x2682('0x24')](_0x348924)[_0x2682('0x25')](function(_0x49c98a){return _0x49c98a;});}return null;};}function removeEntity(_0x57ae26,_0x599726){return function(_0x3ed75d){if(_0x3ed75d){return _0x3ed75d[_0x2682('0x26')]()['then'](function(){var _0xa27b38=_0x3ed75d[_0x2682('0x27')]({'plain':!![]});var _0x2b2d81=_0x2682('0x28');return db['UserProfileResource'][_0x2682('0x26')]({'where':{'type':_0x2b2d81,'resourceId':_0xa27b38['id']}})[_0x2682('0x25')](function(){return _0x3ed75d;});})[_0x2682('0x25')](function(){_0x57ae26[_0x2682('0x1a')](0xcc)[_0x2682('0x1b')]();});}};}function handleEntityNotFound(_0x2accf0,_0x5d325b){return function(_0x4afd1d){if(!_0x4afd1d){_0x2accf0['sendStatus'](0x194);}return _0x4afd1d;};}function handleError(_0x576352,_0x273201){_0x273201=_0x273201||0x1f4;return function(_0x385c1c){logger[_0x2682('0x29')](_0x385c1c[_0x2682('0x2a')]);if(_0x385c1c[_0x2682('0x2b')]){delete _0x385c1c[_0x2682('0x2b')];}_0x576352[_0x2682('0x1a')](_0x273201)[_0x2682('0x2c')](_0x385c1c);};}exports['index']=function(_0x9384b5,_0x8b809b){var _0x545543={},_0x19bb3d={},_0x193df4={'count':0x0,'rows':[]};var _0x3b5fcd=_[_0x2682('0x2d')](db[_0x2682('0x2e')][_0x2682('0x2f')],function(_0x3a417f){return{'name':_0x3a417f[_0x2682('0x30')],'type':_0x3a417f[_0x2682('0x31')][_0x2682('0x32')]};});_0x19bb3d[_0x2682('0x33')]=_['map'](_0x3b5fcd,_0x2682('0x2b'));_0x19bb3d[_0x2682('0x34')]=_[_0x2682('0x35')](_0x9384b5[_0x2682('0x34')]);_0x19bb3d[_0x2682('0x36')]=_['intersection'](_0x19bb3d['model'],_0x19bb3d[_0x2682('0x34')]);_0x545543[_0x2682('0x37')]=_[_0x2682('0x38')](_0x19bb3d['model'],qs[_0x2682('0x39')](_0x9384b5[_0x2682('0x34')][_0x2682('0x39')]));_0x545543[_0x2682('0x37')]=_0x545543['attributes']['length']?_0x545543[_0x2682('0x37')]:_0x19bb3d['model'];if(!_0x9384b5[_0x2682('0x34')][_0x2682('0x3a')](_0x2682('0x3b'))){_0x545543[_0x2682('0x1e')]=qs[_0x2682('0x1e')](_0x9384b5[_0x2682('0x34')]['limit']);_0x545543['offset']=qs[_0x2682('0x1d')](_0x9384b5['query'][_0x2682('0x1d')]);}_0x545543[_0x2682('0x3c')]=qs[_0x2682('0x3d')](_0x9384b5[_0x2682('0x34')][_0x2682('0x3d')]);_0x545543[_0x2682('0x3e')]=qs[_0x2682('0x36')](_[_0x2682('0x3f')](_0x9384b5[_0x2682('0x34')],_0x19bb3d[_0x2682('0x36')]),_0x3b5fcd);if(_0x9384b5['query'][_0x2682('0x40')]){_0x545543['where']=_['merge'](_0x545543[_0x2682('0x3e')],{'$or':_[_0x2682('0x2d')](_0x3b5fcd,function(_0x3ea618){if(_0x3ea618[_0x2682('0x31')]!==_0x2682('0x41')){var _0x92192d={};_0x92192d[_0x3ea618['name']]={'$like':'%'+_0x9384b5[_0x2682('0x34')][_0x2682('0x40')]+'%'};return _0x92192d;}})});}_0x545543=_[_0x2682('0x42')]({},_0x545543,_0x9384b5[_0x2682('0x43')]);var _0x142ee2={'where':_0x545543['where']};return db[_0x2682('0x2e')]['count'](_0x142ee2)[_0x2682('0x25')](function(_0x4e5175){_0x193df4[_0x2682('0x44')]=_0x4e5175;if(_0x9384b5[_0x2682('0x34')]['includeAll']){_0x545543[_0x2682('0x45')]=[{'all':!![]}];}return db[_0x2682('0x2e')][_0x2682('0x46')](_0x545543);})[_0x2682('0x25')](function(_0x1c1c32){_0x193df4[_0x2682('0x47')]=_0x1c1c32;return _0x193df4;})[_0x2682('0x25')](respondWithFilteredResult(_0x8b809b,_0x545543))[_0x2682('0x48')](handleError(_0x8b809b,null));};exports[_0x2682('0x49')]=function(_0x16ba45,_0x2fec5e){var _0x1b4161={'raw':![],'where':{'id':_0x16ba45['params']['id']}},_0x579687={};_0x579687[_0x2682('0x33')]=_[_0x2682('0x35')](db[_0x2682('0x2e')][_0x2682('0x2f')]);_0x579687[_0x2682('0x34')]=_[_0x2682('0x35')](_0x16ba45[_0x2682('0x34')]);_0x579687['filters']=_['intersection'](_0x579687[_0x2682('0x33')],_0x579687[_0x2682('0x34')]);_0x1b4161[_0x2682('0x37')]=_[_0x2682('0x38')](_0x579687[_0x2682('0x33')],qs['fields'](_0x16ba45['query'][_0x2682('0x39')]));_0x1b4161[_0x2682('0x37')]=_0x1b4161[_0x2682('0x37')][_0x2682('0x4a')]?_0x1b4161[_0x2682('0x37')]:_0x579687[_0x2682('0x33')];if(_0x16ba45[_0x2682('0x34')][_0x2682('0x4b')]){_0x1b4161[_0x2682('0x45')]=[{'all':!![]}];}_0x1b4161=_['merge']({},_0x1b4161,_0x16ba45[_0x2682('0x43')]);return db['AnalyticCustomReport']['find'](_0x1b4161)[_0x2682('0x25')](handleEntityNotFound(_0x2fec5e,null))[_0x2682('0x25')](respondWithResult(_0x2fec5e,null))['catch'](handleError(_0x2fec5e,null));};exports['create']=function(_0x2836b1,_0xd525e2){return db[_0x2682('0x2e')][_0x2682('0x4c')](_0x2836b1[_0x2682('0x4d')],{})[_0x2682('0x25')](function(_0x28805b){var _0x30b9fc=_0x2836b1[_0x2682('0x4e')][_0x2682('0x27')]({'plain':!![]});if(!_0x30b9fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30b9fc[_0x2682('0x4f')]===_0x2682('0x4e')){var _0x5bcf84=_0x28805b[_0x2682('0x27')]({'plain':!![]});var _0x608a0f='Reports';return db['UserProfileSection'][_0x2682('0x50')]({'where':{'name':_0x608a0f,'userProfileId':_0x30b9fc[_0x2682('0x51')]},'raw':!![]})[_0x2682('0x25')](function(_0x4412f8){if(_0x4412f8&&_0x4412f8[_0x2682('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x5bcf84[_0x2682('0x2b')],'resourceId':_0x5bcf84['id'],'type':_0x2682('0x28'),'sectionId':_0x4412f8['id']},{})[_0x2682('0x25')](function(){return _0x28805b;});}else{return _0x28805b;}})['catch'](function(_0x7e2a88){logger['error'](_0x2682('0x53'),_0x7e2a88);throw _0x7e2a88;});}return _0x28805b;})[_0x2682('0x25')](respondWithResult(_0xd525e2,0xc9))['catch'](handleError(_0xd525e2,null));};exports[_0x2682('0x24')]=function(_0x11f5f0,_0x21874b){if(_0x11f5f0[_0x2682('0x4d')]['id']){delete _0x11f5f0[_0x2682('0x4d')]['id'];}return db[_0x2682('0x2e')]['find']({'where':{'id':_0x11f5f0['params']['id']}})[_0x2682('0x25')](handleEntityNotFound(_0x21874b,null))['then'](saveUpdates(_0x11f5f0[_0x2682('0x4d')],null))[_0x2682('0x25')](respondWithResult(_0x21874b,null))[_0x2682('0x48')](handleError(_0x21874b,null));};exports['destroy']=function(_0x22f051,_0x5758aa){return db[_0x2682('0x2e')][_0x2682('0x50')]({'where':{'id':_0x22f051[_0x2682('0x54')]['id']}})[_0x2682('0x25')](handleEntityNotFound(_0x5758aa,null))[_0x2682('0x25')](removeEntity(_0x5758aa,null))[_0x2682('0x48')](handleError(_0x5758aa,null));};exports[_0x2682('0x55')]=function(_0x4f0d54,_0x5e71b4){var _0x5a2442=0xa;var _0x524e5b=['join',_0x2682('0x56'),_0x2682('0x57'),_0x2682('0x58')];var _0x24ac62={'SUM':_0x2682('0x59'),'COUNT':_0x2682('0x5a'),'COUNT DISTINCT':_0x2682('0x5b'),'MAX':_0x2682('0x5c'),'MIN':_0x2682('0x5d'),'AVG':_0x2682('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2682('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x22c4ac={'SEC_TO_TIME':_0x2682('0x60'),'DATE':'DATE(%s)','HOUR':_0x2682('0x61'),'ROUND':_0x2682('0x62'),'UNIX_TIMESTAMP':_0x2682('0x63')};var _0x52e6ca=function(_0x479326){return!_[_0x2682('0x64')]([_0x2682('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x479326);};var _0x4f7f20=function(_0x372ada){if(!_0x372ada||!_0x372ada[_0x2682('0x66')][_0x2682('0x4a')]){return'';}for(var _0x3aa9dd='(',_0x1f2bb2=0x0;_0x1f2bb2<_0x372ada[_0x2682('0x66')][_0x2682('0x4a')];_0x1f2bb2+=0x1){_0x1f2bb2>0x0&&(_0x3aa9dd+='\x20'+_0x372ada[_0x2682('0x67')]+'\x20');_0x3aa9dd+=_0x372ada[_0x2682('0x66')][_0x1f2bb2][_0x2682('0x68')]?_0x4f7f20(_0x372ada['rules'][_0x1f2bb2][_0x2682('0x68')]):_0x372ada[_0x2682('0x66')][_0x1f2bb2][_0x2682('0x69')]+'\x20'+_0x372ada[_0x2682('0x66')][_0x1f2bb2][_0x2682('0x6a')]+(_0x52e6ca(_0x372ada[_0x2682('0x66')][_0x1f2bb2]['condition'])?'\x20'+_0x372ada[_0x2682('0x66')][_0x1f2bb2][_0x2682('0x6b')]:'');}return _0x3aa9dd+')';};var _0x44a1e3={'where':{'id':_0x4f0d54[_0x2682('0x54')]['id']}},_0x45fdd4,_0x52e3cd,_0x57c9d1,_0x572b44,_0x3fe0f2;_0x44a1e3=_[_0x2682('0x42')]({},_0x44a1e3,_0x4f0d54[_0x2682('0x43')]);return db['AnalyticCustomReport']['find'](_0x44a1e3)[_0x2682('0x25')](function(_0x555ae9){if(_0x555ae9){_0x45fdd4=_0x555ae9;return _0x555ae9['getFields']();}return null;})['then'](function(_0x31f796){if(_0x31f796){if(!_0x31f796[_0x2682('0x4a')]){throw new db[(_0x2682('0x6c'))][(_0x2682('0x6d'))](_0x2682('0x6e'),0x193);}_0x52e3cd=_0x31f796;return db['AnalyticMetric'][_0x2682('0x46')]({'raw':!![]});}return null;})[_0x2682('0x25')](function(_0x3296ed){if(_0x3296ed){_0x57c9d1=_[_0x2682('0x6f')](_0x3296ed,'id');var _0x39e730;var _0x488c33=squel[_0x2682('0x70')]();_0x488c33[_0x2682('0x71')](_0x45fdd4['table']);for(var _0x3ebabe=0x0;_0x3ebabe<_0x52e3cd[_0x2682('0x4a')];_0x3ebabe+=0x1){_0x39e730=_0x52e3cd[_0x3ebabe]['MetricId']?_0x57c9d1[_0x52e3cd[_0x3ebabe][_0x2682('0x72')]][_0x2682('0x73')]:_0x52e3cd[_0x3ebabe][_0x2682('0x69')];_0x39e730=_0x52e3cd[_0x3ebabe]['function']?_[_0x2682('0x74')](_0x24ac62[_0x52e3cd[_0x3ebabe]['function']],'%s',_0x39e730):_0x39e730;_0x39e730=_0x52e3cd[_0x3ebabe]['format']?_['replace'](_0x22c4ac[_0x52e3cd[_0x3ebabe][_0x2682('0x75')]],'%s',_0x39e730):_0x39e730;if(_0x52e3cd[_0x3ebabe][_0x2682('0x76')]){_0x488c33['group'](_0x39e730);}_0x52e3cd[_0x3ebabe]['orderBy']&&_0x488c33[_0x2682('0x3c')](_0x39e730,_0x52e3cd[_0x3ebabe][_0x2682('0x77')]===_0x2682('0x78')?![]:!![]);_0x488c33['field'](_0x39e730,_0x52e3cd[_0x3ebabe]['alias']||_0x39e730);}if(_0x45fdd4[_0x2682('0x79')]){_0x45fdd4[_0x2682('0x79')]=JSON[_0x2682('0x7a')](_0x45fdd4['joins']);for(var _0x246d2a=0x0;_0x246d2a<_0x45fdd4[_0x2682('0x79')][_0x2682('0x4a')];_0x246d2a+=0x1){if(_0x45fdd4['joins'][_0x246d2a]['type']&&_['includes'](_0x524e5b,_0x45fdd4[_0x2682('0x79')][_0x246d2a]['type'])&&_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x7b')]&&_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x7c')]&&_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x7d')]){_0x488c33[_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x31')]](_0x45fdd4['joins'][_0x246d2a][_0x2682('0x7c')],null,util[_0x2682('0x75')](_0x2682('0x7e'),_0x45fdd4[_0x2682('0x7f')],_0x45fdd4['joins'][_0x246d2a]['parentKey'],_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x7c')],_0x45fdd4[_0x2682('0x79')][_0x246d2a]['foreignKey']));}}}if(_0x45fdd4['conditions']){_0x45fdd4[_0x2682('0x80')]=JSON['parse'](_0x45fdd4[_0x2682('0x80')]);_0x488c33[_0x2682('0x3e')](_0x4f7f20(_0x45fdd4['conditions'][_0x2682('0x68')]));}_0x3fe0f2=_0x488c33['clone']();_0x488c33[_0x2682('0x1e')](_0x5a2442);_0x488c33[_0x2682('0x1d')](0x0);logger[_0x2682('0x81')](_0x2682('0x82'),_0x488c33[_0x2682('0x83')]());return db[_0x2682('0x84')][_0x2682('0x34')](_0x488c33[_0x2682('0x83')](),{'type':db[_0x2682('0x84')]['QueryTypes']['SELECT']});}})[_0x2682('0x25')](respondWithResult(_0x5e71b4,null))[_0x2682('0x48')](handleError(_0x5e71b4,null));};function runReport(_0x1c1207,_0x3632c9,_0x421f1b){var _0x432c4c=_0x3632c9[_0x2682('0x2b')];var _0x50aad9=0xa;var _0x2598d7=[_0x2682('0x85'),'left_join',_0x2682('0x57'),_0x2682('0x58')];var _0xcf8e25={'SUM':_0x2682('0x59'),'COUNT':_0x2682('0x5a'),'COUNT DISTINCT':_0x2682('0x5b'),'MAX':_0x2682('0x5c'),'MIN':'MIN(%s)','AVG':_0x2682('0x5e'),'GROUP_CONCAT':_0x2682('0x86'),'GROUP_CONCAT ASC':_0x2682('0x5f'),'GROUP_CONCAT DESC':_0x2682('0x87')};var _0x100c0c={'SEC_TO_TIME':_0x2682('0x60'),'DATE':_0x2682('0x88'),'HOUR':'HOUR(%s)','ROUND':_0x2682('0x62'),'UNIX_TIMESTAMP':_0x2682('0x63')};var _0x25343d=function(_0x9fefff){return!_['includes']([_0x2682('0x65'),'IS\x20NOT\x20NULL',_0x2682('0x89'),_0x2682('0x8a')],_0x9fefff);};var _0x1fb763=function(_0x1c3ca7){if(!_0x1c3ca7||!_0x1c3ca7[_0x2682('0x66')][_0x2682('0x4a')]){return'';}for(var _0x487079='(',_0xd465be=0x0;_0xd465be<_0x1c3ca7[_0x2682('0x66')]['length'];_0xd465be+=0x1){_0xd465be>0x0&&(_0x487079+='\x20'+_0x1c3ca7['operator']+'\x20');_0x487079+=_0x1c3ca7['rules'][_0xd465be][_0x2682('0x68')]?_0x1fb763(_0x1c3ca7[_0x2682('0x66')][_0xd465be]['group']):_0x1c3ca7[_0x2682('0x66')][_0xd465be][_0x2682('0x69')]+'\x20'+_0x1c3ca7[_0x2682('0x66')][_0xd465be][_0x2682('0x6a')]+(_0x25343d(_0x1c3ca7[_0x2682('0x66')][_0xd465be]['condition'])?'\x20'+_0x1c3ca7[_0x2682('0x66')][_0xd465be][_0x2682('0x6b')]:'');}return _0x487079+')';};var _0x5a8e7a={'where':{'id':_0x1c1207['id']}},_0x4aaee2,_0x44bd07,_0x193e1c,_0x3e1ebd,_0x1c7120;_0x5a8e7a=_[_0x2682('0x42')]({},_0x5a8e7a,_0x421f1b);return db[_0x2682('0x2e')][_0x2682('0x50')](_0x5a8e7a)[_0x2682('0x25')](function(_0x3f194d){if(_0x3f194d){_0x4aaee2=_0x3f194d;return _0x3f194d[_0x2682('0x8b')]();}return null;})[_0x2682('0x25')](function(_0x3b13fd){if(_0x3b13fd){if(!_0x3b13fd['length']){throw new db[(_0x2682('0x6c'))][(_0x2682('0x6d'))](_0x2682('0x6e'),0x193);}_0x44bd07=_0x3b13fd;return db[_0x2682('0x8c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3b6b99){if(_0x3b6b99){_0x193e1c=_[_0x2682('0x6f')](_0x3b6b99,'id');var _0x4b1658;var _0x338d71=squel['select']();_0x338d71[_0x2682('0x71')](_0x4aaee2[_0x2682('0x7f')]);for(var _0x2842df=0x0;_0x2842df<_0x44bd07[_0x2682('0x4a')];_0x2842df+=0x1){_0x4b1658=_0x44bd07[_0x2842df]['MetricId']?_0x193e1c[_0x44bd07[_0x2842df][_0x2682('0x72')]]['metric']:_0x44bd07[_0x2842df]['field'];_0x4b1658=_0x44bd07[_0x2842df][_0x2682('0x8d')]?_[_0x2682('0x74')](_0xcf8e25[_0x44bd07[_0x2842df][_0x2682('0x8d')]],'%s',_0x4b1658):_0x4b1658;_0x4b1658=_0x44bd07[_0x2842df][_0x2682('0x75')]?_['replace'](_0x100c0c[_0x44bd07[_0x2842df][_0x2682('0x75')]],'%s',_0x4b1658):_0x4b1658;if(_0x44bd07[_0x2842df]['groupBy']){_0x338d71['group'](_0x4b1658);}_0x44bd07[_0x2842df][_0x2682('0x77')]&&_0x338d71[_0x2682('0x3c')](_0x4b1658,_0x44bd07[_0x2842df][_0x2682('0x77')]===_0x2682('0x78')?![]:!![]);_0x338d71['field'](_0x4b1658,_0x44bd07[_0x2842df][_0x2682('0x8e')]||_0x4b1658);}if(_0x4aaee2['joins']){_0x4aaee2[_0x2682('0x79')]=JSON[_0x2682('0x7a')](_0x4aaee2[_0x2682('0x79')]);for(var _0x24ca2e=0x0;_0x24ca2e<_0x4aaee2[_0x2682('0x79')][_0x2682('0x4a')];_0x24ca2e+=0x1){if(_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x31')]&&_[_0x2682('0x64')](_0x2598d7,_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x31')])&&_0x4aaee2['joins'][_0x24ca2e][_0x2682('0x7b')]&&_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7c')]&&_0x4aaee2[_0x2682('0x79')][_0x24ca2e]['foreignKey']){_0x338d71[_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x31')]](_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7c')],null,util[_0x2682('0x75')](_0x2682('0x7e'),_0x4aaee2[_0x2682('0x7f')],_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7b')],_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7c')],_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7d')]));}}}if(_0x4aaee2[_0x2682('0x80')]){_0x4aaee2[_0x2682('0x80')]=JSON[_0x2682('0x7a')](_0x4aaee2['conditions']);_0x338d71['where'](_0x1fb763(_0x4aaee2[_0x2682('0x80')][_0x2682('0x68')]));}_0x1c7120=_0x338d71['clone']();_0x338d71[_0x2682('0x1e')](_0x50aad9);_0x338d71['offset'](0x0);logger[_0x2682('0x81')](_0x2682('0x82'),_0x338d71[_0x2682('0x83')]());return db['sequelize'][_0x2682('0x34')](_0x338d71[_0x2682('0x83')](),{'type':db['sequelize'][_0x2682('0x8f')][_0x2682('0x90')]});}})[_0x2682('0x25')](function(_0x1a7103){if(!_0x1a7103[_0x2682('0x4a')]){throw new db['Sequelize'][(_0x2682('0x6d'))](_0x2682('0x91'),0xcc);}if(_0x3632c9[_0x2682('0x92')]===_0x2682('0x93')){return null;}var _0x34fdca=_[_0x2682('0x42')](_0x3632c9,{'name':_0x3632c9[_0x2682('0x94')]||_0x3632c9['name']||_0x4aaee2[_0x2682('0x2b')],'basename':_0x432c4c,'savename':util[_0x2682('0x75')](_0x2682('0x95'),_0x3632c9[_0x2682('0x2b')]||_0x4aaee2[_0x2682('0x2b')],require(_0x2682('0x96'))['generate'](0x4),_0x3632c9[_0x2682('0x92')]||'csv'),'reportId':_0x4aaee2['id'],'reportType':'custom'});return db[_0x2682('0x97')][_0x2682('0x4c')](_0x34fdca,{'raw':!![]});})[_0x2682('0x25')](function(_0x406a03){if(_0x4aaee2[_0x2682('0x7f')]===_0x2682('0x98')){_0x1c7120[_0x2682('0x3e')](_0x4aaee2[_0x2682('0x7f')]+_0x2682('0x99'),_0x3632c9['startDate'],_0x3632c9[_0x2682('0x9a')]);}else{_0x1c7120[_0x2682('0x3e')](_0x4aaee2['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3632c9[_0x2682('0x9b')],_0x3632c9['endDate']);}if(_0x406a03){logger['info'](_0x2682('0x9c'),_0x1c7120[_0x2682('0x83')]());require(_0x2682('0x9d'))[_0x2682('0x9e')](path[_0x2682('0x85')](__dirname,_0x2682('0x9f'),_0x406a03[_0x2682('0x92')]),[_0x406a03['id'],_0x1c7120[_0x2682('0x83')](),path[_0x2682('0x85')](__dirname,_0x2682('0xa0'),_0x406a03[_0x2682('0xa1')]),_0x432c4c]);return _0x406a03;}else{var _0x50abbc=squel[_0x2682('0x70')]();_0x50abbc['from']('('+_0x1c7120[_0x2682('0x83')]()+')','countTable');_0x50abbc[_0x2682('0x69')](_0x2682('0xa2'),_0x2682('0x44'));_0x1c7120[_0x2682('0x1e')](_0x3632c9[_0x2682('0x1e')]||_0x50aad9);_0x1c7120[_0x2682('0x1d')](_0x3632c9[_0x2682('0x1d')]||0x0);return dbH[_0x2682('0x84')][_0x2682('0x34')](_0x50abbc['toString'](),{'type':dbH[_0x2682('0x84')]['QueryTypes']['SELECT']})['then'](function(_0x1cffc4){if(!_0x1cffc4[_0x2682('0x4a')]){_0x3e1ebd=0x0;}else{_0x3e1ebd=_0x1cffc4[0x0]['count']||0x0;}return dbH['sequelize'][_0x2682('0x34')](_0x1c7120[_0x2682('0x83')](),{'type':dbH[_0x2682('0x84')][_0x2682('0x8f')][_0x2682('0x90')]});})[_0x2682('0x25')](function(_0x899a77){return{'rows':_0x899a77||[],'count':_0x3e1ebd};});}});}exports['run']=function(_0x195247,_0x2df0c1){return runReport(_0x195247['params'],_0x195247[_0x2682('0x34')],_0x195247[_0x2682('0x43')])[_0x2682('0x25')](respondWithResult(_0x2df0c1,null))[_0x2682('0x48')](handleError(_0x2df0c1,null));};exports[_0x2682('0xa3')]=runReport;exports[_0x2682('0x34')]=function(_0x487d43,_0x497dc0){var _0x2cbd24=0xa;var _0x240697=[_0x2682('0x85'),_0x2682('0x56'),_0x2682('0x57'),_0x2682('0x58')];var _0x3e8596={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2682('0x5b'),'MAX':'MAX(%s)','MIN':_0x2682('0x5d'),'AVG':_0x2682('0x5e'),'GROUP_CONCAT':_0x2682('0x86'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2682('0x87')};var _0x3ea97d={'SEC_TO_TIME':_0x2682('0x60'),'DATE':_0x2682('0x88'),'HOUR':'HOUR(%s)','ROUND':_0x2682('0x62'),'UNIX_TIMESTAMP':_0x2682('0x63')};var _0x131ab4=function(_0xba6663){return!_[_0x2682('0x64')]([_0x2682('0x65'),_0x2682('0xa4'),'IS\x20EMPTY',_0x2682('0x8a')],_0xba6663);};var _0x2b23a9=function(_0x19a993){if(!_0x19a993||!_0x19a993[_0x2682('0x66')][_0x2682('0x4a')]){return'';}for(var _0x5da5fc='(',_0x4b84de=0x0;_0x4b84de<_0x19a993[_0x2682('0x66')][_0x2682('0x4a')];_0x4b84de+=0x1){_0x4b84de>0x0&&(_0x5da5fc+='\x20'+_0x19a993[_0x2682('0x67')]+'\x20');_0x5da5fc+=_0x19a993[_0x2682('0x66')][_0x4b84de]['group']?_0x2b23a9(_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x68')]):_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x69')]+'\x20'+_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x6a')]+(_0x131ab4(_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x6a')])?'\x20'+_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x6b')]:'');}return _0x5da5fc+')';};var _0x4c8581={'where':{'id':_0x487d43[_0x2682('0x54')]['id']}},_0x5ff5f8,_0x78e9a2,_0x45cebd,_0x37d74c,_0x2d7d84;_0x4c8581=_['merge']({},_0x4c8581,_0x487d43['options']);return db[_0x2682('0x2e')][_0x2682('0x50')](_0x4c8581)[_0x2682('0x25')](function(_0x4c274a){if(_0x4c274a){_0x5ff5f8=_0x4c274a;return _0x4c274a[_0x2682('0x8b')]();}return null;})['then'](function(_0x4a3391){if(_0x4a3391){if(!_0x4a3391[_0x2682('0x4a')]){throw new db[(_0x2682('0x6c'))][(_0x2682('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x78e9a2=_0x4a3391;return db[_0x2682('0x8c')][_0x2682('0x46')]({'raw':!![]});}return null;})[_0x2682('0x25')](function(_0x2a23c0){if(_0x2a23c0){_0x45cebd=_[_0x2682('0x6f')](_0x2a23c0,'id');var _0x507b6a;var _0x49aa01=squel[_0x2682('0x70')]();_0x49aa01['from'](_0x5ff5f8['table']);for(var _0x105d3f=0x0;_0x105d3f<_0x78e9a2[_0x2682('0x4a')];_0x105d3f+=0x1){_0x507b6a=_0x78e9a2[_0x105d3f][_0x2682('0x72')]?_0x45cebd[_0x78e9a2[_0x105d3f]['MetricId']]['metric']:_0x78e9a2[_0x105d3f]['field'];_0x507b6a=_0x78e9a2[_0x105d3f][_0x2682('0x8d')]?_[_0x2682('0x74')](_0x3e8596[_0x78e9a2[_0x105d3f][_0x2682('0x8d')]],'%s',_0x507b6a):_0x507b6a;_0x507b6a=_0x78e9a2[_0x105d3f]['format']?_[_0x2682('0x74')](_0x3ea97d[_0x78e9a2[_0x105d3f][_0x2682('0x75')]],'%s',_0x507b6a):_0x507b6a;if(_0x78e9a2[_0x105d3f][_0x2682('0x76')]){_0x49aa01[_0x2682('0x68')](_0x507b6a);}_0x78e9a2[_0x105d3f]['orderBy']&&_0x49aa01[_0x2682('0x3c')](_0x507b6a,_0x78e9a2[_0x105d3f][_0x2682('0x77')]===_0x2682('0x78')?![]:!![]);_0x49aa01['field'](_0x507b6a,_0x78e9a2[_0x105d3f][_0x2682('0x8e')]||_0x507b6a);}if(_0x5ff5f8['joins']){_0x5ff5f8['joins']=JSON[_0x2682('0x7a')](_0x5ff5f8[_0x2682('0x79')]);for(var _0x31dfd7=0x0;_0x31dfd7<_0x5ff5f8['joins'][_0x2682('0x4a')];_0x31dfd7+=0x1){if(_0x5ff5f8['joins'][_0x31dfd7][_0x2682('0x31')]&&_[_0x2682('0x64')](_0x240697,_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x31')])&&_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7b')]&&_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7c')]&&_0x5ff5f8['joins'][_0x31dfd7][_0x2682('0x7d')]){_0x49aa01[_0x5ff5f8['joins'][_0x31dfd7]['type']](_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7c')],null,util['format'](_0x2682('0x7e'),_0x5ff5f8['table'],_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7b')],_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7c')],_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7d')]));}}}if(_0x5ff5f8['conditions']){_0x5ff5f8[_0x2682('0x80')]=JSON[_0x2682('0x7a')](_0x5ff5f8[_0x2682('0x80')]);_0x49aa01['where'](_0x2b23a9(_0x5ff5f8[_0x2682('0x80')][_0x2682('0x68')]));}_0x2d7d84=_0x49aa01[_0x2682('0xa5')]();_0x49aa01[_0x2682('0x1e')](_0x2cbd24);_0x49aa01[_0x2682('0x1d')](0x0);logger[_0x2682('0x81')]('Limited\x20Query:',_0x49aa01[_0x2682('0x83')]());return db[_0x2682('0x84')][_0x2682('0x34')](_0x49aa01[_0x2682('0x83')](),{'type':db[_0x2682('0x84')][_0x2682('0x8f')][_0x2682('0x90')]});}})[_0x2682('0x25')](function(){return{'sql':_0x2d7d84['toString']()};})[_0x2682('0x25')](respondWithResult(_0x497dc0,null))[_0x2682('0x48')](handleError(_0x497dc0,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index b182e6f..8a8ff75 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 _0xd1aa=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','api','moment','bluebird','path'];(function(_0x539ef5,_0xff6d0f){var _0x4dbf96=function(_0x221237){while(--_0x221237){_0x539ef5['push'](_0x539ef5['shift']());}};_0x4dbf96(++_0xff6d0f);}(_0xd1aa,0x13f));var _0xad1a=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xd1aa[_0x59b439];return _0x521ea3;};'use strict';var _=require(_0xad1a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xad1a('0x1'));var moment=require(_0xad1a('0x2'));var BPromise=require(_0xad1a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad1a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xad1a('0x5'));module['exports']=function(_0x1efc05,_0x8b8043){return _0x1efc05[_0xad1a('0x6')](_0xad1a('0x7'),attributes,{'tableName':_0xad1a('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09f3=['api','moment','bluebird','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger'];(function(_0x3221f9,_0x3e0f4d){var _0x1ef09f=function(_0x29ef95){while(--_0x29ef95){_0x3221f9['push'](_0x3221f9['shift']());}};_0x1ef09f(++_0x3e0f4d);}(_0x09f3,0x1c5));var _0x309f=function(_0x4efe55,_0x6174ea){_0x4efe55=_0x4efe55-0x0;var _0x3a15da=_0x09f3[_0x4efe55];return _0x3a15da;};'use strict';var _=require(_0x309f('0x0'));var util=require(_0x309f('0x1'));var logger=require(_0x309f('0x2'))(_0x309f('0x3'));var moment=require(_0x309f('0x4'));var BPromise=require(_0x309f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x309f('0x6'));var rimraf=require('rimraf');var config=require(_0x309f('0x7'));var attributes=require(_0x309f('0x8'));module[_0x309f('0x9')]=function(_0xfd7e34,_0x107510){return _0xfd7e34[_0x309f('0xa')](_0x309f('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index bc84804..b80ac63 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 _0xb4d0=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x18e196,_0x2ddc7f){var _0x4e775d=function(_0x357f99){while(--_0x357f99){_0x18e196['push'](_0x18e196['shift']());}};_0x4e775d(++_0x2ddc7f);}(_0xb4d0,0xe4));var _0x0b4d=function(_0x204f31,_0x1d9b04){_0x204f31=_0x204f31-0x0;var _0x4c0106=_0xb4d0[_0x204f31];return _0x4c0106;};'use strict';var _=require('lodash');var util=require(_0x0b4d('0x0'));var moment=require(_0x0b4d('0x1'));var BPromise=require(_0x0b4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b4d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b4d('0x4'));var logger=require(_0x0b4d('0x5'))(_0x0b4d('0x6'));var config=require('../../config/environment');var jayson=require(_0x0b4d('0x7'));var client=jayson[_0x0b4d('0x8')][_0x0b4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e5ca4,_0x5236e0,_0x2ea95f){return new BPromise(function(_0x39c4fd,_0x24d6f2){return client[_0x0b4d('0xa')](_0x1e5ca4,_0x2ea95f)[_0x0b4d('0xb')](function(_0x5cc06c){logger['info'](_0x0b4d('0xc'),_0x5236e0,_0x0b4d('0xd'));logger[_0x0b4d('0xe')](_0x0b4d('0xf'),_0x5236e0,_0x0b4d('0xd'),JSON[_0x0b4d('0x10')](_0x5cc06c));if(_0x5cc06c['error']){if(_0x5cc06c[_0x0b4d('0x11')]['code']===0x1f4){logger[_0x0b4d('0x11')](_0x0b4d('0xc'),_0x5236e0,_0x5cc06c[_0x0b4d('0x11')][_0x0b4d('0x12')]);return _0x24d6f2(_0x5cc06c[_0x0b4d('0x11')][_0x0b4d('0x12')]);}logger[_0x0b4d('0x11')](_0x0b4d('0xc'),_0x5236e0,_0x5cc06c[_0x0b4d('0x11')][_0x0b4d('0x12')]);return _0x39c4fd(_0x5cc06c[_0x0b4d('0x11')][_0x0b4d('0x12')]);}else{logger[_0x0b4d('0x13')](_0x0b4d('0xc'),_0x5236e0,'request\x20sent');_0x39c4fd(_0x5cc06c[_0x0b4d('0x14')][_0x0b4d('0x12')]);}})[_0x0b4d('0x15')](function(_0x35386f){logger[_0x0b4d('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5236e0,_0x35386f);_0x24d6f2(_0x35386f);});});} \ No newline at end of file +var _0xb7c2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x1391dc,_0x5b62f5){var _0x4787e4=function(_0x337028){while(--_0x337028){_0x1391dc['push'](_0x1391dc['shift']());}};_0x4787e4(++_0x5b62f5);}(_0xb7c2,0x16c));var _0x2b7c=function(_0x15bd6b,_0x338b15){_0x15bd6b=_0x15bd6b-0x0;var _0x3a270f=_0xb7c2[_0x15bd6b];return _0x3a270f;};'use strict';var _=require(_0x2b7c('0x0'));var util=require('util');var moment=require(_0x2b7c('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b7c('0x2'));var fs=require('fs');var Redis=require(_0x2b7c('0x3'));var db=require(_0x2b7c('0x4'))['db'];var utils=require(_0x2b7c('0x5'));var logger=require(_0x2b7c('0x6'))(_0x2b7c('0x7'));var config=require(_0x2b7c('0x8'));var jayson=require(_0x2b7c('0x9'));var client=jayson['client'][_0x2b7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa67380,_0x1485cd,_0x43dc07){return new BPromise(function(_0x4ccaea,_0x81287){return client[_0x2b7c('0xb')](_0xa67380,_0x43dc07)['then'](function(_0x546e62){logger[_0x2b7c('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1485cd,_0x2b7c('0xd'));logger[_0x2b7c('0xe')](_0x2b7c('0xf'),_0x1485cd,_0x2b7c('0xd'),JSON[_0x2b7c('0x10')](_0x546e62));if(_0x546e62[_0x2b7c('0x11')]){if(_0x546e62[_0x2b7c('0x11')][_0x2b7c('0x12')]===0x1f4){logger[_0x2b7c('0x11')](_0x2b7c('0x13'),_0x1485cd,_0x546e62['error'][_0x2b7c('0x14')]);return _0x81287(_0x546e62['error'][_0x2b7c('0x14')]);}logger[_0x2b7c('0x11')](_0x2b7c('0x13'),_0x1485cd,_0x546e62['error'][_0x2b7c('0x14')]);return _0x4ccaea(_0x546e62[_0x2b7c('0x11')]['message']);}else{logger[_0x2b7c('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1485cd,_0x2b7c('0xd'));_0x4ccaea(_0x546e62[_0x2b7c('0x15')]['message']);}})[_0x2b7c('0x16')](function(_0x33a196){logger[_0x2b7c('0x11')](_0x2b7c('0x13'),_0x1485cd,_0x33a196);_0x81287(_0x33a196);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index e3fdc85..1645c9e 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 _0x8cb2=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','/:id/preview','isAuthenticated','preview','run','/:id/query','query','create','put','update','delete','exports'];(function(_0x21fc96,_0x2df0fe){var _0x2e00b0=function(_0x439cde){while(--_0x439cde){_0x21fc96['push'](_0x21fc96['shift']());}};_0x2e00b0(++_0x2df0fe);}(_0x8cb2,0x14a));var _0x28cb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8cb2[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x28cb('0x0'));var util=require(_0x28cb('0x1'));var path=require(_0x28cb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x28cb('0x3')]();var auth=require(_0x28cb('0x4'));var interaction=require(_0x28cb('0x5'));var config=require(_0x28cb('0x6'));var controller=require(_0x28cb('0x7'));router[_0x28cb('0x8')]('/',auth['isAuthenticated'](),controller[_0x28cb('0x9')]);router[_0x28cb('0x8')](_0x28cb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x28cb('0x8')](_0x28cb('0xb'),auth[_0x28cb('0xc')](),controller[_0x28cb('0xd')]);router[_0x28cb('0x8')]('/:id/run',auth[_0x28cb('0xc')](),controller[_0x28cb('0xe')]);router[_0x28cb('0x8')](_0x28cb('0xf'),auth['isAuthenticated'](),controller[_0x28cb('0x10')]);router['post']('/',auth[_0x28cb('0xc')](),controller[_0x28cb('0x11')]);router[_0x28cb('0x12')](_0x28cb('0xa'),auth[_0x28cb('0xc')](),controller[_0x28cb('0x13')]);router[_0x28cb('0x14')](_0x28cb('0xa'),auth[_0x28cb('0xc')](),controller['destroy']);module[_0x28cb('0x15')]=router; \ No newline at end of file +var _0xc012=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','exports','multer','path'];(function(_0x386f6e,_0x39c2a9){var _0x188b53=function(_0x4d57e8){while(--_0x4d57e8){_0x386f6e['push'](_0x386f6e['shift']());}};_0x188b53(++_0x39c2a9);}(_0xc012,0x1f2));var _0x2c01=function(_0x372b16,_0x5b8c43){_0x372b16=_0x372b16-0x0;var _0x4d261a=_0xc012[_0x372b16];return _0x4d261a;};'use strict';var multer=require(_0x2c01('0x0'));var util=require('util');var path=require(_0x2c01('0x1'));var timeout=require(_0x2c01('0x2'));var express=require(_0x2c01('0x3'));var router=express[_0x2c01('0x4')]();var auth=require(_0x2c01('0x5'));var interaction=require(_0x2c01('0x6'));var config=require(_0x2c01('0x7'));var controller=require(_0x2c01('0x8'));router[_0x2c01('0x9')]('/',auth[_0x2c01('0xa')](),controller[_0x2c01('0xb')]);router['get'](_0x2c01('0xc'),auth[_0x2c01('0xa')](),controller[_0x2c01('0xd')]);router['get']('/:id/preview',auth[_0x2c01('0xa')](),controller[_0x2c01('0xe')]);router[_0x2c01('0x9')](_0x2c01('0xf'),auth[_0x2c01('0xa')](),controller[_0x2c01('0x10')]);router['get'](_0x2c01('0x11'),auth[_0x2c01('0xa')](),controller[_0x2c01('0x12')]);router[_0x2c01('0x13')]('/',auth[_0x2c01('0xa')](),controller[_0x2c01('0x14')]);router[_0x2c01('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2c01('0x16')]);router['delete'](_0x2c01('0xc'),auth['isAuthenticated'](),controller[_0x2c01('0x17')]);module[_0x2c01('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 7d9172c..a0cd34a 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 _0x24c2=['sequelize','exports','STRING','TEXT'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x24c2,0x138));var _0x224c=function(_0x3bd4ec,_0x4cb5ce){_0x3bd4ec=_0x3bd4ec-0x0;var _0x5062dc=_0x24c2[_0x3bd4ec];return _0x5062dc;};'use strict';var Sequelize=require(_0x224c('0x0'));module[_0x224c('0x1')]={'name':{'type':Sequelize[_0x224c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x224c('0x2')]},'table':{'type':Sequelize[_0x224c('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x224c('0x3')]}}; \ No newline at end of file +var _0xb8e2=['STRING','TEXT','sequelize','exports'];(function(_0x314b28,_0x162e01){var _0x5b43a5=function(_0x581367){while(--_0x581367){_0x314b28['push'](_0x314b28['shift']());}};_0x5b43a5(++_0x162e01);}(_0xb8e2,0xb6));var _0x2b8e=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xb8e2[_0x445101];return _0x3c3d04;};'use strict';var Sequelize=require(_0x2b8e('0x0'));module[_0x2b8e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2b8e('0x2')]},'parent':{'type':Sequelize[_0x2b8e('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x2b8e('0x3')]},'joins':{'type':Sequelize[_0x2b8e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9d05e98..1fd44b2 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 _0x43d8=['%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','operator','value','getFields','ValidationErrorItem','AnalyticMetric','metric','No\x20available\x20data','output','web','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','savename','COUNT(*)','runReport','SEC_TO_TIME(%s)','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','get','UserProfileResource','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Reports','UserProfileSection','userProfileId','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','select','from','table','MetricId','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','foreignKey','foreignTable'];(function(_0x10d73c,_0x29a737){var _0x283c9e=function(_0x6ab160){while(--_0x6ab160){_0x10d73c['push'](_0x10d73c['shift']());}};_0x283c9e(++_0x29a737);}(_0x43d8,0xc0));var _0x843d=function(_0x5303b9,_0x5c548){_0x5303b9=_0x5303b9-0x0;var _0x455125=_0x43d8[_0x5303b9];return _0x455125;};'use strict';var pdf=require(_0x843d('0x0'));var emlformat=require(_0x843d('0x1'));var rimraf=require(_0x843d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x843d('0x3'));var moment=require(_0x843d('0x4'));var BPromise=require(_0x843d('0x5'));var Mustache=require(_0x843d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x843d('0x7'));var csv=require(_0x843d('0x8'));var ejs=require(_0x843d('0x9'));var fs=require('fs');var _=require(_0x843d('0xa'));var squel=require('squel');var crypto=require(_0x843d('0xb'));var jsforce=require(_0x843d('0xc'));var deskjs=require(_0x843d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x843d('0xe'));var authService=require(_0x843d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x843d('0x10'));var hardwareService=require(_0x843d('0x11'));var logger=require('../../config/logger')(_0x843d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x843d('0x13'))['db'];var dbH=require(_0x843d('0x13'))[_0x843d('0x14')];function respondWithStatusCode(_0xc632c,_0x461d25){_0x461d25=_0x461d25||0xcc;return function(_0x534ac7){if(_0x534ac7){return _0xc632c[_0x843d('0x15')](_0x461d25);}return _0xc632c[_0x843d('0x16')](_0x461d25)[_0x843d('0x17')]();};}function respondWithResult(_0x282d20,_0x88d58e){_0x88d58e=_0x88d58e||0xc8;return function(_0x3c759d){if(_0x3c759d){return _0x282d20[_0x843d('0x16')](_0x88d58e)[_0x843d('0x18')](_0x3c759d);}};}function respondWithFilteredResult(_0x521285,_0x36663d){return function(_0xf4efa9){if(_0xf4efa9){var _0x38f1fd=_0xf4efa9[_0x843d('0x19')],_0x4b1cd0=_0x36663d[_0x843d('0x1a')],_0x1b8695=_0x36663d[_0x843d('0x1a')]+_0x36663d[_0x843d('0x1b')],_0x49bafb;if(_0x1b8695>=_0x38f1fd){_0x1b8695=_0x38f1fd;_0x49bafb=0xc8;}else{_0x49bafb=0xce;}_0x521285[_0x843d('0x16')](_0x49bafb);return _0x521285[_0x843d('0x1c')]('Content-Range',_0x4b1cd0+'-'+_0x1b8695+'/'+_0x38f1fd)[_0x843d('0x18')](_0xf4efa9);}return null;};}function patchUpdates(_0x324d9b){return function(_0x38199b){try{jsonpatch['apply'](_0x38199b,_0x324d9b,!![]);}catch(_0x1c1848){return BPromise[_0x843d('0x1d')](_0x1c1848);}return _0x38199b[_0x843d('0x1e')]();};}function saveUpdates(_0x5443dc,_0x47a787){return function(_0xac23a6){if(_0xac23a6){return _0xac23a6['update'](_0x5443dc)[_0x843d('0x1f')](function(_0x1aaa68){return _0x1aaa68;});}return null;};}function removeEntity(_0x577997,_0x13e5ed){return function(_0x44f692){if(_0x44f692){return _0x44f692['destroy']()['then'](function(){var _0x2b6c1d=_0x44f692[_0x843d('0x20')]({'plain':!![]});var _0x1d8500='DefaultReports';return db[_0x843d('0x21')]['destroy']({'where':{'type':_0x1d8500,'resourceId':_0x2b6c1d['id']}})['then'](function(){return _0x44f692;});})[_0x843d('0x1f')](function(){_0x577997[_0x843d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1831e5,_0xa74ffd){return function(_0x5c32fb){if(!_0x5c32fb){_0x1831e5[_0x843d('0x15')](0x194);}return _0x5c32fb;};}function handleError(_0x1376f7,_0x377745){_0x377745=_0x377745||0x1f4;return function(_0x140748){logger[_0x843d('0x22')](_0x140748[_0x843d('0x23')]);if(_0x140748[_0x843d('0x24')]){delete _0x140748[_0x843d('0x24')];}_0x1376f7[_0x843d('0x16')](_0x377745)[_0x843d('0x25')](_0x140748);};}exports[_0x843d('0x26')]=function(_0x40a34b,_0x93e100){var _0x4a3847={},_0x430782={},_0x10bab0={'count':0x0,'rows':[]};var _0x2932c5=_[_0x843d('0x27')](db[_0x843d('0x28')][_0x843d('0x29')],function(_0x112f83){return{'name':_0x112f83['fieldName'],'type':_0x112f83[_0x843d('0x2a')][_0x843d('0x2b')]};});_0x430782[_0x843d('0x2c')]=_[_0x843d('0x27')](_0x2932c5,_0x843d('0x24'));_0x430782['query']=_['keys'](_0x40a34b[_0x843d('0x2d')]);_0x430782[_0x843d('0x2e')]=_['intersection'](_0x430782['model'],_0x430782[_0x843d('0x2d')]);_0x4a3847['attributes']=_[_0x843d('0x2f')](_0x430782[_0x843d('0x2c')],qs[_0x843d('0x30')](_0x40a34b[_0x843d('0x2d')][_0x843d('0x30')]));_0x4a3847[_0x843d('0x31')]=_0x4a3847[_0x843d('0x31')][_0x843d('0x32')]?_0x4a3847[_0x843d('0x31')]:_0x430782[_0x843d('0x2c')];if(!_0x40a34b[_0x843d('0x2d')]['hasOwnProperty']('nolimit')){_0x4a3847['limit']=qs[_0x843d('0x1b')](_0x40a34b[_0x843d('0x2d')]['limit']);_0x4a3847[_0x843d('0x1a')]=qs['offset'](_0x40a34b[_0x843d('0x2d')][_0x843d('0x1a')]);}_0x4a3847[_0x843d('0x33')]=qs[_0x843d('0x34')](_0x40a34b['query']['sort']);_0x4a3847[_0x843d('0x35')]=qs['filters'](_[_0x843d('0x36')](_0x40a34b[_0x843d('0x2d')],_0x430782[_0x843d('0x2e')]),_0x2932c5);if(_0x40a34b['query'][_0x843d('0x37')]){_0x4a3847['where']=_['merge'](_0x4a3847[_0x843d('0x35')],{'$or':_[_0x843d('0x27')](_0x2932c5,function(_0x583999){if(_0x583999[_0x843d('0x2a')]!==_0x843d('0x38')){var _0x185e38={};_0x185e38[_0x583999['name']]={'$like':'%'+_0x40a34b[_0x843d('0x2d')][_0x843d('0x37')]+'%'};return _0x185e38;}})});}_0x4a3847=_[_0x843d('0x39')]({},_0x4a3847,_0x40a34b[_0x843d('0x3a')]);var _0x3c584a={'where':_0x4a3847['where']};return db['AnalyticDefaultReport'][_0x843d('0x19')](_0x3c584a)[_0x843d('0x1f')](function(_0x5cfd6c){_0x10bab0['count']=_0x5cfd6c;if(_0x40a34b['query'][_0x843d('0x3b')]){_0x4a3847[_0x843d('0x3c')]=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x4a3847);})[_0x843d('0x1f')](function(_0x5c7de0){_0x10bab0[_0x843d('0x3d')]=_0x5c7de0;return _0x10bab0;})[_0x843d('0x1f')](respondWithFilteredResult(_0x93e100,_0x4a3847))[_0x843d('0x3e')](handleError(_0x93e100,null));};exports[_0x843d('0x3f')]=function(_0x12b333,_0x4a374a){var _0x2d623d={'raw':!![],'where':{'id':_0x12b333[_0x843d('0x40')]['id']}},_0x5d9abf={};_0x5d9abf[_0x843d('0x2c')]=_[_0x843d('0x41')](db[_0x843d('0x28')][_0x843d('0x29')]);_0x5d9abf['query']=_[_0x843d('0x41')](_0x12b333['query']);_0x5d9abf[_0x843d('0x2e')]=_[_0x843d('0x2f')](_0x5d9abf['model'],_0x5d9abf['query']);_0x2d623d[_0x843d('0x31')]=_[_0x843d('0x2f')](_0x5d9abf[_0x843d('0x2c')],qs[_0x843d('0x30')](_0x12b333[_0x843d('0x2d')][_0x843d('0x30')]));_0x2d623d[_0x843d('0x31')]=_0x2d623d[_0x843d('0x31')][_0x843d('0x32')]?_0x2d623d['attributes']:_0x5d9abf[_0x843d('0x2c')];if(_0x12b333[_0x843d('0x2d')]['includeAll']){_0x2d623d['include']=[{'all':!![]}];}_0x2d623d=_[_0x843d('0x39')]({},_0x2d623d,_0x12b333[_0x843d('0x3a')]);return db['AnalyticDefaultReport'][_0x843d('0x42')](_0x2d623d)[_0x843d('0x1f')](handleEntityNotFound(_0x4a374a,null))['then'](respondWithResult(_0x4a374a,null))[_0x843d('0x3e')](handleError(_0x4a374a,null));};exports[_0x843d('0x43')]=function(_0x56dd99,_0x12d2f2){return db[_0x843d('0x28')][_0x843d('0x43')](_0x56dd99[_0x843d('0x44')],{})[_0x843d('0x1f')](function(_0x5ba76c){var _0x459e22=_0x56dd99[_0x843d('0x45')]['get']({'plain':!![]});if(!_0x459e22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x459e22['role']===_0x843d('0x45')){var _0x4fe28d=_0x5ba76c['get']({'plain':!![]});var _0x379592=_0x843d('0x46');return db[_0x843d('0x47')][_0x843d('0x42')]({'where':{'name':_0x379592,'userProfileId':_0x459e22[_0x843d('0x48')]},'raw':!![]})['then'](function(_0x29f047){if(_0x29f047&&_0x29f047['autoAssociation']===0x0){return db[_0x843d('0x21')]['create']({'name':_0x4fe28d[_0x843d('0x24')],'resourceId':_0x4fe28d['id'],'type':_0x843d('0x49'),'sectionId':_0x29f047['id']},{})['then'](function(){return _0x5ba76c;});}else{return _0x5ba76c;}})['catch'](function(_0x3c424f){logger['error'](_0x843d('0x4a'),_0x3c424f);throw _0x3c424f;});}return _0x5ba76c;})[_0x843d('0x1f')](respondWithResult(_0x12d2f2,0xc9))[_0x843d('0x3e')](handleError(_0x12d2f2,null));};exports[_0x843d('0x4b')]=function(_0x313d3b,_0x5b1b6d){if(_0x313d3b['body']['id']){delete _0x313d3b['body']['id'];}return db[_0x843d('0x28')]['find']({'where':{'id':_0x313d3b[_0x843d('0x40')]['id']}})[_0x843d('0x1f')](handleEntityNotFound(_0x5b1b6d,null))[_0x843d('0x1f')](saveUpdates(_0x313d3b[_0x843d('0x44')],null))[_0x843d('0x1f')](respondWithResult(_0x5b1b6d,null))[_0x843d('0x3e')](handleError(_0x5b1b6d,null));};exports['destroy']=function(_0x5c1745,_0x369f82){return db[_0x843d('0x28')][_0x843d('0x42')]({'where':{'id':_0x5c1745[_0x843d('0x40')]['id']}})[_0x843d('0x1f')](handleEntityNotFound(_0x369f82,null))[_0x843d('0x1f')](removeEntity(_0x369f82,null))[_0x843d('0x3e')](handleError(_0x369f82,null));};exports['preview']=function(_0x2e35a8,_0x1a64c8){var _0x2b4da9=0xa;var _0x9576ac=[_0x843d('0x4c'),_0x843d('0x4d'),_0x843d('0x4e'),'cross_join'];var _0x402cd7={'SUM':_0x843d('0x4f'),'COUNT':_0x843d('0x50'),'COUNT DISTINCT':_0x843d('0x51'),'MAX':_0x843d('0x52'),'MIN':_0x843d('0x53'),'AVG':_0x843d('0x54'),'GROUP_CONCAT':_0x843d('0x55'),'GROUP_CONCAT ASC':_0x843d('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x49681e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x843d('0x57'),'HOUR':_0x843d('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x843d('0x59')};var _0x112b6e=function(_0x203f00){return!_[_0x843d('0x5a')]([_0x843d('0x5b'),_0x843d('0x5c'),_0x843d('0x5d'),_0x843d('0x5e')],_0x203f00);};var _0x379a66=function(_0x217913){if(!_0x217913||!_0x217913['rules'][_0x843d('0x32')]){return'';}for(var _0x320528='(',_0x37e4f5=0x0;_0x37e4f5<_0x217913['rules'][_0x843d('0x32')];_0x37e4f5+=0x1){_0x37e4f5>0x0&&(_0x320528+='\x20'+_0x217913['operator']+'\x20');_0x320528+=_0x217913[_0x843d('0x5f')][_0x37e4f5][_0x843d('0x60')]?_0x379a66(_0x217913[_0x843d('0x5f')][_0x37e4f5]['group']):_0x217913[_0x843d('0x5f')][_0x37e4f5][_0x843d('0x61')]+'\x20'+_0x217913[_0x843d('0x5f')][_0x37e4f5][_0x843d('0x62')]+(_0x112b6e(_0x217913['rules'][_0x37e4f5][_0x843d('0x62')])?'\x20'+_0x217913[_0x843d('0x5f')][_0x37e4f5]['value']:'');}return _0x320528+')';};var _0x1455a2={'where':{'id':_0x2e35a8[_0x843d('0x40')]['id']}},_0x3e2818,_0x1d31fc,_0x193a84,_0x368450,_0xc4b70;_0x1455a2=_[_0x843d('0x39')]({},_0x1455a2,_0x2e35a8['options']);return db[_0x843d('0x28')][_0x843d('0x42')](_0x1455a2)[_0x843d('0x1f')](function(_0x27caa4){if(_0x27caa4){_0x3e2818=_0x27caa4;return _0x27caa4['getFields']();}return null;})['then'](function(_0x11c089){if(_0x11c089){if(!_0x11c089[_0x843d('0x32')]){throw new db[(_0x843d('0x63'))]['ValidationErrorItem'](_0x843d('0x64'),0x193);}_0x1d31fc=_0x11c089;return db['AnalyticMetric'][_0x843d('0x65')]({'raw':!![]});}return null;})['then'](function(_0x6324b9){if(_0x6324b9){_0x193a84=_[_0x843d('0x66')](_0x6324b9,'id');var _0x37158f;var _0x34fbd3=squel[_0x843d('0x67')]();_0x34fbd3[_0x843d('0x68')](_0x3e2818[_0x843d('0x69')]);for(var _0x31b451=0x0;_0x31b451<_0x1d31fc['length'];_0x31b451+=0x1){_0x37158f=_0x1d31fc[_0x31b451][_0x843d('0x6a')]?_0x193a84[_0x1d31fc[_0x31b451][_0x843d('0x6a')]]['metric']:_0x1d31fc[_0x31b451][_0x843d('0x61')];_0x37158f=_0x1d31fc[_0x31b451]['function']?_['replace'](_0x402cd7[_0x1d31fc[_0x31b451][_0x843d('0x6b')]],'%s',_0x37158f):_0x37158f;_0x37158f=_0x1d31fc[_0x31b451][_0x843d('0x6c')]?_[_0x843d('0x6d')](_0x49681e[_0x1d31fc[_0x31b451][_0x843d('0x6c')]],'%s',_0x37158f):_0x37158f;if(_0x1d31fc[_0x31b451][_0x843d('0x6e')]){_0x34fbd3[_0x843d('0x60')](_0x37158f);}_0x1d31fc[_0x31b451][_0x843d('0x6f')]&&_0x34fbd3[_0x843d('0x33')](_0x37158f,_0x1d31fc[_0x31b451][_0x843d('0x6f')]===_0x843d('0x70')?![]:!![]);_0x34fbd3[_0x843d('0x61')](_0x37158f,_0x1d31fc[_0x31b451][_0x843d('0x71')]||_0x37158f);}if(_0x3e2818[_0x843d('0x72')]){_0x3e2818[_0x843d('0x72')]=JSON[_0x843d('0x73')](_0x3e2818['joins']);for(var _0x4bd192=0x0;_0x4bd192<_0x3e2818[_0x843d('0x72')]['length'];_0x4bd192+=0x1){if(_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x2a')]&&_[_0x843d('0x5a')](_0x9576ac,_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x2a')])&&_0x3e2818[_0x843d('0x72')][_0x4bd192]['parentKey']&&_0x3e2818[_0x843d('0x72')][_0x4bd192]['foreignTable']&&_0x3e2818['joins'][_0x4bd192][_0x843d('0x74')]){_0x34fbd3[_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x2a')]](_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x75')],null,util[_0x843d('0x6c')](_0x843d('0x76'),_0x3e2818[_0x843d('0x69')],_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x77')],_0x3e2818[_0x843d('0x72')][_0x4bd192]['foreignTable'],_0x3e2818['joins'][_0x4bd192]['foreignKey']));}}}if(_0x3e2818[_0x843d('0x78')]){_0x3e2818[_0x843d('0x78')]=JSON[_0x843d('0x73')](_0x3e2818[_0x843d('0x78')]);_0x34fbd3[_0x843d('0x35')](_0x379a66(_0x3e2818['conditions'][_0x843d('0x60')]));}_0xc4b70=_0x34fbd3[_0x843d('0x79')]();_0x34fbd3[_0x843d('0x1b')](_0x2b4da9);_0x34fbd3[_0x843d('0x1a')](0x0);logger['debug'](_0x843d('0x7a'),_0x34fbd3[_0x843d('0x7b')]());return db[_0x843d('0x7c')][_0x843d('0x2d')](_0x34fbd3['toString'](),{'type':db[_0x843d('0x7c')][_0x843d('0x7d')][_0x843d('0x7e')]});}})[_0x843d('0x1f')](respondWithResult(_0x1a64c8,null))[_0x843d('0x3e')](handleError(_0x1a64c8,null));};function runReport(_0x3fce36,_0x4b4ae2,_0x55a024){var _0x5acf76=_0x4b4ae2[_0x843d('0x24')];var _0x65554d=0xa;var _0x1baaa8=[_0x843d('0x4c'),_0x843d('0x4d'),_0x843d('0x4e'),_0x843d('0x7f')];var _0x2b8b5e={'SUM':_0x843d('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x843d('0x51'),'MAX':_0x843d('0x52'),'MIN':'MIN(%s)','AVG':_0x843d('0x54'),'GROUP_CONCAT':_0x843d('0x55'),'GROUP_CONCAT ASC':_0x843d('0x56'),'GROUP_CONCAT DESC':_0x843d('0x80')};var _0x17d258={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x843d('0x57'),'HOUR':_0x843d('0x58'),'ROUND':_0x843d('0x81'),'UNIX_TIMESTAMP':_0x843d('0x59')};var _0x12cdbc=function(_0x1a4847){return!_[_0x843d('0x5a')](['IS\x20NULL',_0x843d('0x5c'),'IS\x20EMPTY',_0x843d('0x5e')],_0x1a4847);};var _0x58b4f8=function(_0x53d851){if(!_0x53d851||!_0x53d851[_0x843d('0x5f')][_0x843d('0x32')]){return'';}for(var _0x43e224='(',_0x33d8b8=0x0;_0x33d8b8<_0x53d851[_0x843d('0x5f')]['length'];_0x33d8b8+=0x1){_0x33d8b8>0x0&&(_0x43e224+='\x20'+_0x53d851[_0x843d('0x82')]+'\x20');_0x43e224+=_0x53d851[_0x843d('0x5f')][_0x33d8b8][_0x843d('0x60')]?_0x58b4f8(_0x53d851[_0x843d('0x5f')][_0x33d8b8][_0x843d('0x60')]):_0x53d851[_0x843d('0x5f')][_0x33d8b8][_0x843d('0x61')]+'\x20'+_0x53d851['rules'][_0x33d8b8][_0x843d('0x62')]+(_0x12cdbc(_0x53d851['rules'][_0x33d8b8]['condition'])?'\x20'+_0x53d851['rules'][_0x33d8b8][_0x843d('0x83')]:'');}return _0x43e224+')';};var _0x3df404={'where':{'id':_0x3fce36['id']}},_0x2d0a2f,_0x49f3a1,_0x59ae04,_0x549d86,_0x3b1498;_0x3df404=_[_0x843d('0x39')]({},_0x3df404,_0x55a024);return db[_0x843d('0x28')][_0x843d('0x42')](_0x3df404)[_0x843d('0x1f')](function(_0x4b4469){if(_0x4b4469){_0x2d0a2f=_0x4b4469;return _0x4b4469[_0x843d('0x84')]();}return null;})[_0x843d('0x1f')](function(_0x4b7449){if(_0x4b7449){if(!_0x4b7449[_0x843d('0x32')]){throw new db[(_0x843d('0x63'))][(_0x843d('0x85'))](_0x843d('0x64'),0x193);}_0x49f3a1=_0x4b7449;return db[_0x843d('0x86')]['findAll']({'raw':!![]});}return null;})[_0x843d('0x1f')](function(_0xebdc38){if(_0xebdc38){_0x59ae04=_[_0x843d('0x66')](_0xebdc38,'id');var _0x39dee1;var _0x424454=squel[_0x843d('0x67')]();_0x424454[_0x843d('0x68')](_0x2d0a2f['table']);for(var _0x98c03f=0x0;_0x98c03f<_0x49f3a1['length'];_0x98c03f+=0x1){_0x39dee1=_0x49f3a1[_0x98c03f][_0x843d('0x6a')]?_0x59ae04[_0x49f3a1[_0x98c03f][_0x843d('0x6a')]][_0x843d('0x87')]:_0x49f3a1[_0x98c03f]['field'];_0x39dee1=_0x49f3a1[_0x98c03f][_0x843d('0x6b')]?_[_0x843d('0x6d')](_0x2b8b5e[_0x49f3a1[_0x98c03f]['function']],'%s',_0x39dee1):_0x39dee1;_0x39dee1=_0x49f3a1[_0x98c03f][_0x843d('0x6c')]?_[_0x843d('0x6d')](_0x17d258[_0x49f3a1[_0x98c03f][_0x843d('0x6c')]],'%s',_0x39dee1):_0x39dee1;if(_0x49f3a1[_0x98c03f][_0x843d('0x6e')]){_0x424454[_0x843d('0x60')](_0x39dee1);}_0x49f3a1[_0x98c03f][_0x843d('0x6f')]&&_0x424454[_0x843d('0x33')](_0x39dee1,_0x49f3a1[_0x98c03f][_0x843d('0x6f')]===_0x843d('0x70')?![]:!![]);_0x424454['field'](_0x39dee1,_0x49f3a1[_0x98c03f]['alias']||_0x39dee1);}if(_0x2d0a2f[_0x843d('0x72')]){_0x2d0a2f['joins']=JSON[_0x843d('0x73')](_0x2d0a2f[_0x843d('0x72')]);for(var _0x2fc056=0x0;_0x2fc056<_0x2d0a2f[_0x843d('0x72')]['length'];_0x2fc056+=0x1){if(_0x2d0a2f[_0x843d('0x72')][_0x2fc056]['type']&&_[_0x843d('0x5a')](_0x1baaa8,_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x2a')])&&_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x77')]&&_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x75')]&&_0x2d0a2f['joins'][_0x2fc056][_0x843d('0x74')]){_0x424454[_0x2d0a2f['joins'][_0x2fc056][_0x843d('0x2a')]](_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x75')],null,util[_0x843d('0x6c')](_0x843d('0x76'),_0x2d0a2f[_0x843d('0x69')],_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x77')],_0x2d0a2f['joins'][_0x2fc056][_0x843d('0x75')],_0x2d0a2f[_0x843d('0x72')][_0x2fc056]['foreignKey']));}}}if(_0x2d0a2f[_0x843d('0x78')]){_0x2d0a2f[_0x843d('0x78')]=JSON[_0x843d('0x73')](_0x2d0a2f[_0x843d('0x78')]);_0x424454[_0x843d('0x35')](_0x58b4f8(_0x2d0a2f[_0x843d('0x78')][_0x843d('0x60')]));}_0x3b1498=_0x424454[_0x843d('0x79')]();_0x424454[_0x843d('0x1b')](_0x65554d);_0x424454[_0x843d('0x1a')](0x0);logger['debug'](_0x843d('0x7a'),_0x424454['toString']());return db[_0x843d('0x7c')][_0x843d('0x2d')](_0x424454[_0x843d('0x7b')](),{'type':db[_0x843d('0x7c')]['QueryTypes'][_0x843d('0x7e')]});}})['then'](function(_0x31f496){if(!_0x31f496['length']){throw new db[(_0x843d('0x63'))]['ValidationErrorItem'](_0x843d('0x88'),0xcc);}if(_0x4b4ae2[_0x843d('0x89')]===_0x843d('0x8a')){return null;}var _0x1be8c4=_[_0x843d('0x39')](_0x4b4ae2,{'name':_0x4b4ae2['fullPath']||_0x4b4ae2['name']||_0x2d0a2f['name'],'basename':_0x5acf76,'savename':util[_0x843d('0x6c')](_0x843d('0x8b'),_0x4b4ae2[_0x843d('0x24')]||_0x2d0a2f[_0x843d('0x24')],require(_0x843d('0x8c'))['generate'](0x4),_0x4b4ae2[_0x843d('0x89')]||_0x843d('0x8d')),'reportId':_0x2d0a2f['id'],'reportType':'default'});return db[_0x843d('0x8e')][_0x843d('0x43')](_0x1be8c4,{'raw':!![]});})['then'](function(_0x205d28){if(_0x2d0a2f[_0x843d('0x69')]===_0x843d('0x8f')){_0x3b1498[_0x843d('0x35')](_0x2d0a2f[_0x843d('0x69')]+_0x843d('0x90'),_0x4b4ae2[_0x843d('0x91')],_0x4b4ae2[_0x843d('0x92')]);}else{_0x3b1498[_0x843d('0x35')](_0x2d0a2f[_0x843d('0x69')]+_0x843d('0x93'),_0x4b4ae2[_0x843d('0x91')],_0x4b4ae2[_0x843d('0x92')]);}if(_0x205d28){logger['info'](_0x843d('0x94'),_0x3b1498[_0x843d('0x7b')]());require(_0x843d('0x95'))[_0x843d('0x96')](path[_0x843d('0x4c')](__dirname,'../../components/export/',_0x205d28[_0x843d('0x89')]),[_0x205d28['id'],_0x3b1498[_0x843d('0x7b')](),path['join'](__dirname,'../../files/reports',_0x205d28[_0x843d('0x97')]),_0x5acf76]);return _0x205d28;}else{var _0x471484=squel[_0x843d('0x67')]();_0x471484[_0x843d('0x68')]('('+_0x3b1498[_0x843d('0x7b')]()+')','countTable');_0x471484[_0x843d('0x61')](_0x843d('0x98'),_0x843d('0x19'));_0x3b1498[_0x843d('0x1b')](_0x4b4ae2['limit']||_0x65554d);_0x3b1498[_0x843d('0x1a')](_0x4b4ae2['offset']||0x0);return dbH[_0x843d('0x7c')]['query'](_0x471484['toString'](),{'type':dbH[_0x843d('0x7c')][_0x843d('0x7d')][_0x843d('0x7e')]})[_0x843d('0x1f')](function(_0x3f5a98){if(!_0x3f5a98[_0x843d('0x32')]){_0x549d86=0x0;}else{_0x549d86=_0x3f5a98[0x0][_0x843d('0x19')]||0x0;}return dbH[_0x843d('0x7c')][_0x843d('0x2d')](_0x3b1498['toString'](),{'type':dbH[_0x843d('0x7c')][_0x843d('0x7d')][_0x843d('0x7e')]});})[_0x843d('0x1f')](function(_0x595818){return{'rows':_0x595818||[],'count':_0x549d86};});}});}exports['run']=function(_0xe1522d,_0x3f3909){return runReport(_0xe1522d['params'],_0xe1522d[_0x843d('0x2d')],_0xe1522d[_0x843d('0x3a')])[_0x843d('0x1f')](respondWithResult(_0x3f3909,null))[_0x843d('0x3e')](handleError(_0x3f3909,null));};exports[_0x843d('0x99')]=runReport;exports['query']=function(_0x802d32,_0x259d49){var _0x44d592=0xa;var _0x4c2118=['join',_0x843d('0x4d'),_0x843d('0x4e'),'cross_join'];var _0x32dbd7={'SUM':_0x843d('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x843d('0x51'),'MAX':_0x843d('0x52'),'MIN':_0x843d('0x53'),'AVG':_0x843d('0x54'),'GROUP_CONCAT':_0x843d('0x55'),'GROUP_CONCAT ASC':_0x843d('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5ea61d={'SEC_TO_TIME':_0x843d('0x9a'),'DATE':_0x843d('0x57'),'HOUR':'HOUR(%s)','ROUND':_0x843d('0x81'),'UNIX_TIMESTAMP':_0x843d('0x59')};var _0x18896b=function(_0x49e4e7){return!_[_0x843d('0x5a')]([_0x843d('0x5b'),'IS\x20NOT\x20NULL',_0x843d('0x5d'),_0x843d('0x5e')],_0x49e4e7);};var _0x589b7e=function(_0x27f58f){if(!_0x27f58f||!_0x27f58f[_0x843d('0x5f')]['length']){return'';}for(var _0x769b78='(',_0x54b571=0x0;_0x54b571<_0x27f58f[_0x843d('0x5f')]['length'];_0x54b571+=0x1){_0x54b571>0x0&&(_0x769b78+='\x20'+_0x27f58f[_0x843d('0x82')]+'\x20');_0x769b78+=_0x27f58f[_0x843d('0x5f')][_0x54b571]['group']?_0x589b7e(_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x60')]):_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x61')]+'\x20'+_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x62')]+(_0x18896b(_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x62')])?'\x20'+_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x83')]:'');}return _0x769b78+')';};var _0x4457a9={'where':{'id':_0x802d32[_0x843d('0x40')]['id']}},_0x2998b2,_0x421d68,_0x12d723,_0x4b2141,_0x31af56;_0x4457a9=_[_0x843d('0x39')]({},_0x4457a9,_0x802d32[_0x843d('0x3a')]);return db['AnalyticDefaultReport']['find'](_0x4457a9)[_0x843d('0x1f')](function(_0x26eb1f){if(_0x26eb1f){_0x2998b2=_0x26eb1f;return _0x26eb1f[_0x843d('0x84')]();}return null;})[_0x843d('0x1f')](function(_0x58515e){if(_0x58515e){if(!_0x58515e[_0x843d('0x32')]){throw new db[(_0x843d('0x63'))][(_0x843d('0x85'))](_0x843d('0x64'),0x193);}_0x421d68=_0x58515e;return db[_0x843d('0x86')][_0x843d('0x65')]({'raw':!![]});}return null;})[_0x843d('0x1f')](function(_0x3a970f){if(_0x3a970f){_0x12d723=_[_0x843d('0x66')](_0x3a970f,'id');var _0x8e2626;var _0x40c74e=squel[_0x843d('0x67')]();_0x40c74e[_0x843d('0x68')](_0x2998b2['table']);for(var _0x45acce=0x0;_0x45acce<_0x421d68[_0x843d('0x32')];_0x45acce+=0x1){_0x8e2626=_0x421d68[_0x45acce][_0x843d('0x6a')]?_0x12d723[_0x421d68[_0x45acce][_0x843d('0x6a')]][_0x843d('0x87')]:_0x421d68[_0x45acce][_0x843d('0x61')];_0x8e2626=_0x421d68[_0x45acce][_0x843d('0x6b')]?_[_0x843d('0x6d')](_0x32dbd7[_0x421d68[_0x45acce]['function']],'%s',_0x8e2626):_0x8e2626;_0x8e2626=_0x421d68[_0x45acce][_0x843d('0x6c')]?_[_0x843d('0x6d')](_0x5ea61d[_0x421d68[_0x45acce]['format']],'%s',_0x8e2626):_0x8e2626;if(_0x421d68[_0x45acce][_0x843d('0x6e')]){_0x40c74e['group'](_0x8e2626);}_0x421d68[_0x45acce][_0x843d('0x6f')]&&_0x40c74e[_0x843d('0x33')](_0x8e2626,_0x421d68[_0x45acce]['orderBy']===_0x843d('0x70')?![]:!![]);_0x40c74e[_0x843d('0x61')](_0x8e2626,_0x421d68[_0x45acce]['alias']||_0x8e2626);}if(_0x2998b2[_0x843d('0x72')]){_0x2998b2[_0x843d('0x72')]=JSON[_0x843d('0x73')](_0x2998b2[_0x843d('0x72')]);for(var _0x27d323=0x0;_0x27d323<_0x2998b2['joins'][_0x843d('0x32')];_0x27d323+=0x1){if(_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x2a')]&&_[_0x843d('0x5a')](_0x4c2118,_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x2a')])&&_0x2998b2[_0x843d('0x72')][_0x27d323]['parentKey']&&_0x2998b2['joins'][_0x27d323]['foreignTable']&&_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x74')]){_0x40c74e[_0x2998b2[_0x843d('0x72')][_0x27d323]['type']](_0x2998b2['joins'][_0x27d323][_0x843d('0x75')],null,util[_0x843d('0x6c')]('%s.%s\x20=\x20%s.%s',_0x2998b2[_0x843d('0x69')],_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x77')],_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x75')],_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x74')]));}}}if(_0x2998b2[_0x843d('0x78')]){_0x2998b2[_0x843d('0x78')]=JSON[_0x843d('0x73')](_0x2998b2['conditions']);_0x40c74e[_0x843d('0x35')](_0x589b7e(_0x2998b2[_0x843d('0x78')][_0x843d('0x60')]));}_0x31af56=_0x40c74e[_0x843d('0x79')]();_0x40c74e[_0x843d('0x1b')](_0x44d592);_0x40c74e[_0x843d('0x1a')](0x0);logger['debug'](_0x843d('0x7a'),_0x40c74e['toString']());return db[_0x843d('0x7c')][_0x843d('0x2d')](_0x40c74e[_0x843d('0x7b')](),{'type':db[_0x843d('0x7c')][_0x843d('0x7d')]['SELECT']});}})[_0x843d('0x1f')](function(){return{'sql':_0x31af56[_0x843d('0x7b')]()};})[_0x843d('0x1f')](respondWithResult(_0x259d49,null))[_0x843d('0x3e')](handleError(_0x259d49,null));}; \ No newline at end of file +var _0x77c3=['apply','reject','save','update','then','get','DefaultReports','UserProfileResource','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','fields','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','function','replace','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','AVG(%s)','IS\x20NULL','IS\x20NOT\x20NULL','value','Sequelize','AnalyticMetric','metric','format','alias','clone','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','left_join','COUNT(DISTINCT\x20%s)','findAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','end','json','count','offset','Content-Range'];(function(_0x38d1f9,_0xc74aa6){var _0x1466b6=function(_0x31830f){while(--_0x31830f){_0x38d1f9['push'](_0x38d1f9['shift']());}};_0x1466b6(++_0xc74aa6);}(_0x77c3,0x1da));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x377c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x377c('0x1'));var zipdir=require(_0x377c('0x2'));var jsonpatch=require(_0x377c('0x3'));var rp=require(_0x377c('0x4'));var moment=require(_0x377c('0x5'));var BPromise=require(_0x377c('0x6'));var Mustache=require(_0x377c('0x7'));var util=require(_0x377c('0x8'));var path=require(_0x377c('0x9'));var sox=require(_0x377c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x377c('0xb'));var squel=require(_0x377c('0xc'));var crypto=require(_0x377c('0xd'));var jsforce=require(_0x377c('0xe'));var deskjs=require(_0x377c('0xf'));var toCsv=require(_0x377c('0x10'));var querystring=require(_0x377c('0x11'));var Papa=require(_0x377c('0x12'));var Redis=require(_0x377c('0x13'));var authService=require(_0x377c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x377c('0x15'));var logger=require(_0x377c('0x16'))(_0x377c('0x17'));var utils=require(_0x377c('0x18'));var config=require('../../config/environment');var db=require(_0x377c('0x19'))['db'];var dbH=require(_0x377c('0x19'))[_0x377c('0x1a')];function respondWithStatusCode(_0x19c44d,_0x426752){_0x426752=_0x426752||0xcc;return function(_0x429f30){if(_0x429f30){return _0x19c44d['sendStatus'](_0x426752);}return _0x19c44d[_0x377c('0x1b')](_0x426752)[_0x377c('0x1c')]();};}function respondWithResult(_0x5affd9,_0x1e2ed6){_0x1e2ed6=_0x1e2ed6||0xc8;return function(_0x4938c2){if(_0x4938c2){return _0x5affd9['status'](_0x1e2ed6)[_0x377c('0x1d')](_0x4938c2);}};}function respondWithFilteredResult(_0x48e936,_0x4d18d8){return function(_0x37b198){if(_0x37b198){var _0x1ee25c=_0x37b198[_0x377c('0x1e')],_0x473266=_0x4d18d8[_0x377c('0x1f')],_0x46a828=_0x4d18d8[_0x377c('0x1f')]+_0x4d18d8['limit'],_0xf77dc2;if(_0x46a828>=_0x1ee25c){_0x46a828=_0x1ee25c;_0xf77dc2=0xc8;}else{_0xf77dc2=0xce;}_0x48e936[_0x377c('0x1b')](_0xf77dc2);return _0x48e936['set'](_0x377c('0x20'),_0x473266+'-'+_0x46a828+'/'+_0x1ee25c)[_0x377c('0x1d')](_0x37b198);}return null;};}function patchUpdates(_0x535e4d){return function(_0x1206ce){try{jsonpatch[_0x377c('0x21')](_0x1206ce,_0x535e4d,!![]);}catch(_0x42331d){return BPromise[_0x377c('0x22')](_0x42331d);}return _0x1206ce[_0x377c('0x23')]();};}function saveUpdates(_0x21ca68,_0x319f84){return function(_0x17d157){if(_0x17d157){return _0x17d157[_0x377c('0x24')](_0x21ca68)[_0x377c('0x25')](function(_0x3f2f9e){return _0x3f2f9e;});}return null;};}function removeEntity(_0x1cd204,_0x530627){return function(_0x9869c8){if(_0x9869c8){return _0x9869c8['destroy']()[_0x377c('0x25')](function(){var _0x5084ad=_0x9869c8[_0x377c('0x26')]({'plain':!![]});var _0x2fbde2=_0x377c('0x27');return db[_0x377c('0x28')]['destroy']({'where':{'type':_0x2fbde2,'resourceId':_0x5084ad['id']}})['then'](function(){return _0x9869c8;});})[_0x377c('0x25')](function(){_0x1cd204['status'](0xcc)[_0x377c('0x1c')]();});}};}function handleEntityNotFound(_0x46fed9,_0x382362){return function(_0x50e072){if(!_0x50e072){_0x46fed9['sendStatus'](0x194);}return _0x50e072;};}function handleError(_0x585e80,_0x30c6ea){_0x30c6ea=_0x30c6ea||0x1f4;return function(_0xe0ffa8){logger[_0x377c('0x29')](_0xe0ffa8[_0x377c('0x2a')]);if(_0xe0ffa8[_0x377c('0x2b')]){delete _0xe0ffa8['name'];}_0x585e80[_0x377c('0x1b')](_0x30c6ea)['send'](_0xe0ffa8);};}exports[_0x377c('0x2c')]=function(_0x3d9824,_0x4742af){var _0x1825ea={},_0x3aa23b={},_0x4c02c5={'count':0x0,'rows':[]};var _0x263fe4=_[_0x377c('0x2d')](db[_0x377c('0x2e')][_0x377c('0x2f')],function(_0x2ac016){return{'name':_0x2ac016[_0x377c('0x30')],'type':_0x2ac016[_0x377c('0x31')][_0x377c('0x32')]};});_0x3aa23b[_0x377c('0x33')]=_['map'](_0x263fe4,_0x377c('0x2b'));_0x3aa23b[_0x377c('0x34')]=_[_0x377c('0x35')](_0x3d9824[_0x377c('0x34')]);_0x3aa23b[_0x377c('0x36')]=_[_0x377c('0x37')](_0x3aa23b[_0x377c('0x33')],_0x3aa23b['query']);_0x1825ea['attributes']=_[_0x377c('0x37')](_0x3aa23b[_0x377c('0x33')],qs['fields'](_0x3d9824[_0x377c('0x34')]['fields']));_0x1825ea[_0x377c('0x38')]=_0x1825ea[_0x377c('0x38')][_0x377c('0x39')]?_0x1825ea[_0x377c('0x38')]:_0x3aa23b[_0x377c('0x33')];if(!_0x3d9824[_0x377c('0x34')][_0x377c('0x3a')](_0x377c('0x3b'))){_0x1825ea[_0x377c('0x3c')]=qs['limit'](_0x3d9824[_0x377c('0x34')][_0x377c('0x3c')]);_0x1825ea[_0x377c('0x1f')]=qs[_0x377c('0x1f')](_0x3d9824[_0x377c('0x34')][_0x377c('0x1f')]);}_0x1825ea[_0x377c('0x3d')]=qs[_0x377c('0x3e')](_0x3d9824['query'][_0x377c('0x3e')]);_0x1825ea['where']=qs['filters'](_[_0x377c('0x3f')](_0x3d9824[_0x377c('0x34')],_0x3aa23b[_0x377c('0x36')]),_0x263fe4);if(_0x3d9824['query'][_0x377c('0x40')]){_0x1825ea[_0x377c('0x41')]=_[_0x377c('0x42')](_0x1825ea['where'],{'$or':_[_0x377c('0x2d')](_0x263fe4,function(_0x3ad36b){if(_0x3ad36b[_0x377c('0x31')]!==_0x377c('0x43')){var _0x133ebf={};_0x133ebf[_0x3ad36b[_0x377c('0x2b')]]={'$like':'%'+_0x3d9824[_0x377c('0x34')][_0x377c('0x40')]+'%'};return _0x133ebf;}})});}_0x1825ea=_[_0x377c('0x42')]({},_0x1825ea,_0x3d9824['options']);var _0x187388={'where':_0x1825ea[_0x377c('0x41')]};return db[_0x377c('0x2e')][_0x377c('0x1e')](_0x187388)['then'](function(_0xf2169f){_0x4c02c5[_0x377c('0x1e')]=_0xf2169f;if(_0x3d9824[_0x377c('0x34')][_0x377c('0x44')]){_0x1825ea['include']=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x1825ea);})[_0x377c('0x25')](function(_0x288066){_0x4c02c5[_0x377c('0x45')]=_0x288066;return _0x4c02c5;})[_0x377c('0x25')](respondWithFilteredResult(_0x4742af,_0x1825ea))[_0x377c('0x46')](handleError(_0x4742af,null));};exports[_0x377c('0x47')]=function(_0x36af8e,_0x467eac){var _0x3ae657={'raw':!![],'where':{'id':_0x36af8e[_0x377c('0x48')]['id']}},_0xb19096={};_0xb19096[_0x377c('0x33')]=_[_0x377c('0x35')](db[_0x377c('0x2e')][_0x377c('0x2f')]);_0xb19096[_0x377c('0x34')]=_[_0x377c('0x35')](_0x36af8e[_0x377c('0x34')]);_0xb19096['filters']=_[_0x377c('0x37')](_0xb19096[_0x377c('0x33')],_0xb19096[_0x377c('0x34')]);_0x3ae657[_0x377c('0x38')]=_[_0x377c('0x37')](_0xb19096[_0x377c('0x33')],qs['fields'](_0x36af8e['query'][_0x377c('0x49')]));_0x3ae657[_0x377c('0x38')]=_0x3ae657[_0x377c('0x38')]['length']?_0x3ae657['attributes']:_0xb19096['model'];if(_0x36af8e[_0x377c('0x34')][_0x377c('0x44')]){_0x3ae657[_0x377c('0x4a')]=[{'all':!![]}];}_0x3ae657=_[_0x377c('0x42')]({},_0x3ae657,_0x36af8e[_0x377c('0x4b')]);return db[_0x377c('0x2e')][_0x377c('0x4c')](_0x3ae657)[_0x377c('0x25')](handleEntityNotFound(_0x467eac,null))[_0x377c('0x25')](respondWithResult(_0x467eac,null))[_0x377c('0x46')](handleError(_0x467eac,null));};exports['create']=function(_0x16928c,_0x3f7b68){return db[_0x377c('0x2e')][_0x377c('0x4d')](_0x16928c[_0x377c('0x4e')],{})[_0x377c('0x25')](function(_0x2114b3){var _0x18475a=_0x16928c[_0x377c('0x4f')][_0x377c('0x26')]({'plain':!![]});if(!_0x18475a)throw new Error(_0x377c('0x50'));if(_0x18475a['role']==='user'){var _0x34296b=_0x2114b3[_0x377c('0x26')]({'plain':!![]});var _0x2824da=_0x377c('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x2824da,'userProfileId':_0x18475a[_0x377c('0x52')]},'raw':!![]})['then'](function(_0x5060fd){if(_0x5060fd&&_0x5060fd[_0x377c('0x53')]===0x0){return db[_0x377c('0x28')][_0x377c('0x4d')]({'name':_0x34296b[_0x377c('0x2b')],'resourceId':_0x34296b['id'],'type':_0x377c('0x27'),'sectionId':_0x5060fd['id']},{})['then'](function(){return _0x2114b3;});}else{return _0x2114b3;}})[_0x377c('0x46')](function(_0x15d3bd){logger[_0x377c('0x29')](_0x377c('0x54'),_0x15d3bd);throw _0x15d3bd;});}return _0x2114b3;})[_0x377c('0x25')](respondWithResult(_0x3f7b68,0xc9))['catch'](handleError(_0x3f7b68,null));};exports['update']=function(_0x19cc45,_0x56e29f){if(_0x19cc45[_0x377c('0x4e')]['id']){delete _0x19cc45[_0x377c('0x4e')]['id'];}return db[_0x377c('0x2e')]['find']({'where':{'id':_0x19cc45[_0x377c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e29f,null))[_0x377c('0x25')](saveUpdates(_0x19cc45[_0x377c('0x4e')],null))[_0x377c('0x25')](respondWithResult(_0x56e29f,null))[_0x377c('0x46')](handleError(_0x56e29f,null));};exports[_0x377c('0x55')]=function(_0x176be5,_0x334f17){return db[_0x377c('0x2e')][_0x377c('0x4c')]({'where':{'id':_0x176be5[_0x377c('0x48')]['id']}})[_0x377c('0x25')](handleEntityNotFound(_0x334f17,null))[_0x377c('0x25')](removeEntity(_0x334f17,null))['catch'](handleError(_0x334f17,null));};exports[_0x377c('0x56')]=function(_0x24c6f7,_0x2f40a3){var _0x3eab9a=0xa;var _0x155d54=[_0x377c('0x57'),'left_join',_0x377c('0x58'),_0x377c('0x59')];var _0x14a048={'SUM':_0x377c('0x5a'),'COUNT':_0x377c('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x377c('0x5c'),'MIN':_0x377c('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x377c('0x5e'),'GROUP_CONCAT ASC':_0x377c('0x5f'),'GROUP_CONCAT DESC':_0x377c('0x60')};var _0x338f9f={'SEC_TO_TIME':_0x377c('0x61'),'DATE':_0x377c('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x377c('0x63'),'UNIX_TIMESTAMP':_0x377c('0x64')};var _0x5b98a3=function(_0x197123){return!_[_0x377c('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x377c('0x66'),_0x377c('0x67')],_0x197123);};var _0x1453d4=function(_0xc49ace){if(!_0xc49ace||!_0xc49ace[_0x377c('0x68')]['length']){return'';}for(var _0x55bb57='(',_0x144626=0x0;_0x144626<_0xc49ace[_0x377c('0x68')][_0x377c('0x39')];_0x144626+=0x1){_0x144626>0x0&&(_0x55bb57+='\x20'+_0xc49ace[_0x377c('0x69')]+'\x20');_0x55bb57+=_0xc49ace['rules'][_0x144626][_0x377c('0x6a')]?_0x1453d4(_0xc49ace[_0x377c('0x68')][_0x144626][_0x377c('0x6a')]):_0xc49ace[_0x377c('0x68')][_0x144626][_0x377c('0x6b')]+'\x20'+_0xc49ace[_0x377c('0x68')][_0x144626][_0x377c('0x6c')]+(_0x5b98a3(_0xc49ace[_0x377c('0x68')][_0x144626][_0x377c('0x6c')])?'\x20'+_0xc49ace[_0x377c('0x68')][_0x144626]['value']:'');}return _0x55bb57+')';};var _0x39e43f={'where':{'id':_0x24c6f7[_0x377c('0x48')]['id']}},_0x501430,_0x41e0f9,_0x1e67d6,_0x4d8392,_0x55b69b;_0x39e43f=_[_0x377c('0x42')]({},_0x39e43f,_0x24c6f7[_0x377c('0x4b')]);return db['AnalyticDefaultReport']['find'](_0x39e43f)[_0x377c('0x25')](function(_0x85faab){if(_0x85faab){_0x501430=_0x85faab;return _0x85faab[_0x377c('0x6d')]();}return null;})['then'](function(_0x34e7d0){if(_0x34e7d0){if(!_0x34e7d0[_0x377c('0x39')]){throw new db['Sequelize'][(_0x377c('0x6e'))](_0x377c('0x6f'),0x193);}_0x41e0f9=_0x34e7d0;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x377c('0x25')](function(_0x496555){if(_0x496555){_0x1e67d6=_[_0x377c('0x70')](_0x496555,'id');var _0x37b146;var _0x37bcd1=squel[_0x377c('0x71')]();_0x37bcd1[_0x377c('0x72')](_0x501430[_0x377c('0x73')]);for(var _0x522461=0x0;_0x522461<_0x41e0f9[_0x377c('0x39')];_0x522461+=0x1){_0x37b146=_0x41e0f9[_0x522461][_0x377c('0x74')]?_0x1e67d6[_0x41e0f9[_0x522461][_0x377c('0x74')]]['metric']:_0x41e0f9[_0x522461][_0x377c('0x6b')];_0x37b146=_0x41e0f9[_0x522461][_0x377c('0x75')]?_[_0x377c('0x76')](_0x14a048[_0x41e0f9[_0x522461][_0x377c('0x75')]],'%s',_0x37b146):_0x37b146;_0x37b146=_0x41e0f9[_0x522461]['format']?_['replace'](_0x338f9f[_0x41e0f9[_0x522461]['format']],'%s',_0x37b146):_0x37b146;if(_0x41e0f9[_0x522461][_0x377c('0x77')]){_0x37bcd1[_0x377c('0x6a')](_0x37b146);}_0x41e0f9[_0x522461][_0x377c('0x78')]&&_0x37bcd1['order'](_0x37b146,_0x41e0f9[_0x522461][_0x377c('0x78')]===_0x377c('0x79')?![]:!![]);_0x37bcd1[_0x377c('0x6b')](_0x37b146,_0x41e0f9[_0x522461]['alias']||_0x37b146);}if(_0x501430[_0x377c('0x7a')]){_0x501430[_0x377c('0x7a')]=JSON[_0x377c('0x7b')](_0x501430[_0x377c('0x7a')]);for(var _0x4c8a84=0x0;_0x4c8a84<_0x501430[_0x377c('0x7a')][_0x377c('0x39')];_0x4c8a84+=0x1){if(_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x31')]&&_['includes'](_0x155d54,_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x31')])&&_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7c')]&&_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7d')]&&_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7e')]){_0x37bcd1[_0x501430['joins'][_0x4c8a84]['type']](_0x501430['joins'][_0x4c8a84][_0x377c('0x7d')],null,util['format'](_0x377c('0x7f'),_0x501430[_0x377c('0x73')],_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7c')],_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7d')],_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7e')]));}}}if(_0x501430[_0x377c('0x80')]){_0x501430['conditions']=JSON[_0x377c('0x7b')](_0x501430[_0x377c('0x80')]);_0x37bcd1[_0x377c('0x41')](_0x1453d4(_0x501430['conditions']['group']));}_0x55b69b=_0x37bcd1['clone']();_0x37bcd1['limit'](_0x3eab9a);_0x37bcd1[_0x377c('0x1f')](0x0);logger[_0x377c('0x81')](_0x377c('0x82'),_0x37bcd1[_0x377c('0x83')]());return db[_0x377c('0x84')][_0x377c('0x34')](_0x37bcd1[_0x377c('0x83')](),{'type':db['sequelize'][_0x377c('0x85')][_0x377c('0x86')]});}})['then'](respondWithResult(_0x2f40a3,null))[_0x377c('0x46')](handleError(_0x2f40a3,null));};function runReport(_0x50ca8d,_0x826de,_0x41a9be){var _0x1f0df4=_0x826de['name'];var _0x533aa1=0xa;var _0x771006=[_0x377c('0x57'),'left_join',_0x377c('0x58'),_0x377c('0x59')];var _0x1da705={'SUM':'SUM(%s)','COUNT':_0x377c('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x377c('0x5c'),'MIN':_0x377c('0x5d'),'AVG':_0x377c('0x87'),'GROUP_CONCAT':_0x377c('0x5e'),'GROUP_CONCAT ASC':_0x377c('0x5f'),'GROUP_CONCAT DESC':_0x377c('0x60')};var _0x2ad0fd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x377c('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2439f5=function(_0x18e572){return!_[_0x377c('0x65')]([_0x377c('0x88'),_0x377c('0x89'),_0x377c('0x66'),_0x377c('0x67')],_0x18e572);};var _0x353bd4=function(_0x170f2f){if(!_0x170f2f||!_0x170f2f[_0x377c('0x68')][_0x377c('0x39')]){return'';}for(var _0x585a93='(',_0x13118f=0x0;_0x13118f<_0x170f2f[_0x377c('0x68')]['length'];_0x13118f+=0x1){_0x13118f>0x0&&(_0x585a93+='\x20'+_0x170f2f[_0x377c('0x69')]+'\x20');_0x585a93+=_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6a')]?_0x353bd4(_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6a')]):_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6b')]+'\x20'+_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6c')]+(_0x2439f5(_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6c')])?'\x20'+_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x8a')]:'');}return _0x585a93+')';};var _0x581be4={'where':{'id':_0x50ca8d['id']}},_0x34f22d,_0x4a15ce,_0x496207,_0x1b743f,_0xcf5bb6;_0x581be4=_[_0x377c('0x42')]({},_0x581be4,_0x41a9be);return db['AnalyticDefaultReport'][_0x377c('0x4c')](_0x581be4)['then'](function(_0x491aa1){if(_0x491aa1){_0x34f22d=_0x491aa1;return _0x491aa1[_0x377c('0x6d')]();}return null;})[_0x377c('0x25')](function(_0x20cca0){if(_0x20cca0){if(!_0x20cca0[_0x377c('0x39')]){throw new db[(_0x377c('0x8b'))][(_0x377c('0x6e'))](_0x377c('0x6f'),0x193);}_0x4a15ce=_0x20cca0;return db[_0x377c('0x8c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x55d2fe){if(_0x55d2fe){_0x496207=_['keyBy'](_0x55d2fe,'id');var _0x53b948;var _0x4486f6=squel[_0x377c('0x71')]();_0x4486f6['from'](_0x34f22d[_0x377c('0x73')]);for(var _0x2afe73=0x0;_0x2afe73<_0x4a15ce['length'];_0x2afe73+=0x1){_0x53b948=_0x4a15ce[_0x2afe73][_0x377c('0x74')]?_0x496207[_0x4a15ce[_0x2afe73]['MetricId']][_0x377c('0x8d')]:_0x4a15ce[_0x2afe73][_0x377c('0x6b')];_0x53b948=_0x4a15ce[_0x2afe73][_0x377c('0x75')]?_[_0x377c('0x76')](_0x1da705[_0x4a15ce[_0x2afe73]['function']],'%s',_0x53b948):_0x53b948;_0x53b948=_0x4a15ce[_0x2afe73][_0x377c('0x8e')]?_['replace'](_0x2ad0fd[_0x4a15ce[_0x2afe73][_0x377c('0x8e')]],'%s',_0x53b948):_0x53b948;if(_0x4a15ce[_0x2afe73][_0x377c('0x77')]){_0x4486f6['group'](_0x53b948);}_0x4a15ce[_0x2afe73][_0x377c('0x78')]&&_0x4486f6[_0x377c('0x3d')](_0x53b948,_0x4a15ce[_0x2afe73][_0x377c('0x78')]===_0x377c('0x79')?![]:!![]);_0x4486f6[_0x377c('0x6b')](_0x53b948,_0x4a15ce[_0x2afe73][_0x377c('0x8f')]||_0x53b948);}if(_0x34f22d[_0x377c('0x7a')]){_0x34f22d[_0x377c('0x7a')]=JSON[_0x377c('0x7b')](_0x34f22d[_0x377c('0x7a')]);for(var _0x10e8a3=0x0;_0x10e8a3<_0x34f22d['joins']['length'];_0x10e8a3+=0x1){if(_0x34f22d[_0x377c('0x7a')][_0x10e8a3]['type']&&_[_0x377c('0x65')](_0x771006,_0x34f22d[_0x377c('0x7a')][_0x10e8a3]['type'])&&_0x34f22d[_0x377c('0x7a')][_0x10e8a3][_0x377c('0x7c')]&&_0x34f22d[_0x377c('0x7a')][_0x10e8a3][_0x377c('0x7d')]&&_0x34f22d['joins'][_0x10e8a3][_0x377c('0x7e')]){_0x4486f6[_0x34f22d[_0x377c('0x7a')][_0x10e8a3][_0x377c('0x31')]](_0x34f22d[_0x377c('0x7a')][_0x10e8a3]['foreignTable'],null,util[_0x377c('0x8e')](_0x377c('0x7f'),_0x34f22d[_0x377c('0x73')],_0x34f22d[_0x377c('0x7a')][_0x10e8a3][_0x377c('0x7c')],_0x34f22d['joins'][_0x10e8a3][_0x377c('0x7d')],_0x34f22d[_0x377c('0x7a')][_0x10e8a3]['foreignKey']));}}}if(_0x34f22d['conditions']){_0x34f22d[_0x377c('0x80')]=JSON[_0x377c('0x7b')](_0x34f22d[_0x377c('0x80')]);_0x4486f6['where'](_0x353bd4(_0x34f22d[_0x377c('0x80')]['group']));}_0xcf5bb6=_0x4486f6[_0x377c('0x90')]();_0x4486f6['limit'](_0x533aa1);_0x4486f6['offset'](0x0);logger[_0x377c('0x81')](_0x377c('0x82'),_0x4486f6[_0x377c('0x83')]());return db['sequelize'][_0x377c('0x34')](_0x4486f6['toString'](),{'type':db[_0x377c('0x84')][_0x377c('0x85')][_0x377c('0x86')]});}})[_0x377c('0x25')](function(_0x6ab706){if(!_0x6ab706[_0x377c('0x39')]){throw new db['Sequelize'][(_0x377c('0x6e'))](_0x377c('0x91'),0xcc);}if(_0x826de[_0x377c('0x92')]===_0x377c('0x93')){return null;}var _0x31611b=_['merge'](_0x826de,{'name':_0x826de[_0x377c('0x94')]||_0x826de[_0x377c('0x2b')]||_0x34f22d[_0x377c('0x2b')],'basename':_0x1f0df4,'savename':util[_0x377c('0x8e')](_0x377c('0x95'),_0x826de['name']||_0x34f22d[_0x377c('0x2b')],require('randomstring')[_0x377c('0x96')](0x4),_0x826de['output']||_0x377c('0x97')),'reportId':_0x34f22d['id'],'reportType':_0x377c('0x98')});return db[_0x377c('0x99')][_0x377c('0x4d')](_0x31611b,{'raw':!![]});})[_0x377c('0x25')](function(_0xc49039){if(_0x34f22d[_0x377c('0x73')]==='cdr'){_0xcf5bb6['where'](_0x34f22d[_0x377c('0x73')]+_0x377c('0x9a'),_0x826de[_0x377c('0x9b')],_0x826de['endDate']);}else{_0xcf5bb6['where'](_0x34f22d[_0x377c('0x73')]+_0x377c('0x9c'),_0x826de[_0x377c('0x9b')],_0x826de['endDate']);}if(_0xc49039){logger[_0x377c('0x9d')]('Run\x20Query:',_0xcf5bb6['toString']());require(_0x377c('0x9e'))[_0x377c('0x9f')](path[_0x377c('0x57')](__dirname,_0x377c('0xa0'),_0xc49039['output']),[_0xc49039['id'],_0xcf5bb6[_0x377c('0x83')](),path[_0x377c('0x57')](__dirname,_0x377c('0xa1'),_0xc49039[_0x377c('0xa2')]),_0x1f0df4]);return _0xc49039;}else{var _0x398faf=squel['select']();_0x398faf[_0x377c('0x72')]('('+_0xcf5bb6['toString']()+')',_0x377c('0xa3'));_0x398faf[_0x377c('0x6b')](_0x377c('0xa4'),_0x377c('0x1e'));_0xcf5bb6['limit'](_0x826de[_0x377c('0x3c')]||_0x533aa1);_0xcf5bb6[_0x377c('0x1f')](_0x826de[_0x377c('0x1f')]||0x0);return dbH['sequelize'][_0x377c('0x34')](_0x398faf['toString'](),{'type':dbH['sequelize']['QueryTypes']['SELECT']})[_0x377c('0x25')](function(_0x1bb017){if(!_0x1bb017[_0x377c('0x39')]){_0x1b743f=0x0;}else{_0x1b743f=_0x1bb017[0x0]['count']||0x0;}return dbH[_0x377c('0x84')][_0x377c('0x34')](_0xcf5bb6[_0x377c('0x83')](),{'type':dbH[_0x377c('0x84')][_0x377c('0x85')][_0x377c('0x86')]});})['then'](function(_0x11e08e){return{'rows':_0x11e08e||[],'count':_0x1b743f};});}});}exports['run']=function(_0x118548,_0x501aed){return runReport(_0x118548['params'],_0x118548['query'],_0x118548['options'])[_0x377c('0x25')](respondWithResult(_0x501aed,null))['catch'](handleError(_0x501aed,null));};exports[_0x377c('0xa5')]=runReport;exports[_0x377c('0x34')]=function(_0x4493e0,_0x502bb8){var _0x5088a1=0xa;var _0x752f88=[_0x377c('0x57'),_0x377c('0xa6'),_0x377c('0x58'),_0x377c('0x59')];var _0x5932a1={'SUM':'SUM(%s)','COUNT':_0x377c('0x5b'),'COUNT DISTINCT':_0x377c('0xa7'),'MAX':_0x377c('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x377c('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x377c('0x60')};var _0x4351f3={'SEC_TO_TIME':_0x377c('0x61'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x377c('0x63'),'UNIX_TIMESTAMP':_0x377c('0x64')};var _0x354711=function(_0x4bbe27){return!_['includes']([_0x377c('0x88'),_0x377c('0x89'),_0x377c('0x66'),_0x377c('0x67')],_0x4bbe27);};var _0x3969b1=function(_0x4c9c00){if(!_0x4c9c00||!_0x4c9c00[_0x377c('0x68')][_0x377c('0x39')]){return'';}for(var _0x41bbdc='(',_0x288f0a=0x0;_0x288f0a<_0x4c9c00[_0x377c('0x68')][_0x377c('0x39')];_0x288f0a+=0x1){_0x288f0a>0x0&&(_0x41bbdc+='\x20'+_0x4c9c00[_0x377c('0x69')]+'\x20');_0x41bbdc+=_0x4c9c00['rules'][_0x288f0a][_0x377c('0x6a')]?_0x3969b1(_0x4c9c00[_0x377c('0x68')][_0x288f0a][_0x377c('0x6a')]):_0x4c9c00['rules'][_0x288f0a][_0x377c('0x6b')]+'\x20'+_0x4c9c00[_0x377c('0x68')][_0x288f0a][_0x377c('0x6c')]+(_0x354711(_0x4c9c00[_0x377c('0x68')][_0x288f0a][_0x377c('0x6c')])?'\x20'+_0x4c9c00[_0x377c('0x68')][_0x288f0a][_0x377c('0x8a')]:'');}return _0x41bbdc+')';};var _0x35cc94={'where':{'id':_0x4493e0[_0x377c('0x48')]['id']}},_0xa4b420,_0x5cf420,_0x475041,_0x59c785,_0x41d49e;_0x35cc94=_[_0x377c('0x42')]({},_0x35cc94,_0x4493e0[_0x377c('0x4b')]);return db[_0x377c('0x2e')][_0x377c('0x4c')](_0x35cc94)[_0x377c('0x25')](function(_0x307bc5){if(_0x307bc5){_0xa4b420=_0x307bc5;return _0x307bc5[_0x377c('0x6d')]();}return null;})[_0x377c('0x25')](function(_0x1cb7cb){if(_0x1cb7cb){if(!_0x1cb7cb[_0x377c('0x39')]){throw new db[(_0x377c('0x8b'))][(_0x377c('0x6e'))](_0x377c('0x6f'),0x193);}_0x5cf420=_0x1cb7cb;return db['AnalyticMetric'][_0x377c('0xa8')]({'raw':!![]});}return null;})[_0x377c('0x25')](function(_0x2f4df3){if(_0x2f4df3){_0x475041=_[_0x377c('0x70')](_0x2f4df3,'id');var _0x42f49a;var _0x37d9f9=squel[_0x377c('0x71')]();_0x37d9f9[_0x377c('0x72')](_0xa4b420['table']);for(var _0x3620cc=0x0;_0x3620cc<_0x5cf420[_0x377c('0x39')];_0x3620cc+=0x1){_0x42f49a=_0x5cf420[_0x3620cc][_0x377c('0x74')]?_0x475041[_0x5cf420[_0x3620cc][_0x377c('0x74')]][_0x377c('0x8d')]:_0x5cf420[_0x3620cc][_0x377c('0x6b')];_0x42f49a=_0x5cf420[_0x3620cc][_0x377c('0x75')]?_[_0x377c('0x76')](_0x5932a1[_0x5cf420[_0x3620cc]['function']],'%s',_0x42f49a):_0x42f49a;_0x42f49a=_0x5cf420[_0x3620cc][_0x377c('0x8e')]?_['replace'](_0x4351f3[_0x5cf420[_0x3620cc][_0x377c('0x8e')]],'%s',_0x42f49a):_0x42f49a;if(_0x5cf420[_0x3620cc][_0x377c('0x77')]){_0x37d9f9[_0x377c('0x6a')](_0x42f49a);}_0x5cf420[_0x3620cc][_0x377c('0x78')]&&_0x37d9f9[_0x377c('0x3d')](_0x42f49a,_0x5cf420[_0x3620cc]['orderBy']===_0x377c('0x79')?![]:!![]);_0x37d9f9[_0x377c('0x6b')](_0x42f49a,_0x5cf420[_0x3620cc][_0x377c('0x8f')]||_0x42f49a);}if(_0xa4b420['joins']){_0xa4b420[_0x377c('0x7a')]=JSON[_0x377c('0x7b')](_0xa4b420[_0x377c('0x7a')]);for(var _0x27dc39=0x0;_0x27dc39<_0xa4b420[_0x377c('0x7a')]['length'];_0x27dc39+=0x1){if(_0xa4b420[_0x377c('0x7a')][_0x27dc39]['type']&&_[_0x377c('0x65')](_0x752f88,_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x31')])&&_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7c')]&&_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7d')]&&_0xa4b420[_0x377c('0x7a')][_0x27dc39]['foreignKey']){_0x37d9f9[_0xa4b420['joins'][_0x27dc39][_0x377c('0x31')]](_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7d')],null,util[_0x377c('0x8e')]('%s.%s\x20=\x20%s.%s',_0xa4b420['table'],_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7c')],_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7d')],_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7e')]));}}}if(_0xa4b420['conditions']){_0xa4b420[_0x377c('0x80')]=JSON[_0x377c('0x7b')](_0xa4b420[_0x377c('0x80')]);_0x37d9f9[_0x377c('0x41')](_0x3969b1(_0xa4b420[_0x377c('0x80')]['group']));}_0x41d49e=_0x37d9f9[_0x377c('0x90')]();_0x37d9f9[_0x377c('0x3c')](_0x5088a1);_0x37d9f9[_0x377c('0x1f')](0x0);logger[_0x377c('0x81')](_0x377c('0x82'),_0x37d9f9[_0x377c('0x83')]());return db[_0x377c('0x84')]['query'](_0x37d9f9[_0x377c('0x83')](),{'type':db[_0x377c('0x84')][_0x377c('0x85')][_0x377c('0x86')]});}})['then'](function(){return{'sql':_0x41d49e[_0x377c('0x83')]()};})['then'](respondWithResult(_0x502bb8,null))[_0x377c('0x46')](handleError(_0x502bb8,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ee5f60d..6453033 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 _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x1d7c9d,_0x198c69){var _0x534e9e=function(_0x436052){while(--_0x436052){_0x1d7c9d['push'](_0x1d7c9d['shift']());}};_0x534e9e(++_0x198c69);}(_0x0295,0x1f0));var _0x5029=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x0295[_0x25efdf];return _0x22c495;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['analytics_default_reports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x143f23,_0x121813){var _0x4feb05=function(_0xcbd567){while(--_0xcbd567){_0x143f23['push'](_0x143f23['shift']());}};_0x4feb05(++_0x121813);}(_0x326f,0xd1));var _0xf326=function(_0x3281bc,_0x503259){_0x3281bc=_0x3281bc-0x0;var _0x12d60a=_0x326f[_0x3281bc];return _0x12d60a;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index cdce622..69a75ba 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 _0x93ed=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message'];(function(_0x41ef02,_0x101e1a){var _0x5e6995=function(_0x124fdd){while(--_0x124fdd){_0x41ef02['push'](_0x41ef02['shift']());}};_0x5e6995(++_0x101e1a);}(_0x93ed,0xfe));var _0xd93e=function(_0x18f074,_0x41b2c0){_0x18f074=_0x18f074-0x0;var _0x24832a=_0x93ed[_0x18f074];return _0x24832a;};'use strict';var _=require(_0xd93e('0x0'));var util=require(_0xd93e('0x1'));var moment=require(_0xd93e('0x2'));var BPromise=require(_0xd93e('0x3'));var rs=require(_0xd93e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd93e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd93e('0x6'))(_0xd93e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd93e('0x8'));var client=jayson[_0xd93e('0x9')][_0xd93e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x478305,_0xd74ab3,_0x4998bf){return new BPromise(function(_0x4ef1a1,_0x466fca){return client[_0xd93e('0xb')](_0x478305,_0x4998bf)[_0xd93e('0xc')](function(_0x14fc46){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0xd74ab3,_0xd93e('0xd'));logger['debug'](_0xd93e('0xe'),_0xd74ab3,_0xd93e('0xd'),JSON[_0xd93e('0xf')](_0x14fc46));if(_0x14fc46[_0xd93e('0x10')]){if(_0x14fc46[_0xd93e('0x10')]['code']===0x1f4){logger[_0xd93e('0x10')](_0xd93e('0x11'),_0xd74ab3,_0x14fc46[_0xd93e('0x10')][_0xd93e('0x12')]);return _0x466fca(_0x14fc46[_0xd93e('0x10')]['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0xd74ab3,_0x14fc46['error'][_0xd93e('0x12')]);return _0x4ef1a1(_0x14fc46[_0xd93e('0x10')][_0xd93e('0x12')]);}else{logger['info'](_0xd93e('0x11'),_0xd74ab3,'request\x20sent');_0x4ef1a1(_0x14fc46[_0xd93e('0x13')][_0xd93e('0x12')]);}})[_0xd93e('0x14')](function(_0x1ba021){logger[_0xd93e('0x10')](_0xd93e('0x11'),_0xd74ab3,_0x1ba021);_0x466fca(_0x1ba021);});});} \ No newline at end of file +var _0xb240=['http','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb240,0x7e));var _0x0b24=function(_0x2f31d0,_0x24a1d7){_0x2f31d0=_0x2f31d0-0x0;var _0x35c9c3=_0xb240[_0x2f31d0];return _0x35c9c3;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var moment=require(_0x0b24('0x2'));var BPromise=require(_0x0b24('0x3'));var rs=require(_0x0b24('0x4'));var fs=require('fs');var Redis=require(_0x0b24('0x5'));var db=require(_0x0b24('0x6'))['db'];var utils=require(_0x0b24('0x7'));var logger=require(_0x0b24('0x8'))('rpc');var config=require(_0x0b24('0x9'));var jayson=require(_0x0b24('0xa'));var client=jayson[_0x0b24('0xb')][_0x0b24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x162a50,_0x53526b,_0x238a19){return new BPromise(function(_0x34be24,_0x41b7b9){return client['request'](_0x162a50,_0x238a19)['then'](function(_0x2679d5){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x53526b,_0x0b24('0xd'));logger[_0x0b24('0xe')](_0x0b24('0xf'),_0x53526b,_0x0b24('0xd'),JSON[_0x0b24('0x10')](_0x2679d5));if(_0x2679d5[_0x0b24('0x11')]){if(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x12')]===0x1f4){logger['error'](_0x0b24('0x13'),_0x53526b,_0x2679d5[_0x0b24('0x11')]['message']);return _0x41b7b9(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x14')]);}logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x2679d5['error']['message']);return _0x34be24(_0x2679d5['error']['message']);}else{logger[_0x0b24('0x15')](_0x0b24('0x13'),_0x53526b,_0x0b24('0xd'));_0x34be24(_0x2679d5['result'][_0x0b24('0x14')]);}})[_0x0b24('0x16')](function(_0x1fd966){logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x1fd966);_0x41b7b9(_0x1fd966);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index c176f71..e912116 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 _0x6a13=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','run','create','put','delete','destroy'];(function(_0x27e37d,_0x45a064){var _0x2375d2=function(_0x375c36){while(--_0x375c36){_0x27e37d['push'](_0x27e37d['shift']());}};_0x2375d2(++_0x45a064);}(_0x6a13,0x16a));var _0x36a1=function(_0x3eab63,_0x8e719c){_0x3eab63=_0x3eab63-0x0;var _0x143ad6=_0x6a13[_0x3eab63];return _0x143ad6;};'use strict';var multer=require(_0x36a1('0x0'));var util=require(_0x36a1('0x1'));var path=require('path');var timeout=require(_0x36a1('0x2'));var express=require(_0x36a1('0x3'));var router=express['Router']();var auth=require(_0x36a1('0x4'));var interaction=require(_0x36a1('0x5'));var config=require(_0x36a1('0x6'));var controller=require(_0x36a1('0x7'));router[_0x36a1('0x8')]('/',auth[_0x36a1('0x9')](),controller[_0x36a1('0xa')]);router[_0x36a1('0x8')](_0x36a1('0xb'),auth[_0x36a1('0x9')](),controller['show']);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0x36a1('0xc')]);router[_0x36a1('0x8')]('/:id/run',auth[_0x36a1('0x9')](),controller[_0x36a1('0xd')]);router[_0x36a1('0x8')]('/:id/query',auth[_0x36a1('0x9')](),controller['query']);router['post']('/',auth[_0x36a1('0x9')](),controller[_0x36a1('0xe')]);router[_0x36a1('0xf')]('/:id',auth[_0x36a1('0x9')](),controller['update']);router[_0x36a1('0x10')](_0x36a1('0xb'),auth[_0x36a1('0x9')](),controller[_0x36a1('0x11')]);module[_0x36a1('0x12')]=router; \ No newline at end of file +var _0x7ced=['run','query','create','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run'];(function(_0x5ccc99,_0x4c1dde){var _0x511532=function(_0x4a892a){while(--_0x4a892a){_0x5ccc99['push'](_0x5ccc99['shift']());}};_0x511532(++_0x4c1dde);}(_0x7ced,0x1a8));var _0xd7ce=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x7ced[_0x4bd950];return _0x5dc59a;};'use strict';var multer=require(_0xd7ce('0x0'));var util=require(_0xd7ce('0x1'));var path=require(_0xd7ce('0x2'));var timeout=require(_0xd7ce('0x3'));var express=require(_0xd7ce('0x4'));var router=express['Router']();var auth=require(_0xd7ce('0x5'));var interaction=require(_0xd7ce('0x6'));var config=require(_0xd7ce('0x7'));var controller=require(_0xd7ce('0x8'));router[_0xd7ce('0x9')]('/',auth[_0xd7ce('0xa')](),controller[_0xd7ce('0xb')]);router[_0xd7ce('0x9')](_0xd7ce('0xc'),auth[_0xd7ce('0xa')](),controller[_0xd7ce('0xd')]);router['get'](_0xd7ce('0xe'),auth[_0xd7ce('0xa')](),controller['preview']);router['get'](_0xd7ce('0xf'),auth['isAuthenticated'](),controller[_0xd7ce('0x10')]);router['get']('/:id/query',auth[_0xd7ce('0xa')](),controller[_0xd7ce('0x11')]);router['post']('/',auth[_0xd7ce('0xa')](),controller[_0xd7ce('0x12')]);router['put'](_0xd7ce('0xc'),auth[_0xd7ce('0xa')](),controller[_0xd7ce('0x13')]);router[_0xd7ce('0x14')]('/:id',auth[_0xd7ce('0xa')](),controller['destroy']);module[_0xd7ce('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 943e086..e64ba59 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 _0xd976=['STRING','ENUM','pdf','xlsx','csv','DATE','manual','INTEGER','UNSIGNED','sequelize'];(function(_0x35eb8d,_0x2265c4){var _0x447a49=function(_0x163187){while(--_0x163187){_0x35eb8d['push'](_0x35eb8d['shift']());}};_0x447a49(++_0x2265c4);}(_0xd976,0x135));var _0x6d97=function(_0x154e02,_0x11b0e1){_0x154e02=_0x154e02-0x0;var _0x3bd6d1=_0xd976[_0x154e02];return _0x3bd6d1;};'use strict';var Sequelize=require(_0x6d97('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x6d97('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x6d97('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x6d97('0x2')]('csv',_0x6d97('0x3'),_0x6d97('0x4')),'allowNull':![],'defaultValue':_0x6d97('0x5')},'savename':{'type':Sequelize[_0x6d97('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x6d97('0x6')]},'status':{'type':Sequelize[_0x6d97('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x6d97('0x7'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x6d97('0x8')](0xb)[_0x6d97('0x9')]},'reportType':{'type':Sequelize[_0x6d97('0x1')]}}; \ No newline at end of file +var _0xe378=['UNSIGNED','moment','exports','STRING','csv','pdf','xlsx','DATE','Loading','ENUM','manual','INTEGER'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xe378,0xa9));var _0x8e37=function(_0x3f3f75,_0x5e215f){_0x3f3f75=_0x3f3f75-0x0;var _0x322635=_0xe378[_0x3f3f75];return _0x322635;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8e37('0x0'));module[_0x8e37('0x1')]={'name':{'type':Sequelize[_0x8e37('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x8e37('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x8e37('0x3'),_0x8e37('0x4'),_0x8e37('0x5')),'allowNull':![],'defaultValue':_0x8e37('0x3')},'savename':{'type':Sequelize[_0x8e37('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x8e37('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x8e37('0x7')},'type':{'type':Sequelize[_0x8e37('0x8')](_0x8e37('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x8e37('0x9')},'reportId':{'type':Sequelize[_0x8e37('0xa')](0xb)[_0x8e37('0xb')]},'reportType':{'type':Sequelize[_0x8e37('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 0ef77c2..65aa794 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 _0xa0a3=['reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','length','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ExtractedReports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','download','savename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','server/files/reports','%s.%s','basename','toLowerCase','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','limit','set'];(function(_0x20fa49,_0x2e4b4c){var _0x7de2aa=function(_0x227fed){while(--_0x227fed){_0x20fa49['push'](_0x20fa49['shift']());}};_0x7de2aa(++_0x2e4b4c);}(_0xa0a3,0xf4));var _0x3a0a=function(_0x2c6f7c,_0x5de691){_0x2c6f7c=_0x2c6f7c-0x0;var _0x5efaa0=_0xa0a3[_0x2c6f7c];return _0x5efaa0;};'use strict';var pdf=require(_0x3a0a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3a0a('0x1'));var jsonpatch=require(_0x3a0a('0x2'));var rp=require(_0x3a0a('0x3'));var moment=require('moment');var BPromise=require(_0x3a0a('0x4'));var Mustache=require(_0x3a0a('0x5'));var util=require(_0x3a0a('0x6'));var path=require(_0x3a0a('0x7'));var sox=require(_0x3a0a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3a0a('0x9'));var squel=require(_0x3a0a('0xa'));var crypto=require('crypto');var jsforce=require(_0x3a0a('0xb'));var deskjs=require(_0x3a0a('0xc'));var toCsv=require(_0x3a0a('0xd'));var querystring=require(_0x3a0a('0xe'));var Papa=require(_0x3a0a('0xf'));var Redis=require(_0x3a0a('0x10'));var authService=require(_0x3a0a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3a0a('0x12'));var hardwareService=require(_0x3a0a('0x13'));var logger=require(_0x3a0a('0x14'))('api');var utils=require(_0x3a0a('0x15'));var config=require('../../config/environment');var db=require(_0x3a0a('0x16'))['db'];function respondWithStatusCode(_0x37f349,_0x24947d){_0x24947d=_0x24947d||0xcc;return function(_0x1b7e2b){if(_0x1b7e2b){return _0x37f349['sendStatus'](_0x24947d);}return _0x37f349[_0x3a0a('0x17')](_0x24947d)[_0x3a0a('0x18')]();};}function respondWithResult(_0x586dd3,_0x42d45e){_0x42d45e=_0x42d45e||0xc8;return function(_0x503f0c){if(_0x503f0c){return _0x586dd3[_0x3a0a('0x17')](_0x42d45e)[_0x3a0a('0x19')](_0x503f0c);}};}function respondWithFilteredResult(_0x261cb2,_0x13324c){return function(_0x2e6210){if(_0x2e6210){var _0x31aae3=_0x2e6210['count'],_0x3d9d72=_0x13324c[_0x3a0a('0x1a')],_0x4eb2b2=_0x13324c['offset']+_0x13324c[_0x3a0a('0x1b')],_0x42214a;if(_0x4eb2b2>=_0x31aae3){_0x4eb2b2=_0x31aae3;_0x42214a=0xc8;}else{_0x42214a=0xce;}_0x261cb2[_0x3a0a('0x17')](_0x42214a);return _0x261cb2[_0x3a0a('0x1c')]('Content-Range',_0x3d9d72+'-'+_0x4eb2b2+'/'+_0x31aae3)['json'](_0x2e6210);}return null;};}function patchUpdates(_0x14a933){return function(_0xb22fab){try{jsonpatch['apply'](_0xb22fab,_0x14a933,!![]);}catch(_0x2448c6){return BPromise[_0x3a0a('0x1d')](_0x2448c6);}return _0xb22fab['save']();};}function saveUpdates(_0x40c151,_0x299122){return function(_0x41d298){if(_0x41d298){return _0x41d298[_0x3a0a('0x1e')](_0x40c151)[_0x3a0a('0x1f')](function(_0x3d5123){return _0x3d5123;});}return null;};}function removeEntity(_0x31d598,_0x16f311){return function(_0x16d444){if(_0x16d444){return _0x16d444[_0x3a0a('0x20')]()['then'](function(){var _0x1badd8=_0x16d444[_0x3a0a('0x21')]({'plain':!![]});var _0x188bad='ExtractedReports';return db[_0x3a0a('0x22')]['destroy']({'where':{'type':_0x188bad,'resourceId':_0x1badd8['id']}})[_0x3a0a('0x1f')](function(){return _0x16d444;});})[_0x3a0a('0x1f')](function(){_0x31d598[_0x3a0a('0x17')](0xcc)[_0x3a0a('0x18')]();});}};}function handleEntityNotFound(_0x48c3cb,_0x7aa305){return function(_0x181123){if(!_0x181123){_0x48c3cb['sendStatus'](0x194);}return _0x181123;};}function handleError(_0x922b3f,_0x3c72e4){_0x3c72e4=_0x3c72e4||0x1f4;return function(_0x21dbdd){logger[_0x3a0a('0x23')](_0x21dbdd[_0x3a0a('0x24')]);if(_0x21dbdd['name']){delete _0x21dbdd[_0x3a0a('0x25')];}_0x922b3f[_0x3a0a('0x17')](_0x3c72e4)[_0x3a0a('0x26')](_0x21dbdd);};}exports[_0x3a0a('0x27')]=function(_0x5a1ad5,_0x191407){var _0x43063b={},_0x146f18={},_0xe692ce={'count':0x0,'rows':[]};var _0x882fbe=_['map'](db[_0x3a0a('0x28')][_0x3a0a('0x29')],function(_0x4f5b4c){return{'name':_0x4f5b4c[_0x3a0a('0x2a')],'type':_0x4f5b4c[_0x3a0a('0x2b')]['key']};});_0x146f18[_0x3a0a('0x2c')]=_[_0x3a0a('0x2d')](_0x882fbe,_0x3a0a('0x25'));_0x146f18[_0x3a0a('0x2e')]=_[_0x3a0a('0x2f')](_0x5a1ad5[_0x3a0a('0x2e')]);_0x146f18['filters']=_[_0x3a0a('0x30')](_0x146f18[_0x3a0a('0x2c')],_0x146f18[_0x3a0a('0x2e')]);_0x43063b[_0x3a0a('0x31')]=_[_0x3a0a('0x30')](_0x146f18[_0x3a0a('0x2c')],qs[_0x3a0a('0x32')](_0x5a1ad5['query'][_0x3a0a('0x32')]));_0x43063b['attributes']=_0x43063b[_0x3a0a('0x31')]['length']?_0x43063b[_0x3a0a('0x31')]:_0x146f18['model'];if(!_0x5a1ad5['query']['hasOwnProperty']('nolimit')){_0x43063b[_0x3a0a('0x1b')]=qs[_0x3a0a('0x1b')](_0x5a1ad5['query'][_0x3a0a('0x1b')]);_0x43063b['offset']=qs[_0x3a0a('0x1a')](_0x5a1ad5[_0x3a0a('0x2e')][_0x3a0a('0x1a')]);}_0x43063b[_0x3a0a('0x33')]=qs[_0x3a0a('0x34')](_0x5a1ad5['query'][_0x3a0a('0x34')]);_0x43063b[_0x3a0a('0x35')]=qs[_0x3a0a('0x36')](_[_0x3a0a('0x37')](_0x5a1ad5[_0x3a0a('0x2e')],_0x146f18['filters']),_0x882fbe);if(_0x5a1ad5[_0x3a0a('0x2e')][_0x3a0a('0x38')]){_0x43063b[_0x3a0a('0x35')]=_[_0x3a0a('0x39')](_0x43063b[_0x3a0a('0x35')],{'$or':_['map'](_0x882fbe,function(_0x25ef8e){if(_0x25ef8e[_0x3a0a('0x2b')]!=='VIRTUAL'){var _0x1c2a91={};_0x1c2a91[_0x25ef8e[_0x3a0a('0x25')]]={'$like':'%'+_0x5a1ad5[_0x3a0a('0x2e')][_0x3a0a('0x38')]+'%'};return _0x1c2a91;}})});}_0x43063b=_[_0x3a0a('0x39')]({},_0x43063b,_0x5a1ad5[_0x3a0a('0x3a')]);var _0x8694cc={'where':_0x43063b[_0x3a0a('0x35')]};return db[_0x3a0a('0x28')][_0x3a0a('0x3b')](_0x8694cc)[_0x3a0a('0x1f')](function(_0x4a49e4){_0xe692ce[_0x3a0a('0x3b')]=_0x4a49e4;if(_0x5a1ad5[_0x3a0a('0x2e')][_0x3a0a('0x3c')]){_0x43063b['include']=[{'all':!![]}];}return db[_0x3a0a('0x28')][_0x3a0a('0x3d')](_0x43063b);})['then'](function(_0x3ab020){_0xe692ce[_0x3a0a('0x3e')]=_0x3ab020;return _0xe692ce;})[_0x3a0a('0x1f')](respondWithFilteredResult(_0x191407,_0x43063b))['catch'](handleError(_0x191407,null));};exports[_0x3a0a('0x3f')]=function(_0x140b13,_0x3fd4d1){var _0x197aae={'raw':!![],'where':{'id':_0x140b13[_0x3a0a('0x40')]['id']}},_0x491b1f={};_0x491b1f[_0x3a0a('0x2c')]=_[_0x3a0a('0x2f')](db[_0x3a0a('0x28')][_0x3a0a('0x29')]);_0x491b1f['query']=_['keys'](_0x140b13[_0x3a0a('0x2e')]);_0x491b1f[_0x3a0a('0x36')]=_[_0x3a0a('0x30')](_0x491b1f[_0x3a0a('0x2c')],_0x491b1f['query']);_0x197aae[_0x3a0a('0x31')]=_[_0x3a0a('0x30')](_0x491b1f[_0x3a0a('0x2c')],qs['fields'](_0x140b13[_0x3a0a('0x2e')][_0x3a0a('0x32')]));_0x197aae[_0x3a0a('0x31')]=_0x197aae[_0x3a0a('0x31')][_0x3a0a('0x41')]?_0x197aae[_0x3a0a('0x31')]:_0x491b1f[_0x3a0a('0x2c')];if(_0x140b13[_0x3a0a('0x2e')]['includeAll']){_0x197aae[_0x3a0a('0x42')]=[{'all':!![]}];}_0x197aae=_[_0x3a0a('0x39')]({},_0x197aae,_0x140b13['options']);return db[_0x3a0a('0x28')]['find'](_0x197aae)[_0x3a0a('0x1f')](handleEntityNotFound(_0x3fd4d1,null))[_0x3a0a('0x1f')](respondWithResult(_0x3fd4d1,null))[_0x3a0a('0x43')](handleError(_0x3fd4d1,null));};exports[_0x3a0a('0x44')]=function(_0x260a93,_0x368758){return db[_0x3a0a('0x28')]['create'](_0x260a93['body'],{})[_0x3a0a('0x1f')](function(_0x1448ab){var _0x16c54d=_0x260a93['user'][_0x3a0a('0x21')]({'plain':!![]});if(!_0x16c54d)throw new Error(_0x3a0a('0x45'));if(_0x16c54d['role']===_0x3a0a('0x46')){var _0x42054e=_0x1448ab[_0x3a0a('0x21')]({'plain':!![]});var _0x3e38fd=_0x3a0a('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x3e38fd,'userProfileId':_0x16c54d['userProfileId']},'raw':!![]})[_0x3a0a('0x1f')](function(_0x2061f1){if(_0x2061f1&&_0x2061f1[_0x3a0a('0x48')]===0x0){return db[_0x3a0a('0x22')]['create']({'name':_0x42054e[_0x3a0a('0x25')],'resourceId':_0x42054e['id'],'type':_0x2061f1['name'],'sectionId':_0x2061f1['id']},{})['then'](function(){return _0x1448ab;});}else{return _0x1448ab;}})['catch'](function(_0x377422){logger[_0x3a0a('0x23')](_0x3a0a('0x49'),_0x377422);throw _0x377422;});}return _0x1448ab;})['then'](respondWithResult(_0x368758,0xc9))[_0x3a0a('0x43')](handleError(_0x368758,null));};exports[_0x3a0a('0x1e')]=function(_0x86ac35,_0x4d007){if(_0x86ac35[_0x3a0a('0x4a')]['id']){delete _0x86ac35[_0x3a0a('0x4a')]['id'];}return db[_0x3a0a('0x28')][_0x3a0a('0x4b')]({'where':{'id':_0x86ac35[_0x3a0a('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d007,null))[_0x3a0a('0x1f')](saveUpdates(_0x86ac35['body'],null))[_0x3a0a('0x1f')](respondWithResult(_0x4d007,null))[_0x3a0a('0x43')](handleError(_0x4d007,null));};exports[_0x3a0a('0x20')]=function(_0x524369,_0x32acb1){return db[_0x3a0a('0x28')]['find']({'where':{'id':_0x524369['params']['id']}})[_0x3a0a('0x1f')](handleEntityNotFound(_0x32acb1,null))['then'](removeEntity(_0x32acb1,null))[_0x3a0a('0x43')](handleError(_0x32acb1,null));};exports[_0x3a0a('0x4c')]=function(_0x5198e0,_0x5d99ee,_0x49274d){return db[_0x3a0a('0x28')]['find']({'where':{'id':_0x5198e0[_0x3a0a('0x40')]['id']},'attributes':[_0x3a0a('0x25'),'basename',_0x3a0a('0x4d'),_0x3a0a('0x4e')],'raw':!![]})[_0x3a0a('0x1f')](handleEntityNotFound(_0x5d99ee,null))[_0x3a0a('0x1f')](function(_0x5a5d43){if(_0x5a5d43){if(!fs[_0x3a0a('0x4f')](path[_0x3a0a('0x50')](config[_0x3a0a('0x51')],'server/files/reports',_0x5a5d43['savename']))){throw new db[(_0x3a0a('0x52'))][(_0x3a0a('0x53'))](_0x3a0a('0x54'));}if(_0x5198e0[_0x3a0a('0x2e')][_0x3a0a('0x55')]){return _0x5d99ee[_0x3a0a('0x56')](0xc8);}return _0x5d99ee[_0x3a0a('0x4c')](path[_0x3a0a('0x50')](config[_0x3a0a('0x51')],_0x3a0a('0x57'),_0x5a5d43[_0x3a0a('0x4d')]),util['format'](_0x3a0a('0x58'),_0x5a5d43[_0x3a0a('0x59')]||_0x5a5d43[_0x3a0a('0x25')],_0x5a5d43[_0x3a0a('0x4e')][_0x3a0a('0x5a')]()));}})[_0x3a0a('0x43')](handleError(_0x5d99ee,null));}; \ No newline at end of file +var _0xcd58=['merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','output','existsSync','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','server/files/reports','format','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','get','ExtractedReports','UserProfileResource','then','error','name','send','index','map','AnalyticExtractedReport','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where'];(function(_0x5599d3,_0x144aa5){var _0x2ea771=function(_0x1843f5){while(--_0x1843f5){_0x5599d3['push'](_0x5599d3['shift']());}};_0x2ea771(++_0x144aa5);}(_0xcd58,0x7c));var _0x8cd5=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xcd58[_0x5e42a7];return _0x36d21b;};'use strict';var pdf=require(_0x8cd5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8cd5('0x1'));var zipdir=require(_0x8cd5('0x2'));var jsonpatch=require(_0x8cd5('0x3'));var rp=require('request-promise');var moment=require(_0x8cd5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8cd5('0x5'));var util=require(_0x8cd5('0x6'));var path=require('path');var sox=require(_0x8cd5('0x7'));var csv=require(_0x8cd5('0x8'));var ejs=require(_0x8cd5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8cd5('0xa'));var crypto=require(_0x8cd5('0xb'));var jsforce=require(_0x8cd5('0xc'));var deskjs=require(_0x8cd5('0xd'));var toCsv=require(_0x8cd5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8cd5('0xe'));var authService=require(_0x8cd5('0xf'));var qs=require(_0x8cd5('0x10'));var as=require(_0x8cd5('0x11'));var hardwareService=require(_0x8cd5('0x12'));var logger=require('../../config/logger')(_0x8cd5('0x13'));var utils=require(_0x8cd5('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b5fdb,_0xf843c1){_0xf843c1=_0xf843c1||0xcc;return function(_0x9a667c){if(_0x9a667c){return _0x2b5fdb[_0x8cd5('0x15')](_0xf843c1);}return _0x2b5fdb['status'](_0xf843c1)[_0x8cd5('0x16')]();};}function respondWithResult(_0x417ce9,_0x3dec88){_0x3dec88=_0x3dec88||0xc8;return function(_0x302242){if(_0x302242){return _0x417ce9['status'](_0x3dec88)[_0x8cd5('0x17')](_0x302242);}};}function respondWithFilteredResult(_0x51137a,_0x49987f){return function(_0x591bb3){if(_0x591bb3){var _0xb8c6c4=_0x591bb3[_0x8cd5('0x18')],_0x328318=_0x49987f[_0x8cd5('0x19')],_0x3e12fb=_0x49987f[_0x8cd5('0x19')]+_0x49987f[_0x8cd5('0x1a')],_0x671388;if(_0x3e12fb>=_0xb8c6c4){_0x3e12fb=_0xb8c6c4;_0x671388=0xc8;}else{_0x671388=0xce;}_0x51137a[_0x8cd5('0x1b')](_0x671388);return _0x51137a[_0x8cd5('0x1c')](_0x8cd5('0x1d'),_0x328318+'-'+_0x3e12fb+'/'+_0xb8c6c4)[_0x8cd5('0x17')](_0x591bb3);}return null;};}function patchUpdates(_0x5d1926){return function(_0x5ed6a4){try{jsonpatch[_0x8cd5('0x1e')](_0x5ed6a4,_0x5d1926,!![]);}catch(_0xee48c9){return BPromise[_0x8cd5('0x1f')](_0xee48c9);}return _0x5ed6a4[_0x8cd5('0x20')]();};}function saveUpdates(_0x4462b6,_0x111dbc){return function(_0x1e998d){if(_0x1e998d){return _0x1e998d[_0x8cd5('0x21')](_0x4462b6)['then'](function(_0x29bf40){return _0x29bf40;});}return null;};}function removeEntity(_0x5e2cbc,_0x391331){return function(_0x4ea3a3){if(_0x4ea3a3){return _0x4ea3a3[_0x8cd5('0x22')]()['then'](function(){var _0x29b56d=_0x4ea3a3[_0x8cd5('0x23')]({'plain':!![]});var _0x13d5f5=_0x8cd5('0x24');return db[_0x8cd5('0x25')][_0x8cd5('0x22')]({'where':{'type':_0x13d5f5,'resourceId':_0x29b56d['id']}})[_0x8cd5('0x26')](function(){return _0x4ea3a3;});})['then'](function(){_0x5e2cbc[_0x8cd5('0x1b')](0xcc)[_0x8cd5('0x16')]();});}};}function handleEntityNotFound(_0x138d08,_0x30efe4){return function(_0x3376db){if(!_0x3376db){_0x138d08[_0x8cd5('0x15')](0x194);}return _0x3376db;};}function handleError(_0x35b1c,_0x235427){_0x235427=_0x235427||0x1f4;return function(_0x3d27cc){logger[_0x8cd5('0x27')](_0x3d27cc['stack']);if(_0x3d27cc[_0x8cd5('0x28')]){delete _0x3d27cc['name'];}_0x35b1c['status'](_0x235427)[_0x8cd5('0x29')](_0x3d27cc);};}exports[_0x8cd5('0x2a')]=function(_0x481d1f,_0x5464cb){var _0x274b70={},_0x34fda7={},_0x109f6c={'count':0x0,'rows':[]};var _0x42b55f=_[_0x8cd5('0x2b')](db[_0x8cd5('0x2c')]['rawAttributes'],function(_0x1ea591){return{'name':_0x1ea591[_0x8cd5('0x2d')],'type':_0x1ea591['type'][_0x8cd5('0x2e')]};});_0x34fda7[_0x8cd5('0x2f')]=_['map'](_0x42b55f,_0x8cd5('0x28'));_0x34fda7['query']=_[_0x8cd5('0x30')](_0x481d1f['query']);_0x34fda7['filters']=_[_0x8cd5('0x31')](_0x34fda7[_0x8cd5('0x2f')],_0x34fda7[_0x8cd5('0x32')]);_0x274b70[_0x8cd5('0x33')]=_['intersection'](_0x34fda7[_0x8cd5('0x2f')],qs['fields'](_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x34')]));_0x274b70[_0x8cd5('0x33')]=_0x274b70['attributes'][_0x8cd5('0x35')]?_0x274b70['attributes']:_0x34fda7[_0x8cd5('0x2f')];if(!_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x36')]('nolimit')){_0x274b70[_0x8cd5('0x1a')]=qs['limit'](_0x481d1f['query']['limit']);_0x274b70[_0x8cd5('0x19')]=qs[_0x8cd5('0x19')](_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x19')]);}_0x274b70[_0x8cd5('0x37')]=qs['sort'](_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x38')]);_0x274b70['where']=qs[_0x8cd5('0x39')](_['pick'](_0x481d1f[_0x8cd5('0x32')],_0x34fda7['filters']),_0x42b55f);if(_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x3a')]){_0x274b70[_0x8cd5('0x3b')]=_[_0x8cd5('0x3c')](_0x274b70[_0x8cd5('0x3b')],{'$or':_[_0x8cd5('0x2b')](_0x42b55f,function(_0x2c31b1){if(_0x2c31b1['type']!=='VIRTUAL'){var _0xffefa5={};_0xffefa5[_0x2c31b1[_0x8cd5('0x28')]]={'$like':'%'+_0x481d1f['query']['filter']+'%'};return _0xffefa5;}})});}_0x274b70=_[_0x8cd5('0x3c')]({},_0x274b70,_0x481d1f[_0x8cd5('0x3d')]);var _0x37d122={'where':_0x274b70[_0x8cd5('0x3b')]};return db[_0x8cd5('0x2c')][_0x8cd5('0x18')](_0x37d122)['then'](function(_0x200cfd){_0x109f6c[_0x8cd5('0x18')]=_0x200cfd;if(_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x3e')]){_0x274b70[_0x8cd5('0x3f')]=[{'all':!![]}];}return db[_0x8cd5('0x2c')][_0x8cd5('0x40')](_0x274b70);})[_0x8cd5('0x26')](function(_0x4d8920){_0x109f6c[_0x8cd5('0x41')]=_0x4d8920;return _0x109f6c;})[_0x8cd5('0x26')](respondWithFilteredResult(_0x5464cb,_0x274b70))[_0x8cd5('0x42')](handleError(_0x5464cb,null));};exports[_0x8cd5('0x43')]=function(_0x2fe662,_0x3b5e0b){var _0x52bdad={'raw':!![],'where':{'id':_0x2fe662['params']['id']}},_0x45d904={};_0x45d904[_0x8cd5('0x2f')]=_[_0x8cd5('0x30')](db[_0x8cd5('0x2c')][_0x8cd5('0x44')]);_0x45d904[_0x8cd5('0x32')]=_[_0x8cd5('0x30')](_0x2fe662[_0x8cd5('0x32')]);_0x45d904[_0x8cd5('0x39')]=_[_0x8cd5('0x31')](_0x45d904[_0x8cd5('0x2f')],_0x45d904[_0x8cd5('0x32')]);_0x52bdad[_0x8cd5('0x33')]=_[_0x8cd5('0x31')](_0x45d904[_0x8cd5('0x2f')],qs['fields'](_0x2fe662['query'][_0x8cd5('0x34')]));_0x52bdad['attributes']=_0x52bdad['attributes'][_0x8cd5('0x35')]?_0x52bdad[_0x8cd5('0x33')]:_0x45d904[_0x8cd5('0x2f')];if(_0x2fe662[_0x8cd5('0x32')][_0x8cd5('0x3e')]){_0x52bdad[_0x8cd5('0x3f')]=[{'all':!![]}];}_0x52bdad=_[_0x8cd5('0x3c')]({},_0x52bdad,_0x2fe662[_0x8cd5('0x3d')]);return db[_0x8cd5('0x2c')]['find'](_0x52bdad)[_0x8cd5('0x26')](handleEntityNotFound(_0x3b5e0b,null))[_0x8cd5('0x26')](respondWithResult(_0x3b5e0b,null))[_0x8cd5('0x42')](handleError(_0x3b5e0b,null));};exports[_0x8cd5('0x45')]=function(_0x5a91d0,_0x2e37e7){return db[_0x8cd5('0x2c')][_0x8cd5('0x45')](_0x5a91d0[_0x8cd5('0x46')],{})[_0x8cd5('0x26')](function(_0x18757e){var _0x1f262a=_0x5a91d0['user']['get']({'plain':!![]});if(!_0x1f262a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f262a[_0x8cd5('0x47')]===_0x8cd5('0x48')){var _0x20e231=_0x18757e[_0x8cd5('0x23')]({'plain':!![]});var _0x18e154=_0x8cd5('0x24');return db[_0x8cd5('0x49')][_0x8cd5('0x4a')]({'where':{'name':_0x18e154,'userProfileId':_0x1f262a[_0x8cd5('0x4b')]},'raw':!![]})[_0x8cd5('0x26')](function(_0x55bdd4){if(_0x55bdd4&&_0x55bdd4[_0x8cd5('0x4c')]===0x0){return db[_0x8cd5('0x25')][_0x8cd5('0x45')]({'name':_0x20e231[_0x8cd5('0x28')],'resourceId':_0x20e231['id'],'type':_0x55bdd4['name'],'sectionId':_0x55bdd4['id']},{})[_0x8cd5('0x26')](function(){return _0x18757e;});}else{return _0x18757e;}})[_0x8cd5('0x42')](function(_0x5501aa){logger[_0x8cd5('0x27')](_0x8cd5('0x4d'),_0x5501aa);throw _0x5501aa;});}return _0x18757e;})[_0x8cd5('0x26')](respondWithResult(_0x2e37e7,0xc9))[_0x8cd5('0x42')](handleError(_0x2e37e7,null));};exports[_0x8cd5('0x21')]=function(_0x7e481e,_0x28a054){if(_0x7e481e[_0x8cd5('0x46')]['id']){delete _0x7e481e[_0x8cd5('0x46')]['id'];}return db[_0x8cd5('0x2c')]['find']({'where':{'id':_0x7e481e['params']['id']}})[_0x8cd5('0x26')](handleEntityNotFound(_0x28a054,null))['then'](saveUpdates(_0x7e481e[_0x8cd5('0x46')],null))[_0x8cd5('0x26')](respondWithResult(_0x28a054,null))[_0x8cd5('0x42')](handleError(_0x28a054,null));};exports['destroy']=function(_0x40de3b,_0x2a68d9){return db[_0x8cd5('0x2c')][_0x8cd5('0x4a')]({'where':{'id':_0x40de3b[_0x8cd5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2a68d9,null))[_0x8cd5('0x26')](removeEntity(_0x2a68d9,null))['catch'](handleError(_0x2a68d9,null));};exports['download']=function(_0x52f6ae,_0x47aa6c,_0x30ad38){return db[_0x8cd5('0x2c')][_0x8cd5('0x4a')]({'where':{'id':_0x52f6ae[_0x8cd5('0x4e')]['id']},'attributes':[_0x8cd5('0x28'),_0x8cd5('0x4f'),_0x8cd5('0x50'),_0x8cd5('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x47aa6c,null))[_0x8cd5('0x26')](function(_0x43576c){if(_0x43576c){if(!fs[_0x8cd5('0x52')](path[_0x8cd5('0x53')](config[_0x8cd5('0x54')],'server/files/reports',_0x43576c[_0x8cd5('0x50')]))){throw new db[(_0x8cd5('0x55'))]['ValidationError'](_0x8cd5('0x56'));}if(_0x52f6ae[_0x8cd5('0x32')][_0x8cd5('0x57')]){return _0x47aa6c['sendStatus'](0xc8);}return _0x47aa6c[_0x8cd5('0x58')](path[_0x8cd5('0x53')](config[_0x8cd5('0x54')],_0x8cd5('0x59'),_0x43576c['savename']),util[_0x8cd5('0x5a')]('%s.%s',_0x43576c[_0x8cd5('0x4f')]||_0x43576c[_0x8cd5('0x28')],_0x43576c['output'][_0x8cd5('0x5b')]()));}})[_0x8cd5('0x42')](handleError(_0x47aa6c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b264535..8812fde 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 _0xff02=['request-promise','rimraf','../../config/environment','exports','analytics_extracted_reports','lodash','util','api','moment','bluebird'];(function(_0x4a1e00,_0x4dee07){var _0x152fbe=function(_0x454554){while(--_0x454554){_0x4a1e00['push'](_0x4a1e00['shift']());}};_0x152fbe(++_0x4dee07);}(_0xff02,0x1e5));var _0x2ff0=function(_0x1dbf15,_0x4ce75d){_0x1dbf15=_0x1dbf15-0x0;var _0x20dd47=_0xff02[_0x1dbf15];return _0x20dd47;};'use strict';var _=require(_0x2ff0('0x0'));var util=require(_0x2ff0('0x1'));var logger=require('../../config/logger')(_0x2ff0('0x2'));var moment=require(_0x2ff0('0x3'));var BPromise=require(_0x2ff0('0x4'));var rp=require(_0x2ff0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ff0('0x6'));var config=require(_0x2ff0('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x2ff0('0x8')]=function(_0x34965b,_0x2731e1){return _0x34965b['define']('AnalyticExtractedReport',attributes,{'tableName':_0x2ff0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a8e=['moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','api'];(function(_0x5bd8c1,_0xa4ad55){var _0x378964=function(_0x50b2ae){while(--_0x50b2ae){_0x5bd8c1['push'](_0x5bd8c1['shift']());}};_0x378964(++_0xa4ad55);}(_0x6a8e,0xc4));var _0xe6a8=function(_0x49dd5a,_0x1da7e6){_0x49dd5a=_0x49dd5a-0x0;var _0x91c8da=_0x6a8e[_0x49dd5a];return _0x91c8da;};'use strict';var _=require('lodash');var util=require(_0xe6a8('0x0'));var logger=require('../../config/logger')(_0xe6a8('0x1'));var moment=require(_0xe6a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xe6a8('0x3'));var fs=require('fs');var path=require(_0xe6a8('0x4'));var rimraf=require(_0xe6a8('0x5'));var config=require(_0xe6a8('0x6'));var attributes=require(_0xe6a8('0x7'));module['exports']=function(_0x3907c3,_0x8b2615){return _0x3907c3[_0xe6a8('0x8')](_0xe6a8('0x9'),attributes,{'tableName':_0xe6a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index c0f8f2b..503b785 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 _0x92b9=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x92b9,0x163));var _0x992b=function(_0x620a7e,_0x10be30){_0x620a7e=_0x620a7e-0x0;var _0x2008c4=_0x92b9[_0x620a7e];return _0x2008c4;};'use strict';var _=require(_0x992b('0x0'));var util=require(_0x992b('0x1'));var moment=require(_0x992b('0x2'));var BPromise=require(_0x992b('0x3'));var rs=require(_0x992b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x992b('0x5'))['db'];var utils=require(_0x992b('0x6'));var logger=require('../../config/logger')(_0x992b('0x7'));var config=require(_0x992b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x992b('0x9')][_0x992b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4006d1,_0x3cc857,_0x5cd8f6){return new BPromise(function(_0x4ac30f,_0x45f472){return client['request'](_0x4006d1,_0x5cd8f6)[_0x992b('0xb')](function(_0x23d26b){logger[_0x992b('0xc')](_0x992b('0xd'),_0x3cc857,'request\x20sent');logger[_0x992b('0xe')](_0x992b('0xf'),_0x3cc857,_0x992b('0x10'),JSON[_0x992b('0x11')](_0x23d26b));if(_0x23d26b[_0x992b('0x12')]){if(_0x23d26b[_0x992b('0x12')]['code']===0x1f4){logger[_0x992b('0x12')](_0x992b('0xd'),_0x3cc857,_0x23d26b['error'][_0x992b('0x13')]);return _0x45f472(_0x23d26b['error'][_0x992b('0x13')]);}logger['error'](_0x992b('0xd'),_0x3cc857,_0x23d26b[_0x992b('0x12')][_0x992b('0x13')]);return _0x4ac30f(_0x23d26b[_0x992b('0x12')][_0x992b('0x13')]);}else{logger[_0x992b('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3cc857,_0x992b('0x10'));_0x4ac30f(_0x23d26b[_0x992b('0x14')][_0x992b('0x13')]);}})['catch'](function(_0xb8e55c){logger[_0x992b('0x12')](_0x992b('0xd'),_0x3cc857,_0xb8e55c);_0x45f472(_0xb8e55c);});});} \ No newline at end of file +var _0x73fe=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xf06274,_0x590246){var _0x3cee7f=function(_0x1e3337){while(--_0x1e3337){_0xf06274['push'](_0xf06274['shift']());}};_0x3cee7f(++_0x590246);}(_0x73fe,0x1e4));var _0xe73f=function(_0x2bc6b6,_0xe0e9c7){_0x2bc6b6=_0x2bc6b6-0x0;var _0x51af64=_0x73fe[_0x2bc6b6];return _0x51af64;};'use strict';var _=require(_0xe73f('0x0'));var util=require(_0xe73f('0x1'));var moment=require('moment');var BPromise=require(_0xe73f('0x2'));var rs=require(_0xe73f('0x3'));var fs=require('fs');var Redis=require(_0xe73f('0x4'));var db=require(_0xe73f('0x5'))['db'];var utils=require(_0xe73f('0x6'));var logger=require(_0xe73f('0x7'))(_0xe73f('0x8'));var config=require(_0xe73f('0x9'));var jayson=require(_0xe73f('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x462deb,_0x15c3f1,_0x5851cd){return new BPromise(function(_0x38337c,_0x37b24a){return client[_0xe73f('0xb')](_0x462deb,_0x5851cd)['then'](function(_0x3c3630){logger[_0xe73f('0xc')](_0xe73f('0xd'),_0x15c3f1,_0xe73f('0xe'));logger['debug'](_0xe73f('0xf'),_0x15c3f1,'request\x20sent',JSON[_0xe73f('0x10')](_0x3c3630));if(_0x3c3630['error']){if(_0x3c3630[_0xe73f('0x11')][_0xe73f('0x12')]===0x1f4){logger[_0xe73f('0x11')](_0xe73f('0xd'),_0x15c3f1,_0x3c3630[_0xe73f('0x11')][_0xe73f('0x13')]);return _0x37b24a(_0x3c3630[_0xe73f('0x11')]['message']);}logger[_0xe73f('0x11')](_0xe73f('0xd'),_0x15c3f1,_0x3c3630[_0xe73f('0x11')][_0xe73f('0x13')]);return _0x38337c(_0x3c3630[_0xe73f('0x11')][_0xe73f('0x13')]);}else{logger[_0xe73f('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x15c3f1,'request\x20sent');_0x38337c(_0x3c3630[_0xe73f('0x14')][_0xe73f('0x13')]);}})[_0xe73f('0x15')](function(_0x5660ed){logger[_0xe73f('0x11')](_0xe73f('0xd'),_0x15c3f1,_0x5660ed);_0x37b24a(_0x5660ed);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1534da5..11c7e27 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 _0x7868=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id/download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x111c87,_0x2b0e87){var _0x433871=function(_0x45b703){while(--_0x45b703){_0x111c87['push'](_0x111c87['shift']());}};_0x433871(++_0x2b0e87);}(_0x7868,0x67));var _0x8786=function(_0x38c9cf,_0x49c42c){_0x38c9cf=_0x38c9cf-0x0;var _0x3c00c9=_0x7868[_0x38c9cf];return _0x3c00c9;};'use strict';var multer=require(_0x8786('0x0'));var util=require(_0x8786('0x1'));var path=require(_0x8786('0x2'));var timeout=require(_0x8786('0x3'));var express=require(_0x8786('0x4'));var router=express[_0x8786('0x5')]();var auth=require(_0x8786('0x6'));var interaction=require(_0x8786('0x7'));var config=require(_0x8786('0x8'));var controller=require(_0x8786('0x9'));router['get']('/',auth[_0x8786('0xa')](),controller[_0x8786('0xb')]);router[_0x8786('0xc')]('/:id',auth[_0x8786('0xa')](),controller['show']);router[_0x8786('0xc')](_0x8786('0xd'),auth[_0x8786('0xa')](),controller['download']);router[_0x8786('0xe')]('/',auth['isAuthenticated'](),controller[_0x8786('0xf')]);router[_0x8786('0x10')](_0x8786('0x11'),auth[_0x8786('0xa')](),controller[_0x8786('0x12')]);router[_0x8786('0x13')](_0x8786('0x11'),auth['isAuthenticated'](),controller[_0x8786('0x14')]);module[_0x8786('0x15')]=router; \ No newline at end of file +var _0x2572=['/:id/download','download','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0xbec404,_0xcda9ae){var _0x787845=function(_0x5d1f4b){while(--_0x5d1f4b){_0xbec404['push'](_0xbec404['shift']());}};_0x787845(++_0xcda9ae);}(_0x2572,0x110));var _0x2257=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2572[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x2257('0x0'));var util=require(_0x2257('0x1'));var path=require(_0x2257('0x2'));var timeout=require(_0x2257('0x3'));var express=require(_0x2257('0x4'));var router=express[_0x2257('0x5')]();var auth=require(_0x2257('0x6'));var interaction=require(_0x2257('0x7'));var config=require(_0x2257('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x2257('0x9')]('/',auth[_0x2257('0xa')](),controller[_0x2257('0xb')]);router[_0x2257('0x9')](_0x2257('0xc'),auth[_0x2257('0xa')](),controller[_0x2257('0xd')]);router[_0x2257('0x9')](_0x2257('0xe'),auth['isAuthenticated'](),controller[_0x2257('0xf')]);router[_0x2257('0x10')]('/',auth['isAuthenticated'](),controller[_0x2257('0x11')]);router[_0x2257('0x12')](_0x2257('0xc'),auth['isAuthenticated'](),controller[_0x2257('0x13')]);router[_0x2257('0x14')](_0x2257('0xc'),auth[_0x2257('0xa')](),controller['destroy']);module[_0x2257('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3b1064e..8d4ab1b 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x39b07e,_0x33b057){var _0x591dae=function(_0x5bdec5){while(--_0x5bdec5){_0x39b07e['push'](_0x39b07e['shift']());}};_0x591dae(++_0x33b057);}(_0x326f,0xd1));var _0xf326=function(_0x1bc0d8,_0x156f44){_0x1bc0d8=_0x1bc0d8-0x0;var _0x527bdf=_0x326f[_0x1bc0d8];return _0x527bdf;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf326('0x1')]},'function':{'type':Sequelize[_0xf326('0x1')]},'format':{'type':Sequelize[_0xf326('0x1')]},'groupBy':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf326('0x1')]},'custom':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x1f697e,_0x7bb260){var _0x5da78d=function(_0x32d702){while(--_0x32d702){_0x1f697e['push'](_0x1f697e['shift']());}};_0x5da78d(++_0x7bb260);}(_0x1261,0x144));var _0x1126=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x1261[_0x1a89a1];return _0x3d5b46;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 2539410..e650971 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 _0x1a3c=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','then','destroy','error','name','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','findAll','catch','show','params','keys','create','body','bulkCreate','update','find','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs'];(function(_0x383912,_0x3bb9b4){var _0x5cfe8e=function(_0x102bdd){while(--_0x102bdd){_0x383912['push'](_0x383912['shift']());}};_0x5cfe8e(++_0x3bb9b4);}(_0x1a3c,0x1a6));var _0xc1a3=function(_0x37ca53,_0x28f799){_0x37ca53=_0x37ca53-0x0;var _0x4e94a8=_0x1a3c[_0x37ca53];return _0x4e94a8;};'use strict';var pdf=require(_0xc1a3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc1a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1a3('0x2'));var rp=require(_0xc1a3('0x3'));var moment=require(_0xc1a3('0x4'));var BPromise=require(_0xc1a3('0x5'));var Mustache=require(_0xc1a3('0x6'));var util=require('util');var path=require(_0xc1a3('0x7'));var sox=require(_0xc1a3('0x8'));var csv=require(_0xc1a3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc1a3('0xa'));var squel=require(_0xc1a3('0xb'));var crypto=require('crypto');var jsforce=require(_0xc1a3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1a3('0xd'));var Redis=require(_0xc1a3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc1a3('0xf'));var as=require(_0xc1a3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1a3('0x11'))(_0xc1a3('0x12'));var utils=require(_0xc1a3('0x13'));var config=require(_0xc1a3('0x14'));var db=require(_0xc1a3('0x15'))['db'];function respondWithStatusCode(_0x1d53d4,_0x333476){_0x333476=_0x333476||0xcc;return function(_0x122c8f){if(_0x122c8f){return _0x1d53d4[_0xc1a3('0x16')](_0x333476);}return _0x1d53d4[_0xc1a3('0x17')](_0x333476)[_0xc1a3('0x18')]();};}function respondWithResult(_0x20da25,_0x707d72){_0x707d72=_0x707d72||0xc8;return function(_0x4d9dcc){if(_0x4d9dcc){return _0x20da25[_0xc1a3('0x17')](_0x707d72)[_0xc1a3('0x19')](_0x4d9dcc);}};}function respondWithFilteredResult(_0x5b8eef,_0x133a05){return function(_0x488f51){if(_0x488f51){var _0xb3a107=_0x488f51[_0xc1a3('0x1a')],_0x44faea=_0x133a05[_0xc1a3('0x1b')],_0x139fc2=_0x133a05[_0xc1a3('0x1b')]+_0x133a05[_0xc1a3('0x1c')],_0x54f99f;if(_0x139fc2>=_0xb3a107){_0x139fc2=_0xb3a107;_0x54f99f=0xc8;}else{_0x54f99f=0xce;}_0x5b8eef[_0xc1a3('0x17')](_0x54f99f);return _0x5b8eef[_0xc1a3('0x1d')](_0xc1a3('0x1e'),_0x44faea+'-'+_0x139fc2+'/'+_0xb3a107)[_0xc1a3('0x19')](_0x488f51);}return null;};}function patchUpdates(_0x5de3c7){return function(_0x55a3a4){try{jsonpatch['apply'](_0x55a3a4,_0x5de3c7,!![]);}catch(_0x3233af){return BPromise['reject'](_0x3233af);}return _0x55a3a4['save']();};}function saveUpdates(_0xb64ada,_0x382090){return function(_0x20ac11){if(_0x20ac11){return _0x20ac11['update'](_0xb64ada)[_0xc1a3('0x1f')](function(_0x4c31cb){return _0x4c31cb;});}return null;};}function removeEntity(_0x5a77fc,_0x491165){return function(_0x2d9ac2){if(_0x2d9ac2){return _0x2d9ac2[_0xc1a3('0x20')]()[_0xc1a3('0x1f')](function(){_0x5a77fc[_0xc1a3('0x17')](0xcc)[_0xc1a3('0x18')]();});}};}function handleEntityNotFound(_0x20e306,_0x13bf2e){return function(_0x3a2887){if(!_0x3a2887){_0x20e306[_0xc1a3('0x16')](0x194);}return _0x3a2887;};}function handleError(_0xb4d62b,_0x240f10){_0x240f10=_0x240f10||0x1f4;return function(_0x341e03){logger[_0xc1a3('0x21')](_0x341e03['stack']);if(_0x341e03[_0xc1a3('0x22')]){delete _0x341e03[_0xc1a3('0x22')];}_0xb4d62b[_0xc1a3('0x17')](_0x240f10)['send'](_0x341e03);};}exports[_0xc1a3('0x23')]=function(_0x3527de,_0x184d61){var _0x6f4fa9={},_0x17dbc9={},_0x3b0077={'count':0x0,'rows':[]};var _0x10a8cc=_['map'](db[_0xc1a3('0x24')][_0xc1a3('0x25')],function(_0x27ac47){return{'name':_0x27ac47[_0xc1a3('0x26')],'type':_0x27ac47['type'][_0xc1a3('0x27')]};});_0x17dbc9[_0xc1a3('0x28')]=_[_0xc1a3('0x29')](_0x10a8cc,_0xc1a3('0x22'));_0x17dbc9[_0xc1a3('0x2a')]=_['keys'](_0x3527de[_0xc1a3('0x2a')]);_0x17dbc9[_0xc1a3('0x2b')]=_[_0xc1a3('0x2c')](_0x17dbc9[_0xc1a3('0x28')],_0x17dbc9['query']);_0x6f4fa9[_0xc1a3('0x2d')]=_['intersection'](_0x17dbc9[_0xc1a3('0x28')],qs['fields'](_0x3527de[_0xc1a3('0x2a')][_0xc1a3('0x2e')]));_0x6f4fa9[_0xc1a3('0x2d')]=_0x6f4fa9[_0xc1a3('0x2d')][_0xc1a3('0x2f')]?_0x6f4fa9[_0xc1a3('0x2d')]:_0x17dbc9[_0xc1a3('0x28')];if(!_0x3527de['query']['hasOwnProperty'](_0xc1a3('0x30'))){_0x6f4fa9['limit']=qs[_0xc1a3('0x1c')](_0x3527de['query'][_0xc1a3('0x1c')]);_0x6f4fa9[_0xc1a3('0x1b')]=qs['offset'](_0x3527de[_0xc1a3('0x2a')][_0xc1a3('0x1b')]);}_0x6f4fa9[_0xc1a3('0x31')]=qs[_0xc1a3('0x32')](_0x3527de['query'][_0xc1a3('0x32')]);_0x6f4fa9['where']=qs[_0xc1a3('0x2b')](_['pick'](_0x3527de[_0xc1a3('0x2a')],_0x17dbc9['filters']),_0x10a8cc);if(_0x3527de[_0xc1a3('0x2a')][_0xc1a3('0x33')]){_0x6f4fa9[_0xc1a3('0x34')]=_[_0xc1a3('0x35')](_0x6f4fa9[_0xc1a3('0x34')],{'$or':_[_0xc1a3('0x29')](_0x10a8cc,function(_0x4ed538){if(_0x4ed538[_0xc1a3('0x36')]!==_0xc1a3('0x37')){var _0x44cd59={};_0x44cd59[_0x4ed538['name']]={'$like':'%'+_0x3527de[_0xc1a3('0x2a')][_0xc1a3('0x33')]+'%'};return _0x44cd59;}})});}_0x6f4fa9=_[_0xc1a3('0x35')]({},_0x6f4fa9,_0x3527de[_0xc1a3('0x38')]);var _0x50f68a={'where':_0x6f4fa9['where']};return db['AnalyticFieldReport'][_0xc1a3('0x1a')](_0x50f68a)[_0xc1a3('0x1f')](function(_0xfce1f0){_0x3b0077[_0xc1a3('0x1a')]=_0xfce1f0;if(_0x3527de[_0xc1a3('0x2a')]['includeAll']){_0x6f4fa9['include']=[{'all':!![]}];}return db[_0xc1a3('0x24')][_0xc1a3('0x39')](_0x6f4fa9);})['then'](function(_0xd8f796){_0x3b0077['rows']=_0xd8f796;return _0x3b0077;})[_0xc1a3('0x1f')](respondWithFilteredResult(_0x184d61,_0x6f4fa9))[_0xc1a3('0x3a')](handleError(_0x184d61,null));};exports[_0xc1a3('0x3b')]=function(_0x29bdd6,_0x2b8542){var _0x2bb8e9={'raw':![],'where':{'id':_0x29bdd6[_0xc1a3('0x3c')]['id']}},_0x586435={};_0x586435[_0xc1a3('0x28')]=_[_0xc1a3('0x3d')](db[_0xc1a3('0x24')][_0xc1a3('0x25')]);_0x586435[_0xc1a3('0x2a')]=_[_0xc1a3('0x3d')](_0x29bdd6['query']);_0x586435[_0xc1a3('0x2b')]=_['intersection'](_0x586435[_0xc1a3('0x28')],_0x586435[_0xc1a3('0x2a')]);_0x2bb8e9['attributes']=_[_0xc1a3('0x2c')](_0x586435[_0xc1a3('0x28')],qs[_0xc1a3('0x2e')](_0x29bdd6[_0xc1a3('0x2a')][_0xc1a3('0x2e')]));_0x2bb8e9[_0xc1a3('0x2d')]=_0x2bb8e9[_0xc1a3('0x2d')][_0xc1a3('0x2f')]?_0x2bb8e9[_0xc1a3('0x2d')]:_0x586435[_0xc1a3('0x28')];if(_0x29bdd6[_0xc1a3('0x2a')]['includeAll']){_0x2bb8e9['include']=[{'all':!![]}];}_0x2bb8e9=_['merge']({},_0x2bb8e9,_0x29bdd6['options']);return db[_0xc1a3('0x24')]['find'](_0x2bb8e9)[_0xc1a3('0x1f')](handleEntityNotFound(_0x2b8542,null))[_0xc1a3('0x1f')](respondWithResult(_0x2b8542,null))['catch'](handleError(_0x2b8542,null));};exports[_0xc1a3('0x3e')]=function(_0x147148,_0x5aede8){return db[_0xc1a3('0x24')][_0xc1a3('0x3e')](_0x147148[_0xc1a3('0x3f')],{})[_0xc1a3('0x1f')](respondWithResult(_0x5aede8,0xc9))[_0xc1a3('0x3a')](handleError(_0x5aede8,null));};exports[_0xc1a3('0x40')]=function(_0x39956a,_0x54e666){return db[_0xc1a3('0x24')]['bulkCreate'](_0x39956a[_0xc1a3('0x3f')],{'raw':![],'individualHooks':!![]})[_0xc1a3('0x1f')](respondWithResult(_0x54e666,0xc9))[_0xc1a3('0x3a')](handleError(_0x54e666,null));};exports[_0xc1a3('0x41')]=function(_0xc00834,_0x1ec518){if(_0xc00834['body']['id']){delete _0xc00834[_0xc1a3('0x3f')]['id'];}return db[_0xc1a3('0x24')][_0xc1a3('0x42')]({'where':{'id':_0xc00834[_0xc1a3('0x3c')]['id']}})[_0xc1a3('0x1f')](handleEntityNotFound(_0x1ec518,null))['then'](saveUpdates(_0xc00834[_0xc1a3('0x3f')],null))[_0xc1a3('0x1f')](respondWithResult(_0x1ec518,null))[_0xc1a3('0x3a')](handleError(_0x1ec518,null));};exports[_0xc1a3('0x20')]=function(_0x7ec4ae,_0x147b86){return db['AnalyticFieldReport'][_0xc1a3('0x42')]({'where':{'id':_0x7ec4ae[_0xc1a3('0x3c')]['id']}})[_0xc1a3('0x1f')](handleEntityNotFound(_0x147b86,null))['then'](removeEntity(_0x147b86,null))[_0xc1a3('0x3a')](handleError(_0x147b86,null));};exports[_0xc1a3('0x43')]=function(_0x41f77b,_0x5bde52){return db[_0xc1a3('0x24')][_0xc1a3('0x20')]({'where':{'id':_0x41f77b[_0xc1a3('0x2a')][_0xc1a3('0x44')]||[]},'raw':![],'individualHooks':!![]})[_0xc1a3('0x1f')](respondWithResult(_0x5bde52,0xcc))[_0xc1a3('0x3a')](handleError(_0x5bde52,null));};exports['addFields']=function(_0x58a100,_0x5410de,_0x58bade){return db[_0xc1a3('0x45')][_0xc1a3('0x46')]({'where':{'id':_0x58a100[_0xc1a3('0x3c')]['id']}})[_0xc1a3('0x1f')](handleEntityNotFound(_0x5410de,null))[_0xc1a3('0x1f')](function(_0x2c7532){if(_0x2c7532){return db[_0xc1a3('0x47')][_0xc1a3('0x48')](function(_0x150218){return db['AnalyticFieldReport'][_0xc1a3('0x20')]({'where':{'CustomReportId':_0x58a100[_0xc1a3('0x3c')]['id']},'transaction':_0x150218})[_0xc1a3('0x1f')](function(_0x28951f){var _0x4b0920=_[_0xc1a3('0x29')](_0x58a100[_0xc1a3('0x3f')],function(_0x5d95c2){delete _0x5d95c2['id'];_0x5d95c2['CustomReportId']=_0x58a100[_0xc1a3('0x3c')]['id'];return _0x5d95c2;});return db[_0xc1a3('0x24')]['bulkCreate'](_0x4b0920,{'transaction':_0x150218});});})[_0xc1a3('0x1f')](function(){return db[_0xc1a3('0x24')][_0xc1a3('0x39')]({'where':{'CustomReportId':_0x58a100[_0xc1a3('0x3c')]['id']}});});}})[_0xc1a3('0x1f')](respondWithResult(_0x5410de,null))['catch'](handleError(_0x5410de,null));}; \ No newline at end of file +var _0x6f93=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','bulkCreate','update','params','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','then','destroy','error','stack','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','name'];(function(_0x2b57d8,_0x472f3d){var _0xdb7248=function(_0x1c49c3){while(--_0x1c49c3){_0x2b57d8['push'](_0x2b57d8['shift']());}};_0xdb7248(++_0x472f3d);}(_0x6f93,0xb3));var _0x36f9=function(_0x4cd014,_0x40308a){_0x4cd014=_0x4cd014-0x0;var _0x12a63d=_0x6f93[_0x4cd014];return _0x12a63d;};'use strict';var pdf=require(_0x36f9('0x0'));var emlformat=require(_0x36f9('0x1'));var rimraf=require(_0x36f9('0x2'));var zipdir=require(_0x36f9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x36f9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x36f9('0x5'));var path=require(_0x36f9('0x6'));var sox=require(_0x36f9('0x7'));var csv=require(_0x36f9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x36f9('0x9'));var crypto=require('crypto');var jsforce=require(_0x36f9('0xa'));var deskjs=require(_0x36f9('0xb'));var toCsv=require(_0x36f9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x36f9('0xc'));var authService=require(_0x36f9('0xd'));var qs=require(_0x36f9('0xe'));var as=require(_0x36f9('0xf'));var hardwareService=require(_0x36f9('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x36f9('0x11'));var db=require(_0x36f9('0x12'))['db'];function respondWithStatusCode(_0x481fad,_0x1a987b){_0x1a987b=_0x1a987b||0xcc;return function(_0x2315f5){if(_0x2315f5){return _0x481fad[_0x36f9('0x13')](_0x1a987b);}return _0x481fad[_0x36f9('0x14')](_0x1a987b)[_0x36f9('0x15')]();};}function respondWithResult(_0x37c2a4,_0x3fcce2){_0x3fcce2=_0x3fcce2||0xc8;return function(_0x1d2ac5){if(_0x1d2ac5){return _0x37c2a4[_0x36f9('0x14')](_0x3fcce2)[_0x36f9('0x16')](_0x1d2ac5);}};}function respondWithFilteredResult(_0x34c89c,_0x31522d){return function(_0x4801c9){if(_0x4801c9){var _0x461da3=_0x4801c9[_0x36f9('0x17')],_0x5d9ebe=_0x31522d[_0x36f9('0x18')],_0x1cb856=_0x31522d['offset']+_0x31522d[_0x36f9('0x19')],_0x2f17ae;if(_0x1cb856>=_0x461da3){_0x1cb856=_0x461da3;_0x2f17ae=0xc8;}else{_0x2f17ae=0xce;}_0x34c89c[_0x36f9('0x14')](_0x2f17ae);return _0x34c89c[_0x36f9('0x1a')]('Content-Range',_0x5d9ebe+'-'+_0x1cb856+'/'+_0x461da3)[_0x36f9('0x16')](_0x4801c9);}return null;};}function patchUpdates(_0x4d79fa){return function(_0x10605a){try{jsonpatch['apply'](_0x10605a,_0x4d79fa,!![]);}catch(_0x1622a4){return BPromise[_0x36f9('0x1b')](_0x1622a4);}return _0x10605a['save']();};}function saveUpdates(_0x21b52f,_0x32b510){return function(_0xee74b2){if(_0xee74b2){return _0xee74b2['update'](_0x21b52f)[_0x36f9('0x1c')](function(_0x57bea2){return _0x57bea2;});}return null;};}function removeEntity(_0x407916,_0x2af546){return function(_0x26af48){if(_0x26af48){return _0x26af48[_0x36f9('0x1d')]()[_0x36f9('0x1c')](function(){_0x407916[_0x36f9('0x14')](0xcc)[_0x36f9('0x15')]();});}};}function handleEntityNotFound(_0x4a1f40,_0x2d5df2){return function(_0xb67470){if(!_0xb67470){_0x4a1f40['sendStatus'](0x194);}return _0xb67470;};}function handleError(_0xe9a13a,_0x2cdb7e){_0x2cdb7e=_0x2cdb7e||0x1f4;return function(_0x181ec1){logger[_0x36f9('0x1e')](_0x181ec1[_0x36f9('0x1f')]);if(_0x181ec1['name']){delete _0x181ec1['name'];}_0xe9a13a['status'](_0x2cdb7e)['send'](_0x181ec1);};}exports[_0x36f9('0x20')]=function(_0x30a5f0,_0x5b7ee6){var _0x348774={},_0x4c1431={},_0x3ce89d={'count':0x0,'rows':[]};var _0x57c82d=_[_0x36f9('0x21')](db[_0x36f9('0x22')][_0x36f9('0x23')],function(_0x3977bd){return{'name':_0x3977bd[_0x36f9('0x24')],'type':_0x3977bd[_0x36f9('0x25')]['key']};});_0x4c1431[_0x36f9('0x26')]=_['map'](_0x57c82d,_0x36f9('0x27'));_0x4c1431[_0x36f9('0x28')]=_[_0x36f9('0x29')](_0x30a5f0[_0x36f9('0x28')]);_0x4c1431[_0x36f9('0x2a')]=_['intersection'](_0x4c1431[_0x36f9('0x26')],_0x4c1431['query']);_0x348774[_0x36f9('0x2b')]=_[_0x36f9('0x2c')](_0x4c1431['model'],qs[_0x36f9('0x2d')](_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x2d')]));_0x348774[_0x36f9('0x2b')]=_0x348774[_0x36f9('0x2b')][_0x36f9('0x2e')]?_0x348774[_0x36f9('0x2b')]:_0x4c1431[_0x36f9('0x26')];if(!_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x2f')](_0x36f9('0x30'))){_0x348774[_0x36f9('0x19')]=qs[_0x36f9('0x19')](_0x30a5f0['query'][_0x36f9('0x19')]);_0x348774['offset']=qs[_0x36f9('0x18')](_0x30a5f0['query'][_0x36f9('0x18')]);}_0x348774['order']=qs[_0x36f9('0x31')](_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x31')]);_0x348774[_0x36f9('0x32')]=qs[_0x36f9('0x2a')](_[_0x36f9('0x33')](_0x30a5f0[_0x36f9('0x28')],_0x4c1431[_0x36f9('0x2a')]),_0x57c82d);if(_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x34')]){_0x348774[_0x36f9('0x32')]=_[_0x36f9('0x35')](_0x348774['where'],{'$or':_['map'](_0x57c82d,function(_0x4bcc39){if(_0x4bcc39['type']!==_0x36f9('0x36')){var _0x3252e2={};_0x3252e2[_0x4bcc39[_0x36f9('0x27')]]={'$like':'%'+_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x34')]+'%'};return _0x3252e2;}})});}_0x348774=_['merge']({},_0x348774,_0x30a5f0[_0x36f9('0x37')]);var _0x542354={'where':_0x348774[_0x36f9('0x32')]};return db[_0x36f9('0x22')][_0x36f9('0x17')](_0x542354)[_0x36f9('0x1c')](function(_0x50b21a){_0x3ce89d[_0x36f9('0x17')]=_0x50b21a;if(_0x30a5f0[_0x36f9('0x28')]['includeAll']){_0x348774[_0x36f9('0x38')]=[{'all':!![]}];}return db[_0x36f9('0x22')][_0x36f9('0x39')](_0x348774);})['then'](function(_0x12c6b4){_0x3ce89d[_0x36f9('0x3a')]=_0x12c6b4;return _0x3ce89d;})['then'](respondWithFilteredResult(_0x5b7ee6,_0x348774))[_0x36f9('0x3b')](handleError(_0x5b7ee6,null));};exports[_0x36f9('0x3c')]=function(_0x2dd828,_0x3b7d08){var _0x4dc379={'raw':![],'where':{'id':_0x2dd828['params']['id']}},_0x31e6cb={};_0x31e6cb['model']=_[_0x36f9('0x29')](db[_0x36f9('0x22')][_0x36f9('0x23')]);_0x31e6cb[_0x36f9('0x28')]=_[_0x36f9('0x29')](_0x2dd828[_0x36f9('0x28')]);_0x31e6cb[_0x36f9('0x2a')]=_[_0x36f9('0x2c')](_0x31e6cb['model'],_0x31e6cb['query']);_0x4dc379[_0x36f9('0x2b')]=_[_0x36f9('0x2c')](_0x31e6cb[_0x36f9('0x26')],qs['fields'](_0x2dd828[_0x36f9('0x28')][_0x36f9('0x2d')]));_0x4dc379[_0x36f9('0x2b')]=_0x4dc379[_0x36f9('0x2b')][_0x36f9('0x2e')]?_0x4dc379['attributes']:_0x31e6cb[_0x36f9('0x26')];if(_0x2dd828[_0x36f9('0x28')][_0x36f9('0x3d')]){_0x4dc379[_0x36f9('0x38')]=[{'all':!![]}];}_0x4dc379=_[_0x36f9('0x35')]({},_0x4dc379,_0x2dd828[_0x36f9('0x37')]);return db[_0x36f9('0x22')][_0x36f9('0x3e')](_0x4dc379)[_0x36f9('0x1c')](handleEntityNotFound(_0x3b7d08,null))['then'](respondWithResult(_0x3b7d08,null))[_0x36f9('0x3b')](handleError(_0x3b7d08,null));};exports['create']=function(_0x3b9393,_0x24711d){return db[_0x36f9('0x22')][_0x36f9('0x3f')](_0x3b9393[_0x36f9('0x40')],{})[_0x36f9('0x1c')](respondWithResult(_0x24711d,0xc9))[_0x36f9('0x3b')](handleError(_0x24711d,null));};exports[_0x36f9('0x41')]=function(_0x1ff93a,_0x2b86e2){return db[_0x36f9('0x22')][_0x36f9('0x41')](_0x1ff93a[_0x36f9('0x40')],{'raw':![],'individualHooks':!![]})[_0x36f9('0x1c')](respondWithResult(_0x2b86e2,0xc9))[_0x36f9('0x3b')](handleError(_0x2b86e2,null));};exports[_0x36f9('0x42')]=function(_0x22e900,_0x21a575){if(_0x22e900[_0x36f9('0x40')]['id']){delete _0x22e900[_0x36f9('0x40')]['id'];}return db[_0x36f9('0x22')][_0x36f9('0x3e')]({'where':{'id':_0x22e900[_0x36f9('0x43')]['id']}})[_0x36f9('0x1c')](handleEntityNotFound(_0x21a575,null))['then'](saveUpdates(_0x22e900[_0x36f9('0x40')],null))[_0x36f9('0x1c')](respondWithResult(_0x21a575,null))[_0x36f9('0x3b')](handleError(_0x21a575,null));};exports['destroy']=function(_0x1c0d7f,_0x26dabe){return db[_0x36f9('0x22')][_0x36f9('0x3e')]({'where':{'id':_0x1c0d7f['params']['id']}})['then'](handleEntityNotFound(_0x26dabe,null))[_0x36f9('0x1c')](removeEntity(_0x26dabe,null))[_0x36f9('0x3b')](handleError(_0x26dabe,null));};exports['bulkDestroy']=function(_0x50ac2e,_0x1187bb){return db[_0x36f9('0x22')][_0x36f9('0x1d')]({'where':{'id':_0x50ac2e[_0x36f9('0x28')][_0x36f9('0x44')]||[]},'raw':![],'individualHooks':!![]})[_0x36f9('0x1c')](respondWithResult(_0x1187bb,0xcc))['catch'](handleError(_0x1187bb,null));};exports[_0x36f9('0x45')]=function(_0xd884c3,_0x4dcfed,_0x374264){return db[_0x36f9('0x46')][_0x36f9('0x47')]({'where':{'id':_0xd884c3[_0x36f9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4dcfed,null))[_0x36f9('0x1c')](function(_0x1a406f){if(_0x1a406f){return db['sequelize']['transaction'](function(_0x190719){return db[_0x36f9('0x22')][_0x36f9('0x1d')]({'where':{'CustomReportId':_0xd884c3[_0x36f9('0x43')]['id']},'transaction':_0x190719})[_0x36f9('0x1c')](function(_0x5009a3){var _0x3d691d=_[_0x36f9('0x21')](_0xd884c3[_0x36f9('0x40')],function(_0x510497){delete _0x510497['id'];_0x510497[_0x36f9('0x48')]=_0xd884c3[_0x36f9('0x43')]['id'];return _0x510497;});return db[_0x36f9('0x22')][_0x36f9('0x41')](_0x3d691d,{'transaction':_0x190719});});})[_0x36f9('0x1c')](function(){return db[_0x36f9('0x22')][_0x36f9('0x39')]({'where':{'CustomReportId':_0xd884c3[_0x36f9('0x43')]['id']}});});}})[_0x36f9('0x1c')](respondWithResult(_0x4dcfed,null))['catch'](handleError(_0x4dcfed,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index cfb4f55..34f8aca 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 _0xee02=['lodash','util','bluebird','path','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xee02,0xa2));var _0x2ee0=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xee02[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x2ee0('0x0'));var util=require(_0x2ee0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2ee0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ee0('0x3'));var rimraf=require('rimraf');var config=require(_0x2ee0('0x4'));var attributes=require('./analyticFieldReport.attributes');module[_0x2ee0('0x5')]=function(_0x478c73,_0xbce544){return _0x478c73[_0x2ee0('0x6')](_0x2ee0('0x7'),attributes,{'tableName':_0x2ee0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7283=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','request-promise'];(function(_0x269ab2,_0x431eda){var _0x52ae97=function(_0x431ca1){while(--_0x431ca1){_0x269ab2['push'](_0x269ab2['shift']());}};_0x52ae97(++_0x431eda);}(_0x7283,0x18e));var _0x3728=function(_0x33ad7e,_0x135618){_0x33ad7e=_0x33ad7e-0x0;var _0x280712=_0x7283[_0x33ad7e];return _0x280712;};'use strict';var _=require(_0x3728('0x0'));var util=require(_0x3728('0x1'));var logger=require(_0x3728('0x2'))('api');var moment=require(_0x3728('0x3'));var BPromise=require('bluebird');var rp=require(_0x3728('0x4'));var fs=require('fs');var path=require(_0x3728('0x5'));var rimraf=require(_0x3728('0x6'));var config=require(_0x3728('0x7'));var attributes=require(_0x3728('0x8'));module[_0x3728('0x9')]=function(_0x14a8c7,_0x4d47e0){return _0x14a8c7[_0x3728('0xa')](_0x3728('0xb'),attributes,{'tableName':_0x3728('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index f5344cd..0fc3cf6 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 _0xaf78=['code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x751bc2,_0x3959b0){var _0x1dad34=function(_0x308666){while(--_0x308666){_0x751bc2['push'](_0x751bc2['shift']());}};_0x1dad34(++_0x3959b0);}(_0xaf78,0x1bd));var _0x8af7=function(_0x16e01a,_0x5f34e2){_0x16e01a=_0x16e01a-0x0;var _0x3235db=_0xaf78[_0x16e01a];return _0x3235db;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8af7('0x0'));var BPromise=require(_0x8af7('0x1'));var rs=require(_0x8af7('0x2'));var fs=require('fs');var Redis=require(_0x8af7('0x3'));var db=require(_0x8af7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8af7('0x5'))('rpc');var config=require(_0x8af7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8af7('0x7')][_0x8af7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43017d,_0x58c65c,_0xb4198c){return new BPromise(function(_0x22ef2e,_0x1d72ca){return client[_0x8af7('0x9')](_0x43017d,_0xb4198c)[_0x8af7('0xa')](function(_0x26cf67){logger[_0x8af7('0xb')](_0x8af7('0xc'),_0x58c65c,_0x8af7('0xd'));logger[_0x8af7('0xe')](_0x8af7('0xf'),_0x58c65c,_0x8af7('0xd'),JSON['stringify'](_0x26cf67));if(_0x26cf67[_0x8af7('0x10')]){if(_0x26cf67[_0x8af7('0x10')][_0x8af7('0x11')]===0x1f4){logger[_0x8af7('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x58c65c,_0x26cf67['error'][_0x8af7('0x12')]);return _0x1d72ca(_0x26cf67['error'][_0x8af7('0x12')]);}logger[_0x8af7('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x58c65c,_0x26cf67['error']['message']);return _0x22ef2e(_0x26cf67[_0x8af7('0x10')][_0x8af7('0x12')]);}else{logger[_0x8af7('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x58c65c,_0x8af7('0xd'));_0x22ef2e(_0x26cf67[_0x8af7('0x13')]['message']);}})[_0x8af7('0x14')](function(_0x5734f0){logger[_0x8af7('0x10')](_0x8af7('0xc'),_0x58c65c,_0x5734f0);_0x1d72ca(_0x5734f0);});});} \ No newline at end of file +var _0xadaa=['../../config/logger','client','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xadaa,0x85));var _0xaada=function(_0x27357e,_0x2a8501){_0x27357e=_0x27357e-0x0;var _0x149b3e=_0xadaa[_0x27357e];return _0x149b3e;};'use strict';var _=require(_0xaada('0x0'));var util=require('util');var moment=require(_0xaada('0x1'));var BPromise=require(_0xaada('0x2'));var rs=require(_0xaada('0x3'));var fs=require('fs');var Redis=require(_0xaada('0x4'));var db=require(_0xaada('0x5'))['db'];var utils=require(_0xaada('0x6'));var logger=require(_0xaada('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaada('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17dd9,_0x5515f9,_0x31b092){return new BPromise(function(_0x28be4d,_0x17de6c){return client['request'](_0x17dd9,_0x31b092)[_0xaada('0x9')](function(_0x3f99e7){logger[_0xaada('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5515f9,_0xaada('0xb'));logger['debug'](_0xaada('0xc'),_0x5515f9,_0xaada('0xb'),JSON[_0xaada('0xd')](_0x3f99e7));if(_0x3f99e7['error']){if(_0x3f99e7[_0xaada('0xe')][_0xaada('0xf')]===0x1f4){logger['error'](_0xaada('0x10'),_0x5515f9,_0x3f99e7[_0xaada('0xe')][_0xaada('0x11')]);return _0x17de6c(_0x3f99e7[_0xaada('0xe')]['message']);}logger[_0xaada('0xe')](_0xaada('0x10'),_0x5515f9,_0x3f99e7[_0xaada('0xe')]['message']);return _0x28be4d(_0x3f99e7['error'][_0xaada('0x11')]);}else{logger[_0xaada('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5515f9,_0xaada('0xb'));_0x28be4d(_0x3f99e7[_0xaada('0x12')][_0xaada('0x11')]);}})[_0xaada('0x13')](function(_0x5ddc61){logger[_0xaada('0xe')](_0xaada('0x10'),_0x5515f9,_0x5ddc61);_0x17de6c(_0x5ddc61);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d572b93..f4ad54e 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 _0x326f=['/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','update','/destroy_many','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x326f,0xd1));var _0xf326=function(_0x416c14,_0x8f64df){_0x416c14=_0x416c14-0x0;var _0x13a057=_0x326f[_0x416c14];return _0x13a057;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf326('0xe'),auth[_0xf326('0x9')](),controller[_0xf326('0xf')]);router[_0xf326('0xd')](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['put'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x12')]);router['delete'](_0xf326('0x13'),auth[_0xf326('0x9')](),controller['bulkDestroy']);router[_0xf326('0x14')](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x118749,_0x50e848){var _0x20d489=function(_0x3c80a2){while(--_0x3c80a2){_0x118749['push'](_0x118749['shift']());}};_0x20d489(++_0x50e848);}(_0xe14b,0x93));var _0xbe14=function(_0x51ab3b,_0x9f5d8d){_0x51ab3b=_0x51ab3b-0x0;var _0x30cac3=_0xe14b[_0x51ab3b];return _0x30cac3;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 7c8b365..ed6d75a 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 _0x6f18=['TEXT','sequelize','STRING'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x6f18,0x1b4));var _0x86f1=function(_0x46e25c,_0x5b54ae){_0x46e25c=_0x46e25c-0x0;var _0x2d87a0=_0x6f18[_0x46e25c];return _0x2d87a0;};'use strict';var Sequelize=require(_0x86f1('0x0'));module['exports']={'name':{'type':Sequelize[_0x86f1('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x86f1('0x1')]},'metric':{'type':Sequelize[_0x86f1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa9e1=['STRING','TEXT','sequelize','exports','name'];(function(_0x9b2535,_0x30c0a7){var _0x2f2a91=function(_0x731744){while(--_0x731744){_0x9b2535['push'](_0x9b2535['shift']());}};_0x2f2a91(++_0x30c0a7);}(_0xa9e1,0x7a));var _0x1a9e=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0xa9e1[_0x37ae26];return _0x1b1902;};'use strict';var Sequelize=require(_0x1a9e('0x0'));module[_0x1a9e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1a9e('0x2')},'table':{'type':Sequelize[_0x1a9e('0x3')]},'metric':{'type':Sequelize[_0x1a9e('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 718ef10..12c573c 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 _0x0490=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','Metrics','UserProfileResource','error','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x0490,0x147));var _0x0049=function(_0x41732e,_0x4ca559){_0x41732e=_0x41732e-0x0;var _0x225b7e=_0x0490[_0x41732e];return _0x225b7e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0049('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0049('0x1'));var BPromise=require(_0x0049('0x2'));var Mustache=require(_0x0049('0x3'));var util=require(_0x0049('0x4'));var path=require(_0x0049('0x5'));var sox=require(_0x0049('0x6'));var csv=require(_0x0049('0x7'));var ejs=require(_0x0049('0x8'));var fs=require('fs');var _=require(_0x0049('0x9'));var squel=require('squel');var crypto=require(_0x0049('0xa'));var jsforce=require(_0x0049('0xb'));var deskjs=require(_0x0049('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0049('0xd'));var Papa=require(_0x0049('0xe'));var Redis=require(_0x0049('0xf'));var authService=require(_0x0049('0x10'));var qs=require(_0x0049('0x11'));var as=require(_0x0049('0x12'));var hardwareService=require(_0x0049('0x13'));var logger=require(_0x0049('0x14'))(_0x0049('0x15'));var utils=require('../../config/utils');var config=require(_0x0049('0x16'));var db=require(_0x0049('0x17'))['db'];function respondWithStatusCode(_0x20d5cc,_0x5b4d44){_0x5b4d44=_0x5b4d44||0xcc;return function(_0x547be9){if(_0x547be9){return _0x20d5cc[_0x0049('0x18')](_0x5b4d44);}return _0x20d5cc[_0x0049('0x19')](_0x5b4d44)[_0x0049('0x1a')]();};}function respondWithResult(_0x3898be,_0x42dc6b){_0x42dc6b=_0x42dc6b||0xc8;return function(_0x5934fc){if(_0x5934fc){return _0x3898be[_0x0049('0x19')](_0x42dc6b)[_0x0049('0x1b')](_0x5934fc);}};}function respondWithFilteredResult(_0x573138,_0x1802f5){return function(_0x2aace1){if(_0x2aace1){var _0x2d6b06=_0x2aace1[_0x0049('0x1c')],_0x1a62aa=_0x1802f5[_0x0049('0x1d')],_0x5adcf2=_0x1802f5[_0x0049('0x1d')]+_0x1802f5[_0x0049('0x1e')],_0x502038;if(_0x5adcf2>=_0x2d6b06){_0x5adcf2=_0x2d6b06;_0x502038=0xc8;}else{_0x502038=0xce;}_0x573138[_0x0049('0x19')](_0x502038);return _0x573138[_0x0049('0x1f')](_0x0049('0x20'),_0x1a62aa+'-'+_0x5adcf2+'/'+_0x2d6b06)[_0x0049('0x1b')](_0x2aace1);}return null;};}function patchUpdates(_0x6df63c){return function(_0x226808){try{jsonpatch['apply'](_0x226808,_0x6df63c,!![]);}catch(_0x57dd61){return BPromise[_0x0049('0x21')](_0x57dd61);}return _0x226808['save']();};}function saveUpdates(_0x314d00,_0x4624ff){return function(_0x2a5ec3){if(_0x2a5ec3){return _0x2a5ec3[_0x0049('0x22')](_0x314d00)[_0x0049('0x23')](function(_0x4c1507){return _0x4c1507;});}return null;};}function removeEntity(_0x26a9fb,_0x462ceb){return function(_0x49c00b){if(_0x49c00b){return _0x49c00b[_0x0049('0x24')]()[_0x0049('0x23')](function(){var _0x4d76e0=_0x49c00b[_0x0049('0x25')]({'plain':!![]});var _0x91d727=_0x0049('0x26');return db[_0x0049('0x27')][_0x0049('0x24')]({'where':{'type':_0x91d727,'resourceId':_0x4d76e0['id']}})[_0x0049('0x23')](function(){return _0x49c00b;});})[_0x0049('0x23')](function(){_0x26a9fb[_0x0049('0x19')](0xcc)[_0x0049('0x1a')]();});}};}function handleEntityNotFound(_0x47b0c4,_0x217a12){return function(_0x2813d2){if(!_0x2813d2){_0x47b0c4[_0x0049('0x18')](0x194);}return _0x2813d2;};}function handleError(_0x118bc0,_0x435789){_0x435789=_0x435789||0x1f4;return function(_0x48b588){logger[_0x0049('0x28')](_0x48b588['stack']);if(_0x48b588[_0x0049('0x29')]){delete _0x48b588[_0x0049('0x29')];}_0x118bc0[_0x0049('0x19')](_0x435789)[_0x0049('0x2a')](_0x48b588);};}exports['index']=function(_0x305623,_0x402774){var _0x2407d8={},_0x2b8715={},_0x414029={'count':0x0,'rows':[]};var _0x5e59be=_[_0x0049('0x2b')](db[_0x0049('0x2c')][_0x0049('0x2d')],function(_0x4bd71c){return{'name':_0x4bd71c[_0x0049('0x2e')],'type':_0x4bd71c[_0x0049('0x2f')][_0x0049('0x30')]};});_0x2b8715[_0x0049('0x31')]=_['map'](_0x5e59be,_0x0049('0x29'));_0x2b8715[_0x0049('0x32')]=_['keys'](_0x305623[_0x0049('0x32')]);_0x2b8715[_0x0049('0x33')]=_['intersection'](_0x2b8715[_0x0049('0x31')],_0x2b8715[_0x0049('0x32')]);_0x2407d8[_0x0049('0x34')]=_[_0x0049('0x35')](_0x2b8715[_0x0049('0x31')],qs['fields'](_0x305623[_0x0049('0x32')][_0x0049('0x36')]));_0x2407d8[_0x0049('0x34')]=_0x2407d8[_0x0049('0x34')][_0x0049('0x37')]?_0x2407d8['attributes']:_0x2b8715[_0x0049('0x31')];if(!_0x305623['query'][_0x0049('0x38')](_0x0049('0x39'))){_0x2407d8[_0x0049('0x1e')]=qs['limit'](_0x305623[_0x0049('0x32')]['limit']);_0x2407d8[_0x0049('0x1d')]=qs[_0x0049('0x1d')](_0x305623[_0x0049('0x32')]['offset']);}_0x2407d8[_0x0049('0x3a')]=qs[_0x0049('0x3b')](_0x305623[_0x0049('0x32')][_0x0049('0x3b')]);_0x2407d8[_0x0049('0x3c')]=qs[_0x0049('0x33')](_['pick'](_0x305623[_0x0049('0x32')],_0x2b8715[_0x0049('0x33')]),_0x5e59be);if(_0x305623['query']['filter']){_0x2407d8[_0x0049('0x3c')]=_[_0x0049('0x3d')](_0x2407d8[_0x0049('0x3c')],{'$or':_[_0x0049('0x2b')](_0x5e59be,function(_0x1f35e7){if(_0x1f35e7[_0x0049('0x2f')]!==_0x0049('0x3e')){var _0x267d8a={};_0x267d8a[_0x1f35e7['name']]={'$like':'%'+_0x305623[_0x0049('0x32')][_0x0049('0x3f')]+'%'};return _0x267d8a;}})});}_0x2407d8=_[_0x0049('0x3d')]({},_0x2407d8,_0x305623[_0x0049('0x40')]);var _0xe8a86f={'where':_0x2407d8[_0x0049('0x3c')]};return db[_0x0049('0x2c')][_0x0049('0x1c')](_0xe8a86f)['then'](function(_0x2397aa){_0x414029[_0x0049('0x1c')]=_0x2397aa;if(_0x305623[_0x0049('0x32')][_0x0049('0x41')]){_0x2407d8[_0x0049('0x42')]=[{'all':!![]}];}return db[_0x0049('0x2c')][_0x0049('0x43')](_0x2407d8);})[_0x0049('0x23')](function(_0x469bb1){_0x414029[_0x0049('0x44')]=_0x469bb1;return _0x414029;})[_0x0049('0x23')](respondWithFilteredResult(_0x402774,_0x2407d8))[_0x0049('0x45')](handleError(_0x402774,null));};exports[_0x0049('0x46')]=function(_0x4ebc42,_0x22e083){var _0x2818dd={'raw':!![],'where':{'id':_0x4ebc42['params']['id']}},_0x36a2fc={};_0x36a2fc['model']=_[_0x0049('0x47')](db['AnalyticMetric'][_0x0049('0x2d')]);_0x36a2fc[_0x0049('0x32')]=_[_0x0049('0x47')](_0x4ebc42[_0x0049('0x32')]);_0x36a2fc[_0x0049('0x33')]=_[_0x0049('0x35')](_0x36a2fc[_0x0049('0x31')],_0x36a2fc[_0x0049('0x32')]);_0x2818dd['attributes']=_['intersection'](_0x36a2fc['model'],qs[_0x0049('0x36')](_0x4ebc42[_0x0049('0x32')][_0x0049('0x36')]));_0x2818dd['attributes']=_0x2818dd[_0x0049('0x34')][_0x0049('0x37')]?_0x2818dd[_0x0049('0x34')]:_0x36a2fc['model'];if(_0x4ebc42['query']['includeAll']){_0x2818dd[_0x0049('0x42')]=[{'all':!![]}];}_0x2818dd=_['merge']({},_0x2818dd,_0x4ebc42['options']);return db[_0x0049('0x2c')][_0x0049('0x48')](_0x2818dd)[_0x0049('0x23')](handleEntityNotFound(_0x22e083,null))[_0x0049('0x23')](respondWithResult(_0x22e083,null))[_0x0049('0x45')](handleError(_0x22e083,null));};exports['create']=function(_0xa60a2b,_0x2862bf){return db[_0x0049('0x2c')][_0x0049('0x49')](_0xa60a2b[_0x0049('0x4a')],{})[_0x0049('0x23')](function(_0x5cc0bc){var _0x433ce2=_0xa60a2b['user'][_0x0049('0x25')]({'plain':!![]});if(!_0x433ce2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x433ce2[_0x0049('0x4b')]===_0x0049('0x4c')){var _0x22a8c4=_0x5cc0bc[_0x0049('0x25')]({'plain':!![]});var _0xc3a900='Metrics';return db[_0x0049('0x4d')][_0x0049('0x48')]({'where':{'name':_0xc3a900,'userProfileId':_0x433ce2[_0x0049('0x4e')]},'raw':!![]})[_0x0049('0x23')](function(_0x1cd1dc){if(_0x1cd1dc&&_0x1cd1dc[_0x0049('0x4f')]===0x0){return db['UserProfileResource'][_0x0049('0x49')]({'name':_0x22a8c4['name'],'resourceId':_0x22a8c4['id'],'type':_0x1cd1dc[_0x0049('0x29')],'sectionId':_0x1cd1dc['id']},{})[_0x0049('0x23')](function(){return _0x5cc0bc;});}else{return _0x5cc0bc;}})['catch'](function(_0x1abc14){logger[_0x0049('0x28')](_0x0049('0x50'),_0x1abc14);throw _0x1abc14;});}return _0x5cc0bc;})[_0x0049('0x23')](respondWithResult(_0x2862bf,0xc9))[_0x0049('0x45')](handleError(_0x2862bf,null));};exports[_0x0049('0x22')]=function(_0x23a6fb,_0x528824){if(_0x23a6fb['body']['id']){delete _0x23a6fb[_0x0049('0x4a')]['id'];}return db[_0x0049('0x2c')][_0x0049('0x48')]({'where':{'id':_0x23a6fb[_0x0049('0x51')]['id']}})['then'](handleEntityNotFound(_0x528824,null))[_0x0049('0x23')](saveUpdates(_0x23a6fb['body'],null))['then'](respondWithResult(_0x528824,null))['catch'](handleError(_0x528824,null));};exports['destroy']=function(_0xe3ca3d,_0x227785){return db[_0x0049('0x2c')][_0x0049('0x48')]({'where':{'id':_0xe3ca3d[_0x0049('0x51')]['id']}})['then'](handleEntityNotFound(_0x227785,null))['then'](removeEntity(_0x227785,null))[_0x0049('0x45')](handleError(_0x227785,null));}; \ No newline at end of file +var _0xb574=['model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','then','destroy','Metrics','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','key'];(function(_0x4dc00b,_0x229642){var _0x38a107=function(_0x231d7f){while(--_0x231d7f){_0x4dc00b['push'](_0x4dc00b['shift']());}};_0x38a107(++_0x229642);}(_0xb574,0x106));var _0x4b57=function(_0x26dbd8,_0x345f9f){_0x26dbd8=_0x26dbd8-0x0;var _0xe4a077=_0xb574[_0x26dbd8];return _0xe4a077;};'use strict';var pdf=require(_0x4b57('0x0'));var emlformat=require(_0x4b57('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4b57('0x2'));var jsonpatch=require(_0x4b57('0x3'));var rp=require('request-promise');var moment=require(_0x4b57('0x4'));var BPromise=require(_0x4b57('0x5'));var Mustache=require(_0x4b57('0x6'));var util=require(_0x4b57('0x7'));var path=require(_0x4b57('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b57('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2701ab,_0x357c8b){_0x357c8b=_0x357c8b||0xcc;return function(_0x43d066){if(_0x43d066){return _0x2701ab[_0x4b57('0x15')](_0x357c8b);}return _0x2701ab[_0x4b57('0x16')](_0x357c8b)[_0x4b57('0x17')]();};}function respondWithResult(_0x30f685,_0xd5ee6d){_0xd5ee6d=_0xd5ee6d||0xc8;return function(_0x31cced){if(_0x31cced){return _0x30f685['status'](_0xd5ee6d)['json'](_0x31cced);}};}function respondWithFilteredResult(_0x236c95,_0x24f776){return function(_0x10b9ff){if(_0x10b9ff){var _0x58d6bd=_0x10b9ff[_0x4b57('0x18')],_0x284640=_0x24f776[_0x4b57('0x19')],_0x48bd13=_0x24f776[_0x4b57('0x19')]+_0x24f776[_0x4b57('0x1a')],_0x159ce5;if(_0x48bd13>=_0x58d6bd){_0x48bd13=_0x58d6bd;_0x159ce5=0xc8;}else{_0x159ce5=0xce;}_0x236c95[_0x4b57('0x16')](_0x159ce5);return _0x236c95['set'](_0x4b57('0x1b'),_0x284640+'-'+_0x48bd13+'/'+_0x58d6bd)[_0x4b57('0x1c')](_0x10b9ff);}return null;};}function patchUpdates(_0x53f29a){return function(_0x402bb9){try{jsonpatch['apply'](_0x402bb9,_0x53f29a,!![]);}catch(_0xb62450){return BPromise[_0x4b57('0x1d')](_0xb62450);}return _0x402bb9[_0x4b57('0x1e')]();};}function saveUpdates(_0x2682d6,_0xef1eae){return function(_0x4454c8){if(_0x4454c8){return _0x4454c8['update'](_0x2682d6)[_0x4b57('0x1f')](function(_0x131fed){return _0x131fed;});}return null;};}function removeEntity(_0x2c7c87,_0x567d8f){return function(_0x380554){if(_0x380554){return _0x380554[_0x4b57('0x20')]()[_0x4b57('0x1f')](function(){var _0x1fa78d=_0x380554['get']({'plain':!![]});var _0x271361=_0x4b57('0x21');return db['UserProfileResource'][_0x4b57('0x20')]({'where':{'type':_0x271361,'resourceId':_0x1fa78d['id']}})[_0x4b57('0x1f')](function(){return _0x380554;});})[_0x4b57('0x1f')](function(){_0x2c7c87[_0x4b57('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x156962,_0x51d0c3){return function(_0x131dab){if(!_0x131dab){_0x156962['sendStatus'](0x194);}return _0x131dab;};}function handleError(_0x36ceb1,_0x2dc9d8){_0x2dc9d8=_0x2dc9d8||0x1f4;return function(_0x4af2c8){logger[_0x4b57('0x22')](_0x4af2c8[_0x4b57('0x23')]);if(_0x4af2c8[_0x4b57('0x24')]){delete _0x4af2c8['name'];}_0x36ceb1['status'](_0x2dc9d8)[_0x4b57('0x25')](_0x4af2c8);};}exports['index']=function(_0x1ea0cb,_0x458f70){var _0x874cf7={},_0x3af22f={},_0x249461={'count':0x0,'rows':[]};var _0x2c20d2=_['map'](db[_0x4b57('0x26')][_0x4b57('0x27')],function(_0x68be27){return{'name':_0x68be27[_0x4b57('0x28')],'type':_0x68be27['type'][_0x4b57('0x29')]};});_0x3af22f[_0x4b57('0x2a')]=_['map'](_0x2c20d2,_0x4b57('0x24'));_0x3af22f[_0x4b57('0x2b')]=_[_0x4b57('0x2c')](_0x1ea0cb[_0x4b57('0x2b')]);_0x3af22f['filters']=_['intersection'](_0x3af22f['model'],_0x3af22f[_0x4b57('0x2b')]);_0x874cf7[_0x4b57('0x2d')]=_[_0x4b57('0x2e')](_0x3af22f[_0x4b57('0x2a')],qs[_0x4b57('0x2f')](_0x1ea0cb['query'][_0x4b57('0x2f')]));_0x874cf7[_0x4b57('0x2d')]=_0x874cf7[_0x4b57('0x2d')]['length']?_0x874cf7[_0x4b57('0x2d')]:_0x3af22f[_0x4b57('0x2a')];if(!_0x1ea0cb[_0x4b57('0x2b')]['hasOwnProperty'](_0x4b57('0x30'))){_0x874cf7[_0x4b57('0x1a')]=qs['limit'](_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x1a')]);_0x874cf7[_0x4b57('0x19')]=qs[_0x4b57('0x19')](_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x19')]);}_0x874cf7['order']=qs[_0x4b57('0x31')](_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x31')]);_0x874cf7[_0x4b57('0x32')]=qs[_0x4b57('0x33')](_[_0x4b57('0x34')](_0x1ea0cb[_0x4b57('0x2b')],_0x3af22f['filters']),_0x2c20d2);if(_0x1ea0cb['query'][_0x4b57('0x35')]){_0x874cf7[_0x4b57('0x32')]=_[_0x4b57('0x36')](_0x874cf7['where'],{'$or':_[_0x4b57('0x37')](_0x2c20d2,function(_0x1a3c3a){if(_0x1a3c3a[_0x4b57('0x38')]!==_0x4b57('0x39')){var _0x5487cc={};_0x5487cc[_0x1a3c3a[_0x4b57('0x24')]]={'$like':'%'+_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x35')]+'%'};return _0x5487cc;}})});}_0x874cf7=_[_0x4b57('0x36')]({},_0x874cf7,_0x1ea0cb['options']);var _0x5766a6={'where':_0x874cf7['where']};return db[_0x4b57('0x26')][_0x4b57('0x18')](_0x5766a6)[_0x4b57('0x1f')](function(_0x2e23d3){_0x249461['count']=_0x2e23d3;if(_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x3a')]){_0x874cf7[_0x4b57('0x3b')]=[{'all':!![]}];}return db[_0x4b57('0x26')][_0x4b57('0x3c')](_0x874cf7);})[_0x4b57('0x1f')](function(_0x2d5a0c){_0x249461[_0x4b57('0x3d')]=_0x2d5a0c;return _0x249461;})[_0x4b57('0x1f')](respondWithFilteredResult(_0x458f70,_0x874cf7))['catch'](handleError(_0x458f70,null));};exports[_0x4b57('0x3e')]=function(_0x3685fd,_0x3c5095){var _0x5b2f50={'raw':!![],'where':{'id':_0x3685fd['params']['id']}},_0x44f988={};_0x44f988[_0x4b57('0x2a')]=_[_0x4b57('0x2c')](db[_0x4b57('0x26')][_0x4b57('0x27')]);_0x44f988[_0x4b57('0x2b')]=_[_0x4b57('0x2c')](_0x3685fd[_0x4b57('0x2b')]);_0x44f988[_0x4b57('0x33')]=_[_0x4b57('0x2e')](_0x44f988[_0x4b57('0x2a')],_0x44f988[_0x4b57('0x2b')]);_0x5b2f50[_0x4b57('0x2d')]=_[_0x4b57('0x2e')](_0x44f988['model'],qs['fields'](_0x3685fd[_0x4b57('0x2b')][_0x4b57('0x2f')]));_0x5b2f50[_0x4b57('0x2d')]=_0x5b2f50[_0x4b57('0x2d')]['length']?_0x5b2f50[_0x4b57('0x2d')]:_0x44f988[_0x4b57('0x2a')];if(_0x3685fd['query'][_0x4b57('0x3a')]){_0x5b2f50['include']=[{'all':!![]}];}_0x5b2f50=_[_0x4b57('0x36')]({},_0x5b2f50,_0x3685fd['options']);return db['AnalyticMetric'][_0x4b57('0x3f')](_0x5b2f50)[_0x4b57('0x1f')](handleEntityNotFound(_0x3c5095,null))['then'](respondWithResult(_0x3c5095,null))[_0x4b57('0x40')](handleError(_0x3c5095,null));};exports[_0x4b57('0x41')]=function(_0x2732ff,_0x1cf1f3){return db[_0x4b57('0x26')][_0x4b57('0x41')](_0x2732ff['body'],{})[_0x4b57('0x1f')](function(_0x2833f4){var _0x4a632c=_0x2732ff[_0x4b57('0x42')][_0x4b57('0x43')]({'plain':!![]});if(!_0x4a632c)throw new Error(_0x4b57('0x44'));if(_0x4a632c['role']===_0x4b57('0x42')){var _0x5cba5f=_0x2833f4[_0x4b57('0x43')]({'plain':!![]});var _0xfbe7ed=_0x4b57('0x21');return db[_0x4b57('0x45')][_0x4b57('0x3f')]({'where':{'name':_0xfbe7ed,'userProfileId':_0x4a632c[_0x4b57('0x46')]},'raw':!![]})[_0x4b57('0x1f')](function(_0x3ec6ba){if(_0x3ec6ba&&_0x3ec6ba['autoAssociation']===0x0){return db[_0x4b57('0x47')][_0x4b57('0x41')]({'name':_0x5cba5f[_0x4b57('0x24')],'resourceId':_0x5cba5f['id'],'type':_0x3ec6ba['name'],'sectionId':_0x3ec6ba['id']},{})[_0x4b57('0x1f')](function(){return _0x2833f4;});}else{return _0x2833f4;}})[_0x4b57('0x40')](function(_0x32985f){logger['error'](_0x4b57('0x48'),_0x32985f);throw _0x32985f;});}return _0x2833f4;})[_0x4b57('0x1f')](respondWithResult(_0x1cf1f3,0xc9))[_0x4b57('0x40')](handleError(_0x1cf1f3,null));};exports[_0x4b57('0x49')]=function(_0x44494f,_0xb7c37c){if(_0x44494f[_0x4b57('0x4a')]['id']){delete _0x44494f['body']['id'];}return db['AnalyticMetric'][_0x4b57('0x3f')]({'where':{'id':_0x44494f[_0x4b57('0x4b')]['id']}})[_0x4b57('0x1f')](handleEntityNotFound(_0xb7c37c,null))[_0x4b57('0x1f')](saveUpdates(_0x44494f['body'],null))[_0x4b57('0x1f')](respondWithResult(_0xb7c37c,null))[_0x4b57('0x40')](handleError(_0xb7c37c,null));};exports[_0x4b57('0x20')]=function(_0xee171b,_0x4857c3){return db['AnalyticMetric'][_0x4b57('0x3f')]({'where':{'id':_0xee171b[_0x4b57('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4857c3,null))['then'](removeEntity(_0x4857c3,null))[_0x4b57('0x40')](handleError(_0x4857c3,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index bc6353b..54deb68 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 _0x6583=['define','AnalyticMetric','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6583,0x1e6));var _0x3658=function(_0x2377a3,_0x7b4522){_0x2377a3=_0x2377a3-0x0;var _0x538284=_0x6583[_0x2377a3];return _0x538284;};'use strict';var _=require(_0x3658('0x0'));var util=require(_0x3658('0x1'));var logger=require('../../config/logger')(_0x3658('0x2'));var moment=require(_0x3658('0x3'));var BPromise=require(_0x3658('0x4'));var rp=require(_0x3658('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3658('0x6'));var attributes=require(_0x3658('0x7'));module[_0x3658('0x8')]=function(_0x38f571,_0x476f6f){return _0x38f571[_0x3658('0x9')](_0x3658('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7272=['AnalyticMetric','analytics_metrics','lodash','moment','bluebird','request-promise','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x5dd16f,_0x4555eb){var _0x342571=function(_0x198581){while(--_0x198581){_0x5dd16f['push'](_0x5dd16f['shift']());}};_0x342571(++_0x4555eb);}(_0x7272,0x80));var _0x2727=function(_0x59268f,_0x34e1d3){_0x59268f=_0x59268f-0x0;var _0x59e5bb=_0x7272[_0x59268f];return _0x59e5bb;};'use strict';var _=require(_0x2727('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2727('0x1'));var BPromise=require(_0x2727('0x2'));var rp=require(_0x2727('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2727('0x4'));var attributes=require(_0x2727('0x5'));module[_0x2727('0x6')]=function(_0x33a56a,_0x40ce7f){return _0x33a56a['define'](_0x2727('0x7'),attributes,{'tableName':_0x2727('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 97b8903..8066179 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 _0xf97b=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x106cfc,_0x497abd){var _0x17af18=function(_0x16ec08){while(--_0x16ec08){_0x106cfc['push'](_0x106cfc['shift']());}};_0x17af18(++_0x497abd);}(_0xf97b,0x1e6));var _0xbf97=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf97b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbf97('0x0'));var util=require(_0xbf97('0x1'));var moment=require(_0xbf97('0x2'));var BPromise=require(_0xbf97('0x3'));var rs=require(_0xbf97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf97('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf97('0x6'))(_0xbf97('0x7'));var config=require(_0xbf97('0x8'));var jayson=require(_0xbf97('0x9'));var client=jayson[_0xbf97('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3244e0,_0x2469dd,_0xa1987e){return new BPromise(function(_0x4d9ca9,_0x4b1e7c){return client[_0xbf97('0xb')](_0x3244e0,_0xa1987e)[_0xbf97('0xc')](function(_0x1cdcf2){logger[_0xbf97('0xd')](_0xbf97('0xe'),_0x2469dd,_0xbf97('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2469dd,_0xbf97('0xf'),JSON[_0xbf97('0x10')](_0x1cdcf2));if(_0x1cdcf2[_0xbf97('0x11')]){if(_0x1cdcf2[_0xbf97('0x11')][_0xbf97('0x12')]===0x1f4){logger[_0xbf97('0x11')](_0xbf97('0xe'),_0x2469dd,_0x1cdcf2[_0xbf97('0x11')][_0xbf97('0x13')]);return _0x4b1e7c(_0x1cdcf2['error']['message']);}logger['error'](_0xbf97('0xe'),_0x2469dd,_0x1cdcf2[_0xbf97('0x11')]['message']);return _0x4d9ca9(_0x1cdcf2[_0xbf97('0x11')]['message']);}else{logger[_0xbf97('0xd')](_0xbf97('0xe'),_0x2469dd,_0xbf97('0xf'));_0x4d9ca9(_0x1cdcf2[_0xbf97('0x14')]['message']);}})[_0xbf97('0x15')](function(_0x1a6436){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x2469dd,_0x1a6436);_0x4b1e7c(_0x1a6436);});});} \ No newline at end of file +var _0x5db0=['request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x243e64,_0x174f5d){var _0x3ae1ed=function(_0x2c8afe){while(--_0x2c8afe){_0x243e64['push'](_0x243e64['shift']());}};_0x3ae1ed(++_0x174f5d);}(_0x5db0,0xde));var _0x05db=function(_0x33041d,_0x4b3ecd){_0x33041d=_0x33041d-0x0;var _0xe0753a=_0x5db0[_0x33041d];return _0xe0753a;};'use strict';var _=require(_0x05db('0x0'));var util=require('util');var moment=require(_0x05db('0x1'));var BPromise=require(_0x05db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x05db('0x3'));var logger=require(_0x05db('0x4'))(_0x05db('0x5'));var config=require('../../config/environment');var jayson=require(_0x05db('0x6'));var client=jayson[_0x05db('0x7')][_0x05db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x127d23,_0x4fe463,_0x374917){return new BPromise(function(_0x1dc9e1,_0x327f79){return client[_0x05db('0x9')](_0x127d23,_0x374917)[_0x05db('0xa')](function(_0x458769){logger[_0x05db('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x4fe463,_0x05db('0xc'));logger[_0x05db('0xd')](_0x05db('0xe'),_0x4fe463,_0x05db('0xc'),JSON[_0x05db('0xf')](_0x458769));if(_0x458769[_0x05db('0x10')]){if(_0x458769['error'][_0x05db('0x11')]===0x1f4){logger['error'](_0x05db('0x12'),_0x4fe463,_0x458769[_0x05db('0x10')]['message']);return _0x327f79(_0x458769[_0x05db('0x10')]['message']);}logger[_0x05db('0x10')](_0x05db('0x12'),_0x4fe463,_0x458769[_0x05db('0x10')][_0x05db('0x13')]);return _0x1dc9e1(_0x458769[_0x05db('0x10')]['message']);}else{logger[_0x05db('0xb')](_0x05db('0x12'),_0x4fe463,'request\x20sent');_0x1dc9e1(_0x458769[_0x05db('0x14')][_0x05db('0x13')]);}})['catch'](function(_0x1c67ec){logger[_0x05db('0x10')](_0x05db('0x12'),_0x4fe463,_0x1c67ec);_0x327f79(_0x1c67ec);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index ac33bdd..c5cf4cf 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 _0x57ca=['isAuthenticated','index','/:id','show','post','create','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0x57ca,0x108));var _0xa57c=function(_0x537ee3,_0x22f394){_0x537ee3=_0x537ee3-0x0;var _0x2e8d90=_0x57ca[_0x537ee3];return _0x2e8d90;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./analyticMetric.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0xc')]('/',auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['put'](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller['update']);router[_0xa57c('0xe')]('/:id',auth[_0xa57c('0x8')](),controller[_0xa57c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0295=['delete','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','put'];(function(_0x1964b4,_0x5796f4){var _0x509a77=function(_0x247257){while(--_0x247257){_0x1964b4['push'](_0x1964b4['shift']());}};_0x509a77(++_0x5796f4);}(_0x0295,0x1f0));var _0x5029=function(_0x15c5b8,_0x3b670f){_0x15c5b8=_0x15c5b8-0x0;var _0xd45fe6=_0x0295[_0x15c5b8];return _0xd45fe6;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x5029('0x2'));var interaction=require(_0x5029('0x3'));var config=require(_0x5029('0x4'));var controller=require(_0x5029('0x5'));router[_0x5029('0x6')]('/',auth[_0x5029('0x7')](),controller[_0x5029('0x8')]);router[_0x5029('0x6')](_0x5029('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5029('0x7')](),controller['create']);router[_0x5029('0xa')]('/:id',auth[_0x5029('0x7')](),controller['update']);router[_0x5029('0xb')](_0x5029('0x9'),auth[_0x5029('0x7')](),controller['destroy']);module[_0x5029('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 61d58da..44e37aa 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 _0x0f4e=['exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f4e,0x162));var _0xe0f4=function(_0x12de61,_0x4b56a4){_0x12de61=_0x12de61-0x0;var _0xb3684f=_0x0f4e[_0x12de61];return _0xb3684f;};'use strict';var Sequelize=require('sequelize');module[_0xe0f4('0x0')]={'tree':{'type':Sequelize[_0xe0f4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1aea=['exports','TEXT','sequelize'];(function(_0x374715,_0x23d5ed){var _0x34539a=function(_0x3dd77c){while(--_0x3dd77c){_0x374715['push'](_0x374715['shift']());}};_0x34539a(++_0x23d5ed);}(_0x1aea,0x116));var _0xa1ae=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x1aea[_0x5c4585];return _0x21dede;};'use strict';var Sequelize=require(_0xa1ae('0x0'));module[_0xa1ae('0x1')]={'tree':{'type':Sequelize[_0xa1ae('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index fc2fd67..b386c40 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 _0x184d=['attributes','fields','limit','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','reject','save','update','then','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','query','keys','intersection','model'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x184d,0x19b));var _0xd184=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x184d[_0x49b207];return _0x2dc8fa;};'use strict';var pdf=require(_0xd184('0x0'));var emlformat=require(_0xd184('0x1'));var rimraf=require(_0xd184('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd184('0x3'));var rp=require(_0xd184('0x4'));var moment=require(_0xd184('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd184('0x6'));var path=require(_0xd184('0x7'));var sox=require(_0xd184('0x8'));var csv=require('to-csv');var ejs=require(_0xd184('0x9'));var fs=require('fs');var _=require(_0xd184('0xa'));var squel=require(_0xd184('0xb'));var crypto=require('crypto');var jsforce=require(_0xd184('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd184('0xd'));var querystring=require(_0xd184('0xe'));var Papa=require(_0xd184('0xf'));var Redis=require(_0xd184('0x10'));var authService=require(_0xd184('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd184('0x12'))(_0xd184('0x13'));var utils=require(_0xd184('0x14'));var config=require(_0xd184('0x15'));var db=require(_0xd184('0x16'))['db'];function respondWithStatusCode(_0x17daef,_0x342092){_0x342092=_0x342092||0xcc;return function(_0x5a84d6){if(_0x5a84d6){return _0x17daef[_0xd184('0x17')](_0x342092);}return _0x17daef[_0xd184('0x18')](_0x342092)[_0xd184('0x19')]();};}function respondWithResult(_0x306490,_0x365a78){_0x365a78=_0x365a78||0xc8;return function(_0x442616){if(_0x442616){return _0x306490[_0xd184('0x18')](_0x365a78)['json'](_0x442616);}};}function respondWithFilteredResult(_0x1371aa,_0x32a365){return function(_0xea4b51){if(_0xea4b51){var _0x452ee0=_0xea4b51[_0xd184('0x1a')],_0x479c85=_0x32a365[_0xd184('0x1b')],_0x4a881a=_0x32a365[_0xd184('0x1b')]+_0x32a365['limit'],_0x7bef51;if(_0x4a881a>=_0x452ee0){_0x4a881a=_0x452ee0;_0x7bef51=0xc8;}else{_0x7bef51=0xce;}_0x1371aa['status'](_0x7bef51);return _0x1371aa['set'](_0xd184('0x1c'),_0x479c85+'-'+_0x4a881a+'/'+_0x452ee0)['json'](_0xea4b51);}return null;};}function patchUpdates(_0x3b803e){return function(_0x112b98){try{jsonpatch['apply'](_0x112b98,_0x3b803e,!![]);}catch(_0x17a249){return BPromise[_0xd184('0x1d')](_0x17a249);}return _0x112b98[_0xd184('0x1e')]();};}function saveUpdates(_0x246a46,_0x3714a2){return function(_0x2ef179){if(_0x2ef179){return _0x2ef179[_0xd184('0x1f')](_0x246a46)['then'](function(_0x23fc57){return _0x23fc57;});}return null;};}function removeEntity(_0x30b44a,_0xbc2a03){return function(_0x4f428b){if(_0x4f428b){return _0x4f428b['destroy']()[_0xd184('0x20')](function(){_0x30b44a[_0xd184('0x18')](0xcc)[_0xd184('0x19')]();});}};}function handleEntityNotFound(_0x4016c8,_0x5bd8cf){return function(_0x100a3a){if(!_0x100a3a){_0x4016c8[_0xd184('0x17')](0x194);}return _0x100a3a;};}function handleError(_0x451bda,_0x1cad54){_0x1cad54=_0x1cad54||0x1f4;return function(_0x50cb3c){logger['error'](_0x50cb3c['stack']);if(_0x50cb3c[_0xd184('0x21')]){delete _0x50cb3c['name'];}_0x451bda[_0xd184('0x18')](_0x1cad54)['send'](_0x50cb3c);};}exports[_0xd184('0x22')]=function(_0x154928,_0xdcd97){var _0x29de3e={},_0x3c3d9a={},_0xd6e2e5={'count':0x0,'rows':[]};var _0x253a60=_[_0xd184('0x23')](db[_0xd184('0x24')][_0xd184('0x25')],function(_0x4f7f6a){return{'name':_0x4f7f6a[_0xd184('0x26')],'type':_0x4f7f6a[_0xd184('0x27')]['key']};});_0x3c3d9a['model']=_[_0xd184('0x23')](_0x253a60,_0xd184('0x21'));_0x3c3d9a[_0xd184('0x28')]=_[_0xd184('0x29')](_0x154928[_0xd184('0x28')]);_0x3c3d9a['filters']=_[_0xd184('0x2a')](_0x3c3d9a[_0xd184('0x2b')],_0x3c3d9a[_0xd184('0x28')]);_0x29de3e[_0xd184('0x2c')]=_[_0xd184('0x2a')](_0x3c3d9a[_0xd184('0x2b')],qs[_0xd184('0x2d')](_0x154928[_0xd184('0x28')][_0xd184('0x2d')]));_0x29de3e[_0xd184('0x2c')]=_0x29de3e[_0xd184('0x2c')]['length']?_0x29de3e[_0xd184('0x2c')]:_0x3c3d9a['model'];if(!_0x154928[_0xd184('0x28')]['hasOwnProperty']('nolimit')){_0x29de3e[_0xd184('0x2e')]=qs['limit'](_0x154928[_0xd184('0x28')][_0xd184('0x2e')]);_0x29de3e['offset']=qs[_0xd184('0x1b')](_0x154928[_0xd184('0x28')][_0xd184('0x1b')]);}_0x29de3e['order']=qs['sort'](_0x154928['query']['sort']);_0x29de3e[_0xd184('0x2f')]=qs[_0xd184('0x30')](_[_0xd184('0x31')](_0x154928[_0xd184('0x28')],_0x3c3d9a[_0xd184('0x30')]),_0x253a60);if(_0x154928[_0xd184('0x28')]['filter']){_0x29de3e[_0xd184('0x2f')]=_[_0xd184('0x32')](_0x29de3e[_0xd184('0x2f')],{'$or':_[_0xd184('0x23')](_0x253a60,function(_0x401112){if(_0x401112['type']!==_0xd184('0x33')){var _0x29de26={};_0x29de26[_0x401112[_0xd184('0x21')]]={'$like':'%'+_0x154928[_0xd184('0x28')][_0xd184('0x34')]+'%'};return _0x29de26;}})});}_0x29de3e=_['merge']({},_0x29de3e,_0x154928[_0xd184('0x35')]);var _0x2fda97={'where':_0x29de3e[_0xd184('0x2f')]};return db['AnalyticTreeReport'][_0xd184('0x1a')](_0x2fda97)[_0xd184('0x20')](function(_0x2ed4cc){_0xd6e2e5[_0xd184('0x1a')]=_0x2ed4cc;if(_0x154928['query'][_0xd184('0x36')]){_0x29de3e[_0xd184('0x37')]=[{'all':!![]}];}return db[_0xd184('0x24')][_0xd184('0x38')](_0x29de3e);})['then'](function(_0x8cf2d1){_0xd6e2e5[_0xd184('0x39')]=_0x8cf2d1;return _0xd6e2e5;})[_0xd184('0x20')](respondWithFilteredResult(_0xdcd97,_0x29de3e))['catch'](handleError(_0xdcd97,null));};exports[_0xd184('0x3a')]=function(_0x3ba883,_0xa7d440){var _0x4612e5={'raw':!![],'where':{'id':_0x3ba883[_0xd184('0x3b')]['id']}},_0x364cb1={};_0x364cb1['model']=_['keys'](db[_0xd184('0x24')][_0xd184('0x25')]);_0x364cb1[_0xd184('0x28')]=_[_0xd184('0x29')](_0x3ba883['query']);_0x364cb1['filters']=_[_0xd184('0x2a')](_0x364cb1[_0xd184('0x2b')],_0x364cb1[_0xd184('0x28')]);_0x4612e5[_0xd184('0x2c')]=_[_0xd184('0x2a')](_0x364cb1[_0xd184('0x2b')],qs['fields'](_0x3ba883[_0xd184('0x28')]['fields']));_0x4612e5[_0xd184('0x2c')]=_0x4612e5[_0xd184('0x2c')][_0xd184('0x3c')]?_0x4612e5['attributes']:_0x364cb1['model'];if(_0x3ba883[_0xd184('0x28')][_0xd184('0x36')]){_0x4612e5[_0xd184('0x37')]=[{'all':!![]}];}_0x4612e5=_[_0xd184('0x32')]({},_0x4612e5,_0x3ba883[_0xd184('0x35')]);return db[_0xd184('0x24')]['find'](_0x4612e5)['then'](handleEntityNotFound(_0xa7d440,null))[_0xd184('0x20')](respondWithResult(_0xa7d440,null))[_0xd184('0x3d')](handleError(_0xa7d440,null));};exports[_0xd184('0x3e')]=function(_0x32adf2,_0x7b74c9){return db[_0xd184('0x24')][_0xd184('0x3e')](_0x32adf2['body'],{})[_0xd184('0x20')](respondWithResult(_0x7b74c9,0xc9))[_0xd184('0x3d')](handleError(_0x7b74c9,null));};exports[_0xd184('0x1f')]=function(_0xa8645a,_0x26ba71){if(_0xa8645a[_0xd184('0x3f')]['id']){delete _0xa8645a[_0xd184('0x3f')]['id'];}return db['AnalyticTreeReport'][_0xd184('0x40')]({'where':{'id':_0xa8645a[_0xd184('0x3b')]['id']}})['then'](handleEntityNotFound(_0x26ba71,null))['then'](saveUpdates(_0xa8645a[_0xd184('0x3f')],null))[_0xd184('0x20')](respondWithResult(_0x26ba71,null))['catch'](handleError(_0x26ba71,null));};exports['destroy']=function(_0x164ad6,_0x3253e4){return db['AnalyticTreeReport']['find']({'where':{'id':_0x164ad6[_0xd184('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3253e4,null))['then'](removeEntity(_0x3253e4,null))[_0xd184('0x3d')](handleError(_0x3253e4,null));}; \ No newline at end of file +var _0x2f32=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','offset','sort','where','filters','pick','filter','merge','options','AnalyticTreeReport','count','includeAll','include','rows','catch','show','params','find','body','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','set','Content-Range','json','apply','reject','save','then','destroy','end','error'];(function(_0x5a41b8,_0xfb31e9){var _0x37069f=function(_0xdff7a3){while(--_0xdff7a3){_0x5a41b8['push'](_0x5a41b8['shift']());}};_0x37069f(++_0xfb31e9);}(_0x2f32,0xb3));var _0x22f3=function(_0x5769c5,_0x21b824){_0x5769c5=_0x5769c5-0x0;var _0x5e926f=_0x2f32[_0x5769c5];return _0x5e926f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x22f3('0x0'));var zipdir=require(_0x22f3('0x1'));var jsonpatch=require(_0x22f3('0x2'));var rp=require('request-promise');var moment=require(_0x22f3('0x3'));var BPromise=require(_0x22f3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x22f3('0x5'));var sox=require(_0x22f3('0x6'));var csv=require('to-csv');var ejs=require(_0x22f3('0x7'));var fs=require('fs');var _=require(_0x22f3('0x8'));var squel=require(_0x22f3('0x9'));var crypto=require(_0x22f3('0xa'));var jsforce=require(_0x22f3('0xb'));var deskjs=require(_0x22f3('0xc'));var toCsv=require(_0x22f3('0xd'));var querystring=require(_0x22f3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x22f3('0xf'));var as=require(_0x22f3('0x10'));var hardwareService=require(_0x22f3('0x11'));var logger=require('../../config/logger')(_0x22f3('0x12'));var utils=require(_0x22f3('0x13'));var config=require(_0x22f3('0x14'));var db=require(_0x22f3('0x15'))['db'];function respondWithStatusCode(_0xaae736,_0xe1cf8f){_0xe1cf8f=_0xe1cf8f||0xcc;return function(_0x2da013){if(_0x2da013){return _0xaae736[_0x22f3('0x16')](_0xe1cf8f);}return _0xaae736['status'](_0xe1cf8f)['end']();};}function respondWithResult(_0x3dc5cb,_0x37d53e){_0x37d53e=_0x37d53e||0xc8;return function(_0x18fb7d){if(_0x18fb7d){return _0x3dc5cb[_0x22f3('0x17')](_0x37d53e)['json'](_0x18fb7d);}};}function respondWithFilteredResult(_0x2d3044,_0x388f12){return function(_0x15a762){if(_0x15a762){var _0x41bcaf=_0x15a762['count'],_0x4d3469=_0x388f12['offset'],_0x3e28af=_0x388f12['offset']+_0x388f12['limit'],_0x1ba550;if(_0x3e28af>=_0x41bcaf){_0x3e28af=_0x41bcaf;_0x1ba550=0xc8;}else{_0x1ba550=0xce;}_0x2d3044['status'](_0x1ba550);return _0x2d3044[_0x22f3('0x18')](_0x22f3('0x19'),_0x4d3469+'-'+_0x3e28af+'/'+_0x41bcaf)[_0x22f3('0x1a')](_0x15a762);}return null;};}function patchUpdates(_0x16f9e0){return function(_0x22c3b7){try{jsonpatch[_0x22f3('0x1b')](_0x22c3b7,_0x16f9e0,!![]);}catch(_0x29988d){return BPromise[_0x22f3('0x1c')](_0x29988d);}return _0x22c3b7[_0x22f3('0x1d')]();};}function saveUpdates(_0x370744,_0x53998f){return function(_0x555dd3){if(_0x555dd3){return _0x555dd3['update'](_0x370744)[_0x22f3('0x1e')](function(_0x1cfc2d){return _0x1cfc2d;});}return null;};}function removeEntity(_0x5ea9b6,_0x4ec616){return function(_0x5b3b57){if(_0x5b3b57){return _0x5b3b57[_0x22f3('0x1f')]()[_0x22f3('0x1e')](function(){_0x5ea9b6[_0x22f3('0x17')](0xcc)[_0x22f3('0x20')]();});}};}function handleEntityNotFound(_0x169202,_0x5ee038){return function(_0x226b4c){if(!_0x226b4c){_0x169202[_0x22f3('0x16')](0x194);}return _0x226b4c;};}function handleError(_0x2d00e0,_0x442819){_0x442819=_0x442819||0x1f4;return function(_0xfad8c3){logger[_0x22f3('0x21')](_0xfad8c3[_0x22f3('0x22')]);if(_0xfad8c3['name']){delete _0xfad8c3[_0x22f3('0x23')];}_0x2d00e0['status'](_0x442819)[_0x22f3('0x24')](_0xfad8c3);};}exports[_0x22f3('0x25')]=function(_0x2bfc54,_0x3470d8){var _0x49aad0={},_0x252ad9={},_0x115348={'count':0x0,'rows':[]};var _0x4890e3=_[_0x22f3('0x26')](db['AnalyticTreeReport'][_0x22f3('0x27')],function(_0x397587){return{'name':_0x397587[_0x22f3('0x28')],'type':_0x397587[_0x22f3('0x29')][_0x22f3('0x2a')]};});_0x252ad9[_0x22f3('0x2b')]=_[_0x22f3('0x26')](_0x4890e3,'name');_0x252ad9[_0x22f3('0x2c')]=_[_0x22f3('0x2d')](_0x2bfc54[_0x22f3('0x2c')]);_0x252ad9['filters']=_[_0x22f3('0x2e')](_0x252ad9[_0x22f3('0x2b')],_0x252ad9[_0x22f3('0x2c')]);_0x49aad0[_0x22f3('0x2f')]=_['intersection'](_0x252ad9[_0x22f3('0x2b')],qs[_0x22f3('0x30')](_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x30')]));_0x49aad0[_0x22f3('0x2f')]=_0x49aad0[_0x22f3('0x2f')][_0x22f3('0x31')]?_0x49aad0['attributes']:_0x252ad9[_0x22f3('0x2b')];if(!_0x2bfc54[_0x22f3('0x2c')]['hasOwnProperty'](_0x22f3('0x32'))){_0x49aad0[_0x22f3('0x33')]=qs['limit'](_0x2bfc54['query'][_0x22f3('0x33')]);_0x49aad0['offset']=qs['offset'](_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x34')]);}_0x49aad0['order']=qs[_0x22f3('0x35')](_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x35')]);_0x49aad0[_0x22f3('0x36')]=qs[_0x22f3('0x37')](_[_0x22f3('0x38')](_0x2bfc54[_0x22f3('0x2c')],_0x252ad9[_0x22f3('0x37')]),_0x4890e3);if(_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x39')]){_0x49aad0[_0x22f3('0x36')]=_[_0x22f3('0x3a')](_0x49aad0[_0x22f3('0x36')],{'$or':_[_0x22f3('0x26')](_0x4890e3,function(_0xc086bb){if(_0xc086bb[_0x22f3('0x29')]!=='VIRTUAL'){var _0x42c68b={};_0x42c68b[_0xc086bb[_0x22f3('0x23')]]={'$like':'%'+_0x2bfc54['query'][_0x22f3('0x39')]+'%'};return _0x42c68b;}})});}_0x49aad0=_[_0x22f3('0x3a')]({},_0x49aad0,_0x2bfc54[_0x22f3('0x3b')]);var _0x1b3e60={'where':_0x49aad0['where']};return db[_0x22f3('0x3c')][_0x22f3('0x3d')](_0x1b3e60)[_0x22f3('0x1e')](function(_0x4bd7b8){_0x115348[_0x22f3('0x3d')]=_0x4bd7b8;if(_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x3e')]){_0x49aad0[_0x22f3('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x49aad0);})[_0x22f3('0x1e')](function(_0x57ba9d){_0x115348[_0x22f3('0x40')]=_0x57ba9d;return _0x115348;})[_0x22f3('0x1e')](respondWithFilteredResult(_0x3470d8,_0x49aad0))[_0x22f3('0x41')](handleError(_0x3470d8,null));};exports[_0x22f3('0x42')]=function(_0x567a54,_0xe3627b){var _0x472898={'raw':!![],'where':{'id':_0x567a54[_0x22f3('0x43')]['id']}},_0x5016d2={};_0x5016d2['model']=_[_0x22f3('0x2d')](db[_0x22f3('0x3c')][_0x22f3('0x27')]);_0x5016d2[_0x22f3('0x2c')]=_['keys'](_0x567a54[_0x22f3('0x2c')]);_0x5016d2[_0x22f3('0x37')]=_[_0x22f3('0x2e')](_0x5016d2['model'],_0x5016d2[_0x22f3('0x2c')]);_0x472898[_0x22f3('0x2f')]=_[_0x22f3('0x2e')](_0x5016d2[_0x22f3('0x2b')],qs[_0x22f3('0x30')](_0x567a54[_0x22f3('0x2c')][_0x22f3('0x30')]));_0x472898[_0x22f3('0x2f')]=_0x472898[_0x22f3('0x2f')][_0x22f3('0x31')]?_0x472898[_0x22f3('0x2f')]:_0x5016d2[_0x22f3('0x2b')];if(_0x567a54['query']['includeAll']){_0x472898[_0x22f3('0x3f')]=[{'all':!![]}];}_0x472898=_[_0x22f3('0x3a')]({},_0x472898,_0x567a54[_0x22f3('0x3b')]);return db[_0x22f3('0x3c')][_0x22f3('0x44')](_0x472898)[_0x22f3('0x1e')](handleEntityNotFound(_0xe3627b,null))['then'](respondWithResult(_0xe3627b,null))[_0x22f3('0x41')](handleError(_0xe3627b,null));};exports['create']=function(_0x5ed9b8,_0xa74089){return db[_0x22f3('0x3c')]['create'](_0x5ed9b8[_0x22f3('0x45')],{})['then'](respondWithResult(_0xa74089,0xc9))[_0x22f3('0x41')](handleError(_0xa74089,null));};exports[_0x22f3('0x46')]=function(_0x5ba6a7,_0x45c26d){if(_0x5ba6a7[_0x22f3('0x45')]['id']){delete _0x5ba6a7[_0x22f3('0x45')]['id'];}return db[_0x22f3('0x3c')][_0x22f3('0x44')]({'where':{'id':_0x5ba6a7[_0x22f3('0x43')]['id']}})[_0x22f3('0x1e')](handleEntityNotFound(_0x45c26d,null))[_0x22f3('0x1e')](saveUpdates(_0x5ba6a7[_0x22f3('0x45')],null))['then'](respondWithResult(_0x45c26d,null))[_0x22f3('0x41')](handleError(_0x45c26d,null));};exports[_0x22f3('0x1f')]=function(_0x20ce38,_0x46235f){return db[_0x22f3('0x3c')][_0x22f3('0x44')]({'where':{'id':_0x20ce38[_0x22f3('0x43')]['id']}})[_0x22f3('0x1e')](handleEntityNotFound(_0x46235f,null))[_0x22f3('0x1e')](removeEntity(_0x46235f,null))[_0x22f3('0x41')](handleError(_0x46235f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a4a10cb..746b70b 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 _0xc675=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_trees'];(function(_0x8d25be,_0x5ad363){var _0x3fcb44=function(_0x5ef82b){while(--_0x5ef82b){_0x8d25be['push'](_0x8d25be['shift']());}};_0x3fcb44(++_0x5ad363);}(_0xc675,0x1c8));var _0x5c67=function(_0x59c0c6,_0xb3446c){_0x59c0c6=_0x59c0c6-0x0;var _0x25c8dc=_0xc675[_0x59c0c6];return _0x25c8dc;};'use strict';var _=require('lodash');var util=require(_0x5c67('0x0'));var logger=require(_0x5c67('0x1'))(_0x5c67('0x2'));var moment=require(_0x5c67('0x3'));var BPromise=require(_0x5c67('0x4'));var rp=require(_0x5c67('0x5'));var fs=require('fs');var path=require(_0x5c67('0x6'));var rimraf=require(_0x5c67('0x7'));var config=require(_0x5c67('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0x5c67('0x9')]=function(_0x365ca1,_0x14b754){return _0x365ca1[_0x5c67('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x5c67('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67ba=['util','../../config/logger','api','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash'];(function(_0x5cc11b,_0x2ada19){var _0x447b46=function(_0x1c7408){while(--_0x1c7408){_0x5cc11b['push'](_0x5cc11b['shift']());}};_0x447b46(++_0x2ada19);}(_0x67ba,0xba));var _0xa67b=function(_0x451ee5,_0x1376a6){_0x451ee5=_0x451ee5-0x0;var _0x2a9b42=_0x67ba[_0x451ee5];return _0x2a9b42;};'use strict';var _=require(_0xa67b('0x0'));var util=require(_0xa67b('0x1'));var logger=require(_0xa67b('0x2'))(_0xa67b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa67b('0x4'));var fs=require('fs');var path=require(_0xa67b('0x5'));var rimraf=require(_0xa67b('0x6'));var config=require('../../config/environment');var attributes=require(_0xa67b('0x7'));module[_0xa67b('0x8')]=function(_0x10d0c5,_0x2eae36){return _0x10d0c5[_0xa67b('0x9')](_0xa67b('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 640563a..6e932a7 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 _0xa45a=['then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0xa45a,0x9b));var _0xaa45=function(_0x886621,_0x1eab8d){_0x886621=_0x886621-0x0;var _0x233ce4=_0xa45a[_0x886621];return _0x233ce4;};'use strict';var _=require(_0xaa45('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaa45('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa45('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa45('0x3'))('rpc');var config=require(_0xaa45('0x4'));var jayson=require(_0xaa45('0x5'));var client=jayson['client'][_0xaa45('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49bc2b,_0x2dd09c,_0xac5a0d){return new BPromise(function(_0x24db5d,_0x510625){return client['request'](_0x49bc2b,_0xac5a0d)[_0xaa45('0x7')](function(_0xa9e8b0){logger['info'](_0xaa45('0x8'),_0x2dd09c,_0xaa45('0x9'));logger[_0xaa45('0xa')](_0xaa45('0xb'),_0x2dd09c,_0xaa45('0x9'),JSON[_0xaa45('0xc')](_0xa9e8b0));if(_0xa9e8b0[_0xaa45('0xd')]){if(_0xa9e8b0['error'][_0xaa45('0xe')]===0x1f4){logger[_0xaa45('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2dd09c,_0xa9e8b0[_0xaa45('0xd')][_0xaa45('0xf')]);return _0x510625(_0xa9e8b0[_0xaa45('0xd')][_0xaa45('0xf')]);}logger[_0xaa45('0xd')](_0xaa45('0x8'),_0x2dd09c,_0xa9e8b0['error'][_0xaa45('0xf')]);return _0x24db5d(_0xa9e8b0[_0xaa45('0xd')][_0xaa45('0xf')]);}else{logger['info'](_0xaa45('0x8'),_0x2dd09c,_0xaa45('0x9'));_0x24db5d(_0xa9e8b0[_0xaa45('0x10')]['message']);}})[_0xaa45('0x11')](function(_0x5f015c){logger['error'](_0xaa45('0x8'),_0x2dd09c,_0x5f015c);_0x510625(_0x5f015c);});});} \ No newline at end of file +var _0x4560=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x33c0e0,_0x2f7dd2){var _0x1ef863=function(_0x464808){while(--_0x464808){_0x33c0e0['push'](_0x33c0e0['shift']());}};_0x1ef863(++_0x2f7dd2);}(_0x4560,0xa9));var _0x0456=function(_0x57c357,_0x598547){_0x57c357=_0x57c357-0x0;var _0x459831=_0x4560[_0x57c357];return _0x459831;};'use strict';var _=require(_0x0456('0x0'));var util=require(_0x0456('0x1'));var moment=require(_0x0456('0x2'));var BPromise=require(_0x0456('0x3'));var rs=require(_0x0456('0x4'));var fs=require('fs');var Redis=require(_0x0456('0x5'));var db=require(_0x0456('0x6'))['db'];var utils=require(_0x0456('0x7'));var logger=require(_0x0456('0x8'))(_0x0456('0x9'));var config=require(_0x0456('0xa'));var jayson=require(_0x0456('0xb'));var client=jayson[_0x0456('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41ce02,_0x490731,_0x36d744){return new BPromise(function(_0x31106d,_0x5b7e30){return client[_0x0456('0xd')](_0x41ce02,_0x36d744)[_0x0456('0xe')](function(_0x27e66d){logger['info'](_0x0456('0xf'),_0x490731,'request\x20sent');logger[_0x0456('0x10')](_0x0456('0x11'),_0x490731,_0x0456('0x12'),JSON[_0x0456('0x13')](_0x27e66d));if(_0x27e66d[_0x0456('0x14')]){if(_0x27e66d[_0x0456('0x14')]['code']===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x490731,_0x27e66d[_0x0456('0x14')][_0x0456('0x15')]);return _0x5b7e30(_0x27e66d[_0x0456('0x14')][_0x0456('0x15')]);}logger[_0x0456('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x490731,_0x27e66d[_0x0456('0x14')]['message']);return _0x31106d(_0x27e66d[_0x0456('0x14')]['message']);}else{logger[_0x0456('0x16')](_0x0456('0xf'),_0x490731,_0x0456('0x12'));_0x31106d(_0x27e66d[_0x0456('0x17')][_0x0456('0x15')]);}})['catch'](function(_0x5cb81d){logger[_0x0456('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x490731,_0x5cb81d);_0x5b7e30(_0x5cb81d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f257dae..232ed4a 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 _0x1503=['isAuthenticated','index','get','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x1503,0x127));var _0x3150=function(_0x2a27e4,_0x56917a){_0x2a27e4=_0x2a27e4-0x0;var _0x4de982=_0x1503[_0x2a27e4];return _0x4de982;};'use strict';var multer=require(_0x3150('0x0'));var util=require(_0x3150('0x1'));var path=require(_0x3150('0x2'));var timeout=require(_0x3150('0x3'));var express=require(_0x3150('0x4'));var router=express[_0x3150('0x5')]();var auth=require(_0x3150('0x6'));var interaction=require(_0x3150('0x7'));var config=require(_0x3150('0x8'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x3150('0x9')](),controller[_0x3150('0xa')]);router[_0x3150('0xb')]('/:id',auth[_0x3150('0x9')](),controller[_0x3150('0xc')]);router[_0x3150('0xd')]('/',auth[_0x3150('0x9')](),controller[_0x3150('0xe')]);router['put'](_0x3150('0xf'),auth[_0x3150('0x9')](),controller['update']);router[_0x3150('0x10')](_0x3150('0xf'),auth['isAuthenticated'](),controller[_0x3150('0x11')]);module[_0x3150('0x12')]=router; \ No newline at end of file +var _0x7c23=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x7c23,0x14c));var _0x37c2=function(_0xddb2d1,_0x31824b){_0xddb2d1=_0xddb2d1-0x0;var _0x1e26d0=_0x7c23[_0xddb2d1];return _0x1e26d0;};'use strict';var multer=require(_0x37c2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x37c2('0x1'));var express=require(_0x37c2('0x2'));var router=express[_0x37c2('0x3')]();var auth=require(_0x37c2('0x4'));var interaction=require(_0x37c2('0x5'));var config=require(_0x37c2('0x6'));var controller=require(_0x37c2('0x7'));router[_0x37c2('0x8')]('/',auth['isAuthenticated'](),controller[_0x37c2('0x9')]);router[_0x37c2('0x8')](_0x37c2('0xa'),auth[_0x37c2('0xb')](),controller[_0x37c2('0xc')]);router['post']('/',auth[_0x37c2('0xb')](),controller[_0x37c2('0xd')]);router[_0x37c2('0xe')](_0x37c2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x37c2('0xf')](_0x37c2('0xa'),auth[_0x37c2('0xb')](),controller[_0x37c2('0x10')]);module[_0x37c2('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8ea75f4..41434e5 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 _0xc0b7=['exports','STRING','sequelize'];(function(_0x414baf,_0x58e1d0){var _0x3a959b=function(_0x1b06d0){while(--_0x1b06d0){_0x414baf['push'](_0x414baf['shift']());}};_0x3a959b(++_0x58e1d0);}(_0xc0b7,0x1f4));var _0x7c0b=function(_0xb90a9a,_0x3a76fe){_0xb90a9a=_0xb90a9a-0x0;var _0x503084=_0xc0b7[_0xb90a9a];return _0x503084;};'use strict';var Sequelize=require(_0x7c0b('0x0'));module[_0x7c0b('0x1')]={'name':{'type':Sequelize[_0x7c0b('0x2')]},'basename':{'type':Sequelize[_0x7c0b('0x2')]},'type':{'type':Sequelize[_0x7c0b('0x2')]}}; \ No newline at end of file +var _0x6aad=['sequelize','exports','STRING'];(function(_0x3a1ce7,_0x267399){var _0x5311ed=function(_0x270277){while(--_0x270277){_0x3a1ce7['push'](_0x3a1ce7['shift']());}};_0x5311ed(++_0x267399);}(_0x6aad,0xfc));var _0xd6aa=function(_0x2c5777,_0x484619){_0x2c5777=_0x2c5777-0x0;var _0x579244=_0x6aad[_0x2c5777];return _0x579244;};'use strict';var Sequelize=require(_0xd6aa('0x0'));module[_0xd6aa('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd6aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 17c635a..7796338 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 _0x0d7a=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','Attachment','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','rawAttributes','include','find','clone','get','omit','createdAt','updatedAt','body','file','originalname','basename','filename','create','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','Content-Range','apply'];(function(_0x4a48d8,_0x576db6){var _0x1dabb0=function(_0xe8382b){while(--_0xe8382b){_0x4a48d8['push'](_0x4a48d8['shift']());}};_0x1dabb0(++_0x576db6);}(_0x0d7a,0x18d));var _0xa0d7=function(_0x1243ea,_0x55ee56){_0x1243ea=_0x1243ea-0x0;var _0x348358=_0x0d7a[_0x1243ea];return _0x348358;};'use strict';var pdf=require(_0xa0d7('0x0'));var emlformat=require(_0xa0d7('0x1'));var rimraf=require(_0xa0d7('0x2'));var zipdir=require(_0xa0d7('0x3'));var jsonpatch=require(_0xa0d7('0x4'));var rp=require(_0xa0d7('0x5'));var moment=require(_0xa0d7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa0d7('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa0d7('0x8'));var csv=require(_0xa0d7('0x9'));var ejs=require(_0xa0d7('0xa'));var fs=require('fs');var _=require(_0xa0d7('0xb'));var squel=require('squel');var crypto=require(_0xa0d7('0xc'));var jsforce=require(_0xa0d7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa0d7('0x9'));var querystring=require(_0xa0d7('0xe'));var Papa=require('papaparse');var Redis=require(_0xa0d7('0xf'));var authService=require(_0xa0d7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa0d7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0d7('0x12'))('api');var utils=require(_0xa0d7('0x13'));var config=require(_0xa0d7('0x14'));var db=require(_0xa0d7('0x15'))['db'];function respondWithStatusCode(_0x457b2a,_0x8dd6ed){_0x8dd6ed=_0x8dd6ed||0xcc;return function(_0x45d337){if(_0x45d337){return _0x457b2a['sendStatus'](_0x8dd6ed);}return _0x457b2a[_0xa0d7('0x16')](_0x8dd6ed)['end']();};}function respondWithResult(_0x3b08ad,_0x2e4b39){_0x2e4b39=_0x2e4b39||0xc8;return function(_0x31b6d){if(_0x31b6d){return _0x3b08ad[_0xa0d7('0x16')](_0x2e4b39)[_0xa0d7('0x17')](_0x31b6d);}};}function respondWithFilteredResult(_0x335ad4,_0x5ec1a4){return function(_0x553879){if(_0x553879){var _0x52a33d=_0x553879['count'],_0x1fc798=_0x5ec1a4[_0xa0d7('0x18')],_0x4488af=_0x5ec1a4['offset']+_0x5ec1a4[_0xa0d7('0x19')],_0x37f4ed;if(_0x4488af>=_0x52a33d){_0x4488af=_0x52a33d;_0x37f4ed=0xc8;}else{_0x37f4ed=0xce;}_0x335ad4[_0xa0d7('0x16')](_0x37f4ed);return _0x335ad4['set'](_0xa0d7('0x1a'),_0x1fc798+'-'+_0x4488af+'/'+_0x52a33d)[_0xa0d7('0x17')](_0x553879);}return null;};}function patchUpdates(_0x1bc68a){return function(_0x504027){try{jsonpatch[_0xa0d7('0x1b')](_0x504027,_0x1bc68a,!![]);}catch(_0x252a91){return BPromise[_0xa0d7('0x1c')](_0x252a91);}return _0x504027[_0xa0d7('0x1d')]();};}function saveUpdates(_0x1ddeed,_0x3fb09a){return function(_0xacaf78){if(_0xacaf78){return _0xacaf78[_0xa0d7('0x1e')](_0x1ddeed)[_0xa0d7('0x1f')](function(_0xa6da8d){return _0xa6da8d;});}return null;};}function removeEntity(_0x5807db,_0x266454){return function(_0x422872){if(_0x422872){return _0x422872[_0xa0d7('0x20')]()[_0xa0d7('0x1f')](function(){_0x5807db[_0xa0d7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313a31,_0xf3b9ba){return function(_0x2bc08a){if(!_0x2bc08a){_0x313a31[_0xa0d7('0x21')](0x194);}return _0x2bc08a;};}function handleError(_0x285f2c,_0x4ca7d1){_0x4ca7d1=_0x4ca7d1||0x1f4;return function(_0x1dc450){logger[_0xa0d7('0x22')](_0x1dc450[_0xa0d7('0x23')]);if(_0x1dc450[_0xa0d7('0x24')]){delete _0x1dc450[_0xa0d7('0x24')];}_0x285f2c[_0xa0d7('0x16')](_0x4ca7d1)[_0xa0d7('0x25')](_0x1dc450);};}exports['index']=function(_0xcf18fc,_0x2fc611){var _0x2dbd45={},_0x43969f={},_0x212e24={'count':0x0,'rows':[]};var _0x5bb86c=_['map'](db[_0xa0d7('0x26')]['rawAttributes'],function(_0x4cbe23){return{'name':_0x4cbe23[_0xa0d7('0x27')],'type':_0x4cbe23[_0xa0d7('0x28')][_0xa0d7('0x29')]};});_0x43969f[_0xa0d7('0x2a')]=_[_0xa0d7('0x2b')](_0x5bb86c,'name');_0x43969f[_0xa0d7('0x2c')]=_[_0xa0d7('0x2d')](_0xcf18fc['query']);_0x43969f[_0xa0d7('0x2e')]=_[_0xa0d7('0x2f')](_0x43969f[_0xa0d7('0x2a')],_0x43969f['query']);_0x2dbd45[_0xa0d7('0x30')]=_[_0xa0d7('0x2f')](_0x43969f['model'],qs[_0xa0d7('0x31')](_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x31')]));_0x2dbd45[_0xa0d7('0x30')]=_0x2dbd45[_0xa0d7('0x30')][_0xa0d7('0x32')]?_0x2dbd45[_0xa0d7('0x30')]:_0x43969f[_0xa0d7('0x2a')];if(!_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x33')](_0xa0d7('0x34'))){_0x2dbd45[_0xa0d7('0x19')]=qs[_0xa0d7('0x19')](_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x19')]);_0x2dbd45['offset']=qs['offset'](_0xcf18fc[_0xa0d7('0x2c')]['offset']);}_0x2dbd45[_0xa0d7('0x35')]=qs['sort'](_0xcf18fc[_0xa0d7('0x2c')]['sort']);_0x2dbd45[_0xa0d7('0x36')]=qs['filters'](_[_0xa0d7('0x37')](_0xcf18fc['query'],_0x43969f['filters']),_0x5bb86c);if(_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x38')]){_0x2dbd45[_0xa0d7('0x36')]=_[_0xa0d7('0x39')](_0x2dbd45[_0xa0d7('0x36')],{'$or':_[_0xa0d7('0x2b')](_0x5bb86c,function(_0x114e89){if(_0x114e89[_0xa0d7('0x28')]!==_0xa0d7('0x3a')){var _0x4d73fa={};_0x4d73fa[_0x114e89['name']]={'$like':'%'+_0xcf18fc['query'][_0xa0d7('0x38')]+'%'};return _0x4d73fa;}})});}_0x2dbd45=_[_0xa0d7('0x39')]({},_0x2dbd45,_0xcf18fc[_0xa0d7('0x3b')]);var _0x1e2e85={'where':_0x2dbd45[_0xa0d7('0x36')]};return db[_0xa0d7('0x26')][_0xa0d7('0x3c')](_0x1e2e85)[_0xa0d7('0x1f')](function(_0x36ce3e){_0x212e24['count']=_0x36ce3e;if(_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x3d')]){_0x2dbd45['include']=[{'all':!![]}];}return db[_0xa0d7('0x26')][_0xa0d7('0x3e')](_0x2dbd45);})[_0xa0d7('0x1f')](function(_0xf8006e){_0x212e24[_0xa0d7('0x3f')]=_0xf8006e;return _0x212e24;})[_0xa0d7('0x1f')](respondWithFilteredResult(_0x2fc611,_0x2dbd45))[_0xa0d7('0x40')](handleError(_0x2fc611,null));};exports['show']=function(_0x56fd80,_0x9b6e53){var _0x28306c={'raw':!![],'where':{'id':_0x56fd80[_0xa0d7('0x41')]['id']}},_0x417865={};_0x417865[_0xa0d7('0x2a')]=_['keys'](db[_0xa0d7('0x26')][_0xa0d7('0x42')]);_0x417865[_0xa0d7('0x2c')]=_[_0xa0d7('0x2d')](_0x56fd80[_0xa0d7('0x2c')]);_0x417865[_0xa0d7('0x2e')]=_[_0xa0d7('0x2f')](_0x417865[_0xa0d7('0x2a')],_0x417865[_0xa0d7('0x2c')]);_0x28306c[_0xa0d7('0x30')]=_[_0xa0d7('0x2f')](_0x417865[_0xa0d7('0x2a')],qs['fields'](_0x56fd80[_0xa0d7('0x2c')][_0xa0d7('0x31')]));_0x28306c['attributes']=_0x28306c[_0xa0d7('0x30')][_0xa0d7('0x32')]?_0x28306c['attributes']:_0x417865[_0xa0d7('0x2a')];if(_0x56fd80[_0xa0d7('0x2c')][_0xa0d7('0x3d')]){_0x28306c[_0xa0d7('0x43')]=[{'all':!![]}];}_0x28306c=_[_0xa0d7('0x39')]({},_0x28306c,_0x56fd80['options']);return db[_0xa0d7('0x26')][_0xa0d7('0x44')](_0x28306c)['then'](handleEntityNotFound(_0x9b6e53,null))[_0xa0d7('0x1f')](respondWithResult(_0x9b6e53,null))[_0xa0d7('0x40')](handleError(_0x9b6e53,null));};exports[_0xa0d7('0x45')]=function(_0x2310ac,_0x40b34a){var _0x25a8f4={'where':{'id':_0x2310ac['params']['id']}},_0x6c7b2={};_0x6c7b2['model']=_[_0xa0d7('0x2d')](db[_0xa0d7('0x26')]['rawAttributes']);_0x25a8f4['attributes']=_['intersection'](_0x6c7b2[_0xa0d7('0x2a')],qs[_0xa0d7('0x31')](_0x2310ac[_0xa0d7('0x2c')][_0xa0d7('0x31')]));_0x25a8f4['attributes']=_0x25a8f4[_0xa0d7('0x30')][_0xa0d7('0x32')]?_0x25a8f4[_0xa0d7('0x30')]:_0x6c7b2[_0xa0d7('0x2a')];if(_0x2310ac[_0xa0d7('0x2c')][_0xa0d7('0x3d')]){_0x25a8f4['include']=[{'all':!![]}];}_0x25a8f4=_[_0xa0d7('0x39')]({},_0x25a8f4,_0x2310ac[_0xa0d7('0x3b')]);return db['Attachment'][_0xa0d7('0x44')](_0x25a8f4)[_0xa0d7('0x1f')](handleEntityNotFound(_0x40b34a,null))['then'](function(_0x46cd82){if(_0x46cd82){var _0x6497f4=_0x46cd82[_0xa0d7('0x46')]({'plain':!![]});_0x6497f4=qs[_0xa0d7('0x47')](_0x6497f4,['id',_0xa0d7('0x48'),_0xa0d7('0x49')]);_0x2310ac['body']=_[_0xa0d7('0x47')](_0x2310ac[_0xa0d7('0x4a')],['id','createdAt',_0xa0d7('0x49')]);return db['Attachment']['create'](_[_0xa0d7('0x39')](_0x6497f4,_0x2310ac['body']),{'include':_0x2310ac['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xa0d7('0x1f')](respondWithResult(_0x40b34a,0xc9))[_0xa0d7('0x40')](handleError(_0x40b34a,null));};exports[_0xa0d7('0x1e')]=function(_0xbdf6c0,_0x4a5a99){if(_0xbdf6c0['body']['id']){delete _0xbdf6c0[_0xa0d7('0x4a')]['id'];}return db['Attachment'][_0xa0d7('0x44')]({'where':{'id':_0xbdf6c0[_0xa0d7('0x41')]['id']}})[_0xa0d7('0x1f')](handleEntityNotFound(_0x4a5a99,null))['then'](saveUpdates(_0xbdf6c0[_0xa0d7('0x4a')],null))[_0xa0d7('0x1f')](respondWithResult(_0x4a5a99,null))[_0xa0d7('0x40')](handleError(_0x4a5a99,null));};exports['destroy']=function(_0x4857ad,_0x23234d){return db['Attachment']['find']({'where':{'id':_0x4857ad[_0xa0d7('0x41')]['id']}})[_0xa0d7('0x1f')](handleEntityNotFound(_0x23234d,null))[_0xa0d7('0x1f')](removeEntity(_0x23234d,null))[_0xa0d7('0x40')](handleError(_0x23234d,null));};exports['create']=function(_0x31640a,_0x69fe3d,_0x46d744){_0x31640a[_0xa0d7('0x4a')][_0xa0d7('0x24')]=_0x31640a[_0xa0d7('0x4b')][_0xa0d7('0x4c')];_0x31640a['body'][_0xa0d7('0x4d')]=_0x31640a[_0xa0d7('0x4b')][_0xa0d7('0x4e')];_0x31640a['body'][_0xa0d7('0x28')]=_0x31640a[_0xa0d7('0x4b')]['mimetype'];return db[_0xa0d7('0x26')][_0xa0d7('0x4f')](_0x31640a[_0xa0d7('0x4a')])['then'](respondWithResult(_0x69fe3d,0xc9))[_0xa0d7('0x40')](handleError(_0x69fe3d,null));};exports[_0xa0d7('0x50')]=function(_0x2b9c66,_0x52aab1,_0x14a039){return db[_0xa0d7('0x26')][_0xa0d7('0x51')]({'where':{'id':_0x2b9c66[_0xa0d7('0x41')]['id']},'raw':!![]})[_0xa0d7('0x1f')](handleEntityNotFound(_0x52aab1,null))['then'](function(_0x3e744f){if(_0x3e744f){return _0x52aab1[_0xa0d7('0x50')](path[_0xa0d7('0x52')](config[_0xa0d7('0x53')],_0xa0d7('0x54'),_0x3e744f[_0xa0d7('0x4d')]));}})[_0xa0d7('0x40')](handleError(_0x52aab1,null));}; \ No newline at end of file +var _0x5bcd=['zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','then','end','error','stack','send','index','map','Attachment','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','includeAll','include','rows','catch','show','params','keys','find','get','omit','updatedAt','body','createdAt','create','file','originalname','filename','mimetype','download','findOne','join','root','server/files/attachments/','basename','html-pdf','eml-format','rimraf'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x5bcd,0x1ab));var _0xd5bc=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x5bcd[_0x138f59];return _0x3d114d;};'use strict';var pdf=require(_0xd5bc('0x0'));var emlformat=require(_0xd5bc('0x1'));var rimraf=require(_0xd5bc('0x2'));var zipdir=require(_0xd5bc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd5bc('0x4'));var util=require(_0xd5bc('0x5'));var path=require(_0xd5bc('0x6'));var sox=require(_0xd5bc('0x7'));var csv=require(_0xd5bc('0x8'));var ejs=require(_0xd5bc('0x9'));var fs=require('fs');var _=require(_0xd5bc('0xa'));var squel=require('squel');var crypto=require(_0xd5bc('0xb'));var jsforce=require(_0xd5bc('0xc'));var deskjs=require(_0xd5bc('0xd'));var toCsv=require(_0xd5bc('0x8'));var querystring=require(_0xd5bc('0xe'));var Papa=require(_0xd5bc('0xf'));var Redis=require('ioredis');var authService=require(_0xd5bc('0x10'));var qs=require(_0xd5bc('0x11'));var as=require(_0xd5bc('0x12'));var hardwareService=require(_0xd5bc('0x13'));var logger=require(_0xd5bc('0x14'))(_0xd5bc('0x15'));var utils=require(_0xd5bc('0x16'));var config=require(_0xd5bc('0x17'));var db=require(_0xd5bc('0x18'))['db'];function respondWithStatusCode(_0x5dc810,_0x1a5aa7){_0x1a5aa7=_0x1a5aa7||0xcc;return function(_0x397927){if(_0x397927){return _0x5dc810[_0xd5bc('0x19')](_0x1a5aa7);}return _0x5dc810[_0xd5bc('0x1a')](_0x1a5aa7)['end']();};}function respondWithResult(_0x543f3f,_0x252142){_0x252142=_0x252142||0xc8;return function(_0x5ed7c0){if(_0x5ed7c0){return _0x543f3f[_0xd5bc('0x1a')](_0x252142)[_0xd5bc('0x1b')](_0x5ed7c0);}};}function respondWithFilteredResult(_0x1639c1,_0x20d930){return function(_0x36c0e1){if(_0x36c0e1){var _0x490af4=_0x36c0e1[_0xd5bc('0x1c')],_0x232cc8=_0x20d930['offset'],_0x50ff76=_0x20d930[_0xd5bc('0x1d')]+_0x20d930[_0xd5bc('0x1e')],_0x56131e;if(_0x50ff76>=_0x490af4){_0x50ff76=_0x490af4;_0x56131e=0xc8;}else{_0x56131e=0xce;}_0x1639c1[_0xd5bc('0x1a')](_0x56131e);return _0x1639c1[_0xd5bc('0x1f')]('Content-Range',_0x232cc8+'-'+_0x50ff76+'/'+_0x490af4)['json'](_0x36c0e1);}return null;};}function patchUpdates(_0x553d1b){return function(_0x354cbb){try{jsonpatch[_0xd5bc('0x20')](_0x354cbb,_0x553d1b,!![]);}catch(_0x401ad7){return BPromise[_0xd5bc('0x21')](_0x401ad7);}return _0x354cbb['save']();};}function saveUpdates(_0x5c299c,_0x4581d3){return function(_0x43c15f){if(_0x43c15f){return _0x43c15f[_0xd5bc('0x22')](_0x5c299c)['then'](function(_0x4c07d8){return _0x4c07d8;});}return null;};}function removeEntity(_0x2963c3,_0x1765df){return function(_0x2f7272){if(_0x2f7272){return _0x2f7272[_0xd5bc('0x23')]()[_0xd5bc('0x24')](function(){_0x2963c3[_0xd5bc('0x1a')](0xcc)[_0xd5bc('0x25')]();});}};}function handleEntityNotFound(_0x4ce439,_0x42ba17){return function(_0x2d5643){if(!_0x2d5643){_0x4ce439['sendStatus'](0x194);}return _0x2d5643;};}function handleError(_0x1fcd17,_0x1ebfeb){_0x1ebfeb=_0x1ebfeb||0x1f4;return function(_0x4777e4){logger[_0xd5bc('0x26')](_0x4777e4[_0xd5bc('0x27')]);if(_0x4777e4['name']){delete _0x4777e4['name'];}_0x1fcd17[_0xd5bc('0x1a')](_0x1ebfeb)[_0xd5bc('0x28')](_0x4777e4);};}exports[_0xd5bc('0x29')]=function(_0x2af257,_0xf5ea38){var _0x45ec98={},_0x275018={},_0x4c39ef={'count':0x0,'rows':[]};var _0x183137=_[_0xd5bc('0x2a')](db[_0xd5bc('0x2b')][_0xd5bc('0x2c')],function(_0x497c3f){return{'name':_0x497c3f[_0xd5bc('0x2d')],'type':_0x497c3f['type'][_0xd5bc('0x2e')]};});_0x275018[_0xd5bc('0x2f')]=_[_0xd5bc('0x2a')](_0x183137,_0xd5bc('0x30'));_0x275018[_0xd5bc('0x31')]=_['keys'](_0x2af257[_0xd5bc('0x31')]);_0x275018[_0xd5bc('0x32')]=_[_0xd5bc('0x33')](_0x275018['model'],_0x275018[_0xd5bc('0x31')]);_0x45ec98[_0xd5bc('0x34')]=_[_0xd5bc('0x33')](_0x275018[_0xd5bc('0x2f')],qs[_0xd5bc('0x35')](_0x2af257['query'][_0xd5bc('0x35')]));_0x45ec98[_0xd5bc('0x34')]=_0x45ec98[_0xd5bc('0x34')][_0xd5bc('0x36')]?_0x45ec98[_0xd5bc('0x34')]:_0x275018[_0xd5bc('0x2f')];if(!_0x2af257['query']['hasOwnProperty'](_0xd5bc('0x37'))){_0x45ec98[_0xd5bc('0x1e')]=qs[_0xd5bc('0x1e')](_0x2af257[_0xd5bc('0x31')][_0xd5bc('0x1e')]);_0x45ec98['offset']=qs['offset'](_0x2af257[_0xd5bc('0x31')][_0xd5bc('0x1d')]);}_0x45ec98[_0xd5bc('0x38')]=qs[_0xd5bc('0x39')](_0x2af257[_0xd5bc('0x31')][_0xd5bc('0x39')]);_0x45ec98[_0xd5bc('0x3a')]=qs[_0xd5bc('0x32')](_[_0xd5bc('0x3b')](_0x2af257[_0xd5bc('0x31')],_0x275018[_0xd5bc('0x32')]),_0x183137);if(_0x2af257[_0xd5bc('0x31')]['filter']){_0x45ec98[_0xd5bc('0x3a')]=_[_0xd5bc('0x3c')](_0x45ec98[_0xd5bc('0x3a')],{'$or':_[_0xd5bc('0x2a')](_0x183137,function(_0x21f2f){if(_0x21f2f['type']!=='VIRTUAL'){var _0x4052a5={};_0x4052a5[_0x21f2f[_0xd5bc('0x30')]]={'$like':'%'+_0x2af257[_0xd5bc('0x31')]['filter']+'%'};return _0x4052a5;}})});}_0x45ec98=_[_0xd5bc('0x3c')]({},_0x45ec98,_0x2af257[_0xd5bc('0x3d')]);var _0x3d1f64={'where':_0x45ec98[_0xd5bc('0x3a')]};return db[_0xd5bc('0x2b')][_0xd5bc('0x1c')](_0x3d1f64)['then'](function(_0x439a2e){_0x4c39ef[_0xd5bc('0x1c')]=_0x439a2e;if(_0x2af257[_0xd5bc('0x31')][_0xd5bc('0x3e')]){_0x45ec98[_0xd5bc('0x3f')]=[{'all':!![]}];}return db[_0xd5bc('0x2b')]['findAll'](_0x45ec98);})[_0xd5bc('0x24')](function(_0x88e385){_0x4c39ef[_0xd5bc('0x40')]=_0x88e385;return _0x4c39ef;})['then'](respondWithFilteredResult(_0xf5ea38,_0x45ec98))[_0xd5bc('0x41')](handleError(_0xf5ea38,null));};exports[_0xd5bc('0x42')]=function(_0x1f9bb8,_0x2dfc7e){var _0x46a6b5={'raw':!![],'where':{'id':_0x1f9bb8[_0xd5bc('0x43')]['id']}},_0x538fb1={};_0x538fb1['model']=_['keys'](db['Attachment'][_0xd5bc('0x2c')]);_0x538fb1[_0xd5bc('0x31')]=_[_0xd5bc('0x44')](_0x1f9bb8['query']);_0x538fb1[_0xd5bc('0x32')]=_['intersection'](_0x538fb1[_0xd5bc('0x2f')],_0x538fb1['query']);_0x46a6b5[_0xd5bc('0x34')]=_['intersection'](_0x538fb1[_0xd5bc('0x2f')],qs[_0xd5bc('0x35')](_0x1f9bb8[_0xd5bc('0x31')][_0xd5bc('0x35')]));_0x46a6b5['attributes']=_0x46a6b5[_0xd5bc('0x34')][_0xd5bc('0x36')]?_0x46a6b5[_0xd5bc('0x34')]:_0x538fb1['model'];if(_0x1f9bb8[_0xd5bc('0x31')]['includeAll']){_0x46a6b5[_0xd5bc('0x3f')]=[{'all':!![]}];}_0x46a6b5=_[_0xd5bc('0x3c')]({},_0x46a6b5,_0x1f9bb8[_0xd5bc('0x3d')]);return db[_0xd5bc('0x2b')][_0xd5bc('0x45')](_0x46a6b5)[_0xd5bc('0x24')](handleEntityNotFound(_0x2dfc7e,null))['then'](respondWithResult(_0x2dfc7e,null))[_0xd5bc('0x41')](handleError(_0x2dfc7e,null));};exports['clone']=function(_0x3e9ac5,_0x2547cb){var _0x1ea48d={'where':{'id':_0x3e9ac5[_0xd5bc('0x43')]['id']}},_0x3b3374={};_0x3b3374['model']=_['keys'](db[_0xd5bc('0x2b')]['rawAttributes']);_0x1ea48d[_0xd5bc('0x34')]=_[_0xd5bc('0x33')](_0x3b3374['model'],qs[_0xd5bc('0x35')](_0x3e9ac5['query']['fields']));_0x1ea48d['attributes']=_0x1ea48d[_0xd5bc('0x34')][_0xd5bc('0x36')]?_0x1ea48d[_0xd5bc('0x34')]:_0x3b3374[_0xd5bc('0x2f')];if(_0x3e9ac5[_0xd5bc('0x31')]['includeAll']){_0x1ea48d['include']=[{'all':!![]}];}_0x1ea48d=_['merge']({},_0x1ea48d,_0x3e9ac5[_0xd5bc('0x3d')]);return db[_0xd5bc('0x2b')][_0xd5bc('0x45')](_0x1ea48d)[_0xd5bc('0x24')](handleEntityNotFound(_0x2547cb,null))[_0xd5bc('0x24')](function(_0x328411){if(_0x328411){var _0x536537=_0x328411[_0xd5bc('0x46')]({'plain':!![]});_0x536537=qs[_0xd5bc('0x47')](_0x536537,['id','createdAt',_0xd5bc('0x48')]);_0x3e9ac5['body']=_[_0xd5bc('0x47')](_0x3e9ac5[_0xd5bc('0x49')],['id',_0xd5bc('0x4a'),_0xd5bc('0x48')]);return db[_0xd5bc('0x2b')][_0xd5bc('0x4b')](_[_0xd5bc('0x3c')](_0x536537,_0x3e9ac5[_0xd5bc('0x49')]),{'include':_0x3e9ac5[_0xd5bc('0x31')][_0xd5bc('0x3e')]?[{'all':!![]}]:undefined});}})[_0xd5bc('0x24')](respondWithResult(_0x2547cb,0xc9))[_0xd5bc('0x41')](handleError(_0x2547cb,null));};exports[_0xd5bc('0x22')]=function(_0x554e94,_0x3407d1){if(_0x554e94[_0xd5bc('0x49')]['id']){delete _0x554e94['body']['id'];}return db[_0xd5bc('0x2b')][_0xd5bc('0x45')]({'where':{'id':_0x554e94[_0xd5bc('0x43')]['id']}})[_0xd5bc('0x24')](handleEntityNotFound(_0x3407d1,null))[_0xd5bc('0x24')](saveUpdates(_0x554e94[_0xd5bc('0x49')],null))[_0xd5bc('0x24')](respondWithResult(_0x3407d1,null))[_0xd5bc('0x41')](handleError(_0x3407d1,null));};exports[_0xd5bc('0x23')]=function(_0x16dee4,_0x1c52f2){return db[_0xd5bc('0x2b')][_0xd5bc('0x45')]({'where':{'id':_0x16dee4[_0xd5bc('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c52f2,null))['then'](removeEntity(_0x1c52f2,null))[_0xd5bc('0x41')](handleError(_0x1c52f2,null));};exports[_0xd5bc('0x4b')]=function(_0x1bf3ae,_0x44b8e2,_0x4b2017){_0x1bf3ae['body'][_0xd5bc('0x30')]=_0x1bf3ae[_0xd5bc('0x4c')][_0xd5bc('0x4d')];_0x1bf3ae['body']['basename']=_0x1bf3ae[_0xd5bc('0x4c')][_0xd5bc('0x4e')];_0x1bf3ae['body']['type']=_0x1bf3ae[_0xd5bc('0x4c')][_0xd5bc('0x4f')];return db['Attachment'][_0xd5bc('0x4b')](_0x1bf3ae['body'])[_0xd5bc('0x24')](respondWithResult(_0x44b8e2,0xc9))[_0xd5bc('0x41')](handleError(_0x44b8e2,null));};exports[_0xd5bc('0x50')]=function(_0x523970,_0x2a95a7,_0x167319){return db[_0xd5bc('0x2b')][_0xd5bc('0x51')]({'where':{'id':_0x523970[_0xd5bc('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2a95a7,null))[_0xd5bc('0x24')](function(_0x343868){if(_0x343868){return _0x2a95a7['download'](path[_0xd5bc('0x52')](config[_0xd5bc('0x53')],_0xd5bc('0x54'),_0x343868[_0xd5bc('0x55')]));}})[_0xd5bc('0x41')](handleError(_0x2a95a7,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index c5ecd98..149e42d 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 _0xd87e=['moment','bluebird','path','../../config/environment','./attachment.attributes','Attachment','attachments','lodash','util','api'];(function(_0x5efbee,_0x137fa1){var _0x2c4125=function(_0x4fbf80){while(--_0x4fbf80){_0x5efbee['push'](_0x5efbee['shift']());}};_0x2c4125(++_0x137fa1);}(_0xd87e,0x1bf));var _0xed87=function(_0x48ae97,_0x450240){_0x48ae97=_0x48ae97-0x0;var _0x13a62f=_0xd87e[_0x48ae97];return _0x13a62f;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var logger=require('../../config/logger')(_0xed87('0x2'));var moment=require(_0xed87('0x3'));var BPromise=require(_0xed87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed87('0x5'));var rimraf=require('rimraf');var config=require(_0xed87('0x6'));var attributes=require(_0xed87('0x7'));module['exports']=function(_0x17adfe,_0x589fb9){return _0x17adfe['define'](_0xed87('0x8'),attributes,{'tableName':_0xed87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash'];(function(_0x523510,_0x118cd6){var _0x1e9ce6=function(_0x30d094){while(--_0x30d094){_0x523510['push'](_0x523510['shift']());}};_0x1e9ce6(++_0x118cd6);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 3a993d4..000993d 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 _0x289c=['create','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment'];(function(_0x2abd96,_0xbefb59){var _0x584582=function(_0x63111d){while(--_0x63111d){_0x2abd96['push'](_0x2abd96['shift']());}};_0x584582(++_0xbefb59);}(_0x289c,0x126));var _0xc289=function(_0x244cb4,_0x5da548){_0x244cb4=_0x244cb4-0x0;var _0xad88f4=_0x289c[_0x244cb4];return _0xad88f4;};'use strict';var _=require(_0xc289('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc289('0x1'));var rs=require(_0xc289('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc289('0x3'))['db'];var utils=require(_0xc289('0x4'));var logger=require(_0xc289('0x5'))(_0xc289('0x6'));var config=require('../../config/environment');var jayson=require(_0xc289('0x7'));var client=jayson[_0xc289('0x8')][_0xc289('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8dd6,_0x381615,_0x1ea59c){return new BPromise(function(_0x5e848a,_0x57d96c){return client[_0xc289('0xa')](_0x3f8dd6,_0x1ea59c)[_0xc289('0xb')](function(_0x3792e5){logger[_0xc289('0xc')](_0xc289('0xd'),_0x381615,_0xc289('0xe'));logger[_0xc289('0xf')](_0xc289('0x10'),_0x381615,_0xc289('0xe'),JSON[_0xc289('0x11')](_0x3792e5));if(_0x3792e5[_0xc289('0x12')]){if(_0x3792e5[_0xc289('0x12')][_0xc289('0x13')]===0x1f4){logger[_0xc289('0x12')](_0xc289('0xd'),_0x381615,_0x3792e5[_0xc289('0x12')][_0xc289('0x14')]);return _0x57d96c(_0x3792e5[_0xc289('0x12')][_0xc289('0x14')]);}logger[_0xc289('0x12')](_0xc289('0xd'),_0x381615,_0x3792e5[_0xc289('0x12')]['message']);return _0x5e848a(_0x3792e5[_0xc289('0x12')][_0xc289('0x14')]);}else{logger[_0xc289('0xc')]('Attachment,\x20%s,\x20%s',_0x381615,'request\x20sent');_0x5e848a(_0x3792e5[_0xc289('0x15')]['message']);}})[_0xc289('0x16')](function(_0x595e0f){logger['error'](_0xc289('0xd'),_0x381615,_0x595e0f);_0x57d96c(_0x595e0f);});});}exports[_0xc289('0x17')]=function(_0x615d81){var _0x1ea0cd=this;return new Promise(function(_0x564b6b,_0x5ad385){return db[_0xc289('0x18')][_0xc289('0x19')](_0x615d81[_0xc289('0x1a')],{'raw':_0x615d81['options']?_0x615d81[_0xc289('0x1b')][_0xc289('0x1c')]===undefined?!![]:![]:!![]})[_0xc289('0xb')](function(_0x3ebf3a){logger[_0xc289('0xc')]('CreateAttachment',_0x615d81);logger['debug'](_0xc289('0x17'),_0x615d81,JSON[_0xc289('0x11')](_0x3ebf3a));_0x564b6b(_0x3ebf3a);})[_0xc289('0x16')](function(_0x5a7584){logger[_0xc289('0x12')](_0xc289('0x17'),_0x5a7584[_0xc289('0x14')],_0x615d81);_0x5ad385(_0x1ea0cd['error'](0x1f4,_0x5a7584[_0xc289('0x14')]));});});}; \ No newline at end of file +var _0x9a84=['Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','then','CreateAttachment','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x25f9f5,_0x2dbbae){var _0x40276e=function(_0xbe10a4){while(--_0xbe10a4){_0x25f9f5['push'](_0x25f9f5['shift']());}};_0x40276e(++_0x2dbbae);}(_0x9a84,0x1d0));var _0x49a8=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0x9a84[_0x30b159];return _0x23c3f9;};'use strict';var _=require(_0x49a8('0x0'));var util=require(_0x49a8('0x1'));var moment=require(_0x49a8('0x2'));var BPromise=require(_0x49a8('0x3'));var rs=require(_0x49a8('0x4'));var fs=require('fs');var Redis=require(_0x49a8('0x5'));var db=require(_0x49a8('0x6'))['db'];var utils=require(_0x49a8('0x7'));var logger=require(_0x49a8('0x8'))(_0x49a8('0x9'));var config=require(_0x49a8('0xa'));var jayson=require(_0x49a8('0xb'));var client=jayson[_0x49a8('0xc')][_0x49a8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2e0cda,_0x362c19,_0x4fa82b){return new BPromise(function(_0x2a302a,_0x56398e){return client[_0x49a8('0xe')](_0x2e0cda,_0x4fa82b)['then'](function(_0x288979){logger[_0x49a8('0xf')](_0x49a8('0x10'),_0x362c19,_0x49a8('0x11'));logger['debug'](_0x49a8('0x12'),_0x362c19,_0x49a8('0x11'),JSON[_0x49a8('0x13')](_0x288979));if(_0x288979[_0x49a8('0x14')]){if(_0x288979[_0x49a8('0x14')]['code']===0x1f4){logger[_0x49a8('0x14')]('Attachment,\x20%s,\x20%s',_0x362c19,_0x288979[_0x49a8('0x14')][_0x49a8('0x15')]);return _0x56398e(_0x288979[_0x49a8('0x14')]['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x362c19,_0x288979['error'][_0x49a8('0x15')]);return _0x2a302a(_0x288979[_0x49a8('0x14')]['message']);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x362c19,_0x49a8('0x11'));_0x2a302a(_0x288979[_0x49a8('0x16')][_0x49a8('0x15')]);}})[_0x49a8('0x17')](function(_0x3e6ae3){logger[_0x49a8('0x14')](_0x49a8('0x10'),_0x362c19,_0x3e6ae3);_0x56398e(_0x3e6ae3);});});}exports['CreateAttachment']=function(_0xa7ecc){var _0x31a9a9=this;return new Promise(function(_0x4b8649,_0x3793cd){return db['Attachment'][_0x49a8('0x18')](_0xa7ecc[_0x49a8('0x19')],{'raw':_0xa7ecc[_0x49a8('0x1a')]?_0xa7ecc[_0x49a8('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x49a8('0x1b')](function(_0x465247){logger[_0x49a8('0xf')](_0x49a8('0x1c'),_0xa7ecc);logger[_0x49a8('0x1d')](_0x49a8('0x1c'),_0xa7ecc,JSON['stringify'](_0x465247));_0x4b8649(_0x465247);})[_0x49a8('0x17')](function(_0x2aa2a3){logger[_0x49a8('0x14')]('CreateAttachment',_0x2aa2a3[_0x49a8('0x15')],_0xa7ecc);_0x3793cd(_0x31a9a9[_0x49a8('0x14')](0x1f4,_0x2aa2a3['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3a0c225..35c1e0d 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 _0x3eae=['../../config/environment','./attachment.controller','get','index','/:id','isAuthenticated','show','download','/:id/clone','clone','diskStorage','join','root','format','%s-%s','now','post','single','file','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3eae,0x126));var _0xe3ea=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x3eae[_0x7148a3];return _0x52f31d;};'use strict';var multer=require(_0xe3ea('0x0'));var util=require(_0xe3ea('0x1'));var path=require(_0xe3ea('0x2'));var timeout=require(_0xe3ea('0x3'));var express=require('express');var router=express[_0xe3ea('0x4')]();var auth=require(_0xe3ea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe3ea('0x6'));var controller=require(_0xe3ea('0x7'));router[_0xe3ea('0x8')]('/',auth['isAuthenticated'](),controller[_0xe3ea('0x9')]);router[_0xe3ea('0x8')](_0xe3ea('0xa'),auth[_0xe3ea('0xb')](),controller[_0xe3ea('0xc')]);router[_0xe3ea('0x8')]('/:id/download',auth[_0xe3ea('0xb')](),controller[_0xe3ea('0xd')]);router['post'](_0xe3ea('0xe'),auth[_0xe3ea('0xb')](),controller[_0xe3ea('0xf')]);var upload=multer({'storage':multer[_0xe3ea('0x10')]({'destination':function(_0x1db54c,_0x577d3b,_0x2796ed){_0x2796ed(null,path[_0xe3ea('0x11')](config[_0xe3ea('0x12')],'server/files/attachments/'));},'filename':function(_0x309396,_0x3fa991,_0x470912){_0x470912(null,util[_0xe3ea('0x13')](_0xe3ea('0x14'),Date[_0xe3ea('0x15')](),_0x3fa991['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe3ea('0x16')]('/',upload[_0xe3ea('0x17')](_0xe3ea('0x18')),controller[_0xe3ea('0x19')]);router[_0xe3ea('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xe3ea('0x1b')]);router[_0xe3ea('0x1c')]('/:id',auth[_0xe3ea('0xb')](),controller[_0xe3ea('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x3d3b=['root','server/files/attachments/','format','%s-%s','now','single','create','put','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','/:id','isAuthenticated','show','download','post','/:id/clone','diskStorage','join'];(function(_0x33c613,_0x2ce6bb){var _0x3f36e1=function(_0x339044){while(--_0x339044){_0x33c613['push'](_0x33c613['shift']());}};_0x3f36e1(++_0x2ce6bb);}(_0x3d3b,0x1af));var _0xb3d3=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x3d3b[_0xc8a931];return _0x28bd27;};'use strict';var multer=require(_0xb3d3('0x0'));var util=require('util');var path=require(_0xb3d3('0x1'));var timeout=require(_0xb3d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb3d3('0x3'));var interaction=require(_0xb3d3('0x4'));var config=require(_0xb3d3('0x5'));var controller=require(_0xb3d3('0x6'));router[_0xb3d3('0x7')]('/',auth['isAuthenticated'](),controller[_0xb3d3('0x8')]);router[_0xb3d3('0x7')](_0xb3d3('0x9'),auth[_0xb3d3('0xa')](),controller[_0xb3d3('0xb')]);router['get']('/:id/download',auth[_0xb3d3('0xa')](),controller[_0xb3d3('0xc')]);router[_0xb3d3('0xd')](_0xb3d3('0xe'),auth[_0xb3d3('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0xb3d3('0xf')]({'destination':function(_0x35908d,_0x10bf14,_0x597196){_0x597196(null,path[_0xb3d3('0x10')](config[_0xb3d3('0x11')],_0xb3d3('0x12')));},'filename':function(_0x9e85bf,_0x327df1,_0x43434d){_0x43434d(null,util[_0xb3d3('0x13')](_0xb3d3('0x14'),Date[_0xb3d3('0x15')](),_0x327df1['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb3d3('0xd')]('/',upload[_0xb3d3('0x16')]('file'),controller[_0xb3d3('0x17')]);router[_0xb3d3('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb3d3('0x19')](_0xb3d3('0x9'),auth[_0xb3d3('0xa')](),controller[_0xb3d3('0x1a')]);module[_0xb3d3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 194848f..3fc89cb 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 _0x03e1=['clientSecret','secret','callbackURL','findOne','blockDuration','User','find','map','emails','value','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','signToken','login','authenticate','google','/login','profile','callback','use','clientID'];(function(_0x3f9af5,_0x57610a){var _0x461f1a=function(_0x587b45){while(--_0x587b45){_0x3f9af5['push'](_0x3f9af5['shift']());}};_0x461f1a(++_0x57610a);}(_0x03e1,0x166));var _0x103e=function(_0x54644d,_0x50b151){_0x54644d=_0x54644d-0x0;var _0x40f20e=_0x03e1[_0x54644d];return _0x40f20e;};'use strict';var _=require(_0x103e('0x0'));var passport=require(_0x103e('0x1'));var GoogleStrategy=require(_0x103e('0x2'))[_0x103e('0x3')];var moment=require(_0x103e('0x4'));var db=require(_0x103e('0x5'))['db'];var config=require(_0x103e('0x6'));var signToken=require('../../components/auth/service')[_0x103e('0x7')];var utils=require('../../config/utils');exports[_0x103e('0x8')]=passport[_0x103e('0x9')](_0x103e('0xa'),{'failureRedirect':_0x103e('0xb'),'scope':[_0x103e('0xc'),'email'],'session':![]});exports[_0x103e('0xd')]=passport['authenticate'](_0x103e('0xa'),{'failureRedirect':_0x103e('0xb'),'session':![]});passport[_0x103e('0xe')](new GoogleStrategy({'clientID':config[_0x103e('0xa')]?config[_0x103e('0xa')][_0x103e('0xf')]:'id','clientSecret':config[_0x103e('0xa')]?config[_0x103e('0xa')][_0x103e('0x10')]:_0x103e('0x11'),'callbackURL':config[_0x103e('0xa')]?config[_0x103e('0xa')][_0x103e('0x12')]:''},function(_0x44a2e1,_0x1e4c15,_0x8e71d8,_0x33535f){var _0xc9cd40,_0x21baf1;return db['Setting'][_0x103e('0x13')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x103e('0x14')],'raw':!![]})['then'](function(_0x10cd37){_0xc9cd40=_0x10cd37;return db[_0x103e('0x15')][_0x103e('0x16')]({'where':{'email':_[_0x103e('0x17')](_0x8e71d8[_0x103e('0x18')],_0x103e('0x19')),'role':{'$or':['admin',_0x103e('0x1a'),'agent']}}});})[_0x103e('0x1b')](function(_0x4834d1){_0x21baf1=_0x4834d1;if(_0x21baf1){if(_0x21baf1[_0x103e('0x1c')]){return _0x33535f(_0x103e('0x1d'));}else if(_0xc9cd40[_0x103e('0x14')]>0x0){if(_0x21baf1['blocked']){if(moment(_0x21baf1['blockedAt'])['add'](_0xc9cd40[_0x103e('0x14')],_0x103e('0x1e'))>moment()){return _0x33535f(_0x103e('0x1d'));}else{return utils[_0x103e('0x1f')](_0x21baf1,0x0,![],null)[_0x103e('0x1b')](function(){return utils[_0x103e('0x20')](_0x21baf1);})[_0x103e('0x1b')](function(){return _0x33535f(null,_0x21baf1);});}}else{return utils['getLicense'](_0x21baf1)['then'](function(){return _0x33535f(null,_0x21baf1);});}}else{return utils[_0x103e('0x20')](_0x21baf1)[_0x103e('0x1b')](function(){return _0x33535f(null,_0x21baf1);});}}return _0x33535f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x103e('0x21')](function(_0x51ec1f){_0x33535f(_0x51ec1f);});})); \ No newline at end of file +var _0x52ef=['User','find','map','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','getLicense','then','catch','lodash','Strategy','../../mysqldb','../../config/environment','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','secret','callbackURL','allowedLoginAttempts','blockDuration'];(function(_0x33208a,_0x4d79e8){var _0x4f7da4=function(_0x201245){while(--_0x201245){_0x33208a['push'](_0x33208a['shift']());}};_0x4f7da4(++_0x4d79e8);}(_0x52ef,0x11e));var _0xf52e=function(_0x23c31d,_0x2e8382){_0x23c31d=_0x23c31d-0x0;var _0x4c8e11=_0x52ef[_0x23c31d];return _0x4c8e11;};'use strict';var _=require(_0xf52e('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0xf52e('0x1')];var moment=require('moment');var db=require(_0xf52e('0x2'))['db'];var config=require(_0xf52e('0x3'));var signToken=require('../../components/auth/service')[_0xf52e('0x4')];var utils=require(_0xf52e('0x5'));exports[_0xf52e('0x6')]=passport[_0xf52e('0x7')](_0xf52e('0x8'),{'failureRedirect':_0xf52e('0x9'),'scope':[_0xf52e('0xa'),_0xf52e('0xb')],'session':![]});exports[_0xf52e('0xc')]=passport[_0xf52e('0x7')](_0xf52e('0x8'),{'failureRedirect':_0xf52e('0x9'),'session':![]});passport[_0xf52e('0xd')](new GoogleStrategy({'clientID':config[_0xf52e('0x8')]?config[_0xf52e('0x8')][_0xf52e('0xe')]:'id','clientSecret':config[_0xf52e('0x8')]?config['google'][_0xf52e('0xf')]:_0xf52e('0x10'),'callbackURL':config[_0xf52e('0x8')]?config['google'][_0xf52e('0x11')]:''},function(_0x32b5aa,_0x1f8cc2,_0x5025c0,_0x1fe5b1){var _0x5153ce,_0x1e8953;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xf52e('0x12'),_0xf52e('0x13')],'raw':!![]})['then'](function(_0x1b1997){_0x5153ce=_0x1b1997;return db[_0xf52e('0x14')][_0xf52e('0x15')]({'where':{'email':_[_0xf52e('0x16')](_0x5025c0[_0xf52e('0x17')],'value'),'role':{'$or':[_0xf52e('0x18'),_0xf52e('0x19'),_0xf52e('0x1a')]}}});})['then'](function(_0x22821a){_0x1e8953=_0x22821a;if(_0x1e8953){if(_0x1e8953[_0xf52e('0x1b')]){return _0x1fe5b1(_0xf52e('0x1c'));}else if(_0x5153ce[_0xf52e('0x13')]>0x0){if(_0x1e8953['blocked']){if(moment(_0x1e8953['blockedAt'])['add'](_0x5153ce[_0xf52e('0x13')],_0xf52e('0x1d'))>moment()){return _0x1fe5b1('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xf52e('0x1e')](_0x1e8953,0x0,![],null)['then'](function(){return utils[_0xf52e('0x1f')](_0x1e8953);})[_0xf52e('0x20')](function(){return _0x1fe5b1(null,_0x1e8953);});}}else{return utils['getLicense'](_0x1e8953)['then'](function(){return _0x1fe5b1(null,_0x1e8953);});}}else{return utils[_0xf52e('0x1f')](_0x1e8953)[_0xf52e('0x20')](function(){return _0x1fe5b1(null,_0x1e8953);});}}return _0x1fe5b1(_0xf52e('0x1c'));})[_0xf52e('0x21')](function(_0x5ed12e){_0x1fe5b1(_0x5ed12e);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index a441232..667932a 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 _0xae7b=['Router','../../components/auth/service','get','login','isMiddleware','setTokenCookie','express','passport'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xae7b,0xbe));var _0xbae7=function(_0x5ef377,_0x9647db){_0x5ef377=_0x5ef377-0x0;var _0x245c7c=_0xae7b[_0x5ef377];return _0x245c7c;};'use strict';var express=require(_0xbae7('0x0'));var passport=require(_0xbae7('0x1'));var router=express[_0xbae7('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xbae7('0x3'));router[_0xbae7('0x4')]('/',controller[_0xbae7('0x5')]);router[_0xbae7('0x4')]('/callback',controller['callback'],authService[_0xbae7('0x6')],userController[_0xbae7('0x5')],authService[_0xbae7('0x7')]);module['exports']=router; \ No newline at end of file +var _0x25a3=['isMiddleware','express','passport','Router','../user/user.controller.js','get','login','callback'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x25a3,0x121));var _0x325a=function(_0x1a9a72,_0x3724d3){_0x1a9a72=_0x1a9a72-0x0;var _0x384c5b=_0x25a3[_0x1a9a72];return _0x384c5b;};'use strict';var express=require(_0x325a('0x0'));var passport=require(_0x325a('0x1'));var router=express[_0x325a('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x325a('0x3'));var authService=require('../../components/auth/service');router[_0x325a('0x4')]('/',controller[_0x325a('0x5')]);router[_0x325a('0x4')]('/callback',controller[_0x325a('0x6')],authService[_0x325a('0x7')],userController[_0x325a('0x5')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e5ce2ad..89be102 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 _0x5351=['role','disabled','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','pass','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','Setting','findOne','blockDuration','then','password'];(function(_0x1168f5,_0x2f77bc){var _0x574696=function(_0x133bdc){while(--_0x133bdc){_0x1168f5['push'](_0x1168f5['shift']());}};_0x574696(++_0x2f77bc);}(_0x5351,0x1d1));var _0x1535=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5351[_0x122ef9];return _0x42fba0;};'use strict';var util=require('util');var passport=require(_0x1535('0x0'));var LocalStrategy=require(_0x1535('0x1'))[_0x1535('0x2')];var jayson=require(_0x1535('0x3'));var _=require(_0x1535('0x4'));var rs=require(_0x1535('0x5'));var moment=require(_0x1535('0x6'));var db=require(_0x1535('0x7'))['db'];var authService=require(_0x1535('0x8'));var utils=require(_0x1535('0x9'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x40c426,_0x8b38f3,_0x27438f,_0x22c993){var _0x5aba20,_0x1ecabb;return db[_0x1535('0xa')][_0x1535('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1535('0xc')],'raw':!![]})[_0x1535('0xd')](function(_0x25bb40){_0x5aba20=_0x25bb40;return _0x40c426[_0x1535('0xb')]({'attributes':['id','name',_0x1535('0xe'),'salt',_0x1535('0xf'),_0x1535('0x10'),'blocked','blockedAt',_0x1535('0x11')],'where':{'name':_0x8b38f3,'role':{'$or':[_0x1535('0x12'),'user',_0x1535('0x13')]}}});})['then'](function(_0x32e9fc){if(!_0x32e9fc||_0x32e9fc&&_0x32e9fc[_0x1535('0x14')]!==_0x8b38f3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1ecabb=_0x32e9fc;return _0x1ecabb;}})['then'](function(){_0x1ecabb['authenticate'](_0x27438f,function(_0x2ee0b8,_0x1afa7a){var _0x115685=_0x1ecabb['loginAttempts']+0x1;if(_0x2ee0b8){return _0x22c993(_0x2ee0b8);}else if(!_0x1afa7a){if(_0x1ecabb[_0x1535('0x10')]){return _0x22c993(null,![],{'message':_0x1535('0x15')});}else if(_0x5aba20[_0x1535('0x16')]>0x0){if(_0x1ecabb[_0x1535('0x17')]){if(_0x5aba20[_0x1535('0xc')]>0x0){if(moment(_0x1ecabb[_0x1535('0x18')])[_0x1535('0x19')](_0x5aba20[_0x1535('0xc')],_0x1535('0x1a'))>moment()){return _0x22c993(null,![],{'message':_0x1535('0x15')});}else{return utils[_0x1535('0x1b')](_0x1ecabb,_0x115685,![],null)[_0x1535('0xd')](function(){return _0x22c993(null,![],{'message':_0x1535('0x15')});});}}else{return _0x22c993(null,![],{'message':_0x1535('0x15')});}}else{if(_0x115685>=_0x5aba20[_0x1535('0x16')]){return utils[_0x1535('0x1b')](_0x1ecabb,0x0,!![],moment())[_0x1535('0xd')](function(){return _0x22c993(null,![],{'message':_0x1535('0x15')});});}else{return utils[_0x1535('0x1b')](_0x1ecabb,_0x115685,![],null)[_0x1535('0xd')](function(){return _0x22c993(null,![],{'message':_0x1535('0x15')});});}}}else{return _0x22c993(null,![],{'message':_0x1535('0x15')});}}else{if(_0x1ecabb[_0x1535('0x10')]){return _0x22c993(null,![],{'message':_0x1535('0x15')});}else if(_0x5aba20[_0x1535('0x16')]>0x0){if(_0x1ecabb[_0x1535('0x17')]){if(_0x5aba20[_0x1535('0xc')]>0x0){if(moment(_0x1ecabb['blockedAt'])[_0x1535('0x19')](_0x5aba20[_0x1535('0xc')],_0x1535('0x1a'))>moment()){return _0x22c993(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x1ecabb,0x0,![],null)[_0x1535('0xd')](function(){return utils[_0x1535('0x1c')](_0x1ecabb);})['then'](function(){return _0x22c993(null,_0x1ecabb);});}}else{return _0x22c993(null,![],{'message':_0x1535('0x15')});}}else{return utils[_0x1535('0x1b')](_0x1ecabb,0x0,![],null)[_0x1535('0xd')](function(){return utils[_0x1535('0x1c')](_0x1ecabb);})['then'](function(){return _0x22c993(null,_0x1ecabb);})[_0x1535('0x1d')](function(_0x38a3bb){return _0x22c993(null,![],_0x38a3bb);});}}else{if(_0x1ecabb[_0x1535('0x17')]){return _0x22c993(null,![],{'message':_0x1535('0x15')});}else{return utils[_0x1535('0x1c')](_0x1ecabb)[_0x1535('0xd')](function(){return _0x22c993(null,_0x1ecabb);});}}}});})[_0x1535('0x1d')](function(_0x11ade4){return _0x22c993(null,![],_0x11ade4);});}function sendServiceMail(_0x2a6fa7){return db[_0x1535('0x1e')][_0x1535('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x1535('0x14'),_0x1535('0x20')],'include':[{'model':db[_0x1535('0x21')],'as':_0x1535('0x22')}]})[_0x1535('0xd')](function(_0xf12892){if(!_0xf12892){throw new Error(_0x1535('0x23'));}var _0x32b0c7={'tls':{'rejectUnauthorized':![]}};if(_0xf12892[_0x1535('0x22')][_0x1535('0x24')]){_0x32b0c7[_0x1535('0x24')]=_0xf12892[_0x1535('0x22')][_0x1535('0x24')];}else{_0x32b0c7[_0x1535('0x25')]=_0xf12892[_0x1535('0x22')]['host'];_0x32b0c7[_0x1535('0x26')]=_0xf12892['Smtp'][_0x1535('0x26')];_0x32b0c7[_0x1535('0x27')]=_0xf12892['Smtp'][_0x1535('0x27')];}if(_0xf12892[_0x1535('0x22')][_0x1535('0x28')]){_0x32b0c7[_0x1535('0x29')]={'user':_0xf12892[_0x1535('0x22')][_0x1535('0x2a')],'pass':_0xf12892[_0x1535('0x22')][_0x1535('0x2b')]};}var _0x43cd03={'account':_0x32b0c7,'message':_[_0x1535('0x2c')]({'from':util[_0x1535('0x2d')]('\x22%s\x22\x20<%s>',_0xf12892['name'],_0xf12892[_0x1535('0x20')]||_0xf12892['Smtp'][_0x1535('0x2a')])},_0x2a6fa7)};return client[_0x1535('0x2e')](_0x1535('0x2f'),_0x43cd03);})[_0x1535('0xd')](function(_0x10334f){if(_0x10334f[_0x1535('0x30')]){throw new Error(util['format'](_0x1535('0x31'),_0x10334f[_0x1535('0x30')][_0x1535('0x32')]||JSON[_0x1535('0x33')](_0x10334f[_0x1535('0x30')])));}return!![];});}function handleError(_0x5d7e27,_0x5bd57d,_0x4b0f20){return _0x5d7e27[_0x1535('0x34')](_0x5bd57d||0x1f4)[_0x1535('0x35')]({'message':_0x4b0f20?_0x4b0f20[_0x1535('0x32')]||_0x4b0f20:''});}function checkPasswordPattern(_0x3b08d6,_0x3cb59f,_0x492e77){if(_0x492e77){var _0x1a95a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a95a0['test'](_0x3cb59f)){return _0x3b08d6;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3b08d6;}}exports['login']=function(_0x35ed8b,_0x5b9cce,_0x122304){passport['authenticate']('local',function(_0x17b6fa,_0x249f6e,_0x3ed827){var _0x332ba1=_0x17b6fa||_0x3ed827;if(_0x332ba1){return handleError(_0x5b9cce,0x191,_0x332ba1);}if(!_0x249f6e){return handleError(_0x5b9cce,0x194,{'message':_0x1535('0x36')});}else{var _0x298b9d={'payload':{'id':_0x249f6e['id'],'role':_0x249f6e[_0x1535('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x298b9d)[_0x1535('0xd')](function(_0x1a211b){_0x5b9cce[_0x1535('0x37')]({'id':_0x249f6e['id'],'token':_0x1a211b,'statusCall':'','isAlreadyLogged':_0x249f6e[_0x1535('0x38')]});});}})(_0x35ed8b,_0x5b9cce,_0x122304);};exports[_0x1535('0x39')]=function(_0x5e2876,_0x8a115f,_0xb7d9ac){if(!_0x5e2876[_0x1535('0x3a')][_0x1535('0x20')]){return handleError(_0x8a115f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4294c3=rs[_0x1535('0x3b')]();_0x5e2876[_0x1535('0x3a')][_0x1535('0x20')]=_0x5e2876[_0x1535('0x3a')]['email'][_0x1535('0x3c')]()[_0x1535('0x3d')]();var _0x20b45b;return db[_0x1535('0xa')][_0x1535('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1535('0xc')],'raw':!![]})[_0x1535('0xd')](function(_0x5f0513){_0x20b45b=_0x5f0513;return db[_0x1535('0x3e')][_0x1535('0x1f')]({'where':{'email':_0x5e2876[_0x1535('0x3a')]['email']}});})['then'](function(_0x731547){if(!_0x731547){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x731547[_0x1535('0x10')]){throw new Error(_0x1535('0x3f'));}if(_0x731547['blocked']){if(moment(_0x731547['blockedAt'])[_0x1535('0x19')](_0x20b45b[_0x1535('0xc')],'minutes')>moment()){throw new Error(_0x1535('0x40'));}else{_0x731547[_0x1535('0x17')]=![];_0x731547[_0x1535('0x18')]=null;}}_0x731547[_0x1535('0x41')]=_0x4294c3;_0x731547[_0x1535('0x42')]=Date['now']()+0x36ee80;return _0x731547[_0x1535('0x43')]();})[_0x1535('0xd')](function(){return sendServiceMail({'to':_0x5e2876[_0x1535('0x3a')][_0x1535('0x20')],'subject':_0x1535('0x44'),'text':_0x1535('0x45')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x1535('0x46')+_0x5e2876[_0x1535('0x47')][_0x1535('0x25')]+_0x1535('0x48')+_0x4294c3+'\x0a\x0a'+_0x1535('0x49')});})[_0x1535('0xd')](function(){_0x8a115f['status'](0xc8)[_0x1535('0x35')]({'message':_0x1535('0x4a')});})[_0x1535('0x1d')](function(_0x5eb382){return handleError(_0x8a115f,0x1f4,_0x5eb382);});};exports[_0x1535('0x4b')]=function(_0x31e6a7,_0x124ce8,_0x4f25f0){var _0x227353;return db[_0x1535('0x3e')][_0x1535('0x1f')]({'where':{'resetPasswordToken':_0x31e6a7['params'][_0x1535('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x1535('0xd')](function(_0x56e691){_0x227353=_0x56e691;if(!_0x227353){throw new Error(_0x1535('0x4d'));}return db['Setting']['findOne']({'attributes':['id','securePassword']});})[_0x1535('0xd')](function(_0x26da4d){return checkPasswordPattern(_0x26da4d,_0x31e6a7[_0x1535('0x3a')][_0x1535('0xe')],_0x26da4d[_0x1535('0x4e')]);})[_0x1535('0xd')](function(){_0x227353[_0x1535('0xe')]=_0x31e6a7[_0x1535('0x3a')][_0x1535('0xe')];_0x227353[_0x1535('0x41')]=null;_0x227353[_0x1535('0x42')]=null;return _0x227353[_0x1535('0x43')]();})[_0x1535('0xd')](function(){_0x124ce8[_0x1535('0x34')](0xc8)[_0x1535('0x35')]({'message':_0x1535('0x4f')});})[_0x1535('0x1d')](function(_0x5b5f12){return handleError(_0x124ce8,0x1f4,_0x5b5f12);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':_0x1535('0xe')},function(_0x1af8f3,_0x52eae5,_0x103f7d){return localAuthenticate(db[_0x1535('0x3e')],_0x1af8f3,_0x52eae5,_0x103f7d);})); \ No newline at end of file +var _0xfeef=['login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','Email\x20parameter\x20is\x20missing','body','trim','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','resetPasswordExpires','save','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','Smtp','host','port','secure','authentication','auth','pass','merge','format','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x48607a,_0xdd5c99){var _0x116bf0=function(_0x569d45){while(--_0x569d45){_0x48607a['push'](_0x48607a['shift']());}};_0x116bf0(++_0xdd5c99);}(_0xfeef,0xc0));var _0xffee=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xfeef[_0x4b12ae];return _0x16957b;};'use strict';var util=require(_0xffee('0x0'));var passport=require('passport');var LocalStrategy=require(_0xffee('0x1'))[_0xffee('0x2')];var jayson=require(_0xffee('0x3'));var _=require(_0xffee('0x4'));var rs=require(_0xffee('0x5'));var moment=require(_0xffee('0x6'));var db=require(_0xffee('0x7'))['db'];var authService=require(_0xffee('0x8'));var utils=require(_0xffee('0x9'));var client=jayson[_0xffee('0xa')][_0xffee('0xb')]({'port':0x232b});function localAuthenticate(_0x4b04e2,_0x37d27a,_0x3a8ec4,_0x48cdc1){var _0x501997,_0x69c388;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xffee('0xc'),_0xffee('0xd')],'raw':!![]})[_0xffee('0xe')](function(_0x2ef2d3){_0x501997=_0x2ef2d3;return _0x4b04e2[_0xffee('0xf')]({'attributes':['id',_0xffee('0x10'),_0xffee('0x11'),_0xffee('0x12'),_0xffee('0x13'),_0xffee('0x14'),'blocked',_0xffee('0x15'),_0xffee('0x16')],'where':{'name':_0x37d27a,'role':{'$or':[_0xffee('0x17'),_0xffee('0x18'),_0xffee('0x19')]}}});})[_0xffee('0xe')](function(_0x2f20c7){if(!_0x2f20c7||_0x2f20c7&&_0x2f20c7[_0xffee('0x10')]!==_0x37d27a){throw new Error(_0xffee('0x1a'));}else{_0x69c388=_0x2f20c7;return _0x69c388;}})[_0xffee('0xe')](function(){_0x69c388[_0xffee('0x1b')](_0x3a8ec4,function(_0x163b3f,_0x40079d){var _0x421496=_0x69c388[_0xffee('0x16')]+0x1;if(_0x163b3f){return _0x48cdc1(_0x163b3f);}else if(!_0x40079d){if(_0x69c388[_0xffee('0x14')]){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}else if(_0x501997['allowedLoginAttempts']>0x0){if(_0x69c388[_0xffee('0x1c')]){if(_0x501997[_0xffee('0xd')]>0x0){if(moment(_0x69c388[_0xffee('0x15')])['add'](_0x501997[_0xffee('0xd')],_0xffee('0x1d'))>moment()){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}else{return utils[_0xffee('0x1e')](_0x69c388,_0x421496,![],null)[_0xffee('0xe')](function(){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});});}}else{return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}}else{if(_0x421496>=_0x501997[_0xffee('0xc')]){return utils['clearBlockUser'](_0x69c388,0x0,!![],moment())[_0xffee('0xe')](function(){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});});}else{return utils[_0xffee('0x1e')](_0x69c388,_0x421496,![],null)[_0xffee('0xe')](function(){return _0x48cdc1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}}else{if(_0x69c388[_0xffee('0x14')]){return _0x48cdc1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x501997[_0xffee('0xc')]>0x0){if(_0x69c388[_0xffee('0x1c')]){if(_0x501997[_0xffee('0xd')]>0x0){if(moment(_0x69c388['blockedAt'])[_0xffee('0x1f')](_0x501997['blockDuration'],_0xffee('0x1d'))>moment()){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}else{return utils['clearBlockUser'](_0x69c388,0x0,![],null)['then'](function(){return utils[_0xffee('0x20')](_0x69c388);})[_0xffee('0xe')](function(){return _0x48cdc1(null,_0x69c388);});}}else{return _0x48cdc1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xffee('0x1e')](_0x69c388,0x0,![],null)['then'](function(){return utils[_0xffee('0x20')](_0x69c388);})[_0xffee('0xe')](function(){return _0x48cdc1(null,_0x69c388);})['catch'](function(_0x1d8c71){return _0x48cdc1(null,![],_0x1d8c71);});}}else{if(_0x69c388[_0xffee('0x1c')]){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}else{return utils[_0xffee('0x20')](_0x69c388)['then'](function(){return _0x48cdc1(null,_0x69c388);});}}}});})[_0xffee('0x21')](function(_0x403ef6){return _0x48cdc1(null,![],_0x403ef6);});}function sendServiceMail(_0xe78f08){return db[_0xffee('0x22')][_0xffee('0x23')]({'where':{'service':!![]},'attributes':['id',_0xffee('0x10'),_0xffee('0x24')],'include':[{'model':db[_0xffee('0x25')],'as':'Smtp'}]})[_0xffee('0xe')](function(_0x5838d3){if(!_0x5838d3){throw new Error(_0xffee('0x26'));}var _0x26f333={'tls':{'rejectUnauthorized':![]}};if(_0x5838d3['Smtp'][_0xffee('0x27')]){_0x26f333[_0xffee('0x27')]=_0x5838d3[_0xffee('0x28')][_0xffee('0x27')];}else{_0x26f333['host']=_0x5838d3[_0xffee('0x28')][_0xffee('0x29')];_0x26f333['port']=_0x5838d3[_0xffee('0x28')][_0xffee('0x2a')];_0x26f333[_0xffee('0x2b')]=_0x5838d3[_0xffee('0x28')][_0xffee('0x2b')];}if(_0x5838d3[_0xffee('0x28')][_0xffee('0x2c')]){_0x26f333[_0xffee('0x2d')]={'user':_0x5838d3[_0xffee('0x28')][_0xffee('0x18')],'pass':_0x5838d3['Smtp'][_0xffee('0x2e')]};}var _0x277b01={'account':_0x26f333,'message':_[_0xffee('0x2f')]({'from':util[_0xffee('0x30')]('\x22%s\x22\x20<%s>',_0x5838d3[_0xffee('0x10')],_0x5838d3['email']||_0x5838d3[_0xffee('0x28')][_0xffee('0x18')])},_0xe78f08)};return client['request'](_0xffee('0x31'),_0x277b01);})[_0xffee('0xe')](function(_0x68cb8c){if(_0x68cb8c[_0xffee('0x32')]){throw new Error(util[_0xffee('0x30')](_0xffee('0x33'),_0x68cb8c[_0xffee('0x32')][_0xffee('0x34')]||JSON[_0xffee('0x35')](_0x68cb8c['error'])));}return!![];});}function handleError(_0x1d7f9c,_0x518026,_0x36cd53){return _0x1d7f9c[_0xffee('0x36')](_0x518026||0x1f4)[_0xffee('0x37')]({'message':_0x36cd53?_0x36cd53[_0xffee('0x34')]||_0x36cd53:''});}function checkPasswordPattern(_0x497a47,_0x1cda6c,_0x40856a){if(_0x40856a){var _0x22dd68=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22dd68['test'](_0x1cda6c)){return _0x497a47;}else{throw new Error(_0xffee('0x38'));}}else{return _0x497a47;}}exports[_0xffee('0x39')]=function(_0x321aec,_0x57d012,_0x5ea44f){passport[_0xffee('0x1b')](_0xffee('0x3a'),function(_0x502378,_0x593bce,_0x29971c){var _0x597e75=_0x502378||_0x29971c;if(_0x597e75){return handleError(_0x57d012,0x191,_0x597e75);}if(!_0x593bce){return handleError(_0x57d012,0x194,{'message':_0xffee('0x3b')});}else{var _0x34132c={'payload':{'id':_0x593bce['id'],'role':_0x593bce[_0xffee('0x13')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x34132c)[_0xffee('0xe')](function(_0x9eae1c){_0x57d012[_0xffee('0x3c')]({'id':_0x593bce['id'],'token':_0x9eae1c,'statusCall':'','isAlreadyLogged':_0x593bce[_0xffee('0x3d')]});});}})(_0x321aec,_0x57d012,_0x5ea44f);};exports[_0xffee('0x3e')]=function(_0x86ee30,_0x3e01b2,_0x19fbd9){if(!_0x86ee30['body']['email']){return handleError(_0x3e01b2,0x1f4,{'message':_0xffee('0x3f')});}var _0x12ab5e=rs['generate']();_0x86ee30['body'][_0xffee('0x24')]=_0x86ee30[_0xffee('0x40')][_0xffee('0x24')][_0xffee('0x41')]()['toLowerCase']();var _0x201096;return db[_0xffee('0x42')]['findOne']({'where':{'id':0x1},'attributes':[_0xffee('0xc'),_0xffee('0xd')],'raw':!![]})[_0xffee('0xe')](function(_0x3181ea){_0x201096=_0x3181ea;return db[_0xffee('0x43')]['find']({'where':{'email':_0x86ee30[_0xffee('0x40')][_0xffee('0x24')]}});})[_0xffee('0xe')](function(_0x4471ea){if(!_0x4471ea){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4471ea[_0xffee('0x14')]){throw new Error(_0xffee('0x44'));}if(_0x4471ea['blocked']){if(moment(_0x4471ea[_0xffee('0x15')])[_0xffee('0x1f')](_0x201096[_0xffee('0xd')],_0xffee('0x1d'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x4471ea['blocked']=![];_0x4471ea[_0xffee('0x15')]=null;}}_0x4471ea[_0xffee('0x45')]=_0x12ab5e;_0x4471ea['resetPasswordExpires']=Date[_0xffee('0x46')]()+0x36ee80;return _0x4471ea['save']();})[_0xffee('0xe')](function(){return sendServiceMail({'to':_0x86ee30[_0xffee('0x40')][_0xffee('0x24')],'subject':_0xffee('0x47'),'text':_0xffee('0x48')+_0xffee('0x49')+_0xffee('0x4a')+_0x86ee30['headers'][_0xffee('0x29')]+'/reset/'+_0x12ab5e+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xffee('0xe')](function(){_0x3e01b2[_0xffee('0x36')](0xc8)[_0xffee('0x37')]({'message':_0xffee('0x4b')});})[_0xffee('0x21')](function(_0x301fdb){return handleError(_0x3e01b2,0x1f4,_0x301fdb);});};exports[_0xffee('0x4c')]=function(_0x54e33b,_0x59a529,_0x33b66d){var _0xbfc129;return db['User'][_0xffee('0x23')]({'where':{'resetPasswordToken':_0x54e33b['params'][_0xffee('0x4d')],'resetPasswordExpires':{'$gt':Date[_0xffee('0x46')]()}}})[_0xffee('0xe')](function(_0x3ad67f){_0xbfc129=_0x3ad67f;if(!_0xbfc129){throw new Error(_0xffee('0x4e'));}return db[_0xffee('0x42')][_0xffee('0xf')]({'attributes':['id',_0xffee('0x4f')]});})['then'](function(_0x1a2d15){return checkPasswordPattern(_0x1a2d15,_0x54e33b['body']['password'],_0x1a2d15[_0xffee('0x4f')]);})[_0xffee('0xe')](function(){_0xbfc129[_0xffee('0x11')]=_0x54e33b[_0xffee('0x40')][_0xffee('0x11')];_0xbfc129['resetPasswordToken']=null;_0xbfc129[_0xffee('0x50')]=null;return _0xbfc129[_0xffee('0x51')]();})[_0xffee('0xe')](function(){_0x59a529[_0xffee('0x36')](0xc8)[_0xffee('0x37')]({'message':'Password\x20reset!'});})[_0xffee('0x21')](function(_0x418e04){return handleError(_0x59a529,0x1f4,_0x418e04);});};passport[_0xffee('0x52')](new LocalStrategy({'usernameField':'name','passwordField':_0xffee('0x11')},function(_0x43f85f,_0x134ce9,_0x4a3fc4){return localAuthenticate(db['User'],_0x43f85f,_0x134ce9,_0x4a3fc4);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 46061c7..26e7ac1 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 _0x28ba=['post','login','forgot','/reset/:token','exports','express','Router','./authLocal.controller'];(function(_0x50a864,_0x3303e2){var _0x2fb82f=function(_0x2dc650){while(--_0x2dc650){_0x50a864['push'](_0x50a864['shift']());}};_0x2fb82f(++_0x3303e2);}(_0x28ba,0x1b5));var _0xa28b=function(_0x12d559,_0x877cdb){_0x12d559=_0x12d559-0x0;var _0x5d7e5b=_0x28ba[_0x12d559];return _0x5d7e5b;};'use strict';var express=require(_0xa28b('0x0'));var router=express[_0xa28b('0x1')]();var controller=require(_0xa28b('0x2'));router[_0xa28b('0x3')]('/',controller[_0xa28b('0x4')]);router['post']('/forgot',controller[_0xa28b('0x5')]);router[_0xa28b('0x3')](_0xa28b('0x6'),controller['reset']);module[_0xa28b('0x7')]=router; \ No newline at end of file +var _0x1fab=['/reset/:token','reset','express','Router','./authLocal.controller','post','/forgot','forgot'];(function(_0x3dc597,_0x388c60){var _0x1d2b37=function(_0x504ea5){while(--_0x504ea5){_0x3dc597['push'](_0x3dc597['shift']());}};_0x1d2b37(++_0x388c60);}(_0x1fab,0x152));var _0xb1fa=function(_0x60703,_0xe41c27){_0x60703=_0x60703-0x0;var _0x53fbaa=_0x1fab[_0x60703];return _0x53fbaa;};'use strict';var express=require(_0xb1fa('0x0'));var router=express[_0xb1fa('0x1')]();var controller=require(_0xb1fa('0x2'));router['post']('/',controller['login']);router[_0xb1fa('0x3')](_0xb1fa('0x4'),controller[_0xb1fa('0x5')]);router[_0xb1fa('0x3')](_0xb1fa('0x6'),controller[_0xb1fa('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c31b10f..4ab6cb7 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 _0x8f95=['sequelize','STRING','BOOLEAN'];(function(_0x22a5f4,_0x213efc){var _0x113055=function(_0x33f12a){while(--_0x33f12a){_0x22a5f4['push'](_0x22a5f4['shift']());}};_0x113055(++_0x213efc);}(_0x8f95,0x1b9));var _0x58f9=function(_0x15bd71,_0x4dee88){_0x15bd71=_0x15bd71-0x0;var _0x186ffd=_0x8f95[_0x15bd71];return _0x186ffd;};'use strict';var Sequelize=require(_0x58f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x58f9('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x58f9('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xd7a0=['STRING','INTEGER','sequelize'];(function(_0x1bd0ea,_0x25beef){var _0x80b55c=function(_0x52b652){while(--_0x52b652){_0x1bd0ea['push'](_0x1bd0ea['shift']());}};_0x80b55c(++_0x25beef);}(_0xd7a0,0xf8));var _0x0d7a=function(_0x2d944e,_0x39d216){_0x2d944e=_0x2d944e-0x0;var _0x449783=_0xd7a0[_0x2d944e];return _0x449783;};'use strict';var Sequelize=require(_0x0d7a('0x0'));module['exports']={'name':{'type':Sequelize[_0x0d7a('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0d7a('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 93078fc..3969daa 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 _0x09f8=['attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','catch','params','include','find','create','body','addConditions','ids','omit','getConditions','findOne','Condition','order','addActions','Action','getActions','rawAttributes','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','fieldName','type','key','model','query','keys','intersection','fields','length'];(function(_0x43693c,_0x4d888c){var _0x175d7a=function(_0x1e958a){while(--_0x1e958a){_0x43693c['push'](_0x43693c['shift']());}};_0x175d7a(++_0x4d888c);}(_0x09f8,0x72));var _0x809f=function(_0x2085fd,_0x260ccc){_0x2085fd=_0x2085fd-0x0;var _0x557ab3=_0x09f8[_0x2085fd];return _0x557ab3;};'use strict';var pdf=require(_0x809f('0x0'));var emlformat=require(_0x809f('0x1'));var rimraf=require(_0x809f('0x2'));var zipdir=require(_0x809f('0x3'));var jsonpatch=require(_0x809f('0x4'));var rp=require(_0x809f('0x5'));var moment=require(_0x809f('0x6'));var BPromise=require(_0x809f('0x7'));var Mustache=require(_0x809f('0x8'));var util=require('util');var path=require(_0x809f('0x9'));var sox=require(_0x809f('0xa'));var csv=require(_0x809f('0xb'));var ejs=require(_0x809f('0xc'));var fs=require('fs');var _=require(_0x809f('0xd'));var squel=require(_0x809f('0xe'));var crypto=require(_0x809f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x809f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x809f('0x11'));var Papa=require('papaparse');var Redis=require(_0x809f('0x12'));var authService=require(_0x809f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x809f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x809f('0x15'))(_0x809f('0x16'));var utils=require(_0x809f('0x17'));var config=require(_0x809f('0x18'));var db=require(_0x809f('0x19'))['db'];function respondWithStatusCode(_0x3f1983,_0x31789c){_0x31789c=_0x31789c||0xcc;return function(_0x2e026c){if(_0x2e026c){return _0x3f1983['sendStatus'](_0x31789c);}return _0x3f1983[_0x809f('0x1a')](_0x31789c)[_0x809f('0x1b')]();};}function respondWithResult(_0x2a6d82,_0x802a81){_0x802a81=_0x802a81||0xc8;return function(_0x234683){if(_0x234683){return _0x2a6d82['status'](_0x802a81)[_0x809f('0x1c')](_0x234683);}};}function respondWithFilteredResult(_0x2947c5,_0x5cebb9){return function(_0x593d45){if(_0x593d45){var _0x12426d=_0x593d45['count'],_0x20e67a=_0x5cebb9[_0x809f('0x1d')],_0x1f398b=_0x5cebb9['offset']+_0x5cebb9[_0x809f('0x1e')],_0x15b412;if(_0x1f398b>=_0x12426d){_0x1f398b=_0x12426d;_0x15b412=0xc8;}else{_0x15b412=0xce;}_0x2947c5[_0x809f('0x1a')](_0x15b412);return _0x2947c5[_0x809f('0x1f')]('Content-Range',_0x20e67a+'-'+_0x1f398b+'/'+_0x12426d)[_0x809f('0x1c')](_0x593d45);}return null;};}function patchUpdates(_0xcfa46d){return function(_0x28e7aa){try{jsonpatch[_0x809f('0x20')](_0x28e7aa,_0xcfa46d,!![]);}catch(_0x262896){return BPromise['reject'](_0x262896);}return _0x28e7aa[_0x809f('0x21')]();};}function saveUpdates(_0x23e8b7,_0x5f36e8){return function(_0x55b55a){if(_0x55b55a){return _0x55b55a[_0x809f('0x22')](_0x23e8b7)[_0x809f('0x23')](function(_0x32b1b7){return _0x32b1b7;});}return null;};}function removeEntity(_0x1192f5,_0x2df940){return function(_0x507c17){if(_0x507c17){return _0x507c17[_0x809f('0x24')]()[_0x809f('0x23')](function(){_0x1192f5['status'](0xcc)[_0x809f('0x1b')]();});}};}function handleEntityNotFound(_0x15831d,_0xe3f473){return function(_0x1556ba){if(!_0x1556ba){_0x15831d[_0x809f('0x25')](0x194);}return _0x1556ba;};}function handleError(_0x5f0fe4,_0x4df571){_0x4df571=_0x4df571||0x1f4;return function(_0x265d25){logger[_0x809f('0x26')](_0x265d25[_0x809f('0x27')]);if(_0x265d25[_0x809f('0x28')]){delete _0x265d25[_0x809f('0x28')];}_0x5f0fe4[_0x809f('0x1a')](_0x4df571)[_0x809f('0x29')](_0x265d25);};}exports[_0x809f('0x2a')]=function(_0x9076f7,_0x18aa03){var _0x46bf02={},_0x282d73={},_0x17aa25={'count':0x0,'rows':[]};var _0xf4ea49=_[_0x809f('0x2b')](db[_0x809f('0x2c')]['rawAttributes'],function(_0x592107){return{'name':_0x592107[_0x809f('0x2d')],'type':_0x592107[_0x809f('0x2e')][_0x809f('0x2f')]};});_0x282d73[_0x809f('0x30')]=_[_0x809f('0x2b')](_0xf4ea49,_0x809f('0x28'));_0x282d73[_0x809f('0x31')]=_[_0x809f('0x32')](_0x9076f7[_0x809f('0x31')]);_0x282d73['filters']=_[_0x809f('0x33')](_0x282d73[_0x809f('0x30')],_0x282d73[_0x809f('0x31')]);_0x46bf02['attributes']=_[_0x809f('0x33')](_0x282d73[_0x809f('0x30')],qs[_0x809f('0x34')](_0x9076f7[_0x809f('0x31')][_0x809f('0x34')]));_0x46bf02['attributes']=_0x46bf02['attributes'][_0x809f('0x35')]?_0x46bf02[_0x809f('0x36')]:_0x282d73['model'];if(!_0x9076f7['query'][_0x809f('0x37')](_0x809f('0x38'))){_0x46bf02[_0x809f('0x1e')]=qs[_0x809f('0x1e')](_0x9076f7[_0x809f('0x31')][_0x809f('0x1e')]);_0x46bf02['offset']=qs[_0x809f('0x1d')](_0x9076f7[_0x809f('0x31')][_0x809f('0x1d')]);}_0x46bf02['order']=qs[_0x809f('0x39')](_0x9076f7[_0x809f('0x31')]['sort']);_0x46bf02[_0x809f('0x3a')]=qs[_0x809f('0x3b')](_[_0x809f('0x3c')](_0x9076f7[_0x809f('0x31')],_0x282d73[_0x809f('0x3b')]),_0xf4ea49);if(_0x9076f7[_0x809f('0x31')][_0x809f('0x3d')]){_0x46bf02[_0x809f('0x3a')]=_[_0x809f('0x3e')](_0x46bf02['where'],{'$or':_[_0x809f('0x2b')](_0xf4ea49,function(_0x1e9a45){if(_0x1e9a45[_0x809f('0x2e')]!==_0x809f('0x3f')){var _0x34a631={};_0x34a631[_0x1e9a45[_0x809f('0x28')]]={'$like':'%'+_0x9076f7[_0x809f('0x31')]['filter']+'%'};return _0x34a631;}})});}_0x46bf02=_[_0x809f('0x3e')]({},_0x46bf02,_0x9076f7[_0x809f('0x40')]);var _0x2762c3={'where':_0x46bf02[_0x809f('0x3a')]};return db['Automation'][_0x809f('0x41')](_0x2762c3)[_0x809f('0x23')](function(_0x194e22){_0x17aa25['count']=_0x194e22;if(_0x9076f7[_0x809f('0x31')][_0x809f('0x42')]){_0x46bf02['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x46bf02);})[_0x809f('0x23')](function(_0x53ded3){_0x17aa25['rows']=_0x53ded3;return _0x17aa25;})[_0x809f('0x23')](respondWithFilteredResult(_0x18aa03,_0x46bf02))[_0x809f('0x43')](handleError(_0x18aa03,null));};exports['show']=function(_0x4886d7,_0x3b3fe0){var _0x1b2e91={'raw':![],'where':{'id':_0x4886d7[_0x809f('0x44')]['id']}},_0x2ba911={};_0x2ba911[_0x809f('0x30')]=_[_0x809f('0x32')](db['Automation']['rawAttributes']);_0x2ba911[_0x809f('0x31')]=_[_0x809f('0x32')](_0x4886d7['query']);_0x2ba911['filters']=_['intersection'](_0x2ba911[_0x809f('0x30')],_0x2ba911[_0x809f('0x31')]);_0x1b2e91['attributes']=_[_0x809f('0x33')](_0x2ba911[_0x809f('0x30')],qs[_0x809f('0x34')](_0x4886d7[_0x809f('0x31')][_0x809f('0x34')]));_0x1b2e91[_0x809f('0x36')]=_0x1b2e91['attributes'][_0x809f('0x35')]?_0x1b2e91[_0x809f('0x36')]:_0x2ba911['model'];if(_0x4886d7['query'][_0x809f('0x42')]){_0x1b2e91[_0x809f('0x45')]=[{'all':!![]}];}_0x1b2e91=_['merge']({},_0x1b2e91,_0x4886d7[_0x809f('0x40')]);return db[_0x809f('0x2c')][_0x809f('0x46')](_0x1b2e91)[_0x809f('0x23')](handleEntityNotFound(_0x3b3fe0,null))[_0x809f('0x23')](respondWithResult(_0x3b3fe0,null))[_0x809f('0x43')](handleError(_0x3b3fe0,null));};exports['create']=function(_0x586622,_0x4ebeea){return db['Automation'][_0x809f('0x47')](_0x586622[_0x809f('0x48')],{})[_0x809f('0x23')](respondWithResult(_0x4ebeea,0xc9))[_0x809f('0x43')](handleError(_0x4ebeea,null));};exports['update']=function(_0x327ab8,_0x4f06db){if(_0x327ab8['body']['id']){delete _0x327ab8['body']['id'];}return db[_0x809f('0x2c')][_0x809f('0x46')]({'where':{'id':_0x327ab8[_0x809f('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f06db,null))[_0x809f('0x23')](saveUpdates(_0x327ab8[_0x809f('0x48')],null))[_0x809f('0x23')](respondWithResult(_0x4f06db,null))[_0x809f('0x43')](handleError(_0x4f06db,null));};exports[_0x809f('0x24')]=function(_0x94e9b9,_0xcfe95c){return db[_0x809f('0x2c')]['find']({'where':{'id':_0x94e9b9[_0x809f('0x44')]['id']}})[_0x809f('0x23')](handleEntityNotFound(_0xcfe95c,null))['then'](removeEntity(_0xcfe95c,null))['catch'](handleError(_0xcfe95c,null));};exports[_0x809f('0x49')]=function(_0x5c8bb3,_0xf9131f,_0x5ebaee){return db['Condition'][_0x809f('0x46')]({'where':{'id':_0x5c8bb3[_0x809f('0x44')]['id']}})[_0x809f('0x23')](handleEntityNotFound(_0xf9131f,null))[_0x809f('0x23')](function(_0x14b651){if(_0x14b651){return _0x14b651['addConditions'](_0x5c8bb3[_0x809f('0x48')][_0x809f('0x4a')],_[_0x809f('0x4b')](_0x5c8bb3[_0x809f('0x48')],[_0x809f('0x4a'),'id'])||{});}})[_0x809f('0x23')](respondWithResult(_0xf9131f,null))[_0x809f('0x43')](handleError(_0xf9131f,null));};exports[_0x809f('0x4c')]=function(_0x286ec2,_0x13be23,_0x32bef7){var _0x35312d={};var _0xbb2b87={};var _0xb0b13f;var _0x1c42a5;return db['Automation'][_0x809f('0x4d')]({'where':{'id':_0x286ec2[_0x809f('0x44')]['id']}})[_0x809f('0x23')](handleEntityNotFound(_0x13be23,null))[_0x809f('0x23')](function(_0x4a65cc){if(_0x4a65cc){_0xb0b13f=_0x4a65cc;_0xbb2b87[_0x809f('0x30')]=_['keys'](db[_0x809f('0x4e')]['rawAttributes']);_0xbb2b87[_0x809f('0x31')]=_[_0x809f('0x32')](_0x286ec2[_0x809f('0x31')]);_0xbb2b87[_0x809f('0x3b')]=_[_0x809f('0x33')](_0xbb2b87['model'],_0xbb2b87[_0x809f('0x31')]);_0x35312d['attributes']=_[_0x809f('0x33')](_0xbb2b87[_0x809f('0x30')],qs[_0x809f('0x34')](_0x286ec2[_0x809f('0x31')][_0x809f('0x34')]));_0x35312d[_0x809f('0x36')]=_0x35312d[_0x809f('0x36')][_0x809f('0x35')]?_0x35312d[_0x809f('0x36')]:_0xbb2b87[_0x809f('0x30')];_0x35312d[_0x809f('0x4f')]=qs[_0x809f('0x39')](_0x286ec2[_0x809f('0x31')]['sort']);_0x35312d[_0x809f('0x3a')]=qs[_0x809f('0x3b')](_[_0x809f('0x3c')](_0x286ec2[_0x809f('0x31')],_0xbb2b87[_0x809f('0x3b')]));if(_0x286ec2[_0x809f('0x31')][_0x809f('0x3d')]){_0x35312d['where']=_[_0x809f('0x3e')](_0x35312d['where'],{'$or':_[_0x809f('0x2b')](_0x35312d[_0x809f('0x36')],function(_0x1c8d60){var _0x5a71c9={};_0x5a71c9[_0x1c8d60]={'$like':'%'+_0x286ec2[_0x809f('0x31')][_0x809f('0x3d')]+'%'};return _0x5a71c9;})});}_0x35312d=_['merge']({},_0x35312d,_0x286ec2[_0x809f('0x40')]);return _0xb0b13f['getConditions'](_0x35312d);}})[_0x809f('0x23')](function(_0x34a531){if(_0x34a531){_0x1c42a5=_0x34a531[_0x809f('0x35')];if(!_0x286ec2[_0x809f('0x31')][_0x809f('0x37')](_0x809f('0x38'))){_0x35312d[_0x809f('0x1e')]=qs[_0x809f('0x1e')](_0x286ec2[_0x809f('0x31')][_0x809f('0x1e')]);_0x35312d[_0x809f('0x1d')]=qs[_0x809f('0x1d')](_0x286ec2[_0x809f('0x31')][_0x809f('0x1d')]);}return _0xb0b13f[_0x809f('0x4c')](_0x35312d);}})[_0x809f('0x23')](function(_0x541381){if(_0x541381){return _0x541381?{'count':_0x1c42a5,'rows':_0x541381}:null;}})[_0x809f('0x23')](respondWithResult(_0x13be23,null))[_0x809f('0x43')](handleError(_0x13be23,null));};exports[_0x809f('0x50')]=function(_0xd7a14d,_0x4f4b09,_0x4b75a0){return db[_0x809f('0x51')][_0x809f('0x46')]({'where':{'id':_0xd7a14d['params']['id']}})['then'](handleEntityNotFound(_0x4f4b09,null))[_0x809f('0x23')](function(_0x1e630c){if(_0x1e630c){return _0x1e630c[_0x809f('0x50')](_0xd7a14d[_0x809f('0x48')]['ids'],_['omit'](_0xd7a14d[_0x809f('0x48')],[_0x809f('0x4a'),'id'])||{});}})[_0x809f('0x23')](respondWithResult(_0x4f4b09,null))['catch'](handleError(_0x4f4b09,null));};exports[_0x809f('0x52')]=function(_0x4d8c31,_0x31e60f,_0x17a7c8){var _0x2d2363={};var _0x981d82={};var _0x34210b;var _0x3740c2;return db[_0x809f('0x2c')]['findOne']({'where':{'id':_0x4d8c31[_0x809f('0x44')]['id']}})[_0x809f('0x23')](handleEntityNotFound(_0x31e60f,null))['then'](function(_0x528628){if(_0x528628){_0x34210b=_0x528628;_0x981d82[_0x809f('0x30')]=_[_0x809f('0x32')](db[_0x809f('0x51')][_0x809f('0x53')]);_0x981d82['query']=_[_0x809f('0x32')](_0x4d8c31['query']);_0x981d82['filters']=_[_0x809f('0x33')](_0x981d82['model'],_0x981d82['query']);_0x2d2363[_0x809f('0x36')]=_['intersection'](_0x981d82[_0x809f('0x30')],qs[_0x809f('0x34')](_0x4d8c31[_0x809f('0x31')][_0x809f('0x34')]));_0x2d2363['attributes']=_0x2d2363[_0x809f('0x36')][_0x809f('0x35')]?_0x2d2363[_0x809f('0x36')]:_0x981d82[_0x809f('0x30')];_0x2d2363[_0x809f('0x4f')]=qs[_0x809f('0x39')](_0x4d8c31[_0x809f('0x31')]['sort']);_0x2d2363['where']=qs[_0x809f('0x3b')](_[_0x809f('0x3c')](_0x4d8c31[_0x809f('0x31')],_0x981d82['filters']));if(_0x4d8c31[_0x809f('0x31')][_0x809f('0x3d')]){_0x2d2363[_0x809f('0x3a')]=_[_0x809f('0x3e')](_0x2d2363[_0x809f('0x3a')],{'$or':_[_0x809f('0x2b')](_0x2d2363[_0x809f('0x36')],function(_0x3736f2){var _0x24ae06={};_0x24ae06[_0x3736f2]={'$like':'%'+_0x4d8c31[_0x809f('0x31')][_0x809f('0x3d')]+'%'};return _0x24ae06;})});}_0x2d2363=_[_0x809f('0x3e')]({},_0x2d2363,_0x4d8c31[_0x809f('0x40')]);return _0x34210b['getActions'](_0x2d2363);}})[_0x809f('0x23')](function(_0x43f771){if(_0x43f771){_0x3740c2=_0x43f771[_0x809f('0x35')];if(!_0x4d8c31['query']['hasOwnProperty'](_0x809f('0x38'))){_0x2d2363[_0x809f('0x1e')]=qs[_0x809f('0x1e')](_0x4d8c31[_0x809f('0x31')][_0x809f('0x1e')]);_0x2d2363['offset']=qs['offset'](_0x4d8c31['query']['offset']);}return _0x34210b[_0x809f('0x52')](_0x2d2363);}})[_0x809f('0x23')](function(_0xe5d0fe){if(_0xe5d0fe){return _0xe5d0fe?{'count':_0x3740c2,'rows':_0xe5d0fe}:null;}})[_0x809f('0x23')](respondWithResult(_0x31e60f,null))[_0x809f('0x43')](handleError(_0x31e60f,null));}; \ No newline at end of file +var _0x26ec=['Condition','ids','omit','getConditions','findOne','Action','addActions','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Automation','includeAll','findAll','rows','catch','params','include','find','create','body','addConditions'];(function(_0x1ccad3,_0x5bae85){var _0x3d1654=function(_0x460d7d){while(--_0x460d7d){_0x1ccad3['push'](_0x1ccad3['shift']());}};_0x3d1654(++_0x5bae85);}(_0x26ec,0x1c0));var _0xc26e=function(_0x28564b,_0x53b2b2){_0x28564b=_0x28564b-0x0;var _0x3e302f=_0x26ec[_0x28564b];return _0x3e302f;};'use strict';var pdf=require(_0xc26e('0x0'));var emlformat=require(_0xc26e('0x1'));var rimraf=require(_0xc26e('0x2'));var zipdir=require(_0xc26e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc26e('0x4'));var moment=require(_0xc26e('0x5'));var BPromise=require(_0xc26e('0x6'));var Mustache=require(_0xc26e('0x7'));var util=require(_0xc26e('0x8'));var path=require(_0xc26e('0x9'));var sox=require(_0xc26e('0xa'));var csv=require(_0xc26e('0xb'));var ejs=require(_0xc26e('0xc'));var fs=require('fs');var _=require(_0xc26e('0xd'));var squel=require(_0xc26e('0xe'));var crypto=require(_0xc26e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc26e('0x10'));var toCsv=require(_0xc26e('0xb'));var querystring=require(_0xc26e('0x11'));var Papa=require(_0xc26e('0x12'));var Redis=require(_0xc26e('0x13'));var authService=require(_0xc26e('0x14'));var qs=require(_0xc26e('0x15'));var as=require(_0xc26e('0x16'));var hardwareService=require(_0xc26e('0x17'));var logger=require('../../config/logger')(_0xc26e('0x18'));var utils=require(_0xc26e('0x19'));var config=require(_0xc26e('0x1a'));var db=require(_0xc26e('0x1b'))['db'];function respondWithStatusCode(_0xb06d13,_0x36b162){_0x36b162=_0x36b162||0xcc;return function(_0x4a516c){if(_0x4a516c){return _0xb06d13[_0xc26e('0x1c')](_0x36b162);}return _0xb06d13[_0xc26e('0x1d')](_0x36b162)[_0xc26e('0x1e')]();};}function respondWithResult(_0x14999e,_0x472926){_0x472926=_0x472926||0xc8;return function(_0x1a32cc){if(_0x1a32cc){return _0x14999e[_0xc26e('0x1d')](_0x472926)[_0xc26e('0x1f')](_0x1a32cc);}};}function respondWithFilteredResult(_0x277585,_0x244d7b){return function(_0x23b327){if(_0x23b327){var _0x43f245=_0x23b327[_0xc26e('0x20')],_0x444bd9=_0x244d7b[_0xc26e('0x21')],_0xb81fba=_0x244d7b[_0xc26e('0x21')]+_0x244d7b[_0xc26e('0x22')],_0x3aa373;if(_0xb81fba>=_0x43f245){_0xb81fba=_0x43f245;_0x3aa373=0xc8;}else{_0x3aa373=0xce;}_0x277585['status'](_0x3aa373);return _0x277585[_0xc26e('0x23')]('Content-Range',_0x444bd9+'-'+_0xb81fba+'/'+_0x43f245)[_0xc26e('0x1f')](_0x23b327);}return null;};}function patchUpdates(_0x6f727f){return function(_0x17fc1e){try{jsonpatch[_0xc26e('0x24')](_0x17fc1e,_0x6f727f,!![]);}catch(_0x4ef50a){return BPromise[_0xc26e('0x25')](_0x4ef50a);}return _0x17fc1e[_0xc26e('0x26')]();};}function saveUpdates(_0x44923f,_0x3ce12e){return function(_0x5b1087){if(_0x5b1087){return _0x5b1087[_0xc26e('0x27')](_0x44923f)[_0xc26e('0x28')](function(_0x2e0bd0){return _0x2e0bd0;});}return null;};}function removeEntity(_0x15e9b6,_0x49d542){return function(_0x4f133a){if(_0x4f133a){return _0x4f133a[_0xc26e('0x29')]()['then'](function(){_0x15e9b6[_0xc26e('0x1d')](0xcc)[_0xc26e('0x1e')]();});}};}function handleEntityNotFound(_0x57a115,_0x12067d){return function(_0x4b252){if(!_0x4b252){_0x57a115[_0xc26e('0x1c')](0x194);}return _0x4b252;};}function handleError(_0x34d460,_0x4b8f8f){_0x4b8f8f=_0x4b8f8f||0x1f4;return function(_0x6f9cd4){logger[_0xc26e('0x2a')](_0x6f9cd4['stack']);if(_0x6f9cd4[_0xc26e('0x2b')]){delete _0x6f9cd4[_0xc26e('0x2b')];}_0x34d460[_0xc26e('0x1d')](_0x4b8f8f)[_0xc26e('0x2c')](_0x6f9cd4);};}exports[_0xc26e('0x2d')]=function(_0x173cc3,_0x2a86d5){var _0x28f094={},_0x91ca4b={},_0x261356={'count':0x0,'rows':[]};var _0x11472c=_['map'](db['Automation'][_0xc26e('0x2e')],function(_0x28163c){return{'name':_0x28163c[_0xc26e('0x2f')],'type':_0x28163c[_0xc26e('0x30')][_0xc26e('0x31')]};});_0x91ca4b[_0xc26e('0x32')]=_[_0xc26e('0x33')](_0x11472c,_0xc26e('0x2b'));_0x91ca4b['query']=_[_0xc26e('0x34')](_0x173cc3[_0xc26e('0x35')]);_0x91ca4b['filters']=_[_0xc26e('0x36')](_0x91ca4b[_0xc26e('0x32')],_0x91ca4b[_0xc26e('0x35')]);_0x28f094['attributes']=_[_0xc26e('0x36')](_0x91ca4b[_0xc26e('0x32')],qs['fields'](_0x173cc3[_0xc26e('0x35')][_0xc26e('0x37')]));_0x28f094[_0xc26e('0x38')]=_0x28f094[_0xc26e('0x38')][_0xc26e('0x39')]?_0x28f094['attributes']:_0x91ca4b[_0xc26e('0x32')];if(!_0x173cc3['query'][_0xc26e('0x3a')](_0xc26e('0x3b'))){_0x28f094['limit']=qs[_0xc26e('0x22')](_0x173cc3[_0xc26e('0x35')]['limit']);_0x28f094[_0xc26e('0x21')]=qs[_0xc26e('0x21')](_0x173cc3['query'][_0xc26e('0x21')]);}_0x28f094[_0xc26e('0x3c')]=qs[_0xc26e('0x3d')](_0x173cc3[_0xc26e('0x35')][_0xc26e('0x3d')]);_0x28f094[_0xc26e('0x3e')]=qs[_0xc26e('0x3f')](_[_0xc26e('0x40')](_0x173cc3['query'],_0x91ca4b['filters']),_0x11472c);if(_0x173cc3['query'][_0xc26e('0x41')]){_0x28f094[_0xc26e('0x3e')]=_[_0xc26e('0x42')](_0x28f094[_0xc26e('0x3e')],{'$or':_[_0xc26e('0x33')](_0x11472c,function(_0x468a44){if(_0x468a44['type']!==_0xc26e('0x43')){var _0x250b70={};_0x250b70[_0x468a44[_0xc26e('0x2b')]]={'$like':'%'+_0x173cc3[_0xc26e('0x35')][_0xc26e('0x41')]+'%'};return _0x250b70;}})});}_0x28f094=_['merge']({},_0x28f094,_0x173cc3[_0xc26e('0x44')]);var _0x2366d4={'where':_0x28f094[_0xc26e('0x3e')]};return db[_0xc26e('0x45')][_0xc26e('0x20')](_0x2366d4)[_0xc26e('0x28')](function(_0x2a03a5){_0x261356[_0xc26e('0x20')]=_0x2a03a5;if(_0x173cc3[_0xc26e('0x35')][_0xc26e('0x46')]){_0x28f094['include']=[{'all':!![]}];}return db['Automation'][_0xc26e('0x47')](_0x28f094);})[_0xc26e('0x28')](function(_0x17647f){_0x261356[_0xc26e('0x48')]=_0x17647f;return _0x261356;})['then'](respondWithFilteredResult(_0x2a86d5,_0x28f094))[_0xc26e('0x49')](handleError(_0x2a86d5,null));};exports['show']=function(_0x2eb3f0,_0x19a458){var _0x59e48c={'raw':![],'where':{'id':_0x2eb3f0[_0xc26e('0x4a')]['id']}},_0x2416dc={};_0x2416dc[_0xc26e('0x32')]=_[_0xc26e('0x34')](db[_0xc26e('0x45')]['rawAttributes']);_0x2416dc[_0xc26e('0x35')]=_[_0xc26e('0x34')](_0x2eb3f0[_0xc26e('0x35')]);_0x2416dc[_0xc26e('0x3f')]=_[_0xc26e('0x36')](_0x2416dc[_0xc26e('0x32')],_0x2416dc['query']);_0x59e48c[_0xc26e('0x38')]=_['intersection'](_0x2416dc[_0xc26e('0x32')],qs[_0xc26e('0x37')](_0x2eb3f0[_0xc26e('0x35')][_0xc26e('0x37')]));_0x59e48c[_0xc26e('0x38')]=_0x59e48c['attributes'][_0xc26e('0x39')]?_0x59e48c[_0xc26e('0x38')]:_0x2416dc[_0xc26e('0x32')];if(_0x2eb3f0[_0xc26e('0x35')][_0xc26e('0x46')]){_0x59e48c[_0xc26e('0x4b')]=[{'all':!![]}];}_0x59e48c=_[_0xc26e('0x42')]({},_0x59e48c,_0x2eb3f0[_0xc26e('0x44')]);return db[_0xc26e('0x45')][_0xc26e('0x4c')](_0x59e48c)[_0xc26e('0x28')](handleEntityNotFound(_0x19a458,null))[_0xc26e('0x28')](respondWithResult(_0x19a458,null))[_0xc26e('0x49')](handleError(_0x19a458,null));};exports[_0xc26e('0x4d')]=function(_0x32ba32,_0x5f28ba){return db[_0xc26e('0x45')][_0xc26e('0x4d')](_0x32ba32[_0xc26e('0x4e')],{})[_0xc26e('0x28')](respondWithResult(_0x5f28ba,0xc9))[_0xc26e('0x49')](handleError(_0x5f28ba,null));};exports[_0xc26e('0x27')]=function(_0x153e7e,_0x320696){if(_0x153e7e[_0xc26e('0x4e')]['id']){delete _0x153e7e[_0xc26e('0x4e')]['id'];}return db[_0xc26e('0x45')][_0xc26e('0x4c')]({'where':{'id':_0x153e7e['params']['id']}})['then'](handleEntityNotFound(_0x320696,null))[_0xc26e('0x28')](saveUpdates(_0x153e7e['body'],null))[_0xc26e('0x28')](respondWithResult(_0x320696,null))[_0xc26e('0x49')](handleError(_0x320696,null));};exports[_0xc26e('0x29')]=function(_0x4ae355,_0x2065a1){return db['Automation']['find']({'where':{'id':_0x4ae355[_0xc26e('0x4a')]['id']}})[_0xc26e('0x28')](handleEntityNotFound(_0x2065a1,null))[_0xc26e('0x28')](removeEntity(_0x2065a1,null))['catch'](handleError(_0x2065a1,null));};exports[_0xc26e('0x4f')]=function(_0x21dd70,_0x22f833,_0x256622){return db[_0xc26e('0x50')][_0xc26e('0x4c')]({'where':{'id':_0x21dd70[_0xc26e('0x4a')]['id']}})[_0xc26e('0x28')](handleEntityNotFound(_0x22f833,null))[_0xc26e('0x28')](function(_0x3474f8){if(_0x3474f8){return _0x3474f8[_0xc26e('0x4f')](_0x21dd70[_0xc26e('0x4e')][_0xc26e('0x51')],_[_0xc26e('0x52')](_0x21dd70[_0xc26e('0x4e')],[_0xc26e('0x51'),'id'])||{});}})[_0xc26e('0x28')](respondWithResult(_0x22f833,null))[_0xc26e('0x49')](handleError(_0x22f833,null));};exports[_0xc26e('0x53')]=function(_0x4e5fa3,_0x3c4290,_0x24e58b){var _0x4ab14e={};var _0x2bbea6={};var _0x5f555e;var _0x23369a;return db[_0xc26e('0x45')][_0xc26e('0x54')]({'where':{'id':_0x4e5fa3['params']['id']}})[_0xc26e('0x28')](handleEntityNotFound(_0x3c4290,null))['then'](function(_0x17cb11){if(_0x17cb11){_0x5f555e=_0x17cb11;_0x2bbea6[_0xc26e('0x32')]=_[_0xc26e('0x34')](db[_0xc26e('0x50')][_0xc26e('0x2e')]);_0x2bbea6[_0xc26e('0x35')]=_[_0xc26e('0x34')](_0x4e5fa3[_0xc26e('0x35')]);_0x2bbea6['filters']=_['intersection'](_0x2bbea6[_0xc26e('0x32')],_0x2bbea6[_0xc26e('0x35')]);_0x4ab14e['attributes']=_[_0xc26e('0x36')](_0x2bbea6[_0xc26e('0x32')],qs['fields'](_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x37')]));_0x4ab14e[_0xc26e('0x38')]=_0x4ab14e[_0xc26e('0x38')]['length']?_0x4ab14e[_0xc26e('0x38')]:_0x2bbea6[_0xc26e('0x32')];_0x4ab14e['order']=qs[_0xc26e('0x3d')](_0x4e5fa3[_0xc26e('0x35')]['sort']);_0x4ab14e[_0xc26e('0x3e')]=qs[_0xc26e('0x3f')](_['pick'](_0x4e5fa3[_0xc26e('0x35')],_0x2bbea6[_0xc26e('0x3f')]));if(_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x41')]){_0x4ab14e[_0xc26e('0x3e')]=_[_0xc26e('0x42')](_0x4ab14e['where'],{'$or':_[_0xc26e('0x33')](_0x4ab14e[_0xc26e('0x38')],function(_0x37be56){var _0x3a3425={};_0x3a3425[_0x37be56]={'$like':'%'+_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x41')]+'%'};return _0x3a3425;})});}_0x4ab14e=_[_0xc26e('0x42')]({},_0x4ab14e,_0x4e5fa3[_0xc26e('0x44')]);return _0x5f555e['getConditions'](_0x4ab14e);}})[_0xc26e('0x28')](function(_0x2dbb69){if(_0x2dbb69){_0x23369a=_0x2dbb69['length'];if(!_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x3a')](_0xc26e('0x3b'))){_0x4ab14e[_0xc26e('0x22')]=qs[_0xc26e('0x22')](_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x22')]);_0x4ab14e[_0xc26e('0x21')]=qs[_0xc26e('0x21')](_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x21')]);}return _0x5f555e[_0xc26e('0x53')](_0x4ab14e);}})['then'](function(_0x40fc89){if(_0x40fc89){return _0x40fc89?{'count':_0x23369a,'rows':_0x40fc89}:null;}})[_0xc26e('0x28')](respondWithResult(_0x3c4290,null))[_0xc26e('0x49')](handleError(_0x3c4290,null));};exports['addActions']=function(_0x4e1101,_0x24a3d1,_0x34f2f0){return db[_0xc26e('0x55')][_0xc26e('0x4c')]({'where':{'id':_0x4e1101[_0xc26e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24a3d1,null))[_0xc26e('0x28')](function(_0x460a0c){if(_0x460a0c){return _0x460a0c[_0xc26e('0x56')](_0x4e1101[_0xc26e('0x4e')]['ids'],_[_0xc26e('0x52')](_0x4e1101['body'],[_0xc26e('0x51'),'id'])||{});}})[_0xc26e('0x28')](respondWithResult(_0x24a3d1,null))[_0xc26e('0x49')](handleError(_0x24a3d1,null));};exports[_0xc26e('0x57')]=function(_0x493f40,_0x69531c,_0x12419d){var _0x5ee7ac={};var _0x2a4a79={};var _0x19c446;var _0x39e9ef;return db['Automation'][_0xc26e('0x54')]({'where':{'id':_0x493f40[_0xc26e('0x4a')]['id']}})[_0xc26e('0x28')](handleEntityNotFound(_0x69531c,null))[_0xc26e('0x28')](function(_0x572d93){if(_0x572d93){_0x19c446=_0x572d93;_0x2a4a79[_0xc26e('0x32')]=_[_0xc26e('0x34')](db[_0xc26e('0x55')][_0xc26e('0x2e')]);_0x2a4a79[_0xc26e('0x35')]=_[_0xc26e('0x34')](_0x493f40[_0xc26e('0x35')]);_0x2a4a79[_0xc26e('0x3f')]=_['intersection'](_0x2a4a79['model'],_0x2a4a79[_0xc26e('0x35')]);_0x5ee7ac[_0xc26e('0x38')]=_[_0xc26e('0x36')](_0x2a4a79['model'],qs['fields'](_0x493f40['query']['fields']));_0x5ee7ac[_0xc26e('0x38')]=_0x5ee7ac['attributes'][_0xc26e('0x39')]?_0x5ee7ac[_0xc26e('0x38')]:_0x2a4a79['model'];_0x5ee7ac[_0xc26e('0x3c')]=qs[_0xc26e('0x3d')](_0x493f40[_0xc26e('0x35')]['sort']);_0x5ee7ac[_0xc26e('0x3e')]=qs[_0xc26e('0x3f')](_['pick'](_0x493f40[_0xc26e('0x35')],_0x2a4a79[_0xc26e('0x3f')]));if(_0x493f40['query']['filter']){_0x5ee7ac[_0xc26e('0x3e')]=_['merge'](_0x5ee7ac['where'],{'$or':_[_0xc26e('0x33')](_0x5ee7ac[_0xc26e('0x38')],function(_0x4a40b9){var _0x18d8ba={};_0x18d8ba[_0x4a40b9]={'$like':'%'+_0x493f40[_0xc26e('0x35')][_0xc26e('0x41')]+'%'};return _0x18d8ba;})});}_0x5ee7ac=_[_0xc26e('0x42')]({},_0x5ee7ac,_0x493f40[_0xc26e('0x44')]);return _0x19c446[_0xc26e('0x57')](_0x5ee7ac);}})[_0xc26e('0x28')](function(_0x305cf2){if(_0x305cf2){_0x39e9ef=_0x305cf2[_0xc26e('0x39')];if(!_0x493f40[_0xc26e('0x35')][_0xc26e('0x3a')](_0xc26e('0x3b'))){_0x5ee7ac['limit']=qs[_0xc26e('0x22')](_0x493f40['query']['limit']);_0x5ee7ac['offset']=qs[_0xc26e('0x21')](_0x493f40[_0xc26e('0x35')][_0xc26e('0x21')]);}return _0x19c446['getActions'](_0x5ee7ac);}})[_0xc26e('0x28')](function(_0x353eac){if(_0x353eac){return _0x353eac?{'count':_0x39e9ef,'rows':_0x353eac}:null;}})[_0xc26e('0x28')](respondWithResult(_0x69531c,null))[_0xc26e('0x49')](handleError(_0x69531c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index eebcf68..bf33df1 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_automations','lodash'];(function(_0x2548ca,_0x117ca1){var _0x55dda4=function(_0x294d7d){while(--_0x294d7d){_0x2548ca['push'](_0x2548ca['shift']());}};_0x55dda4(++_0x117ca1);}(_0xabce,0x103));var _0xeabc=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xabce[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./automation.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Automation',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33c5=['Automation','tools_automations','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x33c5,0xe6));var _0x533c=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0x33c5[_0x198446];return _0x38d7b7;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('api');var moment=require(_0x533c('0x2'));var BPromise=require(_0x533c('0x3'));var rp=require(_0x533c('0x4'));var fs=require('fs');var path=require(_0x533c('0x5'));var rimraf=require(_0x533c('0x6'));var config=require('../../config/environment');var attributes=require(_0x533c('0x7'));module[_0x533c('0x8')]=function(_0x31d912,_0x151732){return _0x31d912[_0x533c('0x9')](_0x533c('0xa'),attributes,{'tableName':_0x533c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 440af27..ba74ff9 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 _0xbee8=['info','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x68f8c8,_0x3fff19){var _0x193d6f=function(_0x141a37){while(--_0x141a37){_0x68f8c8['push'](_0x68f8c8['shift']());}};_0x193d6f(++_0x3fff19);}(_0xbee8,0x17a));var _0x8bee=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xbee8[_0xbc1a4b];return _0x108b87;};'use strict';var _=require(_0x8bee('0x0'));var util=require(_0x8bee('0x1'));var moment=require(_0x8bee('0x2'));var BPromise=require('bluebird');var rs=require(_0x8bee('0x3'));var fs=require('fs');var Redis=require(_0x8bee('0x4'));var db=require(_0x8bee('0x5'))['db'];var utils=require(_0x8bee('0x6'));var logger=require(_0x8bee('0x7'))(_0x8bee('0x8'));var config=require('../../config/environment');var jayson=require(_0x8bee('0x9'));var client=jayson[_0x8bee('0xa')][_0x8bee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18f3f3,_0x34f49f,_0x2fffc5){return new BPromise(function(_0x48a27a,_0x12f0b5){return client[_0x8bee('0xc')](_0x18f3f3,_0x2fffc5)['then'](function(_0x177fd5){logger[_0x8bee('0xd')]('Automation,\x20%s,\x20%s',_0x34f49f,'request\x20sent');logger[_0x8bee('0xe')](_0x8bee('0xf'),_0x34f49f,_0x8bee('0x10'),JSON[_0x8bee('0x11')](_0x177fd5));if(_0x177fd5[_0x8bee('0x12')]){if(_0x177fd5[_0x8bee('0x12')][_0x8bee('0x13')]===0x1f4){logger[_0x8bee('0x12')](_0x8bee('0x14'),_0x34f49f,_0x177fd5[_0x8bee('0x12')][_0x8bee('0x15')]);return _0x12f0b5(_0x177fd5[_0x8bee('0x12')][_0x8bee('0x15')]);}logger['error']('Automation,\x20%s,\x20%s',_0x34f49f,_0x177fd5[_0x8bee('0x12')]['message']);return _0x48a27a(_0x177fd5[_0x8bee('0x12')][_0x8bee('0x15')]);}else{logger[_0x8bee('0xd')](_0x8bee('0x14'),_0x34f49f,_0x8bee('0x10'));_0x48a27a(_0x177fd5['result'][_0x8bee('0x15')]);}})[_0x8bee('0x16')](function(_0x212c72){logger[_0x8bee('0x12')](_0x8bee('0x14'),_0x34f49f,_0x212c72);_0x12f0b5(_0x212c72);});});} \ No newline at end of file +var _0x55a5=['request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','Automation,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55a5,0x1d0));var _0x555a=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x55a5[_0x1a89a1];return _0x3d5b46;};'use strict';var _=require('lodash');var util=require(_0x555a('0x0'));var moment=require(_0x555a('0x1'));var BPromise=require('bluebird');var rs=require(_0x555a('0x2'));var fs=require('fs');var Redis=require(_0x555a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x555a('0x4'));var logger=require('../../config/logger')(_0x555a('0x5'));var config=require(_0x555a('0x6'));var jayson=require(_0x555a('0x7'));var client=jayson[_0x555a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x461563,_0x132426,_0x19467f){return new BPromise(function(_0x4d09b6,_0x2e3cd5){return client['request'](_0x461563,_0x19467f)[_0x555a('0x9')](function(_0xaec03e){logger['info'](_0x555a('0xa'),_0x132426,_0x555a('0xb'));logger[_0x555a('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x132426,_0x555a('0xb'),JSON[_0x555a('0xd')](_0xaec03e));if(_0xaec03e[_0x555a('0xe')]){if(_0xaec03e[_0x555a('0xe')][_0x555a('0xf')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x132426,_0xaec03e[_0x555a('0xe')][_0x555a('0x10')]);return _0x2e3cd5(_0xaec03e[_0x555a('0xe')][_0x555a('0x10')]);}logger[_0x555a('0xe')](_0x555a('0xa'),_0x132426,_0xaec03e[_0x555a('0xe')]['message']);return _0x4d09b6(_0xaec03e['error']['message']);}else{logger['info'](_0x555a('0xa'),_0x132426,_0x555a('0xb'));_0x4d09b6(_0xaec03e[_0x555a('0x11')][_0x555a('0x10')]);}})[_0x555a('0x12')](function(_0xd13ba3){logger[_0x555a('0xe')]('Automation,\x20%s,\x20%s',_0x132426,_0xd13ba3);_0x2e3cd5(_0xd13ba3);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5970602..21d35c0 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 _0x2657=['get','/:id','show','/:id/conditions','getConditions','/:id/actions','create','post','addActions','update','destroy','multer','path','express','../../config/environment','./automation.controller','isAuthenticated','index'];(function(_0xc795f8,_0x6f05e7){var _0x4ae07b=function(_0x371e52){while(--_0x371e52){_0xc795f8['push'](_0xc795f8['shift']());}};_0x4ae07b(++_0x6f05e7);}(_0x2657,0xd1));var _0x7265=function(_0x2aa983,_0x28c4f0){_0x2aa983=_0x2aa983-0x0;var _0x4c1248=_0x2657[_0x2aa983];return _0x4c1248;};'use strict';var multer=require(_0x7265('0x0'));var util=require('util');var path=require(_0x7265('0x1'));var timeout=require('connect-timeout');var express=require(_0x7265('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7265('0x3'));var controller=require(_0x7265('0x4'));router['get']('/',auth[_0x7265('0x5')](),controller[_0x7265('0x6')]);router[_0x7265('0x7')](_0x7265('0x8'),auth[_0x7265('0x5')](),controller[_0x7265('0x9')]);router['get'](_0x7265('0xa'),auth[_0x7265('0x5')](),controller[_0x7265('0xb')]);router[_0x7265('0x7')](_0x7265('0xc'),auth[_0x7265('0x5')](),controller['getActions']);router['post']('/',auth[_0x7265('0x5')](),controller[_0x7265('0xd')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x7265('0xe')](_0x7265('0xc'),auth[_0x7265('0x5')](),controller[_0x7265('0xf')]);router['put'](_0x7265('0x8'),auth['isAuthenticated'](),controller[_0x7265('0x10')]);router['delete'](_0x7265('0x8'),auth[_0x7265('0x5')](),controller[_0x7265('0x11')]);module['exports']=router; \ No newline at end of file +var _0x50d5=['post','create','addConditions','addActions','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','show','/:id/conditions','isAuthenticated','getConditions','/:id/actions','getActions'];(function(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_0x50d5,0x166));var _0x550d=function(_0x498f42,_0x115d92){_0x498f42=_0x498f42-0x0;var _0x3456bd=_0x50d5[_0x498f42];return _0x3456bd;};'use strict';var multer=require(_0x550d('0x0'));var util=require('util');var path=require(_0x550d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x550d('0x2')]();var auth=require(_0x550d('0x3'));var interaction=require(_0x550d('0x4'));var config=require(_0x550d('0x5'));var controller=require(_0x550d('0x6'));router[_0x550d('0x7')]('/',auth['isAuthenticated'](),controller[_0x550d('0x8')]);router[_0x550d('0x7')](_0x550d('0x9'),auth['isAuthenticated'](),controller[_0x550d('0xa')]);router[_0x550d('0x7')](_0x550d('0xb'),auth[_0x550d('0xc')](),controller[_0x550d('0xd')]);router['get'](_0x550d('0xe'),auth['isAuthenticated'](),controller[_0x550d('0xf')]);router[_0x550d('0x10')]('/',auth['isAuthenticated'](),controller[_0x550d('0x11')]);router[_0x550d('0x10')](_0x550d('0xb'),auth[_0x550d('0xc')](),controller[_0x550d('0x12')]);router[_0x550d('0x10')](_0x550d('0xe'),auth[_0x550d('0xc')](),controller[_0x550d('0x13')]);router['put']('/:id',auth[_0x550d('0xc')](),controller['update']);router[_0x550d('0x14')](_0x550d('0x9'),auth[_0x550d('0xc')](),controller[_0x550d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 728fe3e..3e71df5 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 _0xa120=['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','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x46aec6,_0x1745da){var _0x425ffb=function(_0x4d7fc3){while(--_0x4d7fc3){_0x46aec6['push'](_0x46aec6['shift']());}};_0x425ffb(++_0x1745da);}(_0xa120,0xe8));var _0x0a12=function(_0x3873d8,_0x571bc2){_0x3873d8=_0x3873d8-0x0;var _0x1b2111=_0xa120[_0x3873d8];return _0x1b2111;};'use strict';var Sequelize=require(_0x0a12('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a12('0x1')],'unique':_0x0a12('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0a12('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x0a12('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0a12('0x5')],'defaultValue':0x0,'comment':_0x0a12('0x6')},'limitCalls':{'type':Sequelize[_0x0a12('0x7')](0x4)[_0x0a12('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0a12('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a12('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a12('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'comment':_0x0a12('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0a12('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x0a12('0x3')](_0x0a12('0xf'),_0x0a12('0x10'),_0x0a12('0x11')),'defaultValue':_0x0a12('0xf')},'dialAMDActive':{'type':Sequelize[_0x0a12('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a12('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a12('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x0a12('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a12('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a12('0x7')](0x9)[_0x0a12('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a12('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a12('0x7')](0x9)[_0x0a12('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0a12('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a12('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0a12('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0a12('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0a12('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x0a12('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a12('0x7')](0x9)[_0x0a12('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a12('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x0a12('0x19'),_0x0a12('0x1a')),'defaultValue':_0x0a12('0x19')},'dialPrefix':{'type':Sequelize[_0x0a12('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a12('0x1b')},'dialCutDigit':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a12('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x25')}}; \ No newline at end of file +var _0xe85d=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x2912d8,_0x201076){var _0x6b361c=function(_0x177d9f){while(--_0x177d9f){_0x2912d8['push'](_0x2912d8['shift']());}};_0x6b361c(++_0x201076);}(_0xe85d,0x10d));var _0xde85=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xe85d[_0x50e593];return _0x3821d0;};'use strict';var Sequelize=require(_0xde85('0x0'));module[_0xde85('0x1')]={'name':{'type':Sequelize[_0xde85('0x2')],'unique':_0xde85('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xde85('0x4')),'allowNull':![],'defaultValue':_0xde85('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xde85('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xde85('0x6')](0x4)[_0xde85('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xde85('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xde85('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xde85('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xde85('0xd')},'dialTimezone':{'type':Sequelize[_0xde85('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xde85('0x2')],'defaultValue':_0xde85('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xde85('0xf'),_0xde85('0x10'),'onlyIfOpen'),'defaultValue':_0xde85('0xf')},'dialAMDActive':{'type':Sequelize[_0xde85('0x5')],'defaultValue':0x0,'comment':_0xde85('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xde85('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xde85('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xde85('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xde85('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xde85('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xde85('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xde85('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xde85('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xde85('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xde85('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xde85('0x19')](_0xde85('0x1a'),_0xde85('0x1b')),'defaultValue':_0xde85('0x1a')},'dialPrefix':{'type':Sequelize[_0xde85('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xde85('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xde85('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xde85('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 6b72ed0..7285165 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 _0x383e=['CmListId','phone\x20IS\x20NOT\x20NULL','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','into','sequelize','removeLists','CmList','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','Content-Range','json','apply','reject','save','then','destroy','IvrCampaigns','UserProfileResource','error','name','send','map','Campaign','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','keys','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','select','field','ContactId','ListId','toString','NOW()','cm_contacts','ListId\x20=\x20?'];(function(_0xe202e2,_0xa15f46){var _0x3705fa=function(_0x587bd0){while(--_0x587bd0){_0xe202e2['push'](_0xe202e2['shift']());}};_0x3705fa(++_0xa15f46);}(_0x383e,0x117));var _0xe383=function(_0x32e8c4,_0x39c482){_0x32e8c4=_0x32e8c4-0x0;var _0x1b4ea0=_0x383e[_0x32e8c4];return _0x1b4ea0;};'use strict';var pdf=require(_0xe383('0x0'));var emlformat=require(_0xe383('0x1'));var rimraf=require(_0xe383('0x2'));var zipdir=require(_0xe383('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe383('0x4'));var moment=require(_0xe383('0x5'));var BPromise=require(_0xe383('0x6'));var Mustache=require(_0xe383('0x7'));var util=require('util');var path=require(_0xe383('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe383('0x9'));var squel=require(_0xe383('0xa'));var crypto=require(_0xe383('0xb'));var jsforce=require(_0xe383('0xc'));var deskjs=require(_0xe383('0xd'));var toCsv=require(_0xe383('0xe'));var querystring=require(_0xe383('0xf'));var Papa=require(_0xe383('0x10'));var Redis=require(_0xe383('0x11'));var authService=require(_0xe383('0x12'));var qs=require(_0xe383('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe383('0x14'));var logger=require(_0xe383('0x15'))(_0xe383('0x16'));var utils=require('../../config/utils');var config=require(_0xe383('0x17'));var db=require(_0xe383('0x18'))['db'];function respondWithStatusCode(_0x44320a,_0x4922f8){_0x4922f8=_0x4922f8||0xcc;return function(_0x231d59){if(_0x231d59){return _0x44320a[_0xe383('0x19')](_0x4922f8);}return _0x44320a['status'](_0x4922f8)[_0xe383('0x1a')]();};}function respondWithResult(_0x6c294b,_0x5d3df8){_0x5d3df8=_0x5d3df8||0xc8;return function(_0x3df4b2){if(_0x3df4b2){return _0x6c294b[_0xe383('0x1b')](_0x5d3df8)['json'](_0x3df4b2);}};}function respondWithFilteredResult(_0x31f4f4,_0x387e02){return function(_0x1bb1b3){if(_0x1bb1b3){var _0xf0aac3=_0x1bb1b3['count'],_0x469d53=_0x387e02[_0xe383('0x1c')],_0x23a209=_0x387e02[_0xe383('0x1c')]+_0x387e02['limit'],_0x5e0262;if(_0x23a209>=_0xf0aac3){_0x23a209=_0xf0aac3;_0x5e0262=0xc8;}else{_0x5e0262=0xce;}_0x31f4f4[_0xe383('0x1b')](_0x5e0262);return _0x31f4f4['set'](_0xe383('0x1d'),_0x469d53+'-'+_0x23a209+'/'+_0xf0aac3)[_0xe383('0x1e')](_0x1bb1b3);}return null;};}function patchUpdates(_0x552af6){return function(_0x31c671){try{jsonpatch[_0xe383('0x1f')](_0x31c671,_0x552af6,!![]);}catch(_0x1db0bb){return BPromise[_0xe383('0x20')](_0x1db0bb);}return _0x31c671[_0xe383('0x21')]();};}function saveUpdates(_0x5045ef,_0x2e42fd){return function(_0x396a97){if(_0x396a97){return _0x396a97['update'](_0x5045ef)[_0xe383('0x22')](function(_0x309202){return _0x309202;});}return null;};}function removeEntity(_0x14244f,_0x5aa437){return function(_0x4777ae){if(_0x4777ae){return _0x4777ae[_0xe383('0x23')]()['then'](function(){var _0xcf05a1=_0x4777ae['get']({'plain':!![]});var _0x3f4b8e=_0xe383('0x24');return db[_0xe383('0x25')]['destroy']({'where':{'type':_0x3f4b8e,'resourceId':_0xcf05a1['id']}})['then'](function(){return _0x4777ae;});})['then'](function(){_0x14244f[_0xe383('0x1b')](0xcc)[_0xe383('0x1a')]();});}};}function handleEntityNotFound(_0x421c92,_0x5c57fa){return function(_0x447e80){if(!_0x447e80){_0x421c92['sendStatus'](0x194);}return _0x447e80;};}function handleError(_0x1698c0,_0x40e16c){_0x40e16c=_0x40e16c||0x1f4;return function(_0x5b0aa3){logger[_0xe383('0x26')](_0x5b0aa3['stack']);if(_0x5b0aa3[_0xe383('0x27')]){delete _0x5b0aa3[_0xe383('0x27')];}_0x1698c0['status'](_0x40e16c)[_0xe383('0x28')](_0x5b0aa3);};}exports['index']=function(_0xdff372,_0x4c0ee7){var _0x21a31e={},_0x3a1bfc={},_0x5b623c={'count':0x0,'rows':[]};var _0x3fa536=_[_0xe383('0x29')](db[_0xe383('0x2a')][_0xe383('0x2b')],function(_0x178aad){return{'name':_0x178aad['fieldName'],'type':_0x178aad[_0xe383('0x2c')]['key']};});_0x3a1bfc[_0xe383('0x2d')]=_[_0xe383('0x29')](_0x3fa536,_0xe383('0x27'));_0x3a1bfc[_0xe383('0x2e')]=_['keys'](_0xdff372[_0xe383('0x2e')]);_0x3a1bfc[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x3a1bfc[_0xe383('0x2d')],_0x3a1bfc['query']);_0x21a31e[_0xe383('0x31')]=_[_0xe383('0x30')](_0x3a1bfc[_0xe383('0x2d')],qs['fields'](_0xdff372[_0xe383('0x2e')][_0xe383('0x32')]));_0x21a31e[_0xe383('0x31')]=_0x21a31e['attributes'][_0xe383('0x33')]?_0x21a31e[_0xe383('0x31')]:_0x3a1bfc[_0xe383('0x2d')];if(!_0xdff372[_0xe383('0x2e')]['hasOwnProperty'](_0xe383('0x34'))){_0x21a31e[_0xe383('0x35')]=qs[_0xe383('0x35')](_0xdff372[_0xe383('0x2e')]['limit']);_0x21a31e[_0xe383('0x1c')]=qs[_0xe383('0x1c')](_0xdff372[_0xe383('0x2e')][_0xe383('0x1c')]);}_0x21a31e[_0xe383('0x36')]=qs[_0xe383('0x37')](_0xdff372[_0xe383('0x2e')]['sort']);_0x21a31e[_0xe383('0x38')]=qs['filters'](_[_0xe383('0x39')](_0xdff372[_0xe383('0x2e')],_0x3a1bfc[_0xe383('0x2f')]),_0x3fa536);if(_0xdff372[_0xe383('0x2e')][_0xe383('0x3a')]){_0x21a31e[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x21a31e[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x3fa536,function(_0x4e6f91){if(_0x4e6f91[_0xe383('0x2c')]!==_0xe383('0x3c')){var _0x7639a={};_0x7639a[_0x4e6f91[_0xe383('0x27')]]={'$like':'%'+_0xdff372[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x7639a;}})});}_0x21a31e=_[_0xe383('0x3b')]({},_0x21a31e,_0xdff372[_0xe383('0x3d')]);var _0x336e38={'where':_0x21a31e['where']};return db[_0xe383('0x2a')][_0xe383('0x3e')](_0x336e38)['then'](function(_0x1bf0d0){_0x5b623c[_0xe383('0x3e')]=_0x1bf0d0;if(_0xdff372[_0xe383('0x2e')][_0xe383('0x3f')]){_0x21a31e[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x2a')][_0xe383('0x41')](_0x21a31e);})[_0xe383('0x22')](function(_0x5830de){_0x5b623c[_0xe383('0x42')]=_0x5830de;return _0x5b623c;})['then'](respondWithFilteredResult(_0x4c0ee7,_0x21a31e))['catch'](handleError(_0x4c0ee7,null));};exports['show']=function(_0x3459c4,_0x15a22d){var _0x562dbd={'raw':![],'where':{'id':_0x3459c4[_0xe383('0x43')]['id']}},_0x416aaa={};_0x416aaa['model']=_[_0xe383('0x44')](db[_0xe383('0x2a')][_0xe383('0x2b')]);_0x416aaa['query']=_['keys'](_0x3459c4['query']);_0x416aaa[_0xe383('0x2f')]=_['intersection'](_0x416aaa[_0xe383('0x2d')],_0x416aaa[_0xe383('0x2e')]);_0x562dbd[_0xe383('0x31')]=_[_0xe383('0x30')](_0x416aaa[_0xe383('0x2d')],qs[_0xe383('0x32')](_0x3459c4[_0xe383('0x2e')][_0xe383('0x32')]));_0x562dbd['attributes']=_0x562dbd[_0xe383('0x31')]['length']?_0x562dbd[_0xe383('0x31')]:_0x416aaa[_0xe383('0x2d')];if(_0x3459c4[_0xe383('0x2e')]['includeAll']){_0x562dbd[_0xe383('0x40')]=[{'all':!![]}];}_0x562dbd=_[_0xe383('0x3b')]({},_0x562dbd,_0x3459c4['options']);return db[_0xe383('0x2a')]['find'](_0x562dbd)['then'](handleEntityNotFound(_0x15a22d,null))[_0xe383('0x22')](respondWithResult(_0x15a22d,null))[_0xe383('0x45')](handleError(_0x15a22d,null));};exports[_0xe383('0x46')]=function(_0x1efcdf,_0xa1f54e){return db['Campaign'][_0xe383('0x46')](_0x1efcdf['body'],{})['then'](function(_0x5d8527){var _0x1e7deb=_0x1efcdf[_0xe383('0x47')][_0xe383('0x48')]({'plain':!![]});if(!_0x1e7deb)throw new Error(_0xe383('0x49'));if(_0x1e7deb[_0xe383('0x4a')]===_0xe383('0x47')){var _0x42fb96=_0x5d8527[_0xe383('0x48')]({'plain':!![]});var _0x57620b=_0xe383('0x24');return db[_0xe383('0x4b')][_0xe383('0x4c')]({'where':{'name':_0x57620b,'userProfileId':_0x1e7deb[_0xe383('0x4d')]},'raw':!![]})[_0xe383('0x22')](function(_0x12c4c6){if(_0x12c4c6&&_0x12c4c6[_0xe383('0x4e')]===0x0){return db[_0xe383('0x25')]['create']({'name':_0x42fb96['name'],'resourceId':_0x42fb96['id'],'type':_0x12c4c6[_0xe383('0x27')],'sectionId':_0x12c4c6['id']},{})[_0xe383('0x22')](function(){return _0x5d8527;});}else{return _0x5d8527;}})[_0xe383('0x45')](function(_0x116e28){logger[_0xe383('0x26')](_0xe383('0x4f'),_0x116e28);throw _0x116e28;});}return _0x5d8527;})[_0xe383('0x22')](respondWithResult(_0xa1f54e,0xc9))[_0xe383('0x45')](handleError(_0xa1f54e,null));};exports['clone']=function(_0x2a775c,_0x265ee2){var _0x67d134={'where':{'id':_0x2a775c[_0xe383('0x43')]['id']}},_0x37408b={};_0x37408b[_0xe383('0x2d')]=_[_0xe383('0x44')](db['Campaign']['rawAttributes']);_0x67d134[_0xe383('0x31')]=_['intersection'](_0x37408b[_0xe383('0x2d')],qs['fields'](_0x2a775c[_0xe383('0x2e')]['fields']));_0x67d134[_0xe383('0x31')]=_0x67d134[_0xe383('0x31')][_0xe383('0x33')]?_0x67d134['attributes']:_0x37408b[_0xe383('0x2d')];if(_0x2a775c['query'][_0xe383('0x3f')]){_0x67d134[_0xe383('0x40')]=[{'all':!![]}];}_0x67d134=_['merge']({},_0x67d134,_0x2a775c[_0xe383('0x3d')]);return db['Campaign'][_0xe383('0x4c')](_0x67d134)[_0xe383('0x22')](handleEntityNotFound(_0x265ee2,null))[_0xe383('0x22')](function(_0x1a65c7){if(_0x1a65c7){var _0x186379=_0x1a65c7[_0xe383('0x48')]({'plain':!![]});_0x186379=qs[_0xe383('0x50')](_0x186379,['id',_0xe383('0x51'),_0xe383('0x52')]);_0x2a775c[_0xe383('0x53')]=_[_0xe383('0x50')](_0x2a775c['body'],['id',_0xe383('0x51'),_0xe383('0x52')]);return db[_0xe383('0x2a')]['create'](_['merge'](_0x186379,_0x2a775c[_0xe383('0x53')]),{'include':_0x2a775c['query'][_0xe383('0x3f')]?[{'all':!![]}]:undefined})[_0xe383('0x22')](function(_0x3f6e76){var _0x4aa7f4=_0x2a775c[_0xe383('0x47')]['get']({'plain':!![]});if(!_0x4aa7f4)throw new Error(_0xe383('0x49'));if(_0x4aa7f4[_0xe383('0x4a')]===_0xe383('0x47')){var _0x4e6a76=_0x3f6e76[_0xe383('0x48')]({'plain':!![]});var _0x4e7a76='IvrCampaigns';return db['UserProfileSection'][_0xe383('0x4c')]({'where':{'name':_0x4e7a76,'userProfileId':_0x4aa7f4[_0xe383('0x4d')]},'raw':!![]})[_0xe383('0x22')](function(_0x4613ce){if(_0x4613ce&&_0x4613ce[_0xe383('0x4e')]===0x0){return db[_0xe383('0x25')][_0xe383('0x46')]({'name':_0x4e6a76[_0xe383('0x27')],'resourceId':_0x4e6a76['id'],'type':_0x4613ce[_0xe383('0x27')],'sectionId':_0x4613ce['id']},{})[_0xe383('0x22')](function(){return _0x3f6e76;});}else{return _0x3f6e76;}})[_0xe383('0x45')](function(_0x3802a2){logger['error'](_0xe383('0x4f'),_0x3802a2);throw _0x3802a2;});}return _0x3f6e76;});}})[_0xe383('0x22')](respondWithResult(_0x265ee2,0xc9))[_0xe383('0x45')](handleError(_0x265ee2,null));};exports['update']=function(_0x50aaf4,_0x241654){if(_0x50aaf4[_0xe383('0x53')]['id']){delete _0x50aaf4[_0xe383('0x53')]['id'];}return db[_0xe383('0x2a')][_0xe383('0x4c')]({'where':{'id':_0x50aaf4[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x241654,null))['then'](saveUpdates(_0x50aaf4[_0xe383('0x53')],null))[_0xe383('0x22')](respondWithResult(_0x241654,null))[_0xe383('0x45')](handleError(_0x241654,null));};exports[_0xe383('0x23')]=function(_0x4b921c,_0x3150ac){return db[_0xe383('0x2a')]['find']({'where':{'id':_0x4b921c[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x3150ac,null))[_0xe383('0x22')](removeEntity(_0x3150ac,null))[_0xe383('0x45')](handleError(_0x3150ac,null));};exports[_0xe383('0x54')]=function(_0x236ef1,_0x35bb0d,_0x386072){var _0x5199e0={'raw':!![],'where':{}};var _0x5ef246={};var _0x44c0bc={'count':0x0,'rows':[]};return db[_0xe383('0x2a')][_0xe383('0x55')]({'where':{'id':_0x236ef1['params']['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x35bb0d,null))[_0xe383('0x22')](function(_0x5f1482){if(_0x5f1482){_0x5ef246[_0xe383('0x2d')]=_['keys'](db['CmHopper'][_0xe383('0x2b')]);_0x5ef246[_0xe383('0x2e')]=_[_0xe383('0x44')](_0x236ef1[_0xe383('0x2e')]);_0x5ef246['filters']=_[_0xe383('0x30')](_0x5ef246[_0xe383('0x2d')],_0x5ef246[_0xe383('0x2e')]);_0x5199e0[_0xe383('0x31')]=_['intersection'](_0x5ef246[_0xe383('0x2d')],qs[_0xe383('0x32')](_0x236ef1['query'][_0xe383('0x32')]));_0x5199e0['attributes']=_0x5199e0[_0xe383('0x31')][_0xe383('0x33')]?_0x5199e0['attributes']:_0x5ef246[_0xe383('0x2d')];if(!_0x236ef1[_0xe383('0x2e')]['hasOwnProperty'](_0xe383('0x34'))){_0x5199e0['limit']=qs[_0xe383('0x35')](_0x236ef1[_0xe383('0x2e')][_0xe383('0x35')]);_0x5199e0['offset']=qs[_0xe383('0x1c')](_0x236ef1[_0xe383('0x2e')]['offset']);}_0x5199e0[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x236ef1['query']['sort']);_0x5199e0[_0xe383('0x38')]=qs[_0xe383('0x2f')](_[_0xe383('0x39')](_0x236ef1[_0xe383('0x2e')],_0x5ef246[_0xe383('0x2f')]));_0x5199e0[_0xe383('0x38')][_0xe383('0x56')]=_0x5f1482['id'];if(_0x236ef1['query'][_0xe383('0x3a')]){_0x5199e0['where']=_['merge'](_0x5199e0[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x5199e0[_0xe383('0x31')],function(_0x177a26){var _0x356eff={};_0x356eff[_0x177a26]={'$like':'%'+_0x236ef1[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x356eff;})});}_0x5199e0=_['merge']({},_0x5199e0,_0x236ef1['options']);return db['CmHopper'][_0xe383('0x3e')]({'where':_0x5199e0[_0xe383('0x38')]})[_0xe383('0x22')](function(_0x14bad8){_0x44c0bc['count']=_0x14bad8;if(_0x236ef1['query']['includeAll']){_0x5199e0[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x57')][_0xe383('0x41')](_0x5199e0);})[_0xe383('0x22')](function(_0x5b68ed){_0x44c0bc['rows']=_0x5b68ed;return _0x44c0bc;});}})[_0xe383('0x22')](respondWithFilteredResult(_0x35bb0d,_0x5199e0))['catch'](handleError(_0x35bb0d,null));};exports[_0xe383('0x58')]=function(_0x4b6d9b,_0x1d6e09,_0x1d3ba4){var _0x34137e={'raw':!![],'where':{}};var _0x141905={};var _0x1add48={'count':0x0,'rows':[]};return db['Campaign'][_0xe383('0x55')]({'where':{'id':_0x4b6d9b[_0xe383('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d6e09,null))['then'](function(_0x7344f1){if(_0x7344f1){_0x141905['model']=_[_0xe383('0x44')](db[_0xe383('0x59')][_0xe383('0x2b')]);_0x141905[_0xe383('0x2e')]=_[_0xe383('0x44')](_0x4b6d9b[_0xe383('0x2e')]);_0x141905[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x141905[_0xe383('0x2d')],_0x141905['query']);_0x34137e[_0xe383('0x31')]=_[_0xe383('0x30')](_0x141905[_0xe383('0x2d')],qs[_0xe383('0x32')](_0x4b6d9b[_0xe383('0x2e')][_0xe383('0x32')]));_0x34137e[_0xe383('0x31')]=_0x34137e['attributes'][_0xe383('0x33')]?_0x34137e[_0xe383('0x31')]:_0x141905['model'];if(!_0x4b6d9b['query'][_0xe383('0x5a')]('nolimit')){_0x34137e[_0xe383('0x35')]=qs[_0xe383('0x35')](_0x4b6d9b['query']['limit']);_0x34137e[_0xe383('0x1c')]=qs[_0xe383('0x1c')](_0x4b6d9b['query']['offset']);}_0x34137e[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x4b6d9b[_0xe383('0x2e')]['sort']);_0x34137e[_0xe383('0x38')]=qs[_0xe383('0x2f')](_[_0xe383('0x39')](_0x4b6d9b[_0xe383('0x2e')],_0x141905[_0xe383('0x2f')]));_0x34137e['where'][_0xe383('0x56')]=_0x7344f1['id'];if(_0x4b6d9b[_0xe383('0x2e')][_0xe383('0x3a')]){_0x34137e[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x34137e['where'],{'$or':_[_0xe383('0x29')](_0x34137e[_0xe383('0x31')],function(_0x33daab){var _0x53f5fe={};_0x53f5fe[_0x33daab]={'$like':'%'+_0x4b6d9b[_0xe383('0x2e')]['filter']+'%'};return _0x53f5fe;})});}_0x34137e=_[_0xe383('0x3b')]({},_0x34137e,_0x4b6d9b['options']);return db[_0xe383('0x59')][_0xe383('0x3e')]({'where':_0x34137e['where']})[_0xe383('0x22')](function(_0x31e262){_0x1add48[_0xe383('0x3e')]=_0x31e262;if(_0x4b6d9b[_0xe383('0x2e')]['includeAll']){_0x34137e[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x59')]['findAll'](_0x34137e);})['then'](function(_0x2dde03){_0x1add48[_0xe383('0x42')]=_0x2dde03;return _0x1add48;});}})[_0xe383('0x22')](respondWithFilteredResult(_0x1d6e09,_0x34137e))['catch'](handleError(_0x1d6e09,null));};exports[_0xe383('0x5b')]=function(_0x3659d3,_0x568ca8,_0x865362){var _0x5f345a={'raw':!![],'where':{}};var _0x4eefb4={};var _0x6d3e60={'count':0x0,'rows':[]};return db[_0xe383('0x2a')][_0xe383('0x55')]({'where':{'id':_0x3659d3[_0xe383('0x43')]['id']}})['then'](handleEntityNotFound(_0x568ca8,null))[_0xe383('0x22')](function(_0x123e7f){if(_0x123e7f){_0x4eefb4[_0xe383('0x2d')]=_[_0xe383('0x44')](db[_0xe383('0x5c')][_0xe383('0x2b')]);_0x4eefb4[_0xe383('0x2e')]=_[_0xe383('0x44')](_0x3659d3[_0xe383('0x2e')]);_0x4eefb4['filters']=_[_0xe383('0x30')](_0x4eefb4[_0xe383('0x2d')],_0x4eefb4[_0xe383('0x2e')]);_0x5f345a[_0xe383('0x31')]=_['intersection'](_0x4eefb4[_0xe383('0x2d')],qs[_0xe383('0x32')](_0x3659d3[_0xe383('0x2e')][_0xe383('0x32')]));_0x5f345a[_0xe383('0x31')]=_0x5f345a[_0xe383('0x31')][_0xe383('0x33')]?_0x5f345a['attributes']:_0x4eefb4[_0xe383('0x2d')];if(!_0x3659d3['query'][_0xe383('0x5a')](_0xe383('0x34'))){_0x5f345a[_0xe383('0x35')]=qs['limit'](_0x3659d3[_0xe383('0x2e')][_0xe383('0x35')]);_0x5f345a[_0xe383('0x1c')]=qs[_0xe383('0x1c')](_0x3659d3[_0xe383('0x2e')]['offset']);}_0x5f345a[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x3659d3[_0xe383('0x2e')][_0xe383('0x37')]);_0x5f345a[_0xe383('0x38')]=qs['filters'](_[_0xe383('0x39')](_0x3659d3[_0xe383('0x2e')],_0x4eefb4[_0xe383('0x2f')]));_0x5f345a[_0xe383('0x38')][_0xe383('0x56')]=_0x123e7f['id'];if(_0x3659d3[_0xe383('0x2e')][_0xe383('0x3a')]){_0x5f345a[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x5f345a[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x5f345a[_0xe383('0x31')],function(_0x4709){var _0x52bc64={};_0x52bc64[_0x4709]={'$like':'%'+_0x3659d3[_0xe383('0x2e')]['filter']+'%'};return _0x52bc64;})});}_0x5f345a=_['merge']({},_0x5f345a,_0x3659d3[_0xe383('0x3d')]);return db['CmHopperFinal'][_0xe383('0x3e')]({'where':_0x5f345a[_0xe383('0x38')]})['then'](function(_0x2c63a2){_0x6d3e60[_0xe383('0x3e')]=_0x2c63a2;if(_0x3659d3['query'][_0xe383('0x3f')]){_0x5f345a[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x5c')][_0xe383('0x41')](_0x5f345a);})[_0xe383('0x22')](function(_0x4666a3){_0x6d3e60[_0xe383('0x42')]=_0x4666a3;return _0x6d3e60;});}})[_0xe383('0x22')](respondWithFilteredResult(_0x568ca8,_0x5f345a))[_0xe383('0x45')](handleError(_0x568ca8,null));};exports[_0xe383('0x5d')]=function(_0x71a684,_0xc7dc7c,_0x24fa52){var _0x405256={'raw':!![],'where':{}};var _0x1d05ad={};var _0xb3c52b={'count':0x0,'rows':[]};return db[_0xe383('0x2a')][_0xe383('0x55')]({'where':{'id':_0x71a684['params']['id']}})[_0xe383('0x22')](handleEntityNotFound(_0xc7dc7c,null))[_0xe383('0x22')](function(_0x20e9c7){if(_0x20e9c7){_0x1d05ad[_0xe383('0x2d')]=_[_0xe383('0x44')](db['CmHopperBlack'][_0xe383('0x2b')]);_0x1d05ad['query']=_[_0xe383('0x44')](_0x71a684[_0xe383('0x2e')]);_0x1d05ad[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x1d05ad[_0xe383('0x2d')],_0x1d05ad[_0xe383('0x2e')]);_0x405256[_0xe383('0x31')]=_[_0xe383('0x30')](_0x1d05ad['model'],qs[_0xe383('0x32')](_0x71a684[_0xe383('0x2e')]['fields']));_0x405256[_0xe383('0x31')]=_0x405256[_0xe383('0x31')][_0xe383('0x33')]?_0x405256[_0xe383('0x31')]:_0x1d05ad[_0xe383('0x2d')];if(!_0x71a684[_0xe383('0x2e')][_0xe383('0x5a')](_0xe383('0x34'))){_0x405256['limit']=qs[_0xe383('0x35')](_0x71a684['query']['limit']);_0x405256['offset']=qs[_0xe383('0x1c')](_0x71a684[_0xe383('0x2e')][_0xe383('0x1c')]);}_0x405256['order']=qs[_0xe383('0x37')](_0x71a684['query'][_0xe383('0x37')]);_0x405256[_0xe383('0x38')]=qs[_0xe383('0x2f')](_[_0xe383('0x39')](_0x71a684[_0xe383('0x2e')],_0x1d05ad[_0xe383('0x2f')]));_0x405256[_0xe383('0x38')][_0xe383('0x56')]=_0x20e9c7['id'];if(_0x71a684[_0xe383('0x2e')][_0xe383('0x3a')]){_0x405256[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x405256[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x405256[_0xe383('0x31')],function(_0x3c01c9){var _0x351022={};_0x351022[_0x3c01c9]={'$like':'%'+_0x71a684[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x351022;})});}_0x405256=_['merge']({},_0x405256,_0x71a684[_0xe383('0x3d')]);return db[_0xe383('0x5e')]['count']({'where':_0x405256[_0xe383('0x38')]})['then'](function(_0x405c92){_0xb3c52b[_0xe383('0x3e')]=_0x405c92;if(_0x71a684[_0xe383('0x2e')][_0xe383('0x3f')]){_0x405256['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xe383('0x41')](_0x405256);})[_0xe383('0x22')](function(_0x278da3){_0xb3c52b[_0xe383('0x42')]=_0x278da3;return _0xb3c52b;});}})[_0xe383('0x22')](respondWithFilteredResult(_0xc7dc7c,_0x405256))[_0xe383('0x45')](handleError(_0xc7dc7c,null));};exports['getLists']=function(_0x83b69f,_0x148260,_0xabb240){var _0x21f908={};var _0x3fc54b={};var _0x42e66d;var _0x16af9c;return db[_0xe383('0x2a')]['findOne']({'where':{'id':_0x83b69f[_0xe383('0x43')]['id']}})['then'](handleEntityNotFound(_0x148260,null))[_0xe383('0x22')](function(_0xbe97c1){if(_0xbe97c1){_0x42e66d=_0xbe97c1;_0x3fc54b[_0xe383('0x2d')]=_['keys'](db['CmList']['rawAttributes']);_0x3fc54b['query']=_[_0xe383('0x44')](_0x83b69f[_0xe383('0x2e')]);_0x3fc54b[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x3fc54b[_0xe383('0x2d')],_0x3fc54b['query']);_0x21f908['attributes']=_[_0xe383('0x30')](_0x3fc54b[_0xe383('0x2d')],qs['fields'](_0x83b69f[_0xe383('0x2e')][_0xe383('0x32')]));_0x21f908['attributes']=_0x21f908['attributes']['length']?_0x21f908[_0xe383('0x31')]:_0x3fc54b[_0xe383('0x2d')];_0x21f908[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x83b69f[_0xe383('0x2e')][_0xe383('0x37')]);_0x21f908['where']=qs[_0xe383('0x2f')](_[_0xe383('0x39')](_0x83b69f['query'],_0x3fc54b[_0xe383('0x2f')]));if(_0x83b69f[_0xe383('0x2e')][_0xe383('0x3a')]){_0x21f908[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x21f908['where'],{'$or':_['map'](_0x21f908[_0xe383('0x31')],function(_0x2ba50f){var _0x37341b={};_0x37341b[_0x2ba50f]={'$like':'%'+_0x83b69f[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x37341b;})});}_0x21f908=_[_0xe383('0x3b')]({},_0x21f908,_0x83b69f[_0xe383('0x3d')]);return _0x42e66d['getLists'](_0x21f908);}})[_0xe383('0x22')](function(_0x43b340){if(_0x43b340){_0x16af9c=_0x43b340['length'];if(!_0x83b69f['query'][_0xe383('0x5a')](_0xe383('0x34'))){_0x21f908[_0xe383('0x35')]=qs[_0xe383('0x35')](_0x83b69f[_0xe383('0x2e')]['limit']);_0x21f908['offset']=qs[_0xe383('0x1c')](_0x83b69f['query']['offset']);}return _0x42e66d[_0xe383('0x5f')](_0x21f908);}})[_0xe383('0x22')](function(_0x503ef1){if(_0x503ef1){return _0x503ef1?{'count':_0x16af9c,'rows':_0x503ef1}:null;}})[_0xe383('0x22')](respondWithResult(_0x148260,null))[_0xe383('0x45')](handleError(_0x148260,null));};exports[_0xe383('0x60')]=function(_0xffdbc,_0x4d7828,_0x454ec3){var _0x412d93,_0x5745dd;return db[_0xe383('0x2a')][_0xe383('0x4c')]({'where':{'id':_0xffdbc[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x4d7828,null))[_0xe383('0x22')](function(_0x415665){if(_0x415665){_0x5745dd=_0x415665;return _0x415665[_0xe383('0x60')](_0xffdbc[_0xe383('0x53')]['ids'],_[_0xe383('0x50')](_0xffdbc[_0xe383('0x53')],[_0xe383('0x61'),'id'])||{});}return null;})[_0xe383('0x62')](function(_0xbd07dc){var _0x297651;_0x412d93=_0xbd07dc||[];var _0x401466=[];if(_0xbd07dc){for(var _0x4e5125=0x0;_0x4e5125<_0xbd07dc['length'];_0x4e5125+=0x1){var _0x32ef12=_0xbd07dc[_0x4e5125][_0xe383('0x48')]({'plain':!![]});_0x5745dd[_0xe383('0x63')]=_0xffdbc[_0xe383('0x53')][_0xe383('0x63')]?_0xffdbc[_0xe383('0x53')][_0xe383('0x63')]:_0x5745dd[_0xe383('0x63')];switch(_0x5745dd[_0xe383('0x63')]){case _0xe383('0x64'):_0x297651=squel[_0xe383('0x65')]()['into'](_0xe383('0x66'))[_0xe383('0x67')]([_0xe383('0x68'),_0xe383('0x69'),'ContactId','ListId',_0xe383('0x56'),'createdAt','updatedAt'],squel[_0xe383('0x6a')]()[_0xe383('0x6b')](_0xe383('0x68'),'phone')['field']('NOW()','scheduledAt')[_0xe383('0x6b')]('id',_0xe383('0x6c'))[_0xe383('0x6b')](_0x32ef12['CmListId']['toString'](),_0xe383('0x6d'))[_0xe383('0x6b')](_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')](),_0xe383('0x56'))['field']('NOW()',_0xe383('0x51'))[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x52'))['from'](_0xe383('0x70'))[_0xe383('0x38')]('deletedAt\x20IS\x20NULL')[_0xe383('0x38')](_0xe383('0x71'),_0x32ef12[_0xe383('0x72')]['toString']())[_0xe383('0x38')](_0xe383('0x73'))[_0xe383('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe383('0x6a')]()[_0xe383('0x6b')]('COALESCE(calleridnum,\x27\x27)')[_0xe383('0x74')](_0xe383('0x75'))[_0xe383('0x38')](_0xe383('0x76'),_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')]()))[_0xe383('0x38')](_0xe383('0x77'),squel[_0xe383('0x6a')]()[_0xe383('0x6b')](_0xe383('0x78'))[_0xe383('0x74')]('cm_hopper')[_0xe383('0x38')](_0xe383('0x76'),_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')]())))[_0xe383('0x6e')]();break;case _0xe383('0x79'):_0x297651=squel[_0xe383('0x65')]()['into'](_0xe383('0x66'))[_0xe383('0x67')]([_0xe383('0x68'),_0xe383('0x69'),_0xe383('0x6c'),_0xe383('0x6d'),_0xe383('0x56'),_0xe383('0x51'),_0xe383('0x52')],squel[_0xe383('0x6a')]()[_0xe383('0x6b')]('phone','phone')[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x69'))['field']('id',_0xe383('0x6c'))['field'](_0x32ef12[_0xe383('0x72')]['toString'](),_0xe383('0x6d'))[_0xe383('0x6b')](_0xffdbc['params']['id'][_0xe383('0x6e')](),'CampaignId')[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x51'))[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x52'))[_0xe383('0x74')]('cm_contacts')['where'](_0xe383('0x7a'))['where']('ListId\x20=\x20?',_0x32ef12['CmListId'][_0xe383('0x6e')]())[_0xe383('0x38')](_0xe383('0x73'))[_0xe383('0x38')](_0xe383('0x77'),squel['select']()['field'](_0xe383('0x78'))[_0xe383('0x74')](_0xe383('0x66'))[_0xe383('0x38')](_0xe383('0x76'),_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')]())))['toString']();break;default:_0x297651=squel['insert']()[_0xe383('0x7b')]('cm_hopper')[_0xe383('0x67')]([_0xe383('0x68'),_0xe383('0x69'),_0xe383('0x6c'),_0xe383('0x6d'),_0xe383('0x56'),_0xe383('0x51'),_0xe383('0x52')],squel['select']()[_0xe383('0x6b')](_0xe383('0x68'),_0xe383('0x68'))[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x69'))[_0xe383('0x6b')]('id',_0xe383('0x6c'))['field'](_0x32ef12[_0xe383('0x72')]['toString'](),_0xe383('0x6d'))[_0xe383('0x6b')](_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')](),_0xe383('0x56'))[_0xe383('0x6b')]('NOW()',_0xe383('0x51'))['field'](_0xe383('0x6f'),_0xe383('0x52'))[_0xe383('0x74')](_0xe383('0x70'))[_0xe383('0x38')](_0xe383('0x7a'))['where'](_0xe383('0x71'),_0x32ef12[_0xe383('0x72')]['toString']())[_0xe383('0x38')](_0xe383('0x73')))[_0xe383('0x6e')]();}_0x401466['push'](db[_0xe383('0x7c')][_0xe383('0x2e')](_0x297651));}return BPromise['all'](_0x401466);}})[_0xe383('0x22')](function(){return _0x412d93;})[_0xe383('0x22')](respondWithResult(_0x4d7828,null))[_0xe383('0x45')](handleError(_0x4d7828,null));};exports[_0xe383('0x7d')]=function(_0x54202c,_0x2e66f6,_0x34886c){return db[_0xe383('0x2a')][_0xe383('0x4c')]({'where':{'id':_0x54202c[_0xe383('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e66f6,null))[_0xe383('0x22')](function(_0x385843){if(_0x385843){return _0x385843[_0xe383('0x7d')](_0x54202c['query'][_0xe383('0x61')]);}})['then'](function(_0xb2f798){if(_0xb2f798){return db[_0xe383('0x57')][_0xe383('0x23')]({'where':{'ListId':_0x54202c[_0xe383('0x2e')]['ids'],'CampaignId':_0x54202c['params']['id']}})['then'](function(){return _0xb2f798;});}})[_0xe383('0x22')](respondWithStatusCode(_0x2e66f6,null))[_0xe383('0x45')](handleError(_0x2e66f6,null));};exports['getBlackLists']=function(_0x1d9099,_0x5ca485,_0x23db1b){var _0x1723f0={'raw':!![],'where':{}};var _0x3e0cfb={};var _0xdab81b={'count':0x0,'rows':[]};return db[_0xe383('0x2a')][_0xe383('0x55')]({'where':{'id':_0x1d9099[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x5ca485,null))['then'](function(_0x4a382d){if(_0x4a382d){_0x3e0cfb[_0xe383('0x2d')]=_[_0xe383('0x44')](db[_0xe383('0x7e')][_0xe383('0x2b')]);_0x3e0cfb['query']=_[_0xe383('0x44')](_0x1d9099[_0xe383('0x2e')]);_0x3e0cfb[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x3e0cfb['model'],_0x3e0cfb[_0xe383('0x2e')]);_0x1723f0[_0xe383('0x31')]=_[_0xe383('0x30')](_0x3e0cfb[_0xe383('0x2d')],qs['fields'](_0x1d9099['query'][_0xe383('0x32')]));_0x1723f0[_0xe383('0x31')]=_0x1723f0['attributes']['length']?_0x1723f0[_0xe383('0x31')]:_0x3e0cfb['model'];if(!_0x1d9099['query'][_0xe383('0x5a')](_0xe383('0x34'))){_0x1723f0[_0xe383('0x35')]=qs[_0xe383('0x35')](_0x1d9099[_0xe383('0x2e')][_0xe383('0x35')]);_0x1723f0['offset']=qs[_0xe383('0x1c')](_0x1d9099[_0xe383('0x2e')][_0xe383('0x1c')]);}_0x1723f0[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x1d9099[_0xe383('0x2e')][_0xe383('0x37')]);_0x1723f0[_0xe383('0x38')]=qs[_0xe383('0x2f')](_['pick'](_0x1d9099[_0xe383('0x2e')],_0x3e0cfb['filters']));_0x1723f0['where'][_0xe383('0x56')]=_0x4a382d['id'];if(_0x1d9099[_0xe383('0x2e')][_0xe383('0x3a')]){_0x1723f0[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x1723f0[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x1723f0['attributes'],function(_0x287df8){var _0x4c0f71={};_0x4c0f71[_0x287df8]={'$like':'%'+_0x1d9099[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x4c0f71;})});}_0x1723f0=_['merge']({},_0x1723f0,_0x1d9099['options']);return db[_0xe383('0x7e')][_0xe383('0x3e')]({'where':_0x1723f0[_0xe383('0x38')]})[_0xe383('0x22')](function(_0x387d09){_0xdab81b['count']=_0x387d09;if(_0x1d9099['query'][_0xe383('0x3f')]){_0x1723f0[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x7e')]['findAll'](_0x1723f0);})[_0xe383('0x22')](function(_0x358a29){_0xdab81b[_0xe383('0x42')]=_0x358a29;return _0xdab81b;});}})['then'](respondWithFilteredResult(_0x5ca485,_0x1723f0))[_0xe383('0x45')](handleError(_0x5ca485,null));};exports[_0xe383('0x7f')]=function(_0xf5df04,_0x47ac8d,_0x30746d){var _0x423aee,_0x4b1e90;return db[_0xe383('0x2a')]['find']({'where':{'id':_0xf5df04[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x47ac8d,null))['then'](function(_0x424ac7){if(_0x424ac7){_0x4b1e90=_0x424ac7;return _0x424ac7[_0xe383('0x7f')](_0xf5df04[_0xe383('0x53')][_0xe383('0x61')],_[_0xe383('0x50')](_0xf5df04['body'],[_0xe383('0x61'),'id'])||{});}return null;})[_0xe383('0x62')](function(_0x3e1fb4){var _0x402c40;_0x423aee=_0x3e1fb4||[];var _0x521d96=[];if(_0x3e1fb4){for(var _0x17107c=0x0;_0x17107c<_0x3e1fb4['length'];_0x17107c+=0x1){var _0x640daa=_0x3e1fb4[_0x17107c]['get']({'plain':!![]});_0x402c40=squel['insert']()[_0xe383('0x7b')](_0xe383('0x80'))[_0xe383('0x67')]([_0xe383('0x68'),_0xe383('0x6c'),'ListId',_0xe383('0x56'),_0xe383('0x51'),_0xe383('0x52')],squel[_0xe383('0x6a')]()['field'](_0xe383('0x68'),_0xe383('0x68'))['field']('id',_0xe383('0x6c'))[_0xe383('0x6b')](_0x640daa[_0xe383('0x72')][_0xe383('0x6e')](),'ListId')[_0xe383('0x6b')](_0xf5df04['params']['id'][_0xe383('0x6e')](),_0xe383('0x56'))[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x51'))[_0xe383('0x6b')]('NOW()',_0xe383('0x52'))[_0xe383('0x74')](_0xe383('0x70'))[_0xe383('0x38')](_0xe383('0x7a'))[_0xe383('0x38')](_0xe383('0x71'),_0x640daa[_0xe383('0x72')][_0xe383('0x6e')]())[_0xe383('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0xe383('0x6e')]();_0x521d96['push'](db[_0xe383('0x7c')][_0xe383('0x2e')](_0x402c40));}return BPromise[_0xe383('0x81')](_0x521d96);}})[_0xe383('0x22')](function(){return _0x423aee;})[_0xe383('0x22')](respondWithResult(_0x47ac8d,null))[_0xe383('0x45')](handleError(_0x47ac8d,null));};exports[_0xe383('0x82')]=function(_0x2ccff6,_0x30febe,_0x28d667){return db['Campaign'][_0xe383('0x4c')]({'where':{'id':_0x2ccff6[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x30febe,null))[_0xe383('0x22')](function(_0x298203){if(_0x298203){return _0x298203[_0xe383('0x82')](_0x2ccff6[_0xe383('0x2e')][_0xe383('0x61')]);}})[_0xe383('0x22')](function(_0x3e1f52){if(_0x3e1f52){return db[_0xe383('0x5e')][_0xe383('0x23')]({'where':{'ListId':_0x2ccff6[_0xe383('0x2e')][_0xe383('0x61')],'CampaignId':_0x2ccff6[_0xe383('0x43')]['id']}})[_0xe383('0x22')](function(){return _0x3e1f52;});}})[_0xe383('0x22')](respondWithStatusCode(_0x30febe,null))[_0xe383('0x45')](handleError(_0x30febe,null));}; \ No newline at end of file +var _0xbb3b=['fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','IvrCampaigns','UserProfileResource','end','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','Campaign','include','rows','catch','show','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','hasOwnProperty','order','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper'];(function(_0x566448,_0x1d984a){var _0x182959=function(_0x22f7e8){while(--_0x22f7e8){_0x566448['push'](_0x566448['shift']());}};_0x182959(++_0x1d984a);}(_0xbb3b,0x1b6));var _0xbbb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb3b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbb3('0x0'));var rimraf=require(_0xbbb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbb3('0x2'));var rp=require('request-promise');var moment=require(_0xbbb3('0x3'));var BPromise=require(_0xbbb3('0x4'));var Mustache=require(_0xbbb3('0x5'));var util=require('util');var path=require(_0xbbb3('0x6'));var sox=require(_0xbbb3('0x7'));var csv=require(_0xbbb3('0x8'));var ejs=require(_0xbbb3('0x9'));var fs=require('fs');var _=require(_0xbbb3('0xa'));var squel=require(_0xbbb3('0xb'));var crypto=require(_0xbbb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbbb3('0xd'));var toCsv=require(_0xbbb3('0x8'));var querystring=require(_0xbbb3('0xe'));var Papa=require(_0xbbb3('0xf'));var Redis=require(_0xbbb3('0x10'));var authService=require(_0xbbb3('0x11'));var qs=require(_0xbbb3('0x12'));var as=require(_0xbbb3('0x13'));var hardwareService=require(_0xbbb3('0x14'));var logger=require(_0xbbb3('0x15'))(_0xbbb3('0x16'));var utils=require(_0xbbb3('0x17'));var config=require(_0xbbb3('0x18'));var db=require(_0xbbb3('0x19'))['db'];function respondWithStatusCode(_0x42397e,_0x2686d9){_0x2686d9=_0x2686d9||0xcc;return function(_0x320e6c){if(_0x320e6c){return _0x42397e[_0xbbb3('0x1a')](_0x2686d9);}return _0x42397e['status'](_0x2686d9)['end']();};}function respondWithResult(_0x56b566,_0x2a43aa){_0x2a43aa=_0x2a43aa||0xc8;return function(_0x43f42f){if(_0x43f42f){return _0x56b566[_0xbbb3('0x1b')](_0x2a43aa)['json'](_0x43f42f);}};}function respondWithFilteredResult(_0x32f36a,_0x59a6e6){return function(_0x186051){if(_0x186051){var _0x496ada=_0x186051[_0xbbb3('0x1c')],_0x525b94=_0x59a6e6[_0xbbb3('0x1d')],_0xe0e853=_0x59a6e6[_0xbbb3('0x1d')]+_0x59a6e6[_0xbbb3('0x1e')],_0x15eec1;if(_0xe0e853>=_0x496ada){_0xe0e853=_0x496ada;_0x15eec1=0xc8;}else{_0x15eec1=0xce;}_0x32f36a['status'](_0x15eec1);return _0x32f36a[_0xbbb3('0x1f')](_0xbbb3('0x20'),_0x525b94+'-'+_0xe0e853+'/'+_0x496ada)[_0xbbb3('0x21')](_0x186051);}return null;};}function patchUpdates(_0xed9e96){return function(_0x2adfad){try{jsonpatch[_0xbbb3('0x22')](_0x2adfad,_0xed9e96,!![]);}catch(_0x5c6561){return BPromise[_0xbbb3('0x23')](_0x5c6561);}return _0x2adfad['save']();};}function saveUpdates(_0x1c7ead,_0x5216f4){return function(_0x32477e){if(_0x32477e){return _0x32477e[_0xbbb3('0x24')](_0x1c7ead)['then'](function(_0x5597b5){return _0x5597b5;});}return null;};}function removeEntity(_0x40adb9,_0x327558){return function(_0x17a6c2){if(_0x17a6c2){return _0x17a6c2[_0xbbb3('0x25')]()[_0xbbb3('0x26')](function(){var _0x55222d=_0x17a6c2[_0xbbb3('0x27')]({'plain':!![]});var _0x2f64ee=_0xbbb3('0x28');return db[_0xbbb3('0x29')]['destroy']({'where':{'type':_0x2f64ee,'resourceId':_0x55222d['id']}})[_0xbbb3('0x26')](function(){return _0x17a6c2;});})[_0xbbb3('0x26')](function(){_0x40adb9[_0xbbb3('0x1b')](0xcc)[_0xbbb3('0x2a')]();});}};}function handleEntityNotFound(_0x4a8a72,_0x5e8388){return function(_0x42d845){if(!_0x42d845){_0x4a8a72[_0xbbb3('0x1a')](0x194);}return _0x42d845;};}function handleError(_0x4cf299,_0xabfeae){_0xabfeae=_0xabfeae||0x1f4;return function(_0x1d2e3a){logger[_0xbbb3('0x2b')](_0x1d2e3a[_0xbbb3('0x2c')]);if(_0x1d2e3a[_0xbbb3('0x2d')]){delete _0x1d2e3a[_0xbbb3('0x2d')];}_0x4cf299[_0xbbb3('0x1b')](_0xabfeae)['send'](_0x1d2e3a);};}exports[_0xbbb3('0x2e')]=function(_0x432d93,_0x1a95b0){var _0x446153={},_0x3cad1d={},_0x3e04d0={'count':0x0,'rows':[]};var _0x5e47e3=_['map'](db['Campaign'][_0xbbb3('0x2f')],function(_0x1c2375){return{'name':_0x1c2375[_0xbbb3('0x30')],'type':_0x1c2375[_0xbbb3('0x31')]['key']};});_0x3cad1d[_0xbbb3('0x32')]=_[_0xbbb3('0x33')](_0x5e47e3,_0xbbb3('0x2d'));_0x3cad1d[_0xbbb3('0x34')]=_['keys'](_0x432d93[_0xbbb3('0x34')]);_0x3cad1d[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x3cad1d[_0xbbb3('0x32')],_0x3cad1d[_0xbbb3('0x34')]);_0x446153['attributes']=_[_0xbbb3('0x36')](_0x3cad1d[_0xbbb3('0x32')],qs['fields'](_0x432d93['query'][_0xbbb3('0x37')]));_0x446153[_0xbbb3('0x38')]=_0x446153[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x446153['attributes']:_0x3cad1d[_0xbbb3('0x32')];if(!_0x432d93[_0xbbb3('0x34')]['hasOwnProperty'](_0xbbb3('0x3a'))){_0x446153[_0xbbb3('0x1e')]=qs['limit'](_0x432d93['query'][_0xbbb3('0x1e')]);_0x446153[_0xbbb3('0x1d')]=qs['offset'](_0x432d93['query']['offset']);}_0x446153['order']=qs['sort'](_0x432d93['query'][_0xbbb3('0x3b')]);_0x446153[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0x432d93[_0xbbb3('0x34')],_0x3cad1d[_0xbbb3('0x35')]),_0x5e47e3);if(_0x432d93[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x446153[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x446153[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x5e47e3,function(_0x4de361){if(_0x4de361[_0xbbb3('0x31')]!=='VIRTUAL'){var _0x197086={};_0x197086[_0x4de361[_0xbbb3('0x2d')]]={'$like':'%'+_0x432d93[_0xbbb3('0x34')][_0xbbb3('0x3e')]+'%'};return _0x197086;}})});}_0x446153=_['merge']({},_0x446153,_0x432d93['options']);var _0x3b8d6e={'where':_0x446153['where']};return db[_0xbbb3('0x40')]['count'](_0x3b8d6e)[_0xbbb3('0x26')](function(_0x166ac5){_0x3e04d0[_0xbbb3('0x1c')]=_0x166ac5;if(_0x432d93['query']['includeAll']){_0x446153[_0xbbb3('0x41')]=[{'all':!![]}];}return db[_0xbbb3('0x40')]['findAll'](_0x446153);})[_0xbbb3('0x26')](function(_0x45ca49){_0x3e04d0[_0xbbb3('0x42')]=_0x45ca49;return _0x3e04d0;})['then'](respondWithFilteredResult(_0x1a95b0,_0x446153))[_0xbbb3('0x43')](handleError(_0x1a95b0,null));};exports[_0xbbb3('0x44')]=function(_0x49f20d,_0x46d718){var _0x15176e={'raw':![],'where':{'id':_0x49f20d['params']['id']}},_0xd34788={};_0xd34788[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db[_0xbbb3('0x40')][_0xbbb3('0x2f')]);_0xd34788['query']=_[_0xbbb3('0x45')](_0x49f20d[_0xbbb3('0x34')]);_0xd34788[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0xd34788[_0xbbb3('0x32')],_0xd34788['query']);_0x15176e[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0xd34788[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0x49f20d[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x15176e[_0xbbb3('0x38')]=_0x15176e[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x15176e['attributes']:_0xd34788[_0xbbb3('0x32')];if(_0x49f20d['query'][_0xbbb3('0x46')]){_0x15176e['include']=[{'all':!![]}];}_0x15176e=_['merge']({},_0x15176e,_0x49f20d[_0xbbb3('0x47')]);return db[_0xbbb3('0x40')][_0xbbb3('0x48')](_0x15176e)[_0xbbb3('0x26')](handleEntityNotFound(_0x46d718,null))[_0xbbb3('0x26')](respondWithResult(_0x46d718,null))[_0xbbb3('0x43')](handleError(_0x46d718,null));};exports[_0xbbb3('0x49')]=function(_0x4cd64e,_0x567c24){return db[_0xbbb3('0x40')][_0xbbb3('0x49')](_0x4cd64e[_0xbbb3('0x4a')],{})[_0xbbb3('0x26')](function(_0xd5575){var _0x5221dc=_0x4cd64e[_0xbbb3('0x4b')][_0xbbb3('0x27')]({'plain':!![]});if(!_0x5221dc)throw new Error(_0xbbb3('0x4c'));if(_0x5221dc[_0xbbb3('0x4d')]===_0xbbb3('0x4b')){var _0x430f07=_0xd5575[_0xbbb3('0x27')]({'plain':!![]});var _0x48119c=_0xbbb3('0x28');return db['UserProfileSection'][_0xbbb3('0x48')]({'where':{'name':_0x48119c,'userProfileId':_0x5221dc[_0xbbb3('0x4e')]},'raw':!![]})['then'](function(_0x3f8d24){if(_0x3f8d24&&_0x3f8d24[_0xbbb3('0x4f')]===0x0){return db[_0xbbb3('0x29')][_0xbbb3('0x49')]({'name':_0x430f07[_0xbbb3('0x2d')],'resourceId':_0x430f07['id'],'type':_0x3f8d24[_0xbbb3('0x2d')],'sectionId':_0x3f8d24['id']},{})['then'](function(){return _0xd5575;});}else{return _0xd5575;}})['catch'](function(_0x45a393){logger[_0xbbb3('0x2b')](_0xbbb3('0x50'),_0x45a393);throw _0x45a393;});}return _0xd5575;})['then'](respondWithResult(_0x567c24,0xc9))['catch'](handleError(_0x567c24,null));};exports[_0xbbb3('0x51')]=function(_0x504403,_0x1a15b6){var _0x8d3b80={'where':{'id':_0x504403[_0xbbb3('0x52')]['id']}},_0x4d6007={};_0x4d6007[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db[_0xbbb3('0x40')][_0xbbb3('0x2f')]);_0x8d3b80[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x4d6007[_0xbbb3('0x32')],qs['fields'](_0x504403[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x8d3b80[_0xbbb3('0x38')]=_0x8d3b80[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x8d3b80['attributes']:_0x4d6007[_0xbbb3('0x32')];if(_0x504403[_0xbbb3('0x34')]['includeAll']){_0x8d3b80[_0xbbb3('0x41')]=[{'all':!![]}];}_0x8d3b80=_[_0xbbb3('0x3f')]({},_0x8d3b80,_0x504403[_0xbbb3('0x47')]);return db[_0xbbb3('0x40')][_0xbbb3('0x48')](_0x8d3b80)[_0xbbb3('0x26')](handleEntityNotFound(_0x1a15b6,null))[_0xbbb3('0x26')](function(_0xdb20ed){if(_0xdb20ed){var _0x3df72e=_0xdb20ed[_0xbbb3('0x27')]({'plain':!![]});_0x3df72e=qs[_0xbbb3('0x53')](_0x3df72e,['id',_0xbbb3('0x54'),_0xbbb3('0x55')]);_0x504403[_0xbbb3('0x4a')]=_[_0xbbb3('0x53')](_0x504403['body'],['id',_0xbbb3('0x54'),_0xbbb3('0x55')]);return db['Campaign'][_0xbbb3('0x49')](_['merge'](_0x3df72e,_0x504403[_0xbbb3('0x4a')]),{'include':_0x504403['query'][_0xbbb3('0x46')]?[{'all':!![]}]:undefined})[_0xbbb3('0x26')](function(_0x32583d){var _0x5b6e58=_0x504403['user'][_0xbbb3('0x27')]({'plain':!![]});if(!_0x5b6e58)throw new Error(_0xbbb3('0x4c'));if(_0x5b6e58[_0xbbb3('0x4d')]===_0xbbb3('0x4b')){var _0x495373=_0x32583d['get']({'plain':!![]});var _0xd8f9c5=_0xbbb3('0x28');return db[_0xbbb3('0x56')]['find']({'where':{'name':_0xd8f9c5,'userProfileId':_0x5b6e58['userProfileId']},'raw':!![]})[_0xbbb3('0x26')](function(_0x16bc95){if(_0x16bc95&&_0x16bc95['autoAssociation']===0x0){return db[_0xbbb3('0x29')]['create']({'name':_0x495373[_0xbbb3('0x2d')],'resourceId':_0x495373['id'],'type':_0x16bc95[_0xbbb3('0x2d')],'sectionId':_0x16bc95['id']},{})['then'](function(){return _0x32583d;});}else{return _0x32583d;}})['catch'](function(_0xbb7eab){logger[_0xbbb3('0x2b')](_0xbbb3('0x50'),_0xbb7eab);throw _0xbb7eab;});}return _0x32583d;});}})[_0xbbb3('0x26')](respondWithResult(_0x1a15b6,0xc9))[_0xbbb3('0x43')](handleError(_0x1a15b6,null));};exports['update']=function(_0x159a96,_0x40734a){if(_0x159a96[_0xbbb3('0x4a')]['id']){delete _0x159a96[_0xbbb3('0x4a')]['id'];}return db['Campaign'][_0xbbb3('0x48')]({'where':{'id':_0x159a96[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x40734a,null))[_0xbbb3('0x26')](saveUpdates(_0x159a96['body'],null))[_0xbbb3('0x26')](respondWithResult(_0x40734a,null))[_0xbbb3('0x43')](handleError(_0x40734a,null));};exports[_0xbbb3('0x25')]=function(_0x5aec00,_0x1084e9){return db[_0xbbb3('0x40')][_0xbbb3('0x48')]({'where':{'id':_0x5aec00[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x1084e9,null))[_0xbbb3('0x26')](removeEntity(_0x1084e9,null))[_0xbbb3('0x43')](handleError(_0x1084e9,null));};exports[_0xbbb3('0x57')]=function(_0x3d5c48,_0x333e80,_0x14c51f){var _0x9b078b={'raw':!![],'where':{}};var _0x27feea={};var _0x2063d9={'count':0x0,'rows':[]};return db['Campaign'][_0xbbb3('0x58')]({'where':{'id':_0x3d5c48[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x333e80,null))['then'](function(_0x298f43){if(_0x298f43){_0x27feea[_0xbbb3('0x32')]=_['keys'](db['CmHopper']['rawAttributes']);_0x27feea[_0xbbb3('0x34')]=_[_0xbbb3('0x45')](_0x3d5c48[_0xbbb3('0x34')]);_0x27feea[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x27feea[_0xbbb3('0x32')],_0x27feea[_0xbbb3('0x34')]);_0x9b078b['attributes']=_[_0xbbb3('0x36')](_0x27feea[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0x3d5c48[_0xbbb3('0x34')]['fields']));_0x9b078b[_0xbbb3('0x38')]=_0x9b078b['attributes']['length']?_0x9b078b[_0xbbb3('0x38')]:_0x27feea['model'];if(!_0x3d5c48[_0xbbb3('0x34')][_0xbbb3('0x59')]('nolimit')){_0x9b078b['limit']=qs['limit'](_0x3d5c48[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x9b078b['offset']=qs[_0xbbb3('0x1d')](_0x3d5c48[_0xbbb3('0x34')]['offset']);}_0x9b078b[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0x3d5c48['query']['sort']);_0x9b078b[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0x3d5c48[_0xbbb3('0x34')],_0x27feea[_0xbbb3('0x35')]));_0x9b078b[_0xbbb3('0x3c')][_0xbbb3('0x5b')]=_0x298f43['id'];if(_0x3d5c48['query']['filter']){_0x9b078b[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x9b078b['where'],{'$or':_[_0xbbb3('0x33')](_0x9b078b['attributes'],function(_0x5179aa){var _0x474131={};_0x474131[_0x5179aa]={'$like':'%'+_0x3d5c48[_0xbbb3('0x34')]['filter']+'%'};return _0x474131;})});}_0x9b078b=_[_0xbbb3('0x3f')]({},_0x9b078b,_0x3d5c48[_0xbbb3('0x47')]);return db[_0xbbb3('0x5c')][_0xbbb3('0x1c')]({'where':_0x9b078b[_0xbbb3('0x3c')]})[_0xbbb3('0x26')](function(_0x1c2f36){_0x2063d9[_0xbbb3('0x1c')]=_0x1c2f36;if(_0x3d5c48[_0xbbb3('0x34')][_0xbbb3('0x46')]){_0x9b078b[_0xbbb3('0x41')]=[{'all':!![]}];}return db[_0xbbb3('0x5c')][_0xbbb3('0x5d')](_0x9b078b);})[_0xbbb3('0x26')](function(_0xa36878){_0x2063d9[_0xbbb3('0x42')]=_0xa36878;return _0x2063d9;});}})['then'](respondWithFilteredResult(_0x333e80,_0x9b078b))[_0xbbb3('0x43')](handleError(_0x333e80,null));};exports[_0xbbb3('0x5e')]=function(_0x3a1329,_0x5a32e0,_0x24512e){var _0x4f2787={'raw':!![],'where':{}};var _0x2db34d={};var _0x132ef0={'count':0x0,'rows':[]};return db[_0xbbb3('0x40')]['findOne']({'where':{'id':_0x3a1329[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x5a32e0,null))[_0xbbb3('0x26')](function(_0x2428df){if(_0x2428df){_0x2db34d[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db['CmHopperHistory']['rawAttributes']);_0x2db34d['query']=_[_0xbbb3('0x45')](_0x3a1329[_0xbbb3('0x34')]);_0x2db34d[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x2db34d['model'],_0x2db34d['query']);_0x4f2787[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x2db34d[_0xbbb3('0x32')],qs['fields'](_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x4f2787[_0xbbb3('0x38')]=_0x4f2787[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x4f2787[_0xbbb3('0x38')]:_0x2db34d['model'];if(!_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x59')](_0xbbb3('0x3a'))){_0x4f2787['limit']=qs[_0xbbb3('0x1e')](_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x4f2787[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0x3a1329[_0xbbb3('0x34')]['offset']);}_0x4f2787[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x3b')]);_0x4f2787[_0xbbb3('0x3c')]=qs['filters'](_[_0xbbb3('0x3d')](_0x3a1329[_0xbbb3('0x34')],_0x2db34d['filters']));_0x4f2787[_0xbbb3('0x3c')][_0xbbb3('0x5b')]=_0x2428df['id'];if(_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x4f2787[_0xbbb3('0x3c')]=_['merge'](_0x4f2787[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x4f2787[_0xbbb3('0x38')],function(_0x27bbeb){var _0x1f120d={};_0x1f120d[_0x27bbeb]={'$like':'%'+_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x3e')]+'%'};return _0x1f120d;})});}_0x4f2787=_[_0xbbb3('0x3f')]({},_0x4f2787,_0x3a1329[_0xbbb3('0x47')]);return db['CmHopperHistory'][_0xbbb3('0x1c')]({'where':_0x4f2787['where']})[_0xbbb3('0x26')](function(_0x1e6ce3){_0x132ef0[_0xbbb3('0x1c')]=_0x1e6ce3;if(_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x46')]){_0x4f2787['include']=[{'all':!![]}];}return db[_0xbbb3('0x5f')][_0xbbb3('0x5d')](_0x4f2787);})[_0xbbb3('0x26')](function(_0x204092){_0x132ef0[_0xbbb3('0x42')]=_0x204092;return _0x132ef0;});}})[_0xbbb3('0x26')](respondWithFilteredResult(_0x5a32e0,_0x4f2787))[_0xbbb3('0x43')](handleError(_0x5a32e0,null));};exports['getHopperFinals']=function(_0x3ecafe,_0x4f18a5,_0x2128cd){var _0x3cb334={'raw':!![],'where':{}};var _0x1387ef={};var _0x399c79={'count':0x0,'rows':[]};return db[_0xbbb3('0x40')][_0xbbb3('0x58')]({'where':{'id':_0x3ecafe[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x4f18a5,null))[_0xbbb3('0x26')](function(_0x4a4e20){if(_0x4a4e20){_0x1387ef[_0xbbb3('0x32')]=_['keys'](db[_0xbbb3('0x60')][_0xbbb3('0x2f')]);_0x1387ef['query']=_['keys'](_0x3ecafe['query']);_0x1387ef[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x1387ef[_0xbbb3('0x32')],_0x1387ef['query']);_0x3cb334[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x1387ef[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0x3ecafe['query'][_0xbbb3('0x37')]));_0x3cb334[_0xbbb3('0x38')]=_0x3cb334[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x3cb334[_0xbbb3('0x38')]:_0x1387ef[_0xbbb3('0x32')];if(!_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x59')](_0xbbb3('0x3a'))){_0x3cb334[_0xbbb3('0x1e')]=qs[_0xbbb3('0x1e')](_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x3cb334[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x1d')]);}_0x3cb334[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x3b')]);_0x3cb334[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_['pick'](_0x3ecafe[_0xbbb3('0x34')],_0x1387ef['filters']));_0x3cb334[_0xbbb3('0x3c')]['CampaignId']=_0x4a4e20['id'];if(_0x3ecafe[_0xbbb3('0x34')]['filter']){_0x3cb334['where']=_[_0xbbb3('0x3f')](_0x3cb334[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x3cb334[_0xbbb3('0x38')],function(_0x279069){var _0x226409={};_0x226409[_0x279069]={'$like':'%'+_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x3e')]+'%'};return _0x226409;})});}_0x3cb334=_[_0xbbb3('0x3f')]({},_0x3cb334,_0x3ecafe[_0xbbb3('0x47')]);return db[_0xbbb3('0x60')][_0xbbb3('0x1c')]({'where':_0x3cb334[_0xbbb3('0x3c')]})['then'](function(_0x4c6767){_0x399c79['count']=_0x4c6767;if(_0x3ecafe['query'][_0xbbb3('0x46')]){_0x3cb334[_0xbbb3('0x41')]=[{'all':!![]}];}return db[_0xbbb3('0x60')]['findAll'](_0x3cb334);})[_0xbbb3('0x26')](function(_0x22ee0c){_0x399c79[_0xbbb3('0x42')]=_0x22ee0c;return _0x399c79;});}})['then'](respondWithFilteredResult(_0x4f18a5,_0x3cb334))[_0xbbb3('0x43')](handleError(_0x4f18a5,null));};exports['getHopperBlacks']=function(_0x1f72b0,_0x55b954,_0x41c773){var _0x3216bf={'raw':!![],'where':{}};var _0x4d0932={};var _0x15a56b={'count':0x0,'rows':[]};return db[_0xbbb3('0x40')][_0xbbb3('0x58')]({'where':{'id':_0x1f72b0[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x55b954,null))['then'](function(_0x1e9ef2){if(_0x1e9ef2){_0x4d0932['model']=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x4d0932[_0xbbb3('0x34')]=_[_0xbbb3('0x45')](_0x1f72b0[_0xbbb3('0x34')]);_0x4d0932[_0xbbb3('0x35')]=_['intersection'](_0x4d0932[_0xbbb3('0x32')],_0x4d0932[_0xbbb3('0x34')]);_0x3216bf[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x4d0932['model'],qs[_0xbbb3('0x37')](_0x1f72b0[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x3216bf['attributes']=_0x3216bf[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x3216bf['attributes']:_0x4d0932[_0xbbb3('0x32')];if(!_0x1f72b0[_0xbbb3('0x34')]['hasOwnProperty'](_0xbbb3('0x3a'))){_0x3216bf[_0xbbb3('0x1e')]=qs[_0xbbb3('0x1e')](_0x1f72b0[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x3216bf[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0x1f72b0[_0xbbb3('0x34')]['offset']);}_0x3216bf['order']=qs['sort'](_0x1f72b0['query'][_0xbbb3('0x3b')]);_0x3216bf[_0xbbb3('0x3c')]=qs['filters'](_['pick'](_0x1f72b0[_0xbbb3('0x34')],_0x4d0932[_0xbbb3('0x35')]));_0x3216bf[_0xbbb3('0x3c')][_0xbbb3('0x5b')]=_0x1e9ef2['id'];if(_0x1f72b0[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x3216bf[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x3216bf['where'],{'$or':_[_0xbbb3('0x33')](_0x3216bf[_0xbbb3('0x38')],function(_0x3e82b9){var _0x13d882={};_0x13d882[_0x3e82b9]={'$like':'%'+_0x1f72b0['query']['filter']+'%'};return _0x13d882;})});}_0x3216bf=_['merge']({},_0x3216bf,_0x1f72b0[_0xbbb3('0x47')]);return db[_0xbbb3('0x61')][_0xbbb3('0x1c')]({'where':_0x3216bf[_0xbbb3('0x3c')]})['then'](function(_0x22d688){_0x15a56b['count']=_0x22d688;if(_0x1f72b0[_0xbbb3('0x34')]['includeAll']){_0x3216bf['include']=[{'all':!![]}];}return db[_0xbbb3('0x61')][_0xbbb3('0x5d')](_0x3216bf);})[_0xbbb3('0x26')](function(_0x17df42){_0x15a56b[_0xbbb3('0x42')]=_0x17df42;return _0x15a56b;});}})['then'](respondWithFilteredResult(_0x55b954,_0x3216bf))['catch'](handleError(_0x55b954,null));};exports[_0xbbb3('0x62')]=function(_0x52f2f2,_0x41fd52,_0x545837){var _0x1c27dc={};var _0x375ed1={};var _0x6a9969;var _0x2df628;return db[_0xbbb3('0x40')]['findOne']({'where':{'id':_0x52f2f2[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x41fd52,null))[_0xbbb3('0x26')](function(_0x791420){if(_0x791420){_0x6a9969=_0x791420;_0x375ed1[_0xbbb3('0x32')]=_['keys'](db['CmList'][_0xbbb3('0x2f')]);_0x375ed1[_0xbbb3('0x34')]=_[_0xbbb3('0x45')](_0x52f2f2['query']);_0x375ed1[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x375ed1['model'],_0x375ed1[_0xbbb3('0x34')]);_0x1c27dc[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x375ed1['model'],qs['fields'](_0x52f2f2[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x1c27dc[_0xbbb3('0x38')]=_0x1c27dc[_0xbbb3('0x38')]['length']?_0x1c27dc['attributes']:_0x375ed1[_0xbbb3('0x32')];_0x1c27dc[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0x52f2f2[_0xbbb3('0x34')]['sort']);_0x1c27dc['where']=qs[_0xbbb3('0x35')](_['pick'](_0x52f2f2[_0xbbb3('0x34')],_0x375ed1[_0xbbb3('0x35')]));if(_0x52f2f2[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x1c27dc[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x1c27dc[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x1c27dc[_0xbbb3('0x38')],function(_0x104905){var _0x113a80={};_0x113a80[_0x104905]={'$like':'%'+_0x52f2f2[_0xbbb3('0x34')]['filter']+'%'};return _0x113a80;})});}_0x1c27dc=_[_0xbbb3('0x3f')]({},_0x1c27dc,_0x52f2f2[_0xbbb3('0x47')]);return _0x6a9969[_0xbbb3('0x62')](_0x1c27dc);}})[_0xbbb3('0x26')](function(_0x2e1e51){if(_0x2e1e51){_0x2df628=_0x2e1e51[_0xbbb3('0x39')];if(!_0x52f2f2[_0xbbb3('0x34')][_0xbbb3('0x59')](_0xbbb3('0x3a'))){_0x1c27dc[_0xbbb3('0x1e')]=qs['limit'](_0x52f2f2[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x1c27dc[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0x52f2f2[_0xbbb3('0x34')]['offset']);}return _0x6a9969[_0xbbb3('0x62')](_0x1c27dc);}})['then'](function(_0x1fd9e6){if(_0x1fd9e6){return _0x1fd9e6?{'count':_0x2df628,'rows':_0x1fd9e6}:null;}})[_0xbbb3('0x26')](respondWithResult(_0x41fd52,null))[_0xbbb3('0x43')](handleError(_0x41fd52,null));};exports[_0xbbb3('0x63')]=function(_0x585229,_0xe51c45,_0x474943){var _0x4abd1d,_0x2ab8f0;return db[_0xbbb3('0x40')]['find']({'where':{'id':_0x585229['params']['id']}})['then'](handleEntityNotFound(_0xe51c45,null))[_0xbbb3('0x26')](function(_0x271c30){if(_0x271c30){_0x2ab8f0=_0x271c30;return _0x271c30[_0xbbb3('0x63')](_0x585229[_0xbbb3('0x4a')][_0xbbb3('0x64')],_[_0xbbb3('0x53')](_0x585229[_0xbbb3('0x4a')],[_0xbbb3('0x64'),'id'])||{});}return null;})[_0xbbb3('0x65')](function(_0x4863ff){var _0x54ef3d;_0x4abd1d=_0x4863ff||[];var _0x59139f=[];if(_0x4863ff){for(var _0x310494=0x0;_0x310494<_0x4863ff['length'];_0x310494+=0x1){var _0x1015a9=_0x4863ff[_0x310494]['get']({'plain':!![]});_0x2ab8f0['dialCheckDuplicateType']=_0x585229[_0xbbb3('0x4a')][_0xbbb3('0x66')]?_0x585229[_0xbbb3('0x4a')][_0xbbb3('0x66')]:_0x2ab8f0[_0xbbb3('0x66')];switch(_0x2ab8f0[_0xbbb3('0x66')]){case _0xbbb3('0x67'):_0x54ef3d=squel[_0xbbb3('0x68')]()['into'](_0xbbb3('0x69'))[_0xbbb3('0x6a')]([_0xbbb3('0x6b'),_0xbbb3('0x6c'),'ContactId',_0xbbb3('0x6d'),'CampaignId',_0xbbb3('0x54'),'updatedAt'],squel[_0xbbb3('0x6e')]()['field']('phone','phone')[_0xbbb3('0x6f')](_0xbbb3('0x70'),'scheduledAt')[_0xbbb3('0x6f')]('id',_0xbbb3('0x71'))[_0xbbb3('0x6f')](_0x1015a9['CmListId'][_0xbbb3('0x72')](),_0xbbb3('0x6d'))[_0xbbb3('0x6f')](_0x585229['params']['id'][_0xbbb3('0x72')](),_0xbbb3('0x5b'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x54'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x55'))[_0xbbb3('0x73')](_0xbbb3('0x74'))['where'](_0xbbb3('0x75'))['where'](_0xbbb3('0x76'),_0x1015a9[_0xbbb3('0x77')][_0xbbb3('0x72')]())[_0xbbb3('0x3c')](_0xbbb3('0x78'))['where'](_0xbbb3('0x79'),squel[_0xbbb3('0x6e')]()[_0xbbb3('0x6f')](_0xbbb3('0x7a'))[_0xbbb3('0x73')](_0xbbb3('0x7b'))[_0xbbb3('0x3c')](_0xbbb3('0x7c'),_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')]()))['where'](_0xbbb3('0x79'),squel['select']()[_0xbbb3('0x6f')](_0xbbb3('0x7d'))['from'](_0xbbb3('0x69'))[_0xbbb3('0x3c')](_0xbbb3('0x7c'),_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')]())))['toString']();break;case _0xbbb3('0x7e'):_0x54ef3d=squel[_0xbbb3('0x68')]()[_0xbbb3('0x7f')]('cm_hopper')[_0xbbb3('0x6a')]([_0xbbb3('0x6b'),'scheduledAt','ContactId',_0xbbb3('0x6d'),_0xbbb3('0x5b'),_0xbbb3('0x54'),_0xbbb3('0x55')],squel[_0xbbb3('0x6e')]()[_0xbbb3('0x6f')](_0xbbb3('0x6b'),_0xbbb3('0x6b'))[_0xbbb3('0x6f')]('NOW()',_0xbbb3('0x6c'))['field']('id',_0xbbb3('0x71'))[_0xbbb3('0x6f')](_0x1015a9[_0xbbb3('0x77')][_0xbbb3('0x72')](),_0xbbb3('0x6d'))[_0xbbb3('0x6f')](_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')](),'CampaignId')[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x54'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x55'))[_0xbbb3('0x73')]('cm_contacts')[_0xbbb3('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0xbbb3('0x76'),_0x1015a9['CmListId'][_0xbbb3('0x72')]())[_0xbbb3('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xbbb3('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbbb3('0x6e')]()['field'](_0xbbb3('0x7d'))[_0xbbb3('0x73')](_0xbbb3('0x69'))[_0xbbb3('0x3c')](_0xbbb3('0x7c'),_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')]())))[_0xbbb3('0x72')]();break;default:_0x54ef3d=squel[_0xbbb3('0x68')]()['into'](_0xbbb3('0x69'))[_0xbbb3('0x6a')]([_0xbbb3('0x6b'),_0xbbb3('0x6c'),'ContactId',_0xbbb3('0x6d'),'CampaignId','createdAt','updatedAt'],squel['select']()[_0xbbb3('0x6f')](_0xbbb3('0x6b'),'phone')[_0xbbb3('0x6f')]('NOW()',_0xbbb3('0x6c'))[_0xbbb3('0x6f')]('id',_0xbbb3('0x71'))[_0xbbb3('0x6f')](_0x1015a9[_0xbbb3('0x77')][_0xbbb3('0x72')](),_0xbbb3('0x6d'))['field'](_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')](),_0xbbb3('0x5b'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x54'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x55'))[_0xbbb3('0x73')](_0xbbb3('0x74'))['where'](_0xbbb3('0x75'))[_0xbbb3('0x3c')](_0xbbb3('0x76'),_0x1015a9[_0xbbb3('0x77')][_0xbbb3('0x72')]())['where'](_0xbbb3('0x78')))['toString']();}_0x59139f[_0xbbb3('0x80')](db[_0xbbb3('0x81')][_0xbbb3('0x34')](_0x54ef3d));}return BPromise[_0xbbb3('0x82')](_0x59139f);}})['then'](function(){return _0x4abd1d;})[_0xbbb3('0x26')](respondWithResult(_0xe51c45,null))[_0xbbb3('0x43')](handleError(_0xe51c45,null));};exports[_0xbbb3('0x83')]=function(_0x425070,_0x156a57,_0x133380){return db[_0xbbb3('0x40')][_0xbbb3('0x48')]({'where':{'id':_0x425070[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x156a57,null))[_0xbbb3('0x26')](function(_0x42df80){if(_0x42df80){return _0x42df80[_0xbbb3('0x83')](_0x425070[_0xbbb3('0x34')]['ids']);}})[_0xbbb3('0x26')](function(_0x3a61be){if(_0x3a61be){return db['CmHopper'][_0xbbb3('0x25')]({'where':{'ListId':_0x425070[_0xbbb3('0x34')][_0xbbb3('0x64')],'CampaignId':_0x425070[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](function(){return _0x3a61be;});}})[_0xbbb3('0x26')](respondWithStatusCode(_0x156a57,null))[_0xbbb3('0x43')](handleError(_0x156a57,null));};exports[_0xbbb3('0x84')]=function(_0xa1e36c,_0x454b7f,_0x4f6e38){var _0x91a36a={'raw':!![],'where':{}};var _0x3b5854={};var _0x9a4370={'count':0x0,'rows':[]};return db[_0xbbb3('0x40')][_0xbbb3('0x58')]({'where':{'id':_0xa1e36c['params']['id']}})['then'](handleEntityNotFound(_0x454b7f,null))[_0xbbb3('0x26')](function(_0x327d3b){if(_0x327d3b){_0x3b5854[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db[_0xbbb3('0x85')][_0xbbb3('0x2f')]);_0x3b5854['query']=_[_0xbbb3('0x45')](_0xa1e36c['query']);_0x3b5854['filters']=_[_0xbbb3('0x36')](_0x3b5854['model'],_0x3b5854[_0xbbb3('0x34')]);_0x91a36a[_0xbbb3('0x38')]=_['intersection'](_0x3b5854[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0xa1e36c[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x91a36a[_0xbbb3('0x38')]=_0x91a36a['attributes']['length']?_0x91a36a[_0xbbb3('0x38')]:_0x3b5854[_0xbbb3('0x32')];if(!_0xa1e36c[_0xbbb3('0x34')][_0xbbb3('0x59')]('nolimit')){_0x91a36a[_0xbbb3('0x1e')]=qs[_0xbbb3('0x1e')](_0xa1e36c['query']['limit']);_0x91a36a[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0xa1e36c['query'][_0xbbb3('0x1d')]);}_0x91a36a[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0xa1e36c[_0xbbb3('0x34')][_0xbbb3('0x3b')]);_0x91a36a[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0xa1e36c[_0xbbb3('0x34')],_0x3b5854[_0xbbb3('0x35')]));_0x91a36a[_0xbbb3('0x3c')][_0xbbb3('0x5b')]=_0x327d3b['id'];if(_0xa1e36c[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x91a36a[_0xbbb3('0x3c')]=_['merge'](_0x91a36a[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x91a36a[_0xbbb3('0x38')],function(_0x4b34fc){var _0x37e3ac={};_0x37e3ac[_0x4b34fc]={'$like':'%'+_0xa1e36c['query'][_0xbbb3('0x3e')]+'%'};return _0x37e3ac;})});}_0x91a36a=_['merge']({},_0x91a36a,_0xa1e36c[_0xbbb3('0x47')]);return db['CmList'][_0xbbb3('0x1c')]({'where':_0x91a36a[_0xbbb3('0x3c')]})['then'](function(_0x1b6920){_0x9a4370[_0xbbb3('0x1c')]=_0x1b6920;if(_0xa1e36c[_0xbbb3('0x34')]['includeAll']){_0x91a36a[_0xbbb3('0x41')]=[{'all':!![]}];}return db[_0xbbb3('0x85')]['findAll'](_0x91a36a);})[_0xbbb3('0x26')](function(_0x14f6b5){_0x9a4370[_0xbbb3('0x42')]=_0x14f6b5;return _0x9a4370;});}})[_0xbbb3('0x26')](respondWithFilteredResult(_0x454b7f,_0x91a36a))[_0xbbb3('0x43')](handleError(_0x454b7f,null));};exports[_0xbbb3('0x86')]=function(_0x32b8db,_0x115807,_0x26b4a9){var _0x205370,_0x10c524;return db['Campaign'][_0xbbb3('0x48')]({'where':{'id':_0x32b8db['params']['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x115807,null))['then'](function(_0x5a10a5){if(_0x5a10a5){_0x10c524=_0x5a10a5;return _0x5a10a5[_0xbbb3('0x86')](_0x32b8db[_0xbbb3('0x4a')]['ids'],_[_0xbbb3('0x53')](_0x32b8db[_0xbbb3('0x4a')],['ids','id'])||{});}return null;})[_0xbbb3('0x65')](function(_0x26c0e2){var _0x2a14b8;_0x205370=_0x26c0e2||[];var _0x28be3b=[];if(_0x26c0e2){for(var _0x36e5e8=0x0;_0x36e5e8<_0x26c0e2['length'];_0x36e5e8+=0x1){var _0x6d1626=_0x26c0e2[_0x36e5e8][_0xbbb3('0x27')]({'plain':!![]});_0x2a14b8=squel[_0xbbb3('0x68')]()[_0xbbb3('0x7f')]('cm_hopper_black')[_0xbbb3('0x6a')]([_0xbbb3('0x6b'),_0xbbb3('0x71'),'ListId',_0xbbb3('0x5b'),'createdAt','updatedAt'],squel[_0xbbb3('0x6e')]()[_0xbbb3('0x6f')](_0xbbb3('0x6b'),_0xbbb3('0x6b'))[_0xbbb3('0x6f')]('id',_0xbbb3('0x71'))[_0xbbb3('0x6f')](_0x6d1626[_0xbbb3('0x77')][_0xbbb3('0x72')](),_0xbbb3('0x6d'))[_0xbbb3('0x6f')](_0x32b8db[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')](),_0xbbb3('0x5b'))['field']('NOW()',_0xbbb3('0x54'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),'updatedAt')[_0xbbb3('0x73')]('cm_contacts')[_0xbbb3('0x3c')](_0xbbb3('0x75'))['where'](_0xbbb3('0x76'),_0x6d1626[_0xbbb3('0x77')][_0xbbb3('0x72')]())[_0xbbb3('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xbbb3('0x72')]();_0x28be3b[_0xbbb3('0x80')](db[_0xbbb3('0x81')][_0xbbb3('0x34')](_0x2a14b8));}return BPromise[_0xbbb3('0x82')](_0x28be3b);}})[_0xbbb3('0x26')](function(){return _0x205370;})[_0xbbb3('0x26')](respondWithResult(_0x115807,null))[_0xbbb3('0x43')](handleError(_0x115807,null));};exports['removeBlackLists']=function(_0x50f614,_0x2a6d4f,_0x33fa68){return db['Campaign'][_0xbbb3('0x48')]({'where':{'id':_0x50f614[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x2a6d4f,null))[_0xbbb3('0x26')](function(_0x31ad6b){if(_0x31ad6b){return _0x31ad6b[_0xbbb3('0x87')](_0x50f614[_0xbbb3('0x34')][_0xbbb3('0x64')]);}})[_0xbbb3('0x26')](function(_0x355dcc){if(_0x355dcc){return db[_0xbbb3('0x61')]['destroy']({'where':{'ListId':_0x50f614[_0xbbb3('0x34')][_0xbbb3('0x64')],'CampaignId':_0x50f614['params']['id']}})[_0xbbb3('0x26')](function(){return _0x355dcc;});}})[_0xbbb3('0x26')](respondWithStatusCode(_0x2a6d4f,null))[_0xbbb3('0x43')](handleError(_0x2a6d4f,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index fcb9e12..bcc5109 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x205423,_0x37236d){var _0x2612eb=function(_0x456426){while(--_0x456426){_0x205423['push'](_0x205423['shift']());}};_0x2612eb(++_0x37236d);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5c6c30,_0x2ec907){var _0x310c4e=function(_0x23931f){while(--_0x23931f){_0x5c6c30['push'](_0x5c6c30['shift']());}};_0x310c4e(++_0x2ec907);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 67e9036..734613d 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(_0x5b1a13,_0x2b4c39){var _0x5ca732=function(_0x388a35){while(--_0x388a35){_0x5b1a13['push'](_0x5b1a13['shift']());}};_0x5ca732(++_0x2b4c39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x71435,_0x5627a7){var _0x40de4f=function(_0x383620){while(--_0x383620){_0x71435['push'](_0x71435['shift']());}};_0x40de4f(++_0x5627a7);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 6363332..9de2552 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 _0x43c0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists'];(function(_0x504f5d,_0x5f50e2){var _0x4b76a1=function(_0x2c9263){while(--_0x2c9263){_0x504f5d['push'](_0x504f5d['shift']());}};_0x4b76a1(++_0x5f50e2);}(_0x43c0,0x13b));var _0x043c=function(_0x5dc56d,_0x3ca8f0){_0x5dc56d=_0x5dc56d-0x0;var _0x144f0a=_0x43c0[_0x5dc56d];return _0x144f0a;};'use strict';var multer=require(_0x043c('0x0'));var util=require(_0x043c('0x1'));var path=require(_0x043c('0x2'));var timeout=require(_0x043c('0x3'));var express=require(_0x043c('0x4'));var router=express[_0x043c('0x5')]();var auth=require(_0x043c('0x6'));var interaction=require(_0x043c('0x7'));var config=require(_0x043c('0x8'));var controller=require('./campaign.controller');router[_0x043c('0x9')]('/',auth[_0x043c('0xa')](),controller[_0x043c('0xb')]);router[_0x043c('0x9')](_0x043c('0xc'),auth['isAuthenticated'](),controller[_0x043c('0xd')]);router[_0x043c('0x9')](_0x043c('0xe'),auth[_0x043c('0xa')](),controller['getHoppers']);router['get'](_0x043c('0xf'),auth[_0x043c('0xa')](),controller[_0x043c('0x10')]);router[_0x043c('0x9')](_0x043c('0x11'),auth[_0x043c('0xa')](),controller[_0x043c('0x12')]);router[_0x043c('0x9')](_0x043c('0x13'),auth[_0x043c('0xa')](),controller['getHopperBlacks']);router[_0x043c('0x9')](_0x043c('0x14'),auth[_0x043c('0xa')](),controller[_0x043c('0x15')]);router[_0x043c('0x9')]('/:id/blacklists',auth[_0x043c('0xa')](),controller[_0x043c('0x16')]);router[_0x043c('0x17')]('/',auth[_0x043c('0xa')](),controller[_0x043c('0x18')]);router[_0x043c('0x17')](_0x043c('0x19'),auth[_0x043c('0xa')](),controller[_0x043c('0x1a')]);router['post'](_0x043c('0x14'),auth[_0x043c('0xa')](),controller[_0x043c('0x1b')]);router[_0x043c('0x17')](_0x043c('0x1c'),auth[_0x043c('0xa')](),controller[_0x043c('0x1d')]);router[_0x043c('0x1e')](_0x043c('0xc'),auth[_0x043c('0xa')](),controller['update']);router[_0x043c('0x1f')](_0x043c('0xc'),auth[_0x043c('0xa')](),controller[_0x043c('0x20')]);router[_0x043c('0x1f')]('/:id/lists',auth[_0x043c('0xa')](),controller[_0x043c('0x21')]);router[_0x043c('0x1f')](_0x043c('0x1c'),auth['isAuthenticated'](),controller[_0x043c('0x22')]);module['exports']=router; \ No newline at end of file +var _0x30d5=['getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','/:id','update','delete','destroy','removeLists','/:id/blacklists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show'];(function(_0x3f50ea,_0x32940c){var _0x59f2f1=function(_0xfb9fa9){while(--_0xfb9fa9){_0x3f50ea['push'](_0x3f50ea['shift']());}};_0x59f2f1(++_0x32940c);}(_0x30d5,0x1ae));var _0x530d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x30d5[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x530d('0x0'));var util=require(_0x530d('0x1'));var path=require(_0x530d('0x2'));var timeout=require(_0x530d('0x3'));var express=require(_0x530d('0x4'));var router=express[_0x530d('0x5')]();var auth=require(_0x530d('0x6'));var interaction=require(_0x530d('0x7'));var config=require(_0x530d('0x8'));var controller=require(_0x530d('0x9'));router[_0x530d('0xa')]('/',auth[_0x530d('0xb')](),controller[_0x530d('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x530d('0xd')]);router['get']('/:id/hoppers',auth[_0x530d('0xb')](),controller[_0x530d('0xe')]);router[_0x530d('0xa')]('/:id/hopper_histories',auth[_0x530d('0xb')](),controller[_0x530d('0xf')]);router[_0x530d('0xa')](_0x530d('0x10'),auth[_0x530d('0xb')](),controller[_0x530d('0x11')]);router['get'](_0x530d('0x12'),auth[_0x530d('0xb')](),controller[_0x530d('0x13')]);router[_0x530d('0xa')](_0x530d('0x14'),auth[_0x530d('0xb')](),controller[_0x530d('0x15')]);router['get']('/:id/blacklists',auth[_0x530d('0xb')](),controller[_0x530d('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0x530d('0x17')]);router[_0x530d('0x18')](_0x530d('0x19'),auth[_0x530d('0xb')](),controller[_0x530d('0x1a')]);router[_0x530d('0x18')]('/:id/lists',auth[_0x530d('0xb')](),controller[_0x530d('0x1b')]);router[_0x530d('0x18')]('/:id/blacklists',auth[_0x530d('0xb')](),controller[_0x530d('0x1c')]);router['put'](_0x530d('0x1d'),auth[_0x530d('0xb')](),controller[_0x530d('0x1e')]);router[_0x530d('0x1f')](_0x530d('0x1d'),auth[_0x530d('0xb')](),controller[_0x530d('0x20')]);router[_0x530d('0x1f')](_0x530d('0x14'),auth[_0x530d('0xb')](),controller[_0x530d('0x21')]);router[_0x530d('0x1f')](_0x530d('0x22'),auth[_0x530d('0xb')](),controller[_0x530d('0x23')]);module[_0x530d('0x24')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 84c0cda..846ec2a 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 _0xc689=['getDataValue','sequelize','exports','STRING','VIRTUAL'];(function(_0x2c1280,_0x3e01f9){var _0x1fae85=function(_0x3e3b5a){while(--_0x3e3b5a){_0x2c1280['push'](_0x2c1280['shift']());}};_0x1fae85(++_0x3e01f9);}(_0xc689,0x1b4));var _0x9c68=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0xc689[_0x22ffbf];return _0x360c17;};'use strict';var Sequelize=require(_0x9c68('0x0'));module[_0x9c68('0x1')]={'key':{'type':Sequelize[_0x9c68('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x9c68('0x2')]},'name':{'type':Sequelize[_0x9c68('0x3')],'get':function(){return this[_0x9c68('0x4')]('key');}}}; \ No newline at end of file +var _0x98cb=['TEXT','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x39ee91,_0x410a18){var _0x1cef4a=function(_0x40dd24){while(--_0x40dd24){_0x39ee91['push'](_0x39ee91['shift']());}};_0x1cef4a(++_0x410a18);}(_0x98cb,0x1a1));var _0xb98c=function(_0x27be77,_0x4af20d){_0x27be77=_0x27be77-0x0;var _0x16df46=_0x98cb[_0x27be77];return _0x16df46;};'use strict';var Sequelize=require(_0xb98c('0x0'));module[_0xb98c('0x1')]={'key':{'type':Sequelize[_0xb98c('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb98c('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xb98c('0x2')]},'name':{'type':Sequelize[_0xb98c('0x4')],'get':function(){return this[_0xb98c('0x5')](_0xb98c('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 96f87c2..c756034 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 _0xbc8e=['then','get','CannedAnswers','UserProfileResource','destroy','sendStatus','error','name','index','CannedAnswer','rawAttributes','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','status','end','json','count','offset','limit','set','apply','save','update'];(function(_0x306376,_0x2ce4d5){var _0x22a613=function(_0x94379f){while(--_0x94379f){_0x306376['push'](_0x306376['shift']());}};_0x22a613(++_0x2ce4d5);}(_0xbc8e,0xd7));var _0xebc8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbc8e[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0xebc8('0x0'));var emlformat=require(_0xebc8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xebc8('0x2'));var jsonpatch=require(_0xebc8('0x3'));var rp=require(_0xebc8('0x4'));var moment=require(_0xebc8('0x5'));var BPromise=require(_0xebc8('0x6'));var Mustache=require('mustache');var util=require(_0xebc8('0x7'));var path=require(_0xebc8('0x8'));var sox=require('sox');var csv=require(_0xebc8('0x9'));var ejs=require(_0xebc8('0xa'));var fs=require('fs');var _=require(_0xebc8('0xb'));var squel=require('squel');var crypto=require(_0xebc8('0xc'));var jsforce=require(_0xebc8('0xd'));var deskjs=require(_0xebc8('0xe'));var toCsv=require(_0xebc8('0x9'));var querystring=require(_0xebc8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xebc8('0x10'));var qs=require(_0xebc8('0x11'));var as=require(_0xebc8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebc8('0x13'))(_0xebc8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55b734,_0x599dab){_0x599dab=_0x599dab||0xcc;return function(_0x134e80){if(_0x134e80){return _0x55b734['sendStatus'](_0x599dab);}return _0x55b734[_0xebc8('0x15')](_0x599dab)[_0xebc8('0x16')]();};}function respondWithResult(_0x78e094,_0x4fd317){_0x4fd317=_0x4fd317||0xc8;return function(_0x2db7ff){if(_0x2db7ff){return _0x78e094['status'](_0x4fd317)[_0xebc8('0x17')](_0x2db7ff);}};}function respondWithFilteredResult(_0x13549f,_0x3e846a){return function(_0x3393ec){if(_0x3393ec){var _0x355048=_0x3393ec[_0xebc8('0x18')],_0xfebe76=_0x3e846a[_0xebc8('0x19')],_0xb6d547=_0x3e846a[_0xebc8('0x19')]+_0x3e846a[_0xebc8('0x1a')],_0x2e5287;if(_0xb6d547>=_0x355048){_0xb6d547=_0x355048;_0x2e5287=0xc8;}else{_0x2e5287=0xce;}_0x13549f[_0xebc8('0x15')](_0x2e5287);return _0x13549f[_0xebc8('0x1b')]('Content-Range',_0xfebe76+'-'+_0xb6d547+'/'+_0x355048)[_0xebc8('0x17')](_0x3393ec);}return null;};}function patchUpdates(_0xf3643b){return function(_0x172c77){try{jsonpatch[_0xebc8('0x1c')](_0x172c77,_0xf3643b,!![]);}catch(_0x3bfba0){return BPromise['reject'](_0x3bfba0);}return _0x172c77[_0xebc8('0x1d')]();};}function saveUpdates(_0x19bb16,_0x22aede){return function(_0x39379b){if(_0x39379b){return _0x39379b[_0xebc8('0x1e')](_0x19bb16)[_0xebc8('0x1f')](function(_0x366fde){return _0x366fde;});}return null;};}function removeEntity(_0x1984a6,_0x20b581){return function(_0x201933){if(_0x201933){return _0x201933['destroy']()[_0xebc8('0x1f')](function(){var _0xa384b8=_0x201933[_0xebc8('0x20')]({'plain':!![]});var _0x549f09=_0xebc8('0x21');return db[_0xebc8('0x22')][_0xebc8('0x23')]({'where':{'type':_0x549f09,'resourceId':_0xa384b8['id']}})[_0xebc8('0x1f')](function(){return _0x201933;});})[_0xebc8('0x1f')](function(){_0x1984a6['status'](0xcc)[_0xebc8('0x16')]();});}};}function handleEntityNotFound(_0x3e54bd,_0x5731b5){return function(_0x3b16b4){if(!_0x3b16b4){_0x3e54bd[_0xebc8('0x24')](0x194);}return _0x3b16b4;};}function handleError(_0x43b855,_0x4083d1){_0x4083d1=_0x4083d1||0x1f4;return function(_0x4ff6a8){logger[_0xebc8('0x25')](_0x4ff6a8['stack']);if(_0x4ff6a8[_0xebc8('0x26')]){delete _0x4ff6a8[_0xebc8('0x26')];}_0x43b855['status'](_0x4083d1)['send'](_0x4ff6a8);};}exports[_0xebc8('0x27')]=function(_0x269e8e,_0x3ade8d){var _0x4e4e37={},_0x403194={},_0x5e870f={'count':0x0,'rows':[]};var _0x4c9b43=_['map'](db[_0xebc8('0x28')][_0xebc8('0x29')],function(_0x134402){return{'name':_0x134402['fieldName'],'type':_0x134402['type']['key']};});_0x403194[_0xebc8('0x2a')]=_[_0xebc8('0x2b')](_0x4c9b43,_0xebc8('0x26'));_0x403194['query']=_[_0xebc8('0x2c')](_0x269e8e['query']);_0x403194[_0xebc8('0x2d')]=_[_0xebc8('0x2e')](_0x403194['model'],_0x403194[_0xebc8('0x2f')]);_0x4e4e37[_0xebc8('0x30')]=_['intersection'](_0x403194[_0xebc8('0x2a')],qs[_0xebc8('0x31')](_0x269e8e['query']['fields']));_0x4e4e37[_0xebc8('0x30')]=_0x4e4e37[_0xebc8('0x30')][_0xebc8('0x32')]?_0x4e4e37[_0xebc8('0x30')]:_0x403194[_0xebc8('0x2a')];if(!_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x33')]('nolimit')){_0x4e4e37['limit']=qs[_0xebc8('0x1a')](_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x1a')]);_0x4e4e37[_0xebc8('0x19')]=qs[_0xebc8('0x19')](_0x269e8e['query']['offset']);}_0x4e4e37['order']=qs[_0xebc8('0x34')](_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x34')]);_0x4e4e37[_0xebc8('0x35')]=qs[_0xebc8('0x2d')](_[_0xebc8('0x36')](_0x269e8e['query'],_0x403194[_0xebc8('0x2d')]),_0x4c9b43);if(_0x269e8e['query'][_0xebc8('0x37')]){_0x4e4e37[_0xebc8('0x35')]=_[_0xebc8('0x38')](_0x4e4e37[_0xebc8('0x35')],{'$or':_[_0xebc8('0x2b')](_0x4c9b43,function(_0x279839){if(_0x279839[_0xebc8('0x39')]!==_0xebc8('0x3a')){var _0xad4f77={};_0xad4f77[_0x279839['name']]={'$like':'%'+_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x37')]+'%'};return _0xad4f77;}})});}_0x4e4e37=_['merge']({},_0x4e4e37,_0x269e8e[_0xebc8('0x3b')]);var _0x4941d1={'where':_0x4e4e37['where']};return db[_0xebc8('0x28')]['count'](_0x4941d1)[_0xebc8('0x1f')](function(_0x4eb494){_0x5e870f['count']=_0x4eb494;if(_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x3c')]){_0x4e4e37[_0xebc8('0x3d')]=[{'all':!![]}];}return db[_0xebc8('0x28')]['findAll'](_0x4e4e37);})[_0xebc8('0x1f')](function(_0x4d9c37){_0x5e870f[_0xebc8('0x3e')]=_0x4d9c37;return _0x5e870f;})['then'](respondWithFilteredResult(_0x3ade8d,_0x4e4e37))[_0xebc8('0x3f')](handleError(_0x3ade8d,null));};exports[_0xebc8('0x40')]=function(_0x370b8c,_0x284e32){var _0x4b8d7a={'raw':!![],'where':{'id':_0x370b8c[_0xebc8('0x41')]['id']}},_0x5275b7={};_0x5275b7[_0xebc8('0x2a')]=_[_0xebc8('0x2c')](db[_0xebc8('0x28')][_0xebc8('0x29')]);_0x5275b7[_0xebc8('0x2f')]=_['keys'](_0x370b8c[_0xebc8('0x2f')]);_0x5275b7[_0xebc8('0x2d')]=_[_0xebc8('0x2e')](_0x5275b7['model'],_0x5275b7['query']);_0x4b8d7a[_0xebc8('0x30')]=_[_0xebc8('0x2e')](_0x5275b7[_0xebc8('0x2a')],qs[_0xebc8('0x31')](_0x370b8c['query']['fields']));_0x4b8d7a[_0xebc8('0x30')]=_0x4b8d7a[_0xebc8('0x30')][_0xebc8('0x32')]?_0x4b8d7a['attributes']:_0x5275b7['model'];if(_0x370b8c[_0xebc8('0x2f')][_0xebc8('0x3c')]){_0x4b8d7a[_0xebc8('0x3d')]=[{'all':!![]}];}_0x4b8d7a=_[_0xebc8('0x38')]({},_0x4b8d7a,_0x370b8c[_0xebc8('0x3b')]);return db[_0xebc8('0x28')][_0xebc8('0x42')](_0x4b8d7a)[_0xebc8('0x1f')](handleEntityNotFound(_0x284e32,null))[_0xebc8('0x1f')](respondWithResult(_0x284e32,null))['catch'](handleError(_0x284e32,null));};exports[_0xebc8('0x1e')]=function(_0x259715,_0x2f65a0){if(_0x259715[_0xebc8('0x43')]['id']){delete _0x259715['body']['id'];}return db[_0xebc8('0x28')]['find']({'where':{'id':_0x259715['params']['id']}})[_0xebc8('0x1f')](handleEntityNotFound(_0x2f65a0,null))['then'](saveUpdates(_0x259715[_0xebc8('0x43')],null))['then'](respondWithResult(_0x2f65a0,null))['catch'](handleError(_0x2f65a0,null));};exports['destroy']=function(_0x34fe45,_0x2a2e19){return db[_0xebc8('0x28')][_0xebc8('0x42')]({'where':{'id':_0x34fe45[_0xebc8('0x41')]['id']}})[_0xebc8('0x1f')](handleEntityNotFound(_0x2a2e19,null))[_0xebc8('0x1f')](removeEntity(_0x2a2e19,null))['catch'](handleError(_0x2a2e19,null));};exports[_0xebc8('0x44')]=function(_0x1952ae,_0x331650){var _0x5a282a={'key':_0x1952ae[_0xebc8('0x43')][_0xebc8('0x45')]};if(_0x1952ae['body'][_0xebc8('0x46')]){_0x5a282a[_0xebc8('0x46')]=_0x1952ae[_0xebc8('0x43')][_0xebc8('0x46')];}else if(_0x1952ae[_0xebc8('0x43')][_0xebc8('0x47')]){_0x5a282a['SmsAccountId']=_0x1952ae[_0xebc8('0x43')]['SmsAccountId'];}else if(_0x1952ae[_0xebc8('0x43')][_0xebc8('0x48')]){_0x5a282a[_0xebc8('0x48')]=_0x1952ae[_0xebc8('0x43')]['OpenchannelAccountId'];}else if(_0x1952ae[_0xebc8('0x43')][_0xebc8('0x49')]){_0x5a282a[_0xebc8('0x49')]=_0x1952ae[_0xebc8('0x43')][_0xebc8('0x49')];}return db[_0xebc8('0x28')][_0xebc8('0x42')]({'where':_0x5a282a})[_0xebc8('0x1f')](function(_0x1c6930){if(_0x1c6930){throw new db[(_0xebc8('0x4a'))][(_0xebc8('0x4b'))](_0xebc8('0x4c'));}return db[_0xebc8('0x28')][_0xebc8('0x44')](_0x1952ae['body']);})[_0xebc8('0x1f')](function(_0x2d687f){var _0x2ae5a3=_0x1952ae[_0xebc8('0x4d')][_0xebc8('0x20')]({'plain':!![]});if(!_0x2ae5a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ae5a3[_0xebc8('0x4e')]===_0xebc8('0x4d')){var _0x2c7922=_0x2d687f['get']({'plain':!![]});return db[_0xebc8('0x4f')]['find']({'where':{'name':_0xebc8('0x21'),'userProfileId':_0x2ae5a3['userProfileId']},'raw':!![]})[_0xebc8('0x1f')](function(_0x2baabf){if(_0x2baabf&&_0x2baabf[_0xebc8('0x50')]===0x0){return db[_0xebc8('0x22')][_0xebc8('0x44')]({'name':_0x2c7922['name'],'resourceId':_0x2c7922['id'],'type':_0x2baabf['name'],'sectionId':_0x2baabf['id']},{})['then'](function(){return _0x2d687f;});}else{return _0x2d687f;}})[_0xebc8('0x3f')](function(_0x3a9819){logger['error'](_0xebc8('0x51'),_0x3a9819);throw _0x3a9819;});}return _0x2d687f;})[_0xebc8('0x1f')](respondWithResult(_0x331650,0xc9))[_0xebc8('0x3f')](handleError(_0x331650,null));}; \ No newline at end of file +var _0x8399=['attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','filters','find','catch','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','intersection','fields'];(function(_0xab5594,_0x431e01){var _0x1db392=function(_0x2b9964){while(--_0x2b9964){_0xab5594['push'](_0xab5594['shift']());}};_0x1db392(++_0x431e01);}(_0x8399,0xce));var _0x9839=function(_0x268a1e,_0x544592){_0x268a1e=_0x268a1e-0x0;var _0x11d6a0=_0x8399[_0x268a1e];return _0x11d6a0;};'use strict';var pdf=require(_0x9839('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9839('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9839('0x2'));var BPromise=require(_0x9839('0x3'));var Mustache=require(_0x9839('0x4'));var util=require('util');var path=require(_0x9839('0x5'));var sox=require(_0x9839('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9839('0x7'));var squel=require(_0x9839('0x8'));var crypto=require(_0x9839('0x9'));var jsforce=require(_0x9839('0xa'));var deskjs=require(_0x9839('0xb'));var toCsv=require(_0x9839('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9839('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9839('0xe'));var as=require(_0x9839('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9839('0x10'));var utils=require(_0x9839('0x11'));var config=require(_0x9839('0x12'));var db=require(_0x9839('0x13'))['db'];function respondWithStatusCode(_0x48c7e5,_0x2f70fb){_0x2f70fb=_0x2f70fb||0xcc;return function(_0x43f33a){if(_0x43f33a){return _0x48c7e5[_0x9839('0x14')](_0x2f70fb);}return _0x48c7e5[_0x9839('0x15')](_0x2f70fb)[_0x9839('0x16')]();};}function respondWithResult(_0x134b55,_0x197bdb){_0x197bdb=_0x197bdb||0xc8;return function(_0x42f15e){if(_0x42f15e){return _0x134b55[_0x9839('0x15')](_0x197bdb)[_0x9839('0x17')](_0x42f15e);}};}function respondWithFilteredResult(_0x295bc2,_0x11a97e){return function(_0x3814dc){if(_0x3814dc){var _0x11cc58=_0x3814dc['count'],_0x3d827b=_0x11a97e[_0x9839('0x18')],_0x37af94=_0x11a97e[_0x9839('0x18')]+_0x11a97e[_0x9839('0x19')],_0x3221ca;if(_0x37af94>=_0x11cc58){_0x37af94=_0x11cc58;_0x3221ca=0xc8;}else{_0x3221ca=0xce;}_0x295bc2[_0x9839('0x15')](_0x3221ca);return _0x295bc2[_0x9839('0x1a')](_0x9839('0x1b'),_0x3d827b+'-'+_0x37af94+'/'+_0x11cc58)[_0x9839('0x17')](_0x3814dc);}return null;};}function patchUpdates(_0x3331a1){return function(_0x301ec0){try{jsonpatch[_0x9839('0x1c')](_0x301ec0,_0x3331a1,!![]);}catch(_0x203980){return BPromise['reject'](_0x203980);}return _0x301ec0[_0x9839('0x1d')]();};}function saveUpdates(_0xb8d4ba,_0x4e5a6e){return function(_0x1a3f41){if(_0x1a3f41){return _0x1a3f41['update'](_0xb8d4ba)[_0x9839('0x1e')](function(_0x1f2f62){return _0x1f2f62;});}return null;};}function removeEntity(_0x209f88,_0x14adba){return function(_0x2f0ff1){if(_0x2f0ff1){return _0x2f0ff1[_0x9839('0x1f')]()['then'](function(){var _0x425efb=_0x2f0ff1[_0x9839('0x20')]({'plain':!![]});var _0x4c2e88=_0x9839('0x21');return db[_0x9839('0x22')][_0x9839('0x1f')]({'where':{'type':_0x4c2e88,'resourceId':_0x425efb['id']}})[_0x9839('0x1e')](function(){return _0x2f0ff1;});})[_0x9839('0x1e')](function(){_0x209f88[_0x9839('0x15')](0xcc)[_0x9839('0x16')]();});}};}function handleEntityNotFound(_0x5aca80,_0x2140a8){return function(_0x1f71a3){if(!_0x1f71a3){_0x5aca80[_0x9839('0x14')](0x194);}return _0x1f71a3;};}function handleError(_0x15b2a5,_0x2fe909){_0x2fe909=_0x2fe909||0x1f4;return function(_0x48e82c){logger[_0x9839('0x23')](_0x48e82c[_0x9839('0x24')]);if(_0x48e82c[_0x9839('0x25')]){delete _0x48e82c[_0x9839('0x25')];}_0x15b2a5['status'](_0x2fe909)['send'](_0x48e82c);};}exports[_0x9839('0x26')]=function(_0x543c0c,_0x4b49ec){var _0x44d20b={},_0x36d175={},_0x54e685={'count':0x0,'rows':[]};var _0x49a835=_[_0x9839('0x27')](db[_0x9839('0x28')][_0x9839('0x29')],function(_0x570455){return{'name':_0x570455[_0x9839('0x2a')],'type':_0x570455[_0x9839('0x2b')]['key']};});_0x36d175[_0x9839('0x2c')]=_['map'](_0x49a835,'name');_0x36d175[_0x9839('0x2d')]=_[_0x9839('0x2e')](_0x543c0c['query']);_0x36d175['filters']=_['intersection'](_0x36d175[_0x9839('0x2c')],_0x36d175[_0x9839('0x2d')]);_0x44d20b['attributes']=_[_0x9839('0x2f')](_0x36d175[_0x9839('0x2c')],qs[_0x9839('0x30')](_0x543c0c[_0x9839('0x2d')][_0x9839('0x30')]));_0x44d20b[_0x9839('0x31')]=_0x44d20b[_0x9839('0x31')][_0x9839('0x32')]?_0x44d20b['attributes']:_0x36d175['model'];if(!_0x543c0c[_0x9839('0x2d')][_0x9839('0x33')](_0x9839('0x34'))){_0x44d20b[_0x9839('0x19')]=qs[_0x9839('0x19')](_0x543c0c['query'][_0x9839('0x19')]);_0x44d20b[_0x9839('0x18')]=qs['offset'](_0x543c0c[_0x9839('0x2d')]['offset']);}_0x44d20b['order']=qs[_0x9839('0x35')](_0x543c0c[_0x9839('0x2d')][_0x9839('0x35')]);_0x44d20b['where']=qs['filters'](_[_0x9839('0x36')](_0x543c0c[_0x9839('0x2d')],_0x36d175['filters']),_0x49a835);if(_0x543c0c[_0x9839('0x2d')][_0x9839('0x37')]){_0x44d20b[_0x9839('0x38')]=_['merge'](_0x44d20b[_0x9839('0x38')],{'$or':_[_0x9839('0x27')](_0x49a835,function(_0xb0e5a7){if(_0xb0e5a7[_0x9839('0x2b')]!==_0x9839('0x39')){var _0xd38f55={};_0xd38f55[_0xb0e5a7[_0x9839('0x25')]]={'$like':'%'+_0x543c0c['query'][_0x9839('0x37')]+'%'};return _0xd38f55;}})});}_0x44d20b=_[_0x9839('0x3a')]({},_0x44d20b,_0x543c0c[_0x9839('0x3b')]);var _0x613609={'where':_0x44d20b['where']};return db[_0x9839('0x28')][_0x9839('0x3c')](_0x613609)[_0x9839('0x1e')](function(_0x34be9b){_0x54e685['count']=_0x34be9b;if(_0x543c0c[_0x9839('0x2d')][_0x9839('0x3d')]){_0x44d20b[_0x9839('0x3e')]=[{'all':!![]}];}return db[_0x9839('0x28')][_0x9839('0x3f')](_0x44d20b);})[_0x9839('0x1e')](function(_0x1e322f){_0x54e685['rows']=_0x1e322f;return _0x54e685;})[_0x9839('0x1e')](respondWithFilteredResult(_0x4b49ec,_0x44d20b))['catch'](handleError(_0x4b49ec,null));};exports[_0x9839('0x40')]=function(_0x8757f8,_0x2cf032){var _0x4e09b2={'raw':!![],'where':{'id':_0x8757f8[_0x9839('0x41')]['id']}},_0x2f4245={};_0x2f4245[_0x9839('0x2c')]=_[_0x9839('0x2e')](db[_0x9839('0x28')]['rawAttributes']);_0x2f4245['query']=_[_0x9839('0x2e')](_0x8757f8[_0x9839('0x2d')]);_0x2f4245[_0x9839('0x42')]=_[_0x9839('0x2f')](_0x2f4245['model'],_0x2f4245[_0x9839('0x2d')]);_0x4e09b2['attributes']=_[_0x9839('0x2f')](_0x2f4245[_0x9839('0x2c')],qs[_0x9839('0x30')](_0x8757f8[_0x9839('0x2d')][_0x9839('0x30')]));_0x4e09b2['attributes']=_0x4e09b2[_0x9839('0x31')][_0x9839('0x32')]?_0x4e09b2[_0x9839('0x31')]:_0x2f4245['model'];if(_0x8757f8['query']['includeAll']){_0x4e09b2[_0x9839('0x3e')]=[{'all':!![]}];}_0x4e09b2=_[_0x9839('0x3a')]({},_0x4e09b2,_0x8757f8[_0x9839('0x3b')]);return db['CannedAnswer'][_0x9839('0x43')](_0x4e09b2)[_0x9839('0x1e')](handleEntityNotFound(_0x2cf032,null))[_0x9839('0x1e')](respondWithResult(_0x2cf032,null))[_0x9839('0x44')](handleError(_0x2cf032,null));};exports[_0x9839('0x45')]=function(_0x42b322,_0x2defed){if(_0x42b322[_0x9839('0x46')]['id']){delete _0x42b322[_0x9839('0x46')]['id'];}return db[_0x9839('0x28')][_0x9839('0x43')]({'where':{'id':_0x42b322[_0x9839('0x41')]['id']}})[_0x9839('0x1e')](handleEntityNotFound(_0x2defed,null))[_0x9839('0x1e')](saveUpdates(_0x42b322[_0x9839('0x46')],null))['then'](respondWithResult(_0x2defed,null))[_0x9839('0x44')](handleError(_0x2defed,null));};exports[_0x9839('0x1f')]=function(_0x306e59,_0x2207be){return db[_0x9839('0x28')][_0x9839('0x43')]({'where':{'id':_0x306e59[_0x9839('0x41')]['id']}})[_0x9839('0x1e')](handleEntityNotFound(_0x2207be,null))['then'](removeEntity(_0x2207be,null))[_0x9839('0x44')](handleError(_0x2207be,null));};exports[_0x9839('0x47')]=function(_0x38e8b2,_0x344e49){var _0x1560a3={'key':_0x38e8b2[_0x9839('0x46')][_0x9839('0x48')]};if(_0x38e8b2[_0x9839('0x46')][_0x9839('0x49')]){_0x1560a3[_0x9839('0x49')]=_0x38e8b2[_0x9839('0x46')][_0x9839('0x49')];}else if(_0x38e8b2[_0x9839('0x46')]['SmsAccountId']){_0x1560a3[_0x9839('0x4a')]=_0x38e8b2[_0x9839('0x46')][_0x9839('0x4a')];}else if(_0x38e8b2[_0x9839('0x46')][_0x9839('0x4b')]){_0x1560a3[_0x9839('0x4b')]=_0x38e8b2[_0x9839('0x46')][_0x9839('0x4b')];}else if(_0x38e8b2[_0x9839('0x46')][_0x9839('0x4c')]){_0x1560a3['ChatWebsiteId']=_0x38e8b2['body']['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x1560a3})[_0x9839('0x1e')](function(_0x2b59c7){if(_0x2b59c7){throw new db[(_0x9839('0x4d'))][(_0x9839('0x4e'))](_0x9839('0x4f'));}return db[_0x9839('0x28')][_0x9839('0x47')](_0x38e8b2[_0x9839('0x46')]);})[_0x9839('0x1e')](function(_0x32b36c){var _0x2522ab=_0x38e8b2['user'][_0x9839('0x20')]({'plain':!![]});if(!_0x2522ab)throw new Error(_0x9839('0x50'));if(_0x2522ab[_0x9839('0x51')]==='user'){var _0x1b7fcc=_0x32b36c[_0x9839('0x20')]({'plain':!![]});return db[_0x9839('0x52')]['find']({'where':{'name':_0x9839('0x21'),'userProfileId':_0x2522ab[_0x9839('0x53')]},'raw':!![]})[_0x9839('0x1e')](function(_0x515e23){if(_0x515e23&&_0x515e23['autoAssociation']===0x0){return db[_0x9839('0x22')][_0x9839('0x47')]({'name':_0x1b7fcc['name'],'resourceId':_0x1b7fcc['id'],'type':_0x515e23[_0x9839('0x25')],'sectionId':_0x515e23['id']},{})[_0x9839('0x1e')](function(){return _0x32b36c;});}else{return _0x32b36c;}})[_0x9839('0x44')](function(_0x56a77d){logger[_0x9839('0x23')](_0x9839('0x54'),_0x56a77d);throw _0x56a77d;});}return _0x32b36c;})['then'](respondWithResult(_0x344e49,0xc9))[_0x9839('0x44')](handleError(_0x344e49,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a93c88e..a09fd29 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 _0x9f75=['api','request-promise','path','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9f75,0x15a));var _0x59f7=function(_0xe0df2f,_0x26706f){_0xe0df2f=_0xe0df2f-0x0;var _0x318c91=_0x9f75[_0xe0df2f];return _0x318c91;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var logger=require(_0x59f7('0x1'))(_0x59f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x59f7('0x3'));var fs=require('fs');var path=require(_0x59f7('0x4'));var rimraf=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x59f7('0x7')]=function(_0x278f11,_0x5485fa){return _0x278f11['define'](_0x59f7('0x8'),attributes,{'tableName':_0x59f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x59f7('0xa'),'collate':_0x59f7('0xb')});}; \ No newline at end of file +var _0x55ca=['request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','lodash','util','bluebird'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x55ca,0x126));var _0xa55c=function(_0x44c325,_0x19c625){_0x44c325=_0x44c325-0x0;var _0x55f09e=_0x55ca[_0x44c325];return _0x55f09e;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('CannedAnswer',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa55c('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e1e3c59..b1037a0 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 _0xe0f4=['../../config/environment','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x5f01c2,_0x36aea9){var _0x4fddc2=function(_0x883b08){while(--_0x883b08){_0x5f01c2['push'](_0x5f01c2['shift']());}};_0x4fddc2(++_0x36aea9);}(_0xe0f4,0x1bc));var _0x4e0f=function(_0x857bc8,_0x35b60d){_0x857bc8=_0x857bc8-0x0;var _0x4a6559=_0xe0f4[_0x857bc8];return _0x4a6559;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e0f('0x0'));var BPromise=require(_0x4e0f('0x1'));var rs=require(_0x4e0f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e0f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e0f('0x4'))(_0x4e0f('0x5'));var config=require(_0x4e0f('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14e075,_0x3d3800,_0x3d5777){return new BPromise(function(_0x2a2b11,_0x284ba5){return client[_0x4e0f('0x7')](_0x14e075,_0x3d5777)[_0x4e0f('0x8')](function(_0xc3681c){logger[_0x4e0f('0x9')](_0x4e0f('0xa'),_0x3d3800,_0x4e0f('0xb'));logger['debug'](_0x4e0f('0xc'),_0x3d3800,'request\x20sent',JSON[_0x4e0f('0xd')](_0xc3681c));if(_0xc3681c[_0x4e0f('0xe')]){if(_0xc3681c[_0x4e0f('0xe')]['code']===0x1f4){logger[_0x4e0f('0xe')](_0x4e0f('0xa'),_0x3d3800,_0xc3681c[_0x4e0f('0xe')]['message']);return _0x284ba5(_0xc3681c[_0x4e0f('0xe')]['message']);}logger[_0x4e0f('0xe')](_0x4e0f('0xa'),_0x3d3800,_0xc3681c[_0x4e0f('0xe')][_0x4e0f('0xf')]);return _0x2a2b11(_0xc3681c['error'][_0x4e0f('0xf')]);}else{logger['info'](_0x4e0f('0xa'),_0x3d3800,_0x4e0f('0xb'));_0x2a2b11(_0xc3681c[_0x4e0f('0x10')][_0x4e0f('0xf')]);}})[_0x4e0f('0x11')](function(_0x269e18){logger[_0x4e0f('0xe')](_0x4e0f('0xa'),_0x3d3800,_0x269e18);_0x284ba5(_0x269e18);});});} \ No newline at end of file +var _0x27ba=['../../config/environment','jayson/promise','http','request','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x27ba,0xe7));var _0xa27b=function(_0x38ae2a,_0x487d95){_0x38ae2a=_0x38ae2a-0x0;var _0x2069dd=_0x27ba[_0x38ae2a];return _0x2069dd;};'use strict';var _=require(_0xa27b('0x0'));var util=require('util');var moment=require(_0xa27b('0x1'));var BPromise=require(_0xa27b('0x2'));var rs=require(_0xa27b('0x3'));var fs=require('fs');var Redis=require(_0xa27b('0x4'));var db=require(_0xa27b('0x5'))['db'];var utils=require(_0xa27b('0x6'));var logger=require(_0xa27b('0x7'))(_0xa27b('0x8'));var config=require(_0xa27b('0x9'));var jayson=require(_0xa27b('0xa'));var client=jayson['client'][_0xa27b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f7388,_0x56914c,_0x14bcd3){return new BPromise(function(_0x36d535,_0x565880){return client[_0xa27b('0xc')](_0x3f7388,_0x14bcd3)['then'](function(_0x281779){logger[_0xa27b('0xd')](_0xa27b('0xe'),_0x56914c,'request\x20sent');logger[_0xa27b('0xf')](_0xa27b('0x10'),_0x56914c,_0xa27b('0x11'),JSON[_0xa27b('0x12')](_0x281779));if(_0x281779[_0xa27b('0x13')]){if(_0x281779[_0xa27b('0x13')][_0xa27b('0x14')]===0x1f4){logger[_0xa27b('0x13')](_0xa27b('0xe'),_0x56914c,_0x281779[_0xa27b('0x13')][_0xa27b('0x15')]);return _0x565880(_0x281779['error'][_0xa27b('0x15')]);}logger[_0xa27b('0x13')](_0xa27b('0xe'),_0x56914c,_0x281779[_0xa27b('0x13')]['message']);return _0x36d535(_0x281779[_0xa27b('0x13')][_0xa27b('0x15')]);}else{logger[_0xa27b('0xd')](_0xa27b('0xe'),_0x56914c,_0xa27b('0x11'));_0x36d535(_0x281779[_0xa27b('0x16')]['message']);}})[_0xa27b('0x17')](function(_0xd08294){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x56914c,_0xd08294);_0x565880(_0xd08294);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 6f318fa..c762d85 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 _0x7050=['express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','destroy','multer','util','path','connect-timeout'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7050,0x74));var _0x0705=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x7050[_0xf73c09];return _0xa8923c;};'use strict';var multer=require(_0x0705('0x0'));var util=require(_0x0705('0x1'));var path=require(_0x0705('0x2'));var timeout=require(_0x0705('0x3'));var express=require(_0x0705('0x4'));var router=express['Router']();var auth=require(_0x0705('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0705('0x6'));var controller=require('./cannedAnswer.controller');router[_0x0705('0x7')]('/',auth[_0x0705('0x8')](),controller[_0x0705('0x9')]);router[_0x0705('0x7')](_0x0705('0xa'),auth['isAuthenticated'](),controller[_0x0705('0xb')]);router[_0x0705('0xc')]('/',auth[_0x0705('0x8')](),controller['create']);router['put'](_0x0705('0xa'),auth[_0x0705('0x8')](),controller[_0x0705('0xd')]);router['delete']('/:id',auth[_0x0705('0x8')](),controller[_0x0705('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3663=['put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post'];(function(_0xc3aaaf,_0xaf47f3){var _0x3db515=function(_0x44dc8b){while(--_0x44dc8b){_0xc3aaaf['push'](_0xc3aaaf['shift']());}};_0x3db515(++_0xaf47f3);}(_0x3663,0x1cf));var _0x3366=function(_0x46f098,_0x5f5063){_0x46f098=_0x46f098-0x0;var _0x1eef1d=_0x3663[_0x46f098];return _0x1eef1d;};'use strict';var multer=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var path=require(_0x3366('0x2'));var timeout=require('connect-timeout');var express=require(_0x3366('0x3'));var router=express[_0x3366('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3366('0x5'));var config=require(_0x3366('0x6'));var controller=require(_0x3366('0x7'));router[_0x3366('0x8')]('/',auth[_0x3366('0x9')](),controller['index']);router[_0x3366('0x8')](_0x3366('0xa'),auth['isAuthenticated'](),controller[_0x3366('0xb')]);router[_0x3366('0xc')]('/',auth[_0x3366('0x9')](),controller['create']);router[_0x3366('0xd')](_0x3366('0xa'),auth[_0x3366('0x9')](),controller['update']);router[_0x3366('0xe')](_0x3366('0xa'),auth[_0x3366('0x9')](),controller[_0x3366('0xf')]);module[_0x3366('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e1844b3..d82f0c7 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 _0xaa20=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x3e97da,_0x47b543){var _0x3637a0=function(_0x3b0c41){while(--_0x3b0c41){_0x3e97da['push'](_0x3e97da['shift']());}};_0x3637a0(++_0x47b543);}(_0xaa20,0x14b));var _0x0aa2=function(_0xd15221,_0x123874){_0xd15221=_0xd15221-0x0;var _0x321a0f=_0xaa20[_0xd15221];return _0x321a0f;};'use strict';var Sequelize=require(_0x0aa2('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x0aa2('0x1')],'allowNull':![],'defaultValue':_0x0aa2('0x2')},'clid':{'type':Sequelize[_0x0aa2('0x3')]},'src':{'type':Sequelize[_0x0aa2('0x3')]},'dst':{'type':Sequelize[_0x0aa2('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0aa2('0x3')]},'dstchannel':{'type':Sequelize[_0x0aa2('0x3')]},'lastapp':{'type':Sequelize[_0x0aa2('0x3')]},'lastdata':{'type':Sequelize[_0x0aa2('0x3')]},'duration':{'type':Sequelize[_0x0aa2('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0aa2('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0aa2('0x3')]},'amaflags':{'type':Sequelize[_0x0aa2('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x0aa2('0x3')]},'uniqueid':{'type':Sequelize[_0x0aa2('0x3')]},'linkedid':{'type':Sequelize[_0x0aa2('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x0aa2('0x3')]},'type':{'type':Sequelize[_0x0aa2('0x3')]},'tag':{'type':Sequelize[_0x0aa2('0x3')]}}; \ No newline at end of file +var _0x6695=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6695,0x143));var _0x5669=function(_0x5ee224,_0x783fe8){_0x5ee224=_0x5ee224-0x0;var _0x3c55dc=_0x6695[_0x5ee224];return _0x3c55dc;};'use strict';var Sequelize=require('sequelize');module[_0x5669('0x0')]={'calldate':{'type':Sequelize[_0x5669('0x1')],'allowNull':![],'defaultValue':_0x5669('0x2')},'clid':{'type':Sequelize[_0x5669('0x3')]},'src':{'type':Sequelize[_0x5669('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x5669('0x3')]},'channel':{'type':Sequelize[_0x5669('0x3')]},'dstchannel':{'type':Sequelize[_0x5669('0x3')]},'lastapp':{'type':Sequelize[_0x5669('0x3')]},'lastdata':{'type':Sequelize[_0x5669('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5669('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5669('0x3')]},'amaflags':{'type':Sequelize[_0x5669('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5669('0x3')]},'userfield':{'type':Sequelize[_0x5669('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x5669('0x3')]},'sequence':{'type':Sequelize[_0x5669('0x3')]},'peeraccount':{'type':Sequelize[_0x5669('0x3')]},'type':{'type':Sequelize[_0x5669('0x3')]},'tag':{'type':Sequelize[_0x5669('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 553df0f..729b59c 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 _0xb561=['path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','moment','bluebird','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb561,0x1b0));var _0x1b56=function(_0x1c3054,_0x202a0f){_0x1c3054=_0x1c3054-0x0;var _0x4b1466=_0xb561[_0x1c3054];return _0x4b1466;};'use strict';var pdf=require(_0x1b56('0x0'));var emlformat=require(_0x1b56('0x1'));var rimraf=require(_0x1b56('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b56('0x3'));var BPromise=require(_0x1b56('0x4'));var Mustache=require('mustache');var util=require(_0x1b56('0x5'));var path=require(_0x1b56('0x6'));var sox=require(_0x1b56('0x7'));var csv=require(_0x1b56('0x8'));var ejs=require(_0x1b56('0x9'));var fs=require('fs');var _=require(_0x1b56('0xa'));var squel=require('squel');var crypto=require(_0x1b56('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1b56('0x8'));var querystring=require(_0x1b56('0xc'));var Papa=require(_0x1b56('0xd'));var Redis=require(_0x1b56('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1b56('0xf'));var hardwareService=require(_0x1b56('0x10'));var logger=require(_0x1b56('0x11'))(_0x1b56('0x12'));var utils=require('../../config/utils');var config=require(_0x1b56('0x13'));var db=require(_0x1b56('0x14'))['db'];function respondWithStatusCode(_0x73ccb5,_0x3bad80){_0x3bad80=_0x3bad80||0xcc;return function(_0x169372){if(_0x169372){return _0x73ccb5[_0x1b56('0x15')](_0x3bad80);}return _0x73ccb5['status'](_0x3bad80)[_0x1b56('0x16')]();};}function respondWithResult(_0x5eac0d,_0x5cc0f4){_0x5cc0f4=_0x5cc0f4||0xc8;return function(_0x5a6de0){if(_0x5a6de0){return _0x5eac0d[_0x1b56('0x17')](_0x5cc0f4)[_0x1b56('0x18')](_0x5a6de0);}};}function respondWithFilteredResult(_0x315661,_0x3969bc){return function(_0xe94376){if(_0xe94376){var _0xfb7a45=_0xe94376['count'],_0x11ce40=_0x3969bc[_0x1b56('0x19')],_0x31910c=_0x3969bc['offset']+_0x3969bc[_0x1b56('0x1a')],_0x3f73ee;if(_0x31910c>=_0xfb7a45){_0x31910c=_0xfb7a45;_0x3f73ee=0xc8;}else{_0x3f73ee=0xce;}_0x315661[_0x1b56('0x17')](_0x3f73ee);return _0x315661[_0x1b56('0x1b')](_0x1b56('0x1c'),_0x11ce40+'-'+_0x31910c+'/'+_0xfb7a45)[_0x1b56('0x18')](_0xe94376);}return null;};}function patchUpdates(_0x55e59f){return function(_0x5ee806){try{jsonpatch[_0x1b56('0x1d')](_0x5ee806,_0x55e59f,!![]);}catch(_0x5f1bd0){return BPromise['reject'](_0x5f1bd0);}return _0x5ee806[_0x1b56('0x1e')]();};}function saveUpdates(_0xc237c1,_0x508899){return function(_0x464b12){if(_0x464b12){return _0x464b12[_0x1b56('0x1f')](_0xc237c1)[_0x1b56('0x20')](function(_0x3ffd61){return _0x3ffd61;});}return null;};}function removeEntity(_0x5bf319,_0x52504f){return function(_0x5dff04){if(_0x5dff04){return _0x5dff04['destroy']()[_0x1b56('0x20')](function(){_0x5bf319[_0x1b56('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d342,_0x37d03e){return function(_0x300f00){if(!_0x300f00){_0x48d342[_0x1b56('0x15')](0x194);}return _0x300f00;};}function handleError(_0x16d3c6,_0x5d5060){_0x5d5060=_0x5d5060||0x1f4;return function(_0x19d1e){logger[_0x1b56('0x21')](_0x19d1e[_0x1b56('0x22')]);if(_0x19d1e[_0x1b56('0x23')]){delete _0x19d1e[_0x1b56('0x23')];}_0x16d3c6[_0x1b56('0x17')](_0x5d5060)[_0x1b56('0x24')](_0x19d1e);};}exports[_0x1b56('0x25')]=function(_0x20e6ab,_0x4de618){var _0x44e559={},_0x115e46={},_0x336328={'count':0x0,'rows':[]};var _0xc4d4ef=_[_0x1b56('0x26')](db[_0x1b56('0x27')][_0x1b56('0x28')],function(_0x59640a){return{'name':_0x59640a[_0x1b56('0x29')],'type':_0x59640a[_0x1b56('0x2a')][_0x1b56('0x2b')]};});_0x115e46['model']=_[_0x1b56('0x26')](_0xc4d4ef,_0x1b56('0x23'));_0x115e46[_0x1b56('0x2c')]=_[_0x1b56('0x2d')](_0x20e6ab[_0x1b56('0x2c')]);_0x115e46['filters']=_[_0x1b56('0x2e')](_0x115e46[_0x1b56('0x2f')],_0x115e46[_0x1b56('0x2c')]);_0x44e559[_0x1b56('0x30')]=_[_0x1b56('0x2e')](_0x115e46[_0x1b56('0x2f')],qs['fields'](_0x20e6ab[_0x1b56('0x2c')]['fields']));_0x44e559['attributes']=_0x44e559[_0x1b56('0x30')][_0x1b56('0x31')]?_0x44e559[_0x1b56('0x30')]:_0x115e46[_0x1b56('0x2f')];if(!_0x20e6ab['query']['hasOwnProperty']('nolimit')){_0x44e559[_0x1b56('0x1a')]=qs['limit'](_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x1a')]);_0x44e559[_0x1b56('0x19')]=qs[_0x1b56('0x19')](_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x19')]);}_0x44e559[_0x1b56('0x32')]=qs[_0x1b56('0x33')](_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x33')]);_0x44e559['where']=qs[_0x1b56('0x34')](_[_0x1b56('0x35')](_0x20e6ab[_0x1b56('0x2c')],_0x115e46['filters']),_0xc4d4ef);if(_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x36')]){_0x44e559[_0x1b56('0x37')]=_[_0x1b56('0x38')](_0x44e559[_0x1b56('0x37')],{'$or':_[_0x1b56('0x26')](_0xc4d4ef,function(_0x32b119){if(_0x32b119[_0x1b56('0x2a')]!==_0x1b56('0x39')){var _0x1044e6={};_0x1044e6[_0x32b119[_0x1b56('0x23')]]={'$like':'%'+_0x20e6ab['query'][_0x1b56('0x36')]+'%'};return _0x1044e6;}})});}_0x44e559=_[_0x1b56('0x38')]({},_0x44e559,_0x20e6ab[_0x1b56('0x3a')]);var _0x2dc019={'where':_0x44e559['where']};return db[_0x1b56('0x27')][_0x1b56('0x3b')](_0x2dc019)[_0x1b56('0x20')](function(_0x477fe1){_0x336328[_0x1b56('0x3b')]=_0x477fe1;if(_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x3c')]){_0x44e559[_0x1b56('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x1b56('0x3e')](_0x44e559);})[_0x1b56('0x20')](function(_0x3f172e){_0x336328[_0x1b56('0x3f')]=_0x3f172e;return _0x336328;})[_0x1b56('0x20')](respondWithFilteredResult(_0x4de618,_0x44e559))[_0x1b56('0x40')](handleError(_0x4de618,null));};exports[_0x1b56('0x41')]=function(_0x4aa2cc,_0x221130){var _0x8261ee={'raw':!![],'where':{'id':_0x4aa2cc[_0x1b56('0x42')]['id']}},_0x389c2b={};_0x389c2b[_0x1b56('0x2f')]=_[_0x1b56('0x2d')](db['Cdr'][_0x1b56('0x28')]);_0x389c2b[_0x1b56('0x2c')]=_[_0x1b56('0x2d')](_0x4aa2cc[_0x1b56('0x2c')]);_0x389c2b[_0x1b56('0x34')]=_[_0x1b56('0x2e')](_0x389c2b[_0x1b56('0x2f')],_0x389c2b[_0x1b56('0x2c')]);_0x8261ee[_0x1b56('0x30')]=_[_0x1b56('0x2e')](_0x389c2b[_0x1b56('0x2f')],qs[_0x1b56('0x43')](_0x4aa2cc[_0x1b56('0x2c')]['fields']));_0x8261ee['attributes']=_0x8261ee['attributes'][_0x1b56('0x31')]?_0x8261ee[_0x1b56('0x30')]:_0x389c2b[_0x1b56('0x2f')];if(_0x4aa2cc[_0x1b56('0x2c')]['includeAll']){_0x8261ee[_0x1b56('0x3d')]=[{'all':!![]}];}_0x8261ee=_[_0x1b56('0x38')]({},_0x8261ee,_0x4aa2cc[_0x1b56('0x3a')]);return db[_0x1b56('0x27')][_0x1b56('0x44')](_0x8261ee)[_0x1b56('0x20')](handleEntityNotFound(_0x221130,null))[_0x1b56('0x20')](respondWithResult(_0x221130,null))[_0x1b56('0x40')](handleError(_0x221130,null));};exports[_0x1b56('0x45')]=function(_0x356fb3,_0x4aedb6){return db[_0x1b56('0x27')][_0x1b56('0x45')](_0x356fb3[_0x1b56('0x46')],{})['then'](respondWithResult(_0x4aedb6,0xc9))['catch'](handleError(_0x4aedb6,null));};exports['update']=function(_0x271b2b,_0x41cbdc){if(_0x271b2b['body']['id']){delete _0x271b2b[_0x1b56('0x46')]['id'];}return db[_0x1b56('0x27')]['find']({'where':{'id':_0x271b2b['params']['id']}})[_0x1b56('0x20')](handleEntityNotFound(_0x41cbdc,null))[_0x1b56('0x20')](saveUpdates(_0x271b2b[_0x1b56('0x46')],null))['then'](respondWithResult(_0x41cbdc,null))[_0x1b56('0x40')](handleError(_0x41cbdc,null));};exports[_0x1b56('0x47')]=function(_0x53262d,_0x16978a){return db[_0x1b56('0x27')]['find']({'where':{'id':_0x53262d[_0x1b56('0x42')]['id']}})[_0x1b56('0x20')](handleEntityNotFound(_0x16978a,null))[_0x1b56('0x20')](removeEntity(_0x16978a,null))[_0x1b56('0x40')](handleError(_0x16978a,null));};exports[_0x1b56('0x48')]=function(_0x34c90c,_0x99f65d){return db[_0x1b56('0x27')][_0x1b56('0x48')]()[_0x1b56('0x20')](respondWithResult(_0x99f65d,null))[_0x1b56('0x40')](handleError(_0x99f65d,null));}; \ No newline at end of file +var _0x9b9f=['status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Cdr','includeAll','rows','catch','params','rawAttributes','intersection','include','find','create','update','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0xa9ea28,_0x398a4f){var _0x83ed89=function(_0x571247){while(--_0x571247){_0xa9ea28['push'](_0xa9ea28['shift']());}};_0x83ed89(++_0x398a4f);}(_0x9b9f,0x144));var _0xf9b9=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0x9b9f[_0x5e4b85];return _0x5cd3cb;};'use strict';var pdf=require(_0xf9b9('0x0'));var emlformat=require(_0xf9b9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf9b9('0x2'));var jsonpatch=require(_0xf9b9('0x3'));var rp=require(_0xf9b9('0x4'));var moment=require('moment');var BPromise=require(_0xf9b9('0x5'));var Mustache=require(_0xf9b9('0x6'));var util=require('util');var path=require(_0xf9b9('0x7'));var sox=require('sox');var csv=require(_0xf9b9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf9b9('0x9'));var crypto=require('crypto');var jsforce=require(_0xf9b9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf9b9('0xb'));var Papa=require(_0xf9b9('0xc'));var Redis=require(_0xf9b9('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf9b9('0xe'));var hardwareService=require(_0xf9b9('0xf'));var logger=require(_0xf9b9('0x10'))(_0xf9b9('0x11'));var utils=require(_0xf9b9('0x12'));var config=require('../../config/environment');var db=require(_0xf9b9('0x13'))['db'];function respondWithStatusCode(_0x45591e,_0x565b9a){_0x565b9a=_0x565b9a||0xcc;return function(_0x46ef27){if(_0x46ef27){return _0x45591e[_0xf9b9('0x14')](_0x565b9a);}return _0x45591e[_0xf9b9('0x15')](_0x565b9a)[_0xf9b9('0x16')]();};}function respondWithResult(_0x4e716d,_0x4f91bc){_0x4f91bc=_0x4f91bc||0xc8;return function(_0x22552b){if(_0x22552b){return _0x4e716d[_0xf9b9('0x15')](_0x4f91bc)['json'](_0x22552b);}};}function respondWithFilteredResult(_0x5859ef,_0x43456a){return function(_0x34ba83){if(_0x34ba83){var _0x3ec77b=_0x34ba83[_0xf9b9('0x17')],_0xf6127=_0x43456a[_0xf9b9('0x18')],_0x4f6f4d=_0x43456a[_0xf9b9('0x18')]+_0x43456a[_0xf9b9('0x19')],_0x32e5d9;if(_0x4f6f4d>=_0x3ec77b){_0x4f6f4d=_0x3ec77b;_0x32e5d9=0xc8;}else{_0x32e5d9=0xce;}_0x5859ef['status'](_0x32e5d9);return _0x5859ef[_0xf9b9('0x1a')](_0xf9b9('0x1b'),_0xf6127+'-'+_0x4f6f4d+'/'+_0x3ec77b)[_0xf9b9('0x1c')](_0x34ba83);}return null;};}function patchUpdates(_0x299eab){return function(_0x162ada){try{jsonpatch['apply'](_0x162ada,_0x299eab,!![]);}catch(_0x1f16e9){return BPromise[_0xf9b9('0x1d')](_0x1f16e9);}return _0x162ada[_0xf9b9('0x1e')]();};}function saveUpdates(_0x5a6184,_0x3b00a9){return function(_0x304af7){if(_0x304af7){return _0x304af7['update'](_0x5a6184)[_0xf9b9('0x1f')](function(_0x3342ad){return _0x3342ad;});}return null;};}function removeEntity(_0x186429,_0x446d54){return function(_0x3dd78e){if(_0x3dd78e){return _0x3dd78e[_0xf9b9('0x20')]()[_0xf9b9('0x1f')](function(){_0x186429[_0xf9b9('0x15')](0xcc)[_0xf9b9('0x16')]();});}};}function handleEntityNotFound(_0x12aaf1,_0x1b1503){return function(_0x5619f7){if(!_0x5619f7){_0x12aaf1[_0xf9b9('0x14')](0x194);}return _0x5619f7;};}function handleError(_0x3887b9,_0x29856e){_0x29856e=_0x29856e||0x1f4;return function(_0xa50cf6){logger[_0xf9b9('0x21')](_0xa50cf6[_0xf9b9('0x22')]);if(_0xa50cf6[_0xf9b9('0x23')]){delete _0xa50cf6[_0xf9b9('0x23')];}_0x3887b9[_0xf9b9('0x15')](_0x29856e)[_0xf9b9('0x24')](_0xa50cf6);};}exports[_0xf9b9('0x25')]=function(_0x19b995,_0x558040){var _0x3f3347={},_0xc283e9={},_0x2bd1da={'count':0x0,'rows':[]};var _0xebda4c=_[_0xf9b9('0x26')](db['Cdr']['rawAttributes'],function(_0x16a3e8){return{'name':_0x16a3e8[_0xf9b9('0x27')],'type':_0x16a3e8[_0xf9b9('0x28')]['key']};});_0xc283e9[_0xf9b9('0x29')]=_[_0xf9b9('0x26')](_0xebda4c,_0xf9b9('0x23'));_0xc283e9[_0xf9b9('0x2a')]=_[_0xf9b9('0x2b')](_0x19b995[_0xf9b9('0x2a')]);_0xc283e9[_0xf9b9('0x2c')]=_['intersection'](_0xc283e9['model'],_0xc283e9[_0xf9b9('0x2a')]);_0x3f3347['attributes']=_['intersection'](_0xc283e9['model'],qs[_0xf9b9('0x2d')](_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x2d')]));_0x3f3347[_0xf9b9('0x2e')]=_0x3f3347[_0xf9b9('0x2e')][_0xf9b9('0x2f')]?_0x3f3347[_0xf9b9('0x2e')]:_0xc283e9[_0xf9b9('0x29')];if(!_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x30')](_0xf9b9('0x31'))){_0x3f3347['limit']=qs['limit'](_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x19')]);_0x3f3347[_0xf9b9('0x18')]=qs['offset'](_0x19b995['query'][_0xf9b9('0x18')]);}_0x3f3347['order']=qs[_0xf9b9('0x32')](_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x32')]);_0x3f3347[_0xf9b9('0x33')]=qs[_0xf9b9('0x2c')](_[_0xf9b9('0x34')](_0x19b995['query'],_0xc283e9['filters']),_0xebda4c);if(_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x35')]){_0x3f3347[_0xf9b9('0x33')]=_[_0xf9b9('0x36')](_0x3f3347['where'],{'$or':_[_0xf9b9('0x26')](_0xebda4c,function(_0x4da09b){if(_0x4da09b[_0xf9b9('0x28')]!=='VIRTUAL'){var _0x112748={};_0x112748[_0x4da09b[_0xf9b9('0x23')]]={'$like':'%'+_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x35')]+'%'};return _0x112748;}})});}_0x3f3347=_[_0xf9b9('0x36')]({},_0x3f3347,_0x19b995[_0xf9b9('0x37')]);var _0x41c1a5={'where':_0x3f3347[_0xf9b9('0x33')]};return db[_0xf9b9('0x38')][_0xf9b9('0x17')](_0x41c1a5)[_0xf9b9('0x1f')](function(_0x248f39){_0x2bd1da[_0xf9b9('0x17')]=_0x248f39;if(_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x39')]){_0x3f3347['include']=[{'all':!![]}];}return db[_0xf9b9('0x38')]['findAll'](_0x3f3347);})[_0xf9b9('0x1f')](function(_0x16564f){_0x2bd1da[_0xf9b9('0x3a')]=_0x16564f;return _0x2bd1da;})[_0xf9b9('0x1f')](respondWithFilteredResult(_0x558040,_0x3f3347))[_0xf9b9('0x3b')](handleError(_0x558040,null));};exports['show']=function(_0x3bd183,_0x30172a){var _0x35cfe4={'raw':!![],'where':{'id':_0x3bd183[_0xf9b9('0x3c')]['id']}},_0x3f23eb={};_0x3f23eb[_0xf9b9('0x29')]=_['keys'](db['Cdr'][_0xf9b9('0x3d')]);_0x3f23eb['query']=_[_0xf9b9('0x2b')](_0x3bd183[_0xf9b9('0x2a')]);_0x3f23eb[_0xf9b9('0x2c')]=_[_0xf9b9('0x3e')](_0x3f23eb[_0xf9b9('0x29')],_0x3f23eb[_0xf9b9('0x2a')]);_0x35cfe4[_0xf9b9('0x2e')]=_[_0xf9b9('0x3e')](_0x3f23eb[_0xf9b9('0x29')],qs[_0xf9b9('0x2d')](_0x3bd183[_0xf9b9('0x2a')][_0xf9b9('0x2d')]));_0x35cfe4['attributes']=_0x35cfe4[_0xf9b9('0x2e')][_0xf9b9('0x2f')]?_0x35cfe4[_0xf9b9('0x2e')]:_0x3f23eb[_0xf9b9('0x29')];if(_0x3bd183[_0xf9b9('0x2a')]['includeAll']){_0x35cfe4[_0xf9b9('0x3f')]=[{'all':!![]}];}_0x35cfe4=_['merge']({},_0x35cfe4,_0x3bd183[_0xf9b9('0x37')]);return db['Cdr'][_0xf9b9('0x40')](_0x35cfe4)[_0xf9b9('0x1f')](handleEntityNotFound(_0x30172a,null))[_0xf9b9('0x1f')](respondWithResult(_0x30172a,null))[_0xf9b9('0x3b')](handleError(_0x30172a,null));};exports['create']=function(_0x222bbb,_0x397bc8){return db['Cdr'][_0xf9b9('0x41')](_0x222bbb['body'],{})[_0xf9b9('0x1f')](respondWithResult(_0x397bc8,0xc9))[_0xf9b9('0x3b')](handleError(_0x397bc8,null));};exports[_0xf9b9('0x42')]=function(_0x5caa95,_0x42785e){if(_0x5caa95['body']['id']){delete _0x5caa95[_0xf9b9('0x43')]['id'];}return db['Cdr'][_0xf9b9('0x40')]({'where':{'id':_0x5caa95[_0xf9b9('0x3c')]['id']}})[_0xf9b9('0x1f')](handleEntityNotFound(_0x42785e,null))[_0xf9b9('0x1f')](saveUpdates(_0x5caa95[_0xf9b9('0x43')],null))[_0xf9b9('0x1f')](respondWithResult(_0x42785e,null))['catch'](handleError(_0x42785e,null));};exports[_0xf9b9('0x20')]=function(_0x50d202,_0x379e1c){return db[_0xf9b9('0x38')][_0xf9b9('0x40')]({'where':{'id':_0x50d202[_0xf9b9('0x3c')]['id']}})[_0xf9b9('0x1f')](handleEntityNotFound(_0x379e1c,null))[_0xf9b9('0x1f')](removeEntity(_0x379e1c,null))['catch'](handleError(_0x379e1c,null));};exports[_0xf9b9('0x44')]=function(_0x280df2,_0x26c5e2){return db[_0xf9b9('0x38')][_0xf9b9('0x44')]()[_0xf9b9('0x1f')](respondWithResult(_0x26c5e2,null))['catch'](handleError(_0x26c5e2,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 305f3b2..484fb8b 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 _0x1403=['src','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','dst'];(function(_0x4cefcd,_0xb59db){var _0x57ded8=function(_0x79970b){while(--_0x79970b){_0x4cefcd['push'](_0x4cefcd['shift']());}};_0x57ded8(++_0xb59db);}(_0x1403,0x123));var _0x3140=function(_0x5f01d3,_0x305393){_0x5f01d3=_0x5f01d3-0x0;var _0x342227=_0x1403[_0x5f01d3];return _0x342227;};'use strict';var _=require(_0x3140('0x0'));var util=require(_0x3140('0x1'));var logger=require(_0x3140('0x2'))(_0x3140('0x3'));var moment=require(_0x3140('0x4'));var BPromise=require('bluebird');var rp=require(_0x3140('0x5'));var fs=require('fs');var path=require(_0x3140('0x6'));var rimraf=require('rimraf');var config=require(_0x3140('0x7'));var attributes=require(_0x3140('0x8'));module[_0x3140('0x9')]=function(_0x2ff2e9,_0x29e110){return _0x2ff2e9['define'](_0x3140('0xa'),attributes,{'tableName':_0x3140('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x3140('0xc')]},{'name':_0x3140('0xd'),'fields':[_0x3140('0xd')]},{'name':'disposition','fields':['disposition']},{'name':_0x3140('0xe'),'fields':[_0x3140('0xe')]},{'name':_0x3140('0xf'),'fields':[_0x3140('0xf')]},{'name':_0x3140('0x10'),'fields':[_0x3140('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0xefb3=['./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0xefb3,0x187));var _0x3efb=function(_0x1276c8,_0x475cfa){_0x1276c8=_0x1276c8-0x0;var _0x37451d=_0xefb3[_0x1276c8];return _0x37451d;};'use strict';var _=require(_0x3efb('0x0'));var util=require(_0x3efb('0x1'));var logger=require(_0x3efb('0x2'))(_0x3efb('0x3'));var moment=require(_0x3efb('0x4'));var BPromise=require(_0x3efb('0x5'));var rp=require(_0x3efb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3efb('0x7'));var attributes=require(_0x3efb('0x8'));module[_0x3efb('0x9')]=function(_0x1abb99,_0x293475){return _0x1abb99[_0x3efb('0xa')](_0x3efb('0xb'),attributes,{'tableName':_0x3efb('0xc'),'paranoid':![],'indexes':[{'name':_0x3efb('0xd'),'fields':[_0x3efb('0xd')]},{'name':_0x3efb('0xe'),'fields':[_0x3efb('0xe')]},{'name':'disposition','fields':[_0x3efb('0xf')]},{'name':'dst','fields':[_0x3efb('0x10')]},{'name':_0x3efb('0x11'),'fields':[_0x3efb('0x11')]},{'name':_0x3efb('0x12'),'fields':[_0x3efb('0x12')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 1277702..e21c3a9 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 _0xe7ec=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x33f0f1,_0x1cea77){var _0x398dee=function(_0x26a7e4){while(--_0x26a7e4){_0x33f0f1['push'](_0x33f0f1['shift']());}};_0x398dee(++_0x1cea77);}(_0xe7ec,0x119));var _0xce7e=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xe7ec[_0x3acee8];return _0x5046cc;};'use strict';var _=require(_0xce7e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xce7e('0x1'));var rs=require(_0xce7e('0x2'));var fs=require('fs');var Redis=require(_0xce7e('0x3'));var db=require(_0xce7e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xce7e('0x5'))(_0xce7e('0x6'));var config=require(_0xce7e('0x7'));var jayson=require(_0xce7e('0x8'));var client=jayson[_0xce7e('0x9')][_0xce7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x343b9e,_0x38457b,_0x40cfab){return new BPromise(function(_0x1095b9,_0x4549fe){return client[_0xce7e('0xb')](_0x343b9e,_0x40cfab)[_0xce7e('0xc')](function(_0x2f3a52){logger['info']('Cdr,\x20%s,\x20%s',_0x38457b,_0xce7e('0xd'));logger[_0xce7e('0xe')](_0xce7e('0xf'),_0x38457b,_0xce7e('0xd'),JSON[_0xce7e('0x10')](_0x2f3a52));if(_0x2f3a52['error']){if(_0x2f3a52[_0xce7e('0x11')][_0xce7e('0x12')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x38457b,_0x2f3a52[_0xce7e('0x11')][_0xce7e('0x13')]);return _0x4549fe(_0x2f3a52[_0xce7e('0x11')][_0xce7e('0x13')]);}logger['error'](_0xce7e('0x14'),_0x38457b,_0x2f3a52['error'][_0xce7e('0x13')]);return _0x1095b9(_0x2f3a52['error'][_0xce7e('0x13')]);}else{logger[_0xce7e('0x15')](_0xce7e('0x14'),_0x38457b,_0xce7e('0xd'));_0x1095b9(_0x2f3a52[_0xce7e('0x16')][_0xce7e('0x13')]);}})[_0xce7e('0x17')](function(_0x2345cb){logger['error'](_0xce7e('0x14'),_0x38457b,_0x2345cb);_0x4549fe(_0x2345cb);});});} \ No newline at end of file +var _0x335c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3d171b,_0x2cabed){var _0x40ffb4=function(_0xecde9f){while(--_0xecde9f){_0x3d171b['push'](_0x3d171b['shift']());}};_0x40ffb4(++_0x2cabed);}(_0x335c,0x13c));var _0xc335=function(_0x44c1f3,_0x5cf4a1){_0x44c1f3=_0x44c1f3-0x0;var _0x365dd9=_0x335c[_0x44c1f3];return _0x365dd9;};'use strict';var _=require('lodash');var util=require(_0xc335('0x0'));var moment=require('moment');var BPromise=require(_0xc335('0x1'));var rs=require(_0xc335('0x2'));var fs=require('fs');var Redis=require(_0xc335('0x3'));var db=require(_0xc335('0x4'))['db'];var utils=require(_0xc335('0x5'));var logger=require(_0xc335('0x6'))(_0xc335('0x7'));var config=require(_0xc335('0x8'));var jayson=require(_0xc335('0x9'));var client=jayson[_0xc335('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21cf6b,_0xf58068,_0x4050da){return new BPromise(function(_0x1e63f6,_0x5bd5a8){return client[_0xc335('0xb')](_0x21cf6b,_0x4050da)[_0xc335('0xc')](function(_0x280cf7){logger[_0xc335('0xd')](_0xc335('0xe'),_0xf58068,'request\x20sent');logger[_0xc335('0xf')](_0xc335('0x10'),_0xf58068,'request\x20sent',JSON[_0xc335('0x11')](_0x280cf7));if(_0x280cf7[_0xc335('0x12')]){if(_0x280cf7[_0xc335('0x12')][_0xc335('0x13')]===0x1f4){logger[_0xc335('0x12')](_0xc335('0xe'),_0xf58068,_0x280cf7[_0xc335('0x12')]['message']);return _0x5bd5a8(_0x280cf7[_0xc335('0x12')]['message']);}logger['error'](_0xc335('0xe'),_0xf58068,_0x280cf7[_0xc335('0x12')][_0xc335('0x14')]);return _0x1e63f6(_0x280cf7[_0xc335('0x12')]['message']);}else{logger[_0xc335('0xd')](_0xc335('0xe'),_0xf58068,_0xc335('0x15'));_0x1e63f6(_0x280cf7['result'][_0xc335('0x14')]);}})[_0xc335('0x16')](function(_0x55380d){logger['error'](_0xc335('0xe'),_0xf58068,_0x55380d);_0x5bd5a8(_0x55380d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 68fd7a6..6529254 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 _0xfb20=['express','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x4af3b7,_0x30c116){var _0x24727c=function(_0x3ae9a0){while(--_0x3ae9a0){_0x4af3b7['push'](_0x4af3b7['shift']());}};_0x24727c(++_0x30c116);}(_0xfb20,0x138));var _0x0fb2=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xfb20[_0x3cb152];return _0x4f54c3;};'use strict';var multer=require(_0x0fb2('0x0'));var util=require('util');var path=require(_0x0fb2('0x1'));var timeout=require(_0x0fb2('0x2'));var express=require(_0x0fb2('0x3'));var router=express[_0x0fb2('0x4')]();var auth=require(_0x0fb2('0x5'));var interaction=require(_0x0fb2('0x6'));var config=require('../../config/environment');var controller=require(_0x0fb2('0x7'));router['get']('/',auth[_0x0fb2('0x8')](),controller[_0x0fb2('0x9')]);router[_0x0fb2('0xa')](_0x0fb2('0xb'),auth['isAuthenticated'](),controller[_0x0fb2('0xc')]);router[_0x0fb2('0xa')](_0x0fb2('0xd'),auth['isAuthenticated'](),controller[_0x0fb2('0xe')]);router[_0x0fb2('0xf')]('/',auth[_0x0fb2('0x8')](),controller[_0x0fb2('0x10')]);router[_0x0fb2('0x11')](_0x0fb2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0fb2('0x12')]('/:id',auth[_0x0fb2('0x8')](),controller[_0x0fb2('0x13')]);module[_0x0fb2('0x14')]=router; \ No newline at end of file +var _0xad63=['post','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show'];(function(_0x4511ee,_0x29faa4){var _0x4f106d=function(_0x216790){while(--_0x216790){_0x4511ee['push'](_0x4511ee['shift']());}};_0x4f106d(++_0x29faa4);}(_0xad63,0xf0));var _0x3ad6=function(_0x8fb2a4,_0x55ba0f){_0x8fb2a4=_0x8fb2a4-0x0;var _0x43571f=_0xad63[_0x8fb2a4];return _0x43571f;};'use strict';var multer=require(_0x3ad6('0x0'));var util=require(_0x3ad6('0x1'));var path=require(_0x3ad6('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ad6('0x3'));var router=express['Router']();var auth=require(_0x3ad6('0x4'));var interaction=require(_0x3ad6('0x5'));var config=require('../../config/environment');var controller=require('./cdr.controller');router[_0x3ad6('0x6')]('/',auth[_0x3ad6('0x7')](),controller[_0x3ad6('0x8')]);router[_0x3ad6('0x6')](_0x3ad6('0x9'),auth[_0x3ad6('0x7')](),controller[_0x3ad6('0xa')]);router['get']('/:id',auth[_0x3ad6('0x7')](),controller[_0x3ad6('0xb')]);router[_0x3ad6('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3ad6('0xd'),auth['isAuthenticated'](),controller[_0x3ad6('0xe')]);router[_0x3ad6('0xf')](_0x3ad6('0xd'),auth[_0x3ad6('0x7')](),controller[_0x3ad6('0x10')]);module[_0x3ad6('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 2984e85..c161937 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 _0xa0e9=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x14c48f,_0x4392fb){var _0x36b105=function(_0x2a5b90){while(--_0x2a5b90){_0x14c48f['push'](_0x14c48f['shift']());}};_0x36b105(++_0x4392fb);}(_0xa0e9,0x196));var _0x9a0e=function(_0x581db0,_0x31d992){_0x581db0=_0x581db0-0x0;var _0x198b98=_0xa0e9[_0x581db0];return _0x198b98;};'use strict';var Sequelize=require(_0x9a0e('0x0'));module[_0x9a0e('0x1')]={'priority':{'type':Sequelize[_0x9a0e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9a0e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9a0e('0x4')]()},'description':{'type':Sequelize[_0x9a0e('0x3')]},'interval':{'type':Sequelize[_0x9a0e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xcb77=['*,*,*,*','sequelize','exports','INTEGER','noop','STRING'];(function(_0x1c638c,_0x3b3bff){var _0x2b2731=function(_0x1a46e8){while(--_0x1a46e8){_0x1c638c['push'](_0x1c638c['shift']());}};_0x2b2731(++_0x3b3bff);}(_0xcb77,0x157));var _0x7cb7=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0xcb77[_0x172133];return _0x2460e5;};'use strict';var Sequelize=require(_0x7cb7('0x0'));module[_0x7cb7('0x1')]={'priority':{'type':Sequelize[_0x7cb7('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7cb7('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7cb7('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7cb7('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3f4f35b..5ab1a59 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 _0x874d=['model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','update','then','destroy','error','stack','name','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x874d,0x123));var _0xd874=function(_0x8a30cf,_0x40f19b){_0x8a30cf=_0x8a30cf-0x0;var _0x20f439=_0x874d[_0x8a30cf];return _0x20f439;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd874('0x0'));var rimraf=require(_0xd874('0x1'));var zipdir=require(_0xd874('0x2'));var jsonpatch=require(_0xd874('0x3'));var rp=require(_0xd874('0x4'));var moment=require(_0xd874('0x5'));var BPromise=require(_0xd874('0x6'));var Mustache=require(_0xd874('0x7'));var util=require('util');var path=require(_0xd874('0x8'));var sox=require('sox');var csv=require(_0xd874('0x9'));var ejs=require(_0xd874('0xa'));var fs=require('fs');var _=require(_0xd874('0xb'));var squel=require(_0xd874('0xc'));var crypto=require(_0xd874('0xd'));var jsforce=require(_0xd874('0xe'));var deskjs=require(_0xd874('0xf'));var toCsv=require(_0xd874('0x9'));var querystring=require(_0xd874('0x10'));var Papa=require(_0xd874('0x11'));var Redis=require(_0xd874('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd874('0x13'));var logger=require(_0xd874('0x14'))('api');var utils=require(_0xd874('0x15'));var config=require(_0xd874('0x16'));var db=require(_0xd874('0x17'))['db'];function respondWithStatusCode(_0x597f0b,_0xc9d102){_0xc9d102=_0xc9d102||0xcc;return function(_0x2605fc){if(_0x2605fc){return _0x597f0b[_0xd874('0x18')](_0xc9d102);}return _0x597f0b['status'](_0xc9d102)[_0xd874('0x19')]();};}function respondWithResult(_0x4216c8,_0x212b8c){_0x212b8c=_0x212b8c||0xc8;return function(_0x2b3f6e){if(_0x2b3f6e){return _0x4216c8[_0xd874('0x1a')](_0x212b8c)[_0xd874('0x1b')](_0x2b3f6e);}};}function respondWithFilteredResult(_0x4b5bcb,_0x11b5a5){return function(_0x476752){if(_0x476752){var _0x519052=_0x476752[_0xd874('0x1c')],_0x468dc4=_0x11b5a5[_0xd874('0x1d')],_0x369d26=_0x11b5a5['offset']+_0x11b5a5[_0xd874('0x1e')],_0x2320aa;if(_0x369d26>=_0x519052){_0x369d26=_0x519052;_0x2320aa=0xc8;}else{_0x2320aa=0xce;}_0x4b5bcb[_0xd874('0x1a')](_0x2320aa);return _0x4b5bcb['set'](_0xd874('0x1f'),_0x468dc4+'-'+_0x369d26+'/'+_0x519052)[_0xd874('0x1b')](_0x476752);}return null;};}function patchUpdates(_0x82dc39){return function(_0x19b47f){try{jsonpatch['apply'](_0x19b47f,_0x82dc39,!![]);}catch(_0x52080a){return BPromise['reject'](_0x52080a);}return _0x19b47f['save']();};}function saveUpdates(_0x523141,_0x3d3d43){return function(_0x1f4cb8){if(_0x1f4cb8){return _0x1f4cb8[_0xd874('0x20')](_0x523141)[_0xd874('0x21')](function(_0x5f4c90){return _0x5f4c90;});}return null;};}function removeEntity(_0x5612da,_0x2e4bec){return function(_0x21ab00){if(_0x21ab00){return _0x21ab00[_0xd874('0x22')]()[_0xd874('0x21')](function(){_0x5612da[_0xd874('0x1a')](0xcc)[_0xd874('0x19')]();});}};}function handleEntityNotFound(_0x338675,_0x2e1a66){return function(_0x18db9b){if(!_0x18db9b){_0x338675[_0xd874('0x18')](0x194);}return _0x18db9b;};}function handleError(_0x25c886,_0x5d4ebc){_0x5d4ebc=_0x5d4ebc||0x1f4;return function(_0x1e26d3){logger[_0xd874('0x23')](_0x1e26d3[_0xd874('0x24')]);if(_0x1e26d3[_0xd874('0x25')]){delete _0x1e26d3[_0xd874('0x25')];}_0x25c886[_0xd874('0x1a')](_0x5d4ebc)['send'](_0x1e26d3);};}exports['show']=function(_0x4fe5c0,_0xdb48b5){var _0x3cac41={'raw':!![],'where':{'id':_0x4fe5c0[_0xd874('0x26')]['id']}},_0x2e429c={};_0x2e429c[_0xd874('0x27')]=_[_0xd874('0x28')](db[_0xd874('0x29')][_0xd874('0x2a')]);_0x2e429c['query']=_['keys'](_0x4fe5c0[_0xd874('0x2b')]);_0x2e429c[_0xd874('0x2c')]=_[_0xd874('0x2d')](_0x2e429c[_0xd874('0x27')],_0x2e429c[_0xd874('0x2b')]);_0x3cac41[_0xd874('0x2e')]=_[_0xd874('0x2d')](_0x2e429c[_0xd874('0x27')],qs['fields'](_0x4fe5c0[_0xd874('0x2b')][_0xd874('0x2f')]));_0x3cac41[_0xd874('0x2e')]=_0x3cac41['attributes']['length']?_0x3cac41['attributes']:_0x2e429c[_0xd874('0x27')];if(_0x4fe5c0[_0xd874('0x2b')][_0xd874('0x30')]){_0x3cac41[_0xd874('0x31')]=[{'all':!![]}];}_0x3cac41=_[_0xd874('0x32')]({},_0x3cac41,_0x4fe5c0[_0xd874('0x33')]);return db[_0xd874('0x29')]['find'](_0x3cac41)[_0xd874('0x21')](handleEntityNotFound(_0xdb48b5,null))[_0xd874('0x21')](respondWithResult(_0xdb48b5,null))[_0xd874('0x34')](handleError(_0xdb48b5,null));};exports[_0xd874('0x20')]=function(_0x528ea5,_0x3b87e2){if(_0x528ea5[_0xd874('0x35')]['id']){delete _0x528ea5['body']['id'];}return db[_0xd874('0x29')]['find']({'where':{'id':_0x528ea5[_0xd874('0x26')]['id']}})[_0xd874('0x21')](handleEntityNotFound(_0x3b87e2,null))[_0xd874('0x21')](saveUpdates(_0x528ea5['body'],null))['then'](respondWithResult(_0x3b87e2,null))['catch'](handleError(_0x3b87e2,null));};exports['destroy']=function(_0x2c8904,_0x52f64e){return db['ChatApplication'][_0xd874('0x36')]({'where':{'id':_0x2c8904[_0xd874('0x26')]['id']}})[_0xd874('0x21')](handleEntityNotFound(_0x52f64e,null))['then'](removeEntity(_0x52f64e,null))[_0xd874('0x34')](handleError(_0x52f64e,null));}; \ No newline at end of file +var _0x6566=['sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../mysqldb','status','end','json','count','apply','update','then','sendStatus','error','stack','name','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','attributes','fields','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x1fc53f,_0x39f744){var _0x515190=function(_0x4bf27c){while(--_0x4bf27c){_0x1fc53f['push'](_0x1fc53f['shift']());}};_0x515190(++_0x39f744);}(_0x6566,0x1a8));var _0x6656=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x6566[_0x409353];return _0x4f4b59;};'use strict';var pdf=require(_0x6656('0x0'));var emlformat=require(_0x6656('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6656('0x2'));var rp=require(_0x6656('0x3'));var moment=require('moment');var BPromise=require(_0x6656('0x4'));var Mustache=require(_0x6656('0x5'));var util=require(_0x6656('0x6'));var path=require(_0x6656('0x7'));var sox=require(_0x6656('0x8'));var csv=require('to-csv');var ejs=require(_0x6656('0x9'));var fs=require('fs');var _=require(_0x6656('0xa'));var squel=require(_0x6656('0xb'));var crypto=require('crypto');var jsforce=require(_0x6656('0xc'));var deskjs=require(_0x6656('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6656('0xe'));var Papa=require(_0x6656('0xf'));var Redis=require(_0x6656('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6656('0x11'));var logger=require('../../config/logger')(_0x6656('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6656('0x13'))['db'];function respondWithStatusCode(_0x5d2749,_0x28e35c){_0x28e35c=_0x28e35c||0xcc;return function(_0x1dc8e0){if(_0x1dc8e0){return _0x5d2749['sendStatus'](_0x28e35c);}return _0x5d2749[_0x6656('0x14')](_0x28e35c)[_0x6656('0x15')]();};}function respondWithResult(_0xa13885,_0x445610){_0x445610=_0x445610||0xc8;return function(_0x462b2b){if(_0x462b2b){return _0xa13885[_0x6656('0x14')](_0x445610)[_0x6656('0x16')](_0x462b2b);}};}function respondWithFilteredResult(_0x32025d,_0x3f6633){return function(_0x34c1a6){if(_0x34c1a6){var _0x3294d2=_0x34c1a6[_0x6656('0x17')],_0x35dbdb=_0x3f6633['offset'],_0x4d7c0b=_0x3f6633['offset']+_0x3f6633['limit'],_0x23b4b1;if(_0x4d7c0b>=_0x3294d2){_0x4d7c0b=_0x3294d2;_0x23b4b1=0xc8;}else{_0x23b4b1=0xce;}_0x32025d[_0x6656('0x14')](_0x23b4b1);return _0x32025d['set']('Content-Range',_0x35dbdb+'-'+_0x4d7c0b+'/'+_0x3294d2)['json'](_0x34c1a6);}return null;};}function patchUpdates(_0x12e6c0){return function(_0x57fa51){try{jsonpatch[_0x6656('0x18')](_0x57fa51,_0x12e6c0,!![]);}catch(_0x303658){return BPromise['reject'](_0x303658);}return _0x57fa51['save']();};}function saveUpdates(_0x31001d,_0x59330e){return function(_0x3e2340){if(_0x3e2340){return _0x3e2340[_0x6656('0x19')](_0x31001d)[_0x6656('0x1a')](function(_0x5913eb){return _0x5913eb;});}return null;};}function removeEntity(_0x51bfbc,_0x3248d1){return function(_0x52748b){if(_0x52748b){return _0x52748b['destroy']()['then'](function(){_0x51bfbc[_0x6656('0x14')](0xcc)[_0x6656('0x15')]();});}};}function handleEntityNotFound(_0x10523d,_0x369acf){return function(_0x32a9e6){if(!_0x32a9e6){_0x10523d[_0x6656('0x1b')](0x194);}return _0x32a9e6;};}function handleError(_0x22fbf,_0x20254b){_0x20254b=_0x20254b||0x1f4;return function(_0xc5d516){logger[_0x6656('0x1c')](_0xc5d516[_0x6656('0x1d')]);if(_0xc5d516[_0x6656('0x1e')]){delete _0xc5d516[_0x6656('0x1e')];}_0x22fbf[_0x6656('0x14')](_0x20254b)['send'](_0xc5d516);};}exports[_0x6656('0x1f')]=function(_0x2fe12c,_0x156bb2){var _0x4386a6={'raw':!![],'where':{'id':_0x2fe12c[_0x6656('0x20')]['id']}},_0x2eec4d={};_0x2eec4d['model']=_[_0x6656('0x21')](db[_0x6656('0x22')][_0x6656('0x23')]);_0x2eec4d[_0x6656('0x24')]=_[_0x6656('0x21')](_0x2fe12c[_0x6656('0x24')]);_0x2eec4d['filters']=_[_0x6656('0x25')](_0x2eec4d[_0x6656('0x26')],_0x2eec4d[_0x6656('0x24')]);_0x4386a6[_0x6656('0x27')]=_[_0x6656('0x25')](_0x2eec4d[_0x6656('0x26')],qs['fields'](_0x2fe12c[_0x6656('0x24')][_0x6656('0x28')]));_0x4386a6['attributes']=_0x4386a6[_0x6656('0x27')]['length']?_0x4386a6[_0x6656('0x27')]:_0x2eec4d[_0x6656('0x26')];if(_0x2fe12c[_0x6656('0x24')][_0x6656('0x29')]){_0x4386a6[_0x6656('0x2a')]=[{'all':!![]}];}_0x4386a6=_[_0x6656('0x2b')]({},_0x4386a6,_0x2fe12c[_0x6656('0x2c')]);return db['ChatApplication'][_0x6656('0x2d')](_0x4386a6)['then'](handleEntityNotFound(_0x156bb2,null))[_0x6656('0x1a')](respondWithResult(_0x156bb2,null))[_0x6656('0x2e')](handleError(_0x156bb2,null));};exports[_0x6656('0x19')]=function(_0x4eab59,_0x4437a8){if(_0x4eab59['body']['id']){delete _0x4eab59[_0x6656('0x2f')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x4eab59['params']['id']}})[_0x6656('0x1a')](handleEntityNotFound(_0x4437a8,null))['then'](saveUpdates(_0x4eab59[_0x6656('0x2f')],null))[_0x6656('0x1a')](respondWithResult(_0x4437a8,null))[_0x6656('0x2e')](handleError(_0x4437a8,null));};exports['destroy']=function(_0x65343d,_0x16416d){return db[_0x6656('0x22')]['find']({'where':{'id':_0x65343d[_0x6656('0x20')]['id']}})[_0x6656('0x1a')](handleEntityNotFound(_0x16416d,null))[_0x6656('0x1a')](removeEntity(_0x16416d,null))[_0x6656('0x2e')](handleError(_0x16416d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index c9482e6..ad35538 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 _0xa174=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x4baaa2,_0x3a100a){var _0x5cfc61=function(_0x184610){while(--_0x184610){_0x4baaa2['push'](_0x4baaa2['shift']());}};_0x5cfc61(++_0x3a100a);}(_0xa174,0xbf));var _0x4a17=function(_0x172662,_0x4d8dd1){_0x172662=_0x172662-0x0;var _0xdd6143=_0xa174[_0x172662];return _0xdd6143;};'use strict';var _=require('lodash');var util=require(_0x4a17('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4a17('0x1'));var BPromise=require(_0x4a17('0x2'));var rp=require(_0x4a17('0x3'));var fs=require('fs');var path=require(_0x4a17('0x4'));var rimraf=require(_0x4a17('0x5'));var config=require(_0x4a17('0x6'));var attributes=require('./chatApplication.attributes');module[_0x4a17('0x7')]=function(_0x14dc0c,_0x3f5818){return _0x14dc0c[_0x4a17('0x8')]('ChatApplication',attributes,{'tableName':_0x4a17('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a17('0xa'),'collate':_0x4a17('0xb')});}; \ No newline at end of file +var _0x67ab=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','ChatApplication','chat_applications','utf8mb4','lodash','../../config/logger'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x67ab,0x17e));var _0xb67a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x67ab[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xb67a('0x0'));var util=require('util');var logger=require(_0xb67a('0x1'))(_0xb67a('0x2'));var moment=require(_0xb67a('0x3'));var BPromise=require(_0xb67a('0x4'));var rp=require(_0xb67a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb67a('0x6'));var config=require(_0xb67a('0x7'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x50e012,_0x2a4e3e){return _0x50e012[_0xb67a('0x8')](_0xb67a('0x9'),attributes,{'tableName':_0xb67a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb67a('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d9e006e..ea450d9 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 _0xf334=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x2eae80,_0x481d0b){var _0x48ca71=function(_0xd17f32){while(--_0xd17f32){_0x2eae80['push'](_0x2eae80['shift']());}};_0x48ca71(++_0x481d0b);}(_0xf334,0x7e));var _0x4f33=function(_0x27cb2a,_0x25e011){_0x27cb2a=_0x27cb2a-0x0;var _0x5e85c6=_0xf334[_0x27cb2a];return _0x5e85c6;};'use strict';var _=require('lodash');var util=require(_0x4f33('0x0'));var moment=require('moment');var BPromise=require(_0x4f33('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f33('0x2'))['db'];var utils=require(_0x4f33('0x3'));var logger=require(_0x4f33('0x4'))('rpc');var config=require(_0x4f33('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4f33('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aee45,_0xcf13df,_0x598ba9){return new BPromise(function(_0x3b6a78,_0x4a282b){return client[_0x4f33('0x7')](_0x2aee45,_0x598ba9)[_0x4f33('0x8')](function(_0x571f0b){logger['info'](_0x4f33('0x9'),_0xcf13df,_0x4f33('0xa'));logger[_0x4f33('0xb')](_0x4f33('0xc'),_0xcf13df,_0x4f33('0xa'),JSON[_0x4f33('0xd')](_0x571f0b));if(_0x571f0b[_0x4f33('0xe')]){if(_0x571f0b[_0x4f33('0xe')]['code']===0x1f4){logger[_0x4f33('0xe')]('ChatApplication,\x20%s,\x20%s',_0xcf13df,_0x571f0b[_0x4f33('0xe')]['message']);return _0x4a282b(_0x571f0b['error'][_0x4f33('0xf')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0xcf13df,_0x571f0b[_0x4f33('0xe')][_0x4f33('0xf')]);return _0x3b6a78(_0x571f0b[_0x4f33('0xe')][_0x4f33('0xf')]);}else{logger['info'](_0x4f33('0x9'),_0xcf13df,_0x4f33('0xa'));_0x3b6a78(_0x571f0b[_0x4f33('0x10')][_0x4f33('0xf')]);}})[_0x4f33('0x11')](function(_0x1c69de){logger[_0x4f33('0xe')](_0x4f33('0x9'),_0xcf13df,_0x1c69de);_0x4a282b(_0x1c69de);});});} \ No newline at end of file +var _0x9657=['ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x9657,0x16d));var _0x7965=function(_0x3e5fa1,_0x245899){_0x3e5fa1=_0x3e5fa1-0x0;var _0x3f7eca=_0x9657[_0x3e5fa1];return _0x3f7eca;};'use strict';var _=require(_0x7965('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7965('0x1'));var rs=require(_0x7965('0x2'));var fs=require('fs');var Redis=require(_0x7965('0x3'));var db=require(_0x7965('0x4'))['db'];var utils=require(_0x7965('0x5'));var logger=require(_0x7965('0x6'))(_0x7965('0x7'));var config=require('../../config/environment');var jayson=require(_0x7965('0x8'));var client=jayson[_0x7965('0x9')][_0x7965('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123d9f,_0x21f9d9,_0x2ef1eb){return new BPromise(function(_0xc5c8a4,_0x211093){return client['request'](_0x123d9f,_0x2ef1eb)[_0x7965('0xb')](function(_0x1b5697){logger[_0x7965('0xc')]('ChatApplication,\x20%s,\x20%s',_0x21f9d9,_0x7965('0xd'));logger[_0x7965('0xe')](_0x7965('0xf'),_0x21f9d9,_0x7965('0xd'),JSON['stringify'](_0x1b5697));if(_0x1b5697[_0x7965('0x10')]){if(_0x1b5697['error'][_0x7965('0x11')]===0x1f4){logger[_0x7965('0x10')](_0x7965('0x12'),_0x21f9d9,_0x1b5697['error'][_0x7965('0x13')]);return _0x211093(_0x1b5697[_0x7965('0x10')]['message']);}logger[_0x7965('0x10')](_0x7965('0x12'),_0x21f9d9,_0x1b5697[_0x7965('0x10')][_0x7965('0x13')]);return _0xc5c8a4(_0x1b5697[_0x7965('0x10')][_0x7965('0x13')]);}else{logger[_0x7965('0xc')](_0x7965('0x12'),_0x21f9d9,_0x7965('0xd'));_0xc5c8a4(_0x1b5697['result']['message']);}})['catch'](function(_0x139908){logger[_0x7965('0x10')]('ChatApplication,\x20%s,\x20%s',_0x21f9d9,_0x139908);_0x211093(_0x139908);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 349205d..713425c 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 _0x60e3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','put','update','/:id','exports'];(function(_0x1d190d,_0x55117e){var _0x59b5b2=function(_0x54ad80){while(--_0x54ad80){_0x1d190d['push'](_0x1d190d['shift']());}};_0x59b5b2(++_0x55117e);}(_0x60e3,0xc3));var _0x360e=function(_0x5281fb,_0x51d61a){_0x5281fb=_0x5281fb-0x0;var _0x2be1aa=_0x60e3[_0x5281fb];return _0x2be1aa;};'use strict';var multer=require(_0x360e('0x0'));var util=require(_0x360e('0x1'));var path=require(_0x360e('0x2'));var timeout=require(_0x360e('0x3'));var express=require(_0x360e('0x4'));var router=express[_0x360e('0x5')]();var auth=require(_0x360e('0x6'));var interaction=require(_0x360e('0x7'));var config=require('../../config/environment');var controller=require(_0x360e('0x8'));router[_0x360e('0x9')]('/:id',auth[_0x360e('0xa')](),controller['show']);router[_0x360e('0xb')]('/:id',auth[_0x360e('0xa')](),controller[_0x360e('0xc')]);router['delete'](_0x360e('0xd'),auth[_0x360e('0xa')](),controller['destroy']);module[_0x360e('0xe')]=router; \ No newline at end of file +var _0x50bf=['util','path','connect-timeout','express','Router','../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','put','update','delete','/:id','destroy','exports','multer'];(function(_0x2a96b8,_0x3fe8d8){var _0x477d5a=function(_0x21b454){while(--_0x21b454){_0x2a96b8['push'](_0x2a96b8['shift']());}};_0x477d5a(++_0x3fe8d8);}(_0x50bf,0x1cf));var _0xf50b=function(_0x2ad2ca,_0x1d2b0b){_0x2ad2ca=_0x2ad2ca-0x0;var _0x3007c5=_0x50bf[_0x2ad2ca];return _0x3007c5;};'use strict';var multer=require(_0xf50b('0x0'));var util=require(_0xf50b('0x1'));var path=require(_0xf50b('0x2'));var timeout=require(_0xf50b('0x3'));var express=require(_0xf50b('0x4'));var router=express[_0xf50b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf50b('0x6'));var config=require('../../config/environment');var controller=require(_0xf50b('0x7'));router[_0xf50b('0x8')]('/:id',auth[_0xf50b('0x9')](),controller['show']);router[_0xf50b('0xa')]('/:id',auth[_0xf50b('0x9')](),controller[_0xf50b('0xb')]);router[_0xf50b('0xc')](_0xf50b('0xd'),auth[_0xf50b('0x9')](),controller[_0xf50b('0xe')]);module[_0xf50b('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 6504676..399ff8f 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 _0xef2c=['STRING','BOOLEAN'];(function(_0x2a82db,_0xd0f42e){var _0x2bc54c=function(_0x17e9e8){while(--_0x17e9e8){_0x2a82db['push'](_0x2a82db['shift']());}};_0x2bc54c(++_0xd0f42e);}(_0xef2c,0x182));var _0xcef2=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0xef2c[_0x15b380];return _0x232c5c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcef2('0x0')]},'write':{'type':Sequelize[_0xcef2('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x397a=['STRING','exports'];(function(_0x4717b3,_0x4b70ac){var _0x531828=function(_0x3b5922){while(--_0x3b5922){_0x4717b3['push'](_0x4717b3['shift']());}};_0x531828(++_0x4b70ac);}(_0x397a,0xb1));var _0xa397=function(_0x47c492,_0x311a27){_0x47c492=_0x47c492-0x0;var _0x32105d=_0x397a[_0x47c492];return _0x32105d;};'use strict';var Sequelize=require('sequelize');module[_0xa397('0x0')]={'name':{'type':Sequelize[_0xa397('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa397('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 1668806..0106fe5 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 _0x709c=['key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','filters','pick','where','map','VIRTUAL','merge','options','count','includeAll','findAll','rows','show','params','include','find','create','destroy','ChatInternalMessage','user','addMembers','omit','body','ids','getMembers','filter','ChatGroupId','findOne','sort','$gte','format','getMessages','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','Content-Range','apply','reject','update','then','end','stack','name','send','ChatGroup','rawAttributes','fieldName','type'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x709c,0x1bf));var _0xc709=function(_0x31548e,_0x1297be){_0x31548e=_0x31548e-0x0;var _0x129939=_0x709c[_0x31548e];return _0x129939;};'use strict';var pdf=require(_0xc709('0x0'));var emlformat=require(_0xc709('0x1'));var rimraf=require(_0xc709('0x2'));var zipdir=require(_0xc709('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc709('0x4'));var Mustache=require(_0xc709('0x5'));var util=require('util');var path=require(_0xc709('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc709('0x7'));var fs=require('fs');var _=require(_0xc709('0x8'));var squel=require('squel');var crypto=require(_0xc709('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc709('0xa'));var toCsv=require(_0xc709('0xb'));var querystring=require(_0xc709('0xc'));var Papa=require('papaparse');var Redis=require(_0xc709('0xd'));var authService=require(_0xc709('0xe'));var qs=require(_0xc709('0xf'));var as=require(_0xc709('0x10'));var hardwareService=require(_0xc709('0x11'));var logger=require(_0xc709('0x12'))(_0xc709('0x13'));var utils=require(_0xc709('0x14'));var config=require(_0xc709('0x15'));var db=require('../../mysqldb')['db'];config[_0xc709('0x16')]=_['defaults'](config['redis'],{'host':_0xc709('0x17'),'port':0x18eb});var socket=require(_0xc709('0x18'))(new Redis(config['redis']));require(_0xc709('0x19'))[_0xc709('0x1a')](socket);var jayson=require(_0xc709('0x1b'));var client=jayson['client'][_0xc709('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x141742,_0x40daa3,_0x3d2d07){if(_0x3d2d07){var _0x333ace=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x333ace[_0xc709('0x1d')](_0x40daa3)){return _0x141742;}else{throw new db['Sequelize'][(_0xc709('0x1e'))](_0xc709('0x1f'));}}else{return _0x141742;}}function respondWithRpcPromise(_0x432362,_0x360b,_0x2831fa,_0x3f7b7e){return new BPromise(function(_0x45adce,_0x4b7ddc){var _0x4a1c96=_0x3f7b7e||client;return _0x4a1c96['request'](_0x432362,_0x2831fa)['then'](function(_0x2b4caa){logger[_0xc709('0x20')](_0xc709('0x21'),_0x360b,_0xc709('0x22'));logger[_0xc709('0x23')](_0xc709('0x24'),_0x360b,_0xc709('0x22'),JSON['stringify'](_0x2b4caa));if(_0x2b4caa[_0xc709('0x25')]){if(_0x2b4caa[_0xc709('0x25')]['code']===0x1f4){logger[_0xc709('0x25')](_0xc709('0x21'),_0x360b,_0x2b4caa[_0xc709('0x25')][_0xc709('0x26')]);return _0x4b7ddc(_0x2b4caa[_0xc709('0x25')]['message']);}logger[_0xc709('0x25')](_0xc709('0x21'),_0x360b,_0x2b4caa[_0xc709('0x25')][_0xc709('0x26')]);return _0x45adce(_0x2b4caa[_0xc709('0x25')][_0xc709('0x26')]);}else{logger[_0xc709('0x20')](_0xc709('0x21'),_0x360b,'request\x20sent');_0x45adce(_0x2b4caa[_0xc709('0x27')][_0xc709('0x26')]);}})[_0xc709('0x28')](function(_0x5bd4cb){logger['error']('ChatGroup,\x20%s,\x20%s',_0x360b,_0x5bd4cb);_0x4b7ddc(_0x5bd4cb);});});}function respondWithStatusCode(_0x11fb4f,_0x47c0b3){_0x47c0b3=_0x47c0b3||0xcc;return function(_0x5eec15){if(_0x5eec15){return _0x11fb4f[_0xc709('0x29')](_0x47c0b3);}return _0x11fb4f['status'](_0x47c0b3)['end']();};}function respondWithResult(_0x1b9c86,_0x261192){_0x261192=_0x261192||0xc8;return function(_0x3fb183){if(_0x3fb183){return _0x1b9c86[_0xc709('0x2a')](_0x261192)[_0xc709('0x2b')](_0x3fb183);}};}function respondWithFilteredResult(_0x2cdd2e,_0x2a31e1){return function(_0x1f83f7){if(_0x1f83f7){var _0x474426=_0x1f83f7['count'],_0x3e9fb6=_0x2a31e1[_0xc709('0x2c')],_0x493ca1=_0x2a31e1['offset']+_0x2a31e1['limit'],_0x34e00b;if(_0x493ca1>=_0x474426){_0x493ca1=_0x474426;_0x34e00b=0xc8;}else{_0x34e00b=0xce;}_0x2cdd2e[_0xc709('0x2a')](_0x34e00b);return _0x2cdd2e['set'](_0xc709('0x2d'),_0x3e9fb6+'-'+_0x493ca1+'/'+_0x474426)['json'](_0x1f83f7);}return null;};}function patchUpdates(_0x38904c){return function(_0x1577ca){try{jsonpatch[_0xc709('0x2e')](_0x1577ca,_0x38904c,!![]);}catch(_0x5ec82f){return BPromise[_0xc709('0x2f')](_0x5ec82f);}return _0x1577ca['save']();};}function saveUpdates(_0x1b9a30,_0x71bd6){return function(_0x1ad166){if(_0x1ad166){return _0x1ad166[_0xc709('0x30')](_0x1b9a30)[_0xc709('0x31')](function(_0x4d52d8){return _0x4d52d8;});}return null;};}function removeEntity(_0x1d35da,_0x4f8e1c){return function(_0x43961f){if(_0x43961f){return _0x43961f['destroy']()[_0xc709('0x31')](function(){_0x1d35da[_0xc709('0x2a')](0xcc)[_0xc709('0x32')]();});}};}function handleEntityNotFound(_0x65d1d2,_0x1b2369){return function(_0x1cce20){if(!_0x1cce20){_0x65d1d2[_0xc709('0x29')](0x194);}return _0x1cce20;};}function handleError(_0x465ef8,_0x2eec76){_0x2eec76=_0x2eec76||0x1f4;return function(_0x185cbf){logger[_0xc709('0x25')](_0x185cbf[_0xc709('0x33')]);if(_0x185cbf[_0xc709('0x34')]){delete _0x185cbf['name'];}_0x465ef8['status'](_0x2eec76)[_0xc709('0x35')](_0x185cbf);};}exports['index']=function(_0x5bb29d,_0x37971c){var _0x38b1a9={},_0x101fcf={},_0x177690={'count':0x0,'rows':[]};var _0x4948c0=_['map'](db[_0xc709('0x36')][_0xc709('0x37')],function(_0x28103d){return{'name':_0x28103d[_0xc709('0x38')],'type':_0x28103d[_0xc709('0x39')][_0xc709('0x3a')]};});_0x101fcf[_0xc709('0x3b')]=_['map'](_0x4948c0,_0xc709('0x34'));_0x101fcf[_0xc709('0x3c')]=_[_0xc709('0x3d')](_0x5bb29d[_0xc709('0x3c')]);_0x101fcf['filters']=_['intersection'](_0x101fcf[_0xc709('0x3b')],_0x101fcf[_0xc709('0x3c')]);_0x38b1a9['attributes']=_[_0xc709('0x3e')](_0x101fcf[_0xc709('0x3b')],qs[_0xc709('0x3f')](_0x5bb29d[_0xc709('0x3c')][_0xc709('0x3f')]));_0x38b1a9[_0xc709('0x40')]=_0x38b1a9[_0xc709('0x40')][_0xc709('0x41')]?_0x38b1a9[_0xc709('0x40')]:_0x101fcf[_0xc709('0x3b')];if(!_0x5bb29d['query'][_0xc709('0x42')](_0xc709('0x43'))){_0x38b1a9[_0xc709('0x44')]=qs['limit'](_0x5bb29d[_0xc709('0x3c')]['limit']);_0x38b1a9[_0xc709('0x2c')]=qs[_0xc709('0x2c')](_0x5bb29d[_0xc709('0x3c')][_0xc709('0x2c')]);}_0x38b1a9[_0xc709('0x45')]=qs['sort'](_0x5bb29d[_0xc709('0x3c')]['sort']);_0x38b1a9['where']=qs[_0xc709('0x46')](_[_0xc709('0x47')](_0x5bb29d[_0xc709('0x3c')],_0x101fcf[_0xc709('0x46')]),_0x4948c0);if(_0x5bb29d[_0xc709('0x3c')]['filter']){_0x38b1a9[_0xc709('0x48')]=_['merge'](_0x38b1a9[_0xc709('0x48')],{'$or':_[_0xc709('0x49')](_0x4948c0,function(_0x2ceb40){if(_0x2ceb40['type']!==_0xc709('0x4a')){var _0x38a85d={};_0x38a85d[_0x2ceb40['name']]={'$like':'%'+_0x5bb29d[_0xc709('0x3c')]['filter']+'%'};return _0x38a85d;}})});}_0x38b1a9=_[_0xc709('0x4b')]({},_0x38b1a9,_0x5bb29d[_0xc709('0x4c')]);var _0x28969d={'where':_0x38b1a9['where']};return db[_0xc709('0x36')][_0xc709('0x4d')](_0x28969d)[_0xc709('0x31')](function(_0x176d9f){_0x177690[_0xc709('0x4d')]=_0x176d9f;if(_0x5bb29d[_0xc709('0x3c')][_0xc709('0x4e')]){_0x38b1a9['include']=[{'all':!![]}];}return db[_0xc709('0x36')][_0xc709('0x4f')](_0x38b1a9);})[_0xc709('0x31')](function(_0x4b2a40){_0x177690[_0xc709('0x50')]=_0x4b2a40;return _0x177690;})[_0xc709('0x31')](respondWithFilteredResult(_0x37971c,_0x38b1a9))[_0xc709('0x28')](handleError(_0x37971c,null));};exports[_0xc709('0x51')]=function(_0x1b4af8,_0x168721){var _0x3f9092={'raw':!![],'where':{'id':_0x1b4af8[_0xc709('0x52')]['id']}},_0x4c9824={};_0x4c9824[_0xc709('0x3b')]=_[_0xc709('0x3d')](db[_0xc709('0x36')][_0xc709('0x37')]);_0x4c9824[_0xc709('0x3c')]=_[_0xc709('0x3d')](_0x1b4af8[_0xc709('0x3c')]);_0x4c9824[_0xc709('0x46')]=_['intersection'](_0x4c9824['model'],_0x4c9824[_0xc709('0x3c')]);_0x3f9092[_0xc709('0x40')]=_[_0xc709('0x3e')](_0x4c9824[_0xc709('0x3b')],qs['fields'](_0x1b4af8[_0xc709('0x3c')]['fields']));_0x3f9092[_0xc709('0x40')]=_0x3f9092[_0xc709('0x40')][_0xc709('0x41')]?_0x3f9092[_0xc709('0x40')]:_0x4c9824[_0xc709('0x3b')];if(_0x1b4af8[_0xc709('0x3c')][_0xc709('0x4e')]){_0x3f9092[_0xc709('0x53')]=[{'all':!![]}];}_0x3f9092=_[_0xc709('0x4b')]({},_0x3f9092,_0x1b4af8[_0xc709('0x4c')]);return db[_0xc709('0x36')][_0xc709('0x54')](_0x3f9092)[_0xc709('0x31')](handleEntityNotFound(_0x168721,null))[_0xc709('0x31')](respondWithResult(_0x168721,null))[_0xc709('0x28')](handleError(_0x168721,null));};exports[_0xc709('0x55')]=function(_0x2cbb3f,_0x247ef8){return db[_0xc709('0x36')][_0xc709('0x55')](_0x2cbb3f['body'],{})['then'](respondWithResult(_0x247ef8,0xc9))['catch'](handleError(_0x247ef8,null));};exports[_0xc709('0x30')]=function(_0x4f5047,_0x54e54c){if(_0x4f5047['body']['id']){delete _0x4f5047['body']['id'];}return db['ChatGroup'][_0xc709('0x54')]({'where':{'id':_0x4f5047['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x54e54c,null))[_0xc709('0x31')](saveUpdates(_0x4f5047['body'],null))[_0xc709('0x31')](respondWithResult(_0x54e54c,null))[_0xc709('0x28')](handleError(_0x54e54c,null));};exports[_0xc709('0x56')]=function(_0x123a06,_0x6343f2){return db[_0xc709('0x36')][_0xc709('0x54')]({'where':{'id':_0x123a06[_0xc709('0x52')]['id']}})['then'](handleEntityNotFound(_0x6343f2,null))['then'](removeEntity(_0x6343f2,null))[_0xc709('0x28')](handleError(_0x6343f2,null));};exports['describe']=function(_0x2099e2,_0x272c75){return db[_0xc709('0x36')]['describe']()['then'](respondWithResult(_0x272c75,null))[_0xc709('0x28')](handleError(_0x272c75,null));};exports['getUnread']=function(_0x2fed54,_0x2ded56,_0x3501c9){return db[_0xc709('0x57')][_0xc709('0x4d')]({'where':{'ChatGroupId':_0x2fed54[_0xc709('0x52')]['id'],'ToId':_0x2fed54[_0xc709('0x58')]['id'],'read':![]}})[_0xc709('0x31')](function(_0x325444){return{'id':_['toInteger'](_0x2fed54['params']['id']),'count':_0x325444};})[_0xc709('0x31')](respondWithResult(_0x2ded56,null))['catch'](handleError(_0x2ded56,null));};exports[_0xc709('0x59')]=function(_0x2e41ea,_0x1e1bc7,_0x5a19a1){return db[_0xc709('0x36')][_0xc709('0x54')]({'where':{'id':_0x2e41ea[_0xc709('0x52')]['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x1e1bc7,null))[_0xc709('0x31')](function(_0x10f154){if(_0x10f154){return _0x10f154[_0xc709('0x59')](_0x2e41ea['body']['ids'],_[_0xc709('0x5a')](_0x2e41ea[_0xc709('0x5b')],[_0xc709('0x5c'),'id'])||{});}})[_0xc709('0x31')](respondWithResult(_0x1e1bc7,null))['catch'](handleError(_0x1e1bc7,null));};exports[_0xc709('0x5d')]=function(_0x881e42,_0x3ce18d,_0x3870b8){var _0x12fd0d={};var _0x2b4038={};var _0x5adb52;var _0x157fed;return db[_0xc709('0x36')]['findOne']({'where':{'id':_0x881e42['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x3ce18d,null))['then'](function(_0x179855){if(_0x179855){_0x5adb52=_0x179855;_0x2b4038[_0xc709('0x3b')]=_[_0xc709('0x3d')](db['User']['rawAttributes']);_0x2b4038['query']=_['keys'](_0x881e42[_0xc709('0x3c')]);_0x2b4038[_0xc709('0x46')]=_[_0xc709('0x3e')](_0x2b4038[_0xc709('0x3b')],_0x2b4038[_0xc709('0x3c')]);_0x12fd0d[_0xc709('0x40')]=_['intersection'](_0x2b4038[_0xc709('0x3b')],qs[_0xc709('0x3f')](_0x881e42[_0xc709('0x3c')][_0xc709('0x3f')]));_0x12fd0d['attributes']=_0x12fd0d[_0xc709('0x40')]['length']?_0x12fd0d['attributes']:_0x2b4038[_0xc709('0x3b')];_0x12fd0d['order']=qs['sort'](_0x881e42[_0xc709('0x3c')]['sort']);_0x12fd0d['where']=qs[_0xc709('0x46')](_[_0xc709('0x47')](_0x881e42[_0xc709('0x3c')],_0x2b4038[_0xc709('0x46')]));if(_0x881e42[_0xc709('0x3c')][_0xc709('0x5e')]){_0x12fd0d[_0xc709('0x48')]=_[_0xc709('0x4b')](_0x12fd0d[_0xc709('0x48')],{'$or':_[_0xc709('0x49')](_0x12fd0d[_0xc709('0x40')],function(_0x176bbb){var _0x4d73d7={};_0x4d73d7[_0x176bbb]={'$like':'%'+_0x881e42[_0xc709('0x3c')][_0xc709('0x5e')]+'%'};return _0x4d73d7;})});}_0x12fd0d=_['merge']({},_0x12fd0d,_0x881e42[_0xc709('0x4c')]);return _0x5adb52[_0xc709('0x5d')](_0x12fd0d);}})['then'](function(_0x460871){if(_0x460871){_0x157fed=_0x460871[_0xc709('0x41')];if(!_0x881e42[_0xc709('0x3c')][_0xc709('0x42')](_0xc709('0x43'))){_0x12fd0d[_0xc709('0x44')]=qs[_0xc709('0x44')](_0x881e42[_0xc709('0x3c')][_0xc709('0x44')]);_0x12fd0d[_0xc709('0x2c')]=qs[_0xc709('0x2c')](_0x881e42[_0xc709('0x3c')]['offset']);}return _0x5adb52['getMembers'](_0x12fd0d);}})[_0xc709('0x31')](function(_0x502368){if(_0x502368){return _0x502368?{'count':_0x157fed,'rows':_0x502368}:null;}})[_0xc709('0x31')](respondWithResult(_0x3ce18d,null))[_0xc709('0x28')](handleError(_0x3ce18d,null));};exports['removeMembers']=function(_0x1453a8,_0x3bec59,_0x109350){return db[_0xc709('0x36')][_0xc709('0x54')]({'where':{'id':_0x1453a8['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x3bec59,null))[_0xc709('0x31')](function(_0x25102b){if(_0x25102b){return _0x25102b['removeMembers'](_0x1453a8[_0xc709('0x3c')]['ids']);}})[_0xc709('0x31')](respondWithStatusCode(_0x3bec59,null))[_0xc709('0x28')](handleError(_0x3bec59,null));};exports['addMessage']=function(_0x2ddf54,_0x53abb9,_0x16b80f){if(_0x2ddf54['body']['id']){delete _0x2ddf54[_0xc709('0x5b')]['id'];}return db[_0xc709('0x36')][_0xc709('0x54')]({'where':{'id':_0x2ddf54['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x53abb9,null))['then'](function(_0x455724){if(_0x455724){_0x2ddf54['body'][_0xc709('0x5f')]=_0x455724['id'];return db[_0xc709('0x57')][_0xc709('0x55')](_0x2ddf54['body']);}})['then'](respondWithResult(_0x53abb9,null))[_0xc709('0x28')](handleError(_0x53abb9,null));};exports['getMessages']=function(_0x22f2b0,_0x3e930d,_0x461462){var _0x396ffa={};var _0x3caefd={};var _0x4763f9;var _0x344fbe;return db[_0xc709('0x36')][_0xc709('0x60')]({'where':{'id':_0x22f2b0['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x3e930d,null))[_0xc709('0x31')](function(_0x4e94a2){if(_0x4e94a2){_0x4763f9=_0x4e94a2;_0x3caefd[_0xc709('0x3b')]=_[_0xc709('0x3d')](db[_0xc709('0x57')][_0xc709('0x37')]);_0x3caefd[_0xc709('0x3c')]=_[_0xc709('0x3d')](_0x22f2b0[_0xc709('0x3c')]);_0x3caefd['filters']=_[_0xc709('0x3e')](_0x3caefd[_0xc709('0x3b')],_0x3caefd[_0xc709('0x3c')]);_0x396ffa[_0xc709('0x40')]=_[_0xc709('0x3e')](_0x3caefd[_0xc709('0x3b')],qs[_0xc709('0x3f')](_0x22f2b0[_0xc709('0x3c')][_0xc709('0x3f')]));_0x396ffa[_0xc709('0x40')]=_0x396ffa[_0xc709('0x40')][_0xc709('0x41')]?_0x396ffa[_0xc709('0x40')]:_0x3caefd[_0xc709('0x3b')];_0x396ffa['order']=qs[_0xc709('0x61')](_0x22f2b0[_0xc709('0x3c')][_0xc709('0x61')]);_0x396ffa[_0xc709('0x48')]=qs[_0xc709('0x46')](_[_0xc709('0x47')](_0x22f2b0['query'],_0x3caefd[_0xc709('0x46')]));if(_0x22f2b0[_0xc709('0x3c')][_0xc709('0x5e')]){_0x396ffa['where']=_['merge'](_0x396ffa[_0xc709('0x48')],{'$or':_['map'](_0x396ffa[_0xc709('0x40')],function(_0x48e992){var _0xe35953={};_0xe35953[_0x48e992]={'$like':'%'+_0x22f2b0[_0xc709('0x3c')][_0xc709('0x5e')]+'%'};return _0xe35953;})});}if(_0x22f2b0[_0xc709('0x3c')][_0xc709('0x62')]){var _0x239e66=_0x22f2b0[_0xc709('0x3c')][_0xc709('0x62')]['split'](',');var _0x4560cb={};_0x4560cb[_0x239e66[0x0]]={'$gte':moment(_0x239e66[0x1])[_0xc709('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x396ffa[_0xc709('0x48')]=_[_0xc709('0x4b')](_0x396ffa[_0xc709('0x48')],_0x4560cb);}_0x396ffa=_['merge']({},_0x396ffa,_0x22f2b0[_0xc709('0x4c')]);return _0x4763f9[_0xc709('0x64')](_0x396ffa);}})[_0xc709('0x31')](function(_0x3e6042){if(_0x3e6042){_0x344fbe=_0x3e6042['length'];if(!_0x22f2b0[_0xc709('0x3c')][_0xc709('0x42')](_0xc709('0x43'))){_0x396ffa[_0xc709('0x44')]=qs[_0xc709('0x44')](_0x22f2b0[_0xc709('0x3c')][_0xc709('0x44')]);_0x396ffa[_0xc709('0x2c')]=qs[_0xc709('0x2c')](_0x22f2b0[_0xc709('0x3c')][_0xc709('0x2c')]);}return _0x4763f9['getMessages'](_0x396ffa);}})[_0xc709('0x31')](function(_0x1e0bc4){if(_0x1e0bc4){return _0x1e0bc4?{'count':_0x344fbe,'rows':_0x1e0bc4}:null;}})[_0xc709('0x31')](respondWithResult(_0x3e930d,null))[_0xc709('0x28')](handleError(_0x3e930d,null));}; \ No newline at end of file +var _0xad03=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ChatGroup','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','findOne','User','rawAttributes','sort','getMembers','length','ids','addMessage','getMessages','$gte','split','format','eml-format','rimraf','moment','mustache','util','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','Sequelize'];(function(_0x31d06e,_0xc5dc49){var _0x39ee79=function(_0x1a432c){while(--_0x1a432c){_0x31d06e['push'](_0x31d06e['shift']());}};_0x39ee79(++_0xc5dc49);}(_0xad03,0x1ed));var _0x3ad0=function(_0x2e3b35,_0xde8054){_0x2e3b35=_0x2e3b35-0x0;var _0x268c9b=_0xad03[_0x2e3b35];return _0x268c9b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3ad0('0x0'));var rimraf=require(_0x3ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ad0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3ad0('0x3'));var util=require(_0x3ad0('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ad0('0x5'));var deskjs=require(_0x3ad0('0x6'));var toCsv=require(_0x3ad0('0x7'));var querystring=require(_0x3ad0('0x8'));var Papa=require(_0x3ad0('0x9'));var Redis=require(_0x3ad0('0xa'));var authService=require(_0x3ad0('0xb'));var qs=require(_0x3ad0('0xc'));var as=require(_0x3ad0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3ad0('0xe'));var utils=require(_0x3ad0('0xf'));var config=require(_0x3ad0('0x10'));var db=require(_0x3ad0('0x11'))['db'];config[_0x3ad0('0x12')]=_[_0x3ad0('0x13')](config[_0x3ad0('0x12')],{'host':_0x3ad0('0x14'),'port':0x18eb});var socket=require(_0x3ad0('0x15'))(new Redis(config[_0x3ad0('0x12')]));require('./chatGroup.socket')['register'](socket);var jayson=require(_0x3ad0('0x16'));var client=jayson[_0x3ad0('0x17')][_0x3ad0('0x18')]({'port':0x232a});function checkPasswordPattern(_0x45df7c,_0x53e4ab,_0x107e96){if(_0x107e96){var _0x4f41e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f41e9[_0x3ad0('0x19')](_0x53e4ab)){return _0x45df7c;}else{throw new db[(_0x3ad0('0x1a'))]['ValidationError'](_0x3ad0('0x1b'));}}else{return _0x45df7c;}}function respondWithRpcPromise(_0x417224,_0x533463,_0x3a33d4,_0x2f1fce){return new BPromise(function(_0x5a430e,_0xcb54c8){var _0x1f2272=_0x2f1fce||client;return _0x1f2272[_0x3ad0('0x1c')](_0x417224,_0x3a33d4)['then'](function(_0x58efa2){logger[_0x3ad0('0x1d')](_0x3ad0('0x1e'),_0x533463,'request\x20sent');logger[_0x3ad0('0x1f')](_0x3ad0('0x20'),_0x533463,_0x3ad0('0x21'),JSON[_0x3ad0('0x22')](_0x58efa2));if(_0x58efa2[_0x3ad0('0x23')]){if(_0x58efa2[_0x3ad0('0x23')][_0x3ad0('0x24')]===0x1f4){logger['error'](_0x3ad0('0x1e'),_0x533463,_0x58efa2[_0x3ad0('0x23')][_0x3ad0('0x25')]);return _0xcb54c8(_0x58efa2['error'][_0x3ad0('0x25')]);}logger[_0x3ad0('0x23')](_0x3ad0('0x1e'),_0x533463,_0x58efa2[_0x3ad0('0x23')][_0x3ad0('0x25')]);return _0x5a430e(_0x58efa2[_0x3ad0('0x23')]['message']);}else{logger[_0x3ad0('0x1d')](_0x3ad0('0x1e'),_0x533463,'request\x20sent');_0x5a430e(_0x58efa2[_0x3ad0('0x26')][_0x3ad0('0x25')]);}})[_0x3ad0('0x27')](function(_0xf5918){logger['error'](_0x3ad0('0x1e'),_0x533463,_0xf5918);_0xcb54c8(_0xf5918);});});}function respondWithStatusCode(_0x125c24,_0x45ca52){_0x45ca52=_0x45ca52||0xcc;return function(_0x23b9da){if(_0x23b9da){return _0x125c24[_0x3ad0('0x28')](_0x45ca52);}return _0x125c24['status'](_0x45ca52)[_0x3ad0('0x29')]();};}function respondWithResult(_0x24ac64,_0x3c0a2c){_0x3c0a2c=_0x3c0a2c||0xc8;return function(_0x32b278){if(_0x32b278){return _0x24ac64['status'](_0x3c0a2c)[_0x3ad0('0x2a')](_0x32b278);}};}function respondWithFilteredResult(_0x3e639d,_0x2f5fc8){return function(_0xd233ba){if(_0xd233ba){var _0x382293=_0xd233ba[_0x3ad0('0x2b')],_0xb1d184=_0x2f5fc8[_0x3ad0('0x2c')],_0x428b50=_0x2f5fc8[_0x3ad0('0x2c')]+_0x2f5fc8[_0x3ad0('0x2d')],_0x12495a;if(_0x428b50>=_0x382293){_0x428b50=_0x382293;_0x12495a=0xc8;}else{_0x12495a=0xce;}_0x3e639d[_0x3ad0('0x2e')](_0x12495a);return _0x3e639d[_0x3ad0('0x2f')](_0x3ad0('0x30'),_0xb1d184+'-'+_0x428b50+'/'+_0x382293)[_0x3ad0('0x2a')](_0xd233ba);}return null;};}function patchUpdates(_0x42d71f){return function(_0x10a8cf){try{jsonpatch[_0x3ad0('0x31')](_0x10a8cf,_0x42d71f,!![]);}catch(_0x3d1590){return BPromise[_0x3ad0('0x32')](_0x3d1590);}return _0x10a8cf[_0x3ad0('0x33')]();};}function saveUpdates(_0x4c518c,_0x313a50){return function(_0x52e13f){if(_0x52e13f){return _0x52e13f[_0x3ad0('0x34')](_0x4c518c)[_0x3ad0('0x35')](function(_0x1343a8){return _0x1343a8;});}return null;};}function removeEntity(_0xc4a682,_0x46b74b){return function(_0x1931cc){if(_0x1931cc){return _0x1931cc[_0x3ad0('0x36')]()[_0x3ad0('0x35')](function(){_0xc4a682[_0x3ad0('0x2e')](0xcc)[_0x3ad0('0x29')]();});}};}function handleEntityNotFound(_0x587b6b,_0x2bec14){return function(_0x1a4104){if(!_0x1a4104){_0x587b6b[_0x3ad0('0x28')](0x194);}return _0x1a4104;};}function handleError(_0x577c38,_0x3b1400){_0x3b1400=_0x3b1400||0x1f4;return function(_0xb8e95e){logger[_0x3ad0('0x23')](_0xb8e95e['stack']);if(_0xb8e95e[_0x3ad0('0x37')]){delete _0xb8e95e[_0x3ad0('0x37')];}_0x577c38[_0x3ad0('0x2e')](_0x3b1400)[_0x3ad0('0x38')](_0xb8e95e);};}exports[_0x3ad0('0x39')]=function(_0x1cd15b,_0x4dea23){var _0x409bf1={},_0x75ab22={},_0x3e5b8e={'count':0x0,'rows':[]};var _0x38b4a9=_[_0x3ad0('0x3a')](db[_0x3ad0('0x3b')]['rawAttributes'],function(_0x20ab71){return{'name':_0x20ab71[_0x3ad0('0x3c')],'type':_0x20ab71[_0x3ad0('0x3d')]['key']};});_0x75ab22[_0x3ad0('0x3e')]=_[_0x3ad0('0x3a')](_0x38b4a9,_0x3ad0('0x37'));_0x75ab22[_0x3ad0('0x3f')]=_[_0x3ad0('0x40')](_0x1cd15b[_0x3ad0('0x3f')]);_0x75ab22[_0x3ad0('0x41')]=_[_0x3ad0('0x42')](_0x75ab22[_0x3ad0('0x3e')],_0x75ab22[_0x3ad0('0x3f')]);_0x409bf1[_0x3ad0('0x43')]=_[_0x3ad0('0x42')](_0x75ab22[_0x3ad0('0x3e')],qs['fields'](_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x44')]));_0x409bf1[_0x3ad0('0x43')]=_0x409bf1[_0x3ad0('0x43')]['length']?_0x409bf1[_0x3ad0('0x43')]:_0x75ab22[_0x3ad0('0x3e')];if(!_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x45')](_0x3ad0('0x46'))){_0x409bf1[_0x3ad0('0x2d')]=qs[_0x3ad0('0x2d')](_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x2d')]);_0x409bf1[_0x3ad0('0x2c')]=qs[_0x3ad0('0x2c')](_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x2c')]);}_0x409bf1[_0x3ad0('0x47')]=qs['sort'](_0x1cd15b[_0x3ad0('0x3f')]['sort']);_0x409bf1[_0x3ad0('0x48')]=qs[_0x3ad0('0x41')](_[_0x3ad0('0x49')](_0x1cd15b[_0x3ad0('0x3f')],_0x75ab22[_0x3ad0('0x41')]),_0x38b4a9);if(_0x1cd15b['query'][_0x3ad0('0x4a')]){_0x409bf1[_0x3ad0('0x48')]=_['merge'](_0x409bf1[_0x3ad0('0x48')],{'$or':_['map'](_0x38b4a9,function(_0x212f38){if(_0x212f38[_0x3ad0('0x3d')]!=='VIRTUAL'){var _0x5a0932={};_0x5a0932[_0x212f38[_0x3ad0('0x37')]]={'$like':'%'+_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x4a')]+'%'};return _0x5a0932;}})});}_0x409bf1=_[_0x3ad0('0x4b')]({},_0x409bf1,_0x1cd15b[_0x3ad0('0x4c')]);var _0x39b17a={'where':_0x409bf1[_0x3ad0('0x48')]};return db['ChatGroup']['count'](_0x39b17a)[_0x3ad0('0x35')](function(_0x2b8725){_0x3e5b8e[_0x3ad0('0x2b')]=_0x2b8725;if(_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x4d')]){_0x409bf1[_0x3ad0('0x4e')]=[{'all':!![]}];}return db[_0x3ad0('0x3b')][_0x3ad0('0x4f')](_0x409bf1);})[_0x3ad0('0x35')](function(_0x2dbac9){_0x3e5b8e[_0x3ad0('0x50')]=_0x2dbac9;return _0x3e5b8e;})[_0x3ad0('0x35')](respondWithFilteredResult(_0x4dea23,_0x409bf1))['catch'](handleError(_0x4dea23,null));};exports['show']=function(_0x4a194d,_0x2133f2){var _0x2a756f={'raw':!![],'where':{'id':_0x4a194d['params']['id']}},_0x65b8d3={};_0x65b8d3[_0x3ad0('0x3e')]=_[_0x3ad0('0x40')](db['ChatGroup']['rawAttributes']);_0x65b8d3[_0x3ad0('0x3f')]=_[_0x3ad0('0x40')](_0x4a194d[_0x3ad0('0x3f')]);_0x65b8d3['filters']=_['intersection'](_0x65b8d3[_0x3ad0('0x3e')],_0x65b8d3[_0x3ad0('0x3f')]);_0x2a756f[_0x3ad0('0x43')]=_[_0x3ad0('0x42')](_0x65b8d3[_0x3ad0('0x3e')],qs['fields'](_0x4a194d['query'][_0x3ad0('0x44')]));_0x2a756f['attributes']=_0x2a756f['attributes']['length']?_0x2a756f['attributes']:_0x65b8d3['model'];if(_0x4a194d[_0x3ad0('0x3f')][_0x3ad0('0x4d')]){_0x2a756f[_0x3ad0('0x4e')]=[{'all':!![]}];}_0x2a756f=_[_0x3ad0('0x4b')]({},_0x2a756f,_0x4a194d[_0x3ad0('0x4c')]);return db[_0x3ad0('0x3b')][_0x3ad0('0x51')](_0x2a756f)['then'](handleEntityNotFound(_0x2133f2,null))[_0x3ad0('0x35')](respondWithResult(_0x2133f2,null))[_0x3ad0('0x27')](handleError(_0x2133f2,null));};exports[_0x3ad0('0x52')]=function(_0x23c4c0,_0x46ce44){return db[_0x3ad0('0x3b')][_0x3ad0('0x52')](_0x23c4c0['body'],{})[_0x3ad0('0x35')](respondWithResult(_0x46ce44,0xc9))['catch'](handleError(_0x46ce44,null));};exports[_0x3ad0('0x34')]=function(_0x311c78,_0x5f2318){if(_0x311c78['body']['id']){delete _0x311c78[_0x3ad0('0x53')]['id'];}return db[_0x3ad0('0x3b')][_0x3ad0('0x51')]({'where':{'id':_0x311c78[_0x3ad0('0x54')]['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x5f2318,null))[_0x3ad0('0x35')](saveUpdates(_0x311c78[_0x3ad0('0x53')],null))[_0x3ad0('0x35')](respondWithResult(_0x5f2318,null))[_0x3ad0('0x27')](handleError(_0x5f2318,null));};exports['destroy']=function(_0x5b893b,_0x3c19be){return db[_0x3ad0('0x3b')][_0x3ad0('0x51')]({'where':{'id':_0x5b893b[_0x3ad0('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c19be,null))[_0x3ad0('0x35')](removeEntity(_0x3c19be,null))['catch'](handleError(_0x3c19be,null));};exports[_0x3ad0('0x55')]=function(_0x48bb7a,_0x5aacb4){return db[_0x3ad0('0x3b')][_0x3ad0('0x55')]()['then'](respondWithResult(_0x5aacb4,null))[_0x3ad0('0x27')](handleError(_0x5aacb4,null));};exports[_0x3ad0('0x56')]=function(_0x420347,_0x14c5fc,_0x22401a){return db[_0x3ad0('0x57')]['count']({'where':{'ChatGroupId':_0x420347[_0x3ad0('0x54')]['id'],'ToId':_0x420347[_0x3ad0('0x58')]['id'],'read':![]}})[_0x3ad0('0x35')](function(_0xde8cd4){return{'id':_[_0x3ad0('0x59')](_0x420347[_0x3ad0('0x54')]['id']),'count':_0xde8cd4};})[_0x3ad0('0x35')](respondWithResult(_0x14c5fc,null))[_0x3ad0('0x27')](handleError(_0x14c5fc,null));};exports['addMembers']=function(_0x138ebd,_0x20acb4,_0x3ba751){return db[_0x3ad0('0x3b')]['find']({'where':{'id':_0x138ebd[_0x3ad0('0x54')]['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x20acb4,null))[_0x3ad0('0x35')](function(_0x2a452f){if(_0x2a452f){return _0x2a452f[_0x3ad0('0x5a')](_0x138ebd[_0x3ad0('0x53')]['ids'],_[_0x3ad0('0x5b')](_0x138ebd['body'],['ids','id'])||{});}})[_0x3ad0('0x35')](respondWithResult(_0x20acb4,null))['catch'](handleError(_0x20acb4,null));};exports['getMembers']=function(_0x26e7dd,_0x4f2e96,_0x6daa21){var _0x50c4e8={};var _0x437ddc={};var _0x4b978e;var _0x50641d;return db[_0x3ad0('0x3b')][_0x3ad0('0x5c')]({'where':{'id':_0x26e7dd[_0x3ad0('0x54')]['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x4f2e96,null))['then'](function(_0x2dc75b){if(_0x2dc75b){_0x4b978e=_0x2dc75b;_0x437ddc['model']=_[_0x3ad0('0x40')](db[_0x3ad0('0x5d')][_0x3ad0('0x5e')]);_0x437ddc[_0x3ad0('0x3f')]=_[_0x3ad0('0x40')](_0x26e7dd[_0x3ad0('0x3f')]);_0x437ddc[_0x3ad0('0x41')]=_['intersection'](_0x437ddc[_0x3ad0('0x3e')],_0x437ddc[_0x3ad0('0x3f')]);_0x50c4e8[_0x3ad0('0x43')]=_[_0x3ad0('0x42')](_0x437ddc['model'],qs[_0x3ad0('0x44')](_0x26e7dd['query'][_0x3ad0('0x44')]));_0x50c4e8[_0x3ad0('0x43')]=_0x50c4e8[_0x3ad0('0x43')]['length']?_0x50c4e8[_0x3ad0('0x43')]:_0x437ddc[_0x3ad0('0x3e')];_0x50c4e8['order']=qs[_0x3ad0('0x5f')](_0x26e7dd['query'][_0x3ad0('0x5f')]);_0x50c4e8[_0x3ad0('0x48')]=qs[_0x3ad0('0x41')](_['pick'](_0x26e7dd['query'],_0x437ddc[_0x3ad0('0x41')]));if(_0x26e7dd['query'][_0x3ad0('0x4a')]){_0x50c4e8[_0x3ad0('0x48')]=_[_0x3ad0('0x4b')](_0x50c4e8[_0x3ad0('0x48')],{'$or':_[_0x3ad0('0x3a')](_0x50c4e8[_0x3ad0('0x43')],function(_0x13be49){var _0x86892a={};_0x86892a[_0x13be49]={'$like':'%'+_0x26e7dd[_0x3ad0('0x3f')]['filter']+'%'};return _0x86892a;})});}_0x50c4e8=_[_0x3ad0('0x4b')]({},_0x50c4e8,_0x26e7dd[_0x3ad0('0x4c')]);return _0x4b978e[_0x3ad0('0x60')](_0x50c4e8);}})[_0x3ad0('0x35')](function(_0x3b8ad3){if(_0x3b8ad3){_0x50641d=_0x3b8ad3[_0x3ad0('0x61')];if(!_0x26e7dd[_0x3ad0('0x3f')][_0x3ad0('0x45')]('nolimit')){_0x50c4e8['limit']=qs[_0x3ad0('0x2d')](_0x26e7dd[_0x3ad0('0x3f')][_0x3ad0('0x2d')]);_0x50c4e8[_0x3ad0('0x2c')]=qs['offset'](_0x26e7dd[_0x3ad0('0x3f')]['offset']);}return _0x4b978e[_0x3ad0('0x60')](_0x50c4e8);}})[_0x3ad0('0x35')](function(_0x5ad692){if(_0x5ad692){return _0x5ad692?{'count':_0x50641d,'rows':_0x5ad692}:null;}})[_0x3ad0('0x35')](respondWithResult(_0x4f2e96,null))['catch'](handleError(_0x4f2e96,null));};exports['removeMembers']=function(_0x413f87,_0x28fa95,_0x48f713){return db[_0x3ad0('0x3b')][_0x3ad0('0x51')]({'where':{'id':_0x413f87[_0x3ad0('0x54')]['id']}})['then'](handleEntityNotFound(_0x28fa95,null))[_0x3ad0('0x35')](function(_0x5ce095){if(_0x5ce095){return _0x5ce095['removeMembers'](_0x413f87[_0x3ad0('0x3f')][_0x3ad0('0x62')]);}})[_0x3ad0('0x35')](respondWithStatusCode(_0x28fa95,null))[_0x3ad0('0x27')](handleError(_0x28fa95,null));};exports[_0x3ad0('0x63')]=function(_0x26ebaa,_0x31b69e,_0x106552){if(_0x26ebaa[_0x3ad0('0x53')]['id']){delete _0x26ebaa[_0x3ad0('0x53')]['id'];}return db[_0x3ad0('0x3b')]['find']({'where':{'id':_0x26ebaa['params']['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x31b69e,null))[_0x3ad0('0x35')](function(_0x5f0851){if(_0x5f0851){_0x26ebaa[_0x3ad0('0x53')]['ChatGroupId']=_0x5f0851['id'];return db['ChatInternalMessage'][_0x3ad0('0x52')](_0x26ebaa['body']);}})[_0x3ad0('0x35')](respondWithResult(_0x31b69e,null))[_0x3ad0('0x27')](handleError(_0x31b69e,null));};exports[_0x3ad0('0x64')]=function(_0x4d87d3,_0x450419,_0x467fcf){var _0x591ea7={};var _0xc70743={};var _0x58de10;var _0x1fcd95;return db[_0x3ad0('0x3b')][_0x3ad0('0x5c')]({'where':{'id':_0x4d87d3['params']['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x450419,null))[_0x3ad0('0x35')](function(_0x5992f2){if(_0x5992f2){_0x58de10=_0x5992f2;_0xc70743[_0x3ad0('0x3e')]=_[_0x3ad0('0x40')](db[_0x3ad0('0x57')][_0x3ad0('0x5e')]);_0xc70743[_0x3ad0('0x3f')]=_['keys'](_0x4d87d3[_0x3ad0('0x3f')]);_0xc70743['filters']=_[_0x3ad0('0x42')](_0xc70743[_0x3ad0('0x3e')],_0xc70743[_0x3ad0('0x3f')]);_0x591ea7[_0x3ad0('0x43')]=_['intersection'](_0xc70743['model'],qs['fields'](_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x44')]));_0x591ea7[_0x3ad0('0x43')]=_0x591ea7['attributes'][_0x3ad0('0x61')]?_0x591ea7[_0x3ad0('0x43')]:_0xc70743[_0x3ad0('0x3e')];_0x591ea7[_0x3ad0('0x47')]=qs['sort'](_0x4d87d3['query']['sort']);_0x591ea7[_0x3ad0('0x48')]=qs[_0x3ad0('0x41')](_[_0x3ad0('0x49')](_0x4d87d3[_0x3ad0('0x3f')],_0xc70743[_0x3ad0('0x41')]));if(_0x4d87d3[_0x3ad0('0x3f')]['filter']){_0x591ea7['where']=_[_0x3ad0('0x4b')](_0x591ea7[_0x3ad0('0x48')],{'$or':_[_0x3ad0('0x3a')](_0x591ea7['attributes'],function(_0x2c8c4e){var _0x485230={};_0x485230[_0x2c8c4e]={'$like':'%'+_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x4a')]+'%'};return _0x485230;})});}if(_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x65')]){var _0x758f47=_0x4d87d3[_0x3ad0('0x3f')]['$gte'][_0x3ad0('0x66')](',');var _0xc699da={};_0xc699da[_0x758f47[0x0]]={'$gte':moment(_0x758f47[0x1])[_0x3ad0('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};_0x591ea7[_0x3ad0('0x48')]=_[_0x3ad0('0x4b')](_0x591ea7[_0x3ad0('0x48')],_0xc699da);}_0x591ea7=_[_0x3ad0('0x4b')]({},_0x591ea7,_0x4d87d3['options']);return _0x58de10[_0x3ad0('0x64')](_0x591ea7);}})[_0x3ad0('0x35')](function(_0x37a856){if(_0x37a856){_0x1fcd95=_0x37a856['length'];if(!_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x45')](_0x3ad0('0x46'))){_0x591ea7[_0x3ad0('0x2d')]=qs[_0x3ad0('0x2d')](_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x2d')]);_0x591ea7['offset']=qs[_0x3ad0('0x2c')](_0x4d87d3[_0x3ad0('0x3f')]['offset']);}return _0x58de10['getMessages'](_0x591ea7);}})['then'](function(_0x1ad2a2){if(_0x1ad2a2){return _0x1ad2a2?{'count':_0x1fcd95,'rows':_0x1ad2a2}:null;}})[_0x3ad0('0x35')](respondWithResult(_0x450419,null))['catch'](handleError(_0x450419,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e9ca31e..74812fa 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0xadb5,0xad));var _0x5adb=function(_0x45f525,_0x2aa935){_0x45f525=_0x45f525-0x0;var _0x22cba7=_0xadb5[_0x45f525];return _0x22cba7;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2032,0xd9));var _0x2203=function(_0x577c32,_0x42696e){_0x577c32=_0x577c32-0x0;var _0x387013=_0x2032[_0x577c32];return _0x387013;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 32f6074..8f48005 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 _0xfd2e=['./chatGroup.attributes','chat_groups','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x58cfdf,_0x2109de){var _0x478001=function(_0x1ccb1f){while(--_0x1ccb1f){_0x58cfdf['push'](_0x58cfdf['shift']());}};_0x478001(++_0x2109de);}(_0xfd2e,0x6e));var _0xefd2=function(_0x5f1e6a,_0x46a513){_0x5f1e6a=_0x5f1e6a-0x0;var _0x2a5a41=_0xfd2e[_0x5f1e6a];return _0x2a5a41;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var logger=require(_0xefd2('0x1'))('api');var moment=require(_0xefd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xefd2('0x3'));var fs=require('fs');var path=require(_0xefd2('0x4'));var rimraf=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var attributes=require(_0xefd2('0x7'));module['exports']=function(_0x5124c6,_0x40e76c){return _0x5124c6['define']('ChatGroup',attributes,{'tableName':_0xefd2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c46=['api','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8c46,0x171));var _0x68c4=function(_0x51e5bd,_0x3c2cf1){_0x51e5bd=_0x51e5bd-0x0;var _0x250aed=_0x8c46[_0x51e5bd];return _0x250aed;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68c4('0x2'));var fs=require('fs');var path=require(_0x68c4('0x3'));var rimraf=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var attributes=require(_0x68c4('0x6'));module[_0x68c4('0x7')]=function(_0x40ce21,_0x1516cf){return _0x40ce21[_0x68c4('0x8')](_0x68c4('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 6636a3c..6adbfb4 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 _0x1ab6=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x506c08,_0x2b271f){var _0x4ea6fa=function(_0x4fb4f9){while(--_0x4fb4f9){_0x506c08['push'](_0x506c08['shift']());}};_0x4ea6fa(++_0x2b271f);}(_0x1ab6,0x76));var _0x61ab=function(_0x2ef476,_0x2089be){_0x2ef476=_0x2ef476-0x0;var _0x347e5a=_0x1ab6[_0x2ef476];return _0x347e5a;};'use strict';var _=require(_0x61ab('0x0'));var util=require(_0x61ab('0x1'));var moment=require('moment');var BPromise=require(_0x61ab('0x2'));var rs=require(_0x61ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x61ab('0x5'))('rpc');var config=require(_0x61ab('0x6'));var jayson=require(_0x61ab('0x7'));var client=jayson['client'][_0x61ab('0x8')]({'port':0x232a});config[_0x61ab('0x9')]=_[_0x61ab('0xa')](config[_0x61ab('0x9')],{'host':_0x61ab('0xb'),'port':0x18eb});var socket=require(_0x61ab('0xc'))(new Redis(config[_0x61ab('0x9')]));require('./chatGroup.socket')[_0x61ab('0xd')](socket);function respondWithRpcPromise(_0x48cb34,_0x360ab2,_0x510772){return new BPromise(function(_0x580961,_0x318ab4){return client[_0x61ab('0xe')](_0x48cb34,_0x510772)[_0x61ab('0xf')](function(_0x57e573){logger[_0x61ab('0x10')]('ChatGroup,\x20%s,\x20%s',_0x360ab2,_0x61ab('0x11'));logger['debug'](_0x61ab('0x12'),_0x360ab2,_0x61ab('0x11'),JSON[_0x61ab('0x13')](_0x57e573));if(_0x57e573[_0x61ab('0x14')]){if(_0x57e573[_0x61ab('0x14')]['code']===0x1f4){logger[_0x61ab('0x14')]('ChatGroup,\x20%s,\x20%s',_0x360ab2,_0x57e573[_0x61ab('0x14')][_0x61ab('0x15')]);return _0x318ab4(_0x57e573[_0x61ab('0x14')][_0x61ab('0x15')]);}logger['error'](_0x61ab('0x16'),_0x360ab2,_0x57e573[_0x61ab('0x14')][_0x61ab('0x15')]);return _0x580961(_0x57e573[_0x61ab('0x14')]['message']);}else{logger['info'](_0x61ab('0x16'),_0x360ab2,_0x61ab('0x11'));_0x580961(_0x57e573[_0x61ab('0x17')][_0x61ab('0x15')]);}})[_0x61ab('0x18')](function(_0x330ac8){logger[_0x61ab('0x14')](_0x61ab('0x16'),_0x360ab2,_0x330ac8);_0x318ab4(_0x330ac8);});});} \ No newline at end of file +var _0x7932=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent'];(function(_0xfb1529,_0x292479){var _0x27b42c=function(_0x59338e){while(--_0x59338e){_0xfb1529['push'](_0xfb1529['shift']());}};_0x27b42c(++_0x292479);}(_0x7932,0x170));var _0x2793=function(_0x118b5c,_0x58bfef){_0x118b5c=_0x118b5c-0x0;var _0x55d084=_0x7932[_0x118b5c];return _0x55d084;};'use strict';var _=require(_0x2793('0x0'));var util=require('util');var moment=require(_0x2793('0x1'));var BPromise=require(_0x2793('0x2'));var rs=require(_0x2793('0x3'));var fs=require('fs');var Redis=require(_0x2793('0x4'));var db=require(_0x2793('0x5'))['db'];var utils=require(_0x2793('0x6'));var logger=require(_0x2793('0x7'))(_0x2793('0x8'));var config=require(_0x2793('0x9'));var jayson=require(_0x2793('0xa'));var client=jayson[_0x2793('0xb')]['http']({'port':0x232a});config[_0x2793('0xc')]=_[_0x2793('0xd')](config[_0x2793('0xc')],{'host':_0x2793('0xe'),'port':0x18eb});var socket=require(_0x2793('0xf'))(new Redis(config[_0x2793('0xc')]));require(_0x2793('0x10'))[_0x2793('0x11')](socket);function respondWithRpcPromise(_0x3ac992,_0x1c949a,_0x5b78a2){return new BPromise(function(_0xd2f07c,_0x334ce5){return client[_0x2793('0x12')](_0x3ac992,_0x5b78a2)[_0x2793('0x13')](function(_0x50fe93){logger[_0x2793('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1c949a,_0x2793('0x15'));logger[_0x2793('0x16')](_0x2793('0x17'),_0x1c949a,'request\x20sent',JSON[_0x2793('0x18')](_0x50fe93));if(_0x50fe93[_0x2793('0x19')]){if(_0x50fe93[_0x2793('0x19')][_0x2793('0x1a')]===0x1f4){logger[_0x2793('0x19')](_0x2793('0x1b'),_0x1c949a,_0x50fe93[_0x2793('0x19')][_0x2793('0x1c')]);return _0x334ce5(_0x50fe93['error']['message']);}logger[_0x2793('0x19')](_0x2793('0x1b'),_0x1c949a,_0x50fe93[_0x2793('0x19')][_0x2793('0x1c')]);return _0xd2f07c(_0x50fe93['error'][_0x2793('0x1c')]);}else{logger[_0x2793('0x14')](_0x2793('0x1b'),_0x1c949a,_0x2793('0x15'));_0xd2f07c(_0x50fe93[_0x2793('0x1d')]['message']);}})['catch'](function(_0x1d6642){logger[_0x2793('0x19')]('ChatGroup,\x20%s,\x20%s',_0x1c949a,_0x1d6642);_0x334ce5(_0x1d6642);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index f726d0f..be40947 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 _0xbfb4=['register','length','./chatGroup.events','save','remove','removeListener'];(function(_0x336c1c,_0x3d4c73){var _0x520ffc=function(_0x50cef7){while(--_0x50cef7){_0x336c1c['push'](_0x336c1c['shift']());}};_0x520ffc(++_0x3d4c73);}(_0xbfb4,0x146));var _0x4bfb=function(_0x530937,_0x5ad1b9){_0x530937=_0x530937-0x0;var _0xdc2b2a=_0xbfb4[_0x530937];return _0xdc2b2a;};'use strict';var ChatGroupEvents=require(_0x4bfb('0x0'));var events=[_0x4bfb('0x1'),_0x4bfb('0x2'),'update'];function createListener(_0x3f3541,_0x3ddcd8){return function(_0x46ccb8){_0x3ddcd8['emit'](_0x3f3541,_0x46ccb8);};}function removeListener(_0x3ab54b,_0xf84cdc){return function(){ChatGroupEvents[_0x4bfb('0x3')](_0x3ab54b,_0xf84cdc);};}exports[_0x4bfb('0x4')]=function(_0x2bcd11){for(var _0x2dc086=0x0,_0x1510a1=events[_0x4bfb('0x5')];_0x2dc086<_0x1510a1;_0x2dc086++){var _0x54493d=events[_0x2dc086];var _0x23308d=createListener('chatGroup:'+_0x54493d,_0x2bcd11);ChatGroupEvents['on'](_0x54493d,_0x23308d);}}; \ No newline at end of file +var _0xca7c=['register','length','chatGroup:','save','emit','removeListener'];(function(_0xf3ca3f,_0x570e8d){var _0x4226cf=function(_0x208a38){while(--_0x208a38){_0xf3ca3f['push'](_0xf3ca3f['shift']());}};_0x4226cf(++_0x570e8d);}(_0xca7c,0x165));var _0xcca7=function(_0x334e26,_0x224abd){_0x334e26=_0x334e26-0x0;var _0x30518d=_0xca7c[_0x334e26];return _0x30518d;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xcca7('0x0'),'remove','update'];function createListener(_0x52c7ae,_0x49c69c){return function(_0xe49e76){_0x49c69c[_0xcca7('0x1')](_0x52c7ae,_0xe49e76);};}function removeListener(_0x22fe02,_0x4be63c){return function(){ChatGroupEvents[_0xcca7('0x2')](_0x22fe02,_0x4be63c);};}exports[_0xcca7('0x3')]=function(_0x725709){for(var _0x398ac7=0x0,_0x465836=events[_0xcca7('0x4')];_0x398ac7<_0x465836;_0x398ac7++){var _0x319bf3=events[_0x398ac7];var _0x28b237=createListener(_0xcca7('0x5')+_0x319bf3,_0x725709);ChatGroupEvents['on'](_0x319bf3,_0x28b237);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a9d7d92..fd92354 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 _0xcc32=['destroy','removeMembers','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','getMessages','post','/:id/messages','addMessage','put','update','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcc32,0x162));var _0x2cc3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcc32[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x2cc3('0x0'));var util=require(_0x2cc3('0x1'));var path=require('path');var timeout=require(_0x2cc3('0x2'));var express=require(_0x2cc3('0x3'));var router=express['Router']();var auth=require(_0x2cc3('0x4'));var interaction=require(_0x2cc3('0x5'));var config=require(_0x2cc3('0x6'));var controller=require('./chatGroup.controller');router[_0x2cc3('0x7')]('/',auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x9')]);router[_0x2cc3('0x7')](_0x2cc3('0xa'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0xb')]);router[_0x2cc3('0x7')](_0x2cc3('0xc'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0xd')]);router[_0x2cc3('0x7')]('/:id/unread',auth['isAuthenticated'](),controller[_0x2cc3('0xe')]);router['get'](_0x2cc3('0xf'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x10')]);router[_0x2cc3('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2cc3('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2cc3('0x12')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x2cc3('0x12')](_0x2cc3('0x13'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x14')]);router[_0x2cc3('0x15')](_0x2cc3('0xc'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x16')]);router[_0x2cc3('0x17')](_0x2cc3('0xc'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x18')]);router[_0x2cc3('0x17')](_0x2cc3('0xf'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x19')]);module[_0x2cc3('0x1a')]=router; \ No newline at end of file +var _0x7c77=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','/:id','delete','destroy','removeMembers'];(function(_0x3f5d8d,_0x540010){var _0x15e79a=function(_0x554e64){while(--_0x554e64){_0x3f5d8d['push'](_0x3f5d8d['shift']());}};_0x15e79a(++_0x540010);}(_0x7c77,0x16c));var _0x77c7=function(_0x5be7b1,_0x39fc47){_0x5be7b1=_0x5be7b1-0x0;var _0x1e8695=_0x7c77[_0x5be7b1];return _0x1e8695;};'use strict';var multer=require('multer');var util=require(_0x77c7('0x0'));var path=require(_0x77c7('0x1'));var timeout=require(_0x77c7('0x2'));var express=require(_0x77c7('0x3'));var router=express[_0x77c7('0x4')]();var auth=require(_0x77c7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x77c7('0x6'));var controller=require('./chatGroup.controller');router[_0x77c7('0x7')]('/',auth[_0x77c7('0x8')](),controller['index']);router[_0x77c7('0x7')](_0x77c7('0x9'),auth[_0x77c7('0x8')](),controller[_0x77c7('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x77c7('0xb')]);router[_0x77c7('0x7')](_0x77c7('0xc'),auth[_0x77c7('0x8')](),controller[_0x77c7('0xd')]);router[_0x77c7('0x7')](_0x77c7('0xe'),auth['isAuthenticated'](),controller[_0x77c7('0xf')]);router[_0x77c7('0x7')](_0x77c7('0x10'),auth[_0x77c7('0x8')](),controller[_0x77c7('0x11')]);router[_0x77c7('0x12')]('/',auth[_0x77c7('0x8')](),controller[_0x77c7('0x13')]);router[_0x77c7('0x12')](_0x77c7('0xe'),auth['isAuthenticated'](),controller[_0x77c7('0x14')]);router[_0x77c7('0x12')](_0x77c7('0x10'),auth[_0x77c7('0x8')](),controller[_0x77c7('0x15')]);router['put'](_0x77c7('0x16'),auth[_0x77c7('0x8')](),controller['update']);router[_0x77c7('0x17')](_0x77c7('0x16'),auth['isAuthenticated'](),controller[_0x77c7('0x18')]);router[_0x77c7('0x17')]('/:id/members',auth[_0x77c7('0x8')](),controller[_0x77c7('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index ac3fba6..4dc2287 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 _0x427b=['thumb','TEXT','STRING','DATE','long','exports','INTEGER','ENUM','star'];(function(_0x1b87c3,_0xe13126){var _0x59f3cc=function(_0x5a9967){while(--_0x5a9967){_0x1b87c3['push'](_0x1b87c3['shift']());}};_0x59f3cc(++_0xe13126);}(_0x427b,0xb0));var _0xb427=function(_0x39de60,_0x86aed9){_0x39de60=_0x39de60-0x0;var _0x484194=_0x427b[_0x39de60];return _0x484194;};'use strict';var Sequelize=require('sequelize');module[_0xb427('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb427('0x1')]},'ratingType':{'type':Sequelize[_0xb427('0x2')](_0xb427('0x3'),_0xb427('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xb427('0x5')]},'pathTranscript':{'type':Sequelize[_0xb427('0x5')]},'mailTranscript':{'type':Sequelize[_0xb427('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb427('0x7')]},'disposition':{'type':Sequelize[_0xb427('0x6')]},'note':{'type':Sequelize[_0xb427('0x6')]},'browserName':{'type':Sequelize[_0xb427('0x6')]},'browserVersion':{'type':Sequelize[_0xb427('0x6')]},'osName':{'type':Sequelize[_0xb427('0x6')]},'osVersion':{'type':Sequelize[_0xb427('0x6')]},'deviceModel':{'type':Sequelize[_0xb427('0x6')]},'deviceVendor':{'type':Sequelize[_0xb427('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xb427('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xb427('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xb427('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xb427('0x5')]}}; \ No newline at end of file +var _0xfebe=['TEXT','STRING','long','DATE','exports','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x5d3030,_0x43acec){var _0x26019c=function(_0x254a3d){while(--_0x254a3d){_0x5d3030['push'](_0x5d3030['shift']());}};_0x26019c(++_0x43acec);}(_0xfebe,0x1d0));var _0xefeb=function(_0x1d9dfa,_0x30598d){_0x1d9dfa=_0x1d9dfa-0x0;var _0x252661=_0xfebe[_0x1d9dfa];return _0x252661;};'use strict';var Sequelize=require('sequelize');module[_0xefeb('0x0')]={'closed':{'type':Sequelize[_0xefeb('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xefeb('0x2')]},'ratingType':{'type':Sequelize[_0xefeb('0x3')](_0xefeb('0x4'),_0xefeb('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xefeb('0x6')]},'pathTranscript':{'type':Sequelize[_0xefeb('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xefeb('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xefeb('0x7')]},'osVersion':{'type':Sequelize[_0xefeb('0x7')]},'deviceModel':{'type':Sequelize[_0xefeb('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xefeb('0x7')]},'referer':{'type':Sequelize[_0xefeb('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xefeb('0x6')](_0xefeb('0x8'))},'read1stAt':{'type':Sequelize[_0xefeb('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xefeb('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xefeb('0x7')]},'customerPort':{'type':Sequelize[_0xefeb('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xefeb('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 94bc39f..e8b778a 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 _0x5fab=['Smtp','service','host','port','secure','authentication','auth','pass','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','sort','pick','ChatInteractionId','includeAll','findAll','getMyMessages','addTags','spread','chatInteractionTags:save','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','save','update','stack','name','map','fullname','split','TagIds','catch','index','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','select','field','color','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','tag','forEach','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','order','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','push','all','rows','show','include','options','ChatInteraction','create','params','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount'];(function(_0x2c8aa9,_0x253358){var _0x5b5466=function(_0x1c3806){while(--_0x1c3806){_0x2c8aa9['push'](_0x2c8aa9['shift']());}};_0x5b5466(++_0x253358);}(_0x5fab,0x177));var _0xb5fa=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x5fab[_0x128450];return _0x4d80ed;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var db=require(_0xb5fa('0x18'))['db'];config[_0xb5fa('0x19')]=_['defaults'](config[_0xb5fa('0x19')],{'host':_0xb5fa('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0x19')]));require('./chatInteraction.socket')[_0xb5fa('0x1b')](socket);var jayson=require(_0xb5fa('0x1c'));var client=jayson[_0xb5fa('0x1d')][_0xb5fa('0x1e')]({'port':0x232b});var client9004=jayson[_0xb5fa('0x1d')]['http']({'port':0x232c});function checkPasswordPattern(_0x567f31,_0x38e964,_0x587043){if(_0x587043){var _0x31f252=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31f252[_0xb5fa('0x1f')](_0x38e964)){return _0x567f31;}else{throw new db['Sequelize']['ValidationError'](_0xb5fa('0x20'));}}else{return _0x567f31;}}function respondWithRpcPromise(_0x1f7f05,_0x32e9e5,_0x46eef0,_0x324ba5){return new BPromise(function(_0x13e82b,_0x3b0f69){var _0x21f4f4=_0x324ba5||client;return _0x21f4f4[_0xb5fa('0x21')](_0x1f7f05,_0x46eef0)[_0xb5fa('0x22')](function(_0x3c8d53){logger[_0xb5fa('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x32e9e5,_0xb5fa('0x24'));logger['debug'](_0xb5fa('0x25'),_0x32e9e5,'request\x20sent',JSON[_0xb5fa('0x26')](_0x3c8d53));if(_0x3c8d53[_0xb5fa('0x27')]){if(_0x3c8d53['error'][_0xb5fa('0x28')]===0x1f4){logger[_0xb5fa('0x27')](_0xb5fa('0x29'),_0x32e9e5,_0x3c8d53['error'][_0xb5fa('0x2a')]);return _0x3b0f69(_0x3c8d53[_0xb5fa('0x27')][_0xb5fa('0x2a')]);}logger['error'](_0xb5fa('0x29'),_0x32e9e5,_0x3c8d53['error'][_0xb5fa('0x2a')]);return _0x13e82b(_0x3c8d53[_0xb5fa('0x27')][_0xb5fa('0x2a')]);}else{logger[_0xb5fa('0x23')](_0xb5fa('0x29'),_0x32e9e5,_0xb5fa('0x24'));_0x13e82b(_0x3c8d53[_0xb5fa('0x2b')][_0xb5fa('0x2a')]);}})['catch'](function(_0x4ec294){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x32e9e5,_0x4ec294);_0x3b0f69(_0x4ec294);});});}function respondWithStatusCode(_0x28a350,_0x460b54){_0x460b54=_0x460b54||0xcc;return function(_0x12c0d4){if(_0x12c0d4){return _0x28a350[_0xb5fa('0x2c')](_0x460b54);}return _0x28a350[_0xb5fa('0x2d')](_0x460b54)[_0xb5fa('0x2e')]();};}function respondWithResult(_0x358549,_0x353314){_0x353314=_0x353314||0xc8;return function(_0x409af9){if(_0x409af9){return _0x358549[_0xb5fa('0x2d')](_0x353314)[_0xb5fa('0x2f')](_0x409af9);}};}function respondWithFilteredResult(_0x259d21,_0xab5427){return function(_0x1f4380){if(_0x1f4380){var _0xed02e=_0x1f4380[_0xb5fa('0x30')],_0x116773=_0xab5427[_0xb5fa('0x31')],_0x5a0152=_0xab5427[_0xb5fa('0x31')]+_0xab5427[_0xb5fa('0x32')],_0x3fd1fb;if(_0x5a0152>=_0xed02e){_0x5a0152=_0xed02e;_0x3fd1fb=0xc8;}else{_0x3fd1fb=0xce;}_0x259d21[_0xb5fa('0x2d')](_0x3fd1fb);return _0x259d21[_0xb5fa('0x33')]('Content-Range',_0x116773+'-'+_0x5a0152+'/'+_0xed02e)[_0xb5fa('0x2f')](_0x1f4380);}return null;};}function patchUpdates(_0x4d056c){return function(_0x5c7fdd){try{jsonpatch['apply'](_0x5c7fdd,_0x4d056c,!![]);}catch(_0x1e6ba0){return BPromise['reject'](_0x1e6ba0);}return _0x5c7fdd[_0xb5fa('0x34')]();};}function saveUpdates(_0x5876f1,_0x5518b1){return function(_0x1847bc){if(_0x1847bc){return _0x1847bc[_0xb5fa('0x35')](_0x5876f1)['then'](function(_0x59f41d){return _0x59f41d;});}return null;};}function removeEntity(_0x3d73c2,_0x9cf63d){return function(_0x252421){if(_0x252421){return _0x252421['destroy']()[_0xb5fa('0x22')](function(){_0x3d73c2[_0xb5fa('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18398f,_0x2056de){return function(_0x204d6b){if(!_0x204d6b){_0x18398f['sendStatus'](0x194);}return _0x204d6b;};}function handleError(_0x4652cd,_0x2c950e){_0x2c950e=_0x2c950e||0x1f4;return function(_0x24ef11){logger['error'](_0x24ef11[_0xb5fa('0x36')]);if(_0x24ef11[_0xb5fa('0x37')]){delete _0x24ef11[_0xb5fa('0x37')];}_0x4652cd[_0xb5fa('0x2d')](_0x2c950e)['send'](_0x24ef11);};}function getInteractionUsers(_0x4bba91,_0x4901ad){return new BPromise(function(_0x49e786,_0x5989e1){try{if(_0x4901ad[_0x4bba91['id']]){_0x4bba91['Users']=_[_0xb5fa('0x38')](_0x4901ad[_0x4bba91['id']],function(_0x4c0a4d){return{'id':_0x4c0a4d['id'],'fullname':_0x4c0a4d[_0xb5fa('0x39')]};});}}catch(_0x3ae696){_0x5989e1(_0x3ae696);}_0x49e786(_0x4bba91);});}function getInteractionTags(_0x36db1a,_0x30b288){return new BPromise(function(_0x40c1c0,_0x269d21){try{if(_0x36db1a['TagIds']){_0x36db1a['Tags']=[];_0x36db1a['TagIds'][_0xb5fa('0x3a')](',')['forEach'](function(_0x73d425){_0x36db1a['Tags']['push'](_0x30b288[_0x73d425]);});}delete _0x36db1a[_0xb5fa('0x3b')];}catch(_0x42d331){_0x269d21(_0x42d331);}_0x40c1c0(_0x36db1a);});}function updateChatInteraction(_0x2e056e,_0x36c345,_0x5bc93f){return new BPromise(function(_0x26ef1b,_0x337c53){return getInteractionUsers(_0x2e056e,_0x5bc93f)[_0xb5fa('0x22')](function(_0x19e370){return getInteractionTags(_0x19e370,_0x36c345);})[_0xb5fa('0x22')](function(_0x5acc08){_0x26ef1b(_0x5acc08);})[_0xb5fa('0x3c')](function(_0x4bc9df){_0x337c53(_0x4bc9df);});});}exports[_0xb5fa('0x3d')]=function(_0x39aac3,_0x2c7c5f){var _0x2ef359={},_0x1c706b={},_0x3954b2={'count':0x0,'rows':[]};var _0x3414b2=_[_0xb5fa('0x38')](db['ChatInteraction'][_0xb5fa('0x3e')],function(_0xc03e44){return{'name':_0xc03e44['fieldName'],'type':_0xc03e44[_0xb5fa('0x3f')]['key']};});_0x1c706b[_0xb5fa('0x40')]=_[_0xb5fa('0x38')](_0x3414b2,'name');_0x1c706b['query']=_[_0xb5fa('0x41')](_0x39aac3[_0xb5fa('0x42')]);_0x1c706b[_0xb5fa('0x43')]=_[_0xb5fa('0x44')](_0x1c706b[_0xb5fa('0x40')],_0x1c706b[_0xb5fa('0x42')]);_0x2ef359[_0xb5fa('0x45')]=_[_0xb5fa('0x44')](_0x1c706b['model'],qs[_0xb5fa('0x46')](_0x39aac3[_0xb5fa('0x42')]['fields']));_0x2ef359[_0xb5fa('0x45')]=_0x2ef359[_0xb5fa('0x45')][_0xb5fa('0x47')]?_0x2ef359[_0xb5fa('0x45')]:_0x1c706b[_0xb5fa('0x40')];if(!_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x48')](_0xb5fa('0x49'))){_0x2ef359[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x32')]);_0x2ef359[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x31')]);}_0x2ef359['order']=qs['sort'](_0x39aac3[_0xb5fa('0x42')]['sort']);_0x2ef359[_0xb5fa('0x4a')]=qs[_0xb5fa('0x43')](_['pick'](_0x39aac3[_0xb5fa('0x42')],_0x1c706b[_0xb5fa('0x43')]),_0x3414b2);var _0x18b37c=[];var _0x3159e9=squel[_0xb5fa('0x4b')]()[_0xb5fa('0x4c')]('id')['field'](_0xb5fa('0x37'))['field'](_0xb5fa('0x4d'))[_0xb5fa('0x4e')](_0xb5fa('0x4f'));var _0x51f96a=squel[_0xb5fa('0x4b')]()[_0xb5fa('0x4c')]('u.id')['field'](_0xb5fa('0x50'))[_0xb5fa('0x4c')](_0xb5fa('0x51'))[_0xb5fa('0x4e')](_0xb5fa('0x52'),'ui')[_0xb5fa('0x53')](_0xb5fa('0x54'),'u',_0xb5fa('0x55'));var _0x1c1f1b=squel[_0xb5fa('0x4b')]()[_0xb5fa('0x4e')](_0xb5fa('0x56'),'i')[_0xb5fa('0x53')](_0xb5fa('0x57'),'c',_0xb5fa('0x58'))[_0xb5fa('0x53')](_0xb5fa('0x54'),'o',_0xb5fa('0x59'))['left_join'](_0xb5fa('0x5a'),'a',_0xb5fa('0x5b'))[_0xb5fa('0x53')](_0xb5fa('0x5c'),'me',_0xb5fa('0x5d'))[_0xb5fa('0x53')](_0xb5fa('0x5e'),'it',_0xb5fa('0x5f'))[_0xb5fa('0x53')](_0xb5fa('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x5750d0=squel[_0xb5fa('0x60')]();var _0x264732=[];var _0x1e78cb=squel['expr']();var _0x441c41;if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x61')]){_0x441c41=as[_0xb5fa('0x62')](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x61')]);var _0x2e7286=_0x441c41['sqlOperator'];for(var _0x7bcd09=0x0;_0x7bcd09<_0x441c41[_0xb5fa('0x63')]['length'];_0x7bcd09++){var _0x31e602=_0x441c41[_0xb5fa('0x63')][_0x7bcd09];var _0x540295='i';var _0xd94224=_[_0xb5fa('0x64')](_0x3414b2,[_0xb5fa('0x37'),_0x31e602[_0xb5fa('0x4c')]]);if(!_0xd94224){switch(_0x31e602[_0xb5fa('0x4c')]){case _0xb5fa('0x65'):if(_0x31e602[_0xb5fa('0x66')]==0x1){_0x1c1f1b[_0xb5fa('0x67')]('`'+_0x31e602[_0xb5fa('0x4c')]+_0xb5fa('0x68'));}else{_0x1c1f1b[_0xb5fa('0x67')]('`'+_0x31e602[_0xb5fa('0x4c')]+_0xb5fa('0x69'));}break;case _0xb5fa('0x6a'):if(_0x31e602[_0xb5fa('0x6b')]===_0xb5fa('0x6c')){if(_0x31e602[_0xb5fa('0x66')][_0xb5fa('0x3a')]('\x20')[_0xb5fa('0x47')]>0x1){_0x5750d0[_0x2e7286](_0xb5fa('0x6d'),qs[_0xb5fa('0x6e')](_0x31e602[_0xb5fa('0x66')]),null);}else{var _0x488563='%'+_0x31e602[_0xb5fa('0x66')]+'%';_0x5750d0[_0x2e7286](_0xb5fa('0x6f'),_0x488563,_0x488563,_0x488563);}}else{_0xd94224=_[_0xb5fa('0x64')](_0x3414b2,['name',_0xb5fa('0x70')]);_0x31e602[_0xb5fa('0x4c')]='ContactId';_0x3e90c7=as[_0xb5fa('0x71')](_0x540295,_0xd94224[_0xb5fa('0x3f')],_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7['value']['start'],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);}break;case _0xb5fa('0x73'):var _0x57d8b7=_0x31e602[_0xb5fa('0x66')][_0xb5fa('0x3a')](',')[_0xb5fa('0x38')](function(_0x12b0a2){return Number(_0x12b0a2);});_0x57d8b7['forEach'](function(_0x55000b){_0x1e78cb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x55000b+',%');});_0x264732=_[_0xb5fa('0x74')](_0x264732,_0x57d8b7);break;case _0xb5fa('0x75'):if(_0x31e602[_0xb5fa('0x6b')]==='$substring'){_0x5750d0[_0x2e7286](_0xb5fa('0x76'),'%'+_0x31e602[_0xb5fa('0x66')]+'%',null);}else{_0xd94224=_[_0xb5fa('0x64')](_0x3414b2,[_0xb5fa('0x37'),_0xb5fa('0x77')]);_0x31e602[_0xb5fa('0x4c')]=_0xb5fa('0x77');_0x3e90c7=as[_0xb5fa('0x71')](_0x540295,_0xd94224[_0xb5fa('0x3f')],_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x78')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);}break;case _0xb5fa('0x79'):_0x3e90c7=as['buildExpression']('me',null,_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7['value'][_0xb5fa('0x78')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);break;}}else{var _0x3e90c7=as[_0xb5fa('0x71')](_0x540295,_0xd94224['type'],_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7['value'][_0xb5fa('0x78')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);}}}else{var _0x394386=_(_0x39aac3['query'])['keys']()['map'](function(_0x78a34c){return _[_0xb5fa('0x7a')](_0x3414b2,[_0xb5fa('0x37'),_0x78a34c])?_0x78a34c:undefined;})[_0xb5fa('0x7b')]()[_0xb5fa('0x66')]();if(!_[_0xb5fa('0x7c')](_0x394386)){_0x394386['forEach'](function(_0x9bf200){if(_0x9bf200==='ChatWebsiteId'){_0x1c1f1b['where'](_0xb5fa('0x7d'),[]['concat'](_0x39aac3['query'][_0x9bf200]));}else if(_0x9bf200==='createdAt'){var _0x193e63=JSON['parse'](_0x39aac3[_0xb5fa('0x42')][_0x9bf200])[_0xb5fa('0x7e')];var _0x1f05f7=JSON['parse'](_0x39aac3['query'][_0x9bf200])[_0xb5fa('0x7f')];_0x1c1f1b[_0xb5fa('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x193e63,_0x1f05f7);}else{if(_0x39aac3[_0xb5fa('0x42')][_0x9bf200]===_0xb5fa('0x80')){_0x1c1f1b[_0xb5fa('0x4a')]('i.'+_0x9bf200+_0xb5fa('0x81'));}else{_0x1c1f1b['where']('i.'+_0x9bf200+_0xb5fa('0x82'),_0x39aac3[_0xb5fa('0x42')][_0x9bf200]);}}});}if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x83')]){if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x83')]==0x1){_0x1c1f1b[_0xb5fa('0x67')]('`unreadMessages`\x20=\x200');}else{_0x1c1f1b[_0xb5fa('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')]){_0x264732=_['isArray'](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')])?_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')]:new Array(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')]);_0x264732[_0xb5fa('0x85')](function(_0x1bac54){_0x1e78cb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bac54+',%');});}if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x86')]){var _0x2c5357=_0x39aac3[_0xb5fa('0x42')]['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xb5fa('0x87')](_0x2c5357)){_0x5750d0['or'](_0xb5fa('0x88'),_0x2c5357+'%');}else{_0x5750d0['or'](_0xb5fa('0x89'),qs[_0xb5fa('0x6e')](_0x2c5357))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2c5357+'%');}}}_0x1c1f1b['where'](_0x5750d0);_0x1c1f1b[_0xb5fa('0x8a')]('i.id');var _0x32eebd={'type':db[_0xb5fa('0x8b')][_0xb5fa('0x8c')][_0xb5fa('0x8d')],'raw':!![]};var _0x577aef=_0x1c1f1b[_0xb5fa('0x8e')]();_0x577aef['field'](_0xb5fa('0x8f'));_0x577aef[_0xb5fa('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x2ef359[_0xb5fa('0x90')]){_0x2ef359[_0xb5fa('0x90')][_0xb5fa('0x85')](function(_0x1bcca7){_0x1c1f1b[_0xb5fa('0x90')]('i.'+_0x1bcca7[0x0],_0x1bcca7[0x1]===_0xb5fa('0x91')?![]:!![]);});}if(!_[_0xb5fa('0x7c')](_0x264732)){_0x1c1f1b[_0xb5fa('0x67')](_0x1e78cb);_0x577aef[_0xb5fa('0x4a')](_0xb5fa('0x92'),_0x264732);}BPromise[_0xb5fa('0x93')]()[_0xb5fa('0x22')](function(){if(!_0x441c41){if(_0x39aac3[_0xb5fa('0x42')]['ChatWebsiteId']||_0x39aac3['query'][_0xb5fa('0x94')])return;_0x577aef['where'](_0xb5fa('0x95'));_0x1c1f1b[_0xb5fa('0x4a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x39aac3[_0xb5fa('0x96')][_0xb5fa('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x45afeb){if(_[_0xb5fa('0x7c')](_0x45afeb)){_0x577aef['where'](_0xb5fa('0x98'));_0x1c1f1b[_0xb5fa('0x4a')](_0xb5fa('0x98'));}else{_0x577aef['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xb5fa('0x38')](_0x45afeb,'id'));_0x1c1f1b[_0xb5fa('0x4a')](_0xb5fa('0x7d'),_[_0xb5fa('0x38')](_0x45afeb,'id'));}});})[_0xb5fa('0x22')](function(){db[_0xb5fa('0x99')][_0xb5fa('0x42')](_0x577aef[_0xb5fa('0x9a')](),_0x32eebd)[_0xb5fa('0x22')](function(_0x1a4465){_0x3954b2['count']=_0x1a4465['length'];if(_0x3954b2[_0xb5fa('0x30')]===0x0)return[];return db[_0xb5fa('0x99')][_0xb5fa('0x42')](_0x3159e9[_0xb5fa('0x9a')](),_0x32eebd)['then'](function(_0x2c93c7){_0x18b37c=_[_0xb5fa('0x9b')](_0x2c93c7,'id');_0x32eebd=_[_0xb5fa('0x9c')](_0x32eebd,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x46')]){_0x2ef359[_0xb5fa('0x45')][_0xb5fa('0x85')](function(_0x5ba2e7){_0x1c1f1b[_0xb5fa('0x4c')]('i.'+_0x5ba2e7);});}else{_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0x9d'),_0xb5fa('0x65'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0x9e'),_0xb5fa('0x9f'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa0'),_0xb5fa('0xa1'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa2'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa3'),_0xb5fa('0xa4'));_0x1c1f1b['field'](_0xb5fa('0xa5'),_0xb5fa('0xa6'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa7'),_0xb5fa('0xa8'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa9'),_0xb5fa('0xaa'));_0x1c1f1b['field']('c.mobile',_0xb5fa('0xab'));_0x1c1f1b['field']('c.fax',_0xb5fa('0xac'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xad'),'Owner.fullname');_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xae'),_0xb5fa('0xaf'));_0x1c1f1b['field'](_0xb5fa('0xb0'),_0xb5fa('0x3b'));}if(_0x2ef359['limit'])_0x1c1f1b[_0xb5fa('0x32')](_0x2ef359[_0xb5fa('0x32')]);if(_0x2ef359[_0xb5fa('0x31')])_0x1c1f1b[_0xb5fa('0x31')](_0x2ef359[_0xb5fa('0x31')]);return db[_0xb5fa('0x99')][_0xb5fa('0x42')](_0x1c1f1b['toString'](),_0x32eebd);})[_0xb5fa('0x22')](function(_0xafde6d){_0x51f96a[_0xb5fa('0x4a')](_0xb5fa('0xb1'),_['map'](_0xafde6d,'id'));return db['sequelize'][_0xb5fa('0x42')](_0x51f96a[_0xb5fa('0x9a')](),_0x32eebd)[_0xb5fa('0x22')](function(_0x1a889a){var _0x4eb5a0=_['groupBy'](_0x1a889a,'ChatInteractionId');var _0x537a51=[];_0xafde6d[_0xb5fa('0x85')](function(_0x46a651){_0x537a51[_0xb5fa('0xb2')](updateChatInteraction(_0x46a651,_0x18b37c,_0x4eb5a0));});return BPromise[_0xb5fa('0xb3')](_0x537a51);});});})[_0xb5fa('0x22')](function(_0x1a19ec){_0x3954b2[_0xb5fa('0xb4')]=_0x1a19ec;return _0x3954b2;})[_0xb5fa('0x22')](respondWithFilteredResult(_0x2c7c5f,_0x2ef359));})[_0xb5fa('0x3c')](handleError(_0x2c7c5f,null));};exports[_0xb5fa('0xb5')]=function(_0x4581ed,_0x5ce5d7){var _0x427d61={'raw':![],'where':{'id':_0x4581ed['params']['id']}},_0x2a6f66={};_0x2a6f66[_0xb5fa('0x40')]=_[_0xb5fa('0x41')](db['ChatInteraction'][_0xb5fa('0x3e')]);_0x2a6f66[_0xb5fa('0x42')]=_[_0xb5fa('0x41')](_0x4581ed[_0xb5fa('0x42')]);_0x2a6f66[_0xb5fa('0x43')]=_[_0xb5fa('0x44')](_0x2a6f66[_0xb5fa('0x40')],_0x2a6f66[_0xb5fa('0x42')]);_0x427d61[_0xb5fa('0x45')]=_['intersection'](_0x2a6f66[_0xb5fa('0x40')],qs[_0xb5fa('0x46')](_0x4581ed[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x427d61[_0xb5fa('0x45')]=_0x427d61[_0xb5fa('0x45')][_0xb5fa('0x47')]?_0x427d61[_0xb5fa('0x45')]:_0x2a6f66['model'];if(_0x4581ed[_0xb5fa('0x42')]['includeAll']){_0x427d61[_0xb5fa('0xb6')]=[{'all':!![]}];}_0x427d61=_[_0xb5fa('0x9c')]({},_0x427d61,_0x4581ed[_0xb5fa('0xb7')]);return db[_0xb5fa('0xb8')][_0xb5fa('0x64')](_0x427d61)[_0xb5fa('0x22')](handleEntityNotFound(_0x5ce5d7,null))[_0xb5fa('0x22')](respondWithResult(_0x5ce5d7,null))[_0xb5fa('0x3c')](handleError(_0x5ce5d7,null));};exports[_0xb5fa('0xb9')]=function(_0x4bb9b4,_0x49b530){return db[_0xb5fa('0xb8')][_0xb5fa('0xb9')](_0x4bb9b4[_0xb5fa('0x79')],{})[_0xb5fa('0x22')](respondWithResult(_0x49b530,0xc9))['catch'](handleError(_0x49b530,null));};exports[_0xb5fa('0x35')]=function(_0x5d1897,_0x392359){if(_0x5d1897[_0xb5fa('0x79')]['id']){delete _0x5d1897['body']['id'];}return db[_0xb5fa('0xb8')]['find']({'where':{'id':_0x5d1897[_0xb5fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x392359,null))[_0xb5fa('0x22')](saveUpdates(_0x5d1897[_0xb5fa('0x79')],null))[_0xb5fa('0x22')](respondWithResult(_0x392359,null))[_0xb5fa('0x3c')](handleError(_0x392359,null));};exports[_0xb5fa('0xbb')]=function(_0x1cdb82,_0x3833cc){return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x1cdb82[_0xb5fa('0xba')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x3833cc,null))['then'](removeEntity(_0x3833cc,null))[_0xb5fa('0x3c')](handleError(_0x3833cc,null));};exports[_0xb5fa('0xbc')]=function(_0x384c8e,_0x497931){return db[_0xb5fa('0xb8')][_0xb5fa('0xbc')]()[_0xb5fa('0x22')](respondWithResult(_0x497931,null))[_0xb5fa('0x3c')](handleError(_0x497931,null));};exports[_0xb5fa('0xbd')]=function(_0xa68be5,_0x22ce9f){var _0x3c5115=_0xa68be5['params']['id'];var _0x245ee1;var _0x5c1e1f;var _0x3ba723;return db[_0xb5fa('0xb8')][_0xb5fa('0xbe')]({'where':{'id':_0x3c5115}})[_0xb5fa('0x22')](function(_0x2be44e){_0x245ee1=_0x2be44e;return db[_0xb5fa('0xbf')][_0xb5fa('0xbe')]({'where':{'id':_0x2be44e[_0xb5fa('0xc0')]},'attributes':['id',_0xb5fa('0xc1'),_0xb5fa('0xc2')],'raw':!![]});})[_0xb5fa('0x22')](function(_0x46f1d3){if(_0x46f1d3&&_0x46f1d3[_0xb5fa('0xc1')]&&_0x46f1d3[_0xb5fa('0xc2')]){_0x5c1e1f=_0x46f1d3;var _0x46af2f={'rejectUnauthorized':![],'method':_0xb5fa('0xc3'),'uri':_0xb5fa('0xc4'),'headers':{'X-APIKEY':_0x46f1d3['vidaooApiKey']},'body':{'name':_0xb5fa('0xc5')+_0x3c5115},'redirect':_0xb5fa('0xc6'),'json':!![]};return rp(_0x46af2f);}else{throw new db['Sequelize'][(_0xb5fa('0xc7'))](_0xb5fa('0xc8'));}})['then'](function(_0x4fefa0){_0x3ba723=_0x4fefa0;if(_0x3ba723['id']){var _0x486f43={'body':_0x3ba723[_0xb5fa('0xc9')],'ChatWebsiteId':_0x5c1e1f['id'],'ChatInteractionId':_0x245ee1['id'],'direction':_0xb5fa('0xca'),'UserId':_0xa68be5[_0xb5fa('0x96')]['id']};return db[_0xb5fa('0xcb')][_0xb5fa('0xb9')](_0x486f43,{});}else{throw new db[(_0xb5fa('0x8b'))][(_0xb5fa('0xc7'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x245ee1['updateAttributes']({'vidaooSessionId':_0x3ba723['id']});})[_0xb5fa('0x22')](respondWithResult(_0x22ce9f,null))['catch'](handleError(_0x22ce9f,null));};exports['customUpdate']=function(_0x2c7076,_0x5ab2ba){if(_0x2c7076[_0xb5fa('0x79')]['id']){delete _0x2c7076[_0xb5fa('0x79')]['id'];}return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x2c7076[_0xb5fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x5ab2ba,null))[_0xb5fa('0x22')](saveUpdates(_0x2c7076[_0xb5fa('0x79')],null))[_0xb5fa('0x22')](respondWithResult(_0x5ab2ba,null))[_0xb5fa('0x3c')](handleError(_0x5ab2ba,null));};exports[_0xb5fa('0xcc')]=function(_0x488818,_0x15b228,_0x42fd84){if(_0x488818[_0xb5fa('0x79')]['id']){delete _0x488818[_0xb5fa('0x79')]['id'];}return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x488818['params']['id']}})[_0xb5fa('0x22')](function(_0x390043){if(!_0x390043){logger[_0xb5fa('0x27')](_0xb5fa('0xcd'),_0xb5fa('0xcc'),0x194,_0xb5fa('0xce'));_0x15b228[_0xb5fa('0x2c')](0x194);}else{if(_0x390043[_0xb5fa('0x77')]){throw new db[(_0xb5fa('0x8b'))][(_0xb5fa('0xc7'))](_0xb5fa('0xcf'));}}return _0x390043;})[_0xb5fa('0x22')](function(_0x1d307c){if(_0x1d307c){return _0x1d307c[_0xb5fa('0x35')]({'closed':_0x488818[_0xb5fa('0x79')][_0xb5fa('0xd0')],'disposition':_0x488818[_0xb5fa('0x79')][_0xb5fa('0xd1')]})[_0xb5fa('0x22')](function(_0x2b1c3f){return _0x2b1c3f;});}})[_0xb5fa('0x22')](function(_0x40d8e0){return respondWithRpcPromise('AbandonInteraction','abandon',_0x488818[_0xb5fa('0x79')],client9004);})[_0xb5fa('0x22')](respondWithResult(_0x15b228,null))[_0xb5fa('0x3c')](handleError(_0x15b228,null));};exports[_0xb5fa('0xd2')]=function(_0x160e9a,_0x813966,_0x549579){_0x160e9a['body']['name']=_0x160e9a[_0xb5fa('0xd3')][_0xb5fa('0xd4')];_0x160e9a['body'][_0xb5fa('0xd5')]=_0x160e9a[_0xb5fa('0xd3')]['filename'];_0x160e9a[_0xb5fa('0x79')][_0xb5fa('0x3f')]=_0x160e9a[_0xb5fa('0xd3')][_0xb5fa('0xd6')];return db[_0xb5fa('0xd7')][_0xb5fa('0xb9')](_0x160e9a[_0xb5fa('0x79')])[_0xb5fa('0x22')](respondWithResult(_0x813966,0xc9))['catch'](handleError(_0x813966,null));};exports[_0xb5fa('0xd8')]=function(_0x564c7c,_0xfb95c,_0x5bfb10){return db[_0xb5fa('0xb8')][_0xb5fa('0xbe')]({'where':{'id':_0x564c7c['params']['id']},'raw':!![]})[_0xb5fa('0x22')](handleEntityNotFound(_0xfb95c,null))[_0xb5fa('0x22')](function(_0x3a7f29){if(_0x3a7f29){if(_0x3a7f29[_0xb5fa('0xd0')]){return _0xfb95c['status'](0x193)[_0xb5fa('0x2f')]({'status':0x193,'message':_0xb5fa('0xd9')});}return db[_0xb5fa('0xd7')][_0xb5fa('0xbe')]({'where':{'id':_0x564c7c[_0xb5fa('0x42')][_0xb5fa('0xda')]},'raw':!![]})[_0xb5fa('0x22')](handleEntityNotFound(_0xfb95c,null));}})['then'](function(_0x87f3){if(_0x87f3){return _0xfb95c['download'](path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],_0xb5fa('0xdd'),_0x87f3[_0xb5fa('0xd5')]));}})[_0xb5fa('0x3c')](handleError(_0xfb95c,null));};exports[_0xb5fa('0xde')]=function(_0x34a13e,_0x591df9){var _0x496a26=null;var _0x331ff8=null;var _0x3d9563=null;var _0x419034=null;if(_0x34a13e[_0xb5fa('0x79')]['id']){delete _0x34a13e[_0xb5fa('0x79')]['id'];}if(_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xdf')]){_0x419034=path[_0xb5fa('0xdb')](config['root'],_0xb5fa('0xe0'),util[_0xb5fa('0xe1')](_0xb5fa('0xe2'),Date[_0xb5fa('0xe3')]()));_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xe4')]=_0x419034;}return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x34a13e[_0xb5fa('0xba')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xb5fa('0xe5'),'include':[{'model':db['User'],'as':_0xb5fa('0x75')}]}]})[_0xb5fa('0x22')](handleEntityNotFound(_0x591df9,null))[_0xb5fa('0x22')](saveUpdates(_0x34a13e[_0xb5fa('0x79')],null))[_0xb5fa('0x22')](function(_0x3327bd){if(_0x3327bd){_0x496a26=_0x3327bd;return db['ChatWebsite'][_0xb5fa('0x64')]({'where':{'id':_0x496a26[_0xb5fa('0xc0')]}});}})[_0xb5fa('0x22')](function(_0x327f35){if(_0x327f35){_0x3d9563=_0x327f35;return db[_0xb5fa('0xe6')][_0xb5fa('0x64')]({'where':{'id':_0x496a26[_0xb5fa('0x70')]}});}})['then'](function(_0x5d0e21){if(_0x5d0e21){_0x331ff8=_0x5d0e21;if(_0x419034){var _0x405677=null;for(var _0x3a8dad=0x1;_0x3a8dad<_0x496a26[_0xb5fa('0xe5')][_0xb5fa('0x47')];++_0x3a8dad){_0x405677=_0x496a26[_0xb5fa('0xe5')][_0x3a8dad];var _0x38f750=_0x405677[_0xb5fa('0x77')]?util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0x3d9563[_0xb5fa('0xe8')],_0x405677['UserId']):_0xb5fa('0xe9');var _0x2dec50=_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xea')]||util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0xb5fa('0xeb'),_0x405677[_0xb5fa('0x70')]);switch(_0x3d9563[_0xb5fa('0xec')]){case _0xb5fa('0xed'):_0x38f750=_0x405677[_0xb5fa('0x77')]?util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0x3d9563[_0xb5fa('0xe8')],_0x405677['UserId']):'System';break;case _0xb5fa('0xee'):_0x38f750=_0x405677[_0xb5fa('0x77')]?_0x405677['User'][_0xb5fa('0xef')]||_0x405677[_0xb5fa('0x75')][_0xb5fa('0x39')]:'System';break;case _0xb5fa('0xf0'):_0x38f750=_0x405677[_0xb5fa('0x77')]?_0x405677[_0xb5fa('0x75')][_0xb5fa('0x39')]:_0xb5fa('0xe9');break;default:_0x38f750=_0x405677[_0xb5fa('0x77')]?util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0x3d9563['agentAlias'],_0x405677[_0xb5fa('0x77')]):_0xb5fa('0xe9');}var _0x4da81b=util[_0xb5fa('0xe1')](_0xb5fa('0xf1'),moment(_0x405677['createdAt'])[_0xb5fa('0xe1')](_0xb5fa('0xf2')),_0x405677[_0xb5fa('0xf3')]==='in'?_0x2dec50:_0x38f750,_0x405677[_0xb5fa('0x79')]);if(!_0x405677[_0xb5fa('0xf4')]){fs[_0xb5fa('0xf5')](_0x419034,_0x4da81b);}}return db[_0xb5fa('0xf6')][_0xb5fa('0xbe')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb5fa('0xf7'),'raw':!![]}]});}}})[_0xb5fa('0x22')](function(_0x2d49e4){if(_0x2d49e4&&_0x2d49e4[_0xb5fa('0xf7')]&&_0x34a13e[_0xb5fa('0x79')]){var _0x486620={'tls':{'rejectUnauthorized':![]}};if(_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xf8')]){_0x486620[_0xb5fa('0xf8')]=_0x2d49e4['Smtp'][_0xb5fa('0xf8')];}else{_0x486620[_0xb5fa('0xf9')]=_0x2d49e4[_0xb5fa('0xf7')]['host'];_0x486620[_0xb5fa('0xfa')]=_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfa')];_0x486620[_0xb5fa('0xfb')]=_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfb')];}if(_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfc')]){_0x486620[_0xb5fa('0xfd')]={'user':_0x2d49e4['Smtp'][_0xb5fa('0x96')],'pass':_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfe')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x486620,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2d49e4['name'],_0x2d49e4[_0xb5fa('0xff')]||_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0x96')]),'to':_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xdf')],'subject':_0xb5fa('0x100'),'text':util[_0xb5fa('0xe1')](_0xb5fa('0x101'),_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xdf')]),'attachments':[{'path':_0x419034}]}})['then'](function(){return _0x496a26;})['catch'](function(_0x41c680){console[_0xb5fa('0x27')](_0x41c680);});}else{return _0x496a26;}})[_0xb5fa('0x22')](respondWithStatusCode(_0x591df9,0xc8))['catch'](handleError(_0x591df9,null));};exports['addMessage']=function(_0x3d0a9d,_0x33f6f5,_0x326014){return db[_0xb5fa('0xcb')][_0xb5fa('0x64')]({'where':{'id':_0x3d0a9d[_0xb5fa('0xba')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x33f6f5,null))[_0xb5fa('0x22')](function(_0x286862){if(_0x286862){return _0x286862['addMessage'](_0x3d0a9d[_0xb5fa('0x79')][_0xb5fa('0x102')],_[_0xb5fa('0x103')](_0x3d0a9d[_0xb5fa('0x79')],[_0xb5fa('0x102'),'id'])||{});}})[_0xb5fa('0x22')](respondWithResult(_0x33f6f5,null))[_0xb5fa('0x3c')](handleError(_0x33f6f5,null));};exports[_0xb5fa('0x104')]=function(_0x52481f,_0x187456,_0x1845f3){var _0x55da0a={'raw':![],'where':{}};var _0x510ce8={};var _0x2a87ec={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb5fa('0xbe')]({'where':{'id':_0x52481f[_0xb5fa('0xba')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x187456,null))[_0xb5fa('0x22')](function(_0xa7da23){if(_0xa7da23){_0x510ce8[_0xb5fa('0x40')]=_[_0xb5fa('0x41')](db[_0xb5fa('0xcb')]['rawAttributes']);_0x510ce8[_0xb5fa('0x42')]=_[_0xb5fa('0x41')](_0x52481f[_0xb5fa('0x42')]);_0x510ce8[_0xb5fa('0x43')]=_['intersection'](_0x510ce8[_0xb5fa('0x40')],_0x510ce8[_0xb5fa('0x42')]);_0x55da0a['attributes']=_[_0xb5fa('0x44')](_0x510ce8[_0xb5fa('0x40')],qs['fields'](_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x55da0a['attributes']=_0x55da0a[_0xb5fa('0x45')]['length']?_0x55da0a['attributes']:_0x510ce8[_0xb5fa('0x40')];if(!_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x48')](_0xb5fa('0x49'))){_0x55da0a[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x52481f[_0xb5fa('0x42')]['limit']);_0x55da0a[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x52481f['query']['offset']);}_0x55da0a[_0xb5fa('0x90')]=qs[_0xb5fa('0x105')](_0x52481f[_0xb5fa('0x42')]['sort']);_0x55da0a[_0xb5fa('0x4a')]=qs['filters'](_[_0xb5fa('0x106')](_0x52481f['query'],_0x510ce8[_0xb5fa('0x43')]));_0x55da0a[_0xb5fa('0x4a')][_0xb5fa('0x107')]=_0xa7da23['id'];if(_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x86')]){_0x55da0a[_0xb5fa('0x4a')]=_[_0xb5fa('0x9c')](_0x55da0a['where'],{'$or':_[_0xb5fa('0x38')](_0x55da0a[_0xb5fa('0x45')],function(_0x55a03d){var _0x39d8f3={};_0x39d8f3[_0x55a03d]={'$like':'%'+_0x52481f['query'][_0xb5fa('0x86')]+'%'};return _0x39d8f3;})});}if(_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x7e')]){var _0x165b0a=_0x52481f['query'][_0xb5fa('0x7e')]['split'](',');var _0xc6b700={};_0xc6b700[_0x165b0a[0x0]]={'$gte':moment(_0x165b0a[0x1])[_0xb5fa('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x55da0a[_0xb5fa('0x4a')]=_[_0xb5fa('0x9c')](_0x55da0a[_0xb5fa('0x4a')],_0xc6b700);}_0x55da0a=_[_0xb5fa('0x9c')]({},_0x55da0a,_0x52481f[_0xb5fa('0xb7')]);return db['ChatMessage'][_0xb5fa('0x30')]({'where':_0x55da0a['where']})[_0xb5fa('0x22')](function(_0x1789d1){_0x2a87ec['count']=_0x1789d1;if(_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x108')]){_0x55da0a['include']=[{'all':!![]}];}return db['ChatMessage'][_0xb5fa('0x109')](_0x55da0a);})[_0xb5fa('0x22')](function(_0x2ef70d){_0x2a87ec[_0xb5fa('0xb4')]=_0x2ef70d;return _0x2a87ec;});}})[_0xb5fa('0x22')](respondWithFilteredResult(_0x187456,_0x55da0a))[_0xb5fa('0x3c')](handleError(_0x187456,null));};exports[_0xb5fa('0x10a')]=function(_0x1f0cec,_0x5dbfd7,_0x2eff56){var _0x4d65e2={'where':{}},_0x51f050={},_0x4a2254={'count':0x0,'rows':[]};return db[_0xb5fa('0xb8')][_0xb5fa('0xbe')]({'where':{'id':_0x1f0cec['params']['id']}})['then'](handleEntityNotFound(_0x5dbfd7,null))['then'](function(_0x5ae447){if(_0x5ae447){_0x51f050[_0xb5fa('0x40')]=_['keys'](db[_0xb5fa('0xcb')][_0xb5fa('0x3e')]);_0x51f050[_0xb5fa('0x42')]=_['keys'](_0x1f0cec[_0xb5fa('0x42')]);_0x51f050[_0xb5fa('0x43')]=_['intersection'](_0x51f050[_0xb5fa('0x40')],_0x51f050[_0xb5fa('0x42')]);_0x4d65e2['attributes']=_['intersection'](_0x51f050['model'],qs[_0xb5fa('0x46')](_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x4d65e2['attributes']=_0x4d65e2[_0xb5fa('0x45')][_0xb5fa('0x47')]?_0x4d65e2[_0xb5fa('0x45')]:_0x51f050[_0xb5fa('0x40')];if(!_0x1f0cec[_0xb5fa('0x42')]['hasOwnProperty'](_0xb5fa('0x49'))){_0x4d65e2['limit']=qs[_0xb5fa('0x32')](_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x32')]);_0x4d65e2[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x31')]);}_0x4d65e2[_0xb5fa('0x90')]=qs[_0xb5fa('0x105')](_0x1f0cec['query']['sort']);_0x4d65e2[_0xb5fa('0x4a')]=qs[_0xb5fa('0x43')](_['pick'](_0x1f0cec[_0xb5fa('0x42')],_0x51f050[_0xb5fa('0x43')]));_0x4d65e2['where'][_0xb5fa('0x107')]=_0x5ae447['id'];if(_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x86')]){_0x4d65e2['where']=_[_0xb5fa('0x9c')](_0x4d65e2[_0xb5fa('0x4a')],{'$or':_[_0xb5fa('0x38')](_0x4d65e2[_0xb5fa('0x45')],function(_0x268913){var _0x53e713={};_0x53e713[_0x268913]={'$like':'%'+_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x86')]+'%'};return _0x53e713;})});}_0x4d65e2[_0xb5fa('0x4a')][_0xb5fa('0xf4')]=![];if(_0x1f0cec[_0xb5fa('0x42')]['id']){_0x4d65e2['where']['id']={'$gt':_0x1f0cec['query']['id']};}_0x4d65e2=_[_0xb5fa('0x9c')]({},_0x4d65e2,_0x1f0cec[_0xb5fa('0xb7')]);return db[_0xb5fa('0xcb')][_0xb5fa('0x30')]({'where':_0x4d65e2[_0xb5fa('0x4a')]})['then'](function(_0x5adaa2){_0x4a2254['count']=_0x5adaa2;_0x4d65e2[_0xb5fa('0xb6')]=[];if(_0x1f0cec[_0xb5fa('0x42')]['includeAgent']){_0x4d65e2[_0xb5fa('0xb6')][_0xb5fa('0xb2')]({'model':db[_0xb5fa('0x75')],'as':_0xb5fa('0x75'),'attributes':['id',_0xb5fa('0x39'),'alias']});}if(_0x1f0cec[_0xb5fa('0x42')]['includeAll']){_0x4d65e2[_0xb5fa('0xb6')]=[{'all':!![]}];}return db[_0xb5fa('0xcb')][_0xb5fa('0x109')](_0x4d65e2);})[_0xb5fa('0x22')](function(_0x1db92b){_0x4a2254[_0xb5fa('0xb4')]=_0x1db92b;return _0x4a2254;});}})[_0xb5fa('0x22')](respondWithFilteredResult(_0x5dbfd7,_0x4d65e2))[_0xb5fa('0x3c')](handleError(_0x5dbfd7,null));};exports[_0xb5fa('0x10b')]=function(_0x497465,_0x268f7e,_0x7a3bd4){return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x497465['params']['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x268f7e,null))[_0xb5fa('0x22')](function(_0x48ca4b){if(_0x48ca4b){return _0x48ca4b['setTags'](_0x497465[_0xb5fa('0x79')][_0xb5fa('0x102')],_['omit'](_0x497465['body'],[_0xb5fa('0x102'),'id'])||{})[_0xb5fa('0x10c')](function(){return db[_0xb5fa('0x73')][_0xb5fa('0x109')]({'attributes':['id',_0xb5fa('0x37'),'color'],'where':{'id':_0x497465['body'][_0xb5fa('0x102')]}});})['then'](function(_0x2593ba){socket['emit'](_0xb5fa('0x10d'),{'id':Number(_0x497465[_0xb5fa('0xba')]['id']),'tags':_0x2593ba||[]});return{'id':Number(_0x497465['params']['id']),'tags':_0x2593ba||[]};});}})['then'](respondWithResult(_0x268f7e,null))[_0xb5fa('0x3c')](handleError(_0x268f7e,null));};exports['removeTags']=function(_0x2429ef,_0x315488,_0x49f3a0){return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x2429ef[_0xb5fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x315488,null))[_0xb5fa('0x22')](function(_0x1c77f7){if(_0x1c77f7){return _0x1c77f7['removeTags'](_0x2429ef[_0xb5fa('0x42')][_0xb5fa('0x102')]);}})[_0xb5fa('0x22')](respondWithStatusCode(_0x315488,null))[_0xb5fa('0x3c')](handleError(_0x315488,null));};exports[_0xb5fa('0x10e')]=function(_0x117bd1,_0x41f06c){var _0x1f164f=moment()[_0xb5fa('0x10f')]()[_0xb5fa('0x9a')]();var _0x2dd8fe=path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],_0xb5fa('0x110'),_0xb5fa('0x111'),_0xb5fa('0x112'));var _0x449807=path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],_0xb5fa('0x110'),_0xb5fa('0x111'),_0xb5fa('0x113'));var _0x3e1d20=path[_0xb5fa('0xdb')](_0x2dd8fe,_0x1f164f);var _0x58907b=util[_0xb5fa('0xe1')](_0xb5fa('0x114'),_0x117bd1[_0xb5fa('0xba')]['id'],_0x1f164f);var _0x74e62a=path[_0xb5fa('0xdb')](_0x2dd8fe,_0x58907b);var _0x31646a=[];_0x31646a['push']({'model':db[_0xb5fa('0x75')],'as':_0xb5fa('0x75'),'attributes':['id',_0xb5fa('0x39')],'raw':!![]});_0x31646a[_0xb5fa('0xb2')]({'model':db[_0xb5fa('0xe6')],'as':_0xb5fa('0x6a'),'attributes':['id',_0xb5fa('0x115'),_0xb5fa('0x116')],'raw':!![]});if(_0x117bd1[_0xb5fa('0x42')][_0xb5fa('0x113')]){_0x31646a[_0xb5fa('0xb2')]({'model':db['Attachment'],'as':_0xb5fa('0xd7'),'raw':!![]});}var _0x1f90aa=[{'model':db[_0xb5fa('0xcb')],'as':_0xb5fa('0xe5'),'attributes':['id','body',_0xb5fa('0x117'),'direction',_0xb5fa('0xf4'),'read'],'include':_0x31646a}];_0x1f90aa['push']({'model':db[_0xb5fa('0xbf')],'as':_0xb5fa('0x118'),'attributes':['id',_0xb5fa('0x37')]});_0x1f90aa[_0xb5fa('0xb2')]({'model':db[_0xb5fa('0x75')],'as':_0xb5fa('0x119'),'attributes':['id',_0xb5fa('0x39')]});return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x117bd1[_0xb5fa('0xba')]['id']},'include':_0x1f90aa})['then'](handleEntityNotFound(_0x41f06c,null))[_0xb5fa('0x22')](function(_0x492dfe){if(_0x492dfe){var _0x37132c=_0x492dfe[_0xb5fa('0x11a')]({'plain':!![]});fs[_0xb5fa('0x11b')](_0x3e1d20);var _0x324e9c={'format':'A4','border':_0xb5fa('0x11c'),'header':{'height':_0xb5fa('0x11d'),'contents':{'first':_0xb5fa('0x11e')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xb5fa('0x11f'),util[_0xb5fa('0xe1')](_0xb5fa('0x120'),_0xb5fa('0x121'),_0x37132c['id']),moment()[_0xb5fa('0xe1')](_0xb5fa('0x122'))['toString']())}}};var _0x42195b={'channel':_0xb5fa('0x121'),'account':_0x37132c[_0xb5fa('0x118')][_0xb5fa('0x37')],'agent':_0x37132c['Owner']?_0x37132c[_0xb5fa('0x119')][_0xb5fa('0x39')]:_0xb5fa('0x123'),'createdAt':moment(_0x37132c['createdAt'])[_0xb5fa('0xe1')](_0xb5fa('0x124'))[_0xb5fa('0x9a')](),'closedAt':_0x37132c['closed']?moment(_0x37132c[_0xb5fa('0x125')])[_0xb5fa('0xe1')](_0xb5fa('0x124'))[_0xb5fa('0x9a')]():'','disposition':_0x37132c[_0xb5fa('0xd1')],'chatInfo':{'browser':_0x37132c[_0xb5fa('0x126')],'os':_0x37132c[_0xb5fa('0x127')],'referer':_0x37132c[_0xb5fa('0x128')],'customerIp':_0x37132c['customerIp'],'customerPort':_0x37132c[_0xb5fa('0x129')]?_0x37132c[_0xb5fa('0x129')]:_0xb5fa('0x123')},'messages':_(_0x37132c[_0xb5fa('0xe5')])[_0xb5fa('0x12a')]()[_0xb5fa('0x86')]({'secret':![]})['map'](function(_0x11f9e8){if(_0x11f9e8[_0xb5fa('0xd7')]){var _0x4ba538=path[_0xb5fa('0xdb')](_0x449807,_0x11f9e8[_0xb5fa('0xd7')][_0xb5fa('0xd5')]);if(fs[_0xb5fa('0x12b')](_0x4ba538)){fs[_0xb5fa('0x12c')](_0x4ba538)[_0xb5fa('0x12d')](fs[_0xb5fa('0x12e')](path[_0xb5fa('0xdb')](_0x3e1d20,_0x11f9e8['Attachment']['basename'])));}}return{'date':moment(_0x11f9e8['createdAt'])[_0xb5fa('0xe1')](_0xb5fa('0x124'))[_0xb5fa('0x9a')](),'sender':_0x11f9e8[_0xb5fa('0xf3')]==='out'?_0x11f9e8[_0xb5fa('0x75')]?_0x11f9e8[_0xb5fa('0x75')]['fullname']:_0xb5fa('0xe9'):_0x11f9e8[_0xb5fa('0x6a')][_0xb5fa('0x115')]+(_0x11f9e8['Contact']['lastName']?'\x20'+_0x11f9e8['Contact'][_0xb5fa('0x116')]:''),'body':_0x11f9e8[_0xb5fa('0xd7')]?_0x11f9e8[_0xb5fa('0xd7')]['basename']:_0x11f9e8[_0xb5fa('0x79')],'direction':_0x11f9e8['direction']===_0xb5fa('0xca')?'A':'C','secret':_0x11f9e8[_0xb5fa('0xf4')],'read':_0x11f9e8['read'],'attachment':_0x11f9e8[_0xb5fa('0xd7')]};})[_0xb5fa('0x66')]()};return ejs[_0xb5fa('0x12f')](path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],'server',_0xb5fa('0x130'),_0xb5fa('0x131')),{'interaction':_0x42195b})[_0xb5fa('0x22')](function(_0x1f3c01){return new BPromise(function(_0xb5561b,_0xbd3013){pdf[_0xb5fa('0xb9')](_0x1f3c01,_0x324e9c)[_0xb5fa('0x132')](path[_0xb5fa('0xdb')](_0x3e1d20,'transcript-'+_0x37132c['id']+'-'+_0x1f164f+_0xb5fa('0x133')),function(_0x25a3a1,_0x21df98){if(_0x25a3a1)return _0xbd3013(_0x25a3a1);_0xb5561b(_0x21df98);});});})[_0xb5fa('0x22')](function(){return new BPromise(function(_0x46e0b3,_0xebcda7){zipdir(_0x3e1d20,{'saveTo':_0x74e62a},function(_0x5e6be6,_0x5daeba){if(_0x5e6be6)return _0xebcda7(_0x5e6be6);return _0x46e0b3(_0x5daeba);});})[_0xb5fa('0x22')](function(){return new BPromise(function(_0x593cc7,_0x51c15b){rimraf(_0x3e1d20,function(_0x5a8104){if(_0x5a8104)_0x51c15b(_0x5a8104);return _0x593cc7();});});})[_0xb5fa('0x22')](function(){return _0x41f06c[_0xb5fa('0x10e')](_0x74e62a,_0x58907b,function(_0x2ac2c1){if(_0x2ac2c1){console[_0xb5fa('0x134')](_0xb5fa('0x135'),_0x2ac2c1);}else{fs[_0xb5fa('0x136')](_0x74e62a);}});});});}else{return _0x41f06c[_0xb5fa('0x2c')](0xc8);}})[_0xb5fa('0x3c')](handleError(_0x41f06c,null));}; \ No newline at end of file +var _0x4325=['concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','all','rows','show','params','includeAll','include','merge','options','create','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','closed','disposition','abandon','attachmentUpload','originalname','basename','filename','file','mimetype','Attachment','attachmentDownload','json','Unauthorized','attachId','download','join','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','System','customer','Visitor','website_alias','alias','agent_fullname','agentAlias','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','ids','sort','ChatInteractionId','findAll','getMyMessages','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','CmContact','lastName','attachments','direction','Account','Owner','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','osName','customerIp','customerPort','existsSync','createReadStream','createWriteStream','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','http','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','status','count','offset','limit','set','Content-Range','apply','reject','save','update','end','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','map','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','select','field','color','from','tools_tags','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','left_join','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','keys','some','compact','isEmpty','forEach','ChatWebsiteId','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x5432('0x0'));var emlformat=require(_0x5432('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5432('0x2'));var jsonpatch=require(_0x5432('0x3'));var rp=require(_0x5432('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5432('0x5'));var util=require(_0x5432('0x6'));var path=require(_0x5432('0x7'));var sox=require('sox');var csv=require(_0x5432('0x8'));var ejs=require(_0x5432('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0x8'));var querystring=require(_0x5432('0xd'));var Papa=require(_0x5432('0xe'));var Redis=require('ioredis');var authService=require(_0x5432('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x10'));var hardwareService=require(_0x5432('0x11'));var logger=require(_0x5432('0x12'))(_0x5432('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5432('0x14'))['db'];config[_0x5432('0x15')]=_['defaults'](config[_0x5432('0x15')],{'host':_0x5432('0x16'),'port':0x18eb});var socket=require(_0x5432('0x17'))(new Redis(config[_0x5432('0x15')]));require(_0x5432('0x18'))[_0x5432('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5432('0x1a')]({'port':0x232b});var client9004=jayson[_0x5432('0x1b')][_0x5432('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x364152,_0x9d2023,_0x11db3c){if(_0x11db3c){var _0x5e18e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e18e8[_0x5432('0x1c')](_0x9d2023)){return _0x364152;}else{throw new db['Sequelize'][(_0x5432('0x1d'))](_0x5432('0x1e'));}}else{return _0x364152;}}function respondWithRpcPromise(_0x333152,_0x32fe60,_0x4221a8,_0x5f011f){return new BPromise(function(_0x3f3873,_0x22f030){var _0x12c069=_0x5f011f||client;return _0x12c069[_0x5432('0x1f')](_0x333152,_0x4221a8)[_0x5432('0x20')](function(_0x451de4){logger[_0x5432('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x32fe60,_0x5432('0x22'));logger[_0x5432('0x23')](_0x5432('0x24'),_0x32fe60,_0x5432('0x22'),JSON[_0x5432('0x25')](_0x451de4));if(_0x451de4['error']){if(_0x451de4['error']['code']===0x1f4){logger[_0x5432('0x26')](_0x5432('0x27'),_0x32fe60,_0x451de4[_0x5432('0x26')][_0x5432('0x28')]);return _0x22f030(_0x451de4['error']['message']);}logger[_0x5432('0x26')](_0x5432('0x27'),_0x32fe60,_0x451de4['error'][_0x5432('0x28')]);return _0x3f3873(_0x451de4[_0x5432('0x26')][_0x5432('0x28')]);}else{logger['info'](_0x5432('0x27'),_0x32fe60,_0x5432('0x22'));_0x3f3873(_0x451de4[_0x5432('0x29')]['message']);}})['catch'](function(_0x1f2055){logger[_0x5432('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x32fe60,_0x1f2055);_0x22f030(_0x1f2055);});});}function respondWithStatusCode(_0x1abe73,_0x66a647){_0x66a647=_0x66a647||0xcc;return function(_0x1f2e8f){if(_0x1f2e8f){return _0x1abe73['sendStatus'](_0x66a647);}return _0x1abe73[_0x5432('0x2a')](_0x66a647)['end']();};}function respondWithResult(_0x4821be,_0x6fc7f5){_0x6fc7f5=_0x6fc7f5||0xc8;return function(_0x4a52ba){if(_0x4a52ba){return _0x4821be[_0x5432('0x2a')](_0x6fc7f5)['json'](_0x4a52ba);}};}function respondWithFilteredResult(_0x59a866,_0x465a09){return function(_0x21735e){if(_0x21735e){var _0x345b51=_0x21735e[_0x5432('0x2b')],_0x4e92d5=_0x465a09[_0x5432('0x2c')],_0x31490c=_0x465a09[_0x5432('0x2c')]+_0x465a09[_0x5432('0x2d')],_0x1d436c;if(_0x31490c>=_0x345b51){_0x31490c=_0x345b51;_0x1d436c=0xc8;}else{_0x1d436c=0xce;}_0x59a866[_0x5432('0x2a')](_0x1d436c);return _0x59a866[_0x5432('0x2e')](_0x5432('0x2f'),_0x4e92d5+'-'+_0x31490c+'/'+_0x345b51)['json'](_0x21735e);}return null;};}function patchUpdates(_0x57fd0b){return function(_0x240dec){try{jsonpatch[_0x5432('0x30')](_0x240dec,_0x57fd0b,!![]);}catch(_0x2ebffa){return BPromise[_0x5432('0x31')](_0x2ebffa);}return _0x240dec[_0x5432('0x32')]();};}function saveUpdates(_0x4ce287,_0x30a07f){return function(_0x5649b6){if(_0x5649b6){return _0x5649b6[_0x5432('0x33')](_0x4ce287)[_0x5432('0x20')](function(_0x56f560){return _0x56f560;});}return null;};}function removeEntity(_0x355d26,_0xb17e78){return function(_0x112c83){if(_0x112c83){return _0x112c83['destroy']()[_0x5432('0x20')](function(){_0x355d26[_0x5432('0x2a')](0xcc)[_0x5432('0x34')]();});}};}function handleEntityNotFound(_0xcfb6e8,_0x555b6e){return function(_0xe01f4b){if(!_0xe01f4b){_0xcfb6e8[_0x5432('0x35')](0x194);}return _0xe01f4b;};}function handleError(_0x2ebb2e,_0x2be93f){_0x2be93f=_0x2be93f||0x1f4;return function(_0x3fb586){logger[_0x5432('0x26')](_0x3fb586[_0x5432('0x36')]);if(_0x3fb586[_0x5432('0x37')]){delete _0x3fb586[_0x5432('0x37')];}_0x2ebb2e[_0x5432('0x2a')](_0x2be93f)[_0x5432('0x38')](_0x3fb586);};}function getInteractionUsers(_0x1f4679,_0x32728b){return new BPromise(function(_0x4397a7,_0x48ec3e){try{if(_0x32728b[_0x1f4679['id']]){_0x1f4679[_0x5432('0x39')]=_['map'](_0x32728b[_0x1f4679['id']],function(_0x6f5006){return{'id':_0x6f5006['id'],'fullname':_0x6f5006[_0x5432('0x3a')]};});}}catch(_0x2b8c7f){_0x48ec3e(_0x2b8c7f);}_0x4397a7(_0x1f4679);});}function getInteractionTags(_0x1a5561,_0x4dc00e){return new BPromise(function(_0x4dd813,_0x5c9fec){try{if(_0x1a5561[_0x5432('0x3b')]){_0x1a5561[_0x5432('0x3c')]=[];_0x1a5561[_0x5432('0x3b')][_0x5432('0x3d')](',')['forEach'](function(_0x2f7a3f){_0x1a5561[_0x5432('0x3c')][_0x5432('0x3e')](_0x4dc00e[_0x2f7a3f]);});}delete _0x1a5561['TagIds'];}catch(_0x219ddc){_0x5c9fec(_0x219ddc);}_0x4dd813(_0x1a5561);});}function updateChatInteraction(_0x38c951,_0x4cd86d,_0x3eb446){return new BPromise(function(_0x239f24,_0x48621b){return getInteractionUsers(_0x38c951,_0x3eb446)[_0x5432('0x20')](function(_0x53b11e){return getInteractionTags(_0x53b11e,_0x4cd86d);})[_0x5432('0x20')](function(_0x2d4cb0){_0x239f24(_0x2d4cb0);})[_0x5432('0x3f')](function(_0x11c7f2){_0x48621b(_0x11c7f2);});});}exports['index']=function(_0x9cfb8b,_0x4b93b4){var _0x3771ee={},_0x15f18d={},_0x3afbde={'count':0x0,'rows':[]};var _0x46671c=_[_0x5432('0x40')](db[_0x5432('0x41')][_0x5432('0x42')],function(_0x4ab024){return{'name':_0x4ab024[_0x5432('0x43')],'type':_0x4ab024[_0x5432('0x44')][_0x5432('0x45')]};});_0x15f18d[_0x5432('0x46')]=_[_0x5432('0x40')](_0x46671c,_0x5432('0x37'));_0x15f18d[_0x5432('0x47')]=_['keys'](_0x9cfb8b[_0x5432('0x47')]);_0x15f18d[_0x5432('0x48')]=_[_0x5432('0x49')](_0x15f18d[_0x5432('0x46')],_0x15f18d[_0x5432('0x47')]);_0x3771ee['attributes']=_[_0x5432('0x49')](_0x15f18d['model'],qs[_0x5432('0x4a')](_0x9cfb8b[_0x5432('0x47')]['fields']));_0x3771ee[_0x5432('0x4b')]=_0x3771ee['attributes'][_0x5432('0x4c')]?_0x3771ee[_0x5432('0x4b')]:_0x15f18d['model'];if(!_0x9cfb8b['query'][_0x5432('0x4d')](_0x5432('0x4e'))){_0x3771ee[_0x5432('0x2d')]=qs[_0x5432('0x2d')](_0x9cfb8b[_0x5432('0x47')][_0x5432('0x2d')]);_0x3771ee[_0x5432('0x2c')]=qs['offset'](_0x9cfb8b[_0x5432('0x47')][_0x5432('0x2c')]);}_0x3771ee[_0x5432('0x4f')]=qs['sort'](_0x9cfb8b['query']['sort']);_0x3771ee['where']=qs[_0x5432('0x48')](_[_0x5432('0x50')](_0x9cfb8b[_0x5432('0x47')],_0x15f18d[_0x5432('0x48')]),_0x46671c);var _0x1beefd=[];var _0x4bc716=squel[_0x5432('0x51')]()[_0x5432('0x52')]('id')[_0x5432('0x52')]('name')[_0x5432('0x52')](_0x5432('0x53'))[_0x5432('0x54')](_0x5432('0x55'));var _0x121dc8=squel['select']()[_0x5432('0x52')]('u.id')[_0x5432('0x52')]('u.fullname')[_0x5432('0x52')](_0x5432('0x56'))['from'](_0x5432('0x57'),'ui')['left_join'](_0x5432('0x58'),'u',_0x5432('0x59'));var _0x36cb63=squel[_0x5432('0x51')]()['from'](_0x5432('0x5a'),'i')['left_join'](_0x5432('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5432('0x5c')](_0x5432('0x58'),'o',_0x5432('0x5d'))[_0x5432('0x5c')](_0x5432('0x5e'),'a',_0x5432('0x5f'))[_0x5432('0x5c')](_0x5432('0x60'),'me',_0x5432('0x61'))[_0x5432('0x5c')]('chat_interaction_has_tags','it',_0x5432('0x62'))[_0x5432('0x5c')]('tools_tags','t',_0x5432('0x63'));var _0x3eb16e=squel[_0x5432('0x64')]();var _0x13fd25=[];var _0x863be3=squel['expr']();var _0x522805;if(_0x9cfb8b['query']['search']){_0x522805=as[_0x5432('0x65')](_0x9cfb8b[_0x5432('0x47')][_0x5432('0x66')]);var _0x5b70f9=_0x522805[_0x5432('0x67')];for(var _0x12768f=0x0;_0x12768f<_0x522805[_0x5432('0x68')][_0x5432('0x4c')];_0x12768f++){var _0x3d3d2c=_0x522805[_0x5432('0x68')][_0x12768f];var _0x328211='i';var _0x3a2d2c=_[_0x5432('0x69')](_0x46671c,[_0x5432('0x37'),_0x3d3d2c[_0x5432('0x52')]]);if(!_0x3a2d2c){switch(_0x3d3d2c['field']){case _0x5432('0x6a'):if(_0x3d3d2c[_0x5432('0x6b')]==0x1){_0x36cb63[_0x5432('0x6c')]('`'+_0x3d3d2c[_0x5432('0x52')]+_0x5432('0x6d'));}else{_0x36cb63['having']('`'+_0x3d3d2c[_0x5432('0x52')]+'`\x20>\x200');}break;case _0x5432('0x6e'):if(_0x3d3d2c[_0x5432('0x6f')]===_0x5432('0x70')){if(_0x3d3d2c[_0x5432('0x6b')][_0x5432('0x3d')]('\x20')[_0x5432('0x4c')]>0x1){_0x3eb16e[_0x5b70f9](_0x5432('0x71'),qs[_0x5432('0x72')](_0x3d3d2c[_0x5432('0x6b')]),null);}else{var _0x1a0883='%'+_0x3d3d2c[_0x5432('0x6b')]+'%';_0x3eb16e[_0x5b70f9](_0x5432('0x73'),_0x1a0883,_0x1a0883,_0x1a0883);}}else{_0x3a2d2c=_[_0x5432('0x69')](_0x46671c,[_0x5432('0x37'),_0x5432('0x74')]);_0x3d3d2c[_0x5432('0x52')]=_0x5432('0x74');_0xd20561=as[_0x5432('0x75')](_0x328211,_0x3a2d2c['type'],_0x3d3d2c);_0x3eb16e[_0x5b70f9](_0xd20561[_0x5432('0x76')],_0xd20561['value'][_0x5432('0x77')],_0xd20561[_0x5432('0x6b')]['end']);}break;case _0x5432('0x78'):var _0x33d39a=_0x3d3d2c[_0x5432('0x6b')][_0x5432('0x3d')](',')['map'](function(_0x3a78b3){return Number(_0x3a78b3);});_0x33d39a['forEach'](function(_0x187373){_0x863be3['or'](_0x5432('0x79'),'%,'+_0x187373+',%');});_0x13fd25=_[_0x5432('0x7a')](_0x13fd25,_0x33d39a);break;case _0x5432('0x7b'):if(_0x3d3d2c[_0x5432('0x6f')]===_0x5432('0x70')){_0x3eb16e[_0x5b70f9]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3d3d2c[_0x5432('0x6b')]+'%',null);}else{_0x3a2d2c=_[_0x5432('0x69')](_0x46671c,['name','UserId']);_0x3d3d2c[_0x5432('0x52')]='UserId';_0xd20561=as[_0x5432('0x75')](_0x328211,_0x3a2d2c['type'],_0x3d3d2c);_0x3eb16e[_0x5b70f9](_0xd20561[_0x5432('0x76')],_0xd20561['value'][_0x5432('0x77')],_0xd20561['value']['end']);}break;case _0x5432('0x7c'):_0xd20561=as[_0x5432('0x75')]('me',null,_0x3d3d2c);_0x3eb16e[_0x5b70f9](_0xd20561[_0x5432('0x76')],_0xd20561['value']['start'],_0xd20561['value'][_0x5432('0x34')]);break;}}else{var _0xd20561=as[_0x5432('0x75')](_0x328211,_0x3a2d2c['type'],_0x3d3d2c);_0x3eb16e[_0x5b70f9](_0xd20561['text'],_0xd20561[_0x5432('0x6b')][_0x5432('0x77')],_0xd20561[_0x5432('0x6b')][_0x5432('0x34')]);}}}else{var _0x1835af=_(_0x9cfb8b[_0x5432('0x47')])[_0x5432('0x7d')]()[_0x5432('0x40')](function(_0x4d44a9){return _[_0x5432('0x7e')](_0x46671c,['name',_0x4d44a9])?_0x4d44a9:undefined;})[_0x5432('0x7f')]()[_0x5432('0x6b')]();if(!_[_0x5432('0x80')](_0x1835af)){_0x1835af[_0x5432('0x81')](function(_0x304d81){if(_0x304d81===_0x5432('0x82')){_0x36cb63[_0x5432('0x83')]('i.ChatWebsiteId\x20IN\x20?',[][_0x5432('0x84')](_0x9cfb8b[_0x5432('0x47')][_0x304d81]));}else if(_0x304d81===_0x5432('0x85')){var _0x3ef516=JSON['parse'](_0x9cfb8b[_0x5432('0x47')][_0x304d81])[_0x5432('0x86')];var _0x133a43=JSON[_0x5432('0x87')](_0x9cfb8b[_0x5432('0x47')][_0x304d81])[_0x5432('0x88')];_0x36cb63[_0x5432('0x83')](_0x5432('0x89'),_0x3ef516,_0x133a43);}else{if(_0x9cfb8b['query'][_0x304d81]===_0x5432('0x8a')){_0x36cb63[_0x5432('0x83')]('i.'+_0x304d81+_0x5432('0x8b'));}else{_0x36cb63[_0x5432('0x83')]('i.'+_0x304d81+_0x5432('0x8c'),_0x9cfb8b[_0x5432('0x47')][_0x304d81]);}}});}if(_0x9cfb8b[_0x5432('0x47')]['read']){if(_0x9cfb8b[_0x5432('0x47')][_0x5432('0x8d')]==0x1){_0x36cb63[_0x5432('0x6c')](_0x5432('0x8e'));}else{_0x36cb63[_0x5432('0x6c')](_0x5432('0x8f'));}}if(_0x9cfb8b['query']['tag']){_0x13fd25=_['isArray'](_0x9cfb8b['query'][_0x5432('0x90')])?_0x9cfb8b['query'][_0x5432('0x90')]:new Array(_0x9cfb8b[_0x5432('0x47')]['tag']);_0x13fd25[_0x5432('0x81')](function(_0x4f7d21){_0x863be3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f7d21+',%');});}if(_0x9cfb8b[_0x5432('0x47')][_0x5432('0x91')]){var _0x5d30bf=_0x9cfb8b[_0x5432('0x47')][_0x5432('0x91')][_0x5432('0x92')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x5432('0x93'));if(qs[_0x5432('0x94')](_0x5d30bf)){_0x3eb16e['or']('i.id\x20LIKE\x20?',_0x5d30bf+'%');}else{_0x3eb16e['or'](_0x5432('0x95'),qs['getFullTextValue'](_0x5d30bf))['or'](_0x5432('0x96'),_0x5d30bf+'%');}}}_0x36cb63[_0x5432('0x83')](_0x3eb16e);_0x36cb63[_0x5432('0x97')](_0x5432('0x98'));var _0xbb1f59={'type':db[_0x5432('0x99')]['QueryTypes'][_0x5432('0x9a')],'raw':!![]};var _0x276772=_0x36cb63['clone']();_0x276772[_0x5432('0x52')](_0x5432('0x98'));_0x276772[_0x5432('0x52')](_0x5432('0x9b'),_0x5432('0x6a'));if(_0x3771ee[_0x5432('0x4f')]){_0x3771ee['order'][_0x5432('0x81')](function(_0x53f89c){_0x36cb63['order']('i.'+_0x53f89c[0x0],_0x53f89c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x5432('0x80')](_0x13fd25)){_0x36cb63['having'](_0x863be3);_0x276772['where'](_0x5432('0x9c'),_0x13fd25);}BPromise['resolve']()[_0x5432('0x20')](function(){if(!_0x522805){if(_0x9cfb8b[_0x5432('0x47')][_0x5432('0x82')]||_0x9cfb8b[_0x5432('0x47')][_0x5432('0x9d')])return;_0x276772[_0x5432('0x83')](_0x5432('0x9e'));_0x36cb63[_0x5432('0x83')](_0x5432('0x9e'));return;}return _0x9cfb8b[_0x5432('0x9f')][_0x5432('0xa0')]({'attributes':['id'],'raw':!![]})[_0x5432('0x20')](function(_0x579b58){if(_[_0x5432('0x80')](_0x579b58)){_0x276772['where'](_0x5432('0xa1'));_0x36cb63[_0x5432('0x83')](_0x5432('0xa1'));}else{_0x276772['where'](_0x5432('0xa2'),_[_0x5432('0x40')](_0x579b58,'id'));_0x36cb63[_0x5432('0x83')](_0x5432('0xa2'),_[_0x5432('0x40')](_0x579b58,'id'));}});})['then'](function(){db[_0x5432('0xa3')][_0x5432('0x47')](_0x276772[_0x5432('0xa4')](),_0xbb1f59)[_0x5432('0x20')](function(_0x33e658){_0x3afbde[_0x5432('0x2b')]=_0x33e658[_0x5432('0x4c')];if(_0x3afbde[_0x5432('0x2b')]===0x0)return[];return db[_0x5432('0xa3')][_0x5432('0x47')](_0x4bc716[_0x5432('0xa4')](),_0xbb1f59)[_0x5432('0x20')](function(_0xb9f0e6){_0x1beefd=_[_0x5432('0xa5')](_0xb9f0e6,'id');_0xbb1f59=_['merge'](_0xbb1f59,{'model':db[_0x5432('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9cfb8b['query'][_0x5432('0x4a')]){_0x3771ee['attributes'][_0x5432('0x81')](function(_0x4223cf){_0x36cb63[_0x5432('0x52')]('i.'+_0x4223cf);});}else{_0x36cb63[_0x5432('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5432('0x6a'));_0x36cb63[_0x5432('0x52')](_0x5432('0xa6'),_0x5432('0xa7'));_0x36cb63[_0x5432('0x52')](_0x5432('0xa8'),_0x5432('0xa9'));_0x36cb63[_0x5432('0x52')](_0x5432('0xaa'));_0x36cb63['field'](_0x5432('0xab'),_0x5432('0xac'));_0x36cb63[_0x5432('0x52')](_0x5432('0xad'),_0x5432('0xae'));_0x36cb63[_0x5432('0x52')](_0x5432('0xaf'),'Contact.email');_0x36cb63[_0x5432('0x52')](_0x5432('0xb0'),_0x5432('0xb1'));_0x36cb63['field'](_0x5432('0xb2'),_0x5432('0xb3'));_0x36cb63[_0x5432('0x52')](_0x5432('0xb4'),_0x5432('0xb5'));_0x36cb63[_0x5432('0x52')](_0x5432('0xb6'),_0x5432('0xb7'));_0x36cb63[_0x5432('0x52')](_0x5432('0xb8'),_0x5432('0xb9'));_0x36cb63[_0x5432('0x52')](_0x5432('0xba'),'TagIds');}if(_0x3771ee[_0x5432('0x2d')])_0x36cb63[_0x5432('0x2d')](_0x3771ee[_0x5432('0x2d')]);if(_0x3771ee['offset'])_0x36cb63[_0x5432('0x2c')](_0x3771ee['offset']);return db[_0x5432('0xa3')][_0x5432('0x47')](_0x36cb63[_0x5432('0xa4')](),_0xbb1f59);})['then'](function(_0x4a7433){_0x121dc8[_0x5432('0x83')](_0x5432('0xbb'),_[_0x5432('0x40')](_0x4a7433,'id'));return db[_0x5432('0xa3')][_0x5432('0x47')](_0x121dc8['toString'](),_0xbb1f59)['then'](function(_0x35eeee){var _0x3a02ec=_['groupBy'](_0x35eeee,'ChatInteractionId');var _0x2c5db5=[];_0x4a7433['forEach'](function(_0x4e115b){_0x2c5db5[_0x5432('0x3e')](updateChatInteraction(_0x4e115b,_0x1beefd,_0x3a02ec));});return BPromise[_0x5432('0xbc')](_0x2c5db5);});});})[_0x5432('0x20')](function(_0x1eeb50){_0x3afbde[_0x5432('0xbd')]=_0x1eeb50;return _0x3afbde;})['then'](respondWithFilteredResult(_0x4b93b4,_0x3771ee));})[_0x5432('0x3f')](handleError(_0x4b93b4,null));};exports[_0x5432('0xbe')]=function(_0x9ea224,_0x24db34){var _0x171765={'raw':![],'where':{'id':_0x9ea224[_0x5432('0xbf')]['id']}},_0x2c9bc4={};_0x2c9bc4[_0x5432('0x46')]=_[_0x5432('0x7d')](db[_0x5432('0x41')][_0x5432('0x42')]);_0x2c9bc4[_0x5432('0x47')]=_[_0x5432('0x7d')](_0x9ea224['query']);_0x2c9bc4[_0x5432('0x48')]=_['intersection'](_0x2c9bc4[_0x5432('0x46')],_0x2c9bc4[_0x5432('0x47')]);_0x171765[_0x5432('0x4b')]=_[_0x5432('0x49')](_0x2c9bc4[_0x5432('0x46')],qs[_0x5432('0x4a')](_0x9ea224[_0x5432('0x47')][_0x5432('0x4a')]));_0x171765[_0x5432('0x4b')]=_0x171765[_0x5432('0x4b')][_0x5432('0x4c')]?_0x171765[_0x5432('0x4b')]:_0x2c9bc4[_0x5432('0x46')];if(_0x9ea224['query'][_0x5432('0xc0')]){_0x171765[_0x5432('0xc1')]=[{'all':!![]}];}_0x171765=_[_0x5432('0xc2')]({},_0x171765,_0x9ea224[_0x5432('0xc3')]);return db[_0x5432('0x41')][_0x5432('0x69')](_0x171765)[_0x5432('0x20')](handleEntityNotFound(_0x24db34,null))['then'](respondWithResult(_0x24db34,null))[_0x5432('0x3f')](handleError(_0x24db34,null));};exports[_0x5432('0xc4')]=function(_0x5da672,_0x15596b){return db['ChatInteraction'][_0x5432('0xc4')](_0x5da672[_0x5432('0x7c')],{})[_0x5432('0x20')](respondWithResult(_0x15596b,0xc9))[_0x5432('0x3f')](handleError(_0x15596b,null));};exports[_0x5432('0x33')]=function(_0x47951f,_0x269867){if(_0x47951f['body']['id']){delete _0x47951f[_0x5432('0x7c')]['id'];}return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0x47951f['params']['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x269867,null))[_0x5432('0x20')](saveUpdates(_0x47951f[_0x5432('0x7c')],null))['then'](respondWithResult(_0x269867,null))[_0x5432('0x3f')](handleError(_0x269867,null));};exports[_0x5432('0xc5')]=function(_0x3fe0cb,_0x3db90b){return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0x3fe0cb[_0x5432('0xbf')]['id']}})['then'](handleEntityNotFound(_0x3db90b,null))[_0x5432('0x20')](removeEntity(_0x3db90b,null))[_0x5432('0x3f')](handleError(_0x3db90b,null));};exports[_0x5432('0xc6')]=function(_0x30a9dd,_0x5ce9b2){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x5ce9b2,null))['catch'](handleError(_0x5ce9b2,null));};exports['createVidaooSession']=function(_0x4ee5e3,_0x554b3a){var _0x4bb9c1=_0x4ee5e3[_0x5432('0xbf')]['id'];var _0x1b12c8;var _0x58c6bb;var _0xc85ae7;return db[_0x5432('0x41')][_0x5432('0xc7')]({'where':{'id':_0x4bb9c1}})[_0x5432('0x20')](function(_0x5b3282){_0x1b12c8=_0x5b3282;return db[_0x5432('0xc8')][_0x5432('0xc7')]({'where':{'id':_0x5b3282[_0x5432('0x82')]},'attributes':['id',_0x5432('0xc9'),_0x5432('0xca')],'raw':!![]});})['then'](function(_0x57be29){if(_0x57be29&&_0x57be29[_0x5432('0xc9')]&&_0x57be29['vidaooEscalation']){_0x58c6bb=_0x57be29;var _0x494b04={'rejectUnauthorized':![],'method':_0x5432('0xcb'),'uri':_0x5432('0xcc'),'headers':{'X-APIKEY':_0x57be29[_0x5432('0xc9')]},'body':{'name':'MotionCWB:'+_0x4bb9c1},'redirect':_0x5432('0xcd'),'json':!![]};return rp(_0x494b04);}else{throw new db['Sequelize'][(_0x5432('0x1d'))](_0x5432('0xce'));}})['then'](function(_0x159697){_0xc85ae7=_0x159697;if(_0xc85ae7['id']){var _0x2646f9={'body':_0xc85ae7[_0x5432('0xcf')],'ChatWebsiteId':_0x58c6bb['id'],'ChatInteractionId':_0x1b12c8['id'],'direction':_0x5432('0xd0'),'UserId':_0x4ee5e3['user']['id']};return db[_0x5432('0xd1')][_0x5432('0xc4')](_0x2646f9,{});}else{throw new db[(_0x5432('0x99'))][(_0x5432('0x1d'))](_0x5432('0xd2'));}})[_0x5432('0x20')](function(){return _0x1b12c8[_0x5432('0xd3')]({'vidaooSessionId':_0xc85ae7['id']});})[_0x5432('0x20')](respondWithResult(_0x554b3a,null))[_0x5432('0x3f')](handleError(_0x554b3a,null));};exports[_0x5432('0xd4')]=function(_0x1a6710,_0x5c40ad){if(_0x1a6710['body']['id']){delete _0x1a6710[_0x5432('0x7c')]['id'];}return db['ChatInteraction'][_0x5432('0x69')]({'where':{'id':_0x1a6710[_0x5432('0xbf')]['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x5c40ad,null))[_0x5432('0x20')](saveUpdates(_0x1a6710[_0x5432('0x7c')],null))['then'](respondWithResult(_0x5c40ad,null))['catch'](handleError(_0x5c40ad,null));};exports['abandon']=function(_0x2f23e1,_0x4048d5,_0x3666ae){if(_0x2f23e1['body']['id']){delete _0x2f23e1[_0x5432('0x7c')]['id'];}return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0x2f23e1['params']['id']}})[_0x5432('0x20')](function(_0xcdc2ad){if(!_0xcdc2ad){logger[_0x5432('0x26')](_0x5432('0xd5'),'abandon',0x194,'entity\x20not\x20found');_0x4048d5[_0x5432('0x35')](0x194);}else{if(_0xcdc2ad[_0x5432('0xd6')]){throw new db[(_0x5432('0x99'))][(_0x5432('0x1d'))]('Interaction\x20already\x20assigned');}}return _0xcdc2ad;})[_0x5432('0x20')](function(_0x3a3ed1){if(_0x3a3ed1){return _0x3a3ed1[_0x5432('0x33')]({'closed':_0x2f23e1['body'][_0x5432('0xd7')],'disposition':_0x2f23e1[_0x5432('0x7c')][_0x5432('0xd8')]})[_0x5432('0x20')](function(_0x1c29ba){return _0x1c29ba;});}})[_0x5432('0x20')](function(_0xc53eb2){return respondWithRpcPromise('AbandonInteraction',_0x5432('0xd9'),_0x2f23e1[_0x5432('0x7c')],client9004);})[_0x5432('0x20')](respondWithResult(_0x4048d5,null))[_0x5432('0x3f')](handleError(_0x4048d5,null));};exports[_0x5432('0xda')]=function(_0x4aa003,_0x234f1d,_0xcaefb6){_0x4aa003[_0x5432('0x7c')][_0x5432('0x37')]=_0x4aa003['file'][_0x5432('0xdb')];_0x4aa003[_0x5432('0x7c')][_0x5432('0xdc')]=_0x4aa003['file'][_0x5432('0xdd')];_0x4aa003[_0x5432('0x7c')][_0x5432('0x44')]=_0x4aa003[_0x5432('0xde')][_0x5432('0xdf')];return db[_0x5432('0xe0')]['create'](_0x4aa003[_0x5432('0x7c')])[_0x5432('0x20')](respondWithResult(_0x234f1d,0xc9))['catch'](handleError(_0x234f1d,null));};exports[_0x5432('0xe1')]=function(_0x25b05d,_0x4d8359,_0x1f4f0c){return db[_0x5432('0x41')][_0x5432('0xc7')]({'where':{'id':_0x25b05d[_0x5432('0xbf')]['id']},'raw':!![]})[_0x5432('0x20')](handleEntityNotFound(_0x4d8359,null))['then'](function(_0x296cab){if(_0x296cab){if(_0x296cab[_0x5432('0xd7')]){return _0x4d8359[_0x5432('0x2a')](0x193)[_0x5432('0xe2')]({'status':0x193,'message':_0x5432('0xe3')});}return db[_0x5432('0xe0')][_0x5432('0xc7')]({'where':{'id':_0x25b05d[_0x5432('0x47')][_0x5432('0xe4')]},'raw':!![]})[_0x5432('0x20')](handleEntityNotFound(_0x4d8359,null));}})[_0x5432('0x20')](function(_0x3b0449){if(_0x3b0449){return _0x4d8359[_0x5432('0xe5')](path[_0x5432('0xe6')](config['root'],'server/files/attachments/',_0x3b0449[_0x5432('0xdc')]));}})[_0x5432('0x3f')](handleError(_0x4d8359,null));};exports['close']=function(_0x448eef,_0x102ae1){var _0x14ebe4=null;var _0x4577f5=null;var _0x261069=null;var _0x439db1=null;if(_0x448eef[_0x5432('0x7c')]['id']){delete _0x448eef[_0x5432('0x7c')]['id'];}if(_0x448eef[_0x5432('0x7c')][_0x5432('0xe7')]){_0x439db1=path[_0x5432('0xe6')](config[_0x5432('0xe8')],_0x5432('0xe9'),util[_0x5432('0xea')](_0x5432('0xeb'),Date['now']()));_0x448eef[_0x5432('0x7c')][_0x5432('0xec')]=_0x439db1;}return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0x448eef[_0x5432('0xbf')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x5432('0x7b')],'as':_0x5432('0x7b')}]}]})[_0x5432('0x20')](handleEntityNotFound(_0x102ae1,null))[_0x5432('0x20')](saveUpdates(_0x448eef['body'],null))[_0x5432('0x20')](function(_0x1c7a65){if(_0x1c7a65){_0x14ebe4=_0x1c7a65;return db[_0x5432('0xc8')][_0x5432('0x69')]({'where':{'id':_0x14ebe4[_0x5432('0x82')]}});}})[_0x5432('0x20')](function(_0x3c9a6c){if(_0x3c9a6c){_0x261069=_0x3c9a6c;return db['CmContact'][_0x5432('0x69')]({'where':{'id':_0x14ebe4[_0x5432('0x74')]}});}})['then'](function(_0x5b4795){if(_0x5b4795){_0x4577f5=_0x5b4795;if(_0x439db1){var _0xd9089f=null;for(var _0x2ba2a6=0x1;_0x2ba2a6<_0x14ebe4[_0x5432('0xed')][_0x5432('0x4c')];++_0x2ba2a6){_0xd9089f=_0x14ebe4['Messages'][_0x2ba2a6];var _0x415818=_0xd9089f[_0x5432('0xd6')]?util[_0x5432('0xea')](_0x5432('0xee'),_0x261069['agentAlias'],_0xd9089f[_0x5432('0xd6')]):_0x5432('0xef');var _0x5211de=_0x448eef[_0x5432('0x7c')][_0x5432('0xf0')]||util[_0x5432('0xea')](_0x5432('0xee'),_0x5432('0xf1'),_0xd9089f[_0x5432('0x74')]);switch(_0x261069['agentIdentifier']){case _0x5432('0xf2'):_0x415818=_0xd9089f['UserId']?util[_0x5432('0xea')](_0x5432('0xee'),_0x261069['agentAlias'],_0xd9089f[_0x5432('0xd6')]):_0x5432('0xef');break;case'agent_alias':_0x415818=_0xd9089f[_0x5432('0xd6')]?_0xd9089f[_0x5432('0x7b')][_0x5432('0xf3')]||_0xd9089f['User'][_0x5432('0x3a')]:_0x5432('0xef');break;case _0x5432('0xf4'):_0x415818=_0xd9089f[_0x5432('0xd6')]?_0xd9089f[_0x5432('0x7b')][_0x5432('0x3a')]:'System';break;default:_0x415818=_0xd9089f[_0x5432('0xd6')]?util[_0x5432('0xea')](_0x5432('0xee'),_0x261069[_0x5432('0xf5')],_0xd9089f[_0x5432('0xd6')]):_0x5432('0xef');}var _0x5e0035=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0xd9089f['createdAt'])[_0x5432('0xea')]('MM/DD/YYYY\x20HH:mm:ss'),_0xd9089f['direction']==='in'?_0x5211de:_0x415818,_0xd9089f['body']);if(!_0xd9089f[_0x5432('0xf6')]){fs['appendFileSync'](_0x439db1,_0x5e0035);}}return db[_0x5432('0xf7')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x5432('0xf8')],'as':_0x5432('0xf9'),'raw':!![]}]});}}})[_0x5432('0x20')](function(_0x5c4b4f){if(_0x5c4b4f&&_0x5c4b4f[_0x5432('0xf9')]&&_0x448eef['body']){var _0x300153={'tls':{'rejectUnauthorized':![]}};if(_0x5c4b4f[_0x5432('0xf9')][_0x5432('0xfa')]){_0x300153[_0x5432('0xfa')]=_0x5c4b4f['Smtp'][_0x5432('0xfa')];}else{_0x300153[_0x5432('0xfb')]=_0x5c4b4f[_0x5432('0xf9')][_0x5432('0xfb')];_0x300153[_0x5432('0xfc')]=_0x5c4b4f[_0x5432('0xf9')][_0x5432('0xfc')];_0x300153[_0x5432('0xfd')]=_0x5c4b4f['Smtp']['secure'];}if(_0x5c4b4f[_0x5432('0xf9')]['authentication']){_0x300153[_0x5432('0xfe')]={'user':_0x5c4b4f[_0x5432('0xf9')][_0x5432('0x9f')],'pass':_0x5c4b4f['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0x5432('0xff'),{'account':_0x300153,'message':{'from':util[_0x5432('0xea')](_0x5432('0x100'),_0x5c4b4f[_0x5432('0x37')],_0x5c4b4f['email']||_0x5c4b4f[_0x5432('0xf9')][_0x5432('0x9f')]),'to':_0x448eef[_0x5432('0x7c')]['mailTranscript'],'subject':_0x5432('0x101'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x448eef[_0x5432('0x7c')][_0x5432('0xe7')]),'attachments':[{'path':_0x439db1}]}})[_0x5432('0x20')](function(){return _0x14ebe4;})[_0x5432('0x3f')](function(_0x568abd){console[_0x5432('0x26')](_0x568abd);});}else{return _0x14ebe4;}})['then'](respondWithStatusCode(_0x102ae1,0xc8))[_0x5432('0x3f')](handleError(_0x102ae1,null));};exports['addMessage']=function(_0x41eb80,_0x268511,_0x4eefd9){return db[_0x5432('0xd1')][_0x5432('0x69')]({'where':{'id':_0x41eb80[_0x5432('0xbf')]['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x268511,null))[_0x5432('0x20')](function(_0x2e70a7){if(_0x2e70a7){return _0x2e70a7[_0x5432('0x102')](_0x41eb80[_0x5432('0x7c')]['ids'],_[_0x5432('0x103')](_0x41eb80[_0x5432('0x7c')],[_0x5432('0x104'),'id'])||{});}})[_0x5432('0x20')](respondWithResult(_0x268511,null))[_0x5432('0x3f')](handleError(_0x268511,null));};exports['getMessages']=function(_0x316aa1,_0x52f5c7,_0x558a4a){var _0x46b746={'raw':![],'where':{}};var _0x361b29={};var _0x2d9c3d={'count':0x0,'rows':[]};return db[_0x5432('0x41')][_0x5432('0xc7')]({'where':{'id':_0x316aa1[_0x5432('0xbf')]['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x52f5c7,null))[_0x5432('0x20')](function(_0x5098bc){if(_0x5098bc){_0x361b29[_0x5432('0x46')]=_[_0x5432('0x7d')](db[_0x5432('0xd1')][_0x5432('0x42')]);_0x361b29['query']=_[_0x5432('0x7d')](_0x316aa1[_0x5432('0x47')]);_0x361b29[_0x5432('0x48')]=_[_0x5432('0x49')](_0x361b29['model'],_0x361b29[_0x5432('0x47')]);_0x46b746[_0x5432('0x4b')]=_[_0x5432('0x49')](_0x361b29[_0x5432('0x46')],qs[_0x5432('0x4a')](_0x316aa1[_0x5432('0x47')][_0x5432('0x4a')]));_0x46b746[_0x5432('0x4b')]=_0x46b746[_0x5432('0x4b')][_0x5432('0x4c')]?_0x46b746[_0x5432('0x4b')]:_0x361b29[_0x5432('0x46')];if(!_0x316aa1[_0x5432('0x47')][_0x5432('0x4d')](_0x5432('0x4e'))){_0x46b746[_0x5432('0x2d')]=qs['limit'](_0x316aa1[_0x5432('0x47')][_0x5432('0x2d')]);_0x46b746[_0x5432('0x2c')]=qs[_0x5432('0x2c')](_0x316aa1[_0x5432('0x47')][_0x5432('0x2c')]);}_0x46b746['order']=qs[_0x5432('0x105')](_0x316aa1[_0x5432('0x47')][_0x5432('0x105')]);_0x46b746[_0x5432('0x83')]=qs[_0x5432('0x48')](_[_0x5432('0x50')](_0x316aa1['query'],_0x361b29[_0x5432('0x48')]));_0x46b746[_0x5432('0x83')][_0x5432('0x106')]=_0x5098bc['id'];if(_0x316aa1[_0x5432('0x47')]['filter']){_0x46b746[_0x5432('0x83')]=_['merge'](_0x46b746[_0x5432('0x83')],{'$or':_[_0x5432('0x40')](_0x46b746[_0x5432('0x4b')],function(_0x431473){var _0x2f0598={};_0x2f0598[_0x431473]={'$like':'%'+_0x316aa1[_0x5432('0x47')]['filter']+'%'};return _0x2f0598;})});}if(_0x316aa1[_0x5432('0x47')][_0x5432('0x86')]){var _0x1c3fc6=_0x316aa1[_0x5432('0x47')][_0x5432('0x86')]['split'](',');var _0x3f4ba2={};_0x3f4ba2[_0x1c3fc6[0x0]]={'$gte':moment(_0x1c3fc6[0x1])[_0x5432('0xea')]('YYYY-MM-DD\x20HH:mm:ss')};_0x46b746[_0x5432('0x83')]=_[_0x5432('0xc2')](_0x46b746['where'],_0x3f4ba2);}_0x46b746=_[_0x5432('0xc2')]({},_0x46b746,_0x316aa1[_0x5432('0xc3')]);return db['ChatMessage'][_0x5432('0x2b')]({'where':_0x46b746[_0x5432('0x83')]})['then'](function(_0x1b9082){_0x2d9c3d[_0x5432('0x2b')]=_0x1b9082;if(_0x316aa1[_0x5432('0x47')][_0x5432('0xc0')]){_0x46b746[_0x5432('0xc1')]=[{'all':!![]}];}return db['ChatMessage'][_0x5432('0x107')](_0x46b746);})[_0x5432('0x20')](function(_0xa5eb40){_0x2d9c3d['rows']=_0xa5eb40;return _0x2d9c3d;});}})[_0x5432('0x20')](respondWithFilteredResult(_0x52f5c7,_0x46b746))[_0x5432('0x3f')](handleError(_0x52f5c7,null));};exports[_0x5432('0x108')]=function(_0x4b7cd7,_0x50a55f,_0x4cea33){var _0x5849d6={'where':{}},_0x33386b={},_0x855af3={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5432('0xc7')]({'where':{'id':_0x4b7cd7[_0x5432('0xbf')]['id']}})['then'](handleEntityNotFound(_0x50a55f,null))[_0x5432('0x20')](function(_0x4ba77c){if(_0x4ba77c){_0x33386b[_0x5432('0x46')]=_[_0x5432('0x7d')](db[_0x5432('0xd1')][_0x5432('0x42')]);_0x33386b[_0x5432('0x47')]=_['keys'](_0x4b7cd7[_0x5432('0x47')]);_0x33386b[_0x5432('0x48')]=_[_0x5432('0x49')](_0x33386b['model'],_0x33386b[_0x5432('0x47')]);_0x5849d6[_0x5432('0x4b')]=_['intersection'](_0x33386b[_0x5432('0x46')],qs[_0x5432('0x4a')](_0x4b7cd7[_0x5432('0x47')]['fields']));_0x5849d6['attributes']=_0x5849d6[_0x5432('0x4b')]['length']?_0x5849d6['attributes']:_0x33386b[_0x5432('0x46')];if(!_0x4b7cd7[_0x5432('0x47')]['hasOwnProperty'](_0x5432('0x4e'))){_0x5849d6[_0x5432('0x2d')]=qs[_0x5432('0x2d')](_0x4b7cd7[_0x5432('0x47')][_0x5432('0x2d')]);_0x5849d6[_0x5432('0x2c')]=qs[_0x5432('0x2c')](_0x4b7cd7['query'][_0x5432('0x2c')]);}_0x5849d6[_0x5432('0x4f')]=qs[_0x5432('0x105')](_0x4b7cd7['query'][_0x5432('0x105')]);_0x5849d6['where']=qs[_0x5432('0x48')](_[_0x5432('0x50')](_0x4b7cd7[_0x5432('0x47')],_0x33386b[_0x5432('0x48')]));_0x5849d6[_0x5432('0x83')][_0x5432('0x106')]=_0x4ba77c['id'];if(_0x4b7cd7['query']['filter']){_0x5849d6[_0x5432('0x83')]=_[_0x5432('0xc2')](_0x5849d6['where'],{'$or':_[_0x5432('0x40')](_0x5849d6[_0x5432('0x4b')],function(_0x47b945){var _0x18da80={};_0x18da80[_0x47b945]={'$like':'%'+_0x4b7cd7[_0x5432('0x47')][_0x5432('0x91')]+'%'};return _0x18da80;})});}_0x5849d6['where'][_0x5432('0xf6')]=![];if(_0x4b7cd7[_0x5432('0x47')]['id']){_0x5849d6[_0x5432('0x83')]['id']={'$gt':_0x4b7cd7[_0x5432('0x47')]['id']};}_0x5849d6=_[_0x5432('0xc2')]({},_0x5849d6,_0x4b7cd7[_0x5432('0xc3')]);return db[_0x5432('0xd1')]['count']({'where':_0x5849d6[_0x5432('0x83')]})[_0x5432('0x20')](function(_0x55c093){_0x855af3[_0x5432('0x2b')]=_0x55c093;_0x5849d6['include']=[];if(_0x4b7cd7[_0x5432('0x47')]['includeAgent']){_0x5849d6['include'][_0x5432('0x3e')]({'model':db[_0x5432('0x7b')],'as':_0x5432('0x7b'),'attributes':['id',_0x5432('0x3a'),_0x5432('0xf3')]});}if(_0x4b7cd7[_0x5432('0x47')]['includeAll']){_0x5849d6['include']=[{'all':!![]}];}return db[_0x5432('0xd1')]['findAll'](_0x5849d6);})[_0x5432('0x20')](function(_0x1d8b6f){_0x855af3[_0x5432('0xbd')]=_0x1d8b6f;return _0x855af3;});}})[_0x5432('0x20')](respondWithFilteredResult(_0x50a55f,_0x5849d6))[_0x5432('0x3f')](handleError(_0x50a55f,null));};exports[_0x5432('0x109')]=function(_0x1119d8,_0x404ba3,_0x30463f){return db['ChatInteraction']['find']({'where':{'id':_0x1119d8[_0x5432('0xbf')]['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x404ba3,null))[_0x5432('0x20')](function(_0x2e9669){if(_0x2e9669){return _0x2e9669[_0x5432('0x10a')](_0x1119d8[_0x5432('0x7c')][_0x5432('0x104')],_[_0x5432('0x103')](_0x1119d8[_0x5432('0x7c')],[_0x5432('0x104'),'id'])||{})[_0x5432('0x10b')](function(){return db[_0x5432('0x78')][_0x5432('0x107')]({'attributes':['id',_0x5432('0x37'),_0x5432('0x53')],'where':{'id':_0x1119d8[_0x5432('0x7c')]['ids']}});})[_0x5432('0x20')](function(_0x1d3bd1){socket[_0x5432('0x10c')](_0x5432('0x10d'),{'id':Number(_0x1119d8[_0x5432('0xbf')]['id']),'tags':_0x1d3bd1||[]});return{'id':Number(_0x1119d8[_0x5432('0xbf')]['id']),'tags':_0x1d3bd1||[]};});}})[_0x5432('0x20')](respondWithResult(_0x404ba3,null))[_0x5432('0x3f')](handleError(_0x404ba3,null));};exports[_0x5432('0x10e')]=function(_0xb2a132,_0x4d9757,_0x9c47c1){return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0xb2a132[_0x5432('0xbf')]['id']}})['then'](handleEntityNotFound(_0x4d9757,null))[_0x5432('0x20')](function(_0x1fccdf){if(_0x1fccdf){return _0x1fccdf[_0x5432('0x10e')](_0xb2a132[_0x5432('0x47')][_0x5432('0x104')]);}})['then'](respondWithStatusCode(_0x4d9757,null))['catch'](handleError(_0x4d9757,null));};exports[_0x5432('0xe5')]=function(_0x22ae00,_0x2a0ba9){var _0x593e9f=moment()[_0x5432('0x10f')]()[_0x5432('0xa4')]();var _0x3489a0=path['join'](config[_0x5432('0xe8')],_0x5432('0x110'),_0x5432('0x111'),_0x5432('0x112'));var _0x362a42=path[_0x5432('0xe6')](config[_0x5432('0xe8')],_0x5432('0x110'),'files','attachments');var _0x5c97b7=path['join'](_0x3489a0,_0x593e9f);var _0xfb4184=util[_0x5432('0xea')]('transcript-%d-%s.zip',_0x22ae00[_0x5432('0xbf')]['id'],_0x593e9f);var _0xb80586=path[_0x5432('0xe6')](_0x3489a0,_0xfb4184);var _0x1753c3=[];_0x1753c3['push']({'model':db[_0x5432('0x7b')],'as':_0x5432('0x7b'),'attributes':['id',_0x5432('0x3a')],'raw':!![]});_0x1753c3['push']({'model':db[_0x5432('0x113')],'as':_0x5432('0x6e'),'attributes':['id','firstName',_0x5432('0x114')],'raw':!![]});if(_0x22ae00[_0x5432('0x47')][_0x5432('0x115')]){_0x1753c3[_0x5432('0x3e')]({'model':db[_0x5432('0xe0')],'as':_0x5432('0xe0'),'raw':!![]});}var _0x4620f4=[{'model':db[_0x5432('0xd1')],'as':_0x5432('0xed'),'attributes':['id','body',_0x5432('0x85'),_0x5432('0x116'),_0x5432('0xf6'),_0x5432('0x8d')],'include':_0x1753c3}];_0x4620f4[_0x5432('0x3e')]({'model':db[_0x5432('0xc8')],'as':_0x5432('0x117'),'attributes':['id',_0x5432('0x37')]});_0x4620f4[_0x5432('0x3e')]({'model':db[_0x5432('0x7b')],'as':_0x5432('0x118'),'attributes':['id',_0x5432('0x3a')]});return db['ChatInteraction']['find']({'where':{'id':_0x22ae00[_0x5432('0xbf')]['id']},'include':_0x4620f4})[_0x5432('0x20')](handleEntityNotFound(_0x2a0ba9,null))[_0x5432('0x20')](function(_0x521ba8){if(_0x521ba8){var _0x3504d7=_0x521ba8['get']({'plain':!![]});fs[_0x5432('0x119')](_0x5c97b7);var _0x321d5f={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x5432('0x11a')}},'footer':{'height':'30px','contents':{'default':util[_0x5432('0xea')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x5432('0xea')](_0x5432('0x11b'),_0x5432('0x11c'),_0x3504d7['id']),moment()[_0x5432('0xea')](_0x5432('0x11d'))['toString']())}}};var _0x2e4b2d={'channel':'Chat','account':_0x3504d7['Account'][_0x5432('0x37')],'agent':_0x3504d7[_0x5432('0x118')]?_0x3504d7[_0x5432('0x118')]['fullname']:_0x5432('0x11e'),'createdAt':moment(_0x3504d7['createdAt'])[_0x5432('0xea')](_0x5432('0x11f'))[_0x5432('0xa4')](),'closedAt':_0x3504d7['closed']?moment(_0x3504d7[_0x5432('0x120')])[_0x5432('0xea')](_0x5432('0x11f'))[_0x5432('0xa4')]():'','disposition':_0x3504d7['disposition'],'chatInfo':{'browser':_0x3504d7['browserName'],'os':_0x3504d7[_0x5432('0x121')],'referer':_0x3504d7['referer'],'customerIp':_0x3504d7[_0x5432('0x122')],'customerPort':_0x3504d7[_0x5432('0x123')]?_0x3504d7[_0x5432('0x123')]:_0x5432('0x11e')},'messages':_(_0x3504d7[_0x5432('0xed')])['tail']()[_0x5432('0x91')]({'secret':![]})[_0x5432('0x40')](function(_0x19b279){if(_0x19b279[_0x5432('0xe0')]){var _0x332560=path[_0x5432('0xe6')](_0x362a42,_0x19b279[_0x5432('0xe0')][_0x5432('0xdc')]);if(fs[_0x5432('0x124')](_0x332560)){fs[_0x5432('0x125')](_0x332560)['pipe'](fs[_0x5432('0x126')](path['join'](_0x5c97b7,_0x19b279[_0x5432('0xe0')][_0x5432('0xdc')])));}}return{'date':moment(_0x19b279[_0x5432('0x85')])[_0x5432('0xea')](_0x5432('0x11f'))[_0x5432('0xa4')](),'sender':_0x19b279[_0x5432('0x116')]===_0x5432('0xd0')?_0x19b279[_0x5432('0x7b')]?_0x19b279['User']['fullname']:_0x5432('0xef'):_0x19b279['Contact']['firstName']+(_0x19b279[_0x5432('0x6e')][_0x5432('0x114')]?'\x20'+_0x19b279[_0x5432('0x6e')][_0x5432('0x114')]:''),'body':_0x19b279[_0x5432('0xe0')]?_0x19b279[_0x5432('0xe0')][_0x5432('0xdc')]:_0x19b279[_0x5432('0x7c')],'direction':_0x19b279[_0x5432('0x116')]===_0x5432('0xd0')?'A':'C','secret':_0x19b279[_0x5432('0xf6')],'read':_0x19b279[_0x5432('0x8d')],'attachment':_0x19b279[_0x5432('0xe0')]};})[_0x5432('0x6b')]()};return ejs[_0x5432('0x127')](path[_0x5432('0xe6')](config[_0x5432('0xe8')],'server',_0x5432('0x128'),_0x5432('0x129')),{'interaction':_0x2e4b2d})[_0x5432('0x20')](function(_0x59ad68){return new BPromise(function(_0xb3812d,_0x806b98){pdf[_0x5432('0xc4')](_0x59ad68,_0x321d5f)[_0x5432('0x12a')](path['join'](_0x5c97b7,_0x5432('0x12b')+_0x3504d7['id']+'-'+_0x593e9f+_0x5432('0x12c')),function(_0x4537e0,_0x2f13c9){if(_0x4537e0)return _0x806b98(_0x4537e0);_0xb3812d(_0x2f13c9);});});})[_0x5432('0x20')](function(){return new BPromise(function(_0x337345,_0x5945b1){zipdir(_0x5c97b7,{'saveTo':_0xb80586},function(_0x4af49d,_0x287e3f){if(_0x4af49d)return _0x5945b1(_0x4af49d);return _0x337345(_0x287e3f);});})[_0x5432('0x20')](function(){return new BPromise(function(_0x20eed8,_0x4a9db2){rimraf(_0x5c97b7,function(_0x374f00){if(_0x374f00)_0x4a9db2(_0x374f00);return _0x20eed8();});});})[_0x5432('0x20')](function(){return _0x2a0ba9[_0x5432('0xe5')](_0xb80586,_0xfb4184,function(_0x367efa){if(_0x367efa){console['log'](_0x5432('0x12d'),_0x367efa);}else{fs[_0x5432('0x12e')](_0xb80586);}});});});}else{return _0x2a0ba9['sendStatus'](0xc8);}})[_0x5432('0x3f')](handleError(_0x2a0ba9,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 3cf44ce..d995cd9 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 _0xea21=['findAll','unreadMessages','emit','hook','exports','../../mysqldb','ChatMessage','save','remove','then','setDataValue','Users','map'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xea21,0x109));var _0x1ea2=function(_0x19e3dc,_0x54b281){_0x19e3dc=_0x19e3dc-0x0;var _0x14a1dc=_0xea21[_0x19e3dc];return _0x14a1dc;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x1ea2('0x0'))['db'][_0x1ea2('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ea2('0x2'),'afterUpdate':'update','afterDestroy':_0x1ea2('0x3')};function emitEvent(_0x5c7852){return function(_0x44e926,_0xc6f39,_0x29a098){_0x44e926['getUsers']({'attributes':['id'],'raw':!![]})[_0x1ea2('0x4')](function(_0x1f81c6){_0x44e926[_0x1ea2('0x5')](_0x1ea2('0x6'),_0x1f81c6[_0x1ea2('0x7')](function(_0x449af0){return{'id':_0x449af0['id']};}));return ChatMessage[_0x1ea2('0x8')]({'where':{'ChatInteractionId':_0x44e926['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1ea2('0x4')](function(_0x4f6f2c){_0x44e926[_0x1ea2('0x5')](_0x1ea2('0x9'),_0x4f6f2c['length']);ChatInteractionEvents[_0x1ea2('0xa')](_0x5c7852+':'+_0x44e926['id'],_0x44e926);ChatInteractionEvents['emit'](_0x5c7852,_0x44e926);_0x29a098(null);})['catch'](_0x29a098(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x1ea2('0xb')](e,emitEvent(event));}}module[_0x1ea2('0xc')]=ChatInteractionEvents; \ No newline at end of file +var _0xa9fc=['findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','save','remove','getUsers','setDataValue','Users','map'];(function(_0x4d6904,_0x584a8f){var _0x2f5169=function(_0x2d2b62){while(--_0x2d2b62){_0x4d6904['push'](_0x4d6904['shift']());}};_0x2f5169(++_0x584a8f);}(_0xa9fc,0x19f));var _0xca9f=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xa9fc[_0x2d2c16];return _0x53f2fb;};'use strict';var EventEmitter=require(_0xca9f('0x0'));var ChatInteraction=require(_0xca9f('0x1'))['db'][_0xca9f('0x2')];var ChatMessage=require(_0xca9f('0x1'))['db'][_0xca9f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca9f('0x4'),'afterUpdate':'update','afterDestroy':_0xca9f('0x5')};function emitEvent(_0x32709b){return function(_0x5d2ddf,_0x5eb9af,_0x5c7268){_0x5d2ddf[_0xca9f('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x39963d){_0x5d2ddf[_0xca9f('0x7')](_0xca9f('0x8'),_0x39963d[_0xca9f('0x9')](function(_0x244d4d){return{'id':_0x244d4d['id']};}));return ChatMessage[_0xca9f('0xa')]({'where':{'ChatInteractionId':_0x5d2ddf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xca9f('0xb')](function(_0x5ae48c){_0x5d2ddf['setDataValue'](_0xca9f('0xc'),_0x5ae48c[_0xca9f('0xd')]);ChatInteractionEvents[_0xca9f('0xe')](_0x32709b+':'+_0x5d2ddf['id'],_0x5d2ddf);ChatInteractionEvents[_0xca9f('0xe')](_0x32709b,_0x5d2ddf);_0x5c7268(null);})['catch'](_0x5c7268(null));};}for(var e in events){if(events[_0xca9f('0xf')](e)){var event=events[e];ChatInteraction[_0xca9f('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c73ba14..2f196b6 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 _0x3245=['changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction'];(function(_0x1c0bd3,_0x4014bc){var _0x886e6e=function(_0xd04ee3){while(--_0xd04ee3){_0x1c0bd3['push'](_0x1c0bd3['shift']());}};_0x886e6e(++_0x4014bc);}(_0x3245,0x1c4));var _0x5324=function(_0x1120c7,_0x18f931){_0x1120c7=_0x1120c7-0x0;var _0x436f8a=_0x3245[_0x1120c7];return _0x436f8a;};'use strict';var _=require(_0x5324('0x0'));var util=require(_0x5324('0x1'));var logger=require(_0x5324('0x2'))(_0x5324('0x3'));var moment=require(_0x5324('0x4'));var BPromise=require(_0x5324('0x5'));var rp=require(_0x5324('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5324('0x7'));var config=require(_0x5324('0x8'));var attributes=require(_0x5324('0x9'));module[_0x5324('0xa')]=function(_0x39a320,_0x30d984){return _0x39a320['define'](_0x5324('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fbc72,_0x3605de,_0x28bc16){if(_0x3fbc72[_0x5324('0xc')]('closed')){_0x3fbc72[_0x5324('0xd')]=moment()['format'](_0x5324('0xe'));}_0x28bc16(null,_0x3fbc72);}},'charset':_0x5324('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfb97=['format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfb97,0x17d));var _0x7fb9=function(_0x5d68a2,_0x4304cf){_0x5d68a2=_0x5d68a2-0x0;var _0x5b3088=_0xfb97[_0x5d68a2];return _0x5b3088;};'use strict';var _=require(_0x7fb9('0x0'));var util=require(_0x7fb9('0x1'));var logger=require(_0x7fb9('0x2'))('api');var moment=require(_0x7fb9('0x3'));var BPromise=require(_0x7fb9('0x4'));var rp=require(_0x7fb9('0x5'));var fs=require('fs');var path=require(_0x7fb9('0x6'));var rimraf=require(_0x7fb9('0x7'));var config=require(_0x7fb9('0x8'));var attributes=require(_0x7fb9('0x9'));module[_0x7fb9('0xa')]=function(_0x1b05e7,_0xbec385){return _0x1b05e7[_0x7fb9('0xb')]('ChatInteraction',attributes,{'tableName':_0x7fb9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23c80b,_0x23cc1f,_0x1372d3){if(_0x23c80b[_0x7fb9('0xd')](_0x7fb9('0xe'))){_0x23c80b['closedAt']=moment()[_0x7fb9('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1372d3(null,_0x23c80b);}},'charset':_0x7fb9('0x10'),'collate':_0x7fb9('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 92d337a..6e09952 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 _0x400f=['then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','AddTags','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','redis','./chatInteraction.socket','register','request'];(function(_0x4f98bd,_0x5a478d){var _0x143a7d=function(_0xb4e744){while(--_0xb4e744){_0x4f98bd['push'](_0x4f98bd['shift']());}};_0x143a7d(++_0x5a478d);}(_0x400f,0xb6));var _0xf400=function(_0x11fb34,_0x14675b){_0x11fb34=_0x11fb34-0x0;var _0x160715=_0x400f[_0x11fb34];return _0x160715;};'use strict';var _=require(_0xf400('0x0'));var util=require(_0xf400('0x1'));var moment=require('moment');var BPromise=require(_0xf400('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf400('0x3'))(_0xf400('0x4'));var config=require(_0xf400('0x5'));var jayson=require(_0xf400('0x6'));var client=jayson['client'][_0xf400('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf400('0x8'))(new Redis(config[_0xf400('0x9')]));require(_0xf400('0xa'))[_0xf400('0xb')](socket);function respondWithRpcPromise(_0x3fa674,_0x5a8e84,_0x7b62f0){return new BPromise(function(_0x3e3eb2,_0x43255b){return client[_0xf400('0xc')](_0x3fa674,_0x7b62f0)[_0xf400('0xd')](function(_0x168c59){logger[_0xf400('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x5a8e84,_0xf400('0xf'));logger[_0xf400('0x10')](_0xf400('0x11'),_0x5a8e84,_0xf400('0xf'),JSON[_0xf400('0x12')](_0x168c59));if(_0x168c59[_0xf400('0x13')]){if(_0x168c59[_0xf400('0x13')][_0xf400('0x14')]===0x1f4){logger[_0xf400('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x5a8e84,_0x168c59['error'][_0xf400('0x15')]);return _0x43255b(_0x168c59[_0xf400('0x13')]['message']);}logger[_0xf400('0x13')](_0xf400('0x16'),_0x5a8e84,_0x168c59['error'][_0xf400('0x15')]);return _0x3e3eb2(_0x168c59[_0xf400('0x13')]['message']);}else{logger[_0xf400('0xe')](_0xf400('0x16'),_0x5a8e84,'request\x20sent');_0x3e3eb2(_0x168c59[_0xf400('0x17')]['message']);}})[_0xf400('0x18')](function(_0x56b868){logger['error'](_0xf400('0x16'),_0x5a8e84,_0x56b868);_0x43255b(_0x56b868);});});}exports[_0xf400('0x19')]=function(_0x5ad35d){var _0x49ebe8=this;return new Promise(function(_0x4f82a0,_0x2123da){return db[_0xf400('0x1a')][_0xf400('0x1b')](_0x5ad35d[_0xf400('0x1c')],{'raw':_0x5ad35d['options']?_0x5ad35d[_0xf400('0x1d')][_0xf400('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ad35d[_0xf400('0x1d')]?_0x5ad35d[_0xf400('0x1d')][_0xf400('0x1f')]||null:null,'attributes':_0x5ad35d['options']?_0x5ad35d[_0xf400('0x1d')][_0xf400('0x20')]||null:null,'limit':_0x5ad35d[_0xf400('0x1d')]?_0x5ad35d[_0xf400('0x1d')][_0xf400('0x21')]||null:null})[_0xf400('0xd')](function(_0x4bd5b1){logger[_0xf400('0xe')](_0xf400('0x19'),_0x5ad35d);logger[_0xf400('0x10')](_0xf400('0x19'),_0x5ad35d,JSON[_0xf400('0x12')](_0x4bd5b1));_0x4f82a0(_0x4bd5b1);})[_0xf400('0x18')](function(_0x5560ed){logger['error'](_0xf400('0x19'),_0x5560ed[_0xf400('0x15')],_0x5ad35d);_0x2123da(_0x49ebe8['error'](0x1f4,_0x5560ed[_0xf400('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x524032){return new Promise(function(_0x40d22c,_0x213fdb){return db[_0xf400('0x1a')][_0xf400('0x22')]({'where':_0x524032[_0xf400('0x1d')]?_0x524032['options'][_0xf400('0x1f')]||null:null})[_0xf400('0xd')](function(_0x4584f2){if(_0x4584f2){return _0x4584f2[_0xf400('0x23')](_0x524032['body'][_0xf400('0x24')],_[_0xf400('0x25')](_0x524032[_0xf400('0x1c')],[_0xf400('0x24'),'id'])||{});}})['spread'](function(_0xa00a1c){logger[_0xf400('0xe')](_0xf400('0x26'),_0x524032);logger[_0xf400('0x10')](_0xf400('0x26'),_0x524032,JSON[_0xf400('0x12')](_0xa00a1c));_0x40d22c(_0xa00a1c);})['catch'](function(_0x104cde){logger['error']('AddTags',_0x104cde[_0xf400('0x15')],_0x524032);_0x213fdb(_this[_0xf400('0x13')](0x1f4,_0x104cde['message']));});});}; \ No newline at end of file +var _0x0401=['bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','ChatInteraction','update','body','options','where','attributes','limit','UpdateChatInteraction','stringify','find','omit','spread','AddTags','lodash','util','moment'];(function(_0x28f3c8,_0x4b8b8f){var _0x153e3e=function(_0x19efb3){while(--_0x19efb3){_0x28f3c8['push'](_0x28f3c8['shift']());}};_0x153e3e(++_0x4b8b8f);}(_0x0401,0x194));var _0x1040=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x0401[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x1040('0x0'));var util=require(_0x1040('0x1'));var moment=require(_0x1040('0x2'));var BPromise=require(_0x1040('0x3'));var rs=require(_0x1040('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1040('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1040('0x6'));var jayson=require(_0x1040('0x7'));var client=jayson[_0x1040('0x8')]['http']({'port':0x232a});config[_0x1040('0x9')]=_[_0x1040('0xa')](config['redis'],{'host':_0x1040('0xb'),'port':0x18eb});var socket=require(_0x1040('0xc'))(new Redis(config[_0x1040('0x9')]));require(_0x1040('0xd'))['register'](socket);function respondWithRpcPromise(_0x52ded2,_0x3c6e60,_0x55822a){return new BPromise(function(_0x23604d,_0xc519ec){return client[_0x1040('0xe')](_0x52ded2,_0x55822a)[_0x1040('0xf')](function(_0x194168){logger[_0x1040('0x10')](_0x1040('0x11'),_0x3c6e60,_0x1040('0x12'));logger[_0x1040('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3c6e60,_0x1040('0x12'),JSON['stringify'](_0x194168));if(_0x194168[_0x1040('0x14')]){if(_0x194168['error']['code']===0x1f4){logger['error'](_0x1040('0x11'),_0x3c6e60,_0x194168['error'][_0x1040('0x15')]);return _0xc519ec(_0x194168[_0x1040('0x14')]['message']);}logger[_0x1040('0x14')](_0x1040('0x11'),_0x3c6e60,_0x194168[_0x1040('0x14')][_0x1040('0x15')]);return _0x23604d(_0x194168['error'][_0x1040('0x15')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3c6e60,_0x1040('0x12'));_0x23604d(_0x194168[_0x1040('0x16')][_0x1040('0x15')]);}})[_0x1040('0x17')](function(_0x1960f9){logger[_0x1040('0x14')](_0x1040('0x11'),_0x3c6e60,_0x1960f9);_0xc519ec(_0x1960f9);});});}exports['UpdateChatInteraction']=function(_0x5f545b){var _0x218750=this;return new Promise(function(_0x323646,_0x34633f){return db[_0x1040('0x18')][_0x1040('0x19')](_0x5f545b[_0x1040('0x1a')],{'raw':_0x5f545b[_0x1040('0x1b')]?_0x5f545b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f545b[_0x1040('0x1b')]?_0x5f545b[_0x1040('0x1b')][_0x1040('0x1c')]||null:null,'attributes':_0x5f545b['options']?_0x5f545b[_0x1040('0x1b')][_0x1040('0x1d')]||null:null,'limit':_0x5f545b['options']?_0x5f545b['options'][_0x1040('0x1e')]||null:null})[_0x1040('0xf')](function(_0x6739aa){logger['info'](_0x1040('0x1f'),_0x5f545b);logger[_0x1040('0x13')](_0x1040('0x1f'),_0x5f545b,JSON[_0x1040('0x20')](_0x6739aa));_0x323646(_0x6739aa);})[_0x1040('0x17')](function(_0x3a3526){logger[_0x1040('0x14')]('UpdateChatInteraction',_0x3a3526[_0x1040('0x15')],_0x5f545b);_0x34633f(_0x218750[_0x1040('0x14')](0x1f4,_0x3a3526[_0x1040('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x166de2){return new Promise(function(_0x325f9a,_0x502912){return db['ChatInteraction'][_0x1040('0x21')]({'where':_0x166de2[_0x1040('0x1b')]?_0x166de2[_0x1040('0x1b')][_0x1040('0x1c')]||null:null})['then'](function(_0x41d99a){if(_0x41d99a){return _0x41d99a['addTags'](_0x166de2[_0x1040('0x1a')]['ids'],_[_0x1040('0x22')](_0x166de2[_0x1040('0x1a')],['ids','id'])||{});}})[_0x1040('0x23')](function(_0xba2fd3){logger[_0x1040('0x10')](_0x1040('0x24'),_0x166de2);logger[_0x1040('0x13')]('AddTags',_0x166de2,JSON[_0x1040('0x20')](_0xba2fd3));_0x325f9a(_0xba2fd3);})[_0x1040('0x17')](function(_0xda43cc){logger[_0x1040('0x14')]('AddTags',_0xda43cc[_0x1040('0x15')],_0x166de2);_0x502912(_this['error'](0x1f4,_0xda43cc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c174c37..e6117f3 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 _0x4ce3=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','update'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x4ce3,0x1be));var _0x34ce=function(_0x112c0d,_0x5af795){_0x112c0d=_0x112c0d-0x0;var _0xcb9325=_0x4ce3[_0x112c0d];return _0xcb9325;};'use strict';var ChatInteractionEvents=require(_0x34ce('0x0'));var events=['save','remove',_0x34ce('0x1')];function createListener(_0x50cf5b,_0x44ab70){return function(_0x333ff4){_0x44ab70[_0x34ce('0x2')](_0x50cf5b,_0x333ff4);};}function removeListener(_0x4f60a4,_0x55ec2c){return function(){ChatInteractionEvents[_0x34ce('0x3')](_0x4f60a4,_0x55ec2c);};}exports[_0x34ce('0x4')]=function(_0x21dcab){for(var _0x2bc5f4=0x0,_0x242f1c=events[_0x34ce('0x5')];_0x2bc5f4<_0x242f1c;_0x2bc5f4++){var _0xa54b2f=events[_0x2bc5f4];var _0x54f844=createListener(_0x34ce('0x6')+_0xa54b2f,_0x21dcab);ChatInteractionEvents['on'](_0xa54b2f,_0x54f844);}}; \ No newline at end of file +var _0xefd4=['emit','removeListener','register','length','chatInteraction:','save','remove'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xefd4,0x14e));var _0x4efd=function(_0x13549a,_0x1ae1aa){_0x13549a=_0x13549a-0x0;var _0x49b032=_0xefd4[_0x13549a];return _0x49b032;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4efd('0x0'),_0x4efd('0x1'),'update'];function createListener(_0x1e7e84,_0x184bcd){return function(_0x1fc719){_0x184bcd[_0x4efd('0x2')](_0x1e7e84,_0x1fc719);};}function removeListener(_0x1995e6,_0x3790a7){return function(){ChatInteractionEvents[_0x4efd('0x3')](_0x1995e6,_0x3790a7);};}exports[_0x4efd('0x4')]=function(_0x100124){for(var _0x53be77=0x0,_0x1a267f=events[_0x4efd('0x5')];_0x53be77<_0x1a267f;_0x53be77++){var _0x106ae5=events[_0x53be77];var _0x2d6954=createListener(_0x4efd('0x6')+_0x106ae5,_0x100124);ChatInteractionEvents['on'](_0x106ae5,_0x2d6954);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1991aed..405f136 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 _0xd878=['originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','%s-%s','now'];(function(_0x113202,_0x138d83){var _0xfa095=function(_0xb3746b){while(--_0xb3746b){_0x113202['push'](_0x113202['shift']());}};_0xfa095(++_0x138d83);}(_0xd878,0x118));var _0x8d87=function(_0x5016a2,_0xfaec3d){_0x5016a2=_0x5016a2-0x0;var _0xfac792=_0xd878[_0x5016a2];return _0xfac792;};'use strict';var multer=require(_0x8d87('0x0'));var util=require(_0x8d87('0x1'));var path=require(_0x8d87('0x2'));var timeout=require(_0x8d87('0x3'));var express=require(_0x8d87('0x4'));var router=express[_0x8d87('0x5')]();var auth=require(_0x8d87('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x8d87('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8d87('0x7')](_0x8d87('0x8'),auth[_0x8d87('0x9')](),controller[_0x8d87('0xa')]);router[_0x8d87('0x7')](_0x8d87('0xb'),auth[_0x8d87('0xc')](),controller[_0x8d87('0xd')]);router[_0x8d87('0x7')]('/:id/attachment_download',auth[_0x8d87('0xc')](),controller['attachmentDownload']);router['get'](_0x8d87('0xe'),auth[_0x8d87('0x9')](),controller[_0x8d87('0xf')]);router[_0x8d87('0x7')](_0x8d87('0x10'),auth[_0x8d87('0xc')](),controller['getMyMessages']);router[_0x8d87('0x7')]('/:id/download',auth[_0x8d87('0x9')](),controller['download']);router[_0x8d87('0x11')]('/',auth[_0x8d87('0x9')](),controller[_0x8d87('0x12')]);router['post'](_0x8d87('0x13'),auth[_0x8d87('0x9')](),controller[_0x8d87('0x14')]);var upload=multer({'storage':multer[_0x8d87('0x15')]({'destination':function(_0x5954d3,_0x1d6695,_0x28c54e){_0x28c54e(null,path[_0x8d87('0x16')](config[_0x8d87('0x17')],'server/files/attachments/'));},'filename':function(_0x34ead7,_0x3326d5,_0x5b627f){_0x5b627f(null,util['format'](_0x8d87('0x18'),Date[_0x8d87('0x19')](),_0x3326d5[_0x8d87('0x1a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8d87('0x11')](_0x8d87('0x1b'),upload[_0x8d87('0x1c')](_0x8d87('0x1d')),controller[_0x8d87('0x1e')]);router[_0x8d87('0x11')](_0x8d87('0xe'),auth[_0x8d87('0xc')](),controller[_0x8d87('0x1f')]);router[_0x8d87('0x11')](_0x8d87('0x20'),auth[_0x8d87('0x9')](),interaction[_0x8d87('0x21')](_0x8d87('0x22'),_0x8d87('0x23')),controller[_0x8d87('0x24')]);router[_0x8d87('0x25')](_0x8d87('0xb'),auth[_0x8d87('0x9')](),interaction['tracked'](_0x8d87('0x22'),_0x8d87('0x26')),controller[_0x8d87('0x27')]);router['put'](_0x8d87('0x28'),controller[_0x8d87('0x29')]);router[_0x8d87('0x25')](_0x8d87('0x2a'),auth[_0x8d87('0xc')](),controller[_0x8d87('0x2b')]);router[_0x8d87('0x25')](_0x8d87('0x2c'),controller[_0x8d87('0x2d')]);router[_0x8d87('0x2e')](_0x8d87('0xb'),auth[_0x8d87('0x9')](),interaction[_0x8d87('0x21')](_0x8d87('0x22'),_0x8d87('0x2f')),controller[_0x8d87('0x30')]);router[_0x8d87('0x2e')](_0x8d87('0x20'),auth[_0x8d87('0x9')](),controller[_0x8d87('0x31')]);module[_0x8d87('0x32')]=router; \ No newline at end of file +var _0x105b=['chat','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','create','createVidaooSession','diskStorage','root','format','%s-%s','originalname','replace','post','/:id/attachment_upload','single','attachmentUpload','addMessage','tracked'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x105b,0x1a7));var _0xb105=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x105b[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0xb105('0x0'));var util=require(_0xb105('0x1'));var path=require(_0xb105('0x2'));var timeout=require(_0xb105('0x3'));var express=require(_0xb105('0x4'));var router=express[_0xb105('0x5')]();var auth=require(_0xb105('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb105('0x7'));var controller=require(_0xb105('0x8'));router[_0xb105('0x9')]('/',auth['isAuthenticated'](),controller[_0xb105('0xa')]);router[_0xb105('0x9')](_0xb105('0xb'),auth[_0xb105('0xc')](),controller[_0xb105('0xd')]);router[_0xb105('0x9')](_0xb105('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xb105('0xf')]);router[_0xb105('0x9')]('/:id/attachment_download',auth[_0xb105('0x10')](),controller[_0xb105('0x11')]);router[_0xb105('0x9')](_0xb105('0x12'),auth[_0xb105('0xc')](),controller['getMessages']);router[_0xb105('0x9')](_0xb105('0x13'),auth['isChatInteractionAuthorized'](),controller[_0xb105('0x14')]);router[_0xb105('0x9')](_0xb105('0x15'),auth[_0xb105('0xc')](),controller['download']);router['post']('/',auth[_0xb105('0xc')](),controller[_0xb105('0x16')]);router['post']('/:id/vidaoo',auth[_0xb105('0xc')](),controller[_0xb105('0x17')]);var upload=multer({'storage':multer[_0xb105('0x18')]({'destination':function(_0x1000d8,_0x37a7b8,_0x4c17df){_0x4c17df(null,path['join'](config[_0xb105('0x19')],'server/files/attachments/'));},'filename':function(_0x519ba6,_0x47316a,_0x2f7d98){_0x2f7d98(null,util[_0xb105('0x1a')](_0xb105('0x1b'),Date['now'](),_0x47316a[_0xb105('0x1c')][_0xb105('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb105('0x1e')](_0xb105('0x1f'),upload[_0xb105('0x20')]('file'),controller[_0xb105('0x21')]);router[_0xb105('0x1e')](_0xb105('0x12'),auth[_0xb105('0x10')](),controller[_0xb105('0x22')]);router[_0xb105('0x1e')]('/:id/tags',auth[_0xb105('0xc')](),interaction[_0xb105('0x23')](_0xb105('0x24'),'chatinteraction:addtags'),controller[_0xb105('0x25')]);router[_0xb105('0x26')](_0xb105('0xe'),auth[_0xb105('0xc')](),interaction['tracked'](_0xb105('0x24'),_0xb105('0x27')),controller[_0xb105('0x28')]);router[_0xb105('0x26')](_0xb105('0x29'),controller[_0xb105('0x2a')]);router[_0xb105('0x26')]('/:id/abandon',auth[_0xb105('0x10')](),controller[_0xb105('0x2b')]);router['put'](_0xb105('0x2c'),controller[_0xb105('0x2d')]);router[_0xb105('0x2e')](_0xb105('0xe'),auth['isAuthenticated'](),interaction[_0xb105('0x23')](_0xb105('0x24'),'chatinteraction:destroy'),controller[_0xb105('0x2f')]);router[_0xb105('0x2e')](_0xb105('0x30'),auth['isAuthenticated'](),controller[_0xb105('0x31')]);module[_0xb105('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 055e3ef..847c255 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 _0x66fa=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x9d4d4a,_0x5ac72f){var _0x393234=function(_0x37b9cf){while(--_0x37b9cf){_0x9d4d4a['push'](_0x9d4d4a['shift']());}};_0x393234(++_0x5ac72f);}(_0x66fa,0x117));var _0xa66f=function(_0x35d70c,_0x5628e6){_0x35d70c=_0x35d70c-0x0;var _0x5aeb21=_0x66fa[_0x35d70c];return _0x5aeb21;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa66f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa66f('0x4')]}}; \ No newline at end of file +var _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0x7a54,0x106));var _0x47a5=function(_0x3d2962,_0x5b22b2){_0x3d2962=_0x3d2962-0x0;var _0x567f30=_0x7a54[_0x3d2962];return _0x567f30;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 35f0d49..9a9e7e0 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 _0x9a99=['pick','filter','merge','options','includeAll','include','catch','show','params','find','create','body','update','describe','messages','lastMessageAt','createdAt','lastMessage','admin','user','userpic','internal','online','allowmessenger','-online','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','findAll','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','destroy','error','stack','name','index','ChatInternalMessage','rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x1effd2,_0x13627b){var _0x1d3bcf=function(_0x56be81){while(--_0x56be81){_0x1effd2['push'](_0x1effd2['shift']());}};_0x1d3bcf(++_0x13627b);}(_0x9a99,0x91));var _0x99a9=function(_0x16a93a,_0x1035d5){_0x16a93a=_0x16a93a-0x0;var _0x406b01=_0x9a99[_0x16a93a];return _0x406b01;};'use strict';var pdf=require(_0x99a9('0x0'));var emlformat=require(_0x99a9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x99a9('0x2'));var jsonpatch=require(_0x99a9('0x3'));var rp=require(_0x99a9('0x4'));var moment=require(_0x99a9('0x5'));var BPromise=require(_0x99a9('0x6'));var Mustache=require(_0x99a9('0x7'));var util=require(_0x99a9('0x8'));var path=require(_0x99a9('0x9'));var sox=require(_0x99a9('0xa'));var csv=require('to-csv');var ejs=require(_0x99a9('0xb'));var fs=require('fs');var _=require(_0x99a9('0xc'));var squel=require(_0x99a9('0xd'));var crypto=require(_0x99a9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x99a9('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a9('0x10'));var authService=require(_0x99a9('0x11'));var qs=require(_0x99a9('0x12'));var as=require(_0x99a9('0x13'));var hardwareService=require(_0x99a9('0x14'));var logger=require('../../config/logger')(_0x99a9('0x15'));var utils=require(_0x99a9('0x16'));var config=require('../../config/environment');var db=require(_0x99a9('0x17'))['db'];config[_0x99a9('0x18')]=_['defaults'](config[_0x99a9('0x18')],{'host':_0x99a9('0x19'),'port':0x18eb});var socket=require(_0x99a9('0x1a'))(new Redis(config[_0x99a9('0x18')]));require(_0x99a9('0x1b'))[_0x99a9('0x1c')](socket);function respondWithStatusCode(_0x3bef1a,_0x42cfe7){_0x42cfe7=_0x42cfe7||0xcc;return function(_0x1493c0){if(_0x1493c0){return _0x3bef1a[_0x99a9('0x1d')](_0x42cfe7);}return _0x3bef1a[_0x99a9('0x1e')](_0x42cfe7)[_0x99a9('0x1f')]();};}function respondWithResult(_0x524753,_0x2d7d21){_0x2d7d21=_0x2d7d21||0xc8;return function(_0x485150){if(_0x485150){return _0x524753[_0x99a9('0x1e')](_0x2d7d21)[_0x99a9('0x20')](_0x485150);}};}function respondWithFilteredResult(_0x3c3d03,_0x374662){return function(_0x17cee8){if(_0x17cee8){var _0x1c7fe6=_0x17cee8[_0x99a9('0x21')],_0x36ec89=_0x374662[_0x99a9('0x22')],_0x1ee72b=_0x374662['offset']+_0x374662[_0x99a9('0x23')],_0x4cab8b;if(_0x1ee72b>=_0x1c7fe6){_0x1ee72b=_0x1c7fe6;_0x4cab8b=0xc8;}else{_0x4cab8b=0xce;}_0x3c3d03[_0x99a9('0x1e')](_0x4cab8b);return _0x3c3d03['set']('Content-Range',_0x36ec89+'-'+_0x1ee72b+'/'+_0x1c7fe6)[_0x99a9('0x20')](_0x17cee8);}return null;};}function patchUpdates(_0x2b6b97){return function(_0x5498ee){try{jsonpatch[_0x99a9('0x24')](_0x5498ee,_0x2b6b97,!![]);}catch(_0x537740){return BPromise[_0x99a9('0x25')](_0x537740);}return _0x5498ee[_0x99a9('0x26')]();};}function saveUpdates(_0x18ae60,_0x55a9d8){return function(_0x1985a5){if(_0x1985a5){return _0x1985a5['update'](_0x18ae60)[_0x99a9('0x27')](function(_0x562218){return _0x562218;});}return null;};}function removeEntity(_0x1c1e13,_0x5bd047){return function(_0x66418e){if(_0x66418e){return _0x66418e[_0x99a9('0x28')]()['then'](function(){_0x1c1e13[_0x99a9('0x1e')](0xcc)[_0x99a9('0x1f')]();});}};}function handleEntityNotFound(_0x2d94db,_0x1dc968){return function(_0x3a9ac5){if(!_0x3a9ac5){_0x2d94db['sendStatus'](0x194);}return _0x3a9ac5;};}function handleError(_0x402d10,_0x33d843){_0x33d843=_0x33d843||0x1f4;return function(_0x4f753f){logger[_0x99a9('0x29')](_0x4f753f[_0x99a9('0x2a')]);if(_0x4f753f['name']){delete _0x4f753f[_0x99a9('0x2b')];}_0x402d10['status'](_0x33d843)['send'](_0x4f753f);};}exports[_0x99a9('0x2c')]=function(_0x56286a,_0x2ffd32){var _0x1f49c6={},_0x52d42c={},_0x282b0f={'count':0x0,'rows':[]};var _0x460edb=_['map'](db[_0x99a9('0x2d')][_0x99a9('0x2e')],function(_0xd3e853){return{'name':_0xd3e853['fieldName'],'type':_0xd3e853[_0x99a9('0x2f')][_0x99a9('0x30')]};});_0x52d42c[_0x99a9('0x31')]=_[_0x99a9('0x32')](_0x460edb,'name');_0x52d42c['query']=_[_0x99a9('0x33')](_0x56286a['query']);_0x52d42c['filters']=_[_0x99a9('0x34')](_0x52d42c[_0x99a9('0x31')],_0x52d42c[_0x99a9('0x35')]);_0x1f49c6[_0x99a9('0x36')]=_[_0x99a9('0x34')](_0x52d42c[_0x99a9('0x31')],qs[_0x99a9('0x37')](_0x56286a[_0x99a9('0x35')][_0x99a9('0x37')]));_0x1f49c6[_0x99a9('0x36')]=_0x1f49c6[_0x99a9('0x36')][_0x99a9('0x38')]?_0x1f49c6[_0x99a9('0x36')]:_0x52d42c[_0x99a9('0x31')];if(!_0x56286a['query'][_0x99a9('0x39')](_0x99a9('0x3a'))){_0x1f49c6[_0x99a9('0x23')]=qs[_0x99a9('0x23')](_0x56286a[_0x99a9('0x35')]['limit']);_0x1f49c6['offset']=qs[_0x99a9('0x22')](_0x56286a[_0x99a9('0x35')][_0x99a9('0x22')]);}_0x1f49c6[_0x99a9('0x3b')]=qs[_0x99a9('0x3c')](_0x56286a['query']['sort']);_0x1f49c6[_0x99a9('0x3d')]=qs[_0x99a9('0x3e')](_[_0x99a9('0x3f')](_0x56286a['query'],_0x52d42c[_0x99a9('0x3e')]),_0x460edb);if(_0x56286a[_0x99a9('0x35')][_0x99a9('0x40')]){_0x1f49c6[_0x99a9('0x3d')]=_[_0x99a9('0x41')](_0x1f49c6[_0x99a9('0x3d')],{'$or':_[_0x99a9('0x32')](_0x460edb,function(_0x239998){if(_0x239998[_0x99a9('0x2f')]!=='VIRTUAL'){var _0xef49f0={};_0xef49f0[_0x239998['name']]={'$like':'%'+_0x56286a[_0x99a9('0x35')][_0x99a9('0x40')]+'%'};return _0xef49f0;}})});}_0x1f49c6=_['merge']({},_0x1f49c6,_0x56286a[_0x99a9('0x42')]);var _0x5603e5={'where':_0x1f49c6[_0x99a9('0x3d')]};return db[_0x99a9('0x2d')][_0x99a9('0x21')](_0x5603e5)[_0x99a9('0x27')](function(_0x21ba4a){_0x282b0f[_0x99a9('0x21')]=_0x21ba4a;if(_0x56286a[_0x99a9('0x35')][_0x99a9('0x43')]){_0x1f49c6[_0x99a9('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x1f49c6);})['then'](function(_0x479024){_0x282b0f['rows']=_0x479024;return _0x282b0f;})['then'](respondWithFilteredResult(_0x2ffd32,_0x1f49c6))[_0x99a9('0x45')](handleError(_0x2ffd32,null));};exports[_0x99a9('0x46')]=function(_0x5df1c0,_0x33d018){var _0x40ff35={'raw':!![],'where':{'id':_0x5df1c0[_0x99a9('0x47')]['id']}},_0x5ebb92={};_0x5ebb92[_0x99a9('0x31')]=_[_0x99a9('0x33')](db['ChatInternalMessage'][_0x99a9('0x2e')]);_0x5ebb92[_0x99a9('0x35')]=_[_0x99a9('0x33')](_0x5df1c0[_0x99a9('0x35')]);_0x5ebb92[_0x99a9('0x3e')]=_[_0x99a9('0x34')](_0x5ebb92[_0x99a9('0x31')],_0x5ebb92[_0x99a9('0x35')]);_0x40ff35[_0x99a9('0x36')]=_[_0x99a9('0x34')](_0x5ebb92[_0x99a9('0x31')],qs['fields'](_0x5df1c0['query'][_0x99a9('0x37')]));_0x40ff35[_0x99a9('0x36')]=_0x40ff35[_0x99a9('0x36')][_0x99a9('0x38')]?_0x40ff35[_0x99a9('0x36')]:_0x5ebb92[_0x99a9('0x31')];if(_0x5df1c0[_0x99a9('0x35')]['includeAll']){_0x40ff35['include']=[{'all':!![]}];}_0x40ff35=_['merge']({},_0x40ff35,_0x5df1c0['options']);return db[_0x99a9('0x2d')][_0x99a9('0x48')](_0x40ff35)[_0x99a9('0x27')](handleEntityNotFound(_0x33d018,null))[_0x99a9('0x27')](respondWithResult(_0x33d018,null))[_0x99a9('0x45')](handleError(_0x33d018,null));};exports[_0x99a9('0x49')]=function(_0xda110,_0x23e65b){return db[_0x99a9('0x2d')]['create'](_0xda110[_0x99a9('0x4a')],{})[_0x99a9('0x27')](respondWithResult(_0x23e65b,0xc9))[_0x99a9('0x45')](handleError(_0x23e65b,null));};exports[_0x99a9('0x4b')]=function(_0x731dbd,_0x274e64){if(_0x731dbd['body']['id']){delete _0x731dbd[_0x99a9('0x4a')]['id'];}return db[_0x99a9('0x2d')][_0x99a9('0x48')]({'where':{'id':_0x731dbd[_0x99a9('0x47')]['id']}})[_0x99a9('0x27')](handleEntityNotFound(_0x274e64,null))[_0x99a9('0x27')](saveUpdates(_0x731dbd[_0x99a9('0x4a')],null))['then'](respondWithResult(_0x274e64,null))[_0x99a9('0x45')](handleError(_0x274e64,null));};exports[_0x99a9('0x28')]=function(_0x210225,_0x4924e9){return db[_0x99a9('0x2d')][_0x99a9('0x48')]({'where':{'id':_0x210225['params']['id']}})[_0x99a9('0x27')](handleEntityNotFound(_0x4924e9,null))[_0x99a9('0x27')](removeEntity(_0x4924e9,null))['catch'](handleError(_0x4924e9,null));};exports[_0x99a9('0x4c')]=function(_0x22b42e,_0x5d0db9){return db[_0x99a9('0x2d')]['describe']()[_0x99a9('0x27')](respondWithResult(_0x5d0db9,null))['catch'](handleError(_0x5d0db9,null));};function wrapUser(_0x541ef8){return function(_0x59a4c7){var _0x39368d=_0x541ef8['get']({'plain':!![]});_0x39368d[_0x99a9('0x4d')]=[];if(_0x59a4c7){_0x39368d[_0x99a9('0x4e')]=_0x59a4c7[_0x99a9('0x4f')];_0x39368d[_0x99a9('0x50')]=_0x59a4c7;}else{_0x39368d[_0x99a9('0x4e')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x39368d[_0x99a9('0x50')]={};}return _0x39368d;};}exports['getUsers']=function(_0x12b1f3,_0x2623c2,_0x17b42c){var _0xa22485=[];return db['User']['findAll']({'where':{'role':['agent',_0x99a9('0x51'),_0x99a9('0x52')]},'attributes':['id','fullname',_0x99a9('0x2b'),'role',_0x99a9('0x53'),_0x99a9('0x54'),_0x99a9('0x55'),'lastLoginAt',_0x99a9('0x56'),'showWebBar'],'order':qs['sort'](_0x99a9('0x57')),'include':[{'model':db[_0x99a9('0x58')],'as':'VoiceQueues','attributes':['id','name',_0x99a9('0x2f')],'through':{'attributes':[]}}]})[_0x99a9('0x27')](function(_0x59b76f){if(_0x59b76f){var _0x5a351b=_0x12b1f3['user'][_0x99a9('0x59')]({'plain':!![]});if(!_0x5a351b)throw new Error(_0x99a9('0x5a'));if(_0x5a351b[_0x99a9('0x5b')]===_0x99a9('0x52')){return db[_0x99a9('0x5c')][_0x99a9('0x48')]({'where':{'name':'Agents','userProfileId':_0x5a351b['userProfileId']},'raw':!![]})[_0x99a9('0x27')](function(_0x1b81b1){if(_0x1b81b1){if(_0x1b81b1[_0x99a9('0x5d')]===0x0){return db[_0x99a9('0x5e')][_0x99a9('0x5f')]({'where':{'sectionId':_0x1b81b1['id']},'raw':!![]})[_0x99a9('0x27')](function(_0x9f4c51){var _0x5c1a75=[];if(_[_0x99a9('0x60')](_0x9f4c51)){_0x5c1a75=_[_0x99a9('0x40')](_0x59b76f,function(_0x369d1b){if(_0x369d1b[_0x99a9('0x5b')]!==_0x99a9('0x61')){return _0x369d1b;}});return _0x5c1a75;}else{for(var _0x226265=0x0;_0x226265<_0x59b76f['length'];_0x226265++){var _0x14252d=_0x59b76f[_0x226265];if(_0x14252d[_0x99a9('0x5b')]==='agent'){var _0x2b459d=_[_0x99a9('0x48')](_0x9f4c51,function(_0x565eed){return _0x565eed[_0x99a9('0x62')]===_0x14252d['id'];});if(_0x2b459d)_0x5c1a75['push'](_0x14252d);}else{_0x5c1a75[_0x99a9('0x63')](_0x14252d);}}return _0x5c1a75;}});}else{return _0x59b76f;}}else{var _0x3b20d1=_[_0x99a9('0x40')](_0x59b76f,function(_0x2acac9){if(_0x2acac9[_0x99a9('0x5b')]!==_0x99a9('0x61')){return _0x2acac9;}});return _0x3b20d1;}});}else{return _0x59b76f;}}})[_0x99a9('0x27')](function(_0x5ef26d){var _0x5a5bc3=[];if(_0x5ef26d){_0xa22485=_0x5ef26d;for(var _0x7c3393=0x0;_0x7c3393<_0x5ef26d[_0x99a9('0x38')];_0x7c3393+=0x1){_0xa22485[_0x7c3393][_0x99a9('0x4d')]=[];_0x5a5bc3[_0x99a9('0x63')](db[_0x99a9('0x2d')]['find']({'where':{'FromId':[_0x12b1f3[_0x99a9('0x52')]['id'],_0x5ef26d[_0x7c3393]['id']],'ToId':[_0x12b1f3[_0x99a9('0x52')]['id'],_0x5ef26d[_0x7c3393]['id']],'ChatGroupId':null},'attributes':['id',_0x99a9('0x4f'),_0x99a9('0x64'),_0x99a9('0x65'),_0x99a9('0x66'),_0x99a9('0x4a')],'order':qs[_0x99a9('0x3c')](_0x99a9('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x99a9('0x27')](wrapUser(_0x5ef26d[_0x7c3393])));}return BPromise['all'](_0x5a5bc3);}return[];})['then'](function(_0x4e64e3){return{'rows':_0x4e64e3,'count':_0x4e64e3[_0x99a9('0x38')]};})[_0x99a9('0x27')](respondWithResult(_0x2623c2,null))[_0x99a9('0x45')](handleError(_0x2623c2,null));}; \ No newline at end of file +var _0x51a0=['then','destroy','error','name','send','map','ChatInternalMessage','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','create','body','find','catch','describe','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','findAll','agent','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','ToId','read','-createdAt','all','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x4eba66,_0x138a2d){var _0x1e3f0d=function(_0x128474){while(--_0x128474){_0x4eba66['push'](_0x4eba66['shift']());}};_0x1e3f0d(++_0x138a2d);}(_0x51a0,0xaa));var _0x051a=function(_0x1702e1,_0x3a8949){_0x1702e1=_0x1702e1-0x0;var _0x2bdc8c=_0x51a0[_0x1702e1];return _0x2bdc8c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x051a('0x0'));var jsonpatch=require(_0x051a('0x1'));var rp=require(_0x051a('0x2'));var moment=require(_0x051a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x051a('0x4'));var util=require(_0x051a('0x5'));var path=require(_0x051a('0x6'));var sox=require(_0x051a('0x7'));var csv=require(_0x051a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x051a('0x9'));var squel=require(_0x051a('0xa'));var crypto=require(_0x051a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x051a('0xc'));var toCsv=require(_0x051a('0x8'));var querystring=require(_0x051a('0xd'));var Papa=require('papaparse');var Redis=require(_0x051a('0xe'));var authService=require(_0x051a('0xf'));var qs=require(_0x051a('0x10'));var as=require(_0x051a('0x11'));var hardwareService=require(_0x051a('0x12'));var logger=require(_0x051a('0x13'))('api');var utils=require(_0x051a('0x14'));var config=require(_0x051a('0x15'));var db=require(_0x051a('0x16'))['db'];config[_0x051a('0x17')]=_['defaults'](config['redis'],{'host':_0x051a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x051a('0x17')]));require(_0x051a('0x19'))[_0x051a('0x1a')](socket);function respondWithStatusCode(_0x51dd98,_0x506668){_0x506668=_0x506668||0xcc;return function(_0x15eb53){if(_0x15eb53){return _0x51dd98[_0x051a('0x1b')](_0x506668);}return _0x51dd98[_0x051a('0x1c')](_0x506668)[_0x051a('0x1d')]();};}function respondWithResult(_0x4b9b81,_0x157e43){_0x157e43=_0x157e43||0xc8;return function(_0x341caa){if(_0x341caa){return _0x4b9b81['status'](_0x157e43)[_0x051a('0x1e')](_0x341caa);}};}function respondWithFilteredResult(_0x433d64,_0x3e9ee7){return function(_0x229b12){if(_0x229b12){var _0x2b161b=_0x229b12[_0x051a('0x1f')],_0xca2b95=_0x3e9ee7[_0x051a('0x20')],_0x1efe1f=_0x3e9ee7[_0x051a('0x20')]+_0x3e9ee7[_0x051a('0x21')],_0x458b3a;if(_0x1efe1f>=_0x2b161b){_0x1efe1f=_0x2b161b;_0x458b3a=0xc8;}else{_0x458b3a=0xce;}_0x433d64['status'](_0x458b3a);return _0x433d64[_0x051a('0x22')](_0x051a('0x23'),_0xca2b95+'-'+_0x1efe1f+'/'+_0x2b161b)[_0x051a('0x1e')](_0x229b12);}return null;};}function patchUpdates(_0xc1f697){return function(_0x59734f){try{jsonpatch[_0x051a('0x24')](_0x59734f,_0xc1f697,!![]);}catch(_0x336a49){return BPromise[_0x051a('0x25')](_0x336a49);}return _0x59734f[_0x051a('0x26')]();};}function saveUpdates(_0x44ed27,_0x267d95){return function(_0x2282ac){if(_0x2282ac){return _0x2282ac[_0x051a('0x27')](_0x44ed27)[_0x051a('0x28')](function(_0x423c20){return _0x423c20;});}return null;};}function removeEntity(_0x55fc13,_0x13c795){return function(_0x4b0f45){if(_0x4b0f45){return _0x4b0f45[_0x051a('0x29')]()[_0x051a('0x28')](function(){_0x55fc13[_0x051a('0x1c')](0xcc)[_0x051a('0x1d')]();});}};}function handleEntityNotFound(_0x2ea039,_0x21d555){return function(_0x1dc87b){if(!_0x1dc87b){_0x2ea039[_0x051a('0x1b')](0x194);}return _0x1dc87b;};}function handleError(_0x430236,_0x5bc4d8){_0x5bc4d8=_0x5bc4d8||0x1f4;return function(_0x160946){logger[_0x051a('0x2a')](_0x160946['stack']);if(_0x160946[_0x051a('0x2b')]){delete _0x160946[_0x051a('0x2b')];}_0x430236[_0x051a('0x1c')](_0x5bc4d8)[_0x051a('0x2c')](_0x160946);};}exports['index']=function(_0x25911f,_0x28d848){var _0x4b1734={},_0x346bc1={},_0x1b2a9e={'count':0x0,'rows':[]};var _0x469ef5=_[_0x051a('0x2d')](db[_0x051a('0x2e')][_0x051a('0x2f')],function(_0x1597a0){return{'name':_0x1597a0['fieldName'],'type':_0x1597a0['type'][_0x051a('0x30')]};});_0x346bc1['model']=_[_0x051a('0x2d')](_0x469ef5,_0x051a('0x2b'));_0x346bc1[_0x051a('0x31')]=_['keys'](_0x25911f[_0x051a('0x31')]);_0x346bc1[_0x051a('0x32')]=_[_0x051a('0x33')](_0x346bc1[_0x051a('0x34')],_0x346bc1['query']);_0x4b1734[_0x051a('0x35')]=_[_0x051a('0x33')](_0x346bc1[_0x051a('0x34')],qs[_0x051a('0x36')](_0x25911f[_0x051a('0x31')][_0x051a('0x36')]));_0x4b1734[_0x051a('0x35')]=_0x4b1734['attributes'][_0x051a('0x37')]?_0x4b1734[_0x051a('0x35')]:_0x346bc1[_0x051a('0x34')];if(!_0x25911f[_0x051a('0x31')][_0x051a('0x38')](_0x051a('0x39'))){_0x4b1734[_0x051a('0x21')]=qs[_0x051a('0x21')](_0x25911f[_0x051a('0x31')][_0x051a('0x21')]);_0x4b1734[_0x051a('0x20')]=qs[_0x051a('0x20')](_0x25911f[_0x051a('0x31')]['offset']);}_0x4b1734['order']=qs[_0x051a('0x3a')](_0x25911f[_0x051a('0x31')]['sort']);_0x4b1734[_0x051a('0x3b')]=qs[_0x051a('0x32')](_[_0x051a('0x3c')](_0x25911f['query'],_0x346bc1[_0x051a('0x32')]),_0x469ef5);if(_0x25911f[_0x051a('0x31')][_0x051a('0x3d')]){_0x4b1734['where']=_[_0x051a('0x3e')](_0x4b1734['where'],{'$or':_[_0x051a('0x2d')](_0x469ef5,function(_0x533a59){if(_0x533a59[_0x051a('0x3f')]!==_0x051a('0x40')){var _0x7f96e7={};_0x7f96e7[_0x533a59['name']]={'$like':'%'+_0x25911f[_0x051a('0x31')][_0x051a('0x3d')]+'%'};return _0x7f96e7;}})});}_0x4b1734=_[_0x051a('0x3e')]({},_0x4b1734,_0x25911f[_0x051a('0x41')]);var _0x3f400a={'where':_0x4b1734[_0x051a('0x3b')]};return db[_0x051a('0x2e')]['count'](_0x3f400a)[_0x051a('0x28')](function(_0x33ccec){_0x1b2a9e['count']=_0x33ccec;if(_0x25911f[_0x051a('0x31')][_0x051a('0x42')]){_0x4b1734[_0x051a('0x43')]=[{'all':!![]}];}return db[_0x051a('0x2e')]['findAll'](_0x4b1734);})[_0x051a('0x28')](function(_0x3e4340){_0x1b2a9e[_0x051a('0x44')]=_0x3e4340;return _0x1b2a9e;})[_0x051a('0x28')](respondWithFilteredResult(_0x28d848,_0x4b1734))['catch'](handleError(_0x28d848,null));};exports[_0x051a('0x45')]=function(_0x5f53bb,_0xcc42b5){var _0x3ad69d={'raw':!![],'where':{'id':_0x5f53bb[_0x051a('0x46')]['id']}},_0x2cbcd0={};_0x2cbcd0[_0x051a('0x34')]=_[_0x051a('0x47')](db[_0x051a('0x2e')][_0x051a('0x2f')]);_0x2cbcd0[_0x051a('0x31')]=_[_0x051a('0x47')](_0x5f53bb[_0x051a('0x31')]);_0x2cbcd0['filters']=_[_0x051a('0x33')](_0x2cbcd0[_0x051a('0x34')],_0x2cbcd0[_0x051a('0x31')]);_0x3ad69d[_0x051a('0x35')]=_[_0x051a('0x33')](_0x2cbcd0[_0x051a('0x34')],qs['fields'](_0x5f53bb[_0x051a('0x31')]['fields']));_0x3ad69d[_0x051a('0x35')]=_0x3ad69d[_0x051a('0x35')][_0x051a('0x37')]?_0x3ad69d[_0x051a('0x35')]:_0x2cbcd0[_0x051a('0x34')];if(_0x5f53bb[_0x051a('0x31')][_0x051a('0x42')]){_0x3ad69d[_0x051a('0x43')]=[{'all':!![]}];}_0x3ad69d=_[_0x051a('0x3e')]({},_0x3ad69d,_0x5f53bb[_0x051a('0x41')]);return db['ChatInternalMessage']['find'](_0x3ad69d)[_0x051a('0x28')](handleEntityNotFound(_0xcc42b5,null))[_0x051a('0x28')](respondWithResult(_0xcc42b5,null))['catch'](handleError(_0xcc42b5,null));};exports[_0x051a('0x48')]=function(_0x200ad1,_0x42e427){return db[_0x051a('0x2e')][_0x051a('0x48')](_0x200ad1[_0x051a('0x49')],{})['then'](respondWithResult(_0x42e427,0xc9))['catch'](handleError(_0x42e427,null));};exports[_0x051a('0x27')]=function(_0x2b850e,_0x4a3760){if(_0x2b850e[_0x051a('0x49')]['id']){delete _0x2b850e[_0x051a('0x49')]['id'];}return db[_0x051a('0x2e')][_0x051a('0x4a')]({'where':{'id':_0x2b850e[_0x051a('0x46')]['id']}})[_0x051a('0x28')](handleEntityNotFound(_0x4a3760,null))['then'](saveUpdates(_0x2b850e['body'],null))[_0x051a('0x28')](respondWithResult(_0x4a3760,null))['catch'](handleError(_0x4a3760,null));};exports['destroy']=function(_0x1997e3,_0x4196aa){return db[_0x051a('0x2e')]['find']({'where':{'id':_0x1997e3[_0x051a('0x46')]['id']}})[_0x051a('0x28')](handleEntityNotFound(_0x4196aa,null))[_0x051a('0x28')](removeEntity(_0x4196aa,null))[_0x051a('0x4b')](handleError(_0x4196aa,null));};exports[_0x051a('0x4c')]=function(_0x47e8e0,_0x1f8d0f){return db[_0x051a('0x2e')][_0x051a('0x4c')]()[_0x051a('0x28')](respondWithResult(_0x1f8d0f,null))[_0x051a('0x4b')](handleError(_0x1f8d0f,null));};function wrapUser(_0x4f993c){return function(_0x1cfd5d){var _0x543796=_0x4f993c['get']({'plain':!![]});_0x543796['messages']=[];if(_0x1cfd5d){_0x543796[_0x051a('0x4d')]=_0x1cfd5d[_0x051a('0x4e')];_0x543796['lastMessage']=_0x1cfd5d;}else{_0x543796[_0x051a('0x4d')]=moment(0x0)[_0x051a('0x4f')](_0x051a('0x50'));_0x543796[_0x051a('0x51')]={};}return _0x543796;};}exports['getUsers']=function(_0x20479e,_0x50363b,_0x49780b){var _0x53e122=[];return db['User'][_0x051a('0x52')]({'where':{'role':[_0x051a('0x53'),'admin','user']},'attributes':['id','fullname',_0x051a('0x2b'),_0x051a('0x54'),_0x051a('0x55'),_0x051a('0x56'),_0x051a('0x57'),_0x051a('0x58'),_0x051a('0x59'),'showWebBar'],'order':qs[_0x051a('0x3a')](_0x051a('0x5a')),'include':[{'model':db['VoiceQueue'],'as':_0x051a('0x5b'),'attributes':['id',_0x051a('0x2b'),_0x051a('0x3f')],'through':{'attributes':[]}}]})[_0x051a('0x28')](function(_0x3280e9){if(_0x3280e9){var _0x46e546=_0x20479e[_0x051a('0x5c')][_0x051a('0x5d')]({'plain':!![]});if(!_0x46e546)throw new Error(_0x051a('0x5e'));if(_0x46e546['role']==='user'){return db['UserProfileSection'][_0x051a('0x4a')]({'where':{'name':'Agents','userProfileId':_0x46e546[_0x051a('0x5f')]},'raw':!![]})[_0x051a('0x28')](function(_0x1be221){if(_0x1be221){if(_0x1be221[_0x051a('0x60')]===0x0){return db[_0x051a('0x61')]['findAll']({'where':{'sectionId':_0x1be221['id']},'raw':!![]})[_0x051a('0x28')](function(_0x655420){var _0x39d976=[];if(_[_0x051a('0x62')](_0x655420)){_0x39d976=_[_0x051a('0x3d')](_0x3280e9,function(_0x4d8205){if(_0x4d8205[_0x051a('0x54')]!=='agent'){return _0x4d8205;}});return _0x39d976;}else{for(var _0x296286=0x0;_0x296286<_0x3280e9[_0x051a('0x37')];_0x296286++){var _0x1aa4c2=_0x3280e9[_0x296286];if(_0x1aa4c2[_0x051a('0x54')]===_0x051a('0x53')){var _0x23d596=_[_0x051a('0x4a')](_0x655420,function(_0x349859){return _0x349859[_0x051a('0x63')]===_0x1aa4c2['id'];});if(_0x23d596)_0x39d976[_0x051a('0x64')](_0x1aa4c2);}else{_0x39d976[_0x051a('0x64')](_0x1aa4c2);}}return _0x39d976;}});}else{return _0x3280e9;}}else{var _0x37ec08=_[_0x051a('0x3d')](_0x3280e9,function(_0x43e79b){if(_0x43e79b[_0x051a('0x54')]!==_0x051a('0x53')){return _0x43e79b;}});return _0x37ec08;}});}else{return _0x3280e9;}}})[_0x051a('0x28')](function(_0x3ddb64){var _0x325f39=[];if(_0x3ddb64){_0x53e122=_0x3ddb64;for(var _0x19df8b=0x0;_0x19df8b<_0x3ddb64['length'];_0x19df8b+=0x1){_0x53e122[_0x19df8b]['messages']=[];_0x325f39[_0x051a('0x64')](db['ChatInternalMessage'][_0x051a('0x4a')]({'where':{'FromId':[_0x20479e[_0x051a('0x5c')]['id'],_0x3ddb64[_0x19df8b]['id']],'ToId':[_0x20479e[_0x051a('0x5c')]['id'],_0x3ddb64[_0x19df8b]['id']],'ChatGroupId':null},'attributes':['id',_0x051a('0x4e'),'FromId',_0x051a('0x65'),_0x051a('0x66'),'body'],'order':qs[_0x051a('0x3a')](_0x051a('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3ddb64[_0x19df8b])));}return BPromise[_0x051a('0x68')](_0x325f39);}return[];})[_0x051a('0x28')](function(_0x259a90){return{'rows':_0x259a90,'count':_0x259a90[_0x051a('0x37')]};})['then'](respondWithResult(_0x50363b,null))[_0x051a('0x4b')](handleError(_0x50363b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b7f9f9d..fba6f67 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 _0x0763=['events','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0763,0x87));var _0x3076=function(_0x41ed37,_0xbcd1d4){_0x41ed37=_0x41ed37-0x0;var _0x13f7ea=_0x0763[_0x41ed37];return _0x13f7ea;};'use strict';var EventEmitter=require(_0x3076('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x3076('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3076('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3076('0x3'),'afterDestroy':_0x3076('0x4')};function emitEvent(_0x3ae0c9){return function(_0xecc289,_0x55bd44,_0x3eba05){ChatInternalMessageEvents[_0x3076('0x5')](_0x3ae0c9+':'+_0xecc289['id'],_0xecc289);ChatInternalMessageEvents[_0x3076('0x5')](_0x3ae0c9,_0xecc289);_0x3eba05(null);};}for(var e in events){if(events[_0x3076('0x6')](e)){var event=events[e];ChatInternalMessage[_0x3076('0x7')](e,emitEvent(event));}}module[_0x3076('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xdb5c=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4f3a0e,_0x396ed2){var _0x1d5936=function(_0x1ccdb4){while(--_0x1ccdb4){_0x4f3a0e['push'](_0x4f3a0e['shift']());}};_0x1d5936(++_0x396ed2);}(_0xdb5c,0x169));var _0xcdb5=function(_0x40ba72,_0x2dfa5a){_0x40ba72=_0x40ba72-0x0;var _0x3f6948=_0xdb5c[_0x40ba72];return _0x3f6948;};'use strict';var EventEmitter=require(_0xcdb5('0x0'));var ChatInternalMessage=require(_0xcdb5('0x1'))['db'][_0xcdb5('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xcdb5('0x3')](0x0);var events={'afterCreate':_0xcdb5('0x4'),'afterUpdate':'update','afterDestroy':_0xcdb5('0x5')};function emitEvent(_0x4b0cdb){return function(_0x50678c,_0x273863,_0x2a7a47){ChatInternalMessageEvents[_0xcdb5('0x6')](_0x4b0cdb+':'+_0x50678c['id'],_0x50678c);ChatInternalMessageEvents[_0xcdb5('0x6')](_0x4b0cdb,_0x50678c);_0x2a7a47(null);};}for(var e in events){if(events[_0xcdb5('0x7')](e)){var event=events[e];ChatInternalMessage[_0xcdb5('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 2a432a2..f8ff3d1 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 _0x2eb2=['bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x497ca0,_0x21bc0c){var _0xdbe67e=function(_0x406bce){while(--_0x406bce){_0x497ca0['push'](_0x497ca0['shift']());}};_0xdbe67e(++_0x21bc0c);}(_0x2eb2,0xe1));var _0x22eb=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x2eb2[_0x25bea7];return _0x175952;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x22eb('0x0'))(_0x22eb('0x1'));var moment=require(_0x22eb('0x2'));var BPromise=require(_0x22eb('0x3'));var rp=require(_0x22eb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x5'));var config=require(_0x22eb('0x6'));var attributes=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0xafdde7,_0x5b2c3b){return _0xafdde7[_0x22eb('0x9')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x22eb('0xa'),'collate':_0x22eb('0xb')});}; \ No newline at end of file +var _0x9868=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x44334a,_0x181bce){var _0x20a140=function(_0x7ee785){while(--_0x7ee785){_0x44334a['push'](_0x44334a['shift']());}};_0x20a140(++_0x181bce);}(_0x9868,0x78));var _0x8986=function(_0x43fe79,_0x4e05e7){_0x43fe79=_0x43fe79-0x0;var _0x98912d=_0x9868[_0x43fe79];return _0x98912d;};'use strict';var _=require(_0x8986('0x0'));var util=require(_0x8986('0x1'));var logger=require(_0x8986('0x2'))(_0x8986('0x3'));var moment=require(_0x8986('0x4'));var BPromise=require(_0x8986('0x5'));var rp=require(_0x8986('0x6'));var fs=require('fs');var path=require(_0x8986('0x7'));var rimraf=require(_0x8986('0x8'));var config=require(_0x8986('0x9'));var attributes=require(_0x8986('0xa'));module[_0x8986('0xb')]=function(_0x1ad9a2,_0x4e01d4){return _0x1ad9a2[_0x8986('0xc')](_0x8986('0xd'),attributes,{'tableName':_0x8986('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8986('0xf'),'collate':_0x8986('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 44fee3c..3b22496 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 _0x19c1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x46d459,_0x10dc2b){var _0x2fa982=function(_0x2f00b1){while(--_0x2f00b1){_0x46d459['push'](_0x46d459['shift']());}};_0x2fa982(++_0x10dc2b);}(_0x19c1,0x129));var _0x119c=function(_0x576e6e,_0x4df6df){_0x576e6e=_0x576e6e-0x0;var _0x40ce06=_0x19c1[_0x576e6e];return _0x40ce06;};'use strict';var _=require('lodash');var util=require(_0x119c('0x0'));var moment=require(_0x119c('0x1'));var BPromise=require(_0x119c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119c('0x3'))['db'];var utils=require(_0x119c('0x4'));var logger=require(_0x119c('0x5'))(_0x119c('0x6'));var config=require(_0x119c('0x7'));var jayson=require(_0x119c('0x8'));var client=jayson['client'][_0x119c('0x9')]({'port':0x232a});config[_0x119c('0xa')]=_[_0x119c('0xb')](config[_0x119c('0xa')],{'host':_0x119c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x119c('0xa')]));require('./chatInternalMessage.socket')[_0x119c('0xd')](socket);function respondWithRpcPromise(_0x374169,_0x3af550,_0x109067){return new BPromise(function(_0x551247,_0x3d473b){return client['request'](_0x374169,_0x109067)[_0x119c('0xe')](function(_0x12cf8c){logger[_0x119c('0xf')](_0x119c('0x10'),_0x3af550,_0x119c('0x11'));logger[_0x119c('0x12')](_0x119c('0x13'),_0x3af550,_0x119c('0x11'),JSON[_0x119c('0x14')](_0x12cf8c));if(_0x12cf8c[_0x119c('0x15')]){if(_0x12cf8c[_0x119c('0x15')][_0x119c('0x16')]===0x1f4){logger[_0x119c('0x15')](_0x119c('0x10'),_0x3af550,_0x12cf8c[_0x119c('0x15')][_0x119c('0x17')]);return _0x3d473b(_0x12cf8c[_0x119c('0x15')][_0x119c('0x17')]);}logger[_0x119c('0x15')](_0x119c('0x10'),_0x3af550,_0x12cf8c[_0x119c('0x15')][_0x119c('0x17')]);return _0x551247(_0x12cf8c[_0x119c('0x15')][_0x119c('0x17')]);}else{logger['info'](_0x119c('0x10'),_0x3af550,_0x119c('0x11'));_0x551247(_0x12cf8c['result']['message']);}})[_0x119c('0x18')](function(_0x3c3d69){logger[_0x119c('0x15')](_0x119c('0x10'),_0x3af550,_0x3c3d69);_0x3d473b(_0x3c3d69);});});} \ No newline at end of file +var _0xd61f=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x41c66d,_0x512755){var _0x4b3302=function(_0x5e6307){while(--_0x5e6307){_0x41c66d['push'](_0x41c66d['shift']());}};_0x4b3302(++_0x512755);}(_0xd61f,0x1c0));var _0xfd61=function(_0x50f735,_0x300d8d){_0x50f735=_0x50f735-0x0;var _0x18ad1c=_0xd61f[_0x50f735];return _0x18ad1c;};'use strict';var _=require(_0xfd61('0x0'));var util=require(_0xfd61('0x1'));var moment=require(_0xfd61('0x2'));var BPromise=require(_0xfd61('0x3'));var rs=require(_0xfd61('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd61('0x5'))['db'];var utils=require(_0xfd61('0x6'));var logger=require(_0xfd61('0x7'))(_0xfd61('0x8'));var config=require('../../config/environment');var jayson=require(_0xfd61('0x9'));var client=jayson[_0xfd61('0xa')][_0xfd61('0xb')]({'port':0x232a});config[_0xfd61('0xc')]=_['defaults'](config[_0xfd61('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd61('0xd'))(new Redis(config[_0xfd61('0xc')]));require('./chatInternalMessage.socket')[_0xfd61('0xe')](socket);function respondWithRpcPromise(_0x5657ab,_0x5969b1,_0x539647){return new BPromise(function(_0x579572,_0x3d7da0){return client[_0xfd61('0xf')](_0x5657ab,_0x539647)[_0xfd61('0x10')](function(_0x14ea1c){logger[_0xfd61('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x5969b1,_0xfd61('0x12'));logger[_0xfd61('0x13')](_0xfd61('0x14'),_0x5969b1,_0xfd61('0x12'),JSON[_0xfd61('0x15')](_0x14ea1c));if(_0x14ea1c['error']){if(_0x14ea1c[_0xfd61('0x16')][_0xfd61('0x17')]===0x1f4){logger[_0xfd61('0x16')](_0xfd61('0x18'),_0x5969b1,_0x14ea1c[_0xfd61('0x16')][_0xfd61('0x19')]);return _0x3d7da0(_0x14ea1c['error'][_0xfd61('0x19')]);}logger[_0xfd61('0x16')](_0xfd61('0x18'),_0x5969b1,_0x14ea1c['error'][_0xfd61('0x19')]);return _0x579572(_0x14ea1c[_0xfd61('0x16')][_0xfd61('0x19')]);}else{logger[_0xfd61('0x11')](_0xfd61('0x18'),_0x5969b1,_0xfd61('0x12'));_0x579572(_0x14ea1c[_0xfd61('0x1a')][_0xfd61('0x19')]);}})[_0xfd61('0x1b')](function(_0x12d5e6){logger[_0xfd61('0x16')](_0xfd61('0x18'),_0x5969b1,_0x12d5e6);_0x3d7da0(_0x12d5e6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c5f2da2..c850d73 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 _0xf0ba=['update','emit','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x4058cc,_0x52646f){var _0x105ea6=function(_0x190dc5){while(--_0x190dc5){_0x4058cc['push'](_0x4058cc['shift']());}};_0x105ea6(++_0x52646f);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var ChatInternalMessageEvents=require(_0xaf0b('0x0'));var events=[_0xaf0b('0x1'),_0xaf0b('0x2'),_0xaf0b('0x3')];function createListener(_0xea88b2,_0x555620){return function(_0x277920){_0x555620[_0xaf0b('0x4')](_0xea88b2,_0x277920);};}function removeListener(_0x4cffa5,_0xcd565f){return function(){ChatInternalMessageEvents['removeListener'](_0x4cffa5,_0xcd565f);};}exports[_0xaf0b('0x5')]=function(_0x4b3b85){for(var _0x4d1479=0x0,_0x53b32d=events[_0xaf0b('0x6')];_0x4d1479<_0x53b32d;_0x4d1479++){var _0x17b6d5=events[_0x4d1479];var _0x3439d5=createListener(_0xaf0b('0x7')+_0x17b6d5,_0x4b3b85);ChatInternalMessageEvents['on'](_0x17b6d5,_0x3439d5);}}; \ No newline at end of file +var _0xedd9=['removeListener','register','length','chatInternalMessage:','save','remove','update','emit'];(function(_0x1c14a9,_0x5481a8){var _0x215cf4=function(_0x32b1ef){while(--_0x32b1ef){_0x1c14a9['push'](_0x1c14a9['shift']());}};_0x215cf4(++_0x5481a8);}(_0xedd9,0xfc));var _0x9edd=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0xedd9[_0x1d2bbb];return _0x38082b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){ChatInternalMessageEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);ChatInternalMessageEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 8ed004f..5b85598 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 _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x551db7,_0xb015d2){var _0x22fb25=function(_0xf24c3a){while(--_0xf24c3a){_0x551db7['push'](_0x551db7['shift']());}};_0x22fb25(++_0xb015d2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0xcb91[_0x1daaa9];return _0x1dd221;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x57825b,_0x158953){var _0x501a07=function(_0xac55ce){while(--_0xac55ce){_0x57825b['push'](_0x57825b['shift']());}};_0x501a07(++_0x158953);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index a629192..61c22dd 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 _0xe478=['DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x223ae9,_0x4965ec){var _0x235ca5=function(_0x80ee91){while(--_0x80ee91){_0x223ae9['push'](_0x223ae9['shift']());}};_0x235ca5(++_0x4965ec);}(_0xe478,0xf7));var _0x8e47=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xe478[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x8e47('0x0'));module['exports']={'body':{'type':Sequelize[_0x8e47('0x1')](_0x8e47('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x8e47('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x8e47('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8e47('0x5')]}}; \ No newline at end of file +var _0x55eb=['ENUM','out','DATE','sequelize','TEXT','BOOLEAN'];(function(_0x3667a4,_0x1ff999){var _0x5c8e56=function(_0xbbbe13){while(--_0xbbbe13){_0x3667a4['push'](_0x3667a4['shift']());}};_0x5c8e56(++_0x1ff999);}(_0x55eb,0x171));var _0xb55e=function(_0x43afd6,_0x15f3ee){_0x43afd6=_0x43afd6-0x0;var _0x1f63de=_0x55eb[_0x43afd6];return _0x1f63de;};'use strict';var Sequelize=require(_0xb55e('0x0'));module['exports']={'body':{'type':Sequelize[_0xb55e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb55e('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb55e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb55e('0x3')]('in',_0xb55e('0x4')),'defaultValue':_0xb55e('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb55e('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e26fd0d..e72b1a1 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 _0xea49=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','sendStatus','status','count','offset','set','Content-Range','destroy','end','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','params','create','body','update','find','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','parse','formData','chat-interactions','reject','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3364f7,_0x3ee4b0){var _0x3d2089=function(_0x56658d){while(--_0x56658d){_0x3364f7['push'](_0x3364f7['shift']());}};_0x3d2089(++_0x3ee4b0);}(_0xea49,0x166));var _0x9ea4=function(_0x16b13d,_0x2faf09){_0x16b13d=_0x16b13d-0x0;var _0x1f1e77=_0xea49[_0x16b13d];return _0x1f1e77;};'use strict';var pdf=require(_0x9ea4('0x0'));var emlformat=require(_0x9ea4('0x1'));var rimraf=require(_0x9ea4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ea4('0x3'));var rp=require(_0x9ea4('0x4'));var moment=require(_0x9ea4('0x5'));var BPromise=require(_0x9ea4('0x6'));var Mustache=require(_0x9ea4('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9ea4('0x8'));var squel=require(_0x9ea4('0x9'));var crypto=require(_0x9ea4('0xa'));var jsforce=require(_0x9ea4('0xb'));var deskjs=require(_0x9ea4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9ea4('0xd'));var Papa=require(_0x9ea4('0xe'));var Redis=require(_0x9ea4('0xf'));var authService=require(_0x9ea4('0x10'));var qs=require(_0x9ea4('0x11'));var as=require(_0x9ea4('0x12'));var hardwareService=require(_0x9ea4('0x13'));var logger=require(_0x9ea4('0x14'))(_0x9ea4('0x15'));var utils=require(_0x9ea4('0x16'));var config=require(_0x9ea4('0x17'));var db=require(_0x9ea4('0x18'))['db'];config['redis']=_[_0x9ea4('0x19')](config[_0x9ea4('0x1a')],{'host':_0x9ea4('0x1b'),'port':0x18eb});var socket=require(_0x9ea4('0x1c'))(new Redis(config[_0x9ea4('0x1a')]));require(_0x9ea4('0x1d'))[_0x9ea4('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9ea4('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x9ea4('0x1f')][_0x9ea4('0x20')]({'port':0x232a});function checkPasswordPattern(_0x208197,_0x151051,_0x543572){if(_0x543572){var _0x24165d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24165d['test'](_0x151051)){return _0x208197;}else{throw new db[(_0x9ea4('0x21'))][(_0x9ea4('0x22'))](_0x9ea4('0x23'));}}else{return _0x208197;}}function respondWithRpcPromise(_0x4c6f17,_0x1cd2c4,_0x2f1ccf,_0x4bc3fe){return new BPromise(function(_0x34c819,_0x1fc1d6){var _0x4833a8=_0x4bc3fe||client;return _0x4833a8[_0x9ea4('0x24')](_0x4c6f17,_0x2f1ccf)[_0x9ea4('0x25')](function(_0x325091){logger[_0x9ea4('0x26')]('ChatMessage,\x20%s,\x20%s',_0x1cd2c4,_0x9ea4('0x27'));logger[_0x9ea4('0x28')](_0x9ea4('0x29'),_0x1cd2c4,_0x9ea4('0x27'),JSON[_0x9ea4('0x2a')](_0x325091));if(_0x325091[_0x9ea4('0x2b')]){if(_0x325091['error'][_0x9ea4('0x2c')]===0x1f4){logger[_0x9ea4('0x2b')](_0x9ea4('0x2d'),_0x1cd2c4,_0x325091[_0x9ea4('0x2b')][_0x9ea4('0x2e')]);return _0x1fc1d6(_0x325091[_0x9ea4('0x2b')][_0x9ea4('0x2e')]);}logger['error'](_0x9ea4('0x2d'),_0x1cd2c4,_0x325091[_0x9ea4('0x2b')][_0x9ea4('0x2e')]);return _0x34c819(_0x325091[_0x9ea4('0x2b')][_0x9ea4('0x2e')]);}else{logger[_0x9ea4('0x26')]('ChatMessage,\x20%s,\x20%s',_0x1cd2c4,'request\x20sent');_0x34c819(_0x325091['result'][_0x9ea4('0x2e')]);}})[_0x9ea4('0x2f')](function(_0x2973c9){logger['error'](_0x9ea4('0x2d'),_0x1cd2c4,_0x2973c9);_0x1fc1d6(_0x2973c9);});});}function respondWithStatusCode(_0x5b08b6,_0x18490b){_0x18490b=_0x18490b||0xcc;return function(_0x4783e3){if(_0x4783e3){return _0x5b08b6[_0x9ea4('0x30')](_0x18490b);}return _0x5b08b6[_0x9ea4('0x31')](_0x18490b)['end']();};}function respondWithResult(_0x3987fd,_0xd9f5d7){_0xd9f5d7=_0xd9f5d7||0xc8;return function(_0x42c2a2){if(_0x42c2a2){return _0x3987fd[_0x9ea4('0x31')](_0xd9f5d7)['json'](_0x42c2a2);}};}function respondWithFilteredResult(_0x2a9ffe,_0x267732){return function(_0x276e6c){if(_0x276e6c){var _0x3a6dd4=_0x276e6c[_0x9ea4('0x32')],_0x3cd710=_0x267732[_0x9ea4('0x33')],_0x5da5ab=_0x267732[_0x9ea4('0x33')]+_0x267732['limit'],_0x309918;if(_0x5da5ab>=_0x3a6dd4){_0x5da5ab=_0x3a6dd4;_0x309918=0xc8;}else{_0x309918=0xce;}_0x2a9ffe['status'](_0x309918);return _0x2a9ffe[_0x9ea4('0x34')](_0x9ea4('0x35'),_0x3cd710+'-'+_0x5da5ab+'/'+_0x3a6dd4)['json'](_0x276e6c);}return null;};}function patchUpdates(_0xb0ca78){return function(_0x4ffc9f){try{jsonpatch['apply'](_0x4ffc9f,_0xb0ca78,!![]);}catch(_0x1301ba){return BPromise['reject'](_0x1301ba);}return _0x4ffc9f['save']();};}function saveUpdates(_0x393226,_0x8edbe){return function(_0x3515df){if(_0x3515df){return _0x3515df['update'](_0x393226)[_0x9ea4('0x25')](function(_0x5a5c32){return _0x5a5c32;});}return null;};}function removeEntity(_0x325f35,_0x104fff){return function(_0x13361f){if(_0x13361f){return _0x13361f[_0x9ea4('0x36')]()[_0x9ea4('0x25')](function(){_0x325f35[_0x9ea4('0x31')](0xcc)[_0x9ea4('0x37')]();});}};}function handleEntityNotFound(_0x2eea54,_0xf520b0){return function(_0x1a7fdc){if(!_0x1a7fdc){_0x2eea54['sendStatus'](0x194);}return _0x1a7fdc;};}function handleError(_0x54ecf3,_0x21a0f9){_0x21a0f9=_0x21a0f9||0x1f4;return function(_0x1f7a04){logger['error'](_0x1f7a04['stack']);if(_0x1f7a04[_0x9ea4('0x38')]){delete _0x1f7a04[_0x9ea4('0x38')];}_0x54ecf3[_0x9ea4('0x31')](_0x21a0f9)[_0x9ea4('0x39')](_0x1f7a04);};}exports[_0x9ea4('0x3a')]=function(_0x13097c,_0x3c5d33){var _0x5d0a6f={},_0x5095d9={},_0x701303={'count':0x0,'rows':[]};var _0x3bd685=_[_0x9ea4('0x3b')](db[_0x9ea4('0x3c')][_0x9ea4('0x3d')],function(_0x599546){return{'name':_0x599546[_0x9ea4('0x3e')],'type':_0x599546[_0x9ea4('0x3f')][_0x9ea4('0x40')]};});_0x5095d9['model']=_[_0x9ea4('0x3b')](_0x3bd685,'name');_0x5095d9[_0x9ea4('0x41')]=_[_0x9ea4('0x42')](_0x13097c['query']);_0x5095d9[_0x9ea4('0x43')]=_[_0x9ea4('0x44')](_0x5095d9['model'],_0x5095d9[_0x9ea4('0x41')]);_0x5d0a6f['attributes']=_[_0x9ea4('0x44')](_0x5095d9[_0x9ea4('0x45')],qs[_0x9ea4('0x46')](_0x13097c[_0x9ea4('0x41')]['fields']));_0x5d0a6f[_0x9ea4('0x47')]=_0x5d0a6f[_0x9ea4('0x47')][_0x9ea4('0x48')]?_0x5d0a6f[_0x9ea4('0x47')]:_0x5095d9[_0x9ea4('0x45')];if(!_0x13097c['query'][_0x9ea4('0x49')]('nolimit')){_0x5d0a6f[_0x9ea4('0x4a')]=qs[_0x9ea4('0x4a')](_0x13097c['query']['limit']);_0x5d0a6f[_0x9ea4('0x33')]=qs[_0x9ea4('0x33')](_0x13097c['query']['offset']);}_0x5d0a6f[_0x9ea4('0x4b')]=qs[_0x9ea4('0x4c')](_0x13097c[_0x9ea4('0x41')]['sort']);_0x5d0a6f['where']=qs[_0x9ea4('0x43')](_[_0x9ea4('0x4d')](_0x13097c['query'],_0x5095d9['filters']),_0x3bd685);if(_0x13097c[_0x9ea4('0x41')][_0x9ea4('0x4e')]){_0x5d0a6f[_0x9ea4('0x4f')]=_['merge'](_0x5d0a6f[_0x9ea4('0x4f')],{'$or':_[_0x9ea4('0x3b')](_0x3bd685,function(_0x36654d){if(_0x36654d['type']!==_0x9ea4('0x50')){var _0x2672bd={};_0x2672bd[_0x36654d[_0x9ea4('0x38')]]={'$like':'%'+_0x13097c[_0x9ea4('0x41')][_0x9ea4('0x4e')]+'%'};return _0x2672bd;}})});}_0x5d0a6f=_[_0x9ea4('0x51')]({},_0x5d0a6f,_0x13097c[_0x9ea4('0x52')]);var _0x3069d0={'where':_0x5d0a6f[_0x9ea4('0x4f')]};return db[_0x9ea4('0x3c')]['count'](_0x3069d0)[_0x9ea4('0x25')](function(_0x21c951){_0x701303[_0x9ea4('0x32')]=_0x21c951;if(_0x13097c[_0x9ea4('0x41')]['includeAll']){_0x5d0a6f[_0x9ea4('0x53')]=[{'all':!![]}];}return db[_0x9ea4('0x3c')][_0x9ea4('0x54')](_0x5d0a6f);})[_0x9ea4('0x25')](function(_0x45bd3){_0x701303[_0x9ea4('0x55')]=_0x45bd3;return _0x701303;})[_0x9ea4('0x25')](respondWithFilteredResult(_0x3c5d33,_0x5d0a6f))['catch'](handleError(_0x3c5d33,null));};exports[_0x9ea4('0x56')]=function(_0x1ab4d7,_0x2d7828){var _0x140071={'raw':!![],'where':{'id':_0x1ab4d7[_0x9ea4('0x57')]['id']}},_0x48dc45={};_0x48dc45[_0x9ea4('0x45')]=_[_0x9ea4('0x42')](db[_0x9ea4('0x3c')]['rawAttributes']);_0x48dc45[_0x9ea4('0x41')]=_['keys'](_0x1ab4d7[_0x9ea4('0x41')]);_0x48dc45[_0x9ea4('0x43')]=_['intersection'](_0x48dc45['model'],_0x48dc45[_0x9ea4('0x41')]);_0x140071['attributes']=_['intersection'](_0x48dc45['model'],qs[_0x9ea4('0x46')](_0x1ab4d7[_0x9ea4('0x41')][_0x9ea4('0x46')]));_0x140071[_0x9ea4('0x47')]=_0x140071['attributes']['length']?_0x140071[_0x9ea4('0x47')]:_0x48dc45['model'];if(_0x1ab4d7[_0x9ea4('0x41')]['includeAll']){_0x140071[_0x9ea4('0x53')]=[{'all':!![]}];}_0x140071=_[_0x9ea4('0x51')]({},_0x140071,_0x1ab4d7[_0x9ea4('0x52')]);return db['ChatMessage']['find'](_0x140071)[_0x9ea4('0x25')](handleEntityNotFound(_0x2d7828,null))[_0x9ea4('0x25')](respondWithResult(_0x2d7828,null))[_0x9ea4('0x2f')](handleError(_0x2d7828,null));};exports[_0x9ea4('0x58')]=function(_0x42ff7c,_0x3090cc){return db[_0x9ea4('0x3c')][_0x9ea4('0x58')](_0x42ff7c[_0x9ea4('0x59')],{})['then'](respondWithResult(_0x3090cc,0xc9))['catch'](handleError(_0x3090cc,null));};exports[_0x9ea4('0x5a')]=function(_0x2a640c,_0x15ad26){if(_0x2a640c[_0x9ea4('0x59')]['id']){delete _0x2a640c['body']['id'];}return db['ChatMessage']['find']({'where':{'id':_0x2a640c[_0x9ea4('0x57')]['id']}})[_0x9ea4('0x25')](handleEntityNotFound(_0x15ad26,null))[_0x9ea4('0x25')](saveUpdates(_0x2a640c['body'],null))['then'](respondWithResult(_0x15ad26,null))['catch'](handleError(_0x15ad26,null));};exports['destroy']=function(_0x10ca02,_0x21da16){return db[_0x9ea4('0x3c')][_0x9ea4('0x5b')]({'where':{'id':_0x10ca02['params']['id']}})[_0x9ea4('0x25')](handleEntityNotFound(_0x21da16,null))[_0x9ea4('0x25')](removeEntity(_0x21da16,null))[_0x9ea4('0x2f')](handleError(_0x21da16,null));};exports[_0x9ea4('0x5c')]=function(_0x3f599a,_0x336b98){return db[_0x9ea4('0x3c')][_0x9ea4('0x5c')]()[_0x9ea4('0x25')](respondWithResult(_0x336b98,null))[_0x9ea4('0x2f')](handleError(_0x336b98,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x9ea4('0x5d')]=function(_0x1b4796,_0x17f77e,_0xb21287){var _0xb49d2d={'channel':_0x9ea4('0x5e')};if(_0x1b4796[_0x9ea4('0x59')]['id']){delete _0x1b4796['body']['id'];}_0x1b4796['body'][_0x9ea4('0x5f')]=!![];_0x1b4796[_0x9ea4('0x59')][_0x9ea4('0x60')]=moment()[_0x9ea4('0x61')](_0x9ea4('0x62'));_0x1b4796[_0x9ea4('0x59')][_0x9ea4('0x63')]=_0x1b4796['body'][_0x9ea4('0x63')]||_0x1b4796[_0x9ea4('0x64')]['id'];return db[_0x9ea4('0x3c')]['find']({'where':{'id':_0x1b4796[_0x9ea4('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x9ea4('0x65')],'as':'Contact'}]})[_0x9ea4('0x25')](handleEntityNotFound(_0x17f77e,null))['then'](saveUpdates(_0x1b4796['body'],null))[_0x9ea4('0x25')](function(_0x59df3a){if(_0x59df3a){_0xb49d2d['message']=_0x59df3a[_0x9ea4('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x9ea4('0x5b')]({'where':{'id':_0x59df3a[_0x9ea4('0x67')]}});}return null;})[_0x9ea4('0x25')](handleEntityNotFound(_0x17f77e,null))[_0x9ea4('0x25')](function(_0x3cf53c){if(_0x3cf53c){return _0x3cf53c[_0x9ea4('0x5a')]({'UserId':_0x1b4796[_0x9ea4('0x59')][_0x9ea4('0x63')],'read1stAt':_[_0x9ea4('0x68')](_0x3cf53c[_0x9ea4('0x69')])?moment()[_0x9ea4('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x32f5d1){if(_0x32f5d1){_0xb49d2d['interaction']=_0x32f5d1[_0x9ea4('0x66')]({'plain':!![]});interaction_log[_0x9ea4('0x26')](_0x9ea4('0x6a'),_0x1b4796[_0x9ea4('0x64')]['id'],_0x1b4796[_0x9ea4('0x64')][_0x9ea4('0x38')],_0x1b4796[_0x9ea4('0x64')][_0x9ea4('0x6b')],_0xb49d2d[_0x9ea4('0x6c')]['id'],_0x1b4796[_0x9ea4('0x59')]?JSON['stringify'](_0x1b4796[_0x9ea4('0x59')]):_0x9ea4('0x6d'));return respondWithRpcPromise(_0x9ea4('0x6e'),'acceptMessage',_0xb49d2d);}return null;})[_0x9ea4('0x25')](function(_0x1667ac){if(_0x1667ac){if(_0x1b4796[_0x9ea4('0x59')]['manual']){_0xb49d2d[_0x9ea4('0x2e')][_0x9ea4('0x6f')]=util[_0x9ea4('0x61')](_0x9ea4('0x70'),_0x1b4796[_0x9ea4('0x64')][_0x9ea4('0x38')]);_0xb49d2d[_0x9ea4('0x2e')]['channel']=_0xb49d2d[_0x9ea4('0x71')];_0xb49d2d['message']['event']=_0x9ea4('0x5d');return respondWithRpcPromise(_0x9ea4('0x72'),_0x9ea4('0x72'),{'event':_0x9ea4('0x73'),'message':_[_0x9ea4('0x51')](_0xb49d2d[_0x9ea4('0x2e')],JSON[_0x9ea4('0x74')](_0xb49d2d[_0x9ea4('0x6c')][_0x9ea4('0x75')]))},client9002)[_0x9ea4('0x25')](function(){return _0xb49d2d;});}return _0xb49d2d;}return null;})[_0x9ea4('0x25')](respondWithResult(_0x17f77e,null))[_0x9ea4('0x2f')](handleError(_0x17f77e,null));};var interaction_log=require('../../config/logger')(_0x9ea4('0x76'));exports[_0x9ea4('0x77')]=function(_0x3f65e2,_0x559d98,_0x57d513){var _0x5802c3={'agent':{},'channel':_0x9ea4('0x5e')};if(_0x3f65e2['body']['id']){delete _0x3f65e2['body']['id'];}_0x3f65e2[_0x9ea4('0x59')]['UserId']=_0x3f65e2['body'][_0x9ea4('0x63')]||_0x3f65e2['user']['id'];_0x5802c3[_0x9ea4('0x78')]['id']=_0x3f65e2['body']['UserId'];return db['ChatMessage'][_0x9ea4('0x5b')]({'where':{'id':_0x3f65e2[_0x9ea4('0x57')]['id'],'UserId':null}})[_0x9ea4('0x25')](handleEntityNotFound(_0x559d98,null))[_0x9ea4('0x25')](function(_0x880352){if(_0x880352){_0x5802c3[_0x9ea4('0x2e')]=_0x880352['get']({'plain':!![]});return db[_0x9ea4('0x79')][_0x9ea4('0x5b')]({'where':{'id':_0x880352[_0x9ea4('0x67')]}});}return null;})[_0x9ea4('0x25')](handleEntityNotFound(_0x559d98,null))[_0x9ea4('0x25')](function(_0x3fcfa5){if(_0x3fcfa5){_0x5802c3[_0x9ea4('0x6c')]=_0x3fcfa5['get']({'plain':!![]});interaction_log[_0x9ea4('0x26')](_0x9ea4('0x7a'),_0x3f65e2[_0x9ea4('0x64')]['id'],_0x3f65e2[_0x9ea4('0x64')]['name'],_0x3f65e2[_0x9ea4('0x64')]['role'],_0x5802c3[_0x9ea4('0x6c')]['id'],_0x3f65e2[_0x9ea4('0x59')]?JSON[_0x9ea4('0x2a')](_0x3f65e2['body']):_0x9ea4('0x6d'));return respondWithRpcPromise(_0x9ea4('0x7b'),'rejectMessage',_0x5802c3);}return null;})[_0x9ea4('0x25')](function(_0x44c9a3){if(_0x44c9a3){_0x44c9a3[_0x9ea4('0x2e')][_0x9ea4('0x6f')]=util[_0x9ea4('0x61')](_0x9ea4('0x70'),_0x3f65e2[_0x9ea4('0x64')][_0x9ea4('0x38')]);_0x44c9a3['message']['channel']=_0x5802c3[_0x9ea4('0x71')];_0x44c9a3[_0x9ea4('0x2e')]['event']=_0x9ea4('0x77');respondWithRpcPromise(_0x9ea4('0x72'),_0x9ea4('0x72'),{'event':_0x9ea4('0x7c'),'message':_0x44c9a3[_0x9ea4('0x2e')]},client9002);return _0x5802c3;}return null;})[_0x9ea4('0x25')](respondWithResult(_0x559d98,null))[_0x9ea4('0x2f')](handleError(_0x559d98,null));}; \ No newline at end of file +var _0xf417=['../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','params','length','include','find','create','body','destroy','describe','../../config/logger','chat-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','user','get','ChatInteraction','UserId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','channel','event','EventManager','parse','formData','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x158262,_0x4e7501){var _0x5e47e5=function(_0x5f1b30){while(--_0x5f1b30){_0x158262['push'](_0x158262['shift']());}};_0x5e47e5(++_0x4e7501);}(_0xf417,0x1e3));var _0x7f41=function(_0x226879,_0x30a56b){_0x226879=_0x226879-0x0;var _0x20964c=_0xf417[_0x226879];return _0x20964c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7f41('0x0'));var rimraf=require(_0x7f41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f41('0x2'));var rp=require(_0x7f41('0x3'));var moment=require(_0x7f41('0x4'));var BPromise=require(_0x7f41('0x5'));var Mustache=require(_0x7f41('0x6'));var util=require('util');var path=require(_0x7f41('0x7'));var sox=require(_0x7f41('0x8'));var csv=require(_0x7f41('0x9'));var ejs=require(_0x7f41('0xa'));var fs=require('fs');var _=require(_0x7f41('0xb'));var squel=require(_0x7f41('0xc'));var crypto=require(_0x7f41('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f41('0xe'));var toCsv=require(_0x7f41('0x9'));var querystring=require(_0x7f41('0xf'));var Papa=require('papaparse');var Redis=require(_0x7f41('0x10'));var authService=require(_0x7f41('0x11'));var qs=require(_0x7f41('0x12'));var as=require(_0x7f41('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f41('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7f41('0x15'))['db'];config['redis']=_['defaults'](config[_0x7f41('0x16')],{'host':_0x7f41('0x17'),'port':0x18eb});var socket=require(_0x7f41('0x18'))(new Redis(config[_0x7f41('0x16')]));require(_0x7f41('0x19'))[_0x7f41('0x1a')](socket);var jayson=require(_0x7f41('0x1b'));var client=jayson[_0x7f41('0x1c')][_0x7f41('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x7f41('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xd041ec,_0x177c8e,_0xe1c17d){if(_0xe1c17d){var _0x4eba46=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4eba46[_0x7f41('0x1e')](_0x177c8e)){return _0xd041ec;}else{throw new db[(_0x7f41('0x1f'))][(_0x7f41('0x20'))](_0x7f41('0x21'));}}else{return _0xd041ec;}}function respondWithRpcPromise(_0x352d2b,_0x581b8c,_0x4a53c2,_0x3c5184){return new BPromise(function(_0x2d7e75,_0x14b1f9){var _0x5bd936=_0x3c5184||client;return _0x5bd936[_0x7f41('0x22')](_0x352d2b,_0x4a53c2)[_0x7f41('0x23')](function(_0x4c6d75){logger[_0x7f41('0x24')](_0x7f41('0x25'),_0x581b8c,_0x7f41('0x26'));logger[_0x7f41('0x27')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x581b8c,_0x7f41('0x26'),JSON[_0x7f41('0x28')](_0x4c6d75));if(_0x4c6d75[_0x7f41('0x29')]){if(_0x4c6d75[_0x7f41('0x29')][_0x7f41('0x2a')]===0x1f4){logger[_0x7f41('0x29')](_0x7f41('0x25'),_0x581b8c,_0x4c6d75[_0x7f41('0x29')][_0x7f41('0x2b')]);return _0x14b1f9(_0x4c6d75[_0x7f41('0x29')][_0x7f41('0x2b')]);}logger[_0x7f41('0x29')](_0x7f41('0x25'),_0x581b8c,_0x4c6d75['error']['message']);return _0x2d7e75(_0x4c6d75[_0x7f41('0x29')][_0x7f41('0x2b')]);}else{logger[_0x7f41('0x24')]('ChatMessage,\x20%s,\x20%s',_0x581b8c,_0x7f41('0x26'));_0x2d7e75(_0x4c6d75['result']['message']);}})[_0x7f41('0x2c')](function(_0x28d2b0){logger['error']('ChatMessage,\x20%s,\x20%s',_0x581b8c,_0x28d2b0);_0x14b1f9(_0x28d2b0);});});}function respondWithStatusCode(_0x519d56,_0x10a21c){_0x10a21c=_0x10a21c||0xcc;return function(_0x245b39){if(_0x245b39){return _0x519d56[_0x7f41('0x2d')](_0x10a21c);}return _0x519d56[_0x7f41('0x2e')](_0x10a21c)[_0x7f41('0x2f')]();};}function respondWithResult(_0x5636f6,_0x485b5e){_0x485b5e=_0x485b5e||0xc8;return function(_0x220b55){if(_0x220b55){return _0x5636f6[_0x7f41('0x2e')](_0x485b5e)[_0x7f41('0x30')](_0x220b55);}};}function respondWithFilteredResult(_0x2443f5,_0x4b7149){return function(_0x144c46){if(_0x144c46){var _0x2d3f3b=_0x144c46[_0x7f41('0x31')],_0x214cd9=_0x4b7149[_0x7f41('0x32')],_0x546792=_0x4b7149[_0x7f41('0x32')]+_0x4b7149[_0x7f41('0x33')],_0x837e99;if(_0x546792>=_0x2d3f3b){_0x546792=_0x2d3f3b;_0x837e99=0xc8;}else{_0x837e99=0xce;}_0x2443f5[_0x7f41('0x2e')](_0x837e99);return _0x2443f5[_0x7f41('0x34')](_0x7f41('0x35'),_0x214cd9+'-'+_0x546792+'/'+_0x2d3f3b)[_0x7f41('0x30')](_0x144c46);}return null;};}function patchUpdates(_0x164b05){return function(_0x34ee76){try{jsonpatch['apply'](_0x34ee76,_0x164b05,!![]);}catch(_0x505267){return BPromise[_0x7f41('0x36')](_0x505267);}return _0x34ee76[_0x7f41('0x37')]();};}function saveUpdates(_0x2c9eff,_0x805e38){return function(_0x17cb99){if(_0x17cb99){return _0x17cb99[_0x7f41('0x38')](_0x2c9eff)[_0x7f41('0x23')](function(_0x7b1341){return _0x7b1341;});}return null;};}function removeEntity(_0x25ec4d,_0x19be02){return function(_0x1127f2){if(_0x1127f2){return _0x1127f2['destroy']()['then'](function(){_0x25ec4d[_0x7f41('0x2e')](0xcc)[_0x7f41('0x2f')]();});}};}function handleEntityNotFound(_0x47697c,_0x196ba2){return function(_0x238f13){if(!_0x238f13){_0x47697c['sendStatus'](0x194);}return _0x238f13;};}function handleError(_0x22c022,_0x45c02c){_0x45c02c=_0x45c02c||0x1f4;return function(_0x4d0ca0){logger['error'](_0x4d0ca0['stack']);if(_0x4d0ca0[_0x7f41('0x39')]){delete _0x4d0ca0[_0x7f41('0x39')];}_0x22c022[_0x7f41('0x2e')](_0x45c02c)[_0x7f41('0x3a')](_0x4d0ca0);};}exports[_0x7f41('0x3b')]=function(_0x51ef89,_0xd83739){var _0xc9308f={},_0x2dfa5e={},_0x24a1d5={'count':0x0,'rows':[]};var _0x5f40ae=_[_0x7f41('0x3c')](db[_0x7f41('0x3d')][_0x7f41('0x3e')],function(_0x491149){return{'name':_0x491149[_0x7f41('0x3f')],'type':_0x491149[_0x7f41('0x40')][_0x7f41('0x41')]};});_0x2dfa5e[_0x7f41('0x42')]=_[_0x7f41('0x3c')](_0x5f40ae,_0x7f41('0x39'));_0x2dfa5e['query']=_[_0x7f41('0x43')](_0x51ef89['query']);_0x2dfa5e[_0x7f41('0x44')]=_[_0x7f41('0x45')](_0x2dfa5e[_0x7f41('0x42')],_0x2dfa5e[_0x7f41('0x46')]);_0xc9308f[_0x7f41('0x47')]=_[_0x7f41('0x45')](_0x2dfa5e[_0x7f41('0x42')],qs[_0x7f41('0x48')](_0x51ef89[_0x7f41('0x46')][_0x7f41('0x48')]));_0xc9308f[_0x7f41('0x47')]=_0xc9308f['attributes']['length']?_0xc9308f[_0x7f41('0x47')]:_0x2dfa5e[_0x7f41('0x42')];if(!_0x51ef89[_0x7f41('0x46')][_0x7f41('0x49')](_0x7f41('0x4a'))){_0xc9308f[_0x7f41('0x33')]=qs[_0x7f41('0x33')](_0x51ef89['query']['limit']);_0xc9308f['offset']=qs[_0x7f41('0x32')](_0x51ef89['query'][_0x7f41('0x32')]);}_0xc9308f[_0x7f41('0x4b')]=qs[_0x7f41('0x4c')](_0x51ef89[_0x7f41('0x46')][_0x7f41('0x4c')]);_0xc9308f[_0x7f41('0x4d')]=qs['filters'](_[_0x7f41('0x4e')](_0x51ef89[_0x7f41('0x46')],_0x2dfa5e[_0x7f41('0x44')]),_0x5f40ae);if(_0x51ef89[_0x7f41('0x46')]['filter']){_0xc9308f[_0x7f41('0x4d')]=_['merge'](_0xc9308f[_0x7f41('0x4d')],{'$or':_[_0x7f41('0x3c')](_0x5f40ae,function(_0x37afdb){if(_0x37afdb['type']!==_0x7f41('0x4f')){var _0x54e943={};_0x54e943[_0x37afdb['name']]={'$like':'%'+_0x51ef89['query'][_0x7f41('0x50')]+'%'};return _0x54e943;}})});}_0xc9308f=_[_0x7f41('0x51')]({},_0xc9308f,_0x51ef89[_0x7f41('0x52')]);var _0xdab2f2={'where':_0xc9308f[_0x7f41('0x4d')]};return db[_0x7f41('0x3d')]['count'](_0xdab2f2)[_0x7f41('0x23')](function(_0x12a713){_0x24a1d5['count']=_0x12a713;if(_0x51ef89['query'][_0x7f41('0x53')]){_0xc9308f['include']=[{'all':!![]}];}return db[_0x7f41('0x3d')][_0x7f41('0x54')](_0xc9308f);})[_0x7f41('0x23')](function(_0x54aaff){_0x24a1d5[_0x7f41('0x55')]=_0x54aaff;return _0x24a1d5;})['then'](respondWithFilteredResult(_0xd83739,_0xc9308f))['catch'](handleError(_0xd83739,null));};exports['show']=function(_0x7eb764,_0x97978b){var _0x562d82={'raw':!![],'where':{'id':_0x7eb764[_0x7f41('0x56')]['id']}},_0x3741a7={};_0x3741a7[_0x7f41('0x42')]=_[_0x7f41('0x43')](db[_0x7f41('0x3d')][_0x7f41('0x3e')]);_0x3741a7[_0x7f41('0x46')]=_[_0x7f41('0x43')](_0x7eb764[_0x7f41('0x46')]);_0x3741a7[_0x7f41('0x44')]=_['intersection'](_0x3741a7[_0x7f41('0x42')],_0x3741a7[_0x7f41('0x46')]);_0x562d82[_0x7f41('0x47')]=_['intersection'](_0x3741a7[_0x7f41('0x42')],qs[_0x7f41('0x48')](_0x7eb764[_0x7f41('0x46')][_0x7f41('0x48')]));_0x562d82['attributes']=_0x562d82[_0x7f41('0x47')][_0x7f41('0x57')]?_0x562d82['attributes']:_0x3741a7[_0x7f41('0x42')];if(_0x7eb764[_0x7f41('0x46')]['includeAll']){_0x562d82[_0x7f41('0x58')]=[{'all':!![]}];}_0x562d82=_[_0x7f41('0x51')]({},_0x562d82,_0x7eb764[_0x7f41('0x52')]);return db[_0x7f41('0x3d')][_0x7f41('0x59')](_0x562d82)[_0x7f41('0x23')](handleEntityNotFound(_0x97978b,null))[_0x7f41('0x23')](respondWithResult(_0x97978b,null))[_0x7f41('0x2c')](handleError(_0x97978b,null));};exports[_0x7f41('0x5a')]=function(_0x1ef582,_0x802fd8){return db[_0x7f41('0x3d')][_0x7f41('0x5a')](_0x1ef582['body'],{})['then'](respondWithResult(_0x802fd8,0xc9))['catch'](handleError(_0x802fd8,null));};exports['update']=function(_0x1d1e82,_0x58d9ec){if(_0x1d1e82['body']['id']){delete _0x1d1e82[_0x7f41('0x5b')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x1d1e82[_0x7f41('0x56')]['id']}})['then'](handleEntityNotFound(_0x58d9ec,null))[_0x7f41('0x23')](saveUpdates(_0x1d1e82[_0x7f41('0x5b')],null))[_0x7f41('0x23')](respondWithResult(_0x58d9ec,null))['catch'](handleError(_0x58d9ec,null));};exports[_0x7f41('0x5c')]=function(_0x1f894b,_0x280c59){return db[_0x7f41('0x3d')][_0x7f41('0x59')]({'where':{'id':_0x1f894b[_0x7f41('0x56')]['id']}})[_0x7f41('0x23')](handleEntityNotFound(_0x280c59,null))['then'](removeEntity(_0x280c59,null))[_0x7f41('0x2c')](handleError(_0x280c59,null));};exports['describe']=function(_0xd5acd5,_0x3bb4c3){return db[_0x7f41('0x3d')][_0x7f41('0x5d')]()[_0x7f41('0x23')](respondWithResult(_0x3bb4c3,null))[_0x7f41('0x2c')](handleError(_0x3bb4c3,null));};var interaction_log=require(_0x7f41('0x5e'))(_0x7f41('0x5f'));exports[_0x7f41('0x60')]=function(_0x5c6bcf,_0xe8a9da,_0x4321c6){var _0x14214e={'channel':'chat'};if(_0x5c6bcf[_0x7f41('0x5b')]['id']){delete _0x5c6bcf[_0x7f41('0x5b')]['id'];}_0x5c6bcf[_0x7f41('0x5b')]['read']=!![];_0x5c6bcf[_0x7f41('0x5b')][_0x7f41('0x61')]=moment()['format'](_0x7f41('0x62'));_0x5c6bcf['body']['UserId']=_0x5c6bcf[_0x7f41('0x5b')]['UserId']||_0x5c6bcf[_0x7f41('0x63')]['id'];return db[_0x7f41('0x3d')][_0x7f41('0x59')]({'where':{'id':_0x5c6bcf['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x7f41('0x23')](handleEntityNotFound(_0xe8a9da,null))[_0x7f41('0x23')](saveUpdates(_0x5c6bcf['body'],null))[_0x7f41('0x23')](function(_0x3b35f4){if(_0x3b35f4){_0x14214e[_0x7f41('0x2b')]=_0x3b35f4[_0x7f41('0x64')]({'plain':!![]});return db[_0x7f41('0x65')][_0x7f41('0x59')]({'where':{'id':_0x3b35f4['ChatInteractionId']}});}return null;})[_0x7f41('0x23')](handleEntityNotFound(_0xe8a9da,null))['then'](function(_0x5351eb){if(_0x5351eb){return _0x5351eb['update']({'UserId':_0x5c6bcf[_0x7f41('0x5b')][_0x7f41('0x66')],'read1stAt':_[_0x7f41('0x67')](_0x5351eb[_0x7f41('0x68')])?moment()['format'](_0x7f41('0x62')):undefined});}return null;})[_0x7f41('0x23')](function(_0x4a5c93){if(_0x4a5c93){_0x14214e[_0x7f41('0x69')]=_0x4a5c93[_0x7f41('0x64')]({'plain':!![]});interaction_log['info'](_0x7f41('0x6a'),_0x5c6bcf['user']['id'],_0x5c6bcf['user'][_0x7f41('0x39')],_0x5c6bcf[_0x7f41('0x63')]['role'],_0x14214e[_0x7f41('0x69')]['id'],_0x5c6bcf[_0x7f41('0x5b')]?JSON['stringify'](_0x5c6bcf[_0x7f41('0x5b')]):_0x7f41('0x6b'));return respondWithRpcPromise(_0x7f41('0x6c'),_0x7f41('0x6d'),_0x14214e);}return null;})[_0x7f41('0x23')](function(_0x42cbb0){if(_0x42cbb0){if(_0x5c6bcf[_0x7f41('0x5b')][_0x7f41('0x6e')]){_0x14214e['message'][_0x7f41('0x6f')]=util[_0x7f41('0x70')](_0x7f41('0x71'),_0x5c6bcf[_0x7f41('0x63')]['name']);_0x14214e['message'][_0x7f41('0x72')]=_0x14214e[_0x7f41('0x72')];_0x14214e[_0x7f41('0x2b')][_0x7f41('0x73')]=_0x7f41('0x60');return respondWithRpcPromise(_0x7f41('0x74'),_0x7f41('0x74'),{'event':'acceptmessage','message':_[_0x7f41('0x51')](_0x14214e[_0x7f41('0x2b')],JSON[_0x7f41('0x75')](_0x14214e['interaction'][_0x7f41('0x76')]))},client9002)[_0x7f41('0x23')](function(){return _0x14214e;});}return _0x14214e;}return null;})['then'](respondWithResult(_0xe8a9da,null))[_0x7f41('0x2c')](handleError(_0xe8a9da,null));};var interaction_log=require(_0x7f41('0x5e'))(_0x7f41('0x5f'));exports[_0x7f41('0x36')]=function(_0x2582c0,_0x512ff3,_0x22b1a4){var _0xe3f205={'agent':{},'channel':'chat'};if(_0x2582c0[_0x7f41('0x5b')]['id']){delete _0x2582c0[_0x7f41('0x5b')]['id'];}_0x2582c0['body'][_0x7f41('0x66')]=_0x2582c0['body'][_0x7f41('0x66')]||_0x2582c0['user']['id'];_0xe3f205[_0x7f41('0x77')]['id']=_0x2582c0[_0x7f41('0x5b')][_0x7f41('0x66')];return db[_0x7f41('0x3d')]['find']({'where':{'id':_0x2582c0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x512ff3,null))['then'](function(_0x55b3d4){if(_0x55b3d4){_0xe3f205['message']=_0x55b3d4['get']({'plain':!![]});return db[_0x7f41('0x65')][_0x7f41('0x59')]({'where':{'id':_0x55b3d4[_0x7f41('0x78')]}});}return null;})[_0x7f41('0x23')](handleEntityNotFound(_0x512ff3,null))['then'](function(_0x548acd){if(_0x548acd){_0xe3f205[_0x7f41('0x69')]=_0x548acd['get']({'plain':!![]});interaction_log['info'](_0x7f41('0x79'),_0x2582c0[_0x7f41('0x63')]['id'],_0x2582c0[_0x7f41('0x63')][_0x7f41('0x39')],_0x2582c0[_0x7f41('0x63')][_0x7f41('0x7a')],_0xe3f205[_0x7f41('0x69')]['id'],_0x2582c0[_0x7f41('0x5b')]?JSON[_0x7f41('0x28')](_0x2582c0['body']):'null');return respondWithRpcPromise(_0x7f41('0x7b'),_0x7f41('0x7c'),_0xe3f205);}return null;})[_0x7f41('0x23')](function(_0x495a4c){if(_0x495a4c){_0x495a4c[_0x7f41('0x2b')]['interface']=util['format']('SIP/%s',_0x2582c0[_0x7f41('0x63')][_0x7f41('0x39')]);_0x495a4c[_0x7f41('0x2b')][_0x7f41('0x72')]=_0xe3f205[_0x7f41('0x72')];_0x495a4c[_0x7f41('0x2b')]['event']=_0x7f41('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0x7f41('0x7d'),'message':_0x495a4c[_0x7f41('0x2b')]},client9002);return _0xe3f205;}return null;})[_0x7f41('0x23')](respondWithResult(_0x512ff3,null))['catch'](handleError(_0x512ff3,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 2d9c9c9..762fc86 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 _0x1767=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatMessage'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1767,0x1bf));var _0x7176=function(_0x2defc4,_0x25dbea){_0x2defc4=_0x2defc4-0x0;var _0x10e80a=_0x1767[_0x2defc4];return _0x10e80a;};'use strict';var EventEmitter=require(_0x7176('0x0'));var ChatMessage=require(_0x7176('0x1'))['db'][_0x7176('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7176('0x3'),'afterUpdate':_0x7176('0x4'),'afterDestroy':_0x7176('0x5')};function emitEvent(_0x13700f){return function(_0x4448ec,_0x2a28ff,_0x3fd0e9){ChatMessageEvents['emit'](_0x13700f+':'+_0x4448ec['id'],_0x4448ec);ChatMessageEvents[_0x7176('0x6')](_0x13700f,_0x4448ec);_0x3fd0e9(null);};}for(var e in events){if(events[_0x7176('0x7')](e)){var event=events[e];ChatMessage[_0x7176('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xabbe=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x15883e,_0x1a4df6){var _0x5973ea=function(_0x3c72c3){while(--_0x3c72c3){_0x15883e['push'](_0x15883e['shift']());}};_0x5973ea(++_0x1a4df6);}(_0xabbe,0x147));var _0xeabb=function(_0x221b80,_0x288505){_0x221b80=_0x221b80-0x0;var _0x4dfa0d=_0xabbe[_0x221b80];return _0x4dfa0d;};'use strict';var EventEmitter=require(_0xeabb('0x0'));var ChatMessage=require(_0xeabb('0x1'))['db'][_0xeabb('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xeabb('0x3')](0x0);var events={'afterCreate':_0xeabb('0x4'),'afterUpdate':_0xeabb('0x5'),'afterDestroy':_0xeabb('0x6')};function emitEvent(_0x215af1){return function(_0x5b2a8a,_0x410d43,_0x454b8b){ChatMessageEvents[_0xeabb('0x7')](_0x215af1+':'+_0x5b2a8a['id'],_0x5b2a8a);ChatMessageEvents[_0xeabb('0x7')](_0x215af1,_0x5b2a8a);_0x454b8b(null);};}for(var e in events){if(events[_0xeabb('0x8')](e)){var event=events[e];ChatMessage[_0xeabb('0x9')](e,emitEvent(event));}}module[_0xeabb('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1e14e18..cc967bb 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 _0x2804=['catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2804,0x7a));var _0x4280=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2804[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x4280('0x0'));var util=require(_0x4280('0x1'));var logger=require(_0x4280('0x2'))(_0x4280('0x3'));var moment=require(_0x4280('0x4'));var BPromise=require(_0x4280('0x5'));var rp=require(_0x4280('0x6'));var fs=require('fs');var path=require(_0x4280('0x7'));var rimraf=require(_0x4280('0x8'));var config=require('../../config/environment');var attributes=require(_0x4280('0x9'));module['exports']=function(_0x648851,_0x1d8c91){return _0x648851[_0x4280('0xa')](_0x4280('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x4280('0xc'),'fields':[_0x4280('0xd')],'type':_0x4280('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15c2fe,_0x12d5b1,_0x12937c){var _0x585898=_0x648851[_0x4280('0xf')];var _0xe41c1d=_0x15c2fe[_0x4280('0x10')]({'plain':!![]});if(_0xe41c1d[_0x4280('0x11')][_0x4280('0x12')]()==='in'||_0xe41c1d[_0x4280('0x11')][_0x4280('0x12')]()===_0x4280('0x13')&&!_0xe41c1d['secret']&&!_[_0x4280('0x14')](_0xe41c1d[_0x4280('0x15')])){_0x585898[_0x4280('0x16')][_0x4280('0x17')]({'where':{'id':_0xe41c1d[_0x4280('0x18')]}})[_0x4280('0x19')](function(_0x55f121){if(_0x55f121){_0x55f121[_0x4280('0x1a')]({'lastMsgAt':_0xe41c1d[_0x4280('0x1b')],'lastMsgDirection':_0xe41c1d[_0x4280('0x11')][_0x4280('0x12')]()});}})[_0x4280('0x1c')](function(_0x33e6d9){console['error'](_0x33e6d9);});}_0x12937c();}},'charset':_0x4280('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x893b=['out','secret','isNil','UserId','ChatInteraction','then','update','createdAt','toLowerCase','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','direction'];(function(_0x1de606,_0x2c7427){var _0x15b373=function(_0x497db1){while(--_0x497db1){_0x1de606['push'](_0x1de606['shift']());}};_0x15b373(++_0x2c7427);}(_0x893b,0x93));var _0xb893=function(_0x28e670,_0x5d4122){_0x28e670=_0x28e670-0x0;var _0x444402=_0x893b[_0x28e670];return _0x444402;};'use strict';var _=require('lodash');var util=require(_0xb893('0x0'));var logger=require(_0xb893('0x1'))(_0xb893('0x2'));var moment=require(_0xb893('0x3'));var BPromise=require(_0xb893('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb893('0x5'));var rimraf=require('rimraf');var config=require(_0xb893('0x6'));var attributes=require('./chatMessage.attributes');module[_0xb893('0x7')]=function(_0xd5f45b,_0x5b6955){return _0xd5f45b[_0xb893('0x8')](_0xb893('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xb893('0xa'),'fields':[_0xb893('0xb')],'type':_0xb893('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7b3e57,_0x416533,_0x697731){var _0x2b07da=_0xd5f45b[_0xb893('0xd')];var _0x5eaddd=_0x7b3e57['get']({'plain':!![]});if(_0x5eaddd[_0xb893('0xe')]['toLowerCase']()==='in'||_0x5eaddd[_0xb893('0xe')]['toLowerCase']()===_0xb893('0xf')&&!_0x5eaddd[_0xb893('0x10')]&&!_[_0xb893('0x11')](_0x5eaddd[_0xb893('0x12')])){_0x2b07da[_0xb893('0x13')]['findOne']({'where':{'id':_0x5eaddd['ChatInteractionId']}})[_0xb893('0x14')](function(_0x550a35){if(_0x550a35){_0x550a35[_0xb893('0x15')]({'lastMsgAt':_0x5eaddd[_0xb893('0x16')],'lastMsgDirection':_0x5eaddd[_0xb893('0xe')][_0xb893('0x17')]()});}})['catch'](function(_0xe38fdc){console[_0xb893('0x18')](_0xe38fdc);});}_0x697731();}},'charset':_0xb893('0x19'),'collate':_0xb893('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f484b0e..88ecdba 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 _0x1c79=['ChatMessage,\x20%s,\x20%s','message','info','catch','CreateChatMessage','ChatMessage','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','localhost','socket.io-emitter','redis','register','then','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1c79,0x12b));var _0x91c7=function(_0x3bf1db,_0x4ae4cd){_0x3bf1db=_0x3bf1db-0x0;var _0x55af2d=_0x1c79[_0x3bf1db];return _0x55af2d;};'use strict';var _=require(_0x91c7('0x0'));var util=require('util');var moment=require(_0x91c7('0x1'));var BPromise=require(_0x91c7('0x2'));var rs=require(_0x91c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91c7('0x4'))['db'];var utils=require(_0x91c7('0x5'));var logger=require(_0x91c7('0x6'))(_0x91c7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x91c7('0x8')]({'port':0x232a});config['redis']=_[_0x91c7('0x9')](config['redis'],{'host':_0x91c7('0xa'),'port':0x18eb});var socket=require(_0x91c7('0xb'))(new Redis(config[_0x91c7('0xc')]));require('./chatMessage.socket')[_0x91c7('0xd')](socket);function respondWithRpcPromise(_0xb0b929,_0x151037,_0x45b5fd){return new BPromise(function(_0x31cfdc,_0x42d5bd){return client['request'](_0xb0b929,_0x45b5fd)[_0x91c7('0xe')](function(_0x26abfc){logger['info']('ChatMessage,\x20%s,\x20%s',_0x151037,_0x91c7('0xf'));logger['debug'](_0x91c7('0x10'),_0x151037,_0x91c7('0xf'),JSON[_0x91c7('0x11')](_0x26abfc));if(_0x26abfc[_0x91c7('0x12')]){if(_0x26abfc[_0x91c7('0x12')][_0x91c7('0x13')]===0x1f4){logger['error'](_0x91c7('0x14'),_0x151037,_0x26abfc['error']['message']);return _0x42d5bd(_0x26abfc[_0x91c7('0x12')][_0x91c7('0x15')]);}logger[_0x91c7('0x12')](_0x91c7('0x14'),_0x151037,_0x26abfc[_0x91c7('0x12')][_0x91c7('0x15')]);return _0x31cfdc(_0x26abfc[_0x91c7('0x12')][_0x91c7('0x15')]);}else{logger[_0x91c7('0x16')]('ChatMessage,\x20%s,\x20%s',_0x151037,_0x91c7('0xf'));_0x31cfdc(_0x26abfc['result']['message']);}})[_0x91c7('0x17')](function(_0x3ed454){logger[_0x91c7('0x12')]('ChatMessage,\x20%s,\x20%s',_0x151037,_0x3ed454);_0x42d5bd(_0x3ed454);});});}exports[_0x91c7('0x18')]=function(_0x995c33){var _0x6b9cf0=this;return new Promise(function(_0x2b3a9d,_0x19c066){return db[_0x91c7('0x19')]['create'](_0x995c33[_0x91c7('0x1a')],{'raw':_0x995c33['options']?_0x995c33[_0x91c7('0x1b')][_0x91c7('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3dabb9){logger[_0x91c7('0x16')](_0x91c7('0x18'),_0x995c33);logger['debug'](_0x91c7('0x18'),_0x995c33,JSON[_0x91c7('0x11')](_0x3dabb9));_0x2b3a9d(_0x3dabb9);})[_0x91c7('0x17')](function(_0x12d694){logger['error'](_0x91c7('0x18'),_0x12d694[_0x91c7('0x15')],_0x995c33);_0x19c066(_0x6b9cf0['error'](0x1f4,_0x12d694['message']));});});}; \ No newline at end of file +var _0x73af=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x40ca0b,_0x533b66){var _0x7c139f=function(_0x2d8e56){while(--_0x2d8e56){_0x40ca0b['push'](_0x40ca0b['shift']());}};_0x7c139f(++_0x533b66);}(_0x73af,0xde));var _0xf73a=function(_0x2aeca6,_0x565154){_0x2aeca6=_0x2aeca6-0x0;var _0x48c8c9=_0x73af[_0x2aeca6];return _0x48c8c9;};'use strict';var _=require(_0xf73a('0x0'));var util=require(_0xf73a('0x1'));var moment=require(_0xf73a('0x2'));var BPromise=require(_0xf73a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf73a('0x4'))['db'];var utils=require(_0xf73a('0x5'));var logger=require(_0xf73a('0x6'))(_0xf73a('0x7'));var config=require(_0xf73a('0x8'));var jayson=require(_0xf73a('0x9'));var client=jayson[_0xf73a('0xa')]['http']({'port':0x232a});config[_0xf73a('0xb')]=_[_0xf73a('0xc')](config[_0xf73a('0xb')],{'host':_0xf73a('0xd'),'port':0x18eb});var socket=require(_0xf73a('0xe'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xf73a('0xf')](socket);function respondWithRpcPromise(_0x51ad20,_0x5761d0,_0x2918ba){return new BPromise(function(_0x2a753d,_0xa808db){return client[_0xf73a('0x10')](_0x51ad20,_0x2918ba)[_0xf73a('0x11')](function(_0x54c764){logger[_0xf73a('0x12')]('ChatMessage,\x20%s,\x20%s',_0x5761d0,_0xf73a('0x13'));logger['debug'](_0xf73a('0x14'),_0x5761d0,'request\x20sent',JSON[_0xf73a('0x15')](_0x54c764));if(_0x54c764[_0xf73a('0x16')]){if(_0x54c764[_0xf73a('0x16')][_0xf73a('0x17')]===0x1f4){logger['error'](_0xf73a('0x18'),_0x5761d0,_0x54c764[_0xf73a('0x16')][_0xf73a('0x19')]);return _0xa808db(_0x54c764['error']['message']);}logger[_0xf73a('0x16')](_0xf73a('0x18'),_0x5761d0,_0x54c764[_0xf73a('0x16')][_0xf73a('0x19')]);return _0x2a753d(_0x54c764[_0xf73a('0x16')][_0xf73a('0x19')]);}else{logger[_0xf73a('0x12')](_0xf73a('0x18'),_0x5761d0,'request\x20sent');_0x2a753d(_0x54c764[_0xf73a('0x1a')][_0xf73a('0x19')]);}})[_0xf73a('0x1b')](function(_0x2c675d){logger['error'](_0xf73a('0x18'),_0x5761d0,_0x2c675d);_0xa808db(_0x2c675d);});});}exports[_0xf73a('0x1c')]=function(_0x2c16ea){var _0x16268f=this;return new Promise(function(_0x3b8b3f,_0x58de66){return db[_0xf73a('0x1d')][_0xf73a('0x1e')](_0x2c16ea[_0xf73a('0x1f')],{'raw':_0x2c16ea['options']?_0x2c16ea[_0xf73a('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xf73a('0x11')](function(_0x2b13de){logger[_0xf73a('0x12')](_0xf73a('0x1c'),_0x2c16ea);logger['debug'](_0xf73a('0x1c'),_0x2c16ea,JSON['stringify'](_0x2b13de));_0x3b8b3f(_0x2b13de);})[_0xf73a('0x1b')](function(_0x47ada1){logger[_0xf73a('0x16')](_0xf73a('0x1c'),_0x47ada1[_0xf73a('0x19')],_0x2c16ea);_0x58de66(_0x16268f[_0xf73a('0x16')](0x1f4,_0x47ada1[_0xf73a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 90c0834..df64187 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 _0x4137=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x71430b,_0x224419){var _0x5d5f14=function(_0x55b60b){while(--_0x55b60b){_0x71430b['push'](_0x71430b['shift']());}};_0x5d5f14(++_0x224419);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var ChatMessageEvents=require(_0x7413('0x0'));var events=[_0x7413('0x1'),_0x7413('0x2'),_0x7413('0x3')];function createListener(_0x392ebc,_0x410971){return function(_0x2e6df7){_0x410971[_0x7413('0x4')](_0x392ebc,_0x2e6df7);};}function removeListener(_0x258255,_0x3dc48a){return function(){ChatMessageEvents[_0x7413('0x5')](_0x258255,_0x3dc48a);};}exports[_0x7413('0x6')]=function(_0x4fbade){for(var _0xc808cd=0x0,_0x188d89=events[_0x7413('0x7')];_0xc808cd<_0x188d89;_0xc808cd++){var _0x15af0d=events[_0xc808cd];var _0x5f4cd0=createListener(_0x7413('0x8')+_0x15af0d,_0x4fbade);ChatMessageEvents['on'](_0x15af0d,_0x5f4cd0);}}; \ No newline at end of file +var _0x1a37=['remove','update','emit','register','length','./chatMessage.events','save'];(function(_0x383ea3,_0x195733){var _0xe8d22d=function(_0x71c134){while(--_0x71c134){_0x383ea3['push'](_0x383ea3['shift']());}};_0xe8d22d(++_0x195733);}(_0x1a37,0xb4));var _0x71a3=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x1a37[_0x31cb5f];return _0x586042;};'use strict';var ChatMessageEvents=require(_0x71a3('0x0'));var events=[_0x71a3('0x1'),_0x71a3('0x2'),_0x71a3('0x3')];function createListener(_0x353cf0,_0x20d8a7){return function(_0x348395){_0x20d8a7[_0x71a3('0x4')](_0x353cf0,_0x348395);};}function removeListener(_0x29c54f,_0x100181){return function(){ChatMessageEvents['removeListener'](_0x29c54f,_0x100181);};}exports[_0x71a3('0x5')]=function(_0x4f6b7a){for(var _0xd09f7=0x0,_0x45050a=events[_0x71a3('0x6')];_0xd09f7<_0x45050a;_0xd09f7++){var _0x2bb6a2=events[_0xd09f7];var _0x4a9ab2=createListener('chatMessage:'+_0x2bb6a2,_0x4f6b7a);ChatMessageEvents['on'](_0x2bb6a2,_0x4a9ab2);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d4599b4..c0434e2 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 _0x00d2=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x00d2,0x14c));var _0x200d=function(_0x14e589,_0x5d5c97){_0x14e589=_0x14e589-0x0;var _0x4ceb8c=_0x00d2[_0x14e589];return _0x4ceb8c;};'use strict';var multer=require(_0x200d('0x0'));var util=require(_0x200d('0x1'));var path=require(_0x200d('0x2'));var timeout=require(_0x200d('0x3'));var express=require(_0x200d('0x4'));var router=express['Router']();var auth=require(_0x200d('0x5'));var interaction=require(_0x200d('0x6'));var config=require(_0x200d('0x7'));var controller=require(_0x200d('0x8'));router[_0x200d('0x9')]('/',auth[_0x200d('0xa')](),controller['index']);router[_0x200d('0x9')](_0x200d('0xb'),auth[_0x200d('0xa')](),controller[_0x200d('0xc')]);router[_0x200d('0x9')](_0x200d('0xd'),auth[_0x200d('0xa')](),controller['show']);router['post']('/',auth[_0x200d('0xa')](),interaction['tracked'](_0x200d('0xe'),_0x200d('0xf')),controller[_0x200d('0x10')]);router[_0x200d('0x11')]('/:id',controller[_0x200d('0x12')]);router[_0x200d('0x11')](_0x200d('0x13'),auth[_0x200d('0xa')](),controller[_0x200d('0x14')]);router['put'](_0x200d('0x15'),auth[_0x200d('0xa')](),controller[_0x200d('0x16')]);router[_0x200d('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcebc=['get','index','/describe','isAuthenticated','/:id','show','tracked','chat','chatmessage:create','update','/:id/accept','put','/:id/reject','reject','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./chatMessage.controller'];(function(_0x4509cb,_0x192103){var _0x6eb03b=function(_0x573ce2){while(--_0x573ce2){_0x4509cb['push'](_0x4509cb['shift']());}};_0x6eb03b(++_0x192103);}(_0xcebc,0x118));var _0xcceb=function(_0x475084,_0x58b88b){_0x475084=_0x475084-0x0;var _0x13bb11=_0xcebc[_0x475084];return _0x13bb11;};'use strict';var multer=require('multer');var util=require(_0xcceb('0x0'));var path=require(_0xcceb('0x1'));var timeout=require('connect-timeout');var express=require(_0xcceb('0x2'));var router=express['Router']();var auth=require(_0xcceb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcceb('0x4'));var controller=require(_0xcceb('0x5'));router[_0xcceb('0x6')]('/',auth['isAuthenticated'](),controller[_0xcceb('0x7')]);router['get'](_0xcceb('0x8'),auth[_0xcceb('0x9')](),controller['describe']);router[_0xcceb('0x6')](_0xcceb('0xa'),auth[_0xcceb('0x9')](),controller[_0xcceb('0xb')]);router['post']('/',auth[_0xcceb('0x9')](),interaction[_0xcceb('0xc')](_0xcceb('0xd'),_0xcceb('0xe')),controller['create']);router['put']('/:id',controller[_0xcceb('0xf')]);router['put'](_0xcceb('0x10'),auth[_0xcceb('0x9')](),controller['accept']);router[_0xcceb('0x11')](_0xcceb('0x12'),auth[_0xcceb('0x9')](),controller[_0xcceb('0x13')]);router[_0xcceb('0x14')](_0xcceb('0xa'),auth[_0xcceb('0x9')](),controller['destroy']);module[_0xcceb('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ec3e370..4beb44c 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 _0x7ebe=['medium','sequelize','exports'];(function(_0x1b0899,_0x179c99){var _0x30273f=function(_0x3013e7){while(--_0x3013e7){_0x1b0899['push'](_0x1b0899['shift']());}};_0x30273f(++_0x179c99);}(_0x7ebe,0x121));var _0xe7eb=function(_0x482415,_0x33b44c){_0x482415=_0x482415-0x0;var _0x330885=_0x7ebe[_0x482415];return _0x330885;};'use strict';var Sequelize=require(_0xe7eb('0x0'));module[_0xe7eb('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe7eb('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x232e=['medium','sequelize','exports'];(function(_0x2fa2d6,_0x5d7dc8){var _0x3eb8ab=function(_0x23081f){while(--_0x23081f){_0x2fa2d6['push'](_0x2fa2d6['shift']());}};_0x3eb8ab(++_0x5d7dc8);}(_0x232e,0x157));var _0xe232=function(_0xd01860,_0x25a076){_0xd01860=_0xd01860-0x0;var _0xaa69d8=_0x232e[_0xd01860];return _0xaa69d8;};'use strict';var Sequelize=require(_0xe232('0x0'));module[_0xe232('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe232('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 91b7717..4893aeb 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 _0x4c60=['papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','error','name','send','index','map','ChatOfflineMessage','fieldName','type','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','params','keys','rawAttributes','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x4c60,0xc1));var _0x04c6=function(_0x36370d,_0x53e095){_0x36370d=_0x36370d-0x0;var _0x5ae8e5=_0x4c60[_0x36370d];return _0x5ae8e5;};'use strict';var pdf=require(_0x04c6('0x0'));var emlformat=require(_0x04c6('0x1'));var rimraf=require(_0x04c6('0x2'));var zipdir=require(_0x04c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x04c6('0x5'));var sox=require(_0x04c6('0x6'));var csv=require(_0x04c6('0x7'));var ejs=require(_0x04c6('0x8'));var fs=require('fs');var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x7'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var db=require(_0x04c6('0x13'))['db'];function respondWithStatusCode(_0x119187,_0x4e5e6){_0x4e5e6=_0x4e5e6||0xcc;return function(_0x52cdcf){if(_0x52cdcf){return _0x119187[_0x04c6('0x14')](_0x4e5e6);}return _0x119187[_0x04c6('0x15')](_0x4e5e6)[_0x04c6('0x16')]();};}function respondWithResult(_0x56422a,_0x12d1c5){_0x12d1c5=_0x12d1c5||0xc8;return function(_0x15cbe0){if(_0x15cbe0){return _0x56422a[_0x04c6('0x15')](_0x12d1c5)[_0x04c6('0x17')](_0x15cbe0);}};}function respondWithFilteredResult(_0x4760f8,_0x19a26f){return function(_0x1cd963){if(_0x1cd963){var _0x3d46a9=_0x1cd963[_0x04c6('0x18')],_0x5a5a66=_0x19a26f[_0x04c6('0x19')],_0x31edf9=_0x19a26f[_0x04c6('0x19')]+_0x19a26f[_0x04c6('0x1a')],_0xa2bc92;if(_0x31edf9>=_0x3d46a9){_0x31edf9=_0x3d46a9;_0xa2bc92=0xc8;}else{_0xa2bc92=0xce;}_0x4760f8[_0x04c6('0x15')](_0xa2bc92);return _0x4760f8[_0x04c6('0x1b')]('Content-Range',_0x5a5a66+'-'+_0x31edf9+'/'+_0x3d46a9)[_0x04c6('0x17')](_0x1cd963);}return null;};}function patchUpdates(_0x13e472){return function(_0xa70fd2){try{jsonpatch['apply'](_0xa70fd2,_0x13e472,!![]);}catch(_0x4cef4e){return BPromise['reject'](_0x4cef4e);}return _0xa70fd2[_0x04c6('0x1c')]();};}function saveUpdates(_0xb997e0,_0x50dd61){return function(_0x5a5e9e){if(_0x5a5e9e){return _0x5a5e9e[_0x04c6('0x1d')](_0xb997e0)[_0x04c6('0x1e')](function(_0x3cd448){return _0x3cd448;});}return null;};}function removeEntity(_0x5daa22,_0x33a0f7){return function(_0x13f2dc){if(_0x13f2dc){return _0x13f2dc[_0x04c6('0x1f')]()['then'](function(){_0x5daa22[_0x04c6('0x15')](0xcc)[_0x04c6('0x16')]();});}};}function handleEntityNotFound(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(!_0x4c8d72){_0x562491[_0x04c6('0x14')](0x194);}return _0x4c8d72;};}function handleError(_0x3a2014,_0xd5828d){_0xd5828d=_0xd5828d||0x1f4;return function(_0x115e35){logger[_0x04c6('0x20')](_0x115e35['stack']);if(_0x115e35['name']){delete _0x115e35[_0x04c6('0x21')];}_0x3a2014[_0x04c6('0x15')](_0xd5828d)[_0x04c6('0x22')](_0x115e35);};}exports[_0x04c6('0x23')]=function(_0x4f256f,_0x1f5aaf){var _0x47c69a={},_0x1d0d3f={},_0x165cb5={'count':0x0,'rows':[]};var _0x4e00fe=_[_0x04c6('0x24')](db[_0x04c6('0x25')]['rawAttributes'],function(_0x5c9003){return{'name':_0x5c9003[_0x04c6('0x26')],'type':_0x5c9003[_0x04c6('0x27')][_0x04c6('0x28')]};});_0x1d0d3f[_0x04c6('0x29')]=_[_0x04c6('0x24')](_0x4e00fe,_0x04c6('0x21'));_0x1d0d3f['query']=_['keys'](_0x4f256f['query']);_0x1d0d3f[_0x04c6('0x2a')]=_['intersection'](_0x1d0d3f[_0x04c6('0x29')],_0x1d0d3f[_0x04c6('0x2b')]);_0x47c69a['attributes']=_[_0x04c6('0x2c')](_0x1d0d3f[_0x04c6('0x29')],qs[_0x04c6('0x2d')](_0x4f256f[_0x04c6('0x2b')]['fields']));_0x47c69a[_0x04c6('0x2e')]=_0x47c69a[_0x04c6('0x2e')][_0x04c6('0x2f')]?_0x47c69a[_0x04c6('0x2e')]:_0x1d0d3f[_0x04c6('0x29')];if(!_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x30')](_0x04c6('0x31'))){_0x47c69a[_0x04c6('0x1a')]=qs[_0x04c6('0x1a')](_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x47c69a[_0x04c6('0x19')]=qs[_0x04c6('0x19')](_0x4f256f[_0x04c6('0x2b')]['offset']);}_0x47c69a[_0x04c6('0x32')]=qs[_0x04c6('0x33')](_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x33')]);_0x47c69a['where']=qs[_0x04c6('0x2a')](_[_0x04c6('0x34')](_0x4f256f['query'],_0x1d0d3f['filters']),_0x4e00fe);if(_0x4f256f['query'][_0x04c6('0x35')]){_0x47c69a[_0x04c6('0x36')]=_['merge'](_0x47c69a[_0x04c6('0x36')],{'$or':_['map'](_0x4e00fe,function(_0x15c270){if(_0x15c270[_0x04c6('0x27')]!==_0x04c6('0x37')){var _0x2b28cd={};_0x2b28cd[_0x15c270['name']]={'$like':'%'+_0x4f256f['query'][_0x04c6('0x35')]+'%'};return _0x2b28cd;}})});}_0x47c69a=_[_0x04c6('0x38')]({},_0x47c69a,_0x4f256f['options']);var _0x3f4fad={'where':_0x47c69a['where']};return db['ChatOfflineMessage'][_0x04c6('0x18')](_0x3f4fad)['then'](function(_0x181d3f){_0x165cb5[_0x04c6('0x18')]=_0x181d3f;if(_0x4f256f['query'][_0x04c6('0x39')]){_0x47c69a['include']=[{'all':!![]}];}return db[_0x04c6('0x25')][_0x04c6('0x3a')](_0x47c69a);})[_0x04c6('0x1e')](function(_0x120238){_0x165cb5[_0x04c6('0x3b')]=_0x120238;return _0x165cb5;})['then'](respondWithFilteredResult(_0x1f5aaf,_0x47c69a))[_0x04c6('0x3c')](handleError(_0x1f5aaf,null));};exports['show']=function(_0x74f1d1,_0x533608){var _0x1f7ead={'raw':!![],'where':{'id':_0x74f1d1[_0x04c6('0x3d')]['id']}},_0xc31731={};_0xc31731[_0x04c6('0x29')]=_[_0x04c6('0x3e')](db[_0x04c6('0x25')][_0x04c6('0x3f')]);_0xc31731['query']=_[_0x04c6('0x3e')](_0x74f1d1['query']);_0xc31731[_0x04c6('0x2a')]=_['intersection'](_0xc31731['model'],_0xc31731[_0x04c6('0x2b')]);_0x1f7ead['attributes']=_[_0x04c6('0x2c')](_0xc31731[_0x04c6('0x29')],qs[_0x04c6('0x2d')](_0x74f1d1['query'][_0x04c6('0x2d')]));_0x1f7ead[_0x04c6('0x2e')]=_0x1f7ead[_0x04c6('0x2e')][_0x04c6('0x2f')]?_0x1f7ead[_0x04c6('0x2e')]:_0xc31731[_0x04c6('0x29')];if(_0x74f1d1[_0x04c6('0x2b')]['includeAll']){_0x1f7ead['include']=[{'all':!![]}];}_0x1f7ead=_[_0x04c6('0x38')]({},_0x1f7ead,_0x74f1d1[_0x04c6('0x40')]);return db[_0x04c6('0x25')]['find'](_0x1f7ead)[_0x04c6('0x1e')](handleEntityNotFound(_0x533608,null))[_0x04c6('0x1e')](respondWithResult(_0x533608,null))[_0x04c6('0x3c')](handleError(_0x533608,null));};exports['create']=function(_0x4c9942,_0x56c7e6){return db[_0x04c6('0x25')][_0x04c6('0x41')](_0x4c9942['body'],{})[_0x04c6('0x1e')](respondWithResult(_0x56c7e6,0xc9))[_0x04c6('0x3c')](handleError(_0x56c7e6,null));};exports[_0x04c6('0x1d')]=function(_0x4ef366,_0x392983){if(_0x4ef366[_0x04c6('0x42')]['id']){delete _0x4ef366['body']['id'];}return db[_0x04c6('0x25')][_0x04c6('0x43')]({'where':{'id':_0x4ef366[_0x04c6('0x3d')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x392983,null))['then'](saveUpdates(_0x4ef366[_0x04c6('0x42')],null))[_0x04c6('0x1e')](respondWithResult(_0x392983,null))[_0x04c6('0x3c')](handleError(_0x392983,null));};exports[_0x04c6('0x1f')]=function(_0x5155aa,_0x192437){return db[_0x04c6('0x25')][_0x04c6('0x43')]({'where':{'id':_0x5155aa[_0x04c6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x192437,null))[_0x04c6('0x1e')](removeEntity(_0x192437,null))[_0x04c6('0x3c')](handleError(_0x192437,null));};exports[_0x04c6('0x44')]=function(_0x489361,_0x3119f0){return db[_0x04c6('0x25')][_0x04c6('0x44')]()[_0x04c6('0x1e')](respondWithResult(_0x3119f0,null))[_0x04c6('0x3c')](handleError(_0x3119f0,null));}; \ No newline at end of file +var _0x46ed=['sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','ChatOfflineMessage','includeAll','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x17a64a,_0x56da19){var _0x3089f3=function(_0x2e8866){while(--_0x2e8866){_0x17a64a['push'](_0x17a64a['shift']());}};_0x3089f3(++_0x56da19);}(_0x46ed,0x168));var _0xd46e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x46ed[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0xd46e('0x0'));var emlformat=require(_0xd46e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd46e('0x2'));var jsonpatch=require(_0xd46e('0x3'));var rp=require(_0xd46e('0x4'));var moment=require('moment');var BPromise=require(_0xd46e('0x5'));var Mustache=require(_0xd46e('0x6'));var util=require('util');var path=require(_0xd46e('0x7'));var sox=require(_0xd46e('0x8'));var csv=require(_0xd46e('0x9'));var ejs=require(_0xd46e('0xa'));var fs=require('fs');var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x9'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24c54b,_0x5bc1da){_0x5bc1da=_0x5bc1da||0xcc;return function(_0x48550b){if(_0x48550b){return _0x24c54b[_0xd46e('0x19')](_0x5bc1da);}return _0x24c54b[_0xd46e('0x1a')](_0x5bc1da)['end']();};}function respondWithResult(_0x5a3076,_0xacd799){_0xacd799=_0xacd799||0xc8;return function(_0x4688ae){if(_0x4688ae){return _0x5a3076[_0xd46e('0x1a')](_0xacd799)[_0xd46e('0x1b')](_0x4688ae);}};}function respondWithFilteredResult(_0x50c7c3,_0x3b6d25){return function(_0x44a620){if(_0x44a620){var _0x417402=_0x44a620[_0xd46e('0x1c')],_0x3d72ce=_0x3b6d25[_0xd46e('0x1d')],_0x36a317=_0x3b6d25[_0xd46e('0x1d')]+_0x3b6d25['limit'],_0x47fa8f;if(_0x36a317>=_0x417402){_0x36a317=_0x417402;_0x47fa8f=0xc8;}else{_0x47fa8f=0xce;}_0x50c7c3['status'](_0x47fa8f);return _0x50c7c3[_0xd46e('0x1e')](_0xd46e('0x1f'),_0x3d72ce+'-'+_0x36a317+'/'+_0x417402)['json'](_0x44a620);}return null;};}function patchUpdates(_0x4fd1f2){return function(_0x2d6f2c){try{jsonpatch[_0xd46e('0x20')](_0x2d6f2c,_0x4fd1f2,!![]);}catch(_0x362885){return BPromise[_0xd46e('0x21')](_0x362885);}return _0x2d6f2c[_0xd46e('0x22')]();};}function saveUpdates(_0x312d6f,_0x3b5fa4){return function(_0x327b7e){if(_0x327b7e){return _0x327b7e[_0xd46e('0x23')](_0x312d6f)[_0xd46e('0x24')](function(_0x468aba){return _0x468aba;});}return null;};}function removeEntity(_0x5ba94d,_0x259072){return function(_0x1c83fa){if(_0x1c83fa){return _0x1c83fa[_0xd46e('0x25')]()[_0xd46e('0x24')](function(){_0x5ba94d[_0xd46e('0x1a')](0xcc)[_0xd46e('0x26')]();});}};}function handleEntityNotFound(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(!_0x62dea5){_0x33c2e0['sendStatus'](0x194);}return _0x62dea5;};}function handleError(_0x314570,_0x5424e5){_0x5424e5=_0x5424e5||0x1f4;return function(_0x4b8f6a){logger[_0xd46e('0x27')](_0x4b8f6a[_0xd46e('0x28')]);if(_0x4b8f6a[_0xd46e('0x29')]){delete _0x4b8f6a[_0xd46e('0x29')];}_0x314570[_0xd46e('0x1a')](_0x5424e5)[_0xd46e('0x2a')](_0x4b8f6a);};}exports[_0xd46e('0x2b')]=function(_0x4dab6a,_0x45d789){var _0x3c301a={},_0xddbce9={},_0x17db79={'count':0x0,'rows':[]};var _0x96f15c=_[_0xd46e('0x2c')](db['ChatOfflineMessage'][_0xd46e('0x2d')],function(_0x3a1ced){return{'name':_0x3a1ced[_0xd46e('0x2e')],'type':_0x3a1ced[_0xd46e('0x2f')][_0xd46e('0x30')]};});_0xddbce9[_0xd46e('0x31')]=_[_0xd46e('0x2c')](_0x96f15c,_0xd46e('0x29'));_0xddbce9[_0xd46e('0x32')]=_[_0xd46e('0x33')](_0x4dab6a[_0xd46e('0x32')]);_0xddbce9[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0xddbce9['model'],_0xddbce9[_0xd46e('0x32')]);_0x3c301a[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0xddbce9[_0xd46e('0x31')],qs['fields'](_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x37')]));_0x3c301a['attributes']=_0x3c301a[_0xd46e('0x36')][_0xd46e('0x38')]?_0x3c301a['attributes']:_0xddbce9[_0xd46e('0x31')];if(!_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x39')]('nolimit')){_0x3c301a['limit']=qs[_0xd46e('0x3a')](_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x3a')]);_0x3c301a[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x1d')]);}_0x3c301a[_0xd46e('0x3b')]=qs['sort'](_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x3c')]);_0x3c301a[_0xd46e('0x3d')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3e')](_0x4dab6a[_0xd46e('0x32')],_0xddbce9[_0xd46e('0x34')]),_0x96f15c);if(_0x4dab6a['query'][_0xd46e('0x3f')]){_0x3c301a[_0xd46e('0x3d')]=_['merge'](_0x3c301a[_0xd46e('0x3d')],{'$or':_[_0xd46e('0x2c')](_0x96f15c,function(_0x12ccf8){if(_0x12ccf8[_0xd46e('0x2f')]!=='VIRTUAL'){var _0x3ab607={};_0x3ab607[_0x12ccf8[_0xd46e('0x29')]]={'$like':'%'+_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x3f')]+'%'};return _0x3ab607;}})});}_0x3c301a=_[_0xd46e('0x40')]({},_0x3c301a,_0x4dab6a[_0xd46e('0x41')]);var _0x220c57={'where':_0x3c301a[_0xd46e('0x3d')]};return db['ChatOfflineMessage'][_0xd46e('0x1c')](_0x220c57)[_0xd46e('0x24')](function(_0xc83ea1){_0x17db79[_0xd46e('0x1c')]=_0xc83ea1;if(_0x4dab6a[_0xd46e('0x32')]['includeAll']){_0x3c301a[_0xd46e('0x42')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x3c301a);})['then'](function(_0x55098d){_0x17db79[_0xd46e('0x43')]=_0x55098d;return _0x17db79;})['then'](respondWithFilteredResult(_0x45d789,_0x3c301a))[_0xd46e('0x44')](handleError(_0x45d789,null));};exports[_0xd46e('0x45')]=function(_0x57f803,_0x462477){var _0x4114e6={'raw':!![],'where':{'id':_0x57f803[_0xd46e('0x46')]['id']}},_0x3bd5e9={};_0x3bd5e9[_0xd46e('0x31')]=_[_0xd46e('0x33')](db[_0xd46e('0x47')][_0xd46e('0x2d')]);_0x3bd5e9[_0xd46e('0x32')]=_[_0xd46e('0x33')](_0x57f803[_0xd46e('0x32')]);_0x3bd5e9['filters']=_['intersection'](_0x3bd5e9['model'],_0x3bd5e9[_0xd46e('0x32')]);_0x4114e6['attributes']=_[_0xd46e('0x35')](_0x3bd5e9[_0xd46e('0x31')],qs[_0xd46e('0x37')](_0x57f803[_0xd46e('0x32')][_0xd46e('0x37')]));_0x4114e6[_0xd46e('0x36')]=_0x4114e6[_0xd46e('0x36')][_0xd46e('0x38')]?_0x4114e6['attributes']:_0x3bd5e9[_0xd46e('0x31')];if(_0x57f803['query'][_0xd46e('0x48')]){_0x4114e6[_0xd46e('0x42')]=[{'all':!![]}];}_0x4114e6=_[_0xd46e('0x40')]({},_0x4114e6,_0x57f803[_0xd46e('0x41')]);return db[_0xd46e('0x47')]['find'](_0x4114e6)[_0xd46e('0x24')](handleEntityNotFound(_0x462477,null))[_0xd46e('0x24')](respondWithResult(_0x462477,null))[_0xd46e('0x44')](handleError(_0x462477,null));};exports[_0xd46e('0x49')]=function(_0x2f1278,_0x587784){return db[_0xd46e('0x47')][_0xd46e('0x49')](_0x2f1278[_0xd46e('0x4a')],{})[_0xd46e('0x24')](respondWithResult(_0x587784,0xc9))[_0xd46e('0x44')](handleError(_0x587784,null));};exports['update']=function(_0x341d9f,_0x3ea9e6){if(_0x341d9f[_0xd46e('0x4a')]['id']){delete _0x341d9f[_0xd46e('0x4a')]['id'];}return db[_0xd46e('0x47')][_0xd46e('0x4b')]({'where':{'id':_0x341d9f[_0xd46e('0x46')]['id']}})[_0xd46e('0x24')](handleEntityNotFound(_0x3ea9e6,null))['then'](saveUpdates(_0x341d9f[_0xd46e('0x4a')],null))[_0xd46e('0x24')](respondWithResult(_0x3ea9e6,null))[_0xd46e('0x44')](handleError(_0x3ea9e6,null));};exports[_0xd46e('0x25')]=function(_0x1f1941,_0x4e84c8){return db['ChatOfflineMessage'][_0xd46e('0x4b')]({'where':{'id':_0x1f1941[_0xd46e('0x46')]['id']}})[_0xd46e('0x24')](handleEntityNotFound(_0x4e84c8,null))['then'](removeEntity(_0x4e84c8,null))['catch'](handleError(_0x4e84c8,null));};exports[_0xd46e('0x4c')]=function(_0x9d8638,_0x52354f){return db[_0xd46e('0x47')][_0xd46e('0x4c')]()[_0xd46e('0x24')](respondWithResult(_0x52354f,null))[_0xd46e('0x44')](handleError(_0x52354f,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index cf9564f..a741d59 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 _0x612c=['api','moment','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2a8cb7,_0x314d29){var _0x183a1f=function(_0x7f65bc){while(--_0x7f65bc){_0x2a8cb7['push'](_0x2a8cb7['shift']());}};_0x183a1f(++_0x314d29);}(_0x612c,0x1e0));var _0xc612=function(_0x3d85f0,_0xc4e3e2){_0x3d85f0=_0x3d85f0-0x0;var _0x59e8c7=_0x612c[_0x3d85f0];return _0x59e8c7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc612('0x0'));var moment=require(_0xc612('0x1'));var BPromise=require('bluebird');var rp=require(_0xc612('0x2'));var fs=require('fs');var path=require(_0xc612('0x3'));var rimraf=require(_0xc612('0x4'));var config=require('../../config/environment');var attributes=require(_0xc612('0x5'));module[_0xc612('0x6')]=function(_0x409b28,_0x2917d5){return _0x409b28[_0xc612('0x7')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc612('0x8'),'collate':_0xc612('0x9')});}; \ No newline at end of file +var _0x965d=['request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','util','api','bluebird'];(function(_0x3b40b4,_0xd89aa3){var _0x3626e2=function(_0x308de6){while(--_0x308de6){_0x3b40b4['push'](_0x3b40b4['shift']());}};_0x3626e2(++_0xd89aa3);}(_0x965d,0x176));var _0xd965=function(_0x55c1c6,_0x3edfe1){_0x55c1c6=_0x55c1c6-0x0;var _0x4730e1=_0x965d[_0x55c1c6];return _0x4730e1;};'use strict';var _=require('lodash');var util=require(_0xd965('0x0'));var logger=require('../../config/logger')(_0xd965('0x1'));var moment=require('moment');var BPromise=require(_0xd965('0x2'));var rp=require(_0xd965('0x3'));var fs=require('fs');var path=require(_0xd965('0x4'));var rimraf=require(_0xd965('0x5'));var config=require(_0xd965('0x6'));var attributes=require(_0xd965('0x7'));module[_0xd965('0x8')]=function(_0x35dea0,_0x231b42){return _0x35dea0[_0xd965('0x9')](_0xd965('0xa'),attributes,{'tableName':_0xd965('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd965('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2b66868..0b88d84 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 _0x2180=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2180,0xfb));var _0x0218=function(_0x4d0662,_0x145963){_0x4d0662=_0x4d0662-0x0;var _0x6eea6d=_0x2180[_0x4d0662];return _0x6eea6d;};'use strict';var _=require(_0x0218('0x0'));var util=require(_0x0218('0x1'));var moment=require('moment');var BPromise=require(_0x0218('0x2'));var rs=require(_0x0218('0x3'));var fs=require('fs');var Redis=require(_0x0218('0x4'));var db=require(_0x0218('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0218('0x6'))(_0x0218('0x7'));var config=require(_0x0218('0x8'));var jayson=require(_0x0218('0x9'));var client=jayson['client'][_0x0218('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40bc8d,_0x51eefd,_0x116a8f){return new BPromise(function(_0x55b7f6,_0x51bfc4){return client[_0x0218('0xb')](_0x40bc8d,_0x116a8f)[_0x0218('0xc')](function(_0x33bb4e){logger[_0x0218('0xd')](_0x0218('0xe'),_0x51eefd,_0x0218('0xf'));logger['debug'](_0x0218('0x10'),_0x51eefd,_0x0218('0xf'),JSON[_0x0218('0x11')](_0x33bb4e));if(_0x33bb4e[_0x0218('0x12')]){if(_0x33bb4e['error'][_0x0218('0x13')]===0x1f4){logger[_0x0218('0x12')](_0x0218('0xe'),_0x51eefd,_0x33bb4e[_0x0218('0x12')][_0x0218('0x14')]);return _0x51bfc4(_0x33bb4e[_0x0218('0x12')][_0x0218('0x14')]);}logger[_0x0218('0x12')](_0x0218('0xe'),_0x51eefd,_0x33bb4e[_0x0218('0x12')][_0x0218('0x14')]);return _0x55b7f6(_0x33bb4e[_0x0218('0x12')]['message']);}else{logger[_0x0218('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x51eefd,_0x0218('0xf'));_0x55b7f6(_0x33bb4e[_0x0218('0x15')][_0x0218('0x14')]);}})[_0x0218('0x16')](function(_0x285b2a){logger[_0x0218('0x12')](_0x0218('0xe'),_0x51eefd,_0x285b2a);_0x51bfc4(_0x285b2a);});});} \ No newline at end of file +var _0x8d80=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8d80,0x1cc));var _0x08d8=function(_0x55cf7a,_0x3e6bc5){_0x55cf7a=_0x55cf7a-0x0;var _0x3b79f2=_0x8d80[_0x55cf7a];return _0x3b79f2;};'use strict';var _=require('lodash');var util=require(_0x08d8('0x0'));var moment=require('moment');var BPromise=require(_0x08d8('0x1'));var rs=require(_0x08d8('0x2'));var fs=require('fs');var Redis=require(_0x08d8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x08d8('0x4'));var logger=require(_0x08d8('0x5'))(_0x08d8('0x6'));var config=require('../../config/environment');var jayson=require(_0x08d8('0x7'));var client=jayson[_0x08d8('0x8')][_0x08d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b4933,_0x516ab2,_0x5005b4){return new BPromise(function(_0x2b7d2c,_0x4052c7){return client[_0x08d8('0xa')](_0x5b4933,_0x5005b4)['then'](function(_0x1a06de){logger[_0x08d8('0xb')](_0x08d8('0xc'),_0x516ab2,'request\x20sent');logger[_0x08d8('0xd')](_0x08d8('0xe'),_0x516ab2,_0x08d8('0xf'),JSON[_0x08d8('0x10')](_0x1a06de));if(_0x1a06de[_0x08d8('0x11')]){if(_0x1a06de[_0x08d8('0x11')][_0x08d8('0x12')]===0x1f4){logger[_0x08d8('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x516ab2,_0x1a06de[_0x08d8('0x11')][_0x08d8('0x13')]);return _0x4052c7(_0x1a06de[_0x08d8('0x11')][_0x08d8('0x13')]);}logger[_0x08d8('0x11')](_0x08d8('0xc'),_0x516ab2,_0x1a06de['error'][_0x08d8('0x13')]);return _0x2b7d2c(_0x1a06de[_0x08d8('0x11')]['message']);}else{logger[_0x08d8('0xb')](_0x08d8('0xc'),_0x516ab2,_0x08d8('0xf'));_0x2b7d2c(_0x1a06de[_0x08d8('0x14')]['message']);}})[_0x08d8('0x15')](function(_0x591142){logger['error'](_0x08d8('0xc'),_0x516ab2,_0x591142);_0x4052c7(_0x591142);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ac2487a..eaac0b8 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 _0x436d=['../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','update','delete','destroy','multer','util','path','Router','../../components/auth/service'];(function(_0x4d0d85,_0x3250d3){var _0x290a74=function(_0x4762db){while(--_0x4762db){_0x4d0d85['push'](_0x4d0d85['shift']());}};_0x290a74(++_0x3250d3);}(_0x436d,0x12d));var _0xd436=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x436d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd436('0x0'));var util=require(_0xd436('0x1'));var path=require(_0xd436('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd436('0x3')]();var auth=require(_0xd436('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd436('0x5'));var controller=require(_0xd436('0x6'));router['get']('/',auth[_0xd436('0x7')](),controller[_0xd436('0x8')]);router[_0xd436('0x9')](_0xd436('0xa'),auth[_0xd436('0x7')](),controller[_0xd436('0xb')]);router[_0xd436('0x9')](_0xd436('0xc'),auth[_0xd436('0x7')](),controller['show']);router[_0xd436('0xd')]('/',auth[_0xd436('0x7')](),controller[_0xd436('0xe')]);router['put'](_0xd436('0xc'),auth[_0xd436('0x7')](),controller[_0xd436('0xf')]);router[_0xd436('0x10')](_0xd436('0xc'),auth[_0xd436('0x7')](),controller[_0xd436('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc70d=['/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatOfflineMessage.controller','index','get'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc70d,0xd3));var _0xdc70=function(_0x2341aa,_0x313c0b){_0x2341aa=_0x2341aa-0x0;var _0x58c3f=_0xc70d[_0x2341aa];return _0x58c3f;};'use strict';var multer=require('multer');var util=require(_0xdc70('0x0'));var path=require(_0xdc70('0x1'));var timeout=require(_0xdc70('0x2'));var express=require(_0xdc70('0x3'));var router=express[_0xdc70('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdc70('0x5'));var config=require('../../config/environment');var controller=require(_0xdc70('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xdc70('0x7')]);router[_0xdc70('0x8')](_0xdc70('0x9'),auth[_0xdc70('0xa')](),controller[_0xdc70('0xb')]);router['get'](_0xdc70('0xc'),auth[_0xdc70('0xa')](),controller['show']);router[_0xdc70('0xd')]('/',auth[_0xdc70('0xa')](),controller[_0xdc70('0xe')]);router[_0xdc70('0xf')](_0xdc70('0xc'),auth[_0xdc70('0xa')](),controller[_0xdc70('0x10')]);router[_0xdc70('0x11')](_0xdc70('0xc'),auth[_0xdc70('0xa')](),controller[_0xdc70('0x12')]);module[_0xdc70('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7870519..d39d32a 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 _0x2d2e=['mouseOver','timeout','STRING'];(function(_0x4eb02b,_0x502ac2){var _0x545b18=function(_0x3c302c){while(--_0x3c302c){_0x4eb02b['push'](_0x4eb02b['shift']());}};_0x545b18(++_0x502ac2);}(_0x2d2e,0x14c));var _0xe2d2=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x2d2e[_0x59162a];return _0x35e50d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe2d2('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe2d2('0x1'),_0xe2d2('0x2')),'defaultValue':_0xe2d2('0x1')},'selector':{'type':Sequelize[_0xe2d2('0x0')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x21be=['mouseOver','timeout','STRING','INTEGER','sequelize','exports','ENUM'];(function(_0x161299,_0x4991c7){var _0x293d51=function(_0x44f04d){while(--_0x44f04d){_0x161299['push'](_0x161299['shift']());}};_0x293d51(++_0x4991c7);}(_0x21be,0x107));var _0xe21b=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x21be[_0x20cc29];return _0x28d513;};'use strict';var Sequelize=require(_0xe21b('0x0'));module[_0xe21b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe21b('0x2')](_0xe21b('0x3'),_0xe21b('0x4')),'defaultValue':_0xe21b('0x3')},'selector':{'type':Sequelize[_0xe21b('0x5')]},'timeout':{'type':Sequelize[_0xe21b('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index cc34805..aad9b0e 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 _0x9c44=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','create','ChatProactiveAction','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0x33d798,_0x4f9882){var _0xc20ea=function(_0x52ebff){while(--_0x52ebff){_0x33d798['push'](_0x33d798['shift']());}};_0xc20ea(++_0x4f9882);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['show']=function(_0x543ea2,_0x449960){var _0x53c199={'raw':!![],'where':{'id':_0x543ea2[_0x49c4('0x24')]['id']}},_0x3800b7={};_0x3800b7[_0x49c4('0x25')]=_[_0x49c4('0x26')](db['ChatProactiveAction'][_0x49c4('0x27')]);_0x3800b7[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x543ea2[_0x49c4('0x28')]);_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],_0x3800b7[_0x49c4('0x28')]);_0x53c199[_0x49c4('0x2b')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],qs['fields'](_0x543ea2['query']['fields']));_0x53c199[_0x49c4('0x2b')]=_0x53c199[_0x49c4('0x2b')][_0x49c4('0x2c')]?_0x53c199[_0x49c4('0x2b')]:_0x3800b7[_0x49c4('0x25')];if(_0x543ea2['query'][_0x49c4('0x2d')]){_0x53c199[_0x49c4('0x2e')]=[{'all':!![]}];}_0x53c199=_[_0x49c4('0x2f')]({},_0x53c199,_0x543ea2[_0x49c4('0x30')]);return db['ChatProactiveAction']['find'](_0x53c199)[_0x49c4('0x20')](handleEntityNotFound(_0x449960,null))[_0x49c4('0x20')](respondWithResult(_0x449960,null))[_0x49c4('0x31')](handleError(_0x449960,null));};exports[_0x49c4('0x32')]=function(_0xd38540,_0x4a0c7a){return db[_0x49c4('0x33')][_0x49c4('0x32')](_0xd38540[_0x49c4('0x34')],{})['then'](respondWithResult(_0x4a0c7a,0xc9))['catch'](handleError(_0x4a0c7a,null));};exports[_0x49c4('0x1f')]=function(_0x1991e9,_0x3bec0a){if(_0x1991e9[_0x49c4('0x34')]['id']){delete _0x1991e9[_0x49c4('0x34')]['id'];}return db[_0x49c4('0x33')][_0x49c4('0x35')]({'where':{'id':_0x1991e9[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3bec0a,null))['then'](saveUpdates(_0x1991e9[_0x49c4('0x34')],null))['then'](respondWithResult(_0x3bec0a,null))[_0x49c4('0x31')](handleError(_0x3bec0a,null));};exports[_0x49c4('0x36')]=function(_0x2625a6,_0x1c2830){return db['ChatProactiveAction'][_0x49c4('0x35')]({'where':{'id':_0x2625a6[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1c2830,null))['then'](removeEntity(_0x1c2830,null))[_0x49c4('0x31')](handleError(_0x1c2830,null));}; \ No newline at end of file +var _0xe706=['../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','ChatProactiveAction','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x20688d,_0xae370c){var _0xdddfa2=function(_0xe6a925){while(--_0xe6a925){_0x20688d['push'](_0x20688d['shift']());}};_0xdddfa2(++_0xae370c);}(_0xe706,0xa3));var _0x6e70=function(_0x5b84e5,_0x26076b){_0x5b84e5=_0x5b84e5-0x0;var _0xff9066=_0xe706[_0x5b84e5];return _0xff9066;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={'raw':!![],'where':{'id':_0x4a67ac[_0x6e70('0x2c')]['id']}},_0x3af17f={};_0x3af17f[_0x6e70('0x2d')]=_[_0x6e70('0x2e')](db['ChatProactiveAction'][_0x6e70('0x2f')]);_0x3af17f[_0x6e70('0x30')]=_[_0x6e70('0x2e')](_0x4a67ac[_0x6e70('0x30')]);_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x32')](_0x3af17f[_0x6e70('0x2d')],_0x3af17f[_0x6e70('0x30')]);_0x2c4d37[_0x6e70('0x33')]=_[_0x6e70('0x32')](_0x3af17f['model'],qs[_0x6e70('0x34')](_0x4a67ac['query'][_0x6e70('0x34')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x33')][_0x6e70('0x35')]?_0x2c4d37[_0x6e70('0x33')]:_0x3af17f['model'];if(_0x4a67ac[_0x6e70('0x30')][_0x6e70('0x36')]){_0x2c4d37['include']=[{'all':!![]}];}_0x2c4d37=_[_0x6e70('0x37')]({},_0x2c4d37,_0x4a67ac[_0x6e70('0x38')]);return db['ChatProactiveAction'][_0x6e70('0x39')](_0x2c4d37)[_0x6e70('0x27')](handleEntityNotFound(_0x54a5fe,null))[_0x6e70('0x27')](respondWithResult(_0x54a5fe,null))[_0x6e70('0x3a')](handleError(_0x54a5fe,null));};exports[_0x6e70('0x3b')]=function(_0x1e3e76,_0x44b19d){return db[_0x6e70('0x3c')][_0x6e70('0x3b')](_0x1e3e76[_0x6e70('0x3d')],{})['then'](respondWithResult(_0x44b19d,0xc9))[_0x6e70('0x3a')](handleError(_0x44b19d,null));};exports['update']=function(_0x23cd1a,_0x3222a2){if(_0x23cd1a[_0x6e70('0x3d')]['id']){delete _0x23cd1a[_0x6e70('0x3d')]['id'];}return db[_0x6e70('0x3c')][_0x6e70('0x39')]({'where':{'id':_0x23cd1a[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x3222a2,null))[_0x6e70('0x27')](saveUpdates(_0x23cd1a[_0x6e70('0x3d')],null))[_0x6e70('0x27')](respondWithResult(_0x3222a2,null))[_0x6e70('0x3a')](handleError(_0x3222a2,null));};exports[_0x6e70('0x3e')]=function(_0x501b53,_0x5446a2){return db['ChatProactiveAction'][_0x6e70('0x39')]({'where':{'id':_0x501b53[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x5446a2,null))[_0x6e70('0x27')](removeEntity(_0x5446a2,null))[_0x6e70('0x3a')](handleError(_0x5446a2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index f6be744..6e05b92 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 _0x944c=['./chatProactiveAction.attributes','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x4a5eb9,_0x2e1010){var _0x2d00c7=function(_0x48ff32){while(--_0x48ff32){_0x4a5eb9['push'](_0x4a5eb9['shift']());}};_0x2d00c7(++_0x2e1010);}(_0x944c,0x66));var _0xc944=function(_0x56a4a4,_0x2e15e5){_0x56a4a4=_0x56a4a4-0x0;var _0x16d910=_0x944c[_0x56a4a4];return _0x16d910;};'use strict';var _=require('lodash');var util=require(_0xc944('0x0'));var logger=require(_0xc944('0x1'))('api');var moment=require(_0xc944('0x2'));var BPromise=require(_0xc944('0x3'));var rp=require(_0xc944('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc944('0x5'));var attributes=require(_0xc944('0x6'));module['exports']=function(_0x292133,_0x49a03c){return _0x292133['define'](_0xc944('0x7'),attributes,{'tableName':_0xc944('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1780=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','../../config/logger','moment','request-promise','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1780,0x1c8));var _0x0178=function(_0x139f18,_0x1c8ff4){_0x139f18=_0x139f18-0x0;var _0x1dff4b=_0x1780[_0x139f18];return _0x1dff4b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0178('0x0'))('api');var moment=require(_0x0178('0x1'));var BPromise=require('bluebird');var rp=require(_0x0178('0x2'));var fs=require('fs');var path=require(_0x0178('0x3'));var rimraf=require('rimraf');var config=require(_0x0178('0x4'));var attributes=require(_0x0178('0x5'));module[_0x0178('0x6')]=function(_0x95e6d,_0x1f2843){return _0x95e6d[_0x0178('0x7')](_0x0178('0x8'),attributes,{'tableName':_0x0178('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d908b58..d6717cd 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 _0x1698=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','randomstring','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug'];(function(_0xcb7cc8,_0x5dd374){var _0x3d2dc3=function(_0x26e3d4){while(--_0x26e3d4){_0xcb7cc8['push'](_0xcb7cc8['shift']());}};_0x3d2dc3(++_0x5dd374);}(_0x1698,0x1e7));var _0x8169=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x1698[_0x257495];return _0x3849aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8169('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8169('0x1'))(_0x8169('0x2'));var config=require('../../config/environment');var jayson=require(_0x8169('0x3'));var client=jayson[_0x8169('0x4')][_0x8169('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5bc73a,_0x82a8e3,_0x1766b7){return new BPromise(function(_0x43d77f,_0xb56033){return client['request'](_0x5bc73a,_0x1766b7)['then'](function(_0x74bf01){logger[_0x8169('0x6')]('ChatProactiveAction,\x20%s,\x20%s',_0x82a8e3,_0x8169('0x7'));logger[_0x8169('0x8')](_0x8169('0x9'),_0x82a8e3,'request\x20sent',JSON['stringify'](_0x74bf01));if(_0x74bf01[_0x8169('0xa')]){if(_0x74bf01[_0x8169('0xa')][_0x8169('0xb')]===0x1f4){logger[_0x8169('0xa')](_0x8169('0xc'),_0x82a8e3,_0x74bf01[_0x8169('0xa')][_0x8169('0xd')]);return _0xb56033(_0x74bf01[_0x8169('0xa')][_0x8169('0xd')]);}logger[_0x8169('0xa')](_0x8169('0xc'),_0x82a8e3,_0x74bf01[_0x8169('0xa')]['message']);return _0x43d77f(_0x74bf01[_0x8169('0xa')][_0x8169('0xd')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x82a8e3,_0x8169('0x7'));_0x43d77f(_0x74bf01[_0x8169('0xe')][_0x8169('0xd')]);}})[_0x8169('0xf')](function(_0x5cdf20){logger[_0x8169('0xa')](_0x8169('0xc'),_0x82a8e3,_0x5cdf20);_0xb56033(_0x5cdf20);});});} \ No newline at end of file +var _0x0e06=['request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1d6dea,_0x1f8978){var _0x1b5967=function(_0x4a95f6){while(--_0x4a95f6){_0x1d6dea['push'](_0x1d6dea['shift']());}};_0x1b5967(++_0x1f8978);}(_0x0e06,0xe8));var _0x60e0=function(_0x5eee0f,_0x75e5ad){_0x5eee0f=_0x5eee0f-0x0;var _0x191a64=_0x0e06[_0x5eee0f];return _0x191a64;};'use strict';var _=require(_0x60e0('0x0'));var util=require('util');var moment=require(_0x60e0('0x1'));var BPromise=require(_0x60e0('0x2'));var rs=require(_0x60e0('0x3'));var fs=require('fs');var Redis=require(_0x60e0('0x4'));var db=require(_0x60e0('0x5'))['db'];var utils=require(_0x60e0('0x6'));var logger=require(_0x60e0('0x7'))(_0x60e0('0x8'));var config=require('../../config/environment');var jayson=require(_0x60e0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x294c39,_0x14cce5,_0x2d62ac){return new BPromise(function(_0x3a2382,_0x32c8df){return client[_0x60e0('0xa')](_0x294c39,_0x2d62ac)[_0x60e0('0xb')](function(_0x1060ee){logger[_0x60e0('0xc')](_0x60e0('0xd'),_0x14cce5,_0x60e0('0xe'));logger[_0x60e0('0xf')](_0x60e0('0x10'),_0x14cce5,_0x60e0('0xe'),JSON[_0x60e0('0x11')](_0x1060ee));if(_0x1060ee[_0x60e0('0x12')]){if(_0x1060ee[_0x60e0('0x12')][_0x60e0('0x13')]===0x1f4){logger[_0x60e0('0x12')](_0x60e0('0xd'),_0x14cce5,_0x1060ee[_0x60e0('0x12')][_0x60e0('0x14')]);return _0x32c8df(_0x1060ee[_0x60e0('0x12')][_0x60e0('0x14')]);}logger['error'](_0x60e0('0xd'),_0x14cce5,_0x1060ee[_0x60e0('0x12')][_0x60e0('0x14')]);return _0x3a2382(_0x1060ee[_0x60e0('0x12')][_0x60e0('0x14')]);}else{logger[_0x60e0('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x14cce5,_0x60e0('0xe'));_0x3a2382(_0x1060ee[_0x60e0('0x15')][_0x60e0('0x14')]);}})['catch'](function(_0x1d471f){logger[_0x60e0('0x12')](_0x60e0('0xd'),_0x14cce5,_0x1d471f);_0x32c8df(_0x1d471f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d84f8b6..b6c3374 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 _0x165d=['post','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','show'];(function(_0x3eaad6,_0x3ae162){var _0x470f24=function(_0x7f6c24){while(--_0x7f6c24){_0x3eaad6['push'](_0x3eaad6['shift']());}};_0x470f24(++_0x3ae162);}(_0x165d,0x14a));var _0xd165=function(_0x2beb4d,_0xa7d7c5){_0x2beb4d=_0x2beb4d-0x0;var _0x40fade=_0x165d[_0x2beb4d];return _0x40fade;};'use strict';var multer=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var path=require(_0xd165('0x2'));var timeout=require(_0xd165('0x3'));var express=require(_0xd165('0x4'));var router=express[_0xd165('0x5')]();var auth=require(_0xd165('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd165('0x7'));var controller=require(_0xd165('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller[_0xd165('0x9')]);router[_0xd165('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd165('0xb')](_0xd165('0xc'),auth[_0xd165('0xd')](),controller[_0xd165('0xe')]);router[_0xd165('0xf')](_0xd165('0xc'),auth[_0xd165('0xd')](),controller[_0xd165('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3124=['post','create','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x579fc8,_0x432ea0){var _0x1ac73e=function(_0x585c9a){while(--_0x585c9a){_0x579fc8['push'](_0x579fc8['shift']());}};_0x1ac73e(++_0x432ea0);}(_0x3124,0x15d));var _0x4312=function(_0x5ab016,_0x1eb213){_0x5ab016=_0x5ab016-0x0;var _0x2f5dc6=_0x3124[_0x5ab016];return _0x2f5dc6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4312('0x0'));var timeout=require(_0x4312('0x1'));var express=require(_0x4312('0x2'));var router=express[_0x4312('0x3')]();var auth=require(_0x4312('0x4'));var interaction=require(_0x4312('0x5'));var config=require(_0x4312('0x6'));var controller=require(_0x4312('0x7'));router[_0x4312('0x8')](_0x4312('0x9'),auth[_0x4312('0xa')](),controller['show']);router[_0x4312('0xb')]('/',auth[_0x4312('0xa')](),controller[_0x4312('0xc')]);router['put']('/:id',auth[_0x4312('0xa')](),controller['update']);router[_0x4312('0xd')](_0x4312('0x9'),auth[_0x4312('0xa')](),controller[_0x4312('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3354a0a..220baf1 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 _0xc0d6=['roundrobin','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1daaf4,_0x5f05c4){var _0xd26375=function(_0x481ff4){while(--_0x481ff4){_0x1daaf4['push'](_0x1daaf4['shift']());}};_0xd26375(++_0x5f05c4);}(_0xc0d6,0xbb));var _0x6c0d=function(_0x5b526b,_0x1157da){_0x5b526b=_0x5b526b-0x0;var _0x591549=_0xc0d6[_0x5b526b];return _0x591549;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6c0d('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6c0d('0x0')]},'timeout':{'type':Sequelize[_0x6c0d('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6c0d('0x2')](_0x6c0d('0x3'),_0x6c0d('0x4'),_0x6c0d('0x5'))}}; \ No newline at end of file +var _0x5571=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5571,0x196));var _0x1557=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0x5571[_0x397bfb];return _0x16c9b9;};'use strict';var Sequelize=require(_0x1557('0x0'));module[_0x1557('0x1')]={'name':{'type':Sequelize[_0x1557('0x2')],'unique':_0x1557('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1557('0x2')]},'timeout':{'type':Sequelize[_0x1557('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1557('0x5')](_0x1557('0x6'),_0x1557('0x7'),_0x1557('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7917d27..cc6ffec 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 _0xa679=['forEach','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','includes','all','isEmpty','removeAgents','addAgents','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','ChatQueues','UserProfileResource','end','name','index','ChatQueue','rawAttributes','type','map','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserChatQueue','order','ChatQueueId','User','UserId','agent','chatPause','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','findOrCreate'];(function(_0x27d5f4,_0x5a7934){var _0x5a3cff=function(_0x2d1f88){while(--_0x2d1f88){_0x27d5f4['push'](_0x27d5f4['shift']());}};_0x5a3cff(++_0x5a7934);}(_0xa679,0x13f));var _0x9a67=function(_0x3bd49e,_0x2573ca){_0x3bd49e=_0x3bd49e-0x0;var _0x518f14=_0xa679[_0x3bd49e];return _0x518f14;};'use strict';var pdf=require(_0x9a67('0x0'));var emlformat=require(_0x9a67('0x1'));var rimraf=require(_0x9a67('0x2'));var zipdir=require(_0x9a67('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a67('0x4'));var moment=require(_0x9a67('0x5'));var BPromise=require(_0x9a67('0x6'));var Mustache=require(_0x9a67('0x7'));var util=require('util');var path=require(_0x9a67('0x8'));var sox=require(_0x9a67('0x9'));var csv=require(_0x9a67('0xa'));var ejs=require(_0x9a67('0xb'));var fs=require('fs');var _=require(_0x9a67('0xc'));var squel=require(_0x9a67('0xd'));var crypto=require(_0x9a67('0xe'));var jsforce=require(_0x9a67('0xf'));var deskjs=require(_0x9a67('0x10'));var toCsv=require(_0x9a67('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9a67('0x11'));var qs=require(_0x9a67('0x12'));var as=require(_0x9a67('0x13'));var hardwareService=require(_0x9a67('0x14'));var logger=require(_0x9a67('0x15'))(_0x9a67('0x16'));var utils=require(_0x9a67('0x17'));var config=require(_0x9a67('0x18'));var db=require(_0x9a67('0x19'))['db'];config[_0x9a67('0x1a')]=_[_0x9a67('0x1b')](config[_0x9a67('0x1a')],{'host':_0x9a67('0x1c'),'port':0x18eb});var socket=require(_0x9a67('0x1d'))(new Redis(config[_0x9a67('0x1a')]));require(_0x9a67('0x1e'))[_0x9a67('0x1f')](socket);var jayson=require(_0x9a67('0x20'));var client=jayson[_0x9a67('0x21')][_0x9a67('0x22')]({'port':0x232a});function checkPasswordPattern(_0xe1fd3f,_0x58de93,_0x1f21f4){if(_0x1f21f4){var _0x352315=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x352315[_0x9a67('0x23')](_0x58de93)){return _0xe1fd3f;}else{throw new db[(_0x9a67('0x24'))][(_0x9a67('0x25'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xe1fd3f;}}function respondWithRpcPromise(_0x189c3e,_0x55666f,_0x2f994b,_0x21770e){return new BPromise(function(_0x3eb258,_0xb99342){var _0x10ad91=_0x21770e||client;return _0x10ad91[_0x9a67('0x26')](_0x189c3e,_0x2f994b)['then'](function(_0x468f1b){logger[_0x9a67('0x27')](_0x9a67('0x28'),_0x55666f,_0x9a67('0x29'));logger['debug'](_0x9a67('0x2a'),_0x55666f,'request\x20sent',JSON[_0x9a67('0x2b')](_0x468f1b));if(_0x468f1b['error']){if(_0x468f1b[_0x9a67('0x2c')][_0x9a67('0x2d')]===0x1f4){logger[_0x9a67('0x2c')]('ChatQueue,\x20%s,\x20%s',_0x55666f,_0x468f1b[_0x9a67('0x2c')][_0x9a67('0x2e')]);return _0xb99342(_0x468f1b[_0x9a67('0x2c')][_0x9a67('0x2e')]);}logger['error'](_0x9a67('0x28'),_0x55666f,_0x468f1b[_0x9a67('0x2c')]['message']);return _0x3eb258(_0x468f1b[_0x9a67('0x2c')][_0x9a67('0x2e')]);}else{logger[_0x9a67('0x27')](_0x9a67('0x28'),_0x55666f,_0x9a67('0x29'));_0x3eb258(_0x468f1b[_0x9a67('0x2f')][_0x9a67('0x2e')]);}})[_0x9a67('0x30')](function(_0x84418e){logger['error'](_0x9a67('0x28'),_0x55666f,_0x84418e);_0xb99342(_0x84418e);});});}function respondWithStatusCode(_0x5e3d1b,_0x4f3ff1){_0x4f3ff1=_0x4f3ff1||0xcc;return function(_0x5c42e8){if(_0x5c42e8){return _0x5e3d1b[_0x9a67('0x31')](_0x4f3ff1);}return _0x5e3d1b[_0x9a67('0x32')](_0x4f3ff1)['end']();};}function respondWithResult(_0xb919ef,_0x4e3a70){_0x4e3a70=_0x4e3a70||0xc8;return function(_0x3c7321){if(_0x3c7321){return _0xb919ef['status'](_0x4e3a70)[_0x9a67('0x33')](_0x3c7321);}};}function respondWithFilteredResult(_0x29008a,_0x5694e2){return function(_0x20a5ed){if(_0x20a5ed){var _0x2a0e9c=_0x20a5ed[_0x9a67('0x34')],_0x541ad9=_0x5694e2[_0x9a67('0x35')],_0x273957=_0x5694e2[_0x9a67('0x35')]+_0x5694e2[_0x9a67('0x36')],_0x457d87;if(_0x273957>=_0x2a0e9c){_0x273957=_0x2a0e9c;_0x457d87=0xc8;}else{_0x457d87=0xce;}_0x29008a['status'](_0x457d87);return _0x29008a[_0x9a67('0x37')](_0x9a67('0x38'),_0x541ad9+'-'+_0x273957+'/'+_0x2a0e9c)[_0x9a67('0x33')](_0x20a5ed);}return null;};}function patchUpdates(_0x2eb69c){return function(_0x3c18e7){try{jsonpatch[_0x9a67('0x39')](_0x3c18e7,_0x2eb69c,!![]);}catch(_0xb0ba62){return BPromise[_0x9a67('0x3a')](_0xb0ba62);}return _0x3c18e7['save']();};}function saveUpdates(_0x190a31,_0x3974f0){return function(_0x1429e2){if(_0x1429e2){return _0x1429e2['update'](_0x190a31)[_0x9a67('0x3b')](function(_0x30dac2){return _0x30dac2;});}return null;};}function removeEntity(_0x3c9857,_0x6d7521){return function(_0x4a20a5){if(_0x4a20a5){return _0x4a20a5[_0x9a67('0x3c')]()[_0x9a67('0x3b')](function(){var _0xbf3d0c=_0x4a20a5['get']({'plain':!![]});var _0x2b4e62=_0x9a67('0x3d');return db[_0x9a67('0x3e')][_0x9a67('0x3c')]({'where':{'type':_0x2b4e62,'resourceId':_0xbf3d0c['id']}})['then'](function(){return _0x4a20a5;});})['then'](function(){_0x3c9857[_0x9a67('0x32')](0xcc)[_0x9a67('0x3f')]();});}};}function handleEntityNotFound(_0x271201,_0xb878dd){return function(_0x51bdd4){if(!_0x51bdd4){_0x271201[_0x9a67('0x31')](0x194);}return _0x51bdd4;};}function handleError(_0x144922,_0x2f5f62){_0x2f5f62=_0x2f5f62||0x1f4;return function(_0x2ed630){logger[_0x9a67('0x2c')](_0x2ed630['stack']);if(_0x2ed630['name']){delete _0x2ed630[_0x9a67('0x40')];}_0x144922[_0x9a67('0x32')](_0x2f5f62)['send'](_0x2ed630);};}exports[_0x9a67('0x41')]=function(_0x1cf6a2,_0x570498){var _0x4d417b={},_0x1d38e1={},_0x50398f={'count':0x0,'rows':[]};var _0x1cde09=_['map'](db[_0x9a67('0x42')][_0x9a67('0x43')],function(_0x3ae72f){return{'name':_0x3ae72f['fieldName'],'type':_0x3ae72f[_0x9a67('0x44')]['key']};});_0x1d38e1['model']=_[_0x9a67('0x45')](_0x1cde09,_0x9a67('0x40'));_0x1d38e1['query']=_['keys'](_0x1cf6a2['query']);_0x1d38e1['filters']=_[_0x9a67('0x46')](_0x1d38e1[_0x9a67('0x47')],_0x1d38e1[_0x9a67('0x48')]);_0x4d417b['attributes']=_['intersection'](_0x1d38e1['model'],qs['fields'](_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x49')]));_0x4d417b[_0x9a67('0x4a')]=_0x4d417b[_0x9a67('0x4a')]['length']?_0x4d417b['attributes']:_0x1d38e1[_0x9a67('0x47')];if(!_0x1cf6a2['query'][_0x9a67('0x4b')](_0x9a67('0x4c'))){_0x4d417b[_0x9a67('0x36')]=qs['limit'](_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x36')]);_0x4d417b[_0x9a67('0x35')]=qs['offset'](_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x35')]);}_0x4d417b['order']=qs[_0x9a67('0x4d')](_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x4d')]);_0x4d417b[_0x9a67('0x4e')]=qs[_0x9a67('0x4f')](_[_0x9a67('0x50')](_0x1cf6a2[_0x9a67('0x48')],_0x1d38e1['filters']),_0x1cde09);if(_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x51')]){_0x4d417b[_0x9a67('0x4e')]=_[_0x9a67('0x52')](_0x4d417b[_0x9a67('0x4e')],{'$or':_[_0x9a67('0x45')](_0x1cde09,function(_0x396743){if(_0x396743[_0x9a67('0x44')]!=='VIRTUAL'){var _0x5b398f={};_0x5b398f[_0x396743['name']]={'$like':'%'+_0x1cf6a2['query']['filter']+'%'};return _0x5b398f;}})});}_0x4d417b=_['merge']({},_0x4d417b,_0x1cf6a2[_0x9a67('0x53')]);var _0x2eeaed={'where':_0x4d417b[_0x9a67('0x4e')]};return db[_0x9a67('0x42')][_0x9a67('0x34')](_0x2eeaed)[_0x9a67('0x3b')](function(_0x1ea719){_0x50398f[_0x9a67('0x34')]=_0x1ea719;if(_0x1cf6a2['query'][_0x9a67('0x54')]){_0x4d417b[_0x9a67('0x55')]=[{'all':!![]}];}return db['ChatQueue'][_0x9a67('0x56')](_0x4d417b);})['then'](function(_0x53df3d){_0x50398f[_0x9a67('0x57')]=_0x53df3d;return _0x50398f;})[_0x9a67('0x3b')](respondWithFilteredResult(_0x570498,_0x4d417b))[_0x9a67('0x30')](handleError(_0x570498,null));};exports[_0x9a67('0x58')]=function(_0xca8e83,_0x5b61ae){var _0x493e8a={'raw':!![],'where':{'id':_0xca8e83[_0x9a67('0x59')]['id']}},_0xcd370c={};_0xcd370c[_0x9a67('0x47')]=_[_0x9a67('0x5a')](db[_0x9a67('0x42')][_0x9a67('0x43')]);_0xcd370c[_0x9a67('0x48')]=_[_0x9a67('0x5a')](_0xca8e83[_0x9a67('0x48')]);_0xcd370c[_0x9a67('0x4f')]=_['intersection'](_0xcd370c[_0x9a67('0x47')],_0xcd370c[_0x9a67('0x48')]);_0x493e8a[_0x9a67('0x4a')]=_[_0x9a67('0x46')](_0xcd370c[_0x9a67('0x47')],qs[_0x9a67('0x49')](_0xca8e83['query'][_0x9a67('0x49')]));_0x493e8a[_0x9a67('0x4a')]=_0x493e8a[_0x9a67('0x4a')][_0x9a67('0x5b')]?_0x493e8a[_0x9a67('0x4a')]:_0xcd370c[_0x9a67('0x47')];if(_0xca8e83[_0x9a67('0x48')][_0x9a67('0x54')]){_0x493e8a[_0x9a67('0x55')]=[{'all':!![]}];}_0x493e8a=_[_0x9a67('0x52')]({},_0x493e8a,_0xca8e83[_0x9a67('0x53')]);return db[_0x9a67('0x42')][_0x9a67('0x5c')](_0x493e8a)[_0x9a67('0x3b')](handleEntityNotFound(_0x5b61ae,null))[_0x9a67('0x3b')](respondWithResult(_0x5b61ae,null))['catch'](handleError(_0x5b61ae,null));};exports[_0x9a67('0x5d')]=function(_0x31cb2f,_0x2b7e29){return db[_0x9a67('0x42')][_0x9a67('0x5d')](_0x31cb2f[_0x9a67('0x5e')],{})[_0x9a67('0x3b')](function(_0x4a0cc3){var _0x547a8e=_0x31cb2f['user'][_0x9a67('0x5f')]({'plain':!![]});if(!_0x547a8e)throw new Error(_0x9a67('0x60'));if(_0x547a8e['role']===_0x9a67('0x61')){var _0x310d93=_0x4a0cc3[_0x9a67('0x5f')]({'plain':!![]});var _0x1ae367=_0x9a67('0x3d');return db[_0x9a67('0x62')][_0x9a67('0x5c')]({'where':{'name':_0x1ae367,'userProfileId':_0x547a8e[_0x9a67('0x63')]},'raw':!![]})['then'](function(_0x35972a){if(_0x35972a&&_0x35972a['autoAssociation']===0x0){return db[_0x9a67('0x3e')][_0x9a67('0x5d')]({'name':_0x310d93['name'],'resourceId':_0x310d93['id'],'type':_0x35972a[_0x9a67('0x40')],'sectionId':_0x35972a['id']},{})['then'](function(){return _0x4a0cc3;});}else{return _0x4a0cc3;}})['catch'](function(_0x10227d){logger[_0x9a67('0x2c')](_0x9a67('0x64'),_0x10227d);throw _0x10227d;});}return _0x4a0cc3;})[_0x9a67('0x3b')](respondWithResult(_0x2b7e29,0xc9))['catch'](handleError(_0x2b7e29,null));};exports[_0x9a67('0x65')]=function(_0x583c13,_0x24f27c){if(_0x583c13['body']['id']){delete _0x583c13[_0x9a67('0x5e')]['id'];}return db[_0x9a67('0x42')]['find']({'where':{'id':_0x583c13['params']['id']}})[_0x9a67('0x3b')](handleEntityNotFound(_0x24f27c,null))[_0x9a67('0x3b')](saveUpdates(_0x583c13['body'],null))[_0x9a67('0x3b')](respondWithResult(_0x24f27c,null))['catch'](handleError(_0x24f27c,null));};exports[_0x9a67('0x3c')]=function(_0x3e71fd,_0x106680){return db[_0x9a67('0x42')][_0x9a67('0x5c')]({'where':{'id':_0x3e71fd['params']['id']}})['then'](handleEntityNotFound(_0x106680,null))[_0x9a67('0x3b')](removeEntity(_0x106680,null))['catch'](handleError(_0x106680,null));};exports[_0x9a67('0x66')]=function(_0x3a78ca,_0x14e295){return db['ChatQueue'][_0x9a67('0x66')]()[_0x9a67('0x3b')](respondWithResult(_0x14e295,null))[_0x9a67('0x30')](handleError(_0x14e295,null));};exports['getMembers']=function(_0x4a842c,_0x2962ae,_0x3cccc1){var _0x345b16={'raw':!![],'where':{}},_0x58cd9f={},_0x2ac248;return db[_0x9a67('0x42')][_0x9a67('0x67')]({'where':{'id':_0x4a842c['params']['id']}})[_0x9a67('0x3b')](handleEntityNotFound(_0x2962ae,null))[_0x9a67('0x3b')](function(_0x124311){if(_0x124311){_0x2ac248=_0x124311[_0x9a67('0x5f')]({'plain':!![]});_0x58cd9f[_0x9a67('0x47')]=_[_0x9a67('0x5a')](db[_0x9a67('0x68')]['rawAttributes']);_0x58cd9f['query']=_[_0x9a67('0x5a')](_0x4a842c[_0x9a67('0x48')]);_0x58cd9f[_0x9a67('0x4f')]=_['intersection'](_0x58cd9f[_0x9a67('0x47')],_0x58cd9f['query']);_0x345b16[_0x9a67('0x4a')]=_[_0x9a67('0x46')](_0x58cd9f[_0x9a67('0x47')],qs['fields'](_0x4a842c['query'][_0x9a67('0x49')]));_0x345b16['attributes']=_0x345b16[_0x9a67('0x4a')]['length']?_0x345b16[_0x9a67('0x4a')]:_0x58cd9f[_0x9a67('0x47')];if(!_0x4a842c[_0x9a67('0x48')][_0x9a67('0x4b')](_0x9a67('0x4c'))){_0x345b16[_0x9a67('0x36')]=qs[_0x9a67('0x36')](_0x4a842c[_0x9a67('0x48')][_0x9a67('0x36')]);_0x345b16[_0x9a67('0x35')]=qs[_0x9a67('0x35')](_0x4a842c[_0x9a67('0x48')][_0x9a67('0x35')]);}_0x345b16[_0x9a67('0x69')]=qs[_0x9a67('0x4d')](_0x4a842c[_0x9a67('0x48')][_0x9a67('0x4d')]);_0x345b16['where']=qs[_0x9a67('0x4f')](_[_0x9a67('0x50')](_0x4a842c['query'],_0x58cd9f[_0x9a67('0x4f')]));_0x345b16[_0x9a67('0x4e')][_0x9a67('0x6a')]=_0x124311['id'];if(_0x4a842c[_0x9a67('0x48')]['filter']){_0x345b16[_0x9a67('0x4e')]=_[_0x9a67('0x52')](_0x345b16[_0x9a67('0x4e')],{'$or':_['map'](_0x345b16[_0x9a67('0x4a')],function(_0x50c88a){var _0x194b74={};_0x194b74[_0x50c88a]={'$like':'%'+_0x4a842c[_0x9a67('0x48')][_0x9a67('0x51')]+'%'};return _0x194b74;})});}_0x345b16=_[_0x9a67('0x52')]({},_0x345b16,_0x4a842c[_0x9a67('0x53')]);return db[_0x9a67('0x68')][_0x9a67('0x56')](_0x345b16);}})['then'](function(_0x4f5e9a){if(_0x4f5e9a){return db[_0x9a67('0x6b')]['findAndCountAll']({'where':{'id':_['map'](_0x4f5e9a,_0x9a67('0x6c')),'role':_0x9a67('0x6d')},'attributes':['id',_0x9a67('0x40'),_0x9a67('0x6e'),'updatedAt',_0x9a67('0x6f')]});}})[_0x9a67('0x3b')](function(_0x488f6e){if(_0x488f6e){return{'count':_0x488f6e[_0x9a67('0x34')],'rows':_[_0x9a67('0x45')](_0x488f6e['rows'],function(_0x53f75a){return{'membername':_0x53f75a['name'],'UserId':_0x53f75a['id'],'queue_name':_0x2ac248[_0x9a67('0x40')],'ChatQueueId':_0x2ac248['id'],'interface':util['format'](_0x9a67('0x70'),_0x9a67('0x71'),_0x53f75a['name']),'penalty':0x0,'paused':_0x53f75a['chatPause'],'createdAt':_0x53f75a[_0x9a67('0x6f')],'updatedAt':_0x53f75a[_0x9a67('0x72')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9a67('0x3b')](respondWithFilteredResult(_0x2962ae,_0x345b16))[_0x9a67('0x30')](handleError(_0x2962ae,null));};exports['getTeams']=function(_0x570717,_0x463e67,_0x5dc956){var _0x101cb8={};var _0x2a30bc={};var _0x51cf3b;var _0x1e7895;return db[_0x9a67('0x42')]['findOne']({'where':{'id':_0x570717[_0x9a67('0x59')]['id']}})[_0x9a67('0x3b')](handleEntityNotFound(_0x463e67,null))[_0x9a67('0x3b')](function(_0x544905){if(_0x544905){_0x51cf3b=_0x544905;_0x2a30bc[_0x9a67('0x47')]=_['keys'](db[_0x9a67('0x73')][_0x9a67('0x43')]);_0x2a30bc['query']=_[_0x9a67('0x5a')](_0x570717[_0x9a67('0x48')]);_0x2a30bc['filters']=_[_0x9a67('0x46')](_0x2a30bc[_0x9a67('0x47')],_0x2a30bc[_0x9a67('0x48')]);_0x101cb8['attributes']=_[_0x9a67('0x46')](_0x2a30bc[_0x9a67('0x47')],qs[_0x9a67('0x49')](_0x570717[_0x9a67('0x48')][_0x9a67('0x49')]));_0x101cb8[_0x9a67('0x4a')]=_0x101cb8['attributes'][_0x9a67('0x5b')]?_0x101cb8['attributes']:_0x2a30bc[_0x9a67('0x47')];_0x101cb8[_0x9a67('0x69')]=qs['sort'](_0x570717['query'][_0x9a67('0x4d')]);_0x101cb8['where']=qs[_0x9a67('0x4f')](_[_0x9a67('0x50')](_0x570717[_0x9a67('0x48')],_0x2a30bc[_0x9a67('0x4f')]));if(_0x570717[_0x9a67('0x48')][_0x9a67('0x51')]){_0x101cb8[_0x9a67('0x4e')]=_[_0x9a67('0x52')](_0x101cb8['where'],{'$or':_[_0x9a67('0x45')](_0x101cb8[_0x9a67('0x4a')],function(_0x2fe205){var _0x3a39fc={};_0x3a39fc[_0x2fe205]={'$like':'%'+_0x570717[_0x9a67('0x48')][_0x9a67('0x51')]+'%'};return _0x3a39fc;})});}_0x101cb8=_[_0x9a67('0x52')]({},_0x101cb8,_0x570717[_0x9a67('0x53')]);return _0x51cf3b[_0x9a67('0x74')](_0x101cb8);}})[_0x9a67('0x3b')](function(_0x213eb9){if(_0x213eb9){_0x1e7895=_0x213eb9[_0x9a67('0x5b')];if(!_0x570717[_0x9a67('0x48')][_0x9a67('0x4b')](_0x9a67('0x4c'))){_0x101cb8['limit']=qs[_0x9a67('0x36')](_0x570717[_0x9a67('0x48')][_0x9a67('0x36')]);_0x101cb8[_0x9a67('0x35')]=qs['offset'](_0x570717[_0x9a67('0x48')]['offset']);}return _0x51cf3b['getTeams'](_0x101cb8);}})[_0x9a67('0x3b')](function(_0x387bf7){if(_0x387bf7){return _0x387bf7?{'count':_0x1e7895,'rows':_0x387bf7}:null;}})[_0x9a67('0x3b')](respondWithResult(_0x463e67,null))[_0x9a67('0x30')](handleError(_0x463e67,null));};exports[_0x9a67('0x75')]=function(_0x68f3e2,_0x10dd14,_0x202725){var _0x459f9b=_0x68f3e2[_0x9a67('0x5e')][_0x9a67('0x76')];return db[_0x9a67('0x73')][_0x9a67('0x56')]({'where':{'id':_0x459f9b},'attributes':['id'],'include':[{'model':db[_0x9a67('0x6b')],'as':_0x9a67('0x77'),'attributes':['id','name','online',_0x9a67('0x78'),_0x9a67('0x79')],'raw':!![]}]})[_0x9a67('0x3b')](function(_0x4dd6f8){if(_0x4dd6f8){var _0x487dae=_[_0x9a67('0x7a')](_0x4dd6f8,function(_0xe24e9d){var _0x20a8af=_0xe24e9d[_0x9a67('0x5f')]({'plain':!![]});return _0x20a8af[_0x9a67('0x77')];});return db[_0x9a67('0x42')][_0x9a67('0x5c')]({'where':{'id':_0x68f3e2[_0x9a67('0x59')]['id']}})[_0x9a67('0x3b')](function(_0xd4b6f4){return db['sequelize'][_0x9a67('0x7b')](function(_0x45dbbb){return _0xd4b6f4[_0x9a67('0x75')](_0x459f9b,{'transaction':_0x45dbbb})[_0x9a67('0x3b')](function(){return BPromise['each'](_0x487dae,function(_0x1d6fae){return db[_0x9a67('0x68')][_0x9a67('0x7c')]({'where':{'UserId':_0x1d6fae['id'],'ChatQueueId':_0x68f3e2['params']['id']},'transaction':_0x45dbbb});});})[_0x9a67('0x3b')](function(){_0x487dae[_0x9a67('0x7d')](function(_0x3b11dd){socket[_0x9a67('0x7e')](_0x9a67('0x7f'),{'UserId':_0x3b11dd['id'],'ChatQueueId':_0xd4b6f4['id']});});});});});}})[_0x9a67('0x3b')](respondWithStatusCode(_0x10dd14,null))[_0x9a67('0x30')](handleError(_0x10dd14,null));};exports[_0x9a67('0x80')]=function(_0x58d1ec,_0x357ee3,_0x5ba8af){return db[_0x9a67('0x73')][_0x9a67('0x56')]({'where':{'id':_0x58d1ec[_0x9a67('0x48')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9a67('0x6b')],'as':_0x9a67('0x77'),'attributes':['id'],'raw':!![]}]})[_0x9a67('0x3b')](handleEntityNotFound(_0x357ee3,null))[_0x9a67('0x3b')](function(_0x3f3598){var _0x2fdd5d=_[_0x9a67('0x45')](_0x3f3598,'id');var _0x1ece72=[];var _0x3f2cc4=[];var _0x20faa2=squel[_0x9a67('0x81')]();_0x20faa2[_0x9a67('0x82')]('tq.TeamId')[_0x9a67('0x83')](_0x9a67('0x84'),'tq')['join']('user_has_teams','ut',_0x9a67('0x85'))['where'](_0x9a67('0x86'),_0x58d1ec[_0x9a67('0x59')]['id']);for(var _0x222bba=0x0;_0x222bba<_0x3f3598[_0x9a67('0x5b')];_0x222bba+=0x1){let _0x4e5b4e=_0x3f3598[_0x222bba];for(var _0x393f79=0x0;_0x393f79<_0x4e5b4e[_0x9a67('0x77')]['length'];_0x393f79+=0x1){let _0x16157c=_0x4e5b4e[_0x9a67('0x77')][_0x393f79];var _0x1e049a=_0x20faa2[_0x9a67('0x87')]();_0x1e049a[_0x9a67('0x4e')](_0x9a67('0x88'),_0x16157c['id']);_0x3f2cc4[_0x9a67('0x89')](db[_0x9a67('0x8a')][_0x9a67('0x48')](_0x1e049a[_0x9a67('0x8b')](),{'type':db[_0x9a67('0x8a')]['QueryTypes'][_0x9a67('0x8c')]})[_0x9a67('0x3b')](function(_0x51a1c9){if(_0x51a1c9[_0x9a67('0x5b')]===0x1){return _0x16157c['id'];}else{var _0x1c3716=_['every'](_['map'](_0x51a1c9,'TeamId'),function(_0x3fa4d9){return _[_0x9a67('0x8d')](_0x2fdd5d,_0x3fa4d9);});if(_0x1c3716){return _0x16157c['id'];}}}));}}return BPromise[_0x9a67('0x8e')](_0x3f2cc4)[_0x9a67('0x3b')](function(_0x402a52){_0x1ece72=_(_0x1ece72)['union'](_0x402a52)['compact']()['value']();return db[_0x9a67('0x42')]['find']({'where':{'id':_0x58d1ec[_0x9a67('0x59')]['id']}})[_0x9a67('0x3b')](function(_0x5a4577){return db['sequelize'][_0x9a67('0x7b')](function(_0x4c89d3){return _0x5a4577['removeTeams'](_0x58d1ec[_0x9a67('0x48')][_0x9a67('0x76')],{'transaction':_0x4c89d3})['then'](function(){if(!_[_0x9a67('0x8f')](_0x1ece72)){return _0x5a4577[_0x9a67('0x90')](_0x1ece72,{'transaction':_0x4c89d3});}})[_0x9a67('0x3b')](function(){_0x1ece72['forEach'](function(_0x453ec3){socket[_0x9a67('0x7e')]('userChatQueue:remove',{'UserId':_0x453ec3,'ChatQueueId':_0x5a4577['id']});});});});});});})[_0x9a67('0x3b')](respondWithStatusCode(_0x357ee3,null))['catch'](handleError(_0x357ee3,null));};exports[_0x9a67('0x91')]=function(_0x426681,_0x3ac48c,_0x5b10cd){return db[_0x9a67('0x42')]['find']({'where':{'id':_0x426681['params']['id']}})['then'](handleEntityNotFound(_0x3ac48c,null))[_0x9a67('0x3b')](function(_0x497bbc){if(_0x497bbc){return _0x497bbc['addAgents'](_0x426681[_0x9a67('0x5e')]['ids'],_['omit'](_0x426681[_0x9a67('0x5e')],[_0x9a67('0x76'),'id'])||{})['spread'](function(_0x15d0d4){for(var _0x534ba7=0x0;_0x534ba7<_0x426681[_0x9a67('0x5e')][_0x9a67('0x76')][_0x9a67('0x5b')];_0x534ba7+=0x1){socket[_0x9a67('0x7e')]('userChatQueue:save',{'UserId':_0x426681['body'][_0x9a67('0x76')][_0x534ba7],'ChatQueueId':_0x426681[_0x9a67('0x59')]['id']});}return _0x15d0d4;});}})[_0x9a67('0x3b')](respondWithResult(_0x3ac48c,null))['catch'](handleError(_0x3ac48c,null));};exports[_0x9a67('0x90')]=function(_0x265de3,_0x3fc940,_0x398237){return db[_0x9a67('0x42')][_0x9a67('0x5c')]({'where':{'id':_0x265de3['params']['id']}})[_0x9a67('0x3b')](handleEntityNotFound(_0x3fc940,null))['then'](function(_0x28b0cb){if(_0x28b0cb){return _0x28b0cb[_0x9a67('0x90')](_0x265de3[_0x9a67('0x48')][_0x9a67('0x76')])[_0x9a67('0x3b')](function(){if(_['isArray'](_0x265de3[_0x9a67('0x48')]['ids'])){for(var _0x3a7c60=0x0;_0x3a7c60<_0x265de3[_0x9a67('0x48')][_0x9a67('0x76')]['length'];_0x3a7c60+=0x1){socket[_0x9a67('0x7e')](_0x9a67('0x92'),{'UserId':Number(_0x265de3[_0x9a67('0x48')][_0x9a67('0x76')][_0x3a7c60]),'ChatQueueId':Number(_0x265de3[_0x9a67('0x59')]['id'])});}}else{socket['emit'](_0x9a67('0x92'),{'UserId':Number(_0x265de3[_0x9a67('0x48')][_0x9a67('0x76')]),'ChatQueueId':Number(_0x265de3[_0x9a67('0x59')]['id'])});}});}})[_0x9a67('0x3b')](respondWithStatusCode(_0x3fc940,null))['catch'](handleError(_0x3fc940,null));};exports['getAgents']=function(_0x281120,_0x478fe3,_0x33fbfb){var _0x53db3f={};var _0x1fbf7c={};var _0x1d99e7;var _0x3a1b5d;return db[_0x9a67('0x42')][_0x9a67('0x67')]({'where':{'id':_0x281120['params']['id']}})['then'](handleEntityNotFound(_0x478fe3,null))[_0x9a67('0x3b')](function(_0x1a3445){if(_0x1a3445){_0x1d99e7=_0x1a3445;_0x1fbf7c[_0x9a67('0x47')]=_['keys'](db[_0x9a67('0x6b')][_0x9a67('0x43')]);_0x1fbf7c[_0x9a67('0x48')]=_[_0x9a67('0x5a')](_0x281120[_0x9a67('0x48')]);_0x1fbf7c[_0x9a67('0x4f')]=_[_0x9a67('0x46')](_0x1fbf7c['model'],_0x1fbf7c[_0x9a67('0x48')]);_0x53db3f[_0x9a67('0x4a')]=_['intersection'](_0x1fbf7c[_0x9a67('0x47')],qs[_0x9a67('0x49')](_0x281120['query']['fields']));_0x53db3f[_0x9a67('0x4a')]=_0x53db3f[_0x9a67('0x4a')][_0x9a67('0x5b')]?_0x53db3f[_0x9a67('0x4a')]:_0x1fbf7c['model'];_0x53db3f[_0x9a67('0x69')]=qs['sort'](_0x281120[_0x9a67('0x48')]['sort']);_0x53db3f[_0x9a67('0x4e')]=qs[_0x9a67('0x4f')](_['pick'](_0x281120[_0x9a67('0x48')],_0x1fbf7c['filters']));if(_0x281120['query'][_0x9a67('0x51')]){_0x53db3f[_0x9a67('0x4e')]=_[_0x9a67('0x52')](_0x53db3f[_0x9a67('0x4e')],{'$or':_[_0x9a67('0x45')](_0x53db3f[_0x9a67('0x4a')],function(_0xcc925c){var _0x11e2fc={};_0x11e2fc[_0xcc925c]={'$like':'%'+_0x281120[_0x9a67('0x48')][_0x9a67('0x51')]+'%'};return _0x11e2fc;})});}_0x53db3f=_[_0x9a67('0x52')]({},_0x53db3f,_0x281120[_0x9a67('0x53')]);return _0x1d99e7[_0x9a67('0x93')](_0x53db3f);}})['then'](function(_0x3c181a){if(_0x3c181a){_0x3a1b5d=_0x3c181a['length'];if(!_0x281120[_0x9a67('0x48')]['hasOwnProperty'](_0x9a67('0x4c'))){_0x53db3f['limit']=qs[_0x9a67('0x36')](_0x281120[_0x9a67('0x48')]['limit']);_0x53db3f[_0x9a67('0x35')]=qs[_0x9a67('0x35')](_0x281120[_0x9a67('0x48')][_0x9a67('0x35')]);}return _0x1d99e7['getAgents'](_0x53db3f);}})[_0x9a67('0x3b')](function(_0x249d7a){if(_0x249d7a){return _0x249d7a?{'count':_0x3a1b5d,'rows':_0x249d7a}:null;}})[_0x9a67('0x3b')](respondWithResult(_0x478fe3,null))[_0x9a67('0x30')](handleError(_0x478fe3,null));}; \ No newline at end of file +var _0x8f89=['options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','pick','ChatQueueId','User','chatPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','transaction','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','removeAgents','forEach','userChatQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','map','ChatQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show'];(function(_0x1dac5d,_0x131b84){var _0x468fc8=function(_0x1aea95){while(--_0x1aea95){_0x1dac5d['push'](_0x1dac5d['shift']());}};_0x468fc8(++_0x131b84);}(_0x8f89,0x178));var _0x98f8=function(_0x3ed545,_0x4bd536){_0x3ed545=_0x3ed545-0x0;var _0x21acce=_0x8f89[_0x3ed545];return _0x21acce;};'use strict';var pdf=require(_0x98f8('0x0'));var emlformat=require(_0x98f8('0x1'));var rimraf=require(_0x98f8('0x2'));var zipdir=require(_0x98f8('0x3'));var jsonpatch=require(_0x98f8('0x4'));var rp=require(_0x98f8('0x5'));var moment=require(_0x98f8('0x6'));var BPromise=require(_0x98f8('0x7'));var Mustache=require(_0x98f8('0x8'));var util=require('util');var path=require(_0x98f8('0x9'));var sox=require('sox');var csv=require(_0x98f8('0xa'));var ejs=require(_0x98f8('0xb'));var fs=require('fs');var _=require(_0x98f8('0xc'));var squel=require(_0x98f8('0xd'));var crypto=require(_0x98f8('0xe'));var jsforce=require(_0x98f8('0xf'));var deskjs=require(_0x98f8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x98f8('0x11'));var Papa=require('papaparse');var Redis=require(_0x98f8('0x12'));var authService=require(_0x98f8('0x13'));var qs=require(_0x98f8('0x14'));var as=require(_0x98f8('0x15'));var hardwareService=require(_0x98f8('0x16'));var logger=require(_0x98f8('0x17'))('api');var utils=require(_0x98f8('0x18'));var config=require(_0x98f8('0x19'));var db=require(_0x98f8('0x1a'))['db'];config[_0x98f8('0x1b')]=_[_0x98f8('0x1c')](config[_0x98f8('0x1b')],{'host':_0x98f8('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98f8('0x1b')]));require(_0x98f8('0x1e'))['register'](socket);var jayson=require(_0x98f8('0x1f'));var client=jayson[_0x98f8('0x20')][_0x98f8('0x21')]({'port':0x232a});function checkPasswordPattern(_0x1c9a7d,_0x3a3308,_0x42f072){if(_0x42f072){var _0x76818e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x76818e[_0x98f8('0x22')](_0x3a3308)){return _0x1c9a7d;}else{throw new db[(_0x98f8('0x23'))][(_0x98f8('0x24'))](_0x98f8('0x25'));}}else{return _0x1c9a7d;}}function respondWithRpcPromise(_0x4d6dc7,_0x329157,_0x36dffa,_0x5a3ad7){return new BPromise(function(_0xc0abc2,_0x357456){var _0x1891b4=_0x5a3ad7||client;return _0x1891b4[_0x98f8('0x26')](_0x4d6dc7,_0x36dffa)['then'](function(_0x514b72){logger[_0x98f8('0x27')](_0x98f8('0x28'),_0x329157,_0x98f8('0x29'));logger['debug'](_0x98f8('0x2a'),_0x329157,'request\x20sent',JSON[_0x98f8('0x2b')](_0x514b72));if(_0x514b72[_0x98f8('0x2c')]){if(_0x514b72[_0x98f8('0x2c')][_0x98f8('0x2d')]===0x1f4){logger[_0x98f8('0x2c')](_0x98f8('0x28'),_0x329157,_0x514b72['error'][_0x98f8('0x2e')]);return _0x357456(_0x514b72[_0x98f8('0x2c')][_0x98f8('0x2e')]);}logger[_0x98f8('0x2c')](_0x98f8('0x28'),_0x329157,_0x514b72[_0x98f8('0x2c')][_0x98f8('0x2e')]);return _0xc0abc2(_0x514b72[_0x98f8('0x2c')][_0x98f8('0x2e')]);}else{logger[_0x98f8('0x27')]('ChatQueue,\x20%s,\x20%s',_0x329157,_0x98f8('0x29'));_0xc0abc2(_0x514b72[_0x98f8('0x2f')][_0x98f8('0x2e')]);}})[_0x98f8('0x30')](function(_0x439059){logger[_0x98f8('0x2c')](_0x98f8('0x28'),_0x329157,_0x439059);_0x357456(_0x439059);});});}function respondWithStatusCode(_0x1d2387,_0x1c2261){_0x1c2261=_0x1c2261||0xcc;return function(_0x377400){if(_0x377400){return _0x1d2387[_0x98f8('0x31')](_0x1c2261);}return _0x1d2387[_0x98f8('0x32')](_0x1c2261)[_0x98f8('0x33')]();};}function respondWithResult(_0x485650,_0x22f285){_0x22f285=_0x22f285||0xc8;return function(_0x3dccdb){if(_0x3dccdb){return _0x485650[_0x98f8('0x32')](_0x22f285)[_0x98f8('0x34')](_0x3dccdb);}};}function respondWithFilteredResult(_0x128858,_0x31c9ce){return function(_0x9e98c5){if(_0x9e98c5){var _0x4beaa0=_0x9e98c5[_0x98f8('0x35')],_0x3e95b2=_0x31c9ce[_0x98f8('0x36')],_0x18b439=_0x31c9ce[_0x98f8('0x36')]+_0x31c9ce[_0x98f8('0x37')],_0x282922;if(_0x18b439>=_0x4beaa0){_0x18b439=_0x4beaa0;_0x282922=0xc8;}else{_0x282922=0xce;}_0x128858[_0x98f8('0x32')](_0x282922);return _0x128858[_0x98f8('0x38')](_0x98f8('0x39'),_0x3e95b2+'-'+_0x18b439+'/'+_0x4beaa0)[_0x98f8('0x34')](_0x9e98c5);}return null;};}function patchUpdates(_0x443bfa){return function(_0x899c1e){try{jsonpatch[_0x98f8('0x3a')](_0x899c1e,_0x443bfa,!![]);}catch(_0x95a459){return BPromise[_0x98f8('0x3b')](_0x95a459);}return _0x899c1e[_0x98f8('0x3c')]();};}function saveUpdates(_0x3de331,_0x37e03e){return function(_0x26825f){if(_0x26825f){return _0x26825f[_0x98f8('0x3d')](_0x3de331)[_0x98f8('0x3e')](function(_0x387690){return _0x387690;});}return null;};}function removeEntity(_0x3d63e3,_0x3ab418){return function(_0x427b2d){if(_0x427b2d){return _0x427b2d[_0x98f8('0x3f')]()[_0x98f8('0x3e')](function(){var _0x10b64b=_0x427b2d[_0x98f8('0x40')]({'plain':!![]});var _0x314b2f='ChatQueues';return db[_0x98f8('0x41')]['destroy']({'where':{'type':_0x314b2f,'resourceId':_0x10b64b['id']}})[_0x98f8('0x3e')](function(){return _0x427b2d;});})[_0x98f8('0x3e')](function(){_0x3d63e3[_0x98f8('0x32')](0xcc)[_0x98f8('0x33')]();});}};}function handleEntityNotFound(_0x4db4ba,_0x4a06f8){return function(_0x39b496){if(!_0x39b496){_0x4db4ba[_0x98f8('0x31')](0x194);}return _0x39b496;};}function handleError(_0x464e64,_0x4b8c16){_0x4b8c16=_0x4b8c16||0x1f4;return function(_0x1aeaf6){logger[_0x98f8('0x2c')](_0x1aeaf6[_0x98f8('0x42')]);if(_0x1aeaf6[_0x98f8('0x43')]){delete _0x1aeaf6[_0x98f8('0x43')];}_0x464e64[_0x98f8('0x32')](_0x4b8c16)['send'](_0x1aeaf6);};}exports['index']=function(_0x2dda46,_0x40c7d3){var _0x42a3e1={},_0x424cad={},_0x193c8d={'count':0x0,'rows':[]};var _0x4b4039=_[_0x98f8('0x44')](db[_0x98f8('0x45')][_0x98f8('0x46')],function(_0x1c1f3d){return{'name':_0x1c1f3d['fieldName'],'type':_0x1c1f3d[_0x98f8('0x47')][_0x98f8('0x48')]};});_0x424cad[_0x98f8('0x49')]=_[_0x98f8('0x44')](_0x4b4039,_0x98f8('0x43'));_0x424cad[_0x98f8('0x4a')]=_[_0x98f8('0x4b')](_0x2dda46[_0x98f8('0x4a')]);_0x424cad[_0x98f8('0x4c')]=_[_0x98f8('0x4d')](_0x424cad['model'],_0x424cad['query']);_0x42a3e1[_0x98f8('0x4e')]=_[_0x98f8('0x4d')](_0x424cad[_0x98f8('0x49')],qs['fields'](_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x4f')]));_0x42a3e1[_0x98f8('0x4e')]=_0x42a3e1['attributes'][_0x98f8('0x50')]?_0x42a3e1[_0x98f8('0x4e')]:_0x424cad[_0x98f8('0x49')];if(!_0x2dda46[_0x98f8('0x4a')]['hasOwnProperty']('nolimit')){_0x42a3e1[_0x98f8('0x37')]=qs[_0x98f8('0x37')](_0x2dda46[_0x98f8('0x4a')]['limit']);_0x42a3e1['offset']=qs[_0x98f8('0x36')](_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x36')]);}_0x42a3e1[_0x98f8('0x51')]=qs[_0x98f8('0x52')](_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x52')]);_0x42a3e1[_0x98f8('0x53')]=qs['filters'](_['pick'](_0x2dda46[_0x98f8('0x4a')],_0x424cad['filters']),_0x4b4039);if(_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x54')]){_0x42a3e1['where']=_['merge'](_0x42a3e1[_0x98f8('0x53')],{'$or':_[_0x98f8('0x44')](_0x4b4039,function(_0x459f58){if(_0x459f58[_0x98f8('0x47')]!==_0x98f8('0x55')){var _0x5015ea={};_0x5015ea[_0x459f58[_0x98f8('0x43')]]={'$like':'%'+_0x2dda46['query'][_0x98f8('0x54')]+'%'};return _0x5015ea;}})});}_0x42a3e1=_[_0x98f8('0x56')]({},_0x42a3e1,_0x2dda46['options']);var _0x7d77cb={'where':_0x42a3e1[_0x98f8('0x53')]};return db[_0x98f8('0x45')][_0x98f8('0x35')](_0x7d77cb)[_0x98f8('0x3e')](function(_0x39e9ad){_0x193c8d['count']=_0x39e9ad;if(_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x57')]){_0x42a3e1[_0x98f8('0x58')]=[{'all':!![]}];}return db['ChatQueue'][_0x98f8('0x59')](_0x42a3e1);})[_0x98f8('0x3e')](function(_0x2aa65c){_0x193c8d[_0x98f8('0x5a')]=_0x2aa65c;return _0x193c8d;})[_0x98f8('0x3e')](respondWithFilteredResult(_0x40c7d3,_0x42a3e1))['catch'](handleError(_0x40c7d3,null));};exports[_0x98f8('0x5b')]=function(_0x414c30,_0x2f5dfe){var _0x30fd05={'raw':!![],'where':{'id':_0x414c30['params']['id']}},_0x127f6a={};_0x127f6a[_0x98f8('0x49')]=_[_0x98f8('0x4b')](db[_0x98f8('0x45')][_0x98f8('0x46')]);_0x127f6a['query']=_[_0x98f8('0x4b')](_0x414c30[_0x98f8('0x4a')]);_0x127f6a[_0x98f8('0x4c')]=_[_0x98f8('0x4d')](_0x127f6a[_0x98f8('0x49')],_0x127f6a[_0x98f8('0x4a')]);_0x30fd05[_0x98f8('0x4e')]=_['intersection'](_0x127f6a['model'],qs[_0x98f8('0x4f')](_0x414c30['query']['fields']));_0x30fd05[_0x98f8('0x4e')]=_0x30fd05['attributes'][_0x98f8('0x50')]?_0x30fd05['attributes']:_0x127f6a[_0x98f8('0x49')];if(_0x414c30['query'][_0x98f8('0x57')]){_0x30fd05['include']=[{'all':!![]}];}_0x30fd05=_[_0x98f8('0x56')]({},_0x30fd05,_0x414c30[_0x98f8('0x5c')]);return db[_0x98f8('0x45')][_0x98f8('0x5d')](_0x30fd05)['then'](handleEntityNotFound(_0x2f5dfe,null))[_0x98f8('0x3e')](respondWithResult(_0x2f5dfe,null))['catch'](handleError(_0x2f5dfe,null));};exports[_0x98f8('0x5e')]=function(_0x365654,_0x44d8c7){return db[_0x98f8('0x45')]['create'](_0x365654[_0x98f8('0x5f')],{})[_0x98f8('0x3e')](function(_0x2cbca9){var _0x5c3c64=_0x365654[_0x98f8('0x60')]['get']({'plain':!![]});if(!_0x5c3c64)throw new Error(_0x98f8('0x61'));if(_0x5c3c64[_0x98f8('0x62')]===_0x98f8('0x60')){var _0x158807=_0x2cbca9[_0x98f8('0x40')]({'plain':!![]});var _0x1bdd2e=_0x98f8('0x63');return db[_0x98f8('0x64')]['find']({'where':{'name':_0x1bdd2e,'userProfileId':_0x5c3c64[_0x98f8('0x65')]},'raw':!![]})['then'](function(_0x20a1c6){if(_0x20a1c6&&_0x20a1c6['autoAssociation']===0x0){return db[_0x98f8('0x41')][_0x98f8('0x5e')]({'name':_0x158807[_0x98f8('0x43')],'resourceId':_0x158807['id'],'type':_0x20a1c6[_0x98f8('0x43')],'sectionId':_0x20a1c6['id']},{})['then'](function(){return _0x2cbca9;});}else{return _0x2cbca9;}})[_0x98f8('0x30')](function(_0x3cfc9b){logger[_0x98f8('0x2c')](_0x98f8('0x66'),_0x3cfc9b);throw _0x3cfc9b;});}return _0x2cbca9;})[_0x98f8('0x3e')](respondWithResult(_0x44d8c7,0xc9))[_0x98f8('0x30')](handleError(_0x44d8c7,null));};exports[_0x98f8('0x3d')]=function(_0x479622,_0x2c35ad){if(_0x479622[_0x98f8('0x5f')]['id']){delete _0x479622[_0x98f8('0x5f')]['id'];}return db['ChatQueue'][_0x98f8('0x5d')]({'where':{'id':_0x479622[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x2c35ad,null))[_0x98f8('0x3e')](saveUpdates(_0x479622[_0x98f8('0x5f')],null))[_0x98f8('0x3e')](respondWithResult(_0x2c35ad,null))[_0x98f8('0x30')](handleError(_0x2c35ad,null));};exports[_0x98f8('0x3f')]=function(_0x5b4dcc,_0x202797){return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0x5b4dcc[_0x98f8('0x67')]['id']}})['then'](handleEntityNotFound(_0x202797,null))[_0x98f8('0x3e')](removeEntity(_0x202797,null))[_0x98f8('0x30')](handleError(_0x202797,null));};exports[_0x98f8('0x68')]=function(_0x2f2061,_0xea228a){return db[_0x98f8('0x45')]['describe']()[_0x98f8('0x3e')](respondWithResult(_0xea228a,null))['catch'](handleError(_0xea228a,null));};exports[_0x98f8('0x69')]=function(_0x205c0a,_0x23f7c3,_0x378307){var _0x6c08f9={'raw':!![],'where':{}},_0x11112f={},_0x3ae34e;return db[_0x98f8('0x45')][_0x98f8('0x6a')]({'where':{'id':_0x205c0a[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x23f7c3,null))['then'](function(_0x5907cc){if(_0x5907cc){_0x3ae34e=_0x5907cc[_0x98f8('0x40')]({'plain':!![]});_0x11112f['model']=_[_0x98f8('0x4b')](db[_0x98f8('0x6b')]['rawAttributes']);_0x11112f[_0x98f8('0x4a')]=_[_0x98f8('0x4b')](_0x205c0a[_0x98f8('0x4a')]);_0x11112f[_0x98f8('0x4c')]=_[_0x98f8('0x4d')](_0x11112f[_0x98f8('0x49')],_0x11112f[_0x98f8('0x4a')]);_0x6c08f9[_0x98f8('0x4e')]=_[_0x98f8('0x4d')](_0x11112f[_0x98f8('0x49')],qs[_0x98f8('0x4f')](_0x205c0a[_0x98f8('0x4a')]['fields']));_0x6c08f9[_0x98f8('0x4e')]=_0x6c08f9['attributes'][_0x98f8('0x50')]?_0x6c08f9[_0x98f8('0x4e')]:_0x11112f[_0x98f8('0x49')];if(!_0x205c0a[_0x98f8('0x4a')][_0x98f8('0x6c')](_0x98f8('0x6d'))){_0x6c08f9[_0x98f8('0x37')]=qs['limit'](_0x205c0a[_0x98f8('0x4a')]['limit']);_0x6c08f9[_0x98f8('0x36')]=qs[_0x98f8('0x36')](_0x205c0a[_0x98f8('0x4a')][_0x98f8('0x36')]);}_0x6c08f9[_0x98f8('0x51')]=qs['sort'](_0x205c0a['query']['sort']);_0x6c08f9['where']=qs[_0x98f8('0x4c')](_[_0x98f8('0x6e')](_0x205c0a[_0x98f8('0x4a')],_0x11112f[_0x98f8('0x4c')]));_0x6c08f9[_0x98f8('0x53')][_0x98f8('0x6f')]=_0x5907cc['id'];if(_0x205c0a['query'][_0x98f8('0x54')]){_0x6c08f9['where']=_[_0x98f8('0x56')](_0x6c08f9['where'],{'$or':_[_0x98f8('0x44')](_0x6c08f9['attributes'],function(_0x25e6be){var _0x43b26f={};_0x43b26f[_0x25e6be]={'$like':'%'+_0x205c0a['query']['filter']+'%'};return _0x43b26f;})});}_0x6c08f9=_[_0x98f8('0x56')]({},_0x6c08f9,_0x205c0a[_0x98f8('0x5c')]);return db['UserChatQueue']['findAll'](_0x6c08f9);}})['then'](function(_0x5c8083){if(_0x5c8083){return db[_0x98f8('0x70')]['findAndCountAll']({'where':{'id':_[_0x98f8('0x44')](_0x5c8083,'UserId'),'role':'agent'},'attributes':['id',_0x98f8('0x43'),_0x98f8('0x71'),_0x98f8('0x72'),_0x98f8('0x73')]});}})[_0x98f8('0x3e')](function(_0x351daf){if(_0x351daf){return{'count':_0x351daf[_0x98f8('0x35')],'rows':_[_0x98f8('0x44')](_0x351daf[_0x98f8('0x5a')],function(_0x32fcf7){return{'membername':_0x32fcf7[_0x98f8('0x43')],'UserId':_0x32fcf7['id'],'queue_name':_0x3ae34e[_0x98f8('0x43')],'ChatQueueId':_0x3ae34e['id'],'interface':util[_0x98f8('0x74')]('%s/%s',_0x98f8('0x75'),_0x32fcf7[_0x98f8('0x43')]),'penalty':0x0,'paused':_0x32fcf7[_0x98f8('0x71')],'createdAt':_0x32fcf7[_0x98f8('0x73')],'updatedAt':_0x32fcf7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x98f8('0x3e')](respondWithFilteredResult(_0x23f7c3,_0x6c08f9))[_0x98f8('0x30')](handleError(_0x23f7c3,null));};exports['getTeams']=function(_0x3233e6,_0x2541aa,_0x3e0bc5){var _0x1f7fa0={};var _0x194e63={};var _0x3bf5ea;var _0x7c8dc7;return db['ChatQueue']['findOne']({'where':{'id':_0x3233e6[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x2541aa,null))[_0x98f8('0x3e')](function(_0xaa4a52){if(_0xaa4a52){_0x3bf5ea=_0xaa4a52;_0x194e63[_0x98f8('0x49')]=_['keys'](db['Team'][_0x98f8('0x46')]);_0x194e63['query']=_['keys'](_0x3233e6[_0x98f8('0x4a')]);_0x194e63[_0x98f8('0x4c')]=_['intersection'](_0x194e63['model'],_0x194e63['query']);_0x1f7fa0['attributes']=_[_0x98f8('0x4d')](_0x194e63[_0x98f8('0x49')],qs[_0x98f8('0x4f')](_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x4f')]));_0x1f7fa0['attributes']=_0x1f7fa0[_0x98f8('0x4e')][_0x98f8('0x50')]?_0x1f7fa0[_0x98f8('0x4e')]:_0x194e63[_0x98f8('0x49')];_0x1f7fa0[_0x98f8('0x51')]=qs[_0x98f8('0x52')](_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x52')]);_0x1f7fa0[_0x98f8('0x53')]=qs[_0x98f8('0x4c')](_['pick'](_0x3233e6[_0x98f8('0x4a')],_0x194e63[_0x98f8('0x4c')]));if(_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x54')]){_0x1f7fa0[_0x98f8('0x53')]=_[_0x98f8('0x56')](_0x1f7fa0[_0x98f8('0x53')],{'$or':_[_0x98f8('0x44')](_0x1f7fa0[_0x98f8('0x4e')],function(_0x458570){var _0x40d755={};_0x40d755[_0x458570]={'$like':'%'+_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x54')]+'%'};return _0x40d755;})});}_0x1f7fa0=_[_0x98f8('0x56')]({},_0x1f7fa0,_0x3233e6[_0x98f8('0x5c')]);return _0x3bf5ea['getTeams'](_0x1f7fa0);}})['then'](function(_0x4fa3e0){if(_0x4fa3e0){_0x7c8dc7=_0x4fa3e0[_0x98f8('0x50')];if(!_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x6c')](_0x98f8('0x6d'))){_0x1f7fa0[_0x98f8('0x37')]=qs[_0x98f8('0x37')](_0x3233e6[_0x98f8('0x4a')]['limit']);_0x1f7fa0[_0x98f8('0x36')]=qs[_0x98f8('0x36')](_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x36')]);}return _0x3bf5ea[_0x98f8('0x76')](_0x1f7fa0);}})[_0x98f8('0x3e')](function(_0x10938d){if(_0x10938d){return _0x10938d?{'count':_0x7c8dc7,'rows':_0x10938d}:null;}})[_0x98f8('0x3e')](respondWithResult(_0x2541aa,null))['catch'](handleError(_0x2541aa,null));};exports[_0x98f8('0x77')]=function(_0xc49371,_0x1b637e,_0x4ee50d){var _0x51251b=_0xc49371[_0x98f8('0x5f')][_0x98f8('0x78')];return db[_0x98f8('0x79')][_0x98f8('0x59')]({'where':{'id':_0x51251b},'attributes':['id'],'include':[{'model':db[_0x98f8('0x70')],'as':_0x98f8('0x7a'),'attributes':['id',_0x98f8('0x43'),_0x98f8('0x7b'),_0x98f8('0x7c'),_0x98f8('0x7d')],'raw':!![]}]})[_0x98f8('0x3e')](function(_0x40439a){if(_0x40439a){var _0x1c3c74=_['flatMap'](_0x40439a,function(_0x4c483e){var _0x44127a=_0x4c483e[_0x98f8('0x40')]({'plain':!![]});return _0x44127a[_0x98f8('0x7a')];});return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0xc49371[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](function(_0x351e9c){return db['sequelize'][_0x98f8('0x7e')](function(_0x34a480){return _0x351e9c[_0x98f8('0x77')](_0x51251b,{'transaction':_0x34a480})[_0x98f8('0x3e')](function(){return BPromise['each'](_0x1c3c74,function(_0x4bce0d){return db[_0x98f8('0x6b')][_0x98f8('0x7f')]({'where':{'UserId':_0x4bce0d['id'],'ChatQueueId':_0xc49371[_0x98f8('0x67')]['id']},'transaction':_0x34a480});});})[_0x98f8('0x3e')](function(){_0x1c3c74['forEach'](function(_0x132a92){socket[_0x98f8('0x80')]('userChatQueue:save',{'UserId':_0x132a92['id'],'ChatQueueId':_0x351e9c['id']});});});});});}})['then'](respondWithStatusCode(_0x1b637e,null))[_0x98f8('0x30')](handleError(_0x1b637e,null));};exports[_0x98f8('0x81')]=function(_0x3ac8a1,_0x5ce81e,_0x30ff70){return db[_0x98f8('0x79')][_0x98f8('0x59')]({'where':{'id':_0x3ac8a1[_0x98f8('0x4a')][_0x98f8('0x78')]},'attributes':['id'],'include':[{'model':db[_0x98f8('0x70')],'as':_0x98f8('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x98f8('0x3e')](handleEntityNotFound(_0x5ce81e,null))[_0x98f8('0x3e')](function(_0x24d03f){var _0x2b98e8=_['map'](_0x24d03f,'id');var _0x5ea535=[];var _0x4c2cc6=[];var _0xc7475c=squel[_0x98f8('0x82')]();_0xc7475c[_0x98f8('0x83')](_0x98f8('0x84'))[_0x98f8('0x85')]('team_has_chat_queues','tq')[_0x98f8('0x86')](_0x98f8('0x87'),'ut',_0x98f8('0x88'))[_0x98f8('0x53')](_0x98f8('0x89'),_0x3ac8a1[_0x98f8('0x67')]['id']);for(var _0x5a87c8=0x0;_0x5a87c8<_0x24d03f[_0x98f8('0x50')];_0x5a87c8+=0x1){let _0x1b1f50=_0x24d03f[_0x5a87c8];for(var _0x4d3a18=0x0;_0x4d3a18<_0x1b1f50[_0x98f8('0x7a')]['length'];_0x4d3a18+=0x1){let _0x19f1fa=_0x1b1f50['Agents'][_0x4d3a18];var _0x1b533d=_0xc7475c['clone']();_0x1b533d['where'](_0x98f8('0x8a'),_0x19f1fa['id']);_0x4c2cc6[_0x98f8('0x8b')](db[_0x98f8('0x8c')]['query'](_0x1b533d['toString'](),{'type':db[_0x98f8('0x8c')][_0x98f8('0x8d')][_0x98f8('0x8e')]})['then'](function(_0x1fe448){if(_0x1fe448[_0x98f8('0x50')]===0x1){return _0x19f1fa['id'];}else{var _0x20f14c=_[_0x98f8('0x8f')](_[_0x98f8('0x44')](_0x1fe448,'TeamId'),function(_0x323c6d){return _[_0x98f8('0x90')](_0x2b98e8,_0x323c6d);});if(_0x20f14c){return _0x19f1fa['id'];}}}));}}return BPromise[_0x98f8('0x91')](_0x4c2cc6)[_0x98f8('0x3e')](function(_0x159086){_0x5ea535=_(_0x5ea535)[_0x98f8('0x92')](_0x159086)[_0x98f8('0x93')]()[_0x98f8('0x94')]();return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0x3ac8a1[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](function(_0x4a91ad){return db[_0x98f8('0x8c')][_0x98f8('0x7e')](function(_0x1c6ce5){return _0x4a91ad[_0x98f8('0x81')](_0x3ac8a1[_0x98f8('0x4a')]['ids'],{'transaction':_0x1c6ce5})[_0x98f8('0x3e')](function(){if(!_['isEmpty'](_0x5ea535)){return _0x4a91ad[_0x98f8('0x95')](_0x5ea535,{'transaction':_0x1c6ce5});}})['then'](function(){_0x5ea535[_0x98f8('0x96')](function(_0x557fd3){socket[_0x98f8('0x80')](_0x98f8('0x97'),{'UserId':_0x557fd3,'ChatQueueId':_0x4a91ad['id']});});});});});});})[_0x98f8('0x3e')](respondWithStatusCode(_0x5ce81e,null))[_0x98f8('0x30')](handleError(_0x5ce81e,null));};exports[_0x98f8('0x98')]=function(_0x5b3bd2,_0x4ee87a,_0x154245){return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0x5b3bd2[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x4ee87a,null))[_0x98f8('0x3e')](function(_0x41590a){if(_0x41590a){return _0x41590a[_0x98f8('0x98')](_0x5b3bd2['body']['ids'],_['omit'](_0x5b3bd2[_0x98f8('0x5f')],['ids','id'])||{})[_0x98f8('0x99')](function(_0x14de40){for(var _0x15d4b9=0x0;_0x15d4b9<_0x5b3bd2[_0x98f8('0x5f')]['ids'][_0x98f8('0x50')];_0x15d4b9+=0x1){socket[_0x98f8('0x80')]('userChatQueue:save',{'UserId':_0x5b3bd2[_0x98f8('0x5f')][_0x98f8('0x78')][_0x15d4b9],'ChatQueueId':_0x5b3bd2['params']['id']});}return _0x14de40;});}})[_0x98f8('0x3e')](respondWithResult(_0x4ee87a,null))[_0x98f8('0x30')](handleError(_0x4ee87a,null));};exports[_0x98f8('0x95')]=function(_0x26d2f8,_0xa4e3d9,_0x4b0b40){return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0x26d2f8[_0x98f8('0x67')]['id']}})['then'](handleEntityNotFound(_0xa4e3d9,null))['then'](function(_0x5c08db){if(_0x5c08db){return _0x5c08db[_0x98f8('0x95')](_0x26d2f8[_0x98f8('0x4a')]['ids'])[_0x98f8('0x3e')](function(){if(_[_0x98f8('0x9a')](_0x26d2f8[_0x98f8('0x4a')][_0x98f8('0x78')])){for(var _0x22a43c=0x0;_0x22a43c<_0x26d2f8['query'][_0x98f8('0x78')][_0x98f8('0x50')];_0x22a43c+=0x1){socket[_0x98f8('0x80')](_0x98f8('0x97'),{'UserId':Number(_0x26d2f8['query'][_0x98f8('0x78')][_0x22a43c]),'ChatQueueId':Number(_0x26d2f8[_0x98f8('0x67')]['id'])});}}else{socket[_0x98f8('0x80')]('userChatQueue:remove',{'UserId':Number(_0x26d2f8['query'][_0x98f8('0x78')]),'ChatQueueId':Number(_0x26d2f8['params']['id'])});}});}})[_0x98f8('0x3e')](respondWithStatusCode(_0xa4e3d9,null))[_0x98f8('0x30')](handleError(_0xa4e3d9,null));};exports['getAgents']=function(_0x43c9b3,_0x20f042,_0xe0f634){var _0x264b2c={};var _0xab7af5={};var _0x4323ae;var _0x126d9e;return db['ChatQueue']['findOne']({'where':{'id':_0x43c9b3[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x20f042,null))[_0x98f8('0x3e')](function(_0x43d622){if(_0x43d622){_0x4323ae=_0x43d622;_0xab7af5[_0x98f8('0x49')]=_[_0x98f8('0x4b')](db['User']['rawAttributes']);_0xab7af5[_0x98f8('0x4a')]=_[_0x98f8('0x4b')](_0x43c9b3[_0x98f8('0x4a')]);_0xab7af5['filters']=_[_0x98f8('0x4d')](_0xab7af5['model'],_0xab7af5[_0x98f8('0x4a')]);_0x264b2c[_0x98f8('0x4e')]=_[_0x98f8('0x4d')](_0xab7af5[_0x98f8('0x49')],qs[_0x98f8('0x4f')](_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x4f')]));_0x264b2c[_0x98f8('0x4e')]=_0x264b2c[_0x98f8('0x4e')]['length']?_0x264b2c[_0x98f8('0x4e')]:_0xab7af5[_0x98f8('0x49')];_0x264b2c['order']=qs[_0x98f8('0x52')](_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x52')]);_0x264b2c['where']=qs[_0x98f8('0x4c')](_['pick'](_0x43c9b3[_0x98f8('0x4a')],_0xab7af5['filters']));if(_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x54')]){_0x264b2c[_0x98f8('0x53')]=_[_0x98f8('0x56')](_0x264b2c[_0x98f8('0x53')],{'$or':_[_0x98f8('0x44')](_0x264b2c[_0x98f8('0x4e')],function(_0x4a080d){var _0x3af1b3={};_0x3af1b3[_0x4a080d]={'$like':'%'+_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x54')]+'%'};return _0x3af1b3;})});}_0x264b2c=_[_0x98f8('0x56')]({},_0x264b2c,_0x43c9b3[_0x98f8('0x5c')]);return _0x4323ae[_0x98f8('0x9b')](_0x264b2c);}})[_0x98f8('0x3e')](function(_0x51b8ee){if(_0x51b8ee){_0x126d9e=_0x51b8ee[_0x98f8('0x50')];if(!_0x43c9b3[_0x98f8('0x4a')]['hasOwnProperty']('nolimit')){_0x264b2c[_0x98f8('0x37')]=qs['limit'](_0x43c9b3['query']['limit']);_0x264b2c[_0x98f8('0x36')]=qs[_0x98f8('0x36')](_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x36')]);}return _0x4323ae[_0x98f8('0x9b')](_0x264b2c);}})[_0x98f8('0x3e')](function(_0xa8e943){if(_0xa8e943){return _0xa8e943?{'count':_0x126d9e,'rows':_0xa8e943}:null;}})['then'](respondWithResult(_0x20f042,null))[_0x98f8('0x30')](handleError(_0x20f042,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9162072..193e142 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x337f8e,_0x48c37a){var _0x94b4e8=function(_0x1a46e5){while(--_0x1a46e5){_0x337f8e['push'](_0x337f8e['shift']());}};_0x94b4e8(++_0x48c37a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1dfd6a,_0x43e2b8){_0x1dfd6a=_0x1dfd6a-0x0;var _0x41fe5e=_0x5f2f[_0x1dfd6a];return _0x41fe5e;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x3431d1,_0x4c50a8){var _0x1f5f66=function(_0x2cc566){while(--_0x2cc566){_0x3431d1['push'](_0x3431d1['shift']());}};_0x1f5f66(++_0x4c50a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x248ae1,_0x3a5e3b){_0x248ae1=_0x248ae1-0x0;var _0x29f1e9=_0x5f2f[_0x248ae1];return _0x29f1e9;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 58b7a44..be928c6 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 _0x7493=['exports','define','ChatQueue','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x2f122b,_0x14ffd8){var _0x4b2c4b=function(_0x54879c){while(--_0x54879c){_0x2f122b['push'](_0x2f122b['shift']());}};_0x4b2c4b(++_0x14ffd8);}(_0x7493,0x13b));var _0x3749=function(_0xb4788,_0x1efb8d){_0xb4788=_0xb4788-0x0;var _0xd49d21=_0x7493[_0xb4788];return _0xd49d21;};'use strict';var _=require('lodash');var util=require(_0x3749('0x0'));var logger=require(_0x3749('0x1'))(_0x3749('0x2'));var moment=require(_0x3749('0x3'));var BPromise=require(_0x3749('0x4'));var rp=require(_0x3749('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3749('0x6'));var config=require(_0x3749('0x7'));var attributes=require(_0x3749('0x8'));module[_0x3749('0x9')]=function(_0x1621ba,_0x2c78c8){return _0x1621ba[_0x3749('0xa')](_0x3749('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e75=['./chatQueue.attributes','exports','define','ChatQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b44db,_0x3a027d){var _0x29a68b=function(_0x1082ab){while(--_0x1082ab){_0x4b44db['push'](_0x4b44db['shift']());}};_0x29a68b(++_0x3a027d);}(_0x1e75,0x86));var _0x51e7=function(_0x1849bb,_0x1aee37){_0x1849bb=_0x1849bb-0x0;var _0x4a12a6=_0x1e75[_0x1849bb];return _0x4a12a6;};'use strict';var _=require('lodash');var util=require(_0x51e7('0x0'));var logger=require(_0x51e7('0x1'))(_0x51e7('0x2'));var moment=require(_0x51e7('0x3'));var BPromise=require(_0x51e7('0x4'));var rp=require(_0x51e7('0x5'));var fs=require('fs');var path=require(_0x51e7('0x6'));var rimraf=require(_0x51e7('0x7'));var config=require(_0x51e7('0x8'));var attributes=require(_0x51e7('0x9'));module[_0x51e7('0xa')]=function(_0xd5fbc7,_0x3b1414){return _0xd5fbc7[_0x51e7('0xb')](_0x51e7('0xc'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index d6c8116..b7e6bb4 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 _0x3906=['result','GetChatQueue','ChatQueue','findAll','options','where','include','attributes','model','find','raw','map','ShowChatQueue','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2644ec,_0x42c4da){var _0x155449=function(_0x510f99){while(--_0x510f99){_0x2644ec['push'](_0x2644ec['shift']());}};_0x155449(++_0x42c4da);}(_0x3906,0xd6));var _0x6390=function(_0x166eea,_0xb7c5b5){_0x166eea=_0x166eea-0x0;var _0x1893e2=_0x3906[_0x166eea];return _0x1893e2;};'use strict';var _=require(_0x6390('0x0'));var util=require(_0x6390('0x1'));var moment=require('moment');var BPromise=require(_0x6390('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6390('0x3'));var db=require(_0x6390('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6390('0x5'))(_0x6390('0x6'));var config=require(_0x6390('0x7'));var jayson=require(_0x6390('0x8'));var client=jayson[_0x6390('0x9')][_0x6390('0xa')]({'port':0x232a});config[_0x6390('0xb')]=_[_0x6390('0xc')](config[_0x6390('0xb')],{'host':_0x6390('0xd'),'port':0x18eb});var socket=require(_0x6390('0xe'))(new Redis(config[_0x6390('0xb')]));require('./chatQueue.socket')[_0x6390('0xf')](socket);function respondWithRpcPromise(_0x522556,_0x105319,_0x1f4e72){return new BPromise(function(_0x277742,_0x428b3d){return client[_0x6390('0x10')](_0x522556,_0x1f4e72)[_0x6390('0x11')](function(_0x5f1482){logger[_0x6390('0x12')](_0x6390('0x13'),_0x105319,_0x6390('0x14'));logger[_0x6390('0x15')](_0x6390('0x16'),_0x105319,_0x6390('0x14'),JSON[_0x6390('0x17')](_0x5f1482));if(_0x5f1482[_0x6390('0x18')]){if(_0x5f1482[_0x6390('0x18')]['code']===0x1f4){logger[_0x6390('0x18')](_0x6390('0x13'),_0x105319,_0x5f1482[_0x6390('0x18')][_0x6390('0x19')]);return _0x428b3d(_0x5f1482[_0x6390('0x18')][_0x6390('0x19')]);}logger[_0x6390('0x18')](_0x6390('0x13'),_0x105319,_0x5f1482[_0x6390('0x18')][_0x6390('0x19')]);return _0x277742(_0x5f1482['error']['message']);}else{logger[_0x6390('0x12')](_0x6390('0x13'),_0x105319,_0x6390('0x14'));_0x277742(_0x5f1482[_0x6390('0x1a')][_0x6390('0x19')]);}})['catch'](function(_0x35cdce){logger[_0x6390('0x18')](_0x6390('0x13'),_0x105319,_0x35cdce);_0x428b3d(_0x35cdce);});});}exports[_0x6390('0x1b')]=function(_0x42520d){var _0xcdb5ab=this;return new Promise(function(_0x1c5414,_0x31de0a){return db[_0x6390('0x1c')][_0x6390('0x1d')]({'raw':_0x42520d['options']?_0x42520d['options']['raw']===undefined?!![]:![]:!![],'where':_0x42520d[_0x6390('0x1e')]?_0x42520d['options'][_0x6390('0x1f')]||null:null,'attributes':_0x42520d[_0x6390('0x1e')]?_0x42520d[_0x6390('0x1e')]['attributes']||null:null,'limit':_0x42520d['options']?_0x42520d[_0x6390('0x1e')]['limit']||null:null,'include':_0x42520d['options']?_0x42520d[_0x6390('0x1e')][_0x6390('0x20')]?_['map'](_0x42520d['options'][_0x6390('0x20')],function(_0x34391c){return{'model':db[_0x34391c['model']],'as':_0x34391c['as'],'attributes':_0x34391c[_0x6390('0x21')],'include':_0x34391c['include']?_['map'](_0x34391c[_0x6390('0x20')],function(_0x2cba99){return{'model':db[_0x2cba99[_0x6390('0x22')]],'as':_0x2cba99['as'],'attributes':_0x2cba99[_0x6390('0x21')],'include':_0x2cba99['include']?_['map'](_0x2cba99[_0x6390('0x20')],function(_0x25779b){return{'model':db[_0x25779b[_0x6390('0x22')]],'as':_0x25779b['as'],'attributes':_0x25779b[_0x6390('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27a174){logger[_0x6390('0x12')](_0x6390('0x1b'),_0x42520d);logger[_0x6390('0x15')](_0x6390('0x1b'),_0x42520d,JSON['stringify'](_0x27a174));_0x1c5414(_0x27a174);})['catch'](function(_0x446917){logger[_0x6390('0x18')]('GetChatQueue',_0x446917[_0x6390('0x19')],_0x42520d);_0x31de0a(_0xcdb5ab[_0x6390('0x18')](0x1f4,_0x446917[_0x6390('0x19')]));});});};exports['ShowChatQueue']=function(_0x2cb36b){var _0x5cd765=this;return new Promise(function(_0x2fa7f6,_0x21c2ff){return db['ChatQueue'][_0x6390('0x23')]({'raw':_0x2cb36b[_0x6390('0x1e')]?_0x2cb36b[_0x6390('0x1e')][_0x6390('0x24')]===undefined?!![]:![]:!![],'where':_0x2cb36b[_0x6390('0x1e')]?_0x2cb36b[_0x6390('0x1e')]['where']||null:null,'attributes':_0x2cb36b[_0x6390('0x1e')]?_0x2cb36b[_0x6390('0x1e')]['attributes']||null:null,'include':_0x2cb36b[_0x6390('0x1e')]?_0x2cb36b[_0x6390('0x1e')][_0x6390('0x20')]?_['map'](_0x2cb36b[_0x6390('0x1e')][_0x6390('0x20')],function(_0x403f6f){return{'model':db[_0x403f6f[_0x6390('0x22')]],'as':_0x403f6f['as'],'attributes':_0x403f6f['attributes'],'include':_0x403f6f[_0x6390('0x20')]?_[_0x6390('0x25')](_0x403f6f['include'],function(_0x4fa793){return{'model':db[_0x4fa793[_0x6390('0x22')]],'as':_0x4fa793['as'],'attributes':_0x4fa793['attributes'],'include':_0x4fa793['include']?_[_0x6390('0x25')](_0x4fa793[_0x6390('0x20')],function(_0x2e5324){return{'model':db[_0x2e5324[_0x6390('0x22')]],'as':_0x2e5324['as'],'attributes':_0x2e5324[_0x6390('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fe3d1){logger[_0x6390('0x12')](_0x6390('0x26'),_0x2cb36b);logger['debug']('ShowChatQueue',_0x2cb36b,JSON['stringify'](_0x3fe3d1));_0x2fa7f6(_0x3fe3d1);})[_0x6390('0x27')](function(_0x11837e){logger[_0x6390('0x18')]('ShowChatQueue',_0x11837e[_0x6390('0x19')],_0x2cb36b);_0x21c2ff(_0x5cd765[_0x6390('0x18')](0x1f4,_0x11837e['message']));});});}; \ No newline at end of file +var _0x8e3f=['rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','map','include','model','then','ShowChatQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4a62bd,_0x5a1c68){var _0x3ac21f=function(_0x1a19c2){while(--_0x1a19c2){_0x4a62bd['push'](_0x4a62bd['shift']());}};_0x3ac21f(++_0x5a1c68);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('ChatQueue,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('ChatQueue,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});}exports[_0xf8e3('0x1c')]=function(_0x24e8d6){var _0x31f55d=this;return new Promise(function(_0x3128ad,_0x11c58e){return db[_0xf8e3('0x1d')][_0xf8e3('0x1e')]({'raw':_0x24e8d6['options']?_0x24e8d6[_0xf8e3('0x1f')][_0xf8e3('0x20')]===undefined?!![]:![]:!![],'where':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6[_0xf8e3('0x1f')]['where']||null:null,'attributes':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6['options'][_0xf8e3('0x21')]||null:null,'limit':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6[_0xf8e3('0x1f')][_0xf8e3('0x22')]||null:null,'include':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6[_0xf8e3('0x1f')]['include']?_[_0xf8e3('0x23')](_0x24e8d6[_0xf8e3('0x1f')][_0xf8e3('0x24')],function(_0x417b42){return{'model':db[_0x417b42[_0xf8e3('0x25')]],'as':_0x417b42['as'],'attributes':_0x417b42[_0xf8e3('0x21')],'include':_0x417b42[_0xf8e3('0x24')]?_[_0xf8e3('0x23')](_0x417b42['include'],function(_0x356e0a){return{'model':db[_0x356e0a[_0xf8e3('0x25')]],'as':_0x356e0a['as'],'attributes':_0x356e0a[_0xf8e3('0x21')],'include':_0x356e0a[_0xf8e3('0x24')]?_[_0xf8e3('0x23')](_0x356e0a[_0xf8e3('0x24')],function(_0x16485e){return{'model':db[_0x16485e[_0xf8e3('0x25')]],'as':_0x16485e['as'],'attributes':_0x16485e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf8e3('0x26')](function(_0x243e28){logger[_0xf8e3('0x11')](_0xf8e3('0x1c'),_0x24e8d6);logger['debug'](_0xf8e3('0x1c'),_0x24e8d6,JSON[_0xf8e3('0x16')](_0x243e28));_0x3128ad(_0x243e28);})[_0xf8e3('0x1b')](function(_0x45df49){logger[_0xf8e3('0x17')](_0xf8e3('0x1c'),_0x45df49[_0xf8e3('0x19')],_0x24e8d6);_0x11c58e(_0x31f55d[_0xf8e3('0x17')](0x1f4,_0x45df49['message']));});});};exports[_0xf8e3('0x27')]=function(_0x527337){var _0x4acd6c=this;return new Promise(function(_0x5d2dd5,_0x5cc1ed){return db[_0xf8e3('0x1d')]['find']({'raw':_0x527337[_0xf8e3('0x1f')]?_0x527337[_0xf8e3('0x1f')][_0xf8e3('0x20')]===undefined?!![]:![]:!![],'where':_0x527337[_0xf8e3('0x1f')]?_0x527337['options']['where']||null:null,'attributes':_0x527337[_0xf8e3('0x1f')]?_0x527337[_0xf8e3('0x1f')][_0xf8e3('0x21')]||null:null,'include':_0x527337[_0xf8e3('0x1f')]?_0x527337[_0xf8e3('0x1f')][_0xf8e3('0x24')]?_['map'](_0x527337[_0xf8e3('0x1f')]['include'],function(_0x56cd7b){return{'model':db[_0x56cd7b[_0xf8e3('0x25')]],'as':_0x56cd7b['as'],'attributes':_0x56cd7b[_0xf8e3('0x21')],'include':_0x56cd7b[_0xf8e3('0x24')]?_[_0xf8e3('0x23')](_0x56cd7b['include'],function(_0x5ece46){return{'model':db[_0x5ece46[_0xf8e3('0x25')]],'as':_0x5ece46['as'],'attributes':_0x5ece46[_0xf8e3('0x21')],'include':_0x5ece46['include']?_[_0xf8e3('0x23')](_0x5ece46[_0xf8e3('0x24')],function(_0x35ac8a){return{'model':db[_0x35ac8a[_0xf8e3('0x25')]],'as':_0x35ac8a['as'],'attributes':_0x35ac8a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d307e){logger[_0xf8e3('0x11')](_0xf8e3('0x27'),_0x527337);logger[_0xf8e3('0x13')](_0xf8e3('0x27'),_0x527337,JSON['stringify'](_0x5d307e));_0x5d2dd5(_0x5d307e);})[_0xf8e3('0x1b')](function(_0x4b55fb){logger[_0xf8e3('0x17')](_0xf8e3('0x27'),_0x4b55fb[_0xf8e3('0x19')],_0x527337);_0x5cc1ed(_0x4acd6c[_0xf8e3('0x17')](0x1f4,_0x4b55fb[_0xf8e3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9e9c8c9..226dc02 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(_0x5e7b8c,_0x568ddc){var _0x223bc1=function(_0x5983ba){while(--_0x5983ba){_0x5e7b8c['push'](_0x5e7b8c['shift']());}};_0x223bc1(++_0x568ddc);}(_0x0b0e,0x187));var _0xe0b0=function(_0x23e859,_0x419ccc){_0x23e859=_0x23e859-0x0;var _0xe4964=_0x0b0e[_0x23e859];return _0xe4964;};'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 _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x20634c,_0x5534fc){var _0x5d8936=function(_0x6b45f2){while(--_0x6b45f2){_0x20634c['push'](_0x20634c['shift']());}};_0x5d8936(++_0x5534fc);}(_0xb10b,0x12a));var _0xbb10=function(_0x58b6a8,_0x307021){_0x58b6a8=_0x58b6a8-0x0;var _0xc566dc=_0xb10b[_0x58b6a8];return _0xc566dc;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ec98b8f..12eb9d8 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 _0xdaec=['getMembers','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members'];(function(_0x28a6d7,_0x106ff0){var _0xc65da7=function(_0x261b48){while(--_0x261b48){_0x28a6d7['push'](_0x28a6d7['shift']());}};_0xc65da7(++_0x106ff0);}(_0xdaec,0x1de));var _0xcdae=function(_0x12efd7,_0x14202f){_0x12efd7=_0x12efd7-0x0;var _0x4bb9b2=_0xdaec[_0x12efd7];return _0x4bb9b2;};'use strict';var multer=require(_0xcdae('0x0'));var util=require(_0xcdae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcdae('0x2'));var router=express[_0xcdae('0x3')]();var auth=require(_0xcdae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcdae('0x5'));var controller=require(_0xcdae('0x6'));router['get']('/',auth[_0xcdae('0x7')](),controller[_0xcdae('0x8')]);router[_0xcdae('0x9')](_0xcdae('0xa'),auth[_0xcdae('0x7')](),controller[_0xcdae('0xb')]);router['get'](_0xcdae('0xc'),auth['isAuthenticated'](),controller[_0xcdae('0xd')]);router['get'](_0xcdae('0xe'),auth[_0xcdae('0x7')](),controller[_0xcdae('0xf')]);router['get']('/:id/teams',auth[_0xcdae('0x7')](),controller[_0xcdae('0x10')]);router[_0xcdae('0x9')](_0xcdae('0x11'),auth['isAuthenticated'](),controller[_0xcdae('0x12')]);router[_0xcdae('0x13')]('/',auth[_0xcdae('0x7')](),controller[_0xcdae('0x14')]);router[_0xcdae('0x13')]('/:id/teams',auth[_0xcdae('0x7')](),controller['addTeams']);router[_0xcdae('0x13')](_0xcdae('0x11'),auth[_0xcdae('0x7')](),controller[_0xcdae('0x15')]);router[_0xcdae('0x16')](_0xcdae('0xc'),auth[_0xcdae('0x7')](),controller[_0xcdae('0x17')]);router[_0xcdae('0x18')](_0xcdae('0xc'),auth[_0xcdae('0x7')](),controller[_0xcdae('0x19')]);router['delete']('/:id/teams',auth[_0xcdae('0x7')](),controller[_0xcdae('0x1a')]);router[_0xcdae('0x18')](_0xcdae('0x11'),auth[_0xcdae('0x7')](),controller[_0xcdae('0x1b')]);module[_0xcdae('0x1c')]=router; \ No newline at end of file +var _0x3e7c=['post','create','/:id/teams','addTeams','addAgents','put','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','getTeams','/:id/users','getAgents'];(function(_0x3c8d5b,_0x14c921){var _0x2d77f2=function(_0x59f2dd){while(--_0x59f2dd){_0x3c8d5b['push'](_0x3c8d5b['shift']());}};_0x2d77f2(++_0x14c921);}(_0x3e7c,0xe9));var _0xc3e7=function(_0x46f8a4,_0x340601){_0x46f8a4=_0x46f8a4-0x0;var _0x2a7199=_0x3e7c[_0x46f8a4];return _0x2a7199;};'use strict';var multer=require(_0xc3e7('0x0'));var util=require(_0xc3e7('0x1'));var path=require(_0xc3e7('0x2'));var timeout=require(_0xc3e7('0x3'));var express=require(_0xc3e7('0x4'));var router=express[_0xc3e7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc3e7('0x6'));var config=require(_0xc3e7('0x7'));var controller=require('./chatQueue.controller');router[_0xc3e7('0x8')]('/',auth['isAuthenticated'](),controller[_0xc3e7('0x9')]);router['get'](_0xc3e7('0xa'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0xc')]);router['get'](_0xc3e7('0xd'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0xe')]);router[_0xc3e7('0x8')]('/:id/members',auth[_0xc3e7('0xb')](),controller[_0xc3e7('0xf')]);router['get']('/:id/teams',auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x10')]);router[_0xc3e7('0x8')](_0xc3e7('0x11'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x12')]);router[_0xc3e7('0x13')]('/',auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x14')]);router[_0xc3e7('0x13')](_0xc3e7('0x15'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x16')]);router[_0xc3e7('0x13')](_0xc3e7('0x11'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x17')]);router[_0xc3e7('0x18')]('/:id',auth[_0xc3e7('0xb')](),controller['update']);router[_0xc3e7('0x19')](_0xc3e7('0xd'),auth[_0xc3e7('0xb')](),controller['destroy']);router[_0xc3e7('0x19')](_0xc3e7('0x15'),auth[_0xc3e7('0xb')](),controller['removeTeams']);router[_0xc3e7('0x19')](_0xc3e7('0x11'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x1a')]);module[_0xc3e7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index cdeb107..03b58a8 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 _0xdf9d=['DATE','sequelize','exports','STRING'];(function(_0x2d138a,_0x38524c){var _0x1c13e9=function(_0x342d00){while(--_0x342d00){_0x2d138a['push'](_0x2d138a['shift']());}};_0x1c13e9(++_0x38524c);}(_0xdf9d,0x159));var _0xddf9=function(_0x463b56,_0x38026e){_0x463b56=_0x463b56-0x0;var _0x1b47d6=_0xdf9d[_0x463b56];return _0x1b47d6;};'use strict';var moment=require('moment');var Sequelize=require(_0xddf9('0x0'));module[_0xddf9('0x1')]={'uniqueid':{'type':Sequelize[_0xddf9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xddf9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xddf9('0x3')]},'acceptAt':{'type':Sequelize[_0xddf9('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xddf9('0x2')]}}; \ No newline at end of file +var _0x43ef=['exports','STRING','DATE'];(function(_0x14b1eb,_0x32a4cd){var _0x4d65b6=function(_0x13beaf){while(--_0x13beaf){_0x14b1eb['push'](_0x14b1eb['shift']());}};_0x4d65b6(++_0x32a4cd);}(_0x43ef,0x13b));var _0xf43e=function(_0x186b8f,_0x4642e6){_0x186b8f=_0x186b8f-0x0;var _0x1044af=_0x43ef[_0x186b8f];return _0x1044af;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xf43e('0x0')]={'uniqueid':{'type':Sequelize[_0xf43e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xf43e('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf43e('0x2')]},'acceptAt':{'type':Sequelize[_0xf43e('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf43e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8c38faa..f8ee46e 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 _0xbaf0=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x26b0f6,_0x22ca07){var _0x485d2f=function(_0x27414b){while(--_0x27414b){_0x26b0f6['push'](_0x26b0f6['shift']());}};_0x485d2f(++_0x22ca07);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a53e2,_0x465dd7){_0x465dd7=_0x465dd7||0xcc;return function(_0xe4378c){if(_0xe4378c){return _0x5a53e2[_0x0baf('0x1b')](_0x465dd7);}return _0x5a53e2[_0x0baf('0x1c')](_0x465dd7)['end']();};}function respondWithResult(_0x2ab33e,_0x49e44b){_0x49e44b=_0x49e44b||0xc8;return function(_0x1c76a8){if(_0x1c76a8){return _0x2ab33e[_0x0baf('0x1c')](_0x49e44b)[_0x0baf('0x1d')](_0x1c76a8);}};}function respondWithFilteredResult(_0x2bc381,_0xb8339e){return function(_0x469599){if(_0x469599){var _0x4f80a8=_0x469599[_0x0baf('0x1e')],_0x4cd79d=_0xb8339e[_0x0baf('0x1f')],_0x2312c7=_0xb8339e[_0x0baf('0x1f')]+_0xb8339e[_0x0baf('0x20')],_0x38395b;if(_0x2312c7>=_0x4f80a8){_0x2312c7=_0x4f80a8;_0x38395b=0xc8;}else{_0x38395b=0xce;}_0x2bc381['status'](_0x38395b);return _0x2bc381[_0x0baf('0x21')](_0x0baf('0x22'),_0x4cd79d+'-'+_0x2312c7+'/'+_0x4f80a8)[_0x0baf('0x1d')](_0x469599);}return null;};}function patchUpdates(_0x3e9cb4){return function(_0x47070d){try{jsonpatch[_0x0baf('0x23')](_0x47070d,_0x3e9cb4,!![]);}catch(_0x4ff793){return BPromise['reject'](_0x4ff793);}return _0x47070d[_0x0baf('0x24')]();};}function saveUpdates(_0x154f48,_0x32e839){return function(_0x1848e8){if(_0x1848e8){return _0x1848e8[_0x0baf('0x25')](_0x154f48)[_0x0baf('0x26')](function(_0x210cd8){return _0x210cd8;});}return null;};}function removeEntity(_0x636a13,_0x2c42e2){return function(_0x15a2c3){if(_0x15a2c3){return _0x15a2c3['destroy']()[_0x0baf('0x26')](function(){_0x636a13['status'](0xcc)[_0x0baf('0x27')]();});}};}function handleEntityNotFound(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(!_0x2ef0aa){_0x5dbf00['sendStatus'](0x194);}return _0x2ef0aa;};}function handleError(_0x4be1b9,_0x47c4b){_0x47c4b=_0x47c4b||0x1f4;return function(_0x27b59c){logger[_0x0baf('0x28')](_0x27b59c[_0x0baf('0x29')]);if(_0x27b59c[_0x0baf('0x2a')]){delete _0x27b59c['name'];}_0x4be1b9[_0x0baf('0x1c')](_0x47c4b)[_0x0baf('0x2b')](_0x27b59c);};}exports[_0x0baf('0x2c')]=function(_0x366e71,_0x3843b8){var _0x3b9b31={},_0x453525={},_0x549fd0={'count':0x0,'rows':[]};var _0x1590b4=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0x55c715){return{'name':_0x55c715[_0x0baf('0x30')],'type':_0x55c715[_0x0baf('0x31')]['key']};});_0x453525[_0x0baf('0x32')]=_[_0x0baf('0x2d')](_0x1590b4,_0x0baf('0x2a'));_0x453525[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x366e71[_0x0baf('0x33')]);_0x453525[_0x0baf('0x35')]=_['intersection'](_0x453525[_0x0baf('0x32')],_0x453525[_0x0baf('0x33')]);_0x3b9b31[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x453525[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x38')]));_0x3b9b31[_0x0baf('0x36')]=_0x3b9b31[_0x0baf('0x36')][_0x0baf('0x39')]?_0x3b9b31[_0x0baf('0x36')]:_0x453525[_0x0baf('0x32')];if(!_0x366e71[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3a'))){_0x3b9b31['limit']=qs[_0x0baf('0x20')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x20')]);_0x3b9b31[_0x0baf('0x1f')]=qs['offset'](_0x366e71[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x3b9b31['order']=qs[_0x0baf('0x3b')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x3b')]);_0x3b9b31[_0x0baf('0x3c')]=qs[_0x0baf('0x35')](_[_0x0baf('0x3d')](_0x366e71[_0x0baf('0x33')],_0x453525[_0x0baf('0x35')]),_0x1590b4);if(_0x366e71['query'][_0x0baf('0x3e')]){_0x3b9b31[_0x0baf('0x3c')]=_['merge'](_0x3b9b31[_0x0baf('0x3c')],{'$or':_['map'](_0x1590b4,function(_0x5c545f){if(_0x5c545f[_0x0baf('0x31')]!==_0x0baf('0x3f')){var _0x5d3ad1={};_0x5d3ad1[_0x5c545f['name']]={'$like':'%'+_0x366e71[_0x0baf('0x33')][_0x0baf('0x3e')]+'%'};return _0x5d3ad1;}})});}_0x3b9b31=_[_0x0baf('0x40')]({},_0x3b9b31,_0x366e71[_0x0baf('0x41')]);var _0x15eb5c={'where':_0x3b9b31[_0x0baf('0x3c')]};return db[_0x0baf('0x2e')][_0x0baf('0x1e')](_0x15eb5c)[_0x0baf('0x26')](function(_0x36c6d2){_0x549fd0[_0x0baf('0x1e')]=_0x36c6d2;if(_0x366e71[_0x0baf('0x33')][_0x0baf('0x42')]){_0x3b9b31[_0x0baf('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0baf('0x44')](_0x3b9b31);})[_0x0baf('0x26')](function(_0x4f1de9){_0x549fd0[_0x0baf('0x45')]=_0x4f1de9;return _0x549fd0;})[_0x0baf('0x26')](respondWithFilteredResult(_0x3843b8,_0x3b9b31))[_0x0baf('0x46')](handleError(_0x3843b8,null));};exports[_0x0baf('0x47')]=function(_0x2e20c8,_0x456d0b){var _0x57b581={'raw':!![],'where':{'id':_0x2e20c8[_0x0baf('0x48')]['id']}},_0x23ad34={};_0x23ad34['model']=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x23ad34[_0x0baf('0x33')]=_['keys'](_0x2e20c8[_0x0baf('0x33')]);_0x23ad34[_0x0baf('0x35')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],_0x23ad34[_0x0baf('0x33')]);_0x57b581[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x2e20c8[_0x0baf('0x33')]['fields']));_0x57b581[_0x0baf('0x36')]=_0x57b581[_0x0baf('0x36')][_0x0baf('0x39')]?_0x57b581[_0x0baf('0x36')]:_0x23ad34[_0x0baf('0x32')];if(_0x2e20c8['query'][_0x0baf('0x42')]){_0x57b581[_0x0baf('0x43')]=[{'all':!![]}];}_0x57b581=_[_0x0baf('0x40')]({},_0x57b581,_0x2e20c8[_0x0baf('0x41')]);return db[_0x0baf('0x2e')]['find'](_0x57b581)[_0x0baf('0x26')](handleEntityNotFound(_0x456d0b,null))[_0x0baf('0x26')](respondWithResult(_0x456d0b,null))[_0x0baf('0x46')](handleError(_0x456d0b,null));};exports[_0x0baf('0x49')]=function(_0x41599f,_0x22d10f){return db[_0x0baf('0x2e')]['create'](_0x41599f[_0x0baf('0x4a')],{})[_0x0baf('0x26')](respondWithResult(_0x22d10f,0xc9))[_0x0baf('0x46')](handleError(_0x22d10f,null));};exports['update']=function(_0x3c9de3,_0x2222b6){if(_0x3c9de3[_0x0baf('0x4a')]['id']){delete _0x3c9de3[_0x0baf('0x4a')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x3c9de3[_0x0baf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2222b6,null))[_0x0baf('0x26')](saveUpdates(_0x3c9de3[_0x0baf('0x4a')],null))[_0x0baf('0x26')](respondWithResult(_0x2222b6,null))[_0x0baf('0x46')](handleError(_0x2222b6,null));};exports[_0x0baf('0x4c')]=function(_0xc427b2,_0x40d4a6){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0xc427b2[_0x0baf('0x48')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x40d4a6,null))['then'](removeEntity(_0x40d4a6,null))['catch'](handleError(_0x40d4a6,null));};exports[_0x0baf('0x4d')]=function(_0x3d6b19,_0x1cd114){return db[_0x0baf('0x2e')][_0x0baf('0x4d')]()[_0x0baf('0x26')](respondWithResult(_0x1cd114,null))[_0x0baf('0x46')](handleError(_0x1cd114,null));}; \ No newline at end of file +var _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4e3522,_0x32dc14){var _0x2368c2=function(_0x93671){while(--_0x93671){_0x4e3522['push'](_0x4e3522['shift']());}};_0x2368c2(++_0x32dc14);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['ChatQueueReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['ChatQueueReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index da66540..1232868 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 _0xff28=['util','api','moment','bluebird','request-promise','rimraf','./chatQueueReport.attributes','define','ChatQueueReport','report_chat_queue','uniqueid','lodash'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xff28,0xe3));var _0x8ff2=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0xff28[_0x4bfcbe];return _0x5b65e6;};'use strict';var _=require(_0x8ff2('0x0'));var util=require(_0x8ff2('0x1'));var logger=require('../../config/logger')(_0x8ff2('0x2'));var moment=require(_0x8ff2('0x3'));var BPromise=require(_0x8ff2('0x4'));var rp=require(_0x8ff2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ff2('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ff2('0x7'));module['exports']=function(_0xe3a8e0,_0x23c171){return _0xe3a8e0[_0x8ff2('0x8')](_0x8ff2('0x9'),attributes,{'tableName':_0x8ff2('0xa'),'paranoid':![],'indexes':[{'name':_0x8ff2('0xb'),'fields':[_0x8ff2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28b5=['../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','api','moment','request-promise','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x28b5,0x1da));var _0x528b=function(_0x3889f9,_0x133f81){_0x3889f9=_0x3889f9-0x0;var _0xf47939=_0x28b5[_0x3889f9];return _0xf47939;};'use strict';var _=require(_0x528b('0x0'));var util=require(_0x528b('0x1'));var logger=require('../../config/logger')(_0x528b('0x2'));var moment=require(_0x528b('0x3'));var BPromise=require('bluebird');var rp=require(_0x528b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x528b('0x5'));var config=require(_0x528b('0x6'));var attributes=require(_0x528b('0x7'));module['exports']=function(_0x42ae30,_0xd44fd3){return _0x42ae30[_0x528b('0x8')](_0x528b('0x9'),attributes,{'tableName':_0x528b('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x528b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 75db46c..a3d76a8 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 _0xa110=['http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','options','body','raw','where','attributes','limit','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','client'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0xa110,0x9b));var _0x0a11=function(_0x1223ff,_0x5a07b9){_0x1223ff=_0x1223ff-0x0;var _0x11dbff=_0xa110[_0x1223ff];return _0x11dbff;};'use strict';var _=require(_0x0a11('0x0'));var util=require(_0x0a11('0x1'));var moment=require('moment');var BPromise=require(_0x0a11('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a11('0x3'));var logger=require(_0x0a11('0x4'))(_0x0a11('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a11('0x6')][_0x0a11('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56ee6c,_0x372ee5,_0x1818f3){return new BPromise(function(_0x2960eb,_0x6eec79){return client[_0x0a11('0x8')](_0x56ee6c,_0x1818f3)[_0x0a11('0x9')](function(_0x4dc530){logger[_0x0a11('0xa')](_0x0a11('0xb'),_0x372ee5,_0x0a11('0xc'));logger[_0x0a11('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x372ee5,_0x0a11('0xc'),JSON[_0x0a11('0xe')](_0x4dc530));if(_0x4dc530[_0x0a11('0xf')]){if(_0x4dc530[_0x0a11('0xf')][_0x0a11('0x10')]===0x1f4){logger[_0x0a11('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x372ee5,_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);return _0x6eec79(_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);}logger[_0x0a11('0xf')](_0x0a11('0xb'),_0x372ee5,_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);return _0x2960eb(_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);}else{logger['info'](_0x0a11('0xb'),_0x372ee5,_0x0a11('0xc'));_0x2960eb(_0x4dc530['result'][_0x0a11('0x11')]);}})[_0x0a11('0x12')](function(_0x1ed9f2){logger[_0x0a11('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x372ee5,_0x1ed9f2);_0x6eec79(_0x1ed9f2);});});}exports[_0x0a11('0x13')]=function(_0xa75869){var _0x37ddb7=this;return new Promise(function(_0x2a6ab0,_0x5299cf){return db[_0x0a11('0x14')]['create'](_0xa75869['body'],{'raw':_0xa75869[_0x0a11('0x15')]?_0xa75869['options']['raw']===undefined?!![]:![]:!![]})[_0x0a11('0x9')](function(_0x19fe27){logger[_0x0a11('0xa')](_0x0a11('0x13'),_0xa75869);logger['debug'](_0x0a11('0x13'),_0xa75869,JSON['stringify'](_0x19fe27));_0x2a6ab0(_0x19fe27);})['catch'](function(_0x41ad78){logger[_0x0a11('0xf')](_0x0a11('0x13'),_0x41ad78[_0x0a11('0x11')],_0xa75869);_0x5299cf(_0x37ddb7[_0x0a11('0xf')](0x1f4,_0x41ad78['message']));});});};exports['UpdateChatQueueReport']=function(_0x55e0fd){var _0x3e937c=this;return new Promise(function(_0x3e290b,_0x432f78){return db[_0x0a11('0x14')]['update'](_0x55e0fd[_0x0a11('0x16')],{'raw':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd['options'][_0x0a11('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd[_0x0a11('0x15')][_0x0a11('0x18')]||null:null,'attributes':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd[_0x0a11('0x15')][_0x0a11('0x19')]||null:null,'limit':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd[_0x0a11('0x15')][_0x0a11('0x1a')]||null:null})[_0x0a11('0x9')](function(_0x529eca){logger[_0x0a11('0xa')]('UpdateChatQueueReport',_0x55e0fd);logger['debug']('UpdateChatQueueReport',_0x55e0fd,JSON[_0x0a11('0xe')](_0x529eca));_0x3e290b(_0x529eca);})['catch'](function(_0x4db9e6){logger[_0x0a11('0xf')]('UpdateChatQueueReport',_0x4db9e6[_0x0a11('0x11')],_0x55e0fd);_0x432f78(_0x3e937c[_0x0a11('0xf')](0x1f4,_0x4db9e6[_0x0a11('0x11')]));});});}; \ No newline at end of file +var _0x9181=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatQueueReport','create','body','options','then','CreateChatQueueReport','catch','UpdateChatQueueReport','update','where'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x9181,0x16d));var _0x1918=function(_0x400e5e,_0x3708a7){_0x400e5e=_0x400e5e-0x0;var _0x31adfd=_0x9181[_0x400e5e];return _0x31adfd;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var moment=require(_0x1918('0x2'));var BPromise=require(_0x1918('0x3'));var rs=require(_0x1918('0x4'));var fs=require('fs');var Redis=require(_0x1918('0x5'));var db=require(_0x1918('0x6'))['db'];var utils=require(_0x1918('0x7'));var logger=require(_0x1918('0x8'))(_0x1918('0x9'));var config=require('../../config/environment');var jayson=require(_0x1918('0xa'));var client=jayson[_0x1918('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x430a08,_0x1ba80a,_0x264175){return new BPromise(function(_0xaa2b6e,_0x7143e4){return client[_0x1918('0xc')](_0x430a08,_0x264175)['then'](function(_0x55e36b){logger[_0x1918('0xd')](_0x1918('0xe'),_0x1ba80a,_0x1918('0xf'));logger[_0x1918('0x10')](_0x1918('0x11'),_0x1ba80a,_0x1918('0xf'),JSON[_0x1918('0x12')](_0x55e36b));if(_0x55e36b[_0x1918('0x13')]){if(_0x55e36b[_0x1918('0x13')]['code']===0x1f4){logger[_0x1918('0x13')](_0x1918('0xe'),_0x1ba80a,_0x55e36b[_0x1918('0x13')][_0x1918('0x14')]);return _0x7143e4(_0x55e36b[_0x1918('0x13')]['message']);}logger[_0x1918('0x13')](_0x1918('0xe'),_0x1ba80a,_0x55e36b[_0x1918('0x13')][_0x1918('0x14')]);return _0xaa2b6e(_0x55e36b['error']['message']);}else{logger[_0x1918('0xd')](_0x1918('0xe'),_0x1ba80a,'request\x20sent');_0xaa2b6e(_0x55e36b['result'][_0x1918('0x14')]);}})['catch'](function(_0x217224){logger[_0x1918('0x13')](_0x1918('0xe'),_0x1ba80a,_0x217224);_0x7143e4(_0x217224);});});}exports['CreateChatQueueReport']=function(_0x153a2a){var _0x24fc2d=this;return new Promise(function(_0x58ffcf,_0x5fe402){return db[_0x1918('0x15')][_0x1918('0x16')](_0x153a2a[_0x1918('0x17')],{'raw':_0x153a2a[_0x1918('0x18')]?_0x153a2a[_0x1918('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x1918('0x19')](function(_0x4bcd56){logger['info'](_0x1918('0x1a'),_0x153a2a);logger[_0x1918('0x10')](_0x1918('0x1a'),_0x153a2a,JSON[_0x1918('0x12')](_0x4bcd56));_0x58ffcf(_0x4bcd56);})[_0x1918('0x1b')](function(_0x55eebd){logger[_0x1918('0x13')](_0x1918('0x1a'),_0x55eebd[_0x1918('0x14')],_0x153a2a);_0x5fe402(_0x24fc2d['error'](0x1f4,_0x55eebd[_0x1918('0x14')]));});});};exports[_0x1918('0x1c')]=function(_0x682e75){var _0x819951=this;return new Promise(function(_0x1073b6,_0x21349a){return db[_0x1918('0x15')][_0x1918('0x1d')](_0x682e75[_0x1918('0x17')],{'raw':_0x682e75['options']?_0x682e75[_0x1918('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x682e75[_0x1918('0x18')]?_0x682e75['options'][_0x1918('0x1e')]||null:null,'attributes':_0x682e75[_0x1918('0x18')]?_0x682e75[_0x1918('0x18')][_0x1918('0x1f')]||null:null,'limit':_0x682e75['options']?_0x682e75[_0x1918('0x18')][_0x1918('0x20')]||null:null})['then'](function(_0x3cbe49){logger[_0x1918('0xd')](_0x1918('0x1c'),_0x682e75);logger[_0x1918('0x10')](_0x1918('0x1c'),_0x682e75,JSON['stringify'](_0x3cbe49));_0x1073b6(_0x3cbe49);})[_0x1918('0x1b')](function(_0x2b1ddc){logger[_0x1918('0x13')](_0x1918('0x1c'),_0x2b1ddc[_0x1918('0x14')],_0x682e75);_0x21349a(_0x819951['error'](0x1f4,_0x2b1ddc[_0x1918('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index cbfb42c..ab860fd 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 _0x7c2d=['post','create','put','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x47ac7d,_0x451190){var _0x44e910=function(_0xa2dbf5){while(--_0xa2dbf5){_0x47ac7d['push'](_0x47ac7d['shift']());}};_0x44e910(++_0x451190);}(_0x7c2d,0x8c));var _0xd7c2=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x7c2d[_0x1cb18a];return _0x22442e;};'use strict';var multer=require('multer');var util=require(_0xd7c2('0x0'));var path=require(_0xd7c2('0x1'));var timeout=require(_0xd7c2('0x2'));var express=require(_0xd7c2('0x3'));var router=express[_0xd7c2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7c2('0x5'));var config=require(_0xd7c2('0x6'));var controller=require(_0xd7c2('0x7'));router['get']('/',auth[_0xd7c2('0x8')](),controller[_0xd7c2('0x9')]);router[_0xd7c2('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xd7c2('0xb')]);router[_0xd7c2('0xa')](_0xd7c2('0xc'),auth[_0xd7c2('0x8')](),controller['show']);router[_0xd7c2('0xd')]('/',auth[_0xd7c2('0x8')](),controller[_0xd7c2('0xe')]);router[_0xd7c2('0xf')]('/:id',auth[_0xd7c2('0x8')](),controller['update']);router['delete'](_0xd7c2('0xc'),auth[_0xd7c2('0x8')](),controller['destroy']);module[_0xd7c2('0x10')]=router; \ No newline at end of file +var _0x8127=['isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x8127,0x122));var _0x7812=function(_0x13618c,_0x253332){_0x13618c=_0x13618c-0x0;var _0x208caf=_0x8127[_0x13618c];return _0x208caf;};'use strict';var multer=require(_0x7812('0x0'));var util=require(_0x7812('0x1'));var path=require(_0x7812('0x2'));var timeout=require(_0x7812('0x3'));var express=require(_0x7812('0x4'));var router=express[_0x7812('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7812('0x6'));var config=require(_0x7812('0x7'));var controller=require(_0x7812('0x8'));router['get']('/',auth[_0x7812('0x9')](),controller[_0x7812('0xa')]);router['get'](_0x7812('0xb'),auth[_0x7812('0x9')](),controller[_0x7812('0xc')]);router[_0x7812('0xd')](_0x7812('0xe'),auth[_0x7812('0x9')](),controller[_0x7812('0xf')]);router[_0x7812('0x10')]('/',auth[_0x7812('0x9')](),controller[_0x7812('0x11')]);router[_0x7812('0x12')](_0x7812('0xe'),auth[_0x7812('0x9')](),controller[_0x7812('0x13')]);router[_0x7812('0x14')]('/:id',auth[_0x7812('0x9')](),controller[_0x7812('0x15')]);module[_0x7812('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c4ebeec..e042b8b 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 _0x430d=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0x430d,0x1e8));var _0xd430=function(_0x526898,_0xeb26b8){_0x526898=_0x526898-0x0;var _0x2a1ef3=_0x430d[_0x526898];return _0x2a1ef3;};'use strict';var moment=require(_0xd430('0x0'));var Sequelize=require(_0xd430('0x1'));module[_0xd430('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd430('0x3')]('account',_0xd430('0x4'),_0xd430('0x5')),'allowNull':![],'defaultValue':_0xd430('0x5')},'transferredAt':{'type':Sequelize[_0xd430('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xd430('0x7')]}}; \ No newline at end of file +var _0x16e8=['NOW','moment','sequelize','exports','STRING','account','agent','queue','DATE'];(function(_0xbb6084,_0x1612c1){var _0x2db4f0=function(_0x59048){while(--_0x59048){_0xbb6084['push'](_0xbb6084['shift']());}};_0x2db4f0(++_0x1612c1);}(_0x16e8,0x145));var _0x816e=function(_0x31c06d,_0x475651){_0x31c06d=_0x31c06d-0x0;var _0x20b27b=_0x16e8[_0x31c06d];return _0x20b27b;};'use strict';var moment=require(_0x816e('0x0'));var Sequelize=require(_0x816e('0x1'));module[_0x816e('0x2')]={'uniqueid':{'type':Sequelize[_0x816e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x816e('0x4'),_0x816e('0x5'),_0x816e('0x6')),'allowNull':![],'defaultValue':_0x816e('0x6')},'transferredAt':{'type':Sequelize[_0x816e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x816e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index acbce1d..bce24ab 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 _0x9a67=['pick','where','merge','VIRTUAL','filter','count','then','findAll','catch','show','params','length','includeAll','find','create','body','update','describe','html-pdf','eml-format','rimraf','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/environment','sendStatus','end','status','json','offset','limit','Content-Range','apply','save','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x9a67,0xed));var _0x79a6=function(_0x21aefe,_0x27eccb){_0x21aefe=_0x21aefe-0x0;var _0x45a8f1=_0x9a67[_0x21aefe];return _0x45a8f1;};'use strict';var pdf=require(_0x79a6('0x0'));var emlformat=require(_0x79a6('0x1'));var rimraf=require(_0x79a6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x79a6('0x3'));var BPromise=require(_0x79a6('0x4'));var Mustache=require(_0x79a6('0x5'));var util=require(_0x79a6('0x6'));var path=require(_0x79a6('0x7'));var sox=require(_0x79a6('0x8'));var csv=require('to-csv');var ejs=require(_0x79a6('0x9'));var fs=require('fs');var _=require(_0x79a6('0xa'));var squel=require(_0x79a6('0xb'));var crypto=require(_0x79a6('0xc'));var jsforce=require(_0x79a6('0xd'));var deskjs=require(_0x79a6('0xe'));var toCsv=require(_0x79a6('0xf'));var querystring=require(_0x79a6('0x10'));var Papa=require(_0x79a6('0x11'));var Redis=require(_0x79a6('0x12'));var authService=require(_0x79a6('0x13'));var qs=require(_0x79a6('0x14'));var as=require(_0x79a6('0x15'));var hardwareService=require(_0x79a6('0x16'));var logger=require(_0x79a6('0x17'))(_0x79a6('0x18'));var utils=require('../../config/utils');var config=require(_0x79a6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c033d,_0x5bde19){_0x5bde19=_0x5bde19||0xcc;return function(_0x1bea51){if(_0x1bea51){return _0x5c033d[_0x79a6('0x1a')](_0x5bde19);}return _0x5c033d['status'](_0x5bde19)[_0x79a6('0x1b')]();};}function respondWithResult(_0x2aae09,_0x39b38b){_0x39b38b=_0x39b38b||0xc8;return function(_0x500124){if(_0x500124){return _0x2aae09[_0x79a6('0x1c')](_0x39b38b)[_0x79a6('0x1d')](_0x500124);}};}function respondWithFilteredResult(_0x58be9f,_0x24f8f9){return function(_0xa7e730){if(_0xa7e730){var _0x3aa5d6=_0xa7e730['count'],_0x3a5cf0=_0x24f8f9[_0x79a6('0x1e')],_0x258b8f=_0x24f8f9[_0x79a6('0x1e')]+_0x24f8f9[_0x79a6('0x1f')],_0x25a282;if(_0x258b8f>=_0x3aa5d6){_0x258b8f=_0x3aa5d6;_0x25a282=0xc8;}else{_0x25a282=0xce;}_0x58be9f[_0x79a6('0x1c')](_0x25a282);return _0x58be9f['set'](_0x79a6('0x20'),_0x3a5cf0+'-'+_0x258b8f+'/'+_0x3aa5d6)[_0x79a6('0x1d')](_0xa7e730);}return null;};}function patchUpdates(_0x4df970){return function(_0xe7eed9){try{jsonpatch[_0x79a6('0x21')](_0xe7eed9,_0x4df970,!![]);}catch(_0x4751fb){return BPromise['reject'](_0x4751fb);}return _0xe7eed9[_0x79a6('0x22')]();};}function saveUpdates(_0x5144b5,_0x476700){return function(_0x4ebdf2){if(_0x4ebdf2){return _0x4ebdf2['update'](_0x5144b5)['then'](function(_0x17d7ce){return _0x17d7ce;});}return null;};}function removeEntity(_0x232d37,_0x2c514b){return function(_0x396789){if(_0x396789){return _0x396789[_0x79a6('0x23')]()['then'](function(){_0x232d37[_0x79a6('0x1c')](0xcc)[_0x79a6('0x1b')]();});}};}function handleEntityNotFound(_0x2018c2,_0x57ed29){return function(_0x4f2d61){if(!_0x4f2d61){_0x2018c2['sendStatus'](0x194);}return _0x4f2d61;};}function handleError(_0x1392bc,_0x19ae2b){_0x19ae2b=_0x19ae2b||0x1f4;return function(_0x4f7c26){logger[_0x79a6('0x24')](_0x4f7c26['stack']);if(_0x4f7c26['name']){delete _0x4f7c26[_0x79a6('0x25')];}_0x1392bc[_0x79a6('0x1c')](_0x19ae2b)[_0x79a6('0x26')](_0x4f7c26);};}exports[_0x79a6('0x27')]=function(_0x5142cb,_0x24a935){var _0x5ebe4e={},_0x2c70f8={},_0x1d3ada={'count':0x0,'rows':[]};var _0x582496=_[_0x79a6('0x28')](db[_0x79a6('0x29')][_0x79a6('0x2a')],function(_0x1da1c6){return{'name':_0x1da1c6['fieldName'],'type':_0x1da1c6[_0x79a6('0x2b')]['key']};});_0x2c70f8[_0x79a6('0x2c')]=_[_0x79a6('0x28')](_0x582496,_0x79a6('0x25'));_0x2c70f8[_0x79a6('0x2d')]=_[_0x79a6('0x2e')](_0x5142cb[_0x79a6('0x2d')]);_0x2c70f8[_0x79a6('0x2f')]=_[_0x79a6('0x30')](_0x2c70f8[_0x79a6('0x2c')],_0x2c70f8[_0x79a6('0x2d')]);_0x5ebe4e[_0x79a6('0x31')]=_['intersection'](_0x2c70f8[_0x79a6('0x2c')],qs[_0x79a6('0x32')](_0x5142cb[_0x79a6('0x2d')][_0x79a6('0x32')]));_0x5ebe4e[_0x79a6('0x31')]=_0x5ebe4e[_0x79a6('0x31')]['length']?_0x5ebe4e['attributes']:_0x2c70f8['model'];if(!_0x5142cb[_0x79a6('0x2d')][_0x79a6('0x33')](_0x79a6('0x34'))){_0x5ebe4e[_0x79a6('0x1f')]=qs['limit'](_0x5142cb[_0x79a6('0x2d')]['limit']);_0x5ebe4e[_0x79a6('0x1e')]=qs[_0x79a6('0x1e')](_0x5142cb[_0x79a6('0x2d')]['offset']);}_0x5ebe4e[_0x79a6('0x35')]=qs['sort'](_0x5142cb['query'][_0x79a6('0x36')]);_0x5ebe4e['where']=qs[_0x79a6('0x2f')](_[_0x79a6('0x37')](_0x5142cb['query'],_0x2c70f8[_0x79a6('0x2f')]),_0x582496);if(_0x5142cb['query']['filter']){_0x5ebe4e[_0x79a6('0x38')]=_[_0x79a6('0x39')](_0x5ebe4e[_0x79a6('0x38')],{'$or':_[_0x79a6('0x28')](_0x582496,function(_0x3f154d){if(_0x3f154d[_0x79a6('0x2b')]!==_0x79a6('0x3a')){var _0x278494={};_0x278494[_0x3f154d['name']]={'$like':'%'+_0x5142cb[_0x79a6('0x2d')][_0x79a6('0x3b')]+'%'};return _0x278494;}})});}_0x5ebe4e=_[_0x79a6('0x39')]({},_0x5ebe4e,_0x5142cb['options']);var _0x392455={'where':_0x5ebe4e[_0x79a6('0x38')]};return db['ChatTransferReport'][_0x79a6('0x3c')](_0x392455)[_0x79a6('0x3d')](function(_0x20451f){_0x1d3ada['count']=_0x20451f;if(_0x5142cb['query']['includeAll']){_0x5ebe4e['include']=[{'all':!![]}];}return db[_0x79a6('0x29')][_0x79a6('0x3e')](_0x5ebe4e);})[_0x79a6('0x3d')](function(_0x2816e6){_0x1d3ada['rows']=_0x2816e6;return _0x1d3ada;})[_0x79a6('0x3d')](respondWithFilteredResult(_0x24a935,_0x5ebe4e))[_0x79a6('0x3f')](handleError(_0x24a935,null));};exports[_0x79a6('0x40')]=function(_0x6c0986,_0x573ec3){var _0x8aa28c={'raw':!![],'where':{'id':_0x6c0986[_0x79a6('0x41')]['id']}},_0x4f8f1e={};_0x4f8f1e[_0x79a6('0x2c')]=_[_0x79a6('0x2e')](db[_0x79a6('0x29')][_0x79a6('0x2a')]);_0x4f8f1e['query']=_[_0x79a6('0x2e')](_0x6c0986[_0x79a6('0x2d')]);_0x4f8f1e[_0x79a6('0x2f')]=_['intersection'](_0x4f8f1e[_0x79a6('0x2c')],_0x4f8f1e[_0x79a6('0x2d')]);_0x8aa28c[_0x79a6('0x31')]=_[_0x79a6('0x30')](_0x4f8f1e['model'],qs[_0x79a6('0x32')](_0x6c0986['query'][_0x79a6('0x32')]));_0x8aa28c[_0x79a6('0x31')]=_0x8aa28c[_0x79a6('0x31')][_0x79a6('0x42')]?_0x8aa28c[_0x79a6('0x31')]:_0x4f8f1e['model'];if(_0x6c0986[_0x79a6('0x2d')][_0x79a6('0x43')]){_0x8aa28c['include']=[{'all':!![]}];}_0x8aa28c=_['merge']({},_0x8aa28c,_0x6c0986['options']);return db[_0x79a6('0x29')][_0x79a6('0x44')](_0x8aa28c)['then'](handleEntityNotFound(_0x573ec3,null))[_0x79a6('0x3d')](respondWithResult(_0x573ec3,null))[_0x79a6('0x3f')](handleError(_0x573ec3,null));};exports[_0x79a6('0x45')]=function(_0xcc1ffb,_0x23b8f1){return db[_0x79a6('0x29')][_0x79a6('0x45')](_0xcc1ffb[_0x79a6('0x46')],{})[_0x79a6('0x3d')](respondWithResult(_0x23b8f1,0xc9))['catch'](handleError(_0x23b8f1,null));};exports[_0x79a6('0x47')]=function(_0x5b194b,_0x55fbcc){if(_0x5b194b[_0x79a6('0x46')]['id']){delete _0x5b194b[_0x79a6('0x46')]['id'];}return db[_0x79a6('0x29')][_0x79a6('0x44')]({'where':{'id':_0x5b194b[_0x79a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x55fbcc,null))['then'](saveUpdates(_0x5b194b[_0x79a6('0x46')],null))['then'](respondWithResult(_0x55fbcc,null))[_0x79a6('0x3f')](handleError(_0x55fbcc,null));};exports['destroy']=function(_0x3d03de,_0x39c717){return db[_0x79a6('0x29')][_0x79a6('0x44')]({'where':{'id':_0x3d03de['params']['id']}})[_0x79a6('0x3d')](handleEntityNotFound(_0x39c717,null))[_0x79a6('0x3d')](removeEntity(_0x39c717,null))[_0x79a6('0x3f')](handleError(_0x39c717,null));};exports['describe']=function(_0x115cad,_0x13e23c){return db[_0x79a6('0x29')][_0x79a6('0x48')]()[_0x79a6('0x3d')](respondWithResult(_0x13e23c,null))['catch'](handleError(_0x13e23c,null));}; \ No newline at end of file +var _0x256e=['attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','VIRTUAL','filter','merge','count','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ChatTransferReport','fieldName','type','key','query','keys','intersection'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x256e,0xb5));var _0xe256=function(_0x422d5e,_0x28d38d){_0x422d5e=_0x422d5e-0x0;var _0x14295a=_0x256e[_0x422d5e];return _0x14295a;};'use strict';var pdf=require(_0xe256('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe256('0x1'));var zipdir=require(_0xe256('0x2'));var jsonpatch=require(_0xe256('0x3'));var rp=require(_0xe256('0x4'));var moment=require(_0xe256('0x5'));var BPromise=require(_0xe256('0x6'));var Mustache=require(_0xe256('0x7'));var util=require(_0xe256('0x8'));var path=require(_0xe256('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe256('0xa'));var fs=require('fs');var _=require(_0xe256('0xb'));var squel=require(_0xe256('0xc'));var crypto=require(_0xe256('0xd'));var jsforce=require(_0xe256('0xe'));var deskjs=require(_0xe256('0xf'));var toCsv=require(_0xe256('0x10'));var querystring=require(_0xe256('0x11'));var Papa=require(_0xe256('0x12'));var Redis=require('ioredis');var authService=require(_0xe256('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe256('0x14'));var logger=require(_0xe256('0x15'))('api');var utils=require(_0xe256('0x16'));var config=require(_0xe256('0x17'));var db=require(_0xe256('0x18'))['db'];function respondWithStatusCode(_0x3961cf,_0x45544b){_0x45544b=_0x45544b||0xcc;return function(_0x58e749){if(_0x58e749){return _0x3961cf[_0xe256('0x19')](_0x45544b);}return _0x3961cf[_0xe256('0x1a')](_0x45544b)[_0xe256('0x1b')]();};}function respondWithResult(_0x4a9072,_0x805cf3){_0x805cf3=_0x805cf3||0xc8;return function(_0x9914be){if(_0x9914be){return _0x4a9072['status'](_0x805cf3)[_0xe256('0x1c')](_0x9914be);}};}function respondWithFilteredResult(_0x4c534a,_0x2762d7){return function(_0x21f3a8){if(_0x21f3a8){var _0x182959=_0x21f3a8['count'],_0x325b71=_0x2762d7['offset'],_0x43ca16=_0x2762d7[_0xe256('0x1d')]+_0x2762d7['limit'],_0x13056a;if(_0x43ca16>=_0x182959){_0x43ca16=_0x182959;_0x13056a=0xc8;}else{_0x13056a=0xce;}_0x4c534a[_0xe256('0x1a')](_0x13056a);return _0x4c534a[_0xe256('0x1e')](_0xe256('0x1f'),_0x325b71+'-'+_0x43ca16+'/'+_0x182959)['json'](_0x21f3a8);}return null;};}function patchUpdates(_0x1e3dfa){return function(_0x255666){try{jsonpatch[_0xe256('0x20')](_0x255666,_0x1e3dfa,!![]);}catch(_0x1da865){return BPromise[_0xe256('0x21')](_0x1da865);}return _0x255666[_0xe256('0x22')]();};}function saveUpdates(_0x4bee92,_0x62ed87){return function(_0x59a43a){if(_0x59a43a){return _0x59a43a[_0xe256('0x23')](_0x4bee92)[_0xe256('0x24')](function(_0x20deab){return _0x20deab;});}return null;};}function removeEntity(_0x3aebe1,_0x3e0c30){return function(_0x4ceea6){if(_0x4ceea6){return _0x4ceea6[_0xe256('0x25')]()['then'](function(){_0x3aebe1[_0xe256('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb596,_0x5bcead){return function(_0x5dca69){if(!_0x5dca69){_0x3fb596[_0xe256('0x19')](0x194);}return _0x5dca69;};}function handleError(_0x47a8c6,_0x293669){_0x293669=_0x293669||0x1f4;return function(_0x158c6e){logger[_0xe256('0x26')](_0x158c6e['stack']);if(_0x158c6e['name']){delete _0x158c6e[_0xe256('0x27')];}_0x47a8c6[_0xe256('0x1a')](_0x293669)[_0xe256('0x28')](_0x158c6e);};}exports[_0xe256('0x29')]=function(_0x4d1742,_0x24b170){var _0xb36038={},_0x20503f={},_0x32d71f={'count':0x0,'rows':[]};var _0x8b1e32=_[_0xe256('0x2a')](db[_0xe256('0x2b')]['rawAttributes'],function(_0xd7a95a){return{'name':_0xd7a95a[_0xe256('0x2c')],'type':_0xd7a95a[_0xe256('0x2d')][_0xe256('0x2e')]};});_0x20503f['model']=_[_0xe256('0x2a')](_0x8b1e32,_0xe256('0x27'));_0x20503f[_0xe256('0x2f')]=_[_0xe256('0x30')](_0x4d1742['query']);_0x20503f['filters']=_[_0xe256('0x31')](_0x20503f['model'],_0x20503f['query']);_0xb36038[_0xe256('0x32')]=_[_0xe256('0x31')](_0x20503f[_0xe256('0x33')],qs['fields'](_0x4d1742[_0xe256('0x2f')][_0xe256('0x34')]));_0xb36038[_0xe256('0x32')]=_0xb36038[_0xe256('0x32')][_0xe256('0x35')]?_0xb36038[_0xe256('0x32')]:_0x20503f[_0xe256('0x33')];if(!_0x4d1742[_0xe256('0x2f')][_0xe256('0x36')](_0xe256('0x37'))){_0xb36038[_0xe256('0x38')]=qs[_0xe256('0x38')](_0x4d1742['query'][_0xe256('0x38')]);_0xb36038[_0xe256('0x1d')]=qs[_0xe256('0x1d')](_0x4d1742[_0xe256('0x2f')][_0xe256('0x1d')]);}_0xb36038[_0xe256('0x39')]=qs[_0xe256('0x3a')](_0x4d1742[_0xe256('0x2f')][_0xe256('0x3a')]);_0xb36038['where']=qs['filters'](_[_0xe256('0x3b')](_0x4d1742[_0xe256('0x2f')],_0x20503f[_0xe256('0x3c')]),_0x8b1e32);if(_0x4d1742['query']['filter']){_0xb36038[_0xe256('0x3d')]=_['merge'](_0xb36038[_0xe256('0x3d')],{'$or':_[_0xe256('0x2a')](_0x8b1e32,function(_0x5deb43){if(_0x5deb43[_0xe256('0x2d')]!==_0xe256('0x3e')){var _0x8e3b09={};_0x8e3b09[_0x5deb43[_0xe256('0x27')]]={'$like':'%'+_0x4d1742[_0xe256('0x2f')][_0xe256('0x3f')]+'%'};return _0x8e3b09;}})});}_0xb36038=_[_0xe256('0x40')]({},_0xb36038,_0x4d1742['options']);var _0x1f2678={'where':_0xb36038[_0xe256('0x3d')]};return db['ChatTransferReport'][_0xe256('0x41')](_0x1f2678)[_0xe256('0x24')](function(_0x46ff87){_0x32d71f['count']=_0x46ff87;if(_0x4d1742[_0xe256('0x2f')][_0xe256('0x42')]){_0xb36038[_0xe256('0x43')]=[{'all':!![]}];}return db[_0xe256('0x2b')]['findAll'](_0xb36038);})['then'](function(_0xf16c07){_0x32d71f[_0xe256('0x44')]=_0xf16c07;return _0x32d71f;})[_0xe256('0x24')](respondWithFilteredResult(_0x24b170,_0xb36038))[_0xe256('0x45')](handleError(_0x24b170,null));};exports[_0xe256('0x46')]=function(_0x50f07d,_0xea7928){var _0x5c1eb0={'raw':!![],'where':{'id':_0x50f07d[_0xe256('0x47')]['id']}},_0x3d4b0f={};_0x3d4b0f[_0xe256('0x33')]=_[_0xe256('0x30')](db['ChatTransferReport'][_0xe256('0x48')]);_0x3d4b0f[_0xe256('0x2f')]=_[_0xe256('0x30')](_0x50f07d['query']);_0x3d4b0f['filters']=_[_0xe256('0x31')](_0x3d4b0f['model'],_0x3d4b0f[_0xe256('0x2f')]);_0x5c1eb0[_0xe256('0x32')]=_['intersection'](_0x3d4b0f[_0xe256('0x33')],qs['fields'](_0x50f07d[_0xe256('0x2f')]['fields']));_0x5c1eb0['attributes']=_0x5c1eb0[_0xe256('0x32')]['length']?_0x5c1eb0['attributes']:_0x3d4b0f[_0xe256('0x33')];if(_0x50f07d[_0xe256('0x2f')][_0xe256('0x42')]){_0x5c1eb0[_0xe256('0x43')]=[{'all':!![]}];}_0x5c1eb0=_[_0xe256('0x40')]({},_0x5c1eb0,_0x50f07d[_0xe256('0x49')]);return db['ChatTransferReport'][_0xe256('0x4a')](_0x5c1eb0)[_0xe256('0x24')](handleEntityNotFound(_0xea7928,null))['then'](respondWithResult(_0xea7928,null))[_0xe256('0x45')](handleError(_0xea7928,null));};exports[_0xe256('0x4b')]=function(_0x4f0634,_0x4d5835){return db[_0xe256('0x2b')][_0xe256('0x4b')](_0x4f0634[_0xe256('0x4c')],{})[_0xe256('0x24')](respondWithResult(_0x4d5835,0xc9))[_0xe256('0x45')](handleError(_0x4d5835,null));};exports['update']=function(_0x2acfd8,_0xcc63e0){if(_0x2acfd8[_0xe256('0x4c')]['id']){delete _0x2acfd8['body']['id'];}return db[_0xe256('0x2b')][_0xe256('0x4a')]({'where':{'id':_0x2acfd8[_0xe256('0x47')]['id']}})[_0xe256('0x24')](handleEntityNotFound(_0xcc63e0,null))[_0xe256('0x24')](saveUpdates(_0x2acfd8[_0xe256('0x4c')],null))['then'](respondWithResult(_0xcc63e0,null))[_0xe256('0x45')](handleError(_0xcc63e0,null));};exports[_0xe256('0x25')]=function(_0x3c457b,_0x59f372){return db['ChatTransferReport'][_0xe256('0x4a')]({'where':{'id':_0x3c457b['params']['id']}})[_0xe256('0x24')](handleEntityNotFound(_0x59f372,null))[_0xe256('0x24')](removeEntity(_0x59f372,null))[_0xe256('0x45')](handleError(_0x59f372,null));};exports['describe']=function(_0x2ba504,_0x4415f0){return db[_0xe256('0x2b')]['describe']()[_0xe256('0x24')](respondWithResult(_0x4415f0,null))[_0xe256('0x45')](handleError(_0x4415f0,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 1eb6ae1..9d307b5 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 _0x8ef6=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x23cf2e,_0x17fae0){var _0x18566c=function(_0x1dcf18){while(--_0x1dcf18){_0x23cf2e['push'](_0x23cf2e['shift']());}};_0x18566c(++_0x17fae0);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3138fa,_0x2a2080){_0x3138fa=_0x3138fa-0x0;var _0x46737d=_0x8ef6[_0x3138fa];return _0x46737d;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x68ef('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x6aa7,0x178));var _0x76aa=function(_0x42c6fe,_0x518505){_0x42c6fe=_0x42c6fe-0x0;var _0x4fe912=_0x6aa7[_0x42c6fe];return _0x4fe912;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x76aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9051999..0b5faf2 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 _0x0c68=['http','then','request\x20sent','debug','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x23db35,_0xfa66d5){var _0xfc84ed=function(_0x565ac8){while(--_0x565ac8){_0x23db35['push'](_0x23db35['shift']());}};_0xfc84ed(++_0xfa66d5);}(_0x0c68,0x165));var _0x80c6=function(_0x446a74,_0x3810bf){_0x446a74=_0x446a74-0x0;var _0x178422=_0x0c68[_0x446a74];return _0x178422;};'use strict';var _=require(_0x80c6('0x0'));var util=require('util');var moment=require(_0x80c6('0x1'));var BPromise=require(_0x80c6('0x2'));var rs=require(_0x80c6('0x3'));var fs=require('fs');var Redis=require(_0x80c6('0x4'));var db=require(_0x80c6('0x5'))['db'];var utils=require(_0x80c6('0x6'));var logger=require(_0x80c6('0x7'))(_0x80c6('0x8'));var config=require('../../config/environment');var jayson=require(_0x80c6('0x9'));var client=jayson[_0x80c6('0xa')][_0x80c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45718c,_0x300be4,_0x1060b4){return new BPromise(function(_0x2f8a3c,_0x57c138){return client['request'](_0x45718c,_0x1060b4)[_0x80c6('0xc')](function(_0x3829b6){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x300be4,_0x80c6('0xd'));logger[_0x80c6('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x300be4,_0x80c6('0xd'),JSON[_0x80c6('0xf')](_0x3829b6));if(_0x3829b6[_0x80c6('0x10')]){if(_0x3829b6[_0x80c6('0x10')][_0x80c6('0x11')]===0x1f4){logger[_0x80c6('0x10')](_0x80c6('0x12'),_0x300be4,_0x3829b6['error'][_0x80c6('0x13')]);return _0x57c138(_0x3829b6[_0x80c6('0x10')][_0x80c6('0x13')]);}logger[_0x80c6('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x300be4,_0x3829b6[_0x80c6('0x10')][_0x80c6('0x13')]);return _0x2f8a3c(_0x3829b6['error'][_0x80c6('0x13')]);}else{logger[_0x80c6('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x300be4,_0x80c6('0xd'));_0x2f8a3c(_0x3829b6[_0x80c6('0x15')]['message']);}})[_0x80c6('0x16')](function(_0x13a4a9){logger[_0x80c6('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x300be4,_0x13a4a9);_0x57c138(_0x13a4a9);});});} \ No newline at end of file +var _0xdc76=['request\x20sent','stringify','error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x23a86c,_0x22f86d){var _0x28f3e1=function(_0x491994){while(--_0x491994){_0x23a86c['push'](_0x23a86c['shift']());}};_0x28f3e1(++_0x22f86d);}(_0xdc76,0xc3));var _0x6dc7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdc76[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x6dc7('0x0'));var moment=require(_0x6dc7('0x1'));var BPromise=require(_0x6dc7('0x2'));var rs=require(_0x6dc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dc7('0x4'))['db'];var utils=require(_0x6dc7('0x5'));var logger=require(_0x6dc7('0x6'))(_0x6dc7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13bde3,_0x2ea575,_0x4b1e9d){return new BPromise(function(_0x5d343c,_0x57828a){return client[_0x6dc7('0x8')](_0x13bde3,_0x4b1e9d)[_0x6dc7('0x9')](function(_0x2fea2c){logger[_0x6dc7('0xa')](_0x6dc7('0xb'),_0x2ea575,'request\x20sent');logger[_0x6dc7('0xc')](_0x6dc7('0xd'),_0x2ea575,_0x6dc7('0xe'),JSON[_0x6dc7('0xf')](_0x2fea2c));if(_0x2fea2c['error']){if(_0x2fea2c[_0x6dc7('0x10')]['code']===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2ea575,_0x2fea2c[_0x6dc7('0x10')][_0x6dc7('0x11')]);return _0x57828a(_0x2fea2c[_0x6dc7('0x10')][_0x6dc7('0x11')]);}logger[_0x6dc7('0x10')](_0x6dc7('0xb'),_0x2ea575,_0x2fea2c[_0x6dc7('0x10')][_0x6dc7('0x11')]);return _0x5d343c(_0x2fea2c[_0x6dc7('0x10')]['message']);}else{logger['info'](_0x6dc7('0xb'),_0x2ea575,_0x6dc7('0xe'));_0x5d343c(_0x2fea2c['result'][_0x6dc7('0x11')]);}})[_0x6dc7('0x12')](function(_0x1bd08a){logger[_0x6dc7('0x10')](_0x6dc7('0xb'),_0x2ea575,_0x1bd08a);_0x57828a(_0x1bd08a);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c369224..95b5764 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 _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x54deb9,_0x53e74b){var _0x5da9aa=function(_0x45dca8){while(--_0x45dca8){_0x54deb9['push'](_0x54deb9['shift']());}};_0x5da9aa(++_0x53e74b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file +var _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x757a,0xde));var _0xa757=function(_0x2fdd5c,_0x1ac150){_0x2fdd5c=_0x2fdd5c-0x0;var _0x5cc931=_0x757a[_0x2fdd5c];return _0x5cc931;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 50a7d97..cb54a51 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 _0x4508=['randomstring','exports','STRING','address','email','#011F6A','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','INTEGER','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x4508,0x1ef));var _0x8450=function(_0x193467,_0x4ed357){_0x193467=_0x193467-0x0;var _0x4e8f8d=_0x4508[_0x193467];return _0x4e8f8d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8450('0x0'));module[_0x8450('0x1')]={'name':{'type':Sequelize[_0x8450('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8450('0x3')},'description':{'type':Sequelize[_0x8450('0x2')]},'mapKey':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x4')},'mapKeyOffline':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x4')},'key':{'type':Sequelize[_0x8450('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8450('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8450('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8450('0x2')]},'animation':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8450('0x7')](_0x8450('0x8'),_0x8450('0x9')),'defaultValue':_0x8450('0x8')},'header_online':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0xb')},'offline_chat_button':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0xd')},'download_transcript':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8450('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x13')},'closingMessageButton':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0xc')},'skipMessageButton':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x14')},'conditionAgreement':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x15')},'ratingType':{'type':Sequelize[_0x8450('0x7')](_0x8450('0x16'),'thumb'),'defaultValue':_0x8450('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x8450('0x17')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8450('0xf')],'defaultValue':function(){return JSON[_0x8450('0x18')]({'items':[{'type':_0x8450('0x19'),'variable':null,'config':{'placeholder':_0x8450('0x1a'),'type':_0x8450('0x1b'),'required':!![]},'props':{'title':_0x8450('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0x8450('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8450('0x4'),'type':_0x8450('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x8450('0x1c'))?JSON[_0x8450('0x1d')](this[_0x8450('0x1e')]('onlineForm')):{};},'set':function(_0x4fe54b){return this[_0x8450('0x1f')](_0x8450('0x1c'),JSON[_0x8450('0x18')](_0x4fe54b));}},'offlineForm':{'type':Sequelize[_0x8450('0xf')],'defaultValue':function(){return JSON[_0x8450('0x18')]({'items':[{'type':'input','props':{'title':_0x8450('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x8450('0x20'),'config':{'placeholder':_0x8450('0x21')},'props':{'title':_0x8450('0x21'),'helpText':_0x8450('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x8450('0x23'))?JSON[_0x8450('0x1d')](this[_0x8450('0x1e')](_0x8450('0x23'))):{};},'set':function(_0xb01175){return this[_0x8450('0x1f')](_0x8450('0x23'),JSON[_0x8450('0x18')](_0xb01175));}},'token':{'type':Sequelize[_0x8450('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8450('0x2')]},'forwardOffline':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8450('0x2')]},'waitingTitle':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x24')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x25')},'offlineMessageBody':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x14')},'sendUnmanaged':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8450('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8450('0xf')],'defaultValue':function(){return _0x8450('0x27');}},'notificationSound':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x8450('0x17')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x29')},'defaultTitle':{'type':Sequelize[_0x8450('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8450('0x17')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8450('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8450('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8450('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x2a')},'systemAvatar':{'type':Sequelize[_0x8450('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8450('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![],'comment':_0x8450('0x2c'),'set':function(_0x3419ad){if(!_0x3419ad)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x8450('0x1f')]('mandatoryDisposition',_0x3419ad);}},'vidaooEscalation':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8450('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7f27=['setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','randomstring','STRING','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7f27,0x12e));var _0x77f2=function(_0x2af263,_0x2cdeee){_0x2af263=_0x2af263-0x0;var _0x1774cb=_0x7f27[_0x2af263];return _0x1774cb;};'use strict';var Sequelize=require(_0x77f2('0x0'));var rs=require(_0x77f2('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x3')},'mapKeyOffline':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x4')},'customerAlias':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x77f2('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![],'defaultValue':_0x77f2('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x77f2('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x77f2('0x2')]},'animation':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x77f2('0x8')](_0x77f2('0x9'),_0x77f2('0xa')),'defaultValue':_0x77f2('0x9')},'header_online':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0xd')},'download_transcript':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x77f2('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x77f2('0xf')]},'closingQuestion':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x12')},'noteTitle':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x14')},'closingMessage':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x15')},'closingMessageButton':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x16')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x17')},'conditionAgreement':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x18')},'ratingType':{'type':Sequelize[_0x77f2('0x8')](_0x77f2('0x19'),_0x77f2('0x1a')),'defaultValue':_0x77f2('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x77f2('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x77f2('0xf')],'defaultValue':function(){return JSON[_0x77f2('0x1b')]({'items':[{'type':_0x77f2('0x1c'),'variable':null,'config':{'placeholder':'name','type':_0x77f2('0x1d'),'required':!![]},'props':{'title':_0x77f2('0x1e'),'helpText':''}},{'type':_0x77f2('0x1c'),'props':{'title':_0x77f2('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x77f2('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x77f2('0x1f')](_0x77f2('0x20'))?JSON[_0x77f2('0x21')](this[_0x77f2('0x1f')](_0x77f2('0x20'))):{};},'set':function(_0x37fba4){return this[_0x77f2('0x22')](_0x77f2('0x20'),JSON['stringify'](_0x37fba4));}},'offlineForm':{'type':Sequelize[_0x77f2('0xf')],'defaultValue':function(){return JSON[_0x77f2('0x1b')]({'items':[{'type':_0x77f2('0x1c'),'props':{'title':_0x77f2('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x77f2('0x3')},'variable':null},{'type':_0x77f2('0x23'),'config':{'placeholder':_0x77f2('0x24')},'props':{'title':_0x77f2('0x24'),'helpText':_0x77f2('0x25')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON['parse'](this[_0x77f2('0x1f')]('offlineForm')):{};},'set':function(_0x325af6){return this[_0x77f2('0x22')](_0x77f2('0x26'),JSON[_0x77f2('0x1b')](_0x325af6));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x77f2('0x2')]},'forwardOffline':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x77f2('0x2')]},'waitingTitle':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x27')},'waitingMessage':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x28')},'offlineMessageBody':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x77f2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x77f2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x2b')},'verticalAlignment':{'type':Sequelize[_0x77f2('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x77f2('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![],'defaultValue':_0x77f2('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x77f2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x77f2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x2d')},'systemAvatar':{'type':Sequelize[_0x77f2('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x77f2('0x6')],'comment':_0x77f2('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x518b00){if(!_0x518b00)this[_0x77f2('0x22')](_0x77f2('0x2f'),null);this[_0x77f2('0x22')]('mandatoryDisposition',_0x518b00);}},'vidaooEscalation':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3516bdb..f645b21 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 _0x0ca4=['removeAgents','userChatWebsite:remove','getAgents','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./chatWebsite.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','findAll','rows','catch','show','params','mandatoryDispositionPause','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','describe','addDisposition','Disposition','getDispositions','order','ChatWebsiteId','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','customerAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','notify','user-agent-parser','setUA','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','ChatApplication','Applications','applications','list','orderBy','priority','asc','account','ListId','contact','customerIp','headers','cf-connecting-ip','first','x-forwarded-for','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','ChatInteraction','threadId','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','include','Contact','User','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','License','chatLicenseExceeded','all','utf8','connection','remoteAddress','alignment','verticalAlignment','textColor','addApplications','sequelize','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit'];(function(_0x394739,_0x19ce1e){var _0x48d11e=function(_0x570c40){while(--_0x570c40){_0x394739['push'](_0x394739['shift']());}};_0x48d11e(++_0x19ce1e);}(_0x0ca4,0x11b));var _0x40ca=function(_0x4084d8,_0x5ca4eb){_0x4084d8=_0x4084d8-0x0;var _0x1535da=_0x0ca4[_0x4084d8];return _0x1535da;};'use strict';var pdf=require(_0x40ca('0x0'));var emlformat=require(_0x40ca('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x40ca('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40ca('0x3'));var Mustache=require(_0x40ca('0x4'));var util=require(_0x40ca('0x5'));var path=require(_0x40ca('0x6'));var sox=require(_0x40ca('0x7'));var csv=require('to-csv');var ejs=require(_0x40ca('0x8'));var fs=require('fs');var _=require(_0x40ca('0x9'));var squel=require(_0x40ca('0xa'));var crypto=require('crypto');var jsforce=require(_0x40ca('0xb'));var deskjs=require(_0x40ca('0xc'));var toCsv=require(_0x40ca('0xd'));var querystring=require(_0x40ca('0xe'));var Papa=require(_0x40ca('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x40ca('0x10'));var as=require(_0x40ca('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x40ca('0x12'));var utils=require(_0x40ca('0x13'));var config=require(_0x40ca('0x14'));var db=require(_0x40ca('0x15'))['db'];config['redis']=_[_0x40ca('0x16')](config[_0x40ca('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40ca('0x17')]));require(_0x40ca('0x18'))[_0x40ca('0x19')](socket);var jayson=require(_0x40ca('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x40ca('0x1b')]['http']({'port':0x232a});var client9003=jayson['client'][_0x40ca('0x1c')]({'port':0x232b});function checkPasswordPattern(_0xd03941,_0x11f507,_0x4d1bbf){if(_0x4d1bbf){var _0x4d4cf6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d4cf6[_0x40ca('0x1d')](_0x11f507)){return _0xd03941;}else{throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xd03941;}}function respondWithRpcPromise(_0x3ba2b6,_0x3afba8,_0x2a5ba4,_0x5698e6){return new BPromise(function(_0x5131bd,_0x156d14){var _0x4ae37e=_0x5698e6||client;return _0x4ae37e[_0x40ca('0x20')](_0x3ba2b6,_0x2a5ba4)[_0x40ca('0x21')](function(_0x50dcf1){logger[_0x40ca('0x22')](_0x40ca('0x23'),_0x3afba8,'request\x20sent');logger[_0x40ca('0x24')](_0x40ca('0x25'),_0x3afba8,_0x40ca('0x26'),JSON[_0x40ca('0x27')](_0x50dcf1));if(_0x50dcf1[_0x40ca('0x28')]){if(_0x50dcf1[_0x40ca('0x28')]['code']===0x1f4){logger[_0x40ca('0x28')](_0x40ca('0x23'),_0x3afba8,_0x50dcf1[_0x40ca('0x28')][_0x40ca('0x29')]);return _0x156d14(_0x50dcf1[_0x40ca('0x28')][_0x40ca('0x29')]);}logger[_0x40ca('0x28')](_0x40ca('0x23'),_0x3afba8,_0x50dcf1[_0x40ca('0x28')][_0x40ca('0x29')]);return _0x5131bd(_0x50dcf1[_0x40ca('0x28')][_0x40ca('0x29')]);}else{logger[_0x40ca('0x22')](_0x40ca('0x23'),_0x3afba8,_0x40ca('0x26'));_0x5131bd(_0x50dcf1['result'][_0x40ca('0x29')]);}})['catch'](function(_0x4f3b1e){logger[_0x40ca('0x28')](_0x40ca('0x23'),_0x3afba8,_0x4f3b1e);_0x156d14(_0x4f3b1e);});});}function respondWithStatusCode(_0x234f60,_0x16d401){_0x16d401=_0x16d401||0xcc;return function(_0x4dc5e0){if(_0x4dc5e0){return _0x234f60[_0x40ca('0x2a')](_0x16d401);}return _0x234f60[_0x40ca('0x2b')](_0x16d401)[_0x40ca('0x2c')]();};}function respondWithResult(_0x4be511,_0x13ba13){_0x13ba13=_0x13ba13||0xc8;return function(_0x3476f2){if(_0x3476f2){return _0x4be511[_0x40ca('0x2b')](_0x13ba13)[_0x40ca('0x2d')](_0x3476f2);}};}function respondWithFilteredResult(_0x2672cb,_0x5a5168){return function(_0xf5c329){if(_0xf5c329){var _0x13de2e=_0xf5c329[_0x40ca('0x2e')],_0x2d326b=_0x5a5168[_0x40ca('0x2f')],_0x4cf670=_0x5a5168['offset']+_0x5a5168[_0x40ca('0x30')],_0x5addc4;if(_0x4cf670>=_0x13de2e){_0x4cf670=_0x13de2e;_0x5addc4=0xc8;}else{_0x5addc4=0xce;}_0x2672cb['status'](_0x5addc4);return _0x2672cb[_0x40ca('0x31')](_0x40ca('0x32'),_0x2d326b+'-'+_0x4cf670+'/'+_0x13de2e)['json'](_0xf5c329);}return null;};}function patchUpdates(_0x16ff38){return function(_0x285a8f){try{jsonpatch[_0x40ca('0x33')](_0x285a8f,_0x16ff38,!![]);}catch(_0x1023f6){return BPromise[_0x40ca('0x34')](_0x1023f6);}return _0x285a8f[_0x40ca('0x35')]();};}function saveUpdates(_0x12d2aa,_0xb58674){return function(_0x1754aa){if(_0x1754aa){return _0x1754aa[_0x40ca('0x36')](_0x12d2aa)[_0x40ca('0x21')](function(_0x105750){return _0x105750;});}return null;};}function removeEntity(_0x4a1f7f,_0x1a2ac4){return function(_0x23b867){if(_0x23b867){return _0x23b867['destroy']()[_0x40ca('0x21')](function(){var _0x3bac4e=_0x23b867['get']({'plain':!![]});var _0x380181=_0x40ca('0x37');return db[_0x40ca('0x38')][_0x40ca('0x39')]({'where':{'type':_0x380181,'resourceId':_0x3bac4e['id']}})[_0x40ca('0x21')](function(){return _0x23b867;});})[_0x40ca('0x21')](function(){_0x4a1f7f['status'](0xcc)[_0x40ca('0x2c')]();});}};}function handleEntityNotFound(_0xfe1a40,_0x4569a3){return function(_0x4af607){if(!_0x4af607){_0xfe1a40[_0x40ca('0x2a')](0x194);}return _0x4af607;};}function handleError(_0x37b102,_0x2a0c07){_0x2a0c07=_0x2a0c07||0x1f4;return function(_0x5dcd3d){logger[_0x40ca('0x28')](_0x5dcd3d[_0x40ca('0x3a')]);if(_0x5dcd3d[_0x40ca('0x3b')]){delete _0x5dcd3d[_0x40ca('0x3b')];}_0x37b102[_0x40ca('0x2b')](_0x2a0c07)[_0x40ca('0x3c')](_0x5dcd3d);};}exports[_0x40ca('0x3d')]=function(_0x586305,_0x4b5136){var _0x3ef452={'include':[{'model':db[_0x40ca('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1bad01={},_0x8a50fd={'count':0x0,'rows':[]};var _0x23a1ab=_[_0x40ca('0x3f')](db[_0x40ca('0x40')][_0x40ca('0x41')],function(_0x46f864){return{'name':_0x46f864[_0x40ca('0x42')],'type':_0x46f864[_0x40ca('0x43')]['key']};});_0x1bad01['model']=_[_0x40ca('0x3f')](_0x23a1ab,_0x40ca('0x3b'));_0x1bad01['query']=_[_0x40ca('0x44')](_0x586305[_0x40ca('0x45')]);_0x1bad01[_0x40ca('0x46')]=_[_0x40ca('0x47')](_0x1bad01['model'],_0x1bad01[_0x40ca('0x45')]);_0x3ef452[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x1bad01[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0x586305['query']['fields']));_0x3ef452[_0x40ca('0x48')]=_0x3ef452[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x3ef452[_0x40ca('0x48')]:_0x1bad01[_0x40ca('0x49')];if(!_0x586305['query'][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x3ef452[_0x40ca('0x30')]=qs['limit'](_0x586305[_0x40ca('0x45')][_0x40ca('0x30')]);_0x3ef452[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x586305['query'][_0x40ca('0x2f')]);}_0x3ef452['order']=qs[_0x40ca('0x4e')](_0x586305[_0x40ca('0x45')][_0x40ca('0x4e')]);_0x3ef452[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0x586305[_0x40ca('0x45')],_0x1bad01[_0x40ca('0x46')]),_0x23a1ab);if(_0x586305[_0x40ca('0x45')]['filter']){_0x3ef452[_0x40ca('0x4f')]=_[_0x40ca('0x51')](_0x3ef452['where'],{'$or':_[_0x40ca('0x3f')](_0x23a1ab,function(_0x1dd9c0){if(_0x1dd9c0[_0x40ca('0x43')]!=='VIRTUAL'){var _0xc78031={};_0xc78031[_0x1dd9c0['name']]={'$like':'%'+_0x586305[_0x40ca('0x45')][_0x40ca('0x52')]+'%'};return _0xc78031;}})});}_0x3ef452=_[_0x40ca('0x51')]({},_0x3ef452,_0x586305[_0x40ca('0x53')]);var _0xbe46ae={'where':_0x3ef452[_0x40ca('0x4f')]};return db[_0x40ca('0x40')][_0x40ca('0x2e')](_0xbe46ae)['then'](function(_0x4f4aeb){_0x8a50fd['count']=_0x4f4aeb;if(_0x586305['query']['includeAll']){_0x3ef452['include']=[{'all':!![]}];}return db[_0x40ca('0x40')][_0x40ca('0x54')](_0x3ef452);})[_0x40ca('0x21')](function(_0x4e07ef){_0x8a50fd[_0x40ca('0x55')]=_0x4e07ef;return _0x8a50fd;})[_0x40ca('0x21')](respondWithFilteredResult(_0x4b5136,_0x3ef452))[_0x40ca('0x56')](handleError(_0x4b5136,null));};exports[_0x40ca('0x57')]=function(_0x1fb451,_0x15efb2){var _0x3da76d={'raw':![],'where':{'id':_0x1fb451[_0x40ca('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x40ca('0x59')}]},_0x15a77f={};_0x15a77f['model']=_[_0x40ca('0x44')](db['ChatWebsite'][_0x40ca('0x41')]);_0x15a77f[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0x1fb451[_0x40ca('0x45')]);_0x15a77f[_0x40ca('0x46')]=_['intersection'](_0x15a77f['model'],_0x15a77f['query']);_0x3da76d[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x15a77f['model'],qs[_0x40ca('0x4a')](_0x1fb451['query'][_0x40ca('0x4a')]));_0x3da76d[_0x40ca('0x48')]=_0x3da76d[_0x40ca('0x48')]['length']?_0x3da76d[_0x40ca('0x48')]:_0x15a77f[_0x40ca('0x49')];if(_0x1fb451[_0x40ca('0x45')][_0x40ca('0x5a')]){_0x3da76d['include']=[{'all':!![]}];}_0x3da76d=_[_0x40ca('0x51')]({},_0x3da76d,_0x1fb451[_0x40ca('0x53')]);return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0x3da76d)[_0x40ca('0x21')](handleEntityNotFound(_0x15efb2,null))[_0x40ca('0x21')](respondWithResult(_0x15efb2,null))[_0x40ca('0x56')](handleError(_0x15efb2,null));};exports['create']=function(_0x2bcfde,_0x453efd){return db[_0x40ca('0x40')]['create'](_0x2bcfde[_0x40ca('0x5c')],{})['then'](function(_0x196e5a){var _0x2ec317=_0x2bcfde[_0x40ca('0x5d')][_0x40ca('0x5e')]({'plain':!![]});if(!_0x2ec317)throw new Error(_0x40ca('0x5f'));if(_0x2ec317[_0x40ca('0x60')]===_0x40ca('0x5d')){var _0x5342a6=_0x196e5a['get']({'plain':!![]});var _0x514c97='ChatWebsites';return db[_0x40ca('0x61')][_0x40ca('0x5b')]({'where':{'name':_0x514c97,'userProfileId':_0x2ec317['userProfileId']},'raw':!![]})[_0x40ca('0x21')](function(_0x319ae5){if(_0x319ae5&&_0x319ae5[_0x40ca('0x62')]===0x0){return db[_0x40ca('0x38')][_0x40ca('0x63')]({'name':_0x5342a6[_0x40ca('0x3b')],'resourceId':_0x5342a6['id'],'type':_0x319ae5[_0x40ca('0x3b')],'sectionId':_0x319ae5['id']},{})[_0x40ca('0x21')](function(){return _0x196e5a;});}else{return _0x196e5a;}})['catch'](function(_0x389af2){logger[_0x40ca('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x389af2);throw _0x389af2;});}return _0x196e5a;})[_0x40ca('0x21')](respondWithResult(_0x453efd,0xc9))['catch'](handleError(_0x453efd,null));};exports[_0x40ca('0x36')]=function(_0x4b422b,_0x21f825){if(_0x4b422b['body']['id']){delete _0x4b422b['body']['id'];}return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x4b422b[_0x40ca('0x58')]['id']},'include':[{'model':db[_0x40ca('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x40ca('0x21')](handleEntityNotFound(_0x21f825,null))[_0x40ca('0x21')](saveUpdates(_0x4b422b[_0x40ca('0x5c')],null))[_0x40ca('0x21')](respondWithResult(_0x21f825,null))[_0x40ca('0x56')](handleError(_0x21f825,null));};exports[_0x40ca('0x39')]=function(_0x4afc77,_0x36d156){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x4afc77['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x36d156,null))['then'](removeEntity(_0x36d156,null))[_0x40ca('0x56')](handleError(_0x36d156,null));};exports[_0x40ca('0x64')]=function(_0x54de4b,_0x3905db){return db[_0x40ca('0x40')][_0x40ca('0x64')]()['then'](respondWithResult(_0x3905db,null))[_0x40ca('0x56')](handleError(_0x3905db,null));};exports[_0x40ca('0x65')]=function(_0x5f402c,_0x3684bf,_0x56d54e){if(_0x5f402c[_0x40ca('0x5c')]['id']){delete _0x5f402c[_0x40ca('0x5c')]['id'];}return db[_0x40ca('0x40')]['find']({'where':{'id':_0x5f402c[_0x40ca('0x58')]['id']}})['then'](handleEntityNotFound(_0x3684bf,null))['then'](function(_0x12d019){if(_0x12d019){_0x5f402c[_0x40ca('0x5c')]['ChatWebsiteId']=_0x12d019['id'];return db[_0x40ca('0x66')][_0x40ca('0x63')](_0x5f402c[_0x40ca('0x5c')]);}})['then'](respondWithResult(_0x3684bf,null))[_0x40ca('0x56')](handleError(_0x3684bf,null));};exports[_0x40ca('0x67')]=function(_0xd55183,_0x1995b0,_0x6e1014){var _0x58496d={'raw':![],'where':{}};var _0x1ceeea={};var _0x5d1f68={'count':0x0,'rows':[]};return db[_0x40ca('0x40')]['findOne']({'where':{'id':_0xd55183[_0x40ca('0x58')]['id']}})['then'](handleEntityNotFound(_0x1995b0,null))[_0x40ca('0x21')](function(_0x58c080){if(_0x58c080){_0x1ceeea[_0x40ca('0x49')]=_[_0x40ca('0x44')](db[_0x40ca('0x66')]['rawAttributes']);_0x1ceeea[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0xd55183[_0x40ca('0x45')]);_0x1ceeea['filters']=_[_0x40ca('0x47')](_0x1ceeea['model'],_0x1ceeea['query']);_0x58496d[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x1ceeea[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0xd55183[_0x40ca('0x45')][_0x40ca('0x4a')]));_0x58496d[_0x40ca('0x48')]=_0x58496d[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x58496d[_0x40ca('0x48')]:_0x1ceeea[_0x40ca('0x49')];if(!_0xd55183['query'][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x58496d[_0x40ca('0x30')]=qs['limit'](_0xd55183[_0x40ca('0x45')]['limit']);_0x58496d[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0xd55183[_0x40ca('0x45')][_0x40ca('0x2f')]);}_0x58496d[_0x40ca('0x68')]=qs[_0x40ca('0x4e')](_0xd55183['query'][_0x40ca('0x4e')]);_0x58496d[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0xd55183[_0x40ca('0x45')],_0x1ceeea[_0x40ca('0x46')]));_0x58496d[_0x40ca('0x4f')][_0x40ca('0x69')]=_0x58c080['id'];if(_0xd55183[_0x40ca('0x45')]['filter']){_0x58496d[_0x40ca('0x4f')]=_['merge'](_0x58496d[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x58496d[_0x40ca('0x48')],function(_0x1d0c00){var _0x443116={};_0x443116[_0x1d0c00]={'$like':'%'+_0xd55183[_0x40ca('0x45')][_0x40ca('0x52')]+'%'};return _0x443116;})});}_0x58496d=_['merge']({},_0x58496d,_0xd55183['options']);return db[_0x40ca('0x66')][_0x40ca('0x2e')]({'where':_0x58496d['where']})['then'](function(_0x2073be){_0x5d1f68['count']=_0x2073be;if(_0xd55183[_0x40ca('0x45')][_0x40ca('0x5a')]){_0x58496d['include']=[{'all':!![]}];}return db[_0x40ca('0x66')]['findAll'](_0x58496d);})['then'](function(_0x5f2828){_0x5d1f68[_0x40ca('0x55')]=_0x5f2828;return _0x5d1f68;});}})['then'](respondWithFilteredResult(_0x1995b0,_0x58496d))[_0x40ca('0x56')](handleError(_0x1995b0,null));};exports['removeDispositions']=function(_0x21c1a0,_0x482a5d,_0x58e9a4){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x21c1a0['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x482a5d,null))[_0x40ca('0x21')](function(_0x4f2d95){if(_0x4f2d95){return _0x4f2d95['removeDispositions'](_0x21c1a0['query'][_0x40ca('0x6a')]);}})[_0x40ca('0x21')](respondWithStatusCode(_0x482a5d,null))[_0x40ca('0x56')](handleError(_0x482a5d,null));};exports[_0x40ca('0x6b')]=function(_0x44fefe,_0xf1c76d,_0x5fd37){if(_0x44fefe['body']['id']){delete _0x44fefe['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x44fefe[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0xf1c76d,null))[_0x40ca('0x21')](function(_0x51bf46){if(_0x51bf46){_0x44fefe[_0x40ca('0x5c')][_0x40ca('0x69')]=_0x51bf46['id'];return db[_0x40ca('0x6c')][_0x40ca('0x63')](_0x44fefe['body']);}})[_0x40ca('0x21')](respondWithResult(_0xf1c76d,null))['catch'](handleError(_0xf1c76d,null));};exports[_0x40ca('0x6d')]=function(_0x2da6a3,_0x314485,_0xb9567c){var _0x5a8682={'raw':![],'where':{}};var _0x1dd635={};var _0xc3d73e={'count':0x0,'rows':[]};return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x2da6a3['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x314485,null))['then'](function(_0x4ff957){if(_0x4ff957){_0x1dd635['model']=_['keys'](db[_0x40ca('0x6c')]['rawAttributes']);_0x1dd635[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0x2da6a3['query']);_0x1dd635[_0x40ca('0x46')]=_['intersection'](_0x1dd635['model'],_0x1dd635[_0x40ca('0x45')]);_0x5a8682[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x1dd635[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0x2da6a3[_0x40ca('0x45')][_0x40ca('0x4a')]));_0x5a8682['attributes']=_0x5a8682['attributes'][_0x40ca('0x4b')]?_0x5a8682[_0x40ca('0x48')]:_0x1dd635[_0x40ca('0x49')];if(!_0x2da6a3[_0x40ca('0x45')][_0x40ca('0x4c')]('nolimit')){_0x5a8682['limit']=qs[_0x40ca('0x30')](_0x2da6a3[_0x40ca('0x45')][_0x40ca('0x30')]);_0x5a8682['offset']=qs[_0x40ca('0x2f')](_0x2da6a3[_0x40ca('0x45')]['offset']);}_0x5a8682[_0x40ca('0x68')]=qs[_0x40ca('0x4e')](_0x2da6a3['query'][_0x40ca('0x4e')]);_0x5a8682[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0x2da6a3[_0x40ca('0x45')],_0x1dd635[_0x40ca('0x46')]));_0x5a8682['where'][_0x40ca('0x69')]=_0x4ff957['id'];if(_0x2da6a3[_0x40ca('0x45')]['filter']){_0x5a8682[_0x40ca('0x4f')]=_[_0x40ca('0x51')](_0x5a8682[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x5a8682['attributes'],function(_0x1eda7e){var _0x377b60={};_0x377b60[_0x1eda7e]={'$like':'%'+_0x2da6a3[_0x40ca('0x45')]['filter']+'%'};return _0x377b60;})});}_0x5a8682=_[_0x40ca('0x51')]({},_0x5a8682,_0x2da6a3[_0x40ca('0x53')]);return db[_0x40ca('0x6c')][_0x40ca('0x2e')]({'where':_0x5a8682[_0x40ca('0x4f')]})['then'](function(_0x57fc8e){_0xc3d73e['count']=_0x57fc8e;if(_0x2da6a3[_0x40ca('0x45')][_0x40ca('0x5a')]){_0x5a8682['include']=[{'all':!![]}];}return db[_0x40ca('0x6c')][_0x40ca('0x54')](_0x5a8682);})[_0x40ca('0x21')](function(_0x4fbaf0){_0xc3d73e[_0x40ca('0x55')]=_0x4fbaf0;return _0xc3d73e;});}})[_0x40ca('0x21')](respondWithFilteredResult(_0x314485,_0x5a8682))[_0x40ca('0x56')](handleError(_0x314485,null));};exports[_0x40ca('0x6f')]=function(_0x50f50f,_0x4c5e3c,_0x5608cf){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x50f50f[_0x40ca('0x58')]['id']}})['then'](handleEntityNotFound(_0x4c5e3c,null))['then'](function(_0x2e7c04){if(_0x2e7c04){return _0x2e7c04['removeAnswers'](_0x50f50f['query'][_0x40ca('0x6a')]);}})[_0x40ca('0x21')](respondWithStatusCode(_0x4c5e3c,null))[_0x40ca('0x56')](handleError(_0x4c5e3c,null));};exports[_0x40ca('0x70')]=function(_0x11eb33,_0x3feaea,_0x3c257b){_0x11eb33[_0x40ca('0x5c')][_0x40ca('0x71')]=_0x11eb33[_0x40ca('0x72')][_0x40ca('0x73')];return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x11eb33[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x3feaea,null))['then'](saveUpdates(_0x11eb33['body'],null))[_0x40ca('0x21')](respondWithResult(_0x3feaea,null))[_0x40ca('0x56')](handleError(_0x3feaea,null));};exports['addAvatar']=function(_0x218675,_0x28c4fa,_0x555546){_0x218675[_0x40ca('0x5c')][_0x40ca('0x74')]=_0x218675[_0x40ca('0x72')][_0x40ca('0x73')];return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x218675[_0x40ca('0x58')]['id']}})['then'](handleEntityNotFound(_0x28c4fa,null))[_0x40ca('0x21')](saveUpdates(_0x218675['body'],null))[_0x40ca('0x21')](respondWithResult(_0x28c4fa,null))[_0x40ca('0x56')](handleError(_0x28c4fa,null));};exports['addCustomerAvatar']=function(_0xb9fe90,_0x68dae0,_0x3cf8c5){_0xb9fe90[_0x40ca('0x5c')][_0x40ca('0x75')]=_0xb9fe90[_0x40ca('0x72')][_0x40ca('0x73')];return db[_0x40ca('0x40')]['find']({'where':{'id':_0xb9fe90['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x68dae0,null))[_0x40ca('0x21')](saveUpdates(_0xb9fe90[_0x40ca('0x5c')],null))[_0x40ca('0x21')](respondWithResult(_0x68dae0,null))[_0x40ca('0x56')](handleError(_0x68dae0,null));};exports['addSystemAvatar']=function(_0x24671e,_0x46afe3,_0x1b80c7){_0x24671e['body'][_0x40ca('0x76')]=_0x24671e[_0x40ca('0x72')][_0x40ca('0x73')];return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x24671e['params']['id']}})['then'](handleEntityNotFound(_0x46afe3,null))[_0x40ca('0x21')](saveUpdates(_0x24671e['body'],null))[_0x40ca('0x21')](respondWithResult(_0x46afe3,null))['catch'](handleError(_0x46afe3,null));};exports['getLogo']=function(_0x52cb30,_0x297904,_0x4345e6){var _0x1edf95=path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x79'));var _0x1e4233={'where':{'id':_0x52cb30[_0x40ca('0x58')]['id']},'attributes':['id',_0x40ca('0x71')],'raw':!![]};var _0x16be03=![];return require(_0x40ca('0x7a'))[_0x40ca('0x7b')]()[_0x40ca('0x21')](function(_0x40a072){if(_0x40a072){_0x16be03=_0x40a072[_0x40ca('0x7c')];}})['then'](function(){return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0x1e4233);})[_0x40ca('0x21')](handleEntityNotFound(_0x297904,null))['then'](function(_0x405aaf){if(_0x405aaf){if(!_[_0x40ca('0x7d')](_0x405aaf[_0x40ca('0x71')])){if(fs['existsSync'](path[_0x40ca('0x77')](config['root'],'server/files/images/logos/',_0x405aaf[_0x40ca('0x71')]))&&_0x16be03){_0x1edf95=path[_0x40ca('0x77')](config['root'],_0x40ca('0x7e'),_0x405aaf[_0x40ca('0x71')]);}}return _0x297904[_0x40ca('0x7f')](_0x1edf95);}})[_0x40ca('0x56')](handleError(_0x297904,null));};exports[_0x40ca('0x80')]=function(_0x234a2a,_0x413af7,_0x1941d6){var _0x3b5b8a=path[_0x40ca('0x77')](config[_0x40ca('0x78')],'server/files/images/avatars/default_avatar.png');var _0x2afb84={'where':{'id':_0x234a2a[_0x40ca('0x58')]['id']},'attributes':['id',_0x40ca('0x74')],'raw':!![]};return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0x2afb84)['then'](handleEntityNotFound(_0x413af7,null))[_0x40ca('0x21')](function(_0x2c957f){if(_0x2c957f){if(!_['isNil'](_0x2c957f['agentAvatar'])){if(fs['existsSync'](path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x81'),_0x2c957f[_0x40ca('0x74')]))){_0x3b5b8a=path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x81'),_0x2c957f['agentAvatar']);}}return _0x413af7['download'](_0x3b5b8a);}})[_0x40ca('0x56')](handleError(_0x413af7,null));};exports[_0x40ca('0x82')]=function(_0x26ee96,_0x12e4ba,_0x59b0e6){var _0x1a4a94=path['join'](config['root'],_0x40ca('0x83'));var _0x4be97c={'where':{'id':_0x26ee96['params']['id']},'attributes':['id',_0x40ca('0x75'),_0x40ca('0x84')],'raw':!![]};return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0x4be97c)[_0x40ca('0x21')](handleEntityNotFound(_0x12e4ba,null))[_0x40ca('0x21')](function(_0x3e6e16){if(_0x3e6e16){if(!_[_0x40ca('0x7d')](_0x3e6e16[_0x40ca('0x75')])){if(fs[_0x40ca('0x85')](path[_0x40ca('0x77')](config[_0x40ca('0x78')],'server/files/images/avatars/',_0x3e6e16[_0x40ca('0x75')]))&&_0x3e6e16[_0x40ca('0x84')]){_0x1a4a94=path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x81'),_0x3e6e16[_0x40ca('0x75')]);}}return _0x12e4ba[_0x40ca('0x7f')](_0x1a4a94);}})[_0x40ca('0x56')](handleError(_0x12e4ba,null));};exports['getSystemAvatar']=function(_0x53a653,_0x26fb16,_0x8f43d4){var _0x27a30c=path['join'](config[_0x40ca('0x78')],'server/files/images/avatars/system_avatar.png');var _0xb5a8a9={'where':{'id':_0x53a653[_0x40ca('0x58')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0xb5a8a9)['then'](handleEntityNotFound(_0x26fb16,null))[_0x40ca('0x21')](function(_0x5b7434){if(_0x5b7434){if(!_['isNil'](_0x5b7434[_0x40ca('0x76')])){if(fs['existsSync'](path[_0x40ca('0x77')](config['root'],_0x40ca('0x81'),_0x5b7434[_0x40ca('0x76')]))){_0x27a30c=path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x81'),_0x5b7434[_0x40ca('0x76')]);}}return _0x26fb16['download'](_0x27a30c);}})['catch'](handleError(_0x26fb16,null));};exports[_0x40ca('0x86')]=function(_0x2f199d,_0x2c09e2,_0x4842a6){var _0xc0e400=require(_0x40ca('0x87'));var _0xd8f752=new _0xc0e400();var _0x568577=_0xd8f752[_0x40ca('0x88')](_0x2f199d['headers']['user-agent'])['getResult']();var _0x2b3289={'body':_0x2f199d['body'],'channel':_0x40ca('0x89')};var _0x23db5e=[];var _0x380943=[];var _0x146bad={};var _0x52482e=![];return db[_0x40ca('0x8a')]['describe']()[_0x40ca('0x21')](function(_0x17b5bd){if(!_0x17b5bd){throw new db['Sequelize'][(_0x40ca('0x1f'))](_0x40ca('0x8b'));}_0x23db5e=_[_0x40ca('0x8c')](_['keys'](_0x17b5bd),[_0x40ca('0x8d'),_0x40ca('0x8e')]);_0x380943=_['difference'](_[_0x40ca('0x44')](_0x17b5bd),['createdAt',_0x40ca('0x8e'),'CompanyId','ListId']);if(_0x2f199d['body']['id']){delete _0x2f199d['body']['id'];}if(_[_0x40ca('0x7d')](_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x8f')])){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x90'));}if(_[_0x40ca('0x7d')](_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x5c')])||_0x2f199d['body'][_0x40ca('0x5c')]===''){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x91'));}if(_[_0x40ca('0x7d')](_0x2f199d['body'][_0x40ca('0x92')])){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x93')+_0x380943);}if(!_[_0x40ca('0x94')](_0x380943,_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x92')])){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x380943);}_0x146bad[_0x2f199d['body'][_0x40ca('0x92')]]=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x8f')];})[_0x40ca('0x21')](function(){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x2f199d[_0x40ca('0x58')]['id']},'include':[{'model':db[_0x40ca('0x95')],'as':_0x40ca('0x96'),'include':[{'model':db[_0x40ca('0x8a')],'as':_0x40ca('0x97'),'where':_0x146bad,'limit':0x1,'order':[[_0x40ca('0x8e'),'DESC']]}]},{'model':db[_0x40ca('0x98')],'as':_0x40ca('0x99')}]});})[_0x40ca('0x21')](handleEntityNotFound(_0x2c09e2,null))[_0x40ca('0x21')](function(_0x5400b4){if(_0x5400b4&&_0x5400b4[_0x40ca('0x96')]){_0x2b3289['account']=_0x5400b4;_0x2b3289[_0x40ca('0x9a')]=_0x5400b4[_0x40ca('0x99')];_0x2b3289[_0x40ca('0x9b')]=_0x5400b4[_0x40ca('0x96')];_0x2b3289[_0x40ca('0x9a')]=_[_0x40ca('0x9c')](_0x2b3289[_0x40ca('0x9a')],[_0x40ca('0x9d')],[_0x40ca('0x9e')]);if(_0x2b3289[_0x40ca('0x9f')]['Applications']){delete _0x2b3289[_0x40ca('0x9f')][_0x40ca('0x99')];}if(_0x2b3289[_0x40ca('0x9f')]['List']&&_0x2b3289[_0x40ca('0x9f')][_0x40ca('0x96')][_0x40ca('0x97')]['length']){return _0x2b3289['account'][_0x40ca('0x96')][_0x40ca('0x97')][0x0];}var _0x5e29b3=_[_0x40ca('0x16')](_0x2f199d[_0x40ca('0x5c')],{'firstName':_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x8f')],'ListId':_0x5400b4[_0x40ca('0xa0')]});_0x5e29b3[_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x92')]]=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x8f')];return db[_0x40ca('0x8a')][_0x40ca('0x63')](_0x5e29b3,{'fields':_0x23db5e,'raw':!![]});}})[_0x40ca('0x21')](handleEntityNotFound(_0x2c09e2,null))[_0x40ca('0x21')](function(_0x6ac821){_0x2b3289[_0x40ca('0xa1')]=_0x6ac821;var _0x12242c=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xa2')];if(_0x2f199d[_0x40ca('0xa3')][_0x40ca('0xa4')]){_0x12242c=_0x2f199d[_0x40ca('0xa3')][_0x40ca('0xa4')];}else if(_0x2f199d[_0x40ca('0xa3')]['x-forwarded-for']){_0x12242c=_[_0x40ca('0xa5')](_0x2f199d['headers'][_0x40ca('0xa6')]['split'](','));}if(_0x6ac821){var _0x2b9c9c={'ContactId':_0x6ac821['id'],'ChatWebsiteId':_0x2f199d['params']['id'],'from':(_0x6ac821['firstName']||'')+'\x20'+(_0x6ac821[_0x40ca('0xa7')]||''),'customerIp':_0x12242c,'customerPort':_0x2f199d[_0x40ca('0xa3')][_0x40ca('0xa8')]?_0x2f199d[_0x40ca('0xa3')][_0x40ca('0xa8')]:null,'referer':_0x2f199d['body'][_0x40ca('0xa9')],'browserName':_0x568577[_0x40ca('0xaa')][_0x40ca('0x3b')]&&_0x568577['browser']['version']?util[_0x40ca('0xab')](_0x40ca('0xac'),_0x568577['browser'][_0x40ca('0x3b')],_0x568577[_0x40ca('0xaa')][_0x40ca('0xad')]):_0x40ca('0xae'),'browserVersion':_0x568577['browser'][_0x40ca('0xad')]||_0x40ca('0xae'),'osName':util[_0x40ca('0xab')](_0x40ca('0xac'),_0x568577['os'][_0x40ca('0x3b')],_0x568577['os'][_0x40ca('0xad')]),'osVersion':_0x568577['os']['version'],'deviceModel':_0x568577['device'][_0x40ca('0x49')]&&_0x568577[_0x40ca('0xaf')]['vendor']?util[_0x40ca('0xab')]('%s\x20%s\x20%s',_0x568577['device'][_0x40ca('0x49')],_0x568577[_0x40ca('0xaf')]['vendor'],_0x568577['device'][_0x40ca('0x43')]):null,'deviceVendor':_0x568577['device'][_0x40ca('0xb0')],'deviceType':_0x568577['device'][_0x40ca('0x43')],'formData':JSON[_0x40ca('0x27')](_0x2f199d[_0x40ca('0x5c')])};var _0x2271de={'ChatWebsiteId':_0x2f199d['params']['id'],'closed':![]};if(_0x2f199d['body']['threadId']){_0x2271de['threadId']=_0x2f199d[_0x40ca('0x5c')]['threadId'];return db[_0x40ca('0xb1')][_0x40ca('0x5b')]({'where':_0x2271de})[_0x40ca('0x21')](function(_0x19e8e7){if(_0x19e8e7){return[_0x19e8e7,![]];}_0x2b9c9c[_0x40ca('0xb2')]=_0x2f199d[_0x40ca('0x5c')]['threadId'];_0x2b9c9c[_0x40ca('0xb3')]=_0x2f199d['body']['externalUrl'];return db[_0x40ca('0xb1')][_0x40ca('0x63')](_0x2b9c9c)[_0x40ca('0x21')](function(_0x5193b7){return[_0x5193b7,!![]];});});}_0x2271de[_0x40ca('0xb4')]=_0x6ac821['id'];if(_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xb5')]&&_0x2f199d[_0x40ca('0x5c')]['interaction']['id']){_0x2271de['id']=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xb5')]['id'];return db[_0x40ca('0xb1')]['find']({'where':_0x2271de})[_0x40ca('0x21')](function(_0x4ff042){if(_0x4ff042){return[_0x4ff042,![]];}return db[_0x40ca('0xb1')][_0x40ca('0x63')](_0x2b9c9c)[_0x40ca('0x21')](function(_0x1a526d){return[_0x1a526d,!![]];});});}return db[_0x40ca('0xb1')][_0x40ca('0x63')](_0x2b9c9c)[_0x40ca('0x21')](function(_0x3911e0){return[_0x3911e0,!![]];});}})['spread'](function(_0x4405c5,_0x5181ce){if(_0x4405c5){_0x52482e=_0x5181ce;if(!_0x5181ce){var _0x1f8a08={'from':(_0x2b3289[_0x40ca('0xa1')]['firstName']||'')+'\x20'+(_0x2b3289[_0x40ca('0xa1')][_0x40ca('0xa7')]||'')};if(_0x2f199d['body'][_0x40ca('0xb2')]&&_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xb6')]&&_0x2f199d['body'][_0x40ca('0xb2')]!=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xb6')]){_0x1f8a08[_0x40ca('0xb2')]=_0x2f199d['body']['messageId'];}return _0x4405c5[_0x40ca('0x36')](_0x1f8a08);}else{return _0x4405c5;}}})[_0x40ca('0x21')](function(_0x5072d0){_0x2b3289['interaction']=_0x5072d0['get']({'plain':!![]});_0x2b3289['interaction'][_0x40ca('0xb7')]=_0x52482e;if(_0x2b3289[_0x40ca('0xb5')][_0x40ca('0xb7')]){if(_0x2b3289['account'][_0x40ca('0xb8')]){_0x2b3289[_0x40ca('0x9a')][_0x40ca('0xb9')]({'id':0x0,'priority':_0x2b3289[_0x40ca('0x9a')]['length']+0x1,'app':_0x40ca('0xba'),'appdata':_0x40ca('0xbb'),'interval':_0x40ca('0xbc')});}}return db[_0x40ca('0xbd')][_0x40ca('0x63')]({'body':_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x5c')],'ChatWebsiteId':_0x2f199d[_0x40ca('0x58')]['id'],'ChatInteractionId':_0x5072d0['id'],'direction':'in','ContactId':_0x2b3289['contact']['id'],'AttachmentId':_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xbe')]});})['then'](function(_0x33b6bd){_0x2b3289[_0x40ca('0x29')]=_0x33b6bd;if(_0x2b3289['interaction'][_0x40ca('0xbf')]){return db['User'][_0x40ca('0x5b')]({'attributes':['id',_0x40ca('0x3b')],'where':{'id':_0x2b3289[_0x40ca('0xb5')][_0x40ca('0xbf')]}})['then'](function(_0x1de895){if(_0x1de895){_0x2b3289['applications'][_0x40ca('0xc0')]({'id':0x0,'priority':0x0,'app':_0x40ca('0xc1'),'appdata':_0x1de895[_0x40ca('0x3b')]+','+(_0x2b3289['account'][_0x40ca('0xc2')]||0xa),'interval':_0x40ca('0xbc')});_0x2b3289['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x40ca('0xc3'),_0x2b3289);});}return respondWithRpcPromise(_0x40ca('0xc4'),_0x40ca('0xc3'),_0x2b3289);})[_0x40ca('0x21')](function(_0x40942e){respondWithRpcPromise(_0x40ca('0xc5'),_0x40ca('0xc5'),{'event':_0x40ca('0x86'),'message':_0x40942e},client9002);return _0x40942e;})[_0x40ca('0x21')](respondWithResult(_0x2c09e2,null))[_0x40ca('0x56')](handleError(_0x2c09e2,null));};exports[_0x40ca('0xc6')]=function(_0x151e01,_0x142fb9,_0x584eb7){var _0x56f3e6,_0x440e8f,_0xd16b;var _0x34653c=[];var _0x402f11=[];var _0xf0c0ba={};return db['CmContact'][_0x40ca('0x64')]()['then'](function(_0x5e9517){if(!_0x5e9517){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x8b'));}_0x402f11=_['difference'](_[_0x40ca('0x44')](_0x5e9517),[_0x40ca('0x8d'),_0x40ca('0x8e')]);_0x34653c=_['difference'](_['keys'](_0x5e9517),[_0x40ca('0x8d'),_0x40ca('0x8e'),_0x40ca('0xc7'),_0x40ca('0xa0')]);if(_0x151e01[_0x40ca('0x5c')]['id']){delete _0x151e01['body']['id'];}if(_[_0x40ca('0x7d')](_0x151e01[_0x40ca('0x5c')]['from'])){throw _0x142fb9[_0x40ca('0x2b')](0x1f4)[_0x40ca('0x3c')](new db[(_0x40ca('0x1e'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x40ca('0x7d')](_0x151e01['body'][_0x40ca('0x5c')])||_0x151e01[_0x40ca('0x5c')][_0x40ca('0x5c')]===''){throw _0x142fb9['status'](0x1f4)[_0x40ca('0x3c')](new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x91')));}if(_['isNil'](_0x151e01[_0x40ca('0x5c')][_0x40ca('0xc8')])){throw _0x142fb9['status'](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x40ca('0xc9')+_0x34653c));}if(!_[_0x40ca('0x94')](_0x34653c,_0x151e01[_0x40ca('0x5c')]['mapKeyOffline'])){throw _0x142fb9[_0x40ca('0x2b')](0x1f4)[_0x40ca('0x3c')](new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0xca')+_0x34653c));}_0xf0c0ba[_0x151e01[_0x40ca('0x5c')]['mapKeyOffline']]=_0x151e01[_0x40ca('0x5c')][_0x40ca('0x8f')];})[_0x40ca('0x21')](function(){return db[_0x40ca('0x40')]['find']({'where':{'id':_0x151e01['params']['id']},'include':[{'model':db['CmList'],'as':_0x40ca('0x96')}]});})['then'](handleEntityNotFound(_0x142fb9,null))['then'](function(_0x590832){if(_0x590832&&_0x590832['List']){_0x440e8f=_0x590832;var _0x1cce75=_[_0x40ca('0x16')](_0x151e01[_0x40ca('0x5c')],{'firstName':_0x151e01[_0x40ca('0x5c')][_0x40ca('0x8f')],'phone':_0x151e01['body'][_0x40ca('0x8f')],'ListId':_0x590832['ListId']});_0x1cce75[_0x151e01['body'][_0x40ca('0xc8')]]=_0x151e01[_0x40ca('0x5c')]['from'];return db[_0x40ca('0x8a')][_0x40ca('0xcb')]({'where':_0xf0c0ba,'defaults':_0x1cce75});}})[_0x40ca('0xcc')](function(_0x1239af){if(_0x1239af){_0xd16b=_0x1239af;var _0x3698b5=fs[_0x40ca('0xcd')](path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0xce')),'utf8');var _0x308d91=ejs[_0x40ca('0xcf')](_0x3698b5,{'body':_[_0x40ca('0xd0')](_0x151e01['body']['body']),'bodyTitle':_0x440e8f[_0x40ca('0xd1')]});return db['ChatOfflineMessage'][_0x40ca('0x63')]({'body':_0x308d91,'ContactId':_0x1239af['id'],'ChatWebsiteId':_0x440e8f['id']});}})['then'](function(_0x13875e){if(_0x13875e){_0x56f3e6=_0x13875e;return db[_0x40ca('0xd2')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x40ca('0xd3')],'as':_0x40ca('0xd4'),'raw':!![]}]});}})[_0x40ca('0x21')](function(_0x573c58){if(_0x573c58&&_0x573c58[_0x40ca('0xd4')]&&_0x440e8f[_0x40ca('0xd5')]){var _0xfa47e6={'tls':{'rejectUnauthorized':![]}};if(_0x573c58['Smtp'][_0x40ca('0xd6')]){_0xfa47e6[_0x40ca('0xd6')]=_0x573c58[_0x40ca('0xd4')][_0x40ca('0xd6')];}else{_0xfa47e6[_0x40ca('0xd7')]=_0x573c58[_0x40ca('0xd4')][_0x40ca('0xd7')];_0xfa47e6[_0x40ca('0xd8')]=_0x573c58['Smtp'][_0x40ca('0xd8')];_0xfa47e6['secure']=_0x573c58['Smtp'][_0x40ca('0xd9')];}if(_0x573c58[_0x40ca('0xd4')][_0x40ca('0xda')]){_0xfa47e6[_0x40ca('0xdb')]={'user':_0x573c58[_0x40ca('0xd4')][_0x40ca('0x5d')],'pass':_0x573c58[_0x40ca('0xd4')][_0x40ca('0xdc')]};}return respondWithRpcPromise(_0x40ca('0xdd'),_0x40ca('0xde'),{'account':_0xfa47e6,'message':{'from':util['format'](_0x40ca('0xdf'),_0x573c58['name'],_0x573c58[_0x40ca('0xe0')]||_0x573c58[_0x40ca('0xd4')][_0x40ca('0x5d')]),'to':_0x440e8f[_0x40ca('0xd5')],'subject':_0x440e8f[_0x40ca('0xe1')],'text':_0x56f3e6['body']}},client9003)[_0x40ca('0x21')](function(){return _0x56f3e6;})[_0x40ca('0x56')](function(_0x2eba0d){console['error'](_0x2eba0d);});}})[_0x40ca('0x21')](function(){if(_0x56f3e6){return _0x56f3e6;}})['then'](respondWithResult(_0x142fb9,null))['catch'](handleError(_0x142fb9,null));};exports[_0x40ca('0xe2')]=function(_0x4b62c1,_0x54483c,_0x457a35){return db[_0x40ca('0xb1')]['find']({'where':{'id':_0x4b62c1['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x54483c,null))['then'](function(_0x4ba8db){if(_0x4ba8db){return _0x4ba8db[_0x40ca('0xe2')](_0x4b62c1[_0x40ca('0x5c')][_0x40ca('0x6a')],_[_0x40ca('0xe3')](_0x4b62c1[_0x40ca('0x5c')],['ids','id'])||{});}})[_0x40ca('0x21')](respondWithResult(_0x54483c,null))[_0x40ca('0x56')](handleError(_0x54483c,null));};exports['getInteractions']=function(_0x834b5,_0x34f075,_0x123a24){var _0x2a8b97={'raw':![],'where':{}};var _0x39ad98={};var _0x355818={'count':0x0,'rows':[]};return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x834b5[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x34f075,null))[_0x40ca('0x21')](function(_0x41ad52){if(_0x41ad52){_0x39ad98['model']=_[_0x40ca('0x44')](db[_0x40ca('0xb1')][_0x40ca('0x41')]);_0x39ad98[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0x834b5['query']);_0x39ad98['filters']=_[_0x40ca('0x47')](_0x39ad98[_0x40ca('0x49')],_0x39ad98[_0x40ca('0x45')]);_0x2a8b97[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x39ad98[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0x834b5[_0x40ca('0x45')][_0x40ca('0x4a')]));_0x2a8b97[_0x40ca('0x48')]=_0x2a8b97[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x2a8b97[_0x40ca('0x48')]:_0x39ad98[_0x40ca('0x49')];if(!_0x834b5[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x2a8b97[_0x40ca('0x30')]=qs[_0x40ca('0x30')](_0x834b5[_0x40ca('0x45')][_0x40ca('0x30')]);_0x2a8b97[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x834b5[_0x40ca('0x45')]['offset']);}_0x2a8b97['order']=qs[_0x40ca('0x4e')](_0x834b5[_0x40ca('0x45')][_0x40ca('0x4e')]);_0x2a8b97[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0x834b5[_0x40ca('0x45')],_0x39ad98[_0x40ca('0x46')]));_0x2a8b97[_0x40ca('0x4f')][_0x40ca('0x69')]=_0x41ad52['id'];if(_0x834b5['query'][_0x40ca('0x52')]){_0x2a8b97['where']=_[_0x40ca('0x51')](_0x2a8b97[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x2a8b97[_0x40ca('0x48')],function(_0x10437d){var _0x380013={};_0x380013[_0x10437d]={'$like':'%'+_0x834b5[_0x40ca('0x45')]['filter']+'%'};return _0x380013;})});}_0x2a8b97=_['merge']({},_0x2a8b97,_0x834b5['options']);return db['ChatInteraction']['count']({'where':_0x2a8b97[_0x40ca('0x4f')]})['then'](function(_0x1e4c6b){_0x355818[_0x40ca('0x2e')]=_0x1e4c6b;if(_0x834b5[_0x40ca('0x45')][_0x40ca('0x5a')]){_0x2a8b97[_0x40ca('0xe4')]=[{'model':db[_0x40ca('0x8a')],'as':_0x40ca('0xe5'),'required':![]},{'model':db[_0x40ca('0xe6')],'as':'Owner','attributes':[_0x40ca('0x3b'),_0x40ca('0xe7'),_0x40ca('0xe8')],'required':![]},{'model':db[_0x40ca('0xe9')],'as':_0x40ca('0xea'),'attributes':['id',_0x40ca('0x3b'),_0x40ca('0xeb')],'where':_0x834b5[_0x40ca('0x45')][_0x40ca('0xec')]?{'id':_0x834b5[_0x40ca('0x45')][_0x40ca('0xec')]}:undefined,'required':_0x834b5[_0x40ca('0x45')][_0x40ca('0xec')]?!![]:![]}];}return db['ChatInteraction'][_0x40ca('0x54')](_0x2a8b97);})[_0x40ca('0x21')](function(_0x19409d){_0x355818[_0x40ca('0x55')]=_0x19409d;return _0x355818;});}})[_0x40ca('0x21')](respondWithFilteredResult(_0x34f075,_0x2a8b97))[_0x40ca('0x56')](handleError(_0x34f075,null));};function iftimePromise(_0x91b92b,_0x129afa){return respondWithRpcPromise(_0x40ca('0xed'),'getSnippet',{'command':_0x129afa[_0x40ca('0xee')]?util['format'](_0x40ca('0xef'),_0x91b92b[_0x40ca('0xf0')],_0x129afa['timezone']):util[_0x40ca('0xab')](_0x40ca('0xf1'),_0x91b92b[_0x40ca('0xf0')])},client9002)[_0x40ca('0x21')](function(_0x3e1ac1){var _0x1e7e2c=_0x3e1ac1&&_0x3e1ac1[_0x40ca('0xf2')](_0x40ca('0xf3'))>=0x0?!![]:![];logger[_0x40ca('0x22')](_0x40ca('0xf4'),_0x129afa['id'],_0x91b92b['id'],_0x91b92b[_0x40ca('0xf0')],_0x1e7e2c?_0x40ca('0xf5'):_0x40ca('0xf6'),_0x129afa[_0x40ca('0xee')]?_0x129afa[_0x40ca('0xee')]:_0x40ca('0xf7'));return _0x1e7e2c;})[_0x40ca('0x56')](function(_0x1feb86){logger['error'](_0x40ca('0xf4'),_0x129afa['id'],_0x91b92b['id'],_0x91b92b['interval'],util[_0x40ca('0xf8')](_0x1feb86,{'showHidden':![],'depth':null}),_0x129afa[_0x40ca('0xee')]?_0x129afa[_0x40ca('0xee')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x3aba72,_0x16d783,_0x150655){var _0x3e169d=0x0;var _0x37bf0f=0x0;var _0x53f867=![];var _0x13502b;var _0x397c3d;return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x3aba72['params']['id']},'include':[{'model':db['Interval'],'as':_0x40ca('0xf9'),'include':[{'model':db[_0x40ca('0xf9')],'as':_0x40ca('0xfa'),'attributes':['id',_0x40ca('0xf0')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x16d783,null))['then'](function(_0xba2c69){if(_0xba2c69){_0x13502b=_0xba2c69;return _0xba2c69['getProactiveActions']({'raw':!![]});}})[_0x40ca('0x21')](function(_0x49de3d){if(_0x13502b){if(_0x49de3d){_0x397c3d=_0x49de3d;}}return require(_0x40ca('0x7a'))[_0x40ca('0x7b')]();})[_0x40ca('0x21')](function(_0x124723){if(_0x124723){_0x37bf0f=_0x124723[_0x40ca('0xfb')];_0x53f867=_0x124723['custom'];}})[_0x40ca('0x21')](function(){return db[_0x40ca('0xb1')][_0x40ca('0x2e')]({'where':{'closed':![]}});})[_0x40ca('0x21')](function(_0x42536e){_0x3e169d=_0x42536e;if(_0x37bf0f&&_0x42536e>_0x37bf0f){return db[_0x40ca('0xfc')][_0x40ca('0x6e')]({'where':{'id':0x1}})[_0x40ca('0x21')](function(_0x4ca099){if(_0x4ca099){_0x4ca099['increment'](_0x40ca('0xfd'));}});}})['then'](function(){if(_0x13502b[_0x40ca('0xf9')]&&_0x13502b[_0x40ca('0xf9')][_0x40ca('0xfa')]){var _0x2a5efb=[];for(var _0x4d2bb3=0x0;_0x4d2bb3<_0x13502b['Interval'][_0x40ca('0xfa')][_0x40ca('0x4b')];_0x4d2bb3++){var _0x418a04=_0x13502b[_0x40ca('0xf9')][_0x40ca('0xfa')][_0x4d2bb3][_0x40ca('0x5e')]({'plain':!![]});_0x2a5efb[_0x40ca('0xb9')](iftimePromise(_0x418a04,_0x13502b));}return BPromise[_0x40ca('0xfe')](_0x2a5efb)['then'](function(_0x54f1fa){return _['some'](_0x54f1fa);});}else{return!![];}})['then'](function(_0x5eebaf){var _0x53ab21=fs[_0x40ca('0xcd')](path[_0x40ca('0x77')](config[_0x40ca('0x78')],'server/files/chat/iframe.js'),_0x40ca('0xff'));var _0x332607={'remote':_0x13502b['remote'],'query':querystring['stringify'](_[_0x40ca('0x51')](_0x13502b[_0x40ca('0x5e')]({'plain':!![]}),{'customerIp':_0x3aba72[_0x40ca('0xa3')]['x-forwarded-for']||_0x3aba72[_0x40ca('0xa3')]['x-real-ip']||_0x3aba72[_0x40ca('0x100')][_0x40ca('0x101')]||_0x3aba72['ip'],'referer':_0x3aba72[_0x40ca('0xa3')]['referer'],'openedInteractions':_0x3e169d,'maxInteractions':_0x37bf0f,'virtual':_0x53f867['virtual'],'online':_0x5eebaf,'custom':_0x53f867}))['replace'](/'/g,'\x5c\x27')};_0x16d783[_0x40ca('0x3c')](ejs[_0x40ca('0xcf')](Mustache[_0x40ca('0xcf')](_0x53ab21,_0x332607),{'proactiveActions':_0x397c3d,'alignment':_0x13502b[_0x40ca('0x102')],'verticalAlignment':_0x13502b[_0x40ca('0x103')],'div_color':_0x13502b[_0x40ca('0xeb')],'text_color':_0x13502b[_0x40ca('0x104')]}));})[_0x40ca('0x56')](handleError(_0x16d783,null));};exports[_0x40ca('0x105')]=function(_0x25a93f,_0x4a76c1,_0xdfc4a){return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x25a93f[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x4a76c1,null))[_0x40ca('0x21')](function(_0x4b946f){if(_0x4b946f){return db[_0x40ca('0x106')]['transaction'](function(_0x108a7e){return db[_0x40ca('0x98')][_0x40ca('0x39')]({'where':{'ChatWebsiteId':_0x25a93f[_0x40ca('0x58')]['id']},'transaction':_0x108a7e})[_0x40ca('0x21')](function(_0x116d59){var _0x5f24d1=_[_0x40ca('0x3f')](_0x25a93f[_0x40ca('0x5c')],function(_0x4e5d22){_0x4e5d22['ChatWebsiteId']=_0x25a93f[_0x40ca('0x58')]['id'];return _0x4e5d22;});return db[_0x40ca('0x98')][_0x40ca('0x107')](_0x5f24d1,{'transaction':_0x108a7e});});})[_0x40ca('0x21')](function(){return db[_0x40ca('0x98')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x25a93f[_0x40ca('0x58')]['id']},'order':_0x40ca('0x9d')});});}})[_0x40ca('0x21')](respondWithResult(_0x4a76c1,null))[_0x40ca('0x56')](handleError(_0x4a76c1,null));};exports[_0x40ca('0x108')]=function(_0x39066e,_0x1439cc,_0x21694f){var _0x5b2423={};var _0x586ee2={};var _0x40d135;var _0x36eb13;return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x39066e[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x1439cc,null))[_0x40ca('0x21')](function(_0x1e0eac){if(_0x1e0eac){_0x40d135=_0x1e0eac;_0x586ee2[_0x40ca('0x49')]=_[_0x40ca('0x44')](db[_0x40ca('0x98')][_0x40ca('0x41')]);_0x586ee2[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0x39066e[_0x40ca('0x45')]);_0x586ee2[_0x40ca('0x46')]=_[_0x40ca('0x47')](_0x586ee2[_0x40ca('0x49')],_0x586ee2[_0x40ca('0x45')]);_0x5b2423[_0x40ca('0x48')]=_['intersection'](_0x586ee2[_0x40ca('0x49')],qs['fields'](_0x39066e[_0x40ca('0x45')]['fields']));_0x5b2423[_0x40ca('0x48')]=_0x5b2423[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x5b2423[_0x40ca('0x48')]:_0x586ee2[_0x40ca('0x49')];_0x5b2423['order']=qs[_0x40ca('0x4e')](_0x39066e[_0x40ca('0x45')][_0x40ca('0x4e')]);_0x5b2423[_0x40ca('0x4f')]=qs['filters'](_[_0x40ca('0x50')](_0x39066e[_0x40ca('0x45')],_0x586ee2[_0x40ca('0x46')]));if(_0x39066e['query'][_0x40ca('0x52')]){_0x5b2423[_0x40ca('0x4f')]=_['merge'](_0x5b2423[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x5b2423[_0x40ca('0x48')],function(_0x5ef614){var _0x29b5aa={};_0x29b5aa[_0x5ef614]={'$like':'%'+_0x39066e[_0x40ca('0x45')][_0x40ca('0x52')]+'%'};return _0x29b5aa;})});}_0x5b2423=_[_0x40ca('0x51')]({},_0x5b2423,_0x39066e[_0x40ca('0x53')]);return _0x40d135[_0x40ca('0x108')](_0x5b2423);}})['then'](function(_0x5154d9){if(_0x5154d9){_0x36eb13=_0x5154d9[_0x40ca('0x4b')];if(!_0x39066e[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x5b2423[_0x40ca('0x30')]=qs[_0x40ca('0x30')](_0x39066e[_0x40ca('0x45')][_0x40ca('0x30')]);_0x5b2423['offset']=qs[_0x40ca('0x2f')](_0x39066e[_0x40ca('0x45')][_0x40ca('0x2f')]);}return _0x40d135[_0x40ca('0x108')](_0x5b2423);}})[_0x40ca('0x21')](function(_0x3e1943){if(_0x3e1943){return _0x3e1943?{'count':_0x36eb13,'rows':_0x3e1943}:null;}})[_0x40ca('0x21')](respondWithResult(_0x1439cc,null))[_0x40ca('0x56')](handleError(_0x1439cc,null));};exports[_0x40ca('0x109')]=function(_0x1d26fd,_0x4858f0,_0x28b709){return db[_0x40ca('0x10a')][_0x40ca('0x5b')]({'where':{'id':_0x1d26fd['params']['id']}})['then'](handleEntityNotFound(_0x4858f0,null))[_0x40ca('0x21')](function(_0x14a21e){if(_0x14a21e){return _0x14a21e[_0x40ca('0x109')](_0x1d26fd['body'][_0x40ca('0x6a')],_[_0x40ca('0xe3')](_0x1d26fd[_0x40ca('0x5c')],[_0x40ca('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x4858f0,null))[_0x40ca('0x56')](handleError(_0x4858f0,null));};exports[_0x40ca('0x10b')]=function(_0x1984cc,_0xed4183,_0x2c3e9e){var _0x25e0b3={};var _0x46d66e={};var _0x5f196f;var _0x395329;return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x1984cc[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0xed4183,null))[_0x40ca('0x21')](function(_0x7cbbeb){if(_0x7cbbeb){_0x5f196f=_0x7cbbeb;_0x46d66e[_0x40ca('0x49')]=_[_0x40ca('0x44')](db['ChatProactiveAction'][_0x40ca('0x41')]);_0x46d66e[_0x40ca('0x45')]=_['keys'](_0x1984cc[_0x40ca('0x45')]);_0x46d66e[_0x40ca('0x46')]=_[_0x40ca('0x47')](_0x46d66e[_0x40ca('0x49')],_0x46d66e['query']);_0x25e0b3['attributes']=_['intersection'](_0x46d66e[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0x1984cc[_0x40ca('0x45')]['fields']));_0x25e0b3[_0x40ca('0x48')]=_0x25e0b3[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x25e0b3[_0x40ca('0x48')]:_0x46d66e[_0x40ca('0x49')];_0x25e0b3['order']=qs['sort'](_0x1984cc[_0x40ca('0x45')]['sort']);_0x25e0b3['where']=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0x1984cc[_0x40ca('0x45')],_0x46d66e[_0x40ca('0x46')]));if(_0x1984cc[_0x40ca('0x45')][_0x40ca('0x52')]){_0x25e0b3['where']=_[_0x40ca('0x51')](_0x25e0b3[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x25e0b3['attributes'],function(_0x423256){var _0x4bd655={};_0x4bd655[_0x423256]={'$like':'%'+_0x1984cc['query'][_0x40ca('0x52')]+'%'};return _0x4bd655;})});}_0x25e0b3=_[_0x40ca('0x51')]({},_0x25e0b3,_0x1984cc[_0x40ca('0x53')]);return _0x5f196f[_0x40ca('0x10b')](_0x25e0b3);}})[_0x40ca('0x21')](function(_0x2d445f){if(_0x2d445f){_0x395329=_0x2d445f['length'];if(!_0x1984cc[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x25e0b3['limit']=qs[_0x40ca('0x30')](_0x1984cc['query'][_0x40ca('0x30')]);_0x25e0b3[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x1984cc[_0x40ca('0x45')][_0x40ca('0x2f')]);}return _0x5f196f[_0x40ca('0x10b')](_0x25e0b3);}})[_0x40ca('0x21')](function(_0x14dd1f){if(_0x14dd1f){return _0x14dd1f?{'count':_0x395329,'rows':_0x14dd1f}:null;}})[_0x40ca('0x21')](respondWithResult(_0xed4183,null))[_0x40ca('0x56')](handleError(_0xed4183,null));};exports[_0x40ca('0x10c')]=function(_0x25d191,_0x47d71a,_0xdfff8f){var _0x5e5cd8=_0x25d191['query']['online']==='false'?_0x40ca('0x10d'):_0x40ca('0x10e');return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'attributes':['id',_0x5e5cd8],'where':{'id':_0x25d191[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x47d71a,null))[_0x40ca('0x21')](function(_0x3f57f0){if(_0x3f57f0){var _0xd5549c=_0x3f57f0[_0x5e5cd8];var _0x3cc65e=_0xd5549c&&_0xd5549c[_0x40ca('0x10f')]?_0xd5549c[_0x40ca('0x10f')]:[];_0x47d71a[_0x40ca('0x3c')]({'fromKey':_[_0x40ca('0x7d')](_0xd5549c['fromKey'])?undefined:_0xd5549c[_0x40ca('0x110')],'count':_0x3cc65e['length'],'rows':_0x3cc65e});}})['catch'](handleError(_0x47d71a,null));};exports[_0x40ca('0x111')]=function(_0x3e81e2,_0x1683b3,_0xa6a60a){var _0x3dac2a={'raw':![],'where':{}};var _0x11076a={};var _0x3ea4dd={'count':0x0,'rows':[]};return db[_0x40ca('0x40')]['findOne']({'where':{'id':_0x3e81e2[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x1683b3,null))[_0x40ca('0x21')](function(_0x324ae9){if(_0x324ae9){_0x11076a[_0x40ca('0x49')]=_[_0x40ca('0x44')](db[_0x40ca('0x112')]['rawAttributes']);_0x11076a['query']=_[_0x40ca('0x44')](_0x3e81e2[_0x40ca('0x45')]);_0x11076a[_0x40ca('0x46')]=_['intersection'](_0x11076a[_0x40ca('0x49')],_0x11076a['query']);_0x3dac2a['attributes']=_[_0x40ca('0x47')](_0x11076a[_0x40ca('0x49')],qs['fields'](_0x3e81e2[_0x40ca('0x45')]['fields']));_0x3dac2a[_0x40ca('0x48')]=_0x3dac2a[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x3dac2a['attributes']:_0x11076a[_0x40ca('0x49')];if(!_0x3e81e2[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x3dac2a[_0x40ca('0x30')]=qs['limit'](_0x3e81e2[_0x40ca('0x45')]['limit']);_0x3dac2a[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x3e81e2[_0x40ca('0x45')][_0x40ca('0x2f')]);}_0x3dac2a[_0x40ca('0x68')]=qs[_0x40ca('0x4e')](_0x3e81e2['query'][_0x40ca('0x4e')]);_0x3dac2a['where']=qs[_0x40ca('0x46')](_['pick'](_0x3e81e2[_0x40ca('0x45')],_0x11076a[_0x40ca('0x46')]));_0x3dac2a[_0x40ca('0x4f')][_0x40ca('0x69')]=_0x324ae9['id'];if(_0x3e81e2[_0x40ca('0x45')][_0x40ca('0x52')]){_0x3dac2a[_0x40ca('0x4f')]=_[_0x40ca('0x51')](_0x3dac2a[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x3dac2a[_0x40ca('0x48')],function(_0x5b7887){var _0x2e9923={};_0x2e9923[_0x5b7887]={'$like':'%'+_0x3e81e2[_0x40ca('0x45')]['filter']+'%'};return _0x2e9923;})});}_0x3dac2a=_['merge']({},_0x3dac2a,_0x3e81e2[_0x40ca('0x53')]);return db[_0x40ca('0x112')][_0x40ca('0x2e')]({'where':_0x3dac2a['where']})[_0x40ca('0x21')](function(_0x22dc79){_0x3ea4dd['count']=_0x22dc79;if(_0x3e81e2[_0x40ca('0x45')]['includeAll']){_0x3dac2a['include']=[{'all':!![]}];}else{_0x3dac2a[_0x40ca('0xe4')]=[{'model':db[_0x40ca('0x8a')],'as':_0x40ca('0xe5'),'required':![]}];}return db[_0x40ca('0x112')]['findAll'](_0x3dac2a);})[_0x40ca('0x21')](function(_0x2d5504){_0x3ea4dd[_0x40ca('0x55')]=_0x2d5504;return _0x3ea4dd;});}})[_0x40ca('0x21')](respondWithFilteredResult(_0x1683b3,_0x3dac2a))['catch'](handleError(_0x1683b3,null));};exports['addAgents']=function(_0x11d0db,_0x5ed070,_0x18cec0){return db[_0x40ca('0x40')]['find']({'where':{'id':_0x11d0db[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x5ed070,null))['then'](function(_0x28d923){if(_0x28d923){return _0x28d923[_0x40ca('0x113')](_0x11d0db[_0x40ca('0x5c')][_0x40ca('0x6a')],_[_0x40ca('0xe3')](_0x11d0db[_0x40ca('0x5c')],[_0x40ca('0x6a'),'id'])||{})['spread'](function(_0x32dc45){for(var _0x1119d7=0x0;_0x1119d7<_0x11d0db[_0x40ca('0x5c')][_0x40ca('0x6a')][_0x40ca('0x4b')];_0x1119d7+=0x1){socket[_0x40ca('0x114')]('userChatWebsite:save',{'UserId':_0x11d0db[_0x40ca('0x5c')]['ids'][_0x1119d7],'ChatWebsiteId':_0x11d0db[_0x40ca('0x58')]['id']});}return _0x32dc45;});}})['then'](respondWithResult(_0x5ed070,null))[_0x40ca('0x56')](handleError(_0x5ed070,null));};exports[_0x40ca('0x115')]=function(_0x226f47,_0x20e429,_0x7cdfc1){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x226f47['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x20e429,null))[_0x40ca('0x21')](function(_0xcb29db){if(_0xcb29db){return _0xcb29db['removeAgents'](_0x226f47[_0x40ca('0x45')][_0x40ca('0x6a')])['then'](function(){if(_['isArray'](_0x226f47[_0x40ca('0x45')][_0x40ca('0x6a')])){for(var _0x38c628=0x0;_0x38c628<_0x226f47['query'][_0x40ca('0x6a')][_0x40ca('0x4b')];_0x38c628+=0x1){socket[_0x40ca('0x114')](_0x40ca('0x116'),{'UserId':Number(_0x226f47[_0x40ca('0x45')]['ids'][_0x38c628]),'ChatWebsiteId':Number(_0x226f47['params']['id'])});}}else{socket[_0x40ca('0x114')](_0x40ca('0x116'),{'UserId':Number(_0x226f47[_0x40ca('0x45')][_0x40ca('0x6a')]),'ChatWebsiteId':Number(_0x226f47['params']['id'])});}});}})[_0x40ca('0x21')](respondWithStatusCode(_0x20e429,null))['catch'](handleError(_0x20e429,null));};exports[_0x40ca('0x117')]=function(_0x3d57c2,_0xba91bf,_0x17daa0){var _0x5a7a3a={};var _0x20335f={};var _0x1e9212;var _0x5e0de8;return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x3d57c2[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0xba91bf,null))[_0x40ca('0x21')](function(_0x551874){if(_0x551874){_0x1e9212=_0x551874;_0x20335f['model']=_['keys'](db['User'][_0x40ca('0x41')]);_0x20335f['query']=_[_0x40ca('0x44')](_0x3d57c2[_0x40ca('0x45')]);_0x20335f[_0x40ca('0x46')]=_['intersection'](_0x20335f['model'],_0x20335f[_0x40ca('0x45')]);_0x5a7a3a[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x20335f['model'],qs[_0x40ca('0x4a')](_0x3d57c2[_0x40ca('0x45')]['fields']));_0x5a7a3a['attributes']=_0x5a7a3a[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x5a7a3a[_0x40ca('0x48')]:_0x20335f[_0x40ca('0x49')];_0x5a7a3a['order']=qs['sort'](_0x3d57c2[_0x40ca('0x45')]['sort']);_0x5a7a3a[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_['pick'](_0x3d57c2[_0x40ca('0x45')],_0x20335f[_0x40ca('0x46')]));if(_0x3d57c2[_0x40ca('0x45')][_0x40ca('0x52')]){_0x5a7a3a[_0x40ca('0x4f')]=_[_0x40ca('0x51')](_0x5a7a3a[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x5a7a3a[_0x40ca('0x48')],function(_0x32b9fc){var _0x57995e={};_0x57995e[_0x32b9fc]={'$like':'%'+_0x3d57c2['query'][_0x40ca('0x52')]+'%'};return _0x57995e;})});}_0x5a7a3a=_[_0x40ca('0x51')]({},_0x5a7a3a,_0x3d57c2[_0x40ca('0x53')]);return _0x1e9212[_0x40ca('0x117')](_0x5a7a3a);}})[_0x40ca('0x21')](function(_0x100d26){if(_0x100d26){_0x5e0de8=_0x100d26[_0x40ca('0x4b')];if(!_0x3d57c2[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x5a7a3a[_0x40ca('0x30')]=qs[_0x40ca('0x30')](_0x3d57c2[_0x40ca('0x45')]['limit']);_0x5a7a3a[_0x40ca('0x2f')]=qs['offset'](_0x3d57c2[_0x40ca('0x45')][_0x40ca('0x2f')]);}return _0x1e9212['getAgents'](_0x5a7a3a);}})['then'](function(_0x989487){if(_0x989487){return _0x989487?{'count':_0x5e0de8,'rows':_0x989487}:null;}})[_0x40ca('0x21')](respondWithResult(_0xba91bf,null))['catch'](handleError(_0xba91bf,null));}; \ No newline at end of file +var _0xa75d=['Interval','Intervals','getProactiveActions','getLicense','virtual','License','increment','some','server/files/chat/iframe.js','x-real-ip','connection','alignment','verticalAlignment','sequelize','transaction','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','online','false','offlineForm','onlineForm','items','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','get','ChatWebsites','stack','name','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','params','options','find','create','body','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','rows','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','custom','isNil','sitepic','existsSync','server/files/images/logos/','download','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','setUA','headers','getResult','chat','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','from','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','lastName','messageId','created','push','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailAccount','Smtp','service','host','port','secure','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0xa75d,0x139));var _0xda75=function(_0x3f7eda,_0x1b6503){_0x3f7eda=_0x3f7eda-0x0;var _0x366810=_0xa75d[_0x3f7eda];return _0x366810;};'use strict';var pdf=require(_0xda75('0x0'));var emlformat=require(_0xda75('0x1'));var rimraf=require(_0xda75('0x2'));var zipdir=require(_0xda75('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda75('0x4'));var moment=require(_0xda75('0x5'));var BPromise=require(_0xda75('0x6'));var Mustache=require(_0xda75('0x7'));var util=require(_0xda75('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda75('0x9'));var fs=require('fs');var _=require(_0xda75('0xa'));var squel=require(_0xda75('0xb'));var crypto=require(_0xda75('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xda75('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xda75('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xda75('0xf'));var as=require(_0xda75('0x10'));var hardwareService=require(_0xda75('0x11'));var logger=require(_0xda75('0x12'))(_0xda75('0x13'));var utils=require(_0xda75('0x14'));var config=require(_0xda75('0x15'));var db=require(_0xda75('0x16'))['db'];config[_0xda75('0x17')]=_[_0xda75('0x18')](config[_0xda75('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda75('0x17')]));require(_0xda75('0x19'))[_0xda75('0x1a')](socket);var jayson=require(_0xda75('0x1b'));var client=jayson[_0xda75('0x1c')][_0xda75('0x1d')]({'port':0x232c});var client9002=jayson[_0xda75('0x1c')]['http']({'port':0x232a});var client9003=jayson[_0xda75('0x1c')][_0xda75('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x4de9de,_0x43bd5d,_0x378c9f){if(_0x378c9f){var _0x427793=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x427793[_0xda75('0x1e')](_0x43bd5d)){return _0x4de9de;}else{throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4de9de;}}function respondWithRpcPromise(_0x1a7aa4,_0x3a310a,_0x305ddf,_0x51a1f5){return new BPromise(function(_0xc22f9f,_0x3cbac4){var _0x5272af=_0x51a1f5||client;return _0x5272af['request'](_0x1a7aa4,_0x305ddf)[_0xda75('0x21')](function(_0x3eb284){logger[_0xda75('0x22')](_0xda75('0x23'),_0x3a310a,_0xda75('0x24'));logger[_0xda75('0x25')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3a310a,_0xda75('0x24'),JSON[_0xda75('0x26')](_0x3eb284));if(_0x3eb284[_0xda75('0x27')]){if(_0x3eb284[_0xda75('0x27')]['code']===0x1f4){logger[_0xda75('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x3a310a,_0x3eb284['error'][_0xda75('0x28')]);return _0x3cbac4(_0x3eb284[_0xda75('0x27')]['message']);}logger['error'](_0xda75('0x23'),_0x3a310a,_0x3eb284[_0xda75('0x27')][_0xda75('0x28')]);return _0xc22f9f(_0x3eb284['error']['message']);}else{logger[_0xda75('0x22')](_0xda75('0x23'),_0x3a310a,'request\x20sent');_0xc22f9f(_0x3eb284[_0xda75('0x29')][_0xda75('0x28')]);}})[_0xda75('0x2a')](function(_0x5a5c0c){logger[_0xda75('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x3a310a,_0x5a5c0c);_0x3cbac4(_0x5a5c0c);});});}function respondWithStatusCode(_0xd75fcb,_0x2897f2){_0x2897f2=_0x2897f2||0xcc;return function(_0x5dfd41){if(_0x5dfd41){return _0xd75fcb[_0xda75('0x2b')](_0x2897f2);}return _0xd75fcb[_0xda75('0x2c')](_0x2897f2)[_0xda75('0x2d')]();};}function respondWithResult(_0x40a06d,_0x2d0d10){_0x2d0d10=_0x2d0d10||0xc8;return function(_0x27cd35){if(_0x27cd35){return _0x40a06d[_0xda75('0x2c')](_0x2d0d10)[_0xda75('0x2e')](_0x27cd35);}};}function respondWithFilteredResult(_0x2d40c8,_0x2c7ae8){return function(_0x18126b){if(_0x18126b){var _0x16aee8=_0x18126b[_0xda75('0x2f')],_0x5416fe=_0x2c7ae8[_0xda75('0x30')],_0x569626=_0x2c7ae8[_0xda75('0x30')]+_0x2c7ae8[_0xda75('0x31')],_0x4fe78d;if(_0x569626>=_0x16aee8){_0x569626=_0x16aee8;_0x4fe78d=0xc8;}else{_0x4fe78d=0xce;}_0x2d40c8[_0xda75('0x2c')](_0x4fe78d);return _0x2d40c8[_0xda75('0x32')](_0xda75('0x33'),_0x5416fe+'-'+_0x569626+'/'+_0x16aee8)[_0xda75('0x2e')](_0x18126b);}return null;};}function patchUpdates(_0x9affe7){return function(_0x370696){try{jsonpatch[_0xda75('0x34')](_0x370696,_0x9affe7,!![]);}catch(_0x1f4dc2){return BPromise['reject'](_0x1f4dc2);}return _0x370696[_0xda75('0x35')]();};}function saveUpdates(_0x44b56d,_0x76900e){return function(_0x1858a0){if(_0x1858a0){return _0x1858a0['update'](_0x44b56d)[_0xda75('0x21')](function(_0x5d8303){return _0x5d8303;});}return null;};}function removeEntity(_0x52f22c,_0x21009e){return function(_0x1ccfb6){if(_0x1ccfb6){return _0x1ccfb6[_0xda75('0x36')]()[_0xda75('0x21')](function(){var _0x190e56=_0x1ccfb6[_0xda75('0x37')]({'plain':!![]});var _0x4584e6=_0xda75('0x38');return db['UserProfileResource'][_0xda75('0x36')]({'where':{'type':_0x4584e6,'resourceId':_0x190e56['id']}})['then'](function(){return _0x1ccfb6;});})[_0xda75('0x21')](function(){_0x52f22c['status'](0xcc)[_0xda75('0x2d')]();});}};}function handleEntityNotFound(_0x44fa8a,_0x342f62){return function(_0x40b839){if(!_0x40b839){_0x44fa8a[_0xda75('0x2b')](0x194);}return _0x40b839;};}function handleError(_0x2ff4dd,_0x444a5a){_0x444a5a=_0x444a5a||0x1f4;return function(_0x155280){logger['error'](_0x155280[_0xda75('0x39')]);if(_0x155280[_0xda75('0x3a')]){delete _0x155280[_0xda75('0x3a')];}_0x2ff4dd['status'](_0x444a5a)['send'](_0x155280);};}exports['index']=function(_0x2fe4f2,_0x27c70f){var _0x166957={'include':[{'model':db[_0xda75('0x3b')],'as':_0xda75('0x3c')}]},_0x2598ea={},_0x4be2ae={'count':0x0,'rows':[]};var _0x2c07d1=_[_0xda75('0x3d')](db[_0xda75('0x3e')][_0xda75('0x3f')],function(_0x324196){return{'name':_0x324196[_0xda75('0x40')],'type':_0x324196[_0xda75('0x41')][_0xda75('0x42')]};});_0x2598ea[_0xda75('0x43')]=_[_0xda75('0x3d')](_0x2c07d1,_0xda75('0x3a'));_0x2598ea[_0xda75('0x44')]=_[_0xda75('0x45')](_0x2fe4f2[_0xda75('0x44')]);_0x2598ea[_0xda75('0x46')]=_[_0xda75('0x47')](_0x2598ea['model'],_0x2598ea[_0xda75('0x44')]);_0x166957[_0xda75('0x48')]=_['intersection'](_0x2598ea['model'],qs[_0xda75('0x49')](_0x2fe4f2['query'][_0xda75('0x49')]));_0x166957[_0xda75('0x48')]=_0x166957[_0xda75('0x48')][_0xda75('0x4a')]?_0x166957[_0xda75('0x48')]:_0x2598ea[_0xda75('0x43')];if(!_0x2fe4f2[_0xda75('0x44')][_0xda75('0x4b')]('nolimit')){_0x166957[_0xda75('0x31')]=qs['limit'](_0x2fe4f2[_0xda75('0x44')][_0xda75('0x31')]);_0x166957[_0xda75('0x30')]=qs[_0xda75('0x30')](_0x2fe4f2[_0xda75('0x44')]['offset']);}_0x166957[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x2fe4f2[_0xda75('0x44')][_0xda75('0x4d')]);_0x166957['where']=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x2fe4f2[_0xda75('0x44')],_0x2598ea[_0xda75('0x46')]),_0x2c07d1);if(_0x2fe4f2[_0xda75('0x44')][_0xda75('0x4f')]){_0x166957[_0xda75('0x50')]=_[_0xda75('0x51')](_0x166957[_0xda75('0x50')],{'$or':_[_0xda75('0x3d')](_0x2c07d1,function(_0x2e22e5){if(_0x2e22e5[_0xda75('0x41')]!==_0xda75('0x52')){var _0x2519cd={};_0x2519cd[_0x2e22e5['name']]={'$like':'%'+_0x2fe4f2[_0xda75('0x44')]['filter']+'%'};return _0x2519cd;}})});}_0x166957=_[_0xda75('0x51')]({},_0x166957,_0x2fe4f2['options']);var _0x3b0ef5={'where':_0x166957['where']};return db[_0xda75('0x3e')]['count'](_0x3b0ef5)[_0xda75('0x21')](function(_0x2e25bf){_0x4be2ae['count']=_0x2e25bf;if(_0x2fe4f2[_0xda75('0x44')][_0xda75('0x53')]){_0x166957[_0xda75('0x54')]=[{'all':!![]}];}return db[_0xda75('0x3e')]['findAll'](_0x166957);})['then'](function(_0x2e5b9e){_0x4be2ae['rows']=_0x2e5b9e;return _0x4be2ae;})[_0xda75('0x21')](respondWithFilteredResult(_0x27c70f,_0x166957))[_0xda75('0x2a')](handleError(_0x27c70f,null));};exports['show']=function(_0x342644,_0x1ebd08){var _0x152cd7={'raw':![],'where':{'id':_0x342644[_0xda75('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xda75('0x3c')}]},_0x49b78c={};_0x49b78c[_0xda75('0x43')]=_[_0xda75('0x45')](db[_0xda75('0x3e')][_0xda75('0x3f')]);_0x49b78c[_0xda75('0x44')]=_[_0xda75('0x45')](_0x342644['query']);_0x49b78c[_0xda75('0x46')]=_[_0xda75('0x47')](_0x49b78c['model'],_0x49b78c['query']);_0x152cd7[_0xda75('0x48')]=_[_0xda75('0x47')](_0x49b78c[_0xda75('0x43')],qs[_0xda75('0x49')](_0x342644[_0xda75('0x44')][_0xda75('0x49')]));_0x152cd7[_0xda75('0x48')]=_0x152cd7[_0xda75('0x48')]['length']?_0x152cd7[_0xda75('0x48')]:_0x49b78c[_0xda75('0x43')];if(_0x342644['query'][_0xda75('0x53')]){_0x152cd7[_0xda75('0x54')]=[{'all':!![]}];}_0x152cd7=_[_0xda75('0x51')]({},_0x152cd7,_0x342644[_0xda75('0x56')]);return db[_0xda75('0x3e')][_0xda75('0x57')](_0x152cd7)[_0xda75('0x21')](handleEntityNotFound(_0x1ebd08,null))['then'](respondWithResult(_0x1ebd08,null))[_0xda75('0x2a')](handleError(_0x1ebd08,null));};exports[_0xda75('0x58')]=function(_0x3dfc89,_0x1896ee){return db[_0xda75('0x3e')]['create'](_0x3dfc89[_0xda75('0x59')],{})[_0xda75('0x21')](function(_0x5c3387){var _0x5680a6=_0x3dfc89['user']['get']({'plain':!![]});if(!_0x5680a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5680a6[_0xda75('0x5a')]===_0xda75('0x5b')){var _0x4e88e4=_0x5c3387[_0xda75('0x37')]({'plain':!![]});var _0x3403a6='ChatWebsites';return db[_0xda75('0x5c')][_0xda75('0x57')]({'where':{'name':_0x3403a6,'userProfileId':_0x5680a6['userProfileId']},'raw':!![]})['then'](function(_0x32bb41){if(_0x32bb41&&_0x32bb41['autoAssociation']===0x0){return db[_0xda75('0x5d')][_0xda75('0x58')]({'name':_0x4e88e4[_0xda75('0x3a')],'resourceId':_0x4e88e4['id'],'type':_0x32bb41[_0xda75('0x3a')],'sectionId':_0x32bb41['id']},{})[_0xda75('0x21')](function(){return _0x5c3387;});}else{return _0x5c3387;}})['catch'](function(_0x35f3c8){logger['error'](_0xda75('0x5e'),_0x35f3c8);throw _0x35f3c8;});}return _0x5c3387;})[_0xda75('0x21')](respondWithResult(_0x1896ee,0xc9))[_0xda75('0x2a')](handleError(_0x1896ee,null));};exports[_0xda75('0x5f')]=function(_0x2340fe,_0x41d167){if(_0x2340fe['body']['id']){delete _0x2340fe['body']['id'];}return db[_0xda75('0x3e')]['find']({'where':{'id':_0x2340fe[_0xda75('0x55')]['id']},'include':[{'model':db[_0xda75('0x3b')],'as':_0xda75('0x3c')}]})['then'](handleEntityNotFound(_0x41d167,null))[_0xda75('0x21')](saveUpdates(_0x2340fe['body'],null))['then'](respondWithResult(_0x41d167,null))['catch'](handleError(_0x41d167,null));};exports[_0xda75('0x36')]=function(_0x206ef0,_0x3d6a26){return db['ChatWebsite'][_0xda75('0x57')]({'where':{'id':_0x206ef0[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x3d6a26,null))[_0xda75('0x21')](removeEntity(_0x3d6a26,null))[_0xda75('0x2a')](handleError(_0x3d6a26,null));};exports[_0xda75('0x60')]=function(_0x35383c,_0x17b2d1){return db[_0xda75('0x3e')][_0xda75('0x60')]()['then'](respondWithResult(_0x17b2d1,null))[_0xda75('0x2a')](handleError(_0x17b2d1,null));};exports[_0xda75('0x61')]=function(_0x20c3c8,_0x6ab9d4,_0x2f572c){if(_0x20c3c8[_0xda75('0x59')]['id']){delete _0x20c3c8['body']['id'];}return db[_0xda75('0x3e')]['find']({'where':{'id':_0x20c3c8[_0xda75('0x55')]['id']}})['then'](handleEntityNotFound(_0x6ab9d4,null))[_0xda75('0x21')](function(_0xbcef4c){if(_0xbcef4c){_0x20c3c8[_0xda75('0x59')][_0xda75('0x62')]=_0xbcef4c['id'];return db[_0xda75('0x63')][_0xda75('0x58')](_0x20c3c8['body']);}})[_0xda75('0x21')](respondWithResult(_0x6ab9d4,null))[_0xda75('0x2a')](handleError(_0x6ab9d4,null));};exports[_0xda75('0x64')]=function(_0x279cd7,_0x22d04f,_0x45689d){var _0x1de575={'raw':![],'where':{}};var _0x43bca9={};var _0x1ad319={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x279cd7['params']['id']}})['then'](handleEntityNotFound(_0x22d04f,null))[_0xda75('0x21')](function(_0x36091b){if(_0x36091b){_0x43bca9[_0xda75('0x43')]=_[_0xda75('0x45')](db[_0xda75('0x63')]['rawAttributes']);_0x43bca9[_0xda75('0x44')]=_[_0xda75('0x45')](_0x279cd7[_0xda75('0x44')]);_0x43bca9[_0xda75('0x46')]=_[_0xda75('0x47')](_0x43bca9[_0xda75('0x43')],_0x43bca9[_0xda75('0x44')]);_0x1de575['attributes']=_['intersection'](_0x43bca9['model'],qs[_0xda75('0x49')](_0x279cd7[_0xda75('0x44')][_0xda75('0x49')]));_0x1de575[_0xda75('0x48')]=_0x1de575['attributes']['length']?_0x1de575['attributes']:_0x43bca9['model'];if(!_0x279cd7[_0xda75('0x44')][_0xda75('0x4b')]('nolimit')){_0x1de575['limit']=qs['limit'](_0x279cd7[_0xda75('0x44')]['limit']);_0x1de575[_0xda75('0x30')]=qs[_0xda75('0x30')](_0x279cd7['query']['offset']);}_0x1de575['order']=qs[_0xda75('0x4d')](_0x279cd7[_0xda75('0x44')][_0xda75('0x4d')]);_0x1de575[_0xda75('0x50')]=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x279cd7[_0xda75('0x44')],_0x43bca9[_0xda75('0x46')]));_0x1de575[_0xda75('0x50')][_0xda75('0x62')]=_0x36091b['id'];if(_0x279cd7[_0xda75('0x44')][_0xda75('0x4f')]){_0x1de575[_0xda75('0x50')]=_['merge'](_0x1de575[_0xda75('0x50')],{'$or':_[_0xda75('0x3d')](_0x1de575[_0xda75('0x48')],function(_0x31246d){var _0x593ca7={};_0x593ca7[_0x31246d]={'$like':'%'+_0x279cd7[_0xda75('0x44')][_0xda75('0x4f')]+'%'};return _0x593ca7;})});}_0x1de575=_['merge']({},_0x1de575,_0x279cd7[_0xda75('0x56')]);return db[_0xda75('0x63')][_0xda75('0x2f')]({'where':_0x1de575[_0xda75('0x50')]})['then'](function(_0x46ecd6){_0x1ad319['count']=_0x46ecd6;if(_0x279cd7['query']['includeAll']){_0x1de575['include']=[{'all':!![]}];}return db[_0xda75('0x63')][_0xda75('0x65')](_0x1de575);})[_0xda75('0x21')](function(_0x28c5e9){_0x1ad319['rows']=_0x28c5e9;return _0x1ad319;});}})[_0xda75('0x21')](respondWithFilteredResult(_0x22d04f,_0x1de575))['catch'](handleError(_0x22d04f,null));};exports[_0xda75('0x66')]=function(_0x2fe9e9,_0x304459,_0x1dd0d2){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x2fe9e9['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x304459,null))[_0xda75('0x21')](function(_0x2df6ac){if(_0x2df6ac){return _0x2df6ac[_0xda75('0x66')](_0x2fe9e9['query'][_0xda75('0x67')]);}})[_0xda75('0x21')](respondWithStatusCode(_0x304459,null))['catch'](handleError(_0x304459,null));};exports[_0xda75('0x68')]=function(_0x55b34d,_0x3cf345,_0x24e709){if(_0x55b34d[_0xda75('0x59')]['id']){delete _0x55b34d[_0xda75('0x59')]['id'];}return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x55b34d[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x3cf345,null))[_0xda75('0x21')](function(_0x27a76d){if(_0x27a76d){_0x55b34d[_0xda75('0x59')][_0xda75('0x62')]=_0x27a76d['id'];return db[_0xda75('0x69')]['create'](_0x55b34d[_0xda75('0x59')]);}})[_0xda75('0x21')](respondWithResult(_0x3cf345,null))[_0xda75('0x2a')](handleError(_0x3cf345,null));};exports[_0xda75('0x6a')]=function(_0x5c44cd,_0x49e0d9,_0x4adc40){var _0x144e25={'raw':![],'where':{}};var _0x1c32b2={};var _0x504280={'count':0x0,'rows':[]};return db[_0xda75('0x3e')][_0xda75('0x6b')]({'where':{'id':_0x5c44cd['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x49e0d9,null))[_0xda75('0x21')](function(_0x45747b){if(_0x45747b){_0x1c32b2[_0xda75('0x43')]=_[_0xda75('0x45')](db['CannedAnswer'][_0xda75('0x3f')]);_0x1c32b2[_0xda75('0x44')]=_['keys'](_0x5c44cd[_0xda75('0x44')]);_0x1c32b2['filters']=_[_0xda75('0x47')](_0x1c32b2[_0xda75('0x43')],_0x1c32b2[_0xda75('0x44')]);_0x144e25[_0xda75('0x48')]=_['intersection'](_0x1c32b2[_0xda75('0x43')],qs['fields'](_0x5c44cd[_0xda75('0x44')][_0xda75('0x49')]));_0x144e25[_0xda75('0x48')]=_0x144e25['attributes']['length']?_0x144e25[_0xda75('0x48')]:_0x1c32b2['model'];if(!_0x5c44cd[_0xda75('0x44')]['hasOwnProperty'](_0xda75('0x6c'))){_0x144e25[_0xda75('0x31')]=qs[_0xda75('0x31')](_0x5c44cd[_0xda75('0x44')][_0xda75('0x31')]);_0x144e25[_0xda75('0x30')]=qs[_0xda75('0x30')](_0x5c44cd[_0xda75('0x44')][_0xda75('0x30')]);}_0x144e25[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x5c44cd['query'][_0xda75('0x4d')]);_0x144e25['where']=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x5c44cd['query'],_0x1c32b2[_0xda75('0x46')]));_0x144e25[_0xda75('0x50')][_0xda75('0x62')]=_0x45747b['id'];if(_0x5c44cd['query'][_0xda75('0x4f')]){_0x144e25[_0xda75('0x50')]=_[_0xda75('0x51')](_0x144e25[_0xda75('0x50')],{'$or':_[_0xda75('0x3d')](_0x144e25[_0xda75('0x48')],function(_0x2ad94e){var _0x716188={};_0x716188[_0x2ad94e]={'$like':'%'+_0x5c44cd['query'][_0xda75('0x4f')]+'%'};return _0x716188;})});}_0x144e25=_[_0xda75('0x51')]({},_0x144e25,_0x5c44cd['options']);return db[_0xda75('0x69')]['count']({'where':_0x144e25[_0xda75('0x50')]})[_0xda75('0x21')](function(_0x5d9a9a){_0x504280[_0xda75('0x2f')]=_0x5d9a9a;if(_0x5c44cd[_0xda75('0x44')]['includeAll']){_0x144e25[_0xda75('0x54')]=[{'all':!![]}];}return db[_0xda75('0x69')][_0xda75('0x65')](_0x144e25);})[_0xda75('0x21')](function(_0x1dfa0a){_0x504280[_0xda75('0x6d')]=_0x1dfa0a;return _0x504280;});}})[_0xda75('0x21')](respondWithFilteredResult(_0x49e0d9,_0x144e25))[_0xda75('0x2a')](handleError(_0x49e0d9,null));};exports[_0xda75('0x6e')]=function(_0x2e6cda,_0x13c246,_0x1770b8){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x2e6cda[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x13c246,null))[_0xda75('0x21')](function(_0x64002c){if(_0x64002c){return _0x64002c[_0xda75('0x6e')](_0x2e6cda[_0xda75('0x44')][_0xda75('0x67')]);}})[_0xda75('0x21')](respondWithStatusCode(_0x13c246,null))[_0xda75('0x2a')](handleError(_0x13c246,null));};exports[_0xda75('0x6f')]=function(_0x1cc79a,_0x480424,_0x92e65e){_0x1cc79a[_0xda75('0x59')]['sitepic']=_0x1cc79a[_0xda75('0x70')][_0xda75('0x71')];return db[_0xda75('0x3e')]['find']({'where':{'id':_0x1cc79a['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x480424,null))['then'](saveUpdates(_0x1cc79a['body'],null))['then'](respondWithResult(_0x480424,null))['catch'](handleError(_0x480424,null));};exports[_0xda75('0x72')]=function(_0x5471a3,_0x23315f,_0x6c9069){_0x5471a3[_0xda75('0x59')][_0xda75('0x73')]=_0x5471a3['file'][_0xda75('0x71')];return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x5471a3[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x23315f,null))[_0xda75('0x21')](saveUpdates(_0x5471a3[_0xda75('0x59')],null))[_0xda75('0x21')](respondWithResult(_0x23315f,null))[_0xda75('0x2a')](handleError(_0x23315f,null));};exports['addCustomerAvatar']=function(_0x3a9a77,_0x59dbe7,_0x4379d6){_0x3a9a77[_0xda75('0x59')][_0xda75('0x74')]=_0x3a9a77['file'][_0xda75('0x71')];return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x3a9a77[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x59dbe7,null))['then'](saveUpdates(_0x3a9a77[_0xda75('0x59')],null))[_0xda75('0x21')](respondWithResult(_0x59dbe7,null))['catch'](handleError(_0x59dbe7,null));};exports[_0xda75('0x75')]=function(_0x1128b6,_0x4ad9bb,_0x51a1fb){_0x1128b6[_0xda75('0x59')][_0xda75('0x76')]=_0x1128b6[_0xda75('0x70')]['filename'];return db['ChatWebsite'][_0xda75('0x57')]({'where':{'id':_0x1128b6['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x4ad9bb,null))['then'](saveUpdates(_0x1128b6[_0xda75('0x59')],null))[_0xda75('0x21')](respondWithResult(_0x4ad9bb,null))[_0xda75('0x2a')](handleError(_0x4ad9bb,null));};exports[_0xda75('0x77')]=function(_0x49d7e5,_0x293100,_0x175c51){var _0x165229=path[_0xda75('0x78')](config[_0xda75('0x79')],'server/files/images/logos/default_logo.svg');var _0x308608={'where':{'id':_0x49d7e5[_0xda75('0x55')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x73fd7e=![];return require(_0xda75('0x7a'))['getLicense']()[_0xda75('0x21')](function(_0xe95978){if(_0xe95978){_0x73fd7e=_0xe95978[_0xda75('0x7b')];}})['then'](function(){return db[_0xda75('0x3e')][_0xda75('0x57')](_0x308608);})[_0xda75('0x21')](handleEntityNotFound(_0x293100,null))[_0xda75('0x21')](function(_0x2250d5){if(_0x2250d5){if(!_[_0xda75('0x7c')](_0x2250d5[_0xda75('0x7d')])){if(fs[_0xda75('0x7e')](path['join'](config['root'],_0xda75('0x7f'),_0x2250d5['sitepic']))&&_0x73fd7e){_0x165229=path['join'](config[_0xda75('0x79')],_0xda75('0x7f'),_0x2250d5[_0xda75('0x7d')]);}}return _0x293100[_0xda75('0x80')](_0x165229);}})[_0xda75('0x2a')](handleError(_0x293100,null));};exports['getAvatar']=function(_0x3b3f0a,_0x3a7170,_0x32ff3f){var _0x495840=path['join'](config[_0xda75('0x79')],'server/files/images/avatars/default_avatar.png');var _0x8ce7be={'where':{'id':_0x3b3f0a['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xda75('0x57')](_0x8ce7be)[_0xda75('0x21')](handleEntityNotFound(_0x3a7170,null))['then'](function(_0x14aa78){if(_0x14aa78){if(!_[_0xda75('0x7c')](_0x14aa78[_0xda75('0x73')])){if(fs[_0xda75('0x7e')](path[_0xda75('0x78')](config[_0xda75('0x79')],'server/files/images/avatars/',_0x14aa78[_0xda75('0x73')]))){_0x495840=path[_0xda75('0x78')](config['root'],_0xda75('0x81'),_0x14aa78[_0xda75('0x73')]);}}return _0x3a7170['download'](_0x495840);}})[_0xda75('0x2a')](handleError(_0x3a7170,null));};exports['getCustomerAvatar']=function(_0x2514d3,_0xe9d752,_0x31cdda){var _0x1e4994=path['join'](config[_0xda75('0x79')],_0xda75('0x82'));var _0x559767={'where':{'id':_0x2514d3[_0xda75('0x55')]['id']},'attributes':['id',_0xda75('0x74'),_0xda75('0x83')],'raw':!![]};return db[_0xda75('0x3e')][_0xda75('0x57')](_0x559767)['then'](handleEntityNotFound(_0xe9d752,null))[_0xda75('0x21')](function(_0x3493f9){if(_0x3493f9){if(!_[_0xda75('0x7c')](_0x3493f9[_0xda75('0x74')])){if(fs['existsSync'](path['join'](config[_0xda75('0x79')],_0xda75('0x81'),_0x3493f9['customerAvatar']))&&_0x3493f9[_0xda75('0x83')]){_0x1e4994=path[_0xda75('0x78')](config[_0xda75('0x79')],_0xda75('0x81'),_0x3493f9[_0xda75('0x74')]);}}return _0xe9d752[_0xda75('0x80')](_0x1e4994);}})[_0xda75('0x2a')](handleError(_0xe9d752,null));};exports['getSystemAvatar']=function(_0x5c3c89,_0x5c3e34,_0x286c77){var _0xf66993=path[_0xda75('0x78')](config[_0xda75('0x79')],'server/files/images/avatars/system_avatar.png');var _0x185abd={'where':{'id':_0x5c3c89[_0xda75('0x55')]['id']},'attributes':['id',_0xda75('0x76')],'raw':!![]};return db[_0xda75('0x3e')][_0xda75('0x57')](_0x185abd)[_0xda75('0x21')](handleEntityNotFound(_0x5c3e34,null))[_0xda75('0x21')](function(_0x4dee58){if(_0x4dee58){if(!_['isNil'](_0x4dee58['systemAvatar'])){if(fs[_0xda75('0x7e')](path['join'](config['root'],_0xda75('0x81'),_0x4dee58[_0xda75('0x76')]))){_0xf66993=path[_0xda75('0x78')](config[_0xda75('0x79')],_0xda75('0x81'),_0x4dee58[_0xda75('0x76')]);}}return _0x5c3e34[_0xda75('0x80')](_0xf66993);}})['catch'](handleError(_0x5c3e34,null));};exports['notify']=function(_0x316196,_0x54936d,_0x115baf){var _0x24589c=require('user-agent-parser');var _0x54d74c=new _0x24589c();var _0x7e0802=_0x54d74c[_0xda75('0x84')](_0x316196[_0xda75('0x85')]['user-agent'])[_0xda75('0x86')]();var _0x47ee75={'body':_0x316196[_0xda75('0x59')],'channel':_0xda75('0x87')};var _0x77a8ec=[];var _0x1dcde4=[];var _0x56502b={};var _0x5dbdf0=![];return db[_0xda75('0x88')][_0xda75('0x60')]()['then'](function(_0x12e28f){if(!_0x12e28f){throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0x89'));}_0x77a8ec=_['difference'](_[_0xda75('0x45')](_0x12e28f),[_0xda75('0x8a'),_0xda75('0x8b')]);_0x1dcde4=_[_0xda75('0x8c')](_[_0xda75('0x45')](_0x12e28f),[_0xda75('0x8a'),_0xda75('0x8b'),_0xda75('0x8d'),_0xda75('0x8e')]);if(_0x316196[_0xda75('0x59')]['id']){delete _0x316196['body']['id'];}if(_[_0xda75('0x7c')](_0x316196[_0xda75('0x59')]['from'])){throw new db[(_0xda75('0x1f'))]['ValidationError'](_0xda75('0x8f'));}if(_[_0xda75('0x7c')](_0x316196['body'][_0xda75('0x59')])||_0x316196[_0xda75('0x59')][_0xda75('0x59')]===''){throw new db['Sequelize'][(_0xda75('0x20'))](_0xda75('0x90'));}if(_[_0xda75('0x7c')](_0x316196['body'][_0xda75('0x91')])){throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0x92')+_0x1dcde4);}if(!_[_0xda75('0x93')](_0x1dcde4,_0x316196['body'][_0xda75('0x91')])){throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0x94')+_0x1dcde4);}_0x56502b[_0x316196[_0xda75('0x59')][_0xda75('0x91')]]=_0x316196[_0xda75('0x59')]['from'];})[_0xda75('0x21')](function(){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x316196[_0xda75('0x55')]['id']},'include':[{'model':db[_0xda75('0x95')],'as':_0xda75('0x96'),'include':[{'model':db[_0xda75('0x88')],'as':_0xda75('0x97'),'where':_0x56502b,'limit':0x1,'order':[[_0xda75('0x8b'),_0xda75('0x98')]]}]},{'model':db[_0xda75('0x99')],'as':_0xda75('0x9a')}]});})[_0xda75('0x21')](handleEntityNotFound(_0x54936d,null))[_0xda75('0x21')](function(_0x173d33){if(_0x173d33&&_0x173d33[_0xda75('0x96')]){_0x47ee75[_0xda75('0x9b')]=_0x173d33;_0x47ee75[_0xda75('0x9c')]=_0x173d33[_0xda75('0x9a')];_0x47ee75[_0xda75('0x9d')]=_0x173d33['List'];_0x47ee75[_0xda75('0x9c')]=_[_0xda75('0x9e')](_0x47ee75['applications'],[_0xda75('0x9f')],[_0xda75('0xa0')]);if(_0x47ee75['account'][_0xda75('0x9a')]){delete _0x47ee75[_0xda75('0x9b')]['Applications'];}if(_0x47ee75['account'][_0xda75('0x96')]&&_0x47ee75[_0xda75('0x9b')][_0xda75('0x96')][_0xda75('0x97')]['length']){return _0x47ee75['account']['List'][_0xda75('0x97')][0x0];}var _0x2b1eac=_[_0xda75('0x18')](_0x316196['body'],{'firstName':_0x316196[_0xda75('0x59')]['from'],'ListId':_0x173d33[_0xda75('0x8e')]});_0x2b1eac[_0x316196[_0xda75('0x59')][_0xda75('0x91')]]=_0x316196[_0xda75('0x59')][_0xda75('0xa1')];return db[_0xda75('0x88')][_0xda75('0x58')](_0x2b1eac,{'fields':_0x77a8ec,'raw':!![]});}})[_0xda75('0x21')](handleEntityNotFound(_0x54936d,null))[_0xda75('0x21')](function(_0x39b9a0){_0x47ee75[_0xda75('0xa2')]=_0x39b9a0;var _0x2f2a1b=_0x316196['body'][_0xda75('0xa3')];if(_0x316196['headers'][_0xda75('0xa4')]){_0x2f2a1b=_0x316196[_0xda75('0x85')][_0xda75('0xa4')];}else if(_0x316196['headers']['x-forwarded-for']){_0x2f2a1b=_[_0xda75('0xa5')](_0x316196['headers'][_0xda75('0xa6')][_0xda75('0xa7')](','));}if(_0x39b9a0){var _0x5321c3={'ContactId':_0x39b9a0['id'],'ChatWebsiteId':_0x316196[_0xda75('0x55')]['id'],'from':(_0x39b9a0['firstName']||'')+'\x20'+(_0x39b9a0['lastName']||''),'customerIp':_0x2f2a1b,'customerPort':_0x316196['headers'][_0xda75('0xa8')]?_0x316196[_0xda75('0x85')]['x-real-port']:null,'referer':_0x316196[_0xda75('0x59')][_0xda75('0xa9')],'browserName':_0x7e0802[_0xda75('0xaa')][_0xda75('0x3a')]&&_0x7e0802[_0xda75('0xaa')][_0xda75('0xab')]?util[_0xda75('0xac')]('%s\x20%s',_0x7e0802['browser'][_0xda75('0x3a')],_0x7e0802[_0xda75('0xaa')][_0xda75('0xab')]):'unknown','browserVersion':_0x7e0802['browser'][_0xda75('0xab')]||_0xda75('0xad'),'osName':util['format'](_0xda75('0xae'),_0x7e0802['os'][_0xda75('0x3a')],_0x7e0802['os'][_0xda75('0xab')]),'osVersion':_0x7e0802['os'][_0xda75('0xab')],'deviceModel':_0x7e0802[_0xda75('0xaf')]['model']&&_0x7e0802[_0xda75('0xaf')]['vendor']?util[_0xda75('0xac')]('%s\x20%s\x20%s',_0x7e0802[_0xda75('0xaf')][_0xda75('0x43')],_0x7e0802[_0xda75('0xaf')][_0xda75('0xb0')],_0x7e0802[_0xda75('0xaf')][_0xda75('0x41')]):null,'deviceVendor':_0x7e0802[_0xda75('0xaf')][_0xda75('0xb0')],'deviceType':_0x7e0802[_0xda75('0xaf')][_0xda75('0x41')],'formData':JSON[_0xda75('0x26')](_0x316196[_0xda75('0x59')])};var _0x5890cd={'ChatWebsiteId':_0x316196[_0xda75('0x55')]['id'],'closed':![]};if(_0x316196[_0xda75('0x59')][_0xda75('0xb1')]){_0x5890cd[_0xda75('0xb1')]=_0x316196[_0xda75('0x59')]['threadId'];return db[_0xda75('0xb2')][_0xda75('0x57')]({'where':_0x5890cd})['then'](function(_0x98dafb){if(_0x98dafb){return[_0x98dafb,![]];}_0x5321c3['threadId']=_0x316196[_0xda75('0x59')]['threadId'];_0x5321c3[_0xda75('0xb3')]=_0x316196['body'][_0xda75('0xb3')];return db[_0xda75('0xb2')][_0xda75('0x58')](_0x5321c3)['then'](function(_0x1dd025){return[_0x1dd025,!![]];});});}_0x5890cd['ContactId']=_0x39b9a0['id'];if(_0x316196[_0xda75('0x59')][_0xda75('0xb4')]&&_0x316196[_0xda75('0x59')][_0xda75('0xb4')]['id']){_0x5890cd['id']=_0x316196[_0xda75('0x59')][_0xda75('0xb4')]['id'];return db[_0xda75('0xb2')][_0xda75('0x57')]({'where':_0x5890cd})['then'](function(_0x543fc5){if(_0x543fc5){return[_0x543fc5,![]];}return db['ChatInteraction'][_0xda75('0x58')](_0x5321c3)['then'](function(_0x11aa73){return[_0x11aa73,!![]];});});}return db[_0xda75('0xb2')][_0xda75('0x58')](_0x5321c3)[_0xda75('0x21')](function(_0x55f833){return[_0x55f833,!![]];});}})[_0xda75('0xb5')](function(_0x6d88a0,_0x259774){if(_0x6d88a0){_0x5dbdf0=_0x259774;if(!_0x259774){var _0x1fe6df={'from':(_0x47ee75['contact'][_0xda75('0xb6')]||'')+'\x20'+(_0x47ee75[_0xda75('0xa2')][_0xda75('0xb7')]||'')};if(_0x316196[_0xda75('0x59')][_0xda75('0xb1')]&&_0x316196[_0xda75('0x59')][_0xda75('0xb8')]&&_0x316196[_0xda75('0x59')][_0xda75('0xb1')]!=_0x316196[_0xda75('0x59')][_0xda75('0xb8')]){_0x1fe6df['threadId']=_0x316196['body']['messageId'];}return _0x6d88a0[_0xda75('0x5f')](_0x1fe6df);}else{return _0x6d88a0;}}})[_0xda75('0x21')](function(_0x39a560){_0x47ee75[_0xda75('0xb4')]=_0x39a560[_0xda75('0x37')]({'plain':!![]});_0x47ee75[_0xda75('0xb4')]['created']=_0x5dbdf0;if(_0x47ee75[_0xda75('0xb4')][_0xda75('0xb9')]){if(_0x47ee75[_0xda75('0x9b')]['autoclose']){_0x47ee75['applications'][_0xda75('0xba')]({'id':0x0,'priority':_0x47ee75['applications'][_0xda75('0x4a')]+0x1,'app':'close','appdata':_0xda75('0xbb'),'interval':'*,*,*,*'});}}return db[_0xda75('0xbc')][_0xda75('0x58')]({'body':_0x316196[_0xda75('0x59')][_0xda75('0x59')],'ChatWebsiteId':_0x316196[_0xda75('0x55')]['id'],'ChatInteractionId':_0x39a560['id'],'direction':'in','ContactId':_0x47ee75[_0xda75('0xa2')]['id'],'AttachmentId':_0x316196[_0xda75('0x59')][_0xda75('0xbd')]});})[_0xda75('0x21')](function(_0x564df6){_0x47ee75[_0xda75('0x28')]=_0x564df6;if(_0x47ee75[_0xda75('0xb4')][_0xda75('0xbe')]){return db[_0xda75('0xbf')][_0xda75('0x57')]({'attributes':['id',_0xda75('0x3a')],'where':{'id':_0x47ee75[_0xda75('0xb4')][_0xda75('0xbe')]}})[_0xda75('0x21')](function(_0x32eaa6){if(_0x32eaa6){_0x47ee75[_0xda75('0x9c')][_0xda75('0xc0')]({'id':0x0,'priority':0x0,'app':_0xda75('0xc1'),'appdata':_0x32eaa6['name']+','+(_0x47ee75['account'][_0xda75('0xc2')]||0xa),'interval':_0xda75('0xc3')});_0x47ee75[_0xda75('0xc4')]=!![];}return respondWithRpcPromise(_0xda75('0xc5'),_0xda75('0xc6'),_0x47ee75);});}return respondWithRpcPromise(_0xda75('0xc5'),_0xda75('0xc6'),_0x47ee75);})[_0xda75('0x21')](function(_0x3ab882){respondWithRpcPromise(_0xda75('0xc7'),_0xda75('0xc7'),{'event':_0xda75('0xc8'),'message':_0x3ab882},client9002);return _0x3ab882;})[_0xda75('0x21')](respondWithResult(_0x54936d,null))[_0xda75('0x2a')](handleError(_0x54936d,null));};exports[_0xda75('0xc9')]=function(_0x2e02a5,_0x392503,_0x35a5e8){var _0x43955e,_0x21e0c1,_0x505b54;var _0x49588e=[];var _0xbbf2c4=[];var _0x421496={};return db[_0xda75('0x88')][_0xda75('0x60')]()['then'](function(_0x266a20){if(!_0x266a20){throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0x89'));}_0xbbf2c4=_[_0xda75('0x8c')](_['keys'](_0x266a20),['createdAt',_0xda75('0x8b')]);_0x49588e=_[_0xda75('0x8c')](_[_0xda75('0x45')](_0x266a20),[_0xda75('0x8a'),_0xda75('0x8b'),_0xda75('0x8d'),'ListId']);if(_0x2e02a5[_0xda75('0x59')]['id']){delete _0x2e02a5[_0xda75('0x59')]['id'];}if(_['isNil'](_0x2e02a5['body'][_0xda75('0xa1')])){throw _0x392503['status'](0x1f4)[_0xda75('0xca')](new db['Sequelize'][(_0xda75('0x20'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x2e02a5[_0xda75('0x59')]['body'])||_0x2e02a5[_0xda75('0x59')][_0xda75('0x59')]===''){throw _0x392503['status'](0x1f4)['send'](new db[(_0xda75('0x1f'))][(_0xda75('0x20'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x2e02a5[_0xda75('0x59')]['mapKeyOffline'])){throw _0x392503[_0xda75('0x2c')](0x1f4)[_0xda75('0xca')](new db[(_0xda75('0x1f'))]['ValidationError'](_0xda75('0xcb')+_0x49588e));}if(!_['includes'](_0x49588e,_0x2e02a5[_0xda75('0x59')][_0xda75('0xcc')])){throw _0x392503['status'](0x1f4)[_0xda75('0xca')](new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0xcd')+_0x49588e));}_0x421496[_0x2e02a5[_0xda75('0x59')]['mapKeyOffline']]=_0x2e02a5['body'][_0xda75('0xa1')];})[_0xda75('0x21')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2e02a5[_0xda75('0x55')]['id']},'include':[{'model':db[_0xda75('0x95')],'as':_0xda75('0x96')}]});})[_0xda75('0x21')](handleEntityNotFound(_0x392503,null))[_0xda75('0x21')](function(_0x148902){if(_0x148902&&_0x148902['List']){_0x21e0c1=_0x148902;var _0x30ea82=_[_0xda75('0x18')](_0x2e02a5[_0xda75('0x59')],{'firstName':_0x2e02a5['body'][_0xda75('0xa1')],'phone':_0x2e02a5['body'][_0xda75('0xa1')],'ListId':_0x148902[_0xda75('0x8e')]});_0x30ea82[_0x2e02a5[_0xda75('0x59')][_0xda75('0xcc')]]=_0x2e02a5[_0xda75('0x59')][_0xda75('0xa1')];return db[_0xda75('0x88')]['findOrCreate']({'where':_0x421496,'defaults':_0x30ea82});}})[_0xda75('0xb5')](function(_0x2ed32b){if(_0x2ed32b){_0x505b54=_0x2ed32b;var _0x2f3dfc=fs[_0xda75('0xce')](path[_0xda75('0x78')](config[_0xda75('0x79')],_0xda75('0xcf')),_0xda75('0xd0'));var _0x44bcdd=ejs[_0xda75('0xd1')](_0x2f3dfc,{'body':_[_0xda75('0xd2')](_0x2e02a5[_0xda75('0x59')][_0xda75('0x59')]),'bodyTitle':_0x21e0c1['offlineMessageBody']});return db[_0xda75('0xd3')]['create']({'body':_0x44bcdd,'ContactId':_0x2ed32b['id'],'ChatWebsiteId':_0x21e0c1['id']});}})['then'](function(_0x54cfcb){if(_0x54cfcb){_0x43955e=_0x54cfcb;return db[_0xda75('0xd4')][_0xda75('0x6b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xda75('0xd5'),'raw':!![]}]});}})[_0xda75('0x21')](function(_0x37e61b){if(_0x37e61b&&_0x37e61b[_0xda75('0xd5')]&&_0x21e0c1['forwardOfflineAddress']){var _0x410a8b={'tls':{'rejectUnauthorized':![]}};if(_0x37e61b[_0xda75('0xd5')][_0xda75('0xd6')]){_0x410a8b[_0xda75('0xd6')]=_0x37e61b[_0xda75('0xd5')][_0xda75('0xd6')];}else{_0x410a8b[_0xda75('0xd7')]=_0x37e61b[_0xda75('0xd5')][_0xda75('0xd7')];_0x410a8b[_0xda75('0xd8')]=_0x37e61b['Smtp'][_0xda75('0xd8')];_0x410a8b[_0xda75('0xd9')]=_0x37e61b[_0xda75('0xd5')][_0xda75('0xd9')];}if(_0x37e61b[_0xda75('0xd5')]['authentication']){_0x410a8b[_0xda75('0xda')]={'user':_0x37e61b[_0xda75('0xd5')][_0xda75('0x5b')],'pass':_0x37e61b[_0xda75('0xd5')][_0xda75('0xdb')]};}return respondWithRpcPromise(_0xda75('0xdc'),'sendMail',{'account':_0x410a8b,'message':{'from':util[_0xda75('0xac')](_0xda75('0xdd'),_0x37e61b[_0xda75('0x3a')],_0x37e61b[_0xda75('0xde')]||_0x37e61b[_0xda75('0xd5')][_0xda75('0x5b')]),'to':_0x21e0c1[_0xda75('0xdf')],'subject':_0x21e0c1[_0xda75('0xe0')],'text':_0x43955e[_0xda75('0x59')]}},client9003)[_0xda75('0x21')](function(){return _0x43955e;})[_0xda75('0x2a')](function(_0x466926){console[_0xda75('0x27')](_0x466926);});}})['then'](function(){if(_0x43955e){return _0x43955e;}})[_0xda75('0x21')](respondWithResult(_0x392503,null))[_0xda75('0x2a')](handleError(_0x392503,null));};exports[_0xda75('0xe1')]=function(_0x2aef09,_0x1d2280,_0x3a5c0c){return db[_0xda75('0xb2')]['find']({'where':{'id':_0x2aef09['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x1d2280,null))['then'](function(_0x14b7cc){if(_0x14b7cc){return _0x14b7cc['addInteraction'](_0x2aef09[_0xda75('0x59')][_0xda75('0x67')],_['omit'](_0x2aef09[_0xda75('0x59')],[_0xda75('0x67'),'id'])||{});}})[_0xda75('0x21')](respondWithResult(_0x1d2280,null))[_0xda75('0x2a')](handleError(_0x1d2280,null));};exports[_0xda75('0xe2')]=function(_0x42598d,_0x3dab25,_0x583aa9){var _0x1c1759={'raw':![],'where':{}};var _0x4224ee={};var _0x4597ef={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x42598d[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x3dab25,null))['then'](function(_0x2ffd16){if(_0x2ffd16){_0x4224ee[_0xda75('0x43')]=_['keys'](db[_0xda75('0xb2')]['rawAttributes']);_0x4224ee[_0xda75('0x44')]=_['keys'](_0x42598d['query']);_0x4224ee['filters']=_[_0xda75('0x47')](_0x4224ee[_0xda75('0x43')],_0x4224ee[_0xda75('0x44')]);_0x1c1759[_0xda75('0x48')]=_[_0xda75('0x47')](_0x4224ee[_0xda75('0x43')],qs[_0xda75('0x49')](_0x42598d[_0xda75('0x44')]['fields']));_0x1c1759[_0xda75('0x48')]=_0x1c1759[_0xda75('0x48')][_0xda75('0x4a')]?_0x1c1759[_0xda75('0x48')]:_0x4224ee['model'];if(!_0x42598d[_0xda75('0x44')][_0xda75('0x4b')](_0xda75('0x6c'))){_0x1c1759[_0xda75('0x31')]=qs['limit'](_0x42598d['query']['limit']);_0x1c1759[_0xda75('0x30')]=qs['offset'](_0x42598d['query']['offset']);}_0x1c1759['order']=qs[_0xda75('0x4d')](_0x42598d['query'][_0xda75('0x4d')]);_0x1c1759['where']=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x42598d[_0xda75('0x44')],_0x4224ee[_0xda75('0x46')]));_0x1c1759[_0xda75('0x50')]['ChatWebsiteId']=_0x2ffd16['id'];if(_0x42598d[_0xda75('0x44')][_0xda75('0x4f')]){_0x1c1759[_0xda75('0x50')]=_[_0xda75('0x51')](_0x1c1759['where'],{'$or':_['map'](_0x1c1759['attributes'],function(_0x3ad2c0){var _0x228987={};_0x228987[_0x3ad2c0]={'$like':'%'+_0x42598d[_0xda75('0x44')][_0xda75('0x4f')]+'%'};return _0x228987;})});}_0x1c1759=_[_0xda75('0x51')]({},_0x1c1759,_0x42598d['options']);return db['ChatInteraction'][_0xda75('0x2f')]({'where':_0x1c1759['where']})[_0xda75('0x21')](function(_0x5f3967){_0x4597ef[_0xda75('0x2f')]=_0x5f3967;if(_0x42598d[_0xda75('0x44')]['includeAll']){_0x1c1759['include']=[{'model':db['CmContact'],'as':_0xda75('0xe3'),'required':![]},{'model':db[_0xda75('0xbf')],'as':_0xda75('0xe4'),'attributes':[_0xda75('0x3a'),_0xda75('0xe5'),_0xda75('0xe6')],'required':![]},{'model':db['Tag'],'as':_0xda75('0xe7'),'attributes':['id',_0xda75('0x3a'),_0xda75('0xe8')],'where':_0x42598d[_0xda75('0x44')][_0xda75('0xe9')]?{'id':_0x42598d[_0xda75('0x44')][_0xda75('0xe9')]}:undefined,'required':_0x42598d['query'][_0xda75('0xe9')]?!![]:![]}];}return db[_0xda75('0xb2')]['findAll'](_0x1c1759);})[_0xda75('0x21')](function(_0x34884a){_0x4597ef['rows']=_0x34884a;return _0x4597ef;});}})[_0xda75('0x21')](respondWithFilteredResult(_0x3dab25,_0x1c1759))['catch'](handleError(_0x3dab25,null));};function iftimePromise(_0x391360,_0x25b49b){return respondWithRpcPromise('Command',_0xda75('0xea'),{'command':_0x25b49b['timezone']?util[_0xda75('0xac')](_0xda75('0xeb'),_0x391360[_0xda75('0xec')],_0x25b49b[_0xda75('0xed')]):util[_0xda75('0xac')](_0xda75('0xee'),_0x391360[_0xda75('0xec')])},client9002)[_0xda75('0x21')](function(_0x4e8ceb){var _0x20a407=_0x4e8ceb&&_0x4e8ceb[_0xda75('0xef')](_0xda75('0xf0'))>=0x0?!![]:![];logger[_0xda75('0x22')](_0xda75('0xf1'),_0x25b49b['id'],_0x391360['id'],_0x391360[_0xda75('0xec')],_0x20a407?_0xda75('0xf2'):'OFFLINE',_0x25b49b[_0xda75('0xed')]?_0x25b49b[_0xda75('0xed')]:_0xda75('0xf3'));return _0x20a407;})[_0xda75('0x2a')](function(_0x48ea89){logger[_0xda75('0x27')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x25b49b['id'],_0x391360['id'],_0x391360[_0xda75('0xec')],util[_0xda75('0xf4')](_0x48ea89,{'showHidden':![],'depth':null}),_0x25b49b['timezone']?_0x25b49b[_0xda75('0xed')]:_0xda75('0xf3'));return![];});}exports[_0xda75('0xea')]=function(_0x59c53d,_0x32a057,_0x1097d1){var _0x5cbc2c=0x0;var _0x399906=0x0;var _0x9f9b50=![];var _0x309295;var _0x412e3e;return db[_0xda75('0x3e')]['find']({'where':{'id':_0x59c53d[_0xda75('0x55')]['id']},'include':[{'model':db[_0xda75('0xf5')],'as':_0xda75('0xf5'),'include':[{'model':db[_0xda75('0xf5')],'as':_0xda75('0xf6'),'attributes':['id',_0xda75('0xec')],'raw':!![]}]}]})[_0xda75('0x21')](handleEntityNotFound(_0x32a057,null))[_0xda75('0x21')](function(_0x47f21c){if(_0x47f21c){_0x309295=_0x47f21c;return _0x47f21c[_0xda75('0xf7')]({'raw':!![]});}})['then'](function(_0x32c2c4){if(_0x309295){if(_0x32c2c4){_0x412e3e=_0x32c2c4;}}return require(_0xda75('0x7a'))[_0xda75('0xf8')]();})[_0xda75('0x21')](function(_0x4f0555){if(_0x4f0555){_0x399906=_0x4f0555[_0xda75('0xf9')];_0x9f9b50=_0x4f0555[_0xda75('0x7b')];}})[_0xda75('0x21')](function(){return db[_0xda75('0xb2')][_0xda75('0x2f')]({'where':{'closed':![]}});})[_0xda75('0x21')](function(_0x4819dd){_0x5cbc2c=_0x4819dd;if(_0x399906&&_0x4819dd>_0x399906){return db[_0xda75('0xfa')]['findOne']({'where':{'id':0x1}})['then'](function(_0x3454ee){if(_0x3454ee){_0x3454ee[_0xda75('0xfb')]('chatLicenseExceeded');}});}})[_0xda75('0x21')](function(){if(_0x309295[_0xda75('0xf5')]&&_0x309295['Interval'][_0xda75('0xf6')]){var _0x7ad3f0=[];for(var _0x299969=0x0;_0x299969<_0x309295[_0xda75('0xf5')][_0xda75('0xf6')][_0xda75('0x4a')];_0x299969++){var _0x30005d=_0x309295['Interval'][_0xda75('0xf6')][_0x299969][_0xda75('0x37')]({'plain':!![]});_0x7ad3f0['push'](iftimePromise(_0x30005d,_0x309295));}return BPromise['all'](_0x7ad3f0)['then'](function(_0x3c3c1c){return _[_0xda75('0xfc')](_0x3c3c1c);});}else{return!![];}})['then'](function(_0x6de896){var _0x223c1b=fs[_0xda75('0xce')](path[_0xda75('0x78')](config[_0xda75('0x79')],_0xda75('0xfd')),_0xda75('0xd0'));var _0x588464={'remote':_0x309295['remote'],'query':querystring[_0xda75('0x26')](_['merge'](_0x309295[_0xda75('0x37')]({'plain':!![]}),{'customerIp':_0x59c53d[_0xda75('0x85')]['x-forwarded-for']||_0x59c53d[_0xda75('0x85')][_0xda75('0xfe')]||_0x59c53d[_0xda75('0xff')]['remoteAddress']||_0x59c53d['ip'],'referer':_0x59c53d['headers'][_0xda75('0xa9')],'openedInteractions':_0x5cbc2c,'maxInteractions':_0x399906,'virtual':_0x9f9b50['virtual'],'online':_0x6de896,'custom':_0x9f9b50}))['replace'](/'/g,'\x5c\x27')};_0x32a057['send'](ejs[_0xda75('0xd1')](Mustache[_0xda75('0xd1')](_0x223c1b,_0x588464),{'proactiveActions':_0x412e3e,'alignment':_0x309295[_0xda75('0x100')],'verticalAlignment':_0x309295[_0xda75('0x101')],'div_color':_0x309295['color'],'text_color':_0x309295['textColor']}));})[_0xda75('0x2a')](handleError(_0x32a057,null));};exports['addApplications']=function(_0x4585b0,_0x591ae7,_0x1ba8e2){return db[_0xda75('0x3e')][_0xda75('0x6b')]({'where':{'id':_0x4585b0[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x591ae7,null))[_0xda75('0x21')](function(_0x16548c){if(_0x16548c){return db[_0xda75('0x102')][_0xda75('0x103')](function(_0xde2c63){return db[_0xda75('0x99')][_0xda75('0x36')]({'where':{'ChatWebsiteId':_0x4585b0[_0xda75('0x55')]['id']},'transaction':_0xde2c63})[_0xda75('0x21')](function(_0x1e60d5){var _0x29bc32=_['map'](_0x4585b0['body'],function(_0x3f2b1c){_0x3f2b1c['ChatWebsiteId']=_0x4585b0[_0xda75('0x55')]['id'];return _0x3f2b1c;});return db[_0xda75('0x99')]['bulkCreate'](_0x29bc32,{'transaction':_0xde2c63});});})[_0xda75('0x21')](function(){return db[_0xda75('0x99')][_0xda75('0x104')]({'where':{'ChatWebsiteId':_0x4585b0[_0xda75('0x55')]['id']},'order':_0xda75('0x9f')});});}})[_0xda75('0x21')](respondWithResult(_0x591ae7,null))[_0xda75('0x2a')](handleError(_0x591ae7,null));};exports['getApplications']=function(_0x4a5913,_0x399dfe,_0x2dec9a){var _0xb73ee1={};var _0x26e855={};var _0x2a96ae;var _0x1a24cb;return db['ChatWebsite']['findOne']({'where':{'id':_0x4a5913[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x399dfe,null))['then'](function(_0xc8c6f){if(_0xc8c6f){_0x2a96ae=_0xc8c6f;_0x26e855[_0xda75('0x43')]=_['keys'](db[_0xda75('0x99')][_0xda75('0x3f')]);_0x26e855[_0xda75('0x44')]=_[_0xda75('0x45')](_0x4a5913[_0xda75('0x44')]);_0x26e855['filters']=_[_0xda75('0x47')](_0x26e855[_0xda75('0x43')],_0x26e855['query']);_0xb73ee1[_0xda75('0x48')]=_[_0xda75('0x47')](_0x26e855[_0xda75('0x43')],qs['fields'](_0x4a5913[_0xda75('0x44')]['fields']));_0xb73ee1[_0xda75('0x48')]=_0xb73ee1[_0xda75('0x48')]['length']?_0xb73ee1[_0xda75('0x48')]:_0x26e855[_0xda75('0x43')];_0xb73ee1[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x4a5913[_0xda75('0x44')][_0xda75('0x4d')]);_0xb73ee1['where']=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x4a5913[_0xda75('0x44')],_0x26e855[_0xda75('0x46')]));if(_0x4a5913[_0xda75('0x44')][_0xda75('0x4f')]){_0xb73ee1['where']=_['merge'](_0xb73ee1[_0xda75('0x50')],{'$or':_['map'](_0xb73ee1[_0xda75('0x48')],function(_0x226dd4){var _0x147cd8={};_0x147cd8[_0x226dd4]={'$like':'%'+_0x4a5913['query']['filter']+'%'};return _0x147cd8;})});}_0xb73ee1=_[_0xda75('0x51')]({},_0xb73ee1,_0x4a5913[_0xda75('0x56')]);return _0x2a96ae[_0xda75('0x105')](_0xb73ee1);}})[_0xda75('0x21')](function(_0x1b0633){if(_0x1b0633){_0x1a24cb=_0x1b0633[_0xda75('0x4a')];if(!_0x4a5913[_0xda75('0x44')][_0xda75('0x4b')](_0xda75('0x6c'))){_0xb73ee1[_0xda75('0x31')]=qs[_0xda75('0x31')](_0x4a5913[_0xda75('0x44')][_0xda75('0x31')]);_0xb73ee1[_0xda75('0x30')]=qs[_0xda75('0x30')](_0x4a5913[_0xda75('0x44')]['offset']);}return _0x2a96ae[_0xda75('0x105')](_0xb73ee1);}})[_0xda75('0x21')](function(_0x57e669){if(_0x57e669){return _0x57e669?{'count':_0x1a24cb,'rows':_0x57e669}:null;}})[_0xda75('0x21')](respondWithResult(_0x399dfe,null))[_0xda75('0x2a')](handleError(_0x399dfe,null));};exports[_0xda75('0x106')]=function(_0x5291c5,_0x3cbc3f,_0x14caa0){return db[_0xda75('0x107')]['find']({'where':{'id':_0x5291c5[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x3cbc3f,null))[_0xda75('0x21')](function(_0x3a1fd1){if(_0x3a1fd1){return _0x3a1fd1['addProactiveActions'](_0x5291c5[_0xda75('0x59')][_0xda75('0x67')],_[_0xda75('0x108')](_0x5291c5[_0xda75('0x59')],[_0xda75('0x67'),'id'])||{});}})[_0xda75('0x21')](respondWithResult(_0x3cbc3f,null))[_0xda75('0x2a')](handleError(_0x3cbc3f,null));};exports[_0xda75('0xf7')]=function(_0x3ea66e,_0x527881,_0x47c703){var _0x12af7f={};var _0x2cae4d={};var _0x976df7;var _0x43c830;return db[_0xda75('0x3e')][_0xda75('0x6b')]({'where':{'id':_0x3ea66e[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x527881,null))[_0xda75('0x21')](function(_0x4543ed){if(_0x4543ed){_0x976df7=_0x4543ed;_0x2cae4d['model']=_[_0xda75('0x45')](db[_0xda75('0x109')][_0xda75('0x3f')]);_0x2cae4d[_0xda75('0x44')]=_[_0xda75('0x45')](_0x3ea66e['query']);_0x2cae4d[_0xda75('0x46')]=_[_0xda75('0x47')](_0x2cae4d[_0xda75('0x43')],_0x2cae4d['query']);_0x12af7f[_0xda75('0x48')]=_[_0xda75('0x47')](_0x2cae4d[_0xda75('0x43')],qs['fields'](_0x3ea66e[_0xda75('0x44')][_0xda75('0x49')]));_0x12af7f['attributes']=_0x12af7f[_0xda75('0x48')][_0xda75('0x4a')]?_0x12af7f['attributes']:_0x2cae4d[_0xda75('0x43')];_0x12af7f[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x3ea66e[_0xda75('0x44')]['sort']);_0x12af7f[_0xda75('0x50')]=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x3ea66e[_0xda75('0x44')],_0x2cae4d[_0xda75('0x46')]));if(_0x3ea66e[_0xda75('0x44')][_0xda75('0x4f')]){_0x12af7f['where']=_[_0xda75('0x51')](_0x12af7f[_0xda75('0x50')],{'$or':_[_0xda75('0x3d')](_0x12af7f['attributes'],function(_0x4b1c3c){var _0x278ab6={};_0x278ab6[_0x4b1c3c]={'$like':'%'+_0x3ea66e[_0xda75('0x44')][_0xda75('0x4f')]+'%'};return _0x278ab6;})});}_0x12af7f=_[_0xda75('0x51')]({},_0x12af7f,_0x3ea66e[_0xda75('0x56')]);return _0x976df7[_0xda75('0xf7')](_0x12af7f);}})[_0xda75('0x21')](function(_0x312b38){if(_0x312b38){_0x43c830=_0x312b38[_0xda75('0x4a')];if(!_0x3ea66e[_0xda75('0x44')][_0xda75('0x4b')](_0xda75('0x6c'))){_0x12af7f[_0xda75('0x31')]=qs[_0xda75('0x31')](_0x3ea66e[_0xda75('0x44')]['limit']);_0x12af7f[_0xda75('0x30')]=qs['offset'](_0x3ea66e['query'][_0xda75('0x30')]);}return _0x976df7[_0xda75('0xf7')](_0x12af7f);}})[_0xda75('0x21')](function(_0x309044){if(_0x309044){return _0x309044?{'count':_0x43c830,'rows':_0x309044}:null;}})[_0xda75('0x21')](respondWithResult(_0x527881,null))[_0xda75('0x2a')](handleError(_0x527881,null));};exports['getFields']=function(_0x5c5010,_0x170687,_0x58f992){var _0xba5824=_0x5c5010[_0xda75('0x44')][_0xda75('0x10a')]===_0xda75('0x10b')?_0xda75('0x10c'):_0xda75('0x10d');return db[_0xda75('0x3e')][_0xda75('0x57')]({'attributes':['id',_0xba5824],'where':{'id':_0x5c5010[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x170687,null))[_0xda75('0x21')](function(_0x4a2a2b){if(_0x4a2a2b){var _0x504f2e=_0x4a2a2b[_0xba5824];var _0x436370=_0x504f2e&&_0x504f2e[_0xda75('0x10e')]?_0x504f2e[_0xda75('0x10e')]:[];_0x170687['send']({'fromKey':_['isNil'](_0x504f2e['fromKey'])?undefined:_0x504f2e['fromKey'],'count':_0x436370[_0xda75('0x4a')],'rows':_0x436370});}})[_0xda75('0x2a')](handleError(_0x170687,null));};exports[_0xda75('0x10f')]=function(_0x1bf487,_0x47ff26,_0x249de1){var _0x2e555f={'raw':![],'where':{}};var _0x55d2d6={};var _0x3419dc={'count':0x0,'rows':[]};return db[_0xda75('0x3e')][_0xda75('0x6b')]({'where':{'id':_0x1bf487[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x47ff26,null))[_0xda75('0x21')](function(_0x164196){if(_0x164196){_0x55d2d6[_0xda75('0x43')]=_[_0xda75('0x45')](db[_0xda75('0xd3')]['rawAttributes']);_0x55d2d6[_0xda75('0x44')]=_['keys'](_0x1bf487['query']);_0x55d2d6[_0xda75('0x46')]=_[_0xda75('0x47')](_0x55d2d6[_0xda75('0x43')],_0x55d2d6[_0xda75('0x44')]);_0x2e555f[_0xda75('0x48')]=_[_0xda75('0x47')](_0x55d2d6['model'],qs[_0xda75('0x49')](_0x1bf487[_0xda75('0x44')][_0xda75('0x49')]));_0x2e555f[_0xda75('0x48')]=_0x2e555f[_0xda75('0x48')][_0xda75('0x4a')]?_0x2e555f[_0xda75('0x48')]:_0x55d2d6[_0xda75('0x43')];if(!_0x1bf487[_0xda75('0x44')][_0xda75('0x4b')](_0xda75('0x6c'))){_0x2e555f[_0xda75('0x31')]=qs['limit'](_0x1bf487['query'][_0xda75('0x31')]);_0x2e555f[_0xda75('0x30')]=qs['offset'](_0x1bf487[_0xda75('0x44')][_0xda75('0x30')]);}_0x2e555f[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x1bf487[_0xda75('0x44')][_0xda75('0x4d')]);_0x2e555f[_0xda75('0x50')]=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x1bf487['query'],_0x55d2d6['filters']));_0x2e555f[_0xda75('0x50')][_0xda75('0x62')]=_0x164196['id'];if(_0x1bf487['query'][_0xda75('0x4f')]){_0x2e555f['where']=_[_0xda75('0x51')](_0x2e555f['where'],{'$or':_['map'](_0x2e555f['attributes'],function(_0x5dc194){var _0xc527e7={};_0xc527e7[_0x5dc194]={'$like':'%'+_0x1bf487[_0xda75('0x44')]['filter']+'%'};return _0xc527e7;})});}_0x2e555f=_[_0xda75('0x51')]({},_0x2e555f,_0x1bf487[_0xda75('0x56')]);return db[_0xda75('0xd3')][_0xda75('0x2f')]({'where':_0x2e555f[_0xda75('0x50')]})[_0xda75('0x21')](function(_0x47a001){_0x3419dc[_0xda75('0x2f')]=_0x47a001;if(_0x1bf487[_0xda75('0x44')][_0xda75('0x53')]){_0x2e555f['include']=[{'all':!![]}];}else{_0x2e555f[_0xda75('0x54')]=[{'model':db[_0xda75('0x88')],'as':_0xda75('0xe3'),'required':![]}];}return db['ChatOfflineMessage'][_0xda75('0x65')](_0x2e555f);})['then'](function(_0x28d446){_0x3419dc[_0xda75('0x6d')]=_0x28d446;return _0x3419dc;});}})[_0xda75('0x21')](respondWithFilteredResult(_0x47ff26,_0x2e555f))['catch'](handleError(_0x47ff26,null));};exports['addAgents']=function(_0x1e3ae9,_0xacffed,_0x25924f){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x1e3ae9[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0xacffed,null))['then'](function(_0x2e4ab8){if(_0x2e4ab8){return _0x2e4ab8[_0xda75('0x110')](_0x1e3ae9['body']['ids'],_[_0xda75('0x108')](_0x1e3ae9[_0xda75('0x59')],[_0xda75('0x67'),'id'])||{})[_0xda75('0xb5')](function(_0xfc1ba8){for(var _0x2abc19=0x0;_0x2abc19<_0x1e3ae9[_0xda75('0x59')]['ids']['length'];_0x2abc19+=0x1){socket[_0xda75('0x111')](_0xda75('0x112'),{'UserId':_0x1e3ae9[_0xda75('0x59')][_0xda75('0x67')][_0x2abc19],'ChatWebsiteId':_0x1e3ae9[_0xda75('0x55')]['id']});}return _0xfc1ba8;});}})[_0xda75('0x21')](respondWithResult(_0xacffed,null))['catch'](handleError(_0xacffed,null));};exports[_0xda75('0x113')]=function(_0x225f7e,_0x8639e9,_0x4d2f0b){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x225f7e[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x8639e9,null))[_0xda75('0x21')](function(_0x20f594){if(_0x20f594){return _0x20f594[_0xda75('0x113')](_0x225f7e['query'][_0xda75('0x67')])['then'](function(){if(_[_0xda75('0x114')](_0x225f7e[_0xda75('0x44')][_0xda75('0x67')])){for(var _0x4b2343=0x0;_0x4b2343<_0x225f7e[_0xda75('0x44')][_0xda75('0x67')][_0xda75('0x4a')];_0x4b2343+=0x1){socket[_0xda75('0x111')](_0xda75('0x115'),{'UserId':Number(_0x225f7e[_0xda75('0x44')][_0xda75('0x67')][_0x4b2343]),'ChatWebsiteId':Number(_0x225f7e['params']['id'])});}}else{socket[_0xda75('0x111')](_0xda75('0x115'),{'UserId':Number(_0x225f7e[_0xda75('0x44')][_0xda75('0x67')]),'ChatWebsiteId':Number(_0x225f7e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x8639e9,null))[_0xda75('0x2a')](handleError(_0x8639e9,null));};exports['getAgents']=function(_0x212658,_0x3595d,_0x6d7a32){var _0x3e64f6={};var _0x20dbc1={};var _0x450e24;var _0x1ff749;return db[_0xda75('0x3e')]['findOne']({'where':{'id':_0x212658[_0xda75('0x55')]['id']}})['then'](handleEntityNotFound(_0x3595d,null))[_0xda75('0x21')](function(_0x47395f){if(_0x47395f){_0x450e24=_0x47395f;_0x20dbc1['model']=_[_0xda75('0x45')](db[_0xda75('0xbf')][_0xda75('0x3f')]);_0x20dbc1['query']=_['keys'](_0x212658['query']);_0x20dbc1['filters']=_[_0xda75('0x47')](_0x20dbc1[_0xda75('0x43')],_0x20dbc1[_0xda75('0x44')]);_0x3e64f6[_0xda75('0x48')]=_[_0xda75('0x47')](_0x20dbc1['model'],qs[_0xda75('0x49')](_0x212658[_0xda75('0x44')]['fields']));_0x3e64f6['attributes']=_0x3e64f6[_0xda75('0x48')][_0xda75('0x4a')]?_0x3e64f6[_0xda75('0x48')]:_0x20dbc1[_0xda75('0x43')];_0x3e64f6[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x212658[_0xda75('0x44')][_0xda75('0x4d')]);_0x3e64f6[_0xda75('0x50')]=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x212658[_0xda75('0x44')],_0x20dbc1[_0xda75('0x46')]));if(_0x212658[_0xda75('0x44')][_0xda75('0x4f')]){_0x3e64f6['where']=_[_0xda75('0x51')](_0x3e64f6['where'],{'$or':_[_0xda75('0x3d')](_0x3e64f6[_0xda75('0x48')],function(_0x3a1f0e){var _0x5e705c={};_0x5e705c[_0x3a1f0e]={'$like':'%'+_0x212658['query'][_0xda75('0x4f')]+'%'};return _0x5e705c;})});}_0x3e64f6=_['merge']({},_0x3e64f6,_0x212658[_0xda75('0x56')]);return _0x450e24['getAgents'](_0x3e64f6);}})[_0xda75('0x21')](function(_0x316f13){if(_0x316f13){_0x1ff749=_0x316f13[_0xda75('0x4a')];if(!_0x212658[_0xda75('0x44')]['hasOwnProperty'](_0xda75('0x6c'))){_0x3e64f6[_0xda75('0x31')]=qs[_0xda75('0x31')](_0x212658[_0xda75('0x44')]['limit']);_0x3e64f6['offset']=qs['offset'](_0x212658['query'][_0xda75('0x30')]);}return _0x450e24[_0xda75('0x116')](_0x3e64f6);}})['then'](function(_0x51a131){if(_0x51a131){return _0x51a131?{'count':_0x1ff749,'rows':_0x51a131}:null;}})[_0xda75('0x21')](respondWithResult(_0x3595d,null))[_0xda75('0x2a')](handleError(_0x3595d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ae8e4c6..b5889c1 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 _0x15a9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove'];(function(_0x1e2a32,_0x49a001){var _0x4aba08=function(_0x181df3){while(--_0x181df3){_0x1e2a32['push'](_0x1e2a32['shift']());}};_0x4aba08(++_0x49a001);}(_0x15a9,0x18a));var _0x915a=function(_0x500386,_0xec060b){_0x500386=_0x500386-0x0;var _0x37748d=_0x15a9[_0x500386];return _0x37748d;};'use strict';var EventEmitter=require(_0x915a('0x0'));var ChatWebsite=require(_0x915a('0x1'))['db'][_0x915a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x915a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x915a('0x4'),'afterDestroy':_0x915a('0x5')};function emitEvent(_0x310621){return function(_0x186578,_0x4607a4,_0x351141){ChatWebsiteEvents[_0x915a('0x6')](_0x310621+':'+_0x186578['id'],_0x186578);ChatWebsiteEvents[_0x915a('0x6')](_0x310621,_0x186578);_0x351141(null);};}for(var e in events){if(events[_0x915a('0x7')](e)){var event=events[e];ChatWebsite[_0x915a('0x8')](e,emitEvent(event));}}module[_0x915a('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xcac6=['hasOwnProperty','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','emit'];(function(_0x363050,_0x96f799){var _0x1dd5c5=function(_0x3e9ffe){while(--_0x3e9ffe){_0x363050['push'](_0x363050['shift']());}};_0x1dd5c5(++_0x96f799);}(_0xcac6,0xa3));var _0x6cac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcac6[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x6cac('0x0'))['db'][_0x6cac('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6cac('0x2')](0x0);var events={'afterCreate':_0x6cac('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2c3014){return function(_0x431603,_0x2810e7,_0x123b3b){ChatWebsiteEvents[_0x6cac('0x4')](_0x2c3014+':'+_0x431603['id'],_0x431603);ChatWebsiteEvents[_0x6cac('0x4')](_0x2c3014,_0x431603);_0x123b3b(null);};}for(var e in events){if(events[_0x6cac('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x6cac('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index a128d64..cdd9f02 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 _0xf0cc=['./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','api','request-promise','path'];(function(_0x608459,_0x47590c){var _0x498929=function(_0x40bf9c){while(--_0x40bf9c){_0x608459['push'](_0x608459['shift']());}};_0x498929(++_0x47590c);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x41b92f,_0xf6a8e7){_0x41b92f=_0x41b92f-0x0;var _0x5e62c4=_0xf0cc[_0x41b92f];return _0x5e62c4;};'use strict';var _=require(_0xcf0c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf0c('0x2'));var fs=require('fs');var path=require(_0xcf0c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf0c('0x4'));module[_0xcf0c('0x5')]=function(_0x1a6003,_0x497363){return _0x1a6003[_0xcf0c('0x6')](_0xcf0c('0x7'),attributes,{'tableName':_0xcf0c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d02=['lodash','../../config/logger','moment','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites'];(function(_0x2594d6,_0x5aaac1){var _0x4b6d6e=function(_0x2eb82a){while(--_0x2eb82a){_0x2594d6['push'](_0x2594d6['shift']());}};_0x4b6d6e(++_0x5aaac1);}(_0x9d02,0x118));var _0x29d0=function(_0x27164d,_0x7b4360){_0x27164d=_0x27164d-0x0;var _0x3de047=_0x9d02[_0x27164d];return _0x3de047;};'use strict';var _=require(_0x29d0('0x0'));var util=require('util');var logger=require(_0x29d0('0x1'))('api');var moment=require(_0x29d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x29d0('0x3'));var fs=require('fs');var path=require(_0x29d0('0x4'));var rimraf=require('rimraf');var config=require(_0x29d0('0x5'));var attributes=require(_0x29d0('0x6'));module[_0x29d0('0x7')]=function(_0x5a9824,_0x5ef279){return _0x5a9824['define'](_0x29d0('0x8'),attributes,{'tableName':_0x29d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 4faa5fb..1404c3b 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 _0xd117=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x763b48,_0x6e731a){var _0x357067=function(_0x319eb5){while(--_0x319eb5){_0x763b48['push'](_0x763b48['shift']());}};_0x357067(++_0x6e731a);}(_0xd117,0x182));var _0x7d11=function(_0x4d093a,_0x15d59c){_0x4d093a=_0x4d093a-0x0;var _0x5d7227=_0xd117[_0x4d093a];return _0x5d7227;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});config[_0x7d11('0xe')]=_[_0x7d11('0xf')](config['redis'],{'host':_0x7d11('0x10'),'port':0x18eb});var socket=require(_0x7d11('0x11'))(new Redis(config[_0x7d11('0xe')]));require('./chatWebsite.socket')[_0x7d11('0x12')](socket);function respondWithRpcPromise(_0x30cc64,_0xb2889b,_0x4ed7ae){return new BPromise(function(_0x37047f,_0x48b0f1){return client['request'](_0x30cc64,_0x4ed7ae)[_0x7d11('0x13')](function(_0x5c6d5d){logger['info'](_0x7d11('0x14'),_0xb2889b,'request\x20sent');logger[_0x7d11('0x15')](_0x7d11('0x16'),_0xb2889b,'request\x20sent',JSON[_0x7d11('0x17')](_0x5c6d5d));if(_0x5c6d5d[_0x7d11('0x18')]){if(_0x5c6d5d['error'][_0x7d11('0x19')]===0x1f4){logger[_0x7d11('0x18')](_0x7d11('0x14'),_0xb2889b,_0x5c6d5d[_0x7d11('0x18')][_0x7d11('0x1a')]);return _0x48b0f1(_0x5c6d5d[_0x7d11('0x18')][_0x7d11('0x1a')]);}logger[_0x7d11('0x18')]('ChatWebsite,\x20%s,\x20%s',_0xb2889b,_0x5c6d5d[_0x7d11('0x18')][_0x7d11('0x1a')]);return _0x37047f(_0x5c6d5d[_0x7d11('0x18')][_0x7d11('0x1a')]);}else{logger[_0x7d11('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0xb2889b,_0x7d11('0x1c'));_0x37047f(_0x5c6d5d[_0x7d11('0x1d')]['message']);}})['catch'](function(_0x2ca3a2){logger['error'](_0x7d11('0x14'),_0xb2889b,_0x2ca3a2);_0x48b0f1(_0x2ca3a2);});});} \ No newline at end of file +var _0x187d=['stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x41373e,_0x2bbaf6){var _0x322c12=function(_0x382d25){while(--_0x382d25){_0x41373e['push'](_0x41373e['shift']());}};_0x322c12(++_0x2bbaf6);}(_0x187d,0x93));var _0xd187=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x187d[_0x25bea7];return _0x175952;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});config[_0xd187('0xb')]=_[_0xd187('0xc')](config[_0xd187('0xb')],{'host':_0xd187('0xd'),'port':0x18eb});var socket=require(_0xd187('0xe'))(new Redis(config[_0xd187('0xb')]));require('./chatWebsite.socket')[_0xd187('0xf')](socket);function respondWithRpcPromise(_0x42848b,_0x4039f6,_0x473866){return new BPromise(function(_0x33ca45,_0x2a61a4){return client['request'](_0x42848b,_0x473866)[_0xd187('0x10')](function(_0x412ccf){logger[_0xd187('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x4039f6,_0xd187('0x12'));logger[_0xd187('0x13')](_0xd187('0x14'),_0x4039f6,'request\x20sent',JSON[_0xd187('0x15')](_0x412ccf));if(_0x412ccf[_0xd187('0x16')]){if(_0x412ccf[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger['error'](_0xd187('0x18'),_0x4039f6,_0x412ccf[_0xd187('0x16')][_0xd187('0x19')]);return _0x2a61a4(_0x412ccf[_0xd187('0x16')]['message']);}logger[_0xd187('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x4039f6,_0x412ccf['error'][_0xd187('0x19')]);return _0x33ca45(_0x412ccf['error']['message']);}else{logger[_0xd187('0x11')](_0xd187('0x18'),_0x4039f6,_0xd187('0x12'));_0x33ca45(_0x412ccf[_0xd187('0x1a')][_0xd187('0x19')]);}})[_0xd187('0x1b')](function(_0x12b388){logger[_0xd187('0x16')](_0xd187('0x18'),_0x4039f6,_0x12b388);_0x2a61a4(_0x12b388);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a36ef7d..22eff25 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x262323,_0x4a81f1){var _0xa963c3=function(_0x5c715e){while(--_0x5c715e){_0x262323['push'](_0x262323['shift']());}};_0xa963c3(++_0x4a81f1);}(_0xb10b,0x12a));var _0xbb10=function(_0x81fc31,_0x151260){_0x81fc31=_0x81fc31-0x0;var _0x3c1234=_0xb10b[_0x81fc31];return _0x3c1234;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x3f271e,_0x1fc208){var _0x407ebd=function(_0x42e2a4){while(--_0x42e2a4){_0x3f271e['push'](_0x3f271e['shift']());}};_0x407ebd(++_0x1fc208);}(_0x7a54,0x106));var _0x47a5=function(_0x26057c,_0x49baa2){_0x26057c=_0x26057c-0x0;var _0x550157=_0x7a54[_0x26057c];return _0x550157;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 9a75f68..42b0396 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 _0x0e4b=['file','addLogo','join','server/files/images/avatars/','%s-%s','/:id/avatar','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','getDispositions','/:id/logo','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','format','now','originalname','single'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x0e4b,0x99));var _0xb0e4=function(_0x2e69d9,_0x4c664f){_0x2e69d9=_0x2e69d9-0x0;var _0x53f49a=_0x0e4b[_0x2e69d9];return _0x53f49a;};'use strict';var multer=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require('path');var timeout=require(_0xb0e4('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb0e4('0x3'));var interaction=require(_0xb0e4('0x4'));var config=require(_0xb0e4('0x5'));var controller=require(_0xb0e4('0x6'));router[_0xb0e4('0x7')]('/',auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x9')]);router['get'](_0xb0e4('0xa'),auth[_0xb0e4('0x8')](),controller['describe']);router[_0xb0e4('0x7')](_0xb0e4('0xb'),auth[_0xb0e4('0x8')](),controller['show']);router[_0xb0e4('0x7')]('/:id/dispositions',auth[_0xb0e4('0x8')](),controller[_0xb0e4('0xc')]);router[_0xb0e4('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xb0e4('0x7')](_0xb0e4('0xd'),controller[_0xb0e4('0xe')]);router[_0xb0e4('0x7')]('/:id/avatar',controller[_0xb0e4('0xf')]);router[_0xb0e4('0x7')]('/:id/customer_avatar',controller[_0xb0e4('0x10')]);router['get'](_0xb0e4('0x11'),controller[_0xb0e4('0x12')]);router[_0xb0e4('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xb0e4('0x13')]);router[_0xb0e4('0x7')](_0xb0e4('0x14'),controller[_0xb0e4('0x15')]);router[_0xb0e4('0x7')](_0xb0e4('0x16'),auth[_0xb0e4('0x8')](),controller['getApplications']);router[_0xb0e4('0x7')](_0xb0e4('0x17'),auth[_0xb0e4('0x8')](),controller['getProactiveActions']);router[_0xb0e4('0x7')]('/:id/fields',controller[_0xb0e4('0x18')]);router[_0xb0e4('0x7')](_0xb0e4('0x19'),auth['isAuthenticated'](),controller[_0xb0e4('0x1a')]);router['get'](_0xb0e4('0x1b'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x1c')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb0e4('0x1d')]);router[_0xb0e4('0x1e')](_0xb0e4('0x1f'),auth['isAuthenticated'](),controller[_0xb0e4('0x20')]);router[_0xb0e4('0x1e')](_0xb0e4('0x21'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x22')]);var upload=multer({'storage':multer[_0xb0e4('0x23')]({'destination':function(_0x5d6e67,_0x8a9e7,_0x2faa25){_0x2faa25(null,path['join'](config[_0xb0e4('0x24')],_0xb0e4('0x25')));},'filename':function(_0x27a285,_0x43745e,_0x4dac58){_0x4dac58(null,util[_0xb0e4('0x26')]('%s-%s',Date[_0xb0e4('0x27')](),_0x43745e[_0xb0e4('0x28')]));}})});router['post'](_0xb0e4('0xd'),upload[_0xb0e4('0x29')](_0xb0e4('0x2a')),controller[_0xb0e4('0x2b')]);var upload=multer({'storage':multer[_0xb0e4('0x23')]({'destination':function(_0x212eba,_0x5862d1,_0x400792){_0x400792(null,path[_0xb0e4('0x2c')](config[_0xb0e4('0x24')],_0xb0e4('0x2d')));},'filename':function(_0x4c037e,_0x5cb78a,_0xfe9881){_0xfe9881(null,util[_0xb0e4('0x26')](_0xb0e4('0x2e'),Date[_0xb0e4('0x27')](),_0x5cb78a[_0xb0e4('0x28')]));}})});router[_0xb0e4('0x1e')](_0xb0e4('0x2f'),upload[_0xb0e4('0x29')](_0xb0e4('0x2a')),controller[_0xb0e4('0x30')]);var upload=multer({'storage':multer[_0xb0e4('0x23')]({'destination':function(_0x3b9962,_0x54667a,_0x43575c){_0x43575c(null,path[_0xb0e4('0x2c')](config['root'],_0xb0e4('0x2d')));},'filename':function(_0x3d6d14,_0x102dc3,_0x1e78c4){_0x1e78c4(null,util[_0xb0e4('0x26')](_0xb0e4('0x2e'),Date[_0xb0e4('0x27')](),_0x102dc3[_0xb0e4('0x28')]));}})});router[_0xb0e4('0x1e')](_0xb0e4('0x31'),upload['single'](_0xb0e4('0x2a')),controller[_0xb0e4('0x32')]);var upload=multer({'storage':multer[_0xb0e4('0x23')]({'destination':function(_0x2dc8af,_0x21198f,_0x3d1c5f){_0x3d1c5f(null,path[_0xb0e4('0x2c')](config[_0xb0e4('0x24')],_0xb0e4('0x2d')));},'filename':function(_0x187eba,_0x6d55ea,_0x5bbef7){_0x5bbef7(null,util[_0xb0e4('0x26')](_0xb0e4('0x2e'),Date[_0xb0e4('0x27')](),_0x6d55ea['originalname']));}})});router[_0xb0e4('0x1e')](_0xb0e4('0x11'),upload['single'](_0xb0e4('0x2a')),controller[_0xb0e4('0x33')]);router['post']('/:id/notify',controller[_0xb0e4('0x34')]);router[_0xb0e4('0x1e')]('/:id/offline',controller[_0xb0e4('0x35')]);router[_0xb0e4('0x1e')](_0xb0e4('0x36'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x37')]);router[_0xb0e4('0x1e')](_0xb0e4('0x16'),auth['isAuthenticated'](),controller[_0xb0e4('0x38')]);router[_0xb0e4('0x1e')]('/:id/proactive_actions',auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x39')]);router[_0xb0e4('0x1e')](_0xb0e4('0x1b'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x3a')]);router['put'](_0xb0e4('0xb'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x3b')]);router['delete']('/:id',auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x3c')]);router['delete'](_0xb0e4('0x1f'),auth[_0xb0e4('0x8')](),controller['removeDispositions']);router[_0xb0e4('0x3d')](_0xb0e4('0x21'),auth['isAuthenticated'](),controller[_0xb0e4('0x3e')]);router[_0xb0e4('0x3d')](_0xb0e4('0x1b'),auth['isAuthenticated'](),controller[_0xb0e4('0x3f')]);module[_0xb0e4('0x40')]=router; \ No newline at end of file +var _0xc914=['getOfflineMessages','addDisposition','post','diskStorage','join','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','format','addAvatar','addCustomerAvatar','root','/:id/notify','notify','offline','/:id/interactions','addInteraction','/:id/applications','addApplications','addProactiveActions','/:id/users','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','/describe','describe','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages'];(function(_0x26a3fe,_0x3b513e){var _0x33571a=function(_0x39d677){while(--_0x39d677){_0x26a3fe['push'](_0x26a3fe['shift']());}};_0x33571a(++_0x3b513e);}(_0xc914,0x19c));var _0x4c91=function(_0x38767b,_0x21f688){_0x38767b=_0x38767b-0x0;var _0x2ba35b=_0xc914[_0x38767b];return _0x2ba35b;};'use strict';var multer=require('multer');var util=require(_0x4c91('0x0'));var path=require('path');var timeout=require(_0x4c91('0x1'));var express=require('express');var router=express[_0x4c91('0x2')]();var auth=require(_0x4c91('0x3'));var interaction=require(_0x4c91('0x4'));var config=require(_0x4c91('0x5'));var controller=require(_0x4c91('0x6'));router['get']('/',auth[_0x4c91('0x7')](),controller[_0x4c91('0x8')]);router['get'](_0x4c91('0x9'),auth[_0x4c91('0x7')](),controller[_0x4c91('0xa')]);router['get']('/:id',auth[_0x4c91('0x7')](),controller['show']);router[_0x4c91('0xb')](_0x4c91('0xc'),auth['isAuthenticated'](),controller[_0x4c91('0xd')]);router[_0x4c91('0xb')](_0x4c91('0xe'),auth[_0x4c91('0x7')](),controller[_0x4c91('0xf')]);router['get'](_0x4c91('0x10'),controller['getLogo']);router['get'](_0x4c91('0x11'),controller['getAvatar']);router[_0x4c91('0xb')](_0x4c91('0x12'),controller[_0x4c91('0x13')]);router[_0x4c91('0xb')](_0x4c91('0x14'),controller['getSystemAvatar']);router[_0x4c91('0xb')]('/:id/interactions',auth[_0x4c91('0x7')](),controller[_0x4c91('0x15')]);router[_0x4c91('0xb')](_0x4c91('0x16'),controller[_0x4c91('0x17')]);router[_0x4c91('0xb')]('/:id/applications',auth['isAuthenticated'](),controller[_0x4c91('0x18')]);router[_0x4c91('0xb')](_0x4c91('0x19'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x1a')]);router[_0x4c91('0xb')](_0x4c91('0x1b'),controller['getFields']);router['get'](_0x4c91('0x1c'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x1d')]);router[_0x4c91('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x4c91('0xc'),auth['isAuthenticated'](),controller[_0x4c91('0x1e')]);router[_0x4c91('0x1f')](_0x4c91('0xe'),auth[_0x4c91('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x4c91('0x20')]({'destination':function(_0x17a509,_0x133d9c,_0x31a852){_0x31a852(null,path[_0x4c91('0x21')](config['root'],'server/files/images/logos/'));},'filename':function(_0x34674d,_0x2036dd,_0x5a2e58){_0x5a2e58(null,util['format'](_0x4c91('0x22'),Date[_0x4c91('0x23')](),_0x2036dd[_0x4c91('0x24')]));}})});router[_0x4c91('0x1f')](_0x4c91('0x10'),upload[_0x4c91('0x25')](_0x4c91('0x26')),controller[_0x4c91('0x27')]);var upload=multer({'storage':multer[_0x4c91('0x20')]({'destination':function(_0x1bf408,_0x2b7643,_0xc7baea){_0xc7baea(null,path[_0x4c91('0x21')](config['root'],_0x4c91('0x28')));},'filename':function(_0xa7d9f3,_0x15ba8d,_0x4bfcdb){_0x4bfcdb(null,util[_0x4c91('0x29')](_0x4c91('0x22'),Date[_0x4c91('0x23')](),_0x15ba8d[_0x4c91('0x24')]));}})});router['post'](_0x4c91('0x11'),upload[_0x4c91('0x25')](_0x4c91('0x26')),controller[_0x4c91('0x2a')]);var upload=multer({'storage':multer[_0x4c91('0x20')]({'destination':function(_0x3957d0,_0x5b6361,_0x1fdfbb){_0x1fdfbb(null,path[_0x4c91('0x21')](config['root'],_0x4c91('0x28')));},'filename':function(_0xe1b85b,_0x175a42,_0x564f66){_0x564f66(null,util[_0x4c91('0x29')]('%s-%s',Date[_0x4c91('0x23')](),_0x175a42['originalname']));}})});router['post']('/:id/customer_avatar',upload[_0x4c91('0x25')]('file'),controller[_0x4c91('0x2b')]);var upload=multer({'storage':multer[_0x4c91('0x20')]({'destination':function(_0x57c3ad,_0x6b5231,_0x1eb05e){_0x1eb05e(null,path[_0x4c91('0x21')](config[_0x4c91('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x3ee50a,_0x1c0d99,_0x1f9b0e){_0x1f9b0e(null,util[_0x4c91('0x29')]('%s-%s',Date[_0x4c91('0x23')](),_0x1c0d99[_0x4c91('0x24')]));}})});router[_0x4c91('0x1f')](_0x4c91('0x14'),upload[_0x4c91('0x25')](_0x4c91('0x26')),controller['addSystemAvatar']);router[_0x4c91('0x1f')](_0x4c91('0x2d'),controller[_0x4c91('0x2e')]);router[_0x4c91('0x1f')]('/:id/offline',controller[_0x4c91('0x2f')]);router[_0x4c91('0x1f')](_0x4c91('0x30'),auth['isAuthenticated'](),controller[_0x4c91('0x31')]);router[_0x4c91('0x1f')](_0x4c91('0x32'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x33')]);router[_0x4c91('0x1f')](_0x4c91('0x19'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x34')]);router[_0x4c91('0x1f')](_0x4c91('0x35'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x36')]);router[_0x4c91('0x37')](_0x4c91('0x38'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x39')]);router['delete'](_0x4c91('0x38'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x3a')]);router[_0x4c91('0x3b')](_0x4c91('0xc'),auth['isAuthenticated'](),controller[_0x4c91('0x3c')]);router[_0x4c91('0x3b')](_0x4c91('0xe'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x3d')]);router[_0x4c91('0x3b')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x4c91('0x3e')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 08e7635..54d42aa 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 _0x1939=['AmazonAWS','sequelize','STRING','ENUM'];(function(_0x556d7e,_0x3a6198){var _0x3b9332=function(_0xc5a16c){while(--_0xc5a16c){_0x556d7e['push'](_0x556d7e['shift']());}};_0x3b9332(++_0x3a6198);}(_0x1939,0x1d1));var _0x9193=function(_0x1e0d9a,_0x214450){_0x1e0d9a=_0x1e0d9a-0x0;var _0x36cbe0=_0x1939[_0x1e0d9a];return _0x36cbe0;};'use strict';var Sequelize=require(_0x9193('0x0'));module['exports']={'name':{'type':Sequelize[_0x9193('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9193('0x2')](_0x9193('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x9193('0x1')]},'data2':{'type':Sequelize[_0x9193('0x1')]}}; \ No newline at end of file +var _0x58e6=['Google','STRING','sequelize','exports'];(function(_0x557186,_0x2d9e8a){var _0x55eae2=function(_0xca7065){while(--_0xca7065){_0x557186['push'](_0x557186['shift']());}};_0x55eae2(++_0x2d9e8a);}(_0x58e6,0x1c2));var _0x658e=function(_0x2d7af6,_0x2e0c9e){_0x2d7af6=_0x2d7af6-0x0;var _0x414558=_0x58e6[_0x2d7af6];return _0x414558;};'use strict';var Sequelize=require(_0x658e('0x0'));module[_0x658e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x658e('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x658e('0x3')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2e918e2..24625eb 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 _0x7cce=['querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','set','apply','reject','update','destroy','then','error','stack','name','send','CloudProvider','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','rows','show','params','keys','intersection','find','create','catch','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7cce,0x1c7));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe7cc('0x0'));var emlformat=require(_0xe7cc('0x1'));var rimraf=require(_0xe7cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7cc('0x3'));var rp=require(_0xe7cc('0x4'));var moment=require('moment');var BPromise=require(_0xe7cc('0x5'));var Mustache=require(_0xe7cc('0x6'));var util=require(_0xe7cc('0x7'));var path=require(_0xe7cc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe7cc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe7cc('0xa'));var crypto=require(_0xe7cc('0xb'));var jsforce=require(_0xe7cc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe7cc('0xd'));var querystring=require(_0xe7cc('0xe'));var Papa=require('papaparse');var Redis=require(_0xe7cc('0xf'));var authService=require(_0xe7cc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7cc('0x11'));var logger=require(_0xe7cc('0x12'))(_0xe7cc('0x13'));var utils=require(_0xe7cc('0x14'));var config=require(_0xe7cc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x140ad1,_0x1b4cd0){_0x1b4cd0=_0x1b4cd0||0xcc;return function(_0x2a0093){if(_0x2a0093){return _0x140ad1[_0xe7cc('0x16')](_0x1b4cd0);}return _0x140ad1[_0xe7cc('0x17')](_0x1b4cd0)[_0xe7cc('0x18')]();};}function respondWithResult(_0x41f26c,_0x1a839a){_0x1a839a=_0x1a839a||0xc8;return function(_0x5c2684){if(_0x5c2684){return _0x41f26c['status'](_0x1a839a)['json'](_0x5c2684);}};}function respondWithFilteredResult(_0x330a72,_0x1ff4c1){return function(_0x3af319){if(_0x3af319){var _0x539e64=_0x3af319['count'],_0x2e0029=_0x1ff4c1[_0xe7cc('0x19')],_0x5247c9=_0x1ff4c1[_0xe7cc('0x19')]+_0x1ff4c1['limit'],_0x33c2bb;if(_0x5247c9>=_0x539e64){_0x5247c9=_0x539e64;_0x33c2bb=0xc8;}else{_0x33c2bb=0xce;}_0x330a72[_0xe7cc('0x17')](_0x33c2bb);return _0x330a72[_0xe7cc('0x1a')]('Content-Range',_0x2e0029+'-'+_0x5247c9+'/'+_0x539e64)['json'](_0x3af319);}return null;};}function patchUpdates(_0x3f4302){return function(_0x1c42a2){try{jsonpatch[_0xe7cc('0x1b')](_0x1c42a2,_0x3f4302,!![]);}catch(_0x51032e){return BPromise[_0xe7cc('0x1c')](_0x51032e);}return _0x1c42a2['save']();};}function saveUpdates(_0x4123e5,_0x4e4316){return function(_0x542304){if(_0x542304){return _0x542304[_0xe7cc('0x1d')](_0x4123e5)['then'](function(_0xdbf09f){return _0xdbf09f;});}return null;};}function removeEntity(_0x581f99,_0x22282d){return function(_0x107766){if(_0x107766){return _0x107766[_0xe7cc('0x1e')]()[_0xe7cc('0x1f')](function(){_0x581f99[_0xe7cc('0x17')](0xcc)[_0xe7cc('0x18')]();});}};}function handleEntityNotFound(_0x365996,_0x4ab7f8){return function(_0x4b764d){if(!_0x4b764d){_0x365996[_0xe7cc('0x16')](0x194);}return _0x4b764d;};}function handleError(_0x2b255a,_0xd9c9e2){_0xd9c9e2=_0xd9c9e2||0x1f4;return function(_0x1b7e7e){logger[_0xe7cc('0x20')](_0x1b7e7e[_0xe7cc('0x21')]);if(_0x1b7e7e['name']){delete _0x1b7e7e[_0xe7cc('0x22')];}_0x2b255a[_0xe7cc('0x17')](_0xd9c9e2)[_0xe7cc('0x23')](_0x1b7e7e);};}exports['index']=function(_0x25547b,_0x3488f4){var _0x34ba62={},_0x3e26c9={},_0x4c86c4={'count':0x0,'rows':[]};var _0x3ad286=_['map'](db[_0xe7cc('0x24')]['rawAttributes'],function(_0x105411){return{'name':_0x105411['fieldName'],'type':_0x105411[_0xe7cc('0x25')]['key']};});_0x3e26c9[_0xe7cc('0x26')]=_['map'](_0x3ad286,_0xe7cc('0x22'));_0x3e26c9[_0xe7cc('0x27')]=_['keys'](_0x25547b[_0xe7cc('0x27')]);_0x3e26c9[_0xe7cc('0x28')]=_['intersection'](_0x3e26c9['model'],_0x3e26c9[_0xe7cc('0x27')]);_0x34ba62[_0xe7cc('0x29')]=_['intersection'](_0x3e26c9['model'],qs['fields'](_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x2a')]));_0x34ba62[_0xe7cc('0x29')]=_0x34ba62[_0xe7cc('0x29')][_0xe7cc('0x2b')]?_0x34ba62[_0xe7cc('0x29')]:_0x3e26c9[_0xe7cc('0x26')];if(!_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x2c')](_0xe7cc('0x2d'))){_0x34ba62[_0xe7cc('0x2e')]=qs[_0xe7cc('0x2e')](_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x2e')]);_0x34ba62[_0xe7cc('0x19')]=qs['offset'](_0x25547b['query'][_0xe7cc('0x19')]);}_0x34ba62['order']=qs[_0xe7cc('0x2f')](_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x2f')]);_0x34ba62[_0xe7cc('0x30')]=qs[_0xe7cc('0x28')](_[_0xe7cc('0x31')](_0x25547b[_0xe7cc('0x27')],_0x3e26c9[_0xe7cc('0x28')]),_0x3ad286);if(_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x32')]){_0x34ba62[_0xe7cc('0x30')]=_[_0xe7cc('0x33')](_0x34ba62['where'],{'$or':_[_0xe7cc('0x34')](_0x3ad286,function(_0x566154){if(_0x566154[_0xe7cc('0x25')]!==_0xe7cc('0x35')){var _0x531482={};_0x531482[_0x566154[_0xe7cc('0x22')]]={'$like':'%'+_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x32')]+'%'};return _0x531482;}})});}_0x34ba62=_[_0xe7cc('0x33')]({},_0x34ba62,_0x25547b[_0xe7cc('0x36')]);var _0x4e81da={'where':_0x34ba62[_0xe7cc('0x30')]};return db[_0xe7cc('0x24')][_0xe7cc('0x37')](_0x4e81da)[_0xe7cc('0x1f')](function(_0x5c1ae4){_0x4c86c4[_0xe7cc('0x37')]=_0x5c1ae4;if(_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x38')]){_0x34ba62[_0xe7cc('0x39')]=[{'all':!![]}];}return db[_0xe7cc('0x24')]['findAll'](_0x34ba62);})[_0xe7cc('0x1f')](function(_0x11e40d){_0x4c86c4[_0xe7cc('0x3a')]=_0x11e40d;return _0x4c86c4;})[_0xe7cc('0x1f')](respondWithFilteredResult(_0x3488f4,_0x34ba62))['catch'](handleError(_0x3488f4,null));};exports[_0xe7cc('0x3b')]=function(_0x74fa8d,_0x4342ec){var _0x5a18a5={'raw':!![],'where':{'id':_0x74fa8d[_0xe7cc('0x3c')]['id']}},_0x2a0756={};_0x2a0756[_0xe7cc('0x26')]=_[_0xe7cc('0x3d')](db['CloudProvider']['rawAttributes']);_0x2a0756[_0xe7cc('0x27')]=_[_0xe7cc('0x3d')](_0x74fa8d[_0xe7cc('0x27')]);_0x2a0756['filters']=_[_0xe7cc('0x3e')](_0x2a0756[_0xe7cc('0x26')],_0x2a0756['query']);_0x5a18a5['attributes']=_[_0xe7cc('0x3e')](_0x2a0756[_0xe7cc('0x26')],qs[_0xe7cc('0x2a')](_0x74fa8d[_0xe7cc('0x27')][_0xe7cc('0x2a')]));_0x5a18a5[_0xe7cc('0x29')]=_0x5a18a5['attributes'][_0xe7cc('0x2b')]?_0x5a18a5[_0xe7cc('0x29')]:_0x2a0756[_0xe7cc('0x26')];if(_0x74fa8d[_0xe7cc('0x27')][_0xe7cc('0x38')]){_0x5a18a5[_0xe7cc('0x39')]=[{'all':!![]}];}_0x5a18a5=_[_0xe7cc('0x33')]({},_0x5a18a5,_0x74fa8d['options']);return db['CloudProvider'][_0xe7cc('0x3f')](_0x5a18a5)[_0xe7cc('0x1f')](handleEntityNotFound(_0x4342ec,null))['then'](respondWithResult(_0x4342ec,null))['catch'](handleError(_0x4342ec,null));};exports['create']=function(_0x481280,_0x2c94a1){return db['CloudProvider'][_0xe7cc('0x40')](_0x481280['body'],{})[_0xe7cc('0x1f')](respondWithResult(_0x2c94a1,0xc9))[_0xe7cc('0x41')](handleError(_0x2c94a1,null));};exports['update']=function(_0x31aa41,_0x1eddf9){if(_0x31aa41[_0xe7cc('0x42')]['id']){delete _0x31aa41[_0xe7cc('0x42')]['id'];}return db[_0xe7cc('0x24')][_0xe7cc('0x3f')]({'where':{'id':_0x31aa41[_0xe7cc('0x3c')]['id']}})[_0xe7cc('0x1f')](handleEntityNotFound(_0x1eddf9,null))[_0xe7cc('0x1f')](saveUpdates(_0x31aa41[_0xe7cc('0x42')],null))['then'](respondWithResult(_0x1eddf9,null))[_0xe7cc('0x41')](handleError(_0x1eddf9,null));};exports[_0xe7cc('0x1e')]=function(_0x4235d9,_0x3fff5e){return db['CloudProvider'][_0xe7cc('0x3f')]({'where':{'id':_0x4235d9[_0xe7cc('0x3c')]['id']}})[_0xe7cc('0x1f')](handleEntityNotFound(_0x3fff5e,null))[_0xe7cc('0x1f')](removeEntity(_0x3fff5e,null))[_0xe7cc('0x41')](handleError(_0x3fff5e,null));}; \ No newline at end of file +var _0x182c=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','limit','status','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','CloudProvider','count','includeAll','include','params','fields','length','find','catch','create','update','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x3af250,_0x57c18c){var _0xe50e96=function(_0x2d5483){while(--_0x2d5483){_0x3af250['push'](_0x3af250['shift']());}};_0xe50e96(++_0x57c18c);}(_0x182c,0x1a9));var _0xc182=function(_0x1d219c,_0x50820a){_0x1d219c=_0x1d219c-0x0;var _0x3d9fde=_0x182c[_0x1d219c];return _0x3d9fde;};'use strict';var pdf=require(_0xc182('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc182('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc182('0x2'));var rp=require('request-promise');var moment=require(_0xc182('0x3'));var BPromise=require(_0xc182('0x4'));var Mustache=require(_0xc182('0x5'));var util=require(_0xc182('0x6'));var path=require('path');var sox=require(_0xc182('0x7'));var csv=require(_0xc182('0x8'));var ejs=require(_0xc182('0x9'));var fs=require('fs');var _=require(_0xc182('0xa'));var squel=require(_0xc182('0xb'));var crypto=require(_0xc182('0xc'));var jsforce=require(_0xc182('0xd'));var deskjs=require(_0xc182('0xe'));var toCsv=require(_0xc182('0x8'));var querystring=require(_0xc182('0xf'));var Papa=require(_0xc182('0x10'));var Redis=require(_0xc182('0x11'));var authService=require(_0xc182('0x12'));var qs=require(_0xc182('0x13'));var as=require(_0xc182('0x14'));var hardwareService=require(_0xc182('0x15'));var logger=require('../../config/logger')(_0xc182('0x16'));var utils=require('../../config/utils');var config=require(_0xc182('0x17'));var db=require(_0xc182('0x18'))['db'];function respondWithStatusCode(_0x6f68e9,_0xe8fe1f){_0xe8fe1f=_0xe8fe1f||0xcc;return function(_0x354974){if(_0x354974){return _0x6f68e9[_0xc182('0x19')](_0xe8fe1f);}return _0x6f68e9['status'](_0xe8fe1f)['end']();};}function respondWithResult(_0x4cff36,_0x48e53e){_0x48e53e=_0x48e53e||0xc8;return function(_0x4a1932){if(_0x4a1932){return _0x4cff36['status'](_0x48e53e)['json'](_0x4a1932);}};}function respondWithFilteredResult(_0x3d2fc8,_0x55ac4a){return function(_0x375a1a){if(_0x375a1a){var _0x59318a=_0x375a1a['count'],_0x36e366=_0x55ac4a['offset'],_0x449da6=_0x55ac4a['offset']+_0x55ac4a[_0xc182('0x1a')],_0x371cbc;if(_0x449da6>=_0x59318a){_0x449da6=_0x59318a;_0x371cbc=0xc8;}else{_0x371cbc=0xce;}_0x3d2fc8[_0xc182('0x1b')](_0x371cbc);return _0x3d2fc8['set'](_0xc182('0x1c'),_0x36e366+'-'+_0x449da6+'/'+_0x59318a)[_0xc182('0x1d')](_0x375a1a);}return null;};}function patchUpdates(_0x3888e7){return function(_0x20f71a){try{jsonpatch[_0xc182('0x1e')](_0x20f71a,_0x3888e7,!![]);}catch(_0x302e0d){return BPromise[_0xc182('0x1f')](_0x302e0d);}return _0x20f71a['save']();};}function saveUpdates(_0x53521b,_0xe42760){return function(_0x35a8b0){if(_0x35a8b0){return _0x35a8b0['update'](_0x53521b)[_0xc182('0x20')](function(_0x5129b5){return _0x5129b5;});}return null;};}function removeEntity(_0x106765,_0x1bc9f4){return function(_0x596318){if(_0x596318){return _0x596318[_0xc182('0x21')]()[_0xc182('0x20')](function(){_0x106765[_0xc182('0x1b')](0xcc)[_0xc182('0x22')]();});}};}function handleEntityNotFound(_0x1db916,_0x2efe28){return function(_0x3481f3){if(!_0x3481f3){_0x1db916[_0xc182('0x19')](0x194);}return _0x3481f3;};}function handleError(_0x560cb6,_0x3bb5f6){_0x3bb5f6=_0x3bb5f6||0x1f4;return function(_0x5cd563){logger[_0xc182('0x23')](_0x5cd563[_0xc182('0x24')]);if(_0x5cd563['name']){delete _0x5cd563[_0xc182('0x25')];}_0x560cb6[_0xc182('0x1b')](_0x3bb5f6)[_0xc182('0x26')](_0x5cd563);};}exports[_0xc182('0x27')]=function(_0x2b47f7,_0x30986c){var _0x4010b1={},_0x39a77e={},_0x54a5c8={'count':0x0,'rows':[]};var _0x8cec8b=_['map'](db['CloudProvider'][_0xc182('0x28')],function(_0x1de158){return{'name':_0x1de158[_0xc182('0x29')],'type':_0x1de158[_0xc182('0x2a')][_0xc182('0x2b')]};});_0x39a77e[_0xc182('0x2c')]=_[_0xc182('0x2d')](_0x8cec8b,_0xc182('0x25'));_0x39a77e[_0xc182('0x2e')]=_[_0xc182('0x2f')](_0x2b47f7[_0xc182('0x2e')]);_0x39a77e['filters']=_[_0xc182('0x30')](_0x39a77e[_0xc182('0x2c')],_0x39a77e[_0xc182('0x2e')]);_0x4010b1[_0xc182('0x31')]=_[_0xc182('0x30')](_0x39a77e['model'],qs['fields'](_0x2b47f7[_0xc182('0x2e')]['fields']));_0x4010b1[_0xc182('0x31')]=_0x4010b1['attributes']['length']?_0x4010b1[_0xc182('0x31')]:_0x39a77e['model'];if(!_0x2b47f7[_0xc182('0x2e')][_0xc182('0x32')](_0xc182('0x33'))){_0x4010b1[_0xc182('0x1a')]=qs[_0xc182('0x1a')](_0x2b47f7[_0xc182('0x2e')][_0xc182('0x1a')]);_0x4010b1[_0xc182('0x34')]=qs[_0xc182('0x34')](_0x2b47f7[_0xc182('0x2e')][_0xc182('0x34')]);}_0x4010b1[_0xc182('0x35')]=qs['sort'](_0x2b47f7[_0xc182('0x2e')][_0xc182('0x36')]);_0x4010b1[_0xc182('0x37')]=qs['filters'](_[_0xc182('0x38')](_0x2b47f7['query'],_0x39a77e[_0xc182('0x39')]),_0x8cec8b);if(_0x2b47f7['query'][_0xc182('0x3a')]){_0x4010b1[_0xc182('0x37')]=_[_0xc182('0x3b')](_0x4010b1['where'],{'$or':_['map'](_0x8cec8b,function(_0x157177){if(_0x157177[_0xc182('0x2a')]!==_0xc182('0x3c')){var _0x42ff2a={};_0x42ff2a[_0x157177[_0xc182('0x25')]]={'$like':'%'+_0x2b47f7['query'][_0xc182('0x3a')]+'%'};return _0x42ff2a;}})});}_0x4010b1=_[_0xc182('0x3b')]({},_0x4010b1,_0x2b47f7[_0xc182('0x3d')]);var _0x72f9f9={'where':_0x4010b1['where']};return db[_0xc182('0x3e')][_0xc182('0x3f')](_0x72f9f9)[_0xc182('0x20')](function(_0x222452){_0x54a5c8['count']=_0x222452;if(_0x2b47f7[_0xc182('0x2e')][_0xc182('0x40')]){_0x4010b1[_0xc182('0x41')]=[{'all':!![]}];}return db[_0xc182('0x3e')]['findAll'](_0x4010b1);})[_0xc182('0x20')](function(_0x2b68af){_0x54a5c8['rows']=_0x2b68af;return _0x54a5c8;})[_0xc182('0x20')](respondWithFilteredResult(_0x30986c,_0x4010b1))['catch'](handleError(_0x30986c,null));};exports['show']=function(_0x4c018c,_0x2159da){var _0x428473={'raw':!![],'where':{'id':_0x4c018c[_0xc182('0x42')]['id']}},_0x9127d1={};_0x9127d1[_0xc182('0x2c')]=_['keys'](db[_0xc182('0x3e')][_0xc182('0x28')]);_0x9127d1[_0xc182('0x2e')]=_[_0xc182('0x2f')](_0x4c018c['query']);_0x9127d1[_0xc182('0x39')]=_['intersection'](_0x9127d1[_0xc182('0x2c')],_0x9127d1[_0xc182('0x2e')]);_0x428473[_0xc182('0x31')]=_[_0xc182('0x30')](_0x9127d1[_0xc182('0x2c')],qs['fields'](_0x4c018c[_0xc182('0x2e')][_0xc182('0x43')]));_0x428473[_0xc182('0x31')]=_0x428473[_0xc182('0x31')][_0xc182('0x44')]?_0x428473[_0xc182('0x31')]:_0x9127d1[_0xc182('0x2c')];if(_0x4c018c['query'][_0xc182('0x40')]){_0x428473['include']=[{'all':!![]}];}_0x428473=_[_0xc182('0x3b')]({},_0x428473,_0x4c018c['options']);return db[_0xc182('0x3e')][_0xc182('0x45')](_0x428473)[_0xc182('0x20')](handleEntityNotFound(_0x2159da,null))['then'](respondWithResult(_0x2159da,null))[_0xc182('0x46')](handleError(_0x2159da,null));};exports[_0xc182('0x47')]=function(_0x2b3633,_0x461a4d){return db[_0xc182('0x3e')][_0xc182('0x47')](_0x2b3633['body'],{})['then'](respondWithResult(_0x461a4d,0xc9))[_0xc182('0x46')](handleError(_0x461a4d,null));};exports[_0xc182('0x48')]=function(_0x45bda5,_0x4553f9){if(_0x45bda5['body']['id']){delete _0x45bda5['body']['id'];}return db[_0xc182('0x3e')][_0xc182('0x45')]({'where':{'id':_0x45bda5[_0xc182('0x42')]['id']}})[_0xc182('0x20')](handleEntityNotFound(_0x4553f9,null))[_0xc182('0x20')](saveUpdates(_0x45bda5['body'],null))['then'](respondWithResult(_0x4553f9,null))[_0xc182('0x46')](handleError(_0x4553f9,null));};exports[_0xc182('0x21')]=function(_0x3ed628,_0xa4f48d){return db[_0xc182('0x3e')][_0xc182('0x45')]({'where':{'id':_0x3ed628[_0xc182('0x42')]['id']}})[_0xc182('0x20')](handleEntityNotFound(_0xa4f48d,null))[_0xc182('0x20')](removeEntity(_0xa4f48d,null))['catch'](handleError(_0xa4f48d,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2f24b5e..3e04036 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 _0x0c7f=['path','../../config/environment','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x0c7f,0x162));var _0xf0c7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0c7f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf0c7('0x0'));var util=require(_0xf0c7('0x1'));var logger=require(_0xf0c7('0x2'))(_0xf0c7('0x3'));var moment=require('moment');var BPromise=require(_0xf0c7('0x4'));var rp=require(_0xf0c7('0x5'));var fs=require('fs');var path=require(_0xf0c7('0x6'));var rimraf=require('rimraf');var config=require(_0xf0c7('0x7'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0xff7039,_0x3bb885){return _0xff7039['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e85=['cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x3834bc,_0x3ed661){var _0x277827=function(_0x47e5b6){while(--_0x47e5b6){_0x3834bc['push'](_0x3834bc['shift']());}};_0x277827(++_0x3ed661);}(_0x8e85,0x12d));var _0x58e8=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x8e85[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x58e8('0x0'));var util=require(_0x58e8('0x1'));var logger=require(_0x58e8('0x2'))('api');var moment=require(_0x58e8('0x3'));var BPromise=require(_0x58e8('0x4'));var rp=require(_0x58e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58e8('0x6'));var config=require(_0x58e8('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x58e8('0x8')]=function(_0x1e8f1f,_0x231484){return _0x1e8f1f[_0x58e8('0x9')](_0x58e8('0xa'),attributes,{'tableName':_0x58e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 77f6ee4..172ddaf 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 _0x8839=['client','http','request','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CloudProvider,\x20%s,\x20%s','result','catch','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x259ce8,_0x798276){var _0x5ef5c2=function(_0x1bb84e){while(--_0x1bb84e){_0x259ce8['push'](_0x259ce8['shift']());}};_0x5ef5c2(++_0x798276);}(_0x8839,0x1d5));var _0x9883=function(_0x470caf,_0x3f28d5){_0x470caf=_0x470caf-0x0;var _0x3b30d4=_0x8839[_0x470caf];return _0x3b30d4;};'use strict';var _=require('lodash');var util=require(_0x9883('0x0'));var moment=require('moment');var BPromise=require(_0x9883('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9883('0x2'));var logger=require(_0x9883('0x3'))(_0x9883('0x4'));var config=require('../../config/environment');var jayson=require(_0x9883('0x5'));var client=jayson[_0x9883('0x6')][_0x9883('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x478c8e,_0x32c0cc,_0x4a995f){return new BPromise(function(_0x29e8d9,_0x5d34e1){return client[_0x9883('0x8')](_0x478c8e,_0x4a995f)['then'](function(_0x487ac0){logger[_0x9883('0x9')]('CloudProvider,\x20%s,\x20%s',_0x32c0cc,'request\x20sent');logger[_0x9883('0xa')](_0x9883('0xb'),_0x32c0cc,_0x9883('0xc'),JSON['stringify'](_0x487ac0));if(_0x487ac0[_0x9883('0xd')]){if(_0x487ac0[_0x9883('0xd')][_0x9883('0xe')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x32c0cc,_0x487ac0[_0x9883('0xd')][_0x9883('0xf')]);return _0x5d34e1(_0x487ac0[_0x9883('0xd')][_0x9883('0xf')]);}logger[_0x9883('0xd')]('CloudProvider,\x20%s,\x20%s',_0x32c0cc,_0x487ac0[_0x9883('0xd')]['message']);return _0x29e8d9(_0x487ac0[_0x9883('0xd')]['message']);}else{logger[_0x9883('0x9')](_0x9883('0x10'),_0x32c0cc,_0x9883('0xc'));_0x29e8d9(_0x487ac0[_0x9883('0x11')]['message']);}})[_0x9883('0x12')](function(_0x6a13bf){logger[_0x9883('0xd')]('CloudProvider,\x20%s,\x20%s',_0x32c0cc,_0x6a13bf);_0x5d34e1(_0x6a13bf);});});} \ No newline at end of file +var _0x5f59=['request','then','info','debug','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x23f0dc,_0x525f0a){var _0x55cdf2=function(_0x3d5943){while(--_0x3d5943){_0x23f0dc['push'](_0x23f0dc['shift']());}};_0x55cdf2(++_0x525f0a);}(_0x5f59,0x14c));var _0x95f5=function(_0x2403e0,_0x4c5e94){_0x2403e0=_0x2403e0-0x0;var _0x49a18c=_0x5f59[_0x2403e0];return _0x49a18c;};'use strict';var _=require('lodash');var util=require(_0x95f5('0x0'));var moment=require('moment');var BPromise=require(_0x95f5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95f5('0x2'));var db=require(_0x95f5('0x3'))['db'];var utils=require(_0x95f5('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x95f5('0x5'));var client=jayson[_0x95f5('0x6')][_0x95f5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d7672,_0x1e48d7,_0x3c5ce1){return new BPromise(function(_0x607f29,_0x4dfb19){return client[_0x95f5('0x8')](_0x5d7672,_0x3c5ce1)[_0x95f5('0x9')](function(_0x151900){logger[_0x95f5('0xa')]('CloudProvider,\x20%s,\x20%s',_0x1e48d7,'request\x20sent');logger[_0x95f5('0xb')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1e48d7,_0x95f5('0xc'),JSON[_0x95f5('0xd')](_0x151900));if(_0x151900[_0x95f5('0xe')]){if(_0x151900['error'][_0x95f5('0xf')]===0x1f4){logger[_0x95f5('0xe')](_0x95f5('0x10'),_0x1e48d7,_0x151900[_0x95f5('0xe')][_0x95f5('0x11')]);return _0x4dfb19(_0x151900[_0x95f5('0xe')][_0x95f5('0x11')]);}logger[_0x95f5('0xe')](_0x95f5('0x10'),_0x1e48d7,_0x151900[_0x95f5('0xe')][_0x95f5('0x11')]);return _0x607f29(_0x151900[_0x95f5('0xe')][_0x95f5('0x11')]);}else{logger['info'](_0x95f5('0x10'),_0x1e48d7,_0x95f5('0xc'));_0x607f29(_0x151900[_0x95f5('0x12')][_0x95f5('0x11')]);}})[_0x95f5('0x13')](function(_0x12d65a){logger[_0x95f5('0xe')](_0x95f5('0x10'),_0x1e48d7,_0x12d65a);_0x4dfb19(_0x12d65a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c763fdc..8643c31 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 _0x8314=['isAuthenticated','index','/:id','show','create','delete','destroy','multer','util','express','../../components/auth/service','../../config/environment','./cloudProvider.controller','get'];(function(_0x2e4733,_0x2adff9){var _0x1ebab4=function(_0x1323cb){while(--_0x1323cb){_0x2e4733['push'](_0x2e4733['shift']());}};_0x1ebab4(++_0x2adff9);}(_0x8314,0xbd));var _0x4831=function(_0x42b70c,_0x5c7579){_0x42b70c=_0x42b70c-0x0;var _0x3a1173=_0x8314[_0x42b70c];return _0x3a1173;};'use strict';var multer=require(_0x4831('0x0'));var util=require(_0x4831('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4831('0x2'));var router=express['Router']();var auth=require(_0x4831('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4831('0x4'));var controller=require(_0x4831('0x5'));router[_0x4831('0x6')]('/',auth[_0x4831('0x7')](),controller[_0x4831('0x8')]);router['get'](_0x4831('0x9'),auth[_0x4831('0x7')](),controller[_0x4831('0xa')]);router['post']('/',auth[_0x4831('0x7')](),controller[_0x4831('0xb')]);router['put'](_0x4831('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4831('0xc')](_0x4831('0x9'),auth[_0x4831('0x7')](),controller[_0x4831('0xd')]);module['exports']=router; \ No newline at end of file +var _0xbcf3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','util','path','connect-timeout','express'];(function(_0x12c03c,_0x6ead70){var _0xf72aa9=function(_0x1afddb){while(--_0x1afddb){_0x12c03c['push'](_0x12c03c['shift']());}};_0xf72aa9(++_0x6ead70);}(_0xbcf3,0x1c7));var _0x3bcf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbcf3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x3bcf('0x0'));var path=require(_0x3bcf('0x1'));var timeout=require(_0x3bcf('0x2'));var express=require(_0x3bcf('0x3'));var router=express['Router']();var auth=require(_0x3bcf('0x4'));var interaction=require(_0x3bcf('0x5'));var config=require(_0x3bcf('0x6'));var controller=require(_0x3bcf('0x7'));router[_0x3bcf('0x8')]('/',auth[_0x3bcf('0x9')](),controller[_0x3bcf('0xa')]);router['get'](_0x3bcf('0xb'),auth['isAuthenticated'](),controller[_0x3bcf('0xc')]);router[_0x3bcf('0xd')]('/',auth[_0x3bcf('0x9')](),controller['create']);router[_0x3bcf('0xe')](_0x3bcf('0xb'),auth['isAuthenticated'](),controller[_0x3bcf('0xf')]);router['delete']('/:id',auth[_0x3bcf('0x9')](),controller[_0x3bcf('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7b04ebe..942887f 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 _0xfc29=['exports','STRING','name','sequelize'];(function(_0x49d622,_0x594a0b){var _0x7c523d=function(_0x189ed4){while(--_0x189ed4){_0x49d622['push'](_0x49d622['shift']());}};_0x7c523d(++_0x594a0b);}(_0xfc29,0xbf));var _0x9fc2=function(_0x3ef8b5,_0x496a36){_0x3ef8b5=_0x3ef8b5-0x0;var _0x595f22=_0xfc29[_0x3ef8b5];return _0x595f22;};'use strict';var Sequelize=require(_0x9fc2('0x0'));module[_0x9fc2('0x1')]={'name':{'type':Sequelize[_0x9fc2('0x2')],'unique':_0x9fc2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x9fc2('0x2')]},'website':{'type':Sequelize[_0x9fc2('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9fc2('0x2')]},'type':{'type':Sequelize[_0x9fc2('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9fc2('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9fc2('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9fc2('0x2')]},'sStreet':{'type':Sequelize[_0x9fc2('0x2')]},'sPostalCode':{'type':Sequelize[_0x9fc2('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x9fc2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5924=['name','sequelize','exports','STRING'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5924,0x101));var _0x4592=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0x5924[_0x1265fa];return _0x1fe35e;};'use strict';var Sequelize=require(_0x4592('0x0'));module[_0x4592('0x1')]={'name':{'type':Sequelize[_0x4592('0x2')],'unique':_0x4592('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4592('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x4592('0x2')]},'phone':{'type':Sequelize[_0x4592('0x2')]},'fax':{'type':Sequelize[_0x4592('0x2')]},'type':{'type':Sequelize[_0x4592('0x2')]},'street':{'type':Sequelize[_0x4592('0x2')]},'postalCode':{'type':Sequelize[_0x4592('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4592('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4592('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x4592('0x2')]},'sCity':{'type':Sequelize[_0x4592('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4592('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 37c9833..f318955 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 _0xb9d1=['json','count','offset','set','Content-Range','reject','save','then','get','Companies','UserProfileResource','sendStatus','error','name','send','index','CmCompany','describe','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','map','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addContacts','CmContact','ids','omit','getContacts','findOne','length','options','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x56e4c4,_0x18da67){var _0x1136d1=function(_0x3f7bbe){while(--_0x3f7bbe){_0x56e4c4['push'](_0x56e4c4['shift']());}};_0x1136d1(++_0x18da67);}(_0xb9d1,0xea));var _0x1b9d=function(_0x5991fc,_0x24a425){_0x5991fc=_0x5991fc-0x0;var _0x2c4646=_0xb9d1[_0x5991fc];return _0x2c4646;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b9d('0x0'));var rimraf=require(_0x1b9d('0x1'));var zipdir=require(_0x1b9d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b9d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b9d('0x4'));var util=require(_0x1b9d('0x5'));var path=require('path');var sox=require(_0x1b9d('0x6'));var csv=require(_0x1b9d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b9d('0x8'));var squel=require(_0x1b9d('0x9'));var crypto=require(_0x1b9d('0xa'));var jsforce=require(_0x1b9d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1b9d('0x7'));var querystring=require(_0x1b9d('0xc'));var Papa=require(_0x1b9d('0xd'));var Redis=require(_0x1b9d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1b9d('0xf'));var as=require(_0x1b9d('0x10'));var hardwareService=require(_0x1b9d('0x11'));var logger=require('../../config/logger')(_0x1b9d('0x12'));var utils=require(_0x1b9d('0x13'));var config=require(_0x1b9d('0x14'));var db=require(_0x1b9d('0x15'))['db'];function respondWithStatusCode(_0x2a3f73,_0x57eebe){_0x57eebe=_0x57eebe||0xcc;return function(_0x51b221){if(_0x51b221){return _0x2a3f73['sendStatus'](_0x57eebe);}return _0x2a3f73[_0x1b9d('0x16')](_0x57eebe)[_0x1b9d('0x17')]();};}function respondWithResult(_0x43bd6e,_0x53279b){_0x53279b=_0x53279b||0xc8;return function(_0x336ff6){if(_0x336ff6){return _0x43bd6e[_0x1b9d('0x16')](_0x53279b)[_0x1b9d('0x18')](_0x336ff6);}};}function respondWithFilteredResult(_0x547a87,_0x50738b){return function(_0x57bc57){if(_0x57bc57){var _0x50f9b4=_0x57bc57[_0x1b9d('0x19')],_0x20ce5e=_0x50738b[_0x1b9d('0x1a')],_0x46cf15=_0x50738b[_0x1b9d('0x1a')]+_0x50738b['limit'],_0x100fa3;if(_0x46cf15>=_0x50f9b4){_0x46cf15=_0x50f9b4;_0x100fa3=0xc8;}else{_0x100fa3=0xce;}_0x547a87['status'](_0x100fa3);return _0x547a87[_0x1b9d('0x1b')](_0x1b9d('0x1c'),_0x20ce5e+'-'+_0x46cf15+'/'+_0x50f9b4)['json'](_0x57bc57);}return null;};}function patchUpdates(_0x3c6d3a){return function(_0x3712c6){try{jsonpatch['apply'](_0x3712c6,_0x3c6d3a,!![]);}catch(_0x9b137d){return BPromise[_0x1b9d('0x1d')](_0x9b137d);}return _0x3712c6[_0x1b9d('0x1e')]();};}function saveUpdates(_0x2c7587,_0x2940a0){return function(_0x42ed0b){if(_0x42ed0b){return _0x42ed0b['update'](_0x2c7587)[_0x1b9d('0x1f')](function(_0x45660b){return _0x45660b;});}return null;};}function removeEntity(_0x52e8a2,_0x1fe7ff){return function(_0x2e5d20){if(_0x2e5d20){return _0x2e5d20['destroy']()[_0x1b9d('0x1f')](function(){var _0x21bddf=_0x2e5d20[_0x1b9d('0x20')]({'plain':!![]});var _0x46d89c=_0x1b9d('0x21');return db[_0x1b9d('0x22')]['destroy']({'where':{'type':_0x46d89c,'resourceId':_0x21bddf['id']}})[_0x1b9d('0x1f')](function(){return _0x2e5d20;});})[_0x1b9d('0x1f')](function(){_0x52e8a2[_0x1b9d('0x16')](0xcc)[_0x1b9d('0x17')]();});}};}function handleEntityNotFound(_0x14cbf7,_0x3b0b9e){return function(_0x409af7){if(!_0x409af7){_0x14cbf7[_0x1b9d('0x23')](0x194);}return _0x409af7;};}function handleError(_0xa400c8,_0x17d0c0){_0x17d0c0=_0x17d0c0||0x1f4;return function(_0x3d989c){logger[_0x1b9d('0x24')](_0x3d989c['stack']);if(_0x3d989c['name']){delete _0x3d989c[_0x1b9d('0x25')];}_0xa400c8[_0x1b9d('0x16')](_0x17d0c0)[_0x1b9d('0x26')](_0x3d989c);};}exports[_0x1b9d('0x27')]=function(_0x560848,_0xf7452e){var _0xff36ad={},_0x15108d={},_0x328683={'count':0x0,'rows':[]};return db[_0x1b9d('0x28')][_0x1b9d('0x29')]()[_0x1b9d('0x1f')](function(_0x177a03){_0x15108d[_0x1b9d('0x2a')]=_[_0x1b9d('0x2b')](_0x177a03);_0x15108d[_0x1b9d('0x2c')]=_[_0x1b9d('0x2b')](_0x560848[_0x1b9d('0x2c')]);_0x15108d['filters']=_[_0x1b9d('0x2d')](_0x15108d[_0x1b9d('0x2a')],_0x15108d[_0x1b9d('0x2c')]);_0xff36ad['attributes']=_[_0x1b9d('0x2d')](_0x15108d[_0x1b9d('0x2a')],qs[_0x1b9d('0x2e')](_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x2e')]));_0xff36ad['attributes']=_0xff36ad[_0x1b9d('0x2f')]['length']?_0xff36ad[_0x1b9d('0x2f')]:_0x15108d[_0x1b9d('0x2a')];if(!_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x30')](_0x1b9d('0x31'))){_0xff36ad[_0x1b9d('0x32')]=qs[_0x1b9d('0x32')](_0x560848['query'][_0x1b9d('0x32')]);_0xff36ad[_0x1b9d('0x1a')]=qs[_0x1b9d('0x1a')](_0x560848['query'][_0x1b9d('0x1a')]);}_0xff36ad[_0x1b9d('0x33')]=qs[_0x1b9d('0x34')](_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x34')]);_0xff36ad[_0x1b9d('0x35')]=qs[_0x1b9d('0x36')](_[_0x1b9d('0x37')](_0x560848['query'],_0x15108d[_0x1b9d('0x36')]),_0x177a03);if(_0x560848[_0x1b9d('0x2c')]['filter']){_0xff36ad[_0x1b9d('0x35')]=_[_0x1b9d('0x38')](_0xff36ad[_0x1b9d('0x35')],{'$or':_[_0x1b9d('0x39')](_0xff36ad[_0x1b9d('0x2f')],function(_0x5837c0){var _0x8b7451={};_0x8b7451[_0x5837c0]={'$like':'%'+_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x3a')]+'%'};return _0x8b7451;})});}_0xff36ad=_[_0x1b9d('0x38')]({},_0xff36ad,_0x560848['options']);var _0x4fb9ea={'where':_0xff36ad[_0x1b9d('0x35')]};return db['CmCompany'][_0x1b9d('0x19')](_0x4fb9ea)[_0x1b9d('0x1f')](function(_0x55c9f8){_0x328683['count']=_0x55c9f8;if(_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x3b')]){_0xff36ad[_0x1b9d('0x3c')]=[{'all':!![]}];}return db[_0x1b9d('0x28')][_0x1b9d('0x3d')](_0xff36ad);})['then'](function(_0xfb3736){_0x328683[_0x1b9d('0x3e')]=_0xfb3736;return _0x328683;})[_0x1b9d('0x1f')](respondWithFilteredResult(_0xf7452e,_0xff36ad))[_0x1b9d('0x3f')](handleError(_0xf7452e,null));})[_0x1b9d('0x3f')](handleError(_0xf7452e,null));};exports[_0x1b9d('0x40')]=function(_0x46d32c,_0xa6fc5){var _0xec7013={'raw':![],'where':{'id':_0x46d32c[_0x1b9d('0x41')]['id']}},_0x343470={};_0x343470['model']=_['keys'](db[_0x1b9d('0x28')][_0x1b9d('0x42')]);_0x343470[_0x1b9d('0x2c')]=_[_0x1b9d('0x2b')](_0x46d32c[_0x1b9d('0x2c')]);_0x343470[_0x1b9d('0x36')]=_[_0x1b9d('0x2d')](_0x343470[_0x1b9d('0x2a')],_0x343470['query']);_0xec7013[_0x1b9d('0x2f')]=_['intersection'](_0x343470[_0x1b9d('0x2a')],qs[_0x1b9d('0x2e')](_0x46d32c[_0x1b9d('0x2c')][_0x1b9d('0x2e')]));_0xec7013['attributes']=_0xec7013[_0x1b9d('0x2f')]['length']?_0xec7013[_0x1b9d('0x2f')]:_0x343470[_0x1b9d('0x2a')];if(_0x46d32c['query'][_0x1b9d('0x3b')]){_0xec7013['include']=[{'all':!![]}];}_0xec7013=_[_0x1b9d('0x38')]({},_0xec7013,_0x46d32c['options']);return db['CmCompany'][_0x1b9d('0x43')](_0xec7013)['then'](handleEntityNotFound(_0xa6fc5,null))['then'](respondWithResult(_0xa6fc5,null))[_0x1b9d('0x3f')](handleError(_0xa6fc5,null));};exports['create']=function(_0x1743b8,_0xeee9eb){return db[_0x1b9d('0x28')][_0x1b9d('0x44')](_0x1743b8[_0x1b9d('0x45')],{})[_0x1b9d('0x1f')](function(_0x40de83){var _0x3b5b49=_0x1743b8[_0x1b9d('0x46')][_0x1b9d('0x20')]({'plain':!![]});if(!_0x3b5b49)throw new Error(_0x1b9d('0x47'));if(_0x3b5b49[_0x1b9d('0x48')]===_0x1b9d('0x46')){var _0x5226a0=_0x40de83['get']({'plain':!![]});var _0x3a784f=_0x1b9d('0x21');return db[_0x1b9d('0x49')][_0x1b9d('0x43')]({'where':{'name':_0x3a784f,'userProfileId':_0x3b5b49['userProfileId']},'raw':!![]})[_0x1b9d('0x1f')](function(_0x4f92b8){if(_0x4f92b8&&_0x4f92b8[_0x1b9d('0x4a')]===0x0){return db[_0x1b9d('0x22')][_0x1b9d('0x44')]({'name':_0x5226a0[_0x1b9d('0x25')],'resourceId':_0x5226a0['id'],'type':_0x4f92b8[_0x1b9d('0x25')],'sectionId':_0x4f92b8['id']},{})[_0x1b9d('0x1f')](function(){return _0x40de83;});}else{return _0x40de83;}})['catch'](function(_0x4833b3){logger[_0x1b9d('0x24')](_0x1b9d('0x4b'),_0x4833b3);throw _0x4833b3;});}return _0x40de83;})[_0x1b9d('0x1f')](respondWithResult(_0xeee9eb,0xc9))[_0x1b9d('0x3f')](handleError(_0xeee9eb,null));};exports[_0x1b9d('0x4c')]=function(_0x2d6f0f,_0x3ae85d){if(_0x2d6f0f[_0x1b9d('0x45')]['id']){delete _0x2d6f0f[_0x1b9d('0x45')]['id'];}return db[_0x1b9d('0x28')][_0x1b9d('0x43')]({'where':{'id':_0x2d6f0f['params']['id']}})[_0x1b9d('0x1f')](handleEntityNotFound(_0x3ae85d,null))[_0x1b9d('0x1f')](saveUpdates(_0x2d6f0f[_0x1b9d('0x45')],null))[_0x1b9d('0x1f')](respondWithResult(_0x3ae85d,null))[_0x1b9d('0x3f')](handleError(_0x3ae85d,null));};exports[_0x1b9d('0x4d')]=function(_0x520f99,_0x550248){return db[_0x1b9d('0x28')]['find']({'where':{'id':_0x520f99[_0x1b9d('0x41')]['id']}})[_0x1b9d('0x1f')](handleEntityNotFound(_0x550248,null))[_0x1b9d('0x1f')](removeEntity(_0x550248,null))[_0x1b9d('0x3f')](handleError(_0x550248,null));};exports['describe']=function(_0xfdf7cd,_0x10147c){return db[_0x1b9d('0x28')][_0x1b9d('0x29')]()[_0x1b9d('0x1f')](respondWithResult(_0x10147c,null))[_0x1b9d('0x3f')](handleError(_0x10147c,null));};exports[_0x1b9d('0x4e')]=function(_0x528ad8,_0x9f41f1,_0x1fc3a9){return db[_0x1b9d('0x4f')][_0x1b9d('0x43')]({'where':{'id':_0x528ad8[_0x1b9d('0x41')]['id']}})['then'](handleEntityNotFound(_0x9f41f1,null))['then'](function(_0x22df1f){if(_0x22df1f){return _0x22df1f[_0x1b9d('0x4e')](_0x528ad8[_0x1b9d('0x45')][_0x1b9d('0x50')],_[_0x1b9d('0x51')](_0x528ad8[_0x1b9d('0x45')],['ids','id'])||{});}})[_0x1b9d('0x1f')](respondWithResult(_0x9f41f1,null))[_0x1b9d('0x3f')](handleError(_0x9f41f1,null));};exports[_0x1b9d('0x52')]=function(_0x48014e,_0x4d353f,_0x294ea3){var _0x3c3fcf={};var _0x24adec={};var _0x1d3f3a;var _0x32dd11;return db[_0x1b9d('0x28')][_0x1b9d('0x53')]({'where':{'id':_0x48014e['params']['id']}})[_0x1b9d('0x1f')](handleEntityNotFound(_0x4d353f,null))[_0x1b9d('0x1f')](function(_0x28c91c){if(_0x28c91c){_0x1d3f3a=_0x28c91c;_0x24adec[_0x1b9d('0x2a')]=_['keys'](db['CmContact'][_0x1b9d('0x42')]);_0x24adec[_0x1b9d('0x2c')]=_['keys'](_0x48014e[_0x1b9d('0x2c')]);_0x24adec[_0x1b9d('0x36')]=_[_0x1b9d('0x2d')](_0x24adec[_0x1b9d('0x2a')],_0x24adec[_0x1b9d('0x2c')]);_0x3c3fcf[_0x1b9d('0x2f')]=_[_0x1b9d('0x2d')](_0x24adec[_0x1b9d('0x2a')],qs['fields'](_0x48014e[_0x1b9d('0x2c')]['fields']));_0x3c3fcf['attributes']=_0x3c3fcf[_0x1b9d('0x2f')][_0x1b9d('0x54')]?_0x3c3fcf[_0x1b9d('0x2f')]:_0x24adec[_0x1b9d('0x2a')];_0x3c3fcf[_0x1b9d('0x33')]=qs[_0x1b9d('0x34')](_0x48014e[_0x1b9d('0x2c')][_0x1b9d('0x34')]);_0x3c3fcf[_0x1b9d('0x35')]=qs['filters'](_[_0x1b9d('0x37')](_0x48014e['query'],_0x24adec['filters']));if(_0x48014e[_0x1b9d('0x2c')][_0x1b9d('0x3a')]){_0x3c3fcf[_0x1b9d('0x35')]=_['merge'](_0x3c3fcf[_0x1b9d('0x35')],{'$or':_[_0x1b9d('0x39')](_0x3c3fcf[_0x1b9d('0x2f')],function(_0x4cc4dc){var _0x3ba64c={};_0x3ba64c[_0x4cc4dc]={'$like':'%'+_0x48014e['query'][_0x1b9d('0x3a')]+'%'};return _0x3ba64c;})});}_0x3c3fcf=_[_0x1b9d('0x38')]({},_0x3c3fcf,_0x48014e[_0x1b9d('0x55')]);return _0x1d3f3a[_0x1b9d('0x52')](_0x3c3fcf);}})[_0x1b9d('0x1f')](function(_0x334e1e){if(_0x334e1e){_0x32dd11=_0x334e1e[_0x1b9d('0x54')];if(!_0x48014e[_0x1b9d('0x2c')]['hasOwnProperty'](_0x1b9d('0x31'))){_0x3c3fcf[_0x1b9d('0x32')]=qs[_0x1b9d('0x32')](_0x48014e[_0x1b9d('0x2c')][_0x1b9d('0x32')]);_0x3c3fcf[_0x1b9d('0x1a')]=qs['offset'](_0x48014e['query'][_0x1b9d('0x1a')]);}return _0x1d3f3a[_0x1b9d('0x52')](_0x3c3fcf);}})[_0x1b9d('0x1f')](function(_0x5601da){if(_0x5601da){return _0x5601da?{'count':_0x32dd11,'rows':_0x5601da}:null;}})['then'](respondWithResult(_0x4d353f,null))[_0x1b9d('0x3f')](handleError(_0x4d353f,null));}; \ No newline at end of file +var _0x591c=['../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','find','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','ids','omit','getContacts','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x4d616a,_0x1350fc){var _0x2281c8=function(_0x1019c3){while(--_0x1019c3){_0x4d616a['push'](_0x4d616a['shift']());}};_0x2281c8(++_0x1350fc);}(_0x591c,0x1ea));var _0xc591=function(_0x5ea43a,_0x160212){_0x5ea43a=_0x5ea43a-0x0;var _0x4af94a=_0x591c[_0x5ea43a];return _0x4af94a;};'use strict';var pdf=require(_0xc591('0x0'));var emlformat=require(_0xc591('0x1'));var rimraf=require(_0xc591('0x2'));var zipdir=require(_0xc591('0x3'));var jsonpatch=require(_0xc591('0x4'));var rp=require(_0xc591('0x5'));var moment=require('moment');var BPromise=require(_0xc591('0x6'));var Mustache=require(_0xc591('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc591('0x8'));var fs=require('fs');var _=require(_0xc591('0x9'));var squel=require('squel');var crypto=require(_0xc591('0xa'));var jsforce=require(_0xc591('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc591('0xc'));var querystring=require(_0xc591('0xd'));var Papa=require('papaparse');var Redis=require(_0xc591('0xe'));var authService=require(_0xc591('0xf'));var qs=require(_0xc591('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc591('0x11'));var logger=require(_0xc591('0x12'))(_0xc591('0x13'));var utils=require(_0xc591('0x14'));var config=require(_0xc591('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8e1a,_0x2ff0d4){_0x2ff0d4=_0x2ff0d4||0xcc;return function(_0x3d363a){if(_0x3d363a){return _0x2a8e1a[_0xc591('0x16')](_0x2ff0d4);}return _0x2a8e1a[_0xc591('0x17')](_0x2ff0d4)['end']();};}function respondWithResult(_0x555a08,_0x392e9c){_0x392e9c=_0x392e9c||0xc8;return function(_0x38592f){if(_0x38592f){return _0x555a08[_0xc591('0x17')](_0x392e9c)[_0xc591('0x18')](_0x38592f);}};}function respondWithFilteredResult(_0x4fef93,_0x3b034d){return function(_0x1836aa){if(_0x1836aa){var _0x5cbeeb=_0x1836aa['count'],_0x3f64a1=_0x3b034d['offset'],_0x5bc9ab=_0x3b034d[_0xc591('0x19')]+_0x3b034d[_0xc591('0x1a')],_0x5cc4a0;if(_0x5bc9ab>=_0x5cbeeb){_0x5bc9ab=_0x5cbeeb;_0x5cc4a0=0xc8;}else{_0x5cc4a0=0xce;}_0x4fef93[_0xc591('0x17')](_0x5cc4a0);return _0x4fef93[_0xc591('0x1b')](_0xc591('0x1c'),_0x3f64a1+'-'+_0x5bc9ab+'/'+_0x5cbeeb)['json'](_0x1836aa);}return null;};}function patchUpdates(_0x1b45f5){return function(_0x37ff5e){try{jsonpatch[_0xc591('0x1d')](_0x37ff5e,_0x1b45f5,!![]);}catch(_0x29f34c){return BPromise[_0xc591('0x1e')](_0x29f34c);}return _0x37ff5e[_0xc591('0x1f')]();};}function saveUpdates(_0xea60b4,_0x8d142b){return function(_0x16b89b){if(_0x16b89b){return _0x16b89b[_0xc591('0x20')](_0xea60b4)[_0xc591('0x21')](function(_0x2b94ba){return _0x2b94ba;});}return null;};}function removeEntity(_0xc81dbf,_0x5900fd){return function(_0x3e3811){if(_0x3e3811){return _0x3e3811[_0xc591('0x22')]()['then'](function(){var _0x4e0ecd=_0x3e3811['get']({'plain':!![]});var _0x4223ae='Companies';return db['UserProfileResource'][_0xc591('0x22')]({'where':{'type':_0x4223ae,'resourceId':_0x4e0ecd['id']}})[_0xc591('0x21')](function(){return _0x3e3811;});})[_0xc591('0x21')](function(){_0xc81dbf[_0xc591('0x17')](0xcc)[_0xc591('0x23')]();});}};}function handleEntityNotFound(_0x4064a5,_0x19d25d){return function(_0x14d72b){if(!_0x14d72b){_0x4064a5[_0xc591('0x16')](0x194);}return _0x14d72b;};}function handleError(_0x3d4753,_0x3e3c16){_0x3e3c16=_0x3e3c16||0x1f4;return function(_0x5c26e5){logger[_0xc591('0x24')](_0x5c26e5[_0xc591('0x25')]);if(_0x5c26e5['name']){delete _0x5c26e5['name'];}_0x3d4753[_0xc591('0x17')](_0x3e3c16)[_0xc591('0x26')](_0x5c26e5);};}exports[_0xc591('0x27')]=function(_0x4ccc57,_0x5d5c5e){var _0x113f6a={},_0x462f22={},_0x5eff2f={'count':0x0,'rows':[]};return db[_0xc591('0x28')][_0xc591('0x29')]()[_0xc591('0x21')](function(_0x2f38b6){_0x462f22[_0xc591('0x2a')]=_['keys'](_0x2f38b6);_0x462f22['query']=_[_0xc591('0x2b')](_0x4ccc57[_0xc591('0x2c')]);_0x462f22[_0xc591('0x2d')]=_[_0xc591('0x2e')](_0x462f22['model'],_0x462f22[_0xc591('0x2c')]);_0x113f6a['attributes']=_[_0xc591('0x2e')](_0x462f22[_0xc591('0x2a')],qs[_0xc591('0x2f')](_0x4ccc57[_0xc591('0x2c')][_0xc591('0x2f')]));_0x113f6a[_0xc591('0x30')]=_0x113f6a['attributes'][_0xc591('0x31')]?_0x113f6a['attributes']:_0x462f22[_0xc591('0x2a')];if(!_0x4ccc57[_0xc591('0x2c')][_0xc591('0x32')](_0xc591('0x33'))){_0x113f6a['limit']=qs['limit'](_0x4ccc57[_0xc591('0x2c')]['limit']);_0x113f6a[_0xc591('0x19')]=qs[_0xc591('0x19')](_0x4ccc57[_0xc591('0x2c')][_0xc591('0x19')]);}_0x113f6a[_0xc591('0x34')]=qs[_0xc591('0x35')](_0x4ccc57[_0xc591('0x2c')][_0xc591('0x35')]);_0x113f6a[_0xc591('0x36')]=qs[_0xc591('0x2d')](_['pick'](_0x4ccc57['query'],_0x462f22[_0xc591('0x2d')]),_0x2f38b6);if(_0x4ccc57[_0xc591('0x2c')][_0xc591('0x37')]){_0x113f6a[_0xc591('0x36')]=_[_0xc591('0x38')](_0x113f6a[_0xc591('0x36')],{'$or':_[_0xc591('0x39')](_0x113f6a['attributes'],function(_0x5655dd){var _0x54175c={};_0x54175c[_0x5655dd]={'$like':'%'+_0x4ccc57['query']['filter']+'%'};return _0x54175c;})});}_0x113f6a=_[_0xc591('0x38')]({},_0x113f6a,_0x4ccc57[_0xc591('0x3a')]);var _0x4f74f2={'where':_0x113f6a[_0xc591('0x36')]};return db[_0xc591('0x28')][_0xc591('0x3b')](_0x4f74f2)[_0xc591('0x21')](function(_0xcc5c76){_0x5eff2f[_0xc591('0x3b')]=_0xcc5c76;if(_0x4ccc57[_0xc591('0x2c')][_0xc591('0x3c')]){_0x113f6a[_0xc591('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xc591('0x3e')](_0x113f6a);})['then'](function(_0x1df439){_0x5eff2f[_0xc591('0x3f')]=_0x1df439;return _0x5eff2f;})[_0xc591('0x21')](respondWithFilteredResult(_0x5d5c5e,_0x113f6a))['catch'](handleError(_0x5d5c5e,null));})[_0xc591('0x40')](handleError(_0x5d5c5e,null));};exports[_0xc591('0x41')]=function(_0x44a18b,_0x20c9ef){var _0x3cee80={'raw':![],'where':{'id':_0x44a18b[_0xc591('0x42')]['id']}},_0x34ebb7={};_0x34ebb7[_0xc591('0x2a')]=_['keys'](db[_0xc591('0x28')][_0xc591('0x43')]);_0x34ebb7['query']=_[_0xc591('0x2b')](_0x44a18b[_0xc591('0x2c')]);_0x34ebb7[_0xc591('0x2d')]=_[_0xc591('0x2e')](_0x34ebb7[_0xc591('0x2a')],_0x34ebb7[_0xc591('0x2c')]);_0x3cee80[_0xc591('0x30')]=_[_0xc591('0x2e')](_0x34ebb7[_0xc591('0x2a')],qs[_0xc591('0x2f')](_0x44a18b['query']['fields']));_0x3cee80[_0xc591('0x30')]=_0x3cee80[_0xc591('0x30')][_0xc591('0x31')]?_0x3cee80['attributes']:_0x34ebb7[_0xc591('0x2a')];if(_0x44a18b[_0xc591('0x2c')][_0xc591('0x3c')]){_0x3cee80['include']=[{'all':!![]}];}_0x3cee80=_[_0xc591('0x38')]({},_0x3cee80,_0x44a18b[_0xc591('0x3a')]);return db[_0xc591('0x28')]['find'](_0x3cee80)[_0xc591('0x21')](handleEntityNotFound(_0x20c9ef,null))[_0xc591('0x21')](respondWithResult(_0x20c9ef,null))['catch'](handleError(_0x20c9ef,null));};exports[_0xc591('0x44')]=function(_0x19a53b,_0x4e4875){return db[_0xc591('0x28')][_0xc591('0x44')](_0x19a53b[_0xc591('0x45')],{})[_0xc591('0x21')](function(_0x41f969){var _0x159e95=_0x19a53b[_0xc591('0x46')][_0xc591('0x47')]({'plain':!![]});if(!_0x159e95)throw new Error(_0xc591('0x48'));if(_0x159e95['role']===_0xc591('0x46')){var _0x393059=_0x41f969['get']({'plain':!![]});var _0x5314fc=_0xc591('0x49');return db[_0xc591('0x4a')][_0xc591('0x4b')]({'where':{'name':_0x5314fc,'userProfileId':_0x159e95[_0xc591('0x4c')]},'raw':!![]})['then'](function(_0x52beee){if(_0x52beee&&_0x52beee[_0xc591('0x4d')]===0x0){return db['UserProfileResource'][_0xc591('0x44')]({'name':_0x393059[_0xc591('0x4e')],'resourceId':_0x393059['id'],'type':_0x52beee[_0xc591('0x4e')],'sectionId':_0x52beee['id']},{})['then'](function(){return _0x41f969;});}else{return _0x41f969;}})[_0xc591('0x40')](function(_0x54aede){logger[_0xc591('0x24')](_0xc591('0x4f'),_0x54aede);throw _0x54aede;});}return _0x41f969;})['then'](respondWithResult(_0x4e4875,0xc9))[_0xc591('0x40')](handleError(_0x4e4875,null));};exports[_0xc591('0x20')]=function(_0x20852f,_0x267d90){if(_0x20852f[_0xc591('0x45')]['id']){delete _0x20852f[_0xc591('0x45')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x20852f['params']['id']}})[_0xc591('0x21')](handleEntityNotFound(_0x267d90,null))[_0xc591('0x21')](saveUpdates(_0x20852f[_0xc591('0x45')],null))[_0xc591('0x21')](respondWithResult(_0x267d90,null))[_0xc591('0x40')](handleError(_0x267d90,null));};exports[_0xc591('0x22')]=function(_0x3063bf,_0x477399){return db[_0xc591('0x28')]['find']({'where':{'id':_0x3063bf[_0xc591('0x42')]['id']}})[_0xc591('0x21')](handleEntityNotFound(_0x477399,null))[_0xc591('0x21')](removeEntity(_0x477399,null))[_0xc591('0x40')](handleError(_0x477399,null));};exports[_0xc591('0x29')]=function(_0x57992a,_0x3696d4){return db['CmCompany'][_0xc591('0x29')]()['then'](respondWithResult(_0x3696d4,null))[_0xc591('0x40')](handleError(_0x3696d4,null));};exports['addContacts']=function(_0x276812,_0x465162,_0x1e3742){return db[_0xc591('0x50')][_0xc591('0x4b')]({'where':{'id':_0x276812['params']['id']}})['then'](handleEntityNotFound(_0x465162,null))[_0xc591('0x21')](function(_0x4367d8){if(_0x4367d8){return _0x4367d8['addContacts'](_0x276812[_0xc591('0x45')][_0xc591('0x51')],_[_0xc591('0x52')](_0x276812['body'],[_0xc591('0x51'),'id'])||{});}})[_0xc591('0x21')](respondWithResult(_0x465162,null))[_0xc591('0x40')](handleError(_0x465162,null));};exports[_0xc591('0x53')]=function(_0x1e7f06,_0x336103,_0xfa1f3c){var _0x4c6a53={};var _0x461d35={};var _0x1a0b3c;var _0x452665;return db['CmCompany'][_0xc591('0x54')]({'where':{'id':_0x1e7f06[_0xc591('0x42')]['id']}})[_0xc591('0x21')](handleEntityNotFound(_0x336103,null))[_0xc591('0x21')](function(_0x2da9dc){if(_0x2da9dc){_0x1a0b3c=_0x2da9dc;_0x461d35[_0xc591('0x2a')]=_[_0xc591('0x2b')](db[_0xc591('0x50')][_0xc591('0x43')]);_0x461d35[_0xc591('0x2c')]=_[_0xc591('0x2b')](_0x1e7f06['query']);_0x461d35[_0xc591('0x2d')]=_[_0xc591('0x2e')](_0x461d35['model'],_0x461d35[_0xc591('0x2c')]);_0x4c6a53[_0xc591('0x30')]=_[_0xc591('0x2e')](_0x461d35['model'],qs[_0xc591('0x2f')](_0x1e7f06['query'][_0xc591('0x2f')]));_0x4c6a53['attributes']=_0x4c6a53['attributes']['length']?_0x4c6a53[_0xc591('0x30')]:_0x461d35[_0xc591('0x2a')];_0x4c6a53[_0xc591('0x34')]=qs['sort'](_0x1e7f06[_0xc591('0x2c')][_0xc591('0x35')]);_0x4c6a53[_0xc591('0x36')]=qs['filters'](_['pick'](_0x1e7f06[_0xc591('0x2c')],_0x461d35[_0xc591('0x2d')]));if(_0x1e7f06['query'][_0xc591('0x37')]){_0x4c6a53['where']=_[_0xc591('0x38')](_0x4c6a53[_0xc591('0x36')],{'$or':_[_0xc591('0x39')](_0x4c6a53['attributes'],function(_0x53da1d){var _0x396df1={};_0x396df1[_0x53da1d]={'$like':'%'+_0x1e7f06[_0xc591('0x2c')][_0xc591('0x37')]+'%'};return _0x396df1;})});}_0x4c6a53=_[_0xc591('0x38')]({},_0x4c6a53,_0x1e7f06['options']);return _0x1a0b3c[_0xc591('0x53')](_0x4c6a53);}})[_0xc591('0x21')](function(_0x1fe633){if(_0x1fe633){_0x452665=_0x1fe633[_0xc591('0x31')];if(!_0x1e7f06[_0xc591('0x2c')][_0xc591('0x32')](_0xc591('0x33'))){_0x4c6a53[_0xc591('0x1a')]=qs[_0xc591('0x1a')](_0x1e7f06['query'][_0xc591('0x1a')]);_0x4c6a53[_0xc591('0x19')]=qs['offset'](_0x1e7f06[_0xc591('0x2c')][_0xc591('0x19')]);}return _0x1a0b3c['getContacts'](_0x4c6a53);}})[_0xc591('0x21')](function(_0x7a6f6f){if(_0x7a6f6f){return _0x7a6f6f?{'count':_0x452665,'rows':_0x7a6f6f}:null;}})[_0xc591('0x21')](respondWithResult(_0x336103,null))['catch'](handleError(_0x336103,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 1ef11cf..86275d7 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 _0x6ef5=['../../config/logger','api','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','util'];(function(_0x466cc2,_0x5abbb0){var _0x2da337=function(_0x45a434){while(--_0x45a434){_0x466cc2['push'](_0x466cc2['shift']());}};_0x2da337(++_0x5abbb0);}(_0x6ef5,0x121));var _0x56ef=function(_0x57750c,_0x5e74b1){_0x57750c=_0x57750c-0x0;var _0x1ea9be=_0x6ef5[_0x57750c];return _0x1ea9be;};'use strict';var _=require('lodash');var util=require(_0x56ef('0x0'));var logger=require(_0x56ef('0x1'))(_0x56ef('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x56ef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56ef('0x4'));var config=require(_0x56ef('0x5'));var attributes=require(_0x56ef('0x6'));module[_0x56ef('0x7')]=function(_0x5d6c1b,_0x24c31b){return _0x5d6c1b['define'](_0x56ef('0x8'),attributes,{'tableName':_0x56ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe74=['request-promise','path','rimraf','../../config/environment','exports','CmCompany','cm_companies','lodash','../../config/logger'];(function(_0x2bfb87,_0xa5619d){var _0x2a1c65=function(_0xff37c7){while(--_0xff37c7){_0x2bfb87['push'](_0x2bfb87['shift']());}};_0x2a1c65(++_0xa5619d);}(_0xfe74,0xe8));var _0x4fe7=function(_0x5ef592,_0x530678){_0x5ef592=_0x5ef592-0x0;var _0x1d3c77=_0xfe74[_0x5ef592];return _0x1d3c77;};'use strict';var _=require(_0x4fe7('0x0'));var util=require('util');var logger=require(_0x4fe7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4fe7('0x2'));var fs=require('fs');var path=require(_0x4fe7('0x3'));var rimraf=require(_0x4fe7('0x4'));var config=require(_0x4fe7('0x5'));var attributes=require('./cmCompany.attributes');module[_0x4fe7('0x6')]=function(_0x3e3c96,_0x371d14){return _0x3e3c96['define'](_0x4fe7('0x7'),attributes,{'tableName':_0x4fe7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 5bdd747..8c2ee82 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 _0x5779=['code','CmCompany,\x20%s,\x20%s','message','info','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','error'];(function(_0x107836,_0x255ebc){var _0x6946d2=function(_0x220ab6){while(--_0x220ab6){_0x107836['push'](_0x107836['shift']());}};_0x6946d2(++_0x255ebc);}(_0x5779,0x1cf));var _0x9577=function(_0x309606,_0x49545b){_0x309606=_0x309606-0x0;var _0x41dc3b=_0x5779[_0x309606];return _0x41dc3b;};'use strict';var _=require(_0x9577('0x0'));var util=require(_0x9577('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9577('0x2'));var fs=require('fs');var Redis=require(_0x9577('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9577('0x4'));var logger=require('../../config/logger')(_0x9577('0x5'));var config=require(_0x9577('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9577('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ac17c,_0x552d54,_0x3395c7){return new BPromise(function(_0x35eee8,_0x3c251a){return client[_0x9577('0x8')](_0x1ac17c,_0x3395c7)[_0x9577('0x9')](function(_0x61e621){logger['info']('CmCompany,\x20%s,\x20%s',_0x552d54,_0x9577('0xa'));logger[_0x9577('0xb')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x552d54,_0x9577('0xa'),JSON['stringify'](_0x61e621));if(_0x61e621['error']){if(_0x61e621[_0x9577('0xc')][_0x9577('0xd')]===0x1f4){logger[_0x9577('0xc')](_0x9577('0xe'),_0x552d54,_0x61e621[_0x9577('0xc')][_0x9577('0xf')]);return _0x3c251a(_0x61e621[_0x9577('0xc')][_0x9577('0xf')]);}logger['error'](_0x9577('0xe'),_0x552d54,_0x61e621[_0x9577('0xc')][_0x9577('0xf')]);return _0x35eee8(_0x61e621['error']['message']);}else{logger[_0x9577('0x10')](_0x9577('0xe'),_0x552d54,_0x9577('0xa'));_0x35eee8(_0x61e621['result']['message']);}})['catch'](function(_0x19f4d0){logger['error'](_0x9577('0xe'),_0x552d54,_0x19f4d0);_0x3c251a(_0x19f4d0);});});} \ No newline at end of file +var _0x8d79=['request','then','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x8d79,0x12a));var _0x98d7=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8d79[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x98d7('0x0'));var util=require(_0x98d7('0x1'));var moment=require('moment');var BPromise=require(_0x98d7('0x2'));var rs=require(_0x98d7('0x3'));var fs=require('fs');var Redis=require(_0x98d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98d7('0x5'));var logger=require('../../config/logger')(_0x98d7('0x6'));var config=require(_0x98d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x98d7('0x8')][_0x98d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53f4a3,_0xb61a64,_0x5b5031){return new BPromise(function(_0x56f97a,_0x1b18a5){return client[_0x98d7('0xa')](_0x53f4a3,_0x5b5031)[_0x98d7('0xb')](function(_0x34cda7){logger['info']('CmCompany,\x20%s,\x20%s',_0xb61a64,_0x98d7('0xc'));logger['debug'](_0x98d7('0xd'),_0xb61a64,'request\x20sent',JSON[_0x98d7('0xe')](_0x34cda7));if(_0x34cda7[_0x98d7('0xf')]){if(_0x34cda7[_0x98d7('0xf')][_0x98d7('0x10')]===0x1f4){logger[_0x98d7('0xf')](_0x98d7('0x11'),_0xb61a64,_0x34cda7[_0x98d7('0xf')][_0x98d7('0x12')]);return _0x1b18a5(_0x34cda7['error'][_0x98d7('0x12')]);}logger['error'](_0x98d7('0x11'),_0xb61a64,_0x34cda7['error'][_0x98d7('0x12')]);return _0x56f97a(_0x34cda7['error'][_0x98d7('0x12')]);}else{logger[_0x98d7('0x13')](_0x98d7('0x11'),_0xb61a64,'request\x20sent');_0x56f97a(_0x34cda7[_0x98d7('0x14')]['message']);}})[_0x98d7('0x15')](function(_0x115156){logger['error'](_0x98d7('0x11'),_0xb61a64,_0x115156);_0x1b18a5(_0x115156);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 573d1e2..36c2b1a 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 _0x008c=['../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','create','addContacts','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4bbf30,_0x4ed295){var _0x1aeae8=function(_0x5a46ca){while(--_0x5a46ca){_0x4bbf30['push'](_0x4bbf30['shift']());}};_0x1aeae8(++_0x4ed295);}(_0x008c,0x188));var _0xc008=function(_0x28ac84,_0x2a75fa){_0x28ac84=_0x28ac84-0x0;var _0x10c42a=_0x008c[_0x28ac84];return _0x10c42a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['getContacts']);router['post']('/',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0xf'),auth[_0xc008('0xa')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x13')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x14')]=router; \ No newline at end of file +var _0x55ca=['multer','util','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','getContacts','post','create','/:id/contacts','addContacts','put','update','destroy','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x55ca,0x126));var _0xa55c=function(_0x262323,_0x4a81f1){_0x262323=_0x262323-0x0;var _0xa963c3=_0x55ca[_0x262323];return _0xa963c3;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/contacts',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xd')](_0xa55c('0xf'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router[_0xa55c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);module[_0xa55c('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2faa83f..cda0504 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 _0x5a9e=['STRING','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5a9e,0x15b));var _0xe5a9=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0x5a9e[_0x4d8789];return _0x404e41;};'use strict';var _=require(_0xe5a9('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0xe5a9('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe5a9('0x1')]},'street':{'type':Sequelize[_0xe5a9('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe5a9('0x1')]},'country':{'type':Sequelize[_0xe5a9('0x1')]},'dateOfBirth':{'type':Sequelize[_0xe5a9('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xe5a9('0x1')]},'mobile':{'type':Sequelize[_0xe5a9('0x1')]},'fax':{'type':Sequelize[_0xe5a9('0x1')]},'email':{'type':Sequelize[_0xe5a9('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xe5a9('0x1')]},'fb_data':{'type':Sequelize[_0xe5a9('0x1')]},'twitter':{'type':Sequelize[_0xe5a9('0x1')]},'skype':{'type':Sequelize[_0xe5a9('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xe5a9('0x1')]},'telegram':{'type':Sequelize[_0xe5a9('0x1')]},'UserId':{'type':Sequelize[_0xe5a9('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xe5a9('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe5a9('0x4')],'defaultValue':Sequelize[_0xe5a9('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xe5a9('0x2')]}}; \ No newline at end of file +var _0x35fc=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','STRING'];(function(_0x4bdbfe,_0x37655c){var _0x384eba=function(_0x5f15bf){while(--_0x5f15bf){_0x4bdbfe['push'](_0x4bdbfe['shift']());}};_0x384eba(++_0x37655c);}(_0x35fc,0xde));var _0xc35f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x35fc[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xc35f('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0xc35f('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc35f('0x1')]},'street':{'type':Sequelize[_0xc35f('0x1')]},'postalCode':{'type':Sequelize[_0xc35f('0x1')]},'city':{'type':Sequelize[_0xc35f('0x1')]},'country':{'type':Sequelize[_0xc35f('0x1')]},'dateOfBirth':{'type':Sequelize[_0xc35f('0x1')]},'description':{'type':Sequelize[_0xc35f('0x2')]},'phone':{'type':Sequelize[_0xc35f('0x1')]},'mobile':{'type':Sequelize[_0xc35f('0x1')]},'fax':{'type':Sequelize[_0xc35f('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xc35f('0x1')]},'facebook':{'type':Sequelize[_0xc35f('0x1')]},'fb_data':{'type':Sequelize[_0xc35f('0x1')]},'twitter':{'type':Sequelize[_0xc35f('0x1')]},'skype':{'type':Sequelize[_0xc35f('0x1')]},'teams':{'type':Sequelize[_0xc35f('0x1')]},'viber':{'type':Sequelize[_0xc35f('0x1')]},'line':{'type':Sequelize[_0xc35f('0x1')]},'wechat':{'type':Sequelize[_0xc35f('0x1')]},'telegram':{'type':Sequelize[_0xc35f('0x1')]},'UserId':{'type':Sequelize[_0xc35f('0x3')]},'priority':{'type':Sequelize[_0xc35f('0x3')](0x2)[_0xc35f('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc35f('0x5')],'defaultValue':Sequelize[_0xc35f('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e5fa9ab..92cced1 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 _0xcc8c=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmContact','describe','startsWith','cf_','push','CmCustomField','findOne','trimStart','length','type','query','intersection','fields','model','nolimit','limit','order','sort','pick','filters','field','from','select','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','keys','find','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','datetime','castTo','DATE','text','start','end','map','hasOwnProperty','filter','isNil','Contact','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','\x27\x27\x27\x27','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','some','user','sequelize','count','keyBy','attributes','c.phone','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','toString','Tags','rows','destroy','params','catch','tags','displayName','alias','values','columnName','merge','body','findAll','get','mergeWith','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','join','bulkCreate','each','duplicates','$or','show','$and','omit','format','cf_%d','pickBy','table','id\x20=\x20?','phone','getTags','rawAttributes','options','setTags','ids','getHoppers','ContactId','includeAll','getHopperFinals','include','getJscriptySessions','JscriptySessionReport','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','parse','meta','import','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','child_process','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xcc8c,0xd0));var _0xccc8=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0xcc8c[_0x842858];return _0x46c2a2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xccc8('0x0'));var rimraf=require(_0xccc8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccc8('0x2'));var rp=require(_0xccc8('0x3'));var moment=require(_0xccc8('0x4'));var BPromise=require(_0xccc8('0x5'));var Mustache=require(_0xccc8('0x6'));var util=require(_0xccc8('0x7'));var path=require(_0xccc8('0x8'));var sox=require(_0xccc8('0x9'));var csv=require(_0xccc8('0xa'));var ejs=require(_0xccc8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xccc8('0xc'));var crypto=require(_0xccc8('0xd'));var jsforce=require(_0xccc8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xccc8('0xa'));var querystring=require(_0xccc8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xccc8('0x10'));var qs=require(_0xccc8('0x11'));var as=require(_0xccc8('0x12'));var hardwareService=require(_0xccc8('0x13'));var logger=require(_0xccc8('0x14'))(_0xccc8('0x15'));var utils=require(_0xccc8('0x16'));var config=require(_0xccc8('0x17'));var db=require(_0xccc8('0x18'))['db'];config[_0xccc8('0x19')]=_[_0xccc8('0x1a')](config[_0xccc8('0x19')],{'host':_0xccc8('0x1b'),'port':0x18eb});var socket=require(_0xccc8('0x1c'))(new Redis(config[_0xccc8('0x19')]));require('./cmContact.socket')[_0xccc8('0x1d')](socket);function respondWithStatusCode(_0x5e4586,_0x28931d){_0x28931d=_0x28931d||0xcc;return function(_0x58f31d){if(_0x58f31d){return _0x5e4586[_0xccc8('0x1e')](_0x28931d);}return _0x5e4586[_0xccc8('0x1f')](_0x28931d)['end']();};}function respondWithResult(_0x431c24,_0x1c1b12){_0x1c1b12=_0x1c1b12||0xc8;return function(_0x27420b){if(_0x27420b){return _0x431c24[_0xccc8('0x1f')](_0x1c1b12)[_0xccc8('0x20')](_0x27420b);}};}function respondWithFilteredResult(_0xddd17b,_0x2d163f){return function(_0x27fced){if(_0x27fced){var _0x4d72a9=_0x27fced['count'],_0x241db6=_0x2d163f[_0xccc8('0x21')],_0x4a908f=_0x2d163f[_0xccc8('0x21')]+_0x2d163f['limit'],_0x2d5c6b;if(_0x4a908f>=_0x4d72a9){_0x4a908f=_0x4d72a9;_0x2d5c6b=0xc8;}else{_0x2d5c6b=0xce;}_0xddd17b[_0xccc8('0x1f')](_0x2d5c6b);return _0xddd17b[_0xccc8('0x22')](_0xccc8('0x23'),_0x241db6+'-'+_0x4a908f+'/'+_0x4d72a9)[_0xccc8('0x20')](_0x27fced);}return null;};}function patchUpdates(_0x30ff64){return function(_0x28a2e6){try{jsonpatch[_0xccc8('0x24')](_0x28a2e6,_0x30ff64,!![]);}catch(_0x31cb75){return BPromise[_0xccc8('0x25')](_0x31cb75);}return _0x28a2e6[_0xccc8('0x26')]();};}function saveUpdates(_0x308666,_0xecb3b7){return function(_0x352d1a){if(_0x352d1a){return _0x352d1a[_0xccc8('0x27')](_0x308666)[_0xccc8('0x28')](function(_0xc460fc){return _0xc460fc;});}return null;};}function removeEntity(_0x24fcd0,_0xc68f9d){return function(_0x5539a8){if(_0x5539a8){return _0x5539a8['destroy']()[_0xccc8('0x28')](function(){_0x24fcd0[_0xccc8('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bfd17,_0x18c3bb){return function(_0x2692fb){if(!_0x2692fb){_0x4bfd17[_0xccc8('0x1e')](0x194);}return _0x2692fb;};}function handleError(_0x1edc13,_0x69c928){_0x69c928=_0x69c928||0x1f4;return function(_0x3cc072){logger[_0xccc8('0x29')](_0x3cc072[_0xccc8('0x2a')]);if(_0x3cc072[_0xccc8('0x2b')]){delete _0x3cc072[_0xccc8('0x2b')];}_0x1edc13[_0xccc8('0x1f')](_0x69c928)['send'](_0x3cc072);};}exports[_0xccc8('0x2c')]=function(_0x3b548c,_0x233b86){var _0x437ba8={},_0x29ee3a={},_0x4d40e9={'count':0x0,'rows':[]};return db[_0xccc8('0x2d')][_0xccc8('0x2e')]()[_0xccc8('0x28')](function(_0x3121b0){var _0x694f55=[];for(var _0x21e45c=0x0;_0x21e45c0x1){_0x6f1f35['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xccc8('0x72')](_0x24324e),null);}else{if(qs[_0xccc8('0x73')](_0x24324e)){_0x6f1f35['or']('c.id\x20LIKE\x20?',_0x24324e+'%');_0x6f1f35['or'](_0xccc8('0x74'),_0x24324e+'%');_0x6f1f35['or'](_0xccc8('0x75'),_0x24324e+'%');_0x6f1f35['or'](_0xccc8('0x76'),_0x24324e+'%');}else if(qs[_0xccc8('0x77')](_0x24324e)){_0x6f1f35['or']('c.email\x20LIKE\x20?',_0x24324e+'%');}else{_0x6f1f35['or']('c.firstName\x20LIKE\x20?','%'+_0x24324e+'%');_0x6f1f35['or'](_0xccc8('0x78'),'%'+_0x24324e+'%');_0x6f1f35['or']('c.email\x20LIKE\x20?','%'+_0x24324e+'%');}}}}_0x329774[_0xccc8('0x4b')](_0x6f1f35);_0x329774['group']('c.id');var _0x67427={'type':db['Sequelize'][_0xccc8('0x79')][_0xccc8('0x7a')],'raw':!![]};var _0x2fb150=_0x329774[_0xccc8('0x7b')]()[_0xccc8('0x41')]('c.id');if(_0x437ba8['order']){_0x437ba8[_0xccc8('0x3d')]['forEach'](function(_0x11b672){_0x329774['order']('c.'+_0x11b672[0x0],_0x11b672[0x1]===_0xccc8('0x7c')?![]:!![]);});}if(!_[_0xccc8('0x67')](_0x116868)){_0x329774[_0xccc8('0x7d')](_0x39355b);_0x2fb150[_0xccc8('0x4b')](_0xccc8('0x7e'),_0x116868);}BPromise[_0xccc8('0x7f')]()[_0xccc8('0x28')](function(){if(_0x37d8ec&&!_[_0xccc8('0x80')](_0x37d8ec[_0xccc8('0x51')],['field','User'])){return _0x3b548c[_0xccc8('0x81')]['getLists']({'attributes':['id'],'raw':!![]})[_0xccc8('0x28')](function(_0x3680d8){if(_[_0xccc8('0x67')](_0x3680d8)){_0x2fb150[_0xccc8('0x4b')]('c.ListId\x20IS\x20NULL');_0x329774[_0xccc8('0x4b')]('c.ListId\x20IS\x20NULL');}else{_0x2fb150[_0xccc8('0x4b')]('c.ListId\x20IN\x20?',_[_0xccc8('0x62')](_0x3680d8,'id'));_0x329774[_0xccc8('0x4b')](_0xccc8('0x6a'),_[_0xccc8('0x62')](_0x3680d8,'id'));}});}else{return;}})[_0xccc8('0x28')](function(){db[_0xccc8('0x82')][_0xccc8('0x37')](_0x2fb150['toString'](),_0x67427)[_0xccc8('0x28')](function(_0x58b7e7){_0x4d40e9[_0xccc8('0x83')]=_0x58b7e7[_0xccc8('0x35')];if(_0x4d40e9['count']===0x0)return[];return db[_0xccc8('0x82')][_0xccc8('0x37')](_0x56130f['toString'](),_0x67427);})['then'](function(_0x535edb){_0x2ec093=_[_0xccc8('0x84')](_0x535edb,'id');_0x67427=_['merge'](_0x67427,{'model':db[_0xccc8('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3b548c[_0xccc8('0x37')][_0xccc8('0x39')]){_0x437ba8[_0xccc8('0x85')][_0xccc8('0x68')](function(_0x4a256f){_0x329774['field']('c.'+_0x4a256f);});}else{_0x329774[_0xccc8('0x41')]('c.id');_0x329774['field']('c.firstName');_0x329774[_0xccc8('0x41')]('c.lastName');_0x329774[_0xccc8('0x41')](_0xccc8('0x86'));_0x329774[_0xccc8('0x41')](_0xccc8('0x87'));_0x329774[_0xccc8('0x41')](_0xccc8('0x88'));_0x329774['field'](_0xccc8('0x89'));_0x329774[_0xccc8('0x41')](_0xccc8('0x8a'));_0x329774[_0xccc8('0x41')](_0xccc8('0x8b'));_0x329774[_0xccc8('0x41')](_0xccc8('0x8c'),_0xccc8('0x8d'));}if(_0x437ba8[_0xccc8('0x3c')])_0x329774[_0xccc8('0x3c')](_0x437ba8[_0xccc8('0x3c')]);if(_0x437ba8[_0xccc8('0x21')])_0x329774[_0xccc8('0x21')](_0x437ba8[_0xccc8('0x21')]);return db['sequelize'][_0xccc8('0x37')](_0x329774[_0xccc8('0x8e')](),_0x67427);})[_0xccc8('0x28')](function(_0x2ea00c){_0x2ea00c[_0xccc8('0x68')](function(_0x3a4b12){if(_0x3a4b12['TagIds']){_0x3a4b12[_0xccc8('0x8f')]=[];_0x3a4b12[_0xccc8('0x8d')][_0xccc8('0x55')](',')[_0xccc8('0x68')](function(_0x64ac97){_0x3a4b12[_0xccc8('0x8f')][_0xccc8('0x31')](_0x2ec093[_0x64ac97]);});}delete _0x3a4b12[_0xccc8('0x8d')];});_0x4d40e9[_0xccc8('0x90')]=_0x2ea00c;return _0x4d40e9;})[_0xccc8('0x28')](respondWithFilteredResult(_0x233b86,_0x437ba8));});})['catch'](handleError(_0x233b86,null));};exports[_0xccc8('0x91')]=function(_0x558c26,_0x28cceb){return db[_0xccc8('0x2d')][_0xccc8('0x53')]({'where':{'id':_0x558c26[_0xccc8('0x92')]['id']}})[_0xccc8('0x28')](handleEntityNotFound(_0x28cceb,null))['then'](removeEntity(_0x28cceb,null))[_0xccc8('0x93')](handleError(_0x28cceb,null));};exports['describe']=function(_0x1c658b,_0x100822){return db[_0xccc8('0x2d')][_0xccc8('0x2e')]()[_0xccc8('0x28')](function(_0x27a1c2){delete _0x27a1c2[_0xccc8('0x94')];for(var _0x574499=0x0;_0x574499=_0x8792b5){_0x420866=_0x8792b5;_0x335a36=0xc8;}else{_0x335a36=0xce;}_0x2844ef['status'](_0x335a36);return _0x2844ef['set'](_0xdcea('0x22'),_0x5ed507+'-'+_0x420866+'/'+_0x8792b5)['json'](_0x5d8c7f);}return null;};}function patchUpdates(_0x4a729a){return function(_0xd40d23){try{jsonpatch[_0xdcea('0x23')](_0xd40d23,_0x4a729a,!![]);}catch(_0x20f3c4){return BPromise[_0xdcea('0x24')](_0x20f3c4);}return _0xd40d23[_0xdcea('0x25')]();};}function saveUpdates(_0x54bc1c,_0x129930){return function(_0x22ee58){if(_0x22ee58){return _0x22ee58[_0xdcea('0x26')](_0x54bc1c)['then'](function(_0x1487c3){return _0x1487c3;});}return null;};}function removeEntity(_0x2c8bb9,_0x536ece){return function(_0x52b4cb){if(_0x52b4cb){return _0x52b4cb['destroy']()[_0xdcea('0x27')](function(){_0x2c8bb9[_0xdcea('0x1f')](0xcc)[_0xdcea('0x20')]();});}};}function handleEntityNotFound(_0x463fde,_0x5002ec){return function(_0x1a7c06){if(!_0x1a7c06){_0x463fde['sendStatus'](0x194);}return _0x1a7c06;};}function handleError(_0x3ea4b3,_0x54153d){_0x54153d=_0x54153d||0x1f4;return function(_0x50bb19){logger[_0xdcea('0x28')](_0x50bb19[_0xdcea('0x29')]);if(_0x50bb19['name']){delete _0x50bb19['name'];}_0x3ea4b3[_0xdcea('0x1f')](_0x54153d)['send'](_0x50bb19);};}exports['index']=function(_0x16775e,_0x5dc6ac){var _0x4b97ba={},_0x1711f7={},_0x4aadf2={'count':0x0,'rows':[]};return db['CmContact'][_0xdcea('0x2a')]()['then'](function(_0x5b568f){var _0x2aa5dc=[];for(var _0x2cbe4f=0x0;_0x2cbe4f0x1){_0x16568e['or'](_0xdcea('0x66'),qs['getFullTextValue'](_0x45b670),null);}else{if(qs[_0xdcea('0x67')](_0x45b670)){_0x16568e['or'](_0xdcea('0x68'),_0x45b670+'%');_0x16568e['or']('c.phone\x20LIKE\x20?',_0x45b670+'%');_0x16568e['or'](_0xdcea('0x69'),_0x45b670+'%');_0x16568e['or'](_0xdcea('0x6a'),_0x45b670+'%');}else if(qs[_0xdcea('0x6b')](_0x45b670)){_0x16568e['or'](_0xdcea('0x6c'),_0x45b670+'%');}else{_0x16568e['or'](_0xdcea('0x6d'),'%'+_0x45b670+'%');_0x16568e['or'](_0xdcea('0x6e'),'%'+_0x45b670+'%');_0x16568e['or'](_0xdcea('0x6c'),'%'+_0x45b670+'%');}}}}_0x4d1d20['where'](_0x16568e);_0x4d1d20[_0xdcea('0x6f')]('c.id');var _0x43b8e8={'type':db[_0xdcea('0x70')]['QueryTypes']['SELECT'],'raw':!![]};var _0x23ab20=_0x4d1d20[_0xdcea('0x71')]()['field']('c.id');if(_0x4b97ba[_0xdcea('0x3b')]){_0x4b97ba[_0xdcea('0x3b')][_0xdcea('0x53')](function(_0x1b091c){_0x4d1d20[_0xdcea('0x3b')]('c.'+_0x1b091c[0x0],_0x1b091c[0x1]===_0xdcea('0x72')?![]:!![]);});}if(!_['isEmpty'](_0x580dba)){_0x4d1d20[_0xdcea('0x73')](_0xa3d9bd);_0x23ab20[_0xdcea('0x3d')](_0xdcea('0x74'),_0x580dba);}BPromise[_0xdcea('0x75')]()['then'](function(){if(_0x57e45f&&!_['some'](_0x57e45f['conditions'],[_0xdcea('0x41'),'User'])){return _0x16775e[_0xdcea('0x76')][_0xdcea('0x77')]({'attributes':['id'],'raw':!![]})[_0xdcea('0x27')](function(_0x212a93){if(_[_0xdcea('0x78')](_0x212a93)){_0x23ab20[_0xdcea('0x3d')](_0xdcea('0x79'));_0x4d1d20['where'](_0xdcea('0x79'));}else{_0x23ab20[_0xdcea('0x3d')](_0xdcea('0x5f'),_['map'](_0x212a93,'id'));_0x4d1d20[_0xdcea('0x3d')](_0xdcea('0x5f'),_[_0xdcea('0x52')](_0x212a93,'id'));}});}else{return;}})[_0xdcea('0x27')](function(){db[_0xdcea('0x7a')][_0xdcea('0x35')](_0x23ab20[_0xdcea('0x7b')](),_0x43b8e8)[_0xdcea('0x27')](function(_0x206a61){_0x4aadf2[_0xdcea('0x7c')]=_0x206a61['length'];if(_0x4aadf2[_0xdcea('0x7c')]===0x0)return[];return db[_0xdcea('0x7a')][_0xdcea('0x35')](_0x57f382[_0xdcea('0x7b')](),_0x43b8e8);})[_0xdcea('0x27')](function(_0x5f129b){_0x55f092=_[_0xdcea('0x7d')](_0x5f129b,'id');_0x43b8e8=_['merge'](_0x43b8e8,{'model':db[_0xdcea('0x7e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16775e[_0xdcea('0x35')][_0xdcea('0x39')]){_0x4b97ba[_0xdcea('0x38')]['forEach'](function(_0x4cd487){_0x4d1d20['field']('c.'+_0x4cd487);});}else{_0x4d1d20[_0xdcea('0x41')]('c.id');_0x4d1d20['field']('c.firstName');_0x4d1d20[_0xdcea('0x41')](_0xdcea('0x7f'));_0x4d1d20[_0xdcea('0x41')]('c.phone');_0x4d1d20[_0xdcea('0x41')](_0xdcea('0x80'));_0x4d1d20[_0xdcea('0x41')]('c.fax');_0x4d1d20[_0xdcea('0x41')]('c.email');_0x4d1d20['field'](_0xdcea('0x81'));_0x4d1d20[_0xdcea('0x41')]('c.deletedAt');_0x4d1d20[_0xdcea('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xdcea('0x82'));}if(_0x4b97ba['limit'])_0x4d1d20['limit'](_0x4b97ba[_0xdcea('0x21')]);if(_0x4b97ba[_0xdcea('0x3a')])_0x4d1d20[_0xdcea('0x3a')](_0x4b97ba[_0xdcea('0x3a')]);return db[_0xdcea('0x7a')][_0xdcea('0x35')](_0x4d1d20[_0xdcea('0x7b')](),_0x43b8e8);})[_0xdcea('0x27')](function(_0x5c8f7e){_0x5c8f7e[_0xdcea('0x53')](function(_0x31f852){if(_0x31f852['TagIds']){_0x31f852[_0xdcea('0x83')]=[];_0x31f852[_0xdcea('0x82')][_0xdcea('0x51')](',')['forEach'](function(_0x4d7d3a){_0x31f852[_0xdcea('0x83')][_0xdcea('0x2f')](_0x55f092[_0x4d7d3a]);});}delete _0x31f852[_0xdcea('0x82')];});_0x4aadf2['rows']=_0x5c8f7e;return _0x4aadf2;})[_0xdcea('0x27')](respondWithFilteredResult(_0x5dc6ac,_0x4b97ba));});})[_0xdcea('0x84')](handleError(_0x5dc6ac,null));};exports[_0xdcea('0x85')]=function(_0x4c8c2a,_0x4ad640){return db['CmContact'][_0xdcea('0x86')]({'where':{'id':_0x4c8c2a[_0xdcea('0x87')]['id']}})[_0xdcea('0x27')](handleEntityNotFound(_0x4ad640,null))[_0xdcea('0x27')](removeEntity(_0x4ad640,null))[_0xdcea('0x84')](handleError(_0x4ad640,null));};exports[_0xdcea('0x2a')]=function(_0x4306d2,_0x3b0a38){return db[_0xdcea('0x7e')][_0xdcea('0x2a')]()[_0xdcea('0x27')](function(_0x30b2fd){delete _0x30b2fd[_0xdcea('0x88')];for(var _0x24e10b=0x0;_0x24e10b{}\s\\|]/g,'-');_0x355af0(null,util[_0xd425('0x23')](_0xd425('0x24'),path[_0xd425('0x25')](_0x5e797a[_0xd425('0x21')],path[_0xd425('0x26')](_0x5e797a[_0xd425('0x21')])),Date[_0xd425('0x27')](),path[_0xd425('0x26')](_0x5e797a[_0xd425('0x21')])));}})});router[_0xd425('0x1a')](_0xd425('0x28'),upload['single'](_0xd425('0x29')),controller[_0xd425('0x2a')]);var upload=multer({'storage':multer[_0xd425('0x1e')]({'destination':function(_0x1908a5,_0x2afcdb,_0x400dd7){_0x400dd7(null,path[_0xd425('0x2b')](config['root'],_0xd425('0x20')));},'filename':function(_0x177de2,_0x1d8861,_0x57c950){_0x1d8861[_0xd425('0x21')]=_0x1d8861[_0xd425('0x21')][_0xd425('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57c950(null,util[_0xd425('0x23')](_0xd425('0x24'),path[_0xd425('0x25')](_0x1d8861[_0xd425('0x21')],path[_0xd425('0x26')](_0x1d8861[_0xd425('0x21')])),Date[_0xd425('0x27')](),path['extname'](_0x1d8861[_0xd425('0x21')])));}})});router[_0xd425('0x1a')](_0xd425('0x2c'),upload[_0xd425('0x2d')](_0xd425('0x29')),controller[_0xd425('0x2e')]);router[_0xd425('0x1a')](_0xd425('0x2f'),auth[_0xd425('0x9')](),controller[_0xd425('0x30')]);router[_0xd425('0x31')]('/:id',auth[_0xd425('0x9')](),controller[_0xd425('0x32')]);router[_0xd425('0x33')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller['destroy']);module[_0xd425('0x34')]=router; \ No newline at end of file +var _0x7fbe=['/create_many','diskStorage','root','originalname','replace','%s-%s%s','basename','now','/csv','uploadCsv','join','server/files/tmp','format','extname','/upload','file','upload','import','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/merge','post','create'];(function(_0x4567cc,_0x526e0a){var _0x1c06fd=function(_0x1b6786){while(--_0x1b6786){_0x4567cc['push'](_0x4567cc['shift']());}};_0x1c06fd(++_0x526e0a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x169098,_0x55fa34){_0x169098=_0x169098-0x0;var _0x43d9b2=_0x7fbe[_0x169098];return _0x43d9b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['describe']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['get']('/:id/tags',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0x8')](_0xe7fb('0xf'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x8')](_0xe7fb('0x11'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x8')](_0xe7fb('0x13'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x8')]('/:id/jscripty_sessions',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x15')]);router['post'](_0xe7fb('0x16'),auth[_0xe7fb('0x9')](),controller['merge']);router[_0xe7fb('0x17')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x18')]);router[_0xe7fb('0x17')](_0xe7fb('0x19'),auth[_0xe7fb('0x9')](),controller['bulkCreate']);router[_0xe7fb('0x17')]('/:id/tags',auth[_0xe7fb('0x9')](),controller['setTags']);var upload=multer({'storage':multer[_0xe7fb('0x1a')]({'destination':function(_0x4708f7,_0x3f96a7,_0x182269){_0x182269(null,path['join'](config[_0xe7fb('0x1b')],'server/files/tmp'));},'filename':function(_0x11cae0,_0x51f01f,_0x15f7a4){_0x51f01f['originalname']=_0x51f01f[_0xe7fb('0x1c')][_0xe7fb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x15f7a4(null,util['format'](_0xe7fb('0x1e'),path[_0xe7fb('0x1f')](_0x51f01f[_0xe7fb('0x1c')],path['extname'](_0x51f01f[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path['extname'](_0x51f01f['originalname'])));}})});router['post'](_0xe7fb('0x21'),upload['single']('file'),controller[_0xe7fb('0x22')]);var upload=multer({'storage':multer[_0xe7fb('0x1a')]({'destination':function(_0x2996ae,_0x4f6c73,_0x6c930){_0x6c930(null,path[_0xe7fb('0x23')](config[_0xe7fb('0x1b')],_0xe7fb('0x24')));},'filename':function(_0x392d75,_0x16237a,_0x380130){_0x16237a['originalname']=_0x16237a['originalname'][_0xe7fb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x380130(null,util[_0xe7fb('0x25')](_0xe7fb('0x1e'),path['basename'](_0x16237a[_0xe7fb('0x1c')],path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])));}})});router[_0xe7fb('0x17')](_0xe7fb('0x27'),upload['single'](_0xe7fb('0x28')),controller[_0xe7fb('0x29')]);router[_0xe7fb('0x17')]('/upload/:id',auth['isAuthenticated'](),controller[_0xe7fb('0x2a')]);router['put'](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2b')]);router[_0xe7fb('0x2c')]('/:id',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2d')]);module[_0xe7fb('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 0756416..0f07928 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 _0x1cb9=['STRING','sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5b45ef,_0x491101){_0x5b45ef=_0x5b45ef-0x0;var _0x54b98b=_0x1cb9[_0x5b45ef];return _0x54b98b;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x91cb('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x91cb('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x91cb('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x91cb('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x91cb('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xf13b=['sequelize','INTEGER','STRING','PHONE'];(function(_0x410a98,_0x3839b6){var _0x36e27d=function(_0x271e78){while(--_0x271e78){_0x410a98['push'](_0x410a98['shift']());}};_0x36e27d(++_0x3839b6);}(_0xf13b,0x1f0));var _0xbf13=function(_0x5987b8,_0x2bf595){_0x5987b8=_0x5987b8-0x0;var _0x5884ed=_0xf13b[_0x5987b8];return _0x5884ed;};'use strict';var Sequelize=require(_0xbf13('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xbf13('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xbf13('0x2')],'defaultValue':_0xbf13('0x3')},'OrderBy':{'type':Sequelize[_0xbf13('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index f9510c8..41c9497 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 _0x5a68=['sendStatus','status','end','json','count','offset','set','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x44c9e3,_0x370f9c){var _0x2df2a6=function(_0x1a65b8){while(--_0x1a65b8){_0x44c9e3['push'](_0x44c9e3['shift']());}};_0x2df2a6(++_0x370f9c);}(_0x5a68,0x139));var _0x85a6=function(_0x19ce06,_0x3aa4bc){_0x19ce06=_0x19ce06-0x0;var _0xd88686=_0x5a68[_0x19ce06];return _0xd88686;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x85a6('0x0'));var rimraf=require(_0x85a6('0x1'));var zipdir=require(_0x85a6('0x2'));var jsonpatch=require(_0x85a6('0x3'));var rp=require(_0x85a6('0x4'));var moment=require(_0x85a6('0x5'));var BPromise=require(_0x85a6('0x6'));var Mustache=require(_0x85a6('0x7'));var util=require('util');var path=require(_0x85a6('0x8'));var sox=require(_0x85a6('0x9'));var csv=require(_0x85a6('0xa'));var ejs=require(_0x85a6('0xb'));var fs=require('fs');var _=require(_0x85a6('0xc'));var squel=require(_0x85a6('0xd'));var crypto=require(_0x85a6('0xe'));var jsforce=require(_0x85a6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x85a6('0xa'));var querystring=require(_0x85a6('0x10'));var Papa=require(_0x85a6('0x11'));var Redis=require(_0x85a6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x85a6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85a6('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x85a6('0x15'));var db=require(_0x85a6('0x16'))['db'];function respondWithStatusCode(_0x59be26,_0x12ad3e){_0x12ad3e=_0x12ad3e||0xcc;return function(_0x3a80d0){if(_0x3a80d0){return _0x59be26[_0x85a6('0x17')](_0x12ad3e);}return _0x59be26[_0x85a6('0x18')](_0x12ad3e)[_0x85a6('0x19')]();};}function respondWithResult(_0x699f5e,_0x56a700){_0x56a700=_0x56a700||0xc8;return function(_0x8eff8d){if(_0x8eff8d){return _0x699f5e[_0x85a6('0x18')](_0x56a700)[_0x85a6('0x1a')](_0x8eff8d);}};}function respondWithFilteredResult(_0x3ba004,_0x436414){return function(_0x4d050a){if(_0x4d050a){var _0x54ff8e=_0x4d050a[_0x85a6('0x1b')],_0x5a775d=_0x436414[_0x85a6('0x1c')],_0xc4928d=_0x436414[_0x85a6('0x1c')]+_0x436414['limit'],_0x5815bc;if(_0xc4928d>=_0x54ff8e){_0xc4928d=_0x54ff8e;_0x5815bc=0xc8;}else{_0x5815bc=0xce;}_0x3ba004[_0x85a6('0x18')](_0x5815bc);return _0x3ba004[_0x85a6('0x1d')]('Content-Range',_0x5a775d+'-'+_0xc4928d+'/'+_0x54ff8e)[_0x85a6('0x1a')](_0x4d050a);}return null;};}function patchUpdates(_0x2e7dbb){return function(_0x2bd285){try{jsonpatch[_0x85a6('0x1e')](_0x2bd285,_0x2e7dbb,!![]);}catch(_0x1f2b4e){return BPromise[_0x85a6('0x1f')](_0x1f2b4e);}return _0x2bd285[_0x85a6('0x20')]();};}function saveUpdates(_0x116c20,_0x2b8fe1){return function(_0x12e9f0){if(_0x12e9f0){return _0x12e9f0['update'](_0x116c20)[_0x85a6('0x21')](function(_0x124b0d){return _0x124b0d;});}return null;};}function removeEntity(_0x318b5e,_0x186d2f){return function(_0x2fc84d){if(_0x2fc84d){return _0x2fc84d[_0x85a6('0x22')]()['then'](function(){var _0x5ef52e=_0x2fc84d[_0x85a6('0x23')]({'plain':!![]});var _0x1318e9=_0x85a6('0x24');return db[_0x85a6('0x25')][_0x85a6('0x22')]({'where':{'type':_0x1318e9,'resourceId':_0x5ef52e['id']}})[_0x85a6('0x21')](function(){return _0x2fc84d;});})[_0x85a6('0x21')](function(){_0x318b5e[_0x85a6('0x18')](0xcc)[_0x85a6('0x19')]();});}};}function handleEntityNotFound(_0x361ec3,_0xfebc7f){return function(_0x162b75){if(!_0x162b75){_0x361ec3[_0x85a6('0x17')](0x194);}return _0x162b75;};}function handleError(_0x39dca1,_0x5211cc){_0x5211cc=_0x5211cc||0x1f4;return function(_0x4697f8){logger[_0x85a6('0x26')](_0x4697f8[_0x85a6('0x27')]);if(_0x4697f8[_0x85a6('0x28')]){delete _0x4697f8[_0x85a6('0x28')];}_0x39dca1[_0x85a6('0x18')](_0x5211cc)['send'](_0x4697f8);};}exports[_0x85a6('0x29')]=function(_0x10a7c8,_0x3fa984){var _0x15f008={},_0x9ebf72={},_0x9f1a78={'count':0x0,'rows':[]};var _0x4b4991=_[_0x85a6('0x2a')](db['CmContactHasItem'][_0x85a6('0x2b')],function(_0x5a7048){return{'name':_0x5a7048[_0x85a6('0x2c')],'type':_0x5a7048[_0x85a6('0x2d')][_0x85a6('0x2e')]};});_0x9ebf72[_0x85a6('0x2f')]=_[_0x85a6('0x2a')](_0x4b4991,'name');_0x9ebf72[_0x85a6('0x30')]=_['keys'](_0x10a7c8['query']);_0x9ebf72[_0x85a6('0x31')]=_['intersection'](_0x9ebf72[_0x85a6('0x2f')],_0x9ebf72[_0x85a6('0x30')]);_0x15f008['attributes']=_[_0x85a6('0x32')](_0x9ebf72[_0x85a6('0x2f')],qs[_0x85a6('0x33')](_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x33')]));_0x15f008['attributes']=_0x15f008[_0x85a6('0x34')][_0x85a6('0x35')]?_0x15f008[_0x85a6('0x34')]:_0x9ebf72[_0x85a6('0x2f')];if(!_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x36')](_0x85a6('0x37'))){_0x15f008[_0x85a6('0x38')]=qs[_0x85a6('0x38')](_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x38')]);_0x15f008[_0x85a6('0x1c')]=qs[_0x85a6('0x1c')](_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x1c')]);}_0x15f008[_0x85a6('0x39')]=qs[_0x85a6('0x3a')](_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x3a')]);_0x15f008[_0x85a6('0x3b')]=qs[_0x85a6('0x31')](_[_0x85a6('0x3c')](_0x10a7c8[_0x85a6('0x30')],_0x9ebf72[_0x85a6('0x31')]),_0x4b4991);if(_0x10a7c8['query'][_0x85a6('0x3d')]){_0x15f008[_0x85a6('0x3b')]=_[_0x85a6('0x3e')](_0x15f008[_0x85a6('0x3b')],{'$or':_[_0x85a6('0x2a')](_0x4b4991,function(_0x4dfa7a){if(_0x4dfa7a[_0x85a6('0x2d')]!=='VIRTUAL'){var _0x2d1b3e={};_0x2d1b3e[_0x4dfa7a['name']]={'$like':'%'+_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x3d')]+'%'};return _0x2d1b3e;}})});}_0x15f008=_[_0x85a6('0x3e')]({},_0x15f008,_0x10a7c8[_0x85a6('0x3f')]);var _0x550875={'where':_0x15f008[_0x85a6('0x3b')]};return db[_0x85a6('0x40')][_0x85a6('0x1b')](_0x550875)['then'](function(_0x22a1bc){_0x9f1a78[_0x85a6('0x1b')]=_0x22a1bc;if(_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x41')]){_0x15f008[_0x85a6('0x42')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x85a6('0x43')](_0x15f008);})[_0x85a6('0x21')](function(_0x192998){_0x9f1a78[_0x85a6('0x44')]=_0x192998;return _0x9f1a78;})[_0x85a6('0x21')](respondWithFilteredResult(_0x3fa984,_0x15f008))[_0x85a6('0x45')](handleError(_0x3fa984,null));};exports[_0x85a6('0x46')]=function(_0x832b3,_0x31fcc8){var _0xaee134={'raw':!![],'where':{'id':_0x832b3['params']['id']}},_0x230973={};_0x230973['model']=_[_0x85a6('0x47')](db[_0x85a6('0x40')]['rawAttributes']);_0x230973[_0x85a6('0x30')]=_[_0x85a6('0x47')](_0x832b3['query']);_0x230973[_0x85a6('0x31')]=_[_0x85a6('0x32')](_0x230973[_0x85a6('0x2f')],_0x230973[_0x85a6('0x30')]);_0xaee134[_0x85a6('0x34')]=_['intersection'](_0x230973[_0x85a6('0x2f')],qs[_0x85a6('0x33')](_0x832b3[_0x85a6('0x30')][_0x85a6('0x33')]));_0xaee134[_0x85a6('0x34')]=_0xaee134[_0x85a6('0x34')][_0x85a6('0x35')]?_0xaee134['attributes']:_0x230973[_0x85a6('0x2f')];if(_0x832b3['query'][_0x85a6('0x41')]){_0xaee134[_0x85a6('0x42')]=[{'all':!![]}];}_0xaee134=_[_0x85a6('0x3e')]({},_0xaee134,_0x832b3['options']);return db[_0x85a6('0x40')][_0x85a6('0x48')](_0xaee134)[_0x85a6('0x21')](handleEntityNotFound(_0x31fcc8,null))[_0x85a6('0x21')](respondWithResult(_0x31fcc8,null))[_0x85a6('0x45')](handleError(_0x31fcc8,null));};exports['create']=function(_0x214e27,_0x19505f){return db['CmContactHasItem'][_0x85a6('0x49')](_0x214e27['body'],{})[_0x85a6('0x21')](function(_0x225b95){var _0x5ad76=_0x214e27[_0x85a6('0x4a')]['get']({'plain':!![]});if(!_0x5ad76)throw new Error(_0x85a6('0x4b'));if(_0x5ad76[_0x85a6('0x4c')]===_0x85a6('0x4a')){var _0xedc7ee=_0x225b95[_0x85a6('0x23')]({'plain':!![]});var _0x1840c5=_0x85a6('0x24');return db[_0x85a6('0x4d')]['find']({'where':{'name':_0x1840c5,'userProfileId':_0x5ad76[_0x85a6('0x4e')]},'raw':!![]})[_0x85a6('0x21')](function(_0x5ae8a9){if(_0x5ae8a9&&_0x5ae8a9[_0x85a6('0x4f')]===0x0){return db['UserProfileResource'][_0x85a6('0x49')]({'name':_0xedc7ee[_0x85a6('0x28')],'resourceId':_0xedc7ee['id'],'type':_0x5ae8a9[_0x85a6('0x28')],'sectionId':_0x5ae8a9['id']},{})[_0x85a6('0x21')](function(){return _0x225b95;});}else{return _0x225b95;}})[_0x85a6('0x45')](function(_0x4bcc0d){logger[_0x85a6('0x26')](_0x85a6('0x50'),_0x4bcc0d);throw _0x4bcc0d;});}return _0x225b95;})[_0x85a6('0x21')](respondWithResult(_0x19505f,0xc9))[_0x85a6('0x45')](handleError(_0x19505f,null));};exports[_0x85a6('0x51')]=function(_0x36cadf,_0x170fb5){if(_0x36cadf[_0x85a6('0x52')]['id']){delete _0x36cadf[_0x85a6('0x52')]['id'];}return db[_0x85a6('0x40')][_0x85a6('0x48')]({'where':{'id':_0x36cadf[_0x85a6('0x53')]['id']}})[_0x85a6('0x21')](handleEntityNotFound(_0x170fb5,null))['then'](saveUpdates(_0x36cadf[_0x85a6('0x52')],null))[_0x85a6('0x21')](respondWithResult(_0x170fb5,null))['catch'](handleError(_0x170fb5,null));};exports[_0x85a6('0x22')]=function(_0x50ee91,_0x3ad056){return db['CmContactHasItem'][_0x85a6('0x48')]({'where':{'id':_0x50ee91[_0x85a6('0x53')]['id']}})[_0x85a6('0x21')](handleEntityNotFound(_0x3ad056,null))[_0x85a6('0x21')](removeEntity(_0x3ad056,null))[_0x85a6('0x45')](handleError(_0x3ad056,null));}; \ No newline at end of file +var _0x6517=['apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','where','pick','merge','options','includeAll','include','rows','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json'];(function(_0x246753,_0x62ceb6){var _0x593cc0=function(_0x185d33){while(--_0x185d33){_0x246753['push'](_0x246753['shift']());}};_0x593cc0(++_0x62ceb6);}(_0x6517,0x195));var _0x7651=function(_0x3b376b,_0x4a5635){_0x3b376b=_0x3b376b-0x0;var _0x59fb44=_0x6517[_0x3b376b];return _0x59fb44;};'use strict';var pdf=require(_0x7651('0x0'));var emlformat=require(_0x7651('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7651('0x2'));var moment=require(_0x7651('0x3'));var BPromise=require(_0x7651('0x4'));var Mustache=require(_0x7651('0x5'));var util=require('util');var path=require(_0x7651('0x6'));var sox=require(_0x7651('0x7'));var csv=require(_0x7651('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7651('0x9'));var squel=require('squel');var crypto=require(_0x7651('0xa'));var jsforce=require(_0x7651('0xb'));var deskjs=require(_0x7651('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7651('0xd'));var Papa=require(_0x7651('0xe'));var Redis=require(_0x7651('0xf'));var authService=require(_0x7651('0x10'));var qs=require(_0x7651('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7651('0x12'));var logger=require(_0x7651('0x13'))(_0x7651('0x14'));var utils=require(_0x7651('0x15'));var config=require(_0x7651('0x16'));var db=require(_0x7651('0x17'))['db'];function respondWithStatusCode(_0xd9f706,_0x3864c8){_0x3864c8=_0x3864c8||0xcc;return function(_0x406625){if(_0x406625){return _0xd9f706[_0x7651('0x18')](_0x3864c8);}return _0xd9f706[_0x7651('0x19')](_0x3864c8)[_0x7651('0x1a')]();};}function respondWithResult(_0x319f47,_0x342f1b){_0x342f1b=_0x342f1b||0xc8;return function(_0xd76f4d){if(_0xd76f4d){return _0x319f47[_0x7651('0x19')](_0x342f1b)['json'](_0xd76f4d);}};}function respondWithFilteredResult(_0x54e2a2,_0x212b9e){return function(_0x34c229){if(_0x34c229){var _0x16aebe=_0x34c229[_0x7651('0x1b')],_0x50f84e=_0x212b9e[_0x7651('0x1c')],_0x345aef=_0x212b9e[_0x7651('0x1c')]+_0x212b9e[_0x7651('0x1d')],_0x52e508;if(_0x345aef>=_0x16aebe){_0x345aef=_0x16aebe;_0x52e508=0xc8;}else{_0x52e508=0xce;}_0x54e2a2[_0x7651('0x19')](_0x52e508);return _0x54e2a2[_0x7651('0x1e')](_0x7651('0x1f'),_0x50f84e+'-'+_0x345aef+'/'+_0x16aebe)[_0x7651('0x20')](_0x34c229);}return null;};}function patchUpdates(_0x455529){return function(_0x2566e0){try{jsonpatch[_0x7651('0x21')](_0x2566e0,_0x455529,!![]);}catch(_0x4d5230){return BPromise[_0x7651('0x22')](_0x4d5230);}return _0x2566e0[_0x7651('0x23')]();};}function saveUpdates(_0x32f0c1,_0x3d3638){return function(_0xe28e5c){if(_0xe28e5c){return _0xe28e5c[_0x7651('0x24')](_0x32f0c1)[_0x7651('0x25')](function(_0x1a590e){return _0x1a590e;});}return null;};}function removeEntity(_0x36df38,_0x4baf31){return function(_0x385bac){if(_0x385bac){return _0x385bac[_0x7651('0x26')]()[_0x7651('0x25')](function(){var _0x5d4b9c=_0x385bac[_0x7651('0x27')]({'plain':!![]});var _0x4fe838=_0x7651('0x28');return db[_0x7651('0x29')][_0x7651('0x26')]({'where':{'type':_0x4fe838,'resourceId':_0x5d4b9c['id']}})[_0x7651('0x25')](function(){return _0x385bac;});})[_0x7651('0x25')](function(){_0x36df38[_0x7651('0x19')](0xcc)[_0x7651('0x1a')]();});}};}function handleEntityNotFound(_0x33281c,_0x114d22){return function(_0x5f935a){if(!_0x5f935a){_0x33281c[_0x7651('0x18')](0x194);}return _0x5f935a;};}function handleError(_0x3078ad,_0x131238){_0x131238=_0x131238||0x1f4;return function(_0x3e251b){logger[_0x7651('0x2a')](_0x3e251b[_0x7651('0x2b')]);if(_0x3e251b[_0x7651('0x2c')]){delete _0x3e251b[_0x7651('0x2c')];}_0x3078ad['status'](_0x131238)['send'](_0x3e251b);};}exports['index']=function(_0x498093,_0x1678ae){var _0x2e688d={},_0x18edb2={},_0x27dfe8={'count':0x0,'rows':[]};var _0x411993=_[_0x7651('0x2d')](db[_0x7651('0x2e')][_0x7651('0x2f')],function(_0x4a84de){return{'name':_0x4a84de[_0x7651('0x30')],'type':_0x4a84de[_0x7651('0x31')]['key']};});_0x18edb2[_0x7651('0x32')]=_[_0x7651('0x2d')](_0x411993,_0x7651('0x2c'));_0x18edb2[_0x7651('0x33')]=_[_0x7651('0x34')](_0x498093['query']);_0x18edb2[_0x7651('0x35')]=_[_0x7651('0x36')](_0x18edb2[_0x7651('0x32')],_0x18edb2[_0x7651('0x33')]);_0x2e688d['attributes']=_[_0x7651('0x36')](_0x18edb2[_0x7651('0x32')],qs[_0x7651('0x37')](_0x498093[_0x7651('0x33')][_0x7651('0x37')]));_0x2e688d['attributes']=_0x2e688d['attributes'][_0x7651('0x38')]?_0x2e688d[_0x7651('0x39')]:_0x18edb2['model'];if(!_0x498093[_0x7651('0x33')]['hasOwnProperty']('nolimit')){_0x2e688d[_0x7651('0x1d')]=qs[_0x7651('0x1d')](_0x498093[_0x7651('0x33')]['limit']);_0x2e688d['offset']=qs[_0x7651('0x1c')](_0x498093['query']['offset']);}_0x2e688d['order']=qs['sort'](_0x498093['query']['sort']);_0x2e688d[_0x7651('0x3a')]=qs[_0x7651('0x35')](_[_0x7651('0x3b')](_0x498093['query'],_0x18edb2[_0x7651('0x35')]),_0x411993);if(_0x498093['query']['filter']){_0x2e688d['where']=_[_0x7651('0x3c')](_0x2e688d[_0x7651('0x3a')],{'$or':_[_0x7651('0x2d')](_0x411993,function(_0x50bdd6){if(_0x50bdd6['type']!=='VIRTUAL'){var _0x40ac0b={};_0x40ac0b[_0x50bdd6['name']]={'$like':'%'+_0x498093[_0x7651('0x33')]['filter']+'%'};return _0x40ac0b;}})});}_0x2e688d=_[_0x7651('0x3c')]({},_0x2e688d,_0x498093[_0x7651('0x3d')]);var _0x13b9c7={'where':_0x2e688d[_0x7651('0x3a')]};return db[_0x7651('0x2e')]['count'](_0x13b9c7)[_0x7651('0x25')](function(_0x2abc1d){_0x27dfe8['count']=_0x2abc1d;if(_0x498093['query'][_0x7651('0x3e')]){_0x2e688d[_0x7651('0x3f')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x2e688d);})[_0x7651('0x25')](function(_0x4d7ac9){_0x27dfe8[_0x7651('0x40')]=_0x4d7ac9;return _0x27dfe8;})[_0x7651('0x25')](respondWithFilteredResult(_0x1678ae,_0x2e688d))['catch'](handleError(_0x1678ae,null));};exports[_0x7651('0x41')]=function(_0x1ed9c8,_0x42f417){var _0x1cf6a6={'raw':!![],'where':{'id':_0x1ed9c8['params']['id']}},_0x82b64a={};_0x82b64a[_0x7651('0x32')]=_[_0x7651('0x34')](db['CmContactHasItem'][_0x7651('0x2f')]);_0x82b64a['query']=_[_0x7651('0x34')](_0x1ed9c8[_0x7651('0x33')]);_0x82b64a[_0x7651('0x35')]=_[_0x7651('0x36')](_0x82b64a[_0x7651('0x32')],_0x82b64a['query']);_0x1cf6a6['attributes']=_[_0x7651('0x36')](_0x82b64a[_0x7651('0x32')],qs[_0x7651('0x37')](_0x1ed9c8['query'][_0x7651('0x37')]));_0x1cf6a6['attributes']=_0x1cf6a6[_0x7651('0x39')][_0x7651('0x38')]?_0x1cf6a6['attributes']:_0x82b64a['model'];if(_0x1ed9c8['query'][_0x7651('0x3e')]){_0x1cf6a6[_0x7651('0x3f')]=[{'all':!![]}];}_0x1cf6a6=_[_0x7651('0x3c')]({},_0x1cf6a6,_0x1ed9c8[_0x7651('0x3d')]);return db[_0x7651('0x2e')][_0x7651('0x42')](_0x1cf6a6)['then'](handleEntityNotFound(_0x42f417,null))[_0x7651('0x25')](respondWithResult(_0x42f417,null))[_0x7651('0x43')](handleError(_0x42f417,null));};exports[_0x7651('0x44')]=function(_0x2bb20c,_0x4689c0){return db[_0x7651('0x2e')][_0x7651('0x44')](_0x2bb20c[_0x7651('0x45')],{})[_0x7651('0x25')](function(_0x42db6f){var _0x75179b=_0x2bb20c['user'][_0x7651('0x27')]({'plain':!![]});if(!_0x75179b)throw new Error(_0x7651('0x46'));if(_0x75179b['role']===_0x7651('0x47')){var _0xce46d8=_0x42db6f[_0x7651('0x27')]({'plain':!![]});var _0x3261ea=_0x7651('0x28');return db['UserProfileSection'][_0x7651('0x42')]({'where':{'name':_0x3261ea,'userProfileId':_0x75179b['userProfileId']},'raw':!![]})[_0x7651('0x25')](function(_0x52c13a){if(_0x52c13a&&_0x52c13a[_0x7651('0x48')]===0x0){return db[_0x7651('0x29')][_0x7651('0x44')]({'name':_0xce46d8[_0x7651('0x2c')],'resourceId':_0xce46d8['id'],'type':_0x52c13a[_0x7651('0x2c')],'sectionId':_0x52c13a['id']},{})[_0x7651('0x25')](function(){return _0x42db6f;});}else{return _0x42db6f;}})['catch'](function(_0x42e7dd){logger[_0x7651('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42e7dd);throw _0x42e7dd;});}return _0x42db6f;})[_0x7651('0x25')](respondWithResult(_0x4689c0,0xc9))['catch'](handleError(_0x4689c0,null));};exports[_0x7651('0x24')]=function(_0x3dad7c,_0x21bc63){if(_0x3dad7c[_0x7651('0x45')]['id']){delete _0x3dad7c[_0x7651('0x45')]['id'];}return db[_0x7651('0x2e')][_0x7651('0x42')]({'where':{'id':_0x3dad7c['params']['id']}})[_0x7651('0x25')](handleEntityNotFound(_0x21bc63,null))['then'](saveUpdates(_0x3dad7c[_0x7651('0x45')],null))['then'](respondWithResult(_0x21bc63,null))['catch'](handleError(_0x21bc63,null));};exports[_0x7651('0x26')]=function(_0xca62af,_0x55e19b){return db['CmContactHasItem'][_0x7651('0x42')]({'where':{'id':_0xca62af['params']['id']}})['then'](handleEntityNotFound(_0x55e19b,null))[_0x7651('0x25')](removeEntity(_0x55e19b,null))[_0x7651('0x43')](handleError(_0x55e19b,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index e018480..6838894 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 _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x4da6ba,_0x554ea7){_0x4da6ba=_0x4da6ba-0x0;var _0x4b8317=_0xfdbd[_0x4da6ba];return _0x4b8317;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x58c2d6,_0x293bee){var _0x2dbf62=function(_0x420e89){while(--_0x420e89){_0x58c2d6['push'](_0x58c2d6['shift']());}};_0x2dbf62(++_0x293bee);}(_0xb138,0x1dd));var _0x8b13=function(_0x35854d,_0x1bf625){_0x35854d=_0x35854d-0x0;var _0xcc051=_0xb138[_0x35854d];return _0xcc051;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index ae86c3c..acc9cc6 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 _0xa404=['CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa404,0x159));var _0x4a40=function(_0x3ab711,_0x31b57e){_0x3ab711=_0x3ab711-0x0;var _0x514470=_0xa404[_0x3ab711];return _0x514470;};'use strict';var _=require(_0x4a40('0x0'));var util=require(_0x4a40('0x1'));var moment=require(_0x4a40('0x2'));var BPromise=require('bluebird');var rs=require(_0x4a40('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a40('0x4'));var logger=require(_0x4a40('0x5'))('rpc');var config=require(_0x4a40('0x6'));var jayson=require(_0x4a40('0x7'));var client=jayson[_0x4a40('0x8')][_0x4a40('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be9d0,_0x1255d5,_0x2eb044){return new BPromise(function(_0x100a8a,_0x5e2833){return client['request'](_0x1be9d0,_0x2eb044)[_0x4a40('0xa')](function(_0x23b06b){logger[_0x4a40('0xb')](_0x4a40('0xc'),_0x1255d5,'request\x20sent');logger[_0x4a40('0xd')](_0x4a40('0xe'),_0x1255d5,'request\x20sent',JSON[_0x4a40('0xf')](_0x23b06b));if(_0x23b06b[_0x4a40('0x10')]){if(_0x23b06b[_0x4a40('0x10')][_0x4a40('0x11')]===0x1f4){logger[_0x4a40('0x10')](_0x4a40('0xc'),_0x1255d5,_0x23b06b['error'][_0x4a40('0x12')]);return _0x5e2833(_0x23b06b['error'][_0x4a40('0x12')]);}logger[_0x4a40('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x1255d5,_0x23b06b[_0x4a40('0x10')]['message']);return _0x100a8a(_0x23b06b[_0x4a40('0x10')][_0x4a40('0x12')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x1255d5,_0x4a40('0x13'));_0x100a8a(_0x23b06b[_0x4a40('0x14')][_0x4a40('0x12')]);}})['catch'](function(_0x3bb989){logger[_0x4a40('0x10')](_0x4a40('0xc'),_0x1255d5,_0x3bb989);_0x5e2833(_0x3bb989);});});} \ No newline at end of file +var _0x6658=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2d4258,_0x1eae89){var _0x244daf=function(_0x43b7e0){while(--_0x43b7e0){_0x2d4258['push'](_0x2d4258['shift']());}};_0x244daf(++_0x1eae89);}(_0x6658,0x198));var _0x8665=function(_0x422c44,_0x4cec31){_0x422c44=_0x422c44-0x0;var _0x2a11d2=_0x6658[_0x422c44];return _0x2a11d2;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var moment=require(_0x8665('0x2'));var BPromise=require(_0x8665('0x3'));var rs=require(_0x8665('0x4'));var fs=require('fs');var Redis=require(_0x8665('0x5'));var db=require(_0x8665('0x6'))['db'];var utils=require(_0x8665('0x7'));var logger=require('../../config/logger')(_0x8665('0x8'));var config=require(_0x8665('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8665('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x290df7,_0x24c89f,_0x242f58){return new BPromise(function(_0xe73687,_0x861e11){return client[_0x8665('0xb')](_0x290df7,_0x242f58)[_0x8665('0xc')](function(_0x5c25bf){logger[_0x8665('0xd')](_0x8665('0xe'),_0x24c89f,_0x8665('0xf'));logger[_0x8665('0x10')](_0x8665('0x11'),_0x24c89f,_0x8665('0xf'),JSON[_0x8665('0x12')](_0x5c25bf));if(_0x5c25bf[_0x8665('0x13')]){if(_0x5c25bf[_0x8665('0x13')][_0x8665('0x14')]===0x1f4){logger[_0x8665('0x13')](_0x8665('0xe'),_0x24c89f,_0x5c25bf[_0x8665('0x13')][_0x8665('0x15')]);return _0x861e11(_0x5c25bf['error'][_0x8665('0x15')]);}logger['error'](_0x8665('0xe'),_0x24c89f,_0x5c25bf[_0x8665('0x13')][_0x8665('0x15')]);return _0xe73687(_0x5c25bf[_0x8665('0x13')][_0x8665('0x15')]);}else{logger[_0x8665('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x24c89f,_0x8665('0xf'));_0xe73687(_0x5c25bf[_0x8665('0x16')]['message']);}})[_0x8665('0x17')](function(_0x53dcb5){logger[_0x8665('0x13')](_0x8665('0xe'),_0x24c89f,_0x53dcb5);_0x861e11(_0x53dcb5);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7f35063..a570a46 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 _0x370a=['create','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x4f2d97,_0x178903){var _0x2c1dbc=function(_0x274556){while(--_0x274556){_0x4f2d97['push'](_0x4f2d97['shift']());}};_0x2c1dbc(++_0x178903);}(_0x370a,0x194));var _0xa370=function(_0x53e576,_0x230268){_0x53e576=_0x53e576-0x0;var _0x20cc61=_0x370a[_0x53e576];return _0x20cc61;};'use strict';var multer=require('multer');var util=require(_0xa370('0x0'));var path=require(_0xa370('0x1'));var timeout=require(_0xa370('0x2'));var express=require(_0xa370('0x3'));var router=express['Router']();var auth=require(_0xa370('0x4'));var interaction=require(_0xa370('0x5'));var config=require(_0xa370('0x6'));var controller=require('./cmContactHasItem.controller');router[_0xa370('0x7')]('/',auth[_0xa370('0x8')](),controller['index']);router[_0xa370('0x7')](_0xa370('0x9'),auth[_0xa370('0x8')](),controller[_0xa370('0xa')]);router[_0xa370('0xb')]('/',auth['isAuthenticated'](),controller[_0xa370('0xc')]);router['put'](_0xa370('0x9'),auth[_0xa370('0x8')](),controller[_0xa370('0xd')]);router['delete']('/:id',auth[_0xa370('0x8')](),controller[_0xa370('0xe')]);module[_0xa370('0xf')]=router; \ No newline at end of file +var _0xb5ae=['show','post','create','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id'];(function(_0x67ac46,_0x2a1823){var _0x166ce9=function(_0x428ef1){while(--_0x428ef1){_0x67ac46['push'](_0x67ac46['shift']());}};_0x166ce9(++_0x2a1823);}(_0xb5ae,0x186));var _0xeb5a=function(_0x3caf09,_0x4d9426){_0x3caf09=_0x3caf09-0x0;var _0x35a410=_0xb5ae[_0x3caf09];return _0x35a410;};'use strict';var multer=require(_0xeb5a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeb5a('0x1'));var express=require(_0xeb5a('0x2'));var router=express['Router']();var auth=require(_0xeb5a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xeb5a('0x4'));var controller=require(_0xeb5a('0x5'));router[_0xeb5a('0x6')]('/',auth[_0xeb5a('0x7')](),controller[_0xeb5a('0x8')]);router['get'](_0xeb5a('0x9'),auth[_0xeb5a('0x7')](),controller[_0xeb5a('0xa')]);router[_0xeb5a('0xb')]('/',auth[_0xeb5a('0x7')](),controller[_0xeb5a('0xc')]);router['put'](_0xeb5a('0x9'),auth[_0xeb5a('0x7')](),controller[_0xeb5a('0xd')]);router[_0xeb5a('0xe')](_0xeb5a('0x9'),auth[_0xeb5a('0x7')](),controller[_0xeb5a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 44e0e79..eaf0951 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 _0x3af3=['sequelize','INTEGER'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x3af3,0x12a));var _0x33af=function(_0x39c12e,_0x585534){_0x39c12e=_0x39c12e-0x0;var _0x58dbf4=_0x3af3[_0x39c12e];return _0x58dbf4;};'use strict';var Sequelize=require(_0x33af('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x33af('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x165f=['INTEGER','STRING','sequelize','exports'];(function(_0x9acc89,_0x183869){var _0x245dfc=function(_0x3f0a6f){while(--_0x3f0a6f){_0x9acc89['push'](_0x9acc89['shift']());}};_0x245dfc(++_0x183869);}(_0x165f,0x12a));var _0xf165=function(_0x10f53b,_0x335a35){_0x10f53b=_0x10f53b-0x0;var _0x2e04d6=_0x165f[_0x10f53b];return _0x2e04d6;};'use strict';var Sequelize=require(_0xf165('0x0'));module[_0xf165('0x1')]={'CmContactId':{'type':Sequelize[_0xf165('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xf165('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 435d7b7..fb0d97c 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 _0xd587=['offset','limit','apply','update','then','destroy','CmContactHasPhones','end','stack','name','send','index','map','CmContactHasPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','intersection','create','user','get','role','UserProfileSection','find','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count'];(function(_0x1e0c8d,_0x334e6a){var _0x418fc3=function(_0x2fec5e){while(--_0x2fec5e){_0x1e0c8d['push'](_0x1e0c8d['shift']());}};_0x418fc3(++_0x334e6a);}(_0xd587,0x11b));var _0x7d58=function(_0x634259,_0x47238e){_0x634259=_0x634259-0x0;var _0xce619d=_0xd587[_0x634259];return _0xce619d;};'use strict';var pdf=require(_0x7d58('0x0'));var emlformat=require(_0x7d58('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7d58('0x2'));var rp=require(_0x7d58('0x3'));var moment=require(_0x7d58('0x4'));var BPromise=require(_0x7d58('0x5'));var Mustache=require(_0x7d58('0x6'));var util=require(_0x7d58('0x7'));var path=require('path');var sox=require(_0x7d58('0x8'));var csv=require(_0x7d58('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7d58('0xa'));var crypto=require('crypto');var jsforce=require(_0x7d58('0xb'));var deskjs=require(_0x7d58('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7d58('0xd'));var Redis=require('ioredis');var authService=require(_0x7d58('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7d58('0xf'));var hardwareService=require(_0x7d58('0x10'));var logger=require(_0x7d58('0x11'))('api');var utils=require(_0x7d58('0x12'));var config=require(_0x7d58('0x13'));var db=require(_0x7d58('0x14'))['db'];function respondWithStatusCode(_0x39532e,_0x551d4c){_0x551d4c=_0x551d4c||0xcc;return function(_0x4b4d13){if(_0x4b4d13){return _0x39532e[_0x7d58('0x15')](_0x551d4c);}return _0x39532e[_0x7d58('0x16')](_0x551d4c)['end']();};}function respondWithResult(_0x5a6878,_0x2f28f8){_0x2f28f8=_0x2f28f8||0xc8;return function(_0x297728){if(_0x297728){return _0x5a6878['status'](_0x2f28f8)[_0x7d58('0x17')](_0x297728);}};}function respondWithFilteredResult(_0x16147e,_0x70edc0){return function(_0x5be93d){if(_0x5be93d){var _0x6a4694=_0x5be93d[_0x7d58('0x18')],_0x563d51=_0x70edc0[_0x7d58('0x19')],_0x400f06=_0x70edc0['offset']+_0x70edc0[_0x7d58('0x1a')],_0x1257b4;if(_0x400f06>=_0x6a4694){_0x400f06=_0x6a4694;_0x1257b4=0xc8;}else{_0x1257b4=0xce;}_0x16147e[_0x7d58('0x16')](_0x1257b4);return _0x16147e['set']('Content-Range',_0x563d51+'-'+_0x400f06+'/'+_0x6a4694)[_0x7d58('0x17')](_0x5be93d);}return null;};}function patchUpdates(_0x3559a6){return function(_0x237d40){try{jsonpatch[_0x7d58('0x1b')](_0x237d40,_0x3559a6,!![]);}catch(_0x4a8b9a){return BPromise['reject'](_0x4a8b9a);}return _0x237d40['save']();};}function saveUpdates(_0x45a85c,_0xb77f43){return function(_0x367a76){if(_0x367a76){return _0x367a76[_0x7d58('0x1c')](_0x45a85c)[_0x7d58('0x1d')](function(_0x1ee491){return _0x1ee491;});}return null;};}function removeEntity(_0x4e2b3e,_0x2011f1){return function(_0x5631dc){if(_0x5631dc){return _0x5631dc[_0x7d58('0x1e')]()[_0x7d58('0x1d')](function(){var _0x26fb76=_0x5631dc['get']({'plain':!![]});var _0x5851dd=_0x7d58('0x1f');return db['UserProfileResource'][_0x7d58('0x1e')]({'where':{'type':_0x5851dd,'resourceId':_0x26fb76['id']}})['then'](function(){return _0x5631dc;});})[_0x7d58('0x1d')](function(){_0x4e2b3e[_0x7d58('0x16')](0xcc)[_0x7d58('0x20')]();});}};}function handleEntityNotFound(_0x596081,_0x1d2b5d){return function(_0x3057b0){if(!_0x3057b0){_0x596081[_0x7d58('0x15')](0x194);}return _0x3057b0;};}function handleError(_0x53107c,_0x36170e){_0x36170e=_0x36170e||0x1f4;return function(_0x2ca645){logger['error'](_0x2ca645[_0x7d58('0x21')]);if(_0x2ca645[_0x7d58('0x22')]){delete _0x2ca645['name'];}_0x53107c[_0x7d58('0x16')](_0x36170e)[_0x7d58('0x23')](_0x2ca645);};}exports[_0x7d58('0x24')]=function(_0x500aad,_0xdd82c0){var _0x531093={},_0x10f2fb={},_0x3a789a={'count':0x0,'rows':[]};var _0x4cd1a0=_[_0x7d58('0x25')](db[_0x7d58('0x26')][_0x7d58('0x27')],function(_0x139959){return{'name':_0x139959[_0x7d58('0x28')],'type':_0x139959[_0x7d58('0x29')][_0x7d58('0x2a')]};});_0x10f2fb[_0x7d58('0x2b')]=_[_0x7d58('0x25')](_0x4cd1a0,_0x7d58('0x22'));_0x10f2fb[_0x7d58('0x2c')]=_[_0x7d58('0x2d')](_0x500aad[_0x7d58('0x2c')]);_0x10f2fb[_0x7d58('0x2e')]=_['intersection'](_0x10f2fb['model'],_0x10f2fb['query']);_0x531093[_0x7d58('0x2f')]=_['intersection'](_0x10f2fb[_0x7d58('0x2b')],qs[_0x7d58('0x30')](_0x500aad[_0x7d58('0x2c')]['fields']));_0x531093[_0x7d58('0x2f')]=_0x531093['attributes'][_0x7d58('0x31')]?_0x531093[_0x7d58('0x2f')]:_0x10f2fb[_0x7d58('0x2b')];if(!_0x500aad[_0x7d58('0x2c')][_0x7d58('0x32')](_0x7d58('0x33'))){_0x531093[_0x7d58('0x1a')]=qs[_0x7d58('0x1a')](_0x500aad[_0x7d58('0x2c')][_0x7d58('0x1a')]);_0x531093[_0x7d58('0x19')]=qs['offset'](_0x500aad[_0x7d58('0x2c')][_0x7d58('0x19')]);}_0x531093['order']=qs['sort'](_0x500aad[_0x7d58('0x2c')][_0x7d58('0x34')]);_0x531093[_0x7d58('0x35')]=qs[_0x7d58('0x2e')](_[_0x7d58('0x36')](_0x500aad['query'],_0x10f2fb[_0x7d58('0x2e')]),_0x4cd1a0);if(_0x500aad[_0x7d58('0x2c')][_0x7d58('0x37')]){_0x531093[_0x7d58('0x35')]=_[_0x7d58('0x38')](_0x531093[_0x7d58('0x35')],{'$or':_[_0x7d58('0x25')](_0x4cd1a0,function(_0x3a6155){if(_0x3a6155[_0x7d58('0x29')]!==_0x7d58('0x39')){var _0x40ebe8={};_0x40ebe8[_0x3a6155[_0x7d58('0x22')]]={'$like':'%'+_0x500aad[_0x7d58('0x2c')][_0x7d58('0x37')]+'%'};return _0x40ebe8;}})});}_0x531093=_[_0x7d58('0x38')]({},_0x531093,_0x500aad[_0x7d58('0x3a')]);var _0x590ca0={'where':_0x531093['where']};return db[_0x7d58('0x26')][_0x7d58('0x18')](_0x590ca0)[_0x7d58('0x1d')](function(_0xc6f381){_0x3a789a[_0x7d58('0x18')]=_0xc6f381;if(_0x500aad[_0x7d58('0x2c')][_0x7d58('0x3b')]){_0x531093[_0x7d58('0x3c')]=[{'all':!![]}];}return db[_0x7d58('0x26')]['findAll'](_0x531093);})[_0x7d58('0x1d')](function(_0x28d7c9){_0x3a789a[_0x7d58('0x3d')]=_0x28d7c9;return _0x3a789a;})['then'](respondWithFilteredResult(_0xdd82c0,_0x531093))['catch'](handleError(_0xdd82c0,null));};exports[_0x7d58('0x3e')]=function(_0x272cce,_0x1fff53){var _0x293ba9={'raw':!![],'where':{'id':_0x272cce['params']['id']}},_0x3d41c9={};_0x3d41c9[_0x7d58('0x2b')]=_['keys'](db[_0x7d58('0x26')][_0x7d58('0x27')]);_0x3d41c9[_0x7d58('0x2c')]=_[_0x7d58('0x2d')](_0x272cce[_0x7d58('0x2c')]);_0x3d41c9['filters']=_[_0x7d58('0x3f')](_0x3d41c9[_0x7d58('0x2b')],_0x3d41c9['query']);_0x293ba9['attributes']=_['intersection'](_0x3d41c9['model'],qs['fields'](_0x272cce[_0x7d58('0x2c')]['fields']));_0x293ba9[_0x7d58('0x2f')]=_0x293ba9[_0x7d58('0x2f')][_0x7d58('0x31')]?_0x293ba9[_0x7d58('0x2f')]:_0x3d41c9[_0x7d58('0x2b')];if(_0x272cce[_0x7d58('0x2c')][_0x7d58('0x3b')]){_0x293ba9[_0x7d58('0x3c')]=[{'all':!![]}];}_0x293ba9=_['merge']({},_0x293ba9,_0x272cce[_0x7d58('0x3a')]);return db[_0x7d58('0x26')]['find'](_0x293ba9)[_0x7d58('0x1d')](handleEntityNotFound(_0x1fff53,null))[_0x7d58('0x1d')](respondWithResult(_0x1fff53,null))['catch'](handleError(_0x1fff53,null));};exports[_0x7d58('0x40')]=function(_0x3ab83f,_0x355337){return db[_0x7d58('0x26')]['create'](_0x3ab83f['body'],{})[_0x7d58('0x1d')](function(_0x2196ce){var _0x2aad08=_0x3ab83f[_0x7d58('0x41')][_0x7d58('0x42')]({'plain':!![]});if(!_0x2aad08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2aad08[_0x7d58('0x43')]==='user'){var _0x326574=_0x2196ce[_0x7d58('0x42')]({'plain':!![]});var _0x2d3bed=_0x7d58('0x1f');return db[_0x7d58('0x44')][_0x7d58('0x45')]({'where':{'name':_0x2d3bed,'userProfileId':_0x2aad08['userProfileId']},'raw':!![]})[_0x7d58('0x1d')](function(_0x1b4105){if(_0x1b4105&&_0x1b4105[_0x7d58('0x46')]===0x0){return db[_0x7d58('0x47')][_0x7d58('0x40')]({'name':_0x326574[_0x7d58('0x22')],'resourceId':_0x326574['id'],'type':_0x1b4105[_0x7d58('0x22')],'sectionId':_0x1b4105['id']},{})['then'](function(){return _0x2196ce;});}else{return _0x2196ce;}})[_0x7d58('0x48')](function(_0x2eef8a){logger[_0x7d58('0x49')](_0x7d58('0x4a'),_0x2eef8a);throw _0x2eef8a;});}return _0x2196ce;})[_0x7d58('0x1d')](respondWithResult(_0x355337,0xc9))[_0x7d58('0x48')](handleError(_0x355337,null));};exports[_0x7d58('0x1c')]=function(_0x48ba2a,_0x394150){if(_0x48ba2a[_0x7d58('0x4b')]['id']){delete _0x48ba2a[_0x7d58('0x4b')]['id'];}return db[_0x7d58('0x26')][_0x7d58('0x45')]({'where':{'id':_0x48ba2a[_0x7d58('0x4c')]['id']}})['then'](handleEntityNotFound(_0x394150,null))[_0x7d58('0x1d')](saveUpdates(_0x48ba2a[_0x7d58('0x4b')],null))[_0x7d58('0x1d')](respondWithResult(_0x394150,null))['catch'](handleError(_0x394150,null));};exports[_0x7d58('0x1e')]=function(_0x4da0bd,_0x5ecdcf){return db[_0x7d58('0x26')][_0x7d58('0x45')]({'where':{'id':_0x4da0bd[_0x7d58('0x4c')]['id']}})[_0x7d58('0x1d')](handleEntityNotFound(_0x5ecdcf,null))[_0x7d58('0x1d')](removeEntity(_0x5ecdcf,null))[_0x7d58('0x48')](handleError(_0x5ecdcf,null));}; \ No newline at end of file +var _0x6d5c=['query','keys','model','attributes','intersection','fields','nolimit','order','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','findAll','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CmContactHasPhones','UserProfileResource','error','name','send','map','CmContactHasPhone','rawAttributes','type','key'];(function(_0x56072c,_0xbc1d04){var _0x487a84=function(_0x287723){while(--_0x287723){_0x56072c['push'](_0x56072c['shift']());}};_0x487a84(++_0xbc1d04);}(_0x6d5c,0x1e5));var _0xc6d5=function(_0x4b6e95,_0x1661e4){_0x4b6e95=_0x4b6e95-0x0;var _0x4db44f=_0x6d5c[_0x4b6e95];return _0x4db44f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc6d5('0x0'));var zipdir=require(_0xc6d5('0x1'));var jsonpatch=require(_0xc6d5('0x2'));var rp=require(_0xc6d5('0x3'));var moment=require(_0xc6d5('0x4'));var BPromise=require(_0xc6d5('0x5'));var Mustache=require('mustache');var util=require(_0xc6d5('0x6'));var path=require('path');var sox=require(_0xc6d5('0x7'));var csv=require(_0xc6d5('0x8'));var ejs=require(_0xc6d5('0x9'));var fs=require('fs');var _=require(_0xc6d5('0xa'));var squel=require(_0xc6d5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc6d5('0x8'));var querystring=require(_0xc6d5('0xc'));var Papa=require(_0xc6d5('0xd'));var Redis=require('ioredis');var authService=require(_0xc6d5('0xe'));var qs=require(_0xc6d5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6d5('0x10'));var logger=require(_0xc6d5('0x11'))(_0xc6d5('0x12'));var utils=require(_0xc6d5('0x13'));var config=require(_0xc6d5('0x14'));var db=require(_0xc6d5('0x15'))['db'];function respondWithStatusCode(_0x10a12a,_0x40f2a7){_0x40f2a7=_0x40f2a7||0xcc;return function(_0x24c77d){if(_0x24c77d){return _0x10a12a[_0xc6d5('0x16')](_0x40f2a7);}return _0x10a12a[_0xc6d5('0x17')](_0x40f2a7)[_0xc6d5('0x18')]();};}function respondWithResult(_0xbab59c,_0x57e81b){_0x57e81b=_0x57e81b||0xc8;return function(_0x4d9afd){if(_0x4d9afd){return _0xbab59c['status'](_0x57e81b)[_0xc6d5('0x19')](_0x4d9afd);}};}function respondWithFilteredResult(_0x42b8e4,_0x4b0301){return function(_0x3ab891){if(_0x3ab891){var _0x5339ca=_0x3ab891[_0xc6d5('0x1a')],_0x4692d2=_0x4b0301[_0xc6d5('0x1b')],_0x4538d1=_0x4b0301[_0xc6d5('0x1b')]+_0x4b0301[_0xc6d5('0x1c')],_0x34df91;if(_0x4538d1>=_0x5339ca){_0x4538d1=_0x5339ca;_0x34df91=0xc8;}else{_0x34df91=0xce;}_0x42b8e4[_0xc6d5('0x17')](_0x34df91);return _0x42b8e4[_0xc6d5('0x1d')](_0xc6d5('0x1e'),_0x4692d2+'-'+_0x4538d1+'/'+_0x5339ca)['json'](_0x3ab891);}return null;};}function patchUpdates(_0x399daa){return function(_0x302af1){try{jsonpatch['apply'](_0x302af1,_0x399daa,!![]);}catch(_0x25ff71){return BPromise[_0xc6d5('0x1f')](_0x25ff71);}return _0x302af1[_0xc6d5('0x20')]();};}function saveUpdates(_0x49f529,_0x448d15){return function(_0x57d2b6){if(_0x57d2b6){return _0x57d2b6[_0xc6d5('0x21')](_0x49f529)[_0xc6d5('0x22')](function(_0x19dc6d){return _0x19dc6d;});}return null;};}function removeEntity(_0x4bde16,_0x119545){return function(_0x55022d){if(_0x55022d){return _0x55022d[_0xc6d5('0x23')]()[_0xc6d5('0x22')](function(){var _0x1f3f42=_0x55022d[_0xc6d5('0x24')]({'plain':!![]});var _0x6fe200=_0xc6d5('0x25');return db[_0xc6d5('0x26')][_0xc6d5('0x23')]({'where':{'type':_0x6fe200,'resourceId':_0x1f3f42['id']}})['then'](function(){return _0x55022d;});})[_0xc6d5('0x22')](function(){_0x4bde16[_0xc6d5('0x17')](0xcc)[_0xc6d5('0x18')]();});}};}function handleEntityNotFound(_0x41aa44,_0x4df8ab){return function(_0xd71697){if(!_0xd71697){_0x41aa44[_0xc6d5('0x16')](0x194);}return _0xd71697;};}function handleError(_0x49894f,_0x40c3a4){_0x40c3a4=_0x40c3a4||0x1f4;return function(_0x55f93d){logger[_0xc6d5('0x27')](_0x55f93d['stack']);if(_0x55f93d[_0xc6d5('0x28')]){delete _0x55f93d['name'];}_0x49894f['status'](_0x40c3a4)[_0xc6d5('0x29')](_0x55f93d);};}exports['index']=function(_0x310bb1,_0x445a22){var _0x359bc3={},_0x39ffb3={},_0x310597={'count':0x0,'rows':[]};var _0x695289=_[_0xc6d5('0x2a')](db[_0xc6d5('0x2b')][_0xc6d5('0x2c')],function(_0x516e43){return{'name':_0x516e43['fieldName'],'type':_0x516e43[_0xc6d5('0x2d')][_0xc6d5('0x2e')]};});_0x39ffb3['model']=_['map'](_0x695289,'name');_0x39ffb3[_0xc6d5('0x2f')]=_[_0xc6d5('0x30')](_0x310bb1[_0xc6d5('0x2f')]);_0x39ffb3['filters']=_['intersection'](_0x39ffb3[_0xc6d5('0x31')],_0x39ffb3['query']);_0x359bc3[_0xc6d5('0x32')]=_[_0xc6d5('0x33')](_0x39ffb3[_0xc6d5('0x31')],qs[_0xc6d5('0x34')](_0x310bb1[_0xc6d5('0x2f')][_0xc6d5('0x34')]));_0x359bc3[_0xc6d5('0x32')]=_0x359bc3[_0xc6d5('0x32')]['length']?_0x359bc3[_0xc6d5('0x32')]:_0x39ffb3[_0xc6d5('0x31')];if(!_0x310bb1[_0xc6d5('0x2f')]['hasOwnProperty'](_0xc6d5('0x35'))){_0x359bc3['limit']=qs[_0xc6d5('0x1c')](_0x310bb1['query']['limit']);_0x359bc3[_0xc6d5('0x1b')]=qs[_0xc6d5('0x1b')](_0x310bb1[_0xc6d5('0x2f')][_0xc6d5('0x1b')]);}_0x359bc3[_0xc6d5('0x36')]=qs['sort'](_0x310bb1[_0xc6d5('0x2f')]['sort']);_0x359bc3[_0xc6d5('0x37')]=qs['filters'](_[_0xc6d5('0x38')](_0x310bb1[_0xc6d5('0x2f')],_0x39ffb3[_0xc6d5('0x39')]),_0x695289);if(_0x310bb1['query'][_0xc6d5('0x3a')]){_0x359bc3[_0xc6d5('0x37')]=_['merge'](_0x359bc3[_0xc6d5('0x37')],{'$or':_['map'](_0x695289,function(_0xfc23b1){if(_0xfc23b1[_0xc6d5('0x2d')]!==_0xc6d5('0x3b')){var _0x29b45c={};_0x29b45c[_0xfc23b1[_0xc6d5('0x28')]]={'$like':'%'+_0x310bb1[_0xc6d5('0x2f')][_0xc6d5('0x3a')]+'%'};return _0x29b45c;}})});}_0x359bc3=_[_0xc6d5('0x3c')]({},_0x359bc3,_0x310bb1['options']);var _0x100720={'where':_0x359bc3['where']};return db['CmContactHasPhone']['count'](_0x100720)[_0xc6d5('0x22')](function(_0x10454f){_0x310597['count']=_0x10454f;if(_0x310bb1['query'][_0xc6d5('0x3d')]){_0x359bc3[_0xc6d5('0x3e')]=[{'all':!![]}];}return db[_0xc6d5('0x2b')][_0xc6d5('0x3f')](_0x359bc3);})[_0xc6d5('0x22')](function(_0x7e8da9){_0x310597['rows']=_0x7e8da9;return _0x310597;})[_0xc6d5('0x22')](respondWithFilteredResult(_0x445a22,_0x359bc3))[_0xc6d5('0x40')](handleError(_0x445a22,null));};exports['show']=function(_0xeea757,_0x226d54){var _0x10694e={'raw':!![],'where':{'id':_0xeea757[_0xc6d5('0x41')]['id']}},_0x367268={};_0x367268[_0xc6d5('0x31')]=_['keys'](db[_0xc6d5('0x2b')]['rawAttributes']);_0x367268[_0xc6d5('0x2f')]=_[_0xc6d5('0x30')](_0xeea757[_0xc6d5('0x2f')]);_0x367268[_0xc6d5('0x39')]=_[_0xc6d5('0x33')](_0x367268[_0xc6d5('0x31')],_0x367268[_0xc6d5('0x2f')]);_0x10694e[_0xc6d5('0x32')]=_['intersection'](_0x367268[_0xc6d5('0x31')],qs[_0xc6d5('0x34')](_0xeea757['query']['fields']));_0x10694e['attributes']=_0x10694e['attributes'][_0xc6d5('0x42')]?_0x10694e[_0xc6d5('0x32')]:_0x367268[_0xc6d5('0x31')];if(_0xeea757[_0xc6d5('0x2f')][_0xc6d5('0x3d')]){_0x10694e[_0xc6d5('0x3e')]=[{'all':!![]}];}_0x10694e=_[_0xc6d5('0x3c')]({},_0x10694e,_0xeea757[_0xc6d5('0x43')]);return db[_0xc6d5('0x2b')][_0xc6d5('0x44')](_0x10694e)[_0xc6d5('0x22')](handleEntityNotFound(_0x226d54,null))[_0xc6d5('0x22')](respondWithResult(_0x226d54,null))['catch'](handleError(_0x226d54,null));};exports[_0xc6d5('0x45')]=function(_0x24c42c,_0x47982e){return db[_0xc6d5('0x2b')][_0xc6d5('0x45')](_0x24c42c[_0xc6d5('0x46')],{})[_0xc6d5('0x22')](function(_0x3f20fb){var _0x8bd7f6=_0x24c42c[_0xc6d5('0x47')][_0xc6d5('0x24')]({'plain':!![]});if(!_0x8bd7f6)throw new Error(_0xc6d5('0x48'));if(_0x8bd7f6[_0xc6d5('0x49')]===_0xc6d5('0x47')){var _0x45b5ae=_0x3f20fb[_0xc6d5('0x24')]({'plain':!![]});var _0x3db067=_0xc6d5('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3db067,'userProfileId':_0x8bd7f6[_0xc6d5('0x4a')]},'raw':!![]})[_0xc6d5('0x22')](function(_0x254a58){if(_0x254a58&&_0x254a58['autoAssociation']===0x0){return db[_0xc6d5('0x26')][_0xc6d5('0x45')]({'name':_0x45b5ae[_0xc6d5('0x28')],'resourceId':_0x45b5ae['id'],'type':_0x254a58['name'],'sectionId':_0x254a58['id']},{})['then'](function(){return _0x3f20fb;});}else{return _0x3f20fb;}})['catch'](function(_0x5022db){logger[_0xc6d5('0x27')](_0xc6d5('0x4b'),_0x5022db);throw _0x5022db;});}return _0x3f20fb;})[_0xc6d5('0x22')](respondWithResult(_0x47982e,0xc9))['catch'](handleError(_0x47982e,null));};exports[_0xc6d5('0x21')]=function(_0x7337ff,_0x407cb0){if(_0x7337ff[_0xc6d5('0x46')]['id']){delete _0x7337ff['body']['id'];}return db[_0xc6d5('0x2b')][_0xc6d5('0x44')]({'where':{'id':_0x7337ff[_0xc6d5('0x41')]['id']}})['then'](handleEntityNotFound(_0x407cb0,null))['then'](saveUpdates(_0x7337ff[_0xc6d5('0x46')],null))[_0xc6d5('0x22')](respondWithResult(_0x407cb0,null))[_0xc6d5('0x40')](handleError(_0x407cb0,null));};exports['destroy']=function(_0x488399,_0x4745e9){return db[_0xc6d5('0x2b')][_0xc6d5('0x44')]({'where':{'id':_0x488399[_0xc6d5('0x41')]['id']}})['then'](handleEntityNotFound(_0x4745e9,null))[_0xc6d5('0x22')](removeEntity(_0x4745e9,null))['catch'](handleError(_0x4745e9,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index fc334af..030bade 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 _0xd187=['cm_contact_has_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define'];(function(_0x5f02ba,_0x5c4427){var _0x45b6d9=function(_0x5b35b8){while(--_0x5b35b8){_0x5f02ba['push'](_0x5f02ba['shift']());}};_0x45b6d9(++_0x5c4427);}(_0xd187,0x90));var _0x7d18=function(_0x31ec29,_0x58915c){_0x31ec29=_0x31ec29-0x0;var _0x3275fc=_0xd187[_0x31ec29];return _0x3275fc;};'use strict';var _=require(_0x7d18('0x0'));var util=require(_0x7d18('0x1'));var logger=require(_0x7d18('0x2'))('api');var moment=require(_0x7d18('0x3'));var BPromise=require(_0x7d18('0x4'));var rp=require(_0x7d18('0x5'));var fs=require('fs');var path=require(_0x7d18('0x6'));var rimraf=require(_0x7d18('0x7'));var config=require(_0x7d18('0x8'));var attributes=require(_0x7d18('0x9'));module[_0x7d18('0xa')]=function(_0x520109,_0x30e2bd){return _0x520109[_0x7d18('0xb')]('CmContactHasPhone',attributes,{'tableName':_0x7d18('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6460=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','cm_contact_has_phones'];(function(_0x3f7b43,_0x32f087){var _0x327d40=function(_0x1fd5b8){while(--_0x1fd5b8){_0x3f7b43['push'](_0x3f7b43['shift']());}};_0x327d40(++_0x32f087);}(_0x6460,0xb4));var _0x0646=function(_0x34a62c,_0x353cbe){_0x34a62c=_0x34a62c-0x0;var _0x5c3f14=_0x6460[_0x34a62c];return _0x5c3f14;};'use strict';var _=require(_0x0646('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0646('0x1'));var BPromise=require(_0x0646('0x2'));var rp=require(_0x0646('0x3'));var fs=require('fs');var path=require(_0x0646('0x4'));var rimraf=require(_0x0646('0x5'));var config=require(_0x0646('0x6'));var attributes=require(_0x0646('0x7'));module[_0x0646('0x8')]=function(_0x577663,_0x4a0b87){return _0x577663['define']('CmContactHasPhone',attributes,{'tableName':_0x0646('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index 4cde4ae..4272366 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 _0x2342=['request','info','CmContactHasPhone,\x20%s,\x20%s','CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xeb8b1c,_0x59fee9){var _0x37fb25=function(_0x171691){while(--_0x171691){_0xeb8b1c['push'](_0xeb8b1c['shift']());}};_0x37fb25(++_0x59fee9);}(_0x2342,0xdf));var _0x2234=function(_0x23903b,_0xcdfff){_0x23903b=_0x23903b-0x0;var _0x2a76f6=_0x2342[_0x23903b];return _0x2a76f6;};'use strict';var _=require('lodash');var util=require(_0x2234('0x0'));var moment=require(_0x2234('0x1'));var BPromise=require(_0x2234('0x2'));var rs=require(_0x2234('0x3'));var fs=require('fs');var Redis=require(_0x2234('0x4'));var db=require(_0x2234('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2234('0x6'))('rpc');var config=require(_0x2234('0x7'));var jayson=require(_0x2234('0x8'));var client=jayson[_0x2234('0x9')][_0x2234('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43181a,_0x3de78b,_0x3e5197){return new BPromise(function(_0x519100,_0x3c0b6e){return client[_0x2234('0xb')](_0x43181a,_0x3e5197)['then'](function(_0x5469fe){logger[_0x2234('0xc')](_0x2234('0xd'),_0x3de78b,'request\x20sent');logger['debug'](_0x2234('0xe'),_0x3de78b,_0x2234('0xf'),JSON['stringify'](_0x5469fe));if(_0x5469fe[_0x2234('0x10')]){if(_0x5469fe['error']['code']===0x1f4){logger[_0x2234('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x3de78b,_0x5469fe[_0x2234('0x10')]['message']);return _0x3c0b6e(_0x5469fe[_0x2234('0x10')][_0x2234('0x11')]);}logger[_0x2234('0x10')](_0x2234('0xd'),_0x3de78b,_0x5469fe[_0x2234('0x10')][_0x2234('0x11')]);return _0x519100(_0x5469fe['error'][_0x2234('0x11')]);}else{logger[_0x2234('0xc')]('CmContactHasPhone,\x20%s,\x20%s',_0x3de78b,'request\x20sent');_0x519100(_0x5469fe['result'][_0x2234('0x11')]);}})['catch'](function(_0x1049f0){logger[_0x2234('0x10')](_0x2234('0xd'),_0x3de78b,_0x1049f0);_0x3c0b6e(_0x1049f0);});});} \ No newline at end of file +var _0x9d55=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch'];(function(_0x32736f,_0x37e3f8){var _0x36e049=function(_0x54b013){while(--_0x54b013){_0x32736f['push'](_0x32736f['shift']());}};_0x36e049(++_0x37e3f8);}(_0x9d55,0x1b9));var _0x59d5=function(_0x51564e,_0x12ef79){_0x51564e=_0x51564e-0x0;var _0x31d941=_0x9d55[_0x51564e];return _0x31d941;};'use strict';var _=require(_0x59d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x59d5('0x1'));var rs=require(_0x59d5('0x2'));var fs=require('fs');var Redis=require(_0x59d5('0x3'));var db=require(_0x59d5('0x4'))['db'];var utils=require(_0x59d5('0x5'));var logger=require(_0x59d5('0x6'))('rpc');var config=require(_0x59d5('0x7'));var jayson=require(_0x59d5('0x8'));var client=jayson['client'][_0x59d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e507,_0x4e6eca,_0x49fe41){return new BPromise(function(_0x416c50,_0x461340){return client[_0x59d5('0xa')](_0x4e507,_0x49fe41)[_0x59d5('0xb')](function(_0x3a33a6){logger['info'](_0x59d5('0xc'),_0x4e6eca,_0x59d5('0xd'));logger['debug'](_0x59d5('0xe'),_0x4e6eca,'request\x20sent',JSON['stringify'](_0x3a33a6));if(_0x3a33a6['error']){if(_0x3a33a6['error'][_0x59d5('0xf')]===0x1f4){logger['error'](_0x59d5('0xc'),_0x4e6eca,_0x3a33a6[_0x59d5('0x10')][_0x59d5('0x11')]);return _0x461340(_0x3a33a6[_0x59d5('0x10')][_0x59d5('0x11')]);}logger['error'](_0x59d5('0xc'),_0x4e6eca,_0x3a33a6['error'][_0x59d5('0x11')]);return _0x416c50(_0x3a33a6[_0x59d5('0x10')]['message']);}else{logger[_0x59d5('0x12')](_0x59d5('0xc'),_0x4e6eca,'request\x20sent');_0x416c50(_0x3a33a6[_0x59d5('0x13')][_0x59d5('0x11')]);}})[_0x59d5('0x14')](function(_0x5d6c39){logger[_0x59d5('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x4e6eca,_0x5d6c39);_0x461340(_0x5d6c39);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 284e884..66f70e4 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 _0x7b1a=['create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasPhone.controller','isAuthenticated','get','/:id','show','post'];(function(_0x2f762f,_0x5abc1d){var _0x24669b=function(_0xadf02b){while(--_0xadf02b){_0x2f762f['push'](_0x2f762f['shift']());}};_0x24669b(++_0x5abc1d);}(_0x7b1a,0xdd));var _0xa7b1=function(_0x5dee75,_0x25bc35){_0x5dee75=_0x5dee75-0x0;var _0x2d7837=_0x7b1a[_0x5dee75];return _0x2d7837;};'use strict';var multer=require(_0xa7b1('0x0'));var util=require('util');var path=require(_0xa7b1('0x1'));var timeout=require(_0xa7b1('0x2'));var express=require(_0xa7b1('0x3'));var router=express[_0xa7b1('0x4')]();var auth=require(_0xa7b1('0x5'));var interaction=require(_0xa7b1('0x6'));var config=require('../../config/environment');var controller=require(_0xa7b1('0x7'));router['get']('/',auth[_0xa7b1('0x8')](),controller['index']);router[_0xa7b1('0x9')](_0xa7b1('0xa'),auth['isAuthenticated'](),controller[_0xa7b1('0xb')]);router[_0xa7b1('0xc')]('/',auth[_0xa7b1('0x8')](),controller[_0xa7b1('0xd')]);router[_0xa7b1('0xe')](_0xa7b1('0xa'),auth[_0xa7b1('0x8')](),controller['update']);router[_0xa7b1('0xf')]('/:id',auth[_0xa7b1('0x8')](),controller[_0xa7b1('0x10')]);module[_0xa7b1('0x11')]=router; \ No newline at end of file +var _0x4c22=['get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmContactHasPhone.controller'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4c22,0x16e));var _0x24c2=function(_0x1aae70,_0x2ae006){_0x1aae70=_0x1aae70-0x0;var _0x562a4e=_0x4c22[_0x1aae70];return _0x562a4e;};'use strict';var multer=require(_0x24c2('0x0'));var util=require(_0x24c2('0x1'));var path=require(_0x24c2('0x2'));var timeout=require(_0x24c2('0x3'));var express=require(_0x24c2('0x4'));var router=express[_0x24c2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x24c2('0x6'));var config=require('../../config/environment');var controller=require(_0x24c2('0x7'));router[_0x24c2('0x8')]('/',auth[_0x24c2('0x9')](),controller['index']);router[_0x24c2('0x8')]('/:id',auth[_0x24c2('0x9')](),controller['show']);router[_0x24c2('0xa')]('/',auth[_0x24c2('0x9')](),controller['create']);router[_0x24c2('0xb')](_0x24c2('0xc'),auth[_0x24c2('0x9')](),controller[_0x24c2('0xd')]);router[_0x24c2('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x24c2('0xf')]);module[_0x24c2('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 014d7f0..e11d52f 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 _0x720a=['alias','name','TEXT','type','values','BOOLEAN','sequelize','exports','VIRTUAL','getDataValue','STRING','setDataValue'];(function(_0x81d9b4,_0x74c503){var _0x5051f6=function(_0x5eb9bb){while(--_0x5eb9bb){_0x81d9b4['push'](_0x81d9b4['shift']());}};_0x5051f6(++_0x74c503);}(_0x720a,0x13e));var _0xa720=function(_0x455d63,_0x2ee072){_0x455d63=_0x455d63-0x0;var _0x368dcf=_0x720a[_0x455d63];return _0x368dcf;};'use strict';var Sequelize=require(_0xa720('0x0'));var _=require('lodash');module[_0xa720('0x1')]={'name':{'type':Sequelize[_0xa720('0x2')],'get':function(_0x4b01c3){return this[_0xa720('0x3')]('alias');}},'alias':{'type':Sequelize[_0xa720('0x4')],'allowNull':![],'set':function(_0x2aa50e){this[_0xa720('0x5')](_0xa720('0x6'),_0x2aa50e?_0x2aa50e:this[_0xa720('0x3')](_0xa720('0x7')));}},'type':{'type':Sequelize[_0xa720('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xa720('0x8')]('long'),'get':function(){if(this[_0xa720('0x3')](_0xa720('0x9'))==='select'){return JSON['parse'](this['getDataValue']('values'));}else{return this[_0xa720('0x3')](_0xa720('0xa'));}},'set':function(_0x5d049f){if(Array['isArray'](_0x5d049f)){this[_0xa720('0x5')]('values',JSON['stringify'](_0x5d049f));}else{this[_0xa720('0x5')](_0xa720('0xa'),_0x5d049f);}}},'required':{'type':Sequelize[_0xa720('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0xfe08=['getDataValue','alias','STRING','setDataValue','name','long','type','select','parse','values','isArray','BOOLEAN','sequelize','exports','VIRTUAL'];(function(_0x9e54e0,_0x560c3c){var _0x512f5b=function(_0x2f1892){while(--_0x2f1892){_0x9e54e0['push'](_0x9e54e0['shift']());}};_0x512f5b(++_0x560c3c);}(_0xfe08,0x147));var _0x8fe0=function(_0x264136,_0x22508f){_0x264136=_0x264136-0x0;var _0x414056=_0xfe08[_0x264136];return _0x414056;};'use strict';var Sequelize=require(_0x8fe0('0x0'));var _=require('lodash');module[_0x8fe0('0x1')]={'name':{'type':Sequelize[_0x8fe0('0x2')],'get':function(_0x125551){return this[_0x8fe0('0x3')](_0x8fe0('0x4'));}},'alias':{'type':Sequelize[_0x8fe0('0x5')],'allowNull':![],'set':function(_0x1c2cb4){this[_0x8fe0('0x6')](_0x8fe0('0x4'),_0x1c2cb4?_0x1c2cb4:this['getDataValue'](_0x8fe0('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x8fe0('0x8')),'get':function(){if(this[_0x8fe0('0x3')](_0x8fe0('0x9'))===_0x8fe0('0xa')){return JSON[_0x8fe0('0xb')](this['getDataValue'](_0x8fe0('0xc')));}else{return this[_0x8fe0('0x3')](_0x8fe0('0xc'));}},'set':function(_0x5968a9){if(Array[_0x8fe0('0xd')](_0x5968a9)){this['setDataValue'](_0x8fe0('0xc'),JSON['stringify'](_0x5968a9));}else{this[_0x8fe0('0x6')](_0x8fe0('0xc'),_0x5968a9);}}},'required':{'type':Sequelize[_0x8fe0('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 9966fdb..3736985 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 _0x80a2=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','update','body','find','destroy','create','sequelize','TEXT','Sequelize','number','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x335136,_0x131d00){var _0x234b60=function(_0x1ba3a8){while(--_0x1ba3a8){_0x335136['push'](_0x335136['shift']());}};_0x234b60(++_0x131d00);}(_0x80a2,0xf9));var _0x280a=function(_0x2e8935,_0x15d23b){_0x2e8935=_0x2e8935-0x0;var _0x57b7f5=_0x80a2[_0x2e8935];return _0x57b7f5;};'use strict';var pdf=require(_0x280a('0x0'));var emlformat=require(_0x280a('0x1'));var rimraf=require(_0x280a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x280a('0x3'));var rp=require(_0x280a('0x4'));var moment=require(_0x280a('0x5'));var BPromise=require(_0x280a('0x6'));var Mustache=require(_0x280a('0x7'));var util=require(_0x280a('0x8'));var path=require(_0x280a('0x9'));var sox=require(_0x280a('0xa'));var csv=require(_0x280a('0xb'));var ejs=require(_0x280a('0xc'));var fs=require('fs');var _=require(_0x280a('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x280a('0xb'));var querystring=require(_0x280a('0xe'));var Papa=require(_0x280a('0xf'));var Redis=require(_0x280a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x280a('0x11'));var as=require(_0x280a('0x12'));var hardwareService=require(_0x280a('0x13'));var logger=require('../../config/logger')(_0x280a('0x14'));var utils=require(_0x280a('0x15'));var config=require(_0x280a('0x16'));var db=require(_0x280a('0x17'))['db'];function respondWithStatusCode(_0x244c47,_0x335848){_0x335848=_0x335848||0xcc;return function(_0x5e140f){if(_0x5e140f){return _0x244c47[_0x280a('0x18')](_0x335848);}return _0x244c47[_0x280a('0x19')](_0x335848)[_0x280a('0x1a')]();};}function respondWithResult(_0x529a4e,_0x59a81a){_0x59a81a=_0x59a81a||0xc8;return function(_0x914798){if(_0x914798){return _0x529a4e['status'](_0x59a81a)[_0x280a('0x1b')](_0x914798);}};}function respondWithFilteredResult(_0x22f93f,_0x2fb53b){return function(_0x48fcfb){if(_0x48fcfb){var _0x329124=_0x48fcfb[_0x280a('0x1c')],_0x148252=_0x2fb53b[_0x280a('0x1d')],_0x17e1ed=_0x2fb53b[_0x280a('0x1d')]+_0x2fb53b['limit'],_0x54ca29;if(_0x17e1ed>=_0x329124){_0x17e1ed=_0x329124;_0x54ca29=0xc8;}else{_0x54ca29=0xce;}_0x22f93f[_0x280a('0x19')](_0x54ca29);return _0x22f93f[_0x280a('0x1e')](_0x280a('0x1f'),_0x148252+'-'+_0x17e1ed+'/'+_0x329124)[_0x280a('0x1b')](_0x48fcfb);}return null;};}function patchUpdates(_0x96f3c6){return function(_0x51a025){try{jsonpatch[_0x280a('0x20')](_0x51a025,_0x96f3c6,!![]);}catch(_0x6a53b5){return BPromise[_0x280a('0x21')](_0x6a53b5);}return _0x51a025[_0x280a('0x22')]();};}function saveUpdates(_0x572add,_0x2d30c3){return function(_0x5d56f2){if(_0x5d56f2){return _0x5d56f2['update'](_0x572add)[_0x280a('0x23')](function(_0x4f28a6){return _0x4f28a6;});}return null;};}function removeEntity(_0x5225f3,_0x376983){return function(_0x179107){if(_0x179107){return _0x179107['destroy']()[_0x280a('0x23')](function(){_0x5225f3[_0x280a('0x19')](0xcc)[_0x280a('0x1a')]();});}};}function handleEntityNotFound(_0x411322,_0x2873b0){return function(_0x1a2936){if(!_0x1a2936){_0x411322[_0x280a('0x18')](0x194);}return _0x1a2936;};}function handleError(_0x28f505,_0x444db7){_0x444db7=_0x444db7||0x1f4;return function(_0x5823e2){logger['error'](_0x5823e2[_0x280a('0x24')]);if(_0x5823e2[_0x280a('0x25')]){delete _0x5823e2[_0x280a('0x25')];}_0x28f505[_0x280a('0x19')](_0x444db7)['send'](_0x5823e2);};}exports[_0x280a('0x26')]=function(_0x2ab4a0,_0x50acce){var _0x1e59e8={},_0x3a759e={},_0x1eec6e={'count':0x0,'rows':[]};var _0x2cf2a8=_[_0x280a('0x27')](db[_0x280a('0x28')][_0x280a('0x29')],function(_0x4141f9){return{'name':_0x4141f9[_0x280a('0x2a')],'type':_0x4141f9[_0x280a('0x2b')][_0x280a('0x2c')]};});_0x3a759e[_0x280a('0x2d')]=_['differenceBy'](_['map'](_0x2cf2a8,_0x280a('0x25')),[_0x280a('0x25')]);_0x3a759e[_0x280a('0x2e')]=_[_0x280a('0x2f')](_0x2ab4a0['query']);_0x3a759e[_0x280a('0x30')]=_[_0x280a('0x31')](_0x3a759e[_0x280a('0x2d')],_0x3a759e[_0x280a('0x2e')]);_0x1e59e8[_0x280a('0x32')]=_[_0x280a('0x31')](_0x3a759e['model'],qs[_0x280a('0x33')](_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x33')]));_0x1e59e8[_0x280a('0x32')]=_0x1e59e8[_0x280a('0x32')][_0x280a('0x34')]?_0x1e59e8[_0x280a('0x32')]:_0x3a759e[_0x280a('0x2d')];if(!_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x35')](_0x280a('0x36'))){_0x1e59e8['limit']=qs[_0x280a('0x37')](_0x2ab4a0[_0x280a('0x2e')]['limit']);_0x1e59e8['offset']=qs[_0x280a('0x1d')](_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x1d')]);}_0x1e59e8[_0x280a('0x38')]=qs[_0x280a('0x39')](_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x39')]);_0x1e59e8[_0x280a('0x3a')]=qs[_0x280a('0x30')](_['pick'](_0x2ab4a0[_0x280a('0x2e')],_0x3a759e[_0x280a('0x30')]),_0x2cf2a8);if(_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x3b')]){_0x1e59e8[_0x280a('0x3a')]=_[_0x280a('0x3c')](_0x1e59e8[_0x280a('0x3a')],{'$or':_['map'](_0x2cf2a8,function(_0x41c89f){if(_0x41c89f[_0x280a('0x2b')]!==_0x280a('0x3d')){var _0xf43d1d={};_0xf43d1d[_0x41c89f[_0x280a('0x25')]]={'$like':'%'+_0x2ab4a0[_0x280a('0x2e')]['filter']+'%'};return _0xf43d1d;}})});}_0x1e59e8=_[_0x280a('0x3c')]({},_0x1e59e8,_0x2ab4a0[_0x280a('0x3e')]);var _0x335e02={'where':_0x1e59e8[_0x280a('0x3a')]};return db['CmCustomField'][_0x280a('0x1c')](_0x335e02)[_0x280a('0x23')](function(_0x56f4d2){_0x1eec6e[_0x280a('0x1c')]=_0x56f4d2;if(_0x2ab4a0[_0x280a('0x2e')]['includeAll']){_0x1e59e8[_0x280a('0x3f')]=[{'all':!![]}];}return db['CmCustomField'][_0x280a('0x40')](_0x1e59e8);})['then'](function(_0x51e9ee){_0x1eec6e[_0x280a('0x41')]=_0x51e9ee;return _0x1eec6e;})['then'](respondWithFilteredResult(_0x50acce,_0x1e59e8))[_0x280a('0x42')](handleError(_0x50acce,null));};exports[_0x280a('0x43')]=function(_0x27619d,_0x1c1eb6){var _0x403da1={'raw':!![],'where':{'id':_0x27619d[_0x280a('0x44')]['id']}},_0x5b0074={};_0x5b0074[_0x280a('0x2d')]=_[_0x280a('0x2f')](db[_0x280a('0x28')]['rawAttributes']);_0x5b0074['query']=_[_0x280a('0x2f')](_0x27619d[_0x280a('0x2e')]);_0x5b0074['filters']=_['intersection'](_0x5b0074[_0x280a('0x2d')],_0x5b0074[_0x280a('0x2e')]);_0x403da1[_0x280a('0x32')]=_[_0x280a('0x31')](_0x5b0074[_0x280a('0x2d')],qs[_0x280a('0x33')](_0x27619d[_0x280a('0x2e')][_0x280a('0x33')]));_0x403da1['attributes']=_0x403da1[_0x280a('0x32')]['length']?_0x403da1['attributes']:_0x5b0074[_0x280a('0x2d')];if(_0x27619d[_0x280a('0x2e')][_0x280a('0x45')]){_0x403da1[_0x280a('0x3f')]=[{'all':!![]}];}_0x403da1=_[_0x280a('0x3c')]({},_0x403da1,_0x27619d[_0x280a('0x3e')]);return db[_0x280a('0x28')]['find'](_0x403da1)[_0x280a('0x23')](handleEntityNotFound(_0x1c1eb6,null))[_0x280a('0x23')](respondWithResult(_0x1c1eb6,null))[_0x280a('0x42')](handleError(_0x1c1eb6,null));};exports[_0x280a('0x46')]=function(_0x292cd5,_0xeab8ad){if(_0x292cd5[_0x280a('0x47')]['id']){delete _0x292cd5[_0x280a('0x47')]['id'];}return db[_0x280a('0x28')][_0x280a('0x48')]({'where':{'id':_0x292cd5[_0x280a('0x44')]['id']}})[_0x280a('0x23')](handleEntityNotFound(_0xeab8ad,null))['then'](saveUpdates(_0x292cd5[_0x280a('0x47')],null))[_0x280a('0x23')](respondWithResult(_0xeab8ad,null))['catch'](handleError(_0xeab8ad,null));};exports[_0x280a('0x49')]=function(_0x43a74b,_0x40c735){return db[_0x280a('0x28')]['find']({'where':{'id':_0x43a74b[_0x280a('0x44')]['id']}})[_0x280a('0x23')](handleEntityNotFound(_0x40c735,null))[_0x280a('0x23')](removeEntity(_0x40c735,null))['catch'](handleError(_0x40c735,null));};exports[_0x280a('0x4a')]=function(_0x3d7faa,_0x1ec663){var _0x48c7fa;return db[_0x280a('0x4b')]['transaction'](function(_0x3940b5){return db[_0x280a('0x28')][_0x280a('0x4a')](_0x3d7faa[_0x280a('0x47')],{'transaction':_0x3940b5})[_0x280a('0x23')](function(_0x115882){_0x48c7fa=_0x115882;var _0x37a564={'type':db['Sequelize'][_0x280a('0x4c')],'transaction':_0x3940b5};switch(_0x3d7faa[_0x280a('0x47')][_0x280a('0x2b')]){case'text':_0x37a564[_0x280a('0x2b')]=db[_0x280a('0x4d')]['TEXT'];break;case _0x280a('0x4e'):_0x37a564[_0x280a('0x2b')]=db[_0x280a('0x4d')]['INTEGER'];break;case _0x280a('0x4f'):_0x37a564[_0x280a('0x2b')]=db['Sequelize']['BOOLEAN'];_0x37a564[_0x280a('0x50')]=![];break;default:}return db[_0x280a('0x4b')][_0x280a('0x51')][_0x280a('0x52')](_0x280a('0x53'),util['format'](_0x280a('0x54'),_0x48c7fa['id']),_0x37a564);})[_0x280a('0x23')](function(){return _0x48c7fa;});})['then'](respondWithResult(_0x1ec663,0xc9))[_0x280a('0x42')](handleError(_0x1ec663,null));}; \ No newline at end of file +var _0x9891=['offset','order','sort','pick','filter','where','options','count','includeAll','include','findAll','rows','show','params','fields','length','merge','catch','body','find','destroy','sequelize','create','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','set','Content-Range','json','reject','save','update','then','error','name','index','map','CmCustomField','rawAttributes','fieldName','type','differenceBy','query','keys','filters','intersection','model','attributes','hasOwnProperty','limit'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x9891,0x73));var _0x1989=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0x9891[_0x15cae3];return _0x20596f;};'use strict';var pdf=require(_0x1989('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1989('0x1'));var zipdir=require(_0x1989('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1989('0x3'));var BPromise=require(_0x1989('0x4'));var Mustache=require('mustache');var util=require(_0x1989('0x5'));var path=require(_0x1989('0x6'));var sox=require(_0x1989('0x7'));var csv=require(_0x1989('0x8'));var ejs=require(_0x1989('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1989('0xa'));var jsforce=require(_0x1989('0xb'));var deskjs=require(_0x1989('0xc'));var toCsv=require(_0x1989('0x8'));var querystring=require(_0x1989('0xd'));var Papa=require(_0x1989('0xe'));var Redis=require('ioredis');var authService=require(_0x1989('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1989('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1989('0x11'))(_0x1989('0x12'));var utils=require('../../config/utils');var config=require(_0x1989('0x13'));var db=require(_0x1989('0x14'))['db'];function respondWithStatusCode(_0x31f947,_0x3e1302){_0x3e1302=_0x3e1302||0xcc;return function(_0x4f2d64){if(_0x4f2d64){return _0x31f947[_0x1989('0x15')](_0x3e1302);}return _0x31f947[_0x1989('0x16')](_0x3e1302)['end']();};}function respondWithResult(_0x24fd27,_0x323a1e){_0x323a1e=_0x323a1e||0xc8;return function(_0x5cb500){if(_0x5cb500){return _0x24fd27['status'](_0x323a1e)['json'](_0x5cb500);}};}function respondWithFilteredResult(_0x56b4b3,_0x203d30){return function(_0x2f4297){if(_0x2f4297){var _0x563e81=_0x2f4297['count'],_0x422d20=_0x203d30['offset'],_0x39c8cb=_0x203d30['offset']+_0x203d30['limit'],_0x364a31;if(_0x39c8cb>=_0x563e81){_0x39c8cb=_0x563e81;_0x364a31=0xc8;}else{_0x364a31=0xce;}_0x56b4b3['status'](_0x364a31);return _0x56b4b3[_0x1989('0x17')](_0x1989('0x18'),_0x422d20+'-'+_0x39c8cb+'/'+_0x563e81)[_0x1989('0x19')](_0x2f4297);}return null;};}function patchUpdates(_0xb5dc38){return function(_0x347d89){try{jsonpatch['apply'](_0x347d89,_0xb5dc38,!![]);}catch(_0x491c4c){return BPromise[_0x1989('0x1a')](_0x491c4c);}return _0x347d89[_0x1989('0x1b')]();};}function saveUpdates(_0x232400,_0x2d3ba4){return function(_0x84ee8c){if(_0x84ee8c){return _0x84ee8c[_0x1989('0x1c')](_0x232400)[_0x1989('0x1d')](function(_0x428a35){return _0x428a35;});}return null;};}function removeEntity(_0x21d60b,_0x4ff740){return function(_0x4e6123){if(_0x4e6123){return _0x4e6123['destroy']()['then'](function(){_0x21d60b[_0x1989('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6cd7f6,_0x187a7d){return function(_0x1b609c){if(!_0x1b609c){_0x6cd7f6['sendStatus'](0x194);}return _0x1b609c;};}function handleError(_0x4efa77,_0x15742b){_0x15742b=_0x15742b||0x1f4;return function(_0x159fa2){logger[_0x1989('0x1e')](_0x159fa2['stack']);if(_0x159fa2[_0x1989('0x1f')]){delete _0x159fa2[_0x1989('0x1f')];}_0x4efa77[_0x1989('0x16')](_0x15742b)['send'](_0x159fa2);};}exports[_0x1989('0x20')]=function(_0x4c7623,_0x4c84e9){var _0x179b32={},_0x281df3={},_0x5bb346={'count':0x0,'rows':[]};var _0x26b9de=_[_0x1989('0x21')](db[_0x1989('0x22')][_0x1989('0x23')],function(_0x20f1c1){return{'name':_0x20f1c1[_0x1989('0x24')],'type':_0x20f1c1[_0x1989('0x25')]['key']};});_0x281df3['model']=_[_0x1989('0x26')](_[_0x1989('0x21')](_0x26b9de,_0x1989('0x1f')),[_0x1989('0x1f')]);_0x281df3[_0x1989('0x27')]=_[_0x1989('0x28')](_0x4c7623[_0x1989('0x27')]);_0x281df3[_0x1989('0x29')]=_[_0x1989('0x2a')](_0x281df3[_0x1989('0x2b')],_0x281df3['query']);_0x179b32[_0x1989('0x2c')]=_[_0x1989('0x2a')](_0x281df3[_0x1989('0x2b')],qs['fields'](_0x4c7623['query']['fields']));_0x179b32[_0x1989('0x2c')]=_0x179b32[_0x1989('0x2c')]['length']?_0x179b32[_0x1989('0x2c')]:_0x281df3[_0x1989('0x2b')];if(!_0x4c7623['query'][_0x1989('0x2d')]('nolimit')){_0x179b32['limit']=qs[_0x1989('0x2e')](_0x4c7623[_0x1989('0x27')][_0x1989('0x2e')]);_0x179b32[_0x1989('0x2f')]=qs[_0x1989('0x2f')](_0x4c7623[_0x1989('0x27')][_0x1989('0x2f')]);}_0x179b32[_0x1989('0x30')]=qs[_0x1989('0x31')](_0x4c7623['query'][_0x1989('0x31')]);_0x179b32['where']=qs['filters'](_[_0x1989('0x32')](_0x4c7623[_0x1989('0x27')],_0x281df3[_0x1989('0x29')]),_0x26b9de);if(_0x4c7623[_0x1989('0x27')][_0x1989('0x33')]){_0x179b32[_0x1989('0x34')]=_['merge'](_0x179b32['where'],{'$or':_[_0x1989('0x21')](_0x26b9de,function(_0x106b7e){if(_0x106b7e[_0x1989('0x25')]!=='VIRTUAL'){var _0x5c945a={};_0x5c945a[_0x106b7e[_0x1989('0x1f')]]={'$like':'%'+_0x4c7623['query'][_0x1989('0x33')]+'%'};return _0x5c945a;}})});}_0x179b32=_['merge']({},_0x179b32,_0x4c7623[_0x1989('0x35')]);var _0x111344={'where':_0x179b32[_0x1989('0x34')]};return db[_0x1989('0x22')][_0x1989('0x36')](_0x111344)[_0x1989('0x1d')](function(_0x2b3ba6){_0x5bb346[_0x1989('0x36')]=_0x2b3ba6;if(_0x4c7623[_0x1989('0x27')][_0x1989('0x37')]){_0x179b32[_0x1989('0x38')]=[{'all':!![]}];}return db[_0x1989('0x22')][_0x1989('0x39')](_0x179b32);})[_0x1989('0x1d')](function(_0x1e659f){_0x5bb346[_0x1989('0x3a')]=_0x1e659f;return _0x5bb346;})[_0x1989('0x1d')](respondWithFilteredResult(_0x4c84e9,_0x179b32))['catch'](handleError(_0x4c84e9,null));};exports[_0x1989('0x3b')]=function(_0x5fd059,_0x3d9b09){var _0x242f63={'raw':!![],'where':{'id':_0x5fd059[_0x1989('0x3c')]['id']}},_0x4cd471={};_0x4cd471['model']=_[_0x1989('0x28')](db[_0x1989('0x22')][_0x1989('0x23')]);_0x4cd471[_0x1989('0x27')]=_[_0x1989('0x28')](_0x5fd059[_0x1989('0x27')]);_0x4cd471[_0x1989('0x29')]=_['intersection'](_0x4cd471['model'],_0x4cd471[_0x1989('0x27')]);_0x242f63['attributes']=_[_0x1989('0x2a')](_0x4cd471[_0x1989('0x2b')],qs[_0x1989('0x3d')](_0x5fd059[_0x1989('0x27')][_0x1989('0x3d')]));_0x242f63[_0x1989('0x2c')]=_0x242f63[_0x1989('0x2c')][_0x1989('0x3e')]?_0x242f63[_0x1989('0x2c')]:_0x4cd471[_0x1989('0x2b')];if(_0x5fd059[_0x1989('0x27')][_0x1989('0x37')]){_0x242f63[_0x1989('0x38')]=[{'all':!![]}];}_0x242f63=_[_0x1989('0x3f')]({},_0x242f63,_0x5fd059['options']);return db['CmCustomField']['find'](_0x242f63)[_0x1989('0x1d')](handleEntityNotFound(_0x3d9b09,null))['then'](respondWithResult(_0x3d9b09,null))[_0x1989('0x40')](handleError(_0x3d9b09,null));};exports[_0x1989('0x1c')]=function(_0x2c2f60,_0x2ca024){if(_0x2c2f60[_0x1989('0x41')]['id']){delete _0x2c2f60[_0x1989('0x41')]['id'];}return db[_0x1989('0x22')][_0x1989('0x42')]({'where':{'id':_0x2c2f60['params']['id']}})[_0x1989('0x1d')](handleEntityNotFound(_0x2ca024,null))[_0x1989('0x1d')](saveUpdates(_0x2c2f60[_0x1989('0x41')],null))['then'](respondWithResult(_0x2ca024,null))['catch'](handleError(_0x2ca024,null));};exports[_0x1989('0x43')]=function(_0xb4de5a,_0x18528c){return db[_0x1989('0x22')][_0x1989('0x42')]({'where':{'id':_0xb4de5a['params']['id']}})['then'](handleEntityNotFound(_0x18528c,null))[_0x1989('0x1d')](removeEntity(_0x18528c,null))[_0x1989('0x40')](handleError(_0x18528c,null));};exports['create']=function(_0x2e7f06,_0x5d5942){var _0x16b747;return db[_0x1989('0x44')]['transaction'](function(_0x5c7947){return db[_0x1989('0x22')][_0x1989('0x45')](_0x2e7f06[_0x1989('0x41')],{'transaction':_0x5c7947})[_0x1989('0x1d')](function(_0xd43099){_0x16b747=_0xd43099;var _0x5daec7={'type':db[_0x1989('0x46')][_0x1989('0x47')],'transaction':_0x5c7947};switch(_0x2e7f06[_0x1989('0x41')][_0x1989('0x25')]){case'text':_0x5daec7[_0x1989('0x25')]=db[_0x1989('0x46')]['TEXT'];break;case _0x1989('0x48'):_0x5daec7['type']=db[_0x1989('0x46')][_0x1989('0x49')];break;case _0x1989('0x4a'):_0x5daec7['type']=db[_0x1989('0x46')][_0x1989('0x4b')];_0x5daec7[_0x1989('0x4c')]=![];break;default:}return db[_0x1989('0x44')][_0x1989('0x4d')][_0x1989('0x4e')](_0x1989('0x4f'),util['format'](_0x1989('0x50'),_0x16b747['id']),_0x5daec7);})[_0x1989('0x1d')](function(){return _0x16b747;});})[_0x1989('0x1d')](respondWithResult(_0x5d5942,0xc9))[_0x1989('0x40')](handleError(_0x5d5942,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3ba79a0..0bcc009 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 _0x01a6=['rimraf','./cmCustomField.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a1da5,_0x5ef670){var _0x294b22=function(_0x4f2bfd){while(--_0x4f2bfd){_0x5a1da5['push'](_0x5a1da5['shift']());}};_0x294b22(++_0x5ef670);}(_0x01a6,0x162));var _0x601a=function(_0xadfb98,_0x1370cf){_0xadfb98=_0xadfb98-0x0;var _0x11c795=_0x01a6[_0xadfb98];return _0x11c795;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var logger=require(_0x601a('0x1'))(_0x601a('0x2'));var moment=require(_0x601a('0x3'));var BPromise=require(_0x601a('0x4'));var rp=require(_0x601a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x601a('0x6'));var config=require('../../config/environment');var attributes=require(_0x601a('0x7'));module[_0x601a('0x8')]=function(_0x30df8c,_0x196c77){return _0x30df8c[_0x601a('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['CmCustomField','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','define'];(function(_0x535e0a,_0x40004e){var _0x55666d=function(_0x5f363a){while(--_0x5f363a){_0x535e0a['push'](_0x535e0a['shift']());}};_0x55666d(++_0x40004e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xb7e7[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 918c2b1..49a2a55 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 _0x5db8=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5db8,0xbb));var _0x85db=function(_0x12a612,_0x2a147e){_0x12a612=_0x12a612-0x0;var _0x20eea8=_0x5db8[_0x12a612];return _0x20eea8;};'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')]('CmCustomField,\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')]('CmCustomField,\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);});});} \ No newline at end of file +var _0x0a9a=['CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x40e0eb,_0x51f9a5){var _0x3b11ee=function(_0x17435d){while(--_0x17435d){_0x40e0eb['push'](_0x40e0eb['shift']());}};_0x3b11ee(++_0x51f9a5);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1ba0b0,_0x45d14b){_0x1ba0b0=_0x1ba0b0-0x0;var _0x287928=_0x0a9a[_0x1ba0b0];return _0x287928;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4cc7d66..6e2d485 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 _0x2993=['/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index'];(function(_0x3987ab,_0x3bcf53){var _0x7d0155=function(_0x265fc0){while(--_0x265fc0){_0x3987ab['push'](_0x3987ab['shift']());}};_0x7d0155(++_0x3bcf53);}(_0x2993,0xb1));var _0x3299=function(_0x247498,_0x33dfc3){_0x247498=_0x247498-0x0;var _0x4fa03a=_0x2993[_0x247498];return _0x4fa03a;};'use strict';var multer=require(_0x3299('0x0'));var util=require(_0x3299('0x1'));var path=require(_0x3299('0x2'));var timeout=require(_0x3299('0x3'));var express=require(_0x3299('0x4'));var router=express[_0x3299('0x5')]();var auth=require(_0x3299('0x6'));var interaction=require(_0x3299('0x7'));var config=require(_0x3299('0x8'));var controller=require(_0x3299('0x9'));router[_0x3299('0xa')]('/',auth[_0x3299('0xb')](),controller[_0x3299('0xc')]);router[_0x3299('0xa')](_0x3299('0xd'),auth[_0x3299('0xb')](),controller['show']);router[_0x3299('0xe')]('/',auth['isAuthenticated'](),controller[_0x3299('0xf')]);router[_0x3299('0x10')](_0x3299('0xd'),auth[_0x3299('0xb')](),controller['update']);router[_0x3299('0x11')](_0x3299('0xd'),auth[_0x3299('0xb')](),controller['destroy']);module[_0x3299('0x12')]=router; \ No newline at end of file +var _0x06e0=['../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x34d0ab,_0x45eccd){var _0x7ee0b0=function(_0x41f754){while(--_0x41f754){_0x34d0ab['push'](_0x34d0ab['shift']());}};_0x7ee0b0(++_0x45eccd);}(_0x06e0,0xb8));var _0x006e=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x06e0[_0x43941d];return _0x27b82a;};'use strict';var multer=require(_0x006e('0x0'));var util=require(_0x006e('0x1'));var path=require(_0x006e('0x2'));var timeout=require(_0x006e('0x3'));var express=require(_0x006e('0x4'));var router=express[_0x006e('0x5')]();var auth=require(_0x006e('0x6'));var interaction=require(_0x006e('0x7'));var config=require('../../config/environment');var controller=require(_0x006e('0x8'));router[_0x006e('0x9')]('/',auth[_0x006e('0xa')](),controller[_0x006e('0xb')]);router['get'](_0x006e('0xc'),auth[_0x006e('0xa')](),controller[_0x006e('0xd')]);router[_0x006e('0xe')]('/',auth[_0x006e('0xa')](),controller[_0x006e('0xf')]);router['put']('/:id',auth[_0x006e('0xa')](),controller[_0x006e('0x10')]);router[_0x006e('0x11')](_0x006e('0xc'),auth[_0x006e('0xa')](),controller['destroy']);module[_0x006e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 50af830..4a16fa4 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 _0xba34=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','INTEGER','DATE'];(function(_0x526bd3,_0x4fdb69){var _0x31bb48=function(_0x85e42){while(--_0x85e42){_0x526bd3['push'](_0x526bd3['shift']());}};_0x31bb48(++_0x4fdb69);}(_0xba34,0x119));var _0x4ba3=function(_0x32b19e,_0x1ad05d){_0x32b19e=_0x32b19e-0x0;var _0x2d595d=_0xba34[_0x32b19e];return _0x2d595d;};'use strict';var moment=require(_0x4ba3('0x0'));var Sequelize=require(_0x4ba3('0x1'));module[_0x4ba3('0x2')]={'phone':{'type':Sequelize[_0x4ba3('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4ba3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4ba3('0x6')]},'priority':{'type':Sequelize[_0x4ba3('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4ba3('0x5')],'unique':_0x4ba3('0x7')},'ListId':{'type':Sequelize[_0x4ba3('0x5')],'unique':_0x4ba3('0x7')},'UserId':{'type':Sequelize[_0x4ba3('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x4ba3('0x5')],'unique':_0x4ba3('0x7')},'CampaignId':{'type':Sequelize[_0x4ba3('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1261=['sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue'];(function(_0x270cff,_0x1c995c){var _0x27cc87=function(_0x4df9bd){while(--_0x4df9bd){_0x270cff['push'](_0x270cff['shift']());}};_0x27cc87(++_0x1c995c);}(_0x1261,0x144));var _0x1126=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0x1261[_0x31a37b];return _0x49ae16;};'use strict';var moment=require('moment');var Sequelize=require(_0x1126('0x0'));module[_0x1126('0x1')]={'phone':{'type':Sequelize[_0x1126('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1126('0x4')],'defaultValue':moment()[_0x1126('0x5')](_0x1126('0x6'))},'countbusyretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1126('0x4')]},'priority':{'type':Sequelize[_0x1126('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1126('0x7')],'unique':_0x1126('0x8')},'ListId':{'type':Sequelize[_0x1126('0x7')],'unique':_0x1126('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x1126('0x7')],'unique':_0x1126('0x8')},'CampaignId':{'type':Sequelize[_0x1126('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 73b530a..1fb8cce 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 _0x3da5=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$or','$lt','$lte','$not','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$any','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','CmHopper','findAll','rows','show','params','length','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','calleridnum','phone','campaigntype','queue','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','format','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','html-pdf','eml-format','rimraf','request-promise','moment'];(function(_0x3fc611,_0x4d72cf){var _0x59661b=function(_0x4d5af0){while(--_0x4d5af0){_0x3fc611['push'](_0x3fc611['shift']());}};_0x59661b(++_0x4d72cf);}(_0x3da5,0x12b));var _0x53da=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x3da5[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0x53da('0x0'));var emlformat=require(_0x53da('0x1'));var rimraf=require(_0x53da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x53da('0x3'));var moment=require(_0x53da('0x4'));var BPromise=require(_0x53da('0x5'));var Mustache=require(_0x53da('0x6'));var util=require(_0x53da('0x7'));var path=require('path');var sox=require(_0x53da('0x8'));var csv=require(_0x53da('0x9'));var ejs=require(_0x53da('0xa'));var fs=require('fs');var _=require(_0x53da('0xb'));var squel=require(_0x53da('0xc'));var crypto=require(_0x53da('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53da('0xe'));var Papa=require(_0x53da('0xf'));var Redis=require(_0x53da('0x10'));var shared=require(_0x53da('0x11'));var authService=require(_0x53da('0x12'));var qs=require(_0x53da('0x13'));var as=require(_0x53da('0x14'));var hardwareService=require(_0x53da('0x15'));var logger=require(_0x53da('0x16'))(_0x53da('0x17'));var utils=require(_0x53da('0x18'));var config=require(_0x53da('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20dd38,_0x147954){_0x147954=_0x147954||0xcc;return function(_0x15514d){if(_0x15514d){return _0x20dd38[_0x53da('0x19')](_0x147954);}return _0x20dd38[_0x53da('0x1a')](_0x147954)[_0x53da('0x1b')]();};}function respondWithResult(_0x454df3,_0xfe5ba2){_0xfe5ba2=_0xfe5ba2||0xc8;return function(_0x45b9bb){if(_0x45b9bb){return _0x454df3[_0x53da('0x1a')](_0xfe5ba2)[_0x53da('0x1c')](_0x45b9bb);}};}function respondWithFilteredResult(_0x50519a,_0xd84971){return function(_0x15e8c7){if(_0x15e8c7){var _0x597e6b=_0x15e8c7[_0x53da('0x1d')],_0x40bb7e=_0xd84971[_0x53da('0x1e')],_0x541975=_0xd84971[_0x53da('0x1e')]+_0xd84971[_0x53da('0x1f')],_0x54097f;if(_0x541975>=_0x597e6b){_0x541975=_0x597e6b;_0x54097f=0xc8;}else{_0x54097f=0xce;}_0x50519a[_0x53da('0x1a')](_0x54097f);return _0x50519a[_0x53da('0x20')](_0x53da('0x21'),_0x40bb7e+'-'+_0x541975+'/'+_0x597e6b)['json'](_0x15e8c7);}return null;};}function patchUpdates(_0x4196cf){return function(_0x53ba8f){try{jsonpatch['apply'](_0x53ba8f,_0x4196cf,!![]);}catch(_0x14e17d){return BPromise['reject'](_0x14e17d);}return _0x53ba8f[_0x53da('0x22')]();};}function saveUpdates(_0x2273e2,_0x59d1da){return function(_0xbb4ce8){if(_0xbb4ce8){return _0xbb4ce8[_0x53da('0x23')](_0x2273e2)[_0x53da('0x24')](function(_0x34aa06){return _0x34aa06;});}return null;};}function removeEntity(_0x34af8d,_0x58d645){return function(_0x5bb2b7){if(_0x5bb2b7){return _0x5bb2b7[_0x53da('0x25')]()[_0x53da('0x24')](function(){_0x34af8d[_0x53da('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9a12,_0x4b0487){return function(_0x3b6a90){if(!_0x3b6a90){_0x5b9a12[_0x53da('0x19')](0x194);}return _0x3b6a90;};}function handleError(_0x3763d1,_0x57fe3f){_0x57fe3f=_0x57fe3f||0x1f4;return function(_0x101b51){logger[_0x53da('0x26')](_0x101b51['stack']);if(_0x101b51[_0x53da('0x27')]){delete _0x101b51[_0x53da('0x27')];}_0x3763d1[_0x53da('0x1a')](_0x57fe3f)[_0x53da('0x28')](_0x101b51);};}exports['index']=function(_0x5053d9,_0x230f2a){var _0x5684eb={},_0x5d04e6={},_0x5df533={'count':0x0,'rows':[]};var _0x151d04=_[_0x53da('0x29')](db['CmHopper'][_0x53da('0x2a')],function(_0xe012df){return{'name':_0xe012df[_0x53da('0x2b')],'type':_0xe012df[_0x53da('0x2c')][_0x53da('0x2d')]};});_0x5d04e6[_0x53da('0x2e')]=_[_0x53da('0x29')](_0x151d04,'name');_0x5d04e6[_0x53da('0x2f')]=_[_0x53da('0x30')](_0x5053d9[_0x53da('0x2f')]);_0x5d04e6[_0x53da('0x31')]=_['intersection'](_0x5d04e6[_0x53da('0x2e')],_0x5d04e6[_0x53da('0x2f')]);_0x5d04e6[_0x53da('0x31')]=_[_0x53da('0x32')](_0x5d04e6[_0x53da('0x31')],[_0x53da('0x33'),_0x53da('0x34'),'$gt','$gte',_0x53da('0x35'),_0x53da('0x36'),'$ne','$eq',_0x53da('0x37'),'$between',_0x53da('0x38'),_0x53da('0x39'),'$notIn',_0x53da('0x3a'),'$notLike',_0x53da('0x3b'),_0x53da('0x3c'),_0x53da('0x3a'),_0x53da('0x3d'),_0x53da('0x3e'),'$contained',_0x53da('0x3f')]);_0x5684eb['attributes']=_[_0x53da('0x40')](_0x5d04e6[_0x53da('0x2e')],qs[_0x53da('0x41')](_0x5053d9[_0x53da('0x2f')][_0x53da('0x41')]));_0x5684eb[_0x53da('0x42')]=_0x5684eb['attributes']['length']?_0x5684eb[_0x53da('0x42')]:_0x5d04e6[_0x53da('0x2e')];if(!_0x5053d9[_0x53da('0x2f')][_0x53da('0x43')](_0x53da('0x44'))){_0x5684eb[_0x53da('0x1f')]=qs[_0x53da('0x1f')](_0x5053d9['query'][_0x53da('0x1f')]);_0x5684eb[_0x53da('0x1e')]=qs[_0x53da('0x1e')](_0x5053d9[_0x53da('0x2f')][_0x53da('0x1e')]);}_0x5684eb[_0x53da('0x45')]=qs[_0x53da('0x46')](_0x5053d9[_0x53da('0x2f')]['sort']);_0x5684eb[_0x53da('0x47')]=qs[_0x53da('0x31')](_[_0x53da('0x48')](_0x5053d9[_0x53da('0x2f')],_0x5d04e6['filters']),_0x151d04);if(_0x5053d9['query']['filter']){_0x5684eb[_0x53da('0x47')]=_[_0x53da('0x49')](_0x5684eb[_0x53da('0x47')],{'$or':_['map'](_0x151d04,function(_0x317c98){if(_0x317c98[_0x53da('0x2c')]!==_0x53da('0x4a')){var _0x2d194c={};_0x2d194c[_0x317c98[_0x53da('0x27')]]={'$like':'%'+_0x5053d9['query'][_0x53da('0x4b')]+'%'};return _0x2d194c;}})});}_0x5684eb=_['merge']({},_0x5684eb,_0x5053d9[_0x53da('0x4c')]);var _0x5314c5={'where':_0x5684eb[_0x53da('0x47')]};return db['CmHopper'][_0x53da('0x1d')](_0x5314c5)[_0x53da('0x24')](function(_0x39a09a){_0x5df533[_0x53da('0x1d')]=_0x39a09a;if(_0x5053d9[_0x53da('0x2f')][_0x53da('0x4d')]){_0x5684eb[_0x53da('0x4e')]=[{'all':!![]}];}return db[_0x53da('0x4f')][_0x53da('0x50')](_0x5684eb);})[_0x53da('0x24')](function(_0x499bfe){_0x5df533[_0x53da('0x51')]=_0x499bfe;return _0x5df533;})[_0x53da('0x24')](respondWithFilteredResult(_0x230f2a,_0x5684eb))['catch'](handleError(_0x230f2a,null));};exports[_0x53da('0x52')]=function(_0x10c695,_0x1cc1ee){var _0x5cd8ae={'raw':!![],'where':{'id':_0x10c695[_0x53da('0x53')]['id']}},_0xed9ed8={};_0xed9ed8[_0x53da('0x2e')]=_[_0x53da('0x30')](db[_0x53da('0x4f')][_0x53da('0x2a')]);_0xed9ed8[_0x53da('0x2f')]=_[_0x53da('0x30')](_0x10c695[_0x53da('0x2f')]);_0xed9ed8['filters']=_[_0x53da('0x40')](_0xed9ed8[_0x53da('0x2e')],_0xed9ed8[_0x53da('0x2f')]);_0x5cd8ae[_0x53da('0x42')]=_['intersection'](_0xed9ed8['model'],qs[_0x53da('0x41')](_0x10c695[_0x53da('0x2f')][_0x53da('0x41')]));_0x5cd8ae['attributes']=_0x5cd8ae[_0x53da('0x42')][_0x53da('0x54')]?_0x5cd8ae['attributes']:_0xed9ed8[_0x53da('0x2e')];if(_0x10c695[_0x53da('0x2f')][_0x53da('0x4d')]){_0x5cd8ae[_0x53da('0x4e')]=[{'all':!![]}];}_0x5cd8ae=_[_0x53da('0x49')]({},_0x5cd8ae,_0x10c695[_0x53da('0x4c')]);return db[_0x53da('0x4f')][_0x53da('0x55')](_0x5cd8ae)['then'](handleEntityNotFound(_0x1cc1ee,null))['then'](respondWithResult(_0x1cc1ee,null))[_0x53da('0x56')](handleError(_0x1cc1ee,null));};exports['create']=function(_0x4e7cd8,_0xf1c6b1){return db[_0x53da('0x4f')][_0x53da('0x57')](_0x4e7cd8[_0x53da('0x58')],{})[_0x53da('0x24')](respondWithResult(_0xf1c6b1,0xc9))[_0x53da('0x56')](handleError(_0xf1c6b1,null));};exports[_0x53da('0x23')]=function(_0x209242,_0x545ade){if(_0x209242[_0x53da('0x58')]['id']){delete _0x209242[_0x53da('0x58')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x209242[_0x53da('0x53')]['id']}})[_0x53da('0x24')](handleEntityNotFound(_0x545ade,null))[_0x53da('0x24')](saveUpdates(_0x209242[_0x53da('0x58')],null))[_0x53da('0x24')](respondWithResult(_0x545ade,null))[_0x53da('0x56')](handleError(_0x545ade,null));};exports[_0x53da('0x59')]=function(_0xb20c24,_0x1288d1){return db[_0x53da('0x4f')][_0x53da('0x59')]()[_0x53da('0x24')](respondWithResult(_0x1288d1,null))[_0x53da('0x56')](handleError(_0x1288d1,null));};exports[_0x53da('0x25')]=function(_0x34f789,_0x17cd37){var _0x241e7d;return db[_0x53da('0x4f')][_0x53da('0x55')]({'where':{'id':_0x34f789[_0x53da('0x53')]['id']}})[_0x53da('0x24')](handleEntityNotFound(_0x17cd37,null))['then'](function(_0x35f2d0){if(_0x35f2d0){return _0x35f2d0['destroy']()[_0x53da('0x24')](function(_0x234780){return _0x234780;});}})[_0x53da('0x24')](function(_0x285886){_0x241e7d=_0x285886;if(_0x285886){if(_0x285886[_0x53da('0x5a')]||_0x285886[_0x53da('0x5b')]){return db[_0x285886[_0x53da('0x5a')]?_0x53da('0x5c'):_0x53da('0x5d')][_0x53da('0x55')]({'where':{'id':_0x285886['VoiceQueueId']?_0x285886[_0x53da('0x5a')]:_0x285886[_0x53da('0x5b')]},'attributes':['id',_0x53da('0x27')],'raw':!![]});}}})['then'](function(_0x1fb19a){var _0x5ab3e0={};if(_0x1fb19a){_[_0x53da('0x49')](_0x5ab3e0,_[_0x53da('0x5e')](_0x241e7d[_0x53da('0x5f')],[_0x53da('0x60'),_0x53da('0x61'),'id']));_0x5ab3e0[_0x53da('0x62')]=0x15;_0x5ab3e0[_0x53da('0x63')]=_0x53da('0x64');_0x5ab3e0['campaign']=_0x1fb19a[_0x53da('0x27')];_0x5ab3e0[_0x53da('0x65')]=_0x34f789[_0x53da('0x66')][_0x53da('0x27')];_0x5ab3e0[_0x53da('0x67')]=_0x34f789['user']['id'];_0x5ab3e0[_0x53da('0x64')]=!![];_0x5ab3e0['deletedat']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5ab3e0[_0x53da('0x68')]=_0x241e7d[_0x53da('0x69')];_0x5ab3e0[_0x53da('0x6a')]=_0x241e7d['VoiceQueueId']?_0x53da('0x6b'):_0x53da('0x6c');return db[_0x53da('0x6d')]['find']({'where':{'id':_0x5ab3e0['ContactId']},'attributes':['firstName',_0x53da('0x6e')]})['then'](function(_0x3ab4d2){if(!_[_0x53da('0x6f')](_0x17cd37)&&!_['isNil'](_0x3ab4d2[_0x53da('0x70')])){_0x5ab3e0[_0x53da('0x71')]=_0x3ab4d2[_0x53da('0x70')];if(!_[_0x53da('0x6f')](_0x3ab4d2['lastName'])){_0x5ab3e0[_0x53da('0x71')]+='\x20'+_0x3ab4d2[_0x53da('0x6e')];}}})[_0x53da('0x72')](function(){return db[_0x53da('0x73')]['create'](_0x5ab3e0);});}})[_0x53da('0x24')](function(){return _0x17cd37[_0x53da('0x1a')](0xcc)[_0x53da('0x1b')]();})[_0x53da('0x56')](handleError(_0x17cd37,null));};exports['getPreview']=function(_0x1f624d,_0x5cde1d,_0x5007c1){var _0x560117=[];return db[_0x53da('0x6d')][_0x53da('0x59')]()[_0x53da('0x24')](function(_0x5674ad){_0x560117=_[_0x53da('0x30')](_0x5674ad);return _0x1f624d[_0x53da('0x66')][_0x53da('0x74')]({'where':{'type':_0x53da('0x75'),'dialActive':!![],'dialMethod':_0x53da('0x76')},'attributes':['id',_0x53da('0x77')],'raw':!![]});})[_0x53da('0x24')](function(_0xebd108){if(_0xebd108&&_0xebd108[_0x53da('0x54')]){return db[_0x53da('0x78')]['transaction'](function(_0x209012){var _0x17d45a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x53da('0x79')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x53da('0x29')](_0xebd108,'id')},'$or':[{'UserId':null},{'UserId':_0x1f624d['user']['id']}]};var _0x2b5c8c=[];if(_0x1f624d[_0x53da('0x58')]['direction']&&_0x1f624d[_0x53da('0x58')][_0x53da('0x7a')]===_0x53da('0x7b')){if(!_[_0x53da('0x7c')](_0x1f624d['body'][_0x53da('0x7d')])){_0x17d45a['id']={'$in':_0x1f624d[_0x53da('0x58')][_0x53da('0x7d')]};}_0x2b5c8c=[[_0x53da('0x7e'),_0x53da('0x7f')],[_0x53da('0x80'),_0xebd108[0x0][_0x53da('0x77')]==='ASC'?_0x53da('0x81'):_0x53da('0x7f')],db['sequelize']['literal'](_0x53da('0x82')),['id','DESC']];}else{if(!_[_0x53da('0x7c')](_0x1f624d['body']['hopperIds'])){_0x17d45a['id']={'$notIn':_0x1f624d[_0x53da('0x58')][_0x53da('0x7d')]};}_0x2b5c8c=[[_0x53da('0x7e'),_0x53da('0x81')],[_0x53da('0x80'),_0xebd108[0x0][_0x53da('0x77')]],db['sequelize'][_0x53da('0x83')](_0x53da('0x84')),['id',_0x53da('0x7f')]];}return db['CmHopper'][_0x53da('0x85')]({'attributes':['id',_0x53da('0x86')],'where':_0x17d45a,'order':_0x2b5c8c,'transaction':_0x209012,'lock':_0x209012[_0x53da('0x87')][_0x53da('0x88')],'include':[{'model':db[_0x53da('0x6d')],'as':_0x53da('0x89'),'attributes':_0x560117,'include':[{'model':db[_0x53da('0x8a')],'as':_0x53da('0x8b'),'attributes':['id',_0x53da('0x27')]}]},{'model':db[_0x53da('0x8c')],'as':_0x53da('0x8d'),'attributes':['id',_0x53da('0x27')]},{'model':db['VoiceQueue'],'as':_0x53da('0x8e'),'attributes':['id',_0x53da('0x27'),_0x53da('0x8f')]}]})[_0x53da('0x24')](function(_0x276abf){if(_0x276abf){return _0x276abf[_0x53da('0x23')]({'UserId':_0x1f624d[_0x53da('0x66')]['id']},{'transaction':_0x209012});}});});}})[_0x53da('0x24')](handleEntityNotFound(_0x5cde1d,null))[_0x53da('0x24')](respondWithResult(_0x5cde1d,null))[_0x53da('0x56')](handleError(_0x5cde1d,null));};exports[_0x53da('0x90')]=function(_0x17d332,_0x250523,_0x3bcce2){return _0x17d332['user'][_0x53da('0x74')]({'where':{'type':_0x53da('0x75'),'dialActive':!![],'dialMethod':_0x53da('0x76')},'attributes':['id'],'raw':!![]})[_0x53da('0x24')](function(_0x4a91f9){if(_0x4a91f9&&_0x4a91f9['length']){return db['CmHopper'][_0x53da('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x53da('0x79')](_0x53da('0x91'))},'VoiceQueueId':{'$in':_[_0x53da('0x29')](_0x4a91f9,'id')},'$or':[{'UserId':null},{'UserId':_0x17d332[_0x53da('0x66')]['id']}]}});}return 0x0;})[_0x53da('0x24')](function(_0xbc9f0a){if(!_[_0x53da('0x6f')](_0xbc9f0a)&&_[_0x53da('0x92')](_0xbc9f0a)){return _0x250523[_0x53da('0x1a')](0xc8)[_0x53da('0x1c')]({'contacts':_0xbc9f0a});}else{logger[_0x53da('0x26')](_0x53da('0x93'),_0x53da('0x90'),0x194,_0x53da('0x94'));_0x250523['sendStatus'](0x194);}})[_0x53da('0x56')](handleError(_0x250523,null));};exports['getTimezones']=function(_0x34ff78,_0xbdf6ab,_0x82a3a4){var _0x26aa1b=shared[_0x53da('0x95')];var _0x3e5501=[];_['map'](_0x26aa1b,function(_0x4cfb69){_0x3e5501[_0x53da('0x96')]({'id':_0x4cfb69[_0x53da('0x27')],'name':_0x4cfb69['name'],'utcOffset':_0x4cfb69[_0x53da('0x97')]});});return _0xbdf6ab[_0x53da('0x1a')](0xc8)[_0x53da('0x1c')]({'tz':_0x3e5501});};exports['getTimezone']=function(_0x2a76f9,_0x257599,_0x2e6257){var _0x36f0a8=shared[_0x53da('0x95')];var _0x9b417b={};if(!_['isNil'](_0x36f0a8[_0x2a76f9[_0x53da('0x58')]['id']]))_0x9b417b=_0x36f0a8[_0x2a76f9[_0x53da('0x58')]['id']];return _0x257599[_0x53da('0x1a')](0xc8)['json'](_0x9b417b);}; \ No newline at end of file +var _0x8602=['hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','literal','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezone','timezones','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','error','stack','map','rawAttributes','fieldName','type','key','model','name','query','concat','filters','$and','$or','$lt','$lte','$eq','$not','$between','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','then','CmHopper','findAll','rows','catch','params','keys','includeAll','include','find','create','body','describe','VoiceQueue','Campaign','VoiceQueueId','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x8602,0x1d9));var _0x2860=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x8602[_0x1b3564];return _0x504069;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2860('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2860('0x1'));var jsonpatch=require(_0x2860('0x2'));var rp=require(_0x2860('0x3'));var moment=require(_0x2860('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2860('0x5'));var util=require(_0x2860('0x6'));var path=require('path');var sox=require(_0x2860('0x7'));var csv=require(_0x2860('0x8'));var ejs=require(_0x2860('0x9'));var fs=require('fs');var _=require(_0x2860('0xa'));var squel=require(_0x2860('0xb'));var crypto=require('crypto');var jsforce=require(_0x2860('0xc'));var deskjs=require(_0x2860('0xd'));var toCsv=require(_0x2860('0x8'));var querystring=require(_0x2860('0xe'));var Papa=require(_0x2860('0xf'));var Redis=require(_0x2860('0x10'));var shared=require('../../config/environment');var authService=require(_0x2860('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2860('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2860('0x13'))(_0x2860('0x14'));var utils=require(_0x2860('0x15'));var config=require(_0x2860('0x16'));var db=require(_0x2860('0x17'))['db'];function respondWithStatusCode(_0x5efb1d,_0x1a721d){_0x1a721d=_0x1a721d||0xcc;return function(_0xf4f6b6){if(_0xf4f6b6){return _0x5efb1d[_0x2860('0x18')](_0x1a721d);}return _0x5efb1d[_0x2860('0x19')](_0x1a721d)[_0x2860('0x1a')]();};}function respondWithResult(_0x336d24,_0x347607){_0x347607=_0x347607||0xc8;return function(_0x413d70){if(_0x413d70){return _0x336d24['status'](_0x347607)[_0x2860('0x1b')](_0x413d70);}};}function respondWithFilteredResult(_0x6c84ce,_0x4e0758){return function(_0x505217){if(_0x505217){var _0x5597e5=_0x505217[_0x2860('0x1c')],_0x47a466=_0x4e0758[_0x2860('0x1d')],_0x4ec4cb=_0x4e0758[_0x2860('0x1d')]+_0x4e0758[_0x2860('0x1e')],_0xbb1340;if(_0x4ec4cb>=_0x5597e5){_0x4ec4cb=_0x5597e5;_0xbb1340=0xc8;}else{_0xbb1340=0xce;}_0x6c84ce['status'](_0xbb1340);return _0x6c84ce[_0x2860('0x1f')]('Content-Range',_0x47a466+'-'+_0x4ec4cb+'/'+_0x5597e5)['json'](_0x505217);}return null;};}function patchUpdates(_0x3337b1){return function(_0x38ff53){try{jsonpatch['apply'](_0x38ff53,_0x3337b1,!![]);}catch(_0x34c002){return BPromise[_0x2860('0x20')](_0x34c002);}return _0x38ff53[_0x2860('0x21')]();};}function saveUpdates(_0x581175,_0x59b0e0){return function(_0x26474a){if(_0x26474a){return _0x26474a[_0x2860('0x22')](_0x581175)['then'](function(_0x583b8e){return _0x583b8e;});}return null;};}function removeEntity(_0x86e6d6,_0x59b6d1){return function(_0x3f7008){if(_0x3f7008){return _0x3f7008[_0x2860('0x23')]()['then'](function(){_0x86e6d6[_0x2860('0x19')](0xcc)[_0x2860('0x1a')]();});}};}function handleEntityNotFound(_0x48c50c,_0x4c26d2){return function(_0x333717){if(!_0x333717){_0x48c50c[_0x2860('0x18')](0x194);}return _0x333717;};}function handleError(_0x5b71b6,_0x2c9f9f){_0x2c9f9f=_0x2c9f9f||0x1f4;return function(_0x2b0ae5){logger[_0x2860('0x24')](_0x2b0ae5[_0x2860('0x25')]);if(_0x2b0ae5['name']){delete _0x2b0ae5['name'];}_0x5b71b6[_0x2860('0x19')](_0x2c9f9f)['send'](_0x2b0ae5);};}exports['index']=function(_0x1b1aad,_0x15a7ed){var _0x45f697={},_0x4409c9={},_0x915120={'count':0x0,'rows':[]};var _0x223b61=_[_0x2860('0x26')](db['CmHopper'][_0x2860('0x27')],function(_0x481c73){return{'name':_0x481c73[_0x2860('0x28')],'type':_0x481c73[_0x2860('0x29')][_0x2860('0x2a')]};});_0x4409c9[_0x2860('0x2b')]=_['map'](_0x223b61,_0x2860('0x2c'));_0x4409c9['query']=_['keys'](_0x1b1aad['query']);_0x4409c9['filters']=_['intersection'](_0x4409c9[_0x2860('0x2b')],_0x4409c9[_0x2860('0x2d')]);_0x4409c9['filters']=_[_0x2860('0x2e')](_0x4409c9[_0x2860('0x2f')],[_0x2860('0x30'),_0x2860('0x31'),'$gt','$gte',_0x2860('0x32'),_0x2860('0x33'),'$ne',_0x2860('0x34'),_0x2860('0x35'),_0x2860('0x36'),'$notBetween',_0x2860('0x37'),_0x2860('0x38'),'$like',_0x2860('0x39'),_0x2860('0x3a'),_0x2860('0x3b'),_0x2860('0x3c'),_0x2860('0x3d'),'$contains',_0x2860('0x3e'),_0x2860('0x3f')]);_0x45f697[_0x2860('0x40')]=_[_0x2860('0x41')](_0x4409c9[_0x2860('0x2b')],qs['fields'](_0x1b1aad[_0x2860('0x2d')][_0x2860('0x42')]));_0x45f697[_0x2860('0x40')]=_0x45f697[_0x2860('0x40')][_0x2860('0x43')]?_0x45f697[_0x2860('0x40')]:_0x4409c9['model'];if(!_0x1b1aad[_0x2860('0x2d')][_0x2860('0x44')](_0x2860('0x45'))){_0x45f697['limit']=qs[_0x2860('0x1e')](_0x1b1aad[_0x2860('0x2d')][_0x2860('0x1e')]);_0x45f697[_0x2860('0x1d')]=qs[_0x2860('0x1d')](_0x1b1aad[_0x2860('0x2d')][_0x2860('0x1d')]);}_0x45f697[_0x2860('0x46')]=qs['sort'](_0x1b1aad['query']['sort']);_0x45f697[_0x2860('0x47')]=qs[_0x2860('0x2f')](_[_0x2860('0x48')](_0x1b1aad[_0x2860('0x2d')],_0x4409c9[_0x2860('0x2f')]),_0x223b61);if(_0x1b1aad[_0x2860('0x2d')][_0x2860('0x49')]){_0x45f697[_0x2860('0x47')]=_[_0x2860('0x4a')](_0x45f697[_0x2860('0x47')],{'$or':_['map'](_0x223b61,function(_0x59f596){if(_0x59f596[_0x2860('0x29')]!==_0x2860('0x4b')){var _0x5d6f83={};_0x5d6f83[_0x59f596[_0x2860('0x2c')]]={'$like':'%'+_0x1b1aad[_0x2860('0x2d')][_0x2860('0x49')]+'%'};return _0x5d6f83;}})});}_0x45f697=_[_0x2860('0x4a')]({},_0x45f697,_0x1b1aad[_0x2860('0x4c')]);var _0x34fb1d={'where':_0x45f697[_0x2860('0x47')]};return db['CmHopper'][_0x2860('0x1c')](_0x34fb1d)[_0x2860('0x4d')](function(_0x2aced2){_0x915120[_0x2860('0x1c')]=_0x2aced2;if(_0x1b1aad['query']['includeAll']){_0x45f697['include']=[{'all':!![]}];}return db[_0x2860('0x4e')][_0x2860('0x4f')](_0x45f697);})['then'](function(_0x243f9e){_0x915120[_0x2860('0x50')]=_0x243f9e;return _0x915120;})[_0x2860('0x4d')](respondWithFilteredResult(_0x15a7ed,_0x45f697))[_0x2860('0x51')](handleError(_0x15a7ed,null));};exports['show']=function(_0x14fd7c,_0x41f5f9){var _0x4fe629={'raw':!![],'where':{'id':_0x14fd7c[_0x2860('0x52')]['id']}},_0x2c5cc1={};_0x2c5cc1[_0x2860('0x2b')]=_[_0x2860('0x53')](db[_0x2860('0x4e')]['rawAttributes']);_0x2c5cc1[_0x2860('0x2d')]=_[_0x2860('0x53')](_0x14fd7c[_0x2860('0x2d')]);_0x2c5cc1['filters']=_[_0x2860('0x41')](_0x2c5cc1[_0x2860('0x2b')],_0x2c5cc1[_0x2860('0x2d')]);_0x4fe629[_0x2860('0x40')]=_[_0x2860('0x41')](_0x2c5cc1[_0x2860('0x2b')],qs[_0x2860('0x42')](_0x14fd7c[_0x2860('0x2d')][_0x2860('0x42')]));_0x4fe629[_0x2860('0x40')]=_0x4fe629[_0x2860('0x40')]['length']?_0x4fe629['attributes']:_0x2c5cc1[_0x2860('0x2b')];if(_0x14fd7c[_0x2860('0x2d')][_0x2860('0x54')]){_0x4fe629[_0x2860('0x55')]=[{'all':!![]}];}_0x4fe629=_[_0x2860('0x4a')]({},_0x4fe629,_0x14fd7c['options']);return db[_0x2860('0x4e')][_0x2860('0x56')](_0x4fe629)[_0x2860('0x4d')](handleEntityNotFound(_0x41f5f9,null))['then'](respondWithResult(_0x41f5f9,null))['catch'](handleError(_0x41f5f9,null));};exports[_0x2860('0x57')]=function(_0x142d3d,_0x3b509e){return db[_0x2860('0x4e')][_0x2860('0x57')](_0x142d3d[_0x2860('0x58')],{})['then'](respondWithResult(_0x3b509e,0xc9))[_0x2860('0x51')](handleError(_0x3b509e,null));};exports[_0x2860('0x22')]=function(_0x679053,_0x2ce2dd){if(_0x679053[_0x2860('0x58')]['id']){delete _0x679053[_0x2860('0x58')]['id'];}return db[_0x2860('0x4e')][_0x2860('0x56')]({'where':{'id':_0x679053[_0x2860('0x52')]['id']}})['then'](handleEntityNotFound(_0x2ce2dd,null))[_0x2860('0x4d')](saveUpdates(_0x679053[_0x2860('0x58')],null))['then'](respondWithResult(_0x2ce2dd,null))[_0x2860('0x51')](handleError(_0x2ce2dd,null));};exports[_0x2860('0x59')]=function(_0x30752e,_0x375d41){return db[_0x2860('0x4e')][_0x2860('0x59')]()['then'](respondWithResult(_0x375d41,null))[_0x2860('0x51')](handleError(_0x375d41,null));};exports[_0x2860('0x23')]=function(_0x4e81b6,_0x55f635){var _0x48c382;return db[_0x2860('0x4e')]['find']({'where':{'id':_0x4e81b6[_0x2860('0x52')]['id']}})[_0x2860('0x4d')](handleEntityNotFound(_0x55f635,null))[_0x2860('0x4d')](function(_0x4bb41e){if(_0x4bb41e){return _0x4bb41e[_0x2860('0x23')]()[_0x2860('0x4d')](function(_0xf6af95){return _0xf6af95;});}})[_0x2860('0x4d')](function(_0xc0f30){_0x48c382=_0xc0f30;if(_0xc0f30){if(_0xc0f30['VoiceQueueId']||_0xc0f30['CampaignId']){return db[_0xc0f30['VoiceQueueId']?_0x2860('0x5a'):_0x2860('0x5b')][_0x2860('0x56')]({'where':{'id':_0xc0f30[_0x2860('0x5c')]?_0xc0f30[_0x2860('0x5c')]:_0xc0f30[_0x2860('0x5d')]},'attributes':['id',_0x2860('0x2c')],'raw':!![]});}}})['then'](function(_0x45fb54){var _0x30e857={};if(_0x45fb54){_[_0x2860('0x4a')](_0x30e857,_[_0x2860('0x5e')](_0x48c382[_0x2860('0x5f')],[_0x2860('0x60'),_0x2860('0x61'),'id']));_0x30e857[_0x2860('0x62')]=0x15;_0x30e857[_0x2860('0x63')]='deleted';_0x30e857[_0x2860('0x64')]=_0x45fb54[_0x2860('0x2c')];_0x30e857[_0x2860('0x65')]=_0x4e81b6[_0x2860('0x66')][_0x2860('0x2c')];_0x30e857[_0x2860('0x67')]=_0x4e81b6[_0x2860('0x66')]['id'];_0x30e857[_0x2860('0x68')]=!![];_0x30e857['deletedat']=moment()[_0x2860('0x69')](_0x2860('0x6a'));_0x30e857['calleridnum']=_0x48c382[_0x2860('0x6b')];_0x30e857[_0x2860('0x6c')]=_0x48c382['VoiceQueueId']?_0x2860('0x6d'):_0x2860('0x6e');return db[_0x2860('0x6f')][_0x2860('0x56')]({'where':{'id':_0x30e857[_0x2860('0x70')]},'attributes':[_0x2860('0x71'),_0x2860('0x72')]})[_0x2860('0x4d')](function(_0x298a34){if(!_['isNil'](_0x55f635)&&!_[_0x2860('0x73')](_0x298a34[_0x2860('0x71')])){_0x30e857[_0x2860('0x74')]=_0x298a34[_0x2860('0x71')];if(!_['isNil'](_0x298a34[_0x2860('0x72')])){_0x30e857[_0x2860('0x74')]+='\x20'+_0x298a34[_0x2860('0x72')];}}})['finally'](function(){return db[_0x2860('0x75')]['create'](_0x30e857);});}})['then'](function(){return _0x55f635['status'](0xcc)[_0x2860('0x1a')]();})[_0x2860('0x51')](handleError(_0x55f635,null));};exports[_0x2860('0x76')]=function(_0x40f3f8,_0x212d0e,_0x1a5d7b){var _0x4ac5fe=[];return db[_0x2860('0x6f')]['describe']()[_0x2860('0x4d')](function(_0x545704){_0x4ac5fe=_[_0x2860('0x53')](_0x545704);return _0x40f3f8[_0x2860('0x66')][_0x2860('0x77')]({'where':{'type':_0x2860('0x78'),'dialActive':!![],'dialMethod':_0x2860('0x79')},'attributes':['id',_0x2860('0x7a')],'raw':!![]});})[_0x2860('0x4d')](function(_0x40e831){if(_0x40e831&&_0x40e831[_0x2860('0x43')]){return db[_0x2860('0x7b')][_0x2860('0x7c')](function(_0xe9694c){var _0x4ba198={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x2860('0x26')](_0x40e831,'id')},'$or':[{'UserId':null},{'UserId':_0x40f3f8[_0x2860('0x66')]['id']}]};var _0x3272df=[];if(_0x40f3f8[_0x2860('0x58')][_0x2860('0x7d')]&&_0x40f3f8[_0x2860('0x58')][_0x2860('0x7d')]===_0x2860('0x7e')){if(!_['isEmpty'](_0x40f3f8[_0x2860('0x58')][_0x2860('0x7f')])){_0x4ba198['id']={'$in':_0x40f3f8[_0x2860('0x58')]['hopperIds']};}_0x3272df=[[_0x2860('0x80'),_0x2860('0x81')],[_0x2860('0x82'),_0x40e831[0x0][_0x2860('0x7a')]==='ASC'?_0x2860('0x83'):_0x2860('0x81')],db['sequelize']['literal'](_0x2860('0x84')),['id','DESC']];}else{if(!_[_0x2860('0x85')](_0x40f3f8[_0x2860('0x58')][_0x2860('0x7f')])){_0x4ba198['id']={'$notIn':_0x40f3f8[_0x2860('0x58')][_0x2860('0x7f')]};}_0x3272df=[['priority',_0x2860('0x83')],['scheduledAt',_0x40e831[0x0]['dialOrderByScheduledAt']],db[_0x2860('0x7b')][_0x2860('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x2860('0x81')]];}return db[_0x2860('0x4e')]['findOne']({'attributes':['id',_0x2860('0x87')],'where':_0x4ba198,'order':_0x3272df,'transaction':_0xe9694c,'lock':_0xe9694c[_0x2860('0x88')][_0x2860('0x89')],'include':[{'model':db[_0x2860('0x6f')],'as':_0x2860('0x8a'),'attributes':_0x4ac5fe,'include':[{'model':db[_0x2860('0x8b')],'as':'Company','attributes':['id',_0x2860('0x2c')]}]},{'model':db[_0x2860('0x8c')],'as':_0x2860('0x8d'),'attributes':['id',_0x2860('0x2c')]},{'model':db[_0x2860('0x5a')],'as':_0x2860('0x8e'),'attributes':['id',_0x2860('0x2c'),_0x2860('0x8f')]}]})[_0x2860('0x4d')](function(_0x1590b9){if(_0x1590b9){return _0x1590b9[_0x2860('0x22')]({'UserId':_0x40f3f8[_0x2860('0x66')]['id']},{'transaction':_0xe9694c});}});});}})[_0x2860('0x4d')](handleEntityNotFound(_0x212d0e,null))[_0x2860('0x4d')](respondWithResult(_0x212d0e,null))['catch'](handleError(_0x212d0e,null));};exports['getOpenContacts']=function(_0x49b990,_0x4e734d,_0x1aa021){return _0x49b990[_0x2860('0x66')][_0x2860('0x77')]({'where':{'type':_0x2860('0x78'),'dialActive':!![],'dialMethod':_0x2860('0x79')},'attributes':['id'],'raw':!![]})['then'](function(_0x53428c){if(_0x53428c&&_0x53428c[_0x2860('0x43')]){return db[_0x2860('0x4e')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2860('0x69')](_0x2860('0x6a'))},'VoiceQueueId':{'$in':_['map'](_0x53428c,'id')},'$or':[{'UserId':null},{'UserId':_0x49b990[_0x2860('0x66')]['id']}]}});}return 0x0;})[_0x2860('0x4d')](function(_0x3e7b4b){if(!_['isNil'](_0x3e7b4b)&&_[_0x2860('0x90')](_0x3e7b4b)){return _0x4e734d[_0x2860('0x19')](0xc8)['json']({'contacts':_0x3e7b4b});}else{logger['error'](_0x2860('0x91'),_0x2860('0x92'),0x194,_0x2860('0x93'));_0x4e734d[_0x2860('0x18')](0x194);}})[_0x2860('0x51')](handleError(_0x4e734d,null));};exports['getTimezones']=function(_0x3d065d,_0x34534e,_0x3a3d7d){var _0x3bd00a=shared['timezones'];var _0x4469c6=[];_['map'](_0x3bd00a,function(_0xfc83d2){_0x4469c6['push']({'id':_0xfc83d2[_0x2860('0x2c')],'name':_0xfc83d2[_0x2860('0x2c')],'utcOffset':_0xfc83d2['utcOffset']});});return _0x34534e[_0x2860('0x19')](0xc8)[_0x2860('0x1b')]({'tz':_0x4469c6});};exports[_0x2860('0x94')]=function(_0x4de6c6,_0x138ad8,_0x430eb1){var _0x11d3ec=shared[_0x2860('0x95')];var _0x250b82={};if(!_['isNil'](_0x11d3ec[_0x4de6c6['body']['id']]))_0x250b82=_0x11d3ec[_0x4de6c6[_0x2860('0x58')]['id']];return _0x138ad8['status'](0xc8)[_0x2860('0x1b')](_0x250b82);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d927388..524f056 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 _0xf331=['cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','request-promise','path','../../config/environment','exports','CmHopper'];(function(_0x3811d4,_0x2abdfb){var _0x3f1fae=function(_0x5b8908){while(--_0x5b8908){_0x3811d4['push'](_0x3811d4['shift']());}};_0x3f1fae(++_0x2abdfb);}(_0xf331,0x122));var _0x1f33=function(_0x5d9a47,_0x30f5aa){_0x5d9a47=_0x5d9a47-0x0;var _0x712351=_0xf331[_0x5d9a47];return _0x712351;};'use strict';var _=require(_0x1f33('0x0'));var util=require(_0x1f33('0x1'));var logger=require('../../config/logger')(_0x1f33('0x2'));var moment=require(_0x1f33('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f33('0x4'));var fs=require('fs');var path=require(_0x1f33('0x5'));var rimraf=require('rimraf');var config=require(_0x1f33('0x6'));var attributes=require('./cmHopper.attributes');module[_0x1f33('0x7')]=function(_0x237382,_0x1089aa){return _0x237382['define'](_0x1f33('0x8'),attributes,{'tableName':_0x1f33('0x9'),'paranoid':![],'indexes':[{'name':_0x1f33('0xa'),'fields':['scheduledat']},{'name':_0x1f33('0xb'),'fields':[_0x1f33('0xb')]},{'name':_0x1f33('0xc'),'fields':[_0x1f33('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88f3=['cm_hopper','scheduledat','phone','priority','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x5ee857,_0x15dcfd){var _0x1d0424=function(_0x3cd99c){while(--_0x3cd99c){_0x5ee857['push'](_0x5ee857['shift']());}};_0x1d0424(++_0x15dcfd);}(_0x88f3,0x12f));var _0x388f=function(_0x274bdf,_0x97fb8){_0x274bdf=_0x274bdf-0x0;var _0x559282=_0x88f3[_0x274bdf];return _0x559282;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x388f('0x0'));var moment=require('moment');var BPromise=require(_0x388f('0x1'));var rp=require(_0x388f('0x2'));var fs=require('fs');var path=require(_0x388f('0x3'));var rimraf=require(_0x388f('0x4'));var config=require(_0x388f('0x5'));var attributes=require(_0x388f('0x6'));module[_0x388f('0x7')]=function(_0x4a13fb,_0x128e41){return _0x4a13fb[_0x388f('0x8')]('CmHopper',attributes,{'tableName':_0x388f('0x9'),'paranoid':![],'indexes':[{'name':_0x388f('0xa'),'fields':['scheduledat']},{'name':_0x388f('0xb'),'fields':[_0x388f('0xb')]},{'name':'priority','fields':[_0x388f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e1383f7..2816319 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 _0xeb0d=['`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','GetContactRecallMe','UserId','LOCK','UPDATE','GetCmHopperPreview','GetContactByPhone','log','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopper','findAll','options','raw','attributes','limit','include','map','model','stringify','find','where','ShowCmHopper','CreateCmHopper','CmHopper','create','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','User','Agent','name','voicePause','length','includes','push','update','all','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x4c7481,_0x2d86d5){_0x4c7481=_0x4c7481-0x0;var _0x46d188=_0xeb0d[_0x4c7481];return _0x46d188;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdeb0('0x1'));var fs=require('fs');var Redis=require(_0xdeb0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeb0('0x3'));var logger=require(_0xdeb0('0x4'))(_0xdeb0('0x5'));var config=require(_0xdeb0('0x6'));var jayson=require(_0xdeb0('0x7'));var client=jayson[_0xdeb0('0x8')][_0xdeb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ebaa,_0x55ffce,_0x28a1a4){return new BPromise(function(_0x16b36b,_0x541d8b){return client[_0xdeb0('0xa')](_0x27ebaa,_0x28a1a4)[_0xdeb0('0xb')](function(_0x3336a6){logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,_0xdeb0('0xe'));logger[_0xdeb0('0xf')](_0xdeb0('0x10'),_0x55ffce,'request\x20sent',JSON['stringify'](_0x3336a6));if(_0x3336a6[_0xdeb0('0x11')]){if(_0x3336a6['error'][_0xdeb0('0x12')]===0x1f4){logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);return _0x541d8b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6['error'][_0xdeb0('0x13')]);return _0x16b36b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}else{logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,'request\x20sent');_0x16b36b(_0x3336a6[_0xdeb0('0x14')]['message']);}})[_0xdeb0('0x15')](function(_0x473fb9){logger[_0xdeb0('0x11')]('CmHopper,\x20%s,\x20%s',_0x55ffce,_0x473fb9);_0x541d8b(_0x473fb9);});});}exports[_0xdeb0('0x16')]=function(_0x51e7ee){var _0x7f30d2=this;return new Promise(function(_0x2b1efa,_0x7ad25c){return db['CmHopper'][_0xdeb0('0x17')]({'raw':_0x51e7ee['options']?_0x51e7ee[_0xdeb0('0x18')][_0xdeb0('0x19')]===undefined?!![]:![]:!![],'where':_0x51e7ee[_0xdeb0('0x18')]?_0x51e7ee[_0xdeb0('0x18')]['where']||null:null,'attributes':_0x51e7ee[_0xdeb0('0x18')]?_0x51e7ee[_0xdeb0('0x18')][_0xdeb0('0x1a')]||null:null,'limit':_0x51e7ee[_0xdeb0('0x18')]?_0x51e7ee[_0xdeb0('0x18')][_0xdeb0('0x1b')]||null:null,'include':_0x51e7ee[_0xdeb0('0x18')]?_0x51e7ee[_0xdeb0('0x18')][_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x51e7ee[_0xdeb0('0x18')]['include'],function(_0x566f1f){return{'model':db[_0x566f1f['model']],'as':_0x566f1f['as'],'attributes':_0x566f1f[_0xdeb0('0x1a')],'include':_0x566f1f['include']?_['map'](_0x566f1f['include'],function(_0x38bd4d){return{'model':db[_0x38bd4d[_0xdeb0('0x1e')]],'as':_0x38bd4d['as'],'attributes':_0x38bd4d[_0xdeb0('0x1a')],'include':_0x38bd4d[_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x38bd4d[_0xdeb0('0x1c')],function(_0x19456b){return{'model':db[_0x19456b[_0xdeb0('0x1e')]],'as':_0x19456b['as'],'attributes':_0x19456b[_0xdeb0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdeb0('0xb')](function(_0x191824){logger[_0xdeb0('0xc')](_0xdeb0('0x16'),_0x51e7ee);logger[_0xdeb0('0xf')](_0xdeb0('0x16'),_0x51e7ee,JSON[_0xdeb0('0x1f')](_0x191824));_0x2b1efa(_0x191824);})[_0xdeb0('0x15')](function(_0x59cc01){logger[_0xdeb0('0x11')](_0xdeb0('0x16'),_0x59cc01['message'],_0x51e7ee);_0x7ad25c(_0x7f30d2[_0xdeb0('0x11')](0x1f4,_0x59cc01['message']));});});};exports['ShowCmHopper']=function(_0x1d338){var _0x2085c2=this;return new Promise(function(_0x32ec24,_0x2572d0){return db['CmHopper'][_0xdeb0('0x20')]({'raw':_0x1d338[_0xdeb0('0x18')]?_0x1d338[_0xdeb0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1d338[_0xdeb0('0x18')]?_0x1d338['options'][_0xdeb0('0x21')]||null:null,'attributes':_0x1d338[_0xdeb0('0x18')]?_0x1d338[_0xdeb0('0x18')]['attributes']||null:null,'include':_0x1d338[_0xdeb0('0x18')]?_0x1d338['options'][_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x1d338[_0xdeb0('0x18')][_0xdeb0('0x1c')],function(_0x3983b2){return{'model':db[_0x3983b2[_0xdeb0('0x1e')]],'as':_0x3983b2['as'],'attributes':_0x3983b2['attributes'],'include':_0x3983b2[_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x3983b2[_0xdeb0('0x1c')],function(_0x4c0411){return{'model':db[_0x4c0411[_0xdeb0('0x1e')]],'as':_0x4c0411['as'],'attributes':_0x4c0411[_0xdeb0('0x1a')],'include':_0x4c0411['include']?_[_0xdeb0('0x1d')](_0x4c0411[_0xdeb0('0x1c')],function(_0x3db036){return{'model':db[_0x3db036[_0xdeb0('0x1e')]],'as':_0x3db036['as'],'attributes':_0x3db036[_0xdeb0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdeb0('0xb')](function(_0x57297c){logger[_0xdeb0('0xc')](_0xdeb0('0x22'),_0x1d338);logger[_0xdeb0('0xf')](_0xdeb0('0x22'),_0x1d338,JSON['stringify'](_0x57297c));_0x32ec24(_0x57297c);})[_0xdeb0('0x15')](function(_0x4be7f0){logger[_0xdeb0('0x11')](_0xdeb0('0x22'),_0x4be7f0[_0xdeb0('0x13')],_0x1d338);_0x2572d0(_0x2085c2[_0xdeb0('0x11')](0x1f4,_0x4be7f0['message']));});});};exports[_0xdeb0('0x23')]=function(_0x9ac6a3){var _0x1ddbee=this;return new Promise(function(_0x443c04,_0x435048){return db[_0xdeb0('0x24')][_0xdeb0('0x25')](_0x9ac6a3[_0xdeb0('0x26')],{'raw':_0x9ac6a3[_0xdeb0('0x18')]?_0x9ac6a3[_0xdeb0('0x18')][_0xdeb0('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3123cc){logger[_0xdeb0('0xc')]('CreateCmHopper',_0x9ac6a3);logger[_0xdeb0('0xf')](_0xdeb0('0x23'),_0x9ac6a3,JSON[_0xdeb0('0x1f')](_0x3123cc));_0x443c04(_0x3123cc);})[_0xdeb0('0x15')](function(_0x4a824c){logger[_0xdeb0('0x11')](_0xdeb0('0x23'),_0x4a824c['message'],_0x9ac6a3);_0x435048(_0x1ddbee[_0xdeb0('0x11')](0x1f4,_0x4a824c['message']));});});};exports[_0xdeb0('0x27')]=function(_0x1b7acc){var _0x47e246=this;return new Promise(function(_0x104b70,_0x87cd00){return db['CmHopper']['update'](_0x1b7acc[_0xdeb0('0x26')],{'raw':_0x1b7acc[_0xdeb0('0x18')]?_0x1b7acc[_0xdeb0('0x18')][_0xdeb0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7acc[_0xdeb0('0x18')]?_0x1b7acc[_0xdeb0('0x18')]['where']||null:null,'attributes':_0x1b7acc[_0xdeb0('0x18')]?_0x1b7acc['options'][_0xdeb0('0x1a')]||null:null,'limit':_0x1b7acc[_0xdeb0('0x18')]?_0x1b7acc[_0xdeb0('0x18')][_0xdeb0('0x1b')]||null:null})['then'](function(_0x2d45b9){logger[_0xdeb0('0xc')](_0xdeb0('0x27'),_0x1b7acc);logger[_0xdeb0('0xf')](_0xdeb0('0x27'),_0x1b7acc,JSON[_0xdeb0('0x1f')](_0x2d45b9));_0x104b70(_0x2d45b9);})[_0xdeb0('0x15')](function(_0x1f1ff7){logger[_0xdeb0('0x11')]('UpdateCmHopper',_0x1f1ff7[_0xdeb0('0x13')],_0x1b7acc);_0x87cd00(_0x47e246[_0xdeb0('0x11')](0x1f4,_0x1f1ff7[_0xdeb0('0x13')]));});});};exports[_0xdeb0('0x28')]=function(_0x3a35bf){var _0xda0062=this;return new Promise(function(_0x5894e8,_0x4a440){return db[_0xdeb0('0x24')][_0xdeb0('0x29')]({'where':_0x3a35bf['options']?_0x3a35bf[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null})[_0xdeb0('0xb')](function(_0x8ffedd){logger[_0xdeb0('0xc')]('DestroyCmHopper',_0x3a35bf);logger[_0xdeb0('0xf')](_0xdeb0('0x28'),_0x3a35bf,JSON[_0xdeb0('0x1f')](_0x8ffedd));_0x5894e8(_0x8ffedd);})[_0xdeb0('0x15')](function(_0x2e7fc9){logger['error']('DestroyCmHopper',_0x2e7fc9[_0xdeb0('0x13')],_0x3a35bf);_0x4a440(_0xda0062[_0xdeb0('0x11')](0x1f4,_0x2e7fc9['message']));});});};exports[_0xdeb0('0x2a')]=function(_0x5af87f){var _0xb9ba14=this;return new Promise(function(_0x106119,_0xcdfb83){return db[_0xdeb0('0x2b')][_0xdeb0('0x2c')]()['then'](function(_0x2de391){return db[_0xdeb0('0x2d')][_0xdeb0('0x2e')](function(_0x2d0ea9){return db[_0xdeb0('0x24')]['findAll']({'where':_0x5af87f['options']?_0x5af87f[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null,'attributes':_0x5af87f[_0xdeb0('0x18')]?_0x5af87f[_0xdeb0('0x18')][_0xdeb0('0x1a')]||null:null,'limit':_0x5af87f[_0xdeb0('0x18')]?_0x5af87f[_0xdeb0('0x18')][_0xdeb0('0x1b')]||null:null,'order':_0x5af87f[_0xdeb0('0x18')]?_0x5af87f['options'][_0xdeb0('0x2f')]||null:null,'transaction':_0x2d0ea9,'lock':_0x2d0ea9['LOCK']['UPDATE'],'include':[{'model':db[_0xdeb0('0x2b')],'as':'Contact','attributes':_['keys'](_0x2de391)},{'model':db[_0xdeb0('0x30')],'as':_0xdeb0('0x31'),'attributes':['id',_0xdeb0('0x32'),_0xdeb0('0x33')]}]})[_0xdeb0('0xb')](function(_0x4cc0ea){var _0x141550=[];var _0x530fb2=[];for(var _0x549422=0x0;_0x549422<_0x4cc0ea[_0xdeb0('0x34')];_0x549422+=0x1){if(!_0x530fb2[_0xdeb0('0x35')](_0x4cc0ea[_0x549422]['UserId'])){_0x530fb2['push'](_0x4cc0ea[_0x549422]['UserId']);_0x141550[_0xdeb0('0x36')](_0x4cc0ea[_0x549422][_0xdeb0('0x37')](_0x5af87f[_0xdeb0('0x26')],{'transaction':_0x2d0ea9}));}}return BPromise[_0xdeb0('0x38')](_0x141550);});})['then'](function(_0x4e04ed){logger[_0xdeb0('0xc')](_0xdeb0('0x2a'),_0x5af87f);logger[_0xdeb0('0xf')](_0xdeb0('0x2a'),_0x5af87f,JSON[_0xdeb0('0x1f')](_0x4e04ed));_0x106119(_0x4e04ed);})['catch'](function(_0x379f97){logger['error'](_0xdeb0('0x2a'),_0x379f97[_0xdeb0('0x13')],_0x5af87f);_0xcdfb83(_0xb9ba14[_0xdeb0('0x11')](0x1f4,_0x379f97[_0xdeb0('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x27f610){var _0x297352=this;return new Promise(function(_0x366a92,_0x5e9476){return db['sequelize'][_0xdeb0('0x2e')](function(_0x45d2fb){return db[_0xdeb0('0x39')][_0xdeb0('0x25')](_0x27f610[_0xdeb0('0x26')],{'raw':_0x27f610['options']?_0x27f610['options'][_0xdeb0('0x19')]===undefined?!![]:![]:!![],'transaction':_0x45d2fb})['then'](function(){return db[_0xdeb0('0x24')][_0xdeb0('0x29')]({'where':_0x27f610[_0xdeb0('0x18')]?_0x27f610[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null,'transaction':_0x45d2fb});});})[_0xdeb0('0xb')](function(_0x31044a){logger[_0xdeb0('0xc')](_0xdeb0('0x3a'),_0x27f610);logger[_0xdeb0('0xf')](_0xdeb0('0x3a'),_0x27f610,JSON[_0xdeb0('0x1f')](_0x31044a));_0x366a92(_0x31044a);})[_0xdeb0('0x15')](function(_0x5d2c09){logger['error'](_0xdeb0('0x3a'),_0x5d2c09[_0xdeb0('0x13')],_0x27f610);_0x5e9476(_0x297352['error'](0x1f4,_0x5d2c09['message']));});});};exports[_0xdeb0('0x3b')]=function(_0x3920df){var _0xaacfa9=this;return new Promise(function(_0x1acd83,_0x3a7530){return db[_0xdeb0('0x24')][_0xdeb0('0x17')]({'raw':_0x3920df[_0xdeb0('0x18')]?_0x3920df[_0xdeb0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3920df[_0xdeb0('0x18')]?_0x3920df[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null,'attributes':[[db[_0xdeb0('0x2d')]['fn'](_0xdeb0('0x3c'),db[_0xdeb0('0x2d')]['fn']('IF',db[_0xdeb0('0x2d')][_0xdeb0('0x3d')](_0xdeb0('0x3e')+util[_0xdeb0('0x3f')]('\x22%s\x22',moment()[_0xdeb0('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xdeb0('0x40')))),'contactsRescheduled']]})['then'](function(_0x321f3e){logger['info'](_0xdeb0('0x3b'),_0x3920df);logger[_0xdeb0('0xf')]('CountReScheduled',_0x3920df,JSON[_0xdeb0('0x1f')](_0x321f3e));_0x1acd83(_0x321f3e);})[_0xdeb0('0x15')](function(_0x389a99){logger[_0xdeb0('0x11')](_0xdeb0('0x3b'),_0x389a99[_0xdeb0('0x13')],_0x3920df);_0x3a7530(_0xaacfa9[_0xdeb0('0x11')](0x1f4,_0x389a99[_0xdeb0('0x13')]));});});};exports[_0xdeb0('0x41')]=function(_0x383c53){var _0x4853b9=this;return new Promise(function(_0x4cc359,_0x53d617){return db[_0xdeb0('0x2b')][_0xdeb0('0x2c')]()[_0xdeb0('0xb')](function(_0xafd946){return db[_0xdeb0('0x2d')][_0xdeb0('0x2e')](function(_0x1418e7){return db['CmHopper'][_0xdeb0('0x17')]({'where':_0x383c53[_0xdeb0('0x18')]?_0x383c53['options']['where']||null:null,'attributes':_0x383c53[_0xdeb0('0x18')]?_0x383c53[_0xdeb0('0x18')][_0xdeb0('0x1a')]||null:null,'limit':0x1,'order':_0x383c53[_0xdeb0('0x18')]?_0x383c53[_0xdeb0('0x18')][_0xdeb0('0x2f')]||null:null,'group':db['CmHopper'][_0xdeb0('0x42')],'transaction':_0x1418e7,'lock':_0x1418e7[_0xdeb0('0x43')][_0xdeb0('0x44')],'include':_0x383c53[_0xdeb0('0x18')]?_0x383c53[_0xdeb0('0x18')]['include']?_['map'](_0x383c53[_0xdeb0('0x18')]['include'],function(_0x470845){return{'model':db[_0x470845[_0xdeb0('0x1e')]],'as':_0x470845['as'],'attributes':_0x470845[_0xdeb0('0x1a')],'include':_0x470845[_0xdeb0('0x1c')]?_['map'](_0x470845[_0xdeb0('0x1c')],function(_0x5c7ba2){return{'model':db[_0x5c7ba2[_0xdeb0('0x1e')]],'as':_0x5c7ba2['as'],'attributes':_0x5c7ba2[_0xdeb0('0x1a')],'include':_0x5c7ba2['include']?_['map'](_0x5c7ba2['include'],function(_0x2a64d1){return{'model':db[_0x2a64d1[_0xdeb0('0x1e')]],'as':_0x2a64d1['as'],'attributes':_0x2a64d1['attributes']};}):[]};}):[]};}):[]:[]})[_0xdeb0('0xb')](function(_0x2e2e50){var _0x2a3b29=[];for(var _0x303638=0x0;_0x303638<_0x2e2e50['length'];_0x303638+=0x1){_0x2a3b29[_0xdeb0('0x36')](_0x2e2e50[_0x303638][_0xdeb0('0x37')](_0x383c53[_0xdeb0('0x26')],{'transaction':_0x1418e7}));}return BPromise[_0xdeb0('0x38')](_0x2a3b29);});})[_0xdeb0('0xb')](function(_0x203d89){logger['info'](_0xdeb0('0x41'),_0x383c53);logger['debug'](_0xdeb0('0x41'),_0x383c53,JSON['stringify'](_0x203d89));_0x4cc359(_0x203d89);})[_0xdeb0('0x15')](function(_0x3ec9b4){logger[_0xdeb0('0x11')](_0xdeb0('0x41'),_0x3ec9b4[_0xdeb0('0x13')],_0x383c53);_0x53d617(_0x4853b9[_0xdeb0('0x11')](0x1f4,_0x3ec9b4[_0xdeb0('0x13')]));});});});};exports[_0xdeb0('0x45')]=function(_0x124bdc){var _0x566547=this;return new Promise(function(_0x2e19a0,_0x3957be){db[_0xdeb0('0x2b')][_0xdeb0('0x2c')]()['then'](function(_0x288e10){return db[_0xdeb0('0x24')][_0xdeb0('0x17')]({'raw':_0x124bdc[_0xdeb0('0x18')]?_0x124bdc[_0xdeb0('0x18')][_0xdeb0('0x19')]===undefined?!![]:![]:!![],'where':_0x124bdc[_0xdeb0('0x18')]?_0x124bdc[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null,'attributes':_0x124bdc[_0xdeb0('0x18')]?_0x124bdc[_0xdeb0('0x18')]['attributes']||null:null,'limit':_0x124bdc[_0xdeb0('0x18')]?_0x124bdc[_0xdeb0('0x18')][_0xdeb0('0x1b')]||null:null,'include':_0x124bdc['options']?_0x124bdc['options'][_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x124bdc['options']['include'],function(_0x7f5d0c){return{'model':db[_0x7f5d0c[_0xdeb0('0x1e')]],'as':_0x7f5d0c['as'],'attributes':_0x7f5d0c['as']==='Contact'?_['keys'](_0x288e10):_0x7f5d0c[_0xdeb0('0x1a')],'include':_0x7f5d0c[_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x7f5d0c['include'],function(_0x5b2188){return{'model':db[_0x5b2188[_0xdeb0('0x1e')]],'as':_0x5b2188['as'],'attributes':_0x5b2188['attributes'],'include':_0x5b2188[_0xdeb0('0x1c')]?_['map'](_0x5b2188[_0xdeb0('0x1c')],function(_0x41949c){return{'model':db[_0x41949c[_0xdeb0('0x1e')]],'as':_0x41949c['as'],'attributes':_0x41949c[_0xdeb0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdeb0('0xb')](function(_0x255cf1){logger[_0xdeb0('0xc')](_0xdeb0('0x16'),_0x124bdc);logger[_0xdeb0('0xf')]('GetCmHopper',_0x124bdc,JSON['stringify'](_0x255cf1));_0x2e19a0(_0x255cf1);})[_0xdeb0('0x15')](function(_0x3a6fe9){logger['error']('GetCmHopper',_0x3a6fe9['message'],_0x124bdc);_0x3957be(_0x566547[_0xdeb0('0x11')](0x1f4,_0x3a6fe9[_0xdeb0('0x13')]));});});});};exports[_0xdeb0('0x46')]=function(_0x234de1){console[_0xdeb0('0x47')]('req\x20value',_0x234de1);}; \ No newline at end of file +var _0x978b=['\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','Contact','log','req\x20value','phone\x20value','findOne','DESC','getcontactbyohone','getContactByPhone','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','model','map','debug','find','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','CmContact','sequelize','transaction','findAll','order','LOCK','UPDATE','keys','Agent','name','voicePause','length','includes','push','UserId','update','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22'];(function(_0x58c5e8,_0x4b6c59){var _0x5bae00=function(_0x505be3){while(--_0x505be3){_0x58c5e8['push'](_0x58c5e8['shift']());}};_0x5bae00(++_0x4b6c59);}(_0x978b,0x1e0));var _0xb978=function(_0xc70388,_0x2e0675){_0xc70388=_0xc70388-0x0;var _0x2956fe=_0x978b[_0xc70388];return _0x2956fe;};'use strict';var _=require('lodash');var util=require(_0xb978('0x0'));var moment=require(_0xb978('0x1'));var BPromise=require('bluebird');var rs=require(_0xb978('0x2'));var fs=require('fs');var Redis=require(_0xb978('0x3'));var db=require(_0xb978('0x4'))['db'];var utils=require(_0xb978('0x5'));var logger=require(_0xb978('0x6'))(_0xb978('0x7'));var config=require('../../config/environment');var jayson=require(_0xb978('0x8'));var client=jayson[_0xb978('0x9')][_0xb978('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24d406,_0x545103,_0x21b820){return new BPromise(function(_0x31546b,_0x36b273){return client[_0xb978('0xb')](_0x24d406,_0x21b820)[_0xb978('0xc')](function(_0x2da5fb){logger[_0xb978('0xd')]('CmHopper,\x20%s,\x20%s',_0x545103,_0xb978('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x545103,_0xb978('0xe'),JSON[_0xb978('0xf')](_0x2da5fb));if(_0x2da5fb[_0xb978('0x10')]){if(_0x2da5fb[_0xb978('0x10')][_0xb978('0x11')]===0x1f4){logger[_0xb978('0x10')](_0xb978('0x12'),_0x545103,_0x2da5fb[_0xb978('0x10')][_0xb978('0x13')]);return _0x36b273(_0x2da5fb['error'][_0xb978('0x13')]);}logger[_0xb978('0x10')](_0xb978('0x12'),_0x545103,_0x2da5fb['error'][_0xb978('0x13')]);return _0x31546b(_0x2da5fb[_0xb978('0x10')][_0xb978('0x13')]);}else{logger[_0xb978('0xd')]('CmHopper,\x20%s,\x20%s',_0x545103,_0xb978('0xe'));_0x31546b(_0x2da5fb[_0xb978('0x14')][_0xb978('0x13')]);}})[_0xb978('0x15')](function(_0x1c95b1){logger[_0xb978('0x10')](_0xb978('0x12'),_0x545103,_0x1c95b1);_0x36b273(_0x1c95b1);});});}exports[_0xb978('0x16')]=function(_0x187986){var _0xb3e8c0=this;return new Promise(function(_0x4ca3d8,_0x5683b2){return db[_0xb978('0x17')]['findAll']({'raw':_0x187986[_0xb978('0x18')]?_0x187986[_0xb978('0x18')][_0xb978('0x19')]===undefined?!![]:![]:!![],'where':_0x187986['options']?_0x187986['options'][_0xb978('0x1a')]||null:null,'attributes':_0x187986[_0xb978('0x18')]?_0x187986[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'limit':_0x187986['options']?_0x187986[_0xb978('0x18')][_0xb978('0x1c')]||null:null,'include':_0x187986[_0xb978('0x18')]?_0x187986[_0xb978('0x18')][_0xb978('0x1d')]?_['map'](_0x187986['options'][_0xb978('0x1d')],function(_0x20615a){return{'model':db[_0x20615a[_0xb978('0x1e')]],'as':_0x20615a['as'],'attributes':_0x20615a['attributes'],'include':_0x20615a[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x20615a[_0xb978('0x1d')],function(_0x191f0a){return{'model':db[_0x191f0a['model']],'as':_0x191f0a['as'],'attributes':_0x191f0a[_0xb978('0x1b')],'include':_0x191f0a[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x191f0a[_0xb978('0x1d')],function(_0x1e78a1){return{'model':db[_0x1e78a1['model']],'as':_0x1e78a1['as'],'attributes':_0x1e78a1[_0xb978('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb978('0xc')](function(_0x5c5c16){logger[_0xb978('0xd')](_0xb978('0x16'),_0x187986);logger[_0xb978('0x20')]('GetCmHopper',_0x187986,JSON[_0xb978('0xf')](_0x5c5c16));_0x4ca3d8(_0x5c5c16);})[_0xb978('0x15')](function(_0x25f228){logger['error'](_0xb978('0x16'),_0x25f228[_0xb978('0x13')],_0x187986);_0x5683b2(_0xb3e8c0[_0xb978('0x10')](0x1f4,_0x25f228['message']));});});};exports['ShowCmHopper']=function(_0x590619){var _0x35ea17=this;return new Promise(function(_0x5e5c26,_0x84bbdb){return db[_0xb978('0x17')][_0xb978('0x21')]({'raw':_0x590619[_0xb978('0x18')]?_0x590619[_0xb978('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x590619[_0xb978('0x18')]?_0x590619[_0xb978('0x18')]['where']||null:null,'attributes':_0x590619['options']?_0x590619[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'include':_0x590619['options']?_0x590619[_0xb978('0x18')][_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x590619['options'][_0xb978('0x1d')],function(_0x2a5b0b){return{'model':db[_0x2a5b0b[_0xb978('0x1e')]],'as':_0x2a5b0b['as'],'attributes':_0x2a5b0b['attributes'],'include':_0x2a5b0b['include']?_[_0xb978('0x1f')](_0x2a5b0b[_0xb978('0x1d')],function(_0x5ede16){return{'model':db[_0x5ede16[_0xb978('0x1e')]],'as':_0x5ede16['as'],'attributes':_0x5ede16[_0xb978('0x1b')],'include':_0x5ede16[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x5ede16[_0xb978('0x1d')],function(_0x16bedf){return{'model':db[_0x16bedf[_0xb978('0x1e')]],'as':_0x16bedf['as'],'attributes':_0x16bedf[_0xb978('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb978('0xc')](function(_0x571871){logger[_0xb978('0xd')]('ShowCmHopper',_0x590619);logger[_0xb978('0x20')](_0xb978('0x22'),_0x590619,JSON[_0xb978('0xf')](_0x571871));_0x5e5c26(_0x571871);})[_0xb978('0x15')](function(_0x4370cd){logger[_0xb978('0x10')]('ShowCmHopper',_0x4370cd[_0xb978('0x13')],_0x590619);_0x84bbdb(_0x35ea17[_0xb978('0x10')](0x1f4,_0x4370cd[_0xb978('0x13')]));});});};exports[_0xb978('0x23')]=function(_0x5134e2){var _0x4bfc58=this;return new Promise(function(_0x249a4c,_0x1a9edf){return db[_0xb978('0x17')][_0xb978('0x24')](_0x5134e2[_0xb978('0x25')],{'raw':_0x5134e2['options']?_0x5134e2['options']['raw']===undefined?!![]:![]:!![]})[_0xb978('0xc')](function(_0x5e60f9){logger[_0xb978('0xd')](_0xb978('0x23'),_0x5134e2);logger[_0xb978('0x20')](_0xb978('0x23'),_0x5134e2,JSON[_0xb978('0xf')](_0x5e60f9));_0x249a4c(_0x5e60f9);})[_0xb978('0x15')](function(_0x54552e){logger[_0xb978('0x10')](_0xb978('0x23'),_0x54552e['message'],_0x5134e2);_0x1a9edf(_0x4bfc58[_0xb978('0x10')](0x1f4,_0x54552e[_0xb978('0x13')]));});});};exports[_0xb978('0x26')]=function(_0x51ddea){var _0xaa0b98=this;return new Promise(function(_0x49d6df,_0x4db1f9){return db[_0xb978('0x17')]['update'](_0x51ddea[_0xb978('0x25')],{'raw':_0x51ddea['options']?_0x51ddea[_0xb978('0x18')][_0xb978('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51ddea['options']?_0x51ddea['options']['where']||null:null,'attributes':_0x51ddea[_0xb978('0x18')]?_0x51ddea[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'limit':_0x51ddea[_0xb978('0x18')]?_0x51ddea[_0xb978('0x18')][_0xb978('0x1c')]||null:null})[_0xb978('0xc')](function(_0x2d9267){logger[_0xb978('0xd')](_0xb978('0x26'),_0x51ddea);logger[_0xb978('0x20')](_0xb978('0x26'),_0x51ddea,JSON[_0xb978('0xf')](_0x2d9267));_0x49d6df(_0x2d9267);})[_0xb978('0x15')](function(_0x23e13d){logger[_0xb978('0x10')](_0xb978('0x26'),_0x23e13d[_0xb978('0x13')],_0x51ddea);_0x4db1f9(_0xaa0b98['error'](0x1f4,_0x23e13d[_0xb978('0x13')]));});});};exports[_0xb978('0x27')]=function(_0x2932a9){var _0x302278=this;return new Promise(function(_0xdd5df6,_0x44206e){return db[_0xb978('0x17')]['destroy']({'where':_0x2932a9[_0xb978('0x18')]?_0x2932a9[_0xb978('0x18')][_0xb978('0x1a')]||null:null})[_0xb978('0xc')](function(_0x4e128f){logger[_0xb978('0xd')](_0xb978('0x27'),_0x2932a9);logger['debug'](_0xb978('0x27'),_0x2932a9,JSON[_0xb978('0xf')](_0x4e128f));_0xdd5df6(_0x4e128f);})[_0xb978('0x15')](function(_0x5a396b){logger[_0xb978('0x10')]('DestroyCmHopper',_0x5a396b[_0xb978('0x13')],_0x2932a9);_0x44206e(_0x302278[_0xb978('0x10')](0x1f4,_0x5a396b[_0xb978('0x13')]));});});};exports['GetContactDialer']=function(_0x53bbea){var _0x490141=this;return new Promise(function(_0x56a2a1,_0x35c68d){return db[_0xb978('0x28')]['describe']()[_0xb978('0xc')](function(_0x547d50){return db[_0xb978('0x29')][_0xb978('0x2a')](function(_0x503ad2){return db[_0xb978('0x17')][_0xb978('0x2b')]({'where':_0x53bbea[_0xb978('0x18')]?_0x53bbea[_0xb978('0x18')][_0xb978('0x1a')]||null:null,'attributes':_0x53bbea[_0xb978('0x18')]?_0x53bbea[_0xb978('0x18')]['attributes']||null:null,'limit':_0x53bbea[_0xb978('0x18')]?_0x53bbea[_0xb978('0x18')][_0xb978('0x1c')]||null:null,'order':_0x53bbea[_0xb978('0x18')]?_0x53bbea['options'][_0xb978('0x2c')]||null:null,'transaction':_0x503ad2,'lock':_0x503ad2[_0xb978('0x2d')][_0xb978('0x2e')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0xb978('0x2f')](_0x547d50)},{'model':db['User'],'as':_0xb978('0x30'),'attributes':['id',_0xb978('0x31'),_0xb978('0x32')]}]})[_0xb978('0xc')](function(_0x3be470){var _0x1f45be=[];var _0x10fff1=[];for(var _0x382dd1=0x0;_0x382dd1<_0x3be470[_0xb978('0x33')];_0x382dd1+=0x1){if(!_0x10fff1[_0xb978('0x34')](_0x3be470[_0x382dd1]['UserId'])){_0x10fff1[_0xb978('0x35')](_0x3be470[_0x382dd1][_0xb978('0x36')]);_0x1f45be['push'](_0x3be470[_0x382dd1][_0xb978('0x37')](_0x53bbea[_0xb978('0x25')],{'transaction':_0x503ad2}));}}return BPromise['all'](_0x1f45be);});})[_0xb978('0xc')](function(_0x20b177){logger[_0xb978('0xd')](_0xb978('0x38'),_0x53bbea);logger[_0xb978('0x20')](_0xb978('0x38'),_0x53bbea,JSON[_0xb978('0xf')](_0x20b177));_0x56a2a1(_0x20b177);})[_0xb978('0x15')](function(_0x5cadb9){logger['error'](_0xb978('0x38'),_0x5cadb9[_0xb978('0x13')],_0x53bbea);_0x35c68d(_0x490141['error'](0x1f4,_0x5cadb9[_0xb978('0x13')]));});});});};exports[_0xb978('0x39')]=function(_0x36fac0){var _0x1ec426=this;return new Promise(function(_0x31fc5b,_0x1e3b81){return db['sequelize'][_0xb978('0x2a')](function(_0x2bf097){return db[_0xb978('0x3a')][_0xb978('0x24')](_0x36fac0['body'],{'raw':_0x36fac0[_0xb978('0x18')]?_0x36fac0[_0xb978('0x18')][_0xb978('0x19')]===undefined?!![]:![]:!![],'transaction':_0x2bf097})['then'](function(){return db[_0xb978('0x17')][_0xb978('0x3b')]({'where':_0x36fac0[_0xb978('0x18')]?_0x36fac0[_0xb978('0x18')][_0xb978('0x1a')]||null:null,'transaction':_0x2bf097});});})[_0xb978('0xc')](function(_0x4dd4e0){logger[_0xb978('0xd')]('MoveContactManagedDialer',_0x36fac0);logger[_0xb978('0x20')]('MoveContactManagedDialer',_0x36fac0,JSON[_0xb978('0xf')](_0x4dd4e0));_0x31fc5b(_0x4dd4e0);})['catch'](function(_0x434d3d){logger['error'](_0xb978('0x39'),_0x434d3d['message'],_0x36fac0);_0x1e3b81(_0x1ec426[_0xb978('0x10')](0x1f4,_0x434d3d['message']));});});};exports[_0xb978('0x3c')]=function(_0x46de12){var _0x493c7e=this;return new Promise(function(_0x4e6062,_0x8868c3){return db[_0xb978('0x17')][_0xb978('0x2b')]({'raw':_0x46de12[_0xb978('0x18')]?_0x46de12[_0xb978('0x18')][_0xb978('0x19')]===undefined?!![]:![]:!![],'where':_0x46de12['options']?_0x46de12[_0xb978('0x18')][_0xb978('0x1a')]||null:null,'attributes':[[db[_0xb978('0x29')]['fn'](_0xb978('0x3d'),db['sequelize']['fn']('IF',db['sequelize'][_0xb978('0x3e')](_0xb978('0x3f')+util[_0xb978('0x40')](_0xb978('0x41'),moment()[_0xb978('0x40')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xb978('0x42')))),_0xb978('0x43')]]})[_0xb978('0xc')](function(_0x3891b4){logger[_0xb978('0xd')](_0xb978('0x3c'),_0x46de12);logger['debug'](_0xb978('0x3c'),_0x46de12,JSON[_0xb978('0xf')](_0x3891b4));_0x4e6062(_0x3891b4);})[_0xb978('0x15')](function(_0x3097fe){logger[_0xb978('0x10')](_0xb978('0x3c'),_0x3097fe[_0xb978('0x13')],_0x46de12);_0x8868c3(_0x493c7e['error'](0x1f4,_0x3097fe[_0xb978('0x13')]));});});};exports[_0xb978('0x44')]=function(_0x4810b6){var _0x2b5447=this;return new Promise(function(_0x124851,_0x5c9b45){return db['CmContact']['describe']()[_0xb978('0xc')](function(_0x62f290){return db[_0xb978('0x29')][_0xb978('0x2a')](function(_0x381711){return db[_0xb978('0x17')][_0xb978('0x2b')]({'where':_0x4810b6[_0xb978('0x18')]?_0x4810b6[_0xb978('0x18')][_0xb978('0x1a')]||null:null,'attributes':_0x4810b6[_0xb978('0x18')]?_0x4810b6[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'limit':0x1,'order':_0x4810b6[_0xb978('0x18')]?_0x4810b6[_0xb978('0x18')][_0xb978('0x2c')]||null:null,'group':db['CmHopper'][_0xb978('0x36')],'transaction':_0x381711,'lock':_0x381711[_0xb978('0x2d')][_0xb978('0x2e')],'include':_0x4810b6[_0xb978('0x18')]?_0x4810b6[_0xb978('0x18')][_0xb978('0x1d')]?_['map'](_0x4810b6['options'][_0xb978('0x1d')],function(_0x182a3d){return{'model':db[_0x182a3d[_0xb978('0x1e')]],'as':_0x182a3d['as'],'attributes':_0x182a3d[_0xb978('0x1b')],'include':_0x182a3d[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x182a3d[_0xb978('0x1d')],function(_0x2e8fa1){return{'model':db[_0x2e8fa1[_0xb978('0x1e')]],'as':_0x2e8fa1['as'],'attributes':_0x2e8fa1[_0xb978('0x1b')],'include':_0x2e8fa1[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x2e8fa1['include'],function(_0x43f7b5){return{'model':db[_0x43f7b5[_0xb978('0x1e')]],'as':_0x43f7b5['as'],'attributes':_0x43f7b5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb978('0xc')](function(_0x3907bb){var _0x4f3311=[];for(var _0x6231f9=0x0;_0x6231f9<_0x3907bb[_0xb978('0x33')];_0x6231f9+=0x1){_0x4f3311[_0xb978('0x35')](_0x3907bb[_0x6231f9][_0xb978('0x37')](_0x4810b6[_0xb978('0x25')],{'transaction':_0x381711}));}return BPromise[_0xb978('0x45')](_0x4f3311);});})['then'](function(_0x58c98c){logger[_0xb978('0xd')]('GetContactRecallMe',_0x4810b6);logger[_0xb978('0x20')](_0xb978('0x44'),_0x4810b6,JSON[_0xb978('0xf')](_0x58c98c));_0x124851(_0x58c98c);})[_0xb978('0x15')](function(_0x176491){logger[_0xb978('0x10')]('GetContactRecallMe',_0x176491['message'],_0x4810b6);_0x5c9b45(_0x2b5447['error'](0x1f4,_0x176491[_0xb978('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x388a06){var _0x89e7d3=this;return new Promise(function(_0x12b2be,_0x1a3dc6){db[_0xb978('0x28')]['describe']()['then'](function(_0x208c03){return db[_0xb978('0x17')][_0xb978('0x2b')]({'raw':_0x388a06[_0xb978('0x18')]?_0x388a06[_0xb978('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x388a06['options']?_0x388a06['options'][_0xb978('0x1a')]||null:null,'attributes':_0x388a06[_0xb978('0x18')]?_0x388a06[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'limit':_0x388a06[_0xb978('0x18')]?_0x388a06[_0xb978('0x18')][_0xb978('0x1c')]||null:null,'include':_0x388a06[_0xb978('0x18')]?_0x388a06[_0xb978('0x18')][_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x388a06[_0xb978('0x18')][_0xb978('0x1d')],function(_0x452d15){return{'model':db[_0x452d15[_0xb978('0x1e')]],'as':_0x452d15['as'],'attributes':_0x452d15['as']===_0xb978('0x46')?_[_0xb978('0x2f')](_0x208c03):_0x452d15['attributes'],'include':_0x452d15[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x452d15[_0xb978('0x1d')],function(_0xbd1399){return{'model':db[_0xbd1399['model']],'as':_0xbd1399['as'],'attributes':_0xbd1399[_0xb978('0x1b')],'include':_0xbd1399['include']?_['map'](_0xbd1399['include'],function(_0x2cc192){return{'model':db[_0x2cc192[_0xb978('0x1e')]],'as':_0x2cc192['as'],'attributes':_0x2cc192['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d5f69){logger['info'](_0xb978('0x16'),_0x388a06);logger['debug'](_0xb978('0x16'),_0x388a06,JSON[_0xb978('0xf')](_0x3d5f69));_0x12b2be(_0x3d5f69);})[_0xb978('0x15')](function(_0xbb04f6){logger['error']('GetCmHopper',_0xbb04f6[_0xb978('0x13')],_0x388a06);_0x1a3dc6(_0x89e7d3['error'](0x1f4,_0xbb04f6[_0xb978('0x13')]));});});});};exports['GetContactByPhone']=function(_0x5a4e79){console[_0xb978('0x47')](_0xb978('0x48'),_0x5a4e79);console['log'](_0xb978('0x49'),_0x5a4e79[_0xb978('0x18')][_0xb978('0x1a')]['phone']);return new Promise(function(_0x2f0fe8,_0x4718db){return db[_0xb978('0x28')][_0xb978('0x4a')]({'raw':!![],'where':{'phone':_0x5a4e79['options'][_0xb978('0x1a')]['phone']},'attributes':['id'],'order':[['id',_0xb978('0x4b')]]})['then'](function(_0x402004){console[_0xb978('0x47')](_0xb978('0x4c'),_0x402004);logger[_0xb978('0xd')](_0xb978('0x4d'),_0x5a4e79);logger[_0xb978('0x20')]('getContactByPhone',_0x5a4e79,JSON[_0xb978('0xf')](_0x402004));_0x2f0fe8(_0x402004);})[_0xb978('0x15')](function(_0x1e05b4){logger[_0xb978('0x10')]('getContactByPhone',_0x1e05b4[_0xb978('0x13')],_0x5a4e79);_0x4718db(_this[_0xb978('0x10')](0x1f4,_0x1e05b4[_0xb978('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index e084bb4..dece8cb 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 _0x7fbe=['/timezone','getTimezone','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','post','create','/preview','getPreview'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x20936e,_0x4d5283){_0x20936e=_0x20936e-0x0;var _0x50a212=_0x7fbe[_0x20936e];return _0x50a212;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['describe']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['get']('/timezones',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0x8')](_0xe7fb('0xf'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x11')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x11')](_0xe7fb('0x13'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x11')](_0xe7fb('0x15'),auth['isAuthenticated'](),controller[_0xe7fb('0x16')]);router[_0xe7fb('0x17')]('/:id',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x18')]);router['delete'](_0xe7fb('0xf'),auth['isAuthenticated'](),controller[_0xe7fb('0x19')]);module[_0xe7fb('0x1a')]=router; \ No newline at end of file +var _0x31f0=['describe','/opencontacts','isAuthenticated','/timezones','getTimezones','/:id','show','create','post','/preview','getPreview','getTimezone','put','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','/describe'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x31f0,0xb7));var _0x031f=function(_0x12a31b,_0x1aec79){_0x12a31b=_0x12a31b-0x0;var _0x143629=_0x31f0[_0x12a31b];return _0x143629;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0x7')](_0x031f('0xa'),auth[_0x031f('0xb')](),controller['getOpenContacts']);router[_0x031f('0x7')](_0x031f('0xc'),auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0x7')](_0x031f('0xe'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);router['post']('/',auth[_0x031f('0xb')](),controller[_0x031f('0x10')]);router[_0x031f('0x11')](_0x031f('0x12'),auth[_0x031f('0xb')](),controller[_0x031f('0x13')]);router[_0x031f('0x11')]('/timezone',auth[_0x031f('0xb')](),controller[_0x031f('0x14')]);router[_0x031f('0x15')](_0x031f('0xe'),auth[_0x031f('0xb')](),controller['update']);router['delete'](_0x031f('0xe'),auth[_0x031f('0xb')](),controller[_0x031f('0x16')]);module[_0x031f('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index d76dff2..52d4415 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 _0x0f3d=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','DATE','format'];(function(_0x5fd7ed,_0x4afe7e){var _0xb1326b=function(_0x1f4077){while(--_0x1f4077){_0x5fd7ed['push'](_0x5fd7ed['shift']());}};_0xb1326b(++_0x4afe7e);}(_0x0f3d,0x78));var _0xd0f3=function(_0x19e583,_0x3861a8){_0x19e583=_0x19e583-0x0;var _0x324103=_0x0f3d[_0x19e583];return _0x324103;};'use strict';var moment=require(_0xd0f3('0x0'));var Sequelize=require(_0xd0f3('0x1'));module[_0xd0f3('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xd0f3('0x4')],'defaultValue':moment()[_0xd0f3('0x5')](_0xd0f3('0x6'))},'countbusyretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ca7=['sequelize','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5b6905,_0x1341cb){var _0x210e53=function(_0x16f55a){while(--_0x16f55a){_0x5b6905['push'](_0x5b6905['shift']());}};_0x210e53(++_0x1341cb);}(_0x7ca7,0x1b1));var _0x77ca=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x7ca7[_0x20cb20];return _0x2fcf4b;};'use strict';var moment=require(_0x77ca('0x0'));var Sequelize=require(_0x77ca('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x77ca('0x2')]},'phone':{'type':Sequelize[_0x77ca('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x77ca('0x4')],'defaultValue':moment()[_0x77ca('0x5')](_0x77ca('0x6'))},'countbusyretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index aac307f..c381604 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 _0x9785=['moment','mustache','path','sox','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise'];(function(_0x530056,_0x22980e){var _0x12645c=function(_0x42a88a){while(--_0x42a88a){_0x530056['push'](_0x530056['shift']());}};_0x12645c(++_0x22980e);}(_0x9785,0xe3));var _0x5978=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x9785[_0x56482c];return _0x5aae7a;};'use strict';var pdf=require(_0x5978('0x0'));var emlformat=require(_0x5978('0x1'));var rimraf=require(_0x5978('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5978('0x3'));var moment=require(_0x5978('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5978('0x5'));var util=require('util');var path=require(_0x5978('0x6'));var sox=require(_0x5978('0x7'));var csv=require(_0x5978('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5978('0x9'));var squel=require(_0x5978('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5978('0x8'));var querystring=require(_0x5978('0xb'));var Papa=require(_0x5978('0xc'));var Redis=require(_0x5978('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5978('0xe'));var as=require(_0x5978('0xf'));var hardwareService=require(_0x5978('0x10'));var logger=require(_0x5978('0x11'))(_0x5978('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5978('0x13'))['db'];function respondWithStatusCode(_0x5e8244,_0x3e94d3){_0x3e94d3=_0x3e94d3||0xcc;return function(_0x56c13a){if(_0x56c13a){return _0x5e8244[_0x5978('0x14')](_0x3e94d3);}return _0x5e8244[_0x5978('0x15')](_0x3e94d3)[_0x5978('0x16')]();};}function respondWithResult(_0x489402,_0x5015a6){_0x5015a6=_0x5015a6||0xc8;return function(_0x54fc5e){if(_0x54fc5e){return _0x489402[_0x5978('0x15')](_0x5015a6)[_0x5978('0x17')](_0x54fc5e);}};}function respondWithFilteredResult(_0x3d2508,_0x205058){return function(_0x3e9862){if(_0x3e9862){var _0x38eb2d=_0x3e9862[_0x5978('0x18')],_0x567b9e=_0x205058[_0x5978('0x19')],_0x37adee=_0x205058['offset']+_0x205058[_0x5978('0x1a')],_0x432701;if(_0x37adee>=_0x38eb2d){_0x37adee=_0x38eb2d;_0x432701=0xc8;}else{_0x432701=0xce;}_0x3d2508[_0x5978('0x15')](_0x432701);return _0x3d2508[_0x5978('0x1b')]('Content-Range',_0x567b9e+'-'+_0x37adee+'/'+_0x38eb2d)[_0x5978('0x17')](_0x3e9862);}return null;};}function patchUpdates(_0xd5c817){return function(_0x1ed087){try{jsonpatch['apply'](_0x1ed087,_0xd5c817,!![]);}catch(_0x249852){return BPromise[_0x5978('0x1c')](_0x249852);}return _0x1ed087[_0x5978('0x1d')]();};}function saveUpdates(_0x124fde,_0x29dd2d){return function(_0x2f3027){if(_0x2f3027){return _0x2f3027[_0x5978('0x1e')](_0x124fde)['then'](function(_0xd872b6){return _0xd872b6;});}return null;};}function removeEntity(_0x3183a1,_0x51a888){return function(_0x290702){if(_0x290702){return _0x290702[_0x5978('0x1f')]()[_0x5978('0x20')](function(){var _0x52ffca=_0x290702[_0x5978('0x21')]({'plain':!![]});var _0x1e6fff=_0x5978('0x22');return db[_0x5978('0x23')][_0x5978('0x1f')]({'where':{'type':_0x1e6fff,'resourceId':_0x52ffca['id']}})[_0x5978('0x20')](function(){return _0x290702;});})[_0x5978('0x20')](function(){_0x3183a1[_0x5978('0x15')](0xcc)[_0x5978('0x16')]();});}};}function handleEntityNotFound(_0x14db28,_0x3ca4ea){return function(_0x5a20d0){if(!_0x5a20d0){_0x14db28['sendStatus'](0x194);}return _0x5a20d0;};}function handleError(_0x343b7e,_0x734cef){_0x734cef=_0x734cef||0x1f4;return function(_0x4e0fd4){logger[_0x5978('0x24')](_0x4e0fd4['stack']);if(_0x4e0fd4['name']){delete _0x4e0fd4[_0x5978('0x25')];}_0x343b7e[_0x5978('0x15')](_0x734cef)[_0x5978('0x26')](_0x4e0fd4);};}exports[_0x5978('0x27')]=function(_0x2f04a7,_0x461b2f){var _0x18e143={},_0x4c0c02={},_0x1ab651={'count':0x0,'rows':[]};var _0xc4aa8c=_['map'](db[_0x5978('0x28')][_0x5978('0x29')],function(_0x251814){return{'name':_0x251814[_0x5978('0x2a')],'type':_0x251814[_0x5978('0x2b')][_0x5978('0x2c')]};});_0x4c0c02[_0x5978('0x2d')]=_[_0x5978('0x2e')](_0xc4aa8c,'name');_0x4c0c02['query']=_[_0x5978('0x2f')](_0x2f04a7['query']);_0x4c0c02[_0x5978('0x30')]=_[_0x5978('0x31')](_0x4c0c02[_0x5978('0x2d')],_0x4c0c02[_0x5978('0x32')]);_0x18e143['attributes']=_['intersection'](_0x4c0c02[_0x5978('0x2d')],qs[_0x5978('0x33')](_0x2f04a7[_0x5978('0x32')]['fields']));_0x18e143[_0x5978('0x34')]=_0x18e143[_0x5978('0x34')]['length']?_0x18e143[_0x5978('0x34')]:_0x4c0c02['model'];if(!_0x2f04a7[_0x5978('0x32')][_0x5978('0x35')](_0x5978('0x36'))){_0x18e143['limit']=qs[_0x5978('0x1a')](_0x2f04a7['query'][_0x5978('0x1a')]);_0x18e143['offset']=qs[_0x5978('0x19')](_0x2f04a7[_0x5978('0x32')]['offset']);}_0x18e143[_0x5978('0x37')]=qs['sort'](_0x2f04a7['query'][_0x5978('0x38')]);_0x18e143[_0x5978('0x39')]=qs[_0x5978('0x30')](_[_0x5978('0x3a')](_0x2f04a7[_0x5978('0x32')],_0x4c0c02[_0x5978('0x30')]),_0xc4aa8c);if(_0x2f04a7[_0x5978('0x32')][_0x5978('0x3b')]){_0x18e143['where']=_[_0x5978('0x3c')](_0x18e143[_0x5978('0x39')],{'$or':_[_0x5978('0x2e')](_0xc4aa8c,function(_0x29ada6){if(_0x29ada6[_0x5978('0x2b')]!==_0x5978('0x3d')){var _0x335873={};_0x335873[_0x29ada6[_0x5978('0x25')]]={'$like':'%'+_0x2f04a7[_0x5978('0x32')][_0x5978('0x3b')]+'%'};return _0x335873;}})});}_0x18e143=_[_0x5978('0x3c')]({},_0x18e143,_0x2f04a7[_0x5978('0x3e')]);var _0x5f4580={'where':_0x18e143[_0x5978('0x39')]};return db[_0x5978('0x28')][_0x5978('0x18')](_0x5f4580)[_0x5978('0x20')](function(_0x5296a7){_0x1ab651['count']=_0x5296a7;if(_0x2f04a7[_0x5978('0x32')][_0x5978('0x3f')]){_0x18e143[_0x5978('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x18e143);})[_0x5978('0x20')](function(_0x7ceba1){_0x1ab651[_0x5978('0x41')]=_0x7ceba1;return _0x1ab651;})[_0x5978('0x20')](respondWithFilteredResult(_0x461b2f,_0x18e143))[_0x5978('0x42')](handleError(_0x461b2f,null));};exports[_0x5978('0x43')]=function(_0x3bfd90,_0x1f982f){var _0x43f7d7={'raw':!![],'where':{'id':_0x3bfd90[_0x5978('0x44')]['id']}},_0x33e868={};_0x33e868['model']=_['keys'](db[_0x5978('0x28')][_0x5978('0x29')]);_0x33e868[_0x5978('0x32')]=_[_0x5978('0x2f')](_0x3bfd90[_0x5978('0x32')]);_0x33e868[_0x5978('0x30')]=_[_0x5978('0x31')](_0x33e868['model'],_0x33e868['query']);_0x43f7d7[_0x5978('0x34')]=_[_0x5978('0x31')](_0x33e868[_0x5978('0x2d')],qs['fields'](_0x3bfd90[_0x5978('0x32')]['fields']));_0x43f7d7[_0x5978('0x34')]=_0x43f7d7[_0x5978('0x34')]['length']?_0x43f7d7['attributes']:_0x33e868[_0x5978('0x2d')];if(_0x3bfd90['query'][_0x5978('0x3f')]){_0x43f7d7[_0x5978('0x40')]=[{'all':!![]}];}_0x43f7d7=_['merge']({},_0x43f7d7,_0x3bfd90[_0x5978('0x3e')]);return db[_0x5978('0x28')][_0x5978('0x45')](_0x43f7d7)[_0x5978('0x20')](handleEntityNotFound(_0x1f982f,null))[_0x5978('0x20')](respondWithResult(_0x1f982f,null))[_0x5978('0x42')](handleError(_0x1f982f,null));};exports[_0x5978('0x46')]=function(_0x59a444,_0x32aceb){return db['CmHopperAdditionalPhone'][_0x5978('0x46')](_0x59a444[_0x5978('0x47')],{})[_0x5978('0x20')](function(_0xf0065){var _0x2e56ec=_0x59a444[_0x5978('0x48')][_0x5978('0x21')]({'plain':!![]});if(!_0x2e56ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e56ec[_0x5978('0x49')]==='user'){var _0x1215a0=_0xf0065[_0x5978('0x21')]({'plain':!![]});var _0x39183b=_0x5978('0x22');return db['UserProfileSection'][_0x5978('0x45')]({'where':{'name':_0x39183b,'userProfileId':_0x2e56ec[_0x5978('0x4a')]},'raw':!![]})[_0x5978('0x20')](function(_0x107024){if(_0x107024&&_0x107024[_0x5978('0x4b')]===0x0){return db['UserProfileResource'][_0x5978('0x46')]({'name':_0x1215a0[_0x5978('0x25')],'resourceId':_0x1215a0['id'],'type':_0x107024[_0x5978('0x25')],'sectionId':_0x107024['id']},{})[_0x5978('0x20')](function(){return _0xf0065;});}else{return _0xf0065;}})['catch'](function(_0x382aad){logger['error'](_0x5978('0x4c'),_0x382aad);throw _0x382aad;});}return _0xf0065;})['then'](respondWithResult(_0x32aceb,0xc9))['catch'](handleError(_0x32aceb,null));};exports[_0x5978('0x1e')]=function(_0x5dbb07,_0x1f6a11){if(_0x5dbb07[_0x5978('0x47')]['id']){delete _0x5dbb07[_0x5978('0x47')]['id'];}return db[_0x5978('0x28')][_0x5978('0x45')]({'where':{'id':_0x5dbb07[_0x5978('0x44')]['id']}})[_0x5978('0x20')](handleEntityNotFound(_0x1f6a11,null))['then'](saveUpdates(_0x5dbb07[_0x5978('0x47')],null))[_0x5978('0x20')](respondWithResult(_0x1f6a11,null))[_0x5978('0x42')](handleError(_0x1f6a11,null));};exports[_0x5978('0x1f')]=function(_0x24e4da,_0x184934){return db[_0x5978('0x28')]['find']({'where':{'id':_0x24e4da['params']['id']}})[_0x5978('0x20')](handleEntityNotFound(_0x184934,null))['then'](removeEntity(_0x184934,null))[_0x5978('0x42')](handleError(_0x184934,null));}; \ No newline at end of file +var _0x941b=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','sort','where','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0xbc1eb0,_0x260c8d){var _0x1569b8=function(_0x51ce29){while(--_0x51ce29){_0xbc1eb0['push'](_0xbc1eb0['shift']());}};_0x1569b8(++_0x260c8d);}(_0x941b,0x175));var _0xb941=function(_0x3c4639,_0x89c2ff){_0x3c4639=_0x3c4639-0x0;var _0x996676=_0x941b[_0x3c4639];return _0x996676;};'use strict';var pdf=require(_0xb941('0x0'));var emlformat=require(_0xb941('0x1'));var rimraf=require(_0xb941('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb941('0x3'));var rp=require('request-promise');var moment=require(_0xb941('0x4'));var BPromise=require(_0xb941('0x5'));var Mustache=require(_0xb941('0x6'));var util=require(_0xb941('0x7'));var path=require('path');var sox=require(_0xb941('0x8'));var csv=require(_0xb941('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb941('0xa'));var squel=require(_0xb941('0xb'));var crypto=require(_0xb941('0xc'));var jsforce=require(_0xb941('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb941('0xe'));var Papa=require(_0xb941('0xf'));var Redis=require(_0xb941('0x10'));var authService=require(_0xb941('0x11'));var qs=require(_0xb941('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb941('0x13'));var logger=require(_0xb941('0x14'))(_0xb941('0x15'));var utils=require(_0xb941('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e1030,_0x3a1aea){_0x3a1aea=_0x3a1aea||0xcc;return function(_0x25e98b){if(_0x25e98b){return _0x4e1030[_0xb941('0x17')](_0x3a1aea);}return _0x4e1030['status'](_0x3a1aea)[_0xb941('0x18')]();};}function respondWithResult(_0x1c5583,_0x42deff){_0x42deff=_0x42deff||0xc8;return function(_0x2f38a1){if(_0x2f38a1){return _0x1c5583[_0xb941('0x19')](_0x42deff)[_0xb941('0x1a')](_0x2f38a1);}};}function respondWithFilteredResult(_0x150d80,_0x1ec0ac){return function(_0x163796){if(_0x163796){var _0x1c5706=_0x163796[_0xb941('0x1b')],_0x3c3c35=_0x1ec0ac[_0xb941('0x1c')],_0x1ea958=_0x1ec0ac[_0xb941('0x1c')]+_0x1ec0ac[_0xb941('0x1d')],_0x966610;if(_0x1ea958>=_0x1c5706){_0x1ea958=_0x1c5706;_0x966610=0xc8;}else{_0x966610=0xce;}_0x150d80[_0xb941('0x19')](_0x966610);return _0x150d80['set'](_0xb941('0x1e'),_0x3c3c35+'-'+_0x1ea958+'/'+_0x1c5706)[_0xb941('0x1a')](_0x163796);}return null;};}function patchUpdates(_0xf8340e){return function(_0x28294f){try{jsonpatch['apply'](_0x28294f,_0xf8340e,!![]);}catch(_0x2c9a6d){return BPromise[_0xb941('0x1f')](_0x2c9a6d);}return _0x28294f[_0xb941('0x20')]();};}function saveUpdates(_0x3870f1,_0x1c29c1){return function(_0x13ba99){if(_0x13ba99){return _0x13ba99[_0xb941('0x21')](_0x3870f1)['then'](function(_0xe0bf15){return _0xe0bf15;});}return null;};}function removeEntity(_0x40b1de,_0x4b341b){return function(_0x10363d){if(_0x10363d){return _0x10363d[_0xb941('0x22')]()[_0xb941('0x23')](function(){var _0x5db77c=_0x10363d[_0xb941('0x24')]({'plain':!![]});var _0x571273=_0xb941('0x25');return db[_0xb941('0x26')]['destroy']({'where':{'type':_0x571273,'resourceId':_0x5db77c['id']}})[_0xb941('0x23')](function(){return _0x10363d;});})[_0xb941('0x23')](function(){_0x40b1de[_0xb941('0x19')](0xcc)[_0xb941('0x18')]();});}};}function handleEntityNotFound(_0x48d861,_0x4ee536){return function(_0x30359e){if(!_0x30359e){_0x48d861[_0xb941('0x17')](0x194);}return _0x30359e;};}function handleError(_0x909665,_0x38b7fa){_0x38b7fa=_0x38b7fa||0x1f4;return function(_0x2ca5c8){logger['error'](_0x2ca5c8['stack']);if(_0x2ca5c8['name']){delete _0x2ca5c8[_0xb941('0x27')];}_0x909665[_0xb941('0x19')](_0x38b7fa)[_0xb941('0x28')](_0x2ca5c8);};}exports[_0xb941('0x29')]=function(_0x1cb012,_0x45a34a){var _0x2db6ff={},_0x462dec={},_0x4390b7={'count':0x0,'rows':[]};var _0x4d77c9=_[_0xb941('0x2a')](db[_0xb941('0x2b')][_0xb941('0x2c')],function(_0x588ed6){return{'name':_0x588ed6['fieldName'],'type':_0x588ed6[_0xb941('0x2d')][_0xb941('0x2e')]};});_0x462dec['model']=_[_0xb941('0x2a')](_0x4d77c9,_0xb941('0x27'));_0x462dec[_0xb941('0x2f')]=_[_0xb941('0x30')](_0x1cb012[_0xb941('0x2f')]);_0x462dec['filters']=_[_0xb941('0x31')](_0x462dec[_0xb941('0x32')],_0x462dec['query']);_0x2db6ff['attributes']=_[_0xb941('0x31')](_0x462dec[_0xb941('0x32')],qs[_0xb941('0x33')](_0x1cb012[_0xb941('0x2f')][_0xb941('0x33')]));_0x2db6ff[_0xb941('0x34')]=_0x2db6ff[_0xb941('0x34')][_0xb941('0x35')]?_0x2db6ff[_0xb941('0x34')]:_0x462dec[_0xb941('0x32')];if(!_0x1cb012[_0xb941('0x2f')]['hasOwnProperty'](_0xb941('0x36'))){_0x2db6ff[_0xb941('0x1d')]=qs['limit'](_0x1cb012[_0xb941('0x2f')]['limit']);_0x2db6ff['offset']=qs[_0xb941('0x1c')](_0x1cb012[_0xb941('0x2f')][_0xb941('0x1c')]);}_0x2db6ff['order']=qs[_0xb941('0x37')](_0x1cb012[_0xb941('0x2f')]['sort']);_0x2db6ff[_0xb941('0x38')]=qs['filters'](_['pick'](_0x1cb012[_0xb941('0x2f')],_0x462dec['filters']),_0x4d77c9);if(_0x1cb012[_0xb941('0x2f')][_0xb941('0x39')]){_0x2db6ff['where']=_[_0xb941('0x3a')](_0x2db6ff[_0xb941('0x38')],{'$or':_[_0xb941('0x2a')](_0x4d77c9,function(_0x2cec0d){if(_0x2cec0d['type']!=='VIRTUAL'){var _0x417e65={};_0x417e65[_0x2cec0d[_0xb941('0x27')]]={'$like':'%'+_0x1cb012[_0xb941('0x2f')][_0xb941('0x39')]+'%'};return _0x417e65;}})});}_0x2db6ff=_[_0xb941('0x3a')]({},_0x2db6ff,_0x1cb012['options']);var _0x4b8326={'where':_0x2db6ff[_0xb941('0x38')]};return db[_0xb941('0x2b')][_0xb941('0x1b')](_0x4b8326)[_0xb941('0x23')](function(_0x3fe347){_0x4390b7['count']=_0x3fe347;if(_0x1cb012['query']['includeAll']){_0x2db6ff[_0xb941('0x3b')]=[{'all':!![]}];}return db[_0xb941('0x2b')][_0xb941('0x3c')](_0x2db6ff);})[_0xb941('0x23')](function(_0x212209){_0x4390b7[_0xb941('0x3d')]=_0x212209;return _0x4390b7;})[_0xb941('0x23')](respondWithFilteredResult(_0x45a34a,_0x2db6ff))[_0xb941('0x3e')](handleError(_0x45a34a,null));};exports[_0xb941('0x3f')]=function(_0x50b7a7,_0x29d296){var _0x65f70a={'raw':!![],'where':{'id':_0x50b7a7[_0xb941('0x40')]['id']}},_0xdca4a8={};_0xdca4a8[_0xb941('0x32')]=_['keys'](db[_0xb941('0x2b')][_0xb941('0x2c')]);_0xdca4a8[_0xb941('0x2f')]=_['keys'](_0x50b7a7[_0xb941('0x2f')]);_0xdca4a8['filters']=_[_0xb941('0x31')](_0xdca4a8[_0xb941('0x32')],_0xdca4a8[_0xb941('0x2f')]);_0x65f70a[_0xb941('0x34')]=_[_0xb941('0x31')](_0xdca4a8[_0xb941('0x32')],qs[_0xb941('0x33')](_0x50b7a7[_0xb941('0x2f')]['fields']));_0x65f70a[_0xb941('0x34')]=_0x65f70a[_0xb941('0x34')][_0xb941('0x35')]?_0x65f70a[_0xb941('0x34')]:_0xdca4a8[_0xb941('0x32')];if(_0x50b7a7['query'][_0xb941('0x41')]){_0x65f70a['include']=[{'all':!![]}];}_0x65f70a=_[_0xb941('0x3a')]({},_0x65f70a,_0x50b7a7[_0xb941('0x42')]);return db[_0xb941('0x2b')][_0xb941('0x43')](_0x65f70a)[_0xb941('0x23')](handleEntityNotFound(_0x29d296,null))['then'](respondWithResult(_0x29d296,null))[_0xb941('0x3e')](handleError(_0x29d296,null));};exports[_0xb941('0x44')]=function(_0x35653e,_0x56d9f8){return db[_0xb941('0x2b')][_0xb941('0x44')](_0x35653e[_0xb941('0x45')],{})[_0xb941('0x23')](function(_0x177c91){var _0x30f052=_0x35653e[_0xb941('0x46')][_0xb941('0x24')]({'plain':!![]});if(!_0x30f052)throw new Error(_0xb941('0x47'));if(_0x30f052[_0xb941('0x48')]===_0xb941('0x46')){var _0x6dfeb9=_0x177c91[_0xb941('0x24')]({'plain':!![]});var _0x404742=_0xb941('0x25');return db['UserProfileSection'][_0xb941('0x43')]({'where':{'name':_0x404742,'userProfileId':_0x30f052[_0xb941('0x49')]},'raw':!![]})[_0xb941('0x23')](function(_0x5b92c2){if(_0x5b92c2&&_0x5b92c2[_0xb941('0x4a')]===0x0){return db['UserProfileResource'][_0xb941('0x44')]({'name':_0x6dfeb9[_0xb941('0x27')],'resourceId':_0x6dfeb9['id'],'type':_0x5b92c2[_0xb941('0x27')],'sectionId':_0x5b92c2['id']},{})[_0xb941('0x23')](function(){return _0x177c91;});}else{return _0x177c91;}})[_0xb941('0x3e')](function(_0x82d973){logger[_0xb941('0x4b')](_0xb941('0x4c'),_0x82d973);throw _0x82d973;});}return _0x177c91;})['then'](respondWithResult(_0x56d9f8,0xc9))[_0xb941('0x3e')](handleError(_0x56d9f8,null));};exports['update']=function(_0x475afb,_0x19a4ee){if(_0x475afb['body']['id']){delete _0x475afb['body']['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x475afb['params']['id']}})[_0xb941('0x23')](handleEntityNotFound(_0x19a4ee,null))[_0xb941('0x23')](saveUpdates(_0x475afb[_0xb941('0x45')],null))[_0xb941('0x23')](respondWithResult(_0x19a4ee,null))[_0xb941('0x3e')](handleError(_0x19a4ee,null));};exports[_0xb941('0x22')]=function(_0x290b33,_0x597cd9){return db[_0xb941('0x2b')][_0xb941('0x43')]({'where':{'id':_0x290b33['params']['id']}})[_0xb941('0x23')](handleEntityNotFound(_0x597cd9,null))[_0xb941('0x23')](removeEntity(_0x597cd9,null))[_0xb941('0x3e')](handleError(_0x597cd9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 7429d48..a0cfa45 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 _0x210f=['moment','request-promise','path','rimraf','../../config/environment','exports','CmHopperAdditionalPhone','util','../../config/logger','api'];(function(_0x22ef19,_0x4d5f4c){var _0x11c09e=function(_0x4cc30a){while(--_0x4cc30a){_0x22ef19['push'](_0x22ef19['shift']());}};_0x11c09e(++_0x4d5f4c);}(_0x210f,0x1c9));var _0xf210=function(_0xd275f8,_0x542c91){_0xd275f8=_0xd275f8-0x0;var _0x280b70=_0x210f[_0xd275f8];return _0x280b70;};'use strict';var _=require('lodash');var util=require(_0xf210('0x0'));var logger=require(_0xf210('0x1'))(_0xf210('0x2'));var moment=require(_0xf210('0x3'));var BPromise=require('bluebird');var rp=require(_0xf210('0x4'));var fs=require('fs');var path=require(_0xf210('0x5'));var rimraf=require(_0xf210('0x6'));var config=require(_0xf210('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xf210('0x8')]=function(_0x4924d8,_0x491265){return _0x4924d8['define'](_0xf210('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b1c=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b1c,0xd9));var _0xc6b1=function(_0x5ccc25,_0x1bac75){_0x5ccc25=_0x5ccc25-0x0;var _0x3d5901=_0x6b1c[_0x5ccc25];return _0x3d5901;};'use strict';var _=require(_0xc6b1('0x0'));var util=require(_0xc6b1('0x1'));var logger=require(_0xc6b1('0x2'))(_0xc6b1('0x3'));var moment=require(_0xc6b1('0x4'));var BPromise=require(_0xc6b1('0x5'));var rp=require(_0xc6b1('0x6'));var fs=require('fs');var path=require(_0xc6b1('0x7'));var rimraf=require(_0xc6b1('0x8'));var config=require(_0xc6b1('0x9'));var attributes=require(_0xc6b1('0xa'));module[_0xc6b1('0xb')]=function(_0x115a66,_0x27e744){return _0x115a66['define'](_0xc6b1('0xc'),attributes,{'tableName':_0xc6b1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 71b67ca..45e95d5 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 _0xc32b=['countmachineretry','countagentrejectretry','entity','countabandonedretry','dialGlobalMaxRetry','VerifyAdditionalPhones','CmHopper','duration','waitTime','info','scheduledat','add','minutes','phone','createdAt','updatedAt','isNil','hopperToAdd','additionalToHop','transaction','update','IncrementPreviewCounters','field','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','catch','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x554a48,_0x3b0b29){var _0x4cd1dc=function(_0x420dff){while(--_0x420dff){_0x554a48['push'](_0x554a48['shift']());}};_0x4cd1dc(++_0x3b0b29);}(_0xc32b,0x87));var _0xbc32=function(_0x56bf85,_0x142e1b){_0x56bf85=_0x56bf85-0x0;var _0xaf04aa=_0xc32b[_0x56bf85];return _0xaf04aa;};'use strict';var _=require('lodash');var util=require(_0xbc32('0x0'));var moment=require(_0xbc32('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc32('0x2'));var fs=require('fs');var Redis=require(_0xbc32('0x3'));var db=require(_0xbc32('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc32('0x5'))(_0xbc32('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc32('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28d205,_0x53ade5,_0x4be09a){return new BPromise(function(_0x7c2bb7,_0x1498f4){return client[_0xbc32('0x8')](_0x28d205,_0x4be09a)['then'](function(_0xbaaa98){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x53ade5,_0xbc32('0x9'));logger[_0xbc32('0xa')](_0xbc32('0xb'),_0x53ade5,'request\x20sent',JSON['stringify'](_0xbaaa98));if(_0xbaaa98[_0xbc32('0xc')]){if(_0xbaaa98[_0xbc32('0xc')][_0xbc32('0xd')]===0x1f4){logger[_0xbc32('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x53ade5,_0xbaaa98[_0xbc32('0xc')]['message']);return _0x1498f4(_0xbaaa98[_0xbc32('0xc')][_0xbc32('0xe')]);}logger[_0xbc32('0xc')](_0xbc32('0xf'),_0x53ade5,_0xbaaa98[_0xbc32('0xc')]['message']);return _0x7c2bb7(_0xbaaa98[_0xbc32('0xc')][_0xbc32('0xe')]);}else{logger['info'](_0xbc32('0xf'),_0x53ade5,_0xbc32('0x9'));_0x7c2bb7(_0xbaaa98[_0xbc32('0x10')][_0xbc32('0xe')]);}})[_0xbc32('0x11')](function(_0x11d27f){logger[_0xbc32('0xc')](_0xbc32('0xf'),_0x53ade5,_0x11d27f);_0x1498f4(_0x11d27f);});});}exports['VerifyAdditionalPhones']=function(_0x3f9c24){var _0x3adabd=this;return new Promise(function(_0x100efc,_0x51607f){return db['CmHopper'][_0xbc32('0x12')]({'raw':!![],'where':{'ContactId':_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x14')],'ListId':_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x15')],'VoiceQueueId':_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x16')]===undefined?null:_0x3f9c24['body']['VoiceQueueId'],'CampaignId':_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x17')]===undefined?null:_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x17')]}})[_0xbc32('0x18')](function(_0x37e6f5){if(_0x37e6f5!=null){return db[_0xbc32('0x19')][_0xbc32('0x12')]({'raw':!![],'where':{'CmHopperId':_0x37e6f5['id'],'OrderBy':{'$gt':_0x37e6f5['OrderBy']}},'order':[[_0xbc32('0x1a'),_0xbc32('0x1b')]]})[_0xbc32('0x18')](function(_0xef3245){var _0x15b9be=0x0;if(_0xef3245){if(_0xef3245[_0xbc32('0x1c')]+_0xef3245[_0xbc32('0x1d')]+_0xef3245[_0xbc32('0x1e')]+_0xef3245[_0xbc32('0x1f')]+_0xef3245[_0xbc32('0x20')]+_0xef3245['countabandonedretry']+_0xef3245[_0xbc32('0x21')]+_0xef3245[_0xbc32('0x22')]<_0x3f9c24[_0xbc32('0x23')]['dialGlobalMaxRetry'])_0x15b9be=0x1;_0x100efc({'additional':_0x15b9be});}else{return db[_0xbc32('0x19')][_0xbc32('0x12')]({'raw':!![],'where':{'CmHopperId':_0x37e6f5['id']},'order':[[_0xbc32('0x1a'),'ASC']]})[_0xbc32('0x18')](function(_0x3662f4){var _0x3e735f=0x0;if(_0x3662f4){if(_0x3662f4[_0xbc32('0x1c')]+_0x3662f4[_0xbc32('0x1d')]+_0x3662f4[_0xbc32('0x1e')]+_0x3662f4[_0xbc32('0x1f')]+_0x3662f4[_0xbc32('0x20')]+_0x3662f4[_0xbc32('0x24')]+_0x3662f4['countmachineretry']+_0x3662f4[_0xbc32('0x22')]<_0x3f9c24[_0xbc32('0x23')][_0xbc32('0x25')])_0x3e735f=0x1;_0x100efc({'additional':_0x3e735f});}else{_0x100efc({'additional':0x0});}})[_0xbc32('0x11')](function(_0x15b7f9){logger[_0xbc32('0xc')](_0xbc32('0x26'),_0x15b7f9[_0xbc32('0xe')],_0x3f9c24);_0x51607f(_0x3adabd[_0xbc32('0xc')](0x1f4,_0x15b7f9['message']));});}})[_0xbc32('0x11')](function(_0x1cffed){logger['error'](_0xbc32('0x26'),_0x1cffed[_0xbc32('0xe')],_0x3f9c24);_0x51607f(_0x3adabd[_0xbc32('0xc')](0x1f4,_0x1cffed[_0xbc32('0xe')]));});}else _0x100efc({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x5a79f6){var _0x31f989=this;return new Promise(function(_0x38a829,_0x1a4f03){return db[_0xbc32('0x27')][_0xbc32('0x12')]({'raw':!![],'where':{'ContactId':_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x14')],'ListId':_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x15')],'VoiceQueueId':_0x5a79f6['body']['VoiceQueueId']===undefined?null:_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x16')],'CampaignId':_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x17')]===undefined?null:_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x17')]}})[_0xbc32('0x18')](function(_0x1b0547){if(_0x1b0547!=null){return db[_0xbc32('0x19')][_0xbc32('0x12')]({'raw':!![],'where':{'CmHopperId':_0x1b0547['id'],'OrderBy':{'$gt':_0x1b0547['OrderBy']}},'order':[[_0xbc32('0x1a'),'ASC']]})['then'](function(_0x70f07b){if(_0x70f07b)return activateAdditionalPhone(_0x1b0547,_0x5a79f6[_0xbc32('0x13')],_0x70f07b,_0x5a79f6[_0xbc32('0x28')],_0x5a79f6[_0xbc32('0x29')])[_0xbc32('0x18')](function(_0x23c617){_0x38a829(_0x23c617);});else{return db[_0xbc32('0x19')][_0xbc32('0x12')]({'raw':!![],'where':{'CmHopperId':_0x1b0547['id']},'order':[[_0xbc32('0x1a'),_0xbc32('0x1b')]]})[_0xbc32('0x18')](function(_0x5c61e0){if(_0x5c61e0)return activateAdditionalPhone(_0x1b0547,_0x5a79f6['body'],_0x5c61e0,_0x5a79f6[_0xbc32('0x28')],_0x5a79f6[_0xbc32('0x29')])[_0xbc32('0x18')](function(_0x1cfedb){_0x38a829(_0x1cfedb);});else{_0x38a829({'id':_0x1b0547['id'],'phone':''});}})[_0xbc32('0x11')](function(_0x42f620){logger[_0xbc32('0xc')](_0xbc32('0x26'),_0x42f620['message'],_0x5a79f6);_0x1a4f03(_0x31f989[_0xbc32('0xc')](0x1f4,_0x42f620[_0xbc32('0xe')]));});}})[_0xbc32('0x11')](function(_0x4e170a){logger[_0xbc32('0xc')](_0xbc32('0x26'),_0x4e170a['message'],_0x5a79f6);_0x1a4f03(_0x31f989['error'](0x1f4,_0x4e170a['message']));});}else _0x38a829(0x1);});});};function activateAdditionalPhone(_0x359e8b,_0x393705,_0x357796,_0x31a385,_0x4be729){return new Promise(function(_0x308db2,_0x24c437){logger[_0xbc32('0x2a')]('VerifyAdditionalPhones',_0x357796);var _0x5e1175;if(moment()>moment(_0x357796[_0xbc32('0x2b')])){_0x5e1175=moment()[_0xbc32('0x2c')](_0x4be729||0x3,_0xbc32('0x2d'));}else{if(_0x357796[_0xbc32('0x1a')]==0x0){_0x5e1175=moment(_0x357796[_0xbc32('0x2b')]);}else{_0x5e1175=moment()[_0xbc32('0x2c')](_0x4be729||0x3,_0xbc32('0x2d'));}}var _0x2b55b7={'phone':_0x359e8b[_0xbc32('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x359e8b[_0xbc32('0x1a')])?0x0:_0x359e8b['OrderBy'],'scheduledat':moment()['add'](_0x31a385||0x1,_0xbc32('0x2d')),'countbusyretry':_0x393705[_0xbc32('0x1c')],'countcongestionretry':_0x393705['countcongestionretry'],'countnoanswerretry':_0x393705[_0xbc32('0x1e')],'countnosuchnumberretry':_0x393705[_0xbc32('0x1f')],'countdropretry':_0x393705['countdropretry'],'countabandonedretry':_0x393705[_0xbc32('0x24')],'countmachineretry':_0x393705[_0xbc32('0x21')],'countagentrejectretry':_0x393705['countagentrejectretry'],'createdAt':_0x393705[_0xbc32('0x2f')],'updatedAt':_0x393705[_0xbc32('0x30')]};var _0x184d78={'CmHopperId':_0x359e8b['id'],'phone':_0x357796['phone'],'active':0x0,'OrderBy':_[_0xbc32('0x31')](_0x357796[_0xbc32('0x1a')])?0x0:_0x357796[_0xbc32('0x1a')],'scheduledat':_0x5e1175,'countbusyretry':_0x357796[_0xbc32('0x1c')],'countcongestionretry':_0x357796[_0xbc32('0x1d')],'countnoanswerretry':_0x357796[_0xbc32('0x1e')],'countnosuchnumberretry':_0x393705['countnosuchnumberretry'],'countdropretry':_0x393705[_0xbc32('0x20')],'countabandonedretry':_0x393705[_0xbc32('0x24')],'countmachineretry':_0x393705['countmachineretry'],'countagentrejectretry':_0x393705['countagentrejectretry'],'createdAt':_0x357796[_0xbc32('0x2f')],'updatedAt':_0x357796[_0xbc32('0x30')]};logger['info'](_0xbc32('0x32'),_0x2b55b7);logger[_0xbc32('0x2a')](_0xbc32('0x33'),_0x184d78);return db['sequelize'][_0xbc32('0x34')](function(_0x35f83f){return db[_0xbc32('0x19')]['update'](_0x2b55b7,{'where':{'id':_0x357796['id']}},{'transaction':_0x35f83f})['then'](function(){return db[_0xbc32('0x27')][_0xbc32('0x35')](_0x184d78,{'where':{'id':_0x359e8b['id']}},{'transaction':_0x35f83f});});})[_0xbc32('0x18')](function(_0x1417fa){_0x308db2({'id':_0x359e8b['id'],'phone':_0x357796[_0xbc32('0x2e')]});})['catch'](function(_0x51986f){logger[_0xbc32('0xc')](_0xbc32('0x26'),_0x51986f[_0xbc32('0xe')],req);_0x24c437(_this['error'](0x1f4,_0x51986f[_0xbc32('0xe')]));});});}exports[_0xbc32('0x36')]=function(_0xd4df7c){var _0x4bccb5=this;return new Promise(function(_0x4734e0,_0x394443){return db[_0xbc32('0x27')][_0xbc32('0x35')](_0xd4df7c['body'][_0xbc32('0x37')],{'where':{'id':_0xd4df7c[_0xbc32('0x13')]['id']}})['then'](function(_0x515573){_0x4734e0(_0x515573);})[_0xbc32('0x11')](function(_0x5df7cb){logger[_0xbc32('0xc')]('IncrementPreviewCounters',_0x5df7cb[_0xbc32('0xe')],_0xd4df7c);_0x394443(_0x4bccb5[_0xbc32('0xc')](0x1f4,_0x5df7cb[_0xbc32('0xe')]));});});}; \ No newline at end of file +var _0x29af=['SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','add','phone','isNil','countbusyretry','countcongestionretry','createdAt','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','countagentrejectretry'];(function(_0x12c081,_0x4928a0){var _0x276263=function(_0x2386c4){while(--_0x2386c4){_0x12c081['push'](_0x12c081['shift']());}};_0x276263(++_0x4928a0);}(_0x29af,0x134));var _0xf29a=function(_0x2cf7e1,_0x25fe74){_0x2cf7e1=_0x2cf7e1-0x0;var _0x55833d=_0x29af[_0x2cf7e1];return _0x55833d;};'use strict';var _=require(_0xf29a('0x0'));var util=require(_0xf29a('0x1'));var moment=require(_0xf29a('0x2'));var BPromise=require('bluebird');var rs=require(_0xf29a('0x3'));var fs=require('fs');var Redis=require(_0xf29a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf29a('0x5'));var logger=require('../../config/logger')(_0xf29a('0x6'));var config=require(_0xf29a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf29a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c111b,_0x47749d,_0x33a308){return new BPromise(function(_0x347d76,_0x4393dc){return client['request'](_0x2c111b,_0x33a308)[_0xf29a('0x9')](function(_0x145dbb){logger[_0xf29a('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x47749d,'request\x20sent');logger[_0xf29a('0xb')](_0xf29a('0xc'),_0x47749d,_0xf29a('0xd'),JSON[_0xf29a('0xe')](_0x145dbb));if(_0x145dbb[_0xf29a('0xf')]){if(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x10')]===0x1f4){logger['error'](_0xf29a('0x11'),_0x47749d,_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);return _0x4393dc(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);}logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x145dbb['error']['message']);return _0x347d76(_0x145dbb['error'][_0xf29a('0x12')]);}else{logger[_0xf29a('0xa')](_0xf29a('0x11'),_0x47749d,_0xf29a('0xd'));_0x347d76(_0x145dbb[_0xf29a('0x13')]['message']);}})[_0xf29a('0x14')](function(_0x42567e){logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x42567e);_0x4393dc(_0x42567e);});});}exports[_0xf29a('0x15')]=function(_0xd4ca39){var _0x19e886=this;return new Promise(function(_0x296829,_0x3f9da8){return db[_0xf29a('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x18')],'ListId':_0xd4ca39['body'][_0xf29a('0x19')],'VoiceQueueId':_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x1a')]===undefined?null:_0xd4ca39['body'][_0xf29a('0x1a')],'CampaignId':_0xd4ca39['body'][_0xf29a('0x1b')]===undefined?null:_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x1b')]}})[_0xf29a('0x9')](function(_0x4d557c){if(_0x4d557c!=null){return db[_0xf29a('0x1c')][_0xf29a('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4d557c['id'],'OrderBy':{'$gt':_0x4d557c[_0xf29a('0x1e')]}},'order':[[_0xf29a('0x1e'),_0xf29a('0x1f')]]})[_0xf29a('0x9')](function(_0x2e03e7){var _0x5d5ff5=0x0;if(_0x2e03e7){if(_0x2e03e7['countbusyretry']+_0x2e03e7['countcongestionretry']+_0x2e03e7[_0xf29a('0x20')]+_0x2e03e7['countnosuchnumberretry']+_0x2e03e7[_0xf29a('0x21')]+_0x2e03e7[_0xf29a('0x22')]+_0x2e03e7[_0xf29a('0x23')]+_0x2e03e7['countagentrejectretry']<_0xd4ca39[_0xf29a('0x24')][_0xf29a('0x25')])_0x5d5ff5=0x1;_0x296829({'additional':_0x5d5ff5});}else{return db[_0xf29a('0x1c')][_0xf29a('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4d557c['id']},'order':[[_0xf29a('0x1e'),_0xf29a('0x1f')]]})['then'](function(_0x4216af){var _0x43b4ab=0x0;if(_0x4216af){if(_0x4216af['countbusyretry']+_0x4216af['countcongestionretry']+_0x4216af['countnoanswerretry']+_0x4216af[_0xf29a('0x26')]+_0x4216af[_0xf29a('0x21')]+_0x4216af[_0xf29a('0x22')]+_0x4216af[_0xf29a('0x23')]+_0x4216af[_0xf29a('0x27')]<_0xd4ca39[_0xf29a('0x24')][_0xf29a('0x25')])_0x43b4ab=0x1;_0x296829({'additional':_0x43b4ab});}else{_0x296829({'additional':0x0});}})['catch'](function(_0x2b10d1){logger[_0xf29a('0xf')](_0xf29a('0x15'),_0x2b10d1[_0xf29a('0x12')],_0xd4ca39);_0x3f9da8(_0x19e886[_0xf29a('0xf')](0x1f4,_0x2b10d1[_0xf29a('0x12')]));});}})[_0xf29a('0x14')](function(_0x4feeae){logger[_0xf29a('0xf')]('VerifyAdditionalPhones',_0x4feeae[_0xf29a('0x12')],_0xd4ca39);_0x3f9da8(_0x19e886[_0xf29a('0xf')](0x1f4,_0x4feeae[_0xf29a('0x12')]));});}else _0x296829({'additional':0x0});});});};exports[_0xf29a('0x28')]=function(_0x1ada85){var _0x4e081c=this;return new Promise(function(_0x12110d,_0x56dc44){return db[_0xf29a('0x16')][_0xf29a('0x1d')]({'raw':!![],'where':{'ContactId':_0x1ada85['body'][_0xf29a('0x18')],'ListId':_0x1ada85[_0xf29a('0x17')]['ListId'],'VoiceQueueId':_0x1ada85[_0xf29a('0x17')][_0xf29a('0x1a')]===undefined?null:_0x1ada85[_0xf29a('0x17')][_0xf29a('0x1a')],'CampaignId':_0x1ada85[_0xf29a('0x17')][_0xf29a('0x1b')]===undefined?null:_0x1ada85['body'][_0xf29a('0x1b')]}})[_0xf29a('0x9')](function(_0x10616d){if(_0x10616d!=null){return db['CmHopperAdditionalPhone'][_0xf29a('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x10616d['id'],'OrderBy':{'$gt':_0x10616d[_0xf29a('0x1e')]}},'order':[[_0xf29a('0x1e'),_0xf29a('0x1f')]]})[_0xf29a('0x9')](function(_0x3ef3c){if(_0x3ef3c)return activateAdditionalPhone(_0x10616d,_0x1ada85[_0xf29a('0x17')],_0x3ef3c,_0x1ada85[_0xf29a('0x29')],_0x1ada85[_0xf29a('0x2a')])[_0xf29a('0x9')](function(_0x243291){_0x12110d(_0x243291);});else{return db[_0xf29a('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x10616d['id']},'order':[['OrderBy',_0xf29a('0x1f')]]})[_0xf29a('0x9')](function(_0x27243d){if(_0x27243d)return activateAdditionalPhone(_0x10616d,_0x1ada85['body'],_0x27243d,_0x1ada85[_0xf29a('0x29')],_0x1ada85[_0xf29a('0x2a')])[_0xf29a('0x9')](function(_0x2801ca){_0x12110d(_0x2801ca);});else{_0x12110d({'id':_0x10616d['id'],'phone':''});}})[_0xf29a('0x14')](function(_0x44fb4c){logger[_0xf29a('0xf')](_0xf29a('0x15'),_0x44fb4c[_0xf29a('0x12')],_0x1ada85);_0x56dc44(_0x4e081c[_0xf29a('0xf')](0x1f4,_0x44fb4c[_0xf29a('0x12')]));});}})['catch'](function(_0x358c07){logger['error'](_0xf29a('0x15'),_0x358c07[_0xf29a('0x12')],_0x1ada85);_0x56dc44(_0x4e081c['error'](0x1f4,_0x358c07[_0xf29a('0x12')]));});}else _0x12110d(0x1);});});};function activateAdditionalPhone(_0x5cf180,_0x36f0f3,_0x15ce1e,_0x38c060,_0xe8375d){return new Promise(function(_0x41aa32,_0x548345){logger[_0xf29a('0xa')](_0xf29a('0x15'),_0x15ce1e);var _0x382f5b;if(moment()>moment(_0x15ce1e[_0xf29a('0x2b')])){_0x382f5b=moment()['add'](_0xe8375d||0x3,_0xf29a('0x2c'));}else{if(_0x15ce1e[_0xf29a('0x1e')]==0x0){_0x382f5b=moment(_0x15ce1e[_0xf29a('0x2b')]);}else{_0x382f5b=moment()[_0xf29a('0x2d')](_0xe8375d||0x3,_0xf29a('0x2c'));}}var _0x360779={'phone':_0x5cf180[_0xf29a('0x2e')],'active':0x0,'OrderBy':_[_0xf29a('0x2f')](_0x5cf180[_0xf29a('0x1e')])?0x0:_0x5cf180[_0xf29a('0x1e')],'scheduledat':moment()[_0xf29a('0x2d')](_0x38c060||0x1,_0xf29a('0x2c')),'countbusyretry':_0x36f0f3[_0xf29a('0x30')],'countcongestionretry':_0x36f0f3[_0xf29a('0x31')],'countnoanswerretry':_0x36f0f3[_0xf29a('0x20')],'countnosuchnumberretry':_0x36f0f3[_0xf29a('0x26')],'countdropretry':_0x36f0f3[_0xf29a('0x21')],'countabandonedretry':_0x36f0f3[_0xf29a('0x22')],'countmachineretry':_0x36f0f3[_0xf29a('0x23')],'countagentrejectretry':_0x36f0f3[_0xf29a('0x27')],'createdAt':_0x36f0f3['createdAt'],'updatedAt':_0x36f0f3['updatedAt']};var _0x90bd27={'CmHopperId':_0x5cf180['id'],'phone':_0x15ce1e[_0xf29a('0x2e')],'active':0x0,'OrderBy':_[_0xf29a('0x2f')](_0x15ce1e[_0xf29a('0x1e')])?0x0:_0x15ce1e[_0xf29a('0x1e')],'scheduledat':_0x382f5b,'countbusyretry':_0x15ce1e[_0xf29a('0x30')],'countcongestionretry':_0x15ce1e[_0xf29a('0x31')],'countnoanswerretry':_0x15ce1e[_0xf29a('0x20')],'countnosuchnumberretry':_0x36f0f3[_0xf29a('0x26')],'countdropretry':_0x36f0f3[_0xf29a('0x21')],'countabandonedretry':_0x36f0f3[_0xf29a('0x22')],'countmachineretry':_0x36f0f3[_0xf29a('0x23')],'countagentrejectretry':_0x36f0f3[_0xf29a('0x27')],'createdAt':_0x15ce1e[_0xf29a('0x32')],'updatedAt':_0x15ce1e[_0xf29a('0x33')]};logger[_0xf29a('0xa')](_0xf29a('0x34'),_0x360779);logger[_0xf29a('0xa')](_0xf29a('0x35'),_0x90bd27);return db[_0xf29a('0x36')][_0xf29a('0x37')](function(_0x2e3d62){return db['CmHopperAdditionalPhone'][_0xf29a('0x38')](_0x360779,{'where':{'id':_0x15ce1e['id']}},{'transaction':_0x2e3d62})[_0xf29a('0x9')](function(){return db[_0xf29a('0x16')][_0xf29a('0x38')](_0x90bd27,{'where':{'id':_0x5cf180['id']}},{'transaction':_0x2e3d62});});})[_0xf29a('0x9')](function(_0x56e16c){_0x41aa32({'id':_0x5cf180['id'],'phone':_0x15ce1e[_0xf29a('0x2e')]});})[_0xf29a('0x14')](function(_0x3fb4b4){logger['error']('VerifyAdditionalPhones',_0x3fb4b4['message'],req);_0x548345(_this[_0xf29a('0xf')](0x1f4,_0x3fb4b4[_0xf29a('0x12')]));});});}exports['IncrementPreviewCounters']=function(_0x5f0f1c){var _0x1a52fd=this;return new Promise(function(_0x14e2ab,_0x53c89c){return db[_0xf29a('0x16')][_0xf29a('0x38')](_0x5f0f1c['body']['field'],{'where':{'id':_0x5f0f1c['body']['id']}})[_0xf29a('0x9')](function(_0x277ac7){_0x14e2ab(_0x277ac7);})[_0xf29a('0x14')](function(_0x432935){logger[_0xf29a('0xf')](_0xf29a('0x39'),_0x432935['message'],_0x5f0f1c);_0x53c89c(_0x1a52fd[_0xf29a('0xf')](0x1f4,_0x432935[_0xf29a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index c7f63a3..926a5a6 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 _0x3be2=['Router','../../components/auth/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x24388a,_0x232d93){var _0x22f686=function(_0x5f5473){while(--_0x5f5473){_0x24388a['push'](_0x24388a['shift']());}};_0x22f686(++_0x232d93);}(_0x3be2,0x18d));var _0x23be=function(_0x5eecc3,_0x353e41){_0x5eecc3=_0x5eecc3-0x0;var _0x157680=_0x3be2[_0x5eecc3];return _0x157680;};'use strict';var multer=require(_0x23be('0x0'));var util=require('util');var path=require(_0x23be('0x1'));var timeout=require(_0x23be('0x2'));var express=require('express');var router=express[_0x23be('0x3')]();var auth=require(_0x23be('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x23be('0x5'));router[_0x23be('0x6')]('/',auth[_0x23be('0x7')](),controller['index']);router[_0x23be('0x6')](_0x23be('0x8'),auth[_0x23be('0x7')](),controller[_0x23be('0x9')]);router[_0x23be('0xa')]('/',auth[_0x23be('0x7')](),controller[_0x23be('0xb')]);router[_0x23be('0xc')]('/:id',auth[_0x23be('0x7')](),controller[_0x23be('0xd')]);router['delete']('/:id',auth[_0x23be('0x7')](),controller[_0x23be('0xe')]);module[_0x23be('0xf')]=router; \ No newline at end of file +var _0x56fe=['./cmHopperAdditionalPhone.controller','get','index','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x323ff6,_0x275552){var _0x57d776=function(_0x1dbaca){while(--_0x1dbaca){_0x323ff6['push'](_0x323ff6['shift']());}};_0x57d776(++_0x275552);}(_0x56fe,0xe4));var _0xe56f=function(_0x5f33ba,_0x3286ca){_0x5f33ba=_0x5f33ba-0x0;var _0x319e2d=_0x56fe[_0x5f33ba];return _0x319e2d;};'use strict';var multer=require(_0xe56f('0x0'));var util=require(_0xe56f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe56f('0x2'));var router=express[_0xe56f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe56f('0x4'));var config=require(_0xe56f('0x5'));var controller=require(_0xe56f('0x6'));router[_0xe56f('0x7')]('/',auth['isAuthenticated'](),controller[_0xe56f('0x8')]);router[_0xe56f('0x7')](_0xe56f('0x9'),auth['isAuthenticated'](),controller[_0xe56f('0xa')]);router[_0xe56f('0xb')]('/',auth[_0xe56f('0xc')](),controller[_0xe56f('0xd')]);router['put'](_0xe56f('0x9'),auth[_0xe56f('0xc')](),controller[_0xe56f('0xe')]);router[_0xe56f('0xf')]('/:id',auth[_0xe56f('0xc')](),controller[_0xe56f('0x10')]);module[_0xe56f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 88cbc1d..65a442c 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 _0x65ba=['sequelize','exports','INTEGER','contactListQueue','moment'];(function(_0x108ae5,_0x2650fd){var _0x58ea1f=function(_0x5a778a){while(--_0x5a778a){_0x108ae5['push'](_0x108ae5['shift']());}};_0x58ea1f(++_0x2650fd);}(_0x65ba,0x149));var _0xa65b=function(_0x16ff0e,_0x4e7dc6){_0x16ff0e=_0x16ff0e-0x0;var _0x95bd68=_0x65ba[_0x16ff0e];return _0x95bd68;};'use strict';var moment=require(_0xa65b('0x0'));var Sequelize=require(_0xa65b('0x1'));module[_0xa65b('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa65b('0x3')],'unique':_0xa65b('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa65b('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa65b('0x3')],'unique':_0xa65b('0x4')}}; \ No newline at end of file +var _0x61b7=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x4b6563,_0x3f3519){var _0x19222f=function(_0x30af7e){while(--_0x30af7e){_0x4b6563['push'](_0x4b6563['shift']());}};_0x19222f(++_0x3f3519);}(_0x61b7,0x9a));var _0x761b=function(_0x32677b,_0x132286){_0x32677b=_0x32677b-0x0;var _0x211f26=_0x61b7[_0x32677b];return _0x211f26;};'use strict';var moment=require(_0x761b('0x0'));var Sequelize=require('sequelize');module[_0x761b('0x1')]={'phone':{'type':Sequelize[_0x761b('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x761b('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x761b('0x4')},'VoiceQueueId':{'type':Sequelize[_0x761b('0x3')],'unique':_0x761b('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index cd1e055..9a4add3 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1fbd8f,_0x429bbb){var _0x13c30b=function(_0x2ff77e){while(--_0x2ff77e){_0x1fbd8f['push'](_0x1fbd8f['shift']());}};_0x13c30b(++_0x429bbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x13349f,_0xd7dafc){var _0x298242=function(_0x4df4ca){while(--_0x4df4ca){_0x13349f['push'](_0x13349f['shift']());}};_0x298242(++_0xd7dafc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 210a510..90c6561 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 _0x34e8=['cm_hopper_black','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack'];(function(_0x3b9a30,_0x2564e9){var _0xd6ddf0=function(_0x2b967f){while(--_0x2b967f){_0x3b9a30['push'](_0x3b9a30['shift']());}};_0xd6ddf0(++_0x2564e9);}(_0x34e8,0x12c));var _0x834e=function(_0x37890d,_0x5bd9d3){_0x37890d=_0x37890d-0x0;var _0x132039=_0x34e8[_0x37890d];return _0x132039;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','util'];(function(_0x459b7d,_0x2026a3){var _0x1a5c28=function(_0xf76242){while(--_0xf76242){_0x459b7d['push'](_0x459b7d['shift']());}};_0x1a5c28(++_0x2026a3);}(_0xedd9,0xfc));var _0x9edd=function(_0x56db5b,_0x35549a){_0x56db5b=_0x56db5b-0x0;var _0x4430e5=_0xedd9[_0x56db5b];return _0x4430e5;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 2868998..8799389 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 _0x83f2=['code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','stringify','DestroyCmHopperBlack','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error'];(function(_0x5894c0,_0x577c35){var _0x31f9aa=function(_0x56a1a8){while(--_0x56a1a8){_0x5894c0['push'](_0x5894c0['shift']());}};_0x31f9aa(++_0x577c35);}(_0x83f2,0x117));var _0x283f=function(_0x5e112f,_0x361e47){_0x5e112f=_0x5e112f-0x0;var _0x45d990=_0x83f2[_0x5e112f];return _0x45d990;};'use strict';var _=require(_0x283f('0x0'));var util=require(_0x283f('0x1'));var moment=require('moment');var BPromise=require(_0x283f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x283f('0x3'));var db=require(_0x283f('0x4'))['db'];var utils=require(_0x283f('0x5'));var logger=require('../../config/logger')(_0x283f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x283f('0x7')][_0x283f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23ab8e,_0x3699f7,_0x15d61a){return new BPromise(function(_0x1ba217,_0x4ce28b){return client[_0x283f('0x9')](_0x23ab8e,_0x15d61a)[_0x283f('0xa')](function(_0x35acd){logger[_0x283f('0xb')](_0x283f('0xc'),_0x3699f7,_0x283f('0xd'));logger[_0x283f('0xe')](_0x283f('0xf'),_0x3699f7,_0x283f('0xd'),JSON['stringify'](_0x35acd));if(_0x35acd[_0x283f('0x10')]){if(_0x35acd[_0x283f('0x10')][_0x283f('0x11')]===0x1f4){logger[_0x283f('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3699f7,_0x35acd[_0x283f('0x10')][_0x283f('0x12')]);return _0x4ce28b(_0x35acd[_0x283f('0x10')][_0x283f('0x12')]);}logger[_0x283f('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3699f7,_0x35acd['error'][_0x283f('0x12')]);return _0x1ba217(_0x35acd['error']['message']);}else{logger[_0x283f('0xb')](_0x283f('0xc'),_0x3699f7,_0x283f('0xd'));_0x1ba217(_0x35acd[_0x283f('0x13')][_0x283f('0x12')]);}})[_0x283f('0x14')](function(_0xbf76bd){logger[_0x283f('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3699f7,_0xbf76bd);_0x4ce28b(_0xbf76bd);});});}exports[_0x283f('0x15')]=function(_0x3d536b){var _0x17eb18=this;return new Promise(function(_0x30ffc8,_0xf8fc9c){return db[_0x283f('0x16')][_0x283f('0x17')]({'raw':_0x3d536b[_0x283f('0x18')]?_0x3d536b[_0x283f('0x18')][_0x283f('0x19')]===undefined?!![]:![]:!![],'where':_0x3d536b['options']?_0x3d536b['options'][_0x283f('0x1a')]||null:null,'attributes':_0x3d536b['options']?_0x3d536b[_0x283f('0x18')][_0x283f('0x1b')]||null:null,'limit':_0x3d536b[_0x283f('0x18')]?_0x3d536b['options'][_0x283f('0x1c')]||null:null,'include':_0x3d536b[_0x283f('0x18')]?_0x3d536b['options'][_0x283f('0x1d')]?_[_0x283f('0x1e')](_0x3d536b['options'][_0x283f('0x1d')],function(_0x358072){return{'model':db[_0x358072[_0x283f('0x1f')]],'as':_0x358072['as'],'attributes':_0x358072[_0x283f('0x1b')],'include':_0x358072[_0x283f('0x1d')]?_[_0x283f('0x1e')](_0x358072[_0x283f('0x1d')],function(_0x2291eb){return{'model':db[_0x2291eb[_0x283f('0x1f')]],'as':_0x2291eb['as'],'attributes':_0x2291eb[_0x283f('0x1b')],'include':_0x2291eb['include']?_[_0x283f('0x1e')](_0x2291eb[_0x283f('0x1d')],function(_0x3a42e4){return{'model':db[_0x3a42e4['model']],'as':_0x3a42e4['as'],'attributes':_0x3a42e4['attributes']};}):[]};}):[]};}):[]:[]})[_0x283f('0xa')](function(_0x3546d3){logger[_0x283f('0xb')]('GetCmHopperBlack',_0x3d536b);logger[_0x283f('0xe')](_0x283f('0x15'),_0x3d536b,JSON['stringify'](_0x3546d3));_0x30ffc8(_0x3546d3);})[_0x283f('0x14')](function(_0x37850d){logger[_0x283f('0x10')](_0x283f('0x15'),_0x37850d[_0x283f('0x12')],_0x3d536b);_0xf8fc9c(_0x17eb18[_0x283f('0x10')](0x1f4,_0x37850d['message']));});});};exports[_0x283f('0x20')]=function(_0x4a555b){var _0x54a66a=this;return new Promise(function(_0x57db9f,_0x3f439b){return db[_0x283f('0x16')][_0x283f('0x21')](_0x4a555b[_0x283f('0x22')],{'raw':_0x4a555b[_0x283f('0x18')]?_0x4a555b[_0x283f('0x18')][_0x283f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a555b[_0x283f('0x18')]?_0x4a555b['options']['where']||null:null,'attributes':_0x4a555b['options']?_0x4a555b[_0x283f('0x18')][_0x283f('0x1b')]||null:null,'limit':_0x4a555b[_0x283f('0x18')]?_0x4a555b[_0x283f('0x18')][_0x283f('0x1c')]||null:null})[_0x283f('0xa')](function(_0x1932f5){logger[_0x283f('0xb')](_0x283f('0x20'),_0x4a555b);logger[_0x283f('0xe')]('UpdateCmHopperBlack',_0x4a555b,JSON[_0x283f('0x23')](_0x1932f5));_0x57db9f(_0x1932f5);})['catch'](function(_0x38a46e){logger[_0x283f('0x10')](_0x283f('0x20'),_0x38a46e[_0x283f('0x12')],_0x4a555b);_0x3f439b(_0x54a66a[_0x283f('0x10')](0x1f4,_0x38a46e[_0x283f('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x8990d0){var _0x1c33cb=this;return new Promise(function(_0x2e6edc,_0xa793cf){return db[_0x283f('0x16')]['destroy']({'where':_0x8990d0['options']?_0x8990d0[_0x283f('0x18')]['where']||null:null})[_0x283f('0xa')](function(_0x48e7aa){logger['info'](_0x283f('0x24'),_0x8990d0);logger[_0x283f('0xe')](_0x283f('0x24'),_0x8990d0,JSON[_0x283f('0x23')](_0x48e7aa));_0x2e6edc(_0x48e7aa);})[_0x283f('0x14')](function(_0x154ea1){logger[_0x283f('0x10')](_0x283f('0x24'),_0x154ea1[_0x283f('0x12')],_0x8990d0);_0xa793cf(_0x1c33cb[_0x283f('0x10')](0x1f4,_0x154ea1[_0x283f('0x12')]));});});}; \ No newline at end of file +var _0x3395=['result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','UpdateCmHopperBlack','update','where','then','info','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x273f6b,_0x5c49df){var _0x16a4da=function(_0xd31fa2){while(--_0xd31fa2){_0x273f6b['push'](_0x273f6b['shift']());}};_0x16a4da(++_0x5c49df);}(_0x3395,0x8b));var _0x5339=function(_0x474cfa,_0x497bc8){_0x474cfa=_0x474cfa-0x0;var _0x50894a=_0x3395[_0x474cfa];return _0x50894a;};'use strict';var _=require(_0x5339('0x0'));var util=require(_0x5339('0x1'));var moment=require(_0x5339('0x2'));var BPromise=require(_0x5339('0x3'));var rs=require(_0x5339('0x4'));var fs=require('fs');var Redis=require(_0x5339('0x5'));var db=require(_0x5339('0x6'))['db'];var utils=require(_0x5339('0x7'));var logger=require('../../config/logger')(_0x5339('0x8'));var config=require(_0x5339('0x9'));var jayson=require(_0x5339('0xa'));var client=jayson[_0x5339('0xb')][_0x5339('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54a444,_0x10dbb8,_0x5f13ca){return new BPromise(function(_0x51e50c,_0x1718f6){return client[_0x5339('0xd')](_0x54a444,_0x5f13ca)['then'](function(_0x2dd1bf){logger['info'](_0x5339('0xe'),_0x10dbb8,_0x5339('0xf'));logger[_0x5339('0x10')](_0x5339('0x11'),_0x10dbb8,_0x5339('0xf'),JSON[_0x5339('0x12')](_0x2dd1bf));if(_0x2dd1bf['error']){if(_0x2dd1bf[_0x5339('0x13')]['code']===0x1f4){logger[_0x5339('0x13')](_0x5339('0xe'),_0x10dbb8,_0x2dd1bf['error'][_0x5339('0x14')]);return _0x1718f6(_0x2dd1bf[_0x5339('0x13')][_0x5339('0x14')]);}logger[_0x5339('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x10dbb8,_0x2dd1bf[_0x5339('0x13')][_0x5339('0x14')]);return _0x51e50c(_0x2dd1bf[_0x5339('0x13')][_0x5339('0x14')]);}else{logger['info'](_0x5339('0xe'),_0x10dbb8,'request\x20sent');_0x51e50c(_0x2dd1bf[_0x5339('0x15')][_0x5339('0x14')]);}})[_0x5339('0x16')](function(_0x425181){logger[_0x5339('0x13')](_0x5339('0xe'),_0x10dbb8,_0x425181);_0x1718f6(_0x425181);});});}exports[_0x5339('0x17')]=function(_0x40b554){var _0x5ad27f=this;return new Promise(function(_0x5b67eb,_0x584f7a){return db[_0x5339('0x18')][_0x5339('0x19')]({'raw':_0x40b554['options']?_0x40b554[_0x5339('0x1a')][_0x5339('0x1b')]===undefined?!![]:![]:!![],'where':_0x40b554[_0x5339('0x1a')]?_0x40b554[_0x5339('0x1a')]['where']||null:null,'attributes':_0x40b554[_0x5339('0x1a')]?_0x40b554[_0x5339('0x1a')][_0x5339('0x1c')]||null:null,'limit':_0x40b554[_0x5339('0x1a')]?_0x40b554['options'][_0x5339('0x1d')]||null:null,'include':_0x40b554[_0x5339('0x1a')]?_0x40b554['options'][_0x5339('0x1e')]?_[_0x5339('0x1f')](_0x40b554[_0x5339('0x1a')][_0x5339('0x1e')],function(_0x189ddb){return{'model':db[_0x189ddb['model']],'as':_0x189ddb['as'],'attributes':_0x189ddb['attributes'],'include':_0x189ddb[_0x5339('0x1e')]?_[_0x5339('0x1f')](_0x189ddb['include'],function(_0x2795d8){return{'model':db[_0x2795d8[_0x5339('0x20')]],'as':_0x2795d8['as'],'attributes':_0x2795d8[_0x5339('0x1c')],'include':_0x2795d8[_0x5339('0x1e')]?_['map'](_0x2795d8['include'],function(_0x17a13d){return{'model':db[_0x17a13d[_0x5339('0x20')]],'as':_0x17a13d['as'],'attributes':_0x17a13d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b5f2e){logger['info'](_0x5339('0x17'),_0x40b554);logger[_0x5339('0x10')](_0x5339('0x17'),_0x40b554,JSON['stringify'](_0x4b5f2e));_0x5b67eb(_0x4b5f2e);})[_0x5339('0x16')](function(_0xe0fe16){logger[_0x5339('0x13')](_0x5339('0x17'),_0xe0fe16[_0x5339('0x14')],_0x40b554);_0x584f7a(_0x5ad27f[_0x5339('0x13')](0x1f4,_0xe0fe16[_0x5339('0x14')]));});});};exports[_0x5339('0x21')]=function(_0x4f91d5){var _0x5d1602=this;return new Promise(function(_0x2f4386,_0x5c36bf){return db['CmHopperBlack'][_0x5339('0x22')](_0x4f91d5['body'],{'raw':_0x4f91d5[_0x5339('0x1a')]?_0x4f91d5[_0x5339('0x1a')][_0x5339('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f91d5[_0x5339('0x1a')]?_0x4f91d5[_0x5339('0x1a')][_0x5339('0x23')]||null:null,'attributes':_0x4f91d5[_0x5339('0x1a')]?_0x4f91d5[_0x5339('0x1a')][_0x5339('0x1c')]||null:null,'limit':_0x4f91d5[_0x5339('0x1a')]?_0x4f91d5[_0x5339('0x1a')][_0x5339('0x1d')]||null:null})[_0x5339('0x24')](function(_0x536494){logger[_0x5339('0x25')](_0x5339('0x21'),_0x4f91d5);logger[_0x5339('0x10')](_0x5339('0x21'),_0x4f91d5,JSON[_0x5339('0x12')](_0x536494));_0x2f4386(_0x536494);})[_0x5339('0x16')](function(_0x280619){logger['error'](_0x5339('0x21'),_0x280619[_0x5339('0x14')],_0x4f91d5);_0x5c36bf(_0x5d1602[_0x5339('0x13')](0x1f4,_0x280619[_0x5339('0x14')]));});});};exports[_0x5339('0x26')]=function(_0x1b8f5d){var _0x33fadc=this;return new Promise(function(_0x551b06,_0xf68c1d){return db['CmHopperBlack'][_0x5339('0x27')]({'where':_0x1b8f5d[_0x5339('0x1a')]?_0x1b8f5d[_0x5339('0x1a')][_0x5339('0x23')]||null:null})[_0x5339('0x24')](function(_0x234543){logger[_0x5339('0x25')](_0x5339('0x26'),_0x1b8f5d);logger['debug'](_0x5339('0x26'),_0x1b8f5d,JSON[_0x5339('0x12')](_0x234543));_0x551b06(_0x234543);})[_0x5339('0x16')](function(_0x3138ee){logger[_0x5339('0x13')](_0x5339('0x26'),_0x3138ee['message'],_0x1b8f5d);_0xf68c1d(_0x33fadc[_0x5339('0x13')](0x1f4,_0x3138ee[_0x5339('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 24941e7..feb9c16 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 _0xd2ea=['isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x3b757f,_0x2ef4e3){var _0x1a8a72=function(_0x1986ff){while(--_0x1986ff){_0x3b757f['push'](_0x3b757f['shift']());}};_0x1a8a72(++_0x2ef4e3);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5d0f5e,_0x3e15c8){_0x5d0f5e=_0x5d0f5e-0x0;var _0x556ddd=_0xd2ea[_0x5d0f5e];return _0x556ddd;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var auth=require(_0xad2e('0x5'));var interaction=require(_0xad2e('0x6'));var config=require(_0xad2e('0x7'));var controller=require(_0xad2e('0x8'));router[_0xad2e('0x9')]('/',auth[_0xad2e('0xa')](),controller[_0xad2e('0xb')]);router['get'](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller[_0xad2e('0xd')]);router['get'](_0xad2e('0xe'),auth[_0xad2e('0xa')](),controller['show']);router[_0xad2e('0xf')]('/:id',auth[_0xad2e('0xa')](),controller[_0xad2e('0x10')]);router[_0xad2e('0x11')](_0xad2e('0xe'),auth['isAuthenticated'](),controller[_0xad2e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x24ca=['describe','/:id','show','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x1b8134,_0x57d4fa){var _0x57b230=function(_0x24d97c){while(--_0x24d97c){_0x1b8134['push'](_0x1b8134['shift']());}};_0x57b230(++_0x57d4fa);}(_0x24ca,0x1bc));var _0xa24c=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x24ca[_0x37c07d];return _0x10dadc;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x11')]);module[_0xa24c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f8f5786..aa8276e 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 _0x8d4e=['endtime','followuptime','seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0xf5802e,_0x346340){var _0x55133d=function(_0x306b00){while(--_0x306b00){_0xf5802e['push'](_0xf5802e['shift']());}};_0x55133d(++_0x346340);}(_0x8d4e,0x165));var _0xe8d4=function(_0x157ce2,_0x2365a3){_0x157ce2=_0x157ce2-0x0;var _0x333d76=_0x8d4e[_0x157ce2];return _0x333d76;};'use strict';var Sequelize=require(_0xe8d4('0x0'));var moment=require(_0xe8d4('0x1'));module[_0xe8d4('0x2')]={'state':{'type':Sequelize[_0xe8d4('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xe8d4('0x4')]},'scheduledat':{'type':Sequelize[_0xe8d4('0x5')]},'countbusyretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xe8d4('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe8d4('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe8d4('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe8d4('0x5')]},'answertime':{'type':Sequelize[_0xe8d4('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xe8d4('0x4')]},'campaigntype':{'type':Sequelize[_0xe8d4('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xe8d4('0x5')],'set':function(_0x5b14ee){var _0x193939=this[_0xe8d4('0x6')](_0xe8d4('0x7'));if(_0x193939&&_0x5b14ee){this['setDataValue'](_0xe8d4('0x8'),moment(_0x5b14ee)['diff'](moment(_0x193939),_0xe8d4('0x9')));}return this[_0xe8d4('0xa')](_0xe8d4('0xb'),_0x5b14ee);}},'amd':{'type':Sequelize[_0xe8d4('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe8d4('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe8d4('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe8d4('0x5')]},'callback':{'type':Sequelize[_0xe8d4('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe8d4('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe8d4('0x5')]},'deleted':{'type':Sequelize[_0xe8d4('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe8d4('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe8d4('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1d7=['INTEGER','DATE','STRING','getDataValue','endtime','followuptime','diff','seconds','setDataValue','BOOLEAN','sequelize','moment','exports'];(function(_0x233b2e,_0x3d6545){var _0x1ebf69=function(_0x5817e2){while(--_0x5817e2){_0x233b2e['push'](_0x233b2e['shift']());}};_0x1ebf69(++_0x3d6545);}(_0xb1d7,0x14f));var _0x7b1d=function(_0x8bca6f,_0x552d7d){_0x8bca6f=_0x8bca6f-0x0;var _0x11640d=_0xb1d7[_0x8bca6f];return _0x11640d;};'use strict';var Sequelize=require(_0x7b1d('0x0'));var moment=require(_0x7b1d('0x1'));module[_0x7b1d('0x2')]={'state':{'type':Sequelize[_0x7b1d('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x7b1d('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7b1d('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x7b1d('0x5')]},'calleridnum':{'type':Sequelize[_0x7b1d('0x5')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7b1d('0x4')]},'responsetime':{'type':Sequelize[_0x7b1d('0x4')]},'answertime':{'type':Sequelize[_0x7b1d('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7b1d('0x4')]},'ringtime':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x7b1d('0x5')]},'campaigntype':{'type':Sequelize[_0x7b1d('0x5')]},'membername':{'type':Sequelize[_0x7b1d('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x7b1d('0x5')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5461e3){var _0x4e7890=this[_0x7b1d('0x6')](_0x7b1d('0x7'));if(_0x4e7890&&_0x5461e3){this['setDataValue'](_0x7b1d('0x8'),moment(_0x5461e3)[_0x7b1d('0x9')](moment(_0x4e7890),_0x7b1d('0xa')));}return this[_0x7b1d('0xb')]('dispositionat',_0x5461e3);}},'amd':{'type':Sequelize[_0x7b1d('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7b1d('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7b1d('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7b1d('0x4')]},'callback':{'type':Sequelize[_0x7b1d('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7b1d('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7b1d('0x4')]},'deleted':{'type':Sequelize[_0x7b1d('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7b1d('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7b1d('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 57e1c43..d1b438e 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 _0x082a=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','rows','catch','show','params','intersection','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','sequelize','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','fromQuery','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','offset','limit','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes'];(function(_0x17e78b,_0x2431b3){var _0x1062b4=function(_0x585802){while(--_0x585802){_0x17e78b['push'](_0x17e78b['shift']());}};_0x1062b4(++_0x2431b3);}(_0x082a,0x154));var _0xa082=function(_0x187290,_0x109d7b){_0x187290=_0x187290-0x0;var _0x5bb0c0=_0x082a[_0x187290];return _0x5bb0c0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa082('0x0'));var rimraf=require(_0xa082('0x1'));var zipdir=require(_0xa082('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa082('0x3'));var moment=require(_0xa082('0x4'));var BPromise=require(_0xa082('0x5'));var Mustache=require(_0xa082('0x6'));var util=require(_0xa082('0x7'));var path=require('path');var sox=require(_0xa082('0x8'));var csv=require('to-csv');var ejs=require(_0xa082('0x9'));var fs=require('fs');var _=require(_0xa082('0xa'));var squel=require('squel');var crypto=require(_0xa082('0xb'));var jsforce=require(_0xa082('0xc'));var deskjs=require(_0xa082('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa082('0xe'));var Papa=require(_0xa082('0xf'));var Redis=require(_0xa082('0x10'));var authService=require(_0xa082('0x11'));var qs=require(_0xa082('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa082('0x13'));var logger=require(_0xa082('0x14'))(_0xa082('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa082('0x16'))['db'];function respondWithStatusCode(_0x18d742,_0x473b1d){_0x473b1d=_0x473b1d||0xcc;return function(_0x2f6591){if(_0x2f6591){return _0x18d742['sendStatus'](_0x473b1d);}return _0x18d742[_0xa082('0x17')](_0x473b1d)[_0xa082('0x18')]();};}function respondWithResult(_0xe0276,_0x23bd57){_0x23bd57=_0x23bd57||0xc8;return function(_0x867ef4){if(_0x867ef4){return _0xe0276[_0xa082('0x17')](_0x23bd57)['json'](_0x867ef4);}};}function respondWithFilteredResult(_0xc56d7,_0x1eb38a){return function(_0x5cce12){if(_0x5cce12){var _0x20b6f8=_0x5cce12['count'],_0x13b93f=_0x1eb38a['offset'],_0x32cb5a=_0x1eb38a[_0xa082('0x19')]+_0x1eb38a[_0xa082('0x1a')],_0x3766fa;if(_0x32cb5a>=_0x20b6f8){_0x32cb5a=_0x20b6f8;_0x3766fa=0xc8;}else{_0x3766fa=0xce;}_0xc56d7['status'](_0x3766fa);return _0xc56d7[_0xa082('0x1b')]('Content-Range',_0x13b93f+'-'+_0x32cb5a+'/'+_0x20b6f8)[_0xa082('0x1c')](_0x5cce12);}return null;};}function patchUpdates(_0x284376){return function(_0x127b29){try{jsonpatch[_0xa082('0x1d')](_0x127b29,_0x284376,!![]);}catch(_0x58b29f){return BPromise[_0xa082('0x1e')](_0x58b29f);}return _0x127b29[_0xa082('0x1f')]();};}function saveUpdates(_0x48f656,_0x24befc){return function(_0x8904c7){if(_0x8904c7){return _0x8904c7[_0xa082('0x20')](_0x48f656)[_0xa082('0x21')](function(_0x50a196){return _0x50a196;});}return null;};}function removeEntity(_0x1be195,_0x56eb67){return function(_0x1a10ba){if(_0x1a10ba){return _0x1a10ba[_0xa082('0x22')]()['then'](function(){_0x1be195[_0xa082('0x17')](0xcc)[_0xa082('0x18')]();});}};}function handleEntityNotFound(_0x4fdc57,_0x505d27){return function(_0x36eded){if(!_0x36eded){_0x4fdc57[_0xa082('0x23')](0x194);}return _0x36eded;};}function handleError(_0x29d1db,_0x313a26){_0x313a26=_0x313a26||0x1f4;return function(_0x425b5d){logger[_0xa082('0x24')](_0x425b5d[_0xa082('0x25')]);if(_0x425b5d[_0xa082('0x26')]){delete _0x425b5d[_0xa082('0x26')];}_0x29d1db[_0xa082('0x17')](_0x313a26)[_0xa082('0x27')](_0x425b5d);};}exports[_0xa082('0x28')]=function(_0x3032d2,_0x2d6170){var _0x21730e={},_0x3e604e={},_0x3e9115={'count':0x0,'rows':[]};var _0x3e4971=_[_0xa082('0x29')](db[_0xa082('0x2a')][_0xa082('0x2b')],function(_0x3369ae){return{'name':_0x3369ae[_0xa082('0x2c')],'type':_0x3369ae[_0xa082('0x2d')][_0xa082('0x2e')]};});_0x3e604e[_0xa082('0x2f')]=_['map'](_0x3e4971,_0xa082('0x26'));_0x3e604e[_0xa082('0x30')]=_[_0xa082('0x31')](_0x3032d2[_0xa082('0x30')]);_0x3e604e[_0xa082('0x32')]=_['intersection'](_0x3e604e[_0xa082('0x2f')],_0x3e604e[_0xa082('0x30')]);_0x21730e['attributes']=_['intersection'](_0x3e604e['model'],qs[_0xa082('0x33')](_0x3032d2[_0xa082('0x30')][_0xa082('0x33')]));_0x21730e[_0xa082('0x34')]=_0x21730e[_0xa082('0x34')][_0xa082('0x35')]?_0x21730e[_0xa082('0x34')]:_0x3e604e[_0xa082('0x2f')];if(!_0x3032d2[_0xa082('0x30')][_0xa082('0x36')](_0xa082('0x37'))){_0x21730e[_0xa082('0x1a')]=qs[_0xa082('0x1a')](_0x3032d2['query']['limit']);_0x21730e['offset']=qs[_0xa082('0x19')](_0x3032d2[_0xa082('0x30')][_0xa082('0x19')]);}_0x21730e['order']=qs['sort'](_0x3032d2[_0xa082('0x30')][_0xa082('0x38')]);_0x21730e[_0xa082('0x39')]=qs['filters'](_[_0xa082('0x3a')](_0x3032d2['query'],_0x3e604e[_0xa082('0x32')]),_0x3e4971);if(_0x3032d2[_0xa082('0x30')]['filter']){_0x21730e[_0xa082('0x39')]=_[_0xa082('0x3b')](_0x21730e['where'],{'$or':_[_0xa082('0x29')](_0x3e4971,function(_0x4afed7){if(_0x4afed7[_0xa082('0x2d')]!==_0xa082('0x3c')){var _0x32b1ae={};_0x32b1ae[_0x4afed7[_0xa082('0x26')]]={'$like':'%'+_0x3032d2[_0xa082('0x30')][_0xa082('0x3d')]+'%'};return _0x32b1ae;}})});}_0x21730e=_[_0xa082('0x3b')]({},_0x21730e,_0x3032d2['options']);var _0xa942c9={'where':_0x21730e[_0xa082('0x39')]};return db[_0xa082('0x2a')][_0xa082('0x3e')](_0xa942c9)[_0xa082('0x21')](function(_0x1a2286){_0x3e9115[_0xa082('0x3e')]=_0x1a2286;if(_0x3032d2['query'][_0xa082('0x3f')]){_0x21730e['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x21730e);})[_0xa082('0x21')](function(_0x26bc65){_0x3e9115[_0xa082('0x40')]=_0x26bc65;return _0x3e9115;})['then'](respondWithFilteredResult(_0x2d6170,_0x21730e))[_0xa082('0x41')](handleError(_0x2d6170,null));};exports[_0xa082('0x42')]=function(_0x3438a7,_0x4db21b){var _0x54e284={'raw':!![],'where':{'id':_0x3438a7[_0xa082('0x43')]['id']}},_0x3a4d82={};_0x3a4d82[_0xa082('0x2f')]=_[_0xa082('0x31')](db[_0xa082('0x2a')][_0xa082('0x2b')]);_0x3a4d82[_0xa082('0x30')]=_[_0xa082('0x31')](_0x3438a7['query']);_0x3a4d82[_0xa082('0x32')]=_[_0xa082('0x44')](_0x3a4d82[_0xa082('0x2f')],_0x3a4d82[_0xa082('0x30')]);_0x54e284[_0xa082('0x34')]=_[_0xa082('0x44')](_0x3a4d82[_0xa082('0x2f')],qs[_0xa082('0x33')](_0x3438a7[_0xa082('0x30')]['fields']));_0x54e284[_0xa082('0x34')]=_0x54e284[_0xa082('0x34')][_0xa082('0x35')]?_0x54e284['attributes']:_0x3a4d82[_0xa082('0x2f')];if(_0x3438a7[_0xa082('0x30')][_0xa082('0x3f')]){_0x54e284['include']=[{'all':!![]}];}_0x54e284=_[_0xa082('0x3b')]({},_0x54e284,_0x3438a7[_0xa082('0x45')]);return db[_0xa082('0x2a')][_0xa082('0x46')](_0x54e284)[_0xa082('0x21')](handleEntityNotFound(_0x4db21b,null))['then'](respondWithResult(_0x4db21b,null))['catch'](handleError(_0x4db21b,null));};exports[_0xa082('0x47')]=function(_0x44bb00,_0x49ae44){return db[_0xa082('0x2a')]['describe']()['then'](respondWithResult(_0x49ae44,null))['catch'](handleError(_0x49ae44,null));};exports[_0xa082('0x20')]=function(_0x3003e9,_0x2d554a){if(_0x3003e9[_0xa082('0x48')]['uniqueid']){delete _0x3003e9[_0xa082('0x48')][_0xa082('0x49')];}return db[_0xa082('0x2a')][_0xa082('0x46')]({'where':{'uniqueid':_0x3003e9[_0xa082('0x43')]['id']}})[_0xa082('0x21')](handleEntityNotFound(_0x2d554a,null))[_0xa082('0x21')](saveUpdates(_0x3003e9[_0xa082('0x48')],null))[_0xa082('0x21')](respondWithResult(_0x2d554a,null))[_0xa082('0x41')](handleError(_0x2d554a,null));};exports[_0xa082('0x4a')]=function(_0x2b1092,_0x3ef24a,_0x12c21d){return db[_0xa082('0x2a')][_0xa082('0x4b')]({'raw':![],'where':{'VoiceQueueId':_0x2b1092[_0xa082('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xa082('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xa082('0x4d')](_0xa082('0x4e')))),_0xa082('0x4f')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x51')))),_0xa082('0x52')],[db[_0xa082('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa082('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),_0xa082('0x53')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db['sequelize']['fn']('IF',db[_0xa082('0x50')][_0xa082('0x4d')](_0xa082('0x54')))),_0xa082('0x55')],[db['sequelize']['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x56')))),_0xa082('0x57')],[db['sequelize']['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')][_0xa082('0x4d')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa082('0x58')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x59')))),_0xa082('0x5a')],[db[_0xa082('0x50')]['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x5b')))),_0xa082('0x5c')]]})['then'](handleEntityNotFound(_0x3ef24a,null))[_0xa082('0x21')](respondWithResult(_0x3ef24a,null))[_0xa082('0x41')](handleError(_0x3ef24a,null));};exports[_0xa082('0x5d')]=function(_0x26fb84,_0x432fd4,_0x9825d5){return db['CmHopperFinal'][_0xa082('0x4b')]({'raw':![],'where':{'CampaignId':_0x26fb84[_0xa082('0x43')]['id']},'attributes':[[db[_0xa082('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x4e')))),'noSuchContacts'],[db[_0xa082('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa082('0x51')))),'noAnswerContacts'],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x5e')))),_0xa082('0x53')],[db[_0xa082('0x50')]['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x54')))),_0xa082('0x55')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db['sequelize'][_0xa082('0x4d')](_0xa082('0x56')))),_0xa082('0x57')],[db['sequelize']['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')][_0xa082('0x4d')](_0xa082('0x5f')))),_0xa082('0x58')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x59')))),_0xa082('0x5a')],[db[_0xa082('0x50')]['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db['sequelize'][_0xa082('0x4d')](_0xa082('0x5b')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x432fd4,null))[_0xa082('0x21')](respondWithResult(_0x432fd4,null))[_0xa082('0x41')](handleError(_0x432fd4,null));};exports[_0xa082('0x60')]=function(_0x3bd4a0,_0xd5345e,_0x3cf75c){return db['VoiceQueue'][_0xa082('0x46')]({'where':{'id':_0x3bd4a0['params']['id']}})['then'](handleEntityNotFound(_0xd5345e,null))['then'](function(_0x963bed){var _0x205b31;if(_0x963bed){_0x205b31=squel[_0xa082('0x61')]()[_0xa082('0x62')](_0xa082('0x63'))['fromQuery']([_0xa082('0x64'),_0xa082('0x65'),_0xa082('0x66'),_0xa082('0x67'),_0xa082('0x68'),_0xa082('0x69'),_0xa082('0x6a')],squel[_0xa082('0x6b')]()[_0xa082('0x6c')](_0xa082('0x6d'),_0xa082('0x64'))[_0xa082('0x6c')](_0xa082('0x6e'),'scheduledAt')[_0xa082('0x6c')](_0xa082('0x6f'),'ContactId')[_0xa082('0x6c')](_0xa082('0x70'),_0xa082('0x67'))[_0xa082('0x6c')](_0xa082('0x71'),_0xa082('0x68'))[_0xa082('0x6c')](_0xa082('0x6e'),'createdAt')['field'](_0xa082('0x6e'),'updatedAt')['from'](_0xa082('0x72'))[_0xa082('0x39')](_0xa082('0x73'),_0x3bd4a0[_0xa082('0x43')]['id'][_0xa082('0x74')]())[_0xa082('0x39')]('state\x20=\x20?',_0x3bd4a0[_0xa082('0x48')][_0xa082('0x75')][_0xa082('0x74')]())[_0xa082('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xa082('0x39')](_0xa082('0x76'),squel[_0xa082('0x6b')]()['field'](_0xa082('0x64'))[_0xa082('0x77')]('cm_hopper')['where'](_0xa082('0x73'),_0x3bd4a0[_0xa082('0x43')]['id'][_0xa082('0x74')]()))[_0xa082('0x39')](_0xa082('0x76'),squel[_0xa082('0x6b')]()[_0xa082('0x6c')](_0xa082('0x78'))[_0xa082('0x77')]('cm_hopper_final')[_0xa082('0x39')](_0xa082('0x73'),_0x3bd4a0['params']['id'][_0xa082('0x74')]())[_0xa082('0x39')](_0xa082('0x79')))[_0xa082('0x7a')]('ContactId'))['toString']();return db[_0xa082('0x50')][_0xa082('0x30')](_0x205b31);}return[];})['then'](respondWithResult(_0xd5345e,null))[_0xa082('0x41')](handleError(_0xd5345e,null));};exports[_0xa082('0x7b')]=function(_0x2551ad,_0x3e6bf4,_0x162b0b){return db['Campaign'][_0xa082('0x46')]({'where':{'id':_0x2551ad[_0xa082('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e6bf4,null))['then'](function(_0x536369){var _0x48e0c0;if(_0x536369){_0x48e0c0=squel[_0xa082('0x61')]()[_0xa082('0x62')](_0xa082('0x63'))[_0xa082('0x7c')]([_0xa082('0x64'),'scheduledAt',_0xa082('0x66'),_0xa082('0x67'),_0xa082('0x7d'),_0xa082('0x69'),_0xa082('0x6a')],squel['select']()[_0xa082('0x6c')](_0xa082('0x6d'),'phone')[_0xa082('0x6c')]('NOW()','scheduledAt')[_0xa082('0x6c')](_0xa082('0x6f'),_0xa082('0x66'))[_0xa082('0x6c')](_0xa082('0x70'),_0xa082('0x67'))[_0xa082('0x6c')]('ANY_VALUE(CampaignId)',_0xa082('0x7d'))[_0xa082('0x6c')](_0xa082('0x6e'),_0xa082('0x69'))[_0xa082('0x6c')](_0xa082('0x6e'),'updatedAt')[_0xa082('0x77')](_0xa082('0x72'))[_0xa082('0x39')](_0xa082('0x7e'),_0x2551ad[_0xa082('0x43')]['id']['toString']())[_0xa082('0x39')](_0xa082('0x7f'),_0x2551ad[_0xa082('0x48')]['state'][_0xa082('0x74')]())[_0xa082('0x39')](_0xa082('0x80'))[_0xa082('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa082('0x6b')]()['field']('phone')['from'](_0xa082('0x63'))[_0xa082('0x39')](_0xa082('0x7e'),_0x2551ad[_0xa082('0x43')]['id'][_0xa082('0x74')]()))[_0xa082('0x39')](_0xa082('0x76'),squel['select']()[_0xa082('0x6c')](_0xa082('0x78'))[_0xa082('0x77')](_0xa082('0x72'))['where'](_0xa082('0x7e'),_0x2551ad[_0xa082('0x43')]['id'][_0xa082('0x74')]())[_0xa082('0x39')](_0xa082('0x79')))[_0xa082('0x7a')](_0xa082('0x66')))[_0xa082('0x74')]();return db[_0xa082('0x50')][_0xa082('0x30')](_0x48e0c0);}return[];})[_0xa082('0x21')](respondWithResult(_0x3e6bf4,null))['catch'](handleError(_0x3e6bf4,null));};exports[_0xa082('0x81')]=function(_0x4e5a65,_0xfe7fd6,_0xd1cdbb){return db[_0xa082('0x82')]['findOne']({'where':{'VoiceQueueId':_0x4e5a65['body'][_0xa082('0x68')],'CampaignId':_0x4e5a65[_0xa082('0x48')][_0xa082('0x7d')],'ContactId':_0x4e5a65[_0xa082('0x48')][_0xa082('0x66')]}})[_0xa082('0x21')](handleEntityNotFound(_0xfe7fd6,null))[_0xa082('0x21')](function(_0x82f5fc){if(_0x82f5fc){return _0x82f5fc;}return null;})[_0xa082('0x21')](respondWithResult(_0xfe7fd6,null))[_0xa082('0x41')](handleError(_0xfe7fd6,null));}; \ No newline at end of file +var _0x7880=['CampaignId\x20=\x20?','state','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','status','error','stack','send','map','CmHopperFinal','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','order','sort','filter','merge','where','VIRTUAL','count','include','findAll','catch','show','params','describe','body','uniqueid','find','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','literal','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId'];(function(_0x439e2e,_0x53839f){var _0x16f28d=function(_0x29a7e5){while(--_0x29a7e5){_0x439e2e['push'](_0x439e2e['shift']());}};_0x16f28d(++_0x53839f);}(_0x7880,0x1f4));var _0x0788=function(_0x5d4db8,_0x4ad01b){_0x5d4db8=_0x5d4db8-0x0;var _0x415548=_0x7880[_0x5d4db8];return _0x415548;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0788('0x0'));var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0788('0x6'));var util=require(_0x0788('0x7'));var path=require(_0x0788('0x8'));var sox=require(_0x0788('0x9'));var csv=require(_0x0788('0xa'));var ejs=require(_0x0788('0xb'));var fs=require('fs');var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0xa'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var db=require(_0x0788('0x18'))['db'];function respondWithStatusCode(_0x2d8568,_0x311729){_0x311729=_0x311729||0xcc;return function(_0xce4342){if(_0xce4342){return _0x2d8568[_0x0788('0x19')](_0x311729);}return _0x2d8568['status'](_0x311729)[_0x0788('0x1a')]();};}function respondWithResult(_0x7e3407,_0x3bdcdf){_0x3bdcdf=_0x3bdcdf||0xc8;return function(_0x13cf07){if(_0x13cf07){return _0x7e3407['status'](_0x3bdcdf)[_0x0788('0x1b')](_0x13cf07);}};}function respondWithFilteredResult(_0x4ed024,_0x195f14){return function(_0x170d56){if(_0x170d56){var _0x3fd1e4=_0x170d56['count'],_0xb406fb=_0x195f14['offset'],_0x2ddd1a=_0x195f14[_0x0788('0x1c')]+_0x195f14[_0x0788('0x1d')],_0x430e34;if(_0x2ddd1a>=_0x3fd1e4){_0x2ddd1a=_0x3fd1e4;_0x430e34=0xc8;}else{_0x430e34=0xce;}_0x4ed024['status'](_0x430e34);return _0x4ed024[_0x0788('0x1e')](_0x0788('0x1f'),_0xb406fb+'-'+_0x2ddd1a+'/'+_0x3fd1e4)[_0x0788('0x1b')](_0x170d56);}return null;};}function patchUpdates(_0x52c339){return function(_0x42fe14){try{jsonpatch[_0x0788('0x20')](_0x42fe14,_0x52c339,!![]);}catch(_0x492c2c){return BPromise[_0x0788('0x21')](_0x492c2c);}return _0x42fe14['save']();};}function saveUpdates(_0x7d0869,_0x48bc5f){return function(_0x17cca3){if(_0x17cca3){return _0x17cca3[_0x0788('0x22')](_0x7d0869)[_0x0788('0x23')](function(_0x3cd197){return _0x3cd197;});}return null;};}function removeEntity(_0x3aa142,_0x4f0005){return function(_0x48ec43){if(_0x48ec43){return _0x48ec43[_0x0788('0x24')]()[_0x0788('0x23')](function(){_0x3aa142[_0x0788('0x25')](0xcc)[_0x0788('0x1a')]();});}};}function handleEntityNotFound(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(!_0x79204e){_0x5ba1da[_0x0788('0x19')](0x194);}return _0x79204e;};}function handleError(_0x40309d,_0x50b65c){_0x50b65c=_0x50b65c||0x1f4;return function(_0x4b2693){logger[_0x0788('0x26')](_0x4b2693[_0x0788('0x27')]);if(_0x4b2693['name']){delete _0x4b2693['name'];}_0x40309d[_0x0788('0x25')](_0x50b65c)[_0x0788('0x28')](_0x4b2693);};}exports['index']=function(_0x286730,_0x40e7a6){var _0x467d52={},_0x18fc0e={},_0xf9ba32={'count':0x0,'rows':[]};var _0xb2f4a5=_[_0x0788('0x29')](db[_0x0788('0x2a')]['rawAttributes'],function(_0x5a5178){return{'name':_0x5a5178[_0x0788('0x2b')],'type':_0x5a5178[_0x0788('0x2c')]['key']};});_0x18fc0e['model']=_[_0x0788('0x29')](_0xb2f4a5,_0x0788('0x2d'));_0x18fc0e[_0x0788('0x2e')]=_[_0x0788('0x2f')](_0x286730[_0x0788('0x2e')]);_0x18fc0e[_0x0788('0x30')]=_[_0x0788('0x31')](_0x18fc0e[_0x0788('0x32')],_0x18fc0e[_0x0788('0x2e')]);_0x467d52[_0x0788('0x33')]=_['intersection'](_0x18fc0e[_0x0788('0x32')],qs[_0x0788('0x34')](_0x286730[_0x0788('0x2e')][_0x0788('0x34')]));_0x467d52[_0x0788('0x33')]=_0x467d52[_0x0788('0x33')][_0x0788('0x35')]?_0x467d52[_0x0788('0x33')]:_0x18fc0e[_0x0788('0x32')];if(!_0x286730[_0x0788('0x2e')]['hasOwnProperty']('nolimit')){_0x467d52['limit']=qs['limit'](_0x286730['query']['limit']);_0x467d52[_0x0788('0x1c')]=qs[_0x0788('0x1c')](_0x286730[_0x0788('0x2e')]['offset']);}_0x467d52[_0x0788('0x36')]=qs[_0x0788('0x37')](_0x286730[_0x0788('0x2e')][_0x0788('0x37')]);_0x467d52['where']=qs[_0x0788('0x30')](_['pick'](_0x286730[_0x0788('0x2e')],_0x18fc0e['filters']),_0xb2f4a5);if(_0x286730[_0x0788('0x2e')][_0x0788('0x38')]){_0x467d52['where']=_[_0x0788('0x39')](_0x467d52[_0x0788('0x3a')],{'$or':_['map'](_0xb2f4a5,function(_0x17240e){if(_0x17240e['type']!==_0x0788('0x3b')){var _0x5576c4={};_0x5576c4[_0x17240e[_0x0788('0x2d')]]={'$like':'%'+_0x286730['query'][_0x0788('0x38')]+'%'};return _0x5576c4;}})});}_0x467d52=_['merge']({},_0x467d52,_0x286730['options']);var _0x3e31f8={'where':_0x467d52[_0x0788('0x3a')]};return db[_0x0788('0x2a')][_0x0788('0x3c')](_0x3e31f8)[_0x0788('0x23')](function(_0x53da74){_0xf9ba32['count']=_0x53da74;if(_0x286730['query']['includeAll']){_0x467d52[_0x0788('0x3d')]=[{'all':!![]}];}return db[_0x0788('0x2a')][_0x0788('0x3e')](_0x467d52);})[_0x0788('0x23')](function(_0x362c49){_0xf9ba32['rows']=_0x362c49;return _0xf9ba32;})['then'](respondWithFilteredResult(_0x40e7a6,_0x467d52))[_0x0788('0x3f')](handleError(_0x40e7a6,null));};exports[_0x0788('0x40')]=function(_0x330421,_0x29e09a){var _0x236b63={'raw':!![],'where':{'id':_0x330421[_0x0788('0x41')]['id']}},_0x4316aa={};_0x4316aa[_0x0788('0x32')]=_[_0x0788('0x2f')](db['CmHopperFinal']['rawAttributes']);_0x4316aa[_0x0788('0x2e')]=_[_0x0788('0x2f')](_0x330421[_0x0788('0x2e')]);_0x4316aa['filters']=_['intersection'](_0x4316aa['model'],_0x4316aa[_0x0788('0x2e')]);_0x236b63[_0x0788('0x33')]=_[_0x0788('0x31')](_0x4316aa[_0x0788('0x32')],qs[_0x0788('0x34')](_0x330421[_0x0788('0x2e')][_0x0788('0x34')]));_0x236b63[_0x0788('0x33')]=_0x236b63['attributes'][_0x0788('0x35')]?_0x236b63[_0x0788('0x33')]:_0x4316aa[_0x0788('0x32')];if(_0x330421[_0x0788('0x2e')]['includeAll']){_0x236b63[_0x0788('0x3d')]=[{'all':!![]}];}_0x236b63=_[_0x0788('0x39')]({},_0x236b63,_0x330421['options']);return db['CmHopperFinal']['find'](_0x236b63)[_0x0788('0x23')](handleEntityNotFound(_0x29e09a,null))['then'](respondWithResult(_0x29e09a,null))[_0x0788('0x3f')](handleError(_0x29e09a,null));};exports[_0x0788('0x42')]=function(_0x127ab4,_0x329508){return db[_0x0788('0x2a')][_0x0788('0x42')]()[_0x0788('0x23')](respondWithResult(_0x329508,null))[_0x0788('0x3f')](handleError(_0x329508,null));};exports['update']=function(_0x4c6366,_0x39c3cc){if(_0x4c6366[_0x0788('0x43')][_0x0788('0x44')]){delete _0x4c6366['body'][_0x0788('0x44')];}return db[_0x0788('0x2a')][_0x0788('0x45')]({'where':{'uniqueid':_0x4c6366[_0x0788('0x41')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x39c3cc,null))['then'](saveUpdates(_0x4c6366['body'],null))[_0x0788('0x23')](respondWithResult(_0x39c3cc,null))[_0x0788('0x3f')](handleError(_0x39c3cc,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x2b1479,_0x4a6cde,_0x2103aa){return db[_0x0788('0x2a')][_0x0788('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x2b1479[_0x0788('0x41')]['id']},'attributes':[[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x48')))),_0x0788('0x49')],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x4a')))),_0x0788('0x4b')],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x0788('0x4c')],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x4e')))),_0x0788('0x4f')],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x50')))),_0x0788('0x51')],[db['sequelize']['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x52')))),_0x0788('0x53')],[db['sequelize']['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x0788('0x23')](handleEntityNotFound(_0x4a6cde,null))['then'](respondWithResult(_0x4a6cde,null))[_0x0788('0x3f')](handleError(_0x4a6cde,null));};exports[_0x0788('0x56')]=function(_0x223767,_0x13a021,_0x101e8b){return db[_0x0788('0x2a')][_0x0788('0x3e')]({'raw':![],'where':{'CampaignId':_0x223767[_0x0788('0x41')]['id']},'attributes':[[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db['sequelize']['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x48')))),_0x0788('0x49')],[db['sequelize']['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x4a')))),'noAnswerContacts'],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x57')))),_0x0788('0x4c')],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x4e')))),_0x0788('0x4f')],[db[_0x0788('0x46')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x50')))),'dropContacts'],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db['sequelize']['literal'](_0x0788('0x54')))),'reCallContacts'],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x58')))),_0x0788('0x59')]]})[_0x0788('0x23')](handleEntityNotFound(_0x13a021,null))[_0x0788('0x23')](respondWithResult(_0x13a021,null))[_0x0788('0x3f')](handleError(_0x13a021,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x240210,_0x30248c,_0x52926f){return db['VoiceQueue'][_0x0788('0x45')]({'where':{'id':_0x240210[_0x0788('0x41')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x30248c,null))[_0x0788('0x23')](function(_0x3628d6){var _0x192798;if(_0x3628d6){_0x192798=squel['insert']()[_0x0788('0x5a')](_0x0788('0x5b'))[_0x0788('0x5c')]([_0x0788('0x5d'),'scheduledAt',_0x0788('0x5e'),_0x0788('0x5f'),_0x0788('0x60'),_0x0788('0x61'),'updatedAt'],squel['select']()[_0x0788('0x62')](_0x0788('0x63'),_0x0788('0x5d'))[_0x0788('0x62')](_0x0788('0x64'),_0x0788('0x65'))[_0x0788('0x62')](_0x0788('0x66'),_0x0788('0x5e'))['field'](_0x0788('0x67'),_0x0788('0x5f'))[_0x0788('0x62')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x0788('0x62')]('NOW()',_0x0788('0x61'))[_0x0788('0x62')](_0x0788('0x64'),_0x0788('0x68'))[_0x0788('0x69')](_0x0788('0x6a'))[_0x0788('0x3a')](_0x0788('0x6b'),_0x240210[_0x0788('0x41')]['id']['toString']())[_0x0788('0x3a')](_0x0788('0x6c'),_0x240210[_0x0788('0x43')]['state'][_0x0788('0x6d')]())[_0x0788('0x3a')](_0x0788('0x6e'))['where'](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x5d'))[_0x0788('0x69')](_0x0788('0x5b'))[_0x0788('0x3a')](_0x0788('0x6b'),_0x240210[_0x0788('0x41')]['id']['toString']()))[_0x0788('0x3a')](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x71'))['from'](_0x0788('0x6a'))[_0x0788('0x3a')](_0x0788('0x6b'),_0x240210['params']['id'][_0x0788('0x6d')]())[_0x0788('0x3a')](_0x0788('0x72')))[_0x0788('0x73')](_0x0788('0x5e')))['toString']();return db[_0x0788('0x46')][_0x0788('0x2e')](_0x192798);}return[];})['then'](respondWithResult(_0x30248c,null))[_0x0788('0x3f')](handleError(_0x30248c,null));};exports[_0x0788('0x74')]=function(_0x537a69,_0xc597d7,_0xe14a8e){return db[_0x0788('0x75')]['find']({'where':{'id':_0x537a69[_0x0788('0x41')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0xc597d7,null))[_0x0788('0x23')](function(_0x53730a){var _0xddfb97;if(_0x53730a){_0xddfb97=squel[_0x0788('0x76')]()[_0x0788('0x5a')](_0x0788('0x5b'))[_0x0788('0x5c')]([_0x0788('0x5d'),_0x0788('0x65'),_0x0788('0x5e'),'ListId',_0x0788('0x77'),_0x0788('0x61'),_0x0788('0x68')],squel[_0x0788('0x70')]()['field']('ANY_VALUE(calleridnum)',_0x0788('0x5d'))[_0x0788('0x62')]('NOW()',_0x0788('0x65'))[_0x0788('0x62')](_0x0788('0x66'),'ContactId')['field'](_0x0788('0x67'),_0x0788('0x5f'))['field']('ANY_VALUE(CampaignId)','CampaignId')[_0x0788('0x62')](_0x0788('0x64'),'createdAt')[_0x0788('0x62')](_0x0788('0x64'),_0x0788('0x68'))[_0x0788('0x69')](_0x0788('0x6a'))['where'](_0x0788('0x78'),_0x537a69['params']['id'][_0x0788('0x6d')]())['where'](_0x0788('0x6c'),_0x537a69[_0x0788('0x43')][_0x0788('0x79')][_0x0788('0x6d')]())[_0x0788('0x3a')](_0x0788('0x6e'))[_0x0788('0x3a')](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x5d'))[_0x0788('0x69')](_0x0788('0x5b'))['where']('CampaignId\x20=\x20?',_0x537a69['params']['id'][_0x0788('0x6d')]()))[_0x0788('0x3a')](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x71'))[_0x0788('0x69')](_0x0788('0x6a'))[_0x0788('0x3a')](_0x0788('0x78'),_0x537a69[_0x0788('0x41')]['id']['toString']())['where'](_0x0788('0x72')))[_0x0788('0x73')](_0x0788('0x5e')))[_0x0788('0x6d')]();return db[_0x0788('0x46')][_0x0788('0x2e')](_0xddfb97);}return[];})[_0x0788('0x23')](respondWithResult(_0xc597d7,null))[_0x0788('0x3f')](handleError(_0xc597d7,null));};exports['checkContactHopper']=function(_0x48b82c,_0x3b5c80,_0x22e770){return db[_0x0788('0x7a')][_0x0788('0x7b')]({'where':{'VoiceQueueId':_0x48b82c[_0x0788('0x43')][_0x0788('0x60')],'CampaignId':_0x48b82c['body'][_0x0788('0x77')],'ContactId':_0x48b82c[_0x0788('0x43')][_0x0788('0x5e')]}})[_0x0788('0x23')](handleEntityNotFound(_0x3b5c80,null))[_0x0788('0x23')](function(_0x1191e7){if(_0x1191e7){return _0x1191e7;}return null;})[_0x0788('0x23')](respondWithResult(_0x3b5c80,null))[_0x0788('0x3f')](handleError(_0x3b5c80,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index c88ede8..ddaa5de 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 _0x2504=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x5e4e99,_0x410870){var _0x200520=function(_0x4af77c){while(--_0x4af77c){_0x5e4e99['push'](_0x5e4e99['shift']());}};_0x200520(++_0x410870);}(_0x2504,0xee));var _0x4250=function(_0x21e3af,_0x26127a){_0x21e3af=_0x21e3af-0x0;var _0x1a6048=_0x2504[_0x21e3af];return _0x1a6048;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var logger=require(_0x4250('0x2'))(_0x4250('0x3'));var moment=require(_0x4250('0x4'));var BPromise=require(_0x4250('0x5'));var rp=require(_0x4250('0x6'));var fs=require('fs');var path=require(_0x4250('0x7'));var rimraf=require(_0x4250('0x8'));var config=require(_0x4250('0x9'));var attributes=require(_0x4250('0xa'));module[_0x4250('0xb')]=function(_0x493da9,_0x473cb8){return _0x493da9['define']('CmHopperFinal',attributes,{'tableName':_0x4250('0xc'),'paranoid':![],'indexes':[{'name':_0x4250('0xd'),'fields':[_0x4250('0xd')]},{'name':_0x4250('0xe'),'fields':[_0x4250('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea70=['request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x565aa3,_0xff8fa){var _0x5351a3=function(_0x5a1420){while(--_0x5a1420){_0x565aa3['push'](_0x565aa3['shift']());}};_0x5351a3(++_0xff8fa);}(_0xea70,0x175));var _0x0ea7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xea70[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var logger=require(_0x0ea7('0x2'))('api');var moment=require(_0x0ea7('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ea7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ea7('0x5'));var config=require(_0x0ea7('0x6'));var attributes=require(_0x0ea7('0x7'));module[_0x0ea7('0x8')]=function(_0x168372,_0x489be9){return _0x168372[_0x0ea7('0x9')](_0x0ea7('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x0ea7('0xb'),'fields':[_0x0ea7('0xb')]},{'name':'uniqueid','fields':[_0x0ea7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index d1e4822..6699e24 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 _0x322f=['body','options','CreateCmHopperFinal','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','catch','CmHopperFinal','create'];(function(_0xdd914f,_0xfa6cd4){var _0x1ee80a=function(_0x483a05){while(--_0x483a05){_0xdd914f['push'](_0xdd914f['shift']());}};_0x1ee80a(++_0xfa6cd4);}(_0x322f,0x1bd));var _0xf322=function(_0x12336a,_0x2085c5){_0x12336a=_0x12336a-0x0;var _0x21d342=_0x322f[_0x12336a];return _0x21d342;};'use strict';var _=require(_0xf322('0x0'));var util=require(_0xf322('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf322('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf322('0x3'));var logger=require(_0xf322('0x4'))(_0xf322('0x5'));var config=require(_0xf322('0x6'));var jayson=require(_0xf322('0x7'));var client=jayson[_0xf322('0x8')][_0xf322('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31a86e,_0xefc004,_0x511723){return new BPromise(function(_0xbcdf7b,_0x5460db){return client[_0xf322('0xa')](_0x31a86e,_0x511723)['then'](function(_0x505a23){logger[_0xf322('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0xefc004,_0xf322('0xc'));logger[_0xf322('0xd')](_0xf322('0xe'),_0xefc004,_0xf322('0xc'),JSON[_0xf322('0xf')](_0x505a23));if(_0x505a23[_0xf322('0x10')]){if(_0x505a23[_0xf322('0x10')][_0xf322('0x11')]===0x1f4){logger[_0xf322('0x10')](_0xf322('0x12'),_0xefc004,_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);return _0x5460db(_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);}logger['error'](_0xf322('0x12'),_0xefc004,_0x505a23[_0xf322('0x10')]['message']);return _0xbcdf7b(_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);}else{logger[_0xf322('0xb')](_0xf322('0x12'),_0xefc004,_0xf322('0xc'));_0xbcdf7b(_0x505a23['result'][_0xf322('0x13')]);}})[_0xf322('0x14')](function(_0x56253f){logger[_0xf322('0x10')](_0xf322('0x12'),_0xefc004,_0x56253f);_0x5460db(_0x56253f);});});}exports['CreateCmHopperFinal']=function(_0x5800ff){var _0x37b853=this;return new Promise(function(_0x5e738a,_0x58b863){return db[_0xf322('0x15')][_0xf322('0x16')](_0x5800ff[_0xf322('0x17')],{'raw':_0x5800ff[_0xf322('0x18')]?_0x5800ff[_0xf322('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x7034ff){logger[_0xf322('0xb')](_0xf322('0x19'),_0x5800ff);logger[_0xf322('0xd')](_0xf322('0x19'),_0x5800ff,JSON[_0xf322('0xf')](_0x7034ff));_0x5e738a(_0x7034ff);})[_0xf322('0x14')](function(_0x263aac){logger[_0xf322('0x10')](_0xf322('0x19'),_0x263aac['message'],_0x5800ff);_0x58b863(_0x37b853[_0xf322('0x10')](0x1f4,_0x263aac[_0xf322('0x13')]));});});}; \ No newline at end of file +var _0x145f=['client','request','info','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperFinal,\x20%s,\x20%s','result','catch','create','body','options','raw','then','CreateCmHopperFinal','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x145f,0xec));var _0xf145=function(_0x4d98a7,_0x3b2c60){_0x4d98a7=_0x4d98a7-0x0;var _0x4be531=_0x145f[_0x4d98a7];return _0x4be531;};'use strict';var _=require(_0xf145('0x0'));var util=require(_0xf145('0x1'));var moment=require(_0xf145('0x2'));var BPromise=require(_0xf145('0x3'));var rs=require(_0xf145('0x4'));var fs=require('fs');var Redis=require(_0xf145('0x5'));var db=require(_0xf145('0x6'))['db'];var utils=require(_0xf145('0x7'));var logger=require(_0xf145('0x8'))(_0xf145('0x9'));var config=require(_0xf145('0xa'));var jayson=require(_0xf145('0xb'));var client=jayson[_0xf145('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17109b,_0x235d61,_0x2eb7c6){return new BPromise(function(_0x166a4e,_0xdf3bdc){return client[_0xf145('0xd')](_0x17109b,_0x2eb7c6)['then'](function(_0x2d4ff2){logger[_0xf145('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x235d61,_0xf145('0xf'));logger[_0xf145('0x10')](_0xf145('0x11'),_0x235d61,'request\x20sent',JSON[_0xf145('0x12')](_0x2d4ff2));if(_0x2d4ff2[_0xf145('0x13')]){if(_0x2d4ff2[_0xf145('0x13')][_0xf145('0x14')]===0x1f4){logger[_0xf145('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x235d61,_0x2d4ff2['error'][_0xf145('0x15')]);return _0xdf3bdc(_0x2d4ff2[_0xf145('0x13')]['message']);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x235d61,_0x2d4ff2[_0xf145('0x13')]['message']);return _0x166a4e(_0x2d4ff2['error'][_0xf145('0x15')]);}else{logger[_0xf145('0xe')](_0xf145('0x16'),_0x235d61,_0xf145('0xf'));_0x166a4e(_0x2d4ff2[_0xf145('0x17')][_0xf145('0x15')]);}})[_0xf145('0x18')](function(_0x915fa){logger[_0xf145('0x13')](_0xf145('0x16'),_0x235d61,_0x915fa);_0xdf3bdc(_0x915fa);});});}exports['CreateCmHopperFinal']=function(_0x4eac55){var _0x12982a=this;return new Promise(function(_0x52b195,_0x6671ae){return db['CmHopperFinal'][_0xf145('0x19')](_0x4eac55[_0xf145('0x1a')],{'raw':_0x4eac55[_0xf145('0x1b')]?_0x4eac55[_0xf145('0x1b')][_0xf145('0x1c')]===undefined?!![]:![]:!![]})[_0xf145('0x1d')](function(_0x41abc0){logger[_0xf145('0xe')](_0xf145('0x1e'),_0x4eac55);logger[_0xf145('0x10')]('CreateCmHopperFinal',_0x4eac55,JSON['stringify'](_0x41abc0));_0x52b195(_0x41abc0);})[_0xf145('0x18')](function(_0xc67b39){logger[_0xf145('0x13')](_0xf145('0x1e'),_0xc67b39[_0xf145('0x15')],_0x4eac55);_0x6671ae(_0x12982a[_0xf145('0x13')](0x1f4,_0xc67b39[_0xf145('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 60e1170..c1dc976 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 _0x7fa6=['checkContactHopper','put','multer','path','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','describe','/:id','show','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/checkContactHopper'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7fa6,0x189));var _0x67fa=function(_0x339cf5,_0x62e7ef){_0x339cf5=_0x339cf5-0x0;var _0x535dd5=_0x7fa6[_0x339cf5];return _0x535dd5;};'use strict';var multer=require(_0x67fa('0x0'));var util=require('util');var path=require(_0x67fa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x67fa('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x67fa('0x3'));var controller=require(_0x67fa('0x4'));router['get']('/',auth[_0x67fa('0x5')](),controller['index']);router[_0x67fa('0x6')](_0x67fa('0x7'),auth[_0x67fa('0x5')](),controller[_0x67fa('0x8')]);router[_0x67fa('0x6')](_0x67fa('0x9'),auth[_0x67fa('0x5')](),controller[_0x67fa('0xa')]);router[_0x67fa('0x6')]('/voice/queue/countAttributes/:id',auth[_0x67fa('0x5')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x67fa('0x6')](_0x67fa('0xb'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x67fa('0xc')](_0x67fa('0xd'),auth[_0x67fa('0x5')](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x67fa('0xc')](_0x67fa('0xe'),auth['isAuthenticated'](),controller[_0x67fa('0xf')]);router[_0x67fa('0x10')](_0x67fa('0x9'),auth[_0x67fa('0x5')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x91cd=['/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x2c507b,_0x343d21){var _0x346f0d=function(_0x26c941){while(--_0x26c941){_0x2c507b['push'](_0x2c507b['shift']());}};_0x346f0d(++_0x343d21);}(_0x91cd,0x118));var _0xd91c=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x91cd[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0xd91c('0x0'));var util=require(_0xd91c('0x1'));var path=require(_0xd91c('0x2'));var timeout=require(_0xd91c('0x3'));var express=require(_0xd91c('0x4'));var router=express[_0xd91c('0x5')]();var auth=require(_0xd91c('0x6'));var interaction=require(_0xd91c('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xd91c('0x8')]('/',auth['isAuthenticated'](),controller[_0xd91c('0x9')]);router[_0xd91c('0x8')](_0xd91c('0xa'),auth[_0xd91c('0xb')](),controller[_0xd91c('0xc')]);router['get']('/:id',auth[_0xd91c('0xb')](),controller[_0xd91c('0xd')]);router['get'](_0xd91c('0xe'),auth['isAuthenticated'](),controller[_0xd91c('0xf')]);router[_0xd91c('0x8')]('/campaign/countAttributes/:id',auth[_0xd91c('0xb')](),controller[_0xd91c('0x10')]);router[_0xd91c('0x11')](_0xd91c('0x12'),auth[_0xd91c('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd91c('0x11')]('/voice/campaign/moveContacts/:id',auth[_0xd91c('0xb')](),controller[_0xd91c('0x13')]);router['post'](_0xd91c('0x14'),auth[_0xd91c('0xb')](),controller[_0xd91c('0x15')]);router[_0xd91c('0x16')]('/:id',auth[_0xd91c('0xb')](),controller[_0xd91c('0x17')]);module[_0xd91c('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c3236f9..6a5c108 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 _0x6cc6=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x5afe4f,_0x1bfa27){var _0x32a023=function(_0x160f46){while(--_0x160f46){_0x5afe4f['push'](_0x5afe4f['shift']());}};_0x32a023(++_0x1bfa27);}(_0x6cc6,0x198));var _0x66cc=function(_0x360352,_0x4e8da8){_0x360352=_0x360352-0x0;var _0xa6c2a9=_0x6cc6[_0x360352];return _0xa6c2a9;};'use strict';var Sequelize=require(_0x66cc('0x0'));module[_0x66cc('0x1')]={'state':{'type':Sequelize[_0x66cc('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x66cc('0x3')]},'countbusyretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x66cc('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x66cc('0x3')]},'responsetime':{'type':Sequelize[_0x66cc('0x3')]},'answertime':{'type':Sequelize[_0x66cc('0x3')]},'droptime':{'type':Sequelize[_0x66cc('0x3')]},'endtime':{'type':Sequelize[_0x66cc('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x66cc('0x4')]},'campaign':{'type':Sequelize[_0x66cc('0x4')]},'campaigntype':{'type':Sequelize[_0x66cc('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x66cc('0x4')]},'amd':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x66cc('0x3')]},'recallme':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x66cc('0x3')]},'edited':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x66cc('0x4')]}}; \ No newline at end of file +var _0x6f27=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1649ed,_0x49d93e){var _0xdb17fe=function(_0x1cb3c6){while(--_0x1cb3c6){_0x1649ed['push'](_0x1649ed['shift']());}};_0xdb17fe(++_0x49d93e);}(_0x6f27,0x166));var _0x76f2=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x6f27[_0x43444b];return _0x392fe5;};'use strict';var Sequelize=require(_0x76f2('0x0'));module[_0x76f2('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x76f2('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x76f2('0x3')]},'originatecalleridname':{'type':Sequelize[_0x76f2('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f2('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x76f2('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76f2('0x4')]},'ringtime':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x76f2('0x3')]},'campaign':{'type':Sequelize[_0x76f2('0x3')]},'campaigntype':{'type':Sequelize[_0x76f2('0x3')]},'membername':{'type':Sequelize[_0x76f2('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x76f2('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x76f2('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x76f2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x76f2('0x4')]},'recallme':{'type':Sequelize[_0x76f2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x76f2('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x76f2('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 59dc25e..6f34324 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 _0x5cf6=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','find','create','body','describe','uniqueid','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','filter'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5cf6,0x1df));var _0x65cf=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5cf6[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0x65cf('0x0'));var emlformat=require(_0x65cf('0x1'));var rimraf=require(_0x65cf('0x2'));var zipdir=require(_0x65cf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65cf('0x4'));var moment=require(_0x65cf('0x5'));var BPromise=require(_0x65cf('0x6'));var Mustache=require('mustache');var util=require(_0x65cf('0x7'));var path=require(_0x65cf('0x8'));var sox=require(_0x65cf('0x9'));var csv=require(_0x65cf('0xa'));var ejs=require(_0x65cf('0xb'));var fs=require('fs');var _=require(_0x65cf('0xc'));var squel=require(_0x65cf('0xd'));var crypto=require(_0x65cf('0xe'));var jsforce=require(_0x65cf('0xf'));var deskjs=require(_0x65cf('0x10'));var toCsv=require(_0x65cf('0xa'));var querystring=require(_0x65cf('0x11'));var Papa=require(_0x65cf('0x12'));var Redis=require('ioredis');var authService=require(_0x65cf('0x13'));var qs=require(_0x65cf('0x14'));var as=require(_0x65cf('0x15'));var hardwareService=require(_0x65cf('0x16'));var logger=require(_0x65cf('0x17'))('api');var utils=require(_0x65cf('0x18'));var config=require(_0x65cf('0x19'));var db=require(_0x65cf('0x1a'))['db'];function respondWithStatusCode(_0x563453,_0x288f81){_0x288f81=_0x288f81||0xcc;return function(_0x26151a){if(_0x26151a){return _0x563453[_0x65cf('0x1b')](_0x288f81);}return _0x563453[_0x65cf('0x1c')](_0x288f81)[_0x65cf('0x1d')]();};}function respondWithResult(_0x4f9e37,_0x6571f7){_0x6571f7=_0x6571f7||0xc8;return function(_0x247996){if(_0x247996){return _0x4f9e37[_0x65cf('0x1c')](_0x6571f7)['json'](_0x247996);}};}function respondWithFilteredResult(_0x423c98,_0xb2e89a){return function(_0x3e32c1){if(_0x3e32c1){var _0x5b61d2=_0x3e32c1[_0x65cf('0x1e')],_0x45a35a=_0xb2e89a['offset'],_0x281346=_0xb2e89a['offset']+_0xb2e89a[_0x65cf('0x1f')],_0x869f83;if(_0x281346>=_0x5b61d2){_0x281346=_0x5b61d2;_0x869f83=0xc8;}else{_0x869f83=0xce;}_0x423c98[_0x65cf('0x1c')](_0x869f83);return _0x423c98[_0x65cf('0x20')](_0x65cf('0x21'),_0x45a35a+'-'+_0x281346+'/'+_0x5b61d2)['json'](_0x3e32c1);}return null;};}function patchUpdates(_0x1e5f2f){return function(_0x275a5e){try{jsonpatch[_0x65cf('0x22')](_0x275a5e,_0x1e5f2f,!![]);}catch(_0x203cd9){return BPromise[_0x65cf('0x23')](_0x203cd9);}return _0x275a5e['save']();};}function saveUpdates(_0x5826a7,_0x26635f){return function(_0xa14773){if(_0xa14773){return _0xa14773[_0x65cf('0x24')](_0x5826a7)['then'](function(_0xa9b146){return _0xa9b146;});}return null;};}function removeEntity(_0x57fe4b,_0x1cf691){return function(_0x5e978f){if(_0x5e978f){return _0x5e978f[_0x65cf('0x25')]()[_0x65cf('0x26')](function(){_0x57fe4b[_0x65cf('0x1c')](0xcc)[_0x65cf('0x1d')]();});}};}function handleEntityNotFound(_0x1f41ec,_0x28485b){return function(_0x5c97c5){if(!_0x5c97c5){_0x1f41ec['sendStatus'](0x194);}return _0x5c97c5;};}function handleError(_0x1c1a39,_0x3c1c8d){_0x3c1c8d=_0x3c1c8d||0x1f4;return function(_0x113c67){logger['error'](_0x113c67[_0x65cf('0x27')]);if(_0x113c67[_0x65cf('0x28')]){delete _0x113c67[_0x65cf('0x28')];}_0x1c1a39[_0x65cf('0x1c')](_0x3c1c8d)[_0x65cf('0x29')](_0x113c67);};}exports[_0x65cf('0x2a')]=function(_0x262ed8,_0x4c1d2f){var _0xf240d5={},_0x5da90b={},_0x361683={'count':0x0,'rows':[]};var _0x225db7=_[_0x65cf('0x2b')](db[_0x65cf('0x2c')][_0x65cf('0x2d')],function(_0x54b2fa){return{'name':_0x54b2fa['fieldName'],'type':_0x54b2fa[_0x65cf('0x2e')][_0x65cf('0x2f')]};});_0x5da90b['model']=_[_0x65cf('0x2b')](_0x225db7,_0x65cf('0x28'));_0x5da90b[_0x65cf('0x30')]=_['keys'](_0x262ed8['query']);_0x5da90b[_0x65cf('0x31')]=_[_0x65cf('0x32')](_0x5da90b[_0x65cf('0x33')],_0x5da90b[_0x65cf('0x30')]);_0xf240d5[_0x65cf('0x34')]=_[_0x65cf('0x32')](_0x5da90b[_0x65cf('0x33')],qs[_0x65cf('0x35')](_0x262ed8[_0x65cf('0x30')][_0x65cf('0x35')]));_0xf240d5[_0x65cf('0x34')]=_0xf240d5[_0x65cf('0x34')]['length']?_0xf240d5['attributes']:_0x5da90b[_0x65cf('0x33')];if(!_0x262ed8['query'][_0x65cf('0x36')](_0x65cf('0x37'))){_0xf240d5[_0x65cf('0x1f')]=qs[_0x65cf('0x1f')](_0x262ed8[_0x65cf('0x30')][_0x65cf('0x1f')]);_0xf240d5[_0x65cf('0x38')]=qs[_0x65cf('0x38')](_0x262ed8[_0x65cf('0x30')]['offset']);}_0xf240d5[_0x65cf('0x39')]=qs[_0x65cf('0x3a')](_0x262ed8['query'][_0x65cf('0x3a')]);_0xf240d5['where']=qs[_0x65cf('0x31')](_['pick'](_0x262ed8['query'],_0x5da90b[_0x65cf('0x31')]),_0x225db7);if(_0x262ed8['query'][_0x65cf('0x3b')]){_0xf240d5[_0x65cf('0x3c')]=_[_0x65cf('0x3d')](_0xf240d5[_0x65cf('0x3c')],{'$or':_[_0x65cf('0x2b')](_0x225db7,function(_0x4be09b){if(_0x4be09b[_0x65cf('0x2e')]!==_0x65cf('0x3e')){var _0x3af7c3={};_0x3af7c3[_0x4be09b[_0x65cf('0x28')]]={'$like':'%'+_0x262ed8['query'][_0x65cf('0x3b')]+'%'};return _0x3af7c3;}})});}_0xf240d5=_['merge']({},_0xf240d5,_0x262ed8[_0x65cf('0x3f')]);var _0x1ff245={'where':_0xf240d5[_0x65cf('0x3c')]};return db['CmHopperHistory'][_0x65cf('0x1e')](_0x1ff245)[_0x65cf('0x26')](function(_0x2b7a14){_0x361683[_0x65cf('0x1e')]=_0x2b7a14;if(_0x262ed8['query'][_0x65cf('0x40')]){_0xf240d5[_0x65cf('0x41')]=[{'all':!![]}];}return db[_0x65cf('0x2c')][_0x65cf('0x42')](_0xf240d5);})['then'](function(_0x459f19){_0x361683[_0x65cf('0x43')]=_0x459f19;return _0x361683;})[_0x65cf('0x26')](respondWithFilteredResult(_0x4c1d2f,_0xf240d5))[_0x65cf('0x44')](handleError(_0x4c1d2f,null));};exports['show']=function(_0x342d9f,_0x25113e){var _0x470967={'raw':!![],'where':{'id':_0x342d9f['params']['id']}},_0xac7ad0={};_0xac7ad0[_0x65cf('0x33')]=_['keys'](db[_0x65cf('0x2c')][_0x65cf('0x2d')]);_0xac7ad0['query']=_[_0x65cf('0x45')](_0x342d9f[_0x65cf('0x30')]);_0xac7ad0[_0x65cf('0x31')]=_[_0x65cf('0x32')](_0xac7ad0['model'],_0xac7ad0['query']);_0x470967[_0x65cf('0x34')]=_[_0x65cf('0x32')](_0xac7ad0[_0x65cf('0x33')],qs[_0x65cf('0x35')](_0x342d9f[_0x65cf('0x30')][_0x65cf('0x35')]));_0x470967[_0x65cf('0x34')]=_0x470967[_0x65cf('0x34')][_0x65cf('0x46')]?_0x470967[_0x65cf('0x34')]:_0xac7ad0['model'];if(_0x342d9f[_0x65cf('0x30')]['includeAll']){_0x470967[_0x65cf('0x41')]=[{'all':!![]}];}_0x470967=_[_0x65cf('0x3d')]({},_0x470967,_0x342d9f['options']);return db[_0x65cf('0x2c')][_0x65cf('0x47')](_0x470967)[_0x65cf('0x26')](handleEntityNotFound(_0x25113e,null))['then'](respondWithResult(_0x25113e,null))[_0x65cf('0x44')](handleError(_0x25113e,null));};exports[_0x65cf('0x48')]=function(_0x32a63e,_0x15c795){return db[_0x65cf('0x2c')][_0x65cf('0x48')](_0x32a63e[_0x65cf('0x49')],{})[_0x65cf('0x26')](respondWithResult(_0x15c795,0xc9))['catch'](handleError(_0x15c795,null));};exports[_0x65cf('0x4a')]=function(_0x20bd6d,_0x2ba7bd){return db['CmHopperHistory'][_0x65cf('0x4a')]()['then'](respondWithResult(_0x2ba7bd,null))[_0x65cf('0x44')](handleError(_0x2ba7bd,null));};exports[_0x65cf('0x24')]=function(_0x8ef5d7,_0x4a728c){if(_0x8ef5d7[_0x65cf('0x49')]['uniqueid']){delete _0x8ef5d7['body'][_0x65cf('0x4b')];}return db[_0x65cf('0x2c')]['find']({'where':{'uniqueid':_0x8ef5d7[_0x65cf('0x4c')]['id']}})[_0x65cf('0x26')](handleEntityNotFound(_0x4a728c,null))[_0x65cf('0x26')](saveUpdates(_0x8ef5d7[_0x65cf('0x49')],null))['then'](respondWithResult(_0x4a728c,null))[_0x65cf('0x44')](handleError(_0x4a728c,null));}; \ No newline at end of file +var _0x01c6=['map','CmHopperHistory','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','count','includeAll','include','findAll','catch','params','length','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','set','Content-Range','apply','reject','update','then','stack','send','index'];(function(_0x13993e,_0x3edd98){var _0x39879a=function(_0x47b730){while(--_0x47b730){_0x13993e['push'](_0x13993e['shift']());}};_0x39879a(++_0x3edd98);}(_0x01c6,0x191));var _0x601c=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x01c6[_0x15bc81];return _0x59440e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x601c('0x0'));var rimraf=require(_0x601c('0x1'));var zipdir=require(_0x601c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x601c('0x3'));var moment=require(_0x601c('0x4'));var BPromise=require(_0x601c('0x5'));var Mustache=require(_0x601c('0x6'));var util=require(_0x601c('0x7'));var path=require('path');var sox=require(_0x601c('0x8'));var csv=require(_0x601c('0x9'));var ejs=require(_0x601c('0xa'));var fs=require('fs');var _=require(_0x601c('0xb'));var squel=require('squel');var crypto=require(_0x601c('0xc'));var jsforce=require(_0x601c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x601c('0x9'));var querystring=require(_0x601c('0xe'));var Papa=require(_0x601c('0xf'));var Redis=require(_0x601c('0x10'));var authService=require(_0x601c('0x11'));var qs=require(_0x601c('0x12'));var as=require(_0x601c('0x13'));var hardwareService=require(_0x601c('0x14'));var logger=require(_0x601c('0x15'))(_0x601c('0x16'));var utils=require('../../config/utils');var config=require(_0x601c('0x17'));var db=require(_0x601c('0x18'))['db'];function respondWithStatusCode(_0x2c11b8,_0x56652f){_0x56652f=_0x56652f||0xcc;return function(_0x3a0468){if(_0x3a0468){return _0x2c11b8[_0x601c('0x19')](_0x56652f);}return _0x2c11b8[_0x601c('0x1a')](_0x56652f)['end']();};}function respondWithResult(_0x441927,_0x502dc5){_0x502dc5=_0x502dc5||0xc8;return function(_0x5c5919){if(_0x5c5919){return _0x441927['status'](_0x502dc5)['json'](_0x5c5919);}};}function respondWithFilteredResult(_0x5242aa,_0x9690b3){return function(_0x429327){if(_0x429327){var _0x122ceb=_0x429327['count'],_0x5e2eef=_0x9690b3[_0x601c('0x1b')],_0x2ac54a=_0x9690b3[_0x601c('0x1b')]+_0x9690b3['limit'],_0x1b6b8f;if(_0x2ac54a>=_0x122ceb){_0x2ac54a=_0x122ceb;_0x1b6b8f=0xc8;}else{_0x1b6b8f=0xce;}_0x5242aa['status'](_0x1b6b8f);return _0x5242aa[_0x601c('0x1c')](_0x601c('0x1d'),_0x5e2eef+'-'+_0x2ac54a+'/'+_0x122ceb)['json'](_0x429327);}return null;};}function patchUpdates(_0x2b03ce){return function(_0x17bbdd){try{jsonpatch[_0x601c('0x1e')](_0x17bbdd,_0x2b03ce,!![]);}catch(_0x2ebeb3){return BPromise[_0x601c('0x1f')](_0x2ebeb3);}return _0x17bbdd['save']();};}function saveUpdates(_0x5e9197,_0x50036c){return function(_0x4d4d88){if(_0x4d4d88){return _0x4d4d88[_0x601c('0x20')](_0x5e9197)[_0x601c('0x21')](function(_0x455029){return _0x455029;});}return null;};}function removeEntity(_0x224d9d,_0x5c52f5){return function(_0x19d49d){if(_0x19d49d){return _0x19d49d['destroy']()[_0x601c('0x21')](function(){_0x224d9d[_0x601c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x555eb3,_0x3a1571){return function(_0x5d1341){if(!_0x5d1341){_0x555eb3['sendStatus'](0x194);}return _0x5d1341;};}function handleError(_0x57aa42,_0x31636e){_0x31636e=_0x31636e||0x1f4;return function(_0x46bd67){logger['error'](_0x46bd67[_0x601c('0x22')]);if(_0x46bd67['name']){delete _0x46bd67['name'];}_0x57aa42[_0x601c('0x1a')](_0x31636e)[_0x601c('0x23')](_0x46bd67);};}exports[_0x601c('0x24')]=function(_0x3924ad,_0x4118ae){var _0x14104e={},_0x1b0339={},_0x2f9ba1={'count':0x0,'rows':[]};var _0x4a0cea=_[_0x601c('0x25')](db[_0x601c('0x26')][_0x601c('0x27')],function(_0x4d472c){return{'name':_0x4d472c[_0x601c('0x28')],'type':_0x4d472c[_0x601c('0x29')]['key']};});_0x1b0339[_0x601c('0x2a')]=_['map'](_0x4a0cea,'name');_0x1b0339['query']=_[_0x601c('0x2b')](_0x3924ad[_0x601c('0x2c')]);_0x1b0339[_0x601c('0x2d')]=_[_0x601c('0x2e')](_0x1b0339[_0x601c('0x2a')],_0x1b0339[_0x601c('0x2c')]);_0x14104e[_0x601c('0x2f')]=_[_0x601c('0x2e')](_0x1b0339[_0x601c('0x2a')],qs['fields'](_0x3924ad[_0x601c('0x2c')][_0x601c('0x30')]));_0x14104e[_0x601c('0x2f')]=_0x14104e[_0x601c('0x2f')]['length']?_0x14104e[_0x601c('0x2f')]:_0x1b0339[_0x601c('0x2a')];if(!_0x3924ad['query'][_0x601c('0x31')](_0x601c('0x32'))){_0x14104e[_0x601c('0x33')]=qs[_0x601c('0x33')](_0x3924ad[_0x601c('0x2c')]['limit']);_0x14104e[_0x601c('0x1b')]=qs[_0x601c('0x1b')](_0x3924ad[_0x601c('0x2c')][_0x601c('0x1b')]);}_0x14104e[_0x601c('0x34')]=qs[_0x601c('0x35')](_0x3924ad[_0x601c('0x2c')][_0x601c('0x35')]);_0x14104e[_0x601c('0x36')]=qs[_0x601c('0x2d')](_[_0x601c('0x37')](_0x3924ad[_0x601c('0x2c')],_0x1b0339[_0x601c('0x2d')]),_0x4a0cea);if(_0x3924ad['query']['filter']){_0x14104e[_0x601c('0x36')]=_[_0x601c('0x38')](_0x14104e[_0x601c('0x36')],{'$or':_['map'](_0x4a0cea,function(_0x19f866){if(_0x19f866[_0x601c('0x29')]!==_0x601c('0x39')){var _0x39c650={};_0x39c650[_0x19f866[_0x601c('0x3a')]]={'$like':'%'+_0x3924ad[_0x601c('0x2c')][_0x601c('0x3b')]+'%'};return _0x39c650;}})});}_0x14104e=_[_0x601c('0x38')]({},_0x14104e,_0x3924ad[_0x601c('0x3c')]);var _0x3d36a2={'where':_0x14104e[_0x601c('0x36')]};return db[_0x601c('0x26')][_0x601c('0x3d')](_0x3d36a2)[_0x601c('0x21')](function(_0x1395d6){_0x2f9ba1[_0x601c('0x3d')]=_0x1395d6;if(_0x3924ad[_0x601c('0x2c')][_0x601c('0x3e')]){_0x14104e[_0x601c('0x3f')]=[{'all':!![]}];}return db[_0x601c('0x26')][_0x601c('0x40')](_0x14104e);})[_0x601c('0x21')](function(_0x249f6a){_0x2f9ba1['rows']=_0x249f6a;return _0x2f9ba1;})[_0x601c('0x21')](respondWithFilteredResult(_0x4118ae,_0x14104e))[_0x601c('0x41')](handleError(_0x4118ae,null));};exports['show']=function(_0x5030d3,_0xf2f991){var _0x593612={'raw':!![],'where':{'id':_0x5030d3[_0x601c('0x42')]['id']}},_0x3bddef={};_0x3bddef[_0x601c('0x2a')]=_['keys'](db[_0x601c('0x26')][_0x601c('0x27')]);_0x3bddef['query']=_['keys'](_0x5030d3[_0x601c('0x2c')]);_0x3bddef[_0x601c('0x2d')]=_['intersection'](_0x3bddef[_0x601c('0x2a')],_0x3bddef['query']);_0x593612['attributes']=_[_0x601c('0x2e')](_0x3bddef[_0x601c('0x2a')],qs[_0x601c('0x30')](_0x5030d3[_0x601c('0x2c')]['fields']));_0x593612[_0x601c('0x2f')]=_0x593612[_0x601c('0x2f')][_0x601c('0x43')]?_0x593612['attributes']:_0x3bddef['model'];if(_0x5030d3[_0x601c('0x2c')][_0x601c('0x3e')]){_0x593612[_0x601c('0x3f')]=[{'all':!![]}];}_0x593612=_['merge']({},_0x593612,_0x5030d3['options']);return db['CmHopperHistory'][_0x601c('0x44')](_0x593612)[_0x601c('0x21')](handleEntityNotFound(_0xf2f991,null))[_0x601c('0x21')](respondWithResult(_0xf2f991,null))[_0x601c('0x41')](handleError(_0xf2f991,null));};exports[_0x601c('0x45')]=function(_0x18e47f,_0x2a348b){return db[_0x601c('0x26')][_0x601c('0x45')](_0x18e47f['body'],{})[_0x601c('0x21')](respondWithResult(_0x2a348b,0xc9))[_0x601c('0x41')](handleError(_0x2a348b,null));};exports['describe']=function(_0x2bc9bf,_0x18e3c7){return db[_0x601c('0x26')][_0x601c('0x46')]()[_0x601c('0x21')](respondWithResult(_0x18e3c7,null))[_0x601c('0x41')](handleError(_0x18e3c7,null));};exports['update']=function(_0x4028d2,_0x50779e){if(_0x4028d2[_0x601c('0x47')][_0x601c('0x48')]){delete _0x4028d2['body'][_0x601c('0x48')];}return db['CmHopperHistory'][_0x601c('0x44')]({'where':{'uniqueid':_0x4028d2[_0x601c('0x42')]['id']}})['then'](handleEntityNotFound(_0x50779e,null))[_0x601c('0x21')](saveUpdates(_0x4028d2[_0x601c('0x47')],null))[_0x601c('0x21')](respondWithResult(_0x50779e,null))[_0x601c('0x41')](handleError(_0x50779e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a336449..8ea6999 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 _0xd537=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash','api','bluebird','path','rimraf'];(function(_0x6e4fa0,_0x5eebd1){var _0x347582=function(_0x1d9dd1){while(--_0x1d9dd1){_0x6e4fa0['push'](_0x6e4fa0['shift']());}};_0x347582(++_0x5eebd1);}(_0xd537,0x103));var _0x7d53=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd537[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x7d53('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7d53('0x1'));var moment=require('moment');var BPromise=require(_0x7d53('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d53('0x3'));var rimraf=require(_0x7d53('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d53('0x5'));module[_0x7d53('0x6')]=function(_0x33e6ea,_0x2f974f){return _0x33e6ea[_0x7d53('0x7')](_0x7d53('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x7d53('0x9'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x7d53('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe643=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0xe822b4,_0x4208f1){var _0x209043=function(_0x350d9b){while(--_0x350d9b){_0xe822b4['push'](_0xe822b4['shift']());}};_0x209043(++_0x4208f1);}(_0xe643,0x1ce));var _0x3e64=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe643[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x3e64('0x0'));var util=require(_0x3e64('0x1'));var logger=require(_0x3e64('0x2'))('api');var moment=require(_0x3e64('0x3'));var BPromise=require(_0x3e64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e64('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e64('0x6'));module[_0x3e64('0x7')]=function(_0x1572d7,_0x99833){return _0x1572d7[_0x3e64('0x8')](_0x3e64('0x9'),attributes,{'tableName':_0x3e64('0xa'),'paranoid':![],'indexes':[{'name':_0x3e64('0xb'),'fields':[_0x3e64('0xb')]},{'name':_0x3e64('0xc'),'fields':[_0x3e64('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index b750ee8..a9c208e 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 _0x34b7=['stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','outboundReCallsDay','name','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x34b7,0x196));var _0x734b=function(_0x533ca6,_0x4ed3fb){_0x533ca6=_0x533ca6-0x0;var _0x34f0bd=_0x34b7[_0x533ca6];return _0x34f0bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateCmHopperHistory',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});};exports[_0x734b('0x1c')]=function(_0x46d432){var _0x26d118=this;return new Promise(function(_0x26eccf,_0x104fff){return db[_0x734b('0x16')][_0x734b('0x1d')]({'raw':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x46d432['options']?_0x46d432['options'][_0x734b('0x1e')]||null:null,'attributes':[[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')][_0x734b('0x20')]('id')),_0x734b('0x21')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x23')))),_0x734b('0x24')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x26')))),_0x734b('0x27')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x28')))),_0x734b('0x29')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x2a'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x2b')))),_0x734b('0x2c')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x2a'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x2d')))),'predictiveIntervalAvgTalktime']]})[_0x734b('0x1b')](function(_0x5e2444){logger[_0x734b('0xa')](_0x734b('0x1c'),_0x46d432);logger[_0x734b('0xc')](_0x734b('0x1c'),_0x46d432,JSON[_0x734b('0xe')](_0x5e2444));_0x26eccf(_0x5e2444);})[_0x734b('0x14')](function(_0x55bd2e){logger['error'](_0x734b('0x1c'),_0x55bd2e['message'],_0x46d432);_0x104fff(_0x26d118[_0x734b('0xf')](0x1f4,_0x55bd2e['message']));});});};exports[_0x734b('0x2e')]=function(_0x4b30eb){var _0x1875f1=this;return new Promise(function(_0x5ea4a0,_0x37d891){return db[_0x734b('0x16')][_0x734b('0x1d')]({'raw':_0x4b30eb[_0x734b('0x19')]?_0x4b30eb[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b30eb[_0x734b('0x19')]?_0x4b30eb['options'][_0x734b('0x1e')]||null:null,'attributes':[[_0x734b('0x2f'),'name'],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x30')))),_0x734b('0x31')],[db['sequelize']['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x32')))),_0x734b('0x33')],[db[_0x734b('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x734b('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x734b('0x34')],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x35')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x36')))),'outboundCongestionCallsDay'],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x734b('0x37')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x734b('0x38')],[db['sequelize']['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x39')))),_0x734b('0x3a')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x3b')))),_0x734b('0x3c')],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x734b('0x3d')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x3e')))),'outboundRejectCallsDay'],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x3f')))),_0x734b('0x40')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2020,\x201,\x20null'))),_0x734b('0x41')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x734b('0x42')]],'group':[_0x734b('0x2f')]})[_0x734b('0x1b')](function(_0xe605be){logger['info'](_0x734b('0x2e'),_0x4b30eb);logger[_0x734b('0xc')](_0x734b('0x2e'),_0x4b30eb,JSON[_0x734b('0xe')](_0xe605be));_0x5ea4a0(_0xe605be);})['catch'](function(_0x27f0ff){logger['error'](_0x734b('0x2e'),_0x27f0ff[_0x734b('0x12')],_0x4b30eb);_0x37d891(_0x1875f1[_0x734b('0xf')](0x1f4,_0x27f0ff[_0x734b('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x2b9da7){var _0x1af382=this;return new Promise(function(_0x5b9adc,_0x541e70){return db[_0x734b('0x16')]['findAll']({'raw':_0x2b9da7[_0x734b('0x19')]?_0x2b9da7[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b9da7['options']?_0x2b9da7[_0x734b('0x19')]['where']||null:null,'attributes':[[_0x734b('0x2f'),_0x734b('0x43')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db['sequelize'][_0x734b('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x734b('0x44')]],'group':[_0x734b('0x2f')]})[_0x734b('0x1b')](function(_0x257a87){logger['info'](_0x734b('0x45'),_0x2b9da7);logger['debug'](_0x734b('0x45'),_0x2b9da7,JSON[_0x734b('0xe')](_0x257a87));_0x5b9adc(_0x257a87);})[_0x734b('0x14')](function(_0x4dbff2){logger[_0x734b('0xf')](_0x734b('0x45'),_0x4dbff2[_0x734b('0x12')],_0x2b9da7);_0x541e70(_0x1af382[_0x734b('0xf')](0x1f4,_0x4dbff2[_0x734b('0x12')]));});});}; \ No newline at end of file +var _0xbdb7=['`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0xbdb7[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['create'](_0x5723f4[_0x7bdb('0x17')],{'raw':_0x5723f4[_0x7bdb('0x18')]?_0x5723f4[_0x7bdb('0x18')][_0x7bdb('0x19')]===undefined?!![]:![]:!![]})[_0x7bdb('0x1a')](function(_0x5bfc35){logger['info'](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')]('CreateCmHopperHistory',_0x5723f4,JSON[_0x7bdb('0x10')](_0x5bfc35));_0x4ffd4b(_0x5bfc35);})[_0x7bdb('0x14')](function(_0x346c72){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0x346c72['message'],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0x346c72[_0x7bdb('0x12')]));});});};exports[_0x7bdb('0x1b')]=function(_0x3a456f){var _0x481f4b=this;return new Promise(function(_0x4d6e44,_0x3c423f){return db['CmHopperHistory']['findAll']({'raw':_0x3a456f['options']?_0x3a456f[_0x7bdb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3a456f[_0x7bdb('0x18')]?_0x3a456f[_0x7bdb('0x18')][_0x7bdb('0x1c')]||null:null,'attributes':[[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize'][_0x7bdb('0x1f')]('id')),_0x7bdb('0x20')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x22')))),_0x7bdb('0x23')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x24')))),_0x7bdb('0x25')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x26')))),_0x7bdb('0x27')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x29'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x7bdb('0x1a')](function(_0x5611f5){logger[_0x7bdb('0xb')]('AvgHandleTime',_0x3a456f);logger['debug'](_0x7bdb('0x1b'),_0x3a456f,JSON[_0x7bdb('0x10')](_0x5611f5));_0x4d6e44(_0x5611f5);})[_0x7bdb('0x14')](function(_0x62e562){logger[_0x7bdb('0x11')](_0x7bdb('0x1b'),_0x62e562['message'],_0x3a456f);_0x3c423f(_0x481f4b[_0x7bdb('0x11')](0x1f4,_0x62e562[_0x7bdb('0x12')]));});});};exports[_0x7bdb('0x2a')]=function(_0x3d1537){var _0x26de16=this;return new Promise(function(_0x14c522,_0x228340){return db[_0x7bdb('0x16')][_0x7bdb('0x2b')]({'raw':_0x3d1537['options']?_0x3d1537['options'][_0x7bdb('0x19')]===undefined?!![]:![]:!![],'where':_0x3d1537[_0x7bdb('0x18')]?_0x3d1537[_0x7bdb('0x18')][_0x7bdb('0x1c')]||null:null,'attributes':[[_0x7bdb('0x2c'),'name'],[db['sequelize']['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x2d')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x2e')))),_0x7bdb('0x2f')],[db[_0x7bdb('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x22')))),_0x7bdb('0x30')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x31')))),_0x7bdb('0x32')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x33')))),_0x7bdb('0x34')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x35')))),_0x7bdb('0x36')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7bdb('0x37')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x38')))),_0x7bdb('0x39')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x3a')))),_0x7bdb('0x3b')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x3c')))),_0x7bdb('0x3d')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x3e')))),'outboundRejectCallsDay'],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x3f')))),_0x7bdb('0x40')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x41')))),_0x7bdb('0x42')],[db[_0x7bdb('0x1d')]['fn']('COUNT',db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x43')))),_0x7bdb('0x44')]],'group':[_0x7bdb('0x2c')]})['then'](function(_0x258f29){logger['info']('GetVoiceQueueHopperHistory',_0x3d1537);logger[_0x7bdb('0xe')](_0x7bdb('0x2a'),_0x3d1537,JSON['stringify'](_0x258f29));_0x14c522(_0x258f29);})['catch'](function(_0x49bb3f){logger[_0x7bdb('0x11')]('GetVoiceQueueHopperHistory',_0x49bb3f['message'],_0x3d1537);_0x228340(_0x26de16[_0x7bdb('0x11')](0x1f4,_0x49bb3f[_0x7bdb('0x12')]));});});};exports[_0x7bdb('0x45')]=function(_0x148280){var _0x49c313=this;return new Promise(function(_0x1d444c,_0x4c5c8c){return db[_0x7bdb('0x16')][_0x7bdb('0x2b')]({'raw':_0x148280[_0x7bdb('0x18')]?_0x148280[_0x7bdb('0x18')][_0x7bdb('0x19')]===undefined?!![]:![]:!![],'where':_0x148280[_0x7bdb('0x18')]?_0x148280['options'][_0x7bdb('0x1c')]||null:null,'attributes':[[_0x7bdb('0x2c'),_0x7bdb('0x46')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['col']('id')),_0x7bdb('0x47')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x22')))),_0x7bdb('0x48')]],'group':['campaign']})[_0x7bdb('0x1a')](function(_0x567993){logger[_0x7bdb('0xb')]('GetCampaignHopperHistory',_0x148280);logger['debug'](_0x7bdb('0x45'),_0x148280,JSON[_0x7bdb('0x10')](_0x567993));_0x1d444c(_0x567993);})[_0x7bdb('0x14')](function(_0x26f1f5){logger[_0x7bdb('0x11')](_0x7bdb('0x45'),_0x26f1f5[_0x7bdb('0x12')],_0x148280);_0x4c5c8c(_0x49c313[_0x7bdb('0x11')](0x1f4,_0x26f1f5[_0x7bdb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 01ff43a..d3d169a 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 _0x694d=['/:id','post','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./cmHopperHistory.controller','isAuthenticated','index','get','/describe'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x694d,0x16c));var _0xd694=function(_0x3d98fc,_0x3430b5){_0x3d98fc=_0x3d98fc-0x0;var _0x1bb912=_0x694d[_0x3d98fc];return _0x1bb912;};'use strict';var multer=require(_0xd694('0x0'));var util=require(_0xd694('0x1'));var path=require(_0xd694('0x2'));var timeout=require(_0xd694('0x3'));var express=require('express');var router=express[_0xd694('0x4')]();var auth=require(_0xd694('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd694('0x6'));router['get']('/',auth[_0xd694('0x7')](),controller[_0xd694('0x8')]);router[_0xd694('0x9')](_0xd694('0xa'),auth[_0xd694('0x7')](),controller['describe']);router[_0xd694('0x9')](_0xd694('0xb'),auth[_0xd694('0x7')](),controller['show']);router[_0xd694('0xc')]('/',auth[_0xd694('0x7')](),controller['create']);router['put'](_0xd694('0xb'),auth[_0xd694('0x7')](),controller[_0xd694('0xd')]);module[_0xd694('0xe')]=router; \ No newline at end of file +var _0x4487=['isAuthenticated','/describe','show','post','create','put','/:id','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x4487,0xf2));var _0x7448=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x4487[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x7448('0x0'));var util=require('util');var path=require(_0x7448('0x1'));var timeout=require(_0x7448('0x2'));var express=require(_0x7448('0x3'));var router=express[_0x7448('0x4')]();var auth=require(_0x7448('0x5'));var interaction=require(_0x7448('0x6'));var config=require(_0x7448('0x7'));var controller=require(_0x7448('0x8'));router[_0x7448('0x9')]('/',auth[_0x7448('0xa')](),controller['index']);router[_0x7448('0x9')](_0x7448('0xb'),auth[_0x7448('0xa')](),controller['describe']);router[_0x7448('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7448('0xc')]);router[_0x7448('0xd')]('/',auth['isAuthenticated'](),controller[_0x7448('0xe')]);router[_0x7448('0xf')](_0x7448('0x10'),auth[_0x7448('0xa')](),controller['update']);module[_0x7448('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 5393a33..b222690 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 _0xdb92=['STRING','name','sequelize','exports'];(function(_0x1bd588,_0x3d22e9){var _0x2e3666=function(_0x4b8694){while(--_0x4b8694){_0x1bd588['push'](_0x1bd588['shift']());}};_0x2e3666(++_0x3d22e9);}(_0xdb92,0x96));var _0x2db9=function(_0x117640,_0x4ac313){_0x117640=_0x117640-0x0;var _0x1f4000=_0xdb92[_0x117640];return _0x1f4000;};'use strict';var Sequelize=require(_0x2db9('0x0'));module[_0x2db9('0x1')]={'name':{'type':Sequelize[_0x2db9('0x2')],'unique':_0x2db9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2db9('0x2')]},'dialPrefix':{'type':Sequelize[_0x2db9('0x2')]}}; \ No newline at end of file +var _0x3176=['STRING','name','sequelize'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x3176,0xce));var _0x6317=function(_0x4390de,_0x57bbbc){_0x4390de=_0x4390de-0x0;var _0x3bdcea=_0x3176[_0x4390de];return _0x3bdcea;};'use strict';var Sequelize=require(_0x6317('0x0'));module['exports']={'name':{'type':Sequelize[_0x6317('0x1')],'unique':_0x6317('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6317('0x1')]},'dialPrefix':{'type':Sequelize[_0x6317('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b6f71db..e69c4b5 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 _0x4ad5=['socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','Lists','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','CmList','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','removeDispositions','addContacts','CmContact','tags','isArray','join','push','omit','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','BOOLEAN','defaultValue','cf_%s','getCustomFields','findAndCountAll','addAgents','ids','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../mysqldb','redis','defaults','localhost'];(function(_0x58b57a,_0x3f8a60){var _0x31f1d0=function(_0x48c7f6){while(--_0x48c7f6){_0x58b57a['push'](_0x58b57a['shift']());}};_0x31f1d0(++_0x3f8a60);}(_0x4ad5,0x106));var _0x54ad=function(_0x1f4d04,_0x4fb79c){_0x1f4d04=_0x1f4d04-0x0;var _0x13ff3e=_0x4ad5[_0x1f4d04];return _0x13ff3e;};'use strict';var pdf=require(_0x54ad('0x0'));var emlformat=require(_0x54ad('0x1'));var rimraf=require(_0x54ad('0x2'));var zipdir=require(_0x54ad('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54ad('0x4'));var moment=require(_0x54ad('0x5'));var BPromise=require(_0x54ad('0x6'));var Mustache=require(_0x54ad('0x7'));var util=require(_0x54ad('0x8'));var path=require(_0x54ad('0x9'));var sox=require(_0x54ad('0xa'));var csv=require('to-csv');var ejs=require(_0x54ad('0xb'));var fs=require('fs');var _=require(_0x54ad('0xc'));var squel=require(_0x54ad('0xd'));var crypto=require('crypto');var jsforce=require(_0x54ad('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x54ad('0xf'));var querystring=require(_0x54ad('0x10'));var Papa=require(_0x54ad('0x11'));var Redis=require(_0x54ad('0x12'));var authService=require(_0x54ad('0x13'));var qs=require(_0x54ad('0x14'));var as=require(_0x54ad('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x54ad('0x16'))['db'];config[_0x54ad('0x17')]=_[_0x54ad('0x18')](config['redis'],{'host':_0x54ad('0x19'),'port':0x18eb});var socket=require(_0x54ad('0x1a'))(new Redis(config[_0x54ad('0x17')]));require(_0x54ad('0x1b'))[_0x54ad('0x1c')](socket);function respondWithStatusCode(_0x5cac01,_0x4d7fc0){_0x4d7fc0=_0x4d7fc0||0xcc;return function(_0x263bd5){if(_0x263bd5){return _0x5cac01[_0x54ad('0x1d')](_0x4d7fc0);}return _0x5cac01[_0x54ad('0x1e')](_0x4d7fc0)[_0x54ad('0x1f')]();};}function respondWithResult(_0x5640a8,_0x43d6ec){_0x43d6ec=_0x43d6ec||0xc8;return function(_0x17a400){if(_0x17a400){return _0x5640a8[_0x54ad('0x1e')](_0x43d6ec)[_0x54ad('0x20')](_0x17a400);}};}function respondWithFilteredResult(_0x279f23,_0x164633){return function(_0x229b78){if(_0x229b78){var _0x25e011=_0x229b78[_0x54ad('0x21')],_0x46259c=_0x164633[_0x54ad('0x22')],_0x1a0dc8=_0x164633['offset']+_0x164633[_0x54ad('0x23')],_0x2411c8;if(_0x1a0dc8>=_0x25e011){_0x1a0dc8=_0x25e011;_0x2411c8=0xc8;}else{_0x2411c8=0xce;}_0x279f23['status'](_0x2411c8);return _0x279f23[_0x54ad('0x24')](_0x54ad('0x25'),_0x46259c+'-'+_0x1a0dc8+'/'+_0x25e011)[_0x54ad('0x20')](_0x229b78);}return null;};}function patchUpdates(_0x2c9a84){return function(_0x5cdbc0){try{jsonpatch[_0x54ad('0x26')](_0x5cdbc0,_0x2c9a84,!![]);}catch(_0x5bdbd2){return BPromise[_0x54ad('0x27')](_0x5bdbd2);}return _0x5cdbc0['save']();};}function saveUpdates(_0x98f699,_0x4f3c6b){return function(_0x21e0c4){if(_0x21e0c4){return _0x21e0c4[_0x54ad('0x28')](_0x98f699)['then'](function(_0x3fc894){return _0x3fc894;});}return null;};}function removeEntity(_0x52c24d,_0x3ad7c3){return function(_0x406c15){if(_0x406c15){return _0x406c15[_0x54ad('0x29')]()[_0x54ad('0x2a')](function(){var _0x3bfc59=_0x406c15['get']({'plain':!![]});var _0x393850=_0x54ad('0x2b');return db['UserProfileResource'][_0x54ad('0x29')]({'where':{'type':_0x393850,'resourceId':_0x3bfc59['id']}})[_0x54ad('0x2a')](function(){return _0x406c15;});})[_0x54ad('0x2a')](function(){_0x52c24d['status'](0xcc)[_0x54ad('0x1f')]();});}};}function handleEntityNotFound(_0x5263ec,_0x3ade67){return function(_0x36f139){if(!_0x36f139){_0x5263ec[_0x54ad('0x1d')](0x194);}return _0x36f139;};}function handleError(_0x4db25c,_0x459999){_0x459999=_0x459999||0x1f4;return function(_0x21065f){logger[_0x54ad('0x2c')](_0x21065f[_0x54ad('0x2d')]);if(_0x21065f[_0x54ad('0x2e')]){delete _0x21065f[_0x54ad('0x2e')];}_0x4db25c['status'](_0x459999)[_0x54ad('0x2f')](_0x21065f);};}exports['index']=function(_0x3f15f3,_0x3bb9f3){var _0x286f6a={},_0x4ffbba={},_0x26f4ad={'count':0x0,'rows':[]};var _0x58dd7c=_[_0x54ad('0x30')](db['CmList'][_0x54ad('0x31')],function(_0x46b9eb){return{'name':_0x46b9eb[_0x54ad('0x32')],'type':_0x46b9eb['type'][_0x54ad('0x33')]};});_0x4ffbba[_0x54ad('0x34')]=_['map'](_0x58dd7c,_0x54ad('0x2e'));_0x4ffbba[_0x54ad('0x35')]=_[_0x54ad('0x36')](_0x3f15f3['query']);_0x4ffbba[_0x54ad('0x37')]=_[_0x54ad('0x38')](_0x4ffbba[_0x54ad('0x34')],_0x4ffbba[_0x54ad('0x35')]);_0x286f6a['attributes']=_['intersection'](_0x4ffbba['model'],qs[_0x54ad('0x39')](_0x3f15f3['query']['fields']));_0x286f6a[_0x54ad('0x3a')]=_0x286f6a[_0x54ad('0x3a')][_0x54ad('0x3b')]?_0x286f6a['attributes']:_0x4ffbba['model'];if(!_0x3f15f3['query'][_0x54ad('0x3c')](_0x54ad('0x3d'))){_0x286f6a['limit']=qs['limit'](_0x3f15f3[_0x54ad('0x35')][_0x54ad('0x23')]);_0x286f6a[_0x54ad('0x22')]=qs[_0x54ad('0x22')](_0x3f15f3[_0x54ad('0x35')][_0x54ad('0x22')]);}_0x286f6a[_0x54ad('0x3e')]=qs[_0x54ad('0x3f')](_0x3f15f3[_0x54ad('0x35')][_0x54ad('0x3f')]);_0x286f6a[_0x54ad('0x40')]=qs[_0x54ad('0x37')](_[_0x54ad('0x41')](_0x3f15f3[_0x54ad('0x35')],_0x4ffbba['filters']),_0x58dd7c);if(_0x3f15f3['query'][_0x54ad('0x42')]){_0x286f6a['where']=_[_0x54ad('0x43')](_0x286f6a[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x58dd7c,function(_0x38684b){if(_0x38684b[_0x54ad('0x44')]!=='VIRTUAL'){var _0x5c3aae={};_0x5c3aae[_0x38684b['name']]={'$like':'%'+_0x3f15f3[_0x54ad('0x35')][_0x54ad('0x42')]+'%'};return _0x5c3aae;}})});}_0x286f6a=_[_0x54ad('0x43')]({},_0x286f6a,_0x3f15f3[_0x54ad('0x45')]);var _0x49d1a3={'where':_0x286f6a[_0x54ad('0x40')]};return db[_0x54ad('0x46')][_0x54ad('0x21')](_0x49d1a3)[_0x54ad('0x2a')](function(_0x39ffaa){_0x26f4ad['count']=_0x39ffaa;if(_0x3f15f3['query'][_0x54ad('0x47')]){_0x286f6a[_0x54ad('0x48')]=[{'all':!![]}];}return db[_0x54ad('0x46')][_0x54ad('0x49')](_0x286f6a);})['then'](function(_0xcd3beb){_0x26f4ad[_0x54ad('0x4a')]=_0xcd3beb;return _0x26f4ad;})[_0x54ad('0x2a')](respondWithFilteredResult(_0x3bb9f3,_0x286f6a))[_0x54ad('0x4b')](handleError(_0x3bb9f3,null));};exports[_0x54ad('0x4c')]=function(_0x587053,_0x541a18){var _0x48c309={'raw':![],'where':{'id':_0x587053[_0x54ad('0x4d')]['id']}},_0x5e7d90={};_0x5e7d90[_0x54ad('0x34')]=_[_0x54ad('0x36')](db['CmList'][_0x54ad('0x31')]);_0x5e7d90['query']=_[_0x54ad('0x36')](_0x587053['query']);_0x5e7d90['filters']=_[_0x54ad('0x38')](_0x5e7d90[_0x54ad('0x34')],_0x5e7d90[_0x54ad('0x35')]);_0x48c309[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x5e7d90[_0x54ad('0x34')],qs[_0x54ad('0x39')](_0x587053[_0x54ad('0x35')][_0x54ad('0x39')]));_0x48c309[_0x54ad('0x3a')]=_0x48c309[_0x54ad('0x3a')][_0x54ad('0x3b')]?_0x48c309['attributes']:_0x5e7d90[_0x54ad('0x34')];if(_0x587053['query'][_0x54ad('0x47')]){_0x48c309[_0x54ad('0x48')]=[{'all':!![]}];}_0x48c309=_['merge']({},_0x48c309,_0x587053[_0x54ad('0x45')]);return db['CmList']['find'](_0x48c309)[_0x54ad('0x2a')](handleEntityNotFound(_0x541a18,null))[_0x54ad('0x2a')](respondWithResult(_0x541a18,null))[_0x54ad('0x4b')](handleError(_0x541a18,null));};exports['create']=function(_0x5399a8,_0x5888b6){return db['CmList'][_0x54ad('0x4e')](_0x5399a8[_0x54ad('0x4f')],{})[_0x54ad('0x2a')](function(_0x685975){var _0x232d3a=_0x5399a8[_0x54ad('0x50')][_0x54ad('0x51')]({'plain':!![]});if(!_0x232d3a)throw new Error(_0x54ad('0x52'));if(_0x232d3a[_0x54ad('0x53')]===_0x54ad('0x50')){var _0x3ccb21=_0x685975[_0x54ad('0x51')]({'plain':!![]});var _0x3b593d='Lists';return db['UserProfileSection'][_0x54ad('0x54')]({'where':{'name':_0x3b593d,'userProfileId':_0x232d3a[_0x54ad('0x55')]},'raw':!![]})[_0x54ad('0x2a')](function(_0x306a60){if(_0x306a60&&_0x306a60[_0x54ad('0x56')]===0x0){return db[_0x54ad('0x57')][_0x54ad('0x4e')]({'name':_0x3ccb21['name'],'resourceId':_0x3ccb21['id'],'type':_0x306a60[_0x54ad('0x2e')],'sectionId':_0x306a60['id']},{})[_0x54ad('0x2a')](function(){return _0x685975;});}else{return _0x685975;}})[_0x54ad('0x4b')](function(_0x54827a){logger[_0x54ad('0x2c')](_0x54ad('0x58'),_0x54827a);throw _0x54827a;});}return _0x685975;})['then'](respondWithResult(_0x5888b6,0xc9))[_0x54ad('0x4b')](handleError(_0x5888b6,null));};exports[_0x54ad('0x28')]=function(_0x347e61,_0x5675ff){if(_0x347e61[_0x54ad('0x4f')]['id']){delete _0x347e61['body']['id'];}return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x347e61[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x5675ff,null))['then'](saveUpdates(_0x347e61[_0x54ad('0x4f')],null))[_0x54ad('0x2a')](respondWithResult(_0x5675ff,null))['catch'](handleError(_0x5675ff,null));};exports[_0x54ad('0x29')]=function(_0x53be50,_0x4fc8eb){return db[_0x54ad('0x46')]['find']({'where':{'id':_0x53be50['params']['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x4fc8eb,null))[_0x54ad('0x2a')](removeEntity(_0x4fc8eb,null))[_0x54ad('0x4b')](handleError(_0x4fc8eb,null));};exports[_0x54ad('0x59')]=function(_0x2872af,_0x4da60a){return db['CmList'][_0x54ad('0x59')]()[_0x54ad('0x2a')](respondWithResult(_0x4da60a,null))[_0x54ad('0x4b')](handleError(_0x4da60a,null));};exports[_0x54ad('0x5a')]=function(_0x129b0c,_0x2c722b,_0x32f110){if(_0x129b0c['body']['id']){delete _0x129b0c[_0x54ad('0x4f')]['id'];}return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x129b0c[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x2c722b,null))[_0x54ad('0x2a')](function(_0x21797d){if(_0x21797d){_0x129b0c[_0x54ad('0x4f')][_0x54ad('0x5b')]=_0x21797d['id'];return db[_0x54ad('0x5c')][_0x54ad('0x4e')](_0x129b0c[_0x54ad('0x4f')]);}})[_0x54ad('0x2a')](respondWithResult(_0x2c722b,null))[_0x54ad('0x4b')](handleError(_0x2c722b,null));};exports['getDispositions']=function(_0x13bc33,_0x2121a7,_0x51a9d7){var _0x4a4de1={'raw':![],'where':{}};var _0x2c35c1={};var _0x5affae={'count':0x0,'rows':[]};return db[_0x54ad('0x46')][_0x54ad('0x5d')]({'where':{'id':_0x13bc33[_0x54ad('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2121a7,null))[_0x54ad('0x2a')](function(_0x1d466b){if(_0x1d466b){_0x2c35c1[_0x54ad('0x34')]=_['keys'](db[_0x54ad('0x5c')]['rawAttributes']);_0x2c35c1['query']=_['keys'](_0x13bc33[_0x54ad('0x35')]);_0x2c35c1['filters']=_['intersection'](_0x2c35c1[_0x54ad('0x34')],_0x2c35c1[_0x54ad('0x35')]);_0x4a4de1['attributes']=_[_0x54ad('0x38')](_0x2c35c1[_0x54ad('0x34')],qs['fields'](_0x13bc33[_0x54ad('0x35')][_0x54ad('0x39')]));_0x4a4de1[_0x54ad('0x3a')]=_0x4a4de1['attributes'][_0x54ad('0x3b')]?_0x4a4de1['attributes']:_0x2c35c1[_0x54ad('0x34')];if(!_0x13bc33[_0x54ad('0x35')][_0x54ad('0x3c')]('nolimit')){_0x4a4de1[_0x54ad('0x23')]=qs['limit'](_0x13bc33['query']['limit']);_0x4a4de1[_0x54ad('0x22')]=qs['offset'](_0x13bc33[_0x54ad('0x35')][_0x54ad('0x22')]);}_0x4a4de1[_0x54ad('0x3e')]=qs[_0x54ad('0x3f')](_0x13bc33[_0x54ad('0x35')][_0x54ad('0x3f')]);_0x4a4de1['where']=qs[_0x54ad('0x37')](_['pick'](_0x13bc33['query'],_0x2c35c1[_0x54ad('0x37')]));_0x4a4de1['where'][_0x54ad('0x5b')]=_0x1d466b['id'];if(_0x13bc33[_0x54ad('0x35')][_0x54ad('0x42')]){_0x4a4de1[_0x54ad('0x40')]=_[_0x54ad('0x43')](_0x4a4de1[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x4a4de1[_0x54ad('0x3a')],function(_0x41d0e7){var _0x370011={};_0x370011[_0x41d0e7]={'$like':'%'+_0x13bc33['query']['filter']+'%'};return _0x370011;})});}_0x4a4de1=_[_0x54ad('0x43')]({},_0x4a4de1,_0x13bc33['options']);return db['Disposition'][_0x54ad('0x21')]({'where':_0x4a4de1[_0x54ad('0x40')]})[_0x54ad('0x2a')](function(_0x4c3e5d){_0x5affae['count']=_0x4c3e5d;if(_0x13bc33[_0x54ad('0x35')][_0x54ad('0x47')]){_0x4a4de1[_0x54ad('0x48')]=[{'all':!![]}];}return db[_0x54ad('0x5c')][_0x54ad('0x49')](_0x4a4de1);})[_0x54ad('0x2a')](function(_0x44fab6){_0x5affae[_0x54ad('0x4a')]=_0x44fab6;return _0x5affae;});}})[_0x54ad('0x2a')](respondWithFilteredResult(_0x2121a7,_0x4a4de1))[_0x54ad('0x4b')](handleError(_0x2121a7,null));};exports[_0x54ad('0x5e')]=function(_0x460f20,_0x1f4619,_0x18dca3){return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x460f20[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x1f4619,null))['then'](function(_0x183eef){if(_0x183eef){return _0x183eef[_0x54ad('0x5e')](_0x460f20[_0x54ad('0x35')]['ids']);}})[_0x54ad('0x2a')](respondWithStatusCode(_0x1f4619,null))[_0x54ad('0x4b')](handleError(_0x1f4619,null));};exports[_0x54ad('0x5f')]=function(_0x58b90a,_0x1f23f9,_0x2a6580){return db[_0x54ad('0x46')]['find']({'where':{'id':_0x58b90a[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x1f23f9,null))['then'](function(_0x1a031b){if(_0x1a031b){var _0x164787=[];var _0x4334fb={'success':[],'errors':[]};return db[_0x54ad('0x60')]['describe']()[_0x54ad('0x2a')](function(_0x127a88){if(_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')]&&_[_0x54ad('0x62')](_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')])){if(_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')][_0x54ad('0x3b')]){_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')]=_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')][_0x54ad('0x63')](';')+';';}else{_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')]=null;}}else{_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')]=null;}if(_0x58b90a[_0x54ad('0x4f')]&&_['isArray'](_0x58b90a[_0x54ad('0x4f')])){for(var _0xfe4cbf=0x0;_0xfe4cbf<_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x3b')];_0xfe4cbf+=0x1){_0x58b90a[_0x54ad('0x4f')][_0xfe4cbf][_0x54ad('0x5b')]=_0x58b90a[_0x54ad('0x4d')]['id'];_0x164787[_0x54ad('0x64')](_0x58b90a[_0x54ad('0x4f')][_0xfe4cbf]);}return BPromise['each'](_0x164787,function(_0xe20736){return db['CmContact'][_0x54ad('0x4e')](_[_0x54ad('0x65')](_0xe20736,['ids','id'])||{},{'fields':_[_0x54ad('0x36')](_0x127a88),'raw':!![]})['then'](function(_0x1f477a){_0x4334fb['success'][_0x54ad('0x64')](_0x1f477a[_0x54ad('0x66')]);})[_0x54ad('0x4b')](function(_0x2d2b7d){_0x4334fb['errors'][_0x54ad('0x64')]({'data':_0xe20736,'error':_0x2d2b7d[_0x54ad('0x67')]});});})[_0x54ad('0x2a')](function(_0x2195f7){return _0x4334fb;})[_0x54ad('0x4b')](function(_0x20711e){return _0x20711e;});}else{_0x1f23f9[_0x54ad('0x1e')](0x190)[_0x54ad('0x20')]({'message':_0x54ad('0x68')});}});}})[_0x54ad('0x2a')](respondWithResult(_0x1f23f9,null))[_0x54ad('0x4b')](handleError(_0x1f23f9,null));};exports[_0x54ad('0x69')]=function(_0x489c23,_0x3736bf,_0x3feca7){var _0x383db0;return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x489c23[_0x54ad('0x4d')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x54ad('0x6a')}]})[_0x54ad('0x2a')](handleEntityNotFound(_0x3736bf,null))[_0x54ad('0x2a')](function(_0x1c32f0){if(_0x1c32f0){_0x383db0=_0x1c32f0;return db[_0x54ad('0x60')][_0x54ad('0x31')];}})[_0x54ad('0x2a')](function(_0x3dad5c){if(_0x3dad5c){var _0x1d96a1={};var _0x190cd9={};_0x190cd9[_0x54ad('0x34')]=_[_0x54ad('0x6b')](_[_0x54ad('0x36')](_0x3dad5c),_[_0x54ad('0x30')](_0x383db0[_0x54ad('0x6a')],function(_0xcaacc1){return util[_0x54ad('0x6c')](_0x54ad('0x6d'),_0xcaacc1['id']);}));_0x190cd9[_0x54ad('0x35')]=_[_0x54ad('0x36')](_0x489c23[_0x54ad('0x35')]);_0x190cd9['filters']=_['intersection'](_0x190cd9[_0x54ad('0x34')],_0x190cd9['query']);_0x1d96a1[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x190cd9[_0x54ad('0x34')],qs[_0x54ad('0x39')](_0x489c23[_0x54ad('0x35')][_0x54ad('0x39')]));_0x1d96a1['attributes']=_0x1d96a1[_0x54ad('0x3a')][_0x54ad('0x3b')]?_0x1d96a1[_0x54ad('0x3a')]:_0x190cd9[_0x54ad('0x34')];if(!_0x489c23['query']['hasOwnProperty']('nolimit')){_0x1d96a1[_0x54ad('0x23')]=qs[_0x54ad('0x23')](_0x489c23[_0x54ad('0x35')][_0x54ad('0x23')]);_0x1d96a1['offset']=qs[_0x54ad('0x22')](_0x489c23[_0x54ad('0x35')][_0x54ad('0x22')]);}_0x1d96a1[_0x54ad('0x3e')]=qs[_0x54ad('0x3f')](_0x489c23[_0x54ad('0x35')][_0x54ad('0x3f')]);_0x1d96a1[_0x54ad('0x40')]=qs[_0x54ad('0x37')](_[_0x54ad('0x41')](_0x489c23[_0x54ad('0x35')],_0x190cd9[_0x54ad('0x37')]));_0x1d96a1[_0x54ad('0x6e')]=!![];if(_0x489c23[_0x54ad('0x35')][_0x54ad('0x42')]){_0x1d96a1[_0x54ad('0x40')]=_['merge'](_0x1d96a1[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x1d96a1[_0x54ad('0x3a')],function(_0x3de2ae){var _0x120251={};_0x120251[_0x3de2ae]={'$like':'%'+_0x489c23[_0x54ad('0x35')][_0x54ad('0x42')]+'%'};return _0x120251;})});}_0x1d96a1=_[_0x54ad('0x43')]({},_0x1d96a1,_0x489c23['options']);return _0x383db0[_0x54ad('0x69')](_0x1d96a1);}})[_0x54ad('0x2a')](respondWithResult(_0x3736bf,null))[_0x54ad('0x4b')](handleError(_0x3736bf,null));};exports[_0x54ad('0x6f')]=function(_0x178363,_0x5e2649,_0x45e5b4){var _0x3f405e;return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x178363[_0x54ad('0x4d')]['id']},'include':[{'model':db[_0x54ad('0x70')],'as':_0x54ad('0x6a')}]})[_0x54ad('0x2a')](handleEntityNotFound(_0x5e2649,null))[_0x54ad('0x2a')](function(_0x54e5df){if(_0x54e5df){_0x3f405e=_0x54e5df;return db[_0x54ad('0x60')][_0x54ad('0x31')];}})[_0x54ad('0x2a')](function(_0x56e8e6){if(_0x56e8e6){var _0x53d372={};var _0x3386f4={};_0x3386f4['model']=_[_0x54ad('0x6b')](_[_0x54ad('0x36')](_0x56e8e6),_[_0x54ad('0x30')](_0x3f405e[_0x54ad('0x6a')],function(_0x59f768){return util['format'](_0x54ad('0x6d'),_0x59f768['id']);}));_0x3386f4[_0x54ad('0x35')]=_['keys'](_0x178363[_0x54ad('0x35')]);_0x3386f4['filters']=_[_0x54ad('0x38')](_0x3386f4[_0x54ad('0x34')],_0x3386f4[_0x54ad('0x35')]);_0x53d372[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x3386f4[_0x54ad('0x34')],qs[_0x54ad('0x39')](_0x178363[_0x54ad('0x35')][_0x54ad('0x39')]));_0x53d372[_0x54ad('0x3a')]=_0x53d372['attributes'][_0x54ad('0x3b')]?_0x53d372[_0x54ad('0x3a')]:_0x3386f4[_0x54ad('0x34')];if(!_0x178363[_0x54ad('0x35')]['hasOwnProperty'](_0x54ad('0x3d'))){_0x53d372[_0x54ad('0x23')]=qs[_0x54ad('0x23')](_0x178363[_0x54ad('0x35')][_0x54ad('0x23')]);_0x53d372[_0x54ad('0x22')]=qs[_0x54ad('0x22')](_0x178363[_0x54ad('0x35')][_0x54ad('0x22')]);}_0x53d372['order']=qs[_0x54ad('0x3f')](_0x178363['query'][_0x54ad('0x3f')]);_0x53d372[_0x54ad('0x40')]=qs['filters'](_[_0x54ad('0x41')](_0x178363[_0x54ad('0x35')],_0x3386f4['filters']));_0x53d372['raw']=!![];if(_0x178363[_0x54ad('0x35')]['filter']){_0x53d372[_0x54ad('0x40')]=_['merge'](_0x53d372[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x53d372['attributes'],function(_0x55a9d0){var _0x44ba38={};_0x44ba38[_0x55a9d0]={'$like':'%'+_0x178363[_0x54ad('0x35')]['filter']+'%'};return _0x44ba38;})});}_0x53d372=_[_0x54ad('0x43')]({},_0x53d372,_0x178363['options']);return _0x3f405e[_0x54ad('0x69')](_0x53d372);}})[_0x54ad('0x2a')](function(_0x4f4ca4){if(!_[_0x54ad('0x71')](_0x4f4ca4)){var _0x1c4880=toCsv(_0x4f4ca4);var _0x19709e=Date[_0x54ad('0x72')]();fs[_0x54ad('0x73')](util[_0x54ad('0x6c')](_0x54ad('0x74'),_0x3f405e['id'],_0x19709e),_0x1c4880);_0x5e2649[_0x54ad('0x75')](_0x54ad('0x76'),'attachment;\x20filename='+util[_0x54ad('0x6c')](_0x54ad('0x77'),_0x3f405e['id'],_0x19709e));_0x5e2649[_0x54ad('0x75')](_0x54ad('0x78'),_0x54ad('0x79'));return _0x5e2649[_0x54ad('0x7a')](util[_0x54ad('0x6c')](_0x54ad('0x74'),_0x3f405e['id'],_0x19709e));}else{return _0x5e2649[_0x54ad('0x1d')](0xcc);}})[_0x54ad('0x4b')](handleError(_0x5e2649,null));};exports[_0x54ad('0x7b')]=function(_0x550acf,_0x33d2af,_0x5c8249){var _0x47d474;delete _0x550acf[_0x54ad('0x4f')]['id'];return db[_0x54ad('0x46')][_0x54ad('0x5d')]({'where':{'id':_0x550acf[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x33d2af,null))[_0x54ad('0x2a')](function(_0x50cbb2){if(_0x50cbb2){return db[_0x54ad('0x7c')][_0x54ad('0x7d')](function(_0x5d54b7){return db[_0x54ad('0x70')][_0x54ad('0x4e')](_0x550acf[_0x54ad('0x4f')],{'transaction':_0x5d54b7})[_0x54ad('0x2a')](function(_0x1ea85e){_0x47d474=_0x1ea85e;return _0x50cbb2[_0x54ad('0x7e')](_0x1ea85e,{'transaction':_0x5d54b7});})[_0x54ad('0x2a')](function(){var _0x3d85b4={'type':db[_0x54ad('0x7f')][_0x54ad('0x80')],'transaction':_0x5d54b7};switch(_0x550acf[_0x54ad('0x4f')]['type']){case'text':_0x3d85b4['type']=db['Sequelize'][_0x54ad('0x80')];break;case _0x54ad('0x81'):_0x3d85b4[_0x54ad('0x44')]=db[_0x54ad('0x7f')]['INTEGER'];break;case'switch':_0x3d85b4[_0x54ad('0x44')]=db[_0x54ad('0x7f')][_0x54ad('0x82')];_0x3d85b4[_0x54ad('0x83')]=![];break;default:}return db[_0x54ad('0x7c')]['queryInterface']['addColumn']('cm_contacts',util[_0x54ad('0x6c')](_0x54ad('0x84'),_0x47d474['id']),_0x3d85b4);})[_0x54ad('0x2a')](function(){return _0x47d474;});});}})[_0x54ad('0x2a')](respondWithResult(_0x33d2af,null))['catch'](handleError(_0x33d2af,null));};exports[_0x54ad('0x85')]=function(_0x198159,_0x2ab9ed,_0x559ff1){var _0x5b8b7d={};var _0x595028={};var _0x674cf6;var _0x75ab3;return db[_0x54ad('0x46')]['findOne']({'where':{'id':_0x198159[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x2ab9ed,null))[_0x54ad('0x2a')](function(_0x12b3e6){if(_0x12b3e6){_0x674cf6=_0x12b3e6;_0x595028[_0x54ad('0x34')]=_['keys'](db[_0x54ad('0x70')][_0x54ad('0x31')]);_0x595028['query']=_[_0x54ad('0x36')](_0x198159['query']);_0x595028[_0x54ad('0x37')]=_[_0x54ad('0x38')](_0x595028[_0x54ad('0x34')],_0x595028['query']);_0x5b8b7d[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x595028[_0x54ad('0x34')],qs['fields'](_0x198159[_0x54ad('0x35')][_0x54ad('0x39')]));_0x5b8b7d[_0x54ad('0x3a')]=_0x5b8b7d['attributes'][_0x54ad('0x3b')]?_0x5b8b7d[_0x54ad('0x3a')]:_0x595028[_0x54ad('0x34')];_0x5b8b7d['order']=qs[_0x54ad('0x3f')](_0x198159['query'][_0x54ad('0x3f')]);_0x5b8b7d[_0x54ad('0x40')]=qs[_0x54ad('0x37')](_[_0x54ad('0x41')](_0x198159['query'],_0x595028[_0x54ad('0x37')]));_0x5b8b7d[_0x54ad('0x40')]=_[_0x54ad('0x43')](_0x5b8b7d[_0x54ad('0x40')],{'$or':[{'ListId':_0x12b3e6['id']},{'ListId':null}]});if(_0x198159[_0x54ad('0x35')][_0x54ad('0x42')]){_0x5b8b7d[_0x54ad('0x40')]=_[_0x54ad('0x43')](_0x5b8b7d[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x5b8b7d[_0x54ad('0x3a')],function(_0x5f1fc4){var _0x31d074={};_0x31d074[_0x5f1fc4]={'$like':'%'+_0x198159['query']['filter']+'%'};return _0x31d074;})});}_0x5b8b7d=_[_0x54ad('0x43')]({},_0x5b8b7d,_0x198159[_0x54ad('0x45')]);return db[_0x54ad('0x70')][_0x54ad('0x86')](_0x5b8b7d);}})[_0x54ad('0x2a')](respondWithResult(_0x2ab9ed,null))[_0x54ad('0x4b')](handleError(_0x2ab9ed,null));};exports[_0x54ad('0x87')]=function(_0x12259b,_0x5d8d2f,_0x2b7f7a){return db['CmList'][_0x54ad('0x54')]({'where':{'id':_0x12259b['params']['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x5d8d2f,null))[_0x54ad('0x2a')](function(_0x50683b){if(_0x50683b){return _0x50683b[_0x54ad('0x87')](_0x12259b[_0x54ad('0x4f')][_0x54ad('0x88')],_[_0x54ad('0x65')](_0x12259b[_0x54ad('0x4f')],[_0x54ad('0x88'),'id'])||{})[_0x54ad('0x89')](function(_0x4a9ad0){for(var _0x9c0c12=0x0;_0x9c0c12<_0x12259b['body']['ids'][_0x54ad('0x3b')];_0x9c0c12+=0x1){socket[_0x54ad('0x8a')](_0x54ad('0x8b'),{'UserId':_0x12259b['body'][_0x54ad('0x88')][_0x9c0c12],'CmListId':_0x12259b[_0x54ad('0x4d')]['id']});}return _0x4a9ad0;});}})['then'](respondWithResult(_0x5d8d2f,null))[_0x54ad('0x4b')](handleError(_0x5d8d2f,null));};exports[_0x54ad('0x8c')]=function(_0x5b9145,_0x26c542,_0x82551e){return db['CmList'][_0x54ad('0x54')]({'where':{'id':_0x5b9145[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x26c542,null))[_0x54ad('0x2a')](function(_0x4d9eda){if(_0x4d9eda){return _0x4d9eda[_0x54ad('0x8c')](_0x5b9145[_0x54ad('0x35')][_0x54ad('0x88')])[_0x54ad('0x2a')](function(){if(_[_0x54ad('0x62')](_0x5b9145['query'][_0x54ad('0x88')])){for(var _0x1f4ee8=0x0;_0x1f4ee8<_0x5b9145[_0x54ad('0x35')]['ids'][_0x54ad('0x3b')];_0x1f4ee8+=0x1){socket[_0x54ad('0x8a')](_0x54ad('0x8d'),{'UserId':Number(_0x5b9145['query'][_0x54ad('0x88')][_0x1f4ee8]),'CmListId':Number(_0x5b9145[_0x54ad('0x4d')]['id'])});}}else{socket['emit'](_0x54ad('0x8d'),{'UserId':Number(_0x5b9145[_0x54ad('0x35')][_0x54ad('0x88')]),'CmListId':Number(_0x5b9145['params']['id'])});}});}})['then'](respondWithStatusCode(_0x26c542,null))['catch'](handleError(_0x26c542,null));};exports[_0x54ad('0x8e')]=function(_0x161941,_0x59f385,_0x33561f){var _0x3da7d9={};var _0x2ad5c1={};var _0x265942;var _0x4c1278;return db[_0x54ad('0x46')][_0x54ad('0x5d')]({'where':{'id':_0x161941['params']['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x59f385,null))[_0x54ad('0x2a')](function(_0x27ff18){if(_0x27ff18){_0x265942=_0x27ff18;_0x2ad5c1['model']=_['keys'](db[_0x54ad('0x8f')][_0x54ad('0x31')]);_0x2ad5c1[_0x54ad('0x35')]=_[_0x54ad('0x36')](_0x161941[_0x54ad('0x35')]);_0x2ad5c1[_0x54ad('0x37')]=_['intersection'](_0x2ad5c1['model'],_0x2ad5c1['query']);_0x3da7d9[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x2ad5c1[_0x54ad('0x34')],qs[_0x54ad('0x39')](_0x161941['query'][_0x54ad('0x39')]));_0x3da7d9['attributes']=_0x3da7d9[_0x54ad('0x3a')]['length']?_0x3da7d9['attributes']:_0x2ad5c1[_0x54ad('0x34')];_0x3da7d9[_0x54ad('0x3e')]=qs[_0x54ad('0x3f')](_0x161941[_0x54ad('0x35')]['sort']);_0x3da7d9['where']=qs['filters'](_[_0x54ad('0x41')](_0x161941[_0x54ad('0x35')],_0x2ad5c1[_0x54ad('0x37')]));if(_0x161941[_0x54ad('0x35')][_0x54ad('0x42')]){_0x3da7d9[_0x54ad('0x40')]=_[_0x54ad('0x43')](_0x3da7d9[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x3da7d9[_0x54ad('0x3a')],function(_0x1c5959){var _0x4ac771={};_0x4ac771[_0x1c5959]={'$like':'%'+_0x161941[_0x54ad('0x35')]['filter']+'%'};return _0x4ac771;})});}_0x3da7d9=_['merge']({},_0x3da7d9,_0x161941[_0x54ad('0x45')]);return _0x265942['getAgents'](_0x3da7d9);}})[_0x54ad('0x2a')](function(_0xaf60bb){if(_0xaf60bb){_0x4c1278=_0xaf60bb[_0x54ad('0x3b')];if(!_0x161941[_0x54ad('0x35')]['hasOwnProperty'](_0x54ad('0x3d'))){_0x3da7d9['limit']=qs[_0x54ad('0x23')](_0x161941['query'][_0x54ad('0x23')]);_0x3da7d9[_0x54ad('0x22')]=qs[_0x54ad('0x22')](_0x161941[_0x54ad('0x35')][_0x54ad('0x22')]);}return _0x265942[_0x54ad('0x8e')](_0x3da7d9);}})[_0x54ad('0x2a')](function(_0x1d59b4){if(_0x1d59b4){return _0x1d59b4?{'count':_0x4c1278,'rows':_0x1d59b4}:null;}})[_0x54ad('0x2a')](respondWithResult(_0x59f385,null))[_0x54ad('0x4b')](handleError(_0x59f385,null));}; \ No newline at end of file +var _0x9b28=['userCmList:remove','User','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','Lists','error','stack','send','map','CmList','rawAttributes','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','order','ListId','removeDispositions','ids','addContacts','tags','isArray','join','CmContact','omit','push','errors','message','Malformed\x20request\x20syntax','concat','CustomFields','format','hasOwnProperty','getContactsCsv','CmCustomField','cf_%d','getContacts','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents'];(function(_0x4cb7b9,_0x4f838f){var _0x2d1ceb=function(_0x4cc29e){while(--_0x4cc29e){_0x4cb7b9['push'](_0x4cb7b9['shift']());}};_0x2d1ceb(++_0x4f838f);}(_0x9b28,0x125));var _0x89b2=function(_0x225eb9,_0x3ee6d8){_0x225eb9=_0x225eb9-0x0;var _0x18a5b6=_0x9b28[_0x225eb9];return _0x18a5b6;};'use strict';var pdf=require(_0x89b2('0x0'));var emlformat=require(_0x89b2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x89b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89b2('0x3'));var moment=require(_0x89b2('0x4'));var BPromise=require(_0x89b2('0x5'));var Mustache=require(_0x89b2('0x6'));var util=require(_0x89b2('0x7'));var path=require(_0x89b2('0x8'));var sox=require(_0x89b2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x89b2('0xa'));var jsforce=require(_0x89b2('0xb'));var deskjs=require(_0x89b2('0xc'));var toCsv=require(_0x89b2('0xd'));var querystring=require(_0x89b2('0xe'));var Papa=require(_0x89b2('0xf'));var Redis=require(_0x89b2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x89b2('0x11'));var hardwareService=require(_0x89b2('0x12'));var logger=require(_0x89b2('0x13'))(_0x89b2('0x14'));var utils=require(_0x89b2('0x15'));var config=require(_0x89b2('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x89b2('0x17')](config[_0x89b2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x89b2('0x19'))(new Redis(config[_0x89b2('0x18')]));require(_0x89b2('0x1a'))[_0x89b2('0x1b')](socket);function respondWithStatusCode(_0x149dc2,_0x56e67c){_0x56e67c=_0x56e67c||0xcc;return function(_0x5ee500){if(_0x5ee500){return _0x149dc2[_0x89b2('0x1c')](_0x56e67c);}return _0x149dc2[_0x89b2('0x1d')](_0x56e67c)[_0x89b2('0x1e')]();};}function respondWithResult(_0x43c60f,_0xb8abc9){_0xb8abc9=_0xb8abc9||0xc8;return function(_0x400414){if(_0x400414){return _0x43c60f[_0x89b2('0x1d')](_0xb8abc9)[_0x89b2('0x1f')](_0x400414);}};}function respondWithFilteredResult(_0x18a4d9,_0x55f380){return function(_0x1bdf83){if(_0x1bdf83){var _0x5dac0f=_0x1bdf83[_0x89b2('0x20')],_0x47fc7f=_0x55f380[_0x89b2('0x21')],_0x528391=_0x55f380[_0x89b2('0x21')]+_0x55f380[_0x89b2('0x22')],_0xefa1f2;if(_0x528391>=_0x5dac0f){_0x528391=_0x5dac0f;_0xefa1f2=0xc8;}else{_0xefa1f2=0xce;}_0x18a4d9['status'](_0xefa1f2);return _0x18a4d9['set'](_0x89b2('0x23'),_0x47fc7f+'-'+_0x528391+'/'+_0x5dac0f)['json'](_0x1bdf83);}return null;};}function patchUpdates(_0x3be6a7){return function(_0x172cba){try{jsonpatch[_0x89b2('0x24')](_0x172cba,_0x3be6a7,!![]);}catch(_0x92f5ad){return BPromise[_0x89b2('0x25')](_0x92f5ad);}return _0x172cba[_0x89b2('0x26')]();};}function saveUpdates(_0x4f0565,_0x332403){return function(_0x18fb49){if(_0x18fb49){return _0x18fb49[_0x89b2('0x27')](_0x4f0565)[_0x89b2('0x28')](function(_0x225786){return _0x225786;});}return null;};}function removeEntity(_0x255902,_0x56c34e){return function(_0x26867b){if(_0x26867b){return _0x26867b[_0x89b2('0x29')]()[_0x89b2('0x28')](function(){var _0x2adf54=_0x26867b['get']({'plain':!![]});var _0x1c5517=_0x89b2('0x2a');return db['UserProfileResource'][_0x89b2('0x29')]({'where':{'type':_0x1c5517,'resourceId':_0x2adf54['id']}})[_0x89b2('0x28')](function(){return _0x26867b;});})[_0x89b2('0x28')](function(){_0x255902[_0x89b2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cdda0,_0x18e32e){return function(_0xafc63){if(!_0xafc63){_0x3cdda0['sendStatus'](0x194);}return _0xafc63;};}function handleError(_0x46f571,_0x4895d0){_0x4895d0=_0x4895d0||0x1f4;return function(_0x52d53f){logger[_0x89b2('0x2b')](_0x52d53f[_0x89b2('0x2c')]);if(_0x52d53f['name']){delete _0x52d53f['name'];}_0x46f571[_0x89b2('0x1d')](_0x4895d0)[_0x89b2('0x2d')](_0x52d53f);};}exports['index']=function(_0x592217,_0x42ea48){var _0x4624a1={},_0x4a7d59={},_0xdba074={'count':0x0,'rows':[]};var _0xa9d19d=_[_0x89b2('0x2e')](db[_0x89b2('0x2f')][_0x89b2('0x30')],function(_0x314be5){return{'name':_0x314be5['fieldName'],'type':_0x314be5[_0x89b2('0x31')][_0x89b2('0x32')]};});_0x4a7d59[_0x89b2('0x33')]=_[_0x89b2('0x2e')](_0xa9d19d,_0x89b2('0x34'));_0x4a7d59['query']=_[_0x89b2('0x35')](_0x592217[_0x89b2('0x36')]);_0x4a7d59[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x4a7d59['model'],_0x4a7d59[_0x89b2('0x36')]);_0x4624a1['attributes']=_['intersection'](_0x4a7d59[_0x89b2('0x33')],qs['fields'](_0x592217['query'][_0x89b2('0x39')]));_0x4624a1[_0x89b2('0x3a')]=_0x4624a1[_0x89b2('0x3a')][_0x89b2('0x3b')]?_0x4624a1[_0x89b2('0x3a')]:_0x4a7d59['model'];if(!_0x592217[_0x89b2('0x36')]['hasOwnProperty'](_0x89b2('0x3c'))){_0x4624a1[_0x89b2('0x22')]=qs['limit'](_0x592217[_0x89b2('0x36')]['limit']);_0x4624a1[_0x89b2('0x21')]=qs[_0x89b2('0x21')](_0x592217[_0x89b2('0x36')]['offset']);}_0x4624a1['order']=qs[_0x89b2('0x3d')](_0x592217[_0x89b2('0x36')][_0x89b2('0x3d')]);_0x4624a1[_0x89b2('0x3e')]=qs[_0x89b2('0x37')](_[_0x89b2('0x3f')](_0x592217['query'],_0x4a7d59[_0x89b2('0x37')]),_0xa9d19d);if(_0x592217[_0x89b2('0x36')][_0x89b2('0x40')]){_0x4624a1['where']=_[_0x89b2('0x41')](_0x4624a1[_0x89b2('0x3e')],{'$or':_[_0x89b2('0x2e')](_0xa9d19d,function(_0x21b32d){if(_0x21b32d[_0x89b2('0x31')]!==_0x89b2('0x42')){var _0x2fdb23={};_0x2fdb23[_0x21b32d[_0x89b2('0x34')]]={'$like':'%'+_0x592217[_0x89b2('0x36')][_0x89b2('0x40')]+'%'};return _0x2fdb23;}})});}_0x4624a1=_[_0x89b2('0x41')]({},_0x4624a1,_0x592217[_0x89b2('0x43')]);var _0x616f50={'where':_0x4624a1[_0x89b2('0x3e')]};return db[_0x89b2('0x2f')]['count'](_0x616f50)[_0x89b2('0x28')](function(_0x207611){_0xdba074[_0x89b2('0x20')]=_0x207611;if(_0x592217[_0x89b2('0x36')][_0x89b2('0x44')]){_0x4624a1[_0x89b2('0x45')]=[{'all':!![]}];}return db[_0x89b2('0x2f')][_0x89b2('0x46')](_0x4624a1);})['then'](function(_0x466bdf){_0xdba074[_0x89b2('0x47')]=_0x466bdf;return _0xdba074;})[_0x89b2('0x28')](respondWithFilteredResult(_0x42ea48,_0x4624a1))['catch'](handleError(_0x42ea48,null));};exports[_0x89b2('0x48')]=function(_0x56a862,_0x1b8928){var _0x53bc73={'raw':![],'where':{'id':_0x56a862['params']['id']}},_0x49dcb3={};_0x49dcb3[_0x89b2('0x33')]=_['keys'](db[_0x89b2('0x2f')][_0x89b2('0x30')]);_0x49dcb3[_0x89b2('0x36')]=_['keys'](_0x56a862['query']);_0x49dcb3[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x49dcb3[_0x89b2('0x33')],_0x49dcb3[_0x89b2('0x36')]);_0x53bc73[_0x89b2('0x3a')]=_['intersection'](_0x49dcb3[_0x89b2('0x33')],qs[_0x89b2('0x39')](_0x56a862[_0x89b2('0x36')][_0x89b2('0x39')]));_0x53bc73[_0x89b2('0x3a')]=_0x53bc73[_0x89b2('0x3a')][_0x89b2('0x3b')]?_0x53bc73[_0x89b2('0x3a')]:_0x49dcb3[_0x89b2('0x33')];if(_0x56a862[_0x89b2('0x36')][_0x89b2('0x44')]){_0x53bc73['include']=[{'all':!![]}];}_0x53bc73=_[_0x89b2('0x41')]({},_0x53bc73,_0x56a862[_0x89b2('0x43')]);return db['CmList']['find'](_0x53bc73)[_0x89b2('0x28')](handleEntityNotFound(_0x1b8928,null))[_0x89b2('0x28')](respondWithResult(_0x1b8928,null))[_0x89b2('0x49')](handleError(_0x1b8928,null));};exports[_0x89b2('0x4a')]=function(_0x2851f2,_0x473caa){return db['CmList'][_0x89b2('0x4a')](_0x2851f2[_0x89b2('0x4b')],{})['then'](function(_0x53bb05){var _0x254108=_0x2851f2['user'][_0x89b2('0x4c')]({'plain':!![]});if(!_0x254108)throw new Error(_0x89b2('0x4d'));if(_0x254108[_0x89b2('0x4e')]===_0x89b2('0x4f')){var _0xba7d06=_0x53bb05[_0x89b2('0x4c')]({'plain':!![]});var _0xe6b520=_0x89b2('0x2a');return db['UserProfileSection'][_0x89b2('0x50')]({'where':{'name':_0xe6b520,'userProfileId':_0x254108[_0x89b2('0x51')]},'raw':!![]})[_0x89b2('0x28')](function(_0x2058f6){if(_0x2058f6&&_0x2058f6[_0x89b2('0x52')]===0x0){return db[_0x89b2('0x53')][_0x89b2('0x4a')]({'name':_0xba7d06['name'],'resourceId':_0xba7d06['id'],'type':_0x2058f6[_0x89b2('0x34')],'sectionId':_0x2058f6['id']},{})[_0x89b2('0x28')](function(){return _0x53bb05;});}else{return _0x53bb05;}})[_0x89b2('0x49')](function(_0x27638a){logger[_0x89b2('0x2b')](_0x89b2('0x54'),_0x27638a);throw _0x27638a;});}return _0x53bb05;})[_0x89b2('0x28')](respondWithResult(_0x473caa,0xc9))[_0x89b2('0x49')](handleError(_0x473caa,null));};exports[_0x89b2('0x27')]=function(_0x5851f2,_0x5bd3fe){if(_0x5851f2['body']['id']){delete _0x5851f2[_0x89b2('0x4b')]['id'];}return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x5851f2[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x5bd3fe,null))[_0x89b2('0x28')](saveUpdates(_0x5851f2['body'],null))[_0x89b2('0x28')](respondWithResult(_0x5bd3fe,null))[_0x89b2('0x49')](handleError(_0x5bd3fe,null));};exports[_0x89b2('0x29')]=function(_0x5e51de,_0x3d266e){return db[_0x89b2('0x2f')]['find']({'where':{'id':_0x5e51de[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x3d266e,null))['then'](removeEntity(_0x3d266e,null))[_0x89b2('0x49')](handleError(_0x3d266e,null));};exports[_0x89b2('0x56')]=function(_0x30ca68,_0x5b2599){return db[_0x89b2('0x2f')][_0x89b2('0x56')]()[_0x89b2('0x28')](respondWithResult(_0x5b2599,null))['catch'](handleError(_0x5b2599,null));};exports[_0x89b2('0x57')]=function(_0x6111e8,_0x42a96c,_0x528efd){if(_0x6111e8[_0x89b2('0x4b')]['id']){delete _0x6111e8['body']['id'];}return db[_0x89b2('0x2f')]['find']({'where':{'id':_0x6111e8[_0x89b2('0x55')]['id']}})['then'](handleEntityNotFound(_0x42a96c,null))[_0x89b2('0x28')](function(_0x34078b){if(_0x34078b){_0x6111e8['body']['ListId']=_0x34078b['id'];return db[_0x89b2('0x58')][_0x89b2('0x4a')](_0x6111e8[_0x89b2('0x4b')]);}})[_0x89b2('0x28')](respondWithResult(_0x42a96c,null))[_0x89b2('0x49')](handleError(_0x42a96c,null));};exports[_0x89b2('0x59')]=function(_0x54d19e,_0x5b67cf,_0x3a10e9){var _0xafa889={'raw':![],'where':{}};var _0x5113bd={};var _0x5f2315={'count':0x0,'rows':[]};return db[_0x89b2('0x2f')][_0x89b2('0x5a')]({'where':{'id':_0x54d19e['params']['id']}})['then'](handleEntityNotFound(_0x5b67cf,null))[_0x89b2('0x28')](function(_0x19824c){if(_0x19824c){_0x5113bd[_0x89b2('0x33')]=_[_0x89b2('0x35')](db[_0x89b2('0x58')][_0x89b2('0x30')]);_0x5113bd[_0x89b2('0x36')]=_[_0x89b2('0x35')](_0x54d19e[_0x89b2('0x36')]);_0x5113bd[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x5113bd['model'],_0x5113bd[_0x89b2('0x36')]);_0xafa889['attributes']=_[_0x89b2('0x38')](_0x5113bd['model'],qs[_0x89b2('0x39')](_0x54d19e[_0x89b2('0x36')]['fields']));_0xafa889[_0x89b2('0x3a')]=_0xafa889[_0x89b2('0x3a')]['length']?_0xafa889['attributes']:_0x5113bd[_0x89b2('0x33')];if(!_0x54d19e['query']['hasOwnProperty']('nolimit')){_0xafa889['limit']=qs[_0x89b2('0x22')](_0x54d19e[_0x89b2('0x36')][_0x89b2('0x22')]);_0xafa889[_0x89b2('0x21')]=qs[_0x89b2('0x21')](_0x54d19e[_0x89b2('0x36')][_0x89b2('0x21')]);}_0xafa889[_0x89b2('0x5b')]=qs[_0x89b2('0x3d')](_0x54d19e[_0x89b2('0x36')][_0x89b2('0x3d')]);_0xafa889[_0x89b2('0x3e')]=qs[_0x89b2('0x37')](_[_0x89b2('0x3f')](_0x54d19e['query'],_0x5113bd[_0x89b2('0x37')]));_0xafa889[_0x89b2('0x3e')][_0x89b2('0x5c')]=_0x19824c['id'];if(_0x54d19e[_0x89b2('0x36')][_0x89b2('0x40')]){_0xafa889['where']=_[_0x89b2('0x41')](_0xafa889[_0x89b2('0x3e')],{'$or':_[_0x89b2('0x2e')](_0xafa889['attributes'],function(_0x7c2d6){var _0x2d1866={};_0x2d1866[_0x7c2d6]={'$like':'%'+_0x54d19e[_0x89b2('0x36')][_0x89b2('0x40')]+'%'};return _0x2d1866;})});}_0xafa889=_[_0x89b2('0x41')]({},_0xafa889,_0x54d19e[_0x89b2('0x43')]);return db['Disposition']['count']({'where':_0xafa889[_0x89b2('0x3e')]})[_0x89b2('0x28')](function(_0x1cd181){_0x5f2315[_0x89b2('0x20')]=_0x1cd181;if(_0x54d19e[_0x89b2('0x36')][_0x89b2('0x44')]){_0xafa889['include']=[{'all':!![]}];}return db[_0x89b2('0x58')]['findAll'](_0xafa889);})[_0x89b2('0x28')](function(_0x4d1c44){_0x5f2315[_0x89b2('0x47')]=_0x4d1c44;return _0x5f2315;});}})[_0x89b2('0x28')](respondWithFilteredResult(_0x5b67cf,_0xafa889))[_0x89b2('0x49')](handleError(_0x5b67cf,null));};exports[_0x89b2('0x5d')]=function(_0x2d31f8,_0x59e503,_0x361e45){return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x2d31f8['params']['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x59e503,null))['then'](function(_0x49b322){if(_0x49b322){return _0x49b322[_0x89b2('0x5d')](_0x2d31f8['query'][_0x89b2('0x5e')]);}})[_0x89b2('0x28')](respondWithStatusCode(_0x59e503,null))['catch'](handleError(_0x59e503,null));};exports[_0x89b2('0x5f')]=function(_0x29764f,_0x352288,_0x1e3d2c){return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x29764f['params']['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x352288,null))[_0x89b2('0x28')](function(_0x1ce813){if(_0x1ce813){var _0x409058=[];var _0x2a4d51={'success':[],'errors':[]};return db['CmContact'][_0x89b2('0x56')]()[_0x89b2('0x28')](function(_0x137494){if(_0x29764f['body'][_0x89b2('0x60')]&&_[_0x89b2('0x61')](_0x29764f[_0x89b2('0x4b')][_0x89b2('0x60')])){if(_0x29764f['body'][_0x89b2('0x60')][_0x89b2('0x3b')]){_0x29764f[_0x89b2('0x4b')]['tags']=_0x29764f[_0x89b2('0x4b')][_0x89b2('0x60')][_0x89b2('0x62')](';')+';';}else{_0x29764f[_0x89b2('0x4b')][_0x89b2('0x60')]=null;}}else{_0x29764f[_0x89b2('0x4b')][_0x89b2('0x60')]=null;}if(_0x29764f[_0x89b2('0x4b')]&&_[_0x89b2('0x61')](_0x29764f[_0x89b2('0x4b')])){for(var _0x201f62=0x0;_0x201f62<_0x29764f[_0x89b2('0x4b')]['length'];_0x201f62+=0x1){_0x29764f[_0x89b2('0x4b')][_0x201f62][_0x89b2('0x5c')]=_0x29764f[_0x89b2('0x55')]['id'];_0x409058['push'](_0x29764f[_0x89b2('0x4b')][_0x201f62]);}return BPromise['each'](_0x409058,function(_0x200c17){return db[_0x89b2('0x63')][_0x89b2('0x4a')](_[_0x89b2('0x64')](_0x200c17,[_0x89b2('0x5e'),'id'])||{},{'fields':_[_0x89b2('0x35')](_0x137494),'raw':!![]})[_0x89b2('0x28')](function(_0x406190){_0x2a4d51['success'][_0x89b2('0x65')](_0x406190['dataValues']);})[_0x89b2('0x49')](function(_0x3610e1){_0x2a4d51[_0x89b2('0x66')][_0x89b2('0x65')]({'data':_0x200c17,'error':_0x3610e1[_0x89b2('0x67')]});});})[_0x89b2('0x28')](function(_0x5b6b67){return _0x2a4d51;})[_0x89b2('0x49')](function(_0x19f8a8){return _0x19f8a8;});}else{_0x352288['status'](0x190)[_0x89b2('0x1f')]({'message':_0x89b2('0x68')});}});}})['then'](respondWithResult(_0x352288,null))[_0x89b2('0x49')](handleError(_0x352288,null));};exports['getContacts']=function(_0x38dac,_0x22a509,_0x3ba476){var _0x457661;return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x38dac[_0x89b2('0x55')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x89b2('0x28')](handleEntityNotFound(_0x22a509,null))[_0x89b2('0x28')](function(_0x4872bf){if(_0x4872bf){_0x457661=_0x4872bf;return db[_0x89b2('0x63')][_0x89b2('0x30')];}})['then'](function(_0x20fd81){if(_0x20fd81){var _0x398fb6={};var _0x490413={};_0x490413[_0x89b2('0x33')]=_[_0x89b2('0x69')](_['keys'](_0x20fd81),_[_0x89b2('0x2e')](_0x457661[_0x89b2('0x6a')],function(_0x67097c){return util[_0x89b2('0x6b')]('cf_%d',_0x67097c['id']);}));_0x490413['query']=_['keys'](_0x38dac[_0x89b2('0x36')]);_0x490413['filters']=_[_0x89b2('0x38')](_0x490413[_0x89b2('0x33')],_0x490413[_0x89b2('0x36')]);_0x398fb6[_0x89b2('0x3a')]=_[_0x89b2('0x38')](_0x490413[_0x89b2('0x33')],qs[_0x89b2('0x39')](_0x38dac[_0x89b2('0x36')][_0x89b2('0x39')]));_0x398fb6[_0x89b2('0x3a')]=_0x398fb6['attributes'][_0x89b2('0x3b')]?_0x398fb6[_0x89b2('0x3a')]:_0x490413['model'];if(!_0x38dac[_0x89b2('0x36')][_0x89b2('0x6c')](_0x89b2('0x3c'))){_0x398fb6[_0x89b2('0x22')]=qs[_0x89b2('0x22')](_0x38dac[_0x89b2('0x36')]['limit']);_0x398fb6[_0x89b2('0x21')]=qs[_0x89b2('0x21')](_0x38dac[_0x89b2('0x36')]['offset']);}_0x398fb6['order']=qs[_0x89b2('0x3d')](_0x38dac[_0x89b2('0x36')][_0x89b2('0x3d')]);_0x398fb6[_0x89b2('0x3e')]=qs[_0x89b2('0x37')](_[_0x89b2('0x3f')](_0x38dac[_0x89b2('0x36')],_0x490413[_0x89b2('0x37')]));_0x398fb6['raw']=!![];if(_0x38dac[_0x89b2('0x36')][_0x89b2('0x40')]){_0x398fb6[_0x89b2('0x3e')]=_['merge'](_0x398fb6[_0x89b2('0x3e')],{'$or':_['map'](_0x398fb6[_0x89b2('0x3a')],function(_0x18863f){var _0x5cef3a={};_0x5cef3a[_0x18863f]={'$like':'%'+_0x38dac[_0x89b2('0x36')]['filter']+'%'};return _0x5cef3a;})});}_0x398fb6=_[_0x89b2('0x41')]({},_0x398fb6,_0x38dac[_0x89b2('0x43')]);return _0x457661['getContacts'](_0x398fb6);}})['then'](respondWithResult(_0x22a509,null))[_0x89b2('0x49')](handleError(_0x22a509,null));};exports[_0x89b2('0x6d')]=function(_0x2b201e,_0x5a5a7b,_0xb56a3f){var _0x5c4692;return db[_0x89b2('0x2f')]['find']({'where':{'id':_0x2b201e[_0x89b2('0x55')]['id']},'include':[{'model':db[_0x89b2('0x6e')],'as':_0x89b2('0x6a')}]})['then'](handleEntityNotFound(_0x5a5a7b,null))[_0x89b2('0x28')](function(_0x44dc65){if(_0x44dc65){_0x5c4692=_0x44dc65;return db['CmContact'][_0x89b2('0x30')];}})[_0x89b2('0x28')](function(_0x20d15d){if(_0x20d15d){var _0x2c83db={};var _0x9e9b10={};_0x9e9b10[_0x89b2('0x33')]=_[_0x89b2('0x69')](_[_0x89b2('0x35')](_0x20d15d),_[_0x89b2('0x2e')](_0x5c4692[_0x89b2('0x6a')],function(_0x5f56ff){return util[_0x89b2('0x6b')](_0x89b2('0x6f'),_0x5f56ff['id']);}));_0x9e9b10[_0x89b2('0x36')]=_[_0x89b2('0x35')](_0x2b201e[_0x89b2('0x36')]);_0x9e9b10[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x9e9b10[_0x89b2('0x33')],_0x9e9b10[_0x89b2('0x36')]);_0x2c83db['attributes']=_['intersection'](_0x9e9b10['model'],qs['fields'](_0x2b201e[_0x89b2('0x36')][_0x89b2('0x39')]));_0x2c83db['attributes']=_0x2c83db[_0x89b2('0x3a')]['length']?_0x2c83db[_0x89b2('0x3a')]:_0x9e9b10['model'];if(!_0x2b201e[_0x89b2('0x36')][_0x89b2('0x6c')](_0x89b2('0x3c'))){_0x2c83db[_0x89b2('0x22')]=qs['limit'](_0x2b201e[_0x89b2('0x36')][_0x89b2('0x22')]);_0x2c83db[_0x89b2('0x21')]=qs[_0x89b2('0x21')](_0x2b201e[_0x89b2('0x36')][_0x89b2('0x21')]);}_0x2c83db[_0x89b2('0x5b')]=qs[_0x89b2('0x3d')](_0x2b201e[_0x89b2('0x36')][_0x89b2('0x3d')]);_0x2c83db[_0x89b2('0x3e')]=qs['filters'](_['pick'](_0x2b201e['query'],_0x9e9b10[_0x89b2('0x37')]));_0x2c83db['raw']=!![];if(_0x2b201e[_0x89b2('0x36')][_0x89b2('0x40')]){_0x2c83db[_0x89b2('0x3e')]=_[_0x89b2('0x41')](_0x2c83db[_0x89b2('0x3e')],{'$or':_[_0x89b2('0x2e')](_0x2c83db['attributes'],function(_0x4c5330){var _0x27c947={};_0x27c947[_0x4c5330]={'$like':'%'+_0x2b201e[_0x89b2('0x36')][_0x89b2('0x40')]+'%'};return _0x27c947;})});}_0x2c83db=_[_0x89b2('0x41')]({},_0x2c83db,_0x2b201e['options']);return _0x5c4692[_0x89b2('0x70')](_0x2c83db);}})[_0x89b2('0x28')](function(_0x1d00e8){if(!_[_0x89b2('0x71')](_0x1d00e8)){var _0x443926=toCsv(_0x1d00e8);var _0x44c811=Date[_0x89b2('0x72')]();fs[_0x89b2('0x73')](util[_0x89b2('0x6b')](_0x89b2('0x74'),_0x5c4692['id'],_0x44c811),_0x443926);_0x5a5a7b[_0x89b2('0x75')]('Content-disposition','attachment;\x20filename='+util[_0x89b2('0x6b')](_0x89b2('0x76'),_0x5c4692['id'],_0x44c811));_0x5a5a7b[_0x89b2('0x75')](_0x89b2('0x77'),_0x89b2('0x78'));return _0x5a5a7b[_0x89b2('0x79')](util[_0x89b2('0x6b')](_0x89b2('0x74'),_0x5c4692['id'],_0x44c811));}else{return _0x5a5a7b[_0x89b2('0x1c')](0xcc);}})[_0x89b2('0x49')](handleError(_0x5a5a7b,null));};exports[_0x89b2('0x7a')]=function(_0x47e6e0,_0x4662b7,_0x4338b1){var _0x420638;delete _0x47e6e0['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x47e6e0[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x4662b7,null))['then'](function(_0x3867fd){if(_0x3867fd){return db[_0x89b2('0x7b')][_0x89b2('0x7c')](function(_0x16f154){return db[_0x89b2('0x6e')][_0x89b2('0x4a')](_0x47e6e0[_0x89b2('0x4b')],{'transaction':_0x16f154})['then'](function(_0xf70b2f){_0x420638=_0xf70b2f;return _0x3867fd[_0x89b2('0x7d')](_0xf70b2f,{'transaction':_0x16f154});})['then'](function(){var _0x517e9a={'type':db[_0x89b2('0x7e')][_0x89b2('0x7f')],'transaction':_0x16f154};switch(_0x47e6e0[_0x89b2('0x4b')][_0x89b2('0x31')]){case _0x89b2('0x80'):_0x517e9a[_0x89b2('0x31')]=db[_0x89b2('0x7e')][_0x89b2('0x7f')];break;case _0x89b2('0x81'):_0x517e9a['type']=db[_0x89b2('0x7e')][_0x89b2('0x82')];break;case _0x89b2('0x83'):_0x517e9a[_0x89b2('0x31')]=db[_0x89b2('0x7e')]['BOOLEAN'];_0x517e9a[_0x89b2('0x84')]=![];break;default:}return db[_0x89b2('0x7b')][_0x89b2('0x85')][_0x89b2('0x86')]('cm_contacts',util[_0x89b2('0x6b')](_0x89b2('0x87'),_0x420638['id']),_0x517e9a);})['then'](function(){return _0x420638;});});}})[_0x89b2('0x28')](respondWithResult(_0x4662b7,null))[_0x89b2('0x49')](handleError(_0x4662b7,null));};exports['getCustomFields']=function(_0x5cc665,_0x49488e,_0x45386d){var _0x2fbbd2={};var _0xfc087={};var _0x5cb3ae;var _0x543460;return db[_0x89b2('0x2f')][_0x89b2('0x5a')]({'where':{'id':_0x5cc665['params']['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x49488e,null))[_0x89b2('0x28')](function(_0x45283a){if(_0x45283a){_0x5cb3ae=_0x45283a;_0xfc087[_0x89b2('0x33')]=_[_0x89b2('0x35')](db['CmCustomField'][_0x89b2('0x30')]);_0xfc087[_0x89b2('0x36')]=_[_0x89b2('0x35')](_0x5cc665[_0x89b2('0x36')]);_0xfc087[_0x89b2('0x37')]=_['intersection'](_0xfc087[_0x89b2('0x33')],_0xfc087[_0x89b2('0x36')]);_0x2fbbd2[_0x89b2('0x3a')]=_[_0x89b2('0x38')](_0xfc087[_0x89b2('0x33')],qs[_0x89b2('0x39')](_0x5cc665[_0x89b2('0x36')]['fields']));_0x2fbbd2['attributes']=_0x2fbbd2[_0x89b2('0x3a')]['length']?_0x2fbbd2['attributes']:_0xfc087[_0x89b2('0x33')];_0x2fbbd2[_0x89b2('0x5b')]=qs['sort'](_0x5cc665['query'][_0x89b2('0x3d')]);_0x2fbbd2[_0x89b2('0x3e')]=qs['filters'](_[_0x89b2('0x3f')](_0x5cc665[_0x89b2('0x36')],_0xfc087['filters']));_0x2fbbd2[_0x89b2('0x3e')]=_['merge'](_0x2fbbd2[_0x89b2('0x3e')],{'$or':[{'ListId':_0x45283a['id']},{'ListId':null}]});if(_0x5cc665[_0x89b2('0x36')][_0x89b2('0x40')]){_0x2fbbd2['where']=_[_0x89b2('0x41')](_0x2fbbd2[_0x89b2('0x3e')],{'$or':_[_0x89b2('0x2e')](_0x2fbbd2['attributes'],function(_0x14b810){var _0x12673={};_0x12673[_0x14b810]={'$like':'%'+_0x5cc665[_0x89b2('0x36')]['filter']+'%'};return _0x12673;})});}_0x2fbbd2=_['merge']({},_0x2fbbd2,_0x5cc665[_0x89b2('0x43')]);return db[_0x89b2('0x6e')][_0x89b2('0x88')](_0x2fbbd2);}})['then'](respondWithResult(_0x49488e,null))[_0x89b2('0x49')](handleError(_0x49488e,null));};exports[_0x89b2('0x89')]=function(_0x16d40a,_0x139bb7,_0x589988){return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x16d40a['params']['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x139bb7,null))[_0x89b2('0x28')](function(_0x39c2f1){if(_0x39c2f1){return _0x39c2f1[_0x89b2('0x89')](_0x16d40a[_0x89b2('0x4b')][_0x89b2('0x5e')],_['omit'](_0x16d40a[_0x89b2('0x4b')],[_0x89b2('0x5e'),'id'])||{})[_0x89b2('0x8a')](function(_0x5bb3b5){for(var _0x536ffd=0x0;_0x536ffd<_0x16d40a[_0x89b2('0x4b')][_0x89b2('0x5e')][_0x89b2('0x3b')];_0x536ffd+=0x1){socket[_0x89b2('0x8b')](_0x89b2('0x8c'),{'UserId':_0x16d40a['body'][_0x89b2('0x5e')][_0x536ffd],'CmListId':_0x16d40a['params']['id']});}return _0x5bb3b5;});}})[_0x89b2('0x28')](respondWithResult(_0x139bb7,null))[_0x89b2('0x49')](handleError(_0x139bb7,null));};exports['removeAgents']=function(_0x27d02c,_0x4329fd,_0x58e340){return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x27d02c[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x4329fd,null))[_0x89b2('0x28')](function(_0x309420){if(_0x309420){return _0x309420[_0x89b2('0x8d')](_0x27d02c['query'][_0x89b2('0x5e')])[_0x89b2('0x28')](function(){if(_[_0x89b2('0x61')](_0x27d02c[_0x89b2('0x36')][_0x89b2('0x5e')])){for(var _0x2086f0=0x0;_0x2086f0<_0x27d02c[_0x89b2('0x36')][_0x89b2('0x5e')][_0x89b2('0x3b')];_0x2086f0+=0x1){socket[_0x89b2('0x8b')](_0x89b2('0x8e'),{'UserId':Number(_0x27d02c[_0x89b2('0x36')][_0x89b2('0x5e')][_0x2086f0]),'CmListId':Number(_0x27d02c[_0x89b2('0x55')]['id'])});}}else{socket['emit'](_0x89b2('0x8e'),{'UserId':Number(_0x27d02c[_0x89b2('0x36')][_0x89b2('0x5e')]),'CmListId':Number(_0x27d02c['params']['id'])});}});}})[_0x89b2('0x28')](respondWithStatusCode(_0x4329fd,null))[_0x89b2('0x49')](handleError(_0x4329fd,null));};exports['getAgents']=function(_0x5c0c97,_0x276247,_0x15acd9){var _0x532ce0={};var _0x417c4b={};var _0xc33764;var _0x234a15;return db[_0x89b2('0x2f')][_0x89b2('0x5a')]({'where':{'id':_0x5c0c97[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x276247,null))['then'](function(_0x58ecf3){if(_0x58ecf3){_0xc33764=_0x58ecf3;_0x417c4b[_0x89b2('0x33')]=_[_0x89b2('0x35')](db[_0x89b2('0x8f')][_0x89b2('0x30')]);_0x417c4b[_0x89b2('0x36')]=_['keys'](_0x5c0c97[_0x89b2('0x36')]);_0x417c4b[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x417c4b['model'],_0x417c4b['query']);_0x532ce0['attributes']=_[_0x89b2('0x38')](_0x417c4b[_0x89b2('0x33')],qs[_0x89b2('0x39')](_0x5c0c97[_0x89b2('0x36')]['fields']));_0x532ce0[_0x89b2('0x3a')]=_0x532ce0[_0x89b2('0x3a')][_0x89b2('0x3b')]?_0x532ce0['attributes']:_0x417c4b['model'];_0x532ce0[_0x89b2('0x5b')]=qs[_0x89b2('0x3d')](_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x3d')]);_0x532ce0[_0x89b2('0x3e')]=qs['filters'](_['pick'](_0x5c0c97['query'],_0x417c4b[_0x89b2('0x37')]));if(_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x40')]){_0x532ce0['where']=_[_0x89b2('0x41')](_0x532ce0[_0x89b2('0x3e')],{'$or':_['map'](_0x532ce0[_0x89b2('0x3a')],function(_0x3c9308){var _0x2f98a3={};_0x2f98a3[_0x3c9308]={'$like':'%'+_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x40')]+'%'};return _0x2f98a3;})});}_0x532ce0=_[_0x89b2('0x41')]({},_0x532ce0,_0x5c0c97[_0x89b2('0x43')]);return _0xc33764[_0x89b2('0x90')](_0x532ce0);}})[_0x89b2('0x28')](function(_0x1b4102){if(_0x1b4102){_0x234a15=_0x1b4102[_0x89b2('0x3b')];if(!_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x6c')](_0x89b2('0x3c'))){_0x532ce0[_0x89b2('0x22')]=qs[_0x89b2('0x22')](_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x22')]);_0x532ce0['offset']=qs['offset'](_0x5c0c97['query'][_0x89b2('0x21')]);}return _0xc33764[_0x89b2('0x90')](_0x532ce0);}})[_0x89b2('0x28')](function(_0x488c1f){if(_0x488c1f){return _0x488c1f?{'count':_0x234a15,'rows':_0x488c1f}:null;}})[_0x89b2('0x28')](respondWithResult(_0x276247,null))['catch'](handleError(_0x276247,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 79e520b..4972690 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 _0x47f7=['save','emit','hasOwnProperty','hook'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x47f7,0x158));var _0x747f=function(_0x44b904,_0x41a5cf){_0x44b904=_0x44b904-0x0;var _0x314d4d=_0x47f7[_0x44b904];return _0x314d4d;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x747f('0x0'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3898b5){return function(_0x22c26c,_0x32a888,_0x2eb2c5){CmListEvents['emit'](_0x3898b5+':'+_0x22c26c['id'],_0x22c26c);CmListEvents[_0x747f('0x1')](_0x3898b5,_0x22c26c);_0x2eb2c5(null);};}for(var e in events){if(events[_0x747f('0x2')](e)){var event=events[e];CmList[_0x747f('0x3')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0xb1d0=['update','emit','hasOwnProperty','hook','events','../../mysqldb','save'];(function(_0x2e9d1e,_0x40d95a){var _0xfe5c52=function(_0x2cac93){while(--_0x2cac93){_0x2e9d1e['push'](_0x2e9d1e['shift']());}};_0xfe5c52(++_0x40d95a);}(_0xb1d0,0x154));var _0x0b1d=function(_0x33d581,_0x2da6d0){_0x33d581=_0x33d581-0x0;var _0x3320da=_0xb1d0[_0x33d581];return _0x3320da;};'use strict';var EventEmitter=require(_0x0b1d('0x0'));var CmList=require(_0x0b1d('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0b1d('0x2'),'afterUpdate':_0x0b1d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1eb3ae){return function(_0x56b5d1,_0x3240b0,_0x41f50f){CmListEvents['emit'](_0x1eb3ae+':'+_0x56b5d1['id'],_0x56b5d1);CmListEvents[_0x0b1d('0x4')](_0x1eb3ae,_0x56b5d1);_0x41f50f(null);};}for(var e in events){if(events[_0x0b1d('0x5')](e)){var event=events[e];CmList[_0x0b1d('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 05a7854..9208fbd 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 _0x5e3e=['CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmList.attributes','exports','define'];(function(_0xcf883a,_0x58484a){var _0x360562=function(_0x1a8528){while(--_0x1a8528){_0xcf883a['push'](_0xcf883a['shift']());}};_0x360562(++_0x58484a);}(_0x5e3e,0x1d6));var _0xe5e3=function(_0xe34ce5,_0x1a08c7){_0xe34ce5=_0xe34ce5-0x0;var _0x3067ec=_0x5e3e[_0xe34ce5];return _0x3067ec;};'use strict';var _=require(_0xe5e3('0x0'));var util=require(_0xe5e3('0x1'));var logger=require(_0xe5e3('0x2'))('api');var moment=require(_0xe5e3('0x3'));var BPromise=require(_0xe5e3('0x4'));var rp=require(_0xe5e3('0x5'));var fs=require('fs');var path=require(_0xe5e3('0x6'));var rimraf=require('rimraf');var config=require(_0xe5e3('0x7'));var attributes=require(_0xe5e3('0x8'));module[_0xe5e3('0x9')]=function(_0x570df2,_0x2ed6f5){return _0x570df2[_0xe5e3('0xa')](_0xe5e3('0xb'),attributes,{'tableName':_0xe5e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e77=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','cm_lists','lodash','../../config/logger','api'];(function(_0x2b0da5,_0x5bc04c){var _0x29b500=function(_0x29d7f2){while(--_0x29d7f2){_0x2b0da5['push'](_0x2b0da5['shift']());}};_0x29b500(++_0x5bc04c);}(_0x8e77,0x101));var _0x78e7=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0x8e77[_0x1b4c04];return _0x374f5d;};'use strict';var _=require(_0x78e7('0x0'));var util=require('util');var logger=require(_0x78e7('0x1'))(_0x78e7('0x2'));var moment=require(_0x78e7('0x3'));var BPromise=require(_0x78e7('0x4'));var rp=require(_0x78e7('0x5'));var fs=require('fs');var path=require(_0x78e7('0x6'));var rimraf=require(_0x78e7('0x7'));var config=require(_0x78e7('0x8'));var attributes=require(_0x78e7('0x9'));module['exports']=function(_0x598067,_0x1f738a){return _0x598067[_0x78e7('0xa')](_0x78e7('0xb'),attributes,{'tableName':_0x78e7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index fdad1a6..3a5c696 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 _0x21b4=['debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x18f10a,_0x35f5a7){var _0xd7c3c9=function(_0x5afef){while(--_0x5afef){_0x18f10a['push'](_0x18f10a['shift']());}};_0xd7c3c9(++_0x35f5a7);}(_0x21b4,0x116));var _0x421b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x421b('0x0'));var util=require('util');var moment=require(_0x421b('0x1'));var BPromise=require(_0x421b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x421b('0x3'));var db=require(_0x421b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x421b('0x5'))(_0x421b('0x6'));var config=require(_0x421b('0x7'));var jayson=require(_0x421b('0x8'));var client=jayson[_0x421b('0x9')][_0x421b('0xa')]({'port':0x232a});config[_0x421b('0xb')]=_[_0x421b('0xc')](config[_0x421b('0xb')],{'host':_0x421b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x421b('0xb')]));require(_0x421b('0xe'))[_0x421b('0xf')](socket);function respondWithRpcPromise(_0x596703,_0x2ac5d4,_0x5778eb){return new BPromise(function(_0x48e051,_0x4bd2ba){return client[_0x421b('0x10')](_0x596703,_0x5778eb)['then'](function(_0x1d1f80){logger['info'](_0x421b('0x11'),_0x2ac5d4,_0x421b('0x12'));logger[_0x421b('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x2ac5d4,'request\x20sent',JSON[_0x421b('0x14')](_0x1d1f80));if(_0x1d1f80[_0x421b('0x15')]){if(_0x1d1f80['error'][_0x421b('0x16')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x2ac5d4,_0x1d1f80[_0x421b('0x15')][_0x421b('0x17')]);return _0x4bd2ba(_0x1d1f80['error'][_0x421b('0x17')]);}logger[_0x421b('0x15')]('CmList,\x20%s,\x20%s',_0x2ac5d4,_0x1d1f80[_0x421b('0x15')][_0x421b('0x17')]);return _0x48e051(_0x1d1f80[_0x421b('0x15')][_0x421b('0x17')]);}else{logger[_0x421b('0x18')](_0x421b('0x11'),_0x2ac5d4,_0x421b('0x12'));_0x48e051(_0x1d1f80[_0x421b('0x19')][_0x421b('0x17')]);}})[_0x421b('0x1a')](function(_0x3df829){logger[_0x421b('0x15')](_0x421b('0x11'),_0x2ac5d4,_0x3df829);_0x4bd2ba(_0x3df829);});});} \ No newline at end of file +var _0x5a02=['defaults','localhost','./cmList.socket','register','request','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5a02,0x1e1));var _0x25a0=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x5a02[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require(_0x25a0('0x0'));var util=require(_0x25a0('0x1'));var moment=require(_0x25a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x25a0('0x3'));var fs=require('fs');var Redis=require(_0x25a0('0x4'));var db=require(_0x25a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x25a0('0x6'))(_0x25a0('0x7'));var config=require(_0x25a0('0x8'));var jayson=require(_0x25a0('0x9'));var client=jayson[_0x25a0('0xa')][_0x25a0('0xb')]({'port':0x232a});config[_0x25a0('0xc')]=_[_0x25a0('0xd')](config[_0x25a0('0xc')],{'host':_0x25a0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x25a0('0xf'))[_0x25a0('0x10')](socket);function respondWithRpcPromise(_0x4d3407,_0x24b430,_0x255851){return new BPromise(function(_0xa61b2e,_0x5ea58d){return client[_0x25a0('0x11')](_0x4d3407,_0x255851)['then'](function(_0x53137b){logger[_0x25a0('0x12')]('CmList,\x20%s,\x20%s',_0x24b430,_0x25a0('0x13'));logger['debug'](_0x25a0('0x14'),_0x24b430,_0x25a0('0x13'),JSON['stringify'](_0x53137b));if(_0x53137b[_0x25a0('0x15')]){if(_0x53137b[_0x25a0('0x15')][_0x25a0('0x16')]===0x1f4){logger[_0x25a0('0x15')](_0x25a0('0x17'),_0x24b430,_0x53137b['error'][_0x25a0('0x18')]);return _0x5ea58d(_0x53137b[_0x25a0('0x15')][_0x25a0('0x18')]);}logger['error'](_0x25a0('0x17'),_0x24b430,_0x53137b[_0x25a0('0x15')][_0x25a0('0x18')]);return _0xa61b2e(_0x53137b[_0x25a0('0x15')][_0x25a0('0x18')]);}else{logger[_0x25a0('0x12')](_0x25a0('0x17'),_0x24b430,_0x25a0('0x13'));_0xa61b2e(_0x53137b['result'][_0x25a0('0x18')]);}})[_0x25a0('0x19')](function(_0x285ab5){logger[_0x25a0('0x15')](_0x25a0('0x17'),_0x24b430,_0x285ab5);_0x5ea58d(_0x285ab5);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2f118b8..b5d2622 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 _0x687b=['update','emit','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0x261d17,_0x115fe1){var _0x5a50da=function(_0x409fc0){while(--_0x409fc0){_0x261d17['push'](_0x261d17['shift']());}};_0x5a50da(++_0x115fe1);}(_0x687b,0x14a));var _0xb687=function(_0x282916,_0x29c453){_0x282916=_0x282916-0x0;var _0x317b39=_0x687b[_0x282916];return _0x317b39;};'use strict';var CmListEvents=require(_0xb687('0x0'));var events=[_0xb687('0x1'),_0xb687('0x2'),_0xb687('0x3')];function createListener(_0x5d8563,_0x5e5f06){return function(_0x35069a){_0x5e5f06[_0xb687('0x4')](_0x5d8563,_0x35069a);};}function removeListener(_0x36c468,_0x31bd0d){return function(){CmListEvents[_0xb687('0x5')](_0x36c468,_0x31bd0d);};}exports[_0xb687('0x6')]=function(_0x16ccf3){for(var _0xf43a1f=0x0,_0x47ffea=events[_0xb687('0x7')];_0xf43a1f<_0x47ffea;_0xf43a1f++){var _0x48942b=events[_0xf43a1f];var _0x2aea59=createListener(_0xb687('0x8')+_0x48942b,_0x16ccf3);CmListEvents['on'](_0x48942b,_0x2aea59);}}; \ No newline at end of file +var _0x5e11=['register','length','cmList:','./cmList.events','remove','update','emit'];(function(_0x49f32f,_0x5e8968){var _0x3b274d=function(_0x32d562){while(--_0x32d562){_0x49f32f['push'](_0x49f32f['shift']());}};_0x3b274d(++_0x5e8968);}(_0x5e11,0x1c3));var _0x15e1=function(_0x5f08a6,_0x400121){_0x5f08a6=_0x5f08a6-0x0;var _0x5d0641=_0x5e11[_0x5f08a6];return _0x5d0641;};'use strict';var CmListEvents=require(_0x15e1('0x0'));var events=['save',_0x15e1('0x1'),_0x15e1('0x2')];function createListener(_0x197058,_0xd2c9d9){return function(_0x82943a){_0xd2c9d9[_0x15e1('0x3')](_0x197058,_0x82943a);};}function removeListener(_0x598eda,_0x2409d8){return function(){CmListEvents['removeListener'](_0x598eda,_0x2409d8);};}exports[_0x15e1('0x4')]=function(_0x41b56c){for(var _0xa0d783=0x0,_0xfabd74=events[_0x15e1('0x5')];_0xa0d783<_0xfabd74;_0xa0d783++){var _0x50b131=events[_0xa0d783];var _0xe0b339=createListener(_0x15e1('0x6')+_0x50b131,_0x41b56c);CmListEvents['on'](_0x50b131,_0xe0b339);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 26e730e..bead5c1 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 _0x901e=['removeAgents','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','/:id/dispositions','addCustomField','addAgents','put','update','delete','removeDispositions'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x901e,0x1a1));var _0xe901=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x901e[_0x14490c];return _0x2f6825;};'use strict';var multer=require(_0xe901('0x0'));var util=require(_0xe901('0x1'));var path=require(_0xe901('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe901('0x3')]();var auth=require(_0xe901('0x4'));var interaction=require(_0xe901('0x5'));var config=require('../../config/environment');var controller=require(_0xe901('0x6'));router[_0xe901('0x7')]('/',auth['isAuthenticated'](),controller[_0xe901('0x8')]);router['get'](_0xe901('0x9'),auth[_0xe901('0xa')](),controller[_0xe901('0xb')]);router[_0xe901('0x7')](_0xe901('0xc'),auth['isAuthenticated'](),controller[_0xe901('0xd')]);router[_0xe901('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe901('0xe')]);router[_0xe901('0x7')](_0xe901('0xf'),auth[_0xe901('0xa')](),controller[_0xe901('0x10')]);router[_0xe901('0x7')](_0xe901('0x11'),auth[_0xe901('0xa')](),controller[_0xe901('0x12')]);router[_0xe901('0x7')](_0xe901('0x13'),auth[_0xe901('0xa')](),controller[_0xe901('0x14')]);router[_0xe901('0x7')](_0xe901('0x15'),auth[_0xe901('0xa')](),controller['getAgents']);router[_0xe901('0x16')]('/',auth[_0xe901('0xa')](),controller[_0xe901('0x17')]);router[_0xe901('0x16')](_0xe901('0x18'),auth[_0xe901('0xa')](),controller['addDisposition']);router[_0xe901('0x16')](_0xe901('0xf'),auth[_0xe901('0xa')](),controller['addContacts']);router[_0xe901('0x16')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe901('0x19')]);router['post'](_0xe901('0x15'),auth[_0xe901('0xa')](),controller[_0xe901('0x1a')]);router[_0xe901('0x1b')](_0xe901('0xc'),auth[_0xe901('0xa')](),controller[_0xe901('0x1c')]);router[_0xe901('0x1d')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xe901('0x1d')](_0xe901('0x18'),auth[_0xe901('0xa')](),controller[_0xe901('0x1e')]);router[_0xe901('0x1d')]('/:id/users',auth[_0xe901('0xa')](),controller[_0xe901('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x91f0=['/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','multer','util','express','Router','../../components/auth/service','./cmList.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x91f0,0x11a));var _0x091f=function(_0x2f1777,_0x320c52){_0x2f1777=_0x2f1777-0x0;var _0x197f42=_0x91f0[_0x2f1777];return _0x197f42;};'use strict';var multer=require(_0x091f('0x0'));var util=require(_0x091f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x091f('0x2'));var router=express[_0x091f('0x3')]();var auth=require(_0x091f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x091f('0x5'));router['get']('/',auth[_0x091f('0x6')](),controller[_0x091f('0x7')]);router[_0x091f('0x8')](_0x091f('0x9'),auth[_0x091f('0x6')](),controller['describe']);router[_0x091f('0x8')](_0x091f('0xa'),auth[_0x091f('0x6')](),controller[_0x091f('0xb')]);router[_0x091f('0x8')](_0x091f('0xc'),auth[_0x091f('0x6')](),controller[_0x091f('0xd')]);router[_0x091f('0x8')](_0x091f('0xe'),auth[_0x091f('0x6')](),controller['getContacts']);router[_0x091f('0x8')](_0x091f('0xf'),auth['isAuthenticated'](),controller[_0x091f('0x10')]);router[_0x091f('0x8')]('/:id/fields',auth[_0x091f('0x6')](),controller[_0x091f('0x11')]);router[_0x091f('0x8')](_0x091f('0x12'),auth[_0x091f('0x6')](),controller[_0x091f('0x13')]);router[_0x091f('0x14')]('/',auth[_0x091f('0x6')](),controller[_0x091f('0x15')]);router[_0x091f('0x14')](_0x091f('0xc'),auth[_0x091f('0x6')](),controller[_0x091f('0x16')]);router[_0x091f('0x14')](_0x091f('0xe'),auth[_0x091f('0x6')](),controller[_0x091f('0x17')]);router['post'](_0x091f('0x18'),auth[_0x091f('0x6')](),controller[_0x091f('0x19')]);router['post'](_0x091f('0x12'),auth[_0x091f('0x6')](),controller[_0x091f('0x1a')]);router[_0x091f('0x1b')]('/:id',auth[_0x091f('0x6')](),controller[_0x091f('0x1c')]);router['delete'](_0x091f('0xa'),auth[_0x091f('0x6')](),controller[_0x091f('0x1d')]);router[_0x091f('0x1e')]('/:id/dispositions',auth[_0x091f('0x6')](),controller[_0x091f('0x1f')]);router[_0x091f('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0x091f('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1f41017..c404451 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x38695b,_0x2fa3cb){var _0x5b36dd=function(_0x155f18){while(--_0x155f18){_0x38695b['push'](_0x38695b['shift']());}};_0x5b36dd(++_0x2fa3cb);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x551a48,_0x2ac130){var _0x56536d=function(_0x189fa4){while(--_0x189fa4){_0x551a48['push'](_0x551a48['shift']());}};_0x56536d(++_0x2ac130);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index c0754c2..2fe78ef 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 _0xc4e1=['squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','json','status','set','apply','reject','save','update','destroy','end','error','stack','name','send','body','Condition','params','then','catch','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash'];(function(_0x17e61b,_0x39ff4f){var _0x1e75b4=function(_0x2b574e){while(--_0x2b574e){_0x17e61b['push'](_0x17e61b['shift']());}};_0x1e75b4(++_0x39ff4f);}(_0xc4e1,0x172));var _0x1c4e=function(_0x350e37,_0x3653d8){_0x350e37=_0x350e37-0x0;var _0x10eff5=_0xc4e1[_0x350e37];return _0x10eff5;};'use strict';var pdf=require(_0x1c4e('0x0'));var emlformat=require(_0x1c4e('0x1'));var rimraf=require(_0x1c4e('0x2'));var zipdir=require(_0x1c4e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c4e('0x4'));var moment=require('moment');var BPromise=require(_0x1c4e('0x5'));var Mustache=require('mustache');var util=require(_0x1c4e('0x6'));var path=require('path');var sox=require(_0x1c4e('0x7'));var csv=require(_0x1c4e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c4e('0x9'));var squel=require(_0x1c4e('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c4e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c4e('0xc'));var Papa=require('papaparse');var Redis=require(_0x1c4e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1c4e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c4e('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1c4e('0x10'));var db=require(_0x1c4e('0x11'))['db'];function respondWithStatusCode(_0x25aa73,_0x4f4eec){_0x4f4eec=_0x4f4eec||0xcc;return function(_0x275b90){if(_0x275b90){return _0x25aa73[_0x1c4e('0x12')](_0x4f4eec);}return _0x25aa73['status'](_0x4f4eec)['end']();};}function respondWithResult(_0x4f72ee,_0x119d51){_0x119d51=_0x119d51||0xc8;return function(_0x2b6459){if(_0x2b6459){return _0x4f72ee['status'](_0x119d51)[_0x1c4e('0x13')](_0x2b6459);}};}function respondWithFilteredResult(_0x39d06e,_0x10555f){return function(_0x31708b){if(_0x31708b){var _0x2d55bb=_0x31708b['count'],_0x4b12b3=_0x10555f['offset'],_0x17259a=_0x10555f['offset']+_0x10555f['limit'],_0x3d4bd4;if(_0x17259a>=_0x2d55bb){_0x17259a=_0x2d55bb;_0x3d4bd4=0xc8;}else{_0x3d4bd4=0xce;}_0x39d06e[_0x1c4e('0x14')](_0x3d4bd4);return _0x39d06e[_0x1c4e('0x15')]('Content-Range',_0x4b12b3+'-'+_0x17259a+'/'+_0x2d55bb)[_0x1c4e('0x13')](_0x31708b);}return null;};}function patchUpdates(_0x366529){return function(_0x3b0b4a){try{jsonpatch[_0x1c4e('0x16')](_0x3b0b4a,_0x366529,!![]);}catch(_0x101b27){return BPromise[_0x1c4e('0x17')](_0x101b27);}return _0x3b0b4a[_0x1c4e('0x18')]();};}function saveUpdates(_0x1e9b11,_0x24a1c7){return function(_0x491fdb){if(_0x491fdb){return _0x491fdb[_0x1c4e('0x19')](_0x1e9b11)['then'](function(_0x29b574){return _0x29b574;});}return null;};}function removeEntity(_0x1aebaa,_0x300b16){return function(_0x1353e4){if(_0x1353e4){return _0x1353e4[_0x1c4e('0x1a')]()['then'](function(){_0x1aebaa[_0x1c4e('0x14')](0xcc)[_0x1c4e('0x1b')]();});}};}function handleEntityNotFound(_0x20f93d,_0x41bbe6){return function(_0x18ee91){if(!_0x18ee91){_0x20f93d[_0x1c4e('0x12')](0x194);}return _0x18ee91;};}function handleError(_0x58c9d1,_0x3a52a0){_0x3a52a0=_0x3a52a0||0x1f4;return function(_0x1ea890){logger[_0x1c4e('0x1c')](_0x1ea890[_0x1c4e('0x1d')]);if(_0x1ea890[_0x1c4e('0x1e')]){delete _0x1ea890[_0x1c4e('0x1e')];}_0x58c9d1['status'](_0x3a52a0)[_0x1c4e('0x1f')](_0x1ea890);};}exports[_0x1c4e('0x19')]=function(_0x5925aa,_0x256e72){if(_0x5925aa[_0x1c4e('0x20')]['id']){delete _0x5925aa[_0x1c4e('0x20')]['id'];}return db[_0x1c4e('0x21')]['find']({'where':{'id':_0x5925aa[_0x1c4e('0x22')]['id']}})[_0x1c4e('0x23')](handleEntityNotFound(_0x256e72,null))[_0x1c4e('0x23')](saveUpdates(_0x5925aa['body'],null))[_0x1c4e('0x23')](respondWithResult(_0x256e72,null))[_0x1c4e('0x24')](handleError(_0x256e72,null));};exports[_0x1c4e('0x1a')]=function(_0x1b354c,_0x5bcb92){return db[_0x1c4e('0x21')][_0x1c4e('0x25')]({'where':{'id':_0x1b354c[_0x1c4e('0x22')]['id']}})[_0x1c4e('0x23')](handleEntityNotFound(_0x5bcb92,null))['then'](removeEntity(_0x5bcb92,null))['catch'](handleError(_0x5bcb92,null));}; \ No newline at end of file +var _0xa8e2=['send','body','find','params','destroy','Condition','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','apply','reject','update','then','end','stack','name'];(function(_0x40c318,_0x15aea7){var _0x3f032c=function(_0x517032){while(--_0x517032){_0x40c318['push'](_0x40c318['shift']());}};_0x3f032c(++_0x15aea7);}(_0xa8e2,0x14e));var _0x2a8e=function(_0x1e7fee,_0x3dce9d){_0x1e7fee=_0x1e7fee-0x0;var _0x43e55b=_0xa8e2[_0x1e7fee];return _0x43e55b;};'use strict';var pdf=require(_0x2a8e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2a8e('0x1'));var zipdir=require(_0x2a8e('0x2'));var jsonpatch=require(_0x2a8e('0x3'));var rp=require(_0x2a8e('0x4'));var moment=require(_0x2a8e('0x5'));var BPromise=require(_0x2a8e('0x6'));var Mustache=require('mustache');var util=require(_0x2a8e('0x7'));var path=require(_0x2a8e('0x8'));var sox=require(_0x2a8e('0x9'));var csv=require(_0x2a8e('0xa'));var ejs=require(_0x2a8e('0xb'));var fs=require('fs');var _=require(_0x2a8e('0xc'));var squel=require(_0x2a8e('0xd'));var crypto=require(_0x2a8e('0xe'));var jsforce=require(_0x2a8e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2a8e('0xa'));var querystring=require('querystring');var Papa=require(_0x2a8e('0x10'));var Redis=require(_0x2a8e('0x11'));var authService=require(_0x2a8e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2a8e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a8e('0x14'))('api');var utils=require(_0x2a8e('0x15'));var config=require(_0x2a8e('0x16'));var db=require(_0x2a8e('0x17'))['db'];function respondWithStatusCode(_0x886e95,_0x5cfa00){_0x5cfa00=_0x5cfa00||0xcc;return function(_0x50186e){if(_0x50186e){return _0x886e95['sendStatus'](_0x5cfa00);}return _0x886e95[_0x2a8e('0x18')](_0x5cfa00)['end']();};}function respondWithResult(_0x18c844,_0x3ae693){_0x3ae693=_0x3ae693||0xc8;return function(_0x511481){if(_0x511481){return _0x18c844[_0x2a8e('0x18')](_0x3ae693)[_0x2a8e('0x19')](_0x511481);}};}function respondWithFilteredResult(_0x40dc6c,_0x4112e6){return function(_0x210784){if(_0x210784){var _0x5bda2a=_0x210784['count'],_0x4b99ec=_0x4112e6[_0x2a8e('0x1a')],_0x62cec1=_0x4112e6['offset']+_0x4112e6['limit'],_0x37da38;if(_0x62cec1>=_0x5bda2a){_0x62cec1=_0x5bda2a;_0x37da38=0xc8;}else{_0x37da38=0xce;}_0x40dc6c[_0x2a8e('0x18')](_0x37da38);return _0x40dc6c[_0x2a8e('0x1b')]('Content-Range',_0x4b99ec+'-'+_0x62cec1+'/'+_0x5bda2a)[_0x2a8e('0x19')](_0x210784);}return null;};}function patchUpdates(_0x326331){return function(_0x108028){try{jsonpatch[_0x2a8e('0x1c')](_0x108028,_0x326331,!![]);}catch(_0x4b560d){return BPromise[_0x2a8e('0x1d')](_0x4b560d);}return _0x108028['save']();};}function saveUpdates(_0x5524f9,_0x4891ce){return function(_0x420e60){if(_0x420e60){return _0x420e60[_0x2a8e('0x1e')](_0x5524f9)['then'](function(_0xec3a5d){return _0xec3a5d;});}return null;};}function removeEntity(_0x54bdb5,_0x5a2d2d){return function(_0x203b89){if(_0x203b89){return _0x203b89['destroy']()[_0x2a8e('0x1f')](function(){_0x54bdb5[_0x2a8e('0x18')](0xcc)[_0x2a8e('0x20')]();});}};}function handleEntityNotFound(_0x5360a9,_0x72f454){return function(_0x2b2fd9){if(!_0x2b2fd9){_0x5360a9['sendStatus'](0x194);}return _0x2b2fd9;};}function handleError(_0x3f6b22,_0x30206d){_0x30206d=_0x30206d||0x1f4;return function(_0xefa590){logger['error'](_0xefa590[_0x2a8e('0x21')]);if(_0xefa590[_0x2a8e('0x22')]){delete _0xefa590[_0x2a8e('0x22')];}_0x3f6b22[_0x2a8e('0x18')](_0x30206d)[_0x2a8e('0x23')](_0xefa590);};}exports[_0x2a8e('0x1e')]=function(_0x5a58fd,_0x4841ab){if(_0x5a58fd[_0x2a8e('0x24')]['id']){delete _0x5a58fd['body']['id'];}return db['Condition'][_0x2a8e('0x25')]({'where':{'id':_0x5a58fd[_0x2a8e('0x26')]['id']}})[_0x2a8e('0x1f')](handleEntityNotFound(_0x4841ab,null))[_0x2a8e('0x1f')](saveUpdates(_0x5a58fd[_0x2a8e('0x24')],null))[_0x2a8e('0x1f')](respondWithResult(_0x4841ab,null))['catch'](handleError(_0x4841ab,null));};exports[_0x2a8e('0x27')]=function(_0x4e834f,_0x2a41fb){return db[_0x2a8e('0x28')][_0x2a8e('0x25')]({'where':{'id':_0x4e834f[_0x2a8e('0x26')]['id']}})[_0x2a8e('0x1f')](handleEntityNotFound(_0x2a41fb,null))[_0x2a8e('0x1f')](removeEntity(_0x2a41fb,null))['catch'](handleError(_0x2a41fb,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 8c96c99..9f32d95 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 _0x688a=['exports','define','Condition','lodash','util','api','moment','bluebird','../../config/environment','./condition.attributes'];(function(_0x3ab5a7,_0x41642a){var _0x3029ff=function(_0x630ff7){while(--_0x630ff7){_0x3ab5a7['push'](_0x3ab5a7['shift']());}};_0x3029ff(++_0x41642a);}(_0x688a,0x67));var _0xa688=function(_0x5650ee,_0x21b5a4){_0x5650ee=_0x5650ee-0x0;var _0x3fd65c=_0x688a[_0x5650ee];return _0x3fd65c;};'use strict';var _=require(_0xa688('0x0'));var util=require(_0xa688('0x1'));var logger=require('../../config/logger')(_0xa688('0x2'));var moment=require(_0xa688('0x3'));var BPromise=require(_0xa688('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa688('0x5'));var attributes=require(_0xa688('0x6'));module[_0xa688('0x7')]=function(_0x31f5a6,_0x3c8fcd){return _0x31f5a6[_0xa688('0x8')](_0xa688('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5396=['Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','./condition.attributes','exports','define'];(function(_0x4e1b70,_0x148221){var _0x365ac7=function(_0x514b48){while(--_0x514b48){_0x4e1b70['push'](_0x4e1b70['shift']());}};_0x365ac7(++_0x148221);}(_0x5396,0x14c));var _0x6539=function(_0x1d4f6e,_0x25459c){_0x1d4f6e=_0x1d4f6e-0x0;var _0x56fa40=_0x5396[_0x1d4f6e];return _0x56fa40;};'use strict';var _=require(_0x6539('0x0'));var util=require(_0x6539('0x1'));var logger=require(_0x6539('0x2'))(_0x6539('0x3'));var moment=require(_0x6539('0x4'));var BPromise=require(_0x6539('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6539('0x6'));module[_0x6539('0x7')]=function(_0x15f32e,_0x23fc7e){return _0x15f32e[_0x6539('0x8')](_0x6539('0x9'),attributes,{'tableName':_0x6539('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 89aee37..986d65b 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 _0xd723=['http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0xd723,0x1af));var _0x3d72=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xd723[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x3d72('0x0'));var util=require('util');var moment=require(_0x3d72('0x1'));var BPromise=require(_0x3d72('0x2'));var rs=require(_0x3d72('0x3'));var fs=require('fs');var Redis=require(_0x3d72('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d72('0x5'))(_0x3d72('0x6'));var config=require(_0x3d72('0x7'));var jayson=require(_0x3d72('0x8'));var client=jayson['client'][_0x3d72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x593005,_0x4b0a8d,_0x40a53b){return new BPromise(function(_0x4044f6,_0x2cc90a){return client[_0x3d72('0xa')](_0x593005,_0x40a53b)[_0x3d72('0xb')](function(_0x1f74c){logger['info'](_0x3d72('0xc'),_0x4b0a8d,_0x3d72('0xd'));logger[_0x3d72('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x4b0a8d,_0x3d72('0xd'),JSON[_0x3d72('0xf')](_0x1f74c));if(_0x1f74c[_0x3d72('0x10')]){if(_0x1f74c[_0x3d72('0x10')]['code']===0x1f4){logger[_0x3d72('0x10')]('Condition,\x20%s,\x20%s',_0x4b0a8d,_0x1f74c['error'][_0x3d72('0x11')]);return _0x2cc90a(_0x1f74c['error'][_0x3d72('0x11')]);}logger[_0x3d72('0x10')]('Condition,\x20%s,\x20%s',_0x4b0a8d,_0x1f74c[_0x3d72('0x10')][_0x3d72('0x11')]);return _0x4044f6(_0x1f74c[_0x3d72('0x10')][_0x3d72('0x11')]);}else{logger['info'](_0x3d72('0xc'),_0x4b0a8d,_0x3d72('0xd'));_0x4044f6(_0x1f74c[_0x3d72('0x12')][_0x3d72('0x11')]);}})[_0x3d72('0x13')](function(_0x3f384d){logger[_0x3d72('0x10')](_0x3d72('0xc'),_0x4b0a8d,_0x3f384d);_0x2cc90a(_0x3f384d);});});} \ No newline at end of file +var _0x978d=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','randomstring','ioredis'];(function(_0x4e3bd3,_0x4f9cc4){var _0x1fb687=function(_0x5e26d6){while(--_0x5e26d6){_0x4e3bd3['push'](_0x4e3bd3['shift']());}};_0x1fb687(++_0x4f9cc4);}(_0x978d,0x6b));var _0xd978=function(_0x5f1b23,_0x148527){_0x5f1b23=_0x5f1b23-0x0;var _0x54019b=_0x978d[_0x5f1b23];return _0x54019b;};'use strict';var _=require('lodash');var util=require(_0xd978('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd978('0x1'));var fs=require('fs');var Redis=require(_0xd978('0x2'));var db=require(_0xd978('0x3'))['db'];var utils=require(_0xd978('0x4'));var logger=require(_0xd978('0x5'))(_0xd978('0x6'));var config=require('../../config/environment');var jayson=require(_0xd978('0x7'));var client=jayson[_0xd978('0x8')][_0xd978('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50e03f,_0x2f2f83,_0xe9236e){return new BPromise(function(_0x46d2dd,_0x3c7050){return client[_0xd978('0xa')](_0x50e03f,_0xe9236e)[_0xd978('0xb')](function(_0x4668b5){logger['info'](_0xd978('0xc'),_0x2f2f83,_0xd978('0xd'));logger[_0xd978('0xe')](_0xd978('0xf'),_0x2f2f83,_0xd978('0xd'),JSON[_0xd978('0x10')](_0x4668b5));if(_0x4668b5[_0xd978('0x11')]){if(_0x4668b5[_0xd978('0x11')][_0xd978('0x12')]===0x1f4){logger['error'](_0xd978('0xc'),_0x2f2f83,_0x4668b5[_0xd978('0x11')][_0xd978('0x13')]);return _0x3c7050(_0x4668b5[_0xd978('0x11')]['message']);}logger[_0xd978('0x11')]('Condition,\x20%s,\x20%s',_0x2f2f83,_0x4668b5['error']['message']);return _0x46d2dd(_0x4668b5[_0xd978('0x11')][_0xd978('0x13')]);}else{logger[_0xd978('0x14')](_0xd978('0xc'),_0x2f2f83,_0xd978('0xd'));_0x46d2dd(_0x4668b5['result'][_0xd978('0x13')]);}})[_0xd978('0x15')](function(_0x2981ef){logger[_0xd978('0x11')](_0xd978('0xc'),_0x2f2f83,_0x2981ef);_0x3c7050(_0x2981ef);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6565714..0208163 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 _0x5c3e=['/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5c3e,0x95));var _0xe5c3=function(_0x4ece16,_0x580a80){_0x4ece16=_0x4ece16-0x0;var _0x272152=_0x5c3e[_0x4ece16];return _0x272152;};'use strict';var multer=require(_0xe5c3('0x0'));var util=require('util');var path=require(_0xe5c3('0x1'));var timeout=require(_0xe5c3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe5c3('0x3'));var interaction=require(_0xe5c3('0x4'));var config=require(_0xe5c3('0x5'));var controller=require('./condition.controller');router[_0xe5c3('0x6')](_0xe5c3('0x7'),auth[_0xe5c3('0x8')](),controller[_0xe5c3('0x9')]);router[_0xe5c3('0xa')](_0xe5c3('0x7'),auth[_0xe5c3('0x8')](),controller[_0xe5c3('0xb')]);module[_0xe5c3('0xc')]=router; \ No newline at end of file +var _0xc035=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','exports'];(function(_0x2dbe8d,_0x3c517d){var _0x2402c2=function(_0x297b84){while(--_0x297b84){_0x2dbe8d['push'](_0x2dbe8d['shift']());}};_0x2402c2(++_0x3c517d);}(_0xc035,0x134));var _0x5c03=function(_0x428d0a,_0x5ba1fb){_0x428d0a=_0x428d0a-0x0;var _0x266802=_0xc035[_0x428d0a];return _0x266802;};'use strict';var multer=require(_0x5c03('0x0'));var util=require(_0x5c03('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c03('0x2'));var router=express[_0x5c03('0x3')]();var auth=require(_0x5c03('0x4'));var interaction=require(_0x5c03('0x5'));var config=require(_0x5c03('0x6'));var controller=require(_0x5c03('0x7'));router[_0x5c03('0x8')](_0x5c03('0x9'),auth['isAuthenticated'](),controller[_0x5c03('0xa')]);router[_0x5c03('0xb')]('/:id',auth[_0x5c03('0xc')](),controller['destroy']);module[_0x5c03('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c5649e6..183e57c 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 _0x394e=['STRING','sequelize','exports','name','INTEGER'];(function(_0x35000d,_0xc8945c){var _0x2b856f=function(_0x3d8eb2){while(--_0x3d8eb2){_0x35000d['push'](_0x35000d['shift']());}};_0x2b856f(++_0xc8945c);}(_0x394e,0x88));var _0xe394=function(_0x3a0aef,_0x4815f2){_0x3a0aef=_0x3a0aef-0x0;var _0x837448=_0x394e[_0x3a0aef];return _0x837448;};'use strict';var Sequelize=require(_0xe394('0x0'));module[_0xe394('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe394('0x2')},'OrderBy':{'type':Sequelize[_0xe394('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x32c0=['exports','name','INTEGER','sequelize'];(function(_0x31880d,_0x4f0ff3){var _0x423823=function(_0x57cc92){while(--_0x57cc92){_0x31880d['push'](_0x31880d['shift']());}};_0x423823(++_0x4f0ff3);}(_0x32c0,0x1f3));var _0x032c=function(_0x2f209c,_0x3bc148){_0x2f209c=_0x2f209c-0x0;var _0x400f2d=_0x32c0[_0x2f209c];return _0x400f2d;};'use strict';var Sequelize=require(_0x032c('0x0'));module[_0x032c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x032c('0x2')},'OrderBy':{'type':Sequelize[_0x032c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 7487615..510e4bb 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 _0x34e8=['then','ContactItemTypes','destroy','sendStatus','error','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0x44922f,_0x4500fd){_0x44922f=_0x44922f-0x0;var _0x3d0d2f=_0x34e8[_0x44922f];return _0x3d0d2f;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']),_0xb5bc06);if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['ContactItemType'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x4a')]=function(_0x30568e,_0x40ff5a){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x30568e[_0x834e('0x4b')],{})[_0x834e('0x28')](function(_0x1419eb){var _0x390c45=_0x30568e[_0x834e('0x4c')][_0x834e('0x4d')]({'plain':!![]});if(!_0x390c45)throw new Error(_0x834e('0x4e'));if(_0x390c45[_0x834e('0x4f')]===_0x834e('0x4c')){var _0x1a3855=_0x1419eb[_0x834e('0x4d')]({'plain':!![]});var _0x32b8f7=_0x834e('0x29');return db[_0x834e('0x50')]['find']({'where':{'name':_0x32b8f7,'userProfileId':_0x390c45[_0x834e('0x51')]},'raw':!![]})[_0x834e('0x28')](function(_0x4e73e0){if(_0x4e73e0&&_0x4e73e0[_0x834e('0x52')]===0x0){return db[_0x834e('0x53')]['create']({'name':_0x1a3855[_0x834e('0x2e')],'resourceId':_0x1a3855['id'],'type':_0x4e73e0[_0x834e('0x2e')],'sectionId':_0x4e73e0['id']},{})[_0x834e('0x28')](function(){return _0x1419eb;});}else{return _0x1419eb;}})[_0x834e('0x46')](function(_0x4288e4){logger[_0x834e('0x2c')](_0x834e('0x54'),_0x4288e4);throw _0x4288e4;});}return _0x1419eb;})['then'](respondWithResult(_0x40ff5a,0xc9))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x27')]=function(_0x3e0550,_0x363675){if(_0x3e0550[_0x834e('0x4b')]['id']){delete _0x3e0550[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x3e0550['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x363675,null))['then'](saveUpdates(_0x3e0550[_0x834e('0x4b')],null))['then'](respondWithResult(_0x363675,null))[_0x834e('0x46')](handleError(_0x363675,null));};exports['destroy']=function(_0x527eef,_0x6c0b29){return db[_0x834e('0x30')]['find']({'where':{'id':_0x527eef['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x6c0b29,null))[_0x834e('0x28')](removeEntity(_0x6c0b29,null))[_0x834e('0x46')](handleError(_0x6c0b29,null));}; \ No newline at end of file +var _0x3e74=['rows','catch','params','create','body','user','get','ContactItemTypes','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','count','offset','status','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','options','includeAll','include','findAll'];(function(_0x32f632,_0x30dc81){var _0x40f3e5=function(_0x39c849){while(--_0x39c849){_0x32f632['push'](_0x32f632['shift']());}};_0x40f3e5(++_0x30dc81);}(_0x3e74,0x175));var _0x43e7=function(_0x342927,_0x3aa36b){_0x342927=_0x342927-0x0;var _0x5964d2=_0x3e74[_0x342927];return _0x5964d2;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb206,_0xc960ea){_0xc960ea=_0xc960ea||0xcc;return function(_0x2718d3){if(_0x2718d3){return _0x3eb206[_0x43e7('0x14')](_0xc960ea);}return _0x3eb206['status'](_0xc960ea)['end']();};}function respondWithResult(_0x2fcb36,_0x21fdd3){_0x21fdd3=_0x21fdd3||0xc8;return function(_0x44b0bd){if(_0x44b0bd){return _0x2fcb36['status'](_0x21fdd3)['json'](_0x44b0bd);}};}function respondWithFilteredResult(_0x16849c,_0x14c146){return function(_0x203378){if(_0x203378){var _0x328445=_0x203378[_0x43e7('0x15')],_0x4de324=_0x14c146[_0x43e7('0x16')],_0x5c4eaa=_0x14c146['offset']+_0x14c146['limit'],_0xdf16c;if(_0x5c4eaa>=_0x328445){_0x5c4eaa=_0x328445;_0xdf16c=0xc8;}else{_0xdf16c=0xce;}_0x16849c[_0x43e7('0x17')](_0xdf16c);return _0x16849c[_0x43e7('0x18')](_0x43e7('0x19'),_0x4de324+'-'+_0x5c4eaa+'/'+_0x328445)[_0x43e7('0x1a')](_0x203378);}return null;};}function patchUpdates(_0x3776f5){return function(_0x1f24fb){try{jsonpatch[_0x43e7('0x1b')](_0x1f24fb,_0x3776f5,!![]);}catch(_0x1441ef){return BPromise[_0x43e7('0x1c')](_0x1441ef);}return _0x1f24fb[_0x43e7('0x1d')]();};}function saveUpdates(_0x191dd5,_0x177ee1){return function(_0x4b5d64){if(_0x4b5d64){return _0x4b5d64[_0x43e7('0x1e')](_0x191dd5)[_0x43e7('0x1f')](function(_0x4b386b){return _0x4b386b;});}return null;};}function removeEntity(_0x2898b5,_0x3e281e){return function(_0x3945bb){if(_0x3945bb){return _0x3945bb[_0x43e7('0x20')]()[_0x43e7('0x1f')](function(){var _0x2f4cb4=_0x3945bb['get']({'plain':!![]});var _0x454359='ContactItemTypes';return db['UserProfileResource'][_0x43e7('0x20')]({'where':{'type':_0x454359,'resourceId':_0x2f4cb4['id']}})[_0x43e7('0x1f')](function(){return _0x3945bb;});})['then'](function(){_0x2898b5[_0x43e7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x326dab,_0x5c5e67){return function(_0x1af208){if(!_0x1af208){_0x326dab[_0x43e7('0x14')](0x194);}return _0x1af208;};}function handleError(_0x20888b,_0x405f85){_0x405f85=_0x405f85||0x1f4;return function(_0x51f4d7){logger['error'](_0x51f4d7[_0x43e7('0x21')]);if(_0x51f4d7['name']){delete _0x51f4d7[_0x43e7('0x22')];}_0x20888b[_0x43e7('0x17')](_0x405f85)[_0x43e7('0x23')](_0x51f4d7);};}exports[_0x43e7('0x24')]=function(_0x5087d7,_0x33a1a5){var _0x4690a6={},_0x45b675={},_0x50f9f5={'count':0x0,'rows':[]};var _0x442c3b=_[_0x43e7('0x25')](db[_0x43e7('0x26')][_0x43e7('0x27')],function(_0x3bf475){return{'name':_0x3bf475[_0x43e7('0x28')],'type':_0x3bf475[_0x43e7('0x29')][_0x43e7('0x2a')]};});_0x45b675[_0x43e7('0x2b')]=_[_0x43e7('0x25')](_0x442c3b,'name');_0x45b675[_0x43e7('0x2c')]=_[_0x43e7('0x2d')](_0x5087d7[_0x43e7('0x2c')]);_0x45b675[_0x43e7('0x2e')]=_[_0x43e7('0x2f')](_0x45b675['model'],_0x45b675[_0x43e7('0x2c')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x2f')](_0x45b675[_0x43e7('0x2b')],qs['fields'](_0x5087d7['query']['fields']));_0x4690a6[_0x43e7('0x30')]=_0x4690a6[_0x43e7('0x30')][_0x43e7('0x31')]?_0x4690a6[_0x43e7('0x30')]:_0x45b675[_0x43e7('0x2b')];if(!_0x5087d7[_0x43e7('0x2c')]['hasOwnProperty']('nolimit')){_0x4690a6['limit']=qs['limit'](_0x5087d7['query']['limit']);_0x4690a6['offset']=qs[_0x43e7('0x16')](_0x5087d7['query'][_0x43e7('0x16')]);}_0x4690a6[_0x43e7('0x32')]=qs[_0x43e7('0x33')](_0x5087d7[_0x43e7('0x2c')][_0x43e7('0x33')]);_0x4690a6[_0x43e7('0x34')]=qs[_0x43e7('0x2e')](_['pick'](_0x5087d7['query'],_0x45b675['filters']),_0x442c3b);if(_0x5087d7[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x4690a6[_0x43e7('0x34')]=_[_0x43e7('0x36')](_0x4690a6[_0x43e7('0x34')],{'$or':_[_0x43e7('0x25')](_0x442c3b,function(_0x1d4589){if(_0x1d4589[_0x43e7('0x29')]!=='VIRTUAL'){var _0x61ed8e={};_0x61ed8e[_0x1d4589[_0x43e7('0x22')]]={'$like':'%'+_0x5087d7['query'][_0x43e7('0x35')]+'%'};return _0x61ed8e;}})});}_0x4690a6=_['merge']({},_0x4690a6,_0x5087d7[_0x43e7('0x37')]);var _0x2ad008={'where':_0x4690a6[_0x43e7('0x34')]};return db[_0x43e7('0x26')][_0x43e7('0x15')](_0x2ad008)[_0x43e7('0x1f')](function(_0x5e731b){_0x50f9f5['count']=_0x5e731b;if(_0x5087d7[_0x43e7('0x2c')][_0x43e7('0x38')]){_0x4690a6[_0x43e7('0x39')]=[{'all':!![]}];}return db[_0x43e7('0x26')][_0x43e7('0x3a')](_0x4690a6);})['then'](function(_0x32a451){_0x50f9f5[_0x43e7('0x3b')]=_0x32a451;return _0x50f9f5;})['then'](respondWithFilteredResult(_0x33a1a5,_0x4690a6))[_0x43e7('0x3c')](handleError(_0x33a1a5,null));};exports['show']=function(_0x2ad8ef,_0x504101){var _0x3d81ae={'raw':!![],'where':{'id':_0x2ad8ef[_0x43e7('0x3d')]['id']}},_0x3b4235={};_0x3b4235[_0x43e7('0x2b')]=_['keys'](db['ContactItemType'][_0x43e7('0x27')]);_0x3b4235[_0x43e7('0x2c')]=_[_0x43e7('0x2d')](_0x2ad8ef[_0x43e7('0x2c')]);_0x3b4235['filters']=_['intersection'](_0x3b4235['model'],_0x3b4235[_0x43e7('0x2c')]);_0x3d81ae['attributes']=_[_0x43e7('0x2f')](_0x3b4235['model'],qs['fields'](_0x2ad8ef[_0x43e7('0x2c')]['fields']));_0x3d81ae[_0x43e7('0x30')]=_0x3d81ae[_0x43e7('0x30')][_0x43e7('0x31')]?_0x3d81ae[_0x43e7('0x30')]:_0x3b4235['model'];if(_0x2ad8ef[_0x43e7('0x2c')][_0x43e7('0x38')]){_0x3d81ae[_0x43e7('0x39')]=[{'all':!![]}];}_0x3d81ae=_[_0x43e7('0x36')]({},_0x3d81ae,_0x2ad8ef[_0x43e7('0x37')]);return db[_0x43e7('0x26')]['find'](_0x3d81ae)['then'](handleEntityNotFound(_0x504101,null))[_0x43e7('0x1f')](respondWithResult(_0x504101,null))[_0x43e7('0x3c')](handleError(_0x504101,null));};exports[_0x43e7('0x3e')]=function(_0x4c00a8,_0x5c1c18){return db['ContactItemType'][_0x43e7('0x3e')](_0x4c00a8[_0x43e7('0x3f')],{})['then'](function(_0x351ca2){var _0x47686e=_0x4c00a8[_0x43e7('0x40')]['get']({'plain':!![]});if(!_0x47686e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47686e['role']==='user'){var _0x214e7e=_0x351ca2[_0x43e7('0x41')]({'plain':!![]});var _0x52fea5=_0x43e7('0x42');return db[_0x43e7('0x43')][_0x43e7('0x44')]({'where':{'name':_0x52fea5,'userProfileId':_0x47686e[_0x43e7('0x45')]},'raw':!![]})['then'](function(_0x2718d5){if(_0x2718d5&&_0x2718d5['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x3e')]({'name':_0x214e7e[_0x43e7('0x22')],'resourceId':_0x214e7e['id'],'type':_0x2718d5[_0x43e7('0x22')],'sectionId':_0x2718d5['id']},{})[_0x43e7('0x1f')](function(){return _0x351ca2;});}else{return _0x351ca2;}})[_0x43e7('0x3c')](function(_0x2351cf){logger[_0x43e7('0x46')](_0x43e7('0x47'),_0x2351cf);throw _0x2351cf;});}return _0x351ca2;})[_0x43e7('0x1f')](respondWithResult(_0x5c1c18,0xc9))[_0x43e7('0x3c')](handleError(_0x5c1c18,null));};exports['update']=function(_0x119d34,_0x46c910){if(_0x119d34['body']['id']){delete _0x119d34[_0x43e7('0x3f')]['id'];}return db['ContactItemType'][_0x43e7('0x44')]({'where':{'id':_0x119d34[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x46c910,null))[_0x43e7('0x1f')](saveUpdates(_0x119d34[_0x43e7('0x3f')],null))['then'](respondWithResult(_0x46c910,null))['catch'](handleError(_0x46c910,null));};exports[_0x43e7('0x20')]=function(_0x2ab7ee,_0x399942){return db[_0x43e7('0x26')][_0x43e7('0x44')]({'where':{'id':_0x2ab7ee[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x399942,null))[_0x43e7('0x1f')](removeEntity(_0x399942,null))[_0x43e7('0x3c')](handleError(_0x399942,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 9b26b47..d768b71 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 _0x4cfd=['bluebird','request-promise','path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','lodash','util','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cfd,0x170));var _0xd4cf=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x4cfd[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xd4cf('0x0'));var util=require(_0xd4cf('0x1'));var logger=require('../../config/logger')(_0xd4cf('0x2'));var moment=require(_0xd4cf('0x3'));var BPromise=require(_0xd4cf('0x4'));var rp=require(_0xd4cf('0x5'));var fs=require('fs');var path=require(_0xd4cf('0x6'));var rimraf=require(_0xd4cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xd4cf('0x8'));module[_0xd4cf('0x9')]=function(_0x23710d,_0x108507){return _0x23710d[_0xd4cf('0xa')](_0xd4cf('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb76d=['path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3d34f0,_0x4a5dc0){var _0x135ecd=function(_0x9a81d5){while(--_0x9a81d5){_0x3d34f0['push'](_0x3d34f0['shift']());}};_0x135ecd(++_0x4a5dc0);}(_0xb76d,0x119));var _0xdb76=function(_0x4476ac,_0x3088a3){_0x4476ac=_0x4476ac-0x0;var _0x5a4663=_0xb76d[_0x4476ac];return _0x5a4663;};'use strict';var _=require(_0xdb76('0x0'));var util=require('util');var logger=require(_0xdb76('0x1'))(_0xdb76('0x2'));var moment=require(_0xdb76('0x3'));var BPromise=require('bluebird');var rp=require(_0xdb76('0x4'));var fs=require('fs');var path=require(_0xdb76('0x5'));var rimraf=require(_0xdb76('0x6'));var config=require(_0xdb76('0x7'));var attributes=require(_0xdb76('0x8'));module[_0xdb76('0x9')]=function(_0x5d80df,_0xf1a18d){return _0x5d80df[_0xdb76('0xa')](_0xdb76('0xb'),attributes,{'tableName':_0xdb76('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 3a586e9..08dfed0 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 _0x303a=['ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x303a,0x1a0));var _0xa303=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x303a[_0x59ae8f];return _0x3900b5;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require(_0xa303('0x3'));var fs=require('fs');var Redis=require(_0xa303('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa303('0x5'));var logger=require(_0xa303('0x6'))(_0xa303('0x7'));var config=require(_0xa303('0x8'));var jayson=require(_0xa303('0x9'));var client=jayson[_0xa303('0xa')][_0xa303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f61f1,_0x69b173,_0x5d95fd){return new BPromise(function(_0x51e1ee,_0x488c85){return client[_0xa303('0xc')](_0x3f61f1,_0x5d95fd)[_0xa303('0xd')](function(_0x5e2e48){logger[_0xa303('0xe')]('ContactItemType,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));logger['debug'](_0xa303('0x10'),_0x69b173,_0xa303('0xf'),JSON[_0xa303('0x11')](_0x5e2e48));if(_0x5e2e48[_0xa303('0x12')]){if(_0x5e2e48['error'][_0xa303('0x13')]===0x1f4){logger['error'](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x488c85(_0x5e2e48['error'][_0xa303('0x15')]);}logger[_0xa303('0x12')](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x51e1ee(_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);}else{logger[_0xa303('0xe')]('ContactItemType,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));_0x51e1ee(_0x5e2e48[_0xa303('0x16')][_0xa303('0x15')]);}})[_0xa303('0x17')](function(_0x3e2813){logger[_0xa303('0x12')]('ContactItemType,\x20%s,\x20%s',_0x69b173,_0x3e2813);_0x488c85(_0x3e2813);});});} \ No newline at end of file +var _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x24c38a,_0x3ee208){var _0xd55eb7=function(_0x4a7ec1){while(--_0x4a7ec1){_0x24c38a['push'](_0x24c38a['shift']());}};_0xd55eb7(++_0x3ee208);}(_0xb821,0xa7));var _0x1b82=function(_0x4b12fb,_0x20d036){_0x4b12fb=_0x4b12fb-0x0;var _0x451dfa=_0xb821[_0x4b12fb];return _0x451dfa;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 97cdd94..7b07965 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 _0xd90b=['/:id','show','post','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index'];(function(_0xa66c1,_0x20f3e4){var _0x8693e7=function(_0x571790){while(--_0x571790){_0xa66c1['push'](_0xa66c1['shift']());}};_0x8693e7(++_0x20f3e4);}(_0xd90b,0xb6));var _0xbd90=function(_0x46572e,_0x5c0146){_0x46572e=_0x46572e-0x0;var _0x5995ee=_0xd90b[_0x46572e];return _0x5995ee;};'use strict';var multer=require(_0xbd90('0x0'));var util=require(_0xbd90('0x1'));var path=require('path');var timeout=require(_0xbd90('0x2'));var express=require(_0xbd90('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd90('0x4'));var config=require(_0xbd90('0x5'));var controller=require(_0xbd90('0x6'));router[_0xbd90('0x7')]('/',auth[_0xbd90('0x8')](),controller[_0xbd90('0x9')]);router['get'](_0xbd90('0xa'),auth[_0xbd90('0x8')](),controller[_0xbd90('0xb')]);router[_0xbd90('0xc')]('/',auth[_0xbd90('0x8')](),controller['create']);router['put'](_0xbd90('0xa'),auth[_0xbd90('0x8')](),controller['update']);router[_0xbd90('0xd')]('/:id',auth[_0xbd90('0x8')](),controller[_0xbd90('0xe')]);module[_0xbd90('0xf')]=router; \ No newline at end of file +var _0x8747=['get','isAuthenticated','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x4185e3,_0xdcab5f){var _0x4892df=function(_0x3debbc){while(--_0x3debbc){_0x4185e3['push'](_0x4185e3['shift']());}};_0x4892df(++_0xdcab5f);}(_0x8747,0xf2));var _0x7874=function(_0x1352f0,_0x4cd565){_0x1352f0=_0x1352f0-0x0;var _0x1c2a82=_0x8747[_0x1352f0];return _0x1c2a82;};'use strict';var multer=require(_0x7874('0x0'));var util=require(_0x7874('0x1'));var path=require(_0x7874('0x2'));var timeout=require(_0x7874('0x3'));var express=require(_0x7874('0x4'));var router=express[_0x7874('0x5')]();var auth=require(_0x7874('0x6'));var interaction=require(_0x7874('0x7'));var config=require(_0x7874('0x8'));var controller=require(_0x7874('0x9'));router[_0x7874('0xa')]('/',auth[_0x7874('0xb')](),controller['index']);router[_0x7874('0xa')](_0x7874('0xc'),auth[_0x7874('0xb')](),controller[_0x7874('0xd')]);router['post']('/',auth[_0x7874('0xb')](),controller[_0x7874('0xe')]);router['put']('/:id',auth[_0x7874('0xb')](),controller[_0x7874('0xf')]);router['delete'](_0x7874('0xc'),auth[_0x7874('0xb')](),controller[_0x7874('0x10')]);module[_0x7874('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index b35c9b6..f6aa971 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 _0xdf67=['exports','STRING','name','sequelize'];(function(_0x2def91,_0x26f1e8){var _0x5e85d3=function(_0x3b2641){while(--_0x3b2641){_0x2def91['push'](_0x2def91['shift']());}};_0x5e85d3(++_0x26f1e8);}(_0xdf67,0x117));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7df6('0x0'));module[_0x7df6('0x1')]={'name':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'unique':_0x7df6('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c97=['sequelize','exports','STRING','name'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8c97,0x194));var _0x78c9=function(_0x564e1d,_0x2d3976){_0x564e1d=_0x564e1d-0x0;var _0x144d76=_0x8c97[_0x564e1d];return _0x144d76;};'use strict';var Sequelize=require(_0x78c9('0x0'));module[_0x78c9('0x1')]={'name':{'type':Sequelize[_0x78c9('0x2')],'allowNull':![],'unique':_0x78c9('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 333b614..8ea2157 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 _0x20de=['attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardItem','getItems','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','then','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','catch','params','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x20de,0x1e6));var _0xe20d=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x20de[_0x255d5b];return _0x3e141a;};'use strict';var pdf=require(_0xe20d('0x0'));var emlformat=require(_0xe20d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe20d('0x2'));var jsonpatch=require(_0xe20d('0x3'));var rp=require(_0xe20d('0x4'));var moment=require(_0xe20d('0x5'));var BPromise=require(_0xe20d('0x6'));var Mustache=require(_0xe20d('0x7'));var util=require(_0xe20d('0x8'));var path=require(_0xe20d('0x9'));var sox=require(_0xe20d('0xa'));var csv=require(_0xe20d('0xb'));var ejs=require(_0xe20d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe20d('0xd'));var jsforce=require(_0xe20d('0xe'));var deskjs=require(_0xe20d('0xf'));var toCsv=require(_0xe20d('0xb'));var querystring=require('querystring');var Papa=require(_0xe20d('0x10'));var Redis=require('ioredis');var authService=require(_0xe20d('0x11'));var qs=require(_0xe20d('0x12'));var as=require(_0xe20d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe20d('0x14'));var utils=require('../../config/utils');var config=require(_0xe20d('0x15'));var db=require(_0xe20d('0x16'))['db'];config['redis']=_[_0xe20d('0x17')](config[_0xe20d('0x18')],{'host':_0xe20d('0x19'),'port':0x18eb});var socket=require(_0xe20d('0x1a'))(new Redis(config[_0xe20d('0x18')]));require(_0xe20d('0x1b'))[_0xe20d('0x1c')](socket);function respondWithStatusCode(_0x3bda00,_0x46f09e){_0x46f09e=_0x46f09e||0xcc;return function(_0x1527dc){if(_0x1527dc){return _0x3bda00[_0xe20d('0x1d')](_0x46f09e);}return _0x3bda00[_0xe20d('0x1e')](_0x46f09e)['end']();};}function respondWithResult(_0x4670c0,_0x21bf7e){_0x21bf7e=_0x21bf7e||0xc8;return function(_0x571bc8){if(_0x571bc8){return _0x4670c0[_0xe20d('0x1e')](_0x21bf7e)[_0xe20d('0x1f')](_0x571bc8);}};}function respondWithFilteredResult(_0x4fe803,_0x202737){return function(_0x56ec99){if(_0x56ec99){var _0x58e96f=_0x56ec99[_0xe20d('0x20')],_0x3b475a=_0x202737['offset'],_0x24965f=_0x202737[_0xe20d('0x21')]+_0x202737[_0xe20d('0x22')],_0x140f01;if(_0x24965f>=_0x58e96f){_0x24965f=_0x58e96f;_0x140f01=0xc8;}else{_0x140f01=0xce;}_0x4fe803[_0xe20d('0x1e')](_0x140f01);return _0x4fe803['set'](_0xe20d('0x23'),_0x3b475a+'-'+_0x24965f+'/'+_0x58e96f)['json'](_0x56ec99);}return null;};}function patchUpdates(_0x55096c){return function(_0x2dbe8a){try{jsonpatch[_0xe20d('0x24')](_0x2dbe8a,_0x55096c,!![]);}catch(_0x5a4cb2){return BPromise[_0xe20d('0x25')](_0x5a4cb2);}return _0x2dbe8a['save']();};}function saveUpdates(_0x2b349e,_0x5f2ec0){return function(_0x1390c3){if(_0x1390c3){return _0x1390c3['update'](_0x2b349e)[_0xe20d('0x26')](function(_0x4ed0fa){return _0x4ed0fa;});}return null;};}function removeEntity(_0x4f700b,_0x1e4bfe){return function(_0x5354b4){if(_0x5354b4){return _0x5354b4['destroy']()[_0xe20d('0x26')](function(){var _0x5178ed=_0x5354b4[_0xe20d('0x27')]({'plain':!![]});var _0x328b78=_0xe20d('0x28');return db[_0xe20d('0x29')]['destroy']({'where':{'type':_0x328b78,'resourceId':_0x5178ed['id']}})[_0xe20d('0x26')](function(){return _0x5354b4;});})[_0xe20d('0x26')](function(){_0x4f700b[_0xe20d('0x1e')](0xcc)[_0xe20d('0x2a')]();});}};}function handleEntityNotFound(_0x2b85b7,_0x3f390d){return function(_0x483691){if(!_0x483691){_0x2b85b7[_0xe20d('0x1d')](0x194);}return _0x483691;};}function handleError(_0x5093aa,_0x3b083a){_0x3b083a=_0x3b083a||0x1f4;return function(_0x259a9b){logger[_0xe20d('0x2b')](_0x259a9b[_0xe20d('0x2c')]);if(_0x259a9b[_0xe20d('0x2d')]){delete _0x259a9b[_0xe20d('0x2d')];}_0x5093aa[_0xe20d('0x1e')](_0x3b083a)[_0xe20d('0x2e')](_0x259a9b);};}exports[_0xe20d('0x2f')]=function(_0x19fc0b,_0x3b948b){var _0x49979c={},_0x365ab8={},_0x4382c6={'count':0x0,'rows':[]};var _0x4b7e4a=_['map'](db[_0xe20d('0x30')][_0xe20d('0x31')],function(_0x4899fd){return{'name':_0x4899fd[_0xe20d('0x32')],'type':_0x4899fd[_0xe20d('0x33')][_0xe20d('0x34')]};});_0x365ab8[_0xe20d('0x35')]=_[_0xe20d('0x36')](_0x4b7e4a,_0xe20d('0x2d'));_0x365ab8[_0xe20d('0x37')]=_[_0xe20d('0x38')](_0x19fc0b[_0xe20d('0x37')]);_0x365ab8[_0xe20d('0x39')]=_[_0xe20d('0x3a')](_0x365ab8[_0xe20d('0x35')],_0x365ab8[_0xe20d('0x37')]);_0x49979c['attributes']=_[_0xe20d('0x3a')](_0x365ab8[_0xe20d('0x35')],qs[_0xe20d('0x3b')](_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x3b')]));_0x49979c['attributes']=_0x49979c['attributes'][_0xe20d('0x3c')]?_0x49979c[_0xe20d('0x3d')]:_0x365ab8[_0xe20d('0x35')];if(!_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x3e')]('nolimit')){_0x49979c[_0xe20d('0x22')]=qs[_0xe20d('0x22')](_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x22')]);_0x49979c[_0xe20d('0x21')]=qs[_0xe20d('0x21')](_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x21')]);}_0x49979c[_0xe20d('0x3f')]=qs['sort'](_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x40')]);_0x49979c[_0xe20d('0x41')]=qs['filters'](_[_0xe20d('0x42')](_0x19fc0b['query'],_0x365ab8[_0xe20d('0x39')]),_0x4b7e4a);if(_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x43')]){_0x49979c[_0xe20d('0x41')]=_['merge'](_0x49979c[_0xe20d('0x41')],{'$or':_[_0xe20d('0x36')](_0x4b7e4a,function(_0x284a5a){if(_0x284a5a['type']!==_0xe20d('0x44')){var _0x2a3442={};_0x2a3442[_0x284a5a['name']]={'$like':'%'+_0x19fc0b['query'][_0xe20d('0x43')]+'%'};return _0x2a3442;}})});}_0x49979c=_['merge']({},_0x49979c,_0x19fc0b[_0xe20d('0x45')]);var _0x5a917c={'where':_0x49979c[_0xe20d('0x41')]};return db[_0xe20d('0x30')][_0xe20d('0x20')](_0x5a917c)[_0xe20d('0x26')](function(_0xe797ff){_0x4382c6[_0xe20d('0x20')]=_0xe797ff;if(_0x19fc0b[_0xe20d('0x37')]['includeAll']){_0x49979c[_0xe20d('0x46')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x49979c);})[_0xe20d('0x26')](function(_0x526877){_0x4382c6['rows']=_0x526877;return _0x4382c6;})[_0xe20d('0x26')](respondWithFilteredResult(_0x3b948b,_0x49979c))[_0xe20d('0x47')](handleError(_0x3b948b,null));};exports['show']=function(_0x2898f2,_0x137ec9){var _0x3717b5={'raw':![],'where':{'id':_0x2898f2[_0xe20d('0x48')]['id']}},_0x42c86f={};_0x42c86f[_0xe20d('0x35')]=_[_0xe20d('0x38')](db['Dashboard'][_0xe20d('0x31')]);_0x42c86f['query']=_[_0xe20d('0x38')](_0x2898f2[_0xe20d('0x37')]);_0x42c86f['filters']=_[_0xe20d('0x3a')](_0x42c86f[_0xe20d('0x35')],_0x42c86f[_0xe20d('0x37')]);_0x3717b5['attributes']=_[_0xe20d('0x3a')](_0x42c86f[_0xe20d('0x35')],qs[_0xe20d('0x3b')](_0x2898f2['query']['fields']));_0x3717b5[_0xe20d('0x3d')]=_0x3717b5[_0xe20d('0x3d')][_0xe20d('0x3c')]?_0x3717b5[_0xe20d('0x3d')]:_0x42c86f[_0xe20d('0x35')];if(_0x2898f2[_0xe20d('0x37')][_0xe20d('0x49')]){_0x3717b5[_0xe20d('0x46')]=[{'all':!![]}];}_0x3717b5=_[_0xe20d('0x4a')]({},_0x3717b5,_0x2898f2[_0xe20d('0x45')]);return db['Dashboard'][_0xe20d('0x4b')](_0x3717b5)[_0xe20d('0x26')](handleEntityNotFound(_0x137ec9,null))[_0xe20d('0x26')](respondWithResult(_0x137ec9,null))[_0xe20d('0x47')](handleError(_0x137ec9,null));};exports[_0xe20d('0x4c')]=function(_0x4ac935,_0x5eb31c){return db[_0xe20d('0x30')][_0xe20d('0x4c')](_0x4ac935['body'],{})[_0xe20d('0x26')](function(_0x3ccb47){var _0x4c2a43=_0x4ac935[_0xe20d('0x4d')]['get']({'plain':!![]});if(!_0x4c2a43)throw new Error(_0xe20d('0x4e'));if(_0x4c2a43[_0xe20d('0x4f')]==='user'){var _0x29108f=_0x3ccb47['get']({'plain':!![]});var _0x471a19=_0xe20d('0x28');return db[_0xe20d('0x50')][_0xe20d('0x4b')]({'where':{'name':_0x471a19,'userProfileId':_0x4c2a43[_0xe20d('0x51')]},'raw':!![]})[_0xe20d('0x26')](function(_0x3e1fb9){if(_0x3e1fb9&&_0x3e1fb9[_0xe20d('0x52')]===0x0){return db['UserProfileResource'][_0xe20d('0x4c')]({'name':_0x29108f['name'],'resourceId':_0x29108f['id'],'type':_0x3e1fb9[_0xe20d('0x2d')],'sectionId':_0x3e1fb9['id']},{})[_0xe20d('0x26')](function(){return _0x3ccb47;});}else{return _0x3ccb47;}})[_0xe20d('0x47')](function(_0x1f80e9){logger[_0xe20d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f80e9);throw _0x1f80e9;});}return _0x3ccb47;})[_0xe20d('0x26')](respondWithResult(_0x5eb31c,0xc9))[_0xe20d('0x47')](handleError(_0x5eb31c,null));};exports[_0xe20d('0x53')]=function(_0x250d18,_0x475ff1){var _0x4ea215={'where':{'id':_0x250d18[_0xe20d('0x48')]['id']}},_0x34ae4c={};_0x34ae4c['model']=_[_0xe20d('0x38')](db[_0xe20d('0x30')][_0xe20d('0x31')]);_0x4ea215[_0xe20d('0x3d')]=_['intersection'](_0x34ae4c[_0xe20d('0x35')],qs['fields'](_0x250d18[_0xe20d('0x37')][_0xe20d('0x3b')]));_0x4ea215[_0xe20d('0x3d')]=_0x4ea215['attributes'][_0xe20d('0x3c')]?_0x4ea215[_0xe20d('0x3d')]:_0x34ae4c[_0xe20d('0x35')];if(_0x250d18[_0xe20d('0x37')]['includeAll']){_0x4ea215[_0xe20d('0x46')]=[{'all':!![]}];}_0x4ea215=_[_0xe20d('0x4a')]({},_0x4ea215,_0x250d18[_0xe20d('0x45')]);return db[_0xe20d('0x30')]['find'](_0x4ea215)[_0xe20d('0x26')](handleEntityNotFound(_0x475ff1,null))['then'](function(_0x30afac){if(_0x30afac){var _0x7050b0=_0x30afac[_0xe20d('0x27')]({'plain':!![]});_0x7050b0=qs[_0xe20d('0x54')](_0x7050b0,['id',_0xe20d('0x55'),_0xe20d('0x56')]);_0x250d18[_0xe20d('0x57')]=_['omit'](_0x250d18[_0xe20d('0x57')],['id',_0xe20d('0x55'),_0xe20d('0x56')]);return db[_0xe20d('0x30')][_0xe20d('0x4c')](_[_0xe20d('0x4a')](_0x7050b0,_0x250d18[_0xe20d('0x57')]),{'include':_0x250d18[_0xe20d('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0xe20d('0x26')](function(_0x5ac4e5){var _0x2d81c6=_0x250d18[_0xe20d('0x4d')][_0xe20d('0x27')]({'plain':!![]});if(!_0x2d81c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d81c6['role']===_0xe20d('0x4d')){var _0x33352f=_0x5ac4e5[_0xe20d('0x27')]({'plain':!![]});var _0x1762df=_0xe20d('0x28');return db[_0xe20d('0x50')][_0xe20d('0x4b')]({'where':{'name':_0x1762df,'userProfileId':_0x2d81c6['userProfileId']},'raw':!![]})[_0xe20d('0x26')](function(_0x116d9e){if(_0x116d9e&&_0x116d9e[_0xe20d('0x52')]===0x0){return db[_0xe20d('0x29')][_0xe20d('0x4c')]({'name':_0x33352f[_0xe20d('0x2d')],'resourceId':_0x33352f['id'],'type':_0x116d9e[_0xe20d('0x2d')],'sectionId':_0x116d9e['id']},{})[_0xe20d('0x26')](function(){return _0x5ac4e5;});}else{return _0x5ac4e5;}})[_0xe20d('0x47')](function(_0x329c82){logger[_0xe20d('0x2b')](_0xe20d('0x58'),_0x329c82);throw _0x329c82;});}return _0x5ac4e5;});}})['then'](respondWithResult(_0x475ff1,0xc9))['catch'](handleError(_0x475ff1,null));};exports[_0xe20d('0x59')]=function(_0x5e2eca,_0x21929e){if(_0x5e2eca[_0xe20d('0x57')]['id']){delete _0x5e2eca[_0xe20d('0x57')]['id'];}return db[_0xe20d('0x30')]['find']({'where':{'id':_0x5e2eca[_0xe20d('0x48')]['id']}})[_0xe20d('0x26')](handleEntityNotFound(_0x21929e,null))['then'](saveUpdates(_0x5e2eca['body'],null))[_0xe20d('0x26')](respondWithResult(_0x21929e,null))[_0xe20d('0x47')](handleError(_0x21929e,null));};exports[_0xe20d('0x5a')]=function(_0xb7f62e,_0x14cd81){return db[_0xe20d('0x30')][_0xe20d('0x4b')]({'where':{'id':_0xb7f62e[_0xe20d('0x48')]['id']}})['then'](handleEntityNotFound(_0x14cd81,null))[_0xe20d('0x26')](removeEntity(_0x14cd81,null))[_0xe20d('0x47')](handleError(_0x14cd81,null));};function widgetAttributes(_0x142f0e){try{switch(_0x142f0e['type']){case _0xe20d('0x5b'):return[{'name':_0xe20d('0x5c'),'value':_0x142f0e[_0xe20d('0x5c')]||(_0x142f0e['attrs']&&_0x142f0e['attrs'][0x0]?_0x142f0e[_0xe20d('0x5d')][0x0][_0xe20d('0x5e')]:undefined)||_0xe20d('0x5f')}];case'custom':return[{'name':_0xe20d('0x60'),'value':_0x142f0e[_0xe20d('0x60')]||(_0x142f0e['attrs']&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e[_0xe20d('0x5d')][0x0][_0xe20d('0x5e')]:undefined)||''}];case'clock':return[{'name':_0xe20d('0x61'),'value':_0x142f0e[_0xe20d('0x61')]||(_0x142f0e['attrs']&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e['attrs'][0x0][_0xe20d('0x5e')]:undefined)||_0xe20d('0x62')},{'name':_0xe20d('0x63'),'value':_0x142f0e['attrTimezone']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x1]?_0x142f0e[_0xe20d('0x5d')][0x1][_0xe20d('0x5e')]:undefined)||_0xe20d('0x64')},{'name':'attrFontSize','value':_0x142f0e['attrFontSize']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x2]?_0x142f0e[_0xe20d('0x5d')][0x2]['value']:undefined)||0xc}];case _0xe20d('0x65'):return[{'name':'attrMetric','value':_0x142f0e[_0xe20d('0x66')]||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e['attrs'][0x0]?_0x142f0e['attrs'][0x0]['value']:undefined)||_0xe20d('0x67')},{'name':_0xe20d('0x68'),'value':_0x142f0e['attrVoiceQueues']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x1]?_0x142f0e[_0xe20d('0x5d')][0x1][_0xe20d('0x5e')]:undefined)||[]},{'name':_0xe20d('0x69'),'value':_0x142f0e[_0xe20d('0x69')]||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x2]?_0x142f0e['attrs'][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xe20d('0x6a'):return[{'name':'attrSerie1','value':_0x142f0e['attrSerie1']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e['attrs'][0x0]['value']:undefined)||_0xe20d('0x67')},{'name':_0xe20d('0x6b'),'value':_0x142f0e['attrSerie2']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x1]?_0x142f0e[_0xe20d('0x5d')][0x1][_0xe20d('0x5e')]:undefined)||null},{'name':_0xe20d('0x6c'),'value':_0x142f0e[_0xe20d('0x6c')]||(_0x142f0e['attrs']&&_0x142f0e['attrs'][0x2]?_0x142f0e[_0xe20d('0x5d')][0x2][_0xe20d('0x5e')]:undefined)||null},{'name':_0xe20d('0x68'),'value':_0x142f0e[_0xe20d('0x68')]||(_0x142f0e['attrs']&&_0x142f0e[_0xe20d('0x5d')][0x3]?_0x142f0e[_0xe20d('0x5d')][0x3][_0xe20d('0x5e')]:undefined)||[]}];case _0xe20d('0x6d'):return[{'name':_0xe20d('0x6e'),'type':_0x142f0e[_0xe20d('0x6f')]||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e[_0xe20d('0x5d')][0x0][_0xe20d('0x33')]:undefined)||null,'value':_0x142f0e['attrReport']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e[_0xe20d('0x5d')][0x0][_0xe20d('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x142f0e[_0xe20d('0x70')]||(_0x142f0e['attrs']&&_0x142f0e['attrs'][0x1]?_0x142f0e[_0xe20d('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x363543){logger[_0xe20d('0x2b')]('widgetAttributes:\x20%s',JSON[_0xe20d('0x71')](_0x363543));return[];}}exports[_0xe20d('0x72')]=function(_0x28d76c,_0x31de99,_0x4eba01){if(_0x28d76c[_0xe20d('0x57')]['id']){delete _0x28d76c['body']['id'];}return db[_0xe20d('0x30')][_0xe20d('0x4b')]({'where':{'id':_0x28d76c[_0xe20d('0x48')]['id']}})[_0xe20d('0x26')](handleEntityNotFound(_0x31de99,null))[_0xe20d('0x26')](function(_0x5fb79a){if(_0x5fb79a){_0x28d76c[_0xe20d('0x57')]['DashboardId']=_0x5fb79a['id'];_0x28d76c[_0xe20d('0x57')][_0xe20d('0x5d')]=widgetAttributes(_0x28d76c[_0xe20d('0x57')]);return db[_0xe20d('0x73')][_0xe20d('0x4c')](_0x28d76c[_0xe20d('0x57')]);}})[_0xe20d('0x26')](respondWithResult(_0x31de99,null))[_0xe20d('0x47')](handleError(_0x31de99,null));};exports[_0xe20d('0x74')]=function(_0x37e246,_0x144384,_0x6b58a1){var _0x590cf0={};var _0x4d2671={};var _0x496bdb;var _0x3bbd59;return db['Dashboard']['findOne']({'where':{'id':_0x37e246[_0xe20d('0x48')]['id']}})[_0xe20d('0x26')](handleEntityNotFound(_0x144384,null))[_0xe20d('0x26')](function(_0x6c2e8e){if(_0x6c2e8e){_0x496bdb=_0x6c2e8e;_0x4d2671[_0xe20d('0x35')]=_['keys'](db['DashboardItem'][_0xe20d('0x31')]);_0x4d2671[_0xe20d('0x37')]=_[_0xe20d('0x38')](_0x37e246[_0xe20d('0x37')]);_0x4d2671[_0xe20d('0x39')]=_[_0xe20d('0x3a')](_0x4d2671[_0xe20d('0x35')],_0x4d2671[_0xe20d('0x37')]);_0x590cf0['attributes']=_[_0xe20d('0x3a')](_0x4d2671['model'],qs[_0xe20d('0x3b')](_0x37e246['query'][_0xe20d('0x3b')]));_0x590cf0['attributes']=_0x590cf0[_0xe20d('0x3d')]['length']?_0x590cf0[_0xe20d('0x3d')]:_0x4d2671[_0xe20d('0x35')];_0x590cf0[_0xe20d('0x3f')]=qs['sort'](_0x37e246[_0xe20d('0x37')][_0xe20d('0x40')]);_0x590cf0[_0xe20d('0x41')]=qs[_0xe20d('0x39')](_['pick'](_0x37e246[_0xe20d('0x37')],_0x4d2671[_0xe20d('0x39')]));if(_0x37e246[_0xe20d('0x37')][_0xe20d('0x43')]){_0x590cf0[_0xe20d('0x41')]=_[_0xe20d('0x4a')](_0x590cf0[_0xe20d('0x41')],{'$or':_['map'](_0x590cf0[_0xe20d('0x3d')],function(_0x3cd898){var _0xf89868={};_0xf89868[_0x3cd898]={'$like':'%'+_0x37e246[_0xe20d('0x37')][_0xe20d('0x43')]+'%'};return _0xf89868;})});}_0x590cf0=_['merge']({},_0x590cf0,_0x37e246[_0xe20d('0x45')]);return _0x496bdb[_0xe20d('0x74')](_0x590cf0);}})[_0xe20d('0x26')](function(_0x3cf1e9){if(_0x3cf1e9){_0x3bbd59=_0x3cf1e9[_0xe20d('0x3c')];if(!_0x37e246[_0xe20d('0x37')][_0xe20d('0x3e')]('nolimit')){_0x590cf0[_0xe20d('0x22')]=qs[_0xe20d('0x22')](_0x37e246[_0xe20d('0x37')][_0xe20d('0x22')]);_0x590cf0[_0xe20d('0x21')]=qs[_0xe20d('0x21')](_0x37e246[_0xe20d('0x37')][_0xe20d('0x21')]);}return _0x496bdb[_0xe20d('0x74')](_0x590cf0);}})[_0xe20d('0x26')](function(_0x29fcdd){if(_0x29fcdd){return _0x29fcdd?{'count':_0x3bbd59,'rows':_0x29fcdd}:null;}})['then'](respondWithResult(_0x144384,null))[_0xe20d('0x47')](handleError(_0x144384,null));}; \ No newline at end of file +var _0xe1b2=['findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','addItem','DashboardId','findOne','DashboardItem','order','pick','getItems','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x37ed1b,_0x484103){var _0xeeba01=function(_0x162c6e){while(--_0x162c6e){_0x37ed1b['push'](_0x37ed1b['shift']());}};_0xeeba01(++_0x484103);}(_0xe1b2,0x18d));var _0x2e1b=function(_0x3acece,_0xaa613e){_0x3acece=_0x3acece-0x0;var _0x2b7255=_0xe1b2[_0x3acece];return _0x2b7255;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2e1b('0x0'));var rimraf=require(_0x2e1b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2e1b('0x2'));var BPromise=require(_0x2e1b('0x3'));var Mustache=require(_0x2e1b('0x4'));var util=require('util');var path=require(_0x2e1b('0x5'));var sox=require(_0x2e1b('0x6'));var csv=require(_0x2e1b('0x7'));var ejs=require(_0x2e1b('0x8'));var fs=require('fs');var _=require(_0x2e1b('0x9'));var squel=require('squel');var crypto=require(_0x2e1b('0xa'));var jsforce=require(_0x2e1b('0xb'));var deskjs=require(_0x2e1b('0xc'));var toCsv=require(_0x2e1b('0x7'));var querystring=require(_0x2e1b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2e1b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e1b('0xf'));var logger=require(_0x2e1b('0x10'))('api');var utils=require(_0x2e1b('0x11'));var config=require(_0x2e1b('0x12'));var db=require(_0x2e1b('0x13'))['db'];config['redis']=_[_0x2e1b('0x14')](config[_0x2e1b('0x15')],{'host':_0x2e1b('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e1b('0x15')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x48ac40,_0x47eed8){_0x47eed8=_0x47eed8||0xcc;return function(_0x36a91e){if(_0x36a91e){return _0x48ac40[_0x2e1b('0x17')](_0x47eed8);}return _0x48ac40[_0x2e1b('0x18')](_0x47eed8)[_0x2e1b('0x19')]();};}function respondWithResult(_0x93dd75,_0x472563){_0x472563=_0x472563||0xc8;return function(_0x3aa210){if(_0x3aa210){return _0x93dd75[_0x2e1b('0x18')](_0x472563)[_0x2e1b('0x1a')](_0x3aa210);}};}function respondWithFilteredResult(_0x24a8e2,_0x233991){return function(_0x41ffb4){if(_0x41ffb4){var _0xf4c5d6=_0x41ffb4[_0x2e1b('0x1b')],_0x367377=_0x233991[_0x2e1b('0x1c')],_0x55a55c=_0x233991['offset']+_0x233991['limit'],_0x30008c;if(_0x55a55c>=_0xf4c5d6){_0x55a55c=_0xf4c5d6;_0x30008c=0xc8;}else{_0x30008c=0xce;}_0x24a8e2[_0x2e1b('0x18')](_0x30008c);return _0x24a8e2[_0x2e1b('0x1d')](_0x2e1b('0x1e'),_0x367377+'-'+_0x55a55c+'/'+_0xf4c5d6)[_0x2e1b('0x1a')](_0x41ffb4);}return null;};}function patchUpdates(_0x523e97){return function(_0x25f7d6){try{jsonpatch['apply'](_0x25f7d6,_0x523e97,!![]);}catch(_0x3691d7){return BPromise[_0x2e1b('0x1f')](_0x3691d7);}return _0x25f7d6[_0x2e1b('0x20')]();};}function saveUpdates(_0x86c386,_0x386041){return function(_0x3676f1){if(_0x3676f1){return _0x3676f1[_0x2e1b('0x21')](_0x86c386)['then'](function(_0x21c6b7){return _0x21c6b7;});}return null;};}function removeEntity(_0x2b109e,_0x5e9820){return function(_0x39cd61){if(_0x39cd61){return _0x39cd61[_0x2e1b('0x22')]()[_0x2e1b('0x23')](function(){var _0x33eeb9=_0x39cd61[_0x2e1b('0x24')]({'plain':!![]});var _0x534d3d=_0x2e1b('0x25');return db[_0x2e1b('0x26')]['destroy']({'where':{'type':_0x534d3d,'resourceId':_0x33eeb9['id']}})['then'](function(){return _0x39cd61;});})[_0x2e1b('0x23')](function(){_0x2b109e['status'](0xcc)[_0x2e1b('0x19')]();});}};}function handleEntityNotFound(_0x422ab6,_0x11ea89){return function(_0x3f9038){if(!_0x3f9038){_0x422ab6[_0x2e1b('0x17')](0x194);}return _0x3f9038;};}function handleError(_0xc17155,_0xc55a55){_0xc55a55=_0xc55a55||0x1f4;return function(_0x255017){logger[_0x2e1b('0x27')](_0x255017['stack']);if(_0x255017['name']){delete _0x255017[_0x2e1b('0x28')];}_0xc17155[_0x2e1b('0x18')](_0xc55a55)[_0x2e1b('0x29')](_0x255017);};}exports[_0x2e1b('0x2a')]=function(_0x478f2c,_0x4b019a){var _0x1559a4={},_0x51291d={},_0x557fba={'count':0x0,'rows':[]};var _0x544821=_[_0x2e1b('0x2b')](db[_0x2e1b('0x2c')][_0x2e1b('0x2d')],function(_0x331053){return{'name':_0x331053[_0x2e1b('0x2e')],'type':_0x331053[_0x2e1b('0x2f')][_0x2e1b('0x30')]};});_0x51291d[_0x2e1b('0x31')]=_[_0x2e1b('0x2b')](_0x544821,_0x2e1b('0x28'));_0x51291d[_0x2e1b('0x32')]=_['keys'](_0x478f2c[_0x2e1b('0x32')]);_0x51291d[_0x2e1b('0x33')]=_[_0x2e1b('0x34')](_0x51291d[_0x2e1b('0x31')],_0x51291d['query']);_0x1559a4[_0x2e1b('0x35')]=_[_0x2e1b('0x34')](_0x51291d[_0x2e1b('0x31')],qs[_0x2e1b('0x36')](_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x36')]));_0x1559a4[_0x2e1b('0x35')]=_0x1559a4[_0x2e1b('0x35')][_0x2e1b('0x37')]?_0x1559a4[_0x2e1b('0x35')]:_0x51291d[_0x2e1b('0x31')];if(!_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x38')](_0x2e1b('0x39'))){_0x1559a4[_0x2e1b('0x3a')]=qs[_0x2e1b('0x3a')](_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x3a')]);_0x1559a4[_0x2e1b('0x1c')]=qs['offset'](_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x1c')]);}_0x1559a4['order']=qs[_0x2e1b('0x3b')](_0x478f2c[_0x2e1b('0x32')]['sort']);_0x1559a4[_0x2e1b('0x3c')]=qs[_0x2e1b('0x33')](_['pick'](_0x478f2c['query'],_0x51291d[_0x2e1b('0x33')]),_0x544821);if(_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x3d')]){_0x1559a4[_0x2e1b('0x3c')]=_[_0x2e1b('0x3e')](_0x1559a4[_0x2e1b('0x3c')],{'$or':_[_0x2e1b('0x2b')](_0x544821,function(_0x41d251){if(_0x41d251['type']!==_0x2e1b('0x3f')){var _0x4b6a24={};_0x4b6a24[_0x41d251[_0x2e1b('0x28')]]={'$like':'%'+_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x3d')]+'%'};return _0x4b6a24;}})});}_0x1559a4=_[_0x2e1b('0x3e')]({},_0x1559a4,_0x478f2c[_0x2e1b('0x40')]);var _0x4732ae={'where':_0x1559a4['where']};return db['Dashboard']['count'](_0x4732ae)[_0x2e1b('0x23')](function(_0x50bbf3){_0x557fba[_0x2e1b('0x1b')]=_0x50bbf3;if(_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x41')]){_0x1559a4[_0x2e1b('0x42')]=[{'all':!![]}];}return db['Dashboard'][_0x2e1b('0x43')](_0x1559a4);})['then'](function(_0x1b0fb8){_0x557fba['rows']=_0x1b0fb8;return _0x557fba;})['then'](respondWithFilteredResult(_0x4b019a,_0x1559a4))[_0x2e1b('0x44')](handleError(_0x4b019a,null));};exports[_0x2e1b('0x45')]=function(_0x33479c,_0x43d597){var _0x23a163={'raw':![],'where':{'id':_0x33479c[_0x2e1b('0x46')]['id']}},_0x5d7960={};_0x5d7960['model']=_[_0x2e1b('0x47')](db[_0x2e1b('0x2c')]['rawAttributes']);_0x5d7960[_0x2e1b('0x32')]=_[_0x2e1b('0x47')](_0x33479c['query']);_0x5d7960[_0x2e1b('0x33')]=_[_0x2e1b('0x34')](_0x5d7960[_0x2e1b('0x31')],_0x5d7960[_0x2e1b('0x32')]);_0x23a163[_0x2e1b('0x35')]=_['intersection'](_0x5d7960['model'],qs[_0x2e1b('0x36')](_0x33479c[_0x2e1b('0x32')][_0x2e1b('0x36')]));_0x23a163[_0x2e1b('0x35')]=_0x23a163[_0x2e1b('0x35')][_0x2e1b('0x37')]?_0x23a163[_0x2e1b('0x35')]:_0x5d7960[_0x2e1b('0x31')];if(_0x33479c[_0x2e1b('0x32')][_0x2e1b('0x41')]){_0x23a163['include']=[{'all':!![]}];}_0x23a163=_['merge']({},_0x23a163,_0x33479c[_0x2e1b('0x40')]);return db[_0x2e1b('0x2c')][_0x2e1b('0x48')](_0x23a163)['then'](handleEntityNotFound(_0x43d597,null))[_0x2e1b('0x23')](respondWithResult(_0x43d597,null))['catch'](handleError(_0x43d597,null));};exports[_0x2e1b('0x49')]=function(_0x1bc5ef,_0x4b067f){return db['Dashboard']['create'](_0x1bc5ef[_0x2e1b('0x4a')],{})['then'](function(_0x4f88a8){var _0x3c052e=_0x1bc5ef[_0x2e1b('0x4b')][_0x2e1b('0x24')]({'plain':!![]});if(!_0x3c052e)throw new Error(_0x2e1b('0x4c'));if(_0x3c052e[_0x2e1b('0x4d')]===_0x2e1b('0x4b')){var _0x5ea10f=_0x4f88a8[_0x2e1b('0x24')]({'plain':!![]});var _0x50b56c=_0x2e1b('0x25');return db['UserProfileSection'][_0x2e1b('0x48')]({'where':{'name':_0x50b56c,'userProfileId':_0x3c052e['userProfileId']},'raw':!![]})[_0x2e1b('0x23')](function(_0x11dfbb){if(_0x11dfbb&&_0x11dfbb[_0x2e1b('0x4e')]===0x0){return db[_0x2e1b('0x26')][_0x2e1b('0x49')]({'name':_0x5ea10f[_0x2e1b('0x28')],'resourceId':_0x5ea10f['id'],'type':_0x11dfbb['name'],'sectionId':_0x11dfbb['id']},{})[_0x2e1b('0x23')](function(){return _0x4f88a8;});}else{return _0x4f88a8;}})[_0x2e1b('0x44')](function(_0x405952){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x405952);throw _0x405952;});}return _0x4f88a8;})['then'](respondWithResult(_0x4b067f,0xc9))['catch'](handleError(_0x4b067f,null));};exports['clone']=function(_0x5a36b6,_0x306af4){var _0x754ce7={'where':{'id':_0x5a36b6[_0x2e1b('0x46')]['id']}},_0x4f833c={};_0x4f833c['model']=_[_0x2e1b('0x47')](db[_0x2e1b('0x2c')][_0x2e1b('0x2d')]);_0x754ce7['attributes']=_['intersection'](_0x4f833c[_0x2e1b('0x31')],qs[_0x2e1b('0x36')](_0x5a36b6['query'][_0x2e1b('0x36')]));_0x754ce7[_0x2e1b('0x35')]=_0x754ce7[_0x2e1b('0x35')][_0x2e1b('0x37')]?_0x754ce7[_0x2e1b('0x35')]:_0x4f833c[_0x2e1b('0x31')];if(_0x5a36b6[_0x2e1b('0x32')][_0x2e1b('0x41')]){_0x754ce7['include']=[{'all':!![]}];}_0x754ce7=_[_0x2e1b('0x3e')]({},_0x754ce7,_0x5a36b6[_0x2e1b('0x40')]);return db[_0x2e1b('0x2c')][_0x2e1b('0x48')](_0x754ce7)[_0x2e1b('0x23')](handleEntityNotFound(_0x306af4,null))[_0x2e1b('0x23')](function(_0x3b6c6f){if(_0x3b6c6f){var _0xd2a440=_0x3b6c6f[_0x2e1b('0x24')]({'plain':!![]});_0xd2a440=qs[_0x2e1b('0x4f')](_0xd2a440,['id',_0x2e1b('0x50'),_0x2e1b('0x51')]);_0x5a36b6[_0x2e1b('0x4a')]=_[_0x2e1b('0x4f')](_0x5a36b6['body'],['id',_0x2e1b('0x50'),_0x2e1b('0x51')]);return db['Dashboard'][_0x2e1b('0x49')](_[_0x2e1b('0x3e')](_0xd2a440,_0x5a36b6['body']),{'include':_0x5a36b6[_0x2e1b('0x32')][_0x2e1b('0x41')]?[{'all':!![]}]:undefined})[_0x2e1b('0x23')](function(_0x5cc143){var _0x485d52=_0x5a36b6[_0x2e1b('0x4b')]['get']({'plain':!![]});if(!_0x485d52)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x485d52['role']==='user'){var _0x5f3771=_0x5cc143['get']({'plain':!![]});var _0x516aac=_0x2e1b('0x25');return db['UserProfileSection'][_0x2e1b('0x48')]({'where':{'name':_0x516aac,'userProfileId':_0x485d52[_0x2e1b('0x52')]},'raw':!![]})['then'](function(_0x4eb5fb){if(_0x4eb5fb&&_0x4eb5fb[_0x2e1b('0x4e')]===0x0){return db['UserProfileResource'][_0x2e1b('0x49')]({'name':_0x5f3771[_0x2e1b('0x28')],'resourceId':_0x5f3771['id'],'type':_0x4eb5fb[_0x2e1b('0x28')],'sectionId':_0x4eb5fb['id']},{})[_0x2e1b('0x23')](function(){return _0x5cc143;});}else{return _0x5cc143;}})[_0x2e1b('0x44')](function(_0x15d88f){logger[_0x2e1b('0x27')](_0x2e1b('0x53'),_0x15d88f);throw _0x15d88f;});}return _0x5cc143;});}})['then'](respondWithResult(_0x306af4,0xc9))['catch'](handleError(_0x306af4,null));};exports['update']=function(_0x43dd34,_0x2090ba){if(_0x43dd34[_0x2e1b('0x4a')]['id']){delete _0x43dd34['body']['id'];}return db[_0x2e1b('0x2c')][_0x2e1b('0x48')]({'where':{'id':_0x43dd34[_0x2e1b('0x46')]['id']}})[_0x2e1b('0x23')](handleEntityNotFound(_0x2090ba,null))[_0x2e1b('0x23')](saveUpdates(_0x43dd34['body'],null))['then'](respondWithResult(_0x2090ba,null))['catch'](handleError(_0x2090ba,null));};exports[_0x2e1b('0x22')]=function(_0x2b90fa,_0xe61cd9){return db[_0x2e1b('0x2c')]['find']({'where':{'id':_0x2b90fa[_0x2e1b('0x46')]['id']}})[_0x2e1b('0x23')](handleEntityNotFound(_0xe61cd9,null))[_0x2e1b('0x23')](removeEntity(_0xe61cd9,null))['catch'](handleError(_0xe61cd9,null));};function widgetAttributes(_0x1aadc8){try{switch(_0x1aadc8['type']){case _0x2e1b('0x54'):return[{'name':_0x2e1b('0x55'),'value':_0x1aadc8['attrUrl']||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||_0x2e1b('0x58')}];case _0x2e1b('0x59'):return[{'name':_0x2e1b('0x5a'),'value':_0x1aadc8[_0x2e1b('0x5a')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||''}];case _0x2e1b('0x5b'):return[{'name':_0x2e1b('0x5c'),'value':_0x1aadc8[_0x2e1b('0x5c')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||_0x2e1b('0x5d')},{'name':_0x2e1b('0x5e'),'value':_0x1aadc8[_0x2e1b('0x5e')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x1]?_0x1aadc8[_0x2e1b('0x56')][0x1]['value']:undefined)||'0.00'},{'name':_0x2e1b('0x5f'),'value':_0x1aadc8['attrFontSize']||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8['attrs'][0x2]?_0x1aadc8['attrs'][0x2][_0x2e1b('0x57')]:undefined)||0xc}];case _0x2e1b('0x60'):return[{'name':_0x2e1b('0x61'),'value':_0x1aadc8[_0x2e1b('0x61')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||_0x2e1b('0x62')},{'name':_0x2e1b('0x63'),'value':_0x1aadc8[_0x2e1b('0x63')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x1]?_0x1aadc8[_0x2e1b('0x56')][0x1][_0x2e1b('0x57')]:undefined)||[]},{'name':_0x2e1b('0x5f'),'value':_0x1aadc8[_0x2e1b('0x5f')]||(_0x1aadc8['attrs']&&_0x1aadc8[_0x2e1b('0x56')][0x2]?_0x1aadc8[_0x2e1b('0x56')][0x2][_0x2e1b('0x57')]:undefined)||0x14}];case'multibar-chart':case _0x2e1b('0x64'):return[{'name':_0x2e1b('0x65'),'value':_0x1aadc8[_0x2e1b('0x65')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||_0x2e1b('0x62')},{'name':_0x2e1b('0x66'),'value':_0x1aadc8[_0x2e1b('0x66')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x1]?_0x1aadc8['attrs'][0x1][_0x2e1b('0x57')]:undefined)||null},{'name':'attrSerie3','value':_0x1aadc8[_0x2e1b('0x67')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8['attrs'][0x2]?_0x1aadc8[_0x2e1b('0x56')][0x2][_0x2e1b('0x57')]:undefined)||null},{'name':_0x2e1b('0x63'),'value':_0x1aadc8[_0x2e1b('0x63')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x3]?_0x1aadc8[_0x2e1b('0x56')][0x3][_0x2e1b('0x57')]:undefined)||[]}];case _0x2e1b('0x68'):return[{'name':'attrReport','type':_0x1aadc8[_0x2e1b('0x69')]||(_0x1aadc8['attrs']&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8['attrs'][0x0][_0x2e1b('0x2f')]:undefined)||null,'value':_0x1aadc8[_0x2e1b('0x6a')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||null},{'name':'attrRefresh','value':_0x1aadc8[_0x2e1b('0x6b')]||(_0x1aadc8['attrs']&&_0x1aadc8[_0x2e1b('0x56')][0x1]?_0x1aadc8[_0x2e1b('0x56')][0x1][_0x2e1b('0x57')]:undefined)||0x0}];default:return[];}}catch(_0x5c5772){logger[_0x2e1b('0x27')]('widgetAttributes:\x20%s',JSON[_0x2e1b('0x6c')](_0x5c5772));return[];}}exports[_0x2e1b('0x6d')]=function(_0x2c8bdf,_0x5acc4d,_0x43599c){if(_0x2c8bdf[_0x2e1b('0x4a')]['id']){delete _0x2c8bdf[_0x2e1b('0x4a')]['id'];}return db[_0x2e1b('0x2c')][_0x2e1b('0x48')]({'where':{'id':_0x2c8bdf['params']['id']}})['then'](handleEntityNotFound(_0x5acc4d,null))[_0x2e1b('0x23')](function(_0x34027d){if(_0x34027d){_0x2c8bdf['body'][_0x2e1b('0x6e')]=_0x34027d['id'];_0x2c8bdf[_0x2e1b('0x4a')][_0x2e1b('0x56')]=widgetAttributes(_0x2c8bdf['body']);return db['DashboardItem']['create'](_0x2c8bdf[_0x2e1b('0x4a')]);}})[_0x2e1b('0x23')](respondWithResult(_0x5acc4d,null))[_0x2e1b('0x44')](handleError(_0x5acc4d,null));};exports['getItems']=function(_0x25ee79,_0x721098,_0x19e304){var _0x1828fe={};var _0x12cb34={};var _0x15a810;var _0x1c1e89;return db[_0x2e1b('0x2c')][_0x2e1b('0x6f')]({'where':{'id':_0x25ee79[_0x2e1b('0x46')]['id']}})[_0x2e1b('0x23')](handleEntityNotFound(_0x721098,null))[_0x2e1b('0x23')](function(_0x25c6c6){if(_0x25c6c6){_0x15a810=_0x25c6c6;_0x12cb34[_0x2e1b('0x31')]=_[_0x2e1b('0x47')](db[_0x2e1b('0x70')][_0x2e1b('0x2d')]);_0x12cb34[_0x2e1b('0x32')]=_[_0x2e1b('0x47')](_0x25ee79['query']);_0x12cb34[_0x2e1b('0x33')]=_[_0x2e1b('0x34')](_0x12cb34[_0x2e1b('0x31')],_0x12cb34[_0x2e1b('0x32')]);_0x1828fe['attributes']=_[_0x2e1b('0x34')](_0x12cb34[_0x2e1b('0x31')],qs[_0x2e1b('0x36')](_0x25ee79[_0x2e1b('0x32')]['fields']));_0x1828fe['attributes']=_0x1828fe['attributes'][_0x2e1b('0x37')]?_0x1828fe['attributes']:_0x12cb34[_0x2e1b('0x31')];_0x1828fe[_0x2e1b('0x71')]=qs[_0x2e1b('0x3b')](_0x25ee79[_0x2e1b('0x32')]['sort']);_0x1828fe[_0x2e1b('0x3c')]=qs[_0x2e1b('0x33')](_[_0x2e1b('0x72')](_0x25ee79[_0x2e1b('0x32')],_0x12cb34[_0x2e1b('0x33')]));if(_0x25ee79[_0x2e1b('0x32')][_0x2e1b('0x3d')]){_0x1828fe[_0x2e1b('0x3c')]=_[_0x2e1b('0x3e')](_0x1828fe[_0x2e1b('0x3c')],{'$or':_[_0x2e1b('0x2b')](_0x1828fe[_0x2e1b('0x35')],function(_0x555f83){var _0x321372={};_0x321372[_0x555f83]={'$like':'%'+_0x25ee79[_0x2e1b('0x32')][_0x2e1b('0x3d')]+'%'};return _0x321372;})});}_0x1828fe=_[_0x2e1b('0x3e')]({},_0x1828fe,_0x25ee79[_0x2e1b('0x40')]);return _0x15a810['getItems'](_0x1828fe);}})[_0x2e1b('0x23')](function(_0x1a444c){if(_0x1a444c){_0x1c1e89=_0x1a444c[_0x2e1b('0x37')];if(!_0x25ee79[_0x2e1b('0x32')][_0x2e1b('0x38')](_0x2e1b('0x39'))){_0x1828fe['limit']=qs[_0x2e1b('0x3a')](_0x25ee79['query']['limit']);_0x1828fe['offset']=qs[_0x2e1b('0x1c')](_0x25ee79['query'][_0x2e1b('0x1c')]);}return _0x15a810[_0x2e1b('0x73')](_0x1828fe);}})['then'](function(_0xff0efc){if(_0xff0efc){return _0xff0efc?{'count':_0x1c1e89,'rows':_0xff0efc}:null;}})[_0x2e1b('0x23')](respondWithResult(_0x721098,null))[_0x2e1b('0x44')](handleError(_0x721098,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e2ed45e..5bfccd3 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 _0x3b82=['emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','update','remove'];(function(_0x1a78d6,_0x140c67){var _0x30884a=function(_0x585924){while(--_0x585924){_0x1a78d6['push'](_0x1a78d6['shift']());}};_0x30884a(++_0x140c67);}(_0x3b82,0x159));var _0x23b8=function(_0x1b7d9c,_0x59b000){_0x1b7d9c=_0x1b7d9c-0x0;var _0x439e9d=_0x3b82[_0x1b7d9c];return _0x439e9d;};'use strict';var EventEmitter=require(_0x23b8('0x0'));var Dashboard=require(_0x23b8('0x1'))['db'][_0x23b8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x23b8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x23b8('0x4'),'afterDestroy':_0x23b8('0x5')};function emitEvent(_0x149eee){return function(_0x207fe5,_0x4009e9,_0x2de21c){DashboardEvents[_0x23b8('0x6')](_0x149eee+':'+_0x207fe5['id'],_0x207fe5);DashboardEvents['emit'](_0x149eee,_0x207fe5);_0x2de21c(null);};}for(var e in events){if(events[_0x23b8('0x7')](e)){var event=events[e];Dashboard[_0x23b8('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x76a1=['events','Dashboard','setMaxListeners','save','update','emit','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x76a1,0xa1));var _0x176a=function(_0x46523f,_0x1f0fe5){_0x46523f=_0x46523f-0x0;var _0x13c5c8=_0x76a1[_0x46523f];return _0x13c5c8;};'use strict';var EventEmitter=require(_0x176a('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x176a('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x176a('0x2')](0x0);var events={'afterCreate':_0x176a('0x3'),'afterUpdate':_0x176a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2d0eab){return function(_0x272e35,_0xf65b07,_0x2bb894){DashboardEvents[_0x176a('0x5')](_0x2d0eab+':'+_0x272e35['id'],_0x272e35);DashboardEvents['emit'](_0x2d0eab,_0x272e35);_0x2bb894(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x176a('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 82cebd6..f21edf3 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 _0x5a44=['define','Dashboard','dashboards','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5a44,0x1bd));var _0x45a4=function(_0x45d538,_0x45ece3){_0x45d538=_0x45d538-0x0;var _0x37f23b=_0x5a44[_0x45d538];return _0x37f23b;};'use strict';var _=require('lodash');var util=require(_0x45a4('0x0'));var logger=require(_0x45a4('0x1'))(_0x45a4('0x2'));var moment=require(_0x45a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x45a4('0x4'));var fs=require('fs');var path=require(_0x45a4('0x5'));var rimraf=require(_0x45a4('0x6'));var config=require(_0x45a4('0x7'));var attributes=require(_0x45a4('0x8'));module[_0x45a4('0x9')]=function(_0x5d4e61,_0x52d573){return _0x5d4e61[_0x45a4('0xa')](_0x45a4('0xb'),attributes,{'tableName':_0x45a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea38=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util'];(function(_0x3bacf8,_0x315aaa){var _0x53d999=function(_0xd57078){while(--_0xd57078){_0x3bacf8['push'](_0x3bacf8['shift']());}};_0x53d999(++_0x315aaa);}(_0xea38,0x143));var _0x8ea3=function(_0x1a6363,_0x205f25){_0x1a6363=_0x1a6363-0x0;var _0xd22157=_0xea38[_0x1a6363];return _0xd22157;};'use strict';var _=require(_0x8ea3('0x0'));var util=require(_0x8ea3('0x1'));var logger=require(_0x8ea3('0x2'))('api');var moment=require(_0x8ea3('0x3'));var BPromise=require(_0x8ea3('0x4'));var rp=require(_0x8ea3('0x5'));var fs=require('fs');var path=require(_0x8ea3('0x6'));var rimraf=require(_0x8ea3('0x7'));var config=require(_0x8ea3('0x8'));var attributes=require(_0x8ea3('0x9'));module[_0x8ea3('0xa')]=function(_0x5d29de,_0x1d1103){return _0x5d29de[_0x8ea3('0xb')](_0x8ea3('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 939e81f..6051d77 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 _0xad1b=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0xad1b,0x164));var _0xbad1=function(_0x539422,_0x394efd){_0x539422=_0x539422-0x0;var _0x25129f=_0xad1b[_0x539422];return _0x25129f;};'use strict';var _=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var moment=require('moment');var BPromise=require(_0xbad1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbad1('0x3'));var db=require(_0xbad1('0x4'))['db'];var utils=require(_0xbad1('0x5'));var logger=require('../../config/logger')(_0xbad1('0x6'));var config=require(_0xbad1('0x7'));var jayson=require(_0xbad1('0x8'));var client=jayson[_0xbad1('0x9')][_0xbad1('0xa')]({'port':0x232a});config[_0xbad1('0xb')]=_[_0xbad1('0xc')](config[_0xbad1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbad1('0xd'))(new Redis(config['redis']));require(_0xbad1('0xe'))[_0xbad1('0xf')](socket);function respondWithRpcPromise(_0x310ffc,_0xb71e78,_0x34c5bc){return new BPromise(function(_0x15cafb,_0xf70661){return client[_0xbad1('0x10')](_0x310ffc,_0x34c5bc)[_0xbad1('0x11')](function(_0x18df7a){logger[_0xbad1('0x12')]('Dashboard,\x20%s,\x20%s',_0xb71e78,'request\x20sent');logger[_0xbad1('0x13')](_0xbad1('0x14'),_0xb71e78,_0xbad1('0x15'),JSON[_0xbad1('0x16')](_0x18df7a));if(_0x18df7a[_0xbad1('0x17')]){if(_0x18df7a[_0xbad1('0x17')]['code']===0x1f4){logger[_0xbad1('0x17')]('Dashboard,\x20%s,\x20%s',_0xb71e78,_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);return _0xf70661(_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);}logger[_0xbad1('0x17')](_0xbad1('0x19'),_0xb71e78,_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);return _0x15cafb(_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);}else{logger[_0xbad1('0x12')](_0xbad1('0x19'),_0xb71e78,_0xbad1('0x15'));_0x15cafb(_0x18df7a[_0xbad1('0x1a')]['message']);}})[_0xbad1('0x1b')](function(_0x5c242b){logger[_0xbad1('0x17')](_0xbad1('0x19'),_0xb71e78,_0x5c242b);_0xf70661(_0x5c242b);});});} \ No newline at end of file +var _0xd245=['./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd245,0x14d));var _0x5d24=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xd245[_0x4b5813];return _0x423465;};'use strict';var _=require('lodash');var util=require(_0x5d24('0x0'));var moment=require(_0x5d24('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d24('0x2'));var fs=require('fs');var Redis=require(_0x5d24('0x3'));var db=require(_0x5d24('0x4'))['db'];var utils=require(_0x5d24('0x5'));var logger=require(_0x5d24('0x6'))(_0x5d24('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d24('0x8'));var client=jayson[_0x5d24('0x9')][_0x5d24('0xa')]({'port':0x232a});config[_0x5d24('0xb')]=_[_0x5d24('0xc')](config[_0x5d24('0xb')],{'host':_0x5d24('0xd'),'port':0x18eb});var socket=require(_0x5d24('0xe'))(new Redis(config['redis']));require(_0x5d24('0xf'))['register'](socket);function respondWithRpcPromise(_0x613959,_0xdf32b7,_0x228bd5){return new BPromise(function(_0x5aaf3f,_0x33f17b){return client[_0x5d24('0x10')](_0x613959,_0x228bd5)[_0x5d24('0x11')](function(_0x3788ad){logger[_0x5d24('0x12')](_0x5d24('0x13'),_0xdf32b7,_0x5d24('0x14'));logger[_0x5d24('0x15')](_0x5d24('0x16'),_0xdf32b7,_0x5d24('0x14'),JSON[_0x5d24('0x17')](_0x3788ad));if(_0x3788ad['error']){if(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x19')]===0x1f4){logger[_0x5d24('0x18')](_0x5d24('0x13'),_0xdf32b7,_0x3788ad['error'][_0x5d24('0x1a')]);return _0x33f17b(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);}logger['error'](_0x5d24('0x13'),_0xdf32b7,_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);return _0x5aaf3f(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);}else{logger['info'](_0x5d24('0x13'),_0xdf32b7,_0x5d24('0x14'));_0x5aaf3f(_0x3788ad[_0x5d24('0x1b')]['message']);}})[_0x5d24('0x1c')](function(_0x1f2f2f){logger[_0x5d24('0x18')](_0x5d24('0x13'),_0xdf32b7,_0x1f2f2f);_0x33f17b(_0x1f2f2f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4e38d15..3440d28 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 _0x33d3=['dashboard:','./dashboard.events','save','remove','emit','removeListener','register'];(function(_0x5fcc94,_0x3a1b8b){var _0x117f38=function(_0x402f0c){while(--_0x402f0c){_0x5fcc94['push'](_0x5fcc94['shift']());}};_0x117f38(++_0x3a1b8b);}(_0x33d3,0x1e4));var _0x333d=function(_0x4a4c78,_0x13d5b7){_0x4a4c78=_0x4a4c78-0x0;var _0xd58f32=_0x33d3[_0x4a4c78];return _0xd58f32;};'use strict';var DashboardEvents=require(_0x333d('0x0'));var events=[_0x333d('0x1'),_0x333d('0x2'),'update'];function createListener(_0x47310c,_0x5914ff){return function(_0xf25239){_0x5914ff[_0x333d('0x3')](_0x47310c,_0xf25239);};}function removeListener(_0x5975b8,_0x491cad){return function(){DashboardEvents[_0x333d('0x4')](_0x5975b8,_0x491cad);};}exports[_0x333d('0x5')]=function(_0x4517c7){for(var _0x2f45dd=0x0,_0x3ffd4f=events['length'];_0x2f45dd<_0x3ffd4f;_0x2f45dd++){var _0x23d1a7=events[_0x2f45dd];var _0x4414f4=createListener(_0x333d('0x6')+_0x23d1a7,_0x4517c7);DashboardEvents['on'](_0x23d1a7,_0x4414f4);}}; \ No newline at end of file +var _0x6720=['dashboard:','./dashboard.events','emit','removeListener','register','length'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0x6720,0x163));var _0x0672=function(_0x2975ad,_0x3e930c){_0x2975ad=_0x2975ad-0x0;var _0x1cd96b=_0x6720[_0x2975ad];return _0x1cd96b;};'use strict';var DashboardEvents=require(_0x0672('0x0'));var events=['save','remove','update'];function createListener(_0x187578,_0x37dc6d){return function(_0x249c82){_0x37dc6d[_0x0672('0x1')](_0x187578,_0x249c82);};}function removeListener(_0x373ecf,_0x347da2){return function(){DashboardEvents[_0x0672('0x2')](_0x373ecf,_0x347da2);};}exports[_0x0672('0x3')]=function(_0x5850a7){for(var _0x582f04=0x0,_0x1c68a5=events[_0x0672('0x4')];_0x582f04<_0x1c68a5;_0x582f04++){var _0x357eeb=events[_0x582f04];var _0x2f5886=createListener(_0x0672('0x5')+_0x357eeb,_0x5850a7);DashboardEvents['on'](_0x357eeb,_0x2f5886);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 7351597..6fdcf34 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 _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x280bb5,_0x4a1aff){var _0x2b760c=function(_0x53b65a){while(--_0x53b65a){_0x280bb5['push'](_0x280bb5['shift']());}};_0x2b760c(++_0x4a1aff);}(_0xe706,0xa3));var _0x6e70=function(_0x3462ae,_0x225598){_0x3462ae=_0x3462ae-0x0;var _0x587dd6=_0xe706[_0x3462ae];return _0x587dd6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x19026b,_0xd536a0){var _0x42d065=function(_0xa0ac64){while(--_0xa0ac64){_0x19026b['push'](_0x19026b['shift']());}};_0x42d065(++_0xd536a0);}(_0x70e0,0x17b));var _0x070e=function(_0x22ef48,_0x5a7130){_0x22ef48=_0x22ef48-0x0;var _0x4488c5=_0x70e0[_0x22ef48];return _0x4488c5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index aee52a3..2f8fdfe 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 _0xa6be=['lodash','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','sequelize','squel'];(function(_0x4d8882,_0x59866c){var _0x22fd7c=function(_0x20c815){while(--_0x20c815){_0x4d8882['push'](_0x4d8882['shift']());}};_0x22fd7c(++_0x59866c);}(_0xa6be,0x8d));var _0xea6b=function(_0x587ada,_0x16c2c4){_0x587ada=_0x587ada-0x0;var _0x302624=_0xa6be[_0x587ada];return _0x302624;};'use strict';var Sequelize=require(_0xea6b('0x0'));var squel=require(_0xea6b('0x1'));var _=require(_0xea6b('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xea6b('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xea6b('0x4')](_0xea6b('0x5')),'get':function(){try{return JSON[_0xea6b('0x6')](this[_0xea6b('0x7')](_0xea6b('0x8')));}catch(_0x3de832){return[];}},'set':function(_0x14f76c){try{this['setDataValue'](_0xea6b('0x8'),JSON[_0xea6b('0x9')](_0x14f76c));}catch(_0x543d6f){this[_0xea6b('0xa')](_0xea6b('0x8'),JSON[_0xea6b('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xea6b('0xb')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xea6b('0x3')],'allowNull':![],'defaultValue':_0xea6b('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xea6b('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xea6b('0x3')]}}; \ No newline at end of file +var _0x4943=['TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize','lodash','exports','STRING'];(function(_0x26de1c,_0x27b24b){var _0x11a31a=function(_0x55b300){while(--_0x55b300){_0x26de1c['push'](_0x26de1c['shift']());}};_0x11a31a(++_0x27b24b);}(_0x4943,0x170));var _0x3494=function(_0x58fa9f,_0x5a4566){_0x58fa9f=_0x58fa9f-0x0;var _0x239fc5=_0x4943[_0x58fa9f];return _0x239fc5;};'use strict';var Sequelize=require(_0x3494('0x0'));var squel=require('squel');var _=require(_0x3494('0x1'));module[_0x3494('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3494('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3494('0x4')](_0x3494('0x5')),'get':function(){try{return JSON[_0x3494('0x6')](this['getDataValue'](_0x3494('0x7')));}catch(_0xf2e160){return[];}},'set':function(_0x1dc168){try{this[_0x3494('0x8')]('attrs',JSON['stringify'](_0x1dc168));}catch(_0x5c5b03){this['setDataValue'](_0x3494('0x7'),JSON[_0x3494('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3494('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3494('0xa')]},'col':{'type':Sequelize[_0x3494('0xa')]},'background':{'type':Sequelize[_0x3494('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3494('0x3')],'allowNull':![],'defaultValue':_0x3494('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3494('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ed073ab..78637ba 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 _0x5ff1=['set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','include','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','status','end','json','offset'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5ff1,0x1d2));var _0x15ff=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x5ff1[_0x480bc8];return _0x28c245;};'use strict';var pdf=require(_0x15ff('0x0'));var emlformat=require(_0x15ff('0x1'));var rimraf=require(_0x15ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15ff('0x3'));var rp=require(_0x15ff('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15ff('0x5'));var util=require('util');var path=require(_0x15ff('0x6'));var sox=require(_0x15ff('0x7'));var csv=require(_0x15ff('0x8'));var ejs=require(_0x15ff('0x9'));var fs=require('fs');var _=require(_0x15ff('0xa'));var squel=require('squel');var crypto=require(_0x15ff('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x15ff('0x8'));var querystring=require(_0x15ff('0xc'));var Papa=require(_0x15ff('0xd'));var Redis=require(_0x15ff('0xe'));var authService=require(_0x15ff('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x15ff('0x10'));var hardwareService=require(_0x15ff('0x11'));var logger=require(_0x15ff('0x12'))(_0x15ff('0x13'));var utils=require(_0x15ff('0x14'));var config=require(_0x15ff('0x15'));var db=require(_0x15ff('0x16'))['db'];config[_0x15ff('0x17')]=_[_0x15ff('0x18')](config[_0x15ff('0x17')],{'host':_0x15ff('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15ff('0x17')]));require(_0x15ff('0x1a'))[_0x15ff('0x1b')](socket);function respondWithStatusCode(_0x2939f5,_0xb4724e){_0xb4724e=_0xb4724e||0xcc;return function(_0x50fbdc){if(_0x50fbdc){return _0x2939f5['sendStatus'](_0xb4724e);}return _0x2939f5[_0x15ff('0x1c')](_0xb4724e)[_0x15ff('0x1d')]();};}function respondWithResult(_0x327801,_0x30b344){_0x30b344=_0x30b344||0xc8;return function(_0x40854b){if(_0x40854b){return _0x327801['status'](_0x30b344)[_0x15ff('0x1e')](_0x40854b);}};}function respondWithFilteredResult(_0x59231a,_0x28b2de){return function(_0x3bc915){if(_0x3bc915){var _0x136c82=_0x3bc915['count'],_0x39bc94=_0x28b2de[_0x15ff('0x1f')],_0x1ada0b=_0x28b2de['offset']+_0x28b2de['limit'],_0x10f7fb;if(_0x1ada0b>=_0x136c82){_0x1ada0b=_0x136c82;_0x10f7fb=0xc8;}else{_0x10f7fb=0xce;}_0x59231a[_0x15ff('0x1c')](_0x10f7fb);return _0x59231a[_0x15ff('0x20')](_0x15ff('0x21'),_0x39bc94+'-'+_0x1ada0b+'/'+_0x136c82)[_0x15ff('0x1e')](_0x3bc915);}return null;};}function patchUpdates(_0x416841){return function(_0x311a81){try{jsonpatch[_0x15ff('0x22')](_0x311a81,_0x416841,!![]);}catch(_0x3d4c65){return BPromise[_0x15ff('0x23')](_0x3d4c65);}return _0x311a81['save']();};}function saveUpdates(_0x3938dc,_0x3c9327){return function(_0x39c229){if(_0x39c229){return _0x39c229[_0x15ff('0x24')](_0x3938dc)[_0x15ff('0x25')](function(_0x2cc7e4){return _0x2cc7e4;});}return null;};}function removeEntity(_0x14a080,_0x1e6077){return function(_0x3f13de){if(_0x3f13de){return _0x3f13de['destroy']()['then'](function(){_0x14a080['status'](0xcc)[_0x15ff('0x1d')]();});}};}function handleEntityNotFound(_0x26017c,_0x401e8c){return function(_0x4c92da){if(!_0x4c92da){_0x26017c[_0x15ff('0x26')](0x194);}return _0x4c92da;};}function handleError(_0x481998,_0x8b9209){_0x8b9209=_0x8b9209||0x1f4;return function(_0x4cd11b){logger['error'](_0x4cd11b[_0x15ff('0x27')]);if(_0x4cd11b[_0x15ff('0x28')]){delete _0x4cd11b[_0x15ff('0x28')];}_0x481998['status'](_0x8b9209)[_0x15ff('0x29')](_0x4cd11b);};}exports['show']=function(_0x7c7be9,_0x218641){var _0x145e25={'raw':![],'where':{'id':_0x7c7be9['params']['id']}},_0x33deae={};_0x33deae[_0x15ff('0x2a')]=_[_0x15ff('0x2b')](db[_0x15ff('0x2c')][_0x15ff('0x2d')]);_0x33deae[_0x15ff('0x2e')]=_[_0x15ff('0x2b')](_0x7c7be9[_0x15ff('0x2e')]);_0x33deae['filters']=_[_0x15ff('0x2f')](_0x33deae[_0x15ff('0x2a')],_0x33deae[_0x15ff('0x2e')]);_0x145e25[_0x15ff('0x30')]=_[_0x15ff('0x2f')](_0x33deae[_0x15ff('0x2a')],qs['fields'](_0x7c7be9[_0x15ff('0x2e')][_0x15ff('0x31')]));_0x145e25[_0x15ff('0x30')]=_0x145e25[_0x15ff('0x30')][_0x15ff('0x32')]?_0x145e25[_0x15ff('0x30')]:_0x33deae[_0x15ff('0x2a')];if(_0x7c7be9[_0x15ff('0x2e')]['includeAll']){_0x145e25[_0x15ff('0x33')]=[{'all':!![]}];}_0x145e25=_['merge']({},_0x145e25,_0x7c7be9['options']);return db[_0x15ff('0x2c')][_0x15ff('0x34')](_0x145e25)[_0x15ff('0x25')](handleEntityNotFound(_0x218641,null))[_0x15ff('0x25')](respondWithResult(_0x218641,null))[_0x15ff('0x35')](handleError(_0x218641,null));};exports[_0x15ff('0x36')]=function(_0x2f8ba8,_0x42f7e7){return db['DashboardItem'][_0x15ff('0x34')]({'where':{'id':_0x2f8ba8['params']['id']}})[_0x15ff('0x25')](handleEntityNotFound(_0x42f7e7,null))[_0x15ff('0x25')](removeEntity(_0x42f7e7,null))[_0x15ff('0x35')](handleError(_0x42f7e7,null));};function widgetAttributes(_0x2b7901){try{switch(_0x2b7901[_0x15ff('0x37')]){case _0x15ff('0x38'):return[{'name':'attrUrl','value':_0x2b7901[_0x15ff('0x39')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0][_0x15ff('0x3b')]:undefined)||_0x15ff('0x3c')}];case _0x15ff('0x3d'):return[{'name':'attrPath','value':_0x2b7901['attrPath']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0][_0x15ff('0x3b')]:undefined)||''}];case _0x15ff('0x3e'):return[{'name':_0x15ff('0x3f'),'value':_0x2b7901['attrHourFormat']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901['attrs'][0x0]?_0x2b7901['attrs'][0x0][_0x15ff('0x3b')]:undefined)||_0x15ff('0x40')},{'name':_0x15ff('0x41'),'value':_0x2b7901[_0x15ff('0x41')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x1]?_0x2b7901['attrs'][0x1][_0x15ff('0x3b')]:undefined)||'0.00'},{'name':_0x15ff('0x42'),'value':_0x2b7901['attrFontSize']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x2]?_0x2b7901[_0x15ff('0x3a')][0x2][_0x15ff('0x3b')]:undefined)||0xc}];case'counter':return[{'name':_0x15ff('0x43'),'value':_0x2b7901[_0x15ff('0x43')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0]['value']:undefined)||_0x15ff('0x44')},{'name':_0x15ff('0x45'),'value':_0x2b7901['attrVoiceQueues']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x1]?_0x2b7901[_0x15ff('0x3a')][0x1]['value']:undefined)||[]},{'name':_0x15ff('0x42'),'value':_0x2b7901[_0x15ff('0x42')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x2]?_0x2b7901['attrs'][0x2][_0x15ff('0x3b')]:undefined)||0x14}];case _0x15ff('0x46'):case _0x15ff('0x47'):return[{'name':'attrSerie1','value':_0x2b7901['attrSerie1']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0][_0x15ff('0x3b')]:undefined)||_0x15ff('0x44')},{'name':_0x15ff('0x48'),'value':_0x2b7901[_0x15ff('0x48')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x1]?_0x2b7901['attrs'][0x1][_0x15ff('0x3b')]:undefined)||null},{'name':'attrSerie3','value':_0x2b7901[_0x15ff('0x49')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x2]?_0x2b7901['attrs'][0x2]['value']:undefined)||null},{'name':_0x15ff('0x45'),'value':_0x2b7901[_0x15ff('0x45')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x3]?_0x2b7901[_0x15ff('0x3a')][0x3][_0x15ff('0x3b')]:undefined)||[]}];case'web-report':return[{'name':_0x15ff('0x4a'),'type':_0x2b7901[_0x15ff('0x4b')]||(_0x2b7901['attrs']&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901['attrs'][0x0][_0x15ff('0x37')]:undefined)||null,'value':_0x2b7901[_0x15ff('0x4a')]||(_0x2b7901['attrs']&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0][_0x15ff('0x3b')]:undefined)||null},{'name':'attrRefresh','value':_0x2b7901[_0x15ff('0x4c')]||(_0x2b7901['attrs']&&_0x2b7901[_0x15ff('0x3a')][0x1]?_0x2b7901['attrs'][0x1][_0x15ff('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x4802c9){logger[_0x15ff('0x4d')](_0x15ff('0x4e'),JSON[_0x15ff('0x4f')](_0x4802c9));return[];}}exports[_0x15ff('0x50')]=function(_0x42a661,_0x26e6b7){if(_0x42a661[_0x15ff('0x51')]){_0x42a661[_0x15ff('0x51')][_0x15ff('0x3a')]=widgetAttributes(_0x42a661[_0x15ff('0x51')]);}return db[_0x15ff('0x2c')][_0x15ff('0x50')](_0x42a661[_0x15ff('0x51')],{})[_0x15ff('0x25')](respondWithResult(_0x26e6b7,0xc9))['catch'](handleError(_0x26e6b7,null));};exports[_0x15ff('0x24')]=function(_0xdc919c,_0x3f2242){if(_0xdc919c[_0x15ff('0x51')]['id']){delete _0xdc919c['body']['id'];}_0xdc919c[_0x15ff('0x51')][_0x15ff('0x3a')]=widgetAttributes(_0xdc919c[_0x15ff('0x51')]);return db[_0x15ff('0x2c')][_0x15ff('0x34')]({'where':{'id':_0xdc919c[_0x15ff('0x52')]['id']}})[_0x15ff('0x25')](handleEntityNotFound(_0x3f2242,null))['then'](saveUpdates(_0xdc919c[_0x15ff('0x51')],null))[_0x15ff('0x25')](respondWithResult(_0x3f2242,null))[_0x15ff('0x35')](handleError(_0x3f2242,null));}; \ No newline at end of file +var _0xcba8=['fields','attributes','include','merge','options','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','offset','set','Content-Range','apply','destroy','then','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xcba8,0xdb));var _0x8cba=function(_0x1a6265,_0x290045){_0x1a6265=_0x1a6265-0x0;var _0x12b732=_0xcba8[_0x1a6265];return _0x12b732;};'use strict';var pdf=require(_0x8cba('0x0'));var emlformat=require(_0x8cba('0x1'));var rimraf=require(_0x8cba('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cba('0x3'));var rp=require(_0x8cba('0x4'));var moment=require(_0x8cba('0x5'));var BPromise=require(_0x8cba('0x6'));var Mustache=require(_0x8cba('0x7'));var util=require('util');var path=require(_0x8cba('0x8'));var sox=require(_0x8cba('0x9'));var csv=require('to-csv');var ejs=require(_0x8cba('0xa'));var fs=require('fs');var _=require(_0x8cba('0xb'));var squel=require(_0x8cba('0xc'));var crypto=require('crypto');var jsforce=require(_0x8cba('0xd'));var deskjs=require(_0x8cba('0xe'));var toCsv=require(_0x8cba('0xf'));var querystring=require(_0x8cba('0x10'));var Papa=require(_0x8cba('0x11'));var Redis=require(_0x8cba('0x12'));var authService=require(_0x8cba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8cba('0x14'));var hardwareService=require(_0x8cba('0x15'));var logger=require(_0x8cba('0x16'))(_0x8cba('0x17'));var utils=require(_0x8cba('0x18'));var config=require(_0x8cba('0x19'));var db=require(_0x8cba('0x1a'))['db'];config[_0x8cba('0x1b')]=_[_0x8cba('0x1c')](config[_0x8cba('0x1b')],{'host':_0x8cba('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cba('0x1b')]));require(_0x8cba('0x1e'))['register'](socket);function respondWithStatusCode(_0x251b62,_0x40baa7){_0x40baa7=_0x40baa7||0xcc;return function(_0x21f717){if(_0x21f717){return _0x251b62[_0x8cba('0x1f')](_0x40baa7);}return _0x251b62[_0x8cba('0x20')](_0x40baa7)[_0x8cba('0x21')]();};}function respondWithResult(_0x1bc429,_0x1dc0ed){_0x1dc0ed=_0x1dc0ed||0xc8;return function(_0x34ea26){if(_0x34ea26){return _0x1bc429['status'](_0x1dc0ed)[_0x8cba('0x22')](_0x34ea26);}};}function respondWithFilteredResult(_0x932154,_0x3cc150){return function(_0xf9d908){if(_0xf9d908){var _0x5706f0=_0xf9d908['count'],_0x4b0542=_0x3cc150[_0x8cba('0x23')],_0x4ab58c=_0x3cc150[_0x8cba('0x23')]+_0x3cc150['limit'],_0xc8c5c3;if(_0x4ab58c>=_0x5706f0){_0x4ab58c=_0x5706f0;_0xc8c5c3=0xc8;}else{_0xc8c5c3=0xce;}_0x932154[_0x8cba('0x20')](_0xc8c5c3);return _0x932154[_0x8cba('0x24')](_0x8cba('0x25'),_0x4b0542+'-'+_0x4ab58c+'/'+_0x5706f0)['json'](_0xf9d908);}return null;};}function patchUpdates(_0x32ead0){return function(_0x249539){try{jsonpatch[_0x8cba('0x26')](_0x249539,_0x32ead0,!![]);}catch(_0x5d97b3){return BPromise['reject'](_0x5d97b3);}return _0x249539['save']();};}function saveUpdates(_0x34f651,_0x13fb63){return function(_0xc8bbdb){if(_0xc8bbdb){return _0xc8bbdb['update'](_0x34f651)['then'](function(_0x1f7886){return _0x1f7886;});}return null;};}function removeEntity(_0x19bd1f,_0x496b95){return function(_0x567f22){if(_0x567f22){return _0x567f22[_0x8cba('0x27')]()[_0x8cba('0x28')](function(){_0x19bd1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ca8b,_0x191670){return function(_0x205f03){if(!_0x205f03){_0x25ca8b[_0x8cba('0x1f')](0x194);}return _0x205f03;};}function handleError(_0x2410dc,_0x284aa3){_0x284aa3=_0x284aa3||0x1f4;return function(_0x70e5c3){logger[_0x8cba('0x29')](_0x70e5c3[_0x8cba('0x2a')]);if(_0x70e5c3[_0x8cba('0x2b')]){delete _0x70e5c3[_0x8cba('0x2b')];}_0x2410dc[_0x8cba('0x20')](_0x284aa3)[_0x8cba('0x2c')](_0x70e5c3);};}exports[_0x8cba('0x2d')]=function(_0x23f8ee,_0x4270a4){var _0x65d310={'raw':![],'where':{'id':_0x23f8ee[_0x8cba('0x2e')]['id']}},_0x5d8d7a={};_0x5d8d7a[_0x8cba('0x2f')]=_['keys'](db[_0x8cba('0x30')][_0x8cba('0x31')]);_0x5d8d7a[_0x8cba('0x32')]=_[_0x8cba('0x33')](_0x23f8ee[_0x8cba('0x32')]);_0x5d8d7a[_0x8cba('0x34')]=_[_0x8cba('0x35')](_0x5d8d7a['model'],_0x5d8d7a['query']);_0x65d310['attributes']=_['intersection'](_0x5d8d7a['model'],qs[_0x8cba('0x36')](_0x23f8ee[_0x8cba('0x32')][_0x8cba('0x36')]));_0x65d310[_0x8cba('0x37')]=_0x65d310[_0x8cba('0x37')]['length']?_0x65d310[_0x8cba('0x37')]:_0x5d8d7a[_0x8cba('0x2f')];if(_0x23f8ee[_0x8cba('0x32')]['includeAll']){_0x65d310[_0x8cba('0x38')]=[{'all':!![]}];}_0x65d310=_[_0x8cba('0x39')]({},_0x65d310,_0x23f8ee[_0x8cba('0x3a')]);return db[_0x8cba('0x30')]['find'](_0x65d310)[_0x8cba('0x28')](handleEntityNotFound(_0x4270a4,null))['then'](respondWithResult(_0x4270a4,null))[_0x8cba('0x3b')](handleError(_0x4270a4,null));};exports[_0x8cba('0x27')]=function(_0x33f2e8,_0xff521d){return db[_0x8cba('0x30')][_0x8cba('0x3c')]({'where':{'id':_0x33f2e8[_0x8cba('0x2e')]['id']}})[_0x8cba('0x28')](handleEntityNotFound(_0xff521d,null))['then'](removeEntity(_0xff521d,null))['catch'](handleError(_0xff521d,null));};function widgetAttributes(_0x15aa16){try{switch(_0x15aa16[_0x8cba('0x3d')]){case _0x8cba('0x3e'):return[{'name':_0x8cba('0x3f'),'value':_0x15aa16[_0x8cba('0x3f')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x41')]:undefined)||_0x8cba('0x42')}];case _0x8cba('0x43'):return[{'name':_0x8cba('0x44'),'value':_0x15aa16[_0x8cba('0x44')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16['attrs'][0x0][_0x8cba('0x41')]:undefined)||''}];case _0x8cba('0x45'):return[{'name':_0x8cba('0x46'),'value':_0x15aa16['attrHourFormat']||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x41')]:undefined)||_0x8cba('0x47')},{'name':_0x8cba('0x48'),'value':_0x15aa16[_0x8cba('0x48')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x1]?_0x15aa16[_0x8cba('0x40')][0x1][_0x8cba('0x41')]:undefined)||_0x8cba('0x49')},{'name':'attrFontSize','value':_0x15aa16[_0x8cba('0x4a')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x2]?_0x15aa16['attrs'][0x2][_0x8cba('0x41')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x15aa16[_0x8cba('0x4b')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16['attrs'][0x0][_0x8cba('0x41')]:undefined)||_0x8cba('0x4c')},{'name':_0x8cba('0x4d'),'value':_0x15aa16[_0x8cba('0x4d')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x1]?_0x15aa16[_0x8cba('0x40')][0x1]['value']:undefined)||[]},{'name':_0x8cba('0x4a'),'value':_0x15aa16['attrFontSize']||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16['attrs'][0x2]?_0x15aa16[_0x8cba('0x40')][0x2][_0x8cba('0x41')]:undefined)||0x14}];case _0x8cba('0x4e'):case _0x8cba('0x4f'):return[{'name':'attrSerie1','value':_0x15aa16[_0x8cba('0x50')]||(_0x15aa16['attrs']&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x41')]:undefined)||_0x8cba('0x4c')},{'name':_0x8cba('0x51'),'value':_0x15aa16[_0x8cba('0x51')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x1]?_0x15aa16[_0x8cba('0x40')][0x1]['value']:undefined)||null},{'name':_0x8cba('0x52'),'value':_0x15aa16['attrSerie3']||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x2]?_0x15aa16[_0x8cba('0x40')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x15aa16[_0x8cba('0x4d')]||(_0x15aa16['attrs']&&_0x15aa16['attrs'][0x3]?_0x15aa16[_0x8cba('0x40')][0x3][_0x8cba('0x41')]:undefined)||[]}];case _0x8cba('0x53'):return[{'name':_0x8cba('0x54'),'type':_0x15aa16['reportType']||(_0x15aa16['attrs']&&_0x15aa16['attrs'][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x3d')]:undefined)||null,'value':_0x15aa16[_0x8cba('0x54')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16['attrs'][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x41')]:undefined)||null},{'name':_0x8cba('0x55'),'value':_0x15aa16['attrRefresh']||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x1]?_0x15aa16[_0x8cba('0x40')][0x1][_0x8cba('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x56f2da){logger[_0x8cba('0x29')](_0x8cba('0x56'),JSON[_0x8cba('0x57')](_0x56f2da));return[];}}exports[_0x8cba('0x58')]=function(_0x4b1ab1,_0x44a109){if(_0x4b1ab1[_0x8cba('0x59')]){_0x4b1ab1['body'][_0x8cba('0x40')]=widgetAttributes(_0x4b1ab1[_0x8cba('0x59')]);}return db[_0x8cba('0x30')][_0x8cba('0x58')](_0x4b1ab1[_0x8cba('0x59')],{})[_0x8cba('0x28')](respondWithResult(_0x44a109,0xc9))[_0x8cba('0x3b')](handleError(_0x44a109,null));};exports[_0x8cba('0x5a')]=function(_0x571fe0,_0x4e5665){if(_0x571fe0['body']['id']){delete _0x571fe0[_0x8cba('0x59')]['id'];}_0x571fe0[_0x8cba('0x59')][_0x8cba('0x40')]=widgetAttributes(_0x571fe0[_0x8cba('0x59')]);return db[_0x8cba('0x30')][_0x8cba('0x3c')]({'where':{'id':_0x571fe0['params']['id']}})['then'](handleEntityNotFound(_0x4e5665,null))['then'](saveUpdates(_0x571fe0['body'],null))[_0x8cba('0x28')](respondWithResult(_0x4e5665,null))[_0x8cba('0x3b')](handleError(_0x4e5665,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 824f5c5..0e66daa 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 _0xb479=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0xb479,0x1ee));var _0x9b47=function(_0x259815,_0x32fc32){_0x259815=_0x259815-0x0;var _0xf6a65b=_0xb479[_0x259815];return _0xf6a65b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x9b47('0x0'))['db'][_0x9b47('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9b47('0x2')](0x0);var events={'afterCreate':_0x9b47('0x3'),'afterUpdate':_0x9b47('0x4'),'afterDestroy':_0x9b47('0x5')};function emitEvent(_0x1bb180){return function(_0x600234,_0x21a8e6,_0x2365b7){DashboardItemEvents[_0x9b47('0x6')](_0x1bb180+':'+_0x600234['id'],_0x600234);DashboardItemEvents['emit'](_0x1bb180,_0x600234);_0x2365b7(null);};}for(var e in events){if(events[_0x9b47('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x9b47('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x4f96=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x13f2ec,_0x407206){var _0x389ca9=function(_0x43d7d6){while(--_0x43d7d6){_0x13f2ec['push'](_0x13f2ec['shift']());}};_0x389ca9(++_0x407206);}(_0x4f96,0xb9));var _0x64f9=function(_0x1847fd,_0x48bb28){_0x1847fd=_0x1847fd-0x0;var _0x426713=_0x4f96[_0x1847fd];return _0x426713;};'use strict';var EventEmitter=require(_0x64f9('0x0'));var DashboardItem=require(_0x64f9('0x1'))['db'][_0x64f9('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x64f9('0x3')](0x0);var events={'afterCreate':_0x64f9('0x4'),'afterUpdate':_0x64f9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x27075e){return function(_0x4c95fa,_0x5c4300,_0x1b44fd){DashboardItemEvents['emit'](_0x27075e+':'+_0x4c95fa['id'],_0x4c95fa);DashboardItemEvents[_0x64f9('0x6')](_0x27075e,_0x4c95fa);_0x1b44fd(null);};}for(var e in events){if(events[_0x64f9('0x7')](e)){var event=events[e];DashboardItem[_0x64f9('0x8')](e,emitEvent(event));}}module[_0x64f9('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 05694dc..0d3eccf 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 _0xdf2c=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items'];(function(_0x451f8a,_0x30a7e9){var _0x279417=function(_0x1f240d){while(--_0x1f240d){_0x451f8a['push'](_0x451f8a['shift']());}};_0x279417(++_0x30a7e9);}(_0xdf2c,0x174));var _0xcdf2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdf2c[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xcdf2('0x0'));var util=require(_0xcdf2('0x1'));var logger=require('../../config/logger')(_0xcdf2('0x2'));var moment=require(_0xcdf2('0x3'));var BPromise=require(_0xcdf2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdf2('0x5'));var rimraf=require(_0xcdf2('0x6'));var config=require(_0xcdf2('0x7'));var attributes=require(_0xcdf2('0x8'));module['exports']=function(_0x25dc0b,_0xbaf75c){return _0x25dc0b[_0xcdf2('0x9')](_0xcdf2('0xa'),attributes,{'tableName':_0xcdf2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1858=['api','moment','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x25933a,_0x16f7d5){var _0x1cd93e=function(_0x23fa8c){while(--_0x23fa8c){_0x25933a['push'](_0x25933a['shift']());}};_0x1cd93e(++_0x16f7d5);}(_0x1858,0xbd));var _0x8185=function(_0x102a67,_0x405808){_0x102a67=_0x102a67-0x0;var _0x10ed48=_0x1858[_0x102a67];return _0x10ed48;};'use strict';var _=require(_0x8185('0x0'));var util=require(_0x8185('0x1'));var logger=require(_0x8185('0x2'))(_0x8185('0x3'));var moment=require(_0x8185('0x4'));var BPromise=require('bluebird');var rp=require(_0x8185('0x5'));var fs=require('fs');var path=require(_0x8185('0x6'));var rimraf=require('rimraf');var config=require(_0x8185('0x7'));var attributes=require(_0x8185('0x8'));module[_0x8185('0x9')]=function(_0x43908e,_0xbf3188){return _0x43908e['define'](_0x8185('0xa'),attributes,{'tableName':_0x8185('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 8f5f6cb..4a29833 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 _0xeee2=['client','redis','defaults','localhost','socket.io-emitter','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x331297,_0x1b26aa){var _0x39dcc5=function(_0x19fdfe){while(--_0x19fdfe){_0x331297['push'](_0x331297['shift']());}};_0x39dcc5(++_0x1b26aa);}(_0xeee2,0x86));var _0x2eee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeee2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2eee('0x0'));var util=require(_0x2eee('0x1'));var moment=require(_0x2eee('0x2'));var BPromise=require(_0x2eee('0x3'));var rs=require(_0x2eee('0x4'));var fs=require('fs');var Redis=require(_0x2eee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2eee('0x6'));var logger=require(_0x2eee('0x7'))('rpc');var config=require(_0x2eee('0x8'));var jayson=require(_0x2eee('0x9'));var client=jayson[_0x2eee('0xa')]['http']({'port':0x232a});config[_0x2eee('0xb')]=_[_0x2eee('0xc')](config[_0x2eee('0xb')],{'host':_0x2eee('0xd'),'port':0x18eb});var socket=require(_0x2eee('0xe'))(new Redis(config[_0x2eee('0xb')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x193838,_0x263718,_0x35f469){return new BPromise(function(_0x48d900,_0x5074b9){return client[_0x2eee('0xf')](_0x193838,_0x35f469)['then'](function(_0x1c85dd){logger[_0x2eee('0x10')](_0x2eee('0x11'),_0x263718,_0x2eee('0x12'));logger[_0x2eee('0x13')](_0x2eee('0x14'),_0x263718,_0x2eee('0x12'),JSON['stringify'](_0x1c85dd));if(_0x1c85dd[_0x2eee('0x15')]){if(_0x1c85dd[_0x2eee('0x15')][_0x2eee('0x16')]===0x1f4){logger['error'](_0x2eee('0x11'),_0x263718,_0x1c85dd[_0x2eee('0x15')]['message']);return _0x5074b9(_0x1c85dd['error']['message']);}logger[_0x2eee('0x15')](_0x2eee('0x11'),_0x263718,_0x1c85dd[_0x2eee('0x15')][_0x2eee('0x17')]);return _0x48d900(_0x1c85dd[_0x2eee('0x15')][_0x2eee('0x17')]);}else{logger[_0x2eee('0x10')](_0x2eee('0x11'),_0x263718,_0x2eee('0x12'));_0x48d900(_0x1c85dd['result'][_0x2eee('0x17')]);}})['catch'](function(_0x40e42e){logger[_0x2eee('0x15')](_0x2eee('0x11'),_0x263718,_0x40e42e);_0x5074b9(_0x40e42e);});});} \ No newline at end of file +var _0x05c4=['rpc','redis','defaults','socket.io-emitter','then','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x54a7fc,_0x249f09){var _0x98a4f7=function(_0x1e8e1d){while(--_0x1e8e1d){_0x54a7fc['push'](_0x54a7fc['shift']());}};_0x98a4f7(++_0x249f09);}(_0x05c4,0x189));var _0x405c=function(_0x229c8c,_0x546d4a){_0x229c8c=_0x229c8c-0x0;var _0x5a1898=_0x05c4[_0x229c8c];return _0x5a1898;};'use strict';var _=require('lodash');var util=require(_0x405c('0x0'));var moment=require(_0x405c('0x1'));var BPromise=require(_0x405c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x405c('0x3'));var db=require(_0x405c('0x4'))['db'];var utils=require(_0x405c('0x5'));var logger=require(_0x405c('0x6'))(_0x405c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x405c('0x8')]=_[_0x405c('0x9')](config[_0x405c('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x405c('0xa'))(new Redis(config[_0x405c('0x8')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x57cd4e,_0x56e133,_0x380dc7){return new BPromise(function(_0x5e7cf9,_0x21b84e){return client['request'](_0x57cd4e,_0x380dc7)[_0x405c('0xb')](function(_0xc63fff){logger['info'](_0x405c('0xc'),_0x56e133,'request\x20sent');logger['debug'](_0x405c('0xd'),_0x56e133,_0x405c('0xe'),JSON['stringify'](_0xc63fff));if(_0xc63fff[_0x405c('0xf')]){if(_0xc63fff['error'][_0x405c('0x10')]===0x1f4){logger[_0x405c('0xf')]('DashboardItem,\x20%s,\x20%s',_0x56e133,_0xc63fff[_0x405c('0xf')]['message']);return _0x21b84e(_0xc63fff[_0x405c('0xf')][_0x405c('0x11')]);}logger[_0x405c('0xf')](_0x405c('0xc'),_0x56e133,_0xc63fff[_0x405c('0xf')][_0x405c('0x11')]);return _0x5e7cf9(_0xc63fff['error'][_0x405c('0x11')]);}else{logger['info'](_0x405c('0xc'),_0x56e133,_0x405c('0xe'));_0x5e7cf9(_0xc63fff[_0x405c('0x12')]['message']);}})[_0x405c('0x13')](function(_0x589282){logger['error'](_0x405c('0xc'),_0x56e133,_0x589282);_0x21b84e(_0x589282);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3446896..01c3acf 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 _0xd12f=['removeListener','register','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0xd81983,_0x4e5e04){var _0x157067=function(_0x5f170e){while(--_0x5f170e){_0xd81983['push'](_0xd81983['shift']());}};_0x157067(++_0x4e5e04);}(_0xd12f,0x8b));var _0xfd12=function(_0x552971,_0x3e6f5d){_0x552971=_0x552971-0x0;var _0x2aae9f=_0xd12f[_0x552971];return _0x2aae9f;};'use strict';var DashboardItemEvents=require(_0xfd12('0x0'));var events=[_0xfd12('0x1'),_0xfd12('0x2'),_0xfd12('0x3')];function createListener(_0x3e9e09,_0x2b93bc){return function(_0x81d8ef){_0x2b93bc[_0xfd12('0x4')](_0x3e9e09,_0x81d8ef);};}function removeListener(_0x6f18ee,_0x38a6b3){return function(){DashboardItemEvents[_0xfd12('0x5')](_0x6f18ee,_0x38a6b3);};}exports[_0xfd12('0x6')]=function(_0x522129){for(var _0x137ab1=0x0,_0x75424b=events['length'];_0x137ab1<_0x75424b;_0x137ab1++){var _0x25bc09=events[_0x137ab1];var _0xd9ec55=createListener(_0xfd12('0x7')+_0x25bc09,_0x522129);DashboardItemEvents['on'](_0x25bc09,_0xd9ec55);}}; \ No newline at end of file +var _0xb2ce=['removeListener','length','dashboardItem:','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb2ce,0x1b6));var _0xeb2c=function(_0xfb790d,_0x1793fe){_0xfb790d=_0xfb790d-0x0;var _0x23a1b9=_0xb2ce[_0xfb790d];return _0x23a1b9;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xeb2c('0x0'),_0xeb2c('0x1'),'update'];function createListener(_0x17bc64,_0x270e3f){return function(_0x30c148){_0x270e3f['emit'](_0x17bc64,_0x30c148);};}function removeListener(_0x672cf8,_0x1b0ed5){return function(){DashboardItemEvents[_0xeb2c('0x2')](_0x672cf8,_0x1b0ed5);};}exports['register']=function(_0x40bd15){for(var _0x4baa40=0x0,_0x89a4c7=events[_0xeb2c('0x3')];_0x4baa40<_0x89a4c7;_0x4baa40++){var _0x490dbf=events[_0x4baa40];var _0x5e9561=createListener(_0xeb2c('0x4')+_0x490dbf,_0x40bd15);DashboardItemEvents['on'](_0x490dbf,_0x5e9561);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 36073b4..a4668ff 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 _0x53ec=['../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5b96cf,_0x287514){var _0x1b878e=function(_0x3bb40c){while(--_0x3bb40c){_0x5b96cf['push'](_0x5b96cf['shift']());}};_0x1b878e(++_0x287514);}(_0x53ec,0x192));var _0xc53e=function(_0x4745d9,_0x411b00){_0x4745d9=_0x4745d9-0x0;var _0x38f2ac=_0x53ec[_0x4745d9];return _0x38f2ac;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/:id',auth[_0xc53e('0x9')](),controller['show']);router[_0xc53e('0xa')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0xb')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xf')]);module[_0xc53e('0x10')]=router; \ No newline at end of file +var _0xe2fe=['put','update','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post'];(function(_0x243e2,_0x6cec7b){var _0x2d377c=function(_0x241881){while(--_0x241881){_0x243e2['push'](_0x243e2['shift']());}};_0x2d377c(++_0x6cec7b);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get'](_0xee2f('0x7'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x9')]('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0xa')]('/:id',auth[_0xee2f('0x8')](),controller[_0xee2f('0xb')]);router['delete'](_0xee2f('0x7'),auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 18410db..8eaccc8 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 _0x55f1=['sequelize','exports','STRING'];(function(_0x1cdaa5,_0xf3b67){var _0x58675c=function(_0x36f762){while(--_0x36f762){_0x1cdaa5['push'](_0x1cdaa5['shift']());}};_0x58675c(++_0xf3b67);}(_0x55f1,0x1d7));var _0x155f=function(_0x188998,_0x2a082e){_0x188998=_0x188998-0x0;var _0x17801b=_0x55f1[_0x188998];return _0x17801b;};'use strict';var Sequelize=require(_0x155f('0x0'));module[_0x155f('0x1')]={'name':{'type':Sequelize[_0x155f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xae5e=['STRING','exports'];(function(_0x3b7c44,_0x41a0e4){var _0x65690c=function(_0xb72319){while(--_0xb72319){_0x3b7c44['push'](_0x3b7c44['shift']());}};_0x65690c(++_0x41a0e4);}(_0xae5e,0x103));var _0xeae5=function(_0x3484d8,_0x2e0def){_0x3484d8=_0x3484d8-0x0;var _0x1ebb5f=_0xae5e[_0x3484d8];return _0x1ebb5f;};'use strict';var Sequelize=require('sequelize');module[_0xeae5('0x0')]={'name':{'type':Sequelize[_0xeae5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index b82a638..ab31a58 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 _0x04e3=['name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Disposition','includeAll','include','findAll','catch','create','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','get','Dispositions','end','error','stack'];(function(_0xff1723,_0x3935bd){var _0x390d6c=function(_0x37d2ce){while(--_0x37d2ce){_0xff1723['push'](_0xff1723['shift']());}};_0x390d6c(++_0x3935bd);}(_0x04e3,0x115));var _0x304e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x04e3[_0x55f8b4];return _0x2475f9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x304e('0x0'));var zipdir=require(_0x304e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x304e('0x2'));var moment=require(_0x304e('0x3'));var BPromise=require(_0x304e('0x4'));var Mustache=require(_0x304e('0x5'));var util=require(_0x304e('0x6'));var path=require(_0x304e('0x7'));var sox=require(_0x304e('0x8'));var csv=require(_0x304e('0x9'));var ejs=require(_0x304e('0xa'));var fs=require('fs');var _=require(_0x304e('0xb'));var squel=require(_0x304e('0xc'));var crypto=require(_0x304e('0xd'));var jsforce=require(_0x304e('0xe'));var deskjs=require(_0x304e('0xf'));var toCsv=require(_0x304e('0x9'));var querystring=require(_0x304e('0x10'));var Papa=require(_0x304e('0x11'));var Redis=require('ioredis');var authService=require(_0x304e('0x12'));var qs=require(_0x304e('0x13'));var as=require(_0x304e('0x14'));var hardwareService=require(_0x304e('0x15'));var logger=require(_0x304e('0x16'))(_0x304e('0x17'));var utils=require(_0x304e('0x18'));var config=require(_0x304e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb9c461,_0x21b9c2){_0x21b9c2=_0x21b9c2||0xcc;return function(_0x5a41dc){if(_0x5a41dc){return _0xb9c461[_0x304e('0x1a')](_0x21b9c2);}return _0xb9c461[_0x304e('0x1b')](_0x21b9c2)['end']();};}function respondWithResult(_0x581bf3,_0x4fd970){_0x4fd970=_0x4fd970||0xc8;return function(_0x2e930c){if(_0x2e930c){return _0x581bf3[_0x304e('0x1b')](_0x4fd970)['json'](_0x2e930c);}};}function respondWithFilteredResult(_0x5b079a,_0xc2e936){return function(_0x332696){if(_0x332696){var _0x45cd3c=_0x332696[_0x304e('0x1c')],_0x1f5b8c=_0xc2e936[_0x304e('0x1d')],_0x1c7cec=_0xc2e936[_0x304e('0x1d')]+_0xc2e936[_0x304e('0x1e')],_0x35b339;if(_0x1c7cec>=_0x45cd3c){_0x1c7cec=_0x45cd3c;_0x35b339=0xc8;}else{_0x35b339=0xce;}_0x5b079a[_0x304e('0x1b')](_0x35b339);return _0x5b079a[_0x304e('0x1f')](_0x304e('0x20'),_0x1f5b8c+'-'+_0x1c7cec+'/'+_0x45cd3c)[_0x304e('0x21')](_0x332696);}return null;};}function patchUpdates(_0x518784){return function(_0x369ac9){try{jsonpatch['apply'](_0x369ac9,_0x518784,!![]);}catch(_0xe69e4e){return BPromise[_0x304e('0x22')](_0xe69e4e);}return _0x369ac9['save']();};}function saveUpdates(_0x5da3fc,_0x50d5a1){return function(_0x4c039b){if(_0x4c039b){return _0x4c039b[_0x304e('0x23')](_0x5da3fc)[_0x304e('0x24')](function(_0x480457){return _0x480457;});}return null;};}function removeEntity(_0x100505,_0xa84ba9){return function(_0x25faf1){if(_0x25faf1){return _0x25faf1[_0x304e('0x25')]()[_0x304e('0x24')](function(){var _0x5e7ec9=_0x25faf1[_0x304e('0x26')]({'plain':!![]});var _0x4b4c9e=_0x304e('0x27');return db['UserProfileResource'][_0x304e('0x25')]({'where':{'type':_0x4b4c9e,'resourceId':_0x5e7ec9['id']}})[_0x304e('0x24')](function(){return _0x25faf1;});})[_0x304e('0x24')](function(){_0x100505[_0x304e('0x1b')](0xcc)[_0x304e('0x28')]();});}};}function handleEntityNotFound(_0x969746,_0x1303b2){return function(_0x2f24a8){if(!_0x2f24a8){_0x969746[_0x304e('0x1a')](0x194);}return _0x2f24a8;};}function handleError(_0x3536be,_0x495993){_0x495993=_0x495993||0x1f4;return function(_0x51746e){logger[_0x304e('0x29')](_0x51746e[_0x304e('0x2a')]);if(_0x51746e[_0x304e('0x2b')]){delete _0x51746e['name'];}_0x3536be[_0x304e('0x1b')](_0x495993)[_0x304e('0x2c')](_0x51746e);};}exports['index']=function(_0x2a8435,_0x1df23c){var _0x30549c={},_0x413fb5={},_0x2cd4c3={'count':0x0,'rows':[]};var _0x1ea51f=_[_0x304e('0x2d')](db['Disposition'][_0x304e('0x2e')],function(_0x5771c5){return{'name':_0x5771c5[_0x304e('0x2f')],'type':_0x5771c5[_0x304e('0x30')]['key']};});_0x413fb5[_0x304e('0x31')]=_[_0x304e('0x2d')](_0x1ea51f,'name');_0x413fb5['query']=_[_0x304e('0x32')](_0x2a8435[_0x304e('0x33')]);_0x413fb5[_0x304e('0x34')]=_[_0x304e('0x35')](_0x413fb5[_0x304e('0x31')],_0x413fb5[_0x304e('0x33')]);_0x30549c[_0x304e('0x36')]=_[_0x304e('0x35')](_0x413fb5['model'],qs[_0x304e('0x37')](_0x2a8435['query']['fields']));_0x30549c['attributes']=_0x30549c[_0x304e('0x36')][_0x304e('0x38')]?_0x30549c['attributes']:_0x413fb5[_0x304e('0x31')];if(!_0x2a8435[_0x304e('0x33')][_0x304e('0x39')](_0x304e('0x3a'))){_0x30549c[_0x304e('0x1e')]=qs['limit'](_0x2a8435[_0x304e('0x33')][_0x304e('0x1e')]);_0x30549c[_0x304e('0x1d')]=qs[_0x304e('0x1d')](_0x2a8435[_0x304e('0x33')][_0x304e('0x1d')]);}_0x30549c[_0x304e('0x3b')]=qs[_0x304e('0x3c')](_0x2a8435[_0x304e('0x33')][_0x304e('0x3c')]);_0x30549c['where']=qs[_0x304e('0x34')](_[_0x304e('0x3d')](_0x2a8435[_0x304e('0x33')],_0x413fb5[_0x304e('0x34')]),_0x1ea51f);if(_0x2a8435[_0x304e('0x33')][_0x304e('0x3e')]){_0x30549c['where']=_['merge'](_0x30549c[_0x304e('0x3f')],{'$or':_[_0x304e('0x2d')](_0x1ea51f,function(_0x155cbd){if(_0x155cbd[_0x304e('0x30')]!=='VIRTUAL'){var _0x3e1806={};_0x3e1806[_0x155cbd[_0x304e('0x2b')]]={'$like':'%'+_0x2a8435[_0x304e('0x33')]['filter']+'%'};return _0x3e1806;}})});}_0x30549c=_[_0x304e('0x40')]({},_0x30549c,_0x2a8435[_0x304e('0x41')]);var _0x2c711c={'where':_0x30549c[_0x304e('0x3f')]};return db[_0x304e('0x42')][_0x304e('0x1c')](_0x2c711c)[_0x304e('0x24')](function(_0x585d56){_0x2cd4c3[_0x304e('0x1c')]=_0x585d56;if(_0x2a8435[_0x304e('0x33')][_0x304e('0x43')]){_0x30549c[_0x304e('0x44')]=[{'all':!![]}];}return db[_0x304e('0x42')][_0x304e('0x45')](_0x30549c);})[_0x304e('0x24')](function(_0x5c65c1){_0x2cd4c3['rows']=_0x5c65c1;return _0x2cd4c3;})[_0x304e('0x24')](respondWithFilteredResult(_0x1df23c,_0x30549c))[_0x304e('0x46')](handleError(_0x1df23c,null));};exports['show']=function(_0x2b7e09,_0x237d1c){var _0x4265ca={'raw':!![],'where':{'id':_0x2b7e09['params']['id']}},_0xcfe30c={};_0xcfe30c['model']=_[_0x304e('0x32')](db[_0x304e('0x42')][_0x304e('0x2e')]);_0xcfe30c[_0x304e('0x33')]=_[_0x304e('0x32')](_0x2b7e09[_0x304e('0x33')]);_0xcfe30c[_0x304e('0x34')]=_['intersection'](_0xcfe30c[_0x304e('0x31')],_0xcfe30c['query']);_0x4265ca['attributes']=_[_0x304e('0x35')](_0xcfe30c[_0x304e('0x31')],qs['fields'](_0x2b7e09[_0x304e('0x33')]['fields']));_0x4265ca[_0x304e('0x36')]=_0x4265ca['attributes']['length']?_0x4265ca['attributes']:_0xcfe30c[_0x304e('0x31')];if(_0x2b7e09[_0x304e('0x33')][_0x304e('0x43')]){_0x4265ca['include']=[{'all':!![]}];}_0x4265ca=_[_0x304e('0x40')]({},_0x4265ca,_0x2b7e09['options']);return db[_0x304e('0x42')]['find'](_0x4265ca)[_0x304e('0x24')](handleEntityNotFound(_0x237d1c,null))[_0x304e('0x24')](respondWithResult(_0x237d1c,null))['catch'](handleError(_0x237d1c,null));};exports[_0x304e('0x47')]=function(_0x30fa84,_0x5e2134){return db[_0x304e('0x42')]['create'](_0x30fa84['body'],{})[_0x304e('0x24')](function(_0xbeedf7){var _0x16af38=_0x30fa84[_0x304e('0x48')][_0x304e('0x26')]({'plain':!![]});if(!_0x16af38)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16af38[_0x304e('0x49')]===_0x304e('0x48')){var _0x11126a=_0xbeedf7[_0x304e('0x26')]({'plain':!![]});var _0x29c4ee='Dispositions';return db[_0x304e('0x4a')][_0x304e('0x4b')]({'where':{'name':_0x29c4ee,'userProfileId':_0x16af38['userProfileId']},'raw':!![]})[_0x304e('0x24')](function(_0x257133){if(_0x257133&&_0x257133[_0x304e('0x4c')]===0x0){return db['UserProfileResource'][_0x304e('0x47')]({'name':_0x11126a[_0x304e('0x2b')],'resourceId':_0x11126a['id'],'type':_0x257133['name'],'sectionId':_0x257133['id']},{})['then'](function(){return _0xbeedf7;});}else{return _0xbeedf7;}})[_0x304e('0x46')](function(_0xf526dd){logger['error'](_0x304e('0x4d'),_0xf526dd);throw _0xf526dd;});}return _0xbeedf7;})[_0x304e('0x24')](respondWithResult(_0x5e2134,0xc9))[_0x304e('0x46')](handleError(_0x5e2134,null));};exports[_0x304e('0x23')]=function(_0x5e6d4f,_0x58f64a){if(_0x5e6d4f[_0x304e('0x4e')]['id']){delete _0x5e6d4f[_0x304e('0x4e')]['id'];}return db[_0x304e('0x42')]['find']({'where':{'id':_0x5e6d4f[_0x304e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x58f64a,null))[_0x304e('0x24')](saveUpdates(_0x5e6d4f['body'],null))[_0x304e('0x24')](respondWithResult(_0x58f64a,null))[_0x304e('0x46')](handleError(_0x58f64a,null));};exports['destroy']=function(_0x5de073,_0x1aaea6){return db['Disposition']['find']({'where':{'id':_0x5de073[_0x304e('0x4f')]['id']}})[_0x304e('0x24')](handleEntityNotFound(_0x1aaea6,null))[_0x304e('0x24')](removeEntity(_0x1aaea6,null))[_0x304e('0x46')](handleError(_0x1aaea6,null));}; \ No newline at end of file +var _0xbce5=['bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','json','apply','reject','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','map','Disposition','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','html-pdf','eml-format','request-promise','moment'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0xbce5,0xe9));var _0x5bce=function(_0x50b750,_0xe5817b){_0x50b750=_0x50b750-0x0;var _0x1b60a8=_0xbce5[_0x50b750];return _0x1b60a8;};'use strict';var pdf=require(_0x5bce('0x0'));var emlformat=require(_0x5bce('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5bce('0x2'));var moment=require(_0x5bce('0x3'));var BPromise=require(_0x5bce('0x4'));var Mustache=require(_0x5bce('0x5'));var util=require('util');var path=require(_0x5bce('0x6'));var sox=require(_0x5bce('0x7'));var csv=require('to-csv');var ejs=require(_0x5bce('0x8'));var fs=require('fs');var _=require(_0x5bce('0x9'));var squel=require('squel');var crypto=require(_0x5bce('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5bce('0xb'));var toCsv=require(_0x5bce('0xc'));var querystring=require(_0x5bce('0xd'));var Papa=require(_0x5bce('0xe'));var Redis=require(_0x5bce('0xf'));var authService=require(_0x5bce('0x10'));var qs=require(_0x5bce('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bce('0x12'));var logger=require('../../config/logger')(_0x5bce('0x13'));var utils=require(_0x5bce('0x14'));var config=require(_0x5bce('0x15'));var db=require(_0x5bce('0x16'))['db'];function respondWithStatusCode(_0x53a5dc,_0x5e9d61){_0x5e9d61=_0x5e9d61||0xcc;return function(_0x47042d){if(_0x47042d){return _0x53a5dc[_0x5bce('0x17')](_0x5e9d61);}return _0x53a5dc['status'](_0x5e9d61)[_0x5bce('0x18')]();};}function respondWithResult(_0x36bcff,_0x3aa571){_0x3aa571=_0x3aa571||0xc8;return function(_0x52ddb5){if(_0x52ddb5){return _0x36bcff[_0x5bce('0x19')](_0x3aa571)['json'](_0x52ddb5);}};}function respondWithFilteredResult(_0x23de50,_0x363c35){return function(_0x10d12b){if(_0x10d12b){var _0x40193f=_0x10d12b['count'],_0x5600f1=_0x363c35['offset'],_0x3b53e5=_0x363c35[_0x5bce('0x1a')]+_0x363c35[_0x5bce('0x1b')],_0x2411e1;if(_0x3b53e5>=_0x40193f){_0x3b53e5=_0x40193f;_0x2411e1=0xc8;}else{_0x2411e1=0xce;}_0x23de50['status'](_0x2411e1);return _0x23de50[_0x5bce('0x1c')]('Content-Range',_0x5600f1+'-'+_0x3b53e5+'/'+_0x40193f)[_0x5bce('0x1d')](_0x10d12b);}return null;};}function patchUpdates(_0x1ddb6d){return function(_0x21664b){try{jsonpatch[_0x5bce('0x1e')](_0x21664b,_0x1ddb6d,!![]);}catch(_0x1e8503){return BPromise[_0x5bce('0x1f')](_0x1e8503);}return _0x21664b['save']();};}function saveUpdates(_0x571d24,_0xb7cd3){return function(_0xc5e327){if(_0xc5e327){return _0xc5e327[_0x5bce('0x20')](_0x571d24)[_0x5bce('0x21')](function(_0x3edcf5){return _0x3edcf5;});}return null;};}function removeEntity(_0x396347,_0x2af9a0){return function(_0x303cd7){if(_0x303cd7){return _0x303cd7[_0x5bce('0x22')]()[_0x5bce('0x21')](function(){var _0x4b829c=_0x303cd7[_0x5bce('0x23')]({'plain':!![]});var _0x5a5759=_0x5bce('0x24');return db[_0x5bce('0x25')]['destroy']({'where':{'type':_0x5a5759,'resourceId':_0x4b829c['id']}})[_0x5bce('0x21')](function(){return _0x303cd7;});})[_0x5bce('0x21')](function(){_0x396347[_0x5bce('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb389,_0x52c6b0){return function(_0x1458af){if(!_0x1458af){_0x1eb389[_0x5bce('0x17')](0x194);}return _0x1458af;};}function handleError(_0x6c23df,_0x2981c5){_0x2981c5=_0x2981c5||0x1f4;return function(_0xb3876f){logger[_0x5bce('0x26')](_0xb3876f['stack']);if(_0xb3876f[_0x5bce('0x27')]){delete _0xb3876f[_0x5bce('0x27')];}_0x6c23df[_0x5bce('0x19')](_0x2981c5)[_0x5bce('0x28')](_0xb3876f);};}exports['index']=function(_0xeaff84,_0x1e365b){var _0x48ca72={},_0x3f1e31={},_0x3964df={'count':0x0,'rows':[]};var _0x20b4ae=_[_0x5bce('0x29')](db[_0x5bce('0x2a')]['rawAttributes'],function(_0x471b8b){return{'name':_0x471b8b[_0x5bce('0x2b')],'type':_0x471b8b[_0x5bce('0x2c')][_0x5bce('0x2d')]};});_0x3f1e31[_0x5bce('0x2e')]=_[_0x5bce('0x29')](_0x20b4ae,'name');_0x3f1e31['query']=_['keys'](_0xeaff84[_0x5bce('0x2f')]);_0x3f1e31[_0x5bce('0x30')]=_[_0x5bce('0x31')](_0x3f1e31[_0x5bce('0x2e')],_0x3f1e31[_0x5bce('0x2f')]);_0x48ca72[_0x5bce('0x32')]=_[_0x5bce('0x31')](_0x3f1e31[_0x5bce('0x2e')],qs['fields'](_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x33')]));_0x48ca72[_0x5bce('0x32')]=_0x48ca72['attributes'][_0x5bce('0x34')]?_0x48ca72[_0x5bce('0x32')]:_0x3f1e31[_0x5bce('0x2e')];if(!_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x35')]('nolimit')){_0x48ca72[_0x5bce('0x1b')]=qs['limit'](_0xeaff84[_0x5bce('0x2f')]['limit']);_0x48ca72[_0x5bce('0x1a')]=qs[_0x5bce('0x1a')](_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x1a')]);}_0x48ca72[_0x5bce('0x36')]=qs[_0x5bce('0x37')](_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x37')]);_0x48ca72[_0x5bce('0x38')]=qs['filters'](_[_0x5bce('0x39')](_0xeaff84[_0x5bce('0x2f')],_0x3f1e31['filters']),_0x20b4ae);if(_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x3a')]){_0x48ca72[_0x5bce('0x38')]=_[_0x5bce('0x3b')](_0x48ca72[_0x5bce('0x38')],{'$or':_[_0x5bce('0x29')](_0x20b4ae,function(_0x12b92a){if(_0x12b92a[_0x5bce('0x2c')]!==_0x5bce('0x3c')){var _0x16f3e9={};_0x16f3e9[_0x12b92a[_0x5bce('0x27')]]={'$like':'%'+_0xeaff84['query'][_0x5bce('0x3a')]+'%'};return _0x16f3e9;}})});}_0x48ca72=_['merge']({},_0x48ca72,_0xeaff84[_0x5bce('0x3d')]);var _0x4fa14d={'where':_0x48ca72[_0x5bce('0x38')]};return db[_0x5bce('0x2a')][_0x5bce('0x3e')](_0x4fa14d)[_0x5bce('0x21')](function(_0xd1fd3){_0x3964df[_0x5bce('0x3e')]=_0xd1fd3;if(_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x3f')]){_0x48ca72[_0x5bce('0x40')]=[{'all':!![]}];}return db[_0x5bce('0x2a')]['findAll'](_0x48ca72);})[_0x5bce('0x21')](function(_0xd7e880){_0x3964df[_0x5bce('0x41')]=_0xd7e880;return _0x3964df;})[_0x5bce('0x21')](respondWithFilteredResult(_0x1e365b,_0x48ca72))[_0x5bce('0x42')](handleError(_0x1e365b,null));};exports[_0x5bce('0x43')]=function(_0x20ebaf,_0x1157ac){var _0x142303={'raw':!![],'where':{'id':_0x20ebaf[_0x5bce('0x44')]['id']}},_0xac309e={};_0xac309e[_0x5bce('0x2e')]=_[_0x5bce('0x45')](db[_0x5bce('0x2a')][_0x5bce('0x46')]);_0xac309e['query']=_[_0x5bce('0x45')](_0x20ebaf['query']);_0xac309e[_0x5bce('0x30')]=_[_0x5bce('0x31')](_0xac309e[_0x5bce('0x2e')],_0xac309e[_0x5bce('0x2f')]);_0x142303[_0x5bce('0x32')]=_[_0x5bce('0x31')](_0xac309e[_0x5bce('0x2e')],qs['fields'](_0x20ebaf[_0x5bce('0x2f')][_0x5bce('0x33')]));_0x142303[_0x5bce('0x32')]=_0x142303[_0x5bce('0x32')][_0x5bce('0x34')]?_0x142303[_0x5bce('0x32')]:_0xac309e[_0x5bce('0x2e')];if(_0x20ebaf[_0x5bce('0x2f')][_0x5bce('0x3f')]){_0x142303[_0x5bce('0x40')]=[{'all':!![]}];}_0x142303=_[_0x5bce('0x3b')]({},_0x142303,_0x20ebaf[_0x5bce('0x3d')]);return db[_0x5bce('0x2a')][_0x5bce('0x47')](_0x142303)['then'](handleEntityNotFound(_0x1157ac,null))['then'](respondWithResult(_0x1157ac,null))[_0x5bce('0x42')](handleError(_0x1157ac,null));};exports[_0x5bce('0x48')]=function(_0x12b7b7,_0x16b5bb){return db[_0x5bce('0x2a')][_0x5bce('0x48')](_0x12b7b7[_0x5bce('0x49')],{})[_0x5bce('0x21')](function(_0x443561){var _0x9ab6c6=_0x12b7b7[_0x5bce('0x4a')]['get']({'plain':!![]});if(!_0x9ab6c6)throw new Error(_0x5bce('0x4b'));if(_0x9ab6c6[_0x5bce('0x4c')]===_0x5bce('0x4a')){var _0x35bc17=_0x443561[_0x5bce('0x23')]({'plain':!![]});var _0x316efa=_0x5bce('0x24');return db[_0x5bce('0x4d')][_0x5bce('0x47')]({'where':{'name':_0x316efa,'userProfileId':_0x9ab6c6['userProfileId']},'raw':!![]})[_0x5bce('0x21')](function(_0x338083){if(_0x338083&&_0x338083[_0x5bce('0x4e')]===0x0){return db[_0x5bce('0x25')]['create']({'name':_0x35bc17[_0x5bce('0x27')],'resourceId':_0x35bc17['id'],'type':_0x338083[_0x5bce('0x27')],'sectionId':_0x338083['id']},{})[_0x5bce('0x21')](function(){return _0x443561;});}else{return _0x443561;}})['catch'](function(_0x3d95cd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d95cd);throw _0x3d95cd;});}return _0x443561;})[_0x5bce('0x21')](respondWithResult(_0x16b5bb,0xc9))['catch'](handleError(_0x16b5bb,null));};exports[_0x5bce('0x20')]=function(_0x356378,_0x2182c3){if(_0x356378['body']['id']){delete _0x356378[_0x5bce('0x49')]['id'];}return db[_0x5bce('0x2a')][_0x5bce('0x47')]({'where':{'id':_0x356378[_0x5bce('0x44')]['id']}})['then'](handleEntityNotFound(_0x2182c3,null))['then'](saveUpdates(_0x356378[_0x5bce('0x49')],null))[_0x5bce('0x21')](respondWithResult(_0x2182c3,null))['catch'](handleError(_0x2182c3,null));};exports[_0x5bce('0x22')]=function(_0x381e35,_0x43bca0){return db['Disposition'][_0x5bce('0x47')]({'where':{'id':_0x381e35[_0x5bce('0x44')]['id']}})[_0x5bce('0x21')](handleEntityNotFound(_0x43bca0,null))[_0x5bce('0x21')](removeEntity(_0x43bca0,null))[_0x5bce('0x42')](handleError(_0x43bca0,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 997194c..2796ad1 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 _0x5c8f=['name','ListId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions'];(function(_0xe74afb,_0x2c9ae4){var _0x1cdd92=function(_0x2f3d22){while(--_0x2f3d22){_0xe74afb['push'](_0xe74afb['shift']());}};_0x1cdd92(++_0x2c9ae4);}(_0x5c8f,0x1a8));var _0xf5c8=function(_0x4b699c,_0x4728b9){_0x4b699c=_0x4b699c-0x0;var _0x43d390=_0x5c8f[_0x4b699c];return _0x43d390;};'use strict';var _=require(_0xf5c8('0x0'));var util=require(_0xf5c8('0x1'));var logger=require(_0xf5c8('0x2'))(_0xf5c8('0x3'));var moment=require(_0xf5c8('0x4'));var BPromise=require(_0xf5c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5c8('0x6'));var rimraf=require(_0xf5c8('0x7'));var config=require(_0xf5c8('0x8'));var attributes=require(_0xf5c8('0x9'));module['exports']=function(_0x2d8b8e,_0x4f64b0){return _0x2d8b8e[_0xf5c8('0xa')](_0xf5c8('0xb'),attributes,{'tableName':_0xf5c8('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xf5c8('0xd'),_0xf5c8('0xe')]},{'unique':!![],'name':'name_chat','fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xf5c8('0xf'),'fields':['name',_0xf5c8('0x10')]},{'unique':!![],'name':_0xf5c8('0x11'),'fields':[_0xf5c8('0xd'),_0xf5c8('0x12')]},{'unique':!![],'name':_0xf5c8('0x13'),'fields':[_0xf5c8('0xd'),_0xf5c8('0x14')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xf5c8('0x15')]},{'unique':!![],'name':_0xf5c8('0x16'),'fields':[_0xf5c8('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3f3=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax'];(function(_0x3e9fc6,_0x3a4bd1){var _0x3cb830=function(_0x4eac96){while(--_0x4eac96){_0x3e9fc6['push'](_0x3e9fc6['shift']());}};_0x3cb830(++_0x3a4bd1);}(_0xd3f3,0xac));var _0x3d3f=function(_0x336adb,_0x1c3608){_0x336adb=_0x336adb-0x0;var _0x5be7f5=_0xd3f3[_0x336adb];return _0x5be7f5;};'use strict';var _=require(_0x3d3f('0x0'));var util=require(_0x3d3f('0x1'));var logger=require(_0x3d3f('0x2'))('api');var moment=require(_0x3d3f('0x3'));var BPromise=require(_0x3d3f('0x4'));var rp=require(_0x3d3f('0x5'));var fs=require('fs');var path=require(_0x3d3f('0x6'));var rimraf=require(_0x3d3f('0x7'));var config=require(_0x3d3f('0x8'));var attributes=require(_0x3d3f('0x9'));module[_0x3d3f('0xa')]=function(_0x1b4575,_0xc8796a){return _0x1b4575[_0x3d3f('0xb')](_0x3d3f('0xc'),attributes,{'tableName':_0x3d3f('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3d3f('0xe'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x10')]},{'unique':!![],'name':_0x3d3f('0x11'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x12')]},{'unique':!![],'name':_0x3d3f('0x13'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x14')]},{'unique':!![],'name':_0x3d3f('0x15'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x16')]},{'unique':!![],'name':_0x3d3f('0x17'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x3d3f('0x18'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x19')]},{'unique':!![],'name':_0x3d3f('0x1a'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x1b')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 9b06652..b68f6cb 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 _0x0fed=['stringify','error','Disposition,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','then','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x184cbc,_0xa97898){var _0x5aba8d=function(_0x28aac5){while(--_0x28aac5){_0x184cbc['push'](_0x184cbc['shift']());}};_0x5aba8d(++_0xa97898);}(_0x0fed,0x72));var _0xd0fe=function(_0x22730b,_0x3aafcd){_0x22730b=_0x22730b-0x0;var _0x20af64=_0x0fed[_0x22730b];return _0x20af64;};'use strict';var _=require(_0xd0fe('0x0'));var util=require(_0xd0fe('0x1'));var moment=require('moment');var BPromise=require(_0xd0fe('0x2'));var rs=require(_0xd0fe('0x3'));var fs=require('fs');var Redis=require(_0xd0fe('0x4'));var db=require(_0xd0fe('0x5'))['db'];var utils=require(_0xd0fe('0x6'));var logger=require('../../config/logger')(_0xd0fe('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd0fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x267e84,_0x1c7f47,_0x3766e7){return new BPromise(function(_0x4119e2,_0x5d76e5){return client['request'](_0x267e84,_0x3766e7)[_0xd0fe('0x9')](function(_0x50a810){logger['info']('Disposition,\x20%s,\x20%s',_0x1c7f47,'request\x20sent');logger['debug'](_0xd0fe('0xa'),_0x1c7f47,_0xd0fe('0xb'),JSON[_0xd0fe('0xc')](_0x50a810));if(_0x50a810['error']){if(_0x50a810[_0xd0fe('0xd')]['code']===0x1f4){logger[_0xd0fe('0xd')](_0xd0fe('0xe'),_0x1c7f47,_0x50a810[_0xd0fe('0xd')]['message']);return _0x5d76e5(_0x50a810[_0xd0fe('0xd')][_0xd0fe('0xf')]);}logger[_0xd0fe('0xd')](_0xd0fe('0xe'),_0x1c7f47,_0x50a810[_0xd0fe('0xd')]['message']);return _0x4119e2(_0x50a810[_0xd0fe('0xd')][_0xd0fe('0xf')]);}else{logger['info'](_0xd0fe('0xe'),_0x1c7f47,_0xd0fe('0xb'));_0x4119e2(_0x50a810[_0xd0fe('0x10')][_0xd0fe('0xf')]);}})[_0xd0fe('0x11')](function(_0x3c6c22){logger[_0xd0fe('0xd')]('Disposition,\x20%s,\x20%s',_0x1c7f47,_0x3c6c22);_0x5d76e5(_0x3c6c22);});});} \ No newline at end of file +var _0x2c76=['jayson/promise','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x47c2f9,_0x4d8900){var _0x35096f=function(_0x3e51a8){while(--_0x3e51a8){_0x47c2f9['push'](_0x47c2f9['shift']());}};_0x35096f(++_0x4d8900);}(_0x2c76,0x97));var _0x62c7=function(_0x41fcb8,_0x12c1e9){_0x41fcb8=_0x41fcb8-0x0;var _0x3c7d62=_0x2c76[_0x41fcb8];return _0x3c7d62;};'use strict';var _=require(_0x62c7('0x0'));var util=require(_0x62c7('0x1'));var moment=require(_0x62c7('0x2'));var BPromise=require(_0x62c7('0x3'));var rs=require(_0x62c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62c7('0x5'))['db'];var utils=require(_0x62c7('0x6'));var logger=require(_0x62c7('0x7'))(_0x62c7('0x8'));var config=require(_0x62c7('0x9'));var jayson=require(_0x62c7('0xa'));var client=jayson['client'][_0x62c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fd1ff,_0x390ea3,_0x28f308){return new BPromise(function(_0x5741fd,_0x24521d){return client[_0x62c7('0xc')](_0x2fd1ff,_0x28f308)[_0x62c7('0xd')](function(_0x14910e){logger['info'](_0x62c7('0xe'),_0x390ea3,_0x62c7('0xf'));logger['debug'](_0x62c7('0x10'),_0x390ea3,'request\x20sent',JSON[_0x62c7('0x11')](_0x14910e));if(_0x14910e[_0x62c7('0x12')]){if(_0x14910e['error']['code']===0x1f4){logger[_0x62c7('0x12')]('Disposition,\x20%s,\x20%s',_0x390ea3,_0x14910e['error'][_0x62c7('0x13')]);return _0x24521d(_0x14910e[_0x62c7('0x12')][_0x62c7('0x13')]);}logger[_0x62c7('0x12')](_0x62c7('0xe'),_0x390ea3,_0x14910e[_0x62c7('0x12')][_0x62c7('0x13')]);return _0x5741fd(_0x14910e[_0x62c7('0x12')][_0x62c7('0x13')]);}else{logger[_0x62c7('0x14')](_0x62c7('0xe'),_0x390ea3,_0x62c7('0xf'));_0x5741fd(_0x14910e[_0x62c7('0x15')][_0x62c7('0x13')]);}})[_0x62c7('0x16')](function(_0x1ca81f){logger[_0x62c7('0x12')](_0x62c7('0xe'),_0x390ea3,_0x1ca81f);_0x24521d(_0x1ca81f);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index b5caf2d..2e977f2 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 _0xd237=['../../config/environment','./disposition.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xd237,0x14f));var _0x7d23=function(_0x18bd98,_0x56d69d){_0x18bd98=_0x18bd98-0x0;var _0x404e0c=_0xd237[_0x18bd98];return _0x404e0c;};'use strict';var multer=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var path=require(_0x7d23('0x2'));var timeout=require(_0x7d23('0x3'));var express=require('express');var router=express[_0x7d23('0x4')]();var auth=require(_0x7d23('0x5'));var interaction=require(_0x7d23('0x6'));var config=require(_0x7d23('0x7'));var controller=require(_0x7d23('0x8'));router[_0x7d23('0x9')]('/',auth['isAuthenticated'](),controller[_0x7d23('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7d23('0xb')]);router[_0x7d23('0xc')]('/',auth[_0x7d23('0xd')](),controller[_0x7d23('0xe')]);router[_0x7d23('0xf')](_0x7d23('0x10'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x11')]);router['delete'](_0x7d23('0x10'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6f18=['update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0x6f18,0x1b4));var _0x86f1=function(_0x2a7f48,_0x2ac3dd){_0x2a7f48=_0x2a7f48-0x0;var _0x2d472f=_0x6f18[_0x2a7f48];return _0x2d472f;};'use strict';var multer=require(_0x86f1('0x0'));var util=require('util');var path=require(_0x86f1('0x1'));var timeout=require('connect-timeout');var express=require(_0x86f1('0x2'));var router=express[_0x86f1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x86f1('0x4'));var config=require(_0x86f1('0x5'));var controller=require('./disposition.controller');router[_0x86f1('0x6')]('/',auth[_0x86f1('0x7')](),controller[_0x86f1('0x8')]);router[_0x86f1('0x6')](_0x86f1('0x9'),auth['isAuthenticated'](),controller[_0x86f1('0xa')]);router[_0x86f1('0xb')]('/',auth[_0x86f1('0x7')](),controller[_0x86f1('0xc')]);router[_0x86f1('0xd')]('/:id',auth[_0x86f1('0x7')](),controller[_0x86f1('0xe')]);router[_0x86f1('0xf')](_0x86f1('0x9'),auth[_0x86f1('0x7')](),controller[_0x86f1('0x10')]);module[_0x86f1('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d710236..aae8210 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 _0xdb41=['SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER'];(function(_0x2790fd,_0xbc208b){var _0x5eb880=function(_0x5686f9){while(--_0x5686f9){_0x2790fd['push'](_0x2790fd['shift']());}};_0x5eb880(++_0xbc208b);}(_0xdb41,0x111));var _0x1db4=function(_0x5bf9fd,_0x3f1d89){_0x5bf9fd=_0x5bf9fd-0x0;var _0x3563ce=_0xdb41[_0x5bf9fd];return _0x3563ce;};'use strict';var Sequelize=require(_0x1db4('0x0'));module[_0x1db4('0x1')]={'name':{'type':Sequelize[_0x1db4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1db4('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1db4('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x1db4('0x4')},'localstationid':{'type':Sequelize[_0x1db4('0x2')],'unique':_0x1db4('0x5')},'minrate':{'type':Sequelize[_0x1db4('0x6')](_0x1db4('0x7'),_0x1db4('0x8'),_0x1db4('0x9'),_0x1db4('0xa'),'12000',_0x1db4('0xb')),'defaultValue':_0x1db4('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x1db4('0x7'),_0x1db4('0x8'),'7200',_0x1db4('0xa'),_0x1db4('0xc'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x1db4('0x2')],'defaultValue':_0x1db4('0xd')},'gateway':{'type':Sequelize[_0x1db4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1db4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1db4('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x1db4('0xf'),_0x1db4('0x10'),_0x1db4('0x11'),_0x1db4('0x12')),'defaultValue':_0x1db4('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1db4('0x13')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1db4('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1db4('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xdd2042){if(!_0xdd2042)this[_0x1db4('0x15')](_0x1db4('0x16'),null);this[_0x1db4('0x15')](_0x1db4('0x17'),_0xdd2042);}}}; \ No newline at end of file +var _0xdf57=['14400','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','12000'];(function(_0x5b3c72,_0x3d855b){var _0x71d2cd=function(_0x4c7100){while(--_0x4c7100){_0x5b3c72['push'](_0x5b3c72['shift']());}};_0x71d2cd(++_0x3d855b);}(_0xdf57,0x12c));var _0x7df5=function(_0x49ff3f,_0x531e8f){_0x49ff3f=_0x49ff3f-0x0;var _0x4f9703=_0xdf57[_0x49ff3f];return _0x4f9703;};'use strict';var Sequelize=require(_0x7df5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7df5('0x1')]},'ecm':{'type':Sequelize[_0x7df5('0x2')](_0x7df5('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x7df5('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x7df5('0x2')](_0x7df5('0x5'),_0x7df5('0x6'),'7200','9600',_0x7df5('0x7'),_0x7df5('0x8')),'defaultValue':_0x7df5('0x6')},'maxrate':{'type':Sequelize[_0x7df5('0x2')]('2400',_0x7df5('0x6'),'7200',_0x7df5('0x9'),_0x7df5('0x7'),_0x7df5('0x8')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x7df5('0x1')],'defaultValue':_0x7df5('0xa')},'gateway':{'type':Sequelize[_0x7df5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7df5('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x7df5('0xc'),_0x7df5('0xd'),_0x7df5('0xe'),'KHOMP'),'defaultValue':_0x7df5('0xc')},'key':{'type':Sequelize[_0x7df5('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7df5('0xf')],'defaultValue':function(){return _0x7df5('0x10');}},'notificationSound':{'type':Sequelize[_0x7df5('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7df5('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7df5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7df5('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7df5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7df5('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7df5('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x7df5('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d6eda){if(!_0x2d6eda)this['setDataValue'](_0x7df5('0x13'),null);this[_0x7df5('0x14')](_0x7df5('0x15'),_0x2d6eda);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 92f60c4..3e162c7 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 _0x6e5f=['socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','FaxAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','save','update','then','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','FaxAccountId','Disposition','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','length','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','omit','tech','createdAt','TrunkId','ListId','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','updatedAt','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','user','Messages','Contact\x20not\x20found','spread','out','filename','dataValues','SendFax','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x6e5f,0xab));var _0xf6e5=function(_0x16aba5,_0x22727d){_0x16aba5=_0x16aba5-0x0;var _0x15bb97=_0x6e5f[_0x16aba5];return _0x15bb97;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf6e5('0x0'));var zipdir=require(_0xf6e5('0x1'));var jsonpatch=require(_0xf6e5('0x2'));var rp=require('request-promise');var moment=require(_0xf6e5('0x3'));var BPromise=require(_0xf6e5('0x4'));var Mustache=require('mustache');var util=require(_0xf6e5('0x5'));var path=require('path');var sox=require(_0xf6e5('0x6'));var csv=require(_0xf6e5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf6e5('0x8'));var squel=require(_0xf6e5('0x9'));var crypto=require(_0xf6e5('0xa'));var jsforce=require(_0xf6e5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf6e5('0x7'));var querystring=require(_0xf6e5('0xc'));var Papa=require(_0xf6e5('0xd'));var Redis=require(_0xf6e5('0xe'));var authService=require(_0xf6e5('0xf'));var qs=require(_0xf6e5('0x10'));var as=require(_0xf6e5('0x11'));var hardwareService=require(_0xf6e5('0x12'));var logger=require(_0xf6e5('0x13'))('api');var utils=require(_0xf6e5('0x14'));var config=require('../../config/environment');var db=require(_0xf6e5('0x15'))['db'];config[_0xf6e5('0x16')]=_[_0xf6e5('0x17')](config['redis'],{'host':_0xf6e5('0x18'),'port':0x18eb});var socket=require(_0xf6e5('0x19'))(new Redis(config[_0xf6e5('0x16')]));require('./faxAccount.socket')[_0xf6e5('0x1a')](socket);var jayson=require(_0xf6e5('0x1b'));var client=jayson[_0xf6e5('0x1c')][_0xf6e5('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xf6e5('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x464b51,_0xa9359b,_0x5956ea){if(_0x5956ea){var _0x579224=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x579224[_0xf6e5('0x1e')](_0xa9359b)){return _0x464b51;}else{throw new db[(_0xf6e5('0x1f'))]['ValidationError'](_0xf6e5('0x20'));}}else{return _0x464b51;}}function respondWithRpcPromise(_0x2a8755,_0x4f4c99,_0x75899a,_0x11c17a){return new BPromise(function(_0x1c78e6,_0x9ce8d5){var _0x16df23=_0x11c17a||client;return _0x16df23['request'](_0x2a8755,_0x75899a)['then'](function(_0x408690){logger[_0xf6e5('0x21')]('FaxAccount,\x20%s,\x20%s',_0x4f4c99,_0xf6e5('0x22'));logger[_0xf6e5('0x23')](_0xf6e5('0x24'),_0x4f4c99,_0xf6e5('0x22'),JSON[_0xf6e5('0x25')](_0x408690));if(_0x408690['error']){if(_0x408690['error'][_0xf6e5('0x26')]===0x1f4){logger[_0xf6e5('0x27')]('FaxAccount,\x20%s,\x20%s',_0x4f4c99,_0x408690[_0xf6e5('0x27')][_0xf6e5('0x28')]);return _0x9ce8d5(_0x408690[_0xf6e5('0x27')][_0xf6e5('0x28')]);}logger[_0xf6e5('0x27')](_0xf6e5('0x29'),_0x4f4c99,_0x408690[_0xf6e5('0x27')][_0xf6e5('0x28')]);return _0x1c78e6(_0x408690[_0xf6e5('0x27')][_0xf6e5('0x28')]);}else{logger[_0xf6e5('0x21')]('FaxAccount,\x20%s,\x20%s',_0x4f4c99,_0xf6e5('0x22'));_0x1c78e6(_0x408690[_0xf6e5('0x2a')][_0xf6e5('0x28')]);}})[_0xf6e5('0x2b')](function(_0x59913e){logger[_0xf6e5('0x27')]('FaxAccount,\x20%s,\x20%s',_0x4f4c99,_0x59913e);_0x9ce8d5(_0x59913e);});});}function respondWithStatusCode(_0x24f1ea,_0x2816e1){_0x2816e1=_0x2816e1||0xcc;return function(_0x532a20){if(_0x532a20){return _0x24f1ea[_0xf6e5('0x2c')](_0x2816e1);}return _0x24f1ea['status'](_0x2816e1)[_0xf6e5('0x2d')]();};}function respondWithResult(_0x21a87b,_0x6bdd04){_0x6bdd04=_0x6bdd04||0xc8;return function(_0x2393de){if(_0x2393de){return _0x21a87b[_0xf6e5('0x2e')](_0x6bdd04)[_0xf6e5('0x2f')](_0x2393de);}};}function respondWithFilteredResult(_0x36b967,_0x545715){return function(_0x22d6cb){if(_0x22d6cb){var _0x1de43f=_0x22d6cb['count'],_0x4a852f=_0x545715[_0xf6e5('0x30')],_0x44aed6=_0x545715[_0xf6e5('0x30')]+_0x545715[_0xf6e5('0x31')],_0x491cf5;if(_0x44aed6>=_0x1de43f){_0x44aed6=_0x1de43f;_0x491cf5=0xc8;}else{_0x491cf5=0xce;}_0x36b967[_0xf6e5('0x2e')](_0x491cf5);return _0x36b967[_0xf6e5('0x32')](_0xf6e5('0x33'),_0x4a852f+'-'+_0x44aed6+'/'+_0x1de43f)[_0xf6e5('0x2f')](_0x22d6cb);}return null;};}function patchUpdates(_0x4bfde8){return function(_0xca4d0){try{jsonpatch['apply'](_0xca4d0,_0x4bfde8,!![]);}catch(_0x5c9fc7){return BPromise['reject'](_0x5c9fc7);}return _0xca4d0[_0xf6e5('0x34')]();};}function saveUpdates(_0x3b48a9,_0x39000d){return function(_0x544e1f){if(_0x544e1f){return _0x544e1f[_0xf6e5('0x35')](_0x3b48a9)[_0xf6e5('0x36')](function(_0x16e144){return _0x16e144;});}return null;};}function removeEntity(_0x47274a,_0x58aa20){return function(_0x223176){if(_0x223176){return _0x223176['destroy']()[_0xf6e5('0x36')](function(){var _0x4d07d6=_0x223176[_0xf6e5('0x37')]({'plain':!![]});var _0x544a86=_0xf6e5('0x38');return db[_0xf6e5('0x39')][_0xf6e5('0x3a')]({'where':{'type':_0x544a86,'resourceId':_0x4d07d6['id']}})['then'](function(){return _0x223176;});})[_0xf6e5('0x36')](function(){_0x47274a['status'](0xcc)[_0xf6e5('0x2d')]();});}};}function handleEntityNotFound(_0x2beb75,_0x1910b7){return function(_0xddfd25){if(!_0xddfd25){_0x2beb75[_0xf6e5('0x2c')](0x194);}return _0xddfd25;};}function handleError(_0x43f5bb,_0x4fb617){_0x4fb617=_0x4fb617||0x1f4;return function(_0x230b8e){logger['error'](_0x230b8e[_0xf6e5('0x3b')]);if(_0x230b8e[_0xf6e5('0x3c')]){delete _0x230b8e[_0xf6e5('0x3c')];}_0x43f5bb['status'](_0x4fb617)[_0xf6e5('0x3d')](_0x230b8e);};}exports['index']=function(_0x5226d8,_0xd3f126){var _0x17550f={'include':[{'model':db[_0xf6e5('0x3e')],'as':_0xf6e5('0x3f')}]},_0x4775ca={},_0x54889a={'count':0x0,'rows':[]};var _0x22612e=_[_0xf6e5('0x40')](db[_0xf6e5('0x41')][_0xf6e5('0x42')],function(_0x363313){return{'name':_0x363313['fieldName'],'type':_0x363313[_0xf6e5('0x43')][_0xf6e5('0x44')]};});_0x4775ca['model']=_[_0xf6e5('0x40')](_0x22612e,'name');_0x4775ca[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x5226d8[_0xf6e5('0x45')]);_0x4775ca[_0xf6e5('0x47')]=_[_0xf6e5('0x48')](_0x4775ca['model'],_0x4775ca[_0xf6e5('0x45')]);_0x17550f[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x4775ca[_0xf6e5('0x4a')],qs[_0xf6e5('0x4b')](_0x5226d8[_0xf6e5('0x45')]['fields']));_0x17550f[_0xf6e5('0x49')]=_0x17550f[_0xf6e5('0x49')]['length']?_0x17550f[_0xf6e5('0x49')]:_0x4775ca[_0xf6e5('0x4a')];if(!_0x5226d8['query'][_0xf6e5('0x4c')](_0xf6e5('0x4d'))){_0x17550f['limit']=qs[_0xf6e5('0x31')](_0x5226d8[_0xf6e5('0x45')]['limit']);_0x17550f[_0xf6e5('0x30')]=qs['offset'](_0x5226d8[_0xf6e5('0x45')][_0xf6e5('0x30')]);}_0x17550f[_0xf6e5('0x4e')]=qs[_0xf6e5('0x4f')](_0x5226d8[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x17550f['where']=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x5226d8[_0xf6e5('0x45')],_0x4775ca[_0xf6e5('0x47')]),_0x22612e);if(_0x5226d8['query'][_0xf6e5('0x51')]){_0x17550f[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x17550f[_0xf6e5('0x52')],{'$or':_['map'](_0x22612e,function(_0x20872a){if(_0x20872a[_0xf6e5('0x43')]!==_0xf6e5('0x54')){var _0x3ecc0f={};_0x3ecc0f[_0x20872a[_0xf6e5('0x3c')]]={'$like':'%'+_0x5226d8[_0xf6e5('0x45')][_0xf6e5('0x51')]+'%'};return _0x3ecc0f;}})});}_0x17550f=_[_0xf6e5('0x53')]({},_0x17550f,_0x5226d8[_0xf6e5('0x55')]);var _0x5c170f={'where':_0x17550f[_0xf6e5('0x52')]};return db[_0xf6e5('0x41')][_0xf6e5('0x56')](_0x5c170f)['then'](function(_0x248989){_0x54889a[_0xf6e5('0x56')]=_0x248989;if(_0x5226d8['query'][_0xf6e5('0x57')]){_0x17550f['include']=[{'all':!![]}];}return db[_0xf6e5('0x41')][_0xf6e5('0x58')](_0x17550f);})['then'](function(_0x337834){_0x54889a[_0xf6e5('0x59')]=_0x337834;return _0x54889a;})[_0xf6e5('0x36')](respondWithFilteredResult(_0xd3f126,_0x17550f))[_0xf6e5('0x2b')](handleError(_0xd3f126,null));};exports[_0xf6e5('0x5a')]=function(_0x78f732,_0x3f35d9){var _0x381698={'raw':![],'where':{'id':_0x78f732[_0xf6e5('0x5b')]['id']},'include':[{'model':db[_0xf6e5('0x3e')],'as':'mandatoryDispositionPause'}]},_0x51257e={};_0x51257e['model']=_[_0xf6e5('0x46')](db[_0xf6e5('0x41')][_0xf6e5('0x42')]);_0x51257e[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x78f732[_0xf6e5('0x45')]);_0x51257e[_0xf6e5('0x47')]=_[_0xf6e5('0x48')](_0x51257e[_0xf6e5('0x4a')],_0x51257e[_0xf6e5('0x45')]);_0x381698[_0xf6e5('0x49')]=_['intersection'](_0x51257e['model'],qs[_0xf6e5('0x4b')](_0x78f732[_0xf6e5('0x45')][_0xf6e5('0x4b')]));_0x381698[_0xf6e5('0x49')]=_0x381698[_0xf6e5('0x49')]['length']?_0x381698[_0xf6e5('0x49')]:_0x51257e[_0xf6e5('0x4a')];if(_0x78f732[_0xf6e5('0x45')]['includeAll']){_0x381698['include']=[{'all':!![]}];}_0x381698=_[_0xf6e5('0x53')]({},_0x381698,_0x78f732[_0xf6e5('0x55')]);return db[_0xf6e5('0x41')][_0xf6e5('0x5c')](_0x381698)[_0xf6e5('0x36')](handleEntityNotFound(_0x3f35d9,null))[_0xf6e5('0x36')](respondWithResult(_0x3f35d9,null))[_0xf6e5('0x2b')](handleError(_0x3f35d9,null));};exports['create']=function(_0x4bf0ee,_0x281a25){return db[_0xf6e5('0x41')][_0xf6e5('0x5d')](_0x4bf0ee[_0xf6e5('0x5e')],{})[_0xf6e5('0x36')](function(_0x3b6a76){var _0x35b87d=_0x4bf0ee['user'][_0xf6e5('0x37')]({'plain':!![]});if(!_0x35b87d)throw new Error(_0xf6e5('0x5f'));if(_0x35b87d[_0xf6e5('0x60')]==='user'){var _0x54b0bc=_0x3b6a76[_0xf6e5('0x37')]({'plain':!![]});var _0x588c91=_0xf6e5('0x38');return db[_0xf6e5('0x61')]['find']({'where':{'name':_0x588c91,'userProfileId':_0x35b87d[_0xf6e5('0x62')]},'raw':!![]})[_0xf6e5('0x36')](function(_0x3e3153){if(_0x3e3153&&_0x3e3153[_0xf6e5('0x63')]===0x0){return db[_0xf6e5('0x39')][_0xf6e5('0x5d')]({'name':_0x54b0bc[_0xf6e5('0x3c')],'resourceId':_0x54b0bc['id'],'type':_0x3e3153[_0xf6e5('0x3c')],'sectionId':_0x3e3153['id']},{})[_0xf6e5('0x36')](function(){return _0x3b6a76;});}else{return _0x3b6a76;}})[_0xf6e5('0x2b')](function(_0x563337){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x563337);throw _0x563337;});}return _0x3b6a76;})[_0xf6e5('0x36')](respondWithResult(_0x281a25,0xc9))['catch'](handleError(_0x281a25,null));};exports[_0xf6e5('0x35')]=function(_0x53ac7f,_0x5dfe54){if(_0x53ac7f[_0xf6e5('0x5e')]['id']){delete _0x53ac7f[_0xf6e5('0x5e')]['id'];}return db['FaxAccount'][_0xf6e5('0x5c')]({'where':{'id':_0x53ac7f[_0xf6e5('0x5b')]['id']},'include':[{'model':db[_0xf6e5('0x3e')],'as':_0xf6e5('0x3f')}]})['then'](handleEntityNotFound(_0x5dfe54,null))[_0xf6e5('0x36')](saveUpdates(_0x53ac7f['body'],null))[_0xf6e5('0x36')](respondWithResult(_0x5dfe54,null))[_0xf6e5('0x2b')](handleError(_0x5dfe54,null));};exports['destroy']=function(_0xc5777c,_0x50aaf9){return db[_0xf6e5('0x41')]['find']({'where':{'id':_0xc5777c[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x50aaf9,null))['then'](removeEntity(_0x50aaf9,null))[_0xf6e5('0x2b')](handleError(_0x50aaf9,null));};exports['describe']=function(_0x28cc9a,_0x46f6a0){return db[_0xf6e5('0x41')][_0xf6e5('0x64')]()[_0xf6e5('0x36')](respondWithResult(_0x46f6a0,null))[_0xf6e5('0x2b')](handleError(_0x46f6a0,null));};exports['addDisposition']=function(_0x629e7a,_0x4fe5b4,_0x2af69a){if(_0x629e7a[_0xf6e5('0x5e')]['id']){delete _0x629e7a[_0xf6e5('0x5e')]['id'];}return db[_0xf6e5('0x41')][_0xf6e5('0x5c')]({'where':{'id':_0x629e7a['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x4fe5b4,null))[_0xf6e5('0x36')](function(_0x17d626){if(_0x17d626){_0x629e7a[_0xf6e5('0x5e')][_0xf6e5('0x65')]=_0x17d626['id'];return db[_0xf6e5('0x66')]['create'](_0x629e7a[_0xf6e5('0x5e')]);}})['then'](respondWithResult(_0x4fe5b4,null))[_0xf6e5('0x2b')](handleError(_0x4fe5b4,null));};exports['getDispositions']=function(_0x3e982a,_0x5a32d5,_0x462b8a){var _0x4fc6b7={'raw':![],'where':{}};var _0x1c51ba={};var _0xe3fed6={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3e982a['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x5a32d5,null))[_0xf6e5('0x36')](function(_0x2eecc4){if(_0x2eecc4){_0x1c51ba[_0xf6e5('0x4a')]=_[_0xf6e5('0x46')](db['Disposition'][_0xf6e5('0x42')]);_0x1c51ba['query']=_['keys'](_0x3e982a[_0xf6e5('0x45')]);_0x1c51ba[_0xf6e5('0x47')]=_['intersection'](_0x1c51ba['model'],_0x1c51ba[_0xf6e5('0x45')]);_0x4fc6b7[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x1c51ba[_0xf6e5('0x4a')],qs['fields'](_0x3e982a['query'][_0xf6e5('0x4b')]));_0x4fc6b7['attributes']=_0x4fc6b7[_0xf6e5('0x49')]['length']?_0x4fc6b7[_0xf6e5('0x49')]:_0x1c51ba[_0xf6e5('0x4a')];if(!_0x3e982a[_0xf6e5('0x45')]['hasOwnProperty'](_0xf6e5('0x4d'))){_0x4fc6b7[_0xf6e5('0x31')]=qs[_0xf6e5('0x31')](_0x3e982a[_0xf6e5('0x45')][_0xf6e5('0x31')]);_0x4fc6b7[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x3e982a[_0xf6e5('0x45')][_0xf6e5('0x30')]);}_0x4fc6b7[_0xf6e5('0x4e')]=qs['sort'](_0x3e982a[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x4fc6b7[_0xf6e5('0x52')]=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x3e982a[_0xf6e5('0x45')],_0x1c51ba[_0xf6e5('0x47')]));_0x4fc6b7[_0xf6e5('0x52')]['FaxAccountId']=_0x2eecc4['id'];if(_0x3e982a['query'][_0xf6e5('0x51')]){_0x4fc6b7[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x4fc6b7['where'],{'$or':_[_0xf6e5('0x40')](_0x4fc6b7[_0xf6e5('0x49')],function(_0x82603d){var _0xd8fa8b={};_0xd8fa8b[_0x82603d]={'$like':'%'+_0x3e982a[_0xf6e5('0x45')]['filter']+'%'};return _0xd8fa8b;})});}_0x4fc6b7=_[_0xf6e5('0x53')]({},_0x4fc6b7,_0x3e982a[_0xf6e5('0x55')]);return db[_0xf6e5('0x66')][_0xf6e5('0x56')]({'where':_0x4fc6b7[_0xf6e5('0x52')]})['then'](function(_0x1facf5){_0xe3fed6[_0xf6e5('0x56')]=_0x1facf5;if(_0x3e982a[_0xf6e5('0x45')][_0xf6e5('0x57')]){_0x4fc6b7[_0xf6e5('0x67')]=[{'all':!![]}];}return db[_0xf6e5('0x66')]['findAll'](_0x4fc6b7);})[_0xf6e5('0x36')](function(_0x247568){_0xe3fed6[_0xf6e5('0x59')]=_0x247568;return _0xe3fed6;});}})['then'](respondWithFilteredResult(_0x5a32d5,_0x4fc6b7))[_0xf6e5('0x2b')](handleError(_0x5a32d5,null));};exports[_0xf6e5('0x68')]=function(_0x3ec9af,_0x5e59c8,_0x3df4bd){return db['FaxAccount']['find']({'where':{'id':_0x3ec9af[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x5e59c8,null))['then'](function(_0x19db8){if(_0x19db8){return _0x19db8['removeDispositions'](_0x3ec9af['query'][_0xf6e5('0x69')]);}})[_0xf6e5('0x36')](respondWithStatusCode(_0x5e59c8,null))[_0xf6e5('0x2b')](handleError(_0x5e59c8,null));};exports[_0xf6e5('0x6a')]=function(_0x36be6f,_0x3b0def,_0x9546b7){if(_0x36be6f['body']['id']){delete _0x36be6f[_0xf6e5('0x5e')]['id'];}return db[_0xf6e5('0x41')]['find']({'where':{'id':_0x36be6f['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x3b0def,null))[_0xf6e5('0x36')](function(_0x2c4fd3){if(_0x2c4fd3){_0x36be6f[_0xf6e5('0x5e')][_0xf6e5('0x65')]=_0x2c4fd3['id'];return db[_0xf6e5('0x6b')][_0xf6e5('0x5d')](_0x36be6f[_0xf6e5('0x5e')]);}})['then'](respondWithResult(_0x3b0def,null))[_0xf6e5('0x2b')](handleError(_0x3b0def,null));};exports[_0xf6e5('0x6c')]=function(_0x3fdc8b,_0x34f0e2,_0x17aef5){var _0x2a8c4b={'raw':![],'where':{}};var _0x4371a6={};var _0x31079d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf6e5('0x6d')]({'where':{'id':_0x3fdc8b[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x34f0e2,null))[_0xf6e5('0x36')](function(_0x6011ec){if(_0x6011ec){_0x4371a6['model']=_[_0xf6e5('0x46')](db[_0xf6e5('0x6b')][_0xf6e5('0x42')]);_0x4371a6[_0xf6e5('0x45')]=_['keys'](_0x3fdc8b['query']);_0x4371a6[_0xf6e5('0x47')]=_['intersection'](_0x4371a6[_0xf6e5('0x4a')],_0x4371a6[_0xf6e5('0x45')]);_0x2a8c4b[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x4371a6[_0xf6e5('0x4a')],qs[_0xf6e5('0x4b')](_0x3fdc8b['query'][_0xf6e5('0x4b')]));_0x2a8c4b[_0xf6e5('0x49')]=_0x2a8c4b[_0xf6e5('0x49')]['length']?_0x2a8c4b[_0xf6e5('0x49')]:_0x4371a6[_0xf6e5('0x4a')];if(!_0x3fdc8b[_0xf6e5('0x45')]['hasOwnProperty'](_0xf6e5('0x4d'))){_0x2a8c4b[_0xf6e5('0x31')]=qs[_0xf6e5('0x31')](_0x3fdc8b['query']['limit']);_0x2a8c4b[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x3fdc8b['query'][_0xf6e5('0x30')]);}_0x2a8c4b[_0xf6e5('0x4e')]=qs[_0xf6e5('0x4f')](_0x3fdc8b[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x2a8c4b['where']=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x3fdc8b[_0xf6e5('0x45')],_0x4371a6[_0xf6e5('0x47')]));_0x2a8c4b[_0xf6e5('0x52')][_0xf6e5('0x65')]=_0x6011ec['id'];if(_0x3fdc8b[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0x2a8c4b[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x2a8c4b['where'],{'$or':_[_0xf6e5('0x40')](_0x2a8c4b[_0xf6e5('0x49')],function(_0x585765){var _0x3b925c={};_0x3b925c[_0x585765]={'$like':'%'+_0x3fdc8b[_0xf6e5('0x45')]['filter']+'%'};return _0x3b925c;})});}_0x2a8c4b=_[_0xf6e5('0x53')]({},_0x2a8c4b,_0x3fdc8b[_0xf6e5('0x55')]);return db[_0xf6e5('0x6b')]['count']({'where':_0x2a8c4b[_0xf6e5('0x52')]})[_0xf6e5('0x36')](function(_0x582436){_0x31079d[_0xf6e5('0x56')]=_0x582436;if(_0x3fdc8b[_0xf6e5('0x45')][_0xf6e5('0x57')]){_0x2a8c4b[_0xf6e5('0x67')]=[{'all':!![]}];}return db[_0xf6e5('0x6b')][_0xf6e5('0x58')](_0x2a8c4b);})['then'](function(_0x48ccf0){_0x31079d['rows']=_0x48ccf0;return _0x31079d;});}})[_0xf6e5('0x36')](respondWithFilteredResult(_0x34f0e2,_0x2a8c4b))[_0xf6e5('0x2b')](handleError(_0x34f0e2,null));};exports[_0xf6e5('0x6e')]=function(_0x13c8d9,_0x470a78,_0x1de177){return db[_0xf6e5('0x41')][_0xf6e5('0x5c')]({'where':{'id':_0x13c8d9[_0xf6e5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x470a78,null))['then'](function(_0x17170a){if(_0x17170a){return _0x17170a[_0xf6e5('0x6e')](_0x13c8d9[_0xf6e5('0x45')][_0xf6e5('0x69')]);}})[_0xf6e5('0x36')](respondWithStatusCode(_0x470a78,null))[_0xf6e5('0x2b')](handleError(_0x470a78,null));};exports[_0xf6e5('0x6f')]=function(_0x470190,_0x429807,_0x1c9c69){return db['FaxInteraction'][_0xf6e5('0x5c')]({'where':{'id':_0x470190[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x429807,null))[_0xf6e5('0x36')](function(_0x59d6c0){if(_0x59d6c0){return _0x59d6c0[_0xf6e5('0x6f')](_0x470190[_0xf6e5('0x5e')][_0xf6e5('0x69')],_['omit'](_0x470190[_0xf6e5('0x5e')],['ids','id'])||{});}})[_0xf6e5('0x36')](respondWithResult(_0x429807,null))[_0xf6e5('0x2b')](handleError(_0x429807,null));};exports[_0xf6e5('0x70')]=function(_0x2a43ff,_0x41d4e6,_0x1f9e48){var _0x18bc53={'raw':![],'where':{}};var _0x20b776={};var _0x2d653a={'count':0x0,'rows':[]};return db[_0xf6e5('0x41')][_0xf6e5('0x6d')]({'where':{'id':_0x2a43ff['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x41d4e6,null))['then'](function(_0x4de5be){if(_0x4de5be){_0x20b776[_0xf6e5('0x4a')]=_[_0xf6e5('0x46')](db[_0xf6e5('0x71')][_0xf6e5('0x42')]);_0x20b776[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x2a43ff[_0xf6e5('0x45')]);_0x20b776[_0xf6e5('0x47')]=_[_0xf6e5('0x48')](_0x20b776[_0xf6e5('0x4a')],_0x20b776[_0xf6e5('0x45')]);_0x18bc53[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x20b776[_0xf6e5('0x4a')],qs[_0xf6e5('0x4b')](_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x4b')]));_0x18bc53[_0xf6e5('0x49')]=_0x18bc53[_0xf6e5('0x49')]['length']?_0x18bc53['attributes']:_0x20b776[_0xf6e5('0x4a')];if(!_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x4c')](_0xf6e5('0x4d'))){_0x18bc53['limit']=qs[_0xf6e5('0x31')](_0x2a43ff['query'][_0xf6e5('0x31')]);_0x18bc53[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x30')]);}_0x18bc53['order']=qs[_0xf6e5('0x4f')](_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x18bc53[_0xf6e5('0x52')]=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x2a43ff['query'],_0x20b776[_0xf6e5('0x47')]));_0x18bc53['where'][_0xf6e5('0x65')]=_0x4de5be['id'];if(_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0x18bc53[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x18bc53[_0xf6e5('0x52')],{'$or':_[_0xf6e5('0x40')](_0x18bc53[_0xf6e5('0x49')],function(_0x502904){var _0x4ef08d={};_0x4ef08d[_0x502904]={'$like':'%'+_0x2a43ff['query']['filter']+'%'};return _0x4ef08d;})});}_0x18bc53=_[_0xf6e5('0x53')]({},_0x18bc53,_0x2a43ff[_0xf6e5('0x55')]);return db[_0xf6e5('0x71')][_0xf6e5('0x56')]({'where':_0x18bc53['where']})['then'](function(_0x94f6c3){_0x2d653a[_0xf6e5('0x56')]=_0x94f6c3;if(_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x57')]){_0x18bc53['include']=[{'model':db[_0xf6e5('0x72')],'as':_0xf6e5('0x73'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xf6e5('0x3c'),'fullname',_0xf6e5('0x74')],'required':![]},{'model':db[_0xf6e5('0x75')],'as':_0xf6e5('0x76'),'attributes':['id',_0xf6e5('0x3c'),_0xf6e5('0x77')],'where':_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x78')]?{'id':_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x78')]}:undefined,'required':_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x78')]?!![]:![]}];}return db[_0xf6e5('0x71')]['findAll'](_0x18bc53);})['then'](function(_0x2fd261){_0x2d653a['rows']=_0x2fd261;return _0x2d653a;});}})['then'](respondWithFilteredResult(_0x41d4e6,_0x18bc53))[_0xf6e5('0x2b')](handleError(_0x41d4e6,null));};exports[_0xf6e5('0x79')]=function(_0xb79b7d,_0x53e2b2,_0x3c234c){return db[_0xf6e5('0x41')]['findOne']({'where':{'id':_0xb79b7d[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x53e2b2,null))['then'](function(_0x254203){if(_0x254203){return db[_0xf6e5('0x7a')][_0xf6e5('0x7b')](function(_0x8b677){return db[_0xf6e5('0x7c')][_0xf6e5('0x3a')]({'where':{'FaxAccountId':_0xb79b7d[_0xf6e5('0x5b')]['id']},'transaction':_0x8b677})['then'](function(_0x1b1f65){var _0x33eafc=_[_0xf6e5('0x40')](_0xb79b7d['body'],function(_0x8dd96){_0x8dd96[_0xf6e5('0x65')]=_0xb79b7d[_0xf6e5('0x5b')]['id'];return _0x8dd96;});return db[_0xf6e5('0x7c')][_0xf6e5('0x7d')](_0x33eafc,{'transaction':_0x8b677});});})['then'](function(){return db[_0xf6e5('0x7c')][_0xf6e5('0x7e')]({'where':{'FaxAccountId':_0xb79b7d[_0xf6e5('0x5b')]['id']},'order':'priority'});});}})[_0xf6e5('0x36')](respondWithResult(_0x53e2b2,null))['catch'](handleError(_0x53e2b2,null));};exports['getApplications']=function(_0x5d6bc7,_0x5aad0b,_0x559d42){var _0xb039cd={};var _0x115cc1={};var _0x376d42;var _0x37c7e1;return db['FaxAccount'][_0xf6e5('0x6d')]({'where':{'id':_0x5d6bc7['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x5aad0b,null))[_0xf6e5('0x36')](function(_0x117553){if(_0x117553){_0x376d42=_0x117553;_0x115cc1[_0xf6e5('0x4a')]=_['keys'](db[_0xf6e5('0x7c')]['rawAttributes']);_0x115cc1[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x5d6bc7['query']);_0x115cc1[_0xf6e5('0x47')]=_['intersection'](_0x115cc1['model'],_0x115cc1['query']);_0xb039cd[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x115cc1[_0xf6e5('0x4a')],qs[_0xf6e5('0x4b')](_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x4b')]));_0xb039cd[_0xf6e5('0x49')]=_0xb039cd['attributes']['length']?_0xb039cd[_0xf6e5('0x49')]:_0x115cc1['model'];_0xb039cd[_0xf6e5('0x4e')]=qs['sort'](_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0xb039cd[_0xf6e5('0x52')]=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x5d6bc7['query'],_0x115cc1['filters']));if(_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0xb039cd['where']=_['merge'](_0xb039cd[_0xf6e5('0x52')],{'$or':_[_0xf6e5('0x40')](_0xb039cd[_0xf6e5('0x49')],function(_0x3112b3){var _0x351885={};_0x351885[_0x3112b3]={'$like':'%'+_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x51')]+'%'};return _0x351885;})});}_0xb039cd=_[_0xf6e5('0x53')]({},_0xb039cd,_0x5d6bc7[_0xf6e5('0x55')]);return _0x376d42['getApplications'](_0xb039cd);}})[_0xf6e5('0x36')](function(_0x59b622){if(_0x59b622){_0x37c7e1=_0x59b622[_0xf6e5('0x7f')];if(!_0x5d6bc7['query'][_0xf6e5('0x4c')]('nolimit')){_0xb039cd[_0xf6e5('0x31')]=qs['limit'](_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x31')]);_0xb039cd[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x30')]);}return _0x376d42['getApplications'](_0xb039cd);}})[_0xf6e5('0x36')](function(_0x313632){if(_0x313632){return _0x313632?{'count':_0x37c7e1,'rows':_0x313632}:null;}})[_0xf6e5('0x36')](respondWithResult(_0x5aad0b,null))[_0xf6e5('0x2b')](handleError(_0x5aad0b,null));};function Extension(_0x2c1c43,_0x267a2d,_0x295ddb,_0x38c59c){this[_0xf6e5('0x80')]=_0xf6e5('0x81');this[_0xf6e5('0x82')]=_0x2c1c43[_0xf6e5('0x83')];this[_0xf6e5('0x84')]=_0x38c59c;this['type']=_0xf6e5('0x85');this[_0xf6e5('0x86')]=_0xf6e5('0x87');this[_0xf6e5('0x65')]=_0x2c1c43['id'];this['priority']=_0x267a2d;this[_0xf6e5('0x88')]=_0x295ddb;}function createExtensionsReciveFax(_0x43f6de){var _0x3b3887=0x1;var _0x3f8fe6=[];_0x3f8fe6[_0xf6e5('0x89')](new Extension(_0x43f6de,_0x3b3887,'',_0xf6e5('0x8a')));_0x3b3887+=0x1;_0x3f8fe6['push'](new Extension(_0x43f6de,_0x3b3887,_0xf6e5('0x8b'),_0xf6e5('0x8c')));_0x3b3887+=0x1;for(var _0x25ba7c in _0x43f6de){if(_0x43f6de[_0xf6e5('0x4c')](_0x25ba7c)&&(_0x25ba7c===_0xf6e5('0x8d')||_0x25ba7c===_0xf6e5('0x83')||_0x25ba7c===_0xf6e5('0x8e')||_0x25ba7c===_0xf6e5('0x8f')||_0x25ba7c===_0xf6e5('0x90')||_0x25ba7c===_0xf6e5('0x91')||_0x25ba7c===_0xf6e5('0x92')||_0x25ba7c==='modem'||_0x25ba7c===_0xf6e5('0x93'))){_0x3f8fe6[_0xf6e5('0x89')](new Extension(_0x43f6de,_0x3b3887,_0xf6e5('0x94')+_0x25ba7c+')='+_0x43f6de[_0x25ba7c],_0xf6e5('0x8c')));_0x3b3887+=0x1;}}_0x3f8fe6[_0xf6e5('0x89')](new Extension(_0x43f6de,_0x3b3887,'6',_0xf6e5('0x95')));_0x3b3887+=0x1;_0x3f8fe6[_0xf6e5('0x89')](new Extension(_0x43f6de,_0x3b3887,_0xf6e5('0x96'),_0xf6e5('0x97')));_0x3b3887=0x0;return _0x3f8fe6;}exports[_0xf6e5('0x98')]=function(_0x96dcbe,_0x255deb,_0x4522b9){var _0x14d65d;return db[_0xf6e5('0x7a')]['transaction'](function(_0x7ac217){return db[_0xf6e5('0x41')][_0xf6e5('0x5d')](_0x96dcbe[_0xf6e5('0x5e')],{'transaction':_0x7ac217})['then'](function(_0x50bc0a){_0x14d65d=_0x50bc0a[_0xf6e5('0x37')]({'plain':!![]});return db['VoiceExtension'][_0xf6e5('0x7d')](createExtensionsReciveFax(_0x14d65d),{'transaction':_0x7ac217});});})[_0xf6e5('0x36')](function(){return _0x14d65d;})['then'](respondWithResult(_0x255deb,null))['catch'](handleError(_0x255deb,null));};exports[_0xf6e5('0x99')]=function(_0x52a043,_0x104069,_0x15da10){var _0x4296a4;return db[_0xf6e5('0x7a')][_0xf6e5('0x7b')](function(_0x35999e){return db['FaxAccount']['update'](_0x52a043[_0xf6e5('0x5e')],{'where':{'id':_0x52a043[_0xf6e5('0x5e')]['id']},'transaction':_0x35999e})[_0xf6e5('0x36')](function(_0xc00791){return db[_0xf6e5('0x9a')][_0xf6e5('0x3a')]({'where':{'FaxAccountId':_0x52a043['body']['id']},'transaction':_0x35999e})[_0xf6e5('0x36')](function(_0x2101b8){return db[_0xf6e5('0x9a')][_0xf6e5('0x7d')](createExtensionsReciveFax(_[_0xf6e5('0x9b')](_0x52a043[_0xf6e5('0x5e')],[_0xf6e5('0x9c'),_0xf6e5('0x44'),_0xf6e5('0x9d'),'updatedAt',_0xf6e5('0x9e'),_0xf6e5('0x9f')])),{'transaction':_0x35999e});});});})[_0xf6e5('0x36')](function(){return db['FaxAccount'][_0xf6e5('0xa0')](_0x52a043['body']['id']);})['then'](respondWithResult(_0x104069,null))[_0xf6e5('0x2b')](handleError(_0x104069,null));};exports['getMessages']=function(_0x32f708,_0x364bc3,_0x47e8f9){var _0x442741={'raw':!![],'where':{}};var _0x34ec6c={};var _0x480858={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf6e5('0x6d')]({'where':{'id':_0x32f708[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x364bc3,null))[_0xf6e5('0x36')](function(_0x140d6b){if(_0x140d6b){_0x34ec6c[_0xf6e5('0x4a')]=_[_0xf6e5('0x46')](db['FaxMessage']['rawAttributes']);_0x34ec6c[_0xf6e5('0x45')]=_['keys'](_0x32f708['query']);_0x34ec6c['filters']=_[_0xf6e5('0x48')](_0x34ec6c['model'],_0x34ec6c[_0xf6e5('0x45')]);_0x442741[_0xf6e5('0x49')]=_['intersection'](_0x34ec6c[_0xf6e5('0x4a')],qs['fields'](_0x32f708[_0xf6e5('0x45')]['fields']));_0x442741[_0xf6e5('0x49')]=_0x442741['attributes'][_0xf6e5('0x7f')]?_0x442741['attributes']:_0x34ec6c[_0xf6e5('0x4a')];if(!_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x4c')]('nolimit')){_0x442741[_0xf6e5('0x31')]=qs[_0xf6e5('0x31')](_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x31')]);_0x442741[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x30')]);}_0x442741[_0xf6e5('0x4e')]=qs['sort'](_0x32f708[_0xf6e5('0x45')]['sort']);_0x442741[_0xf6e5('0x52')]=qs['filters'](_[_0xf6e5('0x50')](_0x32f708[_0xf6e5('0x45')],_0x34ec6c[_0xf6e5('0x47')]));_0x442741[_0xf6e5('0x52')][_0xf6e5('0x65')]=_0x140d6b['id'];if(_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0x442741[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x442741['where'],{'$or':_['map'](_0x442741[_0xf6e5('0x49')],function(_0x7f4477){var _0x37d637={};_0x37d637[_0x7f4477]={'$like':'%'+_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x51')]+'%'};return _0x37d637;})});}if(_0x32f708['query'][_0xf6e5('0xa1')]){var _0x546758=_0x32f708['query'][_0xf6e5('0xa1')][_0xf6e5('0xa2')](',');var _0x1a1f28={};_0x1a1f28[_0x546758[0x0]]={'$gte':moment(_0x546758[0x1])[_0xf6e5('0xa3')](_0xf6e5('0xa4'))};_0x442741['where']=_['merge'](_0x442741['where'],_0x1a1f28);}_0x442741=_['merge']({},_0x442741,_0x32f708[_0xf6e5('0x55')]);return db[_0xf6e5('0xa5')][_0xf6e5('0x56')]({'where':_0x442741['where']})['then'](function(_0x3eda95){_0x480858[_0xf6e5('0x56')]=_0x3eda95;if(_0x32f708['query'][_0xf6e5('0x57')]){_0x442741[_0xf6e5('0x67')]=[{'all':!![]}];}return db[_0xf6e5('0xa5')][_0xf6e5('0x58')](_0x442741);})[_0xf6e5('0x36')](function(_0x4448c3){_0x480858[_0xf6e5('0x59')]=_0x4448c3;return _0x480858;});}})[_0xf6e5('0x36')](respondWithFilteredResult(_0x364bc3,_0x442741))[_0xf6e5('0x2b')](handleError(_0x364bc3,null));};exports[_0xf6e5('0x3d')]=function(_0x4c100b,_0x4faade,_0x436ce6){var _0x9821b9,_0x42aab3={},_0x453455;if(_0x4c100b[_0xf6e5('0x5e')]['to']){_0x453455=_0x4c100b['body']['to'][0x0];}return db[_0xf6e5('0x41')][_0xf6e5('0x5c')]({'where':{'id':_0x4c100b[_0xf6e5('0x5b')]['id']},'include':[{'model':db[_0xf6e5('0xa6')],'as':_0xf6e5('0xa7'),'include':[{'model':db[_0xf6e5('0x72')],'as':'Contacts','where':{'fax':_0x453455},'limit':0x1,'order':[[_0xf6e5('0xa8'),_0xf6e5('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x4faade,null))['then'](function(_0x47b10a){_0x9821b9=_0x47b10a;if(_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')]&&_0x4c100b['body']['attachments'][_0xf6e5('0x7f')]){for(var _0x4cb56b=0x0;_0x4cb56b<_0x4c100b['body'][_0xf6e5('0xaa')]['length'];_0x4cb56b+=0x1){_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][_0x4cb56b]={'filename':_0x4c100b['body'][_0xf6e5('0xaa')][_0x4cb56b][_0xf6e5('0x3c')],'id':_0x4c100b[_0xf6e5('0x5e')]['attachments'][_0x4cb56b]['id'],'path':path[_0xf6e5('0xab')](config['root'],_0xf6e5('0xac'),_0x4c100b['body']['attachments'][_0x4cb56b][_0xf6e5('0xad')])};}}return respondWithRpcPromise(_0xf6e5('0xae'),_0xf6e5('0xae'),{'FaxAccountId':_[_0xf6e5('0xaf')](_0x4c100b[_0xf6e5('0x5b')]['id'])?undefined:_0x4c100b['params']['id'],'path':_[_0xf6e5('0xaf')](_0x4c100b['body']['attachments'][0x0][_0xf6e5('0xb0')])?undefined:_0x4c100b[_0xf6e5('0x5e')]['attachments'][0x0][_0xf6e5('0xb0')],'fax':_['isNil'](_0x4c100b['body']['to'][0x0])?undefined:_0x4c100b[_0xf6e5('0x5e')]['to'][0x0]},client9002);})[_0xf6e5('0x36')](function(){if(_0x9821b9){if(_['isNil'](_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xb1')])){_0x4c100b['body'][_0xf6e5('0xb1')]=util[_0xf6e5('0xa3')](_0xf6e5('0xb2'),_0x9821b9[_0xf6e5('0x3c')],_0x9821b9[_0xf6e5('0xb3')]);}if(_0x9821b9[_0xf6e5('0xa7')]){if(_0x9821b9['List']['Contacts']['length']){return _0x9821b9[_0xf6e5('0xa7')][_0xf6e5('0xb4')][0x0];}else{return db[_0xf6e5('0x72')][_0xf6e5('0x5d')](_['defaults'](_0x4c100b['body'],{'firstName':_0x4c100b['body']['to'][0x0],'phone':_0x4c100b[_0xf6e5('0x5e')]['to'][0x0],'fax':_0x4c100b[_0xf6e5('0x5e')]['to'][0x0],'ListId':_0x9821b9[_0xf6e5('0x9f')]}));}}else{throw new Error(_0xf6e5('0xb5'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xf6e5('0x36')](function(_0x274531){if(_0x274531){return db[_0xf6e5('0x71')][_0xf6e5('0x5c')]({'where':{'ContactId':_0x274531['id'],'closed':![],'FaxAccountId':_0x9821b9['id']}})['then'](function(_0x39b2f3){if(_0x39b2f3){return[_0x39b2f3,![]];}return db['FaxInteraction']['create']({'UserId':_0x4c100b[_0xf6e5('0xb6')]['id'],'ContactId':_0x274531['id'],'FaxAccountId':_0x9821b9['id'],'fax':_0x4c100b['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xf6e5('0x53')](_0x4c100b[_0xf6e5('0x5e')],{'read':![],'body':_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0]['filename'],'FaxAccountId':_0x9821b9['id'],'UserId':_0x4c100b[_0xf6e5('0xb6')]['id'],'ContactId':_0x274531['id'],'AttachmentId':_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xf6e5('0xa5')],'as':_0xf6e5('0xb7')}]})[_0xf6e5('0x36')](function(_0x500135){return[_0x500135,!![]];});});}else{throw new Error(_0xf6e5('0xb8'));}})[_0xf6e5('0xb9')](function(_0x57a6cc,_0x13eac7){if(_0x13eac7){return _0x57a6cc;}return db['FaxMessage']['create']({'direction':_0xf6e5('0xba'),'read':![],'body':_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0][_0xf6e5('0xbb')],'FaxAccountId':_0x9821b9['id'],'FaxInteractionId':_0x57a6cc['id'],'UserId':_0x4c100b[_0xf6e5('0xb6')]['id'],'ContactId':_0x57a6cc['ContactId'],'AttachmentId':_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0]['id']})['then'](function(_0x14c387){_0x57a6cc['dataValues'][_0xf6e5('0xb7')]=[];_0x57a6cc[_0xf6e5('0xbc')][_0xf6e5('0xb7')]['push'](_0x14c387[_0xf6e5('0xbc')]);return _0x57a6cc;});})['then'](function(_0x10691c){respondWithRpcPromise(_0xf6e5('0xbd'),_0xf6e5('0xbd'),{'FaxAccountId':_[_0xf6e5('0xaf')](_0x4c100b[_0xf6e5('0x5b')]['id'])?undefined:_0x4c100b['params']['id'],'path':_[_0xf6e5('0xaf')](_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0][_0xf6e5('0xb0')])?undefined:_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0][_0xf6e5('0xb0')],'fax':_[_0xf6e5('0xaf')](_0x4c100b[_0xf6e5('0x5e')]['to'][0x0])?undefined:_0x4c100b[_0xf6e5('0x5e')]['to'][0x0],'AttachmentId':_0x4c100b['body']['attachments'][0x0]['id']},client9002)[_0xf6e5('0x36')](function(_0x9c8f9b){logger[_0xf6e5('0x21')]('SendFaxRpc,\x20%s',_0x9c8f9b);})[_0xf6e5('0x2b')](function(_0x2ae3d5){logger[_0xf6e5('0x21')]('SendFaxRpc,\x20%s',_0x2ae3d5);});return _0x10691c;})[_0xf6e5('0x36')](respondWithResult(_0x4faade,null))[_0xf6e5('0x2b')](handleError(_0x4faade,null));};exports[_0xf6e5('0xbe')]=function(_0x3f1a77,_0x4946fc,_0x1b5465){return db[_0xf6e5('0x41')][_0xf6e5('0x5c')]({'where':{'id':_0x3f1a77['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x4946fc,null))[_0xf6e5('0x36')](function(_0x5c37ea){if(_0x5c37ea){return _0x5c37ea['addAgents'](_0x3f1a77['body'][_0xf6e5('0x69')],_['omit'](_0x3f1a77[_0xf6e5('0x5e')],[_0xf6e5('0x69'),'id'])||{})['spread'](function(_0x81f445){for(var _0xe35836=0x0;_0xe35836<_0x3f1a77[_0xf6e5('0x5e')][_0xf6e5('0x69')]['length'];_0xe35836+=0x1){socket[_0xf6e5('0xbf')]('userFaxAccount:save',{'UserId':_0x3f1a77[_0xf6e5('0x5e')][_0xf6e5('0x69')][_0xe35836],'FaxAccountId':_0x3f1a77[_0xf6e5('0x5b')]['id']});}return _0x81f445;});}})['then'](respondWithResult(_0x4946fc,null))[_0xf6e5('0x2b')](handleError(_0x4946fc,null));};exports[_0xf6e5('0xc0')]=function(_0x1e89bd,_0x4d39d6,_0x201108){return db['FaxAccount']['find']({'where':{'id':_0x1e89bd[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x4d39d6,null))[_0xf6e5('0x36')](function(_0xc92105){if(_0xc92105){return _0xc92105[_0xf6e5('0xc0')](_0x1e89bd[_0xf6e5('0x45')][_0xf6e5('0x69')])[_0xf6e5('0x36')](function(){if(_[_0xf6e5('0xc1')](_0x1e89bd['query']['ids'])){for(var _0x41c22f=0x0;_0x41c22f<_0x1e89bd[_0xf6e5('0x45')][_0xf6e5('0x69')][_0xf6e5('0x7f')];_0x41c22f+=0x1){socket[_0xf6e5('0xbf')](_0xf6e5('0xc2'),{'UserId':Number(_0x1e89bd['query'][_0xf6e5('0x69')][_0x41c22f]),'FaxAccountId':Number(_0x1e89bd['params']['id'])});}}else{socket[_0xf6e5('0xbf')](_0xf6e5('0xc2'),{'UserId':Number(_0x1e89bd['query']['ids']),'FaxAccountId':Number(_0x1e89bd['params']['id'])});}});}})[_0xf6e5('0x36')](respondWithStatusCode(_0x4d39d6,null))['catch'](handleError(_0x4d39d6,null));};exports[_0xf6e5('0xc3')]=function(_0x228d35,_0x358554,_0x2f39b8){var _0x406db1={};var _0x2b0048={};var _0x48c64a;var _0x11c327;return db[_0xf6e5('0x41')][_0xf6e5('0x6d')]({'where':{'id':_0x228d35['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x358554,null))['then'](function(_0x1f368f){if(_0x1f368f){_0x48c64a=_0x1f368f;_0x2b0048[_0xf6e5('0x4a')]=_[_0xf6e5('0x46')](db['User'][_0xf6e5('0x42')]);_0x2b0048[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x228d35[_0xf6e5('0x45')]);_0x2b0048['filters']=_[_0xf6e5('0x48')](_0x2b0048[_0xf6e5('0x4a')],_0x2b0048[_0xf6e5('0x45')]);_0x406db1[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x2b0048[_0xf6e5('0x4a')],qs['fields'](_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x4b')]));_0x406db1[_0xf6e5('0x49')]=_0x406db1[_0xf6e5('0x49')]['length']?_0x406db1[_0xf6e5('0x49')]:_0x2b0048['model'];_0x406db1[_0xf6e5('0x4e')]=qs[_0xf6e5('0x4f')](_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x406db1['where']=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x228d35['query'],_0x2b0048['filters']));if(_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0x406db1[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x406db1[_0xf6e5('0x52')],{'$or':_[_0xf6e5('0x40')](_0x406db1[_0xf6e5('0x49')],function(_0x4246fa){var _0x52aa0e={};_0x52aa0e[_0x4246fa]={'$like':'%'+_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x51')]+'%'};return _0x52aa0e;})});}_0x406db1=_[_0xf6e5('0x53')]({},_0x406db1,_0x228d35[_0xf6e5('0x55')]);return _0x48c64a[_0xf6e5('0xc3')](_0x406db1);}})['then'](function(_0x89478f){if(_0x89478f){_0x11c327=_0x89478f[_0xf6e5('0x7f')];if(!_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x4c')](_0xf6e5('0x4d'))){_0x406db1[_0xf6e5('0x31')]=qs[_0xf6e5('0x31')](_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x31')]);_0x406db1['offset']=qs[_0xf6e5('0x30')](_0x228d35['query'][_0xf6e5('0x30')]);}return _0x48c64a['getAgents'](_0x406db1);}})[_0xf6e5('0x36')](function(_0x507a7c){if(_0x507a7c){return _0x507a7c?{'count':_0x11c327,'rows':_0x507a7c}:null;}})[_0xf6e5('0x36')](respondWithResult(_0x358554,null))['catch'](handleError(_0x358554,null));}; \ No newline at end of file +var _0xdf6c=['TrunkId','ListId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','FaxAccounts','UserProfileResource','end','stack','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','mandatoryDispositionPause','destroy','describe','FaxAccountId','getDispositions','findOne','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','Answer','ecm','gateway','faxdetect','headerinfo','modem','push','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xdf6c,0x1ab));var _0xcdf6=function(_0x31cf4e,_0x1673ec){_0x31cf4e=_0x31cf4e-0x0;var _0x3dcd76=_0xdf6c[_0x31cf4e];return _0x3dcd76;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcdf6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdf6('0x1'));var rp=require('request-promise');var moment=require(_0xcdf6('0x2'));var BPromise=require(_0xcdf6('0x3'));var Mustache=require(_0xcdf6('0x4'));var util=require('util');var path=require(_0xcdf6('0x5'));var sox=require(_0xcdf6('0x6'));var csv=require(_0xcdf6('0x7'));var ejs=require(_0xcdf6('0x8'));var fs=require('fs');var _=require(_0xcdf6('0x9'));var squel=require(_0xcdf6('0xa'));var crypto=require(_0xcdf6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcdf6('0xc'));var toCsv=require(_0xcdf6('0x7'));var querystring=require('querystring');var Papa=require(_0xcdf6('0xd'));var Redis=require(_0xcdf6('0xe'));var authService=require(_0xcdf6('0xf'));var qs=require(_0xcdf6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdf6('0x11'))('api');var utils=require(_0xcdf6('0x12'));var config=require(_0xcdf6('0x13'));var db=require(_0xcdf6('0x14'))['db'];config[_0xcdf6('0x15')]=_[_0xcdf6('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcdf6('0x17'))(new Redis(config[_0xcdf6('0x15')]));require('./faxAccount.socket')[_0xcdf6('0x18')](socket);var jayson=require(_0xcdf6('0x19'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x5e2cc7,_0x395dc0,_0xd9dff8){if(_0xd9dff8){var _0x313136=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x313136[_0xcdf6('0x1a')](_0x395dc0)){return _0x5e2cc7;}else{throw new db[(_0xcdf6('0x1b'))][(_0xcdf6('0x1c'))](_0xcdf6('0x1d'));}}else{return _0x5e2cc7;}}function respondWithRpcPromise(_0x2b6d60,_0x3eef3f,_0x280f2d,_0x21af93){return new BPromise(function(_0x1beea9,_0x2c8285){var _0x3b76e4=_0x21af93||client;return _0x3b76e4[_0xcdf6('0x1e')](_0x2b6d60,_0x280f2d)['then'](function(_0x3831b9){logger[_0xcdf6('0x1f')](_0xcdf6('0x20'),_0x3eef3f,_0xcdf6('0x21'));logger[_0xcdf6('0x22')](_0xcdf6('0x23'),_0x3eef3f,_0xcdf6('0x21'),JSON[_0xcdf6('0x24')](_0x3831b9));if(_0x3831b9[_0xcdf6('0x25')]){if(_0x3831b9['error']['code']===0x1f4){logger[_0xcdf6('0x25')](_0xcdf6('0x20'),_0x3eef3f,_0x3831b9[_0xcdf6('0x25')]['message']);return _0x2c8285(_0x3831b9[_0xcdf6('0x25')][_0xcdf6('0x26')]);}logger[_0xcdf6('0x25')]('FaxAccount,\x20%s,\x20%s',_0x3eef3f,_0x3831b9[_0xcdf6('0x25')][_0xcdf6('0x26')]);return _0x1beea9(_0x3831b9['error'][_0xcdf6('0x26')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x3eef3f,_0xcdf6('0x21'));_0x1beea9(_0x3831b9[_0xcdf6('0x27')][_0xcdf6('0x26')]);}})[_0xcdf6('0x28')](function(_0x88e2e2){logger['error'](_0xcdf6('0x20'),_0x3eef3f,_0x88e2e2);_0x2c8285(_0x88e2e2);});});}function respondWithStatusCode(_0xdcbd65,_0x522b62){_0x522b62=_0x522b62||0xcc;return function(_0x619ec6){if(_0x619ec6){return _0xdcbd65[_0xcdf6('0x29')](_0x522b62);}return _0xdcbd65['status'](_0x522b62)['end']();};}function respondWithResult(_0x24e3bf,_0x3b0aea){_0x3b0aea=_0x3b0aea||0xc8;return function(_0x2c122e){if(_0x2c122e){return _0x24e3bf[_0xcdf6('0x2a')](_0x3b0aea)[_0xcdf6('0x2b')](_0x2c122e);}};}function respondWithFilteredResult(_0x1cc504,_0xc8b3a5){return function(_0x10df6a){if(_0x10df6a){var _0x5647cb=_0x10df6a[_0xcdf6('0x2c')],_0x9a21f2=_0xc8b3a5[_0xcdf6('0x2d')],_0x1bfcb3=_0xc8b3a5[_0xcdf6('0x2d')]+_0xc8b3a5[_0xcdf6('0x2e')],_0x159226;if(_0x1bfcb3>=_0x5647cb){_0x1bfcb3=_0x5647cb;_0x159226=0xc8;}else{_0x159226=0xce;}_0x1cc504['status'](_0x159226);return _0x1cc504[_0xcdf6('0x2f')](_0xcdf6('0x30'),_0x9a21f2+'-'+_0x1bfcb3+'/'+_0x5647cb)['json'](_0x10df6a);}return null;};}function patchUpdates(_0x332efa){return function(_0x1a0734){try{jsonpatch['apply'](_0x1a0734,_0x332efa,!![]);}catch(_0x234d8f){return BPromise[_0xcdf6('0x31')](_0x234d8f);}return _0x1a0734[_0xcdf6('0x32')]();};}function saveUpdates(_0x525304,_0x4ef8c5){return function(_0x1eb077){if(_0x1eb077){return _0x1eb077[_0xcdf6('0x33')](_0x525304)[_0xcdf6('0x34')](function(_0x4da477){return _0x4da477;});}return null;};}function removeEntity(_0x9d833f,_0x2a9a54){return function(_0x51c7f7){if(_0x51c7f7){return _0x51c7f7['destroy']()[_0xcdf6('0x34')](function(){var _0x523dea=_0x51c7f7[_0xcdf6('0x35')]({'plain':!![]});var _0x46cb5a=_0xcdf6('0x36');return db[_0xcdf6('0x37')]['destroy']({'where':{'type':_0x46cb5a,'resourceId':_0x523dea['id']}})['then'](function(){return _0x51c7f7;});})[_0xcdf6('0x34')](function(){_0x9d833f[_0xcdf6('0x2a')](0xcc)[_0xcdf6('0x38')]();});}};}function handleEntityNotFound(_0x22bbf6,_0xc27c0b){return function(_0x7f9706){if(!_0x7f9706){_0x22bbf6['sendStatus'](0x194);}return _0x7f9706;};}function handleError(_0x44186e,_0x16abf6){_0x16abf6=_0x16abf6||0x1f4;return function(_0x44aa14){logger['error'](_0x44aa14[_0xcdf6('0x39')]);if(_0x44aa14[_0xcdf6('0x3a')]){delete _0x44aa14[_0xcdf6('0x3a')];}_0x44186e[_0xcdf6('0x2a')](_0x16abf6)[_0xcdf6('0x3b')](_0x44aa14);};}exports[_0xcdf6('0x3c')]=function(_0x4a59bc,_0x5491e4){var _0x2237cf={'include':[{'model':db[_0xcdf6('0x3d')],'as':'mandatoryDispositionPause'}]},_0x58d762={},_0x48c3d3={'count':0x0,'rows':[]};var _0x1f3dd0=_[_0xcdf6('0x3e')](db[_0xcdf6('0x3f')][_0xcdf6('0x40')],function(_0x56f548){return{'name':_0x56f548[_0xcdf6('0x41')],'type':_0x56f548[_0xcdf6('0x42')][_0xcdf6('0x43')]};});_0x58d762[_0xcdf6('0x44')]=_[_0xcdf6('0x3e')](_0x1f3dd0,'name');_0x58d762[_0xcdf6('0x45')]=_['keys'](_0x4a59bc['query']);_0x58d762[_0xcdf6('0x46')]=_[_0xcdf6('0x47')](_0x58d762[_0xcdf6('0x44')],_0x58d762[_0xcdf6('0x45')]);_0x2237cf[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x58d762[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x49')]));_0x2237cf[_0xcdf6('0x48')]=_0x2237cf[_0xcdf6('0x48')][_0xcdf6('0x4a')]?_0x2237cf[_0xcdf6('0x48')]:_0x58d762[_0xcdf6('0x44')];if(!_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x2237cf['limit']=qs[_0xcdf6('0x2e')](_0x4a59bc['query'][_0xcdf6('0x2e')]);_0x2237cf[_0xcdf6('0x2d')]=qs[_0xcdf6('0x2d')](_0x4a59bc['query'][_0xcdf6('0x2d')]);}_0x2237cf[_0xcdf6('0x4d')]=qs['sort'](_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x2237cf[_0xcdf6('0x4f')]=qs[_0xcdf6('0x46')](_['pick'](_0x4a59bc['query'],_0x58d762[_0xcdf6('0x46')]),_0x1f3dd0);if(_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x2237cf[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x2237cf[_0xcdf6('0x4f')],{'$or':_[_0xcdf6('0x3e')](_0x1f3dd0,function(_0x5c37c8){if(_0x5c37c8[_0xcdf6('0x42')]!==_0xcdf6('0x52')){var _0x3b808c={};_0x3b808c[_0x5c37c8[_0xcdf6('0x3a')]]={'$like':'%'+_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x50')]+'%'};return _0x3b808c;}})});}_0x2237cf=_[_0xcdf6('0x51')]({},_0x2237cf,_0x4a59bc['options']);var _0x4fb0d9={'where':_0x2237cf[_0xcdf6('0x4f')]};return db['FaxAccount'][_0xcdf6('0x2c')](_0x4fb0d9)[_0xcdf6('0x34')](function(_0x35e8ac){_0x48c3d3['count']=_0x35e8ac;if(_0x4a59bc['query'][_0xcdf6('0x53')]){_0x2237cf[_0xcdf6('0x54')]=[{'all':!![]}];}return db[_0xcdf6('0x3f')][_0xcdf6('0x55')](_0x2237cf);})[_0xcdf6('0x34')](function(_0x50d2d0){_0x48c3d3[_0xcdf6('0x56')]=_0x50d2d0;return _0x48c3d3;})['then'](respondWithFilteredResult(_0x5491e4,_0x2237cf))['catch'](handleError(_0x5491e4,null));};exports[_0xcdf6('0x57')]=function(_0x2392a8,_0x5d255c){var _0x493e19={'raw':![],'where':{'id':_0x2392a8['params']['id']},'include':[{'model':db[_0xcdf6('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1f7101={};_0x1f7101['model']=_['keys'](db[_0xcdf6('0x3f')]['rawAttributes']);_0x1f7101[_0xcdf6('0x45')]=_[_0xcdf6('0x58')](_0x2392a8[_0xcdf6('0x45')]);_0x1f7101['filters']=_['intersection'](_0x1f7101[_0xcdf6('0x44')],_0x1f7101[_0xcdf6('0x45')]);_0x493e19[_0xcdf6('0x48')]=_['intersection'](_0x1f7101[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x2392a8[_0xcdf6('0x45')]['fields']));_0x493e19['attributes']=_0x493e19['attributes'][_0xcdf6('0x4a')]?_0x493e19['attributes']:_0x1f7101[_0xcdf6('0x44')];if(_0x2392a8[_0xcdf6('0x45')][_0xcdf6('0x53')]){_0x493e19[_0xcdf6('0x54')]=[{'all':!![]}];}_0x493e19=_[_0xcdf6('0x51')]({},_0x493e19,_0x2392a8[_0xcdf6('0x59')]);return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')](_0x493e19)['then'](handleEntityNotFound(_0x5d255c,null))['then'](respondWithResult(_0x5d255c,null))[_0xcdf6('0x28')](handleError(_0x5d255c,null));};exports[_0xcdf6('0x5b')]=function(_0x295182,_0x41aa4e){return db[_0xcdf6('0x3f')][_0xcdf6('0x5b')](_0x295182[_0xcdf6('0x5c')],{})[_0xcdf6('0x34')](function(_0x1c551b){var _0x5371f6=_0x295182[_0xcdf6('0x5d')][_0xcdf6('0x35')]({'plain':!![]});if(!_0x5371f6)throw new Error(_0xcdf6('0x5e'));if(_0x5371f6[_0xcdf6('0x5f')]===_0xcdf6('0x5d')){var _0x395d88=_0x1c551b[_0xcdf6('0x35')]({'plain':!![]});var _0x4d0e60='FaxAccounts';return db[_0xcdf6('0x60')][_0xcdf6('0x5a')]({'where':{'name':_0x4d0e60,'userProfileId':_0x5371f6['userProfileId']},'raw':!![]})[_0xcdf6('0x34')](function(_0x25ed76){if(_0x25ed76&&_0x25ed76[_0xcdf6('0x61')]===0x0){return db[_0xcdf6('0x37')][_0xcdf6('0x5b')]({'name':_0x395d88[_0xcdf6('0x3a')],'resourceId':_0x395d88['id'],'type':_0x25ed76[_0xcdf6('0x3a')],'sectionId':_0x25ed76['id']},{})['then'](function(){return _0x1c551b;});}else{return _0x1c551b;}})['catch'](function(_0x3f26ed){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f26ed);throw _0x3f26ed;});}return _0x1c551b;})[_0xcdf6('0x34')](respondWithResult(_0x41aa4e,0xc9))[_0xcdf6('0x28')](handleError(_0x41aa4e,null));};exports[_0xcdf6('0x33')]=function(_0x4c0cbe,_0x334096){if(_0x4c0cbe['body']['id']){delete _0x4c0cbe[_0xcdf6('0x5c')]['id'];}return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x4c0cbe[_0xcdf6('0x62')]['id']},'include':[{'model':db[_0xcdf6('0x3d')],'as':_0xcdf6('0x63')}]})[_0xcdf6('0x34')](handleEntityNotFound(_0x334096,null))[_0xcdf6('0x34')](saveUpdates(_0x4c0cbe[_0xcdf6('0x5c')],null))[_0xcdf6('0x34')](respondWithResult(_0x334096,null))[_0xcdf6('0x28')](handleError(_0x334096,null));};exports[_0xcdf6('0x64')]=function(_0x20a989,_0x1bbb10){return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x20a989['params']['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x1bbb10,null))[_0xcdf6('0x34')](removeEntity(_0x1bbb10,null))['catch'](handleError(_0x1bbb10,null));};exports[_0xcdf6('0x65')]=function(_0x5da927,_0x3426fd){return db['FaxAccount'][_0xcdf6('0x65')]()[_0xcdf6('0x34')](respondWithResult(_0x3426fd,null))[_0xcdf6('0x28')](handleError(_0x3426fd,null));};exports['addDisposition']=function(_0x2dd6fa,_0x207444,_0x415aa5){if(_0x2dd6fa[_0xcdf6('0x5c')]['id']){delete _0x2dd6fa['body']['id'];}return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x2dd6fa['params']['id']}})['then'](handleEntityNotFound(_0x207444,null))[_0xcdf6('0x34')](function(_0x20f81b){if(_0x20f81b){_0x2dd6fa[_0xcdf6('0x5c')][_0xcdf6('0x66')]=_0x20f81b['id'];return db['Disposition'][_0xcdf6('0x5b')](_0x2dd6fa['body']);}})['then'](respondWithResult(_0x207444,null))[_0xcdf6('0x28')](handleError(_0x207444,null));};exports[_0xcdf6('0x67')]=function(_0x4b2405,_0x5da3fb,_0x567804){var _0x81a65c={'raw':![],'where':{}};var _0x516025={};var _0x19ef1a={'count':0x0,'rows':[]};return db[_0xcdf6('0x3f')][_0xcdf6('0x68')]({'where':{'id':_0x4b2405[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x5da3fb,null))[_0xcdf6('0x34')](function(_0x10300a){if(_0x10300a){_0x516025['model']=_[_0xcdf6('0x58')](db['Disposition'][_0xcdf6('0x40')]);_0x516025['query']=_[_0xcdf6('0x58')](_0x4b2405[_0xcdf6('0x45')]);_0x516025[_0xcdf6('0x46')]=_[_0xcdf6('0x47')](_0x516025[_0xcdf6('0x44')],_0x516025[_0xcdf6('0x45')]);_0x81a65c[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x516025[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x4b2405[_0xcdf6('0x45')][_0xcdf6('0x49')]));_0x81a65c[_0xcdf6('0x48')]=_0x81a65c['attributes'][_0xcdf6('0x4a')]?_0x81a65c[_0xcdf6('0x48')]:_0x516025[_0xcdf6('0x44')];if(!_0x4b2405[_0xcdf6('0x45')]['hasOwnProperty'](_0xcdf6('0x4c'))){_0x81a65c[_0xcdf6('0x2e')]=qs[_0xcdf6('0x2e')](_0x4b2405['query'][_0xcdf6('0x2e')]);_0x81a65c[_0xcdf6('0x2d')]=qs['offset'](_0x4b2405[_0xcdf6('0x45')]['offset']);}_0x81a65c[_0xcdf6('0x4d')]=qs['sort'](_0x4b2405[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x81a65c[_0xcdf6('0x4f')]=qs['filters'](_[_0xcdf6('0x69')](_0x4b2405['query'],_0x516025[_0xcdf6('0x46')]));_0x81a65c[_0xcdf6('0x4f')]['FaxAccountId']=_0x10300a['id'];if(_0x4b2405[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x81a65c[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x81a65c['where'],{'$or':_[_0xcdf6('0x3e')](_0x81a65c[_0xcdf6('0x48')],function(_0x4ab991){var _0x859ead={};_0x859ead[_0x4ab991]={'$like':'%'+_0x4b2405[_0xcdf6('0x45')][_0xcdf6('0x50')]+'%'};return _0x859ead;})});}_0x81a65c=_[_0xcdf6('0x51')]({},_0x81a65c,_0x4b2405[_0xcdf6('0x59')]);return db[_0xcdf6('0x6a')][_0xcdf6('0x2c')]({'where':_0x81a65c[_0xcdf6('0x4f')]})['then'](function(_0x312558){_0x19ef1a[_0xcdf6('0x2c')]=_0x312558;if(_0x4b2405['query']['includeAll']){_0x81a65c['include']=[{'all':!![]}];}return db[_0xcdf6('0x6a')][_0xcdf6('0x55')](_0x81a65c);})[_0xcdf6('0x34')](function(_0x4314ac){_0x19ef1a[_0xcdf6('0x56')]=_0x4314ac;return _0x19ef1a;});}})['then'](respondWithFilteredResult(_0x5da3fb,_0x81a65c))[_0xcdf6('0x28')](handleError(_0x5da3fb,null));};exports[_0xcdf6('0x6b')]=function(_0x4a34fa,_0x286ef2,_0x71b14a){return db['FaxAccount'][_0xcdf6('0x5a')]({'where':{'id':_0x4a34fa['params']['id']}})['then'](handleEntityNotFound(_0x286ef2,null))['then'](function(_0xb88a3b){if(_0xb88a3b){return _0xb88a3b[_0xcdf6('0x6b')](_0x4a34fa[_0xcdf6('0x45')][_0xcdf6('0x6c')]);}})['then'](respondWithStatusCode(_0x286ef2,null))['catch'](handleError(_0x286ef2,null));};exports[_0xcdf6('0x6d')]=function(_0x19ec46,_0x43a916,_0x3777e9){if(_0x19ec46['body']['id']){delete _0x19ec46[_0xcdf6('0x5c')]['id'];}return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x19ec46[_0xcdf6('0x62')]['id']}})['then'](handleEntityNotFound(_0x43a916,null))['then'](function(_0x5adb0f){if(_0x5adb0f){_0x19ec46[_0xcdf6('0x5c')][_0xcdf6('0x66')]=_0x5adb0f['id'];return db[_0xcdf6('0x6e')][_0xcdf6('0x5b')](_0x19ec46[_0xcdf6('0x5c')]);}})['then'](respondWithResult(_0x43a916,null))[_0xcdf6('0x28')](handleError(_0x43a916,null));};exports[_0xcdf6('0x6f')]=function(_0x4674f5,_0x4fad88,_0x25aa18){var _0x1aaff4={'raw':![],'where':{}};var _0x315e17={};var _0x450ce3={'count':0x0,'rows':[]};return db[_0xcdf6('0x3f')]['findOne']({'where':{'id':_0x4674f5[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x4fad88,null))[_0xcdf6('0x34')](function(_0x38e396){if(_0x38e396){_0x315e17[_0xcdf6('0x44')]=_[_0xcdf6('0x58')](db[_0xcdf6('0x6e')][_0xcdf6('0x40')]);_0x315e17[_0xcdf6('0x45')]=_[_0xcdf6('0x58')](_0x4674f5[_0xcdf6('0x45')]);_0x315e17[_0xcdf6('0x46')]=_[_0xcdf6('0x47')](_0x315e17[_0xcdf6('0x44')],_0x315e17['query']);_0x1aaff4[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x315e17[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x4674f5[_0xcdf6('0x45')]['fields']));_0x1aaff4['attributes']=_0x1aaff4[_0xcdf6('0x48')][_0xcdf6('0x4a')]?_0x1aaff4[_0xcdf6('0x48')]:_0x315e17[_0xcdf6('0x44')];if(!_0x4674f5[_0xcdf6('0x45')][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x1aaff4['limit']=qs[_0xcdf6('0x2e')](_0x4674f5[_0xcdf6('0x45')][_0xcdf6('0x2e')]);_0x1aaff4[_0xcdf6('0x2d')]=qs[_0xcdf6('0x2d')](_0x4674f5['query']['offset']);}_0x1aaff4[_0xcdf6('0x4d')]=qs[_0xcdf6('0x4e')](_0x4674f5[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x1aaff4[_0xcdf6('0x4f')]=qs[_0xcdf6('0x46')](_[_0xcdf6('0x69')](_0x4674f5[_0xcdf6('0x45')],_0x315e17[_0xcdf6('0x46')]));_0x1aaff4['where'][_0xcdf6('0x66')]=_0x38e396['id'];if(_0x4674f5[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x1aaff4[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x1aaff4['where'],{'$or':_[_0xcdf6('0x3e')](_0x1aaff4[_0xcdf6('0x48')],function(_0x1059c9){var _0x4b580d={};_0x4b580d[_0x1059c9]={'$like':'%'+_0x4674f5['query'][_0xcdf6('0x50')]+'%'};return _0x4b580d;})});}_0x1aaff4=_[_0xcdf6('0x51')]({},_0x1aaff4,_0x4674f5[_0xcdf6('0x59')]);return db['CannedAnswer'][_0xcdf6('0x2c')]({'where':_0x1aaff4[_0xcdf6('0x4f')]})[_0xcdf6('0x34')](function(_0x52781a){_0x450ce3[_0xcdf6('0x2c')]=_0x52781a;if(_0x4674f5['query'][_0xcdf6('0x53')]){_0x1aaff4[_0xcdf6('0x54')]=[{'all':!![]}];}return db[_0xcdf6('0x6e')]['findAll'](_0x1aaff4);})[_0xcdf6('0x34')](function(_0x5c2899){_0x450ce3[_0xcdf6('0x56')]=_0x5c2899;return _0x450ce3;});}})[_0xcdf6('0x34')](respondWithFilteredResult(_0x4fad88,_0x1aaff4))[_0xcdf6('0x28')](handleError(_0x4fad88,null));};exports[_0xcdf6('0x70')]=function(_0x1a7ade,_0x10df53,_0x388fcc){return db['FaxAccount'][_0xcdf6('0x5a')]({'where':{'id':_0x1a7ade[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x10df53,null))['then'](function(_0x12bb0a){if(_0x12bb0a){return _0x12bb0a[_0xcdf6('0x70')](_0x1a7ade[_0xcdf6('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x10df53,null))[_0xcdf6('0x28')](handleError(_0x10df53,null));};exports[_0xcdf6('0x71')]=function(_0x4ce368,_0x15c5f1,_0x2d1bc1){return db['FaxInteraction'][_0xcdf6('0x5a')]({'where':{'id':_0x4ce368[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x15c5f1,null))[_0xcdf6('0x34')](function(_0x1180e4){if(_0x1180e4){return _0x1180e4[_0xcdf6('0x71')](_0x4ce368[_0xcdf6('0x5c')][_0xcdf6('0x6c')],_[_0xcdf6('0x72')](_0x4ce368[_0xcdf6('0x5c')],[_0xcdf6('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x15c5f1,null))['catch'](handleError(_0x15c5f1,null));};exports[_0xcdf6('0x73')]=function(_0xbb10d3,_0x3c1a32,_0x19a59f){var _0x2dba65={'raw':![],'where':{}};var _0x3ba199={};var _0x563306={'count':0x0,'rows':[]};return db[_0xcdf6('0x3f')][_0xcdf6('0x68')]({'where':{'id':_0xbb10d3[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x3c1a32,null))[_0xcdf6('0x34')](function(_0xd3b325){if(_0xd3b325){_0x3ba199[_0xcdf6('0x44')]=_[_0xcdf6('0x58')](db[_0xcdf6('0x74')][_0xcdf6('0x40')]);_0x3ba199[_0xcdf6('0x45')]=_[_0xcdf6('0x58')](_0xbb10d3['query']);_0x3ba199[_0xcdf6('0x46')]=_['intersection'](_0x3ba199[_0xcdf6('0x44')],_0x3ba199[_0xcdf6('0x45')]);_0x2dba65['attributes']=_[_0xcdf6('0x47')](_0x3ba199['model'],qs[_0xcdf6('0x49')](_0xbb10d3[_0xcdf6('0x45')]['fields']));_0x2dba65[_0xcdf6('0x48')]=_0x2dba65[_0xcdf6('0x48')][_0xcdf6('0x4a')]?_0x2dba65['attributes']:_0x3ba199[_0xcdf6('0x44')];if(!_0xbb10d3['query'][_0xcdf6('0x4b')]('nolimit')){_0x2dba65[_0xcdf6('0x2e')]=qs['limit'](_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x2e')]);_0x2dba65['offset']=qs[_0xcdf6('0x2d')](_0xbb10d3['query'][_0xcdf6('0x2d')]);}_0x2dba65[_0xcdf6('0x4d')]=qs['sort'](_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x2dba65['where']=qs[_0xcdf6('0x46')](_[_0xcdf6('0x69')](_0xbb10d3[_0xcdf6('0x45')],_0x3ba199[_0xcdf6('0x46')]));_0x2dba65[_0xcdf6('0x4f')]['FaxAccountId']=_0xd3b325['id'];if(_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x2dba65[_0xcdf6('0x4f')]=_['merge'](_0x2dba65[_0xcdf6('0x4f')],{'$or':_[_0xcdf6('0x3e')](_0x2dba65[_0xcdf6('0x48')],function(_0x150abe){var _0x34b9db={};_0x34b9db[_0x150abe]={'$like':'%'+_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x50')]+'%'};return _0x34b9db;})});}_0x2dba65=_[_0xcdf6('0x51')]({},_0x2dba65,_0xbb10d3[_0xcdf6('0x59')]);return db['FaxInteraction'][_0xcdf6('0x2c')]({'where':_0x2dba65[_0xcdf6('0x4f')]})[_0xcdf6('0x34')](function(_0x27e62e){_0x563306[_0xcdf6('0x2c')]=_0x27e62e;if(_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x53')]){_0x2dba65[_0xcdf6('0x54')]=[{'model':db[_0xcdf6('0x75')],'as':_0xcdf6('0x76'),'required':![]},{'model':db[_0xcdf6('0x77')],'as':_0xcdf6('0x78'),'attributes':['name',_0xcdf6('0x79'),_0xcdf6('0x7a')],'required':![]},{'model':db[_0xcdf6('0x7b')],'as':_0xcdf6('0x7c'),'attributes':['id',_0xcdf6('0x3a'),_0xcdf6('0x7d')],'where':_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x7e')]?{'id':_0xbb10d3[_0xcdf6('0x45')]['tag']}:undefined,'required':_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x7e')]?!![]:![]}];}return db[_0xcdf6('0x74')][_0xcdf6('0x55')](_0x2dba65);})[_0xcdf6('0x34')](function(_0x3c8475){_0x563306[_0xcdf6('0x56')]=_0x3c8475;return _0x563306;});}})[_0xcdf6('0x34')](respondWithFilteredResult(_0x3c1a32,_0x2dba65))[_0xcdf6('0x28')](handleError(_0x3c1a32,null));};exports[_0xcdf6('0x7f')]=function(_0x7cadee,_0x21a21f,_0x288f74){return db[_0xcdf6('0x3f')][_0xcdf6('0x68')]({'where':{'id':_0x7cadee[_0xcdf6('0x62')]['id']}})['then'](handleEntityNotFound(_0x21a21f,null))['then'](function(_0xb1e1d4){if(_0xb1e1d4){return db[_0xcdf6('0x80')][_0xcdf6('0x81')](function(_0x4d5a43){return db[_0xcdf6('0x82')][_0xcdf6('0x64')]({'where':{'FaxAccountId':_0x7cadee['params']['id']},'transaction':_0x4d5a43})[_0xcdf6('0x34')](function(_0x55e154){var _0x52478d=_['map'](_0x7cadee['body'],function(_0x3dc8dc){_0x3dc8dc['FaxAccountId']=_0x7cadee[_0xcdf6('0x62')]['id'];return _0x3dc8dc;});return db[_0xcdf6('0x82')][_0xcdf6('0x83')](_0x52478d,{'transaction':_0x4d5a43});});})[_0xcdf6('0x34')](function(){return db[_0xcdf6('0x82')][_0xcdf6('0x84')]({'where':{'FaxAccountId':_0x7cadee[_0xcdf6('0x62')]['id']},'order':_0xcdf6('0x85')});});}})['then'](respondWithResult(_0x21a21f,null))[_0xcdf6('0x28')](handleError(_0x21a21f,null));};exports['getApplications']=function(_0x2780aa,_0x3d2462,_0x40df52){var _0x2ce7fc={};var _0x1cca2d={};var _0x513266;var _0x26f7e0;return db[_0xcdf6('0x3f')]['findOne']({'where':{'id':_0x2780aa['params']['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x3d2462,null))['then'](function(_0x6fe587){if(_0x6fe587){_0x513266=_0x6fe587;_0x1cca2d[_0xcdf6('0x44')]=_[_0xcdf6('0x58')](db[_0xcdf6('0x82')][_0xcdf6('0x40')]);_0x1cca2d['query']=_[_0xcdf6('0x58')](_0x2780aa[_0xcdf6('0x45')]);_0x1cca2d[_0xcdf6('0x46')]=_[_0xcdf6('0x47')](_0x1cca2d[_0xcdf6('0x44')],_0x1cca2d[_0xcdf6('0x45')]);_0x2ce7fc['attributes']=_[_0xcdf6('0x47')](_0x1cca2d['model'],qs['fields'](_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x49')]));_0x2ce7fc[_0xcdf6('0x48')]=_0x2ce7fc[_0xcdf6('0x48')]['length']?_0x2ce7fc[_0xcdf6('0x48')]:_0x1cca2d[_0xcdf6('0x44')];_0x2ce7fc['order']=qs[_0xcdf6('0x4e')](_0x2780aa['query'][_0xcdf6('0x4e')]);_0x2ce7fc[_0xcdf6('0x4f')]=qs['filters'](_['pick'](_0x2780aa[_0xcdf6('0x45')],_0x1cca2d[_0xcdf6('0x46')]));if(_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x2ce7fc[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x2ce7fc[_0xcdf6('0x4f')],{'$or':_[_0xcdf6('0x3e')](_0x2ce7fc['attributes'],function(_0x296023){var _0x4e89f3={};_0x4e89f3[_0x296023]={'$like':'%'+_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x50')]+'%'};return _0x4e89f3;})});}_0x2ce7fc=_[_0xcdf6('0x51')]({},_0x2ce7fc,_0x2780aa[_0xcdf6('0x59')]);return _0x513266[_0xcdf6('0x86')](_0x2ce7fc);}})[_0xcdf6('0x34')](function(_0x3b2255){if(_0x3b2255){_0x26f7e0=_0x3b2255[_0xcdf6('0x4a')];if(!_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x2ce7fc[_0xcdf6('0x2e')]=qs[_0xcdf6('0x2e')](_0x2780aa['query'][_0xcdf6('0x2e')]);_0x2ce7fc[_0xcdf6('0x2d')]=qs[_0xcdf6('0x2d')](_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x2d')]);}return _0x513266[_0xcdf6('0x86')](_0x2ce7fc);}})[_0xcdf6('0x34')](function(_0x1af77f){if(_0x1af77f){return _0x1af77f?{'count':_0x26f7e0,'rows':_0x1af77f}:null;}})[_0xcdf6('0x34')](respondWithResult(_0x3d2462,null))[_0xcdf6('0x28')](handleError(_0x3d2462,null));};function Extension(_0x211519,_0x1922f5,_0x4d50f4,_0x414f3f){this[_0xcdf6('0x87')]=_0xcdf6('0x88');this[_0xcdf6('0x89')]=_0x211519[_0xcdf6('0x8a')];this['app']=_0x414f3f;this[_0xcdf6('0x42')]='system';this[_0xcdf6('0x8b')]=_0xcdf6('0x8c');this[_0xcdf6('0x66')]=_0x211519['id'];this[_0xcdf6('0x85')]=_0x1922f5;this[_0xcdf6('0x8d')]=_0x4d50f4;}function createExtensionsReciveFax(_0x52156d){var _0x1cdb64=0x1;var _0x179a0a=[];_0x179a0a['push'](new Extension(_0x52156d,_0x1cdb64,'',_0xcdf6('0x8e')));_0x1cdb64+=0x1;_0x179a0a['push'](new Extension(_0x52156d,_0x1cdb64,'CDR(type)=inbound-fax','Set'));_0x1cdb64+=0x1;for(var _0x57f169 in _0x52156d){if(_0x52156d[_0xcdf6('0x4b')](_0x57f169)&&(_0x57f169===_0xcdf6('0x8f')||_0x57f169===_0xcdf6('0x8a')||_0x57f169===_0xcdf6('0x90')||_0x57f169===_0xcdf6('0x91')||_0x57f169===_0xcdf6('0x92')||_0x57f169==='maxrate'||_0x57f169==='minrate'||_0x57f169===_0xcdf6('0x93')||_0x57f169==='t38timeout')){_0x179a0a[_0xcdf6('0x94')](new Extension(_0x52156d,_0x1cdb64,_0xcdf6('0x95')+_0x57f169+')='+_0x52156d[_0x57f169],_0xcdf6('0x96')));_0x1cdb64+=0x1;}}_0x179a0a[_0xcdf6('0x94')](new Extension(_0x52156d,_0x1cdb64,'6',_0xcdf6('0x97')));_0x1cdb64+=0x1;_0x179a0a[_0xcdf6('0x94')](new Extension(_0x52156d,_0x1cdb64,_0xcdf6('0x98'),'ReceiveFax'));_0x1cdb64=0x0;return _0x179a0a;}exports[_0xcdf6('0x99')]=function(_0x8944d,_0x395eeb,_0x345ecd){var _0x316578;return db[_0xcdf6('0x80')]['transaction'](function(_0x34b67c){return db[_0xcdf6('0x3f')][_0xcdf6('0x5b')](_0x8944d['body'],{'transaction':_0x34b67c})[_0xcdf6('0x34')](function(_0x2509fe){_0x316578=_0x2509fe['get']({'plain':!![]});return db[_0xcdf6('0x9a')][_0xcdf6('0x83')](createExtensionsReciveFax(_0x316578),{'transaction':_0x34b67c});});})['then'](function(){return _0x316578;})['then'](respondWithResult(_0x395eeb,null))['catch'](handleError(_0x395eeb,null));};exports[_0xcdf6('0x9b')]=function(_0x927fb,_0x591fe9,_0x156275){var _0x58d434;return db[_0xcdf6('0x80')][_0xcdf6('0x81')](function(_0x1ed2f2){return db[_0xcdf6('0x3f')][_0xcdf6('0x33')](_0x927fb['body'],{'where':{'id':_0x927fb[_0xcdf6('0x5c')]['id']},'transaction':_0x1ed2f2})[_0xcdf6('0x34')](function(_0x5d2e7e){return db[_0xcdf6('0x9a')][_0xcdf6('0x64')]({'where':{'FaxAccountId':_0x927fb[_0xcdf6('0x5c')]['id']},'transaction':_0x1ed2f2})['then'](function(_0x2e24c1){return db[_0xcdf6('0x9a')][_0xcdf6('0x83')](createExtensionsReciveFax(_[_0xcdf6('0x72')](_0x927fb['body'],['tech',_0xcdf6('0x43'),_0xcdf6('0x9c'),_0xcdf6('0x9d'),_0xcdf6('0x9e'),_0xcdf6('0x9f')])),{'transaction':_0x1ed2f2});});});})[_0xcdf6('0x34')](function(){return db[_0xcdf6('0x3f')][_0xcdf6('0xa0')](_0x927fb[_0xcdf6('0x5c')]['id']);})[_0xcdf6('0x34')](respondWithResult(_0x591fe9,null))['catch'](handleError(_0x591fe9,null));};exports[_0xcdf6('0xa1')]=function(_0x4b04fe,_0x17240b,_0x4e70b3){var _0x2b34bf={'raw':!![],'where':{}};var _0x3d3898={};var _0x33e1cb={'count':0x0,'rows':[]};return db[_0xcdf6('0x3f')]['findOne']({'where':{'id':_0x4b04fe['params']['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x17240b,null))[_0xcdf6('0x34')](function(_0x5edad7){if(_0x5edad7){_0x3d3898['model']=_[_0xcdf6('0x58')](db[_0xcdf6('0xa2')][_0xcdf6('0x40')]);_0x3d3898[_0xcdf6('0x45')]=_['keys'](_0x4b04fe[_0xcdf6('0x45')]);_0x3d3898['filters']=_[_0xcdf6('0x47')](_0x3d3898[_0xcdf6('0x44')],_0x3d3898[_0xcdf6('0x45')]);_0x2b34bf[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x3d3898[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x49')]));_0x2b34bf[_0xcdf6('0x48')]=_0x2b34bf[_0xcdf6('0x48')][_0xcdf6('0x4a')]?_0x2b34bf[_0xcdf6('0x48')]:_0x3d3898[_0xcdf6('0x44')];if(!_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x2b34bf[_0xcdf6('0x2e')]=qs[_0xcdf6('0x2e')](_0x4b04fe[_0xcdf6('0x45')]['limit']);_0x2b34bf[_0xcdf6('0x2d')]=qs['offset'](_0x4b04fe['query'][_0xcdf6('0x2d')]);}_0x2b34bf['order']=qs[_0xcdf6('0x4e')](_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x2b34bf[_0xcdf6('0x4f')]=qs[_0xcdf6('0x46')](_['pick'](_0x4b04fe['query'],_0x3d3898[_0xcdf6('0x46')]));_0x2b34bf[_0xcdf6('0x4f')][_0xcdf6('0x66')]=_0x5edad7['id'];if(_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x2b34bf[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x2b34bf['where'],{'$or':_[_0xcdf6('0x3e')](_0x2b34bf[_0xcdf6('0x48')],function(_0x36ee14){var _0x5d2685={};_0x5d2685[_0x36ee14]={'$like':'%'+_0x4b04fe[_0xcdf6('0x45')]['filter']+'%'};return _0x5d2685;})});}if(_0x4b04fe[_0xcdf6('0x45')]['$gte']){var _0x556bfd=_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0xa3')]['split'](',');var _0x39d7f8={};_0x39d7f8[_0x556bfd[0x0]]={'$gte':moment(_0x556bfd[0x1])['format'](_0xcdf6('0xa4'))};_0x2b34bf[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x2b34bf[_0xcdf6('0x4f')],_0x39d7f8);}_0x2b34bf=_[_0xcdf6('0x51')]({},_0x2b34bf,_0x4b04fe['options']);return db['FaxMessage'][_0xcdf6('0x2c')]({'where':_0x2b34bf[_0xcdf6('0x4f')]})[_0xcdf6('0x34')](function(_0x3c9aad){_0x33e1cb[_0xcdf6('0x2c')]=_0x3c9aad;if(_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x53')]){_0x2b34bf['include']=[{'all':!![]}];}return db[_0xcdf6('0xa2')][_0xcdf6('0x55')](_0x2b34bf);})[_0xcdf6('0x34')](function(_0x118292){_0x33e1cb[_0xcdf6('0x56')]=_0x118292;return _0x33e1cb;});}})['then'](respondWithFilteredResult(_0x17240b,_0x2b34bf))['catch'](handleError(_0x17240b,null));};exports[_0xcdf6('0x3b')]=function(_0x289407,_0x5034ec,_0x2ac481){var _0x5e928d,_0x2bcf68={},_0x293c05;if(_0x289407[_0xcdf6('0x5c')]['to']){_0x293c05=_0x289407[_0xcdf6('0x5c')]['to'][0x0];}return db['FaxAccount'][_0xcdf6('0x5a')]({'where':{'id':_0x289407['params']['id']},'include':[{'model':db[_0xcdf6('0xa5')],'as':_0xcdf6('0xa6'),'include':[{'model':db[_0xcdf6('0x75')],'as':_0xcdf6('0xa7'),'where':{'fax':_0x293c05},'limit':0x1,'order':[[_0xcdf6('0x9d'),_0xcdf6('0xa8')]]}]}]})[_0xcdf6('0x34')](handleEntityNotFound(_0x5034ec,null))[_0xcdf6('0x34')](function(_0x154e91){_0x5e928d=_0x154e91;if(_0x289407['body'][_0xcdf6('0xa9')]&&_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][_0xcdf6('0x4a')]){for(var _0x440184=0x0;_0x440184<_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')]['length'];_0x440184+=0x1){_0x289407['body'][_0xcdf6('0xa9')][_0x440184]={'filename':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][_0x440184][_0xcdf6('0x3a')],'id':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][_0x440184]['id'],'path':path[_0xcdf6('0xaa')](config[_0xcdf6('0xab')],_0xcdf6('0xac'),_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][_0x440184][_0xcdf6('0xad')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xcdf6('0xae')](_0x289407['params']['id'])?undefined:_0x289407[_0xcdf6('0x62')]['id'],'path':_['isNil'](_0x289407['body']['attachments'][0x0][_0xcdf6('0x5')])?undefined:_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['path'],'fax':_['isNil'](_0x289407[_0xcdf6('0x5c')]['to'][0x0])?undefined:_0x289407[_0xcdf6('0x5c')]['to'][0x0]},client9002);})[_0xcdf6('0x34')](function(){if(_0x5e928d){if(_[_0xcdf6('0xae')](_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xaf')])){_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xaf')]=util[_0xcdf6('0xb0')](_0xcdf6('0xb1'),_0x5e928d[_0xcdf6('0x3a')],_0x5e928d[_0xcdf6('0xb2')]);}if(_0x5e928d[_0xcdf6('0xa6')]){if(_0x5e928d[_0xcdf6('0xa6')][_0xcdf6('0xa7')]['length']){return _0x5e928d[_0xcdf6('0xa6')][_0xcdf6('0xa7')][0x0];}else{return db[_0xcdf6('0x75')][_0xcdf6('0x5b')](_['defaults'](_0x289407[_0xcdf6('0x5c')],{'firstName':_0x289407[_0xcdf6('0x5c')]['to'][0x0],'phone':_0x289407['body']['to'][0x0],'fax':_0x289407[_0xcdf6('0x5c')]['to'][0x0],'ListId':_0x5e928d[_0xcdf6('0x9f')]}));}}else{throw new Error(_0xcdf6('0xb3'));}}else{throw new Error(_0xcdf6('0xb4'));}})['then'](function(_0x451f15){if(_0x451f15){return db['FaxInteraction']['find']({'where':{'ContactId':_0x451f15['id'],'closed':![],'FaxAccountId':_0x5e928d['id']}})[_0xcdf6('0x34')](function(_0x2926ae){if(_0x2926ae){return[_0x2926ae,![]];}return db[_0xcdf6('0x74')][_0xcdf6('0x5b')]({'UserId':_0x289407['user']['id'],'ContactId':_0x451f15['id'],'FaxAccountId':_0x5e928d['id'],'fax':_0x289407[_0xcdf6('0x5c')]['to'][0x0],'firstMsgDirection':_0xcdf6('0xb5'),'Messages':[_[_0xcdf6('0x51')](_0x289407['body'],{'read':![],'body':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0][_0xcdf6('0xb6')],'FaxAccountId':_0x5e928d['id'],'UserId':_0x289407[_0xcdf6('0x5d')]['id'],'ContactId':_0x451f15['id'],'AttachmentId':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0xcdf6('0x34')](function(_0x373ea1){return[_0x373ea1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x180d2a,_0x2ba15e){if(_0x2ba15e){return _0x180d2a;}return db[_0xcdf6('0xa2')]['create']({'direction':_0xcdf6('0xb5'),'read':![],'body':_0x289407[_0xcdf6('0x5c')]['attachments'][0x0][_0xcdf6('0xb6')],'FaxAccountId':_0x5e928d['id'],'FaxInteractionId':_0x180d2a['id'],'UserId':_0x289407[_0xcdf6('0x5d')]['id'],'ContactId':_0x180d2a[_0xcdf6('0xb7')],'AttachmentId':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['id']})[_0xcdf6('0x34')](function(_0x185d52){_0x180d2a[_0xcdf6('0xb8')]['Messages']=[];_0x180d2a[_0xcdf6('0xb8')][_0xcdf6('0xb9')][_0xcdf6('0x94')](_0x185d52['dataValues']);return _0x180d2a;});})[_0xcdf6('0x34')](function(_0x35aab1){respondWithRpcPromise(_0xcdf6('0xba'),_0xcdf6('0xba'),{'FaxAccountId':_[_0xcdf6('0xae')](_0x289407[_0xcdf6('0x62')]['id'])?undefined:_0x289407[_0xcdf6('0x62')]['id'],'path':_[_0xcdf6('0xae')](_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['path'])?undefined:_0x289407['body']['attachments'][0x0]['path'],'fax':_[_0xcdf6('0xae')](_0x289407[_0xcdf6('0x5c')]['to'][0x0])?undefined:_0x289407['body']['to'][0x0],'AttachmentId':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['id']},client9002)[_0xcdf6('0x34')](function(_0x42c351){logger[_0xcdf6('0x1f')](_0xcdf6('0xbb'),_0x42c351);})['catch'](function(_0x37adbf){logger[_0xcdf6('0x1f')]('SendFaxRpc,\x20%s',_0x37adbf);});return _0x35aab1;})['then'](respondWithResult(_0x5034ec,null))[_0xcdf6('0x28')](handleError(_0x5034ec,null));};exports[_0xcdf6('0xbc')]=function(_0x3ffb3f,_0x5c2ec1,_0x114751){return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x3ffb3f[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x5c2ec1,null))[_0xcdf6('0x34')](function(_0x196a9e){if(_0x196a9e){return _0x196a9e['addAgents'](_0x3ffb3f[_0xcdf6('0x5c')][_0xcdf6('0x6c')],_[_0xcdf6('0x72')](_0x3ffb3f[_0xcdf6('0x5c')],[_0xcdf6('0x6c'),'id'])||{})['spread'](function(_0xf4016c){for(var _0x4b00b1=0x0;_0x4b00b1<_0x3ffb3f[_0xcdf6('0x5c')][_0xcdf6('0x6c')][_0xcdf6('0x4a')];_0x4b00b1+=0x1){socket[_0xcdf6('0xbd')](_0xcdf6('0xbe'),{'UserId':_0x3ffb3f[_0xcdf6('0x5c')]['ids'][_0x4b00b1],'FaxAccountId':_0x3ffb3f[_0xcdf6('0x62')]['id']});}return _0xf4016c;});}})[_0xcdf6('0x34')](respondWithResult(_0x5c2ec1,null))[_0xcdf6('0x28')](handleError(_0x5c2ec1,null));};exports[_0xcdf6('0xbf')]=function(_0x454e90,_0x44ab63,_0x59fef1){return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x454e90[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x44ab63,null))['then'](function(_0x2a2c98){if(_0x2a2c98){return _0x2a2c98[_0xcdf6('0xbf')](_0x454e90['query'][_0xcdf6('0x6c')])[_0xcdf6('0x34')](function(){if(_[_0xcdf6('0xc0')](_0x454e90['query'][_0xcdf6('0x6c')])){for(var _0x558e12=0x0;_0x558e12<_0x454e90[_0xcdf6('0x45')][_0xcdf6('0x6c')][_0xcdf6('0x4a')];_0x558e12+=0x1){socket[_0xcdf6('0xbd')](_0xcdf6('0xc1'),{'UserId':Number(_0x454e90[_0xcdf6('0x45')][_0xcdf6('0x6c')][_0x558e12]),'FaxAccountId':Number(_0x454e90['params']['id'])});}}else{socket[_0xcdf6('0xbd')](_0xcdf6('0xc1'),{'UserId':Number(_0x454e90[_0xcdf6('0x45')][_0xcdf6('0x6c')]),'FaxAccountId':Number(_0x454e90[_0xcdf6('0x62')]['id'])});}});}})[_0xcdf6('0x34')](respondWithStatusCode(_0x44ab63,null))[_0xcdf6('0x28')](handleError(_0x44ab63,null));};exports['getAgents']=function(_0x11b0c9,_0x5635b6,_0x5a4f07){var _0x5e489b={};var _0x40439c={};var _0x5dbef6;var _0x4910f8;return db[_0xcdf6('0x3f')]['findOne']({'where':{'id':_0x11b0c9[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x5635b6,null))['then'](function(_0x34f23c){if(_0x34f23c){_0x5dbef6=_0x34f23c;_0x40439c[_0xcdf6('0x44')]=_[_0xcdf6('0x58')](db[_0xcdf6('0x77')][_0xcdf6('0x40')]);_0x40439c[_0xcdf6('0x45')]=_[_0xcdf6('0x58')](_0x11b0c9[_0xcdf6('0x45')]);_0x40439c[_0xcdf6('0x46')]=_['intersection'](_0x40439c['model'],_0x40439c[_0xcdf6('0x45')]);_0x5e489b[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x40439c['model'],qs[_0xcdf6('0x49')](_0x11b0c9['query'][_0xcdf6('0x49')]));_0x5e489b[_0xcdf6('0x48')]=_0x5e489b[_0xcdf6('0x48')]['length']?_0x5e489b[_0xcdf6('0x48')]:_0x40439c['model'];_0x5e489b[_0xcdf6('0x4d')]=qs['sort'](_0x11b0c9[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x5e489b[_0xcdf6('0x4f')]=qs['filters'](_[_0xcdf6('0x69')](_0x11b0c9[_0xcdf6('0x45')],_0x40439c[_0xcdf6('0x46')]));if(_0x11b0c9[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x5e489b[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x5e489b[_0xcdf6('0x4f')],{'$or':_[_0xcdf6('0x3e')](_0x5e489b[_0xcdf6('0x48')],function(_0x1f12df){var _0x1aeae2={};_0x1aeae2[_0x1f12df]={'$like':'%'+_0x11b0c9[_0xcdf6('0x45')]['filter']+'%'};return _0x1aeae2;})});}_0x5e489b=_[_0xcdf6('0x51')]({},_0x5e489b,_0x11b0c9[_0xcdf6('0x59')]);return _0x5dbef6['getAgents'](_0x5e489b);}})[_0xcdf6('0x34')](function(_0x162318){if(_0x162318){_0x4910f8=_0x162318[_0xcdf6('0x4a')];if(!_0x11b0c9['query'][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x5e489b['limit']=qs['limit'](_0x11b0c9['query'][_0xcdf6('0x2e')]);_0x5e489b[_0xcdf6('0x2d')]=qs[_0xcdf6('0x2d')](_0x11b0c9[_0xcdf6('0x45')][_0xcdf6('0x2d')]);}return _0x5dbef6[_0xcdf6('0xc2')](_0x5e489b);}})['then'](function(_0x4e61ec){if(_0x4e61ec){return _0x4e61ec?{'count':_0x4910f8,'rows':_0x4e61ec}:null;}})['then'](respondWithResult(_0x5635b6,null))[_0xcdf6('0x28')](handleError(_0x5635b6,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ca4f9ad..80d72dd 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 _0x350c=['exports','../../mysqldb','FaxAccount','save','update','emit','hasOwnProperty','hook'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x350c,0x1c1));var _0xc350=function(_0x5ec365,_0x51c23b){_0x5ec365=_0x5ec365-0x0;var _0x5d09a5=_0x350c[_0x5ec365];return _0x5d09a5;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xc350('0x0'))['db'][_0xc350('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc350('0x2'),'afterUpdate':_0xc350('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5349ac){return function(_0x581968,_0x2846bb,_0x4e83b3){FaxAccountEvents['emit'](_0x5349ac+':'+_0x581968['id'],_0x581968);FaxAccountEvents[_0xc350('0x4')](_0x5349ac,_0x581968);_0x4e83b3(null);};}for(var e in events){if(events[_0xc350('0x5')](e)){var event=events[e];FaxAccount[_0xc350('0x6')](e,emitEvent(event));}}module[_0xc350('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x95cd=['events','FaxAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x469665,_0x394876){var _0x291ab5=function(_0x55c1c7){while(--_0x55c1c7){_0x469665['push'](_0x469665['shift']());}};_0x291ab5(++_0x394876);}(_0x95cd,0x87));var _0xd95c=function(_0xb5247b,_0xfdc8ad){_0xb5247b=_0xb5247b-0x0;var _0x4561f9=_0x95cd[_0xb5247b];return _0x4561f9;};'use strict';var EventEmitter=require(_0xd95c('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xd95c('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd95c('0x2')](0x0);var events={'afterCreate':_0xd95c('0x3'),'afterUpdate':'update','afterDestroy':_0xd95c('0x4')};function emitEvent(_0x4acc0a){return function(_0x30b8c4,_0x4f98b4,_0x6aad0b){FaxAccountEvents[_0xd95c('0x5')](_0x4acc0a+':'+_0x30b8c4['id'],_0x30b8c4);FaxAccountEvents[_0xd95c('0x5')](_0x4acc0a,_0x30b8c4);_0x6aad0b(null);};}for(var e in events){if(events[_0xd95c('0x6')](e)){var event=events[e];FaxAccount[_0xd95c('0x7')](e,emitEvent(event));}}module[_0xd95c('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9a93b46..0a2e495 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 _0x0953=['util','../../config/logger','api','moment','request-promise','path','exports','define','fax_accounts'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x0953,0x171));var _0x3095=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x0953[_0xd0cd0b];return _0x59cced;};'use strict';var _=require('lodash');var util=require(_0x3095('0x0'));var logger=require(_0x3095('0x1'))(_0x3095('0x2'));var moment=require(_0x3095('0x3'));var BPromise=require('bluebird');var rp=require(_0x3095('0x4'));var fs=require('fs');var path=require(_0x3095('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x3095('0x6')]=function(_0x132b66,_0x242a0d){return _0x132b66[_0x3095('0x7')]('FaxAccount',attributes,{'tableName':_0x3095('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc7a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3fec7d,_0x24bc43){var _0x483c1a=function(_0x17d2c3){while(--_0x17d2c3){_0x3fec7d['push'](_0x3fec7d['shift']());}};_0x483c1a(++_0x24bc43);}(_0xfc7a,0x12d));var _0xafc7=function(_0x1cf7e8,_0x3cea71){_0x1cf7e8=_0x1cf7e8-0x0;var _0x3a9a74=_0xfc7a[_0x1cf7e8];return _0x3a9a74;};'use strict';var _=require(_0xafc7('0x0'));var util=require(_0xafc7('0x1'));var logger=require(_0xafc7('0x2'))(_0xafc7('0x3'));var moment=require(_0xafc7('0x4'));var BPromise=require(_0xafc7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xafc7('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module['exports']=function(_0xf0ce55,_0x4b8377){return _0xf0ce55['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 83f7e13..68aaeac 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 _0xe181=['Contact\x20not\x20found','get','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','list','applications','orderBy','asc','from','create','contact','fax','FaxInteraction'];(function(_0x3c9c2e,_0x1e7d40){var _0x269196=function(_0x1cb3c7){while(--_0x1cb3c7){_0x3c9c2e['push'](_0x3c9c2e['shift']());}};_0x269196(++_0x1e7d40);}(_0xe181,0x68));var _0x1e18=function(_0x19b56f,_0x4cbbd9){_0x19b56f=_0x19b56f-0x0;var _0x1e69f9=_0xe181[_0x19b56f];return _0x1e69f9;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var moment=require(_0x1e18('0x1'));var BPromise=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var fs=require('fs');var Redis=require(_0x1e18('0x4'));var db=require(_0x1e18('0x5'))['db'];var utils=require(_0x1e18('0x6'));var logger=require(_0x1e18('0x7'))('rpc');var config=require(_0x1e18('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e18('0x9')]({'port':0x232c});config[_0x1e18('0xa')]=_[_0x1e18('0xb')](config[_0x1e18('0xa')],{'host':_0x1e18('0xc'),'port':0x18eb});var socket=require(_0x1e18('0xd'))(new Redis(config['redis']));require(_0x1e18('0xe'))[_0x1e18('0xf')](socket);function respondWithRpcPromise(_0x40e5e9,_0x363da4,_0x19d0bc){return new BPromise(function(_0x56ad80,_0x56f13a){return client[_0x1e18('0x10')](_0x40e5e9,_0x19d0bc)[_0x1e18('0x11')](function(_0xa3eecd){logger[_0x1e18('0x12')](_0x1e18('0x13'),_0x363da4,_0x1e18('0x14'));logger[_0x1e18('0x15')](_0x1e18('0x16'),_0x363da4,'request\x20sent',JSON[_0x1e18('0x17')](_0xa3eecd));if(_0xa3eecd['error']){if(_0xa3eecd[_0x1e18('0x18')]['code']===0x1f4){logger[_0x1e18('0x18')](_0x1e18('0x13'),_0x363da4,_0xa3eecd[_0x1e18('0x18')][_0x1e18('0x19')]);return _0x56f13a(_0xa3eecd[_0x1e18('0x18')][_0x1e18('0x19')]);}logger[_0x1e18('0x18')](_0x1e18('0x13'),_0x363da4,_0xa3eecd[_0x1e18('0x18')][_0x1e18('0x19')]);return _0x56ad80(_0xa3eecd[_0x1e18('0x18')][_0x1e18('0x19')]);}else{logger[_0x1e18('0x12')](_0x1e18('0x13'),_0x363da4,_0x1e18('0x14'));_0x56ad80(_0xa3eecd['result'][_0x1e18('0x19')]);}})[_0x1e18('0x1a')](function(_0xea095a){logger[_0x1e18('0x18')](_0x1e18('0x13'),_0x363da4,_0xea095a);_0x56f13a(_0xea095a);});});}exports[_0x1e18('0x1b')]=function(_0x3a6229){var _0x22fada=this;return new Promise(function(_0x2e849d,_0x22baca){return db[_0x1e18('0x1c')][_0x1e18('0x1d')]({'raw':_0x3a6229[_0x1e18('0x1e')]?_0x3a6229[_0x1e18('0x1e')][_0x1e18('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a6229[_0x1e18('0x1e')]?_0x3a6229[_0x1e18('0x1e')]['where']||null:null,'attributes':_0x3a6229[_0x1e18('0x1e')]?_0x3a6229[_0x1e18('0x1e')][_0x1e18('0x20')]||null:null,'limit':_0x3a6229['options']?_0x3a6229[_0x1e18('0x1e')][_0x1e18('0x21')]||null:null,'include':_0x3a6229[_0x1e18('0x1e')]?_0x3a6229[_0x1e18('0x1e')]['include']?_['map'](_0x3a6229[_0x1e18('0x1e')]['include'],function(_0x5bb03c){return{'model':db[_0x5bb03c['model']],'as':_0x5bb03c['as'],'attributes':_0x5bb03c[_0x1e18('0x20')],'include':_0x5bb03c[_0x1e18('0x22')]?_[_0x1e18('0x23')](_0x5bb03c[_0x1e18('0x22')],function(_0x3a95c1){return{'model':db[_0x3a95c1[_0x1e18('0x24')]],'as':_0x3a95c1['as'],'attributes':_0x3a95c1[_0x1e18('0x20')],'include':_0x3a95c1[_0x1e18('0x22')]?_[_0x1e18('0x23')](_0x3a95c1[_0x1e18('0x22')],function(_0x1015a3){return{'model':db[_0x1015a3[_0x1e18('0x24')]],'as':_0x1015a3['as'],'attributes':_0x1015a3[_0x1e18('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1e18('0x11')](function(_0x558d01){logger[_0x1e18('0x12')]('GetFaxAccount',_0x3a6229);logger[_0x1e18('0x15')](_0x1e18('0x1b'),_0x3a6229,JSON[_0x1e18('0x17')](_0x558d01));_0x2e849d(_0x558d01);})[_0x1e18('0x1a')](function(_0x2828dc){logger[_0x1e18('0x18')](_0x1e18('0x1b'),_0x2828dc[_0x1e18('0x19')],_0x3a6229);_0x22baca(_0x22fada['error'](0x1f4,_0x2828dc[_0x1e18('0x19')]));});});};exports[_0x1e18('0x25')]=function(_0x5d4df9,_0xd83059,_0x29a6c8){var _0x415d7b=this;return new Promise(function(_0x4cf595,_0x40fd04){var _0x5597ab={'body':_0x5d4df9['body'],'channel':'fax'};var _0xa4fe9e=[];var _0x48b89f=[];var _0x2a1fd1={};return db[_0x1e18('0x26')][_0x1e18('0x27')]()['then'](function(_0x4a569d){if(!_0x4a569d){throw new db[(_0x1e18('0x28'))][(_0x1e18('0x29'))](_0x1e18('0x2a'));}_0xa4fe9e=_[_0x1e18('0x2b')](_[_0x1e18('0x2c')](_0x4a569d),[_0x1e18('0x2d'),_0x1e18('0x2e')]);_0x48b89f=_[_0x1e18('0x2b')](_[_0x1e18('0x2c')](_0x4a569d),[_0x1e18('0x2d'),_0x1e18('0x2e'),_0x1e18('0x2f'),'ListId']);if(_0x5d4df9['body']['id']){delete _0x5d4df9[_0x1e18('0x30')]['id'];}if(_[_0x1e18('0x31')](_0x5d4df9[_0x1e18('0x30')]['from'])){throw new db[(_0x1e18('0x28'))]['ValidationError'](_0x1e18('0x32'));}if(_['isNil'](_0x5d4df9['body'][_0x1e18('0x30')])||_0x5d4df9[_0x1e18('0x30')][_0x1e18('0x30')]===''){throw new db[(_0x1e18('0x28'))][(_0x1e18('0x29'))](_0x1e18('0x33'));}if(_['isNil'](_0x5d4df9[_0x1e18('0x30')][_0x1e18('0x34')])){throw new db[(_0x1e18('0x28'))][(_0x1e18('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x48b89f);}if(!_[_0x1e18('0x35')](_0x48b89f,_0x5d4df9['body'][_0x1e18('0x34')])){throw new db[(_0x1e18('0x28'))]['ValidationError'](_0x1e18('0x36')+_0x48b89f);}_0x2a1fd1[_0x5d4df9[_0x1e18('0x30')]['mapKey']]=_0x5d4df9['body']['from'];})[_0x1e18('0x11')](function(){return db[_0x1e18('0x1c')][_0x1e18('0x37')]({'where':{'id':_0x5d4df9[_0x1e18('0x38')]['id']},'include':[{'model':db[_0x1e18('0x39')],'as':_0x1e18('0x3a'),'include':[{'model':db[_0x1e18('0x26')],'as':_0x1e18('0x3b'),'where':_0x2a1fd1,'limit':0x1,'order':[[_0x1e18('0x2e'),_0x1e18('0x3c')]]}]},{'model':db[_0x1e18('0x3d')],'as':'Applications'}]});})[_0x1e18('0x11')](function(_0x5cc2e5){if(_0x5cc2e5&&_0x5cc2e5[_0x1e18('0x3a')]){var _0xcb599a=_0x5cc2e5['get']({'plain':!![]});_0x5597ab['account']=_0xcb599a;_0x5597ab['applications']=_0xcb599a[_0x1e18('0x3e')];_0x5597ab[_0x1e18('0x3f')]=_0xcb599a['List'];_0x5597ab[_0x1e18('0x40')]=_[_0x1e18('0x41')](_0x5597ab['applications'],['priority'],[_0x1e18('0x42')]);if(_0x5597ab[_0x1e18('0x38')][_0x1e18('0x3e')]){delete _0x5597ab[_0x1e18('0x38')][_0x1e18('0x3e')];}if(_0x5597ab[_0x1e18('0x38')][_0x1e18('0x3a')]&&_0x5597ab[_0x1e18('0x38')][_0x1e18('0x3a')][_0x1e18('0x3b')]['length']){return _0x5597ab['account'][_0x1e18('0x3a')][_0x1e18('0x3b')][0x0];}var _0x14baa4=_[_0x1e18('0xb')](_0x5d4df9[_0x1e18('0x30')],{'firstName':_0x5d4df9[_0x1e18('0x30')][_0x1e18('0x43')],'ListId':_0xcb599a['ListId']});_0x14baa4[_0x5d4df9['body']['mapKey']]=_0x5d4df9[_0x1e18('0x30')][_0x1e18('0x43')];return db[_0x1e18('0x26')][_0x1e18('0x44')](_0x14baa4,{'fields':_0xa4fe9e,'raw':!![]});}})[_0x1e18('0x11')](function(_0x214b01){_0x5597ab[_0x1e18('0x45')]=_0x214b01;if(_0x214b01){var _0x190af4={'ContactId':_0x214b01['id'],'FaxAccountId':_0x5d4df9[_0x1e18('0x38')]['id'],'fax':_0x214b01[_0x1e18('0x46')]};return db[_0x1e18('0x47')][_0x1e18('0x37')]({'where':{'ContactId':_0x214b01['id'],'closed':![],'FaxAccountId':_0x5d4df9[_0x1e18('0x38')]['id']}})[_0x1e18('0x11')](function(_0x6b0367){if(_0x6b0367){return[_0x6b0367,![]];}return db[_0x1e18('0x47')][_0x1e18('0x44')](_0x190af4)[_0x1e18('0x11')](function(_0x56e30b){return[_0x56e30b,!![]];});});}else{throw new Error(_0x1e18('0x48'));}})['spread'](function(_0x3e2880,_0x17a8ac){var _0x215aa2=_0x3e2880[_0x1e18('0x49')]({'plain':!![]});if(_0x17a8ac){if(_0x5597ab[_0x1e18('0x38')]['autoclose']){_0x5597ab['applications'][_0x1e18('0x4a')]({'id':0x0,'priority':_0x5597ab[_0x1e18('0x40')]['length']+0x1,'app':_0x1e18('0x4b'),'appdata':_0x1e18('0x4c'),'interval':_0x1e18('0x4d')});}_0x215aa2['created']=!![];}else{_0x215aa2[_0x1e18('0x4e')]=![];}_0x5597ab[_0x1e18('0x4f')]=_0x215aa2;return db[_0x1e18('0x50')][_0x1e18('0x44')]({'body':_0x5d4df9[_0x1e18('0x30')]['body'],'FaxAccountId':_0x5d4df9[_0x1e18('0x38')]['id'],'FaxInteractionId':_0x3e2880['id'],'direction':'in','ContactId':_0x3e2880['ContactId'],'AttachmentId':_0x5d4df9['body'][_0x1e18('0x51')]});})[_0x1e18('0x11')](function(_0x157981){_0x5597ab[_0x1e18('0x19')]=_0x157981;if(_0x5597ab[_0x1e18('0x4f')][_0x1e18('0x52')]){return db['User'][_0x1e18('0x37')]({'attributes':['id',_0x1e18('0x53')],'where':{'id':_0x5597ab[_0x1e18('0x4f')]['UserId']}})[_0x1e18('0x11')](function(_0x939d13){if(_0x939d13){_0x5597ab['applications'][_0x1e18('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x939d13[_0x1e18('0x53')]+','+(_0x5597ab[_0x1e18('0x38')][_0x1e18('0x55')]||0xa),'interval':_0x1e18('0x4d')});}return respondWithRpcPromise(_0x1e18('0x56'),_0x1e18('0x57'),_0x5597ab);});}return respondWithRpcPromise(_0x1e18('0x56'),_0x1e18('0x57'),_0x5597ab);})['then'](function(_0x3ab3b8){_0x4cf595(_0x3ab3b8);})[_0x1e18('0x1a')](function(_0x5a5881){_0x40fd04(_0x415d7b[_0x1e18('0x18')](0x1f4,_0x5a5881['message']));});});}; \ No newline at end of file +var _0x4bc3=['orderBy','Contacts','length','defaults','create','contact','spread','autoclose','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','*,*,*,*','startRouting','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','include','map','model','catch','NotifyFaxAccount','body','fax','CmContact','describe','then','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','find','account','CmList','DESC','FaxApplication','Applications','List','get','applications'];(function(_0x21c991,_0xb2401c){var _0x3f99fa=function(_0x198c53){while(--_0x198c53){_0x21c991['push'](_0x21c991['shift']());}};_0x3f99fa(++_0xb2401c);}(_0x4bc3,0x107));var _0x34bc=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x4bc3[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require(_0x34bc('0x0'));var moment=require(_0x34bc('0x1'));var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require(_0x34bc('0x4'));var db=require(_0x34bc('0x5'))['db'];var utils=require(_0x34bc('0x6'));var logger=require(_0x34bc('0x7'))(_0x34bc('0x8'));var config=require(_0x34bc('0x9'));var jayson=require(_0x34bc('0xa'));var client=jayson['client']['http']({'port':0x232c});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x2afc2c,_0x52fb79,_0x609053){return new BPromise(function(_0x40d800,_0x447339){return client[_0x34bc('0x10')](_0x2afc2c,_0x609053)['then'](function(_0x8fdfc3){logger[_0x34bc('0x11')](_0x34bc('0x12'),_0x52fb79,_0x34bc('0x13'));logger[_0x34bc('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x52fb79,_0x34bc('0x13'),JSON[_0x34bc('0x15')](_0x8fdfc3));if(_0x8fdfc3[_0x34bc('0x16')]){if(_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x17')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x52fb79,_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);return _0x447339(_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);}logger[_0x34bc('0x16')](_0x34bc('0x12'),_0x52fb79,_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);return _0x40d800(_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);}else{logger[_0x34bc('0x11')](_0x34bc('0x12'),_0x52fb79,_0x34bc('0x13'));_0x40d800(_0x8fdfc3['result']['message']);}})['catch'](function(_0x4b537a){logger['error'](_0x34bc('0x12'),_0x52fb79,_0x4b537a);_0x447339(_0x4b537a);});});}exports[_0x34bc('0x19')]=function(_0x27912e){var _0x29425d=this;return new Promise(function(_0x474ee8,_0x2450f0){return db[_0x34bc('0x1a')][_0x34bc('0x1b')]({'raw':_0x27912e[_0x34bc('0x1c')]?_0x27912e[_0x34bc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x27912e[_0x34bc('0x1c')]?_0x27912e['options']['where']||null:null,'attributes':_0x27912e[_0x34bc('0x1c')]?_0x27912e['options'][_0x34bc('0x1d')]||null:null,'limit':_0x27912e['options']?_0x27912e[_0x34bc('0x1c')][_0x34bc('0x1e')]||null:null,'include':_0x27912e[_0x34bc('0x1c')]?_0x27912e[_0x34bc('0x1c')][_0x34bc('0x1f')]?_[_0x34bc('0x20')](_0x27912e['options']['include'],function(_0x42c4f2){return{'model':db[_0x42c4f2[_0x34bc('0x21')]],'as':_0x42c4f2['as'],'attributes':_0x42c4f2['attributes'],'include':_0x42c4f2['include']?_[_0x34bc('0x20')](_0x42c4f2['include'],function(_0x2a1d22){return{'model':db[_0x2a1d22[_0x34bc('0x21')]],'as':_0x2a1d22['as'],'attributes':_0x2a1d22['attributes'],'include':_0x2a1d22[_0x34bc('0x1f')]?_['map'](_0x2a1d22['include'],function(_0x1545ca){return{'model':db[_0x1545ca[_0x34bc('0x21')]],'as':_0x1545ca['as'],'attributes':_0x1545ca[_0x34bc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdc37d9){logger[_0x34bc('0x11')](_0x34bc('0x19'),_0x27912e);logger[_0x34bc('0x14')](_0x34bc('0x19'),_0x27912e,JSON[_0x34bc('0x15')](_0xdc37d9));_0x474ee8(_0xdc37d9);})[_0x34bc('0x22')](function(_0x3544b2){logger[_0x34bc('0x16')]('GetFaxAccount',_0x3544b2[_0x34bc('0x18')],_0x27912e);_0x2450f0(_0x29425d[_0x34bc('0x16')](0x1f4,_0x3544b2['message']));});});};exports[_0x34bc('0x23')]=function(_0x1f5fa6,_0x2c48ea,_0x5aa528){var _0x3ee096=this;return new Promise(function(_0x146ff3,_0x28f948){var _0x498ad4={'body':_0x1f5fa6[_0x34bc('0x24')],'channel':_0x34bc('0x25')};var _0x1dfcc4=[];var _0x2b7e52=[];var _0x2a37dc={};return db[_0x34bc('0x26')][_0x34bc('0x27')]()[_0x34bc('0x28')](function(_0x5d9ba5){if(!_0x5d9ba5){throw new db[(_0x34bc('0x29'))][(_0x34bc('0x2a'))]('no\x20available\x20attributes');}_0x1dfcc4=_[_0x34bc('0x2b')](_[_0x34bc('0x2c')](_0x5d9ba5),[_0x34bc('0x2d'),_0x34bc('0x2e')]);_0x2b7e52=_[_0x34bc('0x2b')](_[_0x34bc('0x2c')](_0x5d9ba5),[_0x34bc('0x2d'),'updatedAt','CompanyId',_0x34bc('0x2f')]);if(_0x1f5fa6[_0x34bc('0x24')]['id']){delete _0x1f5fa6['body']['id'];}if(_['isNil'](_0x1f5fa6[_0x34bc('0x24')]['from'])){throw new db[(_0x34bc('0x29'))][(_0x34bc('0x2a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x24')])||_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x24')]===''){throw new db['Sequelize'][(_0x34bc('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')])){throw new db['Sequelize'][(_0x34bc('0x2a'))](_0x34bc('0x31')+_0x2b7e52);}if(!_[_0x34bc('0x32')](_0x2b7e52,_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b7e52);}_0x2a37dc[_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')]]=_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x33')];})['then'](function(){return db[_0x34bc('0x1a')][_0x34bc('0x34')]({'where':{'id':_0x1f5fa6[_0x34bc('0x35')]['id']},'include':[{'model':db[_0x34bc('0x36')],'as':'List','include':[{'model':db[_0x34bc('0x26')],'as':'Contacts','where':_0x2a37dc,'limit':0x1,'order':[['updatedAt',_0x34bc('0x37')]]}]},{'model':db[_0x34bc('0x38')],'as':_0x34bc('0x39')}]});})['then'](function(_0x22b6fd){if(_0x22b6fd&&_0x22b6fd[_0x34bc('0x3a')]){var _0x4307c2=_0x22b6fd[_0x34bc('0x3b')]({'plain':!![]});_0x498ad4['account']=_0x4307c2;_0x498ad4[_0x34bc('0x3c')]=_0x4307c2['Applications'];_0x498ad4['list']=_0x4307c2[_0x34bc('0x3a')];_0x498ad4[_0x34bc('0x3c')]=_[_0x34bc('0x3d')](_0x498ad4[_0x34bc('0x3c')],['priority'],['asc']);if(_0x498ad4[_0x34bc('0x35')][_0x34bc('0x39')]){delete _0x498ad4[_0x34bc('0x35')][_0x34bc('0x39')];}if(_0x498ad4[_0x34bc('0x35')][_0x34bc('0x3a')]&&_0x498ad4[_0x34bc('0x35')][_0x34bc('0x3a')][_0x34bc('0x3e')][_0x34bc('0x3f')]){return _0x498ad4[_0x34bc('0x35')]['List']['Contacts'][0x0];}var _0x74c65b=_[_0x34bc('0x40')](_0x1f5fa6[_0x34bc('0x24')],{'firstName':_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x33')],'ListId':_0x4307c2[_0x34bc('0x2f')]});_0x74c65b[_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')]]=_0x1f5fa6[_0x34bc('0x24')]['from'];return db['CmContact'][_0x34bc('0x41')](_0x74c65b,{'fields':_0x1dfcc4,'raw':!![]});}})[_0x34bc('0x28')](function(_0x22b818){_0x498ad4[_0x34bc('0x42')]=_0x22b818;if(_0x22b818){var _0x2979d0={'ContactId':_0x22b818['id'],'FaxAccountId':_0x1f5fa6[_0x34bc('0x35')]['id'],'fax':_0x22b818[_0x34bc('0x25')]};return db['FaxInteraction'][_0x34bc('0x34')]({'where':{'ContactId':_0x22b818['id'],'closed':![],'FaxAccountId':_0x1f5fa6[_0x34bc('0x35')]['id']}})['then'](function(_0x1ed46e){if(_0x1ed46e){return[_0x1ed46e,![]];}return db['FaxInteraction']['create'](_0x2979d0)[_0x34bc('0x28')](function(_0x243e64){return[_0x243e64,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x34bc('0x43')](function(_0x521474,_0x85c0e){var _0x5d9ec2=_0x521474[_0x34bc('0x3b')]({'plain':!![]});if(_0x85c0e){if(_0x498ad4[_0x34bc('0x35')][_0x34bc('0x44')]){_0x498ad4['applications']['push']({'id':0x0,'priority':_0x498ad4[_0x34bc('0x3c')][_0x34bc('0x3f')]+0x1,'app':_0x34bc('0x45'),'appdata':_0x34bc('0x46'),'interval':'*,*,*,*'});}_0x5d9ec2[_0x34bc('0x47')]=!![];}else{_0x5d9ec2[_0x34bc('0x47')]=![];}_0x498ad4[_0x34bc('0x48')]=_0x5d9ec2;return db[_0x34bc('0x49')][_0x34bc('0x41')]({'body':_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x24')],'FaxAccountId':_0x1f5fa6[_0x34bc('0x35')]['id'],'FaxInteractionId':_0x521474['id'],'direction':'in','ContactId':_0x521474[_0x34bc('0x4a')],'AttachmentId':_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x4b')]});})['then'](function(_0x32bff4){_0x498ad4[_0x34bc('0x18')]=_0x32bff4;if(_0x498ad4['interaction']['UserId']){return db[_0x34bc('0x4c')]['find']({'attributes':['id',_0x34bc('0x4d')],'where':{'id':_0x498ad4['interaction']['UserId']}})['then'](function(_0x5e1aaa){if(_0x5e1aaa){_0x498ad4[_0x34bc('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5e1aaa[_0x34bc('0x4d')]+','+(_0x498ad4[_0x34bc('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0x34bc('0x4e')});}return respondWithRpcPromise('Start',_0x34bc('0x4f'),_0x498ad4);});}return respondWithRpcPromise(_0x34bc('0x50'),_0x34bc('0x4f'),_0x498ad4);})[_0x34bc('0x28')](function(_0x1f803a){_0x146ff3(_0x1f803a);})[_0x34bc('0x22')](function(_0x7226da){_0x28f948(_0x3ee096[_0x34bc('0x16')](0x1f4,_0x7226da[_0x34bc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 97ffbda..d91e480 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 _0x524e=['remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x7e021d,_0x3da738){var _0x3315bb=function(_0x3ae8ff){while(--_0x3ae8ff){_0x7e021d['push'](_0x7e021d['shift']());}};_0x3315bb(++_0x3da738);}(_0x524e,0x15e));var _0xe524=function(_0x4d4d72,_0x25c086){_0x4d4d72=_0x4d4d72-0x0;var _0xf22826=_0x524e[_0x4d4d72];return _0xf22826;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xe524('0x0'),_0xe524('0x1')];function createListener(_0xc5f6b5,_0x29e619){return function(_0x699159){_0x29e619[_0xe524('0x2')](_0xc5f6b5,_0x699159);};}function removeListener(_0xabd694,_0x32c90b){return function(){FaxAccountEvents[_0xe524('0x3')](_0xabd694,_0x32c90b);};}exports[_0xe524('0x4')]=function(_0x4f75d6){for(var _0xaaeaa9=0x0,_0x41e1a3=events[_0xe524('0x5')];_0xaaeaa9<_0x41e1a3;_0xaaeaa9++){var _0x533c14=events[_0xaaeaa9];var _0x384935=createListener(_0xe524('0x6')+_0x533c14,_0x4f75d6);FaxAccountEvents['on'](_0x533c14,_0x384935);}}; \ No newline at end of file +var _0x81c6=['faxAccount:','save','emit','removeListener','register','length'];(function(_0x552081,_0x5e1773){var _0x30baef=function(_0x1b5aa7){while(--_0x1b5aa7){_0x552081['push'](_0x552081['shift']());}};_0x30baef(++_0x5e1773);}(_0x81c6,0x1d5));var _0x681c=function(_0x279841,_0x4e9e3b){_0x279841=_0x279841-0x0;var _0x4d3a9f=_0x81c6[_0x279841];return _0x4d3a9f;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x681c('0x0'),'remove','update'];function createListener(_0x57f8d2,_0x62d9fc){return function(_0x2d0fc0){_0x62d9fc[_0x681c('0x1')](_0x57f8d2,_0x2d0fc0);};}function removeListener(_0x5566e5,_0x44c18e){return function(){FaxAccountEvents[_0x681c('0x2')](_0x5566e5,_0x44c18e);};}exports[_0x681c('0x3')]=function(_0x1d31c8){for(var _0x4ea522=0x0,_0x45331=events[_0x681c('0x4')];_0x4ea522<_0x45331;_0x4ea522++){var _0x5624d7=events[_0x4ea522];var _0x5b5f22=createListener(_0x681c('0x5')+_0x5624d7,_0x1d31c8);FaxAccountEvents['on'](_0x5624d7,_0x5b5f22);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c75a685..7e9c69f 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 _0x6a69=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addApplications','/updateaccountapplications','updateAccountApplications','addAgents','put','update','delete','removeAnswers','removeAgents','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a69,0x17f));var _0x96a6=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x6a69[_0x3da832];return _0xe602f2;};'use strict';var multer=require(_0x96a6('0x0'));var util=require(_0x96a6('0x1'));var path=require(_0x96a6('0x2'));var timeout=require('connect-timeout');var express=require(_0x96a6('0x3'));var router=express['Router']();var auth=require(_0x96a6('0x4'));var interaction=require(_0x96a6('0x5'));var config=require(_0x96a6('0x6'));var controller=require('./faxAccount.controller');router[_0x96a6('0x7')]('/',auth[_0x96a6('0x8')](),controller[_0x96a6('0x9')]);router[_0x96a6('0x7')]('/describe',auth[_0x96a6('0x8')](),controller[_0x96a6('0xa')]);router[_0x96a6('0x7')](_0x96a6('0xb'),auth[_0x96a6('0x8')](),controller[_0x96a6('0xc')]);router[_0x96a6('0x7')]('/:id/dispositions',auth[_0x96a6('0x8')](),controller['getDispositions']);router[_0x96a6('0x7')](_0x96a6('0xd'),auth[_0x96a6('0x8')](),controller[_0x96a6('0xe')]);router[_0x96a6('0x7')]('/:id/interactions',auth[_0x96a6('0x8')](),controller[_0x96a6('0xf')]);router[_0x96a6('0x7')](_0x96a6('0x10'),auth[_0x96a6('0x8')](),controller[_0x96a6('0x11')]);router[_0x96a6('0x7')](_0x96a6('0x12'),auth[_0x96a6('0x8')](),controller['getMessages']);router[_0x96a6('0x7')](_0x96a6('0x13'),auth[_0x96a6('0x8')](),controller[_0x96a6('0x14')]);router[_0x96a6('0x15')]('/',auth['isAuthenticated'](),controller[_0x96a6('0x16')]);router[_0x96a6('0x15')](_0x96a6('0x17'),auth['isAuthenticated'](),controller[_0x96a6('0x18')]);router[_0x96a6('0x15')](_0x96a6('0xd'),auth[_0x96a6('0x8')](),controller['addAnswer']);router[_0x96a6('0x15')]('/:id/interactions',auth[_0x96a6('0x8')](),controller['addInteraction']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x96a6('0x19')]);router[_0x96a6('0x15')]('/addaccountapplications',auth[_0x96a6('0x8')](),controller['addAccountApplications']);router['post'](_0x96a6('0x1a'),auth[_0x96a6('0x8')](),controller[_0x96a6('0x1b')]);router['post']('/:id/send',auth[_0x96a6('0x8')](),controller['send']);router['post']('/:id/users',auth[_0x96a6('0x8')](),controller[_0x96a6('0x1c')]);router[_0x96a6('0x1d')](_0x96a6('0xb'),auth[_0x96a6('0x8')](),controller[_0x96a6('0x1e')]);router[_0x96a6('0x1f')]('/:id',auth[_0x96a6('0x8')](),controller['destroy']);router[_0x96a6('0x1f')](_0x96a6('0x17'),auth[_0x96a6('0x8')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x96a6('0x8')](),controller[_0x96a6('0x20')]);router[_0x96a6('0x1f')]('/:id/users',auth[_0x96a6('0x8')](),controller[_0x96a6('0x21')]);module[_0x96a6('0x22')]=router; \ No newline at end of file +var _0xd59d=['addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','put','/:id','update','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/describe','describe','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','create','/:id/dispositions','addDisposition','post'];(function(_0x2429ea,_0x963210){var _0x48e231=function(_0x525455){while(--_0x525455){_0x2429ea['push'](_0x2429ea['shift']());}};_0x48e231(++_0x963210);}(_0xd59d,0x176));var _0xdd59=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xd59d[_0x4dcc2d];return _0x1bbd79;};'use strict';var multer=require('multer');var util=require(_0xdd59('0x0'));var path=require(_0xdd59('0x1'));var timeout=require(_0xdd59('0x2'));var express=require(_0xdd59('0x3'));var router=express['Router']();var auth=require(_0xdd59('0x4'));var interaction=require(_0xdd59('0x5'));var config=require(_0xdd59('0x6'));var controller=require(_0xdd59('0x7'));router['get']('/',auth[_0xdd59('0x8')](),controller[_0xdd59('0x9')]);router[_0xdd59('0xa')](_0xdd59('0xb'),auth[_0xdd59('0x8')](),controller[_0xdd59('0xc')]);router[_0xdd59('0xa')]('/:id',auth[_0xdd59('0x8')](),controller['show']);router[_0xdd59('0xa')]('/:id/dispositions',auth[_0xdd59('0x8')](),controller[_0xdd59('0xd')]);router[_0xdd59('0xa')](_0xdd59('0xe'),auth[_0xdd59('0x8')](),controller['getAnswers']);router['get'](_0xdd59('0xf'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x10')]);router[_0xdd59('0xa')](_0xdd59('0x11'),auth[_0xdd59('0x8')](),controller['getApplications']);router[_0xdd59('0xa')](_0xdd59('0x12'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x13')]);router[_0xdd59('0xa')](_0xdd59('0x14'),auth['isAuthenticated'](),controller[_0xdd59('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdd59('0x16')]);router['post'](_0xdd59('0x17'),auth['isAuthenticated'](),controller[_0xdd59('0x18')]);router[_0xdd59('0x19')](_0xdd59('0xe'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x1a')]);router[_0xdd59('0x19')](_0xdd59('0xf'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x1b')]);router[_0xdd59('0x19')](_0xdd59('0x11'),auth[_0xdd59('0x8')](),controller['addApplications']);router['post'](_0xdd59('0x1c'),auth['isAuthenticated'](),controller[_0xdd59('0x1d')]);router['post'](_0xdd59('0x1e'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x1f')]);router[_0xdd59('0x19')]('/:id/send',auth[_0xdd59('0x8')](),controller[_0xdd59('0x20')]);router['post'](_0xdd59('0x14'),auth[_0xdd59('0x8')](),controller['addAgents']);router[_0xdd59('0x21')](_0xdd59('0x22'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x23')]);router[_0xdd59('0x24')](_0xdd59('0x22'),auth[_0xdd59('0x8')](),controller['destroy']);router[_0xdd59('0x24')](_0xdd59('0x17'),auth[_0xdd59('0x8')](),controller['removeDispositions']);router['delete'](_0xdd59('0xe'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x25')]);router['delete'](_0xdd59('0x14'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x26')]);module[_0xdd59('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 0847059..6819ec7 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 _0x9d76=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x567bcb,_0x4978c1){var _0x4eebc2=function(_0x42a456){while(--_0x42a456){_0x567bcb['push'](_0x567bcb['shift']());}};_0x4eebc2(++_0x4978c1);}(_0x9d76,0x76));var _0x69d7=function(_0x19335c,_0x2eeaba){_0x19335c=_0x19335c-0x0;var _0x107875=_0x9d76[_0x19335c];return _0x107875;};'use strict';var Sequelize=require(_0x69d7('0x0'));module['exports']={'priority':{'type':Sequelize[_0x69d7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x69d7('0x2')],'allowNull':![],'defaultValue':_0x69d7('0x3')},'appdata':{'type':Sequelize[_0x69d7('0x4')]()},'description':{'type':Sequelize[_0x69d7('0x2')]},'interval':{'type':Sequelize[_0x69d7('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb8de=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3ed6a8,_0x1b2d2c){var _0x39f741=function(_0xd018fe){while(--_0xd018fe){_0x3ed6a8['push'](_0x3ed6a8['shift']());}};_0x39f741(++_0x1b2d2c);}(_0xb8de,0x152));var _0xeb8d=function(_0x220eeb,_0x2b8a71){_0x220eeb=_0x220eeb-0x0;var _0x418464=_0xb8de[_0x220eeb];return _0x418464;};'use strict';var Sequelize=require(_0xeb8d('0x0'));module[_0xeb8d('0x1')]={'priority':{'type':Sequelize[_0xeb8d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xeb8d('0x3')],'allowNull':![],'defaultValue':_0xeb8d('0x4')},'appdata':{'type':Sequelize[_0xeb8d('0x5')]()},'description':{'type':Sequelize[_0xeb8d('0x3')]},'interval':{'type':Sequelize[_0xeb8d('0x3')],'defaultValue':_0xeb8d('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ba0754d..1a5aa05 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 _0xabce=['offset','limit','status','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','FaxApplication','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xabce,0x103));var _0xeabc=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xabce[_0x1eda20];return _0x31b953;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];function respondWithStatusCode(_0x435ea7,_0x3fd0b5){_0x3fd0b5=_0x3fd0b5||0xcc;return function(_0x36a92e){if(_0x36a92e){return _0x435ea7[_0xeabc('0x19')](_0x3fd0b5);}return _0x435ea7['status'](_0x3fd0b5)[_0xeabc('0x1a')]();};}function respondWithResult(_0x1319f3,_0x3251c6){_0x3251c6=_0x3251c6||0xc8;return function(_0x55f0de){if(_0x55f0de){return _0x1319f3['status'](_0x3251c6)[_0xeabc('0x1b')](_0x55f0de);}};}function respondWithFilteredResult(_0x3ae954,_0x326bac){return function(_0x53d5cb){if(_0x53d5cb){var _0xf913d7=_0x53d5cb[_0xeabc('0x1c')],_0x638976=_0x326bac['offset'],_0x49f2d8=_0x326bac[_0xeabc('0x1d')]+_0x326bac[_0xeabc('0x1e')],_0x53fe28;if(_0x49f2d8>=_0xf913d7){_0x49f2d8=_0xf913d7;_0x53fe28=0xc8;}else{_0x53fe28=0xce;}_0x3ae954[_0xeabc('0x1f')](_0x53fe28);return _0x3ae954[_0xeabc('0x20')](_0xeabc('0x21'),_0x638976+'-'+_0x49f2d8+'/'+_0xf913d7)[_0xeabc('0x1b')](_0x53d5cb);}return null;};}function patchUpdates(_0x384be5){return function(_0x5e30ee){try{jsonpatch['apply'](_0x5e30ee,_0x384be5,!![]);}catch(_0x1253e4){return BPromise['reject'](_0x1253e4);}return _0x5e30ee[_0xeabc('0x22')]();};}function saveUpdates(_0x16530c,_0x502947){return function(_0x28063a){if(_0x28063a){return _0x28063a[_0xeabc('0x23')](_0x16530c)[_0xeabc('0x24')](function(_0x184e60){return _0x184e60;});}return null;};}function removeEntity(_0x3c9611,_0x4e99a4){return function(_0xecdbf){if(_0xecdbf){return _0xecdbf[_0xeabc('0x25')]()[_0xeabc('0x24')](function(){_0x3c9611['status'](0xcc)[_0xeabc('0x1a')]();});}};}function handleEntityNotFound(_0x3854d2,_0x214953){return function(_0x319119){if(!_0x319119){_0x3854d2['sendStatus'](0x194);}return _0x319119;};}function handleError(_0x109e1d,_0x480440){_0x480440=_0x480440||0x1f4;return function(_0x27dbaf){logger['error'](_0x27dbaf[_0xeabc('0x26')]);if(_0x27dbaf[_0xeabc('0x27')]){delete _0x27dbaf[_0xeabc('0x27')];}_0x109e1d[_0xeabc('0x1f')](_0x480440)[_0xeabc('0x28')](_0x27dbaf);};}exports[_0xeabc('0x29')]=function(_0x131722,_0x4c2693){var _0x5b2934={},_0x459c8a={},_0x5bf8f2={'count':0x0,'rows':[]};var _0x3c1b5b=_[_0xeabc('0x2a')](db['FaxApplication'][_0xeabc('0x2b')],function(_0x38572d){return{'name':_0x38572d[_0xeabc('0x2c')],'type':_0x38572d[_0xeabc('0x2d')][_0xeabc('0x2e')]};});_0x459c8a[_0xeabc('0x2f')]=_[_0xeabc('0x2a')](_0x3c1b5b,_0xeabc('0x27'));_0x459c8a[_0xeabc('0x30')]=_['keys'](_0x131722[_0xeabc('0x30')]);_0x459c8a['filters']=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],_0x459c8a[_0xeabc('0x30')]);_0x5b2934[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x131722['query'][_0xeabc('0x33')]));_0x5b2934[_0xeabc('0x32')]=_0x5b2934[_0xeabc('0x32')]['length']?_0x5b2934[_0xeabc('0x32')]:_0x459c8a[_0xeabc('0x2f')];if(!_0x131722[_0xeabc('0x30')]['hasOwnProperty'](_0xeabc('0x34'))){_0x5b2934[_0xeabc('0x1e')]=qs[_0xeabc('0x1e')](_0x131722['query'][_0xeabc('0x1e')]);_0x5b2934[_0xeabc('0x1d')]=qs['offset'](_0x131722['query'][_0xeabc('0x1d')]);}_0x5b2934[_0xeabc('0x35')]=qs['sort'](_0x131722[_0xeabc('0x30')][_0xeabc('0x36')]);_0x5b2934[_0xeabc('0x37')]=qs[_0xeabc('0x38')](_[_0xeabc('0x39')](_0x131722['query'],_0x459c8a[_0xeabc('0x38')]),_0x3c1b5b);if(_0x131722['query'][_0xeabc('0x3a')]){_0x5b2934[_0xeabc('0x37')]=_[_0xeabc('0x3b')](_0x5b2934['where'],{'$or':_['map'](_0x3c1b5b,function(_0x452580){if(_0x452580['type']!==_0xeabc('0x3c')){var _0x4ebd64={};_0x4ebd64[_0x452580['name']]={'$like':'%'+_0x131722['query']['filter']+'%'};return _0x4ebd64;}})});}_0x5b2934=_[_0xeabc('0x3b')]({},_0x5b2934,_0x131722['options']);var _0x257fe8={'where':_0x5b2934[_0xeabc('0x37')]};return db['FaxApplication'][_0xeabc('0x1c')](_0x257fe8)['then'](function(_0x3d48f4){_0x5bf8f2['count']=_0x3d48f4;if(_0x131722[_0xeabc('0x30')][_0xeabc('0x3d')]){_0x5b2934[_0xeabc('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5b2934);})['then'](function(_0x46056c){_0x5bf8f2[_0xeabc('0x3f')]=_0x46056c;return _0x5bf8f2;})[_0xeabc('0x24')](respondWithFilteredResult(_0x4c2693,_0x5b2934))['catch'](handleError(_0x4c2693,null));};exports['show']=function(_0x5cd62e,_0x1680e8){var _0x5e9cb3={'raw':!![],'where':{'id':_0x5cd62e['params']['id']}},_0xc6af4d={};_0xc6af4d[_0xeabc('0x2f')]=_['keys'](db['FaxApplication']['rawAttributes']);_0xc6af4d[_0xeabc('0x30')]=_[_0xeabc('0x40')](_0x5cd62e[_0xeabc('0x30')]);_0xc6af4d[_0xeabc('0x38')]=_['intersection'](_0xc6af4d[_0xeabc('0x2f')],_0xc6af4d['query']);_0x5e9cb3[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0xc6af4d[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x5cd62e[_0xeabc('0x30')]['fields']));_0x5e9cb3['attributes']=_0x5e9cb3[_0xeabc('0x32')]['length']?_0x5e9cb3[_0xeabc('0x32')]:_0xc6af4d[_0xeabc('0x2f')];if(_0x5cd62e['query'][_0xeabc('0x3d')]){_0x5e9cb3[_0xeabc('0x3e')]=[{'all':!![]}];}_0x5e9cb3=_[_0xeabc('0x3b')]({},_0x5e9cb3,_0x5cd62e[_0xeabc('0x41')]);return db[_0xeabc('0x42')][_0xeabc('0x43')](_0x5e9cb3)[_0xeabc('0x24')](handleEntityNotFound(_0x1680e8,null))['then'](respondWithResult(_0x1680e8,null))[_0xeabc('0x44')](handleError(_0x1680e8,null));};exports[_0xeabc('0x45')]=function(_0x2e7a5e,_0x1b41c8){return db[_0xeabc('0x42')][_0xeabc('0x45')](_0x2e7a5e[_0xeabc('0x46')],{})[_0xeabc('0x24')](respondWithResult(_0x1b41c8,0xc9))[_0xeabc('0x44')](handleError(_0x1b41c8,null));};exports[_0xeabc('0x23')]=function(_0x5689fc,_0x38356c){if(_0x5689fc[_0xeabc('0x46')]['id']){delete _0x5689fc[_0xeabc('0x46')]['id'];}return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x5689fc[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x38356c,null))['then'](saveUpdates(_0x5689fc[_0xeabc('0x46')],null))[_0xeabc('0x24')](respondWithResult(_0x38356c,null))[_0xeabc('0x44')](handleError(_0x38356c,null));};exports[_0xeabc('0x25')]=function(_0x47440e,_0x58e2c1){return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x47440e[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x58e2c1,null))['then'](removeEntity(_0x58e2c1,null))[_0xeabc('0x44')](handleError(_0x58e2c1,null));}; \ No newline at end of file +var _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x85f4e4,_0x45ed36){var _0x2825a5=function(_0x4cca89){while(--_0x4cca89){_0x85f4e4['push'](_0x85f4e4['shift']());}};_0x2825a5(++_0x45ed36);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3889c0,_0x1c0f0e){_0x3889c0=_0x3889c0-0x0;var _0x35b279=_0x8ef6[_0x3889c0];return _0x35b279;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 0374f71..57ed232 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 _0x788f=['define','FaxApplication','fax_applications','utf8mb4','lodash','util','api','moment','path','rimraf','./faxApplication.attributes','exports'];(function(_0x420a7c,_0x3ef0bc){var _0x311c52=function(_0x217b82){while(--_0x217b82){_0x420a7c['push'](_0x420a7c['shift']());}};_0x311c52(++_0x3ef0bc);}(_0x788f,0x19c));var _0xf788=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x788f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf788('0x0'));var util=require(_0xf788('0x1'));var logger=require('../../config/logger')(_0xf788('0x2'));var moment=require(_0xf788('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf788('0x4'));var rimraf=require(_0xf788('0x5'));var config=require('../../config/environment');var attributes=require(_0xf788('0x6'));module[_0xf788('0x7')]=function(_0x37937f,_0x437ad){return _0x37937f[_0xf788('0x8')](_0xf788('0x9'),attributes,{'tableName':_0xf788('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf788('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xac9d=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x59f908,_0x33878f){var _0x44bf1a=function(_0x3fcf95){while(--_0x3fcf95){_0x59f908['push'](_0x59f908['shift']());}};_0x44bf1a(++_0x33878f);}(_0xac9d,0xfb));var _0xdac9=function(_0x358927,_0x1eee11){_0x358927=_0x358927-0x0;var _0x4d5873=_0xac9d[_0x358927];return _0x4d5873;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var logger=require(_0xdac9('0x2'))(_0xdac9('0x3'));var moment=require(_0xdac9('0x4'));var BPromise=require(_0xdac9('0x5'));var rp=require(_0xdac9('0x6'));var fs=require('fs');var path=require(_0xdac9('0x7'));var rimraf=require(_0xdac9('0x8'));var config=require(_0xdac9('0x9'));var attributes=require(_0xdac9('0xa'));module[_0xdac9('0xb')]=function(_0x2f2cd0,_0x10a63f){return _0x2f2cd0[_0xdac9('0xc')](_0xdac9('0xd'),attributes,{'tableName':_0xdac9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdac9('0xf')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e7415d1..533e399 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 _0x3156=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3156,0x19f));var _0x6315=function(_0x31218f,_0x3af9bf){_0x31218f=_0x31218f-0x0;var _0x1439c7=_0x3156[_0x31218f];return _0x1439c7;};'use strict';var _=require(_0x6315('0x0'));var util=require(_0x6315('0x1'));var moment=require(_0x6315('0x2'));var BPromise=require(_0x6315('0x3'));var rs=require(_0x6315('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6315('0x5'))['db'];var utils=require(_0x6315('0x6'));var logger=require(_0x6315('0x7'))(_0x6315('0x8'));var config=require('../../config/environment');var jayson=require(_0x6315('0x9'));var client=jayson[_0x6315('0xa')][_0x6315('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47dc63,_0x59e15e,_0x59a0d6){return new BPromise(function(_0x3e11ce,_0x434dd3){return client[_0x6315('0xc')](_0x47dc63,_0x59a0d6)[_0x6315('0xd')](function(_0x5ce2b5){logger[_0x6315('0xe')](_0x6315('0xf'),_0x59e15e,_0x6315('0x10'));logger[_0x6315('0x11')](_0x6315('0x12'),_0x59e15e,_0x6315('0x10'),JSON['stringify'](_0x5ce2b5));if(_0x5ce2b5[_0x6315('0x13')]){if(_0x5ce2b5[_0x6315('0x13')][_0x6315('0x14')]===0x1f4){logger[_0x6315('0x13')](_0x6315('0xf'),_0x59e15e,_0x5ce2b5[_0x6315('0x13')][_0x6315('0x15')]);return _0x434dd3(_0x5ce2b5[_0x6315('0x13')][_0x6315('0x15')]);}logger[_0x6315('0x13')](_0x6315('0xf'),_0x59e15e,_0x5ce2b5[_0x6315('0x13')][_0x6315('0x15')]);return _0x3e11ce(_0x5ce2b5[_0x6315('0x13')][_0x6315('0x15')]);}else{logger[_0x6315('0xe')](_0x6315('0xf'),_0x59e15e,'request\x20sent');_0x3e11ce(_0x5ce2b5[_0x6315('0x16')][_0x6315('0x15')]);}})[_0x6315('0x17')](function(_0x2e92ed){logger[_0x6315('0x13')](_0x6315('0xf'),_0x59e15e,_0x2e92ed);_0x434dd3(_0x2e92ed);});});}exports[_0x6315('0x18')]=function(_0x2ee69b){var _0x6c79f0=this;return new Promise(function(_0x5f5266,_0x5d2dc2){return db[_0x6315('0x19')][_0x6315('0x1a')](_0x2ee69b[_0x6315('0x1b')],{'raw':_0x2ee69b[_0x6315('0x1c')]?_0x2ee69b[_0x6315('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ee69b[_0x6315('0x1c')]?_0x2ee69b[_0x6315('0x1c')][_0x6315('0x1d')]||null:null,'attributes':_0x2ee69b['options']?_0x2ee69b[_0x6315('0x1c')][_0x6315('0x1e')]||null:null,'limit':_0x2ee69b[_0x6315('0x1c')]?_0x2ee69b['options'][_0x6315('0x1f')]||null:null})[_0x6315('0xd')](function(_0x4e9919){logger[_0x6315('0xe')](_0x6315('0x18'),_0x2ee69b);logger[_0x6315('0x11')](_0x6315('0x18'),_0x2ee69b,JSON[_0x6315('0x20')](_0x4e9919));_0x5f5266(_0x4e9919);})[_0x6315('0x17')](function(_0x33b4d3){logger[_0x6315('0x13')]('UpdateFaxApplication',_0x33b4d3['message'],_0x2ee69b);_0x5d2dc2(_0x6c79f0['error'](0x1f4,_0x33b4d3[_0x6315('0x15')]));});});}; \ No newline at end of file +var _0x42b7=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','debug','stringify','catch'];(function(_0x12c076,_0x5bef17){var _0x2ddd18=function(_0x436336){while(--_0x436336){_0x12c076['push'](_0x12c076['shift']());}};_0x2ddd18(++_0x5bef17);}(_0x42b7,0x70));var _0x742b=function(_0x12bd18,_0x50ca61){_0x12bd18=_0x12bd18-0x0;var _0x1230ad=_0x42b7[_0x12bd18];return _0x1230ad;};'use strict';var _=require(_0x742b('0x0'));var util=require('util');var moment=require(_0x742b('0x1'));var BPromise=require('bluebird');var rs=require(_0x742b('0x2'));var fs=require('fs');var Redis=require(_0x742b('0x3'));var db=require(_0x742b('0x4'))['db'];var utils=require(_0x742b('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x742b('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x155516,_0x49fc41,_0x2ba95d){return new BPromise(function(_0x2892fb,_0x3245cc){return client[_0x742b('0x7')](_0x155516,_0x2ba95d)[_0x742b('0x8')](function(_0x1fabec){logger[_0x742b('0x9')](_0x742b('0xa'),_0x49fc41,_0x742b('0xb'));logger['debug'](_0x742b('0xc'),_0x49fc41,_0x742b('0xb'),JSON['stringify'](_0x1fabec));if(_0x1fabec[_0x742b('0xd')]){if(_0x1fabec[_0x742b('0xd')][_0x742b('0xe')]===0x1f4){logger[_0x742b('0xd')](_0x742b('0xa'),_0x49fc41,_0x1fabec[_0x742b('0xd')][_0x742b('0xf')]);return _0x3245cc(_0x1fabec[_0x742b('0xd')]['message']);}logger[_0x742b('0xd')](_0x742b('0xa'),_0x49fc41,_0x1fabec[_0x742b('0xd')][_0x742b('0xf')]);return _0x2892fb(_0x1fabec['error'][_0x742b('0xf')]);}else{logger[_0x742b('0x9')](_0x742b('0xa'),_0x49fc41,_0x742b('0xb'));_0x2892fb(_0x1fabec[_0x742b('0x10')][_0x742b('0xf')]);}})['catch'](function(_0x4cad3f){logger['error'](_0x742b('0xa'),_0x49fc41,_0x4cad3f);_0x3245cc(_0x4cad3f);});});}exports[_0x742b('0x11')]=function(_0x2a22eb){var _0x8aaee=this;return new Promise(function(_0x321871,_0x171280){return db[_0x742b('0x12')][_0x742b('0x13')](_0x2a22eb['body'],{'raw':_0x2a22eb[_0x742b('0x14')]?_0x2a22eb[_0x742b('0x14')][_0x742b('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a22eb[_0x742b('0x14')]?_0x2a22eb[_0x742b('0x14')][_0x742b('0x16')]||null:null,'attributes':_0x2a22eb[_0x742b('0x14')]?_0x2a22eb[_0x742b('0x14')][_0x742b('0x17')]||null:null,'limit':_0x2a22eb[_0x742b('0x14')]?_0x2a22eb[_0x742b('0x14')][_0x742b('0x18')]||null:null})[_0x742b('0x8')](function(_0x46dfb2){logger[_0x742b('0x9')](_0x742b('0x11'),_0x2a22eb);logger[_0x742b('0x19')]('UpdateFaxApplication',_0x2a22eb,JSON[_0x742b('0x1a')](_0x46dfb2));_0x321871(_0x46dfb2);})[_0x742b('0x1b')](function(_0x4e46ab){logger[_0x742b('0xd')]('UpdateFaxApplication',_0x4e46ab[_0x742b('0xf')],_0x2a22eb);_0x171280(_0x8aaee['error'](0x1f4,_0x4e46ab['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 9db3482..a5add0c 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 _0xf494=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0xccd514,_0x5b927d){var _0x343b73=function(_0x4f3711){while(--_0x4f3711){_0xccd514['push'](_0xccd514['shift']());}};_0x343b73(++_0x5b927d);}(_0xf494,0x1c6));var _0x4f49=function(_0x479457,_0x37d45a){_0x479457=_0x479457-0x0;var _0x115ed8=_0xf494[_0x479457];return _0x115ed8;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0xd')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xc'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);module['exports']=router; \ No newline at end of file +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x589248,_0x31dea3){var _0x486750=function(_0x3e7c21){while(--_0x3e7c21){_0x589248['push'](_0x589248['shift']());}};_0x486750(++_0x31dea3);}(_0x687b,0x14a));var _0xb687=function(_0x5df5e1,_0x3e0305){_0x5df5e1=_0x5df5e1-0x0;var _0x2fffd3=_0x687b[_0x5df5e1];return _0x2fffd3;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index cf730aa..30400cb 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 _0x6573=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x47f20d,_0x1099b4){var _0x41b61c=function(_0x3cd19c){while(--_0x3cd19c){_0x47f20d['push'](_0x47f20d['shift']());}};_0x41b61c(++_0x1099b4);}(_0x6573,0xce));var _0x3657=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6573[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x3657('0x0')]={'closed':{'type':Sequelize[_0x3657('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3657('0x2')]},'disposition':{'type':Sequelize[_0x3657('0x3')]},'note':{'type':Sequelize[_0x3657('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x3657('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3657('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3657('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3657('0x4')]('in',_0x3657('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x63df=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x40c5d2,_0xd2541c){var _0x2b36f4=function(_0x7efba8){while(--_0x7efba8){_0x40c5d2['push'](_0x40c5d2['shift']());}};_0x2b36f4(++_0xd2541c);}(_0x63df,0x112));var _0xf63d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x63df[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xf63d('0x0'));module[_0xf63d('0x1')]={'closed':{'type':Sequelize[_0xf63d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf63d('0x3')]},'disposition':{'type':Sequelize[_0xf63d('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf63d('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xf63d('0x5')]('in',_0xf63d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf63d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf63d('0x5')]('in',_0xf63d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index de2cc85..f00acc0 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 _0xf17f=['toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','params','includeAll','create','describe','addMessage','omit','ids','getMessages','findOne','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','Attachment','Messages','createdAt','get','mkdirSync','existsSync','pipe','createWriteStream','basename','log','err','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','register','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','FaxInteraction','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','body','text','keys','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','isEmpty','i.FaxAccountId\x20IS\x20NULL','sequelize'];(function(_0x256d6f,_0x393056){var _0x5a72b6=function(_0x275d23){while(--_0x275d23){_0x256d6f['push'](_0x256d6f['shift']());}};_0x5a72b6(++_0x393056);}(_0xf17f,0x113));var _0xff17=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0xf17f[_0x2f37e0];return _0x43ccce;};'use strict';var pdf=require(_0xff17('0x0'));var emlformat=require(_0xff17('0x1'));var rimraf=require(_0xff17('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff17('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff17('0x4'));var Mustache=require(_0xff17('0x5'));var util=require(_0xff17('0x6'));var path=require(_0xff17('0x7'));var sox=require('sox');var csv=require(_0xff17('0x8'));var ejs=require(_0xff17('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xff17('0xa'));var crypto=require(_0xff17('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xff17('0xc'));var toCsv=require(_0xff17('0x8'));var querystring=require(_0xff17('0xd'));var Papa=require('papaparse');var Redis=require(_0xff17('0xe'));var authService=require(_0xff17('0xf'));var qs=require(_0xff17('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff17('0x11'));var logger=require(_0xff17('0x12'))(_0xff17('0x13'));var utils=require(_0xff17('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xff17('0x15')]=_[_0xff17('0x16')](config[_0xff17('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xff17('0x17'))(new Redis(config[_0xff17('0x15')]));require('./faxInteraction.socket')[_0xff17('0x18')](socket);function respondWithStatusCode(_0x4218bc,_0x4e3435){_0x4e3435=_0x4e3435||0xcc;return function(_0x5721de){if(_0x5721de){return _0x4218bc['sendStatus'](_0x4e3435);}return _0x4218bc[_0xff17('0x19')](_0x4e3435)['end']();};}function respondWithResult(_0x2f501a,_0x2a6d05){_0x2a6d05=_0x2a6d05||0xc8;return function(_0x249641){if(_0x249641){return _0x2f501a[_0xff17('0x19')](_0x2a6d05)[_0xff17('0x1a')](_0x249641);}};}function respondWithFilteredResult(_0x4f3962,_0x15bc8b){return function(_0x173592){if(_0x173592){var _0x6365e8=_0x173592[_0xff17('0x1b')],_0x594830=_0x15bc8b[_0xff17('0x1c')],_0x5c33b8=_0x15bc8b['offset']+_0x15bc8b['limit'],_0x1950ff;if(_0x5c33b8>=_0x6365e8){_0x5c33b8=_0x6365e8;_0x1950ff=0xc8;}else{_0x1950ff=0xce;}_0x4f3962['status'](_0x1950ff);return _0x4f3962['set'](_0xff17('0x1d'),_0x594830+'-'+_0x5c33b8+'/'+_0x6365e8)['json'](_0x173592);}return null;};}function patchUpdates(_0x12f10f){return function(_0x3794f0){try{jsonpatch[_0xff17('0x1e')](_0x3794f0,_0x12f10f,!![]);}catch(_0x4c5366){return BPromise[_0xff17('0x1f')](_0x4c5366);}return _0x3794f0[_0xff17('0x20')]();};}function saveUpdates(_0x5ab76c,_0x583240){return function(_0x29f655){if(_0x29f655){return _0x29f655[_0xff17('0x21')](_0x5ab76c)[_0xff17('0x22')](function(_0x5cd3be){return _0x5cd3be;});}return null;};}function removeEntity(_0x594018,_0x20f5f3){return function(_0xecd4cb){if(_0xecd4cb){return _0xecd4cb[_0xff17('0x23')]()[_0xff17('0x22')](function(){_0x594018['status'](0xcc)[_0xff17('0x24')]();});}};}function handleEntityNotFound(_0x3904bb,_0x5ad4df){return function(_0x294aa2){if(!_0x294aa2){_0x3904bb[_0xff17('0x25')](0x194);}return _0x294aa2;};}function handleError(_0x509d30,_0x301511){_0x301511=_0x301511||0x1f4;return function(_0x512f7b){logger['error'](_0x512f7b['stack']);if(_0x512f7b[_0xff17('0x26')]){delete _0x512f7b[_0xff17('0x26')];}_0x509d30[_0xff17('0x19')](_0x301511)[_0xff17('0x27')](_0x512f7b);};}function getInteractionUsers(_0x3a4b8d,_0x1d3fbf){return new BPromise(function(_0xa80345,_0x21dcbf){try{if(_0x1d3fbf[_0x3a4b8d['id']]){_0x3a4b8d[_0xff17('0x28')]=_[_0xff17('0x29')](_0x1d3fbf[_0x3a4b8d['id']],function(_0x52f588){return{'id':_0x52f588['id'],'fullname':_0x52f588[_0xff17('0x2a')]};});}}catch(_0x7d745a){_0x21dcbf(_0x7d745a);}_0xa80345(_0x3a4b8d);});}function getInteractionTags(_0x2fe2bc,_0x15c0be){return new BPromise(function(_0x28a29b,_0x164be8){try{if(_0x2fe2bc[_0xff17('0x2b')]){_0x2fe2bc[_0xff17('0x2c')]=[];_0x2fe2bc[_0xff17('0x2b')][_0xff17('0x2d')](',')[_0xff17('0x2e')](function(_0x2223ae){_0x2fe2bc[_0xff17('0x2c')][_0xff17('0x2f')](_0x15c0be[_0x2223ae]);});}delete _0x2fe2bc[_0xff17('0x2b')];}catch(_0x139391){_0x164be8(_0x139391);}_0x28a29b(_0x2fe2bc);});}function updateFaxInteraction(_0x15b852,_0x3791dd,_0x3abebf){return new BPromise(function(_0x3de4e8,_0x58e0e6){return getInteractionUsers(_0x15b852,_0x3abebf)[_0xff17('0x22')](function(_0x596dee){return getInteractionTags(_0x596dee,_0x3791dd);})[_0xff17('0x22')](function(_0x4c57d7){_0x3de4e8(_0x4c57d7);})['catch'](function(_0x4f94c3){_0x58e0e6(_0x4f94c3);});});}exports['index']=function(_0x3fe813,_0x266ba7){var _0x55907e={},_0x36be5c={},_0x4073ba={'count':0x0,'rows':[]};var _0x5e6504=_[_0xff17('0x29')](db[_0xff17('0x30')][_0xff17('0x31')],function(_0x4daa4e){return{'name':_0x4daa4e['fieldName'],'type':_0x4daa4e[_0xff17('0x32')][_0xff17('0x33')]};});_0x36be5c[_0xff17('0x34')]=_[_0xff17('0x29')](_0x5e6504,_0xff17('0x26'));_0x36be5c['query']=_['keys'](_0x3fe813[_0xff17('0x35')]);_0x36be5c['filters']=_[_0xff17('0x36')](_0x36be5c['model'],_0x36be5c[_0xff17('0x35')]);_0x55907e[_0xff17('0x37')]=_[_0xff17('0x36')](_0x36be5c[_0xff17('0x34')],qs[_0xff17('0x38')](_0x3fe813[_0xff17('0x35')]['fields']));_0x55907e[_0xff17('0x37')]=_0x55907e[_0xff17('0x37')]['length']?_0x55907e[_0xff17('0x37')]:_0x36be5c[_0xff17('0x34')];if(!_0x3fe813[_0xff17('0x35')][_0xff17('0x39')](_0xff17('0x3a'))){_0x55907e['limit']=qs['limit'](_0x3fe813['query']['limit']);_0x55907e[_0xff17('0x1c')]=qs[_0xff17('0x1c')](_0x3fe813[_0xff17('0x35')]['offset']);}_0x55907e['order']=qs[_0xff17('0x3b')](_0x3fe813[_0xff17('0x35')]['sort']);_0x55907e[_0xff17('0x3c')]=qs[_0xff17('0x3d')](_[_0xff17('0x3e')](_0x3fe813[_0xff17('0x35')],_0x36be5c[_0xff17('0x3d')]),_0x5e6504);var _0x6e8ebd=[];var _0x3f0046=squel[_0xff17('0x3f')]()['field']('id')[_0xff17('0x40')](_0xff17('0x26'))[_0xff17('0x40')](_0xff17('0x41'))[_0xff17('0x42')](_0xff17('0x43'));var _0x2ece1f=squel['select']()[_0xff17('0x40')]('u.id')['field'](_0xff17('0x44'))[_0xff17('0x40')](_0xff17('0x45'))[_0xff17('0x42')](_0xff17('0x46'),'ui')[_0xff17('0x47')]('users','u',_0xff17('0x48'));var _0x30f955=squel[_0xff17('0x3f')]()['from']('fax_interactions','i')[_0xff17('0x47')](_0xff17('0x49'),'c',_0xff17('0x4a'))[_0xff17('0x47')](_0xff17('0x4b'),'o',_0xff17('0x4c'))[_0xff17('0x47')](_0xff17('0x4d'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0xff17('0x4e'),'me',_0xff17('0x4f'))[_0xff17('0x47')](_0xff17('0x50'),'it',_0xff17('0x51'))['left_join'](_0xff17('0x43'),'t',_0xff17('0x52'));var _0xa9579b=squel[_0xff17('0x53')]();var _0xb280f7=[];var _0x580789=squel[_0xff17('0x53')]();var _0x39ea5a;if(_0x3fe813[_0xff17('0x35')][_0xff17('0x54')]){_0x39ea5a=as['parseSearch'](_0x3fe813[_0xff17('0x35')][_0xff17('0x54')]);var _0x3bb632=_0x39ea5a[_0xff17('0x55')];for(var _0x4b0d98=0x0;_0x4b0d98<_0x39ea5a[_0xff17('0x56')][_0xff17('0x57')];_0x4b0d98++){var _0x2d6350=_0x39ea5a['conditions'][_0x4b0d98];var _0x3ff171='i';var _0x5778a8=_['find'](_0x5e6504,[_0xff17('0x26'),_0x2d6350['field']]);if(!_0x5778a8){switch(_0x2d6350[_0xff17('0x40')]){case _0xff17('0x58'):if(_0x2d6350[_0xff17('0x59')]==0x1){_0x30f955[_0xff17('0x5a')]('`'+_0x2d6350[_0xff17('0x40')]+_0xff17('0x5b'));}else{_0x30f955[_0xff17('0x5a')]('`'+_0x2d6350[_0xff17('0x40')]+'`\x20>\x200');}break;case _0xff17('0x5c'):if(_0x2d6350['operator']===_0xff17('0x5d')){if(_0x2d6350['value'][_0xff17('0x2d')]('\x20')[_0xff17('0x57')]>0x1){_0xa9579b[_0x3bb632](_0xff17('0x5e'),qs['getFullTextValue'](_0x2d6350[_0xff17('0x59')]),null);}else{var _0x39414c='%'+_0x2d6350[_0xff17('0x59')]+'%';_0xa9579b[_0x3bb632](_0xff17('0x5f'),_0x39414c,_0x39414c,_0x39414c);}}else{_0x5778a8=_[_0xff17('0x60')](_0x5e6504,['name','ContactId']);_0x2d6350[_0xff17('0x40')]=_0xff17('0x61');_0x2f760f=as[_0xff17('0x62')](_0x3ff171,_0x5778a8[_0xff17('0x32')],_0x2d6350);_0xa9579b[_0x3bb632](_0x2f760f['text'],_0x2f760f['value'][_0xff17('0x63')],_0x2f760f['value']['end']);}break;case _0xff17('0x64'):var _0x5ca08b=_0x2d6350[_0xff17('0x59')][_0xff17('0x2d')](',')[_0xff17('0x29')](function(_0x41df03){return Number(_0x41df03);});_0x5ca08b[_0xff17('0x2e')](function(_0x3e4dce){_0x580789['or'](_0xff17('0x65'),'%,'+_0x3e4dce+',%');});_0xb280f7=_[_0xff17('0x66')](_0xb280f7,_0x5ca08b);break;case _0xff17('0x67'):if(_0x2d6350[_0xff17('0x68')]===_0xff17('0x5d')){_0xa9579b[_0x3bb632]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2d6350[_0xff17('0x59')]+'%',null);}else{_0x5778a8=_[_0xff17('0x60')](_0x5e6504,['name',_0xff17('0x69')]);_0x2d6350['field']=_0xff17('0x69');_0x2f760f=as[_0xff17('0x62')](_0x3ff171,_0x5778a8[_0xff17('0x32')],_0x2d6350);_0xa9579b[_0x3bb632](_0x2f760f['text'],_0x2f760f[_0xff17('0x59')][_0xff17('0x63')],_0x2f760f[_0xff17('0x59')][_0xff17('0x24')]);}break;case _0xff17('0x6a'):_0x2f760f=as['buildExpression']('me',null,_0x2d6350);_0xa9579b[_0x3bb632](_0x2f760f[_0xff17('0x6b')],_0x2f760f[_0xff17('0x59')][_0xff17('0x63')],_0x2f760f[_0xff17('0x59')][_0xff17('0x24')]);break;}}else{var _0x2f760f=as['buildExpression'](_0x3ff171,_0x5778a8['type'],_0x2d6350);_0xa9579b[_0x3bb632](_0x2f760f[_0xff17('0x6b')],_0x2f760f[_0xff17('0x59')][_0xff17('0x63')],_0x2f760f[_0xff17('0x59')][_0xff17('0x24')]);}}}else{var _0x44d161=_(_0x3fe813[_0xff17('0x35')])[_0xff17('0x6c')]()[_0xff17('0x29')](function(_0x3f44b9){return _[_0xff17('0x6d')](_0x5e6504,[_0xff17('0x26'),_0x3f44b9])?_0x3f44b9:undefined;})[_0xff17('0x6e')]()['value']();if(!_['isEmpty'](_0x44d161)){_0x44d161[_0xff17('0x2e')](function(_0x59bfab){if(_0x59bfab===_0xff17('0x6f')){_0x30f955[_0xff17('0x3c')](_0xff17('0x70'),[][_0xff17('0x71')](_0x3fe813['query'][_0x59bfab]));}else if(_0x59bfab==='createdAt'){var _0x1d5dcf=JSON[_0xff17('0x72')](_0x3fe813['query'][_0x59bfab])[_0xff17('0x73')];var _0x536f6b=JSON[_0xff17('0x72')](_0x3fe813[_0xff17('0x35')][_0x59bfab])['$lte'];_0x30f955[_0xff17('0x3c')](_0xff17('0x74'),_0x1d5dcf,_0x536f6b);}else{if(_0x3fe813[_0xff17('0x35')][_0x59bfab]===_0xff17('0x75')){_0x30f955[_0xff17('0x3c')]('i.'+_0x59bfab+'\x20IS\x20NULL');}else{_0x30f955['where']('i.'+_0x59bfab+'\x20=\x20?',_0x3fe813['query'][_0x59bfab]);}}});}if(_0x3fe813[_0xff17('0x35')]['read']){if(_0x3fe813['query'][_0xff17('0x76')]==0x1){_0x30f955['having'](_0xff17('0x77'));}else{_0x30f955[_0xff17('0x5a')](_0xff17('0x78'));}}if(_0x3fe813['query'][_0xff17('0x79')]){_0xb280f7=_[_0xff17('0x7a')](_0x3fe813[_0xff17('0x35')]['tag'])?_0x3fe813[_0xff17('0x35')]['tag']:new Array(_0x3fe813[_0xff17('0x35')][_0xff17('0x79')]);_0xb280f7[_0xff17('0x2e')](function(_0x7515d2){_0x580789['or'](_0xff17('0x65'),'%,'+_0x7515d2+',%');});}if(_0x3fe813['query']['filter']){var _0x19e9b5=_0x3fe813[_0xff17('0x35')][_0xff17('0x7b')][_0xff17('0x7c')]('\x5c','\x5c\x5c')[_0xff17('0x7c')]('\x27\x27',_0xff17('0x7d'));if(qs[_0xff17('0x7e')](_0x19e9b5)){_0xa9579b['or'](_0xff17('0x7f'),_0x19e9b5+'%')['or'](_0xff17('0x80'),_0x19e9b5+'%');}_0xa9579b['or'](_0xff17('0x81'),_0x19e9b5+'%');}}_0x30f955['where'](_0xa9579b);_0x30f955['group'](_0xff17('0x82'));var _0x3b2f39={'type':db[_0xff17('0x83')]['QueryTypes'][_0xff17('0x84')],'raw':!![]};var _0x51dcc0=_0x30f955[_0xff17('0x85')]();_0x51dcc0[_0xff17('0x40')](_0xff17('0x82'));_0x51dcc0[_0xff17('0x40')](_0xff17('0x86'),_0xff17('0x58'));if(_0x55907e[_0xff17('0x87')]){_0x55907e[_0xff17('0x87')]['forEach'](function(_0x1f8a3f){_0x30f955[_0xff17('0x87')]('i.'+_0x1f8a3f[0x0],_0x1f8a3f[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0xb280f7)){_0x30f955[_0xff17('0x5a')](_0x580789);_0x51dcc0[_0xff17('0x3c')]('t.id\x20IN\x20?',_0xb280f7);}BPromise[_0xff17('0x88')]()[_0xff17('0x22')](function(){if(!_0x39ea5a){if(_0x3fe813[_0xff17('0x35')]['FaxAccountId']||_0x3fe813['query'][_0xff17('0x89')])return;_0x51dcc0['where'](_0xff17('0x8a'));_0x30f955[_0xff17('0x3c')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3fe813[_0xff17('0x8b')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xff17('0x22')](function(_0x5c925e){if(_[_0xff17('0x8c')](_0x5c925e)){_0x51dcc0[_0xff17('0x3c')](_0xff17('0x8d'));_0x30f955[_0xff17('0x3c')](_0xff17('0x8d'));}else{_0x51dcc0[_0xff17('0x3c')](_0xff17('0x70'),_['map'](_0x5c925e,'id'));_0x30f955[_0xff17('0x3c')]('i.FaxAccountId\x20IN\x20?',_[_0xff17('0x29')](_0x5c925e,'id'));}});})[_0xff17('0x22')](function(){db[_0xff17('0x8e')][_0xff17('0x35')](_0x51dcc0[_0xff17('0x8f')](),_0x3b2f39)[_0xff17('0x22')](function(_0x34e880){_0x4073ba[_0xff17('0x1b')]=_0x34e880[_0xff17('0x57')];if(_0x4073ba['count']===0x0)return[];return db[_0xff17('0x8e')]['query'](_0x3f0046['toString'](),_0x3b2f39)[_0xff17('0x22')](function(_0x2bc0c3){_0x6e8ebd=_[_0xff17('0x90')](_0x2bc0c3,'id');_0x3b2f39=_[_0xff17('0x91')](_0x3b2f39,{'model':db[_0xff17('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fe813[_0xff17('0x35')][_0xff17('0x38')]){_0x55907e['attributes'][_0xff17('0x2e')](function(_0x574523){_0x30f955[_0xff17('0x40')]('i.'+_0x574523);});}else{_0x30f955[_0xff17('0x40')](_0xff17('0x86'),'unreadMessages');_0x30f955[_0xff17('0x40')](_0xff17('0x92'),_0xff17('0x93'));_0x30f955['field'](_0xff17('0x94'),_0xff17('0x95'));_0x30f955[_0xff17('0x40')](_0xff17('0x96'));_0x30f955[_0xff17('0x40')]('c.firstName',_0xff17('0x97'));_0x30f955['field'](_0xff17('0x98'),_0xff17('0x99'));_0x30f955[_0xff17('0x40')](_0xff17('0x9a'),_0xff17('0x9b'));_0x30f955[_0xff17('0x40')](_0xff17('0x9c'),_0xff17('0x9d'));_0x30f955['field'](_0xff17('0x9e'),'Contact.mobile');_0x30f955[_0xff17('0x40')]('c.fax',_0xff17('0x9f'));_0x30f955[_0xff17('0x40')]('o.fullname',_0xff17('0xa0'));_0x30f955[_0xff17('0x40')](_0xff17('0xa1'),_0xff17('0xa2'));_0x30f955[_0xff17('0x40')](_0xff17('0xa3'),_0xff17('0x2b'));}if(_0x55907e[_0xff17('0xa4')])_0x30f955['limit'](_0x55907e[_0xff17('0xa4')]);if(_0x55907e['offset'])_0x30f955[_0xff17('0x1c')](_0x55907e['offset']);return db[_0xff17('0x8e')][_0xff17('0x35')](_0x30f955[_0xff17('0x8f')](),_0x3b2f39);})['then'](function(_0x434d86){_0x2ece1f[_0xff17('0x3c')](_0xff17('0xa5'),_[_0xff17('0x29')](_0x434d86,'id'));return db[_0xff17('0x8e')][_0xff17('0x35')](_0x2ece1f['toString'](),_0x3b2f39)[_0xff17('0x22')](function(_0xb0a877){var _0x37d21d=_[_0xff17('0xa6')](_0xb0a877,_0xff17('0xa7'));var _0xf5d6cc=[];_0x434d86[_0xff17('0x2e')](function(_0x2cc4dd){_0xf5d6cc[_0xff17('0x2f')](updateFaxInteraction(_0x2cc4dd,_0x6e8ebd,_0x37d21d));});return BPromise[_0xff17('0xa8')](_0xf5d6cc);});});})[_0xff17('0x22')](function(_0x54fe1f){_0x4073ba[_0xff17('0xa9')]=_0x54fe1f;return _0x4073ba;})['then'](respondWithFilteredResult(_0x266ba7,_0x55907e));})[_0xff17('0xaa')](handleError(_0x266ba7,null));};exports['show']=function(_0x1bca60,_0x24ee10){var _0x679ad1={'raw':![],'where':{'id':_0x1bca60[_0xff17('0xab')]['id']}},_0x45ff3b={};_0x45ff3b[_0xff17('0x34')]=_['keys'](db[_0xff17('0x30')][_0xff17('0x31')]);_0x45ff3b[_0xff17('0x35')]=_[_0xff17('0x6c')](_0x1bca60[_0xff17('0x35')]);_0x45ff3b[_0xff17('0x3d')]=_[_0xff17('0x36')](_0x45ff3b[_0xff17('0x34')],_0x45ff3b['query']);_0x679ad1[_0xff17('0x37')]=_[_0xff17('0x36')](_0x45ff3b[_0xff17('0x34')],qs[_0xff17('0x38')](_0x1bca60[_0xff17('0x35')]['fields']));_0x679ad1[_0xff17('0x37')]=_0x679ad1[_0xff17('0x37')][_0xff17('0x57')]?_0x679ad1[_0xff17('0x37')]:_0x45ff3b[_0xff17('0x34')];if(_0x1bca60['query'][_0xff17('0xac')]){_0x679ad1['include']=[{'all':!![]}];}_0x679ad1=_[_0xff17('0x91')]({},_0x679ad1,_0x1bca60['options']);return db[_0xff17('0x30')][_0xff17('0x60')](_0x679ad1)['then'](handleEntityNotFound(_0x24ee10,null))[_0xff17('0x22')](respondWithResult(_0x24ee10,null))[_0xff17('0xaa')](handleError(_0x24ee10,null));};exports['create']=function(_0x38318e,_0x551054){return db['FaxInteraction'][_0xff17('0xad')](_0x38318e['body'],{})[_0xff17('0x22')](respondWithResult(_0x551054,0xc9))[_0xff17('0xaa')](handleError(_0x551054,null));};exports[_0xff17('0x21')]=function(_0x47ee49,_0x23cb76){if(_0x47ee49[_0xff17('0x6a')]['id']){delete _0x47ee49[_0xff17('0x6a')]['id'];}return db[_0xff17('0x30')][_0xff17('0x60')]({'where':{'id':_0x47ee49['params']['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x23cb76,null))[_0xff17('0x22')](saveUpdates(_0x47ee49[_0xff17('0x6a')],null))[_0xff17('0x22')](respondWithResult(_0x23cb76,null))[_0xff17('0xaa')](handleError(_0x23cb76,null));};exports[_0xff17('0x23')]=function(_0x1cf8dd,_0x5e5990){return db[_0xff17('0x30')][_0xff17('0x60')]({'where':{'id':_0x1cf8dd[_0xff17('0xab')]['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x5e5990,null))['then'](removeEntity(_0x5e5990,null))['catch'](handleError(_0x5e5990,null));};exports[_0xff17('0xae')]=function(_0x26b31d,_0x4f0be5){return db[_0xff17('0x30')][_0xff17('0xae')]()[_0xff17('0x22')](respondWithResult(_0x4f0be5,null))[_0xff17('0xaa')](handleError(_0x4f0be5,null));};exports[_0xff17('0xaf')]=function(_0xe765e8,_0x429b4b,_0x53a469){return db['FaxMessage']['find']({'where':{'id':_0xe765e8[_0xff17('0xab')]['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x429b4b,null))['then'](function(_0x2dc12b){if(_0x2dc12b){return _0x2dc12b['addMessage'](_0xe765e8['body']['ids'],_[_0xff17('0xb0')](_0xe765e8[_0xff17('0x6a')],[_0xff17('0xb1'),'id'])||{});}})[_0xff17('0x22')](respondWithResult(_0x429b4b,null))['catch'](handleError(_0x429b4b,null));};exports[_0xff17('0xb2')]=function(_0x4ebfe9,_0x2b23c2,_0x16bd3f){var _0x2448a1={'raw':![],'where':{}};var _0x5affc0={};var _0x2261a7={'count':0x0,'rows':[]};return db[_0xff17('0x30')][_0xff17('0xb3')]({'where':{'id':_0x4ebfe9[_0xff17('0xab')]['id']}})['then'](handleEntityNotFound(_0x2b23c2,null))[_0xff17('0x22')](function(_0x480b07){if(_0x480b07){_0x5affc0[_0xff17('0x34')]=_[_0xff17('0x6c')](db[_0xff17('0xb4')]['rawAttributes']);_0x5affc0[_0xff17('0x35')]=_[_0xff17('0x6c')](_0x4ebfe9[_0xff17('0x35')]);_0x5affc0[_0xff17('0x3d')]=_[_0xff17('0x36')](_0x5affc0['model'],_0x5affc0[_0xff17('0x35')]);_0x2448a1[_0xff17('0x37')]=_[_0xff17('0x36')](_0x5affc0[_0xff17('0x34')],qs[_0xff17('0x38')](_0x4ebfe9[_0xff17('0x35')][_0xff17('0x38')]));_0x2448a1[_0xff17('0x37')]=_0x2448a1[_0xff17('0x37')][_0xff17('0x57')]?_0x2448a1[_0xff17('0x37')]:_0x5affc0[_0xff17('0x34')];if(!_0x4ebfe9[_0xff17('0x35')][_0xff17('0x39')]('nolimit')){_0x2448a1[_0xff17('0xa4')]=qs['limit'](_0x4ebfe9[_0xff17('0x35')][_0xff17('0xa4')]);_0x2448a1[_0xff17('0x1c')]=qs['offset'](_0x4ebfe9[_0xff17('0x35')][_0xff17('0x1c')]);}_0x2448a1[_0xff17('0x87')]=qs[_0xff17('0x3b')](_0x4ebfe9[_0xff17('0x35')][_0xff17('0x3b')]);_0x2448a1[_0xff17('0x3c')]=qs[_0xff17('0x3d')](_[_0xff17('0x3e')](_0x4ebfe9[_0xff17('0x35')],_0x5affc0[_0xff17('0x3d')]));_0x2448a1[_0xff17('0x3c')][_0xff17('0xa7')]=_0x480b07['id'];if(_0x4ebfe9[_0xff17('0x35')][_0xff17('0x7b')]){_0x2448a1[_0xff17('0x3c')]=_['merge'](_0x2448a1[_0xff17('0x3c')],{'$or':_[_0xff17('0x29')](_0x2448a1['attributes'],function(_0xf1293){var _0x4da336={};_0x4da336[_0xf1293]={'$like':'%'+_0x4ebfe9[_0xff17('0x35')][_0xff17('0x7b')]+'%'};return _0x4da336;})});}if(_0x4ebfe9[_0xff17('0x35')][_0xff17('0x73')]){var _0x259439=_0x4ebfe9[_0xff17('0x35')][_0xff17('0x73')]['split'](',');var _0x56997c={};_0x56997c[_0x259439[0x0]]={'$gte':moment(_0x259439[0x1])[_0xff17('0xb5')](_0xff17('0xb6'))};_0x2448a1[_0xff17('0x3c')]=_[_0xff17('0x91')](_0x2448a1[_0xff17('0x3c')],_0x56997c);}_0x2448a1=_[_0xff17('0x91')]({},_0x2448a1,_0x4ebfe9[_0xff17('0xb7')]);return db[_0xff17('0xb4')]['count']({'where':_0x2448a1[_0xff17('0x3c')]})[_0xff17('0x22')](function(_0x155043){_0x2261a7[_0xff17('0x1b')]=_0x155043;if(_0x4ebfe9[_0xff17('0x35')]['includeAll']){_0x2448a1['include']=[{'all':!![]}];}return db['FaxMessage'][_0xff17('0xb8')](_0x2448a1);})[_0xff17('0x22')](function(_0x2420a0){_0x2261a7['rows']=_0x2420a0;return _0x2261a7;});}})[_0xff17('0x22')](respondWithFilteredResult(_0x2b23c2,_0x2448a1))[_0xff17('0xaa')](handleError(_0x2b23c2,null));};exports[_0xff17('0xb9')]=function(_0x552cb7,_0x4c9484,_0x1f4f91){return db[_0xff17('0x30')][_0xff17('0x60')]({'where':{'id':_0x552cb7[_0xff17('0xab')]['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x4c9484,null))[_0xff17('0x22')](function(_0x51af6b){if(_0x51af6b){return _0x51af6b['setTags'](_0x552cb7[_0xff17('0x6a')][_0xff17('0xb1')],_['omit'](_0x552cb7[_0xff17('0x6a')],[_0xff17('0xb1'),'id'])||{})[_0xff17('0xba')](function(){return db[_0xff17('0x64')][_0xff17('0xb8')]({'attributes':['id',_0xff17('0x26'),_0xff17('0x41')],'where':{'id':_0x552cb7[_0xff17('0x6a')][_0xff17('0xb1')]}});})['then'](function(_0x4ab22e){socket[_0xff17('0xbb')](_0xff17('0xbc'),{'id':Number(_0x552cb7['params']['id']),'tags':_0x4ab22e||[]});return{'id':Number(_0x552cb7['params']['id']),'tags':_0x4ab22e||[]};});}})[_0xff17('0x22')](respondWithResult(_0x4c9484,null))['catch'](handleError(_0x4c9484,null));};exports[_0xff17('0xbd')]=function(_0x66a1a8,_0x110a8a,_0x56711c){return db['FaxInteraction'][_0xff17('0x60')]({'where':{'id':_0x66a1a8[_0xff17('0xab')]['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x110a8a,null))[_0xff17('0x22')](function(_0x21eef2){if(_0x21eef2){return _0x21eef2['removeTags'](_0x66a1a8[_0xff17('0x35')]['ids']);}})[_0xff17('0x22')](respondWithStatusCode(_0x110a8a,null))[_0xff17('0xaa')](handleError(_0x110a8a,null));};exports[_0xff17('0xbe')]=function(_0x1ad959,_0x400701){var _0xb00e1f=moment()[_0xff17('0xbf')]()[_0xff17('0x8f')]();var _0x4cec66=path['join'](config['root'],_0xff17('0xc0'),_0xff17('0xc1'),_0xff17('0xc2'));var _0x13c055=path[_0xff17('0xc3')](config[_0xff17('0xc4')],_0xff17('0xc0'),_0xff17('0xc1'),_0xff17('0xc5'));var _0x3181e4=path['join'](_0x4cec66,_0xb00e1f);var _0x200404=util[_0xff17('0xb5')]('transcript-%d-%s.zip',_0x1ad959['params']['id'],_0xb00e1f);var _0x1c43e0=path['join'](_0x4cec66,_0x200404);var _0x43764e=[];_0x43764e[_0xff17('0x2f')]({'model':db[_0xff17('0xc6')],'as':'Attachment','raw':!![]});var _0x5a1c78=[{'model':db[_0xff17('0xb4')],'as':_0xff17('0xc7'),'attributes':['id',_0xff17('0x6a'),_0xff17('0xc8')],'include':_0x43764e}];return db['FaxInteraction']['find']({'where':{'id':_0x1ad959[_0xff17('0xab')]['id']},'include':_0x5a1c78})[_0xff17('0x22')](handleEntityNotFound(_0x400701,null))[_0xff17('0x22')](function(_0x1ada5b){if(_0x1ada5b&&_0x1ada5b[_0xff17('0xc7')]){var _0x5f3890=_0x1ada5b[_0xff17('0xc9')]({'plain':!![]});fs[_0xff17('0xca')](_0x3181e4);for(var _0x3a12c8=0x0;_0x3a12c8<_0x5f3890['Messages'][_0xff17('0x57')];_0x3a12c8++){var _0x2279b7=_0x5f3890[_0xff17('0xc7')][_0x3a12c8][_0xff17('0xc6')];if(_0x2279b7){var _0x19ddbc=path[_0xff17('0xc3')](_0x13c055,_0x2279b7['basename']);if(fs[_0xff17('0xcb')](_0x19ddbc)){fs['createReadStream'](_0x19ddbc)[_0xff17('0xcc')](fs[_0xff17('0xcd')](path['join'](_0x3181e4,_0x2279b7[_0xff17('0xce')])));}}}return BPromise[_0xff17('0x88')]()[_0xff17('0x22')](function(){return new BPromise(function(_0x5a56c8,_0x3f3765){zipdir(_0x3181e4,{'saveTo':_0x1c43e0},function(_0x545acb,_0xbe32ae){if(_0x545acb)return _0x3f3765(_0x545acb);return _0x5a56c8(_0xbe32ae);});})[_0xff17('0x22')](function(){return new BPromise(function(_0x26082f,_0x2bdb47){rimraf(_0x3181e4,function(_0x341512){if(_0x341512)_0x2bdb47(_0x341512);return _0x26082f();});});})[_0xff17('0x22')](function(){return _0x400701['download'](_0x1c43e0,_0x200404,function(_0x97d1de){if(_0x97d1de){console[_0xff17('0xcf')](_0xff17('0xd0'),_0x97d1de);}else{fs['unlinkSync'](_0x1c43e0);}});});});}else{return _0x400701[_0xff17('0x25')](0xc8);}})['catch'](handleError(_0x400701,null));}; \ No newline at end of file +var _0xc4e1=['Tags','TagIds','split','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','compact','isEmpty','forEach','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','push','all','rows','catch','show','params','includeAll','include','merge','create','body','destroy','describe','ids','omit','getMessages','findOne','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','spread','emit','faxInteractionTags:save','download','join','server','files','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','Users','map'];(function(_0x4091da,_0x5740a4){var _0xa14d25=function(_0xa75e86){while(--_0xa75e86){_0x4091da['push'](_0x4091da['shift']());}};_0xa14d25(++_0x5740a4);}(_0xc4e1,0x172));var _0x1c4e=function(_0x17c30c,_0x1b410a){_0x17c30c=_0x17c30c-0x0;var _0x3e86c1=_0xc4e1[_0x17c30c];return _0x3e86c1;};'use strict';var pdf=require(_0x1c4e('0x0'));var emlformat=require(_0x1c4e('0x1'));var rimraf=require(_0x1c4e('0x2'));var zipdir=require(_0x1c4e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c4e('0x4'));var moment=require('moment');var BPromise=require(_0x1c4e('0x5'));var Mustache=require('mustache');var util=require(_0x1c4e('0x6'));var path=require('path');var sox=require(_0x1c4e('0x7'));var csv=require(_0x1c4e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c4e('0x9'));var squel=require(_0x1c4e('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c4e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c4e('0xc'));var Papa=require('papaparse');var Redis=require(_0x1c4e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1c4e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c4e('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1c4e('0x10'));var db=require(_0x1c4e('0x11'))['db'];config[_0x1c4e('0x12')]=_['defaults'](config[_0x1c4e('0x12')],{'host':_0x1c4e('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0x1c4e('0x14')](socket);function respondWithStatusCode(_0x2b6459,_0x5889db){_0x5889db=_0x5889db||0xcc;return function(_0x9d8629){if(_0x9d8629){return _0x2b6459[_0x1c4e('0x15')](_0x5889db);}return _0x2b6459[_0x1c4e('0x16')](_0x5889db)[_0x1c4e('0x17')]();};}function respondWithResult(_0x2d55bb,_0x4b12b3){_0x4b12b3=_0x4b12b3||0xc8;return function(_0x17259a){if(_0x17259a){return _0x2d55bb[_0x1c4e('0x16')](_0x4b12b3)['json'](_0x17259a);}};}function respondWithFilteredResult(_0x4a5786,_0x572737){return function(_0x54ef20){if(_0x54ef20){var _0x285d65=_0x54ef20[_0x1c4e('0x18')],_0x3d980a=_0x572737[_0x1c4e('0x19')],_0x4faa6a=_0x572737[_0x1c4e('0x19')]+_0x572737[_0x1c4e('0x1a')],_0x17cb13;if(_0x4faa6a>=_0x285d65){_0x4faa6a=_0x285d65;_0x17cb13=0xc8;}else{_0x17cb13=0xce;}_0x4a5786[_0x1c4e('0x16')](_0x17cb13);return _0x4a5786[_0x1c4e('0x1b')](_0x1c4e('0x1c'),_0x3d980a+'-'+_0x4faa6a+'/'+_0x285d65)[_0x1c4e('0x1d')](_0x54ef20);}return null;};}function patchUpdates(_0x491fdb){return function(_0xadbff8){try{jsonpatch['apply'](_0xadbff8,_0x491fdb,!![]);}catch(_0x29b574){return BPromise[_0x1c4e('0x1e')](_0x29b574);}return _0xadbff8[_0x1c4e('0x1f')]();};}function saveUpdates(_0x1353e4,_0xb79c5){return function(_0x4d7871){if(_0x4d7871){return _0x4d7871[_0x1c4e('0x20')](_0x1353e4)[_0x1c4e('0x21')](function(_0x20f93d){return _0x20f93d;});}return null;};}function removeEntity(_0x41bbe6,_0x18ee91){return function(_0x179a2b){if(_0x179a2b){return _0x179a2b['destroy']()[_0x1c4e('0x21')](function(){_0x41bbe6[_0x1c4e('0x16')](0xcc)[_0x1c4e('0x17')]();});}};}function handleEntityNotFound(_0x1ec251,_0x2bf026){return function(_0x3a2c40){if(!_0x3a2c40){_0x1ec251['sendStatus'](0x194);}return _0x3a2c40;};}function handleError(_0x133b6a,_0x2e2d32){_0x2e2d32=_0x2e2d32||0x1f4;return function(_0x5925aa){logger[_0x1c4e('0x22')](_0x5925aa[_0x1c4e('0x23')]);if(_0x5925aa[_0x1c4e('0x24')]){delete _0x5925aa[_0x1c4e('0x24')];}_0x133b6a['status'](_0x2e2d32)[_0x1c4e('0x25')](_0x5925aa);};}function getInteractionUsers(_0xd843da,_0x2ae1d1){return new BPromise(function(_0x536e52,_0x111bec){try{if(_0x2ae1d1[_0xd843da['id']]){_0xd843da[_0x1c4e('0x26')]=_[_0x1c4e('0x27')](_0x2ae1d1[_0xd843da['id']],function(_0x1b354c){return{'id':_0x1b354c['id'],'fullname':_0x1b354c['fullname']};});}}catch(_0x31ed66){_0x111bec(_0x31ed66);}_0x536e52(_0xd843da);});}function getInteractionTags(_0x37f50b,_0x32eb93){return new BPromise(function(_0x1166c9,_0x5005a6){try{if(_0x37f50b['TagIds']){_0x37f50b[_0x1c4e('0x28')]=[];_0x37f50b[_0x1c4e('0x29')][_0x1c4e('0x2a')](',')['forEach'](function(_0x340268){_0x37f50b[_0x1c4e('0x28')]['push'](_0x32eb93[_0x340268]);});}delete _0x37f50b[_0x1c4e('0x29')];}catch(_0x404057){_0x5005a6(_0x404057);}_0x1166c9(_0x37f50b);});}function updateFaxInteraction(_0x2038f5,_0x1333eb,_0x216cf4){return new BPromise(function(_0x53da71,_0x212fe0){return getInteractionUsers(_0x2038f5,_0x216cf4)[_0x1c4e('0x21')](function(_0x1e2559){return getInteractionTags(_0x1e2559,_0x1333eb);})[_0x1c4e('0x21')](function(_0x28dc1f){_0x53da71(_0x28dc1f);})['catch'](function(_0xf09509){_0x212fe0(_0xf09509);});});}exports['index']=function(_0x1fff83,_0x2fd7ef){var _0x165fbb={},_0x18a038={},_0x2b386a={'count':0x0,'rows':[]};var _0x4bc375=_[_0x1c4e('0x27')](db[_0x1c4e('0x2b')][_0x1c4e('0x2c')],function(_0x8f6786){return{'name':_0x8f6786[_0x1c4e('0x2d')],'type':_0x8f6786[_0x1c4e('0x2e')][_0x1c4e('0x2f')]};});_0x18a038[_0x1c4e('0x30')]=_[_0x1c4e('0x27')](_0x4bc375,_0x1c4e('0x24'));_0x18a038[_0x1c4e('0x31')]=_[_0x1c4e('0x32')](_0x1fff83[_0x1c4e('0x31')]);_0x18a038['filters']=_[_0x1c4e('0x33')](_0x18a038[_0x1c4e('0x30')],_0x18a038[_0x1c4e('0x31')]);_0x165fbb[_0x1c4e('0x34')]=_[_0x1c4e('0x33')](_0x18a038['model'],qs[_0x1c4e('0x35')](_0x1fff83['query']['fields']));_0x165fbb[_0x1c4e('0x34')]=_0x165fbb['attributes'][_0x1c4e('0x36')]?_0x165fbb[_0x1c4e('0x34')]:_0x18a038['model'];if(!_0x1fff83['query'][_0x1c4e('0x37')](_0x1c4e('0x38'))){_0x165fbb[_0x1c4e('0x1a')]=qs[_0x1c4e('0x1a')](_0x1fff83['query']['limit']);_0x165fbb['offset']=qs['offset'](_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x19')]);}_0x165fbb[_0x1c4e('0x39')]=qs[_0x1c4e('0x3a')](_0x1fff83[_0x1c4e('0x31')]['sort']);_0x165fbb['where']=qs[_0x1c4e('0x3b')](_[_0x1c4e('0x3c')](_0x1fff83[_0x1c4e('0x31')],_0x18a038[_0x1c4e('0x3b')]),_0x4bc375);var _0x5179d9=[];var _0xb1102d=squel['select']()['field']('id')[_0x1c4e('0x3d')](_0x1c4e('0x24'))['field'](_0x1c4e('0x3e'))[_0x1c4e('0x3f')](_0x1c4e('0x40'));var _0x34a0f2=squel[_0x1c4e('0x41')]()['field'](_0x1c4e('0x42'))['field'](_0x1c4e('0x43'))['field'](_0x1c4e('0x44'))[_0x1c4e('0x3f')](_0x1c4e('0x45'),'ui')[_0x1c4e('0x46')](_0x1c4e('0x47'),'u',_0x1c4e('0x48'));var _0x2d9204=squel[_0x1c4e('0x41')]()[_0x1c4e('0x3f')](_0x1c4e('0x49'),'i')[_0x1c4e('0x46')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1c4e('0x46')]('users','o','o.id\x20=\x20i.UserId')[_0x1c4e('0x46')](_0x1c4e('0x4a'),'a',_0x1c4e('0x4b'))[_0x1c4e('0x46')](_0x1c4e('0x4c'),'me',_0x1c4e('0x4d'))[_0x1c4e('0x46')](_0x1c4e('0x4e'),'it',_0x1c4e('0x4f'))[_0x1c4e('0x46')](_0x1c4e('0x40'),'t','t.id\x20=\x20it.TagId');var _0x219b6b=squel[_0x1c4e('0x50')]();var _0x281ca7=[];var _0x3cc44f=squel[_0x1c4e('0x50')]();var _0x4169b7;if(_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x51')]){_0x4169b7=as['parseSearch'](_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x51')]);var _0x5a7d19=_0x4169b7[_0x1c4e('0x52')];for(var _0x36ad9d=0x0;_0x36ad9d<_0x4169b7[_0x1c4e('0x53')]['length'];_0x36ad9d++){var _0x5196aa=_0x4169b7['conditions'][_0x36ad9d];var _0x1a1d88='i';var _0x232bbe=_[_0x1c4e('0x54')](_0x4bc375,[_0x1c4e('0x24'),_0x5196aa['field']]);if(!_0x232bbe){switch(_0x5196aa['field']){case _0x1c4e('0x55'):if(_0x5196aa[_0x1c4e('0x56')]==0x1){_0x2d9204[_0x1c4e('0x57')]('`'+_0x5196aa['field']+_0x1c4e('0x58'));}else{_0x2d9204[_0x1c4e('0x57')]('`'+_0x5196aa[_0x1c4e('0x3d')]+_0x1c4e('0x59'));}break;case'Contact':if(_0x5196aa[_0x1c4e('0x5a')]===_0x1c4e('0x5b')){if(_0x5196aa[_0x1c4e('0x56')][_0x1c4e('0x2a')]('\x20')[_0x1c4e('0x36')]>0x1){_0x219b6b[_0x5a7d19](_0x1c4e('0x5c'),qs[_0x1c4e('0x5d')](_0x5196aa[_0x1c4e('0x56')]),null);}else{var _0x1fb50f='%'+_0x5196aa[_0x1c4e('0x56')]+'%';_0x219b6b[_0x5a7d19](_0x1c4e('0x5e'),_0x1fb50f,_0x1fb50f,_0x1fb50f);}}else{_0x232bbe=_[_0x1c4e('0x54')](_0x4bc375,['name',_0x1c4e('0x5f')]);_0x5196aa['field']=_0x1c4e('0x5f');_0x478384=as['buildExpression'](_0x1a1d88,_0x232bbe[_0x1c4e('0x2e')],_0x5196aa);_0x219b6b[_0x5a7d19](_0x478384[_0x1c4e('0x60')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x61')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x17')]);}break;case _0x1c4e('0x62'):var _0x3f75b0=_0x5196aa['value']['split'](',')[_0x1c4e('0x27')](function(_0x4e81a2){return Number(_0x4e81a2);});_0x3f75b0['forEach'](function(_0x7c6ee8){_0x3cc44f['or'](_0x1c4e('0x63'),'%,'+_0x7c6ee8+',%');});_0x281ca7=_[_0x1c4e('0x64')](_0x281ca7,_0x3f75b0);break;case _0x1c4e('0x65'):if(_0x5196aa[_0x1c4e('0x5a')]===_0x1c4e('0x5b')){_0x219b6b[_0x5a7d19](_0x1c4e('0x66'),'%'+_0x5196aa[_0x1c4e('0x56')]+'%',null);}else{_0x232bbe=_[_0x1c4e('0x54')](_0x4bc375,[_0x1c4e('0x24'),_0x1c4e('0x67')]);_0x5196aa[_0x1c4e('0x3d')]=_0x1c4e('0x67');_0x478384=as[_0x1c4e('0x68')](_0x1a1d88,_0x232bbe[_0x1c4e('0x2e')],_0x5196aa);_0x219b6b[_0x5a7d19](_0x478384[_0x1c4e('0x60')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x61')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x17')]);}break;case'body':_0x478384=as[_0x1c4e('0x68')]('me',null,_0x5196aa);_0x219b6b[_0x5a7d19](_0x478384[_0x1c4e('0x60')],_0x478384['value'][_0x1c4e('0x61')],_0x478384['value'][_0x1c4e('0x17')]);break;}}else{var _0x478384=as[_0x1c4e('0x68')](_0x1a1d88,_0x232bbe['type'],_0x5196aa);_0x219b6b[_0x5a7d19](_0x478384[_0x1c4e('0x60')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x61')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x17')]);}}}else{var _0x211ae2=_(_0x1fff83[_0x1c4e('0x31')])[_0x1c4e('0x32')]()[_0x1c4e('0x27')](function(_0x99d68e){return _['some'](_0x4bc375,['name',_0x99d68e])?_0x99d68e:undefined;})[_0x1c4e('0x69')]()['value']();if(!_[_0x1c4e('0x6a')](_0x211ae2)){_0x211ae2[_0x1c4e('0x6b')](function(_0x15dea5){if(_0x15dea5===_0x1c4e('0x6c')){_0x2d9204[_0x1c4e('0x6d')](_0x1c4e('0x6e'),[][_0x1c4e('0x6f')](_0x1fff83[_0x1c4e('0x31')][_0x15dea5]));}else if(_0x15dea5===_0x1c4e('0x70')){var _0x5a1e4d=JSON[_0x1c4e('0x71')](_0x1fff83[_0x1c4e('0x31')][_0x15dea5])[_0x1c4e('0x72')];var _0x594cc3=JSON[_0x1c4e('0x71')](_0x1fff83[_0x1c4e('0x31')][_0x15dea5])[_0x1c4e('0x73')];_0x2d9204[_0x1c4e('0x6d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5a1e4d,_0x594cc3);}else{if(_0x1fff83['query'][_0x15dea5]===_0x1c4e('0x74')){_0x2d9204['where']('i.'+_0x15dea5+_0x1c4e('0x75'));}else{_0x2d9204[_0x1c4e('0x6d')]('i.'+_0x15dea5+_0x1c4e('0x76'),_0x1fff83[_0x1c4e('0x31')][_0x15dea5]);}}});}if(_0x1fff83['query']['read']){if(_0x1fff83[_0x1c4e('0x31')]['read']==0x1){_0x2d9204[_0x1c4e('0x57')]('`unreadMessages`\x20=\x200');}else{_0x2d9204[_0x1c4e('0x57')]('`unreadMessages`\x20>\x200');}}if(_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x77')]){_0x281ca7=_[_0x1c4e('0x78')](_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x77')])?_0x1fff83[_0x1c4e('0x31')]['tag']:new Array(_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x77')]);_0x281ca7[_0x1c4e('0x6b')](function(_0x246390){_0x3cc44f['or'](_0x1c4e('0x63'),'%,'+_0x246390+',%');});}if(_0x1fff83['query'][_0x1c4e('0x79')]){var _0x456339=_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x79')]['replace']('\x5c','\x5c\x5c')[_0x1c4e('0x7a')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x1c4e('0x7b')](_0x456339)){_0x219b6b['or'](_0x1c4e('0x7c'),_0x456339+'%')['or']('i.fax\x20LIKE\x20?',_0x456339+'%');}_0x219b6b['or'](_0x1c4e('0x7d'),_0x456339+'%');}}_0x2d9204[_0x1c4e('0x6d')](_0x219b6b);_0x2d9204[_0x1c4e('0x7e')](_0x1c4e('0x7f'));var _0x56274a={'type':db[_0x1c4e('0x80')][_0x1c4e('0x81')][_0x1c4e('0x82')],'raw':!![]};var _0x920730=_0x2d9204[_0x1c4e('0x83')]();_0x920730[_0x1c4e('0x3d')](_0x1c4e('0x7f'));_0x920730[_0x1c4e('0x3d')](_0x1c4e('0x84'),_0x1c4e('0x55'));if(_0x165fbb['order']){_0x165fbb[_0x1c4e('0x39')][_0x1c4e('0x6b')](function(_0x49f6b4){_0x2d9204[_0x1c4e('0x39')]('i.'+_0x49f6b4[0x0],_0x49f6b4[0x1]===_0x1c4e('0x85')?![]:!![]);});}if(!_[_0x1c4e('0x6a')](_0x281ca7)){_0x2d9204[_0x1c4e('0x57')](_0x3cc44f);_0x920730[_0x1c4e('0x6d')](_0x1c4e('0x86'),_0x281ca7);}BPromise[_0x1c4e('0x87')]()[_0x1c4e('0x21')](function(){if(!_0x4169b7){if(_0x1fff83[_0x1c4e('0x31')]['FaxAccountId']||_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x88')])return;_0x920730[_0x1c4e('0x6d')](_0x1c4e('0x89'));_0x2d9204['where'](_0x1c4e('0x89'));return;}return _0x1fff83[_0x1c4e('0x8a')][_0x1c4e('0x8b')]({'attributes':['id'],'raw':!![]})[_0x1c4e('0x21')](function(_0x3575b5){if(_[_0x1c4e('0x6a')](_0x3575b5)){_0x920730['where']('i.FaxAccountId\x20IS\x20NULL');_0x2d9204['where'](_0x1c4e('0x8c'));}else{_0x920730[_0x1c4e('0x6d')](_0x1c4e('0x6e'),_[_0x1c4e('0x27')](_0x3575b5,'id'));_0x2d9204[_0x1c4e('0x6d')](_0x1c4e('0x6e'),_[_0x1c4e('0x27')](_0x3575b5,'id'));}});})[_0x1c4e('0x21')](function(){db[_0x1c4e('0x8d')][_0x1c4e('0x31')](_0x920730[_0x1c4e('0x8e')](),_0x56274a)['then'](function(_0x46d6c5){_0x2b386a[_0x1c4e('0x18')]=_0x46d6c5['length'];if(_0x2b386a['count']===0x0)return[];return db['sequelize'][_0x1c4e('0x31')](_0xb1102d[_0x1c4e('0x8e')](),_0x56274a)[_0x1c4e('0x21')](function(_0xf23e50){_0x5179d9=_[_0x1c4e('0x8f')](_0xf23e50,'id');_0x56274a=_['merge'](_0x56274a,{'model':db[_0x1c4e('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x35')]){_0x165fbb[_0x1c4e('0x34')]['forEach'](function(_0x378c0f){_0x2d9204[_0x1c4e('0x3d')]('i.'+_0x378c0f);});}else{_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x84'),'unreadMessages');_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x90'),'Account.key');_0x2d9204['field'](_0x1c4e('0x91'),_0x1c4e('0x92'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x93'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x94'),'Contact.firstName');_0x2d9204[_0x1c4e('0x3d')]('c.lastName','Contact.lastName');_0x2d9204['field'](_0x1c4e('0x95'),'Contact.email');_0x2d9204[_0x1c4e('0x3d')]('c.phone',_0x1c4e('0x96'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x97'),'Contact.mobile');_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x98'),_0x1c4e('0x99'));_0x2d9204['field'](_0x1c4e('0x9a'),_0x1c4e('0x9b'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x9c'),_0x1c4e('0x9d'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x9e'),_0x1c4e('0x29'));}if(_0x165fbb[_0x1c4e('0x1a')])_0x2d9204[_0x1c4e('0x1a')](_0x165fbb[_0x1c4e('0x1a')]);if(_0x165fbb[_0x1c4e('0x19')])_0x2d9204[_0x1c4e('0x19')](_0x165fbb[_0x1c4e('0x19')]);return db[_0x1c4e('0x8d')][_0x1c4e('0x31')](_0x2d9204[_0x1c4e('0x8e')](),_0x56274a);})[_0x1c4e('0x21')](function(_0x5b94e9){_0x34a0f2[_0x1c4e('0x6d')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x5b94e9,'id'));return db[_0x1c4e('0x8d')]['query'](_0x34a0f2[_0x1c4e('0x8e')](),_0x56274a)[_0x1c4e('0x21')](function(_0x5a1474){var _0x431dff=_['groupBy'](_0x5a1474,_0x1c4e('0x9f'));var _0x2aac85=[];_0x5b94e9[_0x1c4e('0x6b')](function(_0x2e8b07){_0x2aac85[_0x1c4e('0xa0')](updateFaxInteraction(_0x2e8b07,_0x5179d9,_0x431dff));});return BPromise[_0x1c4e('0xa1')](_0x2aac85);});});})['then'](function(_0x4c0b7f){_0x2b386a[_0x1c4e('0xa2')]=_0x4c0b7f;return _0x2b386a;})['then'](respondWithFilteredResult(_0x2fd7ef,_0x165fbb));})[_0x1c4e('0xa3')](handleError(_0x2fd7ef,null));};exports[_0x1c4e('0xa4')]=function(_0x1fee23,_0x1f3979){var _0x1a40ff={'raw':![],'where':{'id':_0x1fee23[_0x1c4e('0xa5')]['id']}},_0xae06cf={};_0xae06cf[_0x1c4e('0x30')]=_[_0x1c4e('0x32')](db[_0x1c4e('0x2b')][_0x1c4e('0x2c')]);_0xae06cf[_0x1c4e('0x31')]=_['keys'](_0x1fee23[_0x1c4e('0x31')]);_0xae06cf[_0x1c4e('0x3b')]=_['intersection'](_0xae06cf[_0x1c4e('0x30')],_0xae06cf[_0x1c4e('0x31')]);_0x1a40ff[_0x1c4e('0x34')]=_['intersection'](_0xae06cf[_0x1c4e('0x30')],qs[_0x1c4e('0x35')](_0x1fee23[_0x1c4e('0x31')][_0x1c4e('0x35')]));_0x1a40ff['attributes']=_0x1a40ff[_0x1c4e('0x34')][_0x1c4e('0x36')]?_0x1a40ff[_0x1c4e('0x34')]:_0xae06cf[_0x1c4e('0x30')];if(_0x1fee23[_0x1c4e('0x31')][_0x1c4e('0xa6')]){_0x1a40ff[_0x1c4e('0xa7')]=[{'all':!![]}];}_0x1a40ff=_[_0x1c4e('0xa8')]({},_0x1a40ff,_0x1fee23['options']);return db[_0x1c4e('0x2b')][_0x1c4e('0x54')](_0x1a40ff)[_0x1c4e('0x21')](handleEntityNotFound(_0x1f3979,null))[_0x1c4e('0x21')](respondWithResult(_0x1f3979,null))['catch'](handleError(_0x1f3979,null));};exports['create']=function(_0x459c01,_0x3cd41d){return db[_0x1c4e('0x2b')][_0x1c4e('0xa9')](_0x459c01[_0x1c4e('0xaa')],{})[_0x1c4e('0x21')](respondWithResult(_0x3cd41d,0xc9))[_0x1c4e('0xa3')](handleError(_0x3cd41d,null));};exports[_0x1c4e('0x20')]=function(_0x1a2833,_0x3cba43){if(_0x1a2833[_0x1c4e('0xaa')]['id']){delete _0x1a2833[_0x1c4e('0xaa')]['id'];}return db[_0x1c4e('0x2b')][_0x1c4e('0x54')]({'where':{'id':_0x1a2833[_0x1c4e('0xa5')]['id']}})['then'](handleEntityNotFound(_0x3cba43,null))['then'](saveUpdates(_0x1a2833[_0x1c4e('0xaa')],null))[_0x1c4e('0x21')](respondWithResult(_0x3cba43,null))[_0x1c4e('0xa3')](handleError(_0x3cba43,null));};exports[_0x1c4e('0xab')]=function(_0x453ad7,_0x3aa67f){return db[_0x1c4e('0x2b')][_0x1c4e('0x54')]({'where':{'id':_0x453ad7[_0x1c4e('0xa5')]['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x3aa67f,null))['then'](removeEntity(_0x3aa67f,null))[_0x1c4e('0xa3')](handleError(_0x3aa67f,null));};exports[_0x1c4e('0xac')]=function(_0x44c61c,_0x7c1b34){return db[_0x1c4e('0x2b')]['describe']()[_0x1c4e('0x21')](respondWithResult(_0x7c1b34,null))[_0x1c4e('0xa3')](handleError(_0x7c1b34,null));};exports['addMessage']=function(_0x308658,_0x27223b,_0xfe2df4){return db['FaxMessage'][_0x1c4e('0x54')]({'where':{'id':_0x308658[_0x1c4e('0xa5')]['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x27223b,null))[_0x1c4e('0x21')](function(_0x1d14f3){if(_0x1d14f3){return _0x1d14f3['addMessage'](_0x308658['body'][_0x1c4e('0xad')],_[_0x1c4e('0xae')](_0x308658['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x27223b,null))[_0x1c4e('0xa3')](handleError(_0x27223b,null));};exports[_0x1c4e('0xaf')]=function(_0x2c680f,_0x4672b3,_0x1e3fb){var _0x2c50c5={'raw':![],'where':{}};var _0xf07fa7={};var _0x5055db={'count':0x0,'rows':[]};return db[_0x1c4e('0x2b')][_0x1c4e('0xb0')]({'where':{'id':_0x2c680f[_0x1c4e('0xa5')]['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x4672b3,null))[_0x1c4e('0x21')](function(_0xd535f9){if(_0xd535f9){_0xf07fa7[_0x1c4e('0x30')]=_[_0x1c4e('0x32')](db[_0x1c4e('0xb1')][_0x1c4e('0x2c')]);_0xf07fa7[_0x1c4e('0x31')]=_[_0x1c4e('0x32')](_0x2c680f[_0x1c4e('0x31')]);_0xf07fa7[_0x1c4e('0x3b')]=_[_0x1c4e('0x33')](_0xf07fa7[_0x1c4e('0x30')],_0xf07fa7[_0x1c4e('0x31')]);_0x2c50c5[_0x1c4e('0x34')]=_['intersection'](_0xf07fa7[_0x1c4e('0x30')],qs['fields'](_0x2c680f[_0x1c4e('0x31')][_0x1c4e('0x35')]));_0x2c50c5[_0x1c4e('0x34')]=_0x2c50c5[_0x1c4e('0x34')][_0x1c4e('0x36')]?_0x2c50c5[_0x1c4e('0x34')]:_0xf07fa7['model'];if(!_0x2c680f[_0x1c4e('0x31')]['hasOwnProperty'](_0x1c4e('0x38'))){_0x2c50c5['limit']=qs[_0x1c4e('0x1a')](_0x2c680f['query'][_0x1c4e('0x1a')]);_0x2c50c5[_0x1c4e('0x19')]=qs[_0x1c4e('0x19')](_0x2c680f[_0x1c4e('0x31')]['offset']);}_0x2c50c5['order']=qs[_0x1c4e('0x3a')](_0x2c680f[_0x1c4e('0x31')][_0x1c4e('0x3a')]);_0x2c50c5[_0x1c4e('0x6d')]=qs[_0x1c4e('0x3b')](_[_0x1c4e('0x3c')](_0x2c680f[_0x1c4e('0x31')],_0xf07fa7[_0x1c4e('0x3b')]));_0x2c50c5[_0x1c4e('0x6d')][_0x1c4e('0x9f')]=_0xd535f9['id'];if(_0x2c680f['query'][_0x1c4e('0x79')]){_0x2c50c5['where']=_[_0x1c4e('0xa8')](_0x2c50c5['where'],{'$or':_[_0x1c4e('0x27')](_0x2c50c5[_0x1c4e('0x34')],function(_0x2644cf){var _0x42ed1d={};_0x42ed1d[_0x2644cf]={'$like':'%'+_0x2c680f[_0x1c4e('0x31')][_0x1c4e('0x79')]+'%'};return _0x42ed1d;})});}if(_0x2c680f['query'][_0x1c4e('0x72')]){var _0x1faeee=_0x2c680f[_0x1c4e('0x31')][_0x1c4e('0x72')][_0x1c4e('0x2a')](',');var _0x3aa357={};_0x3aa357[_0x1faeee[0x0]]={'$gte':moment(_0x1faeee[0x1])[_0x1c4e('0xb2')](_0x1c4e('0xb3'))};_0x2c50c5[_0x1c4e('0x6d')]=_[_0x1c4e('0xa8')](_0x2c50c5[_0x1c4e('0x6d')],_0x3aa357);}_0x2c50c5=_[_0x1c4e('0xa8')]({},_0x2c50c5,_0x2c680f[_0x1c4e('0xb4')]);return db['FaxMessage'][_0x1c4e('0x18')]({'where':_0x2c50c5[_0x1c4e('0x6d')]})['then'](function(_0x241aa8){_0x5055db[_0x1c4e('0x18')]=_0x241aa8;if(_0x2c680f['query'][_0x1c4e('0xa6')]){_0x2c50c5[_0x1c4e('0xa7')]=[{'all':!![]}];}return db[_0x1c4e('0xb1')][_0x1c4e('0xb5')](_0x2c50c5);})['then'](function(_0x5bb92b){_0x5055db[_0x1c4e('0xa2')]=_0x5bb92b;return _0x5055db;});}})['then'](respondWithFilteredResult(_0x4672b3,_0x2c50c5))[_0x1c4e('0xa3')](handleError(_0x4672b3,null));};exports['addTags']=function(_0x4284d6,_0x423847,_0x1036ab){return db['FaxInteraction'][_0x1c4e('0x54')]({'where':{'id':_0x4284d6['params']['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x423847,null))[_0x1c4e('0x21')](function(_0x4b76ad){if(_0x4b76ad){return _0x4b76ad[_0x1c4e('0xb6')](_0x4284d6[_0x1c4e('0xaa')][_0x1c4e('0xad')],_[_0x1c4e('0xae')](_0x4284d6[_0x1c4e('0xaa')],[_0x1c4e('0xad'),'id'])||{})[_0x1c4e('0xb7')](function(){return db[_0x1c4e('0x62')][_0x1c4e('0xb5')]({'attributes':['id',_0x1c4e('0x24'),'color'],'where':{'id':_0x4284d6[_0x1c4e('0xaa')][_0x1c4e('0xad')]}});})[_0x1c4e('0x21')](function(_0x4a87da){socket[_0x1c4e('0xb8')](_0x1c4e('0xb9'),{'id':Number(_0x4284d6[_0x1c4e('0xa5')]['id']),'tags':_0x4a87da||[]});return{'id':Number(_0x4284d6[_0x1c4e('0xa5')]['id']),'tags':_0x4a87da||[]};});}})[_0x1c4e('0x21')](respondWithResult(_0x423847,null))[_0x1c4e('0xa3')](handleError(_0x423847,null));};exports['removeTags']=function(_0xb0a185,_0x124745,_0x5f5c18){return db[_0x1c4e('0x2b')]['find']({'where':{'id':_0xb0a185[_0x1c4e('0xa5')]['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x124745,null))[_0x1c4e('0x21')](function(_0x2eafae){if(_0x2eafae){return _0x2eafae['removeTags'](_0xb0a185[_0x1c4e('0x31')][_0x1c4e('0xad')]);}})[_0x1c4e('0x21')](respondWithStatusCode(_0x124745,null))[_0x1c4e('0xa3')](handleError(_0x124745,null));};exports[_0x1c4e('0xba')]=function(_0x414aa1,_0x5f4853){var _0x362d02=moment()['unix']()[_0x1c4e('0x8e')]();var _0x58d032=path[_0x1c4e('0xbb')](config['root'],_0x1c4e('0xbc'),_0x1c4e('0xbd'),'tmp');var _0x3dc7af=path['join'](config[_0x1c4e('0xbe')],'server',_0x1c4e('0xbd'),_0x1c4e('0xbf'));var _0x56714b=path['join'](_0x58d032,_0x362d02);var _0x4407ea=util['format'](_0x1c4e('0xc0'),_0x414aa1['params']['id'],_0x362d02);var _0x3bb03b=path[_0x1c4e('0xbb')](_0x58d032,_0x4407ea);var _0xf5a67a=[];_0xf5a67a[_0x1c4e('0xa0')]({'model':db['Attachment'],'as':_0x1c4e('0xc1'),'raw':!![]});var _0xd0959e=[{'model':db[_0x1c4e('0xb1')],'as':_0x1c4e('0xc2'),'attributes':['id','body',_0x1c4e('0x70')],'include':_0xf5a67a}];return db[_0x1c4e('0x2b')]['find']({'where':{'id':_0x414aa1[_0x1c4e('0xa5')]['id']},'include':_0xd0959e})[_0x1c4e('0x21')](handleEntityNotFound(_0x5f4853,null))[_0x1c4e('0x21')](function(_0x1055c0){if(_0x1055c0&&_0x1055c0[_0x1c4e('0xc2')]){var _0x2bbde2=_0x1055c0[_0x1c4e('0xc3')]({'plain':!![]});fs[_0x1c4e('0xc4')](_0x56714b);for(var _0x379412=0x0;_0x379412<_0x2bbde2[_0x1c4e('0xc2')]['length'];_0x379412++){var _0x1ad353=_0x2bbde2[_0x1c4e('0xc2')][_0x379412][_0x1c4e('0xc1')];if(_0x1ad353){var _0x41b1d8=path[_0x1c4e('0xbb')](_0x3dc7af,_0x1ad353[_0x1c4e('0xc5')]);if(fs[_0x1c4e('0xc6')](_0x41b1d8)){fs[_0x1c4e('0xc7')](_0x41b1d8)[_0x1c4e('0xc8')](fs[_0x1c4e('0xc9')](path['join'](_0x56714b,_0x1ad353[_0x1c4e('0xc5')])));}}}return BPromise[_0x1c4e('0x87')]()[_0x1c4e('0x21')](function(){return new BPromise(function(_0x309e8e,_0x148a3b){zipdir(_0x56714b,{'saveTo':_0x3bb03b},function(_0x218da1,_0x50b834){if(_0x218da1)return _0x148a3b(_0x218da1);return _0x309e8e(_0x50b834);});})[_0x1c4e('0x21')](function(){return new BPromise(function(_0x149230,_0x545959){rimraf(_0x56714b,function(_0x3a345a){if(_0x3a345a)_0x545959(_0x3a345a);return _0x149230();});});})['then'](function(){return _0x5f4853[_0x1c4e('0xba')](_0x3bb03b,_0x4407ea,function(_0x79b39d){if(_0x79b39d){console[_0x1c4e('0xca')](_0x1c4e('0xcb'),_0x79b39d);}else{fs[_0x1c4e('0xcc')](_0x3bb03b);}});});});}else{return _0x5f4853[_0x1c4e('0x15')](0xc8);}})[_0x1c4e('0xa3')](handleError(_0x5f4853,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2e40515..8e47054 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 _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ef3,0xba));var _0x32ef=function(_0xd715d7,_0x4b29a4){_0xd715d7=_0xd715d7-0x0;var _0x5e1be3=_0x2ef3[_0xd715d7];return _0x5e1be3;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 446a25f..fb61c60 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 _0xaa88=['./faxInteraction.attributes','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xaa88,0x137));var _0x8aa8=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xaa88[_0x301dab];return _0x2500a2;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27c08d,_0x40826f,_0x4adfb9){if(_0x27c08d[_0x8aa8('0xc')](_0x8aa8('0xd'))){_0x27c08d[_0x8aa8('0xe')]=moment()['format'](_0x8aa8('0xf'));}_0x4adfb9(null,_0x27c08d);}}});}; \ No newline at end of file +var _0xa8a8=['bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x509c7d,_0x226ce5){var _0xb8d722=function(_0x6c6129){while(--_0x6c6129){_0x509c7d['push'](_0x509c7d['shift']());}};_0xb8d722(++_0x226ce5);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1f2f27,_0x121b11){_0x1f2f27=_0x1f2f27-0x0;var _0x335c38=_0xa8a8[_0x1f2f27];return _0x335c38;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4225b9,_0xecaa6f,_0x3287f5){if(_0x4225b9['changed']('closed')){_0x4225b9[_0x8a8a('0xe')]=moment()['format'](_0x8a8a('0xf'));}_0x3287f5(null,_0x4225b9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 4c78079..da44c0f 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 _0x8b09=['FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','register','then','FaxInteraction,\x20%s,\x20%s','debug'];(function(_0x2be46e,_0x2db9ac){var _0xfa7f30=function(_0x303d9b){while(--_0x303d9b){_0x2be46e['push'](_0x2be46e['shift']());}};_0xfa7f30(++_0x2db9ac);}(_0x8b09,0x1a2));var _0x98b0=function(_0x1d649b,_0x522270){_0x1d649b=_0x1d649b-0x0;var _0x516d26=_0x8b09[_0x1d649b];return _0x516d26;};'use strict';var _=require(_0x98b0('0x0'));var util=require(_0x98b0('0x1'));var moment=require(_0x98b0('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(_0x98b0('0x3'));var logger=require(_0x98b0('0x4'))(_0x98b0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x98b0('0x6')]({'port':0x232a});config[_0x98b0('0x7')]=_['defaults'](config[_0x98b0('0x7')],{'host':_0x98b0('0x8'),'port':0x18eb});var socket=require(_0x98b0('0x9'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x98b0('0xa')](socket);function respondWithRpcPromise(_0x5d42e6,_0x39323a,_0x3995af){return new BPromise(function(_0xecd25,_0x28fdde){return client['request'](_0x5d42e6,_0x3995af)[_0x98b0('0xb')](function(_0x196037){logger['info'](_0x98b0('0xc'),_0x39323a,'request\x20sent');logger[_0x98b0('0xd')](_0x98b0('0xe'),_0x39323a,_0x98b0('0xf'),JSON['stringify'](_0x196037));if(_0x196037['error']){if(_0x196037['error'][_0x98b0('0x10')]===0x1f4){logger['error'](_0x98b0('0xc'),_0x39323a,_0x196037[_0x98b0('0x11')][_0x98b0('0x12')]);return _0x28fdde(_0x196037[_0x98b0('0x11')][_0x98b0('0x12')]);}logger[_0x98b0('0x11')](_0x98b0('0xc'),_0x39323a,_0x196037[_0x98b0('0x11')][_0x98b0('0x12')]);return _0xecd25(_0x196037['error'][_0x98b0('0x12')]);}else{logger[_0x98b0('0x13')](_0x98b0('0xc'),_0x39323a,_0x98b0('0xf'));_0xecd25(_0x196037['result'][_0x98b0('0x12')]);}})[_0x98b0('0x14')](function(_0x1f15a9){logger[_0x98b0('0x11')](_0x98b0('0xc'),_0x39323a,_0x1f15a9);_0x28fdde(_0x1f15a9);});});}exports[_0x98b0('0x15')]=function(_0x4e1cdd){var _0x1dea5d=this;return new Promise(function(_0x3f3c0e,_0x1a5a78){return db[_0x98b0('0x16')][_0x98b0('0x17')](_0x4e1cdd[_0x98b0('0x18')],{'raw':_0x4e1cdd[_0x98b0('0x19')]?_0x4e1cdd[_0x98b0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e1cdd[_0x98b0('0x19')]?_0x4e1cdd['options'][_0x98b0('0x1a')]||null:null,'attributes':_0x4e1cdd[_0x98b0('0x19')]?_0x4e1cdd[_0x98b0('0x19')]['attributes']||null:null,'limit':_0x4e1cdd[_0x98b0('0x19')]?_0x4e1cdd[_0x98b0('0x19')][_0x98b0('0x1b')]||null:null})['then'](function(_0x22a2d6){logger['info'](_0x98b0('0x15'),_0x4e1cdd);logger[_0x98b0('0xd')](_0x98b0('0x15'),_0x4e1cdd,JSON[_0x98b0('0x1c')](_0x22a2d6));_0x3f3c0e(_0x22a2d6);})['catch'](function(_0x5f5cad){logger[_0x98b0('0x11')](_0x98b0('0x15'),_0x5f5cad[_0x98b0('0x12')],_0x4e1cdd);_0x1a5a78(_0x1dea5d[_0x98b0('0x11')](0x1f4,_0x5f5cad[_0x98b0('0x12')]));});});};exports[_0x98b0('0x1d')]=function(_0x2ee018){return new Promise(function(_0x1f2be4,_0x4f3c14){return db['FaxInteraction'][_0x98b0('0x1e')]({'where':_0x2ee018['options']?_0x2ee018['options']['where']||null:null})[_0x98b0('0xb')](function(_0x581a7f){if(_0x581a7f){return _0x581a7f[_0x98b0('0x1f')](_0x2ee018['body'][_0x98b0('0x20')],_[_0x98b0('0x21')](_0x2ee018[_0x98b0('0x18')],[_0x98b0('0x20'),'id'])||{});}})[_0x98b0('0x22')](function(_0x57294a){logger[_0x98b0('0x13')](_0x98b0('0x23'),_0x2ee018);logger[_0x98b0('0xd')]('AddTags',_0x2ee018,JSON[_0x98b0('0x1c')](_0x57294a));_0x1f2be4(_0x57294a);})[_0x98b0('0x14')](function(_0x442d64){logger[_0x98b0('0x11')](_0x98b0('0x23'),_0x442d64[_0x98b0('0x12')],_0x2ee018);_0x4f3c14(_this['error'](0x1f4,_0x442d64[_0x98b0('0x12')]));});});}; \ No newline at end of file +var _0x7a2c=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','debug','AddTagsToFaxInteraction','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4c17dd,_0x1a3ae0){var _0x536c17=function(_0x425876){while(--_0x425876){_0x4c17dd['push'](_0x4c17dd['shift']());}};_0x536c17(++_0x1a3ae0);}(_0x7a2c,0x65));var _0xc7a2=function(_0x217fdb,_0x4badeb){_0x217fdb=_0x217fdb-0x0;var _0x122d41=_0x7a2c[_0x217fdb];return _0x122d41;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var moment=require(_0xc7a2('0x1'));var BPromise=require(_0xc7a2('0x2'));var rs=require(_0xc7a2('0x3'));var fs=require('fs');var Redis=require(_0xc7a2('0x4'));var db=require(_0xc7a2('0x5'))['db'];var utils=require(_0xc7a2('0x6'));var logger=require(_0xc7a2('0x7'))(_0xc7a2('0x8'));var config=require(_0xc7a2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc7a2('0xa')]['http']({'port':0x232a});config[_0xc7a2('0xb')]=_[_0xc7a2('0xc')](config[_0xc7a2('0xb')],{'host':_0xc7a2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7a2('0xb')]));require(_0xc7a2('0xe'))['register'](socket);function respondWithRpcPromise(_0x2c5fd7,_0x22fdf1,_0x3ab3db){return new BPromise(function(_0x5dd8e0,_0x33aab0){return client['request'](_0x2c5fd7,_0x3ab3db)[_0xc7a2('0xf')](function(_0x7293de){logger[_0xc7a2('0x10')](_0xc7a2('0x11'),_0x22fdf1,_0xc7a2('0x12'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x22fdf1,_0xc7a2('0x12'),JSON[_0xc7a2('0x13')](_0x7293de));if(_0x7293de[_0xc7a2('0x14')]){if(_0x7293de['error']['code']===0x1f4){logger[_0xc7a2('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x22fdf1,_0x7293de[_0xc7a2('0x14')]['message']);return _0x33aab0(_0x7293de[_0xc7a2('0x14')][_0xc7a2('0x15')]);}logger[_0xc7a2('0x14')](_0xc7a2('0x11'),_0x22fdf1,_0x7293de[_0xc7a2('0x14')][_0xc7a2('0x15')]);return _0x5dd8e0(_0x7293de[_0xc7a2('0x14')][_0xc7a2('0x15')]);}else{logger['info'](_0xc7a2('0x11'),_0x22fdf1,_0xc7a2('0x12'));_0x5dd8e0(_0x7293de['result'][_0xc7a2('0x15')]);}})[_0xc7a2('0x16')](function(_0x3cfa18){logger['error'](_0xc7a2('0x11'),_0x22fdf1,_0x3cfa18);_0x33aab0(_0x3cfa18);});});}exports[_0xc7a2('0x17')]=function(_0x1804e7){var _0x5dc32b=this;return new Promise(function(_0x193417,_0x463d8d){return db[_0xc7a2('0x18')][_0xc7a2('0x19')](_0x1804e7[_0xc7a2('0x1a')],{'raw':_0x1804e7[_0xc7a2('0x1b')]?_0x1804e7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1804e7[_0xc7a2('0x1b')]?_0x1804e7[_0xc7a2('0x1b')][_0xc7a2('0x1c')]||null:null,'attributes':_0x1804e7[_0xc7a2('0x1b')]?_0x1804e7[_0xc7a2('0x1b')][_0xc7a2('0x1d')]||null:null,'limit':_0x1804e7[_0xc7a2('0x1b')]?_0x1804e7[_0xc7a2('0x1b')][_0xc7a2('0x1e')]||null:null})[_0xc7a2('0xf')](function(_0x138c22){logger[_0xc7a2('0x10')](_0xc7a2('0x17'),_0x1804e7);logger[_0xc7a2('0x1f')](_0xc7a2('0x17'),_0x1804e7,JSON['stringify'](_0x138c22));_0x193417(_0x138c22);})[_0xc7a2('0x16')](function(_0x40ff87){logger['error']('UpdateFaxInteraction',_0x40ff87[_0xc7a2('0x15')],_0x1804e7);_0x463d8d(_0x5dc32b[_0xc7a2('0x14')](0x1f4,_0x40ff87[_0xc7a2('0x15')]));});});};exports[_0xc7a2('0x20')]=function(_0x1c3c44){return new Promise(function(_0x1b507e,_0x1e62fa){return db[_0xc7a2('0x18')]['find']({'where':_0x1c3c44[_0xc7a2('0x1b')]?_0x1c3c44['options'][_0xc7a2('0x1c')]||null:null})['then'](function(_0x4bdc37){if(_0x4bdc37){return _0x4bdc37['addTags'](_0x1c3c44[_0xc7a2('0x1a')][_0xc7a2('0x21')],_['omit'](_0x1c3c44[_0xc7a2('0x1a')],[_0xc7a2('0x21'),'id'])||{});}})[_0xc7a2('0x22')](function(_0x231d19){logger[_0xc7a2('0x10')](_0xc7a2('0x23'),_0x1c3c44);logger[_0xc7a2('0x1f')](_0xc7a2('0x23'),_0x1c3c44,JSON[_0xc7a2('0x13')](_0x231d19));_0x1b507e(_0x231d19);})[_0xc7a2('0x16')](function(_0xa1988b){logger[_0xc7a2('0x14')]('AddTags',_0xa1988b[_0xc7a2('0x15')],_0x1c3c44);_0x1e62fa(_this[_0xc7a2('0x14')](0x1f4,_0xa1988b[_0xc7a2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index feaebf4..219d808 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 _0x684e=['removeListener','length','./faxInteraction.events','save','remove','update','emit'];(function(_0x3d45ce,_0x3ea46a){var _0x5defe5=function(_0x1f95c0){while(--_0x1f95c0){_0x3d45ce['push'](_0x3d45ce['shift']());}};_0x5defe5(++_0x3ea46a);}(_0x684e,0x1a6));var _0xe684=function(_0x25ba25,_0x3f3ee7){_0x25ba25=_0x25ba25-0x0;var _0x3dd671=_0x684e[_0x25ba25];return _0x3dd671;};'use strict';var FaxInteractionEvents=require(_0xe684('0x0'));var events=[_0xe684('0x1'),_0xe684('0x2'),_0xe684('0x3')];function createListener(_0x398dac,_0x26e7c4){return function(_0x560f03){_0x26e7c4[_0xe684('0x4')](_0x398dac,_0x560f03);};}function removeListener(_0x2fb612,_0xcf8b30){return function(){FaxInteractionEvents[_0xe684('0x5')](_0x2fb612,_0xcf8b30);};}exports['register']=function(_0x41dbaf){for(var _0xcb9bc2=0x0,_0x3d67ab=events[_0xe684('0x6')];_0xcb9bc2<_0x3d67ab;_0xcb9bc2++){var _0x5af74d=events[_0xcb9bc2];var _0x48173e=createListener('faxInteraction:'+_0x5af74d,_0x41dbaf);FaxInteractionEvents['on'](_0x5af74d,_0x48173e);}}; \ No newline at end of file +var _0xc457=['remove','emit','register','length','./faxInteraction.events'];(function(_0x4ec356,_0x3763df){var _0x5b18e6=function(_0xbd7ba5){while(--_0xbd7ba5){_0x4ec356['push'](_0x4ec356['shift']());}};_0x5b18e6(++_0x3763df);}(_0xc457,0x1df));var _0x7c45=function(_0x468bfe,_0x1ff7a8){_0x468bfe=_0x468bfe-0x0;var _0x15edfd=_0xc457[_0x468bfe];return _0x15edfd;};'use strict';var FaxInteractionEvents=require(_0x7c45('0x0'));var events=['save',_0x7c45('0x1'),'update'];function createListener(_0x10c1a9,_0x497f22){return function(_0xd4e27){_0x497f22[_0x7c45('0x2')](_0x10c1a9,_0xd4e27);};}function removeListener(_0x512564,_0x4f136a){return function(){FaxInteractionEvents['removeListener'](_0x512564,_0x4f136a);};}exports[_0x7c45('0x3')]=function(_0x289018){for(var _0x11a5d3=0x0,_0x193de2=events[_0x7c45('0x4')];_0x11a5d3<_0x193de2;_0x11a5d3++){var _0x4adf43=events[_0x11a5d3];var _0x4e1f44=createListener('faxInteraction:'+_0x4adf43,_0x289018);FaxInteractionEvents['on'](_0x4adf43,_0x4e1f44);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 0308d38..e6e144a 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 _0xcb18=['./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:destroy','destroy','removeTags','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20236b,_0x5c9ecf){var _0x6743f7=function(_0x20538a){while(--_0x20538a){_0x20236b['push'](_0x20236b['shift']());}};_0x6743f7(++_0x5c9ecf);}(_0xcb18,0x159));var _0x8cb1=function(_0x3dec59,_0x3007d2){_0x3dec59=_0x3dec59-0x0;var _0x98c338=_0xcb18[_0x3dec59];return _0x98c338;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8cb1('0x0'));var timeout=require('connect-timeout');var express=require(_0x8cb1('0x1'));var router=express['Router']();var auth=require(_0x8cb1('0x2'));var interaction=require(_0x8cb1('0x3'));var config=require(_0x8cb1('0x4'));var controller=require(_0x8cb1('0x5'));router[_0x8cb1('0x6')]('/',auth[_0x8cb1('0x7')](),controller['index']);router[_0x8cb1('0x6')](_0x8cb1('0x8'),auth['isAuthenticated'](),controller[_0x8cb1('0x9')]);router['get'](_0x8cb1('0xa'),auth[_0x8cb1('0x7')](),controller['show']);router[_0x8cb1('0x6')](_0x8cb1('0xb'),auth[_0x8cb1('0x7')](),controller[_0x8cb1('0xc')]);router[_0x8cb1('0x6')]('/:id/download',auth[_0x8cb1('0x7')](),controller[_0x8cb1('0xd')]);router[_0x8cb1('0xe')]('/',auth['isAuthenticated'](),controller[_0x8cb1('0xf')]);router[_0x8cb1('0xe')](_0x8cb1('0xb'),auth[_0x8cb1('0x7')](),controller[_0x8cb1('0x10')]);router[_0x8cb1('0xe')]('/:id/tags',auth[_0x8cb1('0x7')](),interaction['tracked'](_0x8cb1('0x11'),_0x8cb1('0x12')),controller[_0x8cb1('0x13')]);router[_0x8cb1('0x14')](_0x8cb1('0xa'),auth[_0x8cb1('0x7')](),interaction['tracked'](_0x8cb1('0x11'),'faxinteraction:update'),controller['update']);router['delete'](_0x8cb1('0xa'),auth[_0x8cb1('0x7')](),interaction[_0x8cb1('0x15')]('fax',_0x8cb1('0x16')),controller[_0x8cb1('0x17')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x8cb1('0x18')]);module['exports']=router; \ No newline at end of file +var _0x65fd=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','removeTags','exports','multer'];(function(_0x5a57c6,_0x394b7d){var _0x509601=function(_0x1bb60b){while(--_0x1bb60b){_0x5a57c6['push'](_0x5a57c6['shift']());}};_0x509601(++_0x394b7d);}(_0x65fd,0x185));var _0xd65f=function(_0x172ce2,_0x302ab1){_0x172ce2=_0x172ce2-0x0;var _0x3043d4=_0x65fd[_0x172ce2];return _0x3043d4;};'use strict';var multer=require(_0xd65f('0x0'));var util=require(_0xd65f('0x1'));var path=require(_0xd65f('0x2'));var timeout=require(_0xd65f('0x3'));var express=require('express');var router=express[_0xd65f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd65f('0x5'));var config=require(_0xd65f('0x6'));var controller=require(_0xd65f('0x7'));router[_0xd65f('0x8')]('/',auth[_0xd65f('0x9')](),controller['index']);router['get'](_0xd65f('0xa'),auth[_0xd65f('0x9')](),controller[_0xd65f('0xb')]);router[_0xd65f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd65f('0xc')]);router[_0xd65f('0x8')](_0xd65f('0xd'),auth['isAuthenticated'](),controller[_0xd65f('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xd65f('0xf')]('/',auth[_0xd65f('0x9')](),controller[_0xd65f('0x10')]);router[_0xd65f('0xf')](_0xd65f('0xd'),auth[_0xd65f('0x9')](),controller[_0xd65f('0x11')]);router[_0xd65f('0xf')](_0xd65f('0x12'),auth[_0xd65f('0x9')](),interaction[_0xd65f('0x13')](_0xd65f('0x14'),_0xd65f('0x15')),controller[_0xd65f('0x16')]);router[_0xd65f('0x17')](_0xd65f('0x18'),auth[_0xd65f('0x9')](),interaction[_0xd65f('0x13')](_0xd65f('0x14'),_0xd65f('0x19')),controller[_0xd65f('0x1a')]);router['delete'](_0xd65f('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0xd65f('0x14'),'faxinteraction:destroy'),controller['destroy']);router[_0xd65f('0x1b')](_0xd65f('0x12'),auth[_0xd65f('0x9')](),controller[_0xd65f('0x1c')]);module[_0xd65f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 6ad5593..9abd74e 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 _0x0840=['TEXT','medium','BOOLEAN','out','sequelize','exports'];(function(_0x1a52c9,_0x1167a1){var _0x2a486b=function(_0x31914c){while(--_0x31914c){_0x1a52c9['push'](_0x1a52c9['shift']());}};_0x2a486b(++_0x1167a1);}(_0x0840,0x13c));var _0x0084=function(_0x161341,_0x1c054d){_0x161341=_0x161341-0x0;var _0x5e06c3=_0x0840[_0x161341];return _0x5e06c3;};'use strict';var Sequelize=require(_0x0084('0x0'));module[_0x0084('0x1')]={'body':{'type':Sequelize[_0x0084('0x2')](_0x0084('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0084('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0084('0x5')),'defaultValue':_0x0084('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x42e3=['ENUM','out','TEXT','DATE','sequelize','exports','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42e3,0x1ac));var _0x342e=function(_0x58dcd2,_0x38977e){_0x58dcd2=_0x58dcd2-0x0;var _0x43f7e6=_0x42e3[_0x58dcd2];return _0x43f7e6;};'use strict';var Sequelize=require(_0x342e('0x0'));module[_0x342e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x342e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x342e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x342e('0x4')]('in',_0x342e('0x5')),'defaultValue':_0x342e('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x342e('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x342e('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 0f22546..26a1e9f 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 _0x786a=['EventManager','reject','agent','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','AttachmentId','SendFax','FaxAccountId','basename','root','server','files','attachments','Attachment','join','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','info','catch','status','json','count','offset','set','Content-Range','save','update','destroy','end','sendStatus','name','send','index','map','FaxMessage','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event'];(function(_0x1c081d,_0x10b432){var _0x2deb0e=function(_0x43fcbd){while(--_0x43fcbd){_0x1c081d['push'](_0x1c081d['shift']());}};_0x2deb0e(++_0x10b432);}(_0x786a,0x12c));var _0xa786=function(_0x5d3ef0,_0x58f63e){_0x5d3ef0=_0x5d3ef0-0x0;var _0x5a6ae3=_0x786a[_0x5d3ef0];return _0x5a6ae3;};'use strict';var pdf=require(_0xa786('0x0'));var emlformat=require(_0xa786('0x1'));var rimraf=require(_0xa786('0x2'));var zipdir=require(_0xa786('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa786('0x4'));var moment=require(_0xa786('0x5'));var BPromise=require(_0xa786('0x6'));var Mustache=require(_0xa786('0x7'));var util=require(_0xa786('0x8'));var path=require(_0xa786('0x9'));var sox=require('sox');var csv=require(_0xa786('0xa'));var ejs=require(_0xa786('0xb'));var fs=require('fs');var _=require(_0xa786('0xc'));var squel=require('squel');var crypto=require(_0xa786('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa786('0xa'));var querystring=require(_0xa786('0xe'));var Papa=require(_0xa786('0xf'));var Redis=require(_0xa786('0x10'));var authService=require(_0xa786('0x11'));var qs=require(_0xa786('0x12'));var as=require(_0xa786('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa786('0x14'))(_0xa786('0x15'));var utils=require('../../config/utils');var config=require(_0xa786('0x16'));var db=require(_0xa786('0x17'))['db'];config['redis']=_[_0xa786('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa786('0x19'))(new Redis(config['redis']));require(_0xa786('0x1a'))[_0xa786('0x1b')](socket);var jayson=require(_0xa786('0x1c'));var client=jayson[_0xa786('0x1d')][_0xa786('0x1e')]({'port':0x232c});var client9002=jayson[_0xa786('0x1d')][_0xa786('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x828375,_0x5745a5,_0x392ac8){if(_0x392ac8){var _0x4195f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4195f3[_0xa786('0x1f')](_0x5745a5)){return _0x828375;}else{throw new db[(_0xa786('0x20'))]['ValidationError'](_0xa786('0x21'));}}else{return _0x828375;}}function respondWithRpcPromise(_0x2e2ca9,_0xc4616,_0xe2985c,_0x3e544c){return new BPromise(function(_0x26769b,_0x53f69c){var _0x5d855b=_0x3e544c||client;return _0x5d855b[_0xa786('0x22')](_0x2e2ca9,_0xe2985c)[_0xa786('0x23')](function(_0x535cbc){logger['info']('FaxMessage,\x20%s,\x20%s',_0xc4616,_0xa786('0x24'));logger[_0xa786('0x25')](_0xa786('0x26'),_0xc4616,_0xa786('0x24'),JSON['stringify'](_0x535cbc));if(_0x535cbc['error']){if(_0x535cbc[_0xa786('0x27')][_0xa786('0x28')]===0x1f4){logger['error'](_0xa786('0x29'),_0xc4616,_0x535cbc[_0xa786('0x27')][_0xa786('0x2a')]);return _0x53f69c(_0x535cbc[_0xa786('0x27')][_0xa786('0x2a')]);}logger[_0xa786('0x27')](_0xa786('0x29'),_0xc4616,_0x535cbc['error'][_0xa786('0x2a')]);return _0x26769b(_0x535cbc['error'][_0xa786('0x2a')]);}else{logger[_0xa786('0x2b')]('FaxMessage,\x20%s,\x20%s',_0xc4616,_0xa786('0x24'));_0x26769b(_0x535cbc['result'][_0xa786('0x2a')]);}})[_0xa786('0x2c')](function(_0x17264e){logger[_0xa786('0x27')](_0xa786('0x29'),_0xc4616,_0x17264e);_0x53f69c(_0x17264e);});});}function respondWithStatusCode(_0x40b318,_0x14d757){_0x14d757=_0x14d757||0xcc;return function(_0x3cff0c){if(_0x3cff0c){return _0x40b318['sendStatus'](_0x14d757);}return _0x40b318['status'](_0x14d757)['end']();};}function respondWithResult(_0x1f1bae,_0xa4df48){_0xa4df48=_0xa4df48||0xc8;return function(_0x3c03b7){if(_0x3c03b7){return _0x1f1bae[_0xa786('0x2d')](_0xa4df48)[_0xa786('0x2e')](_0x3c03b7);}};}function respondWithFilteredResult(_0x1bebd3,_0x4b23b8){return function(_0xa8efaf){if(_0xa8efaf){var _0x2506fb=_0xa8efaf[_0xa786('0x2f')],_0x11743d=_0x4b23b8[_0xa786('0x30')],_0x15b05a=_0x4b23b8['offset']+_0x4b23b8['limit'],_0x505480;if(_0x15b05a>=_0x2506fb){_0x15b05a=_0x2506fb;_0x505480=0xc8;}else{_0x505480=0xce;}_0x1bebd3['status'](_0x505480);return _0x1bebd3[_0xa786('0x31')](_0xa786('0x32'),_0x11743d+'-'+_0x15b05a+'/'+_0x2506fb)[_0xa786('0x2e')](_0xa8efaf);}return null;};}function patchUpdates(_0x36c72e){return function(_0x1cc9c9){try{jsonpatch['apply'](_0x1cc9c9,_0x36c72e,!![]);}catch(_0x2b040f){return BPromise['reject'](_0x2b040f);}return _0x1cc9c9[_0xa786('0x33')]();};}function saveUpdates(_0x37cc45,_0xe6e5e3){return function(_0x5aecdd){if(_0x5aecdd){return _0x5aecdd[_0xa786('0x34')](_0x37cc45)[_0xa786('0x23')](function(_0x47698d){return _0x47698d;});}return null;};}function removeEntity(_0x296eb8,_0x1b873a){return function(_0x469d5f){if(_0x469d5f){return _0x469d5f[_0xa786('0x35')]()[_0xa786('0x23')](function(){_0x296eb8[_0xa786('0x2d')](0xcc)[_0xa786('0x36')]();});}};}function handleEntityNotFound(_0x2eca21,_0x2c3042){return function(_0x301bac){if(!_0x301bac){_0x2eca21[_0xa786('0x37')](0x194);}return _0x301bac;};}function handleError(_0x3172ff,_0x137ffb){_0x137ffb=_0x137ffb||0x1f4;return function(_0x8f073c){logger[_0xa786('0x27')](_0x8f073c['stack']);if(_0x8f073c[_0xa786('0x38')]){delete _0x8f073c[_0xa786('0x38')];}_0x3172ff[_0xa786('0x2d')](_0x137ffb)[_0xa786('0x39')](_0x8f073c);};}exports[_0xa786('0x3a')]=function(_0x26bcdd,_0x40fe22){var _0x33e02e={},_0x24674b={},_0x480d9f={'count':0x0,'rows':[]};var _0xf5b3fa=_[_0xa786('0x3b')](db[_0xa786('0x3c')]['rawAttributes'],function(_0x5411c0){return{'name':_0x5411c0[_0xa786('0x3d')],'type':_0x5411c0[_0xa786('0x3e')][_0xa786('0x3f')]};});_0x24674b[_0xa786('0x40')]=_['map'](_0xf5b3fa,_0xa786('0x38'));_0x24674b[_0xa786('0x41')]=_[_0xa786('0x42')](_0x26bcdd[_0xa786('0x41')]);_0x24674b['filters']=_[_0xa786('0x43')](_0x24674b[_0xa786('0x40')],_0x24674b[_0xa786('0x41')]);_0x33e02e['attributes']=_['intersection'](_0x24674b[_0xa786('0x40')],qs[_0xa786('0x44')](_0x26bcdd[_0xa786('0x41')][_0xa786('0x44')]));_0x33e02e[_0xa786('0x45')]=_0x33e02e[_0xa786('0x45')][_0xa786('0x46')]?_0x33e02e[_0xa786('0x45')]:_0x24674b[_0xa786('0x40')];if(!_0x26bcdd[_0xa786('0x41')][_0xa786('0x47')](_0xa786('0x48'))){_0x33e02e[_0xa786('0x49')]=qs[_0xa786('0x49')](_0x26bcdd[_0xa786('0x41')]['limit']);_0x33e02e[_0xa786('0x30')]=qs[_0xa786('0x30')](_0x26bcdd[_0xa786('0x41')][_0xa786('0x30')]);}_0x33e02e[_0xa786('0x4a')]=qs[_0xa786('0x4b')](_0x26bcdd[_0xa786('0x41')][_0xa786('0x4b')]);_0x33e02e[_0xa786('0x4c')]=qs[_0xa786('0x4d')](_['pick'](_0x26bcdd[_0xa786('0x41')],_0x24674b[_0xa786('0x4d')]),_0xf5b3fa);if(_0x26bcdd['query'][_0xa786('0x4e')]){_0x33e02e['where']=_['merge'](_0x33e02e[_0xa786('0x4c')],{'$or':_['map'](_0xf5b3fa,function(_0x4576ce){if(_0x4576ce[_0xa786('0x3e')]!=='VIRTUAL'){var _0xf6564e={};_0xf6564e[_0x4576ce[_0xa786('0x38')]]={'$like':'%'+_0x26bcdd[_0xa786('0x41')][_0xa786('0x4e')]+'%'};return _0xf6564e;}})});}_0x33e02e=_[_0xa786('0x4f')]({},_0x33e02e,_0x26bcdd[_0xa786('0x50')]);var _0x4092f8={'where':_0x33e02e[_0xa786('0x4c')]};return db[_0xa786('0x3c')][_0xa786('0x2f')](_0x4092f8)[_0xa786('0x23')](function(_0x34bcd1){_0x480d9f['count']=_0x34bcd1;if(_0x26bcdd[_0xa786('0x41')][_0xa786('0x51')]){_0x33e02e[_0xa786('0x52')]=[{'all':!![]}];}return db[_0xa786('0x3c')][_0xa786('0x53')](_0x33e02e);})[_0xa786('0x23')](function(_0x4da4ff){_0x480d9f[_0xa786('0x54')]=_0x4da4ff;return _0x480d9f;})['then'](respondWithFilteredResult(_0x40fe22,_0x33e02e))['catch'](handleError(_0x40fe22,null));};exports[_0xa786('0x55')]=function(_0x318c6b,_0x2a4624){var _0x818247={'raw':!![],'where':{'id':_0x318c6b[_0xa786('0x56')]['id']}},_0x4c5bef={};_0x4c5bef[_0xa786('0x40')]=_['keys'](db['FaxMessage'][_0xa786('0x57')]);_0x4c5bef[_0xa786('0x41')]=_[_0xa786('0x42')](_0x318c6b[_0xa786('0x41')]);_0x4c5bef[_0xa786('0x4d')]=_[_0xa786('0x43')](_0x4c5bef[_0xa786('0x40')],_0x4c5bef[_0xa786('0x41')]);_0x818247[_0xa786('0x45')]=_[_0xa786('0x43')](_0x4c5bef[_0xa786('0x40')],qs[_0xa786('0x44')](_0x318c6b['query']['fields']));_0x818247[_0xa786('0x45')]=_0x818247['attributes'][_0xa786('0x46')]?_0x818247[_0xa786('0x45')]:_0x4c5bef['model'];if(_0x318c6b[_0xa786('0x41')][_0xa786('0x51')]){_0x818247[_0xa786('0x52')]=[{'all':!![]}];}_0x818247=_[_0xa786('0x4f')]({},_0x818247,_0x318c6b['options']);return db[_0xa786('0x3c')][_0xa786('0x58')](_0x818247)[_0xa786('0x23')](handleEntityNotFound(_0x2a4624,null))[_0xa786('0x23')](respondWithResult(_0x2a4624,null))[_0xa786('0x2c')](handleError(_0x2a4624,null));};exports[_0xa786('0x34')]=function(_0x45c513,_0x1396f2){if(_0x45c513[_0xa786('0x59')]['id']){delete _0x45c513[_0xa786('0x59')]['id'];}return db['FaxMessage'][_0xa786('0x58')]({'where':{'id':_0x45c513['params']['id']}})[_0xa786('0x23')](handleEntityNotFound(_0x1396f2,null))[_0xa786('0x23')](saveUpdates(_0x45c513[_0xa786('0x59')],null))[_0xa786('0x23')](respondWithResult(_0x1396f2,null))['catch'](handleError(_0x1396f2,null));};exports[_0xa786('0x35')]=function(_0x4805b2,_0x108322){return db['FaxMessage'][_0xa786('0x58')]({'where':{'id':_0x4805b2[_0xa786('0x56')]['id']}})[_0xa786('0x23')](handleEntityNotFound(_0x108322,null))['then'](removeEntity(_0x108322,null))[_0xa786('0x2c')](handleError(_0x108322,null));};exports[_0xa786('0x5a')]=function(_0x2c4cd9,_0x136f86){return db['FaxMessage']['describe']()[_0xa786('0x23')](respondWithResult(_0x136f86,null))[_0xa786('0x2c')](handleError(_0x136f86,null));};var interaction_log=require(_0xa786('0x14'))(_0xa786('0x5b'));exports[_0xa786('0x5c')]=function(_0x5108bc,_0xd5e757,_0x3a994d){var _0x266197={'channel':_0xa786('0x5d')};if(_0x5108bc[_0xa786('0x59')]['id']){delete _0x5108bc[_0xa786('0x59')]['id'];}_0x5108bc['body'][_0xa786('0x5e')]=!![];_0x5108bc[_0xa786('0x59')][_0xa786('0x5f')]=moment()[_0xa786('0x60')](_0xa786('0x61'));_0x5108bc['body'][_0xa786('0x62')]=_0x5108bc[_0xa786('0x59')][_0xa786('0x62')]||_0x5108bc[_0xa786('0x63')]['id'];return db[_0xa786('0x3c')][_0xa786('0x58')]({'where':{'id':_0x5108bc[_0xa786('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xa786('0x64')],'as':_0xa786('0x65')}]})['then'](handleEntityNotFound(_0xd5e757,null))['then'](saveUpdates(_0x5108bc['body'],null))[_0xa786('0x23')](function(_0x2a6ad3){if(_0x2a6ad3){_0x266197['message']=_0x2a6ad3['get']({'plain':!![]});return db[_0xa786('0x66')][_0xa786('0x58')]({'where':{'id':_0x2a6ad3[_0xa786('0x67')]}});}return null;})[_0xa786('0x23')](handleEntityNotFound(_0xd5e757,null))[_0xa786('0x23')](function(_0x3070a2){if(_0x3070a2){return _0x3070a2[_0xa786('0x34')]({'UserId':_0x5108bc['body'][_0xa786('0x62')],'read1stAt':_[_0xa786('0x68')](_0x3070a2[_0xa786('0x69')])?moment()[_0xa786('0x60')](_0xa786('0x61')):undefined});}return null;})[_0xa786('0x23')](function(_0x1f95d1){if(_0x1f95d1){_0x266197['interaction']=_0x1f95d1[_0xa786('0x6a')]({'plain':!![]});interaction_log[_0xa786('0x2b')](_0xa786('0x6b'),_0x5108bc['user']['id'],_0x5108bc[_0xa786('0x63')][_0xa786('0x38')],_0x5108bc[_0xa786('0x63')][_0xa786('0x6c')],_0x266197['interaction']['id'],_0x5108bc[_0xa786('0x59')]?JSON[_0xa786('0x6d')](_0x5108bc['body']):'null');return respondWithRpcPromise(_0xa786('0x6e'),_0xa786('0x6f'),_0x266197);}return null;})[_0xa786('0x23')](function(_0x13ec2e){if(_0x13ec2e){if(_0x5108bc['body'][_0xa786('0x70')]){_0x266197[_0xa786('0x2a')][_0xa786('0x71')]=util['format'](_0xa786('0x72'),_0x5108bc[_0xa786('0x63')][_0xa786('0x38')]);_0x266197[_0xa786('0x2a')][_0xa786('0x73')]=_0x266197[_0xa786('0x73')];_0x266197[_0xa786('0x2a')][_0xa786('0x74')]='accept';return respondWithRpcPromise(_0xa786('0x75'),'EventManager',{'event':'acceptmessage','message':_0x266197[_0xa786('0x2a')]},client9002)[_0xa786('0x23')](function(){return _0x266197;});}return _0x266197;}return null;})[_0xa786('0x23')](respondWithResult(_0xd5e757,null))[_0xa786('0x2c')](handleError(_0xd5e757,null));};var interaction_log=require(_0xa786('0x14'))(_0xa786('0x5b'));exports[_0xa786('0x76')]=function(_0x5a9b1a,_0x5870d4,_0x5f4437){var _0x2a365d={'agent':{},'channel':_0xa786('0x5d')};if(_0x5a9b1a[_0xa786('0x59')]['id']){delete _0x5a9b1a[_0xa786('0x59')]['id'];}_0x5a9b1a[_0xa786('0x59')][_0xa786('0x62')]=_0x5a9b1a['body'][_0xa786('0x62')]||_0x5a9b1a['user']['id'];_0x2a365d[_0xa786('0x77')]['id']=_0x5a9b1a['body'][_0xa786('0x62')];return db[_0xa786('0x3c')][_0xa786('0x58')]({'where':{'id':_0x5a9b1a[_0xa786('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5870d4,null))[_0xa786('0x23')](function(_0x551415){if(_0x551415){_0x2a365d[_0xa786('0x2a')]=_0x551415[_0xa786('0x6a')]({'plain':!![]});return db[_0xa786('0x66')]['find']({'where':{'id':_0x551415[_0xa786('0x67')]}});}return null;})[_0xa786('0x23')](handleEntityNotFound(_0x5870d4,null))['then'](function(_0x12cef6){if(_0x12cef6){_0x2a365d[_0xa786('0x78')]=_0x12cef6[_0xa786('0x6a')]({'plain':!![]});interaction_log['info'](_0xa786('0x79'),_0x5a9b1a['user']['id'],_0x5a9b1a['user']['name'],_0x5a9b1a[_0xa786('0x63')]['role'],_0x2a365d[_0xa786('0x78')]['id'],_0x5a9b1a[_0xa786('0x59')]?JSON[_0xa786('0x6d')](_0x5a9b1a[_0xa786('0x59')]):_0xa786('0x7a'));return respondWithRpcPromise(_0xa786('0x7b'),_0xa786('0x7c'),_0x2a365d);}return null;})[_0xa786('0x23')](function(_0x169f40){if(_0x169f40){_0x169f40['message'][_0xa786('0x71')]=util[_0xa786('0x60')](_0xa786('0x72'),_0x5a9b1a['user']['name']);_0x169f40[_0xa786('0x2a')]['channel']=_0x2a365d['channel'];_0x169f40[_0xa786('0x2a')][_0xa786('0x74')]=_0xa786('0x76');respondWithRpcPromise(_0xa786('0x75'),_0xa786('0x75'),{'event':_0xa786('0x7d'),'message':_0x169f40['message']},client9002);return _0x2a365d;}return null;})[_0xa786('0x23')](respondWithResult(_0x5870d4,null))[_0xa786('0x2c')](handleError(_0x5870d4,null));};exports[_0xa786('0x7e')]=function(_0x5f4bf6,_0x91a4f7){var _0xe11433;return db[_0xa786('0x3c')][_0xa786('0x7e')](_0x5f4bf6[_0xa786('0x59')],{})['then'](function(_0x3faff6){_0xe11433=_0x3faff6;return db[_0xa786('0x64')][_0xa786('0x7f')]({'where':{'id':_0xe11433[_0xa786('0x80')]}});})['then'](function(_0x313af1){if(_['isNil'](_0x313af1)){return;}else{_0xe11433[_0xa786('0x5d')]=_0x313af1[_0xa786('0x5d')];return db['Attachment']['findOne']({'where':{'id':_0xe11433[_0xa786('0x81')]}});}})[_0xa786('0x23')](function(_0x20dc0c){return respondWithRpcPromise(_0xa786('0x82'),_0xa786('0x82'),{'FaxAccountId':_[_0xa786('0x68')](_0x5f4bf6['body'])?undefined:_0x5f4bf6[_0xa786('0x59')][_0xa786('0x83')],'path':_[_0xa786('0x68')](_0x20dc0c)?undefined:util[_0xa786('0x60')]('/var/opt/motion2/server/files/attachments/%s',_0x20dc0c[_0xa786('0x84')]),'fax':_[_0xa786('0x68')](_0xe11433['fax'])?undefined:_0xe11433[_0xa786('0x5d')],'AttachmentId':_0xe11433['AttachmentId']},client9002);})[_0xa786('0x23')](respondWithResult(_0x91a4f7,0xc9))[_0xa786('0x2c')](handleError(_0x91a4f7,null));};exports['download']=function(_0x5ef33e,_0xbdfecc){var _0x59c9fe=path['join'](config[_0xa786('0x85')],_0xa786('0x86'),_0xa786('0x87'),_0xa786('0x88'));return db['FaxMessage'][_0xa786('0x58')]({'where':{'id':_0x5ef33e[_0xa786('0x56')]['id']},'include':[{'model':db[_0xa786('0x89')],'as':'Attachment'}]})[_0xa786('0x23')](handleEntityNotFound(_0xbdfecc,null))[_0xa786('0x23')](function(_0x4ab04c){if(_0x4ab04c){return _0xbdfecc['download'](path[_0xa786('0x8a')](_0x59c9fe,_0x4ab04c['Attachment'][_0xa786('0x84')]));}})['catch'](handleError(_0xbdfecc,null));}; \ No newline at end of file +var _0x43d1=['isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','files','attachments','basename','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s','message','sendStatus','status','json','count','offset','set','Content-Range','apply','save','destroy','end','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','update','body','find','describe','fax-interactions','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteractionId'];(function(_0x54971c,_0x2ade4d){var _0x59df2c=function(_0x31a982){while(--_0x31a982){_0x54971c['push'](_0x54971c['shift']());}};_0x59df2c(++_0x2ade4d);}(_0x43d1,0x1b2));var _0x143d=function(_0x137e28,_0x2ce3f9){_0x137e28=_0x137e28-0x0;var _0x54f56a=_0x43d1[_0x137e28];return _0x54f56a;};'use strict';var pdf=require(_0x143d('0x0'));var emlformat=require(_0x143d('0x1'));var rimraf=require(_0x143d('0x2'));var zipdir=require(_0x143d('0x3'));var jsonpatch=require(_0x143d('0x4'));var rp=require(_0x143d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x143d('0x6'));var util=require(_0x143d('0x7'));var path=require(_0x143d('0x8'));var sox=require('sox');var csv=require(_0x143d('0x9'));var ejs=require(_0x143d('0xa'));var fs=require('fs');var _=require(_0x143d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x143d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x143d('0xd'));var Papa=require(_0x143d('0xe'));var Redis=require(_0x143d('0xf'));var authService=require(_0x143d('0x10'));var qs=require(_0x143d('0x11'));var as=require(_0x143d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x143d('0x13'))('api');var utils=require(_0x143d('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x143d('0x15')]=_[_0x143d('0x16')](config[_0x143d('0x15')],{'host':_0x143d('0x17'),'port':0x18eb});var socket=require(_0x143d('0x18'))(new Redis(config[_0x143d('0x15')]));require(_0x143d('0x19'))['register'](socket);var jayson=require(_0x143d('0x1a'));var client=jayson['client'][_0x143d('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x143d('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1e0a4a,_0xa83541,_0x2d24e9){if(_0x2d24e9){var _0x184007=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x184007[_0x143d('0x1c')](_0xa83541)){return _0x1e0a4a;}else{throw new db[(_0x143d('0x1d'))]['ValidationError'](_0x143d('0x1e'));}}else{return _0x1e0a4a;}}function respondWithRpcPromise(_0xe61e,_0x4d6f05,_0x5987d7,_0x179ec0){return new BPromise(function(_0x88d58e,_0x439f89){var _0x58275d=_0x179ec0||client;return _0x58275d[_0x143d('0x1f')](_0xe61e,_0x5987d7)[_0x143d('0x20')](function(_0x45bbb4){logger[_0x143d('0x21')]('FaxMessage,\x20%s,\x20%s',_0x4d6f05,_0x143d('0x22'));logger[_0x143d('0x23')](_0x143d('0x24'),_0x4d6f05,_0x143d('0x22'),JSON[_0x143d('0x25')](_0x45bbb4));if(_0x45bbb4[_0x143d('0x26')]){if(_0x45bbb4[_0x143d('0x26')]['code']===0x1f4){logger[_0x143d('0x26')](_0x143d('0x27'),_0x4d6f05,_0x45bbb4[_0x143d('0x26')][_0x143d('0x28')]);return _0x439f89(_0x45bbb4[_0x143d('0x26')][_0x143d('0x28')]);}logger[_0x143d('0x26')](_0x143d('0x27'),_0x4d6f05,_0x45bbb4['error'][_0x143d('0x28')]);return _0x88d58e(_0x45bbb4[_0x143d('0x26')][_0x143d('0x28')]);}else{logger[_0x143d('0x21')](_0x143d('0x27'),_0x4d6f05,'request\x20sent');_0x88d58e(_0x45bbb4['result'][_0x143d('0x28')]);}})['catch'](function(_0x41f96e){logger[_0x143d('0x26')](_0x143d('0x27'),_0x4d6f05,_0x41f96e);_0x439f89(_0x41f96e);});});}function respondWithStatusCode(_0x2a756c,_0x56b233){_0x56b233=_0x56b233||0xcc;return function(_0x3b7af4){if(_0x3b7af4){return _0x2a756c[_0x143d('0x29')](_0x56b233);}return _0x2a756c[_0x143d('0x2a')](_0x56b233)['end']();};}function respondWithResult(_0x266b99,_0x397fbc){_0x397fbc=_0x397fbc||0xc8;return function(_0x2656c6){if(_0x2656c6){return _0x266b99[_0x143d('0x2a')](_0x397fbc)[_0x143d('0x2b')](_0x2656c6);}};}function respondWithFilteredResult(_0x2c3423,_0x267232){return function(_0x51f245){if(_0x51f245){var _0x3dc5aa=_0x51f245[_0x143d('0x2c')],_0x4ef9a0=_0x267232['offset'],_0x1429b7=_0x267232[_0x143d('0x2d')]+_0x267232['limit'],_0x32884e;if(_0x1429b7>=_0x3dc5aa){_0x1429b7=_0x3dc5aa;_0x32884e=0xc8;}else{_0x32884e=0xce;}_0x2c3423[_0x143d('0x2a')](_0x32884e);return _0x2c3423[_0x143d('0x2e')](_0x143d('0x2f'),_0x4ef9a0+'-'+_0x1429b7+'/'+_0x3dc5aa)[_0x143d('0x2b')](_0x51f245);}return null;};}function patchUpdates(_0x2f8019){return function(_0x4e2aa7){try{jsonpatch[_0x143d('0x30')](_0x4e2aa7,_0x2f8019,!![]);}catch(_0x35d952){return BPromise['reject'](_0x35d952);}return _0x4e2aa7[_0x143d('0x31')]();};}function saveUpdates(_0x3f18b6,_0x5dc856){return function(_0x5620bd){if(_0x5620bd){return _0x5620bd['update'](_0x3f18b6)[_0x143d('0x20')](function(_0x1bbdf4){return _0x1bbdf4;});}return null;};}function removeEntity(_0x2e5348,_0x456737){return function(_0x462015){if(_0x462015){return _0x462015[_0x143d('0x32')]()[_0x143d('0x20')](function(){_0x2e5348['status'](0xcc)[_0x143d('0x33')]();});}};}function handleEntityNotFound(_0x113dd5,_0x3bc129){return function(_0x574c40){if(!_0x574c40){_0x113dd5[_0x143d('0x29')](0x194);}return _0x574c40;};}function handleError(_0x9aba9d,_0x25bac9){_0x25bac9=_0x25bac9||0x1f4;return function(_0x3cd80e){logger[_0x143d('0x26')](_0x3cd80e[_0x143d('0x34')]);if(_0x3cd80e[_0x143d('0x35')]){delete _0x3cd80e[_0x143d('0x35')];}_0x9aba9d[_0x143d('0x2a')](_0x25bac9)[_0x143d('0x36')](_0x3cd80e);};}exports[_0x143d('0x37')]=function(_0x57511f,_0x89d353){var _0x4981bb={},_0x1da9ca={},_0x29bae7={'count':0x0,'rows':[]};var _0x587324=_[_0x143d('0x38')](db[_0x143d('0x39')][_0x143d('0x3a')],function(_0xd5056f){return{'name':_0xd5056f[_0x143d('0x3b')],'type':_0xd5056f[_0x143d('0x3c')][_0x143d('0x3d')]};});_0x1da9ca['model']=_[_0x143d('0x38')](_0x587324,_0x143d('0x35'));_0x1da9ca[_0x143d('0x3e')]=_[_0x143d('0x3f')](_0x57511f['query']);_0x1da9ca[_0x143d('0x40')]=_[_0x143d('0x41')](_0x1da9ca[_0x143d('0x42')],_0x1da9ca[_0x143d('0x3e')]);_0x4981bb[_0x143d('0x43')]=_[_0x143d('0x41')](_0x1da9ca[_0x143d('0x42')],qs[_0x143d('0x44')](_0x57511f['query'][_0x143d('0x44')]));_0x4981bb[_0x143d('0x43')]=_0x4981bb[_0x143d('0x43')][_0x143d('0x45')]?_0x4981bb[_0x143d('0x43')]:_0x1da9ca['model'];if(!_0x57511f['query']['hasOwnProperty'](_0x143d('0x46'))){_0x4981bb[_0x143d('0x47')]=qs['limit'](_0x57511f['query']['limit']);_0x4981bb['offset']=qs[_0x143d('0x2d')](_0x57511f['query'][_0x143d('0x2d')]);}_0x4981bb[_0x143d('0x48')]=qs[_0x143d('0x49')](_0x57511f[_0x143d('0x3e')][_0x143d('0x49')]);_0x4981bb['where']=qs['filters'](_[_0x143d('0x4a')](_0x57511f[_0x143d('0x3e')],_0x1da9ca[_0x143d('0x40')]),_0x587324);if(_0x57511f[_0x143d('0x3e')][_0x143d('0x4b')]){_0x4981bb[_0x143d('0x4c')]=_[_0x143d('0x4d')](_0x4981bb[_0x143d('0x4c')],{'$or':_[_0x143d('0x38')](_0x587324,function(_0x2c3df4){if(_0x2c3df4['type']!==_0x143d('0x4e')){var _0x2b2245={};_0x2b2245[_0x2c3df4[_0x143d('0x35')]]={'$like':'%'+_0x57511f[_0x143d('0x3e')][_0x143d('0x4b')]+'%'};return _0x2b2245;}})});}_0x4981bb=_[_0x143d('0x4d')]({},_0x4981bb,_0x57511f[_0x143d('0x4f')]);var _0x4a9bf7={'where':_0x4981bb[_0x143d('0x4c')]};return db['FaxMessage'][_0x143d('0x2c')](_0x4a9bf7)[_0x143d('0x20')](function(_0x544f9a){_0x29bae7[_0x143d('0x2c')]=_0x544f9a;if(_0x57511f[_0x143d('0x3e')][_0x143d('0x50')]){_0x4981bb['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x4981bb);})[_0x143d('0x20')](function(_0x324835){_0x29bae7['rows']=_0x324835;return _0x29bae7;})[_0x143d('0x20')](respondWithFilteredResult(_0x89d353,_0x4981bb))[_0x143d('0x51')](handleError(_0x89d353,null));};exports[_0x143d('0x52')]=function(_0x158e8d,_0xb90f0b){var _0x45c2eb={'raw':!![],'where':{'id':_0x158e8d[_0x143d('0x53')]['id']}},_0x1b1ca4={};_0x1b1ca4[_0x143d('0x42')]=_[_0x143d('0x3f')](db[_0x143d('0x39')][_0x143d('0x3a')]);_0x1b1ca4[_0x143d('0x3e')]=_['keys'](_0x158e8d['query']);_0x1b1ca4[_0x143d('0x40')]=_[_0x143d('0x41')](_0x1b1ca4[_0x143d('0x42')],_0x1b1ca4[_0x143d('0x3e')]);_0x45c2eb[_0x143d('0x43')]=_['intersection'](_0x1b1ca4[_0x143d('0x42')],qs['fields'](_0x158e8d[_0x143d('0x3e')][_0x143d('0x44')]));_0x45c2eb[_0x143d('0x43')]=_0x45c2eb[_0x143d('0x43')][_0x143d('0x45')]?_0x45c2eb[_0x143d('0x43')]:_0x1b1ca4[_0x143d('0x42')];if(_0x158e8d[_0x143d('0x3e')][_0x143d('0x50')]){_0x45c2eb['include']=[{'all':!![]}];}_0x45c2eb=_[_0x143d('0x4d')]({},_0x45c2eb,_0x158e8d[_0x143d('0x4f')]);return db[_0x143d('0x39')]['find'](_0x45c2eb)[_0x143d('0x20')](handleEntityNotFound(_0xb90f0b,null))[_0x143d('0x20')](respondWithResult(_0xb90f0b,null))[_0x143d('0x51')](handleError(_0xb90f0b,null));};exports[_0x143d('0x54')]=function(_0x4cd26e,_0x33abec){if(_0x4cd26e[_0x143d('0x55')]['id']){delete _0x4cd26e[_0x143d('0x55')]['id'];}return db[_0x143d('0x39')][_0x143d('0x56')]({'where':{'id':_0x4cd26e[_0x143d('0x53')]['id']}})['then'](handleEntityNotFound(_0x33abec,null))[_0x143d('0x20')](saveUpdates(_0x4cd26e['body'],null))[_0x143d('0x20')](respondWithResult(_0x33abec,null))[_0x143d('0x51')](handleError(_0x33abec,null));};exports[_0x143d('0x32')]=function(_0x52b247,_0x22ad54){return db['FaxMessage']['find']({'where':{'id':_0x52b247['params']['id']}})['then'](handleEntityNotFound(_0x22ad54,null))[_0x143d('0x20')](removeEntity(_0x22ad54,null))[_0x143d('0x51')](handleError(_0x22ad54,null));};exports['describe']=function(_0x4d1278,_0x22b051){return db[_0x143d('0x39')][_0x143d('0x57')]()[_0x143d('0x20')](respondWithResult(_0x22b051,null))[_0x143d('0x51')](handleError(_0x22b051,null));};var interaction_log=require('../../config/logger')(_0x143d('0x58'));exports['accept']=function(_0x4d8925,_0x432b0b,_0x3312dc){var _0x3f79b2={'channel':_0x143d('0x59')};if(_0x4d8925[_0x143d('0x55')]['id']){delete _0x4d8925['body']['id'];}_0x4d8925[_0x143d('0x55')]['read']=!![];_0x4d8925[_0x143d('0x55')]['readAt']=moment()[_0x143d('0x5a')](_0x143d('0x5b'));_0x4d8925['body']['UserId']=_0x4d8925[_0x143d('0x55')][_0x143d('0x5c')]||_0x4d8925[_0x143d('0x5d')]['id'];return db[_0x143d('0x39')][_0x143d('0x56')]({'where':{'id':_0x4d8925[_0x143d('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x143d('0x5e')],'as':_0x143d('0x5f')}]})['then'](handleEntityNotFound(_0x432b0b,null))[_0x143d('0x20')](saveUpdates(_0x4d8925[_0x143d('0x55')],null))[_0x143d('0x20')](function(_0x2c97c5){if(_0x2c97c5){_0x3f79b2['message']=_0x2c97c5[_0x143d('0x60')]({'plain':!![]});return db['FaxInteraction'][_0x143d('0x56')]({'where':{'id':_0x2c97c5[_0x143d('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x432b0b,null))[_0x143d('0x20')](function(_0x5f61d8){if(_0x5f61d8){return _0x5f61d8[_0x143d('0x54')]({'UserId':_0x4d8925[_0x143d('0x55')][_0x143d('0x5c')],'read1stAt':_[_0x143d('0x62')](_0x5f61d8['read1stAt'])?moment()[_0x143d('0x5a')](_0x143d('0x5b')):undefined});}return null;})[_0x143d('0x20')](function(_0x49a653){if(_0x49a653){_0x3f79b2[_0x143d('0x63')]=_0x49a653[_0x143d('0x60')]({'plain':!![]});interaction_log[_0x143d('0x21')](_0x143d('0x64'),_0x4d8925[_0x143d('0x5d')]['id'],_0x4d8925[_0x143d('0x5d')][_0x143d('0x35')],_0x4d8925[_0x143d('0x5d')][_0x143d('0x65')],_0x3f79b2[_0x143d('0x63')]['id'],_0x4d8925[_0x143d('0x55')]?JSON[_0x143d('0x25')](_0x4d8925['body']):_0x143d('0x66'));return respondWithRpcPromise(_0x143d('0x67'),_0x143d('0x68'),_0x3f79b2);}return null;})[_0x143d('0x20')](function(_0x321f51){if(_0x321f51){if(_0x4d8925[_0x143d('0x55')][_0x143d('0x69')]){_0x3f79b2[_0x143d('0x28')]['interface']=util[_0x143d('0x5a')](_0x143d('0x6a'),_0x4d8925[_0x143d('0x5d')][_0x143d('0x35')]);_0x3f79b2[_0x143d('0x28')][_0x143d('0x6b')]=_0x3f79b2[_0x143d('0x6b')];_0x3f79b2[_0x143d('0x28')][_0x143d('0x6c')]=_0x143d('0x6d');return respondWithRpcPromise(_0x143d('0x6e'),_0x143d('0x6e'),{'event':_0x143d('0x6f'),'message':_0x3f79b2[_0x143d('0x28')]},client9002)[_0x143d('0x20')](function(){return _0x3f79b2;});}return _0x3f79b2;}return null;})[_0x143d('0x20')](respondWithResult(_0x432b0b,null))[_0x143d('0x51')](handleError(_0x432b0b,null));};var interaction_log=require(_0x143d('0x13'))(_0x143d('0x58'));exports[_0x143d('0x70')]=function(_0x12f22c,_0x752090,_0x2ca544){var _0x5ed3fd={'agent':{},'channel':_0x143d('0x59')};if(_0x12f22c[_0x143d('0x55')]['id']){delete _0x12f22c[_0x143d('0x55')]['id'];}_0x12f22c[_0x143d('0x55')]['UserId']=_0x12f22c['body']['UserId']||_0x12f22c[_0x143d('0x5d')]['id'];_0x5ed3fd[_0x143d('0x71')]['id']=_0x12f22c['body']['UserId'];return db[_0x143d('0x39')][_0x143d('0x56')]({'where':{'id':_0x12f22c[_0x143d('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x752090,null))[_0x143d('0x20')](function(_0x339cdd){if(_0x339cdd){_0x5ed3fd[_0x143d('0x28')]=_0x339cdd[_0x143d('0x60')]({'plain':!![]});return db[_0x143d('0x72')][_0x143d('0x56')]({'where':{'id':_0x339cdd[_0x143d('0x61')]}});}return null;})[_0x143d('0x20')](handleEntityNotFound(_0x752090,null))['then'](function(_0x5df164){if(_0x5df164){_0x5ed3fd[_0x143d('0x63')]=_0x5df164['get']({'plain':!![]});interaction_log[_0x143d('0x21')](_0x143d('0x73'),_0x12f22c['user']['id'],_0x12f22c[_0x143d('0x5d')][_0x143d('0x35')],_0x12f22c['user'][_0x143d('0x65')],_0x5ed3fd[_0x143d('0x63')]['id'],_0x12f22c['body']?JSON[_0x143d('0x25')](_0x12f22c[_0x143d('0x55')]):_0x143d('0x66'));return respondWithRpcPromise(_0x143d('0x74'),_0x143d('0x75'),_0x5ed3fd);}return null;})['then'](function(_0x2b99da){if(_0x2b99da){_0x2b99da[_0x143d('0x28')]['interface']=util[_0x143d('0x5a')](_0x143d('0x6a'),_0x12f22c['user'][_0x143d('0x35')]);_0x2b99da[_0x143d('0x28')][_0x143d('0x6b')]=_0x5ed3fd[_0x143d('0x6b')];_0x2b99da[_0x143d('0x28')][_0x143d('0x6c')]=_0x143d('0x70');respondWithRpcPromise(_0x143d('0x6e'),_0x143d('0x6e'),{'event':_0x143d('0x76'),'message':_0x2b99da[_0x143d('0x28')]},client9002);return _0x5ed3fd;}return null;})[_0x143d('0x20')](respondWithResult(_0x752090,null))[_0x143d('0x51')](handleError(_0x752090,null));};exports[_0x143d('0x77')]=function(_0x2e123e,_0x1c5a27){var _0x339a52;return db[_0x143d('0x39')][_0x143d('0x77')](_0x2e123e[_0x143d('0x55')],{})['then'](function(_0x41d8db){_0x339a52=_0x41d8db;return db['CmContact'][_0x143d('0x78')]({'where':{'id':_0x339a52[_0x143d('0x79')]}});})[_0x143d('0x20')](function(_0xaf17e4){if(_[_0x143d('0x62')](_0xaf17e4)){return;}else{_0x339a52[_0x143d('0x59')]=_0xaf17e4[_0x143d('0x59')];return db[_0x143d('0x7a')][_0x143d('0x78')]({'where':{'id':_0x339a52[_0x143d('0x7b')]}});}})[_0x143d('0x20')](function(_0x21c554){return respondWithRpcPromise(_0x143d('0x7c'),'SendFax',{'FaxAccountId':_[_0x143d('0x62')](_0x2e123e[_0x143d('0x55')])?undefined:_0x2e123e[_0x143d('0x55')][_0x143d('0x7d')],'path':_[_0x143d('0x62')](_0x21c554)?undefined:util[_0x143d('0x5a')](_0x143d('0x7e'),_0x21c554['basename']),'fax':_['isNil'](_0x339a52['fax'])?undefined:_0x339a52[_0x143d('0x59')],'AttachmentId':_0x339a52[_0x143d('0x7b')]},client9002);})[_0x143d('0x20')](respondWithResult(_0x1c5a27,0xc9))[_0x143d('0x51')](handleError(_0x1c5a27,null));};exports[_0x143d('0x7f')]=function(_0x4f39c4,_0x129860){var _0x420e84=path[_0x143d('0x80')](config[_0x143d('0x81')],'server',_0x143d('0x82'),_0x143d('0x83'));return db['FaxMessage']['find']({'where':{'id':_0x4f39c4[_0x143d('0x53')]['id']},'include':[{'model':db[_0x143d('0x7a')],'as':_0x143d('0x7a')}]})[_0x143d('0x20')](handleEntityNotFound(_0x129860,null))[_0x143d('0x20')](function(_0x517040){if(_0x517040){return _0x129860[_0x143d('0x7f')](path[_0x143d('0x80')](_0x420e84,_0x517040[_0x143d('0x7a')][_0x143d('0x84')]));}})['catch'](handleError(_0x129860,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 115d889..db710fc 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x18770f,_0x2342c7){_0x18770f=_0x18770f-0x0;var _0x4a7e99=_0xe14b[_0x18770f];return _0x4a7e99;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x2cbc0b,_0x2f6971){var _0x62c915=function(_0x1cfbef){while(--_0x1cfbef){_0x2cbc0b['push'](_0x2cbc0b['shift']());}};_0x62c915(++_0x2f6971);}(_0x008c,0x188));var _0xc008=function(_0x38381f,_0x4eff8a){_0x38381f=_0x38381f-0x0;var _0x1c1631=_0x008c[_0x38381f];return _0x1c1631;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 6391259..77b561b 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 _0xe5b6=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','error'];(function(_0x2e1ae1,_0x100544){var _0x203ccf=function(_0x209a5d){while(--_0x209a5d){_0x2e1ae1['push'](_0x2e1ae1['shift']());}};_0x203ccf(++_0x100544);}(_0xe5b6,0x1c4));var _0x6e5b=function(_0x37d54b,_0x206aa8){_0x37d54b=_0x37d54b-0x0;var _0x432046=_0xe5b6[_0x37d54b];return _0x432046;};'use strict';var _=require(_0x6e5b('0x0'));var util=require('util');var logger=require(_0x6e5b('0x1'))(_0x6e5b('0x2'));var moment=require(_0x6e5b('0x3'));var BPromise=require(_0x6e5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e5b('0x5'));var rimraf=require(_0x6e5b('0x6'));var config=require(_0x6e5b('0x7'));var attributes=require(_0x6e5b('0x8'));module[_0x6e5b('0x9')]=function(_0x376553,_0x2155a4){return _0x376553[_0x6e5b('0xa')](_0x6e5b('0xb'),attributes,{'tableName':_0x6e5b('0xc'),'paranoid':![],'indexes':[{'name':_0x6e5b('0xd'),'fields':[_0x6e5b('0xe')],'type':_0x6e5b('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c3326,_0x105fa0,_0x166483){var _0x48c131=_0x376553['models'];var _0x3be583=_0x2c3326[_0x6e5b('0x10')]({'plain':!![]});if(_0x3be583[_0x6e5b('0x11')][_0x6e5b('0x12')]()==='in'||_0x3be583[_0x6e5b('0x11')]['toLowerCase']()==='out'&&!_0x3be583[_0x6e5b('0x13')]&&!_[_0x6e5b('0x14')](_0x3be583[_0x6e5b('0x15')])){_0x48c131[_0x6e5b('0x16')][_0x6e5b('0x17')]({'where':{'id':_0x3be583[_0x6e5b('0x18')]}})[_0x6e5b('0x19')](function(_0x5973f){if(_0x5973f){_0x5973f['update']({'lastMsgAt':_0x3be583[_0x6e5b('0x1a')],'lastMsgDirection':_0x3be583['direction'][_0x6e5b('0x12')]()});}})['catch'](function(_0x27ea64){console[_0x6e5b('0x1b')](_0x27ea64);});}_0x166483();}},'charset':_0x6e5b('0x1c'),'collate':_0x6e5b('0x1d')});}; \ No newline at end of file +var _0x4329=['FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./faxMessage.attributes','exports','define'];(function(_0x4f1cee,_0x35f397){var _0x2f4572=function(_0x54b323){while(--_0x54b323){_0x4f1cee['push'](_0x4f1cee['shift']());}};_0x2f4572(++_0x35f397);}(_0x4329,0x18c));var _0x9432=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x4329[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var logger=require(_0x9432('0x2'))('api');var moment=require(_0x9432('0x3'));var BPromise=require(_0x9432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9432('0x5'));var rimraf=require('rimraf');var config=require(_0x9432('0x6'));var attributes=require(_0x9432('0x7'));module[_0x9432('0x8')]=function(_0x1cd073,_0x15ef52){return _0x1cd073[_0x9432('0x9')](_0x9432('0xa'),attributes,{'tableName':_0x9432('0xb'),'paranoid':![],'indexes':[{'name':_0x9432('0xc'),'fields':[_0x9432('0xd')],'type':_0x9432('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49cd0a,_0x1047b7,_0x221e57){var _0x2dd420=_0x1cd073[_0x9432('0xf')];var _0x35e014=_0x49cd0a['get']({'plain':!![]});if(_0x35e014[_0x9432('0x10')]['toLowerCase']()==='in'||_0x35e014[_0x9432('0x10')][_0x9432('0x11')]()==='out'&&!_0x35e014['secret']&&!_[_0x9432('0x12')](_0x35e014[_0x9432('0x13')])){_0x2dd420[_0x9432('0x14')][_0x9432('0x15')]({'where':{'id':_0x35e014[_0x9432('0x16')]}})['then'](function(_0xcb5014){if(_0xcb5014){_0xcb5014[_0x9432('0x17')]({'lastMsgAt':_0x35e014[_0x9432('0x18')],'lastMsgDirection':_0x35e014['direction'][_0x9432('0x11')]()});}})[_0x9432('0x19')](function(_0x5624fb){console[_0x9432('0x1a')](_0x5624fb);});}_0x221e57();}},'charset':_0x9432('0x1b'),'collate':_0x9432('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 1189f34..6f902a9 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 _0x705f=['info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','create','options','CreateFaxMessage','debug','stringify','UpdateFaxMessage','FaxMessage','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then'];(function(_0x32fe5b,_0x464e33){var _0x2440e5=function(_0x43522f){while(--_0x43522f){_0x32fe5b['push'](_0x32fe5b['shift']());}};_0x2440e5(++_0x464e33);}(_0x705f,0x1c2));var _0xf705=function(_0x2007cf,_0x42a0c1){_0x2007cf=_0x2007cf-0x0;var _0x60255c=_0x705f[_0x2007cf];return _0x60255c;};'use strict';var _=require(_0xf705('0x0'));var util=require(_0xf705('0x1'));var moment=require(_0xf705('0x2'));var BPromise=require(_0xf705('0x3'));var rs=require(_0xf705('0x4'));var fs=require('fs');var Redis=require(_0xf705('0x5'));var db=require(_0xf705('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf705('0x7'))(_0xf705('0x8'));var config=require('../../config/environment');var jayson=require(_0xf705('0x9'));var client=jayson[_0xf705('0xa')][_0xf705('0xb')]({'port':0x232a});config['redis']=_[_0xf705('0xc')](config[_0xf705('0xd')],{'host':_0xf705('0xe'),'port':0x18eb});var socket=require(_0xf705('0xf'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xf705('0x10')](socket);function respondWithRpcPromise(_0x2c9268,_0x2a0f7d,_0x4543fe){return new BPromise(function(_0x1ee8ed,_0x388e62){return client['request'](_0x2c9268,_0x4543fe)[_0xf705('0x11')](function(_0x21fe93){logger[_0xf705('0x12')](_0xf705('0x13'),_0x2a0f7d,_0xf705('0x14'));logger['debug'](_0xf705('0x15'),_0x2a0f7d,_0xf705('0x14'),JSON['stringify'](_0x21fe93));if(_0x21fe93[_0xf705('0x16')]){if(_0x21fe93[_0xf705('0x16')]['code']===0x1f4){logger[_0xf705('0x16')](_0xf705('0x13'),_0x2a0f7d,_0x21fe93[_0xf705('0x16')]['message']);return _0x388e62(_0x21fe93['error']['message']);}logger[_0xf705('0x16')]('FaxMessage,\x20%s,\x20%s',_0x2a0f7d,_0x21fe93[_0xf705('0x16')][_0xf705('0x17')]);return _0x1ee8ed(_0x21fe93[_0xf705('0x16')][_0xf705('0x17')]);}else{logger['info'](_0xf705('0x13'),_0x2a0f7d,'request\x20sent');_0x1ee8ed(_0x21fe93['result']['message']);}})[_0xf705('0x18')](function(_0x59231a){logger[_0xf705('0x16')]('FaxMessage,\x20%s,\x20%s',_0x2a0f7d,_0x59231a);_0x388e62(_0x59231a);});});}exports['CreateFaxMessage']=function(_0x10af1d){var _0x407aae=this;return new Promise(function(_0x194104,_0x2b993c){return db['FaxMessage'][_0xf705('0x19')](_0x10af1d['body'],{'raw':_0x10af1d[_0xf705('0x1a')]?_0x10af1d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2322ad){logger['info'](_0xf705('0x1b'),_0x10af1d);logger[_0xf705('0x1c')](_0xf705('0x1b'),_0x10af1d,JSON[_0xf705('0x1d')](_0x2322ad));_0x194104(_0x2322ad);})[_0xf705('0x18')](function(_0x1a8b6e){logger['error'](_0xf705('0x1b'),_0x1a8b6e[_0xf705('0x17')],_0x10af1d);_0x2b993c(_0x407aae[_0xf705('0x16')](0x1f4,_0x1a8b6e[_0xf705('0x17')]));});});};exports[_0xf705('0x1e')]=function(_0xbf7932){var _0x2f524f=this;return new Promise(function(_0x37279d,_0x100704){return db[_0xf705('0x1f')][_0xf705('0x20')](_0xbf7932['body'],{'raw':_0xbf7932[_0xf705('0x1a')]?_0xbf7932[_0xf705('0x1a')][_0xf705('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbf7932[_0xf705('0x1a')]?_0xbf7932[_0xf705('0x1a')][_0xf705('0x22')]||null:null,'attributes':_0xbf7932[_0xf705('0x1a')]?_0xbf7932[_0xf705('0x1a')]['attributes']||null:null,'limit':_0xbf7932[_0xf705('0x1a')]?_0xbf7932[_0xf705('0x1a')][_0xf705('0x23')]||null:null})['then'](function(_0x4630e4){logger[_0xf705('0x12')](_0xf705('0x1e'),_0xbf7932);logger[_0xf705('0x1c')](_0xf705('0x1e'),_0xbf7932,JSON['stringify'](_0x4630e4));_0x37279d(_0x4630e4);})[_0xf705('0x18')](function(_0x2aa156){logger[_0xf705('0x16')](_0xf705('0x1e'),_0x2aa156[_0xf705('0x17')],_0xbf7932);_0x100704(_0x2f524f[_0xf705('0x16')](0x1f4,_0x2aa156['message']));});});}; \ No newline at end of file +var _0x2d19=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x2d19,0x1b5));var _0x92d1=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x2d19[_0x3ee1fe];return _0x1ae57a;};'use strict';var _=require(_0x92d1('0x0'));var util=require('util');var moment=require(_0x92d1('0x1'));var BPromise=require(_0x92d1('0x2'));var rs=require(_0x92d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92d1('0x4'))['db'];var utils=require(_0x92d1('0x5'));var logger=require('../../config/logger')(_0x92d1('0x6'));var config=require(_0x92d1('0x7'));var jayson=require(_0x92d1('0x8'));var client=jayson['client'][_0x92d1('0x9')]({'port':0x232a});config[_0x92d1('0xa')]=_[_0x92d1('0xb')](config[_0x92d1('0xa')],{'host':_0x92d1('0xc'),'port':0x18eb});var socket=require(_0x92d1('0xd'))(new Redis(config[_0x92d1('0xa')]));require(_0x92d1('0xe'))[_0x92d1('0xf')](socket);function respondWithRpcPromise(_0x2c0e1f,_0x4d8047,_0x12b6d0){return new BPromise(function(_0x1424e7,_0x4c941b){return client['request'](_0x2c0e1f,_0x12b6d0)['then'](function(_0x3b116b){logger[_0x92d1('0x10')](_0x92d1('0x11'),_0x4d8047,_0x92d1('0x12'));logger[_0x92d1('0x13')](_0x92d1('0x14'),_0x4d8047,'request\x20sent',JSON[_0x92d1('0x15')](_0x3b116b));if(_0x3b116b[_0x92d1('0x16')]){if(_0x3b116b[_0x92d1('0x16')][_0x92d1('0x17')]===0x1f4){logger[_0x92d1('0x16')](_0x92d1('0x11'),_0x4d8047,_0x3b116b[_0x92d1('0x16')][_0x92d1('0x18')]);return _0x4c941b(_0x3b116b[_0x92d1('0x16')][_0x92d1('0x18')]);}logger['error'](_0x92d1('0x11'),_0x4d8047,_0x3b116b[_0x92d1('0x16')][_0x92d1('0x18')]);return _0x1424e7(_0x3b116b[_0x92d1('0x16')][_0x92d1('0x18')]);}else{logger[_0x92d1('0x10')](_0x92d1('0x11'),_0x4d8047,_0x92d1('0x12'));_0x1424e7(_0x3b116b[_0x92d1('0x19')][_0x92d1('0x18')]);}})[_0x92d1('0x1a')](function(_0x3e54ad){logger['error'](_0x92d1('0x11'),_0x4d8047,_0x3e54ad);_0x4c941b(_0x3e54ad);});});}exports[_0x92d1('0x1b')]=function(_0x402ab1){var _0x408a8a=this;return new Promise(function(_0xfedfdb,_0x150fa2){return db[_0x92d1('0x1c')]['create'](_0x402ab1[_0x92d1('0x1d')],{'raw':_0x402ab1[_0x92d1('0x1e')]?_0x402ab1['options'][_0x92d1('0x1f')]===undefined?!![]:![]:!![]})[_0x92d1('0x20')](function(_0xd72da8){logger[_0x92d1('0x10')](_0x92d1('0x1b'),_0x402ab1);logger['debug'](_0x92d1('0x1b'),_0x402ab1,JSON[_0x92d1('0x15')](_0xd72da8));_0xfedfdb(_0xd72da8);})[_0x92d1('0x1a')](function(_0x2945ac){logger[_0x92d1('0x16')](_0x92d1('0x1b'),_0x2945ac[_0x92d1('0x18')],_0x402ab1);_0x150fa2(_0x408a8a[_0x92d1('0x16')](0x1f4,_0x2945ac[_0x92d1('0x18')]));});});};exports[_0x92d1('0x21')]=function(_0x2e4f06){var _0x4be738=this;return new Promise(function(_0x41c695,_0x3315d5){return db['FaxMessage'][_0x92d1('0x22')](_0x2e4f06[_0x92d1('0x1d')],{'raw':_0x2e4f06['options']?_0x2e4f06[_0x92d1('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e4f06[_0x92d1('0x1e')]?_0x2e4f06[_0x92d1('0x1e')][_0x92d1('0x23')]||null:null,'attributes':_0x2e4f06[_0x92d1('0x1e')]?_0x2e4f06[_0x92d1('0x1e')][_0x92d1('0x24')]||null:null,'limit':_0x2e4f06[_0x92d1('0x1e')]?_0x2e4f06[_0x92d1('0x1e')][_0x92d1('0x25')]||null:null})[_0x92d1('0x20')](function(_0x33dfe0){logger[_0x92d1('0x10')](_0x92d1('0x21'),_0x2e4f06);logger[_0x92d1('0x13')](_0x92d1('0x21'),_0x2e4f06,JSON[_0x92d1('0x15')](_0x33dfe0));_0x41c695(_0x33dfe0);})['catch'](function(_0x2f9fe8){logger[_0x92d1('0x16')](_0x92d1('0x21'),_0x2f9fe8['message'],_0x2e4f06);_0x3315d5(_0x4be738[_0x92d1('0x16')](0x1f4,_0x2f9fe8[_0x92d1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 852da57..6382d0c 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 8cb13f1..ad14bfc 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 _0xa886=['show','download','post','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id'];(function(_0x378a46,_0x7ffbf5){var _0x14c107=function(_0x19100e){while(--_0x19100e){_0x378a46['push'](_0x378a46['shift']());}};_0x14c107(++_0x7ffbf5);}(_0xa886,0x193));var _0x6a88=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa886[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x6a88('0x0'));var path=require(_0x6a88('0x1'));var timeout=require(_0x6a88('0x2'));var express=require(_0x6a88('0x3'));var router=express[_0x6a88('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a88('0x5'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0x6a88('0x6')]('/',auth[_0x6a88('0x7')](),controller[_0x6a88('0x8')]);router['get'](_0x6a88('0x9'),auth[_0x6a88('0x7')](),controller['describe']);router[_0x6a88('0x6')](_0x6a88('0xa'),auth[_0x6a88('0x7')](),controller[_0x6a88('0xb')]);router[_0x6a88('0x6')]('/:id/download',auth[_0x6a88('0x7')](),controller[_0x6a88('0xc')]);router[_0x6a88('0xd')]('/',auth[_0x6a88('0x7')](),interaction['tracked'](_0x6a88('0xe'),_0x6a88('0xf')),controller[_0x6a88('0x10')]);router[_0x6a88('0x11')]('/:id',auth[_0x6a88('0x7')](),controller[_0x6a88('0x12')]);router[_0x6a88('0x11')]('/:id/accept',auth[_0x6a88('0x7')](),controller[_0x6a88('0x13')]);router[_0x6a88('0x11')](_0x6a88('0x14'),auth[_0x6a88('0x7')](),controller[_0x6a88('0x15')]);router[_0x6a88('0x16')](_0x6a88('0xa'),auth[_0x6a88('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5981=['describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe'];(function(_0x1ad092,_0x1b68ba){var _0x3a3c3e=function(_0x867ba8){while(--_0x867ba8){_0x1ad092['push'](_0x1ad092['shift']());}};_0x3a3c3e(++_0x1b68ba);}(_0x5981,0xa7));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1598('0x0'));var util=require(_0x1598('0x1'));var path=require(_0x1598('0x2'));var timeout=require(_0x1598('0x3'));var express=require(_0x1598('0x4'));var router=express[_0x1598('0x5')]();var auth=require(_0x1598('0x6'));var interaction=require(_0x1598('0x7'));var config=require(_0x1598('0x8'));var controller=require(_0x1598('0x9'));router['get']('/',auth[_0x1598('0xa')](),controller['index']);router[_0x1598('0xb')](_0x1598('0xc'),auth[_0x1598('0xa')](),controller[_0x1598('0xd')]);router[_0x1598('0xb')](_0x1598('0xe'),auth[_0x1598('0xa')](),controller[_0x1598('0xf')]);router[_0x1598('0xb')](_0x1598('0x10'),auth[_0x1598('0xa')](),controller['download']);router[_0x1598('0x11')]('/',auth[_0x1598('0xa')](),interaction[_0x1598('0x12')](_0x1598('0x13'),_0x1598('0x14')),controller[_0x1598('0x15')]);router[_0x1598('0x16')]('/:id',auth[_0x1598('0xa')](),controller['update']);router[_0x1598('0x16')](_0x1598('0x17'),auth[_0x1598('0xa')](),controller[_0x1598('0x18')]);router[_0x1598('0x16')](_0x1598('0x19'),auth[_0x1598('0xa')](),controller[_0x1598('0x1a')]);router[_0x1598('0x1b')]('/:id',auth[_0x1598('0xa')](),controller[_0x1598('0x1c')]);module[_0x1598('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 67454a3..08070f2 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 _0x198a=['exports','STRING','INTEGER','beepall','roundrobin','sequelize'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0x198a,0x19d));var _0xa198=function(_0x2bd86a,_0x56e109){_0x2bd86a=_0x2bd86a-0x0;var _0x11ae96=_0x198a[_0x2bd86a];return _0x11ae96;};'use strict';var Sequelize=require(_0xa198('0x0'));module[_0xa198('0x1')]={'name':{'type':Sequelize[_0xa198('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa198('0x2')]},'timeout':{'type':Sequelize[_0xa198('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xa198('0x4'),_0xa198('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa198('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x669d=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x841d72,_0x5b127a){var _0x1c5dc7=function(_0x251ba9){while(--_0x251ba9){_0x841d72['push'](_0x841d72['shift']());}};_0x1c5dc7(++_0x5b127a);}(_0x669d,0xc9));var _0xd669=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x669d[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0xd669('0x0'));module[_0xd669('0x1')]={'name':{'type':Sequelize[_0xd669('0x2')],'unique':_0xd669('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd669('0x2')]},'timeout':{'type':Sequelize[_0xd669('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd669('0x5')](_0xd669('0x6'),'beepall',_0xd669('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd669('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 24ba5b1..acea56a 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 _0x5a13=['faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','each','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','params','keys','include','find','create','user','get','FaxQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','findAll','User','findAndCountAll'];(function(_0x277180,_0x4e9546){var _0x1f25fb=function(_0x5d1b77){while(--_0x5d1b77){_0x277180['push'](_0x277180['shift']());}};_0x1f25fb(++_0x4e9546);}(_0x5a13,0x145));var _0x35a1=function(_0x361908,_0xaef2c6){_0x361908=_0x361908-0x0;var _0x207fd4=_0x5a13[_0x361908];return _0x207fd4;};'use strict';var pdf=require(_0x35a1('0x0'));var emlformat=require(_0x35a1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35a1('0x2'));var jsonpatch=require(_0x35a1('0x3'));var rp=require(_0x35a1('0x4'));var moment=require(_0x35a1('0x5'));var BPromise=require(_0x35a1('0x6'));var Mustache=require(_0x35a1('0x7'));var util=require(_0x35a1('0x8'));var path=require(_0x35a1('0x9'));var sox=require(_0x35a1('0xa'));var csv=require(_0x35a1('0xb'));var ejs=require(_0x35a1('0xc'));var fs=require('fs');var _=require(_0x35a1('0xd'));var squel=require(_0x35a1('0xe'));var crypto=require(_0x35a1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35a1('0x10'));var Papa=require(_0x35a1('0x11'));var Redis=require('ioredis');var authService=require(_0x35a1('0x12'));var qs=require(_0x35a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a1('0x14'))(_0x35a1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x35a1('0x16'))['db'];config['redis']=_[_0x35a1('0x17')](config['redis'],{'host':_0x35a1('0x18'),'port':0x18eb});var socket=require(_0x35a1('0x19'))(new Redis(config[_0x35a1('0x1a')]));require(_0x35a1('0x1b'))[_0x35a1('0x1c')](socket);function respondWithStatusCode(_0xa149d0,_0x20d868){_0x20d868=_0x20d868||0xcc;return function(_0x42de36){if(_0x42de36){return _0xa149d0[_0x35a1('0x1d')](_0x20d868);}return _0xa149d0[_0x35a1('0x1e')](_0x20d868)[_0x35a1('0x1f')]();};}function respondWithResult(_0x41939f,_0x2f93be){_0x2f93be=_0x2f93be||0xc8;return function(_0x44c755){if(_0x44c755){return _0x41939f[_0x35a1('0x1e')](_0x2f93be)[_0x35a1('0x20')](_0x44c755);}};}function respondWithFilteredResult(_0x9bdc,_0x2b22b4){return function(_0x3e7b28){if(_0x3e7b28){var _0x1de373=_0x3e7b28[_0x35a1('0x21')],_0x5e4317=_0x2b22b4[_0x35a1('0x22')],_0x3b17dc=_0x2b22b4[_0x35a1('0x22')]+_0x2b22b4[_0x35a1('0x23')],_0xbeb751;if(_0x3b17dc>=_0x1de373){_0x3b17dc=_0x1de373;_0xbeb751=0xc8;}else{_0xbeb751=0xce;}_0x9bdc[_0x35a1('0x1e')](_0xbeb751);return _0x9bdc[_0x35a1('0x24')](_0x35a1('0x25'),_0x5e4317+'-'+_0x3b17dc+'/'+_0x1de373)['json'](_0x3e7b28);}return null;};}function patchUpdates(_0x473186){return function(_0xf089dd){try{jsonpatch['apply'](_0xf089dd,_0x473186,!![]);}catch(_0xfce076){return BPromise[_0x35a1('0x26')](_0xfce076);}return _0xf089dd['save']();};}function saveUpdates(_0xc13bad,_0x5a1742){return function(_0x28af51){if(_0x28af51){return _0x28af51[_0x35a1('0x27')](_0xc13bad)[_0x35a1('0x28')](function(_0x5e42cf){return _0x5e42cf;});}return null;};}function removeEntity(_0x1ced16,_0x2b87a1){return function(_0x48f1bd){if(_0x48f1bd){return _0x48f1bd['destroy']()['then'](function(){var _0x35ad8a=_0x48f1bd['get']({'plain':!![]});var _0x5408a7='FaxQueues';return db[_0x35a1('0x29')][_0x35a1('0x2a')]({'where':{'type':_0x5408a7,'resourceId':_0x35ad8a['id']}})[_0x35a1('0x28')](function(){return _0x48f1bd;});})[_0x35a1('0x28')](function(){_0x1ced16['status'](0xcc)[_0x35a1('0x1f')]();});}};}function handleEntityNotFound(_0x34b3d8,_0x3c552c){return function(_0x1b777e){if(!_0x1b777e){_0x34b3d8[_0x35a1('0x1d')](0x194);}return _0x1b777e;};}function handleError(_0x426623,_0x3d3453){_0x3d3453=_0x3d3453||0x1f4;return function(_0x24bb2d){logger[_0x35a1('0x2b')](_0x24bb2d[_0x35a1('0x2c')]);if(_0x24bb2d[_0x35a1('0x2d')]){delete _0x24bb2d[_0x35a1('0x2d')];}_0x426623[_0x35a1('0x1e')](_0x3d3453)[_0x35a1('0x2e')](_0x24bb2d);};}exports[_0x35a1('0x2f')]=function(_0x4b74b3,_0x9720a4){var _0x379819={},_0x10b65e={},_0xd79e92={'count':0x0,'rows':[]};var _0x4382f4=_[_0x35a1('0x30')](db[_0x35a1('0x31')][_0x35a1('0x32')],function(_0x2609ab){return{'name':_0x2609ab[_0x35a1('0x33')],'type':_0x2609ab[_0x35a1('0x34')]['key']};});_0x10b65e['model']=_[_0x35a1('0x30')](_0x4382f4,'name');_0x10b65e[_0x35a1('0x35')]=_['keys'](_0x4b74b3[_0x35a1('0x35')]);_0x10b65e[_0x35a1('0x36')]=_[_0x35a1('0x37')](_0x10b65e[_0x35a1('0x38')],_0x10b65e[_0x35a1('0x35')]);_0x379819[_0x35a1('0x39')]=_[_0x35a1('0x37')](_0x10b65e[_0x35a1('0x38')],qs[_0x35a1('0x3a')](_0x4b74b3[_0x35a1('0x35')][_0x35a1('0x3a')]));_0x379819['attributes']=_0x379819[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x379819[_0x35a1('0x39')]:_0x10b65e['model'];if(!_0x4b74b3['query']['hasOwnProperty']('nolimit')){_0x379819['limit']=qs['limit'](_0x4b74b3[_0x35a1('0x35')][_0x35a1('0x23')]);_0x379819[_0x35a1('0x22')]=qs[_0x35a1('0x22')](_0x4b74b3[_0x35a1('0x35')][_0x35a1('0x22')]);}_0x379819[_0x35a1('0x3c')]=qs[_0x35a1('0x3d')](_0x4b74b3['query'][_0x35a1('0x3d')]);_0x379819['where']=qs[_0x35a1('0x36')](_[_0x35a1('0x3e')](_0x4b74b3[_0x35a1('0x35')],_0x10b65e[_0x35a1('0x36')]),_0x4382f4);if(_0x4b74b3[_0x35a1('0x35')]['filter']){_0x379819[_0x35a1('0x3f')]=_[_0x35a1('0x40')](_0x379819[_0x35a1('0x3f')],{'$or':_['map'](_0x4382f4,function(_0x599295){if(_0x599295[_0x35a1('0x34')]!==_0x35a1('0x41')){var _0x22230b={};_0x22230b[_0x599295[_0x35a1('0x2d')]]={'$like':'%'+_0x4b74b3['query'][_0x35a1('0x42')]+'%'};return _0x22230b;}})});}_0x379819=_['merge']({},_0x379819,_0x4b74b3[_0x35a1('0x43')]);var _0x5afe04={'where':_0x379819[_0x35a1('0x3f')]};return db[_0x35a1('0x31')]['count'](_0x5afe04)['then'](function(_0x221136){_0xd79e92['count']=_0x221136;if(_0x4b74b3[_0x35a1('0x35')][_0x35a1('0x44')]){_0x379819['include']=[{'all':!![]}];}return db[_0x35a1('0x31')]['findAll'](_0x379819);})[_0x35a1('0x28')](function(_0x4c4c21){_0xd79e92[_0x35a1('0x45')]=_0x4c4c21;return _0xd79e92;})['then'](respondWithFilteredResult(_0x9720a4,_0x379819))[_0x35a1('0x46')](handleError(_0x9720a4,null));};exports['show']=function(_0x3453ee,_0x4edec7){var _0x171209={'raw':!![],'where':{'id':_0x3453ee[_0x35a1('0x47')]['id']}},_0x260f29={};_0x260f29[_0x35a1('0x38')]=_[_0x35a1('0x48')](db[_0x35a1('0x31')][_0x35a1('0x32')]);_0x260f29['query']=_[_0x35a1('0x48')](_0x3453ee[_0x35a1('0x35')]);_0x260f29[_0x35a1('0x36')]=_[_0x35a1('0x37')](_0x260f29[_0x35a1('0x38')],_0x260f29[_0x35a1('0x35')]);_0x171209['attributes']=_[_0x35a1('0x37')](_0x260f29[_0x35a1('0x38')],qs[_0x35a1('0x3a')](_0x3453ee[_0x35a1('0x35')][_0x35a1('0x3a')]));_0x171209['attributes']=_0x171209[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x171209[_0x35a1('0x39')]:_0x260f29[_0x35a1('0x38')];if(_0x3453ee['query'][_0x35a1('0x44')]){_0x171209[_0x35a1('0x49')]=[{'all':!![]}];}_0x171209=_[_0x35a1('0x40')]({},_0x171209,_0x3453ee[_0x35a1('0x43')]);return db[_0x35a1('0x31')][_0x35a1('0x4a')](_0x171209)[_0x35a1('0x28')](handleEntityNotFound(_0x4edec7,null))['then'](respondWithResult(_0x4edec7,null))['catch'](handleError(_0x4edec7,null));};exports[_0x35a1('0x4b')]=function(_0x34805f,_0x2d2bb6){return db[_0x35a1('0x31')]['create'](_0x34805f['body'],{})[_0x35a1('0x28')](function(_0x43c5a8){var _0x19123f=_0x34805f[_0x35a1('0x4c')]['get']({'plain':!![]});if(!_0x19123f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19123f['role']===_0x35a1('0x4c')){var _0x5d7f55=_0x43c5a8[_0x35a1('0x4d')]({'plain':!![]});var _0x26e358=_0x35a1('0x4e');return db[_0x35a1('0x4f')][_0x35a1('0x4a')]({'where':{'name':_0x26e358,'userProfileId':_0x19123f[_0x35a1('0x50')]},'raw':!![]})[_0x35a1('0x28')](function(_0x1fed77){if(_0x1fed77&&_0x1fed77['autoAssociation']===0x0){return db[_0x35a1('0x29')][_0x35a1('0x4b')]({'name':_0x5d7f55[_0x35a1('0x2d')],'resourceId':_0x5d7f55['id'],'type':_0x1fed77['name'],'sectionId':_0x1fed77['id']},{})['then'](function(){return _0x43c5a8;});}else{return _0x43c5a8;}})['catch'](function(_0x5b156a){logger[_0x35a1('0x2b')](_0x35a1('0x51'),_0x5b156a);throw _0x5b156a;});}return _0x43c5a8;})[_0x35a1('0x28')](respondWithResult(_0x2d2bb6,0xc9))[_0x35a1('0x46')](handleError(_0x2d2bb6,null));};exports[_0x35a1('0x27')]=function(_0x358cbf,_0x3369c1){if(_0x358cbf[_0x35a1('0x52')]['id']){delete _0x358cbf[_0x35a1('0x52')]['id'];}return db[_0x35a1('0x31')]['find']({'where':{'id':_0x358cbf[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x3369c1,null))[_0x35a1('0x28')](saveUpdates(_0x358cbf['body'],null))['then'](respondWithResult(_0x3369c1,null))[_0x35a1('0x46')](handleError(_0x3369c1,null));};exports['destroy']=function(_0x1a6979,_0xb5b4e3){return db[_0x35a1('0x31')]['find']({'where':{'id':_0x1a6979['params']['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0xb5b4e3,null))['then'](removeEntity(_0xb5b4e3,null))['catch'](handleError(_0xb5b4e3,null));};exports[_0x35a1('0x53')]=function(_0x4b3e29,_0x1cec5e){return db[_0x35a1('0x31')][_0x35a1('0x53')]()[_0x35a1('0x28')](respondWithResult(_0x1cec5e,null))[_0x35a1('0x46')](handleError(_0x1cec5e,null));};exports[_0x35a1('0x54')]=function(_0x152572,_0x23ea8f,_0xd54b59){var _0x2ab62f={'raw':!![],'where':{}},_0x31851d={},_0x5a6b4e;return db[_0x35a1('0x31')][_0x35a1('0x55')]({'where':{'id':_0x152572[_0x35a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x23ea8f,null))[_0x35a1('0x28')](function(_0xa85658){if(_0xa85658){_0x5a6b4e=_0xa85658[_0x35a1('0x4d')]({'plain':!![]});_0x31851d[_0x35a1('0x38')]=_[_0x35a1('0x48')](db[_0x35a1('0x56')][_0x35a1('0x32')]);_0x31851d[_0x35a1('0x35')]=_[_0x35a1('0x48')](_0x152572[_0x35a1('0x35')]);_0x31851d[_0x35a1('0x36')]=_[_0x35a1('0x37')](_0x31851d['model'],_0x31851d[_0x35a1('0x35')]);_0x2ab62f[_0x35a1('0x39')]=_[_0x35a1('0x37')](_0x31851d[_0x35a1('0x38')],qs['fields'](_0x152572['query'][_0x35a1('0x3a')]));_0x2ab62f[_0x35a1('0x39')]=_0x2ab62f[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x2ab62f[_0x35a1('0x39')]:_0x31851d[_0x35a1('0x38')];if(!_0x152572[_0x35a1('0x35')]['hasOwnProperty'](_0x35a1('0x57'))){_0x2ab62f['limit']=qs['limit'](_0x152572[_0x35a1('0x35')][_0x35a1('0x23')]);_0x2ab62f['offset']=qs['offset'](_0x152572[_0x35a1('0x35')][_0x35a1('0x22')]);}_0x2ab62f[_0x35a1('0x3c')]=qs[_0x35a1('0x3d')](_0x152572[_0x35a1('0x35')][_0x35a1('0x3d')]);_0x2ab62f[_0x35a1('0x3f')]=qs[_0x35a1('0x36')](_['pick'](_0x152572[_0x35a1('0x35')],_0x31851d[_0x35a1('0x36')]));_0x2ab62f[_0x35a1('0x3f')][_0x35a1('0x58')]=_0xa85658['id'];if(_0x152572[_0x35a1('0x35')][_0x35a1('0x42')]){_0x2ab62f[_0x35a1('0x3f')]=_[_0x35a1('0x40')](_0x2ab62f[_0x35a1('0x3f')],{'$or':_[_0x35a1('0x30')](_0x2ab62f[_0x35a1('0x39')],function(_0x4befb3){var _0x10997c={};_0x10997c[_0x4befb3]={'$like':'%'+_0x152572[_0x35a1('0x35')]['filter']+'%'};return _0x10997c;})});}_0x2ab62f=_[_0x35a1('0x40')]({},_0x2ab62f,_0x152572[_0x35a1('0x43')]);return db[_0x35a1('0x56')][_0x35a1('0x59')](_0x2ab62f);}})[_0x35a1('0x28')](function(_0x3d1198){if(_0x3d1198){return db[_0x35a1('0x5a')][_0x35a1('0x5b')]({'where':{'id':_[_0x35a1('0x30')](_0x3d1198,'UserId'),'role':'agent'},'attributes':['id',_0x35a1('0x2d'),_0x35a1('0x5c'),_0x35a1('0x5d'),_0x35a1('0x5e')]});}})['then'](function(_0x3c37d8){if(_0x3c37d8){return{'count':_0x3c37d8[_0x35a1('0x21')],'rows':_[_0x35a1('0x30')](_0x3c37d8[_0x35a1('0x45')],function(_0x10f603){return{'membername':_0x10f603[_0x35a1('0x2d')],'UserId':_0x10f603['id'],'queue_name':_0x5a6b4e[_0x35a1('0x2d')],'FaxQueueId':_0x5a6b4e['id'],'interface':util[_0x35a1('0x5f')](_0x35a1('0x60'),_0x35a1('0x61'),_0x10f603[_0x35a1('0x2d')]),'penalty':0x0,'paused':_0x10f603['faxPause'],'createdAt':_0x10f603[_0x35a1('0x5e')],'updatedAt':_0x10f603[_0x35a1('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x23ea8f,_0x2ab62f))[_0x35a1('0x46')](handleError(_0x23ea8f,null));};exports[_0x35a1('0x62')]=function(_0x3fe7fa,_0x3717d4,_0x4e19ac){var _0xe4fe48={};var _0x3e57a4={};var _0x2e7195;var _0xa7d769;return db[_0x35a1('0x31')][_0x35a1('0x55')]({'where':{'id':_0x3fe7fa[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x3717d4,null))[_0x35a1('0x28')](function(_0x5dbbad){if(_0x5dbbad){_0x2e7195=_0x5dbbad;_0x3e57a4['model']=_['keys'](db[_0x35a1('0x63')][_0x35a1('0x32')]);_0x3e57a4[_0x35a1('0x35')]=_[_0x35a1('0x48')](_0x3fe7fa[_0x35a1('0x35')]);_0x3e57a4[_0x35a1('0x36')]=_['intersection'](_0x3e57a4['model'],_0x3e57a4[_0x35a1('0x35')]);_0xe4fe48[_0x35a1('0x39')]=_[_0x35a1('0x37')](_0x3e57a4['model'],qs[_0x35a1('0x3a')](_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x3a')]));_0xe4fe48[_0x35a1('0x39')]=_0xe4fe48['attributes']['length']?_0xe4fe48[_0x35a1('0x39')]:_0x3e57a4[_0x35a1('0x38')];_0xe4fe48['order']=qs[_0x35a1('0x3d')](_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x3d')]);_0xe4fe48[_0x35a1('0x3f')]=qs['filters'](_[_0x35a1('0x3e')](_0x3fe7fa[_0x35a1('0x35')],_0x3e57a4['filters']));if(_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x42')]){_0xe4fe48[_0x35a1('0x3f')]=_['merge'](_0xe4fe48[_0x35a1('0x3f')],{'$or':_[_0x35a1('0x30')](_0xe4fe48[_0x35a1('0x39')],function(_0xbcd000){var _0x269b3e={};_0x269b3e[_0xbcd000]={'$like':'%'+_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x42')]+'%'};return _0x269b3e;})});}_0xe4fe48=_[_0x35a1('0x40')]({},_0xe4fe48,_0x3fe7fa[_0x35a1('0x43')]);return _0x2e7195[_0x35a1('0x62')](_0xe4fe48);}})[_0x35a1('0x28')](function(_0x120fac){if(_0x120fac){_0xa7d769=_0x120fac[_0x35a1('0x3b')];if(!_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x64')](_0x35a1('0x57'))){_0xe4fe48['limit']=qs[_0x35a1('0x23')](_0x3fe7fa['query'][_0x35a1('0x23')]);_0xe4fe48[_0x35a1('0x22')]=qs['offset'](_0x3fe7fa[_0x35a1('0x35')]['offset']);}return _0x2e7195['getTeams'](_0xe4fe48);}})['then'](function(_0x10c8dc){if(_0x10c8dc){return _0x10c8dc?{'count':_0xa7d769,'rows':_0x10c8dc}:null;}})[_0x35a1('0x28')](respondWithResult(_0x3717d4,null))['catch'](handleError(_0x3717d4,null));};exports[_0x35a1('0x65')]=function(_0x265cdb,_0x3621c8,_0x2d6242){var _0x2dbed8=_0x265cdb[_0x35a1('0x52')][_0x35a1('0x66')];return db[_0x35a1('0x63')][_0x35a1('0x59')]({'where':{'id':_0x2dbed8},'attributes':['id'],'include':[{'model':db[_0x35a1('0x5a')],'as':'Agents','attributes':['id',_0x35a1('0x2d'),'online',_0x35a1('0x67'),_0x35a1('0x68')],'raw':!![]}]})[_0x35a1('0x28')](function(_0x403115){if(_0x403115){var _0x38d8c1=_[_0x35a1('0x69')](_0x403115,function(_0x365f44){var _0x453f6d=_0x365f44[_0x35a1('0x4d')]({'plain':!![]});return _0x453f6d[_0x35a1('0x6a')];});return db[_0x35a1('0x31')][_0x35a1('0x4a')]({'where':{'id':_0x265cdb[_0x35a1('0x47')]['id']}})['then'](function(_0x5e735d){return db[_0x35a1('0x6b')]['transaction'](function(_0xb1118d){return _0x5e735d[_0x35a1('0x65')](_0x2dbed8,{'transaction':_0xb1118d})[_0x35a1('0x28')](function(){return BPromise[_0x35a1('0x6c')](_0x38d8c1,function(_0x497838){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x497838['id'],'FaxQueueId':_0x265cdb[_0x35a1('0x47')]['id']},'transaction':_0xb1118d});});})[_0x35a1('0x28')](function(){_0x38d8c1[_0x35a1('0x6d')](function(_0x33fa71){socket[_0x35a1('0x6e')](_0x35a1('0x6f'),{'UserId':_0x33fa71['id'],'FaxQueueId':_0x5e735d['id']});});});});});}})['then'](respondWithStatusCode(_0x3621c8,null))[_0x35a1('0x46')](handleError(_0x3621c8,null));};exports[_0x35a1('0x70')]=function(_0xe32c07,_0x10984e,_0x2c08e9){return db['Team'][_0x35a1('0x59')]({'where':{'id':_0xe32c07['query'][_0x35a1('0x66')]},'attributes':['id'],'include':[{'model':db[_0x35a1('0x5a')],'as':_0x35a1('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10984e,null))[_0x35a1('0x28')](function(_0x4ca0f5){var _0x1dec8a=_[_0x35a1('0x30')](_0x4ca0f5,'id');var _0x140281=[];var _0x21449e=[];var _0xb60e1=squel[_0x35a1('0x71')]();_0xb60e1[_0x35a1('0x72')](_0x35a1('0x73'))['from']('team_has_fax_queues','tq')['join'](_0x35a1('0x74'),'ut',_0x35a1('0x75'))[_0x35a1('0x3f')](_0x35a1('0x76'),_0xe32c07[_0x35a1('0x47')]['id']);for(var _0x5ec513=0x0;_0x5ec513<_0x4ca0f5['length'];_0x5ec513+=0x1){let _0x2f6860=_0x4ca0f5[_0x5ec513];for(var _0x2ec879=0x0;_0x2ec879<_0x2f6860[_0x35a1('0x6a')][_0x35a1('0x3b')];_0x2ec879+=0x1){let _0x578a61=_0x2f6860['Agents'][_0x2ec879];var _0x3a0115=_0xb60e1[_0x35a1('0x77')]();_0x3a0115[_0x35a1('0x3f')](_0x35a1('0x78'),_0x578a61['id']);_0x21449e[_0x35a1('0x79')](db[_0x35a1('0x6b')][_0x35a1('0x35')](_0x3a0115[_0x35a1('0x7a')](),{'type':db[_0x35a1('0x6b')][_0x35a1('0x7b')][_0x35a1('0x7c')]})[_0x35a1('0x28')](function(_0x24d168){if(_0x24d168[_0x35a1('0x3b')]===0x1){return _0x578a61['id'];}else{var _0x3cebc6=_[_0x35a1('0x7d')](_['map'](_0x24d168,_0x35a1('0x7e')),function(_0x3af5f8){return _[_0x35a1('0x7f')](_0x1dec8a,_0x3af5f8);});if(_0x3cebc6){return _0x578a61['id'];}}}));}}return BPromise['all'](_0x21449e)[_0x35a1('0x28')](function(_0x27f1f7){_0x140281=_(_0x140281)[_0x35a1('0x80')](_0x27f1f7)[_0x35a1('0x81')]()['value']();return db[_0x35a1('0x31')][_0x35a1('0x4a')]({'where':{'id':_0xe32c07[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](function(_0x525467){return db[_0x35a1('0x6b')][_0x35a1('0x82')](function(_0x4dea99){return _0x525467[_0x35a1('0x70')](_0xe32c07['query'][_0x35a1('0x66')],{'transaction':_0x4dea99})[_0x35a1('0x28')](function(){if(!_[_0x35a1('0x83')](_0x140281)){return _0x525467[_0x35a1('0x84')](_0x140281,{'transaction':_0x4dea99});}})[_0x35a1('0x28')](function(){_0x140281[_0x35a1('0x6d')](function(_0x3f4f47){socket[_0x35a1('0x6e')](_0x35a1('0x85'),{'UserId':_0x3f4f47,'FaxQueueId':_0x525467['id']});});});});});});})[_0x35a1('0x28')](respondWithStatusCode(_0x10984e,null))[_0x35a1('0x46')](handleError(_0x10984e,null));};exports[_0x35a1('0x86')]=function(_0x260483,_0x138ad1,_0xdd3b08){return db[_0x35a1('0x31')][_0x35a1('0x4a')]({'where':{'id':_0x260483[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x138ad1,null))['then'](function(_0xbce060){if(_0xbce060){return _0xbce060['addAgents'](_0x260483[_0x35a1('0x52')][_0x35a1('0x66')],_[_0x35a1('0x87')](_0x260483[_0x35a1('0x52')],[_0x35a1('0x66'),'id'])||{})[_0x35a1('0x88')](function(_0x1a56cf){for(var _0x34e210=0x0;_0x34e210<_0x260483[_0x35a1('0x52')][_0x35a1('0x66')][_0x35a1('0x3b')];_0x34e210+=0x1){socket['emit'](_0x35a1('0x6f'),{'UserId':_0x260483[_0x35a1('0x52')]['ids'][_0x34e210],'FaxQueueId':_0x260483['params']['id']});}return _0x1a56cf;});}})[_0x35a1('0x28')](respondWithResult(_0x138ad1,null))[_0x35a1('0x46')](handleError(_0x138ad1,null));};exports[_0x35a1('0x84')]=function(_0x48e853,_0x146c7a,_0x5654a3){return db[_0x35a1('0x31')][_0x35a1('0x4a')]({'where':{'id':_0x48e853[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x146c7a,null))[_0x35a1('0x28')](function(_0x3e0ae6){if(_0x3e0ae6){return _0x3e0ae6[_0x35a1('0x84')](_0x48e853[_0x35a1('0x35')][_0x35a1('0x66')])['then'](function(){if(_[_0x35a1('0x89')](_0x48e853[_0x35a1('0x35')][_0x35a1('0x66')])){for(var _0x4a8f2f=0x0;_0x4a8f2f<_0x48e853['query'][_0x35a1('0x66')][_0x35a1('0x3b')];_0x4a8f2f+=0x1){socket[_0x35a1('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x48e853[_0x35a1('0x35')]['ids'][_0x4a8f2f]),'FaxQueueId':Number(_0x48e853[_0x35a1('0x47')]['id'])});}}else{socket[_0x35a1('0x6e')](_0x35a1('0x85'),{'UserId':Number(_0x48e853[_0x35a1('0x35')]['ids']),'FaxQueueId':Number(_0x48e853[_0x35a1('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x146c7a,null))[_0x35a1('0x46')](handleError(_0x146c7a,null));};exports['getAgents']=function(_0xeedeea,_0x3caea6,_0x1dd36b){var _0x16e621={};var _0x272032={};var _0x523aba;var _0x46db8a;return db[_0x35a1('0x31')]['findOne']({'where':{'id':_0xeedeea['params']['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x3caea6,null))[_0x35a1('0x28')](function(_0x437c27){if(_0x437c27){_0x523aba=_0x437c27;_0x272032[_0x35a1('0x38')]=_[_0x35a1('0x48')](db[_0x35a1('0x5a')][_0x35a1('0x32')]);_0x272032[_0x35a1('0x35')]=_[_0x35a1('0x48')](_0xeedeea[_0x35a1('0x35')]);_0x272032['filters']=_[_0x35a1('0x37')](_0x272032[_0x35a1('0x38')],_0x272032['query']);_0x16e621['attributes']=_[_0x35a1('0x37')](_0x272032[_0x35a1('0x38')],qs['fields'](_0xeedeea[_0x35a1('0x35')][_0x35a1('0x3a')]));_0x16e621[_0x35a1('0x39')]=_0x16e621[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x16e621[_0x35a1('0x39')]:_0x272032['model'];_0x16e621[_0x35a1('0x3c')]=qs[_0x35a1('0x3d')](_0xeedeea['query']['sort']);_0x16e621[_0x35a1('0x3f')]=qs['filters'](_[_0x35a1('0x3e')](_0xeedeea[_0x35a1('0x35')],_0x272032[_0x35a1('0x36')]));if(_0xeedeea[_0x35a1('0x35')][_0x35a1('0x42')]){_0x16e621[_0x35a1('0x3f')]=_[_0x35a1('0x40')](_0x16e621[_0x35a1('0x3f')],{'$or':_[_0x35a1('0x30')](_0x16e621[_0x35a1('0x39')],function(_0xfadebf){var _0x1eef50={};_0x1eef50[_0xfadebf]={'$like':'%'+_0xeedeea['query'][_0x35a1('0x42')]+'%'};return _0x1eef50;})});}_0x16e621=_['merge']({},_0x16e621,_0xeedeea[_0x35a1('0x43')]);return _0x523aba[_0x35a1('0x8a')](_0x16e621);}})[_0x35a1('0x28')](function(_0x5b7da0){if(_0x5b7da0){_0x46db8a=_0x5b7da0[_0x35a1('0x3b')];if(!_0xeedeea[_0x35a1('0x35')][_0x35a1('0x64')](_0x35a1('0x57'))){_0x16e621[_0x35a1('0x23')]=qs[_0x35a1('0x23')](_0xeedeea[_0x35a1('0x35')][_0x35a1('0x23')]);_0x16e621[_0x35a1('0x22')]=qs['offset'](_0xeedeea[_0x35a1('0x35')][_0x35a1('0x22')]);}return _0x523aba[_0x35a1('0x8a')](_0x16e621);}})[_0x35a1('0x28')](function(_0x2239c7){if(_0x2239c7){return _0x2239c7?{'count':_0x46db8a,'rows':_0x2239c7}:null;}})[_0x35a1('0x28')](respondWithResult(_0x3caea6,null))[_0x35a1('0x46')](handleError(_0x3caea6,null));}; \ No newline at end of file +var _0x6f18=['forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','type','model','keys','query','filters','attributes','intersection','fields','length','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserFaxQueue','nolimit','FaxQueueId','findAll','User','findAndCountAll','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','pick','hasOwnProperty','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','compact','transaction','removeAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f18,0x1b4));var _0x86f1=function(_0x51a6bf,_0x5eb1ee){_0x51a6bf=_0x51a6bf-0x0;var _0x4a39b4=_0x6f18[_0x51a6bf];return _0x4a39b4;};'use strict';var pdf=require(_0x86f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x86f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86f1('0x2'));var rp=require(_0x86f1('0x3'));var moment=require('moment');var BPromise=require(_0x86f1('0x4'));var Mustache=require(_0x86f1('0x5'));var util=require('util');var path=require(_0x86f1('0x6'));var sox=require(_0x86f1('0x7'));var csv=require(_0x86f1('0x8'));var ejs=require(_0x86f1('0x9'));var fs=require('fs');var _=require(_0x86f1('0xa'));var squel=require('squel');var crypto=require(_0x86f1('0xb'));var jsforce=require(_0x86f1('0xc'));var deskjs=require(_0x86f1('0xd'));var toCsv=require(_0x86f1('0x8'));var querystring=require(_0x86f1('0xe'));var Papa=require('papaparse');var Redis=require(_0x86f1('0xf'));var authService=require(_0x86f1('0x10'));var qs=require(_0x86f1('0x11'));var as=require(_0x86f1('0x12'));var hardwareService=require(_0x86f1('0x13'));var logger=require(_0x86f1('0x14'))(_0x86f1('0x15'));var utils=require(_0x86f1('0x16'));var config=require('../../config/environment');var db=require(_0x86f1('0x17'))['db'];config[_0x86f1('0x18')]=_[_0x86f1('0x19')](config[_0x86f1('0x18')],{'host':_0x86f1('0x1a'),'port':0x18eb});var socket=require(_0x86f1('0x1b'))(new Redis(config['redis']));require(_0x86f1('0x1c'))[_0x86f1('0x1d')](socket);function respondWithStatusCode(_0x1b16ff,_0x648502){_0x648502=_0x648502||0xcc;return function(_0x2a2281){if(_0x2a2281){return _0x1b16ff[_0x86f1('0x1e')](_0x648502);}return _0x1b16ff[_0x86f1('0x1f')](_0x648502)[_0x86f1('0x20')]();};}function respondWithResult(_0x512cde,_0x2cae10){_0x2cae10=_0x2cae10||0xc8;return function(_0x15abcb){if(_0x15abcb){return _0x512cde[_0x86f1('0x1f')](_0x2cae10)[_0x86f1('0x21')](_0x15abcb);}};}function respondWithFilteredResult(_0x2ffc52,_0x129b03){return function(_0x290bca){if(_0x290bca){var _0x7e1756=_0x290bca[_0x86f1('0x22')],_0x1adad5=_0x129b03[_0x86f1('0x23')],_0x4fd6dc=_0x129b03['offset']+_0x129b03['limit'],_0x144018;if(_0x4fd6dc>=_0x7e1756){_0x4fd6dc=_0x7e1756;_0x144018=0xc8;}else{_0x144018=0xce;}_0x2ffc52[_0x86f1('0x1f')](_0x144018);return _0x2ffc52[_0x86f1('0x24')](_0x86f1('0x25'),_0x1adad5+'-'+_0x4fd6dc+'/'+_0x7e1756)[_0x86f1('0x21')](_0x290bca);}return null;};}function patchUpdates(_0xabac12){return function(_0x2196fd){try{jsonpatch[_0x86f1('0x26')](_0x2196fd,_0xabac12,!![]);}catch(_0xe937bc){return BPromise[_0x86f1('0x27')](_0xe937bc);}return _0x2196fd[_0x86f1('0x28')]();};}function saveUpdates(_0x4c13ed,_0x9fced7){return function(_0x22e66f){if(_0x22e66f){return _0x22e66f[_0x86f1('0x29')](_0x4c13ed)['then'](function(_0xe41503){return _0xe41503;});}return null;};}function removeEntity(_0x4b3b6c,_0x398224){return function(_0x6cba5c){if(_0x6cba5c){return _0x6cba5c[_0x86f1('0x2a')]()[_0x86f1('0x2b')](function(){var _0x57573=_0x6cba5c[_0x86f1('0x2c')]({'plain':!![]});var _0x282155=_0x86f1('0x2d');return db[_0x86f1('0x2e')][_0x86f1('0x2a')]({'where':{'type':_0x282155,'resourceId':_0x57573['id']}})[_0x86f1('0x2b')](function(){return _0x6cba5c;});})['then'](function(){_0x4b3b6c[_0x86f1('0x1f')](0xcc)[_0x86f1('0x20')]();});}};}function handleEntityNotFound(_0x5f575b,_0x4e98b7){return function(_0x360480){if(!_0x360480){_0x5f575b[_0x86f1('0x1e')](0x194);}return _0x360480;};}function handleError(_0x39685e,_0x5f18ad){_0x5f18ad=_0x5f18ad||0x1f4;return function(_0x16e3b3){logger[_0x86f1('0x2f')](_0x16e3b3['stack']);if(_0x16e3b3[_0x86f1('0x30')]){delete _0x16e3b3[_0x86f1('0x30')];}_0x39685e[_0x86f1('0x1f')](_0x5f18ad)[_0x86f1('0x31')](_0x16e3b3);};}exports[_0x86f1('0x32')]=function(_0x48b21b,_0x57e4f2){var _0x486991={},_0x82c486={},_0x18dea6={'count':0x0,'rows':[]};var _0x34e4c1=_[_0x86f1('0x33')](db[_0x86f1('0x34')]['rawAttributes'],function(_0x2dc7d7){return{'name':_0x2dc7d7['fieldName'],'type':_0x2dc7d7[_0x86f1('0x35')]['key']};});_0x82c486[_0x86f1('0x36')]=_[_0x86f1('0x33')](_0x34e4c1,_0x86f1('0x30'));_0x82c486['query']=_[_0x86f1('0x37')](_0x48b21b[_0x86f1('0x38')]);_0x82c486[_0x86f1('0x39')]=_['intersection'](_0x82c486['model'],_0x82c486[_0x86f1('0x38')]);_0x486991[_0x86f1('0x3a')]=_[_0x86f1('0x3b')](_0x82c486[_0x86f1('0x36')],qs[_0x86f1('0x3c')](_0x48b21b[_0x86f1('0x38')][_0x86f1('0x3c')]));_0x486991[_0x86f1('0x3a')]=_0x486991[_0x86f1('0x3a')][_0x86f1('0x3d')]?_0x486991[_0x86f1('0x3a')]:_0x82c486[_0x86f1('0x36')];if(!_0x48b21b[_0x86f1('0x38')]['hasOwnProperty']('nolimit')){_0x486991[_0x86f1('0x3e')]=qs['limit'](_0x48b21b['query'][_0x86f1('0x3e')]);_0x486991[_0x86f1('0x23')]=qs[_0x86f1('0x23')](_0x48b21b[_0x86f1('0x38')][_0x86f1('0x23')]);}_0x486991[_0x86f1('0x3f')]=qs['sort'](_0x48b21b['query'][_0x86f1('0x40')]);_0x486991[_0x86f1('0x41')]=qs['filters'](_['pick'](_0x48b21b['query'],_0x82c486[_0x86f1('0x39')]),_0x34e4c1);if(_0x48b21b[_0x86f1('0x38')][_0x86f1('0x42')]){_0x486991[_0x86f1('0x41')]=_['merge'](_0x486991[_0x86f1('0x41')],{'$or':_[_0x86f1('0x33')](_0x34e4c1,function(_0xfb6d2){if(_0xfb6d2[_0x86f1('0x35')]!==_0x86f1('0x43')){var _0x345ef0={};_0x345ef0[_0xfb6d2[_0x86f1('0x30')]]={'$like':'%'+_0x48b21b[_0x86f1('0x38')]['filter']+'%'};return _0x345ef0;}})});}_0x486991=_[_0x86f1('0x44')]({},_0x486991,_0x48b21b[_0x86f1('0x45')]);var _0x382196={'where':_0x486991[_0x86f1('0x41')]};return db[_0x86f1('0x34')][_0x86f1('0x22')](_0x382196)[_0x86f1('0x2b')](function(_0x618ad9){_0x18dea6[_0x86f1('0x22')]=_0x618ad9;if(_0x48b21b[_0x86f1('0x38')][_0x86f1('0x46')]){_0x486991[_0x86f1('0x47')]=[{'all':!![]}];}return db[_0x86f1('0x34')]['findAll'](_0x486991);})['then'](function(_0x30ec49){_0x18dea6[_0x86f1('0x48')]=_0x30ec49;return _0x18dea6;})[_0x86f1('0x2b')](respondWithFilteredResult(_0x57e4f2,_0x486991))[_0x86f1('0x49')](handleError(_0x57e4f2,null));};exports[_0x86f1('0x4a')]=function(_0x32a455,_0x1b0918){var _0x561058={'raw':!![],'where':{'id':_0x32a455['params']['id']}},_0x40c8af={};_0x40c8af[_0x86f1('0x36')]=_['keys'](db[_0x86f1('0x34')][_0x86f1('0x4b')]);_0x40c8af[_0x86f1('0x38')]=_[_0x86f1('0x37')](_0x32a455[_0x86f1('0x38')]);_0x40c8af[_0x86f1('0x39')]=_[_0x86f1('0x3b')](_0x40c8af[_0x86f1('0x36')],_0x40c8af[_0x86f1('0x38')]);_0x561058[_0x86f1('0x3a')]=_[_0x86f1('0x3b')](_0x40c8af[_0x86f1('0x36')],qs[_0x86f1('0x3c')](_0x32a455['query'][_0x86f1('0x3c')]));_0x561058[_0x86f1('0x3a')]=_0x561058[_0x86f1('0x3a')][_0x86f1('0x3d')]?_0x561058[_0x86f1('0x3a')]:_0x40c8af['model'];if(_0x32a455[_0x86f1('0x38')][_0x86f1('0x46')]){_0x561058[_0x86f1('0x47')]=[{'all':!![]}];}_0x561058=_[_0x86f1('0x44')]({},_0x561058,_0x32a455[_0x86f1('0x45')]);return db[_0x86f1('0x34')][_0x86f1('0x4c')](_0x561058)['then'](handleEntityNotFound(_0x1b0918,null))['then'](respondWithResult(_0x1b0918,null))[_0x86f1('0x49')](handleError(_0x1b0918,null));};exports['create']=function(_0x28c671,_0x2fe07b){return db['FaxQueue'][_0x86f1('0x4d')](_0x28c671[_0x86f1('0x4e')],{})[_0x86f1('0x2b')](function(_0x2e5d29){var _0x32ad7c=_0x28c671['user']['get']({'plain':!![]});if(!_0x32ad7c)throw new Error(_0x86f1('0x4f'));if(_0x32ad7c[_0x86f1('0x50')]===_0x86f1('0x51')){var _0x961ea3=_0x2e5d29[_0x86f1('0x2c')]({'plain':!![]});var _0x2cb1d3=_0x86f1('0x2d');return db['UserProfileSection'][_0x86f1('0x4c')]({'where':{'name':_0x2cb1d3,'userProfileId':_0x32ad7c[_0x86f1('0x52')]},'raw':!![]})[_0x86f1('0x2b')](function(_0x15838a){if(_0x15838a&&_0x15838a[_0x86f1('0x53')]===0x0){return db[_0x86f1('0x2e')][_0x86f1('0x4d')]({'name':_0x961ea3[_0x86f1('0x30')],'resourceId':_0x961ea3['id'],'type':_0x15838a['name'],'sectionId':_0x15838a['id']},{})[_0x86f1('0x2b')](function(){return _0x2e5d29;});}else{return _0x2e5d29;}})['catch'](function(_0x4f335c){logger[_0x86f1('0x2f')](_0x86f1('0x54'),_0x4f335c);throw _0x4f335c;});}return _0x2e5d29;})['then'](respondWithResult(_0x2fe07b,0xc9))[_0x86f1('0x49')](handleError(_0x2fe07b,null));};exports[_0x86f1('0x29')]=function(_0xb5c3db,_0x1ea9f2){if(_0xb5c3db['body']['id']){delete _0xb5c3db['body']['id'];}return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0xb5c3db[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x1ea9f2,null))['then'](saveUpdates(_0xb5c3db[_0x86f1('0x4e')],null))[_0x86f1('0x2b')](respondWithResult(_0x1ea9f2,null))[_0x86f1('0x49')](handleError(_0x1ea9f2,null));};exports[_0x86f1('0x2a')]=function(_0x2f788b,_0x1a72bb){return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x2f788b[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x1a72bb,null))[_0x86f1('0x2b')](removeEntity(_0x1a72bb,null))[_0x86f1('0x49')](handleError(_0x1a72bb,null));};exports[_0x86f1('0x56')]=function(_0x1fdfbe,_0x297635){return db[_0x86f1('0x34')]['describe']()[_0x86f1('0x2b')](respondWithResult(_0x297635,null))['catch'](handleError(_0x297635,null));};exports['getMembers']=function(_0x20e162,_0x70be66,_0x490d65){var _0x5a65a5={'raw':!![],'where':{}},_0xb2e276={},_0x4f5cb4;return db[_0x86f1('0x34')][_0x86f1('0x57')]({'where':{'id':_0x20e162[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x70be66,null))[_0x86f1('0x2b')](function(_0x59b7dd){if(_0x59b7dd){_0x4f5cb4=_0x59b7dd['get']({'plain':!![]});_0xb2e276[_0x86f1('0x36')]=_[_0x86f1('0x37')](db[_0x86f1('0x58')][_0x86f1('0x4b')]);_0xb2e276[_0x86f1('0x38')]=_[_0x86f1('0x37')](_0x20e162['query']);_0xb2e276['filters']=_[_0x86f1('0x3b')](_0xb2e276['model'],_0xb2e276[_0x86f1('0x38')]);_0x5a65a5['attributes']=_[_0x86f1('0x3b')](_0xb2e276['model'],qs[_0x86f1('0x3c')](_0x20e162[_0x86f1('0x38')][_0x86f1('0x3c')]));_0x5a65a5[_0x86f1('0x3a')]=_0x5a65a5['attributes'][_0x86f1('0x3d')]?_0x5a65a5[_0x86f1('0x3a')]:_0xb2e276[_0x86f1('0x36')];if(!_0x20e162[_0x86f1('0x38')]['hasOwnProperty'](_0x86f1('0x59'))){_0x5a65a5[_0x86f1('0x3e')]=qs[_0x86f1('0x3e')](_0x20e162[_0x86f1('0x38')][_0x86f1('0x3e')]);_0x5a65a5['offset']=qs[_0x86f1('0x23')](_0x20e162['query'][_0x86f1('0x23')]);}_0x5a65a5[_0x86f1('0x3f')]=qs[_0x86f1('0x40')](_0x20e162[_0x86f1('0x38')][_0x86f1('0x40')]);_0x5a65a5[_0x86f1('0x41')]=qs[_0x86f1('0x39')](_['pick'](_0x20e162['query'],_0xb2e276[_0x86f1('0x39')]));_0x5a65a5['where'][_0x86f1('0x5a')]=_0x59b7dd['id'];if(_0x20e162[_0x86f1('0x38')][_0x86f1('0x42')]){_0x5a65a5['where']=_['merge'](_0x5a65a5[_0x86f1('0x41')],{'$or':_[_0x86f1('0x33')](_0x5a65a5[_0x86f1('0x3a')],function(_0x5989ec){var _0x1f6cf3={};_0x1f6cf3[_0x5989ec]={'$like':'%'+_0x20e162[_0x86f1('0x38')][_0x86f1('0x42')]+'%'};return _0x1f6cf3;})});}_0x5a65a5=_[_0x86f1('0x44')]({},_0x5a65a5,_0x20e162[_0x86f1('0x45')]);return db[_0x86f1('0x58')][_0x86f1('0x5b')](_0x5a65a5);}})[_0x86f1('0x2b')](function(_0x282450){if(_0x282450){return db[_0x86f1('0x5c')][_0x86f1('0x5d')]({'where':{'id':_['map'](_0x282450,'UserId'),'role':_0x86f1('0x5e')},'attributes':['id',_0x86f1('0x30'),_0x86f1('0x5f'),'updatedAt',_0x86f1('0x60')]});}})[_0x86f1('0x2b')](function(_0x137380){if(_0x137380){return{'count':_0x137380['count'],'rows':_[_0x86f1('0x33')](_0x137380[_0x86f1('0x48')],function(_0x3314c3){return{'membername':_0x3314c3[_0x86f1('0x30')],'UserId':_0x3314c3['id'],'queue_name':_0x4f5cb4['name'],'FaxQueueId':_0x4f5cb4['id'],'interface':util[_0x86f1('0x61')](_0x86f1('0x62'),_0x86f1('0x63'),_0x3314c3[_0x86f1('0x30')]),'penalty':0x0,'paused':_0x3314c3['faxPause'],'createdAt':_0x3314c3[_0x86f1('0x60')],'updatedAt':_0x3314c3[_0x86f1('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x70be66,_0x5a65a5))[_0x86f1('0x49')](handleError(_0x70be66,null));};exports[_0x86f1('0x65')]=function(_0x4c5115,_0x34d58b,_0x3f4dc6){var _0x505b38={};var _0x4596c3={};var _0x54f91b;var _0x4e6fd9;return db[_0x86f1('0x34')]['findOne']({'where':{'id':_0x4c5115['params']['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x34d58b,null))[_0x86f1('0x2b')](function(_0x585c91){if(_0x585c91){_0x54f91b=_0x585c91;_0x4596c3[_0x86f1('0x36')]=_[_0x86f1('0x37')](db[_0x86f1('0x66')][_0x86f1('0x4b')]);_0x4596c3[_0x86f1('0x38')]=_[_0x86f1('0x37')](_0x4c5115[_0x86f1('0x38')]);_0x4596c3['filters']=_[_0x86f1('0x3b')](_0x4596c3[_0x86f1('0x36')],_0x4596c3[_0x86f1('0x38')]);_0x505b38['attributes']=_[_0x86f1('0x3b')](_0x4596c3['model'],qs[_0x86f1('0x3c')](_0x4c5115[_0x86f1('0x38')]['fields']));_0x505b38['attributes']=_0x505b38[_0x86f1('0x3a')][_0x86f1('0x3d')]?_0x505b38[_0x86f1('0x3a')]:_0x4596c3['model'];_0x505b38[_0x86f1('0x3f')]=qs[_0x86f1('0x40')](_0x4c5115['query'][_0x86f1('0x40')]);_0x505b38[_0x86f1('0x41')]=qs[_0x86f1('0x39')](_[_0x86f1('0x67')](_0x4c5115['query'],_0x4596c3[_0x86f1('0x39')]));if(_0x4c5115['query'][_0x86f1('0x42')]){_0x505b38[_0x86f1('0x41')]=_[_0x86f1('0x44')](_0x505b38[_0x86f1('0x41')],{'$or':_[_0x86f1('0x33')](_0x505b38[_0x86f1('0x3a')],function(_0x27cb20){var _0x320146={};_0x320146[_0x27cb20]={'$like':'%'+_0x4c5115[_0x86f1('0x38')]['filter']+'%'};return _0x320146;})});}_0x505b38=_[_0x86f1('0x44')]({},_0x505b38,_0x4c5115['options']);return _0x54f91b['getTeams'](_0x505b38);}})[_0x86f1('0x2b')](function(_0xc8fee2){if(_0xc8fee2){_0x4e6fd9=_0xc8fee2[_0x86f1('0x3d')];if(!_0x4c5115[_0x86f1('0x38')][_0x86f1('0x68')](_0x86f1('0x59'))){_0x505b38['limit']=qs[_0x86f1('0x3e')](_0x4c5115[_0x86f1('0x38')][_0x86f1('0x3e')]);_0x505b38[_0x86f1('0x23')]=qs['offset'](_0x4c5115['query'][_0x86f1('0x23')]);}return _0x54f91b['getTeams'](_0x505b38);}})['then'](function(_0x42d4e2){if(_0x42d4e2){return _0x42d4e2?{'count':_0x4e6fd9,'rows':_0x42d4e2}:null;}})[_0x86f1('0x2b')](respondWithResult(_0x34d58b,null))[_0x86f1('0x49')](handleError(_0x34d58b,null));};exports[_0x86f1('0x69')]=function(_0x116891,_0x4f9c38,_0xd4baa3){var _0x5cf573=_0x116891[_0x86f1('0x4e')][_0x86f1('0x6a')];return db['Team'][_0x86f1('0x5b')]({'where':{'id':_0x5cf573},'attributes':['id'],'include':[{'model':db[_0x86f1('0x5c')],'as':'Agents','attributes':['id',_0x86f1('0x30'),_0x86f1('0x6b'),_0x86f1('0x6c'),_0x86f1('0x6d')],'raw':!![]}]})[_0x86f1('0x2b')](function(_0x2336e6){if(_0x2336e6){var _0x46a0fd=_[_0x86f1('0x6e')](_0x2336e6,function(_0x459c0a){var _0x40c508=_0x459c0a[_0x86f1('0x2c')]({'plain':!![]});return _0x40c508[_0x86f1('0x6f')];});return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x116891['params']['id']}})[_0x86f1('0x2b')](function(_0x59a5aa){return db[_0x86f1('0x70')]['transaction'](function(_0x2f7bc9){return _0x59a5aa[_0x86f1('0x69')](_0x5cf573,{'transaction':_0x2f7bc9})['then'](function(){return BPromise[_0x86f1('0x71')](_0x46a0fd,function(_0x535836){return db[_0x86f1('0x58')]['findOrCreate']({'where':{'UserId':_0x535836['id'],'FaxQueueId':_0x116891[_0x86f1('0x55')]['id']},'transaction':_0x2f7bc9});});})['then'](function(){_0x46a0fd['forEach'](function(_0x4db0d6){socket[_0x86f1('0x72')](_0x86f1('0x73'),{'UserId':_0x4db0d6['id'],'FaxQueueId':_0x59a5aa['id']});});});});});}})[_0x86f1('0x2b')](respondWithStatusCode(_0x4f9c38,null))[_0x86f1('0x49')](handleError(_0x4f9c38,null));};exports[_0x86f1('0x74')]=function(_0x299285,_0x162f19,_0x1cf838){return db[_0x86f1('0x66')][_0x86f1('0x5b')]({'where':{'id':_0x299285[_0x86f1('0x38')][_0x86f1('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x86f1('0x5c')],'as':_0x86f1('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x162f19,null))[_0x86f1('0x2b')](function(_0x1d81bf){var _0x617d4e=_[_0x86f1('0x33')](_0x1d81bf,'id');var _0x3fb15b=[];var _0x5040f5=[];var _0x4fc156=squel[_0x86f1('0x75')]();_0x4fc156[_0x86f1('0x76')](_0x86f1('0x77'))[_0x86f1('0x78')](_0x86f1('0x79'),'tq')[_0x86f1('0x7a')](_0x86f1('0x7b'),'ut',_0x86f1('0x7c'))[_0x86f1('0x41')]('FaxQueueId\x20=\x20?',_0x299285[_0x86f1('0x55')]['id']);for(var _0x4e86f8=0x0;_0x4e86f8<_0x1d81bf[_0x86f1('0x3d')];_0x4e86f8+=0x1){let _0x6394c2=_0x1d81bf[_0x4e86f8];for(var _0x2ef891=0x0;_0x2ef891<_0x6394c2[_0x86f1('0x6f')][_0x86f1('0x3d')];_0x2ef891+=0x1){let _0x451171=_0x6394c2[_0x86f1('0x6f')][_0x2ef891];var _0x3bc3a7=_0x4fc156[_0x86f1('0x7d')]();_0x3bc3a7[_0x86f1('0x41')](_0x86f1('0x7e'),_0x451171['id']);_0x5040f5[_0x86f1('0x7f')](db[_0x86f1('0x70')][_0x86f1('0x38')](_0x3bc3a7[_0x86f1('0x80')](),{'type':db[_0x86f1('0x70')][_0x86f1('0x81')]['SELECT']})['then'](function(_0x3c2bf0){if(_0x3c2bf0[_0x86f1('0x3d')]===0x1){return _0x451171['id'];}else{var _0x85597d=_['every'](_[_0x86f1('0x33')](_0x3c2bf0,_0x86f1('0x82')),function(_0x33f01d){return _[_0x86f1('0x83')](_0x617d4e,_0x33f01d);});if(_0x85597d){return _0x451171['id'];}}}));}}return BPromise[_0x86f1('0x84')](_0x5040f5)[_0x86f1('0x2b')](function(_0x3c140f){_0x3fb15b=_(_0x3fb15b)['union'](_0x3c140f)[_0x86f1('0x85')]()['value']();return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x299285[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](function(_0x237bb2){return db[_0x86f1('0x70')][_0x86f1('0x86')](function(_0x336149){return _0x237bb2['removeTeams'](_0x299285[_0x86f1('0x38')]['ids'],{'transaction':_0x336149})[_0x86f1('0x2b')](function(){if(!_['isEmpty'](_0x3fb15b)){return _0x237bb2[_0x86f1('0x87')](_0x3fb15b,{'transaction':_0x336149});}})['then'](function(){_0x3fb15b[_0x86f1('0x88')](function(_0x2b749f){socket['emit'](_0x86f1('0x89'),{'UserId':_0x2b749f,'FaxQueueId':_0x237bb2['id']});});});});});});})[_0x86f1('0x2b')](respondWithStatusCode(_0x162f19,null))[_0x86f1('0x49')](handleError(_0x162f19,null));};exports[_0x86f1('0x8a')]=function(_0x5256cc,_0x2092ab,_0x3e5801){return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x5256cc[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x2092ab,null))[_0x86f1('0x2b')](function(_0x113e97){if(_0x113e97){return _0x113e97[_0x86f1('0x8a')](_0x5256cc['body'][_0x86f1('0x6a')],_[_0x86f1('0x8b')](_0x5256cc[_0x86f1('0x4e')],[_0x86f1('0x6a'),'id'])||{})[_0x86f1('0x8c')](function(_0x4061b3){for(var _0x2f85e2=0x0;_0x2f85e2<_0x5256cc['body'][_0x86f1('0x6a')]['length'];_0x2f85e2+=0x1){socket[_0x86f1('0x72')](_0x86f1('0x73'),{'UserId':_0x5256cc[_0x86f1('0x4e')][_0x86f1('0x6a')][_0x2f85e2],'FaxQueueId':_0x5256cc[_0x86f1('0x55')]['id']});}return _0x4061b3;});}})['then'](respondWithResult(_0x2092ab,null))[_0x86f1('0x49')](handleError(_0x2092ab,null));};exports['removeAgents']=function(_0x3c96df,_0x44ba73,_0x42602c){return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x3c96df['params']['id']}})['then'](handleEntityNotFound(_0x44ba73,null))[_0x86f1('0x2b')](function(_0x4fa14f){if(_0x4fa14f){return _0x4fa14f[_0x86f1('0x87')](_0x3c96df[_0x86f1('0x38')][_0x86f1('0x6a')])[_0x86f1('0x2b')](function(){if(_[_0x86f1('0x8d')](_0x3c96df['query'][_0x86f1('0x6a')])){for(var _0x2f2ac9=0x0;_0x2f2ac9<_0x3c96df[_0x86f1('0x38')][_0x86f1('0x6a')][_0x86f1('0x3d')];_0x2f2ac9+=0x1){socket['emit'](_0x86f1('0x89'),{'UserId':Number(_0x3c96df[_0x86f1('0x38')][_0x86f1('0x6a')][_0x2f2ac9]),'FaxQueueId':Number(_0x3c96df[_0x86f1('0x55')]['id'])});}}else{socket[_0x86f1('0x72')](_0x86f1('0x89'),{'UserId':Number(_0x3c96df['query']['ids']),'FaxQueueId':Number(_0x3c96df[_0x86f1('0x55')]['id'])});}});}})[_0x86f1('0x2b')](respondWithStatusCode(_0x44ba73,null))[_0x86f1('0x49')](handleError(_0x44ba73,null));};exports[_0x86f1('0x8e')]=function(_0x298b8e,_0x3bc0ae,_0x2feec0){var _0x27f7ad={};var _0x22d45d={};var _0x2b6784;var _0x20fbd0;return db[_0x86f1('0x34')][_0x86f1('0x57')]({'where':{'id':_0x298b8e['params']['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x3bc0ae,null))['then'](function(_0x17f85b){if(_0x17f85b){_0x2b6784=_0x17f85b;_0x22d45d[_0x86f1('0x36')]=_['keys'](db[_0x86f1('0x5c')]['rawAttributes']);_0x22d45d[_0x86f1('0x38')]=_[_0x86f1('0x37')](_0x298b8e[_0x86f1('0x38')]);_0x22d45d[_0x86f1('0x39')]=_['intersection'](_0x22d45d[_0x86f1('0x36')],_0x22d45d[_0x86f1('0x38')]);_0x27f7ad[_0x86f1('0x3a')]=_[_0x86f1('0x3b')](_0x22d45d['model'],qs[_0x86f1('0x3c')](_0x298b8e['query']['fields']));_0x27f7ad['attributes']=_0x27f7ad[_0x86f1('0x3a')][_0x86f1('0x3d')]?_0x27f7ad[_0x86f1('0x3a')]:_0x22d45d['model'];_0x27f7ad[_0x86f1('0x3f')]=qs[_0x86f1('0x40')](_0x298b8e[_0x86f1('0x38')][_0x86f1('0x40')]);_0x27f7ad[_0x86f1('0x41')]=qs[_0x86f1('0x39')](_[_0x86f1('0x67')](_0x298b8e[_0x86f1('0x38')],_0x22d45d['filters']));if(_0x298b8e[_0x86f1('0x38')][_0x86f1('0x42')]){_0x27f7ad[_0x86f1('0x41')]=_['merge'](_0x27f7ad[_0x86f1('0x41')],{'$or':_[_0x86f1('0x33')](_0x27f7ad[_0x86f1('0x3a')],function(_0x179e97){var _0x31335d={};_0x31335d[_0x179e97]={'$like':'%'+_0x298b8e[_0x86f1('0x38')][_0x86f1('0x42')]+'%'};return _0x31335d;})});}_0x27f7ad=_[_0x86f1('0x44')]({},_0x27f7ad,_0x298b8e['options']);return _0x2b6784['getAgents'](_0x27f7ad);}})[_0x86f1('0x2b')](function(_0x47a136){if(_0x47a136){_0x20fbd0=_0x47a136['length'];if(!_0x298b8e['query'][_0x86f1('0x68')](_0x86f1('0x59'))){_0x27f7ad['limit']=qs[_0x86f1('0x3e')](_0x298b8e['query'][_0x86f1('0x3e')]);_0x27f7ad[_0x86f1('0x23')]=qs[_0x86f1('0x23')](_0x298b8e['query']['offset']);}return _0x2b6784[_0x86f1('0x8e')](_0x27f7ad);}})[_0x86f1('0x2b')](function(_0x156542){if(_0x156542){return _0x156542?{'count':_0x20fbd0,'rows':_0x156542}:null;}})['then'](respondWithResult(_0x3bc0ae,null))['catch'](handleError(_0x3bc0ae,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 40cfff9..63749ae 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 _0x7de0=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x2f4c99,_0x733841){var _0xd1ef71=function(_0x24cf81){while(--_0x24cf81){_0x2f4c99['push'](_0x2f4c99['shift']());}};_0xd1ef71(++_0x733841);}(_0x7de0,0x187));var _0x07de=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7de0[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x07de('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x07de('0x1')](0x0);var events={'afterCreate':_0x07de('0x2'),'afterUpdate':_0x07de('0x3'),'afterDestroy':_0x07de('0x4')};function emitEvent(_0x3dda60){return function(_0x51e1a6,_0x193da6,_0x426c15){FaxQueueEvents['emit'](_0x3dda60+':'+_0x51e1a6['id'],_0x51e1a6);FaxQueueEvents[_0x07de('0x5')](_0x3dda60,_0x51e1a6);_0x426c15(null);};}for(var e in events){if(events[_0x07de('0x6')](e)){var event=events[e];FaxQueue[_0x07de('0x7')](e,emitEvent(event));}}module[_0x07de('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xe435=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x32e83a,_0x3f88d0){var _0x89facd=function(_0x231178){while(--_0x231178){_0x32e83a['push'](_0x32e83a['shift']());}};_0x89facd(++_0x3f88d0);}(_0xe435,0x1d9));var _0x5e43=function(_0x5d14bf,_0x5214bd){_0x5d14bf=_0x5d14bf-0x0;var _0x4a1810=_0xe435[_0x5d14bf];return _0x4a1810;};'use strict';var EventEmitter=require(_0x5e43('0x0'));var FaxQueue=require(_0x5e43('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e43('0x2'),'afterUpdate':_0x5e43('0x3'),'afterDestroy':_0x5e43('0x4')};function emitEvent(_0x3bc3fe){return function(_0x365cfb,_0x5db2da,_0xbceba5){FaxQueueEvents['emit'](_0x3bc3fe+':'+_0x365cfb['id'],_0x365cfb);FaxQueueEvents[_0x5e43('0x5')](_0x3bc3fe,_0x365cfb);_0xbceba5(null);};}for(var e in events){if(events[_0x5e43('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x5e43('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index a1e5e46..1075a82 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 _0x04fd=['define','fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0x1ae8a5,_0xb27194){var _0x4ed281=function(_0x1ecf69){while(--_0x1ecf69){_0x1ae8a5['push'](_0x1ae8a5['shift']());}};_0x4ed281(++_0xb27194);}(_0x04fd,0x14c));var _0xd04f=function(_0x5443b7,_0x504c2b){_0x5443b7=_0x5443b7-0x0;var _0x4c198f=_0x04fd[_0x5443b7];return _0x4c198f;};'use strict';var _=require(_0xd04f('0x0'));var util=require('util');var logger=require(_0xd04f('0x1'))(_0xd04f('0x2'));var moment=require(_0xd04f('0x3'));var BPromise=require(_0xd04f('0x4'));var rp=require(_0xd04f('0x5'));var fs=require('fs');var path=require(_0xd04f('0x6'));var rimraf=require(_0xd04f('0x7'));var config=require('../../config/environment');var attributes=require(_0xd04f('0x8'));module['exports']=function(_0x15864b,_0x2344a1){return _0x15864b[_0xd04f('0x9')]('FaxQueue',attributes,{'tableName':_0xd04f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76b0=['path','rimraf','../../config/environment','exports','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','request-promise'];(function(_0x507597,_0x412525){var _0x110a0f=function(_0x57935a){while(--_0x57935a){_0x507597['push'](_0x507597['shift']());}};_0x110a0f(++_0x412525);}(_0x76b0,0x8a));var _0x076b=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x76b0[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x076b('0x0'));var util=require('util');var logger=require(_0x076b('0x1'))(_0x076b('0x2'));var moment=require(_0x076b('0x3'));var BPromise=require('bluebird');var rp=require(_0x076b('0x4'));var fs=require('fs');var path=require(_0x076b('0x5'));var rimraf=require(_0x076b('0x6'));var config=require(_0x076b('0x7'));var attributes=require('./faxQueue.attributes');module[_0x076b('0x8')]=function(_0x44b796,_0x33ca02){return _0x44b796['define'](_0x076b('0x9'),attributes,{'tableName':_0x076b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 68b6e0b..e2de2a3 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 _0xba7f=['info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','map','model','include','then','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','request'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0xba7f,0xee));var _0xfba7=function(_0x2152e0,_0x99ca91){_0x2152e0=_0x2152e0-0x0;var _0x22127d=_0xba7f[_0x2152e0];return _0x22127d;};'use strict';var _=require(_0xfba7('0x0'));var util=require(_0xfba7('0x1'));var moment=require(_0xfba7('0x2'));var BPromise=require(_0xfba7('0x3'));var rs=require(_0xfba7('0x4'));var fs=require('fs');var Redis=require(_0xfba7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfba7('0x6'))(_0xfba7('0x7'));var config=require(_0xfba7('0x8'));var jayson=require(_0xfba7('0x9'));var client=jayson[_0xfba7('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xfba7('0xb')],{'host':_0xfba7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x244aa4,_0x551939,_0x2c79c6){return new BPromise(function(_0x3d73bf,_0x21809b){return client[_0xfba7('0xd')](_0x244aa4,_0x2c79c6)['then'](function(_0x2dcb9d){logger[_0xfba7('0xe')](_0xfba7('0xf'),_0x551939,_0xfba7('0x10'));logger[_0xfba7('0x11')](_0xfba7('0x12'),_0x551939,_0xfba7('0x10'),JSON[_0xfba7('0x13')](_0x2dcb9d));if(_0x2dcb9d['error']){if(_0x2dcb9d[_0xfba7('0x14')][_0xfba7('0x15')]===0x1f4){logger['error'](_0xfba7('0xf'),_0x551939,_0x2dcb9d['error']['message']);return _0x21809b(_0x2dcb9d['error'][_0xfba7('0x16')]);}logger[_0xfba7('0x14')]('FaxQueue,\x20%s,\x20%s',_0x551939,_0x2dcb9d[_0xfba7('0x14')]['message']);return _0x3d73bf(_0x2dcb9d[_0xfba7('0x14')][_0xfba7('0x16')]);}else{logger[_0xfba7('0xe')](_0xfba7('0xf'),_0x551939,_0xfba7('0x10'));_0x3d73bf(_0x2dcb9d['result']['message']);}})[_0xfba7('0x17')](function(_0x49e9d4){logger[_0xfba7('0x14')](_0xfba7('0xf'),_0x551939,_0x49e9d4);_0x21809b(_0x49e9d4);});});}exports[_0xfba7('0x18')]=function(_0x5237d5){var _0x12c31c=this;return new Promise(function(_0x2ecc1b,_0x5a391c){return db[_0xfba7('0x19')]['findAll']({'raw':_0x5237d5['options']?_0x5237d5[_0xfba7('0x1a')][_0xfba7('0x1b')]===undefined?!![]:![]:!![],'where':_0x5237d5[_0xfba7('0x1a')]?_0x5237d5['options'][_0xfba7('0x1c')]||null:null,'attributes':_0x5237d5[_0xfba7('0x1a')]?_0x5237d5[_0xfba7('0x1a')][_0xfba7('0x1d')]||null:null,'limit':_0x5237d5[_0xfba7('0x1a')]?_0x5237d5[_0xfba7('0x1a')][_0xfba7('0x1e')]||null:null,'include':_0x5237d5[_0xfba7('0x1a')]?_0x5237d5['options']['include']?_[_0xfba7('0x1f')](_0x5237d5[_0xfba7('0x1a')]['include'],function(_0x400fa2){return{'model':db[_0x400fa2['model']],'as':_0x400fa2['as'],'attributes':_0x400fa2['attributes'],'include':_0x400fa2['include']?_['map'](_0x400fa2['include'],function(_0x4a0351){return{'model':db[_0x4a0351[_0xfba7('0x20')]],'as':_0x4a0351['as'],'attributes':_0x4a0351['attributes'],'include':_0x4a0351[_0xfba7('0x21')]?_[_0xfba7('0x1f')](_0x4a0351[_0xfba7('0x21')],function(_0x53f903){return{'model':db[_0x53f903[_0xfba7('0x20')]],'as':_0x53f903['as'],'attributes':_0x53f903[_0xfba7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfba7('0x22')](function(_0x12d7cb){logger[_0xfba7('0xe')]('GetFaxQueue',_0x5237d5);logger[_0xfba7('0x11')](_0xfba7('0x18'),_0x5237d5,JSON[_0xfba7('0x13')](_0x12d7cb));_0x2ecc1b(_0x12d7cb);})[_0xfba7('0x17')](function(_0x20e524){logger[_0xfba7('0x14')](_0xfba7('0x18'),_0x20e524[_0xfba7('0x16')],_0x5237d5);_0x5a391c(_0x12c31c[_0xfba7('0x14')](0x1f4,_0x20e524[_0xfba7('0x16')]));});});};exports[_0xfba7('0x23')]=function(_0x2fb3b7){var _0x58a016=this;return new Promise(function(_0x4643ec,_0x2e65d2){return db['FaxQueue']['find']({'raw':_0x2fb3b7[_0xfba7('0x1a')]?_0x2fb3b7[_0xfba7('0x1a')][_0xfba7('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fb3b7[_0xfba7('0x1a')]?_0x2fb3b7[_0xfba7('0x1a')][_0xfba7('0x1c')]||null:null,'attributes':_0x2fb3b7[_0xfba7('0x1a')]?_0x2fb3b7[_0xfba7('0x1a')][_0xfba7('0x1d')]||null:null,'include':_0x2fb3b7[_0xfba7('0x1a')]?_0x2fb3b7['options'][_0xfba7('0x21')]?_['map'](_0x2fb3b7[_0xfba7('0x1a')][_0xfba7('0x21')],function(_0x543a76){return{'model':db[_0x543a76[_0xfba7('0x20')]],'as':_0x543a76['as'],'attributes':_0x543a76[_0xfba7('0x1d')],'include':_0x543a76[_0xfba7('0x21')]?_[_0xfba7('0x1f')](_0x543a76[_0xfba7('0x21')],function(_0x32e8ad){return{'model':db[_0x32e8ad[_0xfba7('0x20')]],'as':_0x32e8ad['as'],'attributes':_0x32e8ad[_0xfba7('0x1d')],'include':_0x32e8ad[_0xfba7('0x21')]?_['map'](_0x32e8ad[_0xfba7('0x21')],function(_0x58534c){return{'model':db[_0x58534c['model']],'as':_0x58534c['as'],'attributes':_0x58534c[_0xfba7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfba7('0x22')](function(_0xabab5d){logger[_0xfba7('0xe')](_0xfba7('0x23'),_0x2fb3b7);logger[_0xfba7('0x11')](_0xfba7('0x23'),_0x2fb3b7,JSON['stringify'](_0xabab5d));_0x4643ec(_0xabab5d);})['catch'](function(_0x41b41d){logger['error'](_0xfba7('0x23'),_0x41b41d[_0xfba7('0x16')],_0x2fb3b7);_0x2e65d2(_0x58a016[_0xfba7('0x14')](0x1f4,_0x41b41d[_0xfba7('0x16')]));});});}; \ No newline at end of file +var _0xaeff=['map','model','GetFaxQueue','catch','find','ShowFaxQueue','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','FaxQueue','options','raw','where','attributes','limit','include'];(function(_0x3dec8f,_0x6622c4){var _0x2f67cb=function(_0x436717){while(--_0x436717){_0x3dec8f['push'](_0x3dec8f['shift']());}};_0x2f67cb(++_0x6622c4);}(_0xaeff,0x18d));var _0xfaef=function(_0x3174db,_0x49da42){_0x3174db=_0x3174db-0x0;var _0x4a897=_0xaeff[_0x3174db];return _0x4a897;};'use strict';var _=require('lodash');var util=require(_0xfaef('0x0'));var moment=require(_0xfaef('0x1'));var BPromise=require(_0xfaef('0x2'));var rs=require(_0xfaef('0x3'));var fs=require('fs');var Redis=require(_0xfaef('0x4'));var db=require(_0xfaef('0x5'))['db'];var utils=require(_0xfaef('0x6'));var logger=require(_0xfaef('0x7'))('rpc');var config=require(_0xfaef('0x8'));var jayson=require(_0xfaef('0x9'));var client=jayson[_0xfaef('0xa')]['http']({'port':0x232a});config[_0xfaef('0xb')]=_[_0xfaef('0xc')](config['redis'],{'host':_0xfaef('0xd'),'port':0x18eb});var socket=require(_0xfaef('0xe'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xfaef('0xf')](socket);function respondWithRpcPromise(_0x1644fc,_0xd91162,_0x5ace64){return new BPromise(function(_0x5f321e,_0x4fef77){return client['request'](_0x1644fc,_0x5ace64)[_0xfaef('0x10')](function(_0x3f121f){logger[_0xfaef('0x11')](_0xfaef('0x12'),_0xd91162,'request\x20sent');logger[_0xfaef('0x13')](_0xfaef('0x14'),_0xd91162,_0xfaef('0x15'),JSON['stringify'](_0x3f121f));if(_0x3f121f[_0xfaef('0x16')]){if(_0x3f121f[_0xfaef('0x16')]['code']===0x1f4){logger[_0xfaef('0x16')](_0xfaef('0x12'),_0xd91162,_0x3f121f['error'][_0xfaef('0x17')]);return _0x4fef77(_0x3f121f[_0xfaef('0x16')]['message']);}logger[_0xfaef('0x16')](_0xfaef('0x12'),_0xd91162,_0x3f121f[_0xfaef('0x16')][_0xfaef('0x17')]);return _0x5f321e(_0x3f121f['error'][_0xfaef('0x17')]);}else{logger[_0xfaef('0x11')](_0xfaef('0x12'),_0xd91162,_0xfaef('0x15'));_0x5f321e(_0x3f121f[_0xfaef('0x18')][_0xfaef('0x17')]);}})['catch'](function(_0x47a0bf){logger['error']('FaxQueue,\x20%s,\x20%s',_0xd91162,_0x47a0bf);_0x4fef77(_0x47a0bf);});});}exports['GetFaxQueue']=function(_0x52b976){var _0x547327=this;return new Promise(function(_0x347836,_0x4b4aea){return db[_0xfaef('0x19')]['findAll']({'raw':_0x52b976['options']?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1b')]===undefined?!![]:![]:!![],'where':_0x52b976[_0xfaef('0x1a')]?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1c')]||null:null,'attributes':_0x52b976[_0xfaef('0x1a')]?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1d')]||null:null,'limit':_0x52b976['options']?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1e')]||null:null,'include':_0x52b976[_0xfaef('0x1a')]?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1f')]?_[_0xfaef('0x20')](_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1f')],function(_0x129226){return{'model':db[_0x129226[_0xfaef('0x21')]],'as':_0x129226['as'],'attributes':_0x129226[_0xfaef('0x1d')],'include':_0x129226[_0xfaef('0x1f')]?_[_0xfaef('0x20')](_0x129226['include'],function(_0xb5106b){return{'model':db[_0xb5106b[_0xfaef('0x21')]],'as':_0xb5106b['as'],'attributes':_0xb5106b['attributes'],'include':_0xb5106b[_0xfaef('0x1f')]?_[_0xfaef('0x20')](_0xb5106b[_0xfaef('0x1f')],function(_0x2232d8){return{'model':db[_0x2232d8[_0xfaef('0x21')]],'as':_0x2232d8['as'],'attributes':_0x2232d8['attributes']};}):[]};}):[]};}):[]:[]})[_0xfaef('0x10')](function(_0x47795c){logger['info'](_0xfaef('0x22'),_0x52b976);logger[_0xfaef('0x13')](_0xfaef('0x22'),_0x52b976,JSON['stringify'](_0x47795c));_0x347836(_0x47795c);})[_0xfaef('0x23')](function(_0x266d4d){logger['error']('GetFaxQueue',_0x266d4d[_0xfaef('0x17')],_0x52b976);_0x4b4aea(_0x547327[_0xfaef('0x16')](0x1f4,_0x266d4d[_0xfaef('0x17')]));});});};exports['ShowFaxQueue']=function(_0x3d3c57){var _0x48e2c1=this;return new Promise(function(_0x42d72b,_0x12a05c){return db[_0xfaef('0x19')][_0xfaef('0x24')]({'raw':_0x3d3c57[_0xfaef('0x1a')]?_0x3d3c57['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d3c57[_0xfaef('0x1a')]?_0x3d3c57['options']['where']||null:null,'attributes':_0x3d3c57[_0xfaef('0x1a')]?_0x3d3c57[_0xfaef('0x1a')][_0xfaef('0x1d')]||null:null,'include':_0x3d3c57[_0xfaef('0x1a')]?_0x3d3c57[_0xfaef('0x1a')][_0xfaef('0x1f')]?_[_0xfaef('0x20')](_0x3d3c57['options']['include'],function(_0x33057b){return{'model':db[_0x33057b[_0xfaef('0x21')]],'as':_0x33057b['as'],'attributes':_0x33057b[_0xfaef('0x1d')],'include':_0x33057b[_0xfaef('0x1f')]?_['map'](_0x33057b[_0xfaef('0x1f')],function(_0x53be23){return{'model':db[_0x53be23[_0xfaef('0x21')]],'as':_0x53be23['as'],'attributes':_0x53be23[_0xfaef('0x1d')],'include':_0x53be23['include']?_['map'](_0x53be23[_0xfaef('0x1f')],function(_0x761f48){return{'model':db[_0x761f48[_0xfaef('0x21')]],'as':_0x761f48['as'],'attributes':_0x761f48['attributes']};}):[]};}):[]};}):[]:[]})[_0xfaef('0x10')](function(_0x311182){logger['info'](_0xfaef('0x25'),_0x3d3c57);logger['debug'](_0xfaef('0x25'),_0x3d3c57,JSON[_0xfaef('0x26')](_0x311182));_0x42d72b(_0x311182);})[_0xfaef('0x23')](function(_0xe39b15){logger[_0xfaef('0x16')](_0xfaef('0x25'),_0xe39b15[_0xfaef('0x17')],_0x3d3c57);_0x12a05c(_0x48e2c1[_0xfaef('0x16')](0x1f4,_0xe39b15['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 945b243..fb4def4 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 _0x893a=['update','register','length','./faxQueue.events','save'];(function(_0x54105,_0x12af79){var _0x56ea83=function(_0x37f1e6){while(--_0x37f1e6){_0x54105['push'](_0x54105['shift']());}};_0x56ea83(++_0x12af79);}(_0x893a,0x7b));var _0xa893=function(_0x14ddc4,_0x3847a3){_0x14ddc4=_0x14ddc4-0x0;var _0x28e482=_0x893a[_0x14ddc4];return _0x28e482;};'use strict';var FaxQueueEvents=require(_0xa893('0x0'));var events=[_0xa893('0x1'),'remove',_0xa893('0x2')];function createListener(_0x4fbcd3,_0x479477){return function(_0x214f16){_0x479477['emit'](_0x4fbcd3,_0x214f16);};}function removeListener(_0xd75a00,_0x2f6324){return function(){FaxQueueEvents['removeListener'](_0xd75a00,_0x2f6324);};}exports[_0xa893('0x3')]=function(_0x38b214){for(var _0xc9c8b=0x0,_0x591982=events[_0xa893('0x4')];_0xc9c8b<_0x591982;_0xc9c8b++){var _0x40829c=events[_0xc9c8b];var _0x548831=createListener('faxQueue:'+_0x40829c,_0x38b214);FaxQueueEvents['on'](_0x40829c,_0x548831);}}; \ No newline at end of file +var _0xc2e2=['emit','removeListener','register','length','./faxQueue.events','update'];(function(_0x3622db,_0x54fd21){var _0x5f34a3=function(_0x2fb452){while(--_0x2fb452){_0x3622db['push'](_0x3622db['shift']());}};_0x5f34a3(++_0x54fd21);}(_0xc2e2,0xb2));var _0x2c2e=function(_0x1a14fa,_0x544583){_0x1a14fa=_0x1a14fa-0x0;var _0x46d83f=_0xc2e2[_0x1a14fa];return _0x46d83f;};'use strict';var FaxQueueEvents=require(_0x2c2e('0x0'));var events=['save','remove',_0x2c2e('0x1')];function createListener(_0x14efdb,_0x5a8976){return function(_0x25815e){_0x5a8976[_0x2c2e('0x2')](_0x14efdb,_0x25815e);};}function removeListener(_0x4072cc,_0x34d0d0){return function(){FaxQueueEvents[_0x2c2e('0x3')](_0x4072cc,_0x34d0d0);};}exports[_0x2c2e('0x4')]=function(_0xbe077b){for(var _0x5994bb=0x0,_0x19d299=events[_0x2c2e('0x5')];_0x5994bb<_0x19d299;_0x5994bb++){var _0x45ab15=events[_0x5994bb];var _0x5a4e6a=createListener('faxQueue:'+_0x45ab15,_0xbe077b);FaxQueueEvents['on'](_0x45ab15,_0x5a4e6a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 5c8c493..4e0cfcf 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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x2b89dc,_0x8bfa42){var _0x412762=function(_0x42dc39){while(--_0x42dc39){_0x2b89dc['push'](_0x2b89dc['shift']());}};_0x412762(++_0x8bfa42);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e2272,_0x2e1ae0){_0x4e2272=_0x4e2272-0x0;var _0x45511c=_0x0b0e[_0x4e2272];return _0x45511c;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 64cac34..0ae52e6 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 _0x2391=['DATE','moment','sequelize','STRING'];(function(_0x59f756,_0x5f4d70){var _0x1d4d3b=function(_0x2c903a){while(--_0x2c903a){_0x59f756['push'](_0x59f756['shift']());}};_0x1d4d3b(++_0x5f4d70);}(_0x2391,0xb5));var _0x1239=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x2391[_0x491a7f];return _0x3d8f44;};'use strict';var moment=require(_0x1239('0x0'));var Sequelize=require(_0x1239('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1239('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1239('0x2')]},'joinAt':{'type':Sequelize[_0x1239('0x3')]},'leaveAt':{'type':Sequelize[_0x1239('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1239('0x3')]},'reason':{'type':Sequelize[_0x1239('0x2')]}}; \ No newline at end of file +var _0x0145=['STRING','DATE','moment','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0145,0x1e2));var _0x5014=function(_0xd9fd65,_0x52f51f){_0xd9fd65=_0xd9fd65-0x0;var _0x12c2c3=_0x0145[_0xd9fd65];return _0x12c2c3;};'use strict';var moment=require(_0x5014('0x0'));var Sequelize=require(_0x5014('0x1'));module[_0x5014('0x2')]={'uniqueid':{'type':Sequelize[_0x5014('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5014('0x4')]},'exitAt':{'type':Sequelize[_0x5014('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 74ea658..c43258e 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 _0x62d1=['includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','map','FaxQueueReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x5e146f,_0x5c04f9){var _0x44ce4d=function(_0xb4744f){while(--_0xb4744f){_0x5e146f['push'](_0x5e146f['shift']());}};_0x44ce4d(++_0x5c04f9);}(_0x62d1,0x18e));var _0x162d=function(_0x2f2d88,_0x32815c){_0x2f2d88=_0x2f2d88-0x0;var _0x4742ee=_0x62d1[_0x2f2d88];return _0x4742ee;};'use strict';var pdf=require(_0x162d('0x0'));var emlformat=require(_0x162d('0x1'));var rimraf=require(_0x162d('0x2'));var zipdir=require(_0x162d('0x3'));var jsonpatch=require(_0x162d('0x4'));var rp=require(_0x162d('0x5'));var moment=require(_0x162d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x162d('0x7'));var util=require(_0x162d('0x8'));var path=require(_0x162d('0x9'));var sox=require(_0x162d('0xa'));var csv=require(_0x162d('0xb'));var ejs=require(_0x162d('0xc'));var fs=require('fs');var _=require(_0x162d('0xd'));var squel=require(_0x162d('0xe'));var crypto=require('crypto');var jsforce=require(_0x162d('0xf'));var deskjs=require(_0x162d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x162d('0x11'));var Papa=require(_0x162d('0x12'));var Redis=require(_0x162d('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x162d('0x14'));var logger=require(_0x162d('0x15'))(_0x162d('0x16'));var utils=require(_0x162d('0x17'));var config=require('../../config/environment');var db=require(_0x162d('0x18'))['db'];function respondWithStatusCode(_0x3709fe,_0x23a3d8){_0x23a3d8=_0x23a3d8||0xcc;return function(_0x2e4d77){if(_0x2e4d77){return _0x3709fe[_0x162d('0x19')](_0x23a3d8);}return _0x3709fe[_0x162d('0x1a')](_0x23a3d8)['end']();};}function respondWithResult(_0x3e39c3,_0x3a19fd){_0x3a19fd=_0x3a19fd||0xc8;return function(_0x10a01e){if(_0x10a01e){return _0x3e39c3['status'](_0x3a19fd)[_0x162d('0x1b')](_0x10a01e);}};}function respondWithFilteredResult(_0x371be7,_0x45a2f4){return function(_0xf0a5d5){if(_0xf0a5d5){var _0x4b3b42=_0xf0a5d5[_0x162d('0x1c')],_0x42c685=_0x45a2f4[_0x162d('0x1d')],_0x36a53e=_0x45a2f4[_0x162d('0x1d')]+_0x45a2f4[_0x162d('0x1e')],_0x3d1264;if(_0x36a53e>=_0x4b3b42){_0x36a53e=_0x4b3b42;_0x3d1264=0xc8;}else{_0x3d1264=0xce;}_0x371be7['status'](_0x3d1264);return _0x371be7[_0x162d('0x1f')](_0x162d('0x20'),_0x42c685+'-'+_0x36a53e+'/'+_0x4b3b42)[_0x162d('0x1b')](_0xf0a5d5);}return null;};}function patchUpdates(_0x829428){return function(_0x34a02b){try{jsonpatch[_0x162d('0x21')](_0x34a02b,_0x829428,!![]);}catch(_0x138481){return BPromise[_0x162d('0x22')](_0x138481);}return _0x34a02b[_0x162d('0x23')]();};}function saveUpdates(_0x9b84ba,_0x1b3eb9){return function(_0x4e28f2){if(_0x4e28f2){return _0x4e28f2['update'](_0x9b84ba)[_0x162d('0x24')](function(_0x4300c2){return _0x4300c2;});}return null;};}function removeEntity(_0x45e17e,_0x355592){return function(_0xa4406e){if(_0xa4406e){return _0xa4406e['destroy']()[_0x162d('0x24')](function(){_0x45e17e['status'](0xcc)[_0x162d('0x25')]();});}};}function handleEntityNotFound(_0x168092,_0x2f9f90){return function(_0x543b2c){if(!_0x543b2c){_0x168092[_0x162d('0x19')](0x194);}return _0x543b2c;};}function handleError(_0x1559a2,_0x2407bb){_0x2407bb=_0x2407bb||0x1f4;return function(_0x22527d){logger[_0x162d('0x26')](_0x22527d[_0x162d('0x27')]);if(_0x22527d[_0x162d('0x28')]){delete _0x22527d[_0x162d('0x28')];}_0x1559a2[_0x162d('0x1a')](_0x2407bb)[_0x162d('0x29')](_0x22527d);};}exports['index']=function(_0x45b9d6,_0x15fbc1){var _0x1769d3={},_0x5e649a={},_0x26699c={'count':0x0,'rows':[]};var _0x66f3bc=_[_0x162d('0x2a')](db[_0x162d('0x2b')]['rawAttributes'],function(_0x27aab4){return{'name':_0x27aab4[_0x162d('0x2c')],'type':_0x27aab4['type'][_0x162d('0x2d')]};});_0x5e649a[_0x162d('0x2e')]=_[_0x162d('0x2a')](_0x66f3bc,'name');_0x5e649a[_0x162d('0x2f')]=_[_0x162d('0x30')](_0x45b9d6['query']);_0x5e649a[_0x162d('0x31')]=_['intersection'](_0x5e649a['model'],_0x5e649a[_0x162d('0x2f')]);_0x1769d3[_0x162d('0x32')]=_[_0x162d('0x33')](_0x5e649a[_0x162d('0x2e')],qs[_0x162d('0x34')](_0x45b9d6[_0x162d('0x2f')]['fields']));_0x1769d3[_0x162d('0x32')]=_0x1769d3['attributes'][_0x162d('0x35')]?_0x1769d3['attributes']:_0x5e649a['model'];if(!_0x45b9d6['query'][_0x162d('0x36')](_0x162d('0x37'))){_0x1769d3['limit']=qs['limit'](_0x45b9d6[_0x162d('0x2f')]['limit']);_0x1769d3[_0x162d('0x1d')]=qs['offset'](_0x45b9d6[_0x162d('0x2f')][_0x162d('0x1d')]);}_0x1769d3[_0x162d('0x38')]=qs['sort'](_0x45b9d6[_0x162d('0x2f')]['sort']);_0x1769d3[_0x162d('0x39')]=qs[_0x162d('0x31')](_[_0x162d('0x3a')](_0x45b9d6[_0x162d('0x2f')],_0x5e649a[_0x162d('0x31')]),_0x66f3bc);if(_0x45b9d6[_0x162d('0x2f')][_0x162d('0x3b')]){_0x1769d3[_0x162d('0x39')]=_[_0x162d('0x3c')](_0x1769d3[_0x162d('0x39')],{'$or':_[_0x162d('0x2a')](_0x66f3bc,function(_0x4cd8b7){if(_0x4cd8b7[_0x162d('0x3d')]!==_0x162d('0x3e')){var _0x5a69b0={};_0x5a69b0[_0x4cd8b7['name']]={'$like':'%'+_0x45b9d6[_0x162d('0x2f')][_0x162d('0x3b')]+'%'};return _0x5a69b0;}})});}_0x1769d3=_[_0x162d('0x3c')]({},_0x1769d3,_0x45b9d6[_0x162d('0x3f')]);var _0x3ce237={'where':_0x1769d3[_0x162d('0x39')]};return db[_0x162d('0x2b')][_0x162d('0x1c')](_0x3ce237)['then'](function(_0x5938e4){_0x26699c['count']=_0x5938e4;if(_0x45b9d6[_0x162d('0x2f')][_0x162d('0x40')]){_0x1769d3[_0x162d('0x41')]=[{'all':!![]}];}return db[_0x162d('0x2b')][_0x162d('0x42')](_0x1769d3);})['then'](function(_0x517301){_0x26699c[_0x162d('0x43')]=_0x517301;return _0x26699c;})[_0x162d('0x24')](respondWithFilteredResult(_0x15fbc1,_0x1769d3))[_0x162d('0x44')](handleError(_0x15fbc1,null));};exports[_0x162d('0x45')]=function(_0x272088,_0x388ebf){var _0x1a99a8={'raw':!![],'where':{'id':_0x272088['params']['id']}},_0x50b5a8={};_0x50b5a8[_0x162d('0x2e')]=_[_0x162d('0x30')](db['FaxQueueReport'][_0x162d('0x46')]);_0x50b5a8[_0x162d('0x2f')]=_['keys'](_0x272088[_0x162d('0x2f')]);_0x50b5a8[_0x162d('0x31')]=_['intersection'](_0x50b5a8[_0x162d('0x2e')],_0x50b5a8['query']);_0x1a99a8[_0x162d('0x32')]=_[_0x162d('0x33')](_0x50b5a8[_0x162d('0x2e')],qs['fields'](_0x272088[_0x162d('0x2f')][_0x162d('0x34')]));_0x1a99a8[_0x162d('0x32')]=_0x1a99a8[_0x162d('0x32')][_0x162d('0x35')]?_0x1a99a8[_0x162d('0x32')]:_0x50b5a8['model'];if(_0x272088[_0x162d('0x2f')][_0x162d('0x40')]){_0x1a99a8[_0x162d('0x41')]=[{'all':!![]}];}_0x1a99a8=_[_0x162d('0x3c')]({},_0x1a99a8,_0x272088[_0x162d('0x3f')]);return db[_0x162d('0x2b')][_0x162d('0x47')](_0x1a99a8)[_0x162d('0x24')](handleEntityNotFound(_0x388ebf,null))['then'](respondWithResult(_0x388ebf,null))[_0x162d('0x44')](handleError(_0x388ebf,null));};exports[_0x162d('0x48')]=function(_0x2d6caf,_0x30ef30){return db[_0x162d('0x2b')]['create'](_0x2d6caf[_0x162d('0x49')],{})['then'](respondWithResult(_0x30ef30,0xc9))[_0x162d('0x44')](handleError(_0x30ef30,null));};exports[_0x162d('0x4a')]=function(_0x1cb9b4,_0x3a808c){if(_0x1cb9b4[_0x162d('0x49')]['id']){delete _0x1cb9b4[_0x162d('0x49')]['id'];}return db['FaxQueueReport'][_0x162d('0x47')]({'where':{'id':_0x1cb9b4[_0x162d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a808c,null))[_0x162d('0x24')](saveUpdates(_0x1cb9b4[_0x162d('0x49')],null))[_0x162d('0x24')](respondWithResult(_0x3a808c,null))[_0x162d('0x44')](handleError(_0x3a808c,null));};exports['destroy']=function(_0x438cd9,_0x569739){return db['FaxQueueReport']['find']({'where':{'id':_0x438cd9['params']['id']}})[_0x162d('0x24')](handleEntityNotFound(_0x569739,null))[_0x162d('0x24')](removeEntity(_0x569739,null))[_0x162d('0x44')](handleError(_0x569739,null));};exports[_0x162d('0x4c')]=function(_0x30ea0c,_0x4b3fd4){return db[_0x162d('0x2b')][_0x162d('0x4c')]()[_0x162d('0x24')](respondWithResult(_0x4b3fd4,null))[_0x162d('0x44')](handleError(_0x4b3fd4,null));}; \ No newline at end of file +var _0x3f24=['rows','show','params','keys','create','body','catch','find','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include'];(function(_0xeda28,_0x42da7a){var _0x697e43=function(_0x32368d){while(--_0x32368d){_0xeda28['push'](_0xeda28['shift']());}};_0x697e43(++_0x42da7a);}(_0x3f24,0x163));var _0x43f2=function(_0xcc3c31,_0x3c509b){_0xcc3c31=_0xcc3c31-0x0;var _0x55d249=_0x3f24[_0xcc3c31];return _0x55d249;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x43f2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43f2('0x1'));var rp=require(_0x43f2('0x2'));var moment=require('moment');var BPromise=require(_0x43f2('0x3'));var Mustache=require(_0x43f2('0x4'));var util=require(_0x43f2('0x5'));var path=require(_0x43f2('0x6'));var sox=require(_0x43f2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x43f2('0x8'));var jsforce=require(_0x43f2('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x43f2('0xa'));var Papa=require(_0x43f2('0xb'));var Redis=require(_0x43f2('0xc'));var authService=require(_0x43f2('0xd'));var qs=require(_0x43f2('0xe'));var as=require(_0x43f2('0xf'));var hardwareService=require(_0x43f2('0x10'));var logger=require(_0x43f2('0x11'))(_0x43f2('0x12'));var utils=require(_0x43f2('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13a79b,_0x208edb){_0x208edb=_0x208edb||0xcc;return function(_0x1e0d32){if(_0x1e0d32){return _0x13a79b[_0x43f2('0x14')](_0x208edb);}return _0x13a79b['status'](_0x208edb)[_0x43f2('0x15')]();};}function respondWithResult(_0x5d58c6,_0x183688){_0x183688=_0x183688||0xc8;return function(_0x20d36e){if(_0x20d36e){return _0x5d58c6[_0x43f2('0x16')](_0x183688)[_0x43f2('0x17')](_0x20d36e);}};}function respondWithFilteredResult(_0x1c1903,_0x29f93c){return function(_0x4e5763){if(_0x4e5763){var _0x47442b=_0x4e5763[_0x43f2('0x18')],_0x3369d2=_0x29f93c[_0x43f2('0x19')],_0x3a2f03=_0x29f93c[_0x43f2('0x19')]+_0x29f93c[_0x43f2('0x1a')],_0x2a4d57;if(_0x3a2f03>=_0x47442b){_0x3a2f03=_0x47442b;_0x2a4d57=0xc8;}else{_0x2a4d57=0xce;}_0x1c1903[_0x43f2('0x16')](_0x2a4d57);return _0x1c1903[_0x43f2('0x1b')](_0x43f2('0x1c'),_0x3369d2+'-'+_0x3a2f03+'/'+_0x47442b)[_0x43f2('0x17')](_0x4e5763);}return null;};}function patchUpdates(_0x40238e){return function(_0x47c834){try{jsonpatch[_0x43f2('0x1d')](_0x47c834,_0x40238e,!![]);}catch(_0x219e40){return BPromise['reject'](_0x219e40);}return _0x47c834[_0x43f2('0x1e')]();};}function saveUpdates(_0x1ac978,_0x32e4cf){return function(_0x4e0d31){if(_0x4e0d31){return _0x4e0d31[_0x43f2('0x1f')](_0x1ac978)[_0x43f2('0x20')](function(_0x30a391){return _0x30a391;});}return null;};}function removeEntity(_0x4586bf,_0x1ad763){return function(_0x201750){if(_0x201750){return _0x201750['destroy']()[_0x43f2('0x20')](function(){_0x4586bf[_0x43f2('0x16')](0xcc)[_0x43f2('0x15')]();});}};}function handleEntityNotFound(_0x20f953,_0x2d534e){return function(_0x2d2145){if(!_0x2d2145){_0x20f953[_0x43f2('0x14')](0x194);}return _0x2d2145;};}function handleError(_0x2f7ee3,_0x23c5b8){_0x23c5b8=_0x23c5b8||0x1f4;return function(_0x49b87d){logger[_0x43f2('0x21')](_0x49b87d[_0x43f2('0x22')]);if(_0x49b87d[_0x43f2('0x23')]){delete _0x49b87d[_0x43f2('0x23')];}_0x2f7ee3[_0x43f2('0x16')](_0x23c5b8)[_0x43f2('0x24')](_0x49b87d);};}exports[_0x43f2('0x25')]=function(_0x4e428d,_0x1b8e61){var _0x10d1de={},_0x4cdbe5={},_0x39c6af={'count':0x0,'rows':[]};var _0x4cbaca=_[_0x43f2('0x26')](db[_0x43f2('0x27')][_0x43f2('0x28')],function(_0x2e9b73){return{'name':_0x2e9b73[_0x43f2('0x29')],'type':_0x2e9b73['type'][_0x43f2('0x2a')]};});_0x4cdbe5[_0x43f2('0x2b')]=_[_0x43f2('0x26')](_0x4cbaca,_0x43f2('0x23'));_0x4cdbe5[_0x43f2('0x2c')]=_['keys'](_0x4e428d['query']);_0x4cdbe5[_0x43f2('0x2d')]=_[_0x43f2('0x2e')](_0x4cdbe5[_0x43f2('0x2b')],_0x4cdbe5[_0x43f2('0x2c')]);_0x10d1de[_0x43f2('0x2f')]=_[_0x43f2('0x2e')](_0x4cdbe5[_0x43f2('0x2b')],qs[_0x43f2('0x30')](_0x4e428d[_0x43f2('0x2c')][_0x43f2('0x30')]));_0x10d1de[_0x43f2('0x2f')]=_0x10d1de[_0x43f2('0x2f')][_0x43f2('0x31')]?_0x10d1de[_0x43f2('0x2f')]:_0x4cdbe5['model'];if(!_0x4e428d[_0x43f2('0x2c')]['hasOwnProperty']('nolimit')){_0x10d1de[_0x43f2('0x1a')]=qs[_0x43f2('0x1a')](_0x4e428d[_0x43f2('0x2c')][_0x43f2('0x1a')]);_0x10d1de[_0x43f2('0x19')]=qs[_0x43f2('0x19')](_0x4e428d[_0x43f2('0x2c')]['offset']);}_0x10d1de[_0x43f2('0x32')]=qs[_0x43f2('0x33')](_0x4e428d[_0x43f2('0x2c')]['sort']);_0x10d1de['where']=qs['filters'](_[_0x43f2('0x34')](_0x4e428d[_0x43f2('0x2c')],_0x4cdbe5['filters']),_0x4cbaca);if(_0x4e428d[_0x43f2('0x2c')]['filter']){_0x10d1de[_0x43f2('0x35')]=_[_0x43f2('0x36')](_0x10d1de[_0x43f2('0x35')],{'$or':_[_0x43f2('0x26')](_0x4cbaca,function(_0x92c763){if(_0x92c763['type']!==_0x43f2('0x37')){var _0x4c4602={};_0x4c4602[_0x92c763[_0x43f2('0x23')]]={'$like':'%'+_0x4e428d[_0x43f2('0x2c')][_0x43f2('0x38')]+'%'};return _0x4c4602;}})});}_0x10d1de=_[_0x43f2('0x36')]({},_0x10d1de,_0x4e428d['options']);var _0x2e3805={'where':_0x10d1de[_0x43f2('0x35')]};return db[_0x43f2('0x27')][_0x43f2('0x18')](_0x2e3805)[_0x43f2('0x20')](function(_0x5a04a3){_0x39c6af[_0x43f2('0x18')]=_0x5a04a3;if(_0x4e428d['query'][_0x43f2('0x39')]){_0x10d1de[_0x43f2('0x3a')]=[{'all':!![]}];}return db[_0x43f2('0x27')]['findAll'](_0x10d1de);})['then'](function(_0x36ce23){_0x39c6af[_0x43f2('0x3b')]=_0x36ce23;return _0x39c6af;})[_0x43f2('0x20')](respondWithFilteredResult(_0x1b8e61,_0x10d1de))['catch'](handleError(_0x1b8e61,null));};exports[_0x43f2('0x3c')]=function(_0x48fe65,_0x4ebe1e){var _0x20f6d3={'raw':!![],'where':{'id':_0x48fe65[_0x43f2('0x3d')]['id']}},_0xb7a400={};_0xb7a400[_0x43f2('0x2b')]=_[_0x43f2('0x3e')](db['FaxQueueReport'][_0x43f2('0x28')]);_0xb7a400[_0x43f2('0x2c')]=_[_0x43f2('0x3e')](_0x48fe65[_0x43f2('0x2c')]);_0xb7a400[_0x43f2('0x2d')]=_[_0x43f2('0x2e')](_0xb7a400[_0x43f2('0x2b')],_0xb7a400[_0x43f2('0x2c')]);_0x20f6d3['attributes']=_[_0x43f2('0x2e')](_0xb7a400['model'],qs[_0x43f2('0x30')](_0x48fe65[_0x43f2('0x2c')][_0x43f2('0x30')]));_0x20f6d3['attributes']=_0x20f6d3[_0x43f2('0x2f')][_0x43f2('0x31')]?_0x20f6d3[_0x43f2('0x2f')]:_0xb7a400[_0x43f2('0x2b')];if(_0x48fe65[_0x43f2('0x2c')][_0x43f2('0x39')]){_0x20f6d3[_0x43f2('0x3a')]=[{'all':!![]}];}_0x20f6d3=_['merge']({},_0x20f6d3,_0x48fe65['options']);return db[_0x43f2('0x27')]['find'](_0x20f6d3)[_0x43f2('0x20')](handleEntityNotFound(_0x4ebe1e,null))[_0x43f2('0x20')](respondWithResult(_0x4ebe1e,null))['catch'](handleError(_0x4ebe1e,null));};exports[_0x43f2('0x3f')]=function(_0x58136d,_0x1a66b3){return db['FaxQueueReport'][_0x43f2('0x3f')](_0x58136d[_0x43f2('0x40')],{})['then'](respondWithResult(_0x1a66b3,0xc9))[_0x43f2('0x41')](handleError(_0x1a66b3,null));};exports[_0x43f2('0x1f')]=function(_0x3b5593,_0x17c6f4){if(_0x3b5593[_0x43f2('0x40')]['id']){delete _0x3b5593['body']['id'];}return db[_0x43f2('0x27')][_0x43f2('0x42')]({'where':{'id':_0x3b5593['params']['id']}})[_0x43f2('0x20')](handleEntityNotFound(_0x17c6f4,null))['then'](saveUpdates(_0x3b5593[_0x43f2('0x40')],null))[_0x43f2('0x20')](respondWithResult(_0x17c6f4,null))['catch'](handleError(_0x17c6f4,null));};exports[_0x43f2('0x43')]=function(_0x5ba550,_0x32c620){return db[_0x43f2('0x27')][_0x43f2('0x42')]({'where':{'id':_0x5ba550[_0x43f2('0x3d')]['id']}})[_0x43f2('0x20')](handleEntityNotFound(_0x32c620,null))['then'](removeEntity(_0x32c620,null))[_0x43f2('0x41')](handleError(_0x32c620,null));};exports[_0x43f2('0x44')]=function(_0xd058de,_0x10557d){return db[_0x43f2('0x27')][_0x43f2('0x44')]()[_0x43f2('0x20')](respondWithResult(_0x10557d,null))[_0x43f2('0x41')](handleError(_0x10557d,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index bb2c283..12897a9 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 _0x4d68=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','report_fax_queue','uniqueid'];(function(_0xfa4ca1,_0x3e7106){var _0x2cdbb6=function(_0x21fd92){while(--_0x21fd92){_0xfa4ca1['push'](_0xfa4ca1['shift']());}};_0x2cdbb6(++_0x3e7106);}(_0x4d68,0x1c3));var _0x84d6=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0x4d68[_0x503790];return _0x388092;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var logger=require(_0x84d6('0x2'))(_0x84d6('0x3'));var moment=require(_0x84d6('0x4'));var BPromise=require(_0x84d6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84d6('0x6'));var rimraf=require('rimraf');var config=require(_0x84d6('0x7'));var attributes=require('./faxQueueReport.attributes');module[_0x84d6('0x8')]=function(_0x368a18,_0x20957c){return _0x368a18['define']('FaxQueueReport',attributes,{'tableName':_0x84d6('0x9'),'paranoid':![],'indexes':[{'name':_0x84d6('0xa'),'fields':[_0x84d6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf61e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x526dc2,_0x37ebb8){var _0x54e521=function(_0x186bfb){while(--_0x186bfb){_0x526dc2['push'](_0x526dc2['shift']());}};_0x54e521(++_0x37ebb8);}(_0xf61e,0x191));var _0xef61=function(_0x254ba1,_0x3ce1f1){_0x254ba1=_0x254ba1-0x0;var _0x6c1995=_0xf61e[_0x254ba1];return _0x6c1995;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('FaxQueueReport',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index fc36a81..e3871cf 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 _0xa1de=['jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','stringify','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3e01eb,_0x5d0613){var _0x326402=function(_0x4040a9){while(--_0x4040a9){_0x3e01eb['push'](_0x3e01eb['shift']());}};_0x326402(++_0x5d0613);}(_0xa1de,0xae));var _0xea1d=function(_0x3394b4,_0x4d8898){_0x3394b4=_0x3394b4-0x0;var _0x2acad2=_0xa1de[_0x3394b4];return _0x2acad2;};'use strict';var _=require(_0xea1d('0x0'));var util=require(_0xea1d('0x1'));var moment=require(_0xea1d('0x2'));var BPromise=require(_0xea1d('0x3'));var rs=require(_0xea1d('0x4'));var fs=require('fs');var Redis=require(_0xea1d('0x5'));var db=require(_0xea1d('0x6'))['db'];var utils=require(_0xea1d('0x7'));var logger=require(_0xea1d('0x8'))(_0xea1d('0x9'));var config=require(_0xea1d('0xa'));var jayson=require(_0xea1d('0xb'));var client=jayson['client'][_0xea1d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd28cf5,_0x2a54a3,_0x1011c1){return new BPromise(function(_0x4c1629,_0x2d8638){return client[_0xea1d('0xd')](_0xd28cf5,_0x1011c1)[_0xea1d('0xe')](function(_0x3d5830){logger[_0xea1d('0xf')](_0xea1d('0x10'),_0x2a54a3,_0xea1d('0x11'));logger[_0xea1d('0x12')](_0xea1d('0x13'),_0x2a54a3,_0xea1d('0x11'),JSON['stringify'](_0x3d5830));if(_0x3d5830[_0xea1d('0x14')]){if(_0x3d5830[_0xea1d('0x14')][_0xea1d('0x15')]===0x1f4){logger[_0xea1d('0x14')](_0xea1d('0x10'),_0x2a54a3,_0x3d5830[_0xea1d('0x14')]['message']);return _0x2d8638(_0x3d5830['error'][_0xea1d('0x16')]);}logger[_0xea1d('0x14')](_0xea1d('0x10'),_0x2a54a3,_0x3d5830[_0xea1d('0x14')][_0xea1d('0x16')]);return _0x4c1629(_0x3d5830[_0xea1d('0x14')][_0xea1d('0x16')]);}else{logger['info'](_0xea1d('0x10'),_0x2a54a3,_0xea1d('0x11'));_0x4c1629(_0x3d5830[_0xea1d('0x17')][_0xea1d('0x16')]);}})[_0xea1d('0x18')](function(_0x311d8c){logger[_0xea1d('0x14')](_0xea1d('0x10'),_0x2a54a3,_0x311d8c);_0x2d8638(_0x311d8c);});});}exports[_0xea1d('0x19')]=function(_0x23c593){var _0x455679=this;return new Promise(function(_0x419739,_0x58c8f3){return db['FaxQueueReport'][_0xea1d('0x1a')](_0x23c593[_0xea1d('0x1b')],{'raw':_0x23c593[_0xea1d('0x1c')]?_0x23c593['options'][_0xea1d('0x1d')]===undefined?!![]:![]:!![]})[_0xea1d('0xe')](function(_0x4952cd){logger[_0xea1d('0xf')](_0xea1d('0x19'),_0x23c593);logger[_0xea1d('0x12')](_0xea1d('0x19'),_0x23c593,JSON[_0xea1d('0x1e')](_0x4952cd));_0x419739(_0x4952cd);})[_0xea1d('0x18')](function(_0x54cc86){logger[_0xea1d('0x14')]('CreateFaxQueueReport',_0x54cc86['message'],_0x23c593);_0x58c8f3(_0x455679[_0xea1d('0x14')](0x1f4,_0x54cc86[_0xea1d('0x16')]));});});};exports[_0xea1d('0x1f')]=function(_0x6d5b4a){var _0x2ae1cf=this;return new Promise(function(_0x6fc2c3,_0x1bfa11){return db[_0xea1d('0x20')][_0xea1d('0x21')](_0x6d5b4a[_0xea1d('0x1b')],{'raw':_0x6d5b4a['options']?_0x6d5b4a['options'][_0xea1d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6d5b4a['options']?_0x6d5b4a['options'][_0xea1d('0x22')]||null:null,'attributes':_0x6d5b4a[_0xea1d('0x1c')]?_0x6d5b4a[_0xea1d('0x1c')][_0xea1d('0x23')]||null:null,'limit':_0x6d5b4a['options']?_0x6d5b4a[_0xea1d('0x1c')][_0xea1d('0x24')]||null:null})['then'](function(_0x13dd33){logger[_0xea1d('0xf')](_0xea1d('0x1f'),_0x6d5b4a);logger[_0xea1d('0x12')](_0xea1d('0x1f'),_0x6d5b4a,JSON['stringify'](_0x13dd33));_0x6fc2c3(_0x13dd33);})['catch'](function(_0x183ed4){logger[_0xea1d('0x14')](_0xea1d('0x1f'),_0x183ed4[_0xea1d('0x16')],_0x6d5b4a);_0x1bfa11(_0x2ae1cf[_0xea1d('0x14')](0x1f4,_0x183ed4[_0xea1d('0x16')]));});});}; \ No newline at end of file +var _0x1455=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','then','UpdateFaxQueueReport','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x1455,0x17d));var _0x5145=function(_0x54ca89,_0xa23eb){_0x54ca89=_0x54ca89-0x0;var _0x129799=_0x1455[_0x54ca89];return _0x129799;};'use strict';var _=require(_0x5145('0x0'));var util=require('util');var moment=require(_0x5145('0x1'));var BPromise=require(_0x5145('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5145('0x3'));var db=require(_0x5145('0x4'))['db'];var utils=require(_0x5145('0x5'));var logger=require(_0x5145('0x6'))(_0x5145('0x7'));var config=require(_0x5145('0x8'));var jayson=require(_0x5145('0x9'));var client=jayson[_0x5145('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x563a42,_0x1c28d2,_0x38cd70){return new BPromise(function(_0x5be7ac,_0x1e5811){return client[_0x5145('0xb')](_0x563a42,_0x38cd70)['then'](function(_0x8f607c){logger[_0x5145('0xc')](_0x5145('0xd'),_0x1c28d2,_0x5145('0xe'));logger[_0x5145('0xf')](_0x5145('0x10'),_0x1c28d2,'request\x20sent',JSON[_0x5145('0x11')](_0x8f607c));if(_0x8f607c['error']){if(_0x8f607c[_0x5145('0x12')][_0x5145('0x13')]===0x1f4){logger[_0x5145('0x12')](_0x5145('0xd'),_0x1c28d2,_0x8f607c['error'][_0x5145('0x14')]);return _0x1e5811(_0x8f607c[_0x5145('0x12')][_0x5145('0x14')]);}logger['error'](_0x5145('0xd'),_0x1c28d2,_0x8f607c[_0x5145('0x12')]['message']);return _0x5be7ac(_0x8f607c['error'][_0x5145('0x14')]);}else{logger[_0x5145('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x1c28d2,_0x5145('0xe'));_0x5be7ac(_0x8f607c[_0x5145('0x15')][_0x5145('0x14')]);}})[_0x5145('0x16')](function(_0x13cb0a){logger[_0x5145('0x12')](_0x5145('0xd'),_0x1c28d2,_0x13cb0a);_0x1e5811(_0x13cb0a);});});}exports[_0x5145('0x17')]=function(_0x208bc1){var _0x2fdbb2=this;return new Promise(function(_0x29db5a,_0x1aa92b){return db[_0x5145('0x18')]['create'](_0x208bc1[_0x5145('0x19')],{'raw':_0x208bc1[_0x5145('0x1a')]?_0x208bc1['options'][_0x5145('0x1b')]===undefined?!![]:![]:!![]})[_0x5145('0x1c')](function(_0xd2b107){logger[_0x5145('0xc')]('CreateFaxQueueReport',_0x208bc1);logger['debug']('CreateFaxQueueReport',_0x208bc1,JSON[_0x5145('0x11')](_0xd2b107));_0x29db5a(_0xd2b107);})[_0x5145('0x16')](function(_0x9fc7b8){logger[_0x5145('0x12')](_0x5145('0x17'),_0x9fc7b8[_0x5145('0x14')],_0x208bc1);_0x1aa92b(_0x2fdbb2[_0x5145('0x12')](0x1f4,_0x9fc7b8[_0x5145('0x14')]));});});};exports[_0x5145('0x1d')]=function(_0x419b01){var _0x41a697=this;return new Promise(function(_0x2809ad,_0x38e0f6){return db[_0x5145('0x18')]['update'](_0x419b01[_0x5145('0x19')],{'raw':_0x419b01[_0x5145('0x1a')]?_0x419b01[_0x5145('0x1a')][_0x5145('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x419b01[_0x5145('0x1a')]?_0x419b01[_0x5145('0x1a')][_0x5145('0x1e')]||null:null,'attributes':_0x419b01[_0x5145('0x1a')]?_0x419b01[_0x5145('0x1a')][_0x5145('0x1f')]||null:null,'limit':_0x419b01[_0x5145('0x1a')]?_0x419b01[_0x5145('0x1a')][_0x5145('0x20')]||null:null})['then'](function(_0xf272c1){logger[_0x5145('0xc')](_0x5145('0x1d'),_0x419b01);logger[_0x5145('0xf')](_0x5145('0x1d'),_0x419b01,JSON[_0x5145('0x11')](_0xf272c1));_0x2809ad(_0xf272c1);})[_0x5145('0x16')](function(_0x430489){logger[_0x5145('0x12')](_0x5145('0x1d'),_0x430489['message'],_0x419b01);_0x38e0f6(_0x41a697[_0x5145('0x12')](0x1f4,_0x430489[_0x5145('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 325d20c..6187292 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 _0xd135=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xd135,0x196));var _0x5d13=function(_0x302b92,_0x392123){_0x302b92=_0x302b92-0x0;var _0x4922f6=_0xd135[_0x302b92];return _0x4922f6;};'use strict';var multer=require('multer');var util=require(_0x5d13('0x0'));var path=require(_0x5d13('0x1'));var timeout=require(_0x5d13('0x2'));var express=require(_0x5d13('0x3'));var router=express[_0x5d13('0x4')]();var auth=require(_0x5d13('0x5'));var interaction=require(_0x5d13('0x6'));var config=require(_0x5d13('0x7'));var controller=require(_0x5d13('0x8'));router[_0x5d13('0x9')]('/',auth[_0x5d13('0xa')](),controller[_0x5d13('0xb')]);router[_0x5d13('0x9')](_0x5d13('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x5d13('0x9')](_0x5d13('0xd'),auth[_0x5d13('0xa')](),controller[_0x5d13('0xe')]);router[_0x5d13('0xf')]('/',auth[_0x5d13('0xa')](),controller[_0x5d13('0x10')]);router[_0x5d13('0x11')]('/:id',auth[_0x5d13('0xa')](),controller[_0x5d13('0x12')]);router[_0x5d13('0x13')](_0x5d13('0xd'),auth[_0x5d13('0xa')](),controller['destroy']);module[_0x5d13('0x14')]=router; \ No newline at end of file +var _0x4baa=['describe','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x4baa,0x19a));var _0xa4ba=function(_0x3d937c,_0x534e35){_0x3d937c=_0x3d937c-0x0;var _0x1976e8=_0x4baa[_0x3d937c];return _0x1976e8;};'use strict';var multer=require(_0xa4ba('0x0'));var util=require('util');var path=require(_0xa4ba('0x1'));var timeout=require(_0xa4ba('0x2'));var express=require('express');var router=express[_0xa4ba('0x3')]();var auth=require(_0xa4ba('0x4'));var interaction=require(_0xa4ba('0x5'));var config=require(_0xa4ba('0x6'));var controller=require(_0xa4ba('0x7'));router[_0xa4ba('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa4ba('0x8')](_0xa4ba('0x9'),auth['isAuthenticated'](),controller[_0xa4ba('0xa')]);router[_0xa4ba('0x8')](_0xa4ba('0xb'),auth[_0xa4ba('0xc')](),controller[_0xa4ba('0xd')]);router[_0xa4ba('0xe')]('/',auth[_0xa4ba('0xc')](),controller[_0xa4ba('0xf')]);router[_0xa4ba('0x10')](_0xa4ba('0xb'),auth[_0xa4ba('0xc')](),controller['update']);router[_0xa4ba('0x11')](_0xa4ba('0xb'),auth[_0xa4ba('0xc')](),controller[_0xa4ba('0x12')]);module[_0xa4ba('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index bcb6da7..bdbdf4c 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 _0xfada=['sequelize','exports','ENUM','account','agent','queue','NOW'];(function(_0x13993c,_0x4bead3){var _0x7b7f50=function(_0x5ab11e){while(--_0x5ab11e){_0x13993c['push'](_0x13993c['shift']());}};_0x7b7f50(++_0x4bead3);}(_0xfada,0xe7));var _0xafad=function(_0x1fcdcf,_0x49382e){_0x1fcdcf=_0x1fcdcf-0x0;var _0x3a7a86=_0xfada[_0x1fcdcf];return _0x3a7a86;};'use strict';var moment=require('moment');var Sequelize=require(_0xafad('0x0'));module[_0xafad('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xafad('0x2')](_0xafad('0x3'),_0xafad('0x4'),_0xafad('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xafad('0x6')]}}; \ No newline at end of file +var _0x07e7=['queue','DATE','moment','sequelize','STRING','ENUM','account','agent'];(function(_0x4c0dc1,_0x2cd142){var _0x5caa5c=function(_0x4effbe){while(--_0x4effbe){_0x4c0dc1['push'](_0x4c0dc1['shift']());}};_0x5caa5c(++_0x2cd142);}(_0x07e7,0xfa));var _0x707e=function(_0x817aa5,_0x3504f9){_0x817aa5=_0x817aa5-0x0;var _0x530c00=_0x07e7[_0x817aa5];return _0x530c00;};'use strict';var moment=require(_0x707e('0x0'));var Sequelize=require(_0x707e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x707e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x707e('0x3')](_0x707e('0x4'),_0x707e('0x5'),_0x707e('0x6')),'allowNull':![],'defaultValue':_0x707e('0x6')},'transferredAt':{'type':Sequelize[_0x707e('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 1efa794..3339a3f 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 _0x2032=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','intersection','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x5837ac,_0x24188e){var _0xa6da77=function(_0x4a4cfa){while(--_0x4a4cfa){_0x5837ac['push'](_0x5837ac['shift']());}};_0xa6da77(++_0x24188e);}(_0x2032,0xd9));var _0x2203=function(_0x39f9e0,_0xfa7ca){_0x39f9e0=_0x39f9e0-0x0;var _0x4cfddf=_0x2032[_0x39f9e0];return _0x4cfddf;};'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 _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var db=require(_0x2203('0x16'))['db'];function respondWithStatusCode(_0x1abb51,_0x4b9376){_0x4b9376=_0x4b9376||0xcc;return function(_0x583bc7){if(_0x583bc7){return _0x1abb51['sendStatus'](_0x4b9376);}return _0x1abb51['status'](_0x4b9376)['end']();};}function respondWithResult(_0x238772,_0x538b30){_0x538b30=_0x538b30||0xc8;return function(_0x592e47){if(_0x592e47){return _0x238772[_0x2203('0x17')](_0x538b30)[_0x2203('0x18')](_0x592e47);}};}function respondWithFilteredResult(_0x1c1ead,_0x41af85){return function(_0x226209){if(_0x226209){var _0x3fe0a8=_0x226209[_0x2203('0x19')],_0x2c36e6=_0x41af85['offset'],_0x2c085c=_0x41af85[_0x2203('0x1a')]+_0x41af85[_0x2203('0x1b')],_0xdf9d0b;if(_0x2c085c>=_0x3fe0a8){_0x2c085c=_0x3fe0a8;_0xdf9d0b=0xc8;}else{_0xdf9d0b=0xce;}_0x1c1ead['status'](_0xdf9d0b);return _0x1c1ead[_0x2203('0x1c')](_0x2203('0x1d'),_0x2c36e6+'-'+_0x2c085c+'/'+_0x3fe0a8)['json'](_0x226209);}return null;};}function patchUpdates(_0x30c6f7){return function(_0x5ee83c){try{jsonpatch[_0x2203('0x1e')](_0x5ee83c,_0x30c6f7,!![]);}catch(_0x310b8c){return BPromise[_0x2203('0x1f')](_0x310b8c);}return _0x5ee83c[_0x2203('0x20')]();};}function saveUpdates(_0x15cb1a,_0x449039){return function(_0x538c23){if(_0x538c23){return _0x538c23[_0x2203('0x21')](_0x15cb1a)['then'](function(_0x5ac866){return _0x5ac866;});}return null;};}function removeEntity(_0x15f543,_0x496d82){return function(_0x3b8ef9){if(_0x3b8ef9){return _0x3b8ef9[_0x2203('0x22')]()['then'](function(){_0x15f543[_0x2203('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8da9,_0x226374){return function(_0x2718f5){if(!_0x2718f5){_0x5c8da9[_0x2203('0x23')](0x194);}return _0x2718f5;};}function handleError(_0xfd0970,_0x1244f4){_0x1244f4=_0x1244f4||0x1f4;return function(_0x3114ef){logger[_0x2203('0x24')](_0x3114ef[_0x2203('0x25')]);if(_0x3114ef['name']){delete _0x3114ef[_0x2203('0x26')];}_0xfd0970[_0x2203('0x17')](_0x1244f4)[_0x2203('0x27')](_0x3114ef);};}exports['index']=function(_0xb2071b,_0x1cec17){var _0x5c5fd3={},_0xd6e109={},_0xd91f5d={'count':0x0,'rows':[]};var _0x1c6a77=_[_0x2203('0x28')](db[_0x2203('0x29')][_0x2203('0x2a')],function(_0x9c53f){return{'name':_0x9c53f['fieldName'],'type':_0x9c53f[_0x2203('0x2b')][_0x2203('0x2c')]};});_0xd6e109[_0x2203('0x2d')]=_[_0x2203('0x28')](_0x1c6a77,'name');_0xd6e109[_0x2203('0x2e')]=_[_0x2203('0x2f')](_0xb2071b[_0x2203('0x2e')]);_0xd6e109[_0x2203('0x30')]=_['intersection'](_0xd6e109[_0x2203('0x2d')],_0xd6e109[_0x2203('0x2e')]);_0x5c5fd3['attributes']=_['intersection'](_0xd6e109[_0x2203('0x2d')],qs['fields'](_0xb2071b['query'][_0x2203('0x31')]));_0x5c5fd3[_0x2203('0x32')]=_0x5c5fd3[_0x2203('0x32')][_0x2203('0x33')]?_0x5c5fd3[_0x2203('0x32')]:_0xd6e109['model'];if(!_0xb2071b[_0x2203('0x2e')][_0x2203('0x34')]('nolimit')){_0x5c5fd3[_0x2203('0x1b')]=qs[_0x2203('0x1b')](_0xb2071b[_0x2203('0x2e')][_0x2203('0x1b')]);_0x5c5fd3[_0x2203('0x1a')]=qs[_0x2203('0x1a')](_0xb2071b[_0x2203('0x2e')][_0x2203('0x1a')]);}_0x5c5fd3[_0x2203('0x35')]=qs['sort'](_0xb2071b[_0x2203('0x2e')][_0x2203('0x36')]);_0x5c5fd3['where']=qs['filters'](_[_0x2203('0x37')](_0xb2071b['query'],_0xd6e109[_0x2203('0x30')]),_0x1c6a77);if(_0xb2071b[_0x2203('0x2e')][_0x2203('0x38')]){_0x5c5fd3['where']=_['merge'](_0x5c5fd3[_0x2203('0x39')],{'$or':_['map'](_0x1c6a77,function(_0x2d0365){if(_0x2d0365['type']!==_0x2203('0x3a')){var _0x4b6fc5={};_0x4b6fc5[_0x2d0365[_0x2203('0x26')]]={'$like':'%'+_0xb2071b[_0x2203('0x2e')][_0x2203('0x38')]+'%'};return _0x4b6fc5;}})});}_0x5c5fd3=_[_0x2203('0x3b')]({},_0x5c5fd3,_0xb2071b[_0x2203('0x3c')]);var _0x5436d2={'where':_0x5c5fd3['where']};return db['FaxTransferReport'][_0x2203('0x19')](_0x5436d2)[_0x2203('0x3d')](function(_0x323798){_0xd91f5d[_0x2203('0x19')]=_0x323798;if(_0xb2071b[_0x2203('0x2e')][_0x2203('0x3e')]){_0x5c5fd3[_0x2203('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x2203('0x40')](_0x5c5fd3);})[_0x2203('0x3d')](function(_0x108fde){_0xd91f5d[_0x2203('0x41')]=_0x108fde;return _0xd91f5d;})['then'](respondWithFilteredResult(_0x1cec17,_0x5c5fd3))['catch'](handleError(_0x1cec17,null));};exports[_0x2203('0x42')]=function(_0x5494a1,_0x330303){var _0x446209={'raw':!![],'where':{'id':_0x5494a1['params']['id']}},_0x132091={};_0x132091['model']=_[_0x2203('0x2f')](db[_0x2203('0x29')][_0x2203('0x2a')]);_0x132091[_0x2203('0x2e')]=_[_0x2203('0x2f')](_0x5494a1[_0x2203('0x2e')]);_0x132091['filters']=_[_0x2203('0x43')](_0x132091[_0x2203('0x2d')],_0x132091[_0x2203('0x2e')]);_0x446209[_0x2203('0x32')]=_[_0x2203('0x43')](_0x132091[_0x2203('0x2d')],qs[_0x2203('0x31')](_0x5494a1[_0x2203('0x2e')][_0x2203('0x31')]));_0x446209[_0x2203('0x32')]=_0x446209['attributes'][_0x2203('0x33')]?_0x446209[_0x2203('0x32')]:_0x132091[_0x2203('0x2d')];if(_0x5494a1[_0x2203('0x2e')]['includeAll']){_0x446209['include']=[{'all':!![]}];}_0x446209=_[_0x2203('0x3b')]({},_0x446209,_0x5494a1['options']);return db[_0x2203('0x29')][_0x2203('0x44')](_0x446209)[_0x2203('0x3d')](handleEntityNotFound(_0x330303,null))[_0x2203('0x3d')](respondWithResult(_0x330303,null))['catch'](handleError(_0x330303,null));};exports[_0x2203('0x45')]=function(_0x102803,_0x5cd8c6){return db[_0x2203('0x29')][_0x2203('0x45')](_0x102803[_0x2203('0x46')],{})[_0x2203('0x3d')](respondWithResult(_0x5cd8c6,0xc9))['catch'](handleError(_0x5cd8c6,null));};exports['update']=function(_0x21b8ab,_0x5707c8){if(_0x21b8ab['body']['id']){delete _0x21b8ab[_0x2203('0x46')]['id'];}return db[_0x2203('0x29')][_0x2203('0x44')]({'where':{'id':_0x21b8ab['params']['id']}})['then'](handleEntityNotFound(_0x5707c8,null))[_0x2203('0x3d')](saveUpdates(_0x21b8ab[_0x2203('0x46')],null))[_0x2203('0x3d')](respondWithResult(_0x5707c8,null))[_0x2203('0x47')](handleError(_0x5707c8,null));};exports[_0x2203('0x22')]=function(_0x21fd78,_0x4a7f4e){return db[_0x2203('0x29')]['find']({'where':{'id':_0x21fd78[_0x2203('0x48')]['id']}})[_0x2203('0x3d')](handleEntityNotFound(_0x4a7f4e,null))[_0x2203('0x3d')](removeEntity(_0x4a7f4e,null))[_0x2203('0x47')](handleError(_0x4a7f4e,null));};exports['describe']=function(_0x506795,_0x30d503){return db[_0x2203('0x29')][_0x2203('0x49')]()[_0x2203('0x3d')](respondWithResult(_0x30d503,null))['catch'](handleError(_0x30d503,null));}; \ No newline at end of file +var _0x0b0e=['index','map','FaxTransferReport','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','count','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','reject','update','then','destroy','end','error','name'];(function(_0x5e24bc,_0x1dfc37){var _0x54b0f7=function(_0x37e413){while(--_0x37e413){_0x5e24bc['push'](_0x5e24bc['shift']());}};_0x54b0f7(++_0x1dfc37);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x0b0e[_0x18aaaf];return _0x52d892;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3068c0,_0x1c358a){_0x1c358a=_0x1c358a||0xcc;return function(_0x3cc19a){if(_0x3cc19a){return _0x3068c0[_0xe0b0('0x17')](_0x1c358a);}return _0x3068c0[_0xe0b0('0x18')](_0x1c358a)['end']();};}function respondWithResult(_0x3782be,_0x154de6){_0x154de6=_0x154de6||0xc8;return function(_0x743318){if(_0x743318){return _0x3782be[_0xe0b0('0x18')](_0x154de6)[_0xe0b0('0x19')](_0x743318);}};}function respondWithFilteredResult(_0x55d884,_0x41a7e2){return function(_0x5adb01){if(_0x5adb01){var _0x35cb40=_0x5adb01['count'],_0xadee6e=_0x41a7e2[_0xe0b0('0x1a')],_0x519ae8=_0x41a7e2[_0xe0b0('0x1a')]+_0x41a7e2['limit'],_0x11fdca;if(_0x519ae8>=_0x35cb40){_0x519ae8=_0x35cb40;_0x11fdca=0xc8;}else{_0x11fdca=0xce;}_0x55d884['status'](_0x11fdca);return _0x55d884[_0xe0b0('0x1b')]('Content-Range',_0xadee6e+'-'+_0x519ae8+'/'+_0x35cb40)['json'](_0x5adb01);}return null;};}function patchUpdates(_0x4bce65){return function(_0x1920ee){try{jsonpatch['apply'](_0x1920ee,_0x4bce65,!![]);}catch(_0x52598b){return BPromise[_0xe0b0('0x1c')](_0x52598b);}return _0x1920ee['save']();};}function saveUpdates(_0x472286,_0x5dba2f){return function(_0x2c84cc){if(_0x2c84cc){return _0x2c84cc[_0xe0b0('0x1d')](_0x472286)[_0xe0b0('0x1e')](function(_0x310a6d){return _0x310a6d;});}return null;};}function removeEntity(_0x2cf6a1,_0x58b804){return function(_0x4cae54){if(_0x4cae54){return _0x4cae54[_0xe0b0('0x1f')]()['then'](function(){_0x2cf6a1[_0xe0b0('0x18')](0xcc)[_0xe0b0('0x20')]();});}};}function handleEntityNotFound(_0x513e63,_0x170ad8){return function(_0x503883){if(!_0x503883){_0x513e63[_0xe0b0('0x17')](0x194);}return _0x503883;};}function handleError(_0x49a727,_0x28586d){_0x28586d=_0x28586d||0x1f4;return function(_0x576352){logger[_0xe0b0('0x21')](_0x576352['stack']);if(_0x576352[_0xe0b0('0x22')]){delete _0x576352['name'];}_0x49a727[_0xe0b0('0x18')](_0x28586d)['send'](_0x576352);};}exports[_0xe0b0('0x23')]=function(_0x3c3bc2,_0x1f1ebd){var _0x1d91ad={},_0x3ec2={},_0x10745d={'count':0x0,'rows':[]};var _0x5200a6=_[_0xe0b0('0x24')](db[_0xe0b0('0x25')]['rawAttributes'],function(_0x15e13b){return{'name':_0x15e13b[_0xe0b0('0x26')],'type':_0x15e13b[_0xe0b0('0x27')][_0xe0b0('0x28')]};});_0x3ec2[_0xe0b0('0x29')]=_[_0xe0b0('0x24')](_0x5200a6,_0xe0b0('0x22'));_0x3ec2['query']=_[_0xe0b0('0x2a')](_0x3c3bc2[_0xe0b0('0x2b')]);_0x3ec2['filters']=_['intersection'](_0x3ec2[_0xe0b0('0x29')],_0x3ec2[_0xe0b0('0x2b')]);_0x1d91ad[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x3ec2[_0xe0b0('0x29')],qs['fields'](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x2e')]));_0x1d91ad[_0xe0b0('0x2c')]=_0x1d91ad[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x1d91ad['attributes']:_0x3ec2[_0xe0b0('0x29')];if(!_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x30')](_0xe0b0('0x31'))){_0x1d91ad[_0xe0b0('0x32')]=qs[_0xe0b0('0x32')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x32')]);_0x1d91ad[_0xe0b0('0x1a')]=qs[_0xe0b0('0x1a')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x1a')]);}_0x1d91ad[_0xe0b0('0x33')]=qs[_0xe0b0('0x34')](_0x3c3bc2[_0xe0b0('0x2b')]['sort']);_0x1d91ad[_0xe0b0('0x35')]=qs[_0xe0b0('0x36')](_[_0xe0b0('0x37')](_0x3c3bc2[_0xe0b0('0x2b')],_0x3ec2[_0xe0b0('0x36')]),_0x5200a6);if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]){_0x1d91ad['where']=_['merge'](_0x1d91ad['where'],{'$or':_['map'](_0x5200a6,function(_0x26137c){if(_0x26137c[_0xe0b0('0x27')]!==_0xe0b0('0x39')){var _0x4e4b20={};_0x4e4b20[_0x26137c[_0xe0b0('0x22')]]={'$like':'%'+_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]+'%'};return _0x4e4b20;}})});}_0x1d91ad=_[_0xe0b0('0x3a')]({},_0x1d91ad,_0x3c3bc2['options']);var _0xed3226={'where':_0x1d91ad[_0xe0b0('0x35')]};return db[_0xe0b0('0x25')][_0xe0b0('0x3b')](_0xed3226)[_0xe0b0('0x1e')](function(_0x1205db){_0x10745d[_0xe0b0('0x3b')]=_0x1205db;if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x1d91ad['include']=[{'all':!![]}];}return db[_0xe0b0('0x25')]['findAll'](_0x1d91ad);})[_0xe0b0('0x1e')](function(_0x2d5f47){_0x10745d[_0xe0b0('0x3d')]=_0x2d5f47;return _0x10745d;})[_0xe0b0('0x1e')](respondWithFilteredResult(_0x1f1ebd,_0x1d91ad))['catch'](handleError(_0x1f1ebd,null));};exports[_0xe0b0('0x3e')]=function(_0x41adcb,_0x33706d){var _0x402a0e={'raw':!![],'where':{'id':_0x41adcb[_0xe0b0('0x3f')]['id']}},_0x19c80e={};_0x19c80e[_0xe0b0('0x29')]=_[_0xe0b0('0x2a')](db['FaxTransferReport'][_0xe0b0('0x40')]);_0x19c80e[_0xe0b0('0x2b')]=_['keys'](_0x41adcb['query']);_0x19c80e[_0xe0b0('0x36')]=_[_0xe0b0('0x2d')](_0x19c80e['model'],_0x19c80e[_0xe0b0('0x2b')]);_0x402a0e[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x19c80e[_0xe0b0('0x29')],qs[_0xe0b0('0x2e')](_0x41adcb['query']['fields']));_0x402a0e['attributes']=_0x402a0e[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x402a0e['attributes']:_0x19c80e[_0xe0b0('0x29')];if(_0x41adcb[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x402a0e[_0xe0b0('0x41')]=[{'all':!![]}];}_0x402a0e=_[_0xe0b0('0x3a')]({},_0x402a0e,_0x41adcb['options']);return db['FaxTransferReport'][_0xe0b0('0x42')](_0x402a0e)[_0xe0b0('0x1e')](handleEntityNotFound(_0x33706d,null))[_0xe0b0('0x1e')](respondWithResult(_0x33706d,null))[_0xe0b0('0x43')](handleError(_0x33706d,null));};exports[_0xe0b0('0x44')]=function(_0x575c7d,_0x3b1474){return db[_0xe0b0('0x25')]['create'](_0x575c7d['body'],{})['then'](respondWithResult(_0x3b1474,0xc9))[_0xe0b0('0x43')](handleError(_0x3b1474,null));};exports[_0xe0b0('0x1d')]=function(_0x2419ce,_0x364877){if(_0x2419ce['body']['id']){delete _0x2419ce[_0xe0b0('0x45')]['id'];}return db[_0xe0b0('0x25')]['find']({'where':{'id':_0x2419ce['params']['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x364877,null))[_0xe0b0('0x1e')](saveUpdates(_0x2419ce['body'],null))[_0xe0b0('0x1e')](respondWithResult(_0x364877,null))[_0xe0b0('0x43')](handleError(_0x364877,null));};exports['destroy']=function(_0x5cb2b6,_0x123ad2){return db['FaxTransferReport'][_0xe0b0('0x42')]({'where':{'id':_0x5cb2b6[_0xe0b0('0x3f')]['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x123ad2,null))[_0xe0b0('0x1e')](removeEntity(_0x123ad2,null))[_0xe0b0('0x43')](handleError(_0x123ad2,null));};exports[_0xe0b0('0x46')]=function(_0x5f5486,_0x5d018d){return db[_0xe0b0('0x25')]['describe']()['then'](respondWithResult(_0x5d018d,null))[_0xe0b0('0x43')](handleError(_0x5d018d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 309336d..ab143f7 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 _0xe3dc=['rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x27f6d0,_0x397e9a){var _0x3ab309=function(_0x28ce26){while(--_0x28ce26){_0x27f6d0['push'](_0x27f6d0['shift']());}};_0x3ab309(++_0x397e9a);}(_0xe3dc,0x1e7));var _0xce3d=function(_0x4d2854,_0x3d7688){_0x4d2854=_0x4d2854-0x0;var _0x108402=_0xe3dc[_0x4d2854];return _0x108402;};'use strict';var _=require(_0xce3d('0x0'));var util=require(_0xce3d('0x1'));var logger=require(_0xce3d('0x2'))(_0xce3d('0x3'));var moment=require(_0xce3d('0x4'));var BPromise=require(_0xce3d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce3d('0x6'));var rimraf=require(_0xce3d('0x7'));var config=require(_0xce3d('0x8'));var attributes=require(_0xce3d('0x9'));module[_0xce3d('0xa')]=function(_0x4f4fb7,_0x24f824){return _0x4f4fb7[_0xce3d('0xb')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xce3d('0xc'),'fields':[_0xce3d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x602a=['api','moment','bluebird','path','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger'];(function(_0x4d5005,_0x45209b){var _0x778b8e=function(_0x564da6){while(--_0x564da6){_0x4d5005['push'](_0x4d5005['shift']());}};_0x778b8e(++_0x45209b);}(_0x602a,0x1de));var _0xa602=function(_0x41aa73,_0x278085){_0x41aa73=_0x41aa73-0x0;var _0x2f733a=_0x602a[_0x41aa73];return _0x2f733a;};'use strict';var _=require(_0xa602('0x0'));var util=require('util');var logger=require(_0xa602('0x1'))(_0xa602('0x2'));var moment=require(_0xa602('0x3'));var BPromise=require(_0xa602('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa602('0x5'));var rimraf=require(_0xa602('0x6'));var config=require('../../config/environment');var attributes=require(_0xa602('0x7'));module[_0xa602('0x8')]=function(_0x5c79a1,_0x2a9d2f){return _0x5c79a1['define'](_0xa602('0x9'),attributes,{'tableName':_0xa602('0xa'),'paranoid':![],'indexes':[{'name':_0xa602('0xb'),'fields':[_0xa602('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 541d22e..04bf72a 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 _0xe313=['message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x28c301,_0x49d078){var _0x342017=function(_0x1f7179){while(--_0x1f7179){_0x28c301['push'](_0x28c301['shift']());}};_0x342017(++_0x49d078);}(_0xe313,0x137));var _0x3e31=function(_0x2d036c,_0x2eec5e){_0x2d036c=_0x2d036c-0x0;var _0x480523=_0xe313[_0x2d036c];return _0x480523;};'use strict';var _=require('lodash');var util=require(_0x3e31('0x0'));var moment=require(_0x3e31('0x1'));var BPromise=require(_0x3e31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e31('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e31('0x4'));var logger=require(_0x3e31('0x5'))(_0x3e31('0x6'));var config=require('../../config/environment');var jayson=require(_0x3e31('0x7'));var client=jayson['client'][_0x3e31('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xba35b8,_0x5aa864,_0x1ce77d){return new BPromise(function(_0x2aec54,_0x3c0e19){return client[_0x3e31('0x9')](_0xba35b8,_0x1ce77d)[_0x3e31('0xa')](function(_0x2c5eb3){logger[_0x3e31('0xb')](_0x3e31('0xc'),_0x5aa864,_0x3e31('0xd'));logger[_0x3e31('0xe')](_0x3e31('0xf'),_0x5aa864,_0x3e31('0xd'),JSON[_0x3e31('0x10')](_0x2c5eb3));if(_0x2c5eb3[_0x3e31('0x11')]){if(_0x2c5eb3['error'][_0x3e31('0x12')]===0x1f4){logger[_0x3e31('0x11')](_0x3e31('0xc'),_0x5aa864,_0x2c5eb3[_0x3e31('0x11')]['message']);return _0x3c0e19(_0x2c5eb3[_0x3e31('0x11')]['message']);}logger[_0x3e31('0x11')](_0x3e31('0xc'),_0x5aa864,_0x2c5eb3[_0x3e31('0x11')][_0x3e31('0x13')]);return _0x2aec54(_0x2c5eb3[_0x3e31('0x11')][_0x3e31('0x13')]);}else{logger[_0x3e31('0xb')](_0x3e31('0xc'),_0x5aa864,_0x3e31('0xd'));_0x2aec54(_0x2c5eb3[_0x3e31('0x14')][_0x3e31('0x13')]);}})[_0x3e31('0x15')](function(_0x4b5372){logger['error'](_0x3e31('0xc'),_0x5aa864,_0x4b5372);_0x3c0e19(_0x4b5372);});});} \ No newline at end of file +var _0xd9f2=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0xd9f2,0x162));var _0x2d9f=function(_0x2a0bf6,_0x10a432){_0x2a0bf6=_0x2a0bf6-0x0;var _0x5d85d0=_0xd9f2[_0x2a0bf6];return _0x5d85d0;};'use strict';var _=require(_0x2d9f('0x0'));var util=require('util');var moment=require(_0x2d9f('0x1'));var BPromise=require(_0x2d9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d9f('0x3'));var db=require(_0x2d9f('0x4'))['db'];var utils=require(_0x2d9f('0x5'));var logger=require('../../config/logger')(_0x2d9f('0x6'));var config=require(_0x2d9f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d9f('0x8')][_0x2d9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9c9a8c,_0x43a4c3,_0x4a2ab6){return new BPromise(function(_0x55699d,_0x1e12b3){return client[_0x2d9f('0xa')](_0x9c9a8c,_0x4a2ab6)[_0x2d9f('0xb')](function(_0x5582ce){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x43a4c3,_0x2d9f('0xc'));logger[_0x2d9f('0xd')](_0x2d9f('0xe'),_0x43a4c3,_0x2d9f('0xc'),JSON[_0x2d9f('0xf')](_0x5582ce));if(_0x5582ce[_0x2d9f('0x10')]){if(_0x5582ce['error'][_0x2d9f('0x11')]===0x1f4){logger[_0x2d9f('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x43a4c3,_0x5582ce[_0x2d9f('0x10')][_0x2d9f('0x12')]);return _0x1e12b3(_0x5582ce[_0x2d9f('0x10')][_0x2d9f('0x12')]);}logger[_0x2d9f('0x10')](_0x2d9f('0x13'),_0x43a4c3,_0x5582ce[_0x2d9f('0x10')]['message']);return _0x55699d(_0x5582ce[_0x2d9f('0x10')][_0x2d9f('0x12')]);}else{logger[_0x2d9f('0x14')](_0x2d9f('0x13'),_0x43a4c3,_0x2d9f('0xc'));_0x55699d(_0x5582ce[_0x2d9f('0x15')]['message']);}})[_0x2d9f('0x16')](function(_0x3ff256){logger[_0x2d9f('0x10')](_0x2d9f('0x13'),_0x43a4c3,_0x3ff256);_0x1e12b3(_0x3ff256);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 108b887..27227c0 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 _0xdcd5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','describe','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x45f183,_0x38187b){var _0x361e64=function(_0x1ab07f){while(--_0x1ab07f){_0x45f183['push'](_0x45f183['shift']());}};_0x361e64(++_0x38187b);}(_0xdcd5,0x95));var _0x5dcd=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0xdcd5[_0x32d414];return _0x4e0bca;};'use strict';var multer=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var path=require(_0x5dcd('0x2'));var timeout=require(_0x5dcd('0x3'));var express=require(_0x5dcd('0x4'));var router=express[_0x5dcd('0x5')]();var auth=require(_0x5dcd('0x6'));var interaction=require(_0x5dcd('0x7'));var config=require(_0x5dcd('0x8'));var controller=require(_0x5dcd('0x9'));router[_0x5dcd('0xa')]('/',auth['isAuthenticated'](),controller[_0x5dcd('0xb')]);router[_0x5dcd('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5dcd('0xc')]);router[_0x5dcd('0xa')](_0x5dcd('0xd'),auth['isAuthenticated'](),controller[_0x5dcd('0xe')]);router[_0x5dcd('0xf')]('/',auth[_0x5dcd('0x10')](),controller['create']);router[_0x5dcd('0x11')](_0x5dcd('0xd'),auth[_0x5dcd('0x10')](),controller[_0x5dcd('0x12')]);router[_0x5dcd('0x13')](_0x5dcd('0xd'),auth[_0x5dcd('0x10')](),controller[_0x5dcd('0x14')]);module[_0x5dcd('0x15')]=router; \ No newline at end of file +var _0xc596=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','describe','/:id','isAuthenticated','show','put','update','delete','destroy','multer','path','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc596,0x12c));var _0x6c59=function(_0x38f5c0,_0x57b250){_0x38f5c0=_0x38f5c0-0x0;var _0x54f13a=_0xc596[_0x38f5c0];return _0x54f13a;};'use strict';var multer=require(_0x6c59('0x0'));var util=require('util');var path=require(_0x6c59('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c59('0x2')]();var auth=require(_0x6c59('0x3'));var interaction=require(_0x6c59('0x4'));var config=require(_0x6c59('0x5'));var controller=require(_0x6c59('0x6'));router[_0x6c59('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6c59('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6c59('0x8')]);router[_0x6c59('0x7')](_0x6c59('0x9'),auth[_0x6c59('0xa')](),controller[_0x6c59('0xb')]);router['post']('/',auth[_0x6c59('0xa')](),controller['create']);router[_0x6c59('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x6c59('0xd')]);router[_0x6c59('0xe')](_0x6c59('0x9'),auth[_0x6c59('0xa')](),controller[_0x6c59('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3af1ed2..0831314 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 _0x60c2=['../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x473e0b,_0x2a2b26){var _0x4e68bb=function(_0x95d2a1){while(--_0x95d2a1){_0x473e0b['push'](_0x473e0b['shift']());}};_0x4e68bb(++_0x2a2b26);}(_0x60c2,0x8f));var _0x260c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x60c2[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x260c('0x0'));var path=require(_0x260c('0x1'));var timeout=require(_0x260c('0x2'));var express=require(_0x260c('0x3'));var router=express[_0x260c('0x4')]();var auth=require(_0x260c('0x5'));var interaction=require(_0x260c('0x6'));var config=require(_0x260c('0x7'));var controller=require(_0x260c('0x8'));router[_0x260c('0x9')]('/',auth[_0x260c('0xa')](),controller[_0x260c('0xb')]);router['get'](_0x260c('0xc'),auth[_0x260c('0xa')](),controller[_0x260c('0xd')]);router[_0x260c('0x9')]('/:id/configurations',auth[_0x260c('0xa')](),controller[_0x260c('0xe')]);router[_0x260c('0x9')](_0x260c('0xf'),auth[_0x260c('0xa')](),controller[_0x260c('0x10')]);router[_0x260c('0x11')]('/',auth['isAuthenticated'](),controller[_0x260c('0x12')]);router[_0x260c('0x11')](_0x260c('0x13'),auth['isAuthenticated'](),controller[_0x260c('0x14')]);router[_0x260c('0x15')](_0x260c('0xc'),auth['isAuthenticated'](),controller[_0x260c('0x16')]);router[_0x260c('0x17')](_0x260c('0xc'),auth[_0x260c('0xa')](),controller[_0x260c('0x18')]);module['exports']=router; \ No newline at end of file +var _0xab86=['path','Router','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','update','destroy','exports','multer','util'];(function(_0x4217cb,_0x3a371d){var _0x325fca=function(_0x4096f7){while(--_0x4096f7){_0x4217cb['push'](_0x4217cb['shift']());}};_0x325fca(++_0x3a371d);}(_0xab86,0x13e));var _0x6ab8=function(_0x8fdfe3,_0x39c95c){_0x8fdfe3=_0x8fdfe3-0x0;var _0x9b768=_0xab86[_0x8fdfe3];return _0x9b768;};'use strict';var multer=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var path=require(_0x6ab8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ab8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ab8('0x4'));var config=require('../../config/environment');var controller=require(_0x6ab8('0x5'));router[_0x6ab8('0x6')]('/',auth[_0x6ab8('0x7')](),controller[_0x6ab8('0x8')]);router[_0x6ab8('0x6')](_0x6ab8('0x9'),auth[_0x6ab8('0x7')](),controller[_0x6ab8('0xa')]);router[_0x6ab8('0x6')](_0x6ab8('0xb'),auth[_0x6ab8('0x7')](),controller[_0x6ab8('0xc')]);router[_0x6ab8('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6ab8('0xd')]);router['post']('/',auth[_0x6ab8('0x7')](),controller[_0x6ab8('0xe')]);router[_0x6ab8('0xf')]('/:id/configurations',auth[_0x6ab8('0x7')](),controller[_0x6ab8('0x10')]);router['put'](_0x6ab8('0x9'),auth[_0x6ab8('0x7')](),controller[_0x6ab8('0x11')]);router['delete'](_0x6ab8('0x9'),auth[_0x6ab8('0x7')](),controller[_0x6ab8('0x12')]);module[_0x6ab8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8cd1798..13d6bc6 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 _0xb32d=['integrationTab','newTab','sequelize','STRING','ENUM','basic'];(function(_0x47fd0f,_0x264551){var _0x6d6f9c=function(_0x455311){while(--_0x455311){_0x47fd0f['push'](_0x47fd0f['shift']());}};_0x6d6f9c(++_0x264551);}(_0xb32d,0xc2));var _0xdb32=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0xb32d[_0x2e3dfc];return _0x4b1245;};'use strict';var Sequelize=require(_0xdb32('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb32('0x1')]},'description':{'type':Sequelize[_0xdb32('0x1')]},'username':{'type':Sequelize[_0xdb32('0x1')]},'remoteUri':{'type':Sequelize[_0xdb32('0x1')]},'authType':{'type':Sequelize[_0xdb32('0x2')](_0xdb32('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xdb32('0x1')]},'consumerSecret':{'type':Sequelize[_0xdb32('0x1')]},'token':{'type':Sequelize[_0xdb32('0x1')]},'tokenSecret':{'type':Sequelize[_0xdb32('0x1')]},'serverUrl':{'type':Sequelize[_0xdb32('0x1')]},'type':{'type':Sequelize[_0xdb32('0x2')](_0xdb32('0x4'),_0xdb32('0x5')),'defaultValue':_0xdb32('0x4')}}; \ No newline at end of file +var _0x6767=['sequelize','exports','STRING','basic','newTab','integrationTab'];(function(_0x352039,_0x270e6f){var _0x3c97c9=function(_0x2eee5f){while(--_0x2eee5f){_0x352039['push'](_0x352039['shift']());}};_0x3c97c9(++_0x270e6f);}(_0x6767,0x1e6));var _0x7676=function(_0x4a89ce,_0x409c55){_0x4a89ce=_0x4a89ce-0x0;var _0x2f3ac0=_0x6767[_0x4a89ce];return _0x2f3ac0;};'use strict';var Sequelize=require(_0x7676('0x0'));module[_0x7676('0x1')]={'name':{'type':Sequelize[_0x7676('0x2')]},'description':{'type':Sequelize[_0x7676('0x2')]},'username':{'type':Sequelize[_0x7676('0x2')]},'remoteUri':{'type':Sequelize[_0x7676('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x7676('0x3')),'defaultValue':_0x7676('0x3')},'password':{'type':Sequelize[_0x7676('0x2')]},'consumerKey':{'type':Sequelize[_0x7676('0x2')]},'consumerSecret':{'type':Sequelize[_0x7676('0x2')]},'token':{'type':Sequelize[_0x7676('0x2')]},'tokenSecret':{'type':Sequelize[_0x7676('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('integrationTab',_0x7676('0x4')),'defaultValue':_0x7676('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 5cf2982..70956dd 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 _0x0471=['count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','merge','filter','options','where','includeAll','findAll','rows','params','include','create','body','find','getConfigurations','findOne','DeskConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','priority','remoteUri','authType','username','password','token','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','entries','active','label','test','getFields','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0471,0x145));var _0x1047=function(_0x25de1c,_0x23978f){_0x25de1c=_0x25de1c-0x0;var _0x3170f0=_0x0471[_0x25de1c];return _0x3170f0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1047('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1047('0x1'));var rp=require(_0x1047('0x2'));var moment=require(_0x1047('0x3'));var BPromise=require(_0x1047('0x4'));var Mustache=require(_0x1047('0x5'));var util=require(_0x1047('0x6'));var path=require(_0x1047('0x7'));var sox=require(_0x1047('0x8'));var csv=require('to-csv');var ejs=require(_0x1047('0x9'));var fs=require('fs');var _=require(_0x1047('0xa'));var squel=require(_0x1047('0xb'));var crypto=require(_0x1047('0xc'));var jsforce=require(_0x1047('0xd'));var deskjs=require(_0x1047('0xe'));var toCsv=require(_0x1047('0xf'));var querystring=require('querystring');var Papa=require(_0x1047('0x10'));var Redis=require('ioredis');var authService=require(_0x1047('0x11'));var qs=require(_0x1047('0x12'));var as=require(_0x1047('0x13'));var hardwareService=require(_0x1047('0x14'));var logger=require(_0x1047('0x15'))(_0x1047('0x16'));var utils=require('../../config/utils');var config=require(_0x1047('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1047('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x1047('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x354264,_0x11a724,_0x113fab){if(_0x113fab){var _0x3fdbd7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fdbd7['test'](_0x11a724)){return _0x354264;}else{throw new db['Sequelize'][(_0x1047('0x1a'))](_0x1047('0x1b'));}}else{return _0x354264;}}function respondWithRpcPromise(_0x17d3be,_0x53d4bf,_0x5556d1,_0x298011){return new BPromise(function(_0x2fa4f6,_0x59507b){var _0x3ac7d3=_0x298011||client;return _0x3ac7d3[_0x1047('0x1c')](_0x17d3be,_0x5556d1)[_0x1047('0x1d')](function(_0x337f01){logger[_0x1047('0x1e')](_0x1047('0x1f'),_0x53d4bf,'request\x20sent');logger[_0x1047('0x20')](_0x1047('0x21'),_0x53d4bf,'request\x20sent',JSON[_0x1047('0x22')](_0x337f01));if(_0x337f01[_0x1047('0x23')]){if(_0x337f01['error']['code']===0x1f4){logger[_0x1047('0x23')](_0x1047('0x1f'),_0x53d4bf,_0x337f01['error']['message']);return _0x59507b(_0x337f01[_0x1047('0x23')][_0x1047('0x24')]);}logger[_0x1047('0x23')]('DeskAccount,\x20%s,\x20%s',_0x53d4bf,_0x337f01[_0x1047('0x23')][_0x1047('0x24')]);return _0x2fa4f6(_0x337f01[_0x1047('0x23')][_0x1047('0x24')]);}else{logger['info'](_0x1047('0x1f'),_0x53d4bf,_0x1047('0x25'));_0x2fa4f6(_0x337f01[_0x1047('0x26')][_0x1047('0x24')]);}})[_0x1047('0x27')](function(_0x31f4c9){logger[_0x1047('0x23')](_0x1047('0x1f'),_0x53d4bf,_0x31f4c9);_0x59507b(_0x31f4c9);});});}function respondWithStatusCode(_0x4a11a0,_0x32a013){_0x32a013=_0x32a013||0xcc;return function(_0x5911e1){if(_0x5911e1){return _0x4a11a0[_0x1047('0x28')](_0x32a013);}return _0x4a11a0[_0x1047('0x29')](_0x32a013)[_0x1047('0x2a')]();};}function respondWithResult(_0x41cb7b,_0x18854f){_0x18854f=_0x18854f||0xc8;return function(_0x35be73){if(_0x35be73){return _0x41cb7b[_0x1047('0x29')](_0x18854f)[_0x1047('0x2b')](_0x35be73);}};}function respondWithFilteredResult(_0x4f397f,_0x1a65dd){return function(_0x1c2c4f){if(_0x1c2c4f){var _0x36e245=_0x1c2c4f[_0x1047('0x2c')],_0x9881c0=_0x1a65dd[_0x1047('0x2d')],_0x53646e=_0x1a65dd[_0x1047('0x2d')]+_0x1a65dd[_0x1047('0x2e')],_0x269d72;if(_0x53646e>=_0x36e245){_0x53646e=_0x36e245;_0x269d72=0xc8;}else{_0x269d72=0xce;}_0x4f397f[_0x1047('0x29')](_0x269d72);return _0x4f397f[_0x1047('0x2f')](_0x1047('0x30'),_0x9881c0+'-'+_0x53646e+'/'+_0x36e245)[_0x1047('0x2b')](_0x1c2c4f);}return null;};}function patchUpdates(_0x10d5cc){return function(_0x5aaa96){try{jsonpatch[_0x1047('0x31')](_0x5aaa96,_0x10d5cc,!![]);}catch(_0x4f01ba){return BPromise['reject'](_0x4f01ba);}return _0x5aaa96[_0x1047('0x32')]();};}function saveUpdates(_0x80cf4c,_0x449884){return function(_0x332df0){if(_0x332df0){return _0x332df0[_0x1047('0x33')](_0x80cf4c)['then'](function(_0x9c4f4f){return _0x9c4f4f;});}return null;};}function removeEntity(_0x5517f0,_0x330f65){return function(_0x5233cf){if(_0x5233cf){return _0x5233cf[_0x1047('0x34')]()[_0x1047('0x1d')](function(){_0x5517f0[_0x1047('0x29')](0xcc)[_0x1047('0x2a')]();});}};}function handleEntityNotFound(_0x4a3e5d,_0x3502a6){return function(_0x4af919){if(!_0x4af919){_0x4a3e5d['sendStatus'](0x194);}return _0x4af919;};}function handleError(_0x46a197,_0x524cf5){_0x524cf5=_0x524cf5||0x1f4;return function(_0x41c84f){logger[_0x1047('0x23')](_0x41c84f[_0x1047('0x35')]);if(_0x41c84f[_0x1047('0x36')]){delete _0x41c84f[_0x1047('0x36')];}_0x46a197['status'](_0x524cf5)['send'](_0x41c84f);};}exports['index']=function(_0x5aa541,_0x1945ce){var _0x2a6310={},_0x1fc1f6={},_0x15f8c3={'count':0x0,'rows':[]};var _0x146e0f=_[_0x1047('0x37')](db[_0x1047('0x38')][_0x1047('0x39')],function(_0x3d8964){return{'name':_0x3d8964[_0x1047('0x3a')],'type':_0x3d8964[_0x1047('0x3b')][_0x1047('0x3c')]};});_0x1fc1f6[_0x1047('0x3d')]=_['map'](_0x146e0f,'name');_0x1fc1f6[_0x1047('0x3e')]=_[_0x1047('0x3f')](_0x5aa541[_0x1047('0x3e')]);_0x1fc1f6[_0x1047('0x40')]=_[_0x1047('0x41')](_0x1fc1f6['model'],_0x1fc1f6[_0x1047('0x3e')]);_0x2a6310['attributes']=_[_0x1047('0x41')](_0x1fc1f6[_0x1047('0x3d')],qs[_0x1047('0x42')](_0x5aa541['query'][_0x1047('0x42')]));_0x2a6310['attributes']=_0x2a6310[_0x1047('0x43')][_0x1047('0x44')]?_0x2a6310[_0x1047('0x43')]:_0x1fc1f6[_0x1047('0x3d')];if(!_0x5aa541[_0x1047('0x3e')][_0x1047('0x45')](_0x1047('0x46'))){_0x2a6310[_0x1047('0x2e')]=qs['limit'](_0x5aa541['query'][_0x1047('0x2e')]);_0x2a6310['offset']=qs['offset'](_0x5aa541[_0x1047('0x3e')][_0x1047('0x2d')]);}_0x2a6310[_0x1047('0x47')]=qs['sort'](_0x5aa541[_0x1047('0x3e')]['sort']);_0x2a6310['where']=qs[_0x1047('0x40')](_[_0x1047('0x48')](_0x5aa541[_0x1047('0x3e')],_0x1fc1f6[_0x1047('0x40')]),_0x146e0f);if(_0x5aa541['query']['filter']){_0x2a6310['where']=_[_0x1047('0x49')](_0x2a6310['where'],{'$or':_['map'](_0x146e0f,function(_0x2d9456){if(_0x2d9456[_0x1047('0x3b')]!=='VIRTUAL'){var _0x3d8ac8={};_0x3d8ac8[_0x2d9456[_0x1047('0x36')]]={'$like':'%'+_0x5aa541[_0x1047('0x3e')][_0x1047('0x4a')]+'%'};return _0x3d8ac8;}})});}_0x2a6310=_[_0x1047('0x49')]({},_0x2a6310,_0x5aa541[_0x1047('0x4b')]);var _0x21249a={'where':_0x2a6310[_0x1047('0x4c')]};return db['DeskAccount'][_0x1047('0x2c')](_0x21249a)['then'](function(_0x138f88){_0x15f8c3[_0x1047('0x2c')]=_0x138f88;if(_0x5aa541[_0x1047('0x3e')][_0x1047('0x4d')]){_0x2a6310['include']=[{'all':!![]}];}return db[_0x1047('0x38')][_0x1047('0x4e')](_0x2a6310);})[_0x1047('0x1d')](function(_0x58fe53){_0x15f8c3[_0x1047('0x4f')]=_0x58fe53;return _0x15f8c3;})[_0x1047('0x1d')](respondWithFilteredResult(_0x1945ce,_0x2a6310))[_0x1047('0x27')](handleError(_0x1945ce,null));};exports['show']=function(_0x88f27a,_0x179708){var _0x2f80d5={'raw':![],'where':{'id':_0x88f27a[_0x1047('0x50')]['id']}},_0x2c23e4={};_0x2c23e4[_0x1047('0x3d')]=_[_0x1047('0x3f')](db[_0x1047('0x38')]['rawAttributes']);_0x2c23e4[_0x1047('0x3e')]=_['keys'](_0x88f27a[_0x1047('0x3e')]);_0x2c23e4['filters']=_[_0x1047('0x41')](_0x2c23e4[_0x1047('0x3d')],_0x2c23e4[_0x1047('0x3e')]);_0x2f80d5[_0x1047('0x43')]=_[_0x1047('0x41')](_0x2c23e4[_0x1047('0x3d')],qs[_0x1047('0x42')](_0x88f27a['query'][_0x1047('0x42')]));_0x2f80d5[_0x1047('0x43')]=_0x2f80d5[_0x1047('0x43')][_0x1047('0x44')]?_0x2f80d5[_0x1047('0x43')]:_0x2c23e4['model'];if(_0x88f27a['query'][_0x1047('0x4d')]){_0x2f80d5[_0x1047('0x51')]=[{'all':!![]}];}_0x2f80d5=_[_0x1047('0x49')]({},_0x2f80d5,_0x88f27a['options']);return db['DeskAccount']['find'](_0x2f80d5)[_0x1047('0x1d')](handleEntityNotFound(_0x179708,null))[_0x1047('0x1d')](respondWithResult(_0x179708,null))[_0x1047('0x27')](handleError(_0x179708,null));};exports[_0x1047('0x52')]=function(_0x3631f8,_0x453087){return db[_0x1047('0x38')][_0x1047('0x52')](_0x3631f8[_0x1047('0x53')],{})[_0x1047('0x1d')](respondWithResult(_0x453087,0xc9))['catch'](handleError(_0x453087,null));};exports[_0x1047('0x33')]=function(_0x5dcc77,_0x39aefd){if(_0x5dcc77['body']['id']){delete _0x5dcc77[_0x1047('0x53')]['id'];}return db[_0x1047('0x38')][_0x1047('0x54')]({'where':{'id':_0x5dcc77['params']['id']}})['then'](handleEntityNotFound(_0x39aefd,null))[_0x1047('0x1d')](saveUpdates(_0x5dcc77['body'],null))[_0x1047('0x1d')](respondWithResult(_0x39aefd,null))['catch'](handleError(_0x39aefd,null));};exports[_0x1047('0x34')]=function(_0x3a3df9,_0x5a8893){return db['DeskAccount']['find']({'where':{'id':_0x3a3df9[_0x1047('0x50')]['id']}})[_0x1047('0x1d')](handleEntityNotFound(_0x5a8893,null))[_0x1047('0x1d')](removeEntity(_0x5a8893,null))[_0x1047('0x27')](handleError(_0x5a8893,null));};exports[_0x1047('0x55')]=function(_0x5dea3e,_0x46c6e1,_0x579a63){var _0x2907ec={};var _0x3da49c={};var _0x173075;var _0x3dd765;return db['DeskAccount'][_0x1047('0x56')]({'where':{'id':_0x5dea3e['params']['id']}})[_0x1047('0x1d')](handleEntityNotFound(_0x46c6e1,null))[_0x1047('0x1d')](function(_0xba2a72){if(_0xba2a72){_0x173075=_0xba2a72;_0x3da49c[_0x1047('0x3d')]=_[_0x1047('0x3f')](db[_0x1047('0x57')][_0x1047('0x39')]);_0x3da49c[_0x1047('0x3e')]=_[_0x1047('0x3f')](_0x5dea3e[_0x1047('0x3e')]);_0x3da49c[_0x1047('0x40')]=_[_0x1047('0x41')](_0x3da49c[_0x1047('0x3d')],_0x3da49c[_0x1047('0x3e')]);_0x2907ec[_0x1047('0x43')]=_['intersection'](_0x3da49c[_0x1047('0x3d')],qs[_0x1047('0x42')](_0x5dea3e[_0x1047('0x3e')][_0x1047('0x42')]));_0x2907ec[_0x1047('0x43')]=_0x2907ec[_0x1047('0x43')]['length']?_0x2907ec[_0x1047('0x43')]:_0x3da49c[_0x1047('0x3d')];_0x2907ec['order']=qs[_0x1047('0x58')](_0x5dea3e[_0x1047('0x3e')][_0x1047('0x58')]);_0x2907ec[_0x1047('0x4c')]=qs[_0x1047('0x40')](_[_0x1047('0x48')](_0x5dea3e[_0x1047('0x3e')],_0x3da49c[_0x1047('0x40')]));if(_0x5dea3e[_0x1047('0x3e')][_0x1047('0x4a')]){_0x2907ec['where']=_[_0x1047('0x49')](_0x2907ec[_0x1047('0x4c')],{'$or':_['map'](_0x2907ec[_0x1047('0x43')],function(_0x12f8eb){var _0x228b50={};_0x228b50[_0x12f8eb]={'$like':'%'+_0x5dea3e[_0x1047('0x3e')][_0x1047('0x4a')]+'%'};return _0x228b50;})});}_0x2907ec=_[_0x1047('0x49')]({},_0x2907ec,_0x5dea3e[_0x1047('0x4b')]);return _0x173075['getConfigurations'](_0x2907ec);}})[_0x1047('0x1d')](function(_0x5cea27){if(_0x5cea27){_0x3dd765=_0x5cea27[_0x1047('0x44')];if(!_0x5dea3e[_0x1047('0x3e')][_0x1047('0x45')](_0x1047('0x46'))){_0x2907ec['limit']=qs[_0x1047('0x2e')](_0x5dea3e[_0x1047('0x3e')][_0x1047('0x2e')]);_0x2907ec[_0x1047('0x2d')]=qs[_0x1047('0x2d')](_0x5dea3e[_0x1047('0x3e')][_0x1047('0x2d')]);}return _0x173075[_0x1047('0x55')](_0x2907ec);}})[_0x1047('0x1d')](function(_0x437e3a){if(_0x437e3a){return _0x437e3a?{'count':_0x3dd765,'rows':_0x437e3a}:null;}})[_0x1047('0x1d')](respondWithResult(_0x46c6e1,null))[_0x1047('0x27')](handleError(_0x46c6e1,null));};exports[_0x1047('0x59')]=function(_0x5a721a,_0x3c172b,_0x7afa44){if(_0x5a721a[_0x1047('0x53')]['id']){delete _0x5a721a[_0x1047('0x53')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x5a721a[_0x1047('0x50')]['id']}})[_0x1047('0x1d')](handleEntityNotFound(_0x3c172b,null))[_0x1047('0x1d')](function(_0x2e340e){if(_0x2e340e){_0x5a721a['body'][_0x1047('0x5a')]=_0x2e340e['id'];_0x5a721a['body'][_0x1047('0x5b')]=integrations[_0x1047('0x5c')](_0x5a721a['body']['channel'],_0x5a721a[_0x1047('0x53')][_0x1047('0x3b')]);_0x5a721a['body'][_0x1047('0x5d')]=integrations[_0x1047('0x5e')](_0x5a721a[_0x1047('0x53')][_0x1047('0x5f')],_0x5a721a[_0x1047('0x53')][_0x1047('0x3b')]);return db[_0x1047('0x57')][_0x1047('0x52')](_0x5a721a['body'],{'include':[{'model':db[_0x1047('0x60')],'as':_0x1047('0x5b')},{'model':db[_0x1047('0x60')],'as':_0x1047('0x5d')}]});}return null;})['then'](respondWithResult(_0x3c172b,null))[_0x1047('0x27')](handleError(_0x3c172b,null));};exports['getFields']=function(_0xcbba60,_0x44574b,_0x1e73da){var _0x255982=[{'name':'priority','label':_0x1047('0x61'),'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 _0x4d2999='';return db[_0x1047('0x38')]['findOne']({'where':{'id':_0xcbba60['params']['id']},'attributes':['id',_0x1047('0x62'),_0x1047('0x63'),_0x1047('0x64'),_0x1047('0x65'),'consumerKey','consumerSecret',_0x1047('0x66'),'tokenSecret']})[_0x1047('0x1d')](handleEntityNotFound(_0x44574b,null))[_0x1047('0x1d')](function(_0x54b2c2){if(_0x54b2c2){_0x4d2999=_0x54b2c2[_0x1047('0x62')];var _0x29ee08=_0x4d2999['slice'](-0x1);if(_0x29ee08==='/'){_0x4d2999=_0x4d2999[_0x1047('0x67')](0x0,_0x4d2999[_0x1047('0x68')](_0x29ee08));}var _0x11f07f={'method':_0x1047('0x69'),'uri':util[_0x1047('0x6a')](_0x1047('0x6b'),_0x4d2999),'headers':{'Content-Type':_0x1047('0x6c'),'Accept':'application/json'},'json':!![]};if(_0x54b2c2[_0x1047('0x63')]===_0x1047('0x6d')){_0x11f07f[_0x1047('0x6e')][_0x1047('0x6f')]=util[_0x1047('0x6a')](_0x1047('0x70'),new Buffer(util['format'](_0x1047('0x71'),_0x54b2c2[_0x1047('0x64')],_0x54b2c2[_0x1047('0x65')]))[_0x1047('0x72')]('base64'));}return rp(_0x11f07f)[_0x1047('0x1d')](function(_0x1cc892){return _0x255982[_0x1047('0x73')](_[_0x1047('0x37')](_0x1cc892['_embedded'][_0x1047('0x74')],function(_0x326908){return{'id':_0x326908[_0x1047('0x36')],'name':_0x326908['name'],'type':_0x326908[_0x1047('0x3b')],'active':_0x326908[_0x1047('0x75')],'label':_0x326908[_0x1047('0x76')],'custom':!![]};}));});}})[_0x1047('0x1d')](function(_0x593e00){return{'count':_0x593e00[_0x1047('0x44')],'rows':_0x593e00};})[_0x1047('0x1d')](respondWithResult(_0x44574b,null))['catch'](function(_0xd64c0d){var _0x1ac7e3=_0xcbba60[_0x1047('0x3e')][_0x1047('0x77')]?0x1f4:_0xd64c0d['statusCode']||0x1f4;logger[_0x1047('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x1047('0x78'),_0x1ac7e3,JSON[_0x1047('0x22')](_0xd64c0d));delete _0xd64c0d[_0x1047('0x36')];if(_0x1ac7e3===0x191){_0x1ac7e3=0x190;}_0x44574b[_0x1047('0x29')](_0x1ac7e3)[_0x1047('0x79')](_0xcbba60[_0x1047('0x3e')][_0x1047('0x77')]?{'message':_0x1047('0x7a'),'statusCode':_0xd64c0d['statusCode']}:_0xd64c0d);});}; \ No newline at end of file +var _0x3319=['end','stack','name','send','DeskAccount','type','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','rawAttributes','find','body','getConfigurations','DeskConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','_embedded','entries','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','DeskAccount,\x20%s,\x20%s','message','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3319,0xc6));var _0x9331=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3319[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x9331('0x0'));var emlformat=require(_0x9331('0x1'));var rimraf=require(_0x9331('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9331('0x3'));var rp=require('request-promise');var moment=require(_0x9331('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9331('0x5'));var util=require(_0x9331('0x6'));var path=require(_0x9331('0x7'));var sox=require(_0x9331('0x8'));var csv=require('to-csv');var ejs=require(_0x9331('0x9'));var fs=require('fs');var _=require(_0x9331('0xa'));var squel=require(_0x9331('0xb'));var crypto=require(_0x9331('0xc'));var jsforce=require(_0x9331('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9331('0xe'));var querystring=require(_0x9331('0xf'));var Papa=require(_0x9331('0x10'));var Redis=require(_0x9331('0x11'));var authService=require(_0x9331('0x12'));var qs=require(_0x9331('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9331('0x14'));var logger=require('../../config/logger')(_0x9331('0x15'));var utils=require(_0x9331('0x16'));var config=require(_0x9331('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9331('0x18'));var jayson=require(_0x9331('0x19'));var client=jayson[_0x9331('0x1a')][_0x9331('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x80c99b,_0x593910,_0x3fe4a9){if(_0x3fe4a9){var _0x1ed602=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ed602[_0x9331('0x1c')](_0x593910)){return _0x80c99b;}else{throw new db[(_0x9331('0x1d'))][(_0x9331('0x1e'))](_0x9331('0x1f'));}}else{return _0x80c99b;}}function respondWithRpcPromise(_0x371007,_0x4e0a52,_0x122b67,_0xf49acf){return new BPromise(function(_0x454335,_0x1d7833){var _0x43b54b=_0xf49acf||client;return _0x43b54b[_0x9331('0x20')](_0x371007,_0x122b67)[_0x9331('0x21')](function(_0x4a98dc){logger[_0x9331('0x22')]('DeskAccount,\x20%s,\x20%s',_0x4e0a52,_0x9331('0x23'));logger[_0x9331('0x24')](_0x9331('0x25'),_0x4e0a52,'request\x20sent',JSON[_0x9331('0x26')](_0x4a98dc));if(_0x4a98dc['error']){if(_0x4a98dc['error'][_0x9331('0x27')]===0x1f4){logger[_0x9331('0x28')](_0x9331('0x29'),_0x4e0a52,_0x4a98dc['error']['message']);return _0x1d7833(_0x4a98dc['error']['message']);}logger[_0x9331('0x28')](_0x9331('0x29'),_0x4e0a52,_0x4a98dc[_0x9331('0x28')][_0x9331('0x2a')]);return _0x454335(_0x4a98dc[_0x9331('0x28')][_0x9331('0x2a')]);}else{logger[_0x9331('0x22')](_0x9331('0x29'),_0x4e0a52,_0x9331('0x23'));_0x454335(_0x4a98dc['result'][_0x9331('0x2a')]);}})['catch'](function(_0x1ab870){logger['error'](_0x9331('0x29'),_0x4e0a52,_0x1ab870);_0x1d7833(_0x1ab870);});});}function respondWithStatusCode(_0x1c8d15,_0x4f84ca){_0x4f84ca=_0x4f84ca||0xcc;return function(_0x1483c1){if(_0x1483c1){return _0x1c8d15[_0x9331('0x2b')](_0x4f84ca);}return _0x1c8d15['status'](_0x4f84ca)['end']();};}function respondWithResult(_0x34cd36,_0x221644){_0x221644=_0x221644||0xc8;return function(_0x4f4eee){if(_0x4f4eee){return _0x34cd36[_0x9331('0x2c')](_0x221644)[_0x9331('0x2d')](_0x4f4eee);}};}function respondWithFilteredResult(_0x371fea,_0x1be1bf){return function(_0x2ee872){if(_0x2ee872){var _0x295464=_0x2ee872['count'],_0xd30224=_0x1be1bf[_0x9331('0x2e')],_0x3a6c20=_0x1be1bf[_0x9331('0x2e')]+_0x1be1bf['limit'],_0x24a298;if(_0x3a6c20>=_0x295464){_0x3a6c20=_0x295464;_0x24a298=0xc8;}else{_0x24a298=0xce;}_0x371fea[_0x9331('0x2c')](_0x24a298);return _0x371fea[_0x9331('0x2f')](_0x9331('0x30'),_0xd30224+'-'+_0x3a6c20+'/'+_0x295464)['json'](_0x2ee872);}return null;};}function patchUpdates(_0x35b7fc){return function(_0x45727d){try{jsonpatch[_0x9331('0x31')](_0x45727d,_0x35b7fc,!![]);}catch(_0x157767){return BPromise[_0x9331('0x32')](_0x157767);}return _0x45727d[_0x9331('0x33')]();};}function saveUpdates(_0x56d2ba,_0x3f7e41){return function(_0x11e73a){if(_0x11e73a){return _0x11e73a[_0x9331('0x34')](_0x56d2ba)[_0x9331('0x21')](function(_0x2012e9){return _0x2012e9;});}return null;};}function removeEntity(_0x92809d,_0x7a4a28){return function(_0x17b4a0){if(_0x17b4a0){return _0x17b4a0[_0x9331('0x35')]()[_0x9331('0x21')](function(){_0x92809d[_0x9331('0x2c')](0xcc)[_0x9331('0x36')]();});}};}function handleEntityNotFound(_0x51b02d,_0x5245bf){return function(_0x3cdb54){if(!_0x3cdb54){_0x51b02d[_0x9331('0x2b')](0x194);}return _0x3cdb54;};}function handleError(_0x590298,_0x3e8b78){_0x3e8b78=_0x3e8b78||0x1f4;return function(_0x2ac291){logger[_0x9331('0x28')](_0x2ac291[_0x9331('0x37')]);if(_0x2ac291[_0x9331('0x38')]){delete _0x2ac291[_0x9331('0x38')];}_0x590298['status'](_0x3e8b78)[_0x9331('0x39')](_0x2ac291);};}exports['index']=function(_0x1bf8da,_0x1f5cfe){var _0x517bc2={},_0x1e53aa={},_0x27b532={'count':0x0,'rows':[]};var _0x45053b=_['map'](db[_0x9331('0x3a')]['rawAttributes'],function(_0x223702){return{'name':_0x223702['fieldName'],'type':_0x223702[_0x9331('0x3b')][_0x9331('0x3c')]};});_0x1e53aa['model']=_[_0x9331('0x3d')](_0x45053b,_0x9331('0x38'));_0x1e53aa[_0x9331('0x3e')]=_[_0x9331('0x3f')](_0x1bf8da[_0x9331('0x3e')]);_0x1e53aa['filters']=_[_0x9331('0x40')](_0x1e53aa['model'],_0x1e53aa[_0x9331('0x3e')]);_0x517bc2[_0x9331('0x41')]=_['intersection'](_0x1e53aa[_0x9331('0x42')],qs[_0x9331('0x43')](_0x1bf8da[_0x9331('0x3e')][_0x9331('0x43')]));_0x517bc2[_0x9331('0x41')]=_0x517bc2['attributes'][_0x9331('0x44')]?_0x517bc2[_0x9331('0x41')]:_0x1e53aa[_0x9331('0x42')];if(!_0x1bf8da[_0x9331('0x3e')][_0x9331('0x45')](_0x9331('0x46'))){_0x517bc2[_0x9331('0x47')]=qs[_0x9331('0x47')](_0x1bf8da[_0x9331('0x3e')][_0x9331('0x47')]);_0x517bc2['offset']=qs[_0x9331('0x2e')](_0x1bf8da['query'][_0x9331('0x2e')]);}_0x517bc2[_0x9331('0x48')]=qs['sort'](_0x1bf8da[_0x9331('0x3e')][_0x9331('0x49')]);_0x517bc2['where']=qs['filters'](_[_0x9331('0x4a')](_0x1bf8da[_0x9331('0x3e')],_0x1e53aa[_0x9331('0x4b')]),_0x45053b);if(_0x1bf8da[_0x9331('0x3e')][_0x9331('0x4c')]){_0x517bc2[_0x9331('0x4d')]=_[_0x9331('0x4e')](_0x517bc2[_0x9331('0x4d')],{'$or':_['map'](_0x45053b,function(_0x510f59){if(_0x510f59[_0x9331('0x3b')]!==_0x9331('0x4f')){var _0x50c73a={};_0x50c73a[_0x510f59[_0x9331('0x38')]]={'$like':'%'+_0x1bf8da[_0x9331('0x3e')]['filter']+'%'};return _0x50c73a;}})});}_0x517bc2=_[_0x9331('0x4e')]({},_0x517bc2,_0x1bf8da[_0x9331('0x50')]);var _0x564104={'where':_0x517bc2[_0x9331('0x4d')]};return db[_0x9331('0x3a')][_0x9331('0x51')](_0x564104)[_0x9331('0x21')](function(_0x2cc48c){_0x27b532[_0x9331('0x51')]=_0x2cc48c;if(_0x1bf8da['query'][_0x9331('0x52')]){_0x517bc2[_0x9331('0x53')]=[{'all':!![]}];}return db[_0x9331('0x3a')]['findAll'](_0x517bc2);})[_0x9331('0x21')](function(_0x5a2589){_0x27b532[_0x9331('0x54')]=_0x5a2589;return _0x27b532;})[_0x9331('0x21')](respondWithFilteredResult(_0x1f5cfe,_0x517bc2))[_0x9331('0x55')](handleError(_0x1f5cfe,null));};exports['show']=function(_0x716ef2,_0x17df61){var _0x2b18ea={'raw':![],'where':{'id':_0x716ef2[_0x9331('0x56')]['id']}},_0x12c4cc={};_0x12c4cc['model']=_[_0x9331('0x3f')](db['DeskAccount'][_0x9331('0x57')]);_0x12c4cc[_0x9331('0x3e')]=_[_0x9331('0x3f')](_0x716ef2['query']);_0x12c4cc['filters']=_[_0x9331('0x40')](_0x12c4cc[_0x9331('0x42')],_0x12c4cc['query']);_0x2b18ea['attributes']=_[_0x9331('0x40')](_0x12c4cc['model'],qs[_0x9331('0x43')](_0x716ef2[_0x9331('0x3e')][_0x9331('0x43')]));_0x2b18ea[_0x9331('0x41')]=_0x2b18ea[_0x9331('0x41')]['length']?_0x2b18ea[_0x9331('0x41')]:_0x12c4cc[_0x9331('0x42')];if(_0x716ef2[_0x9331('0x3e')][_0x9331('0x52')]){_0x2b18ea[_0x9331('0x53')]=[{'all':!![]}];}_0x2b18ea=_[_0x9331('0x4e')]({},_0x2b18ea,_0x716ef2[_0x9331('0x50')]);return db[_0x9331('0x3a')][_0x9331('0x58')](_0x2b18ea)[_0x9331('0x21')](handleEntityNotFound(_0x17df61,null))[_0x9331('0x21')](respondWithResult(_0x17df61,null))['catch'](handleError(_0x17df61,null));};exports['create']=function(_0x3e8ba1,_0x41f4ed){return db[_0x9331('0x3a')]['create'](_0x3e8ba1[_0x9331('0x59')],{})[_0x9331('0x21')](respondWithResult(_0x41f4ed,0xc9))[_0x9331('0x55')](handleError(_0x41f4ed,null));};exports[_0x9331('0x34')]=function(_0x3e5ccf,_0x23a011){if(_0x3e5ccf[_0x9331('0x59')]['id']){delete _0x3e5ccf[_0x9331('0x59')]['id'];}return db['DeskAccount'][_0x9331('0x58')]({'where':{'id':_0x3e5ccf[_0x9331('0x56')]['id']}})['then'](handleEntityNotFound(_0x23a011,null))[_0x9331('0x21')](saveUpdates(_0x3e5ccf[_0x9331('0x59')],null))['then'](respondWithResult(_0x23a011,null))[_0x9331('0x55')](handleError(_0x23a011,null));};exports[_0x9331('0x35')]=function(_0x29a36e,_0x55310a){return db[_0x9331('0x3a')][_0x9331('0x58')]({'where':{'id':_0x29a36e[_0x9331('0x56')]['id']}})[_0x9331('0x21')](handleEntityNotFound(_0x55310a,null))[_0x9331('0x21')](removeEntity(_0x55310a,null))[_0x9331('0x55')](handleError(_0x55310a,null));};exports[_0x9331('0x5a')]=function(_0x4a2efe,_0x1e7a77,_0x5c8e4b){var _0x4f2a2a={};var _0x2cecce={};var _0x12b3b9;var _0x2ce178;return db[_0x9331('0x3a')]['findOne']({'where':{'id':_0x4a2efe[_0x9331('0x56')]['id']}})[_0x9331('0x21')](handleEntityNotFound(_0x1e7a77,null))[_0x9331('0x21')](function(_0x36484c){if(_0x36484c){_0x12b3b9=_0x36484c;_0x2cecce[_0x9331('0x42')]=_[_0x9331('0x3f')](db[_0x9331('0x5b')][_0x9331('0x57')]);_0x2cecce[_0x9331('0x3e')]=_[_0x9331('0x3f')](_0x4a2efe[_0x9331('0x3e')]);_0x2cecce[_0x9331('0x4b')]=_['intersection'](_0x2cecce[_0x9331('0x42')],_0x2cecce['query']);_0x4f2a2a[_0x9331('0x41')]=_[_0x9331('0x40')](_0x2cecce[_0x9331('0x42')],qs['fields'](_0x4a2efe[_0x9331('0x3e')]['fields']));_0x4f2a2a['attributes']=_0x4f2a2a[_0x9331('0x41')][_0x9331('0x44')]?_0x4f2a2a[_0x9331('0x41')]:_0x2cecce['model'];_0x4f2a2a[_0x9331('0x48')]=qs[_0x9331('0x49')](_0x4a2efe[_0x9331('0x3e')]['sort']);_0x4f2a2a['where']=qs[_0x9331('0x4b')](_[_0x9331('0x4a')](_0x4a2efe[_0x9331('0x3e')],_0x2cecce[_0x9331('0x4b')]));if(_0x4a2efe[_0x9331('0x3e')]['filter']){_0x4f2a2a[_0x9331('0x4d')]=_[_0x9331('0x4e')](_0x4f2a2a[_0x9331('0x4d')],{'$or':_['map'](_0x4f2a2a[_0x9331('0x41')],function(_0x33efb0){var _0x125387={};_0x125387[_0x33efb0]={'$like':'%'+_0x4a2efe['query']['filter']+'%'};return _0x125387;})});}_0x4f2a2a=_['merge']({},_0x4f2a2a,_0x4a2efe[_0x9331('0x50')]);return _0x12b3b9[_0x9331('0x5a')](_0x4f2a2a);}})[_0x9331('0x21')](function(_0x178f15){if(_0x178f15){_0x2ce178=_0x178f15['length'];if(!_0x4a2efe['query'][_0x9331('0x45')]('nolimit')){_0x4f2a2a[_0x9331('0x47')]=qs[_0x9331('0x47')](_0x4a2efe[_0x9331('0x3e')][_0x9331('0x47')]);_0x4f2a2a[_0x9331('0x2e')]=qs[_0x9331('0x2e')](_0x4a2efe['query'][_0x9331('0x2e')]);}return _0x12b3b9[_0x9331('0x5a')](_0x4f2a2a);}})[_0x9331('0x21')](function(_0x40ec86){if(_0x40ec86){return _0x40ec86?{'count':_0x2ce178,'rows':_0x40ec86}:null;}})[_0x9331('0x21')](respondWithResult(_0x1e7a77,null))[_0x9331('0x55')](handleError(_0x1e7a77,null));};exports[_0x9331('0x5c')]=function(_0x134cf9,_0x2f4a6d,_0x45c7aa){if(_0x134cf9[_0x9331('0x59')]['id']){delete _0x134cf9['body']['id'];}return db[_0x9331('0x3a')][_0x9331('0x5d')]({'where':{'id':_0x134cf9[_0x9331('0x56')]['id']}})[_0x9331('0x21')](handleEntityNotFound(_0x2f4a6d,null))[_0x9331('0x21')](function(_0x40ffd7){if(_0x40ffd7){_0x134cf9[_0x9331('0x59')]['AccountId']=_0x40ffd7['id'];_0x134cf9[_0x9331('0x59')][_0x9331('0x5e')]=integrations[_0x9331('0x5f')](_0x134cf9[_0x9331('0x59')][_0x9331('0x60')],_0x134cf9['body'][_0x9331('0x3b')]);_0x134cf9[_0x9331('0x59')][_0x9331('0x61')]=integrations[_0x9331('0x62')](_0x134cf9[_0x9331('0x59')]['channel'],_0x134cf9[_0x9331('0x59')][_0x9331('0x3b')]);return db[_0x9331('0x5b')][_0x9331('0x63')](_0x134cf9['body'],{'include':[{'model':db[_0x9331('0x64')],'as':_0x9331('0x5e')},{'model':db[_0x9331('0x64')],'as':_0x9331('0x61')}]});}return null;})[_0x9331('0x21')](respondWithResult(_0x2f4a6d,null))[_0x9331('0x55')](handleError(_0x2f4a6d,null));};exports[_0x9331('0x65')]=function(_0x49b6ab,_0x3c41f7,_0x201bd3){var _0x936c5a=[{'name':_0x9331('0x66'),'label':_0x9331('0x66'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x583a5a='';return db[_0x9331('0x3a')][_0x9331('0x5d')]({'where':{'id':_0x49b6ab[_0x9331('0x56')]['id']},'attributes':['id',_0x9331('0x67'),_0x9331('0x68'),_0x9331('0x69'),_0x9331('0x6a'),_0x9331('0x6b'),'consumerSecret',_0x9331('0x6c'),_0x9331('0x6d')]})['then'](handleEntityNotFound(_0x3c41f7,null))[_0x9331('0x21')](function(_0x577411){if(_0x577411){_0x583a5a=_0x577411[_0x9331('0x67')];var _0x4a66ae=_0x583a5a['slice'](-0x1);if(_0x4a66ae==='/'){_0x583a5a=_0x583a5a[_0x9331('0x6e')](0x0,_0x583a5a[_0x9331('0x6f')](_0x4a66ae));}var _0x4cfdbc={'method':'GET','uri':util[_0x9331('0x70')](_0x9331('0x71'),_0x583a5a),'headers':{'Content-Type':_0x9331('0x72'),'Accept':_0x9331('0x72')},'json':!![]};if(_0x577411['authType']===_0x9331('0x73')){_0x4cfdbc[_0x9331('0x74')][_0x9331('0x75')]=util[_0x9331('0x70')](_0x9331('0x76'),new Buffer(util['format'](_0x9331('0x77'),_0x577411[_0x9331('0x69')],_0x577411[_0x9331('0x6a')]))['toString'](_0x9331('0x78')));}return rp(_0x4cfdbc)[_0x9331('0x21')](function(_0x3fbb14){return _0x936c5a['concat'](_['map'](_0x3fbb14[_0x9331('0x79')][_0x9331('0x7a')],function(_0x435043){return{'id':_0x435043[_0x9331('0x38')],'name':_0x435043[_0x9331('0x38')],'type':_0x435043['type'],'active':_0x435043['active'],'label':_0x435043['label'],'custom':!![]};}));});}})[_0x9331('0x21')](function(_0x3f9c18){return{'count':_0x3f9c18[_0x9331('0x44')],'rows':_0x3f9c18};})[_0x9331('0x21')](respondWithResult(_0x3c41f7,null))[_0x9331('0x55')](function(_0xfcc3bf){var _0x5b4bf2=_0x49b6ab[_0x9331('0x3e')]['test']?0x1f4:_0xfcc3bf[_0x9331('0x7b')]||0x1f4;logger[_0x9331('0x28')](_0x9331('0x7c'),'getFields',_0x5b4bf2,JSON[_0x9331('0x26')](_0xfcc3bf));delete _0xfcc3bf[_0x9331('0x38')];if(_0x5b4bf2===0x191){_0x5b4bf2=0x190;}_0x3c41f7[_0x9331('0x2c')](_0x5b4bf2)['send'](_0x49b6ab['query']['test']?{'message':_0x9331('0x7d'),'statusCode':_0xfcc3bf['statusCode']}:_0xfcc3bf);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 7257e90..85c83e7 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 _0x85b9=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x261db1,_0xb737fe){var _0xcb49fe=function(_0x26c78f){while(--_0x26c78f){_0x261db1['push'](_0x261db1['shift']());}};_0xcb49fe(++_0xb737fe);}(_0x85b9,0xc1));var _0x985b=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x85b9[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x985b('0x0'));var util=require(_0x985b('0x1'));var logger=require(_0x985b('0x2'))('api');var moment=require(_0x985b('0x3'));var BPromise=require(_0x985b('0x4'));var rp=require(_0x985b('0x5'));var fs=require('fs');var path=require(_0x985b('0x6'));var rimraf=require(_0x985b('0x7'));var config=require(_0x985b('0x8'));var attributes=require(_0x985b('0x9'));var integrations=require(_0x985b('0xa'));module[_0x985b('0xb')]=function(_0x53c76f,_0x2e7e33){return _0x53c76f[_0x985b('0xc')](_0x985b('0xd'),attributes,{'tableName':_0x985b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82a2=['define','DeskAccount','int_desk_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4360f0,_0x39d82c){var _0x12aeac=function(_0x2a0892){while(--_0x2a0892){_0x4360f0['push'](_0x4360f0['shift']());}};_0x12aeac(++_0x39d82c);}(_0x82a2,0x196));var _0x282a=function(_0x24126c,_0x17aa2f){_0x24126c=_0x24126c-0x0;var _0x53bcbd=_0x82a2[_0x24126c];return _0x53bcbd;};'use strict';var _=require(_0x282a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x282a('0x1'));var moment=require('moment');var BPromise=require(_0x282a('0x2'));var rp=require(_0x282a('0x3'));var fs=require('fs');var path=require(_0x282a('0x4'));var rimraf=require(_0x282a('0x5'));var config=require(_0x282a('0x6'));var attributes=require(_0x282a('0x7'));var integrations=require(_0x282a('0x8'));module[_0x282a('0x9')]=function(_0x5c0e85,_0x481047){return _0x5c0e85[_0x282a('0xa')](_0x282a('0xb'),attributes,{'tableName':_0x282a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 3754a96..c0b2252 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 _0x8de7=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','model','map','then','catch','find','where','ShowDeskAccount','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47a37b,_0x2ff605){var _0x2eee95=function(_0x2ed799){while(--_0x2ed799){_0x47a37b['push'](_0x47a37b['shift']());}};_0x2eee95(++_0x2ff605);}(_0x8de7,0x7a));var _0x78de=function(_0x377912,_0x4779d3){_0x377912=_0x377912-0x0;var _0x58f193=_0x8de7[_0x377912];return _0x58f193;};'use strict';var _=require(_0x78de('0x0'));var util=require('util');var moment=require(_0x78de('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78de('0x2'));var db=require(_0x78de('0x3'))['db'];var utils=require(_0x78de('0x4'));var logger=require('../../config/logger')(_0x78de('0x5'));var config=require(_0x78de('0x6'));var jayson=require(_0x78de('0x7'));var client=jayson[_0x78de('0x8')][_0x78de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ef3a,_0x49cda1,_0x5633eb){return new BPromise(function(_0xd75f2d,_0x378d30){return client['request'](_0x40ef3a,_0x5633eb)['then'](function(_0x98799d){logger[_0x78de('0xa')](_0x78de('0xb'),_0x49cda1,_0x78de('0xc'));logger[_0x78de('0xd')](_0x78de('0xe'),_0x49cda1,'request\x20sent',JSON[_0x78de('0xf')](_0x98799d));if(_0x98799d['error']){if(_0x98799d[_0x78de('0x10')][_0x78de('0x11')]===0x1f4){logger[_0x78de('0x10')](_0x78de('0xb'),_0x49cda1,_0x98799d[_0x78de('0x10')][_0x78de('0x12')]);return _0x378d30(_0x98799d['error'][_0x78de('0x12')]);}logger[_0x78de('0x10')](_0x78de('0xb'),_0x49cda1,_0x98799d[_0x78de('0x10')][_0x78de('0x12')]);return _0xd75f2d(_0x98799d[_0x78de('0x10')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x49cda1,_0x78de('0xc'));_0xd75f2d(_0x98799d['result'][_0x78de('0x12')]);}})['catch'](function(_0x54dd74){logger[_0x78de('0x10')](_0x78de('0xb'),_0x49cda1,_0x54dd74);_0x378d30(_0x54dd74);});});}exports[_0x78de('0x13')]=function(_0x4dac16){var _0x395578=this;return new Promise(function(_0x5abfee,_0x271d16){return db[_0x78de('0x14')][_0x78de('0x15')]({'raw':_0x4dac16[_0x78de('0x16')]?_0x4dac16['options'][_0x78de('0x17')]===undefined?!![]:![]:!![],'where':_0x4dac16['options']?_0x4dac16['options']['where']||null:null,'attributes':_0x4dac16[_0x78de('0x16')]?_0x4dac16[_0x78de('0x16')][_0x78de('0x18')]||null:null,'limit':_0x4dac16[_0x78de('0x16')]?_0x4dac16[_0x78de('0x16')][_0x78de('0x19')]||null:null,'include':_0x4dac16[_0x78de('0x16')]?_0x4dac16[_0x78de('0x16')][_0x78de('0x1a')]?_['map'](_0x4dac16['options']['include'],function(_0x1d4fd8){return{'model':db[_0x1d4fd8[_0x78de('0x1b')]],'as':_0x1d4fd8['as'],'attributes':_0x1d4fd8[_0x78de('0x18')],'include':_0x1d4fd8[_0x78de('0x1a')]?_[_0x78de('0x1c')](_0x1d4fd8['include'],function(_0x1ac812){return{'model':db[_0x1ac812[_0x78de('0x1b')]],'as':_0x1ac812['as'],'attributes':_0x1ac812[_0x78de('0x18')],'include':_0x1ac812['include']?_[_0x78de('0x1c')](_0x1ac812[_0x78de('0x1a')],function(_0x588ec4){return{'model':db[_0x588ec4[_0x78de('0x1b')]],'as':_0x588ec4['as'],'attributes':_0x588ec4[_0x78de('0x18')]};}):[]};}):[]};}):[]:[]})[_0x78de('0x1d')](function(_0x4e839f){logger[_0x78de('0xa')](_0x78de('0x13'),_0x4dac16);logger[_0x78de('0xd')](_0x78de('0x13'),_0x4dac16,JSON[_0x78de('0xf')](_0x4e839f));_0x5abfee(_0x4e839f);})[_0x78de('0x1e')](function(_0x47b5bd){logger[_0x78de('0x10')]('GetDeskAccount',_0x47b5bd[_0x78de('0x12')],_0x4dac16);_0x271d16(_0x395578[_0x78de('0x10')](0x1f4,_0x47b5bd['message']));});});};exports['ShowDeskAccount']=function(_0x29392f){var _0x206956=this;return new Promise(function(_0x526d25,_0x44148c){return db[_0x78de('0x14')][_0x78de('0x1f')]({'raw':_0x29392f['options']?_0x29392f['options'][_0x78de('0x17')]===undefined?!![]:![]:!![],'where':_0x29392f[_0x78de('0x16')]?_0x29392f['options'][_0x78de('0x20')]||null:null,'attributes':_0x29392f[_0x78de('0x16')]?_0x29392f[_0x78de('0x16')]['attributes']||null:null,'include':_0x29392f['options']?_0x29392f[_0x78de('0x16')][_0x78de('0x1a')]?_['map'](_0x29392f[_0x78de('0x16')][_0x78de('0x1a')],function(_0x1d8003){return{'model':db[_0x1d8003[_0x78de('0x1b')]],'as':_0x1d8003['as'],'attributes':_0x1d8003[_0x78de('0x18')],'include':_0x1d8003['include']?_['map'](_0x1d8003[_0x78de('0x1a')],function(_0x5790d7){return{'model':db[_0x5790d7[_0x78de('0x1b')]],'as':_0x5790d7['as'],'attributes':_0x5790d7[_0x78de('0x18')],'include':_0x5790d7['include']?_[_0x78de('0x1c')](_0x5790d7[_0x78de('0x1a')],function(_0x3545b3){return{'model':db[_0x3545b3[_0x78de('0x1b')]],'as':_0x3545b3['as'],'attributes':_0x3545b3[_0x78de('0x18')]};}):[]};}):[]};}):[]:[]})[_0x78de('0x1d')](function(_0x1d64b1){logger['info'](_0x78de('0x21'),_0x29392f);logger[_0x78de('0xd')](_0x78de('0x21'),_0x29392f,JSON[_0x78de('0xf')](_0x1d64b1));_0x526d25(_0x1d64b1);})[_0x78de('0x1e')](function(_0x1d3dbb){logger['error'](_0x78de('0x21'),_0x1d3dbb['message'],_0x29392f);_0x44148c(_0x206956[_0x78de('0x10')](0x1f4,_0x1d3dbb['message']));});});}; \ No newline at end of file +var _0x1eb9=['where','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetDeskAccount','findAll','options','raw','attributes','limit','map','include','model','then','debug','ShowDeskAccount','DeskAccount'];(function(_0x3c0af0,_0x9f26d6){var _0x5be111=function(_0x156154){while(--_0x156154){_0x3c0af0['push'](_0x3c0af0['shift']());}};_0x5be111(++_0x9f26d6);}(_0x1eb9,0x1c1));var _0x91eb=function(_0x49ce11,_0x751697){_0x49ce11=_0x49ce11-0x0;var _0x1c51f6=_0x1eb9[_0x49ce11];return _0x1c51f6;};'use strict';var _=require(_0x91eb('0x0'));var util=require(_0x91eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91eb('0x2'))['db'];var utils=require(_0x91eb('0x3'));var logger=require(_0x91eb('0x4'))(_0x91eb('0x5'));var config=require(_0x91eb('0x6'));var jayson=require(_0x91eb('0x7'));var client=jayson[_0x91eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2867e2,_0x3c99cc,_0x525ff7){return new BPromise(function(_0x29061f,_0x58d7db){return client[_0x91eb('0x9')](_0x2867e2,_0x525ff7)['then'](function(_0x4d193e){logger[_0x91eb('0xa')](_0x91eb('0xb'),_0x3c99cc,_0x91eb('0xc'));logger['debug'](_0x91eb('0xd'),_0x3c99cc,_0x91eb('0xc'),JSON[_0x91eb('0xe')](_0x4d193e));if(_0x4d193e[_0x91eb('0xf')]){if(_0x4d193e[_0x91eb('0xf')]['code']===0x1f4){logger[_0x91eb('0xf')]('DeskAccount,\x20%s,\x20%s',_0x3c99cc,_0x4d193e[_0x91eb('0xf')]['message']);return _0x58d7db(_0x4d193e[_0x91eb('0xf')][_0x91eb('0x10')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x3c99cc,_0x4d193e[_0x91eb('0xf')][_0x91eb('0x10')]);return _0x29061f(_0x4d193e[_0x91eb('0xf')][_0x91eb('0x10')]);}else{logger[_0x91eb('0xa')]('DeskAccount,\x20%s,\x20%s',_0x3c99cc,'request\x20sent');_0x29061f(_0x4d193e['result'][_0x91eb('0x10')]);}})[_0x91eb('0x11')](function(_0x4659ca){logger[_0x91eb('0xf')](_0x91eb('0xb'),_0x3c99cc,_0x4659ca);_0x58d7db(_0x4659ca);});});}exports[_0x91eb('0x12')]=function(_0x586dda){var _0x61f3cc=this;return new Promise(function(_0x283f46,_0x920d09){return db['DeskAccount'][_0x91eb('0x13')]({'raw':_0x586dda['options']?_0x586dda[_0x91eb('0x14')][_0x91eb('0x15')]===undefined?!![]:![]:!![],'where':_0x586dda[_0x91eb('0x14')]?_0x586dda[_0x91eb('0x14')]['where']||null:null,'attributes':_0x586dda[_0x91eb('0x14')]?_0x586dda[_0x91eb('0x14')][_0x91eb('0x16')]||null:null,'limit':_0x586dda['options']?_0x586dda[_0x91eb('0x14')][_0x91eb('0x17')]||null:null,'include':_0x586dda['options']?_0x586dda[_0x91eb('0x14')]['include']?_[_0x91eb('0x18')](_0x586dda[_0x91eb('0x14')][_0x91eb('0x19')],function(_0x1e41ef){return{'model':db[_0x1e41ef['model']],'as':_0x1e41ef['as'],'attributes':_0x1e41ef['attributes'],'include':_0x1e41ef['include']?_[_0x91eb('0x18')](_0x1e41ef[_0x91eb('0x19')],function(_0xf9917b){return{'model':db[_0xf9917b[_0x91eb('0x1a')]],'as':_0xf9917b['as'],'attributes':_0xf9917b[_0x91eb('0x16')],'include':_0xf9917b[_0x91eb('0x19')]?_[_0x91eb('0x18')](_0xf9917b['include'],function(_0x56bbdc){return{'model':db[_0x56bbdc[_0x91eb('0x1a')]],'as':_0x56bbdc['as'],'attributes':_0x56bbdc['attributes']};}):[]};}):[]};}):[]:[]})[_0x91eb('0x1b')](function(_0x49c7e0){logger[_0x91eb('0xa')](_0x91eb('0x12'),_0x586dda);logger[_0x91eb('0x1c')](_0x91eb('0x12'),_0x586dda,JSON[_0x91eb('0xe')](_0x49c7e0));_0x283f46(_0x49c7e0);})['catch'](function(_0x384598){logger[_0x91eb('0xf')](_0x91eb('0x12'),_0x384598[_0x91eb('0x10')],_0x586dda);_0x920d09(_0x61f3cc[_0x91eb('0xf')](0x1f4,_0x384598[_0x91eb('0x10')]));});});};exports[_0x91eb('0x1d')]=function(_0x330b58){var _0x2c8ba5=this;return new Promise(function(_0x3ce690,_0x44bca7){return db[_0x91eb('0x1e')]['find']({'raw':_0x330b58[_0x91eb('0x14')]?_0x330b58[_0x91eb('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x330b58['options']?_0x330b58[_0x91eb('0x14')][_0x91eb('0x1f')]||null:null,'attributes':_0x330b58[_0x91eb('0x14')]?_0x330b58[_0x91eb('0x14')][_0x91eb('0x16')]||null:null,'include':_0x330b58[_0x91eb('0x14')]?_0x330b58[_0x91eb('0x14')][_0x91eb('0x19')]?_[_0x91eb('0x18')](_0x330b58[_0x91eb('0x14')][_0x91eb('0x19')],function(_0x2d6e70){return{'model':db[_0x2d6e70['model']],'as':_0x2d6e70['as'],'attributes':_0x2d6e70['attributes'],'include':_0x2d6e70[_0x91eb('0x19')]?_[_0x91eb('0x18')](_0x2d6e70[_0x91eb('0x19')],function(_0xbe7ed2){return{'model':db[_0xbe7ed2[_0x91eb('0x1a')]],'as':_0xbe7ed2['as'],'attributes':_0xbe7ed2['attributes'],'include':_0xbe7ed2['include']?_['map'](_0xbe7ed2[_0x91eb('0x19')],function(_0x43083c){return{'model':db[_0x43083c[_0x91eb('0x1a')]],'as':_0x43083c['as'],'attributes':_0x43083c[_0x91eb('0x16')]};}):[]};}):[]};}):[]:[]})[_0x91eb('0x1b')](function(_0x3d5ee9){logger[_0x91eb('0xa')](_0x91eb('0x1d'),_0x330b58);logger['debug'](_0x91eb('0x1d'),_0x330b58,JSON[_0x91eb('0xe')](_0x3d5ee9));_0x3ce690(_0x3d5ee9);})[_0x91eb('0x11')](function(_0x3cf493){logger[_0x91eb('0xf')](_0x91eb('0x1d'),_0x3cf493[_0x91eb('0x10')],_0x330b58);_0x44bca7(_0x2c8ba5[_0x91eb('0xf')](0x1f4,_0x3cf493[_0x91eb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index b837291..f41ff3c 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 _0x9f0e=['setTags','update','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post'];(function(_0x201af5,_0xc91123){var _0x35c62f=function(_0x1b0b9d){while(--_0x1b0b9d){_0x201af5['push'](_0x201af5['shift']());}};_0x35c62f(++_0xc91123);}(_0x9f0e,0x116));var _0xe9f0=function(_0xe1ccd9,_0xacc0ee){_0xe1ccd9=_0xe1ccd9-0x0;var _0x51b73f=_0x9f0e[_0xe1ccd9];return _0x51b73f;};'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 auth=require('../../components/auth/service');var interaction=require(_0xe9f0('0x5'));var config=require(_0xe9f0('0x6'));var controller=require(_0xe9f0('0x7'));router[_0xe9f0('0x8')]('/',auth[_0xe9f0('0x9')](),controller['index']);router['get'](_0xe9f0('0xa'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0xb')]);router['get'](_0xe9f0('0xc'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x8')](_0xe9f0('0xe'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x8')](_0xe9f0('0x10'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x8')](_0xe9f0('0x12'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);router['post']('/',auth[_0xe9f0('0x9')](),controller[_0xe9f0('0x14')]);router[_0xe9f0('0x15')](_0xe9f0('0x12'),auth['isAuthenticated'](),controller[_0xe9f0('0x16')]);router['put'](_0xe9f0('0xa'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0x17')]);router['delete'](_0xe9f0('0xa'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0x18')]);module['exports']=router; \ No newline at end of file +var _0x160c=['put','update','/:id','destroy','exports','util','path','connect-timeout','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post'];(function(_0x3804da,_0x4b1678){var _0x1038e3=function(_0x46dbaf){while(--_0x46dbaf){_0x3804da['push'](_0x3804da['shift']());}};_0x1038e3(++_0x4b1678);}(_0x160c,0x181));var _0xc160=function(_0x3df0d4,_0x45f109){_0x3df0d4=_0x3df0d4-0x0;var _0x2906da=_0x160c[_0x3df0d4];return _0x2906da;};'use strict';var multer=require('multer');var util=require(_0xc160('0x0'));var path=require(_0xc160('0x1'));var timeout=require(_0xc160('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc160('0x3'));var config=require('../../config/environment');var controller=require(_0xc160('0x4'));router[_0xc160('0x5')]('/',auth[_0xc160('0x6')](),controller['index']);router[_0xc160('0x5')]('/:id',auth[_0xc160('0x6')](),controller['show']);router[_0xc160('0x5')](_0xc160('0x7'),auth['isAuthenticated'](),controller[_0xc160('0x8')]);router[_0xc160('0x5')]('/:id/subjects',auth[_0xc160('0x6')](),controller[_0xc160('0x9')]);router[_0xc160('0x5')](_0xc160('0xa'),auth[_0xc160('0x6')](),controller[_0xc160('0xb')]);router[_0xc160('0x5')](_0xc160('0xc'),auth[_0xc160('0x6')](),controller['getTags']);router[_0xc160('0xd')]('/',auth[_0xc160('0x6')](),controller['create']);router[_0xc160('0xd')](_0xc160('0xc'),auth[_0xc160('0x6')](),controller['setTags']);router[_0xc160('0xe')]('/:id',auth[_0xc160('0x6')](),controller[_0xc160('0xf')]);router['delete'](_0xc160('0x10'),auth['isAuthenticated'](),controller[_0xc160('0x11')]);module[_0xc160('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a8ef182..5bd91ca 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 _0x30f3=['exports','STRING','sequelize'];(function(_0x2ecb89,_0xcbaeac){var _0x46bd2f=function(_0x52619c){while(--_0x52619c){_0x2ecb89['push'](_0x2ecb89['shift']());}};_0x46bd2f(++_0xcbaeac);}(_0x30f3,0xbf));var _0x330f=function(_0x65397d,_0xf997ae){_0x65397d=_0x65397d-0x0;var _0x357509=_0x30f3[_0x65397d];return _0x357509;};'use strict';var Sequelize=require(_0x330f('0x0'));module[_0x330f('0x1')]={'name':{'type':Sequelize[_0x330f('0x2')]},'description':{'type':Sequelize[_0x330f('0x2')]}}; \ No newline at end of file +var _0x01a0=['STRING','sequelize','exports'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x01a0,0x6a));var _0x001a=function(_0x2df47a,_0x1b4403){_0x2df47a=_0x2df47a-0x0;var _0xac464f=_0x01a0[_0x2df47a];return _0xac464f;};'use strict';var Sequelize=require(_0x001a('0x0'));module[_0x001a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x001a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e090176..cf79862 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 _0xa854=['message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','filter','options','include','findAll','rows','show','params','includeAll','create','body','find','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x5330b7,_0xd242d4){var _0x520a2e=function(_0x10fbc8){while(--_0x10fbc8){_0x5330b7['push'](_0x5330b7['shift']());}};_0x520a2e(++_0xd242d4);}(_0xa854,0x103));var _0x4a85=function(_0x38429d,_0x47f999){_0x38429d=_0x38429d-0x0;var _0x376053=_0xa854[_0x38429d];return _0x376053;};'use strict';var pdf=require(_0x4a85('0x0'));var emlformat=require(_0x4a85('0x1'));var rimraf=require(_0x4a85('0x2'));var zipdir=require(_0x4a85('0x3'));var jsonpatch=require(_0x4a85('0x4'));var rp=require('request-promise');var moment=require(_0x4a85('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4a85('0x6'));var util=require('util');var path=require(_0x4a85('0x7'));var sox=require(_0x4a85('0x8'));var csv=require('to-csv');var ejs=require(_0x4a85('0x9'));var fs=require('fs');var _=require(_0x4a85('0xa'));var squel=require('squel');var crypto=require(_0x4a85('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4a85('0xc'));var toCsv=require(_0x4a85('0xd'));var querystring=require(_0x4a85('0xe'));var Papa=require(_0x4a85('0xf'));var Redis=require(_0x4a85('0x10'));var authService=require(_0x4a85('0x11'));var qs=require(_0x4a85('0x12'));var as=require(_0x4a85('0x13'));var hardwareService=require(_0x4a85('0x14'));var logger=require('../../config/logger')(_0x4a85('0x15'));var utils=require(_0x4a85('0x16'));var config=require(_0x4a85('0x17'));var db=require(_0x4a85('0x18'))['db'];var jayson=require(_0x4a85('0x19'));var client=jayson[_0x4a85('0x1a')][_0x4a85('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x42088d,_0x32d2c1,_0x5e8b82){if(_0x5e8b82){var _0x35e857=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35e857[_0x4a85('0x1c')](_0x32d2c1)){return _0x42088d;}else{throw new db[(_0x4a85('0x1d'))][(_0x4a85('0x1e'))](_0x4a85('0x1f'));}}else{return _0x42088d;}}function respondWithRpcPromise(_0x1249d2,_0x34743a,_0x256a3c,_0x1922cb){return new BPromise(function(_0x397f4a,_0x6f362b){var _0x52504e=_0x1922cb||client;return _0x52504e[_0x4a85('0x20')](_0x1249d2,_0x256a3c)[_0x4a85('0x21')](function(_0x5c9b9f){logger[_0x4a85('0x22')](_0x4a85('0x23'),_0x34743a,_0x4a85('0x24'));logger['debug'](_0x4a85('0x25'),_0x34743a,_0x4a85('0x24'),JSON[_0x4a85('0x26')](_0x5c9b9f));if(_0x5c9b9f['error']){if(_0x5c9b9f['error'][_0x4a85('0x27')]===0x1f4){logger[_0x4a85('0x28')](_0x4a85('0x23'),_0x34743a,_0x5c9b9f[_0x4a85('0x28')][_0x4a85('0x29')]);return _0x6f362b(_0x5c9b9f[_0x4a85('0x28')][_0x4a85('0x29')]);}logger[_0x4a85('0x28')]('DeskConfiguration,\x20%s,\x20%s',_0x34743a,_0x5c9b9f['error']['message']);return _0x397f4a(_0x5c9b9f[_0x4a85('0x28')][_0x4a85('0x29')]);}else{logger[_0x4a85('0x22')](_0x4a85('0x23'),_0x34743a,'request\x20sent');_0x397f4a(_0x5c9b9f[_0x4a85('0x2a')][_0x4a85('0x29')]);}})[_0x4a85('0x2b')](function(_0x3f3894){logger[_0x4a85('0x28')]('DeskConfiguration,\x20%s,\x20%s',_0x34743a,_0x3f3894);_0x6f362b(_0x3f3894);});});}function respondWithStatusCode(_0x1075e2,_0x1a9a8c){_0x1a9a8c=_0x1a9a8c||0xcc;return function(_0x1b3f6b){if(_0x1b3f6b){return _0x1075e2[_0x4a85('0x2c')](_0x1a9a8c);}return _0x1075e2[_0x4a85('0x2d')](_0x1a9a8c)[_0x4a85('0x2e')]();};}function respondWithResult(_0x4a34d5,_0x462656){_0x462656=_0x462656||0xc8;return function(_0x343dfe){if(_0x343dfe){return _0x4a34d5[_0x4a85('0x2d')](_0x462656)['json'](_0x343dfe);}};}function respondWithFilteredResult(_0x20246b,_0x51d51d){return function(_0x470803){if(_0x470803){var _0x1b91ec=_0x470803[_0x4a85('0x2f')],_0x264515=_0x51d51d[_0x4a85('0x30')],_0x3ade10=_0x51d51d[_0x4a85('0x30')]+_0x51d51d['limit'],_0x4596c6;if(_0x3ade10>=_0x1b91ec){_0x3ade10=_0x1b91ec;_0x4596c6=0xc8;}else{_0x4596c6=0xce;}_0x20246b[_0x4a85('0x2d')](_0x4596c6);return _0x20246b['set'](_0x4a85('0x31'),_0x264515+'-'+_0x3ade10+'/'+_0x1b91ec)[_0x4a85('0x32')](_0x470803);}return null;};}function patchUpdates(_0x4fee4f){return function(_0xb42819){try{jsonpatch[_0x4a85('0x33')](_0xb42819,_0x4fee4f,!![]);}catch(_0x2ac470){return BPromise[_0x4a85('0x34')](_0x2ac470);}return _0xb42819[_0x4a85('0x35')]();};}function saveUpdates(_0x181dfa,_0x16a1b5){return function(_0x3af5e7){if(_0x3af5e7){return _0x3af5e7[_0x4a85('0x36')](_0x181dfa)[_0x4a85('0x21')](function(_0x327a1c){return _0x327a1c;});}return null;};}function removeEntity(_0x3612e7,_0x5326a8){return function(_0x3e6e50){if(_0x3e6e50){return _0x3e6e50[_0x4a85('0x37')]()[_0x4a85('0x21')](function(){_0x3612e7[_0x4a85('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x825687,_0x5c838d){return function(_0x474e95){if(!_0x474e95){_0x825687[_0x4a85('0x2c')](0x194);}return _0x474e95;};}function handleError(_0x3441af,_0x41827f){_0x41827f=_0x41827f||0x1f4;return function(_0x46fcb5){logger['error'](_0x46fcb5[_0x4a85('0x38')]);if(_0x46fcb5[_0x4a85('0x39')]){delete _0x46fcb5['name'];}_0x3441af[_0x4a85('0x2d')](_0x41827f)[_0x4a85('0x3a')](_0x46fcb5);};}exports[_0x4a85('0x3b')]=function(_0x5ca719,_0x2d15f7){var _0x2eddef={},_0x3672ff={},_0x3d716c={'count':0x0,'rows':[]};var _0x1e55cf=_[_0x4a85('0x3c')](db[_0x4a85('0x3d')][_0x4a85('0x3e')],function(_0x7d6302){return{'name':_0x7d6302['fieldName'],'type':_0x7d6302[_0x4a85('0x3f')][_0x4a85('0x40')]};});_0x3672ff[_0x4a85('0x41')]=_['map'](_0x1e55cf,_0x4a85('0x39'));_0x3672ff['query']=_[_0x4a85('0x42')](_0x5ca719[_0x4a85('0x43')]);_0x3672ff['filters']=_[_0x4a85('0x44')](_0x3672ff[_0x4a85('0x41')],_0x3672ff[_0x4a85('0x43')]);_0x2eddef['attributes']=_['intersection'](_0x3672ff[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0x5ca719['query']['fields']));_0x2eddef['attributes']=_0x2eddef[_0x4a85('0x46')][_0x4a85('0x47')]?_0x2eddef['attributes']:_0x3672ff['model'];if(!_0x5ca719[_0x4a85('0x43')][_0x4a85('0x48')](_0x4a85('0x49'))){_0x2eddef[_0x4a85('0x4a')]=qs[_0x4a85('0x4a')](_0x5ca719[_0x4a85('0x43')][_0x4a85('0x4a')]);_0x2eddef[_0x4a85('0x30')]=qs['offset'](_0x5ca719['query'][_0x4a85('0x30')]);}_0x2eddef['order']=qs['sort'](_0x5ca719[_0x4a85('0x43')][_0x4a85('0x4b')]);_0x2eddef[_0x4a85('0x4c')]=qs[_0x4a85('0x4d')](_[_0x4a85('0x4e')](_0x5ca719[_0x4a85('0x43')],_0x3672ff[_0x4a85('0x4d')]),_0x1e55cf);if(_0x5ca719[_0x4a85('0x43')]['filter']){_0x2eddef['where']=_[_0x4a85('0x4f')](_0x2eddef[_0x4a85('0x4c')],{'$or':_[_0x4a85('0x3c')](_0x1e55cf,function(_0x320d3f){if(_0x320d3f[_0x4a85('0x3f')]!=='VIRTUAL'){var _0x488a21={};_0x488a21[_0x320d3f[_0x4a85('0x39')]]={'$like':'%'+_0x5ca719[_0x4a85('0x43')][_0x4a85('0x50')]+'%'};return _0x488a21;}})});}_0x2eddef=_[_0x4a85('0x4f')]({},_0x2eddef,_0x5ca719[_0x4a85('0x51')]);var _0x4248fe={'where':_0x2eddef[_0x4a85('0x4c')]};return db[_0x4a85('0x3d')][_0x4a85('0x2f')](_0x4248fe)[_0x4a85('0x21')](function(_0x20e24c){_0x3d716c[_0x4a85('0x2f')]=_0x20e24c;if(_0x5ca719[_0x4a85('0x43')]['includeAll']){_0x2eddef[_0x4a85('0x52')]=[{'all':!![]}];}return db[_0x4a85('0x3d')][_0x4a85('0x53')](_0x2eddef);})['then'](function(_0x1b330a){_0x3d716c[_0x4a85('0x54')]=_0x1b330a;return _0x3d716c;})['then'](respondWithFilteredResult(_0x2d15f7,_0x2eddef))[_0x4a85('0x2b')](handleError(_0x2d15f7,null));};exports[_0x4a85('0x55')]=function(_0x4c8154,_0x5cfa99){var _0x10b0e1={'raw':![],'where':{'id':_0x4c8154[_0x4a85('0x56')]['id']}},_0x5724fb={};_0x5724fb[_0x4a85('0x41')]=_[_0x4a85('0x42')](db[_0x4a85('0x3d')][_0x4a85('0x3e')]);_0x5724fb[_0x4a85('0x43')]=_['keys'](_0x4c8154['query']);_0x5724fb[_0x4a85('0x4d')]=_[_0x4a85('0x44')](_0x5724fb[_0x4a85('0x41')],_0x5724fb[_0x4a85('0x43')]);_0x10b0e1[_0x4a85('0x46')]=_[_0x4a85('0x44')](_0x5724fb[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0x4c8154[_0x4a85('0x43')][_0x4a85('0x45')]));_0x10b0e1[_0x4a85('0x46')]=_0x10b0e1[_0x4a85('0x46')][_0x4a85('0x47')]?_0x10b0e1[_0x4a85('0x46')]:_0x5724fb['model'];if(_0x4c8154[_0x4a85('0x43')][_0x4a85('0x57')]){_0x10b0e1['include']=[{'all':!![]}];}_0x10b0e1=_['merge']({},_0x10b0e1,_0x4c8154[_0x4a85('0x51')]);return db[_0x4a85('0x3d')]['find'](_0x10b0e1)[_0x4a85('0x21')](handleEntityNotFound(_0x5cfa99,null))[_0x4a85('0x21')](respondWithResult(_0x5cfa99,null))['catch'](handleError(_0x5cfa99,null));};exports[_0x4a85('0x58')]=function(_0x5d5db3,_0x3578bd){return db[_0x4a85('0x3d')][_0x4a85('0x58')](_0x5d5db3[_0x4a85('0x59')],{})[_0x4a85('0x21')](respondWithResult(_0x3578bd,0xc9))[_0x4a85('0x2b')](handleError(_0x3578bd,null));};exports[_0x4a85('0x36')]=function(_0x35cc3c,_0x1363d4){if(_0x35cc3c['body']['id']){delete _0x35cc3c[_0x4a85('0x59')]['id'];}return db[_0x4a85('0x3d')][_0x4a85('0x5a')]({'where':{'id':_0x35cc3c[_0x4a85('0x56')]['id']}})[_0x4a85('0x21')](handleEntityNotFound(_0x1363d4,null))['then'](saveUpdates(_0x35cc3c[_0x4a85('0x59')],null))['then'](respondWithResult(_0x1363d4,null))[_0x4a85('0x2b')](handleError(_0x1363d4,null));};exports[_0x4a85('0x37')]=function(_0x37d9e0,_0x4a5dcb){return db[_0x4a85('0x3d')][_0x4a85('0x5a')]({'where':{'id':_0x37d9e0[_0x4a85('0x56')]['id']}})[_0x4a85('0x21')](handleEntityNotFound(_0x4a5dcb,null))[_0x4a85('0x21')](removeEntity(_0x4a5dcb,null))[_0x4a85('0x2b')](handleError(_0x4a5dcb,null));};exports['getFields']=function(_0x4cfb30,_0x83b49e,_0x183020){var _0x16fd6e={};var _0x2af2a0={};var _0x24126a;var _0x47f640;return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0x4cfb30[_0x4a85('0x56')]['id']}})['then'](handleEntityNotFound(_0x83b49e,null))['then'](function(_0x430114){if(_0x430114){_0x24126a=_0x430114;_0x2af2a0[_0x4a85('0x41')]=_[_0x4a85('0x42')](db[_0x4a85('0x5c')][_0x4a85('0x3e')]);_0x2af2a0[_0x4a85('0x43')]=_[_0x4a85('0x42')](_0x4cfb30[_0x4a85('0x43')]);_0x2af2a0['filters']=_[_0x4a85('0x44')](_0x2af2a0[_0x4a85('0x41')],_0x2af2a0['query']);_0x16fd6e['attributes']=_[_0x4a85('0x44')](_0x2af2a0[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0x4cfb30['query'][_0x4a85('0x45')]));_0x16fd6e[_0x4a85('0x46')]=_0x16fd6e[_0x4a85('0x46')][_0x4a85('0x47')]?_0x16fd6e[_0x4a85('0x46')]:_0x2af2a0[_0x4a85('0x41')];_0x16fd6e[_0x4a85('0x5d')]=qs[_0x4a85('0x4b')](_0x4cfb30[_0x4a85('0x43')]['sort']);_0x16fd6e[_0x4a85('0x4c')]=qs[_0x4a85('0x4d')](_['pick'](_0x4cfb30[_0x4a85('0x43')],_0x2af2a0[_0x4a85('0x4d')]));if(_0x4cfb30[_0x4a85('0x43')]['filter']){_0x16fd6e['where']=_[_0x4a85('0x4f')](_0x16fd6e[_0x4a85('0x4c')],{'$or':_[_0x4a85('0x3c')](_0x16fd6e[_0x4a85('0x46')],function(_0x2e3471){var _0x5523df={};_0x5523df[_0x2e3471]={'$like':'%'+_0x4cfb30['query']['filter']+'%'};return _0x5523df;})});}_0x16fd6e=_[_0x4a85('0x4f')]({},_0x16fd6e,_0x4cfb30[_0x4a85('0x51')]);return _0x24126a[_0x4a85('0x5e')](_0x16fd6e);}})[_0x4a85('0x21')](function(_0x156472){if(_0x156472){_0x47f640=_0x156472['length'];if(!_0x4cfb30[_0x4a85('0x43')][_0x4a85('0x48')](_0x4a85('0x49'))){_0x16fd6e['limit']=qs[_0x4a85('0x4a')](_0x4cfb30[_0x4a85('0x43')]['limit']);_0x16fd6e[_0x4a85('0x30')]=qs['offset'](_0x4cfb30[_0x4a85('0x43')][_0x4a85('0x30')]);}return _0x24126a[_0x4a85('0x5e')](_0x16fd6e);}})[_0x4a85('0x21')](function(_0x107cb1){if(_0x107cb1){return _0x107cb1?{'count':_0x47f640,'rows':_0x107cb1}:null;}})[_0x4a85('0x21')](respondWithResult(_0x83b49e,null))[_0x4a85('0x2b')](handleError(_0x83b49e,null));};exports[_0x4a85('0x5f')]=function(_0x56b9f3,_0x293ecf,_0x22da45){var _0x381209={};var _0x405bbb={};var _0x501b76;var _0x728ced;return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0x56b9f3[_0x4a85('0x56')]['id']}})['then'](handleEntityNotFound(_0x293ecf,null))[_0x4a85('0x21')](function(_0x18412e){if(_0x18412e){_0x501b76=_0x18412e;_0x405bbb[_0x4a85('0x41')]=_[_0x4a85('0x42')](db[_0x4a85('0x5c')]['rawAttributes']);_0x405bbb[_0x4a85('0x43')]=_[_0x4a85('0x42')](_0x56b9f3[_0x4a85('0x43')]);_0x405bbb[_0x4a85('0x4d')]=_[_0x4a85('0x44')](_0x405bbb['model'],_0x405bbb[_0x4a85('0x43')]);_0x381209[_0x4a85('0x46')]=_[_0x4a85('0x44')](_0x405bbb[_0x4a85('0x41')],qs['fields'](_0x56b9f3['query'][_0x4a85('0x45')]));_0x381209[_0x4a85('0x46')]=_0x381209['attributes']['length']?_0x381209[_0x4a85('0x46')]:_0x405bbb[_0x4a85('0x41')];_0x381209[_0x4a85('0x5d')]=qs[_0x4a85('0x4b')](_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x4b')]);_0x381209[_0x4a85('0x4c')]=qs['filters'](_[_0x4a85('0x4e')](_0x56b9f3[_0x4a85('0x43')],_0x405bbb[_0x4a85('0x4d')]));if(_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x50')]){_0x381209[_0x4a85('0x4c')]=_[_0x4a85('0x4f')](_0x381209['where'],{'$or':_[_0x4a85('0x3c')](_0x381209[_0x4a85('0x46')],function(_0x4b668a){var _0x283dd2={};_0x283dd2[_0x4b668a]={'$like':'%'+_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x50')]+'%'};return _0x283dd2;})});}_0x381209=_[_0x4a85('0x4f')]({},_0x381209,_0x56b9f3[_0x4a85('0x51')]);return _0x501b76[_0x4a85('0x5f')](_0x381209);}})[_0x4a85('0x21')](function(_0x526cac){if(_0x526cac){_0x728ced=_0x526cac[_0x4a85('0x47')];if(!_0x56b9f3['query'][_0x4a85('0x48')]('nolimit')){_0x381209[_0x4a85('0x4a')]=qs[_0x4a85('0x4a')](_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x4a')]);_0x381209[_0x4a85('0x30')]=qs[_0x4a85('0x30')](_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x30')]);}return _0x501b76[_0x4a85('0x5f')](_0x381209);}})[_0x4a85('0x21')](function(_0x49e5a0){if(_0x49e5a0){return _0x49e5a0?{'count':_0x728ced,'rows':_0x49e5a0}:null;}})['then'](respondWithResult(_0x293ecf,null))[_0x4a85('0x2b')](handleError(_0x293ecf,null));};exports[_0x4a85('0x60')]=function(_0x4e8e9d,_0x27988e,_0x4eed){var _0x3f2296={};var _0x3c18f1={};var _0x36756e;var _0x52ac4a;return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0x4e8e9d['params']['id']}})[_0x4a85('0x21')](handleEntityNotFound(_0x27988e,null))[_0x4a85('0x21')](function(_0x1450c9){if(_0x1450c9){_0x36756e=_0x1450c9;_0x3c18f1['model']=_[_0x4a85('0x42')](db[_0x4a85('0x5c')][_0x4a85('0x3e')]);_0x3c18f1[_0x4a85('0x43')]=_[_0x4a85('0x42')](_0x4e8e9d[_0x4a85('0x43')]);_0x3c18f1[_0x4a85('0x4d')]=_[_0x4a85('0x44')](_0x3c18f1[_0x4a85('0x41')],_0x3c18f1[_0x4a85('0x43')]);_0x3f2296[_0x4a85('0x46')]=_[_0x4a85('0x44')](_0x3c18f1[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0x4e8e9d['query'][_0x4a85('0x45')]));_0x3f2296[_0x4a85('0x46')]=_0x3f2296['attributes'][_0x4a85('0x47')]?_0x3f2296['attributes']:_0x3c18f1[_0x4a85('0x41')];_0x3f2296[_0x4a85('0x5d')]=qs['sort'](_0x4e8e9d['query']['sort']);_0x3f2296[_0x4a85('0x4c')]=qs[_0x4a85('0x4d')](_[_0x4a85('0x4e')](_0x4e8e9d[_0x4a85('0x43')],_0x3c18f1[_0x4a85('0x4d')]));if(_0x4e8e9d[_0x4a85('0x43')]['filter']){_0x3f2296['where']=_['merge'](_0x3f2296[_0x4a85('0x4c')],{'$or':_['map'](_0x3f2296['attributes'],function(_0x456698){var _0x10ed31={};_0x10ed31[_0x456698]={'$like':'%'+_0x4e8e9d[_0x4a85('0x43')]['filter']+'%'};return _0x10ed31;})});}_0x3f2296=_[_0x4a85('0x4f')]({},_0x3f2296,_0x4e8e9d[_0x4a85('0x51')]);return _0x36756e['getDescriptions'](_0x3f2296);}})[_0x4a85('0x21')](function(_0x25cfaf){if(_0x25cfaf){_0x52ac4a=_0x25cfaf['length'];if(!_0x4e8e9d[_0x4a85('0x43')][_0x4a85('0x48')](_0x4a85('0x49'))){_0x3f2296['limit']=qs[_0x4a85('0x4a')](_0x4e8e9d[_0x4a85('0x43')]['limit']);_0x3f2296['offset']=qs[_0x4a85('0x30')](_0x4e8e9d[_0x4a85('0x43')][_0x4a85('0x30')]);}return _0x36756e[_0x4a85('0x60')](_0x3f2296);}})['then'](function(_0x299a81){if(_0x299a81){return _0x299a81?{'count':_0x52ac4a,'rows':_0x299a81}:null;}})['then'](respondWithResult(_0x27988e,null))[_0x4a85('0x2b')](handleError(_0x27988e,null));};exports['getTags']=function(_0xe209f6,_0x53d4a5,_0x391517){var _0x239af2={};var _0x5c5b15={};var _0x27f28c;var _0x58bc27;return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0xe209f6['params']['id']}})[_0x4a85('0x21')](handleEntityNotFound(_0x53d4a5,null))[_0x4a85('0x21')](function(_0x1ac145){if(_0x1ac145){_0x27f28c=_0x1ac145;_0x5c5b15[_0x4a85('0x41')]=_[_0x4a85('0x42')](db['Tag'][_0x4a85('0x3e')]);_0x5c5b15[_0x4a85('0x43')]=_[_0x4a85('0x42')](_0xe209f6[_0x4a85('0x43')]);_0x5c5b15['filters']=_['intersection'](_0x5c5b15[_0x4a85('0x41')],_0x5c5b15[_0x4a85('0x43')]);_0x239af2['attributes']=_[_0x4a85('0x44')](_0x5c5b15[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0xe209f6[_0x4a85('0x43')][_0x4a85('0x45')]));_0x239af2[_0x4a85('0x46')]=_0x239af2['attributes'][_0x4a85('0x47')]?_0x239af2[_0x4a85('0x46')]:_0x5c5b15[_0x4a85('0x41')];_0x239af2['order']=qs[_0x4a85('0x4b')](_0xe209f6[_0x4a85('0x43')][_0x4a85('0x4b')]);_0x239af2[_0x4a85('0x4c')]=qs['filters'](_[_0x4a85('0x4e')](_0xe209f6[_0x4a85('0x43')],_0x5c5b15['filters']));if(_0xe209f6[_0x4a85('0x43')][_0x4a85('0x50')]){_0x239af2['where']=_[_0x4a85('0x4f')](_0x239af2[_0x4a85('0x4c')],{'$or':_[_0x4a85('0x3c')](_0x239af2[_0x4a85('0x46')],function(_0x503fea){var _0x314cfc={};_0x314cfc[_0x503fea]={'$like':'%'+_0xe209f6[_0x4a85('0x43')][_0x4a85('0x50')]+'%'};return _0x314cfc;})});}_0x239af2=_[_0x4a85('0x4f')]({},_0x239af2,_0xe209f6[_0x4a85('0x51')]);return _0x27f28c[_0x4a85('0x61')](_0x239af2);}})['then'](function(_0x8f0b9c){if(_0x8f0b9c){_0x58bc27=_0x8f0b9c[_0x4a85('0x47')];if(!_0xe209f6[_0x4a85('0x43')]['hasOwnProperty'](_0x4a85('0x49'))){_0x239af2[_0x4a85('0x4a')]=qs[_0x4a85('0x4a')](_0xe209f6[_0x4a85('0x43')][_0x4a85('0x4a')]);_0x239af2[_0x4a85('0x30')]=qs['offset'](_0xe209f6['query']['offset']);}return _0x27f28c[_0x4a85('0x61')](_0x239af2);}})['then'](function(_0x13fcf9){if(_0x13fcf9){return _0x13fcf9?{'count':_0x58bc27,'rows':_0x13fcf9}:null;}})['then'](respondWithResult(_0x53d4a5,null))[_0x4a85('0x2b')](handleError(_0x53d4a5,null));};exports['setTags']=function(_0x26879b,_0x92172d,_0x26e332){if(_0x26879b['body']['id']){delete _0x26879b['body']['id'];}return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0x26879b[_0x4a85('0x56')]['id']}})['then'](handleEntityNotFound(_0x92172d,null))[_0x4a85('0x21')](function(_0x5cfc81){if(_0x5cfc81){return _0x5cfc81[_0x4a85('0x62')](_0x26879b[_0x4a85('0x59')][_0x4a85('0x63')]||[]);}return null;})[_0x4a85('0x21')](respondWithResult(_0x92172d,null))[_0x4a85('0x2b')](handleError(_0x92172d,null));}; \ No newline at end of file +var _0x6688=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','test','Sequelize','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','save','end','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','DeskConfiguration','findAll','rows','show','params','length','include','find','create','body','update','destroy','getFields','findOne','getSubjects','getDescriptions','DeskField','Tag','getTags','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x253889,_0x4d71e6){var _0x24f09e=function(_0x389a96){while(--_0x389a96){_0x253889['push'](_0x253889['shift']());}};_0x24f09e(++_0x4d71e6);}(_0x6688,0x10e));var _0x8668=function(_0x45440f,_0x575c5f){_0x45440f=_0x45440f-0x0;var _0x4480bd=_0x6688[_0x45440f];return _0x4480bd;};'use strict';var pdf=require(_0x8668('0x0'));var emlformat=require(_0x8668('0x1'));var rimraf=require(_0x8668('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8668('0x3'));var rp=require(_0x8668('0x4'));var moment=require(_0x8668('0x5'));var BPromise=require(_0x8668('0x6'));var Mustache=require(_0x8668('0x7'));var util=require(_0x8668('0x8'));var path=require(_0x8668('0x9'));var sox=require('sox');var csv=require(_0x8668('0xa'));var ejs=require(_0x8668('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8668('0xc'));var crypto=require(_0x8668('0xd'));var jsforce=require(_0x8668('0xe'));var deskjs=require(_0x8668('0xf'));var toCsv=require(_0x8668('0xa'));var querystring=require(_0x8668('0x10'));var Papa=require(_0x8668('0x11'));var Redis=require(_0x8668('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8668('0x13'))(_0x8668('0x14'));var utils=require(_0x8668('0x15'));var config=require(_0x8668('0x16'));var db=require(_0x8668('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x8668('0x18')]({'port':0x232a});function checkPasswordPattern(_0x118b00,_0x1440ef,_0x48311a){if(_0x48311a){var _0x3c8de8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c8de8[_0x8668('0x19')](_0x1440ef)){return _0x118b00;}else{throw new db[(_0x8668('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x118b00;}}function respondWithRpcPromise(_0x12c31e,_0x16fe4b,_0x1095ea,_0x20dd0a){return new BPromise(function(_0x5a68f6,_0x590e51){var _0x246506=_0x20dd0a||client;return _0x246506[_0x8668('0x1b')](_0x12c31e,_0x1095ea)[_0x8668('0x1c')](function(_0x43a3c9){logger[_0x8668('0x1d')](_0x8668('0x1e'),_0x16fe4b,'request\x20sent');logger[_0x8668('0x1f')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x16fe4b,'request\x20sent',JSON['stringify'](_0x43a3c9));if(_0x43a3c9['error']){if(_0x43a3c9[_0x8668('0x20')][_0x8668('0x21')]===0x1f4){logger[_0x8668('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x16fe4b,_0x43a3c9[_0x8668('0x20')]['message']);return _0x590e51(_0x43a3c9[_0x8668('0x20')][_0x8668('0x22')]);}logger[_0x8668('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x16fe4b,_0x43a3c9[_0x8668('0x20')][_0x8668('0x22')]);return _0x5a68f6(_0x43a3c9[_0x8668('0x20')]['message']);}else{logger[_0x8668('0x1d')](_0x8668('0x1e'),_0x16fe4b,_0x8668('0x23'));_0x5a68f6(_0x43a3c9[_0x8668('0x24')][_0x8668('0x22')]);}})[_0x8668('0x25')](function(_0xbd5c3a){logger[_0x8668('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x16fe4b,_0xbd5c3a);_0x590e51(_0xbd5c3a);});});}function respondWithStatusCode(_0x48f655,_0x3073d7){_0x3073d7=_0x3073d7||0xcc;return function(_0x3286e3){if(_0x3286e3){return _0x48f655[_0x8668('0x26')](_0x3073d7);}return _0x48f655[_0x8668('0x27')](_0x3073d7)['end']();};}function respondWithResult(_0xc765c8,_0x215cef){_0x215cef=_0x215cef||0xc8;return function(_0x459cf8){if(_0x459cf8){return _0xc765c8[_0x8668('0x27')](_0x215cef)[_0x8668('0x28')](_0x459cf8);}};}function respondWithFilteredResult(_0x5c5c14,_0x51fb3b){return function(_0x1f3035){if(_0x1f3035){var _0x105356=_0x1f3035[_0x8668('0x29')],_0x43b8d1=_0x51fb3b[_0x8668('0x2a')],_0x55ee78=_0x51fb3b[_0x8668('0x2a')]+_0x51fb3b['limit'],_0x1bc260;if(_0x55ee78>=_0x105356){_0x55ee78=_0x105356;_0x1bc260=0xc8;}else{_0x1bc260=0xce;}_0x5c5c14[_0x8668('0x27')](_0x1bc260);return _0x5c5c14[_0x8668('0x2b')](_0x8668('0x2c'),_0x43b8d1+'-'+_0x55ee78+'/'+_0x105356)[_0x8668('0x28')](_0x1f3035);}return null;};}function patchUpdates(_0x56ed97){return function(_0x213a58){try{jsonpatch[_0x8668('0x2d')](_0x213a58,_0x56ed97,!![]);}catch(_0x2d66c5){return BPromise['reject'](_0x2d66c5);}return _0x213a58[_0x8668('0x2e')]();};}function saveUpdates(_0x158833,_0x443245){return function(_0x3797e3){if(_0x3797e3){return _0x3797e3['update'](_0x158833)['then'](function(_0xe83805){return _0xe83805;});}return null;};}function removeEntity(_0x3e6498,_0x36e356){return function(_0x13c1da){if(_0x13c1da){return _0x13c1da['destroy']()[_0x8668('0x1c')](function(){_0x3e6498[_0x8668('0x27')](0xcc)[_0x8668('0x2f')]();});}};}function handleEntityNotFound(_0x59a9e0,_0x14c8f1){return function(_0x1adc35){if(!_0x1adc35){_0x59a9e0[_0x8668('0x26')](0x194);}return _0x1adc35;};}function handleError(_0x419a91,_0x509b11){_0x509b11=_0x509b11||0x1f4;return function(_0x31af14){logger['error'](_0x31af14[_0x8668('0x30')]);if(_0x31af14[_0x8668('0x31')]){delete _0x31af14['name'];}_0x419a91['status'](_0x509b11)[_0x8668('0x32')](_0x31af14);};}exports[_0x8668('0x33')]=function(_0x3be395,_0x5bd175){var _0x489fe9={},_0x24e902={},_0x48c14d={'count':0x0,'rows':[]};var _0x2e2c19=_[_0x8668('0x34')](db['DeskConfiguration'][_0x8668('0x35')],function(_0x59829e){return{'name':_0x59829e['fieldName'],'type':_0x59829e[_0x8668('0x36')]['key']};});_0x24e902[_0x8668('0x37')]=_[_0x8668('0x34')](_0x2e2c19,_0x8668('0x31'));_0x24e902[_0x8668('0x38')]=_[_0x8668('0x39')](_0x3be395[_0x8668('0x38')]);_0x24e902['filters']=_[_0x8668('0x3a')](_0x24e902[_0x8668('0x37')],_0x24e902[_0x8668('0x38')]);_0x489fe9[_0x8668('0x3b')]=_[_0x8668('0x3a')](_0x24e902[_0x8668('0x37')],qs[_0x8668('0x3c')](_0x3be395['query']['fields']));_0x489fe9[_0x8668('0x3b')]=_0x489fe9[_0x8668('0x3b')]['length']?_0x489fe9[_0x8668('0x3b')]:_0x24e902['model'];if(!_0x3be395[_0x8668('0x38')][_0x8668('0x3d')](_0x8668('0x3e'))){_0x489fe9['limit']=qs[_0x8668('0x3f')](_0x3be395[_0x8668('0x38')][_0x8668('0x3f')]);_0x489fe9['offset']=qs[_0x8668('0x2a')](_0x3be395[_0x8668('0x38')]['offset']);}_0x489fe9[_0x8668('0x40')]=qs[_0x8668('0x41')](_0x3be395[_0x8668('0x38')][_0x8668('0x41')]);_0x489fe9['where']=qs[_0x8668('0x42')](_[_0x8668('0x43')](_0x3be395[_0x8668('0x38')],_0x24e902[_0x8668('0x42')]),_0x2e2c19);if(_0x3be395[_0x8668('0x38')][_0x8668('0x44')]){_0x489fe9[_0x8668('0x45')]=_[_0x8668('0x46')](_0x489fe9['where'],{'$or':_[_0x8668('0x34')](_0x2e2c19,function(_0x3ae1eb){if(_0x3ae1eb['type']!==_0x8668('0x47')){var _0x27b91f={};_0x27b91f[_0x3ae1eb['name']]={'$like':'%'+_0x3be395[_0x8668('0x38')]['filter']+'%'};return _0x27b91f;}})});}_0x489fe9=_['merge']({},_0x489fe9,_0x3be395[_0x8668('0x48')]);var _0x56a3b9={'where':_0x489fe9[_0x8668('0x45')]};return db['DeskConfiguration']['count'](_0x56a3b9)[_0x8668('0x1c')](function(_0x184353){_0x48c14d['count']=_0x184353;if(_0x3be395[_0x8668('0x38')][_0x8668('0x49')]){_0x489fe9['include']=[{'all':!![]}];}return db[_0x8668('0x4a')][_0x8668('0x4b')](_0x489fe9);})['then'](function(_0x12c04b){_0x48c14d[_0x8668('0x4c')]=_0x12c04b;return _0x48c14d;})[_0x8668('0x1c')](respondWithFilteredResult(_0x5bd175,_0x489fe9))[_0x8668('0x25')](handleError(_0x5bd175,null));};exports[_0x8668('0x4d')]=function(_0x278f2e,_0xe4fecb){var _0x4e3680={'raw':![],'where':{'id':_0x278f2e[_0x8668('0x4e')]['id']}},_0x5138da={};_0x5138da[_0x8668('0x37')]=_[_0x8668('0x39')](db['DeskConfiguration'][_0x8668('0x35')]);_0x5138da[_0x8668('0x38')]=_[_0x8668('0x39')](_0x278f2e[_0x8668('0x38')]);_0x5138da[_0x8668('0x42')]=_[_0x8668('0x3a')](_0x5138da[_0x8668('0x37')],_0x5138da[_0x8668('0x38')]);_0x4e3680[_0x8668('0x3b')]=_['intersection'](_0x5138da['model'],qs[_0x8668('0x3c')](_0x278f2e[_0x8668('0x38')][_0x8668('0x3c')]));_0x4e3680['attributes']=_0x4e3680[_0x8668('0x3b')][_0x8668('0x4f')]?_0x4e3680[_0x8668('0x3b')]:_0x5138da[_0x8668('0x37')];if(_0x278f2e[_0x8668('0x38')][_0x8668('0x49')]){_0x4e3680[_0x8668('0x50')]=[{'all':!![]}];}_0x4e3680=_[_0x8668('0x46')]({},_0x4e3680,_0x278f2e['options']);return db[_0x8668('0x4a')][_0x8668('0x51')](_0x4e3680)['then'](handleEntityNotFound(_0xe4fecb,null))[_0x8668('0x1c')](respondWithResult(_0xe4fecb,null))[_0x8668('0x25')](handleError(_0xe4fecb,null));};exports[_0x8668('0x52')]=function(_0x2d8eb5,_0x5aa439){return db[_0x8668('0x4a')][_0x8668('0x52')](_0x2d8eb5[_0x8668('0x53')],{})[_0x8668('0x1c')](respondWithResult(_0x5aa439,0xc9))[_0x8668('0x25')](handleError(_0x5aa439,null));};exports[_0x8668('0x54')]=function(_0x1b19a6,_0x4d25a6){if(_0x1b19a6[_0x8668('0x53')]['id']){delete _0x1b19a6[_0x8668('0x53')]['id'];}return db[_0x8668('0x4a')][_0x8668('0x51')]({'where':{'id':_0x1b19a6[_0x8668('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d25a6,null))[_0x8668('0x1c')](saveUpdates(_0x1b19a6[_0x8668('0x53')],null))[_0x8668('0x1c')](respondWithResult(_0x4d25a6,null))[_0x8668('0x25')](handleError(_0x4d25a6,null));};exports[_0x8668('0x55')]=function(_0xb44544,_0x5077ed){return db[_0x8668('0x4a')][_0x8668('0x51')]({'where':{'id':_0xb44544['params']['id']}})['then'](handleEntityNotFound(_0x5077ed,null))[_0x8668('0x1c')](removeEntity(_0x5077ed,null))['catch'](handleError(_0x5077ed,null));};exports[_0x8668('0x56')]=function(_0x5aba00,_0x259830,_0x5dac22){var _0x180137={};var _0x9ca6e2={};var _0x1e63fc;var _0x1829ef;return db[_0x8668('0x4a')][_0x8668('0x57')]({'where':{'id':_0x5aba00['params']['id']}})[_0x8668('0x1c')](handleEntityNotFound(_0x259830,null))['then'](function(_0x45dc5f){if(_0x45dc5f){_0x1e63fc=_0x45dc5f;_0x9ca6e2['model']=_[_0x8668('0x39')](db['DeskField']['rawAttributes']);_0x9ca6e2[_0x8668('0x38')]=_[_0x8668('0x39')](_0x5aba00[_0x8668('0x38')]);_0x9ca6e2[_0x8668('0x42')]=_['intersection'](_0x9ca6e2[_0x8668('0x37')],_0x9ca6e2[_0x8668('0x38')]);_0x180137[_0x8668('0x3b')]=_[_0x8668('0x3a')](_0x9ca6e2[_0x8668('0x37')],qs[_0x8668('0x3c')](_0x5aba00[_0x8668('0x38')]['fields']));_0x180137[_0x8668('0x3b')]=_0x180137[_0x8668('0x3b')]['length']?_0x180137[_0x8668('0x3b')]:_0x9ca6e2[_0x8668('0x37')];_0x180137[_0x8668('0x40')]=qs[_0x8668('0x41')](_0x5aba00['query'][_0x8668('0x41')]);_0x180137['where']=qs[_0x8668('0x42')](_[_0x8668('0x43')](_0x5aba00[_0x8668('0x38')],_0x9ca6e2[_0x8668('0x42')]));if(_0x5aba00['query']['filter']){_0x180137[_0x8668('0x45')]=_[_0x8668('0x46')](_0x180137[_0x8668('0x45')],{'$or':_[_0x8668('0x34')](_0x180137[_0x8668('0x3b')],function(_0x9fe594){var _0x57d0cf={};_0x57d0cf[_0x9fe594]={'$like':'%'+_0x5aba00[_0x8668('0x38')][_0x8668('0x44')]+'%'};return _0x57d0cf;})});}_0x180137=_[_0x8668('0x46')]({},_0x180137,_0x5aba00[_0x8668('0x48')]);return _0x1e63fc['getFields'](_0x180137);}})[_0x8668('0x1c')](function(_0x1d19a1){if(_0x1d19a1){_0x1829ef=_0x1d19a1[_0x8668('0x4f')];if(!_0x5aba00[_0x8668('0x38')][_0x8668('0x3d')](_0x8668('0x3e'))){_0x180137[_0x8668('0x3f')]=qs['limit'](_0x5aba00[_0x8668('0x38')]['limit']);_0x180137[_0x8668('0x2a')]=qs[_0x8668('0x2a')](_0x5aba00['query'][_0x8668('0x2a')]);}return _0x1e63fc[_0x8668('0x56')](_0x180137);}})[_0x8668('0x1c')](function(_0x11d21d){if(_0x11d21d){return _0x11d21d?{'count':_0x1829ef,'rows':_0x11d21d}:null;}})['then'](respondWithResult(_0x259830,null))['catch'](handleError(_0x259830,null));};exports[_0x8668('0x58')]=function(_0x15969a,_0x18532a,_0x13d1f7){var _0x29cb6c={};var _0x544bb3={};var _0xc973dc;var _0xf03dc3;return db[_0x8668('0x4a')]['findOne']({'where':{'id':_0x15969a['params']['id']}})[_0x8668('0x1c')](handleEntityNotFound(_0x18532a,null))['then'](function(_0x396f95){if(_0x396f95){_0xc973dc=_0x396f95;_0x544bb3[_0x8668('0x37')]=_[_0x8668('0x39')](db['DeskField'][_0x8668('0x35')]);_0x544bb3[_0x8668('0x38')]=_[_0x8668('0x39')](_0x15969a[_0x8668('0x38')]);_0x544bb3[_0x8668('0x42')]=_[_0x8668('0x3a')](_0x544bb3[_0x8668('0x37')],_0x544bb3[_0x8668('0x38')]);_0x29cb6c[_0x8668('0x3b')]=_[_0x8668('0x3a')](_0x544bb3[_0x8668('0x37')],qs[_0x8668('0x3c')](_0x15969a[_0x8668('0x38')][_0x8668('0x3c')]));_0x29cb6c['attributes']=_0x29cb6c[_0x8668('0x3b')][_0x8668('0x4f')]?_0x29cb6c[_0x8668('0x3b')]:_0x544bb3[_0x8668('0x37')];_0x29cb6c['order']=qs['sort'](_0x15969a[_0x8668('0x38')][_0x8668('0x41')]);_0x29cb6c[_0x8668('0x45')]=qs[_0x8668('0x42')](_[_0x8668('0x43')](_0x15969a[_0x8668('0x38')],_0x544bb3[_0x8668('0x42')]));if(_0x15969a[_0x8668('0x38')]['filter']){_0x29cb6c[_0x8668('0x45')]=_[_0x8668('0x46')](_0x29cb6c['where'],{'$or':_[_0x8668('0x34')](_0x29cb6c[_0x8668('0x3b')],function(_0xf8412d){var _0x1486ff={};_0x1486ff[_0xf8412d]={'$like':'%'+_0x15969a[_0x8668('0x38')][_0x8668('0x44')]+'%'};return _0x1486ff;})});}_0x29cb6c=_['merge']({},_0x29cb6c,_0x15969a[_0x8668('0x48')]);return _0xc973dc[_0x8668('0x58')](_0x29cb6c);}})[_0x8668('0x1c')](function(_0x2c9852){if(_0x2c9852){_0xf03dc3=_0x2c9852['length'];if(!_0x15969a[_0x8668('0x38')]['hasOwnProperty'](_0x8668('0x3e'))){_0x29cb6c[_0x8668('0x3f')]=qs[_0x8668('0x3f')](_0x15969a[_0x8668('0x38')][_0x8668('0x3f')]);_0x29cb6c[_0x8668('0x2a')]=qs['offset'](_0x15969a[_0x8668('0x38')][_0x8668('0x2a')]);}return _0xc973dc['getSubjects'](_0x29cb6c);}})[_0x8668('0x1c')](function(_0x4c1f05){if(_0x4c1f05){return _0x4c1f05?{'count':_0xf03dc3,'rows':_0x4c1f05}:null;}})[_0x8668('0x1c')](respondWithResult(_0x18532a,null))[_0x8668('0x25')](handleError(_0x18532a,null));};exports[_0x8668('0x59')]=function(_0x58acd4,_0x646a5c,_0x5b37b5){var _0x30797a={};var _0x3adbc2={};var _0x2266e1;var _0x399871;return db['DeskConfiguration'][_0x8668('0x57')]({'where':{'id':_0x58acd4[_0x8668('0x4e')]['id']}})['then'](handleEntityNotFound(_0x646a5c,null))[_0x8668('0x1c')](function(_0x5d1965){if(_0x5d1965){_0x2266e1=_0x5d1965;_0x3adbc2[_0x8668('0x37')]=_[_0x8668('0x39')](db[_0x8668('0x5a')]['rawAttributes']);_0x3adbc2['query']=_[_0x8668('0x39')](_0x58acd4[_0x8668('0x38')]);_0x3adbc2['filters']=_['intersection'](_0x3adbc2['model'],_0x3adbc2['query']);_0x30797a[_0x8668('0x3b')]=_['intersection'](_0x3adbc2['model'],qs['fields'](_0x58acd4['query'][_0x8668('0x3c')]));_0x30797a[_0x8668('0x3b')]=_0x30797a[_0x8668('0x3b')][_0x8668('0x4f')]?_0x30797a[_0x8668('0x3b')]:_0x3adbc2['model'];_0x30797a[_0x8668('0x40')]=qs[_0x8668('0x41')](_0x58acd4[_0x8668('0x38')][_0x8668('0x41')]);_0x30797a[_0x8668('0x45')]=qs[_0x8668('0x42')](_['pick'](_0x58acd4[_0x8668('0x38')],_0x3adbc2['filters']));if(_0x58acd4[_0x8668('0x38')][_0x8668('0x44')]){_0x30797a[_0x8668('0x45')]=_[_0x8668('0x46')](_0x30797a['where'],{'$or':_[_0x8668('0x34')](_0x30797a[_0x8668('0x3b')],function(_0x438383){var _0x3511f6={};_0x3511f6[_0x438383]={'$like':'%'+_0x58acd4['query'][_0x8668('0x44')]+'%'};return _0x3511f6;})});}_0x30797a=_[_0x8668('0x46')]({},_0x30797a,_0x58acd4['options']);return _0x2266e1[_0x8668('0x59')](_0x30797a);}})[_0x8668('0x1c')](function(_0x1a8f9f){if(_0x1a8f9f){_0x399871=_0x1a8f9f[_0x8668('0x4f')];if(!_0x58acd4['query'][_0x8668('0x3d')](_0x8668('0x3e'))){_0x30797a[_0x8668('0x3f')]=qs[_0x8668('0x3f')](_0x58acd4[_0x8668('0x38')]['limit']);_0x30797a['offset']=qs[_0x8668('0x2a')](_0x58acd4[_0x8668('0x38')][_0x8668('0x2a')]);}return _0x2266e1[_0x8668('0x59')](_0x30797a);}})[_0x8668('0x1c')](function(_0x15566e){if(_0x15566e){return _0x15566e?{'count':_0x399871,'rows':_0x15566e}:null;}})[_0x8668('0x1c')](respondWithResult(_0x646a5c,null))[_0x8668('0x25')](handleError(_0x646a5c,null));};exports['getTags']=function(_0x409c75,_0x22e8c9,_0x52b3c8){var _0x13a066={};var _0xedbeee={};var _0x187c91;var _0x503139;return db[_0x8668('0x4a')]['findOne']({'where':{'id':_0x409c75[_0x8668('0x4e')]['id']}})[_0x8668('0x1c')](handleEntityNotFound(_0x22e8c9,null))[_0x8668('0x1c')](function(_0x17c47c){if(_0x17c47c){_0x187c91=_0x17c47c;_0xedbeee[_0x8668('0x37')]=_[_0x8668('0x39')](db[_0x8668('0x5b')][_0x8668('0x35')]);_0xedbeee[_0x8668('0x38')]=_[_0x8668('0x39')](_0x409c75['query']);_0xedbeee[_0x8668('0x42')]=_['intersection'](_0xedbeee['model'],_0xedbeee[_0x8668('0x38')]);_0x13a066[_0x8668('0x3b')]=_[_0x8668('0x3a')](_0xedbeee[_0x8668('0x37')],qs[_0x8668('0x3c')](_0x409c75[_0x8668('0x38')][_0x8668('0x3c')]));_0x13a066[_0x8668('0x3b')]=_0x13a066[_0x8668('0x3b')][_0x8668('0x4f')]?_0x13a066[_0x8668('0x3b')]:_0xedbeee[_0x8668('0x37')];_0x13a066[_0x8668('0x40')]=qs[_0x8668('0x41')](_0x409c75[_0x8668('0x38')]['sort']);_0x13a066[_0x8668('0x45')]=qs['filters'](_[_0x8668('0x43')](_0x409c75[_0x8668('0x38')],_0xedbeee['filters']));if(_0x409c75[_0x8668('0x38')][_0x8668('0x44')]){_0x13a066['where']=_['merge'](_0x13a066['where'],{'$or':_[_0x8668('0x34')](_0x13a066[_0x8668('0x3b')],function(_0x5cf846){var _0x2c993c={};_0x2c993c[_0x5cf846]={'$like':'%'+_0x409c75[_0x8668('0x38')]['filter']+'%'};return _0x2c993c;})});}_0x13a066=_[_0x8668('0x46')]({},_0x13a066,_0x409c75[_0x8668('0x48')]);return _0x187c91[_0x8668('0x5c')](_0x13a066);}})[_0x8668('0x1c')](function(_0x465cac){if(_0x465cac){_0x503139=_0x465cac[_0x8668('0x4f')];if(!_0x409c75['query'][_0x8668('0x3d')](_0x8668('0x3e'))){_0x13a066[_0x8668('0x3f')]=qs[_0x8668('0x3f')](_0x409c75[_0x8668('0x38')][_0x8668('0x3f')]);_0x13a066[_0x8668('0x2a')]=qs[_0x8668('0x2a')](_0x409c75[_0x8668('0x38')]['offset']);}return _0x187c91[_0x8668('0x5c')](_0x13a066);}})['then'](function(_0x14a77d){if(_0x14a77d){return _0x14a77d?{'count':_0x503139,'rows':_0x14a77d}:null;}})[_0x8668('0x1c')](respondWithResult(_0x22e8c9,null))[_0x8668('0x25')](handleError(_0x22e8c9,null));};exports[_0x8668('0x5d')]=function(_0x4a6a59,_0x228aa7,_0x14bc3d){if(_0x4a6a59[_0x8668('0x53')]['id']){delete _0x4a6a59[_0x8668('0x53')]['id'];}return db[_0x8668('0x4a')][_0x8668('0x57')]({'where':{'id':_0x4a6a59[_0x8668('0x4e')]['id']}})['then'](handleEntityNotFound(_0x228aa7,null))[_0x8668('0x1c')](function(_0x236422){if(_0x236422){return _0x236422[_0x8668('0x5d')](_0x4a6a59[_0x8668('0x53')]['ids']||[]);}return null;})[_0x8668('0x1c')](respondWithResult(_0x228aa7,null))[_0x8668('0x25')](handleError(_0x228aa7,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 6061111..e214025 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 _0xd75f=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','int_desk_configurations','lodash','util'];(function(_0x472ffe,_0x4ba6f2){var _0x5e50ef=function(_0x4a1a92){while(--_0x4a1a92){_0x472ffe['push'](_0x472ffe['shift']());}};_0x5e50ef(++_0x4ba6f2);}(_0xd75f,0xe5));var _0xfd75=function(_0x5f1ea0,_0x3b52a9){_0x5f1ea0=_0x5f1ea0-0x0;var _0x40c961=_0xd75f[_0x5f1ea0];return _0x40c961;};'use strict';var _=require(_0xfd75('0x0'));var util=require(_0xfd75('0x1'));var logger=require(_0xfd75('0x2'))(_0xfd75('0x3'));var moment=require(_0xfd75('0x4'));var BPromise=require('bluebird');var rp=require(_0xfd75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd75('0x6'));var config=require(_0xfd75('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xfd75('0x8')]=function(_0xc0003c,_0xdc0203){return _0xc0003c[_0xfd75('0x9')]('DeskConfiguration',attributes,{'tableName':_0xfd75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1aa6=['request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1aa6,0x14a));var _0x61aa=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x1aa6[_0x2df724];return _0x1b2504;};'use strict';var _=require(_0x61aa('0x0'));var util=require(_0x61aa('0x1'));var logger=require(_0x61aa('0x2'))(_0x61aa('0x3'));var moment=require(_0x61aa('0x4'));var BPromise=require(_0x61aa('0x5'));var rp=require(_0x61aa('0x6'));var fs=require('fs');var path=require(_0x61aa('0x7'));var rimraf=require('rimraf');var config=require(_0x61aa('0x8'));var attributes=require(_0x61aa('0x9'));module[_0x61aa('0xa')]=function(_0x442945,_0x4f1f19){return _0x442945[_0x61aa('0xb')](_0x61aa('0xc'),attributes,{'tableName':_0x61aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 8ad22d2..659baaa 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 _0x6599=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch'];(function(_0x1edbbf,_0x4e554b){var _0x2b578d=function(_0x11a22d){while(--_0x11a22d){_0x1edbbf['push'](_0x1edbbf['shift']());}};_0x2b578d(++_0x4e554b);}(_0x6599,0xb0));var _0x9659=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x6599[_0x4fdcc0];return _0xc0ce94;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var moment=require(_0x9659('0x1'));var BPromise=require(_0x9659('0x2'));var rs=require(_0x9659('0x3'));var fs=require('fs');var Redis=require(_0x9659('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9659('0x5'));var logger=require('../../config/logger')(_0x9659('0x6'));var config=require('../../config/environment');var jayson=require(_0x9659('0x7'));var client=jayson[_0x9659('0x8')][_0x9659('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x478dfa,_0x4e4402,_0xabdd12){return new BPromise(function(_0x14cb81,_0x4d0a52){return client[_0x9659('0xa')](_0x478dfa,_0xabdd12)['then'](function(_0x23f34a){logger[_0x9659('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x4e4402,_0x9659('0xc'));logger[_0x9659('0xd')](_0x9659('0xe'),_0x4e4402,'request\x20sent',JSON[_0x9659('0xf')](_0x23f34a));if(_0x23f34a['error']){if(_0x23f34a[_0x9659('0x10')][_0x9659('0x11')]===0x1f4){logger[_0x9659('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x4d0a52(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x14cb81(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}else{logger[_0x9659('0xb')](_0x9659('0x13'),_0x4e4402,_0x9659('0xc'));_0x14cb81(_0x23f34a[_0x9659('0x14')]['message']);}})[_0x9659('0x15')](function(_0xd1ab56){logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0xd1ab56);_0x4d0a52(_0xd1ab56);});});} \ No newline at end of file +var _0x33a4=['rpc','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x1b8664,_0x316fc3){var _0x84cd00=function(_0x252f47){while(--_0x252f47){_0x1b8664['push'](_0x1b8664['shift']());}};_0x84cd00(++_0x316fc3);}(_0x33a4,0x88));var _0x433a=function(_0x4a080c,_0x4320c5){_0x4a080c=_0x4a080c-0x0;var _0x4d88c9=_0x33a4[_0x4a080c];return _0x4d88c9;};'use strict';var _=require('lodash');var util=require(_0x433a('0x0'));var moment=require('moment');var BPromise=require(_0x433a('0x1'));var rs=require(_0x433a('0x2'));var fs=require('fs');var Redis=require(_0x433a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x433a('0x4'));var config=require(_0x433a('0x5'));var jayson=require(_0x433a('0x6'));var client=jayson[_0x433a('0x7')][_0x433a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fcc88,_0x422eb9,_0x58e65c){return new BPromise(function(_0x2c2404,_0x3156ec){return client[_0x433a('0x9')](_0x4fcc88,_0x58e65c)[_0x433a('0xa')](function(_0x4c1057){logger['info'](_0x433a('0xb'),_0x422eb9,_0x433a('0xc'));logger[_0x433a('0xd')](_0x433a('0xe'),_0x422eb9,_0x433a('0xc'),JSON['stringify'](_0x4c1057));if(_0x4c1057['error']){if(_0x4c1057[_0x433a('0xf')][_0x433a('0x10')]===0x1f4){logger[_0x433a('0xf')](_0x433a('0xb'),_0x422eb9,_0x4c1057['error'][_0x433a('0x11')]);return _0x3156ec(_0x4c1057[_0x433a('0xf')]['message']);}logger[_0x433a('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x422eb9,_0x4c1057[_0x433a('0xf')][_0x433a('0x11')]);return _0x2c2404(_0x4c1057[_0x433a('0xf')]['message']);}else{logger['info'](_0x433a('0xb'),_0x422eb9,_0x433a('0xc'));_0x2c2404(_0x4c1057[_0x433a('0x12')][_0x433a('0x11')]);}})[_0x433a('0x13')](function(_0x4df77a){logger['error'](_0x433a('0xb'),_0x422eb9,_0x4df77a);_0x3156ec(_0x4df77a);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ab2239c..3e4dd9e 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 _0xf3ac=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xf3ac,0x159));var _0xcf3a=function(_0x1a6bfb,_0x4adeaa){_0x1a6bfb=_0x1a6bfb-0x0;var _0x32ac3a=_0xf3ac[_0x1a6bfb];return _0x32ac3a;};'use strict';var multer=require(_0xcf3a('0x0'));var util=require(_0xcf3a('0x1'));var path=require(_0xcf3a('0x2'));var timeout=require(_0xcf3a('0x3'));var express=require('express');var router=express[_0xcf3a('0x4')]();var auth=require(_0xcf3a('0x5'));var interaction=require(_0xcf3a('0x6'));var config=require(_0xcf3a('0x7'));var controller=require('./intDeskField.controller');router[_0xcf3a('0x8')]('/',auth['isAuthenticated'](),controller[_0xcf3a('0x9')]);router['get'](_0xcf3a('0xa'),auth['isAuthenticated'](),controller[_0xcf3a('0xb')]);router[_0xcf3a('0xc')]('/',auth[_0xcf3a('0xd')](),controller[_0xcf3a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcf3a('0xf')](_0xcf3a('0xa'),auth[_0xcf3a('0xd')](),controller[_0xcf3a('0x10')]);module[_0xcf3a('0x11')]=router; \ No newline at end of file +var _0x783a=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','post','create','update','destroy'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x783a,0xc0));var _0xa783=function(_0x3ed24e,_0x20a13b){_0x3ed24e=_0x3ed24e-0x0;var _0x2bbf0f=_0x783a[_0x3ed24e];return _0x2bbf0f;};'use strict';var multer=require(_0xa783('0x0'));var util=require(_0xa783('0x1'));var path=require(_0xa783('0x2'));var timeout=require(_0xa783('0x3'));var express=require('express');var router=express[_0xa783('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa783('0x5'));var config=require(_0xa783('0x6'));var controller=require(_0xa783('0x7'));router[_0xa783('0x8')]('/',auth[_0xa783('0x9')](),controller[_0xa783('0xa')]);router[_0xa783('0x8')](_0xa783('0xb'),auth[_0xa783('0x9')](),controller['show']);router[_0xa783('0xc')]('/',auth[_0xa783('0x9')](),controller[_0xa783('0xd')]);router['put']('/:id',auth[_0xa783('0x9')](),controller[_0xa783('0xe')]);router['delete'](_0xa783('0xb'),auth['isAuthenticated'](),controller[_0xa783('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 6b35006..56ad924 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 _0xe0da=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x2388c9,_0x34f067){var _0x231203=function(_0x1f593f){while(--_0x1f593f){_0x2388c9['push'](_0x2388c9['shift']());}};_0x231203(++_0x34f067);}(_0xe0da,0x100));var _0xae0d=function(_0x4bcc07,_0x1caf6d){_0x4bcc07=_0x4bcc07-0x0;var _0xdfacab=_0xe0da[_0x4bcc07];return _0xdfacab;};'use strict';var Sequelize=require(_0xae0d('0x0'));module[_0xae0d('0x1')]={'type':{'type':Sequelize[_0xae0d('0x2')](_0xae0d('0x3'),_0xae0d('0x4'),_0xae0d('0x5'),_0xae0d('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xae0d('0x7')]},'key':{'type':Sequelize[_0xae0d('0x7')]},'keyType':{'type':Sequelize[_0xae0d('0x2')]('string',_0xae0d('0x4'),_0xae0d('0x5'))},'keyContent':{'type':Sequelize[_0xae0d('0x7')]},'idField':{'type':Sequelize[_0xae0d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc4d=['string','customVariable','STRING','sequelize','exports','ENUM'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdc4d,0x14d));var _0xddc4=function(_0x4987e9,_0x4bc691){_0x4987e9=_0x4987e9-0x0;var _0x4baa89=_0xdc4d[_0x4987e9];return _0x4baa89;};'use strict';var Sequelize=require(_0xddc4('0x0'));module[_0xddc4('0x1')]={'type':{'type':Sequelize[_0xddc4('0x2')](_0xddc4('0x3'),'variable',_0xddc4('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xddc4('0x5')]},'key':{'type':Sequelize[_0xddc4('0x5')]},'keyType':{'type':Sequelize[_0xddc4('0x2')](_0xddc4('0x3'),'variable',_0xddc4('0x4'))},'keyContent':{'type':Sequelize[_0xddc4('0x5')]},'idField':{'type':Sequelize[_0xddc4('0x5')]},'nameField':{'type':Sequelize[_0xddc4('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xddc4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 16cc3fc..bf4f208 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 _0x0dee=['destroy','error','stack','name','send','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','DeskField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0x505901,_0x1bd014){var _0x12c5ae=function(_0xcdb91e){while(--_0xcdb91e){_0x505901['push'](_0x505901['shift']());}};_0x12c5ae(++_0x1bd014);}(_0x0dee,0x135));var _0xe0de=function(_0x26dc7a,_0x25871e){_0x26dc7a=_0x26dc7a-0x0;var _0x510bd1=_0x0dee[_0x26dc7a];return _0x510bd1;};'use strict';var pdf=require(_0xe0de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0de('0x2'));var rp=require(_0xe0de('0x3'));var moment=require(_0xe0de('0x4'));var BPromise=require(_0xe0de('0x5'));var Mustache=require(_0xe0de('0x6'));var util=require(_0xe0de('0x7'));var path=require('path');var sox=require(_0xe0de('0x8'));var csv=require(_0xe0de('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe0de('0xa'));var crypto=require(_0xe0de('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe0de('0xc'));var toCsv=require(_0xe0de('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe0de('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe0de('0xe'));var hardwareService=require(_0xe0de('0xf'));var logger=require(_0xe0de('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xe0de('0x11'));var db=require(_0xe0de('0x12'))['db'];function respondWithStatusCode(_0xccd33f,_0x30c39c){_0x30c39c=_0x30c39c||0xcc;return function(_0x3d3ff5){if(_0x3d3ff5){return _0xccd33f[_0xe0de('0x13')](_0x30c39c);}return _0xccd33f[_0xe0de('0x14')](_0x30c39c)['end']();};}function respondWithResult(_0x1a3f2c,_0x6a0b78){_0x6a0b78=_0x6a0b78||0xc8;return function(_0x29910d){if(_0x29910d){return _0x1a3f2c[_0xe0de('0x14')](_0x6a0b78)[_0xe0de('0x15')](_0x29910d);}};}function respondWithFilteredResult(_0xfedb38,_0x156cb0){return function(_0x463904){if(_0x463904){var _0x2b771d=_0x463904[_0xe0de('0x16')],_0x1ca1a4=_0x156cb0[_0xe0de('0x17')],_0x316e6e=_0x156cb0['offset']+_0x156cb0[_0xe0de('0x18')],_0x240e3c;if(_0x316e6e>=_0x2b771d){_0x316e6e=_0x2b771d;_0x240e3c=0xc8;}else{_0x240e3c=0xce;}_0xfedb38[_0xe0de('0x14')](_0x240e3c);return _0xfedb38[_0xe0de('0x19')](_0xe0de('0x1a'),_0x1ca1a4+'-'+_0x316e6e+'/'+_0x2b771d)[_0xe0de('0x15')](_0x463904);}return null;};}function patchUpdates(_0x63df4a){return function(_0x3f50bb){try{jsonpatch[_0xe0de('0x1b')](_0x3f50bb,_0x63df4a,!![]);}catch(_0x9700e){return BPromise['reject'](_0x9700e);}return _0x3f50bb[_0xe0de('0x1c')]();};}function saveUpdates(_0x23fb22,_0x1d57c9){return function(_0x59dccc){if(_0x59dccc){return _0x59dccc[_0xe0de('0x1d')](_0x23fb22)[_0xe0de('0x1e')](function(_0x1e6f01){return _0x1e6f01;});}return null;};}function removeEntity(_0x1e0aea,_0x3b2353){return function(_0x291946){if(_0x291946){return _0x291946[_0xe0de('0x1f')]()[_0xe0de('0x1e')](function(){_0x1e0aea[_0xe0de('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d813d,_0x5a4052){return function(_0xf76adb){if(!_0xf76adb){_0x3d813d[_0xe0de('0x13')](0x194);}return _0xf76adb;};}function handleError(_0x407ca3,_0x5d8551){_0x5d8551=_0x5d8551||0x1f4;return function(_0x34494c){logger[_0xe0de('0x20')](_0x34494c[_0xe0de('0x21')]);if(_0x34494c[_0xe0de('0x22')]){delete _0x34494c['name'];}_0x407ca3[_0xe0de('0x14')](_0x5d8551)[_0xe0de('0x23')](_0x34494c);};}exports['index']=function(_0x310771,_0x41726d){var _0x314df4={},_0xa0993b={},_0x4c2eb5={'count':0x0,'rows':[]};var _0x5a7fb2=_['map'](db['DeskField']['rawAttributes'],function(_0x21a1c2){return{'name':_0x21a1c2[_0xe0de('0x24')],'type':_0x21a1c2[_0xe0de('0x25')][_0xe0de('0x26')]};});_0xa0993b[_0xe0de('0x27')]=_[_0xe0de('0x28')](_0x5a7fb2,_0xe0de('0x22'));_0xa0993b[_0xe0de('0x29')]=_[_0xe0de('0x2a')](_0x310771['query']);_0xa0993b[_0xe0de('0x2b')]=_[_0xe0de('0x2c')](_0xa0993b['model'],_0xa0993b[_0xe0de('0x29')]);_0x314df4[_0xe0de('0x2d')]=_[_0xe0de('0x2c')](_0xa0993b['model'],qs['fields'](_0x310771['query'][_0xe0de('0x2e')]));_0x314df4[_0xe0de('0x2d')]=_0x314df4[_0xe0de('0x2d')][_0xe0de('0x2f')]?_0x314df4[_0xe0de('0x2d')]:_0xa0993b['model'];if(!_0x310771['query'][_0xe0de('0x30')]('nolimit')){_0x314df4[_0xe0de('0x18')]=qs['limit'](_0x310771[_0xe0de('0x29')][_0xe0de('0x18')]);_0x314df4['offset']=qs['offset'](_0x310771[_0xe0de('0x29')][_0xe0de('0x17')]);}_0x314df4[_0xe0de('0x31')]=qs[_0xe0de('0x32')](_0x310771[_0xe0de('0x29')][_0xe0de('0x32')]);_0x314df4[_0xe0de('0x33')]=qs['filters'](_[_0xe0de('0x34')](_0x310771['query'],_0xa0993b[_0xe0de('0x2b')]),_0x5a7fb2);if(_0x310771[_0xe0de('0x29')]['filter']){_0x314df4[_0xe0de('0x33')]=_[_0xe0de('0x35')](_0x314df4[_0xe0de('0x33')],{'$or':_[_0xe0de('0x28')](_0x5a7fb2,function(_0x2854a2){if(_0x2854a2[_0xe0de('0x25')]!=='VIRTUAL'){var _0xb477b5={};_0xb477b5[_0x2854a2[_0xe0de('0x22')]]={'$like':'%'+_0x310771[_0xe0de('0x29')][_0xe0de('0x36')]+'%'};return _0xb477b5;}})});}_0x314df4=_[_0xe0de('0x35')]({},_0x314df4,_0x310771[_0xe0de('0x37')]);var _0x288d83={'where':_0x314df4[_0xe0de('0x33')]};return db[_0xe0de('0x38')][_0xe0de('0x16')](_0x288d83)[_0xe0de('0x1e')](function(_0xf97f71){_0x4c2eb5['count']=_0xf97f71;if(_0x310771[_0xe0de('0x29')][_0xe0de('0x39')]){_0x314df4[_0xe0de('0x3a')]=[{'all':!![]}];}return db[_0xe0de('0x38')][_0xe0de('0x3b')](_0x314df4);})[_0xe0de('0x1e')](function(_0x3fd179){_0x4c2eb5[_0xe0de('0x3c')]=_0x3fd179;return _0x4c2eb5;})[_0xe0de('0x1e')](respondWithFilteredResult(_0x41726d,_0x314df4))[_0xe0de('0x3d')](handleError(_0x41726d,null));};exports[_0xe0de('0x3e')]=function(_0x2dd66a,_0x2098b0){var _0x271537={'raw':!![],'where':{'id':_0x2dd66a[_0xe0de('0x3f')]['id']}},_0x2f4c2d={};_0x2f4c2d['model']=_[_0xe0de('0x2a')](db[_0xe0de('0x38')][_0xe0de('0x40')]);_0x2f4c2d[_0xe0de('0x29')]=_[_0xe0de('0x2a')](_0x2dd66a[_0xe0de('0x29')]);_0x2f4c2d['filters']=_[_0xe0de('0x2c')](_0x2f4c2d[_0xe0de('0x27')],_0x2f4c2d[_0xe0de('0x29')]);_0x271537[_0xe0de('0x2d')]=_[_0xe0de('0x2c')](_0x2f4c2d['model'],qs['fields'](_0x2dd66a['query'][_0xe0de('0x2e')]));_0x271537[_0xe0de('0x2d')]=_0x271537['attributes'][_0xe0de('0x2f')]?_0x271537[_0xe0de('0x2d')]:_0x2f4c2d[_0xe0de('0x27')];if(_0x2dd66a[_0xe0de('0x29')]['includeAll']){_0x271537[_0xe0de('0x3a')]=[{'all':!![]}];}_0x271537=_[_0xe0de('0x35')]({},_0x271537,_0x2dd66a['options']);return db[_0xe0de('0x38')][_0xe0de('0x41')](_0x271537)['then'](handleEntityNotFound(_0x2098b0,null))['then'](respondWithResult(_0x2098b0,null))[_0xe0de('0x3d')](handleError(_0x2098b0,null));};exports[_0xe0de('0x42')]=function(_0x361e08,_0x5e79c5){return db[_0xe0de('0x38')][_0xe0de('0x42')](_0x361e08[_0xe0de('0x43')],{})[_0xe0de('0x1e')](respondWithResult(_0x5e79c5,0xc9))[_0xe0de('0x3d')](handleError(_0x5e79c5,null));};exports[_0xe0de('0x1d')]=function(_0x1bcbef,_0x203662){if(_0x1bcbef[_0xe0de('0x43')]['id']){delete _0x1bcbef[_0xe0de('0x43')]['id'];}return db[_0xe0de('0x38')][_0xe0de('0x41')]({'where':{'id':_0x1bcbef[_0xe0de('0x3f')]['id']}})[_0xe0de('0x1e')](handleEntityNotFound(_0x203662,null))[_0xe0de('0x1e')](saveUpdates(_0x1bcbef[_0xe0de('0x43')],null))[_0xe0de('0x1e')](respondWithResult(_0x203662,null))[_0xe0de('0x3d')](handleError(_0x203662,null));};exports[_0xe0de('0x1f')]=function(_0x30b28c,_0x9f969c){return db['DeskField']['find']({'where':{'id':_0x30b28c[_0xe0de('0x3f')]['id']}})['then'](handleEntityNotFound(_0x9f969c,null))['then'](removeEntity(_0x9f969c,null))[_0xe0de('0x3d')](handleError(_0x9f969c,null));}; \ No newline at end of file +var _0x66a9=['destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','reject','save','update','then','error','stack','name','map','DeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body'];(function(_0x26e9da,_0x4ca5a7){var _0x45ed73=function(_0x4a1a5a){while(--_0x4a1a5a){_0x26e9da['push'](_0x26e9da['shift']());}};_0x45ed73(++_0x4ca5a7);}(_0x66a9,0x1b7));var _0x966a=function(_0x4ca1b8,_0x9faad5){_0x4ca1b8=_0x4ca1b8-0x0;var _0x49b9e4=_0x66a9[_0x4ca1b8];return _0x49b9e4;};'use strict';var pdf=require(_0x966a('0x0'));var emlformat=require(_0x966a('0x1'));var rimraf=require(_0x966a('0x2'));var zipdir=require(_0x966a('0x3'));var jsonpatch=require(_0x966a('0x4'));var rp=require(_0x966a('0x5'));var moment=require(_0x966a('0x6'));var BPromise=require(_0x966a('0x7'));var Mustache=require('mustache');var util=require(_0x966a('0x8'));var path=require('path');var sox=require(_0x966a('0x9'));var csv=require('to-csv');var ejs=require(_0x966a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x966a('0xb'));var crypto=require(_0x966a('0xc'));var jsforce=require(_0x966a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x966a('0xe'));var querystring=require(_0x966a('0xf'));var Papa=require(_0x966a('0x10'));var Redis=require(_0x966a('0x11'));var authService=require(_0x966a('0x12'));var qs=require(_0x966a('0x13'));var as=require(_0x966a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x966a('0x15'))(_0x966a('0x16'));var utils=require(_0x966a('0x17'));var config=require(_0x966a('0x18'));var db=require(_0x966a('0x19'))['db'];function respondWithStatusCode(_0x3873f0,_0x30e691){_0x30e691=_0x30e691||0xcc;return function(_0x3aba88){if(_0x3aba88){return _0x3873f0[_0x966a('0x1a')](_0x30e691);}return _0x3873f0[_0x966a('0x1b')](_0x30e691)[_0x966a('0x1c')]();};}function respondWithResult(_0x399172,_0x285c51){_0x285c51=_0x285c51||0xc8;return function(_0x249043){if(_0x249043){return _0x399172[_0x966a('0x1b')](_0x285c51)[_0x966a('0x1d')](_0x249043);}};}function respondWithFilteredResult(_0xe2e43f,_0x339556){return function(_0x5ac13a){if(_0x5ac13a){var _0x47c9da=_0x5ac13a[_0x966a('0x1e')],_0x43fba8=_0x339556['offset'],_0x15b9ea=_0x339556['offset']+_0x339556[_0x966a('0x1f')],_0x1be99d;if(_0x15b9ea>=_0x47c9da){_0x15b9ea=_0x47c9da;_0x1be99d=0xc8;}else{_0x1be99d=0xce;}_0xe2e43f['status'](_0x1be99d);return _0xe2e43f['set']('Content-Range',_0x43fba8+'-'+_0x15b9ea+'/'+_0x47c9da)[_0x966a('0x1d')](_0x5ac13a);}return null;};}function patchUpdates(_0x36a110){return function(_0x1c77ff){try{jsonpatch['apply'](_0x1c77ff,_0x36a110,!![]);}catch(_0x4756d0){return BPromise[_0x966a('0x20')](_0x4756d0);}return _0x1c77ff[_0x966a('0x21')]();};}function saveUpdates(_0x1043df,_0x2a3428){return function(_0x295e64){if(_0x295e64){return _0x295e64[_0x966a('0x22')](_0x1043df)['then'](function(_0x5eaf9d){return _0x5eaf9d;});}return null;};}function removeEntity(_0x54e569,_0x5e9cf9){return function(_0x26ab4d){if(_0x26ab4d){return _0x26ab4d['destroy']()[_0x966a('0x23')](function(){_0x54e569['status'](0xcc)[_0x966a('0x1c')]();});}};}function handleEntityNotFound(_0x578e40,_0x53afc7){return function(_0x5a1cae){if(!_0x5a1cae){_0x578e40[_0x966a('0x1a')](0x194);}return _0x5a1cae;};}function handleError(_0x1b03c6,_0x1936c5){_0x1936c5=_0x1936c5||0x1f4;return function(_0x5767f8){logger[_0x966a('0x24')](_0x5767f8[_0x966a('0x25')]);if(_0x5767f8[_0x966a('0x26')]){delete _0x5767f8[_0x966a('0x26')];}_0x1b03c6[_0x966a('0x1b')](_0x1936c5)['send'](_0x5767f8);};}exports['index']=function(_0x4f5e5e,_0x2c95c9){var _0x32c43c={},_0x593cec={},_0xaf567b={'count':0x0,'rows':[]};var _0x1fdd3a=_[_0x966a('0x27')](db[_0x966a('0x28')][_0x966a('0x29')],function(_0x33fab5){return{'name':_0x33fab5[_0x966a('0x2a')],'type':_0x33fab5[_0x966a('0x2b')]['key']};});_0x593cec[_0x966a('0x2c')]=_[_0x966a('0x27')](_0x1fdd3a,_0x966a('0x26'));_0x593cec[_0x966a('0x2d')]=_[_0x966a('0x2e')](_0x4f5e5e[_0x966a('0x2d')]);_0x593cec[_0x966a('0x2f')]=_[_0x966a('0x30')](_0x593cec[_0x966a('0x2c')],_0x593cec['query']);_0x32c43c[_0x966a('0x31')]=_[_0x966a('0x30')](_0x593cec[_0x966a('0x2c')],qs[_0x966a('0x32')](_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x32')]));_0x32c43c['attributes']=_0x32c43c[_0x966a('0x31')][_0x966a('0x33')]?_0x32c43c['attributes']:_0x593cec['model'];if(!_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x34')](_0x966a('0x35'))){_0x32c43c[_0x966a('0x1f')]=qs[_0x966a('0x1f')](_0x4f5e5e['query']['limit']);_0x32c43c[_0x966a('0x36')]=qs[_0x966a('0x36')](_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x36')]);}_0x32c43c[_0x966a('0x37')]=qs[_0x966a('0x38')](_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x38')]);_0x32c43c[_0x966a('0x39')]=qs['filters'](_[_0x966a('0x3a')](_0x4f5e5e[_0x966a('0x2d')],_0x593cec[_0x966a('0x2f')]),_0x1fdd3a);if(_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x3b')]){_0x32c43c[_0x966a('0x39')]=_['merge'](_0x32c43c[_0x966a('0x39')],{'$or':_[_0x966a('0x27')](_0x1fdd3a,function(_0x134bbb){if(_0x134bbb['type']!==_0x966a('0x3c')){var _0x35e993={};_0x35e993[_0x134bbb['name']]={'$like':'%'+_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x3b')]+'%'};return _0x35e993;}})});}_0x32c43c=_[_0x966a('0x3d')]({},_0x32c43c,_0x4f5e5e[_0x966a('0x3e')]);var _0x210ced={'where':_0x32c43c[_0x966a('0x39')]};return db[_0x966a('0x28')][_0x966a('0x1e')](_0x210ced)['then'](function(_0x435bd6){_0xaf567b[_0x966a('0x1e')]=_0x435bd6;if(_0x4f5e5e[_0x966a('0x2d')]['includeAll']){_0x32c43c[_0x966a('0x3f')]=[{'all':!![]}];}return db['DeskField'][_0x966a('0x40')](_0x32c43c);})['then'](function(_0x3042eb){_0xaf567b['rows']=_0x3042eb;return _0xaf567b;})['then'](respondWithFilteredResult(_0x2c95c9,_0x32c43c))[_0x966a('0x41')](handleError(_0x2c95c9,null));};exports[_0x966a('0x42')]=function(_0x3329f0,_0x3cda8c){var _0x10f40a={'raw':!![],'where':{'id':_0x3329f0[_0x966a('0x43')]['id']}},_0x382d6e={};_0x382d6e[_0x966a('0x2c')]=_[_0x966a('0x2e')](db[_0x966a('0x28')][_0x966a('0x29')]);_0x382d6e[_0x966a('0x2d')]=_[_0x966a('0x2e')](_0x3329f0[_0x966a('0x2d')]);_0x382d6e['filters']=_[_0x966a('0x30')](_0x382d6e[_0x966a('0x2c')],_0x382d6e['query']);_0x10f40a[_0x966a('0x31')]=_[_0x966a('0x30')](_0x382d6e['model'],qs['fields'](_0x3329f0[_0x966a('0x2d')][_0x966a('0x32')]));_0x10f40a[_0x966a('0x31')]=_0x10f40a['attributes'][_0x966a('0x33')]?_0x10f40a[_0x966a('0x31')]:_0x382d6e['model'];if(_0x3329f0[_0x966a('0x2d')][_0x966a('0x44')]){_0x10f40a[_0x966a('0x3f')]=[{'all':!![]}];}_0x10f40a=_[_0x966a('0x3d')]({},_0x10f40a,_0x3329f0['options']);return db[_0x966a('0x28')][_0x966a('0x45')](_0x10f40a)['then'](handleEntityNotFound(_0x3cda8c,null))['then'](respondWithResult(_0x3cda8c,null))[_0x966a('0x41')](handleError(_0x3cda8c,null));};exports[_0x966a('0x46')]=function(_0xc6122f,_0x181d31){return db[_0x966a('0x28')]['create'](_0xc6122f[_0x966a('0x47')],{})['then'](respondWithResult(_0x181d31,0xc9))[_0x966a('0x41')](handleError(_0x181d31,null));};exports['update']=function(_0x2a247e,_0x17ba73){if(_0x2a247e['body']['id']){delete _0x2a247e[_0x966a('0x47')]['id'];}return db[_0x966a('0x28')][_0x966a('0x45')]({'where':{'id':_0x2a247e[_0x966a('0x43')]['id']}})['then'](handleEntityNotFound(_0x17ba73,null))['then'](saveUpdates(_0x2a247e[_0x966a('0x47')],null))[_0x966a('0x23')](respondWithResult(_0x17ba73,null))[_0x966a('0x41')](handleError(_0x17ba73,null));};exports[_0x966a('0x48')]=function(_0x350a89,_0x19dd2f){return db[_0x966a('0x28')]['find']({'where':{'id':_0x350a89[_0x966a('0x43')]['id']}})[_0x966a('0x23')](handleEntityNotFound(_0x19dd2f,null))[_0x966a('0x23')](removeEntity(_0x19dd2f,null))[_0x966a('0x41')](handleError(_0x19dd2f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 81c37d8..3a03aab 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 _0x3585=['api','bluebird','path','rimraf','../../config/environment','exports','DeskField','desk_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x33ba98,_0x536552){var _0x31cf7b=function(_0x221874){while(--_0x221874){_0x33ba98['push'](_0x33ba98['shift']());}};_0x31cf7b(++_0x536552);}(_0x3585,0x11e));var _0x5358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3585[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5358('0x0'));var logger=require(_0x5358('0x1'))(_0x5358('0x2'));var moment=require('moment');var BPromise=require(_0x5358('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5358('0x4'));var rimraf=require(_0x5358('0x5'));var config=require(_0x5358('0x6'));var attributes=require('./intDeskField.attributes');module[_0x5358('0x7')]=function(_0x16e04a,_0x313b1d){return _0x16e04a['define'](_0x5358('0x8'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x5358('0x9'),'fields':[_0x5358('0xa'),_0x5358('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e53=['int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','DeskField'];(function(_0x1cd5fe,_0x94ba03){var _0x57b44f=function(_0x3f4ea5){while(--_0x3f4ea5){_0x1cd5fe['push'](_0x1cd5fe['shift']());}};_0x57b44f(++_0x94ba03);}(_0x1e53,0x199));var _0x31e5=function(_0x45e18e,_0x47cc4d){_0x45e18e=_0x45e18e-0x0;var _0x175e61=_0x1e53[_0x45e18e];return _0x175e61;};'use strict';var _=require(_0x31e5('0x0'));var util=require(_0x31e5('0x1'));var logger=require(_0x31e5('0x2'))(_0x31e5('0x3'));var moment=require(_0x31e5('0x4'));var BPromise=require('bluebird');var rp=require(_0x31e5('0x5'));var fs=require('fs');var path=require(_0x31e5('0x6'));var rimraf=require(_0x31e5('0x7'));var config=require(_0x31e5('0x8'));var attributes=require('./intDeskField.attributes');module[_0x31e5('0x9')]=function(_0x2bae49,_0x2a081d){return _0x2bae49['define'](_0x31e5('0xa'),attributes,{'tableName':_0x31e5('0xb'),'paranoid':![],'indexes':[{'name':_0x31e5('0xc'),'fields':['idField',_0x31e5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 1c795ec..abe9b37 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 _0x7bac=['info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x2ac7fd,_0xbccc19){var _0x520996=function(_0x4e9a7b){while(--_0x4e9a7b){_0x2ac7fd['push'](_0x2ac7fd['shift']());}};_0x520996(++_0xbccc19);}(_0x7bac,0x181));var _0xc7ba=function(_0x1c3315,_0x5a8bec){_0x1c3315=_0x1c3315-0x0;var _0x2f7954=_0x7bac[_0x1c3315];return _0x2f7954;};'use strict';var _=require(_0xc7ba('0x0'));var util=require(_0xc7ba('0x1'));var moment=require(_0xc7ba('0x2'));var BPromise=require(_0xc7ba('0x3'));var rs=require(_0xc7ba('0x4'));var fs=require('fs');var Redis=require(_0xc7ba('0x5'));var db=require(_0xc7ba('0x6'))['db'];var utils=require(_0xc7ba('0x7'));var logger=require(_0xc7ba('0x8'))(_0xc7ba('0x9'));var config=require(_0xc7ba('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc7ba('0xb')][_0xc7ba('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1390cb,_0x191ad8,_0x55b0cf){return new BPromise(function(_0x48fed2,_0x533c41){return client[_0xc7ba('0xd')](_0x1390cb,_0x55b0cf)[_0xc7ba('0xe')](function(_0xeff114){logger[_0xc7ba('0xf')](_0xc7ba('0x10'),_0x191ad8,'request\x20sent');logger[_0xc7ba('0x11')](_0xc7ba('0x12'),_0x191ad8,_0xc7ba('0x13'),JSON['stringify'](_0xeff114));if(_0xeff114['error']){if(_0xeff114[_0xc7ba('0x14')][_0xc7ba('0x15')]===0x1f4){logger[_0xc7ba('0x14')](_0xc7ba('0x10'),_0x191ad8,_0xeff114[_0xc7ba('0x14')][_0xc7ba('0x16')]);return _0x533c41(_0xeff114[_0xc7ba('0x14')][_0xc7ba('0x16')]);}logger['error'](_0xc7ba('0x10'),_0x191ad8,_0xeff114[_0xc7ba('0x14')][_0xc7ba('0x16')]);return _0x48fed2(_0xeff114[_0xc7ba('0x14')]['message']);}else{logger['info'](_0xc7ba('0x10'),_0x191ad8,_0xc7ba('0x13'));_0x48fed2(_0xeff114[_0xc7ba('0x17')][_0xc7ba('0x16')]);}})[_0xc7ba('0x18')](function(_0xb245f2){logger[_0xc7ba('0x14')](_0xc7ba('0x10'),_0x191ad8,_0xb245f2);_0x533c41(_0xb245f2);});});} \ No newline at end of file +var _0x160a=['rpc','jayson/promise','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','DeskField,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x160a,0x116));var _0xa160=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x160a[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0xa160('0x0'));var util=require(_0xa160('0x1'));var moment=require(_0xa160('0x2'));var BPromise=require(_0xa160('0x3'));var rs=require(_0xa160('0x4'));var fs=require('fs');var Redis=require(_0xa160('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa160('0x6'))(_0xa160('0x7'));var config=require('../../config/environment');var jayson=require(_0xa160('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d6893,_0x5efda2,_0x35096b){return new BPromise(function(_0x2f2dd7,_0x362c1c){return client['request'](_0x2d6893,_0x35096b)[_0xa160('0x9')](function(_0x3fc9d0){logger[_0xa160('0xa')]('DeskField,\x20%s,\x20%s',_0x5efda2,_0xa160('0xb'));logger[_0xa160('0xc')](_0xa160('0xd'),_0x5efda2,'request\x20sent',JSON['stringify'](_0x3fc9d0));if(_0x3fc9d0[_0xa160('0xe')]){if(_0x3fc9d0['error'][_0xa160('0xf')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x5efda2,_0x3fc9d0['error']['message']);return _0x362c1c(_0x3fc9d0['error'][_0xa160('0x10')]);}logger[_0xa160('0xe')](_0xa160('0x11'),_0x5efda2,_0x3fc9d0[_0xa160('0xe')][_0xa160('0x10')]);return _0x2f2dd7(_0x3fc9d0[_0xa160('0xe')][_0xa160('0x10')]);}else{logger[_0xa160('0xa')](_0xa160('0x11'),_0x5efda2,_0xa160('0xb'));_0x2f2dd7(_0x3fc9d0[_0xa160('0x12')][_0xa160('0x10')]);}})['catch'](function(_0x27a012){logger[_0xa160('0xe')](_0xa160('0x11'),_0x5efda2,_0x27a012);_0x362c1c(_0x27a012);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 68b12ed..ae4cbb6 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 _0xd602=['update','delete','/:id','destroy','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','show','/:id/configurations','getFields','addConfiguration'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd602,0x115));var _0x2d60=function(_0x3c3ae7,_0x25ed21){_0x3c3ae7=_0x3c3ae7-0x0;var _0x4c53a7=_0xd602[_0x3c3ae7];return _0x4c53a7;};'use strict';var multer=require('multer');var util=require(_0x2d60('0x0'));var path=require('path');var timeout=require(_0x2d60('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2d60('0x2'));var config=require(_0x2d60('0x3'));var controller=require(_0x2d60('0x4'));router[_0x2d60('0x5')]('/',auth[_0x2d60('0x6')](),controller['index']);router[_0x2d60('0x5')]('/:id',auth[_0x2d60('0x6')](),controller[_0x2d60('0x7')]);router[_0x2d60('0x5')](_0x2d60('0x8'),auth[_0x2d60('0x6')](),controller['getConfigurations']);router[_0x2d60('0x5')]('/:id/fields',auth[_0x2d60('0x6')](),controller[_0x2d60('0x9')]);router['post']('/',auth[_0x2d60('0x6')](),controller['create']);router['post'](_0x2d60('0x8'),auth[_0x2d60('0x6')](),controller[_0x2d60('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2d60('0xb')]);router[_0x2d60('0xc')](_0x2d60('0xd'),auth[_0x2d60('0x6')](),controller[_0x2d60('0xe')]);module[_0x2d60('0xf')]=router; \ No newline at end of file +var _0xef2b=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x58f8d6,_0x3de6e9){var _0x249399=function(_0x5a2d88){while(--_0x5a2d88){_0x58f8d6['push'](_0x58f8d6['shift']());}};_0x249399(++_0x3de6e9);}(_0xef2b,0x13a));var _0xbef2=function(_0x126f3b,_0x4b76ec){_0x126f3b=_0x126f3b-0x0;var _0x5d83b8=_0xef2b[_0x126f3b];return _0x5d83b8;};'use strict';var multer=require(_0xbef2('0x0'));var util=require(_0xbef2('0x1'));var path=require(_0xbef2('0x2'));var timeout=require('connect-timeout');var express=require(_0xbef2('0x3'));var router=express[_0xbef2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbef2('0x5'));var config=require(_0xbef2('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xbef2('0x7')]('/',auth[_0xbef2('0x8')](),controller[_0xbef2('0x9')]);router[_0xbef2('0x7')](_0xbef2('0xa'),auth[_0xbef2('0x8')](),controller['show']);router[_0xbef2('0x7')](_0xbef2('0xb'),auth['isAuthenticated'](),controller[_0xbef2('0xc')]);router[_0xbef2('0x7')](_0xbef2('0xd'),auth['isAuthenticated'](),controller[_0xbef2('0xe')]);router[_0xbef2('0xf')]('/',auth['isAuthenticated'](),controller[_0xbef2('0x10')]);router['post'](_0xbef2('0xb'),auth['isAuthenticated'](),controller[_0xbef2('0x11')]);router[_0xbef2('0x12')](_0xbef2('0xa'),auth['isAuthenticated'](),controller[_0xbef2('0x13')]);router[_0xbef2('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xbef2('0x15')]);module[_0xbef2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index e7768de..d867a4d 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 _0xc8ac=['STRING','sequelize','exports'];(function(_0x5e20e0,_0x345246){var _0x2e0630=function(_0x2fa0e2){while(--_0x2fa0e2){_0x5e20e0['push'](_0x5e20e0['shift']());}};_0x2e0630(++_0x345246);}(_0xc8ac,0xb5));var _0xcc8a=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xc8ac[_0x1b51ea];return _0x18bbdc;};'use strict';var Sequelize=require(_0xcc8a('0x0'));module[_0xcc8a('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcc8a('0x2')]},'password':{'type':Sequelize[_0xcc8a('0x2')]},'remoteUri':{'type':Sequelize[_0xcc8a('0x2')]},'tenantId':{'type':Sequelize[_0xcc8a('0x2')]},'clientId':{'type':Sequelize[_0xcc8a('0x2')]},'clientSecret':{'type':Sequelize[_0xcc8a('0x2')]},'serverUrl':{'type':Sequelize[_0xcc8a('0x2')]},'description':{'type':Sequelize[_0xcc8a('0x2')]}}; \ No newline at end of file +var _0x5dcd=['sequelize','exports','STRING'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x5dcd,0x1bc));var _0xd5dc=function(_0x2a9633,_0x3fbfa8){_0x2a9633=_0x2a9633-0x0;var _0x56a4ee=_0x5dcd[_0x2a9633];return _0x56a4ee;};'use strict';var Sequelize=require(_0xd5dc('0x0'));module[_0xd5dc('0x1')]={'name':{'type':Sequelize[_0xd5dc('0x2')]},'username':{'type':Sequelize[_0xd5dc('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd5dc('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd5dc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d923202..d39fccf 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 _0x5005=['../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','Dynamics365Account','findAll','catch','show','params','find','create','body','destroy','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','password','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','username','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','Label','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','OptionSet','FalseOption','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x5005,0xbf));var _0x5500=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x5005[_0x43576f];return _0x4d2466;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5500('0x0'));var rimraf=require(_0x5500('0x1'));var zipdir=require(_0x5500('0x2'));var jsonpatch=require(_0x5500('0x3'));var rp=require(_0x5500('0x4'));var moment=require(_0x5500('0x5'));var BPromise=require(_0x5500('0x6'));var Mustache=require(_0x5500('0x7'));var util=require(_0x5500('0x8'));var path=require('path');var sox=require(_0x5500('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5500('0xa'));var crypto=require('crypto');var jsforce=require(_0x5500('0xb'));var deskjs=require(_0x5500('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5500('0xd'));var Papa=require(_0x5500('0xe'));var Redis=require(_0x5500('0xf'));var authService=require(_0x5500('0x10'));var qs=require(_0x5500('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5500('0x12'));var logger=require('../../config/logger')(_0x5500('0x13'));var utils=require(_0x5500('0x14'));var config=require(_0x5500('0x15'));var db=require(_0x5500('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x5500('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x209332,_0x4d0582,_0x1af582){if(_0x1af582){var _0x2a8525=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a8525[_0x5500('0x18')](_0x4d0582)){return _0x209332;}else{throw new db[(_0x5500('0x19'))][(_0x5500('0x1a'))](_0x5500('0x1b'));}}else{return _0x209332;}}function respondWithRpcPromise(_0x2a1588,_0x444dd6,_0x3349b7,_0x53f816){return new BPromise(function(_0x471933,_0x3e742e){var _0x41b5c3=_0x53f816||client;return _0x41b5c3[_0x5500('0x1c')](_0x2a1588,_0x3349b7)[_0x5500('0x1d')](function(_0x528083){logger[_0x5500('0x1e')](_0x5500('0x1f'),_0x444dd6,_0x5500('0x20'));logger[_0x5500('0x21')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x444dd6,_0x5500('0x20'),JSON['stringify'](_0x528083));if(_0x528083[_0x5500('0x22')]){if(_0x528083['error'][_0x5500('0x23')]===0x1f4){logger[_0x5500('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x444dd6,_0x528083['error']['message']);return _0x3e742e(_0x528083[_0x5500('0x22')][_0x5500('0x24')]);}logger[_0x5500('0x22')](_0x5500('0x1f'),_0x444dd6,_0x528083[_0x5500('0x22')][_0x5500('0x24')]);return _0x471933(_0x528083[_0x5500('0x22')][_0x5500('0x24')]);}else{logger[_0x5500('0x1e')](_0x5500('0x1f'),_0x444dd6,'request\x20sent');_0x471933(_0x528083['result'][_0x5500('0x24')]);}})['catch'](function(_0x743209){logger[_0x5500('0x22')](_0x5500('0x1f'),_0x444dd6,_0x743209);_0x3e742e(_0x743209);});});}function respondWithStatusCode(_0x2e6bc2,_0xb29b7d){_0xb29b7d=_0xb29b7d||0xcc;return function(_0x5a3946){if(_0x5a3946){return _0x2e6bc2[_0x5500('0x25')](_0xb29b7d);}return _0x2e6bc2[_0x5500('0x26')](_0xb29b7d)[_0x5500('0x27')]();};}function respondWithResult(_0x131c20,_0x2fae8c){_0x2fae8c=_0x2fae8c||0xc8;return function(_0x5b3564){if(_0x5b3564){return _0x131c20[_0x5500('0x26')](_0x2fae8c)[_0x5500('0x28')](_0x5b3564);}};}function respondWithFilteredResult(_0x5525a5,_0x2a219){return function(_0x1ab3b0){if(_0x1ab3b0){var _0x5d5c44=_0x1ab3b0[_0x5500('0x29')],_0x34ecc6=_0x2a219['offset'],_0x3b77d3=_0x2a219[_0x5500('0x2a')]+_0x2a219[_0x5500('0x2b')],_0x5c94e9;if(_0x3b77d3>=_0x5d5c44){_0x3b77d3=_0x5d5c44;_0x5c94e9=0xc8;}else{_0x5c94e9=0xce;}_0x5525a5[_0x5500('0x26')](_0x5c94e9);return _0x5525a5[_0x5500('0x2c')](_0x5500('0x2d'),_0x34ecc6+'-'+_0x3b77d3+'/'+_0x5d5c44)['json'](_0x1ab3b0);}return null;};}function patchUpdates(_0x33ee80){return function(_0x4c17c2){try{jsonpatch['apply'](_0x4c17c2,_0x33ee80,!![]);}catch(_0x57d018){return BPromise[_0x5500('0x2e')](_0x57d018);}return _0x4c17c2[_0x5500('0x2f')]();};}function saveUpdates(_0x1fe78b,_0x425e9e){return function(_0x43a7c3){if(_0x43a7c3){return _0x43a7c3[_0x5500('0x30')](_0x1fe78b)[_0x5500('0x1d')](function(_0x4f7029){return _0x4f7029;});}return null;};}function removeEntity(_0x495dfe,_0x5396ea){return function(_0x1c9d0b){if(_0x1c9d0b){return _0x1c9d0b['destroy']()['then'](function(){_0x495dfe[_0x5500('0x26')](0xcc)[_0x5500('0x27')]();});}};}function handleEntityNotFound(_0x1c910e,_0x4a09ca){return function(_0x109bf2){if(!_0x109bf2){_0x1c910e[_0x5500('0x25')](0x194);}return _0x109bf2;};}function handleError(_0x52b77a,_0x4a91a7){_0x4a91a7=_0x4a91a7||0x1f4;return function(_0x5a6ea2){logger[_0x5500('0x22')](_0x5a6ea2['stack']);if(_0x5a6ea2[_0x5500('0x31')]){delete _0x5a6ea2[_0x5500('0x31')];}_0x52b77a[_0x5500('0x26')](_0x4a91a7)[_0x5500('0x32')](_0x5a6ea2);};}exports[_0x5500('0x33')]=function(_0xf776d6,_0x215267){var _0x55ba95={},_0x56d584={},_0x4c1449={'count':0x0,'rows':[]};var _0x36cace=_[_0x5500('0x34')](db['Dynamics365Account'][_0x5500('0x35')],function(_0x536d61){return{'name':_0x536d61['fieldName'],'type':_0x536d61[_0x5500('0x36')][_0x5500('0x37')]};});_0x56d584[_0x5500('0x38')]=_[_0x5500('0x34')](_0x36cace,_0x5500('0x31'));_0x56d584[_0x5500('0x39')]=_[_0x5500('0x3a')](_0xf776d6[_0x5500('0x39')]);_0x56d584['filters']=_[_0x5500('0x3b')](_0x56d584[_0x5500('0x38')],_0x56d584[_0x5500('0x39')]);_0x55ba95[_0x5500('0x3c')]=_['intersection'](_0x56d584[_0x5500('0x38')],qs[_0x5500('0x3d')](_0xf776d6[_0x5500('0x39')][_0x5500('0x3d')]));_0x55ba95[_0x5500('0x3c')]=_0x55ba95['attributes'][_0x5500('0x3e')]?_0x55ba95[_0x5500('0x3c')]:_0x56d584['model'];if(!_0xf776d6[_0x5500('0x39')][_0x5500('0x3f')]('nolimit')){_0x55ba95['limit']=qs[_0x5500('0x2b')](_0xf776d6[_0x5500('0x39')][_0x5500('0x2b')]);_0x55ba95[_0x5500('0x2a')]=qs['offset'](_0xf776d6[_0x5500('0x39')][_0x5500('0x2a')]);}_0x55ba95[_0x5500('0x40')]=qs['sort'](_0xf776d6[_0x5500('0x39')][_0x5500('0x41')]);_0x55ba95[_0x5500('0x42')]=qs['filters'](_[_0x5500('0x43')](_0xf776d6['query'],_0x56d584[_0x5500('0x44')]),_0x36cace);if(_0xf776d6['query']['filter']){_0x55ba95[_0x5500('0x42')]=_[_0x5500('0x45')](_0x55ba95[_0x5500('0x42')],{'$or':_[_0x5500('0x34')](_0x36cace,function(_0x5a2946){if(_0x5a2946[_0x5500('0x36')]!==_0x5500('0x46')){var _0x4f99d1={};_0x4f99d1[_0x5a2946[_0x5500('0x31')]]={'$like':'%'+_0xf776d6[_0x5500('0x39')][_0x5500('0x47')]+'%'};return _0x4f99d1;}})});}_0x55ba95=_[_0x5500('0x45')]({},_0x55ba95,_0xf776d6[_0x5500('0x48')]);var _0x326686={'where':_0x55ba95[_0x5500('0x42')]};return db['Dynamics365Account'][_0x5500('0x29')](_0x326686)[_0x5500('0x1d')](function(_0x17a18d){_0x4c1449['count']=_0x17a18d;if(_0xf776d6[_0x5500('0x39')][_0x5500('0x49')]){_0x55ba95[_0x5500('0x4a')]=[{'all':!![]}];}return db[_0x5500('0x4b')][_0x5500('0x4c')](_0x55ba95);})[_0x5500('0x1d')](function(_0x34ac45){_0x4c1449['rows']=_0x34ac45;return _0x4c1449;})[_0x5500('0x1d')](respondWithFilteredResult(_0x215267,_0x55ba95))[_0x5500('0x4d')](handleError(_0x215267,null));};exports[_0x5500('0x4e')]=function(_0x49801c,_0xaf6db4){var _0x337c05={'raw':![],'where':{'id':_0x49801c[_0x5500('0x4f')]['id']}},_0x4bd62b={};_0x4bd62b[_0x5500('0x38')]=_[_0x5500('0x3a')](db[_0x5500('0x4b')][_0x5500('0x35')]);_0x4bd62b[_0x5500('0x39')]=_[_0x5500('0x3a')](_0x49801c[_0x5500('0x39')]);_0x4bd62b[_0x5500('0x44')]=_[_0x5500('0x3b')](_0x4bd62b[_0x5500('0x38')],_0x4bd62b[_0x5500('0x39')]);_0x337c05[_0x5500('0x3c')]=_[_0x5500('0x3b')](_0x4bd62b[_0x5500('0x38')],qs[_0x5500('0x3d')](_0x49801c[_0x5500('0x39')][_0x5500('0x3d')]));_0x337c05[_0x5500('0x3c')]=_0x337c05[_0x5500('0x3c')][_0x5500('0x3e')]?_0x337c05[_0x5500('0x3c')]:_0x4bd62b[_0x5500('0x38')];if(_0x49801c[_0x5500('0x39')][_0x5500('0x49')]){_0x337c05[_0x5500('0x4a')]=[{'all':!![]}];}_0x337c05=_['merge']({},_0x337c05,_0x49801c[_0x5500('0x48')]);return db['Dynamics365Account'][_0x5500('0x50')](_0x337c05)['then'](handleEntityNotFound(_0xaf6db4,null))['then'](respondWithResult(_0xaf6db4,null))[_0x5500('0x4d')](handleError(_0xaf6db4,null));};exports[_0x5500('0x51')]=function(_0x3cf5a5,_0x3cd4bc){return db[_0x5500('0x4b')][_0x5500('0x51')](_0x3cf5a5[_0x5500('0x52')],{})['then'](respondWithResult(_0x3cd4bc,0xc9))[_0x5500('0x4d')](handleError(_0x3cd4bc,null));};exports[_0x5500('0x30')]=function(_0x41a11d,_0x1878d5){if(_0x41a11d[_0x5500('0x52')]['id']){delete _0x41a11d[_0x5500('0x52')]['id'];}return db[_0x5500('0x4b')][_0x5500('0x50')]({'where':{'id':_0x41a11d[_0x5500('0x4f')]['id']}})[_0x5500('0x1d')](handleEntityNotFound(_0x1878d5,null))['then'](saveUpdates(_0x41a11d[_0x5500('0x52')],null))[_0x5500('0x1d')](respondWithResult(_0x1878d5,null))[_0x5500('0x4d')](handleError(_0x1878d5,null));};exports[_0x5500('0x53')]=function(_0x2e8814,_0x56a826){return db[_0x5500('0x4b')]['find']({'where':{'id':_0x2e8814['params']['id']}})[_0x5500('0x1d')](handleEntityNotFound(_0x56a826,null))[_0x5500('0x1d')](removeEntity(_0x56a826,null))[_0x5500('0x4d')](handleError(_0x56a826,null));};exports['getConfigurations']=function(_0x86bca7,_0x2a727c,_0x3686eb){var _0x20626a={};var _0x47321d={};var _0x292ca5;var _0x4cfadd;return db[_0x5500('0x4b')][_0x5500('0x54')]({'where':{'id':_0x86bca7['params']['id']}})[_0x5500('0x1d')](handleEntityNotFound(_0x2a727c,null))[_0x5500('0x1d')](function(_0x13b406){if(_0x13b406){_0x292ca5=_0x13b406;_0x47321d[_0x5500('0x38')]=_[_0x5500('0x3a')](db[_0x5500('0x55')]['rawAttributes']);_0x47321d[_0x5500('0x39')]=_[_0x5500('0x3a')](_0x86bca7[_0x5500('0x39')]);_0x47321d[_0x5500('0x44')]=_[_0x5500('0x3b')](_0x47321d[_0x5500('0x38')],_0x47321d[_0x5500('0x39')]);_0x20626a[_0x5500('0x3c')]=_['intersection'](_0x47321d[_0x5500('0x38')],qs[_0x5500('0x3d')](_0x86bca7[_0x5500('0x39')]['fields']));_0x20626a['attributes']=_0x20626a[_0x5500('0x3c')]['length']?_0x20626a[_0x5500('0x3c')]:_0x47321d[_0x5500('0x38')];_0x20626a['order']=qs[_0x5500('0x41')](_0x86bca7[_0x5500('0x39')]['sort']);_0x20626a[_0x5500('0x42')]=qs[_0x5500('0x44')](_['pick'](_0x86bca7['query'],_0x47321d['filters']));if(_0x86bca7['query'][_0x5500('0x47')]){_0x20626a['where']=_[_0x5500('0x45')](_0x20626a[_0x5500('0x42')],{'$or':_[_0x5500('0x34')](_0x20626a['attributes'],function(_0x1d88a){var _0x273d6f={};_0x273d6f[_0x1d88a]={'$like':'%'+_0x86bca7[_0x5500('0x39')][_0x5500('0x47')]+'%'};return _0x273d6f;})});}_0x20626a=_[_0x5500('0x45')]({},_0x20626a,_0x86bca7['options']);return _0x292ca5[_0x5500('0x56')](_0x20626a);}})[_0x5500('0x1d')](function(_0x27d080){if(_0x27d080){_0x4cfadd=_0x27d080[_0x5500('0x3e')];if(!_0x86bca7['query'][_0x5500('0x3f')]('nolimit')){_0x20626a['limit']=qs['limit'](_0x86bca7[_0x5500('0x39')]['limit']);_0x20626a[_0x5500('0x2a')]=qs[_0x5500('0x2a')](_0x86bca7['query'][_0x5500('0x2a')]);}return _0x292ca5[_0x5500('0x56')](_0x20626a);}})[_0x5500('0x1d')](function(_0x330d2a){if(_0x330d2a){return _0x330d2a?{'count':_0x4cfadd,'rows':_0x330d2a}:null;}})[_0x5500('0x1d')](respondWithResult(_0x2a727c,null))[_0x5500('0x4d')](handleError(_0x2a727c,null));};exports[_0x5500('0x57')]=function(_0x209796,_0x2d93ea,_0x107d40){if(_0x209796[_0x5500('0x52')]['id']){delete _0x209796[_0x5500('0x52')]['id'];}return db[_0x5500('0x4b')][_0x5500('0x54')]({'where':{'id':_0x209796[_0x5500('0x4f')]['id']}})[_0x5500('0x1d')](handleEntityNotFound(_0x2d93ea,null))['then'](function(_0x3273d5){if(_0x3273d5){_0x209796[_0x5500('0x52')][_0x5500('0x58')]=_0x3273d5['id'];_0x209796[_0x5500('0x52')][_0x5500('0x59')]=integrations['getSubjects'](_0x209796[_0x5500('0x52')][_0x5500('0x5a')],_0x209796[_0x5500('0x52')]['type']);_0x209796[_0x5500('0x52')][_0x5500('0x5b')]=integrations[_0x5500('0x5c')](_0x209796[_0x5500('0x52')][_0x5500('0x5a')],_0x209796[_0x5500('0x52')][_0x5500('0x36')]);return db[_0x5500('0x55')][_0x5500('0x51')](_0x209796[_0x5500('0x52')],{'include':[{'model':db[_0x5500('0x5d')],'as':_0x5500('0x59')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x5500('0x1d')](respondWithResult(_0x2d93ea,null))[_0x5500('0x4d')](handleError(_0x2d93ea,null));};exports[_0x5500('0x5e')]=function(_0x4aaa04,_0x1c6473,_0xf8a2ee){var _0x962441=_0x4aaa04[_0x5500('0x39')][_0x5500('0x5f')];var _0x39e0b5=_0x962441===_0x5500('0x60')?_0x5500('0x61'):_0x5500('0x62');var _0x555f7a='';var _0x2cbd34='';var _0xdbffa0='';var _0x4575b3='';var _0x770102='';var _0x1c8e9c='';var _0x2c61bf='';var _0x28f252='';var _0x304f54=[_0x5500('0x63'),_0x5500('0x64'),'customerid',_0x5500('0x65'),_0x5500('0x66'),_0x5500('0x67'),'phonenumber',_0x5500('0x68'),_0x5500('0x69'),_0x5500('0x6a')];var _0x1a1a3a=[_0x5500('0x6b'),_0x5500('0x6c'),_0x5500('0x6d'),_0x5500('0x6e'),_0x5500('0x6f'),_0x5500('0x70'),_0x5500('0x71'),_0x5500('0x72'),_0x5500('0x73'),_0x5500('0x74'),_0x5500('0x75'),_0x5500('0x76'),_0x5500('0x77'),_0x5500('0x78'),_0x5500('0x79'),'customeridname',_0x5500('0x7a'),_0x5500('0x7b'),_0x5500('0x7c'),'entitlementidname',_0x5500('0x7d'),_0x5500('0x7e'),'escalatedon',_0x5500('0x7f'),_0x5500('0x80'),_0x5500('0x81'),'importsequencenumber',_0x5500('0x82'),'kbarticleidname',_0x5500('0x83'),'masteridname',_0x5500('0x84'),_0x5500('0x85'),_0x5500('0x86'),_0x5500('0x87'),_0x5500('0x88'),_0x5500('0x89'),_0x5500('0x8a'),_0x5500('0x8b'),_0x5500('0x8c'),_0x5500('0x8d'),_0x5500('0x8e'),'overriddencreatedon','owneridname',_0x5500('0x8f'),_0x5500('0x90'),_0x5500('0x91'),'primarycontactidname','primarycontactidyominame',_0x5500('0x92'),_0x5500('0x93'),_0x5500('0x94'),_0x5500('0x95'),_0x5500('0x96'),_0x5500('0x97'),_0x5500('0x98'),'responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x5500('0x99'),_0x5500('0x9a'),'statecode',_0x5500('0x9b'),_0x5500('0x9c'),'ticketnumber',_0x5500('0x9d'),_0x5500('0x9e'),_0x5500('0x9f'),_0x5500('0xa0'),'versionnumber'];var _0x360691=_0x304f54[_0x5500('0xa1')](_0x1a1a3a);return db[_0x5500('0x4b')][_0x5500('0x54')]({'where':{'id':_0x4aaa04[_0x5500('0x4f')]['id']},'attributes':['id','username',_0x5500('0xa2'),'remoteUri',_0x5500('0xa3'),_0x5500('0xa4'),_0x5500('0xa5')]})[_0x5500('0x1d')](handleEntityNotFound(_0x1c6473,null))[_0x5500('0x1d')](function(_0x4b68f2){if(_0x4b68f2){_0x28f252=_0x4b68f2[_0x5500('0xa6')];var _0x48fb89=_0x28f252[_0x5500('0xa7')](-0x1);if(_0x48fb89==='/'){_0x28f252=_0x28f252[_0x5500('0xa8')](0x0,_0x28f252[_0x5500('0xa9')](_0x48fb89));}_0x2c61bf=util[_0x5500('0xaa')](_0x5500('0xab'),_0x28f252);var _0xf47ceb={'method':_0x5500('0xac'),'uri':'https://login.microsoftonline.com/'+_0x4b68f2[_0x5500('0xa3')]+'/oauth2/token','form':{'client_id':_0x4b68f2[_0x5500('0xa4')],'resource':_0x28f252,'username':_0x4b68f2[_0x5500('0xad')],'password':_0x4b68f2[_0x5500('0xa2')],'grant_type':'password','client_secret':_0x4b68f2[_0x5500('0xa5')]},'json':!![]};return rp(_0xf47ceb);}})[_0x5500('0x1d')](function(_0x58af4d){_0x1c8e9c=_0x58af4d[_0x5500('0xae')];var _0x24bf67={'method':_0x5500('0xaf'),'uri':encodeURI(_0x2c61bf+_0x5500('0xb0')+_0x39e0b5+'\x27'),'headers':{'Authorization':_0x5500('0xb1')+_0x1c8e9c,'If-None-Match':null,'OData-Version':_0x5500('0xb2')},'json':!![]};return rp(_0x24bf67);})['then'](function(_0x2754f2){var _0x5f4b43=_0x2754f2[_0x5500('0xb3')][0x0];var _0x3b6087=_0x5f4b43[_0x5500('0xb4')];var _0x3f5425={'method':_0x5500('0xaf'),'uri':_0x2c61bf+_0x5500('0xb5')+_0x3b6087+_0x5500('0xb6'),'headers':{'Authorization':'Bearer\x20'+_0x1c8e9c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3f5425);})[_0x5500('0x1d')](function(_0x3bf745){_0x555f7a=_0x3bf745;_0x2cbd34=_0x555f7a[_0x5500('0xb7')];_0x2cbd34=_[_0x5500('0xb8')](_0x2cbd34,function(_0xa8d63d){return!_0x360691[_0x5500('0xb9')](_0xa8d63d['LogicalName']);});var _0x12bade=[];var _0x22ecd2=[];_0x2cbd34[_0x5500('0xba')](function(_0x21f45c){if(_0x21f45c['@odata.type']){var _0x2a3a5e=_0x21f45c['@odata.type']['substring'](_0x21f45c[_0x5500('0xbb')][_0x5500('0xa9')]('.')+0x1);if(_0x2a3a5e==='PicklistAttributeMetadata'){_0x12bade[_0x5500('0xbc')](getSelectList(_0x2c61bf,_0x962441,_0x22ecd2,_0x555f7a[_0x5500('0xb4')],_0x21f45c[_0x5500('0xb4')],_0x1c8e9c));}}});return Promise[_0x5500('0xbd')](_0x12bade);})[_0x5500('0x1d')](function(_0x50302a){_0xdbffa0=_0x50302a[0x0];var _0x1112fe=[];var _0x4e0ae0=[];_0x2cbd34[_0x5500('0xba')](function(_0x2d1134){if(!_[_0x5500('0xbe')](_0x2d1134[_0x5500('0xbb')])){var _0x5111ed=_0x2d1134[_0x5500('0xbb')][_0x5500('0xa8')](_0x2d1134[_0x5500('0xbb')][_0x5500('0xa9')]('.')+0x1);if(_0x5111ed===_0x5500('0xbf')){_0x1112fe[_0x5500('0xbc')](getBooleanList(_0x2c61bf,_0x962441,_0x4e0ae0,_0x555f7a[_0x5500('0xb4')],_0x2d1134[_0x5500('0xb4')],_0x1c8e9c));}}});return Promise[_0x5500('0xbd')](_0x1112fe);})[_0x5500('0x1d')](function(_0x5779b5){_0x4575b3=_0x5779b5[0x0];var _0x2cf391=[];var _0xe26a60=[];_0x2cbd34['forEach'](function(_0x5d190f){if(_0x5d190f[_0x5500('0xbb')]){var _0x55de39=_0x5d190f[_0x5500('0xbb')][_0x5500('0xa8')](_0x5d190f['@odata.type'][_0x5500('0xa9')]('.')+0x1);if(_0x55de39==='StringAttributeMetadata'||_0x55de39===_0x5500('0xc0')||_0x55de39===_0x5500('0xc1')||_0x55de39==='IntegerAttributeMetadata'||_0x55de39===_0x5500('0xc2')||_0x55de39==='DateTimeAttributeMetadata'||_0x55de39===_0x5500('0xc3')||_0x55de39===_0x5500('0xc4')||_0x55de39===_0x5500('0xc5')||_0x55de39===_0x5500('0xc6')){_0x2cf391[_0x5500('0xbc')](getInputList(_0x2c61bf,_0x962441,_0x55de39,_0xe26a60,_0x555f7a[_0x5500('0xb4')],_0x5d190f[_0x5500('0xb4')],_0x1c8e9c));}}});return Promise[_0x5500('0xbd')](_0x2cf391);})[_0x5500('0x1d')](function(_0x49a243){_0x770102=_0x49a243[0x0];var _0x12e79d=_0xdbffa0[_0x5500('0xa1')](_0x4575b3)[_0x5500('0xa1')](_0x770102);var _0x1aa23d={'count':_0x12e79d[_0x5500('0x3e')],'rows':_0x12e79d};return _0x1aa23d;})[_0x5500('0x1d')](respondWithResult(_0x1c6473,null))[_0x5500('0x4d')](function(_0x2e310b){var _0x5bf2bd=_0x4aaa04['query'][_0x5500('0x18')]?0x1f4:_0x2e310b[_0x5500('0xc7')]||0x1f4;logger[_0x5500('0x22')](_0x2e310b['stack']);delete _0x2e310b['name'];if(_0x5bf2bd===0x191){_0x5bf2bd=0x190;}_0x1c6473['status'](_0x5bf2bd)[_0x5500('0x32')](_0x4aaa04[_0x5500('0x39')][_0x5500('0x18')]?{'message':_0x5500('0xc8'),'statusCode':_0x2e310b[_0x5500('0xc7')]}:_0x2e310b);});};function getSelectList(_0x371f1c,_0x505630,_0x48db64,_0x5dfccf,_0x585375,_0x328666){var _0x489281={'method':'GET','uri':_0x371f1c+'EntityDefinitions('+_0x5dfccf+_0x5500('0xc9')+_0x585375+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x5500('0xb1')+_0x328666,'If-None-Match':null,'OData-Version':_0x5500('0xb2')},'json':!![]};return rp(_0x489281)['then'](function(_0xb0ba82){var _0xa3241=[];var _0x20e037=_0xb0ba82['OptionSet']['Options'];_0x20e037[_0x5500('0xba')](function(_0x59889a){_0xa3241['push']({'name':_0x59889a[_0x5500('0xca')]['UserLocalizedLabel'][_0x5500('0xca')],'value':String(_0x59889a['Value'])});});var _0x54bf92={'id':_0x505630+'_'+_0xb0ba82[_0x5500('0xcb')],'name':_0xb0ba82[_0x5500('0xcc')][_0x5500('0xcd')][_0x5500('0xca')],'custom':![],'options':_0xa3241};_0x48db64[_0x5500('0xbc')](_0x54bf92);return _0x48db64;});}function getBooleanList(_0x4414d3,_0x153e1b,_0x2634ed,_0x476d6f,_0x5455e6,_0x2a83e3){var _0x29898e={'method':_0x5500('0xaf'),'uri':_0x4414d3+_0x5500('0xb5')+_0x476d6f+')/Attributes('+_0x5455e6+_0x5500('0xce'),'headers':{'Authorization':_0x5500('0xb1')+_0x2a83e3,'If-None-Match':null,'OData-Version':_0x5500('0xb2')},'json':!![]};return rp(_0x29898e)[_0x5500('0x1d')](function(_0x33a495){var _0x2427f5=[];_0x2427f5['push']({'name':_0x33a495['OptionSet'][_0x5500('0xcf')][_0x5500('0xca')][_0x5500('0xcd')][_0x5500('0xca')],'value':_0x5500('0xd0')},{'name':_0x33a495[_0x5500('0xd1')][_0x5500('0xd2')][_0x5500('0xca')]['UserLocalizedLabel'][_0x5500('0xca')],'value':'false'});var _0xd186ac={'id':_0x153e1b+'_'+_0x33a495[_0x5500('0xcb')],'name':_0x33a495[_0x5500('0xcc')][_0x5500('0xcd')]['Label'],'custom':![],'options':_0x2427f5};_0x2634ed[_0x5500('0xbc')](_0xd186ac);return _0x2634ed;});}function getInputList(_0x4e4c82,_0x30130e,_0x111f4c,_0x47aba8,_0x1ee00d,_0x2f3724,_0x1d5ce5){var _0xcd17be={'method':_0x5500('0xaf'),'uri':_0x4e4c82+_0x5500('0xb5')+_0x1ee00d+')/Attributes('+_0x2f3724+')/Microsoft.Dynamics.CRM.'+_0x111f4c+_0x5500('0xd3'),'headers':{'Authorization':_0x5500('0xb1')+_0x1d5ce5,'If-None-Match':null,'OData-Version':_0x5500('0xb2')},'json':!![]};return rp(_0xcd17be)[_0x5500('0x1d')](function(_0x109c93){var _0x3a82d1={'id':_0x30130e+'_'+_0x109c93[_0x5500('0xcb')],'name':_0x109c93[_0x5500('0xcc')]['UserLocalizedLabel']?_0x109c93['DisplayName'][_0x5500('0xcd')]['Label']:_0x109c93['LogicalName'],'custom':![],'options':[]};_0x47aba8[_0x5500('0xbc')](_0x3a82d1);return _0x47aba8;});} \ No newline at end of file +var _0x9d57=['options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','Dynamics365Configuration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','clientId','slice','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','Attributes','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','statusCode','send','Wrong\x20credentials','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','json','count','limit','set','Content-Range','save','update','destroy','end','stack','name','index','map','Dynamics365Account','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x9d57,0x16b));var _0x79d5=function(_0x17d114,_0x5a9988){_0x17d114=_0x17d114-0x0;var _0x95997b=_0x9d57[_0x17d114];return _0x95997b;};'use strict';var pdf=require(_0x79d5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x79d5('0x1'));var zipdir=require(_0x79d5('0x2'));var jsonpatch=require(_0x79d5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x79d5('0x4'));var Mustache=require('mustache');var util=require(_0x79d5('0x5'));var path=require(_0x79d5('0x6'));var sox=require(_0x79d5('0x7'));var csv=require('to-csv');var ejs=require(_0x79d5('0x8'));var fs=require('fs');var _=require(_0x79d5('0x9'));var squel=require(_0x79d5('0xa'));var crypto=require(_0x79d5('0xb'));var jsforce=require(_0x79d5('0xc'));var deskjs=require(_0x79d5('0xd'));var toCsv=require(_0x79d5('0xe'));var querystring=require(_0x79d5('0xf'));var Papa=require(_0x79d5('0x10'));var Redis=require(_0x79d5('0x11'));var authService=require(_0x79d5('0x12'));var qs=require(_0x79d5('0x13'));var as=require(_0x79d5('0x14'));var hardwareService=require(_0x79d5('0x15'));var logger=require('../../config/logger')(_0x79d5('0x16'));var utils=require(_0x79d5('0x17'));var config=require(_0x79d5('0x18'));var db=require(_0x79d5('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x79d5('0x1a'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3f27d7,_0x42cf62,_0x5bfd17){if(_0x5bfd17){var _0x521d30=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x521d30[_0x79d5('0x1b')](_0x42cf62)){return _0x3f27d7;}else{throw new db['Sequelize'][(_0x79d5('0x1c'))](_0x79d5('0x1d'));}}else{return _0x3f27d7;}}function respondWithRpcPromise(_0x39779a,_0x38bcbb,_0x239bf3,_0x2e3cb7){return new BPromise(function(_0x406052,_0x21abef){var _0x132c8c=_0x2e3cb7||client;return _0x132c8c['request'](_0x39779a,_0x239bf3)[_0x79d5('0x1e')](function(_0x521bec){logger['info'](_0x79d5('0x1f'),_0x38bcbb,_0x79d5('0x20'));logger[_0x79d5('0x21')](_0x79d5('0x22'),_0x38bcbb,_0x79d5('0x20'),JSON[_0x79d5('0x23')](_0x521bec));if(_0x521bec[_0x79d5('0x24')]){if(_0x521bec['error'][_0x79d5('0x25')]===0x1f4){logger[_0x79d5('0x24')]('Dynamics365Account,\x20%s,\x20%s',_0x38bcbb,_0x521bec[_0x79d5('0x24')][_0x79d5('0x26')]);return _0x21abef(_0x521bec[_0x79d5('0x24')][_0x79d5('0x26')]);}logger[_0x79d5('0x24')](_0x79d5('0x1f'),_0x38bcbb,_0x521bec[_0x79d5('0x24')][_0x79d5('0x26')]);return _0x406052(_0x521bec['error'][_0x79d5('0x26')]);}else{logger[_0x79d5('0x27')](_0x79d5('0x1f'),_0x38bcbb,_0x79d5('0x20'));_0x406052(_0x521bec[_0x79d5('0x28')]['message']);}})['catch'](function(_0x402a97){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x38bcbb,_0x402a97);_0x21abef(_0x402a97);});});}function respondWithStatusCode(_0x120897,_0x168a1a){_0x168a1a=_0x168a1a||0xcc;return function(_0x76b518){if(_0x76b518){return _0x120897[_0x79d5('0x29')](_0x168a1a);}return _0x120897[_0x79d5('0x2a')](_0x168a1a)['end']();};}function respondWithResult(_0x460c89,_0x1cc396){_0x1cc396=_0x1cc396||0xc8;return function(_0x233e9d){if(_0x233e9d){return _0x460c89['status'](_0x1cc396)[_0x79d5('0x2b')](_0x233e9d);}};}function respondWithFilteredResult(_0x36a9a4,_0x327ba1){return function(_0x34a2ad){if(_0x34a2ad){var _0x449f51=_0x34a2ad[_0x79d5('0x2c')],_0x34ef76=_0x327ba1['offset'],_0x36dd23=_0x327ba1['offset']+_0x327ba1[_0x79d5('0x2d')],_0x5a5fa5;if(_0x36dd23>=_0x449f51){_0x36dd23=_0x449f51;_0x5a5fa5=0xc8;}else{_0x5a5fa5=0xce;}_0x36a9a4[_0x79d5('0x2a')](_0x5a5fa5);return _0x36a9a4[_0x79d5('0x2e')](_0x79d5('0x2f'),_0x34ef76+'-'+_0x36dd23+'/'+_0x449f51)[_0x79d5('0x2b')](_0x34a2ad);}return null;};}function patchUpdates(_0x4ae5a5){return function(_0x15fe42){try{jsonpatch['apply'](_0x15fe42,_0x4ae5a5,!![]);}catch(_0x36090f){return BPromise['reject'](_0x36090f);}return _0x15fe42[_0x79d5('0x30')]();};}function saveUpdates(_0x343bbf,_0x3f97e4){return function(_0x51e468){if(_0x51e468){return _0x51e468[_0x79d5('0x31')](_0x343bbf)[_0x79d5('0x1e')](function(_0x33f264){return _0x33f264;});}return null;};}function removeEntity(_0x595cb1,_0x51ec76){return function(_0x551d4e){if(_0x551d4e){return _0x551d4e[_0x79d5('0x32')]()[_0x79d5('0x1e')](function(){_0x595cb1['status'](0xcc)[_0x79d5('0x33')]();});}};}function handleEntityNotFound(_0x3add52,_0x3aedce){return function(_0x30efa0){if(!_0x30efa0){_0x3add52[_0x79d5('0x29')](0x194);}return _0x30efa0;};}function handleError(_0x380ab2,_0x490702){_0x490702=_0x490702||0x1f4;return function(_0x19d8ee){logger['error'](_0x19d8ee[_0x79d5('0x34')]);if(_0x19d8ee[_0x79d5('0x35')]){delete _0x19d8ee[_0x79d5('0x35')];}_0x380ab2['status'](_0x490702)['send'](_0x19d8ee);};}exports[_0x79d5('0x36')]=function(_0x336d1e,_0x33b963){var _0x1b8923={},_0x306eb3={},_0x68b8e0={'count':0x0,'rows':[]};var _0x48398f=_[_0x79d5('0x37')](db[_0x79d5('0x38')][_0x79d5('0x39')],function(_0x595f16){return{'name':_0x595f16['fieldName'],'type':_0x595f16[_0x79d5('0x3a')][_0x79d5('0x3b')]};});_0x306eb3['model']=_['map'](_0x48398f,_0x79d5('0x35'));_0x306eb3[_0x79d5('0x3c')]=_[_0x79d5('0x3d')](_0x336d1e['query']);_0x306eb3[_0x79d5('0x3e')]=_[_0x79d5('0x3f')](_0x306eb3[_0x79d5('0x40')],_0x306eb3['query']);_0x1b8923[_0x79d5('0x41')]=_[_0x79d5('0x3f')](_0x306eb3['model'],qs[_0x79d5('0x42')](_0x336d1e[_0x79d5('0x3c')][_0x79d5('0x42')]));_0x1b8923[_0x79d5('0x41')]=_0x1b8923[_0x79d5('0x41')]['length']?_0x1b8923[_0x79d5('0x41')]:_0x306eb3[_0x79d5('0x40')];if(!_0x336d1e[_0x79d5('0x3c')][_0x79d5('0x43')](_0x79d5('0x44'))){_0x1b8923[_0x79d5('0x2d')]=qs[_0x79d5('0x2d')](_0x336d1e['query'][_0x79d5('0x2d')]);_0x1b8923[_0x79d5('0x45')]=qs[_0x79d5('0x45')](_0x336d1e[_0x79d5('0x3c')]['offset']);}_0x1b8923[_0x79d5('0x46')]=qs[_0x79d5('0x47')](_0x336d1e[_0x79d5('0x3c')]['sort']);_0x1b8923[_0x79d5('0x48')]=qs[_0x79d5('0x3e')](_[_0x79d5('0x49')](_0x336d1e[_0x79d5('0x3c')],_0x306eb3[_0x79d5('0x3e')]),_0x48398f);if(_0x336d1e[_0x79d5('0x3c')][_0x79d5('0x4a')]){_0x1b8923['where']=_[_0x79d5('0x4b')](_0x1b8923[_0x79d5('0x48')],{'$or':_[_0x79d5('0x37')](_0x48398f,function(_0x258fa4){if(_0x258fa4[_0x79d5('0x3a')]!==_0x79d5('0x4c')){var _0x955959={};_0x955959[_0x258fa4[_0x79d5('0x35')]]={'$like':'%'+_0x336d1e[_0x79d5('0x3c')][_0x79d5('0x4a')]+'%'};return _0x955959;}})});}_0x1b8923=_[_0x79d5('0x4b')]({},_0x1b8923,_0x336d1e[_0x79d5('0x4d')]);var _0x3b27fb={'where':_0x1b8923[_0x79d5('0x48')]};return db['Dynamics365Account']['count'](_0x3b27fb)['then'](function(_0x38eb68){_0x68b8e0[_0x79d5('0x2c')]=_0x38eb68;if(_0x336d1e['query'][_0x79d5('0x4e')]){_0x1b8923[_0x79d5('0x4f')]=[{'all':!![]}];}return db[_0x79d5('0x38')][_0x79d5('0x50')](_0x1b8923);})[_0x79d5('0x1e')](function(_0x50bc93){_0x68b8e0[_0x79d5('0x51')]=_0x50bc93;return _0x68b8e0;})['then'](respondWithFilteredResult(_0x33b963,_0x1b8923))[_0x79d5('0x52')](handleError(_0x33b963,null));};exports[_0x79d5('0x53')]=function(_0xa42b7d,_0x2425e1){var _0xeb3cb3={'raw':![],'where':{'id':_0xa42b7d['params']['id']}},_0x4357f3={};_0x4357f3['model']=_[_0x79d5('0x3d')](db['Dynamics365Account'][_0x79d5('0x39')]);_0x4357f3[_0x79d5('0x3c')]=_[_0x79d5('0x3d')](_0xa42b7d[_0x79d5('0x3c')]);_0x4357f3[_0x79d5('0x3e')]=_[_0x79d5('0x3f')](_0x4357f3[_0x79d5('0x40')],_0x4357f3[_0x79d5('0x3c')]);_0xeb3cb3[_0x79d5('0x41')]=_[_0x79d5('0x3f')](_0x4357f3[_0x79d5('0x40')],qs[_0x79d5('0x42')](_0xa42b7d[_0x79d5('0x3c')][_0x79d5('0x42')]));_0xeb3cb3['attributes']=_0xeb3cb3[_0x79d5('0x41')][_0x79d5('0x54')]?_0xeb3cb3[_0x79d5('0x41')]:_0x4357f3[_0x79d5('0x40')];if(_0xa42b7d[_0x79d5('0x3c')][_0x79d5('0x4e')]){_0xeb3cb3[_0x79d5('0x4f')]=[{'all':!![]}];}_0xeb3cb3=_[_0x79d5('0x4b')]({},_0xeb3cb3,_0xa42b7d[_0x79d5('0x4d')]);return db[_0x79d5('0x38')][_0x79d5('0x55')](_0xeb3cb3)['then'](handleEntityNotFound(_0x2425e1,null))[_0x79d5('0x1e')](respondWithResult(_0x2425e1,null))[_0x79d5('0x52')](handleError(_0x2425e1,null));};exports[_0x79d5('0x56')]=function(_0x49fdcb,_0x1ce7a2){return db[_0x79d5('0x38')][_0x79d5('0x56')](_0x49fdcb['body'],{})[_0x79d5('0x1e')](respondWithResult(_0x1ce7a2,0xc9))['catch'](handleError(_0x1ce7a2,null));};exports[_0x79d5('0x31')]=function(_0x583da1,_0x26a441){if(_0x583da1[_0x79d5('0x57')]['id']){delete _0x583da1['body']['id'];}return db[_0x79d5('0x38')][_0x79d5('0x55')]({'where':{'id':_0x583da1[_0x79d5('0x58')]['id']}})[_0x79d5('0x1e')](handleEntityNotFound(_0x26a441,null))['then'](saveUpdates(_0x583da1['body'],null))[_0x79d5('0x1e')](respondWithResult(_0x26a441,null))['catch'](handleError(_0x26a441,null));};exports[_0x79d5('0x32')]=function(_0xaa2324,_0x540eb6){return db['Dynamics365Account'][_0x79d5('0x55')]({'where':{'id':_0xaa2324[_0x79d5('0x58')]['id']}})[_0x79d5('0x1e')](handleEntityNotFound(_0x540eb6,null))[_0x79d5('0x1e')](removeEntity(_0x540eb6,null))[_0x79d5('0x52')](handleError(_0x540eb6,null));};exports[_0x79d5('0x59')]=function(_0x3d2c7c,_0x74697f,_0x3d94e6){var _0x299642={};var _0x4010ed={};var _0x16abdf;var _0x4f867a;return db[_0x79d5('0x38')]['findOne']({'where':{'id':_0x3d2c7c[_0x79d5('0x58')]['id']}})[_0x79d5('0x1e')](handleEntityNotFound(_0x74697f,null))[_0x79d5('0x1e')](function(_0x32c83e){if(_0x32c83e){_0x16abdf=_0x32c83e;_0x4010ed[_0x79d5('0x40')]=_[_0x79d5('0x3d')](db[_0x79d5('0x5a')][_0x79d5('0x39')]);_0x4010ed[_0x79d5('0x3c')]=_[_0x79d5('0x3d')](_0x3d2c7c[_0x79d5('0x3c')]);_0x4010ed[_0x79d5('0x3e')]=_[_0x79d5('0x3f')](_0x4010ed[_0x79d5('0x40')],_0x4010ed['query']);_0x299642['attributes']=_['intersection'](_0x4010ed[_0x79d5('0x40')],qs[_0x79d5('0x42')](_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x42')]));_0x299642[_0x79d5('0x41')]=_0x299642[_0x79d5('0x41')][_0x79d5('0x54')]?_0x299642[_0x79d5('0x41')]:_0x4010ed[_0x79d5('0x40')];_0x299642[_0x79d5('0x46')]=qs[_0x79d5('0x47')](_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x47')]);_0x299642[_0x79d5('0x48')]=qs['filters'](_[_0x79d5('0x49')](_0x3d2c7c[_0x79d5('0x3c')],_0x4010ed['filters']));if(_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x4a')]){_0x299642[_0x79d5('0x48')]=_[_0x79d5('0x4b')](_0x299642['where'],{'$or':_['map'](_0x299642[_0x79d5('0x41')],function(_0x91a943){var _0x5c081e={};_0x5c081e[_0x91a943]={'$like':'%'+_0x3d2c7c[_0x79d5('0x3c')]['filter']+'%'};return _0x5c081e;})});}_0x299642=_[_0x79d5('0x4b')]({},_0x299642,_0x3d2c7c['options']);return _0x16abdf[_0x79d5('0x59')](_0x299642);}})[_0x79d5('0x1e')](function(_0x2dab04){if(_0x2dab04){_0x4f867a=_0x2dab04[_0x79d5('0x54')];if(!_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x43')](_0x79d5('0x44'))){_0x299642['limit']=qs[_0x79d5('0x2d')](_0x3d2c7c['query'][_0x79d5('0x2d')]);_0x299642[_0x79d5('0x45')]=qs['offset'](_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x45')]);}return _0x16abdf[_0x79d5('0x59')](_0x299642);}})[_0x79d5('0x1e')](function(_0x531a41){if(_0x531a41){return _0x531a41?{'count':_0x4f867a,'rows':_0x531a41}:null;}})['then'](respondWithResult(_0x74697f,null))[_0x79d5('0x52')](handleError(_0x74697f,null));};exports['addConfiguration']=function(_0x3a0ebd,_0x19af5b,_0x2ec7bc){if(_0x3a0ebd[_0x79d5('0x57')]['id']){delete _0x3a0ebd[_0x79d5('0x57')]['id'];}return db[_0x79d5('0x38')][_0x79d5('0x5b')]({'where':{'id':_0x3a0ebd['params']['id']}})['then'](handleEntityNotFound(_0x19af5b,null))[_0x79d5('0x1e')](function(_0x1e9462){if(_0x1e9462){_0x3a0ebd['body']['AccountId']=_0x1e9462['id'];_0x3a0ebd[_0x79d5('0x57')][_0x79d5('0x5c')]=integrations[_0x79d5('0x5d')](_0x3a0ebd[_0x79d5('0x57')][_0x79d5('0x5e')],_0x3a0ebd[_0x79d5('0x57')]['type']);_0x3a0ebd[_0x79d5('0x57')][_0x79d5('0x5f')]=integrations[_0x79d5('0x60')](_0x3a0ebd['body'][_0x79d5('0x5e')],_0x3a0ebd[_0x79d5('0x57')][_0x79d5('0x3a')]);return db['Dynamics365Configuration'][_0x79d5('0x56')](_0x3a0ebd[_0x79d5('0x57')],{'include':[{'model':db['Dynamics365Field'],'as':_0x79d5('0x5c')},{'model':db['Dynamics365Field'],'as':_0x79d5('0x5f')}]});}return null;})['then'](respondWithResult(_0x19af5b,null))[_0x79d5('0x52')](handleError(_0x19af5b,null));};exports[_0x79d5('0x61')]=function(_0x34767e,_0x429c45,_0x396c9f){var _0x5ba9ea=_0x34767e[_0x79d5('0x3c')]['ticketType'];var _0x3a5281=_0x5ba9ea===_0x79d5('0x62')?'Incident':_0x79d5('0x63');var _0x3d72fb='';var _0x750872='';var _0x3ff89e='';var _0x4aa523='';var _0x4d4dd1='';var _0xe630f='';var _0x1920b6='';var _0xe938fb='';var _0x327bd8=[_0x79d5('0x64'),_0x79d5('0x65'),_0x79d5('0x66'),_0x79d5('0x67'),_0x79d5('0x68'),_0x79d5('0x69'),'phonenumber','regardingobjectid',_0x79d5('0x6a'),_0x79d5('0x6b')];var _0x156b2c=[_0x79d5('0x6c'),_0x79d5('0x6d'),_0x79d5('0x6e'),_0x79d5('0x6f'),_0x79d5('0x70'),_0x79d5('0x71'),_0x79d5('0x72'),_0x79d5('0x73'),_0x79d5('0x74'),_0x79d5('0x75'),'createdbyname','createdbyyominame',_0x79d5('0x76'),_0x79d5('0x77'),_0x79d5('0x78'),_0x79d5('0x79'),_0x79d5('0x7a'),_0x79d5('0x7b'),_0x79d5('0x7c'),_0x79d5('0x7d'),_0x79d5('0x7e'),_0x79d5('0x7f'),_0x79d5('0x80'),_0x79d5('0x81'),_0x79d5('0x82'),_0x79d5('0x83'),'importsequencenumber',_0x79d5('0x84'),_0x79d5('0x85'),'lastonholdtime','masteridname',_0x79d5('0x86'),_0x79d5('0x87'),_0x79d5('0x88'),'modifiedbyyominame',_0x79d5('0x89'),_0x79d5('0x8a'),_0x79d5('0x8b'),_0x79d5('0x8c'),_0x79d5('0x8d'),'numberofchildincidents',_0x79d5('0x8e'),_0x79d5('0x8f'),_0x79d5('0x90'),'owneridtype',_0x79d5('0x91'),_0x79d5('0x92'),_0x79d5('0x93'),_0x79d5('0x94'),_0x79d5('0x95'),'productidname',_0x79d5('0x96'),_0x79d5('0x97'),_0x79d5('0x98'),_0x79d5('0x99'),_0x79d5('0x9a'),_0x79d5('0x9b'),_0x79d5('0x9c'),'slainvokedidname',_0x79d5('0x9d'),_0x79d5('0x9e'),_0x79d5('0x9f'),_0x79d5('0xa0'),'subjectidname','ticketnumber',_0x79d5('0xa1'),_0x79d5('0xa2'),_0x79d5('0xa3'),_0x79d5('0xa4'),'versionnumber'];var _0x1cb1db=_0x327bd8[_0x79d5('0xa5')](_0x156b2c);return db[_0x79d5('0x38')][_0x79d5('0x5b')]({'where':{'id':_0x34767e['params']['id']},'attributes':['id',_0x79d5('0xa6'),_0x79d5('0xa7'),_0x79d5('0xa8'),'tenantId',_0x79d5('0xa9'),'clientSecret']})[_0x79d5('0x1e')](handleEntityNotFound(_0x429c45,null))[_0x79d5('0x1e')](function(_0x49d17b){if(_0x49d17b){_0xe938fb=_0x49d17b[_0x79d5('0xa8')];var _0x3e7508=_0xe938fb[_0x79d5('0xaa')](-0x1);if(_0x3e7508==='/'){_0xe938fb=_0xe938fb['substring'](0x0,_0xe938fb[_0x79d5('0xab')](_0x3e7508));}_0x1920b6=util['format'](_0x79d5('0xac'),_0xe938fb);var _0x3f1d22={'method':_0x79d5('0xad'),'uri':_0x79d5('0xae')+_0x49d17b[_0x79d5('0xaf')]+_0x79d5('0xb0'),'form':{'client_id':_0x49d17b[_0x79d5('0xa9')],'resource':_0xe938fb,'username':_0x49d17b['username'],'password':_0x49d17b[_0x79d5('0xa7')],'grant_type':'password','client_secret':_0x49d17b['clientSecret']},'json':!![]};return rp(_0x3f1d22);}})['then'](function(_0x4ac2fb){_0xe630f=_0x4ac2fb[_0x79d5('0xb1')];var _0x258475={'method':'GET','uri':encodeURI(_0x1920b6+_0x79d5('0xb2')+_0x3a5281+'\x27'),'headers':{'Authorization':_0x79d5('0xb3')+_0xe630f,'If-None-Match':null,'OData-Version':_0x79d5('0xb4')},'json':!![]};return rp(_0x258475);})[_0x79d5('0x1e')](function(_0x525a2a){var _0x2a3813=_0x525a2a[_0x79d5('0xb5')][0x0];var _0x57649f=_0x2a3813[_0x79d5('0xb6')];var _0x5b3664={'method':_0x79d5('0xb7'),'uri':_0x1920b6+'EntityDefinitions('+_0x57649f+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x79d5('0xb3')+_0xe630f,'If-None-Match':null,'OData-Version':_0x79d5('0xb4')},'json':!![]};return rp(_0x5b3664);})[_0x79d5('0x1e')](function(_0x4e8ae8){_0x3d72fb=_0x4e8ae8;_0x750872=_0x3d72fb[_0x79d5('0xb8')];_0x750872=_['remove'](_0x750872,function(_0x6cf6f4){return!_0x1cb1db[_0x79d5('0xb9')](_0x6cf6f4[_0x79d5('0xba')]);});var _0x41c2ec=[];var _0x57beb3=[];_0x750872[_0x79d5('0xbb')](function(_0x262699){if(_0x262699[_0x79d5('0xbc')]){var _0xf581fc=_0x262699[_0x79d5('0xbc')][_0x79d5('0xbd')](_0x262699[_0x79d5('0xbc')][_0x79d5('0xab')]('.')+0x1);if(_0xf581fc===_0x79d5('0xbe')){_0x41c2ec['push'](getSelectList(_0x1920b6,_0x5ba9ea,_0x57beb3,_0x3d72fb[_0x79d5('0xb6')],_0x262699[_0x79d5('0xb6')],_0xe630f));}}});return Promise['all'](_0x41c2ec);})[_0x79d5('0x1e')](function(_0x26089f){_0x3ff89e=_0x26089f[0x0];var _0x3e89f1=[];var _0x5a6125=[];_0x750872[_0x79d5('0xbb')](function(_0x1860eb){if(!_[_0x79d5('0xbf')](_0x1860eb[_0x79d5('0xbc')])){var _0x1ff75e=_0x1860eb[_0x79d5('0xbc')][_0x79d5('0xbd')](_0x1860eb[_0x79d5('0xbc')][_0x79d5('0xab')]('.')+0x1);if(_0x1ff75e===_0x79d5('0xc0')){_0x3e89f1['push'](getBooleanList(_0x1920b6,_0x5ba9ea,_0x5a6125,_0x3d72fb[_0x79d5('0xb6')],_0x1860eb['MetadataId'],_0xe630f));}}});return Promise[_0x79d5('0xc1')](_0x3e89f1);})[_0x79d5('0x1e')](function(_0x4f9850){_0x4aa523=_0x4f9850[0x0];var _0x4541e3=[];var _0x598b17=[];_0x750872[_0x79d5('0xbb')](function(_0x5dc2bf){if(_0x5dc2bf[_0x79d5('0xbc')]){var _0xd10cb4=_0x5dc2bf[_0x79d5('0xbc')][_0x79d5('0xbd')](_0x5dc2bf[_0x79d5('0xbc')]['lastIndexOf']('.')+0x1);if(_0xd10cb4==='StringAttributeMetadata'||_0xd10cb4===_0x79d5('0xc2')||_0xd10cb4===_0x79d5('0xc3')||_0xd10cb4===_0x79d5('0xc4')||_0xd10cb4==='MemoAttributeMetadata'||_0xd10cb4==='DateTimeAttributeMetadata'||_0xd10cb4===_0x79d5('0xc5')||_0xd10cb4===_0x79d5('0xc6')||_0xd10cb4===_0x79d5('0xc7')||_0xd10cb4===_0x79d5('0xc8')){_0x4541e3[_0x79d5('0xc9')](getInputList(_0x1920b6,_0x5ba9ea,_0xd10cb4,_0x598b17,_0x3d72fb[_0x79d5('0xb6')],_0x5dc2bf['MetadataId'],_0xe630f));}}});return Promise[_0x79d5('0xc1')](_0x4541e3);})['then'](function(_0x5caf12){_0x4d4dd1=_0x5caf12[0x0];var _0x4142f6=_0x3ff89e[_0x79d5('0xa5')](_0x4aa523)[_0x79d5('0xa5')](_0x4d4dd1);var _0xce548a={'count':_0x4142f6[_0x79d5('0x54')],'rows':_0x4142f6};return _0xce548a;})[_0x79d5('0x1e')](respondWithResult(_0x429c45,null))['catch'](function(_0x32c872){var _0x459b84=_0x34767e[_0x79d5('0x3c')][_0x79d5('0x1b')]?0x1f4:_0x32c872[_0x79d5('0xca')]||0x1f4;logger[_0x79d5('0x24')](_0x32c872[_0x79d5('0x34')]);delete _0x32c872['name'];if(_0x459b84===0x191){_0x459b84=0x190;}_0x429c45[_0x79d5('0x2a')](_0x459b84)[_0x79d5('0xcb')](_0x34767e[_0x79d5('0x3c')][_0x79d5('0x1b')]?{'message':_0x79d5('0xcc'),'statusCode':_0x32c872['statusCode']}:_0x32c872);});};function getSelectList(_0x4ba402,_0x1370d2,_0x83a4e6,_0x42ef78,_0x2ed62b,_0x27e4cc){var _0x45997f={'method':_0x79d5('0xb7'),'uri':_0x4ba402+_0x79d5('0xcd')+_0x42ef78+')/Attributes('+_0x2ed62b+_0x79d5('0xce')+_0x79d5('0xcf'),'headers':{'Authorization':'Bearer\x20'+_0x27e4cc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x45997f)[_0x79d5('0x1e')](function(_0x211434){var _0x2d6d9d=[];var _0x5a03f0=_0x211434[_0x79d5('0xd0')][_0x79d5('0xd1')];_0x5a03f0[_0x79d5('0xbb')](function(_0x17d8b3){_0x2d6d9d[_0x79d5('0xc9')]({'name':_0x17d8b3['Label']['UserLocalizedLabel'][_0x79d5('0xd2')],'value':String(_0x17d8b3['Value'])});});var _0x3938b5={'id':_0x1370d2+'_'+_0x211434[_0x79d5('0xba')],'name':_0x211434['DisplayName'][_0x79d5('0xd3')][_0x79d5('0xd2')],'custom':![],'options':_0x2d6d9d};_0x83a4e6[_0x79d5('0xc9')](_0x3938b5);return _0x83a4e6;});}function getBooleanList(_0x432179,_0x47bd35,_0x24c3f2,_0x14826b,_0x1b5323,_0x3b4b63){var _0x1d964e={'method':_0x79d5('0xb7'),'uri':_0x432179+_0x79d5('0xcd')+_0x14826b+_0x79d5('0xd4')+_0x1b5323+_0x79d5('0xd5'),'headers':{'Authorization':_0x79d5('0xb3')+_0x3b4b63,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1d964e)[_0x79d5('0x1e')](function(_0x3b3d48){var _0x1915bd=[];_0x1915bd[_0x79d5('0xc9')]({'name':_0x3b3d48[_0x79d5('0xd0')][_0x79d5('0xd6')][_0x79d5('0xd2')][_0x79d5('0xd3')][_0x79d5('0xd2')],'value':_0x79d5('0xd7')},{'name':_0x3b3d48[_0x79d5('0xd0')]['FalseOption'][_0x79d5('0xd2')][_0x79d5('0xd3')][_0x79d5('0xd2')],'value':_0x79d5('0xd8')});var _0x4db2be={'id':_0x47bd35+'_'+_0x3b3d48['LogicalName'],'name':_0x3b3d48[_0x79d5('0xd9')][_0x79d5('0xd3')][_0x79d5('0xd2')],'custom':![],'options':_0x1915bd};_0x24c3f2[_0x79d5('0xc9')](_0x4db2be);return _0x24c3f2;});}function getInputList(_0xf53aa7,_0xb0f8f0,_0x153653,_0x273d65,_0x39e181,_0x207dc8,_0x2caa88){var _0x86f777={'method':_0x79d5('0xb7'),'uri':_0xf53aa7+_0x79d5('0xcd')+_0x39e181+')/Attributes('+_0x207dc8+_0x79d5('0xda')+_0x153653+_0x79d5('0xdb'),'headers':{'Authorization':_0x79d5('0xb3')+_0x2caa88,'If-None-Match':null,'OData-Version':_0x79d5('0xb4')},'json':!![]};return rp(_0x86f777)[_0x79d5('0x1e')](function(_0x204a74){var _0xadef9a={'id':_0xb0f8f0+'_'+_0x204a74['LogicalName'],'name':_0x204a74['DisplayName'][_0x79d5('0xd3')]?_0x204a74[_0x79d5('0xd9')][_0x79d5('0xd3')][_0x79d5('0xd2')]:_0x204a74[_0x79d5('0xba')],'custom':![],'options':[]};_0x273d65['push'](_0xadef9a);return _0x273d65;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 7ec90ab..19244c9 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 _0xf712=['../../config/logger','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x1a1e57,_0x2cb6fd){var _0x177217=function(_0x403342){while(--_0x403342){_0x1a1e57['push'](_0x1a1e57['shift']());}};_0x177217(++_0x2cb6fd);}(_0xf712,0x195));var _0x2f71=function(_0x347d87,_0x18316a){_0x347d87=_0x347d87-0x0;var _0x5be66c=_0xf712[_0x347d87];return _0x5be66c;};'use strict';var _=require(_0x2f71('0x0'));var util=require(_0x2f71('0x1'));var logger=require(_0x2f71('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f71('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f71('0x4'));var config=require(_0x2f71('0x5'));var attributes=require(_0x2f71('0x6'));var integrations=require(_0x2f71('0x7'));module[_0x2f71('0x8')]=function(_0x14369d,_0x1e91c4){return _0x14369d['define'](_0x2f71('0x9'),attributes,{'tableName':_0x2f71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9e7=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define','Dynamics365Account','int_dynamics365_accounts','util'];(function(_0x444e1e,_0x27b3bf){var _0x1d190a=function(_0x4efaab){while(--_0x4efaab){_0x444e1e['push'](_0x444e1e['shift']());}};_0x1d190a(++_0x27b3bf);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xb9e7[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require('lodash');var util=require(_0x7b9e('0x0'));var logger=require(_0x7b9e('0x1'))(_0x7b9e('0x2'));var moment=require(_0x7b9e('0x3'));var BPromise=require(_0x7b9e('0x4'));var rp=require(_0x7b9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b9e('0x6'));var config=require(_0x7b9e('0x7'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x7b9e('0x8'));module['exports']=function(_0x3a9c5e,_0x3e7ea3){return _0x3a9c5e[_0x7b9e('0x9')](_0x7b9e('0xa'),attributes,{'tableName':_0x7b9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f1f186b..75ab0b1 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 _0xffd6=['options','raw','limit','include','model','attributes','ShowDynamics365Account','Dynamics365Account','find','where','map','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','findAll'];(function(_0x3feb8a,_0x47c784){var _0x4523ca=function(_0x4fba86){while(--_0x4fba86){_0x3feb8a['push'](_0x3feb8a['shift']());}};_0x4523ca(++_0x47c784);}(_0xffd6,0x97));var _0x6ffd=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0xffd6[_0x46428c];return _0x16a677;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});}exports[_0x6ffd('0x16')]=function(_0x889a4b){var _0x545576=this;return new Promise(function(_0x11a609,_0x56c541){return db['Dynamics365Account'][_0x6ffd('0x17')]({'raw':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b['options'][_0x6ffd('0x19')]===undefined?!![]:![]:!![],'where':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b['options']['where']||null:null,'attributes':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b[_0x6ffd('0x18')]['attributes']||null:null,'limit':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b[_0x6ffd('0x18')][_0x6ffd('0x1a')]||null:null,'include':_0x889a4b['options']?_0x889a4b[_0x6ffd('0x18')][_0x6ffd('0x1b')]?_['map'](_0x889a4b[_0x6ffd('0x18')][_0x6ffd('0x1b')],function(_0x50c19a){return{'model':db[_0x50c19a[_0x6ffd('0x1c')]],'as':_0x50c19a['as'],'attributes':_0x50c19a[_0x6ffd('0x1d')],'include':_0x50c19a[_0x6ffd('0x1b')]?_['map'](_0x50c19a[_0x6ffd('0x1b')],function(_0x3e5726){return{'model':db[_0x3e5726[_0x6ffd('0x1c')]],'as':_0x3e5726['as'],'attributes':_0x3e5726['attributes'],'include':_0x3e5726[_0x6ffd('0x1b')]?_['map'](_0x3e5726[_0x6ffd('0x1b')],function(_0x43269c){return{'model':db[_0x43269c['model']],'as':_0x43269c['as'],'attributes':_0x43269c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ffd('0xa')](function(_0x2a0391){logger[_0x6ffd('0x13')]('GetDynamics365Account',_0x889a4b);logger['debug'](_0x6ffd('0x16'),_0x889a4b,JSON['stringify'](_0x2a0391));_0x11a609(_0x2a0391);})[_0x6ffd('0x15')](function(_0x20c007){logger['error'](_0x6ffd('0x16'),_0x20c007[_0x6ffd('0x12')],_0x889a4b);_0x56c541(_0x545576[_0x6ffd('0x10')](0x1f4,_0x20c007[_0x6ffd('0x12')]));});});};exports[_0x6ffd('0x1e')]=function(_0x31c609){var _0x225c66=this;return new Promise(function(_0xccb8c,_0x17f627){return db[_0x6ffd('0x1f')][_0x6ffd('0x20')]({'raw':_0x31c609[_0x6ffd('0x18')]?_0x31c609[_0x6ffd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x31c609['options']?_0x31c609['options'][_0x6ffd('0x21')]||null:null,'attributes':_0x31c609[_0x6ffd('0x18')]?_0x31c609[_0x6ffd('0x18')][_0x6ffd('0x1d')]||null:null,'include':_0x31c609[_0x6ffd('0x18')]?_0x31c609[_0x6ffd('0x18')][_0x6ffd('0x1b')]?_[_0x6ffd('0x22')](_0x31c609[_0x6ffd('0x18')][_0x6ffd('0x1b')],function(_0x26394c){return{'model':db[_0x26394c[_0x6ffd('0x1c')]],'as':_0x26394c['as'],'attributes':_0x26394c[_0x6ffd('0x1d')],'include':_0x26394c['include']?_[_0x6ffd('0x22')](_0x26394c[_0x6ffd('0x1b')],function(_0x2efc20){return{'model':db[_0x2efc20[_0x6ffd('0x1c')]],'as':_0x2efc20['as'],'attributes':_0x2efc20['attributes'],'include':_0x2efc20[_0x6ffd('0x1b')]?_['map'](_0x2efc20['include'],function(_0x617d52){return{'model':db[_0x617d52[_0x6ffd('0x1c')]],'as':_0x617d52['as'],'attributes':_0x617d52[_0x6ffd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6ffd('0xa')](function(_0x55e9b4){logger[_0x6ffd('0x13')]('ShowDynamics365Account',_0x31c609);logger[_0x6ffd('0xd')](_0x6ffd('0x1e'),_0x31c609,JSON[_0x6ffd('0xf')](_0x55e9b4));_0xccb8c(_0x55e9b4);})[_0x6ffd('0x15')](function(_0x23fae4){logger['error']('ShowDynamics365Account',_0x23fae4[_0x6ffd('0x12')],_0x31c609);_0x17f627(_0x225c66['error'](0x1f4,_0x23fae4[_0x6ffd('0x12')]));});});}; \ No newline at end of file +var _0x9541=['message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','include','map','model','stringify','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','result'];(function(_0x1d7b73,_0x61e140){var _0x55d329=function(_0x1a354b){while(--_0x1a354b){_0x1d7b73['push'](_0x1d7b73['shift']());}};_0x55d329(++_0x61e140);}(_0x9541,0xb3));var _0x1954=function(_0x2c4672,_0x17da5f){_0x2c4672=_0x2c4672-0x0;var _0x1317c2=_0x9541[_0x2c4672];return _0x1317c2;};'use strict';var _=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var moment=require(_0x1954('0x2'));var BPromise=require(_0x1954('0x3'));var rs=require(_0x1954('0x4'));var fs=require('fs');var Redis=require(_0x1954('0x5'));var db=require(_0x1954('0x6'))['db'];var utils=require(_0x1954('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1954('0x8'));var jayson=require(_0x1954('0x9'));var client=jayson['client'][_0x1954('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21ceca,_0x30beea,_0x2ccff8){return new BPromise(function(_0xda7a2f,_0xa7a784){return client['request'](_0x21ceca,_0x2ccff8)[_0x1954('0xb')](function(_0x2f2c4b){logger[_0x1954('0xc')](_0x1954('0xd'),_0x30beea,_0x1954('0xe'));logger[_0x1954('0xf')](_0x1954('0x10'),_0x30beea,_0x1954('0xe'),JSON['stringify'](_0x2f2c4b));if(_0x2f2c4b[_0x1954('0x11')]){if(_0x2f2c4b[_0x1954('0x11')]['code']===0x1f4){logger[_0x1954('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x30beea,_0x2f2c4b[_0x1954('0x11')]['message']);return _0xa7a784(_0x2f2c4b['error']['message']);}logger[_0x1954('0x11')](_0x1954('0xd'),_0x30beea,_0x2f2c4b[_0x1954('0x11')]['message']);return _0xda7a2f(_0x2f2c4b[_0x1954('0x11')]['message']);}else{logger['info'](_0x1954('0xd'),_0x30beea,_0x1954('0xe'));_0xda7a2f(_0x2f2c4b[_0x1954('0x12')][_0x1954('0x13')]);}})[_0x1954('0x14')](function(_0x37f4fc){logger[_0x1954('0x11')](_0x1954('0xd'),_0x30beea,_0x37f4fc);_0xa7a784(_0x37f4fc);});});}exports[_0x1954('0x15')]=function(_0xb9c2cd){var _0xc8cb0b=this;return new Promise(function(_0x3da757,_0x16b8b1){return db[_0x1954('0x16')][_0x1954('0x17')]({'raw':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')][_0x1954('0x19')]===undefined?!![]:![]:!![],'where':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')]['where']||null:null,'attributes':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')][_0x1954('0x1a')]||null:null,'limit':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')]['limit']||null:null,'include':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')][_0x1954('0x1b')]?_[_0x1954('0x1c')](_0xb9c2cd[_0x1954('0x18')]['include'],function(_0x4d1b25){return{'model':db[_0x4d1b25[_0x1954('0x1d')]],'as':_0x4d1b25['as'],'attributes':_0x4d1b25[_0x1954('0x1a')],'include':_0x4d1b25[_0x1954('0x1b')]?_[_0x1954('0x1c')](_0x4d1b25['include'],function(_0x21f395){return{'model':db[_0x21f395[_0x1954('0x1d')]],'as':_0x21f395['as'],'attributes':_0x21f395[_0x1954('0x1a')],'include':_0x21f395[_0x1954('0x1b')]?_[_0x1954('0x1c')](_0x21f395[_0x1954('0x1b')],function(_0x46fdc1){return{'model':db[_0x46fdc1['model']],'as':_0x46fdc1['as'],'attributes':_0x46fdc1[_0x1954('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1954('0xb')](function(_0x513917){logger[_0x1954('0xc')](_0x1954('0x15'),_0xb9c2cd);logger[_0x1954('0xf')](_0x1954('0x15'),_0xb9c2cd,JSON[_0x1954('0x1e')](_0x513917));_0x3da757(_0x513917);})[_0x1954('0x14')](function(_0x41b143){logger[_0x1954('0x11')](_0x1954('0x15'),_0x41b143[_0x1954('0x13')],_0xb9c2cd);_0x16b8b1(_0xc8cb0b[_0x1954('0x11')](0x1f4,_0x41b143[_0x1954('0x13')]));});});};exports[_0x1954('0x1f')]=function(_0x22509c){var _0x228a57=this;return new Promise(function(_0x26b1db,_0x24cc47){return db[_0x1954('0x16')][_0x1954('0x20')]({'raw':_0x22509c[_0x1954('0x18')]?_0x22509c[_0x1954('0x18')][_0x1954('0x19')]===undefined?!![]:![]:!![],'where':_0x22509c[_0x1954('0x18')]?_0x22509c[_0x1954('0x18')]['where']||null:null,'attributes':_0x22509c['options']?_0x22509c[_0x1954('0x18')]['attributes']||null:null,'include':_0x22509c[_0x1954('0x18')]?_0x22509c[_0x1954('0x18')]['include']?_[_0x1954('0x1c')](_0x22509c[_0x1954('0x18')]['include'],function(_0x55ec43){return{'model':db[_0x55ec43[_0x1954('0x1d')]],'as':_0x55ec43['as'],'attributes':_0x55ec43[_0x1954('0x1a')],'include':_0x55ec43[_0x1954('0x1b')]?_[_0x1954('0x1c')](_0x55ec43[_0x1954('0x1b')],function(_0x316dc8){return{'model':db[_0x316dc8[_0x1954('0x1d')]],'as':_0x316dc8['as'],'attributes':_0x316dc8['attributes'],'include':_0x316dc8['include']?_[_0x1954('0x1c')](_0x316dc8[_0x1954('0x1b')],function(_0x1bbe28){return{'model':db[_0x1bbe28[_0x1954('0x1d')]],'as':_0x1bbe28['as'],'attributes':_0x1bbe28[_0x1954('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1954('0xb')](function(_0x5d235f){logger[_0x1954('0xc')](_0x1954('0x1f'),_0x22509c);logger['debug'](_0x1954('0x1f'),_0x22509c,JSON[_0x1954('0x1e')](_0x5d235f));_0x26b1db(_0x5d235f);})['catch'](function(_0x580990){logger[_0x1954('0x11')](_0x1954('0x1f'),_0x580990['message'],_0x22509c);_0x24cc47(_0x228a57[_0x1954('0x11')](0x1f4,_0x580990[_0x1954('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b968ff5..ca9200e 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 _0x5e8f=['index','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','post','create','put','/:id','delete','exports','multer','util','express','../../components/auth/service','./intDynamics365Configuration.controller','get'];(function(_0x2c59ea,_0xe7fa31){var _0x4b2f72=function(_0x296fc4){while(--_0x296fc4){_0x2c59ea['push'](_0x2c59ea['shift']());}};_0x4b2f72(++_0xe7fa31);}(_0x5e8f,0x198));var _0xf5e8=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0x5e8f[_0x356127];return _0x5d4c75;};'use strict';var multer=require(_0xf5e8('0x0'));var util=require(_0xf5e8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf5e8('0x2'));var router=express['Router']();var auth=require(_0xf5e8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5e8('0x4'));router[_0xf5e8('0x5')]('/',auth['isAuthenticated'](),controller[_0xf5e8('0x6')]);router[_0xf5e8('0x5')]('/:id',auth[_0xf5e8('0x7')](),controller['show']);router[_0xf5e8('0x5')](_0xf5e8('0x8'),auth['isAuthenticated'](),controller[_0xf5e8('0x9')]);router[_0xf5e8('0x5')](_0xf5e8('0xa'),auth[_0xf5e8('0x7')](),controller[_0xf5e8('0xb')]);router[_0xf5e8('0x5')]('/:id/descriptions',auth[_0xf5e8('0x7')](),controller['getDescriptions']);router[_0xf5e8('0xc')]('/',auth['isAuthenticated'](),controller[_0xf5e8('0xd')]);router[_0xf5e8('0xe')](_0xf5e8('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xf5e8('0x10')](_0xf5e8('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf5e8('0x11')]=router; \ No newline at end of file +var _0x6c67=['../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2716e1,_0x448036){var _0x4a41d6=function(_0x107a59){while(--_0x107a59){_0x2716e1['push'](_0x2716e1['shift']());}};_0x4a41d6(++_0x448036);}(_0x6c67,0x1f4));var _0x76c6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6c67[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x76c6('0x0'));var util=require(_0x76c6('0x1'));var path=require(_0x76c6('0x2'));var timeout=require(_0x76c6('0x3'));var express=require(_0x76c6('0x4'));var router=express[_0x76c6('0x5')]();var auth=require(_0x76c6('0x6'));var interaction=require(_0x76c6('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x76c6('0x8')]);router['get'](_0x76c6('0x9'),auth[_0x76c6('0xa')](),controller[_0x76c6('0xb')]);router[_0x76c6('0xc')](_0x76c6('0xd'),auth[_0x76c6('0xa')](),controller[_0x76c6('0xe')]);router[_0x76c6('0xc')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x76c6('0xf')]);router['get'](_0x76c6('0x10'),auth[_0x76c6('0xa')](),controller[_0x76c6('0x11')]);router['post']('/',auth[_0x76c6('0xa')](),controller[_0x76c6('0x12')]);router['put']('/:id',auth[_0x76c6('0xa')](),controller[_0x76c6('0x13')]);router[_0x76c6('0x14')](_0x76c6('0x9'),auth[_0x76c6('0xa')](),controller['destroy']);module[_0x76c6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 845cbe9..0ef60fd 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 _0x4b9a=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x29bf3e,_0x5bc130){var _0x59a8ff=function(_0x2e0868){while(--_0x2e0868){_0x29bf3e['push'](_0x29bf3e['shift']());}};_0x59a8ff(++_0x5bc130);}(_0x4b9a,0x1b3));var _0xa4b9=function(_0x4c5d02,_0x2d72f0){_0x4c5d02=_0x4c5d02-0x0;var _0x345c58=_0x4b9a[_0x4c5d02];return _0x345c58;};'use strict';var Sequelize=require(_0xa4b9('0x0'));module[_0xa4b9('0x1')]={'name':{'type':Sequelize[_0xa4b9('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xa4b9('0x3')](_0xa4b9('0x4'),_0xa4b9('0x5')),'defaultValue':_0xa4b9('0x4')}}; \ No newline at end of file +var _0x6210=['sequelize','exports','STRING','ENUM','incident'];(function(_0x16b1ee,_0x1bfa03){var _0x133d4c=function(_0x526034){while(--_0x526034){_0x16b1ee['push'](_0x16b1ee['shift']());}};_0x133d4c(++_0x1bfa03);}(_0x6210,0x13b));var _0x0621=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x6210[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0x0621('0x0'));module[_0x0621('0x1')]={'name':{'type':Sequelize[_0x0621('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x0621('0x3')](_0x0621('0x4'),'phonecall'),'defaultValue':_0x0621('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 86e0fdc..1bdb344 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 _0xc0dc=['keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','rawAttributes','find','create','body','params','destroy','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','save','update','then','name','send','index','map','Dynamics365Configuration','type','key','model','query'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0xc0dc,0x1d1));var _0xcc0d=function(_0xef4c88,_0xad688d){_0xef4c88=_0xef4c88-0x0;var _0x43c2a8=_0xc0dc[_0xef4c88];return _0x43c2a8;};'use strict';var pdf=require(_0xcc0d('0x0'));var emlformat=require(_0xcc0d('0x1'));var rimraf=require(_0xcc0d('0x2'));var zipdir=require(_0xcc0d('0x3'));var jsonpatch=require(_0xcc0d('0x4'));var rp=require('request-promise');var moment=require(_0xcc0d('0x5'));var BPromise=require(_0xcc0d('0x6'));var Mustache=require(_0xcc0d('0x7'));var util=require('util');var path=require(_0xcc0d('0x8'));var sox=require(_0xcc0d('0x9'));var csv=require(_0xcc0d('0xa'));var ejs=require(_0xcc0d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc0d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcc0d('0xd'));var toCsv=require(_0xcc0d('0xa'));var querystring=require(_0xcc0d('0xe'));var Papa=require(_0xcc0d('0xf'));var Redis=require(_0xcc0d('0x10'));var authService=require(_0xcc0d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc0d('0x12'))(_0xcc0d('0x13'));var utils=require(_0xcc0d('0x14'));var config=require(_0xcc0d('0x15'));var db=require(_0xcc0d('0x16'))['db'];var jayson=require(_0xcc0d('0x17'));var client=jayson[_0xcc0d('0x18')][_0xcc0d('0x19')]({'port':0x232a});function checkPasswordPattern(_0x520fea,_0x544b13,_0x3510c8){if(_0x3510c8){var _0x592dad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x592dad['test'](_0x544b13)){return _0x520fea;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x520fea;}}function respondWithRpcPromise(_0x35f914,_0x55c5f7,_0x2a7175,_0x17069c){return new BPromise(function(_0xfd03d2,_0x13502e){var _0xf83a0d=_0x17069c||client;return _0xf83a0d[_0xcc0d('0x1a')](_0x35f914,_0x2a7175)['then'](function(_0x3e3623){logger[_0xcc0d('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s',_0x55c5f7,_0xcc0d('0x1c'));logger[_0xcc0d('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x55c5f7,'request\x20sent',JSON[_0xcc0d('0x1e')](_0x3e3623));if(_0x3e3623[_0xcc0d('0x1f')]){if(_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x20')]===0x1f4){logger[_0xcc0d('0x1f')](_0xcc0d('0x21'),_0x55c5f7,_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x22')]);return _0x13502e(_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x22')]);}logger[_0xcc0d('0x1f')](_0xcc0d('0x21'),_0x55c5f7,_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x22')]);return _0xfd03d2(_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x22')]);}else{logger[_0xcc0d('0x1b')](_0xcc0d('0x21'),_0x55c5f7,_0xcc0d('0x1c'));_0xfd03d2(_0x3e3623[_0xcc0d('0x23')][_0xcc0d('0x22')]);}})[_0xcc0d('0x24')](function(_0x44453a){logger[_0xcc0d('0x1f')](_0xcc0d('0x21'),_0x55c5f7,_0x44453a);_0x13502e(_0x44453a);});});}function respondWithStatusCode(_0x3210d5,_0x1c4bab){_0x1c4bab=_0x1c4bab||0xcc;return function(_0x5ae964){if(_0x5ae964){return _0x3210d5[_0xcc0d('0x25')](_0x1c4bab);}return _0x3210d5['status'](_0x1c4bab)[_0xcc0d('0x26')]();};}function respondWithResult(_0x2dfe10,_0x5a7188){_0x5a7188=_0x5a7188||0xc8;return function(_0x2414d2){if(_0x2414d2){return _0x2dfe10[_0xcc0d('0x27')](_0x5a7188)[_0xcc0d('0x28')](_0x2414d2);}};}function respondWithFilteredResult(_0x51a3d8,_0x2705d8){return function(_0x1fd377){if(_0x1fd377){var _0x5944ac=_0x1fd377[_0xcc0d('0x29')],_0x528e0b=_0x2705d8[_0xcc0d('0x2a')],_0x48d4a1=_0x2705d8['offset']+_0x2705d8[_0xcc0d('0x2b')],_0xedfce1;if(_0x48d4a1>=_0x5944ac){_0x48d4a1=_0x5944ac;_0xedfce1=0xc8;}else{_0xedfce1=0xce;}_0x51a3d8[_0xcc0d('0x27')](_0xedfce1);return _0x51a3d8['set'](_0xcc0d('0x2c'),_0x528e0b+'-'+_0x48d4a1+'/'+_0x5944ac)[_0xcc0d('0x28')](_0x1fd377);}return null;};}function patchUpdates(_0x443acb){return function(_0x299ce7){try{jsonpatch['apply'](_0x299ce7,_0x443acb,!![]);}catch(_0x5a2dd3){return BPromise['reject'](_0x5a2dd3);}return _0x299ce7[_0xcc0d('0x2d')]();};}function saveUpdates(_0x5273d1,_0x4256b8){return function(_0x19bc08){if(_0x19bc08){return _0x19bc08[_0xcc0d('0x2e')](_0x5273d1)[_0xcc0d('0x2f')](function(_0x2f0b48){return _0x2f0b48;});}return null;};}function removeEntity(_0x199ec2,_0x221371){return function(_0xc8584e){if(_0xc8584e){return _0xc8584e['destroy']()['then'](function(){_0x199ec2[_0xcc0d('0x27')](0xcc)[_0xcc0d('0x26')]();});}};}function handleEntityNotFound(_0x160a3e,_0x39c285){return function(_0x5118b8){if(!_0x5118b8){_0x160a3e[_0xcc0d('0x25')](0x194);}return _0x5118b8;};}function handleError(_0x2dfb27,_0x5aecd8){_0x5aecd8=_0x5aecd8||0x1f4;return function(_0x5dffd3){logger[_0xcc0d('0x1f')](_0x5dffd3['stack']);if(_0x5dffd3[_0xcc0d('0x30')]){delete _0x5dffd3['name'];}_0x2dfb27[_0xcc0d('0x27')](_0x5aecd8)[_0xcc0d('0x31')](_0x5dffd3);};}exports[_0xcc0d('0x32')]=function(_0x44388e,_0xdb337){var _0x395db0={},_0x7624f9={},_0x1a3bd5={'count':0x0,'rows':[]};var _0x5832a9=_[_0xcc0d('0x33')](db[_0xcc0d('0x34')]['rawAttributes'],function(_0x306acf){return{'name':_0x306acf['fieldName'],'type':_0x306acf[_0xcc0d('0x35')][_0xcc0d('0x36')]};});_0x7624f9[_0xcc0d('0x37')]=_['map'](_0x5832a9,_0xcc0d('0x30'));_0x7624f9[_0xcc0d('0x38')]=_[_0xcc0d('0x39')](_0x44388e['query']);_0x7624f9[_0xcc0d('0x3a')]=_['intersection'](_0x7624f9['model'],_0x7624f9[_0xcc0d('0x38')]);_0x395db0[_0xcc0d('0x3b')]=_[_0xcc0d('0x3c')](_0x7624f9['model'],qs[_0xcc0d('0x3d')](_0x44388e[_0xcc0d('0x38')][_0xcc0d('0x3d')]));_0x395db0[_0xcc0d('0x3b')]=_0x395db0[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x395db0[_0xcc0d('0x3b')]:_0x7624f9[_0xcc0d('0x37')];if(!_0x44388e['query']['hasOwnProperty'](_0xcc0d('0x3f'))){_0x395db0[_0xcc0d('0x2b')]=qs[_0xcc0d('0x2b')](_0x44388e[_0xcc0d('0x38')][_0xcc0d('0x2b')]);_0x395db0['offset']=qs[_0xcc0d('0x2a')](_0x44388e[_0xcc0d('0x38')][_0xcc0d('0x2a')]);}_0x395db0[_0xcc0d('0x40')]=qs[_0xcc0d('0x41')](_0x44388e[_0xcc0d('0x38')]['sort']);_0x395db0[_0xcc0d('0x42')]=qs[_0xcc0d('0x3a')](_[_0xcc0d('0x43')](_0x44388e[_0xcc0d('0x38')],_0x7624f9[_0xcc0d('0x3a')]),_0x5832a9);if(_0x44388e['query'][_0xcc0d('0x44')]){_0x395db0['where']=_[_0xcc0d('0x45')](_0x395db0['where'],{'$or':_[_0xcc0d('0x33')](_0x5832a9,function(_0x410c6e){if(_0x410c6e['type']!==_0xcc0d('0x46')){var _0x45f7a0={};_0x45f7a0[_0x410c6e[_0xcc0d('0x30')]]={'$like':'%'+_0x44388e[_0xcc0d('0x38')][_0xcc0d('0x44')]+'%'};return _0x45f7a0;}})});}_0x395db0=_['merge']({},_0x395db0,_0x44388e[_0xcc0d('0x47')]);var _0x2232d2={'where':_0x395db0[_0xcc0d('0x42')]};return db[_0xcc0d('0x34')][_0xcc0d('0x29')](_0x2232d2)[_0xcc0d('0x2f')](function(_0x54fd59){_0x1a3bd5['count']=_0x54fd59;if(_0x44388e['query']['includeAll']){_0x395db0[_0xcc0d('0x48')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xcc0d('0x49')](_0x395db0);})[_0xcc0d('0x2f')](function(_0x132ecd){_0x1a3bd5[_0xcc0d('0x4a')]=_0x132ecd;return _0x1a3bd5;})['then'](respondWithFilteredResult(_0xdb337,_0x395db0))['catch'](handleError(_0xdb337,null));};exports['show']=function(_0x584a74,_0x75c0c7){var _0x176239={'raw':![],'where':{'id':_0x584a74['params']['id']}},_0x46d3f7={};_0x46d3f7[_0xcc0d('0x37')]=_[_0xcc0d('0x39')](db['Dynamics365Configuration'][_0xcc0d('0x4b')]);_0x46d3f7[_0xcc0d('0x38')]=_[_0xcc0d('0x39')](_0x584a74[_0xcc0d('0x38')]);_0x46d3f7[_0xcc0d('0x3a')]=_[_0xcc0d('0x3c')](_0x46d3f7['model'],_0x46d3f7[_0xcc0d('0x38')]);_0x176239[_0xcc0d('0x3b')]=_['intersection'](_0x46d3f7[_0xcc0d('0x37')],qs[_0xcc0d('0x3d')](_0x584a74[_0xcc0d('0x38')][_0xcc0d('0x3d')]));_0x176239['attributes']=_0x176239[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x176239[_0xcc0d('0x3b')]:_0x46d3f7[_0xcc0d('0x37')];if(_0x584a74[_0xcc0d('0x38')]['includeAll']){_0x176239[_0xcc0d('0x48')]=[{'all':!![]}];}_0x176239=_[_0xcc0d('0x45')]({},_0x176239,_0x584a74[_0xcc0d('0x47')]);return db[_0xcc0d('0x34')][_0xcc0d('0x4c')](_0x176239)[_0xcc0d('0x2f')](handleEntityNotFound(_0x75c0c7,null))[_0xcc0d('0x2f')](respondWithResult(_0x75c0c7,null))[_0xcc0d('0x24')](handleError(_0x75c0c7,null));};exports[_0xcc0d('0x4d')]=function(_0x7a965b,_0x338e28){return db[_0xcc0d('0x34')][_0xcc0d('0x4d')](_0x7a965b['body'],{})[_0xcc0d('0x2f')](respondWithResult(_0x338e28,0xc9))[_0xcc0d('0x24')](handleError(_0x338e28,null));};exports['update']=function(_0x3aa1ed,_0x4653ba){if(_0x3aa1ed[_0xcc0d('0x4e')]['id']){delete _0x3aa1ed['body']['id'];}return db['Dynamics365Configuration'][_0xcc0d('0x4c')]({'where':{'id':_0x3aa1ed[_0xcc0d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4653ba,null))[_0xcc0d('0x2f')](saveUpdates(_0x3aa1ed[_0xcc0d('0x4e')],null))['then'](respondWithResult(_0x4653ba,null))['catch'](handleError(_0x4653ba,null));};exports[_0xcc0d('0x50')]=function(_0x438301,_0x3d0c26){return db[_0xcc0d('0x34')][_0xcc0d('0x4c')]({'where':{'id':_0x438301[_0xcc0d('0x4f')]['id']}})[_0xcc0d('0x2f')](handleEntityNotFound(_0x3d0c26,null))['then'](removeEntity(_0x3d0c26,null))[_0xcc0d('0x24')](handleError(_0x3d0c26,null));};exports[_0xcc0d('0x51')]=function(_0x58e3f5,_0x2c2d21,_0x23e333){var _0x17934d={};var _0x35dca1={};var _0x5c3cc0;var _0x48eee0;return db[_0xcc0d('0x34')]['findOne']({'where':{'id':_0x58e3f5[_0xcc0d('0x4f')]['id']}})[_0xcc0d('0x2f')](handleEntityNotFound(_0x2c2d21,null))[_0xcc0d('0x2f')](function(_0x308b54){if(_0x308b54){_0x5c3cc0=_0x308b54;_0x35dca1['model']=_['keys'](db[_0xcc0d('0x52')][_0xcc0d('0x4b')]);_0x35dca1[_0xcc0d('0x38')]=_[_0xcc0d('0x39')](_0x58e3f5['query']);_0x35dca1[_0xcc0d('0x3a')]=_['intersection'](_0x35dca1[_0xcc0d('0x37')],_0x35dca1[_0xcc0d('0x38')]);_0x17934d[_0xcc0d('0x3b')]=_[_0xcc0d('0x3c')](_0x35dca1['model'],qs[_0xcc0d('0x3d')](_0x58e3f5[_0xcc0d('0x38')]['fields']));_0x17934d[_0xcc0d('0x3b')]=_0x17934d[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x17934d[_0xcc0d('0x3b')]:_0x35dca1[_0xcc0d('0x37')];_0x17934d['order']=qs[_0xcc0d('0x41')](_0x58e3f5[_0xcc0d('0x38')][_0xcc0d('0x41')]);_0x17934d['where']=qs[_0xcc0d('0x3a')](_['pick'](_0x58e3f5['query'],_0x35dca1[_0xcc0d('0x3a')]));if(_0x58e3f5[_0xcc0d('0x38')][_0xcc0d('0x44')]){_0x17934d['where']=_['merge'](_0x17934d[_0xcc0d('0x42')],{'$or':_['map'](_0x17934d[_0xcc0d('0x3b')],function(_0xc098e5){var _0x37298e={};_0x37298e[_0xc098e5]={'$like':'%'+_0x58e3f5['query'][_0xcc0d('0x44')]+'%'};return _0x37298e;})});}_0x17934d=_[_0xcc0d('0x45')]({},_0x17934d,_0x58e3f5['options']);return _0x5c3cc0['getFields'](_0x17934d);}})[_0xcc0d('0x2f')](function(_0xeeb60a){if(_0xeeb60a){_0x48eee0=_0xeeb60a[_0xcc0d('0x3e')];if(!_0x58e3f5[_0xcc0d('0x38')]['hasOwnProperty'](_0xcc0d('0x3f'))){_0x17934d['limit']=qs[_0xcc0d('0x2b')](_0x58e3f5[_0xcc0d('0x38')][_0xcc0d('0x2b')]);_0x17934d[_0xcc0d('0x2a')]=qs[_0xcc0d('0x2a')](_0x58e3f5[_0xcc0d('0x38')]['offset']);}return _0x5c3cc0[_0xcc0d('0x51')](_0x17934d);}})[_0xcc0d('0x2f')](function(_0xf5ddea){if(_0xf5ddea){return _0xf5ddea?{'count':_0x48eee0,'rows':_0xf5ddea}:null;}})[_0xcc0d('0x2f')](respondWithResult(_0x2c2d21,null))[_0xcc0d('0x24')](handleError(_0x2c2d21,null));};exports['getSubjects']=function(_0x4e169f,_0x3b2fe7,_0x2fc377){var _0x1d6c1b={};var _0x2219bf={};var _0x596956;var _0x48495d;return db[_0xcc0d('0x34')]['findOne']({'where':{'id':_0x4e169f[_0xcc0d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3b2fe7,null))[_0xcc0d('0x2f')](function(_0x4c8bb5){if(_0x4c8bb5){_0x596956=_0x4c8bb5;_0x2219bf[_0xcc0d('0x37')]=_['keys'](db[_0xcc0d('0x52')][_0xcc0d('0x4b')]);_0x2219bf[_0xcc0d('0x38')]=_['keys'](_0x4e169f[_0xcc0d('0x38')]);_0x2219bf[_0xcc0d('0x3a')]=_['intersection'](_0x2219bf[_0xcc0d('0x37')],_0x2219bf[_0xcc0d('0x38')]);_0x1d6c1b[_0xcc0d('0x3b')]=_[_0xcc0d('0x3c')](_0x2219bf[_0xcc0d('0x37')],qs[_0xcc0d('0x3d')](_0x4e169f['query'][_0xcc0d('0x3d')]));_0x1d6c1b[_0xcc0d('0x3b')]=_0x1d6c1b[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x1d6c1b[_0xcc0d('0x3b')]:_0x2219bf['model'];_0x1d6c1b['order']=qs['sort'](_0x4e169f['query'][_0xcc0d('0x41')]);_0x1d6c1b[_0xcc0d('0x42')]=qs['filters'](_[_0xcc0d('0x43')](_0x4e169f[_0xcc0d('0x38')],_0x2219bf['filters']));if(_0x4e169f['query'][_0xcc0d('0x44')]){_0x1d6c1b[_0xcc0d('0x42')]=_[_0xcc0d('0x45')](_0x1d6c1b[_0xcc0d('0x42')],{'$or':_[_0xcc0d('0x33')](_0x1d6c1b['attributes'],function(_0x58d34e){var _0x5e90b1={};_0x5e90b1[_0x58d34e]={'$like':'%'+_0x4e169f[_0xcc0d('0x38')]['filter']+'%'};return _0x5e90b1;})});}_0x1d6c1b=_[_0xcc0d('0x45')]({},_0x1d6c1b,_0x4e169f[_0xcc0d('0x47')]);return _0x596956[_0xcc0d('0x53')](_0x1d6c1b);}})[_0xcc0d('0x2f')](function(_0xb44bfa){if(_0xb44bfa){_0x48495d=_0xb44bfa['length'];if(!_0x4e169f['query']['hasOwnProperty'](_0xcc0d('0x3f'))){_0x1d6c1b[_0xcc0d('0x2b')]=qs[_0xcc0d('0x2b')](_0x4e169f[_0xcc0d('0x38')][_0xcc0d('0x2b')]);_0x1d6c1b['offset']=qs[_0xcc0d('0x2a')](_0x4e169f['query']['offset']);}return _0x596956[_0xcc0d('0x53')](_0x1d6c1b);}})[_0xcc0d('0x2f')](function(_0x873a2a){if(_0x873a2a){return _0x873a2a?{'count':_0x48495d,'rows':_0x873a2a}:null;}})['then'](respondWithResult(_0x3b2fe7,null))['catch'](handleError(_0x3b2fe7,null));};exports['getDescriptions']=function(_0x524d52,_0x2ee904,_0x2fbcd1){var _0x3b809b={};var _0x3b09a9={};var _0x319b69;var _0x4fde72;return db['Dynamics365Configuration'][_0xcc0d('0x54')]({'where':{'id':_0x524d52['params']['id']}})['then'](handleEntityNotFound(_0x2ee904,null))[_0xcc0d('0x2f')](function(_0x42ea0b){if(_0x42ea0b){_0x319b69=_0x42ea0b;_0x3b09a9[_0xcc0d('0x37')]=_[_0xcc0d('0x39')](db[_0xcc0d('0x52')][_0xcc0d('0x4b')]);_0x3b09a9[_0xcc0d('0x38')]=_['keys'](_0x524d52[_0xcc0d('0x38')]);_0x3b09a9[_0xcc0d('0x3a')]=_[_0xcc0d('0x3c')](_0x3b09a9[_0xcc0d('0x37')],_0x3b09a9[_0xcc0d('0x38')]);_0x3b809b['attributes']=_[_0xcc0d('0x3c')](_0x3b09a9['model'],qs[_0xcc0d('0x3d')](_0x524d52[_0xcc0d('0x38')]['fields']));_0x3b809b[_0xcc0d('0x3b')]=_0x3b809b[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x3b809b['attributes']:_0x3b09a9['model'];_0x3b809b[_0xcc0d('0x40')]=qs['sort'](_0x524d52['query']['sort']);_0x3b809b[_0xcc0d('0x42')]=qs[_0xcc0d('0x3a')](_['pick'](_0x524d52[_0xcc0d('0x38')],_0x3b09a9[_0xcc0d('0x3a')]));if(_0x524d52['query'][_0xcc0d('0x44')]){_0x3b809b['where']=_[_0xcc0d('0x45')](_0x3b809b[_0xcc0d('0x42')],{'$or':_[_0xcc0d('0x33')](_0x3b809b[_0xcc0d('0x3b')],function(_0x628742){var _0x3d6fcd={};_0x3d6fcd[_0x628742]={'$like':'%'+_0x524d52[_0xcc0d('0x38')][_0xcc0d('0x44')]+'%'};return _0x3d6fcd;})});}_0x3b809b=_[_0xcc0d('0x45')]({},_0x3b809b,_0x524d52[_0xcc0d('0x47')]);return _0x319b69[_0xcc0d('0x55')](_0x3b809b);}})[_0xcc0d('0x2f')](function(_0x4105af){if(_0x4105af){_0x4fde72=_0x4105af[_0xcc0d('0x3e')];if(!_0x524d52[_0xcc0d('0x38')][_0xcc0d('0x56')](_0xcc0d('0x3f'))){_0x3b809b[_0xcc0d('0x2b')]=qs[_0xcc0d('0x2b')](_0x524d52[_0xcc0d('0x38')]['limit']);_0x3b809b[_0xcc0d('0x2a')]=qs[_0xcc0d('0x2a')](_0x524d52[_0xcc0d('0x38')][_0xcc0d('0x2a')]);}return _0x319b69[_0xcc0d('0x55')](_0x3b809b);}})['then'](function(_0x47916e){if(_0x47916e){return _0x47916e?{'count':_0x4fde72,'rows':_0x47916e}:null;}})['then'](respondWithResult(_0x2ee904,null))[_0xcc0d('0x24')](handleError(_0x2ee904,null));}; \ No newline at end of file +var _0x7c38=['filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','Dynamics365Configuration','includeAll','findAll','rows','catch','show','params','fields','include','merge','find','create','body','getFields','hasOwnProperty','getSubjects','Dynamics365Field','getDescriptions','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','model','query','keys'];(function(_0x4bc6c1,_0x5519d0){var _0x2270ab=function(_0x4a423b){while(--_0x4a423b){_0x4bc6c1['push'](_0x4bc6c1['shift']());}};_0x2270ab(++_0x5519d0);}(_0x7c38,0x1a8));var _0x87c3=function(_0x3756e9,_0x23ea1a){_0x3756e9=_0x3756e9-0x0;var _0x86d411=_0x7c38[_0x3756e9];return _0x86d411;};'use strict';var pdf=require(_0x87c3('0x0'));var emlformat=require(_0x87c3('0x1'));var rimraf=require(_0x87c3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x87c3('0x3'));var rp=require(_0x87c3('0x4'));var moment=require(_0x87c3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x87c3('0x6'));var util=require(_0x87c3('0x7'));var path=require(_0x87c3('0x8'));var sox=require(_0x87c3('0x9'));var csv=require(_0x87c3('0xa'));var ejs=require(_0x87c3('0xb'));var fs=require('fs');var _=require(_0x87c3('0xc'));var squel=require(_0x87c3('0xd'));var crypto=require(_0x87c3('0xe'));var jsforce=require(_0x87c3('0xf'));var deskjs=require(_0x87c3('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x87c3('0x11'));var Redis=require('ioredis');var authService=require(_0x87c3('0x12'));var qs=require(_0x87c3('0x13'));var as=require(_0x87c3('0x14'));var hardwareService=require(_0x87c3('0x15'));var logger=require(_0x87c3('0x16'))(_0x87c3('0x17'));var utils=require(_0x87c3('0x18'));var config=require(_0x87c3('0x19'));var db=require(_0x87c3('0x1a'))['db'];var jayson=require(_0x87c3('0x1b'));var client=jayson[_0x87c3('0x1c')][_0x87c3('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x54d69e,_0xfcb357,_0x1f8103){if(_0x1f8103){var _0x313bda=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x313bda['test'](_0xfcb357)){return _0x54d69e;}else{throw new db[(_0x87c3('0x1e'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x54d69e;}}function respondWithRpcPromise(_0x18b953,_0x413e85,_0x56cf72,_0x1af5f7){return new BPromise(function(_0x5a851c,_0x291028){var _0x145a52=_0x1af5f7||client;return _0x145a52[_0x87c3('0x1f')](_0x18b953,_0x56cf72)[_0x87c3('0x20')](function(_0x452327){logger[_0x87c3('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x413e85,_0x87c3('0x22'));logger[_0x87c3('0x23')](_0x87c3('0x24'),_0x413e85,_0x87c3('0x22'),JSON[_0x87c3('0x25')](_0x452327));if(_0x452327[_0x87c3('0x26')]){if(_0x452327[_0x87c3('0x26')][_0x87c3('0x27')]===0x1f4){logger[_0x87c3('0x26')](_0x87c3('0x28'),_0x413e85,_0x452327[_0x87c3('0x26')][_0x87c3('0x29')]);return _0x291028(_0x452327['error'][_0x87c3('0x29')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x413e85,_0x452327[_0x87c3('0x26')][_0x87c3('0x29')]);return _0x5a851c(_0x452327[_0x87c3('0x26')][_0x87c3('0x29')]);}else{logger[_0x87c3('0x21')](_0x87c3('0x28'),_0x413e85,'request\x20sent');_0x5a851c(_0x452327[_0x87c3('0x2a')][_0x87c3('0x29')]);}})['catch'](function(_0x5094c5){logger[_0x87c3('0x26')](_0x87c3('0x28'),_0x413e85,_0x5094c5);_0x291028(_0x5094c5);});});}function respondWithStatusCode(_0x25735b,_0x153079){_0x153079=_0x153079||0xcc;return function(_0x1e55af){if(_0x1e55af){return _0x25735b[_0x87c3('0x2b')](_0x153079);}return _0x25735b[_0x87c3('0x2c')](_0x153079)[_0x87c3('0x2d')]();};}function respondWithResult(_0x5080bb,_0x1de26d){_0x1de26d=_0x1de26d||0xc8;return function(_0x29ed01){if(_0x29ed01){return _0x5080bb[_0x87c3('0x2c')](_0x1de26d)[_0x87c3('0x2e')](_0x29ed01);}};}function respondWithFilteredResult(_0x2e0f30,_0x59522b){return function(_0x2ee0d4){if(_0x2ee0d4){var _0x423587=_0x2ee0d4[_0x87c3('0x2f')],_0x15cb5e=_0x59522b[_0x87c3('0x30')],_0x32cfbc=_0x59522b[_0x87c3('0x30')]+_0x59522b[_0x87c3('0x31')],_0xd96601;if(_0x32cfbc>=_0x423587){_0x32cfbc=_0x423587;_0xd96601=0xc8;}else{_0xd96601=0xce;}_0x2e0f30[_0x87c3('0x2c')](_0xd96601);return _0x2e0f30[_0x87c3('0x32')](_0x87c3('0x33'),_0x15cb5e+'-'+_0x32cfbc+'/'+_0x423587)['json'](_0x2ee0d4);}return null;};}function patchUpdates(_0x2af42e){return function(_0x3f88c0){try{jsonpatch[_0x87c3('0x34')](_0x3f88c0,_0x2af42e,!![]);}catch(_0x1a88cb){return BPromise[_0x87c3('0x35')](_0x1a88cb);}return _0x3f88c0[_0x87c3('0x36')]();};}function saveUpdates(_0x14fa91,_0x3de82b){return function(_0x5e1dce){if(_0x5e1dce){return _0x5e1dce[_0x87c3('0x37')](_0x14fa91)[_0x87c3('0x20')](function(_0x15e362){return _0x15e362;});}return null;};}function removeEntity(_0x5b850e,_0x38a45b){return function(_0x52395e){if(_0x52395e){return _0x52395e[_0x87c3('0x38')]()[_0x87c3('0x20')](function(){_0x5b850e[_0x87c3('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28bc0e,_0x3316a5){return function(_0x5f16cb){if(!_0x5f16cb){_0x28bc0e[_0x87c3('0x2b')](0x194);}return _0x5f16cb;};}function handleError(_0x30c6d6,_0x309677){_0x309677=_0x309677||0x1f4;return function(_0x206b36){logger[_0x87c3('0x26')](_0x206b36['stack']);if(_0x206b36['name']){delete _0x206b36[_0x87c3('0x39')];}_0x30c6d6[_0x87c3('0x2c')](_0x309677)[_0x87c3('0x3a')](_0x206b36);};}exports[_0x87c3('0x3b')]=function(_0x4afeed,_0x40634c){var _0x6935e8={},_0x39187b={},_0x11ebc8={'count':0x0,'rows':[]};var _0x363f5a=_[_0x87c3('0x3c')](db['Dynamics365Configuration'][_0x87c3('0x3d')],function(_0x3769e7){return{'name':_0x3769e7[_0x87c3('0x3e')],'type':_0x3769e7['type']['key']};});_0x39187b[_0x87c3('0x3f')]=_['map'](_0x363f5a,_0x87c3('0x39'));_0x39187b[_0x87c3('0x40')]=_[_0x87c3('0x41')](_0x4afeed[_0x87c3('0x40')]);_0x39187b[_0x87c3('0x42')]=_[_0x87c3('0x43')](_0x39187b[_0x87c3('0x3f')],_0x39187b[_0x87c3('0x40')]);_0x6935e8['attributes']=_[_0x87c3('0x43')](_0x39187b[_0x87c3('0x3f')],qs['fields'](_0x4afeed[_0x87c3('0x40')]['fields']));_0x6935e8['attributes']=_0x6935e8[_0x87c3('0x44')][_0x87c3('0x45')]?_0x6935e8['attributes']:_0x39187b['model'];if(!_0x4afeed[_0x87c3('0x40')]['hasOwnProperty'](_0x87c3('0x46'))){_0x6935e8['limit']=qs[_0x87c3('0x31')](_0x4afeed['query'][_0x87c3('0x31')]);_0x6935e8[_0x87c3('0x30')]=qs[_0x87c3('0x30')](_0x4afeed[_0x87c3('0x40')][_0x87c3('0x30')]);}_0x6935e8[_0x87c3('0x47')]=qs['sort'](_0x4afeed[_0x87c3('0x40')][_0x87c3('0x48')]);_0x6935e8[_0x87c3('0x49')]=qs[_0x87c3('0x42')](_[_0x87c3('0x4a')](_0x4afeed[_0x87c3('0x40')],_0x39187b['filters']),_0x363f5a);if(_0x4afeed[_0x87c3('0x40')][_0x87c3('0x4b')]){_0x6935e8[_0x87c3('0x49')]=_['merge'](_0x6935e8[_0x87c3('0x49')],{'$or':_[_0x87c3('0x3c')](_0x363f5a,function(_0x4614d5){if(_0x4614d5[_0x87c3('0x4c')]!==_0x87c3('0x4d')){var _0x5afc59={};_0x5afc59[_0x4614d5['name']]={'$like':'%'+_0x4afeed['query'][_0x87c3('0x4b')]+'%'};return _0x5afc59;}})});}_0x6935e8=_['merge']({},_0x6935e8,_0x4afeed[_0x87c3('0x4e')]);var _0x263027={'where':_0x6935e8['where']};return db[_0x87c3('0x4f')][_0x87c3('0x2f')](_0x263027)[_0x87c3('0x20')](function(_0x54415e){_0x11ebc8[_0x87c3('0x2f')]=_0x54415e;if(_0x4afeed['query'][_0x87c3('0x50')]){_0x6935e8['include']=[{'all':!![]}];}return db[_0x87c3('0x4f')][_0x87c3('0x51')](_0x6935e8);})[_0x87c3('0x20')](function(_0x5c6765){_0x11ebc8[_0x87c3('0x52')]=_0x5c6765;return _0x11ebc8;})[_0x87c3('0x20')](respondWithFilteredResult(_0x40634c,_0x6935e8))[_0x87c3('0x53')](handleError(_0x40634c,null));};exports[_0x87c3('0x54')]=function(_0x3eff0b,_0x4889ec){var _0x1b927f={'raw':![],'where':{'id':_0x3eff0b[_0x87c3('0x55')]['id']}},_0x431645={};_0x431645['model']=_[_0x87c3('0x41')](db[_0x87c3('0x4f')]['rawAttributes']);_0x431645['query']=_[_0x87c3('0x41')](_0x3eff0b[_0x87c3('0x40')]);_0x431645[_0x87c3('0x42')]=_[_0x87c3('0x43')](_0x431645[_0x87c3('0x3f')],_0x431645[_0x87c3('0x40')]);_0x1b927f[_0x87c3('0x44')]=_[_0x87c3('0x43')](_0x431645[_0x87c3('0x3f')],qs[_0x87c3('0x56')](_0x3eff0b[_0x87c3('0x40')][_0x87c3('0x56')]));_0x1b927f['attributes']=_0x1b927f[_0x87c3('0x44')]['length']?_0x1b927f[_0x87c3('0x44')]:_0x431645[_0x87c3('0x3f')];if(_0x3eff0b[_0x87c3('0x40')][_0x87c3('0x50')]){_0x1b927f[_0x87c3('0x57')]=[{'all':!![]}];}_0x1b927f=_[_0x87c3('0x58')]({},_0x1b927f,_0x3eff0b[_0x87c3('0x4e')]);return db['Dynamics365Configuration'][_0x87c3('0x59')](_0x1b927f)[_0x87c3('0x20')](handleEntityNotFound(_0x4889ec,null))[_0x87c3('0x20')](respondWithResult(_0x4889ec,null))['catch'](handleError(_0x4889ec,null));};exports[_0x87c3('0x5a')]=function(_0xf322c5,_0x3760ae){return db[_0x87c3('0x4f')][_0x87c3('0x5a')](_0xf322c5[_0x87c3('0x5b')],{})[_0x87c3('0x20')](respondWithResult(_0x3760ae,0xc9))[_0x87c3('0x53')](handleError(_0x3760ae,null));};exports[_0x87c3('0x37')]=function(_0x1e333d,_0x58f798){if(_0x1e333d[_0x87c3('0x5b')]['id']){delete _0x1e333d[_0x87c3('0x5b')]['id'];}return db[_0x87c3('0x4f')][_0x87c3('0x59')]({'where':{'id':_0x1e333d[_0x87c3('0x55')]['id']}})['then'](handleEntityNotFound(_0x58f798,null))['then'](saveUpdates(_0x1e333d[_0x87c3('0x5b')],null))[_0x87c3('0x20')](respondWithResult(_0x58f798,null))['catch'](handleError(_0x58f798,null));};exports[_0x87c3('0x38')]=function(_0x1836c9,_0x379ea3){return db['Dynamics365Configuration'][_0x87c3('0x59')]({'where':{'id':_0x1836c9[_0x87c3('0x55')]['id']}})['then'](handleEntityNotFound(_0x379ea3,null))[_0x87c3('0x20')](removeEntity(_0x379ea3,null))[_0x87c3('0x53')](handleError(_0x379ea3,null));};exports[_0x87c3('0x5c')]=function(_0x524759,_0x113298,_0x21f705){var _0x4c589b={};var _0x3d918d={};var _0x3a6cdf;var _0x1eccd4;return db[_0x87c3('0x4f')]['findOne']({'where':{'id':_0x524759[_0x87c3('0x55')]['id']}})[_0x87c3('0x20')](handleEntityNotFound(_0x113298,null))[_0x87c3('0x20')](function(_0x595185){if(_0x595185){_0x3a6cdf=_0x595185;_0x3d918d[_0x87c3('0x3f')]=_[_0x87c3('0x41')](db['Dynamics365Field'][_0x87c3('0x3d')]);_0x3d918d[_0x87c3('0x40')]=_['keys'](_0x524759[_0x87c3('0x40')]);_0x3d918d[_0x87c3('0x42')]=_['intersection'](_0x3d918d[_0x87c3('0x3f')],_0x3d918d['query']);_0x4c589b[_0x87c3('0x44')]=_['intersection'](_0x3d918d[_0x87c3('0x3f')],qs[_0x87c3('0x56')](_0x524759[_0x87c3('0x40')]['fields']));_0x4c589b[_0x87c3('0x44')]=_0x4c589b[_0x87c3('0x44')][_0x87c3('0x45')]?_0x4c589b[_0x87c3('0x44')]:_0x3d918d[_0x87c3('0x3f')];_0x4c589b[_0x87c3('0x47')]=qs['sort'](_0x524759[_0x87c3('0x40')]['sort']);_0x4c589b[_0x87c3('0x49')]=qs[_0x87c3('0x42')](_[_0x87c3('0x4a')](_0x524759[_0x87c3('0x40')],_0x3d918d[_0x87c3('0x42')]));if(_0x524759[_0x87c3('0x40')][_0x87c3('0x4b')]){_0x4c589b[_0x87c3('0x49')]=_[_0x87c3('0x58')](_0x4c589b[_0x87c3('0x49')],{'$or':_[_0x87c3('0x3c')](_0x4c589b[_0x87c3('0x44')],function(_0x960185){var _0x527109={};_0x527109[_0x960185]={'$like':'%'+_0x524759['query'][_0x87c3('0x4b')]+'%'};return _0x527109;})});}_0x4c589b=_[_0x87c3('0x58')]({},_0x4c589b,_0x524759[_0x87c3('0x4e')]);return _0x3a6cdf[_0x87c3('0x5c')](_0x4c589b);}})[_0x87c3('0x20')](function(_0x2a355e){if(_0x2a355e){_0x1eccd4=_0x2a355e[_0x87c3('0x45')];if(!_0x524759[_0x87c3('0x40')][_0x87c3('0x5d')](_0x87c3('0x46'))){_0x4c589b[_0x87c3('0x31')]=qs[_0x87c3('0x31')](_0x524759['query'][_0x87c3('0x31')]);_0x4c589b[_0x87c3('0x30')]=qs['offset'](_0x524759[_0x87c3('0x40')][_0x87c3('0x30')]);}return _0x3a6cdf[_0x87c3('0x5c')](_0x4c589b);}})[_0x87c3('0x20')](function(_0x78fea1){if(_0x78fea1){return _0x78fea1?{'count':_0x1eccd4,'rows':_0x78fea1}:null;}})['then'](respondWithResult(_0x113298,null))[_0x87c3('0x53')](handleError(_0x113298,null));};exports[_0x87c3('0x5e')]=function(_0x18b043,_0x543131,_0x4b3d20){var _0x457a8d={};var _0xd4988c={};var _0x1d0637;var _0x389f41;return db[_0x87c3('0x4f')]['findOne']({'where':{'id':_0x18b043[_0x87c3('0x55')]['id']}})[_0x87c3('0x20')](handleEntityNotFound(_0x543131,null))[_0x87c3('0x20')](function(_0x2d24a5){if(_0x2d24a5){_0x1d0637=_0x2d24a5;_0xd4988c[_0x87c3('0x3f')]=_[_0x87c3('0x41')](db[_0x87c3('0x5f')][_0x87c3('0x3d')]);_0xd4988c[_0x87c3('0x40')]=_[_0x87c3('0x41')](_0x18b043[_0x87c3('0x40')]);_0xd4988c['filters']=_[_0x87c3('0x43')](_0xd4988c[_0x87c3('0x3f')],_0xd4988c['query']);_0x457a8d[_0x87c3('0x44')]=_[_0x87c3('0x43')](_0xd4988c[_0x87c3('0x3f')],qs[_0x87c3('0x56')](_0x18b043[_0x87c3('0x40')][_0x87c3('0x56')]));_0x457a8d[_0x87c3('0x44')]=_0x457a8d[_0x87c3('0x44')][_0x87c3('0x45')]?_0x457a8d[_0x87c3('0x44')]:_0xd4988c[_0x87c3('0x3f')];_0x457a8d['order']=qs[_0x87c3('0x48')](_0x18b043[_0x87c3('0x40')][_0x87c3('0x48')]);_0x457a8d[_0x87c3('0x49')]=qs[_0x87c3('0x42')](_[_0x87c3('0x4a')](_0x18b043[_0x87c3('0x40')],_0xd4988c['filters']));if(_0x18b043[_0x87c3('0x40')][_0x87c3('0x4b')]){_0x457a8d['where']=_[_0x87c3('0x58')](_0x457a8d[_0x87c3('0x49')],{'$or':_['map'](_0x457a8d[_0x87c3('0x44')],function(_0x27247c){var _0x5699e5={};_0x5699e5[_0x27247c]={'$like':'%'+_0x18b043[_0x87c3('0x40')][_0x87c3('0x4b')]+'%'};return _0x5699e5;})});}_0x457a8d=_['merge']({},_0x457a8d,_0x18b043[_0x87c3('0x4e')]);return _0x1d0637[_0x87c3('0x5e')](_0x457a8d);}})[_0x87c3('0x20')](function(_0x3f798a){if(_0x3f798a){_0x389f41=_0x3f798a[_0x87c3('0x45')];if(!_0x18b043[_0x87c3('0x40')][_0x87c3('0x5d')](_0x87c3('0x46'))){_0x457a8d[_0x87c3('0x31')]=qs['limit'](_0x18b043[_0x87c3('0x40')][_0x87c3('0x31')]);_0x457a8d[_0x87c3('0x30')]=qs[_0x87c3('0x30')](_0x18b043[_0x87c3('0x40')]['offset']);}return _0x1d0637[_0x87c3('0x5e')](_0x457a8d);}})[_0x87c3('0x20')](function(_0x2ff428){if(_0x2ff428){return _0x2ff428?{'count':_0x389f41,'rows':_0x2ff428}:null;}})[_0x87c3('0x20')](respondWithResult(_0x543131,null))[_0x87c3('0x53')](handleError(_0x543131,null));};exports[_0x87c3('0x60')]=function(_0x562998,_0x412cc3,_0x4085b7){var _0x3ba761={};var _0x6c3e4b={};var _0xe96527;var _0x250437;return db[_0x87c3('0x4f')][_0x87c3('0x61')]({'where':{'id':_0x562998['params']['id']}})[_0x87c3('0x20')](handleEntityNotFound(_0x412cc3,null))[_0x87c3('0x20')](function(_0x1cad37){if(_0x1cad37){_0xe96527=_0x1cad37;_0x6c3e4b['model']=_['keys'](db[_0x87c3('0x5f')][_0x87c3('0x3d')]);_0x6c3e4b[_0x87c3('0x40')]=_[_0x87c3('0x41')](_0x562998[_0x87c3('0x40')]);_0x6c3e4b['filters']=_[_0x87c3('0x43')](_0x6c3e4b[_0x87c3('0x3f')],_0x6c3e4b['query']);_0x3ba761[_0x87c3('0x44')]=_[_0x87c3('0x43')](_0x6c3e4b['model'],qs[_0x87c3('0x56')](_0x562998[_0x87c3('0x40')][_0x87c3('0x56')]));_0x3ba761[_0x87c3('0x44')]=_0x3ba761[_0x87c3('0x44')][_0x87c3('0x45')]?_0x3ba761[_0x87c3('0x44')]:_0x6c3e4b[_0x87c3('0x3f')];_0x3ba761[_0x87c3('0x47')]=qs[_0x87c3('0x48')](_0x562998[_0x87c3('0x40')][_0x87c3('0x48')]);_0x3ba761[_0x87c3('0x49')]=qs[_0x87c3('0x42')](_[_0x87c3('0x4a')](_0x562998[_0x87c3('0x40')],_0x6c3e4b[_0x87c3('0x42')]));if(_0x562998[_0x87c3('0x40')][_0x87c3('0x4b')]){_0x3ba761[_0x87c3('0x49')]=_[_0x87c3('0x58')](_0x3ba761['where'],{'$or':_[_0x87c3('0x3c')](_0x3ba761[_0x87c3('0x44')],function(_0x5a5369){var _0x429484={};_0x429484[_0x5a5369]={'$like':'%'+_0x562998[_0x87c3('0x40')]['filter']+'%'};return _0x429484;})});}_0x3ba761=_[_0x87c3('0x58')]({},_0x3ba761,_0x562998[_0x87c3('0x4e')]);return _0xe96527[_0x87c3('0x60')](_0x3ba761);}})[_0x87c3('0x20')](function(_0x38c085){if(_0x38c085){_0x250437=_0x38c085['length'];if(!_0x562998[_0x87c3('0x40')][_0x87c3('0x5d')](_0x87c3('0x46'))){_0x3ba761['limit']=qs[_0x87c3('0x31')](_0x562998[_0x87c3('0x40')][_0x87c3('0x31')]);_0x3ba761[_0x87c3('0x30')]=qs[_0x87c3('0x30')](_0x562998[_0x87c3('0x40')][_0x87c3('0x30')]);}return _0xe96527[_0x87c3('0x60')](_0x3ba761);}})[_0x87c3('0x20')](function(_0x46f374){if(_0x46f374){return _0x46f374?{'count':_0x250437,'rows':_0x46f374}:null;}})[_0x87c3('0x20')](respondWithResult(_0x412cc3,null))[_0x87c3('0x53')](handleError(_0x412cc3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 96ad58e..02e00b5 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 _0x7112=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','api','moment','bluebird','request-promise'];(function(_0x453159,_0x2273cf){var _0x2757da=function(_0x3bad39){while(--_0x3bad39){_0x453159['push'](_0x453159['shift']());}};_0x2757da(++_0x2273cf);}(_0x7112,0x1b3));var _0x2711=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7112[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2711('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2711('0x1'));var moment=require(_0x2711('0x2'));var BPromise=require(_0x2711('0x3'));var rp=require(_0x2711('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2711('0x5'));var config=require(_0x2711('0x6'));var attributes=require(_0x2711('0x7'));module['exports']=function(_0x364c53,_0x4005d3){return _0x364c53[_0x2711('0x8')](_0x2711('0x9'),attributes,{'tableName':_0x2711('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3415=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','moment','rimraf'];(function(_0x56fb2e,_0x37c994){var _0x536a28=function(_0x1b294d){while(--_0x1b294d){_0x56fb2e['push'](_0x56fb2e['shift']());}};_0x536a28(++_0x37c994);}(_0x3415,0xd8));var _0x5341=function(_0x5bcd6c,_0x306dc8){_0x5bcd6c=_0x5bcd6c-0x0;var _0x1542f1=_0x3415[_0x5bcd6c];return _0x1542f1;};'use strict';var _=require(_0x5341('0x0'));var util=require('util');var logger=require(_0x5341('0x1'))('api');var moment=require(_0x5341('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5341('0x3'));var config=require(_0x5341('0x4'));var attributes=require(_0x5341('0x5'));module[_0x5341('0x6')]=function(_0x5b3d74,_0x311ad3){return _0x5b3d74[_0x5341('0x7')](_0x5341('0x8'),attributes,{'tableName':_0x5341('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 5e6cc8f..55eb529 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 _0x4688=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x358bf3,_0x40ec1f){var _0x248106=function(_0x2eb1f3){while(--_0x2eb1f3){_0x358bf3['push'](_0x358bf3['shift']());}};_0x248106(++_0x40ec1f);}(_0x4688,0x177));var _0x8468=function(_0x2418e0,_0x7215b0){_0x2418e0=_0x2418e0-0x0;var _0x55ffbf=_0x4688[_0x2418e0];return _0x55ffbf;};'use strict';var _=require(_0x8468('0x0'));var util=require('util');var moment=require(_0x8468('0x1'));var BPromise=require(_0x8468('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8468('0x3'));var db=require(_0x8468('0x4'))['db'];var utils=require(_0x8468('0x5'));var logger=require(_0x8468('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8468('0x7'));var client=jayson[_0x8468('0x8')][_0x8468('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fa119,_0x1276c4,_0x6f169a){return new BPromise(function(_0x41b08f,_0x1ca2e6){return client[_0x8468('0xa')](_0x3fa119,_0x6f169a)['then'](function(_0x154d83){logger[_0x8468('0xb')](_0x8468('0xc'),_0x1276c4,_0x8468('0xd'));logger[_0x8468('0xe')](_0x8468('0xf'),_0x1276c4,'request\x20sent',JSON['stringify'](_0x154d83));if(_0x154d83[_0x8468('0x10')]){if(_0x154d83[_0x8468('0x10')][_0x8468('0x11')]===0x1f4){logger[_0x8468('0x10')](_0x8468('0xc'),_0x1276c4,_0x154d83[_0x8468('0x10')][_0x8468('0x12')]);return _0x1ca2e6(_0x154d83[_0x8468('0x10')][_0x8468('0x12')]);}logger[_0x8468('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1276c4,_0x154d83[_0x8468('0x10')][_0x8468('0x12')]);return _0x41b08f(_0x154d83['error']['message']);}else{logger[_0x8468('0xb')](_0x8468('0xc'),_0x1276c4,_0x8468('0xd'));_0x41b08f(_0x154d83[_0x8468('0x13')]['message']);}})[_0x8468('0x14')](function(_0x1441c0){logger[_0x8468('0x10')](_0x8468('0xc'),_0x1276c4,_0x1441c0);_0x1ca2e6(_0x1441c0);});});} \ No newline at end of file +var _0x5284=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','randomstring'];(function(_0x274540,_0x59ff44){var _0x156702=function(_0x5c72cf){while(--_0x5c72cf){_0x274540['push'](_0x274540['shift']());}};_0x156702(++_0x59ff44);}(_0x5284,0x1d8));var _0x4528=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5284[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x4528('0x0'));var util=require('util');var moment=require(_0x4528('0x1'));var BPromise=require('bluebird');var rs=require(_0x4528('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4528('0x3'));var logger=require(_0x4528('0x4'))(_0x4528('0x5'));var config=require(_0x4528('0x6'));var jayson=require(_0x4528('0x7'));var client=jayson[_0x4528('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x498187,_0x390c15,_0x3580cd){return new BPromise(function(_0x1ddc3f,_0x272ef2){return client['request'](_0x498187,_0x3580cd)[_0x4528('0x9')](function(_0x16cbab){logger[_0x4528('0xa')](_0x4528('0xb'),_0x390c15,'request\x20sent');logger[_0x4528('0xc')](_0x4528('0xd'),_0x390c15,_0x4528('0xe'),JSON['stringify'](_0x16cbab));if(_0x16cbab[_0x4528('0xf')]){if(_0x16cbab[_0x4528('0xf')][_0x4528('0x10')]===0x1f4){logger[_0x4528('0xf')](_0x4528('0xb'),_0x390c15,_0x16cbab['error'][_0x4528('0x11')]);return _0x272ef2(_0x16cbab[_0x4528('0xf')][_0x4528('0x11')]);}logger['error'](_0x4528('0xb'),_0x390c15,_0x16cbab['error'][_0x4528('0x11')]);return _0x1ddc3f(_0x16cbab[_0x4528('0xf')][_0x4528('0x11')]);}else{logger[_0x4528('0xa')](_0x4528('0xb'),_0x390c15,'request\x20sent');_0x1ddc3f(_0x16cbab[_0x4528('0x12')][_0x4528('0x11')]);}})['catch'](function(_0x26222e){logger[_0x4528('0xf')](_0x4528('0xb'),_0x390c15,_0x26222e);_0x272ef2(_0x26222e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9d21571..6862ae1 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 _0xe28e=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0xa7f58b,_0xf501d3){var _0x53b602=function(_0x359cd2){while(--_0x359cd2){_0xa7f58b['push'](_0xa7f58b['shift']());}};_0x53b602(++_0xf501d3);}(_0xe28e,0x1ba));var _0xee28=function(_0x9dac4e,_0x4dc161){_0x9dac4e=_0x9dac4e-0x0;var _0x476a71=_0xe28e[_0x9dac4e];return _0x476a71;};'use strict';var multer=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var path=require(_0xee28('0x2'));var timeout=require(_0xee28('0x3'));var express=require(_0xee28('0x4'));var router=express[_0xee28('0x5')]();var auth=require(_0xee28('0x6'));var interaction=require(_0xee28('0x7'));var config=require(_0xee28('0x8'));var controller=require(_0xee28('0x9'));router[_0xee28('0xa')]('/',auth[_0xee28('0xb')](),controller[_0xee28('0xc')]);router['get'](_0xee28('0xd'),auth[_0xee28('0xb')](),controller[_0xee28('0xe')]);router[_0xee28('0xf')]('/',auth[_0xee28('0xb')](),controller[_0xee28('0x10')]);router[_0xee28('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xee28('0x12')](_0xee28('0xd'),auth['isAuthenticated'](),controller[_0xee28('0x13')]);module[_0xee28('0x14')]=router; \ No newline at end of file +var _0x867f=['../../config/environment','isAuthenticated','index','get','/:id','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x10d8a0,_0x583b3f){var _0x2e49e1=function(_0x14ed1c){while(--_0x14ed1c){_0x10d8a0['push'](_0x10d8a0['shift']());}};_0x2e49e1(++_0x583b3f);}(_0x867f,0xe6));var _0xf867=function(_0x549555,_0x5c2217){_0x549555=_0x549555-0x0;var _0x259593=_0x867f[_0x549555];return _0x259593;};'use strict';var multer=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var path=require(_0xf867('0x2'));var timeout=require(_0xf867('0x3'));var express=require(_0xf867('0x4'));var router=express[_0xf867('0x5')]();var auth=require(_0xf867('0x6'));var interaction=require(_0xf867('0x7'));var config=require(_0xf867('0x8'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xf867('0x9')](),controller[_0xf867('0xa')]);router[_0xf867('0xb')](_0xf867('0xc'),auth[_0xf867('0x9')](),controller['show']);router['post']('/',auth[_0xf867('0x9')](),controller['create']);router[_0xf867('0xd')](_0xf867('0xc'),auth[_0xf867('0x9')](),controller[_0xf867('0xe')]);router[_0xf867('0xf')](_0xf867('0xc'),auth[_0xf867('0x9')](),controller[_0xf867('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index f2413ac..a98a796 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 _0x1145=['STRING','variable','customVariable','sequelize','exports','ENUM','string'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x1145,0xc7));var _0x5114=function(_0x2f02d9,_0x4d3dc7){_0x2f02d9=_0x2f02d9-0x0;var _0x31c00d=_0x1145[_0x2f02d9];return _0x31c00d;};'use strict';var Sequelize=require(_0x5114('0x0'));module[_0x5114('0x1')]={'type':{'type':Sequelize[_0x5114('0x2')]('string','variable','customVariable','keyValue'),'defaultValue':_0x5114('0x3')},'content':{'type':Sequelize[_0x5114('0x4')]},'key':{'type':Sequelize[_0x5114('0x4')]},'keyType':{'type':Sequelize[_0x5114('0x2')](_0x5114('0x3'),_0x5114('0x5'),_0x5114('0x6'))},'keyContent':{'type':Sequelize[_0x5114('0x4')]},'idField':{'type':Sequelize[_0x5114('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5114('0x4')]}}; \ No newline at end of file +var _0x3069=['customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize','string'];(function(_0x5e19ee,_0x5395be){var _0x4fce7c=function(_0x46c733){while(--_0x46c733){_0x5e19ee['push'](_0x5e19ee['shift']());}};_0x4fce7c(++_0x5395be);}(_0x3069,0x1e6));var _0x9306=function(_0x1fc429,_0x2321df){_0x1fc429=_0x1fc429-0x0;var _0x10d7a7=_0x3069[_0x1fc429];return _0x10d7a7;};'use strict';var Sequelize=require(_0x9306('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x9306('0x1'),'variable',_0x9306('0x2'),_0x9306('0x3')),'defaultValue':_0x9306('0x1')},'content':{'type':Sequelize[_0x9306('0x4')]},'key':{'type':Sequelize[_0x9306('0x4')]},'keyType':{'type':Sequelize[_0x9306('0x5')](_0x9306('0x1'),_0x9306('0x6'),_0x9306('0x2'))},'keyContent':{'type':Sequelize[_0x9306('0x4')]},'idField':{'type':Sequelize[_0x9306('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9306('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9306('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b26cfb3..cf38d16 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 _0x2313=['hasOwnProperty','nolimit','order','sort','where','map','filter','merge','options','findAll','rows','catch','show','params','keys','length','includeAll','include','find','create','body','html-pdf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x5c1255,_0xe7aeff){var _0x1824d8=function(_0x3791f3){while(--_0x3791f3){_0x5c1255['push'](_0x5c1255['shift']());}};_0x1824d8(++_0xe7aeff);}(_0x2313,0x191));var _0x3231=function(_0x5bf4a7,_0x226831){_0x5bf4a7=_0x5bf4a7-0x0;var _0x3a8736=_0x2313[_0x5bf4a7];return _0x3a8736;};'use strict';var pdf=require(_0x3231('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3231('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3231('0x2'));var moment=require(_0x3231('0x3'));var BPromise=require(_0x3231('0x4'));var Mustache=require('mustache');var util=require(_0x3231('0x5'));var path=require('path');var sox=require(_0x3231('0x6'));var csv=require(_0x3231('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3231('0x8'));var squel=require(_0x3231('0x9'));var crypto=require(_0x3231('0xa'));var jsforce=require(_0x3231('0xb'));var deskjs=require(_0x3231('0xc'));var toCsv=require(_0x3231('0x7'));var querystring=require(_0x3231('0xd'));var Papa=require(_0x3231('0xe'));var Redis=require(_0x3231('0xf'));var authService=require(_0x3231('0x10'));var qs=require(_0x3231('0x11'));var as=require(_0x3231('0x12'));var hardwareService=require(_0x3231('0x13'));var logger=require(_0x3231('0x14'))(_0x3231('0x15'));var utils=require(_0x3231('0x16'));var config=require(_0x3231('0x17'));var db=require(_0x3231('0x18'))['db'];function respondWithStatusCode(_0x3330e8,_0x143d6c){_0x143d6c=_0x143d6c||0xcc;return function(_0x4cd784){if(_0x4cd784){return _0x3330e8[_0x3231('0x19')](_0x143d6c);}return _0x3330e8[_0x3231('0x1a')](_0x143d6c)['end']();};}function respondWithResult(_0x50e909,_0x32f0bf){_0x32f0bf=_0x32f0bf||0xc8;return function(_0x5c1e28){if(_0x5c1e28){return _0x50e909[_0x3231('0x1a')](_0x32f0bf)[_0x3231('0x1b')](_0x5c1e28);}};}function respondWithFilteredResult(_0x1253e6,_0x378015){return function(_0x538db9){if(_0x538db9){var _0x58f108=_0x538db9[_0x3231('0x1c')],_0x41eaa2=_0x378015[_0x3231('0x1d')],_0x46deaf=_0x378015[_0x3231('0x1d')]+_0x378015[_0x3231('0x1e')],_0x158bec;if(_0x46deaf>=_0x58f108){_0x46deaf=_0x58f108;_0x158bec=0xc8;}else{_0x158bec=0xce;}_0x1253e6['status'](_0x158bec);return _0x1253e6[_0x3231('0x1f')](_0x3231('0x20'),_0x41eaa2+'-'+_0x46deaf+'/'+_0x58f108)[_0x3231('0x1b')](_0x538db9);}return null;};}function patchUpdates(_0x3bc550){return function(_0x4d2c85){try{jsonpatch['apply'](_0x4d2c85,_0x3bc550,!![]);}catch(_0x57098a){return BPromise[_0x3231('0x21')](_0x57098a);}return _0x4d2c85[_0x3231('0x22')]();};}function saveUpdates(_0x5a028d,_0x4c0f7c){return function(_0x5cb4d3){if(_0x5cb4d3){return _0x5cb4d3[_0x3231('0x23')](_0x5a028d)[_0x3231('0x24')](function(_0x589902){return _0x589902;});}return null;};}function removeEntity(_0x2cffd9,_0x1e80f1){return function(_0x446eba){if(_0x446eba){return _0x446eba[_0x3231('0x25')]()[_0x3231('0x24')](function(){_0x2cffd9[_0x3231('0x1a')](0xcc)[_0x3231('0x26')]();});}};}function handleEntityNotFound(_0x1e4eb4,_0x2332f1){return function(_0x13a616){if(!_0x13a616){_0x1e4eb4[_0x3231('0x19')](0x194);}return _0x13a616;};}function handleError(_0x29b84d,_0x779c27){_0x779c27=_0x779c27||0x1f4;return function(_0x141aa9){logger[_0x3231('0x27')](_0x141aa9[_0x3231('0x28')]);if(_0x141aa9[_0x3231('0x29')]){delete _0x141aa9['name'];}_0x29b84d[_0x3231('0x1a')](_0x779c27)[_0x3231('0x2a')](_0x141aa9);};}exports[_0x3231('0x2b')]=function(_0x3ba011,_0x231824){var _0x1a6980={},_0x19f10b={},_0x738635={'count':0x0,'rows':[]};var _0x2170a5=_['map'](db[_0x3231('0x2c')][_0x3231('0x2d')],function(_0x146707){return{'name':_0x146707[_0x3231('0x2e')],'type':_0x146707[_0x3231('0x2f')][_0x3231('0x30')]};});_0x19f10b[_0x3231('0x31')]=_['map'](_0x2170a5,_0x3231('0x29'));_0x19f10b[_0x3231('0x32')]=_['keys'](_0x3ba011[_0x3231('0x32')]);_0x19f10b[_0x3231('0x33')]=_[_0x3231('0x34')](_0x19f10b['model'],_0x19f10b[_0x3231('0x32')]);_0x1a6980[_0x3231('0x35')]=_[_0x3231('0x34')](_0x19f10b[_0x3231('0x31')],qs[_0x3231('0x36')](_0x3ba011[_0x3231('0x32')][_0x3231('0x36')]));_0x1a6980[_0x3231('0x35')]=_0x1a6980[_0x3231('0x35')]['length']?_0x1a6980[_0x3231('0x35')]:_0x19f10b[_0x3231('0x31')];if(!_0x3ba011['query'][_0x3231('0x37')](_0x3231('0x38'))){_0x1a6980[_0x3231('0x1e')]=qs['limit'](_0x3ba011[_0x3231('0x32')]['limit']);_0x1a6980[_0x3231('0x1d')]=qs[_0x3231('0x1d')](_0x3ba011['query'][_0x3231('0x1d')]);}_0x1a6980[_0x3231('0x39')]=qs[_0x3231('0x3a')](_0x3ba011[_0x3231('0x32')]['sort']);_0x1a6980[_0x3231('0x3b')]=qs[_0x3231('0x33')](_['pick'](_0x3ba011[_0x3231('0x32')],_0x19f10b['filters']),_0x2170a5);if(_0x3ba011['query']['filter']){_0x1a6980[_0x3231('0x3b')]=_['merge'](_0x1a6980[_0x3231('0x3b')],{'$or':_[_0x3231('0x3c')](_0x2170a5,function(_0x3cd445){if(_0x3cd445[_0x3231('0x2f')]!=='VIRTUAL'){var _0x3bdafc={};_0x3bdafc[_0x3cd445['name']]={'$like':'%'+_0x3ba011[_0x3231('0x32')][_0x3231('0x3d')]+'%'};return _0x3bdafc;}})});}_0x1a6980=_[_0x3231('0x3e')]({},_0x1a6980,_0x3ba011[_0x3231('0x3f')]);var _0x48003f={'where':_0x1a6980['where']};return db[_0x3231('0x2c')][_0x3231('0x1c')](_0x48003f)['then'](function(_0x4202e0){_0x738635[_0x3231('0x1c')]=_0x4202e0;if(_0x3ba011[_0x3231('0x32')]['includeAll']){_0x1a6980['include']=[{'all':!![]}];}return db[_0x3231('0x2c')][_0x3231('0x40')](_0x1a6980);})[_0x3231('0x24')](function(_0x36fab6){_0x738635[_0x3231('0x41')]=_0x36fab6;return _0x738635;})[_0x3231('0x24')](respondWithFilteredResult(_0x231824,_0x1a6980))[_0x3231('0x42')](handleError(_0x231824,null));};exports[_0x3231('0x43')]=function(_0x56f302,_0x2187d2){var _0x2a20b5={'raw':!![],'where':{'id':_0x56f302[_0x3231('0x44')]['id']}},_0x12c7c3={};_0x12c7c3[_0x3231('0x31')]=_[_0x3231('0x45')](db[_0x3231('0x2c')][_0x3231('0x2d')]);_0x12c7c3[_0x3231('0x32')]=_[_0x3231('0x45')](_0x56f302[_0x3231('0x32')]);_0x12c7c3[_0x3231('0x33')]=_['intersection'](_0x12c7c3[_0x3231('0x31')],_0x12c7c3[_0x3231('0x32')]);_0x2a20b5[_0x3231('0x35')]=_[_0x3231('0x34')](_0x12c7c3[_0x3231('0x31')],qs[_0x3231('0x36')](_0x56f302['query'][_0x3231('0x36')]));_0x2a20b5['attributes']=_0x2a20b5[_0x3231('0x35')][_0x3231('0x46')]?_0x2a20b5[_0x3231('0x35')]:_0x12c7c3[_0x3231('0x31')];if(_0x56f302[_0x3231('0x32')][_0x3231('0x47')]){_0x2a20b5[_0x3231('0x48')]=[{'all':!![]}];}_0x2a20b5=_[_0x3231('0x3e')]({},_0x2a20b5,_0x56f302[_0x3231('0x3f')]);return db[_0x3231('0x2c')][_0x3231('0x49')](_0x2a20b5)['then'](handleEntityNotFound(_0x2187d2,null))[_0x3231('0x24')](respondWithResult(_0x2187d2,null))[_0x3231('0x42')](handleError(_0x2187d2,null));};exports['create']=function(_0x2cbf51,_0xee5ff0){return db['Dynamics365Field'][_0x3231('0x4a')](_0x2cbf51[_0x3231('0x4b')],{})[_0x3231('0x24')](respondWithResult(_0xee5ff0,0xc9))[_0x3231('0x42')](handleError(_0xee5ff0,null));};exports['update']=function(_0x3a78b7,_0xd30486){if(_0x3a78b7['body']['id']){delete _0x3a78b7[_0x3231('0x4b')]['id'];}return db[_0x3231('0x2c')][_0x3231('0x49')]({'where':{'id':_0x3a78b7[_0x3231('0x44')]['id']}})[_0x3231('0x24')](handleEntityNotFound(_0xd30486,null))[_0x3231('0x24')](saveUpdates(_0x3a78b7[_0x3231('0x4b')],null))[_0x3231('0x24')](respondWithResult(_0xd30486,null))[_0x3231('0x42')](handleError(_0xd30486,null));};exports[_0x3231('0x25')]=function(_0x164044,_0x44a47c){return db[_0x3231('0x2c')][_0x3231('0x49')]({'where':{'id':_0x164044[_0x3231('0x44')]['id']}})[_0x3231('0x24')](handleEntityNotFound(_0x44a47c,null))[_0x3231('0x24')](removeEntity(_0x44a47c,null))[_0x3231('0x42')](handleError(_0x44a47c,null));}; \ No newline at end of file +var _0x075e=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','error','stack','name','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','include','findAll','catch','show','params','length','includeAll','find'];(function(_0x3d6295,_0x1f3258){var _0x17e096=function(_0x4606be){while(--_0x4606be){_0x3d6295['push'](_0x3d6295['shift']());}};_0x17e096(++_0x1f3258);}(_0x075e,0x92));var _0xe075=function(_0x43f6ee,_0x167363){_0x43f6ee=_0x43f6ee-0x0;var _0x3d0e02=_0x075e[_0x43f6ee];return _0x3d0e02;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe075('0x0'));var rimraf=require(_0xe075('0x1'));var zipdir=require(_0xe075('0x2'));var jsonpatch=require(_0xe075('0x3'));var rp=require(_0xe075('0x4'));var moment=require(_0xe075('0x5'));var BPromise=require(_0xe075('0x6'));var Mustache=require(_0xe075('0x7'));var util=require('util');var path=require(_0xe075('0x8'));var sox=require(_0xe075('0x9'));var csv=require('to-csv');var ejs=require(_0xe075('0xa'));var fs=require('fs');var _=require(_0xe075('0xb'));var squel=require(_0xe075('0xc'));var crypto=require(_0xe075('0xd'));var jsforce=require(_0xe075('0xe'));var deskjs=require(_0xe075('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe075('0x10'));var Papa=require(_0xe075('0x11'));var Redis=require('ioredis');var authService=require(_0xe075('0x12'));var qs=require(_0xe075('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe075('0x14'));var logger=require(_0xe075('0x15'))(_0xe075('0x16'));var utils=require(_0xe075('0x17'));var config=require(_0xe075('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53223a,_0x541a66){_0x541a66=_0x541a66||0xcc;return function(_0x414adb){if(_0x414adb){return _0x53223a[_0xe075('0x19')](_0x541a66);}return _0x53223a[_0xe075('0x1a')](_0x541a66)[_0xe075('0x1b')]();};}function respondWithResult(_0x4d0182,_0x21aa92){_0x21aa92=_0x21aa92||0xc8;return function(_0x4fbf61){if(_0x4fbf61){return _0x4d0182[_0xe075('0x1a')](_0x21aa92)[_0xe075('0x1c')](_0x4fbf61);}};}function respondWithFilteredResult(_0x1cbf7e,_0x403a6d){return function(_0x1d283a){if(_0x1d283a){var _0x5767d3=_0x1d283a[_0xe075('0x1d')],_0x58a9a9=_0x403a6d[_0xe075('0x1e')],_0xe08799=_0x403a6d[_0xe075('0x1e')]+_0x403a6d[_0xe075('0x1f')],_0x16d8fc;if(_0xe08799>=_0x5767d3){_0xe08799=_0x5767d3;_0x16d8fc=0xc8;}else{_0x16d8fc=0xce;}_0x1cbf7e[_0xe075('0x1a')](_0x16d8fc);return _0x1cbf7e['set'](_0xe075('0x20'),_0x58a9a9+'-'+_0xe08799+'/'+_0x5767d3)[_0xe075('0x1c')](_0x1d283a);}return null;};}function patchUpdates(_0x2c3953){return function(_0xeb0586){try{jsonpatch['apply'](_0xeb0586,_0x2c3953,!![]);}catch(_0x3893db){return BPromise[_0xe075('0x21')](_0x3893db);}return _0xeb0586[_0xe075('0x22')]();};}function saveUpdates(_0x3623f2,_0x308360){return function(_0x3691c6){if(_0x3691c6){return _0x3691c6[_0xe075('0x23')](_0x3623f2)['then'](function(_0x487cb3){return _0x487cb3;});}return null;};}function removeEntity(_0x459445,_0x213880){return function(_0x265769){if(_0x265769){return _0x265769[_0xe075('0x24')]()['then'](function(){_0x459445['status'](0xcc)[_0xe075('0x1b')]();});}};}function handleEntityNotFound(_0x125042,_0x1120e2){return function(_0x532e63){if(!_0x532e63){_0x125042[_0xe075('0x19')](0x194);}return _0x532e63;};}function handleError(_0x49a989,_0x24a924){_0x24a924=_0x24a924||0x1f4;return function(_0x31b1bd){logger[_0xe075('0x25')](_0x31b1bd[_0xe075('0x26')]);if(_0x31b1bd[_0xe075('0x27')]){delete _0x31b1bd['name'];}_0x49a989[_0xe075('0x1a')](_0x24a924)['send'](_0x31b1bd);};}exports['index']=function(_0x54838c,_0x523934){var _0x3e68e2={},_0x59520e={},_0xf797f3={'count':0x0,'rows':[]};var _0x1901c1=_[_0xe075('0x28')](db[_0xe075('0x29')][_0xe075('0x2a')],function(_0x43570b){return{'name':_0x43570b['fieldName'],'type':_0x43570b[_0xe075('0x2b')][_0xe075('0x2c')]};});_0x59520e[_0xe075('0x2d')]=_['map'](_0x1901c1,'name');_0x59520e[_0xe075('0x2e')]=_[_0xe075('0x2f')](_0x54838c[_0xe075('0x2e')]);_0x59520e[_0xe075('0x30')]=_[_0xe075('0x31')](_0x59520e[_0xe075('0x2d')],_0x59520e[_0xe075('0x2e')]);_0x3e68e2[_0xe075('0x32')]=_['intersection'](_0x59520e[_0xe075('0x2d')],qs['fields'](_0x54838c[_0xe075('0x2e')][_0xe075('0x33')]));_0x3e68e2[_0xe075('0x32')]=_0x3e68e2['attributes']['length']?_0x3e68e2[_0xe075('0x32')]:_0x59520e[_0xe075('0x2d')];if(!_0x54838c[_0xe075('0x2e')][_0xe075('0x34')](_0xe075('0x35'))){_0x3e68e2[_0xe075('0x1f')]=qs['limit'](_0x54838c[_0xe075('0x2e')][_0xe075('0x1f')]);_0x3e68e2[_0xe075('0x1e')]=qs[_0xe075('0x1e')](_0x54838c['query'][_0xe075('0x1e')]);}_0x3e68e2[_0xe075('0x36')]=qs[_0xe075('0x37')](_0x54838c[_0xe075('0x2e')][_0xe075('0x37')]);_0x3e68e2[_0xe075('0x38')]=qs[_0xe075('0x30')](_[_0xe075('0x39')](_0x54838c[_0xe075('0x2e')],_0x59520e[_0xe075('0x30')]),_0x1901c1);if(_0x54838c[_0xe075('0x2e')][_0xe075('0x3a')]){_0x3e68e2[_0xe075('0x38')]=_[_0xe075('0x3b')](_0x3e68e2[_0xe075('0x38')],{'$or':_[_0xe075('0x28')](_0x1901c1,function(_0x5ad672){if(_0x5ad672[_0xe075('0x2b')]!=='VIRTUAL'){var _0x33f842={};_0x33f842[_0x5ad672[_0xe075('0x27')]]={'$like':'%'+_0x54838c[_0xe075('0x2e')][_0xe075('0x3a')]+'%'};return _0x33f842;}})});}_0x3e68e2=_['merge']({},_0x3e68e2,_0x54838c[_0xe075('0x3c')]);var _0x5e55b4={'where':_0x3e68e2['where']};return db[_0xe075('0x29')][_0xe075('0x1d')](_0x5e55b4)[_0xe075('0x3d')](function(_0x471b53){_0xf797f3[_0xe075('0x1d')]=_0x471b53;if(_0x54838c[_0xe075('0x2e')]['includeAll']){_0x3e68e2[_0xe075('0x3e')]=[{'all':!![]}];}return db[_0xe075('0x29')][_0xe075('0x3f')](_0x3e68e2);})[_0xe075('0x3d')](function(_0x31d010){_0xf797f3['rows']=_0x31d010;return _0xf797f3;})[_0xe075('0x3d')](respondWithFilteredResult(_0x523934,_0x3e68e2))[_0xe075('0x40')](handleError(_0x523934,null));};exports[_0xe075('0x41')]=function(_0x17a301,_0x12bc09){var _0x6d4afe={'raw':!![],'where':{'id':_0x17a301[_0xe075('0x42')]['id']}},_0x1330b4={};_0x1330b4['model']=_['keys'](db[_0xe075('0x29')][_0xe075('0x2a')]);_0x1330b4[_0xe075('0x2e')]=_[_0xe075('0x2f')](_0x17a301[_0xe075('0x2e')]);_0x1330b4[_0xe075('0x30')]=_['intersection'](_0x1330b4[_0xe075('0x2d')],_0x1330b4[_0xe075('0x2e')]);_0x6d4afe[_0xe075('0x32')]=_['intersection'](_0x1330b4[_0xe075('0x2d')],qs[_0xe075('0x33')](_0x17a301['query'][_0xe075('0x33')]));_0x6d4afe[_0xe075('0x32')]=_0x6d4afe['attributes'][_0xe075('0x43')]?_0x6d4afe['attributes']:_0x1330b4['model'];if(_0x17a301['query'][_0xe075('0x44')]){_0x6d4afe[_0xe075('0x3e')]=[{'all':!![]}];}_0x6d4afe=_[_0xe075('0x3b')]({},_0x6d4afe,_0x17a301[_0xe075('0x3c')]);return db[_0xe075('0x29')][_0xe075('0x45')](_0x6d4afe)[_0xe075('0x3d')](handleEntityNotFound(_0x12bc09,null))[_0xe075('0x3d')](respondWithResult(_0x12bc09,null))[_0xe075('0x40')](handleError(_0x12bc09,null));};exports[_0xe075('0x46')]=function(_0x35f7c4,_0xd7d246){return db[_0xe075('0x29')][_0xe075('0x46')](_0x35f7c4['body'],{})[_0xe075('0x3d')](respondWithResult(_0xd7d246,0xc9))[_0xe075('0x40')](handleError(_0xd7d246,null));};exports[_0xe075('0x23')]=function(_0x15f6d0,_0x1979bd){if(_0x15f6d0[_0xe075('0x47')]['id']){delete _0x15f6d0[_0xe075('0x47')]['id'];}return db[_0xe075('0x29')][_0xe075('0x45')]({'where':{'id':_0x15f6d0['params']['id']}})[_0xe075('0x3d')](handleEntityNotFound(_0x1979bd,null))[_0xe075('0x3d')](saveUpdates(_0x15f6d0[_0xe075('0x47')],null))[_0xe075('0x3d')](respondWithResult(_0x1979bd,null))[_0xe075('0x40')](handleError(_0x1979bd,null));};exports[_0xe075('0x24')]=function(_0x4b3499,_0x569977){return db['Dynamics365Field'][_0xe075('0x45')]({'where':{'id':_0x4b3499['params']['id']}})[_0xe075('0x3d')](handleEntityNotFound(_0x569977,null))[_0xe075('0x3d')](removeEntity(_0x569977,null))[_0xe075('0x40')](handleError(_0x569977,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a001970..0a93195 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 _0xb34d=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','idField','lodash','api','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb34d,0x9d));var _0xdb34=function(_0x4cc652,_0xa34aa5){_0x4cc652=_0x4cc652-0x0;var _0x496a8b=_0xb34d[_0x4cc652];return _0x496a8b;};'use strict';var _=require(_0xdb34('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb34('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb34('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb34('0x3'));var config=require(_0xdb34('0x4'));var attributes=require(_0xdb34('0x5'));module[_0xdb34('0x6')]=function(_0x1c21eb,_0x3184bd){return _0x1c21eb[_0xdb34('0x7')](_0xdb34('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xdb34('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x94a5=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x94a5,0x7e));var _0x594a=function(_0x55e1db,_0x446f3f){_0x55e1db=_0x55e1db-0x0;var _0x2e06e0=_0x94a5[_0x55e1db];return _0x2e06e0;};'use strict';var _=require('lodash');var util=require(_0x594a('0x0'));var logger=require(_0x594a('0x1'))(_0x594a('0x2'));var moment=require(_0x594a('0x3'));var BPromise=require(_0x594a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x594a('0x5'));var rimraf=require(_0x594a('0x6'));var config=require(_0x594a('0x7'));var attributes=require(_0x594a('0x8'));module['exports']=function(_0x4031ea,_0x112b13){return _0x4031ea[_0x594a('0x9')](_0x594a('0xa'),attributes,{'tableName':_0x594a('0xb'),'paranoid':![],'indexes':[{'name':_0x594a('0xc'),'fields':[_0x594a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index e805c9b..1bffb41 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 _0x363e=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x363e,0x179));var _0xe363=function(_0xe5410d,_0x4cf8fd){_0xe5410d=_0xe5410d-0x0;var _0x1669ee=_0x363e[_0xe5410d];return _0x1669ee;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var moment=require('moment');var BPromise=require(_0xe363('0x2'));var rs=require(_0xe363('0x3'));var fs=require('fs');var Redis=require(_0xe363('0x4'));var db=require(_0xe363('0x5'))['db'];var utils=require(_0xe363('0x6'));var logger=require(_0xe363('0x7'))(_0xe363('0x8'));var config=require(_0xe363('0x9'));var jayson=require(_0xe363('0xa'));var client=jayson[_0xe363('0xb')][_0xe363('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fe10b,_0x1fc808,_0x30bffc){return new BPromise(function(_0xc5df66,_0x29d330){return client['request'](_0x4fe10b,_0x30bffc)[_0xe363('0xd')](function(_0x308de7){logger[_0xe363('0xe')](_0xe363('0xf'),_0x1fc808,_0xe363('0x10'));logger[_0xe363('0x11')](_0xe363('0x12'),_0x1fc808,'request\x20sent',JSON[_0xe363('0x13')](_0x308de7));if(_0x308de7[_0xe363('0x14')]){if(_0x308de7['error'][_0xe363('0x15')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0x29d330(_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);}logger[_0xe363('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0xc5df66(_0x308de7['error'][_0xe363('0x16')]);}else{logger[_0xe363('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x1fc808,_0xe363('0x10'));_0xc5df66(_0x308de7[_0xe363('0x17')]['message']);}})[_0xe363('0x18')](function(_0xc94d0a){logger['error'](_0xe363('0xf'),_0x1fc808,_0xc94d0a);_0x29d330(_0xc94d0a);});});} \ No newline at end of file +var _0x7f94=['Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xf8a419,_0x4d2075){var _0xf61db2=function(_0x53388e){while(--_0x53388e){_0xf8a419['push'](_0xf8a419['shift']());}};_0xf61db2(++_0x4d2075);}(_0x7f94,0x65));var _0x47f9=function(_0x558484,_0x2d7a8c){_0x558484=_0x558484-0x0;var _0x10c7dc=_0x7f94[_0x558484];return _0x10c7dc;};'use strict';var _=require(_0x47f9('0x0'));var util=require('util');var moment=require(_0x47f9('0x1'));var BPromise=require(_0x47f9('0x2'));var rs=require(_0x47f9('0x3'));var fs=require('fs');var Redis=require(_0x47f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47f9('0x5'));var logger=require(_0x47f9('0x6'))(_0x47f9('0x7'));var config=require(_0x47f9('0x8'));var jayson=require(_0x47f9('0x9'));var client=jayson[_0x47f9('0xa')][_0x47f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x572cab,_0x42fa6d,_0x4a8f54){return new BPromise(function(_0x23ab0b,_0x3240cf){return client[_0x47f9('0xc')](_0x572cab,_0x4a8f54)[_0x47f9('0xd')](function(_0x813b51){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x42fa6d,'request\x20sent');logger['debug'](_0x47f9('0xe'),_0x42fa6d,_0x47f9('0xf'),JSON[_0x47f9('0x10')](_0x813b51));if(_0x813b51[_0x47f9('0x11')]){if(_0x813b51[_0x47f9('0x11')][_0x47f9('0x12')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x42fa6d,_0x813b51[_0x47f9('0x11')]['message']);return _0x3240cf(_0x813b51['error']['message']);}logger[_0x47f9('0x11')](_0x47f9('0x13'),_0x42fa6d,_0x813b51['error'][_0x47f9('0x14')]);return _0x23ab0b(_0x813b51[_0x47f9('0x11')][_0x47f9('0x14')]);}else{logger[_0x47f9('0x15')]('Dynamics365Field,\x20%s,\x20%s',_0x42fa6d,_0x47f9('0xf'));_0x23ab0b(_0x813b51[_0x47f9('0x16')][_0x47f9('0x14')]);}})[_0x47f9('0x17')](function(_0x27ad5e){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x42fa6d,_0x27ad5e);_0x3240cf(_0x27ad5e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c061958..456cfa7 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 _0xd4a3=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x68c5e3,_0x39cc2a){var _0x105064=function(_0x3dd11b){while(--_0x3dd11b){_0x68c5e3['push'](_0x68c5e3['shift']());}};_0x105064(++_0x39cc2a);}(_0xd4a3,0x145));var _0x3d4a=function(_0x204346,_0x838e13){_0x204346=_0x204346-0x0;var _0x26a327=_0xd4a3[_0x204346];return _0x26a327;};'use strict';var multer=require(_0x3d4a('0x0'));var util=require('util');var path=require(_0x3d4a('0x1'));var timeout=require(_0x3d4a('0x2'));var express=require(_0x3d4a('0x3'));var router=express['Router']();var auth=require(_0x3d4a('0x4'));var interaction=require(_0x3d4a('0x5'));var config=require(_0x3d4a('0x6'));var controller=require(_0x3d4a('0x7'));router[_0x3d4a('0x8')]('/',auth[_0x3d4a('0x9')](),controller[_0x3d4a('0xa')]);router[_0x3d4a('0x8')](_0x3d4a('0xb'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0xc')]);router[_0x3d4a('0x8')](_0x3d4a('0xd'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0xe')]);router[_0x3d4a('0x8')](_0x3d4a('0xf'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0x10')]);router[_0x3d4a('0x11')]('/',auth['isAuthenticated'](),controller[_0x3d4a('0x12')]);router[_0x3d4a('0x11')]('/:id/configurations',auth[_0x3d4a('0x9')](),controller[_0x3d4a('0x13')]);router[_0x3d4a('0x14')](_0x3d4a('0xb'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0x15')]);router[_0x3d4a('0x16')](_0x3d4a('0xb'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0x17')]);module[_0x3d4a('0x18')]=router; \ No newline at end of file +var _0x4d1d=['exports','multer','util','path','express','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','destroy'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4d1d,0x1cd));var _0xd4d1=function(_0xeef7d1,_0x3bfbf5){_0xeef7d1=_0xeef7d1-0x0;var _0x5416ec=_0x4d1d[_0xeef7d1];return _0x5416ec;};'use strict';var multer=require(_0xd4d1('0x0'));var util=require(_0xd4d1('0x1'));var path=require(_0xd4d1('0x2'));var timeout=require('connect-timeout');var express=require(_0xd4d1('0x3'));var router=express['Router']();var auth=require(_0xd4d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd4d1('0x5'));var controller=require(_0xd4d1('0x6'));router[_0xd4d1('0x7')]('/',auth[_0xd4d1('0x8')](),controller['index']);router[_0xd4d1('0x7')](_0xd4d1('0x9'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0xa')]);router[_0xd4d1('0x7')](_0xd4d1('0xb'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0xc')]);router[_0xd4d1('0x7')](_0xd4d1('0xd'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0xe')]);router['post']('/',auth[_0xd4d1('0x8')](),controller['create']);router[_0xd4d1('0xf')](_0xd4d1('0xb'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0x10')]);router['put'](_0xd4d1('0x9'),auth[_0xd4d1('0x8')](),controller['update']);router[_0xd4d1('0x11')](_0xd4d1('0x9'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0x12')]);module[_0xd4d1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index a8c95a0..3482ce0 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 _0x3f96=['exports','STRING','remoteUri','sequelize'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0x3f96,0x1d3));var _0x63f9=function(_0x2dee30,_0x4d1fd2){_0x2dee30=_0x2dee30-0x0;var _0x37495f=_0x3f96[_0x2dee30];return _0x37495f;};'use strict';var Sequelize=require(_0x63f9('0x0'));module[_0x63f9('0x1')]={'name':{'type':Sequelize[_0x63f9('0x2')]},'description':{'type':Sequelize[_0x63f9('0x2')]},'username':{'type':Sequelize[_0x63f9('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x63f9('0x2')]},'remoteUri':{'type':Sequelize[_0x63f9('0x2')],'unique':_0x63f9('0x3')},'serverUrl':{'type':Sequelize[_0x63f9('0x2')]}}; \ No newline at end of file +var _0x8325=['STRING','remoteUri','sequelize'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0x8325,0x1f1));var _0x5832=function(_0x47fc57,_0x5f0285){_0x47fc57=_0x47fc57-0x0;var _0x12944a=_0x8325[_0x47fc57];return _0x12944a;};'use strict';var Sequelize=require(_0x5832('0x0'));module['exports']={'name':{'type':Sequelize[_0x5832('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5832('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0x5832('0x1')]},'remoteUri':{'type':Sequelize[_0x5832('0x1')],'unique':_0x5832('0x2')},'serverUrl':{'type':Sequelize[_0x5832('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index eaf9230..ec72d14 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 _0xf494=['set','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','agent','description','source','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','status','end','count','limit'];(function(_0x19e3c9,_0x2fb0c3){var _0x377fc9=function(_0x5bd928){while(--_0x5bd928){_0x19e3c9['push'](_0x19e3c9['shift']());}};_0x377fc9(++_0x2fb0c3);}(_0xf494,0x1c6));var _0x4f49=function(_0x544979,_0x49cc6b){_0x544979=_0x544979-0x0;var _0x3c8d11=_0xf494[_0x544979];return _0x3c8d11;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f49('0x18'));var jayson=require(_0x4f49('0x19'));var client=jayson['client'][_0x4f49('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x111a8b,_0x1b9145,_0x2efe49){if(_0x2efe49){var _0x1a0f1e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a0f1e[_0x4f49('0x1b')](_0x1b9145)){return _0x111a8b;}else{throw new db[(_0x4f49('0x1c'))]['ValidationError'](_0x4f49('0x1d'));}}else{return _0x111a8b;}}function respondWithRpcPromise(_0x1f2d0d,_0x415e83,_0x5878f4,_0x5bdfaf){return new BPromise(function(_0x2f0a0d,_0x2ecaaa){var _0x74886e=_0x5bdfaf||client;return _0x74886e['request'](_0x1f2d0d,_0x5878f4)[_0x4f49('0x1e')](function(_0x399be7){logger[_0x4f49('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0x415e83,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x415e83,_0x4f49('0x20'),JSON[_0x4f49('0x21')](_0x399be7));if(_0x399be7[_0x4f49('0x22')]){if(_0x399be7[_0x4f49('0x22')]['code']===0x1f4){logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);return _0x2ecaaa(_0x399be7[_0x4f49('0x22')]['message']);}logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')]['message']);return _0x2f0a0d(_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);}else{logger[_0x4f49('0x1f')](_0x4f49('0x23'),_0x415e83,_0x4f49('0x20'));_0x2f0a0d(_0x399be7[_0x4f49('0x25')]['message']);}})['catch'](function(_0x3a947b){logger[_0x4f49('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0x415e83,_0x3a947b);_0x2ecaaa(_0x3a947b);});});}function respondWithStatusCode(_0x408552,_0x2c1519){_0x2c1519=_0x2c1519||0xcc;return function(_0x35f8e0){if(_0x35f8e0){return _0x408552['sendStatus'](_0x2c1519);}return _0x408552[_0x4f49('0x26')](_0x2c1519)[_0x4f49('0x27')]();};}function respondWithResult(_0x298785,_0x148153){_0x148153=_0x148153||0xc8;return function(_0xfefbab){if(_0xfefbab){return _0x298785[_0x4f49('0x26')](_0x148153)['json'](_0xfefbab);}};}function respondWithFilteredResult(_0x50c571,_0x239f44){return function(_0x2c00ee){if(_0x2c00ee){var _0x605c91=_0x2c00ee[_0x4f49('0x28')],_0x560050=_0x239f44['offset'],_0x3cbfbd=_0x239f44['offset']+_0x239f44[_0x4f49('0x29')],_0x206203;if(_0x3cbfbd>=_0x605c91){_0x3cbfbd=_0x605c91;_0x206203=0xc8;}else{_0x206203=0xce;}_0x50c571[_0x4f49('0x26')](_0x206203);return _0x50c571[_0x4f49('0x2a')]('Content-Range',_0x560050+'-'+_0x3cbfbd+'/'+_0x605c91)[_0x4f49('0x2b')](_0x2c00ee);}return null;};}function patchUpdates(_0x35aa33){return function(_0x173657){try{jsonpatch[_0x4f49('0x2c')](_0x173657,_0x35aa33,!![]);}catch(_0x3e103b){return BPromise[_0x4f49('0x2d')](_0x3e103b);}return _0x173657[_0x4f49('0x2e')]();};}function saveUpdates(_0x45ae19,_0x1f38d3){return function(_0x310ee2){if(_0x310ee2){return _0x310ee2[_0x4f49('0x2f')](_0x45ae19)[_0x4f49('0x1e')](function(_0x29ff83){return _0x29ff83;});}return null;};}function removeEntity(_0x6625cd,_0x135d17){return function(_0x97ef98){if(_0x97ef98){return _0x97ef98[_0x4f49('0x30')]()[_0x4f49('0x1e')](function(){_0x6625cd[_0x4f49('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d0d2,_0x46b7ba){return function(_0x24f568){if(!_0x24f568){_0x45d0d2[_0x4f49('0x31')](0x194);}return _0x24f568;};}function handleError(_0x1c3af8,_0x15e82b){_0x15e82b=_0x15e82b||0x1f4;return function(_0x2cbe4e){logger[_0x4f49('0x22')](_0x2cbe4e[_0x4f49('0x32')]);if(_0x2cbe4e[_0x4f49('0x33')]){delete _0x2cbe4e[_0x4f49('0x33')];}_0x1c3af8[_0x4f49('0x26')](_0x15e82b)[_0x4f49('0x34')](_0x2cbe4e);};}exports['index']=function(_0x371282,_0x27b7a9){var _0x36000a={},_0x26014f={},_0x1c1e9b={'count':0x0,'rows':[]};var _0x3ee818=_[_0x4f49('0x35')](db[_0x4f49('0x36')][_0x4f49('0x37')],function(_0xf8c377){return{'name':_0xf8c377[_0x4f49('0x38')],'type':_0xf8c377[_0x4f49('0x39')][_0x4f49('0x3a')]};});_0x26014f[_0x4f49('0x3b')]=_['map'](_0x3ee818,_0x4f49('0x33'));_0x26014f[_0x4f49('0x3c')]=_['keys'](_0x371282[_0x4f49('0x3c')]);_0x26014f[_0x4f49('0x3d')]=_['intersection'](_0x26014f[_0x4f49('0x3b')],_0x26014f[_0x4f49('0x3c')]);_0x36000a[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x26014f[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x371282[_0x4f49('0x3c')]['fields']));_0x36000a['attributes']=_0x36000a['attributes'][_0x4f49('0x41')]?_0x36000a[_0x4f49('0x3e')]:_0x26014f[_0x4f49('0x3b')];if(!_0x371282[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x36000a[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x371282[_0x4f49('0x3c')]['limit']);_0x36000a['offset']=qs[_0x4f49('0x44')](_0x371282[_0x4f49('0x3c')][_0x4f49('0x44')]);}_0x36000a['order']=qs[_0x4f49('0x45')](_0x371282['query']['sort']);_0x36000a[_0x4f49('0x46')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x47')](_0x371282['query'],_0x26014f[_0x4f49('0x3d')]),_0x3ee818);if(_0x371282[_0x4f49('0x3c')]['filter']){_0x36000a[_0x4f49('0x46')]=_['merge'](_0x36000a[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x3ee818,function(_0x133f39){if(_0x133f39['type']!==_0x4f49('0x48')){var _0x1e5f0b={};_0x1e5f0b[_0x133f39[_0x4f49('0x33')]]={'$like':'%'+_0x371282[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x1e5f0b;}})});}_0x36000a=_[_0x4f49('0x4a')]({},_0x36000a,_0x371282[_0x4f49('0x4b')]);var _0x356785={'where':_0x36000a[_0x4f49('0x46')]};return db[_0x4f49('0x36')]['count'](_0x356785)[_0x4f49('0x1e')](function(_0x44bf1d){_0x1c1e9b['count']=_0x44bf1d;if(_0x371282[_0x4f49('0x3c')]['includeAll']){_0x36000a[_0x4f49('0x4c')]=[{'all':!![]}];}return db[_0x4f49('0x36')][_0x4f49('0x4d')](_0x36000a);})[_0x4f49('0x1e')](function(_0x4a91ec){_0x1c1e9b[_0x4f49('0x4e')]=_0x4a91ec;return _0x1c1e9b;})[_0x4f49('0x1e')](respondWithFilteredResult(_0x27b7a9,_0x36000a))[_0x4f49('0x4f')](handleError(_0x27b7a9,null));};exports[_0x4f49('0x50')]=function(_0x3ec266,_0x72ea05){var _0x37fdb7={'raw':![],'where':{'id':_0x3ec266[_0x4f49('0x51')]['id']}},_0xd282c={};_0xd282c[_0x4f49('0x3b')]=_[_0x4f49('0x52')](db[_0x4f49('0x36')][_0x4f49('0x37')]);_0xd282c[_0x4f49('0x3c')]=_[_0x4f49('0x52')](_0x3ec266[_0x4f49('0x3c')]);_0xd282c['filters']=_['intersection'](_0xd282c[_0x4f49('0x3b')],_0xd282c[_0x4f49('0x3c')]);_0x37fdb7[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0xd282c[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x3ec266[_0x4f49('0x3c')]['fields']));_0x37fdb7[_0x4f49('0x3e')]=_0x37fdb7['attributes'][_0x4f49('0x41')]?_0x37fdb7[_0x4f49('0x3e')]:_0xd282c[_0x4f49('0x3b')];if(_0x3ec266[_0x4f49('0x3c')]['includeAll']){_0x37fdb7[_0x4f49('0x4c')]=[{'all':!![]}];}_0x37fdb7=_['merge']({},_0x37fdb7,_0x3ec266['options']);return db[_0x4f49('0x36')][_0x4f49('0x53')](_0x37fdb7)[_0x4f49('0x1e')](handleEntityNotFound(_0x72ea05,null))[_0x4f49('0x1e')](respondWithResult(_0x72ea05,null))['catch'](handleError(_0x72ea05,null));};exports['create']=function(_0xd7f47b,_0x291a45){return db['FreshdeskAccount'][_0x4f49('0x54')](_0xd7f47b['body'],{})['then'](respondWithResult(_0x291a45,0xc9))[_0x4f49('0x4f')](handleError(_0x291a45,null));};exports['update']=function(_0xfa7dd6,_0x492aaa){if(_0xfa7dd6[_0x4f49('0x55')]['id']){delete _0xfa7dd6[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0xfa7dd6[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x492aaa,null))[_0x4f49('0x1e')](saveUpdates(_0xfa7dd6[_0x4f49('0x55')],null))['then'](respondWithResult(_0x492aaa,null))[_0x4f49('0x4f')](handleError(_0x492aaa,null));};exports['destroy']=function(_0x213608,_0x1f640d){return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0x213608[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1f640d,null))['then'](removeEntity(_0x1f640d,null))[_0x4f49('0x4f')](handleError(_0x1f640d,null));};exports[_0x4f49('0x56')]=function(_0x5e3568,_0x5d2b3c,_0x121c04){var _0x447dde={};var _0x2e0df5={};var _0x2409f1;var _0x19a788;return db['FreshdeskAccount'][_0x4f49('0x57')]({'where':{'id':_0x5e3568['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x5d2b3c,null))[_0x4f49('0x1e')](function(_0x2a2b0d){if(_0x2a2b0d){_0x2409f1=_0x2a2b0d;_0x2e0df5['model']=_[_0x4f49('0x52')](db[_0x4f49('0x58')][_0x4f49('0x37')]);_0x2e0df5[_0x4f49('0x3c')]=_['keys'](_0x5e3568[_0x4f49('0x3c')]);_0x2e0df5[_0x4f49('0x3d')]=_['intersection'](_0x2e0df5[_0x4f49('0x3b')],_0x2e0df5[_0x4f49('0x3c')]);_0x447dde[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x2e0df5[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x40')]));_0x447dde['attributes']=_0x447dde[_0x4f49('0x3e')][_0x4f49('0x41')]?_0x447dde[_0x4f49('0x3e')]:_0x2e0df5[_0x4f49('0x3b')];_0x447dde[_0x4f49('0x59')]=qs[_0x4f49('0x45')](_0x5e3568[_0x4f49('0x3c')]['sort']);_0x447dde[_0x4f49('0x46')]=qs['filters'](_[_0x4f49('0x47')](_0x5e3568[_0x4f49('0x3c')],_0x2e0df5[_0x4f49('0x3d')]));if(_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]){_0x447dde[_0x4f49('0x46')]=_[_0x4f49('0x4a')](_0x447dde[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x447dde[_0x4f49('0x3e')],function(_0x545552){var _0x2f9f2e={};_0x2f9f2e[_0x545552]={'$like':'%'+_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x2f9f2e;})});}_0x447dde=_[_0x4f49('0x4a')]({},_0x447dde,_0x5e3568['options']);return _0x2409f1['getConfigurations'](_0x447dde);}})[_0x4f49('0x1e')](function(_0x5e4879){if(_0x5e4879){_0x19a788=_0x5e4879[_0x4f49('0x41')];if(!_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x447dde[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x29')]);_0x447dde[_0x4f49('0x44')]=qs[_0x4f49('0x44')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x44')]);}return _0x2409f1[_0x4f49('0x56')](_0x447dde);}})[_0x4f49('0x1e')](function(_0x234984){if(_0x234984){return _0x234984?{'count':_0x19a788,'rows':_0x234984}:null;}})[_0x4f49('0x1e')](respondWithResult(_0x5d2b3c,null))[_0x4f49('0x4f')](handleError(_0x5d2b3c,null));};exports[_0x4f49('0x5a')]=function(_0x1f9161,_0x1434ea,_0x2c3962){if(_0x1f9161[_0x4f49('0x55')]['id']){delete _0x1f9161[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x1f9161['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1434ea,null))['then'](function(_0x31df7f){if(_0x31df7f){_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5b')]=_0x31df7f['id'];_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5c')]=integrations[_0x4f49('0x5d')](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')]['type']);_0x1f9161['body'][_0x4f49('0x5f')]=integrations['getDescriptions'](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')][_0x4f49('0x39')]);return db[_0x4f49('0x58')]['create'](_0x1f9161['body'],{'include':[{'model':db[_0x4f49('0x60')],'as':_0x4f49('0x5c')},{'model':db['FreshdeskField'],'as':_0x4f49('0x5f')}]});}return null;})[_0x4f49('0x1e')](respondWithResult(_0x1434ea,null))['catch'](handleError(_0x1434ea,null));};exports[_0x4f49('0x61')]=function(_0x5b88aa,_0x121972,_0x160cf8){var _0x544356='';return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x5b88aa[_0x4f49('0x51')]['id']},'attributes':['id',_0x4f49('0x62'),_0x4f49('0x63')]})[_0x4f49('0x1e')](handleEntityNotFound(_0x121972,null))['then'](function(_0x25ed14){if(_0x25ed14){_0x544356=_0x25ed14['remoteUri'];var _0x3ecc94=_0x544356['slice'](-0x1);if(_0x3ecc94==='/'){_0x544356=_0x544356[_0x4f49('0x64')](0x0,_0x544356['lastIndexOf'](_0x3ecc94));}return rp({'method':_0x4f49('0x65'),'uri':util[_0x4f49('0x66')](_0x4f49('0x67'),_0x544356,_0x4f49('0x68')),'headers':{'Authorization':util['format'](_0x4f49('0x69'),new Buffer(util['format'](_0x4f49('0x6a'),_0x25ed14['apiKey']))[_0x4f49('0x6b')]('base64'))},'json':!![]});}})['then'](function(_0x329a49){if(_0x329a49){var _0x20b2be=[_0x4f49('0x6c'),'subject',_0x4f49('0x6d'),_0x4f49('0x6e'),'status','priority','group',_0x4f49('0x6f'),_0x4f49('0x70'),_0x4f49('0x71'),_0x4f49('0x72')];_[_0x4f49('0x73')](_0x329a49,function(_0x517144){return _0x20b2be[_0x4f49('0x74')](_0x517144[_0x4f49('0x33')])||!_0x517144[_0x4f49('0x75')]&&_0x517144['type']!==_0x4f49('0x76')&&_0x517144[_0x4f49('0x39')]!==_0x4f49('0x77');});return{'count':_0x329a49[_0x4f49('0x41')],'rows':_['map'](_0x329a49,function(_0x249799){return{'id':_0x249799[_0x4f49('0x33')],'name':_0x249799[_0x4f49('0x78')],'custom':!_0x249799[_0x4f49('0x75')],'options':_0x249799[_0x4f49('0x79')]?_['map'](_0x249799[_0x4f49('0x79')],function(_0x32539c){return{'name':_['capitalize'](_0x32539c),'value':_0x32539c};}):[]};})};}})[_0x4f49('0x1e')](respondWithResult(_0x121972,null))['catch'](function(_0x351a33){var _0x4d72a0=_0x5b88aa[_0x4f49('0x3c')][_0x4f49('0x1b')]?0x1f4:_0x351a33[_0x4f49('0x7a')]||0x1f4;logger[_0x4f49('0x22')](_0x4f49('0x7b'),'getFields',_0x4d72a0,JSON[_0x4f49('0x21')](_0x351a33));delete _0x351a33[_0x4f49('0x33')];if(_0x4d72a0===0x191){_0x4d72a0=0x190;}_0x121972[_0x4f49('0x26')](_0x4d72a0)[_0x4f49('0x34')](_0x5b88aa['query'][_0x4f49('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x351a33[_0x4f49('0x7a')]}:_0x351a33);});}; \ No newline at end of file +var _0xe14b=['apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','priority','group','ticket_type','company','includes','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','show','params','include','find','create','body','update','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri'];(function(_0x14f051,_0x85870b){var _0x3f59ee=function(_0xc8785a){while(--_0xc8785a){_0x14f051['push'](_0x14f051['shift']());}};_0x3f59ee(++_0x85870b);}(_0xe14b,0x93));var _0xbe14=function(_0x1c3e65,_0x326a33){_0x1c3e65=_0x1c3e65-0x0;var _0x3d988c=_0xe14b[_0x1c3e65];return _0x3d988c;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];var integrations=require(_0xbe14('0x15'));var jayson=require(_0xbe14('0x16'));var client=jayson[_0xbe14('0x17')][_0xbe14('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2850cb,_0x16893f,_0xa2cf72){if(_0xa2cf72){var _0x1e4826=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4826[_0xbe14('0x19')](_0x16893f)){return _0x2850cb;}else{throw new db[(_0xbe14('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2850cb;}}function respondWithRpcPromise(_0x3f58f5,_0x3dc4a9,_0xf4ac9,_0x37ce4e){return new BPromise(function(_0x4e8f34,_0x21c789){var _0xe9c3ec=_0x37ce4e||client;return _0xe9c3ec[_0xbe14('0x1b')](_0x3f58f5,_0xf4ac9)[_0xbe14('0x1c')](function(_0x38f1ea){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,_0xbe14('0x21'),JSON[_0xbe14('0x22')](_0x38f1ea));if(_0x38f1ea[_0xbe14('0x23')]){if(_0x38f1ea[_0xbe14('0x23')]['code']===0x1f4){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')][_0xbe14('0x24')]);return _0x21c789(_0x38f1ea[_0xbe14('0x23')]['message']);}logger[_0xbe14('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')]['message']);return _0x4e8f34(_0x38f1ea[_0xbe14('0x23')]['message']);}else{logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');_0x4e8f34(_0x38f1ea[_0xbe14('0x25')]['message']);}})[_0xbe14('0x26')](function(_0x4851f8){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x4851f8);_0x21c789(_0x4851f8);});});}function respondWithStatusCode(_0x1ee9c1,_0x39cc81){_0x39cc81=_0x39cc81||0xcc;return function(_0x15ef02){if(_0x15ef02){return _0x1ee9c1[_0xbe14('0x27')](_0x39cc81);}return _0x1ee9c1['status'](_0x39cc81)[_0xbe14('0x28')]();};}function respondWithResult(_0x1ba46a,_0x391556){_0x391556=_0x391556||0xc8;return function(_0x169369){if(_0x169369){return _0x1ba46a['status'](_0x391556)[_0xbe14('0x29')](_0x169369);}};}function respondWithFilteredResult(_0x29fc64,_0x59bf34){return function(_0x3c3613){if(_0x3c3613){var _0x3b3e84=_0x3c3613[_0xbe14('0x2a')],_0x1c7cc7=_0x59bf34[_0xbe14('0x2b')],_0x19252f=_0x59bf34[_0xbe14('0x2b')]+_0x59bf34[_0xbe14('0x2c')],_0x34d648;if(_0x19252f>=_0x3b3e84){_0x19252f=_0x3b3e84;_0x34d648=0xc8;}else{_0x34d648=0xce;}_0x29fc64[_0xbe14('0x2d')](_0x34d648);return _0x29fc64[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x1c7cc7+'-'+_0x19252f+'/'+_0x3b3e84)[_0xbe14('0x29')](_0x3c3613);}return null;};}function patchUpdates(_0x10ae36){return function(_0x223f7a){try{jsonpatch[_0xbe14('0x30')](_0x223f7a,_0x10ae36,!![]);}catch(_0x6ba36c){return BPromise[_0xbe14('0x31')](_0x6ba36c);}return _0x223f7a[_0xbe14('0x32')]();};}function saveUpdates(_0x14e7c4,_0x581e86){return function(_0x2e33e1){if(_0x2e33e1){return _0x2e33e1['update'](_0x14e7c4)['then'](function(_0x46c2d1){return _0x46c2d1;});}return null;};}function removeEntity(_0x4c1e7e,_0x243524){return function(_0x345b0){if(_0x345b0){return _0x345b0['destroy']()['then'](function(){_0x4c1e7e['status'](0xcc)[_0xbe14('0x28')]();});}};}function handleEntityNotFound(_0xa3d24,_0x5f27b6){return function(_0x46c570){if(!_0x46c570){_0xa3d24[_0xbe14('0x27')](0x194);}return _0x46c570;};}function handleError(_0x452635,_0x1aa849){_0x1aa849=_0x1aa849||0x1f4;return function(_0x29c23e){logger['error'](_0x29c23e['stack']);if(_0x29c23e[_0xbe14('0x33')]){delete _0x29c23e['name'];}_0x452635['status'](_0x1aa849)['send'](_0x29c23e);};}exports[_0xbe14('0x34')]=function(_0x393f6b,_0x2bb45){var _0x3dbacb={},_0x172e79={},_0x29356f={'count':0x0,'rows':[]};var _0xcdc50=_[_0xbe14('0x35')](db[_0xbe14('0x36')][_0xbe14('0x37')],function(_0x41652d){return{'name':_0x41652d[_0xbe14('0x38')],'type':_0x41652d['type']['key']};});_0x172e79[_0xbe14('0x39')]=_[_0xbe14('0x35')](_0xcdc50,_0xbe14('0x33'));_0x172e79['query']=_[_0xbe14('0x3a')](_0x393f6b[_0xbe14('0x3b')]);_0x172e79[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],_0x172e79[_0xbe14('0x3b')]);_0x3dbacb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],qs['fields'](_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x3dbacb[_0xbe14('0x3e')]=_0x3dbacb[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x3dbacb[_0xbe14('0x3e')]:_0x172e79['model'];if(!_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x3dbacb[_0xbe14('0x2c')]=qs['limit'](_0x393f6b['query'][_0xbe14('0x2c')]);_0x3dbacb[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x393f6b['query']['offset']);}_0x3dbacb[_0xbe14('0x43')]=qs['sort'](_0x393f6b['query'][_0xbe14('0x44')]);_0x3dbacb[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x393f6b['query'],_0x172e79['filters']),_0xcdc50);if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x3dbacb[_0xbe14('0x45')]=_['merge'](_0x3dbacb[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0xcdc50,function(_0x32f22e){if(_0x32f22e[_0xbe14('0x47')]!=='VIRTUAL'){var _0x4a1a4b={};_0x4a1a4b[_0x32f22e[_0xbe14('0x33')]]={'$like':'%'+_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0x4a1a4b;}})});}_0x3dbacb=_[_0xbe14('0x48')]({},_0x3dbacb,_0x393f6b[_0xbe14('0x49')]);var _0x4f2d95={'where':_0x3dbacb['where']};return db[_0xbe14('0x36')][_0xbe14('0x2a')](_0x4f2d95)[_0xbe14('0x1c')](function(_0x2a3b35){_0x29356f['count']=_0x2a3b35;if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x4a')]){_0x3dbacb['include']=[{'all':!![]}];}return db[_0xbe14('0x36')][_0xbe14('0x4b')](_0x3dbacb);})[_0xbe14('0x1c')](function(_0x36c20c){_0x29356f['rows']=_0x36c20c;return _0x29356f;})['then'](respondWithFilteredResult(_0x2bb45,_0x3dbacb))[_0xbe14('0x26')](handleError(_0x2bb45,null));};exports[_0xbe14('0x4c')]=function(_0x4a1a37,_0x5acf90){var _0xca8cdb={'raw':![],'where':{'id':_0x4a1a37[_0xbe14('0x4d')]['id']}},_0x5d3726={};_0x5d3726[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x36')][_0xbe14('0x37')]);_0x5d3726['query']=_[_0xbe14('0x3a')](_0x4a1a37[_0xbe14('0x3b')]);_0x5d3726[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],_0x5d3726['query']);_0xca8cdb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x4a1a37[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0xca8cdb['attributes']=_0xca8cdb['attributes'][_0xbe14('0x40')]?_0xca8cdb[_0xbe14('0x3e')]:_0x5d3726[_0xbe14('0x39')];if(_0x4a1a37['query']['includeAll']){_0xca8cdb[_0xbe14('0x4e')]=[{'all':!![]}];}_0xca8cdb=_[_0xbe14('0x48')]({},_0xca8cdb,_0x4a1a37['options']);return db[_0xbe14('0x36')][_0xbe14('0x4f')](_0xca8cdb)['then'](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x1c')](respondWithResult(_0x5acf90,null))['catch'](handleError(_0x5acf90,null));};exports[_0xbe14('0x50')]=function(_0x410c59,_0x12a9de){return db['FreshdeskAccount'][_0xbe14('0x50')](_0x410c59[_0xbe14('0x51')],{})['then'](respondWithResult(_0x12a9de,0xc9))[_0xbe14('0x26')](handleError(_0x12a9de,null));};exports[_0xbe14('0x52')]=function(_0x2210cc,_0x20c48d){if(_0x2210cc[_0xbe14('0x51')]['id']){delete _0x2210cc['body']['id'];}return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x2210cc[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x20c48d,null))[_0xbe14('0x1c')](saveUpdates(_0x2210cc[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x20c48d,null))['catch'](handleError(_0x20c48d,null));};exports[_0xbe14('0x53')]=function(_0x1b47a4,_0x941ee2){return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x1b47a4[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x941ee2,null))[_0xbe14('0x1c')](removeEntity(_0x941ee2,null))[_0xbe14('0x26')](handleError(_0x941ee2,null));};exports[_0xbe14('0x54')]=function(_0x358950,_0x4bccfc,_0x56bcd3){var _0x58dd79={};var _0x10c0bc={};var _0x1bfcbf;var _0x2f4e52;return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x358950[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1c')](function(_0x31d015){if(_0x31d015){_0x1bfcbf=_0x31d015;_0x10c0bc[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x56')][_0xbe14('0x37')]);_0x10c0bc[_0xbe14('0x3b')]=_[_0xbe14('0x3a')](_0x358950[_0xbe14('0x3b')]);_0x10c0bc[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],_0x10c0bc[_0xbe14('0x3b')]);_0x58dd79['attributes']=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x58dd79[_0xbe14('0x3e')]=_0x58dd79[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x58dd79[_0xbe14('0x3e')]:_0x10c0bc[_0xbe14('0x39')];_0x58dd79['order']=qs[_0xbe14('0x44')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x44')]);_0x58dd79[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x358950[_0xbe14('0x3b')],_0x10c0bc[_0xbe14('0x3c')]));if(_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x58dd79[_0xbe14('0x45')]=_['merge'](_0x58dd79[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0x58dd79[_0xbe14('0x3e')],function(_0x29bb26){var _0xaebce8={};_0xaebce8[_0x29bb26]={'$like':'%'+_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0xaebce8;})});}_0x58dd79=_[_0xbe14('0x48')]({},_0x58dd79,_0x358950['options']);return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x2fdf5d){if(_0x2fdf5d){_0x2f4e52=_0x2fdf5d[_0xbe14('0x40')];if(!_0x358950[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x58dd79['limit']=qs['limit'](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2c')]);_0x58dd79[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2b')]);}return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x50e644){if(_0x50e644){return _0x50e644?{'count':_0x2f4e52,'rows':_0x50e644}:null;}})['then'](respondWithResult(_0x4bccfc,null))[_0xbe14('0x26')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x57')]=function(_0x29aa52,_0x57729f,_0x76e91e){if(_0x29aa52[_0xbe14('0x51')]['id']){delete _0x29aa52[_0xbe14('0x51')]['id'];}return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x29aa52[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x57729f,null))['then'](function(_0x43b817){if(_0x43b817){_0x29aa52[_0xbe14('0x51')][_0xbe14('0x58')]=_0x43b817['id'];_0x29aa52[_0xbe14('0x51')][_0xbe14('0x59')]=integrations[_0xbe14('0x5a')](_0x29aa52[_0xbe14('0x51')]['channel'],_0x29aa52[_0xbe14('0x51')][_0xbe14('0x47')]);_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5b')]=integrations[_0xbe14('0x5c')](_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5d')],_0x29aa52[_0xbe14('0x51')]['type']);return db[_0xbe14('0x56')][_0xbe14('0x50')](_0x29aa52[_0xbe14('0x51')],{'include':[{'model':db[_0xbe14('0x5e')],'as':_0xbe14('0x59')},{'model':db[_0xbe14('0x5e')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1c')](respondWithResult(_0x57729f,null))[_0xbe14('0x26')](handleError(_0x57729f,null));};exports[_0xbe14('0x5f')]=function(_0x1b23a1,_0x508455,_0x7e9e5c){var _0x1578b6='';return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x1b23a1[_0xbe14('0x4d')]['id']},'attributes':['id',_0xbe14('0x60'),_0xbe14('0x61')]})['then'](handleEntityNotFound(_0x508455,null))[_0xbe14('0x1c')](function(_0x589197){if(_0x589197){_0x1578b6=_0x589197[_0xbe14('0x60')];var _0x5d85d3=_0x1578b6[_0xbe14('0x62')](-0x1);if(_0x5d85d3==='/'){_0x1578b6=_0x1578b6[_0xbe14('0x63')](0x0,_0x1578b6[_0xbe14('0x64')](_0x5d85d3));}return rp({'method':'GET','uri':util[_0xbe14('0x65')](_0xbe14('0x66'),_0x1578b6,_0xbe14('0x67')),'headers':{'Authorization':util['format'](_0xbe14('0x68'),new Buffer(util[_0xbe14('0x65')](_0xbe14('0x69'),_0x589197[_0xbe14('0x61')]))['toString'](_0xbe14('0x6a')))},'json':!![]});}})[_0xbe14('0x1c')](function(_0x34f90b){if(_0x34f90b){var _0x2b2e0e=[_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'description',_0xbe14('0x2d'),_0xbe14('0x6e'),_0xbe14('0x6f'),'source',_0xbe14('0x70'),_0xbe14('0x6f'),_0xbe14('0x71')];_['remove'](_0x34f90b,function(_0xa53262){return _0x2b2e0e[_0xbe14('0x72')](_0xa53262['name'])||!_0xa53262[_0xbe14('0x73')]&&_0xa53262['type']!==_0xbe14('0x74')&&_0xa53262[_0xbe14('0x47')]!=='custom_dropdown';});return{'count':_0x34f90b['length'],'rows':_[_0xbe14('0x35')](_0x34f90b,function(_0x3db955){return{'id':_0x3db955[_0xbe14('0x33')],'name':_0x3db955['label'],'custom':!_0x3db955[_0xbe14('0x73')],'options':_0x3db955[_0xbe14('0x75')]?_[_0xbe14('0x35')](_0x3db955[_0xbe14('0x75')],function(_0x5ee624){return{'name':_['capitalize'](_0x5ee624),'value':_0x5ee624};}):[]};})};}})[_0xbe14('0x1c')](respondWithResult(_0x508455,null))[_0xbe14('0x26')](function(_0xc8d0f6){var _0x215d5b=_0x1b23a1[_0xbe14('0x3b')][_0xbe14('0x19')]?0x1f4:_0xc8d0f6[_0xbe14('0x76')]||0x1f4;logger['error'](_0xbe14('0x77'),'getFields',_0x215d5b,JSON[_0xbe14('0x22')](_0xc8d0f6));delete _0xc8d0f6[_0xbe14('0x33')];if(_0x215d5b===0x191){_0x215d5b=0x190;}_0x508455[_0xbe14('0x2d')](_0x215d5b)[_0xbe14('0x78')](_0x1b23a1['query'][_0xbe14('0x19')]?{'message':_0xbe14('0x79'),'statusCode':_0xc8d0f6[_0xbe14('0x76')]}:_0xc8d0f6);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e61f361..b5a99c9 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 _0x9d60=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x46c035,_0x259c5c){var _0xedfa0a=function(_0x17814b){while(--_0x17814b){_0x46c035['push'](_0x46c035['shift']());}};_0xedfa0a(++_0x259c5c);}(_0x9d60,0x11b));var _0x09d6=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x9d60[_0x284a61];return _0x220e3c;};'use strict';var _=require(_0x09d6('0x0'));var util=require(_0x09d6('0x1'));var logger=require(_0x09d6('0x2'))(_0x09d6('0x3'));var moment=require('moment');var BPromise=require(_0x09d6('0x4'));var rp=require(_0x09d6('0x5'));var fs=require('fs');var path=require(_0x09d6('0x6'));var rimraf=require(_0x09d6('0x7'));var config=require(_0x09d6('0x8'));var attributes=require(_0x09d6('0x9'));var integrations=require(_0x09d6('0xa'));module[_0x09d6('0xb')]=function(_0x13d4b4,_0x54df3a){return _0x13d4b4[_0x09d6('0xc')](_0x09d6('0xd'),attributes,{'tableName':_0x09d6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4af=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x17a5c2,_0x3ad5a5){var _0x25fa0a=function(_0x2cc2b9){while(--_0x2cc2b9){_0x17a5c2['push'](_0x17a5c2['shift']());}};_0x25fa0a(++_0x3ad5a5);}(_0xf4af,0x13b));var _0xff4a=function(_0x353643,_0x568495){_0x353643=_0x353643-0x0;var _0x394b32=_0xf4af[_0x353643];return _0x394b32;};'use strict';var _=require('lodash');var util=require(_0xff4a('0x0'));var logger=require(_0xff4a('0x1'))('api');var moment=require(_0xff4a('0x2'));var BPromise=require(_0xff4a('0x3'));var rp=require(_0xff4a('0x4'));var fs=require('fs');var path=require(_0xff4a('0x5'));var rimraf=require(_0xff4a('0x6'));var config=require(_0xff4a('0x7'));var attributes=require(_0xff4a('0x8'));var integrations=require(_0xff4a('0x9'));module[_0xff4a('0xa')]=function(_0x310258,_0x28bb41){return _0x310258[_0xff4a('0xb')](_0xff4a('0xc'),attributes,{'tableName':_0xff4a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index ed2794c..5d6cd46 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 _0xd085=['FreshdeskAccount','findAll','options','limit','include','map','model','attributes','ShowFreshdeskAccount','raw','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFreshdeskAccount'];(function(_0x5c9fee,_0x1d9db8){var _0x280fa1=function(_0x5796f2){while(--_0x5796f2){_0x5c9fee['push'](_0x5c9fee['shift']());}};_0x280fa1(++_0x1d9db8);}(_0xd085,0xab));var _0x5d08=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0xd085[_0x3b594b];return _0x1ea5f8;};'use strict';var _=require(_0x5d08('0x0'));var util=require('util');var moment=require(_0x5d08('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d08('0x2'));var fs=require('fs');var Redis=require(_0x5d08('0x3'));var db=require(_0x5d08('0x4'))['db'];var utils=require(_0x5d08('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d08('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x537b93,_0x5f0478,_0x32b66c){return new BPromise(function(_0x22133c,_0x5692c9){return client[_0x5d08('0x7')](_0x537b93,_0x32b66c)[_0x5d08('0x8')](function(_0x43572d){logger[_0x5d08('0x9')](_0x5d08('0xa'),_0x5f0478,'request\x20sent');logger[_0x5d08('0xb')](_0x5d08('0xc'),_0x5f0478,'request\x20sent',JSON[_0x5d08('0xd')](_0x43572d));if(_0x43572d[_0x5d08('0xe')]){if(_0x43572d[_0x5d08('0xe')][_0x5d08('0xf')]===0x1f4){logger[_0x5d08('0xe')](_0x5d08('0xa'),_0x5f0478,_0x43572d[_0x5d08('0xe')][_0x5d08('0x10')]);return _0x5692c9(_0x43572d['error'][_0x5d08('0x10')]);}logger[_0x5d08('0xe')](_0x5d08('0xa'),_0x5f0478,_0x43572d[_0x5d08('0xe')][_0x5d08('0x10')]);return _0x22133c(_0x43572d[_0x5d08('0xe')][_0x5d08('0x10')]);}else{logger['info'](_0x5d08('0xa'),_0x5f0478,_0x5d08('0x11'));_0x22133c(_0x43572d[_0x5d08('0x12')][_0x5d08('0x10')]);}})[_0x5d08('0x13')](function(_0x1b08eb){logger[_0x5d08('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5f0478,_0x1b08eb);_0x5692c9(_0x1b08eb);});});}exports[_0x5d08('0x14')]=function(_0x29e032){var _0x4f1f64=this;return new Promise(function(_0x2640e6,_0x12676d){return db[_0x5d08('0x15')][_0x5d08('0x16')]({'raw':_0x29e032[_0x5d08('0x17')]?_0x29e032[_0x5d08('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x29e032['options']?_0x29e032[_0x5d08('0x17')]['where']||null:null,'attributes':_0x29e032[_0x5d08('0x17')]?_0x29e032[_0x5d08('0x17')]['attributes']||null:null,'limit':_0x29e032['options']?_0x29e032['options'][_0x5d08('0x18')]||null:null,'include':_0x29e032[_0x5d08('0x17')]?_0x29e032[_0x5d08('0x17')][_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0x29e032[_0x5d08('0x17')][_0x5d08('0x19')],function(_0x231cef){return{'model':db[_0x231cef[_0x5d08('0x1b')]],'as':_0x231cef['as'],'attributes':_0x231cef['attributes'],'include':_0x231cef[_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0x231cef[_0x5d08('0x19')],function(_0xcb8568){return{'model':db[_0xcb8568[_0x5d08('0x1b')]],'as':_0xcb8568['as'],'attributes':_0xcb8568['attributes'],'include':_0xcb8568[_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0xcb8568[_0x5d08('0x19')],function(_0x39ca62){return{'model':db[_0x39ca62['model']],'as':_0x39ca62['as'],'attributes':_0x39ca62[_0x5d08('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5d08('0x8')](function(_0x511c03){logger[_0x5d08('0x9')]('GetFreshdeskAccount',_0x29e032);logger['debug'](_0x5d08('0x14'),_0x29e032,JSON[_0x5d08('0xd')](_0x511c03));_0x2640e6(_0x511c03);})[_0x5d08('0x13')](function(_0x106abb){logger[_0x5d08('0xe')](_0x5d08('0x14'),_0x106abb['message'],_0x29e032);_0x12676d(_0x4f1f64[_0x5d08('0xe')](0x1f4,_0x106abb[_0x5d08('0x10')]));});});};exports[_0x5d08('0x1d')]=function(_0x1ff5b2){var _0x2fb5d1=this;return new Promise(function(_0x28e3f1,_0xe006b2){return db[_0x5d08('0x15')]['find']({'raw':_0x1ff5b2[_0x5d08('0x17')]?_0x1ff5b2[_0x5d08('0x17')][_0x5d08('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ff5b2[_0x5d08('0x17')]?_0x1ff5b2[_0x5d08('0x17')][_0x5d08('0x1f')]||null:null,'attributes':_0x1ff5b2['options']?_0x1ff5b2[_0x5d08('0x17')]['attributes']||null:null,'include':_0x1ff5b2['options']?_0x1ff5b2[_0x5d08('0x17')][_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0x1ff5b2[_0x5d08('0x17')]['include'],function(_0x406a6b){return{'model':db[_0x406a6b[_0x5d08('0x1b')]],'as':_0x406a6b['as'],'attributes':_0x406a6b[_0x5d08('0x1c')],'include':_0x406a6b[_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0x406a6b[_0x5d08('0x19')],function(_0x2d1228){return{'model':db[_0x2d1228[_0x5d08('0x1b')]],'as':_0x2d1228['as'],'attributes':_0x2d1228[_0x5d08('0x1c')],'include':_0x2d1228['include']?_['map'](_0x2d1228['include'],function(_0x48ed08){return{'model':db[_0x48ed08['model']],'as':_0x48ed08['as'],'attributes':_0x48ed08[_0x5d08('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27d90d){logger[_0x5d08('0x9')](_0x5d08('0x1d'),_0x1ff5b2);logger[_0x5d08('0xb')]('ShowFreshdeskAccount',_0x1ff5b2,JSON[_0x5d08('0xd')](_0x27d90d));_0x28e3f1(_0x27d90d);})[_0x5d08('0x13')](function(_0x5f3fba){logger['error'](_0x5d08('0x1d'),_0x5f3fba[_0x5d08('0x10')],_0x1ff5b2);_0xe006b2(_0x2fb5d1['error'](0x1f4,_0x5f3fba[_0x5d08('0x10')]));});});}; \ No newline at end of file +var _0xac68=['GetFreshdeskAccount','ShowFreshdeskAccount','find','raw','where','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','FreshdeskAccount','findAll','options','limit','map','include','model','attributes'];(function(_0x3e46d6,_0x4f5a19){var _0x12f066=function(_0x1aa0ca){while(--_0x1aa0ca){_0x3e46d6['push'](_0x3e46d6['shift']());}};_0x12f066(++_0x4f5a19);}(_0xac68,0xcc));var _0x8ac6=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xac68[_0x75f869];return _0x10af8b;};'use strict';var _=require(_0x8ac6('0x0'));var util=require('util');var moment=require(_0x8ac6('0x1'));var BPromise=require('bluebird');var rs=require(_0x8ac6('0x2'));var fs=require('fs');var Redis=require(_0x8ac6('0x3'));var db=require(_0x8ac6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ac6('0x5'));var config=require(_0x8ac6('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ac6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x441605,_0xd756f5,_0x25ef1c){return new BPromise(function(_0x13d4db,_0x42c093){return client[_0x8ac6('0x8')](_0x441605,_0x25ef1c)[_0x8ac6('0x9')](function(_0x133a4a){logger[_0x8ac6('0xa')](_0x8ac6('0xb'),_0xd756f5,_0x8ac6('0xc'));logger[_0x8ac6('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xd756f5,_0x8ac6('0xc'),JSON['stringify'](_0x133a4a));if(_0x133a4a['error']){if(_0x133a4a[_0x8ac6('0xe')][_0x8ac6('0xf')]===0x1f4){logger[_0x8ac6('0xe')](_0x8ac6('0xb'),_0xd756f5,_0x133a4a[_0x8ac6('0xe')]['message']);return _0x42c093(_0x133a4a[_0x8ac6('0xe')][_0x8ac6('0x10')]);}logger[_0x8ac6('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0xd756f5,_0x133a4a['error'][_0x8ac6('0x10')]);return _0x13d4db(_0x133a4a[_0x8ac6('0xe')][_0x8ac6('0x10')]);}else{logger[_0x8ac6('0xa')](_0x8ac6('0xb'),_0xd756f5,_0x8ac6('0xc'));_0x13d4db(_0x133a4a[_0x8ac6('0x11')][_0x8ac6('0x10')]);}})[_0x8ac6('0x12')](function(_0x45ff76){logger[_0x8ac6('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0xd756f5,_0x45ff76);_0x42c093(_0x45ff76);});});}exports['GetFreshdeskAccount']=function(_0x5c5b98){var _0x5d9e9e=this;return new Promise(function(_0x2282b9,_0x4ec8e3){return db[_0x8ac6('0x13')][_0x8ac6('0x14')]({'raw':_0x5c5b98[_0x8ac6('0x15')]?_0x5c5b98[_0x8ac6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5c5b98[_0x8ac6('0x15')]?_0x5c5b98['options']['where']||null:null,'attributes':_0x5c5b98[_0x8ac6('0x15')]?_0x5c5b98[_0x8ac6('0x15')]['attributes']||null:null,'limit':_0x5c5b98['options']?_0x5c5b98[_0x8ac6('0x15')][_0x8ac6('0x16')]||null:null,'include':_0x5c5b98[_0x8ac6('0x15')]?_0x5c5b98[_0x8ac6('0x15')]['include']?_[_0x8ac6('0x17')](_0x5c5b98[_0x8ac6('0x15')][_0x8ac6('0x18')],function(_0x19b8e2){return{'model':db[_0x19b8e2[_0x8ac6('0x19')]],'as':_0x19b8e2['as'],'attributes':_0x19b8e2['attributes'],'include':_0x19b8e2[_0x8ac6('0x18')]?_[_0x8ac6('0x17')](_0x19b8e2[_0x8ac6('0x18')],function(_0x2f5595){return{'model':db[_0x2f5595[_0x8ac6('0x19')]],'as':_0x2f5595['as'],'attributes':_0x2f5595[_0x8ac6('0x1a')],'include':_0x2f5595[_0x8ac6('0x18')]?_['map'](_0x2f5595[_0x8ac6('0x18')],function(_0x1f25e4){return{'model':db[_0x1f25e4[_0x8ac6('0x19')]],'as':_0x1f25e4['as'],'attributes':_0x1f25e4[_0x8ac6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f2541){logger[_0x8ac6('0xa')]('GetFreshdeskAccount',_0x5c5b98);logger[_0x8ac6('0xd')]('GetFreshdeskAccount',_0x5c5b98,JSON['stringify'](_0x4f2541));_0x2282b9(_0x4f2541);})[_0x8ac6('0x12')](function(_0x2f33ec){logger['error'](_0x8ac6('0x1b'),_0x2f33ec[_0x8ac6('0x10')],_0x5c5b98);_0x4ec8e3(_0x5d9e9e[_0x8ac6('0xe')](0x1f4,_0x2f33ec[_0x8ac6('0x10')]));});});};exports[_0x8ac6('0x1c')]=function(_0x1f9319){var _0x45eb9c=this;return new Promise(function(_0x1de448,_0x2397d9){return db[_0x8ac6('0x13')][_0x8ac6('0x1d')]({'raw':_0x1f9319[_0x8ac6('0x15')]?_0x1f9319[_0x8ac6('0x15')][_0x8ac6('0x1e')]===undefined?!![]:![]:!![],'where':_0x1f9319[_0x8ac6('0x15')]?_0x1f9319['options'][_0x8ac6('0x1f')]||null:null,'attributes':_0x1f9319['options']?_0x1f9319[_0x8ac6('0x15')][_0x8ac6('0x1a')]||null:null,'include':_0x1f9319[_0x8ac6('0x15')]?_0x1f9319[_0x8ac6('0x15')][_0x8ac6('0x18')]?_[_0x8ac6('0x17')](_0x1f9319[_0x8ac6('0x15')]['include'],function(_0x551784){return{'model':db[_0x551784['model']],'as':_0x551784['as'],'attributes':_0x551784['attributes'],'include':_0x551784[_0x8ac6('0x18')]?_[_0x8ac6('0x17')](_0x551784[_0x8ac6('0x18')],function(_0x4bd16d){return{'model':db[_0x4bd16d[_0x8ac6('0x19')]],'as':_0x4bd16d['as'],'attributes':_0x4bd16d[_0x8ac6('0x1a')],'include':_0x4bd16d[_0x8ac6('0x18')]?_[_0x8ac6('0x17')](_0x4bd16d[_0x8ac6('0x18')],function(_0xf2f890){return{'model':db[_0xf2f890[_0x8ac6('0x19')]],'as':_0xf2f890['as'],'attributes':_0xf2f890[_0x8ac6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ac6('0x9')](function(_0x45c600){logger[_0x8ac6('0xa')](_0x8ac6('0x1c'),_0x1f9319);logger[_0x8ac6('0xd')]('ShowFreshdeskAccount',_0x1f9319,JSON[_0x8ac6('0x20')](_0x45c600));_0x1de448(_0x45c600);})[_0x8ac6('0x12')](function(_0x34ae19){logger[_0x8ac6('0xe')](_0x8ac6('0x1c'),_0x34ae19[_0x8ac6('0x10')],_0x1f9319);_0x2397d9(_0x45eb9c['error'](0x1f4,_0x34ae19[_0x8ac6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index cbc58dd..a84ad89 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 _0xfa53=['/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','put','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','get','index','show'];(function(_0x275ea0,_0x2d0dd5){var _0x57b859=function(_0x5b31d5){while(--_0x5b31d5){_0x275ea0['push'](_0x275ea0['shift']());}};_0x57b859(++_0x2d0dd5);}(_0xfa53,0x16f));var _0x3fa5=function(_0x171e3a,_0x3f02c7){_0x171e3a=_0x171e3a-0x0;var _0x576990=_0xfa53[_0x171e3a];return _0x576990;};'use strict';var multer=require(_0x3fa5('0x0'));var util=require(_0x3fa5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3fa5('0x2'));var router=express['Router']();var auth=require(_0x3fa5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3fa5('0x4'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x3fa5('0x5')]('/',auth['isAuthenticated'](),controller[_0x3fa5('0x6')]);router[_0x3fa5('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x3fa5('0x7')]);router[_0x3fa5('0x5')](_0x3fa5('0x8'),auth['isAuthenticated'](),controller[_0x3fa5('0x9')]);router[_0x3fa5('0x5')](_0x3fa5('0xa'),auth[_0x3fa5('0xb')](),controller[_0x3fa5('0xc')]);router[_0x3fa5('0x5')](_0x3fa5('0xd'),auth[_0x3fa5('0xb')](),controller[_0x3fa5('0xe')]);router['get']('/:id/tags',auth[_0x3fa5('0xb')](),controller['getTags']);router[_0x3fa5('0xf')]('/',auth[_0x3fa5('0xb')](),controller[_0x3fa5('0x10')]);router[_0x3fa5('0xf')](_0x3fa5('0x11'),auth[_0x3fa5('0xb')](),controller[_0x3fa5('0x12')]);router[_0x3fa5('0x13')](_0x3fa5('0x14'),auth[_0x3fa5('0xb')](),controller[_0x3fa5('0x15')]);router[_0x3fa5('0x16')]('/:id',auth[_0x3fa5('0xb')](),controller[_0x3fa5('0x17')]);module[_0x3fa5('0x18')]=router; \ No newline at end of file +var _0xd216=['/:id/fields','getFields','/:id/tags','post','create','put','update','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd216,0xa9));var _0x6d21=function(_0x2e3796,_0x26a534){_0x2e3796=_0x2e3796-0x0;var _0x373be1=_0xd216[_0x2e3796];return _0x373be1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d21('0x0'));var timeout=require(_0x6d21('0x1'));var express=require(_0x6d21('0x2'));var router=express['Router']();var auth=require(_0x6d21('0x3'));var interaction=require(_0x6d21('0x4'));var config=require(_0x6d21('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x6d21('0x6')]('/',auth[_0x6d21('0x7')](),controller[_0x6d21('0x8')]);router['get'](_0x6d21('0x9'),auth[_0x6d21('0x7')](),controller[_0x6d21('0xa')]);router[_0x6d21('0x6')](_0x6d21('0xb'),auth[_0x6d21('0x7')](),controller[_0x6d21('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x6d21('0x7')](),controller['getDescriptions']);router[_0x6d21('0x6')](_0x6d21('0xd'),auth[_0x6d21('0x7')](),controller['getTags']);router[_0x6d21('0xe')]('/',auth[_0x6d21('0x7')](),controller[_0x6d21('0xf')]);router[_0x6d21('0xe')](_0x6d21('0xd'),auth['isAuthenticated'](),controller['setTags']);router[_0x6d21('0x10')](_0x6d21('0x9'),auth[_0x6d21('0x7')](),controller[_0x6d21('0x11')]);router['delete'](_0x6d21('0x9'),auth[_0x6d21('0x7')](),controller[_0x6d21('0x12')]);module[_0x6d21('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 2df46c2..6e1d5ee 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 _0x85bc=['STRING','sequelize','exports'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0x85bc,0xf4));var _0xc85b=function(_0x1cb511,_0x5f068a){_0x1cb511=_0x1cb511-0x0;var _0x374758=_0x85bc[_0x1cb511];return _0x374758;};'use strict';var Sequelize=require(_0xc85b('0x0'));module[_0xc85b('0x1')]={'name':{'type':Sequelize[_0xc85b('0x2')]},'description':{'type':Sequelize[_0xc85b('0x2')]}}; \ No newline at end of file +var _0x0fe5=['STRING','sequelize','exports'];(function(_0x15534e,_0x313eab){var _0x3327bf=function(_0x3204c9){while(--_0x3204c9){_0x15534e['push'](_0x15534e['shift']());}};_0x3327bf(++_0x313eab);}(_0x0fe5,0xd3));var _0x50fe=function(_0x376555,_0x1fbf37){_0x376555=_0x376555-0x0;var _0x13023a=_0x0fe5[_0x376555];return _0x13023a;};'use strict';var Sequelize=require(_0x50fe('0x0'));module[_0x50fe('0x1')]={'name':{'type':Sequelize[_0x50fe('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 4cb2def..2b62ee6 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 _0x03d2=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','count','includeAll','include','rows','show','params','find','create','body','destroy','getFields','FreshdeskField','getSubjects','findOne','rawAttributes','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','stack','name','send','index','map'];(function(_0x36b717,_0x46d71e){var _0x121337=function(_0x108b7b){while(--_0x108b7b){_0x36b717['push'](_0x36b717['shift']());}};_0x121337(++_0x46d71e);}(_0x03d2,0xe3));var _0x203d=function(_0x4dc17e,_0x2cdc03){_0x4dc17e=_0x4dc17e-0x0;var _0xf33afe=_0x03d2[_0x4dc17e];return _0xf33afe;};'use strict';var pdf=require(_0x203d('0x0'));var emlformat=require(_0x203d('0x1'));var rimraf=require(_0x203d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x203d('0x3'));var moment=require(_0x203d('0x4'));var BPromise=require(_0x203d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x203d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x203d('0x7'));var fs=require('fs');var _=require(_0x203d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x203d('0x9'));var toCsv=require('to-csv');var querystring=require(_0x203d('0xa'));var Papa=require(_0x203d('0xb'));var Redis=require('ioredis');var authService=require(_0x203d('0xc'));var qs=require(_0x203d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x203d('0xe'));var logger=require(_0x203d('0xf'))(_0x203d('0x10'));var utils=require('../../config/utils');var config=require(_0x203d('0x11'));var db=require(_0x203d('0x12'))['db'];var jayson=require(_0x203d('0x13'));var client=jayson[_0x203d('0x14')][_0x203d('0x15')]({'port':0x232a});function checkPasswordPattern(_0x1fbd04,_0x150fd6,_0x12a090){if(_0x12a090){var _0x275019=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x275019[_0x203d('0x16')](_0x150fd6)){return _0x1fbd04;}else{throw new db[(_0x203d('0x17'))][(_0x203d('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1fbd04;}}function respondWithRpcPromise(_0x399e4e,_0x5e7c7f,_0x4c3e54,_0x144ef5){return new BPromise(function(_0x1eabfb,_0x2e44da){var _0x5d7dbc=_0x144ef5||client;return _0x5d7dbc[_0x203d('0x19')](_0x399e4e,_0x4c3e54)[_0x203d('0x1a')](function(_0x33b4ba){logger[_0x203d('0x1b')](_0x203d('0x1c'),_0x5e7c7f,_0x203d('0x1d'));logger['debug'](_0x203d('0x1e'),_0x5e7c7f,_0x203d('0x1d'),JSON[_0x203d('0x1f')](_0x33b4ba));if(_0x33b4ba[_0x203d('0x20')]){if(_0x33b4ba[_0x203d('0x20')][_0x203d('0x21')]===0x1f4){logger[_0x203d('0x20')](_0x203d('0x1c'),_0x5e7c7f,_0x33b4ba[_0x203d('0x20')]['message']);return _0x2e44da(_0x33b4ba[_0x203d('0x20')][_0x203d('0x22')]);}logger[_0x203d('0x20')](_0x203d('0x1c'),_0x5e7c7f,_0x33b4ba['error'][_0x203d('0x22')]);return _0x1eabfb(_0x33b4ba[_0x203d('0x20')]['message']);}else{logger[_0x203d('0x1b')](_0x203d('0x1c'),_0x5e7c7f,_0x203d('0x1d'));_0x1eabfb(_0x33b4ba[_0x203d('0x23')]['message']);}})[_0x203d('0x24')](function(_0x32e8ab){logger[_0x203d('0x20')](_0x203d('0x1c'),_0x5e7c7f,_0x32e8ab);_0x2e44da(_0x32e8ab);});});}function respondWithStatusCode(_0x93387f,_0x5c2c98){_0x5c2c98=_0x5c2c98||0xcc;return function(_0x55a70e){if(_0x55a70e){return _0x93387f[_0x203d('0x25')](_0x5c2c98);}return _0x93387f[_0x203d('0x26')](_0x5c2c98)[_0x203d('0x27')]();};}function respondWithResult(_0x45c113,_0x1e8e03){_0x1e8e03=_0x1e8e03||0xc8;return function(_0x5270f5){if(_0x5270f5){return _0x45c113[_0x203d('0x26')](_0x1e8e03)[_0x203d('0x28')](_0x5270f5);}};}function respondWithFilteredResult(_0x250d75,_0x41c4b9){return function(_0x13dce3){if(_0x13dce3){var _0x1efddb=_0x13dce3['count'],_0x30181e=_0x41c4b9[_0x203d('0x29')],_0x22f7ea=_0x41c4b9['offset']+_0x41c4b9[_0x203d('0x2a')],_0x39c731;if(_0x22f7ea>=_0x1efddb){_0x22f7ea=_0x1efddb;_0x39c731=0xc8;}else{_0x39c731=0xce;}_0x250d75[_0x203d('0x26')](_0x39c731);return _0x250d75[_0x203d('0x2b')](_0x203d('0x2c'),_0x30181e+'-'+_0x22f7ea+'/'+_0x1efddb)[_0x203d('0x28')](_0x13dce3);}return null;};}function patchUpdates(_0x594bbe){return function(_0x44e7c0){try{jsonpatch['apply'](_0x44e7c0,_0x594bbe,!![]);}catch(_0x51891f){return BPromise['reject'](_0x51891f);}return _0x44e7c0[_0x203d('0x2d')]();};}function saveUpdates(_0x52590e,_0x3c8b06){return function(_0x39d1da){if(_0x39d1da){return _0x39d1da[_0x203d('0x2e')](_0x52590e)['then'](function(_0x12ff03){return _0x12ff03;});}return null;};}function removeEntity(_0x9cfdc8,_0x259947){return function(_0x18201f){if(_0x18201f){return _0x18201f['destroy']()[_0x203d('0x1a')](function(){_0x9cfdc8['status'](0xcc)[_0x203d('0x27')]();});}};}function handleEntityNotFound(_0x3ff44f,_0x300d40){return function(_0x4e667c){if(!_0x4e667c){_0x3ff44f['sendStatus'](0x194);}return _0x4e667c;};}function handleError(_0x4747a6,_0x1d5af0){_0x1d5af0=_0x1d5af0||0x1f4;return function(_0x5e2d23){logger[_0x203d('0x20')](_0x5e2d23[_0x203d('0x2f')]);if(_0x5e2d23[_0x203d('0x30')]){delete _0x5e2d23[_0x203d('0x30')];}_0x4747a6[_0x203d('0x26')](_0x1d5af0)[_0x203d('0x31')](_0x5e2d23);};}exports[_0x203d('0x32')]=function(_0x230df9,_0x21f8d3){var _0x4e6cec={},_0x48d913={},_0x192aba={'count':0x0,'rows':[]};var _0x3e4d7f=_[_0x203d('0x33')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x18e7d3){return{'name':_0x18e7d3[_0x203d('0x34')],'type':_0x18e7d3[_0x203d('0x35')][_0x203d('0x36')]};});_0x48d913[_0x203d('0x37')]=_[_0x203d('0x33')](_0x3e4d7f,_0x203d('0x30'));_0x48d913[_0x203d('0x38')]=_[_0x203d('0x39')](_0x230df9[_0x203d('0x38')]);_0x48d913[_0x203d('0x3a')]=_[_0x203d('0x3b')](_0x48d913[_0x203d('0x37')],_0x48d913[_0x203d('0x38')]);_0x4e6cec[_0x203d('0x3c')]=_[_0x203d('0x3b')](_0x48d913[_0x203d('0x37')],qs[_0x203d('0x3d')](_0x230df9[_0x203d('0x38')][_0x203d('0x3d')]));_0x4e6cec[_0x203d('0x3c')]=_0x4e6cec['attributes'][_0x203d('0x3e')]?_0x4e6cec[_0x203d('0x3c')]:_0x48d913[_0x203d('0x37')];if(!_0x230df9[_0x203d('0x38')][_0x203d('0x3f')](_0x203d('0x40'))){_0x4e6cec[_0x203d('0x2a')]=qs['limit'](_0x230df9['query'][_0x203d('0x2a')]);_0x4e6cec[_0x203d('0x29')]=qs[_0x203d('0x29')](_0x230df9[_0x203d('0x38')][_0x203d('0x29')]);}_0x4e6cec[_0x203d('0x41')]=qs['sort'](_0x230df9[_0x203d('0x38')][_0x203d('0x42')]);_0x4e6cec[_0x203d('0x43')]=qs[_0x203d('0x3a')](_[_0x203d('0x44')](_0x230df9[_0x203d('0x38')],_0x48d913['filters']),_0x3e4d7f);if(_0x230df9['query'][_0x203d('0x45')]){_0x4e6cec[_0x203d('0x43')]=_[_0x203d('0x46')](_0x4e6cec['where'],{'$or':_['map'](_0x3e4d7f,function(_0x573985){if(_0x573985[_0x203d('0x35')]!==_0x203d('0x47')){var _0x1d3652={};_0x1d3652[_0x573985[_0x203d('0x30')]]={'$like':'%'+_0x230df9[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x1d3652;}})});}_0x4e6cec=_[_0x203d('0x46')]({},_0x4e6cec,_0x230df9[_0x203d('0x48')]);var _0x3852f8={'where':_0x4e6cec[_0x203d('0x43')]};return db[_0x203d('0x49')][_0x203d('0x4a')](_0x3852f8)[_0x203d('0x1a')](function(_0x5786b9){_0x192aba[_0x203d('0x4a')]=_0x5786b9;if(_0x230df9[_0x203d('0x38')][_0x203d('0x4b')]){_0x4e6cec[_0x203d('0x4c')]=[{'all':!![]}];}return db[_0x203d('0x49')]['findAll'](_0x4e6cec);})[_0x203d('0x1a')](function(_0x3624e3){_0x192aba[_0x203d('0x4d')]=_0x3624e3;return _0x192aba;})[_0x203d('0x1a')](respondWithFilteredResult(_0x21f8d3,_0x4e6cec))[_0x203d('0x24')](handleError(_0x21f8d3,null));};exports[_0x203d('0x4e')]=function(_0x5a88b2,_0x248680){var _0x176db9={'raw':![],'where':{'id':_0x5a88b2[_0x203d('0x4f')]['id']}},_0x494b29={};_0x494b29[_0x203d('0x37')]=_[_0x203d('0x39')](db[_0x203d('0x49')]['rawAttributes']);_0x494b29[_0x203d('0x38')]=_['keys'](_0x5a88b2[_0x203d('0x38')]);_0x494b29[_0x203d('0x3a')]=_[_0x203d('0x3b')](_0x494b29[_0x203d('0x37')],_0x494b29[_0x203d('0x38')]);_0x176db9['attributes']=_['intersection'](_0x494b29[_0x203d('0x37')],qs[_0x203d('0x3d')](_0x5a88b2[_0x203d('0x38')]['fields']));_0x176db9[_0x203d('0x3c')]=_0x176db9[_0x203d('0x3c')][_0x203d('0x3e')]?_0x176db9[_0x203d('0x3c')]:_0x494b29[_0x203d('0x37')];if(_0x5a88b2['query']['includeAll']){_0x176db9['include']=[{'all':!![]}];}_0x176db9=_[_0x203d('0x46')]({},_0x176db9,_0x5a88b2[_0x203d('0x48')]);return db[_0x203d('0x49')][_0x203d('0x50')](_0x176db9)[_0x203d('0x1a')](handleEntityNotFound(_0x248680,null))['then'](respondWithResult(_0x248680,null))[_0x203d('0x24')](handleError(_0x248680,null));};exports[_0x203d('0x51')]=function(_0x19412d,_0x1c94f2){return db[_0x203d('0x49')]['create'](_0x19412d[_0x203d('0x52')],{})['then'](respondWithResult(_0x1c94f2,0xc9))['catch'](handleError(_0x1c94f2,null));};exports[_0x203d('0x2e')]=function(_0x91b97f,_0x529143){if(_0x91b97f[_0x203d('0x52')]['id']){delete _0x91b97f['body']['id'];}return db[_0x203d('0x49')][_0x203d('0x50')]({'where':{'id':_0x91b97f[_0x203d('0x4f')]['id']}})[_0x203d('0x1a')](handleEntityNotFound(_0x529143,null))[_0x203d('0x1a')](saveUpdates(_0x91b97f['body'],null))['then'](respondWithResult(_0x529143,null))[_0x203d('0x24')](handleError(_0x529143,null));};exports[_0x203d('0x53')]=function(_0x5803c0,_0x2bd9bb){return db[_0x203d('0x49')][_0x203d('0x50')]({'where':{'id':_0x5803c0['params']['id']}})['then'](handleEntityNotFound(_0x2bd9bb,null))[_0x203d('0x1a')](removeEntity(_0x2bd9bb,null))[_0x203d('0x24')](handleError(_0x2bd9bb,null));};exports[_0x203d('0x54')]=function(_0x3be9a2,_0xa73ea4,_0x342d55){var _0x437928={};var _0xf9ca6a={};var _0x5c952d;var _0x5de1b5;return db[_0x203d('0x49')]['findOne']({'where':{'id':_0x3be9a2['params']['id']}})[_0x203d('0x1a')](handleEntityNotFound(_0xa73ea4,null))[_0x203d('0x1a')](function(_0x4a378c){if(_0x4a378c){_0x5c952d=_0x4a378c;_0xf9ca6a['model']=_['keys'](db[_0x203d('0x55')]['rawAttributes']);_0xf9ca6a[_0x203d('0x38')]=_[_0x203d('0x39')](_0x3be9a2[_0x203d('0x38')]);_0xf9ca6a[_0x203d('0x3a')]=_[_0x203d('0x3b')](_0xf9ca6a[_0x203d('0x37')],_0xf9ca6a[_0x203d('0x38')]);_0x437928[_0x203d('0x3c')]=_[_0x203d('0x3b')](_0xf9ca6a[_0x203d('0x37')],qs[_0x203d('0x3d')](_0x3be9a2[_0x203d('0x38')][_0x203d('0x3d')]));_0x437928[_0x203d('0x3c')]=_0x437928['attributes'][_0x203d('0x3e')]?_0x437928[_0x203d('0x3c')]:_0xf9ca6a['model'];_0x437928[_0x203d('0x41')]=qs[_0x203d('0x42')](_0x3be9a2['query'][_0x203d('0x42')]);_0x437928[_0x203d('0x43')]=qs[_0x203d('0x3a')](_[_0x203d('0x44')](_0x3be9a2[_0x203d('0x38')],_0xf9ca6a[_0x203d('0x3a')]));if(_0x3be9a2[_0x203d('0x38')]['filter']){_0x437928['where']=_[_0x203d('0x46')](_0x437928[_0x203d('0x43')],{'$or':_[_0x203d('0x33')](_0x437928[_0x203d('0x3c')],function(_0x195a4c){var _0x4b77cc={};_0x4b77cc[_0x195a4c]={'$like':'%'+_0x3be9a2[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x4b77cc;})});}_0x437928=_['merge']({},_0x437928,_0x3be9a2['options']);return _0x5c952d[_0x203d('0x54')](_0x437928);}})['then'](function(_0x5aba64){if(_0x5aba64){_0x5de1b5=_0x5aba64[_0x203d('0x3e')];if(!_0x3be9a2[_0x203d('0x38')][_0x203d('0x3f')](_0x203d('0x40'))){_0x437928[_0x203d('0x2a')]=qs[_0x203d('0x2a')](_0x3be9a2[_0x203d('0x38')]['limit']);_0x437928['offset']=qs['offset'](_0x3be9a2['query'][_0x203d('0x29')]);}return _0x5c952d[_0x203d('0x54')](_0x437928);}})[_0x203d('0x1a')](function(_0x25bb7d){if(_0x25bb7d){return _0x25bb7d?{'count':_0x5de1b5,'rows':_0x25bb7d}:null;}})['then'](respondWithResult(_0xa73ea4,null))[_0x203d('0x24')](handleError(_0xa73ea4,null));};exports[_0x203d('0x56')]=function(_0x51c99a,_0x1213be,_0x43e161){var _0x36f603={};var _0x3b618a={};var _0x4bcb88;var _0x4999be;return db[_0x203d('0x49')][_0x203d('0x57')]({'where':{'id':_0x51c99a[_0x203d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1213be,null))['then'](function(_0x273b50){if(_0x273b50){_0x4bcb88=_0x273b50;_0x3b618a[_0x203d('0x37')]=_[_0x203d('0x39')](db[_0x203d('0x55')][_0x203d('0x58')]);_0x3b618a[_0x203d('0x38')]=_[_0x203d('0x39')](_0x51c99a[_0x203d('0x38')]);_0x3b618a['filters']=_[_0x203d('0x3b')](_0x3b618a[_0x203d('0x37')],_0x3b618a['query']);_0x36f603[_0x203d('0x3c')]=_[_0x203d('0x3b')](_0x3b618a[_0x203d('0x37')],qs['fields'](_0x51c99a['query']['fields']));_0x36f603[_0x203d('0x3c')]=_0x36f603[_0x203d('0x3c')][_0x203d('0x3e')]?_0x36f603[_0x203d('0x3c')]:_0x3b618a[_0x203d('0x37')];_0x36f603['order']=qs[_0x203d('0x42')](_0x51c99a[_0x203d('0x38')][_0x203d('0x42')]);_0x36f603[_0x203d('0x43')]=qs['filters'](_['pick'](_0x51c99a[_0x203d('0x38')],_0x3b618a['filters']));if(_0x51c99a[_0x203d('0x38')]['filter']){_0x36f603[_0x203d('0x43')]=_[_0x203d('0x46')](_0x36f603[_0x203d('0x43')],{'$or':_['map'](_0x36f603['attributes'],function(_0x20e3f1){var _0x24485b={};_0x24485b[_0x20e3f1]={'$like':'%'+_0x51c99a[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x24485b;})});}_0x36f603=_[_0x203d('0x46')]({},_0x36f603,_0x51c99a[_0x203d('0x48')]);return _0x4bcb88[_0x203d('0x56')](_0x36f603);}})[_0x203d('0x1a')](function(_0x1290ab){if(_0x1290ab){_0x4999be=_0x1290ab[_0x203d('0x3e')];if(!_0x51c99a['query'][_0x203d('0x3f')](_0x203d('0x40'))){_0x36f603[_0x203d('0x2a')]=qs[_0x203d('0x2a')](_0x51c99a['query'][_0x203d('0x2a')]);_0x36f603[_0x203d('0x29')]=qs[_0x203d('0x29')](_0x51c99a[_0x203d('0x38')][_0x203d('0x29')]);}return _0x4bcb88[_0x203d('0x56')](_0x36f603);}})[_0x203d('0x1a')](function(_0x457910){if(_0x457910){return _0x457910?{'count':_0x4999be,'rows':_0x457910}:null;}})[_0x203d('0x1a')](respondWithResult(_0x1213be,null))['catch'](handleError(_0x1213be,null));};exports[_0x203d('0x59')]=function(_0x4b7589,_0x3a71c9,_0x3ad7bb){var _0x558b57={};var _0x2fc846={};var _0x3241e8;var _0x23aa27;return db[_0x203d('0x49')]['findOne']({'where':{'id':_0x4b7589[_0x203d('0x4f')]['id']}})[_0x203d('0x1a')](handleEntityNotFound(_0x3a71c9,null))[_0x203d('0x1a')](function(_0x3dddfd){if(_0x3dddfd){_0x3241e8=_0x3dddfd;_0x2fc846[_0x203d('0x37')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x2fc846[_0x203d('0x38')]=_[_0x203d('0x39')](_0x4b7589[_0x203d('0x38')]);_0x2fc846[_0x203d('0x3a')]=_['intersection'](_0x2fc846[_0x203d('0x37')],_0x2fc846[_0x203d('0x38')]);_0x558b57[_0x203d('0x3c')]=_[_0x203d('0x3b')](_0x2fc846[_0x203d('0x37')],qs[_0x203d('0x3d')](_0x4b7589[_0x203d('0x38')][_0x203d('0x3d')]));_0x558b57[_0x203d('0x3c')]=_0x558b57[_0x203d('0x3c')][_0x203d('0x3e')]?_0x558b57['attributes']:_0x2fc846['model'];_0x558b57['order']=qs[_0x203d('0x42')](_0x4b7589['query'][_0x203d('0x42')]);_0x558b57['where']=qs[_0x203d('0x3a')](_[_0x203d('0x44')](_0x4b7589[_0x203d('0x38')],_0x2fc846['filters']));if(_0x4b7589[_0x203d('0x38')][_0x203d('0x45')]){_0x558b57[_0x203d('0x43')]=_[_0x203d('0x46')](_0x558b57['where'],{'$or':_[_0x203d('0x33')](_0x558b57[_0x203d('0x3c')],function(_0xd95fa3){var _0x3e312d={};_0x3e312d[_0xd95fa3]={'$like':'%'+_0x4b7589[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x3e312d;})});}_0x558b57=_[_0x203d('0x46')]({},_0x558b57,_0x4b7589[_0x203d('0x48')]);return _0x3241e8[_0x203d('0x59')](_0x558b57);}})[_0x203d('0x1a')](function(_0x52ac6f){if(_0x52ac6f){_0x23aa27=_0x52ac6f[_0x203d('0x3e')];if(!_0x4b7589['query'][_0x203d('0x3f')](_0x203d('0x40'))){_0x558b57['limit']=qs['limit'](_0x4b7589[_0x203d('0x38')][_0x203d('0x2a')]);_0x558b57[_0x203d('0x29')]=qs['offset'](_0x4b7589[_0x203d('0x38')][_0x203d('0x29')]);}return _0x3241e8[_0x203d('0x59')](_0x558b57);}})['then'](function(_0x2e03f1){if(_0x2e03f1){return _0x2e03f1?{'count':_0x23aa27,'rows':_0x2e03f1}:null;}})[_0x203d('0x1a')](respondWithResult(_0x3a71c9,null))[_0x203d('0x24')](handleError(_0x3a71c9,null));};exports[_0x203d('0x5a')]=function(_0x959727,_0x573457,_0x575e27){var _0x372404={};var _0x1e05cf={};var _0x35317c;var _0xad90a6;return db[_0x203d('0x49')][_0x203d('0x57')]({'where':{'id':_0x959727[_0x203d('0x4f')]['id']}})[_0x203d('0x1a')](handleEntityNotFound(_0x573457,null))[_0x203d('0x1a')](function(_0x1c8d05){if(_0x1c8d05){_0x35317c=_0x1c8d05;_0x1e05cf[_0x203d('0x37')]=_[_0x203d('0x39')](db['Tag'][_0x203d('0x58')]);_0x1e05cf[_0x203d('0x38')]=_[_0x203d('0x39')](_0x959727[_0x203d('0x38')]);_0x1e05cf[_0x203d('0x3a')]=_['intersection'](_0x1e05cf[_0x203d('0x37')],_0x1e05cf[_0x203d('0x38')]);_0x372404[_0x203d('0x3c')]=_['intersection'](_0x1e05cf[_0x203d('0x37')],qs['fields'](_0x959727[_0x203d('0x38')][_0x203d('0x3d')]));_0x372404['attributes']=_0x372404['attributes'][_0x203d('0x3e')]?_0x372404[_0x203d('0x3c')]:_0x1e05cf['model'];_0x372404[_0x203d('0x41')]=qs[_0x203d('0x42')](_0x959727[_0x203d('0x38')][_0x203d('0x42')]);_0x372404[_0x203d('0x43')]=qs['filters'](_[_0x203d('0x44')](_0x959727[_0x203d('0x38')],_0x1e05cf['filters']));if(_0x959727[_0x203d('0x38')]['filter']){_0x372404[_0x203d('0x43')]=_['merge'](_0x372404[_0x203d('0x43')],{'$or':_[_0x203d('0x33')](_0x372404[_0x203d('0x3c')],function(_0x41b175){var _0x43dfa1={};_0x43dfa1[_0x41b175]={'$like':'%'+_0x959727[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x43dfa1;})});}_0x372404=_[_0x203d('0x46')]({},_0x372404,_0x959727['options']);return _0x35317c['getTags'](_0x372404);}})[_0x203d('0x1a')](function(_0x1eee0a){if(_0x1eee0a){_0xad90a6=_0x1eee0a['length'];if(!_0x959727['query'][_0x203d('0x3f')](_0x203d('0x40'))){_0x372404[_0x203d('0x2a')]=qs[_0x203d('0x2a')](_0x959727[_0x203d('0x38')]['limit']);_0x372404[_0x203d('0x29')]=qs[_0x203d('0x29')](_0x959727[_0x203d('0x38')]['offset']);}return _0x35317c['getTags'](_0x372404);}})[_0x203d('0x1a')](function(_0x46307c){if(_0x46307c){return _0x46307c?{'count':_0xad90a6,'rows':_0x46307c}:null;}})[_0x203d('0x1a')](respondWithResult(_0x573457,null))[_0x203d('0x24')](handleError(_0x573457,null));};exports[_0x203d('0x5b')]=function(_0x25b5c7,_0x265d3d,_0x3d1897){if(_0x25b5c7[_0x203d('0x52')]['id']){delete _0x25b5c7['body']['id'];}return db[_0x203d('0x49')][_0x203d('0x57')]({'where':{'id':_0x25b5c7[_0x203d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x265d3d,null))[_0x203d('0x1a')](function(_0x263ba8){if(_0x263ba8){return _0x263ba8[_0x203d('0x5b')](_0x25b5c7[_0x203d('0x52')][_0x203d('0x5c')]||[]);}return null;})[_0x203d('0x1a')](respondWithResult(_0x265d3d,null))[_0x203d('0x24')](handleError(_0x265d3d,null));}; \ No newline at end of file +var _0x00bb=['rows','length','find','create','body','params','getFields','findOne','FreshdeskField','order','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','findAll'];(function(_0xd081f8,_0xe64ecb){var _0x3b026e=function(_0x3ad59d){while(--_0x3ad59d){_0xd081f8['push'](_0xd081f8['shift']());}};_0x3b026e(++_0xe64ecb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x00bb[_0x23e7c1];return _0x1add43;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xb00b('0x14'));var client=jayson[_0xb00b('0x15')][_0xb00b('0x16')]({'port':0x232a});function checkPasswordPattern(_0x466b9b,_0xef5d52,_0x1f1c1d){if(_0x1f1c1d){var _0x4ada81=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ada81[_0xb00b('0x17')](_0xef5d52)){return _0x466b9b;}else{throw new db[(_0xb00b('0x18'))]['ValidationError'](_0xb00b('0x19'));}}else{return _0x466b9b;}}function respondWithRpcPromise(_0x1084a6,_0x540b79,_0x5da36b,_0x9b471e){return new BPromise(function(_0x4dcd45,_0x51d136){var _0x1f9c78=_0x9b471e||client;return _0x1f9c78[_0xb00b('0x1a')](_0x1084a6,_0x5da36b)[_0xb00b('0x1b')](function(_0xbb72fc){logger['info'](_0xb00b('0x1c'),_0x540b79,'request\x20sent');logger[_0xb00b('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x540b79,_0xb00b('0x1e'),JSON['stringify'](_0xbb72fc));if(_0xbb72fc[_0xb00b('0x1f')]){if(_0xbb72fc[_0xb00b('0x1f')]['code']===0x1f4){logger['error'](_0xb00b('0x1c'),_0x540b79,_0xbb72fc['error'][_0xb00b('0x20')]);return _0x51d136(_0xbb72fc[_0xb00b('0x1f')][_0xb00b('0x20')]);}logger[_0xb00b('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x540b79,_0xbb72fc[_0xb00b('0x1f')]['message']);return _0x4dcd45(_0xbb72fc[_0xb00b('0x1f')][_0xb00b('0x20')]);}else{logger['info'](_0xb00b('0x1c'),_0x540b79,_0xb00b('0x1e'));_0x4dcd45(_0xbb72fc['result'][_0xb00b('0x20')]);}})[_0xb00b('0x21')](function(_0x5568bb){logger[_0xb00b('0x1f')](_0xb00b('0x1c'),_0x540b79,_0x5568bb);_0x51d136(_0x5568bb);});});}function respondWithStatusCode(_0x3c9500,_0x8caadf){_0x8caadf=_0x8caadf||0xcc;return function(_0x520e55){if(_0x520e55){return _0x3c9500['sendStatus'](_0x8caadf);}return _0x3c9500[_0xb00b('0x22')](_0x8caadf)['end']();};}function respondWithResult(_0x550587,_0x4a635e){_0x4a635e=_0x4a635e||0xc8;return function(_0x16ac55){if(_0x16ac55){return _0x550587[_0xb00b('0x22')](_0x4a635e)[_0xb00b('0x23')](_0x16ac55);}};}function respondWithFilteredResult(_0x3825af,_0x1f14fa){return function(_0x197379){if(_0x197379){var _0x15d3b9=_0x197379[_0xb00b('0x24')],_0x4a8d2b=_0x1f14fa[_0xb00b('0x25')],_0x22c22d=_0x1f14fa[_0xb00b('0x25')]+_0x1f14fa['limit'],_0x503c9c;if(_0x22c22d>=_0x15d3b9){_0x22c22d=_0x15d3b9;_0x503c9c=0xc8;}else{_0x503c9c=0xce;}_0x3825af[_0xb00b('0x22')](_0x503c9c);return _0x3825af[_0xb00b('0x26')](_0xb00b('0x27'),_0x4a8d2b+'-'+_0x22c22d+'/'+_0x15d3b9)[_0xb00b('0x23')](_0x197379);}return null;};}function patchUpdates(_0x303625){return function(_0x2b9824){try{jsonpatch[_0xb00b('0x28')](_0x2b9824,_0x303625,!![]);}catch(_0x7c56e7){return BPromise[_0xb00b('0x29')](_0x7c56e7);}return _0x2b9824['save']();};}function saveUpdates(_0x2b5f41,_0x44918d){return function(_0x49078d){if(_0x49078d){return _0x49078d[_0xb00b('0x2a')](_0x2b5f41)[_0xb00b('0x1b')](function(_0x5a5e5a){return _0x5a5e5a;});}return null;};}function removeEntity(_0x456241,_0x4d2ee5){return function(_0x20e1c9){if(_0x20e1c9){return _0x20e1c9[_0xb00b('0x2b')]()[_0xb00b('0x1b')](function(){_0x456241[_0xb00b('0x22')](0xcc)[_0xb00b('0x2c')]();});}};}function handleEntityNotFound(_0x1436ad,_0x17f613){return function(_0x594840){if(!_0x594840){_0x1436ad['sendStatus'](0x194);}return _0x594840;};}function handleError(_0x5b04c2,_0x347e73){_0x347e73=_0x347e73||0x1f4;return function(_0xc21102){logger[_0xb00b('0x1f')](_0xc21102[_0xb00b('0x2d')]);if(_0xc21102['name']){delete _0xc21102[_0xb00b('0x2e')];}_0x5b04c2[_0xb00b('0x22')](_0x347e73)[_0xb00b('0x2f')](_0xc21102);};}exports[_0xb00b('0x30')]=function(_0x261c80,_0x39da49){var _0x8785ec={},_0x3302ac={},_0x5efc18={'count':0x0,'rows':[]};var _0x55451e=_[_0xb00b('0x31')](db['FreshdeskConfiguration'][_0xb00b('0x32')],function(_0x1c5400){return{'name':_0x1c5400[_0xb00b('0x33')],'type':_0x1c5400[_0xb00b('0x34')][_0xb00b('0x35')]};});_0x3302ac[_0xb00b('0x36')]=_[_0xb00b('0x31')](_0x55451e,'name');_0x3302ac[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x261c80[_0xb00b('0x37')]);_0x3302ac[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x3302ac[_0xb00b('0x36')],_0x3302ac['query']);_0x8785ec[_0xb00b('0x3b')]=_[_0xb00b('0x3a')](_0x3302ac['model'],qs[_0xb00b('0x3c')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x8785ec[_0xb00b('0x3b')]=_0x8785ec[_0xb00b('0x3b')]['length']?_0x8785ec[_0xb00b('0x3b')]:_0x3302ac[_0xb00b('0x36')];if(!_0x261c80[_0xb00b('0x37')][_0xb00b('0x3d')]('nolimit')){_0x8785ec['limit']=qs[_0xb00b('0x3e')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x8785ec[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x25')]);}_0x8785ec['order']=qs[_0xb00b('0x3f')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x3f')]);_0x8785ec[_0xb00b('0x40')]=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x261c80[_0xb00b('0x37')],_0x3302ac[_0xb00b('0x39')]),_0x55451e);if(_0x261c80[_0xb00b('0x37')][_0xb00b('0x42')]){_0x8785ec[_0xb00b('0x40')]=_[_0xb00b('0x43')](_0x8785ec['where'],{'$or':_[_0xb00b('0x31')](_0x55451e,function(_0x35a0ba){if(_0x35a0ba[_0xb00b('0x34')]!==_0xb00b('0x44')){var _0x10b136={};_0x10b136[_0x35a0ba[_0xb00b('0x2e')]]={'$like':'%'+_0x261c80[_0xb00b('0x37')][_0xb00b('0x42')]+'%'};return _0x10b136;}})});}_0x8785ec=_[_0xb00b('0x43')]({},_0x8785ec,_0x261c80[_0xb00b('0x45')]);var _0x1eec12={'where':_0x8785ec[_0xb00b('0x40')]};return db['FreshdeskConfiguration']['count'](_0x1eec12)['then'](function(_0x3f8f60){_0x5efc18[_0xb00b('0x24')]=_0x3f8f60;if(_0x261c80['query'][_0xb00b('0x46')]){_0x8785ec[_0xb00b('0x47')]=[{'all':!![]}];}return db[_0xb00b('0x48')][_0xb00b('0x49')](_0x8785ec);})['then'](function(_0x58e9cb){_0x5efc18[_0xb00b('0x4a')]=_0x58e9cb;return _0x5efc18;})[_0xb00b('0x1b')](respondWithFilteredResult(_0x39da49,_0x8785ec))['catch'](handleError(_0x39da49,null));};exports['show']=function(_0x154759,_0x3a205d){var _0x4e0be4={'raw':![],'where':{'id':_0x154759['params']['id']}},_0x2228e9={};_0x2228e9['model']=_['keys'](db[_0xb00b('0x48')]['rawAttributes']);_0x2228e9[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x154759[_0xb00b('0x37')]);_0x2228e9[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x2228e9[_0xb00b('0x36')],_0x2228e9['query']);_0x4e0be4['attributes']=_[_0xb00b('0x3a')](_0x2228e9[_0xb00b('0x36')],qs['fields'](_0x154759[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x4e0be4['attributes']=_0x4e0be4[_0xb00b('0x3b')][_0xb00b('0x4b')]?_0x4e0be4[_0xb00b('0x3b')]:_0x2228e9['model'];if(_0x154759['query'][_0xb00b('0x46')]){_0x4e0be4[_0xb00b('0x47')]=[{'all':!![]}];}_0x4e0be4=_[_0xb00b('0x43')]({},_0x4e0be4,_0x154759[_0xb00b('0x45')]);return db['FreshdeskConfiguration'][_0xb00b('0x4c')](_0x4e0be4)[_0xb00b('0x1b')](handleEntityNotFound(_0x3a205d,null))['then'](respondWithResult(_0x3a205d,null))['catch'](handleError(_0x3a205d,null));};exports[_0xb00b('0x4d')]=function(_0x524b05,_0x1ab196){return db[_0xb00b('0x48')][_0xb00b('0x4d')](_0x524b05[_0xb00b('0x4e')],{})[_0xb00b('0x1b')](respondWithResult(_0x1ab196,0xc9))[_0xb00b('0x21')](handleError(_0x1ab196,null));};exports['update']=function(_0x5d52a5,_0x51c9e3){if(_0x5d52a5[_0xb00b('0x4e')]['id']){delete _0x5d52a5[_0xb00b('0x4e')]['id'];}return db[_0xb00b('0x48')]['find']({'where':{'id':_0x5d52a5[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x51c9e3,null))[_0xb00b('0x1b')](saveUpdates(_0x5d52a5['body'],null))[_0xb00b('0x1b')](respondWithResult(_0x51c9e3,null))[_0xb00b('0x21')](handleError(_0x51c9e3,null));};exports[_0xb00b('0x2b')]=function(_0x385029,_0x131848){return db[_0xb00b('0x48')][_0xb00b('0x4c')]({'where':{'id':_0x385029[_0xb00b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x131848,null))[_0xb00b('0x1b')](removeEntity(_0x131848,null))[_0xb00b('0x21')](handleError(_0x131848,null));};exports[_0xb00b('0x50')]=function(_0x4a22dd,_0x237419,_0x24a8a2){var _0x309799={};var _0x2b7148={};var _0x1ad387;var _0x4bfe0b;return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x4a22dd[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x237419,null))['then'](function(_0x32b9fe){if(_0x32b9fe){_0x1ad387=_0x32b9fe;_0x2b7148[_0xb00b('0x36')]=_[_0xb00b('0x38')](db[_0xb00b('0x52')][_0xb00b('0x32')]);_0x2b7148[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x4a22dd['query']);_0x2b7148[_0xb00b('0x39')]=_['intersection'](_0x2b7148[_0xb00b('0x36')],_0x2b7148['query']);_0x309799[_0xb00b('0x3b')]=_['intersection'](_0x2b7148[_0xb00b('0x36')],qs['fields'](_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x309799[_0xb00b('0x3b')]=_0x309799['attributes']['length']?_0x309799['attributes']:_0x2b7148[_0xb00b('0x36')];_0x309799[_0xb00b('0x53')]=qs[_0xb00b('0x3f')](_0x4a22dd['query'][_0xb00b('0x3f')]);_0x309799[_0xb00b('0x40')]=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x4a22dd[_0xb00b('0x37')],_0x2b7148['filters']));if(_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x42')]){_0x309799['where']=_[_0xb00b('0x43')](_0x309799[_0xb00b('0x40')],{'$or':_[_0xb00b('0x31')](_0x309799['attributes'],function(_0x4e8b85){var _0x359669={};_0x359669[_0x4e8b85]={'$like':'%'+_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x42')]+'%'};return _0x359669;})});}_0x309799=_['merge']({},_0x309799,_0x4a22dd['options']);return _0x1ad387['getFields'](_0x309799);}})['then'](function(_0xc695f){if(_0xc695f){_0x4bfe0b=_0xc695f['length'];if(!_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x3d')]('nolimit')){_0x309799[_0xb00b('0x3e')]=qs[_0xb00b('0x3e')](_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x309799[_0xb00b('0x25')]=qs['offset'](_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x1ad387[_0xb00b('0x50')](_0x309799);}})[_0xb00b('0x1b')](function(_0x8e7e4e){if(_0x8e7e4e){return _0x8e7e4e?{'count':_0x4bfe0b,'rows':_0x8e7e4e}:null;}})[_0xb00b('0x1b')](respondWithResult(_0x237419,null))[_0xb00b('0x21')](handleError(_0x237419,null));};exports['getSubjects']=function(_0x27b3ae,_0x258d0b,_0xe6188b){var _0x328f72={};var _0x109f56={};var _0x432b68;var _0x3f010a;return db[_0xb00b('0x48')]['findOne']({'where':{'id':_0x27b3ae[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x258d0b,null))[_0xb00b('0x1b')](function(_0x3e6a79){if(_0x3e6a79){_0x432b68=_0x3e6a79;_0x109f56[_0xb00b('0x36')]=_[_0xb00b('0x38')](db[_0xb00b('0x52')][_0xb00b('0x32')]);_0x109f56['query']=_[_0xb00b('0x38')](_0x27b3ae[_0xb00b('0x37')]);_0x109f56[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x109f56[_0xb00b('0x36')],_0x109f56[_0xb00b('0x37')]);_0x328f72[_0xb00b('0x3b')]=_['intersection'](_0x109f56[_0xb00b('0x36')],qs[_0xb00b('0x3c')](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x328f72[_0xb00b('0x3b')]=_0x328f72[_0xb00b('0x3b')]['length']?_0x328f72[_0xb00b('0x3b')]:_0x109f56['model'];_0x328f72[_0xb00b('0x53')]=qs['sort'](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x3f')]);_0x328f72[_0xb00b('0x40')]=qs['filters'](_['pick'](_0x27b3ae[_0xb00b('0x37')],_0x109f56[_0xb00b('0x39')]));if(_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x42')]){_0x328f72[_0xb00b('0x40')]=_[_0xb00b('0x43')](_0x328f72[_0xb00b('0x40')],{'$or':_[_0xb00b('0x31')](_0x328f72[_0xb00b('0x3b')],function(_0x25bef6){var _0x257430={};_0x257430[_0x25bef6]={'$like':'%'+_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x42')]+'%'};return _0x257430;})});}_0x328f72=_[_0xb00b('0x43')]({},_0x328f72,_0x27b3ae['options']);return _0x432b68['getSubjects'](_0x328f72);}})[_0xb00b('0x1b')](function(_0x180008){if(_0x180008){_0x3f010a=_0x180008['length'];if(!_0x27b3ae['query'][_0xb00b('0x3d')](_0xb00b('0x54'))){_0x328f72[_0xb00b('0x3e')]=qs['limit'](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x328f72[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x432b68[_0xb00b('0x55')](_0x328f72);}})['then'](function(_0x4168cf){if(_0x4168cf){return _0x4168cf?{'count':_0x3f010a,'rows':_0x4168cf}:null;}})['then'](respondWithResult(_0x258d0b,null))[_0xb00b('0x21')](handleError(_0x258d0b,null));};exports[_0xb00b('0x56')]=function(_0x545dfd,_0xcef063,_0x1099cb){var _0xe80a21={};var _0x263f0b={};var _0x410d68;var _0x4434fa;return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x545dfd[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0xcef063,null))[_0xb00b('0x1b')](function(_0x3893df){if(_0x3893df){_0x410d68=_0x3893df;_0x263f0b['model']=_[_0xb00b('0x38')](db[_0xb00b('0x52')][_0xb00b('0x32')]);_0x263f0b[_0xb00b('0x37')]=_['keys'](_0x545dfd[_0xb00b('0x37')]);_0x263f0b[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x263f0b[_0xb00b('0x36')],_0x263f0b[_0xb00b('0x37')]);_0xe80a21['attributes']=_[_0xb00b('0x3a')](_0x263f0b[_0xb00b('0x36')],qs[_0xb00b('0x3c')](_0x545dfd[_0xb00b('0x37')]['fields']));_0xe80a21[_0xb00b('0x3b')]=_0xe80a21['attributes'][_0xb00b('0x4b')]?_0xe80a21[_0xb00b('0x3b')]:_0x263f0b[_0xb00b('0x36')];_0xe80a21[_0xb00b('0x53')]=qs[_0xb00b('0x3f')](_0x545dfd[_0xb00b('0x37')][_0xb00b('0x3f')]);_0xe80a21[_0xb00b('0x40')]=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x545dfd[_0xb00b('0x37')],_0x263f0b['filters']));if(_0x545dfd[_0xb00b('0x37')][_0xb00b('0x42')]){_0xe80a21[_0xb00b('0x40')]=_[_0xb00b('0x43')](_0xe80a21['where'],{'$or':_[_0xb00b('0x31')](_0xe80a21[_0xb00b('0x3b')],function(_0x4b5508){var _0x5c1aaa={};_0x5c1aaa[_0x4b5508]={'$like':'%'+_0x545dfd['query'][_0xb00b('0x42')]+'%'};return _0x5c1aaa;})});}_0xe80a21=_[_0xb00b('0x43')]({},_0xe80a21,_0x545dfd[_0xb00b('0x45')]);return _0x410d68['getDescriptions'](_0xe80a21);}})[_0xb00b('0x1b')](function(_0x296be0){if(_0x296be0){_0x4434fa=_0x296be0[_0xb00b('0x4b')];if(!_0x545dfd[_0xb00b('0x37')][_0xb00b('0x3d')](_0xb00b('0x54'))){_0xe80a21[_0xb00b('0x3e')]=qs[_0xb00b('0x3e')](_0x545dfd[_0xb00b('0x37')]['limit']);_0xe80a21['offset']=qs[_0xb00b('0x25')](_0x545dfd[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x410d68[_0xb00b('0x56')](_0xe80a21);}})['then'](function(_0x62f47){if(_0x62f47){return _0x62f47?{'count':_0x4434fa,'rows':_0x62f47}:null;}})[_0xb00b('0x1b')](respondWithResult(_0xcef063,null))['catch'](handleError(_0xcef063,null));};exports[_0xb00b('0x57')]=function(_0x21cdbe,_0x2762fb,_0x54244b){var _0x1abcd8={};var _0x1dd043={};var _0x51d9de;var _0x2b7fa9;return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x21cdbe[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x2762fb,null))[_0xb00b('0x1b')](function(_0x3a7db7){if(_0x3a7db7){_0x51d9de=_0x3a7db7;_0x1dd043[_0xb00b('0x36')]=_['keys'](db[_0xb00b('0x58')][_0xb00b('0x32')]);_0x1dd043[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x21cdbe['query']);_0x1dd043[_0xb00b('0x39')]=_['intersection'](_0x1dd043[_0xb00b('0x36')],_0x1dd043['query']);_0x1abcd8[_0xb00b('0x3b')]=_[_0xb00b('0x3a')](_0x1dd043[_0xb00b('0x36')],qs[_0xb00b('0x3c')](_0x21cdbe[_0xb00b('0x37')]['fields']));_0x1abcd8[_0xb00b('0x3b')]=_0x1abcd8[_0xb00b('0x3b')]['length']?_0x1abcd8[_0xb00b('0x3b')]:_0x1dd043['model'];_0x1abcd8[_0xb00b('0x53')]=qs[_0xb00b('0x3f')](_0x21cdbe[_0xb00b('0x37')][_0xb00b('0x3f')]);_0x1abcd8['where']=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x21cdbe[_0xb00b('0x37')],_0x1dd043[_0xb00b('0x39')]));if(_0x21cdbe[_0xb00b('0x37')]['filter']){_0x1abcd8['where']=_[_0xb00b('0x43')](_0x1abcd8[_0xb00b('0x40')],{'$or':_[_0xb00b('0x31')](_0x1abcd8[_0xb00b('0x3b')],function(_0x35ad28){var _0x4d2c18={};_0x4d2c18[_0x35ad28]={'$like':'%'+_0x21cdbe['query'][_0xb00b('0x42')]+'%'};return _0x4d2c18;})});}_0x1abcd8=_[_0xb00b('0x43')]({},_0x1abcd8,_0x21cdbe[_0xb00b('0x45')]);return _0x51d9de[_0xb00b('0x57')](_0x1abcd8);}})[_0xb00b('0x1b')](function(_0x38b718){if(_0x38b718){_0x2b7fa9=_0x38b718[_0xb00b('0x4b')];if(!_0x21cdbe['query'][_0xb00b('0x3d')]('nolimit')){_0x1abcd8[_0xb00b('0x3e')]=qs['limit'](_0x21cdbe[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x1abcd8[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x21cdbe[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x51d9de[_0xb00b('0x57')](_0x1abcd8);}})[_0xb00b('0x1b')](function(_0x2268d0){if(_0x2268d0){return _0x2268d0?{'count':_0x2b7fa9,'rows':_0x2268d0}:null;}})[_0xb00b('0x1b')](respondWithResult(_0x2762fb,null))[_0xb00b('0x21')](handleError(_0x2762fb,null));};exports['setTags']=function(_0x456a2f,_0xaad8c4,_0x29742c){if(_0x456a2f[_0xb00b('0x4e')]['id']){delete _0x456a2f['body']['id'];}return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x456a2f['params']['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0xaad8c4,null))['then'](function(_0x22d726){if(_0x22d726){return _0x22d726[_0xb00b('0x59')](_0x456a2f['body'][_0xb00b('0x5a')]||[]);}return null;})[_0xb00b('0x1b')](respondWithResult(_0xaad8c4,null))[_0xb00b('0x21')](handleError(_0xaad8c4,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index efc1436..7eb6d1b 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x214505,_0x3930a7){var _0x442256=function(_0x15cc36){while(--_0x15cc36){_0x214505['push'](_0x214505['shift']());}};_0x442256(++_0x3930a7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x5fc3[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x17b23c,_0x423472){var _0x3af1b4=function(_0x34e307){while(--_0x34e307){_0x17b23c['push'](_0x17b23c['shift']());}};_0x3af1b4(++_0x423472);}(_0x8ef6,0xf2));var _0x68ef=function(_0x499d80,_0x174450){_0x499d80=_0x499d80-0x0;var _0x48c74f=_0x8ef6[_0x499d80];return _0x48c74f;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 201e38d..9d445c3 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 _0x2a1b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xe60533,_0x2f1209){var _0x4377e3=function(_0x1125fc){while(--_0x1125fc){_0xe60533['push'](_0xe60533['shift']());}};_0x4377e3(++_0x2f1209);}(_0x2a1b,0x9a));var _0xb2a1=function(_0x424e22,_0x5a12c9){_0x424e22=_0x424e22-0x0;var _0xc7d454=_0x2a1b[_0x424e22];return _0xc7d454;};'use strict';var _=require(_0xb2a1('0x0'));var util=require(_0xb2a1('0x1'));var moment=require(_0xb2a1('0x2'));var BPromise=require(_0xb2a1('0x3'));var rs=require(_0xb2a1('0x4'));var fs=require('fs');var Redis=require(_0xb2a1('0x5'));var db=require(_0xb2a1('0x6'))['db'];var utils=require(_0xb2a1('0x7'));var logger=require(_0xb2a1('0x8'))(_0xb2a1('0x9'));var config=require(_0xb2a1('0xa'));var jayson=require(_0xb2a1('0xb'));var client=jayson[_0xb2a1('0xc')][_0xb2a1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x32b77d,_0x2d60c1,_0x33e825){return new BPromise(function(_0x391e6e,_0x467650){return client[_0xb2a1('0xe')](_0x32b77d,_0x33e825)[_0xb2a1('0xf')](function(_0x5d0f56){logger[_0xb2a1('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2d60c1,_0xb2a1('0x11'));logger[_0xb2a1('0x12')](_0xb2a1('0x13'),_0x2d60c1,'request\x20sent',JSON[_0xb2a1('0x14')](_0x5d0f56));if(_0x5d0f56[_0xb2a1('0x15')]){if(_0x5d0f56[_0xb2a1('0x15')][_0xb2a1('0x16')]===0x1f4){logger[_0xb2a1('0x15')](_0xb2a1('0x17'),_0x2d60c1,_0x5d0f56['error'][_0xb2a1('0x18')]);return _0x467650(_0x5d0f56['error'][_0xb2a1('0x18')]);}logger[_0xb2a1('0x15')](_0xb2a1('0x17'),_0x2d60c1,_0x5d0f56[_0xb2a1('0x15')][_0xb2a1('0x18')]);return _0x391e6e(_0x5d0f56['error'][_0xb2a1('0x18')]);}else{logger[_0xb2a1('0x10')](_0xb2a1('0x17'),_0x2d60c1,_0xb2a1('0x11'));_0x391e6e(_0x5d0f56[_0xb2a1('0x19')]['message']);}})[_0xb2a1('0x1a')](function(_0x28a9db){logger[_0xb2a1('0x15')](_0xb2a1('0x17'),_0x2d60c1,_0x28a9db);_0x467650(_0x28a9db);});});} \ No newline at end of file +var _0x5a12=['rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b9c43,_0x49b9cd){var _0x3e3c32=function(_0x48b8fe){while(--_0x48b8fe){_0x2b9c43['push'](_0x2b9c43['shift']());}};_0x3e3c32(++_0x49b9cd);}(_0x5a12,0x101));var _0x25a1=function(_0x3af782,_0x4eb7e2){_0x3af782=_0x3af782-0x0;var _0x407343=_0x5a12[_0x3af782];return _0x407343;};'use strict';var _=require(_0x25a1('0x0'));var util=require('util');var moment=require(_0x25a1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25a1('0x2'));var fs=require('fs');var Redis=require(_0x25a1('0x3'));var db=require(_0x25a1('0x4'))['db'];var utils=require(_0x25a1('0x5'));var logger=require(_0x25a1('0x6'))(_0x25a1('0x7'));var config=require(_0x25a1('0x8'));var jayson=require(_0x25a1('0x9'));var client=jayson['client'][_0x25a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37bfe6,_0x48763e,_0x55c792){return new BPromise(function(_0x135d7d,_0xa8c803){return client['request'](_0x37bfe6,_0x55c792)[_0x25a1('0xb')](function(_0x126ff3){logger[_0x25a1('0xc')](_0x25a1('0xd'),_0x48763e,_0x25a1('0xe'));logger[_0x25a1('0xf')](_0x25a1('0x10'),_0x48763e,_0x25a1('0xe'),JSON[_0x25a1('0x11')](_0x126ff3));if(_0x126ff3['error']){if(_0x126ff3[_0x25a1('0x12')][_0x25a1('0x13')]===0x1f4){logger['error'](_0x25a1('0xd'),_0x48763e,_0x126ff3[_0x25a1('0x12')][_0x25a1('0x14')]);return _0xa8c803(_0x126ff3[_0x25a1('0x12')]['message']);}logger[_0x25a1('0x12')](_0x25a1('0xd'),_0x48763e,_0x126ff3[_0x25a1('0x12')][_0x25a1('0x14')]);return _0x135d7d(_0x126ff3['error'][_0x25a1('0x14')]);}else{logger['info'](_0x25a1('0xd'),_0x48763e,_0x25a1('0xe'));_0x135d7d(_0x126ff3['result'][_0x25a1('0x14')]);}})[_0x25a1('0x15')](function(_0x5e3f11){logger[_0x25a1('0x12')](_0x25a1('0xd'),_0x48763e,_0x5e3f11);_0xa8c803(_0x5e3f11);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 575a23c..0c8db22 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 _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x52efaa,_0x53c68a){var _0x525109=function(_0x4efe4d){while(--_0x4efe4d){_0x52efaa['push'](_0x52efaa['shift']());}};_0x525109(++_0x53c68a);}(_0x008c,0x188));var _0xc008=function(_0x6942e0,_0x131e6d){_0x6942e0=_0x6942e0-0x0;var _0xb86490=_0x008c[_0x6942e0];return _0xb86490;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0x5d8084,_0x1947e9){var _0x4c0147=function(_0x20c7f0){while(--_0x20c7f0){_0x5d8084['push'](_0x5d8084['shift']());}};_0x4c0147(++_0x1947e9);}(_0x70e0,0x17b));var _0x070e=function(_0xcbe91d,_0xc1f3c1){_0xcbe91d=_0xcbe91d-0x0;var _0xfb018c=_0x70e0[_0xcbe91d];return _0xfb018c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0xa')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')](_0x070e('0xe'),auth[_0x070e('0xb')](),controller['update']);router['delete'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);module[_0x070e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4fc4b51..f225c5c 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 _0x6f49=['string','variable','customVariable','STRING','BOOLEAN','exports','ENUM'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6f49,0xa6));var _0x96f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f49[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x96f4('0x0')]={'type':{'type':Sequelize[_0x96f4('0x1')](_0x96f4('0x2'),_0x96f4('0x3'),_0x96f4('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x96f4('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x96f4('0x2'),_0x96f4('0x3'),_0x96f4('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x96f4('0x5')]},'nameField':{'type':Sequelize[_0x96f4('0x5')]},'customField':{'type':Sequelize[_0x96f4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x96f4('0x5')]}}; \ No newline at end of file +var _0xa5ca=['string','STRING','sequelize','exports','ENUM','customVariable','keyValue'];(function(_0x533879,_0x184a56){var _0x583f88=function(_0x5dfc82){while(--_0x5dfc82){_0x533879['push'](_0x533879['shift']());}};_0x583f88(++_0x184a56);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xa5ca[_0x2adbeb];return _0x5e18a6;};'use strict';var Sequelize=require(_0xaa5c('0x0'));module[_0xaa5c('0x1')]={'type':{'type':Sequelize[_0xaa5c('0x2')]('string','variable',_0xaa5c('0x3'),_0xaa5c('0x4')),'defaultValue':_0xaa5c('0x5')},'content':{'type':Sequelize[_0xaa5c('0x6')]},'key':{'type':Sequelize[_0xaa5c('0x6')]},'keyType':{'type':Sequelize[_0xaa5c('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xaa5c('0x6')]},'idField':{'type':Sequelize[_0xaa5c('0x6')]},'nameField':{'type':Sequelize[_0xaa5c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 4e41b8f..e466c2e 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 _0x5c67=['util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','Content-Range','update','then','destroy','stack','send','index','map','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x172e0a,_0x15d22a){var _0x4baf16=function(_0xcbd5e5){while(--_0xcbd5e5){_0x172e0a['push'](_0x172e0a['shift']());}};_0x4baf16(++_0x15d22a);}(_0x5c67,0x114));var _0x75c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c67[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x75c6('0x0'));var rimraf=require(_0x75c6('0x1'));var zipdir=require(_0x75c6('0x2'));var jsonpatch=require(_0x75c6('0x3'));var rp=require(_0x75c6('0x4'));var moment=require(_0x75c6('0x5'));var BPromise=require(_0x75c6('0x6'));var Mustache=require(_0x75c6('0x7'));var util=require(_0x75c6('0x8'));var path=require(_0x75c6('0x9'));var sox=require(_0x75c6('0xa'));var csv=require(_0x75c6('0xb'));var ejs=require(_0x75c6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x75c6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x75c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x75c6('0xf'));var Papa=require('papaparse');var Redis=require(_0x75c6('0x10'));var authService=require(_0x75c6('0x11'));var qs=require(_0x75c6('0x12'));var as=require(_0x75c6('0x13'));var hardwareService=require(_0x75c6('0x14'));var logger=require(_0x75c6('0x15'))(_0x75c6('0x16'));var utils=require(_0x75c6('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10013b,_0x5126cb){_0x5126cb=_0x5126cb||0xcc;return function(_0x2f8ab0){if(_0x2f8ab0){return _0x10013b[_0x75c6('0x18')](_0x5126cb);}return _0x10013b[_0x75c6('0x19')](_0x5126cb)[_0x75c6('0x1a')]();};}function respondWithResult(_0x4e5308,_0x425555){_0x425555=_0x425555||0xc8;return function(_0x563758){if(_0x563758){return _0x4e5308[_0x75c6('0x19')](_0x425555)[_0x75c6('0x1b')](_0x563758);}};}function respondWithFilteredResult(_0x1eb66c,_0x1608f6){return function(_0x645a17){if(_0x645a17){var _0x4b8567=_0x645a17[_0x75c6('0x1c')],_0x211e35=_0x1608f6[_0x75c6('0x1d')],_0x106343=_0x1608f6[_0x75c6('0x1d')]+_0x1608f6['limit'],_0x4924fb;if(_0x106343>=_0x4b8567){_0x106343=_0x4b8567;_0x4924fb=0xc8;}else{_0x4924fb=0xce;}_0x1eb66c['status'](_0x4924fb);return _0x1eb66c['set'](_0x75c6('0x1e'),_0x211e35+'-'+_0x106343+'/'+_0x4b8567)['json'](_0x645a17);}return null;};}function patchUpdates(_0x239c90){return function(_0x13490c){try{jsonpatch['apply'](_0x13490c,_0x239c90,!![]);}catch(_0x50784b){return BPromise['reject'](_0x50784b);}return _0x13490c['save']();};}function saveUpdates(_0x59357d,_0x1f42b8){return function(_0x1d6851){if(_0x1d6851){return _0x1d6851[_0x75c6('0x1f')](_0x59357d)[_0x75c6('0x20')](function(_0x562be1){return _0x562be1;});}return null;};}function removeEntity(_0x51fd5b,_0x1767e7){return function(_0x2755e4){if(_0x2755e4){return _0x2755e4[_0x75c6('0x21')]()['then'](function(){_0x51fd5b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x418e93,_0x2aed3e){return function(_0x54cee3){if(!_0x54cee3){_0x418e93['sendStatus'](0x194);}return _0x54cee3;};}function handleError(_0x4c80ae,_0x48223d){_0x48223d=_0x48223d||0x1f4;return function(_0x3bb423){logger['error'](_0x3bb423[_0x75c6('0x22')]);if(_0x3bb423['name']){delete _0x3bb423['name'];}_0x4c80ae[_0x75c6('0x19')](_0x48223d)[_0x75c6('0x23')](_0x3bb423);};}exports[_0x75c6('0x24')]=function(_0x98f5c8,_0x313c47){var _0x7e4da6={},_0x29f7ea={},_0x53d5e3={'count':0x0,'rows':[]};var _0x3dc170=_[_0x75c6('0x25')](db['FreshdeskField']['rawAttributes'],function(_0x511b17){return{'name':_0x511b17['fieldName'],'type':_0x511b17[_0x75c6('0x26')][_0x75c6('0x27')]};});_0x29f7ea[_0x75c6('0x28')]=_[_0x75c6('0x25')](_0x3dc170,_0x75c6('0x29'));_0x29f7ea[_0x75c6('0x2a')]=_[_0x75c6('0x2b')](_0x98f5c8['query']);_0x29f7ea[_0x75c6('0x2c')]=_[_0x75c6('0x2d')](_0x29f7ea[_0x75c6('0x28')],_0x29f7ea[_0x75c6('0x2a')]);_0x7e4da6[_0x75c6('0x2e')]=_[_0x75c6('0x2d')](_0x29f7ea['model'],qs[_0x75c6('0x2f')](_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x2f')]));_0x7e4da6[_0x75c6('0x2e')]=_0x7e4da6[_0x75c6('0x2e')][_0x75c6('0x30')]?_0x7e4da6[_0x75c6('0x2e')]:_0x29f7ea[_0x75c6('0x28')];if(!_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x31')](_0x75c6('0x32'))){_0x7e4da6[_0x75c6('0x33')]=qs['limit'](_0x98f5c8[_0x75c6('0x2a')]['limit']);_0x7e4da6[_0x75c6('0x1d')]=qs[_0x75c6('0x1d')](_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x1d')]);}_0x7e4da6['order']=qs[_0x75c6('0x34')](_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x34')]);_0x7e4da6['where']=qs['filters'](_[_0x75c6('0x35')](_0x98f5c8[_0x75c6('0x2a')],_0x29f7ea[_0x75c6('0x2c')]),_0x3dc170);if(_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x36')]){_0x7e4da6[_0x75c6('0x37')]=_[_0x75c6('0x38')](_0x7e4da6['where'],{'$or':_[_0x75c6('0x25')](_0x3dc170,function(_0x4b4196){if(_0x4b4196[_0x75c6('0x26')]!==_0x75c6('0x39')){var _0x17fd9c={};_0x17fd9c[_0x4b4196[_0x75c6('0x29')]]={'$like':'%'+_0x98f5c8[_0x75c6('0x2a')]['filter']+'%'};return _0x17fd9c;}})});}_0x7e4da6=_[_0x75c6('0x38')]({},_0x7e4da6,_0x98f5c8[_0x75c6('0x3a')]);var _0x13256c={'where':_0x7e4da6[_0x75c6('0x37')]};return db[_0x75c6('0x3b')][_0x75c6('0x1c')](_0x13256c)[_0x75c6('0x20')](function(_0x4e323d){_0x53d5e3['count']=_0x4e323d;if(_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x3c')]){_0x7e4da6[_0x75c6('0x3d')]=[{'all':!![]}];}return db[_0x75c6('0x3b')][_0x75c6('0x3e')](_0x7e4da6);})['then'](function(_0x10a54b){_0x53d5e3[_0x75c6('0x3f')]=_0x10a54b;return _0x53d5e3;})[_0x75c6('0x20')](respondWithFilteredResult(_0x313c47,_0x7e4da6))[_0x75c6('0x40')](handleError(_0x313c47,null));};exports[_0x75c6('0x41')]=function(_0x6fe866,_0x417dd0){var _0x2215ec={'raw':!![],'where':{'id':_0x6fe866[_0x75c6('0x42')]['id']}},_0x3591e8={};_0x3591e8[_0x75c6('0x28')]=_['keys'](db[_0x75c6('0x3b')][_0x75c6('0x43')]);_0x3591e8[_0x75c6('0x2a')]=_[_0x75c6('0x2b')](_0x6fe866[_0x75c6('0x2a')]);_0x3591e8[_0x75c6('0x2c')]=_[_0x75c6('0x2d')](_0x3591e8['model'],_0x3591e8[_0x75c6('0x2a')]);_0x2215ec[_0x75c6('0x2e')]=_[_0x75c6('0x2d')](_0x3591e8['model'],qs[_0x75c6('0x2f')](_0x6fe866[_0x75c6('0x2a')][_0x75c6('0x2f')]));_0x2215ec['attributes']=_0x2215ec['attributes']['length']?_0x2215ec[_0x75c6('0x2e')]:_0x3591e8['model'];if(_0x6fe866[_0x75c6('0x2a')][_0x75c6('0x3c')]){_0x2215ec[_0x75c6('0x3d')]=[{'all':!![]}];}_0x2215ec=_['merge']({},_0x2215ec,_0x6fe866['options']);return db[_0x75c6('0x3b')][_0x75c6('0x44')](_0x2215ec)['then'](handleEntityNotFound(_0x417dd0,null))[_0x75c6('0x20')](respondWithResult(_0x417dd0,null))[_0x75c6('0x40')](handleError(_0x417dd0,null));};exports[_0x75c6('0x45')]=function(_0x3306d0,_0x2d9fff){return db[_0x75c6('0x3b')]['create'](_0x3306d0['body'],{})['then'](respondWithResult(_0x2d9fff,0xc9))[_0x75c6('0x40')](handleError(_0x2d9fff,null));};exports[_0x75c6('0x1f')]=function(_0x5c60fc,_0x1c2570){if(_0x5c60fc['body']['id']){delete _0x5c60fc[_0x75c6('0x46')]['id'];}return db[_0x75c6('0x3b')][_0x75c6('0x44')]({'where':{'id':_0x5c60fc[_0x75c6('0x42')]['id']}})[_0x75c6('0x20')](handleEntityNotFound(_0x1c2570,null))[_0x75c6('0x20')](saveUpdates(_0x5c60fc[_0x75c6('0x46')],null))[_0x75c6('0x20')](respondWithResult(_0x1c2570,null))['catch'](handleError(_0x1c2570,null));};exports[_0x75c6('0x21')]=function(_0x5aa44e,_0xee91f5){return db[_0x75c6('0x3b')][_0x75c6('0x44')]({'where':{'id':_0x5aa44e['params']['id']}})[_0x75c6('0x20')](handleEntityNotFound(_0xee91f5,null))[_0x75c6('0x20')](removeEntity(_0xee91f5,null))['catch'](handleError(_0xee91f5,null));}; \ No newline at end of file +var _0xb67b=['eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','findAll','rows','catch','params','keys','length','include','options','find','create','body','html-pdf'];(function(_0x27ff3a,_0x11ab58){var _0x41ac12=function(_0x16afda){while(--_0x16afda){_0x27ff3a['push'](_0x27ff3a['shift']());}};_0x41ac12(++_0x11ab58);}(_0xb67b,0x91));var _0xbb67=function(_0x57d0dc,_0x387f3e){_0x57d0dc=_0x57d0dc-0x0;var _0x177765=_0xb67b[_0x57d0dc];return _0x177765;};'use strict';var pdf=require(_0xbb67('0x0'));var emlformat=require(_0xbb67('0x1'));var rimraf=require(_0xbb67('0x2'));var zipdir=require(_0xbb67('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb67('0x4'));var moment=require(_0xbb67('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbb67('0x6'));var util=require(_0xbb67('0x7'));var path=require(_0xbb67('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb67('0x9'));var fs=require('fs');var _=require(_0xbb67('0xa'));var squel=require(_0xbb67('0xb'));var crypto=require('crypto');var jsforce=require(_0xbb67('0xc'));var deskjs=require(_0xbb67('0xd'));var toCsv=require(_0xbb67('0xe'));var querystring=require(_0xbb67('0xf'));var Papa=require(_0xbb67('0x10'));var Redis=require(_0xbb67('0x11'));var authService=require(_0xbb67('0x12'));var qs=require(_0xbb67('0x13'));var as=require(_0xbb67('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb67('0x15'))('api');var utils=require(_0xbb67('0x16'));var config=require(_0xbb67('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x304bff,_0x33c861){_0x33c861=_0x33c861||0xcc;return function(_0x5b3fc5){if(_0x5b3fc5){return _0x304bff[_0xbb67('0x18')](_0x33c861);}return _0x304bff['status'](_0x33c861)[_0xbb67('0x19')]();};}function respondWithResult(_0x3cee63,_0x4afffd){_0x4afffd=_0x4afffd||0xc8;return function(_0x42d0d9){if(_0x42d0d9){return _0x3cee63['status'](_0x4afffd)['json'](_0x42d0d9);}};}function respondWithFilteredResult(_0x34183b,_0x2ccea1){return function(_0x1d2c22){if(_0x1d2c22){var _0x4dc70b=_0x1d2c22[_0xbb67('0x1a')],_0x4fddb4=_0x2ccea1[_0xbb67('0x1b')],_0x303dcb=_0x2ccea1[_0xbb67('0x1b')]+_0x2ccea1[_0xbb67('0x1c')],_0x17d8e8;if(_0x303dcb>=_0x4dc70b){_0x303dcb=_0x4dc70b;_0x17d8e8=0xc8;}else{_0x17d8e8=0xce;}_0x34183b[_0xbb67('0x1d')](_0x17d8e8);return _0x34183b[_0xbb67('0x1e')](_0xbb67('0x1f'),_0x4fddb4+'-'+_0x303dcb+'/'+_0x4dc70b)[_0xbb67('0x20')](_0x1d2c22);}return null;};}function patchUpdates(_0x483ef3){return function(_0x50b5a4){try{jsonpatch['apply'](_0x50b5a4,_0x483ef3,!![]);}catch(_0x6736c4){return BPromise[_0xbb67('0x21')](_0x6736c4);}return _0x50b5a4[_0xbb67('0x22')]();};}function saveUpdates(_0x4f89e7,_0x3d7c4a){return function(_0x203a9c){if(_0x203a9c){return _0x203a9c[_0xbb67('0x23')](_0x4f89e7)[_0xbb67('0x24')](function(_0x41c525){return _0x41c525;});}return null;};}function removeEntity(_0x2397d2,_0x59e80e){return function(_0x4e01c1){if(_0x4e01c1){return _0x4e01c1[_0xbb67('0x25')]()[_0xbb67('0x24')](function(){_0x2397d2[_0xbb67('0x1d')](0xcc)[_0xbb67('0x19')]();});}};}function handleEntityNotFound(_0x45d2ed,_0x45bf79){return function(_0x27b72d){if(!_0x27b72d){_0x45d2ed[_0xbb67('0x18')](0x194);}return _0x27b72d;};}function handleError(_0x1abfc1,_0x34a553){_0x34a553=_0x34a553||0x1f4;return function(_0x23ff93){logger[_0xbb67('0x26')](_0x23ff93[_0xbb67('0x27')]);if(_0x23ff93[_0xbb67('0x28')]){delete _0x23ff93['name'];}_0x1abfc1[_0xbb67('0x1d')](_0x34a553)[_0xbb67('0x29')](_0x23ff93);};}exports[_0xbb67('0x2a')]=function(_0x38bd3e,_0x38afe9){var _0x49720b={},_0x4f2734={},_0x307c26={'count':0x0,'rows':[]};var _0x4785da=_['map'](db[_0xbb67('0x2b')][_0xbb67('0x2c')],function(_0x1fdf7b){return{'name':_0x1fdf7b[_0xbb67('0x2d')],'type':_0x1fdf7b[_0xbb67('0x2e')][_0xbb67('0x2f')]};});_0x4f2734[_0xbb67('0x30')]=_[_0xbb67('0x31')](_0x4785da,'name');_0x4f2734[_0xbb67('0x32')]=_['keys'](_0x38bd3e['query']);_0x4f2734['filters']=_[_0xbb67('0x33')](_0x4f2734[_0xbb67('0x30')],_0x4f2734[_0xbb67('0x32')]);_0x49720b[_0xbb67('0x34')]=_['intersection'](_0x4f2734['model'],qs[_0xbb67('0x35')](_0x38bd3e['query'][_0xbb67('0x35')]));_0x49720b[_0xbb67('0x34')]=_0x49720b[_0xbb67('0x34')]['length']?_0x49720b[_0xbb67('0x34')]:_0x4f2734[_0xbb67('0x30')];if(!_0x38bd3e[_0xbb67('0x32')]['hasOwnProperty'](_0xbb67('0x36'))){_0x49720b[_0xbb67('0x1c')]=qs[_0xbb67('0x1c')](_0x38bd3e['query'][_0xbb67('0x1c')]);_0x49720b['offset']=qs[_0xbb67('0x1b')](_0x38bd3e[_0xbb67('0x32')]['offset']);}_0x49720b[_0xbb67('0x37')]=qs[_0xbb67('0x38')](_0x38bd3e[_0xbb67('0x32')][_0xbb67('0x38')]);_0x49720b[_0xbb67('0x39')]=qs['filters'](_[_0xbb67('0x3a')](_0x38bd3e[_0xbb67('0x32')],_0x4f2734[_0xbb67('0x3b')]),_0x4785da);if(_0x38bd3e['query'][_0xbb67('0x3c')]){_0x49720b[_0xbb67('0x39')]=_[_0xbb67('0x3d')](_0x49720b[_0xbb67('0x39')],{'$or':_['map'](_0x4785da,function(_0x52111e){if(_0x52111e[_0xbb67('0x2e')]!=='VIRTUAL'){var _0x30c2ea={};_0x30c2ea[_0x52111e[_0xbb67('0x28')]]={'$like':'%'+_0x38bd3e['query']['filter']+'%'};return _0x30c2ea;}})});}_0x49720b=_[_0xbb67('0x3d')]({},_0x49720b,_0x38bd3e['options']);var _0x1066fc={'where':_0x49720b[_0xbb67('0x39')]};return db[_0xbb67('0x2b')]['count'](_0x1066fc)[_0xbb67('0x24')](function(_0x47a924){_0x307c26[_0xbb67('0x1a')]=_0x47a924;if(_0x38bd3e[_0xbb67('0x32')]['includeAll']){_0x49720b['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xbb67('0x3e')](_0x49720b);})['then'](function(_0x118bf6){_0x307c26[_0xbb67('0x3f')]=_0x118bf6;return _0x307c26;})[_0xbb67('0x24')](respondWithFilteredResult(_0x38afe9,_0x49720b))[_0xbb67('0x40')](handleError(_0x38afe9,null));};exports['show']=function(_0x318a09,_0x1ea57f){var _0x55b6a5={'raw':!![],'where':{'id':_0x318a09[_0xbb67('0x41')]['id']}},_0x33b1e6={};_0x33b1e6[_0xbb67('0x30')]=_[_0xbb67('0x42')](db[_0xbb67('0x2b')]['rawAttributes']);_0x33b1e6[_0xbb67('0x32')]=_[_0xbb67('0x42')](_0x318a09[_0xbb67('0x32')]);_0x33b1e6[_0xbb67('0x3b')]=_['intersection'](_0x33b1e6[_0xbb67('0x30')],_0x33b1e6['query']);_0x55b6a5[_0xbb67('0x34')]=_[_0xbb67('0x33')](_0x33b1e6[_0xbb67('0x30')],qs[_0xbb67('0x35')](_0x318a09['query'][_0xbb67('0x35')]));_0x55b6a5['attributes']=_0x55b6a5[_0xbb67('0x34')][_0xbb67('0x43')]?_0x55b6a5[_0xbb67('0x34')]:_0x33b1e6[_0xbb67('0x30')];if(_0x318a09[_0xbb67('0x32')]['includeAll']){_0x55b6a5[_0xbb67('0x44')]=[{'all':!![]}];}_0x55b6a5=_[_0xbb67('0x3d')]({},_0x55b6a5,_0x318a09[_0xbb67('0x45')]);return db[_0xbb67('0x2b')][_0xbb67('0x46')](_0x55b6a5)[_0xbb67('0x24')](handleEntityNotFound(_0x1ea57f,null))[_0xbb67('0x24')](respondWithResult(_0x1ea57f,null))[_0xbb67('0x40')](handleError(_0x1ea57f,null));};exports[_0xbb67('0x47')]=function(_0x174097,_0xb0943e){return db[_0xbb67('0x2b')][_0xbb67('0x47')](_0x174097[_0xbb67('0x48')],{})[_0xbb67('0x24')](respondWithResult(_0xb0943e,0xc9))[_0xbb67('0x40')](handleError(_0xb0943e,null));};exports[_0xbb67('0x23')]=function(_0x583074,_0x1cf9a3){if(_0x583074['body']['id']){delete _0x583074[_0xbb67('0x48')]['id'];}return db['FreshdeskField'][_0xbb67('0x46')]({'where':{'id':_0x583074[_0xbb67('0x41')]['id']}})['then'](handleEntityNotFound(_0x1cf9a3,null))[_0xbb67('0x24')](saveUpdates(_0x583074[_0xbb67('0x48')],null))['then'](respondWithResult(_0x1cf9a3,null))['catch'](handleError(_0x1cf9a3,null));};exports[_0xbb67('0x25')]=function(_0x5a5a28,_0x3355b2){return db[_0xbb67('0x2b')]['find']({'where':{'id':_0x5a5a28[_0xbb67('0x41')]['id']}})[_0xbb67('0x24')](handleEntityNotFound(_0x3355b2,null))[_0xbb67('0x24')](removeEntity(_0x3355b2,null))['catch'](handleError(_0x3355b2,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index da4329a..9fdabd9 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 _0xd3b7=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','freshdesk_unique_index','idField','FieldId','lodash','util'];(function(_0x574430,_0x5d5152){var _0x4f6fb3=function(_0x2b4fe3){while(--_0x2b4fe3){_0x574430['push'](_0x574430['shift']());}};_0x4f6fb3(++_0x5d5152);}(_0xd3b7,0x1c6));var _0x7d3b=function(_0x32413f,_0x26e699){_0x32413f=_0x32413f-0x0;var _0x58508a=_0xd3b7[_0x32413f];return _0x58508a;};'use strict';var _=require(_0x7d3b('0x0'));var util=require(_0x7d3b('0x1'));var logger=require(_0x7d3b('0x2'))(_0x7d3b('0x3'));var moment=require('moment');var BPromise=require(_0x7d3b('0x4'));var rp=require(_0x7d3b('0x5'));var fs=require('fs');var path=require(_0x7d3b('0x6'));var rimraf=require('rimraf');var config=require(_0x7d3b('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x7d3b('0x8')]=function(_0x237bbd,_0x259d3e){return _0x237bbd['define']('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x7d3b('0x9'),'fields':[_0x7d3b('0xa'),_0x7d3b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2cad=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x2cad,0x1e5));var _0xd2ca=function(_0x1e90a6,_0x3d43b5){_0x1e90a6=_0x1e90a6-0x0;var _0x27c6cd=_0x2cad[_0x1e90a6];return _0x27c6cd;};'use strict';var _=require(_0xd2ca('0x0'));var util=require(_0xd2ca('0x1'));var logger=require(_0xd2ca('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd2ca('0x3'));var rp=require(_0xd2ca('0x4'));var fs=require('fs');var path=require(_0xd2ca('0x5'));var rimraf=require(_0xd2ca('0x6'));var config=require(_0xd2ca('0x7'));var attributes=require(_0xd2ca('0x8'));module[_0xd2ca('0x9')]=function(_0x26a84b,_0x26b2f4){return _0x26a84b['define'](_0xd2ca('0xa'),attributes,{'tableName':_0xd2ca('0xb'),'paranoid':![],'indexes':[{'name':_0xd2ca('0xc'),'fields':[_0xd2ca('0xd'),_0xd2ca('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 2f25283..0132fad 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(_0x516d66,_0x469cf9){var _0x338780=function(_0x124898){while(--_0x124898){_0x516d66['push'](_0x516d66['shift']());}};_0x338780(++_0x469cf9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5f4b06,_0x3e5997){_0x5f4b06=_0x5f4b06-0x0;var _0x55cc05=_0xb10b[_0x5f4b06];return _0x55cc05;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2ff3e6,_0x58d46a){var _0x5ee0e2=function(_0x591afd){while(--_0x591afd){_0x2ff3e6['push'](_0x2ff3e6['shift']());}};_0x5ee0e2(++_0x58d46a);}(_0xb10b,0x12a));var _0xbb10=function(_0x20c809,_0x26b566){_0x20c809=_0x20c809-0x0;var _0x1064a1=_0xb10b[_0x20c809];return _0x1064a1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a405a0a..9b4873e 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 _0xbf89=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','get','/:id/fields','post','addConfiguration','put','update','delete'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xbf89,0x190));var _0x9bf8=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xbf89[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9bf8('0x0'));var timeout=require(_0x9bf8('0x1'));var express=require(_0x9bf8('0x2'));var router=express[_0x9bf8('0x3')]();var auth=require(_0x9bf8('0x4'));var interaction=require(_0x9bf8('0x5'));var config=require(_0x9bf8('0x6'));var controller=require(_0x9bf8('0x7'));router['get']('/',auth[_0x9bf8('0x8')](),controller[_0x9bf8('0x9')]);router['get'](_0x9bf8('0xa'),auth[_0x9bf8('0x8')](),controller['show']);router['get'](_0x9bf8('0xb'),auth[_0x9bf8('0x8')](),controller[_0x9bf8('0xc')]);router[_0x9bf8('0xd')](_0x9bf8('0xe'),auth[_0x9bf8('0x8')](),controller['getFields']);router[_0x9bf8('0xf')]('/',auth[_0x9bf8('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x9bf8('0x10')]);router[_0x9bf8('0x11')](_0x9bf8('0xa'),auth['isAuthenticated'](),controller[_0x9bf8('0x12')]);router[_0x9bf8('0x13')](_0x9bf8('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9bf8('0x14')]=router; \ No newline at end of file +var _0xd340=['./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../config/environment'];(function(_0x2fc5db,_0x2253b1){var _0x1ef11b=function(_0x2846a5){while(--_0x2846a5){_0x2fc5db['push'](_0x2fc5db['shift']());}};_0x1ef11b(++_0x2253b1);}(_0xd340,0xe0));var _0x0d34=function(_0x2a4551,_0x312009){_0x2a4551=_0x2a4551-0x0;var _0x287585=_0xd340[_0x2a4551];return _0x287585;};'use strict';var multer=require(_0x0d34('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d34('0x1'));var router=express['Router']();var auth=require(_0x0d34('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x0d34('0x3'));var controller=require(_0x0d34('0x4'));router[_0x0d34('0x5')]('/',auth['isAuthenticated'](),controller[_0x0d34('0x6')]);router[_0x0d34('0x5')](_0x0d34('0x7'),auth[_0x0d34('0x8')](),controller[_0x0d34('0x9')]);router[_0x0d34('0x5')](_0x0d34('0xa'),auth['isAuthenticated'](),controller[_0x0d34('0xb')]);router[_0x0d34('0x5')]('/:id/fields',auth[_0x0d34('0x8')](),controller[_0x0d34('0xc')]);router[_0x0d34('0xd')]('/',auth[_0x0d34('0x8')](),controller[_0x0d34('0xe')]);router['post'](_0x0d34('0xa'),auth[_0x0d34('0x8')](),controller['addConfiguration']);router[_0x0d34('0xf')](_0x0d34('0x7'),auth['isAuthenticated'](),controller[_0x0d34('0x10')]);router['delete'](_0x0d34('0x7'),auth['isAuthenticated'](),controller[_0x0d34('0x11')]);module[_0x0d34('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index de33ca7..aa9e477 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 _0x1aab=['STRING','remoteUri','sequelize','exports'];(function(_0x47990b,_0xf722d6){var _0x57bb0a=function(_0x26b8d0){while(--_0x26b8d0){_0x47990b['push'](_0x47990b['shift']());}};_0x57bb0a(++_0xf722d6);}(_0x1aab,0x122));var _0xb1aa=function(_0x4ac7f6,_0x3087d7){_0x4ac7f6=_0x4ac7f6-0x0;var _0x2cae4b=_0x1aab[_0x4ac7f6];return _0x2cae4b;};'use strict';var Sequelize=require(_0xb1aa('0x0'));module[_0xb1aa('0x1')]={'name':{'type':Sequelize[_0xb1aa('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb1aa('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xb1aa('0x2')]},'remoteUri':{'type':Sequelize[_0xb1aa('0x2')],'unique':_0xb1aa('0x3')},'serverUrl':{'type':Sequelize[_0xb1aa('0x2')]}}; \ No newline at end of file +var _0x7382=['exports','STRING','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7382,0x111));var _0x2738=function(_0xce6a9d,_0x4b1804){_0xce6a9d=_0xce6a9d-0x0;var _0x344e2=_0x7382[_0xce6a9d];return _0x344e2;};'use strict';var Sequelize=require('sequelize');module[_0x2738('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2738('0x1')],'unique':_0x2738('0x2')},'serverUrl':{'type':Sequelize[_0x2738('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 6105781..9a7df95 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 _0xd55e=['FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','end','sendStatus','stack','name','map','FreshsalesAccount','rawAttributes','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','body','find','getConfigurations','findOne','keys','addConfiguration','AccountId','Descriptions','getDescriptions','channel'];(function(_0x3ae9ea,_0x1f5605){var _0xdcbf71=function(_0x37ee92){while(--_0x37ee92){_0x3ae9ea['push'](_0x3ae9ea['shift']());}};_0xdcbf71(++_0x1f5605);}(_0xd55e,0x158));var _0xed55=function(_0x50d52e,_0x25c3a7){_0x50d52e=_0x50d52e-0x0;var _0x45bf12=_0xd55e[_0x50d52e];return _0x45bf12;};'use strict';var pdf=require(_0xed55('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed55('0x1'));var zipdir=require(_0xed55('0x2'));var jsonpatch=require(_0xed55('0x3'));var rp=require('request-promise');var moment=require(_0xed55('0x4'));var BPromise=require(_0xed55('0x5'));var Mustache=require(_0xed55('0x6'));var util=require(_0xed55('0x7'));var path=require(_0xed55('0x8'));var sox=require(_0xed55('0x9'));var csv=require(_0xed55('0xa'));var ejs=require(_0xed55('0xb'));var fs=require('fs');var _=require(_0xed55('0xc'));var squel=require(_0xed55('0xd'));var crypto=require(_0xed55('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xed55('0xa'));var querystring=require('querystring');var Papa=require(_0xed55('0xf'));var Redis=require(_0xed55('0x10'));var authService=require(_0xed55('0x11'));var qs=require(_0xed55('0x12'));var as=require(_0xed55('0x13'));var hardwareService=require(_0xed55('0x14'));var logger=require(_0xed55('0x15'))('api');var utils=require(_0xed55('0x16'));var config=require(_0xed55('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xed55('0x18'));var jayson=require(_0xed55('0x19'));var client=jayson['client'][_0xed55('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1648b0,_0x378819,_0x2df464){if(_0x2df464){var _0x79aa21=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x79aa21[_0xed55('0x1b')](_0x378819)){return _0x1648b0;}else{throw new db[(_0xed55('0x1c'))][(_0xed55('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1648b0;}}function respondWithRpcPromise(_0x24b9e2,_0x1603f6,_0x2120d4,_0x60ddd1){return new BPromise(function(_0x529921,_0x334405){var _0x5d92b0=_0x60ddd1||client;return _0x5d92b0[_0xed55('0x1e')](_0x24b9e2,_0x2120d4)[_0xed55('0x1f')](function(_0x2de28a){logger[_0xed55('0x20')](_0xed55('0x21'),_0x1603f6,_0xed55('0x22'));logger[_0xed55('0x23')](_0xed55('0x24'),_0x1603f6,_0xed55('0x22'),JSON['stringify'](_0x2de28a));if(_0x2de28a[_0xed55('0x25')]){if(_0x2de28a['error'][_0xed55('0x26')]===0x1f4){logger['error'](_0xed55('0x21'),_0x1603f6,_0x2de28a[_0xed55('0x25')][_0xed55('0x27')]);return _0x334405(_0x2de28a[_0xed55('0x25')][_0xed55('0x27')]);}logger[_0xed55('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0x1603f6,_0x2de28a[_0xed55('0x25')]['message']);return _0x529921(_0x2de28a['error'][_0xed55('0x27')]);}else{logger['info'](_0xed55('0x21'),_0x1603f6,_0xed55('0x22'));_0x529921(_0x2de28a[_0xed55('0x28')][_0xed55('0x27')]);}})['catch'](function(_0x247b8a){logger[_0xed55('0x25')](_0xed55('0x21'),_0x1603f6,_0x247b8a);_0x334405(_0x247b8a);});});}function respondWithStatusCode(_0x12b9fc,_0x3f6e84){_0x3f6e84=_0x3f6e84||0xcc;return function(_0x535a7a){if(_0x535a7a){return _0x12b9fc['sendStatus'](_0x3f6e84);}return _0x12b9fc[_0xed55('0x29')](_0x3f6e84)['end']();};}function respondWithResult(_0xa76d8d,_0x5a4aec){_0x5a4aec=_0x5a4aec||0xc8;return function(_0xb43f69){if(_0xb43f69){return _0xa76d8d[_0xed55('0x29')](_0x5a4aec)[_0xed55('0x2a')](_0xb43f69);}};}function respondWithFilteredResult(_0x194153,_0x1105cb){return function(_0x172f2f){if(_0x172f2f){var _0x5d754a=_0x172f2f[_0xed55('0x2b')],_0xbb94c2=_0x1105cb[_0xed55('0x2c')],_0x501580=_0x1105cb[_0xed55('0x2c')]+_0x1105cb[_0xed55('0x2d')],_0x24a43e;if(_0x501580>=_0x5d754a){_0x501580=_0x5d754a;_0x24a43e=0xc8;}else{_0x24a43e=0xce;}_0x194153['status'](_0x24a43e);return _0x194153['set'](_0xed55('0x2e'),_0xbb94c2+'-'+_0x501580+'/'+_0x5d754a)[_0xed55('0x2a')](_0x172f2f);}return null;};}function patchUpdates(_0x309d75){return function(_0x5be7f6){try{jsonpatch[_0xed55('0x2f')](_0x5be7f6,_0x309d75,!![]);}catch(_0x58868c){return BPromise[_0xed55('0x30')](_0x58868c);}return _0x5be7f6['save']();};}function saveUpdates(_0x5b9417,_0x390819){return function(_0x1c2136){if(_0x1c2136){return _0x1c2136[_0xed55('0x31')](_0x5b9417)[_0xed55('0x1f')](function(_0x34bc5a){return _0x34bc5a;});}return null;};}function removeEntity(_0x1a906d,_0x55eef0){return function(_0x4602e5){if(_0x4602e5){return _0x4602e5[_0xed55('0x32')]()['then'](function(){_0x1a906d['status'](0xcc)[_0xed55('0x33')]();});}};}function handleEntityNotFound(_0x4b92fc,_0x29c08f){return function(_0x5d8023){if(!_0x5d8023){_0x4b92fc[_0xed55('0x34')](0x194);}return _0x5d8023;};}function handleError(_0x68ebf6,_0x1d1606){_0x1d1606=_0x1d1606||0x1f4;return function(_0x49c033){logger['error'](_0x49c033[_0xed55('0x35')]);if(_0x49c033[_0xed55('0x36')]){delete _0x49c033[_0xed55('0x36')];}_0x68ebf6[_0xed55('0x29')](_0x1d1606)['send'](_0x49c033);};}exports['index']=function(_0x924160,_0x108977){var _0x5172a8={},_0x293536={},_0x1f1e3f={'count':0x0,'rows':[]};var _0x22e289=_[_0xed55('0x37')](db[_0xed55('0x38')][_0xed55('0x39')],function(_0x526707){return{'name':_0x526707['fieldName'],'type':_0x526707['type'][_0xed55('0x3a')]};});_0x293536[_0xed55('0x3b')]=_[_0xed55('0x37')](_0x22e289,_0xed55('0x36'));_0x293536[_0xed55('0x3c')]=_['keys'](_0x924160[_0xed55('0x3c')]);_0x293536['filters']=_['intersection'](_0x293536[_0xed55('0x3b')],_0x293536[_0xed55('0x3c')]);_0x5172a8['attributes']=_[_0xed55('0x3d')](_0x293536[_0xed55('0x3b')],qs[_0xed55('0x3e')](_0x924160['query']['fields']));_0x5172a8[_0xed55('0x3f')]=_0x5172a8[_0xed55('0x3f')]['length']?_0x5172a8[_0xed55('0x3f')]:_0x293536[_0xed55('0x3b')];if(!_0x924160[_0xed55('0x3c')][_0xed55('0x40')](_0xed55('0x41'))){_0x5172a8[_0xed55('0x2d')]=qs[_0xed55('0x2d')](_0x924160['query'][_0xed55('0x2d')]);_0x5172a8['offset']=qs[_0xed55('0x2c')](_0x924160[_0xed55('0x3c')][_0xed55('0x2c')]);}_0x5172a8[_0xed55('0x42')]=qs['sort'](_0x924160[_0xed55('0x3c')][_0xed55('0x43')]);_0x5172a8[_0xed55('0x44')]=qs[_0xed55('0x45')](_['pick'](_0x924160['query'],_0x293536[_0xed55('0x45')]),_0x22e289);if(_0x924160[_0xed55('0x3c')]['filter']){_0x5172a8[_0xed55('0x44')]=_[_0xed55('0x46')](_0x5172a8[_0xed55('0x44')],{'$or':_['map'](_0x22e289,function(_0x3e944a){if(_0x3e944a[_0xed55('0x47')]!==_0xed55('0x48')){var _0x1b68a0={};_0x1b68a0[_0x3e944a['name']]={'$like':'%'+_0x924160[_0xed55('0x3c')][_0xed55('0x49')]+'%'};return _0x1b68a0;}})});}_0x5172a8=_['merge']({},_0x5172a8,_0x924160[_0xed55('0x4a')]);var _0x297c09={'where':_0x5172a8[_0xed55('0x44')]};return db[_0xed55('0x38')]['count'](_0x297c09)[_0xed55('0x1f')](function(_0xe13b5c){_0x1f1e3f[_0xed55('0x2b')]=_0xe13b5c;if(_0x924160[_0xed55('0x3c')][_0xed55('0x4b')]){_0x5172a8[_0xed55('0x4c')]=[{'all':!![]}];}return db[_0xed55('0x38')]['findAll'](_0x5172a8);})[_0xed55('0x1f')](function(_0x30c153){_0x1f1e3f[_0xed55('0x4d')]=_0x30c153;return _0x1f1e3f;})[_0xed55('0x1f')](respondWithFilteredResult(_0x108977,_0x5172a8))[_0xed55('0x4e')](handleError(_0x108977,null));};exports[_0xed55('0x4f')]=function(_0x14544e,_0x46ee95){var _0xccf3b7={'raw':![],'where':{'id':_0x14544e[_0xed55('0x50')]['id']}},_0x1c9418={};_0x1c9418['model']=_['keys'](db[_0xed55('0x38')][_0xed55('0x39')]);_0x1c9418[_0xed55('0x3c')]=_['keys'](_0x14544e[_0xed55('0x3c')]);_0x1c9418[_0xed55('0x45')]=_[_0xed55('0x3d')](_0x1c9418[_0xed55('0x3b')],_0x1c9418['query']);_0xccf3b7['attributes']=_[_0xed55('0x3d')](_0x1c9418[_0xed55('0x3b')],qs[_0xed55('0x3e')](_0x14544e[_0xed55('0x3c')][_0xed55('0x3e')]));_0xccf3b7[_0xed55('0x3f')]=_0xccf3b7[_0xed55('0x3f')][_0xed55('0x51')]?_0xccf3b7[_0xed55('0x3f')]:_0x1c9418[_0xed55('0x3b')];if(_0x14544e['query'][_0xed55('0x4b')]){_0xccf3b7[_0xed55('0x4c')]=[{'all':!![]}];}_0xccf3b7=_[_0xed55('0x46')]({},_0xccf3b7,_0x14544e['options']);return db['FreshsalesAccount']['find'](_0xccf3b7)['then'](handleEntityNotFound(_0x46ee95,null))['then'](respondWithResult(_0x46ee95,null))['catch'](handleError(_0x46ee95,null));};exports['create']=function(_0x1c7067,_0x5e7cef){return db[_0xed55('0x38')]['create'](_0x1c7067[_0xed55('0x52')],{})[_0xed55('0x1f')](respondWithResult(_0x5e7cef,0xc9))[_0xed55('0x4e')](handleError(_0x5e7cef,null));};exports[_0xed55('0x31')]=function(_0x2a0ffe,_0x6449f2){if(_0x2a0ffe[_0xed55('0x52')]['id']){delete _0x2a0ffe['body']['id'];}return db[_0xed55('0x38')][_0xed55('0x53')]({'where':{'id':_0x2a0ffe[_0xed55('0x50')]['id']}})[_0xed55('0x1f')](handleEntityNotFound(_0x6449f2,null))[_0xed55('0x1f')](saveUpdates(_0x2a0ffe[_0xed55('0x52')],null))[_0xed55('0x1f')](respondWithResult(_0x6449f2,null))[_0xed55('0x4e')](handleError(_0x6449f2,null));};exports[_0xed55('0x32')]=function(_0x1413f2,_0x4ce42b){return db[_0xed55('0x38')][_0xed55('0x53')]({'where':{'id':_0x1413f2[_0xed55('0x50')]['id']}})[_0xed55('0x1f')](handleEntityNotFound(_0x4ce42b,null))[_0xed55('0x1f')](removeEntity(_0x4ce42b,null))[_0xed55('0x4e')](handleError(_0x4ce42b,null));};exports[_0xed55('0x54')]=function(_0x26119d,_0xd08c83,_0x209af6){var _0x2c645b={};var _0x53a607={};var _0x1da7eb;var _0x40aad5;return db[_0xed55('0x38')][_0xed55('0x55')]({'where':{'id':_0x26119d[_0xed55('0x50')]['id']}})['then'](handleEntityNotFound(_0xd08c83,null))[_0xed55('0x1f')](function(_0x5d921a){if(_0x5d921a){_0x1da7eb=_0x5d921a;_0x53a607[_0xed55('0x3b')]=_[_0xed55('0x56')](db['FreshsalesConfiguration'][_0xed55('0x39')]);_0x53a607['query']=_[_0xed55('0x56')](_0x26119d[_0xed55('0x3c')]);_0x53a607[_0xed55('0x45')]=_[_0xed55('0x3d')](_0x53a607['model'],_0x53a607[_0xed55('0x3c')]);_0x2c645b[_0xed55('0x3f')]=_[_0xed55('0x3d')](_0x53a607[_0xed55('0x3b')],qs['fields'](_0x26119d[_0xed55('0x3c')][_0xed55('0x3e')]));_0x2c645b[_0xed55('0x3f')]=_0x2c645b[_0xed55('0x3f')][_0xed55('0x51')]?_0x2c645b[_0xed55('0x3f')]:_0x53a607['model'];_0x2c645b[_0xed55('0x42')]=qs[_0xed55('0x43')](_0x26119d[_0xed55('0x3c')][_0xed55('0x43')]);_0x2c645b[_0xed55('0x44')]=qs['filters'](_['pick'](_0x26119d[_0xed55('0x3c')],_0x53a607[_0xed55('0x45')]));if(_0x26119d[_0xed55('0x3c')][_0xed55('0x49')]){_0x2c645b[_0xed55('0x44')]=_['merge'](_0x2c645b['where'],{'$or':_[_0xed55('0x37')](_0x2c645b[_0xed55('0x3f')],function(_0x5daa69){var _0x50b840={};_0x50b840[_0x5daa69]={'$like':'%'+_0x26119d['query'][_0xed55('0x49')]+'%'};return _0x50b840;})});}_0x2c645b=_[_0xed55('0x46')]({},_0x2c645b,_0x26119d['options']);return _0x1da7eb[_0xed55('0x54')](_0x2c645b);}})['then'](function(_0xc80755){if(_0xc80755){_0x40aad5=_0xc80755['length'];if(!_0x26119d[_0xed55('0x3c')][_0xed55('0x40')](_0xed55('0x41'))){_0x2c645b[_0xed55('0x2d')]=qs[_0xed55('0x2d')](_0x26119d['query'][_0xed55('0x2d')]);_0x2c645b[_0xed55('0x2c')]=qs[_0xed55('0x2c')](_0x26119d[_0xed55('0x3c')][_0xed55('0x2c')]);}return _0x1da7eb[_0xed55('0x54')](_0x2c645b);}})[_0xed55('0x1f')](function(_0x3faae9){if(_0x3faae9){return _0x3faae9?{'count':_0x40aad5,'rows':_0x3faae9}:null;}})[_0xed55('0x1f')](respondWithResult(_0xd08c83,null))['catch'](handleError(_0xd08c83,null));};exports[_0xed55('0x57')]=function(_0x2db7a4,_0x308c65,_0x443c49){if(_0x2db7a4[_0xed55('0x52')]['id']){delete _0x2db7a4[_0xed55('0x52')]['id'];}return db[_0xed55('0x38')]['findOne']({'where':{'id':_0x2db7a4[_0xed55('0x50')]['id']}})[_0xed55('0x1f')](handleEntityNotFound(_0x308c65,null))[_0xed55('0x1f')](function(_0x51ec0f){if(_0x51ec0f){_0x2db7a4[_0xed55('0x52')][_0xed55('0x58')]=_0x51ec0f['id'];_0x2db7a4['body']['Subjects']=integrations['getSubjects'](_0x2db7a4[_0xed55('0x52')]['channel'],_0x2db7a4[_0xed55('0x52')]['type']);_0x2db7a4['body'][_0xed55('0x59')]=integrations[_0xed55('0x5a')](_0x2db7a4[_0xed55('0x52')][_0xed55('0x5b')],_0x2db7a4[_0xed55('0x52')][_0xed55('0x47')]);return db['FreshsalesConfiguration']['create'](_0x2db7a4[_0xed55('0x52')],{'include':[{'model':db[_0xed55('0x5c')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0xed55('0x59')}]});}return null;})[_0xed55('0x1f')](respondWithResult(_0x308c65,null))[_0xed55('0x4e')](handleError(_0x308c65,null));};exports[_0xed55('0x5d')]=function(_0x283bb2,_0x38aca7,_0x5a21da){var _0x409779='';var _0x5cda44='';return db[_0xed55('0x38')]['findOne']({'where':{'id':_0x283bb2['params']['id']},'attributes':['id',_0xed55('0x5e'),_0xed55('0x5f'),'apiKey']})[_0xed55('0x1f')](handleEntityNotFound(_0x38aca7,null))[_0xed55('0x1f')](function(_0x5b38fd){if(_0x5b38fd){_0x5cda44=_0x5b38fd[_0xed55('0x5e')];_0x409779=_0x5b38fd['remoteUri'];var _0x58c5ec=_0x5b38fd[_0xed55('0x5f')][_0xed55('0x60')](-0x1);if(_0x58c5ec==='/'){_0x409779=_0x409779[_0xed55('0x61')](0x0,_0x409779[_0xed55('0x62')](_0x58c5ec));}return rp({'method':'GET','uri':util[_0xed55('0x63')](_0xed55('0x64'),_0x409779,_0xed55('0x65')),'headers':{'Authorization':_0xed55('0x66')+_0x5b38fd[_0xed55('0x67')]},'json':!![]});}})[_0xed55('0x1f')](function(_0x2bc888){if(_0x2bc888){var _0x1054be=_0x2bc888[_0xed55('0x68')];var _0x3b64e0=![];var _0x1b9ff7=null;for(_0x1b9ff7=0x0;_0x1b9ff7<_0x1054be[_0xed55('0x51')];_0x1b9ff7++){if(_0x1054be[_0x1b9ff7][_0xed55('0x69')]===_0x5cda44){_0x3b64e0=!![];}}if(_0x3b64e0){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xed55('0x1f')](respondWithResult(_0x38aca7,null))[_0xed55('0x4e')](function(_0x501d){var _0x396c47=_0x283bb2[_0xed55('0x3c')][_0xed55('0x1b')]?0x1f4:_0x501d[_0xed55('0x6a')]||0x1f4;logger[_0xed55('0x25')](_0xed55('0x6b'),'getFields',_0x396c47,JSON['stringify'](_0x501d));delete _0x501d[_0xed55('0x36')];if(_0x396c47===0x191){_0x396c47=0x190;}_0x38aca7[_0xed55('0x29')](_0x396c47)[_0xed55('0x6c')](_0x283bb2[_0xed55('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x501d[_0xed55('0x6a')]}:_0x501d);});}; \ No newline at end of file +var _0xd701=['params','intersection','length','find','create','body','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','slice','substring','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','FreshsalesAccount','rawAttributes','type','model','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show'];(function(_0x48ced1,_0x502259){var _0x33edb6=function(_0x4f260c){while(--_0x4f260c){_0x48ced1['push'](_0x48ced1['shift']());}};_0x33edb6(++_0x502259);}(_0xd701,0x86));var _0x1d70=function(_0x4fd540,_0x4de6c7){_0x4fd540=_0x4fd540-0x0;var _0x735bb2=_0xd701[_0x4fd540];return _0x735bb2;};'use strict';var pdf=require(_0x1d70('0x0'));var emlformat=require(_0x1d70('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1d70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d70('0x3'));var moment=require(_0x1d70('0x4'));var BPromise=require(_0x1d70('0x5'));var Mustache=require(_0x1d70('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1d70('0x7'));var csv=require('to-csv');var ejs=require(_0x1d70('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d70('0x9'));var crypto=require('crypto');var jsforce=require(_0x1d70('0xa'));var deskjs=require(_0x1d70('0xb'));var toCsv=require(_0x1d70('0xc'));var querystring=require(_0x1d70('0xd'));var Papa=require(_0x1d70('0xe'));var Redis=require(_0x1d70('0xf'));var authService=require(_0x1d70('0x10'));var qs=require(_0x1d70('0x11'));var as=require(_0x1d70('0x12'));var hardwareService=require(_0x1d70('0x13'));var logger=require(_0x1d70('0x14'))(_0x1d70('0x15'));var utils=require('../../config/utils');var config=require(_0x1d70('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1d70('0x17'));var client=jayson['client'][_0x1d70('0x18')]({'port':0x232a});function checkPasswordPattern(_0x385e8a,_0x420211,_0x98e95c){if(_0x98e95c){var _0x397ef5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x397ef5[_0x1d70('0x19')](_0x420211)){return _0x385e8a;}else{throw new db['Sequelize'][(_0x1d70('0x1a'))](_0x1d70('0x1b'));}}else{return _0x385e8a;}}function respondWithRpcPromise(_0x411ef1,_0x51f73f,_0x35ba16,_0x2042b5){return new BPromise(function(_0x4b99a7,_0x4aeccd){var _0x5328de=_0x2042b5||client;return _0x5328de['request'](_0x411ef1,_0x35ba16)[_0x1d70('0x1c')](function(_0x3c74f7){logger[_0x1d70('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x51f73f,'request\x20sent');logger[_0x1d70('0x1e')](_0x1d70('0x1f'),_0x51f73f,_0x1d70('0x20'),JSON['stringify'](_0x3c74f7));if(_0x3c74f7[_0x1d70('0x21')]){if(_0x3c74f7['error']['code']===0x1f4){logger[_0x1d70('0x21')](_0x1d70('0x22'),_0x51f73f,_0x3c74f7[_0x1d70('0x21')]['message']);return _0x4aeccd(_0x3c74f7[_0x1d70('0x21')]['message']);}logger[_0x1d70('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x51f73f,_0x3c74f7[_0x1d70('0x21')][_0x1d70('0x23')]);return _0x4b99a7(_0x3c74f7[_0x1d70('0x21')]['message']);}else{logger[_0x1d70('0x1d')](_0x1d70('0x22'),_0x51f73f,_0x1d70('0x20'));_0x4b99a7(_0x3c74f7[_0x1d70('0x24')][_0x1d70('0x23')]);}})[_0x1d70('0x25')](function(_0x439073){logger[_0x1d70('0x21')](_0x1d70('0x22'),_0x51f73f,_0x439073);_0x4aeccd(_0x439073);});});}function respondWithStatusCode(_0x3f47e7,_0x5d7c79){_0x5d7c79=_0x5d7c79||0xcc;return function(_0x4a7fbd){if(_0x4a7fbd){return _0x3f47e7[_0x1d70('0x26')](_0x5d7c79);}return _0x3f47e7['status'](_0x5d7c79)['end']();};}function respondWithResult(_0x4c65a9,_0x37c939){_0x37c939=_0x37c939||0xc8;return function(_0xf2e962){if(_0xf2e962){return _0x4c65a9[_0x1d70('0x27')](_0x37c939)[_0x1d70('0x28')](_0xf2e962);}};}function respondWithFilteredResult(_0x2e2194,_0x5b4da3){return function(_0x42367b){if(_0x42367b){var _0x3a0363=_0x42367b[_0x1d70('0x29')],_0x34d333=_0x5b4da3[_0x1d70('0x2a')],_0x370253=_0x5b4da3[_0x1d70('0x2a')]+_0x5b4da3[_0x1d70('0x2b')],_0x1b20cc;if(_0x370253>=_0x3a0363){_0x370253=_0x3a0363;_0x1b20cc=0xc8;}else{_0x1b20cc=0xce;}_0x2e2194['status'](_0x1b20cc);return _0x2e2194[_0x1d70('0x2c')](_0x1d70('0x2d'),_0x34d333+'-'+_0x370253+'/'+_0x3a0363)[_0x1d70('0x28')](_0x42367b);}return null;};}function patchUpdates(_0x379dec){return function(_0x37ed0d){try{jsonpatch[_0x1d70('0x2e')](_0x37ed0d,_0x379dec,!![]);}catch(_0x3cb963){return BPromise[_0x1d70('0x2f')](_0x3cb963);}return _0x37ed0d[_0x1d70('0x30')]();};}function saveUpdates(_0x1b4f59,_0xc2733b){return function(_0x42959b){if(_0x42959b){return _0x42959b[_0x1d70('0x31')](_0x1b4f59)[_0x1d70('0x1c')](function(_0x2eeaeb){return _0x2eeaeb;});}return null;};}function removeEntity(_0x78c185,_0x57bd01){return function(_0x98df8){if(_0x98df8){return _0x98df8[_0x1d70('0x32')]()[_0x1d70('0x1c')](function(){_0x78c185[_0x1d70('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a435a,_0x32d22c){return function(_0x230b70){if(!_0x230b70){_0x1a435a[_0x1d70('0x26')](0x194);}return _0x230b70;};}function handleError(_0x5cfa94,_0x118aae){_0x118aae=_0x118aae||0x1f4;return function(_0x565a74){logger[_0x1d70('0x21')](_0x565a74['stack']);if(_0x565a74[_0x1d70('0x33')]){delete _0x565a74['name'];}_0x5cfa94[_0x1d70('0x27')](_0x118aae)[_0x1d70('0x34')](_0x565a74);};}exports[_0x1d70('0x35')]=function(_0x12fae8,_0x18e128){var _0x10e94c={},_0x5309dc={},_0x247b42={'count':0x0,'rows':[]};var _0x3d1cea=_[_0x1d70('0x36')](db[_0x1d70('0x37')][_0x1d70('0x38')],function(_0xf4f421){return{'name':_0xf4f421['fieldName'],'type':_0xf4f421[_0x1d70('0x39')]['key']};});_0x5309dc[_0x1d70('0x3a')]=_['map'](_0x3d1cea,_0x1d70('0x33'));_0x5309dc[_0x1d70('0x3b')]=_[_0x1d70('0x3c')](_0x12fae8[_0x1d70('0x3b')]);_0x5309dc[_0x1d70('0x3d')]=_['intersection'](_0x5309dc[_0x1d70('0x3a')],_0x5309dc['query']);_0x10e94c['attributes']=_['intersection'](_0x5309dc[_0x1d70('0x3a')],qs[_0x1d70('0x3e')](_0x12fae8[_0x1d70('0x3b')][_0x1d70('0x3e')]));_0x10e94c[_0x1d70('0x3f')]=_0x10e94c[_0x1d70('0x3f')]['length']?_0x10e94c[_0x1d70('0x3f')]:_0x5309dc['model'];if(!_0x12fae8[_0x1d70('0x3b')]['hasOwnProperty'](_0x1d70('0x40'))){_0x10e94c['limit']=qs[_0x1d70('0x2b')](_0x12fae8[_0x1d70('0x3b')]['limit']);_0x10e94c[_0x1d70('0x2a')]=qs['offset'](_0x12fae8['query'][_0x1d70('0x2a')]);}_0x10e94c[_0x1d70('0x41')]=qs['sort'](_0x12fae8['query'][_0x1d70('0x42')]);_0x10e94c[_0x1d70('0x43')]=qs['filters'](_[_0x1d70('0x44')](_0x12fae8[_0x1d70('0x3b')],_0x5309dc[_0x1d70('0x3d')]),_0x3d1cea);if(_0x12fae8[_0x1d70('0x3b')][_0x1d70('0x45')]){_0x10e94c['where']=_['merge'](_0x10e94c[_0x1d70('0x43')],{'$or':_[_0x1d70('0x36')](_0x3d1cea,function(_0xc3b3d3){if(_0xc3b3d3[_0x1d70('0x39')]!==_0x1d70('0x46')){var _0x48eee9={};_0x48eee9[_0xc3b3d3[_0x1d70('0x33')]]={'$like':'%'+_0x12fae8[_0x1d70('0x3b')][_0x1d70('0x45')]+'%'};return _0x48eee9;}})});}_0x10e94c=_[_0x1d70('0x47')]({},_0x10e94c,_0x12fae8[_0x1d70('0x48')]);var _0x9db34f={'where':_0x10e94c['where']};return db[_0x1d70('0x37')][_0x1d70('0x29')](_0x9db34f)[_0x1d70('0x1c')](function(_0x584c4e){_0x247b42[_0x1d70('0x29')]=_0x584c4e;if(_0x12fae8[_0x1d70('0x3b')][_0x1d70('0x49')]){_0x10e94c['include']=[{'all':!![]}];}return db[_0x1d70('0x37')]['findAll'](_0x10e94c);})[_0x1d70('0x1c')](function(_0x5918c8){_0x247b42[_0x1d70('0x4a')]=_0x5918c8;return _0x247b42;})['then'](respondWithFilteredResult(_0x18e128,_0x10e94c))[_0x1d70('0x25')](handleError(_0x18e128,null));};exports[_0x1d70('0x4b')]=function(_0x37fca7,_0x465620){var _0x5ca88b={'raw':![],'where':{'id':_0x37fca7[_0x1d70('0x4c')]['id']}},_0x14c163={};_0x14c163[_0x1d70('0x3a')]=_[_0x1d70('0x3c')](db[_0x1d70('0x37')][_0x1d70('0x38')]);_0x14c163[_0x1d70('0x3b')]=_[_0x1d70('0x3c')](_0x37fca7['query']);_0x14c163[_0x1d70('0x3d')]=_[_0x1d70('0x4d')](_0x14c163[_0x1d70('0x3a')],_0x14c163[_0x1d70('0x3b')]);_0x5ca88b['attributes']=_[_0x1d70('0x4d')](_0x14c163[_0x1d70('0x3a')],qs[_0x1d70('0x3e')](_0x37fca7[_0x1d70('0x3b')][_0x1d70('0x3e')]));_0x5ca88b[_0x1d70('0x3f')]=_0x5ca88b[_0x1d70('0x3f')][_0x1d70('0x4e')]?_0x5ca88b[_0x1d70('0x3f')]:_0x14c163['model'];if(_0x37fca7[_0x1d70('0x3b')][_0x1d70('0x49')]){_0x5ca88b['include']=[{'all':!![]}];}_0x5ca88b=_[_0x1d70('0x47')]({},_0x5ca88b,_0x37fca7['options']);return db[_0x1d70('0x37')][_0x1d70('0x4f')](_0x5ca88b)[_0x1d70('0x1c')](handleEntityNotFound(_0x465620,null))['then'](respondWithResult(_0x465620,null))[_0x1d70('0x25')](handleError(_0x465620,null));};exports[_0x1d70('0x50')]=function(_0x38b49c,_0x286ac6){return db[_0x1d70('0x37')]['create'](_0x38b49c['body'],{})[_0x1d70('0x1c')](respondWithResult(_0x286ac6,0xc9))[_0x1d70('0x25')](handleError(_0x286ac6,null));};exports[_0x1d70('0x31')]=function(_0x31c05c,_0x9b17fa){if(_0x31c05c[_0x1d70('0x51')]['id']){delete _0x31c05c[_0x1d70('0x51')]['id'];}return db['FreshsalesAccount'][_0x1d70('0x4f')]({'where':{'id':_0x31c05c['params']['id']}})[_0x1d70('0x1c')](handleEntityNotFound(_0x9b17fa,null))[_0x1d70('0x1c')](saveUpdates(_0x31c05c[_0x1d70('0x51')],null))[_0x1d70('0x1c')](respondWithResult(_0x9b17fa,null))[_0x1d70('0x25')](handleError(_0x9b17fa,null));};exports['destroy']=function(_0x3bb7ce,_0x37abbb){return db[_0x1d70('0x37')][_0x1d70('0x4f')]({'where':{'id':_0x3bb7ce[_0x1d70('0x4c')]['id']}})[_0x1d70('0x1c')](handleEntityNotFound(_0x37abbb,null))[_0x1d70('0x1c')](removeEntity(_0x37abbb,null))[_0x1d70('0x25')](handleError(_0x37abbb,null));};exports[_0x1d70('0x52')]=function(_0x21a7e9,_0x5ef66c,_0x4a15b8){var _0x4a4d04={};var _0x5344f4={};var _0x26b11c;var _0x2b0259;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x21a7e9['params']['id']}})['then'](handleEntityNotFound(_0x5ef66c,null))['then'](function(_0x414bb6){if(_0x414bb6){_0x26b11c=_0x414bb6;_0x5344f4[_0x1d70('0x3a')]=_[_0x1d70('0x3c')](db['FreshsalesConfiguration'][_0x1d70('0x38')]);_0x5344f4['query']=_[_0x1d70('0x3c')](_0x21a7e9[_0x1d70('0x3b')]);_0x5344f4[_0x1d70('0x3d')]=_[_0x1d70('0x4d')](_0x5344f4[_0x1d70('0x3a')],_0x5344f4[_0x1d70('0x3b')]);_0x4a4d04[_0x1d70('0x3f')]=_[_0x1d70('0x4d')](_0x5344f4[_0x1d70('0x3a')],qs[_0x1d70('0x3e')](_0x21a7e9[_0x1d70('0x3b')][_0x1d70('0x3e')]));_0x4a4d04[_0x1d70('0x3f')]=_0x4a4d04[_0x1d70('0x3f')][_0x1d70('0x4e')]?_0x4a4d04[_0x1d70('0x3f')]:_0x5344f4['model'];_0x4a4d04['order']=qs[_0x1d70('0x42')](_0x21a7e9[_0x1d70('0x3b')][_0x1d70('0x42')]);_0x4a4d04['where']=qs[_0x1d70('0x3d')](_[_0x1d70('0x44')](_0x21a7e9[_0x1d70('0x3b')],_0x5344f4[_0x1d70('0x3d')]));if(_0x21a7e9[_0x1d70('0x3b')][_0x1d70('0x45')]){_0x4a4d04[_0x1d70('0x43')]=_['merge'](_0x4a4d04[_0x1d70('0x43')],{'$or':_['map'](_0x4a4d04[_0x1d70('0x3f')],function(_0x6b4a89){var _0x33d994={};_0x33d994[_0x6b4a89]={'$like':'%'+_0x21a7e9['query']['filter']+'%'};return _0x33d994;})});}_0x4a4d04=_[_0x1d70('0x47')]({},_0x4a4d04,_0x21a7e9[_0x1d70('0x48')]);return _0x26b11c[_0x1d70('0x52')](_0x4a4d04);}})[_0x1d70('0x1c')](function(_0xfb75b2){if(_0xfb75b2){_0x2b0259=_0xfb75b2[_0x1d70('0x4e')];if(!_0x21a7e9[_0x1d70('0x3b')]['hasOwnProperty']('nolimit')){_0x4a4d04[_0x1d70('0x2b')]=qs['limit'](_0x21a7e9['query'][_0x1d70('0x2b')]);_0x4a4d04[_0x1d70('0x2a')]=qs[_0x1d70('0x2a')](_0x21a7e9[_0x1d70('0x3b')][_0x1d70('0x2a')]);}return _0x26b11c[_0x1d70('0x52')](_0x4a4d04);}})['then'](function(_0x1b1171){if(_0x1b1171){return _0x1b1171?{'count':_0x2b0259,'rows':_0x1b1171}:null;}})['then'](respondWithResult(_0x5ef66c,null))[_0x1d70('0x25')](handleError(_0x5ef66c,null));};exports[_0x1d70('0x53')]=function(_0x3f104c,_0xce57a2,_0x2567f8){if(_0x3f104c['body']['id']){delete _0x3f104c[_0x1d70('0x51')]['id'];}return db[_0x1d70('0x37')][_0x1d70('0x54')]({'where':{'id':_0x3f104c[_0x1d70('0x4c')]['id']}})[_0x1d70('0x1c')](handleEntityNotFound(_0xce57a2,null))[_0x1d70('0x1c')](function(_0x42ceb3){if(_0x42ceb3){_0x3f104c[_0x1d70('0x51')]['AccountId']=_0x42ceb3['id'];_0x3f104c['body'][_0x1d70('0x55')]=integrations[_0x1d70('0x56')](_0x3f104c[_0x1d70('0x51')][_0x1d70('0x57')],_0x3f104c[_0x1d70('0x51')]['type']);_0x3f104c[_0x1d70('0x51')][_0x1d70('0x58')]=integrations[_0x1d70('0x59')](_0x3f104c[_0x1d70('0x51')]['channel'],_0x3f104c['body'][_0x1d70('0x39')]);return db[_0x1d70('0x5a')][_0x1d70('0x50')](_0x3f104c['body'],{'include':[{'model':db[_0x1d70('0x5b')],'as':'Subjects'},{'model':db[_0x1d70('0x5b')],'as':_0x1d70('0x58')}]});}return null;})['then'](respondWithResult(_0xce57a2,null))[_0x1d70('0x25')](handleError(_0xce57a2,null));};exports[_0x1d70('0x5c')]=function(_0x558946,_0x139e7a,_0x311ceb){var _0x18b777='';var _0xdd0b86='';return db[_0x1d70('0x37')][_0x1d70('0x54')]({'where':{'id':_0x558946[_0x1d70('0x4c')]['id']},'attributes':['id',_0x1d70('0x5d'),_0x1d70('0x5e'),'apiKey']})[_0x1d70('0x1c')](handleEntityNotFound(_0x139e7a,null))[_0x1d70('0x1c')](function(_0x232a41){if(_0x232a41){_0xdd0b86=_0x232a41[_0x1d70('0x5d')];_0x18b777=_0x232a41[_0x1d70('0x5e')];var _0xc6f7f7=_0x232a41[_0x1d70('0x5e')][_0x1d70('0x5f')](-0x1);if(_0xc6f7f7==='/'){_0x18b777=_0x18b777[_0x1d70('0x60')](0x0,_0x18b777['lastIndexOf'](_0xc6f7f7));}return rp({'method':'GET','uri':util['format'](_0x1d70('0x61'),_0x18b777,_0x1d70('0x62')),'headers':{'Authorization':_0x1d70('0x63')+_0x232a41['apiKey']},'json':!![]});}})[_0x1d70('0x1c')](function(_0x2b157e){if(_0x2b157e){var _0x3f1efc=_0x2b157e[_0x1d70('0x64')];var _0x36597d=![];var _0x148495=null;for(_0x148495=0x0;_0x148495<_0x3f1efc['length'];_0x148495++){if(_0x3f1efc[_0x148495][_0x1d70('0x65')]===_0xdd0b86){_0x36597d=!![];}}if(_0x36597d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1d70('0x66')});}}})[_0x1d70('0x1c')](respondWithResult(_0x139e7a,null))[_0x1d70('0x25')](function(_0x39ad93){var _0x4f0362=_0x558946[_0x1d70('0x3b')][_0x1d70('0x19')]?0x1f4:_0x39ad93['statusCode']||0x1f4;logger[_0x1d70('0x21')](_0x1d70('0x67'),_0x1d70('0x5c'),_0x4f0362,JSON['stringify'](_0x39ad93));delete _0x39ad93['name'];if(_0x4f0362===0x191){_0x4f0362=0x190;}_0x139e7a['status'](_0x4f0362)[_0x1d70('0x34')](_0x558946[_0x1d70('0x3b')][_0x1d70('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x39ad93[_0x1d70('0x68')]}:_0x39ad93);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index bd51708..817a9ed 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 _0xf021=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x20bf3e,_0x11e986){var _0x306e05=function(_0x52f762){while(--_0x52f762){_0x20bf3e['push'](_0x20bf3e['shift']());}};_0x306e05(++_0x11e986);}(_0xf021,0x18f));var _0x1f02=function(_0x1188a8,_0xc1498d){_0x1188a8=_0x1188a8-0x0;var _0x50c1c1=_0xf021[_0x1188a8];return _0x50c1c1;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var logger=require(_0x1f02('0x2'))(_0x1f02('0x3'));var moment=require(_0x1f02('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f02('0x6'));var config=require(_0x1f02('0x7'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1f02('0x8')]=function(_0x56b275,_0x383d0b){return _0x56b275[_0x1f02('0x9')](_0x1f02('0xa'),attributes,{'tableName':_0x1f02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','int_freshsales_accounts'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x885a,0x180));var _0xa885=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x885a[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));var integrations=require(_0xa885('0x9'));module['exports']=function(_0x7ac6bd,_0x1200c7){return _0x7ac6bd[_0xa885('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xa885('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 530f97f..91c19be 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 _0x082a=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','map','model','include','debug','ShowFreshsalesAccount','find'];(function(_0x5e07a7,_0x1438b3){var _0x22ced5=function(_0x7c975b){while(--_0x7c975b){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x22ced5(++_0x1438b3);}(_0x082a,0x154));var _0xa082=function(_0xbb76c7,_0x2621a2){_0xbb76c7=_0xbb76c7-0x0;var _0x369de3=_0x082a[_0xbb76c7];return _0x369de3;};'use strict';var _=require('lodash');var util=require(_0xa082('0x0'));var moment=require(_0xa082('0x1'));var BPromise=require(_0xa082('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa082('0x3'));var db=require(_0xa082('0x4'))['db'];var utils=require(_0xa082('0x5'));var logger=require(_0xa082('0x6'))(_0xa082('0x7'));var config=require('../../config/environment');var jayson=require(_0xa082('0x8'));var client=jayson['client'][_0xa082('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41030c,_0x5ae561,_0x31c98d){return new BPromise(function(_0x193550,_0x382b03){return client['request'](_0x41030c,_0x31c98d)[_0xa082('0xa')](function(_0xafc3c1){logger[_0xa082('0xb')](_0xa082('0xc'),_0x5ae561,_0xa082('0xd'));logger['debug'](_0xa082('0xe'),_0x5ae561,_0xa082('0xd'),JSON[_0xa082('0xf')](_0xafc3c1));if(_0xafc3c1['error']){if(_0xafc3c1['error'][_0xa082('0x10')]===0x1f4){logger[_0xa082('0x11')](_0xa082('0xc'),_0x5ae561,_0xafc3c1[_0xa082('0x11')]['message']);return _0x382b03(_0xafc3c1[_0xa082('0x11')][_0xa082('0x12')]);}logger[_0xa082('0x11')](_0xa082('0xc'),_0x5ae561,_0xafc3c1[_0xa082('0x11')][_0xa082('0x12')]);return _0x193550(_0xafc3c1['error'][_0xa082('0x12')]);}else{logger[_0xa082('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x5ae561,_0xa082('0xd'));_0x193550(_0xafc3c1[_0xa082('0x13')][_0xa082('0x12')]);}})[_0xa082('0x14')](function(_0x507d9c){logger['error'](_0xa082('0xc'),_0x5ae561,_0x507d9c);_0x382b03(_0x507d9c);});});}exports[_0xa082('0x15')]=function(_0x507043){var _0x3c32cc=this;return new Promise(function(_0x536ffa,_0xeaa1ce){return db[_0xa082('0x16')][_0xa082('0x17')]({'raw':_0x507043[_0xa082('0x18')]?_0x507043['options'][_0xa082('0x19')]===undefined?!![]:![]:!![],'where':_0x507043[_0xa082('0x18')]?_0x507043['options'][_0xa082('0x1a')]||null:null,'attributes':_0x507043[_0xa082('0x18')]?_0x507043[_0xa082('0x18')][_0xa082('0x1b')]||null:null,'limit':_0x507043['options']?_0x507043[_0xa082('0x18')]['limit']||null:null,'include':_0x507043[_0xa082('0x18')]?_0x507043[_0xa082('0x18')]['include']?_[_0xa082('0x1c')](_0x507043[_0xa082('0x18')]['include'],function(_0x505d27){return{'model':db[_0x505d27[_0xa082('0x1d')]],'as':_0x505d27['as'],'attributes':_0x505d27[_0xa082('0x1b')],'include':_0x505d27[_0xa082('0x1e')]?_[_0xa082('0x1c')](_0x505d27[_0xa082('0x1e')],function(_0x11d847){return{'model':db[_0x11d847[_0xa082('0x1d')]],'as':_0x11d847['as'],'attributes':_0x11d847[_0xa082('0x1b')],'include':_0x11d847[_0xa082('0x1e')]?_[_0xa082('0x1c')](_0x11d847[_0xa082('0x1e')],function(_0x3ae84a){return{'model':db[_0x3ae84a[_0xa082('0x1d')]],'as':_0x3ae84a['as'],'attributes':_0x3ae84a[_0xa082('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa082('0xa')](function(_0x3e604e){logger[_0xa082('0xb')](_0xa082('0x15'),_0x507043);logger[_0xa082('0x1f')](_0xa082('0x15'),_0x507043,JSON[_0xa082('0xf')](_0x3e604e));_0x536ffa(_0x3e604e);})[_0xa082('0x14')](function(_0x208120){logger[_0xa082('0x11')](_0xa082('0x15'),_0x208120[_0xa082('0x12')],_0x507043);_0xeaa1ce(_0x3c32cc['error'](0x1f4,_0x208120[_0xa082('0x12')]));});});};exports[_0xa082('0x20')]=function(_0x8f2543){var _0x329bb2=this;return new Promise(function(_0x220905,_0x5e41a0){return db[_0xa082('0x16')][_0xa082('0x21')]({'raw':_0x8f2543['options']?_0x8f2543['options']['raw']===undefined?!![]:![]:!![],'where':_0x8f2543[_0xa082('0x18')]?_0x8f2543[_0xa082('0x18')][_0xa082('0x1a')]||null:null,'attributes':_0x8f2543[_0xa082('0x18')]?_0x8f2543[_0xa082('0x18')][_0xa082('0x1b')]||null:null,'include':_0x8f2543[_0xa082('0x18')]?_0x8f2543[_0xa082('0x18')][_0xa082('0x1e')]?_[_0xa082('0x1c')](_0x8f2543[_0xa082('0x18')][_0xa082('0x1e')],function(_0x15fa68){return{'model':db[_0x15fa68['model']],'as':_0x15fa68['as'],'attributes':_0x15fa68['attributes'],'include':_0x15fa68['include']?_[_0xa082('0x1c')](_0x15fa68[_0xa082('0x1e')],function(_0x411757){return{'model':db[_0x411757['model']],'as':_0x411757['as'],'attributes':_0x411757['attributes'],'include':_0x411757[_0xa082('0x1e')]?_[_0xa082('0x1c')](_0x411757[_0xa082('0x1e')],function(_0x4f0824){return{'model':db[_0x4f0824[_0xa082('0x1d')]],'as':_0x4f0824['as'],'attributes':_0x4f0824['attributes']};}):[]};}):[]};}):[]:[]})[_0xa082('0xa')](function(_0x42037c){logger['info'](_0xa082('0x20'),_0x8f2543);logger[_0xa082('0x1f')]('ShowFreshsalesAccount',_0x8f2543,JSON[_0xa082('0xf')](_0x42037c));_0x220905(_0x42037c);})['catch'](function(_0x214bf4){logger[_0xa082('0x11')](_0xa082('0x20'),_0x214bf4[_0xa082('0x12')],_0x8f2543);_0x5e41a0(_0x329bb2[_0xa082('0x11')](0x1f4,_0x214bf4[_0xa082('0x12')]));});});}; \ No newline at end of file +var _0xd26f=['GetFreshsalesAccount','FreshsalesAccount','raw','options','limit','map','model','include','attributes','then','ShowFreshsalesAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x44df8a,_0x58af81){var _0x1a7d01=function(_0x416059){while(--_0x416059){_0x44df8a['push'](_0x44df8a['shift']());}};_0x1a7d01(++_0x58af81);}(_0xd26f,0x113));var _0xfd26=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd26f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});}exports[_0xfd26('0x16')]=function(_0xeb7aeb){var _0x210dd4=this;return new Promise(function(_0x36a275,_0x5b3e8b){return db[_0xfd26('0x17')]['findAll']({'raw':_0xeb7aeb['options']?_0xeb7aeb['options'][_0xfd26('0x18')]===undefined?!![]:![]:!![],'where':_0xeb7aeb[_0xfd26('0x19')]?_0xeb7aeb['options']['where']||null:null,'attributes':_0xeb7aeb[_0xfd26('0x19')]?_0xeb7aeb[_0xfd26('0x19')]['attributes']||null:null,'limit':_0xeb7aeb[_0xfd26('0x19')]?_0xeb7aeb['options'][_0xfd26('0x1a')]||null:null,'include':_0xeb7aeb['options']?_0xeb7aeb[_0xfd26('0x19')]['include']?_[_0xfd26('0x1b')](_0xeb7aeb[_0xfd26('0x19')]['include'],function(_0x5f5d51){return{'model':db[_0x5f5d51[_0xfd26('0x1c')]],'as':_0x5f5d51['as'],'attributes':_0x5f5d51['attributes'],'include':_0x5f5d51[_0xfd26('0x1d')]?_[_0xfd26('0x1b')](_0x5f5d51[_0xfd26('0x1d')],function(_0x20be94){return{'model':db[_0x20be94[_0xfd26('0x1c')]],'as':_0x20be94['as'],'attributes':_0x20be94['attributes'],'include':_0x20be94[_0xfd26('0x1d')]?_['map'](_0x20be94[_0xfd26('0x1d')],function(_0x217a38){return{'model':db[_0x217a38['model']],'as':_0x217a38['as'],'attributes':_0x217a38[_0xfd26('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfd26('0x1f')](function(_0x375c98){logger[_0xfd26('0xc')](_0xfd26('0x16'),_0xeb7aeb);logger[_0xfd26('0xf')](_0xfd26('0x16'),_0xeb7aeb,JSON[_0xfd26('0x11')](_0x375c98));_0x36a275(_0x375c98);})[_0xfd26('0x15')](function(_0x5b3be9){logger['error']('GetFreshsalesAccount',_0x5b3be9['message'],_0xeb7aeb);_0x5b3e8b(_0x210dd4[_0xfd26('0x12')](0x1f4,_0x5b3be9['message']));});});};exports[_0xfd26('0x20')]=function(_0x944d20){var _0x481b18=this;return new Promise(function(_0x5d8dab,_0x2b166c){return db['FreshsalesAccount']['find']({'raw':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')][_0xfd26('0x18')]===undefined?!![]:![]:!![],'where':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')]['where']||null:null,'attributes':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')][_0xfd26('0x1e')]||null:null,'include':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')]['include']?_[_0xfd26('0x1b')](_0x944d20['options'][_0xfd26('0x1d')],function(_0x1f1e63){return{'model':db[_0x1f1e63[_0xfd26('0x1c')]],'as':_0x1f1e63['as'],'attributes':_0x1f1e63['attributes'],'include':_0x1f1e63[_0xfd26('0x1d')]?_[_0xfd26('0x1b')](_0x1f1e63[_0xfd26('0x1d')],function(_0xd76274){return{'model':db[_0xd76274['model']],'as':_0xd76274['as'],'attributes':_0xd76274['attributes'],'include':_0xd76274[_0xfd26('0x1d')]?_['map'](_0xd76274[_0xfd26('0x1d')],function(_0x57a5a4){return{'model':db[_0x57a5a4[_0xfd26('0x1c')]],'as':_0x57a5a4['as'],'attributes':_0x57a5a4[_0xfd26('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfd26('0x1f')](function(_0x5ed9de){logger[_0xfd26('0xc')](_0xfd26('0x20'),_0x944d20);logger[_0xfd26('0xf')](_0xfd26('0x20'),_0x944d20,JSON['stringify'](_0x5ed9de));_0x5d8dab(_0x5ed9de);})[_0xfd26('0x15')](function(_0x50cca5){logger[_0xfd26('0x12')]('ShowFreshsalesAccount',_0x50cca5[_0xfd26('0x13')],_0x944d20);_0x2b166c(_0x481b18[_0xfd26('0x12')](0x1f4,_0x50cca5[_0xfd26('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 24a7366..6203d8a 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 _0x76bc=['Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76bc,0x163));var _0xc76b=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x76bc[_0x59e821];return _0x5333f6;};'use strict';var multer=require(_0xc76b('0x0'));var util=require(_0xc76b('0x1'));var path=require(_0xc76b('0x2'));var timeout=require(_0xc76b('0x3'));var express=require(_0xc76b('0x4'));var router=express[_0xc76b('0x5')]();var auth=require(_0xc76b('0x6'));var interaction=require(_0xc76b('0x7'));var config=require('../../config/environment');var controller=require(_0xc76b('0x8'));router[_0xc76b('0x9')]('/',auth[_0xc76b('0xa')](),controller[_0xc76b('0xb')]);router[_0xc76b('0x9')](_0xc76b('0xc'),auth[_0xc76b('0xa')](),controller[_0xc76b('0xd')]);router['get'](_0xc76b('0xe'),auth[_0xc76b('0xa')](),controller['getSubjects']);router[_0xc76b('0x9')](_0xc76b('0xf'),auth[_0xc76b('0xa')](),controller[_0xc76b('0x10')]);router[_0xc76b('0x9')](_0xc76b('0x11'),auth[_0xc76b('0xa')](),controller['getFields']);router['post']('/',auth[_0xc76b('0xa')](),controller[_0xc76b('0x12')]);router[_0xc76b('0x13')](_0xc76b('0xc'),auth[_0xc76b('0xa')](),controller[_0xc76b('0x14')]);router[_0xc76b('0x15')](_0xc76b('0xc'),auth[_0xc76b('0xa')](),controller[_0xc76b('0x16')]);module[_0xc76b('0x17')]=router; \ No newline at end of file +var _0xb31f=['get','getDescriptions','getFields','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects'];(function(_0x27a773,_0x4d6eb2){var _0x31655e=function(_0x5f4744){while(--_0x5f4744){_0x27a773['push'](_0x27a773['shift']());}};_0x31655e(++_0x4d6eb2);}(_0xb31f,0x16e));var _0xfb31=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xb31f[_0x4099ee];return _0x1b7bfc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb31('0x0'));var timeout=require(_0xfb31('0x1'));var express=require(_0xfb31('0x2'));var router=express[_0xfb31('0x3')]();var auth=require(_0xfb31('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfb31('0x5'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xfb31('0x6')](),controller[_0xfb31('0x7')]);router['get'](_0xfb31('0x8'),auth[_0xfb31('0x6')](),controller[_0xfb31('0x9')]);router['get'](_0xfb31('0xa'),auth[_0xfb31('0x6')](),controller[_0xfb31('0xb')]);router[_0xfb31('0xc')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xfb31('0xd')]);router[_0xfb31('0xc')]('/:id/fields',auth[_0xfb31('0x6')](),controller[_0xfb31('0xe')]);router[_0xfb31('0xf')]('/',auth[_0xfb31('0x6')](),controller['create']);router[_0xfb31('0x10')](_0xfb31('0x8'),auth[_0xfb31('0x6')](),controller[_0xfb31('0x11')]);router[_0xfb31('0x12')](_0xfb31('0x8'),auth[_0xfb31('0x6')](),controller[_0xfb31('0x13')]);module[_0xfb31('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0b63202..10a5de0 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 _0xbf83=['exports','sequelize'];(function(_0x29b3aa,_0x50f51f){var _0x303bbb=function(_0x299dcd){while(--_0x299dcd){_0x29b3aa['push'](_0x29b3aa['shift']());}};_0x303bbb(++_0x50f51f);}(_0xbf83,0x1b9));var _0x3bf8=function(_0x3df652,_0x4258f9){_0x3df652=_0x3df652-0x0;var _0x4f2e74=_0xbf83[_0x3df652];return _0x4f2e74;};'use strict';var Sequelize=require(_0x3bf8('0x0'));module[_0x3bf8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x926e=['exports','sequelize'];(function(_0x55bd12,_0x3ccb52){var _0x1941dd=function(_0x22fa61){while(--_0x22fa61){_0x55bd12['push'](_0x55bd12['shift']());}};_0x1941dd(++_0x3ccb52);}(_0x926e,0x1af));var _0xe926=function(_0x1f7609,_0x50ef5d){_0x1f7609=_0x1f7609-0x0;var _0x31a1c2=_0x926e[_0x1f7609];return _0x31a1c2;};'use strict';var Sequelize=require(_0xe926('0x0'));module[_0xe926('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 5c38b00..bb4db24 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 _0xf720=['moment','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','FreshsalesConfiguration','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','includeAll','find','create','body','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','html-pdf','eml-format','zip-dir','request-promise'];(function(_0xf27369,_0x2e357e){var _0x5437e7=function(_0x2f4836){while(--_0x2f4836){_0xf27369['push'](_0xf27369['shift']());}};_0x5437e7(++_0x2e357e);}(_0xf720,0x17c));var _0x0f72=function(_0x577e8d,_0x5aa635){_0x577e8d=_0x577e8d-0x0;var _0x252ae2=_0xf720[_0x577e8d];return _0x252ae2;};'use strict';var pdf=require(_0x0f72('0x0'));var emlformat=require(_0x0f72('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0f72('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f72('0x3'));var moment=require(_0x0f72('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0f72('0x5'));var util=require(_0x0f72('0x6'));var path=require(_0x0f72('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0f72('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0f72('0x9'));var crypto=require(_0x0f72('0xa'));var jsforce=require(_0x0f72('0xb'));var deskjs=require(_0x0f72('0xc'));var toCsv=require(_0x0f72('0xd'));var querystring=require(_0x0f72('0xe'));var Papa=require(_0x0f72('0xf'));var Redis=require(_0x0f72('0x10'));var authService=require(_0x0f72('0x11'));var qs=require(_0x0f72('0x12'));var as=require(_0x0f72('0x13'));var hardwareService=require(_0x0f72('0x14'));var logger=require(_0x0f72('0x15'))(_0x0f72('0x16'));var utils=require(_0x0f72('0x17'));var config=require(_0x0f72('0x18'));var db=require(_0x0f72('0x19'))['db'];var jayson=require(_0x0f72('0x1a'));var client=jayson[_0x0f72('0x1b')][_0x0f72('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3f54b6,_0x89c4b0,_0x3ea9e6){if(_0x3ea9e6){var _0x37a36f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37a36f[_0x0f72('0x1d')](_0x89c4b0)){return _0x3f54b6;}else{throw new db['Sequelize'][(_0x0f72('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3f54b6;}}function respondWithRpcPromise(_0x19dbda,_0x5d463c,_0x206ead,_0x181c5f){return new BPromise(function(_0x7286e5,_0xb9861d){var _0x1d6acb=_0x181c5f||client;return _0x1d6acb[_0x0f72('0x1f')](_0x19dbda,_0x206ead)['then'](function(_0x451353){logger[_0x0f72('0x20')](_0x0f72('0x21'),_0x5d463c,'request\x20sent');logger[_0x0f72('0x22')](_0x0f72('0x23'),_0x5d463c,'request\x20sent',JSON['stringify'](_0x451353));if(_0x451353[_0x0f72('0x24')]){if(_0x451353[_0x0f72('0x24')][_0x0f72('0x25')]===0x1f4){logger['error'](_0x0f72('0x21'),_0x5d463c,_0x451353[_0x0f72('0x24')][_0x0f72('0x26')]);return _0xb9861d(_0x451353[_0x0f72('0x24')][_0x0f72('0x26')]);}logger[_0x0f72('0x24')](_0x0f72('0x21'),_0x5d463c,_0x451353[_0x0f72('0x24')][_0x0f72('0x26')]);return _0x7286e5(_0x451353[_0x0f72('0x24')]['message']);}else{logger[_0x0f72('0x20')](_0x0f72('0x21'),_0x5d463c,'request\x20sent');_0x7286e5(_0x451353[_0x0f72('0x27')][_0x0f72('0x26')]);}})[_0x0f72('0x28')](function(_0x189b0d){logger[_0x0f72('0x24')](_0x0f72('0x21'),_0x5d463c,_0x189b0d);_0xb9861d(_0x189b0d);});});}function respondWithStatusCode(_0x49bc3a,_0x358c20){_0x358c20=_0x358c20||0xcc;return function(_0x4a5781){if(_0x4a5781){return _0x49bc3a[_0x0f72('0x29')](_0x358c20);}return _0x49bc3a[_0x0f72('0x2a')](_0x358c20)[_0x0f72('0x2b')]();};}function respondWithResult(_0x3c2c8d,_0x178f38){_0x178f38=_0x178f38||0xc8;return function(_0x3d9f63){if(_0x3d9f63){return _0x3c2c8d['status'](_0x178f38)[_0x0f72('0x2c')](_0x3d9f63);}};}function respondWithFilteredResult(_0x22695c,_0x400893){return function(_0x1316a6){if(_0x1316a6){var _0x3608ad=_0x1316a6[_0x0f72('0x2d')],_0x3ae32d=_0x400893['offset'],_0x3f77e2=_0x400893[_0x0f72('0x2e')]+_0x400893[_0x0f72('0x2f')],_0x4077aa;if(_0x3f77e2>=_0x3608ad){_0x3f77e2=_0x3608ad;_0x4077aa=0xc8;}else{_0x4077aa=0xce;}_0x22695c[_0x0f72('0x2a')](_0x4077aa);return _0x22695c[_0x0f72('0x30')](_0x0f72('0x31'),_0x3ae32d+'-'+_0x3f77e2+'/'+_0x3608ad)['json'](_0x1316a6);}return null;};}function patchUpdates(_0x4999f0){return function(_0x411785){try{jsonpatch[_0x0f72('0x32')](_0x411785,_0x4999f0,!![]);}catch(_0x25da2f){return BPromise[_0x0f72('0x33')](_0x25da2f);}return _0x411785['save']();};}function saveUpdates(_0xa14ddb,_0xd91595){return function(_0x12c540){if(_0x12c540){return _0x12c540[_0x0f72('0x34')](_0xa14ddb)[_0x0f72('0x35')](function(_0x519406){return _0x519406;});}return null;};}function removeEntity(_0x1bada0,_0x831c8a){return function(_0x4fc745){if(_0x4fc745){return _0x4fc745[_0x0f72('0x36')]()[_0x0f72('0x35')](function(){_0x1bada0[_0x0f72('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15de0,_0x5f0b13){return function(_0x43adf0){if(!_0x43adf0){_0x15de0[_0x0f72('0x29')](0x194);}return _0x43adf0;};}function handleError(_0x3cc414,_0xab732a){_0xab732a=_0xab732a||0x1f4;return function(_0x5f1ed2){logger[_0x0f72('0x24')](_0x5f1ed2[_0x0f72('0x37')]);if(_0x5f1ed2[_0x0f72('0x38')]){delete _0x5f1ed2['name'];}_0x3cc414[_0x0f72('0x2a')](_0xab732a)[_0x0f72('0x39')](_0x5f1ed2);};}exports[_0x0f72('0x3a')]=function(_0x5b051d,_0x20c69c){var _0xb86059={},_0x3f5cd7={},_0x17c275={'count':0x0,'rows':[]};var _0x3f8029=_['map'](db[_0x0f72('0x3b')][_0x0f72('0x3c')],function(_0x302dc3){return{'name':_0x302dc3['fieldName'],'type':_0x302dc3[_0x0f72('0x3d')][_0x0f72('0x3e')]};});_0x3f5cd7[_0x0f72('0x3f')]=_[_0x0f72('0x40')](_0x3f8029,'name');_0x3f5cd7['query']=_[_0x0f72('0x41')](_0x5b051d[_0x0f72('0x42')]);_0x3f5cd7[_0x0f72('0x43')]=_['intersection'](_0x3f5cd7[_0x0f72('0x3f')],_0x3f5cd7[_0x0f72('0x42')]);_0xb86059[_0x0f72('0x44')]=_[_0x0f72('0x45')](_0x3f5cd7[_0x0f72('0x3f')],qs[_0x0f72('0x46')](_0x5b051d['query'][_0x0f72('0x46')]));_0xb86059[_0x0f72('0x44')]=_0xb86059['attributes'][_0x0f72('0x47')]?_0xb86059[_0x0f72('0x44')]:_0x3f5cd7['model'];if(!_0x5b051d[_0x0f72('0x42')][_0x0f72('0x48')](_0x0f72('0x49'))){_0xb86059['limit']=qs[_0x0f72('0x2f')](_0x5b051d[_0x0f72('0x42')]['limit']);_0xb86059[_0x0f72('0x2e')]=qs[_0x0f72('0x2e')](_0x5b051d[_0x0f72('0x42')]['offset']);}_0xb86059[_0x0f72('0x4a')]=qs[_0x0f72('0x4b')](_0x5b051d['query'][_0x0f72('0x4b')]);_0xb86059[_0x0f72('0x4c')]=qs[_0x0f72('0x43')](_['pick'](_0x5b051d['query'],_0x3f5cd7[_0x0f72('0x43')]),_0x3f8029);if(_0x5b051d['query']['filter']){_0xb86059['where']=_[_0x0f72('0x4d')](_0xb86059[_0x0f72('0x4c')],{'$or':_[_0x0f72('0x40')](_0x3f8029,function(_0x343a56){if(_0x343a56[_0x0f72('0x3d')]!==_0x0f72('0x4e')){var _0x507395={};_0x507395[_0x343a56[_0x0f72('0x38')]]={'$like':'%'+_0x5b051d[_0x0f72('0x42')][_0x0f72('0x4f')]+'%'};return _0x507395;}})});}_0xb86059=_[_0x0f72('0x4d')]({},_0xb86059,_0x5b051d[_0x0f72('0x50')]);var _0x198b5f={'where':_0xb86059[_0x0f72('0x4c')]};return db[_0x0f72('0x3b')][_0x0f72('0x2d')](_0x198b5f)[_0x0f72('0x35')](function(_0x27d1be){_0x17c275['count']=_0x27d1be;if(_0x5b051d[_0x0f72('0x42')]['includeAll']){_0xb86059[_0x0f72('0x51')]=[{'all':!![]}];}return db[_0x0f72('0x3b')][_0x0f72('0x52')](_0xb86059);})[_0x0f72('0x35')](function(_0x169a5a){_0x17c275[_0x0f72('0x53')]=_0x169a5a;return _0x17c275;})[_0x0f72('0x35')](respondWithFilteredResult(_0x20c69c,_0xb86059))[_0x0f72('0x28')](handleError(_0x20c69c,null));};exports[_0x0f72('0x54')]=function(_0x29be22,_0x58f216){var _0x573d8e={'raw':![],'where':{'id':_0x29be22['params']['id']}},_0x5b5620={};_0x5b5620['model']=_[_0x0f72('0x41')](db['FreshsalesConfiguration']['rawAttributes']);_0x5b5620[_0x0f72('0x42')]=_['keys'](_0x29be22['query']);_0x5b5620['filters']=_['intersection'](_0x5b5620[_0x0f72('0x3f')],_0x5b5620[_0x0f72('0x42')]);_0x573d8e[_0x0f72('0x44')]=_[_0x0f72('0x45')](_0x5b5620[_0x0f72('0x3f')],qs['fields'](_0x29be22[_0x0f72('0x42')][_0x0f72('0x46')]));_0x573d8e['attributes']=_0x573d8e['attributes'][_0x0f72('0x47')]?_0x573d8e[_0x0f72('0x44')]:_0x5b5620[_0x0f72('0x3f')];if(_0x29be22[_0x0f72('0x42')][_0x0f72('0x55')]){_0x573d8e['include']=[{'all':!![]}];}_0x573d8e=_[_0x0f72('0x4d')]({},_0x573d8e,_0x29be22['options']);return db[_0x0f72('0x3b')][_0x0f72('0x56')](_0x573d8e)['then'](handleEntityNotFound(_0x58f216,null))[_0x0f72('0x35')](respondWithResult(_0x58f216,null))[_0x0f72('0x28')](handleError(_0x58f216,null));};exports[_0x0f72('0x57')]=function(_0x556c3c,_0x227ae2){return db[_0x0f72('0x3b')]['create'](_0x556c3c['body'],{})['then'](respondWithResult(_0x227ae2,0xc9))[_0x0f72('0x28')](handleError(_0x227ae2,null));};exports[_0x0f72('0x34')]=function(_0x2d26a8,_0x3b12df){if(_0x2d26a8[_0x0f72('0x58')]['id']){delete _0x2d26a8['body']['id'];}return db[_0x0f72('0x3b')]['find']({'where':{'id':_0x2d26a8[_0x0f72('0x59')]['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x3b12df,null))[_0x0f72('0x35')](saveUpdates(_0x2d26a8[_0x0f72('0x58')],null))[_0x0f72('0x35')](respondWithResult(_0x3b12df,null))[_0x0f72('0x28')](handleError(_0x3b12df,null));};exports[_0x0f72('0x36')]=function(_0x5ab526,_0x555c21){return db['FreshsalesConfiguration'][_0x0f72('0x56')]({'where':{'id':_0x5ab526['params']['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x555c21,null))[_0x0f72('0x35')](removeEntity(_0x555c21,null))[_0x0f72('0x28')](handleError(_0x555c21,null));};exports[_0x0f72('0x5a')]=function(_0x380168,_0x5dd058,_0x131413){var _0x2ef177={};var _0x3dd5f1={};var _0x1f4d33;var _0xf60326;return db['FreshsalesConfiguration'][_0x0f72('0x5b')]({'where':{'id':_0x380168[_0x0f72('0x59')]['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x5dd058,null))[_0x0f72('0x35')](function(_0x4492ae){if(_0x4492ae){_0x1f4d33=_0x4492ae;_0x3dd5f1[_0x0f72('0x3f')]=_[_0x0f72('0x41')](db[_0x0f72('0x5c')][_0x0f72('0x3c')]);_0x3dd5f1['query']=_[_0x0f72('0x41')](_0x380168['query']);_0x3dd5f1[_0x0f72('0x43')]=_['intersection'](_0x3dd5f1[_0x0f72('0x3f')],_0x3dd5f1[_0x0f72('0x42')]);_0x2ef177[_0x0f72('0x44')]=_[_0x0f72('0x45')](_0x3dd5f1[_0x0f72('0x3f')],qs[_0x0f72('0x46')](_0x380168['query']['fields']));_0x2ef177[_0x0f72('0x44')]=_0x2ef177[_0x0f72('0x44')][_0x0f72('0x47')]?_0x2ef177[_0x0f72('0x44')]:_0x3dd5f1[_0x0f72('0x3f')];_0x2ef177['order']=qs[_0x0f72('0x4b')](_0x380168[_0x0f72('0x42')][_0x0f72('0x4b')]);_0x2ef177[_0x0f72('0x4c')]=qs[_0x0f72('0x43')](_[_0x0f72('0x5d')](_0x380168[_0x0f72('0x42')],_0x3dd5f1[_0x0f72('0x43')]));if(_0x380168[_0x0f72('0x42')]['filter']){_0x2ef177[_0x0f72('0x4c')]=_[_0x0f72('0x4d')](_0x2ef177[_0x0f72('0x4c')],{'$or':_['map'](_0x2ef177['attributes'],function(_0x33032a){var _0x53be05={};_0x53be05[_0x33032a]={'$like':'%'+_0x380168[_0x0f72('0x42')][_0x0f72('0x4f')]+'%'};return _0x53be05;})});}_0x2ef177=_[_0x0f72('0x4d')]({},_0x2ef177,_0x380168['options']);return _0x1f4d33[_0x0f72('0x5a')](_0x2ef177);}})[_0x0f72('0x35')](function(_0x5af345){if(_0x5af345){_0xf60326=_0x5af345[_0x0f72('0x47')];if(!_0x380168[_0x0f72('0x42')][_0x0f72('0x48')](_0x0f72('0x49'))){_0x2ef177[_0x0f72('0x2f')]=qs[_0x0f72('0x2f')](_0x380168['query']['limit']);_0x2ef177[_0x0f72('0x2e')]=qs['offset'](_0x380168[_0x0f72('0x42')][_0x0f72('0x2e')]);}return _0x1f4d33[_0x0f72('0x5a')](_0x2ef177);}})[_0x0f72('0x35')](function(_0x2176cb){if(_0x2176cb){return _0x2176cb?{'count':_0xf60326,'rows':_0x2176cb}:null;}})[_0x0f72('0x35')](respondWithResult(_0x5dd058,null))[_0x0f72('0x28')](handleError(_0x5dd058,null));};exports[_0x0f72('0x5e')]=function(_0x58ae22,_0x69947a,_0x3f186b){var _0x269c05={};var _0xd23596={};var _0x2212e7;var _0x646c8a;return db[_0x0f72('0x3b')][_0x0f72('0x5b')]({'where':{'id':_0x58ae22['params']['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x69947a,null))['then'](function(_0x4ff713){if(_0x4ff713){_0x2212e7=_0x4ff713;_0xd23596['model']=_[_0x0f72('0x41')](db[_0x0f72('0x5c')][_0x0f72('0x3c')]);_0xd23596[_0x0f72('0x42')]=_['keys'](_0x58ae22[_0x0f72('0x42')]);_0xd23596[_0x0f72('0x43')]=_['intersection'](_0xd23596['model'],_0xd23596[_0x0f72('0x42')]);_0x269c05['attributes']=_[_0x0f72('0x45')](_0xd23596[_0x0f72('0x3f')],qs[_0x0f72('0x46')](_0x58ae22[_0x0f72('0x42')]['fields']));_0x269c05[_0x0f72('0x44')]=_0x269c05[_0x0f72('0x44')]['length']?_0x269c05['attributes']:_0xd23596[_0x0f72('0x3f')];_0x269c05[_0x0f72('0x4a')]=qs[_0x0f72('0x4b')](_0x58ae22['query'][_0x0f72('0x4b')]);_0x269c05[_0x0f72('0x4c')]=qs[_0x0f72('0x43')](_['pick'](_0x58ae22[_0x0f72('0x42')],_0xd23596[_0x0f72('0x43')]));if(_0x58ae22[_0x0f72('0x42')][_0x0f72('0x4f')]){_0x269c05[_0x0f72('0x4c')]=_[_0x0f72('0x4d')](_0x269c05[_0x0f72('0x4c')],{'$or':_['map'](_0x269c05['attributes'],function(_0x4fb8b8){var _0x37fb85={};_0x37fb85[_0x4fb8b8]={'$like':'%'+_0x58ae22[_0x0f72('0x42')][_0x0f72('0x4f')]+'%'};return _0x37fb85;})});}_0x269c05=_[_0x0f72('0x4d')]({},_0x269c05,_0x58ae22[_0x0f72('0x50')]);return _0x2212e7[_0x0f72('0x5e')](_0x269c05);}})['then'](function(_0x56facf){if(_0x56facf){_0x646c8a=_0x56facf[_0x0f72('0x47')];if(!_0x58ae22[_0x0f72('0x42')]['hasOwnProperty']('nolimit')){_0x269c05[_0x0f72('0x2f')]=qs['limit'](_0x58ae22['query'][_0x0f72('0x2f')]);_0x269c05[_0x0f72('0x2e')]=qs['offset'](_0x58ae22[_0x0f72('0x42')][_0x0f72('0x2e')]);}return _0x2212e7['getDescriptions'](_0x269c05);}})[_0x0f72('0x35')](function(_0x4fc6e4){if(_0x4fc6e4){return _0x4fc6e4?{'count':_0x646c8a,'rows':_0x4fc6e4}:null;}})[_0x0f72('0x35')](respondWithResult(_0x69947a,null))[_0x0f72('0x28')](handleError(_0x69947a,null));};exports[_0x0f72('0x5f')]=function(_0x22e2d3,_0x36f406,_0x18ab3b){var _0x21eb32={};var _0x1a22bf={};var _0x368c6e;var _0x3c0ede;return db[_0x0f72('0x3b')][_0x0f72('0x5b')]({'where':{'id':_0x22e2d3[_0x0f72('0x59')]['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x36f406,null))['then'](function(_0x40e1ff){if(_0x40e1ff){_0x368c6e=_0x40e1ff;_0x1a22bf[_0x0f72('0x3f')]=_[_0x0f72('0x41')](db[_0x0f72('0x5c')][_0x0f72('0x3c')]);_0x1a22bf[_0x0f72('0x42')]=_[_0x0f72('0x41')](_0x22e2d3[_0x0f72('0x42')]);_0x1a22bf[_0x0f72('0x43')]=_[_0x0f72('0x45')](_0x1a22bf[_0x0f72('0x3f')],_0x1a22bf['query']);_0x21eb32[_0x0f72('0x44')]=_['intersection'](_0x1a22bf[_0x0f72('0x3f')],qs['fields'](_0x22e2d3[_0x0f72('0x42')][_0x0f72('0x46')]));_0x21eb32['attributes']=_0x21eb32['attributes'][_0x0f72('0x47')]?_0x21eb32['attributes']:_0x1a22bf[_0x0f72('0x3f')];_0x21eb32['order']=qs[_0x0f72('0x4b')](_0x22e2d3[_0x0f72('0x42')]['sort']);_0x21eb32[_0x0f72('0x4c')]=qs[_0x0f72('0x43')](_[_0x0f72('0x5d')](_0x22e2d3['query'],_0x1a22bf[_0x0f72('0x43')]));if(_0x22e2d3['query'][_0x0f72('0x4f')]){_0x21eb32[_0x0f72('0x4c')]=_[_0x0f72('0x4d')](_0x21eb32['where'],{'$or':_[_0x0f72('0x40')](_0x21eb32[_0x0f72('0x44')],function(_0x5b0fe4){var _0x53a8e5={};_0x53a8e5[_0x5b0fe4]={'$like':'%'+_0x22e2d3['query'][_0x0f72('0x4f')]+'%'};return _0x53a8e5;})});}_0x21eb32=_[_0x0f72('0x4d')]({},_0x21eb32,_0x22e2d3[_0x0f72('0x50')]);return _0x368c6e[_0x0f72('0x5f')](_0x21eb32);}})[_0x0f72('0x35')](function(_0x5584fc){if(_0x5584fc){_0x3c0ede=_0x5584fc[_0x0f72('0x47')];if(!_0x22e2d3[_0x0f72('0x42')][_0x0f72('0x48')](_0x0f72('0x49'))){_0x21eb32[_0x0f72('0x2f')]=qs[_0x0f72('0x2f')](_0x22e2d3[_0x0f72('0x42')][_0x0f72('0x2f')]);_0x21eb32['offset']=qs[_0x0f72('0x2e')](_0x22e2d3[_0x0f72('0x42')][_0x0f72('0x2e')]);}return _0x368c6e[_0x0f72('0x5f')](_0x21eb32);}})['then'](function(_0x1050ff){if(_0x1050ff){return _0x1050ff?{'count':_0x3c0ede,'rows':_0x1050ff}:null;}})[_0x0f72('0x35')](respondWithResult(_0x36f406,null))['catch'](handleError(_0x36f406,null));}; \ No newline at end of file +var _0x21ba=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','FreshsalesConfiguration','includeAll','findAll','include','create','body','update','params','find','getSubjects','FreshsalesField','getDescriptions','findOne','nolimit','getFields','options','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','reject','save','then','destroy','end','stack','name','map','rawAttributes','fieldName','type'];(function(_0x492e0b,_0x495310){var _0x5c646a=function(_0x54a0e3){while(--_0x54a0e3){_0x492e0b['push'](_0x492e0b['shift']());}};_0x5c646a(++_0x495310);}(_0x21ba,0x1e3));var _0xa21b=function(_0x1cb526,_0x372383){_0x1cb526=_0x1cb526-0x0;var _0x582cbe=_0x21ba[_0x1cb526];return _0x582cbe;};'use strict';var pdf=require(_0xa21b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa21b('0x1'));var jsonpatch=require(_0xa21b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa21b('0x3'));var Mustache=require(_0xa21b('0x4'));var util=require(_0xa21b('0x5'));var path=require(_0xa21b('0x6'));var sox=require('sox');var csv=require(_0xa21b('0x7'));var ejs=require(_0xa21b('0x8'));var fs=require('fs');var _=require(_0xa21b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa21b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa21b('0x7'));var querystring=require(_0xa21b('0xb'));var Papa=require('papaparse');var Redis=require(_0xa21b('0xc'));var authService=require(_0xa21b('0xd'));var qs=require(_0xa21b('0xe'));var as=require(_0xa21b('0xf'));var hardwareService=require(_0xa21b('0x10'));var logger=require(_0xa21b('0x11'))(_0xa21b('0x12'));var utils=require(_0xa21b('0x13'));var config=require(_0xa21b('0x14'));var db=require(_0xa21b('0x15'))['db'];var jayson=require(_0xa21b('0x16'));var client=jayson[_0xa21b('0x17')][_0xa21b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5f2212,_0x57f0a6,_0x344d7f){if(_0x344d7f){var _0x3a63f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a63f6[_0xa21b('0x19')](_0x57f0a6)){return _0x5f2212;}else{throw new db[(_0xa21b('0x1a'))]['ValidationError'](_0xa21b('0x1b'));}}else{return _0x5f2212;}}function respondWithRpcPromise(_0xb0ec1b,_0x549cac,_0x253ed2,_0x29f2c2){return new BPromise(function(_0x3d4a8c,_0x334963){var _0x623d60=_0x29f2c2||client;return _0x623d60[_0xa21b('0x1c')](_0xb0ec1b,_0x253ed2)['then'](function(_0x837215){logger[_0xa21b('0x1d')](_0xa21b('0x1e'),_0x549cac,_0xa21b('0x1f'));logger['debug'](_0xa21b('0x20'),_0x549cac,_0xa21b('0x1f'),JSON[_0xa21b('0x21')](_0x837215));if(_0x837215[_0xa21b('0x22')]){if(_0x837215['error'][_0xa21b('0x23')]===0x1f4){logger[_0xa21b('0x22')](_0xa21b('0x1e'),_0x549cac,_0x837215['error']['message']);return _0x334963(_0x837215[_0xa21b('0x22')][_0xa21b('0x24')]);}logger[_0xa21b('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x549cac,_0x837215[_0xa21b('0x22')]['message']);return _0x3d4a8c(_0x837215[_0xa21b('0x22')]['message']);}else{logger[_0xa21b('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x549cac,_0xa21b('0x1f'));_0x3d4a8c(_0x837215[_0xa21b('0x25')][_0xa21b('0x24')]);}})[_0xa21b('0x26')](function(_0x37fe32){logger[_0xa21b('0x22')](_0xa21b('0x1e'),_0x549cac,_0x37fe32);_0x334963(_0x37fe32);});});}function respondWithStatusCode(_0x35d2f7,_0x343598){_0x343598=_0x343598||0xcc;return function(_0x553ff9){if(_0x553ff9){return _0x35d2f7[_0xa21b('0x27')](_0x343598);}return _0x35d2f7[_0xa21b('0x28')](_0x343598)['end']();};}function respondWithResult(_0x474aba,_0x272730){_0x272730=_0x272730||0xc8;return function(_0x66c5d8){if(_0x66c5d8){return _0x474aba['status'](_0x272730)[_0xa21b('0x29')](_0x66c5d8);}};}function respondWithFilteredResult(_0x23f997,_0x1bdda2){return function(_0x401004){if(_0x401004){var _0x4b6ed1=_0x401004[_0xa21b('0x2a')],_0x339418=_0x1bdda2['offset'],_0x1f050e=_0x1bdda2['offset']+_0x1bdda2[_0xa21b('0x2b')],_0x451773;if(_0x1f050e>=_0x4b6ed1){_0x1f050e=_0x4b6ed1;_0x451773=0xc8;}else{_0x451773=0xce;}_0x23f997['status'](_0x451773);return _0x23f997[_0xa21b('0x2c')](_0xa21b('0x2d'),_0x339418+'-'+_0x1f050e+'/'+_0x4b6ed1)[_0xa21b('0x29')](_0x401004);}return null;};}function patchUpdates(_0x37afa6){return function(_0x39b00f){try{jsonpatch['apply'](_0x39b00f,_0x37afa6,!![]);}catch(_0x1c69b2){return BPromise[_0xa21b('0x2e')](_0x1c69b2);}return _0x39b00f[_0xa21b('0x2f')]();};}function saveUpdates(_0x3825da,_0x21cc30){return function(_0x10539c){if(_0x10539c){return _0x10539c['update'](_0x3825da)[_0xa21b('0x30')](function(_0x427e97){return _0x427e97;});}return null;};}function removeEntity(_0x422b03,_0x5e3354){return function(_0x50db07){if(_0x50db07){return _0x50db07[_0xa21b('0x31')]()[_0xa21b('0x30')](function(){_0x422b03[_0xa21b('0x28')](0xcc)[_0xa21b('0x32')]();});}};}function handleEntityNotFound(_0x3673e0,_0x16e138){return function(_0x25a06f){if(!_0x25a06f){_0x3673e0[_0xa21b('0x27')](0x194);}return _0x25a06f;};}function handleError(_0x4c0893,_0x5059c2){_0x5059c2=_0x5059c2||0x1f4;return function(_0x17e2b7){logger[_0xa21b('0x22')](_0x17e2b7[_0xa21b('0x33')]);if(_0x17e2b7[_0xa21b('0x34')]){delete _0x17e2b7[_0xa21b('0x34')];}_0x4c0893[_0xa21b('0x28')](_0x5059c2)['send'](_0x17e2b7);};}exports['index']=function(_0x2d716c,_0x50f035){var _0x111098={},_0xc47803={},_0xabeb1d={'count':0x0,'rows':[]};var _0x418a19=_[_0xa21b('0x35')](db['FreshsalesConfiguration'][_0xa21b('0x36')],function(_0x3da218){return{'name':_0x3da218[_0xa21b('0x37')],'type':_0x3da218[_0xa21b('0x38')]['key']};});_0xc47803[_0xa21b('0x39')]=_[_0xa21b('0x35')](_0x418a19,_0xa21b('0x34'));_0xc47803[_0xa21b('0x3a')]=_[_0xa21b('0x3b')](_0x2d716c['query']);_0xc47803[_0xa21b('0x3c')]=_[_0xa21b('0x3d')](_0xc47803[_0xa21b('0x39')],_0xc47803[_0xa21b('0x3a')]);_0x111098[_0xa21b('0x3e')]=_[_0xa21b('0x3d')](_0xc47803[_0xa21b('0x39')],qs[_0xa21b('0x3f')](_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x3f')]));_0x111098['attributes']=_0x111098['attributes'][_0xa21b('0x40')]?_0x111098['attributes']:_0xc47803[_0xa21b('0x39')];if(!_0x2d716c['query'][_0xa21b('0x41')]('nolimit')){_0x111098[_0xa21b('0x2b')]=qs['limit'](_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x2b')]);_0x111098[_0xa21b('0x42')]=qs[_0xa21b('0x42')](_0x2d716c['query'][_0xa21b('0x42')]);}_0x111098[_0xa21b('0x43')]=qs['sort'](_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x44')]);_0x111098[_0xa21b('0x45')]=qs['filters'](_[_0xa21b('0x46')](_0x2d716c[_0xa21b('0x3a')],_0xc47803['filters']),_0x418a19);if(_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x47')]){_0x111098[_0xa21b('0x45')]=_[_0xa21b('0x48')](_0x111098[_0xa21b('0x45')],{'$or':_['map'](_0x418a19,function(_0x5aba63){if(_0x5aba63[_0xa21b('0x38')]!==_0xa21b('0x49')){var _0x1b8b99={};_0x1b8b99[_0x5aba63[_0xa21b('0x34')]]={'$like':'%'+_0x2d716c['query']['filter']+'%'};return _0x1b8b99;}})});}_0x111098=_[_0xa21b('0x48')]({},_0x111098,_0x2d716c['options']);var _0x4cd761={'where':_0x111098[_0xa21b('0x45')]};return db[_0xa21b('0x4a')][_0xa21b('0x2a')](_0x4cd761)[_0xa21b('0x30')](function(_0x514198){_0xabeb1d['count']=_0x514198;if(_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x4b')]){_0x111098['include']=[{'all':!![]}];}return db[_0xa21b('0x4a')][_0xa21b('0x4c')](_0x111098);})['then'](function(_0xf31ac0){_0xabeb1d['rows']=_0xf31ac0;return _0xabeb1d;})[_0xa21b('0x30')](respondWithFilteredResult(_0x50f035,_0x111098))[_0xa21b('0x26')](handleError(_0x50f035,null));};exports['show']=function(_0x50b101,_0x26abec){var _0x277dc5={'raw':![],'where':{'id':_0x50b101['params']['id']}},_0x45a3c4={};_0x45a3c4[_0xa21b('0x39')]=_['keys'](db[_0xa21b('0x4a')][_0xa21b('0x36')]);_0x45a3c4[_0xa21b('0x3a')]=_[_0xa21b('0x3b')](_0x50b101[_0xa21b('0x3a')]);_0x45a3c4[_0xa21b('0x3c')]=_[_0xa21b('0x3d')](_0x45a3c4[_0xa21b('0x39')],_0x45a3c4[_0xa21b('0x3a')]);_0x277dc5[_0xa21b('0x3e')]=_['intersection'](_0x45a3c4['model'],qs['fields'](_0x50b101[_0xa21b('0x3a')]['fields']));_0x277dc5[_0xa21b('0x3e')]=_0x277dc5['attributes']['length']?_0x277dc5['attributes']:_0x45a3c4[_0xa21b('0x39')];if(_0x50b101[_0xa21b('0x3a')][_0xa21b('0x4b')]){_0x277dc5[_0xa21b('0x4d')]=[{'all':!![]}];}_0x277dc5=_[_0xa21b('0x48')]({},_0x277dc5,_0x50b101['options']);return db[_0xa21b('0x4a')]['find'](_0x277dc5)[_0xa21b('0x30')](handleEntityNotFound(_0x26abec,null))[_0xa21b('0x30')](respondWithResult(_0x26abec,null))[_0xa21b('0x26')](handleError(_0x26abec,null));};exports[_0xa21b('0x4e')]=function(_0x57fd53,_0x3ab670){return db['FreshsalesConfiguration'][_0xa21b('0x4e')](_0x57fd53[_0xa21b('0x4f')],{})[_0xa21b('0x30')](respondWithResult(_0x3ab670,0xc9))[_0xa21b('0x26')](handleError(_0x3ab670,null));};exports[_0xa21b('0x50')]=function(_0x1c4c39,_0x1069ba){if(_0x1c4c39[_0xa21b('0x4f')]['id']){delete _0x1c4c39['body']['id'];}return db[_0xa21b('0x4a')]['find']({'where':{'id':_0x1c4c39[_0xa21b('0x51')]['id']}})[_0xa21b('0x30')](handleEntityNotFound(_0x1069ba,null))['then'](saveUpdates(_0x1c4c39['body'],null))[_0xa21b('0x30')](respondWithResult(_0x1069ba,null))[_0xa21b('0x26')](handleError(_0x1069ba,null));};exports[_0xa21b('0x31')]=function(_0x8b1c8e,_0x7fefc8){return db[_0xa21b('0x4a')][_0xa21b('0x52')]({'where':{'id':_0x8b1c8e['params']['id']}})[_0xa21b('0x30')](handleEntityNotFound(_0x7fefc8,null))['then'](removeEntity(_0x7fefc8,null))[_0xa21b('0x26')](handleError(_0x7fefc8,null));};exports[_0xa21b('0x53')]=function(_0x294f6f,_0x2b8c8e,_0x36d788){var _0x593361={};var _0x426a24={};var _0x3fc3e0;var _0x1beb7f;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x294f6f[_0xa21b('0x51')]['id']}})['then'](handleEntityNotFound(_0x2b8c8e,null))['then'](function(_0x9fb3c2){if(_0x9fb3c2){_0x3fc3e0=_0x9fb3c2;_0x426a24[_0xa21b('0x39')]=_[_0xa21b('0x3b')](db[_0xa21b('0x54')]['rawAttributes']);_0x426a24[_0xa21b('0x3a')]=_[_0xa21b('0x3b')](_0x294f6f['query']);_0x426a24[_0xa21b('0x3c')]=_[_0xa21b('0x3d')](_0x426a24[_0xa21b('0x39')],_0x426a24[_0xa21b('0x3a')]);_0x593361[_0xa21b('0x3e')]=_[_0xa21b('0x3d')](_0x426a24[_0xa21b('0x39')],qs['fields'](_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x3f')]));_0x593361[_0xa21b('0x3e')]=_0x593361[_0xa21b('0x3e')]['length']?_0x593361[_0xa21b('0x3e')]:_0x426a24[_0xa21b('0x39')];_0x593361[_0xa21b('0x43')]=qs[_0xa21b('0x44')](_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x44')]);_0x593361[_0xa21b('0x45')]=qs[_0xa21b('0x3c')](_['pick'](_0x294f6f[_0xa21b('0x3a')],_0x426a24[_0xa21b('0x3c')]));if(_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x47')]){_0x593361[_0xa21b('0x45')]=_[_0xa21b('0x48')](_0x593361[_0xa21b('0x45')],{'$or':_[_0xa21b('0x35')](_0x593361['attributes'],function(_0x47b793){var _0x4d686c={};_0x4d686c[_0x47b793]={'$like':'%'+_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x47')]+'%'};return _0x4d686c;})});}_0x593361=_[_0xa21b('0x48')]({},_0x593361,_0x294f6f['options']);return _0x3fc3e0[_0xa21b('0x53')](_0x593361);}})[_0xa21b('0x30')](function(_0x16b7dd){if(_0x16b7dd){_0x1beb7f=_0x16b7dd[_0xa21b('0x40')];if(!_0x294f6f['query']['hasOwnProperty']('nolimit')){_0x593361[_0xa21b('0x2b')]=qs[_0xa21b('0x2b')](_0x294f6f['query'][_0xa21b('0x2b')]);_0x593361[_0xa21b('0x42')]=qs[_0xa21b('0x42')](_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x42')]);}return _0x3fc3e0[_0xa21b('0x53')](_0x593361);}})[_0xa21b('0x30')](function(_0x236572){if(_0x236572){return _0x236572?{'count':_0x1beb7f,'rows':_0x236572}:null;}})[_0xa21b('0x30')](respondWithResult(_0x2b8c8e,null))[_0xa21b('0x26')](handleError(_0x2b8c8e,null));};exports[_0xa21b('0x55')]=function(_0xe04361,_0xc6bae2,_0x5093c4){var _0x247218={};var _0x55bd34={};var _0x92c9f8;var _0x546db8;return db[_0xa21b('0x4a')][_0xa21b('0x56')]({'where':{'id':_0xe04361[_0xa21b('0x51')]['id']}})[_0xa21b('0x30')](handleEntityNotFound(_0xc6bae2,null))[_0xa21b('0x30')](function(_0x4a510e){if(_0x4a510e){_0x92c9f8=_0x4a510e;_0x55bd34['model']=_[_0xa21b('0x3b')](db[_0xa21b('0x54')][_0xa21b('0x36')]);_0x55bd34['query']=_['keys'](_0xe04361[_0xa21b('0x3a')]);_0x55bd34[_0xa21b('0x3c')]=_['intersection'](_0x55bd34[_0xa21b('0x39')],_0x55bd34[_0xa21b('0x3a')]);_0x247218[_0xa21b('0x3e')]=_[_0xa21b('0x3d')](_0x55bd34['model'],qs[_0xa21b('0x3f')](_0xe04361[_0xa21b('0x3a')][_0xa21b('0x3f')]));_0x247218[_0xa21b('0x3e')]=_0x247218['attributes']['length']?_0x247218['attributes']:_0x55bd34[_0xa21b('0x39')];_0x247218[_0xa21b('0x43')]=qs['sort'](_0xe04361[_0xa21b('0x3a')][_0xa21b('0x44')]);_0x247218[_0xa21b('0x45')]=qs[_0xa21b('0x3c')](_[_0xa21b('0x46')](_0xe04361['query'],_0x55bd34['filters']));if(_0xe04361[_0xa21b('0x3a')]['filter']){_0x247218['where']=_['merge'](_0x247218['where'],{'$or':_['map'](_0x247218[_0xa21b('0x3e')],function(_0x3d9f19){var _0x5535d8={};_0x5535d8[_0x3d9f19]={'$like':'%'+_0xe04361[_0xa21b('0x3a')]['filter']+'%'};return _0x5535d8;})});}_0x247218=_['merge']({},_0x247218,_0xe04361['options']);return _0x92c9f8[_0xa21b('0x55')](_0x247218);}})[_0xa21b('0x30')](function(_0x2361a4){if(_0x2361a4){_0x546db8=_0x2361a4['length'];if(!_0xe04361[_0xa21b('0x3a')][_0xa21b('0x41')](_0xa21b('0x57'))){_0x247218[_0xa21b('0x2b')]=qs['limit'](_0xe04361['query'][_0xa21b('0x2b')]);_0x247218[_0xa21b('0x42')]=qs[_0xa21b('0x42')](_0xe04361[_0xa21b('0x3a')][_0xa21b('0x42')]);}return _0x92c9f8[_0xa21b('0x55')](_0x247218);}})[_0xa21b('0x30')](function(_0x1b4e54){if(_0x1b4e54){return _0x1b4e54?{'count':_0x546db8,'rows':_0x1b4e54}:null;}})['then'](respondWithResult(_0xc6bae2,null))[_0xa21b('0x26')](handleError(_0xc6bae2,null));};exports[_0xa21b('0x58')]=function(_0x5297bd,_0x3ecb62,_0x2bbac8){var _0xdd6d74={};var _0x63a667={};var _0x62d6c0;var _0x30700d;return db[_0xa21b('0x4a')][_0xa21b('0x56')]({'where':{'id':_0x5297bd[_0xa21b('0x51')]['id']}})[_0xa21b('0x30')](handleEntityNotFound(_0x3ecb62,null))[_0xa21b('0x30')](function(_0x435182){if(_0x435182){_0x62d6c0=_0x435182;_0x63a667[_0xa21b('0x39')]=_['keys'](db[_0xa21b('0x54')][_0xa21b('0x36')]);_0x63a667['query']=_[_0xa21b('0x3b')](_0x5297bd[_0xa21b('0x3a')]);_0x63a667[_0xa21b('0x3c')]=_[_0xa21b('0x3d')](_0x63a667[_0xa21b('0x39')],_0x63a667[_0xa21b('0x3a')]);_0xdd6d74[_0xa21b('0x3e')]=_['intersection'](_0x63a667[_0xa21b('0x39')],qs[_0xa21b('0x3f')](_0x5297bd[_0xa21b('0x3a')]['fields']));_0xdd6d74[_0xa21b('0x3e')]=_0xdd6d74[_0xa21b('0x3e')]['length']?_0xdd6d74[_0xa21b('0x3e')]:_0x63a667[_0xa21b('0x39')];_0xdd6d74['order']=qs[_0xa21b('0x44')](_0x5297bd[_0xa21b('0x3a')][_0xa21b('0x44')]);_0xdd6d74[_0xa21b('0x45')]=qs[_0xa21b('0x3c')](_[_0xa21b('0x46')](_0x5297bd[_0xa21b('0x3a')],_0x63a667[_0xa21b('0x3c')]));if(_0x5297bd[_0xa21b('0x3a')]['filter']){_0xdd6d74[_0xa21b('0x45')]=_[_0xa21b('0x48')](_0xdd6d74[_0xa21b('0x45')],{'$or':_[_0xa21b('0x35')](_0xdd6d74[_0xa21b('0x3e')],function(_0x4dc876){var _0x6ea227={};_0x6ea227[_0x4dc876]={'$like':'%'+_0x5297bd[_0xa21b('0x3a')]['filter']+'%'};return _0x6ea227;})});}_0xdd6d74=_[_0xa21b('0x48')]({},_0xdd6d74,_0x5297bd[_0xa21b('0x59')]);return _0x62d6c0[_0xa21b('0x58')](_0xdd6d74);}})[_0xa21b('0x30')](function(_0x5e874b){if(_0x5e874b){_0x30700d=_0x5e874b[_0xa21b('0x40')];if(!_0x5297bd[_0xa21b('0x3a')][_0xa21b('0x41')](_0xa21b('0x57'))){_0xdd6d74[_0xa21b('0x2b')]=qs[_0xa21b('0x2b')](_0x5297bd['query'][_0xa21b('0x2b')]);_0xdd6d74[_0xa21b('0x42')]=qs[_0xa21b('0x42')](_0x5297bd[_0xa21b('0x3a')][_0xa21b('0x42')]);}return _0x62d6c0['getFields'](_0xdd6d74);}})['then'](function(_0x13de07){if(_0x13de07){return _0x13de07?{'count':_0x30700d,'rows':_0x13de07}:null;}})[_0xa21b('0x30')](respondWithResult(_0x3ecb62,null))['catch'](handleError(_0x3ecb62,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 195d1c1..55271df 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 _0x5a44=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a44,0x17b));var _0x45a4=function(_0x2ed90a,_0x456af3){_0x2ed90a=_0x2ed90a-0x0;var _0x51f786=_0x5a44[_0x2ed90a];return _0x51f786;};'use strict';var _=require(_0x45a4('0x0'));var util=require('util');var logger=require(_0x45a4('0x1'))(_0x45a4('0x2'));var moment=require(_0x45a4('0x3'));var BPromise=require(_0x45a4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x45a4('0x5'));var rimraf=require(_0x45a4('0x6'));var config=require(_0x45a4('0x7'));var attributes=require(_0x45a4('0x8'));module[_0x45a4('0x9')]=function(_0x468f6d,_0x417006){return _0x468f6d[_0x45a4('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x45a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78d4=['util','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','lodash'];(function(_0x4135d8,_0x2672a2){var _0x227f8b=function(_0x5f9ca6){while(--_0x5f9ca6){_0x4135d8['push'](_0x4135d8['shift']());}};_0x227f8b(++_0x2672a2);}(_0x78d4,0xef));var _0x478d=function(_0x480387,_0x1eeafd){_0x480387=_0x480387-0x0;var _0x1aed30=_0x78d4[_0x480387];return _0x1aed30;};'use strict';var _=require(_0x478d('0x0'));var util=require(_0x478d('0x1'));var logger=require('../../config/logger')(_0x478d('0x2'));var moment=require('moment');var BPromise=require(_0x478d('0x3'));var rp=require(_0x478d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x478d('0x5'));var config=require(_0x478d('0x6'));var attributes=require(_0x478d('0x7'));module['exports']=function(_0x52e76e,_0x27d894){return _0x52e76e[_0x478d('0x8')](_0x478d('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 3ddf9e0..54715f0 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 _0xdf79=['stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xdf79,0xa7));var _0x9df7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf79[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9df7('0x0'));var BPromise=require(_0x9df7('0x1'));var rs=require(_0x9df7('0x2'));var fs=require('fs');var Redis=require(_0x9df7('0x3'));var db=require(_0x9df7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9df7('0x5'));var client=jayson[_0x9df7('0x6')][_0x9df7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x39f3c2,_0x5cf73b,_0x21d177){return new BPromise(function(_0x4cc7d5,_0x1663c8){return client['request'](_0x39f3c2,_0x21d177)[_0x9df7('0x8')](function(_0x1d86ed){logger[_0x9df7('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5cf73b,_0x9df7('0xa'));logger[_0x9df7('0xb')](_0x9df7('0xc'),_0x5cf73b,'request\x20sent',JSON[_0x9df7('0xd')](_0x1d86ed));if(_0x1d86ed[_0x9df7('0xe')]){if(_0x1d86ed[_0x9df7('0xe')][_0x9df7('0xf')]===0x1f4){logger[_0x9df7('0xe')](_0x9df7('0x10'),_0x5cf73b,_0x1d86ed[_0x9df7('0xe')][_0x9df7('0x11')]);return _0x1663c8(_0x1d86ed[_0x9df7('0xe')][_0x9df7('0x11')]);}logger[_0x9df7('0xe')](_0x9df7('0x10'),_0x5cf73b,_0x1d86ed['error']['message']);return _0x4cc7d5(_0x1d86ed[_0x9df7('0xe')][_0x9df7('0x11')]);}else{logger[_0x9df7('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5cf73b,_0x9df7('0xa'));_0x4cc7d5(_0x1d86ed['result']['message']);}})['catch'](function(_0x47241b){logger[_0x9df7('0xe')](_0x9df7('0x10'),_0x5cf73b,_0x47241b);_0x1663c8(_0x47241b);});});} \ No newline at end of file +var _0x38d0=['debug','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0xc86ab7,_0x1a1cea){var _0x24c021=function(_0x5578d4){while(--_0x5578d4){_0xc86ab7['push'](_0xc86ab7['shift']());}};_0x24c021(++_0x1a1cea);}(_0x38d0,0x123));var _0x038d=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x38d0[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require(_0x038d('0x0'));var moment=require(_0x038d('0x1'));var BPromise=require(_0x038d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x038d('0x3'));var db=require(_0x038d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x038d('0x5'));var config=require('../../config/environment');var jayson=require(_0x038d('0x6'));var client=jayson[_0x038d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10dca5,_0x18b35a,_0x434026){return new BPromise(function(_0x76bc10,_0x22d8ab){return client[_0x038d('0x8')](_0x10dca5,_0x434026)[_0x038d('0x9')](function(_0x353806){logger[_0x038d('0xa')](_0x038d('0xb'),_0x18b35a,_0x038d('0xc'));logger[_0x038d('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x18b35a,_0x038d('0xc'),JSON[_0x038d('0xe')](_0x353806));if(_0x353806[_0x038d('0xf')]){if(_0x353806['error'][_0x038d('0x10')]===0x1f4){logger[_0x038d('0xf')](_0x038d('0xb'),_0x18b35a,_0x353806[_0x038d('0xf')][_0x038d('0x11')]);return _0x22d8ab(_0x353806[_0x038d('0xf')][_0x038d('0x11')]);}logger[_0x038d('0xf')](_0x038d('0xb'),_0x18b35a,_0x353806['error']['message']);return _0x76bc10(_0x353806['error'][_0x038d('0x11')]);}else{logger[_0x038d('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x18b35a,'request\x20sent');_0x76bc10(_0x353806['result']['message']);}})[_0x038d('0x12')](function(_0x748d51){logger[_0x038d('0xf')](_0x038d('0xb'),_0x18b35a,_0x748d51);_0x22d8ab(_0x748d51);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0add123..c882675 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 _0xd369=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','create','put','/:id','update','delete','exports','multer'];(function(_0x577b0,_0x5721ff){var _0x2c2060=function(_0x58c5cc){while(--_0x58c5cc){_0x577b0['push'](_0x577b0['shift']());}};_0x2c2060(++_0x5721ff);}(_0xd369,0x1a8));var _0x9d36=function(_0x49ecfc,_0x165580){_0x49ecfc=_0x49ecfc-0x0;var _0x219944=_0xd369[_0x49ecfc];return _0x219944;};'use strict';var multer=require(_0x9d36('0x0'));var util=require(_0x9d36('0x1'));var path=require('path');var timeout=require(_0x9d36('0x2'));var express=require(_0x9d36('0x3'));var router=express[_0x9d36('0x4')]();var auth=require(_0x9d36('0x5'));var interaction=require(_0x9d36('0x6'));var config=require(_0x9d36('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x9d36('0x8')](),controller[_0x9d36('0x9')]);router[_0x9d36('0xa')]('/:id',auth[_0x9d36('0x8')](),controller['show']);router['post']('/',auth[_0x9d36('0x8')](),controller[_0x9d36('0xb')]);router[_0x9d36('0xc')](_0x9d36('0xd'),auth['isAuthenticated'](),controller[_0x9d36('0xe')]);router[_0x9d36('0xf')]('/:id',auth[_0x9d36('0x8')](),controller['destroy']);module[_0x9d36('0x10')]=router; \ No newline at end of file +var _0xf6e2=['Router','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5ddb24,_0x81cab2){var _0x3578b8=function(_0x63522b){while(--_0x63522b){_0x5ddb24['push'](_0x5ddb24['shift']());}};_0x3578b8(++_0x81cab2);}(_0xf6e2,0x1e2));var _0x2f6e=function(_0x64b6e,_0x391478){_0x64b6e=_0x64b6e-0x0;var _0x5d4448=_0xf6e2[_0x64b6e];return _0x5d4448;};'use strict';var multer=require(_0x2f6e('0x0'));var util=require('util');var path=require(_0x2f6e('0x1'));var timeout=require(_0x2f6e('0x2'));var express=require(_0x2f6e('0x3'));var router=express[_0x2f6e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f6e('0x5'));var controller=require(_0x2f6e('0x6'));router[_0x2f6e('0x7')]('/',auth[_0x2f6e('0x8')](),controller[_0x2f6e('0x9')]);router[_0x2f6e('0x7')](_0x2f6e('0xa'),auth['isAuthenticated'](),controller[_0x2f6e('0xb')]);router[_0x2f6e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2f6e('0xd')](_0x2f6e('0xa'),auth['isAuthenticated'](),controller[_0x2f6e('0xe')]);router[_0x2f6e('0xf')](_0x2f6e('0xa'),auth[_0x2f6e('0x8')](),controller[_0x2f6e('0x10')]);module[_0x2f6e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 909ef53..805c74e 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 _0x66cf=['string','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x4519e5,_0x22c44b){var _0x10e4f9=function(_0x2a2106){while(--_0x2a2106){_0x4519e5['push'](_0x4519e5['shift']());}};_0x10e4f9(++_0x22c44b);}(_0x66cf,0x1a2));var _0xf66c=function(_0x1ab6da,_0x1b2a2b){_0x1ab6da=_0x1ab6da-0x0;var _0x12cc6a=_0x66cf[_0x1ab6da];return _0x12cc6a;};'use strict';var Sequelize=require(_0xf66c('0x0'));module['exports']={'type':{'type':Sequelize[_0xf66c('0x1')](_0xf66c('0x2'),'variable',_0xf66c('0x3'),_0xf66c('0x4')),'defaultValue':_0xf66c('0x2')},'content':{'type':Sequelize[_0xf66c('0x5')]},'key':{'type':Sequelize[_0xf66c('0x5')]},'keyType':{'type':Sequelize[_0xf66c('0x1')](_0xf66c('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf66c('0x5')]},'idField':{'type':Sequelize[_0xf66c('0x5')]},'nameField':{'type':Sequelize[_0xf66c('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x603c=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x603c,0x16b));var _0xc603=function(_0xa8ec8f,_0x3eaefa){_0xa8ec8f=_0xa8ec8f-0x0;var _0xcd07ea=_0x603c[_0xa8ec8f];return _0xcd07ea;};'use strict';var Sequelize=require(_0xc603('0x0'));module[_0xc603('0x1')]={'type':{'type':Sequelize[_0xc603('0x2')](_0xc603('0x3'),'variable','customVariable',_0xc603('0x4')),'defaultValue':_0xc603('0x3')},'content':{'type':Sequelize[_0xc603('0x5')]},'key':{'type':Sequelize[_0xc603('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xc603('0x3'),'variable',_0xc603('0x6'))},'keyContent':{'type':Sequelize[_0xc603('0x5')]},'idField':{'type':Sequelize[_0xc603('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc603('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc603('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index fb74140..88163ad 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 _0x79b7=['includeAll','include','catch','show','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','FreshsalesField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x550a09,_0x54b8dc){var _0x4ca9cd=function(_0x233661){while(--_0x233661){_0x550a09['push'](_0x550a09['shift']());}};_0x4ca9cd(++_0x54b8dc);}(_0x79b7,0x131));var _0x779b=function(_0x26072b,_0x377151){_0x26072b=_0x26072b-0x0;var _0x3afa1f=_0x79b7[_0x26072b];return _0x3afa1f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x779b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x779b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x779b('0x2'));var moment=require(_0x779b('0x3'));var BPromise=require(_0x779b('0x4'));var Mustache=require(_0x779b('0x5'));var util=require(_0x779b('0x6'));var path=require(_0x779b('0x7'));var sox=require(_0x779b('0x8'));var csv=require('to-csv');var ejs=require(_0x779b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x779b('0xa'));var crypto=require(_0x779b('0xb'));var jsforce=require(_0x779b('0xc'));var deskjs=require(_0x779b('0xd'));var toCsv=require(_0x779b('0xe'));var querystring=require(_0x779b('0xf'));var Papa=require(_0x779b('0x10'));var Redis=require(_0x779b('0x11'));var authService=require(_0x779b('0x12'));var qs=require(_0x779b('0x13'));var as=require(_0x779b('0x14'));var hardwareService=require(_0x779b('0x15'));var logger=require(_0x779b('0x16'))('api');var utils=require(_0x779b('0x17'));var config=require(_0x779b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f83f9,_0x221f26){_0x221f26=_0x221f26||0xcc;return function(_0x54504b){if(_0x54504b){return _0x1f83f9[_0x779b('0x19')](_0x221f26);}return _0x1f83f9[_0x779b('0x1a')](_0x221f26)[_0x779b('0x1b')]();};}function respondWithResult(_0x15c824,_0x1a28b6){_0x1a28b6=_0x1a28b6||0xc8;return function(_0x315aa3){if(_0x315aa3){return _0x15c824[_0x779b('0x1a')](_0x1a28b6)[_0x779b('0x1c')](_0x315aa3);}};}function respondWithFilteredResult(_0x534b7b,_0x523a34){return function(_0x451cab){if(_0x451cab){var _0x5e8fdd=_0x451cab[_0x779b('0x1d')],_0x20fdbc=_0x523a34['offset'],_0x4180af=_0x523a34[_0x779b('0x1e')]+_0x523a34[_0x779b('0x1f')],_0x1fb9cd;if(_0x4180af>=_0x5e8fdd){_0x4180af=_0x5e8fdd;_0x1fb9cd=0xc8;}else{_0x1fb9cd=0xce;}_0x534b7b[_0x779b('0x1a')](_0x1fb9cd);return _0x534b7b[_0x779b('0x20')](_0x779b('0x21'),_0x20fdbc+'-'+_0x4180af+'/'+_0x5e8fdd)[_0x779b('0x1c')](_0x451cab);}return null;};}function patchUpdates(_0x2338f9){return function(_0x2a8135){try{jsonpatch[_0x779b('0x22')](_0x2a8135,_0x2338f9,!![]);}catch(_0x425e12){return BPromise['reject'](_0x425e12);}return _0x2a8135[_0x779b('0x23')]();};}function saveUpdates(_0x4c1779,_0x2ba291){return function(_0x2a0833){if(_0x2a0833){return _0x2a0833[_0x779b('0x24')](_0x4c1779)['then'](function(_0x3ef096){return _0x3ef096;});}return null;};}function removeEntity(_0x5c8d29,_0x5b956c){return function(_0x1b6b4c){if(_0x1b6b4c){return _0x1b6b4c[_0x779b('0x25')]()[_0x779b('0x26')](function(){_0x5c8d29[_0x779b('0x1a')](0xcc)[_0x779b('0x1b')]();});}};}function handleEntityNotFound(_0x1a8896,_0x1eee36){return function(_0x12cab3){if(!_0x12cab3){_0x1a8896['sendStatus'](0x194);}return _0x12cab3;};}function handleError(_0x126d19,_0x20dc2c){_0x20dc2c=_0x20dc2c||0x1f4;return function(_0x4d0d31){logger[_0x779b('0x27')](_0x4d0d31['stack']);if(_0x4d0d31[_0x779b('0x28')]){delete _0x4d0d31[_0x779b('0x28')];}_0x126d19[_0x779b('0x1a')](_0x20dc2c)[_0x779b('0x29')](_0x4d0d31);};}exports[_0x779b('0x2a')]=function(_0x37df42,_0x270d33){var _0x1a29b2={},_0x33e240={},_0x539b5a={'count':0x0,'rows':[]};var _0x34662d=_['map'](db[_0x779b('0x2b')]['rawAttributes'],function(_0x481a6f){return{'name':_0x481a6f[_0x779b('0x2c')],'type':_0x481a6f[_0x779b('0x2d')][_0x779b('0x2e')]};});_0x33e240[_0x779b('0x2f')]=_[_0x779b('0x30')](_0x34662d,_0x779b('0x28'));_0x33e240[_0x779b('0x31')]=_[_0x779b('0x32')](_0x37df42['query']);_0x33e240[_0x779b('0x33')]=_[_0x779b('0x34')](_0x33e240[_0x779b('0x2f')],_0x33e240[_0x779b('0x31')]);_0x1a29b2[_0x779b('0x35')]=_['intersection'](_0x33e240['model'],qs[_0x779b('0x36')](_0x37df42[_0x779b('0x31')]['fields']));_0x1a29b2[_0x779b('0x35')]=_0x1a29b2[_0x779b('0x35')]['length']?_0x1a29b2[_0x779b('0x35')]:_0x33e240[_0x779b('0x2f')];if(!_0x37df42[_0x779b('0x31')][_0x779b('0x37')](_0x779b('0x38'))){_0x1a29b2[_0x779b('0x1f')]=qs[_0x779b('0x1f')](_0x37df42[_0x779b('0x31')][_0x779b('0x1f')]);_0x1a29b2[_0x779b('0x1e')]=qs[_0x779b('0x1e')](_0x37df42[_0x779b('0x31')][_0x779b('0x1e')]);}_0x1a29b2[_0x779b('0x39')]=qs[_0x779b('0x3a')](_0x37df42[_0x779b('0x31')][_0x779b('0x3a')]);_0x1a29b2[_0x779b('0x3b')]=qs['filters'](_[_0x779b('0x3c')](_0x37df42['query'],_0x33e240[_0x779b('0x33')]),_0x34662d);if(_0x37df42[_0x779b('0x31')]['filter']){_0x1a29b2[_0x779b('0x3b')]=_[_0x779b('0x3d')](_0x1a29b2[_0x779b('0x3b')],{'$or':_[_0x779b('0x30')](_0x34662d,function(_0x16c748){if(_0x16c748[_0x779b('0x2d')]!==_0x779b('0x3e')){var _0x2b6138={};_0x2b6138[_0x16c748[_0x779b('0x28')]]={'$like':'%'+_0x37df42['query'][_0x779b('0x3f')]+'%'};return _0x2b6138;}})});}_0x1a29b2=_[_0x779b('0x3d')]({},_0x1a29b2,_0x37df42[_0x779b('0x40')]);var _0x344252={'where':_0x1a29b2['where']};return db[_0x779b('0x2b')]['count'](_0x344252)[_0x779b('0x26')](function(_0x3c245d){_0x539b5a[_0x779b('0x1d')]=_0x3c245d;if(_0x37df42['query'][_0x779b('0x41')]){_0x1a29b2[_0x779b('0x42')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x1a29b2);})[_0x779b('0x26')](function(_0x13258c){_0x539b5a['rows']=_0x13258c;return _0x539b5a;})[_0x779b('0x26')](respondWithFilteredResult(_0x270d33,_0x1a29b2))[_0x779b('0x43')](handleError(_0x270d33,null));};exports[_0x779b('0x44')]=function(_0x4a5e25,_0x1af27b){var _0x3d67f1={'raw':!![],'where':{'id':_0x4a5e25[_0x779b('0x45')]['id']}},_0xfdb76e={};_0xfdb76e['model']=_[_0x779b('0x32')](db[_0x779b('0x2b')]['rawAttributes']);_0xfdb76e[_0x779b('0x31')]=_[_0x779b('0x32')](_0x4a5e25[_0x779b('0x31')]);_0xfdb76e[_0x779b('0x33')]=_['intersection'](_0xfdb76e[_0x779b('0x2f')],_0xfdb76e[_0x779b('0x31')]);_0x3d67f1[_0x779b('0x35')]=_[_0x779b('0x34')](_0xfdb76e[_0x779b('0x2f')],qs['fields'](_0x4a5e25[_0x779b('0x31')][_0x779b('0x36')]));_0x3d67f1['attributes']=_0x3d67f1[_0x779b('0x35')][_0x779b('0x46')]?_0x3d67f1[_0x779b('0x35')]:_0xfdb76e[_0x779b('0x2f')];if(_0x4a5e25['query'][_0x779b('0x41')]){_0x3d67f1['include']=[{'all':!![]}];}_0x3d67f1=_[_0x779b('0x3d')]({},_0x3d67f1,_0x4a5e25[_0x779b('0x40')]);return db['FreshsalesField'][_0x779b('0x47')](_0x3d67f1)[_0x779b('0x26')](handleEntityNotFound(_0x1af27b,null))[_0x779b('0x26')](respondWithResult(_0x1af27b,null))[_0x779b('0x43')](handleError(_0x1af27b,null));};exports[_0x779b('0x48')]=function(_0x190a0f,_0x38efca){return db[_0x779b('0x2b')][_0x779b('0x48')](_0x190a0f[_0x779b('0x49')],{})[_0x779b('0x26')](respondWithResult(_0x38efca,0xc9))[_0x779b('0x43')](handleError(_0x38efca,null));};exports[_0x779b('0x24')]=function(_0x4b5016,_0x567872){if(_0x4b5016[_0x779b('0x49')]['id']){delete _0x4b5016[_0x779b('0x49')]['id'];}return db[_0x779b('0x2b')]['find']({'where':{'id':_0x4b5016[_0x779b('0x45')]['id']}})[_0x779b('0x26')](handleEntityNotFound(_0x567872,null))['then'](saveUpdates(_0x4b5016[_0x779b('0x49')],null))[_0x779b('0x26')](respondWithResult(_0x567872,null))['catch'](handleError(_0x567872,null));};exports[_0x779b('0x25')]=function(_0x3ef526,_0x2209a9){return db['FreshsalesField'][_0x779b('0x47')]({'where':{'id':_0x3ef526[_0x779b('0x45')]['id']}})[_0x779b('0x26')](handleEntityNotFound(_0x2209a9,null))[_0x779b('0x26')](removeEntity(_0x2209a9,null))[_0x779b('0x43')](handleError(_0x2209a9,null));}; \ No newline at end of file +var _0x6f13=['papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','set','Content-Range','json','save','then','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x6f13,0x1d4));var _0x36f1=function(_0x466b51,_0x13e3ea){_0x466b51=_0x466b51-0x0;var _0x54138b=_0x6f13[_0x466b51];return _0x54138b;};'use strict';var pdf=require(_0x36f1('0x0'));var emlformat=require(_0x36f1('0x1'));var rimraf=require(_0x36f1('0x2'));var zipdir=require(_0x36f1('0x3'));var jsonpatch=require(_0x36f1('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x36f1('0x5'));var Mustache=require(_0x36f1('0x6'));var util=require(_0x36f1('0x7'));var path=require(_0x36f1('0x8'));var sox=require(_0x36f1('0x9'));var csv=require('to-csv');var ejs=require(_0x36f1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x36f1('0xb'));var crypto=require(_0x36f1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x36f1('0xd'));var toCsv=require(_0x36f1('0xe'));var querystring=require('querystring');var Papa=require(_0x36f1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x36f1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x36f1('0x11'));var config=require(_0x36f1('0x12'));var db=require(_0x36f1('0x13'))['db'];function respondWithStatusCode(_0x5569d3,_0x5e12f7){_0x5e12f7=_0x5e12f7||0xcc;return function(_0x52b6aa){if(_0x52b6aa){return _0x5569d3[_0x36f1('0x14')](_0x5e12f7);}return _0x5569d3[_0x36f1('0x15')](_0x5e12f7)[_0x36f1('0x16')]();};}function respondWithResult(_0x2fc800,_0x19bc2a){_0x19bc2a=_0x19bc2a||0xc8;return function(_0x2e14d0){if(_0x2e14d0){return _0x2fc800['status'](_0x19bc2a)['json'](_0x2e14d0);}};}function respondWithFilteredResult(_0x4ccc45,_0x3b8e99){return function(_0x2bc92a){if(_0x2bc92a){var _0x2cc632=_0x2bc92a[_0x36f1('0x17')],_0x220afa=_0x3b8e99['offset'],_0x4124f5=_0x3b8e99['offset']+_0x3b8e99['limit'],_0x211e43;if(_0x4124f5>=_0x2cc632){_0x4124f5=_0x2cc632;_0x211e43=0xc8;}else{_0x211e43=0xce;}_0x4ccc45[_0x36f1('0x15')](_0x211e43);return _0x4ccc45[_0x36f1('0x18')](_0x36f1('0x19'),_0x220afa+'-'+_0x4124f5+'/'+_0x2cc632)[_0x36f1('0x1a')](_0x2bc92a);}return null;};}function patchUpdates(_0x3fa616){return function(_0x5e9de3){try{jsonpatch['apply'](_0x5e9de3,_0x3fa616,!![]);}catch(_0x2bc889){return BPromise['reject'](_0x2bc889);}return _0x5e9de3[_0x36f1('0x1b')]();};}function saveUpdates(_0x517875,_0x5e01ba){return function(_0x205207){if(_0x205207){return _0x205207['update'](_0x517875)[_0x36f1('0x1c')](function(_0x5c7d77){return _0x5c7d77;});}return null;};}function removeEntity(_0x13a285,_0x10bee4){return function(_0x2fce1a){if(_0x2fce1a){return _0x2fce1a['destroy']()[_0x36f1('0x1c')](function(){_0x13a285[_0x36f1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ddd9,_0x320ae3){return function(_0x342f23){if(!_0x342f23){_0x47ddd9[_0x36f1('0x14')](0x194);}return _0x342f23;};}function handleError(_0x4e5578,_0x345833){_0x345833=_0x345833||0x1f4;return function(_0x235647){logger['error'](_0x235647[_0x36f1('0x1d')]);if(_0x235647[_0x36f1('0x1e')]){delete _0x235647[_0x36f1('0x1e')];}_0x4e5578[_0x36f1('0x15')](_0x345833)[_0x36f1('0x1f')](_0x235647);};}exports[_0x36f1('0x20')]=function(_0x56fa96,_0x396428){var _0x318908={},_0x205f45={},_0x22112a={'count':0x0,'rows':[]};var _0x3c69a7=_[_0x36f1('0x21')](db[_0x36f1('0x22')][_0x36f1('0x23')],function(_0x4ec36b){return{'name':_0x4ec36b[_0x36f1('0x24')],'type':_0x4ec36b[_0x36f1('0x25')][_0x36f1('0x26')]};});_0x205f45[_0x36f1('0x27')]=_[_0x36f1('0x21')](_0x3c69a7,_0x36f1('0x1e'));_0x205f45[_0x36f1('0x28')]=_[_0x36f1('0x29')](_0x56fa96[_0x36f1('0x28')]);_0x205f45[_0x36f1('0x2a')]=_[_0x36f1('0x2b')](_0x205f45[_0x36f1('0x27')],_0x205f45[_0x36f1('0x28')]);_0x318908[_0x36f1('0x2c')]=_['intersection'](_0x205f45[_0x36f1('0x27')],qs['fields'](_0x56fa96[_0x36f1('0x28')]['fields']));_0x318908[_0x36f1('0x2c')]=_0x318908['attributes'][_0x36f1('0x2d')]?_0x318908[_0x36f1('0x2c')]:_0x205f45[_0x36f1('0x27')];if(!_0x56fa96[_0x36f1('0x28')][_0x36f1('0x2e')](_0x36f1('0x2f'))){_0x318908['limit']=qs[_0x36f1('0x30')](_0x56fa96[_0x36f1('0x28')][_0x36f1('0x30')]);_0x318908[_0x36f1('0x31')]=qs['offset'](_0x56fa96[_0x36f1('0x28')][_0x36f1('0x31')]);}_0x318908[_0x36f1('0x32')]=qs[_0x36f1('0x33')](_0x56fa96[_0x36f1('0x28')][_0x36f1('0x33')]);_0x318908['where']=qs['filters'](_[_0x36f1('0x34')](_0x56fa96[_0x36f1('0x28')],_0x205f45[_0x36f1('0x2a')]),_0x3c69a7);if(_0x56fa96[_0x36f1('0x28')][_0x36f1('0x35')]){_0x318908[_0x36f1('0x36')]=_[_0x36f1('0x37')](_0x318908[_0x36f1('0x36')],{'$or':_[_0x36f1('0x21')](_0x3c69a7,function(_0x40e23f){if(_0x40e23f[_0x36f1('0x25')]!==_0x36f1('0x38')){var _0x4e0c98={};_0x4e0c98[_0x40e23f['name']]={'$like':'%'+_0x56fa96['query'][_0x36f1('0x35')]+'%'};return _0x4e0c98;}})});}_0x318908=_[_0x36f1('0x37')]({},_0x318908,_0x56fa96[_0x36f1('0x39')]);var _0x1cd05f={'where':_0x318908[_0x36f1('0x36')]};return db[_0x36f1('0x22')][_0x36f1('0x17')](_0x1cd05f)[_0x36f1('0x1c')](function(_0x14a37a){_0x22112a[_0x36f1('0x17')]=_0x14a37a;if(_0x56fa96[_0x36f1('0x28')][_0x36f1('0x3a')]){_0x318908[_0x36f1('0x3b')]=[{'all':!![]}];}return db['FreshsalesField'][_0x36f1('0x3c')](_0x318908);})['then'](function(_0x5d755c){_0x22112a[_0x36f1('0x3d')]=_0x5d755c;return _0x22112a;})[_0x36f1('0x1c')](respondWithFilteredResult(_0x396428,_0x318908))[_0x36f1('0x3e')](handleError(_0x396428,null));};exports[_0x36f1('0x3f')]=function(_0xcb4e24,_0x804b71){var _0x14a2a3={'raw':!![],'where':{'id':_0xcb4e24[_0x36f1('0x40')]['id']}},_0x443f8b={};_0x443f8b[_0x36f1('0x27')]=_[_0x36f1('0x29')](db[_0x36f1('0x22')][_0x36f1('0x23')]);_0x443f8b[_0x36f1('0x28')]=_[_0x36f1('0x29')](_0xcb4e24[_0x36f1('0x28')]);_0x443f8b[_0x36f1('0x2a')]=_[_0x36f1('0x2b')](_0x443f8b[_0x36f1('0x27')],_0x443f8b[_0x36f1('0x28')]);_0x14a2a3[_0x36f1('0x2c')]=_[_0x36f1('0x2b')](_0x443f8b['model'],qs['fields'](_0xcb4e24[_0x36f1('0x28')][_0x36f1('0x41')]));_0x14a2a3['attributes']=_0x14a2a3[_0x36f1('0x2c')][_0x36f1('0x2d')]?_0x14a2a3[_0x36f1('0x2c')]:_0x443f8b[_0x36f1('0x27')];if(_0xcb4e24[_0x36f1('0x28')][_0x36f1('0x3a')]){_0x14a2a3[_0x36f1('0x3b')]=[{'all':!![]}];}_0x14a2a3=_[_0x36f1('0x37')]({},_0x14a2a3,_0xcb4e24[_0x36f1('0x39')]);return db[_0x36f1('0x22')][_0x36f1('0x42')](_0x14a2a3)[_0x36f1('0x1c')](handleEntityNotFound(_0x804b71,null))['then'](respondWithResult(_0x804b71,null))['catch'](handleError(_0x804b71,null));};exports[_0x36f1('0x43')]=function(_0x753d31,_0x6bf3ea){return db[_0x36f1('0x22')][_0x36f1('0x43')](_0x753d31[_0x36f1('0x44')],{})[_0x36f1('0x1c')](respondWithResult(_0x6bf3ea,0xc9))['catch'](handleError(_0x6bf3ea,null));};exports['update']=function(_0x23106f,_0x76d7a0){if(_0x23106f['body']['id']){delete _0x23106f[_0x36f1('0x44')]['id'];}return db[_0x36f1('0x22')][_0x36f1('0x42')]({'where':{'id':_0x23106f['params']['id']}})[_0x36f1('0x1c')](handleEntityNotFound(_0x76d7a0,null))[_0x36f1('0x1c')](saveUpdates(_0x23106f[_0x36f1('0x44')],null))['then'](respondWithResult(_0x76d7a0,null))['catch'](handleError(_0x76d7a0,null));};exports['destroy']=function(_0x42fea5,_0x28bc09){return db[_0x36f1('0x22')][_0x36f1('0x42')]({'where':{'id':_0x42fea5['params']['id']}})['then'](handleEntityNotFound(_0x28bc09,null))[_0x36f1('0x1c')](removeEntity(_0x28bc09,null))['catch'](handleError(_0x28bc09,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7c09ea1..3ddb960 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 _0xfdda=['path','../../config/environment','./intFreshsalesField.attributes','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xfdda,0x156));var _0xafdd=function(_0x5d9c37,_0x518b93){_0x5d9c37=_0x5d9c37-0x0;var _0x1ba9eb=_0xfdda[_0x5d9c37];return _0x1ba9eb;};'use strict';var _=require(_0xafdd('0x0'));var util=require(_0xafdd('0x1'));var logger=require(_0xafdd('0x2'))(_0xafdd('0x3'));var moment=require('moment');var BPromise=require(_0xafdd('0x4'));var rp=require(_0xafdd('0x5'));var fs=require('fs');var path=require(_0xafdd('0x6'));var rimraf=require('rimraf');var config=require(_0xafdd('0x7'));var attributes=require(_0xafdd('0x8'));module['exports']=function(_0x18ac12,_0x523597){return _0x18ac12['define']('FreshsalesField',attributes,{'tableName':_0xafdd('0x9'),'paranoid':![],'indexes':[{'name':_0xafdd('0xa'),'fields':['idField',_0xafdd('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe81b=['define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe81b,0x1f3));var _0xbe81=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xe81b[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xbe81('0x0'));var util=require(_0xbe81('0x1'));var logger=require(_0xbe81('0x2'))(_0xbe81('0x3'));var moment=require(_0xbe81('0x4'));var BPromise=require(_0xbe81('0x5'));var rp=require(_0xbe81('0x6'));var fs=require('fs');var path=require(_0xbe81('0x7'));var rimraf=require(_0xbe81('0x8'));var config=require(_0xbe81('0x9'));var attributes=require(_0xbe81('0xa'));module['exports']=function(_0xc346af,_0x5d2b54){return _0xc346af[_0xbe81('0xb')](_0xbe81('0xc'),attributes,{'tableName':_0xbe81('0xd'),'paranoid':![],'indexes':[{'name':_0xbe81('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 2b05c75..ae43f78 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 _0x35f9=['client','http','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xe74694,_0x45838e){var _0x1bab95=function(_0xf6f063){while(--_0xf6f063){_0xe74694['push'](_0xe74694['shift']());}};_0x1bab95(++_0x45838e);}(_0x35f9,0x1d7));var _0x935f=function(_0x26231c,_0x2a572b){_0x26231c=_0x26231c-0x0;var _0x5b4937=_0x35f9[_0x26231c];return _0x5b4937;};'use strict';var _=require(_0x935f('0x0'));var util=require('util');var moment=require(_0x935f('0x1'));var BPromise=require(_0x935f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x935f('0x3'));var db=require(_0x935f('0x4'))['db'];var utils=require(_0x935f('0x5'));var logger=require(_0x935f('0x6'))(_0x935f('0x7'));var config=require('../../config/environment');var jayson=require(_0x935f('0x8'));var client=jayson[_0x935f('0x9')][_0x935f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59cc63,_0x355b1a,_0x23683f){return new BPromise(function(_0x51a9f8,_0x3c92bb){return client['request'](_0x59cc63,_0x23683f)[_0x935f('0xb')](function(_0x532564){logger['info'](_0x935f('0xc'),_0x355b1a,_0x935f('0xd'));logger['debug'](_0x935f('0xe'),_0x355b1a,_0x935f('0xd'),JSON[_0x935f('0xf')](_0x532564));if(_0x532564[_0x935f('0x10')]){if(_0x532564[_0x935f('0x10')][_0x935f('0x11')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x355b1a,_0x532564[_0x935f('0x10')][_0x935f('0x12')]);return _0x3c92bb(_0x532564[_0x935f('0x10')][_0x935f('0x12')]);}logger[_0x935f('0x10')](_0x935f('0xc'),_0x355b1a,_0x532564[_0x935f('0x10')][_0x935f('0x12')]);return _0x51a9f8(_0x532564['error'][_0x935f('0x12')]);}else{logger['info'](_0x935f('0xc'),_0x355b1a,_0x935f('0xd'));_0x51a9f8(_0x532564['result'][_0x935f('0x12')]);}})[_0x935f('0x13')](function(_0x565882){logger[_0x935f('0x10')](_0x935f('0xc'),_0x355b1a,_0x565882);_0x3c92bb(_0x565882);});});} \ No newline at end of file +var _0x462f=['FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x151b28,_0x372ae4){var _0x261219=function(_0xa1f1d3){while(--_0xa1f1d3){_0x151b28['push'](_0x151b28['shift']());}};_0x261219(++_0x372ae4);}(_0x462f,0x1d7));var _0xf462=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x462f[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0xf462('0x0'));var util=require(_0xf462('0x1'));var moment=require(_0xf462('0x2'));var BPromise=require(_0xf462('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf462('0x4'));var db=require(_0xf462('0x5'))['db'];var utils=require(_0xf462('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf462('0x7'));var jayson=require(_0xf462('0x8'));var client=jayson[_0xf462('0x9')][_0xf462('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cc10f,_0x2344a8,_0x270440){return new BPromise(function(_0x2b0a6c,_0x413c11){return client[_0xf462('0xb')](_0x4cc10f,_0x270440)[_0xf462('0xc')](function(_0x81e5b7){logger['info'](_0xf462('0xd'),_0x2344a8,'request\x20sent');logger[_0xf462('0xe')](_0xf462('0xf'),_0x2344a8,_0xf462('0x10'),JSON[_0xf462('0x11')](_0x81e5b7));if(_0x81e5b7[_0xf462('0x12')]){if(_0x81e5b7[_0xf462('0x12')]['code']===0x1f4){logger['error'](_0xf462('0xd'),_0x2344a8,_0x81e5b7[_0xf462('0x12')][_0xf462('0x13')]);return _0x413c11(_0x81e5b7[_0xf462('0x12')][_0xf462('0x13')]);}logger[_0xf462('0x12')](_0xf462('0xd'),_0x2344a8,_0x81e5b7['error'][_0xf462('0x13')]);return _0x2b0a6c(_0x81e5b7[_0xf462('0x12')][_0xf462('0x13')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2344a8,_0xf462('0x10'));_0x2b0a6c(_0x81e5b7[_0xf462('0x14')]['message']);}})[_0xf462('0x15')](function(_0x3f1496){logger[_0xf462('0x12')](_0xf462('0xd'),_0x2344a8,_0x3f1496);_0x413c11(_0x3f1496);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index aaa7112..81be476 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 _0x83e0=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x83e0,0x1b0));var _0x083e=function(_0x567e1e,_0x247b98){_0x567e1e=_0x567e1e-0x0;var _0xae1bab=_0x83e0[_0x567e1e];return _0xae1bab;};'use strict';var multer=require(_0x083e('0x0'));var util=require('util');var path=require(_0x083e('0x1'));var timeout=require(_0x083e('0x2'));var express=require(_0x083e('0x3'));var router=express[_0x083e('0x4')]();var auth=require(_0x083e('0x5'));var interaction=require(_0x083e('0x6'));var config=require('../../config/environment');var controller=require(_0x083e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x083e('0x8')]);router['get'](_0x083e('0x9'),auth[_0x083e('0xa')](),controller[_0x083e('0xb')]);router[_0x083e('0xc')](_0x083e('0xd'),auth[_0x083e('0xa')](),controller[_0x083e('0xe')]);router[_0x083e('0xc')](_0x083e('0xf'),auth[_0x083e('0xa')](),controller[_0x083e('0x10')]);router[_0x083e('0x11')]('/',auth['isAuthenticated'](),controller[_0x083e('0x12')]);router[_0x083e('0x11')](_0x083e('0xd'),auth[_0x083e('0xa')](),controller[_0x083e('0x13')]);router[_0x083e('0x14')]('/:id',auth[_0x083e('0xa')](),controller[_0x083e('0x15')]);router[_0x083e('0x16')](_0x083e('0x9'),auth[_0x083e('0xa')](),controller['destroy']);module[_0x083e('0x17')]=router; \ No newline at end of file +var _0x69b4=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','update','delete','exports','multer'];(function(_0x2ae28c,_0x3fa73c){var _0x30ff86=function(_0x5b89cd){while(--_0x5b89cd){_0x2ae28c['push'](_0x2ae28c['shift']());}};_0x30ff86(++_0x3fa73c);}(_0x69b4,0x133));var _0x469b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x69b4[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x469b('0x0'));var util=require(_0x469b('0x1'));var path=require(_0x469b('0x2'));var timeout=require('connect-timeout');var express=require(_0x469b('0x3'));var router=express[_0x469b('0x4')]();var auth=require(_0x469b('0x5'));var interaction=require(_0x469b('0x6'));var config=require(_0x469b('0x7'));var controller=require(_0x469b('0x8'));router[_0x469b('0x9')]('/',auth[_0x469b('0xa')](),controller[_0x469b('0xb')]);router[_0x469b('0x9')](_0x469b('0xc'),auth['isAuthenticated'](),controller[_0x469b('0xd')]);router['get'](_0x469b('0xe'),auth[_0x469b('0xa')](),controller[_0x469b('0xf')]);router[_0x469b('0x9')]('/:id/fields',auth[_0x469b('0xa')](),controller[_0x469b('0x10')]);router[_0x469b('0x11')]('/',auth[_0x469b('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0x469b('0xa')](),controller[_0x469b('0x12')]);router['put'](_0x469b('0xc'),auth[_0x469b('0xa')](),controller[_0x469b('0x13')]);router[_0x469b('0x14')](_0x469b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x469b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 5788dc8..80e00ae 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 _0x1cb9=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x29fdb7,_0x37b629){var _0x3387e7=function(_0x3ee352){while(--_0x3ee352){_0x29fdb7['push'](_0x29fdb7['shift']());}};_0x3387e7(++_0x37b629);}(_0x1cb9,0x14e));var _0x91cb=function(_0x18b548,_0x531de3){_0x18b548=_0x18b548-0x0;var _0x89de38=_0x1cb9[_0x18b548];return _0x89de38;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')]},'description':{'type':Sequelize[_0x91cb('0x1')]},'username':{'type':Sequelize[_0x91cb('0x1')],'unique':_0x91cb('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x91cb('0x1')]},'clientId':{'type':Sequelize[_0x91cb('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x91cb('0x1')]},'serverUrl':{'type':Sequelize[_0x91cb('0x1')]},'type':{'type':Sequelize[_0x91cb('0x3')](_0x91cb('0x4'),_0x91cb('0x5')),'defaultValue':_0x91cb('0x4')}}; \ No newline at end of file +var _0xf494=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x350dc0,_0x137137){var _0x39fb3f=function(_0x507f69){while(--_0x507f69){_0x350dc0['push'](_0x350dc0['shift']());}};_0x39fb3f(++_0x137137);}(_0xf494,0x1c6));var _0x4f49=function(_0x2aca18,_0x5ca170){_0x2aca18=_0x2aca18-0x0;var _0xbee03c=_0xf494[_0x2aca18];return _0xbee03c;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4f49('0x2')],'unique':_0x4f49('0x3')},'remoteUri':{'type':Sequelize[_0x4f49('0x2')]},'password':{'type':Sequelize[_0x4f49('0x2')]},'clientId':{'type':Sequelize[_0x4f49('0x2')]},'clientSecret':{'type':Sequelize[_0x4f49('0x2')]},'securityToken':{'type':Sequelize[_0x4f49('0x2')]},'serverUrl':{'type':Sequelize[_0x4f49('0x2')]},'type':{'type':Sequelize[_0x4f49('0x4')](_0x4f49('0x5'),_0x4f49('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 42b4718..ea88374 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 _0x67ea=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','save','update','then','destroy','stack','name','send','map','SalesforceAccount','fieldName','type','key','model','query','intersection','fields','attributes','length','sort','filters','pick','filter','where','merge','includeAll','rows','show','params','keys','rawAttributes','include','find','create','body','findOne','order','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','password','securityToken','slice','login','username','concat','isNil','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Type','Origin','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','zip-dir'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x67ea,0x18d));var _0xa67e=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x67ea[_0x1dd82f];return _0x353ca4;};'use strict';var pdf=require(_0xa67e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa67e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa67e('0x2'));var moment=require(_0xa67e('0x3'));var BPromise=require(_0xa67e('0x4'));var Mustache=require(_0xa67e('0x5'));var util=require(_0xa67e('0x6'));var path=require(_0xa67e('0x7'));var sox=require(_0xa67e('0x8'));var csv=require('to-csv');var ejs=require(_0xa67e('0x9'));var fs=require('fs');var _=require(_0xa67e('0xa'));var squel=require(_0xa67e('0xb'));var crypto=require('crypto');var jsforce=require(_0xa67e('0xc'));var deskjs=require(_0xa67e('0xd'));var toCsv=require(_0xa67e('0xe'));var querystring=require(_0xa67e('0xf'));var Papa=require(_0xa67e('0x10'));var Redis=require(_0xa67e('0x11'));var authService=require(_0xa67e('0x12'));var qs=require(_0xa67e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67e('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa67e('0x15'));var db=require(_0xa67e('0x16'))['db'];var integrations=require(_0xa67e('0x17'));var jayson=require(_0xa67e('0x18'));var client=jayson['client'][_0xa67e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x489a7c,_0x3e264d,_0x37f4af){if(_0x37f4af){var _0xeaa4d9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xeaa4d9[_0xa67e('0x1a')](_0x3e264d)){return _0x489a7c;}else{throw new db[(_0xa67e('0x1b'))][(_0xa67e('0x1c'))](_0xa67e('0x1d'));}}else{return _0x489a7c;}}function respondWithRpcPromise(_0x45ef65,_0x5047dd,_0x3c82dd,_0x2aa5d6){return new BPromise(function(_0x252177,_0x294bc0){var _0x1222e5=_0x2aa5d6||client;return _0x1222e5[_0xa67e('0x1e')](_0x45ef65,_0x3c82dd)['then'](function(_0x1c0ff2){logger[_0xa67e('0x1f')](_0xa67e('0x20'),_0x5047dd,_0xa67e('0x21'));logger[_0xa67e('0x22')](_0xa67e('0x23'),_0x5047dd,'request\x20sent',JSON[_0xa67e('0x24')](_0x1c0ff2));if(_0x1c0ff2[_0xa67e('0x25')]){if(_0x1c0ff2[_0xa67e('0x25')][_0xa67e('0x26')]===0x1f4){logger['error'](_0xa67e('0x20'),_0x5047dd,_0x1c0ff2[_0xa67e('0x25')][_0xa67e('0x27')]);return _0x294bc0(_0x1c0ff2[_0xa67e('0x25')][_0xa67e('0x27')]);}logger[_0xa67e('0x25')]('SalesforceAccount,\x20%s,\x20%s',_0x5047dd,_0x1c0ff2['error']['message']);return _0x252177(_0x1c0ff2[_0xa67e('0x25')]['message']);}else{logger['info'](_0xa67e('0x20'),_0x5047dd,_0xa67e('0x21'));_0x252177(_0x1c0ff2[_0xa67e('0x28')][_0xa67e('0x27')]);}})[_0xa67e('0x29')](function(_0x596efb){logger[_0xa67e('0x25')](_0xa67e('0x20'),_0x5047dd,_0x596efb);_0x294bc0(_0x596efb);});});}function respondWithStatusCode(_0xf1b772,_0xfb39fe){_0xfb39fe=_0xfb39fe||0xcc;return function(_0x2472fb){if(_0x2472fb){return _0xf1b772[_0xa67e('0x2a')](_0xfb39fe);}return _0xf1b772[_0xa67e('0x2b')](_0xfb39fe)[_0xa67e('0x2c')]();};}function respondWithResult(_0x54b76e,_0x211130){_0x211130=_0x211130||0xc8;return function(_0x14ecdb){if(_0x14ecdb){return _0x54b76e['status'](_0x211130)[_0xa67e('0x2d')](_0x14ecdb);}};}function respondWithFilteredResult(_0x4a2dfe,_0x2ea80c){return function(_0x2f2ee9){if(_0x2f2ee9){var _0x275d7c=_0x2f2ee9[_0xa67e('0x2e')],_0x35d2ac=_0x2ea80c[_0xa67e('0x2f')],_0x17a241=_0x2ea80c['offset']+_0x2ea80c[_0xa67e('0x30')],_0x1d223d;if(_0x17a241>=_0x275d7c){_0x17a241=_0x275d7c;_0x1d223d=0xc8;}else{_0x1d223d=0xce;}_0x4a2dfe['status'](_0x1d223d);return _0x4a2dfe['set']('Content-Range',_0x35d2ac+'-'+_0x17a241+'/'+_0x275d7c)['json'](_0x2f2ee9);}return null;};}function patchUpdates(_0x4edbe2){return function(_0x32346b){try{jsonpatch['apply'](_0x32346b,_0x4edbe2,!![]);}catch(_0x17e1fe){return BPromise['reject'](_0x17e1fe);}return _0x32346b[_0xa67e('0x31')]();};}function saveUpdates(_0x5bd951,_0x138c9b){return function(_0x3f93a4){if(_0x3f93a4){return _0x3f93a4[_0xa67e('0x32')](_0x5bd951)[_0xa67e('0x33')](function(_0x306c6f){return _0x306c6f;});}return null;};}function removeEntity(_0x4dbc82,_0x4d847e){return function(_0x46bbe7){if(_0x46bbe7){return _0x46bbe7[_0xa67e('0x34')]()[_0xa67e('0x33')](function(){_0x4dbc82['status'](0xcc)[_0xa67e('0x2c')]();});}};}function handleEntityNotFound(_0x2c8641,_0x498c8e){return function(_0x408611){if(!_0x408611){_0x2c8641[_0xa67e('0x2a')](0x194);}return _0x408611;};}function handleError(_0x34fbac,_0x51f790){_0x51f790=_0x51f790||0x1f4;return function(_0x4fcd12){logger[_0xa67e('0x25')](_0x4fcd12[_0xa67e('0x35')]);if(_0x4fcd12['name']){delete _0x4fcd12[_0xa67e('0x36')];}_0x34fbac[_0xa67e('0x2b')](_0x51f790)[_0xa67e('0x37')](_0x4fcd12);};}exports['index']=function(_0x2ed4ec,_0x52f648){var _0x4b1872={},_0x5d0d17={},_0x3f917b={'count':0x0,'rows':[]};var _0x1769bb=_[_0xa67e('0x38')](db[_0xa67e('0x39')]['rawAttributes'],function(_0x40b23f){return{'name':_0x40b23f[_0xa67e('0x3a')],'type':_0x40b23f[_0xa67e('0x3b')][_0xa67e('0x3c')]};});_0x5d0d17[_0xa67e('0x3d')]=_[_0xa67e('0x38')](_0x1769bb,_0xa67e('0x36'));_0x5d0d17[_0xa67e('0x3e')]=_['keys'](_0x2ed4ec[_0xa67e('0x3e')]);_0x5d0d17['filters']=_[_0xa67e('0x3f')](_0x5d0d17['model'],_0x5d0d17[_0xa67e('0x3e')]);_0x4b1872['attributes']=_[_0xa67e('0x3f')](_0x5d0d17[_0xa67e('0x3d')],qs[_0xa67e('0x40')](_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x40')]));_0x4b1872[_0xa67e('0x41')]=_0x4b1872[_0xa67e('0x41')][_0xa67e('0x42')]?_0x4b1872[_0xa67e('0x41')]:_0x5d0d17[_0xa67e('0x3d')];if(!_0x2ed4ec[_0xa67e('0x3e')]['hasOwnProperty']('nolimit')){_0x4b1872['limit']=qs[_0xa67e('0x30')](_0x2ed4ec['query'][_0xa67e('0x30')]);_0x4b1872[_0xa67e('0x2f')]=qs[_0xa67e('0x2f')](_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x2f')]);}_0x4b1872['order']=qs[_0xa67e('0x43')](_0x2ed4ec['query'][_0xa67e('0x43')]);_0x4b1872['where']=qs[_0xa67e('0x44')](_[_0xa67e('0x45')](_0x2ed4ec[_0xa67e('0x3e')],_0x5d0d17[_0xa67e('0x44')]),_0x1769bb);if(_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x46')]){_0x4b1872[_0xa67e('0x47')]=_[_0xa67e('0x48')](_0x4b1872[_0xa67e('0x47')],{'$or':_[_0xa67e('0x38')](_0x1769bb,function(_0x381bad){if(_0x381bad[_0xa67e('0x3b')]!=='VIRTUAL'){var _0x343406={};_0x343406[_0x381bad[_0xa67e('0x36')]]={'$like':'%'+_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x46')]+'%'};return _0x343406;}})});}_0x4b1872=_[_0xa67e('0x48')]({},_0x4b1872,_0x2ed4ec['options']);var _0x3e63af={'where':_0x4b1872[_0xa67e('0x47')]};return db[_0xa67e('0x39')][_0xa67e('0x2e')](_0x3e63af)[_0xa67e('0x33')](function(_0x3bb131){_0x3f917b[_0xa67e('0x2e')]=_0x3bb131;if(_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x49')]){_0x4b1872['include']=[{'all':!![]}];}return db[_0xa67e('0x39')]['findAll'](_0x4b1872);})[_0xa67e('0x33')](function(_0x16b218){_0x3f917b[_0xa67e('0x4a')]=_0x16b218;return _0x3f917b;})['then'](respondWithFilteredResult(_0x52f648,_0x4b1872))[_0xa67e('0x29')](handleError(_0x52f648,null));};exports[_0xa67e('0x4b')]=function(_0xe45d74,_0x15dee7){var _0x350492={'raw':![],'where':{'id':_0xe45d74[_0xa67e('0x4c')]['id']}},_0x1d8fcd={};_0x1d8fcd['model']=_[_0xa67e('0x4d')](db[_0xa67e('0x39')][_0xa67e('0x4e')]);_0x1d8fcd[_0xa67e('0x3e')]=_[_0xa67e('0x4d')](_0xe45d74[_0xa67e('0x3e')]);_0x1d8fcd[_0xa67e('0x44')]=_[_0xa67e('0x3f')](_0x1d8fcd[_0xa67e('0x3d')],_0x1d8fcd[_0xa67e('0x3e')]);_0x350492[_0xa67e('0x41')]=_[_0xa67e('0x3f')](_0x1d8fcd['model'],qs[_0xa67e('0x40')](_0xe45d74['query'][_0xa67e('0x40')]));_0x350492[_0xa67e('0x41')]=_0x350492[_0xa67e('0x41')][_0xa67e('0x42')]?_0x350492['attributes']:_0x1d8fcd[_0xa67e('0x3d')];if(_0xe45d74[_0xa67e('0x3e')][_0xa67e('0x49')]){_0x350492[_0xa67e('0x4f')]=[{'all':!![]}];}_0x350492=_[_0xa67e('0x48')]({},_0x350492,_0xe45d74['options']);return db['SalesforceAccount'][_0xa67e('0x50')](_0x350492)[_0xa67e('0x33')](handleEntityNotFound(_0x15dee7,null))[_0xa67e('0x33')](respondWithResult(_0x15dee7,null))[_0xa67e('0x29')](handleError(_0x15dee7,null));};exports['create']=function(_0x36454c,_0x264900){return db[_0xa67e('0x39')][_0xa67e('0x51')](_0x36454c[_0xa67e('0x52')],{})[_0xa67e('0x33')](respondWithResult(_0x264900,0xc9))[_0xa67e('0x29')](handleError(_0x264900,null));};exports['update']=function(_0x844780,_0x23d352){if(_0x844780[_0xa67e('0x52')]['id']){delete _0x844780['body']['id'];}return db[_0xa67e('0x39')][_0xa67e('0x50')]({'where':{'id':_0x844780[_0xa67e('0x4c')]['id']}})[_0xa67e('0x33')](handleEntityNotFound(_0x23d352,null))['then'](saveUpdates(_0x844780[_0xa67e('0x52')],null))[_0xa67e('0x33')](respondWithResult(_0x23d352,null))[_0xa67e('0x29')](handleError(_0x23d352,null));};exports[_0xa67e('0x34')]=function(_0x3df250,_0x4c109e){return db[_0xa67e('0x39')][_0xa67e('0x50')]({'where':{'id':_0x3df250[_0xa67e('0x4c')]['id']}})[_0xa67e('0x33')](handleEntityNotFound(_0x4c109e,null))[_0xa67e('0x33')](removeEntity(_0x4c109e,null))[_0xa67e('0x29')](handleError(_0x4c109e,null));};exports['getConfigurations']=function(_0x4bf225,_0x3abd93,_0x1fe86e){var _0x2a2422={};var _0x468aa7={};var _0x2ab219;var _0x4c2e9c;return db[_0xa67e('0x39')][_0xa67e('0x53')]({'where':{'id':_0x4bf225[_0xa67e('0x4c')]['id']}})[_0xa67e('0x33')](handleEntityNotFound(_0x3abd93,null))[_0xa67e('0x33')](function(_0x3026d7){if(_0x3026d7){_0x2ab219=_0x3026d7;_0x468aa7['model']=_[_0xa67e('0x4d')](db['SalesforceConfiguration'][_0xa67e('0x4e')]);_0x468aa7[_0xa67e('0x3e')]=_[_0xa67e('0x4d')](_0x4bf225[_0xa67e('0x3e')]);_0x468aa7[_0xa67e('0x44')]=_['intersection'](_0x468aa7[_0xa67e('0x3d')],_0x468aa7[_0xa67e('0x3e')]);_0x2a2422['attributes']=_[_0xa67e('0x3f')](_0x468aa7[_0xa67e('0x3d')],qs['fields'](_0x4bf225[_0xa67e('0x3e')]['fields']));_0x2a2422[_0xa67e('0x41')]=_0x2a2422[_0xa67e('0x41')][_0xa67e('0x42')]?_0x2a2422['attributes']:_0x468aa7[_0xa67e('0x3d')];_0x2a2422[_0xa67e('0x54')]=qs['sort'](_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x43')]);_0x2a2422['where']=qs['filters'](_[_0xa67e('0x45')](_0x4bf225[_0xa67e('0x3e')],_0x468aa7[_0xa67e('0x44')]));if(_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x46')]){_0x2a2422[_0xa67e('0x47')]=_[_0xa67e('0x48')](_0x2a2422[_0xa67e('0x47')],{'$or':_['map'](_0x2a2422[_0xa67e('0x41')],function(_0x2d7bb1){var _0x1b2750={};_0x1b2750[_0x2d7bb1]={'$like':'%'+_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x46')]+'%'};return _0x1b2750;})});}_0x2a2422=_[_0xa67e('0x48')]({},_0x2a2422,_0x4bf225['options']);return _0x2ab219[_0xa67e('0x55')](_0x2a2422);}})[_0xa67e('0x33')](function(_0x45d20b){if(_0x45d20b){_0x4c2e9c=_0x45d20b['length'];if(!_0x4bf225['query'][_0xa67e('0x56')](_0xa67e('0x57'))){_0x2a2422[_0xa67e('0x30')]=qs[_0xa67e('0x30')](_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x30')]);_0x2a2422['offset']=qs[_0xa67e('0x2f')](_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x2f')]);}return _0x2ab219[_0xa67e('0x55')](_0x2a2422);}})[_0xa67e('0x33')](function(_0x46aba8){if(_0x46aba8){return _0x46aba8?{'count':_0x4c2e9c,'rows':_0x46aba8}:null;}})[_0xa67e('0x33')](respondWithResult(_0x3abd93,null))[_0xa67e('0x29')](handleError(_0x3abd93,null));};exports[_0xa67e('0x58')]=function(_0x55c1fb,_0x25001e,_0x28a5b6){if(_0x55c1fb['body']['id']){delete _0x55c1fb[_0xa67e('0x52')]['id'];}return db[_0xa67e('0x39')][_0xa67e('0x53')]({'where':{'id':_0x55c1fb[_0xa67e('0x4c')]['id']}})[_0xa67e('0x33')](handleEntityNotFound(_0x25001e,null))[_0xa67e('0x33')](function(_0x5bd8f1){if(_0x5bd8f1){_0x55c1fb[_0xa67e('0x52')][_0xa67e('0x59')]=_0x5bd8f1['id'];_0x55c1fb[_0xa67e('0x52')][_0xa67e('0x5a')]=integrations['getSubjects'](_0x55c1fb[_0xa67e('0x52')][_0xa67e('0x5b')],_0x55c1fb[_0xa67e('0x52')][_0xa67e('0x3b')]);_0x55c1fb['body'][_0xa67e('0x5c')]=integrations[_0xa67e('0x5d')](_0x55c1fb['body'][_0xa67e('0x5b')],_0x55c1fb[_0xa67e('0x52')]['type']);return db['SalesforceConfiguration']['create'](_0x55c1fb['body'],{'include':[{'model':db[_0xa67e('0x5e')],'as':'Subjects'},{'model':db[_0xa67e('0x5e')],'as':_0xa67e('0x5c')}]});}return null;})['then'](respondWithResult(_0x25001e,null))[_0xa67e('0x29')](handleError(_0x25001e,null));};exports[_0xa67e('0x5f')]=function(_0x4d208d,_0x1bb981,_0x1eb9d0){var _0x2f08de;var _0x2f3bb0='';var _0x38e232=_0xa67e('0x60');return db['SalesforceAccount'][_0xa67e('0x53')]({'where':{'id':_0x4d208d[_0xa67e('0x4c')]['id']},'attributes':['id',_0xa67e('0x61'),_0xa67e('0x62'),'clientSecret','username',_0xa67e('0x63'),_0xa67e('0x64')]})['then'](handleEntityNotFound(_0x1bb981,null))['then'](function(_0x202322){if(_0x202322){_0x2f3bb0=_0x202322[_0xa67e('0x61')];var _0x414330=_0x2f3bb0[_0xa67e('0x65')](-0x1);if(_0x414330==='/'){_0x2f3bb0=_0x2f3bb0['substring'](0x0,_0x2f3bb0['lastIndexOf'](_0x414330));}_0x2f08de=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2f3bb0,'clientId':_0x202322[_0xa67e('0x62')],'clientSecret':_0x202322['clientSecret']}});return _0x2f08de[_0xa67e('0x66')](_0x202322[_0xa67e('0x67')],_0x202322[_0xa67e('0x63')][_0xa67e('0x68')](_0x202322[_0xa67e('0x64')]));}})[_0xa67e('0x33')](function(_0x4af0b4){if(_0x4af0b4){if(!_[_0xa67e('0x69')](_0x4d208d['query']['ticketType'])){_0x38e232=_0x4d208d[_0xa67e('0x3e')][_0xa67e('0x6a')];}return _0x2f08de[_0xa67e('0x6b')](_0x38e232)[_0xa67e('0x6c')]();}})[_0xa67e('0x33')](function(_0x20a28d){var _0x2a0e9e=['CallDisposition',_0xa67e('0x6d'),_0xa67e('0x6e'),_0xa67e('0x6f'),_0xa67e('0x70'),'Priority','Status',_0xa67e('0x71')];if(!_[_0xa67e('0x69')](_0x4d208d[_0xa67e('0x3e')][_0xa67e('0x6a')])&&_0x4d208d[_0xa67e('0x3e')]['ticketType']==='Case'){_0x2a0e9e=['Type',_0xa67e('0x72'),_0xa67e('0x73'),'Status',_0xa67e('0x74'),_0xa67e('0x75'),_0xa67e('0x76'),_0xa67e('0x77')];}if(_0x20a28d){_[_0xa67e('0x78')](_0x20a28d[_0xa67e('0x40')],function(_0x1af21d){return _0x1af21d[_0xa67e('0x79')]===![]&&!_0x2a0e9e[_0xa67e('0x7a')](_0x1af21d[_0xa67e('0x36')]);});return{'count':_0x20a28d[_0xa67e('0x40')]['length'],'rows':_['map'](_0x20a28d[_0xa67e('0x40')],function(_0x28a14e){return{'id':_0x28a14e[_0xa67e('0x36')],'name':_0x28a14e[_0xa67e('0x7b')],'custom':_0x28a14e['custom'],'options':_0x28a14e['picklistValues'][_0xa67e('0x42')]>0x0?_[_0xa67e('0x38')](_0x28a14e[_0xa67e('0x7c')],function(_0x2b420f){return{'name':_0x2b420f[_0xa67e('0x7b')],'value':_0x2b420f['value']};}):_0x28a14e[_0xa67e('0x3b')]==_0xa67e('0x7d')?[{'name':_0xa67e('0x7e'),'value':_0xa67e('0x7f')},{'name':_0xa67e('0x80'),'value':_0xa67e('0x81')}]:[]};})};}})[_0xa67e('0x33')](respondWithResult(_0x1bb981,null))[_0xa67e('0x29')](function(_0x4adcaf){var _0x160a7a=_0x4d208d[_0xa67e('0x3e')][_0xa67e('0x1a')]?0x1f4:_0x4adcaf[_0xa67e('0x82')]||0x1f4;logger['error'](_0xa67e('0x83'),_0xa67e('0x5f'),_0x160a7a,JSON[_0xa67e('0x24')](_0x4adcaf));delete _0x4adcaf[_0xa67e('0x36')];if(_0x160a7a===0x191){_0x160a7a=0x190;}_0x1bb981['status'](_0x160a7a)['send'](_0x4d208d[_0xa67e('0x3e')][_0xa67e('0x1a')]?{'message':_0xa67e('0x84'),'statusCode':_0x4adcaf[_0xa67e('0x82')]}:_0x4adcaf);});}; \ No newline at end of file +var _0x5bd0=['where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','keys','intersection','create','body','find','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','Connection','login','concat','securityToken','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','Status','Type','Case','Origin','Reason','Priority','IsEscalated','SuppliedCompany','remove','custom','includes','length','picklistValues','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','attributes','fields','sort'];(function(_0x7d324f,_0x33cd55){var _0x4c54db=function(_0xf6a52c){while(--_0xf6a52c){_0x7d324f['push'](_0x7d324f['shift']());}};_0x4c54db(++_0x33cd55);}(_0x5bd0,0x1d7));var _0x05bd=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x5bd0[_0x48f7cf];return _0xc201c0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x05bd('0x0'));var jsonpatch=require(_0x05bd('0x1'));var rp=require('request-promise');var moment=require(_0x05bd('0x2'));var BPromise=require(_0x05bd('0x3'));var Mustache=require(_0x05bd('0x4'));var util=require(_0x05bd('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x05bd('0x6'));var ejs=require(_0x05bd('0x7'));var fs=require('fs');var _=require(_0x05bd('0x8'));var squel=require(_0x05bd('0x9'));var crypto=require(_0x05bd('0xa'));var jsforce=require(_0x05bd('0xb'));var deskjs=require(_0x05bd('0xc'));var toCsv=require(_0x05bd('0x6'));var querystring=require('querystring');var Papa=require(_0x05bd('0xd'));var Redis=require(_0x05bd('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x05bd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05bd('0x10'))(_0x05bd('0x11'));var utils=require(_0x05bd('0x12'));var config=require(_0x05bd('0x13'));var db=require(_0x05bd('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x05bd('0x15'));var client=jayson['client'][_0x05bd('0x16')]({'port':0x232a});function checkPasswordPattern(_0x2d57b6,_0x63f8f5,_0x3c2081){if(_0x3c2081){var _0x3911ac=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3911ac[_0x05bd('0x17')](_0x63f8f5)){return _0x2d57b6;}else{throw new db['Sequelize'][(_0x05bd('0x18'))](_0x05bd('0x19'));}}else{return _0x2d57b6;}}function respondWithRpcPromise(_0x76fa10,_0x13bce0,_0x2cae58,_0x3ed20a){return new BPromise(function(_0x174a57,_0xf39cc5){var _0x328bac=_0x3ed20a||client;return _0x328bac[_0x05bd('0x1a')](_0x76fa10,_0x2cae58)['then'](function(_0x15889c){logger['info'](_0x05bd('0x1b'),_0x13bce0,'request\x20sent');logger[_0x05bd('0x1c')](_0x05bd('0x1d'),_0x13bce0,_0x05bd('0x1e'),JSON[_0x05bd('0x1f')](_0x15889c));if(_0x15889c['error']){if(_0x15889c['error'][_0x05bd('0x20')]===0x1f4){logger[_0x05bd('0x21')](_0x05bd('0x1b'),_0x13bce0,_0x15889c[_0x05bd('0x21')][_0x05bd('0x22')]);return _0xf39cc5(_0x15889c['error'][_0x05bd('0x22')]);}logger[_0x05bd('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x13bce0,_0x15889c[_0x05bd('0x21')][_0x05bd('0x22')]);return _0x174a57(_0x15889c[_0x05bd('0x21')]['message']);}else{logger[_0x05bd('0x23')](_0x05bd('0x1b'),_0x13bce0,_0x05bd('0x1e'));_0x174a57(_0x15889c[_0x05bd('0x24')][_0x05bd('0x22')]);}})[_0x05bd('0x25')](function(_0x4bc2bd){logger[_0x05bd('0x21')](_0x05bd('0x1b'),_0x13bce0,_0x4bc2bd);_0xf39cc5(_0x4bc2bd);});});}function respondWithStatusCode(_0x7c1202,_0x2adeda){_0x2adeda=_0x2adeda||0xcc;return function(_0x12f988){if(_0x12f988){return _0x7c1202[_0x05bd('0x26')](_0x2adeda);}return _0x7c1202[_0x05bd('0x27')](_0x2adeda)[_0x05bd('0x28')]();};}function respondWithResult(_0x3039e2,_0x451501){_0x451501=_0x451501||0xc8;return function(_0x2bc00e){if(_0x2bc00e){return _0x3039e2[_0x05bd('0x27')](_0x451501)['json'](_0x2bc00e);}};}function respondWithFilteredResult(_0x85e032,_0x102ce5){return function(_0x2f349d){if(_0x2f349d){var _0x5e8559=_0x2f349d[_0x05bd('0x29')],_0x52f214=_0x102ce5['offset'],_0x28082f=_0x102ce5[_0x05bd('0x2a')]+_0x102ce5[_0x05bd('0x2b')],_0x32dc42;if(_0x28082f>=_0x5e8559){_0x28082f=_0x5e8559;_0x32dc42=0xc8;}else{_0x32dc42=0xce;}_0x85e032[_0x05bd('0x27')](_0x32dc42);return _0x85e032['set'](_0x05bd('0x2c'),_0x52f214+'-'+_0x28082f+'/'+_0x5e8559)['json'](_0x2f349d);}return null;};}function patchUpdates(_0xbf72ea){return function(_0x49dd8a){try{jsonpatch[_0x05bd('0x2d')](_0x49dd8a,_0xbf72ea,!![]);}catch(_0x5a2529){return BPromise[_0x05bd('0x2e')](_0x5a2529);}return _0x49dd8a[_0x05bd('0x2f')]();};}function saveUpdates(_0x40bfea,_0x2bda43){return function(_0x4b5a12){if(_0x4b5a12){return _0x4b5a12[_0x05bd('0x30')](_0x40bfea)[_0x05bd('0x31')](function(_0x1aeb00){return _0x1aeb00;});}return null;};}function removeEntity(_0x4733b8,_0x5288f9){return function(_0xe69a98){if(_0xe69a98){return _0xe69a98[_0x05bd('0x32')]()[_0x05bd('0x31')](function(){_0x4733b8[_0x05bd('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8fba,_0x5513ea){return function(_0x4c7c50){if(!_0x4c7c50){_0x5e8fba['sendStatus'](0x194);}return _0x4c7c50;};}function handleError(_0x2f793c,_0x5b50f2){_0x5b50f2=_0x5b50f2||0x1f4;return function(_0x190e47){logger['error'](_0x190e47[_0x05bd('0x33')]);if(_0x190e47['name']){delete _0x190e47[_0x05bd('0x34')];}_0x2f793c[_0x05bd('0x27')](_0x5b50f2)[_0x05bd('0x35')](_0x190e47);};}exports[_0x05bd('0x36')]=function(_0x28e3c5,_0x3d1020){var _0x6ee2da={},_0x49fdcc={},_0x55c47f={'count':0x0,'rows':[]};var _0x5ad08f=_[_0x05bd('0x37')](db[_0x05bd('0x38')][_0x05bd('0x39')],function(_0x1c714f){return{'name':_0x1c714f[_0x05bd('0x3a')],'type':_0x1c714f[_0x05bd('0x3b')]['key']};});_0x49fdcc[_0x05bd('0x3c')]=_[_0x05bd('0x37')](_0x5ad08f,_0x05bd('0x34'));_0x49fdcc[_0x05bd('0x3d')]=_['keys'](_0x28e3c5['query']);_0x49fdcc['filters']=_['intersection'](_0x49fdcc[_0x05bd('0x3c')],_0x49fdcc['query']);_0x6ee2da[_0x05bd('0x3e')]=_['intersection'](_0x49fdcc['model'],qs[_0x05bd('0x3f')](_0x28e3c5[_0x05bd('0x3d')]['fields']));_0x6ee2da['attributes']=_0x6ee2da[_0x05bd('0x3e')]['length']?_0x6ee2da['attributes']:_0x49fdcc[_0x05bd('0x3c')];if(!_0x28e3c5[_0x05bd('0x3d')]['hasOwnProperty']('nolimit')){_0x6ee2da['limit']=qs['limit'](_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x2b')]);_0x6ee2da[_0x05bd('0x2a')]=qs[_0x05bd('0x2a')](_0x28e3c5[_0x05bd('0x3d')]['offset']);}_0x6ee2da['order']=qs[_0x05bd('0x40')](_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x40')]);_0x6ee2da[_0x05bd('0x41')]=qs[_0x05bd('0x42')](_[_0x05bd('0x43')](_0x28e3c5[_0x05bd('0x3d')],_0x49fdcc[_0x05bd('0x42')]),_0x5ad08f);if(_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x44')]){_0x6ee2da['where']=_['merge'](_0x6ee2da[_0x05bd('0x41')],{'$or':_[_0x05bd('0x37')](_0x5ad08f,function(_0x3a03f6){if(_0x3a03f6['type']!==_0x05bd('0x45')){var _0x4308cb={};_0x4308cb[_0x3a03f6[_0x05bd('0x34')]]={'$like':'%'+_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x44')]+'%'};return _0x4308cb;}})});}_0x6ee2da=_[_0x05bd('0x46')]({},_0x6ee2da,_0x28e3c5[_0x05bd('0x47')]);var _0x1d4dc={'where':_0x6ee2da[_0x05bd('0x41')]};return db[_0x05bd('0x38')][_0x05bd('0x29')](_0x1d4dc)[_0x05bd('0x31')](function(_0x173f1f){_0x55c47f[_0x05bd('0x29')]=_0x173f1f;if(_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x48')]){_0x6ee2da[_0x05bd('0x49')]=[{'all':!![]}];}return db[_0x05bd('0x38')]['findAll'](_0x6ee2da);})[_0x05bd('0x31')](function(_0x4752ed){_0x55c47f['rows']=_0x4752ed;return _0x55c47f;})[_0x05bd('0x31')](respondWithFilteredResult(_0x3d1020,_0x6ee2da))[_0x05bd('0x25')](handleError(_0x3d1020,null));};exports[_0x05bd('0x4a')]=function(_0x3bec95,_0x135a53){var _0x4fde93={'raw':![],'where':{'id':_0x3bec95[_0x05bd('0x4b')]['id']}},_0xcd24aa={};_0xcd24aa[_0x05bd('0x3c')]=_[_0x05bd('0x4c')](db[_0x05bd('0x38')][_0x05bd('0x39')]);_0xcd24aa[_0x05bd('0x3d')]=_[_0x05bd('0x4c')](_0x3bec95[_0x05bd('0x3d')]);_0xcd24aa[_0x05bd('0x42')]=_[_0x05bd('0x4d')](_0xcd24aa[_0x05bd('0x3c')],_0xcd24aa[_0x05bd('0x3d')]);_0x4fde93['attributes']=_[_0x05bd('0x4d')](_0xcd24aa['model'],qs['fields'](_0x3bec95[_0x05bd('0x3d')][_0x05bd('0x3f')]));_0x4fde93[_0x05bd('0x3e')]=_0x4fde93[_0x05bd('0x3e')]['length']?_0x4fde93['attributes']:_0xcd24aa['model'];if(_0x3bec95[_0x05bd('0x3d')]['includeAll']){_0x4fde93[_0x05bd('0x49')]=[{'all':!![]}];}_0x4fde93=_['merge']({},_0x4fde93,_0x3bec95['options']);return db[_0x05bd('0x38')]['find'](_0x4fde93)['then'](handleEntityNotFound(_0x135a53,null))[_0x05bd('0x31')](respondWithResult(_0x135a53,null))[_0x05bd('0x25')](handleError(_0x135a53,null));};exports[_0x05bd('0x4e')]=function(_0x52c087,_0x17d3c7){return db[_0x05bd('0x38')][_0x05bd('0x4e')](_0x52c087['body'],{})['then'](respondWithResult(_0x17d3c7,0xc9))[_0x05bd('0x25')](handleError(_0x17d3c7,null));};exports[_0x05bd('0x30')]=function(_0x277d87,_0x1c9e87){if(_0x277d87[_0x05bd('0x4f')]['id']){delete _0x277d87[_0x05bd('0x4f')]['id'];}return db[_0x05bd('0x38')][_0x05bd('0x50')]({'where':{'id':_0x277d87[_0x05bd('0x4b')]['id']}})[_0x05bd('0x31')](handleEntityNotFound(_0x1c9e87,null))[_0x05bd('0x31')](saveUpdates(_0x277d87[_0x05bd('0x4f')],null))[_0x05bd('0x31')](respondWithResult(_0x1c9e87,null))[_0x05bd('0x25')](handleError(_0x1c9e87,null));};exports['destroy']=function(_0x464e82,_0x134aba){return db['SalesforceAccount']['find']({'where':{'id':_0x464e82[_0x05bd('0x4b')]['id']}})[_0x05bd('0x31')](handleEntityNotFound(_0x134aba,null))['then'](removeEntity(_0x134aba,null))['catch'](handleError(_0x134aba,null));};exports[_0x05bd('0x51')]=function(_0x4305b0,_0x286eb4,_0xb1a80){var _0xbe6d38={};var _0x5b70ad={};var _0x166d98;var _0x101321;return db['SalesforceAccount'][_0x05bd('0x52')]({'where':{'id':_0x4305b0[_0x05bd('0x4b')]['id']}})[_0x05bd('0x31')](handleEntityNotFound(_0x286eb4,null))['then'](function(_0x22008d){if(_0x22008d){_0x166d98=_0x22008d;_0x5b70ad[_0x05bd('0x3c')]=_[_0x05bd('0x4c')](db[_0x05bd('0x53')]['rawAttributes']);_0x5b70ad[_0x05bd('0x3d')]=_[_0x05bd('0x4c')](_0x4305b0[_0x05bd('0x3d')]);_0x5b70ad['filters']=_[_0x05bd('0x4d')](_0x5b70ad[_0x05bd('0x3c')],_0x5b70ad[_0x05bd('0x3d')]);_0xbe6d38[_0x05bd('0x3e')]=_[_0x05bd('0x4d')](_0x5b70ad['model'],qs[_0x05bd('0x3f')](_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x3f')]));_0xbe6d38['attributes']=_0xbe6d38[_0x05bd('0x3e')]['length']?_0xbe6d38[_0x05bd('0x3e')]:_0x5b70ad[_0x05bd('0x3c')];_0xbe6d38['order']=qs['sort'](_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x40')]);_0xbe6d38[_0x05bd('0x41')]=qs[_0x05bd('0x42')](_[_0x05bd('0x43')](_0x4305b0['query'],_0x5b70ad[_0x05bd('0x42')]));if(_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x44')]){_0xbe6d38[_0x05bd('0x41')]=_[_0x05bd('0x46')](_0xbe6d38[_0x05bd('0x41')],{'$or':_['map'](_0xbe6d38[_0x05bd('0x3e')],function(_0x57a61d){var _0x51adaf={};_0x51adaf[_0x57a61d]={'$like':'%'+_0x4305b0['query'][_0x05bd('0x44')]+'%'};return _0x51adaf;})});}_0xbe6d38=_[_0x05bd('0x46')]({},_0xbe6d38,_0x4305b0['options']);return _0x166d98[_0x05bd('0x51')](_0xbe6d38);}})[_0x05bd('0x31')](function(_0x165d30){if(_0x165d30){_0x101321=_0x165d30['length'];if(!_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x54')](_0x05bd('0x55'))){_0xbe6d38['limit']=qs[_0x05bd('0x2b')](_0x4305b0['query'][_0x05bd('0x2b')]);_0xbe6d38[_0x05bd('0x2a')]=qs[_0x05bd('0x2a')](_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x2a')]);}return _0x166d98['getConfigurations'](_0xbe6d38);}})[_0x05bd('0x31')](function(_0x153a24){if(_0x153a24){return _0x153a24?{'count':_0x101321,'rows':_0x153a24}:null;}})[_0x05bd('0x31')](respondWithResult(_0x286eb4,null))[_0x05bd('0x25')](handleError(_0x286eb4,null));};exports[_0x05bd('0x56')]=function(_0x1560ae,_0x483028,_0x27c502){if(_0x1560ae[_0x05bd('0x4f')]['id']){delete _0x1560ae[_0x05bd('0x4f')]['id'];}return db[_0x05bd('0x38')]['findOne']({'where':{'id':_0x1560ae[_0x05bd('0x4b')]['id']}})[_0x05bd('0x31')](handleEntityNotFound(_0x483028,null))[_0x05bd('0x31')](function(_0x4dfdae){if(_0x4dfdae){_0x1560ae[_0x05bd('0x4f')]['AccountId']=_0x4dfdae['id'];_0x1560ae['body'][_0x05bd('0x57')]=integrations[_0x05bd('0x58')](_0x1560ae[_0x05bd('0x4f')]['channel'],_0x1560ae['body'][_0x05bd('0x3b')]);_0x1560ae[_0x05bd('0x4f')][_0x05bd('0x59')]=integrations[_0x05bd('0x5a')](_0x1560ae[_0x05bd('0x4f')][_0x05bd('0x5b')],_0x1560ae[_0x05bd('0x4f')][_0x05bd('0x3b')]);return db['SalesforceConfiguration'][_0x05bd('0x4e')](_0x1560ae[_0x05bd('0x4f')],{'include':[{'model':db[_0x05bd('0x5c')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x05bd('0x59')}]});}return null;})[_0x05bd('0x31')](respondWithResult(_0x483028,null))[_0x05bd('0x25')](handleError(_0x483028,null));};exports[_0x05bd('0x5d')]=function(_0x54e580,_0x32d5ac,_0x1be3b5){var _0x5bacc3;var _0x5269c0='';var _0x1cce3c=_0x05bd('0x5e');return db['SalesforceAccount'][_0x05bd('0x52')]({'where':{'id':_0x54e580['params']['id']},'attributes':['id',_0x05bd('0x5f'),_0x05bd('0x60'),_0x05bd('0x61'),_0x05bd('0x62'),_0x05bd('0x63'),'securityToken']})[_0x05bd('0x31')](handleEntityNotFound(_0x32d5ac,null))[_0x05bd('0x31')](function(_0x51c89c){if(_0x51c89c){_0x5269c0=_0x51c89c[_0x05bd('0x5f')];var _0x5aad37=_0x5269c0[_0x05bd('0x64')](-0x1);if(_0x5aad37==='/'){_0x5269c0=_0x5269c0[_0x05bd('0x65')](0x0,_0x5269c0['lastIndexOf'](_0x5aad37));}_0x5bacc3=new jsforce[(_0x05bd('0x66'))]({'oauth2':{'loginUrl':_0x5269c0,'clientId':_0x51c89c[_0x05bd('0x60')],'clientSecret':_0x51c89c[_0x05bd('0x61')]}});return _0x5bacc3[_0x05bd('0x67')](_0x51c89c[_0x05bd('0x62')],_0x51c89c[_0x05bd('0x63')][_0x05bd('0x68')](_0x51c89c[_0x05bd('0x69')]));}})[_0x05bd('0x31')](function(_0x12f9e1){if(_0x12f9e1){if(!_[_0x05bd('0x6a')](_0x54e580[_0x05bd('0x3d')][_0x05bd('0x6b')])){_0x1cce3c=_0x54e580[_0x05bd('0x3d')][_0x05bd('0x6b')];}return _0x5bacc3[_0x05bd('0x6c')](_0x1cce3c)['describe']();}})[_0x05bd('0x31')](function(_0x16334a){var _0x3a715b=[_0x05bd('0x6d'),_0x05bd('0x6e'),_0x05bd('0x6f'),'CallType','IsArchived','Priority',_0x05bd('0x70'),_0x05bd('0x71')];if(!_['isNil'](_0x54e580[_0x05bd('0x3d')]['ticketType'])&&_0x54e580['query'][_0x05bd('0x6b')]===_0x05bd('0x72')){_0x3a715b=[_0x05bd('0x71'),_0x05bd('0x73'),_0x05bd('0x74'),_0x05bd('0x70'),_0x05bd('0x75'),_0x05bd('0x76'),'SuppliedName',_0x05bd('0x77')];}if(_0x16334a){_[_0x05bd('0x78')](_0x16334a[_0x05bd('0x3f')],function(_0x2351d0){return _0x2351d0[_0x05bd('0x79')]===![]&&!_0x3a715b[_0x05bd('0x7a')](_0x2351d0['name']);});return{'count':_0x16334a[_0x05bd('0x3f')][_0x05bd('0x7b')],'rows':_['map'](_0x16334a[_0x05bd('0x3f')],function(_0x588ab4){return{'id':_0x588ab4['name'],'name':_0x588ab4['label'],'custom':_0x588ab4[_0x05bd('0x79')],'options':_0x588ab4[_0x05bd('0x7c')][_0x05bd('0x7b')]>0x0?_['map'](_0x588ab4[_0x05bd('0x7c')],function(_0x56d0c9){return{'name':_0x56d0c9['label'],'value':_0x56d0c9[_0x05bd('0x7d')]};}):_0x588ab4[_0x05bd('0x3b')]==_0x05bd('0x7e')?[{'name':_0x05bd('0x7f'),'value':_0x05bd('0x80')},{'name':_0x05bd('0x81'),'value':_0x05bd('0x82')}]:[]};})};}})[_0x05bd('0x31')](respondWithResult(_0x32d5ac,null))[_0x05bd('0x25')](function(_0x2cc476){var _0x38650d=_0x54e580[_0x05bd('0x3d')]['test']?0x1f4:_0x2cc476[_0x05bd('0x83')]||0x1f4;logger['error'](_0x05bd('0x84'),_0x05bd('0x5d'),_0x38650d,JSON['stringify'](_0x2cc476));delete _0x2cc476[_0x05bd('0x34')];if(_0x38650d===0x191){_0x38650d=0x190;}_0x32d5ac[_0x05bd('0x27')](_0x38650d)[_0x05bd('0x35')](_0x54e580[_0x05bd('0x3d')]['test']?{'message':_0x05bd('0x85'),'statusCode':_0x2cc476[_0x05bd('0x83')]}:_0x2cc476);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a227a2c..c5bdafa 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 _0x9c66=['moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','api'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0x9c66,0x1c1));var _0x69c6=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x9c66[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x69c6('0x0'));var moment=require(_0x69c6('0x1'));var BPromise=require(_0x69c6('0x2'));var rp=require(_0x69c6('0x3'));var fs=require('fs');var path=require(_0x69c6('0x4'));var rimraf=require(_0x69c6('0x5'));var config=require('../../config/environment');var attributes=require(_0x69c6('0x6'));var integrations=require(_0x69c6('0x7'));module['exports']=function(_0x526217,_0x51df3c){return _0x526217['define'](_0x69c6('0x8'),attributes,{'tableName':_0x69c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbac3=['./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x141dd0,_0x13f015){var _0x41aa2a=function(_0x51213d){while(--_0x51213d){_0x141dd0['push'](_0x141dd0['shift']());}};_0x41aa2a(++_0x13f015);}(_0xbac3,0x1f0));var _0x3bac=function(_0x3303fb,_0x1266dd){_0x3303fb=_0x3303fb-0x0;var _0x71a686=_0xbac3[_0x3303fb];return _0x71a686;};'use strict';var _=require(_0x3bac('0x0'));var util=require(_0x3bac('0x1'));var logger=require('../../config/logger')(_0x3bac('0x2'));var moment=require(_0x3bac('0x3'));var BPromise=require('bluebird');var rp=require(_0x3bac('0x4'));var fs=require('fs');var path=require(_0x3bac('0x5'));var rimraf=require(_0x3bac('0x6'));var config=require(_0x3bac('0x7'));var attributes=require(_0x3bac('0x8'));var integrations=require(_0x3bac('0x9'));module[_0x3bac('0xa')]=function(_0x2b1868,_0x2e10de){return _0x2b1868[_0x3bac('0xb')](_0x3bac('0xc'),attributes,{'tableName':_0x3bac('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 3a1bbea..1d80439 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 _0x222f=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','debug','find','where','ShowSalesforceAccount'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x222f,0x1a4));var _0xf222=function(_0x87d3ec,_0x387888){_0x87d3ec=_0x87d3ec-0x0;var _0x5f3f6f=_0x222f[_0x87d3ec];return _0x5f3f6f;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});}exports[_0xf222('0x16')]=function(_0x8783ab){var _0xfb4ddf=this;return new Promise(function(_0x12a2e4,_0x1e57ee){return db[_0xf222('0x17')]['findAll']({'raw':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x8783ab[_0xf222('0x18')]?_0x8783ab['options']['where']||null:null,'attributes':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'limit':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1b')]||null:null,'include':_0x8783ab['options']?_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')],function(_0x2d18ab){return{'model':db[_0x2d18ab[_0xf222('0x1e')]],'as':_0x2d18ab['as'],'attributes':_0x2d18ab[_0xf222('0x1a')],'include':_0x2d18ab['include']?_[_0xf222('0x1d')](_0x2d18ab[_0xf222('0x1c')],function(_0x1883c1){return{'model':db[_0x1883c1[_0xf222('0x1e')]],'as':_0x1883c1['as'],'attributes':_0x1883c1[_0xf222('0x1a')],'include':_0x1883c1[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x1883c1[_0xf222('0x1c')],function(_0x15bf4e){return{'model':db[_0x15bf4e[_0xf222('0x1e')]],'as':_0x15bf4e['as'],'attributes':_0x15bf4e[_0xf222('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b2b1){logger[_0xf222('0xc')](_0xf222('0x16'),_0x8783ab);logger[_0xf222('0x1f')](_0xf222('0x16'),_0x8783ab,JSON[_0xf222('0x10')](_0x14b2b1));_0x12a2e4(_0x14b2b1);})[_0xf222('0x15')](function(_0x1b928b){logger[_0xf222('0x11')]('GetSalesforceAccount',_0x1b928b[_0xf222('0x13')],_0x8783ab);_0x1e57ee(_0xfb4ddf[_0xf222('0x11')](0x1f4,_0x1b928b[_0xf222('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x3ccc9e){var _0x5d5963=this;return new Promise(function(_0x40c7e7,_0x27a8cc){return db[_0xf222('0x17')][_0xf222('0x20')]({'raw':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x3ccc9e['options']?_0x3ccc9e['options'][_0xf222('0x21')]||null:null,'attributes':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'include':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')]['include']?_[_0xf222('0x1d')](_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1c')],function(_0x57c862){return{'model':db[_0x57c862[_0xf222('0x1e')]],'as':_0x57c862['as'],'attributes':_0x57c862[_0xf222('0x1a')],'include':_0x57c862[_0xf222('0x1c')]?_['map'](_0x57c862[_0xf222('0x1c')],function(_0x21e20a){return{'model':db[_0x21e20a[_0xf222('0x1e')]],'as':_0x21e20a['as'],'attributes':_0x21e20a['attributes'],'include':_0x21e20a[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x21e20a[_0xf222('0x1c')],function(_0x2b838c){return{'model':db[_0x2b838c[_0xf222('0x1e')]],'as':_0x2b838c['as'],'attributes':_0x2b838c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf222('0xb')](function(_0x542123){logger[_0xf222('0xc')](_0xf222('0x22'),_0x3ccc9e);logger[_0xf222('0x1f')]('ShowSalesforceAccount',_0x3ccc9e,JSON[_0xf222('0x10')](_0x542123));_0x40c7e7(_0x542123);})[_0xf222('0x15')](function(_0x54a10d){logger[_0xf222('0x11')]('ShowSalesforceAccount',_0x54a10d[_0xf222('0x13')],_0x3ccc9e);_0x27a8cc(_0x5d5963[_0xf222('0x11')](0x1f4,_0x54a10d[_0xf222('0x13')]));});});}; \ No newline at end of file +var _0x579c=['error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','include','map','model','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x177b82,_0x57d19e){var _0x54163a=function(_0x48c09a){while(--_0x48c09a){_0x177b82['push'](_0x177b82['shift']());}};_0x54163a(++_0x57d19e);}(_0x579c,0xda));var _0xc579=function(_0xce5f43,_0x2820b8){_0xce5f43=_0xce5f43-0x0;var _0x4d07ed=_0x579c[_0xce5f43];return _0x4d07ed;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});}exports[_0xc579('0x18')]=function(_0x33d341){var _0xbbbe3e=this;return new Promise(function(_0x3da8a1,_0xa41248){return db[_0xc579('0x19')]['findAll']({'raw':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1b')]||null:null,'attributes':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'limit':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['limit']||null:null,'include':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x33d341[_0xc579('0x1a')]['include'],function(_0x3634f2){return{'model':db[_0x3634f2[_0xc579('0x1f')]],'as':_0x3634f2['as'],'attributes':_0x3634f2[_0xc579('0x1c')],'include':_0x3634f2['include']?_[_0xc579('0x1e')](_0x3634f2['include'],function(_0x4610c2){return{'model':db[_0x4610c2[_0xc579('0x1f')]],'as':_0x4610c2['as'],'attributes':_0x4610c2[_0xc579('0x1c')],'include':_0x4610c2['include']?_[_0xc579('0x1e')](_0x4610c2['include'],function(_0x532b33){return{'model':db[_0x532b33['model']],'as':_0x532b33['as'],'attributes':_0x532b33[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0xfdbb73){logger[_0xc579('0xe')](_0xc579('0x18'),_0x33d341);logger[_0xc579('0x10')](_0xc579('0x18'),_0x33d341,JSON['stringify'](_0xfdbb73));_0x3da8a1(_0xfdbb73);})['catch'](function(_0x4a5f6){logger['error'](_0xc579('0x18'),_0x4a5f6[_0xc579('0x16')],_0x33d341);_0xa41248(_0xbbbe3e[_0xc579('0x14')](0x1f4,_0x4a5f6[_0xc579('0x16')]));});});};exports[_0xc579('0x20')]=function(_0x156bf5){var _0x45e6a3=this;return new Promise(function(_0x133d08,_0x49b48f){return db[_0xc579('0x19')][_0xc579('0x21')]({'raw':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x156bf5['options']?_0x156bf5[_0xc579('0x1a')]['where']||null:null,'attributes':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'include':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['include']?_[_0xc579('0x1e')](_0x156bf5['options'][_0xc579('0x1d')],function(_0x473000){return{'model':db[_0x473000['model']],'as':_0x473000['as'],'attributes':_0x473000[_0xc579('0x1c')],'include':_0x473000[_0xc579('0x1d')]?_['map'](_0x473000['include'],function(_0x37bce9){return{'model':db[_0x37bce9[_0xc579('0x1f')]],'as':_0x37bce9['as'],'attributes':_0x37bce9['attributes'],'include':_0x37bce9[_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x37bce9['include'],function(_0x32589a){return{'model':db[_0x32589a['model']],'as':_0x32589a['as'],'attributes':_0x32589a[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0x5c6f38){logger[_0xc579('0xe')](_0xc579('0x20'),_0x156bf5);logger[_0xc579('0x10')](_0xc579('0x20'),_0x156bf5,JSON[_0xc579('0x13')](_0x5c6f38));_0x133d08(_0x5c6f38);})[_0xc579('0x17')](function(_0x59ae89){logger[_0xc579('0x14')](_0xc579('0x20'),_0x59ae89['message'],_0x156bf5);_0x49b48f(_0x45e6a3[_0xc579('0x14')](0x1f4,_0x59ae89[_0xc579('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5a96bb1..086bffd 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 _0x15ac=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','multer','util'];(function(_0x92354d,_0xcbd1ac){var _0x57f449=function(_0x19658f){while(--_0x19658f){_0x92354d['push'](_0x92354d['shift']());}};_0x57f449(++_0xcbd1ac);}(_0x15ac,0xda));var _0xc15a=function(_0xf40a8a,_0x4474b2){_0xf40a8a=_0xf40a8a-0x0;var _0x13f1c4=_0x15ac[_0xf40a8a];return _0x13f1c4;};'use strict';var multer=require(_0xc15a('0x0'));var util=require(_0xc15a('0x1'));var path=require('path');var timeout=require(_0xc15a('0x2'));var express=require(_0xc15a('0x3'));var router=express[_0xc15a('0x4')]();var auth=require(_0xc15a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc15a('0x6'));var controller=require(_0xc15a('0x7'));router[_0xc15a('0x8')]('/',auth['isAuthenticated'](),controller[_0xc15a('0x9')]);router['get'](_0xc15a('0xa'),auth[_0xc15a('0xb')](),controller[_0xc15a('0xc')]);router[_0xc15a('0x8')](_0xc15a('0xd'),auth['isAuthenticated'](),controller[_0xc15a('0xe')]);router[_0xc15a('0x8')](_0xc15a('0xf'),auth[_0xc15a('0xb')](),controller['getSubjects']);router[_0xc15a('0x8')](_0xc15a('0x10'),auth[_0xc15a('0xb')](),controller[_0xc15a('0x11')]);router[_0xc15a('0x12')]('/',auth[_0xc15a('0xb')](),controller[_0xc15a('0x13')]);router['put'](_0xc15a('0xa'),auth[_0xc15a('0xb')](),controller['update']);router[_0xc15a('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc15a('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd81f=['/:id/descriptions','getDescriptions','create','put','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xd81f,0xaf));var _0xfd81=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xd81f[_0x1bc013];return _0x55df36;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfd81('0x0'));var express=require(_0xfd81('0x1'));var router=express[_0xfd81('0x2')]();var auth=require(_0xfd81('0x3'));var interaction=require(_0xfd81('0x4'));var config=require(_0xfd81('0x5'));var controller=require(_0xfd81('0x6'));router[_0xfd81('0x7')]('/',auth[_0xfd81('0x8')](),controller[_0xfd81('0x9')]);router[_0xfd81('0x7')](_0xfd81('0xa'),auth[_0xfd81('0x8')](),controller[_0xfd81('0xb')]);router[_0xfd81('0x7')](_0xfd81('0xc'),auth[_0xfd81('0x8')](),controller[_0xfd81('0xd')]);router[_0xfd81('0x7')]('/:id/subjects',auth[_0xfd81('0x8')](),controller['getSubjects']);router[_0xfd81('0x7')](_0xfd81('0xe'),auth[_0xfd81('0x8')](),controller[_0xfd81('0xf')]);router['post']('/',auth[_0xfd81('0x8')](),controller[_0xfd81('0x10')]);router[_0xfd81('0x11')](_0xfd81('0xa'),auth[_0xfd81('0x8')](),controller[_0xfd81('0x12')]);router['delete']('/:id',auth[_0xfd81('0x8')](),controller[_0xfd81('0x13')]);module[_0xfd81('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index d3aaff2..1997c40 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 _0x3da7=['ENUM','Task','contact_lead','lead','nothing','contact','STRING'];(function(_0x26fbce,_0x2bf009){var _0x1871d2=function(_0x533094){while(--_0x533094){_0x26fbce['push'](_0x26fbce['shift']());}};_0x1871d2(++_0x2bf009);}(_0x3da7,0x1aa));var _0x73da=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x3da7[_0x34ad72];return _0x5c9aa8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x73da('0x0')]},'description':{'type':Sequelize[_0x73da('0x0')]},'ticketType':{'type':Sequelize[_0x73da('0x1')](_0x73da('0x2'),'Case'),'defaultValue':_0x73da('0x2')},'moduleSearch':{'type':Sequelize[_0x73da('0x1')](_0x73da('0x3'),'contact',_0x73da('0x4')),'defaultValue':_0x73da('0x3')},'moduleCreate':{'type':Sequelize[_0x73da('0x1')](_0x73da('0x5'),_0x73da('0x6'),_0x73da('0x4')),'defaultValue':'lead'}}; \ No newline at end of file +var _0x9623=['Task','Case','contact_lead','contact','nothing','lead','sequelize','exports','STRING','ENUM'];(function(_0x5b065e,_0x51d0d2){var _0x1afd26=function(_0x33b3ee){while(--_0x33b3ee){_0x5b065e['push'](_0x5b065e['shift']());}};_0x1afd26(++_0x51d0d2);}(_0x9623,0x1a0));var _0x3962=function(_0x180e7b,_0x599496){_0x180e7b=_0x180e7b-0x0;var _0x328f56=_0x9623[_0x180e7b];return _0x328f56;};'use strict';var Sequelize=require(_0x3962('0x0'));module[_0x3962('0x1')]={'name':{'type':Sequelize[_0x3962('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x3962('0x3')](_0x3962('0x4'),_0x3962('0x5')),'defaultValue':_0x3962('0x4')},'moduleSearch':{'type':Sequelize[_0x3962('0x3')](_0x3962('0x6'),_0x3962('0x7'),'lead'),'defaultValue':_0x3962('0x6')},'moduleCreate':{'type':Sequelize[_0x3962('0x3')](_0x3962('0x8'),'contact',_0x3962('0x9')),'defaultValue':_0x3962('0x9')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4bc80e8..a4a5d9d 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 _0x64d9=['mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','SalesforceConfiguration','count','include','findAll','show','keys','includeAll','find','create','body','update','params','destroy','getFields','order','nolimit','SalesforceField','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x64d9,0x1d9));var _0x964d=function(_0x2c8d38,_0x3aaa34){_0x2c8d38=_0x2c8d38-0x0;var _0xf9c6fd=_0x64d9[_0x2c8d38];return _0xf9c6fd;};'use strict';var pdf=require(_0x964d('0x0'));var emlformat=require(_0x964d('0x1'));var rimraf=require(_0x964d('0x2'));var zipdir=require(_0x964d('0x3'));var jsonpatch=require(_0x964d('0x4'));var rp=require('request-promise');var moment=require(_0x964d('0x5'));var BPromise=require(_0x964d('0x6'));var Mustache=require(_0x964d('0x7'));var util=require(_0x964d('0x8'));var path=require(_0x964d('0x9'));var sox=require(_0x964d('0xa'));var csv=require('to-csv');var ejs=require(_0x964d('0xb'));var fs=require('fs');var _=require(_0x964d('0xc'));var squel=require('squel');var crypto=require(_0x964d('0xd'));var jsforce=require(_0x964d('0xe'));var deskjs=require(_0x964d('0xf'));var toCsv=require(_0x964d('0x10'));var querystring=require(_0x964d('0x11'));var Papa=require(_0x964d('0x12'));var Redis=require(_0x964d('0x13'));var authService=require(_0x964d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x964d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x964d('0x16'))(_0x964d('0x17'));var utils=require(_0x964d('0x18'));var config=require(_0x964d('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x964d('0x1a'));var client=jayson[_0x964d('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x496ed3,_0xcfd583,_0x315ee5){if(_0x315ee5){var _0x42ca54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42ca54['test'](_0xcfd583)){return _0x496ed3;}else{throw new db[(_0x964d('0x1c'))]['ValidationError'](_0x964d('0x1d'));}}else{return _0x496ed3;}}function respondWithRpcPromise(_0x3fb4de,_0x222361,_0x3e0971,_0x4c929d){return new BPromise(function(_0x4aef26,_0x27d5c8){var _0x53fe3c=_0x4c929d||client;return _0x53fe3c[_0x964d('0x1e')](_0x3fb4de,_0x3e0971)['then'](function(_0x4e44e2){logger[_0x964d('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x222361,_0x964d('0x20'));logger['debug'](_0x964d('0x21'),_0x222361,'request\x20sent',JSON[_0x964d('0x22')](_0x4e44e2));if(_0x4e44e2['error']){if(_0x4e44e2[_0x964d('0x23')]['code']===0x1f4){logger[_0x964d('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x222361,_0x4e44e2[_0x964d('0x23')]['message']);return _0x27d5c8(_0x4e44e2[_0x964d('0x23')][_0x964d('0x24')]);}logger['error'](_0x964d('0x25'),_0x222361,_0x4e44e2[_0x964d('0x23')][_0x964d('0x24')]);return _0x4aef26(_0x4e44e2['error']['message']);}else{logger[_0x964d('0x1f')](_0x964d('0x25'),_0x222361,_0x964d('0x20'));_0x4aef26(_0x4e44e2[_0x964d('0x26')]['message']);}})[_0x964d('0x27')](function(_0x4f971e){logger[_0x964d('0x23')](_0x964d('0x25'),_0x222361,_0x4f971e);_0x27d5c8(_0x4f971e);});});}function respondWithStatusCode(_0x2a9492,_0xfec22c){_0xfec22c=_0xfec22c||0xcc;return function(_0x45179e){if(_0x45179e){return _0x2a9492[_0x964d('0x28')](_0xfec22c);}return _0x2a9492[_0x964d('0x29')](_0xfec22c)[_0x964d('0x2a')]();};}function respondWithResult(_0x5cfb2e,_0x2da5a0){_0x2da5a0=_0x2da5a0||0xc8;return function(_0x23dfb6){if(_0x23dfb6){return _0x5cfb2e['status'](_0x2da5a0)[_0x964d('0x2b')](_0x23dfb6);}};}function respondWithFilteredResult(_0x31fc1c,_0x5dbb5c){return function(_0x30f835){if(_0x30f835){var _0x419961=_0x30f835['count'],_0x23ff9d=_0x5dbb5c[_0x964d('0x2c')],_0x5c7471=_0x5dbb5c[_0x964d('0x2c')]+_0x5dbb5c[_0x964d('0x2d')],_0x24adac;if(_0x5c7471>=_0x419961){_0x5c7471=_0x419961;_0x24adac=0xc8;}else{_0x24adac=0xce;}_0x31fc1c['status'](_0x24adac);return _0x31fc1c[_0x964d('0x2e')](_0x964d('0x2f'),_0x23ff9d+'-'+_0x5c7471+'/'+_0x419961)[_0x964d('0x2b')](_0x30f835);}return null;};}function patchUpdates(_0x428259){return function(_0x4a0406){try{jsonpatch[_0x964d('0x30')](_0x4a0406,_0x428259,!![]);}catch(_0x4b580e){return BPromise[_0x964d('0x31')](_0x4b580e);}return _0x4a0406[_0x964d('0x32')]();};}function saveUpdates(_0x542a8b,_0x58620d){return function(_0x217eae){if(_0x217eae){return _0x217eae['update'](_0x542a8b)[_0x964d('0x33')](function(_0x5d68de){return _0x5d68de;});}return null;};}function removeEntity(_0x54a28a,_0x2b8bf1){return function(_0x410cd4){if(_0x410cd4){return _0x410cd4['destroy']()[_0x964d('0x33')](function(){_0x54a28a[_0x964d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x166e72,_0x19e770){return function(_0x23317c){if(!_0x23317c){_0x166e72[_0x964d('0x28')](0x194);}return _0x23317c;};}function handleError(_0x18e785,_0x1e14d8){_0x1e14d8=_0x1e14d8||0x1f4;return function(_0x106a22){logger[_0x964d('0x23')](_0x106a22[_0x964d('0x34')]);if(_0x106a22['name']){delete _0x106a22[_0x964d('0x35')];}_0x18e785['status'](_0x1e14d8)[_0x964d('0x36')](_0x106a22);};}exports[_0x964d('0x37')]=function(_0x200cda,_0x42b51d){var _0x13f501={},_0x289c26={},_0xe904ff={'count':0x0,'rows':[]};var _0x75c7ae=_[_0x964d('0x38')](db['SalesforceConfiguration'][_0x964d('0x39')],function(_0x59d9e0){return{'name':_0x59d9e0[_0x964d('0x3a')],'type':_0x59d9e0['type'][_0x964d('0x3b')]};});_0x289c26[_0x964d('0x3c')]=_[_0x964d('0x38')](_0x75c7ae,_0x964d('0x35'));_0x289c26[_0x964d('0x3d')]=_['keys'](_0x200cda[_0x964d('0x3d')]);_0x289c26[_0x964d('0x3e')]=_[_0x964d('0x3f')](_0x289c26[_0x964d('0x3c')],_0x289c26[_0x964d('0x3d')]);_0x13f501[_0x964d('0x40')]=_[_0x964d('0x3f')](_0x289c26['model'],qs[_0x964d('0x41')](_0x200cda[_0x964d('0x3d')][_0x964d('0x41')]));_0x13f501[_0x964d('0x40')]=_0x13f501[_0x964d('0x40')][_0x964d('0x42')]?_0x13f501['attributes']:_0x289c26[_0x964d('0x3c')];if(!_0x200cda[_0x964d('0x3d')][_0x964d('0x43')]('nolimit')){_0x13f501[_0x964d('0x2d')]=qs[_0x964d('0x2d')](_0x200cda[_0x964d('0x3d')][_0x964d('0x2d')]);_0x13f501[_0x964d('0x2c')]=qs[_0x964d('0x2c')](_0x200cda[_0x964d('0x3d')][_0x964d('0x2c')]);}_0x13f501['order']=qs[_0x964d('0x44')](_0x200cda[_0x964d('0x3d')]['sort']);_0x13f501[_0x964d('0x45')]=qs[_0x964d('0x3e')](_[_0x964d('0x46')](_0x200cda[_0x964d('0x3d')],_0x289c26[_0x964d('0x3e')]),_0x75c7ae);if(_0x200cda['query'][_0x964d('0x47')]){_0x13f501[_0x964d('0x45')]=_[_0x964d('0x48')](_0x13f501[_0x964d('0x45')],{'$or':_[_0x964d('0x38')](_0x75c7ae,function(_0x520ac3){if(_0x520ac3[_0x964d('0x49')]!==_0x964d('0x4a')){var _0x4ebae6={};_0x4ebae6[_0x520ac3[_0x964d('0x35')]]={'$like':'%'+_0x200cda[_0x964d('0x3d')][_0x964d('0x47')]+'%'};return _0x4ebae6;}})});}_0x13f501=_[_0x964d('0x48')]({},_0x13f501,_0x200cda[_0x964d('0x4b')]);var _0x2edfc0={'where':_0x13f501[_0x964d('0x45')]};return db[_0x964d('0x4c')][_0x964d('0x4d')](_0x2edfc0)[_0x964d('0x33')](function(_0x106df2){_0xe904ff[_0x964d('0x4d')]=_0x106df2;if(_0x200cda[_0x964d('0x3d')]['includeAll']){_0x13f501[_0x964d('0x4e')]=[{'all':!![]}];}return db[_0x964d('0x4c')][_0x964d('0x4f')](_0x13f501);})[_0x964d('0x33')](function(_0x42e453){_0xe904ff['rows']=_0x42e453;return _0xe904ff;})[_0x964d('0x33')](respondWithFilteredResult(_0x42b51d,_0x13f501))[_0x964d('0x27')](handleError(_0x42b51d,null));};exports[_0x964d('0x50')]=function(_0x56cc64,_0x46f3fa){var _0x3053e4={'raw':![],'where':{'id':_0x56cc64['params']['id']}},_0x442c5d={};_0x442c5d[_0x964d('0x3c')]=_[_0x964d('0x51')](db[_0x964d('0x4c')][_0x964d('0x39')]);_0x442c5d[_0x964d('0x3d')]=_[_0x964d('0x51')](_0x56cc64[_0x964d('0x3d')]);_0x442c5d['filters']=_[_0x964d('0x3f')](_0x442c5d[_0x964d('0x3c')],_0x442c5d[_0x964d('0x3d')]);_0x3053e4['attributes']=_[_0x964d('0x3f')](_0x442c5d[_0x964d('0x3c')],qs[_0x964d('0x41')](_0x56cc64['query']['fields']));_0x3053e4[_0x964d('0x40')]=_0x3053e4['attributes']['length']?_0x3053e4[_0x964d('0x40')]:_0x442c5d[_0x964d('0x3c')];if(_0x56cc64['query'][_0x964d('0x52')]){_0x3053e4[_0x964d('0x4e')]=[{'all':!![]}];}_0x3053e4=_[_0x964d('0x48')]({},_0x3053e4,_0x56cc64[_0x964d('0x4b')]);return db[_0x964d('0x4c')][_0x964d('0x53')](_0x3053e4)[_0x964d('0x33')](handleEntityNotFound(_0x46f3fa,null))[_0x964d('0x33')](respondWithResult(_0x46f3fa,null))['catch'](handleError(_0x46f3fa,null));};exports['create']=function(_0x4d57c1,_0x217d23){return db[_0x964d('0x4c')][_0x964d('0x54')](_0x4d57c1[_0x964d('0x55')],{})['then'](respondWithResult(_0x217d23,0xc9))[_0x964d('0x27')](handleError(_0x217d23,null));};exports[_0x964d('0x56')]=function(_0x184182,_0x3efa5e){if(_0x184182[_0x964d('0x55')]['id']){delete _0x184182[_0x964d('0x55')]['id'];}return db[_0x964d('0x4c')][_0x964d('0x53')]({'where':{'id':_0x184182[_0x964d('0x57')]['id']}})[_0x964d('0x33')](handleEntityNotFound(_0x3efa5e,null))[_0x964d('0x33')](saveUpdates(_0x184182[_0x964d('0x55')],null))['then'](respondWithResult(_0x3efa5e,null))[_0x964d('0x27')](handleError(_0x3efa5e,null));};exports[_0x964d('0x58')]=function(_0x15fed1,_0x33da21){return db[_0x964d('0x4c')][_0x964d('0x53')]({'where':{'id':_0x15fed1[_0x964d('0x57')]['id']}})['then'](handleEntityNotFound(_0x33da21,null))['then'](removeEntity(_0x33da21,null))['catch'](handleError(_0x33da21,null));};exports[_0x964d('0x59')]=function(_0x347da4,_0x46c3dd,_0x5ec12c){var _0x13f46c={};var _0x568b0b={};var _0x41485a;var _0x1b19e2;return db[_0x964d('0x4c')]['findOne']({'where':{'id':_0x347da4[_0x964d('0x57')]['id']}})[_0x964d('0x33')](handleEntityNotFound(_0x46c3dd,null))['then'](function(_0x41ba8d){if(_0x41ba8d){_0x41485a=_0x41ba8d;_0x568b0b[_0x964d('0x3c')]=_[_0x964d('0x51')](db['SalesforceField'][_0x964d('0x39')]);_0x568b0b[_0x964d('0x3d')]=_['keys'](_0x347da4[_0x964d('0x3d')]);_0x568b0b[_0x964d('0x3e')]=_[_0x964d('0x3f')](_0x568b0b[_0x964d('0x3c')],_0x568b0b[_0x964d('0x3d')]);_0x13f46c['attributes']=_[_0x964d('0x3f')](_0x568b0b[_0x964d('0x3c')],qs[_0x964d('0x41')](_0x347da4[_0x964d('0x3d')][_0x964d('0x41')]));_0x13f46c[_0x964d('0x40')]=_0x13f46c[_0x964d('0x40')][_0x964d('0x42')]?_0x13f46c[_0x964d('0x40')]:_0x568b0b[_0x964d('0x3c')];_0x13f46c[_0x964d('0x5a')]=qs[_0x964d('0x44')](_0x347da4[_0x964d('0x3d')][_0x964d('0x44')]);_0x13f46c['where']=qs[_0x964d('0x3e')](_[_0x964d('0x46')](_0x347da4[_0x964d('0x3d')],_0x568b0b[_0x964d('0x3e')]));if(_0x347da4[_0x964d('0x3d')][_0x964d('0x47')]){_0x13f46c['where']=_[_0x964d('0x48')](_0x13f46c['where'],{'$or':_[_0x964d('0x38')](_0x13f46c[_0x964d('0x40')],function(_0x113c12){var _0x15f282={};_0x15f282[_0x113c12]={'$like':'%'+_0x347da4['query']['filter']+'%'};return _0x15f282;})});}_0x13f46c=_[_0x964d('0x48')]({},_0x13f46c,_0x347da4[_0x964d('0x4b')]);return _0x41485a[_0x964d('0x59')](_0x13f46c);}})[_0x964d('0x33')](function(_0xa953b0){if(_0xa953b0){_0x1b19e2=_0xa953b0[_0x964d('0x42')];if(!_0x347da4['query']['hasOwnProperty'](_0x964d('0x5b'))){_0x13f46c[_0x964d('0x2d')]=qs[_0x964d('0x2d')](_0x347da4[_0x964d('0x3d')][_0x964d('0x2d')]);_0x13f46c[_0x964d('0x2c')]=qs[_0x964d('0x2c')](_0x347da4[_0x964d('0x3d')][_0x964d('0x2c')]);}return _0x41485a[_0x964d('0x59')](_0x13f46c);}})['then'](function(_0x306edd){if(_0x306edd){return _0x306edd?{'count':_0x1b19e2,'rows':_0x306edd}:null;}})[_0x964d('0x33')](respondWithResult(_0x46c3dd,null))[_0x964d('0x27')](handleError(_0x46c3dd,null));};exports['getSubjects']=function(_0x3895da,_0x46aa2b,_0x370350){var _0x34392f={};var _0x5f32f2={};var _0x28e082;var _0x2e9f3d;return db[_0x964d('0x4c')]['findOne']({'where':{'id':_0x3895da[_0x964d('0x57')]['id']}})['then'](handleEntityNotFound(_0x46aa2b,null))['then'](function(_0xf6a56e){if(_0xf6a56e){_0x28e082=_0xf6a56e;_0x5f32f2[_0x964d('0x3c')]=_['keys'](db[_0x964d('0x5c')][_0x964d('0x39')]);_0x5f32f2[_0x964d('0x3d')]=_[_0x964d('0x51')](_0x3895da[_0x964d('0x3d')]);_0x5f32f2[_0x964d('0x3e')]=_[_0x964d('0x3f')](_0x5f32f2['model'],_0x5f32f2[_0x964d('0x3d')]);_0x34392f[_0x964d('0x40')]=_[_0x964d('0x3f')](_0x5f32f2['model'],qs[_0x964d('0x41')](_0x3895da[_0x964d('0x3d')]['fields']));_0x34392f['attributes']=_0x34392f[_0x964d('0x40')][_0x964d('0x42')]?_0x34392f[_0x964d('0x40')]:_0x5f32f2[_0x964d('0x3c')];_0x34392f[_0x964d('0x5a')]=qs[_0x964d('0x44')](_0x3895da[_0x964d('0x3d')][_0x964d('0x44')]);_0x34392f['where']=qs['filters'](_['pick'](_0x3895da[_0x964d('0x3d')],_0x5f32f2[_0x964d('0x3e')]));if(_0x3895da[_0x964d('0x3d')][_0x964d('0x47')]){_0x34392f[_0x964d('0x45')]=_[_0x964d('0x48')](_0x34392f[_0x964d('0x45')],{'$or':_[_0x964d('0x38')](_0x34392f[_0x964d('0x40')],function(_0x2dbe05){var _0x6f5491={};_0x6f5491[_0x2dbe05]={'$like':'%'+_0x3895da['query'][_0x964d('0x47')]+'%'};return _0x6f5491;})});}_0x34392f=_[_0x964d('0x48')]({},_0x34392f,_0x3895da[_0x964d('0x4b')]);return _0x28e082[_0x964d('0x5d')](_0x34392f);}})[_0x964d('0x33')](function(_0x320eb4){if(_0x320eb4){_0x2e9f3d=_0x320eb4[_0x964d('0x42')];if(!_0x3895da[_0x964d('0x3d')]['hasOwnProperty'](_0x964d('0x5b'))){_0x34392f[_0x964d('0x2d')]=qs['limit'](_0x3895da[_0x964d('0x3d')][_0x964d('0x2d')]);_0x34392f[_0x964d('0x2c')]=qs[_0x964d('0x2c')](_0x3895da[_0x964d('0x3d')][_0x964d('0x2c')]);}return _0x28e082[_0x964d('0x5d')](_0x34392f);}})['then'](function(_0x139c22){if(_0x139c22){return _0x139c22?{'count':_0x2e9f3d,'rows':_0x139c22}:null;}})[_0x964d('0x33')](respondWithResult(_0x46aa2b,null))[_0x964d('0x27')](handleError(_0x46aa2b,null));};exports[_0x964d('0x5e')]=function(_0x289faa,_0x354ffa,_0x577c37){var _0x110bf5={};var _0x52cede={};var _0x5207c9;var _0x13df0b;return db['SalesforceConfiguration'][_0x964d('0x5f')]({'where':{'id':_0x289faa[_0x964d('0x57')]['id']}})[_0x964d('0x33')](handleEntityNotFound(_0x354ffa,null))[_0x964d('0x33')](function(_0x57b668){if(_0x57b668){_0x5207c9=_0x57b668;_0x52cede[_0x964d('0x3c')]=_[_0x964d('0x51')](db[_0x964d('0x5c')][_0x964d('0x39')]);_0x52cede[_0x964d('0x3d')]=_[_0x964d('0x51')](_0x289faa[_0x964d('0x3d')]);_0x52cede[_0x964d('0x3e')]=_['intersection'](_0x52cede[_0x964d('0x3c')],_0x52cede[_0x964d('0x3d')]);_0x110bf5[_0x964d('0x40')]=_['intersection'](_0x52cede[_0x964d('0x3c')],qs[_0x964d('0x41')](_0x289faa[_0x964d('0x3d')]['fields']));_0x110bf5[_0x964d('0x40')]=_0x110bf5['attributes']['length']?_0x110bf5[_0x964d('0x40')]:_0x52cede[_0x964d('0x3c')];_0x110bf5[_0x964d('0x5a')]=qs['sort'](_0x289faa[_0x964d('0x3d')][_0x964d('0x44')]);_0x110bf5[_0x964d('0x45')]=qs[_0x964d('0x3e')](_[_0x964d('0x46')](_0x289faa[_0x964d('0x3d')],_0x52cede[_0x964d('0x3e')]));if(_0x289faa['query'][_0x964d('0x47')]){_0x110bf5['where']=_['merge'](_0x110bf5[_0x964d('0x45')],{'$or':_[_0x964d('0x38')](_0x110bf5['attributes'],function(_0x3a8501){var _0x57a400={};_0x57a400[_0x3a8501]={'$like':'%'+_0x289faa[_0x964d('0x3d')][_0x964d('0x47')]+'%'};return _0x57a400;})});}_0x110bf5=_[_0x964d('0x48')]({},_0x110bf5,_0x289faa['options']);return _0x5207c9['getDescriptions'](_0x110bf5);}})[_0x964d('0x33')](function(_0x54302b){if(_0x54302b){_0x13df0b=_0x54302b[_0x964d('0x42')];if(!_0x289faa[_0x964d('0x3d')][_0x964d('0x43')]('nolimit')){_0x110bf5[_0x964d('0x2d')]=qs[_0x964d('0x2d')](_0x289faa['query'][_0x964d('0x2d')]);_0x110bf5[_0x964d('0x2c')]=qs[_0x964d('0x2c')](_0x289faa['query']['offset']);}return _0x5207c9[_0x964d('0x5e')](_0x110bf5);}})[_0x964d('0x33')](function(_0x31035b){if(_0x31035b){return _0x31035b?{'count':_0x13df0b,'rows':_0x31035b}:null;}})[_0x964d('0x33')](respondWithResult(_0x354ffa,null))[_0x964d('0x27')](handleError(_0x354ffa,null));}; \ No newline at end of file +var _0xe7b3=['fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','limit','set','apply','reject','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','destroy','getFields','SalesforceField','pick','getSubjects','findOne','getDescriptions','html-pdf','zip-dir'];(function(_0x5df7fd,_0xc0eb56){var _0x2e8026=function(_0x2dd913){while(--_0x2dd913){_0x5df7fd['push'](_0x5df7fd['shift']());}};_0x2e8026(++_0xc0eb56);}(_0xe7b3,0x1b6));var _0x3e7b=function(_0x2b60a6,_0x1fcbd7){_0x2b60a6=_0x2b60a6-0x0;var _0x17e0db=_0xe7b3[_0x2b60a6];return _0x17e0db;};'use strict';var pdf=require(_0x3e7b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e7b('0x1'));var jsonpatch=require(_0x3e7b('0x2'));var rp=require(_0x3e7b('0x3'));var moment=require(_0x3e7b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3e7b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3e7b('0x6'));var csv=require(_0x3e7b('0x7'));var ejs=require(_0x3e7b('0x8'));var fs=require('fs');var _=require(_0x3e7b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3e7b('0xa'));var Redis=require(_0x3e7b('0xb'));var authService=require(_0x3e7b('0xc'));var qs=require(_0x3e7b('0xd'));var as=require(_0x3e7b('0xe'));var hardwareService=require(_0x3e7b('0xf'));var logger=require(_0x3e7b('0x10'))('api');var utils=require(_0x3e7b('0x11'));var config=require(_0x3e7b('0x12'));var db=require(_0x3e7b('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3e7b('0x14')][_0x3e7b('0x15')]({'port':0x232a});function checkPasswordPattern(_0x125890,_0x53a7fc,_0x5710d2){if(_0x5710d2){var _0x27b2b9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27b2b9['test'](_0x53a7fc)){return _0x125890;}else{throw new db[(_0x3e7b('0x16'))]['ValidationError'](_0x3e7b('0x17'));}}else{return _0x125890;}}function respondWithRpcPromise(_0xbfe5a4,_0x5a107f,_0x4fd138,_0xcd6996){return new BPromise(function(_0xed1941,_0x5c6968){var _0x185e81=_0xcd6996||client;return _0x185e81[_0x3e7b('0x18')](_0xbfe5a4,_0x4fd138)[_0x3e7b('0x19')](function(_0x20ed2e){logger['info'](_0x3e7b('0x1a'),_0x5a107f,'request\x20sent');logger[_0x3e7b('0x1b')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5a107f,_0x3e7b('0x1c'),JSON['stringify'](_0x20ed2e));if(_0x20ed2e[_0x3e7b('0x1d')]){if(_0x20ed2e[_0x3e7b('0x1d')][_0x3e7b('0x1e')]===0x1f4){logger[_0x3e7b('0x1d')](_0x3e7b('0x1a'),_0x5a107f,_0x20ed2e[_0x3e7b('0x1d')][_0x3e7b('0x1f')]);return _0x5c6968(_0x20ed2e['error']['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5a107f,_0x20ed2e[_0x3e7b('0x1d')][_0x3e7b('0x1f')]);return _0xed1941(_0x20ed2e[_0x3e7b('0x1d')]['message']);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x5a107f,_0x3e7b('0x1c'));_0xed1941(_0x20ed2e[_0x3e7b('0x20')][_0x3e7b('0x1f')]);}})['catch'](function(_0x52799f){logger[_0x3e7b('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5a107f,_0x52799f);_0x5c6968(_0x52799f);});});}function respondWithStatusCode(_0x180925,_0x196d08){_0x196d08=_0x196d08||0xcc;return function(_0xe8f889){if(_0xe8f889){return _0x180925[_0x3e7b('0x21')](_0x196d08);}return _0x180925[_0x3e7b('0x22')](_0x196d08)[_0x3e7b('0x23')]();};}function respondWithResult(_0x2652bc,_0x1a6f1b){_0x1a6f1b=_0x1a6f1b||0xc8;return function(_0x3f2427){if(_0x3f2427){return _0x2652bc[_0x3e7b('0x22')](_0x1a6f1b)[_0x3e7b('0x24')](_0x3f2427);}};}function respondWithFilteredResult(_0x26179d,_0x571011){return function(_0x5736af){if(_0x5736af){var _0x4c94b2=_0x5736af['count'],_0x5afba1=_0x571011[_0x3e7b('0x25')],_0x1ad126=_0x571011[_0x3e7b('0x25')]+_0x571011[_0x3e7b('0x26')],_0x3cdc2f;if(_0x1ad126>=_0x4c94b2){_0x1ad126=_0x4c94b2;_0x3cdc2f=0xc8;}else{_0x3cdc2f=0xce;}_0x26179d[_0x3e7b('0x22')](_0x3cdc2f);return _0x26179d[_0x3e7b('0x27')]('Content-Range',_0x5afba1+'-'+_0x1ad126+'/'+_0x4c94b2)[_0x3e7b('0x24')](_0x5736af);}return null;};}function patchUpdates(_0x2d40b4){return function(_0xfbe8b9){try{jsonpatch[_0x3e7b('0x28')](_0xfbe8b9,_0x2d40b4,!![]);}catch(_0x41fa76){return BPromise[_0x3e7b('0x29')](_0x41fa76);}return _0xfbe8b9['save']();};}function saveUpdates(_0x32db89,_0x518ba5){return function(_0x1a5763){if(_0x1a5763){return _0x1a5763['update'](_0x32db89)[_0x3e7b('0x19')](function(_0x221e3c){return _0x221e3c;});}return null;};}function removeEntity(_0xbd247d,_0x33a2be){return function(_0x5c2974){if(_0x5c2974){return _0x5c2974['destroy']()['then'](function(){_0xbd247d[_0x3e7b('0x22')](0xcc)[_0x3e7b('0x23')]();});}};}function handleEntityNotFound(_0x541002,_0x5be292){return function(_0x663b42){if(!_0x663b42){_0x541002[_0x3e7b('0x21')](0x194);}return _0x663b42;};}function handleError(_0x3de949,_0x320eaa){_0x320eaa=_0x320eaa||0x1f4;return function(_0x461147){logger['error'](_0x461147[_0x3e7b('0x2a')]);if(_0x461147[_0x3e7b('0x2b')]){delete _0x461147[_0x3e7b('0x2b')];}_0x3de949[_0x3e7b('0x22')](_0x320eaa)[_0x3e7b('0x2c')](_0x461147);};}exports[_0x3e7b('0x2d')]=function(_0x5443d6,_0x24c9fc){var _0x1bbefd={},_0x159f30={},_0x5352b5={'count':0x0,'rows':[]};var _0x70ac2=_[_0x3e7b('0x2e')](db[_0x3e7b('0x2f')][_0x3e7b('0x30')],function(_0x8a4e7c){return{'name':_0x8a4e7c[_0x3e7b('0x31')],'type':_0x8a4e7c[_0x3e7b('0x32')][_0x3e7b('0x33')]};});_0x159f30[_0x3e7b('0x34')]=_[_0x3e7b('0x2e')](_0x70ac2,'name');_0x159f30[_0x3e7b('0x35')]=_[_0x3e7b('0x36')](_0x5443d6[_0x3e7b('0x35')]);_0x159f30['filters']=_[_0x3e7b('0x37')](_0x159f30[_0x3e7b('0x34')],_0x159f30[_0x3e7b('0x35')]);_0x1bbefd[_0x3e7b('0x38')]=_[_0x3e7b('0x37')](_0x159f30[_0x3e7b('0x34')],qs[_0x3e7b('0x39')](_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x39')]));_0x1bbefd[_0x3e7b('0x38')]=_0x1bbefd[_0x3e7b('0x38')]['length']?_0x1bbefd[_0x3e7b('0x38')]:_0x159f30[_0x3e7b('0x34')];if(!_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x3a')](_0x3e7b('0x3b'))){_0x1bbefd[_0x3e7b('0x26')]=qs[_0x3e7b('0x26')](_0x5443d6[_0x3e7b('0x35')]['limit']);_0x1bbefd[_0x3e7b('0x25')]=qs[_0x3e7b('0x25')](_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x25')]);}_0x1bbefd[_0x3e7b('0x3c')]=qs[_0x3e7b('0x3d')](_0x5443d6['query'][_0x3e7b('0x3d')]);_0x1bbefd[_0x3e7b('0x3e')]=qs[_0x3e7b('0x3f')](_['pick'](_0x5443d6[_0x3e7b('0x35')],_0x159f30[_0x3e7b('0x3f')]),_0x70ac2);if(_0x5443d6[_0x3e7b('0x35')]['filter']){_0x1bbefd[_0x3e7b('0x3e')]=_[_0x3e7b('0x40')](_0x1bbefd[_0x3e7b('0x3e')],{'$or':_['map'](_0x70ac2,function(_0x1609a1){if(_0x1609a1[_0x3e7b('0x32')]!==_0x3e7b('0x41')){var _0xd94a6c={};_0xd94a6c[_0x1609a1['name']]={'$like':'%'+_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x42')]+'%'};return _0xd94a6c;}})});}_0x1bbefd=_[_0x3e7b('0x40')]({},_0x1bbefd,_0x5443d6[_0x3e7b('0x43')]);var _0x48d03b={'where':_0x1bbefd[_0x3e7b('0x3e')]};return db['SalesforceConfiguration'][_0x3e7b('0x44')](_0x48d03b)['then'](function(_0x57ad07){_0x5352b5[_0x3e7b('0x44')]=_0x57ad07;if(_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x45')]){_0x1bbefd[_0x3e7b('0x46')]=[{'all':!![]}];}return db[_0x3e7b('0x2f')][_0x3e7b('0x47')](_0x1bbefd);})[_0x3e7b('0x19')](function(_0x187945){_0x5352b5[_0x3e7b('0x48')]=_0x187945;return _0x5352b5;})[_0x3e7b('0x19')](respondWithFilteredResult(_0x24c9fc,_0x1bbefd))[_0x3e7b('0x49')](handleError(_0x24c9fc,null));};exports[_0x3e7b('0x4a')]=function(_0x34bf3f,_0x3eba4e){var _0x5ca6c5={'raw':![],'where':{'id':_0x34bf3f[_0x3e7b('0x4b')]['id']}},_0x157694={};_0x157694['model']=_['keys'](db[_0x3e7b('0x2f')]['rawAttributes']);_0x157694[_0x3e7b('0x35')]=_[_0x3e7b('0x36')](_0x34bf3f[_0x3e7b('0x35')]);_0x157694[_0x3e7b('0x3f')]=_['intersection'](_0x157694[_0x3e7b('0x34')],_0x157694[_0x3e7b('0x35')]);_0x5ca6c5['attributes']=_[_0x3e7b('0x37')](_0x157694['model'],qs[_0x3e7b('0x39')](_0x34bf3f[_0x3e7b('0x35')][_0x3e7b('0x39')]));_0x5ca6c5[_0x3e7b('0x38')]=_0x5ca6c5[_0x3e7b('0x38')][_0x3e7b('0x4c')]?_0x5ca6c5[_0x3e7b('0x38')]:_0x157694[_0x3e7b('0x34')];if(_0x34bf3f[_0x3e7b('0x35')][_0x3e7b('0x45')]){_0x5ca6c5[_0x3e7b('0x46')]=[{'all':!![]}];}_0x5ca6c5=_[_0x3e7b('0x40')]({},_0x5ca6c5,_0x34bf3f['options']);return db[_0x3e7b('0x2f')][_0x3e7b('0x4d')](_0x5ca6c5)[_0x3e7b('0x19')](handleEntityNotFound(_0x3eba4e,null))['then'](respondWithResult(_0x3eba4e,null))[_0x3e7b('0x49')](handleError(_0x3eba4e,null));};exports[_0x3e7b('0x4e')]=function(_0x8208d9,_0x48a8c0){return db[_0x3e7b('0x2f')]['create'](_0x8208d9[_0x3e7b('0x4f')],{})[_0x3e7b('0x19')](respondWithResult(_0x48a8c0,0xc9))[_0x3e7b('0x49')](handleError(_0x48a8c0,null));};exports[_0x3e7b('0x50')]=function(_0x507ff6,_0x395f6b){if(_0x507ff6[_0x3e7b('0x4f')]['id']){delete _0x507ff6[_0x3e7b('0x4f')]['id'];}return db[_0x3e7b('0x2f')][_0x3e7b('0x4d')]({'where':{'id':_0x507ff6['params']['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0x395f6b,null))[_0x3e7b('0x19')](saveUpdates(_0x507ff6[_0x3e7b('0x4f')],null))[_0x3e7b('0x19')](respondWithResult(_0x395f6b,null))['catch'](handleError(_0x395f6b,null));};exports[_0x3e7b('0x51')]=function(_0x332adc,_0x2d3d63){return db['SalesforceConfiguration'][_0x3e7b('0x4d')]({'where':{'id':_0x332adc[_0x3e7b('0x4b')]['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0x2d3d63,null))['then'](removeEntity(_0x2d3d63,null))[_0x3e7b('0x49')](handleError(_0x2d3d63,null));};exports[_0x3e7b('0x52')]=function(_0xa8e825,_0x2f63ba,_0x334c43){var _0x5db42d={};var _0x3f9516={};var _0x3eaf56;var _0x57e84e;return db[_0x3e7b('0x2f')]['findOne']({'where':{'id':_0xa8e825[_0x3e7b('0x4b')]['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0x2f63ba,null))[_0x3e7b('0x19')](function(_0x35a1c7){if(_0x35a1c7){_0x3eaf56=_0x35a1c7;_0x3f9516['model']=_[_0x3e7b('0x36')](db[_0x3e7b('0x53')]['rawAttributes']);_0x3f9516[_0x3e7b('0x35')]=_[_0x3e7b('0x36')](_0xa8e825[_0x3e7b('0x35')]);_0x3f9516[_0x3e7b('0x3f')]=_[_0x3e7b('0x37')](_0x3f9516['model'],_0x3f9516[_0x3e7b('0x35')]);_0x5db42d['attributes']=_[_0x3e7b('0x37')](_0x3f9516[_0x3e7b('0x34')],qs[_0x3e7b('0x39')](_0xa8e825[_0x3e7b('0x35')]['fields']));_0x5db42d[_0x3e7b('0x38')]=_0x5db42d[_0x3e7b('0x38')]['length']?_0x5db42d[_0x3e7b('0x38')]:_0x3f9516[_0x3e7b('0x34')];_0x5db42d[_0x3e7b('0x3c')]=qs[_0x3e7b('0x3d')](_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x3d')]);_0x5db42d[_0x3e7b('0x3e')]=qs[_0x3e7b('0x3f')](_[_0x3e7b('0x54')](_0xa8e825['query'],_0x3f9516[_0x3e7b('0x3f')]));if(_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x42')]){_0x5db42d['where']=_[_0x3e7b('0x40')](_0x5db42d[_0x3e7b('0x3e')],{'$or':_['map'](_0x5db42d['attributes'],function(_0x33eb14){var _0x466e35={};_0x466e35[_0x33eb14]={'$like':'%'+_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x42')]+'%'};return _0x466e35;})});}_0x5db42d=_[_0x3e7b('0x40')]({},_0x5db42d,_0xa8e825['options']);return _0x3eaf56['getFields'](_0x5db42d);}})[_0x3e7b('0x19')](function(_0xbefd9b){if(_0xbefd9b){_0x57e84e=_0xbefd9b['length'];if(!_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x3a')](_0x3e7b('0x3b'))){_0x5db42d[_0x3e7b('0x26')]=qs[_0x3e7b('0x26')](_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x26')]);_0x5db42d[_0x3e7b('0x25')]=qs['offset'](_0xa8e825[_0x3e7b('0x35')]['offset']);}return _0x3eaf56['getFields'](_0x5db42d);}})['then'](function(_0x290c44){if(_0x290c44){return _0x290c44?{'count':_0x57e84e,'rows':_0x290c44}:null;}})[_0x3e7b('0x19')](respondWithResult(_0x2f63ba,null))[_0x3e7b('0x49')](handleError(_0x2f63ba,null));};exports[_0x3e7b('0x55')]=function(_0x52a82a,_0x4e114c,_0x1f5503){var _0x2ec7af={};var _0x31655e={};var _0x5d4c07;var _0x4d7b9c;return db[_0x3e7b('0x2f')][_0x3e7b('0x56')]({'where':{'id':_0x52a82a['params']['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0x4e114c,null))[_0x3e7b('0x19')](function(_0x1b6229){if(_0x1b6229){_0x5d4c07=_0x1b6229;_0x31655e[_0x3e7b('0x34')]=_['keys'](db['SalesforceField'][_0x3e7b('0x30')]);_0x31655e[_0x3e7b('0x35')]=_[_0x3e7b('0x36')](_0x52a82a[_0x3e7b('0x35')]);_0x31655e['filters']=_[_0x3e7b('0x37')](_0x31655e[_0x3e7b('0x34')],_0x31655e[_0x3e7b('0x35')]);_0x2ec7af[_0x3e7b('0x38')]=_['intersection'](_0x31655e[_0x3e7b('0x34')],qs['fields'](_0x52a82a[_0x3e7b('0x35')][_0x3e7b('0x39')]));_0x2ec7af['attributes']=_0x2ec7af[_0x3e7b('0x38')][_0x3e7b('0x4c')]?_0x2ec7af[_0x3e7b('0x38')]:_0x31655e[_0x3e7b('0x34')];_0x2ec7af[_0x3e7b('0x3c')]=qs['sort'](_0x52a82a['query'][_0x3e7b('0x3d')]);_0x2ec7af[_0x3e7b('0x3e')]=qs['filters'](_[_0x3e7b('0x54')](_0x52a82a[_0x3e7b('0x35')],_0x31655e[_0x3e7b('0x3f')]));if(_0x52a82a[_0x3e7b('0x35')][_0x3e7b('0x42')]){_0x2ec7af[_0x3e7b('0x3e')]=_[_0x3e7b('0x40')](_0x2ec7af[_0x3e7b('0x3e')],{'$or':_[_0x3e7b('0x2e')](_0x2ec7af['attributes'],function(_0x19b874){var _0x584127={};_0x584127[_0x19b874]={'$like':'%'+_0x52a82a[_0x3e7b('0x35')]['filter']+'%'};return _0x584127;})});}_0x2ec7af=_[_0x3e7b('0x40')]({},_0x2ec7af,_0x52a82a[_0x3e7b('0x43')]);return _0x5d4c07[_0x3e7b('0x55')](_0x2ec7af);}})['then'](function(_0x519ce9){if(_0x519ce9){_0x4d7b9c=_0x519ce9['length'];if(!_0x52a82a['query'][_0x3e7b('0x3a')](_0x3e7b('0x3b'))){_0x2ec7af[_0x3e7b('0x26')]=qs['limit'](_0x52a82a[_0x3e7b('0x35')][_0x3e7b('0x26')]);_0x2ec7af['offset']=qs[_0x3e7b('0x25')](_0x52a82a[_0x3e7b('0x35')][_0x3e7b('0x25')]);}return _0x5d4c07[_0x3e7b('0x55')](_0x2ec7af);}})[_0x3e7b('0x19')](function(_0x3f271f){if(_0x3f271f){return _0x3f271f?{'count':_0x4d7b9c,'rows':_0x3f271f}:null;}})['then'](respondWithResult(_0x4e114c,null))[_0x3e7b('0x49')](handleError(_0x4e114c,null));};exports[_0x3e7b('0x57')]=function(_0x13957c,_0xe12f0c,_0x21f365){var _0x2f102f={};var _0x5977fb={};var _0x474f29;var _0x2a409f;return db['SalesforceConfiguration'][_0x3e7b('0x56')]({'where':{'id':_0x13957c[_0x3e7b('0x4b')]['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0xe12f0c,null))[_0x3e7b('0x19')](function(_0x5c3584){if(_0x5c3584){_0x474f29=_0x5c3584;_0x5977fb[_0x3e7b('0x34')]=_[_0x3e7b('0x36')](db[_0x3e7b('0x53')]['rawAttributes']);_0x5977fb['query']=_[_0x3e7b('0x36')](_0x13957c['query']);_0x5977fb[_0x3e7b('0x3f')]=_[_0x3e7b('0x37')](_0x5977fb['model'],_0x5977fb[_0x3e7b('0x35')]);_0x2f102f[_0x3e7b('0x38')]=_[_0x3e7b('0x37')](_0x5977fb[_0x3e7b('0x34')],qs[_0x3e7b('0x39')](_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x39')]));_0x2f102f['attributes']=_0x2f102f[_0x3e7b('0x38')][_0x3e7b('0x4c')]?_0x2f102f[_0x3e7b('0x38')]:_0x5977fb[_0x3e7b('0x34')];_0x2f102f['order']=qs[_0x3e7b('0x3d')](_0x13957c['query']['sort']);_0x2f102f['where']=qs[_0x3e7b('0x3f')](_[_0x3e7b('0x54')](_0x13957c[_0x3e7b('0x35')],_0x5977fb[_0x3e7b('0x3f')]));if(_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x42')]){_0x2f102f[_0x3e7b('0x3e')]=_[_0x3e7b('0x40')](_0x2f102f[_0x3e7b('0x3e')],{'$or':_[_0x3e7b('0x2e')](_0x2f102f['attributes'],function(_0x49279d){var _0xc17e5e={};_0xc17e5e[_0x49279d]={'$like':'%'+_0x13957c['query']['filter']+'%'};return _0xc17e5e;})});}_0x2f102f=_[_0x3e7b('0x40')]({},_0x2f102f,_0x13957c['options']);return _0x474f29[_0x3e7b('0x57')](_0x2f102f);}})[_0x3e7b('0x19')](function(_0x3653f6){if(_0x3653f6){_0x2a409f=_0x3653f6[_0x3e7b('0x4c')];if(!_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x3a')](_0x3e7b('0x3b'))){_0x2f102f[_0x3e7b('0x26')]=qs[_0x3e7b('0x26')](_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x26')]);_0x2f102f['offset']=qs[_0x3e7b('0x25')](_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x25')]);}return _0x474f29[_0x3e7b('0x57')](_0x2f102f);}})[_0x3e7b('0x19')](function(_0x3d356b){if(_0x3d356b){return _0x3d356b?{'count':_0x2a409f,'rows':_0x3d356b}:null;}})[_0x3e7b('0x19')](respondWithResult(_0xe12f0c,null))['catch'](handleError(_0xe12f0c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 543c65a..29e3d0d 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 _0xdfbf=['../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xdfbf,0xaa));var _0xfdfb=function(_0x346655,_0x2832d1){_0x346655=_0x346655-0x0;var _0x25483e=_0xdfbf[_0x346655];return _0x25483e;};'use strict';var _=require('lodash');var util=require(_0xfdfb('0x0'));var logger=require(_0xfdfb('0x1'))(_0xfdfb('0x2'));var moment=require('moment');var BPromise=require(_0xfdfb('0x3'));var rp=require(_0xfdfb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdfb('0x5'));var config=require(_0xfdfb('0x6'));var attributes=require(_0xfdfb('0x7'));module[_0xfdfb('0x8')]=function(_0x41223e,_0x174304){return _0x41223e['define'](_0xfdfb('0x9'),attributes,{'tableName':_0xfdfb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x113d=['util','api','moment','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x29fea7,_0x44c996){var _0x27208c=function(_0x410aa6){while(--_0x410aa6){_0x29fea7['push'](_0x29fea7['shift']());}};_0x27208c(++_0x44c996);}(_0x113d,0x82));var _0xd113=function(_0x33aca5,_0x19daff){_0x33aca5=_0x33aca5-0x0;var _0x4fe2a5=_0x113d[_0x33aca5];return _0x4fe2a5;};'use strict';var _=require('lodash');var util=require(_0xd113('0x0'));var logger=require('../../config/logger')(_0xd113('0x1'));var moment=require(_0xd113('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd113('0x3'));var rimraf=require(_0xd113('0x4'));var config=require('../../config/environment');var attributes=require(_0xd113('0x5'));module[_0xd113('0x6')]=function(_0x5c5b22,_0x28eca4){return _0x5c5b22[_0xd113('0x7')](_0xd113('0x8'),attributes,{'tableName':_0xd113('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 9fa51cc..6d660bb 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 _0x1ad9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x5b9b40,_0x3a7e77){var _0x51423d=function(_0x197719){while(--_0x197719){_0x5b9b40['push'](_0x5b9b40['shift']());}};_0x51423d(++_0x3a7e77);}(_0x1ad9,0x88));var _0x91ad=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x1ad9[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x91ad('0x0'));var util=require(_0x91ad('0x1'));var moment=require(_0x91ad('0x2'));var BPromise=require(_0x91ad('0x3'));var rs=require(_0x91ad('0x4'));var fs=require('fs');var Redis=require(_0x91ad('0x5'));var db=require(_0x91ad('0x6'))['db'];var utils=require(_0x91ad('0x7'));var logger=require(_0x91ad('0x8'))(_0x91ad('0x9'));var config=require(_0x91ad('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38e8bd,_0x4f7712,_0x1fd8cf){return new BPromise(function(_0x18bbac,_0x4d9d4e){return client[_0x91ad('0xb')](_0x38e8bd,_0x1fd8cf)[_0x91ad('0xc')](function(_0x4f8b97){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4f7712,_0x91ad('0xd'));logger[_0x91ad('0xe')](_0x91ad('0xf'),_0x4f7712,_0x91ad('0xd'),JSON[_0x91ad('0x10')](_0x4f8b97));if(_0x4f8b97[_0x91ad('0x11')]){if(_0x4f8b97['error'][_0x91ad('0x12')]===0x1f4){logger[_0x91ad('0x11')](_0x91ad('0x13'),_0x4f7712,_0x4f8b97['error'][_0x91ad('0x14')]);return _0x4d9d4e(_0x4f8b97[_0x91ad('0x11')][_0x91ad('0x14')]);}logger[_0x91ad('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f7712,_0x4f8b97[_0x91ad('0x11')][_0x91ad('0x14')]);return _0x18bbac(_0x4f8b97[_0x91ad('0x11')][_0x91ad('0x14')]);}else{logger[_0x91ad('0x15')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f7712,_0x91ad('0xd'));_0x18bbac(_0x4f8b97['result']['message']);}})[_0x91ad('0x16')](function(_0xc65b66){logger[_0x91ad('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f7712,_0xc65b66);_0x4d9d4e(_0xc65b66);});});} \ No newline at end of file +var _0x8de0=['http','then','info','request\x20sent','debug','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0x8de0,0x155));var _0x08de=function(_0x480edd,_0x37f398){_0x480edd=_0x480edd-0x0;var _0x12b311=_0x8de0[_0x480edd];return _0x12b311;};'use strict';var _=require(_0x08de('0x0'));var util=require(_0x08de('0x1'));var moment=require(_0x08de('0x2'));var BPromise=require(_0x08de('0x3'));var rs=require(_0x08de('0x4'));var fs=require('fs');var Redis=require(_0x08de('0x5'));var db=require(_0x08de('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x08de('0x7'))(_0x08de('0x8'));var config=require(_0x08de('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x08de('0xa')][_0x08de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a1d9e,_0x27924e,_0x131c31){return new BPromise(function(_0x498409,_0x480453){return client['request'](_0x2a1d9e,_0x131c31)[_0x08de('0xc')](function(_0x15f515){logger[_0x08de('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x27924e,_0x08de('0xe'));logger[_0x08de('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x27924e,_0x08de('0xe'),JSON[_0x08de('0x10')](_0x15f515));if(_0x15f515['error']){if(_0x15f515[_0x08de('0x11')][_0x08de('0x12')]===0x1f4){logger[_0x08de('0x11')](_0x08de('0x13'),_0x27924e,_0x15f515[_0x08de('0x11')]['message']);return _0x480453(_0x15f515[_0x08de('0x11')][_0x08de('0x14')]);}logger[_0x08de('0x11')](_0x08de('0x13'),_0x27924e,_0x15f515[_0x08de('0x11')][_0x08de('0x14')]);return _0x498409(_0x15f515[_0x08de('0x11')]['message']);}else{logger['info'](_0x08de('0x13'),_0x27924e,_0x08de('0xe'));_0x498409(_0x15f515['result'][_0x08de('0x14')]);}})[_0x08de('0x15')](function(_0x6c58c4){logger['error'](_0x08de('0x13'),_0x27924e,_0x6c58c4);_0x480453(_0x6c58c4);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c436f76..1768777 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 _0x82c4=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x82c4,0x1ca));var _0x482c=function(_0x37ea17,_0x58c122){_0x37ea17=_0x37ea17-0x0;var _0x4c6387=_0x82c4[_0x37ea17];return _0x4c6387;};'use strict';var multer=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var path=require(_0x482c('0x2'));var timeout=require(_0x482c('0x3'));var express=require(_0x482c('0x4'));var router=express[_0x482c('0x5')]();var auth=require(_0x482c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x482c('0x7'));var controller=require('./intSalesforceField.controller');router[_0x482c('0x8')]('/',auth['isAuthenticated'](),controller[_0x482c('0x9')]);router['get'](_0x482c('0xa'),auth[_0x482c('0xb')](),controller[_0x482c('0xc')]);router[_0x482c('0xd')]('/',auth[_0x482c('0xb')](),controller['create']);router[_0x482c('0xe')](_0x482c('0xa'),auth[_0x482c('0xb')](),controller[_0x482c('0xf')]);router[_0x482c('0x10')](_0x482c('0xa'),auth['isAuthenticated'](),controller[_0x482c('0x11')]);module[_0x482c('0x12')]=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x47f62e,_0x5180f8){var _0x216014=function(_0x51c75d){while(--_0x51c75d){_0x47f62e['push'](_0x47f62e['shift']());}};_0x216014(++_0x5180f8);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['show']);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router[_0x86d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b22ca36..07244d2 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 _0x1686=['customVariable','keyValue','string','STRING','ENUM','sequelize','exports','variable'];(function(_0x2926c4,_0x4e27b5){var _0x1208c1=function(_0x428d9b){while(--_0x428d9b){_0x2926c4['push'](_0x2926c4['shift']());}};_0x1208c1(++_0x4e27b5);}(_0x1686,0x1d5));var _0x6168=function(_0x334f7d,_0x13f7a0){_0x334f7d=_0x334f7d-0x0;var _0x38b00d=_0x1686[_0x334f7d];return _0x38b00d;};'use strict';var Sequelize=require(_0x6168('0x0'));module[_0x6168('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x6168('0x2'),_0x6168('0x3'),_0x6168('0x4')),'defaultValue':_0x6168('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6168('0x6')]},'keyType':{'type':Sequelize[_0x6168('0x7')]('string',_0x6168('0x2'),_0x6168('0x3'))},'keyContent':{'type':Sequelize[_0x6168('0x6')]},'idField':{'type':Sequelize[_0x6168('0x6')]},'variableName':{'type':Sequelize[_0x6168('0x6')]}}; \ No newline at end of file +var _0xd9f7=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xd9f7,0x13a));var _0x7d9f=function(_0x14146b,_0xc72b05){_0x14146b=_0x14146b-0x0;var _0x4ab737=_0xd9f7[_0x14146b];return _0x4ab737;};'use strict';var Sequelize=require(_0x7d9f('0x0'));module['exports']={'type':{'type':Sequelize[_0x7d9f('0x1')](_0x7d9f('0x2'),_0x7d9f('0x3'),_0x7d9f('0x4'),_0x7d9f('0x5')),'defaultValue':_0x7d9f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7d9f('0x6')]},'keyType':{'type':Sequelize[_0x7d9f('0x1')](_0x7d9f('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x7d9f('0x6')]},'idField':{'type':Sequelize[_0x7d9f('0x6')]},'variableName':{'type':Sequelize[_0x7d9f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index be89864..59c73ac 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 _0xabf5=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','SalesforceField','includeAll','include','findAll','rows','show','params','options','catch','create','body','update','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox'];(function(_0x162671,_0x12fbe0){var _0x4faa6a=function(_0x3c4e50){while(--_0x3c4e50){_0x162671['push'](_0x162671['shift']());}};_0x4faa6a(++_0x12fbe0);}(_0xabf5,0x16f));var _0x5abf=function(_0x2a815d,_0x5516be){_0x2a815d=_0x2a815d-0x0;var _0x35d5c6=_0xabf5[_0x2a815d];return _0x35d5c6;};'use strict';var pdf=require(_0x5abf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5abf('0x1'));var zipdir=require(_0x5abf('0x2'));var jsonpatch=require(_0x5abf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5abf('0x4'));var Mustache=require('mustache');var util=require(_0x5abf('0x5'));var path=require(_0x5abf('0x6'));var sox=require(_0x5abf('0x7'));var csv=require(_0x5abf('0x8'));var ejs=require(_0x5abf('0x9'));var fs=require('fs');var _=require(_0x5abf('0xa'));var squel=require(_0x5abf('0xb'));var crypto=require(_0x5abf('0xc'));var jsforce=require(_0x5abf('0xd'));var deskjs=require(_0x5abf('0xe'));var toCsv=require(_0x5abf('0x8'));var querystring=require(_0x5abf('0xf'));var Papa=require(_0x5abf('0x10'));var Redis=require(_0x5abf('0x11'));var authService=require(_0x5abf('0x12'));var qs=require(_0x5abf('0x13'));var as=require(_0x5abf('0x14'));var hardwareService=require(_0x5abf('0x15'));var logger=require(_0x5abf('0x16'))(_0x5abf('0x17'));var utils=require(_0x5abf('0x18'));var config=require(_0x5abf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe9d1,_0x3fddcf){_0x3fddcf=_0x3fddcf||0xcc;return function(_0x2029be){if(_0x2029be){return _0x3fe9d1[_0x5abf('0x1a')](_0x3fddcf);}return _0x3fe9d1['status'](_0x3fddcf)[_0x5abf('0x1b')]();};}function respondWithResult(_0x12f441,_0xf773ea){_0xf773ea=_0xf773ea||0xc8;return function(_0x2736c1){if(_0x2736c1){return _0x12f441['status'](_0xf773ea)[_0x5abf('0x1c')](_0x2736c1);}};}function respondWithFilteredResult(_0x135069,_0x34e731){return function(_0x1e027c){if(_0x1e027c){var _0x1b89b0=_0x1e027c[_0x5abf('0x1d')],_0x56b3cf=_0x34e731[_0x5abf('0x1e')],_0x5a2018=_0x34e731[_0x5abf('0x1e')]+_0x34e731[_0x5abf('0x1f')],_0xb034e;if(_0x5a2018>=_0x1b89b0){_0x5a2018=_0x1b89b0;_0xb034e=0xc8;}else{_0xb034e=0xce;}_0x135069[_0x5abf('0x20')](_0xb034e);return _0x135069[_0x5abf('0x21')](_0x5abf('0x22'),_0x56b3cf+'-'+_0x5a2018+'/'+_0x1b89b0)[_0x5abf('0x1c')](_0x1e027c);}return null;};}function patchUpdates(_0x433a7e){return function(_0x5c1f3f){try{jsonpatch['apply'](_0x5c1f3f,_0x433a7e,!![]);}catch(_0x432874){return BPromise[_0x5abf('0x23')](_0x432874);}return _0x5c1f3f[_0x5abf('0x24')]();};}function saveUpdates(_0x3e45d3,_0x42e1fa){return function(_0x2eeb50){if(_0x2eeb50){return _0x2eeb50['update'](_0x3e45d3)[_0x5abf('0x25')](function(_0x28bdb9){return _0x28bdb9;});}return null;};}function removeEntity(_0x3c3ce5,_0x17c9cc){return function(_0x345af3){if(_0x345af3){return _0x345af3[_0x5abf('0x26')]()[_0x5abf('0x25')](function(){_0x3c3ce5[_0x5abf('0x20')](0xcc)[_0x5abf('0x1b')]();});}};}function handleEntityNotFound(_0x5de97c,_0xaa29e8){return function(_0x31e4d0){if(!_0x31e4d0){_0x5de97c[_0x5abf('0x1a')](0x194);}return _0x31e4d0;};}function handleError(_0x5b1979,_0x36e431){_0x36e431=_0x36e431||0x1f4;return function(_0xa047a0){logger['error'](_0xa047a0[_0x5abf('0x27')]);if(_0xa047a0[_0x5abf('0x28')]){delete _0xa047a0[_0x5abf('0x28')];}_0x5b1979[_0x5abf('0x20')](_0x36e431)[_0x5abf('0x29')](_0xa047a0);};}exports[_0x5abf('0x2a')]=function(_0x1ba373,_0x400b64){var _0x12e905={},_0x331255={},_0x13c7c3={'count':0x0,'rows':[]};var _0x4fddf1=_[_0x5abf('0x2b')](db['SalesforceField'][_0x5abf('0x2c')],function(_0xbf518b){return{'name':_0xbf518b[_0x5abf('0x2d')],'type':_0xbf518b[_0x5abf('0x2e')][_0x5abf('0x2f')]};});_0x331255[_0x5abf('0x30')]=_[_0x5abf('0x2b')](_0x4fddf1,'name');_0x331255['query']=_[_0x5abf('0x31')](_0x1ba373['query']);_0x331255[_0x5abf('0x32')]=_[_0x5abf('0x33')](_0x331255[_0x5abf('0x30')],_0x331255[_0x5abf('0x34')]);_0x12e905[_0x5abf('0x35')]=_['intersection'](_0x331255['model'],qs['fields'](_0x1ba373[_0x5abf('0x34')][_0x5abf('0x36')]));_0x12e905[_0x5abf('0x35')]=_0x12e905['attributes'][_0x5abf('0x37')]?_0x12e905['attributes']:_0x331255[_0x5abf('0x30')];if(!_0x1ba373['query'][_0x5abf('0x38')]('nolimit')){_0x12e905[_0x5abf('0x1f')]=qs[_0x5abf('0x1f')](_0x1ba373[_0x5abf('0x34')][_0x5abf('0x1f')]);_0x12e905[_0x5abf('0x1e')]=qs[_0x5abf('0x1e')](_0x1ba373[_0x5abf('0x34')][_0x5abf('0x1e')]);}_0x12e905['order']=qs[_0x5abf('0x39')](_0x1ba373[_0x5abf('0x34')][_0x5abf('0x39')]);_0x12e905[_0x5abf('0x3a')]=qs[_0x5abf('0x32')](_[_0x5abf('0x3b')](_0x1ba373[_0x5abf('0x34')],_0x331255[_0x5abf('0x32')]),_0x4fddf1);if(_0x1ba373[_0x5abf('0x34')][_0x5abf('0x3c')]){_0x12e905[_0x5abf('0x3a')]=_[_0x5abf('0x3d')](_0x12e905[_0x5abf('0x3a')],{'$or':_[_0x5abf('0x2b')](_0x4fddf1,function(_0x68b0de){if(_0x68b0de[_0x5abf('0x2e')]!=='VIRTUAL'){var _0x93bc2={};_0x93bc2[_0x68b0de['name']]={'$like':'%'+_0x1ba373[_0x5abf('0x34')][_0x5abf('0x3c')]+'%'};return _0x93bc2;}})});}_0x12e905=_[_0x5abf('0x3d')]({},_0x12e905,_0x1ba373['options']);var _0x14e974={'where':_0x12e905[_0x5abf('0x3a')]};return db[_0x5abf('0x3e')][_0x5abf('0x1d')](_0x14e974)[_0x5abf('0x25')](function(_0x547dba){_0x13c7c3[_0x5abf('0x1d')]=_0x547dba;if(_0x1ba373['query'][_0x5abf('0x3f')]){_0x12e905[_0x5abf('0x40')]=[{'all':!![]}];}return db[_0x5abf('0x3e')][_0x5abf('0x41')](_0x12e905);})['then'](function(_0x404b9d){_0x13c7c3[_0x5abf('0x42')]=_0x404b9d;return _0x13c7c3;})[_0x5abf('0x25')](respondWithFilteredResult(_0x400b64,_0x12e905))['catch'](handleError(_0x400b64,null));};exports[_0x5abf('0x43')]=function(_0x18b7b2,_0x4040de){var _0x1d0010={'raw':!![],'where':{'id':_0x18b7b2[_0x5abf('0x44')]['id']}},_0x52964f={};_0x52964f['model']=_['keys'](db[_0x5abf('0x3e')]['rawAttributes']);_0x52964f[_0x5abf('0x34')]=_[_0x5abf('0x31')](_0x18b7b2['query']);_0x52964f[_0x5abf('0x32')]=_[_0x5abf('0x33')](_0x52964f[_0x5abf('0x30')],_0x52964f[_0x5abf('0x34')]);_0x1d0010[_0x5abf('0x35')]=_['intersection'](_0x52964f['model'],qs[_0x5abf('0x36')](_0x18b7b2[_0x5abf('0x34')][_0x5abf('0x36')]));_0x1d0010['attributes']=_0x1d0010[_0x5abf('0x35')][_0x5abf('0x37')]?_0x1d0010[_0x5abf('0x35')]:_0x52964f[_0x5abf('0x30')];if(_0x18b7b2[_0x5abf('0x34')]['includeAll']){_0x1d0010[_0x5abf('0x40')]=[{'all':!![]}];}_0x1d0010=_['merge']({},_0x1d0010,_0x18b7b2[_0x5abf('0x45')]);return db[_0x5abf('0x3e')]['find'](_0x1d0010)[_0x5abf('0x25')](handleEntityNotFound(_0x4040de,null))[_0x5abf('0x25')](respondWithResult(_0x4040de,null))[_0x5abf('0x46')](handleError(_0x4040de,null));};exports[_0x5abf('0x47')]=function(_0x190172,_0x5a8e2b){return db[_0x5abf('0x3e')][_0x5abf('0x47')](_0x190172[_0x5abf('0x48')],{})[_0x5abf('0x25')](respondWithResult(_0x5a8e2b,0xc9))['catch'](handleError(_0x5a8e2b,null));};exports[_0x5abf('0x49')]=function(_0x53c274,_0x29edf0){if(_0x53c274[_0x5abf('0x48')]['id']){delete _0x53c274[_0x5abf('0x48')]['id'];}return db[_0x5abf('0x3e')][_0x5abf('0x4a')]({'where':{'id':_0x53c274['params']['id']}})[_0x5abf('0x25')](handleEntityNotFound(_0x29edf0,null))[_0x5abf('0x25')](saveUpdates(_0x53c274['body'],null))['then'](respondWithResult(_0x29edf0,null))[_0x5abf('0x46')](handleError(_0x29edf0,null));};exports[_0x5abf('0x26')]=function(_0x343f71,_0x512cd8){return db[_0x5abf('0x3e')][_0x5abf('0x4a')]({'where':{'id':_0x343f71[_0x5abf('0x44')]['id']}})[_0x5abf('0x25')](handleEntityNotFound(_0x512cd8,null))[_0x5abf('0x25')](removeEntity(_0x512cd8,null))[_0x5abf('0x46')](handleError(_0x512cd8,null));}; \ No newline at end of file +var _0x492b=['name','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','catch','show','params','SalesforceField','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','index','map','rawAttributes','fieldName','type','key'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x492b,0x18e));var _0xb492=function(_0x2a08b8,_0x39bd90){_0x2a08b8=_0x2a08b8-0x0;var _0x74e1e=_0x492b[_0x2a08b8];return _0x74e1e;};'use strict';var pdf=require(_0xb492('0x0'));var emlformat=require(_0xb492('0x1'));var rimraf=require(_0xb492('0x2'));var zipdir=require(_0xb492('0x3'));var jsonpatch=require(_0xb492('0x4'));var rp=require(_0xb492('0x5'));var moment=require(_0xb492('0x6'));var BPromise=require(_0xb492('0x7'));var Mustache=require(_0xb492('0x8'));var util=require('util');var path=require(_0xb492('0x9'));var sox=require(_0xb492('0xa'));var csv=require('to-csv');var ejs=require(_0xb492('0xb'));var fs=require('fs');var _=require(_0xb492('0xc'));var squel=require(_0xb492('0xd'));var crypto=require(_0xb492('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb492('0xf'));var toCsv=require(_0xb492('0x10'));var querystring=require(_0xb492('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb492('0x12'));var qs=require(_0xb492('0x13'));var as=require(_0xb492('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb492('0x15'))(_0xb492('0x16'));var utils=require(_0xb492('0x17'));var config=require(_0xb492('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcb7311,_0x186a5f){_0x186a5f=_0x186a5f||0xcc;return function(_0xd1c3bd){if(_0xd1c3bd){return _0xcb7311['sendStatus'](_0x186a5f);}return _0xcb7311[_0xb492('0x19')](_0x186a5f)[_0xb492('0x1a')]();};}function respondWithResult(_0x3cd495,_0x350b24){_0x350b24=_0x350b24||0xc8;return function(_0x531c28){if(_0x531c28){return _0x3cd495[_0xb492('0x19')](_0x350b24)['json'](_0x531c28);}};}function respondWithFilteredResult(_0x3eb8dd,_0x13a670){return function(_0x4fd74b){if(_0x4fd74b){var _0x3178db=_0x4fd74b['count'],_0x108e12=_0x13a670[_0xb492('0x1b')],_0x59242f=_0x13a670[_0xb492('0x1b')]+_0x13a670[_0xb492('0x1c')],_0x1daa20;if(_0x59242f>=_0x3178db){_0x59242f=_0x3178db;_0x1daa20=0xc8;}else{_0x1daa20=0xce;}_0x3eb8dd['status'](_0x1daa20);return _0x3eb8dd[_0xb492('0x1d')](_0xb492('0x1e'),_0x108e12+'-'+_0x59242f+'/'+_0x3178db)[_0xb492('0x1f')](_0x4fd74b);}return null;};}function patchUpdates(_0x1e3aaa){return function(_0x5e0ea){try{jsonpatch[_0xb492('0x20')](_0x5e0ea,_0x1e3aaa,!![]);}catch(_0x74fb6a){return BPromise['reject'](_0x74fb6a);}return _0x5e0ea[_0xb492('0x21')]();};}function saveUpdates(_0x3fd408,_0x4950b4){return function(_0x5b634d){if(_0x5b634d){return _0x5b634d[_0xb492('0x22')](_0x3fd408)[_0xb492('0x23')](function(_0x50c958){return _0x50c958;});}return null;};}function removeEntity(_0x164ee7,_0x4eb82b){return function(_0x2aebf4){if(_0x2aebf4){return _0x2aebf4[_0xb492('0x24')]()['then'](function(){_0x164ee7['status'](0xcc)[_0xb492('0x1a')]();});}};}function handleEntityNotFound(_0x44ca84,_0x1d93a1){return function(_0x59ddc5){if(!_0x59ddc5){_0x44ca84[_0xb492('0x25')](0x194);}return _0x59ddc5;};}function handleError(_0x582ae9,_0x4cb9d4){_0x4cb9d4=_0x4cb9d4||0x1f4;return function(_0x59ce2d){logger[_0xb492('0x26')](_0x59ce2d[_0xb492('0x27')]);if(_0x59ce2d['name']){delete _0x59ce2d['name'];}_0x582ae9[_0xb492('0x19')](_0x4cb9d4)['send'](_0x59ce2d);};}exports[_0xb492('0x28')]=function(_0x281112,_0x4899cc){var _0x11bc1f={},_0x5e88a4={},_0x13ba78={'count':0x0,'rows':[]};var _0x502640=_[_0xb492('0x29')](db['SalesforceField'][_0xb492('0x2a')],function(_0x36aadb){return{'name':_0x36aadb[_0xb492('0x2b')],'type':_0x36aadb[_0xb492('0x2c')][_0xb492('0x2d')]};});_0x5e88a4['model']=_[_0xb492('0x29')](_0x502640,_0xb492('0x2e'));_0x5e88a4[_0xb492('0x2f')]=_[_0xb492('0x30')](_0x281112[_0xb492('0x2f')]);_0x5e88a4[_0xb492('0x31')]=_[_0xb492('0x32')](_0x5e88a4[_0xb492('0x33')],_0x5e88a4['query']);_0x11bc1f[_0xb492('0x34')]=_['intersection'](_0x5e88a4[_0xb492('0x33')],qs['fields'](_0x281112['query'][_0xb492('0x35')]));_0x11bc1f[_0xb492('0x34')]=_0x11bc1f[_0xb492('0x34')][_0xb492('0x36')]?_0x11bc1f[_0xb492('0x34')]:_0x5e88a4[_0xb492('0x33')];if(!_0x281112[_0xb492('0x2f')]['hasOwnProperty'](_0xb492('0x37'))){_0x11bc1f[_0xb492('0x1c')]=qs[_0xb492('0x1c')](_0x281112[_0xb492('0x2f')][_0xb492('0x1c')]);_0x11bc1f[_0xb492('0x1b')]=qs['offset'](_0x281112[_0xb492('0x2f')][_0xb492('0x1b')]);}_0x11bc1f['order']=qs[_0xb492('0x38')](_0x281112[_0xb492('0x2f')]['sort']);_0x11bc1f[_0xb492('0x39')]=qs[_0xb492('0x31')](_[_0xb492('0x3a')](_0x281112['query'],_0x5e88a4[_0xb492('0x31')]),_0x502640);if(_0x281112[_0xb492('0x2f')][_0xb492('0x3b')]){_0x11bc1f[_0xb492('0x39')]=_['merge'](_0x11bc1f[_0xb492('0x39')],{'$or':_['map'](_0x502640,function(_0x4f1495){if(_0x4f1495[_0xb492('0x2c')]!==_0xb492('0x3c')){var _0x1122da={};_0x1122da[_0x4f1495['name']]={'$like':'%'+_0x281112[_0xb492('0x2f')]['filter']+'%'};return _0x1122da;}})});}_0x11bc1f=_[_0xb492('0x3d')]({},_0x11bc1f,_0x281112[_0xb492('0x3e')]);var _0x32fff3={'where':_0x11bc1f['where']};return db['SalesforceField'][_0xb492('0x3f')](_0x32fff3)['then'](function(_0x3c281c){_0x13ba78['count']=_0x3c281c;if(_0x281112[_0xb492('0x2f')][_0xb492('0x40')]){_0x11bc1f['include']=[{'all':!![]}];}return db['SalesforceField'][_0xb492('0x41')](_0x11bc1f);})[_0xb492('0x23')](function(_0x1be09c){_0x13ba78['rows']=_0x1be09c;return _0x13ba78;})['then'](respondWithFilteredResult(_0x4899cc,_0x11bc1f))[_0xb492('0x42')](handleError(_0x4899cc,null));};exports[_0xb492('0x43')]=function(_0x80aeed,_0x4e783c){var _0x28ba80={'raw':!![],'where':{'id':_0x80aeed[_0xb492('0x44')]['id']}},_0x5bc66f={};_0x5bc66f['model']=_[_0xb492('0x30')](db[_0xb492('0x45')][_0xb492('0x2a')]);_0x5bc66f[_0xb492('0x2f')]=_[_0xb492('0x30')](_0x80aeed[_0xb492('0x2f')]);_0x5bc66f[_0xb492('0x31')]=_['intersection'](_0x5bc66f[_0xb492('0x33')],_0x5bc66f[_0xb492('0x2f')]);_0x28ba80[_0xb492('0x34')]=_[_0xb492('0x32')](_0x5bc66f[_0xb492('0x33')],qs[_0xb492('0x35')](_0x80aeed[_0xb492('0x2f')][_0xb492('0x35')]));_0x28ba80[_0xb492('0x34')]=_0x28ba80[_0xb492('0x34')][_0xb492('0x36')]?_0x28ba80[_0xb492('0x34')]:_0x5bc66f[_0xb492('0x33')];if(_0x80aeed[_0xb492('0x2f')][_0xb492('0x40')]){_0x28ba80[_0xb492('0x46')]=[{'all':!![]}];}_0x28ba80=_[_0xb492('0x3d')]({},_0x28ba80,_0x80aeed[_0xb492('0x3e')]);return db[_0xb492('0x45')][_0xb492('0x47')](_0x28ba80)[_0xb492('0x23')](handleEntityNotFound(_0x4e783c,null))[_0xb492('0x23')](respondWithResult(_0x4e783c,null))['catch'](handleError(_0x4e783c,null));};exports['create']=function(_0x39c78c,_0x4d20ac){return db['SalesforceField'][_0xb492('0x48')](_0x39c78c[_0xb492('0x49')],{})[_0xb492('0x23')](respondWithResult(_0x4d20ac,0xc9))['catch'](handleError(_0x4d20ac,null));};exports['update']=function(_0x2b655a,_0x10f5a9){if(_0x2b655a['body']['id']){delete _0x2b655a['body']['id'];}return db[_0xb492('0x45')][_0xb492('0x47')]({'where':{'id':_0x2b655a['params']['id']}})[_0xb492('0x23')](handleEntityNotFound(_0x10f5a9,null))[_0xb492('0x23')](saveUpdates(_0x2b655a[_0xb492('0x49')],null))[_0xb492('0x23')](respondWithResult(_0x10f5a9,null))['catch'](handleError(_0x10f5a9,null));};exports['destroy']=function(_0x1dda81,_0x19c8c){return db[_0xb492('0x45')][_0xb492('0x47')]({'where':{'id':_0x1dda81[_0xb492('0x44')]['id']}})[_0xb492('0x23')](handleEntityNotFound(_0x19c8c,null))[_0xb492('0x23')](removeEntity(_0x19c8c,null))['catch'](handleError(_0x19c8c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 84275c1..44c609c 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 _0xce55=['path','rimraf','exports','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xce55,0x10e));var _0x5ce5=function(_0x1f34d3,_0x3e2bb7){_0x1f34d3=_0x1f34d3-0x0;var _0x42313a=_0xce55[_0x1f34d3];return _0x42313a;};'use strict';var _=require(_0x5ce5('0x0'));var util=require(_0x5ce5('0x1'));var logger=require('../../config/logger')(_0x5ce5('0x2'));var moment=require(_0x5ce5('0x3'));var BPromise=require(_0x5ce5('0x4'));var rp=require(_0x5ce5('0x5'));var fs=require('fs');var path=require(_0x5ce5('0x6'));var rimraf=require(_0x5ce5('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x5ce5('0x8')]=function(_0x567cb3,_0x584fd8){return _0x567cb3['define']('SalesforceField',attributes,{'tableName':_0x5ce5('0x9'),'paranoid':![],'indexes':[{'name':_0x5ce5('0xa'),'fields':['idField',_0x5ce5('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbacb=['salesforce_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','SalesforceField'];(function(_0x41d82a,_0x29fc06){var _0x1a9380=function(_0x3d38bd){while(--_0x3d38bd){_0x41d82a['push'](_0x41d82a['shift']());}};_0x1a9380(++_0x29fc06);}(_0xbacb,0xbd));var _0xbbac=function(_0xa8dc4f,_0x96622c){_0xa8dc4f=_0xa8dc4f-0x0;var _0x45b00c=_0xbacb[_0xa8dc4f];return _0x45b00c;};'use strict';var _=require(_0xbbac('0x0'));var util=require('util');var logger=require(_0xbbac('0x1'))(_0xbbac('0x2'));var moment=require(_0xbbac('0x3'));var BPromise=require(_0xbbac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbbac('0x5'));var config=require(_0xbbac('0x6'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x48183f,_0x1eb111){return _0x48183f[_0xbbac('0x7')](_0xbbac('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xbbac('0x9'),'fields':['idField',_0xbbac('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 9bd3255..c8d4ab3 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 _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(_0x1550ed,_0x589486){var _0x5b5add=function(_0x2a2549){while(--_0x2a2549){_0x1550ed['push'](_0x1550ed['shift']());}};_0x5b5add(++_0x589486);}(_0x91a7,0xe7));var _0x791a=function(_0x1bcbcc,_0x462637){_0x1bcbcc=_0x1bcbcc-0x0;var _0x414fa3=_0x91a7[_0x1bcbcc];return _0x414fa3;};'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 +var _0x6f0d=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x1a4b99,_0x118280){var _0x5cef7e=function(_0x56b233){while(--_0x56b233){_0x1a4b99['push'](_0x1a4b99['shift']());}};_0x5cef7e(++_0x118280);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x9d6272,_0x11e0ac){_0x9d6272=_0x9d6272-0x0;var _0x23bdeb=_0x6f0d[_0x9d6272];return _0x23bdeb;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 0d26932..c16bdb6 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 _0xc923=['put','update','multer','util','path','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration'];(function(_0x1f1b03,_0x18dea7){var _0x30d8e5=function(_0x5b3ce4){while(--_0x5b3ce4){_0x1f1b03['push'](_0x1f1b03['shift']());}};_0x30d8e5(++_0x18dea7);}(_0xc923,0x1ef));var _0x3c92=function(_0x5c1876,_0x8f7f57){_0x5c1876=_0x5c1876-0x0;var _0x400a10=_0xc923[_0x5c1876];return _0x400a10;};'use strict';var multer=require(_0x3c92('0x0'));var util=require(_0x3c92('0x1'));var path=require(_0x3c92('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3c92('0x3'));var controller=require(_0x3c92('0x4'));router[_0x3c92('0x5')]('/',auth[_0x3c92('0x6')](),controller[_0x3c92('0x7')]);router[_0x3c92('0x5')](_0x3c92('0x8'),auth[_0x3c92('0x6')](),controller[_0x3c92('0x9')]);router['get'](_0x3c92('0xa'),auth[_0x3c92('0x6')](),controller[_0x3c92('0xb')]);router[_0x3c92('0x5')]('/:id/fields',auth[_0x3c92('0x6')](),controller['getFields']);router[_0x3c92('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c92('0xd')]);router[_0x3c92('0xc')](_0x3c92('0xa'),auth[_0x3c92('0x6')](),controller[_0x3c92('0xe')]);router[_0x3c92('0xf')]('/:id',auth[_0x3c92('0x6')](),controller[_0x3c92('0x10')]);router['delete'](_0x3c92('0x8'),auth[_0x3c92('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdcd9=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x2a3808,_0x4fd0d5){var _0x2dd4c3=function(_0x2075d0){while(--_0x2075d0){_0x2a3808['push'](_0x2a3808['shift']());}};_0x2dd4c3(++_0x4fd0d5);}(_0xdcd9,0xf5));var _0x9dcd=function(_0x211782,_0x2e256d){_0x211782=_0x211782-0x0;var _0x327c3f=_0xdcd9[_0x211782];return _0x327c3f;};'use strict';var multer=require('multer');var util=require(_0x9dcd('0x0'));var path=require('path');var timeout=require(_0x9dcd('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x9dcd('0x2'));var interaction=require(_0x9dcd('0x3'));var config=require(_0x9dcd('0x4'));var controller=require(_0x9dcd('0x5'));router[_0x9dcd('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9dcd('0x6')](_0x9dcd('0x7'),auth[_0x9dcd('0x8')](),controller[_0x9dcd('0x9')]);router[_0x9dcd('0x6')](_0x9dcd('0xa'),auth[_0x9dcd('0x8')](),controller[_0x9dcd('0xb')]);router[_0x9dcd('0x6')](_0x9dcd('0xc'),auth['isAuthenticated'](),controller[_0x9dcd('0xd')]);router[_0x9dcd('0xe')]('/',auth[_0x9dcd('0x8')](),controller[_0x9dcd('0xf')]);router['post']('/:id/configurations',auth[_0x9dcd('0x8')](),controller[_0x9dcd('0x10')]);router[_0x9dcd('0x11')](_0x9dcd('0x7'),auth[_0x9dcd('0x8')](),controller[_0x9dcd('0x12')]);router[_0x9dcd('0x13')](_0x9dcd('0x7'),auth[_0x9dcd('0x8')](),controller['destroy']);module[_0x9dcd('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index a9ac170..3f898e1 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 _0x42ae=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3c24c3,_0x39888b){var _0x23e5e0=function(_0x3b2415){while(--_0x3b2415){_0x3c24c3['push'](_0x3c24c3['shift']());}};_0x23e5e0(++_0x39888b);}(_0x42ae,0x137));var _0xe42a=function(_0x48aaca,_0x140945){_0x48aaca=_0x48aaca-0x0;var _0xac5ed9=_0x42ae[_0x48aaca];return _0xac5ed9;};'use strict';var Sequelize=require(_0xe42a('0x0'));module[_0xe42a('0x1')]={'name':{'type':Sequelize[_0xe42a('0x2')]},'description':{'type':Sequelize[_0xe42a('0x2')]},'username':{'type':Sequelize[_0xe42a('0x2')],'unique':_0xe42a('0x3')},'password':{'type':Sequelize[_0xe42a('0x2')]},'email':{'type':Sequelize[_0xe42a('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe42a('0x4')},'serverUrl':{'type':Sequelize[_0xe42a('0x2')]}}; \ No newline at end of file +var _0x98bf=['exports','STRING','username','remoteUri','sequelize'];(function(_0xf7d47e,_0x7222c8){var _0x31733c=function(_0x1efa27){while(--_0x1efa27){_0xf7d47e['push'](_0xf7d47e['shift']());}};_0x31733c(++_0x7222c8);}(_0x98bf,0x6d));var _0xf98b=function(_0x407a3e,_0x15acb0){_0x407a3e=_0x407a3e-0x0;var _0x129fe3=_0x98bf[_0x407a3e];return _0x129fe3;};'use strict';var Sequelize=require(_0xf98b('0x0'));module[_0xf98b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf98b('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf98b('0x3')},'password':{'type':Sequelize[_0xf98b('0x2')]},'email':{'type':Sequelize[_0xf98b('0x2')]},'remoteUri':{'type':Sequelize[_0xf98b('0x2')],'unique':_0xf98b('0x4')},'serverUrl':{'type':Sequelize[_0xf98b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5ff4aa6..fcd4c3b 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 _0x3022=['inactive','value','html-pdf','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','ServicenowAccount','includeAll','include','findAll','rows','show','params','create','body','find','findOne','ServicenowConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','severity','category','parent','caused_by','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','contact_type','reopened_by','company','activity_due','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','statusCode','Wrong\x20credentials','boolean','True','False','false'];(function(_0x24686a,_0x4b929b){var _0x38fdb0=function(_0x4f1b16){while(--_0x4f1b16){_0x24686a['push'](_0x24686a['shift']());}};_0x38fdb0(++_0x4b929b);}(_0x3022,0xc1));var _0x2302=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x3022[_0x2fc012];return _0x2891f9;};'use strict';var pdf=require(_0x2302('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2302('0x1'));var zipdir=require(_0x2302('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2302('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2302('0x4'));var util=require(_0x2302('0x5'));var path=require('path');var sox=require(_0x2302('0x6'));var csv=require(_0x2302('0x7'));var ejs=require(_0x2302('0x8'));var fs=require('fs');var _=require(_0x2302('0x9'));var squel=require(_0x2302('0xa'));var crypto=require(_0x2302('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2302('0x7'));var querystring=require(_0x2302('0xc'));var Papa=require(_0x2302('0xd'));var Redis=require('ioredis');var authService=require(_0x2302('0xe'));var qs=require(_0x2302('0xf'));var as=require(_0x2302('0x10'));var hardwareService=require(_0x2302('0x11'));var logger=require(_0x2302('0x12'))(_0x2302('0x13'));var utils=require('../../config/utils');var config=require(_0x2302('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2302('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x2302('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x457f36,_0x3dbc67,_0x2692a0){if(_0x2692a0){var _0x45be16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45be16[_0x2302('0x17')](_0x3dbc67)){return _0x457f36;}else{throw new db[(_0x2302('0x18'))][(_0x2302('0x19'))](_0x2302('0x1a'));}}else{return _0x457f36;}}function respondWithRpcPromise(_0x2ae09b,_0x1f6601,_0x55ee81,_0x1e0b78){return new BPromise(function(_0x165a96,_0x4d16b7){var _0x2cada8=_0x1e0b78||client;return _0x2cada8['request'](_0x2ae09b,_0x55ee81)['then'](function(_0x59232f){logger[_0x2302('0x1b')](_0x2302('0x1c'),_0x1f6601,_0x2302('0x1d'));logger[_0x2302('0x1e')](_0x2302('0x1f'),_0x1f6601,_0x2302('0x1d'),JSON[_0x2302('0x20')](_0x59232f));if(_0x59232f[_0x2302('0x21')]){if(_0x59232f[_0x2302('0x21')]['code']===0x1f4){logger[_0x2302('0x21')](_0x2302('0x1c'),_0x1f6601,_0x59232f['error']['message']);return _0x4d16b7(_0x59232f['error'][_0x2302('0x22')]);}logger[_0x2302('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x1f6601,_0x59232f[_0x2302('0x21')][_0x2302('0x22')]);return _0x165a96(_0x59232f[_0x2302('0x21')]['message']);}else{logger[_0x2302('0x1b')](_0x2302('0x1c'),_0x1f6601,_0x2302('0x1d'));_0x165a96(_0x59232f['result'][_0x2302('0x22')]);}})[_0x2302('0x23')](function(_0xfb0439){logger[_0x2302('0x21')](_0x2302('0x1c'),_0x1f6601,_0xfb0439);_0x4d16b7(_0xfb0439);});});}function respondWithStatusCode(_0x1414f1,_0x5c22ca){_0x5c22ca=_0x5c22ca||0xcc;return function(_0x4f4b13){if(_0x4f4b13){return _0x1414f1[_0x2302('0x24')](_0x5c22ca);}return _0x1414f1[_0x2302('0x25')](_0x5c22ca)[_0x2302('0x26')]();};}function respondWithResult(_0x4cb342,_0x321d99){_0x321d99=_0x321d99||0xc8;return function(_0xb77d19){if(_0xb77d19){return _0x4cb342[_0x2302('0x25')](_0x321d99)[_0x2302('0x27')](_0xb77d19);}};}function respondWithFilteredResult(_0x16c1fc,_0x12ea1){return function(_0x3b3b9a){if(_0x3b3b9a){var _0x12462b=_0x3b3b9a[_0x2302('0x28')],_0x449118=_0x12ea1[_0x2302('0x29')],_0x6755e7=_0x12ea1[_0x2302('0x29')]+_0x12ea1[_0x2302('0x2a')],_0x424492;if(_0x6755e7>=_0x12462b){_0x6755e7=_0x12462b;_0x424492=0xc8;}else{_0x424492=0xce;}_0x16c1fc[_0x2302('0x25')](_0x424492);return _0x16c1fc[_0x2302('0x2b')](_0x2302('0x2c'),_0x449118+'-'+_0x6755e7+'/'+_0x12462b)[_0x2302('0x27')](_0x3b3b9a);}return null;};}function patchUpdates(_0x5b1dc8){return function(_0x37676f){try{jsonpatch[_0x2302('0x2d')](_0x37676f,_0x5b1dc8,!![]);}catch(_0x27979a){return BPromise[_0x2302('0x2e')](_0x27979a);}return _0x37676f[_0x2302('0x2f')]();};}function saveUpdates(_0x103093,_0x4bbf7b){return function(_0x56b376){if(_0x56b376){return _0x56b376[_0x2302('0x30')](_0x103093)[_0x2302('0x31')](function(_0x4eeaa5){return _0x4eeaa5;});}return null;};}function removeEntity(_0x115f1f,_0x4bda8f){return function(_0x56ecb1){if(_0x56ecb1){return _0x56ecb1[_0x2302('0x32')]()['then'](function(){_0x115f1f[_0x2302('0x25')](0xcc)[_0x2302('0x26')]();});}};}function handleEntityNotFound(_0x4bfae7,_0x12a999){return function(_0x45baaa){if(!_0x45baaa){_0x4bfae7['sendStatus'](0x194);}return _0x45baaa;};}function handleError(_0x41b297,_0x5d1931){_0x5d1931=_0x5d1931||0x1f4;return function(_0xcda7e3){logger[_0x2302('0x21')](_0xcda7e3[_0x2302('0x33')]);if(_0xcda7e3[_0x2302('0x34')]){delete _0xcda7e3[_0x2302('0x34')];}_0x41b297['status'](_0x5d1931)[_0x2302('0x35')](_0xcda7e3);};}exports['index']=function(_0x3ec396,_0x1b67ff){var _0x4b5955={},_0x9e0766={},_0x87f506={'count':0x0,'rows':[]};var _0x74b325=_[_0x2302('0x36')](db['ServicenowAccount'][_0x2302('0x37')],function(_0x3775c5){return{'name':_0x3775c5['fieldName'],'type':_0x3775c5['type'][_0x2302('0x38')]};});_0x9e0766[_0x2302('0x39')]=_[_0x2302('0x36')](_0x74b325,_0x2302('0x34'));_0x9e0766[_0x2302('0x3a')]=_[_0x2302('0x3b')](_0x3ec396['query']);_0x9e0766[_0x2302('0x3c')]=_['intersection'](_0x9e0766[_0x2302('0x39')],_0x9e0766[_0x2302('0x3a')]);_0x4b5955[_0x2302('0x3d')]=_[_0x2302('0x3e')](_0x9e0766[_0x2302('0x39')],qs[_0x2302('0x3f')](_0x3ec396[_0x2302('0x3a')][_0x2302('0x3f')]));_0x4b5955[_0x2302('0x3d')]=_0x4b5955[_0x2302('0x3d')][_0x2302('0x40')]?_0x4b5955[_0x2302('0x3d')]:_0x9e0766[_0x2302('0x39')];if(!_0x3ec396[_0x2302('0x3a')][_0x2302('0x41')](_0x2302('0x42'))){_0x4b5955['limit']=qs[_0x2302('0x2a')](_0x3ec396[_0x2302('0x3a')]['limit']);_0x4b5955[_0x2302('0x29')]=qs['offset'](_0x3ec396['query'][_0x2302('0x29')]);}_0x4b5955[_0x2302('0x43')]=qs[_0x2302('0x44')](_0x3ec396[_0x2302('0x3a')]['sort']);_0x4b5955[_0x2302('0x45')]=qs['filters'](_['pick'](_0x3ec396[_0x2302('0x3a')],_0x9e0766['filters']),_0x74b325);if(_0x3ec396['query'][_0x2302('0x46')]){_0x4b5955[_0x2302('0x45')]=_[_0x2302('0x47')](_0x4b5955[_0x2302('0x45')],{'$or':_[_0x2302('0x36')](_0x74b325,function(_0x1f9c75){if(_0x1f9c75[_0x2302('0x48')]!=='VIRTUAL'){var _0x3f8565={};_0x3f8565[_0x1f9c75[_0x2302('0x34')]]={'$like':'%'+_0x3ec396['query'][_0x2302('0x46')]+'%'};return _0x3f8565;}})});}_0x4b5955=_[_0x2302('0x47')]({},_0x4b5955,_0x3ec396[_0x2302('0x49')]);var _0x311f1d={'where':_0x4b5955[_0x2302('0x45')]};return db[_0x2302('0x4a')][_0x2302('0x28')](_0x311f1d)[_0x2302('0x31')](function(_0x109f84){_0x87f506[_0x2302('0x28')]=_0x109f84;if(_0x3ec396[_0x2302('0x3a')][_0x2302('0x4b')]){_0x4b5955[_0x2302('0x4c')]=[{'all':!![]}];}return db[_0x2302('0x4a')][_0x2302('0x4d')](_0x4b5955);})[_0x2302('0x31')](function(_0x3562a9){_0x87f506[_0x2302('0x4e')]=_0x3562a9;return _0x87f506;})[_0x2302('0x31')](respondWithFilteredResult(_0x1b67ff,_0x4b5955))[_0x2302('0x23')](handleError(_0x1b67ff,null));};exports[_0x2302('0x4f')]=function(_0x5654a7,_0x592c04){var _0x4b1c91={'raw':![],'where':{'id':_0x5654a7[_0x2302('0x50')]['id']}},_0x142766={};_0x142766[_0x2302('0x39')]=_[_0x2302('0x3b')](db[_0x2302('0x4a')]['rawAttributes']);_0x142766[_0x2302('0x3a')]=_[_0x2302('0x3b')](_0x5654a7[_0x2302('0x3a')]);_0x142766['filters']=_['intersection'](_0x142766[_0x2302('0x39')],_0x142766[_0x2302('0x3a')]);_0x4b1c91[_0x2302('0x3d')]=_['intersection'](_0x142766['model'],qs[_0x2302('0x3f')](_0x5654a7[_0x2302('0x3a')][_0x2302('0x3f')]));_0x4b1c91[_0x2302('0x3d')]=_0x4b1c91[_0x2302('0x3d')]['length']?_0x4b1c91[_0x2302('0x3d')]:_0x142766['model'];if(_0x5654a7[_0x2302('0x3a')]['includeAll']){_0x4b1c91[_0x2302('0x4c')]=[{'all':!![]}];}_0x4b1c91=_['merge']({},_0x4b1c91,_0x5654a7[_0x2302('0x49')]);return db['ServicenowAccount']['find'](_0x4b1c91)[_0x2302('0x31')](handleEntityNotFound(_0x592c04,null))['then'](respondWithResult(_0x592c04,null))[_0x2302('0x23')](handleError(_0x592c04,null));};exports[_0x2302('0x51')]=function(_0x4a177e,_0x2838e0){return db['ServicenowAccount'][_0x2302('0x51')](_0x4a177e['body'],{})['then'](respondWithResult(_0x2838e0,0xc9))[_0x2302('0x23')](handleError(_0x2838e0,null));};exports[_0x2302('0x30')]=function(_0x4bdb5d,_0x4beec3){if(_0x4bdb5d[_0x2302('0x52')]['id']){delete _0x4bdb5d[_0x2302('0x52')]['id'];}return db['ServicenowAccount'][_0x2302('0x53')]({'where':{'id':_0x4bdb5d[_0x2302('0x50')]['id']}})[_0x2302('0x31')](handleEntityNotFound(_0x4beec3,null))['then'](saveUpdates(_0x4bdb5d[_0x2302('0x52')],null))['then'](respondWithResult(_0x4beec3,null))[_0x2302('0x23')](handleError(_0x4beec3,null));};exports[_0x2302('0x32')]=function(_0x315c05,_0x452c6c){return db[_0x2302('0x4a')][_0x2302('0x53')]({'where':{'id':_0x315c05[_0x2302('0x50')]['id']}})[_0x2302('0x31')](handleEntityNotFound(_0x452c6c,null))[_0x2302('0x31')](removeEntity(_0x452c6c,null))[_0x2302('0x23')](handleError(_0x452c6c,null));};exports['getConfigurations']=function(_0x2f6fb4,_0x9ee10f,_0x19c162){var _0x3202ff={};var _0x426945={};var _0x3d451e;var _0x4fff7a;return db[_0x2302('0x4a')][_0x2302('0x54')]({'where':{'id':_0x2f6fb4[_0x2302('0x50')]['id']}})[_0x2302('0x31')](handleEntityNotFound(_0x9ee10f,null))['then'](function(_0xc7ed1e){if(_0xc7ed1e){_0x3d451e=_0xc7ed1e;_0x426945[_0x2302('0x39')]=_[_0x2302('0x3b')](db[_0x2302('0x55')][_0x2302('0x37')]);_0x426945[_0x2302('0x3a')]=_[_0x2302('0x3b')](_0x2f6fb4[_0x2302('0x3a')]);_0x426945[_0x2302('0x3c')]=_['intersection'](_0x426945[_0x2302('0x39')],_0x426945[_0x2302('0x3a')]);_0x3202ff['attributes']=_['intersection'](_0x426945[_0x2302('0x39')],qs['fields'](_0x2f6fb4[_0x2302('0x3a')]['fields']));_0x3202ff[_0x2302('0x3d')]=_0x3202ff['attributes'][_0x2302('0x40')]?_0x3202ff[_0x2302('0x3d')]:_0x426945[_0x2302('0x39')];_0x3202ff[_0x2302('0x43')]=qs[_0x2302('0x44')](_0x2f6fb4[_0x2302('0x3a')][_0x2302('0x44')]);_0x3202ff['where']=qs[_0x2302('0x3c')](_[_0x2302('0x56')](_0x2f6fb4[_0x2302('0x3a')],_0x426945[_0x2302('0x3c')]));if(_0x2f6fb4[_0x2302('0x3a')][_0x2302('0x46')]){_0x3202ff['where']=_[_0x2302('0x47')](_0x3202ff['where'],{'$or':_['map'](_0x3202ff[_0x2302('0x3d')],function(_0x2617ec){var _0x5793ae={};_0x5793ae[_0x2617ec]={'$like':'%'+_0x2f6fb4[_0x2302('0x3a')][_0x2302('0x46')]+'%'};return _0x5793ae;})});}_0x3202ff=_[_0x2302('0x47')]({},_0x3202ff,_0x2f6fb4[_0x2302('0x49')]);return _0x3d451e[_0x2302('0x57')](_0x3202ff);}})[_0x2302('0x31')](function(_0x55a4f4){if(_0x55a4f4){_0x4fff7a=_0x55a4f4[_0x2302('0x40')];if(!_0x2f6fb4[_0x2302('0x3a')]['hasOwnProperty'](_0x2302('0x42'))){_0x3202ff[_0x2302('0x2a')]=qs[_0x2302('0x2a')](_0x2f6fb4[_0x2302('0x3a')]['limit']);_0x3202ff[_0x2302('0x29')]=qs[_0x2302('0x29')](_0x2f6fb4[_0x2302('0x3a')]['offset']);}return _0x3d451e['getConfigurations'](_0x3202ff);}})['then'](function(_0x251b80){if(_0x251b80){return _0x251b80?{'count':_0x4fff7a,'rows':_0x251b80}:null;}})[_0x2302('0x31')](respondWithResult(_0x9ee10f,null))[_0x2302('0x23')](handleError(_0x9ee10f,null));};exports[_0x2302('0x58')]=function(_0x5db548,_0x511e3a,_0x16f973){if(_0x5db548['body']['id']){delete _0x5db548[_0x2302('0x52')]['id'];}return db[_0x2302('0x4a')][_0x2302('0x54')]({'where':{'id':_0x5db548['params']['id']}})[_0x2302('0x31')](handleEntityNotFound(_0x511e3a,null))[_0x2302('0x31')](function(_0x17715e){if(_0x17715e){_0x5db548[_0x2302('0x52')][_0x2302('0x59')]=_0x17715e['id'];_0x5db548['body'][_0x2302('0x5a')]=integrations['getSubjects'](_0x5db548['body']['channel'],_0x5db548[_0x2302('0x52')][_0x2302('0x48')]);_0x5db548[_0x2302('0x52')][_0x2302('0x5b')]=integrations[_0x2302('0x5c')](_0x5db548[_0x2302('0x52')][_0x2302('0x5d')],_0x5db548['body'][_0x2302('0x48')]);return db[_0x2302('0x55')]['create'](_0x5db548[_0x2302('0x52')],{'include':[{'model':db['ServicenowField'],'as':_0x2302('0x5a')},{'model':db[_0x2302('0x5e')],'as':_0x2302('0x5b')}]});}return null;})[_0x2302('0x31')](respondWithResult(_0x511e3a,null))[_0x2302('0x23')](handleError(_0x511e3a,null));};exports[_0x2302('0x5f')]=function(_0x1ded29,_0x5a8c9c,_0x4a40e7){var _0x35790b=[_0x2302('0x60'),_0x2302('0x61'),_0x2302('0x62'),_0x2302('0x63'),_0x2302('0x64'),'notify','incident_state',_0x2302('0x65'),_0x2302('0x66')];var _0x2ce8cb=[_0x2302('0x67'),'made_sla',_0x2302('0x68'),'watch_list',_0x2302('0x69'),'sys_updated_on',_0x2302('0x6a'),_0x2302('0x61'),_0x2302('0x6b'),_0x2302('0x6c'),_0x2302('0x6d'),_0x2302('0x6e'),_0x2302('0x6f'),_0x2302('0x70'),_0x2302('0x71'),'sys_domain',_0x2302('0x72'),_0x2302('0x73'),'knowledge','order','calendar_stc',_0x2302('0x74'),_0x2302('0x75'),_0x2302('0x76'),_0x2302('0x77'),_0x2302('0x78'),_0x2302('0x79'),_0x2302('0x7a'),'priority',_0x2302('0x7b'),_0x2302('0x7c'),_0x2302('0x7d'),_0x2302('0x7e'),'opened_at',_0x2302('0x7f'),_0x2302('0x80'),_0x2302('0x81'),'reopened_time',_0x2302('0x82'),_0x2302('0x83'),'approval_set','subcategory','work_notes',_0x2302('0x84'),'close_code',_0x2302('0x85'),_0x2302('0x86'),_0x2302('0x87'),_0x2302('0x88'),_0x2302('0x89'),'additional_assignee_list',_0x2302('0x8a'),_0x2302('0x8b'),_0x2302('0x8c'),_0x2302('0x8d'),'close_notes',_0x2302('0x8e'),_0x2302('0x8f'),_0x2302('0x90'),'sys_id',_0x2302('0x91'),_0x2302('0x92'),'incident_state','urgency','problem_id',_0x2302('0x93'),'reassignment_count',_0x2302('0x94'),'assigned_to',_0x2302('0x65'),'comments',_0x2302('0x95'),_0x2302('0x96'),_0x2302('0x97'),_0x2302('0x98'),_0x2302('0x99'),_0x2302('0x9a'),'sys_tags',_0x2302('0x9b'),_0x2302('0x9c'),'correlation_id',_0x2302('0x9d'),_0x2302('0x66')];var _0x210caa='';var _0x406ce7='';var _0x1610ff=[];var _0x13a676='';var _0x35c3fe='';var _0x1b2ddc=[];var _0x1140a8='';var _0x9f7993='';var _0x674f6={};var _0x277ee3='';return db[_0x2302('0x4a')][_0x2302('0x54')]({'where':{'id':_0x1ded29['params']['id']},'attributes':['id',_0x2302('0x9e'),_0x2302('0x9f'),_0x2302('0xa0'),_0x2302('0xa1'),_0x2302('0xa2')]})[_0x2302('0x31')](handleEntityNotFound(_0x5a8c9c,null))['then'](function(_0x31218f){if(_0x31218f){_0x277ee3=_0x31218f[_0x2302('0xa1')];var _0x2b0b0f=_0x277ee3[_0x2302('0xa3')](-0x1);if(_0x2b0b0f==='/'){_0x277ee3=_0x277ee3[_0x2302('0xa4')](0x0,_0x277ee3[_0x2302('0xa5')](_0x2b0b0f));}_0x9f7993=util[_0x2302('0xa6')](_0x2302('0xa7'),_0x277ee3);_0x1140a8=util[_0x2302('0xa6')]('%s/api/now/table/',_0x277ee3);_0x674f6={'user':_0x31218f['username'],'pass':_0x31218f['password']};var _0x1a28af={'method':_0x2302('0xa8'),'uri':_0x9f7993+_0x2302('0xa9'),'auth':_0x674f6,'json':!![]};return rp(_0x1a28af);}})[_0x2302('0x31')](function(_0xb10a18){if(_0xb10a18[_0x2302('0xaa')][_0x2302('0x40')]>0x0){_0x210caa=_0xb10a18['result'];}console[_0x2302('0xab')](_0x2302('0xac'),_0x210caa);_0x1b2ddc=[];_0x406ce7=Object[_0x2302('0xad')]([],_0x210caa);_[_0x2302('0xae')](_0x406ce7,function(_0x4206bc){return!_0x35790b['includes'](_0x4206bc['name']);});_0x406ce7['forEach'](function(_0x1f1334){var _0x267034=createFieldObject(_0x1140a8,_0x674f6,_0x1f1334[_0x2302('0xaf')],_0x1f1334[_0x2302('0x34')],_0x1f1334[_0x2302('0xb0')],![]);_0x1b2ddc[_0x2302('0xb1')](_0x267034);});return Promise[_0x2302('0xb2')](_0x1b2ddc);})[_0x2302('0x31')](function(_0x5ab1bc){_0x1610ff=_0x5ab1bc;_0x13a676=Object[_0x2302('0xad')]([],_0x210caa);console['log'](_0x2302('0xb3'),_0x210caa);_[_0x2302('0xae')](_0x13a676,function(_0x4e0b7f){return _0x2ce8cb[_0x2302('0xb4')](_0x4e0b7f[_0x2302('0x34')]);});console['log'](_0x2302('0xb5'),_0x13a676);_0x1b2ddc=[];_0x13a676[_0x2302('0xb6')](function(_0x8955b5){var _0x5ee68b=createFieldObject(_0x1140a8,_0x674f6,_0x8955b5[_0x2302('0xaf')],_0x8955b5[_0x2302('0x34')],_0x8955b5[_0x2302('0xb0')],!![]);_0x1b2ddc[_0x2302('0xb1')](_0x5ee68b);});return Promise[_0x2302('0xb2')](_0x1b2ddc);})[_0x2302('0x31')](function(_0x21aeba){_0x35c3fe=_0x21aeba;var _0x19b79b=_0x1610ff['concat'](_0x35c3fe);return{'count':_0x19b79b['length'],'rows':_0x19b79b};})[_0x2302('0x31')](respondWithResult(_0x5a8c9c,null))[_0x2302('0x23')](function(_0x45a18d){console['log']('ServiceNow\x20error:\x20'+_0x45a18d);var _0x932ed3=_0x1ded29['query']['test']?0x1f4:_0x45a18d[_0x2302('0xb7')]||0x1f4;logger[_0x2302('0x21')](_0x45a18d[_0x2302('0x33')]);delete _0x45a18d[_0x2302('0x34')];if(_0x932ed3===0x191){_0x932ed3=0x190;}_0x5a8c9c['status'](_0x932ed3)[_0x2302('0x35')](_0x1ded29['query']['test']?{'message':_0x2302('0xb8'),'statusCode':_0x45a18d['statusCode']}:_0x45a18d);});};function createFieldObject(_0x22b98e,_0x231921,_0x27245c,_0x1051cf,_0x29b8eb,_0x1b4a03){return new Promise(function(_0x3fe351,_0x17d8b9){var _0x292beb={'id':_0x1051cf,'name':_0x29b8eb,'custom':_0x1b4a03};if(_0x27245c===_0x2302('0xb9')){_0x292beb['options']=[{'name':_0x2302('0xba'),'value':'true'},{'name':_0x2302('0xbb'),'value':_0x2302('0xbc')}];_0x3fe351(_0x292beb);}else{var _0x153e85={'method':_0x2302('0xa8'),'uri':_0x22b98e+'sys_choice?sysparm_query=name=incident^element='+_0x1051cf,'auth':_0x231921,'json':!![]};return rp(_0x153e85)['then'](function(_0x6c6d71){var _0xd5d85b=[];if(_0x6c6d71[_0x2302('0xaa')]['length']>0x0){_0x6c6d71[_0x2302('0xaa')][_0x2302('0xb6')](function(_0x475252){if(_0x475252[_0x2302('0xbd')]==='false'){var _0x198c61={'name':_0x475252[_0x2302('0xb0')],'value':_0x475252[_0x2302('0xbe')]};_0xd5d85b[_0x2302('0xb1')](_0x198c61);}});}_0x292beb[_0x2302('0x49')]=_0xd5d85b;if(_0x292beb['options']['length']>0x0){_0x3fe351(_0x292beb);}else{if(_0x1b4a03==![]){_0x3fe351();}else{_0x3fe351(_0x292beb);}}});}});} \ No newline at end of file +var _0x87f3=['request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','create','body','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','opened_at','group_list','work_end','reopened_time','resolved_at','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','location','password','email','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','push','all','TCL:\x20_object','includes','label','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then'];(function(_0x1f8ee9,_0x521f85){var _0x24c8a9=function(_0x351d5a){while(--_0x351d5a){_0x1f8ee9['push'](_0x1f8ee9['shift']());}};_0x24c8a9(++_0x521f85);}(_0x87f3,0x165));var _0x387f=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x87f3[_0x16629d];return _0x56ccee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x387f('0x0'));var rimraf=require(_0x387f('0x1'));var zipdir=require(_0x387f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x387f('0x3'));var moment=require(_0x387f('0x4'));var BPromise=require(_0x387f('0x5'));var Mustache=require('mustache');var util=require(_0x387f('0x6'));var path=require(_0x387f('0x7'));var sox=require('sox');var csv=require(_0x387f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x387f('0x9'));var squel=require(_0x387f('0xa'));var crypto=require(_0x387f('0xb'));var jsforce=require(_0x387f('0xc'));var deskjs=require(_0x387f('0xd'));var toCsv=require(_0x387f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x387f('0xe'));var qs=require(_0x387f('0xf'));var as=require(_0x387f('0x10'));var hardwareService=require(_0x387f('0x11'));var logger=require('../../config/logger')(_0x387f('0x12'));var utils=require(_0x387f('0x13'));var config=require(_0x387f('0x14'));var db=require(_0x387f('0x15'))['db'];var integrations=require(_0x387f('0x16'));var jayson=require(_0x387f('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0xa67403,_0x4b4dd7,_0x48361e){if(_0x48361e){var _0x557547=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x557547[_0x387f('0x18')](_0x4b4dd7)){return _0xa67403;}else{throw new db[(_0x387f('0x19'))]['ValidationError'](_0x387f('0x1a'));}}else{return _0xa67403;}}function respondWithRpcPromise(_0x396045,_0x5928d9,_0x3d87be,_0xa16ca1){return new BPromise(function(_0x5a5bec,_0x47d8a6){var _0xf029b6=_0xa16ca1||client;return _0xf029b6[_0x387f('0x1b')](_0x396045,_0x3d87be)[_0x387f('0x1c')](function(_0x8892){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x5928d9,_0x387f('0x1d'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5928d9,_0x387f('0x1d'),JSON[_0x387f('0x1e')](_0x8892));if(_0x8892[_0x387f('0x1f')]){if(_0x8892[_0x387f('0x1f')]['code']===0x1f4){logger[_0x387f('0x1f')](_0x387f('0x20'),_0x5928d9,_0x8892[_0x387f('0x1f')]['message']);return _0x47d8a6(_0x8892['error'][_0x387f('0x21')]);}logger[_0x387f('0x1f')](_0x387f('0x20'),_0x5928d9,_0x8892[_0x387f('0x1f')]['message']);return _0x5a5bec(_0x8892['error'][_0x387f('0x21')]);}else{logger[_0x387f('0x22')](_0x387f('0x20'),_0x5928d9,_0x387f('0x1d'));_0x5a5bec(_0x8892['result'][_0x387f('0x21')]);}})[_0x387f('0x23')](function(_0xd8f664){logger['error'](_0x387f('0x20'),_0x5928d9,_0xd8f664);_0x47d8a6(_0xd8f664);});});}function respondWithStatusCode(_0x292f52,_0x3c4450){_0x3c4450=_0x3c4450||0xcc;return function(_0x136113){if(_0x136113){return _0x292f52[_0x387f('0x24')](_0x3c4450);}return _0x292f52[_0x387f('0x25')](_0x3c4450)[_0x387f('0x26')]();};}function respondWithResult(_0x5e1ac8,_0xbbe09f){_0xbbe09f=_0xbbe09f||0xc8;return function(_0x225ac1){if(_0x225ac1){return _0x5e1ac8[_0x387f('0x25')](_0xbbe09f)[_0x387f('0x27')](_0x225ac1);}};}function respondWithFilteredResult(_0x41f487,_0x131274){return function(_0x12afa9){if(_0x12afa9){var _0x1949b6=_0x12afa9[_0x387f('0x28')],_0x3b7024=_0x131274[_0x387f('0x29')],_0xec885a=_0x131274[_0x387f('0x29')]+_0x131274[_0x387f('0x2a')],_0x51765c;if(_0xec885a>=_0x1949b6){_0xec885a=_0x1949b6;_0x51765c=0xc8;}else{_0x51765c=0xce;}_0x41f487[_0x387f('0x25')](_0x51765c);return _0x41f487[_0x387f('0x2b')](_0x387f('0x2c'),_0x3b7024+'-'+_0xec885a+'/'+_0x1949b6)[_0x387f('0x27')](_0x12afa9);}return null;};}function patchUpdates(_0x5d0866){return function(_0x5394ea){try{jsonpatch[_0x387f('0x2d')](_0x5394ea,_0x5d0866,!![]);}catch(_0x465387){return BPromise[_0x387f('0x2e')](_0x465387);}return _0x5394ea[_0x387f('0x2f')]();};}function saveUpdates(_0x5a94b9,_0x209dec){return function(_0x1976f8){if(_0x1976f8){return _0x1976f8[_0x387f('0x30')](_0x5a94b9)['then'](function(_0x17ec75){return _0x17ec75;});}return null;};}function removeEntity(_0x3ee95b,_0xf3edaf){return function(_0x208b91){if(_0x208b91){return _0x208b91[_0x387f('0x31')]()[_0x387f('0x1c')](function(){_0x3ee95b['status'](0xcc)[_0x387f('0x26')]();});}};}function handleEntityNotFound(_0x1a4cdf,_0x5cccf2){return function(_0x27605e){if(!_0x27605e){_0x1a4cdf[_0x387f('0x24')](0x194);}return _0x27605e;};}function handleError(_0x3e81a2,_0x500849){_0x500849=_0x500849||0x1f4;return function(_0x5e5c0b){logger['error'](_0x5e5c0b['stack']);if(_0x5e5c0b[_0x387f('0x32')]){delete _0x5e5c0b['name'];}_0x3e81a2[_0x387f('0x25')](_0x500849)[_0x387f('0x33')](_0x5e5c0b);};}exports[_0x387f('0x34')]=function(_0x361f1b,_0x2fb4ac){var _0x2b26aa={},_0x3aa02a={},_0x554993={'count':0x0,'rows':[]};var _0x4101cc=_[_0x387f('0x35')](db[_0x387f('0x36')]['rawAttributes'],function(_0x2b7d04){return{'name':_0x2b7d04[_0x387f('0x37')],'type':_0x2b7d04[_0x387f('0x38')][_0x387f('0x39')]};});_0x3aa02a[_0x387f('0x3a')]=_[_0x387f('0x35')](_0x4101cc,_0x387f('0x32'));_0x3aa02a[_0x387f('0x3b')]=_[_0x387f('0x3c')](_0x361f1b[_0x387f('0x3b')]);_0x3aa02a[_0x387f('0x3d')]=_['intersection'](_0x3aa02a[_0x387f('0x3a')],_0x3aa02a[_0x387f('0x3b')]);_0x2b26aa[_0x387f('0x3e')]=_[_0x387f('0x3f')](_0x3aa02a[_0x387f('0x3a')],qs[_0x387f('0x40')](_0x361f1b[_0x387f('0x3b')][_0x387f('0x40')]));_0x2b26aa['attributes']=_0x2b26aa['attributes']['length']?_0x2b26aa[_0x387f('0x3e')]:_0x3aa02a['model'];if(!_0x361f1b[_0x387f('0x3b')][_0x387f('0x41')](_0x387f('0x42'))){_0x2b26aa['limit']=qs[_0x387f('0x2a')](_0x361f1b['query'][_0x387f('0x2a')]);_0x2b26aa['offset']=qs[_0x387f('0x29')](_0x361f1b['query']['offset']);}_0x2b26aa[_0x387f('0x43')]=qs[_0x387f('0x44')](_0x361f1b[_0x387f('0x3b')]['sort']);_0x2b26aa[_0x387f('0x45')]=qs[_0x387f('0x3d')](_[_0x387f('0x46')](_0x361f1b[_0x387f('0x3b')],_0x3aa02a[_0x387f('0x3d')]),_0x4101cc);if(_0x361f1b['query'][_0x387f('0x47')]){_0x2b26aa[_0x387f('0x45')]=_[_0x387f('0x48')](_0x2b26aa[_0x387f('0x45')],{'$or':_[_0x387f('0x35')](_0x4101cc,function(_0x4fe4ca){if(_0x4fe4ca['type']!=='VIRTUAL'){var _0x30ee0f={};_0x30ee0f[_0x4fe4ca[_0x387f('0x32')]]={'$like':'%'+_0x361f1b[_0x387f('0x3b')][_0x387f('0x47')]+'%'};return _0x30ee0f;}})});}_0x2b26aa=_[_0x387f('0x48')]({},_0x2b26aa,_0x361f1b[_0x387f('0x49')]);var _0x14904a={'where':_0x2b26aa[_0x387f('0x45')]};return db[_0x387f('0x36')][_0x387f('0x28')](_0x14904a)[_0x387f('0x1c')](function(_0x144a57){_0x554993[_0x387f('0x28')]=_0x144a57;if(_0x361f1b[_0x387f('0x3b')][_0x387f('0x4a')]){_0x2b26aa['include']=[{'all':!![]}];}return db[_0x387f('0x36')][_0x387f('0x4b')](_0x2b26aa);})[_0x387f('0x1c')](function(_0x273f8b){_0x554993[_0x387f('0x4c')]=_0x273f8b;return _0x554993;})[_0x387f('0x1c')](respondWithFilteredResult(_0x2fb4ac,_0x2b26aa))[_0x387f('0x23')](handleError(_0x2fb4ac,null));};exports[_0x387f('0x4d')]=function(_0x465b7d,_0x182abd){var _0x273560={'raw':![],'where':{'id':_0x465b7d[_0x387f('0x4e')]['id']}},_0x5718d8={};_0x5718d8[_0x387f('0x3a')]=_[_0x387f('0x3c')](db[_0x387f('0x36')][_0x387f('0x4f')]);_0x5718d8[_0x387f('0x3b')]=_[_0x387f('0x3c')](_0x465b7d[_0x387f('0x3b')]);_0x5718d8[_0x387f('0x3d')]=_[_0x387f('0x3f')](_0x5718d8[_0x387f('0x3a')],_0x5718d8[_0x387f('0x3b')]);_0x273560[_0x387f('0x3e')]=_['intersection'](_0x5718d8[_0x387f('0x3a')],qs[_0x387f('0x40')](_0x465b7d[_0x387f('0x3b')][_0x387f('0x40')]));_0x273560['attributes']=_0x273560[_0x387f('0x3e')][_0x387f('0x50')]?_0x273560[_0x387f('0x3e')]:_0x5718d8[_0x387f('0x3a')];if(_0x465b7d[_0x387f('0x3b')][_0x387f('0x4a')]){_0x273560[_0x387f('0x51')]=[{'all':!![]}];}_0x273560=_['merge']({},_0x273560,_0x465b7d[_0x387f('0x49')]);return db[_0x387f('0x36')][_0x387f('0x52')](_0x273560)[_0x387f('0x1c')](handleEntityNotFound(_0x182abd,null))['then'](respondWithResult(_0x182abd,null))[_0x387f('0x23')](handleError(_0x182abd,null));};exports[_0x387f('0x53')]=function(_0x2b777d,_0x368b39){return db[_0x387f('0x36')][_0x387f('0x53')](_0x2b777d[_0x387f('0x54')],{})['then'](respondWithResult(_0x368b39,0xc9))[_0x387f('0x23')](handleError(_0x368b39,null));};exports[_0x387f('0x30')]=function(_0x518c3b,_0x35a8ec){if(_0x518c3b[_0x387f('0x54')]['id']){delete _0x518c3b['body']['id'];}return db[_0x387f('0x36')][_0x387f('0x52')]({'where':{'id':_0x518c3b[_0x387f('0x4e')]['id']}})[_0x387f('0x1c')](handleEntityNotFound(_0x35a8ec,null))[_0x387f('0x1c')](saveUpdates(_0x518c3b['body'],null))[_0x387f('0x1c')](respondWithResult(_0x35a8ec,null))[_0x387f('0x23')](handleError(_0x35a8ec,null));};exports[_0x387f('0x31')]=function(_0x46c5f3,_0x4ab236){return db[_0x387f('0x36')][_0x387f('0x52')]({'where':{'id':_0x46c5f3['params']['id']}})[_0x387f('0x1c')](handleEntityNotFound(_0x4ab236,null))['then'](removeEntity(_0x4ab236,null))[_0x387f('0x23')](handleError(_0x4ab236,null));};exports[_0x387f('0x55')]=function(_0x14e71e,_0x8e7ab8,_0x2d7c15){var _0x108b2c={};var _0x75e9a1={};var _0x1af69d;var _0xc91155;return db[_0x387f('0x36')]['findOne']({'where':{'id':_0x14e71e['params']['id']}})[_0x387f('0x1c')](handleEntityNotFound(_0x8e7ab8,null))[_0x387f('0x1c')](function(_0x306828){if(_0x306828){_0x1af69d=_0x306828;_0x75e9a1[_0x387f('0x3a')]=_[_0x387f('0x3c')](db[_0x387f('0x56')]['rawAttributes']);_0x75e9a1[_0x387f('0x3b')]=_[_0x387f('0x3c')](_0x14e71e['query']);_0x75e9a1[_0x387f('0x3d')]=_['intersection'](_0x75e9a1[_0x387f('0x3a')],_0x75e9a1[_0x387f('0x3b')]);_0x108b2c[_0x387f('0x3e')]=_[_0x387f('0x3f')](_0x75e9a1[_0x387f('0x3a')],qs[_0x387f('0x40')](_0x14e71e[_0x387f('0x3b')][_0x387f('0x40')]));_0x108b2c[_0x387f('0x3e')]=_0x108b2c[_0x387f('0x3e')][_0x387f('0x50')]?_0x108b2c[_0x387f('0x3e')]:_0x75e9a1['model'];_0x108b2c[_0x387f('0x43')]=qs[_0x387f('0x44')](_0x14e71e[_0x387f('0x3b')][_0x387f('0x44')]);_0x108b2c[_0x387f('0x45')]=qs[_0x387f('0x3d')](_['pick'](_0x14e71e[_0x387f('0x3b')],_0x75e9a1[_0x387f('0x3d')]));if(_0x14e71e[_0x387f('0x3b')]['filter']){_0x108b2c[_0x387f('0x45')]=_[_0x387f('0x48')](_0x108b2c[_0x387f('0x45')],{'$or':_[_0x387f('0x35')](_0x108b2c[_0x387f('0x3e')],function(_0x12fb64){var _0xcd953a={};_0xcd953a[_0x12fb64]={'$like':'%'+_0x14e71e[_0x387f('0x3b')][_0x387f('0x47')]+'%'};return _0xcd953a;})});}_0x108b2c=_[_0x387f('0x48')]({},_0x108b2c,_0x14e71e[_0x387f('0x49')]);return _0x1af69d[_0x387f('0x55')](_0x108b2c);}})['then'](function(_0x1d15e3){if(_0x1d15e3){_0xc91155=_0x1d15e3[_0x387f('0x50')];if(!_0x14e71e['query'][_0x387f('0x41')](_0x387f('0x42'))){_0x108b2c[_0x387f('0x2a')]=qs['limit'](_0x14e71e[_0x387f('0x3b')][_0x387f('0x2a')]);_0x108b2c[_0x387f('0x29')]=qs[_0x387f('0x29')](_0x14e71e[_0x387f('0x3b')]['offset']);}return _0x1af69d[_0x387f('0x55')](_0x108b2c);}})[_0x387f('0x1c')](function(_0x52ba65){if(_0x52ba65){return _0x52ba65?{'count':_0xc91155,'rows':_0x52ba65}:null;}})[_0x387f('0x1c')](respondWithResult(_0x8e7ab8,null))['catch'](handleError(_0x8e7ab8,null));};exports[_0x387f('0x57')]=function(_0x8b5fba,_0x17dad4,_0x4f3873){if(_0x8b5fba[_0x387f('0x54')]['id']){delete _0x8b5fba['body']['id'];}return db['ServicenowAccount'][_0x387f('0x58')]({'where':{'id':_0x8b5fba[_0x387f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17dad4,null))[_0x387f('0x1c')](function(_0x59afaa){if(_0x59afaa){_0x8b5fba[_0x387f('0x54')][_0x387f('0x59')]=_0x59afaa['id'];_0x8b5fba['body'][_0x387f('0x5a')]=integrations[_0x387f('0x5b')](_0x8b5fba['body']['channel'],_0x8b5fba[_0x387f('0x54')][_0x387f('0x38')]);_0x8b5fba[_0x387f('0x54')][_0x387f('0x5c')]=integrations['getDescriptions'](_0x8b5fba[_0x387f('0x54')]['channel'],_0x8b5fba[_0x387f('0x54')]['type']);return db['ServicenowConfiguration'][_0x387f('0x53')](_0x8b5fba[_0x387f('0x54')],{'include':[{'model':db['ServicenowField'],'as':_0x387f('0x5a')},{'model':db[_0x387f('0x5d')],'as':'Descriptions'}]});}return null;})[_0x387f('0x1c')](respondWithResult(_0x17dad4,null))[_0x387f('0x23')](handleError(_0x17dad4,null));};exports[_0x387f('0x5e')]=function(_0x119742,_0x49fae8,_0x32f030){var _0x53a86a=[_0x387f('0x5f'),_0x387f('0x60'),_0x387f('0x61'),'subcategory',_0x387f('0x62'),'notify',_0x387f('0x63'),_0x387f('0x64'),_0x387f('0x65')];var _0x4a1deb=[_0x387f('0x66'),_0x387f('0x5f'),_0x387f('0x67'),_0x387f('0x68'),_0x387f('0x69'),_0x387f('0x6a'),_0x387f('0x6b'),_0x387f('0x60'),_0x387f('0x6c'),_0x387f('0x6d'),_0x387f('0x6e'),_0x387f('0x6f'),_0x387f('0x70'),_0x387f('0x71'),'sys_created_on',_0x387f('0x72'),_0x387f('0x73'),'sys_created_by',_0x387f('0x61'),_0x387f('0x43'),'calendar_stc',_0x387f('0x74'),_0x387f('0x75'),_0x387f('0x76'),'impact',_0x387f('0x77'),_0x387f('0x78'),_0x387f('0x79'),'priority','sys_domain_path','rfc','time_worked','expected_start',_0x387f('0x7a'),'business_duration',_0x387f('0x7b'),_0x387f('0x7c'),_0x387f('0x7d'),_0x387f('0x7e'),'caller_id',_0x387f('0x7f'),_0x387f('0x80'),_0x387f('0x81'),_0x387f('0x82'),_0x387f('0x62'),_0x387f('0x83'),_0x387f('0x84'),_0x387f('0x85'),_0x387f('0x86'),_0x387f('0x87'),'additional_assignee_list',_0x387f('0x88'),_0x387f('0x89'),_0x387f('0x8a'),_0x387f('0x8b'),_0x387f('0x8c'),_0x387f('0x8d'),_0x387f('0x8e'),_0x387f('0x8f'),_0x387f('0x90'),_0x387f('0x91'),'reopened_by','incident_state','urgency',_0x387f('0x92'),'company',_0x387f('0x93'),_0x387f('0x94'),_0x387f('0x95'),'severity',_0x387f('0x96'),_0x387f('0x97'),_0x387f('0x98'),_0x387f('0x99'),_0x387f('0x9a'),_0x387f('0x9b'),_0x387f('0x9c'),_0x387f('0x9d'),'escalation',_0x387f('0x9e'),'correlation_id',_0x387f('0x9f'),_0x387f('0x65')];var _0x53076d='';var _0x13988d='';var _0xd7941a=[];var _0x59e7e6='';var _0xb9e74a='';var _0x5dac4a=[];var _0x49692b='';var _0x485c31='';var _0x19716d={};var _0xc80621='';return db[_0x387f('0x36')][_0x387f('0x58')]({'where':{'id':_0x119742['params']['id']},'attributes':['id','username',_0x387f('0xa0'),_0x387f('0xa1'),'remoteUri',_0x387f('0xa2')]})['then'](handleEntityNotFound(_0x49fae8,null))[_0x387f('0x1c')](function(_0x4d9ac1){if(_0x4d9ac1){_0xc80621=_0x4d9ac1['remoteUri'];var _0x47befc=_0xc80621[_0x387f('0xa3')](-0x1);if(_0x47befc==='/'){_0xc80621=_0xc80621[_0x387f('0xa4')](0x0,_0xc80621[_0x387f('0xa5')](_0x47befc));}_0x485c31=util['format'](_0x387f('0xa6'),_0xc80621);_0x49692b=util[_0x387f('0xa7')](_0x387f('0xa8'),_0xc80621);_0x19716d={'user':_0x4d9ac1['username'],'pass':_0x4d9ac1['password']};var _0x5c1738={'method':_0x387f('0xa9'),'uri':_0x485c31+_0x387f('0xaa'),'auth':_0x19716d,'json':!![]};return rp(_0x5c1738);}})[_0x387f('0x1c')](function(_0x4e295f){if(_0x4e295f[_0x387f('0xab')][_0x387f('0x50')]>0x0){_0x53076d=_0x4e295f[_0x387f('0xab')];}console[_0x387f('0xac')](_0x387f('0xad'),_0x53076d);_0x5dac4a=[];_0x13988d=Object[_0x387f('0xae')]([],_0x53076d);_[_0x387f('0xaf')](_0x13988d,function(_0x47508f){return!_0x53a86a['includes'](_0x47508f[_0x387f('0x32')]);});_0x13988d[_0x387f('0xb0')](function(_0x307e1f){var _0x407fdd=createFieldObject(_0x49692b,_0x19716d,_0x307e1f[_0x387f('0xb1')],_0x307e1f['name'],_0x307e1f['label'],![]);_0x5dac4a[_0x387f('0xb2')](_0x407fdd);});return Promise[_0x387f('0xb3')](_0x5dac4a);})[_0x387f('0x1c')](function(_0xbeb72d){_0xd7941a=_0xbeb72d;_0x59e7e6=Object[_0x387f('0xae')]([],_0x53076d);console['log'](_0x387f('0xb4'),_0x53076d);_[_0x387f('0xaf')](_0x59e7e6,function(_0x5d13a2){return _0x4a1deb[_0x387f('0xb5')](_0x5d13a2['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x59e7e6);_0x5dac4a=[];_0x59e7e6[_0x387f('0xb0')](function(_0x366437){var _0x17ccaf=createFieldObject(_0x49692b,_0x19716d,_0x366437['internalType'],_0x366437[_0x387f('0x32')],_0x366437[_0x387f('0xb6')],!![]);_0x5dac4a[_0x387f('0xb2')](_0x17ccaf);});return Promise[_0x387f('0xb3')](_0x5dac4a);})[_0x387f('0x1c')](function(_0x2eb567){_0xb9e74a=_0x2eb567;var _0x395d5e=_0xd7941a[_0x387f('0xb7')](_0xb9e74a);return{'count':_0x395d5e[_0x387f('0x50')],'rows':_0x395d5e};})['then'](respondWithResult(_0x49fae8,null))[_0x387f('0x23')](function(_0x297a50){console['log'](_0x387f('0xb8')+_0x297a50);var _0x28ea2e=_0x119742[_0x387f('0x3b')][_0x387f('0x18')]?0x1f4:_0x297a50[_0x387f('0xb9')]||0x1f4;logger['error'](_0x297a50['stack']);delete _0x297a50['name'];if(_0x28ea2e===0x191){_0x28ea2e=0x190;}_0x49fae8[_0x387f('0x25')](_0x28ea2e)[_0x387f('0x33')](_0x119742[_0x387f('0x3b')]['test']?{'message':_0x387f('0xba'),'statusCode':_0x297a50['statusCode']}:_0x297a50);});};function createFieldObject(_0x399ca8,_0x737aed,_0x1fec64,_0x38e16a,_0x369d66,_0x4eb5d1){return new Promise(function(_0x4097d8,_0x129a27){var _0x48c8ac={'id':_0x38e16a,'name':_0x369d66,'custom':_0x4eb5d1};if(_0x1fec64==='boolean'){_0x48c8ac['options']=[{'name':_0x387f('0xbb'),'value':_0x387f('0xbc')},{'name':'False','value':'false'}];_0x4097d8(_0x48c8ac);}else{var _0x58c7ef={'method':_0x387f('0xa9'),'uri':_0x399ca8+_0x387f('0xbd')+_0x38e16a,'auth':_0x737aed,'json':!![]};return rp(_0x58c7ef)[_0x387f('0x1c')](function(_0x4c23a9){var _0xc66552=[];if(_0x4c23a9[_0x387f('0xab')][_0x387f('0x50')]>0x0){_0x4c23a9[_0x387f('0xab')]['forEach'](function(_0x573d3d){if(_0x573d3d[_0x387f('0xbe')]===_0x387f('0xbf')){var _0x589ffd={'name':_0x573d3d[_0x387f('0xb6')],'value':_0x573d3d[_0x387f('0xc0')]};_0xc66552[_0x387f('0xb2')](_0x589ffd);}});}_0x48c8ac[_0x387f('0x49')]=_0xc66552;if(_0x48c8ac['options'][_0x387f('0x50')]>0x0){_0x4097d8(_0x48c8ac);}else{if(_0x4eb5d1==![]){_0x4097d8();}else{_0x4097d8(_0x48c8ac);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index befa8ea..077cf91 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 _0x44e5=['./intServicenowAccount.attributes','exports','define','ServicenowAccount','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0x44e5,0x1f3));var _0x544e=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0x44e5[_0x39479f];return _0x4a6d96;};'use strict';var _=require(_0x544e('0x0'));var util=require(_0x544e('0x1'));var logger=require('../../config/logger')(_0x544e('0x2'));var moment=require(_0x544e('0x3'));var BPromise=require('bluebird');var rp=require(_0x544e('0x4'));var fs=require('fs');var path=require(_0x544e('0x5'));var rimraf=require(_0x544e('0x6'));var config=require('../../config/environment');var attributes=require(_0x544e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x544e('0x8')]=function(_0x186b24,_0x57ceb4){return _0x186b24[_0x544e('0x9')](_0x544e('0xa'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10cb=['define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x12aa66,_0x2d35c1){var _0x53dfe9=function(_0x2ab011){while(--_0x2ab011){_0x12aa66['push'](_0x12aa66['shift']());}};_0x53dfe9(++_0x2d35c1);}(_0x10cb,0x145));var _0xb10c=function(_0x57326a,_0x4682f5){_0x57326a=_0x57326a-0x0;var _0x24b1e7=_0x10cb[_0x57326a];return _0x24b1e7;};'use strict';var _=require(_0xb10c('0x0'));var util=require('util');var logger=require(_0xb10c('0x1'))(_0xb10c('0x2'));var moment=require('moment');var BPromise=require(_0xb10c('0x3'));var rp=require(_0xb10c('0x4'));var fs=require('fs');var path=require(_0xb10c('0x5'));var rimraf=require(_0xb10c('0x6'));var config=require(_0xb10c('0x7'));var attributes=require(_0xb10c('0x8'));var integrations=require(_0xb10c('0x9'));module[_0xb10c('0xa')]=function(_0x1336e1,_0x4a9a65){return _0x1336e1[_0xb10c('0xb')](_0xb10c('0xc'),attributes,{'tableName':_0xb10c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index ae8104d..2d3f021 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 _0x8c05=['message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d782b,_0x423255){var _0x4112fc=function(_0x58e7ee){while(--_0x58e7ee){_0x1d782b['push'](_0x1d782b['shift']());}};_0x4112fc(++_0x423255);}(_0x8c05,0x1a9));var _0x58c0=function(_0x22629d,_0x52081e){_0x22629d=_0x22629d-0x0;var _0x518a87=_0x8c05[_0x22629d];return _0x518a87;};'use strict';var _=require(_0x58c0('0x0'));var util=require(_0x58c0('0x1'));var moment=require(_0x58c0('0x2'));var BPromise=require(_0x58c0('0x3'));var rs=require(_0x58c0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58c0('0x5'))['db'];var utils=require(_0x58c0('0x6'));var logger=require(_0x58c0('0x7'))(_0x58c0('0x8'));var config=require(_0x58c0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58c0('0xa')][_0x58c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfcda7,_0x246615,_0xbb5cc1){return new BPromise(function(_0x1efc54,_0x2fc661){return client['request'](_0xfcda7,_0xbb5cc1)['then'](function(_0x4a0d43){logger[_0x58c0('0xc')](_0x58c0('0xd'),_0x246615,'request\x20sent');logger[_0x58c0('0xe')](_0x58c0('0xf'),_0x246615,'request\x20sent',JSON[_0x58c0('0x10')](_0x4a0d43));if(_0x4a0d43[_0x58c0('0x11')]){if(_0x4a0d43[_0x58c0('0x11')][_0x58c0('0x12')]===0x1f4){logger[_0x58c0('0x11')](_0x58c0('0xd'),_0x246615,_0x4a0d43['error'][_0x58c0('0x13')]);return _0x2fc661(_0x4a0d43['error']['message']);}logger[_0x58c0('0x11')](_0x58c0('0xd'),_0x246615,_0x4a0d43[_0x58c0('0x11')][_0x58c0('0x13')]);return _0x1efc54(_0x4a0d43['error']['message']);}else{logger[_0x58c0('0xc')](_0x58c0('0xd'),_0x246615,_0x58c0('0x14'));_0x1efc54(_0x4a0d43[_0x58c0('0x15')][_0x58c0('0x13')]);}})[_0x58c0('0x16')](function(_0x468db4){logger[_0x58c0('0x11')](_0x58c0('0xd'),_0x246615,_0x468db4);_0x2fc661(_0x468db4);});});}exports[_0x58c0('0x17')]=function(_0xcd3b1){var _0x3cd4ce=this;return new Promise(function(_0x296d68,_0x13a7b0){return db[_0x58c0('0x18')][_0x58c0('0x19')]({'raw':_0xcd3b1[_0x58c0('0x1a')]?_0xcd3b1[_0x58c0('0x1a')][_0x58c0('0x1b')]===undefined?!![]:![]:!![],'where':_0xcd3b1[_0x58c0('0x1a')]?_0xcd3b1[_0x58c0('0x1a')][_0x58c0('0x1c')]||null:null,'attributes':_0xcd3b1['options']?_0xcd3b1['options'][_0x58c0('0x1d')]||null:null,'limit':_0xcd3b1[_0x58c0('0x1a')]?_0xcd3b1[_0x58c0('0x1a')][_0x58c0('0x1e')]||null:null,'include':_0xcd3b1[_0x58c0('0x1a')]?_0xcd3b1[_0x58c0('0x1a')]['include']?_[_0x58c0('0x1f')](_0xcd3b1[_0x58c0('0x1a')][_0x58c0('0x20')],function(_0x18ff22){return{'model':db[_0x18ff22[_0x58c0('0x21')]],'as':_0x18ff22['as'],'attributes':_0x18ff22[_0x58c0('0x1d')],'include':_0x18ff22[_0x58c0('0x20')]?_['map'](_0x18ff22[_0x58c0('0x20')],function(_0x5cbcd0){return{'model':db[_0x5cbcd0[_0x58c0('0x21')]],'as':_0x5cbcd0['as'],'attributes':_0x5cbcd0[_0x58c0('0x1d')],'include':_0x5cbcd0['include']?_[_0x58c0('0x1f')](_0x5cbcd0[_0x58c0('0x20')],function(_0x5947a9){return{'model':db[_0x5947a9['model']],'as':_0x5947a9['as'],'attributes':_0x5947a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x58c0('0x22')](function(_0x47fa64){logger[_0x58c0('0xc')](_0x58c0('0x17'),_0xcd3b1);logger[_0x58c0('0xe')]('GetServicenowAccount',_0xcd3b1,JSON[_0x58c0('0x10')](_0x47fa64));_0x296d68(_0x47fa64);})['catch'](function(_0x3f0626){logger['error'](_0x58c0('0x17'),_0x3f0626['message'],_0xcd3b1);_0x13a7b0(_0x3cd4ce[_0x58c0('0x11')](0x1f4,_0x3f0626['message']));});});};exports[_0x58c0('0x23')]=function(_0x2d4e4f){var _0x178d20=this;return new Promise(function(_0xb0365e,_0x3f9b04){return db['ServicenowAccount'][_0x58c0('0x24')]({'raw':_0x2d4e4f[_0x58c0('0x1a')]?_0x2d4e4f[_0x58c0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2d4e4f[_0x58c0('0x1a')]?_0x2d4e4f['options'][_0x58c0('0x1c')]||null:null,'attributes':_0x2d4e4f[_0x58c0('0x1a')]?_0x2d4e4f[_0x58c0('0x1a')][_0x58c0('0x1d')]||null:null,'include':_0x2d4e4f['options']?_0x2d4e4f[_0x58c0('0x1a')][_0x58c0('0x20')]?_[_0x58c0('0x1f')](_0x2d4e4f[_0x58c0('0x1a')]['include'],function(_0x3715d0){return{'model':db[_0x3715d0[_0x58c0('0x21')]],'as':_0x3715d0['as'],'attributes':_0x3715d0[_0x58c0('0x1d')],'include':_0x3715d0['include']?_[_0x58c0('0x1f')](_0x3715d0[_0x58c0('0x20')],function(_0x2e742d){return{'model':db[_0x2e742d[_0x58c0('0x21')]],'as':_0x2e742d['as'],'attributes':_0x2e742d[_0x58c0('0x1d')],'include':_0x2e742d[_0x58c0('0x20')]?_[_0x58c0('0x1f')](_0x2e742d[_0x58c0('0x20')],function(_0x2d3a61){return{'model':db[_0x2d3a61['model']],'as':_0x2d3a61['as'],'attributes':_0x2d3a61['attributes']};}):[]};}):[]};}):[]:[]})[_0x58c0('0x22')](function(_0xbe6b0c){logger[_0x58c0('0xc')](_0x58c0('0x23'),_0x2d4e4f);logger[_0x58c0('0xe')](_0x58c0('0x23'),_0x2d4e4f,JSON[_0x58c0('0x10')](_0xbe6b0c));_0xb0365e(_0xbe6b0c);})['catch'](function(_0x646f8b){logger[_0x58c0('0x11')](_0x58c0('0x23'),_0x646f8b['message'],_0x2d4e4f);_0x3f9b04(_0x178d20['error'](0x1f4,_0x646f8b[_0x58c0('0x13')]));});});}; \ No newline at end of file +var _0x09d2=['ServicenowAccount','findAll','raw','options','where','attributes','limit','map','include','model','catch','find','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount'];(function(_0x2ef644,_0x2ab0ff){var _0x11f00e=function(_0x32983a){while(--_0x32983a){_0x2ef644['push'](_0x2ef644['shift']());}};_0x11f00e(++_0x2ab0ff);}(_0x09d2,0x13d));var _0x209d=function(_0x27a2c3,_0x15cca8){_0x27a2c3=_0x27a2c3-0x0;var _0x179c00=_0x09d2[_0x27a2c3];return _0x179c00;};'use strict';var _=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var moment=require(_0x209d('0x2'));var BPromise=require(_0x209d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x209d('0x4'));var db=require(_0x209d('0x5'))['db'];var utils=require(_0x209d('0x6'));var logger=require(_0x209d('0x7'))(_0x209d('0x8'));var config=require(_0x209d('0x9'));var jayson=require(_0x209d('0xa'));var client=jayson['client'][_0x209d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x460bd9,_0xbc980c,_0x212d8f){return new BPromise(function(_0x5a0f39,_0x5ba1e0){return client[_0x209d('0xc')](_0x460bd9,_0x212d8f)[_0x209d('0xd')](function(_0x227628){logger[_0x209d('0xe')](_0x209d('0xf'),_0xbc980c,_0x209d('0x10'));logger[_0x209d('0x11')](_0x209d('0x12'),_0xbc980c,_0x209d('0x10'),JSON[_0x209d('0x13')](_0x227628));if(_0x227628['error']){if(_0x227628[_0x209d('0x14')][_0x209d('0x15')]===0x1f4){logger[_0x209d('0x14')](_0x209d('0xf'),_0xbc980c,_0x227628[_0x209d('0x14')][_0x209d('0x16')]);return _0x5ba1e0(_0x227628[_0x209d('0x14')]['message']);}logger[_0x209d('0x14')](_0x209d('0xf'),_0xbc980c,_0x227628[_0x209d('0x14')]['message']);return _0x5a0f39(_0x227628[_0x209d('0x14')]['message']);}else{logger['info'](_0x209d('0xf'),_0xbc980c,_0x209d('0x10'));_0x5a0f39(_0x227628[_0x209d('0x17')][_0x209d('0x16')]);}})['catch'](function(_0x2fc9ae){logger[_0x209d('0x14')](_0x209d('0xf'),_0xbc980c,_0x2fc9ae);_0x5ba1e0(_0x2fc9ae);});});}exports[_0x209d('0x18')]=function(_0x4aed86){var _0x30e121=this;return new Promise(function(_0x52d681,_0x443d3b){return db[_0x209d('0x19')][_0x209d('0x1a')]({'raw':_0x4aed86['options']?_0x4aed86['options'][_0x209d('0x1b')]===undefined?!![]:![]:!![],'where':_0x4aed86['options']?_0x4aed86[_0x209d('0x1c')][_0x209d('0x1d')]||null:null,'attributes':_0x4aed86[_0x209d('0x1c')]?_0x4aed86[_0x209d('0x1c')][_0x209d('0x1e')]||null:null,'limit':_0x4aed86[_0x209d('0x1c')]?_0x4aed86[_0x209d('0x1c')][_0x209d('0x1f')]||null:null,'include':_0x4aed86[_0x209d('0x1c')]?_0x4aed86[_0x209d('0x1c')]['include']?_[_0x209d('0x20')](_0x4aed86['options'][_0x209d('0x21')],function(_0x1025f4){return{'model':db[_0x1025f4[_0x209d('0x22')]],'as':_0x1025f4['as'],'attributes':_0x1025f4['attributes'],'include':_0x1025f4['include']?_[_0x209d('0x20')](_0x1025f4['include'],function(_0x2fef73){return{'model':db[_0x2fef73['model']],'as':_0x2fef73['as'],'attributes':_0x2fef73[_0x209d('0x1e')],'include':_0x2fef73[_0x209d('0x21')]?_[_0x209d('0x20')](_0x2fef73['include'],function(_0x270baf){return{'model':db[_0x270baf[_0x209d('0x22')]],'as':_0x270baf['as'],'attributes':_0x270baf['attributes']};}):[]};}):[]};}):[]:[]})[_0x209d('0xd')](function(_0xdc3ebe){logger[_0x209d('0xe')]('GetServicenowAccount',_0x4aed86);logger[_0x209d('0x11')](_0x209d('0x18'),_0x4aed86,JSON['stringify'](_0xdc3ebe));_0x52d681(_0xdc3ebe);})[_0x209d('0x23')](function(_0x15aaf1){logger[_0x209d('0x14')](_0x209d('0x18'),_0x15aaf1[_0x209d('0x16')],_0x4aed86);_0x443d3b(_0x30e121[_0x209d('0x14')](0x1f4,_0x15aaf1[_0x209d('0x16')]));});});};exports['ShowServicenowAccount']=function(_0x525558){var _0x23e8fb=this;return new Promise(function(_0x5d88c8,_0x4c5793){return db[_0x209d('0x19')][_0x209d('0x24')]({'raw':_0x525558[_0x209d('0x1c')]?_0x525558[_0x209d('0x1c')][_0x209d('0x1b')]===undefined?!![]:![]:!![],'where':_0x525558[_0x209d('0x1c')]?_0x525558[_0x209d('0x1c')][_0x209d('0x1d')]||null:null,'attributes':_0x525558[_0x209d('0x1c')]?_0x525558[_0x209d('0x1c')][_0x209d('0x1e')]||null:null,'include':_0x525558[_0x209d('0x1c')]?_0x525558[_0x209d('0x1c')][_0x209d('0x21')]?_[_0x209d('0x20')](_0x525558[_0x209d('0x1c')][_0x209d('0x21')],function(_0x1f129e){return{'model':db[_0x1f129e['model']],'as':_0x1f129e['as'],'attributes':_0x1f129e['attributes'],'include':_0x1f129e[_0x209d('0x21')]?_[_0x209d('0x20')](_0x1f129e[_0x209d('0x21')],function(_0x205ead){return{'model':db[_0x205ead[_0x209d('0x22')]],'as':_0x205ead['as'],'attributes':_0x205ead[_0x209d('0x1e')],'include':_0x205ead[_0x209d('0x21')]?_[_0x209d('0x20')](_0x205ead[_0x209d('0x21')],function(_0x45cfa8){return{'model':db[_0x45cfa8[_0x209d('0x22')]],'as':_0x45cfa8['as'],'attributes':_0x45cfa8[_0x209d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x209d('0xd')](function(_0x4a917b){logger[_0x209d('0xe')](_0x209d('0x25'),_0x525558);logger['debug'](_0x209d('0x25'),_0x525558,JSON['stringify'](_0x4a917b));_0x5d88c8(_0x4a917b);})[_0x209d('0x23')](function(_0x5d8500){logger[_0x209d('0x14')](_0x209d('0x25'),_0x5d8500[_0x209d('0x16')],_0x525558);_0x4c5793(_0x23e8fb[_0x209d('0x14')](0x1f4,_0x5d8500[_0x209d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 7637f4d..56027c0 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 _0x3152=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','show','/:id/fields'];(function(_0x38b80b,_0x589b3b){var _0x500f68=function(_0x2fa796){while(--_0x2fa796){_0x38b80b['push'](_0x38b80b['shift']());}};_0x500f68(++_0x589b3b);}(_0x3152,0x135));var _0x2315=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x3152[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0x2315('0x0'));var util=require(_0x2315('0x1'));var path=require(_0x2315('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2315('0x3')]();var auth=require(_0x2315('0x4'));var interaction=require(_0x2315('0x5'));var config=require(_0x2315('0x6'));var controller=require(_0x2315('0x7'));router[_0x2315('0x8')]('/',auth['isAuthenticated'](),controller[_0x2315('0x9')]);router[_0x2315('0x8')](_0x2315('0xa'),auth['isAuthenticated'](),controller[_0x2315('0xb')]);router['get'](_0x2315('0xc'),auth[_0x2315('0xd')](),controller[_0x2315('0xe')]);router[_0x2315('0x8')](_0x2315('0xf'),auth[_0x2315('0xd')](),controller[_0x2315('0x10')]);router['get'](_0x2315('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x2315('0x12')]('/',auth[_0x2315('0xd')](),controller[_0x2315('0x13')]);router['put'](_0x2315('0xa'),auth[_0x2315('0xd')](),controller[_0x2315('0x14')]);router[_0x2315('0x15')](_0x2315('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2315('0x16')]=router; \ No newline at end of file +var _0xc6da=['/:id/descriptions','getDescriptions','create','put','update','destroy','util','path','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','index','/:id','isAuthenticated','get','getFields','/:id/subjects','getSubjects'];(function(_0x16fc1e,_0x590c8e){var _0x4e21a2=function(_0x4c9483){while(--_0x4c9483){_0x16fc1e['push'](_0x16fc1e['shift']());}};_0x4e21a2(++_0x590c8e);}(_0xc6da,0x182));var _0xac6d=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xc6da[_0x5c9307];return _0x373e29;};'use strict';var multer=require('multer');var util=require(_0xac6d('0x0'));var path=require(_0xac6d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac6d('0x2')]();var auth=require(_0xac6d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xac6d('0x4'));var controller=require(_0xac6d('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xac6d('0x6')]);router['get'](_0xac6d('0x7'),auth[_0xac6d('0x8')](),controller['show']);router[_0xac6d('0x9')]('/:id/fields',auth[_0xac6d('0x8')](),controller[_0xac6d('0xa')]);router[_0xac6d('0x9')](_0xac6d('0xb'),auth[_0xac6d('0x8')](),controller[_0xac6d('0xc')]);router[_0xac6d('0x9')](_0xac6d('0xd'),auth['isAuthenticated'](),controller[_0xac6d('0xe')]);router['post']('/',auth[_0xac6d('0x8')](),controller[_0xac6d('0xf')]);router[_0xac6d('0x10')](_0xac6d('0x7'),auth[_0xac6d('0x8')](),controller[_0xac6d('0x11')]);router['delete'](_0xac6d('0x7'),auth['isAuthenticated'](),controller[_0xac6d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index aaf165f..427ebd8 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 _0xda9c=['sequelize','exports','STRING'];(function(_0x29cde2,_0x3b0a07){var _0x36932a=function(_0x1d2824){while(--_0x1d2824){_0x29cde2['push'](_0x29cde2['shift']());}};_0x36932a(++_0x3b0a07);}(_0xda9c,0x10e));var _0xcda9=function(_0x50d6ef,_0x895eb9){_0x50d6ef=_0x50d6ef-0x0;var _0x6e3872=_0xda9c[_0x50d6ef];return _0x6e3872;};'use strict';var Sequelize=require(_0xcda9('0x0'));module[_0xcda9('0x1')]={'name':{'type':Sequelize[_0xcda9('0x2')]},'description':{'type':Sequelize[_0xcda9('0x2')]}}; \ No newline at end of file +var _0x78bb=['exports','STRING'];(function(_0x4cf322,_0x503e21){var _0x3fb757=function(_0x296175){while(--_0x296175){_0x4cf322['push'](_0x4cf322['shift']());}};_0x3fb757(++_0x503e21);}(_0x78bb,0x84));var _0xb78b=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x78bb[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require('sequelize');module[_0xb78b('0x0')]={'name':{'type':Sequelize[_0xb78b('0x1')]},'description':{'type':Sequelize[_0xb78b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 20be00d..28197c9 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 _0xb62e=['body','getFields','findOne','ServicenowField','options','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count','offset','limit','apply','reject','save','destroy','sendStatus','stack','send','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','name','filter','merge','include','ServicenowConfiguration','findAll','show','params','rawAttributes','includeAll','find','catch','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb62e,0x1de));var _0xeb62=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb62e[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var as=require(_0xeb62('0x13'));var hardwareService=require(_0xeb62('0x14'));var logger=require(_0xeb62('0x15'))(_0xeb62('0x16'));var utils=require(_0xeb62('0x17'));var config=require(_0xeb62('0x18'));var db=require(_0xeb62('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xeb62('0x1a')][_0xeb62('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x27671e,_0x6822bc,_0x55a629){if(_0x55a629){var _0x333126=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x333126[_0xeb62('0x1c')](_0x6822bc)){return _0x27671e;}else{throw new db[(_0xeb62('0x1d'))]['ValidationError'](_0xeb62('0x1e'));}}else{return _0x27671e;}}function respondWithRpcPromise(_0x195837,_0x2fd4c7,_0x4ce9fa,_0x1f6a1f){return new BPromise(function(_0x15b3e8,_0x184106){var _0x353e2c=_0x1f6a1f||client;return _0x353e2c[_0xeb62('0x1f')](_0x195837,_0x4ce9fa)[_0xeb62('0x20')](function(_0x1fb460){logger[_0xeb62('0x21')](_0xeb62('0x22'),_0x2fd4c7,_0xeb62('0x23'));logger[_0xeb62('0x24')](_0xeb62('0x25'),_0x2fd4c7,_0xeb62('0x23'),JSON['stringify'](_0x1fb460));if(_0x1fb460[_0xeb62('0x26')]){if(_0x1fb460[_0xeb62('0x26')][_0xeb62('0x27')]===0x1f4){logger[_0xeb62('0x26')](_0xeb62('0x22'),_0x2fd4c7,_0x1fb460[_0xeb62('0x26')][_0xeb62('0x28')]);return _0x184106(_0x1fb460['error']['message']);}logger[_0xeb62('0x26')](_0xeb62('0x22'),_0x2fd4c7,_0x1fb460[_0xeb62('0x26')][_0xeb62('0x28')]);return _0x15b3e8(_0x1fb460[_0xeb62('0x26')]['message']);}else{logger['info'](_0xeb62('0x22'),_0x2fd4c7,_0xeb62('0x23'));_0x15b3e8(_0x1fb460[_0xeb62('0x29')][_0xeb62('0x28')]);}})['catch'](function(_0x4e92f5){logger[_0xeb62('0x26')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2fd4c7,_0x4e92f5);_0x184106(_0x4e92f5);});});}function respondWithStatusCode(_0x448327,_0x4b0f46){_0x4b0f46=_0x4b0f46||0xcc;return function(_0xfe3e16){if(_0xfe3e16){return _0x448327['sendStatus'](_0x4b0f46);}return _0x448327[_0xeb62('0x2a')](_0x4b0f46)[_0xeb62('0x2b')]();};}function respondWithResult(_0x46d1bb,_0x4e4268){_0x4e4268=_0x4e4268||0xc8;return function(_0x3ef784){if(_0x3ef784){return _0x46d1bb[_0xeb62('0x2a')](_0x4e4268)[_0xeb62('0x2c')](_0x3ef784);}};}function respondWithFilteredResult(_0xe8872c,_0x42f486){return function(_0x360efd){if(_0x360efd){var _0x511202=_0x360efd[_0xeb62('0x2d')],_0x192517=_0x42f486[_0xeb62('0x2e')],_0x1616ee=_0x42f486[_0xeb62('0x2e')]+_0x42f486[_0xeb62('0x2f')],_0x57169a;if(_0x1616ee>=_0x511202){_0x1616ee=_0x511202;_0x57169a=0xc8;}else{_0x57169a=0xce;}_0xe8872c[_0xeb62('0x2a')](_0x57169a);return _0xe8872c['set']('Content-Range',_0x192517+'-'+_0x1616ee+'/'+_0x511202)[_0xeb62('0x2c')](_0x360efd);}return null;};}function patchUpdates(_0x357cf4){return function(_0x1607ef){try{jsonpatch[_0xeb62('0x30')](_0x1607ef,_0x357cf4,!![]);}catch(_0x42b197){return BPromise[_0xeb62('0x31')](_0x42b197);}return _0x1607ef[_0xeb62('0x32')]();};}function saveUpdates(_0x4be25d,_0x411062){return function(_0x47a94b){if(_0x47a94b){return _0x47a94b['update'](_0x4be25d)[_0xeb62('0x20')](function(_0x286455){return _0x286455;});}return null;};}function removeEntity(_0x4978e8,_0x1ade38){return function(_0x4bcfce){if(_0x4bcfce){return _0x4bcfce[_0xeb62('0x33')]()[_0xeb62('0x20')](function(){_0x4978e8['status'](0xcc)[_0xeb62('0x2b')]();});}};}function handleEntityNotFound(_0xe2589,_0x5914c9){return function(_0x1b3a60){if(!_0x1b3a60){_0xe2589[_0xeb62('0x34')](0x194);}return _0x1b3a60;};}function handleError(_0x38b116,_0x2203cb){_0x2203cb=_0x2203cb||0x1f4;return function(_0x513dd8){logger[_0xeb62('0x26')](_0x513dd8[_0xeb62('0x35')]);if(_0x513dd8['name']){delete _0x513dd8['name'];}_0x38b116[_0xeb62('0x2a')](_0x2203cb)[_0xeb62('0x36')](_0x513dd8);};}exports['index']=function(_0x338ab7,_0x30cff0){var _0x11eadb={},_0x1f839a={},_0x21f604={'count':0x0,'rows':[]};var _0x15387a=_[_0xeb62('0x37')](db['ServicenowConfiguration']['rawAttributes'],function(_0x3306e3){return{'name':_0x3306e3[_0xeb62('0x38')],'type':_0x3306e3[_0xeb62('0x39')][_0xeb62('0x3a')]};});_0x1f839a['model']=_[_0xeb62('0x37')](_0x15387a,'name');_0x1f839a[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x338ab7[_0xeb62('0x3b')]);_0x1f839a[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x1f839a[_0xeb62('0x3f')],_0x1f839a[_0xeb62('0x3b')]);_0x11eadb[_0xeb62('0x40')]=_['intersection'](_0x1f839a[_0xeb62('0x3f')],qs[_0xeb62('0x41')](_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x41')]));_0x11eadb['attributes']=_0x11eadb['attributes'][_0xeb62('0x42')]?_0x11eadb[_0xeb62('0x40')]:_0x1f839a['model'];if(!_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x43')]('nolimit')){_0x11eadb[_0xeb62('0x2f')]=qs['limit'](_0x338ab7[_0xeb62('0x3b')]['limit']);_0x11eadb[_0xeb62('0x2e')]=qs['offset'](_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x2e')]);}_0x11eadb[_0xeb62('0x44')]=qs['sort'](_0x338ab7['query'][_0xeb62('0x45')]);_0x11eadb[_0xeb62('0x46')]=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x338ab7[_0xeb62('0x3b')],_0x1f839a['filters']),_0x15387a);if(_0x338ab7[_0xeb62('0x3b')]['filter']){_0x11eadb[_0xeb62('0x46')]=_['merge'](_0x11eadb[_0xeb62('0x46')],{'$or':_['map'](_0x15387a,function(_0x26c77d){if(_0x26c77d['type']!==_0xeb62('0x48')){var _0x4624e7={};_0x4624e7[_0x26c77d[_0xeb62('0x49')]]={'$like':'%'+_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x4624e7;}})});}_0x11eadb=_[_0xeb62('0x4b')]({},_0x11eadb,_0x338ab7['options']);var _0x19af97={'where':_0x11eadb[_0xeb62('0x46')]};return db['ServicenowConfiguration']['count'](_0x19af97)['then'](function(_0x4d4c5a){_0x21f604[_0xeb62('0x2d')]=_0x4d4c5a;if(_0x338ab7[_0xeb62('0x3b')]['includeAll']){_0x11eadb[_0xeb62('0x4c')]=[{'all':!![]}];}return db[_0xeb62('0x4d')][_0xeb62('0x4e')](_0x11eadb);})[_0xeb62('0x20')](function(_0x39595c){_0x21f604['rows']=_0x39595c;return _0x21f604;})[_0xeb62('0x20')](respondWithFilteredResult(_0x30cff0,_0x11eadb))['catch'](handleError(_0x30cff0,null));};exports[_0xeb62('0x4f')]=function(_0x2cf2b5,_0x7fb53f){var _0x18c40d={'raw':![],'where':{'id':_0x2cf2b5[_0xeb62('0x50')]['id']}},_0x1f2d87={};_0x1f2d87[_0xeb62('0x3f')]=_[_0xeb62('0x3c')](db[_0xeb62('0x4d')][_0xeb62('0x51')]);_0x1f2d87[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x2cf2b5['query']);_0x1f2d87[_0xeb62('0x3d')]=_['intersection'](_0x1f2d87['model'],_0x1f2d87[_0xeb62('0x3b')]);_0x18c40d[_0xeb62('0x40')]=_['intersection'](_0x1f2d87[_0xeb62('0x3f')],qs[_0xeb62('0x41')](_0x2cf2b5['query'][_0xeb62('0x41')]));_0x18c40d[_0xeb62('0x40')]=_0x18c40d[_0xeb62('0x40')][_0xeb62('0x42')]?_0x18c40d[_0xeb62('0x40')]:_0x1f2d87[_0xeb62('0x3f')];if(_0x2cf2b5[_0xeb62('0x3b')][_0xeb62('0x52')]){_0x18c40d['include']=[{'all':!![]}];}_0x18c40d=_[_0xeb62('0x4b')]({},_0x18c40d,_0x2cf2b5['options']);return db[_0xeb62('0x4d')][_0xeb62('0x53')](_0x18c40d)[_0xeb62('0x20')](handleEntityNotFound(_0x7fb53f,null))[_0xeb62('0x20')](respondWithResult(_0x7fb53f,null))[_0xeb62('0x54')](handleError(_0x7fb53f,null));};exports[_0xeb62('0x55')]=function(_0xc3aee0,_0xf12d72){return db['ServicenowConfiguration']['create'](_0xc3aee0['body'],{})['then'](respondWithResult(_0xf12d72,0xc9))[_0xeb62('0x54')](handleError(_0xf12d72,null));};exports['update']=function(_0x3876ca,_0x5c0e7f){if(_0x3876ca[_0xeb62('0x56')]['id']){delete _0x3876ca[_0xeb62('0x56')]['id'];}return db[_0xeb62('0x4d')]['find']({'where':{'id':_0x3876ca[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x5c0e7f,null))['then'](saveUpdates(_0x3876ca[_0xeb62('0x56')],null))[_0xeb62('0x20')](respondWithResult(_0x5c0e7f,null))[_0xeb62('0x54')](handleError(_0x5c0e7f,null));};exports[_0xeb62('0x33')]=function(_0x55370c,_0x3be3e1){return db[_0xeb62('0x4d')]['find']({'where':{'id':_0x55370c[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x3be3e1,null))[_0xeb62('0x20')](removeEntity(_0x3be3e1,null))[_0xeb62('0x54')](handleError(_0x3be3e1,null));};exports[_0xeb62('0x57')]=function(_0x46da69,_0x3e55bf,_0x1b354d){var _0x222d0c={};var _0x1db841={};var _0x130153;var _0x15c93f;return db[_0xeb62('0x4d')][_0xeb62('0x58')]({'where':{'id':_0x46da69[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x3e55bf,null))['then'](function(_0x5550b6){if(_0x5550b6){_0x130153=_0x5550b6;_0x1db841['model']=_['keys'](db[_0xeb62('0x59')]['rawAttributes']);_0x1db841[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x46da69[_0xeb62('0x3b')]);_0x1db841[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x1db841[_0xeb62('0x3f')],_0x1db841[_0xeb62('0x3b')]);_0x222d0c[_0xeb62('0x40')]=_[_0xeb62('0x3e')](_0x1db841[_0xeb62('0x3f')],qs['fields'](_0x46da69[_0xeb62('0x3b')][_0xeb62('0x41')]));_0x222d0c[_0xeb62('0x40')]=_0x222d0c[_0xeb62('0x40')]['length']?_0x222d0c[_0xeb62('0x40')]:_0x1db841[_0xeb62('0x3f')];_0x222d0c[_0xeb62('0x44')]=qs[_0xeb62('0x45')](_0x46da69[_0xeb62('0x3b')][_0xeb62('0x45')]);_0x222d0c[_0xeb62('0x46')]=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x46da69[_0xeb62('0x3b')],_0x1db841[_0xeb62('0x3d')]));if(_0x46da69['query'][_0xeb62('0x4a')]){_0x222d0c[_0xeb62('0x46')]=_[_0xeb62('0x4b')](_0x222d0c[_0xeb62('0x46')],{'$or':_[_0xeb62('0x37')](_0x222d0c[_0xeb62('0x40')],function(_0x388b31){var _0x1dcc91={};_0x1dcc91[_0x388b31]={'$like':'%'+_0x46da69[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x1dcc91;})});}_0x222d0c=_['merge']({},_0x222d0c,_0x46da69[_0xeb62('0x5a')]);return _0x130153[_0xeb62('0x57')](_0x222d0c);}})[_0xeb62('0x20')](function(_0xdd124f){if(_0xdd124f){_0x15c93f=_0xdd124f['length'];if(!_0x46da69[_0xeb62('0x3b')][_0xeb62('0x43')](_0xeb62('0x5b'))){_0x222d0c[_0xeb62('0x2f')]=qs[_0xeb62('0x2f')](_0x46da69[_0xeb62('0x3b')]['limit']);_0x222d0c[_0xeb62('0x2e')]=qs[_0xeb62('0x2e')](_0x46da69[_0xeb62('0x3b')][_0xeb62('0x2e')]);}return _0x130153[_0xeb62('0x57')](_0x222d0c);}})[_0xeb62('0x20')](function(_0x2e4502){if(_0x2e4502){return _0x2e4502?{'count':_0x15c93f,'rows':_0x2e4502}:null;}})[_0xeb62('0x20')](respondWithResult(_0x3e55bf,null))[_0xeb62('0x54')](handleError(_0x3e55bf,null));};exports[_0xeb62('0x5c')]=function(_0x1c3cb0,_0x1bf4f2,_0x1cbf33){var _0x129d44={};var _0xddc862={};var _0x2bbbff;var _0x4eb152;return db[_0xeb62('0x4d')]['findOne']({'where':{'id':_0x1c3cb0[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x1bf4f2,null))['then'](function(_0x2d8bbe){if(_0x2d8bbe){_0x2bbbff=_0x2d8bbe;_0xddc862[_0xeb62('0x3f')]=_[_0xeb62('0x3c')](db[_0xeb62('0x59')][_0xeb62('0x51')]);_0xddc862[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x1c3cb0[_0xeb62('0x3b')]);_0xddc862[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0xddc862[_0xeb62('0x3f')],_0xddc862[_0xeb62('0x3b')]);_0x129d44[_0xeb62('0x40')]=_['intersection'](_0xddc862[_0xeb62('0x3f')],qs[_0xeb62('0x41')](_0x1c3cb0['query'][_0xeb62('0x41')]));_0x129d44['attributes']=_0x129d44[_0xeb62('0x40')][_0xeb62('0x42')]?_0x129d44[_0xeb62('0x40')]:_0xddc862[_0xeb62('0x3f')];_0x129d44[_0xeb62('0x44')]=qs[_0xeb62('0x45')](_0x1c3cb0['query'][_0xeb62('0x45')]);_0x129d44['where']=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x1c3cb0[_0xeb62('0x3b')],_0xddc862[_0xeb62('0x3d')]));if(_0x1c3cb0[_0xeb62('0x3b')]['filter']){_0x129d44[_0xeb62('0x46')]=_[_0xeb62('0x4b')](_0x129d44[_0xeb62('0x46')],{'$or':_['map'](_0x129d44[_0xeb62('0x40')],function(_0x3ad496){var _0x8a8ef3={};_0x8a8ef3[_0x3ad496]={'$like':'%'+_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x8a8ef3;})});}_0x129d44=_[_0xeb62('0x4b')]({},_0x129d44,_0x1c3cb0['options']);return _0x2bbbff['getSubjects'](_0x129d44);}})['then'](function(_0x50590b){if(_0x50590b){_0x4eb152=_0x50590b['length'];if(!_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x43')](_0xeb62('0x5b'))){_0x129d44[_0xeb62('0x2f')]=qs[_0xeb62('0x2f')](_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x2f')]);_0x129d44[_0xeb62('0x2e')]=qs[_0xeb62('0x2e')](_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x2e')]);}return _0x2bbbff[_0xeb62('0x5c')](_0x129d44);}})['then'](function(_0x71c47b){if(_0x71c47b){return _0x71c47b?{'count':_0x4eb152,'rows':_0x71c47b}:null;}})[_0xeb62('0x20')](respondWithResult(_0x1bf4f2,null))[_0xeb62('0x54')](handleError(_0x1bf4f2,null));};exports[_0xeb62('0x5d')]=function(_0x25106d,_0x2f43d6,_0x30c8e0){var _0x214fd0={};var _0x1bb222={};var _0x33b16b;var _0x124847;return db[_0xeb62('0x4d')][_0xeb62('0x58')]({'where':{'id':_0x25106d[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x2f43d6,null))[_0xeb62('0x20')](function(_0x29648f){if(_0x29648f){_0x33b16b=_0x29648f;_0x1bb222[_0xeb62('0x3f')]=_['keys'](db[_0xeb62('0x59')]['rawAttributes']);_0x1bb222[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x25106d['query']);_0x1bb222[_0xeb62('0x3d')]=_['intersection'](_0x1bb222['model'],_0x1bb222[_0xeb62('0x3b')]);_0x214fd0[_0xeb62('0x40')]=_[_0xeb62('0x3e')](_0x1bb222[_0xeb62('0x3f')],qs['fields'](_0x25106d[_0xeb62('0x3b')][_0xeb62('0x41')]));_0x214fd0['attributes']=_0x214fd0[_0xeb62('0x40')][_0xeb62('0x42')]?_0x214fd0[_0xeb62('0x40')]:_0x1bb222[_0xeb62('0x3f')];_0x214fd0[_0xeb62('0x44')]=qs[_0xeb62('0x45')](_0x25106d[_0xeb62('0x3b')][_0xeb62('0x45')]);_0x214fd0['where']=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x25106d['query'],_0x1bb222[_0xeb62('0x3d')]));if(_0x25106d['query']['filter']){_0x214fd0[_0xeb62('0x46')]=_[_0xeb62('0x4b')](_0x214fd0[_0xeb62('0x46')],{'$or':_[_0xeb62('0x37')](_0x214fd0[_0xeb62('0x40')],function(_0x5072fd){var _0x3da53a={};_0x3da53a[_0x5072fd]={'$like':'%'+_0x25106d[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x3da53a;})});}_0x214fd0=_[_0xeb62('0x4b')]({},_0x214fd0,_0x25106d[_0xeb62('0x5a')]);return _0x33b16b[_0xeb62('0x5d')](_0x214fd0);}})[_0xeb62('0x20')](function(_0x50170b){if(_0x50170b){_0x124847=_0x50170b['length'];if(!_0x25106d['query'][_0xeb62('0x43')](_0xeb62('0x5b'))){_0x214fd0[_0xeb62('0x2f')]=qs[_0xeb62('0x2f')](_0x25106d['query'][_0xeb62('0x2f')]);_0x214fd0['offset']=qs['offset'](_0x25106d[_0xeb62('0x3b')][_0xeb62('0x2e')]);}return _0x33b16b['getDescriptions'](_0x214fd0);}})[_0xeb62('0x20')](function(_0x53aa1c){if(_0x53aa1c){return _0x53aa1c?{'count':_0x124847,'rows':_0x53aa1c}:null;}})[_0xeb62('0x20')](respondWithResult(_0x2f43d6,null))[_0xeb62('0x54')](handleError(_0x2f43d6,null));}; \ No newline at end of file +var _0xb688=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','create','update','body','find','params','getFields','findOne','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','status','count','offset','limit','set','Content-Range','apply','save','destroy','sendStatus','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x4e66e2,_0x34899d){var _0x338b70=function(_0x2b6de7){while(--_0x2b6de7){_0x4e66e2['push'](_0x4e66e2['shift']());}};_0x338b70(++_0x34899d);}(_0xb688,0xcf));var _0x8b68=function(_0x34357d,_0x85bbe2){_0x34357d=_0x34357d-0x0;var _0x3115c9=_0xb688[_0x34357d];return _0x3115c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require(_0x8b68('0x2'));var jsonpatch=require(_0x8b68('0x3'));var rp=require(_0x8b68('0x4'));var moment=require(_0x8b68('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0xf'));var querystring=require(_0x8b68('0x10'));var Papa=require(_0x8b68('0x11'));var Redis=require(_0x8b68('0x12'));var authService=require(_0x8b68('0x13'));var qs=require(_0x8b68('0x14'));var as=require(_0x8b68('0x15'));var hardwareService=require(_0x8b68('0x16'));var logger=require(_0x8b68('0x17'))('api');var utils=require(_0x8b68('0x18'));var config=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];var jayson=require(_0x8b68('0x1b'));var client=jayson[_0x8b68('0x1c')][_0x8b68('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xaa8725,_0x137c8e,_0x2686c7){if(_0x2686c7){var _0x5b4364=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b4364[_0x8b68('0x1e')](_0x137c8e)){return _0xaa8725;}else{throw new db['Sequelize']['ValidationError'](_0x8b68('0x1f'));}}else{return _0xaa8725;}}function respondWithRpcPromise(_0x1554d6,_0x27d717,_0x5d3468,_0x5c8d0e){return new BPromise(function(_0x23bd52,_0x5c1e44){var _0x136f1b=_0x5c8d0e||client;return _0x136f1b[_0x8b68('0x20')](_0x1554d6,_0x5d3468)[_0x8b68('0x21')](function(_0x10c9c6){logger['info'](_0x8b68('0x22'),_0x27d717,_0x8b68('0x23'));logger['debug'](_0x8b68('0x24'),_0x27d717,_0x8b68('0x23'),JSON[_0x8b68('0x25')](_0x10c9c6));if(_0x10c9c6[_0x8b68('0x26')]){if(_0x10c9c6[_0x8b68('0x26')]['code']===0x1f4){logger[_0x8b68('0x26')](_0x8b68('0x22'),_0x27d717,_0x10c9c6[_0x8b68('0x26')][_0x8b68('0x27')]);return _0x5c1e44(_0x10c9c6[_0x8b68('0x26')][_0x8b68('0x27')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x27d717,_0x10c9c6[_0x8b68('0x26')]['message']);return _0x23bd52(_0x10c9c6[_0x8b68('0x26')][_0x8b68('0x27')]);}else{logger[_0x8b68('0x28')](_0x8b68('0x22'),_0x27d717,_0x8b68('0x23'));_0x23bd52(_0x10c9c6[_0x8b68('0x29')]['message']);}})[_0x8b68('0x2a')](function(_0x46e827){logger['error'](_0x8b68('0x22'),_0x27d717,_0x46e827);_0x5c1e44(_0x46e827);});});}function respondWithStatusCode(_0x3cf8d2,_0x240b0b){_0x240b0b=_0x240b0b||0xcc;return function(_0x5590ec){if(_0x5590ec){return _0x3cf8d2['sendStatus'](_0x240b0b);}return _0x3cf8d2['status'](_0x240b0b)[_0x8b68('0x2b')]();};}function respondWithResult(_0x448e43,_0x2ba2a3){_0x2ba2a3=_0x2ba2a3||0xc8;return function(_0x583476){if(_0x583476){return _0x448e43[_0x8b68('0x2c')](_0x2ba2a3)['json'](_0x583476);}};}function respondWithFilteredResult(_0x4cf89d,_0x3865ea){return function(_0x59b3ce){if(_0x59b3ce){var _0x26cad7=_0x59b3ce[_0x8b68('0x2d')],_0x3ac356=_0x3865ea[_0x8b68('0x2e')],_0x48e2c8=_0x3865ea[_0x8b68('0x2e')]+_0x3865ea[_0x8b68('0x2f')],_0x494ce4;if(_0x48e2c8>=_0x26cad7){_0x48e2c8=_0x26cad7;_0x494ce4=0xc8;}else{_0x494ce4=0xce;}_0x4cf89d[_0x8b68('0x2c')](_0x494ce4);return _0x4cf89d[_0x8b68('0x30')](_0x8b68('0x31'),_0x3ac356+'-'+_0x48e2c8+'/'+_0x26cad7)['json'](_0x59b3ce);}return null;};}function patchUpdates(_0x3b6d1b){return function(_0x50a1e9){try{jsonpatch[_0x8b68('0x32')](_0x50a1e9,_0x3b6d1b,!![]);}catch(_0x133b75){return BPromise['reject'](_0x133b75);}return _0x50a1e9[_0x8b68('0x33')]();};}function saveUpdates(_0x93daf7,_0x26fe0e){return function(_0x49ce2d){if(_0x49ce2d){return _0x49ce2d['update'](_0x93daf7)[_0x8b68('0x21')](function(_0x8c11aa){return _0x8c11aa;});}return null;};}function removeEntity(_0x3e905a,_0x394cca){return function(_0x2c0ace){if(_0x2c0ace){return _0x2c0ace[_0x8b68('0x34')]()[_0x8b68('0x21')](function(){_0x3e905a[_0x8b68('0x2c')](0xcc)[_0x8b68('0x2b')]();});}};}function handleEntityNotFound(_0x7fe301,_0x49e2db){return function(_0x15027a){if(!_0x15027a){_0x7fe301[_0x8b68('0x35')](0x194);}return _0x15027a;};}function handleError(_0x439d36,_0x10aca9){_0x10aca9=_0x10aca9||0x1f4;return function(_0x151277){logger[_0x8b68('0x26')](_0x151277[_0x8b68('0x36')]);if(_0x151277[_0x8b68('0x37')]){delete _0x151277[_0x8b68('0x37')];}_0x439d36[_0x8b68('0x2c')](_0x10aca9)[_0x8b68('0x38')](_0x151277);};}exports['index']=function(_0x5c158b,_0x24026c){var _0x262d6c={},_0x23554d={},_0xb9b5b1={'count':0x0,'rows':[]};var _0xf2154f=_[_0x8b68('0x39')](db[_0x8b68('0x3a')][_0x8b68('0x3b')],function(_0x5b628e){return{'name':_0x5b628e[_0x8b68('0x3c')],'type':_0x5b628e[_0x8b68('0x3d')][_0x8b68('0x3e')]};});_0x23554d[_0x8b68('0x3f')]=_[_0x8b68('0x39')](_0xf2154f,_0x8b68('0x37'));_0x23554d[_0x8b68('0x40')]=_[_0x8b68('0x41')](_0x5c158b['query']);_0x23554d[_0x8b68('0x42')]=_[_0x8b68('0x43')](_0x23554d[_0x8b68('0x3f')],_0x23554d[_0x8b68('0x40')]);_0x262d6c[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x23554d[_0x8b68('0x3f')],qs['fields'](_0x5c158b[_0x8b68('0x40')][_0x8b68('0x45')]));_0x262d6c['attributes']=_0x262d6c[_0x8b68('0x44')][_0x8b68('0x46')]?_0x262d6c['attributes']:_0x23554d['model'];if(!_0x5c158b['query']['hasOwnProperty'](_0x8b68('0x47'))){_0x262d6c[_0x8b68('0x2f')]=qs['limit'](_0x5c158b[_0x8b68('0x40')]['limit']);_0x262d6c[_0x8b68('0x2e')]=qs[_0x8b68('0x2e')](_0x5c158b['query'][_0x8b68('0x2e')]);}_0x262d6c['order']=qs['sort'](_0x5c158b['query'][_0x8b68('0x48')]);_0x262d6c[_0x8b68('0x49')]=qs[_0x8b68('0x42')](_[_0x8b68('0x4a')](_0x5c158b['query'],_0x23554d[_0x8b68('0x42')]),_0xf2154f);if(_0x5c158b['query'][_0x8b68('0x4b')]){_0x262d6c[_0x8b68('0x49')]=_['merge'](_0x262d6c[_0x8b68('0x49')],{'$or':_[_0x8b68('0x39')](_0xf2154f,function(_0x422f91){if(_0x422f91[_0x8b68('0x3d')]!=='VIRTUAL'){var _0x14fa5a={};_0x14fa5a[_0x422f91[_0x8b68('0x37')]]={'$like':'%'+_0x5c158b[_0x8b68('0x40')][_0x8b68('0x4b')]+'%'};return _0x14fa5a;}})});}_0x262d6c=_[_0x8b68('0x4c')]({},_0x262d6c,_0x5c158b[_0x8b68('0x4d')]);var _0x41d9a2={'where':_0x262d6c[_0x8b68('0x49')]};return db[_0x8b68('0x3a')][_0x8b68('0x2d')](_0x41d9a2)[_0x8b68('0x21')](function(_0x2a2a99){_0xb9b5b1[_0x8b68('0x2d')]=_0x2a2a99;if(_0x5c158b[_0x8b68('0x40')][_0x8b68('0x4e')]){_0x262d6c[_0x8b68('0x4f')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8b68('0x50')](_0x262d6c);})[_0x8b68('0x21')](function(_0x5dd099){_0xb9b5b1[_0x8b68('0x51')]=_0x5dd099;return _0xb9b5b1;})['then'](respondWithFilteredResult(_0x24026c,_0x262d6c))['catch'](handleError(_0x24026c,null));};exports['show']=function(_0x1c8a3e,_0x35874b){var _0x34047c={'raw':![],'where':{'id':_0x1c8a3e['params']['id']}},_0x6da48b={};_0x6da48b['model']=_[_0x8b68('0x41')](db[_0x8b68('0x3a')][_0x8b68('0x3b')]);_0x6da48b['query']=_[_0x8b68('0x41')](_0x1c8a3e[_0x8b68('0x40')]);_0x6da48b['filters']=_[_0x8b68('0x43')](_0x6da48b[_0x8b68('0x3f')],_0x6da48b['query']);_0x34047c[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x6da48b['model'],qs[_0x8b68('0x45')](_0x1c8a3e[_0x8b68('0x40')]['fields']));_0x34047c['attributes']=_0x34047c['attributes'][_0x8b68('0x46')]?_0x34047c[_0x8b68('0x44')]:_0x6da48b[_0x8b68('0x3f')];if(_0x1c8a3e[_0x8b68('0x40')]['includeAll']){_0x34047c['include']=[{'all':!![]}];}_0x34047c=_[_0x8b68('0x4c')]({},_0x34047c,_0x1c8a3e[_0x8b68('0x4d')]);return db[_0x8b68('0x3a')]['find'](_0x34047c)[_0x8b68('0x21')](handleEntityNotFound(_0x35874b,null))[_0x8b68('0x21')](respondWithResult(_0x35874b,null))[_0x8b68('0x2a')](handleError(_0x35874b,null));};exports['create']=function(_0x49dc86,_0x4825df){return db[_0x8b68('0x3a')][_0x8b68('0x52')](_0x49dc86['body'],{})[_0x8b68('0x21')](respondWithResult(_0x4825df,0xc9))[_0x8b68('0x2a')](handleError(_0x4825df,null));};exports[_0x8b68('0x53')]=function(_0xcd88b4,_0x8cc614){if(_0xcd88b4['body']['id']){delete _0xcd88b4[_0x8b68('0x54')]['id'];}return db[_0x8b68('0x3a')][_0x8b68('0x55')]({'where':{'id':_0xcd88b4[_0x8b68('0x56')]['id']}})[_0x8b68('0x21')](handleEntityNotFound(_0x8cc614,null))[_0x8b68('0x21')](saveUpdates(_0xcd88b4[_0x8b68('0x54')],null))[_0x8b68('0x21')](respondWithResult(_0x8cc614,null))['catch'](handleError(_0x8cc614,null));};exports[_0x8b68('0x34')]=function(_0x1a85da,_0x1e8694){return db[_0x8b68('0x3a')][_0x8b68('0x55')]({'where':{'id':_0x1a85da[_0x8b68('0x56')]['id']}})[_0x8b68('0x21')](handleEntityNotFound(_0x1e8694,null))[_0x8b68('0x21')](removeEntity(_0x1e8694,null))[_0x8b68('0x2a')](handleError(_0x1e8694,null));};exports[_0x8b68('0x57')]=function(_0x368c86,_0x42871e,_0x1019cb){var _0x275b31={};var _0x28e7aa={};var _0xd7e86d;var _0xf07a90;return db[_0x8b68('0x3a')][_0x8b68('0x58')]({'where':{'id':_0x368c86[_0x8b68('0x56')]['id']}})['then'](handleEntityNotFound(_0x42871e,null))[_0x8b68('0x21')](function(_0x51e17b){if(_0x51e17b){_0xd7e86d=_0x51e17b;_0x28e7aa['model']=_[_0x8b68('0x41')](db['ServicenowField'][_0x8b68('0x3b')]);_0x28e7aa[_0x8b68('0x40')]=_[_0x8b68('0x41')](_0x368c86['query']);_0x28e7aa[_0x8b68('0x42')]=_[_0x8b68('0x43')](_0x28e7aa[_0x8b68('0x3f')],_0x28e7aa[_0x8b68('0x40')]);_0x275b31[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x28e7aa[_0x8b68('0x3f')],qs['fields'](_0x368c86['query'][_0x8b68('0x45')]));_0x275b31[_0x8b68('0x44')]=_0x275b31[_0x8b68('0x44')][_0x8b68('0x46')]?_0x275b31[_0x8b68('0x44')]:_0x28e7aa[_0x8b68('0x3f')];_0x275b31[_0x8b68('0x59')]=qs[_0x8b68('0x48')](_0x368c86[_0x8b68('0x40')][_0x8b68('0x48')]);_0x275b31[_0x8b68('0x49')]=qs[_0x8b68('0x42')](_[_0x8b68('0x4a')](_0x368c86[_0x8b68('0x40')],_0x28e7aa[_0x8b68('0x42')]));if(_0x368c86[_0x8b68('0x40')][_0x8b68('0x4b')]){_0x275b31[_0x8b68('0x49')]=_['merge'](_0x275b31['where'],{'$or':_[_0x8b68('0x39')](_0x275b31[_0x8b68('0x44')],function(_0x5bd581){var _0x48d57a={};_0x48d57a[_0x5bd581]={'$like':'%'+_0x368c86['query'][_0x8b68('0x4b')]+'%'};return _0x48d57a;})});}_0x275b31=_[_0x8b68('0x4c')]({},_0x275b31,_0x368c86[_0x8b68('0x4d')]);return _0xd7e86d[_0x8b68('0x57')](_0x275b31);}})[_0x8b68('0x21')](function(_0x58d93c){if(_0x58d93c){_0xf07a90=_0x58d93c[_0x8b68('0x46')];if(!_0x368c86[_0x8b68('0x40')]['hasOwnProperty'](_0x8b68('0x47'))){_0x275b31['limit']=qs['limit'](_0x368c86['query'][_0x8b68('0x2f')]);_0x275b31[_0x8b68('0x2e')]=qs[_0x8b68('0x2e')](_0x368c86[_0x8b68('0x40')][_0x8b68('0x2e')]);}return _0xd7e86d[_0x8b68('0x57')](_0x275b31);}})[_0x8b68('0x21')](function(_0x34456d){if(_0x34456d){return _0x34456d?{'count':_0xf07a90,'rows':_0x34456d}:null;}})[_0x8b68('0x21')](respondWithResult(_0x42871e,null))[_0x8b68('0x2a')](handleError(_0x42871e,null));};exports['getSubjects']=function(_0x3a8d15,_0x335b3b,_0x310ec9){var _0x49cce6={};var _0x5deaba={};var _0x1854a9;var _0x1966f6;return db['ServicenowConfiguration'][_0x8b68('0x58')]({'where':{'id':_0x3a8d15[_0x8b68('0x56')]['id']}})[_0x8b68('0x21')](handleEntityNotFound(_0x335b3b,null))[_0x8b68('0x21')](function(_0x50fd2c){if(_0x50fd2c){_0x1854a9=_0x50fd2c;_0x5deaba[_0x8b68('0x3f')]=_['keys'](db['ServicenowField'][_0x8b68('0x3b')]);_0x5deaba['query']=_[_0x8b68('0x41')](_0x3a8d15[_0x8b68('0x40')]);_0x5deaba['filters']=_[_0x8b68('0x43')](_0x5deaba[_0x8b68('0x3f')],_0x5deaba[_0x8b68('0x40')]);_0x49cce6[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x5deaba['model'],qs[_0x8b68('0x45')](_0x3a8d15[_0x8b68('0x40')][_0x8b68('0x45')]));_0x49cce6[_0x8b68('0x44')]=_0x49cce6[_0x8b68('0x44')]['length']?_0x49cce6['attributes']:_0x5deaba[_0x8b68('0x3f')];_0x49cce6['order']=qs[_0x8b68('0x48')](_0x3a8d15[_0x8b68('0x40')][_0x8b68('0x48')]);_0x49cce6[_0x8b68('0x49')]=qs[_0x8b68('0x42')](_[_0x8b68('0x4a')](_0x3a8d15[_0x8b68('0x40')],_0x5deaba['filters']));if(_0x3a8d15[_0x8b68('0x40')]['filter']){_0x49cce6[_0x8b68('0x49')]=_[_0x8b68('0x4c')](_0x49cce6[_0x8b68('0x49')],{'$or':_['map'](_0x49cce6[_0x8b68('0x44')],function(_0x50d0b9){var _0x104a9d={};_0x104a9d[_0x50d0b9]={'$like':'%'+_0x3a8d15['query'][_0x8b68('0x4b')]+'%'};return _0x104a9d;})});}_0x49cce6=_[_0x8b68('0x4c')]({},_0x49cce6,_0x3a8d15[_0x8b68('0x4d')]);return _0x1854a9['getSubjects'](_0x49cce6);}})[_0x8b68('0x21')](function(_0x1fc6dc){if(_0x1fc6dc){_0x1966f6=_0x1fc6dc[_0x8b68('0x46')];if(!_0x3a8d15[_0x8b68('0x40')][_0x8b68('0x5a')](_0x8b68('0x47'))){_0x49cce6[_0x8b68('0x2f')]=qs[_0x8b68('0x2f')](_0x3a8d15[_0x8b68('0x40')]['limit']);_0x49cce6[_0x8b68('0x2e')]=qs[_0x8b68('0x2e')](_0x3a8d15[_0x8b68('0x40')][_0x8b68('0x2e')]);}return _0x1854a9[_0x8b68('0x5b')](_0x49cce6);}})['then'](function(_0x3dfd43){if(_0x3dfd43){return _0x3dfd43?{'count':_0x1966f6,'rows':_0x3dfd43}:null;}})['then'](respondWithResult(_0x335b3b,null))[_0x8b68('0x2a')](handleError(_0x335b3b,null));};exports[_0x8b68('0x5c')]=function(_0x524763,_0x20c8b4,_0x75af51){var _0xa7890f={};var _0x4c9e0f={};var _0x3cca8c;var _0x18ee1a;return db[_0x8b68('0x3a')][_0x8b68('0x58')]({'where':{'id':_0x524763[_0x8b68('0x56')]['id']}})[_0x8b68('0x21')](handleEntityNotFound(_0x20c8b4,null))['then'](function(_0x3b1c92){if(_0x3b1c92){_0x3cca8c=_0x3b1c92;_0x4c9e0f[_0x8b68('0x3f')]=_[_0x8b68('0x41')](db['ServicenowField'][_0x8b68('0x3b')]);_0x4c9e0f[_0x8b68('0x40')]=_[_0x8b68('0x41')](_0x524763[_0x8b68('0x40')]);_0x4c9e0f[_0x8b68('0x42')]=_[_0x8b68('0x43')](_0x4c9e0f[_0x8b68('0x3f')],_0x4c9e0f[_0x8b68('0x40')]);_0xa7890f[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x4c9e0f[_0x8b68('0x3f')],qs['fields'](_0x524763['query'][_0x8b68('0x45')]));_0xa7890f[_0x8b68('0x44')]=_0xa7890f[_0x8b68('0x44')][_0x8b68('0x46')]?_0xa7890f[_0x8b68('0x44')]:_0x4c9e0f['model'];_0xa7890f[_0x8b68('0x59')]=qs[_0x8b68('0x48')](_0x524763[_0x8b68('0x40')][_0x8b68('0x48')]);_0xa7890f['where']=qs['filters'](_[_0x8b68('0x4a')](_0x524763[_0x8b68('0x40')],_0x4c9e0f[_0x8b68('0x42')]));if(_0x524763[_0x8b68('0x40')][_0x8b68('0x4b')]){_0xa7890f[_0x8b68('0x49')]=_[_0x8b68('0x4c')](_0xa7890f[_0x8b68('0x49')],{'$or':_['map'](_0xa7890f[_0x8b68('0x44')],function(_0x3fa9be){var _0x2b03b8={};_0x2b03b8[_0x3fa9be]={'$like':'%'+_0x524763[_0x8b68('0x40')][_0x8b68('0x4b')]+'%'};return _0x2b03b8;})});}_0xa7890f=_[_0x8b68('0x4c')]({},_0xa7890f,_0x524763['options']);return _0x3cca8c[_0x8b68('0x5c')](_0xa7890f);}})[_0x8b68('0x21')](function(_0x327cff){if(_0x327cff){_0x18ee1a=_0x327cff['length'];if(!_0x524763[_0x8b68('0x40')]['hasOwnProperty'](_0x8b68('0x47'))){_0xa7890f['limit']=qs[_0x8b68('0x2f')](_0x524763[_0x8b68('0x40')][_0x8b68('0x2f')]);_0xa7890f[_0x8b68('0x2e')]=qs[_0x8b68('0x2e')](_0x524763[_0x8b68('0x40')]['offset']);}return _0x3cca8c['getDescriptions'](_0xa7890f);}})['then'](function(_0xa20bfd){if(_0xa20bfd){return _0xa20bfd?{'count':_0x18ee1a,'rows':_0xa20bfd}:null;}})[_0x8b68('0x21')](respondWithResult(_0x20c8b4,null))[_0x8b68('0x2a')](handleError(_0x20c8b4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index aa8de59..73d2bbc 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 _0xaf55=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x1a0016,_0x3d80e1){var _0x2945df=function(_0x2e82b2){while(--_0x2e82b2){_0x1a0016['push'](_0x1a0016['shift']());}};_0x2945df(++_0x3d80e1);}(_0xaf55,0x1e0));var _0x5af5=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xaf55[_0xd09668];return _0x68726;};'use strict';var _=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var logger=require(_0x5af5('0x2'))(_0x5af5('0x3'));var moment=require(_0x5af5('0x4'));var BPromise=require(_0x5af5('0x5'));var rp=require(_0x5af5('0x6'));var fs=require('fs');var path=require(_0x5af5('0x7'));var rimraf=require(_0x5af5('0x8'));var config=require(_0x5af5('0x9'));var attributes=require(_0x5af5('0xa'));module[_0x5af5('0xb')]=function(_0x16b6a0,_0x872cb0){return _0x16b6a0[_0x5af5('0xc')](_0x5af5('0xd'),attributes,{'tableName':_0x5af5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0dc=['./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xe0dc,0x190));var _0xce0d=function(_0x57d500,_0xf52c67){_0x57d500=_0x57d500-0x0;var _0x142c14=_0xe0dc[_0x57d500];return _0x142c14;};'use strict';var _=require(_0xce0d('0x0'));var util=require('util');var logger=require(_0xce0d('0x1'))(_0xce0d('0x2'));var moment=require('moment');var BPromise=require(_0xce0d('0x3'));var rp=require(_0xce0d('0x4'));var fs=require('fs');var path=require(_0xce0d('0x5'));var rimraf=require(_0xce0d('0x6'));var config=require('../../config/environment');var attributes=require(_0xce0d('0x7'));module['exports']=function(_0x3e7888,_0x33f430){return _0x3e7888[_0xce0d('0x8')](_0xce0d('0x9'),attributes,{'tableName':_0xce0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 0ffa537..1cd537d 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 _0x7736=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x187ef8,_0x178007){var _0x47a915=function(_0x1a8925){while(--_0x1a8925){_0x187ef8['push'](_0x187ef8['shift']());}};_0x47a915(++_0x178007);}(_0x7736,0x113));var _0x6773=function(_0x1b0281,_0x507883){_0x1b0281=_0x1b0281-0x0;var _0x4fc6ef=_0x7736[_0x1b0281];return _0x4fc6ef;};'use strict';var _=require(_0x6773('0x0'));var util=require(_0x6773('0x1'));var moment=require('moment');var BPromise=require(_0x6773('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6773('0x3'));var db=require(_0x6773('0x4'))['db'];var utils=require(_0x6773('0x5'));var logger=require(_0x6773('0x6'))(_0x6773('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6773('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2238f2,_0x60a529,_0x3e886e){return new BPromise(function(_0x1dc555,_0x1d120b){return client[_0x6773('0x9')](_0x2238f2,_0x3e886e)['then'](function(_0x1ee04b){logger[_0x6773('0xa')](_0x6773('0xb'),_0x60a529,_0x6773('0xc'));logger[_0x6773('0xd')](_0x6773('0xe'),_0x60a529,_0x6773('0xc'),JSON[_0x6773('0xf')](_0x1ee04b));if(_0x1ee04b[_0x6773('0x10')]){if(_0x1ee04b[_0x6773('0x10')]['code']===0x1f4){logger[_0x6773('0x10')](_0x6773('0xb'),_0x60a529,_0x1ee04b[_0x6773('0x10')][_0x6773('0x11')]);return _0x1d120b(_0x1ee04b[_0x6773('0x10')][_0x6773('0x11')]);}logger[_0x6773('0x10')](_0x6773('0xb'),_0x60a529,_0x1ee04b['error']['message']);return _0x1dc555(_0x1ee04b['error'][_0x6773('0x11')]);}else{logger[_0x6773('0xa')](_0x6773('0xb'),_0x60a529,'request\x20sent');_0x1dc555(_0x1ee04b[_0x6773('0x12')][_0x6773('0x11')]);}})['catch'](function(_0x33cdee){logger['error'](_0x6773('0xb'),_0x60a529,_0x33cdee);_0x1d120b(_0x33cdee);});});} \ No newline at end of file +var _0x8106=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x46d393,_0x4c3c22){var _0x532209=function(_0x48c10c){while(--_0x48c10c){_0x46d393['push'](_0x46d393['shift']());}};_0x532209(++_0x4c3c22);}(_0x8106,0x76));var _0x6810=function(_0x2a673c,_0x1e01ff){_0x2a673c=_0x2a673c-0x0;var _0x2cbafa=_0x8106[_0x2a673c];return _0x2cbafa;};'use strict';var _=require(_0x6810('0x0'));var util=require(_0x6810('0x1'));var moment=require(_0x6810('0x2'));var BPromise=require(_0x6810('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6810('0x4'));var db=require(_0x6810('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6810('0x6'))(_0x6810('0x7'));var config=require(_0x6810('0x8'));var jayson=require(_0x6810('0x9'));var client=jayson['client'][_0x6810('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59d477,_0xd88e0a,_0x364e61){return new BPromise(function(_0x2b047d,_0x4088e5){return client[_0x6810('0xb')](_0x59d477,_0x364e61)[_0x6810('0xc')](function(_0x46bb7a){logger[_0x6810('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0xd88e0a,'request\x20sent');logger[_0x6810('0xe')](_0x6810('0xf'),_0xd88e0a,_0x6810('0x10'),JSON[_0x6810('0x11')](_0x46bb7a));if(_0x46bb7a[_0x6810('0x12')]){if(_0x46bb7a[_0x6810('0x12')][_0x6810('0x13')]===0x1f4){logger[_0x6810('0x12')](_0x6810('0x14'),_0xd88e0a,_0x46bb7a[_0x6810('0x12')][_0x6810('0x15')]);return _0x4088e5(_0x46bb7a[_0x6810('0x12')][_0x6810('0x15')]);}logger[_0x6810('0x12')](_0x6810('0x14'),_0xd88e0a,_0x46bb7a['error'][_0x6810('0x15')]);return _0x2b047d(_0x46bb7a[_0x6810('0x12')][_0x6810('0x15')]);}else{logger[_0x6810('0xd')](_0x6810('0x14'),_0xd88e0a,'request\x20sent');_0x2b047d(_0x46bb7a[_0x6810('0x16')]['message']);}})[_0x6810('0x17')](function(_0x4f2376){logger[_0x6810('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0xd88e0a,_0x4f2376);_0x4088e5(_0x4f2376);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index d108fb5..328f973 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 _0x86ab=['isAuthenticated','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intServicenowField.controller','get','/:id','post'];(function(_0x466325,_0x162cdd){var _0xf91863=function(_0x2c028b){while(--_0x2c028b){_0x466325['push'](_0x466325['shift']());}};_0xf91863(++_0x162cdd);}(_0x86ab,0xa5));var _0xb86a=function(_0x2410cf,_0x15f99f){_0x2410cf=_0x2410cf-0x0;var _0x268162=_0x86ab[_0x2410cf];return _0x268162;};'use strict';var multer=require(_0xb86a('0x0'));var util=require(_0xb86a('0x1'));var path=require(_0xb86a('0x2'));var timeout=require(_0xb86a('0x3'));var express=require(_0xb86a('0x4'));var router=express[_0xb86a('0x5')]();var auth=require(_0xb86a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb86a('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb86a('0x8')](_0xb86a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xb86a('0xa')]('/',auth[_0xb86a('0xb')](),controller['create']);router[_0xb86a('0xc')](_0xb86a('0x9'),auth[_0xb86a('0xb')](),controller[_0xb86a('0xd')]);router[_0xb86a('0xe')]('/:id',auth[_0xb86a('0xb')](),controller['destroy']);module[_0xb86a('0xf')]=router; \ No newline at end of file +var _0xecc3=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','put','/:id','update','exports','multer'];(function(_0x3f4989,_0x484af9){var _0x36ccdd=function(_0x4dedd8){while(--_0x4dedd8){_0x3f4989['push'](_0x3f4989['shift']());}};_0x36ccdd(++_0x484af9);}(_0xecc3,0xbd));var _0x3ecc=function(_0x414f6b,_0x585e6d){_0x414f6b=_0x414f6b-0x0;var _0x3f2fba=_0xecc3[_0x414f6b];return _0x3f2fba;};'use strict';var multer=require(_0x3ecc('0x0'));var util=require(_0x3ecc('0x1'));var path=require(_0x3ecc('0x2'));var timeout=require(_0x3ecc('0x3'));var express=require(_0x3ecc('0x4'));var router=express[_0x3ecc('0x5')]();var auth=require(_0x3ecc('0x6'));var interaction=require(_0x3ecc('0x7'));var config=require(_0x3ecc('0x8'));var controller=require(_0x3ecc('0x9'));router[_0x3ecc('0xa')]('/',auth[_0x3ecc('0xb')](),controller[_0x3ecc('0xc')]);router[_0x3ecc('0xa')]('/:id',auth[_0x3ecc('0xb')](),controller[_0x3ecc('0xd')]);router[_0x3ecc('0xe')]('/',auth[_0x3ecc('0xb')](),controller['create']);router[_0x3ecc('0xf')](_0x3ecc('0x10'),auth[_0x3ecc('0xb')](),controller[_0x3ecc('0x11')]);router['delete'](_0x3ecc('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x3ecc('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index ad63c21..1cbeec3 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 _0x5455=['ENUM','exports','string','customVariable','keyValue','STRING'];(function(_0x2f49b0,_0x484ffe){var _0x211b48=function(_0x3c376d){while(--_0x3c376d){_0x2f49b0['push'](_0x2f49b0['shift']());}};_0x211b48(++_0x484ffe);}(_0x5455,0x17b));var _0x5545=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5455[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');module[_0x5545('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5545('0x1'),'variable',_0x5545('0x2'),_0x5545('0x3')),'defaultValue':_0x5545('0x1')},'content':{'type':Sequelize[_0x5545('0x4')]},'key':{'type':Sequelize[_0x5545('0x4')]},'keyType':{'type':Sequelize[_0x5545('0x5')](_0x5545('0x1'),'variable',_0x5545('0x2'))},'keyContent':{'type':Sequelize[_0x5545('0x4')]},'idField':{'type':Sequelize[_0x5545('0x4')]},'nameField':{'type':Sequelize[_0x5545('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5545('0x4')]}}; \ No newline at end of file +var _0x0d00=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3e81b2,_0x44d939){var _0x281c48=function(_0x9867d0){while(--_0x9867d0){_0x3e81b2['push'](_0x3e81b2['shift']());}};_0x281c48(++_0x44d939);}(_0x0d00,0x13d));var _0x00d0=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x0d00[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x00d0('0x0'));module[_0x00d0('0x1')]={'type':{'type':Sequelize[_0x00d0('0x2')](_0x00d0('0x3'),_0x00d0('0x4'),_0x00d0('0x5'),'keyValue'),'defaultValue':_0x00d0('0x3')},'content':{'type':Sequelize[_0x00d0('0x6')]},'key':{'type':Sequelize[_0x00d0('0x6')]},'keyType':{'type':Sequelize[_0x00d0('0x2')](_0x00d0('0x3'),_0x00d0('0x4'),_0x00d0('0x5'))},'keyContent':{'type':Sequelize[_0x00d0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x00d0('0x6')]},'customField':{'type':Sequelize[_0x00d0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00d0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 50ebb96..72d38dc 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x55ae99,_0x5ab789){var _0x4297e1=function(_0x33ee69){while(--_0x33ee69){_0x55ae99['push'](_0x55ae99['shift']());}};_0x4297e1(++_0x5ab789);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1ec506,_0x1e882d){var _0x56381f=function(_0x5bc395){while(--_0x5bc395){_0x1ec506['push'](_0x1ec506['shift']());}};_0x56381f(++_0x1e882d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index b8e04fe..5be4171 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 _0xc124=['request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc124,0x91));var _0x4c12=function(_0x2ea4b9,_0x27259b){_0x2ea4b9=_0x2ea4b9-0x0;var _0x1ea2f6=_0xc124[_0x2ea4b9];return _0x1ea2f6;};'use strict';var _=require('lodash');var util=require(_0x4c12('0x0'));var logger=require(_0x4c12('0x1'))(_0x4c12('0x2'));var moment=require(_0x4c12('0x3'));var BPromise=require(_0x4c12('0x4'));var rp=require(_0x4c12('0x5'));var fs=require('fs');var path=require(_0x4c12('0x6'));var rimraf=require(_0x4c12('0x7'));var config=require(_0x4c12('0x8'));var attributes=require(_0x4c12('0x9'));module['exports']=function(_0x15fb88,_0x12ad1a){return _0x15fb88[_0x4c12('0xa')]('ServicenowField',attributes,{'tableName':_0x4c12('0xb'),'paranoid':![],'indexes':[{'name':_0x4c12('0xc'),'fields':[_0x4c12('0xd'),_0x4c12('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4d4=['path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','idField','lodash','util','../../config/logger','api','moment'];(function(_0x59d0c0,_0x39a54d){var _0x3f28d2=function(_0x58c365){while(--_0x58c365){_0x59d0c0['push'](_0x59d0c0['shift']());}};_0x3f28d2(++_0x39a54d);}(_0xc4d4,0x193));var _0x4c4d=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0xc4d4[_0x4d821c];return _0x15dd5b;};'use strict';var _=require(_0x4c4d('0x0'));var util=require(_0x4c4d('0x1'));var logger=require(_0x4c4d('0x2'))(_0x4c4d('0x3'));var moment=require(_0x4c4d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c4d('0x5'));var rimraf=require(_0x4c4d('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c4d('0x7'));module[_0x4c4d('0x8')]=function(_0xea4b4d,_0x15358a){return _0xea4b4d[_0x4c4d('0x9')](_0x4c4d('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x4c4d('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 5643d78..291528d 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 _0x6363=['error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','ServicenowField,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x3f9d54,_0x5df593){var _0x2d68a0=function(_0x3c9874){while(--_0x3c9874){_0x3f9d54['push'](_0x3f9d54['shift']());}};_0x2d68a0(++_0x5df593);}(_0x6363,0x194));var _0x3636=function(_0x1982cb,_0x31d47c){_0x1982cb=_0x1982cb-0x0;var _0x41ca87=_0x6363[_0x1982cb];return _0x41ca87;};'use strict';var _=require('lodash');var util=require(_0x3636('0x0'));var moment=require(_0x3636('0x1'));var BPromise=require(_0x3636('0x2'));var rs=require(_0x3636('0x3'));var fs=require('fs');var Redis=require(_0x3636('0x4'));var db=require(_0x3636('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3636('0x6'));var config=require(_0x3636('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3636('0x8')][_0x3636('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x228fe6,_0x17badc,_0x3b01e1){return new BPromise(function(_0x592f52,_0x430e19){return client['request'](_0x228fe6,_0x3b01e1)[_0x3636('0xa')](function(_0x34035c){logger[_0x3636('0xb')](_0x3636('0xc'),_0x17badc,'request\x20sent');logger[_0x3636('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x17badc,_0x3636('0xe'),JSON[_0x3636('0xf')](_0x34035c));if(_0x34035c[_0x3636('0x10')]){if(_0x34035c[_0x3636('0x10')][_0x3636('0x11')]===0x1f4){logger[_0x3636('0x10')]('ServicenowField,\x20%s,\x20%s',_0x17badc,_0x34035c['error'][_0x3636('0x12')]);return _0x430e19(_0x34035c['error'][_0x3636('0x12')]);}logger['error'](_0x3636('0xc'),_0x17badc,_0x34035c[_0x3636('0x10')]['message']);return _0x592f52(_0x34035c[_0x3636('0x10')][_0x3636('0x12')]);}else{logger[_0x3636('0xb')](_0x3636('0xc'),_0x17badc,_0x3636('0xe'));_0x592f52(_0x34035c['result']['message']);}})[_0x3636('0x13')](function(_0x55d801){logger[_0x3636('0x10')](_0x3636('0xc'),_0x17badc,_0x55d801);_0x430e19(_0x55d801);});});} \ No newline at end of file +var _0xfbc2=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbc2,0xb4));var _0x2fbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfbc2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fbc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2fbc('0x1'));var rs=require(_0x2fbc('0x2'));var fs=require('fs');var Redis=require(_0x2fbc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fbc('0x4'));var logger=require(_0x2fbc('0x5'))(_0x2fbc('0x6'));var config=require(_0x2fbc('0x7'));var jayson=require(_0x2fbc('0x8'));var client=jayson['client'][_0x2fbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51cea9,_0xe1f12a,_0x5b51c0){return new BPromise(function(_0x5da2d2,_0x2df5c4){return client[_0x2fbc('0xa')](_0x51cea9,_0x5b51c0)[_0x2fbc('0xb')](function(_0x22c7f1){logger[_0x2fbc('0xc')](_0x2fbc('0xd'),_0xe1f12a,_0x2fbc('0xe'));logger['debug']('ServicenowField,\x20%s,\x20%s,\x20%s',_0xe1f12a,_0x2fbc('0xe'),JSON[_0x2fbc('0xf')](_0x22c7f1));if(_0x22c7f1[_0x2fbc('0x10')]){if(_0x22c7f1[_0x2fbc('0x10')][_0x2fbc('0x11')]===0x1f4){logger[_0x2fbc('0x10')](_0x2fbc('0xd'),_0xe1f12a,_0x22c7f1[_0x2fbc('0x10')][_0x2fbc('0x12')]);return _0x2df5c4(_0x22c7f1[_0x2fbc('0x10')][_0x2fbc('0x12')]);}logger[_0x2fbc('0x10')](_0x2fbc('0xd'),_0xe1f12a,_0x22c7f1['error'][_0x2fbc('0x12')]);return _0x5da2d2(_0x22c7f1[_0x2fbc('0x10')][_0x2fbc('0x12')]);}else{logger[_0x2fbc('0xc')](_0x2fbc('0xd'),_0xe1f12a,_0x2fbc('0xe'));_0x5da2d2(_0x22c7f1[_0x2fbc('0x13')]['message']);}})[_0x2fbc('0x14')](function(_0x4d0c6a){logger[_0x2fbc('0x10')]('ServicenowField,\x20%s,\x20%s',_0xe1f12a,_0x4d0c6a);_0x2df5c4(_0x4d0c6a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b748ce1..01c6ae4 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 _0x8142=['Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x13d749,_0x274ca2){var _0x2277f4=function(_0x188d96){while(--_0x188d96){_0x13d749['push'](_0x13d749['shift']());}};_0x2277f4(++_0x274ca2);}(_0x8142,0x1c3));var _0x2814=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0x8142[_0x57eb2d];return _0xd8e18;};'use strict';var multer=require(_0x2814('0x0'));var util=require(_0x2814('0x1'));var path=require(_0x2814('0x2'));var timeout=require(_0x2814('0x3'));var express=require(_0x2814('0x4'));var router=express[_0x2814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2814('0x6'));var config=require(_0x2814('0x7'));var controller=require(_0x2814('0x8'));router[_0x2814('0x9')]('/',auth[_0x2814('0xa')](),controller[_0x2814('0xb')]);router[_0x2814('0x9')](_0x2814('0xc'),auth[_0x2814('0xa')](),controller[_0x2814('0xd')]);router[_0x2814('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x2814('0xe'),auth[_0x2814('0xa')](),controller[_0x2814('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2814('0x10')]);router[_0x2814('0x11')](_0x2814('0x12'),auth[_0x2814('0xa')](),controller[_0x2814('0x13')]);router[_0x2814('0x14')](_0x2814('0xc'),auth[_0x2814('0xa')](),controller[_0x2814('0x15')]);router[_0x2814('0x16')]('/:id',auth[_0x2814('0xa')](),controller['destroy']);module[_0x2814('0x17')]=router; \ No newline at end of file +var _0x4314=['addConfiguration','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0xaac2c8,_0x4252f8){var _0xae37aa=function(_0x2d0835){while(--_0x2d0835){_0xaac2c8['push'](_0xaac2c8['shift']());}};_0xae37aa(++_0x4252f8);}(_0x4314,0xca));var _0x4431=function(_0x1fd590,_0x1232c0){_0x1fd590=_0x1fd590-0x0;var _0x227edc=_0x4314[_0x1fd590];return _0x227edc;};'use strict';var multer=require(_0x4431('0x0'));var util=require('util');var path=require(_0x4431('0x1'));var timeout=require(_0x4431('0x2'));var express=require(_0x4431('0x3'));var router=express[_0x4431('0x4')]();var auth=require(_0x4431('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4431('0x6'));router['get']('/',auth[_0x4431('0x7')](),controller[_0x4431('0x8')]);router[_0x4431('0x9')](_0x4431('0xa'),auth[_0x4431('0x7')](),controller[_0x4431('0xb')]);router[_0x4431('0x9')](_0x4431('0xc'),auth[_0x4431('0x7')](),controller[_0x4431('0xd')]);router[_0x4431('0x9')](_0x4431('0xe'),auth[_0x4431('0x7')](),controller[_0x4431('0xf')]);router[_0x4431('0x10')]('/',auth[_0x4431('0x7')](),controller[_0x4431('0x11')]);router[_0x4431('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4431('0x12')]);router[_0x4431('0x13')](_0x4431('0xa'),auth[_0x4431('0x7')](),controller['update']);router[_0x4431('0x14')](_0x4431('0xa'),auth[_0x4431('0x7')](),controller['destroy']);module[_0x4431('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 24a8486..1debf5b 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 _0xe6ec=['sequelize','exports','STRING','remoteUri'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe6ec,0x1cc));var _0xce6e=function(_0x15e63a,_0x512bc7){_0x15e63a=_0x15e63a-0x0;var _0x5085b5=_0xe6ec[_0x15e63a];return _0x5085b5;};'use strict';var Sequelize=require(_0xce6e('0x0'));module[_0xce6e('0x1')]={'name':{'type':Sequelize[_0xce6e('0x2')]},'description':{'type':Sequelize[_0xce6e('0x2')]},'username':{'type':Sequelize[_0xce6e('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xce6e('0x2')]},'remoteUri':{'type':Sequelize[_0xce6e('0x2')],'unique':_0xce6e('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1161=['username','remoteUri','sequelize','exports','STRING'];(function(_0x291220,_0x137a1b){var _0x49275f=function(_0x1a733d){while(--_0x1a733d){_0x291220['push'](_0x291220['shift']());}};_0x49275f(++_0x137a1b);}(_0x1161,0x156));var _0x1116=function(_0x14f7a1,_0x1ff4c7){_0x14f7a1=_0x14f7a1-0x0;var _0x117110=_0x1161[_0x14f7a1];return _0x117110;};'use strict';var Sequelize=require(_0x1116('0x0'));module[_0x1116('0x1')]={'name':{'type':Sequelize[_0x1116('0x2')]},'description':{'type':Sequelize[_0x1116('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1116('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1116('0x2')],'unique':_0x1116('0x4')},'serverUrl':{'type':Sequelize[_0x1116('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index c2fafa4..bc50d7d 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 _0xe0b2=['api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','SugarcrmAccount','count','include','rows','show','params','includeAll','merge','options','create','body','find','findOne','length','order','getConfigurations','addConfiguration','AccountId','Subjects','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','Calls','values','module_fields','includes','endsWith','value','statusCode','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x191da3,_0x29e356){var _0x49c9aa=function(_0x4b1dde){while(--_0x4b1dde){_0x191da3['push'](_0x191da3['shift']());}};_0x49c9aa(++_0x29e356);}(_0xe0b2,0xec));var _0x2e0b=function(_0x42e956,_0x26c976){_0x42e956=_0x42e956-0x0;var _0x28b298=_0xe0b2[_0x42e956];return _0x28b298;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2e0b('0x0'));var rimraf=require(_0x2e0b('0x1'));var zipdir=require(_0x2e0b('0x2'));var jsonpatch=require(_0x2e0b('0x3'));var rp=require(_0x2e0b('0x4'));var moment=require(_0x2e0b('0x5'));var BPromise=require(_0x2e0b('0x6'));var Mustache=require('mustache');var util=require(_0x2e0b('0x7'));var path=require(_0x2e0b('0x8'));var sox=require(_0x2e0b('0x9'));var csv=require(_0x2e0b('0xa'));var ejs=require(_0x2e0b('0xb'));var fs=require('fs');var _=require(_0x2e0b('0xc'));var squel=require('squel');var crypto=require(_0x2e0b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2e0b('0xe'));var toCsv=require(_0x2e0b('0xa'));var querystring=require(_0x2e0b('0xf'));var Papa=require(_0x2e0b('0x10'));var Redis=require(_0x2e0b('0x11'));var authService=require(_0x2e0b('0x12'));var qs=require(_0x2e0b('0x13'));var as=require(_0x2e0b('0x14'));var hardwareService=require(_0x2e0b('0x15'));var logger=require('../../config/logger')(_0x2e0b('0x16'));var utils=require(_0x2e0b('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x2e0b('0x18'));var jayson=require(_0x2e0b('0x19'));var client=jayson[_0x2e0b('0x1a')][_0x2e0b('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2a7d19,_0x36f31d,_0x1a0456){if(_0x1a0456){var _0x3d789f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d789f[_0x2e0b('0x1c')](_0x36f31d)){return _0x2a7d19;}else{throw new db[(_0x2e0b('0x1d'))][(_0x2e0b('0x1e'))](_0x2e0b('0x1f'));}}else{return _0x2a7d19;}}function respondWithRpcPromise(_0x5d0d0c,_0x5a5022,_0x4a7c04,_0x1cb1fe){return new BPromise(function(_0x4bcc46,_0x391f62){var _0x426879=_0x1cb1fe||client;return _0x426879['request'](_0x5d0d0c,_0x4a7c04)['then'](function(_0x5b9374){logger[_0x2e0b('0x20')](_0x2e0b('0x21'),_0x5a5022,_0x2e0b('0x22'));logger[_0x2e0b('0x23')](_0x2e0b('0x24'),_0x5a5022,'request\x20sent',JSON[_0x2e0b('0x25')](_0x5b9374));if(_0x5b9374['error']){if(_0x5b9374[_0x2e0b('0x26')][_0x2e0b('0x27')]===0x1f4){logger['error'](_0x2e0b('0x21'),_0x5a5022,_0x5b9374[_0x2e0b('0x26')][_0x2e0b('0x28')]);return _0x391f62(_0x5b9374[_0x2e0b('0x26')][_0x2e0b('0x28')]);}logger['error'](_0x2e0b('0x21'),_0x5a5022,_0x5b9374['error']['message']);return _0x4bcc46(_0x5b9374[_0x2e0b('0x26')][_0x2e0b('0x28')]);}else{logger[_0x2e0b('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x5a5022,_0x2e0b('0x22'));_0x4bcc46(_0x5b9374[_0x2e0b('0x29')][_0x2e0b('0x28')]);}})[_0x2e0b('0x2a')](function(_0x28ecc4){logger[_0x2e0b('0x26')](_0x2e0b('0x21'),_0x5a5022,_0x28ecc4);_0x391f62(_0x28ecc4);});});}function respondWithStatusCode(_0x263170,_0x501e7d){_0x501e7d=_0x501e7d||0xcc;return function(_0x5d61f7){if(_0x5d61f7){return _0x263170['sendStatus'](_0x501e7d);}return _0x263170[_0x2e0b('0x2b')](_0x501e7d)[_0x2e0b('0x2c')]();};}function respondWithResult(_0x1cda21,_0x452080){_0x452080=_0x452080||0xc8;return function(_0x275204){if(_0x275204){return _0x1cda21[_0x2e0b('0x2b')](_0x452080)[_0x2e0b('0x2d')](_0x275204);}};}function respondWithFilteredResult(_0x482cb0,_0x3ddb07){return function(_0x12cca8){if(_0x12cca8){var _0x63c043=_0x12cca8['count'],_0x397c30=_0x3ddb07['offset'],_0x5e19c6=_0x3ddb07[_0x2e0b('0x2e')]+_0x3ddb07[_0x2e0b('0x2f')],_0x2049a6;if(_0x5e19c6>=_0x63c043){_0x5e19c6=_0x63c043;_0x2049a6=0xc8;}else{_0x2049a6=0xce;}_0x482cb0[_0x2e0b('0x2b')](_0x2049a6);return _0x482cb0[_0x2e0b('0x30')]('Content-Range',_0x397c30+'-'+_0x5e19c6+'/'+_0x63c043)['json'](_0x12cca8);}return null;};}function patchUpdates(_0x517509){return function(_0x4316e9){try{jsonpatch[_0x2e0b('0x31')](_0x4316e9,_0x517509,!![]);}catch(_0x2cbfbd){return BPromise[_0x2e0b('0x32')](_0x2cbfbd);}return _0x4316e9[_0x2e0b('0x33')]();};}function saveUpdates(_0x2c3afe,_0x4ef4ef){return function(_0x257572){if(_0x257572){return _0x257572[_0x2e0b('0x34')](_0x2c3afe)[_0x2e0b('0x35')](function(_0x5c0e15){return _0x5c0e15;});}return null;};}function removeEntity(_0x127124,_0x5bd943){return function(_0x29d3b4){if(_0x29d3b4){return _0x29d3b4[_0x2e0b('0x36')]()['then'](function(){_0x127124[_0x2e0b('0x2b')](0xcc)[_0x2e0b('0x2c')]();});}};}function handleEntityNotFound(_0x4565f2,_0x4390a2){return function(_0x30264f){if(!_0x30264f){_0x4565f2['sendStatus'](0x194);}return _0x30264f;};}function handleError(_0x1268fb,_0xe1c827){_0xe1c827=_0xe1c827||0x1f4;return function(_0x200c96){logger[_0x2e0b('0x26')](_0x200c96['stack']);if(_0x200c96[_0x2e0b('0x37')]){delete _0x200c96['name'];}_0x1268fb['status'](_0xe1c827)['send'](_0x200c96);};}exports[_0x2e0b('0x38')]=function(_0x11053e,_0x8456d3){var _0x3a47c0={},_0x345caf={},_0x334f37={'count':0x0,'rows':[]};var _0x1d80cd=_[_0x2e0b('0x39')](db['SugarcrmAccount'][_0x2e0b('0x3a')],function(_0x8571df){return{'name':_0x8571df[_0x2e0b('0x3b')],'type':_0x8571df[_0x2e0b('0x3c')][_0x2e0b('0x3d')]};});_0x345caf[_0x2e0b('0x3e')]=_['map'](_0x1d80cd,'name');_0x345caf[_0x2e0b('0x3f')]=_[_0x2e0b('0x40')](_0x11053e[_0x2e0b('0x3f')]);_0x345caf[_0x2e0b('0x41')]=_[_0x2e0b('0x42')](_0x345caf['model'],_0x345caf[_0x2e0b('0x3f')]);_0x3a47c0[_0x2e0b('0x43')]=_[_0x2e0b('0x42')](_0x345caf['model'],qs[_0x2e0b('0x44')](_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x44')]));_0x3a47c0[_0x2e0b('0x43')]=_0x3a47c0[_0x2e0b('0x43')]['length']?_0x3a47c0[_0x2e0b('0x43')]:_0x345caf['model'];if(!_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x45')](_0x2e0b('0x46'))){_0x3a47c0[_0x2e0b('0x2f')]=qs[_0x2e0b('0x2f')](_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x2f')]);_0x3a47c0['offset']=qs[_0x2e0b('0x2e')](_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x2e')]);}_0x3a47c0['order']=qs[_0x2e0b('0x47')](_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x47')]);_0x3a47c0[_0x2e0b('0x48')]=qs[_0x2e0b('0x41')](_[_0x2e0b('0x49')](_0x11053e['query'],_0x345caf['filters']),_0x1d80cd);if(_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x4a')]){_0x3a47c0['where']=_['merge'](_0x3a47c0[_0x2e0b('0x48')],{'$or':_[_0x2e0b('0x39')](_0x1d80cd,function(_0x286082){if(_0x286082[_0x2e0b('0x3c')]!==_0x2e0b('0x4b')){var _0x3c16a7={};_0x3c16a7[_0x286082['name']]={'$like':'%'+_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x4a')]+'%'};return _0x3c16a7;}})});}_0x3a47c0=_['merge']({},_0x3a47c0,_0x11053e['options']);var _0x188524={'where':_0x3a47c0[_0x2e0b('0x48')]};return db[_0x2e0b('0x4c')]['count'](_0x188524)[_0x2e0b('0x35')](function(_0x3c900f){_0x334f37[_0x2e0b('0x4d')]=_0x3c900f;if(_0x11053e[_0x2e0b('0x3f')]['includeAll']){_0x3a47c0[_0x2e0b('0x4e')]=[{'all':!![]}];}return db[_0x2e0b('0x4c')]['findAll'](_0x3a47c0);})[_0x2e0b('0x35')](function(_0x3e12f2){_0x334f37[_0x2e0b('0x4f')]=_0x3e12f2;return _0x334f37;})[_0x2e0b('0x35')](respondWithFilteredResult(_0x8456d3,_0x3a47c0))[_0x2e0b('0x2a')](handleError(_0x8456d3,null));};exports[_0x2e0b('0x50')]=function(_0x2ba22b,_0x64d1b6){var _0x2e7635={'raw':![],'where':{'id':_0x2ba22b[_0x2e0b('0x51')]['id']}},_0x4c5212={};_0x4c5212[_0x2e0b('0x3e')]=_[_0x2e0b('0x40')](db[_0x2e0b('0x4c')][_0x2e0b('0x3a')]);_0x4c5212[_0x2e0b('0x3f')]=_[_0x2e0b('0x40')](_0x2ba22b[_0x2e0b('0x3f')]);_0x4c5212[_0x2e0b('0x41')]=_['intersection'](_0x4c5212['model'],_0x4c5212[_0x2e0b('0x3f')]);_0x2e7635['attributes']=_[_0x2e0b('0x42')](_0x4c5212[_0x2e0b('0x3e')],qs[_0x2e0b('0x44')](_0x2ba22b[_0x2e0b('0x3f')]['fields']));_0x2e7635[_0x2e0b('0x43')]=_0x2e7635[_0x2e0b('0x43')]['length']?_0x2e7635[_0x2e0b('0x43')]:_0x4c5212[_0x2e0b('0x3e')];if(_0x2ba22b['query'][_0x2e0b('0x52')]){_0x2e7635[_0x2e0b('0x4e')]=[{'all':!![]}];}_0x2e7635=_[_0x2e0b('0x53')]({},_0x2e7635,_0x2ba22b[_0x2e0b('0x54')]);return db['SugarcrmAccount']['find'](_0x2e7635)[_0x2e0b('0x35')](handleEntityNotFound(_0x64d1b6,null))[_0x2e0b('0x35')](respondWithResult(_0x64d1b6,null))['catch'](handleError(_0x64d1b6,null));};exports[_0x2e0b('0x55')]=function(_0x4ad530,_0x23f894){return db[_0x2e0b('0x4c')]['create'](_0x4ad530[_0x2e0b('0x56')],{})[_0x2e0b('0x35')](respondWithResult(_0x23f894,0xc9))[_0x2e0b('0x2a')](handleError(_0x23f894,null));};exports['update']=function(_0x46fda0,_0x2d84bb){if(_0x46fda0[_0x2e0b('0x56')]['id']){delete _0x46fda0[_0x2e0b('0x56')]['id'];}return db[_0x2e0b('0x4c')][_0x2e0b('0x57')]({'where':{'id':_0x46fda0[_0x2e0b('0x51')]['id']}})[_0x2e0b('0x35')](handleEntityNotFound(_0x2d84bb,null))[_0x2e0b('0x35')](saveUpdates(_0x46fda0[_0x2e0b('0x56')],null))[_0x2e0b('0x35')](respondWithResult(_0x2d84bb,null))['catch'](handleError(_0x2d84bb,null));};exports[_0x2e0b('0x36')]=function(_0x17ce40,_0x998be6){return db['SugarcrmAccount']['find']({'where':{'id':_0x17ce40[_0x2e0b('0x51')]['id']}})[_0x2e0b('0x35')](handleEntityNotFound(_0x998be6,null))[_0x2e0b('0x35')](removeEntity(_0x998be6,null))['catch'](handleError(_0x998be6,null));};exports['getConfigurations']=function(_0x308e71,_0x4333b7,_0x4b44e4){var _0x28fdec={};var _0x48309b={};var _0x3a7e5c;var _0x349f20;return db['SugarcrmAccount'][_0x2e0b('0x58')]({'where':{'id':_0x308e71[_0x2e0b('0x51')]['id']}})['then'](handleEntityNotFound(_0x4333b7,null))['then'](function(_0x9fcab4){if(_0x9fcab4){_0x3a7e5c=_0x9fcab4;_0x48309b[_0x2e0b('0x3e')]=_[_0x2e0b('0x40')](db['SugarcrmConfiguration'][_0x2e0b('0x3a')]);_0x48309b[_0x2e0b('0x3f')]=_['keys'](_0x308e71[_0x2e0b('0x3f')]);_0x48309b[_0x2e0b('0x41')]=_[_0x2e0b('0x42')](_0x48309b['model'],_0x48309b[_0x2e0b('0x3f')]);_0x28fdec['attributes']=_[_0x2e0b('0x42')](_0x48309b[_0x2e0b('0x3e')],qs['fields'](_0x308e71[_0x2e0b('0x3f')][_0x2e0b('0x44')]));_0x28fdec['attributes']=_0x28fdec['attributes'][_0x2e0b('0x59')]?_0x28fdec[_0x2e0b('0x43')]:_0x48309b[_0x2e0b('0x3e')];_0x28fdec[_0x2e0b('0x5a')]=qs['sort'](_0x308e71[_0x2e0b('0x3f')][_0x2e0b('0x47')]);_0x28fdec[_0x2e0b('0x48')]=qs[_0x2e0b('0x41')](_[_0x2e0b('0x49')](_0x308e71['query'],_0x48309b['filters']));if(_0x308e71[_0x2e0b('0x3f')][_0x2e0b('0x4a')]){_0x28fdec[_0x2e0b('0x48')]=_['merge'](_0x28fdec[_0x2e0b('0x48')],{'$or':_[_0x2e0b('0x39')](_0x28fdec[_0x2e0b('0x43')],function(_0x534bd6){var _0x5088dc={};_0x5088dc[_0x534bd6]={'$like':'%'+_0x308e71[_0x2e0b('0x3f')][_0x2e0b('0x4a')]+'%'};return _0x5088dc;})});}_0x28fdec=_[_0x2e0b('0x53')]({},_0x28fdec,_0x308e71[_0x2e0b('0x54')]);return _0x3a7e5c[_0x2e0b('0x5b')](_0x28fdec);}})[_0x2e0b('0x35')](function(_0x2b2438){if(_0x2b2438){_0x349f20=_0x2b2438[_0x2e0b('0x59')];if(!_0x308e71['query'][_0x2e0b('0x45')](_0x2e0b('0x46'))){_0x28fdec[_0x2e0b('0x2f')]=qs['limit'](_0x308e71['query'][_0x2e0b('0x2f')]);_0x28fdec[_0x2e0b('0x2e')]=qs[_0x2e0b('0x2e')](_0x308e71['query'][_0x2e0b('0x2e')]);}return _0x3a7e5c['getConfigurations'](_0x28fdec);}})['then'](function(_0x36d507){if(_0x36d507){return _0x36d507?{'count':_0x349f20,'rows':_0x36d507}:null;}})[_0x2e0b('0x35')](respondWithResult(_0x4333b7,null))[_0x2e0b('0x2a')](handleError(_0x4333b7,null));};exports[_0x2e0b('0x5c')]=function(_0x554042,_0x958f2a,_0x529588){if(_0x554042[_0x2e0b('0x56')]['id']){delete _0x554042[_0x2e0b('0x56')]['id'];}return db[_0x2e0b('0x4c')]['findOne']({'where':{'id':_0x554042['params']['id']}})[_0x2e0b('0x35')](handleEntityNotFound(_0x958f2a,null))[_0x2e0b('0x35')](function(_0x253898){if(_0x253898){_0x554042[_0x2e0b('0x56')][_0x2e0b('0x5d')]=_0x253898['id'];_0x554042[_0x2e0b('0x56')][_0x2e0b('0x5e')]=integrations['getSubjects'](_0x554042[_0x2e0b('0x56')]['channel'],_0x554042['body'][_0x2e0b('0x3c')]);_0x554042[_0x2e0b('0x56')]['Descriptions']=integrations[_0x2e0b('0x5f')](_0x554042[_0x2e0b('0x56')]['channel'],_0x554042['body']['type']);return db['SugarcrmConfiguration'][_0x2e0b('0x55')](_0x554042[_0x2e0b('0x56')],{'include':[{'model':db['SugarcrmField'],'as':_0x2e0b('0x5e')},{'model':db[_0x2e0b('0x60')],'as':_0x2e0b('0x61')}]});}return null;})[_0x2e0b('0x35')](respondWithResult(_0x958f2a,null))[_0x2e0b('0x2a')](handleError(_0x958f2a,null));};exports[_0x2e0b('0x62')]=function(_0x42ca0c,_0xc5d79f,_0x254d38){var _0x49eb2b='';var _0xc3e643=['id',_0x2e0b('0x37'),_0x2e0b('0x63'),_0x2e0b('0x64'),_0x2e0b('0x65'),'date_start',_0x2e0b('0x66'),_0x2e0b('0x67'),'parent_id',_0x2e0b('0x68'),_0x2e0b('0x69'),_0x2e0b('0x6a')];return db[_0x2e0b('0x4c')][_0x2e0b('0x58')]({'where':{'id':_0x42ca0c[_0x2e0b('0x51')]['id']},'attributes':['id',_0x2e0b('0x6b'),_0x2e0b('0x6c'),_0x2e0b('0x6d')]})['then'](handleEntityNotFound(_0xc5d79f,null))[_0x2e0b('0x35')](function(_0x4695de){if(_0x4695de){_0x49eb2b=_0x4695de[_0x2e0b('0x6d')];var _0x5d677d=_0x49eb2b['slice'](-0x1);if(_0x5d677d==='/'){_0x49eb2b=_0x49eb2b[_0x2e0b('0x6e')](0x0,_0x49eb2b[_0x2e0b('0x6f')](_0x5d677d));}return rp({'method':_0x2e0b('0x70'),'uri':util['format'](_0x2e0b('0x71'),_0x49eb2b,_0x2e0b('0x72')),'json':!![],'form':{'method':'login','input_type':_0x2e0b('0x73'),'response_type':_0x2e0b('0x73'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4695de[_0x2e0b('0x6b')],'password':_0x4695de['password'],'encryption':_0x2e0b('0x74')},'application':_0x2e0b('0x75')})}});}})[_0x2e0b('0x35')](function(_0x34a5f){if(_0x34a5f&&_0x34a5f['name']!==_0x2e0b('0x76')&&_0x34a5f['name']!=='Password\x20Expired'){return rp({'method':_0x2e0b('0x70'),'uri':util[_0x2e0b('0x77')](_0x2e0b('0x71'),_0x49eb2b,_0x2e0b('0x72')),'json':!![],'form':{'method':_0x2e0b('0x78'),'input_type':_0x2e0b('0x73'),'response_type':'JSON','rest_data':JSON[_0x2e0b('0x25')]({'session':_0x34a5f['id'],'module_name':_0x2e0b('0x79')})}})[_0x2e0b('0x35')](function(_0x273e24){if(_0x273e24){var _0x5352e5=_[_0x2e0b('0x7a')](_0x273e24[_0x2e0b('0x7b')]);_['remove'](_0x5352e5,function(_0x234dee){return _0xc3e643[_0x2e0b('0x7c')](_0x234dee[_0x2e0b('0x37')]);});return{'count':_0x5352e5['length'],'rows':_[_0x2e0b('0x39')](_0x5352e5,function(_0x5d7f0e){return{'id':_0x5d7f0e[_0x2e0b('0x37')],'name':_0x5d7f0e['label'],'custom':_[_0x2e0b('0x7d')](_0x5d7f0e['name'],'_c')?!![]:![],'options':_0x5d7f0e[_0x2e0b('0x54')]?_[_0x2e0b('0x39')](_['values'](_0x5d7f0e['options']),function(_0x1bdd11){return{'name':_0x1bdd11[_0x2e0b('0x7e')],'value':_0x1bdd11[_0x2e0b('0x37')]};}):[]};})};}})[_0x2e0b('0x35')](respondWithResult(_0xc5d79f,null))['catch'](function(_0x312bc1){var _0x2e0b83=_0x42ca0c[_0x2e0b('0x3f')][_0x2e0b('0x1c')]?0x1f4:_0x312bc1[_0x2e0b('0x7f')]||0x1f4;logger[_0x2e0b('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2e0b83,JSON[_0x2e0b('0x25')](_0x312bc1));delete _0x312bc1[_0x2e0b('0x37')];if(_0x2e0b83===0x191){_0x2e0b83=0x190;}_0xc5d79f[_0x2e0b('0x2b')](_0x2e0b83)[_0x2e0b('0x80')](_0x42ca0c[_0x2e0b('0x3f')][_0x2e0b('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x312bc1[_0x2e0b('0x7f')]}:_0x312bc1);});}else{var _0x72c7a8=0x1f4;_0xc5d79f[_0x2e0b('0x2b')](_0x72c7a8)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xf3d0=['statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','status','end','json','offset','limit','set','apply','update','destroy','sendStatus','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','show','params','intersection','fields','length','include','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','label','endsWith','value'];(function(_0x11f2ec,_0x1c6718){var _0x1681a1=function(_0x208432){while(--_0x208432){_0x11f2ec['push'](_0x11f2ec['shift']());}};_0x1681a1(++_0x1c6718);}(_0xf3d0,0x87));var _0x0f3d=function(_0x3f9973,_0xafff86){_0x3f9973=_0x3f9973-0x0;var _0x4e694c=_0xf3d0[_0x3f9973];return _0x4e694c;};'use strict';var pdf=require(_0x0f3d('0x0'));var emlformat=require(_0x0f3d('0x1'));var rimraf=require(_0x0f3d('0x2'));var zipdir=require(_0x0f3d('0x3'));var jsonpatch=require(_0x0f3d('0x4'));var rp=require(_0x0f3d('0x5'));var moment=require(_0x0f3d('0x6'));var BPromise=require(_0x0f3d('0x7'));var Mustache=require(_0x0f3d('0x8'));var util=require(_0x0f3d('0x9'));var path=require(_0x0f3d('0xa'));var sox=require(_0x0f3d('0xb'));var csv=require(_0x0f3d('0xc'));var ejs=require(_0x0f3d('0xd'));var fs=require('fs');var _=require(_0x0f3d('0xe'));var squel=require(_0x0f3d('0xf'));var crypto=require('crypto');var jsforce=require(_0x0f3d('0x10'));var deskjs=require(_0x0f3d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0f3d('0x12'));var Papa=require(_0x0f3d('0x13'));var Redis=require(_0x0f3d('0x14'));var authService=require(_0x0f3d('0x15'));var qs=require(_0x0f3d('0x16'));var as=require(_0x0f3d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f3d('0x18'))('api');var utils=require(_0x0f3d('0x19'));var config=require(_0x0f3d('0x1a'));var db=require(_0x0f3d('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0f3d('0x1c'));var client=jayson['client'][_0x0f3d('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3e02e2,_0x34588e,_0x181258){if(_0x181258){var _0x2bf609=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2bf609[_0x0f3d('0x1e')](_0x34588e)){return _0x3e02e2;}else{throw new db[(_0x0f3d('0x1f'))][(_0x0f3d('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3e02e2;}}function respondWithRpcPromise(_0x4b085c,_0x58b093,_0x53b980,_0x302aec){return new BPromise(function(_0x103ad3,_0x3682c2){var _0x515889=_0x302aec||client;return _0x515889[_0x0f3d('0x21')](_0x4b085c,_0x53b980)[_0x0f3d('0x22')](function(_0x14a664){logger[_0x0f3d('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x58b093,_0x0f3d('0x24'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x58b093,'request\x20sent',JSON['stringify'](_0x14a664));if(_0x14a664[_0x0f3d('0x25')]){if(_0x14a664[_0x0f3d('0x25')][_0x0f3d('0x26')]===0x1f4){logger[_0x0f3d('0x25')](_0x0f3d('0x27'),_0x58b093,_0x14a664[_0x0f3d('0x25')]['message']);return _0x3682c2(_0x14a664[_0x0f3d('0x25')][_0x0f3d('0x28')]);}logger[_0x0f3d('0x25')](_0x0f3d('0x27'),_0x58b093,_0x14a664[_0x0f3d('0x25')][_0x0f3d('0x28')]);return _0x103ad3(_0x14a664['error'][_0x0f3d('0x28')]);}else{logger[_0x0f3d('0x23')](_0x0f3d('0x27'),_0x58b093,_0x0f3d('0x24'));_0x103ad3(_0x14a664['result'][_0x0f3d('0x28')]);}})[_0x0f3d('0x29')](function(_0x29554e){logger[_0x0f3d('0x25')](_0x0f3d('0x27'),_0x58b093,_0x29554e);_0x3682c2(_0x29554e);});});}function respondWithStatusCode(_0x39c01f,_0x8c9b43){_0x8c9b43=_0x8c9b43||0xcc;return function(_0x2ba875){if(_0x2ba875){return _0x39c01f['sendStatus'](_0x8c9b43);}return _0x39c01f[_0x0f3d('0x2a')](_0x8c9b43)[_0x0f3d('0x2b')]();};}function respondWithResult(_0x3a4141,_0x267a53){_0x267a53=_0x267a53||0xc8;return function(_0x3caa46){if(_0x3caa46){return _0x3a4141[_0x0f3d('0x2a')](_0x267a53)[_0x0f3d('0x2c')](_0x3caa46);}};}function respondWithFilteredResult(_0x30ce46,_0x20cbf3){return function(_0x56197b){if(_0x56197b){var _0x3a9b10=_0x56197b['count'],_0x5247ad=_0x20cbf3[_0x0f3d('0x2d')],_0x33296b=_0x20cbf3[_0x0f3d('0x2d')]+_0x20cbf3[_0x0f3d('0x2e')],_0x158da9;if(_0x33296b>=_0x3a9b10){_0x33296b=_0x3a9b10;_0x158da9=0xc8;}else{_0x158da9=0xce;}_0x30ce46[_0x0f3d('0x2a')](_0x158da9);return _0x30ce46[_0x0f3d('0x2f')]('Content-Range',_0x5247ad+'-'+_0x33296b+'/'+_0x3a9b10)[_0x0f3d('0x2c')](_0x56197b);}return null;};}function patchUpdates(_0x236e9e){return function(_0x578b14){try{jsonpatch[_0x0f3d('0x30')](_0x578b14,_0x236e9e,!![]);}catch(_0x2ff3a6){return BPromise['reject'](_0x2ff3a6);}return _0x578b14['save']();};}function saveUpdates(_0x397949,_0x1c7973){return function(_0x566e5a){if(_0x566e5a){return _0x566e5a[_0x0f3d('0x31')](_0x397949)['then'](function(_0x101631){return _0x101631;});}return null;};}function removeEntity(_0x191371,_0x2b08fd){return function(_0x1c8551){if(_0x1c8551){return _0x1c8551[_0x0f3d('0x32')]()['then'](function(){_0x191371[_0x0f3d('0x2a')](0xcc)[_0x0f3d('0x2b')]();});}};}function handleEntityNotFound(_0xb34848,_0x2a904e){return function(_0x379b83){if(!_0x379b83){_0xb34848[_0x0f3d('0x33')](0x194);}return _0x379b83;};}function handleError(_0x4c633f,_0x54938e){_0x54938e=_0x54938e||0x1f4;return function(_0x410d2b){logger[_0x0f3d('0x25')](_0x410d2b[_0x0f3d('0x34')]);if(_0x410d2b[_0x0f3d('0x35')]){delete _0x410d2b[_0x0f3d('0x35')];}_0x4c633f[_0x0f3d('0x2a')](_0x54938e)[_0x0f3d('0x36')](_0x410d2b);};}exports['index']=function(_0x16378d,_0x3e991b){var _0x440e14={},_0x134f00={},_0x4312fe={'count':0x0,'rows':[]};var _0x380456=_[_0x0f3d('0x37')](db[_0x0f3d('0x38')][_0x0f3d('0x39')],function(_0x18cb71){return{'name':_0x18cb71[_0x0f3d('0x3a')],'type':_0x18cb71[_0x0f3d('0x3b')][_0x0f3d('0x3c')]};});_0x134f00[_0x0f3d('0x3d')]=_[_0x0f3d('0x37')](_0x380456,'name');_0x134f00[_0x0f3d('0x3e')]=_[_0x0f3d('0x3f')](_0x16378d['query']);_0x134f00[_0x0f3d('0x40')]=_['intersection'](_0x134f00[_0x0f3d('0x3d')],_0x134f00[_0x0f3d('0x3e')]);_0x440e14['attributes']=_['intersection'](_0x134f00[_0x0f3d('0x3d')],qs['fields'](_0x16378d[_0x0f3d('0x3e')]['fields']));_0x440e14[_0x0f3d('0x41')]=_0x440e14[_0x0f3d('0x41')]['length']?_0x440e14[_0x0f3d('0x41')]:_0x134f00['model'];if(!_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x42')](_0x0f3d('0x43'))){_0x440e14['limit']=qs['limit'](_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x2e')]);_0x440e14[_0x0f3d('0x2d')]=qs['offset'](_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x2d')]);}_0x440e14[_0x0f3d('0x44')]=qs[_0x0f3d('0x45')](_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x45')]);_0x440e14[_0x0f3d('0x46')]=qs['filters'](_[_0x0f3d('0x47')](_0x16378d[_0x0f3d('0x3e')],_0x134f00['filters']),_0x380456);if(_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x48')]){_0x440e14[_0x0f3d('0x46')]=_['merge'](_0x440e14[_0x0f3d('0x46')],{'$or':_[_0x0f3d('0x37')](_0x380456,function(_0x10bf8b){if(_0x10bf8b[_0x0f3d('0x3b')]!==_0x0f3d('0x49')){var _0x255458={};_0x255458[_0x10bf8b[_0x0f3d('0x35')]]={'$like':'%'+_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x48')]+'%'};return _0x255458;}})});}_0x440e14=_[_0x0f3d('0x4a')]({},_0x440e14,_0x16378d[_0x0f3d('0x4b')]);var _0x188044={'where':_0x440e14['where']};return db[_0x0f3d('0x38')]['count'](_0x188044)['then'](function(_0x5d5be9){_0x4312fe[_0x0f3d('0x4c')]=_0x5d5be9;if(_0x16378d['query'][_0x0f3d('0x4d')]){_0x440e14['include']=[{'all':!![]}];}return db[_0x0f3d('0x38')][_0x0f3d('0x4e')](_0x440e14);})[_0x0f3d('0x22')](function(_0x1105e5){_0x4312fe['rows']=_0x1105e5;return _0x4312fe;})[_0x0f3d('0x22')](respondWithFilteredResult(_0x3e991b,_0x440e14))[_0x0f3d('0x29')](handleError(_0x3e991b,null));};exports[_0x0f3d('0x4f')]=function(_0x2797b0,_0x4a9dfe){var _0x4e0059={'raw':![],'where':{'id':_0x2797b0[_0x0f3d('0x50')]['id']}},_0x364cff={};_0x364cff[_0x0f3d('0x3d')]=_[_0x0f3d('0x3f')](db[_0x0f3d('0x38')]['rawAttributes']);_0x364cff[_0x0f3d('0x3e')]=_[_0x0f3d('0x3f')](_0x2797b0[_0x0f3d('0x3e')]);_0x364cff[_0x0f3d('0x40')]=_['intersection'](_0x364cff[_0x0f3d('0x3d')],_0x364cff[_0x0f3d('0x3e')]);_0x4e0059[_0x0f3d('0x41')]=_[_0x0f3d('0x51')](_0x364cff[_0x0f3d('0x3d')],qs[_0x0f3d('0x52')](_0x2797b0[_0x0f3d('0x3e')][_0x0f3d('0x52')]));_0x4e0059[_0x0f3d('0x41')]=_0x4e0059['attributes'][_0x0f3d('0x53')]?_0x4e0059[_0x0f3d('0x41')]:_0x364cff['model'];if(_0x2797b0[_0x0f3d('0x3e')][_0x0f3d('0x4d')]){_0x4e0059[_0x0f3d('0x54')]=[{'all':!![]}];}_0x4e0059=_['merge']({},_0x4e0059,_0x2797b0[_0x0f3d('0x4b')]);return db[_0x0f3d('0x38')][_0x0f3d('0x55')](_0x4e0059)[_0x0f3d('0x22')](handleEntityNotFound(_0x4a9dfe,null))[_0x0f3d('0x22')](respondWithResult(_0x4a9dfe,null))[_0x0f3d('0x29')](handleError(_0x4a9dfe,null));};exports[_0x0f3d('0x56')]=function(_0x4f3423,_0x411a7c){return db['SugarcrmAccount'][_0x0f3d('0x56')](_0x4f3423[_0x0f3d('0x57')],{})[_0x0f3d('0x22')](respondWithResult(_0x411a7c,0xc9))[_0x0f3d('0x29')](handleError(_0x411a7c,null));};exports[_0x0f3d('0x31')]=function(_0x43eb3d,_0x1e51da){if(_0x43eb3d[_0x0f3d('0x57')]['id']){delete _0x43eb3d[_0x0f3d('0x57')]['id'];}return db[_0x0f3d('0x38')]['find']({'where':{'id':_0x43eb3d[_0x0f3d('0x50')]['id']}})[_0x0f3d('0x22')](handleEntityNotFound(_0x1e51da,null))['then'](saveUpdates(_0x43eb3d['body'],null))[_0x0f3d('0x22')](respondWithResult(_0x1e51da,null))['catch'](handleError(_0x1e51da,null));};exports['destroy']=function(_0x14fc65,_0x5b1d31){return db['SugarcrmAccount'][_0x0f3d('0x55')]({'where':{'id':_0x14fc65[_0x0f3d('0x50')]['id']}})['then'](handleEntityNotFound(_0x5b1d31,null))[_0x0f3d('0x22')](removeEntity(_0x5b1d31,null))[_0x0f3d('0x29')](handleError(_0x5b1d31,null));};exports[_0x0f3d('0x58')]=function(_0x167d91,_0x25cee4,_0x1314b6){var _0x13f58f={};var _0x4fd68e={};var _0x2da10c;var _0x55308b;return db[_0x0f3d('0x38')][_0x0f3d('0x59')]({'where':{'id':_0x167d91[_0x0f3d('0x50')]['id']}})['then'](handleEntityNotFound(_0x25cee4,null))[_0x0f3d('0x22')](function(_0x33afd7){if(_0x33afd7){_0x2da10c=_0x33afd7;_0x4fd68e['model']=_[_0x0f3d('0x3f')](db['SugarcrmConfiguration']['rawAttributes']);_0x4fd68e['query']=_[_0x0f3d('0x3f')](_0x167d91[_0x0f3d('0x3e')]);_0x4fd68e[_0x0f3d('0x40')]=_[_0x0f3d('0x51')](_0x4fd68e['model'],_0x4fd68e[_0x0f3d('0x3e')]);_0x13f58f['attributes']=_[_0x0f3d('0x51')](_0x4fd68e[_0x0f3d('0x3d')],qs[_0x0f3d('0x52')](_0x167d91[_0x0f3d('0x3e')][_0x0f3d('0x52')]));_0x13f58f[_0x0f3d('0x41')]=_0x13f58f[_0x0f3d('0x41')][_0x0f3d('0x53')]?_0x13f58f[_0x0f3d('0x41')]:_0x4fd68e[_0x0f3d('0x3d')];_0x13f58f[_0x0f3d('0x44')]=qs['sort'](_0x167d91['query'][_0x0f3d('0x45')]);_0x13f58f['where']=qs[_0x0f3d('0x40')](_[_0x0f3d('0x47')](_0x167d91[_0x0f3d('0x3e')],_0x4fd68e[_0x0f3d('0x40')]));if(_0x167d91['query'][_0x0f3d('0x48')]){_0x13f58f[_0x0f3d('0x46')]=_['merge'](_0x13f58f[_0x0f3d('0x46')],{'$or':_[_0x0f3d('0x37')](_0x13f58f[_0x0f3d('0x41')],function(_0xfad85f){var _0x6e2759={};_0x6e2759[_0xfad85f]={'$like':'%'+_0x167d91[_0x0f3d('0x3e')][_0x0f3d('0x48')]+'%'};return _0x6e2759;})});}_0x13f58f=_[_0x0f3d('0x4a')]({},_0x13f58f,_0x167d91[_0x0f3d('0x4b')]);return _0x2da10c['getConfigurations'](_0x13f58f);}})['then'](function(_0x4cbf78){if(_0x4cbf78){_0x55308b=_0x4cbf78[_0x0f3d('0x53')];if(!_0x167d91[_0x0f3d('0x3e')]['hasOwnProperty'](_0x0f3d('0x43'))){_0x13f58f[_0x0f3d('0x2e')]=qs[_0x0f3d('0x2e')](_0x167d91['query'][_0x0f3d('0x2e')]);_0x13f58f['offset']=qs[_0x0f3d('0x2d')](_0x167d91[_0x0f3d('0x3e')][_0x0f3d('0x2d')]);}return _0x2da10c[_0x0f3d('0x58')](_0x13f58f);}})[_0x0f3d('0x22')](function(_0x47b4ab){if(_0x47b4ab){return _0x47b4ab?{'count':_0x55308b,'rows':_0x47b4ab}:null;}})[_0x0f3d('0x22')](respondWithResult(_0x25cee4,null))[_0x0f3d('0x29')](handleError(_0x25cee4,null));};exports[_0x0f3d('0x5a')]=function(_0x2b0d2e,_0x4743af,_0x5d4c1a){if(_0x2b0d2e[_0x0f3d('0x57')]['id']){delete _0x2b0d2e[_0x0f3d('0x57')]['id'];}return db['SugarcrmAccount'][_0x0f3d('0x59')]({'where':{'id':_0x2b0d2e[_0x0f3d('0x50')]['id']}})[_0x0f3d('0x22')](handleEntityNotFound(_0x4743af,null))[_0x0f3d('0x22')](function(_0x25f955){if(_0x25f955){_0x2b0d2e['body'][_0x0f3d('0x5b')]=_0x25f955['id'];_0x2b0d2e[_0x0f3d('0x57')][_0x0f3d('0x5c')]=integrations[_0x0f3d('0x5d')](_0x2b0d2e['body'][_0x0f3d('0x5e')],_0x2b0d2e[_0x0f3d('0x57')][_0x0f3d('0x3b')]);_0x2b0d2e[_0x0f3d('0x57')][_0x0f3d('0x5f')]=integrations[_0x0f3d('0x60')](_0x2b0d2e[_0x0f3d('0x57')][_0x0f3d('0x5e')],_0x2b0d2e['body'][_0x0f3d('0x3b')]);return db[_0x0f3d('0x61')][_0x0f3d('0x56')](_0x2b0d2e[_0x0f3d('0x57')],{'include':[{'model':db[_0x0f3d('0x62')],'as':_0x0f3d('0x5c')},{'model':db[_0x0f3d('0x62')],'as':_0x0f3d('0x5f')}]});}return null;})[_0x0f3d('0x22')](respondWithResult(_0x4743af,null))['catch'](handleError(_0x4743af,null));};exports[_0x0f3d('0x63')]=function(_0xe246bd,_0x10ee64,_0x5121dc){var _0x2e55ac='';var _0x338d8d=['id',_0x0f3d('0x35'),_0x0f3d('0x64'),'created_by',_0x0f3d('0x65'),'date_start',_0x0f3d('0x66'),_0x0f3d('0x67'),_0x0f3d('0x68'),_0x0f3d('0x69'),_0x0f3d('0x6a'),_0x0f3d('0x6b')];return db[_0x0f3d('0x38')][_0x0f3d('0x59')]({'where':{'id':_0xe246bd[_0x0f3d('0x50')]['id']},'attributes':['id',_0x0f3d('0x6c'),_0x0f3d('0x6d'),_0x0f3d('0x6e')]})['then'](handleEntityNotFound(_0x10ee64,null))['then'](function(_0x6826dd){if(_0x6826dd){_0x2e55ac=_0x6826dd[_0x0f3d('0x6e')];var _0x22d036=_0x2e55ac['slice'](-0x1);if(_0x22d036==='/'){_0x2e55ac=_0x2e55ac[_0x0f3d('0x6f')](0x0,_0x2e55ac[_0x0f3d('0x70')](_0x22d036));}return rp({'method':_0x0f3d('0x71'),'uri':util['format'](_0x0f3d('0x72'),_0x2e55ac,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0f3d('0x73'),'input_type':'JSON','response_type':_0x0f3d('0x74'),'rest_data':JSON[_0x0f3d('0x75')]({'user_auth':{'user_name':_0x6826dd['username'],'password':_0x6826dd['password'],'encryption':_0x0f3d('0x76')},'application':_0x0f3d('0x77')})}});}})[_0x0f3d('0x22')](function(_0x13f2ae){if(_0x13f2ae&&_0x13f2ae['name']!=='Invalid\x20Login'&&_0x13f2ae['name']!==_0x0f3d('0x78')){return rp({'method':_0x0f3d('0x71'),'uri':util[_0x0f3d('0x79')]('%s%s',_0x2e55ac,_0x0f3d('0x7a')),'json':!![],'form':{'method':_0x0f3d('0x7b'),'input_type':_0x0f3d('0x74'),'response_type':_0x0f3d('0x74'),'rest_data':JSON[_0x0f3d('0x75')]({'session':_0x13f2ae['id'],'module_name':_0x0f3d('0x7c')})}})[_0x0f3d('0x22')](function(_0x20aca7){if(_0x20aca7){var _0x414485=_[_0x0f3d('0x7d')](_0x20aca7[_0x0f3d('0x7e')]);_[_0x0f3d('0x7f')](_0x414485,function(_0x39b6c1){return _0x338d8d['includes'](_0x39b6c1[_0x0f3d('0x35')]);});return{'count':_0x414485[_0x0f3d('0x53')],'rows':_[_0x0f3d('0x37')](_0x414485,function(_0x37822f){return{'id':_0x37822f[_0x0f3d('0x35')],'name':_0x37822f[_0x0f3d('0x80')],'custom':_[_0x0f3d('0x81')](_0x37822f[_0x0f3d('0x35')],'_c')?!![]:![],'options':_0x37822f[_0x0f3d('0x4b')]?_[_0x0f3d('0x37')](_[_0x0f3d('0x7d')](_0x37822f[_0x0f3d('0x4b')]),function(_0x3e24f4){return{'name':_0x3e24f4[_0x0f3d('0x82')],'value':_0x3e24f4[_0x0f3d('0x35')]};}):[]};})};}})[_0x0f3d('0x22')](respondWithResult(_0x10ee64,null))[_0x0f3d('0x29')](function(_0x4015a7){var _0x205ed3=_0xe246bd[_0x0f3d('0x3e')][_0x0f3d('0x1e')]?0x1f4:_0x4015a7[_0x0f3d('0x83')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x205ed3,JSON[_0x0f3d('0x75')](_0x4015a7));delete _0x4015a7[_0x0f3d('0x35')];if(_0x205ed3===0x191){_0x205ed3=0x190;}_0x10ee64[_0x0f3d('0x2a')](_0x205ed3)['send'](_0xe246bd[_0x0f3d('0x3e')][_0x0f3d('0x1e')]?{'message':_0x0f3d('0x84'),'statusCode':_0x4015a7['statusCode']}:_0x4015a7);});}else{var _0x12ad7d=0x1f4;_0x10ee64['status'](_0x12ad7d)[_0x0f3d('0x36')]({'message':_0x0f3d('0x84'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index c16d495..b9e8a5a 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 _0x19ae=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','define'];(function(_0x3cffe7,_0x4d784f){var _0x2b7e9e=function(_0x10deaa){while(--_0x10deaa){_0x3cffe7['push'](_0x3cffe7['shift']());}};_0x2b7e9e(++_0x4d784f);}(_0x19ae,0x199));var _0xe19a=function(_0x6e359a,_0x4eed80){_0x6e359a=_0x6e359a-0x0;var _0x4034f0=_0x19ae[_0x6e359a];return _0x4034f0;};'use strict';var _=require(_0xe19a('0x0'));var util=require(_0xe19a('0x1'));var logger=require(_0xe19a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe19a('0x3'));var rp=require(_0xe19a('0x4'));var fs=require('fs');var path=require(_0xe19a('0x5'));var rimraf=require('rimraf');var config=require(_0xe19a('0x6'));var attributes=require(_0xe19a('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3566da,_0x2b54f3){return _0x3566da[_0xe19a('0x8')](_0xe19a('0x9'),attributes,{'tableName':_0xe19a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf181=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x578b8f,_0x586eb1){var _0x3394f3=function(_0x1be308){while(--_0x1be308){_0x578b8f['push'](_0x578b8f['shift']());}};_0x3394f3(++_0x586eb1);}(_0xf181,0x1d8));var _0x1f18=function(_0x2d92bd,_0x416726){_0x2d92bd=_0x2d92bd-0x0;var _0x51a00f=_0xf181[_0x2d92bd];return _0x51a00f;};'use strict';var _=require(_0x1f18('0x0'));var util=require(_0x1f18('0x1'));var logger=require(_0x1f18('0x2'))(_0x1f18('0x3'));var moment=require(_0x1f18('0x4'));var BPromise=require(_0x1f18('0x5'));var rp=require(_0x1f18('0x6'));var fs=require('fs');var path=require(_0x1f18('0x7'));var rimraf=require(_0x1f18('0x8'));var config=require(_0x1f18('0x9'));var attributes=require(_0x1f18('0xa'));var integrations=require(_0x1f18('0xb'));module[_0x1f18('0xc')]=function(_0x237768,_0x5c101d){return _0x237768[_0x1f18('0xd')](_0x1f18('0xe'),attributes,{'tableName':_0x1f18('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 23849d0..bd99b20 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 _0x1fb9=['GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','limit','map','include','model','info','ShowSugarcrmAccount','find','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x5b8c28,_0x219f5f){var _0x4a36ec=function(_0x297c4e){while(--_0x297c4e){_0x5b8c28['push'](_0x5b8c28['shift']());}};_0x4a36ec(++_0x219f5f);}(_0x1fb9,0xc7));var _0x91fb=function(_0x39e227,_0x21fa81){_0x39e227=_0x39e227-0x0;var _0x558d73=_0x1fb9[_0x39e227];return _0x558d73;};'use strict';var _=require('lodash');var util=require(_0x91fb('0x0'));var moment=require(_0x91fb('0x1'));var BPromise=require(_0x91fb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91fb('0x3'));var db=require(_0x91fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x91fb('0x5'))('rpc');var config=require(_0x91fb('0x6'));var jayson=require(_0x91fb('0x7'));var client=jayson[_0x91fb('0x8')][_0x91fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ae3eb,_0x2ac16d,_0x804d3d){return new BPromise(function(_0x426a99,_0x5ef135){return client['request'](_0x1ae3eb,_0x804d3d)[_0x91fb('0xa')](function(_0x44fec9){logger['info'](_0x91fb('0xb'),_0x2ac16d,_0x91fb('0xc'));logger[_0x91fb('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2ac16d,'request\x20sent',JSON[_0x91fb('0xe')](_0x44fec9));if(_0x44fec9['error']){if(_0x44fec9['error']['code']===0x1f4){logger[_0x91fb('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x2ac16d,_0x44fec9[_0x91fb('0xf')]['message']);return _0x5ef135(_0x44fec9[_0x91fb('0xf')]['message']);}logger[_0x91fb('0xf')](_0x91fb('0xb'),_0x2ac16d,_0x44fec9['error'][_0x91fb('0x10')]);return _0x426a99(_0x44fec9[_0x91fb('0xf')][_0x91fb('0x10')]);}else{logger['info'](_0x91fb('0xb'),_0x2ac16d,_0x91fb('0xc'));_0x426a99(_0x44fec9[_0x91fb('0x11')][_0x91fb('0x10')]);}})['catch'](function(_0x2d50f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2ac16d,_0x2d50f4);_0x5ef135(_0x2d50f4);});});}exports[_0x91fb('0x12')]=function(_0x554aca){var _0x34c6c2=this;return new Promise(function(_0x5ecbf1,_0x223331){return db[_0x91fb('0x13')]['findAll']({'raw':_0x554aca['options']?_0x554aca['options']['raw']===undefined?!![]:![]:!![],'where':_0x554aca[_0x91fb('0x14')]?_0x554aca[_0x91fb('0x14')][_0x91fb('0x15')]||null:null,'attributes':_0x554aca[_0x91fb('0x14')]?_0x554aca[_0x91fb('0x14')][_0x91fb('0x16')]||null:null,'limit':_0x554aca['options']?_0x554aca[_0x91fb('0x14')][_0x91fb('0x17')]||null:null,'include':_0x554aca[_0x91fb('0x14')]?_0x554aca[_0x91fb('0x14')]['include']?_[_0x91fb('0x18')](_0x554aca['options'][_0x91fb('0x19')],function(_0x5b5433){return{'model':db[_0x5b5433[_0x91fb('0x1a')]],'as':_0x5b5433['as'],'attributes':_0x5b5433[_0x91fb('0x16')],'include':_0x5b5433[_0x91fb('0x19')]?_['map'](_0x5b5433[_0x91fb('0x19')],function(_0x410f15){return{'model':db[_0x410f15[_0x91fb('0x1a')]],'as':_0x410f15['as'],'attributes':_0x410f15[_0x91fb('0x16')],'include':_0x410f15[_0x91fb('0x19')]?_[_0x91fb('0x18')](_0x410f15['include'],function(_0x379686){return{'model':db[_0x379686[_0x91fb('0x1a')]],'as':_0x379686['as'],'attributes':_0x379686[_0x91fb('0x16')]};}):[]};}):[]};}):[]:[]})[_0x91fb('0xa')](function(_0x44506d){logger[_0x91fb('0x1b')](_0x91fb('0x12'),_0x554aca);logger[_0x91fb('0xd')]('GetSugarcrmAccount',_0x554aca,JSON[_0x91fb('0xe')](_0x44506d));_0x5ecbf1(_0x44506d);})['catch'](function(_0x36e42e){logger[_0x91fb('0xf')](_0x91fb('0x12'),_0x36e42e[_0x91fb('0x10')],_0x554aca);_0x223331(_0x34c6c2['error'](0x1f4,_0x36e42e[_0x91fb('0x10')]));});});};exports[_0x91fb('0x1c')]=function(_0x32cdb7){var _0x590b7b=this;return new Promise(function(_0x25a31d,_0x5d3dd9){return db[_0x91fb('0x13')][_0x91fb('0x1d')]({'raw':_0x32cdb7['options']?_0x32cdb7['options']['raw']===undefined?!![]:![]:!![],'where':_0x32cdb7[_0x91fb('0x14')]?_0x32cdb7['options'][_0x91fb('0x15')]||null:null,'attributes':_0x32cdb7[_0x91fb('0x14')]?_0x32cdb7['options'][_0x91fb('0x16')]||null:null,'include':_0x32cdb7[_0x91fb('0x14')]?_0x32cdb7['options'][_0x91fb('0x19')]?_[_0x91fb('0x18')](_0x32cdb7[_0x91fb('0x14')]['include'],function(_0x280d79){return{'model':db[_0x280d79['model']],'as':_0x280d79['as'],'attributes':_0x280d79[_0x91fb('0x16')],'include':_0x280d79['include']?_[_0x91fb('0x18')](_0x280d79[_0x91fb('0x19')],function(_0x2e5ad5){return{'model':db[_0x2e5ad5['model']],'as':_0x2e5ad5['as'],'attributes':_0x2e5ad5[_0x91fb('0x16')],'include':_0x2e5ad5[_0x91fb('0x19')]?_['map'](_0x2e5ad5[_0x91fb('0x19')],function(_0x32116b){return{'model':db[_0x32116b['model']],'as':_0x32116b['as'],'attributes':_0x32116b['attributes']};}):[]};}):[]};}):[]:[]})[_0x91fb('0xa')](function(_0x451e0c){logger[_0x91fb('0x1b')](_0x91fb('0x1c'),_0x32cdb7);logger[_0x91fb('0xd')](_0x91fb('0x1c'),_0x32cdb7,JSON[_0x91fb('0xe')](_0x451e0c));_0x25a31d(_0x451e0c);})[_0x91fb('0x1e')](function(_0x159c33){logger[_0x91fb('0xf')](_0x91fb('0x1c'),_0x159c33[_0x91fb('0x10')],_0x32cdb7);_0x5d3dd9(_0x590b7b[_0x91fb('0xf')](0x1f4,_0x159c33[_0x91fb('0x10')]));});});}; \ No newline at end of file +var _0x80fe=['stringify','error','message','info','catch','GetSugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','then','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x80fe,0x93));var _0xe80f=function(_0x491733,_0x255579){_0x491733=_0x491733-0x0;var _0x3ebb39=_0x80fe[_0x491733];return _0x3ebb39;};'use strict';var _=require(_0xe80f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe80f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe80f('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe80f('0x3'));var config=require(_0xe80f('0x4'));var jayson=require(_0xe80f('0x5'));var client=jayson[_0xe80f('0x6')][_0xe80f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f10d7,_0x38581f,_0x575f58){return new BPromise(function(_0x33e2b9,_0x48d29b){return client[_0xe80f('0x8')](_0x5f10d7,_0x575f58)['then'](function(_0x4ea9ae){logger['info'](_0xe80f('0x9'),_0x38581f,_0xe80f('0xa'));logger[_0xe80f('0xb')](_0xe80f('0xc'),_0x38581f,_0xe80f('0xa'),JSON[_0xe80f('0xd')](_0x4ea9ae));if(_0x4ea9ae['error']){if(_0x4ea9ae['error']['code']===0x1f4){logger[_0xe80f('0xe')](_0xe80f('0x9'),_0x38581f,_0x4ea9ae[_0xe80f('0xe')]['message']);return _0x48d29b(_0x4ea9ae[_0xe80f('0xe')][_0xe80f('0xf')]);}logger[_0xe80f('0xe')](_0xe80f('0x9'),_0x38581f,_0x4ea9ae[_0xe80f('0xe')][_0xe80f('0xf')]);return _0x33e2b9(_0x4ea9ae[_0xe80f('0xe')][_0xe80f('0xf')]);}else{logger[_0xe80f('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x38581f,'request\x20sent');_0x33e2b9(_0x4ea9ae['result']['message']);}})[_0xe80f('0x11')](function(_0xf2f1b8){logger['error'](_0xe80f('0x9'),_0x38581f,_0xf2f1b8);_0x48d29b(_0xf2f1b8);});});}exports[_0xe80f('0x12')]=function(_0xce33a1){var _0x351451=this;return new Promise(function(_0x193d3a,_0x26a3f9){return db['SugarcrmAccount'][_0xe80f('0x13')]({'raw':_0xce33a1['options']?_0xce33a1[_0xe80f('0x14')][_0xe80f('0x15')]===undefined?!![]:![]:!![],'where':_0xce33a1[_0xe80f('0x14')]?_0xce33a1[_0xe80f('0x14')]['where']||null:null,'attributes':_0xce33a1[_0xe80f('0x14')]?_0xce33a1[_0xe80f('0x14')][_0xe80f('0x16')]||null:null,'limit':_0xce33a1['options']?_0xce33a1[_0xe80f('0x14')][_0xe80f('0x17')]||null:null,'include':_0xce33a1[_0xe80f('0x14')]?_0xce33a1[_0xe80f('0x14')][_0xe80f('0x18')]?_[_0xe80f('0x19')](_0xce33a1[_0xe80f('0x14')]['include'],function(_0x53639d){return{'model':db[_0x53639d['model']],'as':_0x53639d['as'],'attributes':_0x53639d[_0xe80f('0x16')],'include':_0x53639d[_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x53639d[_0xe80f('0x18')],function(_0x27d48c){return{'model':db[_0x27d48c[_0xe80f('0x1a')]],'as':_0x27d48c['as'],'attributes':_0x27d48c[_0xe80f('0x16')],'include':_0x27d48c[_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x27d48c['include'],function(_0x1b861f){return{'model':db[_0x1b861f[_0xe80f('0x1a')]],'as':_0x1b861f['as'],'attributes':_0x1b861f[_0xe80f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe80f('0x1b')](function(_0x85ca4e){logger[_0xe80f('0x10')](_0xe80f('0x12'),_0xce33a1);logger['debug'](_0xe80f('0x12'),_0xce33a1,JSON[_0xe80f('0xd')](_0x85ca4e));_0x193d3a(_0x85ca4e);})[_0xe80f('0x11')](function(_0x4195fd){logger[_0xe80f('0xe')]('GetSugarcrmAccount',_0x4195fd[_0xe80f('0xf')],_0xce33a1);_0x26a3f9(_0x351451[_0xe80f('0xe')](0x1f4,_0x4195fd[_0xe80f('0xf')]));});});};exports[_0xe80f('0x1c')]=function(_0x4d2764){var _0x2f65c5=this;return new Promise(function(_0x56e69f,_0x4c4d4d){return db[_0xe80f('0x1d')][_0xe80f('0x1e')]({'raw':_0x4d2764[_0xe80f('0x14')]?_0x4d2764[_0xe80f('0x14')][_0xe80f('0x15')]===undefined?!![]:![]:!![],'where':_0x4d2764[_0xe80f('0x14')]?_0x4d2764[_0xe80f('0x14')][_0xe80f('0x1f')]||null:null,'attributes':_0x4d2764[_0xe80f('0x14')]?_0x4d2764['options'][_0xe80f('0x16')]||null:null,'include':_0x4d2764[_0xe80f('0x14')]?_0x4d2764[_0xe80f('0x14')][_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x4d2764[_0xe80f('0x14')][_0xe80f('0x18')],function(_0x5b7a55){return{'model':db[_0x5b7a55[_0xe80f('0x1a')]],'as':_0x5b7a55['as'],'attributes':_0x5b7a55[_0xe80f('0x16')],'include':_0x5b7a55[_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x5b7a55[_0xe80f('0x18')],function(_0x3f587c){return{'model':db[_0x3f587c['model']],'as':_0x3f587c['as'],'attributes':_0x3f587c[_0xe80f('0x16')],'include':_0x3f587c[_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x3f587c[_0xe80f('0x18')],function(_0x58371d){return{'model':db[_0x58371d[_0xe80f('0x1a')]],'as':_0x58371d['as'],'attributes':_0x58371d[_0xe80f('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27bec0){logger['info'](_0xe80f('0x1c'),_0x4d2764);logger[_0xe80f('0xb')]('ShowSugarcrmAccount',_0x4d2764,JSON['stringify'](_0x27bec0));_0x56e69f(_0x27bec0);})['catch'](function(_0x569e2b){logger[_0xe80f('0xe')](_0xe80f('0x1c'),_0x569e2b[_0xe80f('0xf')],_0x4d2764);_0x4c4d4d(_0x2f65c5['error'](0x1f4,_0x569e2b[_0xe80f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d3129c5..0ccbbf9 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 _0x0cf7=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','util'];(function(_0xc7d3c1,_0x318b7d){var _0x5ad8df=function(_0x49a8a1){while(--_0x49a8a1){_0xc7d3c1['push'](_0xc7d3c1['shift']());}};_0x5ad8df(++_0x318b7d);}(_0x0cf7,0x186));var _0x70cf=function(_0x25e050,_0x8c3e56){_0x25e050=_0x25e050-0x0;var _0x42ec1d=_0x0cf7[_0x25e050];return _0x42ec1d;};'use strict';var multer=require('multer');var util=require(_0x70cf('0x0'));var path=require(_0x70cf('0x1'));var timeout=require(_0x70cf('0x2'));var express=require(_0x70cf('0x3'));var router=express[_0x70cf('0x4')]();var auth=require(_0x70cf('0x5'));var interaction=require(_0x70cf('0x6'));var config=require(_0x70cf('0x7'));var controller=require(_0x70cf('0x8'));router[_0x70cf('0x9')]('/',auth[_0x70cf('0xa')](),controller[_0x70cf('0xb')]);router['get'](_0x70cf('0xc'),auth['isAuthenticated'](),controller[_0x70cf('0xd')]);router[_0x70cf('0x9')]('/:id/fields',auth[_0x70cf('0xa')](),controller[_0x70cf('0xe')]);router[_0x70cf('0x9')]('/:id/subjects',auth[_0x70cf('0xa')](),controller[_0x70cf('0xf')]);router['get'](_0x70cf('0x10'),auth['isAuthenticated'](),controller[_0x70cf('0x11')]);router[_0x70cf('0x12')]('/',auth[_0x70cf('0xa')](),controller[_0x70cf('0x13')]);router['put'](_0x70cf('0xc'),auth[_0x70cf('0xa')](),controller[_0x70cf('0x14')]);router['delete']('/:id',auth[_0x70cf('0xa')](),controller[_0x70cf('0x15')]);module[_0x70cf('0x16')]=router; \ No newline at end of file +var _0xa7d2=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','delete','destroy','exports','util','path','express','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields'];(function(_0x1cbdda,_0x49a2fc){var _0x46d35a=function(_0x5aa437){while(--_0x5aa437){_0x1cbdda['push'](_0x1cbdda['shift']());}};_0x46d35a(++_0x49a2fc);}(_0xa7d2,0x86));var _0x2a7d=function(_0xc0e093,_0x5eb6fc){_0xc0e093=_0xc0e093-0x0;var _0x518a6c=_0xa7d2[_0xc0e093];return _0x518a6c;};'use strict';var multer=require('multer');var util=require(_0x2a7d('0x0'));var path=require(_0x2a7d('0x1'));var timeout=require('connect-timeout');var express=require(_0x2a7d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a7d('0x3'));var controller=require(_0x2a7d('0x4'));router[_0x2a7d('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2a7d('0x6'),auth[_0x2a7d('0x7')](),controller[_0x2a7d('0x8')]);router[_0x2a7d('0x5')](_0x2a7d('0x9'),auth[_0x2a7d('0x7')](),controller[_0x2a7d('0xa')]);router['get'](_0x2a7d('0xb'),auth[_0x2a7d('0x7')](),controller['getSubjects']);router[_0x2a7d('0x5')](_0x2a7d('0xc'),auth['isAuthenticated'](),controller[_0x2a7d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2a7d('0xe')](_0x2a7d('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x2a7d('0xf')](_0x2a7d('0x6'),auth[_0x2a7d('0x7')](),controller[_0x2a7d('0x10')]);module[_0x2a7d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 2c4848e..d3ff2c5 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 _0xd5ca=['sequelize','STRING'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd5ca,0x6a));var _0xad5c=function(_0x20480a,_0x338c7b){_0x20480a=_0x20480a-0x0;var _0x158914=_0xd5ca[_0x20480a];return _0x158914;};'use strict';var Sequelize=require(_0xad5c('0x0'));module['exports']={'name':{'type':Sequelize[_0xad5c('0x1')]},'description':{'type':Sequelize[_0xad5c('0x1')]}}; \ No newline at end of file +var _0x588c=['exports','STRING','sequelize'];(function(_0xedf6bc,_0x4b8d10){var _0x52891e=function(_0x1791a9){while(--_0x1791a9){_0xedf6bc['push'](_0xedf6bc['shift']());}};_0x52891e(++_0x4b8d10);}(_0x588c,0x1d3));var _0xc588=function(_0x446f95,_0x5f8e04){_0x446f95=_0x446f95-0x0;var _0x368664=_0x588c[_0x446f95];return _0x368664;};'use strict';var Sequelize=require(_0xc588('0x0'));module[_0xc588('0x1')]={'name':{'type':Sequelize[_0xc588('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index e3fc67f..5f4680f 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 _0x2b3e=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','status','end','count','offset','limit','set','Content-Range','reject','save','destroy','sendStatus','stack','name','send','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','update','params','getFields','findOne','SugarcrmField','rawAttributes','order','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash'];(function(_0x5ab1fc,_0x377cb2){var _0x53cb78=function(_0x1cff17){while(--_0x1cff17){_0x5ab1fc['push'](_0x5ab1fc['shift']());}};_0x53cb78(++_0x377cb2);}(_0x2b3e,0x1d9));var _0xe2b3=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x2b3e[_0x4709c0];return _0x13348b;};'use strict';var pdf=require(_0xe2b3('0x0'));var emlformat=require(_0xe2b3('0x1'));var rimraf=require(_0xe2b3('0x2'));var zipdir=require(_0xe2b3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2b3('0x4'));var moment=require(_0xe2b3('0x5'));var BPromise=require(_0xe2b3('0x6'));var Mustache=require(_0xe2b3('0x7'));var util=require('util');var path=require(_0xe2b3('0x8'));var sox=require(_0xe2b3('0x9'));var csv=require('to-csv');var ejs=require(_0xe2b3('0xa'));var fs=require('fs');var _=require(_0xe2b3('0xb'));var squel=require(_0xe2b3('0xc'));var crypto=require(_0xe2b3('0xd'));var jsforce=require(_0xe2b3('0xe'));var deskjs=require(_0xe2b3('0xf'));var toCsv=require(_0xe2b3('0x10'));var querystring=require(_0xe2b3('0x11'));var Papa=require(_0xe2b3('0x12'));var Redis=require(_0xe2b3('0x13'));var authService=require(_0xe2b3('0x14'));var qs=require(_0xe2b3('0x15'));var as=require(_0xe2b3('0x16'));var hardwareService=require(_0xe2b3('0x17'));var logger=require(_0xe2b3('0x18'))('api');var utils=require(_0xe2b3('0x19'));var config=require(_0xe2b3('0x1a'));var db=require(_0xe2b3('0x1b'))['db'];var jayson=require(_0xe2b3('0x1c'));var client=jayson['client'][_0xe2b3('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1d421b,_0x17f193,_0x5f4bcb){if(_0x5f4bcb){var _0x4b47e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b47e5[_0xe2b3('0x1e')](_0x17f193)){return _0x1d421b;}else{throw new db[(_0xe2b3('0x1f'))][(_0xe2b3('0x20'))](_0xe2b3('0x21'));}}else{return _0x1d421b;}}function respondWithRpcPromise(_0x5d1d0a,_0x46112e,_0x1a0189,_0x2bf367){return new BPromise(function(_0x3fdecb,_0x2d3c17){var _0x58f6ce=_0x2bf367||client;return _0x58f6ce[_0xe2b3('0x22')](_0x5d1d0a,_0x1a0189)[_0xe2b3('0x23')](function(_0x2e5c3a){logger[_0xe2b3('0x24')](_0xe2b3('0x25'),_0x46112e,'request\x20sent');logger['debug'](_0xe2b3('0x26'),_0x46112e,_0xe2b3('0x27'),JSON['stringify'](_0x2e5c3a));if(_0x2e5c3a[_0xe2b3('0x28')]){if(_0x2e5c3a[_0xe2b3('0x28')][_0xe2b3('0x29')]===0x1f4){logger[_0xe2b3('0x28')](_0xe2b3('0x25'),_0x46112e,_0x2e5c3a[_0xe2b3('0x28')][_0xe2b3('0x2a')]);return _0x2d3c17(_0x2e5c3a['error'][_0xe2b3('0x2a')]);}logger[_0xe2b3('0x28')](_0xe2b3('0x25'),_0x46112e,_0x2e5c3a[_0xe2b3('0x28')]['message']);return _0x3fdecb(_0x2e5c3a[_0xe2b3('0x28')]['message']);}else{logger[_0xe2b3('0x24')](_0xe2b3('0x25'),_0x46112e,_0xe2b3('0x27'));_0x3fdecb(_0x2e5c3a[_0xe2b3('0x2b')]['message']);}})['catch'](function(_0x5ededf){logger[_0xe2b3('0x28')](_0xe2b3('0x25'),_0x46112e,_0x5ededf);_0x2d3c17(_0x5ededf);});});}function respondWithStatusCode(_0x3217c4,_0x1b23f2){_0x1b23f2=_0x1b23f2||0xcc;return function(_0x734634){if(_0x734634){return _0x3217c4['sendStatus'](_0x1b23f2);}return _0x3217c4[_0xe2b3('0x2c')](_0x1b23f2)[_0xe2b3('0x2d')]();};}function respondWithResult(_0x3327b9,_0x10aded){_0x10aded=_0x10aded||0xc8;return function(_0x4a4645){if(_0x4a4645){return _0x3327b9[_0xe2b3('0x2c')](_0x10aded)['json'](_0x4a4645);}};}function respondWithFilteredResult(_0x4ffc34,_0x457da9){return function(_0x408a46){if(_0x408a46){var _0x5750a0=_0x408a46[_0xe2b3('0x2e')],_0x2c3fca=_0x457da9[_0xe2b3('0x2f')],_0x5e5637=_0x457da9['offset']+_0x457da9[_0xe2b3('0x30')],_0x40b7d4;if(_0x5e5637>=_0x5750a0){_0x5e5637=_0x5750a0;_0x40b7d4=0xc8;}else{_0x40b7d4=0xce;}_0x4ffc34[_0xe2b3('0x2c')](_0x40b7d4);return _0x4ffc34[_0xe2b3('0x31')](_0xe2b3('0x32'),_0x2c3fca+'-'+_0x5e5637+'/'+_0x5750a0)['json'](_0x408a46);}return null;};}function patchUpdates(_0x51b11a){return function(_0x431fb9){try{jsonpatch['apply'](_0x431fb9,_0x51b11a,!![]);}catch(_0x293e9d){return BPromise[_0xe2b3('0x33')](_0x293e9d);}return _0x431fb9[_0xe2b3('0x34')]();};}function saveUpdates(_0xda1f15,_0x50a80d){return function(_0x2dba94){if(_0x2dba94){return _0x2dba94['update'](_0xda1f15)[_0xe2b3('0x23')](function(_0x2bf2f6){return _0x2bf2f6;});}return null;};}function removeEntity(_0x15a987,_0x533c44){return function(_0x3789fa){if(_0x3789fa){return _0x3789fa[_0xe2b3('0x35')]()[_0xe2b3('0x23')](function(){_0x15a987[_0xe2b3('0x2c')](0xcc)[_0xe2b3('0x2d')]();});}};}function handleEntityNotFound(_0x19cf86,_0x367227){return function(_0x4e7692){if(!_0x4e7692){_0x19cf86[_0xe2b3('0x36')](0x194);}return _0x4e7692;};}function handleError(_0x12839d,_0x5de9b0){_0x5de9b0=_0x5de9b0||0x1f4;return function(_0x5a47e8){logger[_0xe2b3('0x28')](_0x5a47e8[_0xe2b3('0x37')]);if(_0x5a47e8[_0xe2b3('0x38')]){delete _0x5a47e8[_0xe2b3('0x38')];}_0x12839d['status'](_0x5de9b0)[_0xe2b3('0x39')](_0x5a47e8);};}exports['index']=function(_0x55407e,_0x369ac2){var _0x453ed0={},_0xa5579={},_0x3005a9={'count':0x0,'rows':[]};var _0x26611b=_[_0xe2b3('0x3a')](db[_0xe2b3('0x3b')]['rawAttributes'],function(_0x539d4a){return{'name':_0x539d4a[_0xe2b3('0x3c')],'type':_0x539d4a[_0xe2b3('0x3d')][_0xe2b3('0x3e')]};});_0xa5579[_0xe2b3('0x3f')]=_[_0xe2b3('0x3a')](_0x26611b,'name');_0xa5579[_0xe2b3('0x40')]=_[_0xe2b3('0x41')](_0x55407e[_0xe2b3('0x40')]);_0xa5579[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0xa5579[_0xe2b3('0x3f')],_0xa5579['query']);_0x453ed0['attributes']=_[_0xe2b3('0x43')](_0xa5579[_0xe2b3('0x3f')],qs[_0xe2b3('0x44')](_0x55407e[_0xe2b3('0x40')][_0xe2b3('0x44')]));_0x453ed0[_0xe2b3('0x45')]=_0x453ed0[_0xe2b3('0x45')][_0xe2b3('0x46')]?_0x453ed0['attributes']:_0xa5579[_0xe2b3('0x3f')];if(!_0x55407e[_0xe2b3('0x40')][_0xe2b3('0x47')](_0xe2b3('0x48'))){_0x453ed0['limit']=qs['limit'](_0x55407e[_0xe2b3('0x40')]['limit']);_0x453ed0[_0xe2b3('0x2f')]=qs['offset'](_0x55407e[_0xe2b3('0x40')][_0xe2b3('0x2f')]);}_0x453ed0['order']=qs[_0xe2b3('0x49')](_0x55407e[_0xe2b3('0x40')]['sort']);_0x453ed0[_0xe2b3('0x4a')]=qs['filters'](_[_0xe2b3('0x4b')](_0x55407e[_0xe2b3('0x40')],_0xa5579[_0xe2b3('0x42')]),_0x26611b);if(_0x55407e['query'][_0xe2b3('0x4c')]){_0x453ed0[_0xe2b3('0x4a')]=_[_0xe2b3('0x4d')](_0x453ed0[_0xe2b3('0x4a')],{'$or':_['map'](_0x26611b,function(_0x451381){if(_0x451381['type']!==_0xe2b3('0x4e')){var _0x2d74bb={};_0x2d74bb[_0x451381[_0xe2b3('0x38')]]={'$like':'%'+_0x55407e[_0xe2b3('0x40')]['filter']+'%'};return _0x2d74bb;}})});}_0x453ed0=_[_0xe2b3('0x4d')]({},_0x453ed0,_0x55407e[_0xe2b3('0x4f')]);var _0x29d952={'where':_0x453ed0[_0xe2b3('0x4a')]};return db[_0xe2b3('0x3b')]['count'](_0x29d952)[_0xe2b3('0x23')](function(_0x137f76){_0x3005a9[_0xe2b3('0x2e')]=_0x137f76;if(_0x55407e[_0xe2b3('0x40')]['includeAll']){_0x453ed0[_0xe2b3('0x50')]=[{'all':!![]}];}return db[_0xe2b3('0x3b')][_0xe2b3('0x51')](_0x453ed0);})['then'](function(_0x57aee5){_0x3005a9['rows']=_0x57aee5;return _0x3005a9;})['then'](respondWithFilteredResult(_0x369ac2,_0x453ed0))[_0xe2b3('0x52')](handleError(_0x369ac2,null));};exports[_0xe2b3('0x53')]=function(_0x11b523,_0x574c5e){var _0xb62c8a={'raw':![],'where':{'id':_0x11b523['params']['id']}},_0x1e40db={};_0x1e40db['model']=_[_0xe2b3('0x41')](db[_0xe2b3('0x3b')]['rawAttributes']);_0x1e40db[_0xe2b3('0x40')]=_[_0xe2b3('0x41')](_0x11b523[_0xe2b3('0x40')]);_0x1e40db[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0x1e40db[_0xe2b3('0x3f')],_0x1e40db[_0xe2b3('0x40')]);_0xb62c8a['attributes']=_[_0xe2b3('0x43')](_0x1e40db['model'],qs[_0xe2b3('0x44')](_0x11b523[_0xe2b3('0x40')]['fields']));_0xb62c8a[_0xe2b3('0x45')]=_0xb62c8a[_0xe2b3('0x45')][_0xe2b3('0x46')]?_0xb62c8a[_0xe2b3('0x45')]:_0x1e40db[_0xe2b3('0x3f')];if(_0x11b523['query'][_0xe2b3('0x54')]){_0xb62c8a[_0xe2b3('0x50')]=[{'all':!![]}];}_0xb62c8a=_['merge']({},_0xb62c8a,_0x11b523[_0xe2b3('0x4f')]);return db[_0xe2b3('0x3b')][_0xe2b3('0x55')](_0xb62c8a)[_0xe2b3('0x23')](handleEntityNotFound(_0x574c5e,null))[_0xe2b3('0x23')](respondWithResult(_0x574c5e,null))[_0xe2b3('0x52')](handleError(_0x574c5e,null));};exports['create']=function(_0x20c6e8,_0x15e35d){return db[_0xe2b3('0x3b')][_0xe2b3('0x56')](_0x20c6e8[_0xe2b3('0x57')],{})[_0xe2b3('0x23')](respondWithResult(_0x15e35d,0xc9))[_0xe2b3('0x52')](handleError(_0x15e35d,null));};exports[_0xe2b3('0x58')]=function(_0x109219,_0x51e6f0){if(_0x109219['body']['id']){delete _0x109219['body']['id'];}return db[_0xe2b3('0x3b')][_0xe2b3('0x55')]({'where':{'id':_0x109219[_0xe2b3('0x59')]['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x51e6f0,null))['then'](saveUpdates(_0x109219[_0xe2b3('0x57')],null))[_0xe2b3('0x23')](respondWithResult(_0x51e6f0,null))[_0xe2b3('0x52')](handleError(_0x51e6f0,null));};exports[_0xe2b3('0x35')]=function(_0x3a22c7,_0x1e594b){return db[_0xe2b3('0x3b')][_0xe2b3('0x55')]({'where':{'id':_0x3a22c7[_0xe2b3('0x59')]['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x1e594b,null))[_0xe2b3('0x23')](removeEntity(_0x1e594b,null))[_0xe2b3('0x52')](handleError(_0x1e594b,null));};exports[_0xe2b3('0x5a')]=function(_0x26f57b,_0x59a2b9,_0x2c46bb){var _0x5b25ea={};var _0x21fb44={};var _0x1eae05;var _0x35ae78;return db[_0xe2b3('0x3b')][_0xe2b3('0x5b')]({'where':{'id':_0x26f57b[_0xe2b3('0x59')]['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x59a2b9,null))[_0xe2b3('0x23')](function(_0x167f73){if(_0x167f73){_0x1eae05=_0x167f73;_0x21fb44[_0xe2b3('0x3f')]=_[_0xe2b3('0x41')](db[_0xe2b3('0x5c')][_0xe2b3('0x5d')]);_0x21fb44[_0xe2b3('0x40')]=_['keys'](_0x26f57b[_0xe2b3('0x40')]);_0x21fb44[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0x21fb44['model'],_0x21fb44[_0xe2b3('0x40')]);_0x5b25ea[_0xe2b3('0x45')]=_[_0xe2b3('0x43')](_0x21fb44[_0xe2b3('0x3f')],qs[_0xe2b3('0x44')](_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x44')]));_0x5b25ea[_0xe2b3('0x45')]=_0x5b25ea['attributes'][_0xe2b3('0x46')]?_0x5b25ea[_0xe2b3('0x45')]:_0x21fb44[_0xe2b3('0x3f')];_0x5b25ea[_0xe2b3('0x5e')]=qs[_0xe2b3('0x49')](_0x26f57b[_0xe2b3('0x40')]['sort']);_0x5b25ea[_0xe2b3('0x4a')]=qs['filters'](_['pick'](_0x26f57b[_0xe2b3('0x40')],_0x21fb44[_0xe2b3('0x42')]));if(_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x4c')]){_0x5b25ea[_0xe2b3('0x4a')]=_[_0xe2b3('0x4d')](_0x5b25ea[_0xe2b3('0x4a')],{'$or':_[_0xe2b3('0x3a')](_0x5b25ea[_0xe2b3('0x45')],function(_0x25c0b9){var _0x302692={};_0x302692[_0x25c0b9]={'$like':'%'+_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x4c')]+'%'};return _0x302692;})});}_0x5b25ea=_[_0xe2b3('0x4d')]({},_0x5b25ea,_0x26f57b[_0xe2b3('0x4f')]);return _0x1eae05[_0xe2b3('0x5a')](_0x5b25ea);}})[_0xe2b3('0x23')](function(_0x437101){if(_0x437101){_0x35ae78=_0x437101[_0xe2b3('0x46')];if(!_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x47')](_0xe2b3('0x48'))){_0x5b25ea[_0xe2b3('0x30')]=qs['limit'](_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x30')]);_0x5b25ea[_0xe2b3('0x2f')]=qs[_0xe2b3('0x2f')](_0x26f57b['query'][_0xe2b3('0x2f')]);}return _0x1eae05[_0xe2b3('0x5a')](_0x5b25ea);}})[_0xe2b3('0x23')](function(_0x473f6c){if(_0x473f6c){return _0x473f6c?{'count':_0x35ae78,'rows':_0x473f6c}:null;}})[_0xe2b3('0x23')](respondWithResult(_0x59a2b9,null))[_0xe2b3('0x52')](handleError(_0x59a2b9,null));};exports['getSubjects']=function(_0x302bd2,_0x1c22f8,_0x1e234d){var _0x2f53fd={};var _0x2dc72b={};var _0x354db8;var _0x583189;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x302bd2['params']['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x1c22f8,null))[_0xe2b3('0x23')](function(_0x35bcf8){if(_0x35bcf8){_0x354db8=_0x35bcf8;_0x2dc72b[_0xe2b3('0x3f')]=_[_0xe2b3('0x41')](db[_0xe2b3('0x5c')][_0xe2b3('0x5d')]);_0x2dc72b[_0xe2b3('0x40')]=_[_0xe2b3('0x41')](_0x302bd2[_0xe2b3('0x40')]);_0x2dc72b[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0x2dc72b[_0xe2b3('0x3f')],_0x2dc72b['query']);_0x2f53fd[_0xe2b3('0x45')]=_[_0xe2b3('0x43')](_0x2dc72b[_0xe2b3('0x3f')],qs[_0xe2b3('0x44')](_0x302bd2[_0xe2b3('0x40')][_0xe2b3('0x44')]));_0x2f53fd[_0xe2b3('0x45')]=_0x2f53fd[_0xe2b3('0x45')]['length']?_0x2f53fd[_0xe2b3('0x45')]:_0x2dc72b[_0xe2b3('0x3f')];_0x2f53fd[_0xe2b3('0x5e')]=qs[_0xe2b3('0x49')](_0x302bd2[_0xe2b3('0x40')][_0xe2b3('0x49')]);_0x2f53fd[_0xe2b3('0x4a')]=qs['filters'](_[_0xe2b3('0x4b')](_0x302bd2[_0xe2b3('0x40')],_0x2dc72b[_0xe2b3('0x42')]));if(_0x302bd2[_0xe2b3('0x40')]['filter']){_0x2f53fd['where']=_[_0xe2b3('0x4d')](_0x2f53fd['where'],{'$or':_[_0xe2b3('0x3a')](_0x2f53fd[_0xe2b3('0x45')],function(_0x293eeb){var _0x2a3f27={};_0x2a3f27[_0x293eeb]={'$like':'%'+_0x302bd2[_0xe2b3('0x40')]['filter']+'%'};return _0x2a3f27;})});}_0x2f53fd=_[_0xe2b3('0x4d')]({},_0x2f53fd,_0x302bd2[_0xe2b3('0x4f')]);return _0x354db8[_0xe2b3('0x5f')](_0x2f53fd);}})[_0xe2b3('0x23')](function(_0xd5f0d3){if(_0xd5f0d3){_0x583189=_0xd5f0d3[_0xe2b3('0x46')];if(!_0x302bd2[_0xe2b3('0x40')]['hasOwnProperty'](_0xe2b3('0x48'))){_0x2f53fd['limit']=qs[_0xe2b3('0x30')](_0x302bd2[_0xe2b3('0x40')][_0xe2b3('0x30')]);_0x2f53fd[_0xe2b3('0x2f')]=qs[_0xe2b3('0x2f')](_0x302bd2[_0xe2b3('0x40')]['offset']);}return _0x354db8[_0xe2b3('0x5f')](_0x2f53fd);}})[_0xe2b3('0x23')](function(_0x2290fa){if(_0x2290fa){return _0x2290fa?{'count':_0x583189,'rows':_0x2290fa}:null;}})[_0xe2b3('0x23')](respondWithResult(_0x1c22f8,null))['catch'](handleError(_0x1c22f8,null));};exports[_0xe2b3('0x60')]=function(_0x2ee2fd,_0x5ec5f3,_0x23ee41){var _0x5ce558={};var _0x5a7404={};var _0x5b513c;var _0x3f89c2;return db[_0xe2b3('0x3b')][_0xe2b3('0x5b')]({'where':{'id':_0x2ee2fd[_0xe2b3('0x59')]['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x5ec5f3,null))[_0xe2b3('0x23')](function(_0x6801c2){if(_0x6801c2){_0x5b513c=_0x6801c2;_0x5a7404[_0xe2b3('0x3f')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x5a7404[_0xe2b3('0x40')]=_[_0xe2b3('0x41')](_0x2ee2fd[_0xe2b3('0x40')]);_0x5a7404[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0x5a7404[_0xe2b3('0x3f')],_0x5a7404[_0xe2b3('0x40')]);_0x5ce558[_0xe2b3('0x45')]=_[_0xe2b3('0x43')](_0x5a7404['model'],qs[_0xe2b3('0x44')](_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x44')]));_0x5ce558[_0xe2b3('0x45')]=_0x5ce558[_0xe2b3('0x45')][_0xe2b3('0x46')]?_0x5ce558[_0xe2b3('0x45')]:_0x5a7404[_0xe2b3('0x3f')];_0x5ce558['order']=qs[_0xe2b3('0x49')](_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x49')]);_0x5ce558[_0xe2b3('0x4a')]=qs['filters'](_[_0xe2b3('0x4b')](_0x2ee2fd[_0xe2b3('0x40')],_0x5a7404[_0xe2b3('0x42')]));if(_0x2ee2fd[_0xe2b3('0x40')]['filter']){_0x5ce558[_0xe2b3('0x4a')]=_[_0xe2b3('0x4d')](_0x5ce558[_0xe2b3('0x4a')],{'$or':_[_0xe2b3('0x3a')](_0x5ce558[_0xe2b3('0x45')],function(_0x1352bd){var _0xd6e6a7={};_0xd6e6a7[_0x1352bd]={'$like':'%'+_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x4c')]+'%'};return _0xd6e6a7;})});}_0x5ce558=_[_0xe2b3('0x4d')]({},_0x5ce558,_0x2ee2fd['options']);return _0x5b513c[_0xe2b3('0x60')](_0x5ce558);}})[_0xe2b3('0x23')](function(_0x3dfde2){if(_0x3dfde2){_0x3f89c2=_0x3dfde2['length'];if(!_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x47')](_0xe2b3('0x48'))){_0x5ce558['limit']=qs[_0xe2b3('0x30')](_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x30')]);_0x5ce558['offset']=qs[_0xe2b3('0x2f')](_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x2f')]);}return _0x5b513c[_0xe2b3('0x60')](_0x5ce558);}})[_0xe2b3('0x23')](function(_0x36943d){if(_0x36943d){return _0x36943d?{'count':_0x3f89c2,'rows':_0x36943d}:null;}})[_0xe2b3('0x23')](respondWithResult(_0x5ec5f3,null))[_0xe2b3('0x52')](handleError(_0x5ec5f3,null));}; \ No newline at end of file +var _0x957b=['save','destroy','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','SugarcrmConfiguration','includeAll','include','findAll','rows','rawAttributes','options','find','create','body','update','params','getFields','length','merge','getSubjects','findOne','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','catch','status','end','json','count','offset','limit','set','Content-Range','reject'];(function(_0x17f50f,_0x4cb44d){var _0x55b7a5=function(_0x4eba52){while(--_0x4eba52){_0x17f50f['push'](_0x17f50f['shift']());}};_0x55b7a5(++_0x4cb44d);}(_0x957b,0x8a));var _0xb957=function(_0xf316bd,_0x194537){_0xf316bd=_0xf316bd-0x0;var _0x1127e1=_0x957b[_0xf316bd];return _0x1127e1;};'use strict';var pdf=require(_0xb957('0x0'));var emlformat=require(_0xb957('0x1'));var rimraf=require(_0xb957('0x2'));var zipdir=require(_0xb957('0x3'));var jsonpatch=require(_0xb957('0x4'));var rp=require(_0xb957('0x5'));var moment=require(_0xb957('0x6'));var BPromise=require(_0xb957('0x7'));var Mustache=require(_0xb957('0x8'));var util=require(_0xb957('0x9'));var path=require('path');var sox=require(_0xb957('0xa'));var csv=require(_0xb957('0xb'));var ejs=require(_0xb957('0xc'));var fs=require('fs');var _=require(_0xb957('0xd'));var squel=require(_0xb957('0xe'));var crypto=require('crypto');var jsforce=require(_0xb957('0xf'));var deskjs=require(_0xb957('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb957('0x11'));var Papa=require('papaparse');var Redis=require(_0xb957('0x12'));var authService=require(_0xb957('0x13'));var qs=require(_0xb957('0x14'));var as=require(_0xb957('0x15'));var hardwareService=require(_0xb957('0x16'));var logger=require(_0xb957('0x17'))(_0xb957('0x18'));var utils=require(_0xb957('0x19'));var config=require(_0xb957('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb957('0x1b'));var client=jayson[_0xb957('0x1c')][_0xb957('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x148a3a,_0x41233b,_0x1c5884){if(_0x1c5884){var _0x83e9a1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x83e9a1[_0xb957('0x1e')](_0x41233b)){return _0x148a3a;}else{throw new db['Sequelize'][(_0xb957('0x1f'))](_0xb957('0x20'));}}else{return _0x148a3a;}}function respondWithRpcPromise(_0x4f0ec1,_0x2eaef3,_0x95b7df,_0x358cf5){return new BPromise(function(_0x525509,_0x2ec2f3){var _0x327ecf=_0x358cf5||client;return _0x327ecf[_0xb957('0x21')](_0x4f0ec1,_0x95b7df)[_0xb957('0x22')](function(_0x431e37){logger['info'](_0xb957('0x23'),_0x2eaef3,_0xb957('0x24'));logger[_0xb957('0x25')](_0xb957('0x26'),_0x2eaef3,_0xb957('0x24'),JSON['stringify'](_0x431e37));if(_0x431e37[_0xb957('0x27')]){if(_0x431e37[_0xb957('0x27')]['code']===0x1f4){logger['error'](_0xb957('0x23'),_0x2eaef3,_0x431e37[_0xb957('0x27')]['message']);return _0x2ec2f3(_0x431e37[_0xb957('0x27')]['message']);}logger[_0xb957('0x27')](_0xb957('0x23'),_0x2eaef3,_0x431e37[_0xb957('0x27')][_0xb957('0x28')]);return _0x525509(_0x431e37[_0xb957('0x27')][_0xb957('0x28')]);}else{logger[_0xb957('0x29')](_0xb957('0x23'),_0x2eaef3,_0xb957('0x24'));_0x525509(_0x431e37['result'][_0xb957('0x28')]);}})[_0xb957('0x2a')](function(_0x3f9cb8){logger['error'](_0xb957('0x23'),_0x2eaef3,_0x3f9cb8);_0x2ec2f3(_0x3f9cb8);});});}function respondWithStatusCode(_0x1d2c0b,_0x2d242e){_0x2d242e=_0x2d242e||0xcc;return function(_0xff4dfb){if(_0xff4dfb){return _0x1d2c0b['sendStatus'](_0x2d242e);}return _0x1d2c0b[_0xb957('0x2b')](_0x2d242e)[_0xb957('0x2c')]();};}function respondWithResult(_0xc13ca1,_0x266e6a){_0x266e6a=_0x266e6a||0xc8;return function(_0x5ca64a){if(_0x5ca64a){return _0xc13ca1[_0xb957('0x2b')](_0x266e6a)[_0xb957('0x2d')](_0x5ca64a);}};}function respondWithFilteredResult(_0x57cb5b,_0x18c297){return function(_0x4b1d81){if(_0x4b1d81){var _0x108a05=_0x4b1d81[_0xb957('0x2e')],_0x4c29dc=_0x18c297['offset'],_0x349267=_0x18c297[_0xb957('0x2f')]+_0x18c297[_0xb957('0x30')],_0x26218f;if(_0x349267>=_0x108a05){_0x349267=_0x108a05;_0x26218f=0xc8;}else{_0x26218f=0xce;}_0x57cb5b[_0xb957('0x2b')](_0x26218f);return _0x57cb5b[_0xb957('0x31')](_0xb957('0x32'),_0x4c29dc+'-'+_0x349267+'/'+_0x108a05)['json'](_0x4b1d81);}return null;};}function patchUpdates(_0x29dcba){return function(_0x154cbc){try{jsonpatch['apply'](_0x154cbc,_0x29dcba,!![]);}catch(_0x3f9b62){return BPromise[_0xb957('0x33')](_0x3f9b62);}return _0x154cbc[_0xb957('0x34')]();};}function saveUpdates(_0x531046,_0x2c4fc3){return function(_0x33c95d){if(_0x33c95d){return _0x33c95d['update'](_0x531046)[_0xb957('0x22')](function(_0x56c6df){return _0x56c6df;});}return null;};}function removeEntity(_0x42618c,_0x47bb6c){return function(_0x4bb8ca){if(_0x4bb8ca){return _0x4bb8ca[_0xb957('0x35')]()[_0xb957('0x22')](function(){_0x42618c['status'](0xcc)[_0xb957('0x2c')]();});}};}function handleEntityNotFound(_0x448303,_0x9593fc){return function(_0x74a778){if(!_0x74a778){_0x448303['sendStatus'](0x194);}return _0x74a778;};}function handleError(_0x197c65,_0x345204){_0x345204=_0x345204||0x1f4;return function(_0xefc193){logger[_0xb957('0x27')](_0xefc193[_0xb957('0x36')]);if(_0xefc193[_0xb957('0x37')]){delete _0xefc193[_0xb957('0x37')];}_0x197c65[_0xb957('0x2b')](_0x345204)[_0xb957('0x38')](_0xefc193);};}exports[_0xb957('0x39')]=function(_0x5d617f,_0x5cf169){var _0x2129c6={},_0x12d5de={},_0x383e95={'count':0x0,'rows':[]};var _0x3eee42=_[_0xb957('0x3a')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x4b0fb7){return{'name':_0x4b0fb7['fieldName'],'type':_0x4b0fb7[_0xb957('0x3b')][_0xb957('0x3c')]};});_0x12d5de[_0xb957('0x3d')]=_['map'](_0x3eee42,'name');_0x12d5de[_0xb957('0x3e')]=_[_0xb957('0x3f')](_0x5d617f[_0xb957('0x3e')]);_0x12d5de[_0xb957('0x40')]=_[_0xb957('0x41')](_0x12d5de[_0xb957('0x3d')],_0x12d5de[_0xb957('0x3e')]);_0x2129c6[_0xb957('0x42')]=_[_0xb957('0x41')](_0x12d5de[_0xb957('0x3d')],qs[_0xb957('0x43')](_0x5d617f[_0xb957('0x3e')][_0xb957('0x43')]));_0x2129c6[_0xb957('0x42')]=_0x2129c6[_0xb957('0x42')]['length']?_0x2129c6[_0xb957('0x42')]:_0x12d5de[_0xb957('0x3d')];if(!_0x5d617f[_0xb957('0x3e')][_0xb957('0x44')](_0xb957('0x45'))){_0x2129c6['limit']=qs[_0xb957('0x30')](_0x5d617f[_0xb957('0x3e')][_0xb957('0x30')]);_0x2129c6['offset']=qs[_0xb957('0x2f')](_0x5d617f[_0xb957('0x3e')][_0xb957('0x2f')]);}_0x2129c6[_0xb957('0x46')]=qs[_0xb957('0x47')](_0x5d617f[_0xb957('0x3e')][_0xb957('0x47')]);_0x2129c6[_0xb957('0x48')]=qs[_0xb957('0x40')](_[_0xb957('0x49')](_0x5d617f[_0xb957('0x3e')],_0x12d5de['filters']),_0x3eee42);if(_0x5d617f[_0xb957('0x3e')][_0xb957('0x4a')]){_0x2129c6[_0xb957('0x48')]=_['merge'](_0x2129c6[_0xb957('0x48')],{'$or':_[_0xb957('0x3a')](_0x3eee42,function(_0x32ff78){if(_0x32ff78[_0xb957('0x3b')]!==_0xb957('0x4b')){var _0x5df06a={};_0x5df06a[_0x32ff78[_0xb957('0x37')]]={'$like':'%'+_0x5d617f[_0xb957('0x3e')]['filter']+'%'};return _0x5df06a;}})});}_0x2129c6=_['merge']({},_0x2129c6,_0x5d617f['options']);var _0x57536a={'where':_0x2129c6['where']};return db[_0xb957('0x4c')][_0xb957('0x2e')](_0x57536a)[_0xb957('0x22')](function(_0x38a16a){_0x383e95[_0xb957('0x2e')]=_0x38a16a;if(_0x5d617f[_0xb957('0x3e')][_0xb957('0x4d')]){_0x2129c6[_0xb957('0x4e')]=[{'all':!![]}];}return db[_0xb957('0x4c')][_0xb957('0x4f')](_0x2129c6);})['then'](function(_0x2fc6cc){_0x383e95[_0xb957('0x50')]=_0x2fc6cc;return _0x383e95;})[_0xb957('0x22')](respondWithFilteredResult(_0x5cf169,_0x2129c6))[_0xb957('0x2a')](handleError(_0x5cf169,null));};exports['show']=function(_0x524185,_0x30c576){var _0x45eaa0={'raw':![],'where':{'id':_0x524185['params']['id']}},_0x1fec70={};_0x1fec70['model']=_[_0xb957('0x3f')](db[_0xb957('0x4c')][_0xb957('0x51')]);_0x1fec70[_0xb957('0x3e')]=_[_0xb957('0x3f')](_0x524185['query']);_0x1fec70['filters']=_['intersection'](_0x1fec70[_0xb957('0x3d')],_0x1fec70[_0xb957('0x3e')]);_0x45eaa0[_0xb957('0x42')]=_[_0xb957('0x41')](_0x1fec70[_0xb957('0x3d')],qs[_0xb957('0x43')](_0x524185[_0xb957('0x3e')][_0xb957('0x43')]));_0x45eaa0[_0xb957('0x42')]=_0x45eaa0[_0xb957('0x42')]['length']?_0x45eaa0['attributes']:_0x1fec70[_0xb957('0x3d')];if(_0x524185['query'][_0xb957('0x4d')]){_0x45eaa0[_0xb957('0x4e')]=[{'all':!![]}];}_0x45eaa0=_['merge']({},_0x45eaa0,_0x524185[_0xb957('0x52')]);return db['SugarcrmConfiguration'][_0xb957('0x53')](_0x45eaa0)[_0xb957('0x22')](handleEntityNotFound(_0x30c576,null))[_0xb957('0x22')](respondWithResult(_0x30c576,null))[_0xb957('0x2a')](handleError(_0x30c576,null));};exports['create']=function(_0x1b7369,_0x39659d){return db[_0xb957('0x4c')][_0xb957('0x54')](_0x1b7369[_0xb957('0x55')],{})[_0xb957('0x22')](respondWithResult(_0x39659d,0xc9))[_0xb957('0x2a')](handleError(_0x39659d,null));};exports[_0xb957('0x56')]=function(_0xeda774,_0x2d53b5){if(_0xeda774['body']['id']){delete _0xeda774['body']['id'];}return db[_0xb957('0x4c')][_0xb957('0x53')]({'where':{'id':_0xeda774[_0xb957('0x57')]['id']}})[_0xb957('0x22')](handleEntityNotFound(_0x2d53b5,null))[_0xb957('0x22')](saveUpdates(_0xeda774[_0xb957('0x55')],null))['then'](respondWithResult(_0x2d53b5,null))['catch'](handleError(_0x2d53b5,null));};exports['destroy']=function(_0x30a68f,_0x4d001f){return db[_0xb957('0x4c')][_0xb957('0x53')]({'where':{'id':_0x30a68f[_0xb957('0x57')]['id']}})[_0xb957('0x22')](handleEntityNotFound(_0x4d001f,null))[_0xb957('0x22')](removeEntity(_0x4d001f,null))['catch'](handleError(_0x4d001f,null));};exports[_0xb957('0x58')]=function(_0x573fe8,_0x4f061d,_0xba7148){var _0x4747e9={};var _0x32cbea={};var _0x423e64;var _0x3756ed;return db[_0xb957('0x4c')]['findOne']({'where':{'id':_0x573fe8[_0xb957('0x57')]['id']}})['then'](handleEntityNotFound(_0x4f061d,null))[_0xb957('0x22')](function(_0x4d019d){if(_0x4d019d){_0x423e64=_0x4d019d;_0x32cbea[_0xb957('0x3d')]=_[_0xb957('0x3f')](db['SugarcrmField'][_0xb957('0x51')]);_0x32cbea[_0xb957('0x3e')]=_['keys'](_0x573fe8[_0xb957('0x3e')]);_0x32cbea['filters']=_['intersection'](_0x32cbea[_0xb957('0x3d')],_0x32cbea[_0xb957('0x3e')]);_0x4747e9[_0xb957('0x42')]=_[_0xb957('0x41')](_0x32cbea[_0xb957('0x3d')],qs[_0xb957('0x43')](_0x573fe8[_0xb957('0x3e')][_0xb957('0x43')]));_0x4747e9[_0xb957('0x42')]=_0x4747e9[_0xb957('0x42')][_0xb957('0x59')]?_0x4747e9[_0xb957('0x42')]:_0x32cbea[_0xb957('0x3d')];_0x4747e9[_0xb957('0x46')]=qs[_0xb957('0x47')](_0x573fe8[_0xb957('0x3e')]['sort']);_0x4747e9[_0xb957('0x48')]=qs[_0xb957('0x40')](_[_0xb957('0x49')](_0x573fe8[_0xb957('0x3e')],_0x32cbea['filters']));if(_0x573fe8[_0xb957('0x3e')][_0xb957('0x4a')]){_0x4747e9[_0xb957('0x48')]=_['merge'](_0x4747e9[_0xb957('0x48')],{'$or':_[_0xb957('0x3a')](_0x4747e9[_0xb957('0x42')],function(_0x31c2f1){var _0x1dcdae={};_0x1dcdae[_0x31c2f1]={'$like':'%'+_0x573fe8[_0xb957('0x3e')][_0xb957('0x4a')]+'%'};return _0x1dcdae;})});}_0x4747e9=_[_0xb957('0x5a')]({},_0x4747e9,_0x573fe8[_0xb957('0x52')]);return _0x423e64[_0xb957('0x58')](_0x4747e9);}})['then'](function(_0x2c9444){if(_0x2c9444){_0x3756ed=_0x2c9444[_0xb957('0x59')];if(!_0x573fe8[_0xb957('0x3e')][_0xb957('0x44')](_0xb957('0x45'))){_0x4747e9[_0xb957('0x30')]=qs[_0xb957('0x30')](_0x573fe8[_0xb957('0x3e')][_0xb957('0x30')]);_0x4747e9[_0xb957('0x2f')]=qs[_0xb957('0x2f')](_0x573fe8[_0xb957('0x3e')]['offset']);}return _0x423e64[_0xb957('0x58')](_0x4747e9);}})[_0xb957('0x22')](function(_0x16a664){if(_0x16a664){return _0x16a664?{'count':_0x3756ed,'rows':_0x16a664}:null;}})[_0xb957('0x22')](respondWithResult(_0x4f061d,null))['catch'](handleError(_0x4f061d,null));};exports[_0xb957('0x5b')]=function(_0x5e6faf,_0x1efd63,_0x1392ab){var _0xa25c7c={};var _0xd71549={};var _0x1dccd2;var _0x442f90;return db[_0xb957('0x4c')][_0xb957('0x5c')]({'where':{'id':_0x5e6faf['params']['id']}})[_0xb957('0x22')](handleEntityNotFound(_0x1efd63,null))[_0xb957('0x22')](function(_0x3c3175){if(_0x3c3175){_0x1dccd2=_0x3c3175;_0xd71549[_0xb957('0x3d')]=_[_0xb957('0x3f')](db[_0xb957('0x5d')][_0xb957('0x51')]);_0xd71549[_0xb957('0x3e')]=_['keys'](_0x5e6faf[_0xb957('0x3e')]);_0xd71549[_0xb957('0x40')]=_[_0xb957('0x41')](_0xd71549[_0xb957('0x3d')],_0xd71549[_0xb957('0x3e')]);_0xa25c7c[_0xb957('0x42')]=_[_0xb957('0x41')](_0xd71549['model'],qs['fields'](_0x5e6faf[_0xb957('0x3e')][_0xb957('0x43')]));_0xa25c7c[_0xb957('0x42')]=_0xa25c7c[_0xb957('0x42')]['length']?_0xa25c7c[_0xb957('0x42')]:_0xd71549['model'];_0xa25c7c['order']=qs[_0xb957('0x47')](_0x5e6faf[_0xb957('0x3e')][_0xb957('0x47')]);_0xa25c7c[_0xb957('0x48')]=qs[_0xb957('0x40')](_['pick'](_0x5e6faf['query'],_0xd71549[_0xb957('0x40')]));if(_0x5e6faf['query'][_0xb957('0x4a')]){_0xa25c7c[_0xb957('0x48')]=_[_0xb957('0x5a')](_0xa25c7c[_0xb957('0x48')],{'$or':_[_0xb957('0x3a')](_0xa25c7c[_0xb957('0x42')],function(_0x24256c){var _0x3d831f={};_0x3d831f[_0x24256c]={'$like':'%'+_0x5e6faf['query'][_0xb957('0x4a')]+'%'};return _0x3d831f;})});}_0xa25c7c=_[_0xb957('0x5a')]({},_0xa25c7c,_0x5e6faf[_0xb957('0x52')]);return _0x1dccd2['getSubjects'](_0xa25c7c);}})[_0xb957('0x22')](function(_0x1f5252){if(_0x1f5252){_0x442f90=_0x1f5252[_0xb957('0x59')];if(!_0x5e6faf['query'][_0xb957('0x44')](_0xb957('0x45'))){_0xa25c7c['limit']=qs['limit'](_0x5e6faf[_0xb957('0x3e')][_0xb957('0x30')]);_0xa25c7c[_0xb957('0x2f')]=qs[_0xb957('0x2f')](_0x5e6faf[_0xb957('0x3e')][_0xb957('0x2f')]);}return _0x1dccd2[_0xb957('0x5b')](_0xa25c7c);}})[_0xb957('0x22')](function(_0xe8e790){if(_0xe8e790){return _0xe8e790?{'count':_0x442f90,'rows':_0xe8e790}:null;}})[_0xb957('0x22')](respondWithResult(_0x1efd63,null))['catch'](handleError(_0x1efd63,null));};exports['getDescriptions']=function(_0x87b1e0,_0x3ee49f,_0x5dcf10){var _0x25cd26={};var _0x57b7b3={};var _0x2f7fb1;var _0x46ea85;return db[_0xb957('0x4c')][_0xb957('0x5c')]({'where':{'id':_0x87b1e0[_0xb957('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ee49f,null))[_0xb957('0x22')](function(_0x4dccf8){if(_0x4dccf8){_0x2f7fb1=_0x4dccf8;_0x57b7b3['model']=_['keys'](db['SugarcrmField']['rawAttributes']);_0x57b7b3[_0xb957('0x3e')]=_[_0xb957('0x3f')](_0x87b1e0[_0xb957('0x3e')]);_0x57b7b3['filters']=_[_0xb957('0x41')](_0x57b7b3[_0xb957('0x3d')],_0x57b7b3[_0xb957('0x3e')]);_0x25cd26[_0xb957('0x42')]=_[_0xb957('0x41')](_0x57b7b3[_0xb957('0x3d')],qs[_0xb957('0x43')](_0x87b1e0[_0xb957('0x3e')][_0xb957('0x43')]));_0x25cd26[_0xb957('0x42')]=_0x25cd26[_0xb957('0x42')][_0xb957('0x59')]?_0x25cd26[_0xb957('0x42')]:_0x57b7b3[_0xb957('0x3d')];_0x25cd26['order']=qs[_0xb957('0x47')](_0x87b1e0[_0xb957('0x3e')][_0xb957('0x47')]);_0x25cd26[_0xb957('0x48')]=qs['filters'](_[_0xb957('0x49')](_0x87b1e0[_0xb957('0x3e')],_0x57b7b3['filters']));if(_0x87b1e0[_0xb957('0x3e')][_0xb957('0x4a')]){_0x25cd26[_0xb957('0x48')]=_[_0xb957('0x5a')](_0x25cd26[_0xb957('0x48')],{'$or':_[_0xb957('0x3a')](_0x25cd26[_0xb957('0x42')],function(_0x8d66e1){var _0x5cd9e1={};_0x5cd9e1[_0x8d66e1]={'$like':'%'+_0x87b1e0[_0xb957('0x3e')][_0xb957('0x4a')]+'%'};return _0x5cd9e1;})});}_0x25cd26=_[_0xb957('0x5a')]({},_0x25cd26,_0x87b1e0[_0xb957('0x52')]);return _0x2f7fb1[_0xb957('0x5e')](_0x25cd26);}})['then'](function(_0x508614){if(_0x508614){_0x46ea85=_0x508614[_0xb957('0x59')];if(!_0x87b1e0['query'][_0xb957('0x44')]('nolimit')){_0x25cd26[_0xb957('0x30')]=qs[_0xb957('0x30')](_0x87b1e0[_0xb957('0x3e')][_0xb957('0x30')]);_0x25cd26[_0xb957('0x2f')]=qs[_0xb957('0x2f')](_0x87b1e0[_0xb957('0x3e')]['offset']);}return _0x2f7fb1[_0xb957('0x5e')](_0x25cd26);}})[_0xb957('0x22')](function(_0x79921a){if(_0x79921a){return _0x79921a?{'count':_0x46ea85,'rows':_0x79921a}:null;}})[_0xb957('0x22')](respondWithResult(_0x3ee49f,null))[_0xb957('0x2a')](handleError(_0x3ee49f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index cba643f..c6e0f31 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 _0x9cc8=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x12d6ba,_0x2e6236){var _0x41a75a=function(_0x47a7b4){while(--_0x47a7b4){_0x12d6ba['push'](_0x12d6ba['shift']());}};_0x41a75a(++_0x2e6236);}(_0x9cc8,0x70));var _0x89cc=function(_0x2aead6,_0x54a533){_0x2aead6=_0x2aead6-0x0;var _0x1cc19a=_0x9cc8[_0x2aead6];return _0x1cc19a;};'use strict';var _=require(_0x89cc('0x0'));var util=require(_0x89cc('0x1'));var logger=require(_0x89cc('0x2'))(_0x89cc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x89cc('0x4'));var rimraf=require('rimraf');var config=require(_0x89cc('0x5'));var attributes=require(_0x89cc('0x6'));module[_0x89cc('0x7')]=function(_0x1b9bd5,_0x1505be){return _0x1b9bd5[_0x89cc('0x8')](_0x89cc('0x9'),attributes,{'tableName':_0x89cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe73=['define','int_sugarcrm_configurations','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfe73,0x1e8));var _0x3fe7=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xfe73[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3fe7('0x0'))('api');var moment=require(_0x3fe7('0x1'));var BPromise=require(_0x3fe7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fe7('0x3'));var rimraf=require(_0x3fe7('0x4'));var config=require(_0x3fe7('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x3fe7('0x6')]=function(_0x20aa3d,_0x39a8a3){return _0x20aa3d[_0x3fe7('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0x3fe7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 3c5f0ad..2b0d993 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 _0xb50d=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x55ccbd,_0x3a60db){var _0x322b67=function(_0x4b5ddd){while(--_0x4b5ddd){_0x55ccbd['push'](_0x55ccbd['shift']());}};_0x322b67(++_0x3a60db);}(_0xb50d,0x15d));var _0xdb50=function(_0x459507,_0x4a5814){_0x459507=_0x459507-0x0;var _0x9a71e6=_0xb50d[_0x459507];return _0x9a71e6;};'use strict';var _=require(_0xdb50('0x0'));var util=require(_0xdb50('0x1'));var moment=require('moment');var BPromise=require(_0xdb50('0x2'));var rs=require(_0xdb50('0x3'));var fs=require('fs');var Redis=require(_0xdb50('0x4'));var db=require(_0xdb50('0x5'))['db'];var utils=require(_0xdb50('0x6'));var logger=require('../../config/logger')(_0xdb50('0x7'));var config=require('../../config/environment');var jayson=require(_0xdb50('0x8'));var client=jayson[_0xdb50('0x9')][_0xdb50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21eecb,_0xb57950,_0x4b8ac9){return new BPromise(function(_0x3b37ad,_0x5396b2){return client[_0xdb50('0xb')](_0x21eecb,_0x4b8ac9)[_0xdb50('0xc')](function(_0x462cb6){logger[_0xdb50('0xd')](_0xdb50('0xe'),_0xb57950,_0xdb50('0xf'));logger[_0xdb50('0x10')](_0xdb50('0x11'),_0xb57950,_0xdb50('0xf'),JSON[_0xdb50('0x12')](_0x462cb6));if(_0x462cb6[_0xdb50('0x13')]){if(_0x462cb6[_0xdb50('0x13')][_0xdb50('0x14')]===0x1f4){logger[_0xdb50('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xb57950,_0x462cb6['error'][_0xdb50('0x15')]);return _0x5396b2(_0x462cb6[_0xdb50('0x13')][_0xdb50('0x15')]);}logger[_0xdb50('0x13')](_0xdb50('0xe'),_0xb57950,_0x462cb6[_0xdb50('0x13')][_0xdb50('0x15')]);return _0x3b37ad(_0x462cb6[_0xdb50('0x13')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0xb57950,_0xdb50('0xf'));_0x3b37ad(_0x462cb6[_0xdb50('0x16')][_0xdb50('0x15')]);}})[_0xdb50('0x17')](function(_0x454bcd){logger['error'](_0xdb50('0xe'),_0xb57950,_0x454bcd);_0x5396b2(_0x454bcd);});});} \ No newline at end of file +var _0x9377=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9377,0x107));var _0x7937=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9377[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7937('0x0'));var util=require(_0x7937('0x1'));var moment=require('moment');var BPromise=require(_0x7937('0x2'));var rs=require(_0x7937('0x3'));var fs=require('fs');var Redis=require(_0x7937('0x4'));var db=require(_0x7937('0x5'))['db'];var utils=require(_0x7937('0x6'));var logger=require(_0x7937('0x7'))(_0x7937('0x8'));var config=require(_0x7937('0x9'));var jayson=require(_0x7937('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeb8f51,_0x33e858,_0x588384){return new BPromise(function(_0x2c93c,_0x5c1afe){return client[_0x7937('0xb')](_0xeb8f51,_0x588384)[_0x7937('0xc')](function(_0x5c5411){logger[_0x7937('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x33e858,_0x7937('0xe'));logger[_0x7937('0xf')](_0x7937('0x10'),_0x33e858,_0x7937('0xe'),JSON[_0x7937('0x11')](_0x5c5411));if(_0x5c5411[_0x7937('0x12')]){if(_0x5c5411[_0x7937('0x12')][_0x7937('0x13')]===0x1f4){logger['error'](_0x7937('0x14'),_0x33e858,_0x5c5411[_0x7937('0x12')][_0x7937('0x15')]);return _0x5c1afe(_0x5c5411[_0x7937('0x12')][_0x7937('0x15')]);}logger[_0x7937('0x12')](_0x7937('0x14'),_0x33e858,_0x5c5411[_0x7937('0x12')][_0x7937('0x15')]);return _0x2c93c(_0x5c5411['error'][_0x7937('0x15')]);}else{logger[_0x7937('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x33e858,'request\x20sent');_0x2c93c(_0x5c5411[_0x7937('0x16')]['message']);}})[_0x7937('0x17')](function(_0x242c21){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x33e858,_0x242c21);_0x5c1afe(_0x242c21);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 321a996..28596c0 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 _0xf4ca=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id'];(function(_0xe41fb4,_0x52bcab){var _0x2d126c=function(_0x3720d2){while(--_0x3720d2){_0xe41fb4['push'](_0xe41fb4['shift']());}};_0x2d126c(++_0x52bcab);}(_0xf4ca,0xb6));var _0xaf4c=function(_0x3451e0,_0x23d8e1){_0x3451e0=_0x3451e0-0x0;var _0x5bc322=_0xf4ca[_0x3451e0];return _0x5bc322;};'use strict';var multer=require(_0xaf4c('0x0'));var util=require(_0xaf4c('0x1'));var path=require(_0xaf4c('0x2'));var timeout=require(_0xaf4c('0x3'));var express=require(_0xaf4c('0x4'));var router=express[_0xaf4c('0x5')]();var auth=require(_0xaf4c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf4c('0x7'));var controller=require(_0xaf4c('0x8'));router[_0xaf4c('0x9')]('/',auth[_0xaf4c('0xa')](),controller[_0xaf4c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xaf4c('0xc')]);router[_0xaf4c('0xd')]('/',auth[_0xaf4c('0xa')](),controller[_0xaf4c('0xe')]);router['put']('/:id',auth[_0xaf4c('0xa')](),controller[_0xaf4c('0xf')]);router[_0xaf4c('0x10')](_0xaf4c('0x11'),auth[_0xaf4c('0xa')](),controller[_0xaf4c('0x12')]);module[_0xaf4c('0x13')]=router; \ No newline at end of file +var _0xa0b2=['isAuthenticated','index','show','create','put','update','delete','/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x463a6e,_0x1b47b5){var _0x51d8c6=function(_0x21f507){while(--_0x21f507){_0x463a6e['push'](_0x463a6e['shift']());}};_0x51d8c6(++_0x1b47b5);}(_0xa0b2,0x106));var _0x2a0b=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0xa0b2[_0x263f4c];return _0x3a78d3;};'use strict';var multer=require(_0x2a0b('0x0'));var util=require('util');var path=require(_0x2a0b('0x1'));var timeout=require('connect-timeout');var express=require(_0x2a0b('0x2'));var router=express[_0x2a0b('0x3')]();var auth=require(_0x2a0b('0x4'));var interaction=require(_0x2a0b('0x5'));var config=require(_0x2a0b('0x6'));var controller=require('./intSugarcrmField.controller');router[_0x2a0b('0x7')]('/',auth[_0x2a0b('0x8')](),controller[_0x2a0b('0x9')]);router[_0x2a0b('0x7')]('/:id',auth[_0x2a0b('0x8')](),controller[_0x2a0b('0xa')]);router['post']('/',auth[_0x2a0b('0x8')](),controller[_0x2a0b('0xb')]);router[_0x2a0b('0xc')]('/:id',auth[_0x2a0b('0x8')](),controller[_0x2a0b('0xd')]);router[_0x2a0b('0xe')](_0x2a0b('0xf'),auth[_0x2a0b('0x8')](),controller[_0x2a0b('0x10')]);module[_0x2a0b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 29e80ee..2ddac9e 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 _0x5ed2=['sequelize','ENUM','string','customVariable','keyValue','STRING'];(function(_0x25c4c8,_0x1970a3){var _0x571173=function(_0x2bf317){while(--_0x2bf317){_0x25c4c8['push'](_0x25c4c8['shift']());}};_0x571173(++_0x1970a3);}(_0x5ed2,0x114));var _0x25ed=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x5ed2[_0x46ec32];return _0x338f60;};'use strict';var Sequelize=require(_0x25ed('0x0'));module['exports']={'type':{'type':Sequelize[_0x25ed('0x1')](_0x25ed('0x2'),'variable',_0x25ed('0x3'),_0x25ed('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x25ed('0x5')]},'key':{'type':Sequelize[_0x25ed('0x5')]},'keyType':{'type':Sequelize[_0x25ed('0x1')](_0x25ed('0x2'),'variable',_0x25ed('0x3'))},'keyContent':{'type':Sequelize[_0x25ed('0x5')]},'idField':{'type':Sequelize[_0x25ed('0x5')]},'nameField':{'type':Sequelize[_0x25ed('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x795a=['STRING','BOOLEAN','exports','ENUM','variable','keyValue','string','customVariable'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x795a,0xa2));var _0xa795=function(_0x4a6ead,_0xd2c0e6){_0x4a6ead=_0x4a6ead-0x0;var _0x1d9676=_0x795a[_0x4a6ead];return _0x1d9676;};'use strict';var Sequelize=require('sequelize');module[_0xa795('0x0')]={'type':{'type':Sequelize[_0xa795('0x1')]('string',_0xa795('0x2'),'customVariable',_0xa795('0x3')),'defaultValue':_0xa795('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa795('0x1')](_0xa795('0x4'),_0xa795('0x2'),_0xa795('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa795('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa795('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4ad0041..a2a4455 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 _0x35a1=['reject','save','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','findAll','then','catch','show','params','rawAttributes','length','include','find','SugarcrmField','create','body','update','destroy','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','apply'];(function(_0x4f66,_0x4c4a2e){var _0x4e3d42=function(_0xcbd4b0){while(--_0xcbd4b0){_0x4f66['push'](_0x4f66['shift']());}};_0x4e3d42(++_0x4c4a2e);}(_0x35a1,0x14e));var _0x135a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x35a1[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x135a('0x0'));var emlformat=require(_0x135a('0x1'));var rimraf=require(_0x135a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x135a('0x3'));var rp=require('request-promise');var moment=require(_0x135a('0x4'));var BPromise=require(_0x135a('0x5'));var Mustache=require(_0x135a('0x6'));var util=require(_0x135a('0x7'));var path=require(_0x135a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x135a('0x9'));var fs=require('fs');var _=require(_0x135a('0xa'));var squel=require('squel');var crypto=require(_0x135a('0xb'));var jsforce=require(_0x135a('0xc'));var deskjs=require(_0x135a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x135a('0xe'));var Papa=require(_0x135a('0xf'));var Redis=require(_0x135a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x135a('0x11'));var as=require(_0x135a('0x12'));var hardwareService=require(_0x135a('0x13'));var logger=require(_0x135a('0x14'))(_0x135a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x135a('0x16'))['db'];function respondWithStatusCode(_0x3d9133,_0x5adff4){_0x5adff4=_0x5adff4||0xcc;return function(_0x39a50a){if(_0x39a50a){return _0x3d9133[_0x135a('0x17')](_0x5adff4);}return _0x3d9133['status'](_0x5adff4)[_0x135a('0x18')]();};}function respondWithResult(_0x5f0667,_0x5e4d3f){_0x5e4d3f=_0x5e4d3f||0xc8;return function(_0x21d7ee){if(_0x21d7ee){return _0x5f0667[_0x135a('0x19')](_0x5e4d3f)[_0x135a('0x1a')](_0x21d7ee);}};}function respondWithFilteredResult(_0x37ef45,_0x3874ff){return function(_0x2e6a2b){if(_0x2e6a2b){var _0x3cf5be=_0x2e6a2b['count'],_0x1c19b8=_0x3874ff[_0x135a('0x1b')],_0x3a0613=_0x3874ff[_0x135a('0x1b')]+_0x3874ff[_0x135a('0x1c')],_0x2f3345;if(_0x3a0613>=_0x3cf5be){_0x3a0613=_0x3cf5be;_0x2f3345=0xc8;}else{_0x2f3345=0xce;}_0x37ef45[_0x135a('0x19')](_0x2f3345);return _0x37ef45['set'](_0x135a('0x1d'),_0x1c19b8+'-'+_0x3a0613+'/'+_0x3cf5be)[_0x135a('0x1a')](_0x2e6a2b);}return null;};}function patchUpdates(_0x30c421){return function(_0x851e37){try{jsonpatch[_0x135a('0x1e')](_0x851e37,_0x30c421,!![]);}catch(_0x44341f){return BPromise[_0x135a('0x1f')](_0x44341f);}return _0x851e37[_0x135a('0x20')]();};}function saveUpdates(_0x1c1d63,_0x3634be){return function(_0x16b811){if(_0x16b811){return _0x16b811['update'](_0x1c1d63)['then'](function(_0x109817){return _0x109817;});}return null;};}function removeEntity(_0x295759,_0x370de5){return function(_0x1d32d6){if(_0x1d32d6){return _0x1d32d6['destroy']()['then'](function(){_0x295759[_0x135a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8443,_0x10174f){return function(_0x2a4f61){if(!_0x2a4f61){_0x5d8443[_0x135a('0x17')](0x194);}return _0x2a4f61;};}function handleError(_0x4c28b6,_0x85d6e6){_0x85d6e6=_0x85d6e6||0x1f4;return function(_0x11f517){logger[_0x135a('0x21')](_0x11f517[_0x135a('0x22')]);if(_0x11f517[_0x135a('0x23')]){delete _0x11f517[_0x135a('0x23')];}_0x4c28b6[_0x135a('0x19')](_0x85d6e6)[_0x135a('0x24')](_0x11f517);};}exports[_0x135a('0x25')]=function(_0x4280c9,_0x25a7ff){var _0xf0b8f9={},_0x79bb6c={},_0x1cf198={'count':0x0,'rows':[]};var _0x110e9e=_[_0x135a('0x26')](db['SugarcrmField']['rawAttributes'],function(_0x29cc47){return{'name':_0x29cc47[_0x135a('0x27')],'type':_0x29cc47[_0x135a('0x28')][_0x135a('0x29')]};});_0x79bb6c[_0x135a('0x2a')]=_[_0x135a('0x26')](_0x110e9e,_0x135a('0x23'));_0x79bb6c['query']=_[_0x135a('0x2b')](_0x4280c9[_0x135a('0x2c')]);_0x79bb6c[_0x135a('0x2d')]=_[_0x135a('0x2e')](_0x79bb6c[_0x135a('0x2a')],_0x79bb6c['query']);_0xf0b8f9[_0x135a('0x2f')]=_[_0x135a('0x2e')](_0x79bb6c['model'],qs['fields'](_0x4280c9[_0x135a('0x2c')][_0x135a('0x30')]));_0xf0b8f9[_0x135a('0x2f')]=_0xf0b8f9[_0x135a('0x2f')]['length']?_0xf0b8f9['attributes']:_0x79bb6c[_0x135a('0x2a')];if(!_0x4280c9[_0x135a('0x2c')][_0x135a('0x31')](_0x135a('0x32'))){_0xf0b8f9[_0x135a('0x1c')]=qs[_0x135a('0x1c')](_0x4280c9[_0x135a('0x2c')][_0x135a('0x1c')]);_0xf0b8f9['offset']=qs[_0x135a('0x1b')](_0x4280c9[_0x135a('0x2c')][_0x135a('0x1b')]);}_0xf0b8f9[_0x135a('0x33')]=qs['sort'](_0x4280c9[_0x135a('0x2c')][_0x135a('0x34')]);_0xf0b8f9[_0x135a('0x35')]=qs[_0x135a('0x2d')](_['pick'](_0x4280c9[_0x135a('0x2c')],_0x79bb6c[_0x135a('0x2d')]),_0x110e9e);if(_0x4280c9[_0x135a('0x2c')][_0x135a('0x36')]){_0xf0b8f9[_0x135a('0x35')]=_[_0x135a('0x37')](_0xf0b8f9[_0x135a('0x35')],{'$or':_[_0x135a('0x26')](_0x110e9e,function(_0x5e1e93){if(_0x5e1e93['type']!=='VIRTUAL'){var _0x53e1bb={};_0x53e1bb[_0x5e1e93[_0x135a('0x23')]]={'$like':'%'+_0x4280c9[_0x135a('0x2c')]['filter']+'%'};return _0x53e1bb;}})});}_0xf0b8f9=_[_0x135a('0x37')]({},_0xf0b8f9,_0x4280c9[_0x135a('0x38')]);var _0x293e46={'where':_0xf0b8f9[_0x135a('0x35')]};return db['SugarcrmField'][_0x135a('0x39')](_0x293e46)['then'](function(_0x118a47){_0x1cf198[_0x135a('0x39')]=_0x118a47;if(_0x4280c9[_0x135a('0x2c')][_0x135a('0x3a')]){_0xf0b8f9['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x135a('0x3b')](_0xf0b8f9);})[_0x135a('0x3c')](function(_0x48b6fa){_0x1cf198['rows']=_0x48b6fa;return _0x1cf198;})[_0x135a('0x3c')](respondWithFilteredResult(_0x25a7ff,_0xf0b8f9))[_0x135a('0x3d')](handleError(_0x25a7ff,null));};exports[_0x135a('0x3e')]=function(_0x25c2ab,_0x390bf4){var _0x1d02d6={'raw':!![],'where':{'id':_0x25c2ab[_0x135a('0x3f')]['id']}},_0x51abcd={};_0x51abcd['model']=_['keys'](db['SugarcrmField'][_0x135a('0x40')]);_0x51abcd['query']=_[_0x135a('0x2b')](_0x25c2ab['query']);_0x51abcd[_0x135a('0x2d')]=_['intersection'](_0x51abcd['model'],_0x51abcd[_0x135a('0x2c')]);_0x1d02d6[_0x135a('0x2f')]=_[_0x135a('0x2e')](_0x51abcd['model'],qs[_0x135a('0x30')](_0x25c2ab['query'][_0x135a('0x30')]));_0x1d02d6[_0x135a('0x2f')]=_0x1d02d6[_0x135a('0x2f')][_0x135a('0x41')]?_0x1d02d6[_0x135a('0x2f')]:_0x51abcd['model'];if(_0x25c2ab[_0x135a('0x2c')][_0x135a('0x3a')]){_0x1d02d6[_0x135a('0x42')]=[{'all':!![]}];}_0x1d02d6=_[_0x135a('0x37')]({},_0x1d02d6,_0x25c2ab[_0x135a('0x38')]);return db['SugarcrmField'][_0x135a('0x43')](_0x1d02d6)[_0x135a('0x3c')](handleEntityNotFound(_0x390bf4,null))[_0x135a('0x3c')](respondWithResult(_0x390bf4,null))[_0x135a('0x3d')](handleError(_0x390bf4,null));};exports['create']=function(_0x202980,_0x37575f){return db[_0x135a('0x44')][_0x135a('0x45')](_0x202980[_0x135a('0x46')],{})['then'](respondWithResult(_0x37575f,0xc9))[_0x135a('0x3d')](handleError(_0x37575f,null));};exports[_0x135a('0x47')]=function(_0x4e00e9,_0x363da6){if(_0x4e00e9[_0x135a('0x46')]['id']){delete _0x4e00e9['body']['id'];}return db['SugarcrmField'][_0x135a('0x43')]({'where':{'id':_0x4e00e9['params']['id']}})['then'](handleEntityNotFound(_0x363da6,null))['then'](saveUpdates(_0x4e00e9[_0x135a('0x46')],null))[_0x135a('0x3c')](respondWithResult(_0x363da6,null))['catch'](handleError(_0x363da6,null));};exports[_0x135a('0x48')]=function(_0x2d3a3b,_0xc28943){return db[_0x135a('0x44')][_0x135a('0x43')]({'where':{'id':_0x2d3a3b[_0x135a('0x3f')]['id']}})[_0x135a('0x3c')](handleEntityNotFound(_0xc28943,null))['then'](removeEntity(_0xc28943,null))[_0x135a('0x3d')](handleError(_0xc28943,null));}; \ No newline at end of file +var _0x85a8=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SugarcrmField','count','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto'];(function(_0x93aa24,_0x2363ba){var _0x5252ad=function(_0x382c59){while(--_0x382c59){_0x93aa24['push'](_0x93aa24['shift']());}};_0x5252ad(++_0x2363ba);}(_0x85a8,0x168));var _0x885a=function(_0xf2dfe2,_0x54fde6){_0xf2dfe2=_0xf2dfe2-0x0;var _0x5cf2d5=_0x85a8[_0xf2dfe2];return _0x5cf2d5;};'use strict';var pdf=require(_0x885a('0x0'));var emlformat=require(_0x885a('0x1'));var rimraf=require(_0x885a('0x2'));var zipdir=require(_0x885a('0x3'));var jsonpatch=require(_0x885a('0x4'));var rp=require(_0x885a('0x5'));var moment=require(_0x885a('0x6'));var BPromise=require(_0x885a('0x7'));var Mustache=require(_0x885a('0x8'));var util=require(_0x885a('0x9'));var path=require(_0x885a('0xa'));var sox=require('sox');var csv=require(_0x885a('0xb'));var ejs=require(_0x885a('0xc'));var fs=require('fs');var _=require(_0x885a('0xd'));var squel=require('squel');var crypto=require(_0x885a('0xe'));var jsforce=require(_0x885a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x885a('0x10'));var Papa=require(_0x885a('0x11'));var Redis=require(_0x885a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x885a('0x13'));var as=require(_0x885a('0x14'));var hardwareService=require(_0x885a('0x15'));var logger=require(_0x885a('0x16'))(_0x885a('0x17'));var utils=require('../../config/utils');var config=require(_0x885a('0x18'));var db=require(_0x885a('0x19'))['db'];function respondWithStatusCode(_0x231f36,_0x2933c0){_0x2933c0=_0x2933c0||0xcc;return function(_0x37a8f3){if(_0x37a8f3){return _0x231f36[_0x885a('0x1a')](_0x2933c0);}return _0x231f36[_0x885a('0x1b')](_0x2933c0)[_0x885a('0x1c')]();};}function respondWithResult(_0x54d4db,_0x3d4a89){_0x3d4a89=_0x3d4a89||0xc8;return function(_0x29ac10){if(_0x29ac10){return _0x54d4db[_0x885a('0x1b')](_0x3d4a89)[_0x885a('0x1d')](_0x29ac10);}};}function respondWithFilteredResult(_0x4ee37a,_0x169440){return function(_0x488427){if(_0x488427){var _0x1a0450=_0x488427['count'],_0x4470bd=_0x169440[_0x885a('0x1e')],_0x5ce4c1=_0x169440[_0x885a('0x1e')]+_0x169440[_0x885a('0x1f')],_0x1768ee;if(_0x5ce4c1>=_0x1a0450){_0x5ce4c1=_0x1a0450;_0x1768ee=0xc8;}else{_0x1768ee=0xce;}_0x4ee37a['status'](_0x1768ee);return _0x4ee37a['set'](_0x885a('0x20'),_0x4470bd+'-'+_0x5ce4c1+'/'+_0x1a0450)['json'](_0x488427);}return null;};}function patchUpdates(_0x589e95){return function(_0x4aa9ae){try{jsonpatch[_0x885a('0x21')](_0x4aa9ae,_0x589e95,!![]);}catch(_0x223d58){return BPromise[_0x885a('0x22')](_0x223d58);}return _0x4aa9ae['save']();};}function saveUpdates(_0x1eda16,_0xa7f8cc){return function(_0x5c27e6){if(_0x5c27e6){return _0x5c27e6['update'](_0x1eda16)[_0x885a('0x23')](function(_0x4a10a4){return _0x4a10a4;});}return null;};}function removeEntity(_0x49d52a,_0x1cebe3){return function(_0x530acc){if(_0x530acc){return _0x530acc[_0x885a('0x24')]()[_0x885a('0x23')](function(){_0x49d52a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb239,_0x58c7c7){return function(_0x40deb7){if(!_0x40deb7){_0x5cb239[_0x885a('0x1a')](0x194);}return _0x40deb7;};}function handleError(_0x3ca2c1,_0x15938e){_0x15938e=_0x15938e||0x1f4;return function(_0x44e50e){logger[_0x885a('0x25')](_0x44e50e[_0x885a('0x26')]);if(_0x44e50e[_0x885a('0x27')]){delete _0x44e50e['name'];}_0x3ca2c1[_0x885a('0x1b')](_0x15938e)[_0x885a('0x28')](_0x44e50e);};}exports[_0x885a('0x29')]=function(_0x105959,_0x56abea){var _0x1e622e={},_0x1b5d84={},_0xb82929={'count':0x0,'rows':[]};var _0x1166c2=_[_0x885a('0x2a')](db['SugarcrmField'][_0x885a('0x2b')],function(_0x22943e){return{'name':_0x22943e[_0x885a('0x2c')],'type':_0x22943e[_0x885a('0x2d')]['key']};});_0x1b5d84[_0x885a('0x2e')]=_['map'](_0x1166c2,_0x885a('0x27'));_0x1b5d84[_0x885a('0x2f')]=_[_0x885a('0x30')](_0x105959[_0x885a('0x2f')]);_0x1b5d84[_0x885a('0x31')]=_[_0x885a('0x32')](_0x1b5d84[_0x885a('0x2e')],_0x1b5d84['query']);_0x1e622e[_0x885a('0x33')]=_[_0x885a('0x32')](_0x1b5d84[_0x885a('0x2e')],qs['fields'](_0x105959['query'][_0x885a('0x34')]));_0x1e622e[_0x885a('0x33')]=_0x1e622e[_0x885a('0x33')]['length']?_0x1e622e[_0x885a('0x33')]:_0x1b5d84['model'];if(!_0x105959['query']['hasOwnProperty'](_0x885a('0x35'))){_0x1e622e[_0x885a('0x1f')]=qs[_0x885a('0x1f')](_0x105959[_0x885a('0x2f')][_0x885a('0x1f')]);_0x1e622e[_0x885a('0x1e')]=qs['offset'](_0x105959[_0x885a('0x2f')][_0x885a('0x1e')]);}_0x1e622e[_0x885a('0x36')]=qs[_0x885a('0x37')](_0x105959['query'][_0x885a('0x37')]);_0x1e622e[_0x885a('0x38')]=qs[_0x885a('0x31')](_['pick'](_0x105959[_0x885a('0x2f')],_0x1b5d84[_0x885a('0x31')]),_0x1166c2);if(_0x105959[_0x885a('0x2f')][_0x885a('0x39')]){_0x1e622e[_0x885a('0x38')]=_['merge'](_0x1e622e[_0x885a('0x38')],{'$or':_['map'](_0x1166c2,function(_0x3ed2d9){if(_0x3ed2d9[_0x885a('0x2d')]!==_0x885a('0x3a')){var _0x244001={};_0x244001[_0x3ed2d9[_0x885a('0x27')]]={'$like':'%'+_0x105959[_0x885a('0x2f')][_0x885a('0x39')]+'%'};return _0x244001;}})});}_0x1e622e=_[_0x885a('0x3b')]({},_0x1e622e,_0x105959[_0x885a('0x3c')]);var _0x537ccb={'where':_0x1e622e[_0x885a('0x38')]};return db[_0x885a('0x3d')]['count'](_0x537ccb)[_0x885a('0x23')](function(_0x434da9){_0xb82929[_0x885a('0x3e')]=_0x434da9;if(_0x105959[_0x885a('0x2f')][_0x885a('0x3f')]){_0x1e622e[_0x885a('0x40')]=[{'all':!![]}];}return db[_0x885a('0x3d')][_0x885a('0x41')](_0x1e622e);})[_0x885a('0x23')](function(_0x5126c5){_0xb82929[_0x885a('0x42')]=_0x5126c5;return _0xb82929;})[_0x885a('0x23')](respondWithFilteredResult(_0x56abea,_0x1e622e))['catch'](handleError(_0x56abea,null));};exports[_0x885a('0x43')]=function(_0x47b20b,_0x3d9ea9){var _0x4f5c4f={'raw':!![],'where':{'id':_0x47b20b[_0x885a('0x44')]['id']}},_0x581264={};_0x581264[_0x885a('0x2e')]=_[_0x885a('0x30')](db['SugarcrmField'][_0x885a('0x2b')]);_0x581264[_0x885a('0x2f')]=_[_0x885a('0x30')](_0x47b20b[_0x885a('0x2f')]);_0x581264['filters']=_['intersection'](_0x581264[_0x885a('0x2e')],_0x581264[_0x885a('0x2f')]);_0x4f5c4f[_0x885a('0x33')]=_[_0x885a('0x32')](_0x581264[_0x885a('0x2e')],qs['fields'](_0x47b20b[_0x885a('0x2f')][_0x885a('0x34')]));_0x4f5c4f[_0x885a('0x33')]=_0x4f5c4f['attributes'][_0x885a('0x45')]?_0x4f5c4f[_0x885a('0x33')]:_0x581264[_0x885a('0x2e')];if(_0x47b20b['query']['includeAll']){_0x4f5c4f[_0x885a('0x40')]=[{'all':!![]}];}_0x4f5c4f=_[_0x885a('0x3b')]({},_0x4f5c4f,_0x47b20b[_0x885a('0x3c')]);return db[_0x885a('0x3d')][_0x885a('0x46')](_0x4f5c4f)[_0x885a('0x23')](handleEntityNotFound(_0x3d9ea9,null))[_0x885a('0x23')](respondWithResult(_0x3d9ea9,null))[_0x885a('0x47')](handleError(_0x3d9ea9,null));};exports[_0x885a('0x48')]=function(_0x383de1,_0x2d2e46){return db[_0x885a('0x3d')][_0x885a('0x48')](_0x383de1['body'],{})[_0x885a('0x23')](respondWithResult(_0x2d2e46,0xc9))['catch'](handleError(_0x2d2e46,null));};exports[_0x885a('0x49')]=function(_0x199f6e,_0x22c992){if(_0x199f6e[_0x885a('0x4a')]['id']){delete _0x199f6e['body']['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x199f6e[_0x885a('0x44')]['id']}})[_0x885a('0x23')](handleEntityNotFound(_0x22c992,null))['then'](saveUpdates(_0x199f6e['body'],null))[_0x885a('0x23')](respondWithResult(_0x22c992,null))[_0x885a('0x47')](handleError(_0x22c992,null));};exports[_0x885a('0x24')]=function(_0x5c934e,_0x4ef752){return db['SugarcrmField'][_0x885a('0x46')]({'where':{'id':_0x5c934e[_0x885a('0x44')]['id']}})[_0x885a('0x23')](handleEntityNotFound(_0x4ef752,null))[_0x885a('0x23')](removeEntity(_0x4ef752,null))[_0x885a('0x47')](handleError(_0x4ef752,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a7d2154..6c332ae 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 _0xa842=['../../config/logger','moment','bluebird','path','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','FieldId','lodash','util'];(function(_0x5c6951,_0x507abb){var _0x5ee145=function(_0x4f8b75){while(--_0x4f8b75){_0x5c6951['push'](_0x5c6951['shift']());}};_0x5ee145(++_0x507abb);}(_0xa842,0xd6));var _0x2a84=function(_0x422ca5,_0x1324d9){_0x422ca5=_0x422ca5-0x0;var _0x216f45=_0xa842[_0x422ca5];return _0x216f45;};'use strict';var _=require(_0x2a84('0x0'));var util=require(_0x2a84('0x1'));var logger=require(_0x2a84('0x2'))('api');var moment=require(_0x2a84('0x3'));var BPromise=require(_0x2a84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a84('0x5'));var rimraf=require('rimraf');var config=require(_0x2a84('0x6'));var attributes=require(_0x2a84('0x7'));module[_0x2a84('0x8')]=function(_0xe1cdb,_0x5f27b2){return _0xe1cdb['define'](_0x2a84('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x2a84('0xa'),'fields':['idField',_0x2a84('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09fe=['./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','FieldId','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xf1c26a,_0x1ca014){var _0x4be4a8=function(_0x58e7a2){while(--_0x58e7a2){_0xf1c26a['push'](_0xf1c26a['shift']());}};_0x4be4a8(++_0x1ca014);}(_0x09fe,0x10e));var _0xe09f=function(_0x48132f,_0x35c1ce){_0x48132f=_0x48132f-0x0;var _0x1d3c28=_0x09fe[_0x48132f];return _0x1d3c28;};'use strict';var _=require('lodash');var util=require(_0xe09f('0x0'));var logger=require(_0xe09f('0x1'))(_0xe09f('0x2'));var moment=require('moment');var BPromise=require(_0xe09f('0x3'));var rp=require(_0xe09f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe09f('0x5'));var config=require('../../config/environment');var attributes=require(_0xe09f('0x6'));module[_0xe09f('0x7')]=function(_0x5ab7ae,_0x5beb97){return _0x5ab7ae[_0xe09f('0x8')](_0xe09f('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xe09f('0xa'),'fields':['idField',_0xe09f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index e46328e..3c982a1 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(_0x17bb21,_0x369098){var _0x2956a6=function(_0x3e5ecf){while(--_0x3e5ecf){_0x17bb21['push'](_0x17bb21['shift']());}};_0x2956a6(++_0x369098);}(_0x14a0,0x8e));var _0x014a=function(_0x18265c,_0xfae450){_0x18265c=_0x18265c-0x0;var _0xf60565=_0x14a0[_0x18265c];return _0xf60565;};'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 _0x9ffd=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x316b7b,_0x5ba87e){var _0xcedfe1=function(_0x1c184e){while(--_0x1c184e){_0x316b7b['push'](_0x316b7b['shift']());}};_0xcedfe1(++_0x5ba87e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2910d7,_0x258e63){_0x2910d7=_0x2910d7-0x0;var _0x22d9b9=_0x9ffd[_0x2910d7];return _0x22d9b9;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SugarcrmField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ec934de..08c2699 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 _0xdc12=['path','connect-timeout','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','put','update','delete','destroy','exports'];(function(_0x2feb80,_0x2908ce){var _0x2279bf=function(_0x38f306){while(--_0x38f306){_0x2feb80['push'](_0x2feb80['shift']());}};_0x2279bf(++_0x2908ce);}(_0xdc12,0x156));var _0x2dc1=function(_0x512739,_0x19bf89){_0x512739=_0x512739-0x0;var _0x56ab67=_0xdc12[_0x512739];return _0x56ab67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2dc1('0x0'));var timeout=require(_0x2dc1('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x2dc1('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2dc1('0x3'));var controller=require(_0x2dc1('0x4'));router['get']('/',auth[_0x2dc1('0x5')](),controller['index']);router['get'](_0x2dc1('0x6'),auth['isAuthenticated'](),controller[_0x2dc1('0x7')]);router[_0x2dc1('0x8')](_0x2dc1('0x9'),auth['isAuthenticated'](),controller[_0x2dc1('0xa')]);router[_0x2dc1('0x8')](_0x2dc1('0xb'),auth[_0x2dc1('0x5')](),controller[_0x2dc1('0xc')]);router['post']('/',auth[_0x2dc1('0x5')](),controller[_0x2dc1('0xd')]);router['post'](_0x2dc1('0x9'),auth[_0x2dc1('0x5')](),controller['addConfiguration']);router[_0x2dc1('0xe')](_0x2dc1('0x6'),auth['isAuthenticated'](),controller[_0x2dc1('0xf')]);router[_0x2dc1('0x10')](_0x2dc1('0x6'),auth[_0x2dc1('0x5')](),controller[_0x2dc1('0x11')]);module[_0x2dc1('0x12')]=router; \ No newline at end of file +var _0xd4a1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','multer','util','path'];(function(_0x415912,_0x133e44){var _0x31c3ec=function(_0x55cdcb){while(--_0x55cdcb){_0x415912['push'](_0x415912['shift']());}};_0x31c3ec(++_0x133e44);}(_0xd4a1,0x105));var _0x1d4a=function(_0x19b9cb,_0x32c322){_0x19b9cb=_0x19b9cb-0x0;var _0x1a33c7=_0xd4a1[_0x19b9cb];return _0x1a33c7;};'use strict';var multer=require(_0x1d4a('0x0'));var util=require(_0x1d4a('0x1'));var path=require(_0x1d4a('0x2'));var timeout=require(_0x1d4a('0x3'));var express=require(_0x1d4a('0x4'));var router=express[_0x1d4a('0x5')]();var auth=require(_0x1d4a('0x6'));var interaction=require(_0x1d4a('0x7'));var config=require('../../config/environment');var controller=require(_0x1d4a('0x8'));router[_0x1d4a('0x9')]('/',auth[_0x1d4a('0xa')](),controller['index']);router['get'](_0x1d4a('0xb'),auth[_0x1d4a('0xa')](),controller[_0x1d4a('0xc')]);router['get']('/:id/configurations',auth[_0x1d4a('0xa')](),controller[_0x1d4a('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x1d4a('0xe')]);router[_0x1d4a('0xf')]('/',auth['isAuthenticated'](),controller[_0x1d4a('0x10')]);router[_0x1d4a('0xf')](_0x1d4a('0x11'),auth[_0x1d4a('0xa')](),controller[_0x1d4a('0x12')]);router[_0x1d4a('0x13')](_0x1d4a('0xb'),auth[_0x1d4a('0xa')](),controller['update']);router['delete']('/:id',auth[_0x1d4a('0xa')](),controller[_0x1d4a('0x14')]);module[_0x1d4a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c5971d7..a5edb38 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 _0xc876=['STRING','HelpDesk'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0xc876,0x9e));var _0x6c87=function(_0x845eea,_0x5b60dd){_0x845eea=_0x845eea-0x0;var _0x3d07dc=_0xc876[_0x845eea];return _0x3d07dc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6c87('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6c87('0x0')],'allowNull':![],'defaultValue':_0x6c87('0x1')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6c87('0x0')]},'accessKey':{'type':Sequelize[_0x6c87('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x1f6a=['STRING','HelpDesk','sequelize'];(function(_0x616d44,_0x4ba865){var _0x4b2644=function(_0x1b193c){while(--_0x1b193c){_0x616d44['push'](_0x616d44['shift']());}};_0x4b2644(++_0x4ba865);}(_0x1f6a,0xd7));var _0xa1f6=function(_0x16f6e4,_0x288b61){_0x16f6e4=_0x16f6e4-0x0;var _0x275354=_0x1f6a[_0x16f6e4];return _0x275354;};'use strict';var Sequelize=require(_0xa1f6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa1f6('0x1')]},'username':{'type':Sequelize[_0xa1f6('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa1f6('0x1')],'allowNull':![],'defaultValue':_0xa1f6('0x2')},'remoteUri':{'type':Sequelize[_0xa1f6('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa1f6('0x1')]},'accessKey':{'type':Sequelize[_0xa1f6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6af3d51..7e2f5cb 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 _0xdd0e=['addConfiguration','AccountId','Subjects','Descriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','substring','lastIndexOf','format','getchallenge','success','POST','login','token','sessionName','autogenerated','reference','includes','startsWith','picklist','picklistValues','label','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','request','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','set','Content-Range','apply','destroy','then','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','offset','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','keys','fields','includeAll','options','create','body','find','params','getConfigurations','findOne','VtigerConfiguration','pick','nolimit'];(function(_0x440bc8,_0x3d1650){var _0x22883b=function(_0x134319){while(--_0x134319){_0x440bc8['push'](_0x440bc8['shift']());}};_0x22883b(++_0x3d1650);}(_0xdd0e,0x113));var _0xedd0=function(_0x1d94ba,_0x204592){_0x1d94ba=_0x1d94ba-0x0;var _0x17fb76=_0xdd0e[_0x1d94ba];return _0x17fb76;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xedd0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xedd0('0x1'));var Mustache=require('mustache');var util=require(_0xedd0('0x2'));var path=require(_0xedd0('0x3'));var sox=require(_0xedd0('0x4'));var csv=require(_0xedd0('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xedd0('0x6'));var squel=require(_0xedd0('0x7'));var crypto=require(_0xedd0('0x8'));var jsforce=require(_0xedd0('0x9'));var deskjs=require(_0xedd0('0xa'));var toCsv=require(_0xedd0('0x5'));var querystring=require(_0xedd0('0xb'));var Papa=require(_0xedd0('0xc'));var Redis=require(_0xedd0('0xd'));var authService=require(_0xedd0('0xe'));var qs=require(_0xedd0('0xf'));var as=require(_0xedd0('0x10'));var hardwareService=require(_0xedd0('0x11'));var logger=require('../../config/logger')(_0xedd0('0x12'));var utils=require(_0xedd0('0x13'));var config=require(_0xedd0('0x14'));var db=require(_0xedd0('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xedd0('0x16'));var client=jayson[_0xedd0('0x17')][_0xedd0('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5ba56c,_0x3f354b,_0x1d8280){if(_0x1d8280){var _0x396e8f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x396e8f['test'](_0x3f354b)){return _0x5ba56c;}else{throw new db[(_0xedd0('0x19'))][(_0xedd0('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5ba56c;}}function respondWithRpcPromise(_0x437a19,_0x128480,_0x43df90,_0xf599d9){return new BPromise(function(_0x45dbfb,_0x5b57ce){var _0x442e01=_0xf599d9||client;return _0x442e01[_0xedd0('0x1b')](_0x437a19,_0x43df90)['then'](function(_0x1a8a64){logger[_0xedd0('0x1c')]('VtigerAccount,\x20%s,\x20%s',_0x128480,'request\x20sent');logger[_0xedd0('0x1d')](_0xedd0('0x1e'),_0x128480,_0xedd0('0x1f'),JSON[_0xedd0('0x20')](_0x1a8a64));if(_0x1a8a64['error']){if(_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x22')]===0x1f4){logger['error'](_0xedd0('0x23'),_0x128480,_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x24')]);return _0x5b57ce(_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x24')]);}logger[_0xedd0('0x21')](_0xedd0('0x23'),_0x128480,_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x24')]);return _0x45dbfb(_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x24')]);}else{logger[_0xedd0('0x1c')](_0xedd0('0x23'),_0x128480,'request\x20sent');_0x45dbfb(_0x1a8a64[_0xedd0('0x25')][_0xedd0('0x24')]);}})['catch'](function(_0x574cde){logger[_0xedd0('0x21')](_0xedd0('0x23'),_0x128480,_0x574cde);_0x5b57ce(_0x574cde);});});}function respondWithStatusCode(_0x4e5549,_0x4ec837){_0x4ec837=_0x4ec837||0xcc;return function(_0x1fe25c){if(_0x1fe25c){return _0x4e5549[_0xedd0('0x26')](_0x4ec837);}return _0x4e5549['status'](_0x4ec837)[_0xedd0('0x27')]();};}function respondWithResult(_0x308ed2,_0x18ecfb){_0x18ecfb=_0x18ecfb||0xc8;return function(_0x1e78a9){if(_0x1e78a9){return _0x308ed2[_0xedd0('0x28')](_0x18ecfb)[_0xedd0('0x29')](_0x1e78a9);}};}function respondWithFilteredResult(_0x6427e3,_0x839505){return function(_0x5a2156){if(_0x5a2156){var _0x58e110=_0x5a2156[_0xedd0('0x2a')],_0x5b6a71=_0x839505['offset'],_0x3377cd=_0x839505['offset']+_0x839505['limit'],_0x21ea15;if(_0x3377cd>=_0x58e110){_0x3377cd=_0x58e110;_0x21ea15=0xc8;}else{_0x21ea15=0xce;}_0x6427e3[_0xedd0('0x28')](_0x21ea15);return _0x6427e3[_0xedd0('0x2b')](_0xedd0('0x2c'),_0x5b6a71+'-'+_0x3377cd+'/'+_0x58e110)[_0xedd0('0x29')](_0x5a2156);}return null;};}function patchUpdates(_0x2d0114){return function(_0x33369f){try{jsonpatch[_0xedd0('0x2d')](_0x33369f,_0x2d0114,!![]);}catch(_0x5aa6c4){return BPromise['reject'](_0x5aa6c4);}return _0x33369f['save']();};}function saveUpdates(_0xa33973,_0x4a9fcb){return function(_0x34c714){if(_0x34c714){return _0x34c714['update'](_0xa33973)['then'](function(_0x254b20){return _0x254b20;});}return null;};}function removeEntity(_0x3dce30,_0x46ada4){return function(_0x17bcdc){if(_0x17bcdc){return _0x17bcdc[_0xedd0('0x2e')]()[_0xedd0('0x2f')](function(){_0x3dce30[_0xedd0('0x28')](0xcc)[_0xedd0('0x27')]();});}};}function handleEntityNotFound(_0x4bb658,_0x193e37){return function(_0x35feb6){if(!_0x35feb6){_0x4bb658[_0xedd0('0x26')](0x194);}return _0x35feb6;};}function handleError(_0x2861f2,_0x37667f){_0x37667f=_0x37667f||0x1f4;return function(_0x376c1b){logger[_0xedd0('0x21')](_0x376c1b['stack']);if(_0x376c1b[_0xedd0('0x30')]){delete _0x376c1b['name'];}_0x2861f2['status'](_0x37667f)[_0xedd0('0x31')](_0x376c1b);};}exports[_0xedd0('0x32')]=function(_0x30b8f3,_0x2f4ea4){var _0x5578ad={},_0x907291={},_0x59a205={'count':0x0,'rows':[]};var _0x18bd9c=_[_0xedd0('0x33')](db[_0xedd0('0x34')][_0xedd0('0x35')],function(_0x23aa82){return{'name':_0x23aa82[_0xedd0('0x36')],'type':_0x23aa82[_0xedd0('0x37')]['key']};});_0x907291[_0xedd0('0x38')]=_[_0xedd0('0x33')](_0x18bd9c,_0xedd0('0x30'));_0x907291[_0xedd0('0x39')]=_['keys'](_0x30b8f3['query']);_0x907291[_0xedd0('0x3a')]=_[_0xedd0('0x3b')](_0x907291[_0xedd0('0x38')],_0x907291[_0xedd0('0x39')]);_0x5578ad[_0xedd0('0x3c')]=_['intersection'](_0x907291[_0xedd0('0x38')],qs['fields'](_0x30b8f3['query']['fields']));_0x5578ad[_0xedd0('0x3c')]=_0x5578ad[_0xedd0('0x3c')][_0xedd0('0x3d')]?_0x5578ad[_0xedd0('0x3c')]:_0x907291['model'];if(!_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x3e')]('nolimit')){_0x5578ad[_0xedd0('0x3f')]=qs[_0xedd0('0x3f')](_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x3f')]);_0x5578ad[_0xedd0('0x40')]=qs['offset'](_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x40')]);}_0x5578ad[_0xedd0('0x41')]=qs['sort'](_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x42')]);_0x5578ad[_0xedd0('0x43')]=qs['filters'](_['pick'](_0x30b8f3['query'],_0x907291[_0xedd0('0x3a')]),_0x18bd9c);if(_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x44')]){_0x5578ad['where']=_[_0xedd0('0x45')](_0x5578ad[_0xedd0('0x43')],{'$or':_[_0xedd0('0x33')](_0x18bd9c,function(_0xff1c68){if(_0xff1c68['type']!==_0xedd0('0x46')){var _0x53f9cb={};_0x53f9cb[_0xff1c68[_0xedd0('0x30')]]={'$like':'%'+_0x30b8f3['query'][_0xedd0('0x44')]+'%'};return _0x53f9cb;}})});}_0x5578ad=_[_0xedd0('0x45')]({},_0x5578ad,_0x30b8f3['options']);var _0x344dab={'where':_0x5578ad[_0xedd0('0x43')]};return db['VtigerAccount']['count'](_0x344dab)['then'](function(_0x200bb5){_0x59a205[_0xedd0('0x2a')]=_0x200bb5;if(_0x30b8f3[_0xedd0('0x39')]['includeAll']){_0x5578ad[_0xedd0('0x47')]=[{'all':!![]}];}return db[_0xedd0('0x34')]['findAll'](_0x5578ad);})[_0xedd0('0x2f')](function(_0x54d440){_0x59a205[_0xedd0('0x48')]=_0x54d440;return _0x59a205;})[_0xedd0('0x2f')](respondWithFilteredResult(_0x2f4ea4,_0x5578ad))[_0xedd0('0x49')](handleError(_0x2f4ea4,null));};exports[_0xedd0('0x4a')]=function(_0x3c63b7,_0xe85b8c){var _0x5270c6={'raw':![],'where':{'id':_0x3c63b7['params']['id']}},_0xdc9014={};_0xdc9014[_0xedd0('0x38')]=_[_0xedd0('0x4b')](db['VtigerAccount'][_0xedd0('0x35')]);_0xdc9014[_0xedd0('0x39')]=_[_0xedd0('0x4b')](_0x3c63b7[_0xedd0('0x39')]);_0xdc9014[_0xedd0('0x3a')]=_[_0xedd0('0x3b')](_0xdc9014[_0xedd0('0x38')],_0xdc9014[_0xedd0('0x39')]);_0x5270c6['attributes']=_[_0xedd0('0x3b')](_0xdc9014[_0xedd0('0x38')],qs[_0xedd0('0x4c')](_0x3c63b7[_0xedd0('0x39')][_0xedd0('0x4c')]));_0x5270c6['attributes']=_0x5270c6[_0xedd0('0x3c')][_0xedd0('0x3d')]?_0x5270c6[_0xedd0('0x3c')]:_0xdc9014[_0xedd0('0x38')];if(_0x3c63b7[_0xedd0('0x39')][_0xedd0('0x4d')]){_0x5270c6['include']=[{'all':!![]}];}_0x5270c6=_[_0xedd0('0x45')]({},_0x5270c6,_0x3c63b7[_0xedd0('0x4e')]);return db[_0xedd0('0x34')]['find'](_0x5270c6)[_0xedd0('0x2f')](handleEntityNotFound(_0xe85b8c,null))['then'](respondWithResult(_0xe85b8c,null))[_0xedd0('0x49')](handleError(_0xe85b8c,null));};exports['create']=function(_0x845132,_0x46a4c6){return db['VtigerAccount'][_0xedd0('0x4f')](_0x845132[_0xedd0('0x50')],{})[_0xedd0('0x2f')](respondWithResult(_0x46a4c6,0xc9))[_0xedd0('0x49')](handleError(_0x46a4c6,null));};exports['update']=function(_0x401319,_0x3ca742){if(_0x401319[_0xedd0('0x50')]['id']){delete _0x401319[_0xedd0('0x50')]['id'];}return db[_0xedd0('0x34')][_0xedd0('0x51')]({'where':{'id':_0x401319['params']['id']}})['then'](handleEntityNotFound(_0x3ca742,null))[_0xedd0('0x2f')](saveUpdates(_0x401319[_0xedd0('0x50')],null))[_0xedd0('0x2f')](respondWithResult(_0x3ca742,null))[_0xedd0('0x49')](handleError(_0x3ca742,null));};exports[_0xedd0('0x2e')]=function(_0x5239ed,_0x2b00ec){return db['VtigerAccount'][_0xedd0('0x51')]({'where':{'id':_0x5239ed[_0xedd0('0x52')]['id']}})[_0xedd0('0x2f')](handleEntityNotFound(_0x2b00ec,null))['then'](removeEntity(_0x2b00ec,null))[_0xedd0('0x49')](handleError(_0x2b00ec,null));};exports[_0xedd0('0x53')]=function(_0x16f7b3,_0x466168,_0x543019){var _0x36b491={};var _0x224b79={};var _0x387a7c;var _0x5792e5;return db['VtigerAccount'][_0xedd0('0x54')]({'where':{'id':_0x16f7b3['params']['id']}})[_0xedd0('0x2f')](handleEntityNotFound(_0x466168,null))[_0xedd0('0x2f')](function(_0x3de56c){if(_0x3de56c){_0x387a7c=_0x3de56c;_0x224b79[_0xedd0('0x38')]=_[_0xedd0('0x4b')](db[_0xedd0('0x55')]['rawAttributes']);_0x224b79[_0xedd0('0x39')]=_['keys'](_0x16f7b3['query']);_0x224b79[_0xedd0('0x3a')]=_[_0xedd0('0x3b')](_0x224b79[_0xedd0('0x38')],_0x224b79[_0xedd0('0x39')]);_0x36b491['attributes']=_[_0xedd0('0x3b')](_0x224b79[_0xedd0('0x38')],qs[_0xedd0('0x4c')](_0x16f7b3['query'][_0xedd0('0x4c')]));_0x36b491[_0xedd0('0x3c')]=_0x36b491['attributes']['length']?_0x36b491[_0xedd0('0x3c')]:_0x224b79['model'];_0x36b491[_0xedd0('0x41')]=qs['sort'](_0x16f7b3[_0xedd0('0x39')]['sort']);_0x36b491['where']=qs[_0xedd0('0x3a')](_[_0xedd0('0x56')](_0x16f7b3[_0xedd0('0x39')],_0x224b79[_0xedd0('0x3a')]));if(_0x16f7b3[_0xedd0('0x39')][_0xedd0('0x44')]){_0x36b491['where']=_[_0xedd0('0x45')](_0x36b491[_0xedd0('0x43')],{'$or':_[_0xedd0('0x33')](_0x36b491[_0xedd0('0x3c')],function(_0x107bf4){var _0x340fa8={};_0x340fa8[_0x107bf4]={'$like':'%'+_0x16f7b3['query']['filter']+'%'};return _0x340fa8;})});}_0x36b491=_[_0xedd0('0x45')]({},_0x36b491,_0x16f7b3[_0xedd0('0x4e')]);return _0x387a7c[_0xedd0('0x53')](_0x36b491);}})[_0xedd0('0x2f')](function(_0x49b7fa){if(_0x49b7fa){_0x5792e5=_0x49b7fa[_0xedd0('0x3d')];if(!_0x16f7b3[_0xedd0('0x39')][_0xedd0('0x3e')](_0xedd0('0x57'))){_0x36b491['limit']=qs['limit'](_0x16f7b3[_0xedd0('0x39')][_0xedd0('0x3f')]);_0x36b491[_0xedd0('0x40')]=qs['offset'](_0x16f7b3['query'][_0xedd0('0x40')]);}return _0x387a7c[_0xedd0('0x53')](_0x36b491);}})['then'](function(_0x54ecd2){if(_0x54ecd2){return _0x54ecd2?{'count':_0x5792e5,'rows':_0x54ecd2}:null;}})[_0xedd0('0x2f')](respondWithResult(_0x466168,null))['catch'](handleError(_0x466168,null));};exports[_0xedd0('0x58')]=function(_0x2dd45e,_0x29ad5d,_0x575da5){if(_0x2dd45e[_0xedd0('0x50')]['id']){delete _0x2dd45e[_0xedd0('0x50')]['id'];}return db[_0xedd0('0x34')][_0xedd0('0x54')]({'where':{'id':_0x2dd45e['params']['id']}})[_0xedd0('0x2f')](handleEntityNotFound(_0x29ad5d,null))[_0xedd0('0x2f')](function(_0x36d02a){if(_0x36d02a){_0x2dd45e['body'][_0xedd0('0x59')]=_0x36d02a['id'];_0x2dd45e['body'][_0xedd0('0x5a')]=integrations['getSubjects'](_0x2dd45e['body']['channel'],_0x2dd45e[_0xedd0('0x50')][_0xedd0('0x37')]);_0x2dd45e[_0xedd0('0x50')][_0xedd0('0x5b')]=integrations['getDescriptions'](_0x2dd45e[_0xedd0('0x50')]['channel'],_0x2dd45e[_0xedd0('0x50')][_0xedd0('0x37')]);return db['VtigerConfiguration'][_0xedd0('0x4f')](_0x2dd45e[_0xedd0('0x50')],{'include':[{'model':db['VtigerField'],'as':_0xedd0('0x5a')},{'model':db[_0xedd0('0x5c')],'as':'Descriptions'}]});}return null;})[_0xedd0('0x2f')](respondWithResult(_0x29ad5d,null))[_0xedd0('0x49')](handleError(_0x29ad5d,null));};var md5=require(_0xedd0('0x5d'));exports[_0xedd0('0x5e')]=function(_0x4ed40a,_0x30a234,_0x32710d){var _0x129211=null;var _0x1cb808=null;var _0x3a2de1=null;var _0xa76bd=null;var _0x94ede='';return db[_0xedd0('0x34')][_0xedd0('0x54')]({'where':{'id':_0x4ed40a[_0xedd0('0x52')]['id']},'attributes':['id',_0xedd0('0x30'),_0xedd0('0x5f'),'description',_0xedd0('0x60'),_0xedd0('0x61'),_0xedd0('0x62'),'accessKey']})[_0xedd0('0x2f')](handleEntityNotFound(_0x30a234,null))['then'](function(_0x5b52d6){if(_0x5b52d6){_0x129211=_0x5b52d6[_0xedd0('0x5f')];_0x1cb808=_0x5b52d6['accessKey'];_0x3a2de1=_0x5b52d6[_0xedd0('0x60')];_0x94ede=_0x5b52d6[_0xedd0('0x61')];var _0x1cc5a6=_0x94ede['slice'](-0x1);if(_0x1cc5a6==='/'){_0x94ede=_0x94ede[_0xedd0('0x63')](0x0,_0x94ede[_0xedd0('0x64')](_0x1cc5a6));}_0xa76bd=util[_0xedd0('0x65')]('%s/webservice.php',_0x94ede);var _0x37d5a0={'method':'GET','uri':_0xa76bd,'qs':{'operation':_0xedd0('0x66'),'username':_0x5b52d6[_0xedd0('0x5f')]},'json':!![]};return rp(_0x37d5a0);}})[_0xedd0('0x2f')](function(_0x5d357c){if(_0x5d357c[_0xedd0('0x67')]){var _0x3db722={'method':_0xedd0('0x68'),'uri':_0xa76bd,'form':{'operation':_0xedd0('0x69'),'username':_0x129211,'accessKey':md5(_0x5d357c[_0xedd0('0x25')][_0xedd0('0x6a')]+_0x1cb808)},'json':!![]};return rp(_0x3db722);}})[_0xedd0('0x2f')](function(_0x4a7b32){if(_0x4a7b32[_0xedd0('0x67')]){var _0x2c6c3f={'method':'GET','uri':_0xa76bd,'qs':{'operation':'describe','username':_0x129211,'sessionName':_0x4a7b32['result'][_0xedd0('0x6b')],'elementType':_0x3a2de1},'json':!![]};return rp(_0x2c6c3f);}})[_0xedd0('0x2f')](function(_0x1a22ba){if(_0x1a22ba[_0xedd0('0x67')]){var _0x28dae3=[_0xedd0('0x6c'),_0xedd0('0x6d'),'owner'];_['remove'](_0x1a22ba[_0xedd0('0x25')][_0xedd0('0x4c')],function(_0xbd6c82){return _0x28dae3[_0xedd0('0x6e')](_0xbd6c82['type'][_0xedd0('0x30')]);});_['remove'](_0x1a22ba[_0xedd0('0x25')][_0xedd0('0x4c')],function(_0x4cf96e){return _0x4cf96e['editable']==='false';});return{'count':_0x1a22ba[_0xedd0('0x25')][_0xedd0('0x4c')][_0xedd0('0x3d')],'rows':_[_0xedd0('0x33')](_0x1a22ba[_0xedd0('0x25')]['fields'],function(_0xf8d6ae){return{'id':_0xf8d6ae[_0xedd0('0x30')],'name':_0xf8d6ae['label'],'custom':_[_0xedd0('0x6f')](_0xf8d6ae[_0xedd0('0x30')],'cf_')?!![]:![],'options':_0xf8d6ae[_0xedd0('0x37')][_0xedd0('0x30')]===_0xedd0('0x70')&&_0xf8d6ae[_0xedd0('0x37')][_0xedd0('0x71')][_0xedd0('0x3d')]>0x0?_[_0xedd0('0x33')](_0xf8d6ae['type'][_0xedd0('0x71')],function(_0x7aa6e4){return{'name':_0x7aa6e4[_0xedd0('0x72')],'value':_0x7aa6e4[_0xedd0('0x73')]};}):[]};})};}})[_0xedd0('0x2f')](respondWithResult(_0x30a234,null))[_0xedd0('0x49')](function(_0x274661){console[_0xedd0('0x74')]('vTiger\x20error:\x20'+_0x274661);var _0x40526e=_0x4ed40a[_0xedd0('0x39')]['test']?0x1f4:_0x274661[_0xedd0('0x75')]||0x1f4;logger[_0xedd0('0x21')](_0xedd0('0x76'),_0xedd0('0x5e'),_0x40526e,JSON[_0xedd0('0x20')](_0x274661));delete _0x274661[_0xedd0('0x30')];if(_0x40526e===0x191){_0x40526e=0x190;}_0x30a234[_0xedd0('0x28')](_0x40526e)[_0xedd0('0x31')](_0x4ed40a[_0xedd0('0x39')][_0xedd0('0x77')]?{'message':_0xedd0('0x78'),'statusCode':_0x274661[_0xedd0('0x75')]}:_0x274661);});}; \ No newline at end of file +var _0xa0e0=['picklistValues','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','end','sendStatus','stack','name','index','map','VtigerAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri','serverUrl','slice','format','GET','getchallenge','POST','login','token','describe','sessionName','success','reference','owner','remove','includes','editable','false','label'];(function(_0x309e21,_0x4f920a){var _0x12306f=function(_0x2c789c){while(--_0x2c789c){_0x309e21['push'](_0x309e21['shift']());}};_0x12306f(++_0x4f920a);}(_0xa0e0,0x103));var _0x0a0e=function(_0x41596c,_0x18b32d){_0x41596c=_0x41596c-0x0;var _0x159c3f=_0xa0e0[_0x41596c];return _0x159c3f;};'use strict';var pdf=require(_0x0a0e('0x0'));var emlformat=require(_0x0a0e('0x1'));var rimraf=require(_0x0a0e('0x2'));var zipdir=require(_0x0a0e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a0e('0x4'));var moment=require(_0x0a0e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0a0e('0x6'));var util=require(_0x0a0e('0x7'));var path=require(_0x0a0e('0x8'));var sox=require(_0x0a0e('0x9'));var csv=require('to-csv');var ejs=require(_0x0a0e('0xa'));var fs=require('fs');var _=require(_0x0a0e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a0e('0xc'));var toCsv=require(_0x0a0e('0xd'));var querystring=require(_0x0a0e('0xe'));var Papa=require(_0x0a0e('0xf'));var Redis=require(_0x0a0e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0a0e('0x11'));var as=require(_0x0a0e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a0e('0x13'))(_0x0a0e('0x14'));var utils=require(_0x0a0e('0x15'));var config=require('../../config/environment');var db=require(_0x0a0e('0x16'))['db'];var integrations=require(_0x0a0e('0x17'));var jayson=require(_0x0a0e('0x18'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x23c913,_0x36ca39,_0x375e94){if(_0x375e94){var _0x17c4c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17c4c7[_0x0a0e('0x19')](_0x36ca39)){return _0x23c913;}else{throw new db[(_0x0a0e('0x1a'))][(_0x0a0e('0x1b'))](_0x0a0e('0x1c'));}}else{return _0x23c913;}}function respondWithRpcPromise(_0x41cf97,_0x25626c,_0x1c05ad,_0x12bd43){return new BPromise(function(_0x412e21,_0x379a3b){var _0x23a21a=_0x12bd43||client;return _0x23a21a['request'](_0x41cf97,_0x1c05ad)[_0x0a0e('0x1d')](function(_0xb6dffa){logger[_0x0a0e('0x1e')](_0x0a0e('0x1f'),_0x25626c,_0x0a0e('0x20'));logger[_0x0a0e('0x21')](_0x0a0e('0x22'),_0x25626c,_0x0a0e('0x20'),JSON[_0x0a0e('0x23')](_0xb6dffa));if(_0xb6dffa[_0x0a0e('0x24')]){if(_0xb6dffa['error'][_0x0a0e('0x25')]===0x1f4){logger['error'](_0x0a0e('0x1f'),_0x25626c,_0xb6dffa[_0x0a0e('0x24')][_0x0a0e('0x26')]);return _0x379a3b(_0xb6dffa[_0x0a0e('0x24')]['message']);}logger[_0x0a0e('0x24')](_0x0a0e('0x1f'),_0x25626c,_0xb6dffa[_0x0a0e('0x24')]['message']);return _0x412e21(_0xb6dffa[_0x0a0e('0x24')][_0x0a0e('0x26')]);}else{logger[_0x0a0e('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x25626c,'request\x20sent');_0x412e21(_0xb6dffa[_0x0a0e('0x27')][_0x0a0e('0x26')]);}})[_0x0a0e('0x28')](function(_0x28cada){logger[_0x0a0e('0x24')]('VtigerAccount,\x20%s,\x20%s',_0x25626c,_0x28cada);_0x379a3b(_0x28cada);});});}function respondWithStatusCode(_0x1bf9ab,_0x1a90c9){_0x1a90c9=_0x1a90c9||0xcc;return function(_0x532152){if(_0x532152){return _0x1bf9ab['sendStatus'](_0x1a90c9);}return _0x1bf9ab[_0x0a0e('0x29')](_0x1a90c9)['end']();};}function respondWithResult(_0x3dd520,_0x5ad56d){_0x5ad56d=_0x5ad56d||0xc8;return function(_0x3f83f5){if(_0x3f83f5){return _0x3dd520['status'](_0x5ad56d)[_0x0a0e('0x2a')](_0x3f83f5);}};}function respondWithFilteredResult(_0x55974,_0x281ef1){return function(_0x386313){if(_0x386313){var _0x1cc101=_0x386313[_0x0a0e('0x2b')],_0x143a11=_0x281ef1[_0x0a0e('0x2c')],_0x55d57b=_0x281ef1['offset']+_0x281ef1[_0x0a0e('0x2d')],_0x3e051f;if(_0x55d57b>=_0x1cc101){_0x55d57b=_0x1cc101;_0x3e051f=0xc8;}else{_0x3e051f=0xce;}_0x55974[_0x0a0e('0x29')](_0x3e051f);return _0x55974['set'](_0x0a0e('0x2e'),_0x143a11+'-'+_0x55d57b+'/'+_0x1cc101)[_0x0a0e('0x2a')](_0x386313);}return null;};}function patchUpdates(_0x560710){return function(_0x2d9525){try{jsonpatch[_0x0a0e('0x2f')](_0x2d9525,_0x560710,!![]);}catch(_0x2779c7){return BPromise[_0x0a0e('0x30')](_0x2779c7);}return _0x2d9525[_0x0a0e('0x31')]();};}function saveUpdates(_0x260d40,_0x3cf27b){return function(_0x101c22){if(_0x101c22){return _0x101c22['update'](_0x260d40)[_0x0a0e('0x1d')](function(_0x3c59a0){return _0x3c59a0;});}return null;};}function removeEntity(_0x505739,_0x47748f){return function(_0x3960f7){if(_0x3960f7){return _0x3960f7['destroy']()[_0x0a0e('0x1d')](function(){_0x505739[_0x0a0e('0x29')](0xcc)[_0x0a0e('0x32')]();});}};}function handleEntityNotFound(_0x52e02f,_0x29f72b){return function(_0x2d913f){if(!_0x2d913f){_0x52e02f[_0x0a0e('0x33')](0x194);}return _0x2d913f;};}function handleError(_0x372048,_0x1c7cfa){_0x1c7cfa=_0x1c7cfa||0x1f4;return function(_0x5327fd){logger[_0x0a0e('0x24')](_0x5327fd[_0x0a0e('0x34')]);if(_0x5327fd[_0x0a0e('0x35')]){delete _0x5327fd[_0x0a0e('0x35')];}_0x372048[_0x0a0e('0x29')](_0x1c7cfa)['send'](_0x5327fd);};}exports[_0x0a0e('0x36')]=function(_0x43f672,_0x39777a){var _0x3824ab={},_0x405a4d={},_0x2e0cc0={'count':0x0,'rows':[]};var _0x179ea8=_[_0x0a0e('0x37')](db[_0x0a0e('0x38')]['rawAttributes'],function(_0x10f66d){return{'name':_0x10f66d[_0x0a0e('0x39')],'type':_0x10f66d[_0x0a0e('0x3a')][_0x0a0e('0x3b')]};});_0x405a4d[_0x0a0e('0x3c')]=_[_0x0a0e('0x37')](_0x179ea8,'name');_0x405a4d['query']=_['keys'](_0x43f672[_0x0a0e('0x3d')]);_0x405a4d[_0x0a0e('0x3e')]=_[_0x0a0e('0x3f')](_0x405a4d['model'],_0x405a4d[_0x0a0e('0x3d')]);_0x3824ab['attributes']=_[_0x0a0e('0x3f')](_0x405a4d[_0x0a0e('0x3c')],qs[_0x0a0e('0x40')](_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x40')]));_0x3824ab[_0x0a0e('0x41')]=_0x3824ab[_0x0a0e('0x41')][_0x0a0e('0x42')]?_0x3824ab[_0x0a0e('0x41')]:_0x405a4d[_0x0a0e('0x3c')];if(!_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x43')]('nolimit')){_0x3824ab[_0x0a0e('0x2d')]=qs[_0x0a0e('0x2d')](_0x43f672['query'][_0x0a0e('0x2d')]);_0x3824ab[_0x0a0e('0x2c')]=qs[_0x0a0e('0x2c')](_0x43f672[_0x0a0e('0x3d')]['offset']);}_0x3824ab[_0x0a0e('0x44')]=qs['sort'](_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x45')]);_0x3824ab[_0x0a0e('0x46')]=qs[_0x0a0e('0x3e')](_[_0x0a0e('0x47')](_0x43f672[_0x0a0e('0x3d')],_0x405a4d[_0x0a0e('0x3e')]),_0x179ea8);if(_0x43f672[_0x0a0e('0x3d')]['filter']){_0x3824ab[_0x0a0e('0x46')]=_[_0x0a0e('0x48')](_0x3824ab[_0x0a0e('0x46')],{'$or':_[_0x0a0e('0x37')](_0x179ea8,function(_0x4c1b3a){if(_0x4c1b3a[_0x0a0e('0x3a')]!==_0x0a0e('0x49')){var _0x50e092={};_0x50e092[_0x4c1b3a[_0x0a0e('0x35')]]={'$like':'%'+_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x4a')]+'%'};return _0x50e092;}})});}_0x3824ab=_['merge']({},_0x3824ab,_0x43f672[_0x0a0e('0x4b')]);var _0x47711f={'where':_0x3824ab[_0x0a0e('0x46')]};return db[_0x0a0e('0x38')][_0x0a0e('0x2b')](_0x47711f)[_0x0a0e('0x1d')](function(_0x1e129d){_0x2e0cc0[_0x0a0e('0x2b')]=_0x1e129d;if(_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x4c')]){_0x3824ab[_0x0a0e('0x4d')]=[{'all':!![]}];}return db['VtigerAccount'][_0x0a0e('0x4e')](_0x3824ab);})[_0x0a0e('0x1d')](function(_0x566a38){_0x2e0cc0['rows']=_0x566a38;return _0x2e0cc0;})[_0x0a0e('0x1d')](respondWithFilteredResult(_0x39777a,_0x3824ab))['catch'](handleError(_0x39777a,null));};exports[_0x0a0e('0x4f')]=function(_0x512115,_0x5b5635){var _0x2d3ff4={'raw':![],'where':{'id':_0x512115[_0x0a0e('0x50')]['id']}},_0x3c4be9={};_0x3c4be9['model']=_[_0x0a0e('0x51')](db[_0x0a0e('0x38')][_0x0a0e('0x52')]);_0x3c4be9[_0x0a0e('0x3d')]=_['keys'](_0x512115[_0x0a0e('0x3d')]);_0x3c4be9[_0x0a0e('0x3e')]=_[_0x0a0e('0x3f')](_0x3c4be9[_0x0a0e('0x3c')],_0x3c4be9[_0x0a0e('0x3d')]);_0x2d3ff4[_0x0a0e('0x41')]=_['intersection'](_0x3c4be9[_0x0a0e('0x3c')],qs[_0x0a0e('0x40')](_0x512115[_0x0a0e('0x3d')][_0x0a0e('0x40')]));_0x2d3ff4[_0x0a0e('0x41')]=_0x2d3ff4[_0x0a0e('0x41')]['length']?_0x2d3ff4[_0x0a0e('0x41')]:_0x3c4be9[_0x0a0e('0x3c')];if(_0x512115['query'][_0x0a0e('0x4c')]){_0x2d3ff4[_0x0a0e('0x4d')]=[{'all':!![]}];}_0x2d3ff4=_[_0x0a0e('0x48')]({},_0x2d3ff4,_0x512115[_0x0a0e('0x4b')]);return db[_0x0a0e('0x38')][_0x0a0e('0x53')](_0x2d3ff4)['then'](handleEntityNotFound(_0x5b5635,null))[_0x0a0e('0x1d')](respondWithResult(_0x5b5635,null))['catch'](handleError(_0x5b5635,null));};exports[_0x0a0e('0x54')]=function(_0x4c0511,_0x17bc08){return db[_0x0a0e('0x38')][_0x0a0e('0x54')](_0x4c0511[_0x0a0e('0x55')],{})[_0x0a0e('0x1d')](respondWithResult(_0x17bc08,0xc9))[_0x0a0e('0x28')](handleError(_0x17bc08,null));};exports[_0x0a0e('0x56')]=function(_0x23d1e9,_0x35e297){if(_0x23d1e9[_0x0a0e('0x55')]['id']){delete _0x23d1e9[_0x0a0e('0x55')]['id'];}return db[_0x0a0e('0x38')][_0x0a0e('0x53')]({'where':{'id':_0x23d1e9[_0x0a0e('0x50')]['id']}})[_0x0a0e('0x1d')](handleEntityNotFound(_0x35e297,null))[_0x0a0e('0x1d')](saveUpdates(_0x23d1e9[_0x0a0e('0x55')],null))[_0x0a0e('0x1d')](respondWithResult(_0x35e297,null))[_0x0a0e('0x28')](handleError(_0x35e297,null));};exports['destroy']=function(_0x11e425,_0x29d437){return db[_0x0a0e('0x38')]['find']({'where':{'id':_0x11e425[_0x0a0e('0x50')]['id']}})[_0x0a0e('0x1d')](handleEntityNotFound(_0x29d437,null))['then'](removeEntity(_0x29d437,null))['catch'](handleError(_0x29d437,null));};exports[_0x0a0e('0x57')]=function(_0x2a9974,_0x36a888,_0x484009){var _0x709272={};var _0x1f0360={};var _0xf5f18d;var _0x299578;return db[_0x0a0e('0x38')][_0x0a0e('0x58')]({'where':{'id':_0x2a9974[_0x0a0e('0x50')]['id']}})[_0x0a0e('0x1d')](handleEntityNotFound(_0x36a888,null))[_0x0a0e('0x1d')](function(_0x3e2b98){if(_0x3e2b98){_0xf5f18d=_0x3e2b98;_0x1f0360['model']=_[_0x0a0e('0x51')](db[_0x0a0e('0x59')][_0x0a0e('0x52')]);_0x1f0360[_0x0a0e('0x3d')]=_[_0x0a0e('0x51')](_0x2a9974[_0x0a0e('0x3d')]);_0x1f0360[_0x0a0e('0x3e')]=_['intersection'](_0x1f0360['model'],_0x1f0360[_0x0a0e('0x3d')]);_0x709272[_0x0a0e('0x41')]=_['intersection'](_0x1f0360[_0x0a0e('0x3c')],qs[_0x0a0e('0x40')](_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x40')]));_0x709272[_0x0a0e('0x41')]=_0x709272[_0x0a0e('0x41')]['length']?_0x709272[_0x0a0e('0x41')]:_0x1f0360[_0x0a0e('0x3c')];_0x709272[_0x0a0e('0x44')]=qs[_0x0a0e('0x45')](_0x2a9974['query'][_0x0a0e('0x45')]);_0x709272['where']=qs[_0x0a0e('0x3e')](_[_0x0a0e('0x47')](_0x2a9974[_0x0a0e('0x3d')],_0x1f0360['filters']));if(_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x4a')]){_0x709272['where']=_[_0x0a0e('0x48')](_0x709272['where'],{'$or':_['map'](_0x709272[_0x0a0e('0x41')],function(_0x3f7e66){var _0x23c05d={};_0x23c05d[_0x3f7e66]={'$like':'%'+_0x2a9974['query'][_0x0a0e('0x4a')]+'%'};return _0x23c05d;})});}_0x709272=_[_0x0a0e('0x48')]({},_0x709272,_0x2a9974['options']);return _0xf5f18d['getConfigurations'](_0x709272);}})[_0x0a0e('0x1d')](function(_0x5324ed){if(_0x5324ed){_0x299578=_0x5324ed[_0x0a0e('0x42')];if(!_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x43')](_0x0a0e('0x5a'))){_0x709272[_0x0a0e('0x2d')]=qs[_0x0a0e('0x2d')](_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x2d')]);_0x709272['offset']=qs[_0x0a0e('0x2c')](_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x2c')]);}return _0xf5f18d[_0x0a0e('0x57')](_0x709272);}})[_0x0a0e('0x1d')](function(_0x23b3c6){if(_0x23b3c6){return _0x23b3c6?{'count':_0x299578,'rows':_0x23b3c6}:null;}})[_0x0a0e('0x1d')](respondWithResult(_0x36a888,null))[_0x0a0e('0x28')](handleError(_0x36a888,null));};exports[_0x0a0e('0x5b')]=function(_0x29bc09,_0x2e79d6,_0x531d44){if(_0x29bc09['body']['id']){delete _0x29bc09[_0x0a0e('0x55')]['id'];}return db[_0x0a0e('0x38')][_0x0a0e('0x58')]({'where':{'id':_0x29bc09[_0x0a0e('0x50')]['id']}})['then'](handleEntityNotFound(_0x2e79d6,null))['then'](function(_0x4a9ab5){if(_0x4a9ab5){_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x5c')]=_0x4a9ab5['id'];_0x29bc09['body']['Subjects']=integrations[_0x0a0e('0x5d')](_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x5e')],_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x3a')]);_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x5f')]=integrations[_0x0a0e('0x60')](_0x29bc09['body']['channel'],_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x3a')]);return db[_0x0a0e('0x59')][_0x0a0e('0x54')](_0x29bc09[_0x0a0e('0x55')],{'include':[{'model':db[_0x0a0e('0x61')],'as':_0x0a0e('0x62')},{'model':db[_0x0a0e('0x61')],'as':_0x0a0e('0x5f')}]});}return null;})['then'](respondWithResult(_0x2e79d6,null))[_0x0a0e('0x28')](handleError(_0x2e79d6,null));};var md5=require('md5');exports[_0x0a0e('0x63')]=function(_0x23ced5,_0x1c8e1b,_0x26f738){var _0x3c98e3=null;var _0x374a79=null;var _0x5dcf63=null;var _0x30bdaa=null;var _0x1d1f6b='';return db[_0x0a0e('0x38')][_0x0a0e('0x58')]({'where':{'id':_0x23ced5['params']['id']},'attributes':['id',_0x0a0e('0x35'),_0x0a0e('0x64'),_0x0a0e('0x65'),_0x0a0e('0x66'),_0x0a0e('0x67'),_0x0a0e('0x68'),'accessKey']})[_0x0a0e('0x1d')](handleEntityNotFound(_0x1c8e1b,null))[_0x0a0e('0x1d')](function(_0xe4ff36){if(_0xe4ff36){_0x3c98e3=_0xe4ff36[_0x0a0e('0x64')];_0x374a79=_0xe4ff36['accessKey'];_0x5dcf63=_0xe4ff36[_0x0a0e('0x66')];_0x1d1f6b=_0xe4ff36[_0x0a0e('0x67')];var _0x571592=_0x1d1f6b[_0x0a0e('0x69')](-0x1);if(_0x571592==='/'){_0x1d1f6b=_0x1d1f6b['substring'](0x0,_0x1d1f6b['lastIndexOf'](_0x571592));}_0x30bdaa=util[_0x0a0e('0x6a')]('%s/webservice.php',_0x1d1f6b);var _0x2716c2={'method':_0x0a0e('0x6b'),'uri':_0x30bdaa,'qs':{'operation':_0x0a0e('0x6c'),'username':_0xe4ff36['username']},'json':!![]};return rp(_0x2716c2);}})['then'](function(_0xb4556f){if(_0xb4556f['success']){var _0x5b0b1a={'method':_0x0a0e('0x6d'),'uri':_0x30bdaa,'form':{'operation':_0x0a0e('0x6e'),'username':_0x3c98e3,'accessKey':md5(_0xb4556f[_0x0a0e('0x27')][_0x0a0e('0x6f')]+_0x374a79)},'json':!![]};return rp(_0x5b0b1a);}})[_0x0a0e('0x1d')](function(_0x6ff3a5){if(_0x6ff3a5['success']){var _0x552f33={'method':_0x0a0e('0x6b'),'uri':_0x30bdaa,'qs':{'operation':_0x0a0e('0x70'),'username':_0x3c98e3,'sessionName':_0x6ff3a5[_0x0a0e('0x27')][_0x0a0e('0x71')],'elementType':_0x5dcf63},'json':!![]};return rp(_0x552f33);}})[_0x0a0e('0x1d')](function(_0x2377af){if(_0x2377af[_0x0a0e('0x72')]){var _0x366b61=['autogenerated',_0x0a0e('0x73'),_0x0a0e('0x74')];_[_0x0a0e('0x75')](_0x2377af['result'][_0x0a0e('0x40')],function(_0x2f5e64){return _0x366b61[_0x0a0e('0x76')](_0x2f5e64[_0x0a0e('0x3a')][_0x0a0e('0x35')]);});_[_0x0a0e('0x75')](_0x2377af[_0x0a0e('0x27')][_0x0a0e('0x40')],function(_0x421d6f){return _0x421d6f[_0x0a0e('0x77')]===_0x0a0e('0x78');});return{'count':_0x2377af[_0x0a0e('0x27')][_0x0a0e('0x40')]['length'],'rows':_[_0x0a0e('0x37')](_0x2377af[_0x0a0e('0x27')][_0x0a0e('0x40')],function(_0x4fe9bc){return{'id':_0x4fe9bc[_0x0a0e('0x35')],'name':_0x4fe9bc[_0x0a0e('0x79')],'custom':_['startsWith'](_0x4fe9bc[_0x0a0e('0x35')],'cf_')?!![]:![],'options':_0x4fe9bc[_0x0a0e('0x3a')]['name']==='picklist'&&_0x4fe9bc[_0x0a0e('0x3a')]['picklistValues'][_0x0a0e('0x42')]>0x0?_[_0x0a0e('0x37')](_0x4fe9bc[_0x0a0e('0x3a')][_0x0a0e('0x7a')],function(_0x2afd66){return{'name':_0x2afd66[_0x0a0e('0x79')],'value':_0x2afd66['value']};}):[]};})};}})['then'](respondWithResult(_0x1c8e1b,null))[_0x0a0e('0x28')](function(_0x3b0aeb){console['log'](_0x0a0e('0x7b')+_0x3b0aeb);var _0x56f13b=_0x23ced5[_0x0a0e('0x3d')][_0x0a0e('0x19')]?0x1f4:_0x3b0aeb['statusCode']||0x1f4;logger['error'](_0x0a0e('0x7c'),_0x0a0e('0x63'),_0x56f13b,JSON[_0x0a0e('0x23')](_0x3b0aeb));delete _0x3b0aeb[_0x0a0e('0x35')];if(_0x56f13b===0x191){_0x56f13b=0x190;}_0x1c8e1b[_0x0a0e('0x29')](_0x56f13b)[_0x0a0e('0x7d')](_0x23ced5[_0x0a0e('0x3d')]['test']?{'message':_0x0a0e('0x7e'),'statusCode':_0x3b0aeb['statusCode']}:_0x3b0aeb);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 8534d8f..0e001e5 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 _0x9803=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x23d552,_0x3fe415){var _0x142f15=function(_0x448851){while(--_0x448851){_0x23d552['push'](_0x23d552['shift']());}};_0x142f15(++_0x3fe415);}(_0x9803,0x9a));var _0x3980=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9803[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3980('0x0'));var util=require(_0x3980('0x1'));var logger=require(_0x3980('0x2'))(_0x3980('0x3'));var moment=require(_0x3980('0x4'));var BPromise=require(_0x3980('0x5'));var rp=require(_0x3980('0x6'));var fs=require('fs');var path=require(_0x3980('0x7'));var rimraf=require(_0x3980('0x8'));var config=require(_0x3980('0x9'));var attributes=require(_0x3980('0xa'));var integrations=require(_0x3980('0xb'));module[_0x3980('0xc')]=function(_0x2916d7,_0x517bed){return _0x2916d7[_0x3980('0xd')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9d1=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x9eb64c,_0x5f0b4a){var _0x5128bf=function(_0x328dcd){while(--_0x328dcd){_0x9eb64c['push'](_0x9eb64c['shift']());}};_0x5128bf(++_0x5f0b4a);}(_0xa9d1,0x74));var _0x1a9d=function(_0x5af6f6,_0x563f0e){_0x5af6f6=_0x5af6f6-0x0;var _0x1939bb=_0xa9d1[_0x5af6f6];return _0x1939bb;};'use strict';var _=require(_0x1a9d('0x0'));var util=require(_0x1a9d('0x1'));var logger=require(_0x1a9d('0x2'))(_0x1a9d('0x3'));var moment=require(_0x1a9d('0x4'));var BPromise=require(_0x1a9d('0x5'));var rp=require(_0x1a9d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a9d('0x7'));var attributes=require(_0x1a9d('0x8'));var integrations=require(_0x1a9d('0x9'));module[_0x1a9d('0xa')]=function(_0x2a764e,_0xff906f){return _0x2a764e[_0x1a9d('0xb')](_0x1a9d('0xc'),attributes,{'tableName':_0x1a9d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 7a00810..514b109 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 _0xeb27=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','limit','include','model','map','find','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x15acf0,_0x513460){var _0x45e482=function(_0x313c38){while(--_0x313c38){_0x15acf0['push'](_0x15acf0['shift']());}};_0x45e482(++_0x513460);}(_0xeb27,0x132));var _0x7eb2=function(_0x51f736,_0x5879f2){_0x51f736=_0x51f736-0x0;var _0x7f45=_0xeb27[_0x51f736];return _0x7f45;};'use strict';var _=require(_0x7eb2('0x0'));var util=require('util');var moment=require(_0x7eb2('0x1'));var BPromise=require('bluebird');var rs=require(_0x7eb2('0x2'));var fs=require('fs');var Redis=require(_0x7eb2('0x3'));var db=require(_0x7eb2('0x4'))['db'];var utils=require(_0x7eb2('0x5'));var logger=require(_0x7eb2('0x6'))(_0x7eb2('0x7'));var config=require(_0x7eb2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7eb2('0x9')][_0x7eb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeee496,_0x4695c4,_0x20fa75){return new BPromise(function(_0x1df6d4,_0x3d25d7){return client[_0x7eb2('0xb')](_0xeee496,_0x20fa75)[_0x7eb2('0xc')](function(_0x185c65){logger[_0x7eb2('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x4695c4,_0x7eb2('0xe'));logger[_0x7eb2('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4695c4,_0x7eb2('0xe'),JSON[_0x7eb2('0x10')](_0x185c65));if(_0x185c65[_0x7eb2('0x11')]){if(_0x185c65['error'][_0x7eb2('0x12')]===0x1f4){logger[_0x7eb2('0x11')](_0x7eb2('0x13'),_0x4695c4,_0x185c65[_0x7eb2('0x11')][_0x7eb2('0x14')]);return _0x3d25d7(_0x185c65['error'][_0x7eb2('0x14')]);}logger[_0x7eb2('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4695c4,_0x185c65[_0x7eb2('0x11')]['message']);return _0x1df6d4(_0x185c65['error'][_0x7eb2('0x14')]);}else{logger[_0x7eb2('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x4695c4,'request\x20sent');_0x1df6d4(_0x185c65[_0x7eb2('0x15')][_0x7eb2('0x14')]);}})[_0x7eb2('0x16')](function(_0x7cc120){logger[_0x7eb2('0x11')](_0x7eb2('0x13'),_0x4695c4,_0x7cc120);_0x3d25d7(_0x7cc120);});});}exports[_0x7eb2('0x17')]=function(_0x20b18f){var _0x9a5ba0=this;return new Promise(function(_0x567c22,_0x522f45){return db[_0x7eb2('0x18')]['findAll']({'raw':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1a')]===undefined?!![]:![]:!![],'where':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1b')]||null:null,'attributes':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f['options'][_0x7eb2('0x1c')]||null:null,'limit':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1d')]||null:null,'include':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1e')]?_['map'](_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1e')],function(_0x587690){return{'model':db[_0x587690[_0x7eb2('0x1f')]],'as':_0x587690['as'],'attributes':_0x587690[_0x7eb2('0x1c')],'include':_0x587690[_0x7eb2('0x1e')]?_[_0x7eb2('0x20')](_0x587690[_0x7eb2('0x1e')],function(_0x28949d){return{'model':db[_0x28949d[_0x7eb2('0x1f')]],'as':_0x28949d['as'],'attributes':_0x28949d['attributes'],'include':_0x28949d['include']?_[_0x7eb2('0x20')](_0x28949d['include'],function(_0x29c9cd){return{'model':db[_0x29c9cd[_0x7eb2('0x1f')]],'as':_0x29c9cd['as'],'attributes':_0x29c9cd[_0x7eb2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7eb2('0xc')](function(_0x5d2b13){logger[_0x7eb2('0xd')]('GetVtigerAccount',_0x20b18f);logger[_0x7eb2('0xf')](_0x7eb2('0x17'),_0x20b18f,JSON[_0x7eb2('0x10')](_0x5d2b13));_0x567c22(_0x5d2b13);})['catch'](function(_0x1fda35){logger[_0x7eb2('0x11')](_0x7eb2('0x17'),_0x1fda35['message'],_0x20b18f);_0x522f45(_0x9a5ba0['error'](0x1f4,_0x1fda35[_0x7eb2('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x3fabaf){var _0x305283=this;return new Promise(function(_0x19f22d,_0x64fc11){return db[_0x7eb2('0x18')][_0x7eb2('0x21')]({'raw':_0x3fabaf['options']?_0x3fabaf[_0x7eb2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3fabaf['options']?_0x3fabaf[_0x7eb2('0x19')]['where']||null:null,'attributes':_0x3fabaf['options']?_0x3fabaf[_0x7eb2('0x19')][_0x7eb2('0x1c')]||null:null,'include':_0x3fabaf[_0x7eb2('0x19')]?_0x3fabaf[_0x7eb2('0x19')][_0x7eb2('0x1e')]?_[_0x7eb2('0x20')](_0x3fabaf['options'][_0x7eb2('0x1e')],function(_0x2d3512){return{'model':db[_0x2d3512[_0x7eb2('0x1f')]],'as':_0x2d3512['as'],'attributes':_0x2d3512[_0x7eb2('0x1c')],'include':_0x2d3512['include']?_[_0x7eb2('0x20')](_0x2d3512['include'],function(_0x3a1079){return{'model':db[_0x3a1079[_0x7eb2('0x1f')]],'as':_0x3a1079['as'],'attributes':_0x3a1079[_0x7eb2('0x1c')],'include':_0x3a1079['include']?_['map'](_0x3a1079[_0x7eb2('0x1e')],function(_0x557ebd){return{'model':db[_0x557ebd[_0x7eb2('0x1f')]],'as':_0x557ebd['as'],'attributes':_0x557ebd[_0x7eb2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7eb2('0xc')](function(_0x590180){logger[_0x7eb2('0xd')](_0x7eb2('0x22'),_0x3fabaf);logger[_0x7eb2('0xf')]('ShowVtigerAccount',_0x3fabaf,JSON['stringify'](_0x590180));_0x19f22d(_0x590180);})[_0x7eb2('0x16')](function(_0xaf894b){logger['error'](_0x7eb2('0x22'),_0xaf894b[_0x7eb2('0x14')],_0x3fabaf);_0x64fc11(_0x305283[_0x7eb2('0x11')](0x1f4,_0xaf894b[_0x7eb2('0x14')]));});});}; \ No newline at end of file +var _0x86f3=['GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','ShowVtigerAccount','find','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x18c50c,_0x14230b){var _0x4a8711=function(_0x3f027d){while(--_0x3f027d){_0x18c50c['push'](_0x18c50c['shift']());}};_0x4a8711(++_0x14230b);}(_0x86f3,0x73));var _0x386f=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x86f3[_0x1c34e7];return _0x378cb1;};'use strict';var _=require(_0x386f('0x0'));var util=require(_0x386f('0x1'));var moment=require(_0x386f('0x2'));var BPromise=require(_0x386f('0x3'));var rs=require(_0x386f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x386f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x386f('0x6'))(_0x386f('0x7'));var config=require(_0x386f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x381f38,_0x251a02,_0x23a773){return new BPromise(function(_0x1dba05,_0x584f94){return client[_0x386f('0x9')](_0x381f38,_0x23a773)[_0x386f('0xa')](function(_0x3d6dfd){logger[_0x386f('0xb')](_0x386f('0xc'),_0x251a02,_0x386f('0xd'));logger[_0x386f('0xe')](_0x386f('0xf'),_0x251a02,_0x386f('0xd'),JSON['stringify'](_0x3d6dfd));if(_0x3d6dfd[_0x386f('0x10')]){if(_0x3d6dfd[_0x386f('0x10')][_0x386f('0x11')]===0x1f4){logger[_0x386f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x251a02,_0x3d6dfd[_0x386f('0x10')]['message']);return _0x584f94(_0x3d6dfd[_0x386f('0x10')][_0x386f('0x12')]);}logger[_0x386f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x251a02,_0x3d6dfd[_0x386f('0x10')][_0x386f('0x12')]);return _0x1dba05(_0x3d6dfd[_0x386f('0x10')]['message']);}else{logger['info'](_0x386f('0xc'),_0x251a02,_0x386f('0xd'));_0x1dba05(_0x3d6dfd[_0x386f('0x13')]['message']);}})[_0x386f('0x14')](function(_0x5e342e){logger[_0x386f('0x10')](_0x386f('0xc'),_0x251a02,_0x5e342e);_0x584f94(_0x5e342e);});});}exports[_0x386f('0x15')]=function(_0x44bbcd){var _0x204500=this;return new Promise(function(_0x36ba08,_0x34a768){return db[_0x386f('0x16')][_0x386f('0x17')]({'raw':_0x44bbcd['options']?_0x44bbcd[_0x386f('0x18')][_0x386f('0x19')]===undefined?!![]:![]:!![],'where':_0x44bbcd['options']?_0x44bbcd[_0x386f('0x18')][_0x386f('0x1a')]||null:null,'attributes':_0x44bbcd[_0x386f('0x18')]?_0x44bbcd[_0x386f('0x18')][_0x386f('0x1b')]||null:null,'limit':_0x44bbcd[_0x386f('0x18')]?_0x44bbcd[_0x386f('0x18')]['limit']||null:null,'include':_0x44bbcd['options']?_0x44bbcd['options'][_0x386f('0x1c')]?_['map'](_0x44bbcd['options'][_0x386f('0x1c')],function(_0x267f31){return{'model':db[_0x267f31['model']],'as':_0x267f31['as'],'attributes':_0x267f31[_0x386f('0x1b')],'include':_0x267f31['include']?_[_0x386f('0x1d')](_0x267f31[_0x386f('0x1c')],function(_0x48007c){return{'model':db[_0x48007c['model']],'as':_0x48007c['as'],'attributes':_0x48007c[_0x386f('0x1b')],'include':_0x48007c[_0x386f('0x1c')]?_[_0x386f('0x1d')](_0x48007c[_0x386f('0x1c')],function(_0xee56a0){return{'model':db[_0xee56a0[_0x386f('0x1e')]],'as':_0xee56a0['as'],'attributes':_0xee56a0[_0x386f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2951dd){logger[_0x386f('0xb')](_0x386f('0x15'),_0x44bbcd);logger[_0x386f('0xe')](_0x386f('0x15'),_0x44bbcd,JSON['stringify'](_0x2951dd));_0x36ba08(_0x2951dd);})[_0x386f('0x14')](function(_0x107252){logger['error'](_0x386f('0x15'),_0x107252[_0x386f('0x12')],_0x44bbcd);_0x34a768(_0x204500[_0x386f('0x10')](0x1f4,_0x107252[_0x386f('0x12')]));});});};exports[_0x386f('0x1f')]=function(_0x49d47a){var _0x24880d=this;return new Promise(function(_0x48e1a6,_0x17d5f0){return db[_0x386f('0x16')][_0x386f('0x20')]({'raw':_0x49d47a[_0x386f('0x18')]?_0x49d47a['options'][_0x386f('0x19')]===undefined?!![]:![]:!![],'where':_0x49d47a[_0x386f('0x18')]?_0x49d47a[_0x386f('0x18')]['where']||null:null,'attributes':_0x49d47a['options']?_0x49d47a[_0x386f('0x18')][_0x386f('0x1b')]||null:null,'include':_0x49d47a['options']?_0x49d47a[_0x386f('0x18')]['include']?_[_0x386f('0x1d')](_0x49d47a['options'][_0x386f('0x1c')],function(_0x414d86){return{'model':db[_0x414d86[_0x386f('0x1e')]],'as':_0x414d86['as'],'attributes':_0x414d86[_0x386f('0x1b')],'include':_0x414d86[_0x386f('0x1c')]?_[_0x386f('0x1d')](_0x414d86[_0x386f('0x1c')],function(_0x435422){return{'model':db[_0x435422[_0x386f('0x1e')]],'as':_0x435422['as'],'attributes':_0x435422['attributes'],'include':_0x435422[_0x386f('0x1c')]?_['map'](_0x435422['include'],function(_0x2df171){return{'model':db[_0x2df171[_0x386f('0x1e')]],'as':_0x2df171['as'],'attributes':_0x2df171['attributes']};}):[]};}):[]};}):[]:[]})[_0x386f('0xa')](function(_0x56f7ba){logger[_0x386f('0xb')]('ShowVtigerAccount',_0x49d47a);logger[_0x386f('0xe')](_0x386f('0x1f'),_0x49d47a,JSON[_0x386f('0x21')](_0x56f7ba));_0x48e1a6(_0x56f7ba);})[_0x386f('0x14')](function(_0x590c58){logger[_0x386f('0x10')]('ShowVtigerAccount',_0x590c58['message'],_0x49d47a);_0x17d5f0(_0x24880d['error'](0x1f4,_0x590c58[_0x386f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 95ee931..4d5ee52 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x1087ce,_0x2dde76){var _0x9edc66=function(_0x325abb){while(--_0x325abb){_0x1087ce['push'](_0x1087ce['shift']());}};_0x9edc66(++_0x2dde76);}(_0xb10b,0x12a));var _0xbb10=function(_0x22de09,_0x3db597){_0x22de09=_0x22de09-0x0;var _0x4a13dc=_0xb10b[_0x22de09];return _0x4a13dc;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x5ce2ba,_0x52efc4){var _0xf26586=function(_0x58cba3){while(--_0x58cba3){_0x5ce2ba['push'](_0x5ce2ba['shift']());}};_0xf26586(++_0x52efc4);}(_0xb10b,0x12a));var _0xbb10=function(_0x536380,_0x3f79d5){_0x536380=_0x536380-0x0;var _0xd2229d=_0xb10b[_0x536380];return _0xd2229d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index eaba070..362ca22 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 _0x9c25=['sequelize','STRING'];(function(_0x614504,_0x458975){var _0x2e34d1=function(_0x46951d){while(--_0x46951d){_0x614504['push'](_0x614504['shift']());}};_0x2e34d1(++_0x458975);}(_0x9c25,0xf2));var _0x59c2=function(_0x665870,_0x42ab57){_0x665870=_0x665870-0x0;var _0x317721=_0x9c25[_0x665870];return _0x317721;};'use strict';var Sequelize=require(_0x59c2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x59c2('0x1')]}}; \ No newline at end of file +var _0xaa56=['STRING','sequelize','exports'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xaa56,0x1b4));var _0x6aa5=function(_0x7fe39b,_0x372720){_0x7fe39b=_0x7fe39b-0x0;var _0x227ad9=_0xaa56[_0x7fe39b];return _0x227ad9;};'use strict';var Sequelize=require(_0x6aa5('0x0'));module[_0x6aa5('0x1')]={'name':{'type':Sequelize[_0x6aa5('0x2')]},'description':{'type':Sequelize[_0x6aa5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 46127df..7b09e22 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 _0xd25d=['where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','find','create','body','getFields','findOne','VtigerField','intersection','order','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd25d,0x19f));var _0xdd25=function(_0x254f29,_0x20247e){_0x254f29=_0x254f29-0x0;var _0xda409c=_0xd25d[_0x254f29];return _0xda409c;};'use strict';var pdf=require(_0xdd25('0x0'));var emlformat=require(_0xdd25('0x1'));var rimraf=require(_0xdd25('0x2'));var zipdir=require(_0xdd25('0x3'));var jsonpatch=require(_0xdd25('0x4'));var rp=require(_0xdd25('0x5'));var moment=require('moment');var BPromise=require(_0xdd25('0x6'));var Mustache=require(_0xdd25('0x7'));var util=require(_0xdd25('0x8'));var path=require(_0xdd25('0x9'));var sox=require(_0xdd25('0xa'));var csv=require('to-csv');var ejs=require(_0xdd25('0xb'));var fs=require('fs');var _=require(_0xdd25('0xc'));var squel=require('squel');var crypto=require(_0xdd25('0xd'));var jsforce=require(_0xdd25('0xe'));var deskjs=require(_0xdd25('0xf'));var toCsv=require(_0xdd25('0x10'));var querystring=require(_0xdd25('0x11'));var Papa=require(_0xdd25('0x12'));var Redis=require(_0xdd25('0x13'));var authService=require(_0xdd25('0x14'));var qs=require(_0xdd25('0x15'));var as=require(_0xdd25('0x16'));var hardwareService=require(_0xdd25('0x17'));var logger=require(_0xdd25('0x18'))(_0xdd25('0x19'));var utils=require(_0xdd25('0x1a'));var config=require(_0xdd25('0x1b'));var db=require(_0xdd25('0x1c'))['db'];var jayson=require(_0xdd25('0x1d'));var client=jayson[_0xdd25('0x1e')][_0xdd25('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x17893a,_0x2b7038,_0x582c93){if(_0x582c93){var _0x2f37cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f37cb['test'](_0x2b7038)){return _0x17893a;}else{throw new db[(_0xdd25('0x20'))][(_0xdd25('0x21'))](_0xdd25('0x22'));}}else{return _0x17893a;}}function respondWithRpcPromise(_0xed061e,_0x333627,_0x596bd5,_0x1bf2b1){return new BPromise(function(_0x5d31e0,_0x26acaa){var _0x2a2bbc=_0x1bf2b1||client;return _0x2a2bbc[_0xdd25('0x23')](_0xed061e,_0x596bd5)[_0xdd25('0x24')](function(_0x4c0036){logger[_0xdd25('0x25')](_0xdd25('0x26'),_0x333627,_0xdd25('0x27'));logger['debug'](_0xdd25('0x28'),_0x333627,'request\x20sent',JSON[_0xdd25('0x29')](_0x4c0036));if(_0x4c0036[_0xdd25('0x2a')]){if(_0x4c0036['error'][_0xdd25('0x2b')]===0x1f4){logger[_0xdd25('0x2a')](_0xdd25('0x26'),_0x333627,_0x4c0036[_0xdd25('0x2a')][_0xdd25('0x2c')]);return _0x26acaa(_0x4c0036[_0xdd25('0x2a')]['message']);}logger[_0xdd25('0x2a')](_0xdd25('0x26'),_0x333627,_0x4c0036[_0xdd25('0x2a')]['message']);return _0x5d31e0(_0x4c0036[_0xdd25('0x2a')][_0xdd25('0x2c')]);}else{logger[_0xdd25('0x25')]('VtigerConfiguration,\x20%s,\x20%s',_0x333627,_0xdd25('0x27'));_0x5d31e0(_0x4c0036[_0xdd25('0x2d')][_0xdd25('0x2c')]);}})[_0xdd25('0x2e')](function(_0xb62447){logger[_0xdd25('0x2a')]('VtigerConfiguration,\x20%s,\x20%s',_0x333627,_0xb62447);_0x26acaa(_0xb62447);});});}function respondWithStatusCode(_0x5af086,_0x3fd611){_0x3fd611=_0x3fd611||0xcc;return function(_0x4a980c){if(_0x4a980c){return _0x5af086[_0xdd25('0x2f')](_0x3fd611);}return _0x5af086[_0xdd25('0x30')](_0x3fd611)[_0xdd25('0x31')]();};}function respondWithResult(_0x1866cb,_0x16709a){_0x16709a=_0x16709a||0xc8;return function(_0x1b17af){if(_0x1b17af){return _0x1866cb[_0xdd25('0x30')](_0x16709a)['json'](_0x1b17af);}};}function respondWithFilteredResult(_0x2402c0,_0x3bd0b4){return function(_0x58dafd){if(_0x58dafd){var _0x4a3298=_0x58dafd[_0xdd25('0x32')],_0x3be342=_0x3bd0b4[_0xdd25('0x33')],_0x28edcf=_0x3bd0b4[_0xdd25('0x33')]+_0x3bd0b4[_0xdd25('0x34')],_0x19dc18;if(_0x28edcf>=_0x4a3298){_0x28edcf=_0x4a3298;_0x19dc18=0xc8;}else{_0x19dc18=0xce;}_0x2402c0['status'](_0x19dc18);return _0x2402c0[_0xdd25('0x35')](_0xdd25('0x36'),_0x3be342+'-'+_0x28edcf+'/'+_0x4a3298)['json'](_0x58dafd);}return null;};}function patchUpdates(_0x2a0e17){return function(_0x37312e){try{jsonpatch[_0xdd25('0x37')](_0x37312e,_0x2a0e17,!![]);}catch(_0x281b91){return BPromise[_0xdd25('0x38')](_0x281b91);}return _0x37312e['save']();};}function saveUpdates(_0x124567,_0x54ee56){return function(_0x349ada){if(_0x349ada){return _0x349ada[_0xdd25('0x39')](_0x124567)['then'](function(_0x2a9382){return _0x2a9382;});}return null;};}function removeEntity(_0x1985fa,_0x266569){return function(_0x195c25){if(_0x195c25){return _0x195c25['destroy']()[_0xdd25('0x24')](function(){_0x1985fa[_0xdd25('0x30')](0xcc)[_0xdd25('0x31')]();});}};}function handleEntityNotFound(_0x3759d0,_0x485605){return function(_0x1e83b6){if(!_0x1e83b6){_0x3759d0[_0xdd25('0x2f')](0x194);}return _0x1e83b6;};}function handleError(_0x23ac1b,_0x1f5825){_0x1f5825=_0x1f5825||0x1f4;return function(_0x7e995f){logger[_0xdd25('0x2a')](_0x7e995f[_0xdd25('0x3a')]);if(_0x7e995f[_0xdd25('0x3b')]){delete _0x7e995f[_0xdd25('0x3b')];}_0x23ac1b[_0xdd25('0x30')](_0x1f5825)['send'](_0x7e995f);};}exports[_0xdd25('0x3c')]=function(_0x9967be,_0x103a6e){var _0x1f5e6={},_0x255504={},_0x4ece25={'count':0x0,'rows':[]};var _0x523e20=_[_0xdd25('0x3d')](db[_0xdd25('0x3e')][_0xdd25('0x3f')],function(_0x75cab){return{'name':_0x75cab[_0xdd25('0x40')],'type':_0x75cab[_0xdd25('0x41')][_0xdd25('0x42')]};});_0x255504[_0xdd25('0x43')]=_[_0xdd25('0x3d')](_0x523e20,_0xdd25('0x3b'));_0x255504[_0xdd25('0x44')]=_['keys'](_0x9967be[_0xdd25('0x44')]);_0x255504['filters']=_['intersection'](_0x255504['model'],_0x255504[_0xdd25('0x44')]);_0x1f5e6[_0xdd25('0x45')]=_['intersection'](_0x255504[_0xdd25('0x43')],qs[_0xdd25('0x46')](_0x9967be[_0xdd25('0x44')][_0xdd25('0x46')]));_0x1f5e6['attributes']=_0x1f5e6[_0xdd25('0x45')][_0xdd25('0x47')]?_0x1f5e6[_0xdd25('0x45')]:_0x255504[_0xdd25('0x43')];if(!_0x9967be[_0xdd25('0x44')][_0xdd25('0x48')](_0xdd25('0x49'))){_0x1f5e6[_0xdd25('0x34')]=qs[_0xdd25('0x34')](_0x9967be[_0xdd25('0x44')]['limit']);_0x1f5e6[_0xdd25('0x33')]=qs[_0xdd25('0x33')](_0x9967be[_0xdd25('0x44')][_0xdd25('0x33')]);}_0x1f5e6['order']=qs[_0xdd25('0x4a')](_0x9967be[_0xdd25('0x44')][_0xdd25('0x4a')]);_0x1f5e6[_0xdd25('0x4b')]=qs[_0xdd25('0x4c')](_['pick'](_0x9967be['query'],_0x255504[_0xdd25('0x4c')]),_0x523e20);if(_0x9967be[_0xdd25('0x44')][_0xdd25('0x4d')]){_0x1f5e6[_0xdd25('0x4b')]=_['merge'](_0x1f5e6[_0xdd25('0x4b')],{'$or':_[_0xdd25('0x3d')](_0x523e20,function(_0x1bf0b9){if(_0x1bf0b9[_0xdd25('0x41')]!==_0xdd25('0x4e')){var _0x4a824e={};_0x4a824e[_0x1bf0b9[_0xdd25('0x3b')]]={'$like':'%'+_0x9967be[_0xdd25('0x44')][_0xdd25('0x4d')]+'%'};return _0x4a824e;}})});}_0x1f5e6=_[_0xdd25('0x4f')]({},_0x1f5e6,_0x9967be[_0xdd25('0x50')]);var _0x255192={'where':_0x1f5e6[_0xdd25('0x4b')]};return db[_0xdd25('0x3e')][_0xdd25('0x32')](_0x255192)[_0xdd25('0x24')](function(_0x265257){_0x4ece25[_0xdd25('0x32')]=_0x265257;if(_0x9967be[_0xdd25('0x44')][_0xdd25('0x51')]){_0x1f5e6[_0xdd25('0x52')]=[{'all':!![]}];}return db[_0xdd25('0x3e')][_0xdd25('0x53')](_0x1f5e6);})[_0xdd25('0x24')](function(_0x56d6d5){_0x4ece25[_0xdd25('0x54')]=_0x56d6d5;return _0x4ece25;})['then'](respondWithFilteredResult(_0x103a6e,_0x1f5e6))[_0xdd25('0x2e')](handleError(_0x103a6e,null));};exports['show']=function(_0x4b83de,_0x359e20){var _0x1aaa1c={'raw':![],'where':{'id':_0x4b83de[_0xdd25('0x55')]['id']}},_0x3d343c={};_0x3d343c[_0xdd25('0x43')]=_[_0xdd25('0x56')](db[_0xdd25('0x3e')][_0xdd25('0x3f')]);_0x3d343c['query']=_['keys'](_0x4b83de[_0xdd25('0x44')]);_0x3d343c[_0xdd25('0x4c')]=_['intersection'](_0x3d343c[_0xdd25('0x43')],_0x3d343c[_0xdd25('0x44')]);_0x1aaa1c['attributes']=_['intersection'](_0x3d343c['model'],qs[_0xdd25('0x46')](_0x4b83de[_0xdd25('0x44')][_0xdd25('0x46')]));_0x1aaa1c[_0xdd25('0x45')]=_0x1aaa1c[_0xdd25('0x45')]['length']?_0x1aaa1c['attributes']:_0x3d343c[_0xdd25('0x43')];if(_0x4b83de[_0xdd25('0x44')][_0xdd25('0x51')]){_0x1aaa1c[_0xdd25('0x52')]=[{'all':!![]}];}_0x1aaa1c=_['merge']({},_0x1aaa1c,_0x4b83de[_0xdd25('0x50')]);return db[_0xdd25('0x3e')][_0xdd25('0x57')](_0x1aaa1c)[_0xdd25('0x24')](handleEntityNotFound(_0x359e20,null))[_0xdd25('0x24')](respondWithResult(_0x359e20,null))[_0xdd25('0x2e')](handleError(_0x359e20,null));};exports[_0xdd25('0x58')]=function(_0x54d443,_0x40305b){return db[_0xdd25('0x3e')][_0xdd25('0x58')](_0x54d443['body'],{})[_0xdd25('0x24')](respondWithResult(_0x40305b,0xc9))[_0xdd25('0x2e')](handleError(_0x40305b,null));};exports[_0xdd25('0x39')]=function(_0x29bd81,_0x157fa7){if(_0x29bd81['body']['id']){delete _0x29bd81[_0xdd25('0x59')]['id'];}return db[_0xdd25('0x3e')][_0xdd25('0x57')]({'where':{'id':_0x29bd81['params']['id']}})[_0xdd25('0x24')](handleEntityNotFound(_0x157fa7,null))['then'](saveUpdates(_0x29bd81[_0xdd25('0x59')],null))[_0xdd25('0x24')](respondWithResult(_0x157fa7,null))[_0xdd25('0x2e')](handleError(_0x157fa7,null));};exports['destroy']=function(_0x554865,_0x26e3a1){return db[_0xdd25('0x3e')]['find']({'where':{'id':_0x554865['params']['id']}})[_0xdd25('0x24')](handleEntityNotFound(_0x26e3a1,null))[_0xdd25('0x24')](removeEntity(_0x26e3a1,null))[_0xdd25('0x2e')](handleError(_0x26e3a1,null));};exports[_0xdd25('0x5a')]=function(_0x67613a,_0x84407b,_0x24c126){var _0x2970df={};var _0x456f84={};var _0x20cb2a;var _0x40e136;return db['VtigerConfiguration'][_0xdd25('0x5b')]({'where':{'id':_0x67613a[_0xdd25('0x55')]['id']}})['then'](handleEntityNotFound(_0x84407b,null))[_0xdd25('0x24')](function(_0x536597){if(_0x536597){_0x20cb2a=_0x536597;_0x456f84[_0xdd25('0x43')]=_[_0xdd25('0x56')](db[_0xdd25('0x5c')]['rawAttributes']);_0x456f84[_0xdd25('0x44')]=_[_0xdd25('0x56')](_0x67613a[_0xdd25('0x44')]);_0x456f84[_0xdd25('0x4c')]=_[_0xdd25('0x5d')](_0x456f84[_0xdd25('0x43')],_0x456f84[_0xdd25('0x44')]);_0x2970df[_0xdd25('0x45')]=_[_0xdd25('0x5d')](_0x456f84['model'],qs[_0xdd25('0x46')](_0x67613a[_0xdd25('0x44')]['fields']));_0x2970df[_0xdd25('0x45')]=_0x2970df[_0xdd25('0x45')][_0xdd25('0x47')]?_0x2970df[_0xdd25('0x45')]:_0x456f84[_0xdd25('0x43')];_0x2970df[_0xdd25('0x5e')]=qs[_0xdd25('0x4a')](_0x67613a['query'][_0xdd25('0x4a')]);_0x2970df[_0xdd25('0x4b')]=qs[_0xdd25('0x4c')](_['pick'](_0x67613a['query'],_0x456f84['filters']));if(_0x67613a['query'][_0xdd25('0x4d')]){_0x2970df[_0xdd25('0x4b')]=_[_0xdd25('0x4f')](_0x2970df['where'],{'$or':_[_0xdd25('0x3d')](_0x2970df[_0xdd25('0x45')],function(_0x33bfc3){var _0x20c5d5={};_0x20c5d5[_0x33bfc3]={'$like':'%'+_0x67613a[_0xdd25('0x44')][_0xdd25('0x4d')]+'%'};return _0x20c5d5;})});}_0x2970df=_[_0xdd25('0x4f')]({},_0x2970df,_0x67613a[_0xdd25('0x50')]);return _0x20cb2a[_0xdd25('0x5a')](_0x2970df);}})['then'](function(_0x2a1254){if(_0x2a1254){_0x40e136=_0x2a1254[_0xdd25('0x47')];if(!_0x67613a[_0xdd25('0x44')][_0xdd25('0x48')](_0xdd25('0x49'))){_0x2970df['limit']=qs[_0xdd25('0x34')](_0x67613a['query'][_0xdd25('0x34')]);_0x2970df[_0xdd25('0x33')]=qs['offset'](_0x67613a['query']['offset']);}return _0x20cb2a['getFields'](_0x2970df);}})[_0xdd25('0x24')](function(_0x42552a){if(_0x42552a){return _0x42552a?{'count':_0x40e136,'rows':_0x42552a}:null;}})[_0xdd25('0x24')](respondWithResult(_0x84407b,null))['catch'](handleError(_0x84407b,null));};exports['getSubjects']=function(_0x64ae10,_0x3b066b,_0x7aab9e){var _0x271e38={};var _0xfc687b={};var _0x1b99d1;var _0x10a071;return db[_0xdd25('0x3e')]['findOne']({'where':{'id':_0x64ae10['params']['id']}})[_0xdd25('0x24')](handleEntityNotFound(_0x3b066b,null))[_0xdd25('0x24')](function(_0x3dca46){if(_0x3dca46){_0x1b99d1=_0x3dca46;_0xfc687b[_0xdd25('0x43')]=_['keys'](db[_0xdd25('0x5c')][_0xdd25('0x3f')]);_0xfc687b[_0xdd25('0x44')]=_[_0xdd25('0x56')](_0x64ae10[_0xdd25('0x44')]);_0xfc687b[_0xdd25('0x4c')]=_['intersection'](_0xfc687b[_0xdd25('0x43')],_0xfc687b['query']);_0x271e38[_0xdd25('0x45')]=_[_0xdd25('0x5d')](_0xfc687b[_0xdd25('0x43')],qs[_0xdd25('0x46')](_0x64ae10[_0xdd25('0x44')][_0xdd25('0x46')]));_0x271e38[_0xdd25('0x45')]=_0x271e38[_0xdd25('0x45')][_0xdd25('0x47')]?_0x271e38[_0xdd25('0x45')]:_0xfc687b[_0xdd25('0x43')];_0x271e38[_0xdd25('0x5e')]=qs['sort'](_0x64ae10[_0xdd25('0x44')][_0xdd25('0x4a')]);_0x271e38[_0xdd25('0x4b')]=qs['filters'](_[_0xdd25('0x5f')](_0x64ae10['query'],_0xfc687b[_0xdd25('0x4c')]));if(_0x64ae10['query'][_0xdd25('0x4d')]){_0x271e38['where']=_[_0xdd25('0x4f')](_0x271e38[_0xdd25('0x4b')],{'$or':_[_0xdd25('0x3d')](_0x271e38[_0xdd25('0x45')],function(_0x40c38c){var _0x1b953b={};_0x1b953b[_0x40c38c]={'$like':'%'+_0x64ae10[_0xdd25('0x44')][_0xdd25('0x4d')]+'%'};return _0x1b953b;})});}_0x271e38=_['merge']({},_0x271e38,_0x64ae10[_0xdd25('0x50')]);return _0x1b99d1[_0xdd25('0x60')](_0x271e38);}})[_0xdd25('0x24')](function(_0x309079){if(_0x309079){_0x10a071=_0x309079[_0xdd25('0x47')];if(!_0x64ae10['query']['hasOwnProperty'](_0xdd25('0x49'))){_0x271e38['limit']=qs[_0xdd25('0x34')](_0x64ae10[_0xdd25('0x44')]['limit']);_0x271e38[_0xdd25('0x33')]=qs[_0xdd25('0x33')](_0x64ae10[_0xdd25('0x44')][_0xdd25('0x33')]);}return _0x1b99d1['getSubjects'](_0x271e38);}})[_0xdd25('0x24')](function(_0x39a06b){if(_0x39a06b){return _0x39a06b?{'count':_0x10a071,'rows':_0x39a06b}:null;}})[_0xdd25('0x24')](respondWithResult(_0x3b066b,null))[_0xdd25('0x2e')](handleError(_0x3b066b,null));};exports['getDescriptions']=function(_0x189087,_0x1a2973,_0x135868){var _0x245f5e={};var _0xaa5504={};var _0x10d7d5;var _0x5db13b;return db[_0xdd25('0x3e')]['findOne']({'where':{'id':_0x189087[_0xdd25('0x55')]['id']}})[_0xdd25('0x24')](handleEntityNotFound(_0x1a2973,null))[_0xdd25('0x24')](function(_0x46913f){if(_0x46913f){_0x10d7d5=_0x46913f;_0xaa5504[_0xdd25('0x43')]=_[_0xdd25('0x56')](db[_0xdd25('0x5c')]['rawAttributes']);_0xaa5504['query']=_[_0xdd25('0x56')](_0x189087[_0xdd25('0x44')]);_0xaa5504[_0xdd25('0x4c')]=_['intersection'](_0xaa5504['model'],_0xaa5504['query']);_0x245f5e[_0xdd25('0x45')]=_[_0xdd25('0x5d')](_0xaa5504[_0xdd25('0x43')],qs[_0xdd25('0x46')](_0x189087[_0xdd25('0x44')][_0xdd25('0x46')]));_0x245f5e[_0xdd25('0x45')]=_0x245f5e['attributes'][_0xdd25('0x47')]?_0x245f5e[_0xdd25('0x45')]:_0xaa5504[_0xdd25('0x43')];_0x245f5e[_0xdd25('0x5e')]=qs['sort'](_0x189087[_0xdd25('0x44')]['sort']);_0x245f5e[_0xdd25('0x4b')]=qs[_0xdd25('0x4c')](_[_0xdd25('0x5f')](_0x189087[_0xdd25('0x44')],_0xaa5504[_0xdd25('0x4c')]));if(_0x189087[_0xdd25('0x44')][_0xdd25('0x4d')]){_0x245f5e[_0xdd25('0x4b')]=_[_0xdd25('0x4f')](_0x245f5e[_0xdd25('0x4b')],{'$or':_[_0xdd25('0x3d')](_0x245f5e['attributes'],function(_0xfeb076){var _0x268e09={};_0x268e09[_0xfeb076]={'$like':'%'+_0x189087['query']['filter']+'%'};return _0x268e09;})});}_0x245f5e=_['merge']({},_0x245f5e,_0x189087[_0xdd25('0x50')]);return _0x10d7d5[_0xdd25('0x61')](_0x245f5e);}})[_0xdd25('0x24')](function(_0x4d11c7){if(_0x4d11c7){_0x5db13b=_0x4d11c7['length'];if(!_0x189087[_0xdd25('0x44')][_0xdd25('0x48')](_0xdd25('0x49'))){_0x245f5e[_0xdd25('0x34')]=qs['limit'](_0x189087[_0xdd25('0x44')][_0xdd25('0x34')]);_0x245f5e[_0xdd25('0x33')]=qs[_0xdd25('0x33')](_0x189087[_0xdd25('0x44')][_0xdd25('0x33')]);}return _0x10d7d5[_0xdd25('0x61')](_0x245f5e);}})[_0xdd25('0x24')](function(_0x371095){if(_0x371095){return _0x371095?{'count':_0x5db13b,'rows':_0x371095}:null;}})['then'](respondWithResult(_0x1a2973,null))[_0xdd25('0x2e')](handleError(_0x1a2973,null));}; \ No newline at end of file +var _0x32f0=['http','test','Sequelize','ValidationError','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','limit','set','json','apply','reject','update','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','getSubjects','VtigerField','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x23c9f1,_0x67ad6f){var _0x59434f=function(_0x5a3bcb){while(--_0x5a3bcb){_0x23c9f1['push'](_0x23c9f1['shift']());}};_0x59434f(++_0x67ad6f);}(_0x32f0,0x1ab));var _0x032f=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x32f0[_0xbb9dbf];return _0x30223c;};'use strict';var pdf=require(_0x032f('0x0'));var emlformat=require(_0x032f('0x1'));var rimraf=require(_0x032f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x032f('0x3'));var rp=require(_0x032f('0x4'));var moment=require('moment');var BPromise=require(_0x032f('0x5'));var Mustache=require(_0x032f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x032f('0x7'));var csv=require(_0x032f('0x8'));var ejs=require(_0x032f('0x9'));var fs=require('fs');var _=require(_0x032f('0xa'));var squel=require(_0x032f('0xb'));var crypto=require('crypto');var jsforce=require(_0x032f('0xc'));var deskjs=require(_0x032f('0xd'));var toCsv=require(_0x032f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032f('0xe'));var authService=require(_0x032f('0xf'));var qs=require(_0x032f('0x10'));var as=require(_0x032f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x032f('0x12'));var utils=require(_0x032f('0x13'));var config=require(_0x032f('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x032f('0x15'));var client=jayson[_0x032f('0x16')][_0x032f('0x17')]({'port':0x232a});function checkPasswordPattern(_0x175dff,_0x3efcdd,_0x401438){if(_0x401438){var _0x1f7270=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f7270[_0x032f('0x18')](_0x3efcdd)){return _0x175dff;}else{throw new db[(_0x032f('0x19'))][(_0x032f('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x175dff;}}function respondWithRpcPromise(_0x1afdd,_0x4d94a0,_0x406e73,_0x2afa83){return new BPromise(function(_0x40882e,_0x1c7c05){var _0x24551f=_0x2afa83||client;return _0x24551f[_0x032f('0x1b')](_0x1afdd,_0x406e73)[_0x032f('0x1c')](function(_0x552b46){logger[_0x032f('0x1d')](_0x032f('0x1e'),_0x4d94a0,_0x032f('0x1f'));logger[_0x032f('0x20')](_0x032f('0x21'),_0x4d94a0,_0x032f('0x1f'),JSON[_0x032f('0x22')](_0x552b46));if(_0x552b46[_0x032f('0x23')]){if(_0x552b46['error'][_0x032f('0x24')]===0x1f4){logger[_0x032f('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x4d94a0,_0x552b46[_0x032f('0x23')]['message']);return _0x1c7c05(_0x552b46[_0x032f('0x23')][_0x032f('0x25')]);}logger[_0x032f('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x4d94a0,_0x552b46['error'][_0x032f('0x25')]);return _0x40882e(_0x552b46['error'][_0x032f('0x25')]);}else{logger[_0x032f('0x1d')]('VtigerConfiguration,\x20%s,\x20%s',_0x4d94a0,_0x032f('0x1f'));_0x40882e(_0x552b46[_0x032f('0x26')]['message']);}})['catch'](function(_0x228844){logger[_0x032f('0x23')](_0x032f('0x1e'),_0x4d94a0,_0x228844);_0x1c7c05(_0x228844);});});}function respondWithStatusCode(_0xd58ad9,_0x30bbe3){_0x30bbe3=_0x30bbe3||0xcc;return function(_0x250cc8){if(_0x250cc8){return _0xd58ad9[_0x032f('0x27')](_0x30bbe3);}return _0xd58ad9[_0x032f('0x28')](_0x30bbe3)[_0x032f('0x29')]();};}function respondWithResult(_0x3a0ad1,_0x10f8c3){_0x10f8c3=_0x10f8c3||0xc8;return function(_0x45096d){if(_0x45096d){return _0x3a0ad1[_0x032f('0x28')](_0x10f8c3)['json'](_0x45096d);}};}function respondWithFilteredResult(_0x575897,_0x25a5b6){return function(_0xd00e27){if(_0xd00e27){var _0x283e74=_0xd00e27['count'],_0x451e4f=_0x25a5b6[_0x032f('0x2a')],_0x52ecf6=_0x25a5b6['offset']+_0x25a5b6[_0x032f('0x2b')],_0x521d22;if(_0x52ecf6>=_0x283e74){_0x52ecf6=_0x283e74;_0x521d22=0xc8;}else{_0x521d22=0xce;}_0x575897[_0x032f('0x28')](_0x521d22);return _0x575897[_0x032f('0x2c')]('Content-Range',_0x451e4f+'-'+_0x52ecf6+'/'+_0x283e74)[_0x032f('0x2d')](_0xd00e27);}return null;};}function patchUpdates(_0x5eb553){return function(_0x2b8d5c){try{jsonpatch[_0x032f('0x2e')](_0x2b8d5c,_0x5eb553,!![]);}catch(_0x49f94c){return BPromise[_0x032f('0x2f')](_0x49f94c);}return _0x2b8d5c['save']();};}function saveUpdates(_0x251f79,_0x249ab6){return function(_0x51f788){if(_0x51f788){return _0x51f788[_0x032f('0x30')](_0x251f79)[_0x032f('0x1c')](function(_0x5198af){return _0x5198af;});}return null;};}function removeEntity(_0x588293,_0x4ddab5){return function(_0x389a6d){if(_0x389a6d){return _0x389a6d['destroy']()['then'](function(){_0x588293[_0x032f('0x28')](0xcc)[_0x032f('0x29')]();});}};}function handleEntityNotFound(_0x7045b8,_0x3e694b){return function(_0x55b3a2){if(!_0x55b3a2){_0x7045b8['sendStatus'](0x194);}return _0x55b3a2;};}function handleError(_0x2beb8f,_0x5cd2dc){_0x5cd2dc=_0x5cd2dc||0x1f4;return function(_0x57f9e1){logger[_0x032f('0x23')](_0x57f9e1[_0x032f('0x31')]);if(_0x57f9e1[_0x032f('0x32')]){delete _0x57f9e1[_0x032f('0x32')];}_0x2beb8f[_0x032f('0x28')](_0x5cd2dc)['send'](_0x57f9e1);};}exports[_0x032f('0x33')]=function(_0xb20ed,_0x188fa0){var _0x1d89ae={},_0x492088={},_0x31476c={'count':0x0,'rows':[]};var _0x5070fe=_[_0x032f('0x34')](db[_0x032f('0x35')][_0x032f('0x36')],function(_0x59aef1){return{'name':_0x59aef1[_0x032f('0x37')],'type':_0x59aef1['type']['key']};});_0x492088[_0x032f('0x38')]=_[_0x032f('0x34')](_0x5070fe,'name');_0x492088[_0x032f('0x39')]=_[_0x032f('0x3a')](_0xb20ed['query']);_0x492088['filters']=_['intersection'](_0x492088[_0x032f('0x38')],_0x492088[_0x032f('0x39')]);_0x1d89ae[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x492088[_0x032f('0x38')],qs[_0x032f('0x3d')](_0xb20ed['query'][_0x032f('0x3d')]));_0x1d89ae['attributes']=_0x1d89ae[_0x032f('0x3b')][_0x032f('0x3e')]?_0x1d89ae[_0x032f('0x3b')]:_0x492088[_0x032f('0x38')];if(!_0xb20ed['query'][_0x032f('0x3f')](_0x032f('0x40'))){_0x1d89ae[_0x032f('0x2b')]=qs['limit'](_0xb20ed[_0x032f('0x39')][_0x032f('0x2b')]);_0x1d89ae[_0x032f('0x2a')]=qs['offset'](_0xb20ed[_0x032f('0x39')]['offset']);}_0x1d89ae[_0x032f('0x41')]=qs[_0x032f('0x42')](_0xb20ed[_0x032f('0x39')]['sort']);_0x1d89ae[_0x032f('0x43')]=qs['filters'](_[_0x032f('0x44')](_0xb20ed['query'],_0x492088[_0x032f('0x45')]),_0x5070fe);if(_0xb20ed[_0x032f('0x39')][_0x032f('0x46')]){_0x1d89ae[_0x032f('0x43')]=_[_0x032f('0x47')](_0x1d89ae[_0x032f('0x43')],{'$or':_['map'](_0x5070fe,function(_0x5bd417){if(_0x5bd417['type']!=='VIRTUAL'){var _0x3ef179={};_0x3ef179[_0x5bd417[_0x032f('0x32')]]={'$like':'%'+_0xb20ed[_0x032f('0x39')][_0x032f('0x46')]+'%'};return _0x3ef179;}})});}_0x1d89ae=_['merge']({},_0x1d89ae,_0xb20ed[_0x032f('0x48')]);var _0x5a5e08={'where':_0x1d89ae[_0x032f('0x43')]};return db[_0x032f('0x35')]['count'](_0x5a5e08)[_0x032f('0x1c')](function(_0xb12d1b){_0x31476c[_0x032f('0x49')]=_0xb12d1b;if(_0xb20ed[_0x032f('0x39')][_0x032f('0x4a')]){_0x1d89ae[_0x032f('0x4b')]=[{'all':!![]}];}return db[_0x032f('0x35')][_0x032f('0x4c')](_0x1d89ae);})[_0x032f('0x1c')](function(_0x314d1b){_0x31476c[_0x032f('0x4d')]=_0x314d1b;return _0x31476c;})['then'](respondWithFilteredResult(_0x188fa0,_0x1d89ae))[_0x032f('0x4e')](handleError(_0x188fa0,null));};exports[_0x032f('0x4f')]=function(_0x34ef18,_0x34570d){var _0x260b22={'raw':![],'where':{'id':_0x34ef18[_0x032f('0x50')]['id']}},_0x18b740={};_0x18b740['model']=_[_0x032f('0x3a')](db[_0x032f('0x35')][_0x032f('0x36')]);_0x18b740[_0x032f('0x39')]=_[_0x032f('0x3a')](_0x34ef18[_0x032f('0x39')]);_0x18b740[_0x032f('0x45')]=_[_0x032f('0x3c')](_0x18b740['model'],_0x18b740[_0x032f('0x39')]);_0x260b22[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x18b740[_0x032f('0x38')],qs[_0x032f('0x3d')](_0x34ef18[_0x032f('0x39')][_0x032f('0x3d')]));_0x260b22['attributes']=_0x260b22['attributes']['length']?_0x260b22['attributes']:_0x18b740[_0x032f('0x38')];if(_0x34ef18[_0x032f('0x39')][_0x032f('0x4a')]){_0x260b22[_0x032f('0x4b')]=[{'all':!![]}];}_0x260b22=_[_0x032f('0x47')]({},_0x260b22,_0x34ef18[_0x032f('0x48')]);return db['VtigerConfiguration'][_0x032f('0x51')](_0x260b22)[_0x032f('0x1c')](handleEntityNotFound(_0x34570d,null))[_0x032f('0x1c')](respondWithResult(_0x34570d,null))[_0x032f('0x4e')](handleError(_0x34570d,null));};exports[_0x032f('0x52')]=function(_0x5480b2,_0x45aa74){return db[_0x032f('0x35')][_0x032f('0x52')](_0x5480b2['body'],{})[_0x032f('0x1c')](respondWithResult(_0x45aa74,0xc9))[_0x032f('0x4e')](handleError(_0x45aa74,null));};exports[_0x032f('0x30')]=function(_0x3263fa,_0x53f736){if(_0x3263fa[_0x032f('0x53')]['id']){delete _0x3263fa['body']['id'];}return db[_0x032f('0x35')][_0x032f('0x51')]({'where':{'id':_0x3263fa[_0x032f('0x50')]['id']}})[_0x032f('0x1c')](handleEntityNotFound(_0x53f736,null))[_0x032f('0x1c')](saveUpdates(_0x3263fa[_0x032f('0x53')],null))[_0x032f('0x1c')](respondWithResult(_0x53f736,null))[_0x032f('0x4e')](handleError(_0x53f736,null));};exports[_0x032f('0x54')]=function(_0x201c86,_0xc57f88){return db[_0x032f('0x35')]['find']({'where':{'id':_0x201c86[_0x032f('0x50')]['id']}})[_0x032f('0x1c')](handleEntityNotFound(_0xc57f88,null))[_0x032f('0x1c')](removeEntity(_0xc57f88,null))['catch'](handleError(_0xc57f88,null));};exports[_0x032f('0x55')]=function(_0x24d608,_0x155c59,_0x2177c9){var _0x5a0708={};var _0x1b567f={};var _0x5333bc;var _0x29fba3;return db['VtigerConfiguration'][_0x032f('0x56')]({'where':{'id':_0x24d608['params']['id']}})['then'](handleEntityNotFound(_0x155c59,null))[_0x032f('0x1c')](function(_0x5793f2){if(_0x5793f2){_0x5333bc=_0x5793f2;_0x1b567f[_0x032f('0x38')]=_[_0x032f('0x3a')](db['VtigerField'][_0x032f('0x36')]);_0x1b567f[_0x032f('0x39')]=_[_0x032f('0x3a')](_0x24d608[_0x032f('0x39')]);_0x1b567f['filters']=_['intersection'](_0x1b567f['model'],_0x1b567f[_0x032f('0x39')]);_0x5a0708[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x1b567f[_0x032f('0x38')],qs['fields'](_0x24d608[_0x032f('0x39')][_0x032f('0x3d')]));_0x5a0708[_0x032f('0x3b')]=_0x5a0708[_0x032f('0x3b')][_0x032f('0x3e')]?_0x5a0708[_0x032f('0x3b')]:_0x1b567f[_0x032f('0x38')];_0x5a0708['order']=qs[_0x032f('0x42')](_0x24d608['query'][_0x032f('0x42')]);_0x5a0708['where']=qs['filters'](_[_0x032f('0x44')](_0x24d608[_0x032f('0x39')],_0x1b567f[_0x032f('0x45')]));if(_0x24d608['query']['filter']){_0x5a0708[_0x032f('0x43')]=_['merge'](_0x5a0708[_0x032f('0x43')],{'$or':_['map'](_0x5a0708[_0x032f('0x3b')],function(_0x2fd666){var _0x5c7729={};_0x5c7729[_0x2fd666]={'$like':'%'+_0x24d608[_0x032f('0x39')][_0x032f('0x46')]+'%'};return _0x5c7729;})});}_0x5a0708=_[_0x032f('0x47')]({},_0x5a0708,_0x24d608[_0x032f('0x48')]);return _0x5333bc[_0x032f('0x55')](_0x5a0708);}})[_0x032f('0x1c')](function(_0xeac93a){if(_0xeac93a){_0x29fba3=_0xeac93a[_0x032f('0x3e')];if(!_0x24d608['query']['hasOwnProperty']('nolimit')){_0x5a0708[_0x032f('0x2b')]=qs['limit'](_0x24d608['query']['limit']);_0x5a0708[_0x032f('0x2a')]=qs[_0x032f('0x2a')](_0x24d608[_0x032f('0x39')]['offset']);}return _0x5333bc[_0x032f('0x55')](_0x5a0708);}})[_0x032f('0x1c')](function(_0x35fee7){if(_0x35fee7){return _0x35fee7?{'count':_0x29fba3,'rows':_0x35fee7}:null;}})[_0x032f('0x1c')](respondWithResult(_0x155c59,null))[_0x032f('0x4e')](handleError(_0x155c59,null));};exports[_0x032f('0x57')]=function(_0x17c45a,_0x172957,_0x4a31c5){var _0x45cdd4={};var _0x1b9345={};var _0x27f8f0;var _0x4603d1;return db[_0x032f('0x35')][_0x032f('0x56')]({'where':{'id':_0x17c45a[_0x032f('0x50')]['id']}})[_0x032f('0x1c')](handleEntityNotFound(_0x172957,null))[_0x032f('0x1c')](function(_0x1fdd5b){if(_0x1fdd5b){_0x27f8f0=_0x1fdd5b;_0x1b9345['model']=_[_0x032f('0x3a')](db[_0x032f('0x58')][_0x032f('0x36')]);_0x1b9345[_0x032f('0x39')]=_[_0x032f('0x3a')](_0x17c45a[_0x032f('0x39')]);_0x1b9345['filters']=_['intersection'](_0x1b9345[_0x032f('0x38')],_0x1b9345[_0x032f('0x39')]);_0x45cdd4[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x1b9345['model'],qs[_0x032f('0x3d')](_0x17c45a['query'][_0x032f('0x3d')]));_0x45cdd4[_0x032f('0x3b')]=_0x45cdd4['attributes'][_0x032f('0x3e')]?_0x45cdd4[_0x032f('0x3b')]:_0x1b9345['model'];_0x45cdd4[_0x032f('0x41')]=qs['sort'](_0x17c45a[_0x032f('0x39')][_0x032f('0x42')]);_0x45cdd4[_0x032f('0x43')]=qs[_0x032f('0x45')](_[_0x032f('0x44')](_0x17c45a['query'],_0x1b9345[_0x032f('0x45')]));if(_0x17c45a[_0x032f('0x39')][_0x032f('0x46')]){_0x45cdd4[_0x032f('0x43')]=_[_0x032f('0x47')](_0x45cdd4[_0x032f('0x43')],{'$or':_[_0x032f('0x34')](_0x45cdd4[_0x032f('0x3b')],function(_0xd5725){var _0x1ecd47={};_0x1ecd47[_0xd5725]={'$like':'%'+_0x17c45a[_0x032f('0x39')][_0x032f('0x46')]+'%'};return _0x1ecd47;})});}_0x45cdd4=_['merge']({},_0x45cdd4,_0x17c45a['options']);return _0x27f8f0[_0x032f('0x57')](_0x45cdd4);}})[_0x032f('0x1c')](function(_0xd9dcdd){if(_0xd9dcdd){_0x4603d1=_0xd9dcdd[_0x032f('0x3e')];if(!_0x17c45a['query'][_0x032f('0x3f')](_0x032f('0x40'))){_0x45cdd4[_0x032f('0x2b')]=qs[_0x032f('0x2b')](_0x17c45a[_0x032f('0x39')][_0x032f('0x2b')]);_0x45cdd4['offset']=qs[_0x032f('0x2a')](_0x17c45a[_0x032f('0x39')][_0x032f('0x2a')]);}return _0x27f8f0['getSubjects'](_0x45cdd4);}})[_0x032f('0x1c')](function(_0x458525){if(_0x458525){return _0x458525?{'count':_0x4603d1,'rows':_0x458525}:null;}})[_0x032f('0x1c')](respondWithResult(_0x172957,null))[_0x032f('0x4e')](handleError(_0x172957,null));};exports[_0x032f('0x59')]=function(_0x17401f,_0x27d07e,_0xc88b05){var _0x4c7b21={};var _0x3fb900={};var _0x365744;var _0x2a999d;return db[_0x032f('0x35')][_0x032f('0x56')]({'where':{'id':_0x17401f['params']['id']}})[_0x032f('0x1c')](handleEntityNotFound(_0x27d07e,null))[_0x032f('0x1c')](function(_0x52dfe6){if(_0x52dfe6){_0x365744=_0x52dfe6;_0x3fb900[_0x032f('0x38')]=_[_0x032f('0x3a')](db[_0x032f('0x58')][_0x032f('0x36')]);_0x3fb900[_0x032f('0x39')]=_['keys'](_0x17401f[_0x032f('0x39')]);_0x3fb900['filters']=_[_0x032f('0x3c')](_0x3fb900[_0x032f('0x38')],_0x3fb900['query']);_0x4c7b21[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x3fb900[_0x032f('0x38')],qs[_0x032f('0x3d')](_0x17401f[_0x032f('0x39')][_0x032f('0x3d')]));_0x4c7b21[_0x032f('0x3b')]=_0x4c7b21['attributes'][_0x032f('0x3e')]?_0x4c7b21[_0x032f('0x3b')]:_0x3fb900[_0x032f('0x38')];_0x4c7b21[_0x032f('0x41')]=qs['sort'](_0x17401f['query'][_0x032f('0x42')]);_0x4c7b21[_0x032f('0x43')]=qs['filters'](_[_0x032f('0x44')](_0x17401f['query'],_0x3fb900[_0x032f('0x45')]));if(_0x17401f[_0x032f('0x39')][_0x032f('0x46')]){_0x4c7b21[_0x032f('0x43')]=_[_0x032f('0x47')](_0x4c7b21[_0x032f('0x43')],{'$or':_['map'](_0x4c7b21[_0x032f('0x3b')],function(_0x184293){var _0x42f87a={};_0x42f87a[_0x184293]={'$like':'%'+_0x17401f[_0x032f('0x39')][_0x032f('0x46')]+'%'};return _0x42f87a;})});}_0x4c7b21=_['merge']({},_0x4c7b21,_0x17401f[_0x032f('0x48')]);return _0x365744[_0x032f('0x59')](_0x4c7b21);}})['then'](function(_0x440965){if(_0x440965){_0x2a999d=_0x440965[_0x032f('0x3e')];if(!_0x17401f['query'][_0x032f('0x3f')](_0x032f('0x40'))){_0x4c7b21['limit']=qs[_0x032f('0x2b')](_0x17401f['query']['limit']);_0x4c7b21[_0x032f('0x2a')]=qs['offset'](_0x17401f[_0x032f('0x39')][_0x032f('0x2a')]);}return _0x365744['getDescriptions'](_0x4c7b21);}})['then'](function(_0x377183){if(_0x377183){return _0x377183?{'count':_0x2a999d,'rows':_0x377183}:null;}})[_0x032f('0x1c')](respondWithResult(_0x27d07e,null))['catch'](handleError(_0x27d07e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9258089..9852777 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 _0xdddf=['path','../../config/environment','./intVtigerConfiguration.attributes','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x17d69e,_0x27717d){var _0x4b153f=function(_0x542e11){while(--_0x542e11){_0x17d69e['push'](_0x17d69e['shift']());}};_0x4b153f(++_0x27717d);}(_0xdddf,0xf6));var _0xfddd=function(_0x15e4c6,_0x5b2648){_0x15e4c6=_0x15e4c6-0x0;var _0x2e42bc=_0xdddf[_0x15e4c6];return _0x2e42bc;};'use strict';var _=require(_0xfddd('0x0'));var util=require(_0xfddd('0x1'));var logger=require(_0xfddd('0x2'))(_0xfddd('0x3'));var moment=require(_0xfddd('0x4'));var BPromise=require(_0xfddd('0x5'));var rp=require(_0xfddd('0x6'));var fs=require('fs');var path=require(_0xfddd('0x7'));var rimraf=require('rimraf');var config=require(_0xfddd('0x8'));var attributes=require(_0xfddd('0x9'));module['exports']=function(_0x393e44,_0x5c81e2){return _0x393e44['define']('VtigerConfiguration',attributes,{'tableName':_0xfddd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02ed=['bluebird','request-promise','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x02ed,0x173));var _0xd02e=function(_0x58f0db,_0x4e59e1){_0x58f0db=_0x58f0db-0x0;var _0x24a34e=_0x02ed[_0x58f0db];return _0x24a34e;};'use strict';var _=require('lodash');var util=require(_0xd02e('0x0'));var logger=require(_0xd02e('0x1'))(_0xd02e('0x2'));var moment=require('moment');var BPromise=require(_0xd02e('0x3'));var rp=require(_0xd02e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd02e('0x5'));var config=require(_0xd02e('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xd02e('0x7')]=function(_0x26a37c,_0x5c54e3){return _0x26a37c[_0xd02e('0x8')](_0xd02e('0x9'),attributes,{'tableName':_0xd02e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 396c7ac..46b17b4 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 _0x7f8b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3c67f3,_0x5a6706){var _0x2c2233=function(_0x2294c0){while(--_0x2294c0){_0x3c67f3['push'](_0x3c67f3['shift']());}};_0x2c2233(++_0x5a6706);}(_0x7f8b,0x1f2));var _0xb7f8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f8b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xb7f8('0x0'));var moment=require(_0xb7f8('0x1'));var BPromise=require(_0xb7f8('0x2'));var rs=require(_0xb7f8('0x3'));var fs=require('fs');var Redis=require(_0xb7f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb7f8('0x5'));var logger=require(_0xb7f8('0x6'))(_0xb7f8('0x7'));var config=require(_0xb7f8('0x8'));var jayson=require(_0xb7f8('0x9'));var client=jayson[_0xb7f8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6b075d,_0x170488,_0x63655b){return new BPromise(function(_0x139a8d,_0x130f77){return client['request'](_0x6b075d,_0x63655b)[_0xb7f8('0xb')](function(_0x1003ad){logger[_0xb7f8('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x170488,'request\x20sent');logger['debug'](_0xb7f8('0xd'),_0x170488,'request\x20sent',JSON['stringify'](_0x1003ad));if(_0x1003ad[_0xb7f8('0xe')]){if(_0x1003ad[_0xb7f8('0xe')][_0xb7f8('0xf')]===0x1f4){logger[_0xb7f8('0xe')](_0xb7f8('0x10'),_0x170488,_0x1003ad[_0xb7f8('0xe')][_0xb7f8('0x11')]);return _0x130f77(_0x1003ad[_0xb7f8('0xe')][_0xb7f8('0x11')]);}logger[_0xb7f8('0xe')](_0xb7f8('0x10'),_0x170488,_0x1003ad['error'][_0xb7f8('0x11')]);return _0x139a8d(_0x1003ad[_0xb7f8('0xe')][_0xb7f8('0x11')]);}else{logger[_0xb7f8('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x170488,_0xb7f8('0x12'));_0x139a8d(_0x1003ad[_0xb7f8('0x13')]['message']);}})[_0xb7f8('0x14')](function(_0xc11863){logger[_0xb7f8('0xe')](_0xb7f8('0x10'),_0x170488,_0xc11863);_0x130f77(_0xc11863);});});} \ No newline at end of file +var _0xe146=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis'];(function(_0x330740,_0x58c0c0){var _0x1cb5f2=function(_0xa5c99a){while(--_0xa5c99a){_0x330740['push'](_0x330740['shift']());}};_0x1cb5f2(++_0x58c0c0);}(_0xe146,0x10f));var _0x6e14=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0xe146[_0x19115e];return _0x45bbd4;};'use strict';var _=require(_0x6e14('0x0'));var util=require(_0x6e14('0x1'));var moment=require('moment');var BPromise=require(_0x6e14('0x2'));var rs=require(_0x6e14('0x3'));var fs=require('fs');var Redis=require(_0x6e14('0x4'));var db=require(_0x6e14('0x5'))['db'];var utils=require(_0x6e14('0x6'));var logger=require(_0x6e14('0x7'))(_0x6e14('0x8'));var config=require(_0x6e14('0x9'));var jayson=require(_0x6e14('0xa'));var client=jayson[_0x6e14('0xb')][_0x6e14('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cdb3c,_0x85d4be,_0x158e7d){return new BPromise(function(_0x140b15,_0x299742){return client[_0x6e14('0xd')](_0x1cdb3c,_0x158e7d)['then'](function(_0xf1bd26){logger[_0x6e14('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x85d4be,_0x6e14('0xf'));logger[_0x6e14('0x10')](_0x6e14('0x11'),_0x85d4be,_0x6e14('0xf'),JSON[_0x6e14('0x12')](_0xf1bd26));if(_0xf1bd26[_0x6e14('0x13')]){if(_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x14')]===0x1f4){logger[_0x6e14('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x85d4be,_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x15')]);return _0x299742(_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x15')]);}logger[_0x6e14('0x13')](_0x6e14('0x16'),_0x85d4be,_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x15')]);return _0x140b15(_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x15')]);}else{logger[_0x6e14('0xe')](_0x6e14('0x16'),_0x85d4be,_0x6e14('0xf'));_0x140b15(_0xf1bd26['result'][_0x6e14('0x15')]);}})['catch'](function(_0x5bb6c1){logger[_0x6e14('0x13')](_0x6e14('0x16'),_0x85d4be,_0x5bb6c1);_0x299742(_0x5bb6c1);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 9e87144..80165aa 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 _0x4e6b=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x507d76,_0xaf77ff){var _0x48e2e8=function(_0x1b33f5){while(--_0x1b33f5){_0x507d76['push'](_0x507d76['shift']());}};_0x48e2e8(++_0xaf77ff);}(_0x4e6b,0xbb));var _0xb4e6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4e6b[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xb4e6('0x0'));var util=require(_0xb4e6('0x1'));var path=require(_0xb4e6('0x2'));var timeout=require(_0xb4e6('0x3'));var express=require(_0xb4e6('0x4'));var router=express[_0xb4e6('0x5')]();var auth=require(_0xb4e6('0x6'));var interaction=require(_0xb4e6('0x7'));var config=require(_0xb4e6('0x8'));var controller=require(_0xb4e6('0x9'));router[_0xb4e6('0xa')]('/',auth[_0xb4e6('0xb')](),controller[_0xb4e6('0xc')]);router[_0xb4e6('0xa')](_0xb4e6('0xd'),auth[_0xb4e6('0xb')](),controller[_0xb4e6('0xe')]);router[_0xb4e6('0xf')]('/',auth[_0xb4e6('0xb')](),controller[_0xb4e6('0x10')]);router[_0xb4e6('0x11')]('/:id',auth[_0xb4e6('0xb')](),controller[_0xb4e6('0x12')]);router[_0xb4e6('0x13')](_0xb4e6('0xd'),auth[_0xb4e6('0xb')](),controller[_0xb4e6('0x14')]);module[_0xb4e6('0x15')]=router; \ No newline at end of file +var _0xcfaa=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x4c288b,_0x424d2b){var _0x54896a=function(_0x3a8188){while(--_0x3a8188){_0x4c288b['push'](_0x4c288b['shift']());}};_0x54896a(++_0x424d2b);}(_0xcfaa,0x18f));var _0xacfa=function(_0x5012a0,_0x25c11b){_0x5012a0=_0x5012a0-0x0;var _0x37839d=_0xcfaa[_0x5012a0];return _0x37839d;};'use strict';var multer=require(_0xacfa('0x0'));var util=require(_0xacfa('0x1'));var path=require(_0xacfa('0x2'));var timeout=require(_0xacfa('0x3'));var express=require(_0xacfa('0x4'));var router=express[_0xacfa('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xacfa('0x6'));var config=require(_0xacfa('0x7'));var controller=require(_0xacfa('0x8'));router[_0xacfa('0x9')]('/',auth[_0xacfa('0xa')](),controller[_0xacfa('0xb')]);router[_0xacfa('0x9')](_0xacfa('0xc'),auth[_0xacfa('0xa')](),controller[_0xacfa('0xd')]);router[_0xacfa('0xe')]('/',auth[_0xacfa('0xa')](),controller[_0xacfa('0xf')]);router['put'](_0xacfa('0xc'),auth[_0xacfa('0xa')](),controller[_0xacfa('0x10')]);router[_0xacfa('0x11')](_0xacfa('0xc'),auth[_0xacfa('0xa')](),controller[_0xacfa('0x12')]);module[_0xacfa('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 74a5438..82c530b 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 _0x6453=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x5bbdfc,_0xb09d1a){var _0x76076c=function(_0x18ca3a){while(--_0x18ca3a){_0x5bbdfc['push'](_0x5bbdfc['shift']());}};_0x76076c(++_0xb09d1a);}(_0x6453,0x88));var _0x3645=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x6453[_0x1f7413];return _0x2d2775;};'use strict';var Sequelize=require(_0x3645('0x0'));module[_0x3645('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3645('0x2'),_0x3645('0x3'),_0x3645('0x4'),_0x3645('0x5')),'defaultValue':_0x3645('0x2')},'content':{'type':Sequelize[_0x3645('0x6')]},'key':{'type':Sequelize[_0x3645('0x6')]},'keyType':{'type':Sequelize[_0x3645('0x7')](_0x3645('0x2'),_0x3645('0x3'),_0x3645('0x4'))},'keyContent':{'type':Sequelize[_0x3645('0x6')]},'idField':{'type':Sequelize[_0x3645('0x6')]},'nameField':{'type':Sequelize[_0x3645('0x6')]},'customField':{'type':Sequelize[_0x3645('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3645('0x6')]}}; \ No newline at end of file +var _0xd73c=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x18d479,_0x32bc04){var _0x26b12e=function(_0x2bbbdc){while(--_0x2bbbdc){_0x18d479['push'](_0x18d479['shift']());}};_0x26b12e(++_0x32bc04);}(_0xd73c,0x134));var _0xcd73=function(_0x1cb3ff,_0x40fa84){_0x1cb3ff=_0x1cb3ff-0x0;var _0x4b8018=_0xd73c[_0x1cb3ff];return _0x4b8018;};'use strict';var Sequelize=require(_0xcd73('0x0'));module[_0xcd73('0x1')]={'type':{'type':Sequelize[_0xcd73('0x2')](_0xcd73('0x3'),_0xcd73('0x4'),_0xcd73('0x5'),_0xcd73('0x6')),'defaultValue':_0xcd73('0x3')},'content':{'type':Sequelize[_0xcd73('0x7')]},'key':{'type':Sequelize[_0xcd73('0x7')]},'keyType':{'type':Sequelize[_0xcd73('0x2')](_0xcd73('0x3'),_0xcd73('0x4'),_0xcd73('0x5'))},'keyContent':{'type':Sequelize[_0xcd73('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcd73('0x7')]},'customField':{'type':Sequelize[_0xcd73('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcd73('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index e3c20c0..5b89c94 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 _0xb941=['save','update','then','destroy','name','send','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','params','find','create','body','catch','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb941,0x1ec));var _0x1b94=function(_0x2c55dd,_0x2f6d3f){_0x2c55dd=_0x2c55dd-0x0;var _0xc886bd=_0xb941[_0x2c55dd];return _0xc886bd;};'use strict';var pdf=require(_0x1b94('0x0'));var emlformat=require(_0x1b94('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1b94('0x2'));var jsonpatch=require(_0x1b94('0x3'));var rp=require('request-promise');var moment=require(_0x1b94('0x4'));var BPromise=require(_0x1b94('0x5'));var Mustache=require(_0x1b94('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1b94('0x7'));var ejs=require(_0x1b94('0x8'));var fs=require('fs');var _=require(_0x1b94('0x9'));var squel=require(_0x1b94('0xa'));var crypto=require('crypto');var jsforce=require(_0x1b94('0xb'));var deskjs=require(_0x1b94('0xc'));var toCsv=require(_0x1b94('0x7'));var querystring=require(_0x1b94('0xd'));var Papa=require(_0x1b94('0xe'));var Redis=require(_0x1b94('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1b94('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b94('0x11'))(_0x1b94('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1b94('0x13'))['db'];function respondWithStatusCode(_0x2c6614,_0x42bd8f){_0x42bd8f=_0x42bd8f||0xcc;return function(_0x3a0cce){if(_0x3a0cce){return _0x2c6614[_0x1b94('0x14')](_0x42bd8f);}return _0x2c6614[_0x1b94('0x15')](_0x42bd8f)[_0x1b94('0x16')]();};}function respondWithResult(_0xb60da7,_0x4aa3e0){_0x4aa3e0=_0x4aa3e0||0xc8;return function(_0x58aa86){if(_0x58aa86){return _0xb60da7[_0x1b94('0x15')](_0x4aa3e0)['json'](_0x58aa86);}};}function respondWithFilteredResult(_0x33fcd7,_0x51c556){return function(_0x476969){if(_0x476969){var _0x376a52=_0x476969[_0x1b94('0x17')],_0x5411d3=_0x51c556[_0x1b94('0x18')],_0x1d49d1=_0x51c556[_0x1b94('0x18')]+_0x51c556[_0x1b94('0x19')],_0x272431;if(_0x1d49d1>=_0x376a52){_0x1d49d1=_0x376a52;_0x272431=0xc8;}else{_0x272431=0xce;}_0x33fcd7[_0x1b94('0x15')](_0x272431);return _0x33fcd7[_0x1b94('0x1a')]('Content-Range',_0x5411d3+'-'+_0x1d49d1+'/'+_0x376a52)['json'](_0x476969);}return null;};}function patchUpdates(_0x437ff3){return function(_0x1f5342){try{jsonpatch['apply'](_0x1f5342,_0x437ff3,!![]);}catch(_0x117d80){return BPromise[_0x1b94('0x1b')](_0x117d80);}return _0x1f5342[_0x1b94('0x1c')]();};}function saveUpdates(_0x245b87,_0x1b26fc){return function(_0xbd8b0){if(_0xbd8b0){return _0xbd8b0[_0x1b94('0x1d')](_0x245b87)[_0x1b94('0x1e')](function(_0x4a6e22){return _0x4a6e22;});}return null;};}function removeEntity(_0x2a5b54,_0x59db95){return function(_0x2f9f03){if(_0x2f9f03){return _0x2f9f03[_0x1b94('0x1f')]()[_0x1b94('0x1e')](function(){_0x2a5b54[_0x1b94('0x15')](0xcc)[_0x1b94('0x16')]();});}};}function handleEntityNotFound(_0x456ffe,_0x3a035d){return function(_0x52f73d){if(!_0x52f73d){_0x456ffe['sendStatus'](0x194);}return _0x52f73d;};}function handleError(_0x27360b,_0x1b75c1){_0x1b75c1=_0x1b75c1||0x1f4;return function(_0x2cb693){logger['error'](_0x2cb693['stack']);if(_0x2cb693[_0x1b94('0x20')]){delete _0x2cb693[_0x1b94('0x20')];}_0x27360b['status'](_0x1b75c1)[_0x1b94('0x21')](_0x2cb693);};}exports['index']=function(_0x1b847,_0xe7657c){var _0x3fedc7={},_0x267d70={},_0x24afd8={'count':0x0,'rows':[]};var _0x7c2220=_['map'](db[_0x1b94('0x22')][_0x1b94('0x23')],function(_0x2c1514){return{'name':_0x2c1514[_0x1b94('0x24')],'type':_0x2c1514[_0x1b94('0x25')][_0x1b94('0x26')]};});_0x267d70[_0x1b94('0x27')]=_['map'](_0x7c2220,_0x1b94('0x20'));_0x267d70['query']=_[_0x1b94('0x28')](_0x1b847[_0x1b94('0x29')]);_0x267d70[_0x1b94('0x2a')]=_[_0x1b94('0x2b')](_0x267d70[_0x1b94('0x27')],_0x267d70[_0x1b94('0x29')]);_0x3fedc7['attributes']=_[_0x1b94('0x2b')](_0x267d70[_0x1b94('0x27')],qs[_0x1b94('0x2c')](_0x1b847[_0x1b94('0x29')][_0x1b94('0x2c')]));_0x3fedc7['attributes']=_0x3fedc7[_0x1b94('0x2d')][_0x1b94('0x2e')]?_0x3fedc7[_0x1b94('0x2d')]:_0x267d70['model'];if(!_0x1b847[_0x1b94('0x29')][_0x1b94('0x2f')](_0x1b94('0x30'))){_0x3fedc7['limit']=qs[_0x1b94('0x19')](_0x1b847[_0x1b94('0x29')][_0x1b94('0x19')]);_0x3fedc7[_0x1b94('0x18')]=qs[_0x1b94('0x18')](_0x1b847[_0x1b94('0x29')]['offset']);}_0x3fedc7[_0x1b94('0x31')]=qs['sort'](_0x1b847[_0x1b94('0x29')][_0x1b94('0x32')]);_0x3fedc7[_0x1b94('0x33')]=qs[_0x1b94('0x2a')](_[_0x1b94('0x34')](_0x1b847['query'],_0x267d70[_0x1b94('0x2a')]),_0x7c2220);if(_0x1b847['query'][_0x1b94('0x35')]){_0x3fedc7[_0x1b94('0x33')]=_[_0x1b94('0x36')](_0x3fedc7[_0x1b94('0x33')],{'$or':_[_0x1b94('0x37')](_0x7c2220,function(_0x20910f){if(_0x20910f[_0x1b94('0x25')]!==_0x1b94('0x38')){var _0x12ccbe={};_0x12ccbe[_0x20910f['name']]={'$like':'%'+_0x1b847[_0x1b94('0x29')][_0x1b94('0x35')]+'%'};return _0x12ccbe;}})});}_0x3fedc7=_[_0x1b94('0x36')]({},_0x3fedc7,_0x1b847[_0x1b94('0x39')]);var _0x5c1330={'where':_0x3fedc7['where']};return db['VtigerField'][_0x1b94('0x17')](_0x5c1330)[_0x1b94('0x1e')](function(_0x3e0582){_0x24afd8[_0x1b94('0x17')]=_0x3e0582;if(_0x1b847[_0x1b94('0x29')]['includeAll']){_0x3fedc7[_0x1b94('0x3a')]=[{'all':!![]}];}return db[_0x1b94('0x22')][_0x1b94('0x3b')](_0x3fedc7);})[_0x1b94('0x1e')](function(_0x5451b5){_0x24afd8['rows']=_0x5451b5;return _0x24afd8;})[_0x1b94('0x1e')](respondWithFilteredResult(_0xe7657c,_0x3fedc7))['catch'](handleError(_0xe7657c,null));};exports['show']=function(_0x12536d,_0x327962){var _0x2a595e={'raw':!![],'where':{'id':_0x12536d[_0x1b94('0x3c')]['id']}},_0x15c1be={};_0x15c1be[_0x1b94('0x27')]=_[_0x1b94('0x28')](db[_0x1b94('0x22')][_0x1b94('0x23')]);_0x15c1be[_0x1b94('0x29')]=_[_0x1b94('0x28')](_0x12536d[_0x1b94('0x29')]);_0x15c1be['filters']=_['intersection'](_0x15c1be[_0x1b94('0x27')],_0x15c1be['query']);_0x2a595e[_0x1b94('0x2d')]=_[_0x1b94('0x2b')](_0x15c1be[_0x1b94('0x27')],qs[_0x1b94('0x2c')](_0x12536d[_0x1b94('0x29')][_0x1b94('0x2c')]));_0x2a595e[_0x1b94('0x2d')]=_0x2a595e[_0x1b94('0x2d')][_0x1b94('0x2e')]?_0x2a595e[_0x1b94('0x2d')]:_0x15c1be[_0x1b94('0x27')];if(_0x12536d[_0x1b94('0x29')]['includeAll']){_0x2a595e[_0x1b94('0x3a')]=[{'all':!![]}];}_0x2a595e=_[_0x1b94('0x36')]({},_0x2a595e,_0x12536d['options']);return db[_0x1b94('0x22')][_0x1b94('0x3d')](_0x2a595e)['then'](handleEntityNotFound(_0x327962,null))[_0x1b94('0x1e')](respondWithResult(_0x327962,null))['catch'](handleError(_0x327962,null));};exports[_0x1b94('0x3e')]=function(_0x300894,_0x46351c){return db[_0x1b94('0x22')]['create'](_0x300894[_0x1b94('0x3f')],{})[_0x1b94('0x1e')](respondWithResult(_0x46351c,0xc9))[_0x1b94('0x40')](handleError(_0x46351c,null));};exports[_0x1b94('0x1d')]=function(_0x14e2b6,_0x5ca8e6){if(_0x14e2b6[_0x1b94('0x3f')]['id']){delete _0x14e2b6[_0x1b94('0x3f')]['id'];}return db[_0x1b94('0x22')]['find']({'where':{'id':_0x14e2b6[_0x1b94('0x3c')]['id']}})[_0x1b94('0x1e')](handleEntityNotFound(_0x5ca8e6,null))[_0x1b94('0x1e')](saveUpdates(_0x14e2b6[_0x1b94('0x3f')],null))[_0x1b94('0x1e')](respondWithResult(_0x5ca8e6,null))[_0x1b94('0x40')](handleError(_0x5ca8e6,null));};exports[_0x1b94('0x1f')]=function(_0x4266b5,_0x5d9135){return db[_0x1b94('0x22')][_0x1b94('0x3d')]({'where':{'id':_0x4266b5[_0x1b94('0x3c')]['id']}})[_0x1b94('0x1e')](handleEntityNotFound(_0x5d9135,null))['then'](removeEntity(_0x5d9135,null))[_0x1b94('0x40')](handleError(_0x5d9135,null));}; \ No newline at end of file +var _0x2143=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VtigerField','findAll','rows','catch','show','fields','includeAll','include','options','find','create','body','params','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0x2143,0x114));var _0x3214=function(_0x388134,_0x49904f){_0x388134=_0x388134-0x0;var _0x125f71=_0x2143[_0x388134];return _0x125f71;};'use strict';var pdf=require(_0x3214('0x0'));var emlformat=require(_0x3214('0x1'));var rimraf=require(_0x3214('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3214('0x3'));var moment=require(_0x3214('0x4'));var BPromise=require(_0x3214('0x5'));var Mustache=require(_0x3214('0x6'));var util=require(_0x3214('0x7'));var path=require(_0x3214('0x8'));var sox=require(_0x3214('0x9'));var csv=require(_0x3214('0xa'));var ejs=require(_0x3214('0xb'));var fs=require('fs');var _=require(_0x3214('0xc'));var squel=require(_0x3214('0xd'));var crypto=require(_0x3214('0xe'));var jsforce=require(_0x3214('0xf'));var deskjs=require(_0x3214('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3214('0x11'));var Redis=require(_0x3214('0x12'));var authService=require(_0x3214('0x13'));var qs=require(_0x3214('0x14'));var as=require(_0x3214('0x15'));var hardwareService=require(_0x3214('0x16'));var logger=require('../../config/logger')(_0x3214('0x17'));var utils=require('../../config/utils');var config=require(_0x3214('0x18'));var db=require(_0x3214('0x19'))['db'];function respondWithStatusCode(_0x378d3e,_0x597c99){_0x597c99=_0x597c99||0xcc;return function(_0x352cc0){if(_0x352cc0){return _0x378d3e[_0x3214('0x1a')](_0x597c99);}return _0x378d3e['status'](_0x597c99)['end']();};}function respondWithResult(_0x32e4af,_0x5ec0fb){_0x5ec0fb=_0x5ec0fb||0xc8;return function(_0x17689f){if(_0x17689f){return _0x32e4af[_0x3214('0x1b')](_0x5ec0fb)[_0x3214('0x1c')](_0x17689f);}};}function respondWithFilteredResult(_0x326a58,_0x51ba9e){return function(_0x110e9d){if(_0x110e9d){var _0x4a94fd=_0x110e9d[_0x3214('0x1d')],_0x585fea=_0x51ba9e[_0x3214('0x1e')],_0xa2b205=_0x51ba9e[_0x3214('0x1e')]+_0x51ba9e[_0x3214('0x1f')],_0x4cebec;if(_0xa2b205>=_0x4a94fd){_0xa2b205=_0x4a94fd;_0x4cebec=0xc8;}else{_0x4cebec=0xce;}_0x326a58[_0x3214('0x1b')](_0x4cebec);return _0x326a58[_0x3214('0x20')]('Content-Range',_0x585fea+'-'+_0xa2b205+'/'+_0x4a94fd)[_0x3214('0x1c')](_0x110e9d);}return null;};}function patchUpdates(_0x12db65){return function(_0x24ed9e){try{jsonpatch[_0x3214('0x21')](_0x24ed9e,_0x12db65,!![]);}catch(_0x4fe358){return BPromise['reject'](_0x4fe358);}return _0x24ed9e[_0x3214('0x22')]();};}function saveUpdates(_0x58fc25,_0x46d489){return function(_0x5ebadf){if(_0x5ebadf){return _0x5ebadf[_0x3214('0x23')](_0x58fc25)[_0x3214('0x24')](function(_0x1f7741){return _0x1f7741;});}return null;};}function removeEntity(_0x16e2a5,_0x3cbee7){return function(_0x3698b8){if(_0x3698b8){return _0x3698b8[_0x3214('0x25')]()[_0x3214('0x24')](function(){_0x16e2a5[_0x3214('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e1dd5,_0x4c1c59){return function(_0x173a99){if(!_0x173a99){_0x1e1dd5['sendStatus'](0x194);}return _0x173a99;};}function handleError(_0xc40b47,_0x1e3ec3){_0x1e3ec3=_0x1e3ec3||0x1f4;return function(_0x1936e5){logger[_0x3214('0x26')](_0x1936e5['stack']);if(_0x1936e5['name']){delete _0x1936e5[_0x3214('0x27')];}_0xc40b47[_0x3214('0x1b')](_0x1e3ec3)['send'](_0x1936e5);};}exports[_0x3214('0x28')]=function(_0x31ae63,_0x1d9e68){var _0xa4a839={},_0x5ad679={},_0x166b66={'count':0x0,'rows':[]};var _0x46b7a2=_[_0x3214('0x29')](db['VtigerField'][_0x3214('0x2a')],function(_0x10859b){return{'name':_0x10859b[_0x3214('0x2b')],'type':_0x10859b[_0x3214('0x2c')][_0x3214('0x2d')]};});_0x5ad679[_0x3214('0x2e')]=_[_0x3214('0x29')](_0x46b7a2,_0x3214('0x27'));_0x5ad679[_0x3214('0x2f')]=_[_0x3214('0x30')](_0x31ae63[_0x3214('0x2f')]);_0x5ad679['filters']=_['intersection'](_0x5ad679[_0x3214('0x2e')],_0x5ad679[_0x3214('0x2f')]);_0xa4a839[_0x3214('0x31')]=_[_0x3214('0x32')](_0x5ad679[_0x3214('0x2e')],qs['fields'](_0x31ae63['query']['fields']));_0xa4a839['attributes']=_0xa4a839[_0x3214('0x31')][_0x3214('0x33')]?_0xa4a839[_0x3214('0x31')]:_0x5ad679['model'];if(!_0x31ae63[_0x3214('0x2f')][_0x3214('0x34')](_0x3214('0x35'))){_0xa4a839[_0x3214('0x1f')]=qs[_0x3214('0x1f')](_0x31ae63[_0x3214('0x2f')][_0x3214('0x1f')]);_0xa4a839[_0x3214('0x1e')]=qs['offset'](_0x31ae63['query'][_0x3214('0x1e')]);}_0xa4a839[_0x3214('0x36')]=qs[_0x3214('0x37')](_0x31ae63[_0x3214('0x2f')][_0x3214('0x37')]);_0xa4a839[_0x3214('0x38')]=qs[_0x3214('0x39')](_[_0x3214('0x3a')](_0x31ae63[_0x3214('0x2f')],_0x5ad679[_0x3214('0x39')]),_0x46b7a2);if(_0x31ae63[_0x3214('0x2f')]['filter']){_0xa4a839[_0x3214('0x38')]=_['merge'](_0xa4a839[_0x3214('0x38')],{'$or':_[_0x3214('0x29')](_0x46b7a2,function(_0x5ffb99){if(_0x5ffb99['type']!=='VIRTUAL'){var _0x1f8a8b={};_0x1f8a8b[_0x5ffb99[_0x3214('0x27')]]={'$like':'%'+_0x31ae63[_0x3214('0x2f')][_0x3214('0x3b')]+'%'};return _0x1f8a8b;}})});}_0xa4a839=_[_0x3214('0x3c')]({},_0xa4a839,_0x31ae63['options']);var _0x24634c={'where':_0xa4a839[_0x3214('0x38')]};return db[_0x3214('0x3d')]['count'](_0x24634c)[_0x3214('0x24')](function(_0xd14057){_0x166b66[_0x3214('0x1d')]=_0xd14057;if(_0x31ae63[_0x3214('0x2f')]['includeAll']){_0xa4a839['include']=[{'all':!![]}];}return db[_0x3214('0x3d')][_0x3214('0x3e')](_0xa4a839);})[_0x3214('0x24')](function(_0x14087c){_0x166b66[_0x3214('0x3f')]=_0x14087c;return _0x166b66;})[_0x3214('0x24')](respondWithFilteredResult(_0x1d9e68,_0xa4a839))[_0x3214('0x40')](handleError(_0x1d9e68,null));};exports[_0x3214('0x41')]=function(_0x4a0e07,_0x33fe1e){var _0x5ee04b={'raw':!![],'where':{'id':_0x4a0e07['params']['id']}},_0x76afa3={};_0x76afa3['model']=_[_0x3214('0x30')](db[_0x3214('0x3d')][_0x3214('0x2a')]);_0x76afa3[_0x3214('0x2f')]=_[_0x3214('0x30')](_0x4a0e07[_0x3214('0x2f')]);_0x76afa3[_0x3214('0x39')]=_[_0x3214('0x32')](_0x76afa3[_0x3214('0x2e')],_0x76afa3['query']);_0x5ee04b[_0x3214('0x31')]=_[_0x3214('0x32')](_0x76afa3[_0x3214('0x2e')],qs[_0x3214('0x42')](_0x4a0e07['query']['fields']));_0x5ee04b[_0x3214('0x31')]=_0x5ee04b[_0x3214('0x31')][_0x3214('0x33')]?_0x5ee04b[_0x3214('0x31')]:_0x76afa3[_0x3214('0x2e')];if(_0x4a0e07[_0x3214('0x2f')][_0x3214('0x43')]){_0x5ee04b[_0x3214('0x44')]=[{'all':!![]}];}_0x5ee04b=_[_0x3214('0x3c')]({},_0x5ee04b,_0x4a0e07[_0x3214('0x45')]);return db['VtigerField'][_0x3214('0x46')](_0x5ee04b)[_0x3214('0x24')](handleEntityNotFound(_0x33fe1e,null))[_0x3214('0x24')](respondWithResult(_0x33fe1e,null))[_0x3214('0x40')](handleError(_0x33fe1e,null));};exports[_0x3214('0x47')]=function(_0x46a5f9,_0x119c02){return db[_0x3214('0x3d')][_0x3214('0x47')](_0x46a5f9[_0x3214('0x48')],{})['then'](respondWithResult(_0x119c02,0xc9))['catch'](handleError(_0x119c02,null));};exports[_0x3214('0x23')]=function(_0x55a80b,_0x447542){if(_0x55a80b['body']['id']){delete _0x55a80b[_0x3214('0x48')]['id'];}return db[_0x3214('0x3d')]['find']({'where':{'id':_0x55a80b['params']['id']}})[_0x3214('0x24')](handleEntityNotFound(_0x447542,null))[_0x3214('0x24')](saveUpdates(_0x55a80b[_0x3214('0x48')],null))['then'](respondWithResult(_0x447542,null))['catch'](handleError(_0x447542,null));};exports[_0x3214('0x25')]=function(_0x2a402f,_0x4d9bb8){return db[_0x3214('0x3d')][_0x3214('0x46')]({'where':{'id':_0x2a402f[_0x3214('0x49')]['id']}})[_0x3214('0x24')](handleEntityNotFound(_0x4d9bb8,null))[_0x3214('0x24')](removeEntity(_0x4d9bb8,null))[_0x3214('0x40')](handleError(_0x4d9bb8,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 83d059b..75b6389 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 _0xaa88=['int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField'];(function(_0x544f46,_0x168b65){var _0x21e7f2=function(_0x4e22a8){while(--_0x4e22a8){_0x544f46['push'](_0x544f46['shift']());}};_0x21e7f2(++_0x168b65);}(_0xaa88,0x137));var _0x8aa8=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0xaa88[_0x91d019];return _0x19de1f;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[{'name':_0x8aa8('0xc'),'fields':[_0x8aa8('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['path','rimraf','./intVtigerField.attributes','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x3090b6,_0x233710){var _0x8fdb83=function(_0x54f7b7){while(--_0x54f7b7){_0x3090b6['push'](_0x3090b6['shift']());}};_0x8fdb83(++_0x233710);}(_0x70e0,0x17b));var _0x070e=function(_0x5cf694,_0x7be551){_0x5cf694=_0x5cf694-0x0;var _0x3af377=_0x70e0[_0x5cf694];return _0x3af377;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VtigerField',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0xa'),_0x070e('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 6d125fc..a66691b 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 _0x4c4d=['lodash','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0xcadf4c,_0x32eb3b){_0xcadf4c=_0xcadf4c-0x0;var _0x29001e=_0x4c4d[_0xcadf4c];return _0x29001e;};'use strict';var _=require(_0xd4c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4c4('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4c4('0x2'));var logger=require(_0xd4c4('0x3'))(_0xd4c4('0x4'));var config=require(_0xd4c4('0x5'));var jayson=require(_0xd4c4('0x6'));var client=jayson[_0xd4c4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x421581,_0x463c30,_0x1691e5){return new BPromise(function(_0xbe6e8d,_0x350f8f){return client['request'](_0x421581,_0x1691e5)[_0xd4c4('0x8')](function(_0xf97702){logger[_0xd4c4('0x9')](_0xd4c4('0xa'),_0x463c30,_0xd4c4('0xb'));logger[_0xd4c4('0xc')](_0xd4c4('0xd'),_0x463c30,_0xd4c4('0xb'),JSON[_0xd4c4('0xe')](_0xf97702));if(_0xf97702['error']){if(_0xf97702[_0xd4c4('0xf')]['code']===0x1f4){logger[_0xd4c4('0xf')](_0xd4c4('0xa'),_0x463c30,_0xf97702['error'][_0xd4c4('0x10')]);return _0x350f8f(_0xf97702['error']['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x463c30,_0xf97702[_0xd4c4('0xf')][_0xd4c4('0x10')]);return _0xbe6e8d(_0xf97702['error'][_0xd4c4('0x10')]);}else{logger[_0xd4c4('0x9')](_0xd4c4('0xa'),_0x463c30,_0xd4c4('0xb'));_0xbe6e8d(_0xf97702[_0xd4c4('0x11')][_0xd4c4('0x10')]);}})[_0xd4c4('0x12')](function(_0x3d514c){logger[_0xd4c4('0xf')]('VtigerField,\x20%s,\x20%s',_0x463c30,_0x3d514c);_0x350f8f(_0x3d514c);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('VtigerField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 33ad419..60aaf9a 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 _0xabdc=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','/:id','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x8ef77e,_0x45d725){var _0x275ce2=function(_0x4faf39){while(--_0x4faf39){_0x8ef77e['push'](_0x8ef77e['shift']());}};_0x275ce2(++_0x45d725);}(_0xabdc,0x1de));var _0xcabd=function(_0x30c24f,_0x2d8c00){_0x30c24f=_0x30c24f-0x0;var _0x9cc496=_0xabdc[_0x30c24f];return _0x9cc496;};'use strict';var multer=require('multer');var util=require(_0xcabd('0x0'));var path=require(_0xcabd('0x1'));var timeout=require(_0xcabd('0x2'));var express=require(_0xcabd('0x3'));var router=express[_0xcabd('0x4')]();var auth=require(_0xcabd('0x5'));var interaction=require(_0xcabd('0x6'));var config=require(_0xcabd('0x7'));var controller=require(_0xcabd('0x8'));router[_0xcabd('0x9')]('/',auth[_0xcabd('0xa')](),controller[_0xcabd('0xb')]);router[_0xcabd('0x9')]('/:id',auth[_0xcabd('0xa')](),controller[_0xcabd('0xc')]);router['get'](_0xcabd('0xd'),auth[_0xcabd('0xa')](),controller[_0xcabd('0xe')]);router['get'](_0xcabd('0xf'),auth['isAuthenticated'](),controller[_0xcabd('0x10')]);router[_0xcabd('0x11')]('/',auth[_0xcabd('0xa')](),controller['create']);router['post'](_0xcabd('0xd'),auth[_0xcabd('0xa')](),controller['addConfiguration']);router[_0xcabd('0x12')](_0xcabd('0x13'),auth[_0xcabd('0xa')](),controller[_0xcabd('0x14')]);router['delete']('/:id',auth[_0xcabd('0xa')](),controller['destroy']);module[_0xcabd('0x15')]=router; \ No newline at end of file +var _0x4ec1=['/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0x4ec1,0x11e));var _0x14ec=function(_0x150d70,_0x2da39b){_0x150d70=_0x150d70-0x0;var _0x57dff4=_0x4ec1[_0x150d70];return _0x57dff4;};'use strict';var multer=require('multer');var util=require(_0x14ec('0x0'));var path=require(_0x14ec('0x1'));var timeout=require(_0x14ec('0x2'));var express=require(_0x14ec('0x3'));var router=express[_0x14ec('0x4')]();var auth=require(_0x14ec('0x5'));var interaction=require(_0x14ec('0x6'));var config=require(_0x14ec('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x14ec('0x8')]('/',auth[_0x14ec('0x9')](),controller[_0x14ec('0xa')]);router['get'](_0x14ec('0xb'),auth[_0x14ec('0x9')](),controller[_0x14ec('0xc')]);router[_0x14ec('0x8')](_0x14ec('0xd'),auth[_0x14ec('0x9')](),controller['getConfigurations']);router[_0x14ec('0x8')](_0x14ec('0xe'),auth['isAuthenticated'](),controller[_0x14ec('0xf')]);router['post']('/',auth[_0x14ec('0x9')](),controller[_0x14ec('0x10')]);router[_0x14ec('0x11')](_0x14ec('0xd'),auth['isAuthenticated'](),controller[_0x14ec('0x12')]);router[_0x14ec('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x14ec('0x14')]);router[_0x14ec('0x15')](_0x14ec('0xb'),auth['isAuthenticated'](),controller[_0x14ec('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index fa5a1f6..da34dca 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 _0xdde3=['ENUM','password','token','integrationTab','newTab','sequelize','exports','username','STRING','remoteUri'];(function(_0x2fa811,_0x192e2a){var _0x21f99a=function(_0x2a3dc4){while(--_0x2a3dc4){_0x2fa811['push'](_0x2fa811['shift']());}};_0x21f99a(++_0x192e2a);}(_0xdde3,0xf5));var _0x3dde=function(_0x240928,_0x4d8979){_0x240928=_0x240928-0x0;var _0x3d17cd=_0xdde3[_0x240928];return _0x3d17cd;};'use strict';var Sequelize=require(_0x3dde('0x0'));module[_0x3dde('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x3dde('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x3dde('0x3')]},'remoteUri':{'type':Sequelize[_0x3dde('0x3')],'unique':_0x3dde('0x4')},'authType':{'type':Sequelize[_0x3dde('0x5')](_0x3dde('0x6'),_0x3dde('0x7')),'defaultValue':_0x3dde('0x6')},'serverUrl':{'type':Sequelize[_0x3dde('0x3')]},'type':{'type':Sequelize[_0x3dde('0x5')](_0x3dde('0x8'),_0x3dde('0x9')),'defaultValue':_0x3dde('0x8')}}; \ No newline at end of file +var _0x3afd=['token','password','integrationTab','newTab','sequelize','exports','STRING','remoteUri','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3afd,0x1d8));var _0xd3af=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0x3afd[_0x2c18a8];return _0x1e009a;};'use strict';var Sequelize=require(_0xd3af('0x0'));module[_0xd3af('0x1')]={'name':{'type':Sequelize[_0xd3af('0x2')]},'description':{'type':Sequelize[_0xd3af('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xd3af('0x2')]},'token':{'type':Sequelize[_0xd3af('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd3af('0x3')},'authType':{'type':Sequelize[_0xd3af('0x4')]('password',_0xd3af('0x5')),'defaultValue':_0xd3af('0x6')},'serverUrl':{'type':Sequelize[_0xd3af('0x2')]},'type':{'type':Sequelize['ENUM'](_0xd3af('0x7'),_0xd3af('0x8')),'defaultValue':_0xd3af('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4115cc1..a2ba6bc 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 _0xff58=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','Content-Range','apply','reject','save','update','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','VIRTUAL','options','count','includeAll','include','ZendeskAccount','findAll','rows','catch','show','params','keys','filters','find','create','body','destroy','findOne','pick','merge','getConfigurations','AccountId','Subjects','Descriptions','getDescriptions','getFields','username','password','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','group','assignee','includes','position','title','system_field_options','custom_field_options','test','Wrong\x20credentials','statusCode','html-pdf','eml-format'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0xff58,0xf8));var _0x8ff5=function(_0x334d5b,_0x33d99c){_0x334d5b=_0x334d5b-0x0;var _0x46a4a0=_0xff58[_0x334d5b];return _0x46a4a0;};'use strict';var pdf=require(_0x8ff5('0x0'));var emlformat=require(_0x8ff5('0x1'));var rimraf=require(_0x8ff5('0x2'));var zipdir=require(_0x8ff5('0x3'));var jsonpatch=require(_0x8ff5('0x4'));var rp=require(_0x8ff5('0x5'));var moment=require('moment');var BPromise=require(_0x8ff5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8ff5('0x7'));var sox=require(_0x8ff5('0x8'));var csv=require(_0x8ff5('0x9'));var ejs=require(_0x8ff5('0xa'));var fs=require('fs');var _=require(_0x8ff5('0xb'));var squel=require('squel');var crypto=require(_0x8ff5('0xc'));var jsforce=require(_0x8ff5('0xd'));var deskjs=require(_0x8ff5('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ff5('0xf'));var Redis=require(_0x8ff5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8ff5('0x11'));var as=require(_0x8ff5('0x12'));var hardwareService=require(_0x8ff5('0x13'));var logger=require(_0x8ff5('0x14'))('api');var utils=require(_0x8ff5('0x15'));var config=require(_0x8ff5('0x16'));var db=require(_0x8ff5('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8ff5('0x18'));var client=jayson[_0x8ff5('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x150681,_0x29b643,_0x3793f2){if(_0x3793f2){var _0x3c5d9f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c5d9f['test'](_0x29b643)){return _0x150681;}else{throw new db['Sequelize'][(_0x8ff5('0x1a'))](_0x8ff5('0x1b'));}}else{return _0x150681;}}function respondWithRpcPromise(_0xca7c71,_0x5cae5e,_0x11e597,_0x1b9bde){return new BPromise(function(_0x5d513f,_0x1f7ade){var _0x245cdf=_0x1b9bde||client;return _0x245cdf[_0x8ff5('0x1c')](_0xca7c71,_0x11e597)[_0x8ff5('0x1d')](function(_0x3a6d1f){logger[_0x8ff5('0x1e')](_0x8ff5('0x1f'),_0x5cae5e,_0x8ff5('0x20'));logger[_0x8ff5('0x21')](_0x8ff5('0x22'),_0x5cae5e,_0x8ff5('0x20'),JSON[_0x8ff5('0x23')](_0x3a6d1f));if(_0x3a6d1f['error']){if(_0x3a6d1f[_0x8ff5('0x24')][_0x8ff5('0x25')]===0x1f4){logger[_0x8ff5('0x24')]('ZendeskAccount,\x20%s,\x20%s',_0x5cae5e,_0x3a6d1f[_0x8ff5('0x24')][_0x8ff5('0x26')]);return _0x1f7ade(_0x3a6d1f['error'][_0x8ff5('0x26')]);}logger[_0x8ff5('0x24')](_0x8ff5('0x1f'),_0x5cae5e,_0x3a6d1f['error']['message']);return _0x5d513f(_0x3a6d1f[_0x8ff5('0x24')][_0x8ff5('0x26')]);}else{logger['info'](_0x8ff5('0x1f'),_0x5cae5e,'request\x20sent');_0x5d513f(_0x3a6d1f[_0x8ff5('0x27')][_0x8ff5('0x26')]);}})['catch'](function(_0x3114d6){logger['error'](_0x8ff5('0x1f'),_0x5cae5e,_0x3114d6);_0x1f7ade(_0x3114d6);});});}function respondWithStatusCode(_0x1f66d2,_0x595a21){_0x595a21=_0x595a21||0xcc;return function(_0xfcc5fe){if(_0xfcc5fe){return _0x1f66d2[_0x8ff5('0x28')](_0x595a21);}return _0x1f66d2['status'](_0x595a21)[_0x8ff5('0x29')]();};}function respondWithResult(_0x4b213e,_0x3dffc3){_0x3dffc3=_0x3dffc3||0xc8;return function(_0xc6d7d8){if(_0xc6d7d8){return _0x4b213e[_0x8ff5('0x2a')](_0x3dffc3)[_0x8ff5('0x2b')](_0xc6d7d8);}};}function respondWithFilteredResult(_0x59dde0,_0xcac6c7){return function(_0x57d6f3){if(_0x57d6f3){var _0x1170d3=_0x57d6f3['count'],_0x1ccdcb=_0xcac6c7['offset'],_0x346b3b=_0xcac6c7['offset']+_0xcac6c7['limit'],_0x19c3c3;if(_0x346b3b>=_0x1170d3){_0x346b3b=_0x1170d3;_0x19c3c3=0xc8;}else{_0x19c3c3=0xce;}_0x59dde0[_0x8ff5('0x2a')](_0x19c3c3);return _0x59dde0['set'](_0x8ff5('0x2c'),_0x1ccdcb+'-'+_0x346b3b+'/'+_0x1170d3)['json'](_0x57d6f3);}return null;};}function patchUpdates(_0x426373){return function(_0x32c2a0){try{jsonpatch[_0x8ff5('0x2d')](_0x32c2a0,_0x426373,!![]);}catch(_0x32c40a){return BPromise[_0x8ff5('0x2e')](_0x32c40a);}return _0x32c2a0[_0x8ff5('0x2f')]();};}function saveUpdates(_0x1f3e52,_0x1e5fb2){return function(_0x30babd){if(_0x30babd){return _0x30babd[_0x8ff5('0x30')](_0x1f3e52)[_0x8ff5('0x1d')](function(_0x297d12){return _0x297d12;});}return null;};}function removeEntity(_0x73f3ea,_0x574c60){return function(_0x53d9a7){if(_0x53d9a7){return _0x53d9a7['destroy']()[_0x8ff5('0x1d')](function(){_0x73f3ea[_0x8ff5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f944,_0x15617f){return function(_0x49706b){if(!_0x49706b){_0x59f944['sendStatus'](0x194);}return _0x49706b;};}function handleError(_0x4619ce,_0xc2ce6f){_0xc2ce6f=_0xc2ce6f||0x1f4;return function(_0x9a4066){logger[_0x8ff5('0x24')](_0x9a4066['stack']);if(_0x9a4066[_0x8ff5('0x31')]){delete _0x9a4066[_0x8ff5('0x31')];}_0x4619ce[_0x8ff5('0x2a')](_0xc2ce6f)[_0x8ff5('0x32')](_0x9a4066);};}exports['index']=function(_0x51dd7f,_0x194de6){var _0xdcd03f={},_0x34c611={},_0x377fc7={'count':0x0,'rows':[]};var _0x56d230=_[_0x8ff5('0x33')](db['ZendeskAccount'][_0x8ff5('0x34')],function(_0x394008){return{'name':_0x394008[_0x8ff5('0x35')],'type':_0x394008[_0x8ff5('0x36')][_0x8ff5('0x37')]};});_0x34c611[_0x8ff5('0x38')]=_[_0x8ff5('0x33')](_0x56d230,_0x8ff5('0x31'));_0x34c611[_0x8ff5('0x39')]=_['keys'](_0x51dd7f[_0x8ff5('0x39')]);_0x34c611['filters']=_[_0x8ff5('0x3a')](_0x34c611[_0x8ff5('0x38')],_0x34c611[_0x8ff5('0x39')]);_0xdcd03f[_0x8ff5('0x3b')]=_[_0x8ff5('0x3a')](_0x34c611[_0x8ff5('0x38')],qs[_0x8ff5('0x3c')](_0x51dd7f[_0x8ff5('0x39')]['fields']));_0xdcd03f[_0x8ff5('0x3b')]=_0xdcd03f[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0xdcd03f[_0x8ff5('0x3b')]:_0x34c611[_0x8ff5('0x38')];if(!_0x51dd7f['query'][_0x8ff5('0x3e')](_0x8ff5('0x3f'))){_0xdcd03f[_0x8ff5('0x40')]=qs[_0x8ff5('0x40')](_0x51dd7f[_0x8ff5('0x39')][_0x8ff5('0x40')]);_0xdcd03f[_0x8ff5('0x41')]=qs[_0x8ff5('0x41')](_0x51dd7f[_0x8ff5('0x39')][_0x8ff5('0x41')]);}_0xdcd03f[_0x8ff5('0x42')]=qs[_0x8ff5('0x43')](_0x51dd7f['query'][_0x8ff5('0x43')]);_0xdcd03f[_0x8ff5('0x44')]=qs['filters'](_['pick'](_0x51dd7f['query'],_0x34c611['filters']),_0x56d230);if(_0x51dd7f['query'][_0x8ff5('0x45')]){_0xdcd03f[_0x8ff5('0x44')]=_['merge'](_0xdcd03f['where'],{'$or':_[_0x8ff5('0x33')](_0x56d230,function(_0x11f990){if(_0x11f990[_0x8ff5('0x36')]!==_0x8ff5('0x46')){var _0x3c4499={};_0x3c4499[_0x11f990[_0x8ff5('0x31')]]={'$like':'%'+_0x51dd7f[_0x8ff5('0x39')]['filter']+'%'};return _0x3c4499;}})});}_0xdcd03f=_['merge']({},_0xdcd03f,_0x51dd7f[_0x8ff5('0x47')]);var _0x137501={'where':_0xdcd03f[_0x8ff5('0x44')]};return db['ZendeskAccount'][_0x8ff5('0x48')](_0x137501)[_0x8ff5('0x1d')](function(_0x3bcf3d){_0x377fc7[_0x8ff5('0x48')]=_0x3bcf3d;if(_0x51dd7f[_0x8ff5('0x39')][_0x8ff5('0x49')]){_0xdcd03f[_0x8ff5('0x4a')]=[{'all':!![]}];}return db[_0x8ff5('0x4b')][_0x8ff5('0x4c')](_0xdcd03f);})['then'](function(_0x1a595a){_0x377fc7[_0x8ff5('0x4d')]=_0x1a595a;return _0x377fc7;})['then'](respondWithFilteredResult(_0x194de6,_0xdcd03f))[_0x8ff5('0x4e')](handleError(_0x194de6,null));};exports[_0x8ff5('0x4f')]=function(_0x27b736,_0xd531ca){var _0x1ecbc6={'raw':![],'where':{'id':_0x27b736[_0x8ff5('0x50')]['id']}},_0x3029e8={};_0x3029e8[_0x8ff5('0x38')]=_[_0x8ff5('0x51')](db[_0x8ff5('0x4b')][_0x8ff5('0x34')]);_0x3029e8['query']=_[_0x8ff5('0x51')](_0x27b736['query']);_0x3029e8[_0x8ff5('0x52')]=_['intersection'](_0x3029e8['model'],_0x3029e8[_0x8ff5('0x39')]);_0x1ecbc6[_0x8ff5('0x3b')]=_['intersection'](_0x3029e8[_0x8ff5('0x38')],qs['fields'](_0x27b736[_0x8ff5('0x39')]['fields']));_0x1ecbc6[_0x8ff5('0x3b')]=_0x1ecbc6[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0x1ecbc6[_0x8ff5('0x3b')]:_0x3029e8[_0x8ff5('0x38')];if(_0x27b736[_0x8ff5('0x39')][_0x8ff5('0x49')]){_0x1ecbc6[_0x8ff5('0x4a')]=[{'all':!![]}];}_0x1ecbc6=_['merge']({},_0x1ecbc6,_0x27b736['options']);return db[_0x8ff5('0x4b')][_0x8ff5('0x53')](_0x1ecbc6)[_0x8ff5('0x1d')](handleEntityNotFound(_0xd531ca,null))['then'](respondWithResult(_0xd531ca,null))[_0x8ff5('0x4e')](handleError(_0xd531ca,null));};exports[_0x8ff5('0x54')]=function(_0x5aa5a4,_0x70b0c9){return db[_0x8ff5('0x4b')][_0x8ff5('0x54')](_0x5aa5a4[_0x8ff5('0x55')],{})[_0x8ff5('0x1d')](respondWithResult(_0x70b0c9,0xc9))[_0x8ff5('0x4e')](handleError(_0x70b0c9,null));};exports[_0x8ff5('0x30')]=function(_0x50a3c3,_0x4fde2a){if(_0x50a3c3['body']['id']){delete _0x50a3c3[_0x8ff5('0x55')]['id'];}return db[_0x8ff5('0x4b')]['find']({'where':{'id':_0x50a3c3[_0x8ff5('0x50')]['id']}})['then'](handleEntityNotFound(_0x4fde2a,null))[_0x8ff5('0x1d')](saveUpdates(_0x50a3c3[_0x8ff5('0x55')],null))[_0x8ff5('0x1d')](respondWithResult(_0x4fde2a,null))[_0x8ff5('0x4e')](handleError(_0x4fde2a,null));};exports[_0x8ff5('0x56')]=function(_0x5dc841,_0x3ccc23){return db['ZendeskAccount'][_0x8ff5('0x53')]({'where':{'id':_0x5dc841[_0x8ff5('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ccc23,null))['then'](removeEntity(_0x3ccc23,null))[_0x8ff5('0x4e')](handleError(_0x3ccc23,null));};exports['getConfigurations']=function(_0x235b96,_0x42f0eb,_0x137220){var _0x21560a={};var _0x3b34ce={};var _0x4edf85;var _0x851d79;return db['ZendeskAccount'][_0x8ff5('0x57')]({'where':{'id':_0x235b96[_0x8ff5('0x50')]['id']}})[_0x8ff5('0x1d')](handleEntityNotFound(_0x42f0eb,null))['then'](function(_0x17c7fe){if(_0x17c7fe){_0x4edf85=_0x17c7fe;_0x3b34ce[_0x8ff5('0x38')]=_[_0x8ff5('0x51')](db['ZendeskConfiguration'][_0x8ff5('0x34')]);_0x3b34ce[_0x8ff5('0x39')]=_[_0x8ff5('0x51')](_0x235b96[_0x8ff5('0x39')]);_0x3b34ce[_0x8ff5('0x52')]=_['intersection'](_0x3b34ce['model'],_0x3b34ce['query']);_0x21560a[_0x8ff5('0x3b')]=_['intersection'](_0x3b34ce[_0x8ff5('0x38')],qs[_0x8ff5('0x3c')](_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x3c')]));_0x21560a[_0x8ff5('0x3b')]=_0x21560a[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0x21560a[_0x8ff5('0x3b')]:_0x3b34ce[_0x8ff5('0x38')];_0x21560a['order']=qs[_0x8ff5('0x43')](_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x43')]);_0x21560a[_0x8ff5('0x44')]=qs[_0x8ff5('0x52')](_[_0x8ff5('0x58')](_0x235b96[_0x8ff5('0x39')],_0x3b34ce[_0x8ff5('0x52')]));if(_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x45')]){_0x21560a['where']=_[_0x8ff5('0x59')](_0x21560a[_0x8ff5('0x44')],{'$or':_[_0x8ff5('0x33')](_0x21560a['attributes'],function(_0x133472){var _0x17eb09={};_0x17eb09[_0x133472]={'$like':'%'+_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x45')]+'%'};return _0x17eb09;})});}_0x21560a=_[_0x8ff5('0x59')]({},_0x21560a,_0x235b96[_0x8ff5('0x47')]);return _0x4edf85[_0x8ff5('0x5a')](_0x21560a);}})[_0x8ff5('0x1d')](function(_0x7bf644){if(_0x7bf644){_0x851d79=_0x7bf644[_0x8ff5('0x3d')];if(!_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x3e')](_0x8ff5('0x3f'))){_0x21560a[_0x8ff5('0x40')]=qs[_0x8ff5('0x40')](_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x40')]);_0x21560a[_0x8ff5('0x41')]=qs['offset'](_0x235b96['query']['offset']);}return _0x4edf85[_0x8ff5('0x5a')](_0x21560a);}})[_0x8ff5('0x1d')](function(_0x4c45b3){if(_0x4c45b3){return _0x4c45b3?{'count':_0x851d79,'rows':_0x4c45b3}:null;}})[_0x8ff5('0x1d')](respondWithResult(_0x42f0eb,null))[_0x8ff5('0x4e')](handleError(_0x42f0eb,null));};exports['addConfiguration']=function(_0x3eb8ad,_0x4647b8,_0x4d9961){if(_0x3eb8ad['body']['id']){delete _0x3eb8ad['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x3eb8ad[_0x8ff5('0x50')]['id']}})['then'](handleEntityNotFound(_0x4647b8,null))['then'](function(_0xa368d0){if(_0xa368d0){_0x3eb8ad[_0x8ff5('0x55')][_0x8ff5('0x5b')]=_0xa368d0['id'];_0x3eb8ad[_0x8ff5('0x55')][_0x8ff5('0x5c')]=integrations['getSubjects'](_0x3eb8ad[_0x8ff5('0x55')]['channel'],_0x3eb8ad[_0x8ff5('0x55')][_0x8ff5('0x36')]);_0x3eb8ad[_0x8ff5('0x55')][_0x8ff5('0x5d')]=integrations[_0x8ff5('0x5e')](_0x3eb8ad[_0x8ff5('0x55')]['channel'],_0x3eb8ad[_0x8ff5('0x55')]['type']);return db['ZendeskConfiguration'][_0x8ff5('0x54')](_0x3eb8ad['body'],{'include':[{'model':db['ZendeskField'],'as':_0x8ff5('0x5c')},{'model':db['ZendeskField'],'as':_0x8ff5('0x5d')}]});}return null;})['then'](respondWithResult(_0x4647b8,null))['catch'](handleError(_0x4647b8,null));};exports[_0x8ff5('0x5f')]=function(_0x133be3,_0x14b807,_0x5bfc5e){var _0x4b9f67='';return db[_0x8ff5('0x4b')]['findOne']({'where':{'id':_0x133be3[_0x8ff5('0x50')]['id']},'attributes':['id',_0x8ff5('0x60'),_0x8ff5('0x61'),'token',_0x8ff5('0x62'),_0x8ff5('0x63')]})[_0x8ff5('0x1d')](handleEntityNotFound(_0x14b807,null))[_0x8ff5('0x1d')](function(_0x3682c3){if(_0x3682c3){_0x4b9f67=_0x3682c3[_0x8ff5('0x63')];var _0x28eef1=_0x4b9f67['slice'](-0x1);if(_0x28eef1==='/'){_0x4b9f67=_0x4b9f67[_0x8ff5('0x64')](0x0,_0x4b9f67[_0x8ff5('0x65')](_0x28eef1));}var _0x6872f1={'method':'GET','uri':util[_0x8ff5('0x66')](_0x8ff5('0x67'),_0x4b9f67,_0x8ff5('0x68')),'json':!![]};switch(_0x3682c3['authType']){case _0x8ff5('0x61'):_0x6872f1[_0x8ff5('0x69')]={'Authorization':util[_0x8ff5('0x66')](_0x8ff5('0x6a'),new Buffer(util[_0x8ff5('0x66')](_0x8ff5('0x6b'),_0x3682c3['username'],_0x3682c3[_0x8ff5('0x61')]))[_0x8ff5('0x6c')](_0x8ff5('0x6d')))};break;case _0x8ff5('0x6e'):_0x6872f1[_0x8ff5('0x69')]={'Authorization':util[_0x8ff5('0x66')]('Basic\x20%s',new Buffer(util['format'](_0x8ff5('0x6f'),_0x3682c3[_0x8ff5('0x60')],_0x3682c3[_0x8ff5('0x6e')]))[_0x8ff5('0x6c')](_0x8ff5('0x6d')))};break;default:throw new db[(_0x8ff5('0x70'))][(_0x8ff5('0x1a'))](_0x8ff5('0x71'));}return rp(_0x6872f1);}})['then'](function(_0x43988a){if(_0x43988a){var _0x41b951=[_0x8ff5('0x72'),'description',_0x8ff5('0x73'),_0x8ff5('0x74')];_['remove'](_0x43988a[_0x8ff5('0x68')],function(_0x57e3c3){return _0x41b951[_0x8ff5('0x75')](_0x57e3c3[_0x8ff5('0x36')]);});return{'count':_0x43988a[_0x8ff5('0x68')][_0x8ff5('0x3d')],'rows':_[_0x8ff5('0x33')](_0x43988a[_0x8ff5('0x68')],function(_0x51cd19){return{'id':_0x51cd19['id'],'name':_0x51cd19[_0x8ff5('0x76')]>0x7?_0x51cd19[_0x8ff5('0x77')]:_0x51cd19['type'],'custom':_0x51cd19[_0x8ff5('0x76')]>0x7?!![]:![],'options':_0x51cd19['system_field_options']?_0x51cd19[_0x8ff5('0x78')]:_0x51cd19[_0x8ff5('0x79')]?_0x51cd19['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x14b807,null))[_0x8ff5('0x4e')](function(_0x41c0d7){var _0x5170f0=_0x133be3['query'][_0x8ff5('0x7a')]?0x1f4:_0x41c0d7['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8ff5('0x5f'),_0x5170f0,JSON[_0x8ff5('0x23')](_0x41c0d7));delete _0x41c0d7[_0x8ff5('0x31')];if(_0x5170f0===0x191){_0x5170f0=0x190;}_0x14b807[_0x8ff5('0x2a')](_0x5170f0)[_0x8ff5('0x32')](_0x133be3[_0x8ff5('0x39')][_0x8ff5('0x7a')]?{'message':_0x8ff5('0x7b'),'statusCode':_0x41c0d7[_0x8ff5('0x7c')]}:_0x41c0d7);});}; \ No newline at end of file +var _0xdbe2=['base64','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','includes','position','system_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ZendeskAccount','includeAll','include','findAll','rows','catch','find','create','body','params','findOne','ZendeskConfiguration','filters','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString'];(function(_0x1d9fd5,_0x13f9bc){var _0x5ddcf8=function(_0x5b955c){while(--_0x5b955c){_0x1d9fd5['push'](_0x1d9fd5['shift']());}};_0x5ddcf8(++_0x13f9bc);}(_0xdbe2,0x109));var _0x2dbe=function(_0x171e4d,_0x4f2493){_0x171e4d=_0x171e4d-0x0;var _0x2d2bf4=_0xdbe2[_0x171e4d];return _0x2d2bf4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2dbe('0x0'));var zipdir=require(_0x2dbe('0x1'));var jsonpatch=require(_0x2dbe('0x2'));var rp=require(_0x2dbe('0x3'));var moment=require(_0x2dbe('0x4'));var BPromise=require(_0x2dbe('0x5'));var Mustache=require(_0x2dbe('0x6'));var util=require('util');var path=require(_0x2dbe('0x7'));var sox=require(_0x2dbe('0x8'));var csv=require(_0x2dbe('0x9'));var ejs=require(_0x2dbe('0xa'));var fs=require('fs');var _=require(_0x2dbe('0xb'));var squel=require(_0x2dbe('0xc'));var crypto=require(_0x2dbe('0xd'));var jsforce=require(_0x2dbe('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2dbe('0x9'));var querystring=require(_0x2dbe('0xf'));var Papa=require(_0x2dbe('0x10'));var Redis=require(_0x2dbe('0x11'));var authService=require(_0x2dbe('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dbe('0x13'))(_0x2dbe('0x14'));var utils=require(_0x2dbe('0x15'));var config=require(_0x2dbe('0x16'));var db=require(_0x2dbe('0x17'))['db'];var integrations=require(_0x2dbe('0x18'));var jayson=require(_0x2dbe('0x19'));var client=jayson['client'][_0x2dbe('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x189a20,_0x372434,_0x3e91f7){if(_0x3e91f7){var _0x1d13e6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d13e6[_0x2dbe('0x1b')](_0x372434)){return _0x189a20;}else{throw new db[(_0x2dbe('0x1c'))][(_0x2dbe('0x1d'))](_0x2dbe('0x1e'));}}else{return _0x189a20;}}function respondWithRpcPromise(_0x1ac581,_0x2bd785,_0x8db038,_0x3a1c79){return new BPromise(function(_0x3a3a09,_0x5e2f0e){var _0x1be2b9=_0x3a1c79||client;return _0x1be2b9['request'](_0x1ac581,_0x8db038)[_0x2dbe('0x1f')](function(_0x4f42e6){logger[_0x2dbe('0x20')](_0x2dbe('0x21'),_0x2bd785,_0x2dbe('0x22'));logger[_0x2dbe('0x23')](_0x2dbe('0x24'),_0x2bd785,_0x2dbe('0x22'),JSON[_0x2dbe('0x25')](_0x4f42e6));if(_0x4f42e6['error']){if(_0x4f42e6[_0x2dbe('0x26')][_0x2dbe('0x27')]===0x1f4){logger[_0x2dbe('0x26')]('ZendeskAccount,\x20%s,\x20%s',_0x2bd785,_0x4f42e6[_0x2dbe('0x26')][_0x2dbe('0x28')]);return _0x5e2f0e(_0x4f42e6['error'][_0x2dbe('0x28')]);}logger[_0x2dbe('0x26')](_0x2dbe('0x21'),_0x2bd785,_0x4f42e6[_0x2dbe('0x26')][_0x2dbe('0x28')]);return _0x3a3a09(_0x4f42e6[_0x2dbe('0x26')][_0x2dbe('0x28')]);}else{logger[_0x2dbe('0x20')](_0x2dbe('0x21'),_0x2bd785,'request\x20sent');_0x3a3a09(_0x4f42e6['result'][_0x2dbe('0x28')]);}})['catch'](function(_0x28d08a){logger[_0x2dbe('0x26')]('ZendeskAccount,\x20%s,\x20%s',_0x2bd785,_0x28d08a);_0x5e2f0e(_0x28d08a);});});}function respondWithStatusCode(_0x12bf09,_0x5b2b57){_0x5b2b57=_0x5b2b57||0xcc;return function(_0x231159){if(_0x231159){return _0x12bf09[_0x2dbe('0x29')](_0x5b2b57);}return _0x12bf09[_0x2dbe('0x2a')](_0x5b2b57)[_0x2dbe('0x2b')]();};}function respondWithResult(_0x560f30,_0x3a1603){_0x3a1603=_0x3a1603||0xc8;return function(_0x5862bb){if(_0x5862bb){return _0x560f30[_0x2dbe('0x2a')](_0x3a1603)[_0x2dbe('0x2c')](_0x5862bb);}};}function respondWithFilteredResult(_0x41dacf,_0x4c1fed){return function(_0x52caa6){if(_0x52caa6){var _0x2d8af8=_0x52caa6[_0x2dbe('0x2d')],_0x3bdff5=_0x4c1fed[_0x2dbe('0x2e')],_0x2eea2c=_0x4c1fed[_0x2dbe('0x2e')]+_0x4c1fed[_0x2dbe('0x2f')],_0x3b00a8;if(_0x2eea2c>=_0x2d8af8){_0x2eea2c=_0x2d8af8;_0x3b00a8=0xc8;}else{_0x3b00a8=0xce;}_0x41dacf[_0x2dbe('0x2a')](_0x3b00a8);return _0x41dacf[_0x2dbe('0x30')](_0x2dbe('0x31'),_0x3bdff5+'-'+_0x2eea2c+'/'+_0x2d8af8)[_0x2dbe('0x2c')](_0x52caa6);}return null;};}function patchUpdates(_0x53252d){return function(_0x11c40c){try{jsonpatch['apply'](_0x11c40c,_0x53252d,!![]);}catch(_0x304d76){return BPromise[_0x2dbe('0x32')](_0x304d76);}return _0x11c40c[_0x2dbe('0x33')]();};}function saveUpdates(_0x4a3fa9,_0x52efd7){return function(_0x1589d2){if(_0x1589d2){return _0x1589d2[_0x2dbe('0x34')](_0x4a3fa9)[_0x2dbe('0x1f')](function(_0x24d0ec){return _0x24d0ec;});}return null;};}function removeEntity(_0x149d76,_0x54b37a){return function(_0x5c6892){if(_0x5c6892){return _0x5c6892[_0x2dbe('0x35')]()['then'](function(){_0x149d76[_0x2dbe('0x2a')](0xcc)[_0x2dbe('0x2b')]();});}};}function handleEntityNotFound(_0x18d13c,_0x3d540a){return function(_0x1d7874){if(!_0x1d7874){_0x18d13c[_0x2dbe('0x29')](0x194);}return _0x1d7874;};}function handleError(_0x4d0d18,_0x42711f){_0x42711f=_0x42711f||0x1f4;return function(_0x4f4681){logger[_0x2dbe('0x26')](_0x4f4681[_0x2dbe('0x36')]);if(_0x4f4681[_0x2dbe('0x37')]){delete _0x4f4681[_0x2dbe('0x37')];}_0x4d0d18[_0x2dbe('0x2a')](_0x42711f)['send'](_0x4f4681);};}exports[_0x2dbe('0x38')]=function(_0x256169,_0x336c65){var _0x3e5fd5={},_0xb1fb01={},_0x211e82={'count':0x0,'rows':[]};var _0x8983c4=_[_0x2dbe('0x39')](db['ZendeskAccount'][_0x2dbe('0x3a')],function(_0x593187){return{'name':_0x593187[_0x2dbe('0x3b')],'type':_0x593187[_0x2dbe('0x3c')]['key']};});_0xb1fb01[_0x2dbe('0x3d')]=_['map'](_0x8983c4,_0x2dbe('0x37'));_0xb1fb01[_0x2dbe('0x3e')]=_[_0x2dbe('0x3f')](_0x256169[_0x2dbe('0x3e')]);_0xb1fb01['filters']=_[_0x2dbe('0x40')](_0xb1fb01[_0x2dbe('0x3d')],_0xb1fb01[_0x2dbe('0x3e')]);_0x3e5fd5[_0x2dbe('0x41')]=_['intersection'](_0xb1fb01['model'],qs[_0x2dbe('0x42')](_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x42')]));_0x3e5fd5['attributes']=_0x3e5fd5[_0x2dbe('0x41')][_0x2dbe('0x43')]?_0x3e5fd5[_0x2dbe('0x41')]:_0xb1fb01[_0x2dbe('0x3d')];if(!_0x256169['query'][_0x2dbe('0x44')](_0x2dbe('0x45'))){_0x3e5fd5[_0x2dbe('0x2f')]=qs[_0x2dbe('0x2f')](_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x2f')]);_0x3e5fd5['offset']=qs[_0x2dbe('0x2e')](_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x2e')]);}_0x3e5fd5[_0x2dbe('0x46')]=qs[_0x2dbe('0x47')](_0x256169['query'][_0x2dbe('0x47')]);_0x3e5fd5[_0x2dbe('0x48')]=qs['filters'](_[_0x2dbe('0x49')](_0x256169[_0x2dbe('0x3e')],_0xb1fb01['filters']),_0x8983c4);if(_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x4a')]){_0x3e5fd5[_0x2dbe('0x48')]=_['merge'](_0x3e5fd5['where'],{'$or':_[_0x2dbe('0x39')](_0x8983c4,function(_0x20263b){if(_0x20263b[_0x2dbe('0x3c')]!=='VIRTUAL'){var _0x44dee3={};_0x44dee3[_0x20263b[_0x2dbe('0x37')]]={'$like':'%'+_0x256169[_0x2dbe('0x3e')]['filter']+'%'};return _0x44dee3;}})});}_0x3e5fd5=_[_0x2dbe('0x4b')]({},_0x3e5fd5,_0x256169[_0x2dbe('0x4c')]);var _0x29d39f={'where':_0x3e5fd5[_0x2dbe('0x48')]};return db[_0x2dbe('0x4d')]['count'](_0x29d39f)[_0x2dbe('0x1f')](function(_0x2c867d){_0x211e82['count']=_0x2c867d;if(_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x4e')]){_0x3e5fd5[_0x2dbe('0x4f')]=[{'all':!![]}];}return db[_0x2dbe('0x4d')][_0x2dbe('0x50')](_0x3e5fd5);})[_0x2dbe('0x1f')](function(_0x14379d){_0x211e82[_0x2dbe('0x51')]=_0x14379d;return _0x211e82;})[_0x2dbe('0x1f')](respondWithFilteredResult(_0x336c65,_0x3e5fd5))[_0x2dbe('0x52')](handleError(_0x336c65,null));};exports['show']=function(_0x31c616,_0x51ce0d){var _0x2db1e0={'raw':![],'where':{'id':_0x31c616['params']['id']}},_0x360d0c={};_0x360d0c[_0x2dbe('0x3d')]=_[_0x2dbe('0x3f')](db[_0x2dbe('0x4d')][_0x2dbe('0x3a')]);_0x360d0c[_0x2dbe('0x3e')]=_[_0x2dbe('0x3f')](_0x31c616[_0x2dbe('0x3e')]);_0x360d0c['filters']=_['intersection'](_0x360d0c[_0x2dbe('0x3d')],_0x360d0c[_0x2dbe('0x3e')]);_0x2db1e0[_0x2dbe('0x41')]=_['intersection'](_0x360d0c['model'],qs[_0x2dbe('0x42')](_0x31c616[_0x2dbe('0x3e')][_0x2dbe('0x42')]));_0x2db1e0[_0x2dbe('0x41')]=_0x2db1e0[_0x2dbe('0x41')]['length']?_0x2db1e0[_0x2dbe('0x41')]:_0x360d0c[_0x2dbe('0x3d')];if(_0x31c616[_0x2dbe('0x3e')][_0x2dbe('0x4e')]){_0x2db1e0['include']=[{'all':!![]}];}_0x2db1e0=_[_0x2dbe('0x4b')]({},_0x2db1e0,_0x31c616[_0x2dbe('0x4c')]);return db[_0x2dbe('0x4d')][_0x2dbe('0x53')](_0x2db1e0)[_0x2dbe('0x1f')](handleEntityNotFound(_0x51ce0d,null))[_0x2dbe('0x1f')](respondWithResult(_0x51ce0d,null))[_0x2dbe('0x52')](handleError(_0x51ce0d,null));};exports[_0x2dbe('0x54')]=function(_0x2cf6aa,_0x120799){return db[_0x2dbe('0x4d')][_0x2dbe('0x54')](_0x2cf6aa['body'],{})[_0x2dbe('0x1f')](respondWithResult(_0x120799,0xc9))[_0x2dbe('0x52')](handleError(_0x120799,null));};exports['update']=function(_0x167161,_0x1e909c){if(_0x167161['body']['id']){delete _0x167161[_0x2dbe('0x55')]['id'];}return db[_0x2dbe('0x4d')][_0x2dbe('0x53')]({'where':{'id':_0x167161[_0x2dbe('0x56')]['id']}})[_0x2dbe('0x1f')](handleEntityNotFound(_0x1e909c,null))[_0x2dbe('0x1f')](saveUpdates(_0x167161[_0x2dbe('0x55')],null))[_0x2dbe('0x1f')](respondWithResult(_0x1e909c,null))[_0x2dbe('0x52')](handleError(_0x1e909c,null));};exports[_0x2dbe('0x35')]=function(_0x792f02,_0x16e161){return db[_0x2dbe('0x4d')][_0x2dbe('0x53')]({'where':{'id':_0x792f02[_0x2dbe('0x56')]['id']}})['then'](handleEntityNotFound(_0x16e161,null))['then'](removeEntity(_0x16e161,null))[_0x2dbe('0x52')](handleError(_0x16e161,null));};exports['getConfigurations']=function(_0x3a5b03,_0x6ff55b,_0x399882){var _0x1c09d8={};var _0x2ccce7={};var _0x5cb63a;var _0x3f52a8;return db['ZendeskAccount'][_0x2dbe('0x57')]({'where':{'id':_0x3a5b03[_0x2dbe('0x56')]['id']}})['then'](handleEntityNotFound(_0x6ff55b,null))[_0x2dbe('0x1f')](function(_0xaeda87){if(_0xaeda87){_0x5cb63a=_0xaeda87;_0x2ccce7['model']=_[_0x2dbe('0x3f')](db[_0x2dbe('0x58')]['rawAttributes']);_0x2ccce7[_0x2dbe('0x3e')]=_[_0x2dbe('0x3f')](_0x3a5b03[_0x2dbe('0x3e')]);_0x2ccce7[_0x2dbe('0x59')]=_[_0x2dbe('0x40')](_0x2ccce7[_0x2dbe('0x3d')],_0x2ccce7['query']);_0x1c09d8['attributes']=_[_0x2dbe('0x40')](_0x2ccce7[_0x2dbe('0x3d')],qs['fields'](_0x3a5b03[_0x2dbe('0x3e')][_0x2dbe('0x42')]));_0x1c09d8[_0x2dbe('0x41')]=_0x1c09d8[_0x2dbe('0x41')]['length']?_0x1c09d8[_0x2dbe('0x41')]:_0x2ccce7['model'];_0x1c09d8[_0x2dbe('0x46')]=qs[_0x2dbe('0x47')](_0x3a5b03['query']['sort']);_0x1c09d8[_0x2dbe('0x48')]=qs[_0x2dbe('0x59')](_['pick'](_0x3a5b03[_0x2dbe('0x3e')],_0x2ccce7[_0x2dbe('0x59')]));if(_0x3a5b03['query']['filter']){_0x1c09d8[_0x2dbe('0x48')]=_[_0x2dbe('0x4b')](_0x1c09d8[_0x2dbe('0x48')],{'$or':_[_0x2dbe('0x39')](_0x1c09d8['attributes'],function(_0xaa5e){var _0x253102={};_0x253102[_0xaa5e]={'$like':'%'+_0x3a5b03[_0x2dbe('0x3e')]['filter']+'%'};return _0x253102;})});}_0x1c09d8=_[_0x2dbe('0x4b')]({},_0x1c09d8,_0x3a5b03[_0x2dbe('0x4c')]);return _0x5cb63a[_0x2dbe('0x5a')](_0x1c09d8);}})[_0x2dbe('0x1f')](function(_0x5d9937){if(_0x5d9937){_0x3f52a8=_0x5d9937['length'];if(!_0x3a5b03[_0x2dbe('0x3e')]['hasOwnProperty'](_0x2dbe('0x45'))){_0x1c09d8[_0x2dbe('0x2f')]=qs['limit'](_0x3a5b03[_0x2dbe('0x3e')][_0x2dbe('0x2f')]);_0x1c09d8['offset']=qs[_0x2dbe('0x2e')](_0x3a5b03['query'][_0x2dbe('0x2e')]);}return _0x5cb63a['getConfigurations'](_0x1c09d8);}})['then'](function(_0x957c1e){if(_0x957c1e){return _0x957c1e?{'count':_0x3f52a8,'rows':_0x957c1e}:null;}})[_0x2dbe('0x1f')](respondWithResult(_0x6ff55b,null))[_0x2dbe('0x52')](handleError(_0x6ff55b,null));};exports[_0x2dbe('0x5b')]=function(_0x5e8c58,_0x5dfc06,_0x59bbf3){if(_0x5e8c58['body']['id']){delete _0x5e8c58[_0x2dbe('0x55')]['id'];}return db[_0x2dbe('0x4d')]['findOne']({'where':{'id':_0x5e8c58['params']['id']}})[_0x2dbe('0x1f')](handleEntityNotFound(_0x5dfc06,null))[_0x2dbe('0x1f')](function(_0x3efc08){if(_0x3efc08){_0x5e8c58['body'][_0x2dbe('0x5c')]=_0x3efc08['id'];_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x5d')]=integrations[_0x2dbe('0x5e')](_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x5f')],_0x5e8c58['body'][_0x2dbe('0x3c')]);_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x60')]=integrations[_0x2dbe('0x61')](_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x5f')],_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x3c')]);return db[_0x2dbe('0x58')][_0x2dbe('0x54')](_0x5e8c58[_0x2dbe('0x55')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x2dbe('0x62')],'as':_0x2dbe('0x60')}]});}return null;})[_0x2dbe('0x1f')](respondWithResult(_0x5dfc06,null))[_0x2dbe('0x52')](handleError(_0x5dfc06,null));};exports[_0x2dbe('0x63')]=function(_0x1507e1,_0x114f67,_0x586587){var _0x21e19d='';return db[_0x2dbe('0x4d')]['findOne']({'where':{'id':_0x1507e1['params']['id']},'attributes':['id',_0x2dbe('0x64'),_0x2dbe('0x65'),_0x2dbe('0x66'),'authType',_0x2dbe('0x67')]})[_0x2dbe('0x1f')](handleEntityNotFound(_0x114f67,null))[_0x2dbe('0x1f')](function(_0x9803d2){if(_0x9803d2){_0x21e19d=_0x9803d2[_0x2dbe('0x67')];var _0x103ecd=_0x21e19d[_0x2dbe('0x68')](-0x1);if(_0x103ecd==='/'){_0x21e19d=_0x21e19d[_0x2dbe('0x69')](0x0,_0x21e19d[_0x2dbe('0x6a')](_0x103ecd));}var _0x570851={'method':_0x2dbe('0x6b'),'uri':util[_0x2dbe('0x6c')](_0x2dbe('0x6d'),_0x21e19d,_0x2dbe('0x6e')),'json':!![]};switch(_0x9803d2[_0x2dbe('0x6f')]){case _0x2dbe('0x65'):_0x570851[_0x2dbe('0x70')]={'Authorization':util[_0x2dbe('0x6c')](_0x2dbe('0x71'),new Buffer(util[_0x2dbe('0x6c')](_0x2dbe('0x72'),_0x9803d2[_0x2dbe('0x64')],_0x9803d2[_0x2dbe('0x65')]))[_0x2dbe('0x73')](_0x2dbe('0x74')))};break;case'token':_0x570851['headers']={'Authorization':util[_0x2dbe('0x6c')](_0x2dbe('0x71'),new Buffer(util[_0x2dbe('0x6c')](_0x2dbe('0x75'),_0x9803d2[_0x2dbe('0x64')],_0x9803d2['token']))[_0x2dbe('0x73')]('base64'))};break;default:throw new db[(_0x2dbe('0x1c'))][(_0x2dbe('0x1d'))](_0x2dbe('0x76'));}return rp(_0x570851);}})[_0x2dbe('0x1f')](function(_0x4b8a6b){if(_0x4b8a6b){var _0x4ecc55=[_0x2dbe('0x77'),_0x2dbe('0x78'),_0x2dbe('0x79'),'assignee'];_['remove'](_0x4b8a6b[_0x2dbe('0x6e')],function(_0x267366){return _0x4ecc55[_0x2dbe('0x7a')](_0x267366['type']);});return{'count':_0x4b8a6b['ticket_fields'][_0x2dbe('0x43')],'rows':_[_0x2dbe('0x39')](_0x4b8a6b['ticket_fields'],function(_0x17e31d){return{'id':_0x17e31d['id'],'name':_0x17e31d[_0x2dbe('0x7b')]>0x7?_0x17e31d['title']:_0x17e31d[_0x2dbe('0x3c')],'custom':_0x17e31d[_0x2dbe('0x7b')]>0x7?!![]:![],'options':_0x17e31d[_0x2dbe('0x7c')]?_0x17e31d[_0x2dbe('0x7c')]:_0x17e31d['custom_field_options']?_0x17e31d['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x114f67,null))[_0x2dbe('0x52')](function(_0x207046){var _0x2b332c=_0x1507e1['query']['test']?0x1f4:_0x207046[_0x2dbe('0x7d')]||0x1f4;logger[_0x2dbe('0x26')](_0x2dbe('0x7e'),'getFields',_0x2b332c,JSON['stringify'](_0x207046));delete _0x207046['name'];if(_0x2b332c===0x191){_0x2b332c=0x190;}_0x114f67[_0x2dbe('0x2a')](_0x2b332c)['send'](_0x1507e1[_0x2dbe('0x3e')][_0x2dbe('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x207046[_0x2dbe('0x7d')]}:_0x207046);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 665e921..5fb7714 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 _0xf957=['int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x3b8f58,_0x20982c){var _0x26e820=function(_0x13807b){while(--_0x13807b){_0x3b8f58['push'](_0x3b8f58['shift']());}};_0x26e820(++_0x20982c);}(_0xf957,0x160));var _0x7f95=function(_0x241a03,_0x585f94){_0x241a03=_0x241a03-0x0;var _0x310d78=_0xf957[_0x241a03];return _0x310d78;};'use strict';var _=require(_0x7f95('0x0'));var util=require(_0x7f95('0x1'));var logger=require(_0x7f95('0x2'))('api');var moment=require(_0x7f95('0x3'));var BPromise=require(_0x7f95('0x4'));var rp=require(_0x7f95('0x5'));var fs=require('fs');var path=require(_0x7f95('0x6'));var rimraf=require(_0x7f95('0x7'));var config=require(_0x7f95('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x7f95('0x9'));module[_0x7f95('0xa')]=function(_0x30050d,_0x2fcf04){return _0x30050d[_0x7f95('0xb')]('ZendeskAccount',attributes,{'tableName':_0x7f95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf543=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x572715,_0x28b3ac){var _0x9d97c6=function(_0x4a496a){while(--_0x4a496a){_0x572715['push'](_0x572715['shift']());}};_0x9d97c6(++_0x28b3ac);}(_0xf543,0x77));var _0x3f54=function(_0x15003d,_0x1f5482){_0x15003d=_0x15003d-0x0;var _0x4c9bdd=_0xf543[_0x15003d];return _0x4c9bdd;};'use strict';var _=require(_0x3f54('0x0'));var util=require(_0x3f54('0x1'));var logger=require(_0x3f54('0x2'))(_0x3f54('0x3'));var moment=require(_0x3f54('0x4'));var BPromise=require(_0x3f54('0x5'));var rp=require(_0x3f54('0x6'));var fs=require('fs');var path=require(_0x3f54('0x7'));var rimraf=require(_0x3f54('0x8'));var config=require(_0x3f54('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3f54('0xa')]=function(_0x29b354,_0x1afdd8){return _0x29b354[_0x3f54('0xb')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 2de126c..c5dc1ee 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 _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x133296,_0xe8ff9a){var _0x193517=function(_0x161ffd){while(--_0x161ffd){_0x133296['push'](_0x133296['shift']());}};_0x193517(++_0xe8ff9a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetZendeskAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6093030..3a4c822 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 _0x47b7=['Router','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','create','setTags','put','destroy','exports','multer','path','express'];(function(_0x32efb5,_0x1b6f42){var _0x5b644c=function(_0x44e59b){while(--_0x44e59b){_0x32efb5['push'](_0x32efb5['shift']());}};_0x5b644c(++_0x1b6f42);}(_0x47b7,0x153));var _0x747b=function(_0x27acea,_0x3e2aa1){_0x27acea=_0x27acea-0x0;var _0x46da8f=_0x47b7[_0x27acea];return _0x46da8f;};'use strict';var multer=require(_0x747b('0x0'));var util=require('util');var path=require(_0x747b('0x1'));var timeout=require('connect-timeout');var express=require(_0x747b('0x2'));var router=express[_0x747b('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x747b('0x4'));router[_0x747b('0x5')]('/',auth[_0x747b('0x6')](),controller['index']);router['get'](_0x747b('0x7'),auth['isAuthenticated'](),controller[_0x747b('0x8')]);router[_0x747b('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0x747b('0x9')]);router[_0x747b('0x5')](_0x747b('0xa'),auth[_0x747b('0x6')](),controller[_0x747b('0xb')]);router['get'](_0x747b('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x747b('0x5')](_0x747b('0xd'),auth[_0x747b('0x6')](),controller['getTags']);router['post']('/',auth[_0x747b('0x6')](),controller[_0x747b('0xe')]);router['post'](_0x747b('0xd'),auth[_0x747b('0x6')](),controller[_0x747b('0xf')]);router[_0x747b('0x10')](_0x747b('0x7'),auth[_0x747b('0x6')](),controller['update']);router['delete'](_0x747b('0x7'),auth[_0x747b('0x6')](),controller[_0x747b('0x11')]);module[_0x747b('0x12')]=router; \ No newline at end of file +var _0x43a4=['Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x33b6c9,_0x13a936){var _0x2090f3=function(_0x23e392){while(--_0x23e392){_0x33b6c9['push'](_0x33b6c9['shift']());}};_0x2090f3(++_0x13a936);}(_0x43a4,0x82));var _0x443a=function(_0x364f67,_0x24b0d7){_0x364f67=_0x364f67-0x0;var _0x474f32=_0x43a4[_0x364f67];return _0x474f32;};'use strict';var multer=require(_0x443a('0x0'));var util=require(_0x443a('0x1'));var path=require(_0x443a('0x2'));var timeout=require(_0x443a('0x3'));var express=require(_0x443a('0x4'));var router=express[_0x443a('0x5')]();var auth=require(_0x443a('0x6'));var interaction=require(_0x443a('0x7'));var config=require('../../config/environment');var controller=require(_0x443a('0x8'));router['get']('/',auth[_0x443a('0x9')](),controller['index']);router[_0x443a('0xa')](_0x443a('0xb'),auth[_0x443a('0x9')](),controller[_0x443a('0xc')]);router[_0x443a('0xa')](_0x443a('0xd'),auth[_0x443a('0x9')](),controller[_0x443a('0xe')]);router[_0x443a('0xa')](_0x443a('0xf'),auth[_0x443a('0x9')](),controller['getSubjects']);router[_0x443a('0xa')](_0x443a('0x10'),auth['isAuthenticated'](),controller[_0x443a('0x11')]);router[_0x443a('0xa')]('/:id/tags',auth[_0x443a('0x9')](),controller[_0x443a('0x12')]);router[_0x443a('0x13')]('/',auth['isAuthenticated'](),controller[_0x443a('0x14')]);router['post'](_0x443a('0x15'),auth[_0x443a('0x9')](),controller[_0x443a('0x16')]);router[_0x443a('0x17')](_0x443a('0xb'),auth[_0x443a('0x9')](),controller[_0x443a('0x18')]);router['delete'](_0x443a('0xb'),auth['isAuthenticated'](),controller[_0x443a('0x19')]);module[_0x443a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6bba766..21112a0 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 _0xd26f=['exports','STRING','sequelize'];(function(_0x5087b3,_0x2ba926){var _0x3007ab=function(_0xf71b60){while(--_0xf71b60){_0x5087b3['push'](_0x5087b3['shift']());}};_0x3007ab(++_0x2ba926);}(_0xd26f,0x77));var _0xfd26=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xd26f[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require(_0xfd26('0x0'));module[_0xfd26('0x1')]={'name':{'type':Sequelize[_0xfd26('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb5d3=['exports','STRING','sequelize'];(function(_0x21fa5e,_0x1c73ff){var _0x582fdd=function(_0x15dd4b){while(--_0x15dd4b){_0x21fa5e['push'](_0x21fa5e['shift']());}};_0x582fdd(++_0x1c73ff);}(_0xb5d3,0x170));var _0x3b5d=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb5d3[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0x3b5d('0x0'));module[_0x3b5d('0x1')]={'name':{'type':Sequelize[_0x3b5d('0x2')]},'description':{'type':Sequelize[_0x3b5d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4d2d01a..03c266d 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 _0x4936=['limit','set','json','apply','reject','save','then','destroy','end','stack','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','include','findAll','rows','show','length','includeAll','options','find','create','update','body','params','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4936,0x1a2));var _0x6493=function(_0x3110f8,_0x46cd8d){_0x3110f8=_0x3110f8-0x0;var _0xff7d7e=_0x4936[_0x3110f8];return _0xff7d7e;};'use strict';var pdf=require(_0x6493('0x0'));var emlformat=require(_0x6493('0x1'));var rimraf=require(_0x6493('0x2'));var zipdir=require(_0x6493('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6493('0x4'));var BPromise=require(_0x6493('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6493('0x6'));var sox=require('sox');var csv=require(_0x6493('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6493('0x8'));var jsforce=require(_0x6493('0x9'));var deskjs=require(_0x6493('0xa'));var toCsv=require(_0x6493('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6493('0xb'));var authService=require(_0x6493('0xc'));var qs=require(_0x6493('0xd'));var as=require(_0x6493('0xe'));var hardwareService=require(_0x6493('0xf'));var logger=require(_0x6493('0x10'))(_0x6493('0x11'));var utils=require(_0x6493('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x6493('0x13'));var client=jayson[_0x6493('0x14')][_0x6493('0x15')]({'port':0x232a});function checkPasswordPattern(_0x57ef42,_0x31e8da,_0x59e514){if(_0x59e514){var _0x104db6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x104db6['test'](_0x31e8da)){return _0x57ef42;}else{throw new db['Sequelize']['ValidationError'](_0x6493('0x16'));}}else{return _0x57ef42;}}function respondWithRpcPromise(_0x3e71a2,_0x1a047f,_0x1bab5b,_0x4475be){return new BPromise(function(_0x51a786,_0x65836b){var _0x402c0c=_0x4475be||client;return _0x402c0c[_0x6493('0x17')](_0x3e71a2,_0x1bab5b)['then'](function(_0x1f1fba){logger['info'](_0x6493('0x18'),_0x1a047f,_0x6493('0x19'));logger[_0x6493('0x1a')](_0x6493('0x1b'),_0x1a047f,_0x6493('0x19'),JSON[_0x6493('0x1c')](_0x1f1fba));if(_0x1f1fba[_0x6493('0x1d')]){if(_0x1f1fba[_0x6493('0x1d')][_0x6493('0x1e')]===0x1f4){logger[_0x6493('0x1d')](_0x6493('0x18'),_0x1a047f,_0x1f1fba[_0x6493('0x1d')][_0x6493('0x1f')]);return _0x65836b(_0x1f1fba[_0x6493('0x1d')][_0x6493('0x1f')]);}logger[_0x6493('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1a047f,_0x1f1fba[_0x6493('0x1d')][_0x6493('0x1f')]);return _0x51a786(_0x1f1fba[_0x6493('0x1d')]['message']);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1a047f,_0x6493('0x19'));_0x51a786(_0x1f1fba[_0x6493('0x20')]['message']);}})[_0x6493('0x21')](function(_0x29e2ef){logger[_0x6493('0x1d')](_0x6493('0x18'),_0x1a047f,_0x29e2ef);_0x65836b(_0x29e2ef);});});}function respondWithStatusCode(_0x4233d0,_0x1e962e){_0x1e962e=_0x1e962e||0xcc;return function(_0x4ef4f9){if(_0x4ef4f9){return _0x4233d0[_0x6493('0x22')](_0x1e962e);}return _0x4233d0[_0x6493('0x23')](_0x1e962e)['end']();};}function respondWithResult(_0xaf7824,_0x5544eb){_0x5544eb=_0x5544eb||0xc8;return function(_0x1f9677){if(_0x1f9677){return _0xaf7824[_0x6493('0x23')](_0x5544eb)['json'](_0x1f9677);}};}function respondWithFilteredResult(_0x1ffbbd,_0x486264){return function(_0x5c091f){if(_0x5c091f){var _0x12ee78=_0x5c091f[_0x6493('0x24')],_0x1f34f2=_0x486264['offset'],_0x10a8d7=_0x486264['offset']+_0x486264[_0x6493('0x25')],_0x5a553;if(_0x10a8d7>=_0x12ee78){_0x10a8d7=_0x12ee78;_0x5a553=0xc8;}else{_0x5a553=0xce;}_0x1ffbbd[_0x6493('0x23')](_0x5a553);return _0x1ffbbd[_0x6493('0x26')]('Content-Range',_0x1f34f2+'-'+_0x10a8d7+'/'+_0x12ee78)[_0x6493('0x27')](_0x5c091f);}return null;};}function patchUpdates(_0x522909){return function(_0x5063aa){try{jsonpatch[_0x6493('0x28')](_0x5063aa,_0x522909,!![]);}catch(_0x26b6cc){return BPromise[_0x6493('0x29')](_0x26b6cc);}return _0x5063aa[_0x6493('0x2a')]();};}function saveUpdates(_0x18441e,_0x2ca304){return function(_0x47c0e9){if(_0x47c0e9){return _0x47c0e9['update'](_0x18441e)[_0x6493('0x2b')](function(_0x143fe6){return _0x143fe6;});}return null;};}function removeEntity(_0x35be17,_0x315cfe){return function(_0x13555b){if(_0x13555b){return _0x13555b[_0x6493('0x2c')]()['then'](function(){_0x35be17[_0x6493('0x23')](0xcc)[_0x6493('0x2d')]();});}};}function handleEntityNotFound(_0x824e2f,_0x4b47e8){return function(_0xf87881){if(!_0xf87881){_0x824e2f['sendStatus'](0x194);}return _0xf87881;};}function handleError(_0x2ad3ae,_0x297635){_0x297635=_0x297635||0x1f4;return function(_0x2cffe7){logger['error'](_0x2cffe7[_0x6493('0x2e')]);if(_0x2cffe7['name']){delete _0x2cffe7['name'];}_0x2ad3ae[_0x6493('0x23')](_0x297635)['send'](_0x2cffe7);};}exports[_0x6493('0x2f')]=function(_0x4fa5e9,_0x4adaca){var _0x5d88b9={},_0x1b0a2f={},_0x5879a4={'count':0x0,'rows':[]};var _0x1ddbd5=_[_0x6493('0x30')](db[_0x6493('0x31')][_0x6493('0x32')],function(_0x5f3ff8){return{'name':_0x5f3ff8[_0x6493('0x33')],'type':_0x5f3ff8[_0x6493('0x34')]['key']};});_0x1b0a2f[_0x6493('0x35')]=_[_0x6493('0x30')](_0x1ddbd5,_0x6493('0x36'));_0x1b0a2f[_0x6493('0x37')]=_[_0x6493('0x38')](_0x4fa5e9[_0x6493('0x37')]);_0x1b0a2f[_0x6493('0x39')]=_['intersection'](_0x1b0a2f[_0x6493('0x35')],_0x1b0a2f['query']);_0x5d88b9[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x1b0a2f[_0x6493('0x35')],qs[_0x6493('0x3c')](_0x4fa5e9['query'][_0x6493('0x3c')]));_0x5d88b9['attributes']=_0x5d88b9[_0x6493('0x3a')]['length']?_0x5d88b9[_0x6493('0x3a')]:_0x1b0a2f[_0x6493('0x35')];if(!_0x4fa5e9['query'][_0x6493('0x3d')](_0x6493('0x3e'))){_0x5d88b9[_0x6493('0x25')]=qs[_0x6493('0x25')](_0x4fa5e9['query'][_0x6493('0x25')]);_0x5d88b9[_0x6493('0x3f')]=qs['offset'](_0x4fa5e9['query'][_0x6493('0x3f')]);}_0x5d88b9[_0x6493('0x40')]=qs[_0x6493('0x41')](_0x4fa5e9['query'][_0x6493('0x41')]);_0x5d88b9[_0x6493('0x42')]=qs[_0x6493('0x39')](_['pick'](_0x4fa5e9[_0x6493('0x37')],_0x1b0a2f[_0x6493('0x39')]),_0x1ddbd5);if(_0x4fa5e9[_0x6493('0x37')][_0x6493('0x43')]){_0x5d88b9[_0x6493('0x42')]=_[_0x6493('0x44')](_0x5d88b9[_0x6493('0x42')],{'$or':_[_0x6493('0x30')](_0x1ddbd5,function(_0x14412b){if(_0x14412b['type']!=='VIRTUAL'){var _0x531686={};_0x531686[_0x14412b['name']]={'$like':'%'+_0x4fa5e9[_0x6493('0x37')][_0x6493('0x43')]+'%'};return _0x531686;}})});}_0x5d88b9=_[_0x6493('0x44')]({},_0x5d88b9,_0x4fa5e9['options']);var _0x295f80={'where':_0x5d88b9[_0x6493('0x42')]};return db[_0x6493('0x31')]['count'](_0x295f80)[_0x6493('0x2b')](function(_0x43585a){_0x5879a4[_0x6493('0x24')]=_0x43585a;if(_0x4fa5e9[_0x6493('0x37')]['includeAll']){_0x5d88b9[_0x6493('0x45')]=[{'all':!![]}];}return db[_0x6493('0x31')][_0x6493('0x46')](_0x5d88b9);})['then'](function(_0x1e2560){_0x5879a4[_0x6493('0x47')]=_0x1e2560;return _0x5879a4;})[_0x6493('0x2b')](respondWithFilteredResult(_0x4adaca,_0x5d88b9))[_0x6493('0x21')](handleError(_0x4adaca,null));};exports[_0x6493('0x48')]=function(_0x1e72ed,_0x25f979){var _0x4a423d={'raw':![],'where':{'id':_0x1e72ed['params']['id']}},_0x9b9323={};_0x9b9323['model']=_[_0x6493('0x38')](db['ZendeskConfiguration'][_0x6493('0x32')]);_0x9b9323['query']=_['keys'](_0x1e72ed['query']);_0x9b9323[_0x6493('0x39')]=_[_0x6493('0x3b')](_0x9b9323[_0x6493('0x35')],_0x9b9323[_0x6493('0x37')]);_0x4a423d[_0x6493('0x3a')]=_['intersection'](_0x9b9323[_0x6493('0x35')],qs[_0x6493('0x3c')](_0x1e72ed['query']['fields']));_0x4a423d['attributes']=_0x4a423d[_0x6493('0x3a')][_0x6493('0x49')]?_0x4a423d[_0x6493('0x3a')]:_0x9b9323[_0x6493('0x35')];if(_0x1e72ed[_0x6493('0x37')][_0x6493('0x4a')]){_0x4a423d[_0x6493('0x45')]=[{'all':!![]}];}_0x4a423d=_[_0x6493('0x44')]({},_0x4a423d,_0x1e72ed[_0x6493('0x4b')]);return db['ZendeskConfiguration'][_0x6493('0x4c')](_0x4a423d)['then'](handleEntityNotFound(_0x25f979,null))[_0x6493('0x2b')](respondWithResult(_0x25f979,null))[_0x6493('0x21')](handleError(_0x25f979,null));};exports[_0x6493('0x4d')]=function(_0x21fb34,_0x95fdb8){return db[_0x6493('0x31')][_0x6493('0x4d')](_0x21fb34['body'],{})[_0x6493('0x2b')](respondWithResult(_0x95fdb8,0xc9))[_0x6493('0x21')](handleError(_0x95fdb8,null));};exports[_0x6493('0x4e')]=function(_0x2638df,_0x4365b3){if(_0x2638df[_0x6493('0x4f')]['id']){delete _0x2638df[_0x6493('0x4f')]['id'];}return db[_0x6493('0x31')][_0x6493('0x4c')]({'where':{'id':_0x2638df[_0x6493('0x50')]['id']}})[_0x6493('0x2b')](handleEntityNotFound(_0x4365b3,null))[_0x6493('0x2b')](saveUpdates(_0x2638df[_0x6493('0x4f')],null))[_0x6493('0x2b')](respondWithResult(_0x4365b3,null))['catch'](handleError(_0x4365b3,null));};exports[_0x6493('0x2c')]=function(_0x3c3c7b,_0x241793){return db[_0x6493('0x31')][_0x6493('0x4c')]({'where':{'id':_0x3c3c7b['params']['id']}})['then'](handleEntityNotFound(_0x241793,null))[_0x6493('0x2b')](removeEntity(_0x241793,null))[_0x6493('0x21')](handleError(_0x241793,null));};exports[_0x6493('0x51')]=function(_0x32d784,_0x1e3af7,_0x37df00){var _0x16cb49={};var _0x4e2fe6={};var _0x532279;var _0x43170c;return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x32d784['params']['id']}})[_0x6493('0x2b')](handleEntityNotFound(_0x1e3af7,null))[_0x6493('0x2b')](function(_0x2ecb18){if(_0x2ecb18){_0x532279=_0x2ecb18;_0x4e2fe6[_0x6493('0x35')]=_[_0x6493('0x38')](db[_0x6493('0x53')]['rawAttributes']);_0x4e2fe6[_0x6493('0x37')]=_[_0x6493('0x38')](_0x32d784[_0x6493('0x37')]);_0x4e2fe6[_0x6493('0x39')]=_[_0x6493('0x3b')](_0x4e2fe6[_0x6493('0x35')],_0x4e2fe6['query']);_0x16cb49[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x4e2fe6[_0x6493('0x35')],qs[_0x6493('0x3c')](_0x32d784[_0x6493('0x37')]['fields']));_0x16cb49[_0x6493('0x3a')]=_0x16cb49[_0x6493('0x3a')][_0x6493('0x49')]?_0x16cb49[_0x6493('0x3a')]:_0x4e2fe6[_0x6493('0x35')];_0x16cb49[_0x6493('0x40')]=qs[_0x6493('0x41')](_0x32d784['query'][_0x6493('0x41')]);_0x16cb49['where']=qs['filters'](_[_0x6493('0x54')](_0x32d784[_0x6493('0x37')],_0x4e2fe6['filters']));if(_0x32d784['query'][_0x6493('0x43')]){_0x16cb49[_0x6493('0x42')]=_[_0x6493('0x44')](_0x16cb49[_0x6493('0x42')],{'$or':_[_0x6493('0x30')](_0x16cb49[_0x6493('0x3a')],function(_0x12a592){var _0x2358de={};_0x2358de[_0x12a592]={'$like':'%'+_0x32d784['query'][_0x6493('0x43')]+'%'};return _0x2358de;})});}_0x16cb49=_[_0x6493('0x44')]({},_0x16cb49,_0x32d784[_0x6493('0x4b')]);return _0x532279[_0x6493('0x51')](_0x16cb49);}})['then'](function(_0x1dd43e){if(_0x1dd43e){_0x43170c=_0x1dd43e[_0x6493('0x49')];if(!_0x32d784[_0x6493('0x37')]['hasOwnProperty'](_0x6493('0x3e'))){_0x16cb49['limit']=qs[_0x6493('0x25')](_0x32d784[_0x6493('0x37')][_0x6493('0x25')]);_0x16cb49['offset']=qs[_0x6493('0x3f')](_0x32d784[_0x6493('0x37')][_0x6493('0x3f')]);}return _0x532279[_0x6493('0x51')](_0x16cb49);}})[_0x6493('0x2b')](function(_0x5e4ea8){if(_0x5e4ea8){return _0x5e4ea8?{'count':_0x43170c,'rows':_0x5e4ea8}:null;}})[_0x6493('0x2b')](respondWithResult(_0x1e3af7,null))[_0x6493('0x21')](handleError(_0x1e3af7,null));};exports[_0x6493('0x55')]=function(_0x4ad477,_0x59bdbf,_0x15e890){var _0x5f0ca7={};var _0x84a07d={};var _0x38e63d;var _0x251041;return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x4ad477[_0x6493('0x50')]['id']}})[_0x6493('0x2b')](handleEntityNotFound(_0x59bdbf,null))[_0x6493('0x2b')](function(_0x1e23f7){if(_0x1e23f7){_0x38e63d=_0x1e23f7;_0x84a07d[_0x6493('0x35')]=_[_0x6493('0x38')](db[_0x6493('0x53')][_0x6493('0x32')]);_0x84a07d[_0x6493('0x37')]=_[_0x6493('0x38')](_0x4ad477[_0x6493('0x37')]);_0x84a07d[_0x6493('0x39')]=_[_0x6493('0x3b')](_0x84a07d['model'],_0x84a07d[_0x6493('0x37')]);_0x5f0ca7['attributes']=_[_0x6493('0x3b')](_0x84a07d['model'],qs['fields'](_0x4ad477[_0x6493('0x37')][_0x6493('0x3c')]));_0x5f0ca7[_0x6493('0x3a')]=_0x5f0ca7[_0x6493('0x3a')]['length']?_0x5f0ca7[_0x6493('0x3a')]:_0x84a07d[_0x6493('0x35')];_0x5f0ca7[_0x6493('0x40')]=qs[_0x6493('0x41')](_0x4ad477[_0x6493('0x37')][_0x6493('0x41')]);_0x5f0ca7['where']=qs[_0x6493('0x39')](_[_0x6493('0x54')](_0x4ad477[_0x6493('0x37')],_0x84a07d[_0x6493('0x39')]));if(_0x4ad477[_0x6493('0x37')][_0x6493('0x43')]){_0x5f0ca7[_0x6493('0x42')]=_[_0x6493('0x44')](_0x5f0ca7[_0x6493('0x42')],{'$or':_['map'](_0x5f0ca7[_0x6493('0x3a')],function(_0x5949d3){var _0x1de71b={};_0x1de71b[_0x5949d3]={'$like':'%'+_0x4ad477['query'][_0x6493('0x43')]+'%'};return _0x1de71b;})});}_0x5f0ca7=_[_0x6493('0x44')]({},_0x5f0ca7,_0x4ad477[_0x6493('0x4b')]);return _0x38e63d[_0x6493('0x55')](_0x5f0ca7);}})[_0x6493('0x2b')](function(_0x138b75){if(_0x138b75){_0x251041=_0x138b75[_0x6493('0x49')];if(!_0x4ad477[_0x6493('0x37')][_0x6493('0x3d')](_0x6493('0x3e'))){_0x5f0ca7[_0x6493('0x25')]=qs[_0x6493('0x25')](_0x4ad477[_0x6493('0x37')][_0x6493('0x25')]);_0x5f0ca7[_0x6493('0x3f')]=qs[_0x6493('0x3f')](_0x4ad477['query'][_0x6493('0x3f')]);}return _0x38e63d[_0x6493('0x55')](_0x5f0ca7);}})[_0x6493('0x2b')](function(_0x5a4c6c){if(_0x5a4c6c){return _0x5a4c6c?{'count':_0x251041,'rows':_0x5a4c6c}:null;}})[_0x6493('0x2b')](respondWithResult(_0x59bdbf,null))[_0x6493('0x21')](handleError(_0x59bdbf,null));};exports[_0x6493('0x56')]=function(_0x2fb63c,_0x12e832,_0x517e04){var _0x2e6296={};var _0x4643a1={};var _0x4b41da;var _0x4310a0;return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x2fb63c[_0x6493('0x50')]['id']}})['then'](handleEntityNotFound(_0x12e832,null))[_0x6493('0x2b')](function(_0x3a42dd){if(_0x3a42dd){_0x4b41da=_0x3a42dd;_0x4643a1[_0x6493('0x35')]=_[_0x6493('0x38')](db[_0x6493('0x53')][_0x6493('0x32')]);_0x4643a1[_0x6493('0x37')]=_[_0x6493('0x38')](_0x2fb63c[_0x6493('0x37')]);_0x4643a1[_0x6493('0x39')]=_[_0x6493('0x3b')](_0x4643a1[_0x6493('0x35')],_0x4643a1[_0x6493('0x37')]);_0x2e6296[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x4643a1[_0x6493('0x35')],qs['fields'](_0x2fb63c[_0x6493('0x37')][_0x6493('0x3c')]));_0x2e6296[_0x6493('0x3a')]=_0x2e6296[_0x6493('0x3a')][_0x6493('0x49')]?_0x2e6296['attributes']:_0x4643a1[_0x6493('0x35')];_0x2e6296[_0x6493('0x40')]=qs[_0x6493('0x41')](_0x2fb63c[_0x6493('0x37')][_0x6493('0x41')]);_0x2e6296[_0x6493('0x42')]=qs[_0x6493('0x39')](_[_0x6493('0x54')](_0x2fb63c[_0x6493('0x37')],_0x4643a1[_0x6493('0x39')]));if(_0x2fb63c[_0x6493('0x37')][_0x6493('0x43')]){_0x2e6296[_0x6493('0x42')]=_[_0x6493('0x44')](_0x2e6296[_0x6493('0x42')],{'$or':_[_0x6493('0x30')](_0x2e6296[_0x6493('0x3a')],function(_0x2c09fe){var _0x4b16dd={};_0x4b16dd[_0x2c09fe]={'$like':'%'+_0x2fb63c[_0x6493('0x37')][_0x6493('0x43')]+'%'};return _0x4b16dd;})});}_0x2e6296=_[_0x6493('0x44')]({},_0x2e6296,_0x2fb63c[_0x6493('0x4b')]);return _0x4b41da['getDescriptions'](_0x2e6296);}})[_0x6493('0x2b')](function(_0x6e968c){if(_0x6e968c){_0x4310a0=_0x6e968c['length'];if(!_0x2fb63c[_0x6493('0x37')][_0x6493('0x3d')]('nolimit')){_0x2e6296[_0x6493('0x25')]=qs[_0x6493('0x25')](_0x2fb63c[_0x6493('0x37')][_0x6493('0x25')]);_0x2e6296[_0x6493('0x3f')]=qs[_0x6493('0x3f')](_0x2fb63c[_0x6493('0x37')]['offset']);}return _0x4b41da[_0x6493('0x56')](_0x2e6296);}})[_0x6493('0x2b')](function(_0x4c0bed){if(_0x4c0bed){return _0x4c0bed?{'count':_0x4310a0,'rows':_0x4c0bed}:null;}})[_0x6493('0x2b')](respondWithResult(_0x12e832,null))[_0x6493('0x21')](handleError(_0x12e832,null));};exports[_0x6493('0x57')]=function(_0x236384,_0x2711da,_0x877228){var _0x5a3f53={};var _0x3e98c0={};var _0x8aa4ac;var _0x171c61;return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x236384['params']['id']}})['then'](handleEntityNotFound(_0x2711da,null))[_0x6493('0x2b')](function(_0x142ffe){if(_0x142ffe){_0x8aa4ac=_0x142ffe;_0x3e98c0[_0x6493('0x35')]=_[_0x6493('0x38')](db[_0x6493('0x58')][_0x6493('0x32')]);_0x3e98c0[_0x6493('0x37')]=_[_0x6493('0x38')](_0x236384[_0x6493('0x37')]);_0x3e98c0['filters']=_['intersection'](_0x3e98c0['model'],_0x3e98c0['query']);_0x5a3f53[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x3e98c0[_0x6493('0x35')],qs[_0x6493('0x3c')](_0x236384[_0x6493('0x37')]['fields']));_0x5a3f53['attributes']=_0x5a3f53['attributes'][_0x6493('0x49')]?_0x5a3f53[_0x6493('0x3a')]:_0x3e98c0[_0x6493('0x35')];_0x5a3f53['order']=qs[_0x6493('0x41')](_0x236384[_0x6493('0x37')][_0x6493('0x41')]);_0x5a3f53[_0x6493('0x42')]=qs[_0x6493('0x39')](_[_0x6493('0x54')](_0x236384['query'],_0x3e98c0['filters']));if(_0x236384[_0x6493('0x37')]['filter']){_0x5a3f53['where']=_[_0x6493('0x44')](_0x5a3f53[_0x6493('0x42')],{'$or':_[_0x6493('0x30')](_0x5a3f53[_0x6493('0x3a')],function(_0x2dfc01){var _0xe61708={};_0xe61708[_0x2dfc01]={'$like':'%'+_0x236384[_0x6493('0x37')][_0x6493('0x43')]+'%'};return _0xe61708;})});}_0x5a3f53=_[_0x6493('0x44')]({},_0x5a3f53,_0x236384[_0x6493('0x4b')]);return _0x8aa4ac['getTags'](_0x5a3f53);}})[_0x6493('0x2b')](function(_0x1d4e00){if(_0x1d4e00){_0x171c61=_0x1d4e00['length'];if(!_0x236384[_0x6493('0x37')]['hasOwnProperty'](_0x6493('0x3e'))){_0x5a3f53['limit']=qs[_0x6493('0x25')](_0x236384[_0x6493('0x37')]['limit']);_0x5a3f53[_0x6493('0x3f')]=qs[_0x6493('0x3f')](_0x236384[_0x6493('0x37')]['offset']);}return _0x8aa4ac[_0x6493('0x57')](_0x5a3f53);}})[_0x6493('0x2b')](function(_0x46ded7){if(_0x46ded7){return _0x46ded7?{'count':_0x171c61,'rows':_0x46ded7}:null;}})[_0x6493('0x2b')](respondWithResult(_0x2711da,null))['catch'](handleError(_0x2711da,null));};exports[_0x6493('0x59')]=function(_0x55574f,_0x27de6c,_0x20289c){if(_0x55574f[_0x6493('0x4f')]['id']){delete _0x55574f[_0x6493('0x4f')]['id'];}return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x55574f['params']['id']}})[_0x6493('0x2b')](handleEntityNotFound(_0x27de6c,null))[_0x6493('0x2b')](function(_0x39514e){if(_0x39514e){return _0x39514e[_0x6493('0x59')](_0x55574f[_0x6493('0x4f')][_0x6493('0x5a')]||[]);}return null;})[_0x6493('0x2b')](respondWithResult(_0x27de6c,null))[_0x6493('0x21')](handleError(_0x27de6c,null));}; \ No newline at end of file +var _0x65b4=['querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','getFields','ZendeskField','nolimit','getSubjects','getDescriptions','findOne','Tag','getTags','setTags','ids','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js'];(function(_0x14e75e,_0x43a34d){var _0x5fc83b=function(_0x37bcb1){while(--_0x37bcb1){_0x14e75e['push'](_0x14e75e['shift']());}};_0x5fc83b(++_0x43a34d);}(_0x65b4,0x172));var _0x465b=function(_0x1c3b40,_0x1bb555){_0x1c3b40=_0x1c3b40-0x0;var _0x38f43a=_0x65b4[_0x1c3b40];return _0x38f43a;};'use strict';var pdf=require(_0x465b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x465b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x465b('0x2'));var moment=require(_0x465b('0x3'));var BPromise=require(_0x465b('0x4'));var Mustache=require(_0x465b('0x5'));var util=require(_0x465b('0x6'));var path=require(_0x465b('0x7'));var sox=require(_0x465b('0x8'));var csv=require(_0x465b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x465b('0xa'));var squel=require('squel');var crypto=require(_0x465b('0xb'));var jsforce=require(_0x465b('0xc'));var deskjs=require(_0x465b('0xd'));var toCsv=require(_0x465b('0x9'));var querystring=require(_0x465b('0xe'));var Papa=require(_0x465b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x465b('0x10'));var logger=require(_0x465b('0x11'))(_0x465b('0x12'));var utils=require(_0x465b('0x13'));var config=require(_0x465b('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x465b('0x15')][_0x465b('0x16')]({'port':0x232a});function checkPasswordPattern(_0x35d347,_0xfc0753,_0x1f9650){if(_0x1f9650){var _0x4e1aea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e1aea[_0x465b('0x17')](_0xfc0753)){return _0x35d347;}else{throw new db[(_0x465b('0x18'))]['ValidationError'](_0x465b('0x19'));}}else{return _0x35d347;}}function respondWithRpcPromise(_0x4d3af7,_0x3a2554,_0x13c21e,_0x26dfba){return new BPromise(function(_0x12a649,_0xdc1f7b){var _0x59a3c4=_0x26dfba||client;return _0x59a3c4[_0x465b('0x1a')](_0x4d3af7,_0x13c21e)['then'](function(_0x3e6b5d){logger[_0x465b('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a2554,'request\x20sent');logger['debug'](_0x465b('0x1c'),_0x3a2554,_0x465b('0x1d'),JSON[_0x465b('0x1e')](_0x3e6b5d));if(_0x3e6b5d['error']){if(_0x3e6b5d[_0x465b('0x1f')][_0x465b('0x20')]===0x1f4){logger[_0x465b('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a2554,_0x3e6b5d[_0x465b('0x1f')][_0x465b('0x21')]);return _0xdc1f7b(_0x3e6b5d['error'][_0x465b('0x21')]);}logger[_0x465b('0x1f')](_0x465b('0x22'),_0x3a2554,_0x3e6b5d[_0x465b('0x1f')][_0x465b('0x21')]);return _0x12a649(_0x3e6b5d[_0x465b('0x1f')]['message']);}else{logger[_0x465b('0x1b')](_0x465b('0x22'),_0x3a2554,_0x465b('0x1d'));_0x12a649(_0x3e6b5d[_0x465b('0x23')][_0x465b('0x21')]);}})[_0x465b('0x24')](function(_0x4392fa){logger['error'](_0x465b('0x22'),_0x3a2554,_0x4392fa);_0xdc1f7b(_0x4392fa);});});}function respondWithStatusCode(_0x4715d4,_0x11fa3b){_0x11fa3b=_0x11fa3b||0xcc;return function(_0x4e8a75){if(_0x4e8a75){return _0x4715d4['sendStatus'](_0x11fa3b);}return _0x4715d4['status'](_0x11fa3b)[_0x465b('0x25')]();};}function respondWithResult(_0x47fc09,_0x11e845){_0x11e845=_0x11e845||0xc8;return function(_0x16fe68){if(_0x16fe68){return _0x47fc09[_0x465b('0x26')](_0x11e845)[_0x465b('0x27')](_0x16fe68);}};}function respondWithFilteredResult(_0x367b83,_0x4e3ec5){return function(_0x325775){if(_0x325775){var _0x548904=_0x325775[_0x465b('0x28')],_0x34fc9d=_0x4e3ec5[_0x465b('0x29')],_0x3e4e66=_0x4e3ec5['offset']+_0x4e3ec5[_0x465b('0x2a')],_0x473bc1;if(_0x3e4e66>=_0x548904){_0x3e4e66=_0x548904;_0x473bc1=0xc8;}else{_0x473bc1=0xce;}_0x367b83[_0x465b('0x26')](_0x473bc1);return _0x367b83['set'](_0x465b('0x2b'),_0x34fc9d+'-'+_0x3e4e66+'/'+_0x548904)[_0x465b('0x27')](_0x325775);}return null;};}function patchUpdates(_0x36a34e){return function(_0x35eb05){try{jsonpatch[_0x465b('0x2c')](_0x35eb05,_0x36a34e,!![]);}catch(_0x34095d){return BPromise[_0x465b('0x2d')](_0x34095d);}return _0x35eb05[_0x465b('0x2e')]();};}function saveUpdates(_0x2b3b16,_0x4200cf){return function(_0x3eab1a){if(_0x3eab1a){return _0x3eab1a[_0x465b('0x2f')](_0x2b3b16)[_0x465b('0x30')](function(_0x4fe7da){return _0x4fe7da;});}return null;};}function removeEntity(_0x7859c7,_0x10ca21){return function(_0x231e5b){if(_0x231e5b){return _0x231e5b[_0x465b('0x31')]()[_0x465b('0x30')](function(){_0x7859c7[_0x465b('0x26')](0xcc)[_0x465b('0x25')]();});}};}function handleEntityNotFound(_0x3706bf,_0x55878b){return function(_0x2de40a){if(!_0x2de40a){_0x3706bf[_0x465b('0x32')](0x194);}return _0x2de40a;};}function handleError(_0xa2356d,_0x47e410){_0x47e410=_0x47e410||0x1f4;return function(_0x92c211){logger['error'](_0x92c211[_0x465b('0x33')]);if(_0x92c211[_0x465b('0x34')]){delete _0x92c211[_0x465b('0x34')];}_0xa2356d[_0x465b('0x26')](_0x47e410)[_0x465b('0x35')](_0x92c211);};}exports['index']=function(_0x3d9bc7,_0x40cc79){var _0x14ae6a={},_0x241c60={},_0x4d9abf={'count':0x0,'rows':[]};var _0x3d8756=_[_0x465b('0x36')](db[_0x465b('0x37')][_0x465b('0x38')],function(_0x4d0b34){return{'name':_0x4d0b34[_0x465b('0x39')],'type':_0x4d0b34[_0x465b('0x3a')][_0x465b('0x3b')]};});_0x241c60['model']=_[_0x465b('0x36')](_0x3d8756,_0x465b('0x34'));_0x241c60[_0x465b('0x3c')]=_[_0x465b('0x3d')](_0x3d9bc7[_0x465b('0x3c')]);_0x241c60['filters']=_[_0x465b('0x3e')](_0x241c60[_0x465b('0x3f')],_0x241c60[_0x465b('0x3c')]);_0x14ae6a[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x241c60['model'],qs[_0x465b('0x41')](_0x3d9bc7['query'][_0x465b('0x41')]));_0x14ae6a[_0x465b('0x40')]=_0x14ae6a[_0x465b('0x40')][_0x465b('0x42')]?_0x14ae6a[_0x465b('0x40')]:_0x241c60[_0x465b('0x3f')];if(!_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x43')]('nolimit')){_0x14ae6a['limit']=qs['limit'](_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x2a')]);_0x14ae6a[_0x465b('0x29')]=qs[_0x465b('0x29')](_0x3d9bc7['query'][_0x465b('0x29')]);}_0x14ae6a[_0x465b('0x44')]=qs[_0x465b('0x45')](_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x45')]);_0x14ae6a[_0x465b('0x46')]=qs[_0x465b('0x47')](_[_0x465b('0x48')](_0x3d9bc7[_0x465b('0x3c')],_0x241c60['filters']),_0x3d8756);if(_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x49')]){_0x14ae6a['where']=_[_0x465b('0x4a')](_0x14ae6a[_0x465b('0x46')],{'$or':_['map'](_0x3d8756,function(_0x389327){if(_0x389327['type']!==_0x465b('0x4b')){var _0x4fae7e={};_0x4fae7e[_0x389327[_0x465b('0x34')]]={'$like':'%'+_0x3d9bc7['query'][_0x465b('0x49')]+'%'};return _0x4fae7e;}})});}_0x14ae6a=_[_0x465b('0x4a')]({},_0x14ae6a,_0x3d9bc7[_0x465b('0x4c')]);var _0x232abd={'where':_0x14ae6a[_0x465b('0x46')]};return db[_0x465b('0x37')][_0x465b('0x28')](_0x232abd)['then'](function(_0x50243f){_0x4d9abf[_0x465b('0x28')]=_0x50243f;if(_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x4d')]){_0x14ae6a[_0x465b('0x4e')]=[{'all':!![]}];}return db[_0x465b('0x37')][_0x465b('0x4f')](_0x14ae6a);})[_0x465b('0x30')](function(_0x5378dd){_0x4d9abf[_0x465b('0x50')]=_0x5378dd;return _0x4d9abf;})[_0x465b('0x30')](respondWithFilteredResult(_0x40cc79,_0x14ae6a))['catch'](handleError(_0x40cc79,null));};exports[_0x465b('0x51')]=function(_0x1ba8e2,_0x30814d){var _0x4429a5={'raw':![],'where':{'id':_0x1ba8e2[_0x465b('0x52')]['id']}},_0x30da30={};_0x30da30[_0x465b('0x3f')]=_[_0x465b('0x3d')](db[_0x465b('0x37')]['rawAttributes']);_0x30da30[_0x465b('0x3c')]=_[_0x465b('0x3d')](_0x1ba8e2[_0x465b('0x3c')]);_0x30da30[_0x465b('0x47')]=_[_0x465b('0x3e')](_0x30da30[_0x465b('0x3f')],_0x30da30['query']);_0x4429a5[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x30da30['model'],qs[_0x465b('0x41')](_0x1ba8e2[_0x465b('0x3c')][_0x465b('0x41')]));_0x4429a5['attributes']=_0x4429a5[_0x465b('0x40')]['length']?_0x4429a5[_0x465b('0x40')]:_0x30da30['model'];if(_0x1ba8e2[_0x465b('0x3c')][_0x465b('0x4d')]){_0x4429a5[_0x465b('0x4e')]=[{'all':!![]}];}_0x4429a5=_[_0x465b('0x4a')]({},_0x4429a5,_0x1ba8e2[_0x465b('0x4c')]);return db[_0x465b('0x37')]['find'](_0x4429a5)['then'](handleEntityNotFound(_0x30814d,null))[_0x465b('0x30')](respondWithResult(_0x30814d,null))[_0x465b('0x24')](handleError(_0x30814d,null));};exports['create']=function(_0x5bea3a,_0x522c4f){return db[_0x465b('0x37')][_0x465b('0x53')](_0x5bea3a[_0x465b('0x54')],{})[_0x465b('0x30')](respondWithResult(_0x522c4f,0xc9))[_0x465b('0x24')](handleError(_0x522c4f,null));};exports['update']=function(_0x3478ef,_0x3133e0){if(_0x3478ef['body']['id']){delete _0x3478ef[_0x465b('0x54')]['id'];}return db[_0x465b('0x37')][_0x465b('0x55')]({'where':{'id':_0x3478ef[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x3133e0,null))[_0x465b('0x30')](saveUpdates(_0x3478ef[_0x465b('0x54')],null))['then'](respondWithResult(_0x3133e0,null))[_0x465b('0x24')](handleError(_0x3133e0,null));};exports[_0x465b('0x31')]=function(_0x151c84,_0x3ea3fa){return db[_0x465b('0x37')][_0x465b('0x55')]({'where':{'id':_0x151c84[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x3ea3fa,null))[_0x465b('0x30')](removeEntity(_0x3ea3fa,null))[_0x465b('0x24')](handleError(_0x3ea3fa,null));};exports[_0x465b('0x56')]=function(_0x45d600,_0x2154af,_0x42cec4){var _0x5ea390={};var _0x28d865={};var _0x174b72;var _0x239bb6;return db[_0x465b('0x37')]['findOne']({'where':{'id':_0x45d600[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x2154af,null))['then'](function(_0x4409bb){if(_0x4409bb){_0x174b72=_0x4409bb;_0x28d865[_0x465b('0x3f')]=_[_0x465b('0x3d')](db[_0x465b('0x57')][_0x465b('0x38')]);_0x28d865['query']=_[_0x465b('0x3d')](_0x45d600[_0x465b('0x3c')]);_0x28d865[_0x465b('0x47')]=_[_0x465b('0x3e')](_0x28d865[_0x465b('0x3f')],_0x28d865[_0x465b('0x3c')]);_0x5ea390[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x28d865[_0x465b('0x3f')],qs[_0x465b('0x41')](_0x45d600[_0x465b('0x3c')][_0x465b('0x41')]));_0x5ea390['attributes']=_0x5ea390['attributes'][_0x465b('0x42')]?_0x5ea390['attributes']:_0x28d865[_0x465b('0x3f')];_0x5ea390[_0x465b('0x44')]=qs[_0x465b('0x45')](_0x45d600['query']['sort']);_0x5ea390['where']=qs[_0x465b('0x47')](_[_0x465b('0x48')](_0x45d600[_0x465b('0x3c')],_0x28d865[_0x465b('0x47')]));if(_0x45d600[_0x465b('0x3c')][_0x465b('0x49')]){_0x5ea390[_0x465b('0x46')]=_[_0x465b('0x4a')](_0x5ea390['where'],{'$or':_[_0x465b('0x36')](_0x5ea390[_0x465b('0x40')],function(_0x4863ea){var _0x31b24c={};_0x31b24c[_0x4863ea]={'$like':'%'+_0x45d600['query'][_0x465b('0x49')]+'%'};return _0x31b24c;})});}_0x5ea390=_[_0x465b('0x4a')]({},_0x5ea390,_0x45d600['options']);return _0x174b72[_0x465b('0x56')](_0x5ea390);}})['then'](function(_0x4a7d00){if(_0x4a7d00){_0x239bb6=_0x4a7d00['length'];if(!_0x45d600[_0x465b('0x3c')][_0x465b('0x43')](_0x465b('0x58'))){_0x5ea390[_0x465b('0x2a')]=qs[_0x465b('0x2a')](_0x45d600[_0x465b('0x3c')]['limit']);_0x5ea390[_0x465b('0x29')]=qs[_0x465b('0x29')](_0x45d600[_0x465b('0x3c')][_0x465b('0x29')]);}return _0x174b72['getFields'](_0x5ea390);}})[_0x465b('0x30')](function(_0x54692a){if(_0x54692a){return _0x54692a?{'count':_0x239bb6,'rows':_0x54692a}:null;}})[_0x465b('0x30')](respondWithResult(_0x2154af,null))['catch'](handleError(_0x2154af,null));};exports[_0x465b('0x59')]=function(_0xeb36a,_0x2930e5,_0x2c5234){var _0x31824d={};var _0x216c97={};var _0x89628c;var _0x42372b;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xeb36a[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x2930e5,null))[_0x465b('0x30')](function(_0xb6725){if(_0xb6725){_0x89628c=_0xb6725;_0x216c97['model']=_[_0x465b('0x3d')](db['ZendeskField'][_0x465b('0x38')]);_0x216c97[_0x465b('0x3c')]=_[_0x465b('0x3d')](_0xeb36a[_0x465b('0x3c')]);_0x216c97[_0x465b('0x47')]=_['intersection'](_0x216c97[_0x465b('0x3f')],_0x216c97[_0x465b('0x3c')]);_0x31824d[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x216c97[_0x465b('0x3f')],qs[_0x465b('0x41')](_0xeb36a[_0x465b('0x3c')][_0x465b('0x41')]));_0x31824d[_0x465b('0x40')]=_0x31824d['attributes']['length']?_0x31824d['attributes']:_0x216c97[_0x465b('0x3f')];_0x31824d[_0x465b('0x44')]=qs[_0x465b('0x45')](_0xeb36a[_0x465b('0x3c')][_0x465b('0x45')]);_0x31824d[_0x465b('0x46')]=qs[_0x465b('0x47')](_[_0x465b('0x48')](_0xeb36a[_0x465b('0x3c')],_0x216c97['filters']));if(_0xeb36a[_0x465b('0x3c')][_0x465b('0x49')]){_0x31824d[_0x465b('0x46')]=_[_0x465b('0x4a')](_0x31824d['where'],{'$or':_['map'](_0x31824d[_0x465b('0x40')],function(_0x29ffe8){var _0x4ef373={};_0x4ef373[_0x29ffe8]={'$like':'%'+_0xeb36a[_0x465b('0x3c')][_0x465b('0x49')]+'%'};return _0x4ef373;})});}_0x31824d=_[_0x465b('0x4a')]({},_0x31824d,_0xeb36a[_0x465b('0x4c')]);return _0x89628c['getSubjects'](_0x31824d);}})['then'](function(_0x38087d){if(_0x38087d){_0x42372b=_0x38087d[_0x465b('0x42')];if(!_0xeb36a[_0x465b('0x3c')][_0x465b('0x43')]('nolimit')){_0x31824d['limit']=qs[_0x465b('0x2a')](_0xeb36a[_0x465b('0x3c')][_0x465b('0x2a')]);_0x31824d[_0x465b('0x29')]=qs[_0x465b('0x29')](_0xeb36a[_0x465b('0x3c')]['offset']);}return _0x89628c['getSubjects'](_0x31824d);}})[_0x465b('0x30')](function(_0x597b79){if(_0x597b79){return _0x597b79?{'count':_0x42372b,'rows':_0x597b79}:null;}})[_0x465b('0x30')](respondWithResult(_0x2930e5,null))[_0x465b('0x24')](handleError(_0x2930e5,null));};exports[_0x465b('0x5a')]=function(_0x1770cc,_0x2013c1,_0x40950c){var _0x1adbb1={};var _0x1a14e5={};var _0x329c2f;var _0x435d3b;return db[_0x465b('0x37')][_0x465b('0x5b')]({'where':{'id':_0x1770cc[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x2013c1,null))[_0x465b('0x30')](function(_0x5126e5){if(_0x5126e5){_0x329c2f=_0x5126e5;_0x1a14e5[_0x465b('0x3f')]=_[_0x465b('0x3d')](db[_0x465b('0x57')]['rawAttributes']);_0x1a14e5['query']=_[_0x465b('0x3d')](_0x1770cc['query']);_0x1a14e5[_0x465b('0x47')]=_[_0x465b('0x3e')](_0x1a14e5[_0x465b('0x3f')],_0x1a14e5['query']);_0x1adbb1[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x1a14e5[_0x465b('0x3f')],qs[_0x465b('0x41')](_0x1770cc[_0x465b('0x3c')][_0x465b('0x41')]));_0x1adbb1[_0x465b('0x40')]=_0x1adbb1[_0x465b('0x40')]['length']?_0x1adbb1[_0x465b('0x40')]:_0x1a14e5[_0x465b('0x3f')];_0x1adbb1['order']=qs[_0x465b('0x45')](_0x1770cc[_0x465b('0x3c')]['sort']);_0x1adbb1[_0x465b('0x46')]=qs['filters'](_[_0x465b('0x48')](_0x1770cc[_0x465b('0x3c')],_0x1a14e5[_0x465b('0x47')]));if(_0x1770cc[_0x465b('0x3c')][_0x465b('0x49')]){_0x1adbb1[_0x465b('0x46')]=_[_0x465b('0x4a')](_0x1adbb1['where'],{'$or':_[_0x465b('0x36')](_0x1adbb1[_0x465b('0x40')],function(_0x1dbd4c){var _0x4c06df={};_0x4c06df[_0x1dbd4c]={'$like':'%'+_0x1770cc[_0x465b('0x3c')][_0x465b('0x49')]+'%'};return _0x4c06df;})});}_0x1adbb1=_[_0x465b('0x4a')]({},_0x1adbb1,_0x1770cc[_0x465b('0x4c')]);return _0x329c2f['getDescriptions'](_0x1adbb1);}})[_0x465b('0x30')](function(_0x4147d3){if(_0x4147d3){_0x435d3b=_0x4147d3[_0x465b('0x42')];if(!_0x1770cc[_0x465b('0x3c')][_0x465b('0x43')](_0x465b('0x58'))){_0x1adbb1['limit']=qs['limit'](_0x1770cc[_0x465b('0x3c')][_0x465b('0x2a')]);_0x1adbb1['offset']=qs[_0x465b('0x29')](_0x1770cc[_0x465b('0x3c')][_0x465b('0x29')]);}return _0x329c2f[_0x465b('0x5a')](_0x1adbb1);}})[_0x465b('0x30')](function(_0x25d785){if(_0x25d785){return _0x25d785?{'count':_0x435d3b,'rows':_0x25d785}:null;}})[_0x465b('0x30')](respondWithResult(_0x2013c1,null))[_0x465b('0x24')](handleError(_0x2013c1,null));};exports['getTags']=function(_0x39cc97,_0x52409e,_0x4e71ed){var _0xb3d627={};var _0x264128={};var _0x378e38;var _0x2d4a62;return db[_0x465b('0x37')][_0x465b('0x5b')]({'where':{'id':_0x39cc97[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x52409e,null))[_0x465b('0x30')](function(_0x1df918){if(_0x1df918){_0x378e38=_0x1df918;_0x264128[_0x465b('0x3f')]=_[_0x465b('0x3d')](db[_0x465b('0x5c')][_0x465b('0x38')]);_0x264128[_0x465b('0x3c')]=_[_0x465b('0x3d')](_0x39cc97[_0x465b('0x3c')]);_0x264128['filters']=_[_0x465b('0x3e')](_0x264128[_0x465b('0x3f')],_0x264128[_0x465b('0x3c')]);_0xb3d627['attributes']=_['intersection'](_0x264128[_0x465b('0x3f')],qs[_0x465b('0x41')](_0x39cc97['query'][_0x465b('0x41')]));_0xb3d627[_0x465b('0x40')]=_0xb3d627['attributes']['length']?_0xb3d627[_0x465b('0x40')]:_0x264128[_0x465b('0x3f')];_0xb3d627[_0x465b('0x44')]=qs[_0x465b('0x45')](_0x39cc97[_0x465b('0x3c')]['sort']);_0xb3d627['where']=qs[_0x465b('0x47')](_[_0x465b('0x48')](_0x39cc97[_0x465b('0x3c')],_0x264128[_0x465b('0x47')]));if(_0x39cc97[_0x465b('0x3c')][_0x465b('0x49')]){_0xb3d627[_0x465b('0x46')]=_[_0x465b('0x4a')](_0xb3d627[_0x465b('0x46')],{'$or':_[_0x465b('0x36')](_0xb3d627[_0x465b('0x40')],function(_0x2b8c37){var _0xba0232={};_0xba0232[_0x2b8c37]={'$like':'%'+_0x39cc97[_0x465b('0x3c')][_0x465b('0x49')]+'%'};return _0xba0232;})});}_0xb3d627=_[_0x465b('0x4a')]({},_0xb3d627,_0x39cc97[_0x465b('0x4c')]);return _0x378e38[_0x465b('0x5d')](_0xb3d627);}})[_0x465b('0x30')](function(_0x791016){if(_0x791016){_0x2d4a62=_0x791016[_0x465b('0x42')];if(!_0x39cc97[_0x465b('0x3c')][_0x465b('0x43')](_0x465b('0x58'))){_0xb3d627['limit']=qs[_0x465b('0x2a')](_0x39cc97[_0x465b('0x3c')][_0x465b('0x2a')]);_0xb3d627['offset']=qs[_0x465b('0x29')](_0x39cc97[_0x465b('0x3c')][_0x465b('0x29')]);}return _0x378e38[_0x465b('0x5d')](_0xb3d627);}})[_0x465b('0x30')](function(_0x43469d){if(_0x43469d){return _0x43469d?{'count':_0x2d4a62,'rows':_0x43469d}:null;}})[_0x465b('0x30')](respondWithResult(_0x52409e,null))[_0x465b('0x24')](handleError(_0x52409e,null));};exports[_0x465b('0x5e')]=function(_0x2ad4d0,_0x300bee,_0x37d03c){if(_0x2ad4d0[_0x465b('0x54')]['id']){delete _0x2ad4d0[_0x465b('0x54')]['id'];}return db[_0x465b('0x37')][_0x465b('0x5b')]({'where':{'id':_0x2ad4d0[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x300bee,null))[_0x465b('0x30')](function(_0x5d1bdd){if(_0x5d1bdd){return _0x5d1bdd[_0x465b('0x5e')](_0x2ad4d0[_0x465b('0x54')][_0x465b('0x5f')]||[]);}return null;})[_0x465b('0x30')](respondWithResult(_0x300bee,null))['catch'](handleError(_0x300bee,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index dbaa634..12e7825 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 _0x1c18=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','../../config/logger','moment','request-promise','path'];(function(_0x202e81,_0x2dc375){var _0x29a066=function(_0x4172da){while(--_0x4172da){_0x202e81['push'](_0x202e81['shift']());}};_0x29a066(++_0x2dc375);}(_0x1c18,0xc1));var _0x81c1=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0x1c18[_0x37cc52];return _0x2b4a90;};'use strict';var _=require(_0x81c1('0x0'));var util=require('util');var logger=require(_0x81c1('0x1'))('api');var moment=require(_0x81c1('0x2'));var BPromise=require('bluebird');var rp=require(_0x81c1('0x3'));var fs=require('fs');var path=require(_0x81c1('0x4'));var rimraf=require(_0x81c1('0x5'));var config=require(_0x81c1('0x6'));var attributes=require(_0x81c1('0x7'));module[_0x81c1('0x8')]=function(_0x357f31,_0x501b86){return _0x357f31[_0x81c1('0x9')](_0x81c1('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20a0=['int_zendesk_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration'];(function(_0x48f80a,_0x3bb5d4){var _0x1327fb=function(_0x46293e){while(--_0x46293e){_0x48f80a['push'](_0x48f80a['shift']());}};_0x1327fb(++_0x3bb5d4);}(_0x20a0,0x15d));var _0x020a=function(_0xd6574d,_0x4cce7c){_0xd6574d=_0xd6574d-0x0;var _0x592d73=_0x20a0[_0xd6574d];return _0x592d73;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x020a('0x0'))(_0x020a('0x1'));var moment=require(_0x020a('0x2'));var BPromise=require(_0x020a('0x3'));var rp=require(_0x020a('0x4'));var fs=require('fs');var path=require(_0x020a('0x5'));var rimraf=require(_0x020a('0x6'));var config=require(_0x020a('0x7'));var attributes=require(_0x020a('0x8'));module[_0x020a('0x9')]=function(_0x552f85,_0x1bab6f){return _0x552f85['define'](_0x020a('0xa'),attributes,{'tableName':_0x020a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 6a43c05..d0b84d7 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 _0x6bad=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x511133,_0x35255f){var _0x3acd78=function(_0x371acd){while(--_0x371acd){_0x511133['push'](_0x511133['shift']());}};_0x3acd78(++_0x35255f);}(_0x6bad,0x1de));var _0xd6ba=function(_0xc7ef24,_0x33578a){_0xc7ef24=_0xc7ef24-0x0;var _0x32770d=_0x6bad[_0xc7ef24];return _0x32770d;};'use strict';var _=require(_0xd6ba('0x0'));var util=require(_0xd6ba('0x1'));var moment=require(_0xd6ba('0x2'));var BPromise=require('bluebird');var rs=require(_0xd6ba('0x3'));var fs=require('fs');var Redis=require(_0xd6ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6ba('0x5'));var logger=require(_0xd6ba('0x6'))(_0xd6ba('0x7'));var config=require(_0xd6ba('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6ba('0x9')][_0xd6ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x169d5f,_0x4089ea,_0x14d989){return new BPromise(function(_0x1e0230,_0xda8872){return client['request'](_0x169d5f,_0x14d989)[_0xd6ba('0xb')](function(_0x2549c7){logger[_0xd6ba('0xc')](_0xd6ba('0xd'),_0x4089ea,_0xd6ba('0xe'));logger[_0xd6ba('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4089ea,'request\x20sent',JSON[_0xd6ba('0x10')](_0x2549c7));if(_0x2549c7[_0xd6ba('0x11')]){if(_0x2549c7[_0xd6ba('0x11')][_0xd6ba('0x12')]===0x1f4){logger[_0xd6ba('0x11')](_0xd6ba('0xd'),_0x4089ea,_0x2549c7[_0xd6ba('0x11')][_0xd6ba('0x13')]);return _0xda8872(_0x2549c7[_0xd6ba('0x11')][_0xd6ba('0x13')]);}logger['error'](_0xd6ba('0xd'),_0x4089ea,_0x2549c7['error'][_0xd6ba('0x13')]);return _0x1e0230(_0x2549c7['error'][_0xd6ba('0x13')]);}else{logger[_0xd6ba('0xc')](_0xd6ba('0xd'),_0x4089ea,'request\x20sent');_0x1e0230(_0x2549c7['result'][_0xd6ba('0x13')]);}})[_0xd6ba('0x14')](function(_0x205e3e){logger[_0xd6ba('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4089ea,_0x205e3e);_0xda8872(_0x205e3e);});});} \ No newline at end of file +var _0xcb97=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x1de69c,_0x41666e){var _0x37dbe8=function(_0x1159f7){while(--_0x1159f7){_0x1de69c['push'](_0x1de69c['shift']());}};_0x37dbe8(++_0x41666e);}(_0xcb97,0x16b));var _0x7cb9=function(_0x50f719,_0x5b915b){_0x50f719=_0x50f719-0x0;var _0x2e9e1f=_0xcb97[_0x50f719];return _0x2e9e1f;};'use strict';var _=require(_0x7cb9('0x0'));var util=require(_0x7cb9('0x1'));var moment=require(_0x7cb9('0x2'));var BPromise=require(_0x7cb9('0x3'));var rs=require(_0x7cb9('0x4'));var fs=require('fs');var Redis=require(_0x7cb9('0x5'));var db=require(_0x7cb9('0x6'))['db'];var utils=require(_0x7cb9('0x7'));var logger=require(_0x7cb9('0x8'))(_0x7cb9('0x9'));var config=require('../../config/environment');var jayson=require(_0x7cb9('0xa'));var client=jayson[_0x7cb9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c75f0,_0x51188b,_0x53514d){return new BPromise(function(_0x3c4f35,_0x5be1bd){return client[_0x7cb9('0xc')](_0x5c75f0,_0x53514d)[_0x7cb9('0xd')](function(_0xb2e7c4){logger[_0x7cb9('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x51188b,_0x7cb9('0xf'));logger[_0x7cb9('0x10')](_0x7cb9('0x11'),_0x51188b,_0x7cb9('0xf'),JSON[_0x7cb9('0x12')](_0xb2e7c4));if(_0xb2e7c4[_0x7cb9('0x13')]){if(_0xb2e7c4['error']['code']===0x1f4){logger['error'](_0x7cb9('0x14'),_0x51188b,_0xb2e7c4[_0x7cb9('0x13')][_0x7cb9('0x15')]);return _0x5be1bd(_0xb2e7c4[_0x7cb9('0x13')][_0x7cb9('0x15')]);}logger['error'](_0x7cb9('0x14'),_0x51188b,_0xb2e7c4['error'][_0x7cb9('0x15')]);return _0x3c4f35(_0xb2e7c4[_0x7cb9('0x13')][_0x7cb9('0x15')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x51188b,_0x7cb9('0xf'));_0x3c4f35(_0xb2e7c4[_0x7cb9('0x16')][_0x7cb9('0x15')]);}})[_0x7cb9('0x17')](function(_0x1ea145){logger[_0x7cb9('0x13')](_0x7cb9('0x14'),_0x51188b,_0x1ea145);_0x5be1bd(_0x1ea145);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ea850e2..9f0025f 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 _0xcab6=['index','get','show','post','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0xcab6,0xd4));var _0x6cab=function(_0x5ddff3,_0x52f03c){_0x5ddff3=_0x5ddff3-0x0;var _0x207dcd=_0xcab6[_0x5ddff3];return _0x207dcd;};'use strict';var multer=require(_0x6cab('0x0'));var util=require('util');var path=require(_0x6cab('0x1'));var timeout=require(_0x6cab('0x2'));var express=require(_0x6cab('0x3'));var router=express[_0x6cab('0x4')]();var auth=require(_0x6cab('0x5'));var interaction=require(_0x6cab('0x6'));var config=require('../../config/environment');var controller=require(_0x6cab('0x7'));router['get']('/',auth[_0x6cab('0x8')](),controller[_0x6cab('0x9')]);router[_0x6cab('0xa')]('/:id',auth[_0x6cab('0x8')](),controller[_0x6cab('0xb')]);router[_0x6cab('0xc')]('/',auth[_0x6cab('0x8')](),controller['create']);router['put'](_0x6cab('0xd'),auth[_0x6cab('0x8')](),controller[_0x6cab('0xe')]);router[_0x6cab('0xf')](_0x6cab('0xd'),auth[_0x6cab('0x8')](),controller['destroy']);module[_0x6cab('0x10')]=router; \ No newline at end of file +var _0x0fc2=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x204e3a,_0x322db0){var _0x37f26d=function(_0x59dd3e){while(--_0x59dd3e){_0x204e3a['push'](_0x204e3a['shift']());}};_0x37f26d(++_0x322db0);}(_0x0fc2,0x6e));var _0x20fc=function(_0x2c06ad,_0x36f164){_0x2c06ad=_0x2c06ad-0x0;var _0x5113ff=_0x0fc2[_0x2c06ad];return _0x5113ff;};'use strict';var multer=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var path=require(_0x20fc('0x2'));var timeout=require(_0x20fc('0x3'));var express=require('express');var router=express[_0x20fc('0x4')]();var auth=require(_0x20fc('0x5'));var interaction=require(_0x20fc('0x6'));var config=require(_0x20fc('0x7'));var controller=require(_0x20fc('0x8'));router[_0x20fc('0x9')]('/',auth[_0x20fc('0xa')](),controller[_0x20fc('0xb')]);router[_0x20fc('0x9')](_0x20fc('0xc'),auth[_0x20fc('0xa')](),controller[_0x20fc('0xd')]);router[_0x20fc('0xe')]('/',auth[_0x20fc('0xa')](),controller[_0x20fc('0xf')]);router[_0x20fc('0x10')]('/:id',auth[_0x20fc('0xa')](),controller[_0x20fc('0x11')]);router[_0x20fc('0x12')]('/:id',auth[_0x20fc('0xa')](),controller[_0x20fc('0x13')]);module[_0x20fc('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 7d61c95..ef03ae4 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 _0x8aaa=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x678774,_0x4e110d){var _0x56c83a=function(_0xcedc08){while(--_0xcedc08){_0x678774['push'](_0x678774['shift']());}};_0x56c83a(++_0x4e110d);}(_0x8aaa,0x64));var _0xa8aa=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0x8aaa[_0x297c55];return _0x120389;};'use strict';var Sequelize=require(_0xa8aa('0x0'));module[_0xa8aa('0x1')]={'type':{'type':Sequelize[_0xa8aa('0x2')]('string',_0xa8aa('0x3'),_0xa8aa('0x4'),_0xa8aa('0x5')),'defaultValue':_0xa8aa('0x6')},'content':{'type':Sequelize[_0xa8aa('0x7')]},'key':{'type':Sequelize[_0xa8aa('0x7')]},'keyType':{'type':Sequelize[_0xa8aa('0x2')](_0xa8aa('0x6'),'variable',_0xa8aa('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa8aa('0x7')]},'customField':{'type':Sequelize[_0xa8aa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c32=['keyValue','string','customVariable','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x26c3('0x0'));module['exports']={'type':{'type':Sequelize[_0x26c3('0x1')]('string',_0x26c3('0x2'),'customVariable',_0x26c3('0x3')),'defaultValue':_0x26c3('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x26c3('0x1')](_0x26c3('0x4'),_0x26c3('0x2'),_0x26c3('0x5'))},'keyContent':{'type':Sequelize[_0x26c3('0x6')]},'idField':{'type':Sequelize[_0x26c3('0x6')]},'nameField':{'type':Sequelize[_0x26c3('0x6')]},'customField':{'type':Sequelize[_0x26c3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x26c3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 145cc0f..435249f 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 _0xae0e=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','ZendeskField','find','catch','create','body','html-pdf','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','query'];(function(_0x4da965,_0x1e3bc7){var _0x16675b=function(_0x35ebb9){while(--_0x35ebb9){_0x4da965['push'](_0x4da965['shift']());}};_0x16675b(++_0x1e3bc7);}(_0xae0e,0xa8));var _0xeae0=function(_0x38dbb1,_0x12ffcb){_0x38dbb1=_0x38dbb1-0x0;var _0x1fc598=_0xae0e[_0x38dbb1];return _0x1fc598;};'use strict';var pdf=require(_0xeae0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeae0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeae0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeae0('0x3'));var util=require(_0xeae0('0x4'));var path=require(_0xeae0('0x5'));var sox=require(_0xeae0('0x6'));var csv=require(_0xeae0('0x7'));var ejs=require(_0xeae0('0x8'));var fs=require('fs');var _=require(_0xeae0('0x9'));var squel=require(_0xeae0('0xa'));var crypto=require(_0xeae0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeae0('0xc'));var toCsv=require(_0xeae0('0x7'));var querystring=require(_0xeae0('0xd'));var Papa=require(_0xeae0('0xe'));var Redis=require(_0xeae0('0xf'));var authService=require(_0xeae0('0x10'));var qs=require(_0xeae0('0x11'));var as=require(_0xeae0('0x12'));var hardwareService=require(_0xeae0('0x13'));var logger=require('../../config/logger')(_0xeae0('0x14'));var utils=require('../../config/utils');var config=require(_0xeae0('0x15'));var db=require(_0xeae0('0x16'))['db'];function respondWithStatusCode(_0x2cbb89,_0x101d80){_0x101d80=_0x101d80||0xcc;return function(_0x100ab4){if(_0x100ab4){return _0x2cbb89['sendStatus'](_0x101d80);}return _0x2cbb89[_0xeae0('0x17')](_0x101d80)['end']();};}function respondWithResult(_0x376310,_0x51621e){_0x51621e=_0x51621e||0xc8;return function(_0x1c4b3a){if(_0x1c4b3a){return _0x376310['status'](_0x51621e)[_0xeae0('0x18')](_0x1c4b3a);}};}function respondWithFilteredResult(_0xb8c674,_0x3fbf9c){return function(_0x2ee38b){if(_0x2ee38b){var _0x11905d=_0x2ee38b[_0xeae0('0x19')],_0x500b89=_0x3fbf9c[_0xeae0('0x1a')],_0x5175db=_0x3fbf9c[_0xeae0('0x1a')]+_0x3fbf9c[_0xeae0('0x1b')],_0x2250b7;if(_0x5175db>=_0x11905d){_0x5175db=_0x11905d;_0x2250b7=0xc8;}else{_0x2250b7=0xce;}_0xb8c674['status'](_0x2250b7);return _0xb8c674[_0xeae0('0x1c')](_0xeae0('0x1d'),_0x500b89+'-'+_0x5175db+'/'+_0x11905d)[_0xeae0('0x18')](_0x2ee38b);}return null;};}function patchUpdates(_0x19acff){return function(_0xf75c9b){try{jsonpatch['apply'](_0xf75c9b,_0x19acff,!![]);}catch(_0x5821a1){return BPromise[_0xeae0('0x1e')](_0x5821a1);}return _0xf75c9b[_0xeae0('0x1f')]();};}function saveUpdates(_0x13de7f,_0x4bd57f){return function(_0x5612af){if(_0x5612af){return _0x5612af[_0xeae0('0x20')](_0x13de7f)[_0xeae0('0x21')](function(_0x5ee6d6){return _0x5ee6d6;});}return null;};}function removeEntity(_0x179408,_0x56f455){return function(_0x567fe4){if(_0x567fe4){return _0x567fe4[_0xeae0('0x22')]()[_0xeae0('0x21')](function(){_0x179408['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x167a27,_0x5dad39){return function(_0x330f31){if(!_0x330f31){_0x167a27[_0xeae0('0x23')](0x194);}return _0x330f31;};}function handleError(_0x2de241,_0x51c224){_0x51c224=_0x51c224||0x1f4;return function(_0x388e20){logger['error'](_0x388e20[_0xeae0('0x24')]);if(_0x388e20[_0xeae0('0x25')]){delete _0x388e20['name'];}_0x2de241[_0xeae0('0x17')](_0x51c224)[_0xeae0('0x26')](_0x388e20);};}exports['index']=function(_0x30c589,_0x3e1078){var _0x45d248={},_0x4aa013={},_0x2bd6fc={'count':0x0,'rows':[]};var _0x3ef54b=_[_0xeae0('0x27')](db['ZendeskField'][_0xeae0('0x28')],function(_0x52ace0){return{'name':_0x52ace0[_0xeae0('0x29')],'type':_0x52ace0[_0xeae0('0x2a')][_0xeae0('0x2b')]};});_0x4aa013['model']=_[_0xeae0('0x27')](_0x3ef54b,_0xeae0('0x25'));_0x4aa013[_0xeae0('0x2c')]=_['keys'](_0x30c589['query']);_0x4aa013['filters']=_[_0xeae0('0x2d')](_0x4aa013[_0xeae0('0x2e')],_0x4aa013[_0xeae0('0x2c')]);_0x45d248[_0xeae0('0x2f')]=_['intersection'](_0x4aa013[_0xeae0('0x2e')],qs[_0xeae0('0x30')](_0x30c589['query']['fields']));_0x45d248[_0xeae0('0x2f')]=_0x45d248['attributes'][_0xeae0('0x31')]?_0x45d248[_0xeae0('0x2f')]:_0x4aa013[_0xeae0('0x2e')];if(!_0x30c589['query'][_0xeae0('0x32')](_0xeae0('0x33'))){_0x45d248[_0xeae0('0x1b')]=qs[_0xeae0('0x1b')](_0x30c589[_0xeae0('0x2c')]['limit']);_0x45d248['offset']=qs[_0xeae0('0x1a')](_0x30c589[_0xeae0('0x2c')]['offset']);}_0x45d248['order']=qs[_0xeae0('0x34')](_0x30c589['query'][_0xeae0('0x34')]);_0x45d248[_0xeae0('0x35')]=qs[_0xeae0('0x36')](_['pick'](_0x30c589[_0xeae0('0x2c')],_0x4aa013[_0xeae0('0x36')]),_0x3ef54b);if(_0x30c589[_0xeae0('0x2c')][_0xeae0('0x37')]){_0x45d248['where']=_[_0xeae0('0x38')](_0x45d248[_0xeae0('0x35')],{'$or':_['map'](_0x3ef54b,function(_0x551781){if(_0x551781[_0xeae0('0x2a')]!==_0xeae0('0x39')){var _0x3e9571={};_0x3e9571[_0x551781[_0xeae0('0x25')]]={'$like':'%'+_0x30c589[_0xeae0('0x2c')][_0xeae0('0x37')]+'%'};return _0x3e9571;}})});}_0x45d248=_[_0xeae0('0x38')]({},_0x45d248,_0x30c589['options']);var _0x14e80c={'where':_0x45d248[_0xeae0('0x35')]};return db['ZendeskField'][_0xeae0('0x19')](_0x14e80c)[_0xeae0('0x21')](function(_0x398442){_0x2bd6fc['count']=_0x398442;if(_0x30c589[_0xeae0('0x2c')][_0xeae0('0x3a')]){_0x45d248[_0xeae0('0x3b')]=[{'all':!![]}];}return db['ZendeskField'][_0xeae0('0x3c')](_0x45d248);})[_0xeae0('0x21')](function(_0x38f886){_0x2bd6fc[_0xeae0('0x3d')]=_0x38f886;return _0x2bd6fc;})['then'](respondWithFilteredResult(_0x3e1078,_0x45d248))['catch'](handleError(_0x3e1078,null));};exports[_0xeae0('0x3e')]=function(_0x2ddbb2,_0x4f2ea7){var _0x2e2766={'raw':!![],'where':{'id':_0x2ddbb2[_0xeae0('0x3f')]['id']}},_0x5b36ce={};_0x5b36ce['model']=_[_0xeae0('0x40')](db['ZendeskField'][_0xeae0('0x28')]);_0x5b36ce['query']=_[_0xeae0('0x40')](_0x2ddbb2[_0xeae0('0x2c')]);_0x5b36ce[_0xeae0('0x36')]=_[_0xeae0('0x2d')](_0x5b36ce[_0xeae0('0x2e')],_0x5b36ce[_0xeae0('0x2c')]);_0x2e2766['attributes']=_[_0xeae0('0x2d')](_0x5b36ce['model'],qs[_0xeae0('0x30')](_0x2ddbb2[_0xeae0('0x2c')][_0xeae0('0x30')]));_0x2e2766[_0xeae0('0x2f')]=_0x2e2766[_0xeae0('0x2f')]['length']?_0x2e2766[_0xeae0('0x2f')]:_0x5b36ce['model'];if(_0x2ddbb2['query'][_0xeae0('0x3a')]){_0x2e2766[_0xeae0('0x3b')]=[{'all':!![]}];}_0x2e2766=_[_0xeae0('0x38')]({},_0x2e2766,_0x2ddbb2[_0xeae0('0x41')]);return db[_0xeae0('0x42')][_0xeae0('0x43')](_0x2e2766)[_0xeae0('0x21')](handleEntityNotFound(_0x4f2ea7,null))[_0xeae0('0x21')](respondWithResult(_0x4f2ea7,null))[_0xeae0('0x44')](handleError(_0x4f2ea7,null));};exports[_0xeae0('0x45')]=function(_0x2daaf2,_0x1d80c3){return db['ZendeskField'][_0xeae0('0x45')](_0x2daaf2[_0xeae0('0x46')],{})[_0xeae0('0x21')](respondWithResult(_0x1d80c3,0xc9))[_0xeae0('0x44')](handleError(_0x1d80c3,null));};exports[_0xeae0('0x20')]=function(_0x106435,_0x2318ef){if(_0x106435[_0xeae0('0x46')]['id']){delete _0x106435[_0xeae0('0x46')]['id'];}return db['ZendeskField'][_0xeae0('0x43')]({'where':{'id':_0x106435[_0xeae0('0x3f')]['id']}})[_0xeae0('0x21')](handleEntityNotFound(_0x2318ef,null))['then'](saveUpdates(_0x106435[_0xeae0('0x46')],null))[_0xeae0('0x21')](respondWithResult(_0x2318ef,null))[_0xeae0('0x44')](handleError(_0x2318ef,null));};exports['destroy']=function(_0x365531,_0x5dcebe){return db[_0xeae0('0x42')][_0xeae0('0x43')]({'where':{'id':_0x365531[_0xeae0('0x3f')]['id']}})[_0xeae0('0x21')](handleEntityNotFound(_0x5dcebe,null))[_0xeae0('0x21')](removeEntity(_0x5dcebe,null))[_0xeae0('0x44')](handleError(_0x5dcebe,null));}; \ No newline at end of file +var _0xf300=['json','apply','reject','save','then','destroy','stack','name','send','index','map','fieldName','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','ZendeskField','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xf300,0x105));var _0x0f30=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0xf300[_0x2212d1];return _0x15eec5;};'use strict';var pdf=require(_0x0f30('0x0'));var emlformat=require(_0x0f30('0x1'));var rimraf=require(_0x0f30('0x2'));var zipdir=require(_0x0f30('0x3'));var jsonpatch=require(_0x0f30('0x4'));var rp=require('request-promise');var moment=require(_0x0f30('0x5'));var BPromise=require(_0x0f30('0x6'));var Mustache=require('mustache');var util=require(_0x0f30('0x7'));var path=require(_0x0f30('0x8'));var sox=require(_0x0f30('0x9'));var csv=require(_0x0f30('0xa'));var ejs=require(_0x0f30('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f30('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0f30('0xd'));var toCsv=require(_0x0f30('0xa'));var querystring=require(_0x0f30('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f30('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f30('0x10'));var logger=require(_0x0f30('0x11'))(_0x0f30('0x12'));var utils=require(_0x0f30('0x13'));var config=require(_0x0f30('0x14'));var db=require(_0x0f30('0x15'))['db'];function respondWithStatusCode(_0x4e142f,_0x1c3906){_0x1c3906=_0x1c3906||0xcc;return function(_0x4944da){if(_0x4944da){return _0x4e142f[_0x0f30('0x16')](_0x1c3906);}return _0x4e142f[_0x0f30('0x17')](_0x1c3906)[_0x0f30('0x18')]();};}function respondWithResult(_0x54d780,_0x44498c){_0x44498c=_0x44498c||0xc8;return function(_0x5d3b0d){if(_0x5d3b0d){return _0x54d780[_0x0f30('0x17')](_0x44498c)['json'](_0x5d3b0d);}};}function respondWithFilteredResult(_0x28827e,_0x2c06db){return function(_0x5113c3){if(_0x5113c3){var _0x2c6f6f=_0x5113c3[_0x0f30('0x19')],_0x395b29=_0x2c06db['offset'],_0x3b1e6c=_0x2c06db[_0x0f30('0x1a')]+_0x2c06db['limit'],_0x3d2a32;if(_0x3b1e6c>=_0x2c6f6f){_0x3b1e6c=_0x2c6f6f;_0x3d2a32=0xc8;}else{_0x3d2a32=0xce;}_0x28827e[_0x0f30('0x17')](_0x3d2a32);return _0x28827e['set']('Content-Range',_0x395b29+'-'+_0x3b1e6c+'/'+_0x2c6f6f)[_0x0f30('0x1b')](_0x5113c3);}return null;};}function patchUpdates(_0xfa6b2){return function(_0x1bd024){try{jsonpatch[_0x0f30('0x1c')](_0x1bd024,_0xfa6b2,!![]);}catch(_0x5c3569){return BPromise[_0x0f30('0x1d')](_0x5c3569);}return _0x1bd024[_0x0f30('0x1e')]();};}function saveUpdates(_0x2a925f,_0x4d6fd7){return function(_0x20bd49){if(_0x20bd49){return _0x20bd49['update'](_0x2a925f)[_0x0f30('0x1f')](function(_0x57e9ca){return _0x57e9ca;});}return null;};}function removeEntity(_0x43fdea,_0x2a80c3){return function(_0x3143f0){if(_0x3143f0){return _0x3143f0[_0x0f30('0x20')]()[_0x0f30('0x1f')](function(){_0x43fdea[_0x0f30('0x17')](0xcc)[_0x0f30('0x18')]();});}};}function handleEntityNotFound(_0x3ac161,_0x47f151){return function(_0x43d103){if(!_0x43d103){_0x3ac161[_0x0f30('0x16')](0x194);}return _0x43d103;};}function handleError(_0x5607c1,_0x4394d7){_0x4394d7=_0x4394d7||0x1f4;return function(_0x43213c){logger['error'](_0x43213c[_0x0f30('0x21')]);if(_0x43213c[_0x0f30('0x22')]){delete _0x43213c['name'];}_0x5607c1['status'](_0x4394d7)[_0x0f30('0x23')](_0x43213c);};}exports[_0x0f30('0x24')]=function(_0x1a8d75,_0x47fc00){var _0x142cf8={},_0x2b02ae={},_0x1cff0f={'count':0x0,'rows':[]};var _0x55c862=_[_0x0f30('0x25')](db['ZendeskField']['rawAttributes'],function(_0x32a28){return{'name':_0x32a28[_0x0f30('0x26')],'type':_0x32a28['type'][_0x0f30('0x27')]};});_0x2b02ae[_0x0f30('0x28')]=_['map'](_0x55c862,'name');_0x2b02ae['query']=_['keys'](_0x1a8d75[_0x0f30('0x29')]);_0x2b02ae['filters']=_[_0x0f30('0x2a')](_0x2b02ae[_0x0f30('0x28')],_0x2b02ae[_0x0f30('0x29')]);_0x142cf8[_0x0f30('0x2b')]=_[_0x0f30('0x2a')](_0x2b02ae[_0x0f30('0x28')],qs['fields'](_0x1a8d75[_0x0f30('0x29')]['fields']));_0x142cf8[_0x0f30('0x2b')]=_0x142cf8['attributes'][_0x0f30('0x2c')]?_0x142cf8[_0x0f30('0x2b')]:_0x2b02ae[_0x0f30('0x28')];if(!_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x2d')](_0x0f30('0x2e'))){_0x142cf8[_0x0f30('0x2f')]=qs[_0x0f30('0x2f')](_0x1a8d75['query'][_0x0f30('0x2f')]);_0x142cf8[_0x0f30('0x1a')]=qs[_0x0f30('0x1a')](_0x1a8d75['query'][_0x0f30('0x1a')]);}_0x142cf8[_0x0f30('0x30')]=qs[_0x0f30('0x31')](_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x31')]);_0x142cf8[_0x0f30('0x32')]=qs[_0x0f30('0x33')](_[_0x0f30('0x34')](_0x1a8d75[_0x0f30('0x29')],_0x2b02ae['filters']),_0x55c862);if(_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x35')]){_0x142cf8[_0x0f30('0x32')]=_[_0x0f30('0x36')](_0x142cf8[_0x0f30('0x32')],{'$or':_[_0x0f30('0x25')](_0x55c862,function(_0x598c3e){if(_0x598c3e[_0x0f30('0x37')]!==_0x0f30('0x38')){var _0x157c72={};_0x157c72[_0x598c3e[_0x0f30('0x22')]]={'$like':'%'+_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x35')]+'%'};return _0x157c72;}})});}_0x142cf8=_[_0x0f30('0x36')]({},_0x142cf8,_0x1a8d75[_0x0f30('0x39')]);var _0x1825fa={'where':_0x142cf8[_0x0f30('0x32')]};return db['ZendeskField'][_0x0f30('0x19')](_0x1825fa)['then'](function(_0x28fa30){_0x1cff0f['count']=_0x28fa30;if(_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x3a')]){_0x142cf8[_0x0f30('0x3b')]=[{'all':!![]}];}return db[_0x0f30('0x3c')][_0x0f30('0x3d')](_0x142cf8);})[_0x0f30('0x1f')](function(_0x6f477b){_0x1cff0f[_0x0f30('0x3e')]=_0x6f477b;return _0x1cff0f;})[_0x0f30('0x1f')](respondWithFilteredResult(_0x47fc00,_0x142cf8))[_0x0f30('0x3f')](handleError(_0x47fc00,null));};exports[_0x0f30('0x40')]=function(_0x422e02,_0x1231ba){var _0x41ac20={'raw':!![],'where':{'id':_0x422e02[_0x0f30('0x41')]['id']}},_0x145597={};_0x145597[_0x0f30('0x28')]=_[_0x0f30('0x42')](db[_0x0f30('0x3c')][_0x0f30('0x43')]);_0x145597[_0x0f30('0x29')]=_[_0x0f30('0x42')](_0x422e02[_0x0f30('0x29')]);_0x145597[_0x0f30('0x33')]=_[_0x0f30('0x2a')](_0x145597[_0x0f30('0x28')],_0x145597[_0x0f30('0x29')]);_0x41ac20[_0x0f30('0x2b')]=_['intersection'](_0x145597[_0x0f30('0x28')],qs['fields'](_0x422e02[_0x0f30('0x29')][_0x0f30('0x44')]));_0x41ac20[_0x0f30('0x2b')]=_0x41ac20[_0x0f30('0x2b')][_0x0f30('0x2c')]?_0x41ac20[_0x0f30('0x2b')]:_0x145597[_0x0f30('0x28')];if(_0x422e02['query'][_0x0f30('0x3a')]){_0x41ac20['include']=[{'all':!![]}];}_0x41ac20=_['merge']({},_0x41ac20,_0x422e02[_0x0f30('0x39')]);return db[_0x0f30('0x3c')][_0x0f30('0x45')](_0x41ac20)[_0x0f30('0x1f')](handleEntityNotFound(_0x1231ba,null))[_0x0f30('0x1f')](respondWithResult(_0x1231ba,null))[_0x0f30('0x3f')](handleError(_0x1231ba,null));};exports['create']=function(_0x5ac3ab,_0x2f9594){return db[_0x0f30('0x3c')]['create'](_0x5ac3ab[_0x0f30('0x46')],{})[_0x0f30('0x1f')](respondWithResult(_0x2f9594,0xc9))[_0x0f30('0x3f')](handleError(_0x2f9594,null));};exports[_0x0f30('0x47')]=function(_0x9782c6,_0xaf6f98){if(_0x9782c6[_0x0f30('0x46')]['id']){delete _0x9782c6[_0x0f30('0x46')]['id'];}return db[_0x0f30('0x3c')][_0x0f30('0x45')]({'where':{'id':_0x9782c6[_0x0f30('0x41')]['id']}})[_0x0f30('0x1f')](handleEntityNotFound(_0xaf6f98,null))[_0x0f30('0x1f')](saveUpdates(_0x9782c6['body'],null))[_0x0f30('0x1f')](respondWithResult(_0xaf6f98,null))[_0x0f30('0x3f')](handleError(_0xaf6f98,null));};exports[_0x0f30('0x20')]=function(_0x1de872,_0x28ae95){return db[_0x0f30('0x3c')][_0x0f30('0x45')]({'where':{'id':_0x1de872[_0x0f30('0x41')]['id']}})[_0x0f30('0x1f')](handleEntityNotFound(_0x28ae95,null))[_0x0f30('0x1f')](removeEntity(_0x28ae95,null))[_0x0f30('0x3f')](handleError(_0x28ae95,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f80ac26..dcb22dc 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 _0x531a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x531a,0x100));var _0xa531=function(_0x52753e,_0x1718bc){_0x52753e=_0x52753e-0x0;var _0x5b2cd5=_0x531a[_0x52753e];return _0x5b2cd5;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var logger=require(_0xa531('0x2'))(_0xa531('0x3'));var moment=require(_0xa531('0x4'));var BPromise=require(_0xa531('0x5'));var rp=require(_0xa531('0x6'));var fs=require('fs');var path=require(_0xa531('0x7'));var rimraf=require(_0xa531('0x8'));var config=require(_0xa531('0x9'));var attributes=require('./intZendeskField.attributes');module[_0xa531('0xa')]=function(_0x4ec419,_0x266b43){return _0x4ec419[_0xa531('0xb')](_0xa531('0xc'),attributes,{'tableName':_0xa531('0xd'),'paranoid':![],'indexes':[{'name':_0xa531('0xe'),'fields':['idField',_0xa531('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5fc=['../../config/environment','exports','define','idField','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0xd5fc,0xae));var _0xcd5f=function(_0x269705,_0x1276a3){_0x269705=_0x269705-0x0;var _0x372a1b=_0xd5fc[_0x269705];return _0x372a1b;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcd5f('0x1'));var BPromise=require(_0xcd5f('0x2'));var rp=require(_0xcd5f('0x3'));var fs=require('fs');var path=require(_0xcd5f('0x4'));var rimraf=require(_0xcd5f('0x5'));var config=require(_0xcd5f('0x6'));var attributes=require('./intZendeskField.attributes');module[_0xcd5f('0x7')]=function(_0x4b4ca8,_0x95b8bb){return _0x4b4ca8[_0xcd5f('0x8')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xcd5f('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index fc843d1..fdaa038 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 _0xc7c4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring'];(function(_0x34043b,_0x135de7){var _0x4031ab=function(_0x1a1788){while(--_0x1a1788){_0x34043b['push'](_0x34043b['shift']());}};_0x4031ab(++_0x135de7);}(_0xc7c4,0x1b2));var _0x4c7c=function(_0x63cfc8,_0x4a0921){_0x63cfc8=_0x63cfc8-0x0;var _0x723916=_0xc7c4[_0x63cfc8];return _0x723916;};'use strict';var _=require('lodash');var util=require(_0x4c7c('0x0'));var moment=require('moment');var BPromise=require(_0x4c7c('0x1'));var rs=require(_0x4c7c('0x2'));var fs=require('fs');var Redis=require(_0x4c7c('0x3'));var db=require(_0x4c7c('0x4'))['db'];var utils=require(_0x4c7c('0x5'));var logger=require(_0x4c7c('0x6'))(_0x4c7c('0x7'));var config=require(_0x4c7c('0x8'));var jayson=require(_0x4c7c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x390168,_0x3457aa,_0x2058da){return new BPromise(function(_0x43c185,_0x453571){return client[_0x4c7c('0xa')](_0x390168,_0x2058da)[_0x4c7c('0xb')](function(_0x453d49){logger[_0x4c7c('0xc')](_0x4c7c('0xd'),_0x3457aa,_0x4c7c('0xe'));logger[_0x4c7c('0xf')](_0x4c7c('0x10'),_0x3457aa,_0x4c7c('0xe'),JSON[_0x4c7c('0x11')](_0x453d49));if(_0x453d49[_0x4c7c('0x12')]){if(_0x453d49[_0x4c7c('0x12')][_0x4c7c('0x13')]===0x1f4){logger[_0x4c7c('0x12')](_0x4c7c('0xd'),_0x3457aa,_0x453d49[_0x4c7c('0x12')][_0x4c7c('0x14')]);return _0x453571(_0x453d49[_0x4c7c('0x12')][_0x4c7c('0x14')]);}logger[_0x4c7c('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3457aa,_0x453d49['error'][_0x4c7c('0x14')]);return _0x43c185(_0x453d49[_0x4c7c('0x12')][_0x4c7c('0x14')]);}else{logger['info'](_0x4c7c('0xd'),_0x3457aa,'request\x20sent');_0x43c185(_0x453d49[_0x4c7c('0x15')][_0x4c7c('0x14')]);}})[_0x4c7c('0x16')](function(_0x4d6184){logger['error'](_0x4c7c('0xd'),_0x3457aa,_0x4d6184);_0x453571(_0x4d6184);});});} \ No newline at end of file +var _0xfc55=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb'];(function(_0x4ded2b,_0x4ec27a){var _0x406c24=function(_0x447905){while(--_0x447905){_0x4ded2b['push'](_0x4ded2b['shift']());}};_0x406c24(++_0x4ec27a);}(_0xfc55,0x1ca));var _0x5fc5=function(_0xdfb6f8,_0x2641be){_0xdfb6f8=_0xdfb6f8-0x0;var _0xaf622e=_0xfc55[_0xdfb6f8];return _0xaf622e;};'use strict';var _=require('lodash');var util=require(_0x5fc5('0x0'));var moment=require(_0x5fc5('0x1'));var BPromise=require('bluebird');var rs=require(_0x5fc5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fc5('0x3'))['db'];var utils=require(_0x5fc5('0x4'));var logger=require(_0x5fc5('0x5'))(_0x5fc5('0x6'));var config=require(_0x5fc5('0x7'));var jayson=require(_0x5fc5('0x8'));var client=jayson[_0x5fc5('0x9')][_0x5fc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c4718,_0x59dfda,_0x456136){return new BPromise(function(_0x328c90,_0x3e4295){return client[_0x5fc5('0xb')](_0x2c4718,_0x456136)['then'](function(_0x8b6de4){logger[_0x5fc5('0xc')](_0x5fc5('0xd'),_0x59dfda,_0x5fc5('0xe'));logger[_0x5fc5('0xf')](_0x5fc5('0x10'),_0x59dfda,_0x5fc5('0xe'),JSON[_0x5fc5('0x11')](_0x8b6de4));if(_0x8b6de4[_0x5fc5('0x12')]){if(_0x8b6de4[_0x5fc5('0x12')]['code']===0x1f4){logger[_0x5fc5('0x12')](_0x5fc5('0xd'),_0x59dfda,_0x8b6de4[_0x5fc5('0x12')][_0x5fc5('0x13')]);return _0x3e4295(_0x8b6de4[_0x5fc5('0x12')][_0x5fc5('0x13')]);}logger[_0x5fc5('0x12')](_0x5fc5('0xd'),_0x59dfda,_0x8b6de4[_0x5fc5('0x12')][_0x5fc5('0x13')]);return _0x328c90(_0x8b6de4['error'][_0x5fc5('0x13')]);}else{logger[_0x5fc5('0xc')]('ZendeskField,\x20%s,\x20%s',_0x59dfda,_0x5fc5('0xe'));_0x328c90(_0x8b6de4[_0x5fc5('0x14')][_0x5fc5('0x13')]);}})[_0x5fc5('0x15')](function(_0x4e47de){logger[_0x5fc5('0x12')](_0x5fc5('0xd'),_0x59dfda,_0x4e47de);_0x3e4295(_0x4e47de);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index d8598b3..67df54a 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 _0xd7f6=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','../../config/environment','./intZohoAccount.controller'];(function(_0x2a43b9,_0x2aa7ea){var _0x3b6c90=function(_0x5be37f){while(--_0x5be37f){_0x2a43b9['push'](_0x2a43b9['shift']());}};_0x3b6c90(++_0x2aa7ea);}(_0xd7f6,0xd6));var _0x6d7f=function(_0x21fc7a,_0x3cbef7){_0x21fc7a=_0x21fc7a-0x0;var _0x52f11c=_0xd7f6[_0x21fc7a];return _0x52f11c;};'use strict';var multer=require('multer');var util=require(_0x6d7f('0x0'));var path=require(_0x6d7f('0x1'));var timeout=require(_0x6d7f('0x2'));var express=require(_0x6d7f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d7f('0x4'));var controller=require(_0x6d7f('0x5'));router[_0x6d7f('0x6')]('/',auth[_0x6d7f('0x7')](),controller[_0x6d7f('0x8')]);router[_0x6d7f('0x6')](_0x6d7f('0x9'),auth[_0x6d7f('0x7')](),controller[_0x6d7f('0xa')]);router[_0x6d7f('0x6')](_0x6d7f('0xb'),auth[_0x6d7f('0x7')](),controller[_0x6d7f('0xc')]);router[_0x6d7f('0x6')]('/:id/fields',auth[_0x6d7f('0x7')](),controller[_0x6d7f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6d7f('0xe')]);router['post'](_0x6d7f('0xb'),auth['isAuthenticated'](),controller[_0x6d7f('0xf')]);router[_0x6d7f('0x10')]('/:id',auth[_0x6d7f('0x7')](),controller[_0x6d7f('0x11')]);router[_0x6d7f('0x12')]('/:id',auth[_0x6d7f('0x7')](),controller['destroy']);module[_0x6d7f('0x13')]=router; \ No newline at end of file +var _0x6a0d=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','put','update','delete','destroy','exports','util','path'];(function(_0x49c550,_0xa9cdcd){var _0x39da96=function(_0x1dc6d8){while(--_0x1dc6d8){_0x49c550['push'](_0x49c550['shift']());}};_0x39da96(++_0xa9cdcd);}(_0x6a0d,0x18d));var _0xd6a0=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6a0d[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0xd6a0('0x0'));var path=require(_0xd6a0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd6a0('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xd6a0('0x3'));var config=require(_0xd6a0('0x4'));var controller=require('./intZohoAccount.controller');router[_0xd6a0('0x5')]('/',auth[_0xd6a0('0x6')](),controller[_0xd6a0('0x7')]);router[_0xd6a0('0x5')](_0xd6a0('0x8'),auth['isAuthenticated'](),controller[_0xd6a0('0x9')]);router['get'](_0xd6a0('0xa'),auth[_0xd6a0('0x6')](),controller[_0xd6a0('0xb')]);router[_0xd6a0('0x5')]('/:id/fields',auth[_0xd6a0('0x6')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd6a0('0xc')]('/:id/configurations',auth[_0xd6a0('0x6')](),controller[_0xd6a0('0xd')]);router[_0xd6a0('0xe')](_0xd6a0('0x8'),auth['isAuthenticated'](),controller[_0xd6a0('0xf')]);router[_0xd6a0('0x10')](_0xd6a0('0x8'),auth['isAuthenticated'](),controller[_0xd6a0('0x11')]);module[_0xd6a0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b920a90..166e36d 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 _0xbebf=['STRING','sequelize','exports'];(function(_0x4d3d13,_0x4c5bff){var _0x244df9=function(_0x575353){while(--_0x575353){_0x4d3d13['push'](_0x4d3d13['shift']());}};_0x244df9(++_0x4c5bff);}(_0xbebf,0xcd));var _0xfbeb=function(_0x3c64de,_0x4d2b21){_0x3c64de=_0x3c64de-0x0;var _0x3413b5=_0xbebf[_0x3c64de];return _0x3413b5;};'use strict';var Sequelize=require(_0xfbeb('0x0'));module[_0xfbeb('0x1')]={'name':{'type':Sequelize[_0xfbeb('0x2')]},'description':{'type':Sequelize[_0xfbeb('0x2')]},'host':{'type':Sequelize[_0xfbeb('0x2')]},'zone':{'type':Sequelize[_0xfbeb('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xfbeb('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xfbeb('0x2')]}}; \ No newline at end of file +var _0x6e51=['exports','STRING'];(function(_0x15fca0,_0x1cf85f){var _0x2e6a37=function(_0x5306cd){while(--_0x5306cd){_0x15fca0['push'](_0x15fca0['shift']());}};_0x2e6a37(++_0x1cf85f);}(_0x6e51,0x138));var _0x16e5=function(_0x51020c,_0x28eb60){_0x51020c=_0x51020c-0x0;var _0x29280d=_0x6e51[_0x51020c];return _0x29280d;};'use strict';var Sequelize=require('sequelize');module[_0x16e5('0x0')]={'name':{'type':Sequelize[_0x16e5('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x16e5('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x16e5('0x1')]},'clientSecret':{'type':Sequelize[_0x16e5('0x1')]},'serverUrl':{'type':Sequelize[_0x16e5('0x1')]},'code':{'type':Sequelize[_0x16e5('0x1')]},'refreshToken':{'type':Sequelize[_0x16e5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c85b6e6..4171f44 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 _0x62b7=['response','Subject','Description','WhoId','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','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','find','catch','update','body','getConfigurations','findOne','ZohoConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','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','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','serverUrl','host','zoho.eu','com','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20'];(function(_0x3b57fc,_0x1fbf22){var _0x146f10=function(_0x857ac3){while(--_0x857ac3){_0x3b57fc['push'](_0x3b57fc['shift']());}};_0x146f10(++_0x1fbf22);}(_0x62b7,0xa8));var _0x762b=function(_0xf1add8,_0x1254a0){_0xf1add8=_0xf1add8-0x0;var _0x8cc260=_0x62b7[_0xf1add8];return _0x8cc260;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x762b('0x0'));var rimraf=require(_0x762b('0x1'));var zipdir=require(_0x762b('0x2'));var jsonpatch=require(_0x762b('0x3'));var rp=require('request-promise');var moment=require(_0x762b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x762b('0x5'));var util=require('util');var path=require(_0x762b('0x6'));var sox=require(_0x762b('0x7'));var csv=require(_0x762b('0x8'));var ejs=require(_0x762b('0x9'));var fs=require('fs');var _=require(_0x762b('0xa'));var squel=require(_0x762b('0xb'));var crypto=require(_0x762b('0xc'));var jsforce=require(_0x762b('0xd'));var deskjs=require(_0x762b('0xe'));var toCsv=require(_0x762b('0x8'));var querystring=require(_0x762b('0xf'));var Papa=require('papaparse');var Redis=require(_0x762b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x762b('0x11'));var as=require(_0x762b('0x12'));var hardwareService=require(_0x762b('0x13'));var logger=require(_0x762b('0x14'))(_0x762b('0x15'));var utils=require(_0x762b('0x16'));var config=require(_0x762b('0x17'));var db=require(_0x762b('0x18'))['db'];var integrations=require(_0x762b('0x19'));var jayson=require(_0x762b('0x1a'));var client=jayson[_0x762b('0x1b')][_0x762b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0xa36209,_0x4f4de9,_0x3d1df7){if(_0x3d1df7){var _0x1ed1fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ed1fd[_0x762b('0x1d')](_0x4f4de9)){return _0xa36209;}else{throw new db[(_0x762b('0x1e'))][(_0x762b('0x1f'))](_0x762b('0x20'));}}else{return _0xa36209;}}function respondWithRpcPromise(_0x92cbba,_0x2fb7e7,_0x1d51b7,_0x4aada1){return new BPromise(function(_0xdd3cf6,_0x417825){var _0xf807eb=_0x4aada1||client;return _0xf807eb[_0x762b('0x21')](_0x92cbba,_0x1d51b7)['then'](function(_0x178e62){logger[_0x762b('0x22')](_0x762b('0x23'),_0x2fb7e7,_0x762b('0x24'));logger[_0x762b('0x25')](_0x762b('0x26'),_0x2fb7e7,_0x762b('0x24'),JSON[_0x762b('0x27')](_0x178e62));if(_0x178e62['error']){if(_0x178e62['error'][_0x762b('0x28')]===0x1f4){logger[_0x762b('0x29')](_0x762b('0x23'),_0x2fb7e7,_0x178e62['error'][_0x762b('0x2a')]);return _0x417825(_0x178e62['error'][_0x762b('0x2a')]);}logger['error'](_0x762b('0x23'),_0x2fb7e7,_0x178e62[_0x762b('0x29')][_0x762b('0x2a')]);return _0xdd3cf6(_0x178e62[_0x762b('0x29')][_0x762b('0x2a')]);}else{logger[_0x762b('0x22')](_0x762b('0x23'),_0x2fb7e7,'request\x20sent');_0xdd3cf6(_0x178e62[_0x762b('0x2b')][_0x762b('0x2a')]);}})['catch'](function(_0x3d5f1f){logger[_0x762b('0x29')](_0x762b('0x23'),_0x2fb7e7,_0x3d5f1f);_0x417825(_0x3d5f1f);});});}function respondWithStatusCode(_0xe546db,_0x52c419){_0x52c419=_0x52c419||0xcc;return function(_0x4ebfc3){if(_0x4ebfc3){return _0xe546db[_0x762b('0x2c')](_0x52c419);}return _0xe546db['status'](_0x52c419)[_0x762b('0x2d')]();};}function respondWithResult(_0x19053f,_0x586c3c){_0x586c3c=_0x586c3c||0xc8;return function(_0x329a7a){if(_0x329a7a){return _0x19053f[_0x762b('0x2e')](_0x586c3c)['json'](_0x329a7a);}};}function respondWithFilteredResult(_0x1c376e,_0x66ec9e){return function(_0x481473){if(_0x481473){var _0x373d84=_0x481473['count'],_0x54b774=_0x66ec9e[_0x762b('0x2f')],_0x38be1d=_0x66ec9e[_0x762b('0x2f')]+_0x66ec9e[_0x762b('0x30')],_0x56b1f8;if(_0x38be1d>=_0x373d84){_0x38be1d=_0x373d84;_0x56b1f8=0xc8;}else{_0x56b1f8=0xce;}_0x1c376e[_0x762b('0x2e')](_0x56b1f8);return _0x1c376e[_0x762b('0x31')](_0x762b('0x32'),_0x54b774+'-'+_0x38be1d+'/'+_0x373d84)[_0x762b('0x33')](_0x481473);}return null;};}function patchUpdates(_0xc3d7e9){return function(_0x27f283){try{jsonpatch[_0x762b('0x34')](_0x27f283,_0xc3d7e9,!![]);}catch(_0x55823d){return BPromise[_0x762b('0x35')](_0x55823d);}return _0x27f283[_0x762b('0x36')]();};}function saveUpdates(_0x40c20a,_0x110875){return function(_0xd8368c){if(_0xd8368c){return _0xd8368c['update'](_0x40c20a)['then'](function(_0x24c623){return _0x24c623;});}return null;};}function removeEntity(_0x33827a,_0x581af9){return function(_0x500633){if(_0x500633){return _0x500633[_0x762b('0x37')]()[_0x762b('0x38')](function(){_0x33827a[_0x762b('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e035,_0x46f5f6){return function(_0x11ac95){if(!_0x11ac95){_0x13e035[_0x762b('0x2c')](0x194);}return _0x11ac95;};}function handleError(_0x5183a3,_0xc7a493){_0xc7a493=_0xc7a493||0x1f4;return function(_0x1503ab){logger[_0x762b('0x29')](_0x1503ab[_0x762b('0x39')]);if(_0x1503ab['name']){delete _0x1503ab[_0x762b('0x3a')];}_0x5183a3[_0x762b('0x2e')](_0xc7a493)['send'](_0x1503ab);};}exports[_0x762b('0x3b')]=function(_0x3a2e73,_0x5a6b47){var _0x4cadfa={},_0x1285ea={},_0x5aa504={'count':0x0,'rows':[]};var _0x2b75d8=_[_0x762b('0x3c')](db[_0x762b('0x3d')][_0x762b('0x3e')],function(_0x5a7e13){return{'name':_0x5a7e13[_0x762b('0x3f')],'type':_0x5a7e13['type'][_0x762b('0x40')]};});_0x1285ea[_0x762b('0x41')]=_[_0x762b('0x3c')](_0x2b75d8,_0x762b('0x3a'));_0x1285ea[_0x762b('0x42')]=_[_0x762b('0x43')](_0x3a2e73[_0x762b('0x42')]);_0x1285ea[_0x762b('0x44')]=_[_0x762b('0x45')](_0x1285ea['model'],_0x1285ea[_0x762b('0x42')]);_0x4cadfa['attributes']=_[_0x762b('0x45')](_0x1285ea[_0x762b('0x41')],qs['fields'](_0x3a2e73[_0x762b('0x42')][_0x762b('0x46')]));_0x4cadfa[_0x762b('0x47')]=_0x4cadfa[_0x762b('0x47')][_0x762b('0x48')]?_0x4cadfa['attributes']:_0x1285ea[_0x762b('0x41')];if(!_0x3a2e73[_0x762b('0x42')][_0x762b('0x49')]('nolimit')){_0x4cadfa[_0x762b('0x30')]=qs[_0x762b('0x30')](_0x3a2e73['query'][_0x762b('0x30')]);_0x4cadfa[_0x762b('0x2f')]=qs[_0x762b('0x2f')](_0x3a2e73[_0x762b('0x42')][_0x762b('0x2f')]);}_0x4cadfa[_0x762b('0x4a')]=qs['sort'](_0x3a2e73[_0x762b('0x42')]['sort']);_0x4cadfa[_0x762b('0x4b')]=qs['filters'](_[_0x762b('0x4c')](_0x3a2e73[_0x762b('0x42')],_0x1285ea[_0x762b('0x44')]),_0x2b75d8);if(_0x3a2e73[_0x762b('0x42')]['filter']){_0x4cadfa[_0x762b('0x4b')]=_[_0x762b('0x4d')](_0x4cadfa[_0x762b('0x4b')],{'$or':_['map'](_0x2b75d8,function(_0x31d73b){if(_0x31d73b[_0x762b('0x4e')]!==_0x762b('0x4f')){var _0x196d2e={};_0x196d2e[_0x31d73b['name']]={'$like':'%'+_0x3a2e73['query'][_0x762b('0x50')]+'%'};return _0x196d2e;}})});}_0x4cadfa=_[_0x762b('0x4d')]({},_0x4cadfa,_0x3a2e73[_0x762b('0x51')]);var _0x10694a={'where':_0x4cadfa[_0x762b('0x4b')]};return db[_0x762b('0x3d')]['count'](_0x10694a)[_0x762b('0x38')](function(_0x45086c){_0x5aa504[_0x762b('0x52')]=_0x45086c;if(_0x3a2e73['query'][_0x762b('0x53')]){_0x4cadfa[_0x762b('0x54')]=[{'all':!![]}];}return db[_0x762b('0x3d')][_0x762b('0x55')](_0x4cadfa);})[_0x762b('0x38')](function(_0x29b2d3){_0x5aa504[_0x762b('0x56')]=_0x29b2d3;return _0x5aa504;})[_0x762b('0x38')](respondWithFilteredResult(_0x5a6b47,_0x4cadfa))['catch'](handleError(_0x5a6b47,null));};exports['show']=function(_0xe43ba2,_0xa2277e){var _0x344439={'raw':![],'where':{'id':_0xe43ba2[_0x762b('0x57')]['id']}},_0x2e403f={};_0x2e403f[_0x762b('0x41')]=_['keys'](db['ZohoAccount']['rawAttributes']);_0x2e403f[_0x762b('0x42')]=_['keys'](_0xe43ba2[_0x762b('0x42')]);_0x2e403f[_0x762b('0x44')]=_[_0x762b('0x45')](_0x2e403f[_0x762b('0x41')],_0x2e403f['query']);_0x344439[_0x762b('0x47')]=_[_0x762b('0x45')](_0x2e403f[_0x762b('0x41')],qs[_0x762b('0x46')](_0xe43ba2[_0x762b('0x42')][_0x762b('0x46')]));_0x344439[_0x762b('0x47')]=_0x344439[_0x762b('0x47')][_0x762b('0x48')]?_0x344439['attributes']:_0x2e403f[_0x762b('0x41')];if(_0xe43ba2['query']['includeAll']){_0x344439[_0x762b('0x54')]=[{'all':!![]}];}_0x344439=_['merge']({},_0x344439,_0xe43ba2[_0x762b('0x51')]);return db[_0x762b('0x3d')][_0x762b('0x58')](_0x344439)['then'](handleEntityNotFound(_0xa2277e,null))[_0x762b('0x38')](respondWithResult(_0xa2277e,null))[_0x762b('0x59')](handleError(_0xa2277e,null));};exports['create']=function(_0x10fef2,_0x41d14f){return db[_0x762b('0x3d')]['create'](_0x10fef2['body'],{})[_0x762b('0x38')](respondWithResult(_0x41d14f,0xc9))['catch'](handleError(_0x41d14f,null));};exports[_0x762b('0x5a')]=function(_0x2fe59,_0x38c8e7){if(_0x2fe59[_0x762b('0x5b')]['id']){delete _0x2fe59[_0x762b('0x5b')]['id'];}return db[_0x762b('0x3d')]['find']({'where':{'id':_0x2fe59[_0x762b('0x57')]['id']}})[_0x762b('0x38')](handleEntityNotFound(_0x38c8e7,null))[_0x762b('0x38')](saveUpdates(_0x2fe59[_0x762b('0x5b')],null))[_0x762b('0x38')](respondWithResult(_0x38c8e7,null))[_0x762b('0x59')](handleError(_0x38c8e7,null));};exports[_0x762b('0x37')]=function(_0x5a9322,_0x1219ea){return db['ZohoAccount']['find']({'where':{'id':_0x5a9322[_0x762b('0x57')]['id']}})[_0x762b('0x38')](handleEntityNotFound(_0x1219ea,null))['then'](removeEntity(_0x1219ea,null))[_0x762b('0x59')](handleError(_0x1219ea,null));};exports[_0x762b('0x5c')]=function(_0x1ac0a3,_0x4a0971,_0x42a35a){var _0x17d013={};var _0x34c687={};var _0x40076f;var _0x3263fd;return db[_0x762b('0x3d')][_0x762b('0x5d')]({'where':{'id':_0x1ac0a3['params']['id']}})['then'](handleEntityNotFound(_0x4a0971,null))[_0x762b('0x38')](function(_0x41477a){if(_0x41477a){_0x40076f=_0x41477a;_0x34c687[_0x762b('0x41')]=_[_0x762b('0x43')](db[_0x762b('0x5e')][_0x762b('0x3e')]);_0x34c687[_0x762b('0x42')]=_['keys'](_0x1ac0a3[_0x762b('0x42')]);_0x34c687['filters']=_[_0x762b('0x45')](_0x34c687[_0x762b('0x41')],_0x34c687[_0x762b('0x42')]);_0x17d013[_0x762b('0x47')]=_['intersection'](_0x34c687[_0x762b('0x41')],qs['fields'](_0x1ac0a3[_0x762b('0x42')]['fields']));_0x17d013[_0x762b('0x47')]=_0x17d013[_0x762b('0x47')][_0x762b('0x48')]?_0x17d013['attributes']:_0x34c687['model'];_0x17d013[_0x762b('0x4a')]=qs[_0x762b('0x5f')](_0x1ac0a3[_0x762b('0x42')][_0x762b('0x5f')]);_0x17d013[_0x762b('0x4b')]=qs[_0x762b('0x44')](_[_0x762b('0x4c')](_0x1ac0a3[_0x762b('0x42')],_0x34c687['filters']));if(_0x1ac0a3[_0x762b('0x42')][_0x762b('0x50')]){_0x17d013['where']=_[_0x762b('0x4d')](_0x17d013[_0x762b('0x4b')],{'$or':_[_0x762b('0x3c')](_0x17d013['attributes'],function(_0x416cc9){var _0x211c64={};_0x211c64[_0x416cc9]={'$like':'%'+_0x1ac0a3['query'][_0x762b('0x50')]+'%'};return _0x211c64;})});}_0x17d013=_[_0x762b('0x4d')]({},_0x17d013,_0x1ac0a3[_0x762b('0x51')]);return _0x40076f[_0x762b('0x5c')](_0x17d013);}})['then'](function(_0x50a7c7){if(_0x50a7c7){_0x3263fd=_0x50a7c7['length'];if(!_0x1ac0a3['query'][_0x762b('0x49')](_0x762b('0x60'))){_0x17d013[_0x762b('0x30')]=qs[_0x762b('0x30')](_0x1ac0a3[_0x762b('0x42')][_0x762b('0x30')]);_0x17d013[_0x762b('0x2f')]=qs[_0x762b('0x2f')](_0x1ac0a3[_0x762b('0x42')][_0x762b('0x2f')]);}return _0x40076f[_0x762b('0x5c')](_0x17d013);}})[_0x762b('0x38')](function(_0x182446){if(_0x182446){return _0x182446?{'count':_0x3263fd,'rows':_0x182446}:null;}})[_0x762b('0x38')](respondWithResult(_0x4a0971,null))[_0x762b('0x59')](handleError(_0x4a0971,null));};exports[_0x762b('0x61')]=function(_0x16dd0b,_0x473665,_0x4a6010){if(_0x16dd0b[_0x762b('0x5b')]['id']){delete _0x16dd0b[_0x762b('0x5b')]['id'];}return db[_0x762b('0x3d')][_0x762b('0x5d')]({'where':{'id':_0x16dd0b[_0x762b('0x57')]['id']}})[_0x762b('0x38')](handleEntityNotFound(_0x473665,null))[_0x762b('0x38')](function(_0x38f44b){if(_0x38f44b){_0x16dd0b[_0x762b('0x5b')][_0x762b('0x62')]=_0x38f44b['id'];_0x16dd0b[_0x762b('0x5b')][_0x762b('0x63')]=integrations[_0x762b('0x64')](_0x16dd0b[_0x762b('0x5b')][_0x762b('0x65')],_0x16dd0b['body'][_0x762b('0x4e')]);_0x16dd0b[_0x762b('0x5b')][_0x762b('0x66')]=integrations[_0x762b('0x67')](_0x16dd0b[_0x762b('0x5b')][_0x762b('0x65')],_0x16dd0b[_0x762b('0x5b')][_0x762b('0x4e')]);return db[_0x762b('0x5e')][_0x762b('0x68')](_0x16dd0b['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x762b('0x69')],'as':_0x762b('0x66')}]});}return null;})['then'](respondWithResult(_0x473665,null))[_0x762b('0x59')](handleError(_0x473665,null));};function getAccessToken(_0x5a2be3){return new Promise(function(_0x37bc91,_0x185216){var _0xb2c2c5;switch(_0x5a2be3[_0x762b('0x6a')]){case'US':_0xb2c2c5=_0x762b('0x6b');break;case'AU':_0xb2c2c5=_0x762b('0x6c');break;case'EU':_0xb2c2c5=_0x762b('0x6d');break;case'IN':_0xb2c2c5=_0x762b('0x6e');break;case'CN':_0xb2c2c5=_0x762b('0x6f');break;default:_0xb2c2c5=_0x762b('0x6d');break;}var _0x514270={'method':_0x762b('0x70'),'uri':_0xb2c2c5+_0x762b('0x71'),'qs':{'refresh_token':_0x5a2be3[_0x762b('0x72')],'client_id':_0x5a2be3[_0x762b('0x73')],'client_secret':_0x5a2be3[_0x762b('0x74')],'grant_type':_0x762b('0x75')},'json':!![]};return rp(_0x514270)[_0x762b('0x38')](function(_0x5c2cf7){if(_0x5c2cf7[_0x762b('0x76')]){_0x37bc91(_0x5c2cf7[_0x762b('0x76')]);}else{_0x185216(_0x762b('0x77'));}})[_0x762b('0x59')](function(_0x147e2a){_0x185216(_0x147e2a);});});}exports['getFields']=function(_0x113a4b,_0x34bfe4,_0x3d6b5d){var _0x11114c,_0xac3dde,_0x2775c7,_0x1ba773,_0x1a3b4e;return db['ZohoAccount']['findOne']({'where':{'id':_0x113a4b[_0x762b('0x57')]['id']},'attributes':['id','host',_0x762b('0x6a'),'clientId','clientSecret',_0x762b('0x78'),_0x762b('0x28'),_0x762b('0x72')]})['then'](handleEntityNotFound(_0x34bfe4,null))['then'](function(_0x271e50){_0x1a3b4e=_0x271e50;_0x11114c=_0x1a3b4e[_0x762b('0x79')];_0xac3dde=_0x11114c===_0x762b('0x7a')?'eu':_0x762b('0x7b');_0x2775c7=_0x1a3b4e[_0x762b('0x78')];var _0x1010ac=_0x2775c7['slice'](-0x1);if(_0x1010ac==='/'||_0x1010ac==='\x5c'||_0x1010ac===':'){_0x2775c7=_0x2775c7[_0x762b('0x7c')](0x0,_0x2775c7['lastIndexOf'](_0x1010ac));}if(!_0x1a3b4e[_0x762b('0x72')]){throw new Error(_0x762b('0x7d'));}return getAccessToken(_0x1a3b4e);})['then'](function(_0x1c7082){if(_0x1c7082){return rp({'method':'GET','uri':util[_0x762b('0x7e')](_0x762b('0x7f'),_0xac3dde),'qs':{'module':_0x762b('0x80')},'headers':{'Authorization':_0x762b('0x81')+_0x1c7082},'json':!![]});}})[_0x762b('0x38')](function(_0x4e67c6){if(_0x4e67c6){if(_0x4e67c6[_0x762b('0x82')]&&_0x4e67c6[_0x762b('0x82')][_0x762b('0x29')]){throw new Error(_0x4e67c6[_0x762b('0x82')][_0x762b('0x29')][_0x762b('0x2a')]);}var _0x22029c=[];var _0xd543bb=[];var _0x4eb91f=['Owner',_0x762b('0x83'),_0x762b('0x84'),_0x762b('0x85'),'Call_Duration',_0x762b('0x86'),_0x762b('0x87'),_0x762b('0x88')];_0xd543bb=_[_0x762b('0x89')](_0x4e67c6[_0x762b('0x46')],function(_0x16db90){return _0x4eb91f[_0x762b('0x8a')](_0x16db90[_0x762b('0x8b')]);});for(var _0x27d8a4=0x0;_0x27d8a4<_0xd543bb['length'];_0x27d8a4++){if(_0xd543bb[_0x27d8a4][_0x762b('0x8c')]===![]){_0x22029c[_0x762b('0x8d')]({'id':_0xd543bb[_0x27d8a4]['id'],'name':_0xd543bb[_0x27d8a4][_0x762b('0x8e')],'custom':_0xd543bb[_0x27d8a4][_0x762b('0x8f')],'options':_0xd543bb[_0x27d8a4][_0x762b('0x90')]===_0x762b('0x91')&&_0xd543bb[_0x27d8a4][_0x762b('0x92')]['length']>-0x1?_[_0x762b('0x3c')](_0xd543bb[_0x27d8a4][_0x762b('0x92')],function(_0x42f56c){return{'name':_0x42f56c,'value':_0x42f56c};}):[]});}}return{'count':_0x22029c[_0x762b('0x48')],'rows':_0x22029c};}else{return{'count':0x0,'rows':[]};}})[_0x762b('0x38')](respondWithResult(_0x34bfe4,null))[_0x762b('0x59')](function(_0x2730c3){var _0x12e7c1=_0x113a4b[_0x762b('0x42')]['test']?0x1f4:_0x2730c3['statusCode']||0x1f4;logger['error'](_0x762b('0x93'),_0x762b('0x94'),_0x12e7c1,JSON[_0x762b('0x27')](_0x2730c3));delete _0x2730c3[_0x762b('0x3a')];if(_0x12e7c1===0x191){_0x12e7c1=0x190;}_0x34bfe4[_0x762b('0x2e')](_0x12e7c1)['send'](_0x113a4b[_0x762b('0x42')][_0x762b('0x1d')]?{'message':'Wrong\x20credentials','statusCode':_0x2730c3['statusCode']}:_0x2730c3);});}; \ No newline at end of file +var _0x0236=['sort','where','pick','filters','filter','merge','findAll','params','includeAll','options','find','body','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','getDescriptions','create','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','host','clientId','serverUrl','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','Content-Range','save','update','then','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','limit','order'];(function(_0x3185ad,_0x5e5ca2){var _0x4f77fb=function(_0x435aca){while(--_0x435aca){_0x3185ad['push'](_0x3185ad['shift']());}};_0x4f77fb(++_0x5e5ca2);}(_0x0236,0xce));var _0x6023=function(_0x12d917,_0x59ddd4){_0x12d917=_0x12d917-0x0;var _0x576d1a=_0x0236[_0x12d917];return _0x576d1a;};'use strict';var pdf=require(_0x6023('0x0'));var emlformat=require(_0x6023('0x1'));var rimraf=require(_0x6023('0x2'));var zipdir=require(_0x6023('0x3'));var jsonpatch=require(_0x6023('0x4'));var rp=require('request-promise');var moment=require(_0x6023('0x5'));var BPromise=require(_0x6023('0x6'));var Mustache=require('mustache');var util=require(_0x6023('0x7'));var path=require(_0x6023('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6023('0x9'));var squel=require(_0x6023('0xa'));var crypto=require(_0x6023('0xb'));var jsforce=require(_0x6023('0xc'));var deskjs=require(_0x6023('0xd'));var toCsv=require(_0x6023('0xe'));var querystring=require(_0x6023('0xf'));var Papa=require(_0x6023('0x10'));var Redis=require('ioredis');var authService=require(_0x6023('0x11'));var qs=require(_0x6023('0x12'));var as=require(_0x6023('0x13'));var hardwareService=require(_0x6023('0x14'));var logger=require(_0x6023('0x15'))('api');var utils=require(_0x6023('0x16'));var config=require('../../config/environment');var db=require(_0x6023('0x17'))['db'];var integrations=require(_0x6023('0x18'));var jayson=require(_0x6023('0x19'));var client=jayson['client'][_0x6023('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x29bc2a,_0x45290f,_0x27c48e){if(_0x27c48e){var _0x5cb1e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5cb1e5[_0x6023('0x1b')](_0x45290f)){return _0x29bc2a;}else{throw new db[(_0x6023('0x1c'))][(_0x6023('0x1d'))](_0x6023('0x1e'));}}else{return _0x29bc2a;}}function respondWithRpcPromise(_0x3627b2,_0x184dc0,_0x9470d2,_0x5e9ce6){return new BPromise(function(_0x133544,_0x144b70){var _0x195b14=_0x5e9ce6||client;return _0x195b14['request'](_0x3627b2,_0x9470d2)['then'](function(_0x500ec5){logger[_0x6023('0x1f')](_0x6023('0x20'),_0x184dc0,_0x6023('0x21'));logger[_0x6023('0x22')](_0x6023('0x23'),_0x184dc0,'request\x20sent',JSON[_0x6023('0x24')](_0x500ec5));if(_0x500ec5[_0x6023('0x25')]){if(_0x500ec5[_0x6023('0x25')][_0x6023('0x26')]===0x1f4){logger[_0x6023('0x25')](_0x6023('0x20'),_0x184dc0,_0x500ec5[_0x6023('0x25')][_0x6023('0x27')]);return _0x144b70(_0x500ec5['error'][_0x6023('0x27')]);}logger['error'](_0x6023('0x20'),_0x184dc0,_0x500ec5[_0x6023('0x25')]['message']);return _0x133544(_0x500ec5['error']['message']);}else{logger[_0x6023('0x1f')](_0x6023('0x20'),_0x184dc0,_0x6023('0x21'));_0x133544(_0x500ec5['result']['message']);}})[_0x6023('0x28')](function(_0x217729){logger[_0x6023('0x25')](_0x6023('0x20'),_0x184dc0,_0x217729);_0x144b70(_0x217729);});});}function respondWithStatusCode(_0x1bbe5d,_0x403edd){_0x403edd=_0x403edd||0xcc;return function(_0x163280){if(_0x163280){return _0x1bbe5d[_0x6023('0x29')](_0x403edd);}return _0x1bbe5d[_0x6023('0x2a')](_0x403edd)[_0x6023('0x2b')]();};}function respondWithResult(_0x5f01f9,_0x3294e3){_0x3294e3=_0x3294e3||0xc8;return function(_0x4a34f9){if(_0x4a34f9){return _0x5f01f9[_0x6023('0x2a')](_0x3294e3)[_0x6023('0x2c')](_0x4a34f9);}};}function respondWithFilteredResult(_0x48dfd2,_0x1cab1b){return function(_0x4b7136){if(_0x4b7136){var _0x5eb3c1=_0x4b7136[_0x6023('0x2d')],_0xe8128a=_0x1cab1b[_0x6023('0x2e')],_0x6b0112=_0x1cab1b['offset']+_0x1cab1b['limit'],_0x2366cc;if(_0x6b0112>=_0x5eb3c1){_0x6b0112=_0x5eb3c1;_0x2366cc=0xc8;}else{_0x2366cc=0xce;}_0x48dfd2[_0x6023('0x2a')](_0x2366cc);return _0x48dfd2['set'](_0x6023('0x2f'),_0xe8128a+'-'+_0x6b0112+'/'+_0x5eb3c1)[_0x6023('0x2c')](_0x4b7136);}return null;};}function patchUpdates(_0x437f33){return function(_0x123a2a){try{jsonpatch['apply'](_0x123a2a,_0x437f33,!![]);}catch(_0x102d43){return BPromise['reject'](_0x102d43);}return _0x123a2a[_0x6023('0x30')]();};}function saveUpdates(_0x3679dd,_0x41c3d0){return function(_0x32e90c){if(_0x32e90c){return _0x32e90c[_0x6023('0x31')](_0x3679dd)[_0x6023('0x32')](function(_0x2183eb){return _0x2183eb;});}return null;};}function removeEntity(_0x2a4cc8,_0x2b7ce1){return function(_0x5de172){if(_0x5de172){return _0x5de172[_0x6023('0x33')]()[_0x6023('0x32')](function(){_0x2a4cc8[_0x6023('0x2a')](0xcc)[_0x6023('0x2b')]();});}};}function handleEntityNotFound(_0x1a6073,_0x4e4feb){return function(_0x2280f0){if(!_0x2280f0){_0x1a6073['sendStatus'](0x194);}return _0x2280f0;};}function handleError(_0xd803be,_0x353b47){_0x353b47=_0x353b47||0x1f4;return function(_0x2c370d){logger[_0x6023('0x25')](_0x2c370d[_0x6023('0x34')]);if(_0x2c370d[_0x6023('0x35')]){delete _0x2c370d[_0x6023('0x35')];}_0xd803be[_0x6023('0x2a')](_0x353b47)[_0x6023('0x36')](_0x2c370d);};}exports[_0x6023('0x37')]=function(_0xacfa65,_0x3f05e5){var _0x1c62ed={},_0x3e07a3={},_0x1862fd={'count':0x0,'rows':[]};var _0xb2e79a=_[_0x6023('0x38')](db[_0x6023('0x39')][_0x6023('0x3a')],function(_0x1272d9){return{'name':_0x1272d9[_0x6023('0x3b')],'type':_0x1272d9[_0x6023('0x3c')][_0x6023('0x3d')]};});_0x3e07a3[_0x6023('0x3e')]=_[_0x6023('0x38')](_0xb2e79a,_0x6023('0x35'));_0x3e07a3['query']=_[_0x6023('0x3f')](_0xacfa65[_0x6023('0x40')]);_0x3e07a3['filters']=_[_0x6023('0x41')](_0x3e07a3[_0x6023('0x3e')],_0x3e07a3['query']);_0x1c62ed['attributes']=_['intersection'](_0x3e07a3[_0x6023('0x3e')],qs[_0x6023('0x42')](_0xacfa65[_0x6023('0x40')][_0x6023('0x42')]));_0x1c62ed['attributes']=_0x1c62ed[_0x6023('0x43')][_0x6023('0x44')]?_0x1c62ed['attributes']:_0x3e07a3[_0x6023('0x3e')];if(!_0xacfa65['query']['hasOwnProperty'](_0x6023('0x45'))){_0x1c62ed[_0x6023('0x46')]=qs[_0x6023('0x46')](_0xacfa65['query'][_0x6023('0x46')]);_0x1c62ed[_0x6023('0x2e')]=qs[_0x6023('0x2e')](_0xacfa65[_0x6023('0x40')][_0x6023('0x2e')]);}_0x1c62ed[_0x6023('0x47')]=qs[_0x6023('0x48')](_0xacfa65[_0x6023('0x40')]['sort']);_0x1c62ed[_0x6023('0x49')]=qs['filters'](_[_0x6023('0x4a')](_0xacfa65[_0x6023('0x40')],_0x3e07a3[_0x6023('0x4b')]),_0xb2e79a);if(_0xacfa65[_0x6023('0x40')][_0x6023('0x4c')]){_0x1c62ed[_0x6023('0x49')]=_[_0x6023('0x4d')](_0x1c62ed[_0x6023('0x49')],{'$or':_['map'](_0xb2e79a,function(_0x2f37ff){if(_0x2f37ff[_0x6023('0x3c')]!=='VIRTUAL'){var _0x32c81c={};_0x32c81c[_0x2f37ff[_0x6023('0x35')]]={'$like':'%'+_0xacfa65[_0x6023('0x40')][_0x6023('0x4c')]+'%'};return _0x32c81c;}})});}_0x1c62ed=_[_0x6023('0x4d')]({},_0x1c62ed,_0xacfa65['options']);var _0x2e5648={'where':_0x1c62ed[_0x6023('0x49')]};return db['ZohoAccount'][_0x6023('0x2d')](_0x2e5648)[_0x6023('0x32')](function(_0x1732ca){_0x1862fd[_0x6023('0x2d')]=_0x1732ca;if(_0xacfa65['query']['includeAll']){_0x1c62ed['include']=[{'all':!![]}];}return db[_0x6023('0x39')][_0x6023('0x4e')](_0x1c62ed);})[_0x6023('0x32')](function(_0x4476c0){_0x1862fd['rows']=_0x4476c0;return _0x1862fd;})[_0x6023('0x32')](respondWithFilteredResult(_0x3f05e5,_0x1c62ed))['catch'](handleError(_0x3f05e5,null));};exports['show']=function(_0xbab65,_0x113be0){var _0x26ad4c={'raw':![],'where':{'id':_0xbab65[_0x6023('0x4f')]['id']}},_0x563a6b={};_0x563a6b[_0x6023('0x3e')]=_[_0x6023('0x3f')](db[_0x6023('0x39')][_0x6023('0x3a')]);_0x563a6b[_0x6023('0x40')]=_['keys'](_0xbab65[_0x6023('0x40')]);_0x563a6b[_0x6023('0x4b')]=_['intersection'](_0x563a6b[_0x6023('0x3e')],_0x563a6b['query']);_0x26ad4c[_0x6023('0x43')]=_[_0x6023('0x41')](_0x563a6b[_0x6023('0x3e')],qs[_0x6023('0x42')](_0xbab65[_0x6023('0x40')][_0x6023('0x42')]));_0x26ad4c[_0x6023('0x43')]=_0x26ad4c[_0x6023('0x43')]['length']?_0x26ad4c[_0x6023('0x43')]:_0x563a6b[_0x6023('0x3e')];if(_0xbab65[_0x6023('0x40')][_0x6023('0x50')]){_0x26ad4c['include']=[{'all':!![]}];}_0x26ad4c=_['merge']({},_0x26ad4c,_0xbab65[_0x6023('0x51')]);return db['ZohoAccount'][_0x6023('0x52')](_0x26ad4c)[_0x6023('0x32')](handleEntityNotFound(_0x113be0,null))[_0x6023('0x32')](respondWithResult(_0x113be0,null))[_0x6023('0x28')](handleError(_0x113be0,null));};exports['create']=function(_0x5e0c55,_0x46b456){return db['ZohoAccount']['create'](_0x5e0c55[_0x6023('0x53')],{})[_0x6023('0x32')](respondWithResult(_0x46b456,0xc9))['catch'](handleError(_0x46b456,null));};exports['update']=function(_0x2ef322,_0x25e9b4){if(_0x2ef322[_0x6023('0x53')]['id']){delete _0x2ef322[_0x6023('0x53')]['id'];}return db[_0x6023('0x39')][_0x6023('0x52')]({'where':{'id':_0x2ef322['params']['id']}})[_0x6023('0x32')](handleEntityNotFound(_0x25e9b4,null))[_0x6023('0x32')](saveUpdates(_0x2ef322[_0x6023('0x53')],null))[_0x6023('0x32')](respondWithResult(_0x25e9b4,null))[_0x6023('0x28')](handleError(_0x25e9b4,null));};exports[_0x6023('0x33')]=function(_0x540649,_0x59a52e){return db[_0x6023('0x39')]['find']({'where':{'id':_0x540649[_0x6023('0x4f')]['id']}})['then'](handleEntityNotFound(_0x59a52e,null))[_0x6023('0x32')](removeEntity(_0x59a52e,null))[_0x6023('0x28')](handleError(_0x59a52e,null));};exports['getConfigurations']=function(_0x5abd5a,_0x33c75a,_0x1f477c){var _0x36c54f={};var _0x76b84a={};var _0x33fb7f;var _0x27ef45;return db['ZohoAccount'][_0x6023('0x54')]({'where':{'id':_0x5abd5a['params']['id']}})[_0x6023('0x32')](handleEntityNotFound(_0x33c75a,null))['then'](function(_0x5464ae){if(_0x5464ae){_0x33fb7f=_0x5464ae;_0x76b84a['model']=_[_0x6023('0x3f')](db[_0x6023('0x55')][_0x6023('0x3a')]);_0x76b84a[_0x6023('0x40')]=_['keys'](_0x5abd5a[_0x6023('0x40')]);_0x76b84a[_0x6023('0x4b')]=_[_0x6023('0x41')](_0x76b84a[_0x6023('0x3e')],_0x76b84a['query']);_0x36c54f[_0x6023('0x43')]=_['intersection'](_0x76b84a[_0x6023('0x3e')],qs[_0x6023('0x42')](_0x5abd5a[_0x6023('0x40')][_0x6023('0x42')]));_0x36c54f[_0x6023('0x43')]=_0x36c54f['attributes'][_0x6023('0x44')]?_0x36c54f[_0x6023('0x43')]:_0x76b84a[_0x6023('0x3e')];_0x36c54f[_0x6023('0x47')]=qs[_0x6023('0x48')](_0x5abd5a['query'][_0x6023('0x48')]);_0x36c54f[_0x6023('0x49')]=qs[_0x6023('0x4b')](_[_0x6023('0x4a')](_0x5abd5a[_0x6023('0x40')],_0x76b84a[_0x6023('0x4b')]));if(_0x5abd5a[_0x6023('0x40')][_0x6023('0x4c')]){_0x36c54f['where']=_[_0x6023('0x4d')](_0x36c54f[_0x6023('0x49')],{'$or':_[_0x6023('0x38')](_0x36c54f[_0x6023('0x43')],function(_0xd69b7){var _0xec801b={};_0xec801b[_0xd69b7]={'$like':'%'+_0x5abd5a[_0x6023('0x40')][_0x6023('0x4c')]+'%'};return _0xec801b;})});}_0x36c54f=_[_0x6023('0x4d')]({},_0x36c54f,_0x5abd5a['options']);return _0x33fb7f[_0x6023('0x56')](_0x36c54f);}})[_0x6023('0x32')](function(_0x1ff6c8){if(_0x1ff6c8){_0x27ef45=_0x1ff6c8[_0x6023('0x44')];if(!_0x5abd5a[_0x6023('0x40')]['hasOwnProperty']('nolimit')){_0x36c54f[_0x6023('0x46')]=qs[_0x6023('0x46')](_0x5abd5a[_0x6023('0x40')]['limit']);_0x36c54f[_0x6023('0x2e')]=qs[_0x6023('0x2e')](_0x5abd5a[_0x6023('0x40')][_0x6023('0x2e')]);}return _0x33fb7f['getConfigurations'](_0x36c54f);}})[_0x6023('0x32')](function(_0x3b0755){if(_0x3b0755){return _0x3b0755?{'count':_0x27ef45,'rows':_0x3b0755}:null;}})[_0x6023('0x32')](respondWithResult(_0x33c75a,null))['catch'](handleError(_0x33c75a,null));};exports[_0x6023('0x57')]=function(_0x8a8fc9,_0x25bea9,_0x29c8af){if(_0x8a8fc9[_0x6023('0x53')]['id']){delete _0x8a8fc9['body']['id'];}return db[_0x6023('0x39')][_0x6023('0x54')]({'where':{'id':_0x8a8fc9[_0x6023('0x4f')]['id']}})['then'](handleEntityNotFound(_0x25bea9,null))[_0x6023('0x32')](function(_0xf0a6d7){if(_0xf0a6d7){_0x8a8fc9[_0x6023('0x53')][_0x6023('0x58')]=_0xf0a6d7['id'];_0x8a8fc9[_0x6023('0x53')]['Subjects']=integrations[_0x6023('0x59')](_0x8a8fc9[_0x6023('0x53')][_0x6023('0x5a')],_0x8a8fc9[_0x6023('0x53')][_0x6023('0x3c')]);_0x8a8fc9['body']['Descriptions']=integrations[_0x6023('0x5b')](_0x8a8fc9[_0x6023('0x53')]['channel'],_0x8a8fc9[_0x6023('0x53')][_0x6023('0x3c')]);return db['ZohoConfiguration'][_0x6023('0x5c')](_0x8a8fc9['body'],{'include':[{'model':db[_0x6023('0x5d')],'as':_0x6023('0x5e')},{'model':db['ZohoField'],'as':_0x6023('0x5f')}]});}return null;})[_0x6023('0x32')](respondWithResult(_0x25bea9,null))[_0x6023('0x28')](handleError(_0x25bea9,null));};function getAccessToken(_0x3c4b21){return new Promise(function(_0x27f2fd,_0x5498e9){var _0x573a19;switch(_0x3c4b21[_0x6023('0x60')]){case'US':_0x573a19='https://accounts.zoho.com';break;case'AU':_0x573a19=_0x6023('0x61');break;case'EU':_0x573a19=_0x6023('0x62');break;case'IN':_0x573a19='https://accounts.zoho.in';break;case'CN':_0x573a19=_0x6023('0x63');break;default:_0x573a19=_0x6023('0x62');break;}var _0x449afb={'method':_0x6023('0x64'),'uri':_0x573a19+_0x6023('0x65'),'qs':{'refresh_token':_0x3c4b21[_0x6023('0x66')],'client_id':_0x3c4b21['clientId'],'client_secret':_0x3c4b21[_0x6023('0x67')],'grant_type':_0x6023('0x68')},'json':!![]};return rp(_0x449afb)[_0x6023('0x32')](function(_0x53a336){if(_0x53a336['access_token']){_0x27f2fd(_0x53a336[_0x6023('0x69')]);}else{_0x5498e9('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x6023('0x28')](function(_0x4eb238){_0x5498e9(_0x4eb238);});});}exports['getFields']=function(_0x421980,_0x4bc9f4,_0x2ddbb7){var _0xa2fee8,_0x47ec0a,_0x39150c,_0x2829df,_0x32c636;return db['ZohoAccount'][_0x6023('0x54')]({'where':{'id':_0x421980[_0x6023('0x4f')]['id']},'attributes':['id',_0x6023('0x6a'),_0x6023('0x60'),_0x6023('0x6b'),'clientSecret',_0x6023('0x6c'),_0x6023('0x26'),'refreshToken']})['then'](handleEntityNotFound(_0x4bc9f4,null))['then'](function(_0x1ae814){_0x32c636=_0x1ae814;_0xa2fee8=_0x32c636[_0x6023('0x6a')];_0x47ec0a=_0xa2fee8==='zoho.eu'?'eu':_0x6023('0x6d');_0x39150c=_0x32c636[_0x6023('0x6c')];var _0x5b937e=_0x39150c[_0x6023('0x6e')](-0x1);if(_0x5b937e==='/'||_0x5b937e==='\x5c'||_0x5b937e===':'){_0x39150c=_0x39150c[_0x6023('0x6f')](0x0,_0x39150c[_0x6023('0x70')](_0x5b937e));}if(!_0x32c636['refreshToken']){throw new Error(_0x6023('0x71'));}return getAccessToken(_0x32c636);})[_0x6023('0x32')](function(_0x5d9d94){if(_0x5d9d94){return rp({'method':_0x6023('0x72'),'uri':util[_0x6023('0x73')](_0x6023('0x74'),_0x47ec0a),'qs':{'module':_0x6023('0x75')},'headers':{'Authorization':_0x6023('0x76')+_0x5d9d94},'json':!![]});}})['then'](function(_0xdb7bf3){if(_0xdb7bf3){if(_0xdb7bf3[_0x6023('0x77')]&&_0xdb7bf3['response'][_0x6023('0x25')]){throw new Error(_0xdb7bf3[_0x6023('0x77')][_0x6023('0x25')][_0x6023('0x27')]);}var _0x308941=[];var _0x34c89b=[];var _0x2fdde4=[_0x6023('0x78'),_0x6023('0x79'),_0x6023('0x7a'),_0x6023('0x7b'),_0x6023('0x7c'),_0x6023('0x7d'),_0x6023('0x7e'),_0x6023('0x7f')];_0x34c89b=_[_0x6023('0x80')](_0xdb7bf3[_0x6023('0x42')],function(_0x478c00){return _0x2fdde4[_0x6023('0x81')](_0x478c00[_0x6023('0x82')]);});for(var _0x76a146=0x0;_0x76a146<_0x34c89b[_0x6023('0x44')];_0x76a146++){if(_0x34c89b[_0x76a146][_0x6023('0x83')]===![]){_0x308941['push']({'id':_0x34c89b[_0x76a146]['id'],'name':_0x34c89b[_0x76a146][_0x6023('0x84')],'custom':_0x34c89b[_0x76a146][_0x6023('0x85')],'options':_0x34c89b[_0x76a146][_0x6023('0x86')]===_0x6023('0x87')&&_0x34c89b[_0x76a146][_0x6023('0x88')][_0x6023('0x44')]>-0x1?_[_0x6023('0x38')](_0x34c89b[_0x76a146][_0x6023('0x88')],function(_0x38bca7){return{'name':_0x38bca7,'value':_0x38bca7};}):[]});}}return{'count':_0x308941[_0x6023('0x44')],'rows':_0x308941};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4bc9f4,null))[_0x6023('0x28')](function(_0x3eacd4){var _0x260a56=_0x421980[_0x6023('0x40')][_0x6023('0x1b')]?0x1f4:_0x3eacd4['statusCode']||0x1f4;logger['error'](_0x6023('0x89'),'getFields',_0x260a56,JSON['stringify'](_0x3eacd4));delete _0x3eacd4['name'];if(_0x260a56===0x191){_0x260a56=0x190;}_0x4bc9f4['status'](_0x260a56)['send'](_0x421980[_0x6023('0x40')][_0x6023('0x1b')]?{'message':_0x6023('0x8a'),'statusCode':_0x3eacd4['statusCode']}:_0x3eacd4);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 42d6959..63e3a5a 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 _0x2551=['application/x-www-form-urlencoded','refresh_token','info','format','name','error','inspect','catch','then','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','zone','clientId','clientSecret','changed','code','host','serverUrl','substring','lastIndexOf','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','authorization_code'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2551,0xcf));var _0x1255=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x2551[_0xd336fa];return _0x3370b1;};'use strict';var _=require(_0x1255('0x0'));var util=require(_0x1255('0x1'));var logger=require('../../config/logger')(_0x1255('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1255('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1255('0x4'));var attributes=require(_0x1255('0x5'));var integrations=require(_0x1255('0x6'));module[_0x1255('0x7')]=function(_0x4072d5,_0xfc1671){return _0x4072d5['define'](_0x1255('0x8'),attributes,{'tableName':_0x1255('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31a96b,_0x6a0f04,_0x42b647){if(_0x31a96b['changed'](_0x1255('0xa'))||_0x31a96b['changed']('serverUrl')||_0x31a96b['changed'](_0x1255('0xb'))||_0x31a96b['changed'](_0x1255('0xc'))||_0x31a96b[_0x1255('0xd')](_0x1255('0xe'))||_0x31a96b[_0x1255('0xd')](_0x1255('0xf'))){var _0x4ad4a4,_0x3f95b4;_0x4ad4a4=_0x31a96b[_0x1255('0x10')];var _0x5bb2ae=_0x4ad4a4['slice'](-0x1);if(_0x5bb2ae==='/'||_0x5bb2ae==='\x5c'||_0x5bb2ae===':'){_0x4ad4a4=_0x4ad4a4[_0x1255('0x11')](0x0,_0x4ad4a4[_0x1255('0x12')](_0x5bb2ae));}switch(_0x31a96b[_0x1255('0xa')]){case'US':_0x3f95b4=_0x1255('0x13');break;case'AU':_0x3f95b4=_0x1255('0x14');break;case'IN':_0x3f95b4=_0x1255('0x15');break;case'CN':_0x3f95b4=_0x1255('0x16');break;default:_0x3f95b4=_0x1255('0x17');break;}var _0x2058c1={'method':_0x1255('0x18'),'uri':_0x3f95b4+_0x1255('0x19'),'form':{'grant_type':_0x1255('0x1a'),'client_id':_0x31a96b[_0x1255('0xb')],'client_secret':_0x31a96b[_0x1255('0xc')],'redirect_uri':_0x31a96b['serverUrl'],'code':_0x31a96b[_0x1255('0xe')]},'headers':{'Content-Type':_0x1255('0x1b')}};return rp(_0x2058c1)['then'](function(_0xda1b01){var _0x2adef5=JSON['parse'](_0xda1b01);if(_0x2adef5[_0x1255('0x1c')]){_0x31a96b['refreshToken']=_0x2adef5[_0x1255('0x1c')];logger[_0x1255('0x1d')](util[_0x1255('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31a96b[_0x1255('0x1f')],_0x31a96b['id']));}else{logger[_0x1255('0x20')](util[_0x1255('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31a96b[_0x1255('0x1f')],_0x31a96b['id']),util[_0x1255('0x21')](_0x2adef5,{'showHidden':![],'depth':null}));}return _0x42b647(null,_0x6a0f04);})[_0x1255('0x22')](function(_0x4c33b7){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31a96b[_0x1255('0x1f')],_0x31a96b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x42b647(_0x4c33b7);});}else{return _0x42b647(null,_0x6a0f04);}},'beforeUpdate':function(_0x1f2636,_0x31a833,_0x3d79a4){if(_0x1f2636[_0x1255('0xd')](_0x1255('0xa'))||_0x1f2636['changed'](_0x1255('0x10'))||_0x1f2636[_0x1255('0xd')](_0x1255('0xb'))||_0x1f2636[_0x1255('0xd')](_0x1255('0xc'))||_0x1f2636[_0x1255('0xd')](_0x1255('0xe'))||_0x1f2636['changed'](_0x1255('0xf'))){var _0x37cbaa,_0x3e03bd;_0x37cbaa=_0x1f2636[_0x1255('0x10')];var _0x3c8419=_0x37cbaa['slice'](-0x1);if(_0x3c8419==='/'||_0x3c8419==='\x5c'||_0x3c8419===':'){_0x37cbaa=_0x37cbaa[_0x1255('0x11')](0x0,_0x37cbaa[_0x1255('0x12')](_0x3c8419));}switch(_0x1f2636[_0x1255('0xa')]){case'US':_0x3e03bd=_0x1255('0x13');break;case'AU':_0x3e03bd=_0x1255('0x14');break;case'IN':_0x3e03bd=_0x1255('0x15');break;case'CN':_0x3e03bd=_0x1255('0x16');break;default:_0x3e03bd=_0x1255('0x17');break;}var _0x52ae6a={'method':'POST','uri':_0x3e03bd+_0x1255('0x19'),'form':{'grant_type':_0x1255('0x1a'),'client_id':_0x1f2636['clientId'],'client_secret':_0x1f2636[_0x1255('0xc')],'redirect_uri':_0x1f2636[_0x1255('0x10')],'code':_0x1f2636['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x52ae6a)[_0x1255('0x23')](function(_0x11d1bb){var _0xe195d9=JSON['parse'](_0x11d1bb);if(_0xe195d9[_0x1255('0x1c')]){_0x1f2636[_0x1255('0x24')]=_0xe195d9[_0x1255('0x1c')];logger[_0x1255('0x1d')](util['format'](_0x1255('0x25'),_0x1f2636[_0x1255('0x1f')],_0x1f2636['id']));}else{logger['error'](util[_0x1255('0x1e')](_0x1255('0x26'),_0x1f2636[_0x1255('0x1f')],_0x1f2636['id']),util['inspect'](_0xe195d9,{'showHidden':![],'depth':null}));}return _0x3d79a4(null,_0x31a833);})[_0x1255('0x22')](function(_0x3bef10){logger['error'](util[_0x1255('0x1e')](_0x1255('0x26'),_0x1f2636[_0x1255('0x1f')],_0x1f2636['id']),util[_0x1255('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3d79a4(_0x3bef10);});}else{return _0x3d79a4(null,_0x31a833);}}}});}; \ No newline at end of file +var _0x5fd1=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.eu','info','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','zone','changed','clientId','clientSecret','code','host','serverUrl','slice','substring'];(function(_0x4dd15b,_0x1d880a){var _0x2445f2=function(_0x236d63){while(--_0x236d63){_0x4dd15b['push'](_0x4dd15b['shift']());}};_0x2445f2(++_0x1d880a);}(_0x5fd1,0x13b));var _0x15fd=function(_0x559e4e,_0x1d1130){_0x559e4e=_0x559e4e-0x0;var _0x3fc11d=_0x5fd1[_0x559e4e];return _0x3fc11d;};'use strict';var _=require('lodash');var util=require(_0x15fd('0x0'));var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require(_0x15fd('0x4'));var rp=require(_0x15fd('0x5'));var fs=require('fs');var path=require(_0x15fd('0x6'));var rimraf=require('rimraf');var config=require(_0x15fd('0x7'));var attributes=require(_0x15fd('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x15fd('0x9')]=function(_0x5690c6,_0x5105ee){return _0x5690c6['define'](_0x15fd('0xa'),attributes,{'tableName':_0x15fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x544ee7,_0xc86fda,_0x1ce395){if(_0x544ee7['changed'](_0x15fd('0xc'))||_0x544ee7[_0x15fd('0xd')]('serverUrl')||_0x544ee7['changed'](_0x15fd('0xe'))||_0x544ee7[_0x15fd('0xd')](_0x15fd('0xf'))||_0x544ee7[_0x15fd('0xd')](_0x15fd('0x10'))||_0x544ee7['changed'](_0x15fd('0x11'))){var _0x170eec,_0x377400;_0x170eec=_0x544ee7[_0x15fd('0x12')];var _0x3aec0e=_0x170eec[_0x15fd('0x13')](-0x1);if(_0x3aec0e==='/'||_0x3aec0e==='\x5c'||_0x3aec0e===':'){_0x170eec=_0x170eec[_0x15fd('0x14')](0x0,_0x170eec[_0x15fd('0x15')](_0x3aec0e));}switch(_0x544ee7[_0x15fd('0xc')]){case'US':_0x377400=_0x15fd('0x16');break;case'AU':_0x377400=_0x15fd('0x17');break;case'IN':_0x377400=_0x15fd('0x18');break;case'CN':_0x377400=_0x15fd('0x19');break;default:_0x377400='https://accounts.zoho.eu';break;}var _0x4dfe91={'method':_0x15fd('0x1a'),'uri':_0x377400+_0x15fd('0x1b'),'form':{'grant_type':_0x15fd('0x1c'),'client_id':_0x544ee7['clientId'],'client_secret':_0x544ee7[_0x15fd('0xf')],'redirect_uri':_0x544ee7[_0x15fd('0x12')],'code':_0x544ee7[_0x15fd('0x10')]},'headers':{'Content-Type':_0x15fd('0x1d')}};return rp(_0x4dfe91)[_0x15fd('0x1e')](function(_0x23d1a5){var _0x4b57cf=JSON[_0x15fd('0x1f')](_0x23d1a5);if(_0x4b57cf[_0x15fd('0x20')]){_0x544ee7[_0x15fd('0x21')]=_0x4b57cf[_0x15fd('0x20')];logger['info'](util[_0x15fd('0x22')](_0x15fd('0x23'),_0x544ee7[_0x15fd('0x24')],_0x544ee7['id']));}else{logger[_0x15fd('0x25')](util[_0x15fd('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x544ee7['name'],_0x544ee7['id']),util[_0x15fd('0x26')](_0x4b57cf,{'showHidden':![],'depth':null}));}return _0x1ce395(null,_0xc86fda);})['catch'](function(_0x5e40e6){logger[_0x15fd('0x25')](util['format'](_0x15fd('0x27'),_0x544ee7[_0x15fd('0x24')],_0x544ee7['id']),util[_0x15fd('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1ce395(_0x5e40e6);});}else{return _0x1ce395(null,_0xc86fda);}},'beforeUpdate':function(_0x4dfc42,_0x2ec166,_0x4eea89){if(_0x4dfc42[_0x15fd('0xd')]('zone')||_0x4dfc42[_0x15fd('0xd')](_0x15fd('0x12'))||_0x4dfc42[_0x15fd('0xd')]('clientId')||_0x4dfc42['changed'](_0x15fd('0xf'))||_0x4dfc42[_0x15fd('0xd')](_0x15fd('0x10'))||_0x4dfc42['changed'](_0x15fd('0x11'))){var _0x18f241,_0x4d83a3;_0x18f241=_0x4dfc42['serverUrl'];var _0x2dc57f=_0x18f241[_0x15fd('0x13')](-0x1);if(_0x2dc57f==='/'||_0x2dc57f==='\x5c'||_0x2dc57f===':'){_0x18f241=_0x18f241['substring'](0x0,_0x18f241['lastIndexOf'](_0x2dc57f));}switch(_0x4dfc42[_0x15fd('0xc')]){case'US':_0x4d83a3=_0x15fd('0x16');break;case'AU':_0x4d83a3=_0x15fd('0x17');break;case'IN':_0x4d83a3=_0x15fd('0x18');break;case'CN':_0x4d83a3=_0x15fd('0x19');break;default:_0x4d83a3=_0x15fd('0x28');break;}var _0x52e53c={'method':_0x15fd('0x1a'),'uri':_0x4d83a3+'/oauth/v2/token','form':{'grant_type':_0x15fd('0x1c'),'client_id':_0x4dfc42[_0x15fd('0xe')],'client_secret':_0x4dfc42[_0x15fd('0xf')],'redirect_uri':_0x4dfc42[_0x15fd('0x12')],'code':_0x4dfc42[_0x15fd('0x10')]},'headers':{'Content-Type':_0x15fd('0x1d')}};return rp(_0x52e53c)[_0x15fd('0x1e')](function(_0x166f77){var _0xf61a5b=JSON[_0x15fd('0x1f')](_0x166f77);if(_0xf61a5b[_0x15fd('0x20')]){_0x4dfc42[_0x15fd('0x21')]=_0xf61a5b[_0x15fd('0x20')];logger[_0x15fd('0x29')](util[_0x15fd('0x22')](_0x15fd('0x23'),_0x4dfc42[_0x15fd('0x24')],_0x4dfc42['id']));}else{logger[_0x15fd('0x25')](util[_0x15fd('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4dfc42[_0x15fd('0x24')],_0x4dfc42['id']),util['inspect'](_0xf61a5b,{'showHidden':![],'depth':null}));}return _0x4eea89(null,_0x2ec166);})['catch'](function(_0x568a75){logger[_0x15fd('0x25')](util[_0x15fd('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4dfc42[_0x15fd('0x24')],_0x4dfc42['id']),util[_0x15fd('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x4eea89(_0x568a75);});}else{return _0x4eea89(null,_0x2ec166);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2a5cbf9..5d66f75 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 _0xe134=['stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','map','model','attributes','raw','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x40f4de,_0x38d0cb){var _0x3678dd=function(_0x3fdb40){while(--_0x3fdb40){_0x40f4de['push'](_0x40f4de['shift']());}};_0x3678dd(++_0x38d0cb);}(_0xe134,0x170));var _0x4e13=function(_0x13b28b,_0x5769fd){_0x13b28b=_0x13b28b-0x0;var _0x521b3d=_0xe134[_0x13b28b];return _0x521b3d;};'use strict';var _=require(_0x4e13('0x0'));var util=require(_0x4e13('0x1'));var moment=require(_0x4e13('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e13('0x3'));var fs=require('fs');var Redis=require(_0x4e13('0x4'));var db=require(_0x4e13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e13('0x6'))(_0x4e13('0x7'));var config=require('../../config/environment');var jayson=require(_0x4e13('0x8'));var client=jayson[_0x4e13('0x9')][_0x4e13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22ade6,_0x4c90f0,_0x1449d7){return new BPromise(function(_0x13887a,_0x5f1b18){return client['request'](_0x22ade6,_0x1449d7)[_0x4e13('0xb')](function(_0x43da09){logger[_0x4e13('0xc')](_0x4e13('0xd'),_0x4c90f0,'request\x20sent');logger[_0x4e13('0xe')](_0x4e13('0xf'),_0x4c90f0,_0x4e13('0x10'),JSON[_0x4e13('0x11')](_0x43da09));if(_0x43da09[_0x4e13('0x12')]){if(_0x43da09[_0x4e13('0x12')][_0x4e13('0x13')]===0x1f4){logger['error'](_0x4e13('0xd'),_0x4c90f0,_0x43da09[_0x4e13('0x12')][_0x4e13('0x14')]);return _0x5f1b18(_0x43da09['error'][_0x4e13('0x14')]);}logger['error'](_0x4e13('0xd'),_0x4c90f0,_0x43da09[_0x4e13('0x12')][_0x4e13('0x14')]);return _0x13887a(_0x43da09[_0x4e13('0x12')][_0x4e13('0x14')]);}else{logger[_0x4e13('0xc')](_0x4e13('0xd'),_0x4c90f0,'request\x20sent');_0x13887a(_0x43da09[_0x4e13('0x15')][_0x4e13('0x14')]);}})[_0x4e13('0x16')](function(_0x1848e1){logger['error'](_0x4e13('0xd'),_0x4c90f0,_0x1848e1);_0x5f1b18(_0x1848e1);});});}exports[_0x4e13('0x17')]=function(_0x1b9b6d){var _0x5ebf68=this;return new Promise(function(_0x293948,_0x3ea9){return db[_0x4e13('0x18')][_0x4e13('0x19')]({'raw':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')][_0x4e13('0x1b')]||null:null,'attributes':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')]['attributes']||null:null,'limit':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')][_0x4e13('0x1c')]||null:null,'include':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')][_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x1b9b6d[_0x4e13('0x1a')][_0x4e13('0x1d')],function(_0x1cb495){return{'model':db[_0x1cb495[_0x4e13('0x1f')]],'as':_0x1cb495['as'],'attributes':_0x1cb495[_0x4e13('0x20')],'include':_0x1cb495[_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x1cb495[_0x4e13('0x1d')],function(_0x3c0631){return{'model':db[_0x3c0631[_0x4e13('0x1f')]],'as':_0x3c0631['as'],'attributes':_0x3c0631[_0x4e13('0x20')],'include':_0x3c0631[_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x3c0631[_0x4e13('0x1d')],function(_0xd7cfcc){return{'model':db[_0xd7cfcc[_0x4e13('0x1f')]],'as':_0xd7cfcc['as'],'attributes':_0xd7cfcc[_0x4e13('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4e13('0xb')](function(_0x355fa8){logger[_0x4e13('0xc')](_0x4e13('0x17'),_0x1b9b6d);logger[_0x4e13('0xe')](_0x4e13('0x17'),_0x1b9b6d,JSON['stringify'](_0x355fa8));_0x293948(_0x355fa8);})[_0x4e13('0x16')](function(_0x35f17e){logger['error'](_0x4e13('0x17'),_0x35f17e[_0x4e13('0x14')],_0x1b9b6d);_0x3ea9(_0x5ebf68[_0x4e13('0x12')](0x1f4,_0x35f17e[_0x4e13('0x14')]));});});};exports['ShowZohoAccount']=function(_0x8e972d){var _0x52c0bd=this;return new Promise(function(_0x3d26e1,_0x3e341d){return db[_0x4e13('0x18')]['find']({'raw':_0x8e972d[_0x4e13('0x1a')]?_0x8e972d[_0x4e13('0x1a')][_0x4e13('0x21')]===undefined?!![]:![]:!![],'where':_0x8e972d[_0x4e13('0x1a')]?_0x8e972d[_0x4e13('0x1a')][_0x4e13('0x1b')]||null:null,'attributes':_0x8e972d[_0x4e13('0x1a')]?_0x8e972d[_0x4e13('0x1a')][_0x4e13('0x20')]||null:null,'include':_0x8e972d['options']?_0x8e972d['options'][_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x8e972d[_0x4e13('0x1a')][_0x4e13('0x1d')],function(_0x2fce13){return{'model':db[_0x2fce13[_0x4e13('0x1f')]],'as':_0x2fce13['as'],'attributes':_0x2fce13[_0x4e13('0x20')],'include':_0x2fce13[_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x2fce13['include'],function(_0x3bc818){return{'model':db[_0x3bc818[_0x4e13('0x1f')]],'as':_0x3bc818['as'],'attributes':_0x3bc818[_0x4e13('0x20')],'include':_0x3bc818[_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x3bc818[_0x4e13('0x1d')],function(_0x2af036){return{'model':db[_0x2af036['model']],'as':_0x2af036['as'],'attributes':_0x2af036[_0x4e13('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c2114){logger[_0x4e13('0xc')]('ShowZohoAccount',_0x8e972d);logger[_0x4e13('0xe')](_0x4e13('0x22'),_0x8e972d,JSON[_0x4e13('0x11')](_0x1c2114));_0x3d26e1(_0x1c2114);})[_0x4e13('0x16')](function(_0x45d2d3){logger[_0x4e13('0x12')](_0x4e13('0x22'),_0x45d2d3[_0x4e13('0x14')],_0x8e972d);_0x3e341d(_0x52c0bd['error'](0x1f4,_0x45d2d3['message']));});});}; \ No newline at end of file +var _0x2f8a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowZohoAccount','find','lodash'];(function(_0x7cce8d,_0x8d7c9c){var _0x381b50=function(_0x4ab2d4){while(--_0x4ab2d4){_0x7cce8d['push'](_0x7cce8d['shift']());}};_0x381b50(++_0x8d7c9c);}(_0x2f8a,0x12f));var _0xa2f8=function(_0x117cb1,_0x538faa){_0x117cb1=_0x117cb1-0x0;var _0xb82d6a=_0x2f8a[_0x117cb1];return _0xb82d6a;};'use strict';var _=require(_0xa2f8('0x0'));var util=require(_0xa2f8('0x1'));var moment=require(_0xa2f8('0x2'));var BPromise=require(_0xa2f8('0x3'));var rs=require(_0xa2f8('0x4'));var fs=require('fs');var Redis=require(_0xa2f8('0x5'));var db=require(_0xa2f8('0x6'))['db'];var utils=require(_0xa2f8('0x7'));var logger=require(_0xa2f8('0x8'))(_0xa2f8('0x9'));var config=require(_0xa2f8('0xa'));var jayson=require(_0xa2f8('0xb'));var client=jayson[_0xa2f8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42b8f8,_0x40fbf0,_0x4e4bb0){return new BPromise(function(_0x72b48c,_0xfd507a){return client[_0xa2f8('0xd')](_0x42b8f8,_0x4e4bb0)[_0xa2f8('0xe')](function(_0x474d61){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x40fbf0,_0xa2f8('0xf'));logger[_0xa2f8('0x10')](_0xa2f8('0x11'),_0x40fbf0,_0xa2f8('0xf'),JSON[_0xa2f8('0x12')](_0x474d61));if(_0x474d61[_0xa2f8('0x13')]){if(_0x474d61[_0xa2f8('0x13')][_0xa2f8('0x14')]===0x1f4){logger[_0xa2f8('0x13')](_0xa2f8('0x15'),_0x40fbf0,_0x474d61['error'][_0xa2f8('0x16')]);return _0xfd507a(_0x474d61[_0xa2f8('0x13')]['message']);}logger[_0xa2f8('0x13')](_0xa2f8('0x15'),_0x40fbf0,_0x474d61[_0xa2f8('0x13')]['message']);return _0x72b48c(_0x474d61[_0xa2f8('0x13')][_0xa2f8('0x16')]);}else{logger[_0xa2f8('0x17')]('ZohoAccount,\x20%s,\x20%s',_0x40fbf0,_0xa2f8('0xf'));_0x72b48c(_0x474d61['result'][_0xa2f8('0x16')]);}})[_0xa2f8('0x18')](function(_0xa2273b){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x40fbf0,_0xa2273b);_0xfd507a(_0xa2273b);});});}exports[_0xa2f8('0x19')]=function(_0x4928e1){var _0x5ea6db=this;return new Promise(function(_0x553749,_0x4554a4){return db[_0xa2f8('0x1a')][_0xa2f8('0x1b')]({'raw':_0x4928e1[_0xa2f8('0x1c')]?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x4928e1[_0xa2f8('0x1c')]?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x1e')]||null:null,'attributes':_0x4928e1[_0xa2f8('0x1c')]?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x1f')]||null:null,'limit':_0x4928e1[_0xa2f8('0x1c')]?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x20')]||null:null,'include':_0x4928e1['options']?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x21')]?_['map'](_0x4928e1['options']['include'],function(_0x21eaac){return{'model':db[_0x21eaac[_0xa2f8('0x22')]],'as':_0x21eaac['as'],'attributes':_0x21eaac[_0xa2f8('0x1f')],'include':_0x21eaac[_0xa2f8('0x21')]?_['map'](_0x21eaac[_0xa2f8('0x21')],function(_0x49c8e9){return{'model':db[_0x49c8e9[_0xa2f8('0x22')]],'as':_0x49c8e9['as'],'attributes':_0x49c8e9[_0xa2f8('0x1f')],'include':_0x49c8e9['include']?_[_0xa2f8('0x23')](_0x49c8e9[_0xa2f8('0x21')],function(_0x2dca85){return{'model':db[_0x2dca85[_0xa2f8('0x22')]],'as':_0x2dca85['as'],'attributes':_0x2dca85[_0xa2f8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa2f8('0xe')](function(_0x43d44d){logger['info'](_0xa2f8('0x19'),_0x4928e1);logger[_0xa2f8('0x10')](_0xa2f8('0x19'),_0x4928e1,JSON[_0xa2f8('0x12')](_0x43d44d));_0x553749(_0x43d44d);})[_0xa2f8('0x18')](function(_0x7f2903){logger[_0xa2f8('0x13')]('GetZohoAccount',_0x7f2903[_0xa2f8('0x16')],_0x4928e1);_0x4554a4(_0x5ea6db[_0xa2f8('0x13')](0x1f4,_0x7f2903['message']));});});};exports[_0xa2f8('0x24')]=function(_0x2afaac){var _0x40500c=this;return new Promise(function(_0x2cb882,_0x5b7d4b){return db['ZohoAccount'][_0xa2f8('0x25')]({'raw':_0x2afaac[_0xa2f8('0x1c')]?_0x2afaac['options'][_0xa2f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x2afaac[_0xa2f8('0x1c')]?_0x2afaac['options'][_0xa2f8('0x1e')]||null:null,'attributes':_0x2afaac['options']?_0x2afaac[_0xa2f8('0x1c')][_0xa2f8('0x1f')]||null:null,'include':_0x2afaac[_0xa2f8('0x1c')]?_0x2afaac[_0xa2f8('0x1c')][_0xa2f8('0x21')]?_[_0xa2f8('0x23')](_0x2afaac['options'][_0xa2f8('0x21')],function(_0x309234){return{'model':db[_0x309234['model']],'as':_0x309234['as'],'attributes':_0x309234['attributes'],'include':_0x309234[_0xa2f8('0x21')]?_[_0xa2f8('0x23')](_0x309234[_0xa2f8('0x21')],function(_0xa7fe72){return{'model':db[_0xa7fe72['model']],'as':_0xa7fe72['as'],'attributes':_0xa7fe72['attributes'],'include':_0xa7fe72['include']?_[_0xa2f8('0x23')](_0xa7fe72['include'],function(_0x23883d){return{'model':db[_0x23883d[_0xa2f8('0x22')]],'as':_0x23883d['as'],'attributes':_0x23883d[_0xa2f8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa2f8('0xe')](function(_0x5049fc){logger[_0xa2f8('0x17')]('ShowZohoAccount',_0x2afaac);logger[_0xa2f8('0x10')](_0xa2f8('0x24'),_0x2afaac,JSON[_0xa2f8('0x12')](_0x5049fc));_0x2cb882(_0x5049fc);})[_0xa2f8('0x18')](function(_0x5765f3){logger[_0xa2f8('0x13')]('ShowZohoAccount',_0x5765f3[_0xa2f8('0x16')],_0x2afaac);_0x5b7d4b(_0x40500c[_0xa2f8('0x13')](0x1f4,_0x5765f3[_0xa2f8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2298596..1c9222e 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 _0x0427=['/:id','show','/:id/fields','getFields','getDescriptions','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated'];(function(_0x1257dd,_0x159b6c){var _0x3ec13c=function(_0x110674){while(--_0x110674){_0x1257dd['push'](_0x1257dd['shift']());}};_0x3ec13c(++_0x159b6c);}(_0x0427,0x137));var _0x7042=function(_0x18999e,_0x3311d0){_0x18999e=_0x18999e-0x0;var _0xb0fb8=_0x0427[_0x18999e];return _0xb0fb8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7042('0x0'));var timeout=require(_0x7042('0x1'));var express=require('express');var router=express[_0x7042('0x2')]();var auth=require(_0x7042('0x3'));var interaction=require(_0x7042('0x4'));var config=require(_0x7042('0x5'));var controller=require(_0x7042('0x6'));router[_0x7042('0x7')]('/',auth[_0x7042('0x8')](),controller['index']);router[_0x7042('0x7')](_0x7042('0x9'),auth[_0x7042('0x8')](),controller[_0x7042('0xa')]);router[_0x7042('0x7')](_0x7042('0xb'),auth[_0x7042('0x8')](),controller[_0x7042('0xc')]);router[_0x7042('0x7')]('/:id/subjects',auth[_0x7042('0x8')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x7042('0xd')]);router['post']('/',auth[_0x7042('0x8')](),controller[_0x7042('0xe')]);router[_0x7042('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7042('0x10')]);router[_0x7042('0x11')](_0x7042('0x9'),auth[_0x7042('0x8')](),controller[_0x7042('0x12')]);module[_0x7042('0x13')]=router; \ No newline at end of file +var _0x2cb0=['get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x128de4,_0x511592){var _0x167659=function(_0x5d4b6d){while(--_0x5d4b6d){_0x128de4['push'](_0x128de4['shift']());}};_0x167659(++_0x511592);}(_0x2cb0,0x12c));var _0x02cb=function(_0x33c2db,_0x3940e0){_0x33c2db=_0x33c2db-0x0;var _0x94c99b=_0x2cb0[_0x33c2db];return _0x94c99b;};'use strict';var multer=require(_0x02cb('0x0'));var util=require(_0x02cb('0x1'));var path=require('path');var timeout=require(_0x02cb('0x2'));var express=require(_0x02cb('0x3'));var router=express[_0x02cb('0x4')]();var auth=require(_0x02cb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x02cb('0x6'));var controller=require(_0x02cb('0x7'));router[_0x02cb('0x8')]('/',auth[_0x02cb('0x9')](),controller[_0x02cb('0xa')]);router[_0x02cb('0x8')](_0x02cb('0xb'),auth[_0x02cb('0x9')](),controller['show']);router[_0x02cb('0x8')](_0x02cb('0xc'),auth[_0x02cb('0x9')](),controller[_0x02cb('0xd')]);router[_0x02cb('0x8')]('/:id/subjects',auth[_0x02cb('0x9')](),controller[_0x02cb('0xe')]);router[_0x02cb('0x8')]('/:id/descriptions',auth[_0x02cb('0x9')](),controller[_0x02cb('0xf')]);router[_0x02cb('0x10')]('/',auth[_0x02cb('0x9')](),controller['create']);router[_0x02cb('0x11')](_0x02cb('0xb'),auth[_0x02cb('0x9')](),controller[_0x02cb('0x12')]);router[_0x02cb('0x13')](_0x02cb('0xb'),auth['isAuthenticated'](),controller[_0x02cb('0x14')]);module[_0x02cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6e1eb1c..72a8e0d 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 _0x8c80=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8c80,0x1b5));var _0x08c8=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x8c80[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require(_0x08c8('0x0'));module[_0x08c8('0x1')]={'name':{'type':Sequelize[_0x08c8('0x2')]},'moduleCreate':{'type':Sequelize[_0x08c8('0x3')](_0x08c8('0x4'),_0x08c8('0x5'),_0x08c8('0x6')),'defaultValue':_0x08c8('0x4')},'moduleSearch':{'type':Sequelize[_0x08c8('0x3')](_0x08c8('0x7'),_0x08c8('0x5'),_0x08c8('0x4')),'defaultValue':_0x08c8('0x7')},'description':{'type':Sequelize[_0x08c8('0x2')]}}; \ No newline at end of file +var _0x8de8=['ENUM','lead','contact','nothing','contact_lead','exports','STRING'];(function(_0xd1e092,_0x58f358){var _0x390470=function(_0x358e32){while(--_0x358e32){_0xd1e092['push'](_0xd1e092['shift']());}};_0x390470(++_0x58f358);}(_0x8de8,0xbb));var _0x88de=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8de8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x88de('0x0')]={'name':{'type':Sequelize[_0x88de('0x1')]},'moduleCreate':{'type':Sequelize[_0x88de('0x2')](_0x88de('0x3'),_0x88de('0x4'),_0x88de('0x5')),'defaultValue':_0x88de('0x3')},'moduleSearch':{'type':Sequelize[_0x88de('0x2')](_0x88de('0x6'),_0x88de('0x4'),_0x88de('0x3')),'defaultValue':_0x88de('0x6')},'description':{'type':Sequelize[_0x88de('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4ca96b3..a37ab7c 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 _0x3cc1=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','ZohoConfiguration','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','ZohoField','filter','getFields','getSubjects','findOne','getDescriptions','html-pdf'];(function(_0x34219e,_0x46b1cc){var _0x1deeb9=function(_0x5e3b6d){while(--_0x5e3b6d){_0x34219e['push'](_0x34219e['shift']());}};_0x1deeb9(++_0x46b1cc);}(_0x3cc1,0x16f));var _0x13cc=function(_0x3b54fb,_0x4b40d8){_0x3b54fb=_0x3b54fb-0x0;var _0x309b3f=_0x3cc1[_0x3b54fb];return _0x309b3f;};'use strict';var pdf=require(_0x13cc('0x0'));var emlformat=require(_0x13cc('0x1'));var rimraf=require(_0x13cc('0x2'));var zipdir=require(_0x13cc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13cc('0x4'));var moment=require(_0x13cc('0x5'));var BPromise=require(_0x13cc('0x6'));var Mustache=require(_0x13cc('0x7'));var util=require(_0x13cc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x13cc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x13cc('0xa'));var squel=require(_0x13cc('0xb'));var crypto=require(_0x13cc('0xc'));var jsforce=require(_0x13cc('0xd'));var deskjs=require(_0x13cc('0xe'));var toCsv=require(_0x13cc('0x9'));var querystring=require(_0x13cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x13cc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x13cc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x13cc('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x13cc('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x13cc('0x14')][_0x13cc('0x15')]({'port':0x232a});function checkPasswordPattern(_0x22ccd8,_0x29c5c5,_0x24e224){if(_0x24e224){var _0x46f8f7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46f8f7['test'](_0x29c5c5)){return _0x22ccd8;}else{throw new db[(_0x13cc('0x16'))][(_0x13cc('0x17'))](_0x13cc('0x18'));}}else{return _0x22ccd8;}}function respondWithRpcPromise(_0x467bf1,_0x4b605e,_0x25c423,_0x304394){return new BPromise(function(_0x37c23d,_0x23d3a6){var _0x5df9ed=_0x304394||client;return _0x5df9ed[_0x13cc('0x19')](_0x467bf1,_0x25c423)[_0x13cc('0x1a')](function(_0x1efd96){logger[_0x13cc('0x1b')](_0x13cc('0x1c'),_0x4b605e,_0x13cc('0x1d'));logger[_0x13cc('0x1e')](_0x13cc('0x1f'),_0x4b605e,'request\x20sent',JSON[_0x13cc('0x20')](_0x1efd96));if(_0x1efd96['error']){if(_0x1efd96[_0x13cc('0x21')][_0x13cc('0x22')]===0x1f4){logger[_0x13cc('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x4b605e,_0x1efd96[_0x13cc('0x21')][_0x13cc('0x23')]);return _0x23d3a6(_0x1efd96[_0x13cc('0x21')][_0x13cc('0x23')]);}logger[_0x13cc('0x21')](_0x13cc('0x1c'),_0x4b605e,_0x1efd96[_0x13cc('0x21')]['message']);return _0x37c23d(_0x1efd96[_0x13cc('0x21')][_0x13cc('0x23')]);}else{logger['info'](_0x13cc('0x1c'),_0x4b605e,_0x13cc('0x1d'));_0x37c23d(_0x1efd96[_0x13cc('0x24')][_0x13cc('0x23')]);}})['catch'](function(_0x3f10d0){logger[_0x13cc('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x4b605e,_0x3f10d0);_0x23d3a6(_0x3f10d0);});});}function respondWithStatusCode(_0x56f13d,_0x404cd4){_0x404cd4=_0x404cd4||0xcc;return function(_0x5173dd){if(_0x5173dd){return _0x56f13d[_0x13cc('0x25')](_0x404cd4);}return _0x56f13d[_0x13cc('0x26')](_0x404cd4)[_0x13cc('0x27')]();};}function respondWithResult(_0x2a0cb5,_0x3153f3){_0x3153f3=_0x3153f3||0xc8;return function(_0x4823be){if(_0x4823be){return _0x2a0cb5[_0x13cc('0x26')](_0x3153f3)[_0x13cc('0x28')](_0x4823be);}};}function respondWithFilteredResult(_0x5b284f,_0x58d8ab){return function(_0x9ac2fa){if(_0x9ac2fa){var _0x3d2d4b=_0x9ac2fa[_0x13cc('0x29')],_0x8e59b1=_0x58d8ab[_0x13cc('0x2a')],_0x4c007f=_0x58d8ab[_0x13cc('0x2a')]+_0x58d8ab[_0x13cc('0x2b')],_0x12c9b8;if(_0x4c007f>=_0x3d2d4b){_0x4c007f=_0x3d2d4b;_0x12c9b8=0xc8;}else{_0x12c9b8=0xce;}_0x5b284f[_0x13cc('0x26')](_0x12c9b8);return _0x5b284f[_0x13cc('0x2c')]('Content-Range',_0x8e59b1+'-'+_0x4c007f+'/'+_0x3d2d4b)[_0x13cc('0x28')](_0x9ac2fa);}return null;};}function patchUpdates(_0x3349b4){return function(_0x351f77){try{jsonpatch[_0x13cc('0x2d')](_0x351f77,_0x3349b4,!![]);}catch(_0x37fdb7){return BPromise[_0x13cc('0x2e')](_0x37fdb7);}return _0x351f77[_0x13cc('0x2f')]();};}function saveUpdates(_0x356192,_0x35296f){return function(_0x4a69d6){if(_0x4a69d6){return _0x4a69d6[_0x13cc('0x30')](_0x356192)[_0x13cc('0x1a')](function(_0x2c7202){return _0x2c7202;});}return null;};}function removeEntity(_0x470ce3,_0x32869f){return function(_0x1a2ec9){if(_0x1a2ec9){return _0x1a2ec9[_0x13cc('0x31')]()[_0x13cc('0x1a')](function(){_0x470ce3[_0x13cc('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c6047,_0x3c67ff){return function(_0x4e7957){if(!_0x4e7957){_0x2c6047[_0x13cc('0x25')](0x194);}return _0x4e7957;};}function handleError(_0x145607,_0x261989){_0x261989=_0x261989||0x1f4;return function(_0x599928){logger[_0x13cc('0x21')](_0x599928[_0x13cc('0x32')]);if(_0x599928[_0x13cc('0x33')]){delete _0x599928[_0x13cc('0x33')];}_0x145607[_0x13cc('0x26')](_0x261989)[_0x13cc('0x34')](_0x599928);};}exports[_0x13cc('0x35')]=function(_0x4ef61b,_0xef77be){var _0xcb8da5={},_0x396c82={},_0x13fc17={'count':0x0,'rows':[]};var _0x53ab9e=_[_0x13cc('0x36')](db['ZohoConfiguration']['rawAttributes'],function(_0x37c37c){return{'name':_0x37c37c[_0x13cc('0x37')],'type':_0x37c37c[_0x13cc('0x38')][_0x13cc('0x39')]};});_0x396c82[_0x13cc('0x3a')]=_['map'](_0x53ab9e,_0x13cc('0x33'));_0x396c82['query']=_[_0x13cc('0x3b')](_0x4ef61b['query']);_0x396c82[_0x13cc('0x3c')]=_[_0x13cc('0x3d')](_0x396c82['model'],_0x396c82[_0x13cc('0x3e')]);_0xcb8da5[_0x13cc('0x3f')]=_[_0x13cc('0x3d')](_0x396c82[_0x13cc('0x3a')],qs['fields'](_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x40')]));_0xcb8da5['attributes']=_0xcb8da5['attributes'][_0x13cc('0x41')]?_0xcb8da5[_0x13cc('0x3f')]:_0x396c82['model'];if(!_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x42')](_0x13cc('0x43'))){_0xcb8da5[_0x13cc('0x2b')]=qs['limit'](_0x4ef61b['query']['limit']);_0xcb8da5[_0x13cc('0x2a')]=qs[_0x13cc('0x2a')](_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x2a')]);}_0xcb8da5[_0x13cc('0x44')]=qs['sort'](_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x45')]);_0xcb8da5[_0x13cc('0x46')]=qs[_0x13cc('0x3c')](_[_0x13cc('0x47')](_0x4ef61b['query'],_0x396c82[_0x13cc('0x3c')]),_0x53ab9e);if(_0x4ef61b['query']['filter']){_0xcb8da5[_0x13cc('0x46')]=_['merge'](_0xcb8da5['where'],{'$or':_[_0x13cc('0x36')](_0x53ab9e,function(_0x2a2f33){if(_0x2a2f33[_0x13cc('0x38')]!==_0x13cc('0x48')){var _0x2fb47b={};_0x2fb47b[_0x2a2f33[_0x13cc('0x33')]]={'$like':'%'+_0x4ef61b[_0x13cc('0x3e')]['filter']+'%'};return _0x2fb47b;}})});}_0xcb8da5=_[_0x13cc('0x49')]({},_0xcb8da5,_0x4ef61b[_0x13cc('0x4a')]);var _0x3fd341={'where':_0xcb8da5[_0x13cc('0x46')]};return db[_0x13cc('0x4b')][_0x13cc('0x29')](_0x3fd341)['then'](function(_0x2dd48c){_0x13fc17[_0x13cc('0x29')]=_0x2dd48c;if(_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x4c')]){_0xcb8da5[_0x13cc('0x4d')]=[{'all':!![]}];}return db[_0x13cc('0x4b')]['findAll'](_0xcb8da5);})[_0x13cc('0x1a')](function(_0x48ccdc){_0x13fc17[_0x13cc('0x4e')]=_0x48ccdc;return _0x13fc17;})[_0x13cc('0x1a')](respondWithFilteredResult(_0xef77be,_0xcb8da5))[_0x13cc('0x4f')](handleError(_0xef77be,null));};exports[_0x13cc('0x50')]=function(_0x27dab4,_0x51caa9){var _0x53113c={'raw':![],'where':{'id':_0x27dab4[_0x13cc('0x51')]['id']}},_0x319e17={};_0x319e17[_0x13cc('0x3a')]=_[_0x13cc('0x3b')](db[_0x13cc('0x4b')][_0x13cc('0x52')]);_0x319e17[_0x13cc('0x3e')]=_[_0x13cc('0x3b')](_0x27dab4['query']);_0x319e17[_0x13cc('0x3c')]=_[_0x13cc('0x3d')](_0x319e17['model'],_0x319e17[_0x13cc('0x3e')]);_0x53113c[_0x13cc('0x3f')]=_[_0x13cc('0x3d')](_0x319e17[_0x13cc('0x3a')],qs[_0x13cc('0x40')](_0x27dab4[_0x13cc('0x3e')][_0x13cc('0x40')]));_0x53113c['attributes']=_0x53113c[_0x13cc('0x3f')][_0x13cc('0x41')]?_0x53113c[_0x13cc('0x3f')]:_0x319e17['model'];if(_0x27dab4[_0x13cc('0x3e')][_0x13cc('0x4c')]){_0x53113c[_0x13cc('0x4d')]=[{'all':!![]}];}_0x53113c=_[_0x13cc('0x49')]({},_0x53113c,_0x27dab4['options']);return db['ZohoConfiguration'][_0x13cc('0x53')](_0x53113c)['then'](handleEntityNotFound(_0x51caa9,null))[_0x13cc('0x1a')](respondWithResult(_0x51caa9,null))[_0x13cc('0x4f')](handleError(_0x51caa9,null));};exports[_0x13cc('0x54')]=function(_0x2e6cba,_0x5b5a50){return db[_0x13cc('0x4b')][_0x13cc('0x54')](_0x2e6cba[_0x13cc('0x55')],{})[_0x13cc('0x1a')](respondWithResult(_0x5b5a50,0xc9))[_0x13cc('0x4f')](handleError(_0x5b5a50,null));};exports[_0x13cc('0x30')]=function(_0x4e6c8f,_0x34d261){if(_0x4e6c8f[_0x13cc('0x55')]['id']){delete _0x4e6c8f[_0x13cc('0x55')]['id'];}return db[_0x13cc('0x4b')][_0x13cc('0x53')]({'where':{'id':_0x4e6c8f[_0x13cc('0x51')]['id']}})[_0x13cc('0x1a')](handleEntityNotFound(_0x34d261,null))[_0x13cc('0x1a')](saveUpdates(_0x4e6c8f[_0x13cc('0x55')],null))['then'](respondWithResult(_0x34d261,null))['catch'](handleError(_0x34d261,null));};exports[_0x13cc('0x31')]=function(_0x369320,_0x228815){return db['ZohoConfiguration'][_0x13cc('0x53')]({'where':{'id':_0x369320[_0x13cc('0x51')]['id']}})[_0x13cc('0x1a')](handleEntityNotFound(_0x228815,null))[_0x13cc('0x1a')](removeEntity(_0x228815,null))[_0x13cc('0x4f')](handleError(_0x228815,null));};exports['getFields']=function(_0x32f997,_0x36b2a8,_0x53e5d3){var _0x4968cd={};var _0x4fb87b={};var _0xd06e6;var _0x5bf3d2;return db[_0x13cc('0x4b')]['findOne']({'where':{'id':_0x32f997[_0x13cc('0x51')]['id']}})[_0x13cc('0x1a')](handleEntityNotFound(_0x36b2a8,null))[_0x13cc('0x1a')](function(_0x1175f7){if(_0x1175f7){_0xd06e6=_0x1175f7;_0x4fb87b['model']=_[_0x13cc('0x3b')](db[_0x13cc('0x56')][_0x13cc('0x52')]);_0x4fb87b['query']=_[_0x13cc('0x3b')](_0x32f997['query']);_0x4fb87b[_0x13cc('0x3c')]=_['intersection'](_0x4fb87b[_0x13cc('0x3a')],_0x4fb87b[_0x13cc('0x3e')]);_0x4968cd[_0x13cc('0x3f')]=_[_0x13cc('0x3d')](_0x4fb87b['model'],qs[_0x13cc('0x40')](_0x32f997['query'][_0x13cc('0x40')]));_0x4968cd[_0x13cc('0x3f')]=_0x4968cd[_0x13cc('0x3f')]['length']?_0x4968cd[_0x13cc('0x3f')]:_0x4fb87b['model'];_0x4968cd['order']=qs[_0x13cc('0x45')](_0x32f997['query'][_0x13cc('0x45')]);_0x4968cd[_0x13cc('0x46')]=qs[_0x13cc('0x3c')](_[_0x13cc('0x47')](_0x32f997[_0x13cc('0x3e')],_0x4fb87b[_0x13cc('0x3c')]));if(_0x32f997[_0x13cc('0x3e')][_0x13cc('0x57')]){_0x4968cd[_0x13cc('0x46')]=_[_0x13cc('0x49')](_0x4968cd['where'],{'$or':_[_0x13cc('0x36')](_0x4968cd['attributes'],function(_0x38492d){var _0x33ecd7={};_0x33ecd7[_0x38492d]={'$like':'%'+_0x32f997[_0x13cc('0x3e')]['filter']+'%'};return _0x33ecd7;})});}_0x4968cd=_[_0x13cc('0x49')]({},_0x4968cd,_0x32f997[_0x13cc('0x4a')]);return _0xd06e6[_0x13cc('0x58')](_0x4968cd);}})[_0x13cc('0x1a')](function(_0x3b88fd){if(_0x3b88fd){_0x5bf3d2=_0x3b88fd[_0x13cc('0x41')];if(!_0x32f997['query'][_0x13cc('0x42')](_0x13cc('0x43'))){_0x4968cd[_0x13cc('0x2b')]=qs[_0x13cc('0x2b')](_0x32f997['query'][_0x13cc('0x2b')]);_0x4968cd[_0x13cc('0x2a')]=qs[_0x13cc('0x2a')](_0x32f997[_0x13cc('0x3e')][_0x13cc('0x2a')]);}return _0xd06e6['getFields'](_0x4968cd);}})[_0x13cc('0x1a')](function(_0x570019){if(_0x570019){return _0x570019?{'count':_0x5bf3d2,'rows':_0x570019}:null;}})[_0x13cc('0x1a')](respondWithResult(_0x36b2a8,null))['catch'](handleError(_0x36b2a8,null));};exports[_0x13cc('0x59')]=function(_0x62d40e,_0x54823f,_0x23dcc0){var _0x7706b0={};var _0x3db981={};var _0x554570;var _0x4cab47;return db['ZohoConfiguration'][_0x13cc('0x5a')]({'where':{'id':_0x62d40e['params']['id']}})[_0x13cc('0x1a')](handleEntityNotFound(_0x54823f,null))[_0x13cc('0x1a')](function(_0x5bff6b){if(_0x5bff6b){_0x554570=_0x5bff6b;_0x3db981[_0x13cc('0x3a')]=_[_0x13cc('0x3b')](db[_0x13cc('0x56')][_0x13cc('0x52')]);_0x3db981[_0x13cc('0x3e')]=_[_0x13cc('0x3b')](_0x62d40e[_0x13cc('0x3e')]);_0x3db981[_0x13cc('0x3c')]=_[_0x13cc('0x3d')](_0x3db981[_0x13cc('0x3a')],_0x3db981['query']);_0x7706b0['attributes']=_['intersection'](_0x3db981['model'],qs[_0x13cc('0x40')](_0x62d40e[_0x13cc('0x3e')]['fields']));_0x7706b0[_0x13cc('0x3f')]=_0x7706b0[_0x13cc('0x3f')]['length']?_0x7706b0['attributes']:_0x3db981[_0x13cc('0x3a')];_0x7706b0['order']=qs['sort'](_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x45')]);_0x7706b0[_0x13cc('0x46')]=qs[_0x13cc('0x3c')](_[_0x13cc('0x47')](_0x62d40e[_0x13cc('0x3e')],_0x3db981[_0x13cc('0x3c')]));if(_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x57')]){_0x7706b0[_0x13cc('0x46')]=_[_0x13cc('0x49')](_0x7706b0[_0x13cc('0x46')],{'$or':_[_0x13cc('0x36')](_0x7706b0[_0x13cc('0x3f')],function(_0x4693a4){var _0x5b99a4={};_0x5b99a4[_0x4693a4]={'$like':'%'+_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x57')]+'%'};return _0x5b99a4;})});}_0x7706b0=_[_0x13cc('0x49')]({},_0x7706b0,_0x62d40e[_0x13cc('0x4a')]);return _0x554570[_0x13cc('0x59')](_0x7706b0);}})[_0x13cc('0x1a')](function(_0x372143){if(_0x372143){_0x4cab47=_0x372143['length'];if(!_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x42')](_0x13cc('0x43'))){_0x7706b0[_0x13cc('0x2b')]=qs[_0x13cc('0x2b')](_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x2b')]);_0x7706b0[_0x13cc('0x2a')]=qs[_0x13cc('0x2a')](_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x2a')]);}return _0x554570[_0x13cc('0x59')](_0x7706b0);}})[_0x13cc('0x1a')](function(_0x3027e8){if(_0x3027e8){return _0x3027e8?{'count':_0x4cab47,'rows':_0x3027e8}:null;}})['then'](respondWithResult(_0x54823f,null))['catch'](handleError(_0x54823f,null));};exports[_0x13cc('0x5b')]=function(_0x106aba,_0x40d639,_0x236091){var _0x2a692a={};var _0x4f14f8={};var _0x2c213d;var _0x3ec091;return db[_0x13cc('0x4b')][_0x13cc('0x5a')]({'where':{'id':_0x106aba[_0x13cc('0x51')]['id']}})['then'](handleEntityNotFound(_0x40d639,null))['then'](function(_0x130b37){if(_0x130b37){_0x2c213d=_0x130b37;_0x4f14f8[_0x13cc('0x3a')]=_[_0x13cc('0x3b')](db[_0x13cc('0x56')][_0x13cc('0x52')]);_0x4f14f8[_0x13cc('0x3e')]=_[_0x13cc('0x3b')](_0x106aba['query']);_0x4f14f8[_0x13cc('0x3c')]=_['intersection'](_0x4f14f8[_0x13cc('0x3a')],_0x4f14f8[_0x13cc('0x3e')]);_0x2a692a['attributes']=_[_0x13cc('0x3d')](_0x4f14f8[_0x13cc('0x3a')],qs['fields'](_0x106aba[_0x13cc('0x3e')][_0x13cc('0x40')]));_0x2a692a['attributes']=_0x2a692a[_0x13cc('0x3f')][_0x13cc('0x41')]?_0x2a692a['attributes']:_0x4f14f8['model'];_0x2a692a['order']=qs[_0x13cc('0x45')](_0x106aba[_0x13cc('0x3e')][_0x13cc('0x45')]);_0x2a692a[_0x13cc('0x46')]=qs[_0x13cc('0x3c')](_['pick'](_0x106aba['query'],_0x4f14f8['filters']));if(_0x106aba[_0x13cc('0x3e')][_0x13cc('0x57')]){_0x2a692a[_0x13cc('0x46')]=_[_0x13cc('0x49')](_0x2a692a[_0x13cc('0x46')],{'$or':_['map'](_0x2a692a[_0x13cc('0x3f')],function(_0x20be72){var _0x3c5146={};_0x3c5146[_0x20be72]={'$like':'%'+_0x106aba[_0x13cc('0x3e')]['filter']+'%'};return _0x3c5146;})});}_0x2a692a=_[_0x13cc('0x49')]({},_0x2a692a,_0x106aba[_0x13cc('0x4a')]);return _0x2c213d[_0x13cc('0x5b')](_0x2a692a);}})[_0x13cc('0x1a')](function(_0x39152a){if(_0x39152a){_0x3ec091=_0x39152a[_0x13cc('0x41')];if(!_0x106aba[_0x13cc('0x3e')]['hasOwnProperty'](_0x13cc('0x43'))){_0x2a692a[_0x13cc('0x2b')]=qs[_0x13cc('0x2b')](_0x106aba[_0x13cc('0x3e')][_0x13cc('0x2b')]);_0x2a692a['offset']=qs[_0x13cc('0x2a')](_0x106aba[_0x13cc('0x3e')][_0x13cc('0x2a')]);}return _0x2c213d[_0x13cc('0x5b')](_0x2a692a);}})[_0x13cc('0x1a')](function(_0x35f691){if(_0x35f691){return _0x35f691?{'count':_0x3ec091,'rows':_0x35f691}:null;}})['then'](respondWithResult(_0x40d639,null))['catch'](handleError(_0x40d639,null));}; \ No newline at end of file +var _0xe68b=['catch','params','rawAttributes','options','find','create','body','getFields','findOne','ZohoField','pick','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ZohoConfiguration,\x20%s,\x20%s','result','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','ZohoConfiguration','includeAll','include','rows'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0xe68b,0x18a));var _0xbe68=function(_0x4f6537,_0x44df55){_0x4f6537=_0x4f6537-0x0;var _0x4eb387=_0xe68b[_0x4f6537];return _0x4eb387;};'use strict';var pdf=require(_0xbe68('0x0'));var emlformat=require(_0xbe68('0x1'));var rimraf=require(_0xbe68('0x2'));var zipdir=require(_0xbe68('0x3'));var jsonpatch=require(_0xbe68('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbe68('0x5'));var Mustache=require(_0xbe68('0x6'));var util=require(_0xbe68('0x7'));var path=require('path');var sox=require(_0xbe68('0x8'));var csv=require(_0xbe68('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbe68('0xa'));var squel=require(_0xbe68('0xb'));var crypto=require(_0xbe68('0xc'));var jsforce=require(_0xbe68('0xd'));var deskjs=require(_0xbe68('0xe'));var toCsv=require(_0xbe68('0x9'));var querystring=require(_0xbe68('0xf'));var Papa=require(_0xbe68('0x10'));var Redis=require(_0xbe68('0x11'));var authService=require(_0xbe68('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbe68('0x13'));var hardwareService=require(_0xbe68('0x14'));var logger=require(_0xbe68('0x15'))('api');var utils=require(_0xbe68('0x16'));var config=require(_0xbe68('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbe68('0x18'));var client=jayson[_0xbe68('0x19')][_0xbe68('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x216a67,_0x3df6f2,_0x584781){if(_0x584781){var _0x3a4f88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a4f88[_0xbe68('0x1b')](_0x3df6f2)){return _0x216a67;}else{throw new db[(_0xbe68('0x1c'))][(_0xbe68('0x1d'))](_0xbe68('0x1e'));}}else{return _0x216a67;}}function respondWithRpcPromise(_0x4abec4,_0x42454c,_0xa21dd4,_0x1f7092){return new BPromise(function(_0x31f5d3,_0x1ab0f6){var _0x5d350a=_0x1f7092||client;return _0x5d350a[_0xbe68('0x1f')](_0x4abec4,_0xa21dd4)[_0xbe68('0x20')](function(_0x2575ea){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x42454c,_0xbe68('0x21'));logger[_0xbe68('0x22')](_0xbe68('0x23'),_0x42454c,_0xbe68('0x21'),JSON[_0xbe68('0x24')](_0x2575ea));if(_0x2575ea['error']){if(_0x2575ea[_0xbe68('0x25')][_0xbe68('0x26')]===0x1f4){logger[_0xbe68('0x25')]('ZohoConfiguration,\x20%s,\x20%s',_0x42454c,_0x2575ea[_0xbe68('0x25')][_0xbe68('0x27')]);return _0x1ab0f6(_0x2575ea[_0xbe68('0x25')][_0xbe68('0x27')]);}logger[_0xbe68('0x25')]('ZohoConfiguration,\x20%s,\x20%s',_0x42454c,_0x2575ea[_0xbe68('0x25')][_0xbe68('0x27')]);return _0x31f5d3(_0x2575ea[_0xbe68('0x25')][_0xbe68('0x27')]);}else{logger[_0xbe68('0x28')](_0xbe68('0x29'),_0x42454c,_0xbe68('0x21'));_0x31f5d3(_0x2575ea[_0xbe68('0x2a')]['message']);}})['catch'](function(_0x2a51d9){logger['error'](_0xbe68('0x29'),_0x42454c,_0x2a51d9);_0x1ab0f6(_0x2a51d9);});});}function respondWithStatusCode(_0x525abb,_0x1ce64a){_0x1ce64a=_0x1ce64a||0xcc;return function(_0x315f53){if(_0x315f53){return _0x525abb[_0xbe68('0x2b')](_0x1ce64a);}return _0x525abb['status'](_0x1ce64a)[_0xbe68('0x2c')]();};}function respondWithResult(_0x1070ba,_0x4ca788){_0x4ca788=_0x4ca788||0xc8;return function(_0x33996f){if(_0x33996f){return _0x1070ba[_0xbe68('0x2d')](_0x4ca788)[_0xbe68('0x2e')](_0x33996f);}};}function respondWithFilteredResult(_0x550779,_0x46f9f2){return function(_0x57187a){if(_0x57187a){var _0x3f20e8=_0x57187a[_0xbe68('0x2f')],_0x5a36e1=_0x46f9f2['offset'],_0x2b6950=_0x46f9f2[_0xbe68('0x30')]+_0x46f9f2['limit'],_0x46b9ec;if(_0x2b6950>=_0x3f20e8){_0x2b6950=_0x3f20e8;_0x46b9ec=0xc8;}else{_0x46b9ec=0xce;}_0x550779[_0xbe68('0x2d')](_0x46b9ec);return _0x550779[_0xbe68('0x31')](_0xbe68('0x32'),_0x5a36e1+'-'+_0x2b6950+'/'+_0x3f20e8)['json'](_0x57187a);}return null;};}function patchUpdates(_0x5cc293){return function(_0x5946f6){try{jsonpatch[_0xbe68('0x33')](_0x5946f6,_0x5cc293,!![]);}catch(_0x2c72f3){return BPromise[_0xbe68('0x34')](_0x2c72f3);}return _0x5946f6[_0xbe68('0x35')]();};}function saveUpdates(_0x129b7f,_0x20d286){return function(_0x2595cc){if(_0x2595cc){return _0x2595cc[_0xbe68('0x36')](_0x129b7f)[_0xbe68('0x20')](function(_0x55b069){return _0x55b069;});}return null;};}function removeEntity(_0x552383,_0xc6fd25){return function(_0x1e16f3){if(_0x1e16f3){return _0x1e16f3[_0xbe68('0x37')]()['then'](function(){_0x552383[_0xbe68('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d4da5,_0x32ecc4){return function(_0x63f45){if(!_0x63f45){_0x2d4da5[_0xbe68('0x2b')](0x194);}return _0x63f45;};}function handleError(_0x3f179a,_0x152ae2){_0x152ae2=_0x152ae2||0x1f4;return function(_0x4850){logger['error'](_0x4850[_0xbe68('0x38')]);if(_0x4850[_0xbe68('0x39')]){delete _0x4850['name'];}_0x3f179a[_0xbe68('0x2d')](_0x152ae2)['send'](_0x4850);};}exports['index']=function(_0x21590e,_0x3943e2){var _0x57a633={},_0x5b0a3c={},_0x16017c={'count':0x0,'rows':[]};var _0x5cc316=_[_0xbe68('0x3a')](db['ZohoConfiguration']['rawAttributes'],function(_0x2e7dad){return{'name':_0x2e7dad[_0xbe68('0x3b')],'type':_0x2e7dad[_0xbe68('0x3c')]['key']};});_0x5b0a3c['model']=_['map'](_0x5cc316,_0xbe68('0x39'));_0x5b0a3c['query']=_[_0xbe68('0x3d')](_0x21590e[_0xbe68('0x3e')]);_0x5b0a3c[_0xbe68('0x3f')]=_['intersection'](_0x5b0a3c[_0xbe68('0x40')],_0x5b0a3c[_0xbe68('0x3e')]);_0x57a633[_0xbe68('0x41')]=_[_0xbe68('0x42')](_0x5b0a3c[_0xbe68('0x40')],qs['fields'](_0x21590e[_0xbe68('0x3e')][_0xbe68('0x43')]));_0x57a633[_0xbe68('0x41')]=_0x57a633[_0xbe68('0x41')][_0xbe68('0x44')]?_0x57a633[_0xbe68('0x41')]:_0x5b0a3c[_0xbe68('0x40')];if(!_0x21590e[_0xbe68('0x3e')][_0xbe68('0x45')]('nolimit')){_0x57a633[_0xbe68('0x46')]=qs['limit'](_0x21590e['query'][_0xbe68('0x46')]);_0x57a633[_0xbe68('0x30')]=qs[_0xbe68('0x30')](_0x21590e[_0xbe68('0x3e')][_0xbe68('0x30')]);}_0x57a633[_0xbe68('0x47')]=qs[_0xbe68('0x48')](_0x21590e['query'][_0xbe68('0x48')]);_0x57a633[_0xbe68('0x49')]=qs[_0xbe68('0x3f')](_['pick'](_0x21590e[_0xbe68('0x3e')],_0x5b0a3c[_0xbe68('0x3f')]),_0x5cc316);if(_0x21590e[_0xbe68('0x3e')][_0xbe68('0x4a')]){_0x57a633[_0xbe68('0x49')]=_[_0xbe68('0x4b')](_0x57a633['where'],{'$or':_[_0xbe68('0x3a')](_0x5cc316,function(_0x9c9d45){if(_0x9c9d45[_0xbe68('0x3c')]!==_0xbe68('0x4c')){var _0x1a7a2c={};_0x1a7a2c[_0x9c9d45[_0xbe68('0x39')]]={'$like':'%'+_0x21590e[_0xbe68('0x3e')]['filter']+'%'};return _0x1a7a2c;}})});}_0x57a633=_['merge']({},_0x57a633,_0x21590e['options']);var _0x1f9233={'where':_0x57a633[_0xbe68('0x49')]};return db[_0xbe68('0x4d')][_0xbe68('0x2f')](_0x1f9233)[_0xbe68('0x20')](function(_0x11a6dc){_0x16017c['count']=_0x11a6dc;if(_0x21590e[_0xbe68('0x3e')][_0xbe68('0x4e')]){_0x57a633[_0xbe68('0x4f')]=[{'all':!![]}];}return db[_0xbe68('0x4d')]['findAll'](_0x57a633);})[_0xbe68('0x20')](function(_0xb54914){_0x16017c[_0xbe68('0x50')]=_0xb54914;return _0x16017c;})['then'](respondWithFilteredResult(_0x3943e2,_0x57a633))[_0xbe68('0x51')](handleError(_0x3943e2,null));};exports['show']=function(_0x1adbdf,_0x5d435d){var _0x47ded3={'raw':![],'where':{'id':_0x1adbdf[_0xbe68('0x52')]['id']}},_0x382bd1={};_0x382bd1[_0xbe68('0x40')]=_[_0xbe68('0x3d')](db[_0xbe68('0x4d')][_0xbe68('0x53')]);_0x382bd1[_0xbe68('0x3e')]=_['keys'](_0x1adbdf[_0xbe68('0x3e')]);_0x382bd1['filters']=_[_0xbe68('0x42')](_0x382bd1[_0xbe68('0x40')],_0x382bd1[_0xbe68('0x3e')]);_0x47ded3[_0xbe68('0x41')]=_[_0xbe68('0x42')](_0x382bd1[_0xbe68('0x40')],qs[_0xbe68('0x43')](_0x1adbdf[_0xbe68('0x3e')][_0xbe68('0x43')]));_0x47ded3[_0xbe68('0x41')]=_0x47ded3[_0xbe68('0x41')][_0xbe68('0x44')]?_0x47ded3[_0xbe68('0x41')]:_0x382bd1[_0xbe68('0x40')];if(_0x1adbdf['query'][_0xbe68('0x4e')]){_0x47ded3[_0xbe68('0x4f')]=[{'all':!![]}];}_0x47ded3=_['merge']({},_0x47ded3,_0x1adbdf[_0xbe68('0x54')]);return db['ZohoConfiguration'][_0xbe68('0x55')](_0x47ded3)[_0xbe68('0x20')](handleEntityNotFound(_0x5d435d,null))['then'](respondWithResult(_0x5d435d,null))['catch'](handleError(_0x5d435d,null));};exports[_0xbe68('0x56')]=function(_0x399c77,_0x157eb8){return db[_0xbe68('0x4d')]['create'](_0x399c77[_0xbe68('0x57')],{})[_0xbe68('0x20')](respondWithResult(_0x157eb8,0xc9))[_0xbe68('0x51')](handleError(_0x157eb8,null));};exports[_0xbe68('0x36')]=function(_0x2c5b4e,_0x539cba){if(_0x2c5b4e['body']['id']){delete _0x2c5b4e['body']['id'];}return db[_0xbe68('0x4d')]['find']({'where':{'id':_0x2c5b4e[_0xbe68('0x52')]['id']}})[_0xbe68('0x20')](handleEntityNotFound(_0x539cba,null))['then'](saveUpdates(_0x2c5b4e[_0xbe68('0x57')],null))[_0xbe68('0x20')](respondWithResult(_0x539cba,null))[_0xbe68('0x51')](handleError(_0x539cba,null));};exports[_0xbe68('0x37')]=function(_0x1cde0e,_0x528c35){return db[_0xbe68('0x4d')][_0xbe68('0x55')]({'where':{'id':_0x1cde0e[_0xbe68('0x52')]['id']}})[_0xbe68('0x20')](handleEntityNotFound(_0x528c35,null))[_0xbe68('0x20')](removeEntity(_0x528c35,null))[_0xbe68('0x51')](handleError(_0x528c35,null));};exports[_0xbe68('0x58')]=function(_0x241e60,_0x582791,_0x296e3b){var _0x552656={};var _0x235263={};var _0x16de0c;var _0x4fd6ba;return db[_0xbe68('0x4d')][_0xbe68('0x59')]({'where':{'id':_0x241e60[_0xbe68('0x52')]['id']}})[_0xbe68('0x20')](handleEntityNotFound(_0x582791,null))[_0xbe68('0x20')](function(_0x3a083d){if(_0x3a083d){_0x16de0c=_0x3a083d;_0x235263['model']=_[_0xbe68('0x3d')](db[_0xbe68('0x5a')]['rawAttributes']);_0x235263['query']=_['keys'](_0x241e60[_0xbe68('0x3e')]);_0x235263[_0xbe68('0x3f')]=_[_0xbe68('0x42')](_0x235263['model'],_0x235263[_0xbe68('0x3e')]);_0x552656[_0xbe68('0x41')]=_[_0xbe68('0x42')](_0x235263[_0xbe68('0x40')],qs[_0xbe68('0x43')](_0x241e60['query']['fields']));_0x552656[_0xbe68('0x41')]=_0x552656[_0xbe68('0x41')][_0xbe68('0x44')]?_0x552656[_0xbe68('0x41')]:_0x235263[_0xbe68('0x40')];_0x552656[_0xbe68('0x47')]=qs['sort'](_0x241e60[_0xbe68('0x3e')]['sort']);_0x552656['where']=qs['filters'](_[_0xbe68('0x5b')](_0x241e60[_0xbe68('0x3e')],_0x235263[_0xbe68('0x3f')]));if(_0x241e60['query'][_0xbe68('0x4a')]){_0x552656[_0xbe68('0x49')]=_[_0xbe68('0x4b')](_0x552656['where'],{'$or':_[_0xbe68('0x3a')](_0x552656['attributes'],function(_0x2214c8){var _0x489203={};_0x489203[_0x2214c8]={'$like':'%'+_0x241e60['query'][_0xbe68('0x4a')]+'%'};return _0x489203;})});}_0x552656=_['merge']({},_0x552656,_0x241e60[_0xbe68('0x54')]);return _0x16de0c[_0xbe68('0x58')](_0x552656);}})[_0xbe68('0x20')](function(_0x5a3472){if(_0x5a3472){_0x4fd6ba=_0x5a3472[_0xbe68('0x44')];if(!_0x241e60[_0xbe68('0x3e')]['hasOwnProperty'](_0xbe68('0x5c'))){_0x552656[_0xbe68('0x46')]=qs['limit'](_0x241e60[_0xbe68('0x3e')][_0xbe68('0x46')]);_0x552656[_0xbe68('0x30')]=qs[_0xbe68('0x30')](_0x241e60[_0xbe68('0x3e')][_0xbe68('0x30')]);}return _0x16de0c[_0xbe68('0x58')](_0x552656);}})[_0xbe68('0x20')](function(_0x57139d){if(_0x57139d){return _0x57139d?{'count':_0x4fd6ba,'rows':_0x57139d}:null;}})['then'](respondWithResult(_0x582791,null))[_0xbe68('0x51')](handleError(_0x582791,null));};exports[_0xbe68('0x5d')]=function(_0x52d187,_0x453773,_0x5bdf02){var _0x25eaf2={};var _0x326416={};var _0x5aa27f;var _0x1b2fec;return db['ZohoConfiguration'][_0xbe68('0x59')]({'where':{'id':_0x52d187[_0xbe68('0x52')]['id']}})[_0xbe68('0x20')](handleEntityNotFound(_0x453773,null))['then'](function(_0x2e68d7){if(_0x2e68d7){_0x5aa27f=_0x2e68d7;_0x326416['model']=_['keys'](db[_0xbe68('0x5a')]['rawAttributes']);_0x326416[_0xbe68('0x3e')]=_['keys'](_0x52d187[_0xbe68('0x3e')]);_0x326416[_0xbe68('0x3f')]=_[_0xbe68('0x42')](_0x326416['model'],_0x326416[_0xbe68('0x3e')]);_0x25eaf2[_0xbe68('0x41')]=_['intersection'](_0x326416[_0xbe68('0x40')],qs[_0xbe68('0x43')](_0x52d187[_0xbe68('0x3e')]['fields']));_0x25eaf2[_0xbe68('0x41')]=_0x25eaf2[_0xbe68('0x41')][_0xbe68('0x44')]?_0x25eaf2[_0xbe68('0x41')]:_0x326416[_0xbe68('0x40')];_0x25eaf2[_0xbe68('0x47')]=qs[_0xbe68('0x48')](_0x52d187[_0xbe68('0x3e')]['sort']);_0x25eaf2['where']=qs[_0xbe68('0x3f')](_[_0xbe68('0x5b')](_0x52d187[_0xbe68('0x3e')],_0x326416['filters']));if(_0x52d187[_0xbe68('0x3e')][_0xbe68('0x4a')]){_0x25eaf2[_0xbe68('0x49')]=_[_0xbe68('0x4b')](_0x25eaf2['where'],{'$or':_[_0xbe68('0x3a')](_0x25eaf2[_0xbe68('0x41')],function(_0x3c715a){var _0xc648c4={};_0xc648c4[_0x3c715a]={'$like':'%'+_0x52d187[_0xbe68('0x3e')][_0xbe68('0x4a')]+'%'};return _0xc648c4;})});}_0x25eaf2=_[_0xbe68('0x4b')]({},_0x25eaf2,_0x52d187['options']);return _0x5aa27f[_0xbe68('0x5d')](_0x25eaf2);}})['then'](function(_0x50f210){if(_0x50f210){_0x1b2fec=_0x50f210['length'];if(!_0x52d187[_0xbe68('0x3e')][_0xbe68('0x45')](_0xbe68('0x5c'))){_0x25eaf2['limit']=qs[_0xbe68('0x46')](_0x52d187[_0xbe68('0x3e')]['limit']);_0x25eaf2[_0xbe68('0x30')]=qs[_0xbe68('0x30')](_0x52d187['query']['offset']);}return _0x5aa27f['getSubjects'](_0x25eaf2);}})['then'](function(_0x598a54){if(_0x598a54){return _0x598a54?{'count':_0x1b2fec,'rows':_0x598a54}:null;}})[_0xbe68('0x20')](respondWithResult(_0x453773,null))[_0xbe68('0x51')](handleError(_0x453773,null));};exports[_0xbe68('0x5e')]=function(_0x2980df,_0x351cc0,_0x2d30c1){var _0x43ce00={};var _0x25fe02={};var _0x115f46;var _0x1a66c1;return db[_0xbe68('0x4d')][_0xbe68('0x59')]({'where':{'id':_0x2980df['params']['id']}})['then'](handleEntityNotFound(_0x351cc0,null))[_0xbe68('0x20')](function(_0x32db45){if(_0x32db45){_0x115f46=_0x32db45;_0x25fe02[_0xbe68('0x40')]=_[_0xbe68('0x3d')](db[_0xbe68('0x5a')][_0xbe68('0x53')]);_0x25fe02[_0xbe68('0x3e')]=_[_0xbe68('0x3d')](_0x2980df['query']);_0x25fe02['filters']=_[_0xbe68('0x42')](_0x25fe02[_0xbe68('0x40')],_0x25fe02[_0xbe68('0x3e')]);_0x43ce00[_0xbe68('0x41')]=_[_0xbe68('0x42')](_0x25fe02[_0xbe68('0x40')],qs[_0xbe68('0x43')](_0x2980df[_0xbe68('0x3e')][_0xbe68('0x43')]));_0x43ce00[_0xbe68('0x41')]=_0x43ce00['attributes'][_0xbe68('0x44')]?_0x43ce00[_0xbe68('0x41')]:_0x25fe02[_0xbe68('0x40')];_0x43ce00[_0xbe68('0x47')]=qs[_0xbe68('0x48')](_0x2980df[_0xbe68('0x3e')][_0xbe68('0x48')]);_0x43ce00['where']=qs[_0xbe68('0x3f')](_[_0xbe68('0x5b')](_0x2980df['query'],_0x25fe02[_0xbe68('0x3f')]));if(_0x2980df['query'][_0xbe68('0x4a')]){_0x43ce00[_0xbe68('0x49')]=_[_0xbe68('0x4b')](_0x43ce00['where'],{'$or':_['map'](_0x43ce00[_0xbe68('0x41')],function(_0x36ef1c){var _0x372eec={};_0x372eec[_0x36ef1c]={'$like':'%'+_0x2980df[_0xbe68('0x3e')][_0xbe68('0x4a')]+'%'};return _0x372eec;})});}_0x43ce00=_[_0xbe68('0x4b')]({},_0x43ce00,_0x2980df[_0xbe68('0x54')]);return _0x115f46[_0xbe68('0x5e')](_0x43ce00);}})[_0xbe68('0x20')](function(_0x2bb2ab){if(_0x2bb2ab){_0x1a66c1=_0x2bb2ab[_0xbe68('0x44')];if(!_0x2980df[_0xbe68('0x3e')]['hasOwnProperty'](_0xbe68('0x5c'))){_0x43ce00[_0xbe68('0x46')]=qs['limit'](_0x2980df[_0xbe68('0x3e')][_0xbe68('0x46')]);_0x43ce00[_0xbe68('0x30')]=qs[_0xbe68('0x30')](_0x2980df[_0xbe68('0x3e')][_0xbe68('0x30')]);}return _0x115f46['getDescriptions'](_0x43ce00);}})[_0xbe68('0x20')](function(_0x5a18d0){if(_0x5a18d0){return _0x5a18d0?{'count':_0x1a66c1,'rows':_0x5a18d0}:null;}})['then'](respondWithResult(_0x351cc0,null))[_0xbe68('0x51')](handleError(_0x351cc0,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 7fa4671..c596415 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 _0xd7f0=['int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x6adb95,_0x1acdff){var _0x226b03=function(_0x57635b){while(--_0x57635b){_0x6adb95['push'](_0x6adb95['shift']());}};_0x226b03(++_0x1acdff);}(_0xd7f0,0x83));var _0x0d7f=function(_0x3f05d0,_0x302aa9){_0x3f05d0=_0x3f05d0-0x0;var _0x32cc15=_0xd7f0[_0x3f05d0];return _0x32cc15;};'use strict';var _=require(_0x0d7f('0x0'));var util=require(_0x0d7f('0x1'));var logger=require(_0x0d7f('0x2'))('api');var moment=require(_0x0d7f('0x3'));var BPromise=require(_0x0d7f('0x4'));var rp=require(_0x0d7f('0x5'));var fs=require('fs');var path=require(_0x0d7f('0x6'));var rimraf=require(_0x0d7f('0x7'));var config=require(_0x0d7f('0x8'));var attributes=require(_0x0d7f('0x9'));module['exports']=function(_0x5c78b0,_0x50bccd){return _0x5c78b0[_0x0d7f('0xa')](_0x0d7f('0xb'),attributes,{'tableName':_0x0d7f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c49=['rimraf','./intZohoConfiguration.attributes','define','ZohoConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x2c49,0xd5));var _0x92c4=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0x2c49[_0x2c18a8];return _0x1e009a;};'use strict';var _=require(_0x92c4('0x0'));var util=require(_0x92c4('0x1'));var logger=require(_0x92c4('0x2'))(_0x92c4('0x3'));var moment=require('moment');var BPromise=require(_0x92c4('0x4'));var rp=require(_0x92c4('0x5'));var fs=require('fs');var path=require(_0x92c4('0x6'));var rimraf=require(_0x92c4('0x7'));var config=require('../../config/environment');var attributes=require(_0x92c4('0x8'));module['exports']=function(_0xa8e776,_0x28c55b){return _0xa8e776[_0x92c4('0x9')](_0x92c4('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 5b95880..097f0fe 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 _0x3015=['rpc','../../config/environment','jayson/promise','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3015,0x10b));var _0x5301=function(_0x2c7630,_0x205a13){_0x2c7630=_0x2c7630-0x0;var _0x4115f7=_0x3015[_0x2c7630];return _0x4115f7;};'use strict';var _=require('lodash');var util=require(_0x5301('0x0'));var moment=require('moment');var BPromise=require(_0x5301('0x1'));var rs=require(_0x5301('0x2'));var fs=require('fs');var Redis=require(_0x5301('0x3'));var db=require(_0x5301('0x4'))['db'];var utils=require(_0x5301('0x5'));var logger=require('../../config/logger')(_0x5301('0x6'));var config=require(_0x5301('0x7'));var jayson=require(_0x5301('0x8'));var client=jayson['client'][_0x5301('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cab95,_0x3ea707,_0x446962){return new BPromise(function(_0x5a9220,_0x4a552c){return client[_0x5301('0xa')](_0x3cab95,_0x446962)[_0x5301('0xb')](function(_0x3fd276){logger['info'](_0x5301('0xc'),_0x3ea707,_0x5301('0xd'));logger[_0x5301('0xe')](_0x5301('0xf'),_0x3ea707,'request\x20sent',JSON[_0x5301('0x10')](_0x3fd276));if(_0x3fd276[_0x5301('0x11')]){if(_0x3fd276[_0x5301('0x11')]['code']===0x1f4){logger['error'](_0x5301('0xc'),_0x3ea707,_0x3fd276[_0x5301('0x11')]['message']);return _0x4a552c(_0x3fd276[_0x5301('0x11')][_0x5301('0x12')]);}logger['error'](_0x5301('0xc'),_0x3ea707,_0x3fd276['error']['message']);return _0x5a9220(_0x3fd276['error']['message']);}else{logger[_0x5301('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x3ea707,_0x5301('0xd'));_0x5a9220(_0x3fd276[_0x5301('0x14')][_0x5301('0x12')]);}})['catch'](function(_0xe6763b){logger[_0x5301('0x11')](_0x5301('0xc'),_0x3ea707,_0xe6763b);_0x4a552c(_0xe6763b);});});} \ No newline at end of file +var _0x34ab=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x5c6fde,_0x29fac8){var _0x2a9c77=function(_0x22d576){while(--_0x22d576){_0x5c6fde['push'](_0x5c6fde['shift']());}};_0x2a9c77(++_0x29fac8);}(_0x34ab,0x6d));var _0xb34a=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x34ab[_0x1bf809];return _0x1caa4e;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var moment=require('moment');var BPromise=require(_0xb34a('0x2'));var rs=require(_0xb34a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb34a('0x4'))['db'];var utils=require(_0xb34a('0x5'));var logger=require(_0xb34a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb34a('0x7'));var client=jayson[_0xb34a('0x8')][_0xb34a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x485f65,_0x22675f,_0x41162c){return new BPromise(function(_0x5c3626,_0x1b85ac){return client[_0xb34a('0xa')](_0x485f65,_0x41162c)[_0xb34a('0xb')](function(_0xfaab84){logger[_0xb34a('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x22675f,'request\x20sent');logger[_0xb34a('0xd')](_0xb34a('0xe'),_0x22675f,_0xb34a('0xf'),JSON[_0xb34a('0x10')](_0xfaab84));if(_0xfaab84[_0xb34a('0x11')]){if(_0xfaab84['error'][_0xb34a('0x12')]===0x1f4){logger['error'](_0xb34a('0x13'),_0x22675f,_0xfaab84[_0xb34a('0x11')]['message']);return _0x1b85ac(_0xfaab84[_0xb34a('0x11')]['message']);}logger[_0xb34a('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x22675f,_0xfaab84[_0xb34a('0x11')][_0xb34a('0x14')]);return _0x5c3626(_0xfaab84['error']['message']);}else{logger[_0xb34a('0xc')](_0xb34a('0x13'),_0x22675f,'request\x20sent');_0x5c3626(_0xfaab84['result']['message']);}})[_0xb34a('0x15')](function(_0x2b4f25){logger[_0xb34a('0x11')](_0xb34a('0x13'),_0x22675f,_0x2b4f25);_0x1b85ac(_0x2b4f25);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 28409d6..29de417 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 _0xf4f4=['./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x494d18,_0x56b775){var _0x451015=function(_0x849fda){while(--_0x849fda){_0x494d18['push'](_0x494d18['shift']());}};_0x451015(++_0x56b775);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x32cd25,_0x5abf21){_0x32cd25=_0x32cd25-0x0;var _0x423f41=_0xf4f4[_0x32cd25];return _0x423f41;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xd')]('/',auth[_0x4f4f('0x8')](),controller['create']);router[_0x4f4f('0xe')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x10')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8e3f=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var path=require(_0xf8e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8e3('0x3'));var router=express[_0xf8e3('0x4')]();var auth=require(_0xf8e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8e3('0x6'));var controller=require(_0xf8e3('0x7'));router['get']('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x9')]);router[_0xf8e3('0xa')](_0xf8e3('0xb'),auth['isAuthenticated'](),controller[_0xf8e3('0xc')]);router[_0xf8e3('0xd')]('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0xe')]);router[_0xf8e3('0xf')](_0xf8e3('0xb'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x10')]);router[_0xf8e3('0x11')](_0xf8e3('0xb'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index abf28bc..e19bc36 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 _0x32ef=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x35aa5c,_0x546369){var _0xde096b=function(_0x5d958e){while(--_0x5d958e){_0x35aa5c['push'](_0x35aa5c['shift']());}};_0xde096b(++_0x546369);}(_0x32ef,0xf9));var _0xf32e=function(_0x3d2753,_0x1f52dd){_0x3d2753=_0x3d2753-0x0;var _0x34defd=_0x32ef[_0x3d2753];return _0x34defd;};'use strict';var Sequelize=require(_0xf32e('0x0'));module[_0xf32e('0x1')]={'type':{'type':Sequelize[_0xf32e('0x2')](_0xf32e('0x3'),_0xf32e('0x4'),_0xf32e('0x5'),'keyValue'),'defaultValue':_0xf32e('0x3')},'content':{'type':Sequelize[_0xf32e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf32e('0x2')](_0xf32e('0x3'),_0xf32e('0x4'),_0xf32e('0x5'))},'keyContent':{'type':Sequelize[_0xf32e('0x6')]},'idField':{'type':Sequelize[_0xf32e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf32e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7b47=['exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0x7b47,0x118));var _0x77b4=function(_0x2bafd8,_0x53effd){_0x2bafd8=_0x2bafd8-0x0;var _0x347087=_0x7b47[_0x2bafd8];return _0x347087;};'use strict';var Sequelize=require('sequelize');module[_0x77b4('0x0')]={'type':{'type':Sequelize['ENUM'](_0x77b4('0x1'),_0x77b4('0x2'),_0x77b4('0x3'),_0x77b4('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x77b4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x77b4('0x6')](_0x77b4('0x1'),_0x77b4('0x2'),_0x77b4('0x3'))},'keyContent':{'type':Sequelize[_0x77b4('0x5')]},'idField':{'type':Sequelize[_0x77b4('0x5')]},'nameField':{'type':Sequelize[_0x77b4('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77b4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index dd27471..36a4c7b 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x20fb56,_0x315362){var _0x3ca29e=function(_0x1a4f2a){while(--_0x1a4f2a){_0x20fb56['push'](_0x20fb56['shift']());}};_0x3ca29e(++_0x315362);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x3046d8,_0x19af5e){var _0x56ecb6=function(_0x4d50f9){while(--_0x4d50f9){_0x3046d8['push'](_0x3046d8['shift']());}};_0x56ecb6(++_0x19af5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b9a2c0b..8627b83 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 _0xaeab=['rimraf','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','lodash','util','moment','request-promise','path'];(function(_0x3dfd1c,_0x55764a){var _0x5217ed=function(_0x1ac9af){while(--_0x1ac9af){_0x3dfd1c['push'](_0x3dfd1c['shift']());}};_0x5217ed(++_0x55764a);}(_0xaeab,0x1c9));var _0xbaea=function(_0x4bec8d,_0x4e83c4){_0x4bec8d=_0x4bec8d-0x0;var _0x33d8ed=_0xaeab[_0x4bec8d];return _0x33d8ed;};'use strict';var _=require(_0xbaea('0x0'));var util=require(_0xbaea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbaea('0x2'));var BPromise=require('bluebird');var rp=require(_0xbaea('0x3'));var fs=require('fs');var path=require(_0xbaea('0x4'));var rimraf=require(_0xbaea('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xbaea('0x6')]=function(_0x59ae71,_0x286550){return _0x59ae71[_0xbaea('0x7')](_0xbaea('0x8'),attributes,{'tableName':_0xbaea('0x9'),'paranoid':![],'indexes':[{'name':_0xbaea('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3fb=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0xe3fb,0x9c));var _0xbe3f=function(_0x32ca7a,_0x4a069d){_0x32ca7a=_0x32ca7a-0x0;var _0xab41b9=_0xe3fb[_0x32ca7a];return _0xab41b9;};'use strict';var _=require(_0xbe3f('0x0'));var util=require('util');var logger=require(_0xbe3f('0x1'))(_0xbe3f('0x2'));var moment=require('moment');var BPromise=require(_0xbe3f('0x3'));var rp=require(_0xbe3f('0x4'));var fs=require('fs');var path=require(_0xbe3f('0x5'));var rimraf=require(_0xbe3f('0x6'));var config=require(_0xbe3f('0x7'));var attributes=require('./intZohoField.attributes');module[_0xbe3f('0x8')]=function(_0x331574,_0x14da19){return _0x331574[_0xbe3f('0x9')](_0xbe3f('0xa'),attributes,{'tableName':_0xbe3f('0xb'),'paranoid':![],'indexes':[{'name':_0xbe3f('0xc'),'fields':[_0xbe3f('0xd'),_0xbe3f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 622345d..a18a031 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 _0x3eea=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x3ba687,_0x177b13){var _0x30828c=function(_0x92d6c6){while(--_0x92d6c6){_0x3ba687['push'](_0x3ba687['shift']());}};_0x30828c(++_0x177b13);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1e6eaa,_0x585d05){_0x1e6eaa=_0x1e6eaa-0x0;var _0x5b031f=_0x3eea[_0x1e6eaa];return _0x5b031f;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];var utils=require(_0xa3ee('0x6'));var logger=require(_0xa3ee('0x7'))(_0xa3ee('0x8'));var config=require(_0xa3ee('0x9'));var jayson=require(_0xa3ee('0xa'));var client=jayson[_0xa3ee('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x538bf9,_0x4183ee,_0x4e4588){return new BPromise(function(_0x37a3f0,_0x56f37b){return client[_0xa3ee('0xc')](_0x538bf9,_0x4e4588)['then'](function(_0xb1b96d){logger['info'](_0xa3ee('0xd'),_0x4183ee,_0xa3ee('0xe'));logger[_0xa3ee('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x4183ee,_0xa3ee('0xe'),JSON[_0xa3ee('0x10')](_0xb1b96d));if(_0xb1b96d['error']){if(_0xb1b96d['error'][_0xa3ee('0x11')]===0x1f4){logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')]['message']);return _0x56f37b(_0xb1b96d[_0xa3ee('0x12')]['message']);}logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')][_0xa3ee('0x13')]);return _0x37a3f0(_0xb1b96d['error'][_0xa3ee('0x13')]);}else{logger[_0xa3ee('0x14')]('ZohoField,\x20%s,\x20%s',_0x4183ee,'request\x20sent');_0x37a3f0(_0xb1b96d['result'][_0xa3ee('0x13')]);}})[_0xa3ee('0x15')](function(_0x354dd5){logger[_0xa3ee('0x12')]('ZohoField,\x20%s,\x20%s',_0x4183ee,_0x354dd5);_0x56f37b(_0x354dd5);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x55b7ef,_0x3f234e){var _0x1f62b8=function(_0x5b872f){while(--_0x5b872f){_0x55b7ef['push'](_0x55b7ef['shift']());}};_0x1f62b8(++_0x3f234e);}(_0x6aa7,0x178));var _0x76aa=function(_0x5b055a,_0x47b65e){_0x5b055a=_0x5b055a-0x0;var _0x5ec09b=_0x6aa7[_0x5b055a];return _0x5ec09b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index a0820f7..11c6868 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 _0x5995=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59249e,_0x299fa4){var _0x146108=function(_0x126bef){while(--_0x126bef){_0x59249e['push'](_0x59249e['shift']());}};_0x146108(++_0x299fa4);}(_0x5995,0xa0));var _0x5599=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5995[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x5599('0x0'));var util=require(_0x5599('0x1'));var path=require('path');var timeout=require(_0x5599('0x2'));var express=require(_0x5599('0x3'));var router=express[_0x5599('0x4')]();var auth=require(_0x5599('0x5'));var interaction=require(_0x5599('0x6'));var config=require(_0x5599('0x7'));module['exports']=router; \ No newline at end of file +var _0xf748=['../../config/environment','exports','path','express','../../components/interaction/service'];(function(_0x2de0ec,_0x38812f){var _0x13aa7b=function(_0x340176){while(--_0x340176){_0x2de0ec['push'](_0x2de0ec['shift']());}};_0x13aa7b(++_0x38812f);}(_0xf748,0x1d8));var _0x8f74=function(_0x2df537,_0x1359a8){_0x2df537=_0x2df537-0x0;var _0x288850=_0xf748[_0x2df537];return _0x288850;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f74('0x0'));var timeout=require('connect-timeout');var express=require(_0x8f74('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8f74('0x2'));var config=require(_0x8f74('0x3'));module[_0x8f74('0x4')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c709236..cca99d8 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 _0x222c=['exports','unique_name_and_version','app.js','STRING','BOOLEAN','state','sequelize'];(function(_0x1b9210,_0x5bd4fa){var _0x27fa48=function(_0x227db8){while(--_0x227db8){_0x1b9210['push'](_0x1b9210['shift']());}};_0x27fa48(++_0x5bd4fa);}(_0x222c,0xae));var _0xc222=function(_0x332c0c,_0x4250ae){_0x332c0c=_0x332c0c-0x0;var _0x301a6d=_0x222c[_0x332c0c];return _0x301a6d;};'use strict';var Sequelize=require(_0xc222('0x0'));module[_0xc222('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc222('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xc222('0x3')},'filename':{'type':Sequelize[_0xc222('0x4')]},'path':{'type':Sequelize[_0xc222('0x4')]},'type':{'type':Sequelize[_0xc222('0x4')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xc222('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xc222('0x4')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xc222('0x4')],'unique':_0xc222('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xc222('0x4')]},'remoteUri':{'type':Sequelize[_0xc222('0x4')]},'link':{'type':Sequelize[_0xc222('0x4')],'defaultValue':'#'}}; \ No newline at end of file +var _0x5501=['state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x212c61,_0x5beafd){var _0xd63be8=function(_0x4096c3){while(--_0x4096c3){_0x212c61['push'](_0x212c61['shift']());}};_0xd63be8(++_0x5beafd);}(_0x5501,0xe5));var _0x1550=function(_0x481866,_0x50427b){_0x481866=_0x481866-0x0;var _0x3abeca=_0x5501[_0x481866];return _0x3abeca;};'use strict';var Sequelize=require(_0x1550('0x0'));module[_0x1550('0x1')]={'name':{'type':Sequelize[_0x1550('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x1550('0x2')],'allowNull':![],'unique':_0x1550('0x3')},'main':{'type':Sequelize[_0x1550('0x2')],'defaultValue':_0x1550('0x4')},'filename':{'type':Sequelize[_0x1550('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x1550('0x2')]},'logo':{'type':Sequelize[_0x1550('0x2')]},'state':{'type':Sequelize[_0x1550('0x2')],'unique':_0x1550('0x5')},'description':{'type':Sequelize[_0x1550('0x2')]},'title':{'type':Sequelize[_0x1550('0x2')]},'remoteUri':{'type':Sequelize[_0x1550('0x2')]},'link':{'type':Sequelize[_0x1550('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 6694158..3e29404 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 _0x2813=['rows','catch','show','params','length','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','destroy','stack','name','map','Integration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','includeAll','include'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0x2813,0x8f));var _0x3281=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2813[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3281('0x0'));var emlformat=require(_0x3281('0x1'));var rimraf=require(_0x3281('0x2'));var zipdir=require(_0x3281('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3281('0x4'));var moment=require('moment');var BPromise=require(_0x3281('0x5'));var Mustache=require('mustache');var util=require(_0x3281('0x6'));var path=require(_0x3281('0x7'));var sox=require(_0x3281('0x8'));var csv=require('to-csv');var ejs=require(_0x3281('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3281('0xa'));var crypto=require(_0x3281('0xb'));var jsforce=require(_0x3281('0xc'));var deskjs=require(_0x3281('0xd'));var toCsv=require(_0x3281('0xe'));var querystring=require(_0x3281('0xf'));var Papa=require(_0x3281('0x10'));var Redis=require('ioredis');var authService=require(_0x3281('0x11'));var qs=require(_0x3281('0x12'));var as=require(_0x3281('0x13'));var hardwareService=require(_0x3281('0x14'));var logger=require('../../config/logger')(_0x3281('0x15'));var utils=require(_0x3281('0x16'));var config=require('../../config/environment');var db=require(_0x3281('0x17'))['db'];function respondWithStatusCode(_0x2bb80c,_0x443b5f){_0x443b5f=_0x443b5f||0xcc;return function(_0x25f976){if(_0x25f976){return _0x2bb80c[_0x3281('0x18')](_0x443b5f);}return _0x2bb80c[_0x3281('0x19')](_0x443b5f)[_0x3281('0x1a')]();};}function respondWithResult(_0x52cdcb,_0x2e680f){_0x2e680f=_0x2e680f||0xc8;return function(_0x4b7a76){if(_0x4b7a76){return _0x52cdcb['status'](_0x2e680f)[_0x3281('0x1b')](_0x4b7a76);}};}function respondWithFilteredResult(_0x258688,_0x5a83dd){return function(_0xa237f5){if(_0xa237f5){var _0x2622f8=_0xa237f5[_0x3281('0x1c')],_0x3b4156=_0x5a83dd[_0x3281('0x1d')],_0x143ff6=_0x5a83dd[_0x3281('0x1d')]+_0x5a83dd['limit'],_0x215099;if(_0x143ff6>=_0x2622f8){_0x143ff6=_0x2622f8;_0x215099=0xc8;}else{_0x215099=0xce;}_0x258688[_0x3281('0x19')](_0x215099);return _0x258688['set'](_0x3281('0x1e'),_0x3b4156+'-'+_0x143ff6+'/'+_0x2622f8)['json'](_0xa237f5);}return null;};}function patchUpdates(_0x252ce1){return function(_0x3ee84c){try{jsonpatch[_0x3281('0x1f')](_0x3ee84c,_0x252ce1,!![]);}catch(_0x3f8f1d){return BPromise['reject'](_0x3f8f1d);}return _0x3ee84c['save']();};}function saveUpdates(_0x45ee74,_0x10d967){return function(_0x2f7670){if(_0x2f7670){return _0x2f7670[_0x3281('0x20')](_0x45ee74)[_0x3281('0x21')](function(_0x5f03d4){return _0x5f03d4;});}return null;};}function removeEntity(_0xcb9c7b,_0x287e27){return function(_0x853b71){if(_0x853b71){return _0x853b71[_0x3281('0x22')]()[_0x3281('0x21')](function(){_0xcb9c7b['status'](0xcc)[_0x3281('0x1a')]();});}};}function handleEntityNotFound(_0x52e8bf,_0x376e62){return function(_0x4a47a5){if(!_0x4a47a5){_0x52e8bf['sendStatus'](0x194);}return _0x4a47a5;};}function handleError(_0x495ca3,_0x1d345e){_0x1d345e=_0x1d345e||0x1f4;return function(_0x53d219){logger['error'](_0x53d219[_0x3281('0x23')]);if(_0x53d219[_0x3281('0x24')]){delete _0x53d219[_0x3281('0x24')];}_0x495ca3[_0x3281('0x19')](_0x1d345e)['send'](_0x53d219);};}exports['index']=function(_0x373b4f,_0x4e098b){var _0x36ee68={},_0x4874d0={},_0x457919={'count':0x0,'rows':[]};var _0x14083b=_[_0x3281('0x25')](db[_0x3281('0x26')][_0x3281('0x27')],function(_0x484367){return{'name':_0x484367[_0x3281('0x28')],'type':_0x484367[_0x3281('0x29')]['key']};});_0x4874d0['model']=_[_0x3281('0x25')](_0x14083b,_0x3281('0x24'));_0x4874d0[_0x3281('0x2a')]=_[_0x3281('0x2b')](_0x373b4f['query']);_0x4874d0[_0x3281('0x2c')]=_[_0x3281('0x2d')](_0x4874d0[_0x3281('0x2e')],_0x4874d0['query']);_0x36ee68[_0x3281('0x2f')]=_[_0x3281('0x2d')](_0x4874d0[_0x3281('0x2e')],qs['fields'](_0x373b4f[_0x3281('0x2a')][_0x3281('0x30')]));_0x36ee68['attributes']=_0x36ee68[_0x3281('0x2f')]['length']?_0x36ee68[_0x3281('0x2f')]:_0x4874d0[_0x3281('0x2e')];if(!_0x373b4f['query']['hasOwnProperty'](_0x3281('0x31'))){_0x36ee68[_0x3281('0x32')]=qs[_0x3281('0x32')](_0x373b4f[_0x3281('0x2a')][_0x3281('0x32')]);_0x36ee68['offset']=qs[_0x3281('0x1d')](_0x373b4f[_0x3281('0x2a')][_0x3281('0x1d')]);}_0x36ee68['order']=qs[_0x3281('0x33')](_0x373b4f[_0x3281('0x2a')][_0x3281('0x33')]);_0x36ee68[_0x3281('0x34')]=qs[_0x3281('0x2c')](_[_0x3281('0x35')](_0x373b4f[_0x3281('0x2a')],_0x4874d0[_0x3281('0x2c')]),_0x14083b);if(_0x373b4f[_0x3281('0x2a')][_0x3281('0x36')]){_0x36ee68[_0x3281('0x34')]=_[_0x3281('0x37')](_0x36ee68['where'],{'$or':_[_0x3281('0x25')](_0x14083b,function(_0x8f539){if(_0x8f539[_0x3281('0x29')]!=='VIRTUAL'){var _0xf9347c={};_0xf9347c[_0x8f539[_0x3281('0x24')]]={'$like':'%'+_0x373b4f[_0x3281('0x2a')][_0x3281('0x36')]+'%'};return _0xf9347c;}})});}_0x36ee68=_[_0x3281('0x37')]({},_0x36ee68,_0x373b4f['options']);var _0x28a6fc={'where':_0x36ee68['where']};return db['Integration'][_0x3281('0x1c')](_0x28a6fc)['then'](function(_0x59a2b0){_0x457919['count']=_0x59a2b0;if(_0x373b4f[_0x3281('0x2a')][_0x3281('0x38')]){_0x36ee68[_0x3281('0x39')]=[{'all':!![]}];}return db[_0x3281('0x26')]['findAll'](_0x36ee68);})['then'](function(_0x5bf213){_0x457919[_0x3281('0x3a')]=_0x5bf213;return _0x457919;})['then'](respondWithFilteredResult(_0x4e098b,_0x36ee68))[_0x3281('0x3b')](handleError(_0x4e098b,null));};exports[_0x3281('0x3c')]=function(_0x32b6eb,_0x23640d){var _0x5d7d15={'raw':![],'where':{'id':_0x32b6eb[_0x3281('0x3d')]['id']}},_0x205cab={};_0x205cab[_0x3281('0x2e')]=_[_0x3281('0x2b')](db['Integration'][_0x3281('0x27')]);_0x205cab[_0x3281('0x2a')]=_[_0x3281('0x2b')](_0x32b6eb['query']);_0x205cab[_0x3281('0x2c')]=_[_0x3281('0x2d')](_0x205cab[_0x3281('0x2e')],_0x205cab[_0x3281('0x2a')]);_0x5d7d15[_0x3281('0x2f')]=_[_0x3281('0x2d')](_0x205cab[_0x3281('0x2e')],qs[_0x3281('0x30')](_0x32b6eb[_0x3281('0x2a')]['fields']));_0x5d7d15['attributes']=_0x5d7d15[_0x3281('0x2f')][_0x3281('0x3e')]?_0x5d7d15[_0x3281('0x2f')]:_0x205cab[_0x3281('0x2e')];if(_0x32b6eb[_0x3281('0x2a')][_0x3281('0x38')]){_0x5d7d15['include']=[{'all':!![]}];}_0x5d7d15=_[_0x3281('0x37')]({},_0x5d7d15,_0x32b6eb[_0x3281('0x3f')]);return db[_0x3281('0x26')][_0x3281('0x40')](_0x5d7d15)[_0x3281('0x21')](handleEntityNotFound(_0x23640d,null))[_0x3281('0x21')](respondWithResult(_0x23640d,null))['catch'](handleError(_0x23640d,null));};exports[_0x3281('0x41')]=function(_0x519b0e,_0x3b19cb){return db[_0x3281('0x26')][_0x3281('0x41')](_0x519b0e['body'],{})[_0x3281('0x21')](respondWithResult(_0x3b19cb,0xc9))['catch'](handleError(_0x3b19cb,null));};exports[_0x3281('0x20')]=function(_0x416092,_0x2da2e6){if(_0x416092[_0x3281('0x42')]['id']){delete _0x416092[_0x3281('0x42')]['id'];}return db[_0x3281('0x26')][_0x3281('0x40')]({'where':{'id':_0x416092[_0x3281('0x3d')]['id']}})[_0x3281('0x21')](handleEntityNotFound(_0x2da2e6,null))[_0x3281('0x21')](saveUpdates(_0x416092[_0x3281('0x42')],null))[_0x3281('0x21')](respondWithResult(_0x2da2e6,null))['catch'](handleError(_0x2da2e6,null));};exports[_0x3281('0x22')]=function(_0x1fb947,_0x40096f){return db[_0x3281('0x26')][_0x3281('0x40')]({'where':{'id':_0x1fb947[_0x3281('0x3d')]['id']}})[_0x3281('0x21')](handleEntityNotFound(_0x40096f,null))[_0x3281('0x21')](removeEntity(_0x40096f,null))[_0x3281('0x3b')](handleError(_0x40096f,null));}; \ No newline at end of file +var _0x20b6=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','Integration','rawAttributes','fieldName','type','key','keys','query','filters'];(function(_0x423865,_0x499a7a){var _0x332593=function(_0x50c2bf){while(--_0x50c2bf){_0x423865['push'](_0x423865['shift']());}};_0x332593(++_0x499a7a);}(_0x20b6,0x180));var _0x620b=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x20b6[_0x47a40b];return _0x19610c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x620b('0x0'));var rimraf=require(_0x620b('0x1'));var zipdir=require(_0x620b('0x2'));var jsonpatch=require(_0x620b('0x3'));var rp=require(_0x620b('0x4'));var moment=require(_0x620b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x620b('0x6'));var path=require(_0x620b('0x7'));var sox=require('sox');var csv=require(_0x620b('0x8'));var ejs=require(_0x620b('0x9'));var fs=require('fs');var _=require(_0x620b('0xa'));var squel=require(_0x620b('0xb'));var crypto=require(_0x620b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x620b('0xd'));var toCsv=require(_0x620b('0x8'));var querystring=require(_0x620b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x620b('0xf'));var qs=require(_0x620b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x620b('0x11'));var logger=require('../../config/logger')(_0x620b('0x12'));var utils=require(_0x620b('0x13'));var config=require(_0x620b('0x14'));var db=require(_0x620b('0x15'))['db'];function respondWithStatusCode(_0x522adf,_0x5d6092){_0x5d6092=_0x5d6092||0xcc;return function(_0x4786ba){if(_0x4786ba){return _0x522adf[_0x620b('0x16')](_0x5d6092);}return _0x522adf[_0x620b('0x17')](_0x5d6092)['end']();};}function respondWithResult(_0x4ebe84,_0xf30045){_0xf30045=_0xf30045||0xc8;return function(_0x162ee8){if(_0x162ee8){return _0x4ebe84[_0x620b('0x17')](_0xf30045)[_0x620b('0x18')](_0x162ee8);}};}function respondWithFilteredResult(_0x2abada,_0x6f0672){return function(_0x47e60e){if(_0x47e60e){var _0x577e05=_0x47e60e[_0x620b('0x19')],_0x28f4af=_0x6f0672['offset'],_0x24c110=_0x6f0672[_0x620b('0x1a')]+_0x6f0672[_0x620b('0x1b')],_0x38f1b2;if(_0x24c110>=_0x577e05){_0x24c110=_0x577e05;_0x38f1b2=0xc8;}else{_0x38f1b2=0xce;}_0x2abada['status'](_0x38f1b2);return _0x2abada['set'](_0x620b('0x1c'),_0x28f4af+'-'+_0x24c110+'/'+_0x577e05)['json'](_0x47e60e);}return null;};}function patchUpdates(_0x1a3b39){return function(_0x3a2609){try{jsonpatch[_0x620b('0x1d')](_0x3a2609,_0x1a3b39,!![]);}catch(_0x11196b){return BPromise[_0x620b('0x1e')](_0x11196b);}return _0x3a2609[_0x620b('0x1f')]();};}function saveUpdates(_0x1be4a0,_0x35c6e5){return function(_0x2a4a90){if(_0x2a4a90){return _0x2a4a90[_0x620b('0x20')](_0x1be4a0)[_0x620b('0x21')](function(_0x1141d7){return _0x1141d7;});}return null;};}function removeEntity(_0x39e50c,_0x4b9b9c){return function(_0x29c645){if(_0x29c645){return _0x29c645[_0x620b('0x22')]()['then'](function(){_0x39e50c['status'](0xcc)[_0x620b('0x23')]();});}};}function handleEntityNotFound(_0x6e7911,_0x3460c6){return function(_0xc1796a){if(!_0xc1796a){_0x6e7911[_0x620b('0x16')](0x194);}return _0xc1796a;};}function handleError(_0x2f34ff,_0x5d8268){_0x5d8268=_0x5d8268||0x1f4;return function(_0x1f5d56){logger['error'](_0x1f5d56[_0x620b('0x24')]);if(_0x1f5d56[_0x620b('0x25')]){delete _0x1f5d56['name'];}_0x2f34ff[_0x620b('0x17')](_0x5d8268)['send'](_0x1f5d56);};}exports[_0x620b('0x26')]=function(_0xb45d75,_0x53d01c){var _0x3c5d0d={},_0x327417={},_0x532ca0={'count':0x0,'rows':[]};var _0x3f7bf3=_[_0x620b('0x27')](db[_0x620b('0x28')][_0x620b('0x29')],function(_0x42725a){return{'name':_0x42725a[_0x620b('0x2a')],'type':_0x42725a[_0x620b('0x2b')][_0x620b('0x2c')]};});_0x327417['model']=_[_0x620b('0x27')](_0x3f7bf3,_0x620b('0x25'));_0x327417['query']=_[_0x620b('0x2d')](_0xb45d75[_0x620b('0x2e')]);_0x327417[_0x620b('0x2f')]=_['intersection'](_0x327417['model'],_0x327417[_0x620b('0x2e')]);_0x3c5d0d['attributes']=_[_0x620b('0x30')](_0x327417[_0x620b('0x31')],qs['fields'](_0xb45d75[_0x620b('0x2e')][_0x620b('0x32')]));_0x3c5d0d[_0x620b('0x33')]=_0x3c5d0d[_0x620b('0x33')][_0x620b('0x34')]?_0x3c5d0d[_0x620b('0x33')]:_0x327417[_0x620b('0x31')];if(!_0xb45d75[_0x620b('0x2e')][_0x620b('0x35')](_0x620b('0x36'))){_0x3c5d0d['limit']=qs[_0x620b('0x1b')](_0xb45d75[_0x620b('0x2e')][_0x620b('0x1b')]);_0x3c5d0d[_0x620b('0x1a')]=qs[_0x620b('0x1a')](_0xb45d75[_0x620b('0x2e')][_0x620b('0x1a')]);}_0x3c5d0d[_0x620b('0x37')]=qs['sort'](_0xb45d75[_0x620b('0x2e')][_0x620b('0x38')]);_0x3c5d0d[_0x620b('0x39')]=qs[_0x620b('0x2f')](_[_0x620b('0x3a')](_0xb45d75[_0x620b('0x2e')],_0x327417[_0x620b('0x2f')]),_0x3f7bf3);if(_0xb45d75['query'][_0x620b('0x3b')]){_0x3c5d0d[_0x620b('0x39')]=_[_0x620b('0x3c')](_0x3c5d0d[_0x620b('0x39')],{'$or':_[_0x620b('0x27')](_0x3f7bf3,function(_0x30de67){if(_0x30de67[_0x620b('0x2b')]!==_0x620b('0x3d')){var _0x15a83e={};_0x15a83e[_0x30de67[_0x620b('0x25')]]={'$like':'%'+_0xb45d75[_0x620b('0x2e')][_0x620b('0x3b')]+'%'};return _0x15a83e;}})});}_0x3c5d0d=_[_0x620b('0x3c')]({},_0x3c5d0d,_0xb45d75['options']);var _0x265905={'where':_0x3c5d0d[_0x620b('0x39')]};return db[_0x620b('0x28')][_0x620b('0x19')](_0x265905)[_0x620b('0x21')](function(_0x50b5c4){_0x532ca0[_0x620b('0x19')]=_0x50b5c4;if(_0xb45d75[_0x620b('0x2e')][_0x620b('0x3e')]){_0x3c5d0d[_0x620b('0x3f')]=[{'all':!![]}];}return db[_0x620b('0x28')][_0x620b('0x40')](_0x3c5d0d);})[_0x620b('0x21')](function(_0xdebfae){_0x532ca0['rows']=_0xdebfae;return _0x532ca0;})[_0x620b('0x21')](respondWithFilteredResult(_0x53d01c,_0x3c5d0d))[_0x620b('0x41')](handleError(_0x53d01c,null));};exports[_0x620b('0x42')]=function(_0x1eca35,_0x5d2571){var _0x596a9e={'raw':![],'where':{'id':_0x1eca35[_0x620b('0x43')]['id']}},_0x2962f8={};_0x2962f8['model']=_[_0x620b('0x2d')](db[_0x620b('0x28')][_0x620b('0x29')]);_0x2962f8[_0x620b('0x2e')]=_[_0x620b('0x2d')](_0x1eca35[_0x620b('0x2e')]);_0x2962f8['filters']=_['intersection'](_0x2962f8['model'],_0x2962f8[_0x620b('0x2e')]);_0x596a9e[_0x620b('0x33')]=_[_0x620b('0x30')](_0x2962f8[_0x620b('0x31')],qs[_0x620b('0x32')](_0x1eca35[_0x620b('0x2e')][_0x620b('0x32')]));_0x596a9e[_0x620b('0x33')]=_0x596a9e[_0x620b('0x33')][_0x620b('0x34')]?_0x596a9e['attributes']:_0x2962f8[_0x620b('0x31')];if(_0x1eca35[_0x620b('0x2e')][_0x620b('0x3e')]){_0x596a9e[_0x620b('0x3f')]=[{'all':!![]}];}_0x596a9e=_[_0x620b('0x3c')]({},_0x596a9e,_0x1eca35[_0x620b('0x44')]);return db[_0x620b('0x28')][_0x620b('0x45')](_0x596a9e)['then'](handleEntityNotFound(_0x5d2571,null))[_0x620b('0x21')](respondWithResult(_0x5d2571,null))[_0x620b('0x41')](handleError(_0x5d2571,null));};exports[_0x620b('0x46')]=function(_0xcc94f9,_0x132576){return db['Integration'][_0x620b('0x46')](_0xcc94f9[_0x620b('0x47')],{})['then'](respondWithResult(_0x132576,0xc9))[_0x620b('0x41')](handleError(_0x132576,null));};exports['update']=function(_0x2d4fde,_0x4c979e){if(_0x2d4fde[_0x620b('0x47')]['id']){delete _0x2d4fde[_0x620b('0x47')]['id'];}return db[_0x620b('0x28')][_0x620b('0x45')]({'where':{'id':_0x2d4fde[_0x620b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c979e,null))[_0x620b('0x21')](saveUpdates(_0x2d4fde[_0x620b('0x47')],null))[_0x620b('0x21')](respondWithResult(_0x4c979e,null))[_0x620b('0x41')](handleError(_0x4c979e,null));};exports['destroy']=function(_0x385282,_0x501610){return db[_0x620b('0x28')][_0x620b('0x45')]({'where':{'id':_0x385282[_0x620b('0x43')]['id']}})['then'](handleEntityNotFound(_0x501610,null))['then'](removeEntity(_0x501610,null))[_0x620b('0x41')](handleError(_0x501610,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 87edbed..f1a75ad 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 _0xe735=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','Integration','integrations','util'];(function(_0x350a00,_0x41d490){var _0x2f07e8=function(_0xa9cdce){while(--_0xa9cdce){_0x350a00['push'](_0x350a00['shift']());}};_0x2f07e8(++_0x41d490);}(_0xe735,0x121));var _0x5e73=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0xe735[_0x44afa4];return _0xcad289;};'use strict';var _=require('lodash');var util=require(_0x5e73('0x0'));var logger=require(_0x5e73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5e73('0x2'));var rp=require(_0x5e73('0x3'));var fs=require('fs');var path=require(_0x5e73('0x4'));var rimraf=require(_0x5e73('0x5'));var config=require(_0x5e73('0x6'));var attributes=require('./integration.attributes');module[_0x5e73('0x7')]=function(_0x46440a,_0x522634){return _0x46440a['define'](_0x5e73('0x8'),attributes,{'tableName':_0x5e73('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef5=['../../config/environment','./integration.attributes','exports','define','Integration','lodash','util','request-promise','path','rimraf'];(function(_0x380a7c,_0x3713c8){var _0x3983f3=function(_0x3acc19){while(--_0x3acc19){_0x380a7c['push'](_0x380a7c['shift']());}};_0x3983f3(++_0x3713c8);}(_0x2ef5,0x1db));var _0x52ef=function(_0x210d95,_0x478cd5){_0x210d95=_0x210d95-0x0;var _0x561600=_0x2ef5[_0x210d95];return _0x561600;};'use strict';var _=require(_0x52ef('0x0'));var util=require(_0x52ef('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x52ef('0x2'));var fs=require('fs');var path=require(_0x52ef('0x3'));var rimraf=require(_0x52ef('0x4'));var config=require(_0x52ef('0x5'));var attributes=require(_0x52ef('0x6'));module[_0x52ef('0x7')]=function(_0x509054,_0x34639a){return _0x509054[_0x52ef('0x8')](_0x52ef('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 2e576b5..7e6b8b2 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 _0x4986=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x4986,0x6e));var _0x6498=function(_0x1a8698,_0x51a362){_0x1a8698=_0x1a8698-0x0;var _0x25c050=_0x4986[_0x1a8698];return _0x25c050;};'use strict';var _=require(_0x6498('0x0'));var util=require(_0x6498('0x1'));var moment=require(_0x6498('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6498('0x3'));var db=require(_0x6498('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6498('0x5'))(_0x6498('0x6'));var config=require(_0x6498('0x7'));var jayson=require(_0x6498('0x8'));var client=jayson[_0x6498('0x9')][_0x6498('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26476d,_0x49b00a,_0x54e6af){return new BPromise(function(_0x1e2d8a,_0x2472af){return client[_0x6498('0xb')](_0x26476d,_0x54e6af)[_0x6498('0xc')](function(_0x1c590e){logger['info'](_0x6498('0xd'),_0x49b00a,_0x6498('0xe'));logger[_0x6498('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x49b00a,'request\x20sent',JSON[_0x6498('0x10')](_0x1c590e));if(_0x1c590e['error']){if(_0x1c590e[_0x6498('0x11')][_0x6498('0x12')]===0x1f4){logger[_0x6498('0x11')](_0x6498('0xd'),_0x49b00a,_0x1c590e[_0x6498('0x11')][_0x6498('0x13')]);return _0x2472af(_0x1c590e[_0x6498('0x11')]['message']);}logger['error'](_0x6498('0xd'),_0x49b00a,_0x1c590e[_0x6498('0x11')][_0x6498('0x13')]);return _0x1e2d8a(_0x1c590e[_0x6498('0x11')][_0x6498('0x13')]);}else{logger['info'](_0x6498('0xd'),_0x49b00a,_0x6498('0xe'));_0x1e2d8a(_0x1c590e[_0x6498('0x14')][_0x6498('0x13')]);}})[_0x6498('0x15')](function(_0x1b4083){logger[_0x6498('0x11')]('Integration,\x20%s,\x20%s',_0x49b00a,_0x1b4083);_0x2472af(_0x1b4083);});});} \ No newline at end of file +var _0x8ece=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ece,0x195));var _0xe8ec=function(_0x5c8a11,_0x10805f){_0x5c8a11=_0x5c8a11-0x0;var _0x116b22=_0x8ece[_0x5c8a11];return _0x116b22;};'use strict';var _=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var moment=require(_0xe8ec('0x2'));var BPromise=require(_0xe8ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8ec('0x4'))['db'];var utils=require(_0xe8ec('0x5'));var logger=require(_0xe8ec('0x6'))(_0xe8ec('0x7'));var config=require(_0xe8ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe8ec('0x9')][_0xe8ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x64ed4c,_0x234b67,_0x3682cb){return new BPromise(function(_0x122f36,_0x406f7e){return client['request'](_0x64ed4c,_0x3682cb)[_0xe8ec('0xb')](function(_0x5e1fe9){logger[_0xe8ec('0xc')]('Integration,\x20%s,\x20%s',_0x234b67,_0xe8ec('0xd'));logger[_0xe8ec('0xe')](_0xe8ec('0xf'),_0x234b67,_0xe8ec('0xd'),JSON[_0xe8ec('0x10')](_0x5e1fe9));if(_0x5e1fe9[_0xe8ec('0x11')]){if(_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x12')]===0x1f4){logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);return _0x406f7e(_0x5e1fe9[_0xe8ec('0x11')]['message']);}logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);return _0x122f36(_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);}else{logger[_0xe8ec('0xc')](_0xe8ec('0x13'),_0x234b67,'request\x20sent');_0x122f36(_0x5e1fe9[_0xe8ec('0x15')][_0xe8ec('0x14')]);}})[_0xe8ec('0x16')](function(_0x50f8ed){logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x50f8ed);_0x406f7e(_0x50f8ed);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index ba3d4db..cf953bd 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 _0xe62f=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','get','/describe'];(function(_0x3d9685,_0x3a9f99){var _0x5856f8=function(_0x4d85eb){while(--_0x4d85eb){_0x3d9685['push'](_0x3d9685['shift']());}};_0x5856f8(++_0x3a9f99);}(_0xe62f,0xc5));var _0xfe62=function(_0x179388,_0x4c4ce3){_0x179388=_0x179388-0x0;var _0xaa9a2f=_0xe62f[_0x179388];return _0xaa9a2f;};'use strict';var multer=require(_0xfe62('0x0'));var util=require(_0xfe62('0x1'));var path=require(_0xfe62('0x2'));var timeout=require(_0xfe62('0x3'));var express=require(_0xfe62('0x4'));var router=express[_0xfe62('0x5')]();var auth=require(_0xfe62('0x6'));var interaction=require(_0xfe62('0x7'));var config=require(_0xfe62('0x8'));var controller=require(_0xfe62('0x9'));router['get']('/',auth[_0xfe62('0xa')](),controller['index']);router[_0xfe62('0xb')](_0xfe62('0xc'),auth[_0xfe62('0xa')](),controller['describe']);router[_0xfe62('0xb')](_0xfe62('0xd'),auth['isAuthenticated'](),controller[_0xfe62('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfe62('0xf')]);router[_0xfe62('0x10')]('/:id',auth[_0xfe62('0xa')](),controller[_0xfe62('0x11')]);router[_0xfe62('0x12')](_0xfe62('0xd'),auth[_0xfe62('0xa')](),controller[_0xfe62('0x13')]);module[_0xfe62('0x14')]=router; \ No newline at end of file +var _0x95fa=['show','post','create','update','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/:id'];(function(_0x23aabf,_0x552fa4){var _0x122c6e=function(_0x38ebff){while(--_0x38ebff){_0x23aabf['push'](_0x23aabf['shift']());}};_0x122c6e(++_0x552fa4);}(_0x95fa,0x196));var _0xa95f=function(_0x151c85,_0x2d21be){_0x151c85=_0x151c85-0x0;var _0x2db453=_0x95fa[_0x151c85];return _0x2db453;};'use strict';var multer=require(_0xa95f('0x0'));var util=require(_0xa95f('0x1'));var path=require('path');var timeout=require(_0xa95f('0x2'));var express=require('express');var router=express[_0xa95f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa95f('0x4'));var config=require(_0xa95f('0x5'));var controller=require(_0xa95f('0x6'));router[_0xa95f('0x7')]('/',auth[_0xa95f('0x8')](),controller['index']);router['get']('/describe',auth[_0xa95f('0x8')](),controller['describe']);router[_0xa95f('0x7')](_0xa95f('0x9'),auth[_0xa95f('0x8')](),controller[_0xa95f('0xa')]);router[_0xa95f('0xb')]('/',auth[_0xa95f('0x8')](),controller[_0xa95f('0xc')]);router['put']('/:id',auth[_0xa95f('0x8')](),controller[_0xa95f('0xd')]);router['delete'](_0xa95f('0x9'),auth[_0xa95f('0x8')](),controller[_0xa95f('0xe')]);module[_0xa95f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index affc4b7..cab2b6c 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 _0xdfb5=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM'];(function(_0x3445a1,_0x4661bb){var _0x4b739b=function(_0x4ed18b){while(--_0x4ed18b){_0x3445a1['push'](_0x3445a1['shift']());}};_0x4b739b(++_0x4661bb);}(_0xdfb5,0xb3));var _0x5dfb=function(_0x31564f,_0x507909){_0x31564f=_0x31564f-0x0;var _0x156982=_0xdfb5[_0x31564f];return _0x156982;};'use strict';var Sequelize=require(_0x5dfb('0x0'));module[_0x5dfb('0x1')]={'integration':{'type':Sequelize[_0x5dfb('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x5dfb('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5dfb('0x2')]},'calleridnum':{'type':Sequelize[_0x5dfb('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5dfb('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5dfb('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5dfb('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5dfb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5dfb('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5dfb('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5dfb('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x5dfb('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5dfb('0x3')]},'lastevent':{'type':Sequelize[_0x5dfb('0x2')]},'channel':{'type':Sequelize[_0x5dfb('0x2')]},'channelstate':{'type':Sequelize[_0x5dfb('0x5')]},'channelstatedesc':{'type':Sequelize[_0x5dfb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5dfb('0x2')]},'connectedlinename':{'type':Sequelize[_0x5dfb('0x2')]},'language':{'type':Sequelize[_0x5dfb('0x2')]},'accountcode':{'type':Sequelize[_0x5dfb('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5dfb('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x5dfb('0x2')]},'destcalleridname':{'type':Sequelize[_0x5dfb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5dfb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5dfb('0x2')]},'destlanguage':{'type':Sequelize[_0x5dfb('0x2')]},'destaccountcode':{'type':Sequelize[_0x5dfb('0x2')]},'destcontext':{'type':Sequelize[_0x5dfb('0x2')]},'destexten':{'type':Sequelize[_0x5dfb('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x5dfb('0x2')]},'messageId':{'type':Sequelize[_0x5dfb('0x2')]},'inReplyTo':{'type':Sequelize[_0x5dfb('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x5dfb('0x2')]},'to':{'type':Sequelize[_0x5dfb('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x5dfb('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x5dfb('0x6')]},'status':{'type':Sequelize[_0x5dfb('0x7')]('SENT',_0x5dfb('0x8'),_0x5dfb('0x9'),_0x5dfb('0xa'))},'url':{'type':Sequelize[_0x5dfb('0x2')]},'app':{'type':Sequelize[_0x5dfb('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x5dfb('0x5')]}}; \ No newline at end of file +var _0xbf8a=['BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','STRING','INTEGER','DATE'];(function(_0xbb59c6,_0x47edc0){var _0x32b906=function(_0xc309c0){while(--_0xc309c0){_0xbb59c6['push'](_0xbb59c6['shift']());}};_0x32b906(++_0x47edc0);}(_0xbf8a,0x11d));var _0xabf8=function(_0x40ef50,_0x2f571d){_0x40ef50=_0x40ef50-0x0;var _0x544784=_0xbf8a[_0x40ef50];return _0x544784;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xabf8('0x0')]},'exitStatus':{'type':Sequelize[_0xabf8('0x0')]},'ticketId':{'type':Sequelize[_0xabf8('0x0')]},'integrationId':{'type':Sequelize[_0xabf8('0x1')]},'contacts':{'type':Sequelize[_0xabf8('0x0')]},'uniqueid':{'type':Sequelize[_0xabf8('0x0')]},'calleridnum':{'type':Sequelize[_0xabf8('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xabf8('0x0')]},'interface':{'type':Sequelize[_0xabf8('0x0')]},'membername':{'type':Sequelize[_0xabf8('0x0')]},'agentcalledAt':{'type':Sequelize[_0xabf8('0x2')]},'agentconnectAt':{'type':Sequelize[_0xabf8('0x2')]},'holdtime':{'type':Sequelize[_0xabf8('0x1')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xabf8('0x2')]},'talktime':{'type':Sequelize[_0xabf8('0x1')]},'agentacw':{'type':Sequelize[_0xabf8('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xabf8('0x0')]},'agentringnoanswer':{'type':Sequelize[_0xabf8('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xabf8('0x2')]},'lastevent':{'type':Sequelize[_0xabf8('0x0')]},'channel':{'type':Sequelize[_0xabf8('0x0')]},'channelstate':{'type':Sequelize[_0xabf8('0x1')]},'channelstatedesc':{'type':Sequelize[_0xabf8('0x0')]},'connectedlinenum':{'type':Sequelize[_0xabf8('0x0')]},'connectedlinename':{'type':Sequelize[_0xabf8('0x0')]},'language':{'type':Sequelize[_0xabf8('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xabf8('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xabf8('0x0')]},'destchannelstate':{'type':Sequelize[_0xabf8('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0xabf8('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xabf8('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xabf8('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xabf8('0x0')]},'destlanguage':{'type':Sequelize[_0xabf8('0x0')]},'destaccountcode':{'type':Sequelize[_0xabf8('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xabf8('0x0')]},'destuniqueid':{'type':Sequelize[_0xabf8('0x0')]},'messageId':{'type':Sequelize[_0xabf8('0x0')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xabf8('0x0')]},'from':{'type':Sequelize[_0xabf8('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xabf8('0x4')]},'html':{'type':Sequelize[_0xabf8('0x4')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xabf8('0x5')]('SENT',_0xabf8('0x6'),_0xabf8('0x7'),_0xabf8('0x8'))},'url':{'type':Sequelize[_0xabf8('0x0')]},'app':{'type':Sequelize[_0xabf8('0x0')]},'appdata':{'type':Sequelize[_0xabf8('0x0')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d866fc8..71bf803 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 _0x467f=['update','destroy','then','error','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','fields','attributes','length','hasOwnProperty','limit','sort','filters','merge','where','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject'];(function(_0x5352d7,_0x447a4c){var _0x594939=function(_0x3baa2c){while(--_0x3baa2c){_0x5352d7['push'](_0x5352d7['shift']());}};_0x594939(++_0x447a4c);}(_0x467f,0x17d));var _0xf467=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x467f[_0x4e676e];return _0x336a3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf467('0x0'));var rimraf=require(_0xf467('0x1'));var zipdir=require(_0xf467('0x2'));var jsonpatch=require(_0xf467('0x3'));var rp=require(_0xf467('0x4'));var moment=require('moment');var BPromise=require(_0xf467('0x5'));var Mustache=require(_0xf467('0x6'));var util=require(_0xf467('0x7'));var path=require(_0xf467('0x8'));var sox=require('sox');var csv=require(_0xf467('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf467('0xa'));var jsforce=require(_0xf467('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf467('0x9'));var querystring=require(_0xf467('0xc'));var Papa=require(_0xf467('0xd'));var Redis=require(_0xf467('0xe'));var authService=require(_0xf467('0xf'));var qs=require(_0xf467('0x10'));var as=require(_0xf467('0x11'));var hardwareService=require(_0xf467('0x12'));var logger=require(_0xf467('0x13'))(_0xf467('0x14'));var utils=require(_0xf467('0x15'));var config=require(_0xf467('0x16'));var db=require(_0xf467('0x17'))['db'];function respondWithStatusCode(_0x4a334c,_0x5c6558){_0x5c6558=_0x5c6558||0xcc;return function(_0xe8124f){if(_0xe8124f){return _0x4a334c[_0xf467('0x18')](_0x5c6558);}return _0x4a334c[_0xf467('0x19')](_0x5c6558)[_0xf467('0x1a')]();};}function respondWithResult(_0x6fd48a,_0x1135d4){_0x1135d4=_0x1135d4||0xc8;return function(_0x183fb1){if(_0x183fb1){return _0x6fd48a[_0xf467('0x19')](_0x1135d4)[_0xf467('0x1b')](_0x183fb1);}};}function respondWithFilteredResult(_0x396ae2,_0x5423f3){return function(_0x405531){if(_0x405531){var _0x2c9027=_0x405531[_0xf467('0x1c')],_0x2c520b=_0x5423f3['offset'],_0x5657ad=_0x5423f3[_0xf467('0x1d')]+_0x5423f3['limit'],_0x124a61;if(_0x5657ad>=_0x2c9027){_0x5657ad=_0x2c9027;_0x124a61=0xc8;}else{_0x124a61=0xce;}_0x396ae2[_0xf467('0x19')](_0x124a61);return _0x396ae2[_0xf467('0x1e')]('Content-Range',_0x2c520b+'-'+_0x5657ad+'/'+_0x2c9027)['json'](_0x405531);}return null;};}function patchUpdates(_0x1bccce){return function(_0x2bbc5f){try{jsonpatch[_0xf467('0x1f')](_0x2bbc5f,_0x1bccce,!![]);}catch(_0x3b7a63){return BPromise[_0xf467('0x20')](_0x3b7a63);}return _0x2bbc5f['save']();};}function saveUpdates(_0x26002c,_0x5ba923){return function(_0x3bda98){if(_0x3bda98){return _0x3bda98[_0xf467('0x21')](_0x26002c)['then'](function(_0x2435b0){return _0x2435b0;});}return null;};}function removeEntity(_0x448c46,_0x2f70bc){return function(_0x19087d){if(_0x19087d){return _0x19087d[_0xf467('0x22')]()[_0xf467('0x23')](function(){_0x448c46[_0xf467('0x19')](0xcc)[_0xf467('0x1a')]();});}};}function handleEntityNotFound(_0x5e3cd3,_0x584547){return function(_0x49b0aa){if(!_0x49b0aa){_0x5e3cd3[_0xf467('0x18')](0x194);}return _0x49b0aa;};}function handleError(_0x317613,_0xb709ba){_0xb709ba=_0xb709ba||0x1f4;return function(_0x562e42){logger[_0xf467('0x24')](_0x562e42['stack']);if(_0x562e42[_0xf467('0x25')]){delete _0x562e42[_0xf467('0x25')];}_0x317613[_0xf467('0x19')](_0xb709ba)[_0xf467('0x26')](_0x562e42);};}exports['index']=function(_0x22f53a,_0x40d4cd){var _0x2dde63={},_0x1072d8={},_0x518851={'count':0x0,'rows':[]};var _0x43dd95=_[_0xf467('0x27')](db[_0xf467('0x28')][_0xf467('0x29')],function(_0xe7fbc9){return{'name':_0xe7fbc9[_0xf467('0x2a')],'type':_0xe7fbc9[_0xf467('0x2b')][_0xf467('0x2c')]};});_0x1072d8[_0xf467('0x2d')]=_[_0xf467('0x27')](_0x43dd95,_0xf467('0x25'));_0x1072d8['query']=_[_0xf467('0x2e')](_0x22f53a['query']);_0x1072d8['filters']=_['intersection'](_0x1072d8['model'],_0x1072d8[_0xf467('0x2f')]);_0x2dde63['attributes']=_['intersection'](_0x1072d8['model'],qs[_0xf467('0x30')](_0x22f53a['query'][_0xf467('0x30')]));_0x2dde63[_0xf467('0x31')]=_0x2dde63[_0xf467('0x31')][_0xf467('0x32')]?_0x2dde63['attributes']:_0x1072d8[_0xf467('0x2d')];if(!_0x22f53a[_0xf467('0x2f')][_0xf467('0x33')]('nolimit')){_0x2dde63[_0xf467('0x34')]=qs[_0xf467('0x34')](_0x22f53a[_0xf467('0x2f')]['limit']);_0x2dde63[_0xf467('0x1d')]=qs[_0xf467('0x1d')](_0x22f53a[_0xf467('0x2f')]['offset']);}_0x2dde63['order']=qs['sort'](_0x22f53a[_0xf467('0x2f')][_0xf467('0x35')]);_0x2dde63['where']=qs[_0xf467('0x36')](_['pick'](_0x22f53a[_0xf467('0x2f')],_0x1072d8['filters']),_0x43dd95);if(_0x22f53a['query']['filter']){_0x2dde63['where']=_[_0xf467('0x37')](_0x2dde63[_0xf467('0x38')],{'$or':_[_0xf467('0x27')](_0x43dd95,function(_0x28d35b){if(_0x28d35b[_0xf467('0x2b')]!=='VIRTUAL'){var _0x85cc4b={};_0x85cc4b[_0x28d35b[_0xf467('0x25')]]={'$like':'%'+_0x22f53a[_0xf467('0x2f')]['filter']+'%'};return _0x85cc4b;}})});}_0x2dde63=_['merge']({},_0x2dde63,_0x22f53a['options']);var _0x56d85c={'where':_0x2dde63[_0xf467('0x38')]};return db[_0xf467('0x28')][_0xf467('0x1c')](_0x56d85c)[_0xf467('0x23')](function(_0x5d0b8c){_0x518851[_0xf467('0x1c')]=_0x5d0b8c;if(_0x22f53a['query'][_0xf467('0x39')]){_0x2dde63[_0xf467('0x3a')]=[{'all':!![]}];}return db[_0xf467('0x28')][_0xf467('0x3b')](_0x2dde63);})[_0xf467('0x23')](function(_0x30b07b){_0x518851[_0xf467('0x3c')]=_0x30b07b;return _0x518851;})[_0xf467('0x23')](respondWithFilteredResult(_0x40d4cd,_0x2dde63))[_0xf467('0x3d')](handleError(_0x40d4cd,null));};exports['show']=function(_0x50421f,_0x3508b3){var _0xe53255={'raw':![],'where':{'id':_0x50421f[_0xf467('0x3e')]['id']}},_0x3225f2={};_0x3225f2[_0xf467('0x2d')]=_[_0xf467('0x2e')](db[_0xf467('0x28')]['rawAttributes']);_0x3225f2['query']=_[_0xf467('0x2e')](_0x50421f[_0xf467('0x2f')]);_0x3225f2[_0xf467('0x36')]=_[_0xf467('0x3f')](_0x3225f2['model'],_0x3225f2[_0xf467('0x2f')]);_0xe53255[_0xf467('0x31')]=_[_0xf467('0x3f')](_0x3225f2[_0xf467('0x2d')],qs['fields'](_0x50421f[_0xf467('0x2f')][_0xf467('0x30')]));_0xe53255['attributes']=_0xe53255[_0xf467('0x31')][_0xf467('0x32')]?_0xe53255['attributes']:_0x3225f2[_0xf467('0x2d')];if(_0x50421f[_0xf467('0x2f')][_0xf467('0x39')]){_0xe53255['include']=[{'all':!![]}];}_0xe53255=_[_0xf467('0x37')]({},_0xe53255,_0x50421f[_0xf467('0x40')]);return db[_0xf467('0x28')][_0xf467('0x41')](_0xe53255)[_0xf467('0x23')](handleEntityNotFound(_0x3508b3,null))['then'](respondWithResult(_0x3508b3,null))[_0xf467('0x3d')](handleError(_0x3508b3,null));};exports[_0xf467('0x42')]=function(_0x48440c,_0x350f21){return db[_0xf467('0x28')][_0xf467('0x42')](_0x48440c['body'],{})[_0xf467('0x23')](respondWithResult(_0x350f21,0xc9))['catch'](handleError(_0x350f21,null));};exports['update']=function(_0x3a730e,_0x5cef48){if(_0x3a730e[_0xf467('0x43')]['id']){delete _0x3a730e[_0xf467('0x43')]['id'];}return db[_0xf467('0x28')][_0xf467('0x41')]({'where':{'id':_0x3a730e['params']['id']}})[_0xf467('0x23')](handleEntityNotFound(_0x5cef48,null))[_0xf467('0x23')](saveUpdates(_0x3a730e[_0xf467('0x43')],null))[_0xf467('0x23')](respondWithResult(_0x5cef48,null))[_0xf467('0x3d')](handleError(_0x5cef48,null));};exports[_0xf467('0x22')]=function(_0xe3b475,_0xa9b715){return db['IntegrationReport']['find']({'where':{'id':_0xe3b475[_0xf467('0x3e')]['id']}})[_0xf467('0x23')](handleEntityNotFound(_0xa9b715,null))[_0xf467('0x23')](removeEntity(_0xa9b715,null))[_0xf467('0x3d')](handleError(_0xa9b715,null));};exports['describe']=function(_0x5afa37,_0xe339f9){return db[_0xf467('0x28')][_0xf467('0x44')]()[_0xf467('0x23')](respondWithResult(_0xe339f9,null))[_0xf467('0x3d')](handleError(_0xe339f9,null));}; \ No newline at end of file +var _0x737c=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','json','apply','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','IntegrationReport','includeAll','include','findAll','rows','show','find','catch','create','body','destroy','params','describe','html-pdf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x116482,_0x35ddae){var _0x56db37=function(_0xc3685c){while(--_0xc3685c){_0x116482['push'](_0x116482['shift']());}};_0x56db37(++_0x35ddae);}(_0x737c,0x11e));var _0xc737=function(_0x1b1dff,_0x4c2de2){_0x1b1dff=_0x1b1dff-0x0;var _0x280d9d=_0x737c[_0x1b1dff];return _0x280d9d;};'use strict';var pdf=require(_0xc737('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc737('0x1'));var moment=require(_0xc737('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc737('0x3'));var util=require(_0xc737('0x4'));var path=require(_0xc737('0x5'));var sox=require(_0xc737('0x6'));var csv=require(_0xc737('0x7'));var ejs=require(_0xc737('0x8'));var fs=require('fs');var _=require(_0xc737('0x9'));var squel=require(_0xc737('0xa'));var crypto=require(_0xc737('0xb'));var jsforce=require(_0xc737('0xc'));var deskjs=require(_0xc737('0xd'));var toCsv=require(_0xc737('0x7'));var querystring=require(_0xc737('0xe'));var Papa=require(_0xc737('0xf'));var Redis=require('ioredis');var authService=require(_0xc737('0x10'));var qs=require(_0xc737('0x11'));var as=require(_0xc737('0x12'));var hardwareService=require(_0xc737('0x13'));var logger=require(_0xc737('0x14'))('api');var utils=require(_0xc737('0x15'));var config=require(_0xc737('0x16'));var db=require(_0xc737('0x17'))['db'];function respondWithStatusCode(_0x2ddb6f,_0x453a32){_0x453a32=_0x453a32||0xcc;return function(_0x5ec203){if(_0x5ec203){return _0x2ddb6f[_0xc737('0x18')](_0x453a32);}return _0x2ddb6f[_0xc737('0x19')](_0x453a32)['end']();};}function respondWithResult(_0x498c18,_0x7c9c00){_0x7c9c00=_0x7c9c00||0xc8;return function(_0x38db5f){if(_0x38db5f){return _0x498c18['status'](_0x7c9c00)['json'](_0x38db5f);}};}function respondWithFilteredResult(_0x1aeac9,_0x1ff172){return function(_0x4dedd0){if(_0x4dedd0){var _0xe94c8b=_0x4dedd0[_0xc737('0x1a')],_0x573386=_0x1ff172[_0xc737('0x1b')],_0x276f72=_0x1ff172['offset']+_0x1ff172['limit'],_0x37bcc5;if(_0x276f72>=_0xe94c8b){_0x276f72=_0xe94c8b;_0x37bcc5=0xc8;}else{_0x37bcc5=0xce;}_0x1aeac9[_0xc737('0x19')](_0x37bcc5);return _0x1aeac9[_0xc737('0x1c')]('Content-Range',_0x573386+'-'+_0x276f72+'/'+_0xe94c8b)[_0xc737('0x1d')](_0x4dedd0);}return null;};}function patchUpdates(_0x221af0){return function(_0x71ebbf){try{jsonpatch[_0xc737('0x1e')](_0x71ebbf,_0x221af0,!![]);}catch(_0x14cb00){return BPromise['reject'](_0x14cb00);}return _0x71ebbf[_0xc737('0x1f')]();};}function saveUpdates(_0x3f4832,_0x3fdd7f){return function(_0xc001dc){if(_0xc001dc){return _0xc001dc[_0xc737('0x20')](_0x3f4832)[_0xc737('0x21')](function(_0x51eb99){return _0x51eb99;});}return null;};}function removeEntity(_0x5844fe,_0x53a555){return function(_0x1d8434){if(_0x1d8434){return _0x1d8434['destroy']()[_0xc737('0x21')](function(){_0x5844fe['status'](0xcc)[_0xc737('0x22')]();});}};}function handleEntityNotFound(_0x2c963a,_0x36b4a3){return function(_0x249f73){if(!_0x249f73){_0x2c963a[_0xc737('0x18')](0x194);}return _0x249f73;};}function handleError(_0x12d108,_0xbf9750){_0xbf9750=_0xbf9750||0x1f4;return function(_0x2e29fa){logger['error'](_0x2e29fa[_0xc737('0x23')]);if(_0x2e29fa[_0xc737('0x24')]){delete _0x2e29fa['name'];}_0x12d108[_0xc737('0x19')](_0xbf9750)[_0xc737('0x25')](_0x2e29fa);};}exports[_0xc737('0x26')]=function(_0x463a9f,_0x4563ed){var _0x3fe25f={},_0x54e40e={},_0x483687={'count':0x0,'rows':[]};var _0x3a9001=_[_0xc737('0x27')](db['IntegrationReport'][_0xc737('0x28')],function(_0x426d67){return{'name':_0x426d67[_0xc737('0x29')],'type':_0x426d67[_0xc737('0x2a')][_0xc737('0x2b')]};});_0x54e40e[_0xc737('0x2c')]=_[_0xc737('0x27')](_0x3a9001,'name');_0x54e40e['query']=_[_0xc737('0x2d')](_0x463a9f[_0xc737('0x2e')]);_0x54e40e[_0xc737('0x2f')]=_['intersection'](_0x54e40e['model'],_0x54e40e[_0xc737('0x2e')]);_0x3fe25f[_0xc737('0x30')]=_[_0xc737('0x31')](_0x54e40e['model'],qs[_0xc737('0x32')](_0x463a9f[_0xc737('0x2e')][_0xc737('0x32')]));_0x3fe25f['attributes']=_0x3fe25f['attributes'][_0xc737('0x33')]?_0x3fe25f[_0xc737('0x30')]:_0x54e40e[_0xc737('0x2c')];if(!_0x463a9f[_0xc737('0x2e')]['hasOwnProperty'](_0xc737('0x34'))){_0x3fe25f[_0xc737('0x35')]=qs[_0xc737('0x35')](_0x463a9f['query'][_0xc737('0x35')]);_0x3fe25f[_0xc737('0x1b')]=qs['offset'](_0x463a9f['query'][_0xc737('0x1b')]);}_0x3fe25f[_0xc737('0x36')]=qs[_0xc737('0x37')](_0x463a9f[_0xc737('0x2e')][_0xc737('0x37')]);_0x3fe25f[_0xc737('0x38')]=qs[_0xc737('0x2f')](_[_0xc737('0x39')](_0x463a9f[_0xc737('0x2e')],_0x54e40e[_0xc737('0x2f')]),_0x3a9001);if(_0x463a9f[_0xc737('0x2e')]['filter']){_0x3fe25f[_0xc737('0x38')]=_[_0xc737('0x3a')](_0x3fe25f[_0xc737('0x38')],{'$or':_[_0xc737('0x27')](_0x3a9001,function(_0x5b4583){if(_0x5b4583['type']!==_0xc737('0x3b')){var _0x5b2fbd={};_0x5b2fbd[_0x5b4583['name']]={'$like':'%'+_0x463a9f[_0xc737('0x2e')][_0xc737('0x3c')]+'%'};return _0x5b2fbd;}})});}_0x3fe25f=_[_0xc737('0x3a')]({},_0x3fe25f,_0x463a9f[_0xc737('0x3d')]);var _0x1f9daf={'where':_0x3fe25f[_0xc737('0x38')]};return db[_0xc737('0x3e')][_0xc737('0x1a')](_0x1f9daf)['then'](function(_0x4424bd){_0x483687[_0xc737('0x1a')]=_0x4424bd;if(_0x463a9f[_0xc737('0x2e')][_0xc737('0x3f')]){_0x3fe25f[_0xc737('0x40')]=[{'all':!![]}];}return db[_0xc737('0x3e')][_0xc737('0x41')](_0x3fe25f);})[_0xc737('0x21')](function(_0x211bfe){_0x483687[_0xc737('0x42')]=_0x211bfe;return _0x483687;})[_0xc737('0x21')](respondWithFilteredResult(_0x4563ed,_0x3fe25f))['catch'](handleError(_0x4563ed,null));};exports[_0xc737('0x43')]=function(_0x1b503a,_0x13c950){var _0x173745={'raw':![],'where':{'id':_0x1b503a['params']['id']}},_0x3e22a9={};_0x3e22a9['model']=_['keys'](db[_0xc737('0x3e')][_0xc737('0x28')]);_0x3e22a9[_0xc737('0x2e')]=_[_0xc737('0x2d')](_0x1b503a[_0xc737('0x2e')]);_0x3e22a9[_0xc737('0x2f')]=_[_0xc737('0x31')](_0x3e22a9['model'],_0x3e22a9[_0xc737('0x2e')]);_0x173745[_0xc737('0x30')]=_[_0xc737('0x31')](_0x3e22a9['model'],qs[_0xc737('0x32')](_0x1b503a['query']['fields']));_0x173745['attributes']=_0x173745[_0xc737('0x30')][_0xc737('0x33')]?_0x173745[_0xc737('0x30')]:_0x3e22a9[_0xc737('0x2c')];if(_0x1b503a[_0xc737('0x2e')][_0xc737('0x3f')]){_0x173745[_0xc737('0x40')]=[{'all':!![]}];}_0x173745=_[_0xc737('0x3a')]({},_0x173745,_0x1b503a['options']);return db[_0xc737('0x3e')][_0xc737('0x44')](_0x173745)[_0xc737('0x21')](handleEntityNotFound(_0x13c950,null))['then'](respondWithResult(_0x13c950,null))[_0xc737('0x45')](handleError(_0x13c950,null));};exports[_0xc737('0x46')]=function(_0xdc4195,_0x2b8e83){return db[_0xc737('0x3e')]['create'](_0xdc4195[_0xc737('0x47')],{})[_0xc737('0x21')](respondWithResult(_0x2b8e83,0xc9))[_0xc737('0x45')](handleError(_0x2b8e83,null));};exports['update']=function(_0x1115c8,_0xab9a28){if(_0x1115c8[_0xc737('0x47')]['id']){delete _0x1115c8[_0xc737('0x47')]['id'];}return db[_0xc737('0x3e')][_0xc737('0x44')]({'where':{'id':_0x1115c8['params']['id']}})['then'](handleEntityNotFound(_0xab9a28,null))[_0xc737('0x21')](saveUpdates(_0x1115c8[_0xc737('0x47')],null))[_0xc737('0x21')](respondWithResult(_0xab9a28,null))[_0xc737('0x45')](handleError(_0xab9a28,null));};exports[_0xc737('0x48')]=function(_0x5da7ef,_0x2e644a){return db['IntegrationReport'][_0xc737('0x44')]({'where':{'id':_0x5da7ef[_0xc737('0x49')]['id']}})[_0xc737('0x21')](handleEntityNotFound(_0x2e644a,null))[_0xc737('0x21')](removeEntity(_0x2e644a,null))[_0xc737('0x45')](handleError(_0x2e644a,null));};exports[_0xc737('0x4a')]=function(_0x2fa7b6,_0x3c7649){return db['IntegrationReport'][_0xc737('0x4a')]()['then'](respondWithResult(_0x3c7649,null))['catch'](handleError(_0x3c7649,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 4aef774..5338bb8 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 _0xbdc5=['define','IntegrationReport','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes'];(function(_0x33793a,_0x515635){var _0x242389=function(_0x11f5aa){while(--_0x11f5aa){_0x33793a['push'](_0x33793a['shift']());}};_0x242389(++_0x515635);}(_0xbdc5,0x84));var _0x5bdc=function(_0x56ba31,_0x3101e9){_0x56ba31=_0x56ba31-0x0;var _0x57a1e6=_0xbdc5[_0x56ba31];return _0x57a1e6;};'use strict';var _=require('lodash');var util=require(_0x5bdc('0x0'));var logger=require(_0x5bdc('0x1'))(_0x5bdc('0x2'));var moment=require('moment');var BPromise=require(_0x5bdc('0x3'));var rp=require(_0x5bdc('0x4'));var fs=require('fs');var path=require(_0x5bdc('0x5'));var rimraf=require('rimraf');var config=require(_0x5bdc('0x6'));var attributes=require(_0x5bdc('0x7'));module['exports']=function(_0x3e2eeb,_0x180d6c){return _0x3e2eeb[_0x5bdc('0x8')](_0x5bdc('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x390d=['define','report_integration','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x390d,0x188));var _0xd390=function(_0x70fca0,_0x13e939){_0x70fca0=_0x70fca0-0x0;var _0x25d265=_0x390d[_0x70fca0];return _0x25d265;};'use strict';var _=require(_0xd390('0x0'));var util=require('util');var logger=require(_0xd390('0x1'))(_0xd390('0x2'));var moment=require(_0xd390('0x3'));var BPromise=require('bluebird');var rp=require(_0xd390('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd390('0x5'));var config=require(_0xd390('0x6'));var attributes=require(_0xd390('0x7'));module['exports']=function(_0x2a6c16,_0x29d416){return _0x2a6c16[_0xd390('0x8')]('IntegrationReport',attributes,{'tableName':_0xd390('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 8a713ed..e414349 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x0b0e[_0x28509b];return _0x1e0b6;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0xb7e7=['IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x340010,_0x3aecdd){var _0x59be2a=function(_0x2c6704){while(--_0x2c6704){_0x340010['push'](_0x340010['shift']());}};_0x59be2a(++_0x3aecdd);}(_0xb7e7,0x121));var _0x7b7e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xb7e7[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 8004f2c..ed9be1d 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xe9507b,_0x23020a){var _0x1640d1=function(_0xf73429){while(--_0xf73429){_0xe9507b['push'](_0xe9507b['shift']());}};_0x1640d1(++_0x23020a);}(_0x34e8,0x12c));var _0x834e=function(_0x3f380c,_0x2f6036){_0x3f380c=_0x3f380c-0x0;var _0x11ca1b=_0x34e8[_0x3f380c];return _0x11ca1b;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x55ca,0x126));var _0xa55c=function(_0x44caf2,_0x8ffb16){_0x44caf2=_0x44caf2-0x0;var _0x25978d=_0x55ca[_0x44caf2];return _0x25978d;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 42a57b6..80d0f44 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 _0xee7d=['exports','STRING','sequelize'];(function(_0x4b7280,_0x504af7){var _0x3f3590=function(_0x219d08){while(--_0x219d08){_0x4b7280['push'](_0x4b7280['shift']());}};_0x3f3590(++_0x504af7);}(_0xee7d,0x149));var _0xdee7=function(_0x66adbd,_0xa70710){_0x66adbd=_0x66adbd-0x0;var _0xcf294f=_0xee7d[_0x66adbd];return _0xcf294f;};'use strict';var Sequelize=require(_0xdee7('0x0'));module[_0xdee7('0x1')]={'name':{'type':Sequelize[_0xdee7('0x2')]},'description':{'type':Sequelize[_0xdee7('0x2')]},'interval':{'type':Sequelize[_0xdee7('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x26be=['STRING'];(function(_0x456759,_0x51bd2f){var _0x3f9662=function(_0xc0d965){while(--_0xc0d965){_0x456759['push'](_0x456759['shift']());}};_0x3f9662(++_0x51bd2f);}(_0x26be,0x104));var _0xe26b=function(_0x4184da,_0x5c5a9b){_0x4184da=_0x4184da-0x0;var _0x5b3c97=_0x26be[_0x4184da];return _0x5b3c97;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe26b('0x0')]},'description':{'type':Sequelize[_0xe26b('0x0')]},'interval':{'type':Sequelize[_0xe26b('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index b46809a..d0b7115 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 _0x40fd=['userProfileId','autoAssociation','body','addInterval','IntervalId','getIntervals','findOne','length','transaction','bulkCreate','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','filters','pick','merge','where','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x516ad1,_0x5993c6){var _0x4ae562=function(_0xa722a2){while(--_0xa722a2){_0x516ad1['push'](_0x516ad1['shift']());}};_0x4ae562(++_0x5993c6);}(_0x40fd,0x1c2));var _0xd40f=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x40fd[_0x20a68a];return _0x56c5d4;};'use strict';var pdf=require(_0xd40f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd40f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd40f('0x2'));var rp=require(_0xd40f('0x3'));var moment=require(_0xd40f('0x4'));var BPromise=require(_0xd40f('0x5'));var Mustache=require('mustache');var util=require(_0xd40f('0x6'));var path=require(_0xd40f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd40f('0x8'));var fs=require('fs');var _=require(_0xd40f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd40f('0xa'));var deskjs=require(_0xd40f('0xb'));var toCsv=require(_0xd40f('0xc'));var querystring=require('querystring');var Papa=require(_0xd40f('0xd'));var Redis=require(_0xd40f('0xe'));var authService=require(_0xd40f('0xf'));var qs=require(_0xd40f('0x10'));var as=require(_0xd40f('0x11'));var hardwareService=require(_0xd40f('0x12'));var logger=require('../../config/logger')(_0xd40f('0x13'));var utils=require('../../config/utils');var config=require(_0xd40f('0x14'));var db=require(_0xd40f('0x15'))['db'];var extensions=require(_0xd40f('0x16'));function respondWithStatusCode(_0x539cd5,_0xdc02cc){_0xdc02cc=_0xdc02cc||0xcc;return function(_0x3b5ab6){if(_0x3b5ab6){return _0x539cd5[_0xd40f('0x17')](_0xdc02cc);}return _0x539cd5['status'](_0xdc02cc)[_0xd40f('0x18')]();};}function respondWithResult(_0xf1acb5,_0x35c2c1){_0x35c2c1=_0x35c2c1||0xc8;return function(_0x4ec8fa){if(_0x4ec8fa){return _0xf1acb5[_0xd40f('0x19')](_0x35c2c1)[_0xd40f('0x1a')](_0x4ec8fa);}};}function respondWithFilteredResult(_0x519c1d,_0xac0f13){return function(_0x261ce3){if(_0x261ce3){var _0x1c18aa=_0x261ce3[_0xd40f('0x1b')],_0x2937f7=_0xac0f13[_0xd40f('0x1c')],_0x418d45=_0xac0f13[_0xd40f('0x1c')]+_0xac0f13['limit'],_0x1178aa;if(_0x418d45>=_0x1c18aa){_0x418d45=_0x1c18aa;_0x1178aa=0xc8;}else{_0x1178aa=0xce;}_0x519c1d[_0xd40f('0x19')](_0x1178aa);return _0x519c1d[_0xd40f('0x1d')](_0xd40f('0x1e'),_0x2937f7+'-'+_0x418d45+'/'+_0x1c18aa)[_0xd40f('0x1a')](_0x261ce3);}return null;};}function patchUpdates(_0x2e2079){return function(_0x131408){try{jsonpatch['apply'](_0x131408,_0x2e2079,!![]);}catch(_0x3e5f18){return BPromise[_0xd40f('0x1f')](_0x3e5f18);}return _0x131408[_0xd40f('0x20')]();};}function saveUpdates(_0x1c4a50,_0x30ff0d){return function(_0x530446){if(_0x530446){return _0x530446[_0xd40f('0x21')](_0x1c4a50)[_0xd40f('0x22')](function(_0x1781f4){return _0x1781f4;});}return null;};}function removeEntity(_0x4628ae,_0x26a1d8){return function(_0x37d341){if(_0x37d341){return _0x37d341[_0xd40f('0x23')]()[_0xd40f('0x22')](function(){var _0x47ede2=_0x37d341[_0xd40f('0x24')]({'plain':!![]});var _0x2f4234=_0xd40f('0x25');return db[_0xd40f('0x26')][_0xd40f('0x23')]({'where':{'type':_0x2f4234,'resourceId':_0x47ede2['id']}})[_0xd40f('0x22')](function(){return _0x37d341;});})[_0xd40f('0x22')](function(){_0x4628ae[_0xd40f('0x19')](0xcc)[_0xd40f('0x18')]();});}};}function handleEntityNotFound(_0x45409e,_0x3587b4){return function(_0x518756){if(!_0x518756){_0x45409e[_0xd40f('0x17')](0x194);}return _0x518756;};}function handleError(_0x12db38,_0x33fac3){_0x33fac3=_0x33fac3||0x1f4;return function(_0x391bbd){logger['error'](_0x391bbd[_0xd40f('0x27')]);if(_0x391bbd[_0xd40f('0x28')]){delete _0x391bbd[_0xd40f('0x28')];}_0x12db38[_0xd40f('0x19')](_0x33fac3)[_0xd40f('0x29')](_0x391bbd);};}exports[_0xd40f('0x2a')]=function(_0x10dd15,_0x473dbb){var _0x37671a={},_0x3b032e={},_0x3b7d30={'count':0x0,'rows':[]};var _0x1f7f77=_[_0xd40f('0x2b')](db[_0xd40f('0x2c')][_0xd40f('0x2d')],function(_0x8d124d){return{'name':_0x8d124d[_0xd40f('0x2e')],'type':_0x8d124d['type'][_0xd40f('0x2f')]};});_0x3b032e[_0xd40f('0x30')]=_['map'](_0x1f7f77,'name');_0x3b032e[_0xd40f('0x31')]=_[_0xd40f('0x32')](_0x10dd15[_0xd40f('0x31')]);_0x3b032e['filters']=_[_0xd40f('0x33')](_0x3b032e[_0xd40f('0x30')],_0x3b032e[_0xd40f('0x31')]);_0x37671a[_0xd40f('0x34')]=_[_0xd40f('0x33')](_0x3b032e[_0xd40f('0x30')],qs[_0xd40f('0x35')](_0x10dd15[_0xd40f('0x31')][_0xd40f('0x35')]));_0x37671a[_0xd40f('0x34')]=_0x37671a[_0xd40f('0x34')]['length']?_0x37671a['attributes']:_0x3b032e[_0xd40f('0x30')];if(!_0x10dd15['query'][_0xd40f('0x36')]('nolimit')){_0x37671a['limit']=qs[_0xd40f('0x37')](_0x10dd15[_0xd40f('0x31')]['limit']);_0x37671a[_0xd40f('0x1c')]=qs[_0xd40f('0x1c')](_0x10dd15[_0xd40f('0x31')][_0xd40f('0x1c')]);}_0x37671a[_0xd40f('0x38')]=qs[_0xd40f('0x39')](_0x10dd15[_0xd40f('0x31')][_0xd40f('0x39')]);_0x37671a['where']=qs[_0xd40f('0x3a')](_[_0xd40f('0x3b')](_0x10dd15[_0xd40f('0x31')],_0x3b032e[_0xd40f('0x3a')]),_0x1f7f77);if(_0x10dd15[_0xd40f('0x31')]['filter']){_0x37671a['where']=_[_0xd40f('0x3c')](_0x37671a[_0xd40f('0x3d')],{'$or':_[_0xd40f('0x2b')](_0x1f7f77,function(_0x3f3920){if(_0x3f3920[_0xd40f('0x3e')]!==_0xd40f('0x3f')){var _0x56ef0a={};_0x56ef0a[_0x3f3920[_0xd40f('0x28')]]={'$like':'%'+_0x10dd15[_0xd40f('0x31')][_0xd40f('0x40')]+'%'};return _0x56ef0a;}})});}_0x37671a=_[_0xd40f('0x3c')]({},_0x37671a,_0x10dd15[_0xd40f('0x41')]);var _0xbdca22={'where':_0x37671a[_0xd40f('0x3d')]};return db[_0xd40f('0x2c')][_0xd40f('0x1b')](_0xbdca22)[_0xd40f('0x22')](function(_0xa2a623){_0x3b7d30[_0xd40f('0x1b')]=_0xa2a623;if(_0x10dd15[_0xd40f('0x31')]['includeAll']){_0x37671a[_0xd40f('0x42')]=[{'all':!![]}];}return db[_0xd40f('0x2c')][_0xd40f('0x43')](_0x37671a);})[_0xd40f('0x22')](function(_0x1b67d6){_0x3b7d30[_0xd40f('0x44')]=_0x1b67d6;return _0x3b7d30;})[_0xd40f('0x22')](respondWithFilteredResult(_0x473dbb,_0x37671a))[_0xd40f('0x45')](handleError(_0x473dbb,null));};exports[_0xd40f('0x46')]=function(_0xdd52e2,_0x41f370){var _0x30f633={'raw':!![],'where':{'id':_0xdd52e2[_0xd40f('0x47')]['id']}},_0x24cc4c={};_0x24cc4c[_0xd40f('0x30')]=_[_0xd40f('0x32')](db['Interval'][_0xd40f('0x2d')]);_0x24cc4c[_0xd40f('0x31')]=_[_0xd40f('0x32')](_0xdd52e2[_0xd40f('0x31')]);_0x24cc4c[_0xd40f('0x3a')]=_[_0xd40f('0x33')](_0x24cc4c['model'],_0x24cc4c[_0xd40f('0x31')]);_0x30f633[_0xd40f('0x34')]=_[_0xd40f('0x33')](_0x24cc4c['model'],qs[_0xd40f('0x35')](_0xdd52e2[_0xd40f('0x31')]['fields']));_0x30f633[_0xd40f('0x34')]=_0x30f633[_0xd40f('0x34')]['length']?_0x30f633[_0xd40f('0x34')]:_0x24cc4c['model'];if(_0xdd52e2[_0xd40f('0x31')][_0xd40f('0x48')]){_0x30f633[_0xd40f('0x42')]=[{'all':!![]}];}_0x30f633=_[_0xd40f('0x3c')]({},_0x30f633,_0xdd52e2[_0xd40f('0x41')]);return db[_0xd40f('0x2c')][_0xd40f('0x49')](_0x30f633)[_0xd40f('0x22')](handleEntityNotFound(_0x41f370,null))[_0xd40f('0x22')](respondWithResult(_0x41f370,null))['catch'](handleError(_0x41f370,null));};exports[_0xd40f('0x4a')]=function(_0x1ad1b3,_0x27432f){return db[_0xd40f('0x2c')][_0xd40f('0x4a')](_0x1ad1b3['body'],{})[_0xd40f('0x22')](function(_0x26406b){var _0x3e8ba1=_0x1ad1b3[_0xd40f('0x4b')]['get']({'plain':!![]});if(!_0x3e8ba1)throw new Error(_0xd40f('0x4c'));if(_0x3e8ba1[_0xd40f('0x4d')]===_0xd40f('0x4b')){var _0x49fb33=_0x26406b['get']({'plain':!![]});var _0x5e0e50='Intervals';return db['UserProfileSection'][_0xd40f('0x49')]({'where':{'name':_0x5e0e50,'userProfileId':_0x3e8ba1[_0xd40f('0x4e')]},'raw':!![]})[_0xd40f('0x22')](function(_0x3ac75a){if(_0x3ac75a&&_0x3ac75a[_0xd40f('0x4f')]===0x0){return db[_0xd40f('0x26')][_0xd40f('0x4a')]({'name':_0x49fb33[_0xd40f('0x28')],'resourceId':_0x49fb33['id'],'type':_0x3ac75a[_0xd40f('0x28')],'sectionId':_0x3ac75a['id']},{})[_0xd40f('0x22')](function(){return _0x26406b;});}else{return _0x26406b;}})[_0xd40f('0x45')](function(_0x1fe8d5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fe8d5);throw _0x1fe8d5;});}return _0x26406b;})[_0xd40f('0x22')](respondWithResult(_0x27432f,0xc9))['catch'](handleError(_0x27432f,null));};exports[_0xd40f('0x21')]=function(_0x374e27,_0x33f563){if(_0x374e27[_0xd40f('0x50')]['id']){delete _0x374e27[_0xd40f('0x50')]['id'];}return db[_0xd40f('0x2c')]['find']({'where':{'id':_0x374e27['params']['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x33f563,null))[_0xd40f('0x22')](saveUpdates(_0x374e27[_0xd40f('0x50')],null))[_0xd40f('0x22')](respondWithResult(_0x33f563,null))[_0xd40f('0x45')](handleError(_0x33f563,null));};exports[_0xd40f('0x23')]=function(_0x1dd846,_0x4d52c3){return db['Interval']['find']({'where':{'id':_0x1dd846[_0xd40f('0x47')]['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x4d52c3,null))[_0xd40f('0x22')](removeEntity(_0x4d52c3,null))['catch'](handleError(_0x4d52c3,null));};exports[_0xd40f('0x51')]=function(_0x724089,_0x1fffa5,_0x3a22ee){if(_0x724089['body']['id']){delete _0x724089['body']['id'];}return db[_0xd40f('0x2c')]['find']({'where':{'id':_0x724089['params']['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x1fffa5,null))['then'](function(_0x1a0bcb){if(_0x1a0bcb){_0x724089[_0xd40f('0x50')][_0xd40f('0x52')]=_0x1a0bcb['id'];return db['Interval'][_0xd40f('0x4a')](_0x724089[_0xd40f('0x50')]);}})[_0xd40f('0x22')](respondWithResult(_0x1fffa5,null))['catch'](handleError(_0x1fffa5,null));};exports[_0xd40f('0x53')]=function(_0x354764,_0x34964,_0x5dd2dd){var _0x4427f4={};var _0x4845e1={};var _0x24b3e5;var _0x35c4e4;return db[_0xd40f('0x2c')][_0xd40f('0x54')]({'where':{'id':_0x354764['params']['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x34964,null))[_0xd40f('0x22')](function(_0x17c9d5){if(_0x17c9d5){_0x24b3e5=_0x17c9d5;_0x4845e1[_0xd40f('0x30')]=_['keys'](db[_0xd40f('0x2c')]['rawAttributes']);_0x4845e1[_0xd40f('0x31')]=_[_0xd40f('0x32')](_0x354764[_0xd40f('0x31')]);_0x4845e1[_0xd40f('0x3a')]=_[_0xd40f('0x33')](_0x4845e1[_0xd40f('0x30')],_0x4845e1[_0xd40f('0x31')]);_0x4427f4[_0xd40f('0x34')]=_[_0xd40f('0x33')](_0x4845e1[_0xd40f('0x30')],qs[_0xd40f('0x35')](_0x354764[_0xd40f('0x31')]['fields']));_0x4427f4[_0xd40f('0x34')]=_0x4427f4[_0xd40f('0x34')][_0xd40f('0x55')]?_0x4427f4['attributes']:_0x4845e1[_0xd40f('0x30')];_0x4427f4[_0xd40f('0x38')]=qs['sort'](_0x354764['query'][_0xd40f('0x39')]);_0x4427f4[_0xd40f('0x3d')]=qs[_0xd40f('0x3a')](_[_0xd40f('0x3b')](_0x354764[_0xd40f('0x31')],_0x4845e1[_0xd40f('0x3a')]));if(_0x354764['query']['filter']){_0x4427f4[_0xd40f('0x3d')]=_[_0xd40f('0x3c')](_0x4427f4['where'],{'$or':_['map'](_0x4427f4[_0xd40f('0x34')],function(_0x2e0212){var _0xa2d34={};_0xa2d34[_0x2e0212]={'$like':'%'+_0x354764[_0xd40f('0x31')][_0xd40f('0x40')]+'%'};return _0xa2d34;})});}_0x4427f4=_[_0xd40f('0x3c')]({},_0x4427f4,_0x354764[_0xd40f('0x41')]);return _0x24b3e5[_0xd40f('0x53')](_0x4427f4);}})[_0xd40f('0x22')](function(_0xec1e5d){if(_0xec1e5d){_0x35c4e4=_0xec1e5d[_0xd40f('0x55')];if(!_0x354764[_0xd40f('0x31')][_0xd40f('0x36')]('nolimit')){_0x4427f4[_0xd40f('0x37')]=qs[_0xd40f('0x37')](_0x354764[_0xd40f('0x31')][_0xd40f('0x37')]);_0x4427f4[_0xd40f('0x1c')]=qs['offset'](_0x354764[_0xd40f('0x31')]['offset']);}return _0x24b3e5[_0xd40f('0x53')](_0x4427f4);}})[_0xd40f('0x22')](function(_0x48ec72){if(_0x48ec72){return _0x48ec72?{'count':_0x35c4e4,'rows':_0x48ec72}:null;}})[_0xd40f('0x22')](respondWithResult(_0x34964,null))[_0xd40f('0x45')](handleError(_0x34964,null));};exports['addIntervals']=function(_0x483630,_0x4e0805,_0x5144d3){return db[_0xd40f('0x2c')][_0xd40f('0x54')]({'where':{'id':_0x483630['params']['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x4e0805,null))['then'](function(_0xb3f838){if(_0xb3f838){return db['sequelize'][_0xd40f('0x56')](function(_0x3ffcd9){return db['Interval'][_0xd40f('0x23')]({'where':{'IntervalId':_0x483630[_0xd40f('0x47')]['id']},'transaction':_0x3ffcd9})[_0xd40f('0x22')](function(_0x10f37f){var _0x5160c7=_[_0xd40f('0x2b')](_0x483630[_0xd40f('0x50')],function(_0x572e25){delete _0x572e25['id'];_0x572e25['IntervalId']=_0x483630['params']['id'];return _0x572e25;});return db[_0xd40f('0x2c')][_0xd40f('0x57')](_0x5160c7,{'transaction':_0x3ffcd9});});})['then'](function(){return db[_0xd40f('0x2c')]['findAll']({'where':{'IntervalId':_0x483630[_0xd40f('0x47')]['id']}});});}})[_0xd40f('0x22')](respondWithResult(_0x4e0805,null))[_0xd40f('0x45')](handleError(_0x4e0805,null));}; \ No newline at end of file +var _0x954c=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','IntervalId','getIntervals','findOne','filter','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','then','destroy','get','Intervals','UserProfileResource','error','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','count','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find'];(function(_0x240860,_0x20c04d){var _0x40e288=function(_0x38a753){while(--_0x38a753){_0x240860['push'](_0x240860['shift']());}};_0x40e288(++_0x20c04d);}(_0x954c,0x69));var _0xc954=function(_0x482523,_0x3063ec){_0x482523=_0x482523-0x0;var _0x4223b6=_0x954c[_0x482523];return _0x4223b6;};'use strict';var pdf=require(_0xc954('0x0'));var emlformat=require(_0xc954('0x1'));var rimraf=require(_0xc954('0x2'));var zipdir=require(_0xc954('0x3'));var jsonpatch=require(_0xc954('0x4'));var rp=require(_0xc954('0x5'));var moment=require(_0xc954('0x6'));var BPromise=require(_0xc954('0x7'));var Mustache=require('mustache');var util=require(_0xc954('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc954('0x9'));var ejs=require(_0xc954('0xa'));var fs=require('fs');var _=require(_0xc954('0xb'));var squel=require(_0xc954('0xc'));var crypto=require(_0xc954('0xd'));var jsforce=require(_0xc954('0xe'));var deskjs=require(_0xc954('0xf'));var toCsv=require(_0xc954('0x9'));var querystring=require(_0xc954('0x10'));var Papa=require('papaparse');var Redis=require(_0xc954('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc954('0x12'));var as=require(_0xc954('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc954('0x14'));var utils=require(_0xc954('0x15'));var config=require(_0xc954('0x16'));var db=require(_0xc954('0x17'))['db'];var extensions=require(_0xc954('0x18'));function respondWithStatusCode(_0x4494ba,_0x4512ab){_0x4512ab=_0x4512ab||0xcc;return function(_0x3a08f2){if(_0x3a08f2){return _0x4494ba[_0xc954('0x19')](_0x4512ab);}return _0x4494ba[_0xc954('0x1a')](_0x4512ab)[_0xc954('0x1b')]();};}function respondWithResult(_0x3d0098,_0xca60e){_0xca60e=_0xca60e||0xc8;return function(_0x4f5eea){if(_0x4f5eea){return _0x3d0098['status'](_0xca60e)['json'](_0x4f5eea);}};}function respondWithFilteredResult(_0x1c6d85,_0x52d41b){return function(_0x240ef0){if(_0x240ef0){var _0x4338fd=_0x240ef0['count'],_0x5cc9a1=_0x52d41b[_0xc954('0x1c')],_0x5ceb4f=_0x52d41b[_0xc954('0x1c')]+_0x52d41b[_0xc954('0x1d')],_0x571d2a;if(_0x5ceb4f>=_0x4338fd){_0x5ceb4f=_0x4338fd;_0x571d2a=0xc8;}else{_0x571d2a=0xce;}_0x1c6d85[_0xc954('0x1a')](_0x571d2a);return _0x1c6d85[_0xc954('0x1e')](_0xc954('0x1f'),_0x5cc9a1+'-'+_0x5ceb4f+'/'+_0x4338fd)[_0xc954('0x20')](_0x240ef0);}return null;};}function patchUpdates(_0x1c575a){return function(_0x8810f1){try{jsonpatch[_0xc954('0x21')](_0x8810f1,_0x1c575a,!![]);}catch(_0x5b453c){return BPromise['reject'](_0x5b453c);}return _0x8810f1['save']();};}function saveUpdates(_0x136188,_0x43ea9b){return function(_0x55644b){if(_0x55644b){return _0x55644b['update'](_0x136188)[_0xc954('0x22')](function(_0x103580){return _0x103580;});}return null;};}function removeEntity(_0x53acb4,_0x5f18e4){return function(_0x3fba80){if(_0x3fba80){return _0x3fba80[_0xc954('0x23')]()[_0xc954('0x22')](function(){var _0x5f4d36=_0x3fba80[_0xc954('0x24')]({'plain':!![]});var _0x4cd498=_0xc954('0x25');return db[_0xc954('0x26')]['destroy']({'where':{'type':_0x4cd498,'resourceId':_0x5f4d36['id']}})[_0xc954('0x22')](function(){return _0x3fba80;});})['then'](function(){_0x53acb4[_0xc954('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35af6e,_0x365dba){return function(_0x10e477){if(!_0x10e477){_0x35af6e[_0xc954('0x19')](0x194);}return _0x10e477;};}function handleError(_0x42ffb1,_0x4146b0){_0x4146b0=_0x4146b0||0x1f4;return function(_0x5b2967){logger[_0xc954('0x27')](_0x5b2967['stack']);if(_0x5b2967[_0xc954('0x28')]){delete _0x5b2967['name'];}_0x42ffb1[_0xc954('0x1a')](_0x4146b0)[_0xc954('0x29')](_0x5b2967);};}exports[_0xc954('0x2a')]=function(_0x31f070,_0x384d71){var _0x30a288={},_0x560542={},_0x5afa11={'count':0x0,'rows':[]};var _0x17ed68=_[_0xc954('0x2b')](db[_0xc954('0x2c')]['rawAttributes'],function(_0x7386e9){return{'name':_0x7386e9[_0xc954('0x2d')],'type':_0x7386e9[_0xc954('0x2e')][_0xc954('0x2f')]};});_0x560542[_0xc954('0x30')]=_[_0xc954('0x2b')](_0x17ed68,_0xc954('0x28'));_0x560542[_0xc954('0x31')]=_[_0xc954('0x32')](_0x31f070[_0xc954('0x31')]);_0x560542[_0xc954('0x33')]=_['intersection'](_0x560542[_0xc954('0x30')],_0x560542[_0xc954('0x31')]);_0x30a288['attributes']=_[_0xc954('0x34')](_0x560542['model'],qs[_0xc954('0x35')](_0x31f070[_0xc954('0x31')][_0xc954('0x35')]));_0x30a288[_0xc954('0x36')]=_0x30a288[_0xc954('0x36')][_0xc954('0x37')]?_0x30a288[_0xc954('0x36')]:_0x560542[_0xc954('0x30')];if(!_0x31f070[_0xc954('0x31')][_0xc954('0x38')](_0xc954('0x39'))){_0x30a288['limit']=qs['limit'](_0x31f070[_0xc954('0x31')][_0xc954('0x1d')]);_0x30a288[_0xc954('0x1c')]=qs[_0xc954('0x1c')](_0x31f070[_0xc954('0x31')][_0xc954('0x1c')]);}_0x30a288[_0xc954('0x3a')]=qs[_0xc954('0x3b')](_0x31f070[_0xc954('0x31')][_0xc954('0x3b')]);_0x30a288[_0xc954('0x3c')]=qs[_0xc954('0x33')](_[_0xc954('0x3d')](_0x31f070[_0xc954('0x31')],_0x560542[_0xc954('0x33')]),_0x17ed68);if(_0x31f070[_0xc954('0x31')]['filter']){_0x30a288[_0xc954('0x3c')]=_['merge'](_0x30a288['where'],{'$or':_[_0xc954('0x2b')](_0x17ed68,function(_0x400150){if(_0x400150[_0xc954('0x2e')]!==_0xc954('0x3e')){var _0x125fd8={};_0x125fd8[_0x400150[_0xc954('0x28')]]={'$like':'%'+_0x31f070[_0xc954('0x31')]['filter']+'%'};return _0x125fd8;}})});}_0x30a288=_[_0xc954('0x3f')]({},_0x30a288,_0x31f070[_0xc954('0x40')]);var _0x5c8eda={'where':_0x30a288[_0xc954('0x3c')]};return db[_0xc954('0x2c')][_0xc954('0x41')](_0x5c8eda)[_0xc954('0x22')](function(_0x1d34ca){_0x5afa11[_0xc954('0x41')]=_0x1d34ca;if(_0x31f070[_0xc954('0x31')]['includeAll']){_0x30a288['include']=[{'all':!![]}];}return db[_0xc954('0x2c')][_0xc954('0x42')](_0x30a288);})['then'](function(_0x429b06){_0x5afa11[_0xc954('0x43')]=_0x429b06;return _0x5afa11;})[_0xc954('0x22')](respondWithFilteredResult(_0x384d71,_0x30a288))[_0xc954('0x44')](handleError(_0x384d71,null));};exports[_0xc954('0x45')]=function(_0xe817a0,_0x39de10){var _0x19edc7={'raw':!![],'where':{'id':_0xe817a0[_0xc954('0x46')]['id']}},_0x30768f={};_0x30768f[_0xc954('0x30')]=_[_0xc954('0x32')](db[_0xc954('0x2c')][_0xc954('0x47')]);_0x30768f[_0xc954('0x31')]=_[_0xc954('0x32')](_0xe817a0[_0xc954('0x31')]);_0x30768f[_0xc954('0x33')]=_['intersection'](_0x30768f[_0xc954('0x30')],_0x30768f[_0xc954('0x31')]);_0x19edc7[_0xc954('0x36')]=_['intersection'](_0x30768f[_0xc954('0x30')],qs['fields'](_0xe817a0[_0xc954('0x31')]['fields']));_0x19edc7[_0xc954('0x36')]=_0x19edc7['attributes'][_0xc954('0x37')]?_0x19edc7[_0xc954('0x36')]:_0x30768f[_0xc954('0x30')];if(_0xe817a0[_0xc954('0x31')][_0xc954('0x48')]){_0x19edc7[_0xc954('0x49')]=[{'all':!![]}];}_0x19edc7=_['merge']({},_0x19edc7,_0xe817a0[_0xc954('0x40')]);return db['Interval'][_0xc954('0x4a')](_0x19edc7)[_0xc954('0x22')](handleEntityNotFound(_0x39de10,null))['then'](respondWithResult(_0x39de10,null))[_0xc954('0x44')](handleError(_0x39de10,null));};exports['create']=function(_0x4e75e5,_0x52cb21){return db[_0xc954('0x2c')][_0xc954('0x4b')](_0x4e75e5[_0xc954('0x4c')],{})[_0xc954('0x22')](function(_0xa8189b){var _0xaccda6=_0x4e75e5['user']['get']({'plain':!![]});if(!_0xaccda6)throw new Error(_0xc954('0x4d'));if(_0xaccda6[_0xc954('0x4e')]==='user'){var _0x184549=_0xa8189b['get']({'plain':!![]});var _0xf85ad=_0xc954('0x25');return db[_0xc954('0x4f')][_0xc954('0x4a')]({'where':{'name':_0xf85ad,'userProfileId':_0xaccda6[_0xc954('0x50')]},'raw':!![]})[_0xc954('0x22')](function(_0x4caf17){if(_0x4caf17&&_0x4caf17[_0xc954('0x51')]===0x0){return db[_0xc954('0x26')][_0xc954('0x4b')]({'name':_0x184549['name'],'resourceId':_0x184549['id'],'type':_0x4caf17[_0xc954('0x28')],'sectionId':_0x4caf17['id']},{})[_0xc954('0x22')](function(){return _0xa8189b;});}else{return _0xa8189b;}})[_0xc954('0x44')](function(_0x36f5d7){logger[_0xc954('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36f5d7);throw _0x36f5d7;});}return _0xa8189b;})['then'](respondWithResult(_0x52cb21,0xc9))[_0xc954('0x44')](handleError(_0x52cb21,null));};exports[_0xc954('0x52')]=function(_0x5283ce,_0x275762){if(_0x5283ce[_0xc954('0x4c')]['id']){delete _0x5283ce[_0xc954('0x4c')]['id'];}return db[_0xc954('0x2c')][_0xc954('0x4a')]({'where':{'id':_0x5283ce['params']['id']}})[_0xc954('0x22')](handleEntityNotFound(_0x275762,null))['then'](saveUpdates(_0x5283ce[_0xc954('0x4c')],null))[_0xc954('0x22')](respondWithResult(_0x275762,null))[_0xc954('0x44')](handleError(_0x275762,null));};exports['destroy']=function(_0x416921,_0x13e063){return db[_0xc954('0x2c')]['find']({'where':{'id':_0x416921[_0xc954('0x46')]['id']}})['then'](handleEntityNotFound(_0x13e063,null))['then'](removeEntity(_0x13e063,null))[_0xc954('0x44')](handleError(_0x13e063,null));};exports['addInterval']=function(_0x43749d,_0x5488f6,_0x13d560){if(_0x43749d[_0xc954('0x4c')]['id']){delete _0x43749d[_0xc954('0x4c')]['id'];}return db['Interval'][_0xc954('0x4a')]({'where':{'id':_0x43749d[_0xc954('0x46')]['id']}})['then'](handleEntityNotFound(_0x5488f6,null))[_0xc954('0x22')](function(_0x3f239c){if(_0x3f239c){_0x43749d['body'][_0xc954('0x53')]=_0x3f239c['id'];return db[_0xc954('0x2c')][_0xc954('0x4b')](_0x43749d[_0xc954('0x4c')]);}})[_0xc954('0x22')](respondWithResult(_0x5488f6,null))[_0xc954('0x44')](handleError(_0x5488f6,null));};exports[_0xc954('0x54')]=function(_0x4d1e3a,_0x4c7bc8,_0x54af40){var _0x9183c1={};var _0x5e36b0={};var _0x15dadf;var _0x4c22f2;return db[_0xc954('0x2c')][_0xc954('0x55')]({'where':{'id':_0x4d1e3a[_0xc954('0x46')]['id']}})[_0xc954('0x22')](handleEntityNotFound(_0x4c7bc8,null))[_0xc954('0x22')](function(_0x59ec96){if(_0x59ec96){_0x15dadf=_0x59ec96;_0x5e36b0[_0xc954('0x30')]=_[_0xc954('0x32')](db[_0xc954('0x2c')][_0xc954('0x47')]);_0x5e36b0[_0xc954('0x31')]=_[_0xc954('0x32')](_0x4d1e3a[_0xc954('0x31')]);_0x5e36b0['filters']=_[_0xc954('0x34')](_0x5e36b0[_0xc954('0x30')],_0x5e36b0[_0xc954('0x31')]);_0x9183c1[_0xc954('0x36')]=_[_0xc954('0x34')](_0x5e36b0[_0xc954('0x30')],qs['fields'](_0x4d1e3a['query']['fields']));_0x9183c1[_0xc954('0x36')]=_0x9183c1['attributes']['length']?_0x9183c1[_0xc954('0x36')]:_0x5e36b0[_0xc954('0x30')];_0x9183c1['order']=qs[_0xc954('0x3b')](_0x4d1e3a['query'][_0xc954('0x3b')]);_0x9183c1[_0xc954('0x3c')]=qs[_0xc954('0x33')](_[_0xc954('0x3d')](_0x4d1e3a['query'],_0x5e36b0['filters']));if(_0x4d1e3a[_0xc954('0x31')][_0xc954('0x56')]){_0x9183c1[_0xc954('0x3c')]=_['merge'](_0x9183c1[_0xc954('0x3c')],{'$or':_[_0xc954('0x2b')](_0x9183c1[_0xc954('0x36')],function(_0x3e29ad){var _0x1a4e2b={};_0x1a4e2b[_0x3e29ad]={'$like':'%'+_0x4d1e3a[_0xc954('0x31')][_0xc954('0x56')]+'%'};return _0x1a4e2b;})});}_0x9183c1=_[_0xc954('0x3f')]({},_0x9183c1,_0x4d1e3a[_0xc954('0x40')]);return _0x15dadf[_0xc954('0x54')](_0x9183c1);}})[_0xc954('0x22')](function(_0x5dd627){if(_0x5dd627){_0x4c22f2=_0x5dd627['length'];if(!_0x4d1e3a[_0xc954('0x31')][_0xc954('0x38')]('nolimit')){_0x9183c1['limit']=qs[_0xc954('0x1d')](_0x4d1e3a['query'][_0xc954('0x1d')]);_0x9183c1['offset']=qs[_0xc954('0x1c')](_0x4d1e3a[_0xc954('0x31')]['offset']);}return _0x15dadf[_0xc954('0x54')](_0x9183c1);}})[_0xc954('0x22')](function(_0x361ee6){if(_0x361ee6){return _0x361ee6?{'count':_0x4c22f2,'rows':_0x361ee6}:null;}})[_0xc954('0x22')](respondWithResult(_0x4c7bc8,null))[_0xc954('0x44')](handleError(_0x4c7bc8,null));};exports['addIntervals']=function(_0x566798,_0x146621,_0x17a594){return db[_0xc954('0x2c')]['findOne']({'where':{'id':_0x566798[_0xc954('0x46')]['id']}})[_0xc954('0x22')](handleEntityNotFound(_0x146621,null))['then'](function(_0x283455){if(_0x283455){return db[_0xc954('0x57')][_0xc954('0x58')](function(_0xa423e1){return db[_0xc954('0x2c')][_0xc954('0x23')]({'where':{'IntervalId':_0x566798[_0xc954('0x46')]['id']},'transaction':_0xa423e1})[_0xc954('0x22')](function(_0x276ca1){var _0xcd7fe=_['map'](_0x566798[_0xc954('0x4c')],function(_0x550342){delete _0x550342['id'];_0x550342[_0xc954('0x53')]=_0x566798[_0xc954('0x46')]['id'];return _0x550342;});return db[_0xc954('0x2c')][_0xc954('0x59')](_0xcd7fe,{'transaction':_0xa423e1});});})[_0xc954('0x22')](function(){return db[_0xc954('0x2c')][_0xc954('0x42')]({'where':{'IntervalId':_0x566798[_0xc954('0x46')]['id']}});});}})['then'](respondWithResult(_0x146621,null))['catch'](handleError(_0x146621,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2425071..03f2c5e 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 _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','../../config/logger'];(function(_0x44498d,_0x189bf3){var _0x1e640a=function(_0xc30f0d){while(--_0xc30f0d){_0x44498d['push'](_0x44498d['shift']());}};_0x1e640a(++_0x189bf3);}(_0x0427,0x137));var _0x7042=function(_0x5aef19,_0x3e9c54){_0x5aef19=_0x5aef19-0x0;var _0x31d0bb=_0x0427[_0x5aef19];return _0x31d0bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rp=require(_0x7042('0x3'));var fs=require('fs');var path=require(_0x7042('0x4'));var rimraf=require(_0x7042('0x5'));var config=require(_0x7042('0x6'));var attributes=require(_0x7042('0x7'));var extensions=require(_0x7042('0x8'));module['exports']=function(_0x37a35b,_0x2f24b5){return _0x37a35b[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x978169,_0x40caa9){extensions[_0x7042('0xc')](_0x37a35b,_0x978169);},'afterBulkCreate':function(_0x3bd534,_0x5a29aa,_0x326210){_0x326210();extensions['rewrite'](_0x37a35b,_0x3bd534[0x0]);},'afterUpdate':function(_0x5cf853,_0x50eefb){extensions['rewrite'](_0x37a35b,_0x5cf853);},'afterDestroy':function(_0x2809a9,_0x5636e8){extensions[_0x7042('0xc')](_0x37a35b,_0x2809a9);}}});}; \ No newline at end of file +var _0x95af=['rimraf','../../config/environment','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x26c26c,_0x39f9cf){var _0x153b04=function(_0x57aa87){while(--_0x57aa87){_0x26c26c['push'](_0x26c26c['shift']());}};_0x153b04(++_0x39f9cf);}(_0x95af,0x173));var _0xf95a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x95af[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xf95a('0x0'));var util=require(_0xf95a('0x1'));var logger=require('../../config/logger')(_0xf95a('0x2'));var moment=require(_0xf95a('0x3'));var BPromise=require(_0xf95a('0x4'));var rp=require(_0xf95a('0x5'));var fs=require('fs');var path=require(_0xf95a('0x6'));var rimraf=require(_0xf95a('0x7'));var config=require(_0xf95a('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0xf95a('0x9'));module['exports']=function(_0xaa15ba,_0x576610){return _0xaa15ba[_0xf95a('0xa')](_0xf95a('0xb'),attributes,{'tableName':_0xf95a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x48d314,_0x474d95){extensions[_0xf95a('0xd')](_0xaa15ba,_0x48d314);},'afterBulkCreate':function(_0x5afd05,_0x1e5aa3,_0x49656e){_0x49656e();extensions[_0xf95a('0xd')](_0xaa15ba,_0x5afd05[0x0]);},'afterUpdate':function(_0x1058b6,_0x2a24bd){extensions[_0xf95a('0xd')](_0xaa15ba,_0x1058b6);},'afterDestroy':function(_0x442f20,_0xf221e4){extensions[_0xf95a('0xd')](_0xaa15ba,_0x442f20);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 3b6e25a..3357569 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 _0x449e=['raw','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetInterval','findAll','options','where','attributes','limit','include','model','map','catch','ShowInterval','Interval'];(function(_0x5424db,_0x2abeb0){var _0xe4ad2e=function(_0xcec037){while(--_0xcec037){_0x5424db['push'](_0x5424db['shift']());}};_0xe4ad2e(++_0x2abeb0);}(_0x449e,0x67));var _0xe449=function(_0xadd0d2,_0x3bf5b9){_0xadd0d2=_0xadd0d2-0x0;var _0x2d564c=_0x449e[_0xadd0d2];return _0x2d564c;};'use strict';var _=require('lodash');var util=require(_0xe449('0x0'));var moment=require('moment');var BPromise=require(_0xe449('0x1'));var rs=require(_0xe449('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe449('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe449('0x4'))(_0xe449('0x5'));var config=require(_0xe449('0x6'));var jayson=require(_0xe449('0x7'));var client=jayson[_0xe449('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x438d33,_0x410bd7,_0x10531a){return new BPromise(function(_0x2e9a97,_0x5372e6){return client[_0xe449('0x9')](_0x438d33,_0x10531a)[_0xe449('0xa')](function(_0x48f591){logger[_0xe449('0xb')](_0xe449('0xc'),_0x410bd7,'request\x20sent');logger[_0xe449('0xd')](_0xe449('0xe'),_0x410bd7,'request\x20sent',JSON[_0xe449('0xf')](_0x48f591));if(_0x48f591['error']){if(_0x48f591[_0xe449('0x10')][_0xe449('0x11')]===0x1f4){logger[_0xe449('0x10')](_0xe449('0xc'),_0x410bd7,_0x48f591[_0xe449('0x10')]['message']);return _0x5372e6(_0x48f591[_0xe449('0x10')][_0xe449('0x12')]);}logger['error'](_0xe449('0xc'),_0x410bd7,_0x48f591[_0xe449('0x10')][_0xe449('0x12')]);return _0x2e9a97(_0x48f591[_0xe449('0x10')][_0xe449('0x12')]);}else{logger[_0xe449('0xb')](_0xe449('0xc'),_0x410bd7,_0xe449('0x13'));_0x2e9a97(_0x48f591[_0xe449('0x14')][_0xe449('0x12')]);}})['catch'](function(_0x3e1872){logger[_0xe449('0x10')](_0xe449('0xc'),_0x410bd7,_0x3e1872);_0x5372e6(_0x3e1872);});});}exports[_0xe449('0x15')]=function(_0x1ade0b){var _0x4b6e0c=this;return new Promise(function(_0x18ec7a,_0x1f1b9a){return db['Interval'][_0xe449('0x16')]({'raw':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')][_0xe449('0x18')]||null:null,'attributes':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')][_0xe449('0x19')]||null:null,'limit':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')][_0xe449('0x1a')]||null:null,'include':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')]['include']?_['map'](_0x1ade0b[_0xe449('0x17')][_0xe449('0x1b')],function(_0x223a74){return{'model':db[_0x223a74[_0xe449('0x1c')]],'as':_0x223a74['as'],'attributes':_0x223a74[_0xe449('0x19')],'include':_0x223a74[_0xe449('0x1b')]?_[_0xe449('0x1d')](_0x223a74['include'],function(_0x1a917a){return{'model':db[_0x1a917a[_0xe449('0x1c')]],'as':_0x1a917a['as'],'attributes':_0x1a917a[_0xe449('0x19')],'include':_0x1a917a[_0xe449('0x1b')]?_['map'](_0x1a917a[_0xe449('0x1b')],function(_0x3f92e5){return{'model':db[_0x3f92e5[_0xe449('0x1c')]],'as':_0x3f92e5['as'],'attributes':_0x3f92e5[_0xe449('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bf825){logger[_0xe449('0xb')](_0xe449('0x15'),_0x1ade0b);logger[_0xe449('0xd')](_0xe449('0x15'),_0x1ade0b,JSON[_0xe449('0xf')](_0x1bf825));_0x18ec7a(_0x1bf825);})[_0xe449('0x1e')](function(_0x395edc){logger[_0xe449('0x10')](_0xe449('0x15'),_0x395edc[_0xe449('0x12')],_0x1ade0b);_0x1f1b9a(_0x4b6e0c[_0xe449('0x10')](0x1f4,_0x395edc['message']));});});};exports[_0xe449('0x1f')]=function(_0x3b7867){var _0x48017c=this;return new Promise(function(_0x59ed9d,_0x1b4f59){return db[_0xe449('0x20')]['find']({'raw':_0x3b7867[_0xe449('0x17')]?_0x3b7867[_0xe449('0x17')][_0xe449('0x21')]===undefined?!![]:![]:!![],'where':_0x3b7867[_0xe449('0x17')]?_0x3b7867[_0xe449('0x17')]['where']||null:null,'attributes':_0x3b7867['options']?_0x3b7867[_0xe449('0x17')][_0xe449('0x19')]||null:null,'include':_0x3b7867[_0xe449('0x17')]?_0x3b7867['options']['include']?_[_0xe449('0x1d')](_0x3b7867[_0xe449('0x17')][_0xe449('0x1b')],function(_0x58ab53){return{'model':db[_0x58ab53[_0xe449('0x1c')]],'as':_0x58ab53['as'],'attributes':_0x58ab53[_0xe449('0x19')],'include':_0x58ab53[_0xe449('0x1b')]?_[_0xe449('0x1d')](_0x58ab53['include'],function(_0x591e5d){return{'model':db[_0x591e5d[_0xe449('0x1c')]],'as':_0x591e5d['as'],'attributes':_0x591e5d[_0xe449('0x19')],'include':_0x591e5d[_0xe449('0x1b')]?_[_0xe449('0x1d')](_0x591e5d['include'],function(_0x507755){return{'model':db[_0x507755[_0xe449('0x1c')]],'as':_0x507755['as'],'attributes':_0x507755['attributes']};}):[]};}):[]};}):[]:[]})[_0xe449('0xa')](function(_0xcf9206){logger['info'](_0xe449('0x1f'),_0x3b7867);logger[_0xe449('0xd')](_0xe449('0x1f'),_0x3b7867,JSON[_0xe449('0xf')](_0xcf9206));_0x59ed9d(_0xcf9206);})['catch'](function(_0xd96506){logger[_0xe449('0x10')](_0xe449('0x1f'),_0xd96506[_0xe449('0x12')],_0x3b7867);_0x1b4f59(_0x48017c[_0xe449('0x10')](0x1f4,_0xd96506['message']));});});}; \ No newline at end of file +var _0x7ef9=['GetInterval','Interval','options','where','include','map','model','attributes','ShowInterval','find','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1ee16,_0xcdebe6){var _0x2cd332=function(_0x527db8){while(--_0x527db8){_0x1ee16['push'](_0x1ee16['shift']());}};_0x2cd332(++_0xcdebe6);}(_0x7ef9,0x1eb));var _0x97ef=function(_0x33b4f7,_0x16f341){_0x33b4f7=_0x33b4f7-0x0;var _0x199990=_0x7ef9[_0x33b4f7];return _0x199990;};'use strict';var _=require(_0x97ef('0x0'));var util=require(_0x97ef('0x1'));var moment=require(_0x97ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x97ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x97ef('0x5'))(_0x97ef('0x6'));var config=require(_0x97ef('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1429f2,_0x5246d7,_0x54a21e){return new BPromise(function(_0x1601ba,_0x4ae86d){return client[_0x97ef('0x8')](_0x1429f2,_0x54a21e)[_0x97ef('0x9')](function(_0x19eb52){logger[_0x97ef('0xa')](_0x97ef('0xb'),_0x5246d7,_0x97ef('0xc'));logger[_0x97ef('0xd')](_0x97ef('0xe'),_0x5246d7,_0x97ef('0xc'),JSON[_0x97ef('0xf')](_0x19eb52));if(_0x19eb52[_0x97ef('0x10')]){if(_0x19eb52[_0x97ef('0x10')]['code']===0x1f4){logger['error'](_0x97ef('0xb'),_0x5246d7,_0x19eb52['error']['message']);return _0x4ae86d(_0x19eb52['error']['message']);}logger[_0x97ef('0x10')](_0x97ef('0xb'),_0x5246d7,_0x19eb52[_0x97ef('0x10')][_0x97ef('0x11')]);return _0x1601ba(_0x19eb52[_0x97ef('0x10')][_0x97ef('0x11')]);}else{logger['info'](_0x97ef('0xb'),_0x5246d7,_0x97ef('0xc'));_0x1601ba(_0x19eb52['result'][_0x97ef('0x11')]);}})[_0x97ef('0x12')](function(_0x454c30){logger[_0x97ef('0x10')](_0x97ef('0xb'),_0x5246d7,_0x454c30);_0x4ae86d(_0x454c30);});});}exports[_0x97ef('0x13')]=function(_0x14d311){var _0x2020ef=this;return new Promise(function(_0x2c0031,_0x214ee5){return db[_0x97ef('0x14')]['findAll']({'raw':_0x14d311[_0x97ef('0x15')]?_0x14d311[_0x97ef('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x14d311[_0x97ef('0x15')]?_0x14d311[_0x97ef('0x15')][_0x97ef('0x16')]||null:null,'attributes':_0x14d311[_0x97ef('0x15')]?_0x14d311['options']['attributes']||null:null,'limit':_0x14d311[_0x97ef('0x15')]?_0x14d311[_0x97ef('0x15')]['limit']||null:null,'include':_0x14d311[_0x97ef('0x15')]?_0x14d311['options'][_0x97ef('0x17')]?_[_0x97ef('0x18')](_0x14d311['options']['include'],function(_0x4ab2a6){return{'model':db[_0x4ab2a6[_0x97ef('0x19')]],'as':_0x4ab2a6['as'],'attributes':_0x4ab2a6[_0x97ef('0x1a')],'include':_0x4ab2a6[_0x97ef('0x17')]?_['map'](_0x4ab2a6[_0x97ef('0x17')],function(_0x6fff10){return{'model':db[_0x6fff10[_0x97ef('0x19')]],'as':_0x6fff10['as'],'attributes':_0x6fff10[_0x97ef('0x1a')],'include':_0x6fff10[_0x97ef('0x17')]?_[_0x97ef('0x18')](_0x6fff10[_0x97ef('0x17')],function(_0x1a2e52){return{'model':db[_0x1a2e52[_0x97ef('0x19')]],'as':_0x1a2e52['as'],'attributes':_0x1a2e52[_0x97ef('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x97ef('0x9')](function(_0x273c1e){logger['info']('GetInterval',_0x14d311);logger[_0x97ef('0xd')](_0x97ef('0x13'),_0x14d311,JSON[_0x97ef('0xf')](_0x273c1e));_0x2c0031(_0x273c1e);})['catch'](function(_0x31b6f6){logger['error'](_0x97ef('0x13'),_0x31b6f6[_0x97ef('0x11')],_0x14d311);_0x214ee5(_0x2020ef[_0x97ef('0x10')](0x1f4,_0x31b6f6[_0x97ef('0x11')]));});});};exports[_0x97ef('0x1b')]=function(_0x1ec7e2){var _0x4f1ff0=this;return new Promise(function(_0x478935,_0x389668){return db[_0x97ef('0x14')][_0x97ef('0x1c')]({'raw':_0x1ec7e2['options']?_0x1ec7e2[_0x97ef('0x15')][_0x97ef('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ec7e2['options']?_0x1ec7e2['options'][_0x97ef('0x16')]||null:null,'attributes':_0x1ec7e2[_0x97ef('0x15')]?_0x1ec7e2['options'][_0x97ef('0x1a')]||null:null,'include':_0x1ec7e2[_0x97ef('0x15')]?_0x1ec7e2['options'][_0x97ef('0x17')]?_[_0x97ef('0x18')](_0x1ec7e2[_0x97ef('0x15')][_0x97ef('0x17')],function(_0x2cbf01){return{'model':db[_0x2cbf01[_0x97ef('0x19')]],'as':_0x2cbf01['as'],'attributes':_0x2cbf01['attributes'],'include':_0x2cbf01[_0x97ef('0x17')]?_['map'](_0x2cbf01['include'],function(_0x48ccf2){return{'model':db[_0x48ccf2['model']],'as':_0x48ccf2['as'],'attributes':_0x48ccf2[_0x97ef('0x1a')],'include':_0x48ccf2[_0x97ef('0x17')]?_[_0x97ef('0x18')](_0x48ccf2['include'],function(_0x36ee39){return{'model':db[_0x36ee39[_0x97ef('0x19')]],'as':_0x36ee39['as'],'attributes':_0x36ee39[_0x97ef('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x97ef('0x9')](function(_0x2805ee){logger['info'](_0x97ef('0x1b'),_0x1ec7e2);logger['debug']('ShowInterval',_0x1ec7e2,JSON[_0x97ef('0xf')](_0x2805ee));_0x478935(_0x2805ee);})['catch'](function(_0x412508){logger[_0x97ef('0x10')]('ShowInterval',_0x412508['message'],_0x1ec7e2);_0x389668(_0x4f1ff0[_0x97ef('0x10')](0x1f4,_0x412508[_0x97ef('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index cd7ac32..cb1eb2f 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 _0x7029=['exports','express','Router','./jira.controller','post','send'];(function(_0x2ff88b,_0x559d50){var _0x52bca0=function(_0x395b40){while(--_0x395b40){_0x2ff88b['push'](_0x2ff88b['shift']());}};_0x52bca0(++_0x559d50);}(_0x7029,0xd3));var _0x9702=function(_0x3b0986,_0x3fd783){_0x3b0986=_0x3b0986-0x0;var _0x223648=_0x7029[_0x3b0986];return _0x223648;};'use strict';var express=require(_0x9702('0x0'));var router=express[_0x9702('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9702('0x2'));router[_0x9702('0x3')]('/',auth['isAuthenticated'](),controller[_0x9702('0x4')]);module[_0x9702('0x5')]=router; \ No newline at end of file +var _0xfb45=['exports','express','Router','../../components/auth/service','isAuthenticated','send'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xfb45,0x115));var _0x5fb4=function(_0x2bd739,_0x42ec0a){_0x2bd739=_0x2bd739-0x0;var _0x8fbeaa=_0xfb45[_0x2bd739];return _0x8fbeaa;};'use strict';var express=require(_0x5fb4('0x0'));var router=express[_0x5fb4('0x1')]();var auth=require(_0x5fb4('0x2'));var controller=require('./jira.controller');router['post']('/',auth[_0x5fb4('0x3')](),controller[_0x5fb4('0x4')]);module[_0x5fb4('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index bc07916..415aa0e 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 _0x00a0=['body','headers','connection','remoteAddress','socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','end','openIssue'];(function(_0x2f47d2,_0x2696f0){var _0x52b8d3=function(_0x543b76){while(--_0x543b76){_0x2f47d2['push'](_0x2f47d2['shift']());}};_0x52b8d3(++_0x2696f0);}(_0x00a0,0x86));var _0x000a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x00a0[_0x27af45];return _0x18df21;};'use strict';var BPromise=require(_0x000a('0x0'));var https=require('https');var logger=require(_0x000a('0x1'))(_0x000a('0x2'));var USERNAME=_0x000a('0x3');var PASSWORD=_0x000a('0x4');function openIssue(_0x51cffa,_0x265f6b){var _0x4ce024={'fields':{'project':{'key':_0x51cffa[_0x000a('0x5')]||_0x000a('0x6')},'summary':(_0x51cffa[_0x000a('0x7')]||'Report')+_0x000a('0x8')+_0x51cffa['ip'],'description':_0x51cffa[_0x000a('0x9')]||JSON[_0x000a('0xa')](_0x51cffa),'issuetype':{'name':_0x51cffa[_0x000a('0xb')]||_0x000a('0xc')}}};_0x4ce024[_0x000a('0xd')][_0x000a('0xe')]=_0x51cffa[_0x000a('0xf')];_0x4ce024['fields']['customfield_11501']=_0x51cffa['oldToken'];_0x4ce024[_0x000a('0xd')]['customfield_11502']=_0x51cffa[_0x000a('0x10')];_0x4ce024[_0x000a('0xd')][_0x000a('0x11')]=_0x51cffa[_0x000a('0x12')];_0x4ce024['fields'][_0x000a('0x13')]=_0x51cffa[_0x000a('0x14')];_0x4ce024['fields'][_0x000a('0x15')]=_0x51cffa['ip'];var _0x4f9eb1={'host':_0x000a('0x16'),'port':0x1bb,'path':_0x000a('0x17'),'method':_0x000a('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x000a('0x19'),'Authorization':_0x000a('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x000a('0x1b')]('base64')}};var _0x5182c6=JSON[_0x000a('0xa')](_0x4ce024);var _0x20905a=https[_0x000a('0x1c')](_0x4f9eb1,function(_0x59b036){_0x59b036[_0x000a('0x1d')](_0x000a('0x1e'));var _0x507af4='';_0x59b036['on'](_0x000a('0x1f'),function(_0xcedc3d){_0x507af4+=_0xcedc3d;});_0x59b036['on']('end',function(){if(_0x265f6b){return _0x265f6b[_0x000a('0x20')](_0x59b036['statusCode'])[_0x000a('0x21')](JSON[_0x000a('0x22')](_0x507af4));}});});_0x20905a['on']('error',function(_0x26e838){if(_0x265f6b){return _0x265f6b[_0x000a('0x20')](0x1f4)[_0x000a('0x21')]({'errors':[{'message':_0x000a('0x23'),'type':'api.jira'}]});}});_0x20905a['write'](_0x5182c6);_0x20905a[_0x000a('0x24')]();}exports[_0x000a('0x25')]=openIssue;exports['send']=function(_0x6995db,_0xe9c532){_0x6995db[_0x000a('0x26')]['ip']=_0x6995db[_0x000a('0x27')]['x-forwarded-for']||_0x6995db[_0x000a('0x28')][_0x000a('0x29')]||_0x6995db[_0x000a('0x2a')][_0x000a('0x29')]||_0x6995db[_0x000a('0x28')]['socket'][_0x000a('0x29')];return openIssue(_0x6995db[_0x000a('0x26')],_0xe9c532);}; \ No newline at end of file +var _0x551f=['toString','base64','request','setEncoding','end','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','../../config/logger','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','stringify','issuetype','Bug','customfield_11501','oldToken','fields','customfield_11502','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20'];(function(_0x18d417,_0x692f5e){var _0x40fb7a=function(_0x54163b){while(--_0x54163b){_0x18d417['push'](_0x18d417['shift']());}};_0x40fb7a(++_0x692f5e);}(_0x551f,0x67));var _0xf551=function(_0x5f0f89,_0x1fc5cc){_0x5f0f89=_0x5f0f89-0x0;var _0x541945=_0x551f[_0x5f0f89];return _0x541945;};'use strict';var BPromise=require(_0xf551('0x0'));var https=require('https');var logger=require(_0xf551('0x1'))('api');var USERNAME=_0xf551('0x2');var PASSWORD=_0xf551('0x3');function openIssue(_0x500048,_0x2e2f8f){var _0x5d2060={'fields':{'project':{'key':_0x500048['key']||_0xf551('0x4')},'summary':(_0x500048[_0xf551('0x5')]||'Report')+_0xf551('0x6')+_0x500048['ip'],'description':_0x500048['description']||JSON[_0xf551('0x7')](_0x500048),'issuetype':{'name':_0x500048[_0xf551('0x8')]||_0xf551('0x9')}}};_0x5d2060['fields']['customfield_11500']=_0x500048['email'];_0x5d2060['fields'][_0xf551('0xa')]=_0x500048[_0xf551('0xb')];_0x5d2060[_0xf551('0xc')][_0xf551('0xd')]=_0x500048['newToken'];_0x5d2060[_0xf551('0xc')]['customfield_11503']=_0x500048[_0xf551('0xe')];_0x5d2060[_0xf551('0xc')][_0xf551('0xf')]=_0x500048[_0xf551('0x10')];_0x5d2060[_0xf551('0xc')][_0xf551('0x11')]=_0x500048['ip'];var _0x2e8947={'host':_0xf551('0x12'),'port':0x1bb,'path':_0xf551('0x13'),'method':_0xf551('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xf551('0x15'),'Authorization':_0xf551('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xf551('0x17')](_0xf551('0x18'))}};var _0x593567=JSON[_0xf551('0x7')](_0x5d2060);var _0x396bf5=https[_0xf551('0x19')](_0x2e8947,function(_0x38ed7d){_0x38ed7d[_0xf551('0x1a')]('utf8');var _0x3c8ded='';_0x38ed7d['on']('data',function(_0x5bf956){_0x3c8ded+=_0x5bf956;});_0x38ed7d['on'](_0xf551('0x1b'),function(){if(_0x2e2f8f){return _0x2e2f8f['status'](_0x38ed7d['statusCode'])[_0xf551('0x1c')](JSON[_0xf551('0x1d')](_0x3c8ded));}});});_0x396bf5['on'](_0xf551('0x1e'),function(_0x31db80){if(_0x2e2f8f){return _0x2e2f8f[_0xf551('0x1f')](0x1f4)[_0xf551('0x1c')]({'errors':[{'message':_0xf551('0x20'),'type':_0xf551('0x21')}]});}});_0x396bf5[_0xf551('0x22')](_0x593567);_0x396bf5[_0xf551('0x1b')]();}exports[_0xf551('0x23')]=openIssue;exports['send']=function(_0x590632,_0x34797e){_0x590632[_0xf551('0x24')]['ip']=_0x590632[_0xf551('0x25')][_0xf551('0x26')]||_0x590632['connection'][_0xf551('0x27')]||_0x590632[_0xf551('0x28')][_0xf551('0x27')]||_0x590632[_0xf551('0x29')][_0xf551('0x28')][_0xf551('0x27')];return openIssue(_0x590632[_0xf551('0x24')],_0x34797e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 36544ec..5c32d62 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 _0x448c=['exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','post','isAuthenticated','update','delete','/:id'];(function(_0x4b22c4,_0x550d36){var _0x497806=function(_0x348b65){while(--_0x348b65){_0x4b22c4['push'](_0x4b22c4['shift']());}};_0x497806(++_0x550d36);}(_0x448c,0x119));var _0xc448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x448c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc448('0x0'));var path=require(_0xc448('0x1'));var timeout=require('connect-timeout');var express=require(_0xc448('0x2'));var router=express['Router']();var auth=require(_0xc448('0x3'));var interaction=require(_0xc448('0x4'));var config=require(_0xc448('0x5'));var controller=require(_0xc448('0x6'));router[_0xc448('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc448('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc448('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc448('0x8')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xc448('0x9')](),controller[_0xc448('0xa')]);router[_0xc448('0xb')](_0xc448('0xc'),auth[_0xc448('0x9')](),controller['destroy']);module[_0xc448('0xd')]=router; \ No newline at end of file +var _0xc86d=['../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4fb721,_0x245cab){var _0x8e7738=function(_0x1eddbe){while(--_0x1eddbe){_0x4fb721['push'](_0x4fb721['shift']());}};_0x8e7738(++_0x245cab);}(_0xc86d,0xae));var _0xdc86=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc86d[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xdc86('0x0'));var util=require(_0xdc86('0x1'));var path=require(_0xdc86('0x2'));var timeout=require(_0xdc86('0x3'));var express=require(_0xdc86('0x4'));var router=express[_0xdc86('0x5')]();var auth=require(_0xdc86('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc86('0x7'));var controller=require(_0xdc86('0x8'));router[_0xdc86('0x9')]('/',auth['isAuthenticated'](),controller[_0xdc86('0xa')]);router['get'](_0xdc86('0xb'),auth[_0xdc86('0xc')](),controller[_0xdc86('0xd')]);router[_0xdc86('0x9')](_0xdc86('0xe'),auth[_0xdc86('0xc')](),controller[_0xdc86('0xf')]);router['post']('/',auth[_0xdc86('0xc')](),controller['create']);router[_0xdc86('0x10')](_0xdc86('0xe'),auth['isAuthenticated'](),controller[_0xdc86('0x11')]);router[_0xdc86('0x12')](_0xdc86('0xe'),auth[_0xdc86('0xc')](),controller['destroy']);module[_0xdc86('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index a5d11d1..39ccf81 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 _0x1430=['TEXT','exports','STRING'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x1430,0x187));var _0x0143=function(_0x1c865d,_0x6e2bb9){_0x1c865d=_0x1c865d-0x0;var _0x1466bc=_0x1430[_0x1c865d];return _0x1466bc;};'use strict';var Sequelize=require('sequelize');module[_0x0143('0x0')]={'question':{'type':Sequelize[_0x0143('0x1')]},'answer':{'type':Sequelize[_0x0143('0x2')]('long')},'membername':{'type':Sequelize[_0x0143('0x1')]},'projectname':{'type':Sequelize[_0x0143('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0143('0x1')]},'calleridname':{'type':Sequelize[_0x0143('0x1')]},'calleridnum':{'type':Sequelize[_0x0143('0x1')]},'questionId':{'type':Sequelize[_0x0143('0x1')]}}; \ No newline at end of file +var _0x4f46=['STRING','TEXT','long','sequelize','exports'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x4f46,0x80));var _0x64f4=function(_0x5d0d1b,_0x44b391){_0x5d0d1b=_0x5d0d1b-0x0;var _0x196810=_0x4f46[_0x5d0d1b];return _0x196810;};'use strict';var Sequelize=require(_0x64f4('0x0'));module[_0x64f4('0x1')]={'question':{'type':Sequelize[_0x64f4('0x2')]},'answer':{'type':Sequelize[_0x64f4('0x3')](_0x64f4('0x4'))},'membername':{'type':Sequelize[_0x64f4('0x2')]},'projectname':{'type':Sequelize[_0x64f4('0x2')]},'queue':{'type':Sequelize[_0x64f4('0x2')]},'uniqueid':{'type':Sequelize[_0x64f4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x64f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 10f8845..f5ff34f 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 _0xf041=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','length','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xa858b6,_0x156b7b){var _0x287b3a=function(_0x873838){while(--_0x873838){_0xa858b6['push'](_0xa858b6['shift']());}};_0x287b3a(++_0x156b7b);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1f04('0x0'));var zipdir=require(_0x1f04('0x1'));var jsonpatch=require(_0x1f04('0x2'));var rp=require(_0x1f04('0x3'));var moment=require('moment');var BPromise=require(_0x1f04('0x4'));var Mustache=require('mustache');var util=require(_0x1f04('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1f04('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1f04('0x7'));var squel=require(_0x1f04('0x8'));var crypto=require(_0x1f04('0x9'));var jsforce=require(_0x1f04('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1f04('0x6'));var querystring=require(_0x1f04('0xb'));var Papa=require(_0x1f04('0xc'));var Redis=require(_0x1f04('0xd'));var authService=require(_0x1f04('0xe'));var qs=require(_0x1f04('0xf'));var as=require(_0x1f04('0x10'));var hardwareService=require(_0x1f04('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1f04('0x12'));var config=require(_0x1f04('0x13'));var db=require(_0x1f04('0x14'))['db'];function respondWithStatusCode(_0x38787a,_0x10e1da){_0x10e1da=_0x10e1da||0xcc;return function(_0x28edce){if(_0x28edce){return _0x38787a[_0x1f04('0x15')](_0x10e1da);}return _0x38787a[_0x1f04('0x16')](_0x10e1da)[_0x1f04('0x17')]();};}function respondWithResult(_0x1e7693,_0x306c30){_0x306c30=_0x306c30||0xc8;return function(_0x4ebd86){if(_0x4ebd86){return _0x1e7693['status'](_0x306c30)[_0x1f04('0x18')](_0x4ebd86);}};}function respondWithFilteredResult(_0x2056f7,_0x24d37c){return function(_0x57de82){if(_0x57de82){var _0x255fc8=_0x57de82[_0x1f04('0x19')],_0x57b4e5=_0x24d37c[_0x1f04('0x1a')],_0x2edf54=_0x24d37c[_0x1f04('0x1a')]+_0x24d37c[_0x1f04('0x1b')],_0x3bc1e6;if(_0x2edf54>=_0x255fc8){_0x2edf54=_0x255fc8;_0x3bc1e6=0xc8;}else{_0x3bc1e6=0xce;}_0x2056f7['status'](_0x3bc1e6);return _0x2056f7['set'](_0x1f04('0x1c'),_0x57b4e5+'-'+_0x2edf54+'/'+_0x255fc8)[_0x1f04('0x18')](_0x57de82);}return null;};}function patchUpdates(_0x413c24){return function(_0x275170){try{jsonpatch[_0x1f04('0x1d')](_0x275170,_0x413c24,!![]);}catch(_0x30d2e5){return BPromise[_0x1f04('0x1e')](_0x30d2e5);}return _0x275170[_0x1f04('0x1f')]();};}function saveUpdates(_0x596bf9,_0x2d325e){return function(_0x3de665){if(_0x3de665){return _0x3de665[_0x1f04('0x20')](_0x596bf9)['then'](function(_0x2eb6d2){return _0x2eb6d2;});}return null;};}function removeEntity(_0x1453e6,_0x570578){return function(_0xae5976){if(_0xae5976){return _0xae5976[_0x1f04('0x21')]()[_0x1f04('0x22')](function(){_0x1453e6[_0x1f04('0x16')](0xcc)[_0x1f04('0x17')]();});}};}function handleEntityNotFound(_0x162d4f,_0x33ada4){return function(_0x4735a2){if(!_0x4735a2){_0x162d4f['sendStatus'](0x194);}return _0x4735a2;};}function handleError(_0x4e9883,_0x3a29aa){_0x3a29aa=_0x3a29aa||0x1f4;return function(_0x42a782){logger[_0x1f04('0x23')](_0x42a782[_0x1f04('0x24')]);if(_0x42a782[_0x1f04('0x25')]){delete _0x42a782[_0x1f04('0x25')];}_0x4e9883[_0x1f04('0x16')](_0x3a29aa)[_0x1f04('0x26')](_0x42a782);};}exports[_0x1f04('0x27')]=function(_0x96ab0e,_0x2288b3){var _0x26c515={},_0x372fec={},_0x5a110d={'count':0x0,'rows':[]};var _0x3b84c0=_[_0x1f04('0x28')](db[_0x1f04('0x29')][_0x1f04('0x2a')],function(_0x22848d){return{'name':_0x22848d[_0x1f04('0x2b')],'type':_0x22848d[_0x1f04('0x2c')][_0x1f04('0x2d')]};});_0x372fec[_0x1f04('0x2e')]=_[_0x1f04('0x28')](_0x3b84c0,_0x1f04('0x25'));_0x372fec['query']=_[_0x1f04('0x2f')](_0x96ab0e['query']);_0x372fec[_0x1f04('0x30')]=_[_0x1f04('0x31')](_0x372fec[_0x1f04('0x2e')],_0x372fec[_0x1f04('0x32')]);_0x26c515['attributes']=_[_0x1f04('0x31')](_0x372fec[_0x1f04('0x2e')],qs[_0x1f04('0x33')](_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x33')]));_0x26c515[_0x1f04('0x34')]=_0x26c515[_0x1f04('0x34')]['length']?_0x26c515[_0x1f04('0x34')]:_0x372fec['model'];if(!_0x96ab0e['query'][_0x1f04('0x35')](_0x1f04('0x36'))){_0x26c515[_0x1f04('0x1b')]=qs['limit'](_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x1b')]);_0x26c515[_0x1f04('0x1a')]=qs['offset'](_0x96ab0e[_0x1f04('0x32')]['offset']);}_0x26c515[_0x1f04('0x37')]=qs[_0x1f04('0x38')](_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x38')]);_0x26c515[_0x1f04('0x39')]=qs[_0x1f04('0x30')](_[_0x1f04('0x3a')](_0x96ab0e[_0x1f04('0x32')],_0x372fec[_0x1f04('0x30')]),_0x3b84c0);if(_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x3b')]){_0x26c515[_0x1f04('0x39')]=_['merge'](_0x26c515[_0x1f04('0x39')],{'$or':_['map'](_0x3b84c0,function(_0x76795b){if(_0x76795b[_0x1f04('0x2c')]!==_0x1f04('0x3c')){var _0x425769={};_0x425769[_0x76795b[_0x1f04('0x25')]]={'$like':'%'+_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x3b')]+'%'};return _0x425769;}})});}_0x26c515=_[_0x1f04('0x3d')]({},_0x26c515,_0x96ab0e[_0x1f04('0x3e')]);var _0x291171={'where':_0x26c515[_0x1f04('0x39')]};return db['JscriptyAnswerReport'][_0x1f04('0x19')](_0x291171)[_0x1f04('0x22')](function(_0x1adcd6){_0x5a110d[_0x1f04('0x19')]=_0x1adcd6;if(_0x96ab0e[_0x1f04('0x32')]['includeAll']){_0x26c515['include']=[{'all':!![]}];}return db[_0x1f04('0x29')][_0x1f04('0x3f')](_0x26c515);})['then'](function(_0xdc751e){_0x5a110d[_0x1f04('0x40')]=_0xdc751e;return _0x5a110d;})[_0x1f04('0x22')](respondWithFilteredResult(_0x2288b3,_0x26c515))[_0x1f04('0x41')](handleError(_0x2288b3,null));};exports['show']=function(_0xbadf8c,_0x4d2d04){var _0x488940={'raw':!![],'where':{'id':_0xbadf8c[_0x1f04('0x42')]['id']}},_0x2644ee={};_0x2644ee[_0x1f04('0x2e')]=_[_0x1f04('0x2f')](db[_0x1f04('0x29')][_0x1f04('0x2a')]);_0x2644ee[_0x1f04('0x32')]=_['keys'](_0xbadf8c[_0x1f04('0x32')]);_0x2644ee['filters']=_[_0x1f04('0x31')](_0x2644ee[_0x1f04('0x2e')],_0x2644ee[_0x1f04('0x32')]);_0x488940[_0x1f04('0x34')]=_[_0x1f04('0x31')](_0x2644ee[_0x1f04('0x2e')],qs[_0x1f04('0x33')](_0xbadf8c[_0x1f04('0x32')][_0x1f04('0x33')]));_0x488940[_0x1f04('0x34')]=_0x488940[_0x1f04('0x34')][_0x1f04('0x43')]?_0x488940['attributes']:_0x2644ee[_0x1f04('0x2e')];if(_0xbadf8c['query']['includeAll']){_0x488940[_0x1f04('0x44')]=[{'all':!![]}];}_0x488940=_[_0x1f04('0x3d')]({},_0x488940,_0xbadf8c[_0x1f04('0x3e')]);return db[_0x1f04('0x29')][_0x1f04('0x45')](_0x488940)['then'](handleEntityNotFound(_0x4d2d04,null))[_0x1f04('0x22')](respondWithResult(_0x4d2d04,null))[_0x1f04('0x41')](handleError(_0x4d2d04,null));};exports[_0x1f04('0x46')]=function(_0x559d92,_0x564b29){return db['JscriptyAnswerReport'][_0x1f04('0x46')](_0x559d92[_0x1f04('0x47')],{})['then'](respondWithResult(_0x564b29,0xc9))['catch'](handleError(_0x564b29,null));};exports['update']=function(_0x1597fa,_0x59315a){if(_0x1597fa['body']['id']){delete _0x1597fa[_0x1f04('0x47')]['id'];}return db[_0x1f04('0x29')][_0x1f04('0x45')]({'where':{'id':_0x1597fa[_0x1f04('0x42')]['id']}})[_0x1f04('0x22')](handleEntityNotFound(_0x59315a,null))[_0x1f04('0x22')](saveUpdates(_0x1597fa[_0x1f04('0x47')],null))['then'](respondWithResult(_0x59315a,null))[_0x1f04('0x41')](handleError(_0x59315a,null));};exports[_0x1f04('0x21')]=function(_0x333db5,_0x187195){return db[_0x1f04('0x29')][_0x1f04('0x45')]({'where':{'id':_0x333db5['params']['id']}})[_0x1f04('0x22')](handleEntityNotFound(_0x187195,null))[_0x1f04('0x22')](removeEntity(_0x187195,null))[_0x1f04('0x41')](handleError(_0x187195,null));};exports[_0x1f04('0x48')]=function(_0x140315,_0x59f69f){return db['JscriptyAnswerReport'][_0x1f04('0x48')]()['then'](respondWithResult(_0x59f69f,null))[_0x1f04('0x41')](handleError(_0x59f69f,null));}; \ No newline at end of file +var _0x6e1e=['options','count','includeAll','rows','show','params','fields','include','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','offset','limit','apply','reject','save','update','then','error','stack','name','status','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x3eb450,_0x592b0a){var _0x2c4cfd=function(_0x34f5dc){while(--_0x34f5dc){_0x3eb450['push'](_0x3eb450['shift']());}};_0x2c4cfd(++_0x592b0a);}(_0x6e1e,0x142));var _0xe6e1=function(_0x3679cd,_0x1aa98a){_0x3679cd=_0x3679cd-0x0;var _0x281367=_0x6e1e[_0x3679cd];return _0x281367;};'use strict';var pdf=require(_0xe6e1('0x0'));var emlformat=require(_0xe6e1('0x1'));var rimraf=require(_0xe6e1('0x2'));var zipdir=require(_0xe6e1('0x3'));var jsonpatch=require(_0xe6e1('0x4'));var rp=require(_0xe6e1('0x5'));var moment=require(_0xe6e1('0x6'));var BPromise=require(_0xe6e1('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe6e1('0x8'));var csv=require(_0xe6e1('0x9'));var ejs=require(_0xe6e1('0xa'));var fs=require('fs');var _=require(_0xe6e1('0xb'));var squel=require(_0xe6e1('0xc'));var crypto=require(_0xe6e1('0xd'));var jsforce=require(_0xe6e1('0xe'));var deskjs=require(_0xe6e1('0xf'));var toCsv=require(_0xe6e1('0x9'));var querystring=require(_0xe6e1('0x10'));var Papa=require(_0xe6e1('0x11'));var Redis=require(_0xe6e1('0x12'));var authService=require(_0xe6e1('0x13'));var qs=require(_0xe6e1('0x14'));var as=require(_0xe6e1('0x15'));var hardwareService=require(_0xe6e1('0x16'));var logger=require(_0xe6e1('0x17'))(_0xe6e1('0x18'));var utils=require(_0xe6e1('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5687e6,_0x3b18a1){_0x3b18a1=_0x3b18a1||0xcc;return function(_0x52eb76){if(_0x52eb76){return _0x5687e6[_0xe6e1('0x1a')](_0x3b18a1);}return _0x5687e6['status'](_0x3b18a1)[_0xe6e1('0x1b')]();};}function respondWithResult(_0x3d338d,_0x4dc8e9){_0x4dc8e9=_0x4dc8e9||0xc8;return function(_0x4a3cda){if(_0x4a3cda){return _0x3d338d['status'](_0x4dc8e9)[_0xe6e1('0x1c')](_0x4a3cda);}};}function respondWithFilteredResult(_0x862804,_0x41c528){return function(_0xa8e36){if(_0xa8e36){var _0x3fac60=_0xa8e36['count'],_0x2ede78=_0x41c528[_0xe6e1('0x1d')],_0xbee614=_0x41c528[_0xe6e1('0x1d')]+_0x41c528[_0xe6e1('0x1e')],_0x36ae45;if(_0xbee614>=_0x3fac60){_0xbee614=_0x3fac60;_0x36ae45=0xc8;}else{_0x36ae45=0xce;}_0x862804['status'](_0x36ae45);return _0x862804['set']('Content-Range',_0x2ede78+'-'+_0xbee614+'/'+_0x3fac60)[_0xe6e1('0x1c')](_0xa8e36);}return null;};}function patchUpdates(_0x4cad31){return function(_0x407a80){try{jsonpatch[_0xe6e1('0x1f')](_0x407a80,_0x4cad31,!![]);}catch(_0x3c0387){return BPromise[_0xe6e1('0x20')](_0x3c0387);}return _0x407a80[_0xe6e1('0x21')]();};}function saveUpdates(_0x455e22,_0x456ccc){return function(_0x306892){if(_0x306892){return _0x306892[_0xe6e1('0x22')](_0x455e22)['then'](function(_0x3aa0c9){return _0x3aa0c9;});}return null;};}function removeEntity(_0xe436e,_0x2f7d57){return function(_0x2b5757){if(_0x2b5757){return _0x2b5757['destroy']()[_0xe6e1('0x23')](function(){_0xe436e['status'](0xcc)[_0xe6e1('0x1b')]();});}};}function handleEntityNotFound(_0x138f41,_0x3e2c34){return function(_0x49cd15){if(!_0x49cd15){_0x138f41['sendStatus'](0x194);}return _0x49cd15;};}function handleError(_0x4734ab,_0x9767c9){_0x9767c9=_0x9767c9||0x1f4;return function(_0x456e7b){logger[_0xe6e1('0x24')](_0x456e7b[_0xe6e1('0x25')]);if(_0x456e7b[_0xe6e1('0x26')]){delete _0x456e7b['name'];}_0x4734ab[_0xe6e1('0x27')](_0x9767c9)[_0xe6e1('0x28')](_0x456e7b);};}exports[_0xe6e1('0x29')]=function(_0x9a7175,_0x37505a){var _0x2288a6={},_0x39f647={},_0x38489a={'count':0x0,'rows':[]};var _0x3447b2=_['map'](db[_0xe6e1('0x2a')][_0xe6e1('0x2b')],function(_0x3901ac){return{'name':_0x3901ac[_0xe6e1('0x2c')],'type':_0x3901ac[_0xe6e1('0x2d')]['key']};});_0x39f647[_0xe6e1('0x2e')]=_[_0xe6e1('0x2f')](_0x3447b2,'name');_0x39f647[_0xe6e1('0x30')]=_[_0xe6e1('0x31')](_0x9a7175['query']);_0x39f647[_0xe6e1('0x32')]=_[_0xe6e1('0x33')](_0x39f647[_0xe6e1('0x2e')],_0x39f647[_0xe6e1('0x30')]);_0x2288a6[_0xe6e1('0x34')]=_[_0xe6e1('0x33')](_0x39f647[_0xe6e1('0x2e')],qs['fields'](_0x9a7175[_0xe6e1('0x30')]['fields']));_0x2288a6[_0xe6e1('0x34')]=_0x2288a6[_0xe6e1('0x34')][_0xe6e1('0x35')]?_0x2288a6[_0xe6e1('0x34')]:_0x39f647[_0xe6e1('0x2e')];if(!_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x36')](_0xe6e1('0x37'))){_0x2288a6['limit']=qs[_0xe6e1('0x1e')](_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x1e')]);_0x2288a6['offset']=qs[_0xe6e1('0x1d')](_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x1d')]);}_0x2288a6[_0xe6e1('0x38')]=qs[_0xe6e1('0x39')](_0x9a7175['query'][_0xe6e1('0x39')]);_0x2288a6[_0xe6e1('0x3a')]=qs[_0xe6e1('0x32')](_[_0xe6e1('0x3b')](_0x9a7175[_0xe6e1('0x30')],_0x39f647[_0xe6e1('0x32')]),_0x3447b2);if(_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x3c')]){_0x2288a6['where']=_[_0xe6e1('0x3d')](_0x2288a6[_0xe6e1('0x3a')],{'$or':_[_0xe6e1('0x2f')](_0x3447b2,function(_0x200e87){if(_0x200e87[_0xe6e1('0x2d')]!==_0xe6e1('0x3e')){var _0x1bc57b={};_0x1bc57b[_0x200e87[_0xe6e1('0x26')]]={'$like':'%'+_0x9a7175['query'][_0xe6e1('0x3c')]+'%'};return _0x1bc57b;}})});}_0x2288a6=_[_0xe6e1('0x3d')]({},_0x2288a6,_0x9a7175[_0xe6e1('0x3f')]);var _0x343a15={'where':_0x2288a6[_0xe6e1('0x3a')]};return db['JscriptyAnswerReport'][_0xe6e1('0x40')](_0x343a15)[_0xe6e1('0x23')](function(_0x43505b){_0x38489a['count']=_0x43505b;if(_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x41')]){_0x2288a6['include']=[{'all':!![]}];}return db[_0xe6e1('0x2a')]['findAll'](_0x2288a6);})['then'](function(_0x37100e){_0x38489a[_0xe6e1('0x42')]=_0x37100e;return _0x38489a;})[_0xe6e1('0x23')](respondWithFilteredResult(_0x37505a,_0x2288a6))['catch'](handleError(_0x37505a,null));};exports[_0xe6e1('0x43')]=function(_0x2a818d,_0x422127){var _0x5b55da={'raw':!![],'where':{'id':_0x2a818d[_0xe6e1('0x44')]['id']}},_0x2159ea={};_0x2159ea[_0xe6e1('0x2e')]=_['keys'](db[_0xe6e1('0x2a')][_0xe6e1('0x2b')]);_0x2159ea[_0xe6e1('0x30')]=_[_0xe6e1('0x31')](_0x2a818d[_0xe6e1('0x30')]);_0x2159ea['filters']=_[_0xe6e1('0x33')](_0x2159ea[_0xe6e1('0x2e')],_0x2159ea['query']);_0x5b55da['attributes']=_[_0xe6e1('0x33')](_0x2159ea[_0xe6e1('0x2e')],qs[_0xe6e1('0x45')](_0x2a818d['query']['fields']));_0x5b55da['attributes']=_0x5b55da[_0xe6e1('0x34')][_0xe6e1('0x35')]?_0x5b55da[_0xe6e1('0x34')]:_0x2159ea[_0xe6e1('0x2e')];if(_0x2a818d['query'][_0xe6e1('0x41')]){_0x5b55da[_0xe6e1('0x46')]=[{'all':!![]}];}_0x5b55da=_[_0xe6e1('0x3d')]({},_0x5b55da,_0x2a818d[_0xe6e1('0x3f')]);return db[_0xe6e1('0x2a')][_0xe6e1('0x47')](_0x5b55da)[_0xe6e1('0x23')](handleEntityNotFound(_0x422127,null))[_0xe6e1('0x23')](respondWithResult(_0x422127,null))[_0xe6e1('0x48')](handleError(_0x422127,null));};exports[_0xe6e1('0x49')]=function(_0x4f87c2,_0x3c1b6f){return db[_0xe6e1('0x2a')][_0xe6e1('0x49')](_0x4f87c2[_0xe6e1('0x4a')],{})[_0xe6e1('0x23')](respondWithResult(_0x3c1b6f,0xc9))[_0xe6e1('0x48')](handleError(_0x3c1b6f,null));};exports['update']=function(_0x2dfa69,_0x2c4640){if(_0x2dfa69[_0xe6e1('0x4a')]['id']){delete _0x2dfa69[_0xe6e1('0x4a')]['id'];}return db[_0xe6e1('0x2a')][_0xe6e1('0x47')]({'where':{'id':_0x2dfa69[_0xe6e1('0x44')]['id']}})[_0xe6e1('0x23')](handleEntityNotFound(_0x2c4640,null))[_0xe6e1('0x23')](saveUpdates(_0x2dfa69['body'],null))[_0xe6e1('0x23')](respondWithResult(_0x2c4640,null))[_0xe6e1('0x48')](handleError(_0x2c4640,null));};exports[_0xe6e1('0x4b')]=function(_0x2292ff,_0x2b2386){return db[_0xe6e1('0x2a')][_0xe6e1('0x47')]({'where':{'id':_0x2292ff[_0xe6e1('0x44')]['id']}})[_0xe6e1('0x23')](handleEntityNotFound(_0x2b2386,null))[_0xe6e1('0x23')](removeEntity(_0x2b2386,null))['catch'](handleError(_0x2b2386,null));};exports[_0xe6e1('0x4c')]=function(_0x15fdca,_0x4edf92){return db[_0xe6e1('0x2a')]['describe']()[_0xe6e1('0x23')](respondWithResult(_0x4edf92,null))[_0xe6e1('0x48')](handleError(_0x4edf92,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index b492556..4e3e0b8 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 _0x44fc=['request-promise','path','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird'];(function(_0x46591a,_0x801bdd){var _0x46de39=function(_0x2e8641){while(--_0x2e8641){_0x46591a['push'](_0x46591a['shift']());}};_0x46de39(++_0x801bdd);}(_0x44fc,0x127));var _0xc44f=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x44fc[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xc44f('0x0'));var util=require(_0xc44f('0x1'));var logger=require(_0xc44f('0x2'))(_0xc44f('0x3'));var moment=require('moment');var BPromise=require(_0xc44f('0x4'));var rp=require(_0xc44f('0x5'));var fs=require('fs');var path=require(_0xc44f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xc44f('0x7')]=function(_0x35d679,_0x4fa758){return _0x35d679['define'](_0xc44f('0x8'),attributes,{'tableName':_0xc44f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f9e=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','report_jscripty_answers'];(function(_0x5515a7,_0x2c4af1){var _0x43f4bf=function(_0x3d519d){while(--_0x3d519d){_0x5515a7['push'](_0x5515a7['shift']());}};_0x43f4bf(++_0x2c4af1);}(_0x1f9e,0x19a));var _0xe1f9=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x1f9e[_0x5de214];return _0x4df627;};'use strict';var _=require(_0xe1f9('0x0'));var util=require(_0xe1f9('0x1'));var logger=require(_0xe1f9('0x2'))('api');var moment=require(_0xe1f9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe1f9('0x4'));var fs=require('fs');var path=require(_0xe1f9('0x5'));var rimraf=require(_0xe1f9('0x6'));var config=require(_0xe1f9('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x184032,_0xfca3a0){return _0x184032[_0xe1f9('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0xe1f9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index d419cbb..e8973ba 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 _0x8c58=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x5cbbb6,_0x21e5ef){var _0x464e58=function(_0x295566){while(--_0x295566){_0x5cbbb6['push'](_0x5cbbb6['shift']());}};_0x464e58(++_0x21e5ef);}(_0x8c58,0x132));var _0x88c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8c58[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x88c5('0x0'));var util=require(_0x88c5('0x1'));var moment=require(_0x88c5('0x2'));var BPromise=require(_0x88c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x88c5('0x5'))(_0x88c5('0x6'));var config=require(_0x88c5('0x7'));var jayson=require(_0x88c5('0x8'));var client=jayson[_0x88c5('0x9')][_0x88c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193aca,_0x14b88d,_0xcdff9b){return new BPromise(function(_0x100cd3,_0x42eb66){return client['request'](_0x193aca,_0xcdff9b)[_0x88c5('0xb')](function(_0x2fb081){logger[_0x88c5('0xc')](_0x88c5('0xd'),_0x14b88d,'request\x20sent');logger['debug'](_0x88c5('0xe'),_0x14b88d,_0x88c5('0xf'),JSON['stringify'](_0x2fb081));if(_0x2fb081[_0x88c5('0x10')]){if(_0x2fb081[_0x88c5('0x10')][_0x88c5('0x11')]===0x1f4){logger[_0x88c5('0x10')](_0x88c5('0xd'),_0x14b88d,_0x2fb081[_0x88c5('0x10')][_0x88c5('0x12')]);return _0x42eb66(_0x2fb081[_0x88c5('0x10')][_0x88c5('0x12')]);}logger[_0x88c5('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x14b88d,_0x2fb081[_0x88c5('0x10')][_0x88c5('0x12')]);return _0x100cd3(_0x2fb081[_0x88c5('0x10')][_0x88c5('0x12')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x14b88d,_0x88c5('0xf'));_0x100cd3(_0x2fb081[_0x88c5('0x13')][_0x88c5('0x12')]);}})['catch'](function(_0x853de9){logger[_0x88c5('0x10')](_0x88c5('0xd'),_0x14b88d,_0x853de9);_0x42eb66(_0x853de9);});});} \ No newline at end of file +var _0xeb8b=['info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xeb8b,0x106));var _0xbeb8=function(_0x5956e4,_0x4e4c98){_0x5956e4=_0x5956e4-0x0;var _0x48e972=_0xeb8b[_0x5956e4];return _0x48e972;};'use strict';var _=require(_0xbeb8('0x0'));var util=require(_0xbeb8('0x1'));var moment=require(_0xbeb8('0x2'));var BPromise=require(_0xbeb8('0x3'));var rs=require(_0xbeb8('0x4'));var fs=require('fs');var Redis=require(_0xbeb8('0x5'));var db=require(_0xbeb8('0x6'))['db'];var utils=require(_0xbeb8('0x7'));var logger=require(_0xbeb8('0x8'))(_0xbeb8('0x9'));var config=require(_0xbeb8('0xa'));var jayson=require(_0xbeb8('0xb'));var client=jayson[_0xbeb8('0xc')][_0xbeb8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2d4936,_0x249197,_0x36e22b){return new BPromise(function(_0x4c55f2,_0x5dc502){return client['request'](_0x2d4936,_0x36e22b)['then'](function(_0x21f5d6){logger[_0xbeb8('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x249197,_0xbeb8('0xf'));logger['debug'](_0xbeb8('0x10'),_0x249197,_0xbeb8('0xf'),JSON[_0xbeb8('0x11')](_0x21f5d6));if(_0x21f5d6[_0xbeb8('0x12')]){if(_0x21f5d6['error']['code']===0x1f4){logger[_0xbeb8('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x249197,_0x21f5d6[_0xbeb8('0x12')][_0xbeb8('0x13')]);return _0x5dc502(_0x21f5d6['error']['message']);}logger[_0xbeb8('0x12')](_0xbeb8('0x14'),_0x249197,_0x21f5d6[_0xbeb8('0x12')][_0xbeb8('0x13')]);return _0x4c55f2(_0x21f5d6[_0xbeb8('0x12')][_0xbeb8('0x13')]);}else{logger[_0xbeb8('0xe')](_0xbeb8('0x14'),_0x249197,_0xbeb8('0xf'));_0x4c55f2(_0x21f5d6[_0xbeb8('0x15')]['message']);}})[_0xbeb8('0x16')](function(_0x141287){logger['error'](_0xbeb8('0x14'),_0x249197,_0x141287);_0x5dc502(_0x141287);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5226342..ba630b8 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 _0x119f=['../../components/interaction/service','isAuthenticated','index','get','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3710f1,_0x4d55cf){var _0x1ef269=function(_0x286dce){while(--_0x286dce){_0x3710f1['push'](_0x3710f1['shift']());}};_0x1ef269(++_0x4d55cf);}(_0x119f,0xd4));var _0xf119=function(_0x1942a4,_0x14952f){_0x1942a4=_0x1942a4-0x0;var _0x536f31=_0x119f[_0x1942a4];return _0x536f31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf119('0x0'));var timeout=require(_0xf119('0x1'));var express=require('express');var router=express[_0xf119('0x2')]();var auth=require(_0xf119('0x3'));var interaction=require(_0xf119('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xf119('0x5')](),controller[_0xf119('0x6')]);router[_0xf119('0x7')](_0xf119('0x8'),auth['isAuthenticated'](),controller[_0xf119('0x9')]);router[_0xf119('0x7')]('/:id/sessions',auth[_0xf119('0x5')](),controller[_0xf119('0xa')]);router[_0xf119('0x7')](_0xf119('0xb'),auth[_0xf119('0x5')](),controller[_0xf119('0xc')]);router[_0xf119('0x7')](_0xf119('0xd'),auth['isAuthenticated'](),timeout(_0xf119('0xe')),controller[_0xf119('0xf')]);router[_0xf119('0x10')]('/',auth[_0xf119('0x5')](),controller[_0xf119('0x11')]);router[_0xf119('0x10')](_0xf119('0x12'),auth[_0xf119('0x5')](),controller['clone']);router[_0xf119('0x13')](_0xf119('0x8'),auth['isAuthenticated'](),controller[_0xf119('0x14')]);router[_0xf119('0x15')](_0xf119('0x8'),auth[_0xf119('0x5')](),controller[_0xf119('0x16')]);module[_0xf119('0x17')]=router; \ No newline at end of file +var _0x7ca0=['/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers'];(function(_0xac6c0b,_0x28e148){var _0x39077d=function(_0x59ebd4){while(--_0x59ebd4){_0xac6c0b['push'](_0xac6c0b['shift']());}};_0x39077d(++_0x28e148);}(_0x7ca0,0xe2));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x07ca('0x0'));var util=require(_0x07ca('0x1'));var path=require(_0x07ca('0x2'));var timeout=require(_0x07ca('0x3'));var express=require(_0x07ca('0x4'));var router=express['Router']();var auth=require(_0x07ca('0x5'));var interaction=require(_0x07ca('0x6'));var config=require('../../config/environment');var controller=require(_0x07ca('0x7'));router['get']('/',auth[_0x07ca('0x8')](),controller[_0x07ca('0x9')]);router[_0x07ca('0xa')](_0x07ca('0xb'),auth[_0x07ca('0x8')](),controller[_0x07ca('0xc')]);router[_0x07ca('0xa')](_0x07ca('0xd'),auth[_0x07ca('0x8')](),controller[_0x07ca('0xe')]);router['get'](_0x07ca('0xf'),auth['isAuthenticated'](),controller[_0x07ca('0x10')]);router[_0x07ca('0xa')](_0x07ca('0x11'),auth['isAuthenticated'](),timeout(_0x07ca('0x12')),controller['getSummary']);router[_0x07ca('0x13')]('/',auth['isAuthenticated'](),controller[_0x07ca('0x14')]);router[_0x07ca('0x13')](_0x07ca('0x15'),auth['isAuthenticated'](),controller[_0x07ca('0x16')]);router[_0x07ca('0x17')](_0x07ca('0xb'),auth[_0x07ca('0x8')](),controller[_0x07ca('0x18')]);router[_0x07ca('0x19')](_0x07ca('0xb'),auth[_0x07ca('0x8')](),controller['destroy']);module[_0x07ca('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 199433a..4dbc0a4 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 _0xb151=['format','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString'];(function(_0x24e07b,_0x5c9ce1){var _0x406f1e=function(_0x410df4){while(--_0x410df4){_0x24e07b['push'](_0x24e07b['shift']());}};_0x406f1e(++_0x5c9ce1);}(_0xb151,0x124));var _0x1b15=function(_0x37b1df,_0x2d5b07){_0x37b1df=_0x37b1df-0x0;var _0x1b5a5f=_0xb151[_0x37b1df];return _0x1b5a5f;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1b15('0x0'));var util=require(_0x1b15('0x1'));module[_0x1b15('0x2')]={'name':{'type':Sequelize[_0x1b15('0x3')],'unique':_0x1b15('0x4')},'description':{'type':Sequelize[_0x1b15('0x3')]},'formData':{'type':Sequelize[_0x1b15('0x5')](_0x1b15('0x6')),'set':function(_0x57c0a4){if(_[_0x1b15('0x7')](_0x57c0a4)){this[_0x1b15('0x8')](_0x1b15('0x9'),JSON[_0x1b15('0xa')](_0x57c0a4));}else if(_[_0x1b15('0xb')](_0x57c0a4)){this[_0x1b15('0x8')](_0x1b15('0x9'),_0x57c0a4);}else{this[_0x1b15('0x8')](_0x1b15('0x9'),util[_0x1b15('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x1b15('0xd')]('name')||'',this[_0x1b15('0xd')](_0x1b15('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1b15('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9bf4=['BOOLEAN','lodash','util','exports','STRING','TEXT','long','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name'];(function(_0x2e48a9,_0x2a0896){var _0x5eb0bc=function(_0x192646){while(--_0x192646){_0x2e48a9['push'](_0x2e48a9['shift']());}};_0x5eb0bc(++_0x2a0896);}(_0x9bf4,0x1a5));var _0x49bf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bf4[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var _=require(_0x49bf('0x0'));var util=require(_0x49bf('0x1'));module[_0x49bf('0x2')]={'name':{'type':Sequelize[_0x49bf('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x49bf('0x4')](_0x49bf('0x5')),'set':function(_0x47f644){if(_['isObjectLike'](_0x47f644)){this[_0x49bf('0x6')](_0x49bf('0x7'),JSON['stringify'](_0x47f644));}else if(_['isString'](_0x47f644)){this[_0x49bf('0x6')]('formData',_0x47f644);}else{this[_0x49bf('0x6')](_0x49bf('0x7'),util['format'](_0x49bf('0x8'),this[_0x49bf('0x9')](_0x49bf('0xa'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x49bf('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 10b9950..f7b952d 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 _0xb870=['apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','error','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','JscriptyProject','findAll','rows','show','includeAll','options','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','rawAttributes','nolimit','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xb870,0xd0));var _0x0b87=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb870[_0x413feb];return _0x40ee88;};'use strict';var pdf=require(_0x0b87('0x0'));var emlformat=require(_0x0b87('0x1'));var rimraf=require(_0x0b87('0x2'));var zipdir=require(_0x0b87('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b87('0x4'));var BPromise=require(_0x0b87('0x5'));var Mustache=require('mustache');var util=require(_0x0b87('0x6'));var path=require(_0x0b87('0x7'));var sox=require(_0x0b87('0x8'));var csv=require(_0x0b87('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0b87('0xa'));var crypto=require(_0x0b87('0xb'));var jsforce=require(_0x0b87('0xc'));var deskjs=require(_0x0b87('0xd'));var toCsv=require(_0x0b87('0x9'));var querystring=require('querystring');var Papa=require(_0x0b87('0xe'));var Redis=require('ioredis');var authService=require(_0x0b87('0xf'));var qs=require(_0x0b87('0x10'));var as=require(_0x0b87('0x11'));var hardwareService=require(_0x0b87('0x12'));var logger=require('../../config/logger')(_0x0b87('0x13'));var utils=require(_0x0b87('0x14'));var config=require(_0x0b87('0x15'));var db=require(_0x0b87('0x16'))['db'];function respondWithStatusCode(_0x6d88a4,_0x47c228){_0x47c228=_0x47c228||0xcc;return function(_0x2880c0){if(_0x2880c0){return _0x6d88a4[_0x0b87('0x17')](_0x47c228);}return _0x6d88a4[_0x0b87('0x18')](_0x47c228)[_0x0b87('0x19')]();};}function respondWithResult(_0x13999c,_0x4e6483){_0x4e6483=_0x4e6483||0xc8;return function(_0x5d7899){if(_0x5d7899){return _0x13999c['status'](_0x4e6483)[_0x0b87('0x1a')](_0x5d7899);}};}function respondWithFilteredResult(_0x4566cd,_0x1dc6e2){return function(_0x43f51a){if(_0x43f51a){var _0x396ff3=_0x43f51a[_0x0b87('0x1b')],_0x4cb589=_0x1dc6e2[_0x0b87('0x1c')],_0x3027f3=_0x1dc6e2[_0x0b87('0x1c')]+_0x1dc6e2[_0x0b87('0x1d')],_0x2009c4;if(_0x3027f3>=_0x396ff3){_0x3027f3=_0x396ff3;_0x2009c4=0xc8;}else{_0x2009c4=0xce;}_0x4566cd['status'](_0x2009c4);return _0x4566cd[_0x0b87('0x1e')](_0x0b87('0x1f'),_0x4cb589+'-'+_0x3027f3+'/'+_0x396ff3)[_0x0b87('0x1a')](_0x43f51a);}return null;};}function patchUpdates(_0x5e16b5){return function(_0x2f3405){try{jsonpatch[_0x0b87('0x20')](_0x2f3405,_0x5e16b5,!![]);}catch(_0x35add9){return BPromise[_0x0b87('0x21')](_0x35add9);}return _0x2f3405[_0x0b87('0x22')]();};}function saveUpdates(_0x2e34ca,_0x164732){return function(_0xfd38a5){if(_0xfd38a5){return _0xfd38a5[_0x0b87('0x23')](_0x2e34ca)['then'](function(_0x25f9b6){return _0x25f9b6;});}return null;};}function removeEntity(_0x20ae82,_0x27122d){return function(_0x32642a){if(_0x32642a){return _0x32642a[_0x0b87('0x24')]()[_0x0b87('0x25')](function(){var _0x5bc401=_0x32642a[_0x0b87('0x26')]({'plain':!![]});var _0x21476b=_0x0b87('0x27');return db[_0x0b87('0x28')][_0x0b87('0x24')]({'where':{'type':_0x21476b,'resourceId':_0x5bc401['id']}})['then'](function(){return _0x32642a;});})[_0x0b87('0x25')](function(){_0x20ae82[_0x0b87('0x18')](0xcc)[_0x0b87('0x19')]();});}};}function handleEntityNotFound(_0x167baf,_0x14144b){return function(_0x495c3e){if(!_0x495c3e){_0x167baf['sendStatus'](0x194);}return _0x495c3e;};}function handleError(_0x58184e,_0x38fd67){_0x38fd67=_0x38fd67||0x1f4;return function(_0x59d087){logger[_0x0b87('0x29')](_0x59d087[_0x0b87('0x2a')]);if(_0x59d087['name']){delete _0x59d087['name'];}_0x58184e[_0x0b87('0x18')](_0x38fd67)[_0x0b87('0x2b')](_0x59d087);};}exports[_0x0b87('0x2c')]=function(_0x2a596,_0x22e165){var _0x80827f={},_0x3c659f={},_0x4481de={'count':0x0,'rows':[]};var _0x35efad=_[_0x0b87('0x2d')](db['JscriptyProject']['rawAttributes'],function(_0x59d836){return{'name':_0x59d836[_0x0b87('0x2e')],'type':_0x59d836[_0x0b87('0x2f')][_0x0b87('0x30')]};});_0x3c659f[_0x0b87('0x31')]=_[_0x0b87('0x2d')](_0x35efad,_0x0b87('0x32'));_0x3c659f[_0x0b87('0x33')]=_[_0x0b87('0x34')](_0x2a596['query']);_0x3c659f[_0x0b87('0x35')]=_[_0x0b87('0x36')](_0x3c659f['model'],_0x3c659f[_0x0b87('0x33')]);_0x80827f['attributes']=_[_0x0b87('0x36')](_0x3c659f[_0x0b87('0x31')],qs['fields'](_0x2a596[_0x0b87('0x33')][_0x0b87('0x37')]));_0x80827f[_0x0b87('0x38')]=_0x80827f[_0x0b87('0x38')][_0x0b87('0x39')]?_0x80827f[_0x0b87('0x38')]:_0x3c659f[_0x0b87('0x31')];if(!_0x2a596[_0x0b87('0x33')][_0x0b87('0x3a')]('nolimit')){_0x80827f['limit']=qs[_0x0b87('0x1d')](_0x2a596[_0x0b87('0x33')][_0x0b87('0x1d')]);_0x80827f['offset']=qs[_0x0b87('0x1c')](_0x2a596['query'][_0x0b87('0x1c')]);}_0x80827f[_0x0b87('0x3b')]=qs[_0x0b87('0x3c')](_0x2a596[_0x0b87('0x33')][_0x0b87('0x3c')]);_0x80827f[_0x0b87('0x3d')]=qs['filters'](_[_0x0b87('0x3e')](_0x2a596[_0x0b87('0x33')],_0x3c659f['filters']),_0x35efad);if(_0x2a596[_0x0b87('0x33')][_0x0b87('0x3f')]){_0x80827f[_0x0b87('0x3d')]=_[_0x0b87('0x40')](_0x80827f['where'],{'$or':_[_0x0b87('0x2d')](_0x35efad,function(_0x5c6363){if(_0x5c6363['type']!==_0x0b87('0x41')){var _0x3c41a2={};_0x3c41a2[_0x5c6363[_0x0b87('0x32')]]={'$like':'%'+_0x2a596[_0x0b87('0x33')][_0x0b87('0x3f')]+'%'};return _0x3c41a2;}})});}_0x80827f=_[_0x0b87('0x40')]({},_0x80827f,_0x2a596['options']);var _0x45e6e1={'where':_0x80827f[_0x0b87('0x3d')]};return db['JscriptyProject'][_0x0b87('0x1b')](_0x45e6e1)[_0x0b87('0x25')](function(_0x2841a2){_0x4481de[_0x0b87('0x1b')]=_0x2841a2;if(_0x2a596['query']['includeAll']){_0x80827f[_0x0b87('0x42')]=[{'all':!![]}];}return db[_0x0b87('0x43')][_0x0b87('0x44')](_0x80827f);})[_0x0b87('0x25')](function(_0x49b27c){_0x4481de[_0x0b87('0x45')]=_0x49b27c;return _0x4481de;})[_0x0b87('0x25')](respondWithFilteredResult(_0x22e165,_0x80827f))['catch'](handleError(_0x22e165,null));};exports[_0x0b87('0x46')]=function(_0x5dfe96,_0x1f2662){var _0x19e586={'raw':![],'where':{'id':_0x5dfe96['params']['id']}},_0x4a4082={};_0x4a4082[_0x0b87('0x31')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x4a4082[_0x0b87('0x33')]=_[_0x0b87('0x34')](_0x5dfe96[_0x0b87('0x33')]);_0x4a4082['filters']=_[_0x0b87('0x36')](_0x4a4082[_0x0b87('0x31')],_0x4a4082['query']);_0x19e586[_0x0b87('0x38')]=_[_0x0b87('0x36')](_0x4a4082[_0x0b87('0x31')],qs['fields'](_0x5dfe96[_0x0b87('0x33')]['fields']));_0x19e586[_0x0b87('0x38')]=_0x19e586[_0x0b87('0x38')]['length']?_0x19e586[_0x0b87('0x38')]:_0x4a4082[_0x0b87('0x31')];if(_0x5dfe96[_0x0b87('0x33')][_0x0b87('0x47')]){_0x19e586[_0x0b87('0x42')]=[{'all':!![]}];}_0x19e586=_[_0x0b87('0x40')]({},_0x19e586,_0x5dfe96[_0x0b87('0x48')]);return db[_0x0b87('0x43')][_0x0b87('0x49')](_0x19e586)[_0x0b87('0x25')](handleEntityNotFound(_0x1f2662,null))[_0x0b87('0x25')](respondWithResult(_0x1f2662,null))[_0x0b87('0x4a')](handleError(_0x1f2662,null));};exports['create']=function(_0x555ad5,_0x429e8a){return db[_0x0b87('0x43')][_0x0b87('0x4b')](_0x555ad5[_0x0b87('0x4c')],{})[_0x0b87('0x25')](function(_0x480f6a){var _0x57dc32=_0x555ad5[_0x0b87('0x4d')][_0x0b87('0x26')]({'plain':!![]});if(!_0x57dc32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57dc32['role']===_0x0b87('0x4d')){var _0x2066d9=_0x480f6a[_0x0b87('0x26')]({'plain':!![]});var _0xf4907a=_0x0b87('0x27');return db[_0x0b87('0x4e')][_0x0b87('0x49')]({'where':{'name':_0xf4907a,'userProfileId':_0x57dc32[_0x0b87('0x4f')]},'raw':!![]})['then'](function(_0x4c51b6){if(_0x4c51b6&&_0x4c51b6[_0x0b87('0x50')]===0x0){return db[_0x0b87('0x28')][_0x0b87('0x4b')]({'name':_0x2066d9[_0x0b87('0x32')],'resourceId':_0x2066d9['id'],'type':_0x4c51b6[_0x0b87('0x32')],'sectionId':_0x4c51b6['id']},{})['then'](function(){return _0x480f6a;});}else{return _0x480f6a;}})[_0x0b87('0x4a')](function(_0x4e0865){logger[_0x0b87('0x29')](_0x0b87('0x51'),_0x4e0865);throw _0x4e0865;});}return _0x480f6a;})[_0x0b87('0x25')](respondWithResult(_0x429e8a,0xc9))[_0x0b87('0x4a')](handleError(_0x429e8a,null));};exports[_0x0b87('0x52')]=function(_0x462e29,_0x5c544d){var _0xaed888={'where':{'id':_0x462e29[_0x0b87('0x53')]['id']}},_0x1cbe36={};_0x1cbe36[_0x0b87('0x31')]=_['keys'](db[_0x0b87('0x43')]['rawAttributes']);_0xaed888[_0x0b87('0x38')]=_[_0x0b87('0x36')](_0x1cbe36['model'],qs[_0x0b87('0x37')](_0x462e29[_0x0b87('0x33')][_0x0b87('0x37')]));_0xaed888['attributes']=_0xaed888[_0x0b87('0x38')][_0x0b87('0x39')]?_0xaed888[_0x0b87('0x38')]:_0x1cbe36[_0x0b87('0x31')];if(_0x462e29['query'][_0x0b87('0x47')]){_0xaed888['include']=[{'all':!![]}];}_0xaed888=_[_0x0b87('0x40')]({},_0xaed888,_0x462e29[_0x0b87('0x48')]);return db[_0x0b87('0x43')][_0x0b87('0x49')](_0xaed888)[_0x0b87('0x25')](handleEntityNotFound(_0x5c544d,null))[_0x0b87('0x25')](function(_0x4192f6){if(_0x4192f6){var _0x3b7815=_0x4192f6[_0x0b87('0x26')]({'plain':!![]});_0x3b7815=qs[_0x0b87('0x54')](_0x3b7815,['id',_0x0b87('0x55'),_0x0b87('0x56')]);_0x462e29[_0x0b87('0x4c')]=_[_0x0b87('0x54')](_0x462e29[_0x0b87('0x4c')],['id',_0x0b87('0x55'),_0x0b87('0x56')]);return db[_0x0b87('0x43')]['create'](_['merge'](_0x3b7815,_0x462e29[_0x0b87('0x4c')]),{'include':_0x462e29['query'][_0x0b87('0x47')]?[{'all':!![]}]:undefined})[_0x0b87('0x25')](function(_0x4dd122){var _0x5c3ad4=_0x462e29[_0x0b87('0x4d')][_0x0b87('0x26')]({'plain':!![]});if(!_0x5c3ad4)throw new Error(_0x0b87('0x57'));if(_0x5c3ad4['role']===_0x0b87('0x4d')){var _0x13cc31=_0x4dd122[_0x0b87('0x26')]({'plain':!![]});var _0x34acfd=_0x0b87('0x27');return db[_0x0b87('0x4e')]['find']({'where':{'name':_0x34acfd,'userProfileId':_0x5c3ad4[_0x0b87('0x4f')]},'raw':!![]})[_0x0b87('0x25')](function(_0xd8e7a8){if(_0xd8e7a8&&_0xd8e7a8[_0x0b87('0x50')]===0x0){return db[_0x0b87('0x28')][_0x0b87('0x4b')]({'name':_0x13cc31[_0x0b87('0x32')],'resourceId':_0x13cc31['id'],'type':_0xd8e7a8[_0x0b87('0x32')],'sectionId':_0xd8e7a8['id']},{})[_0x0b87('0x25')](function(){return _0x4dd122;});}else{return _0x4dd122;}})[_0x0b87('0x4a')](function(_0x1f5fc4){logger[_0x0b87('0x29')](_0x0b87('0x51'),_0x1f5fc4);throw _0x1f5fc4;});}return _0x4dd122;});}})[_0x0b87('0x25')](respondWithResult(_0x5c544d,0xc9))[_0x0b87('0x4a')](handleError(_0x5c544d,null));};exports[_0x0b87('0x23')]=function(_0x2d3916,_0x2714ac){if(_0x2d3916[_0x0b87('0x4c')]['id']){delete _0x2d3916[_0x0b87('0x4c')]['id'];}return db[_0x0b87('0x43')][_0x0b87('0x49')]({'where':{'id':_0x2d3916[_0x0b87('0x53')]['id']}})[_0x0b87('0x25')](handleEntityNotFound(_0x2714ac,null))[_0x0b87('0x25')](saveUpdates(_0x2d3916[_0x0b87('0x4c')],null))[_0x0b87('0x25')](respondWithResult(_0x2714ac,null))[_0x0b87('0x4a')](handleError(_0x2714ac,null));};exports[_0x0b87('0x24')]=function(_0x5b52e6,_0x4defcb){return db['JscriptyProject'][_0x0b87('0x49')]({'where':{'id':_0x5b52e6[_0x0b87('0x53')]['id']}})[_0x0b87('0x25')](handleEntityNotFound(_0x4defcb,null))[_0x0b87('0x25')](removeEntity(_0x4defcb,null))['catch'](handleError(_0x4defcb,null));};exports[_0x0b87('0x58')]=function(_0x30e670,_0x43fe5f,_0x307fb0){var _0x3f30d9={'raw':!![],'where':{}};var _0x4e8c28={};var _0x3058f1={'count':0x0,'rows':[]};return db[_0x0b87('0x43')][_0x0b87('0x59')]({'where':{'id':_0x30e670['params']['id']}})[_0x0b87('0x25')](handleEntityNotFound(_0x43fe5f,null))[_0x0b87('0x25')](function(_0xe34f1a){if(_0xe34f1a){_0x4e8c28[_0x0b87('0x31')]=_[_0x0b87('0x34')](db['JscriptySessionReport'][_0x0b87('0x5a')]);_0x4e8c28['query']=_[_0x0b87('0x34')](_0x30e670[_0x0b87('0x33')]);_0x4e8c28[_0x0b87('0x35')]=_['intersection'](_0x4e8c28[_0x0b87('0x31')],_0x4e8c28[_0x0b87('0x33')]);_0x3f30d9[_0x0b87('0x38')]=_['intersection'](_0x4e8c28[_0x0b87('0x31')],qs[_0x0b87('0x37')](_0x30e670[_0x0b87('0x33')]['fields']));_0x3f30d9['attributes']=_0x3f30d9[_0x0b87('0x38')][_0x0b87('0x39')]?_0x3f30d9[_0x0b87('0x38')]:_0x4e8c28[_0x0b87('0x31')];if(!_0x30e670[_0x0b87('0x33')]['hasOwnProperty'](_0x0b87('0x5b'))){_0x3f30d9[_0x0b87('0x1d')]=qs[_0x0b87('0x1d')](_0x30e670[_0x0b87('0x33')][_0x0b87('0x1d')]);_0x3f30d9[_0x0b87('0x1c')]=qs['offset'](_0x30e670['query']['offset']);}_0x3f30d9[_0x0b87('0x3b')]=qs[_0x0b87('0x3c')](_0x30e670[_0x0b87('0x33')]['sort']);_0x3f30d9[_0x0b87('0x3d')]=qs[_0x0b87('0x35')](_[_0x0b87('0x3e')](_0x30e670[_0x0b87('0x33')],_0x4e8c28[_0x0b87('0x35')]));_0x3f30d9[_0x0b87('0x3d')][_0x0b87('0x5c')]=_0xe34f1a['id'];if(_0x30e670['query'][_0x0b87('0x3f')]){_0x3f30d9[_0x0b87('0x3d')]=_[_0x0b87('0x40')](_0x3f30d9[_0x0b87('0x3d')],{'$or':_[_0x0b87('0x2d')](_0x3f30d9[_0x0b87('0x38')],function(_0x15b72d){var _0x27f39f={};_0x27f39f[_0x15b72d]={'$like':'%'+_0x30e670[_0x0b87('0x33')]['filter']+'%'};return _0x27f39f;})});}_0x3f30d9=_[_0x0b87('0x40')]({},_0x3f30d9,_0x30e670[_0x0b87('0x48')]);return db[_0x0b87('0x5d')]['count']({'where':_0x3f30d9['where']})[_0x0b87('0x25')](function(_0x47fe81){_0x3058f1['count']=_0x47fe81;if(_0x30e670[_0x0b87('0x33')]['includeAll']){_0x3f30d9[_0x0b87('0x42')]=[{'all':!![]}];}return db[_0x0b87('0x5d')][_0x0b87('0x44')](_0x3f30d9);})[_0x0b87('0x25')](function(_0x2a7ca3){_0x3058f1[_0x0b87('0x45')]=_0x2a7ca3;return _0x3058f1;});}})[_0x0b87('0x25')](respondWithFilteredResult(_0x43fe5f,_0x3f30d9))[_0x0b87('0x4a')](handleError(_0x43fe5f,null));};exports[_0x0b87('0x5e')]=function(_0x44fc21,_0x33af6e,_0x62aab3){var _0x4536ec={'raw':!![],'where':{}};var _0x2e2b0f={};var _0x119bf5={'count':0x0,'rows':[]};return db[_0x0b87('0x43')]['findOne']({'where':{'id':_0x44fc21['params']['id']}})[_0x0b87('0x25')](handleEntityNotFound(_0x33af6e,null))[_0x0b87('0x25')](function(_0x2755b6){if(_0x2755b6){_0x2e2b0f[_0x0b87('0x31')]=_[_0x0b87('0x34')](db['JscriptyAnswerReport']['rawAttributes']);_0x2e2b0f[_0x0b87('0x33')]=_['keys'](_0x44fc21[_0x0b87('0x33')]);_0x2e2b0f[_0x0b87('0x35')]=_['intersection'](_0x2e2b0f[_0x0b87('0x31')],_0x2e2b0f[_0x0b87('0x33')]);_0x4536ec['attributes']=_[_0x0b87('0x36')](_0x2e2b0f['model'],qs['fields'](_0x44fc21[_0x0b87('0x33')][_0x0b87('0x37')]));_0x4536ec[_0x0b87('0x38')]=_0x4536ec[_0x0b87('0x38')]['length']?_0x4536ec[_0x0b87('0x38')]:_0x2e2b0f[_0x0b87('0x31')];if(!_0x44fc21[_0x0b87('0x33')][_0x0b87('0x3a')](_0x0b87('0x5b'))){_0x4536ec[_0x0b87('0x1d')]=qs[_0x0b87('0x1d')](_0x44fc21[_0x0b87('0x33')][_0x0b87('0x1d')]);_0x4536ec[_0x0b87('0x1c')]=qs[_0x0b87('0x1c')](_0x44fc21[_0x0b87('0x33')]['offset']);}_0x4536ec[_0x0b87('0x3b')]=qs[_0x0b87('0x3c')](_0x44fc21[_0x0b87('0x33')][_0x0b87('0x3c')]);_0x4536ec[_0x0b87('0x3d')]=qs[_0x0b87('0x35')](_[_0x0b87('0x3e')](_0x44fc21['query'],_0x2e2b0f[_0x0b87('0x35')]));_0x4536ec[_0x0b87('0x3d')][_0x0b87('0x5c')]=_0x2755b6['id'];if(_0x44fc21[_0x0b87('0x33')][_0x0b87('0x3f')]){_0x4536ec[_0x0b87('0x3d')]=_[_0x0b87('0x40')](_0x4536ec[_0x0b87('0x3d')],{'$or':_[_0x0b87('0x2d')](_0x4536ec[_0x0b87('0x38')],function(_0x473014){var _0x449dc2={};_0x449dc2[_0x473014]={'$like':'%'+_0x44fc21[_0x0b87('0x33')][_0x0b87('0x3f')]+'%'};return _0x449dc2;})});}_0x4536ec=_[_0x0b87('0x40')]({},_0x4536ec,_0x44fc21['options']);return db[_0x0b87('0x5f')][_0x0b87('0x1b')]({'where':_0x4536ec[_0x0b87('0x3d')]})[_0x0b87('0x25')](function(_0x285156){_0x119bf5[_0x0b87('0x1b')]=_0x285156;if(_0x44fc21['query'][_0x0b87('0x47')]){_0x4536ec['include']=[{'all':!![]}];}return db[_0x0b87('0x5f')][_0x0b87('0x44')](_0x4536ec);})['then'](function(_0xc8d03c){_0x119bf5['rows']=_0xc8d03c;return _0x119bf5;});}})[_0x0b87('0x25')](respondWithFilteredResult(_0x33af6e,_0x4536ec))[_0x0b87('0x4a')](handleError(_0x33af6e,null));};function char(_0x155c4d){return _0x0b87('0x60')===typeof _0x155c4d?String[_0x0b87('0x61')]['apply'](null,arguments):_0x155c4d;}function needsEncapsulation(_0x1c856d){return!!_0x1c856d&&(_0x1c856d[_0x0b87('0x62')]()['indexOf'](char(0xd))>=0x0||_0x1c856d[_0x0b87('0x62')]()[_0x0b87('0x63')](char(0xa))>=0x0||_0x1c856d[_0x0b87('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x1c856d[_0x0b87('0x62')]()[_0x0b87('0x63')](char(0x22))>=0x0);}function encapsulate(_0x80f122){var _0x41ba96=char(0x22),_0x411cf0='\x5c'+char(0x22),_0x2570c7=_0x80f122['toString']()[_0x0b87('0x64')](new RegExp(_0x41ba96,'g'),_0x411cf0);return _0x41ba96+_0x2570c7+_0x41ba96;}exports[_0x0b87('0x65')]=function(_0x1b1c6b,_0x539426,_0x7e3055){var _0x48713a,_0x1eb0b3;var _0x2c7a68={'where':{'ProjectId':_0x1b1c6b[_0x0b87('0x53')]['id']}};if(_0x1b1c6b[_0x0b87('0x33')][_0x0b87('0x66')]){_0x2c7a68['where'][_0x0b87('0x67')]=JSON['parse'](_0x1b1c6b['query'][_0x0b87('0x66')]);}return db[_0x0b87('0x5d')]['findAll'](_0x2c7a68)[_0x0b87('0x25')](handleEntityNotFound(_0x539426,null))[_0x0b87('0x25')](function(_0x2f49f4){if(_0x2f49f4){_0x48713a=_0x2f49f4;return db[_0x0b87('0x68')][_0x0b87('0x44')]({'where':{'SessionId':{'$in':_[_0x0b87('0x2d')](_0x48713a,'id')},'ProjectId':_0x1b1c6b[_0x0b87('0x53')]['id']},'order':'-createdAt'});}})[_0x0b87('0x25')](handleEntityNotFound(_0x539426,null))['then'](function(_0x11244d){if(_0x11244d){_0x1eb0b3=_0x11244d;var _0x534eb8={};for(var _0x583a0e=0x0,_0x420281=_0x1eb0b3[_0x0b87('0x39')];_0x583a0e<_0x420281;_0x583a0e++){if(!_0x534eb8[_0x0b87('0x3a')](_0x1eb0b3[_0x583a0e][_0x0b87('0x69')])){_0x534eb8[_0x1eb0b3[_0x583a0e][_0x0b87('0x69')]]=needsEncapsulation(_0x1eb0b3[_0x583a0e][_0x0b87('0x6a')])?encapsulate(_0x1eb0b3[_0x583a0e][_0x0b87('0x6a')]):_0x1eb0b3[_0x583a0e][_0x0b87('0x6a')];}}var _0xf303e6=[],_0xb8335d={};for(var _0x12aeb8=0x0,_0xde7452=_0x48713a[_0x0b87('0x39')];_0x12aeb8<_0xde7452;_0x12aeb8++){_0xb8335d={'ProjectId':_0x1b1c6b[_0x0b87('0x53')]['id'],'SessionId':_0x48713a[_0x12aeb8]['id'],'StartTime':moment(_0x48713a[_0x12aeb8][_0x0b87('0x67')])[_0x0b87('0x6b')](_0x0b87('0x6c'))};for(var _0x197671=0x0,_0x3747e2=_0x1eb0b3[_0x0b87('0x39')];_0x197671<_0x3747e2;_0x197671++){if(_0x1eb0b3[_0x197671][_0x0b87('0x6d')]==_0x48713a[_0x12aeb8]['id']&&_0x534eb8['hasOwnProperty'](_0x1eb0b3[_0x197671][_0x0b87('0x69')])){_0xb8335d[_0x534eb8[_0x1eb0b3[_0x197671][_0x0b87('0x69')]]]=_0x1eb0b3[_0x197671][_0x0b87('0x6e')];}}for(var _0x4e1daa in _0x534eb8){if(!_0xb8335d['hasOwnProperty'](_0x534eb8[_0x4e1daa])){_0xb8335d[_0x534eb8[_0x4e1daa]]=null;}}_0xf303e6[_0x0b87('0x6f')](_0xb8335d);}return _0xf303e6;}})[_0x0b87('0x25')](function(_0x88df16){if(!_[_0x0b87('0x70')](_0x88df16)){var _0xb01aef=toCsv(_0x88df16);var _0x19aba8=Date['now']();fs[_0x0b87('0x71')](util[_0x0b87('0x6b')](_0x0b87('0x72'),_0x1b1c6b[_0x0b87('0x53')]['id'],_0x19aba8),_0xb01aef);_0x539426['setHeader']('Content-disposition','attachment;\x20filename='+util[_0x0b87('0x6b')](_0x0b87('0x73'),_0x1b1c6b[_0x0b87('0x53')]['id'],_0x19aba8));_0x539426[_0x0b87('0x74')](_0x0b87('0x75'),_0x0b87('0x76'));return _0x539426[_0x0b87('0x77')](util['format'](_0x0b87('0x72'),_0x1b1c6b[_0x0b87('0x53')]['id'],_0x19aba8));}else{return _0x539426['sendStatus'](0xcc);}})[_0x0b87('0x4a')](handleError(_0x539426,null));}; \ No newline at end of file +var _0x6d51=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','createdAt','updatedAt','omit','getSessions','findOne','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','starttime','startTime','JscriptySessionReport','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','rimraf','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x546e26,_0x18fc24){var _0x4702e7=function(_0x96ba40){while(--_0x96ba40){_0x546e26['push'](_0x546e26['shift']());}};_0x4702e7(++_0x18fc24);}(_0x6d51,0x173));var _0x16d5=function(_0xfc6f76,_0x43044a){_0xfc6f76=_0xfc6f76-0x0;var _0xeaeef7=_0x6d51[_0xfc6f76];return _0xeaeef7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x16d5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x16d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x16d5('0x2'));var path=require(_0x16d5('0x3'));var sox=require(_0x16d5('0x4'));var csv=require(_0x16d5('0x5'));var ejs=require(_0x16d5('0x6'));var fs=require('fs');var _=require(_0x16d5('0x7'));var squel=require('squel');var crypto=require(_0x16d5('0x8'));var jsforce=require(_0x16d5('0x9'));var deskjs=require(_0x16d5('0xa'));var toCsv=require(_0x16d5('0x5'));var querystring=require(_0x16d5('0xb'));var Papa=require('papaparse');var Redis=require(_0x16d5('0xc'));var authService=require(_0x16d5('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x16d5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16d5('0xf'))(_0x16d5('0x10'));var utils=require(_0x16d5('0x11'));var config=require(_0x16d5('0x12'));var db=require(_0x16d5('0x13'))['db'];function respondWithStatusCode(_0x912b09,_0x1758e0){_0x1758e0=_0x1758e0||0xcc;return function(_0x3590c2){if(_0x3590c2){return _0x912b09['sendStatus'](_0x1758e0);}return _0x912b09[_0x16d5('0x14')](_0x1758e0)[_0x16d5('0x15')]();};}function respondWithResult(_0x19cbf7,_0x3cc650){_0x3cc650=_0x3cc650||0xc8;return function(_0x472825){if(_0x472825){return _0x19cbf7[_0x16d5('0x14')](_0x3cc650)[_0x16d5('0x16')](_0x472825);}};}function respondWithFilteredResult(_0x460a73,_0x1e6862){return function(_0x262329){if(_0x262329){var _0x4e72fd=_0x262329[_0x16d5('0x17')],_0x2407f0=_0x1e6862['offset'],_0x204d84=_0x1e6862[_0x16d5('0x18')]+_0x1e6862[_0x16d5('0x19')],_0x399c8e;if(_0x204d84>=_0x4e72fd){_0x204d84=_0x4e72fd;_0x399c8e=0xc8;}else{_0x399c8e=0xce;}_0x460a73['status'](_0x399c8e);return _0x460a73[_0x16d5('0x1a')](_0x16d5('0x1b'),_0x2407f0+'-'+_0x204d84+'/'+_0x4e72fd)[_0x16d5('0x16')](_0x262329);}return null;};}function patchUpdates(_0x25c3d2){return function(_0x2f0354){try{jsonpatch[_0x16d5('0x1c')](_0x2f0354,_0x25c3d2,!![]);}catch(_0x2e2e4d){return BPromise[_0x16d5('0x1d')](_0x2e2e4d);}return _0x2f0354[_0x16d5('0x1e')]();};}function saveUpdates(_0x1dc276,_0x568d49){return function(_0x147dc6){if(_0x147dc6){return _0x147dc6[_0x16d5('0x1f')](_0x1dc276)[_0x16d5('0x20')](function(_0xb678fe){return _0xb678fe;});}return null;};}function removeEntity(_0x5f4c55,_0x4d2883){return function(_0xfa0ea8){if(_0xfa0ea8){return _0xfa0ea8[_0x16d5('0x21')]()[_0x16d5('0x20')](function(){var _0xa4c542=_0xfa0ea8[_0x16d5('0x22')]({'plain':!![]});var _0x4a4ea6=_0x16d5('0x23');return db[_0x16d5('0x24')]['destroy']({'where':{'type':_0x4a4ea6,'resourceId':_0xa4c542['id']}})[_0x16d5('0x20')](function(){return _0xfa0ea8;});})[_0x16d5('0x20')](function(){_0x5f4c55[_0x16d5('0x14')](0xcc)[_0x16d5('0x15')]();});}};}function handleEntityNotFound(_0xd6ced4,_0x66ee0e){return function(_0x44db35){if(!_0x44db35){_0xd6ced4[_0x16d5('0x25')](0x194);}return _0x44db35;};}function handleError(_0x2b6c83,_0x4a204a){_0x4a204a=_0x4a204a||0x1f4;return function(_0xb64dc0){logger[_0x16d5('0x26')](_0xb64dc0[_0x16d5('0x27')]);if(_0xb64dc0[_0x16d5('0x28')]){delete _0xb64dc0['name'];}_0x2b6c83[_0x16d5('0x14')](_0x4a204a)[_0x16d5('0x29')](_0xb64dc0);};}exports[_0x16d5('0x2a')]=function(_0x316a19,_0xb7fbff){var _0x53715a={},_0x442861={},_0x15dbd5={'count':0x0,'rows':[]};var _0x4283bc=_[_0x16d5('0x2b')](db[_0x16d5('0x2c')]['rawAttributes'],function(_0x5b4fa0){return{'name':_0x5b4fa0[_0x16d5('0x2d')],'type':_0x5b4fa0[_0x16d5('0x2e')]['key']};});_0x442861[_0x16d5('0x2f')]=_[_0x16d5('0x2b')](_0x4283bc,_0x16d5('0x28'));_0x442861[_0x16d5('0x30')]=_[_0x16d5('0x31')](_0x316a19[_0x16d5('0x30')]);_0x442861[_0x16d5('0x32')]=_['intersection'](_0x442861[_0x16d5('0x2f')],_0x442861[_0x16d5('0x30')]);_0x53715a[_0x16d5('0x33')]=_[_0x16d5('0x34')](_0x442861[_0x16d5('0x2f')],qs[_0x16d5('0x35')](_0x316a19[_0x16d5('0x30')]['fields']));_0x53715a[_0x16d5('0x33')]=_0x53715a['attributes']['length']?_0x53715a[_0x16d5('0x33')]:_0x442861[_0x16d5('0x2f')];if(!_0x316a19[_0x16d5('0x30')][_0x16d5('0x36')](_0x16d5('0x37'))){_0x53715a[_0x16d5('0x19')]=qs[_0x16d5('0x19')](_0x316a19[_0x16d5('0x30')][_0x16d5('0x19')]);_0x53715a[_0x16d5('0x18')]=qs['offset'](_0x316a19[_0x16d5('0x30')]['offset']);}_0x53715a[_0x16d5('0x38')]=qs['sort'](_0x316a19[_0x16d5('0x30')][_0x16d5('0x39')]);_0x53715a['where']=qs[_0x16d5('0x32')](_[_0x16d5('0x3a')](_0x316a19[_0x16d5('0x30')],_0x442861[_0x16d5('0x32')]),_0x4283bc);if(_0x316a19[_0x16d5('0x30')][_0x16d5('0x3b')]){_0x53715a[_0x16d5('0x3c')]=_['merge'](_0x53715a['where'],{'$or':_['map'](_0x4283bc,function(_0x28a83b){if(_0x28a83b[_0x16d5('0x2e')]!==_0x16d5('0x3d')){var _0x558fe4={};_0x558fe4[_0x28a83b['name']]={'$like':'%'+_0x316a19[_0x16d5('0x30')][_0x16d5('0x3b')]+'%'};return _0x558fe4;}})});}_0x53715a=_[_0x16d5('0x3e')]({},_0x53715a,_0x316a19[_0x16d5('0x3f')]);var _0x1afe10={'where':_0x53715a[_0x16d5('0x3c')]};return db[_0x16d5('0x2c')]['count'](_0x1afe10)['then'](function(_0x5e41cb){_0x15dbd5[_0x16d5('0x17')]=_0x5e41cb;if(_0x316a19[_0x16d5('0x30')][_0x16d5('0x40')]){_0x53715a['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x16d5('0x41')](_0x53715a);})[_0x16d5('0x20')](function(_0x2ebb84){_0x15dbd5[_0x16d5('0x42')]=_0x2ebb84;return _0x15dbd5;})[_0x16d5('0x20')](respondWithFilteredResult(_0xb7fbff,_0x53715a))[_0x16d5('0x43')](handleError(_0xb7fbff,null));};exports['show']=function(_0x1dbbfb,_0x430c5d){var _0x47b653={'raw':![],'where':{'id':_0x1dbbfb[_0x16d5('0x44')]['id']}},_0x44606e={};_0x44606e[_0x16d5('0x2f')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x44606e['query']=_[_0x16d5('0x31')](_0x1dbbfb[_0x16d5('0x30')]);_0x44606e[_0x16d5('0x32')]=_[_0x16d5('0x34')](_0x44606e['model'],_0x44606e[_0x16d5('0x30')]);_0x47b653[_0x16d5('0x33')]=_[_0x16d5('0x34')](_0x44606e[_0x16d5('0x2f')],qs[_0x16d5('0x35')](_0x1dbbfb[_0x16d5('0x30')][_0x16d5('0x35')]));_0x47b653[_0x16d5('0x33')]=_0x47b653[_0x16d5('0x33')][_0x16d5('0x45')]?_0x47b653[_0x16d5('0x33')]:_0x44606e['model'];if(_0x1dbbfb[_0x16d5('0x30')][_0x16d5('0x40')]){_0x47b653[_0x16d5('0x46')]=[{'all':!![]}];}_0x47b653=_[_0x16d5('0x3e')]({},_0x47b653,_0x1dbbfb[_0x16d5('0x3f')]);return db[_0x16d5('0x2c')][_0x16d5('0x47')](_0x47b653)['then'](handleEntityNotFound(_0x430c5d,null))[_0x16d5('0x20')](respondWithResult(_0x430c5d,null))['catch'](handleError(_0x430c5d,null));};exports[_0x16d5('0x48')]=function(_0x14aa42,_0x160cf1){return db['JscriptyProject'][_0x16d5('0x48')](_0x14aa42[_0x16d5('0x49')],{})[_0x16d5('0x20')](function(_0x263df3){var _0x393f84=_0x14aa42[_0x16d5('0x4a')][_0x16d5('0x22')]({'plain':!![]});if(!_0x393f84)throw new Error(_0x16d5('0x4b'));if(_0x393f84[_0x16d5('0x4c')]===_0x16d5('0x4a')){var _0x58efec=_0x263df3[_0x16d5('0x22')]({'plain':!![]});var _0x2413be=_0x16d5('0x23');return db[_0x16d5('0x4d')][_0x16d5('0x47')]({'where':{'name':_0x2413be,'userProfileId':_0x393f84[_0x16d5('0x4e')]},'raw':!![]})[_0x16d5('0x20')](function(_0x240106){if(_0x240106&&_0x240106[_0x16d5('0x4f')]===0x0){return db[_0x16d5('0x24')][_0x16d5('0x48')]({'name':_0x58efec[_0x16d5('0x28')],'resourceId':_0x58efec['id'],'type':_0x240106[_0x16d5('0x28')],'sectionId':_0x240106['id']},{})[_0x16d5('0x20')](function(){return _0x263df3;});}else{return _0x263df3;}})[_0x16d5('0x43')](function(_0x5f00e5){logger[_0x16d5('0x26')](_0x16d5('0x50'),_0x5f00e5);throw _0x5f00e5;});}return _0x263df3;})['then'](respondWithResult(_0x160cf1,0xc9))['catch'](handleError(_0x160cf1,null));};exports[_0x16d5('0x51')]=function(_0x473904,_0x14fba1){var _0x369b6b={'where':{'id':_0x473904[_0x16d5('0x44')]['id']}},_0x5a36a7={};_0x5a36a7[_0x16d5('0x2f')]=_['keys'](db['JscriptyProject'][_0x16d5('0x52')]);_0x369b6b[_0x16d5('0x33')]=_[_0x16d5('0x34')](_0x5a36a7[_0x16d5('0x2f')],qs[_0x16d5('0x35')](_0x473904[_0x16d5('0x30')][_0x16d5('0x35')]));_0x369b6b[_0x16d5('0x33')]=_0x369b6b[_0x16d5('0x33')][_0x16d5('0x45')]?_0x369b6b[_0x16d5('0x33')]:_0x5a36a7[_0x16d5('0x2f')];if(_0x473904[_0x16d5('0x30')][_0x16d5('0x40')]){_0x369b6b[_0x16d5('0x46')]=[{'all':!![]}];}_0x369b6b=_[_0x16d5('0x3e')]({},_0x369b6b,_0x473904['options']);return db['JscriptyProject'][_0x16d5('0x47')](_0x369b6b)[_0x16d5('0x20')](handleEntityNotFound(_0x14fba1,null))[_0x16d5('0x20')](function(_0x8437f5){if(_0x8437f5){var _0x1ef4dd=_0x8437f5[_0x16d5('0x22')]({'plain':!![]});_0x1ef4dd=qs['omit'](_0x1ef4dd,['id',_0x16d5('0x53'),_0x16d5('0x54')]);_0x473904[_0x16d5('0x49')]=_[_0x16d5('0x55')](_0x473904[_0x16d5('0x49')],['id',_0x16d5('0x53'),_0x16d5('0x54')]);return db[_0x16d5('0x2c')]['create'](_[_0x16d5('0x3e')](_0x1ef4dd,_0x473904[_0x16d5('0x49')]),{'include':_0x473904[_0x16d5('0x30')][_0x16d5('0x40')]?[{'all':!![]}]:undefined})[_0x16d5('0x20')](function(_0x34c12f){var _0x49411d=_0x473904['user'][_0x16d5('0x22')]({'plain':!![]});if(!_0x49411d)throw new Error(_0x16d5('0x4b'));if(_0x49411d[_0x16d5('0x4c')]===_0x16d5('0x4a')){var _0x407d62=_0x34c12f['get']({'plain':!![]});var _0x199d4b='Projects';return db['UserProfileSection'][_0x16d5('0x47')]({'where':{'name':_0x199d4b,'userProfileId':_0x49411d[_0x16d5('0x4e')]},'raw':!![]})[_0x16d5('0x20')](function(_0x304829){if(_0x304829&&_0x304829[_0x16d5('0x4f')]===0x0){return db[_0x16d5('0x24')]['create']({'name':_0x407d62['name'],'resourceId':_0x407d62['id'],'type':_0x304829[_0x16d5('0x28')],'sectionId':_0x304829['id']},{})[_0x16d5('0x20')](function(){return _0x34c12f;});}else{return _0x34c12f;}})[_0x16d5('0x43')](function(_0x45cc6f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45cc6f);throw _0x45cc6f;});}return _0x34c12f;});}})[_0x16d5('0x20')](respondWithResult(_0x14fba1,0xc9))[_0x16d5('0x43')](handleError(_0x14fba1,null));};exports[_0x16d5('0x1f')]=function(_0x4e6579,_0x263271){if(_0x4e6579[_0x16d5('0x49')]['id']){delete _0x4e6579['body']['id'];}return db[_0x16d5('0x2c')]['find']({'where':{'id':_0x4e6579['params']['id']}})[_0x16d5('0x20')](handleEntityNotFound(_0x263271,null))[_0x16d5('0x20')](saveUpdates(_0x4e6579[_0x16d5('0x49')],null))[_0x16d5('0x20')](respondWithResult(_0x263271,null))[_0x16d5('0x43')](handleError(_0x263271,null));};exports[_0x16d5('0x21')]=function(_0x2db5ba,_0x1aff03){return db[_0x16d5('0x2c')][_0x16d5('0x47')]({'where':{'id':_0x2db5ba[_0x16d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aff03,null))['then'](removeEntity(_0x1aff03,null))[_0x16d5('0x43')](handleError(_0x1aff03,null));};exports[_0x16d5('0x56')]=function(_0xcb9a18,_0x3197fb,_0x143f1f){var _0x30fc31={'raw':!![],'where':{}};var _0xa52688={};var _0x196b4d={'count':0x0,'rows':[]};return db[_0x16d5('0x2c')][_0x16d5('0x57')]({'where':{'id':_0xcb9a18[_0x16d5('0x44')]['id']}})[_0x16d5('0x20')](handleEntityNotFound(_0x3197fb,null))[_0x16d5('0x20')](function(_0x8bea07){if(_0x8bea07){_0xa52688[_0x16d5('0x2f')]=_[_0x16d5('0x31')](db['JscriptySessionReport'][_0x16d5('0x52')]);_0xa52688[_0x16d5('0x30')]=_[_0x16d5('0x31')](_0xcb9a18[_0x16d5('0x30')]);_0xa52688['filters']=_[_0x16d5('0x34')](_0xa52688[_0x16d5('0x2f')],_0xa52688['query']);_0x30fc31['attributes']=_[_0x16d5('0x34')](_0xa52688[_0x16d5('0x2f')],qs['fields'](_0xcb9a18[_0x16d5('0x30')][_0x16d5('0x35')]));_0x30fc31[_0x16d5('0x33')]=_0x30fc31[_0x16d5('0x33')]['length']?_0x30fc31[_0x16d5('0x33')]:_0xa52688[_0x16d5('0x2f')];if(!_0xcb9a18[_0x16d5('0x30')][_0x16d5('0x36')](_0x16d5('0x37'))){_0x30fc31['limit']=qs[_0x16d5('0x19')](_0xcb9a18['query'][_0x16d5('0x19')]);_0x30fc31[_0x16d5('0x18')]=qs[_0x16d5('0x18')](_0xcb9a18[_0x16d5('0x30')][_0x16d5('0x18')]);}_0x30fc31[_0x16d5('0x38')]=qs[_0x16d5('0x39')](_0xcb9a18[_0x16d5('0x30')][_0x16d5('0x39')]);_0x30fc31['where']=qs[_0x16d5('0x32')](_[_0x16d5('0x3a')](_0xcb9a18['query'],_0xa52688[_0x16d5('0x32')]));_0x30fc31['where'][_0x16d5('0x58')]=_0x8bea07['id'];if(_0xcb9a18[_0x16d5('0x30')]['filter']){_0x30fc31[_0x16d5('0x3c')]=_[_0x16d5('0x3e')](_0x30fc31[_0x16d5('0x3c')],{'$or':_[_0x16d5('0x2b')](_0x30fc31[_0x16d5('0x33')],function(_0x5673d1){var _0x5dfdf3={};_0x5dfdf3[_0x5673d1]={'$like':'%'+_0xcb9a18[_0x16d5('0x30')]['filter']+'%'};return _0x5dfdf3;})});}_0x30fc31=_['merge']({},_0x30fc31,_0xcb9a18['options']);return db['JscriptySessionReport']['count']({'where':_0x30fc31['where']})[_0x16d5('0x20')](function(_0x44ef5b){_0x196b4d[_0x16d5('0x17')]=_0x44ef5b;if(_0xcb9a18['query']['includeAll']){_0x30fc31['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x30fc31);})['then'](function(_0x16c01b){_0x196b4d[_0x16d5('0x42')]=_0x16c01b;return _0x196b4d;});}})[_0x16d5('0x20')](respondWithFilteredResult(_0x3197fb,_0x30fc31))[_0x16d5('0x43')](handleError(_0x3197fb,null));};exports['getAnswers']=function(_0x3ecc3d,_0x29aba9,_0x32241b){var _0x17ac10={'raw':!![],'where':{}};var _0x4c141e={};var _0x6d1701={'count':0x0,'rows':[]};return db[_0x16d5('0x2c')][_0x16d5('0x57')]({'where':{'id':_0x3ecc3d[_0x16d5('0x44')]['id']}})[_0x16d5('0x20')](handleEntityNotFound(_0x29aba9,null))[_0x16d5('0x20')](function(_0x3cb7f9){if(_0x3cb7f9){_0x4c141e['model']=_[_0x16d5('0x31')](db[_0x16d5('0x59')]['rawAttributes']);_0x4c141e[_0x16d5('0x30')]=_[_0x16d5('0x31')](_0x3ecc3d[_0x16d5('0x30')]);_0x4c141e[_0x16d5('0x32')]=_[_0x16d5('0x34')](_0x4c141e[_0x16d5('0x2f')],_0x4c141e[_0x16d5('0x30')]);_0x17ac10['attributes']=_[_0x16d5('0x34')](_0x4c141e[_0x16d5('0x2f')],qs['fields'](_0x3ecc3d['query'][_0x16d5('0x35')]));_0x17ac10['attributes']=_0x17ac10[_0x16d5('0x33')][_0x16d5('0x45')]?_0x17ac10[_0x16d5('0x33')]:_0x4c141e[_0x16d5('0x2f')];if(!_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x36')](_0x16d5('0x37'))){_0x17ac10['limit']=qs[_0x16d5('0x19')](_0x3ecc3d[_0x16d5('0x30')]['limit']);_0x17ac10[_0x16d5('0x18')]=qs[_0x16d5('0x18')](_0x3ecc3d[_0x16d5('0x30')]['offset']);}_0x17ac10[_0x16d5('0x38')]=qs[_0x16d5('0x39')](_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x39')]);_0x17ac10['where']=qs[_0x16d5('0x32')](_[_0x16d5('0x3a')](_0x3ecc3d[_0x16d5('0x30')],_0x4c141e['filters']));_0x17ac10['where'][_0x16d5('0x58')]=_0x3cb7f9['id'];if(_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x3b')]){_0x17ac10['where']=_[_0x16d5('0x3e')](_0x17ac10['where'],{'$or':_['map'](_0x17ac10['attributes'],function(_0x4ea24c){var _0x3f5532={};_0x3f5532[_0x4ea24c]={'$like':'%'+_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x3b')]+'%'};return _0x3f5532;})});}_0x17ac10=_[_0x16d5('0x3e')]({},_0x17ac10,_0x3ecc3d[_0x16d5('0x3f')]);return db[_0x16d5('0x59')][_0x16d5('0x17')]({'where':_0x17ac10['where']})[_0x16d5('0x20')](function(_0x1ff55d){_0x6d1701[_0x16d5('0x17')]=_0x1ff55d;if(_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x40')]){_0x17ac10[_0x16d5('0x46')]=[{'all':!![]}];}return db[_0x16d5('0x59')][_0x16d5('0x41')](_0x17ac10);})[_0x16d5('0x20')](function(_0xf2d522){_0x6d1701['rows']=_0xf2d522;return _0x6d1701;});}})['then'](respondWithFilteredResult(_0x29aba9,_0x17ac10))[_0x16d5('0x43')](handleError(_0x29aba9,null));};function char(_0x192e40){return _0x16d5('0x5a')===typeof _0x192e40?String[_0x16d5('0x5b')][_0x16d5('0x1c')](null,arguments):_0x192e40;}function needsEncapsulation(_0x27cbe9){return!!_0x27cbe9&&(_0x27cbe9[_0x16d5('0x5c')]()[_0x16d5('0x5d')](char(0xd))>=0x0||_0x27cbe9['toString']()['indexOf'](char(0xa))>=0x0||_0x27cbe9[_0x16d5('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x27cbe9[_0x16d5('0x5c')]()[_0x16d5('0x5d')](char(0x22))>=0x0);}function encapsulate(_0xa50dec){var _0x4e3f0a=char(0x22),_0x3dd25c='\x5c'+char(0x22),_0x28f27e=_0xa50dec[_0x16d5('0x5c')]()['replace'](new RegExp(_0x4e3f0a,'g'),_0x3dd25c);return _0x4e3f0a+_0x28f27e+_0x4e3f0a;}exports[_0x16d5('0x5e')]=function(_0x127fd5,_0x30460e,_0x236a3d){var _0x1c579a,_0x361dd6;var _0xa318db={'where':{'ProjectId':_0x127fd5[_0x16d5('0x44')]['id']}};if(_0x127fd5[_0x16d5('0x30')]['startTime']){_0xa318db[_0x16d5('0x3c')][_0x16d5('0x5f')]=JSON['parse'](_0x127fd5[_0x16d5('0x30')][_0x16d5('0x60')]);}return db[_0x16d5('0x61')][_0x16d5('0x41')](_0xa318db)[_0x16d5('0x20')](handleEntityNotFound(_0x30460e,null))[_0x16d5('0x20')](function(_0x4e178a){if(_0x4e178a){_0x1c579a=_0x4e178a;return db[_0x16d5('0x62')]['findAll']({'where':{'SessionId':{'$in':_[_0x16d5('0x2b')](_0x1c579a,'id')},'ProjectId':_0x127fd5[_0x16d5('0x44')]['id']},'order':_0x16d5('0x63')});}})[_0x16d5('0x20')](handleEntityNotFound(_0x30460e,null))[_0x16d5('0x20')](function(_0x34253b){if(_0x34253b){_0x361dd6=_0x34253b;var _0x1f7e11={};for(var _0x55ea61=0x0,_0x5b3c73=_0x361dd6[_0x16d5('0x45')];_0x55ea61<_0x5b3c73;_0x55ea61++){if(!_0x1f7e11['hasOwnProperty'](_0x361dd6[_0x55ea61]['questionId'])){_0x1f7e11[_0x361dd6[_0x55ea61][_0x16d5('0x64')]]=needsEncapsulation(_0x361dd6[_0x55ea61][_0x16d5('0x65')])?encapsulate(_0x361dd6[_0x55ea61][_0x16d5('0x65')]):_0x361dd6[_0x55ea61][_0x16d5('0x65')];}}var _0x475634=[],_0x20067e={};for(var _0xac2730=0x0,_0xa7a5cd=_0x1c579a[_0x16d5('0x45')];_0xac2730<_0xa7a5cd;_0xac2730++){_0x20067e={'ProjectId':_0x127fd5[_0x16d5('0x44')]['id'],'SessionId':_0x1c579a[_0xac2730]['id'],'StartTime':moment(_0x1c579a[_0xac2730][_0x16d5('0x5f')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x59a4d2=0x0,_0x55519d=_0x361dd6[_0x16d5('0x45')];_0x59a4d2<_0x55519d;_0x59a4d2++){if(_0x361dd6[_0x59a4d2][_0x16d5('0x66')]==_0x1c579a[_0xac2730]['id']&&_0x1f7e11[_0x16d5('0x36')](_0x361dd6[_0x59a4d2][_0x16d5('0x64')])){_0x20067e[_0x1f7e11[_0x361dd6[_0x59a4d2][_0x16d5('0x64')]]]=_0x361dd6[_0x59a4d2][_0x16d5('0x67')];}}for(var _0x49ea0a in _0x1f7e11){if(!_0x20067e['hasOwnProperty'](_0x1f7e11[_0x49ea0a])){_0x20067e[_0x1f7e11[_0x49ea0a]]=null;}}_0x475634['push'](_0x20067e);}return _0x475634;}})[_0x16d5('0x20')](function(_0x46769e){if(!_[_0x16d5('0x68')](_0x46769e)){var _0x345988=toCsv(_0x46769e);var _0x22ab91=Date['now']();fs[_0x16d5('0x69')](util[_0x16d5('0x6a')](_0x16d5('0x6b'),_0x127fd5[_0x16d5('0x44')]['id'],_0x22ab91),_0x345988);_0x30460e[_0x16d5('0x6c')](_0x16d5('0x6d'),_0x16d5('0x6e')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x127fd5['params']['id'],_0x22ab91));_0x30460e[_0x16d5('0x6c')](_0x16d5('0x6f'),'text/csv');return _0x30460e['download'](util[_0x16d5('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x127fd5[_0x16d5('0x44')]['id'],_0x22ab91));}else{return _0x30460e[_0x16d5('0x25')](0xcc);}})[_0x16d5('0x43')](handleError(_0x30460e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index eed6ea9..c7e6f4a 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 _0x8567=['bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment'];(function(_0x5b099c,_0x3cbab2){var _0x6fc6cb=function(_0x4fa3ac){while(--_0x4fa3ac){_0x5b099c['push'](_0x5b099c['shift']());}};_0x6fc6cb(++_0x3cbab2);}(_0x8567,0x8b));var _0x7856=function(_0x1e3035,_0x26e2c7){_0x1e3035=_0x1e3035-0x0;var _0x5268da=_0x8567[_0x1e3035];return _0x5268da;};'use strict';var _=require(_0x7856('0x0'));var util=require(_0x7856('0x1'));var logger=require(_0x7856('0x2'))(_0x7856('0x3'));var moment=require(_0x7856('0x4'));var BPromise=require(_0x7856('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7856('0x6'));var rimraf=require(_0x7856('0x7'));var config=require(_0x7856('0x8'));var attributes=require(_0x7856('0x9'));module['exports']=function(_0x322a2b,_0x493f55){return _0x322a2b['define'](_0x7856('0xa'),attributes,{'tableName':_0x7856('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x446e=['jscripty_projects','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','JscriptyProject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x446e,0x1f0));var _0xe446=function(_0x2e6660,_0x35d5b9){_0x2e6660=_0x2e6660-0x0;var _0x8241ed=_0x446e[_0x2e6660];return _0x8241ed;};'use strict';var _=require(_0xe446('0x0'));var util=require(_0xe446('0x1'));var logger=require('../../config/logger')(_0xe446('0x2'));var moment=require(_0xe446('0x3'));var BPromise=require(_0xe446('0x4'));var rp=require(_0xe446('0x5'));var fs=require('fs');var path=require(_0xe446('0x6'));var rimraf=require(_0xe446('0x7'));var config=require(_0xe446('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x52b114,_0x1d1444){return _0x52b114['define'](_0xe446('0x9'),attributes,{'tableName':_0xe446('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 1bc6cf0..bb06061 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 _0x9e57=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x9e57,0x165));var _0x79e5=function(_0x28f2cf,_0x1de725){_0x28f2cf=_0x28f2cf-0x0;var _0x2411b2=_0x9e57[_0x28f2cf];return _0x2411b2;};'use strict';var _=require(_0x79e5('0x0'));var util=require(_0x79e5('0x1'));var moment=require(_0x79e5('0x2'));var BPromise=require('bluebird');var rs=require(_0x79e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79e5('0x4'))['db'];var utils=require(_0x79e5('0x5'));var logger=require(_0x79e5('0x6'))(_0x79e5('0x7'));var config=require(_0x79e5('0x8'));var jayson=require(_0x79e5('0x9'));var client=jayson[_0x79e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e87ee,_0x28f655,_0x54f0b0){return new BPromise(function(_0x2c497d,_0x2d7e03){return client[_0x79e5('0xb')](_0x3e87ee,_0x54f0b0)[_0x79e5('0xc')](function(_0x52b9ed){logger[_0x79e5('0xd')](_0x79e5('0xe'),_0x28f655,'request\x20sent');logger[_0x79e5('0xf')](_0x79e5('0x10'),_0x28f655,_0x79e5('0x11'),JSON[_0x79e5('0x12')](_0x52b9ed));if(_0x52b9ed[_0x79e5('0x13')]){if(_0x52b9ed[_0x79e5('0x13')][_0x79e5('0x14')]===0x1f4){logger[_0x79e5('0x13')](_0x79e5('0xe'),_0x28f655,_0x52b9ed[_0x79e5('0x13')][_0x79e5('0x15')]);return _0x2d7e03(_0x52b9ed[_0x79e5('0x13')]['message']);}logger[_0x79e5('0x13')](_0x79e5('0xe'),_0x28f655,_0x52b9ed[_0x79e5('0x13')]['message']);return _0x2c497d(_0x52b9ed[_0x79e5('0x13')][_0x79e5('0x15')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x28f655,'request\x20sent');_0x2c497d(_0x52b9ed[_0x79e5('0x16')][_0x79e5('0x15')]);}})[_0x79e5('0x17')](function(_0x4ff75b){logger[_0x79e5('0x13')](_0x79e5('0xe'),_0x28f655,_0x4ff75b);_0x2d7e03(_0x4ff75b);});});} \ No newline at end of file +var _0x9148=['then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xc3b746,_0x437056){var _0x9264dc=function(_0x10ad6a){while(--_0x10ad6a){_0xc3b746['push'](_0xc3b746['shift']());}};_0x9264dc(++_0x437056);}(_0x9148,0x1ab));var _0x8914=function(_0x843c14,_0x2368d5){_0x843c14=_0x843c14-0x0;var _0x433454=_0x9148[_0x843c14];return _0x433454;};'use strict';var _=require(_0x8914('0x0'));var util=require(_0x8914('0x1'));var moment=require(_0x8914('0x2'));var BPromise=require(_0x8914('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8914('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8914('0x5'));var logger=require(_0x8914('0x6'))(_0x8914('0x7'));var config=require(_0x8914('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8914('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44556f,_0x2567e9,_0x586b39){return new BPromise(function(_0xcc434,_0x379eea){return client['request'](_0x44556f,_0x586b39)[_0x8914('0xa')](function(_0x2c6ef2){logger[_0x8914('0xb')](_0x8914('0xc'),_0x2567e9,_0x8914('0xd'));logger[_0x8914('0xe')](_0x8914('0xf'),_0x2567e9,'request\x20sent',JSON['stringify'](_0x2c6ef2));if(_0x2c6ef2[_0x8914('0x10')]){if(_0x2c6ef2[_0x8914('0x10')]['code']===0x1f4){logger[_0x8914('0x10')](_0x8914('0xc'),_0x2567e9,_0x2c6ef2[_0x8914('0x10')][_0x8914('0x11')]);return _0x379eea(_0x2c6ef2[_0x8914('0x10')][_0x8914('0x11')]);}logger['error'](_0x8914('0xc'),_0x2567e9,_0x2c6ef2['error'][_0x8914('0x11')]);return _0xcc434(_0x2c6ef2[_0x8914('0x10')]['message']);}else{logger[_0x8914('0xb')](_0x8914('0xc'),_0x2567e9,_0x8914('0xd'));_0xcc434(_0x2c6ef2['result']['message']);}})[_0x8914('0x12')](function(_0x4a840a){logger[_0x8914('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x2567e9,_0x4a840a);_0x379eea(_0x4a840a);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 69bd71e..0bc3fdb 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 _0x2c2a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x120404,_0x474f63){var _0x4f70d6=function(_0x54fe59){while(--_0x54fe59){_0x120404['push'](_0x120404['shift']());}};_0x4f70d6(++_0x474f63);}(_0x2c2a,0x94));var _0xa2c2=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2c2a[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xa2c2('0x0'));var util=require(_0xa2c2('0x1'));var path=require(_0xa2c2('0x2'));var timeout=require(_0xa2c2('0x3'));var express=require(_0xa2c2('0x4'));var router=express[_0xa2c2('0x5')]();var auth=require(_0xa2c2('0x6'));var interaction=require(_0xa2c2('0x7'));var config=require(_0xa2c2('0x8'));var controller=require(_0xa2c2('0x9'));router[_0xa2c2('0xa')]('/',auth['isAuthenticated'](),controller[_0xa2c2('0xb')]);router[_0xa2c2('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa2c2('0xa')](_0xa2c2('0xc'),auth[_0xa2c2('0xd')](),controller[_0xa2c2('0xe')]);router[_0xa2c2('0xf')]('/',auth[_0xa2c2('0xd')](),controller[_0xa2c2('0x10')]);router[_0xa2c2('0x11')](_0xa2c2('0xc'),auth[_0xa2c2('0xd')](),controller[_0xa2c2('0x12')]);router[_0xa2c2('0x13')]('/:id',auth[_0xa2c2('0xd')](),controller[_0xa2c2('0x14')]);module[_0xa2c2('0x15')]=router; \ No newline at end of file +var _0x278b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put'];(function(_0x3c6f40,_0x59119e){var _0x16f167=function(_0x295a0d){while(--_0x295a0d){_0x3c6f40['push'](_0x3c6f40['shift']());}};_0x16f167(++_0x59119e);}(_0x278b,0x1bc));var _0xb278=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x278b[_0x51ac09];return _0x3f827d;};'use strict';var multer=require('multer');var util=require(_0xb278('0x0'));var path=require(_0xb278('0x1'));var timeout=require(_0xb278('0x2'));var express=require('express');var router=express[_0xb278('0x3')]();var auth=require(_0xb278('0x4'));var interaction=require(_0xb278('0x5'));var config=require(_0xb278('0x6'));var controller=require(_0xb278('0x7'));router[_0xb278('0x8')]('/',auth[_0xb278('0x9')](),controller['index']);router['get'](_0xb278('0xa'),auth[_0xb278('0x9')](),controller['describe']);router['get'](_0xb278('0xb'),auth[_0xb278('0x9')](),controller[_0xb278('0xc')]);router[_0xb278('0xd')]('/',auth[_0xb278('0x9')](),controller[_0xb278('0xe')]);router[_0xb278('0xf')](_0xb278('0xb'),auth[_0xb278('0x9')](),controller[_0xb278('0x10')]);router[_0xb278('0x11')]('/:id',auth[_0xb278('0x9')](),controller[_0xb278('0x12')]);module[_0xb278('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index df84e4a..b39ba4d 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 _0xbf5e=['STRING','sequelize','exports'];(function(_0x3087cc,_0x4ccde7){var _0x1c15ab=function(_0x50297e){while(--_0x50297e){_0x3087cc['push'](_0x3087cc['shift']());}};_0x1c15ab(++_0x4ccde7);}(_0xbf5e,0x97));var _0xebf5=function(_0xa72ac3,_0x333647){_0xa72ac3=_0xa72ac3-0x0;var _0x13a920=_0xbf5e[_0xa72ac3];return _0x13a920;};'use strict';var Sequelize=require(_0xebf5('0x0'));module[_0xebf5('0x1')]={'question':{'type':Sequelize[_0xebf5('0x2')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0xebf5('0x2')]},'projectname':{'type':Sequelize[_0xebf5('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xebf5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xebf5('0x2')]},'questionId':{'type':Sequelize[_0xebf5('0x2')]}}; \ No newline at end of file +var _0x1d3c=['STRING','TEXT','long','sequelize','exports'];(function(_0x258bd8,_0x1ec976){var _0x1f2dfd=function(_0x35b0a3){while(--_0x35b0a3){_0x258bd8['push'](_0x258bd8['shift']());}};_0x1f2dfd(++_0x1ec976);}(_0x1d3c,0x1ac));var _0xc1d3=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x1d3c[_0x2af29a];return _0x5ef02f;};'use strict';var Sequelize=require(_0xc1d3('0x0'));module[_0xc1d3('0x1')]={'question':{'type':Sequelize[_0xc1d3('0x2')]},'answer':{'type':Sequelize[_0xc1d3('0x3')](_0xc1d3('0x4'))},'membername':{'type':Sequelize[_0xc1d3('0x2')]},'projectname':{'type':Sequelize[_0xc1d3('0x2')]},'queue':{'type':Sequelize[_0xc1d3('0x2')]},'uniqueid':{'type':Sequelize[_0xc1d3('0x2')]},'calleridname':{'type':Sequelize[_0xc1d3('0x2')]},'calleridnum':{'type':Sequelize[_0xc1d3('0x2')]},'questionId':{'type':Sequelize[_0xc1d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 0c380b6..f9045fb 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 _0x760e=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','JscriptyQuestionReport','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x760e,0x119));var _0xe760=function(_0x13a3eb,_0x2f5273){_0x13a3eb=_0x13a3eb-0x0;var _0x40815a=_0x760e[_0x13a3eb];return _0x40815a;};'use strict';var pdf=require(_0xe760('0x0'));var emlformat=require(_0xe760('0x1'));var rimraf=require(_0xe760('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe760('0x3'));var rp=require(_0xe760('0x4'));var moment=require(_0xe760('0x5'));var BPromise=require(_0xe760('0x6'));var Mustache=require(_0xe760('0x7'));var util=require(_0xe760('0x8'));var path=require(_0xe760('0x9'));var sox=require(_0xe760('0xa'));var csv=require(_0xe760('0xb'));var ejs=require(_0xe760('0xc'));var fs=require('fs');var _=require(_0xe760('0xd'));var squel=require('squel');var crypto=require(_0xe760('0xe'));var jsforce=require(_0xe760('0xf'));var deskjs=require(_0xe760('0x10'));var toCsv=require(_0xe760('0xb'));var querystring=require(_0xe760('0x11'));var Papa=require(_0xe760('0x12'));var Redis=require(_0xe760('0x13'));var authService=require(_0xe760('0x14'));var qs=require(_0xe760('0x15'));var as=require(_0xe760('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe760('0x17'));var utils=require(_0xe760('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b5f72,_0x1d68d0){_0x1d68d0=_0x1d68d0||0xcc;return function(_0x310429){if(_0x310429){return _0x2b5f72[_0xe760('0x19')](_0x1d68d0);}return _0x2b5f72[_0xe760('0x1a')](_0x1d68d0)['end']();};}function respondWithResult(_0x2b9b0f,_0x332ca8){_0x332ca8=_0x332ca8||0xc8;return function(_0x1239bb){if(_0x1239bb){return _0x2b9b0f[_0xe760('0x1a')](_0x332ca8)[_0xe760('0x1b')](_0x1239bb);}};}function respondWithFilteredResult(_0x38df89,_0x5d5ea1){return function(_0x34c517){if(_0x34c517){var _0x241175=_0x34c517[_0xe760('0x1c')],_0x41be70=_0x5d5ea1[_0xe760('0x1d')],_0x3d86f=_0x5d5ea1[_0xe760('0x1d')]+_0x5d5ea1[_0xe760('0x1e')],_0x3aa468;if(_0x3d86f>=_0x241175){_0x3d86f=_0x241175;_0x3aa468=0xc8;}else{_0x3aa468=0xce;}_0x38df89['status'](_0x3aa468);return _0x38df89['set'](_0xe760('0x1f'),_0x41be70+'-'+_0x3d86f+'/'+_0x241175)[_0xe760('0x1b')](_0x34c517);}return null;};}function patchUpdates(_0x1c51b1){return function(_0x427f78){try{jsonpatch[_0xe760('0x20')](_0x427f78,_0x1c51b1,!![]);}catch(_0x50c078){return BPromise[_0xe760('0x21')](_0x50c078);}return _0x427f78['save']();};}function saveUpdates(_0x5d3a4c,_0x5e9c40){return function(_0x5931df){if(_0x5931df){return _0x5931df['update'](_0x5d3a4c)[_0xe760('0x22')](function(_0x1e37e2){return _0x1e37e2;});}return null;};}function removeEntity(_0x20dedc,_0x89df28){return function(_0x5d5a87){if(_0x5d5a87){return _0x5d5a87[_0xe760('0x23')]()[_0xe760('0x22')](function(){_0x20dedc[_0xe760('0x1a')](0xcc)[_0xe760('0x24')]();});}};}function handleEntityNotFound(_0x14676c,_0x44bdf7){return function(_0x2888ad){if(!_0x2888ad){_0x14676c['sendStatus'](0x194);}return _0x2888ad;};}function handleError(_0x5b33bd,_0x100246){_0x100246=_0x100246||0x1f4;return function(_0x19fed2){logger['error'](_0x19fed2[_0xe760('0x25')]);if(_0x19fed2[_0xe760('0x26')]){delete _0x19fed2[_0xe760('0x26')];}_0x5b33bd['status'](_0x100246)[_0xe760('0x27')](_0x19fed2);};}exports[_0xe760('0x28')]=function(_0xcdbd68,_0x40d9f6){var _0x5a27ef={},_0x1cf405={},_0x5a70fa={'count':0x0,'rows':[]};var _0x39a0a2=_[_0xe760('0x29')](db['JscriptyQuestionReport'][_0xe760('0x2a')],function(_0x36f0b9){return{'name':_0x36f0b9[_0xe760('0x2b')],'type':_0x36f0b9[_0xe760('0x2c')][_0xe760('0x2d')]};});_0x1cf405['model']=_[_0xe760('0x29')](_0x39a0a2,_0xe760('0x26'));_0x1cf405['query']=_[_0xe760('0x2e')](_0xcdbd68['query']);_0x1cf405[_0xe760('0x2f')]=_[_0xe760('0x30')](_0x1cf405[_0xe760('0x31')],_0x1cf405[_0xe760('0x32')]);_0x5a27ef[_0xe760('0x33')]=_[_0xe760('0x30')](_0x1cf405[_0xe760('0x31')],qs[_0xe760('0x34')](_0xcdbd68[_0xe760('0x32')][_0xe760('0x34')]));_0x5a27ef['attributes']=_0x5a27ef[_0xe760('0x33')][_0xe760('0x35')]?_0x5a27ef['attributes']:_0x1cf405[_0xe760('0x31')];if(!_0xcdbd68[_0xe760('0x32')][_0xe760('0x36')](_0xe760('0x37'))){_0x5a27ef[_0xe760('0x1e')]=qs[_0xe760('0x1e')](_0xcdbd68['query']['limit']);_0x5a27ef['offset']=qs['offset'](_0xcdbd68['query'][_0xe760('0x1d')]);}_0x5a27ef[_0xe760('0x38')]=qs['sort'](_0xcdbd68[_0xe760('0x32')][_0xe760('0x39')]);_0x5a27ef['where']=qs['filters'](_[_0xe760('0x3a')](_0xcdbd68[_0xe760('0x32')],_0x1cf405[_0xe760('0x2f')]),_0x39a0a2);if(_0xcdbd68['query'][_0xe760('0x3b')]){_0x5a27ef[_0xe760('0x3c')]=_['merge'](_0x5a27ef['where'],{'$or':_['map'](_0x39a0a2,function(_0x3e5108){if(_0x3e5108[_0xe760('0x2c')]!==_0xe760('0x3d')){var _0xf94cc2={};_0xf94cc2[_0x3e5108[_0xe760('0x26')]]={'$like':'%'+_0xcdbd68['query'][_0xe760('0x3b')]+'%'};return _0xf94cc2;}})});}_0x5a27ef=_[_0xe760('0x3e')]({},_0x5a27ef,_0xcdbd68[_0xe760('0x3f')]);var _0x263f8e={'where':_0x5a27ef[_0xe760('0x3c')]};return db[_0xe760('0x40')][_0xe760('0x1c')](_0x263f8e)['then'](function(_0xd8802e){_0x5a70fa['count']=_0xd8802e;if(_0xcdbd68['query'][_0xe760('0x41')]){_0x5a27ef[_0xe760('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x5a27ef);})[_0xe760('0x22')](function(_0xd1e25){_0x5a70fa[_0xe760('0x43')]=_0xd1e25;return _0x5a70fa;})['then'](respondWithFilteredResult(_0x40d9f6,_0x5a27ef))[_0xe760('0x44')](handleError(_0x40d9f6,null));};exports[_0xe760('0x45')]=function(_0x227261,_0x41d340){var _0xe5718d={'raw':!![],'where':{'id':_0x227261[_0xe760('0x46')]['id']}},_0x344bb0={};_0x344bb0[_0xe760('0x31')]=_[_0xe760('0x2e')](db['JscriptyQuestionReport'][_0xe760('0x2a')]);_0x344bb0[_0xe760('0x32')]=_[_0xe760('0x2e')](_0x227261[_0xe760('0x32')]);_0x344bb0[_0xe760('0x2f')]=_[_0xe760('0x30')](_0x344bb0[_0xe760('0x31')],_0x344bb0[_0xe760('0x32')]);_0xe5718d[_0xe760('0x33')]=_[_0xe760('0x30')](_0x344bb0[_0xe760('0x31')],qs[_0xe760('0x34')](_0x227261[_0xe760('0x32')][_0xe760('0x34')]));_0xe5718d[_0xe760('0x33')]=_0xe5718d['attributes'][_0xe760('0x35')]?_0xe5718d['attributes']:_0x344bb0[_0xe760('0x31')];if(_0x227261[_0xe760('0x32')]['includeAll']){_0xe5718d[_0xe760('0x42')]=[{'all':!![]}];}_0xe5718d=_['merge']({},_0xe5718d,_0x227261['options']);return db[_0xe760('0x40')][_0xe760('0x47')](_0xe5718d)['then'](handleEntityNotFound(_0x41d340,null))[_0xe760('0x22')](respondWithResult(_0x41d340,null))[_0xe760('0x44')](handleError(_0x41d340,null));};exports[_0xe760('0x48')]=function(_0x1d0cfb,_0x3effd1){return db[_0xe760('0x40')][_0xe760('0x48')](_0x1d0cfb[_0xe760('0x49')],{})['then'](respondWithResult(_0x3effd1,0xc9))[_0xe760('0x44')](handleError(_0x3effd1,null));};exports['update']=function(_0xd6e2e0,_0x24eb26){if(_0xd6e2e0[_0xe760('0x49')]['id']){delete _0xd6e2e0[_0xe760('0x49')]['id'];}return db['JscriptyQuestionReport'][_0xe760('0x47')]({'where':{'id':_0xd6e2e0[_0xe760('0x46')]['id']}})[_0xe760('0x22')](handleEntityNotFound(_0x24eb26,null))['then'](saveUpdates(_0xd6e2e0[_0xe760('0x49')],null))[_0xe760('0x22')](respondWithResult(_0x24eb26,null))[_0xe760('0x44')](handleError(_0x24eb26,null));};exports[_0xe760('0x23')]=function(_0x207846,_0x4ececb){return db[_0xe760('0x40')][_0xe760('0x47')]({'where':{'id':_0x207846[_0xe760('0x46')]['id']}})[_0xe760('0x22')](handleEntityNotFound(_0x4ececb,null))['then'](removeEntity(_0x4ececb,null))[_0xe760('0x44')](handleError(_0x4ececb,null));};exports['describe']=function(_0x49ac69,_0x4d77db){return db[_0xe760('0x40')][_0xe760('0x4a')]()[_0xe760('0x22')](respondWithResult(_0x4d77db,null))['catch'](handleError(_0x4d77db,null));}; \ No newline at end of file +var _0xd455=['status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4fcb54,_0x27db23){var _0x30a590=function(_0x271d66){while(--_0x271d66){_0x4fcb54['push'](_0x4fcb54['shift']());}};_0x30a590(++_0x27db23);}(_0xd455,0xc5));var _0x5d45=function(_0x81ea4,_0x15dc79){_0x81ea4=_0x81ea4-0x0;var _0x127577=_0xd455[_0x81ea4];return _0x127577;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5d45('0x0'));var rimraf=require(_0x5d45('0x1'));var zipdir=require(_0x5d45('0x2'));var jsonpatch=require(_0x5d45('0x3'));var rp=require(_0x5d45('0x4'));var moment=require(_0x5d45('0x5'));var BPromise=require(_0x5d45('0x6'));var Mustache=require(_0x5d45('0x7'));var util=require('util');var path=require(_0x5d45('0x8'));var sox=require(_0x5d45('0x9'));var csv=require(_0x5d45('0xa'));var ejs=require(_0x5d45('0xb'));var fs=require('fs');var _=require(_0x5d45('0xc'));var squel=require(_0x5d45('0xd'));var crypto=require(_0x5d45('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5d45('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5d45('0x10'));var Redis=require(_0x5d45('0x11'));var authService=require(_0x5d45('0x12'));var qs=require(_0x5d45('0x13'));var as=require(_0x5d45('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d45('0x15'))('api');var utils=require(_0x5d45('0x16'));var config=require(_0x5d45('0x17'));var db=require(_0x5d45('0x18'))['db'];function respondWithStatusCode(_0x3aa9be,_0x8f5a34){_0x8f5a34=_0x8f5a34||0xcc;return function(_0x553b00){if(_0x553b00){return _0x3aa9be['sendStatus'](_0x8f5a34);}return _0x3aa9be[_0x5d45('0x19')](_0x8f5a34)['end']();};}function respondWithResult(_0x3c6cc5,_0x303eab){_0x303eab=_0x303eab||0xc8;return function(_0x34a8db){if(_0x34a8db){return _0x3c6cc5[_0x5d45('0x19')](_0x303eab)[_0x5d45('0x1a')](_0x34a8db);}};}function respondWithFilteredResult(_0x33b07e,_0x4c0b54){return function(_0x4f4991){if(_0x4f4991){var _0x13f2a9=_0x4f4991[_0x5d45('0x1b')],_0x3474a2=_0x4c0b54[_0x5d45('0x1c')],_0x137e8e=_0x4c0b54[_0x5d45('0x1c')]+_0x4c0b54[_0x5d45('0x1d')],_0x363958;if(_0x137e8e>=_0x13f2a9){_0x137e8e=_0x13f2a9;_0x363958=0xc8;}else{_0x363958=0xce;}_0x33b07e[_0x5d45('0x19')](_0x363958);return _0x33b07e[_0x5d45('0x1e')](_0x5d45('0x1f'),_0x3474a2+'-'+_0x137e8e+'/'+_0x13f2a9)[_0x5d45('0x1a')](_0x4f4991);}return null;};}function patchUpdates(_0x1949ad){return function(_0xd9475a){try{jsonpatch[_0x5d45('0x20')](_0xd9475a,_0x1949ad,!![]);}catch(_0x306b3b){return BPromise[_0x5d45('0x21')](_0x306b3b);}return _0xd9475a[_0x5d45('0x22')]();};}function saveUpdates(_0x552a57,_0x123c4d){return function(_0x2f57ab){if(_0x2f57ab){return _0x2f57ab[_0x5d45('0x23')](_0x552a57)[_0x5d45('0x24')](function(_0x37da96){return _0x37da96;});}return null;};}function removeEntity(_0x4787ce,_0x4e55f7){return function(_0x4bf365){if(_0x4bf365){return _0x4bf365['destroy']()[_0x5d45('0x24')](function(){_0x4787ce['status'](0xcc)[_0x5d45('0x25')]();});}};}function handleEntityNotFound(_0x1e8f61,_0x486710){return function(_0x11500d){if(!_0x11500d){_0x1e8f61[_0x5d45('0x26')](0x194);}return _0x11500d;};}function handleError(_0x4e739d,_0x50e2b9){_0x50e2b9=_0x50e2b9||0x1f4;return function(_0x2d42da){logger[_0x5d45('0x27')](_0x2d42da[_0x5d45('0x28')]);if(_0x2d42da[_0x5d45('0x29')]){delete _0x2d42da['name'];}_0x4e739d[_0x5d45('0x19')](_0x50e2b9)['send'](_0x2d42da);};}exports[_0x5d45('0x2a')]=function(_0x39b8a5,_0x2745a6){var _0x2c0b44={},_0x536715={},_0x13c341={'count':0x0,'rows':[]};var _0x8d6b1c=_[_0x5d45('0x2b')](db['JscriptyQuestionReport'][_0x5d45('0x2c')],function(_0x54d45f){return{'name':_0x54d45f[_0x5d45('0x2d')],'type':_0x54d45f['type'][_0x5d45('0x2e')]};});_0x536715['model']=_[_0x5d45('0x2b')](_0x8d6b1c,_0x5d45('0x29'));_0x536715[_0x5d45('0x2f')]=_[_0x5d45('0x30')](_0x39b8a5[_0x5d45('0x2f')]);_0x536715[_0x5d45('0x31')]=_[_0x5d45('0x32')](_0x536715[_0x5d45('0x33')],_0x536715[_0x5d45('0x2f')]);_0x2c0b44[_0x5d45('0x34')]=_[_0x5d45('0x32')](_0x536715[_0x5d45('0x33')],qs[_0x5d45('0x35')](_0x39b8a5[_0x5d45('0x2f')]['fields']));_0x2c0b44[_0x5d45('0x34')]=_0x2c0b44['attributes'][_0x5d45('0x36')]?_0x2c0b44['attributes']:_0x536715[_0x5d45('0x33')];if(!_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x37')](_0x5d45('0x38'))){_0x2c0b44[_0x5d45('0x1d')]=qs[_0x5d45('0x1d')](_0x39b8a5[_0x5d45('0x2f')]['limit']);_0x2c0b44[_0x5d45('0x1c')]=qs[_0x5d45('0x1c')](_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x1c')]);}_0x2c0b44[_0x5d45('0x39')]=qs[_0x5d45('0x3a')](_0x39b8a5['query']['sort']);_0x2c0b44[_0x5d45('0x3b')]=qs[_0x5d45('0x31')](_['pick'](_0x39b8a5['query'],_0x536715[_0x5d45('0x31')]),_0x8d6b1c);if(_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x3c')]){_0x2c0b44['where']=_[_0x5d45('0x3d')](_0x2c0b44[_0x5d45('0x3b')],{'$or':_[_0x5d45('0x2b')](_0x8d6b1c,function(_0xe11f9f){if(_0xe11f9f[_0x5d45('0x3e')]!==_0x5d45('0x3f')){var _0x264b14={};_0x264b14[_0xe11f9f[_0x5d45('0x29')]]={'$like':'%'+_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x3c')]+'%'};return _0x264b14;}})});}_0x2c0b44=_[_0x5d45('0x3d')]({},_0x2c0b44,_0x39b8a5[_0x5d45('0x40')]);var _0x5ac44d={'where':_0x2c0b44[_0x5d45('0x3b')]};return db[_0x5d45('0x41')][_0x5d45('0x1b')](_0x5ac44d)['then'](function(_0x162c09){_0x13c341['count']=_0x162c09;if(_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x42')]){_0x2c0b44[_0x5d45('0x43')]=[{'all':!![]}];}return db[_0x5d45('0x41')]['findAll'](_0x2c0b44);})['then'](function(_0x308265){_0x13c341[_0x5d45('0x44')]=_0x308265;return _0x13c341;})[_0x5d45('0x24')](respondWithFilteredResult(_0x2745a6,_0x2c0b44))[_0x5d45('0x45')](handleError(_0x2745a6,null));};exports['show']=function(_0x2b2fa6,_0x5bfb06){var _0x374093={'raw':!![],'where':{'id':_0x2b2fa6[_0x5d45('0x46')]['id']}},_0x12a0de={};_0x12a0de[_0x5d45('0x33')]=_[_0x5d45('0x30')](db['JscriptyQuestionReport'][_0x5d45('0x2c')]);_0x12a0de[_0x5d45('0x2f')]=_['keys'](_0x2b2fa6[_0x5d45('0x2f')]);_0x12a0de[_0x5d45('0x31')]=_[_0x5d45('0x32')](_0x12a0de[_0x5d45('0x33')],_0x12a0de[_0x5d45('0x2f')]);_0x374093[_0x5d45('0x34')]=_[_0x5d45('0x32')](_0x12a0de['model'],qs[_0x5d45('0x35')](_0x2b2fa6[_0x5d45('0x2f')][_0x5d45('0x35')]));_0x374093[_0x5d45('0x34')]=_0x374093[_0x5d45('0x34')][_0x5d45('0x36')]?_0x374093[_0x5d45('0x34')]:_0x12a0de[_0x5d45('0x33')];if(_0x2b2fa6['query'][_0x5d45('0x42')]){_0x374093[_0x5d45('0x43')]=[{'all':!![]}];}_0x374093=_[_0x5d45('0x3d')]({},_0x374093,_0x2b2fa6[_0x5d45('0x40')]);return db[_0x5d45('0x41')][_0x5d45('0x47')](_0x374093)[_0x5d45('0x24')](handleEntityNotFound(_0x5bfb06,null))[_0x5d45('0x24')](respondWithResult(_0x5bfb06,null))['catch'](handleError(_0x5bfb06,null));};exports[_0x5d45('0x48')]=function(_0x4c78a5,_0x13ed2d){return db['JscriptyQuestionReport'][_0x5d45('0x48')](_0x4c78a5[_0x5d45('0x49')],{})[_0x5d45('0x24')](respondWithResult(_0x13ed2d,0xc9))[_0x5d45('0x45')](handleError(_0x13ed2d,null));};exports['update']=function(_0x3e1cfc,_0x26a966){if(_0x3e1cfc[_0x5d45('0x49')]['id']){delete _0x3e1cfc[_0x5d45('0x49')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x3e1cfc['params']['id']}})[_0x5d45('0x24')](handleEntityNotFound(_0x26a966,null))[_0x5d45('0x24')](saveUpdates(_0x3e1cfc[_0x5d45('0x49')],null))[_0x5d45('0x24')](respondWithResult(_0x26a966,null))[_0x5d45('0x45')](handleError(_0x26a966,null));};exports['destroy']=function(_0x34b6f6,_0x51295b){return db[_0x5d45('0x41')]['find']({'where':{'id':_0x34b6f6[_0x5d45('0x46')]['id']}})['then'](handleEntityNotFound(_0x51295b,null))[_0x5d45('0x24')](removeEntity(_0x51295b,null))[_0x5d45('0x45')](handleError(_0x51295b,null));};exports['describe']=function(_0x8594c0,_0x5de94f){return db[_0x5d45('0x41')]['describe']()['then'](respondWithResult(_0x5de94f,null))[_0x5d45('0x45')](handleError(_0x5de94f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 5a7112c..49fdadb 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 _0x4d81=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./jscriptyQuestionReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d81,0xc4));var _0x14d8=function(_0x212537,_0x64c7f5){_0x212537=_0x212537-0x0;var _0x233b98=_0x4d81[_0x212537];return _0x233b98;};'use strict';var _=require(_0x14d8('0x0'));var util=require(_0x14d8('0x1'));var logger=require(_0x14d8('0x2'))(_0x14d8('0x3'));var moment=require(_0x14d8('0x4'));var BPromise=require(_0x14d8('0x5'));var rp=require(_0x14d8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x14d8('0x7'));module[_0x14d8('0x8')]=function(_0x2164e1,_0x227454){return _0x2164e1[_0x14d8('0x9')](_0x14d8('0xa'),attributes,{'tableName':_0x14d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3724=['request-promise','rimraf','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','bluebird'];(function(_0x4d2de8,_0x1391e9){var _0x58eaa0=function(_0xbd2834){while(--_0xbd2834){_0x4d2de8['push'](_0x4d2de8['shift']());}};_0x58eaa0(++_0x1391e9);}(_0x3724,0x87));var _0x4372=function(_0x156489,_0x2bbaf2){_0x156489=_0x156489-0x0;var _0x4d2814=_0x3724[_0x156489];return _0x4d2814;};'use strict';var _=require(_0x4372('0x0'));var util=require(_0x4372('0x1'));var logger=require(_0x4372('0x2'))(_0x4372('0x3'));var moment=require('moment');var BPromise=require(_0x4372('0x4'));var rp=require(_0x4372('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4372('0x6'));var config=require('../../config/environment');var attributes=require(_0x4372('0x7'));module['exports']=function(_0x41da19,_0x1ec767){return _0x41da19[_0x4372('0x8')](_0x4372('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 3b688bc..9c39041 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 _0x988c=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x310da2,_0x181858){var _0x12bc21=function(_0x559fe7){while(--_0x559fe7){_0x310da2['push'](_0x310da2['shift']());}};_0x12bc21(++_0x181858);}(_0x988c,0x14a));var _0xc988=function(_0x169551,_0x32e757){_0x169551=_0x169551-0x0;var _0x1e0384=_0x988c[_0x169551];return _0x1e0384;};'use strict';var _=require('lodash');var util=require(_0xc988('0x0'));var moment=require(_0xc988('0x1'));var BPromise=require(_0xc988('0x2'));var rs=require(_0xc988('0x3'));var fs=require('fs');var Redis=require(_0xc988('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc988('0x5'));var logger=require(_0xc988('0x6'))(_0xc988('0x7'));var config=require(_0xc988('0x8'));var jayson=require(_0xc988('0x9'));var client=jayson['client'][_0xc988('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38653e,_0x2749be,_0x551c68){return new BPromise(function(_0x3cdb68,_0x20d948){return client[_0xc988('0xb')](_0x38653e,_0x551c68)[_0xc988('0xc')](function(_0x16c7a4){logger[_0xc988('0xd')](_0xc988('0xe'),_0x2749be,_0xc988('0xf'));logger[_0xc988('0x10')](_0xc988('0x11'),_0x2749be,_0xc988('0xf'),JSON['stringify'](_0x16c7a4));if(_0x16c7a4['error']){if(_0x16c7a4[_0xc988('0x12')]['code']===0x1f4){logger[_0xc988('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2749be,_0x16c7a4[_0xc988('0x12')]['message']);return _0x20d948(_0x16c7a4[_0xc988('0x12')][_0xc988('0x13')]);}logger[_0xc988('0x12')](_0xc988('0xe'),_0x2749be,_0x16c7a4[_0xc988('0x12')][_0xc988('0x13')]);return _0x3cdb68(_0x16c7a4[_0xc988('0x12')][_0xc988('0x13')]);}else{logger[_0xc988('0xd')](_0xc988('0xe'),_0x2749be,'request\x20sent');_0x3cdb68(_0x16c7a4[_0xc988('0x14')]['message']);}})[_0xc988('0x15')](function(_0x473168){logger[_0xc988('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2749be,_0x473168);_0x20d948(_0x473168);});});} \ No newline at end of file +var _0xe50a=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash'];(function(_0x42bb0a,_0x5c713f){var _0x548011=function(_0x1532c8){while(--_0x1532c8){_0x42bb0a['push'](_0x42bb0a['shift']());}};_0x548011(++_0x5c713f);}(_0xe50a,0xb3));var _0xae50=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xe50a[_0x4d45c1];return _0x244478;};'use strict';var _=require(_0xae50('0x0'));var util=require(_0xae50('0x1'));var moment=require(_0xae50('0x2'));var BPromise=require('bluebird');var rs=require(_0xae50('0x3'));var fs=require('fs');var Redis=require(_0xae50('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae50('0x5'));var logger=require(_0xae50('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae50('0x7'));var client=jayson[_0xae50('0x8')][_0xae50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3e7a,_0x251848,_0xf73925){return new BPromise(function(_0x30366e,_0x3a54c3){return client[_0xae50('0xa')](_0x4c3e7a,_0xf73925)[_0xae50('0xb')](function(_0x31ca72){logger[_0xae50('0xc')](_0xae50('0xd'),_0x251848,_0xae50('0xe'));logger[_0xae50('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x251848,_0xae50('0xe'),JSON[_0xae50('0x10')](_0x31ca72));if(_0x31ca72[_0xae50('0x11')]){if(_0x31ca72[_0xae50('0x11')]['code']===0x1f4){logger[_0xae50('0x11')](_0xae50('0xd'),_0x251848,_0x31ca72[_0xae50('0x11')][_0xae50('0x12')]);return _0x3a54c3(_0x31ca72[_0xae50('0x11')][_0xae50('0x12')]);}logger[_0xae50('0x11')](_0xae50('0xd'),_0x251848,_0x31ca72['error'][_0xae50('0x12')]);return _0x30366e(_0x31ca72[_0xae50('0x11')][_0xae50('0x12')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x251848,_0xae50('0xe'));_0x30366e(_0x31ca72['result'][_0xae50('0x12')]);}})[_0xae50('0x13')](function(_0x4a9a21){logger['error'](_0xae50('0xd'),_0x251848,_0x4a9a21);_0x3a54c3(_0x4a9a21);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 07663d5..631210b 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 _0x0f9f=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','getQuestions','post','put','/:id','update','delete','exports','util','path'];(function(_0x373436,_0x39d99c){var _0x5bba01=function(_0x294fed){while(--_0x294fed){_0x373436['push'](_0x373436['shift']());}};_0x5bba01(++_0x39d99c);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x130633,_0x1e83d0){_0x130633=_0x130633-0x0;var _0x2c36b2=_0x0f9f[_0x130633];return _0x2c36b2;};'use strict';var multer=require('multer');var util=require(_0xf0f9('0x0'));var path=require(_0xf0f9('0x1'));var timeout=require(_0xf0f9('0x2'));var express=require('express');var router=express[_0xf0f9('0x3')]();var auth=require(_0xf0f9('0x4'));var interaction=require(_0xf0f9('0x5'));var config=require(_0xf0f9('0x6'));var controller=require(_0xf0f9('0x7'));router[_0xf0f9('0x8')]('/',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xa')]);router[_0xf0f9('0x8')](_0xf0f9('0xb'),auth['isAuthenticated'](),controller[_0xf0f9('0xc')]);router[_0xf0f9('0x8')]('/:id',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xd')]);router[_0xf0f9('0x8')]('/:id/questions',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xe')]);router[_0xf0f9('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf0f9('0x10')](_0xf0f9('0x11'),auth[_0xf0f9('0x9')](),controller[_0xf0f9('0x12')]);router[_0xf0f9('0x13')](_0xf0f9('0x11'),auth[_0xf0f9('0x9')](),controller['destroy']);module[_0xf0f9('0x14')]=router; \ No newline at end of file +var _0x1670=['getQuestions','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/questions'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x1670,0x9a));var _0x0167=function(_0x21cda3,_0x17b90a){_0x21cda3=_0x21cda3-0x0;var _0x558dc3=_0x1670[_0x21cda3];return _0x558dc3;};'use strict';var multer=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var path=require('path');var timeout=require(_0x0167('0x2'));var express=require('express');var router=express[_0x0167('0x3')]();var auth=require(_0x0167('0x4'));var interaction=require(_0x0167('0x5'));var config=require(_0x0167('0x6'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x0167('0x7')](),controller[_0x0167('0x8')]);router[_0x0167('0x9')](_0x0167('0xa'),auth[_0x0167('0x7')](),controller[_0x0167('0xb')]);router[_0x0167('0x9')](_0x0167('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0167('0x9')](_0x0167('0xd'),auth[_0x0167('0x7')](),controller[_0x0167('0xe')]);router[_0x0167('0xf')]('/',auth[_0x0167('0x7')](),controller[_0x0167('0x10')]);router[_0x0167('0x11')](_0x0167('0xc'),auth[_0x0167('0x7')](),controller[_0x0167('0x12')]);router[_0x0167('0x13')](_0x0167('0xc'),auth[_0x0167('0x7')](),controller['destroy']);module[_0x0167('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c54f944..51e1636 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 _0x0565=['STRING','BOOLEAN','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x531721,_0x1a9f7d){var _0x31d548=function(_0x2c30e5){while(--_0x2c30e5){_0x531721['push'](_0x531721['shift']());}};_0x31d548(++_0x1a9f7d);}(_0x0565,0x12e));var _0x5056=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x0565[_0x220f3f];return _0x1f170e;};'use strict';var moment=require('moment');var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x480664){this[_0x5056('0x2')](_0x5056('0x3'),_0x480664);this[_0x5056('0x2')](_0x5056('0x4'),moment()[_0x5056('0x5')](_0x5056('0x6')));}},'endtime':{'type':Sequelize[_0x5056('0x7')]},'membername':{'type':Sequelize[_0x5056('0x8')]},'projectname':{'type':Sequelize[_0x5056('0x8')]},'queue':{'type':Sequelize[_0x5056('0x8')]},'uniqueid':{'type':Sequelize[_0x5056('0x8')]},'calleridname':{'type':Sequelize[_0x5056('0x8')]},'calleridnum':{'type':Sequelize[_0x5056('0x8')]},'completed':{'type':Sequelize[_0x5056('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x0320=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0x571d85,_0xda439c){var _0x3c2e07=function(_0x2d2144){while(--_0x2d2144){_0x571d85['push'](_0x571d85['shift']());}};_0x3c2e07(++_0xda439c);}(_0x0320,0x145));var _0x0032=function(_0x74039f,_0x3a5d17){_0x74039f=_0x74039f-0x0;var _0x76d3fa=_0x0320[_0x74039f];return _0x76d3fa;};'use strict';var moment=require(_0x0032('0x0'));var Sequelize=require(_0x0032('0x1'));module[_0x0032('0x2')]={'starttime':{'type':Sequelize[_0x0032('0x3')],'set':function(_0x39852f){this[_0x0032('0x4')]('starttime',_0x39852f);this[_0x0032('0x4')](_0x0032('0x5'),moment()[_0x0032('0x6')](_0x0032('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0032('0x8')]},'uniqueid':{'type':Sequelize[_0x0032('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0032('0x8')]},'completed':{'type':Sequelize[_0x0032('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index da650f8..757bb0d 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 _0xb486=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','reject','save','update','then','destroy','error','stack','name','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','count','include','findAll','rows','fields','includeAll','catch','create','body','find','params','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','pick','rimraf','zip-dir'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0xb486,0x1cc));var _0x6b48=function(_0xc6d4f2,_0x10747d){_0xc6d4f2=_0xc6d4f2-0x0;var _0x48ea90=_0xb486[_0xc6d4f2];return _0x48ea90;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6b48('0x0'));var zipdir=require(_0x6b48('0x1'));var jsonpatch=require(_0x6b48('0x2'));var rp=require(_0x6b48('0x3'));var moment=require('moment');var BPromise=require(_0x6b48('0x4'));var Mustache=require(_0x6b48('0x5'));var util=require(_0x6b48('0x6'));var path=require(_0x6b48('0x7'));var sox=require('sox');var csv=require(_0x6b48('0x8'));var ejs=require(_0x6b48('0x9'));var fs=require('fs');var _=require(_0x6b48('0xa'));var squel=require(_0x6b48('0xb'));var crypto=require('crypto');var jsforce=require(_0x6b48('0xc'));var deskjs=require(_0x6b48('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b48('0xe'));var Papa=require(_0x6b48('0xf'));var Redis=require(_0x6b48('0x10'));var authService=require(_0x6b48('0x11'));var qs=require(_0x6b48('0x12'));var as=require(_0x6b48('0x13'));var hardwareService=require(_0x6b48('0x14'));var logger=require('../../config/logger')(_0x6b48('0x15'));var utils=require(_0x6b48('0x16'));var config=require(_0x6b48('0x17'));var db=require(_0x6b48('0x18'))['db'];function respondWithStatusCode(_0x3ff7f4,_0x3d255){_0x3d255=_0x3d255||0xcc;return function(_0x3031be){if(_0x3031be){return _0x3ff7f4[_0x6b48('0x19')](_0x3d255);}return _0x3ff7f4[_0x6b48('0x1a')](_0x3d255)['end']();};}function respondWithResult(_0x24c7d3,_0x1932f9){_0x1932f9=_0x1932f9||0xc8;return function(_0x3e68bf){if(_0x3e68bf){return _0x24c7d3['status'](_0x1932f9)[_0x6b48('0x1b')](_0x3e68bf);}};}function respondWithFilteredResult(_0x4b845f,_0x9dc8c8){return function(_0x40601a){if(_0x40601a){var _0x4ebf96=_0x40601a['count'],_0x1213db=_0x9dc8c8[_0x6b48('0x1c')],_0x29a3db=_0x9dc8c8[_0x6b48('0x1c')]+_0x9dc8c8[_0x6b48('0x1d')],_0x42f168;if(_0x29a3db>=_0x4ebf96){_0x29a3db=_0x4ebf96;_0x42f168=0xc8;}else{_0x42f168=0xce;}_0x4b845f['status'](_0x42f168);return _0x4b845f[_0x6b48('0x1e')]('Content-Range',_0x1213db+'-'+_0x29a3db+'/'+_0x4ebf96)[_0x6b48('0x1b')](_0x40601a);}return null;};}function patchUpdates(_0x290341){return function(_0x452e27){try{jsonpatch['apply'](_0x452e27,_0x290341,!![]);}catch(_0x4ffcfc){return BPromise[_0x6b48('0x1f')](_0x4ffcfc);}return _0x452e27[_0x6b48('0x20')]();};}function saveUpdates(_0x6f063e,_0x43e671){return function(_0x3d6ded){if(_0x3d6ded){return _0x3d6ded[_0x6b48('0x21')](_0x6f063e)[_0x6b48('0x22')](function(_0x1a3131){return _0x1a3131;});}return null;};}function removeEntity(_0x25c4ef,_0x9edc43){return function(_0x23bbb4){if(_0x23bbb4){return _0x23bbb4[_0x6b48('0x23')]()['then'](function(){_0x25c4ef[_0x6b48('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55c3f3,_0x20e575){return function(_0x41a81c){if(!_0x41a81c){_0x55c3f3[_0x6b48('0x19')](0x194);}return _0x41a81c;};}function handleError(_0x318455,_0x550ed3){_0x550ed3=_0x550ed3||0x1f4;return function(_0xcc4f19){logger[_0x6b48('0x24')](_0xcc4f19[_0x6b48('0x25')]);if(_0xcc4f19[_0x6b48('0x26')]){delete _0xcc4f19['name'];}_0x318455[_0x6b48('0x1a')](_0x550ed3)['send'](_0xcc4f19);};}exports[_0x6b48('0x27')]=function(_0x910eae,_0x6812a3){var _0x4f0a41={},_0x5091e1={},_0x1931e6={'count':0x0,'rows':[]};var _0xfee47c=_[_0x6b48('0x28')](db[_0x6b48('0x29')][_0x6b48('0x2a')],function(_0x709a77){return{'name':_0x709a77['fieldName'],'type':_0x709a77[_0x6b48('0x2b')][_0x6b48('0x2c')]};});_0x5091e1[_0x6b48('0x2d')]=_['map'](_0xfee47c,_0x6b48('0x26'));_0x5091e1[_0x6b48('0x2e')]=_[_0x6b48('0x2f')](_0x910eae['query']);_0x5091e1[_0x6b48('0x30')]=_[_0x6b48('0x31')](_0x5091e1['model'],_0x5091e1[_0x6b48('0x2e')]);_0x4f0a41[_0x6b48('0x32')]=_[_0x6b48('0x31')](_0x5091e1[_0x6b48('0x2d')],qs['fields'](_0x910eae[_0x6b48('0x2e')]['fields']));_0x4f0a41[_0x6b48('0x32')]=_0x4f0a41[_0x6b48('0x32')][_0x6b48('0x33')]?_0x4f0a41[_0x6b48('0x32')]:_0x5091e1[_0x6b48('0x2d')];if(!_0x910eae[_0x6b48('0x2e')][_0x6b48('0x34')]('nolimit')){_0x4f0a41[_0x6b48('0x1d')]=qs[_0x6b48('0x1d')](_0x910eae[_0x6b48('0x2e')][_0x6b48('0x1d')]);_0x4f0a41[_0x6b48('0x1c')]=qs['offset'](_0x910eae[_0x6b48('0x2e')]['offset']);}_0x4f0a41[_0x6b48('0x35')]=qs[_0x6b48('0x36')](_0x910eae['query'][_0x6b48('0x36')]);_0x4f0a41[_0x6b48('0x37')]=qs[_0x6b48('0x30')](_['pick'](_0x910eae[_0x6b48('0x2e')],_0x5091e1[_0x6b48('0x30')]),_0xfee47c);if(_0x910eae[_0x6b48('0x2e')][_0x6b48('0x38')]){_0x4f0a41['where']=_['merge'](_0x4f0a41[_0x6b48('0x37')],{'$or':_['map'](_0xfee47c,function(_0x28e14c){if(_0x28e14c[_0x6b48('0x2b')]!==_0x6b48('0x39')){var _0x44f810={};_0x44f810[_0x28e14c[_0x6b48('0x26')]]={'$like':'%'+_0x910eae[_0x6b48('0x2e')][_0x6b48('0x38')]+'%'};return _0x44f810;}})});}_0x4f0a41=_[_0x6b48('0x3a')]({},_0x4f0a41,_0x910eae[_0x6b48('0x3b')]);var _0x6db7b1={'where':_0x4f0a41[_0x6b48('0x37')]};return db[_0x6b48('0x29')][_0x6b48('0x3c')](_0x6db7b1)[_0x6b48('0x22')](function(_0x4b69a1){_0x1931e6[_0x6b48('0x3c')]=_0x4b69a1;if(_0x910eae[_0x6b48('0x2e')]['includeAll']){_0x4f0a41[_0x6b48('0x3d')]=[{'all':!![]}];}return db[_0x6b48('0x29')][_0x6b48('0x3e')](_0x4f0a41);})[_0x6b48('0x22')](function(_0x1dcb3a){_0x1931e6[_0x6b48('0x3f')]=_0x1dcb3a;return _0x1931e6;})['then'](respondWithFilteredResult(_0x6812a3,_0x4f0a41))['catch'](handleError(_0x6812a3,null));};exports['show']=function(_0x406eb5,_0x112377){var _0x4ccb9c={'raw':!![],'where':{'id':_0x406eb5['params']['id']}},_0x146e3b={};_0x146e3b[_0x6b48('0x2d')]=_[_0x6b48('0x2f')](db['JscriptySessionReport'][_0x6b48('0x2a')]);_0x146e3b[_0x6b48('0x2e')]=_[_0x6b48('0x2f')](_0x406eb5[_0x6b48('0x2e')]);_0x146e3b['filters']=_['intersection'](_0x146e3b[_0x6b48('0x2d')],_0x146e3b[_0x6b48('0x2e')]);_0x4ccb9c[_0x6b48('0x32')]=_['intersection'](_0x146e3b[_0x6b48('0x2d')],qs[_0x6b48('0x40')](_0x406eb5['query']['fields']));_0x4ccb9c[_0x6b48('0x32')]=_0x4ccb9c[_0x6b48('0x32')][_0x6b48('0x33')]?_0x4ccb9c[_0x6b48('0x32')]:_0x146e3b[_0x6b48('0x2d')];if(_0x406eb5[_0x6b48('0x2e')][_0x6b48('0x41')]){_0x4ccb9c[_0x6b48('0x3d')]=[{'all':!![]}];}_0x4ccb9c=_['merge']({},_0x4ccb9c,_0x406eb5[_0x6b48('0x3b')]);return db[_0x6b48('0x29')]['find'](_0x4ccb9c)[_0x6b48('0x22')](handleEntityNotFound(_0x112377,null))[_0x6b48('0x22')](respondWithResult(_0x112377,null))[_0x6b48('0x42')](handleError(_0x112377,null));};exports[_0x6b48('0x43')]=function(_0x3d5ce2,_0x5e9d19){return db[_0x6b48('0x29')][_0x6b48('0x43')](_0x3d5ce2[_0x6b48('0x44')],{})[_0x6b48('0x22')](respondWithResult(_0x5e9d19,0xc9))['catch'](handleError(_0x5e9d19,null));};exports['update']=function(_0x5960c5,_0x2bd8b3){if(_0x5960c5['body']['id']){delete _0x5960c5[_0x6b48('0x44')]['id'];}return db[_0x6b48('0x29')][_0x6b48('0x45')]({'where':{'id':_0x5960c5[_0x6b48('0x46')]['id']}})[_0x6b48('0x22')](handleEntityNotFound(_0x2bd8b3,null))[_0x6b48('0x22')](saveUpdates(_0x5960c5[_0x6b48('0x44')],null))[_0x6b48('0x22')](respondWithResult(_0x2bd8b3,null))['catch'](handleError(_0x2bd8b3,null));};exports[_0x6b48('0x23')]=function(_0x3ad2a8,_0x8480f0){return db[_0x6b48('0x29')]['find']({'where':{'id':_0x3ad2a8[_0x6b48('0x46')]['id']}})[_0x6b48('0x22')](handleEntityNotFound(_0x8480f0,null))['then'](removeEntity(_0x8480f0,null))['catch'](handleError(_0x8480f0,null));};exports[_0x6b48('0x47')]=function(_0x579b4d,_0x366439){return db[_0x6b48('0x29')]['describe']()[_0x6b48('0x22')](respondWithResult(_0x366439,null))[_0x6b48('0x42')](handleError(_0x366439,null));};exports[_0x6b48('0x48')]=function(_0x594b33,_0x47cc6b,_0x1bac0d){var _0x20a3c0={'raw':!![],'where':{}};var _0x1a193c={};var _0xec79c={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x6b48('0x49')]({'where':{'id':_0x594b33['params']['id']}})[_0x6b48('0x22')](handleEntityNotFound(_0x47cc6b,null))['then'](function(_0x56a37c){if(_0x56a37c){_0x1a193c[_0x6b48('0x2d')]=_[_0x6b48('0x2f')](db[_0x6b48('0x4a')][_0x6b48('0x2a')]);_0x1a193c[_0x6b48('0x2e')]=_[_0x6b48('0x2f')](_0x594b33[_0x6b48('0x2e')]);_0x1a193c['filters']=_[_0x6b48('0x31')](_0x1a193c[_0x6b48('0x2d')],_0x1a193c[_0x6b48('0x2e')]);_0x20a3c0[_0x6b48('0x32')]=_[_0x6b48('0x31')](_0x1a193c[_0x6b48('0x2d')],qs[_0x6b48('0x40')](_0x594b33[_0x6b48('0x2e')][_0x6b48('0x40')]));_0x20a3c0[_0x6b48('0x32')]=_0x20a3c0[_0x6b48('0x32')][_0x6b48('0x33')]?_0x20a3c0['attributes']:_0x1a193c['model'];if(!_0x594b33['query']['hasOwnProperty'](_0x6b48('0x4b'))){_0x20a3c0[_0x6b48('0x1d')]=qs[_0x6b48('0x1d')](_0x594b33[_0x6b48('0x2e')][_0x6b48('0x1d')]);_0x20a3c0[_0x6b48('0x1c')]=qs[_0x6b48('0x1c')](_0x594b33[_0x6b48('0x2e')][_0x6b48('0x1c')]);}_0x20a3c0[_0x6b48('0x35')]=qs[_0x6b48('0x36')](_0x594b33[_0x6b48('0x2e')]['sort']);_0x20a3c0[_0x6b48('0x37')]=qs[_0x6b48('0x30')](_[_0x6b48('0x4c')](_0x594b33['query'],_0x1a193c[_0x6b48('0x30')]));_0x20a3c0['where']['SessionId']=_0x56a37c['id'];if(_0x594b33[_0x6b48('0x2e')][_0x6b48('0x38')]){_0x20a3c0[_0x6b48('0x37')]=_[_0x6b48('0x3a')](_0x20a3c0[_0x6b48('0x37')],{'$or':_['map'](_0x20a3c0['attributes'],function(_0x45e404){var _0x43fa29={};_0x43fa29[_0x45e404]={'$like':'%'+_0x594b33[_0x6b48('0x2e')][_0x6b48('0x38')]+'%'};return _0x43fa29;})});}_0x20a3c0=_[_0x6b48('0x3a')]({},_0x20a3c0,_0x594b33['options']);return db[_0x6b48('0x4a')][_0x6b48('0x3c')]({'where':_0x20a3c0['where']})['then'](function(_0x35a02d){_0xec79c[_0x6b48('0x3c')]=_0x35a02d;if(_0x594b33[_0x6b48('0x2e')][_0x6b48('0x41')]){_0x20a3c0['include']=[{'all':!![]}];}return db[_0x6b48('0x4a')][_0x6b48('0x3e')](_0x20a3c0);})[_0x6b48('0x22')](function(_0xcef58e){_0xec79c[_0x6b48('0x3f')]=_0xcef58e;return _0xec79c;});}})[_0x6b48('0x22')](respondWithFilteredResult(_0x47cc6b,_0x20a3c0))['catch'](handleError(_0x47cc6b,null));}; \ No newline at end of file +var _0xf4f7=['include','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','findAll','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','JscriptySessionReport','includeAll','rows','catch','show','params','rawAttributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf4f7,0xa3));var _0x7f4f=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0xf4f7[_0x5d8018];return _0x151ac4;};'use strict';var pdf=require(_0x7f4f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f4f('0x2'));var rp=require(_0x7f4f('0x3'));var moment=require(_0x7f4f('0x4'));var BPromise=require(_0x7f4f('0x5'));var Mustache=require('mustache');var util=require(_0x7f4f('0x6'));var path=require('path');var sox=require(_0x7f4f('0x7'));var csv=require(_0x7f4f('0x8'));var ejs=require(_0x7f4f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f4f('0xa'));var crypto=require('crypto');var jsforce=require(_0x7f4f('0xb'));var deskjs=require(_0x7f4f('0xc'));var toCsv=require(_0x7f4f('0x8'));var querystring=require('querystring');var Papa=require(_0x7f4f('0xd'));var Redis=require(_0x7f4f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7f4f('0xf'));var as=require(_0x7f4f('0x10'));var hardwareService=require(_0x7f4f('0x11'));var logger=require(_0x7f4f('0x12'))('api');var utils=require(_0x7f4f('0x13'));var config=require(_0x7f4f('0x14'));var db=require(_0x7f4f('0x15'))['db'];function respondWithStatusCode(_0x327469,_0xd0ff84){_0xd0ff84=_0xd0ff84||0xcc;return function(_0x12f3c2){if(_0x12f3c2){return _0x327469['sendStatus'](_0xd0ff84);}return _0x327469[_0x7f4f('0x16')](_0xd0ff84)[_0x7f4f('0x17')]();};}function respondWithResult(_0x4e4227,_0x56de91){_0x56de91=_0x56de91||0xc8;return function(_0x566a37){if(_0x566a37){return _0x4e4227[_0x7f4f('0x16')](_0x56de91)['json'](_0x566a37);}};}function respondWithFilteredResult(_0x64f4ca,_0x555020){return function(_0x29b174){if(_0x29b174){var _0x1b414e=_0x29b174[_0x7f4f('0x18')],_0x4ac13f=_0x555020[_0x7f4f('0x19')],_0x47a226=_0x555020[_0x7f4f('0x19')]+_0x555020['limit'],_0x5c41f5;if(_0x47a226>=_0x1b414e){_0x47a226=_0x1b414e;_0x5c41f5=0xc8;}else{_0x5c41f5=0xce;}_0x64f4ca['status'](_0x5c41f5);return _0x64f4ca[_0x7f4f('0x1a')](_0x7f4f('0x1b'),_0x4ac13f+'-'+_0x47a226+'/'+_0x1b414e)[_0x7f4f('0x1c')](_0x29b174);}return null;};}function patchUpdates(_0x227527){return function(_0x4ea80d){try{jsonpatch[_0x7f4f('0x1d')](_0x4ea80d,_0x227527,!![]);}catch(_0xa016c1){return BPromise[_0x7f4f('0x1e')](_0xa016c1);}return _0x4ea80d[_0x7f4f('0x1f')]();};}function saveUpdates(_0x419bc5,_0x2d92cf){return function(_0x1a687b){if(_0x1a687b){return _0x1a687b[_0x7f4f('0x20')](_0x419bc5)['then'](function(_0x26e502){return _0x26e502;});}return null;};}function removeEntity(_0x59d0db,_0x225cd5){return function(_0x8975e1){if(_0x8975e1){return _0x8975e1[_0x7f4f('0x21')]()[_0x7f4f('0x22')](function(){_0x59d0db[_0x7f4f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230467,_0x449cd7){return function(_0x7bdbe2){if(!_0x7bdbe2){_0x230467[_0x7f4f('0x23')](0x194);}return _0x7bdbe2;};}function handleError(_0x61e72f,_0x35be7e){_0x35be7e=_0x35be7e||0x1f4;return function(_0x471340){logger[_0x7f4f('0x24')](_0x471340[_0x7f4f('0x25')]);if(_0x471340[_0x7f4f('0x26')]){delete _0x471340[_0x7f4f('0x26')];}_0x61e72f['status'](_0x35be7e)[_0x7f4f('0x27')](_0x471340);};}exports['index']=function(_0x4d2189,_0x1e68b4){var _0x26525d={},_0x51ce56={},_0x13662f={'count':0x0,'rows':[]};var _0x1f834a=_[_0x7f4f('0x28')](db['JscriptySessionReport']['rawAttributes'],function(_0x5dd2af){return{'name':_0x5dd2af['fieldName'],'type':_0x5dd2af['type']['key']};});_0x51ce56['model']=_[_0x7f4f('0x28')](_0x1f834a,_0x7f4f('0x26'));_0x51ce56[_0x7f4f('0x29')]=_[_0x7f4f('0x2a')](_0x4d2189['query']);_0x51ce56[_0x7f4f('0x2b')]=_['intersection'](_0x51ce56[_0x7f4f('0x2c')],_0x51ce56[_0x7f4f('0x29')]);_0x26525d[_0x7f4f('0x2d')]=_[_0x7f4f('0x2e')](_0x51ce56[_0x7f4f('0x2c')],qs[_0x7f4f('0x2f')](_0x4d2189[_0x7f4f('0x29')]['fields']));_0x26525d[_0x7f4f('0x2d')]=_0x26525d['attributes'][_0x7f4f('0x30')]?_0x26525d[_0x7f4f('0x2d')]:_0x51ce56[_0x7f4f('0x2c')];if(!_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x31')](_0x7f4f('0x32'))){_0x26525d['limit']=qs[_0x7f4f('0x33')](_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x33')]);_0x26525d['offset']=qs[_0x7f4f('0x19')](_0x4d2189['query'][_0x7f4f('0x19')]);}_0x26525d[_0x7f4f('0x34')]=qs[_0x7f4f('0x35')](_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x35')]);_0x26525d[_0x7f4f('0x36')]=qs[_0x7f4f('0x2b')](_[_0x7f4f('0x37')](_0x4d2189[_0x7f4f('0x29')],_0x51ce56[_0x7f4f('0x2b')]),_0x1f834a);if(_0x4d2189['query'][_0x7f4f('0x38')]){_0x26525d[_0x7f4f('0x36')]=_['merge'](_0x26525d['where'],{'$or':_['map'](_0x1f834a,function(_0x2e36e6){if(_0x2e36e6[_0x7f4f('0x39')]!==_0x7f4f('0x3a')){var _0x2f8da8={};_0x2f8da8[_0x2e36e6[_0x7f4f('0x26')]]={'$like':'%'+_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x38')]+'%'};return _0x2f8da8;}})});}_0x26525d=_[_0x7f4f('0x3b')]({},_0x26525d,_0x4d2189[_0x7f4f('0x3c')]);var _0x557d89={'where':_0x26525d[_0x7f4f('0x36')]};return db[_0x7f4f('0x3d')][_0x7f4f('0x18')](_0x557d89)[_0x7f4f('0x22')](function(_0x1933a8){_0x13662f[_0x7f4f('0x18')]=_0x1933a8;if(_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x3e')]){_0x26525d['include']=[{'all':!![]}];}return db[_0x7f4f('0x3d')]['findAll'](_0x26525d);})[_0x7f4f('0x22')](function(_0x475a66){_0x13662f[_0x7f4f('0x3f')]=_0x475a66;return _0x13662f;})[_0x7f4f('0x22')](respondWithFilteredResult(_0x1e68b4,_0x26525d))[_0x7f4f('0x40')](handleError(_0x1e68b4,null));};exports[_0x7f4f('0x41')]=function(_0x36a383,_0x5b89b4){var _0x5a436a={'raw':!![],'where':{'id':_0x36a383[_0x7f4f('0x42')]['id']}},_0x24ef96={};_0x24ef96['model']=_[_0x7f4f('0x2a')](db[_0x7f4f('0x3d')][_0x7f4f('0x43')]);_0x24ef96[_0x7f4f('0x29')]=_[_0x7f4f('0x2a')](_0x36a383['query']);_0x24ef96[_0x7f4f('0x2b')]=_[_0x7f4f('0x2e')](_0x24ef96[_0x7f4f('0x2c')],_0x24ef96[_0x7f4f('0x29')]);_0x5a436a[_0x7f4f('0x2d')]=_[_0x7f4f('0x2e')](_0x24ef96['model'],qs[_0x7f4f('0x2f')](_0x36a383[_0x7f4f('0x29')][_0x7f4f('0x2f')]));_0x5a436a['attributes']=_0x5a436a['attributes'][_0x7f4f('0x30')]?_0x5a436a[_0x7f4f('0x2d')]:_0x24ef96[_0x7f4f('0x2c')];if(_0x36a383[_0x7f4f('0x29')][_0x7f4f('0x3e')]){_0x5a436a[_0x7f4f('0x44')]=[{'all':!![]}];}_0x5a436a=_[_0x7f4f('0x3b')]({},_0x5a436a,_0x36a383[_0x7f4f('0x3c')]);return db['JscriptySessionReport']['find'](_0x5a436a)['then'](handleEntityNotFound(_0x5b89b4,null))[_0x7f4f('0x22')](respondWithResult(_0x5b89b4,null))[_0x7f4f('0x40')](handleError(_0x5b89b4,null));};exports[_0x7f4f('0x45')]=function(_0xcb3798,_0x19bb7c){return db['JscriptySessionReport'][_0x7f4f('0x45')](_0xcb3798[_0x7f4f('0x46')],{})['then'](respondWithResult(_0x19bb7c,0xc9))['catch'](handleError(_0x19bb7c,null));};exports[_0x7f4f('0x20')]=function(_0x47e737,_0x5abe2e){if(_0x47e737[_0x7f4f('0x46')]['id']){delete _0x47e737[_0x7f4f('0x46')]['id'];}return db[_0x7f4f('0x3d')][_0x7f4f('0x47')]({'where':{'id':_0x47e737[_0x7f4f('0x42')]['id']}})[_0x7f4f('0x22')](handleEntityNotFound(_0x5abe2e,null))[_0x7f4f('0x22')](saveUpdates(_0x47e737['body'],null))[_0x7f4f('0x22')](respondWithResult(_0x5abe2e,null))[_0x7f4f('0x40')](handleError(_0x5abe2e,null));};exports['destroy']=function(_0x317614,_0x243c9a){return db[_0x7f4f('0x3d')][_0x7f4f('0x47')]({'where':{'id':_0x317614[_0x7f4f('0x42')]['id']}})[_0x7f4f('0x22')](handleEntityNotFound(_0x243c9a,null))['then'](removeEntity(_0x243c9a,null))[_0x7f4f('0x40')](handleError(_0x243c9a,null));};exports[_0x7f4f('0x48')]=function(_0x471886,_0x4172af){return db[_0x7f4f('0x3d')][_0x7f4f('0x48')]()[_0x7f4f('0x22')](respondWithResult(_0x4172af,null))[_0x7f4f('0x40')](handleError(_0x4172af,null));};exports[_0x7f4f('0x49')]=function(_0x23eacd,_0xc84f60,_0x503dab){var _0x21fa5={'raw':!![],'where':{}};var _0x1c940e={};var _0x8ad013={'count':0x0,'rows':[]};return db[_0x7f4f('0x3d')][_0x7f4f('0x4a')]({'where':{'id':_0x23eacd[_0x7f4f('0x42')]['id']}})[_0x7f4f('0x22')](handleEntityNotFound(_0xc84f60,null))[_0x7f4f('0x22')](function(_0xd90bae){if(_0xd90bae){_0x1c940e['model']=_[_0x7f4f('0x2a')](db[_0x7f4f('0x4b')][_0x7f4f('0x43')]);_0x1c940e[_0x7f4f('0x29')]=_[_0x7f4f('0x2a')](_0x23eacd[_0x7f4f('0x29')]);_0x1c940e[_0x7f4f('0x2b')]=_[_0x7f4f('0x2e')](_0x1c940e[_0x7f4f('0x2c')],_0x1c940e[_0x7f4f('0x29')]);_0x21fa5[_0x7f4f('0x2d')]=_[_0x7f4f('0x2e')](_0x1c940e['model'],qs[_0x7f4f('0x2f')](_0x23eacd[_0x7f4f('0x29')][_0x7f4f('0x2f')]));_0x21fa5[_0x7f4f('0x2d')]=_0x21fa5[_0x7f4f('0x2d')]['length']?_0x21fa5['attributes']:_0x1c940e['model'];if(!_0x23eacd[_0x7f4f('0x29')][_0x7f4f('0x31')](_0x7f4f('0x32'))){_0x21fa5[_0x7f4f('0x33')]=qs[_0x7f4f('0x33')](_0x23eacd[_0x7f4f('0x29')][_0x7f4f('0x33')]);_0x21fa5['offset']=qs[_0x7f4f('0x19')](_0x23eacd['query'][_0x7f4f('0x19')]);}_0x21fa5[_0x7f4f('0x34')]=qs['sort'](_0x23eacd[_0x7f4f('0x29')]['sort']);_0x21fa5[_0x7f4f('0x36')]=qs[_0x7f4f('0x2b')](_[_0x7f4f('0x37')](_0x23eacd['query'],_0x1c940e[_0x7f4f('0x2b')]));_0x21fa5[_0x7f4f('0x36')]['SessionId']=_0xd90bae['id'];if(_0x23eacd[_0x7f4f('0x29')][_0x7f4f('0x38')]){_0x21fa5[_0x7f4f('0x36')]=_['merge'](_0x21fa5[_0x7f4f('0x36')],{'$or':_[_0x7f4f('0x28')](_0x21fa5[_0x7f4f('0x2d')],function(_0x37b06b){var _0x3f7d8d={};_0x3f7d8d[_0x37b06b]={'$like':'%'+_0x23eacd['query'][_0x7f4f('0x38')]+'%'};return _0x3f7d8d;})});}_0x21fa5=_[_0x7f4f('0x3b')]({},_0x21fa5,_0x23eacd[_0x7f4f('0x3c')]);return db[_0x7f4f('0x4b')][_0x7f4f('0x18')]({'where':_0x21fa5[_0x7f4f('0x36')]})[_0x7f4f('0x22')](function(_0x3279cd){_0x8ad013[_0x7f4f('0x18')]=_0x3279cd;if(_0x23eacd[_0x7f4f('0x29')]['includeAll']){_0x21fa5[_0x7f4f('0x44')]=[{'all':!![]}];}return db[_0x7f4f('0x4b')][_0x7f4f('0x4c')](_0x21fa5);})[_0x7f4f('0x22')](function(_0x885ac0){_0x8ad013['rows']=_0x885ac0;return _0x8ad013;});}})[_0x7f4f('0x22')](respondWithFilteredResult(_0xc84f60,_0x21fa5))[_0x7f4f('0x40')](handleError(_0xc84f60,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8346c0a..1dec656 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 _0x6f44=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','api','moment'];(function(_0x4168b8,_0x5f62ff){var _0x41146e=function(_0x441b75){while(--_0x441b75){_0x4168b8['push'](_0x4168b8['shift']());}};_0x41146e(++_0x5f62ff);}(_0x6f44,0x1ea));var _0x46f4=function(_0x1bc7b9,_0x139cd1){_0x1bc7b9=_0x1bc7b9-0x0;var _0x369ecf=_0x6f44[_0x1bc7b9];return _0x369ecf;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var logger=require('../../config/logger')(_0x46f4('0x2'));var moment=require(_0x46f4('0x3'));var BPromise=require(_0x46f4('0x4'));var rp=require(_0x46f4('0x5'));var fs=require('fs');var path=require(_0x46f4('0x6'));var rimraf=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var attributes=require(_0x46f4('0x9'));module[_0x46f4('0xa')]=function(_0x57f1a9,_0x169a5a){return _0x57f1a9[_0x46f4('0xb')](_0x46f4('0xc'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38b8=['../../config/logger','api','bluebird','rimraf','../../config/environment','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x38b8,0x7f));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x838b('0x0'));var util=require('util');var logger=require(_0x838b('0x1'))(_0x838b('0x2'));var moment=require('moment');var BPromise=require(_0x838b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x838b('0x4'));var config=require(_0x838b('0x5'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x43fd53,_0x4299dc){return _0x43fd53['define'](_0x838b('0x6'),attributes,{'tableName':_0x838b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index fb266cd..b6b8343 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 _0xe74e=['../../config/logger','rpc','../../config/environment','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x28a6ad,_0x351697){var _0xbb804=function(_0x165d37){while(--_0x165d37){_0x28a6ad['push'](_0x28a6ad['shift']());}};_0xbb804(++_0x351697);}(_0xe74e,0x10a));var _0xee74=function(_0x500abc,_0x532cbf){_0x500abc=_0x500abc-0x0;var _0x268b6d=_0xe74e[_0x500abc];return _0x268b6d;};'use strict';var _=require('lodash');var util=require(_0xee74('0x0'));var moment=require(_0xee74('0x1'));var BPromise=require(_0xee74('0x2'));var rs=require(_0xee74('0x3'));var fs=require('fs');var Redis=require(_0xee74('0x4'));var db=require(_0xee74('0x5'))['db'];var utils=require(_0xee74('0x6'));var logger=require(_0xee74('0x7'))(_0xee74('0x8'));var config=require(_0xee74('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242ac6,_0x539a7b,_0x58fa11){return new BPromise(function(_0x11c67e,_0x21043c){return client[_0xee74('0xb')](_0x242ac6,_0x58fa11)['then'](function(_0x48cdb0){logger[_0xee74('0xc')](_0xee74('0xd'),_0x539a7b,_0xee74('0xe'));logger[_0xee74('0xf')](_0xee74('0x10'),_0x539a7b,_0xee74('0xe'),JSON['stringify'](_0x48cdb0));if(_0x48cdb0[_0xee74('0x11')]){if(_0x48cdb0[_0xee74('0x11')][_0xee74('0x12')]===0x1f4){logger[_0xee74('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x539a7b,_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);return _0x21043c(_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);}logger['error'](_0xee74('0xd'),_0x539a7b,_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);return _0x11c67e(_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);}else{logger[_0xee74('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x539a7b,_0xee74('0xe'));_0x11c67e(_0x48cdb0[_0xee74('0x14')][_0xee74('0x13')]);}})['catch'](function(_0x988fb5){logger[_0xee74('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x539a7b,_0x988fb5);_0x21043c(_0x988fb5);});});} \ No newline at end of file +var _0xc67b=['util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xc67b,0x17a));var _0xbc67=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc67b[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xbc67('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbc67('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc67('0x2'))['db'];var utils=require(_0xbc67('0x3'));var logger=require('../../config/logger')(_0xbc67('0x4'));var config=require(_0xbc67('0x5'));var jayson=require(_0xbc67('0x6'));var client=jayson[_0xbc67('0x7')][_0xbc67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eb7ca,_0x14f949,_0x4f0be4){return new BPromise(function(_0x55cf26,_0x5eae18){return client[_0xbc67('0x9')](_0x1eb7ca,_0x4f0be4)[_0xbc67('0xa')](function(_0x35b900){logger['info'](_0xbc67('0xb'),_0x14f949,_0xbc67('0xc'));logger[_0xbc67('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x14f949,'request\x20sent',JSON[_0xbc67('0xe')](_0x35b900));if(_0x35b900[_0xbc67('0xf')]){if(_0x35b900[_0xbc67('0xf')][_0xbc67('0x10')]===0x1f4){logger[_0xbc67('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x14f949,_0x35b900['error'][_0xbc67('0x11')]);return _0x5eae18(_0x35b900['error'][_0xbc67('0x11')]);}logger['error'](_0xbc67('0xb'),_0x14f949,_0x35b900[_0xbc67('0xf')][_0xbc67('0x11')]);return _0x55cf26(_0x35b900[_0xbc67('0xf')]['message']);}else{logger[_0xbc67('0x12')](_0xbc67('0xb'),_0x14f949,_0xbc67('0xc'));_0x55cf26(_0x35b900[_0xbc67('0x13')][_0xbc67('0x11')]);}})[_0xbc67('0x14')](function(_0x4bd640){logger[_0xbc67('0xf')](_0xbc67('0xb'),_0x14f949,_0x4bd640);_0x5eae18(_0x4bd640);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 1b62593..4bfff5c 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 _0x9ca8=['exports','multer','util','path','connect-timeout','../../components/auth/service','./license.controller','get','index','/:id','update'];(function(_0x21e29b,_0x47dd45){var _0x28f11e=function(_0xb91b0d){while(--_0xb91b0d){_0x21e29b['push'](_0x21e29b['shift']());}};_0x28f11e(++_0x47dd45);}(_0x9ca8,0xb1));var _0x89ca=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0x9ca8[_0x418549];return _0x288826;};'use strict';var multer=require(_0x89ca('0x0'));var util=require(_0x89ca('0x1'));var path=require(_0x89ca('0x2'));var timeout=require(_0x89ca('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x89ca('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89ca('0x5'));router[_0x89ca('0x6')]('/',controller[_0x89ca('0x7')]);router['put'](_0x89ca('0x8'),auth['isAuthenticated'](),controller[_0x89ca('0x9')]);module[_0x89ca('0xa')]=router; \ No newline at end of file +var _0x0840=['put','isAuthenticated','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller','get'];(function(_0x5afd6a,_0x559bee){var _0xb2a24d=function(_0x15ca38){while(--_0x15ca38){_0x5afd6a['push'](_0x5afd6a['shift']());}};_0xb2a24d(++_0x559bee);}(_0x0840,0x6b));var _0x0084=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x0840[_0x22eb96];return _0x5e1adf;};'use strict';var multer=require(_0x0084('0x0'));var util=require(_0x0084('0x1'));var path=require(_0x0084('0x2'));var timeout=require(_0x0084('0x3'));var express=require(_0x0084('0x4'));var router=express[_0x0084('0x5')]();var auth=require(_0x0084('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0084('0x7'));var controller=require(_0x0084('0x8'));router[_0x0084('0x9')]('/',controller['index']);router[_0x0084('0xa')]('/:id',auth[_0x0084('0xb')](),controller[_0x0084('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 07ac8c8..ffe8ee9 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(_0x157fdf,_0x255a37){var _0x4faa13=function(_0x188f62){while(--_0x188f62){_0x157fdf['push'](_0x157fdf['shift']());}};_0x4faa13(++_0x255a37);}(_0x2675,0x75));var _0x5267=function(_0x2e997d,_0x460edc){_0x2e997d=_0x2e997d-0x0;var _0x325930=_0x2675[_0x2e997d];return _0x325930;};'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 _0x4819=['INTEGER','exports','TEXT','STRING'];(function(_0x1fbd72,_0x5b353f){var _0x47e61a=function(_0x24581a){while(--_0x24581a){_0x1fbd72['push'](_0x1fbd72['shift']());}};_0x47e61a(++_0x5b353f);}(_0x4819,0xcd));var _0x9481=function(_0x597992,_0x516580){_0x597992=_0x597992-0x0;var _0x2bea67=_0x4819[_0x597992];return _0x2bea67;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'license':{'type':Sequelize[_0x9481('0x1')]},'data1':{'type':Sequelize[_0x9481('0x2')]},'data2':{'type':Sequelize[_0x9481('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x9481('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index ea23b97..da32978 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 _0xb439=['catch','body','License','find','params','checkLicense','key','demo','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','json','count','offset','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','../../config/license/util','index','model','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense'];(function(_0x2848d6,_0x1376f8){var _0x14eca6=function(_0x4c4027){while(--_0x4c4027){_0x2848d6['push'](_0x2848d6['shift']());}};_0x14eca6(++_0x1376f8);}(_0xb439,0x152));var _0x9b43=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb439[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x9b43('0x0'));var emlformat=require(_0x9b43('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9b43('0x2'));var jsonpatch=require(_0x9b43('0x3'));var rp=require(_0x9b43('0x4'));var moment=require('moment');var BPromise=require(_0x9b43('0x5'));var Mustache=require(_0x9b43('0x6'));var util=require(_0x9b43('0x7'));var path=require(_0x9b43('0x8'));var sox=require('sox');var csv=require(_0x9b43('0x9'));var ejs=require(_0x9b43('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9b43('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9b43('0xc'));var toCsv=require(_0x9b43('0x9'));var querystring=require(_0x9b43('0xd'));var Papa=require('papaparse');var Redis=require(_0x9b43('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9b43('0xf'));var as=require(_0x9b43('0x10'));var hardwareService=require(_0x9b43('0x11'));var logger=require(_0x9b43('0x12'))(_0x9b43('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120411,_0x2870f3){_0x2870f3=_0x2870f3||0xcc;return function(_0x48645b){if(_0x48645b){return _0x120411['sendStatus'](_0x2870f3);}return _0x120411[_0x9b43('0x14')](_0x2870f3)['end']();};}function respondWithResult(_0x5e5d30,_0x4eb34f){_0x4eb34f=_0x4eb34f||0xc8;return function(_0x511d66){if(_0x511d66){return _0x5e5d30[_0x9b43('0x14')](_0x4eb34f)[_0x9b43('0x15')](_0x511d66);}};}function respondWithFilteredResult(_0x1b5aee,_0x404156){return function(_0x3f4dd5){if(_0x3f4dd5){var _0x3d2a36=_0x3f4dd5[_0x9b43('0x16')],_0x172595=_0x404156[_0x9b43('0x17')],_0x2d7756=_0x404156[_0x9b43('0x17')]+_0x404156['limit'],_0x4f04b9;if(_0x2d7756>=_0x3d2a36){_0x2d7756=_0x3d2a36;_0x4f04b9=0xc8;}else{_0x4f04b9=0xce;}_0x1b5aee[_0x9b43('0x14')](_0x4f04b9);return _0x1b5aee['set'](_0x9b43('0x18'),_0x172595+'-'+_0x2d7756+'/'+_0x3d2a36)['json'](_0x3f4dd5);}return null;};}function patchUpdates(_0x546a29){return function(_0x41f2cd){try{jsonpatch[_0x9b43('0x19')](_0x41f2cd,_0x546a29,!![]);}catch(_0x6923c1){return BPromise[_0x9b43('0x1a')](_0x6923c1);}return _0x41f2cd['save']();};}function saveUpdates(_0x36cee0,_0x104242){return function(_0x38e52f){if(_0x38e52f){return _0x38e52f[_0x9b43('0x1b')](_0x36cee0)[_0x9b43('0x1c')](function(_0x298ac1){return _0x298ac1;});}return null;};}function removeEntity(_0x4c0313,_0xc9e11a){return function(_0x3f2e13){if(_0x3f2e13){return _0x3f2e13['destroy']()[_0x9b43('0x1c')](function(){_0x4c0313['status'](0xcc)[_0x9b43('0x1d')]();});}};}function handleEntityNotFound(_0x432d7e,_0x413108){return function(_0x29f3c8){if(!_0x29f3c8){_0x432d7e[_0x9b43('0x1e')](0x194);}return _0x29f3c8;};}function handleError(_0x497bad,_0x581f8c){_0x581f8c=_0x581f8c||0x1f4;return function(_0x1577f9){logger[_0x9b43('0x1f')](_0x1577f9[_0x9b43('0x20')]);if(_0x1577f9[_0x9b43('0x21')]){delete _0x1577f9[_0x9b43('0x21')];}_0x497bad[_0x9b43('0x14')](_0x581f8c)['send'](_0x1577f9);};}var utilLicense=require(_0x9b43('0x22'));exports[_0x9b43('0x23')]=function(_0x1226f5,_0x436bbd){var _0x46a6da={'raw':!![],'where':{'id':0x1}},_0x411e1f={};_0x411e1f[_0x9b43('0x24')]=_['keys'](db['License'][_0x9b43('0x25')]);_0x411e1f[_0x9b43('0x26')]=_['keys'](_0x1226f5[_0x9b43('0x26')]);_0x411e1f[_0x9b43('0x27')]=_[_0x9b43('0x28')](_0x411e1f['model'],_0x411e1f[_0x9b43('0x26')]);_0x46a6da[_0x9b43('0x29')]=_[_0x9b43('0x28')](_0x411e1f['model'],qs[_0x9b43('0x2a')](_0x1226f5[_0x9b43('0x26')][_0x9b43('0x2a')]));_0x46a6da[_0x9b43('0x29')]=_0x46a6da[_0x9b43('0x29')][_0x9b43('0x2b')]?_0x46a6da[_0x9b43('0x29')]:_0x411e1f['model'];_0x46a6da=_[_0x9b43('0x2c')]({},_0x46a6da,_0x1226f5[_0x9b43('0x2d')]);return utilLicense[_0x9b43('0x2e')](_0x46a6da)[_0x9b43('0x1c')](respondWithResult(_0x436bbd,null))[_0x9b43('0x2f')](handleError(_0x436bbd,null));};exports[_0x9b43('0x1b')]=function(_0x12e8b5,_0x431604){if(_0x12e8b5[_0x9b43('0x30')]['id']){delete _0x12e8b5[_0x9b43('0x30')]['id'];}return db[_0x9b43('0x31')][_0x9b43('0x32')]({'where':{'id':_0x12e8b5[_0x9b43('0x33')]['id']}})[_0x9b43('0x1c')](handleEntityNotFound(_0x431604,null))[_0x9b43('0x1c')](function(_0x4b64b6){var _0x58f200=_0x4b64b6['get']({'plain':!![]});return utilLicense[_0x9b43('0x34')](_0x58f200,_0x12e8b5[_0x9b43('0x30')][_0x9b43('0x35')]);})[_0x9b43('0x1c')](function(_0x4ecd38){if(!_0x4ecd38[_0x9b43('0x36')]){return saveUpdates(_0x12e8b5[_0x9b43('0x30')],null);}return _0x4ecd38;})[_0x9b43('0x1c')](respondWithResult(_0x431604,null))['catch'](handleError(_0x431604,null));}; \ No newline at end of file +var _0x62ba=['../../config/environment','sendStatus','end','json','offset','limit','status','set','Content-Range','reject','then','stack','name','send','../../config/license/util','index','keys','License','rawAttributes','query','intersection','model','attributes','fields','length','merge','options','getLicense','catch','update','body','find','params','get','checkLicense','key','demo','html-pdf','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x5c0122,_0x3ec654){var _0x15daf3=function(_0x3ae671){while(--_0x3ae671){_0x5c0122['push'](_0x5c0122['shift']());}};_0x15daf3(++_0x3ec654);}(_0x62ba,0x10d));var _0xa62b=function(_0x4bb8ce,_0x2e7bf3){_0x4bb8ce=_0x4bb8ce-0x0;var _0x1ec99f=_0x62ba[_0x4bb8ce];return _0x1ec99f;};'use strict';var pdf=require(_0xa62b('0x0'));var emlformat=require(_0xa62b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa62b('0x2'));var BPromise=require(_0xa62b('0x3'));var Mustache=require(_0xa62b('0x4'));var util=require(_0xa62b('0x5'));var path=require(_0xa62b('0x6'));var sox=require(_0xa62b('0x7'));var csv=require(_0xa62b('0x8'));var ejs=require(_0xa62b('0x9'));var fs=require('fs');var _=require(_0xa62b('0xa'));var squel=require('squel');var crypto=require(_0xa62b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa62b('0xc'));var toCsv=require(_0xa62b('0x8'));var querystring=require(_0xa62b('0xd'));var Papa=require(_0xa62b('0xe'));var Redis=require(_0xa62b('0xf'));var authService=require(_0xa62b('0x10'));var qs=require(_0xa62b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa62b('0x12'))(_0xa62b('0x13'));var utils=require(_0xa62b('0x14'));var config=require(_0xa62b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaa1759,_0x5ef11e){_0x5ef11e=_0x5ef11e||0xcc;return function(_0x3a9399){if(_0x3a9399){return _0xaa1759[_0xa62b('0x16')](_0x5ef11e);}return _0xaa1759['status'](_0x5ef11e)[_0xa62b('0x17')]();};}function respondWithResult(_0x307ccc,_0x103908){_0x103908=_0x103908||0xc8;return function(_0x2fc58e){if(_0x2fc58e){return _0x307ccc['status'](_0x103908)[_0xa62b('0x18')](_0x2fc58e);}};}function respondWithFilteredResult(_0x4fd309,_0x310fe0){return function(_0x6c757b){if(_0x6c757b){var _0x14e911=_0x6c757b['count'],_0x2a638e=_0x310fe0[_0xa62b('0x19')],_0x355485=_0x310fe0['offset']+_0x310fe0[_0xa62b('0x1a')],_0x10a9e0;if(_0x355485>=_0x14e911){_0x355485=_0x14e911;_0x10a9e0=0xc8;}else{_0x10a9e0=0xce;}_0x4fd309[_0xa62b('0x1b')](_0x10a9e0);return _0x4fd309[_0xa62b('0x1c')](_0xa62b('0x1d'),_0x2a638e+'-'+_0x355485+'/'+_0x14e911)['json'](_0x6c757b);}return null;};}function patchUpdates(_0x4a5ac5){return function(_0x46eff9){try{jsonpatch['apply'](_0x46eff9,_0x4a5ac5,!![]);}catch(_0x199f92){return BPromise[_0xa62b('0x1e')](_0x199f92);}return _0x46eff9['save']();};}function saveUpdates(_0x1fa681,_0x3feec0){return function(_0x358eb9){if(_0x358eb9){return _0x358eb9['update'](_0x1fa681)['then'](function(_0x529354){return _0x529354;});}return null;};}function removeEntity(_0x3fea58,_0x238ecf){return function(_0x32df02){if(_0x32df02){return _0x32df02['destroy']()[_0xa62b('0x1f')](function(){_0x3fea58[_0xa62b('0x1b')](0xcc)[_0xa62b('0x17')]();});}};}function handleEntityNotFound(_0x5dd4f0,_0x545485){return function(_0x565663){if(!_0x565663){_0x5dd4f0[_0xa62b('0x16')](0x194);}return _0x565663;};}function handleError(_0x4c5b72,_0x3c4a7a){_0x3c4a7a=_0x3c4a7a||0x1f4;return function(_0x5c63ea){logger['error'](_0x5c63ea[_0xa62b('0x20')]);if(_0x5c63ea[_0xa62b('0x21')]){delete _0x5c63ea[_0xa62b('0x21')];}_0x4c5b72['status'](_0x3c4a7a)[_0xa62b('0x22')](_0x5c63ea);};}var utilLicense=require(_0xa62b('0x23'));exports[_0xa62b('0x24')]=function(_0xa706f0,_0x2dc404){var _0x534210={'raw':!![],'where':{'id':0x1}},_0x3c2a67={};_0x3c2a67['model']=_[_0xa62b('0x25')](db[_0xa62b('0x26')][_0xa62b('0x27')]);_0x3c2a67['query']=_[_0xa62b('0x25')](_0xa706f0[_0xa62b('0x28')]);_0x3c2a67['filters']=_[_0xa62b('0x29')](_0x3c2a67[_0xa62b('0x2a')],_0x3c2a67[_0xa62b('0x28')]);_0x534210[_0xa62b('0x2b')]=_['intersection'](_0x3c2a67[_0xa62b('0x2a')],qs[_0xa62b('0x2c')](_0xa706f0['query'][_0xa62b('0x2c')]));_0x534210[_0xa62b('0x2b')]=_0x534210[_0xa62b('0x2b')][_0xa62b('0x2d')]?_0x534210[_0xa62b('0x2b')]:_0x3c2a67[_0xa62b('0x2a')];_0x534210=_[_0xa62b('0x2e')]({},_0x534210,_0xa706f0[_0xa62b('0x2f')]);return utilLicense[_0xa62b('0x30')](_0x534210)[_0xa62b('0x1f')](respondWithResult(_0x2dc404,null))[_0xa62b('0x31')](handleError(_0x2dc404,null));};exports[_0xa62b('0x32')]=function(_0x5b65bc,_0x3ebeb0){if(_0x5b65bc[_0xa62b('0x33')]['id']){delete _0x5b65bc[_0xa62b('0x33')]['id'];}return db[_0xa62b('0x26')][_0xa62b('0x34')]({'where':{'id':_0x5b65bc[_0xa62b('0x35')]['id']}})[_0xa62b('0x1f')](handleEntityNotFound(_0x3ebeb0,null))[_0xa62b('0x1f')](function(_0x1dd497){var _0x4b5c1d=_0x1dd497[_0xa62b('0x36')]({'plain':!![]});return utilLicense[_0xa62b('0x37')](_0x4b5c1d,_0x5b65bc[_0xa62b('0x33')][_0xa62b('0x38')]);})[_0xa62b('0x1f')](function(_0x3203ce){if(!_0x3203ce[_0xa62b('0x39')]){return saveUpdates(_0x5b65bc[_0xa62b('0x33')],null);}return _0x3203ce;})['then'](respondWithResult(_0x3ebeb0,null))['catch'](handleError(_0x3ebeb0,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f36a195..4dd8019 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','license','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2090b7,_0x21e78d){var _0x2ad7d5=function(_0x2e906e){while(--_0x2e906e){_0x2090b7['push'](_0x2090b7['shift']());}};_0x2ad7d5(++_0x21e78d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('License',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a5b9f,_0x599f46){_0x3a5b9f=_0x3a5b9f-0x0;var _0x4e9b72=_0xb10b[_0x3a5b9f];return _0x4e9b72;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index bec7132..d5ce28c 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 _0x115a=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s'];(function(_0x1ccd8a,_0x5bf417){var _0x5a69d8=function(_0x336fdb){while(--_0x336fdb){_0x1ccd8a['push'](_0x1ccd8a['shift']());}};_0x5a69d8(++_0x5bf417);}(_0x115a,0x91));var _0xa115=function(_0x241214,_0x458410){_0x241214=_0x241214-0x0;var _0x12f2df=_0x115a[_0x241214];return _0x12f2df;};'use strict';var _=require(_0xa115('0x0'));var util=require(_0xa115('0x1'));var moment=require(_0xa115('0x2'));var BPromise=require(_0xa115('0x3'));var rs=require(_0xa115('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa115('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa115('0x6'))(_0xa115('0x7'));var config=require(_0xa115('0x8'));var jayson=require(_0xa115('0x9'));var client=jayson[_0xa115('0xa')][_0xa115('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x567cb3,_0x2499eb,_0x149d01){return new BPromise(function(_0x291bec,_0x2a7527){return client[_0xa115('0xc')](_0x567cb3,_0x149d01)[_0xa115('0xd')](function(_0xd6f607){logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));logger[_0xa115('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x2499eb,_0xa115('0x10'),JSON[_0xa115('0x12')](_0xd6f607));if(_0xd6f607[_0xa115('0x13')]){if(_0xd6f607[_0xa115('0x13')]['code']===0x1f4){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x2a7527(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}logger[_0xa115('0x13')]('License,\x20%s,\x20%s',_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x291bec(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}else{logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));_0x291bec(_0xd6f607[_0xa115('0x15')][_0xa115('0x14')]);}})[_0xa115('0x16')](function(_0x30c06b){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0x30c06b);_0x2a7527(_0x30c06b);});});} \ No newline at end of file +var _0x652b=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','client','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','License,\x20%s,\x20%s','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x652b,0x68));var _0xb652=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x652b[_0x57975f];return _0x4793b8;};'use strict';var _=require(_0xb652('0x0'));var util=require(_0xb652('0x1'));var moment=require(_0xb652('0x2'));var BPromise=require('bluebird');var rs=require(_0xb652('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb652('0x4'));var logger=require(_0xb652('0x5'))(_0xb652('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb652('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58d168,_0x10b742,_0x5c0245){return new BPromise(function(_0x2b82fd,_0x117e49){return client[_0xb652('0x8')](_0x58d168,_0x5c0245)[_0xb652('0x9')](function(_0x2f06f0){logger[_0xb652('0xa')]('License,\x20%s,\x20%s',_0x10b742,'request\x20sent');logger[_0xb652('0xb')](_0xb652('0xc'),_0x10b742,_0xb652('0xd'),JSON[_0xb652('0xe')](_0x2f06f0));if(_0x2f06f0['error']){if(_0x2f06f0[_0xb652('0xf')][_0xb652('0x10')]===0x1f4){logger[_0xb652('0xf')]('License,\x20%s,\x20%s',_0x10b742,_0x2f06f0[_0xb652('0xf')][_0xb652('0x11')]);return _0x117e49(_0x2f06f0['error']['message']);}logger['error']('License,\x20%s,\x20%s',_0x10b742,_0x2f06f0[_0xb652('0xf')]['message']);return _0x2b82fd(_0x2f06f0[_0xb652('0xf')][_0xb652('0x11')]);}else{logger[_0xb652('0xa')]('License,\x20%s,\x20%s',_0x10b742,_0xb652('0xd'));_0x2b82fd(_0x2f06f0[_0xb652('0x12')][_0xb652('0x11')]);}})[_0xb652('0x13')](function(_0x4ba393){logger[_0xb652('0xf')](_0xb652('0x14'),_0x10b742,_0x4ba393);_0x117e49(_0x4ba393);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 7cc6bd8..f283f16 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 _0x63b9=['isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addAnswer','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','put','/:id','update','removeDispositions','removeAnswers','delete','removeImap','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','get'];(function(_0x327905,_0x3a5af7){var _0x4b8ba6=function(_0x4a5c43){while(--_0x4a5c43){_0x327905['push'](_0x327905['shift']());}};_0x4b8ba6(++_0x3a5af7);}(_0x63b9,0xdb));var _0x963b=function(_0x12d4b7,_0x29cc5d){_0x12d4b7=_0x12d4b7-0x0;var _0x379644=_0x63b9[_0x12d4b7];return _0x379644;};'use strict';var multer=require(_0x963b('0x0'));var util=require(_0x963b('0x1'));var path=require('path');var timeout=require(_0x963b('0x2'));var express=require(_0x963b('0x3'));var router=express[_0x963b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x963b('0x5')]('/',auth[_0x963b('0x6')](),controller[_0x963b('0x7')]);router[_0x963b('0x5')](_0x963b('0x8'),auth[_0x963b('0x6')](),controller[_0x963b('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x963b('0xa')]);router[_0x963b('0x5')](_0x963b('0xb'),auth['isAuthenticated'](),controller[_0x963b('0xc')]);router[_0x963b('0x5')](_0x963b('0xd'),auth['isAuthenticated'](),controller[_0x963b('0xe')]);router[_0x963b('0x5')]('/:id/in_servers',auth[_0x963b('0x6')](),controller[_0x963b('0xf')]);router[_0x963b('0x5')](_0x963b('0x10'),auth[_0x963b('0x6')](),controller[_0x963b('0x11')]);router['get'](_0x963b('0x12'),auth[_0x963b('0x6')](),controller[_0x963b('0x13')]);router['get'](_0x963b('0x14'),auth[_0x963b('0x6')](),controller['getApplications']);router[_0x963b('0x5')](_0x963b('0x15'),auth[_0x963b('0x6')](),controller[_0x963b('0x16')]);router['get'](_0x963b('0x17'),auth[_0x963b('0x6')](),controller[_0x963b('0x18')]);router[_0x963b('0x5')]('/:id/users',auth[_0x963b('0x6')](),controller[_0x963b('0x19')]);router[_0x963b('0x1a')]('/:id/dispositions',auth[_0x963b('0x6')](),controller['addDisposition']);router['post'](_0x963b('0xd'),auth['isAuthenticated'](),controller[_0x963b('0x1b')]);router[_0x963b('0x1a')]('/',auth[_0x963b('0x6')](),controller['create']);router[_0x963b('0x1a')](_0x963b('0x1c'),auth[_0x963b('0x6')](),controller[_0x963b('0x1d')]);router[_0x963b('0x1a')](_0x963b('0x10'),auth[_0x963b('0x6')](),controller[_0x963b('0x1e')]);router['post'](_0x963b('0x12'),auth[_0x963b('0x6')](),controller[_0x963b('0x1f')]);router[_0x963b('0x1a')](_0x963b('0x14'),auth[_0x963b('0x6')](),controller[_0x963b('0x20')]);router[_0x963b('0x1a')](_0x963b('0x21'),auth[_0x963b('0x6')](),controller[_0x963b('0x22')]);router[_0x963b('0x1a')]('/:id/users',auth[_0x963b('0x6')](),controller['addAgents']);router[_0x963b('0x23')](_0x963b('0x24'),auth['isAuthenticated'](),controller[_0x963b('0x25')]);router['delete'](_0x963b('0xb'),auth[_0x963b('0x6')](),controller[_0x963b('0x26')]);router['delete'](_0x963b('0xd'),auth[_0x963b('0x6')](),controller[_0x963b('0x27')]);router[_0x963b('0x28')](_0x963b('0x1c'),auth['isAuthenticated'](),controller[_0x963b('0x29')]);router[_0x963b('0x28')]('/:id/out_servers',auth['isAuthenticated'](),controller['removeSmtp']);router[_0x963b('0x28')](_0x963b('0x24'),auth[_0x963b('0x6')](),controller['destroy']);router[_0x963b('0x28')](_0x963b('0x2a'),auth[_0x963b('0x6')](),controller[_0x963b('0x2b')]);module[_0x963b('0x2c')]=router; \ No newline at end of file +var _0x073e=['/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','addSmtp','addInteraction'];(function(_0x402f08,_0x5a3d66){var _0x14632a=function(_0x3e3584){while(--_0x3e3584){_0x402f08['push'](_0x402f08['shift']());}};_0x14632a(++_0x5a3d66);}(_0x073e,0x14e));var _0xe073=function(_0x329101,_0x1eb476){_0x329101=_0x329101-0x0;var _0x1641d6=_0x073e[_0x329101];return _0x1641d6;};'use strict';var multer=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var path=require(_0xe073('0x2'));var timeout=require(_0xe073('0x3'));var express=require(_0xe073('0x4'));var router=express['Router']();var auth=require(_0xe073('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe073('0x6'));var controller=require(_0xe073('0x7'));router[_0xe073('0x8')]('/',auth[_0xe073('0x9')](),controller[_0xe073('0xa')]);router[_0xe073('0x8')](_0xe073('0xb'),auth[_0xe073('0x9')](),controller[_0xe073('0xc')]);router[_0xe073('0x8')](_0xe073('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe073('0x8')](_0xe073('0xe'),auth[_0xe073('0x9')](),controller[_0xe073('0xf')]);router[_0xe073('0x8')]('/:id/canned_answers',auth[_0xe073('0x9')](),controller[_0xe073('0x10')]);router[_0xe073('0x8')](_0xe073('0x11'),auth['isAuthenticated'](),controller[_0xe073('0x12')]);router['get'](_0xe073('0x13'),auth['isAuthenticated'](),controller['getSmtp']);router[_0xe073('0x8')](_0xe073('0x14'),auth[_0xe073('0x9')](),controller[_0xe073('0x15')]);router[_0xe073('0x8')](_0xe073('0x16'),auth[_0xe073('0x9')](),controller[_0xe073('0x17')]);router['get']('/:id/messages',auth[_0xe073('0x9')](),controller[_0xe073('0x18')]);router[_0xe073('0x8')](_0xe073('0x19'),auth[_0xe073('0x9')](),controller[_0xe073('0x1a')]);router[_0xe073('0x8')](_0xe073('0x1b'),auth['isAuthenticated'](),controller[_0xe073('0x1c')]);router['post'](_0xe073('0xe'),auth['isAuthenticated'](),controller[_0xe073('0x1d')]);router[_0xe073('0x1e')]('/:id/canned_answers',auth[_0xe073('0x9')](),controller[_0xe073('0x1f')]);router[_0xe073('0x1e')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe073('0x1e')](_0xe073('0x11'),auth[_0xe073('0x9')](),controller['addImap']);router[_0xe073('0x1e')](_0xe073('0x13'),auth[_0xe073('0x9')](),controller[_0xe073('0x20')]);router[_0xe073('0x1e')](_0xe073('0x14'),auth[_0xe073('0x9')](),controller[_0xe073('0x21')]);router[_0xe073('0x1e')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xe073('0x1e')](_0xe073('0x22'),auth[_0xe073('0x9')](),controller[_0xe073('0x23')]);router[_0xe073('0x1e')](_0xe073('0x1b'),auth['isAuthenticated'](),controller[_0xe073('0x24')]);router['put'](_0xe073('0xd'),auth[_0xe073('0x9')](),controller[_0xe073('0x25')]);router[_0xe073('0x26')](_0xe073('0xe'),auth[_0xe073('0x9')](),controller[_0xe073('0x27')]);router[_0xe073('0x26')]('/:id/canned_answers',auth[_0xe073('0x9')](),controller[_0xe073('0x28')]);router[_0xe073('0x26')]('/:id/in_servers',auth[_0xe073('0x9')](),controller[_0xe073('0x29')]);router[_0xe073('0x26')]('/:id/out_servers',auth[_0xe073('0x9')](),controller[_0xe073('0x2a')]);router[_0xe073('0x26')](_0xe073('0xd'),auth[_0xe073('0x9')](),controller[_0xe073('0x2b')]);router[_0xe073('0x26')](_0xe073('0x1b'),auth[_0xe073('0x9')](),controller[_0xe073('0x2c')]);module[_0xe073('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 2070e64..86606a9 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 _0xf841=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0xf841,0x1a9));var _0x1f84=function(_0x224067,_0xe73c38){_0x224067=_0x224067-0x0;var _0x4af627=_0xf841[_0x224067];return _0x4af627;};'use strict';var Sequelize=require(_0x1f84('0x0'));module[_0x1f84('0x1')]={'description':{'type':Sequelize[_0x1f84('0x2')]},'name':{'type':Sequelize[_0x1f84('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1f84('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1f84('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1f84('0x4')},'fontSize':{'type':Sequelize[_0x1f84('0x5')](0x2)[_0x1f84('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1f84('0x7')],'defaultValue':function(){return _0x1f84('0x8');}},'notificationSound':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f84('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1f84('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1f84('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f84('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x1f84('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':![],'comment':_0x1f84('0xa'),'set':function(_0x6e7e2){if(!_0x6e7e2)this[_0x1f84('0xb')](_0x1f84('0xc'),null);this[_0x1f84('0xb')](_0x1f84('0xd'),_0x6e7e2);}}}; \ No newline at end of file +var _0xd005=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0xd005,0xe2));var _0x5d00=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd005[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x5d00('0x0'));module[_0x5d00('0x1')]={'description':{'type':Sequelize[_0x5d00('0x2')]},'name':{'type':Sequelize[_0x5d00('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5d00('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x5d00('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x5d00('0x4')]},'markAsUnread':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5d00('0x5')},'fontSize':{'type':Sequelize[_0x5d00('0x6')](0x2)[_0x5d00('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5d00('0x4')],'defaultValue':function(){return _0x5d00('0x8');}},'notificationSound':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5d00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5d00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5d00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5d00('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x5d00('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5d00('0xa'),'set':function(_0x249b73){if(!_0x249b73)this[_0x5d00('0xb')]('mandatoryDispositionPauseId',null);this[_0x5d00('0xb')](_0x5d00('0xc'),_0x249b73);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 02db39f..aac2949 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 _0xc75e=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','redis','./mailAccount.socket','register','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','count','offset','set','json','reject','destroy','get','stack','name','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','query','keys','filters','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','Pause','intersection','body','find','update','describe','Disposition','getDispositions','hasOwnProperty','rows','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','create','getAnswers','findOne','removeAnswers','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','port','host','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','send','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','server/files/attachments','secure','auth','List\x20not\x20found','defaults','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir'];(function(_0x46229d,_0x4eef5d){var _0x154732=function(_0x15b6aa){while(--_0x15b6aa){_0x46229d['push'](_0x46229d['shift']());}};_0x154732(++_0x4eef5d);}(_0xc75e,0x17f));var _0xec75=function(_0x4d7dfa,_0x2daec0){_0x4d7dfa=_0x4d7dfa-0x0;var _0xe7e02b=_0xc75e[_0x4d7dfa];return _0xe7e02b;};'use strict';var pdf=require(_0xec75('0x0'));var emlformat=require(_0xec75('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xec75('0x2'));var jsonpatch=require(_0xec75('0x3'));var rp=require(_0xec75('0x4'));var moment=require(_0xec75('0x5'));var BPromise=require(_0xec75('0x6'));var Mustache=require(_0xec75('0x7'));var util=require(_0xec75('0x8'));var path=require(_0xec75('0x9'));var sox=require(_0xec75('0xa'));var csv=require(_0xec75('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec75('0xc'));var squel=require(_0xec75('0xd'));var crypto=require(_0xec75('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xec75('0xf'));var toCsv=require(_0xec75('0xb'));var querystring=require(_0xec75('0x10'));var Papa=require(_0xec75('0x11'));var Redis=require(_0xec75('0x12'));var authService=require(_0xec75('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec75('0x14'))(_0xec75('0x15'));var utils=require(_0xec75('0x16'));var config=require(_0xec75('0x17'));var db=require(_0xec75('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xec75('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec75('0x1a')]));require(_0xec75('0x1b'))[_0xec75('0x1c')](socket);var jayson=require(_0xec75('0x1d'));var client=jayson['client'][_0xec75('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x2d162c,_0x30ef3c,_0x46dd22){if(_0x46dd22){var _0x4af9b3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4af9b3[_0xec75('0x1f')](_0x30ef3c)){return _0x2d162c;}else{throw new db[(_0xec75('0x20'))]['ValidationError'](_0xec75('0x21'));}}else{return _0x2d162c;}}function respondWithRpcPromise(_0x2f2d09,_0x190906,_0x26fc00,_0x441758){return new BPromise(function(_0x2b04f0,_0x56da9d){var _0x59798d=_0x441758||client;return _0x59798d[_0xec75('0x22')](_0x2f2d09,_0x26fc00)[_0xec75('0x23')](function(_0x51087e){logger[_0xec75('0x24')](_0xec75('0x25'),_0x190906,_0xec75('0x26'));logger[_0xec75('0x27')](_0xec75('0x28'),_0x190906,'request\x20sent',JSON[_0xec75('0x29')](_0x51087e));if(_0x51087e[_0xec75('0x2a')]){if(_0x51087e['error']['code']===0x1f4){logger[_0xec75('0x2a')]('MailAccount,\x20%s,\x20%s',_0x190906,_0x51087e[_0xec75('0x2a')][_0xec75('0x2b')]);return _0x56da9d(_0x51087e[_0xec75('0x2a')][_0xec75('0x2b')]);}logger[_0xec75('0x2a')](_0xec75('0x25'),_0x190906,_0x51087e['error'][_0xec75('0x2b')]);return _0x2b04f0(_0x51087e[_0xec75('0x2a')][_0xec75('0x2b')]);}else{logger[_0xec75('0x24')](_0xec75('0x25'),_0x190906,_0xec75('0x26'));_0x2b04f0(_0x51087e['result'][_0xec75('0x2b')]);}})[_0xec75('0x2c')](function(_0x2f7343){logger[_0xec75('0x2a')](_0xec75('0x25'),_0x190906,_0x2f7343);_0x56da9d(_0x2f7343);});});}function respondWithStatusCode(_0x19fc93,_0x6ccc9e){_0x6ccc9e=_0x6ccc9e||0xcc;return function(_0x574912){if(_0x574912){return _0x19fc93[_0xec75('0x2d')](_0x6ccc9e);}return _0x19fc93['status'](_0x6ccc9e)[_0xec75('0x2e')]();};}function respondWithResult(_0x2fb40b,_0x2f570c){_0x2f570c=_0x2f570c||0xc8;return function(_0x3d11b4){if(_0x3d11b4){return _0x2fb40b[_0xec75('0x2f')](_0x2f570c)['json'](_0x3d11b4);}};}function respondWithFilteredResult(_0x29e9e3,_0x160a86){return function(_0x52ecfb){if(_0x52ecfb){var _0x4ed9ee=_0x52ecfb[_0xec75('0x30')],_0x2d8581=_0x160a86[_0xec75('0x31')],_0x2bd24d=_0x160a86['offset']+_0x160a86['limit'],_0x32244e;if(_0x2bd24d>=_0x4ed9ee){_0x2bd24d=_0x4ed9ee;_0x32244e=0xc8;}else{_0x32244e=0xce;}_0x29e9e3[_0xec75('0x2f')](_0x32244e);return _0x29e9e3[_0xec75('0x32')]('Content-Range',_0x2d8581+'-'+_0x2bd24d+'/'+_0x4ed9ee)[_0xec75('0x33')](_0x52ecfb);}return null;};}function patchUpdates(_0x2dac77){return function(_0xd210d6){try{jsonpatch['apply'](_0xd210d6,_0x2dac77,!![]);}catch(_0x49a2f5){return BPromise[_0xec75('0x34')](_0x49a2f5);}return _0xd210d6['save']();};}function saveUpdates(_0x463c6e,_0x379941){return function(_0x3d1515){if(_0x3d1515){return _0x3d1515['update'](_0x463c6e)['then'](function(_0x30c088){return _0x30c088;});}return null;};}function removeEntity(_0x19ee70,_0x57a586){return function(_0x145327){if(_0x145327){return _0x145327[_0xec75('0x35')]()['then'](function(){var _0x56963f=_0x145327[_0xec75('0x36')]({'plain':!![]});var _0x3e6f1b='MailAccounts';return db['UserProfileResource'][_0xec75('0x35')]({'where':{'type':_0x3e6f1b,'resourceId':_0x56963f['id']}})['then'](function(){return _0x145327;});})['then'](function(){_0x19ee70[_0xec75('0x2f')](0xcc)[_0xec75('0x2e')]();});}};}function handleEntityNotFound(_0x21e43f,_0x35b024){return function(_0x39a75b){if(!_0x39a75b){_0x21e43f[_0xec75('0x2d')](0x194);}return _0x39a75b;};}function handleError(_0xb8a316,_0x1c9e11){_0x1c9e11=_0x1c9e11||0x1f4;return function(_0x16b0c2){logger[_0xec75('0x2a')](_0x16b0c2[_0xec75('0x37')]);if(_0x16b0c2['name']){delete _0x16b0c2[_0xec75('0x38')];}_0xb8a316[_0xec75('0x2f')](_0x1c9e11)['send'](_0x16b0c2);};}exports['index']=function(_0x727c68,_0x5150df){var _0x16459b={'include':[{'model':db[_0xec75('0x39')],'as':_0xec75('0x3a')},{'model':db[_0xec75('0x3b')],'as':_0xec75('0x3c')},{'model':db['Pause'],'as':_0xec75('0x3d')}]},_0x3ddabd={},_0x19333c={'count':0x0,'rows':[]};var _0xaae20a=_[_0xec75('0x3e')](db[_0xec75('0x3f')][_0xec75('0x40')],function(_0x35e7f3){return{'name':_0x35e7f3['fieldName'],'type':_0x35e7f3[_0xec75('0x41')][_0xec75('0x42')]};});_0x3ddabd['model']=_[_0xec75('0x3e')](_0xaae20a,_0xec75('0x38'));_0x3ddabd[_0xec75('0x43')]=_[_0xec75('0x44')](_0x727c68['query']);_0x3ddabd[_0xec75('0x45')]=_['intersection'](_0x3ddabd[_0xec75('0x46')],_0x3ddabd[_0xec75('0x43')]);_0x16459b['attributes']=_['intersection'](_0x3ddabd['model'],qs[_0xec75('0x47')](_0x727c68[_0xec75('0x43')][_0xec75('0x47')]));_0x16459b[_0xec75('0x48')]=_0x16459b[_0xec75('0x48')][_0xec75('0x49')]?_0x16459b[_0xec75('0x48')]:_0x3ddabd[_0xec75('0x46')];if(!_0x727c68['query']['hasOwnProperty'](_0xec75('0x4a'))){_0x16459b[_0xec75('0x4b')]=qs[_0xec75('0x4b')](_0x727c68[_0xec75('0x43')][_0xec75('0x4b')]);_0x16459b[_0xec75('0x31')]=qs[_0xec75('0x31')](_0x727c68[_0xec75('0x43')][_0xec75('0x31')]);}_0x16459b[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x727c68[_0xec75('0x43')][_0xec75('0x4d')]);_0x16459b[_0xec75('0x4e')]=qs['filters'](_[_0xec75('0x4f')](_0x727c68['query'],_0x3ddabd[_0xec75('0x45')]),_0xaae20a);if(_0x727c68[_0xec75('0x43')][_0xec75('0x50')]){_0x16459b[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x16459b['where'],{'$or':_['map'](_0xaae20a,function(_0x3c5860){if(_0x3c5860['type']!==_0xec75('0x52')){var _0x5b8d31={};_0x5b8d31[_0x3c5860[_0xec75('0x38')]]={'$like':'%'+_0x727c68['query'][_0xec75('0x50')]+'%'};return _0x5b8d31;}})});}_0x16459b=_['merge']({},_0x16459b,_0x727c68[_0xec75('0x53')]);var _0x3f70eb={'where':_0x16459b[_0xec75('0x4e')]};return db['MailAccount'][_0xec75('0x30')](_0x3f70eb)['then'](function(_0x336a72){_0x19333c[_0xec75('0x30')]=_0x336a72;if(_0x727c68[_0xec75('0x43')][_0xec75('0x54')]){_0x16459b[_0xec75('0x55')]=[{'all':!![]}];}return db['MailAccount'][_0xec75('0x56')](_0x16459b);})['then'](function(_0x549c9f){_0x19333c['rows']=_0x549c9f;return _0x19333c;})[_0xec75('0x23')](respondWithFilteredResult(_0x5150df,_0x16459b))['catch'](handleError(_0x5150df,null));};exports[_0xec75('0x57')]=function(_0x508cd0,_0x292b1d){var _0x540d36={'raw':![],'where':{'id':_0x508cd0[_0xec75('0x58')]['id']},'include':[{'model':db[_0xec75('0x39')],'as':'Imap'},{'model':db[_0xec75('0x3b')],'as':'Smtp'},{'model':db[_0xec75('0x59')],'as':'mandatoryDispositionPause'}]},_0x4f9308={};_0x4f9308[_0xec75('0x46')]=_['keys'](db[_0xec75('0x3f')][_0xec75('0x40')]);_0x4f9308['query']=_[_0xec75('0x44')](_0x508cd0[_0xec75('0x43')]);_0x4f9308['filters']=_[_0xec75('0x5a')](_0x4f9308[_0xec75('0x46')],_0x4f9308[_0xec75('0x43')]);_0x540d36[_0xec75('0x48')]=_[_0xec75('0x5a')](_0x4f9308[_0xec75('0x46')],qs['fields'](_0x508cd0[_0xec75('0x43')][_0xec75('0x47')]));_0x540d36['attributes']=_0x540d36[_0xec75('0x48')][_0xec75('0x49')]?_0x540d36[_0xec75('0x48')]:_0x4f9308[_0xec75('0x46')];if(_0x508cd0[_0xec75('0x43')][_0xec75('0x54')]){_0x540d36[_0xec75('0x55')]=[{'all':!![]}];}_0x540d36=_[_0xec75('0x51')]({},_0x540d36,_0x508cd0['options']);return db[_0xec75('0x3f')]['find'](_0x540d36)[_0xec75('0x23')](handleEntityNotFound(_0x292b1d,null))['then'](respondWithResult(_0x292b1d,null))[_0xec75('0x2c')](handleError(_0x292b1d,null));};exports['update']=function(_0x2a2203,_0x291ca6){if(_0x2a2203[_0xec75('0x5b')]['id']){delete _0x2a2203[_0xec75('0x5b')]['id'];}return db[_0xec75('0x3f')][_0xec75('0x5c')]({'where':{'id':_0x2a2203[_0xec75('0x58')]['id']},'include':[{'model':db[_0xec75('0x39')],'as':_0xec75('0x3a')},{'model':db['MailServerOut'],'as':_0xec75('0x3c')},{'model':db[_0xec75('0x59')],'as':_0xec75('0x3d')}]})['then'](handleEntityNotFound(_0x291ca6,null))[_0xec75('0x23')](saveUpdates(_0x2a2203[_0xec75('0x5b')],null))[_0xec75('0x23')](function(_0x4803c4){if(_0x4803c4&&_0x2a2203[_0xec75('0x5b')][_0xec75('0x3a')]){return db[_0xec75('0x39')][_0xec75('0x5d')](_0x2a2203[_0xec75('0x5b')][_0xec75('0x3a')],{'where':{'MailAccountId':_0x4803c4['id']}})[_0xec75('0x23')](function(){return _0x4803c4;});}return _0x4803c4;})[_0xec75('0x23')](function(_0x1346aa){if(_0x1346aa&&_0x2a2203[_0xec75('0x5b')]['Smtp']){return db[_0xec75('0x3b')][_0xec75('0x5d')](_0x2a2203[_0xec75('0x5b')][_0xec75('0x3c')],{'where':{'MailAccountId':_0x1346aa['id']}})[_0xec75('0x23')](function(){return _0x1346aa;});}return _0x1346aa;})[_0xec75('0x23')](respondWithResult(_0x291ca6,null))[_0xec75('0x2c')](handleError(_0x291ca6,null));};exports[_0xec75('0x5e')]=function(_0x523a31,_0x10426c){return db['MailAccount'][_0xec75('0x5e')]()[_0xec75('0x23')](respondWithResult(_0x10426c,null))[_0xec75('0x2c')](handleError(_0x10426c,null));};exports['addDisposition']=function(_0x1a2cec,_0x5513be,_0x11a43d){if(_0x1a2cec['body']['id']){delete _0x1a2cec['body']['id'];}return db[_0xec75('0x3f')]['find']({'where':{'id':_0x1a2cec['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x5513be,null))[_0xec75('0x23')](function(_0x59df83){if(_0x59df83){_0x1a2cec[_0xec75('0x5b')]['MailAccountId']=_0x59df83['id'];return db[_0xec75('0x5f')]['create'](_0x1a2cec[_0xec75('0x5b')]);}})[_0xec75('0x23')](respondWithResult(_0x5513be,null))[_0xec75('0x2c')](handleError(_0x5513be,null));};exports[_0xec75('0x60')]=function(_0x2dd8f1,_0x38c3f0,_0x1a6dc9){var _0x1481be={'raw':![],'where':{}};var _0x5eb88e={};var _0x2ac185={'count':0x0,'rows':[]};return db[_0xec75('0x3f')]['findOne']({'where':{'id':_0x2dd8f1['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x38c3f0,null))['then'](function(_0x5c2238){if(_0x5c2238){_0x5eb88e[_0xec75('0x46')]=_['keys'](db[_0xec75('0x5f')]['rawAttributes']);_0x5eb88e[_0xec75('0x43')]=_[_0xec75('0x44')](_0x2dd8f1[_0xec75('0x43')]);_0x5eb88e['filters']=_['intersection'](_0x5eb88e['model'],_0x5eb88e[_0xec75('0x43')]);_0x1481be[_0xec75('0x48')]=_[_0xec75('0x5a')](_0x5eb88e[_0xec75('0x46')],qs[_0xec75('0x47')](_0x2dd8f1[_0xec75('0x43')][_0xec75('0x47')]));_0x1481be[_0xec75('0x48')]=_0x1481be['attributes'][_0xec75('0x49')]?_0x1481be['attributes']:_0x5eb88e[_0xec75('0x46')];if(!_0x2dd8f1[_0xec75('0x43')][_0xec75('0x61')](_0xec75('0x4a'))){_0x1481be['limit']=qs[_0xec75('0x4b')](_0x2dd8f1[_0xec75('0x43')][_0xec75('0x4b')]);_0x1481be[_0xec75('0x31')]=qs[_0xec75('0x31')](_0x2dd8f1[_0xec75('0x43')][_0xec75('0x31')]);}_0x1481be[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x2dd8f1['query']['sort']);_0x1481be[_0xec75('0x4e')]=qs['filters'](_['pick'](_0x2dd8f1[_0xec75('0x43')],_0x5eb88e[_0xec75('0x45')]));_0x1481be['where']['MailAccountId']=_0x5c2238['id'];if(_0x2dd8f1[_0xec75('0x43')][_0xec75('0x50')]){_0x1481be[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x1481be[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0x1481be['attributes'],function(_0x29b1ef){var _0x2781e3={};_0x2781e3[_0x29b1ef]={'$like':'%'+_0x2dd8f1[_0xec75('0x43')][_0xec75('0x50')]+'%'};return _0x2781e3;})});}_0x1481be=_[_0xec75('0x51')]({},_0x1481be,_0x2dd8f1[_0xec75('0x53')]);return db['Disposition'][_0xec75('0x30')]({'where':_0x1481be[_0xec75('0x4e')]})[_0xec75('0x23')](function(_0x22d7ab){_0x2ac185[_0xec75('0x30')]=_0x22d7ab;if(_0x2dd8f1[_0xec75('0x43')]['includeAll']){_0x1481be[_0xec75('0x55')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1481be);})[_0xec75('0x23')](function(_0x3e32ab){_0x2ac185[_0xec75('0x62')]=_0x3e32ab;return _0x2ac185;});}})[_0xec75('0x23')](respondWithFilteredResult(_0x38c3f0,_0x1481be))[_0xec75('0x2c')](handleError(_0x38c3f0,null));};exports[_0xec75('0x63')]=function(_0xb77049,_0x105b2c,_0x49e81d){return db[_0xec75('0x3f')][_0xec75('0x5c')]({'where':{'id':_0xb77049['params']['id']}})['then'](handleEntityNotFound(_0x105b2c,null))[_0xec75('0x23')](function(_0x3b4a0a){if(_0x3b4a0a){return _0x3b4a0a[_0xec75('0x63')](_0xb77049[_0xec75('0x43')][_0xec75('0x64')]);}})['then'](respondWithStatusCode(_0x105b2c,null))['catch'](handleError(_0x105b2c,null));};exports[_0xec75('0x65')]=function(_0x5874e5,_0xcf3bbb,_0x3388b6){if(_0x5874e5[_0xec75('0x5b')]['id']){delete _0x5874e5[_0xec75('0x5b')]['id'];}return db[_0xec75('0x3f')]['find']({'where':{'id':_0x5874e5['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0xcf3bbb,null))[_0xec75('0x23')](function(_0x4a6f35){if(_0x4a6f35){_0x5874e5['body'][_0xec75('0x66')]=_0x4a6f35['id'];return db[_0xec75('0x67')][_0xec75('0x68')](_0x5874e5[_0xec75('0x5b')]);}})['then'](respondWithResult(_0xcf3bbb,null))[_0xec75('0x2c')](handleError(_0xcf3bbb,null));};exports[_0xec75('0x69')]=function(_0x1f63a7,_0x4139f7,_0x48c8d6){var _0xe50a11={'raw':![],'where':{}};var _0xc26ddd={};var _0x1ded80={'count':0x0,'rows':[]};return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x1f63a7[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x4139f7,null))[_0xec75('0x23')](function(_0xf2e0ec){if(_0xf2e0ec){_0xc26ddd[_0xec75('0x46')]=_[_0xec75('0x44')](db['CannedAnswer']['rawAttributes']);_0xc26ddd['query']=_[_0xec75('0x44')](_0x1f63a7[_0xec75('0x43')]);_0xc26ddd['filters']=_[_0xec75('0x5a')](_0xc26ddd[_0xec75('0x46')],_0xc26ddd[_0xec75('0x43')]);_0xe50a11['attributes']=_['intersection'](_0xc26ddd[_0xec75('0x46')],qs['fields'](_0x1f63a7[_0xec75('0x43')][_0xec75('0x47')]));_0xe50a11['attributes']=_0xe50a11[_0xec75('0x48')]['length']?_0xe50a11[_0xec75('0x48')]:_0xc26ddd[_0xec75('0x46')];if(!_0x1f63a7['query'][_0xec75('0x61')](_0xec75('0x4a'))){_0xe50a11[_0xec75('0x4b')]=qs[_0xec75('0x4b')](_0x1f63a7['query'][_0xec75('0x4b')]);_0xe50a11[_0xec75('0x31')]=qs['offset'](_0x1f63a7['query'][_0xec75('0x31')]);}_0xe50a11['order']=qs['sort'](_0x1f63a7[_0xec75('0x43')][_0xec75('0x4d')]);_0xe50a11[_0xec75('0x4e')]=qs[_0xec75('0x45')](_[_0xec75('0x4f')](_0x1f63a7[_0xec75('0x43')],_0xc26ddd[_0xec75('0x45')]));_0xe50a11['where']['MailAccountId']=_0xf2e0ec['id'];if(_0x1f63a7[_0xec75('0x43')][_0xec75('0x50')]){_0xe50a11[_0xec75('0x4e')]=_[_0xec75('0x51')](_0xe50a11[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0xe50a11[_0xec75('0x48')],function(_0x3fa1d2){var _0x469029={};_0x469029[_0x3fa1d2]={'$like':'%'+_0x1f63a7[_0xec75('0x43')][_0xec75('0x50')]+'%'};return _0x469029;})});}_0xe50a11=_['merge']({},_0xe50a11,_0x1f63a7['options']);return db[_0xec75('0x67')][_0xec75('0x30')]({'where':_0xe50a11[_0xec75('0x4e')]})[_0xec75('0x23')](function(_0x4026aa){_0x1ded80[_0xec75('0x30')]=_0x4026aa;if(_0x1f63a7[_0xec75('0x43')]['includeAll']){_0xe50a11['include']=[{'all':!![]}];}return db[_0xec75('0x67')]['findAll'](_0xe50a11);})['then'](function(_0x55e6aa){_0x1ded80['rows']=_0x55e6aa;return _0x1ded80;});}})[_0xec75('0x23')](respondWithFilteredResult(_0x4139f7,_0xe50a11))[_0xec75('0x2c')](handleError(_0x4139f7,null));};exports[_0xec75('0x6b')]=function(_0x381849,_0x21acf3,_0x5a4b37){return db[_0xec75('0x3f')]['find']({'where':{'id':_0x381849['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x21acf3,null))[_0xec75('0x23')](function(_0x45214f){if(_0x45214f){return _0x45214f[_0xec75('0x6b')](_0x381849[_0xec75('0x43')][_0xec75('0x64')]);}})[_0xec75('0x23')](respondWithStatusCode(_0x21acf3,null))[_0xec75('0x2c')](handleError(_0x21acf3,null));};exports[_0xec75('0x68')]=function(_0x109b4f,_0xdf3575){var _0x3e856a={'name':_0x109b4f[_0xec75('0x5b')][_0xec75('0x38')],'key':_0x109b4f['body'][_0xec75('0x42')],'email':_0x109b4f[_0xec75('0x5b')]['email'],'ListId':_0x109b4f['body'][_0xec75('0x6c')],'active':!_[_0xec75('0x6d')](_0x109b4f[_0xec75('0x5b')][_0xec75('0x6e')])?_0x109b4f[_0xec75('0x5b')][_0xec75('0x6e')]:!![],'description':_0x109b4f['body'][_0xec75('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0xec75('0x6d')](_0x109b4f[_0xec75('0x5b')]['cservice'])){if(_0x109b4f['body'][_0xec75('0x70')]){_0x3e856a['Imap'][_0xec75('0x71')]=_0x3e856a['Smtp'][_0xec75('0x71')]=_0x109b4f[_0xec75('0x5b')][_0xec75('0x72')];_0x3e856a[_0xec75('0x3a')][_0xec75('0x73')]=_0x3e856a[_0xec75('0x3c')][_0xec75('0x74')]=_0x109b4f['body'][_0xec75('0x75')];}else{_0x3e856a[_0xec75('0x3a')][_0xec75('0x76')]=_0x3e856a[_0xec75('0x3c')][_0xec75('0x76')]=![];}_0x3e856a[_0xec75('0x3a')]['host']=_0x109b4f[_0xec75('0x5b')]['Imap']['host'];_0x3e856a[_0xec75('0x3a')][_0xec75('0x77')]=_0x109b4f[_0xec75('0x5b')][_0xec75('0x3a')][_0xec75('0x77')];_0x3e856a[_0xec75('0x3c')][_0xec75('0x78')]=_0x109b4f[_0xec75('0x5b')][_0xec75('0x3c')][_0xec75('0x78')];_0x3e856a[_0xec75('0x3c')][_0xec75('0x77')]=_0x109b4f['body'][_0xec75('0x3c')][_0xec75('0x77')];}else{_0x3e856a[_0xec75('0x3a')][_0xec75('0x79')]=_0x3e856a['Smtp'][_0xec75('0x79')]=_0x109b4f[_0xec75('0x5b')]['cservice'];_0x3e856a['Imap'][_0xec75('0x71')]=_0x3e856a[_0xec75('0x3c')][_0xec75('0x71')]=_0x109b4f[_0xec75('0x5b')][_0xec75('0x72')];_0x3e856a['Imap'][_0xec75('0x73')]=_0x3e856a[_0xec75('0x3c')][_0xec75('0x74')]=_0x109b4f['body'][_0xec75('0x75')];}return db['MailAccount'][_0xec75('0x68')](_0x3e856a,{'include':[{'model':db['MailServerOut'],'as':_0xec75('0x3c')},{'model':db[_0xec75('0x39')],'as':_0xec75('0x3a')}]})[_0xec75('0x23')](function(_0xa5078d){var _0x58afe0=_0x109b4f['user'][_0xec75('0x36')]({'plain':!![]});if(!_0x58afe0)throw new Error(_0xec75('0x7a'));if(_0x58afe0['role']===_0xec75('0x71')){var _0x2e5877=_0xa5078d['get']({'plain':!![]});return db[_0xec75('0x7b')][_0xec75('0x5c')]({'where':{'name':_0xec75('0x7c'),'userProfileId':_0x58afe0[_0xec75('0x7d')]},'raw':!![]})[_0xec75('0x23')](function(_0x97d7de){if(_0x97d7de&&_0x97d7de[_0xec75('0x7e')]===0x0){return db[_0xec75('0x7f')][_0xec75('0x68')]({'name':_0x2e5877['name'],'resourceId':_0x2e5877['id'],'type':_0x97d7de[_0xec75('0x38')],'sectionId':_0x97d7de['id']},{})[_0xec75('0x23')](function(){return _0xa5078d;});}else{return _0xa5078d;}})[_0xec75('0x2c')](function(_0x213a08){logger['error'](_0xec75('0x80'),_0x213a08);throw _0x213a08;});}return _0xa5078d;})[_0xec75('0x23')](respondWithResult(_0xdf3575,0xc9))[_0xec75('0x2c')](handleError(_0xdf3575,null));};exports[_0xec75('0x81')]=function(_0x364592,_0x336832,_0x4a5105){return db[_0xec75('0x3f')]['findOne']({'where':{'id':_0x364592[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x336832,null))['then'](function(_0x33849e){if(_0x33849e){return _0x33849e['getImap']();}return null;})[_0xec75('0x23')](respondWithResult(_0x336832,null))[_0xec75('0x2c')](handleError(_0x336832,null));};exports[_0xec75('0x82')]=function(_0x300860,_0x5da765,_0x22e90a){if(_0x300860[_0xec75('0x5b')]['id']){delete _0x300860[_0xec75('0x5b')]['id'];}return db['MailAccount'][_0xec75('0x5c')]({'where':{'id':_0x300860[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x5da765,null))[_0xec75('0x23')](function(_0x2acbbe){if(_0x2acbbe){_0x300860[_0xec75('0x5b')][_0xec75('0x66')]=_0x2acbbe['id'];return db[_0xec75('0x39')][_0xec75('0x68')](_0x300860[_0xec75('0x5b')]);}})[_0xec75('0x23')](respondWithResult(_0x5da765,null))['catch'](handleError(_0x5da765,null));};exports[_0xec75('0x83')]=function(_0x15556b,_0x2bdf5c,_0x3be850){return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x15556b[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x2bdf5c,null))[_0xec75('0x23')](function(_0x3a041b){if(_0x3a041b){return _0x3a041b[_0xec75('0x84')](null);}return null;})[_0xec75('0x23')](respondWithStatusCode(_0x2bdf5c,null))[_0xec75('0x2c')](handleError(_0x2bdf5c,null));};exports['getSmtp']=function(_0x19cb4f,_0x41bcb7,_0x4e151c){return db['MailAccount'][_0xec75('0x6a')]({'where':{'id':_0x19cb4f[_0xec75('0x58')]['id']}})['then'](handleEntityNotFound(_0x41bcb7,null))[_0xec75('0x23')](function(_0x1b7d3e){if(_0x1b7d3e){return _0x1b7d3e[_0xec75('0x85')]();}return null;})[_0xec75('0x23')](respondWithResult(_0x41bcb7,null))['catch'](handleError(_0x41bcb7,null));};exports['addSmtp']=function(_0xf3ec1d,_0x2baca8,_0x2faf8e){if(_0xf3ec1d[_0xec75('0x5b')]['id']){delete _0xf3ec1d[_0xec75('0x5b')]['id'];}return db['MailAccount'][_0xec75('0x5c')]({'where':{'id':_0xf3ec1d[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x2baca8,null))[_0xec75('0x23')](function(_0x270070){if(_0x270070){_0xf3ec1d[_0xec75('0x5b')][_0xec75('0x66')]=_0x270070['id'];return db[_0xec75('0x3b')][_0xec75('0x68')](_0xf3ec1d[_0xec75('0x5b')]);}})[_0xec75('0x23')](respondWithResult(_0x2baca8,null))[_0xec75('0x2c')](handleError(_0x2baca8,null));};exports[_0xec75('0x86')]=function(_0x24f4ab,_0x7945,_0x1b89b1){return db['MailAccount'][_0xec75('0x6a')]({'where':{'id':_0x24f4ab[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x7945,null))[_0xec75('0x23')](function(_0x4c5245){if(_0x4c5245){return _0x4c5245['setSmtp'](null);}return null;})[_0xec75('0x23')](respondWithStatusCode(_0x7945,null))[_0xec75('0x2c')](handleError(_0x7945,null));};exports[_0xec75('0x87')]=function(_0x168f6d,_0x4f05ec,_0x26ba5c){return db[_0xec75('0x88')][_0xec75('0x5c')]({'where':{'id':_0x168f6d[_0xec75('0x58')]['id']}})['then'](handleEntityNotFound(_0x4f05ec,null))[_0xec75('0x23')](function(_0x4c84a8){if(_0x4c84a8){return _0x4c84a8[_0xec75('0x87')](_0x168f6d[_0xec75('0x5b')][_0xec75('0x64')],_['omit'](_0x168f6d['body'],[_0xec75('0x64'),'id'])||{});}})[_0xec75('0x23')](respondWithResult(_0x4f05ec,null))['catch'](handleError(_0x4f05ec,null));};exports[_0xec75('0x89')]=function(_0x4e5191,_0x1f82a2,_0xb4cc5b){var _0x61ed9b={'raw':![],'where':{}};var _0x45a321={};var _0x969efe={'count':0x0,'rows':[]};return db[_0xec75('0x3f')]['findOne']({'where':{'id':_0x4e5191['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x1f82a2,null))['then'](function(_0x2224d3){if(_0x2224d3){_0x45a321[_0xec75('0x46')]=_[_0xec75('0x44')](db[_0xec75('0x88')][_0xec75('0x40')]);_0x45a321['query']=_[_0xec75('0x44')](_0x4e5191[_0xec75('0x43')]);_0x45a321[_0xec75('0x45')]=_[_0xec75('0x5a')](_0x45a321[_0xec75('0x46')],_0x45a321[_0xec75('0x43')]);_0x61ed9b['attributes']=_[_0xec75('0x5a')](_0x45a321['model'],qs[_0xec75('0x47')](_0x4e5191[_0xec75('0x43')][_0xec75('0x47')]));_0x61ed9b[_0xec75('0x48')]=_0x61ed9b[_0xec75('0x48')]['length']?_0x61ed9b[_0xec75('0x48')]:_0x45a321[_0xec75('0x46')];if(!_0x4e5191[_0xec75('0x43')][_0xec75('0x61')](_0xec75('0x4a'))){_0x61ed9b[_0xec75('0x4b')]=qs['limit'](_0x4e5191[_0xec75('0x43')]['limit']);_0x61ed9b['offset']=qs[_0xec75('0x31')](_0x4e5191[_0xec75('0x43')]['offset']);}_0x61ed9b[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x4e5191[_0xec75('0x43')]['sort']);_0x61ed9b[_0xec75('0x4e')]=qs[_0xec75('0x45')](_[_0xec75('0x4f')](_0x4e5191[_0xec75('0x43')],_0x45a321['filters']));_0x61ed9b[_0xec75('0x4e')]['MailAccountId']=_0x2224d3['id'];if(_0x4e5191[_0xec75('0x43')][_0xec75('0x50')]){_0x61ed9b[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x61ed9b[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0x61ed9b['attributes'],function(_0x46f320){var _0x25d149={};_0x25d149[_0x46f320]={'$like':'%'+_0x4e5191[_0xec75('0x43')]['filter']+'%'};return _0x25d149;})});}_0x61ed9b=_[_0xec75('0x51')]({},_0x61ed9b,_0x4e5191[_0xec75('0x53')]);return db[_0xec75('0x88')][_0xec75('0x30')]({'where':_0x61ed9b[_0xec75('0x4e')]})[_0xec75('0x23')](function(_0x34b92d){_0x969efe[_0xec75('0x30')]=_0x34b92d;if(_0x4e5191['query'][_0xec75('0x54')]){_0x61ed9b[_0xec75('0x55')]=[{'model':db[_0xec75('0x8a')],'as':_0xec75('0x8b'),'required':![]},{'model':db[_0xec75('0x8c')],'as':'Owner','attributes':[_0xec75('0x38'),_0xec75('0x8d'),_0xec75('0x8e')],'required':![]},{'model':db[_0xec75('0x8f')],'as':_0xec75('0x90'),'attributes':['id',_0xec75('0x38'),_0xec75('0x91')],'where':_0x4e5191[_0xec75('0x43')][_0xec75('0x92')]?{'id':_0x4e5191[_0xec75('0x43')][_0xec75('0x92')]}:undefined,'required':_0x4e5191[_0xec75('0x43')]['tag']?!![]:![]}];}return db[_0xec75('0x88')]['findAll'](_0x61ed9b);})[_0xec75('0x23')](function(_0x29479d){_0x969efe[_0xec75('0x62')]=_0x29479d;return _0x969efe;});}})[_0xec75('0x23')](respondWithFilteredResult(_0x1f82a2,_0x61ed9b))['catch'](handleError(_0x1f82a2,null));};exports[_0xec75('0x93')]=function(_0x327274,_0x4b1325,_0x5dcc8d){return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x327274[_0xec75('0x58')]['id']}})['then'](handleEntityNotFound(_0x4b1325,null))[_0xec75('0x23')](function(_0x57fa87){if(_0x57fa87){return db[_0xec75('0x94')][_0xec75('0x95')](function(_0x2b7e39){return db['MailApplication'][_0xec75('0x35')]({'where':{'MailAccountId':_0x327274[_0xec75('0x58')]['id']},'transaction':_0x2b7e39})[_0xec75('0x23')](function(_0x3c8e37){var _0x32b8a8=_[_0xec75('0x3e')](_0x327274[_0xec75('0x5b')],function(_0x22c472){_0x22c472[_0xec75('0x66')]=_0x327274[_0xec75('0x58')]['id'];return _0x22c472;});return db[_0xec75('0x96')][_0xec75('0x97')](_0x32b8a8,{'transaction':_0x2b7e39});});})['then'](function(){return db[_0xec75('0x96')]['findAndCountAll']({'where':{'MailAccountId':_0x327274[_0xec75('0x58')]['id']},'order':_0xec75('0x98')});});}})['then'](respondWithResult(_0x4b1325,null))[_0xec75('0x2c')](handleError(_0x4b1325,null));};exports[_0xec75('0x99')]=function(_0x26962f,_0x362439,_0x1b352c){var _0x16df8f={};var _0x200939={};var _0x81a9d5;var _0x3e8d33;return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x26962f[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x362439,null))['then'](function(_0x46dbcf){if(_0x46dbcf){_0x81a9d5=_0x46dbcf;_0x200939['model']=_[_0xec75('0x44')](db[_0xec75('0x96')][_0xec75('0x40')]);_0x200939[_0xec75('0x43')]=_[_0xec75('0x44')](_0x26962f['query']);_0x200939['filters']=_[_0xec75('0x5a')](_0x200939[_0xec75('0x46')],_0x200939[_0xec75('0x43')]);_0x16df8f[_0xec75('0x48')]=_['intersection'](_0x200939[_0xec75('0x46')],qs[_0xec75('0x47')](_0x26962f[_0xec75('0x43')][_0xec75('0x47')]));_0x16df8f[_0xec75('0x48')]=_0x16df8f['attributes']['length']?_0x16df8f[_0xec75('0x48')]:_0x200939[_0xec75('0x46')];_0x16df8f[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x26962f[_0xec75('0x43')]['sort']);_0x16df8f['where']=qs[_0xec75('0x45')](_['pick'](_0x26962f[_0xec75('0x43')],_0x200939[_0xec75('0x45')]));if(_0x26962f[_0xec75('0x43')]['filter']){_0x16df8f[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x16df8f['where'],{'$or':_['map'](_0x16df8f[_0xec75('0x48')],function(_0x253ef2){var _0x21fea2={};_0x21fea2[_0x253ef2]={'$like':'%'+_0x26962f[_0xec75('0x43')]['filter']+'%'};return _0x21fea2;})});}_0x16df8f=_['merge']({},_0x16df8f,_0x26962f[_0xec75('0x53')]);return _0x81a9d5['getApplications'](_0x16df8f);}})[_0xec75('0x23')](function(_0x3f9fc9){if(_0x3f9fc9){_0x3e8d33=_0x3f9fc9['length'];if(!_0x26962f[_0xec75('0x43')][_0xec75('0x61')](_0xec75('0x4a'))){_0x16df8f[_0xec75('0x4b')]=qs[_0xec75('0x4b')](_0x26962f[_0xec75('0x43')][_0xec75('0x4b')]);_0x16df8f[_0xec75('0x31')]=qs['offset'](_0x26962f['query'][_0xec75('0x31')]);}return _0x81a9d5[_0xec75('0x99')](_0x16df8f);}})[_0xec75('0x23')](function(_0x969538){if(_0x969538){return _0x969538?{'count':_0x3e8d33,'rows':_0x969538}:null;}})['then'](respondWithResult(_0x362439,null))[_0xec75('0x2c')](handleError(_0x362439,null));};exports[_0xec75('0x9a')]=function(_0x2d99d0,_0x197d76,_0x48c09b){var _0x10d962={'raw':!![],'where':{}};var _0x1af1d6={};var _0x3e86c3={'count':0x0,'rows':[]};return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x2d99d0[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x197d76,null))[_0xec75('0x23')](function(_0x4ff7a2){if(_0x4ff7a2){_0x1af1d6[_0xec75('0x46')]=_[_0xec75('0x44')](db[_0xec75('0x9b')][_0xec75('0x40')]);_0x1af1d6[_0xec75('0x43')]=_[_0xec75('0x44')](_0x2d99d0[_0xec75('0x43')]);_0x1af1d6[_0xec75('0x45')]=_[_0xec75('0x5a')](_0x1af1d6[_0xec75('0x46')],_0x1af1d6['query']);_0x10d962[_0xec75('0x48')]=_['intersection'](_0x1af1d6[_0xec75('0x46')],qs['fields'](_0x2d99d0['query'][_0xec75('0x47')]));_0x10d962[_0xec75('0x48')]=_0x10d962['attributes'][_0xec75('0x49')]?_0x10d962['attributes']:_0x1af1d6[_0xec75('0x46')];if(!_0x2d99d0[_0xec75('0x43')][_0xec75('0x61')](_0xec75('0x4a'))){_0x10d962['limit']=qs[_0xec75('0x4b')](_0x2d99d0[_0xec75('0x43')]['limit']);_0x10d962['offset']=qs[_0xec75('0x31')](_0x2d99d0[_0xec75('0x43')][_0xec75('0x31')]);}_0x10d962[_0xec75('0x4c')]=qs['sort'](_0x2d99d0[_0xec75('0x43')][_0xec75('0x4d')]);_0x10d962['where']=qs[_0xec75('0x45')](_[_0xec75('0x4f')](_0x2d99d0[_0xec75('0x43')],_0x1af1d6[_0xec75('0x45')]));_0x10d962['where'][_0xec75('0x66')]=_0x4ff7a2['id'];if(_0x2d99d0[_0xec75('0x43')][_0xec75('0x50')]){_0x10d962[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x10d962[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0x10d962[_0xec75('0x48')],function(_0x439d37){var _0x4d6ead={};_0x4d6ead[_0x439d37]={'$like':'%'+_0x2d99d0[_0xec75('0x43')][_0xec75('0x50')]+'%'};return _0x4d6ead;})});}if(_0x2d99d0['query'][_0xec75('0x9c')]){var _0x513571=_0x2d99d0[_0xec75('0x43')]['$gte'][_0xec75('0x9d')](',');var _0x229f4b={};_0x229f4b[_0x513571[0x0]]={'$gte':moment(_0x513571[0x1])[_0xec75('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x10d962[_0xec75('0x4e')]=_['merge'](_0x10d962[_0xec75('0x4e')],_0x229f4b);}_0x10d962=_['merge']({},_0x10d962,_0x2d99d0[_0xec75('0x53')]);return db['MailMessage'][_0xec75('0x30')]({'where':_0x10d962[_0xec75('0x4e')]})['then'](function(_0x5e6ceb){_0x3e86c3[_0xec75('0x30')]=_0x5e6ceb;if(_0x2d99d0[_0xec75('0x43')][_0xec75('0x54')]){_0x10d962[_0xec75('0x55')]=[{'all':!![]}];}return db[_0xec75('0x9b')][_0xec75('0x56')](_0x10d962);})[_0xec75('0x23')](function(_0x3d6782){_0x3e86c3[_0xec75('0x62')]=_0x3d6782;return _0x3e86c3;});}})[_0xec75('0x23')](respondWithFilteredResult(_0x197d76,_0x10d962))[_0xec75('0x2c')](handleError(_0x197d76,null));};exports[_0xec75('0x9f')]=function(_0x791fac,_0x19ddef,_0xa67cd5){var _0x3a4b86,_0x5aad42={},_0x5191c6;if(_0x791fac[_0xec75('0x5b')]['to']){_0x5191c6=_0x791fac[_0xec75('0x5b')]['to'][_0xec75('0x9d')](',')[0x0];}return db[_0xec75('0x3f')]['find']({'where':{'id':_0x791fac['params']['id']},'include':[{'model':db[_0xec75('0xa0')],'as':_0xec75('0xa1'),'include':[{'model':db['CmContact'],'as':_0xec75('0xa2'),'where':{'email':_0x5191c6},'limit':0x1,'order':[[_0xec75('0xa3'),_0xec75('0xa4')]]}]},{'model':db[_0xec75('0x3b')],'as':_0xec75('0x3c'),'raw':!![]}]})[_0xec75('0x23')](handleEntityNotFound(_0x19ddef,null))['then'](function(_0x5e4a39){if(_0x5e4a39){_0x3a4b86=_0x5e4a39;if(_0x5e4a39[_0xec75('0x3c')]){if(_['isNil'](_0x791fac[_0xec75('0x5b')][_0xec75('0xa5')])){_0x791fac[_0xec75('0x5b')][_0xec75('0xa5')]=util[_0xec75('0x9e')](_0xec75('0xa6'),_0x5e4a39[_0xec75('0x38')],_0x5e4a39[_0xec75('0xa7')]||_0x5e4a39[_0xec75('0x3c')][_0xec75('0x71')]);}if(_0x791fac[_0xec75('0x5b')]['attachments']&&_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')][_0xec75('0x49')]){for(var _0x26bb22=0x0;_0x26bb22<_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')]['length'];_0x26bb22+=0x1){_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')][_0x26bb22]={'filename':_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')][_0x26bb22][_0xec75('0x38')],'path':path[_0xec75('0xa9')](config['root'],_0xec75('0xaa'),_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')][_0x26bb22]['basename'])};}}var _0x1977cb={'tls':{'rejectUnauthorized':![]}};if(_[_0xec75('0x6d')](_0x5e4a39[_0xec75('0x3c')][_0xec75('0x79')])){if(_0x5e4a39[_0xec75('0x3c')][_0xec75('0x76')]){_0x1977cb['auth']={'user':_0x5e4a39[_0xec75('0x3c')][_0xec75('0x71')],'pass':_0x5e4a39[_0xec75('0x3c')][_0xec75('0x74')]};}_0x1977cb[_0xec75('0x78')]=_0x5e4a39[_0xec75('0x3c')][_0xec75('0x78')];_0x1977cb[_0xec75('0x77')]=_0x5e4a39[_0xec75('0x3c')]['port'];_0x1977cb['secure']=_0x5e4a39[_0xec75('0x3c')][_0xec75('0xab')];}else{_0x1977cb[_0xec75('0x79')]=_0x5e4a39[_0xec75('0x3c')][_0xec75('0x79')];_0x1977cb[_0xec75('0xac')]={'user':_0x5e4a39[_0xec75('0x3c')][_0xec75('0x71')],'pass':_0x5e4a39['Smtp'][_0xec75('0x74')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x1977cb,'message':_0x791fac[_0xec75('0x5b')]});}else{throw new Error(_0xec75('0xad'));}}})[_0xec75('0x23')](function(_0xb493c9){if(_0xb493c9){_0x5aad42=_0xb493c9;if(_0x3a4b86[_0xec75('0xa1')]){if(_0x3a4b86[_0xec75('0xa1')][_0xec75('0xa2')][_0xec75('0x49')]){return _0x3a4b86[_0xec75('0xa1')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xec75('0xae')](_0x791fac[_0xec75('0x5b')],{'firstName':_0x791fac[_0xec75('0x5b')]['to'],'email':_0x791fac[_0xec75('0x5b')]['to'],'phone':_0x791fac[_0xec75('0x5b')]['to'],'ListId':_0x3a4b86[_0xec75('0x6c')]}));}}else{throw new Error(_0xec75('0xad'));}}})[_0xec75('0x23')](function(_0x23c0a8){if(_0x23c0a8){var _0x14f26c={'UserId':_0x791fac['user']['id'],'ContactId':_0x23c0a8['id'],'MailAccountId':_0x3a4b86['id'],'inReplyTo':_0x5aad42[_0xec75('0xaf')],'to':_0x791fac['body'][_0xec75('0xa5')],'cc':_0x791fac[_0xec75('0x5b')]['cc'],'subject':_0x791fac[_0xec75('0x5b')]['subject'],'attach':_0x791fac[_0xec75('0x5b')][_0xec75('0xb0')],'firstMsgDirection':_0xec75('0xb1'),'lastMsgAt':moment()[_0xec75('0x9e')](_0xec75('0xb2')),'lastMsgDirection':_0xec75('0xb1'),'lastMsgBody':_0x791fac[_0xec75('0x5b')]['body'],'Messages':[_[_0xec75('0x51')](_0x791fac[_0xec75('0x5b')],{'messageId':_0x5aad42['messageId'],'sentAt':moment()[_0xec75('0x9e')](_0xec75('0xb2')),'read':!![],'MailAccountId':_0x3a4b86['id'],'UserId':_0x791fac[_0xec75('0x71')]['id'],'ContactId':_0x23c0a8['id']})]};if(_0x791fac['body'][_0xec75('0xb3')]){_0x14f26c=_[_0xec75('0x51')](_0x14f26c,_0x791fac[_0xec75('0x5b')]['Interaction']);}return db[_0xec75('0x88')]['create'](_0x14f26c,{'include':[{'model':db[_0xec75('0x9b')],'as':_0xec75('0xb4')}]});}})[_0xec75('0x23')](respondWithResult(_0x19ddef,null))[_0xec75('0x2c')](handleError(_0x19ddef,null));};exports[_0xec75('0xb5')]=function(_0x5e4ce5,_0x574e92,_0x5e3bbb){return db['MailAccount'][_0xec75('0x5c')]({'where':{'id':_0x5e4ce5[_0xec75('0x58')]['id']},'include':[{'model':db[_0xec75('0x3b')],'as':_0xec75('0x3c'),'raw':!![]}]})[_0xec75('0x23')](handleEntityNotFound(_0x574e92,null))['then'](function(_0x4a8766){if(_0x4a8766&&_0x4a8766['Smtp']){var _0xd5325c={'id':_0x4a8766['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a8766[_0xec75('0x3c')][_0xec75('0x79')]){_0xd5325c[_0xec75('0x79')]=_0x4a8766[_0xec75('0x3c')][_0xec75('0x79')];}else{_0xd5325c[_0xec75('0x78')]=_0x4a8766[_0xec75('0x3c')][_0xec75('0x78')];_0xd5325c[_0xec75('0x77')]=_0x4a8766['Smtp'][_0xec75('0x77')];_0xd5325c[_0xec75('0xab')]=_0x4a8766[_0xec75('0x3c')]['secure'];}if(_0x4a8766['Smtp'][_0xec75('0x76')]){_0xd5325c[_0xec75('0xac')]={'user':_0x4a8766[_0xec75('0x3c')]['user'],'pass':_0x4a8766['Smtp'][_0xec75('0x74')]};}return respondWithRpcPromise(_0xec75('0xb6'),'verifySmtp',{'account':_0xd5325c});}})[_0xec75('0x23')](respondWithResult(_0x574e92,null))[_0xec75('0x2c')](handleError(_0x574e92,null));};exports[_0xec75('0x35')]=function(_0x288d23,_0x150715){return db[_0xec75('0x3f')][_0xec75('0x5c')]({'where':{'id':_0x288d23[_0xec75('0x58')]['id']}})['then'](handleEntityNotFound(_0x150715,null))[_0xec75('0x23')](function(_0x4de37d){if(_0x4de37d&&_0x4de37d[_0xec75('0x79')]){throw new db['Sequelize']['ValidationError'](_0xec75('0xb7'));}return _0x4de37d;})[_0xec75('0x23')](removeEntity(_0x150715,null))[_0xec75('0x2c')](handleError(_0x150715,null));};exports[_0xec75('0xb8')]=function(_0x284718,_0x395fb8,_0x59a077){return db['MailAccount'][_0xec75('0x5c')]({'where':{'id':_0x284718[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x395fb8,null))[_0xec75('0x23')](function(_0x214b14){if(_0x214b14){return _0x214b14[_0xec75('0xb8')](_0x284718[_0xec75('0x5b')]['ids'],_[_0xec75('0xb9')](_0x284718[_0xec75('0x5b')],['ids','id'])||{})[_0xec75('0xba')](function(_0x2f1b7d){for(var _0x2bc440=0x0;_0x2bc440<_0x284718[_0xec75('0x5b')]['ids'][_0xec75('0x49')];_0x2bc440+=0x1){socket[_0xec75('0xbb')](_0xec75('0xbc'),{'UserId':_0x284718[_0xec75('0x5b')][_0xec75('0x64')][_0x2bc440],'MailAccountId':_0x284718[_0xec75('0x58')]['id']});}return _0x2f1b7d;});}})[_0xec75('0x23')](respondWithResult(_0x395fb8,null))['catch'](handleError(_0x395fb8,null));};exports[_0xec75('0xbd')]=function(_0x13ded9,_0x337f10,_0x3ec0a2){return db[_0xec75('0x3f')][_0xec75('0x5c')]({'where':{'id':_0x13ded9[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x337f10,null))[_0xec75('0x23')](function(_0x3cecb3){if(_0x3cecb3){return _0x3cecb3['removeAgents'](_0x13ded9[_0xec75('0x43')][_0xec75('0x64')])[_0xec75('0x23')](function(){if(_[_0xec75('0xbe')](_0x13ded9['query'][_0xec75('0x64')])){for(var _0x564322=0x0;_0x564322<_0x13ded9[_0xec75('0x43')][_0xec75('0x64')][_0xec75('0x49')];_0x564322+=0x1){socket[_0xec75('0xbb')](_0xec75('0xbf'),{'UserId':Number(_0x13ded9['query'][_0xec75('0x64')][_0x564322]),'MailAccountId':Number(_0x13ded9[_0xec75('0x58')]['id'])});}}else{socket['emit'](_0xec75('0xbf'),{'UserId':Number(_0x13ded9[_0xec75('0x43')][_0xec75('0x64')]),'MailAccountId':Number(_0x13ded9[_0xec75('0x58')]['id'])});}});}})[_0xec75('0x23')](respondWithStatusCode(_0x337f10,null))['catch'](handleError(_0x337f10,null));};exports['getAgents']=function(_0x4af05c,_0x5aaeb0,_0x1907d3){var _0x5c6cb5={};var _0x48f916={};var _0x434845;var _0x38ed81;return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x4af05c['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x5aaeb0,null))[_0xec75('0x23')](function(_0x1af64c){if(_0x1af64c){_0x434845=_0x1af64c;_0x48f916[_0xec75('0x46')]=_['keys'](db[_0xec75('0x8c')]['rawAttributes']);_0x48f916[_0xec75('0x43')]=_[_0xec75('0x44')](_0x4af05c['query']);_0x48f916['filters']=_[_0xec75('0x5a')](_0x48f916['model'],_0x48f916[_0xec75('0x43')]);_0x5c6cb5[_0xec75('0x48')]=_[_0xec75('0x5a')](_0x48f916[_0xec75('0x46')],qs[_0xec75('0x47')](_0x4af05c['query'][_0xec75('0x47')]));_0x5c6cb5['attributes']=_0x5c6cb5[_0xec75('0x48')][_0xec75('0x49')]?_0x5c6cb5[_0xec75('0x48')]:_0x48f916[_0xec75('0x46')];_0x5c6cb5[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x4af05c['query'][_0xec75('0x4d')]);_0x5c6cb5[_0xec75('0x4e')]=qs[_0xec75('0x45')](_['pick'](_0x4af05c[_0xec75('0x43')],_0x48f916[_0xec75('0x45')]));if(_0x4af05c[_0xec75('0x43')][_0xec75('0x50')]){_0x5c6cb5[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x5c6cb5[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0x5c6cb5['attributes'],function(_0x4d5db6){var _0x37be5f={};_0x37be5f[_0x4d5db6]={'$like':'%'+_0x4af05c['query'][_0xec75('0x50')]+'%'};return _0x37be5f;})});}_0x5c6cb5=_['merge']({},_0x5c6cb5,_0x4af05c['options']);return _0x434845[_0xec75('0xc0')](_0x5c6cb5);}})[_0xec75('0x23')](function(_0x594107){if(_0x594107){_0x38ed81=_0x594107[_0xec75('0x49')];if(!_0x4af05c['query'][_0xec75('0x61')](_0xec75('0x4a'))){_0x5c6cb5[_0xec75('0x4b')]=qs[_0xec75('0x4b')](_0x4af05c[_0xec75('0x43')][_0xec75('0x4b')]);_0x5c6cb5[_0xec75('0x31')]=qs[_0xec75('0x31')](_0x4af05c['query'][_0xec75('0x31')]);}return _0x434845[_0xec75('0xc0')](_0x5c6cb5);}})[_0xec75('0x23')](function(_0x2396c3){if(_0x2396c3){return _0x2396c3?{'count':_0x38ed81,'rows':_0x2396c3}:null;}})[_0xec75('0x23')](respondWithResult(_0x5aaeb0,null))[_0xec75('0x2c')](handleError(_0x5aaeb0,null));}; \ No newline at end of file +var _0x8e22=['update','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','length','find','body','Pause','describe','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','email','ListId','isNil','active','cservice','cauthentication','user','cuser','password','authentication','host','port','service','pass','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','destroy','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','split','List','Contacts','from','format','%s\x20<%s>','attachments','join','basename','auth','secure','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','redis','./mailAccount.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x31e91d,_0x5333d4){var _0x19f4b8=function(_0x36edff){while(--_0x36edff){_0x31e91d['push'](_0x31e91d['shift']());}};_0x19f4b8(++_0x5333d4);}(_0x8e22,0x87));var _0x28e2=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0x8e22[_0x111494];return _0x1d0d8b;};'use strict';var pdf=require(_0x28e2('0x0'));var emlformat=require(_0x28e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x28e2('0x2'));var jsonpatch=require(_0x28e2('0x3'));var rp=require(_0x28e2('0x4'));var moment=require(_0x28e2('0x5'));var BPromise=require(_0x28e2('0x6'));var Mustache=require(_0x28e2('0x7'));var util=require(_0x28e2('0x8'));var path=require('path');var sox=require(_0x28e2('0x9'));var csv=require(_0x28e2('0xa'));var ejs=require(_0x28e2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x28e2('0xc'));var crypto=require(_0x28e2('0xd'));var jsforce=require(_0x28e2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28e2('0xa'));var querystring=require(_0x28e2('0xf'));var Papa=require(_0x28e2('0x10'));var Redis=require(_0x28e2('0x11'));var authService=require(_0x28e2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x28e2('0x13'));var hardwareService=require(_0x28e2('0x14'));var logger=require(_0x28e2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x28e2('0x16'));var db=require(_0x28e2('0x17'))['db'];config['redis']=_[_0x28e2('0x18')](config['redis'],{'host':_0x28e2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28e2('0x1a')]));require(_0x28e2('0x1b'))['register'](socket);var jayson=require(_0x28e2('0x1c'));var client=jayson[_0x28e2('0x1d')][_0x28e2('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x5d207c,_0x39b766,_0x26b109){if(_0x26b109){var _0x1d50d8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d50d8[_0x28e2('0x1f')](_0x39b766)){return _0x5d207c;}else{throw new db[(_0x28e2('0x20'))][(_0x28e2('0x21'))](_0x28e2('0x22'));}}else{return _0x5d207c;}}function respondWithRpcPromise(_0x1ccfe9,_0x3dde23,_0x5ce179,_0x551c38){return new BPromise(function(_0x19eb9,_0x384d0a){var _0x3a0a76=_0x551c38||client;return _0x3a0a76[_0x28e2('0x23')](_0x1ccfe9,_0x5ce179)[_0x28e2('0x24')](function(_0x263363){logger[_0x28e2('0x25')]('MailAccount,\x20%s,\x20%s',_0x3dde23,'request\x20sent');logger[_0x28e2('0x26')](_0x28e2('0x27'),_0x3dde23,_0x28e2('0x28'),JSON['stringify'](_0x263363));if(_0x263363[_0x28e2('0x29')]){if(_0x263363['error'][_0x28e2('0x2a')]===0x1f4){logger['error'](_0x28e2('0x2b'),_0x3dde23,_0x263363[_0x28e2('0x29')][_0x28e2('0x2c')]);return _0x384d0a(_0x263363[_0x28e2('0x29')][_0x28e2('0x2c')]);}logger['error'](_0x28e2('0x2b'),_0x3dde23,_0x263363['error'][_0x28e2('0x2c')]);return _0x19eb9(_0x263363['error']['message']);}else{logger[_0x28e2('0x25')](_0x28e2('0x2b'),_0x3dde23,_0x28e2('0x28'));_0x19eb9(_0x263363[_0x28e2('0x2d')]['message']);}})[_0x28e2('0x2e')](function(_0x10b798){logger[_0x28e2('0x29')](_0x28e2('0x2b'),_0x3dde23,_0x10b798);_0x384d0a(_0x10b798);});});}function respondWithStatusCode(_0x223e25,_0x111c16){_0x111c16=_0x111c16||0xcc;return function(_0x3735dd){if(_0x3735dd){return _0x223e25[_0x28e2('0x2f')](_0x111c16);}return _0x223e25[_0x28e2('0x30')](_0x111c16)['end']();};}function respondWithResult(_0x39ae8c,_0x441793){_0x441793=_0x441793||0xc8;return function(_0x52fd61){if(_0x52fd61){return _0x39ae8c[_0x28e2('0x30')](_0x441793)[_0x28e2('0x31')](_0x52fd61);}};}function respondWithFilteredResult(_0x48d2b5,_0x5e61d2){return function(_0x537a02){if(_0x537a02){var _0x10cf77=_0x537a02[_0x28e2('0x32')],_0x3682b5=_0x5e61d2[_0x28e2('0x33')],_0x5e9ba7=_0x5e61d2[_0x28e2('0x33')]+_0x5e61d2[_0x28e2('0x34')],_0x1416c0;if(_0x5e9ba7>=_0x10cf77){_0x5e9ba7=_0x10cf77;_0x1416c0=0xc8;}else{_0x1416c0=0xce;}_0x48d2b5[_0x28e2('0x30')](_0x1416c0);return _0x48d2b5['set'](_0x28e2('0x35'),_0x3682b5+'-'+_0x5e9ba7+'/'+_0x10cf77)[_0x28e2('0x31')](_0x537a02);}return null;};}function patchUpdates(_0x5e7e20){return function(_0x154cf7){try{jsonpatch[_0x28e2('0x36')](_0x154cf7,_0x5e7e20,!![]);}catch(_0x59e7c2){return BPromise[_0x28e2('0x37')](_0x59e7c2);}return _0x154cf7[_0x28e2('0x38')]();};}function saveUpdates(_0x153390,_0x3b7151){return function(_0x1d5d88){if(_0x1d5d88){return _0x1d5d88[_0x28e2('0x39')](_0x153390)[_0x28e2('0x24')](function(_0x25ff08){return _0x25ff08;});}return null;};}function removeEntity(_0x3132c4,_0x14887e){return function(_0x463430){if(_0x463430){return _0x463430['destroy']()[_0x28e2('0x24')](function(){var _0x48ded2=_0x463430['get']({'plain':!![]});var _0x1114eb=_0x28e2('0x3a');return db[_0x28e2('0x3b')]['destroy']({'where':{'type':_0x1114eb,'resourceId':_0x48ded2['id']}})[_0x28e2('0x24')](function(){return _0x463430;});})[_0x28e2('0x24')](function(){_0x3132c4[_0x28e2('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7f813a,_0x146c43){return function(_0x1e85c1){if(!_0x1e85c1){_0x7f813a[_0x28e2('0x2f')](0x194);}return _0x1e85c1;};}function handleError(_0x79bc53,_0x320d3f){_0x320d3f=_0x320d3f||0x1f4;return function(_0x3f0975){logger[_0x28e2('0x29')](_0x3f0975[_0x28e2('0x3c')]);if(_0x3f0975[_0x28e2('0x3d')]){delete _0x3f0975[_0x28e2('0x3d')];}_0x79bc53[_0x28e2('0x30')](_0x320d3f)[_0x28e2('0x3e')](_0x3f0975);};}exports[_0x28e2('0x3f')]=function(_0x3e6f43,_0x531a25){var _0x1df645={'include':[{'model':db[_0x28e2('0x40')],'as':_0x28e2('0x41')},{'model':db[_0x28e2('0x42')],'as':_0x28e2('0x43')},{'model':db['Pause'],'as':_0x28e2('0x44')}]},_0x4412d2={},_0x5cb563={'count':0x0,'rows':[]};var _0x417385=_[_0x28e2('0x45')](db[_0x28e2('0x46')][_0x28e2('0x47')],function(_0x2a2842){return{'name':_0x2a2842[_0x28e2('0x48')],'type':_0x2a2842[_0x28e2('0x49')][_0x28e2('0x4a')]};});_0x4412d2['model']=_[_0x28e2('0x45')](_0x417385,_0x28e2('0x3d'));_0x4412d2[_0x28e2('0x4b')]=_[_0x28e2('0x4c')](_0x3e6f43[_0x28e2('0x4b')]);_0x4412d2[_0x28e2('0x4d')]=_['intersection'](_0x4412d2[_0x28e2('0x4e')],_0x4412d2['query']);_0x1df645[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x4412d2[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x1df645[_0x28e2('0x4f')]=_0x1df645[_0x28e2('0x4f')]['length']?_0x1df645[_0x28e2('0x4f')]:_0x4412d2[_0x28e2('0x4e')];if(!_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x52')]('nolimit')){_0x1df645[_0x28e2('0x34')]=qs[_0x28e2('0x34')](_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x34')]);_0x1df645[_0x28e2('0x33')]=qs[_0x28e2('0x33')](_0x3e6f43['query'][_0x28e2('0x33')]);}_0x1df645[_0x28e2('0x53')]=qs['sort'](_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x54')]);_0x1df645[_0x28e2('0x55')]=qs[_0x28e2('0x4d')](_[_0x28e2('0x56')](_0x3e6f43[_0x28e2('0x4b')],_0x4412d2[_0x28e2('0x4d')]),_0x417385);if(_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x57')]){_0x1df645[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x1df645[_0x28e2('0x55')],{'$or':_['map'](_0x417385,function(_0x211e03){if(_0x211e03[_0x28e2('0x49')]!==_0x28e2('0x59')){var _0x35b170={};_0x35b170[_0x211e03[_0x28e2('0x3d')]]={'$like':'%'+_0x3e6f43['query']['filter']+'%'};return _0x35b170;}})});}_0x1df645=_['merge']({},_0x1df645,_0x3e6f43[_0x28e2('0x5a')]);var _0x584eb8={'where':_0x1df645[_0x28e2('0x55')]};return db[_0x28e2('0x46')]['count'](_0x584eb8)[_0x28e2('0x24')](function(_0x527aa8){_0x5cb563[_0x28e2('0x32')]=_0x527aa8;if(_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x5b')]){_0x1df645[_0x28e2('0x5c')]=[{'all':!![]}];}return db[_0x28e2('0x46')]['findAll'](_0x1df645);})['then'](function(_0xe44a29){_0x5cb563['rows']=_0xe44a29;return _0x5cb563;})[_0x28e2('0x24')](respondWithFilteredResult(_0x531a25,_0x1df645))[_0x28e2('0x2e')](handleError(_0x531a25,null));};exports[_0x28e2('0x5d')]=function(_0x5deca7,_0x37cee3){var _0x111783={'raw':![],'where':{'id':_0x5deca7[_0x28e2('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x28e2('0x41')},{'model':db[_0x28e2('0x42')],'as':_0x28e2('0x43')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x46c331={};_0x46c331[_0x28e2('0x4e')]=_[_0x28e2('0x4c')](db[_0x28e2('0x46')][_0x28e2('0x47')]);_0x46c331[_0x28e2('0x4b')]=_[_0x28e2('0x4c')](_0x5deca7[_0x28e2('0x4b')]);_0x46c331['filters']=_['intersection'](_0x46c331[_0x28e2('0x4e')],_0x46c331[_0x28e2('0x4b')]);_0x111783[_0x28e2('0x4f')]=_['intersection'](_0x46c331['model'],qs[_0x28e2('0x51')](_0x5deca7[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x111783[_0x28e2('0x4f')]=_0x111783[_0x28e2('0x4f')][_0x28e2('0x5f')]?_0x111783[_0x28e2('0x4f')]:_0x46c331[_0x28e2('0x4e')];if(_0x5deca7[_0x28e2('0x4b')][_0x28e2('0x5b')]){_0x111783[_0x28e2('0x5c')]=[{'all':!![]}];}_0x111783=_[_0x28e2('0x58')]({},_0x111783,_0x5deca7[_0x28e2('0x5a')]);return db[_0x28e2('0x46')][_0x28e2('0x60')](_0x111783)[_0x28e2('0x24')](handleEntityNotFound(_0x37cee3,null))[_0x28e2('0x24')](respondWithResult(_0x37cee3,null))[_0x28e2('0x2e')](handleError(_0x37cee3,null));};exports['update']=function(_0x4ba6f6,_0x67747a){if(_0x4ba6f6['body']['id']){delete _0x4ba6f6[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x4ba6f6['params']['id']},'include':[{'model':db[_0x28e2('0x40')],'as':_0x28e2('0x41')},{'model':db[_0x28e2('0x42')],'as':'Smtp'},{'model':db[_0x28e2('0x62')],'as':_0x28e2('0x44')}]})[_0x28e2('0x24')](handleEntityNotFound(_0x67747a,null))['then'](saveUpdates(_0x4ba6f6[_0x28e2('0x61')],null))[_0x28e2('0x24')](function(_0x3f015c){if(_0x3f015c&&_0x4ba6f6[_0x28e2('0x61')]['Imap']){return db[_0x28e2('0x40')][_0x28e2('0x39')](_0x4ba6f6[_0x28e2('0x61')]['Imap'],{'where':{'MailAccountId':_0x3f015c['id']}})[_0x28e2('0x24')](function(){return _0x3f015c;});}return _0x3f015c;})[_0x28e2('0x24')](function(_0x1557c5){if(_0x1557c5&&_0x4ba6f6[_0x28e2('0x61')][_0x28e2('0x43')]){return db[_0x28e2('0x42')][_0x28e2('0x39')](_0x4ba6f6[_0x28e2('0x61')]['Smtp'],{'where':{'MailAccountId':_0x1557c5['id']}})[_0x28e2('0x24')](function(){return _0x1557c5;});}return _0x1557c5;})[_0x28e2('0x24')](respondWithResult(_0x67747a,null))[_0x28e2('0x2e')](handleError(_0x67747a,null));};exports[_0x28e2('0x63')]=function(_0x1eae77,_0x3632e5){return db[_0x28e2('0x46')]['describe']()['then'](respondWithResult(_0x3632e5,null))[_0x28e2('0x2e')](handleError(_0x3632e5,null));};exports['addDisposition']=function(_0x1a947a,_0x2054d2,_0x215ebf){if(_0x1a947a['body']['id']){delete _0x1a947a[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x1a947a[_0x28e2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2054d2,null))[_0x28e2('0x24')](function(_0x55e78d){if(_0x55e78d){_0x1a947a[_0x28e2('0x61')][_0x28e2('0x64')]=_0x55e78d['id'];return db[_0x28e2('0x65')][_0x28e2('0x66')](_0x1a947a[_0x28e2('0x61')]);}})['then'](respondWithResult(_0x2054d2,null))[_0x28e2('0x2e')](handleError(_0x2054d2,null));};exports[_0x28e2('0x67')]=function(_0x15d1a1,_0x10407e,_0xd663b8){var _0xcfe1ad={'raw':![],'where':{}};var _0x2782ae={};var _0x59fc29={'count':0x0,'rows':[]};return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0x15d1a1[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x10407e,null))[_0x28e2('0x24')](function(_0x52b3a2){if(_0x52b3a2){_0x2782ae['model']=_[_0x28e2('0x4c')](db['Disposition'][_0x28e2('0x47')]);_0x2782ae['query']=_['keys'](_0x15d1a1['query']);_0x2782ae[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x2782ae[_0x28e2('0x4e')],_0x2782ae[_0x28e2('0x4b')]);_0xcfe1ad[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x2782ae[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0x15d1a1[_0x28e2('0x4b')][_0x28e2('0x51')]));_0xcfe1ad[_0x28e2('0x4f')]=_0xcfe1ad['attributes'][_0x28e2('0x5f')]?_0xcfe1ad['attributes']:_0x2782ae[_0x28e2('0x4e')];if(!_0x15d1a1[_0x28e2('0x4b')][_0x28e2('0x52')](_0x28e2('0x69'))){_0xcfe1ad[_0x28e2('0x34')]=qs[_0x28e2('0x34')](_0x15d1a1[_0x28e2('0x4b')][_0x28e2('0x34')]);_0xcfe1ad[_0x28e2('0x33')]=qs['offset'](_0x15d1a1['query']['offset']);}_0xcfe1ad[_0x28e2('0x53')]=qs['sort'](_0x15d1a1['query'][_0x28e2('0x54')]);_0xcfe1ad['where']=qs[_0x28e2('0x4d')](_[_0x28e2('0x56')](_0x15d1a1[_0x28e2('0x4b')],_0x2782ae[_0x28e2('0x4d')]));_0xcfe1ad['where'][_0x28e2('0x64')]=_0x52b3a2['id'];if(_0x15d1a1['query']['filter']){_0xcfe1ad[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0xcfe1ad[_0x28e2('0x55')],{'$or':_[_0x28e2('0x45')](_0xcfe1ad[_0x28e2('0x4f')],function(_0x2559c6){var _0x419552={};_0x419552[_0x2559c6]={'$like':'%'+_0x15d1a1[_0x28e2('0x4b')][_0x28e2('0x57')]+'%'};return _0x419552;})});}_0xcfe1ad=_[_0x28e2('0x58')]({},_0xcfe1ad,_0x15d1a1['options']);return db[_0x28e2('0x65')]['count']({'where':_0xcfe1ad[_0x28e2('0x55')]})[_0x28e2('0x24')](function(_0xe7c731){_0x59fc29['count']=_0xe7c731;if(_0x15d1a1['query'][_0x28e2('0x5b')]){_0xcfe1ad[_0x28e2('0x5c')]=[{'all':!![]}];}return db[_0x28e2('0x65')]['findAll'](_0xcfe1ad);})['then'](function(_0x36e327){_0x59fc29[_0x28e2('0x6a')]=_0x36e327;return _0x59fc29;});}})[_0x28e2('0x24')](respondWithFilteredResult(_0x10407e,_0xcfe1ad))['catch'](handleError(_0x10407e,null));};exports[_0x28e2('0x6b')]=function(_0xe5d347,_0x33e61d,_0x5911e8){return db[_0x28e2('0x46')]['find']({'where':{'id':_0xe5d347[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x33e61d,null))[_0x28e2('0x24')](function(_0x57995e){if(_0x57995e){return _0x57995e['removeDispositions'](_0xe5d347['query'][_0x28e2('0x6c')]);}})[_0x28e2('0x24')](respondWithStatusCode(_0x33e61d,null))[_0x28e2('0x2e')](handleError(_0x33e61d,null));};exports[_0x28e2('0x6d')]=function(_0x1c4b3c,_0x33b16d,_0x3c30e8){if(_0x1c4b3c[_0x28e2('0x61')]['id']){delete _0x1c4b3c[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x1c4b3c[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x33b16d,null))[_0x28e2('0x24')](function(_0x2bdc61){if(_0x2bdc61){_0x1c4b3c['body']['MailAccountId']=_0x2bdc61['id'];return db[_0x28e2('0x6e')][_0x28e2('0x66')](_0x1c4b3c['body']);}})[_0x28e2('0x24')](respondWithResult(_0x33b16d,null))[_0x28e2('0x2e')](handleError(_0x33b16d,null));};exports[_0x28e2('0x6f')]=function(_0xc20061,_0x134933,_0x445c32){var _0x1e7259={'raw':![],'where':{}};var _0x5ddaca={};var _0x5ea82d={'count':0x0,'rows':[]};return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0xc20061[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x134933,null))[_0x28e2('0x24')](function(_0x18d16b){if(_0x18d16b){_0x5ddaca[_0x28e2('0x4e')]=_[_0x28e2('0x4c')](db[_0x28e2('0x6e')][_0x28e2('0x47')]);_0x5ddaca['query']=_[_0x28e2('0x4c')](_0xc20061[_0x28e2('0x4b')]);_0x5ddaca[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x5ddaca[_0x28e2('0x4e')],_0x5ddaca[_0x28e2('0x4b')]);_0x1e7259[_0x28e2('0x4f')]=_['intersection'](_0x5ddaca[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0xc20061[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x1e7259['attributes']=_0x1e7259['attributes'][_0x28e2('0x5f')]?_0x1e7259['attributes']:_0x5ddaca[_0x28e2('0x4e')];if(!_0xc20061[_0x28e2('0x4b')][_0x28e2('0x52')]('nolimit')){_0x1e7259[_0x28e2('0x34')]=qs[_0x28e2('0x34')](_0xc20061[_0x28e2('0x4b')][_0x28e2('0x34')]);_0x1e7259['offset']=qs[_0x28e2('0x33')](_0xc20061[_0x28e2('0x4b')]['offset']);}_0x1e7259[_0x28e2('0x53')]=qs[_0x28e2('0x54')](_0xc20061[_0x28e2('0x4b')]['sort']);_0x1e7259[_0x28e2('0x55')]=qs[_0x28e2('0x4d')](_['pick'](_0xc20061[_0x28e2('0x4b')],_0x5ddaca[_0x28e2('0x4d')]));_0x1e7259[_0x28e2('0x55')][_0x28e2('0x64')]=_0x18d16b['id'];if(_0xc20061[_0x28e2('0x4b')]['filter']){_0x1e7259[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x1e7259[_0x28e2('0x55')],{'$or':_[_0x28e2('0x45')](_0x1e7259[_0x28e2('0x4f')],function(_0x2ad99b){var _0x484959={};_0x484959[_0x2ad99b]={'$like':'%'+_0xc20061[_0x28e2('0x4b')][_0x28e2('0x57')]+'%'};return _0x484959;})});}_0x1e7259=_[_0x28e2('0x58')]({},_0x1e7259,_0xc20061[_0x28e2('0x5a')]);return db[_0x28e2('0x6e')][_0x28e2('0x32')]({'where':_0x1e7259[_0x28e2('0x55')]})[_0x28e2('0x24')](function(_0xd32670){_0x5ea82d[_0x28e2('0x32')]=_0xd32670;if(_0xc20061[_0x28e2('0x4b')][_0x28e2('0x5b')]){_0x1e7259[_0x28e2('0x5c')]=[{'all':!![]}];}return db[_0x28e2('0x6e')][_0x28e2('0x70')](_0x1e7259);})[_0x28e2('0x24')](function(_0x363414){_0x5ea82d[_0x28e2('0x6a')]=_0x363414;return _0x5ea82d;});}})[_0x28e2('0x24')](respondWithFilteredResult(_0x134933,_0x1e7259))[_0x28e2('0x2e')](handleError(_0x134933,null));};exports['removeAnswers']=function(_0x2ddee0,_0xd9e8f9,_0x4f7d5d){return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x2ddee0[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0xd9e8f9,null))[_0x28e2('0x24')](function(_0x3c0619){if(_0x3c0619){return _0x3c0619[_0x28e2('0x71')](_0x2ddee0[_0x28e2('0x4b')][_0x28e2('0x6c')]);}})[_0x28e2('0x24')](respondWithStatusCode(_0xd9e8f9,null))['catch'](handleError(_0xd9e8f9,null));};exports[_0x28e2('0x66')]=function(_0x561dec,_0x42a762){var _0x59283a={'name':_0x561dec[_0x28e2('0x61')]['name'],'key':_0x561dec[_0x28e2('0x61')][_0x28e2('0x4a')],'email':_0x561dec[_0x28e2('0x61')][_0x28e2('0x72')],'ListId':_0x561dec[_0x28e2('0x61')][_0x28e2('0x73')],'active':!_[_0x28e2('0x74')](_0x561dec['body'][_0x28e2('0x75')])?_0x561dec[_0x28e2('0x61')]['active']:!![],'description':_0x561dec[_0x28e2('0x61')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x28e2('0x74')](_0x561dec[_0x28e2('0x61')][_0x28e2('0x76')])){if(_0x561dec[_0x28e2('0x61')][_0x28e2('0x77')]){_0x59283a['Imap'][_0x28e2('0x78')]=_0x59283a[_0x28e2('0x43')][_0x28e2('0x78')]=_0x561dec['body'][_0x28e2('0x79')];_0x59283a['Imap'][_0x28e2('0x7a')]=_0x59283a[_0x28e2('0x43')]['pass']=_0x561dec[_0x28e2('0x61')]['cpassword'];}else{_0x59283a[_0x28e2('0x41')][_0x28e2('0x7b')]=_0x59283a['Smtp'][_0x28e2('0x7b')]=![];}_0x59283a[_0x28e2('0x41')][_0x28e2('0x7c')]=_0x561dec[_0x28e2('0x61')]['Imap'][_0x28e2('0x7c')];_0x59283a[_0x28e2('0x41')][_0x28e2('0x7d')]=_0x561dec[_0x28e2('0x61')][_0x28e2('0x41')][_0x28e2('0x7d')];_0x59283a['Smtp']['host']=_0x561dec['body'][_0x28e2('0x43')]['host'];_0x59283a[_0x28e2('0x43')][_0x28e2('0x7d')]=_0x561dec[_0x28e2('0x61')][_0x28e2('0x43')][_0x28e2('0x7d')];}else{_0x59283a[_0x28e2('0x41')]['service']=_0x59283a['Smtp'][_0x28e2('0x7e')]=_0x561dec[_0x28e2('0x61')][_0x28e2('0x76')];_0x59283a[_0x28e2('0x41')][_0x28e2('0x78')]=_0x59283a['Smtp'][_0x28e2('0x78')]=_0x561dec[_0x28e2('0x61')][_0x28e2('0x79')];_0x59283a['Imap'][_0x28e2('0x7a')]=_0x59283a[_0x28e2('0x43')][_0x28e2('0x7f')]=_0x561dec[_0x28e2('0x61')]['cpassword'];}return db[_0x28e2('0x46')][_0x28e2('0x66')](_0x59283a,{'include':[{'model':db[_0x28e2('0x42')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x28e2('0x41')}]})['then'](function(_0x2871c2){var _0x672c00=_0x561dec[_0x28e2('0x78')]['get']({'plain':!![]});if(!_0x672c00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x672c00['role']===_0x28e2('0x78')){var _0x1168ae=_0x2871c2[_0x28e2('0x80')]({'plain':!![]});return db[_0x28e2('0x81')][_0x28e2('0x60')]({'where':{'name':_0x28e2('0x3a'),'userProfileId':_0x672c00[_0x28e2('0x82')]},'raw':!![]})['then'](function(_0x1eaaa1){if(_0x1eaaa1&&_0x1eaaa1['autoAssociation']===0x0){return db['UserProfileResource'][_0x28e2('0x66')]({'name':_0x1168ae[_0x28e2('0x3d')],'resourceId':_0x1168ae['id'],'type':_0x1eaaa1[_0x28e2('0x3d')],'sectionId':_0x1eaaa1['id']},{})['then'](function(){return _0x2871c2;});}else{return _0x2871c2;}})[_0x28e2('0x2e')](function(_0x478213){logger[_0x28e2('0x29')](_0x28e2('0x83'),_0x478213);throw _0x478213;});}return _0x2871c2;})[_0x28e2('0x24')](respondWithResult(_0x42a762,0xc9))[_0x28e2('0x2e')](handleError(_0x42a762,null));};exports['getImap']=function(_0x1e6200,_0x3244e0,_0x5a908b){return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x1e6200['params']['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x3244e0,null))[_0x28e2('0x24')](function(_0xbd1995){if(_0xbd1995){return _0xbd1995[_0x28e2('0x84')]();}return null;})[_0x28e2('0x24')](respondWithResult(_0x3244e0,null))[_0x28e2('0x2e')](handleError(_0x3244e0,null));};exports[_0x28e2('0x85')]=function(_0x33ba07,_0xc30b7c,_0x40597a){if(_0x33ba07[_0x28e2('0x61')]['id']){delete _0x33ba07[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x33ba07[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0xc30b7c,null))[_0x28e2('0x24')](function(_0x419e28){if(_0x419e28){_0x33ba07[_0x28e2('0x61')]['MailAccountId']=_0x419e28['id'];return db[_0x28e2('0x40')][_0x28e2('0x66')](_0x33ba07['body']);}})[_0x28e2('0x24')](respondWithResult(_0xc30b7c,null))[_0x28e2('0x2e')](handleError(_0xc30b7c,null));};exports[_0x28e2('0x86')]=function(_0x290312,_0x593093,_0x3dba66){return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0x290312[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x593093,null))[_0x28e2('0x24')](function(_0x3facb5){if(_0x3facb5){return _0x3facb5[_0x28e2('0x87')](null);}return null;})[_0x28e2('0x24')](respondWithStatusCode(_0x593093,null))[_0x28e2('0x2e')](handleError(_0x593093,null));};exports['getSmtp']=function(_0x20c1eb,_0x20d394,_0x1846e1){return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x20c1eb[_0x28e2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x20d394,null))['then'](function(_0xb0fde3){if(_0xb0fde3){return _0xb0fde3[_0x28e2('0x88')]();}return null;})['then'](respondWithResult(_0x20d394,null))[_0x28e2('0x2e')](handleError(_0x20d394,null));};exports[_0x28e2('0x89')]=function(_0xfb0b62,_0x5916d2,_0x43162f){if(_0xfb0b62[_0x28e2('0x61')]['id']){delete _0xfb0b62[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0xfb0b62[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x5916d2,null))['then'](function(_0x3fc5b6){if(_0x3fc5b6){_0xfb0b62[_0x28e2('0x61')][_0x28e2('0x64')]=_0x3fc5b6['id'];return db[_0x28e2('0x42')][_0x28e2('0x66')](_0xfb0b62['body']);}})['then'](respondWithResult(_0x5916d2,null))[_0x28e2('0x2e')](handleError(_0x5916d2,null));};exports[_0x28e2('0x8a')]=function(_0x1a020c,_0x1799ca,_0x3f1a94){return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x1a020c['params']['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x1799ca,null))[_0x28e2('0x24')](function(_0xa6b756){if(_0xa6b756){return _0xa6b756[_0x28e2('0x8b')](null);}return null;})[_0x28e2('0x24')](respondWithStatusCode(_0x1799ca,null))['catch'](handleError(_0x1799ca,null));};exports[_0x28e2('0x8c')]=function(_0x3fd9ed,_0x2db6ee,_0x29ef35){return db[_0x28e2('0x8d')]['find']({'where':{'id':_0x3fd9ed['params']['id']}})['then'](handleEntityNotFound(_0x2db6ee,null))[_0x28e2('0x24')](function(_0x21812c){if(_0x21812c){return _0x21812c[_0x28e2('0x8c')](_0x3fd9ed['body'][_0x28e2('0x6c')],_[_0x28e2('0x8e')](_0x3fd9ed[_0x28e2('0x61')],['ids','id'])||{});}})[_0x28e2('0x24')](respondWithResult(_0x2db6ee,null))['catch'](handleError(_0x2db6ee,null));};exports[_0x28e2('0x8f')]=function(_0x5c03b0,_0x1ac328,_0x1bb3d6){var _0x54f9e7={'raw':![],'where':{}};var _0x13c639={};var _0x210085={'count':0x0,'rows':[]};return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0x5c03b0[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x1ac328,null))[_0x28e2('0x24')](function(_0x472eef){if(_0x472eef){_0x13c639[_0x28e2('0x4e')]=_[_0x28e2('0x4c')](db[_0x28e2('0x8d')]['rawAttributes']);_0x13c639['query']=_[_0x28e2('0x4c')](_0x5c03b0[_0x28e2('0x4b')]);_0x13c639[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x13c639['model'],_0x13c639['query']);_0x54f9e7[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x13c639[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0x5c03b0[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x54f9e7[_0x28e2('0x4f')]=_0x54f9e7['attributes']['length']?_0x54f9e7[_0x28e2('0x4f')]:_0x13c639[_0x28e2('0x4e')];if(!_0x5c03b0[_0x28e2('0x4b')]['hasOwnProperty'](_0x28e2('0x69'))){_0x54f9e7[_0x28e2('0x34')]=qs['limit'](_0x5c03b0[_0x28e2('0x4b')]['limit']);_0x54f9e7[_0x28e2('0x33')]=qs['offset'](_0x5c03b0[_0x28e2('0x4b')]['offset']);}_0x54f9e7[_0x28e2('0x53')]=qs[_0x28e2('0x54')](_0x5c03b0[_0x28e2('0x4b')]['sort']);_0x54f9e7[_0x28e2('0x55')]=qs['filters'](_[_0x28e2('0x56')](_0x5c03b0[_0x28e2('0x4b')],_0x13c639[_0x28e2('0x4d')]));_0x54f9e7[_0x28e2('0x55')][_0x28e2('0x64')]=_0x472eef['id'];if(_0x5c03b0['query'][_0x28e2('0x57')]){_0x54f9e7[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x54f9e7['where'],{'$or':_['map'](_0x54f9e7[_0x28e2('0x4f')],function(_0x16a6f0){var _0x5476d2={};_0x5476d2[_0x16a6f0]={'$like':'%'+_0x5c03b0['query'][_0x28e2('0x57')]+'%'};return _0x5476d2;})});}_0x54f9e7=_[_0x28e2('0x58')]({},_0x54f9e7,_0x5c03b0[_0x28e2('0x5a')]);return db['MailInteraction'][_0x28e2('0x32')]({'where':_0x54f9e7[_0x28e2('0x55')]})['then'](function(_0x5c7b0e){_0x210085[_0x28e2('0x32')]=_0x5c7b0e;if(_0x5c03b0['query'][_0x28e2('0x5b')]){_0x54f9e7[_0x28e2('0x5c')]=[{'model':db[_0x28e2('0x90')],'as':_0x28e2('0x91'),'required':![]},{'model':db[_0x28e2('0x92')],'as':_0x28e2('0x93'),'attributes':[_0x28e2('0x3d'),_0x28e2('0x94'),_0x28e2('0x95')],'required':![]},{'model':db[_0x28e2('0x96')],'as':_0x28e2('0x97'),'attributes':['id','name','color'],'where':_0x5c03b0[_0x28e2('0x4b')][_0x28e2('0x98')]?{'id':_0x5c03b0['query'][_0x28e2('0x98')]}:undefined,'required':_0x5c03b0['query'][_0x28e2('0x98')]?!![]:![]}];}return db[_0x28e2('0x8d')][_0x28e2('0x70')](_0x54f9e7);})[_0x28e2('0x24')](function(_0x3dce37){_0x210085['rows']=_0x3dce37;return _0x210085;});}})[_0x28e2('0x24')](respondWithFilteredResult(_0x1ac328,_0x54f9e7))['catch'](handleError(_0x1ac328,null));};exports[_0x28e2('0x99')]=function(_0x593f42,_0x3ef507,_0x378faf){return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0x593f42[_0x28e2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3ef507,null))['then'](function(_0x281f83){if(_0x281f83){return db[_0x28e2('0x9a')][_0x28e2('0x9b')](function(_0x1b536e){return db[_0x28e2('0x9c')][_0x28e2('0x9d')]({'where':{'MailAccountId':_0x593f42[_0x28e2('0x5e')]['id']},'transaction':_0x1b536e})[_0x28e2('0x24')](function(_0x12bfae){var _0x1ecd50=_['map'](_0x593f42['body'],function(_0x104c86){_0x104c86[_0x28e2('0x64')]=_0x593f42['params']['id'];return _0x104c86;});return db[_0x28e2('0x9c')]['bulkCreate'](_0x1ecd50,{'transaction':_0x1b536e});});})[_0x28e2('0x24')](function(){return db[_0x28e2('0x9c')][_0x28e2('0x9e')]({'where':{'MailAccountId':_0x593f42['params']['id']},'order':_0x28e2('0x9f')});});}})[_0x28e2('0x24')](respondWithResult(_0x3ef507,null))['catch'](handleError(_0x3ef507,null));};exports[_0x28e2('0xa0')]=function(_0x447e5a,_0x10d627,_0x7da481){var _0x3bb918={};var _0xe1e649={};var _0x433a5e;var _0x2d8dc0;return db['MailAccount'][_0x28e2('0x68')]({'where':{'id':_0x447e5a[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x10d627,null))[_0x28e2('0x24')](function(_0x4b374a){if(_0x4b374a){_0x433a5e=_0x4b374a;_0xe1e649[_0x28e2('0x4e')]=_['keys'](db[_0x28e2('0x9c')][_0x28e2('0x47')]);_0xe1e649[_0x28e2('0x4b')]=_['keys'](_0x447e5a['query']);_0xe1e649['filters']=_[_0x28e2('0x50')](_0xe1e649['model'],_0xe1e649[_0x28e2('0x4b')]);_0x3bb918['attributes']=_['intersection'](_0xe1e649['model'],qs[_0x28e2('0x51')](_0x447e5a[_0x28e2('0x4b')]['fields']));_0x3bb918[_0x28e2('0x4f')]=_0x3bb918[_0x28e2('0x4f')]['length']?_0x3bb918[_0x28e2('0x4f')]:_0xe1e649[_0x28e2('0x4e')];_0x3bb918[_0x28e2('0x53')]=qs[_0x28e2('0x54')](_0x447e5a['query']['sort']);_0x3bb918[_0x28e2('0x55')]=qs['filters'](_['pick'](_0x447e5a[_0x28e2('0x4b')],_0xe1e649[_0x28e2('0x4d')]));if(_0x447e5a[_0x28e2('0x4b')][_0x28e2('0x57')]){_0x3bb918[_0x28e2('0x55')]=_['merge'](_0x3bb918['where'],{'$or':_[_0x28e2('0x45')](_0x3bb918[_0x28e2('0x4f')],function(_0x1bcb05){var _0x4390b3={};_0x4390b3[_0x1bcb05]={'$like':'%'+_0x447e5a[_0x28e2('0x4b')][_0x28e2('0x57')]+'%'};return _0x4390b3;})});}_0x3bb918=_['merge']({},_0x3bb918,_0x447e5a['options']);return _0x433a5e[_0x28e2('0xa0')](_0x3bb918);}})['then'](function(_0x48b0b9){if(_0x48b0b9){_0x2d8dc0=_0x48b0b9['length'];if(!_0x447e5a[_0x28e2('0x4b')][_0x28e2('0x52')](_0x28e2('0x69'))){_0x3bb918['limit']=qs[_0x28e2('0x34')](_0x447e5a['query'][_0x28e2('0x34')]);_0x3bb918[_0x28e2('0x33')]=qs[_0x28e2('0x33')](_0x447e5a['query']['offset']);}return _0x433a5e['getApplications'](_0x3bb918);}})['then'](function(_0x15a387){if(_0x15a387){return _0x15a387?{'count':_0x2d8dc0,'rows':_0x15a387}:null;}})[_0x28e2('0x24')](respondWithResult(_0x10d627,null))['catch'](handleError(_0x10d627,null));};exports[_0x28e2('0xa1')]=function(_0x5e0f1d,_0x181a5c,_0x8363e3){var _0x7896b9={'raw':!![],'where':{}};var _0x5bdbbe={};var _0x356072={'count':0x0,'rows':[]};return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x5e0f1d[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x181a5c,null))[_0x28e2('0x24')](function(_0x58ae58){if(_0x58ae58){_0x5bdbbe[_0x28e2('0x4e')]=_[_0x28e2('0x4c')](db[_0x28e2('0xa2')][_0x28e2('0x47')]);_0x5bdbbe[_0x28e2('0x4b')]=_[_0x28e2('0x4c')](_0x5e0f1d['query']);_0x5bdbbe[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x5bdbbe[_0x28e2('0x4e')],_0x5bdbbe[_0x28e2('0x4b')]);_0x7896b9[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x5bdbbe[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x7896b9[_0x28e2('0x4f')]=_0x7896b9[_0x28e2('0x4f')][_0x28e2('0x5f')]?_0x7896b9['attributes']:_0x5bdbbe[_0x28e2('0x4e')];if(!_0x5e0f1d['query'][_0x28e2('0x52')]('nolimit')){_0x7896b9[_0x28e2('0x34')]=qs[_0x28e2('0x34')](_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x34')]);_0x7896b9[_0x28e2('0x33')]=qs[_0x28e2('0x33')](_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x33')]);}_0x7896b9[_0x28e2('0x53')]=qs['sort'](_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x54')]);_0x7896b9['where']=qs['filters'](_[_0x28e2('0x56')](_0x5e0f1d['query'],_0x5bdbbe['filters']));_0x7896b9['where'][_0x28e2('0x64')]=_0x58ae58['id'];if(_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x57')]){_0x7896b9[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x7896b9[_0x28e2('0x55')],{'$or':_['map'](_0x7896b9[_0x28e2('0x4f')],function(_0x5e4ea0){var _0x2bbcad={};_0x2bbcad[_0x5e4ea0]={'$like':'%'+_0x5e0f1d['query'][_0x28e2('0x57')]+'%'};return _0x2bbcad;})});}if(_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0xa3')]){var _0x1d784f=_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0xa3')]['split'](',');var _0x56a5f1={};_0x56a5f1[_0x1d784f[0x0]]={'$gte':moment(_0x1d784f[0x1])['format'](_0x28e2('0xa4'))};_0x7896b9['where']=_[_0x28e2('0x58')](_0x7896b9[_0x28e2('0x55')],_0x56a5f1);}_0x7896b9=_[_0x28e2('0x58')]({},_0x7896b9,_0x5e0f1d[_0x28e2('0x5a')]);return db[_0x28e2('0xa2')]['count']({'where':_0x7896b9[_0x28e2('0x55')]})['then'](function(_0x3002e0){_0x356072['count']=_0x3002e0;if(_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x5b')]){_0x7896b9[_0x28e2('0x5c')]=[{'all':!![]}];}return db[_0x28e2('0xa2')][_0x28e2('0x70')](_0x7896b9);})[_0x28e2('0x24')](function(_0x1acb02){_0x356072[_0x28e2('0x6a')]=_0x1acb02;return _0x356072;});}})[_0x28e2('0x24')](respondWithFilteredResult(_0x181a5c,_0x7896b9))[_0x28e2('0x2e')](handleError(_0x181a5c,null));};exports[_0x28e2('0x3e')]=function(_0x3ef991,_0x4e7ff2,_0x2a40a7){var _0x3e68e1,_0x161c86={},_0x188822;if(_0x3ef991[_0x28e2('0x61')]['to']){_0x188822=_0x3ef991[_0x28e2('0x61')]['to'][_0x28e2('0xa5')](',')[0x0];}return db['MailAccount'][_0x28e2('0x60')]({'where':{'id':_0x3ef991[_0x28e2('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x28e2('0xa6'),'include':[{'model':db[_0x28e2('0x90')],'as':_0x28e2('0xa7'),'where':{'email':_0x188822},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x28e2('0x42')],'as':_0x28e2('0x43'),'raw':!![]}]})[_0x28e2('0x24')](handleEntityNotFound(_0x4e7ff2,null))[_0x28e2('0x24')](function(_0x41408f){if(_0x41408f){_0x3e68e1=_0x41408f;if(_0x41408f[_0x28e2('0x43')]){if(_['isNil'](_0x3ef991[_0x28e2('0x61')]['from'])){_0x3ef991[_0x28e2('0x61')][_0x28e2('0xa8')]=util[_0x28e2('0xa9')](_0x28e2('0xaa'),_0x41408f[_0x28e2('0x3d')],_0x41408f['email']||_0x41408f[_0x28e2('0x43')]['user']);}if(_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')]&&_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')][_0x28e2('0x5f')]){for(var _0x505a85=0x0;_0x505a85<_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')]['length'];_0x505a85+=0x1){_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')][_0x505a85]={'filename':_0x3ef991['body'][_0x28e2('0xab')][_0x505a85]['name'],'path':path[_0x28e2('0xac')](config['root'],'server/files/attachments',_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')][_0x505a85][_0x28e2('0xad')])};}}var _0x241681={'tls':{'rejectUnauthorized':![]}};if(_[_0x28e2('0x74')](_0x41408f[_0x28e2('0x43')][_0x28e2('0x7e')])){if(_0x41408f[_0x28e2('0x43')][_0x28e2('0x7b')]){_0x241681[_0x28e2('0xae')]={'user':_0x41408f[_0x28e2('0x43')][_0x28e2('0x78')],'pass':_0x41408f[_0x28e2('0x43')][_0x28e2('0x7f')]};}_0x241681[_0x28e2('0x7c')]=_0x41408f['Smtp'][_0x28e2('0x7c')];_0x241681[_0x28e2('0x7d')]=_0x41408f[_0x28e2('0x43')]['port'];_0x241681['secure']=_0x41408f['Smtp'][_0x28e2('0xaf')];}else{_0x241681[_0x28e2('0x7e')]=_0x41408f[_0x28e2('0x43')]['service'];_0x241681[_0x28e2('0xae')]={'user':_0x41408f[_0x28e2('0x43')][_0x28e2('0x78')],'pass':_0x41408f['Smtp'][_0x28e2('0x7f')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x241681,'message':_0x3ef991[_0x28e2('0x61')]});}else{throw new Error('List\x20not\x20found');}}})[_0x28e2('0x24')](function(_0x50ae1b){if(_0x50ae1b){_0x161c86=_0x50ae1b;if(_0x3e68e1[_0x28e2('0xa6')]){if(_0x3e68e1[_0x28e2('0xa6')]['Contacts'][_0x28e2('0x5f')]){return _0x3e68e1[_0x28e2('0xa6')][_0x28e2('0xa7')][0x0];}else{return db[_0x28e2('0x90')][_0x28e2('0x66')](_[_0x28e2('0x18')](_0x3ef991[_0x28e2('0x61')],{'firstName':_0x3ef991[_0x28e2('0x61')]['to'],'email':_0x3ef991[_0x28e2('0x61')]['to'],'phone':_0x3ef991[_0x28e2('0x61')]['to'],'ListId':_0x3e68e1[_0x28e2('0x73')]}));}}else{throw new Error(_0x28e2('0xb0'));}}})['then'](function(_0x313f54){if(_0x313f54){var _0x13437f={'UserId':_0x3ef991[_0x28e2('0x78')]['id'],'ContactId':_0x313f54['id'],'MailAccountId':_0x3e68e1['id'],'inReplyTo':_0x161c86[_0x28e2('0xb1')],'to':_0x3ef991[_0x28e2('0x61')][_0x28e2('0xa8')],'cc':_0x3ef991['body']['cc'],'subject':_0x3ef991['body'][_0x28e2('0xb2')],'attach':_0x3ef991[_0x28e2('0x61')][_0x28e2('0xb3')],'firstMsgDirection':_0x28e2('0xb4'),'lastMsgAt':moment()[_0x28e2('0xa9')](_0x28e2('0xa4')),'lastMsgDirection':_0x28e2('0xb4'),'lastMsgBody':_0x3ef991[_0x28e2('0x61')][_0x28e2('0x61')],'Messages':[_[_0x28e2('0x58')](_0x3ef991[_0x28e2('0x61')],{'messageId':_0x161c86[_0x28e2('0xb1')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3e68e1['id'],'UserId':_0x3ef991[_0x28e2('0x78')]['id'],'ContactId':_0x313f54['id']})]};if(_0x3ef991[_0x28e2('0x61')][_0x28e2('0xb5')]){_0x13437f=_['merge'](_0x13437f,_0x3ef991['body']['Interaction']);}return db[_0x28e2('0x8d')][_0x28e2('0x66')](_0x13437f,{'include':[{'model':db[_0x28e2('0xa2')],'as':_0x28e2('0xb6')}]});}})[_0x28e2('0x24')](respondWithResult(_0x4e7ff2,null))['catch'](handleError(_0x4e7ff2,null));};exports[_0x28e2('0xb7')]=function(_0xc0d420,_0x4da7ab,_0x9c86f9){return db[_0x28e2('0x46')]['find']({'where':{'id':_0xc0d420[_0x28e2('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x28e2('0x43'),'raw':!![]}]})[_0x28e2('0x24')](handleEntityNotFound(_0x4da7ab,null))[_0x28e2('0x24')](function(_0x290996){if(_0x290996&&_0x290996[_0x28e2('0x43')]){var _0x47ad81={'id':_0x290996['id'],'tls':{'rejectUnauthorized':![]}};if(_0x290996['Smtp'][_0x28e2('0x7e')]){_0x47ad81[_0x28e2('0x7e')]=_0x290996[_0x28e2('0x43')]['service'];}else{_0x47ad81['host']=_0x290996[_0x28e2('0x43')]['host'];_0x47ad81['port']=_0x290996[_0x28e2('0x43')]['port'];_0x47ad81[_0x28e2('0xaf')]=_0x290996[_0x28e2('0x43')][_0x28e2('0xaf')];}if(_0x290996[_0x28e2('0x43')][_0x28e2('0x7b')]){_0x47ad81[_0x28e2('0xae')]={'user':_0x290996[_0x28e2('0x43')][_0x28e2('0x78')],'pass':_0x290996[_0x28e2('0x43')]['pass']};}return respondWithRpcPromise(_0x28e2('0xb8'),_0x28e2('0xb7'),{'account':_0x47ad81});}})[_0x28e2('0x24')](respondWithResult(_0x4da7ab,null))[_0x28e2('0x2e')](handleError(_0x4da7ab,null));};exports[_0x28e2('0x9d')]=function(_0x5ccee4,_0x3a8842){return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x5ccee4[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x3a8842,null))[_0x28e2('0x24')](function(_0xd19477){if(_0xd19477&&_0xd19477[_0x28e2('0x7e')]){throw new db[(_0x28e2('0x20'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xd19477;})[_0x28e2('0x24')](removeEntity(_0x3a8842,null))[_0x28e2('0x2e')](handleError(_0x3a8842,null));};exports[_0x28e2('0xb9')]=function(_0x341217,_0x4aa746,_0x38c0f6){return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x341217['params']['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x4aa746,null))[_0x28e2('0x24')](function(_0x589e85){if(_0x589e85){return _0x589e85[_0x28e2('0xb9')](_0x341217[_0x28e2('0x61')]['ids'],_['omit'](_0x341217[_0x28e2('0x61')],['ids','id'])||{})[_0x28e2('0xba')](function(_0x2364a9){for(var _0x445ae7=0x0;_0x445ae7<_0x341217[_0x28e2('0x61')][_0x28e2('0x6c')][_0x28e2('0x5f')];_0x445ae7+=0x1){socket[_0x28e2('0xbb')](_0x28e2('0xbc'),{'UserId':_0x341217[_0x28e2('0x61')][_0x28e2('0x6c')][_0x445ae7],'MailAccountId':_0x341217['params']['id']});}return _0x2364a9;});}})[_0x28e2('0x24')](respondWithResult(_0x4aa746,null))[_0x28e2('0x2e')](handleError(_0x4aa746,null));};exports['removeAgents']=function(_0x1917da,_0x492d69,_0x594113){return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x1917da[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x492d69,null))[_0x28e2('0x24')](function(_0x5c521e){if(_0x5c521e){return _0x5c521e['removeAgents'](_0x1917da[_0x28e2('0x4b')][_0x28e2('0x6c')])[_0x28e2('0x24')](function(){if(_[_0x28e2('0xbd')](_0x1917da[_0x28e2('0x4b')]['ids'])){for(var _0x469b78=0x0;_0x469b78<_0x1917da['query'][_0x28e2('0x6c')][_0x28e2('0x5f')];_0x469b78+=0x1){socket[_0x28e2('0xbb')](_0x28e2('0xbe'),{'UserId':Number(_0x1917da[_0x28e2('0x4b')][_0x28e2('0x6c')][_0x469b78]),'MailAccountId':Number(_0x1917da[_0x28e2('0x5e')]['id'])});}}else{socket[_0x28e2('0xbb')](_0x28e2('0xbe'),{'UserId':Number(_0x1917da[_0x28e2('0x4b')][_0x28e2('0x6c')]),'MailAccountId':Number(_0x1917da[_0x28e2('0x5e')]['id'])});}});}})[_0x28e2('0x24')](respondWithStatusCode(_0x492d69,null))['catch'](handleError(_0x492d69,null));};exports['getAgents']=function(_0x3cf32e,_0x1d88e7,_0x5359d4){var _0x4adb41={};var _0x58f24f={};var _0x1c9b6c;var _0x3e94b8;return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x3cf32e[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x1d88e7,null))['then'](function(_0x5b73bb){if(_0x5b73bb){_0x1c9b6c=_0x5b73bb;_0x58f24f[_0x28e2('0x4e')]=_['keys'](db[_0x28e2('0x92')][_0x28e2('0x47')]);_0x58f24f['query']=_['keys'](_0x3cf32e[_0x28e2('0x4b')]);_0x58f24f[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x58f24f[_0x28e2('0x4e')],_0x58f24f['query']);_0x4adb41[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x58f24f['model'],qs[_0x28e2('0x51')](_0x3cf32e[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x4adb41['attributes']=_0x4adb41[_0x28e2('0x4f')][_0x28e2('0x5f')]?_0x4adb41[_0x28e2('0x4f')]:_0x58f24f[_0x28e2('0x4e')];_0x4adb41['order']=qs['sort'](_0x3cf32e['query'][_0x28e2('0x54')]);_0x4adb41[_0x28e2('0x55')]=qs[_0x28e2('0x4d')](_['pick'](_0x3cf32e[_0x28e2('0x4b')],_0x58f24f[_0x28e2('0x4d')]));if(_0x3cf32e['query'][_0x28e2('0x57')]){_0x4adb41[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x4adb41['where'],{'$or':_['map'](_0x4adb41['attributes'],function(_0x5828b7){var _0x2fef02={};_0x2fef02[_0x5828b7]={'$like':'%'+_0x3cf32e['query'][_0x28e2('0x57')]+'%'};return _0x2fef02;})});}_0x4adb41=_[_0x28e2('0x58')]({},_0x4adb41,_0x3cf32e[_0x28e2('0x5a')]);return _0x1c9b6c[_0x28e2('0xbf')](_0x4adb41);}})[_0x28e2('0x24')](function(_0x151977){if(_0x151977){_0x3e94b8=_0x151977[_0x28e2('0x5f')];if(!_0x3cf32e['query'][_0x28e2('0x52')](_0x28e2('0x69'))){_0x4adb41[_0x28e2('0x34')]=qs['limit'](_0x3cf32e[_0x28e2('0x4b')]['limit']);_0x4adb41[_0x28e2('0x33')]=qs[_0x28e2('0x33')](_0x3cf32e[_0x28e2('0x4b')][_0x28e2('0x33')]);}return _0x1c9b6c[_0x28e2('0xbf')](_0x4adb41);}})['then'](function(_0x25560a){if(_0x25560a){return _0x25560a?{'count':_0x3e94b8,'rows':_0x25560a}:null;}})['then'](respondWithResult(_0x1d88e7,null))[_0x28e2('0x2e')](handleError(_0x1d88e7,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index acb399f..3a8e58d 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 _0x96e8=['exports','events','../../mysqldb','MailAccount','update','remove','emit','hook'];(function(_0x4b0db2,_0x2c115b){var _0x2fd0e3=function(_0x334be9){while(--_0x334be9){_0x4b0db2['push'](_0x4b0db2['shift']());}};_0x2fd0e3(++_0x2c115b);}(_0x96e8,0x99));var _0x896e=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x96e8[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require(_0x896e('0x0'));var MailAccount=require(_0x896e('0x1'))['db'][_0x896e('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x896e('0x3'),'afterDestroy':_0x896e('0x4')};function emitEvent(_0xe30ae8){return function(_0x410364,_0x16ce4a,_0x2e29fc){MailAccountEvents[_0x896e('0x5')](_0xe30ae8+':'+_0x410364['id'],_0x410364);MailAccountEvents[_0x896e('0x5')](_0xe30ae8,_0x410364);_0x2e29fc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x896e('0x6')](e,emitEvent(event));}}module[_0x896e('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x4484=['hasOwnProperty','exports','save','update','remove','emit'];(function(_0x27a1e0,_0x3ff2cb){var _0x1ca624=function(_0x435802){while(--_0x435802){_0x27a1e0['push'](_0x27a1e0['shift']());}};_0x1ca624(++_0x3ff2cb);}(_0x4484,0xf2));var _0x4448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4484[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4448('0x0'),'afterUpdate':_0x4448('0x1'),'afterDestroy':_0x4448('0x2')};function emitEvent(_0x45e18c){return function(_0x151ddf,_0x19f471,_0x279cbc){MailAccountEvents[_0x4448('0x3')](_0x45e18c+':'+_0x151ddf['id'],_0x151ddf);MailAccountEvents[_0x4448('0x3')](_0x45e18c,_0x151ddf);_0x279cbc(null);};}for(var e in events){if(events[_0x4448('0x4')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x4448('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index ea0c281..f6a1d75 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 _0x9e0c=['mail_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x212f56,_0xfaa7dd){var _0x59b847=function(_0x2b6aed){while(--_0x2b6aed){_0x212f56['push'](_0x212f56['shift']());}};_0x59b847(++_0xfaa7dd);}(_0x9e0c,0x121));var _0xc9e0=function(_0x13d68e,_0x1ee2fd){_0x13d68e=_0x13d68e-0x0;var _0x314e59=_0x9e0c[_0x13d68e];return _0x314e59;};'use strict';var _=require(_0xc9e0('0x0'));var util=require(_0xc9e0('0x1'));var logger=require(_0xc9e0('0x2'))(_0xc9e0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9e0('0x4'));var fs=require('fs');var path=require(_0xc9e0('0x5'));var rimraf=require(_0xc9e0('0x6'));var config=require(_0xc9e0('0x7'));var attributes=require(_0xc9e0('0x8'));module[_0xc9e0('0x9')]=function(_0x353514,_0x3c2d33){return _0x353514[_0xc9e0('0xa')]('MailAccount',attributes,{'tableName':_0xc9e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dcf=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x1bb536,_0x23501c){var _0x12e57b=function(_0x954ffa){while(--_0x954ffa){_0x1bb536['push'](_0x1bb536['shift']());}};_0x12e57b(++_0x23501c);}(_0x1dcf,0x9c));var _0xf1dc=function(_0x3d529d,_0xa2e33c){_0x3d529d=_0x3d529d-0x0;var _0x334f87=_0x1dcf[_0x3d529d];return _0x334f87;};'use strict';var _=require(_0xf1dc('0x0'));var util=require(_0xf1dc('0x1'));var logger=require(_0xf1dc('0x2'))(_0xf1dc('0x3'));var moment=require(_0xf1dc('0x4'));var BPromise=require(_0xf1dc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1dc('0x6'));var rimraf=require(_0xf1dc('0x7'));var config=require('../../config/environment');var attributes=require(_0xf1dc('0x8'));module[_0xf1dc('0x9')]=function(_0x21674c,_0x134567){return _0x21674c[_0xf1dc('0xa')](_0xf1dc('0xb'),attributes,{'tableName':_0xf1dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c3b965a..7c8fd3f 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 _0xb332=['List\x20not\x20found','contact','generate','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','update','format','interaction','created','MailMessage','originCc','bcc','Attachment','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetMailAccount','find','ShowMailAccount','catch','NotifyMailAccount','body','difference','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','Smtp','get','omit','Applications','list','applications','orderBy','asc','push','close','length','create'];(function(_0x13aee0,_0x45ab29){var _0xa7e086=function(_0x3ad36a){while(--_0x3ad36a){_0x13aee0['push'](_0x13aee0['shift']());}};_0xa7e086(++_0x45ab29);}(_0xb332,0xd9));var _0x2b33=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0xb332[_0x35b7d4];return _0x4e8cee;};'use strict';var _=require(_0x2b33('0x0'));var util=require('util');var moment=require(_0x2b33('0x1'));var BPromise=require(_0x2b33('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b33('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b33('0x4'));var logger=require('../../config/logger')(_0x2b33('0x5'));var config=require('../../config/environment');var jayson=require(_0x2b33('0x6'));var client=jayson[_0x2b33('0x7')][_0x2b33('0x8')]({'port':0x232c});config[_0x2b33('0x9')]=_['defaults'](config['redis'],{'host':_0x2b33('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b33('0x9')]));require(_0x2b33('0xb'))[_0x2b33('0xc')](socket);function respondWithRpcPromise(_0x14b4d1,_0x5834bb,_0x16f18){return new BPromise(function(_0x1cefb1,_0x1be19d){return client[_0x2b33('0xd')](_0x14b4d1,_0x16f18)[_0x2b33('0xe')](function(_0xf1e5e5){logger[_0x2b33('0xf')](_0x2b33('0x10'),_0x5834bb,_0x2b33('0x11'));logger[_0x2b33('0x12')](_0x2b33('0x13'),_0x5834bb,'request\x20sent',JSON[_0x2b33('0x14')](_0xf1e5e5));if(_0xf1e5e5[_0x2b33('0x15')]){if(_0xf1e5e5[_0x2b33('0x15')]['code']===0x1f4){logger[_0x2b33('0x15')]('MailAccount,\x20%s,\x20%s',_0x5834bb,_0xf1e5e5[_0x2b33('0x15')][_0x2b33('0x16')]);return _0x1be19d(_0xf1e5e5[_0x2b33('0x15')]['message']);}logger['error'](_0x2b33('0x10'),_0x5834bb,_0xf1e5e5[_0x2b33('0x15')][_0x2b33('0x16')]);return _0x1cefb1(_0xf1e5e5[_0x2b33('0x15')][_0x2b33('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x5834bb,'request\x20sent');_0x1cefb1(_0xf1e5e5[_0x2b33('0x17')]['message']);}})['catch'](function(_0x42cfd7){logger[_0x2b33('0x15')](_0x2b33('0x10'),_0x5834bb,_0x42cfd7);_0x1be19d(_0x42cfd7);});});}exports['GetMailAccount']=function(_0x42461e){var _0x5e1795=this;return new Promise(function(_0x8079c0,_0x2565be){return db[_0x2b33('0x18')][_0x2b33('0x19')]({'raw':_0x42461e[_0x2b33('0x1a')]?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1b')]===undefined?!![]:![]:!![],'where':_0x42461e['options']?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1c')]||null:null,'attributes':_0x42461e[_0x2b33('0x1a')]?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1d')]||null:null,'limit':_0x42461e[_0x2b33('0x1a')]?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1e')]||null:null,'include':_0x42461e['options']?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1f')]?_[_0x2b33('0x20')](_0x42461e[_0x2b33('0x1a')]['include'],function(_0x2ec9db){return{'model':db[_0x2ec9db['model']],'as':_0x2ec9db['as'],'attributes':_0x2ec9db[_0x2b33('0x1d')],'include':_0x2ec9db['include']?_[_0x2b33('0x20')](_0x2ec9db[_0x2b33('0x1f')],function(_0x5d8d05){return{'model':db[_0x5d8d05[_0x2b33('0x21')]],'as':_0x5d8d05['as'],'attributes':_0x5d8d05['attributes'],'include':_0x5d8d05[_0x2b33('0x1f')]?_['map'](_0x5d8d05[_0x2b33('0x1f')],function(_0xa109f4){return{'model':db[_0xa109f4[_0x2b33('0x21')]],'as':_0xa109f4['as'],'attributes':_0xa109f4[_0x2b33('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b33('0xe')](function(_0x312d4d){logger[_0x2b33('0xf')](_0x2b33('0x22'),_0x42461e);logger[_0x2b33('0x12')](_0x2b33('0x22'),_0x42461e,JSON['stringify'](_0x312d4d));_0x8079c0(_0x312d4d);})['catch'](function(_0x106ea0){logger[_0x2b33('0x15')](_0x2b33('0x22'),_0x106ea0[_0x2b33('0x16')],_0x42461e);_0x2565be(_0x5e1795[_0x2b33('0x15')](0x1f4,_0x106ea0['message']));});});};exports['ShowMailAccount']=function(_0x311ddd){var _0x3d2aaa=this;return new Promise(function(_0x476965,_0x1d2168){return db[_0x2b33('0x18')][_0x2b33('0x23')]({'raw':_0x311ddd['options']?_0x311ddd[_0x2b33('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x311ddd[_0x2b33('0x1a')]?_0x311ddd[_0x2b33('0x1a')][_0x2b33('0x1c')]||null:null,'attributes':_0x311ddd[_0x2b33('0x1a')]?_0x311ddd[_0x2b33('0x1a')][_0x2b33('0x1d')]||null:null,'include':_0x311ddd[_0x2b33('0x1a')]?_0x311ddd[_0x2b33('0x1a')][_0x2b33('0x1f')]?_[_0x2b33('0x20')](_0x311ddd[_0x2b33('0x1a')][_0x2b33('0x1f')],function(_0xe415f4){return{'model':db[_0xe415f4[_0x2b33('0x21')]],'as':_0xe415f4['as'],'attributes':_0xe415f4[_0x2b33('0x1d')],'include':_0xe415f4[_0x2b33('0x1f')]?_['map'](_0xe415f4['include'],function(_0x5da10e){return{'model':db[_0x5da10e[_0x2b33('0x21')]],'as':_0x5da10e['as'],'attributes':_0x5da10e[_0x2b33('0x1d')],'include':_0x5da10e[_0x2b33('0x1f')]?_[_0x2b33('0x20')](_0x5da10e[_0x2b33('0x1f')],function(_0x51a5d3){return{'model':db[_0x51a5d3['model']],'as':_0x51a5d3['as'],'attributes':_0x51a5d3[_0x2b33('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44aea1){logger[_0x2b33('0xf')](_0x2b33('0x24'),_0x311ddd);logger[_0x2b33('0x12')](_0x2b33('0x24'),_0x311ddd,JSON[_0x2b33('0x14')](_0x44aea1));_0x476965(_0x44aea1);})[_0x2b33('0x25')](function(_0x2594fd){logger[_0x2b33('0x15')](_0x2b33('0x24'),_0x2594fd['message'],_0x311ddd);_0x1d2168(_0x3d2aaa[_0x2b33('0x15')](0x1f4,_0x2594fd[_0x2b33('0x16')]));});});};exports[_0x2b33('0x26')]=function(_0x5b7c32){var _0x5e0aba=this;return new Promise(function(_0x3afaa5,_0x4e4d54){var _0x108182={'body':_0x5b7c32[_0x2b33('0x27')],'channel':'mail'};var _0x10147a=_[_0x2b33('0x28')](_['keys'](db[_0x2b33('0x29')][_0x2b33('0x2a')]),['createdAt',_0x2b33('0x2b'),_0x2b33('0x2c'),_0x2b33('0x2d')]);var _0x49348c=![];if(_0x5b7c32[_0x2b33('0x27')]['id']){delete _0x5b7c32[_0x2b33('0x27')]['id'];}if(_[_0x2b33('0x2e')](_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x2f')])){return _0x4e4d54(_0x5e0aba['error'](0x1f4,_0x2b33('0x30')));}if(_[_0x2b33('0x2e')](_0x5b7c32[_0x2b33('0x27')]['body'])||_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x27')]===''){return _0x4e4d54(_0x5e0aba[_0x2b33('0x15')](0x1f4,_0x2b33('0x31')));}if(_['isNil'](_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x32')])){return _0x4e4d54(_0x5e0aba['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x10147a));}if(!_['includes'](_0x10147a,_0x5b7c32[_0x2b33('0x27')]['mapKey'])){return _0x4e4d54(_0x5e0aba[_0x2b33('0x15')](0x1f4,_0x2b33('0x33')+_0x10147a));}var _0x4ac79b={};_0x4ac79b[_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x32')]]=_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x2f')];return db[_0x2b33('0x18')]['find']({'where':{'id':_0x5b7c32[_0x2b33('0x34')]['id']},'include':[{'model':db[_0x2b33('0x35')],'as':_0x2b33('0x36'),'include':[{'model':db[_0x2b33('0x29')],'as':_0x2b33('0x37'),'where':_0x4ac79b,'limit':0x1,'order':[[_0x2b33('0x2b'),'DESC']]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x2b33('0x38')}]})['then'](function(_0x1c5019){if(_0x1c5019&&_0x1c5019['List']){var _0x5071ab=_0x1c5019[_0x2b33('0x39')]({'plain':!![]});_0x108182[_0x2b33('0x34')]=_[_0x2b33('0x3a')](_0x5071ab,['Applications',_0x2b33('0x36')]);_0x108182['applications']=_0x5071ab[_0x2b33('0x3b')];_0x108182[_0x2b33('0x3c')]=_0x5071ab[_0x2b33('0x36')];_0x108182[_0x2b33('0x3d')]=_[_0x2b33('0x3e')](_0x108182[_0x2b33('0x3d')],['priority'],[_0x2b33('0x3f')]);if(_0x108182[_0x2b33('0x34')]&&_0x108182[_0x2b33('0x34')]['autoclose']){_0x108182[_0x2b33('0x3d')][_0x2b33('0x40')]({'id':0x0,'priority':_0x108182[_0x2b33('0x3d')]['length']+0x1,'app':_0x2b33('0x41'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x108182[_0x2b33('0x34')][_0x2b33('0x3b')]){delete _0x108182[_0x2b33('0x34')][_0x2b33('0x3b')];}if(_0x108182[_0x2b33('0x34')][_0x2b33('0x36')]){delete _0x108182[_0x2b33('0x34')][_0x2b33('0x36')];}if(_0x5071ab['List'][_0x2b33('0x37')][_0x2b33('0x42')]){return _0x5071ab['List'][_0x2b33('0x37')][0x0];}var _0x45a939=_['defaults'](_0x5b7c32[_0x2b33('0x27')],{'firstName':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x2f')],'ListId':_0x5071ab[_0x2b33('0x2d')]});_0x45a939[_0x5b7c32['body'][_0x2b33('0x32')]]=_0x5b7c32[_0x2b33('0x27')]['from'];return db[_0x2b33('0x29')][_0x2b33('0x43')](_0x45a939);}else{throw new Error(_0x2b33('0x44'));}})[_0x2b33('0xe')](function(_0x3a9bbf){_0x108182[_0x2b33('0x45')]=_0x3a9bbf;if(_0x3a9bbf){if(!_0x5b7c32[_0x2b33('0x27')]['message']['messageId']){_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['messageId']=rs[_0x2b33('0x46')]()+'\x20'+_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['from'];}var _0x185c3e={'ContactId':_0x3a9bbf['id'],'MailAccountId':_0x5b7c32[_0x2b33('0x34')]['id'],'inReplyTo':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x47')],'to':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x2f')],'cc':_0x5b7c32['body']['message']['cc'],'subject':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x48')],'attach':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x49')],'lastMsgAt':moment()['format'](_0x2b33('0x4a')),'lastMsgDirection':'in','lastMsgBody':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x27')]};return db[_0x2b33('0x4b')][_0x2b33('0x23')]({'where':{'closed':![],'MailAccountId':_0x5b7c32[_0x2b33('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':_0x2b33('0x4c'),'attributes':[_0x2b33('0x47')],'where':{'messageId':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x4d')]}}]})['then'](function(_0xd3dc0d){if(_0xd3dc0d){return[_0xd3dc0d,![]];}return db[_0x2b33('0x4b')][_0x2b33('0x43')](_0x185c3e)[_0x2b33('0xe')](function(_0x49745e){return[_0x49745e,!![]];});});}else{throw new Error(_0x2b33('0x4e'));}})['spread'](function(_0x1388ed,_0x23cb0b){if(_0x1388ed){_0x49348c=_0x23cb0b;if(!_0x23cb0b){return _0x1388ed[_0x2b33('0x4f')]({'inReplyTo':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x47')],'to':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['from'],'cc':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['cc'],'subject':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x48')],'attach':_0x1388ed[_0x2b33('0x49')]?_0x1388ed[_0x2b33('0x49')]:_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x49')],'substatus':null,'substatusAt':moment()[_0x2b33('0x50')](_0x2b33('0x4a')),'lastMsgAt':moment()['format'](_0x2b33('0x4a')),'lastMsgDirection':'in','lastMsgBody':_0x5b7c32['body']['body']});}else{return _0x1388ed;}}})[_0x2b33('0xe')](function(_0x5404f8){_0x108182[_0x2b33('0x51')]=_0x5404f8['get']({'plain':!![]});_0x108182[_0x2b33('0x51')][_0x2b33('0x52')]=_0x49348c;return db[_0x2b33('0x53')][_0x2b33('0x43')]({'body':_0x5b7c32['body']['body'],'MailAccountId':_0x5b7c32['account']['id'],'MailInteractionId':_0x5404f8['id'],'direction':'in','ContactId':_0x108182['contact']['id'],'messageId':_0x5b7c32['body']['message']['messageId'],'from':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x2f')],'to':_0x5b7c32['body'][_0x2b33('0x16')]['to'],'cc':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['cc'],'subject':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x48')],'attach':_0x5b7c32['body']['message']['attach'],'Attachments':_0x5b7c32['body']['message']['attachments'],'originTo':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['originTo'],'originCc':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x54')],'bcc':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x55')]},{'include':[{'model':db[_0x2b33('0x56')],'as':'Attachments'}]});})['then'](function(_0x22b354){_0x108182[_0x2b33('0x16')]=_0x22b354;if(_0x108182[_0x2b33('0x51')][_0x2b33('0x57')]){return db[_0x2b33('0x58')]['find']({'attributes':['id','name'],'where':{'id':_0x108182['interaction'][_0x2b33('0x57')]}})[_0x2b33('0xe')](function(_0x2452e4){if(_0x2452e4){_0x108182['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x2b33('0x59'),'appdata':_0x2452e4[_0x2b33('0x5a')]+','+(_0x108182['account'][_0x2b33('0x5b')]||0xa),'interval':_0x2b33('0x5c')});}return respondWithRpcPromise(_0x2b33('0x5d'),'startRouting',_0x108182);});}return respondWithRpcPromise(_0x2b33('0x5d'),_0x2b33('0x5e'),_0x108182);})[_0x2b33('0xe')](function(_0x44cec5){_0x3afaa5(_0x44cec5);})['catch'](function(_0x3e0900){_0x4e4d54(_0x5e0aba['error'](0x1f4,_0x3e0900[_0x2b33('0x16')]));});});}; \ No newline at end of file +var _0x453b=['includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','get','Applications','applications','orderBy','push','length','close','*,*,*,*','create','List\x20not\x20found','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','interaction','created','contact','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','name','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','GetMailAccount','options','raw','where','attributes','include','map','model','MailAccount','find','ShowMailAccount','stringify','catch','NotifyMailAccount','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x3e6467,_0xd48e71){var _0x18fb37=function(_0x361969){while(--_0x361969){_0x3e6467['push'](_0x3e6467['shift']());}};_0x18fb37(++_0xd48e71);}(_0x453b,0x164));var _0xb453=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x453b[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require(_0xb453('0x0'));var util=require(_0xb453('0x1'));var moment=require(_0xb453('0x2'));var BPromise=require(_0xb453('0x3'));var rs=require(_0xb453('0x4'));var fs=require('fs');var Redis=require(_0xb453('0x5'));var db=require(_0xb453('0x6'))['db'];var utils=require(_0xb453('0x7'));var logger=require(_0xb453('0x8'))(_0xb453('0x9'));var config=require(_0xb453('0xa'));var jayson=require(_0xb453('0xb'));var client=jayson[_0xb453('0xc')][_0xb453('0xd')]({'port':0x232c});config[_0xb453('0xe')]=_[_0xb453('0xf')](config['redis'],{'host':_0xb453('0x10'),'port':0x18eb});var socket=require(_0xb453('0x11'))(new Redis(config['redis']));require(_0xb453('0x12'))['register'](socket);function respondWithRpcPromise(_0x894303,_0x2aa50b,_0x446cd3){return new BPromise(function(_0x1ec172,_0x4ef367){return client[_0xb453('0x13')](_0x894303,_0x446cd3)[_0xb453('0x14')](function(_0x1ac734){logger[_0xb453('0x15')](_0xb453('0x16'),_0x2aa50b,_0xb453('0x17'));logger[_0xb453('0x18')](_0xb453('0x19'),_0x2aa50b,_0xb453('0x17'),JSON['stringify'](_0x1ac734));if(_0x1ac734['error']){if(_0x1ac734['error'][_0xb453('0x1a')]===0x1f4){logger['error'](_0xb453('0x16'),_0x2aa50b,_0x1ac734[_0xb453('0x1b')][_0xb453('0x1c')]);return _0x4ef367(_0x1ac734['error']['message']);}logger[_0xb453('0x1b')](_0xb453('0x16'),_0x2aa50b,_0x1ac734[_0xb453('0x1b')][_0xb453('0x1c')]);return _0x1ec172(_0x1ac734[_0xb453('0x1b')][_0xb453('0x1c')]);}else{logger[_0xb453('0x15')](_0xb453('0x16'),_0x2aa50b,_0xb453('0x17'));_0x1ec172(_0x1ac734['result']['message']);}})['catch'](function(_0x5b5776){logger[_0xb453('0x1b')](_0xb453('0x16'),_0x2aa50b,_0x5b5776);_0x4ef367(_0x5b5776);});});}exports[_0xb453('0x1d')]=function(_0x3066cf){var _0x24e0f1=this;return new Promise(function(_0x8b6911,_0x590283){return db['MailAccount']['findAll']({'raw':_0x3066cf[_0xb453('0x1e')]?_0x3066cf['options'][_0xb453('0x1f')]===undefined?!![]:![]:!![],'where':_0x3066cf[_0xb453('0x1e')]?_0x3066cf[_0xb453('0x1e')][_0xb453('0x20')]||null:null,'attributes':_0x3066cf[_0xb453('0x1e')]?_0x3066cf[_0xb453('0x1e')][_0xb453('0x21')]||null:null,'limit':_0x3066cf[_0xb453('0x1e')]?_0x3066cf[_0xb453('0x1e')]['limit']||null:null,'include':_0x3066cf[_0xb453('0x1e')]?_0x3066cf[_0xb453('0x1e')][_0xb453('0x22')]?_[_0xb453('0x23')](_0x3066cf[_0xb453('0x1e')][_0xb453('0x22')],function(_0x31592f){return{'model':db[_0x31592f[_0xb453('0x24')]],'as':_0x31592f['as'],'attributes':_0x31592f[_0xb453('0x21')],'include':_0x31592f[_0xb453('0x22')]?_[_0xb453('0x23')](_0x31592f[_0xb453('0x22')],function(_0x3e6631){return{'model':db[_0x3e6631['model']],'as':_0x3e6631['as'],'attributes':_0x3e6631[_0xb453('0x21')],'include':_0x3e6631[_0xb453('0x22')]?_[_0xb453('0x23')](_0x3e6631[_0xb453('0x22')],function(_0x430ba4){return{'model':db[_0x430ba4[_0xb453('0x24')]],'as':_0x430ba4['as'],'attributes':_0x430ba4[_0xb453('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb453('0x14')](function(_0x1a6c72){logger['info'](_0xb453('0x1d'),_0x3066cf);logger[_0xb453('0x18')](_0xb453('0x1d'),_0x3066cf,JSON['stringify'](_0x1a6c72));_0x8b6911(_0x1a6c72);})['catch'](function(_0x1613d8){logger[_0xb453('0x1b')](_0xb453('0x1d'),_0x1613d8[_0xb453('0x1c')],_0x3066cf);_0x590283(_0x24e0f1['error'](0x1f4,_0x1613d8['message']));});});};exports['ShowMailAccount']=function(_0x3a4054){var _0x5c78a5=this;return new Promise(function(_0x5030f8,_0x397e23){return db[_0xb453('0x25')][_0xb453('0x26')]({'raw':_0x3a4054[_0xb453('0x1e')]?_0x3a4054[_0xb453('0x1e')][_0xb453('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a4054[_0xb453('0x1e')]?_0x3a4054[_0xb453('0x1e')]['where']||null:null,'attributes':_0x3a4054['options']?_0x3a4054[_0xb453('0x1e')]['attributes']||null:null,'include':_0x3a4054['options']?_0x3a4054[_0xb453('0x1e')][_0xb453('0x22')]?_['map'](_0x3a4054[_0xb453('0x1e')][_0xb453('0x22')],function(_0x474484){return{'model':db[_0x474484[_0xb453('0x24')]],'as':_0x474484['as'],'attributes':_0x474484[_0xb453('0x21')],'include':_0x474484['include']?_['map'](_0x474484['include'],function(_0x40bfa3){return{'model':db[_0x40bfa3[_0xb453('0x24')]],'as':_0x40bfa3['as'],'attributes':_0x40bfa3[_0xb453('0x21')],'include':_0x40bfa3['include']?_[_0xb453('0x23')](_0x40bfa3['include'],function(_0x246843){return{'model':db[_0x246843['model']],'as':_0x246843['as'],'attributes':_0x246843[_0xb453('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb453('0x14')](function(_0x20290c){logger[_0xb453('0x15')](_0xb453('0x27'),_0x3a4054);logger[_0xb453('0x18')](_0xb453('0x27'),_0x3a4054,JSON[_0xb453('0x28')](_0x20290c));_0x5030f8(_0x20290c);})[_0xb453('0x29')](function(_0x413b6e){logger['error']('ShowMailAccount',_0x413b6e[_0xb453('0x1c')],_0x3a4054);_0x397e23(_0x5c78a5[_0xb453('0x1b')](0x1f4,_0x413b6e[_0xb453('0x1c')]));});});};exports[_0xb453('0x2a')]=function(_0x559d5f){var _0x49a4f2=this;return new Promise(function(_0x499cdc,_0x37b51f){var _0x1e79c6={'body':_0x559d5f['body'],'channel':'mail'};var _0x1a1d4e=_[_0xb453('0x2b')](_['keys'](db[_0xb453('0x2c')][_0xb453('0x2d')]),[_0xb453('0x2e'),_0xb453('0x2f'),_0xb453('0x30'),_0xb453('0x31')]);var _0x4f062c=![];if(_0x559d5f['body']['id']){delete _0x559d5f[_0xb453('0x32')]['id'];}if(_[_0xb453('0x33')](_0x559d5f[_0xb453('0x32')][_0xb453('0x34')])){return _0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0xb453('0x35')));}if(_[_0xb453('0x33')](_0x559d5f[_0xb453('0x32')][_0xb453('0x32')])||_0x559d5f[_0xb453('0x32')][_0xb453('0x32')]===''){return _0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0xb453('0x36')));}if(_['isNil'](_0x559d5f[_0xb453('0x32')]['mapKey'])){return _0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0xb453('0x37')+_0x1a1d4e));}if(!_[_0xb453('0x38')](_0x1a1d4e,_0x559d5f[_0xb453('0x32')][_0xb453('0x39')])){return _0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0xb453('0x3a')+_0x1a1d4e));}var _0x35b3aa={};_0x35b3aa[_0x559d5f['body'][_0xb453('0x39')]]=_0x559d5f[_0xb453('0x32')][_0xb453('0x34')];return db[_0xb453('0x25')][_0xb453('0x26')]({'where':{'id':_0x559d5f[_0xb453('0x3b')]['id']},'include':[{'model':db[_0xb453('0x3c')],'as':_0xb453('0x3d'),'include':[{'model':db[_0xb453('0x2c')],'as':_0xb453('0x3e'),'where':_0x35b3aa,'limit':0x1,'order':[['updatedAt',_0xb453('0x3f')]]}]},{'model':db[_0xb453('0x40')],'as':'Applications'},{'model':db[_0xb453('0x41')],'as':_0xb453('0x42')}]})[_0xb453('0x14')](function(_0x5da822){if(_0x5da822&&_0x5da822[_0xb453('0x3d')]){var _0x53cb5b=_0x5da822[_0xb453('0x43')]({'plain':!![]});_0x1e79c6[_0xb453('0x3b')]=_['omit'](_0x53cb5b,[_0xb453('0x44'),'List']);_0x1e79c6[_0xb453('0x45')]=_0x53cb5b[_0xb453('0x44')];_0x1e79c6['list']=_0x53cb5b[_0xb453('0x3d')];_0x1e79c6[_0xb453('0x45')]=_[_0xb453('0x46')](_0x1e79c6[_0xb453('0x45')],['priority'],['asc']);if(_0x1e79c6[_0xb453('0x3b')]&&_0x1e79c6['account']['autoclose']){_0x1e79c6[_0xb453('0x45')][_0xb453('0x47')]({'id':0x0,'priority':_0x1e79c6['applications'][_0xb453('0x48')]+0x1,'app':_0xb453('0x49'),'appdata':'autoclose','interval':_0xb453('0x4a')});}if(_0x1e79c6['account']['Applications']){delete _0x1e79c6['account'][_0xb453('0x44')];}if(_0x1e79c6[_0xb453('0x3b')][_0xb453('0x3d')]){delete _0x1e79c6['account'][_0xb453('0x3d')];}if(_0x53cb5b['List'][_0xb453('0x3e')][_0xb453('0x48')]){return _0x53cb5b['List'][_0xb453('0x3e')][0x0];}var _0x5c5d6a=_[_0xb453('0xf')](_0x559d5f[_0xb453('0x32')],{'firstName':_0x559d5f['body'][_0xb453('0x34')],'ListId':_0x53cb5b[_0xb453('0x31')]});_0x5c5d6a[_0x559d5f[_0xb453('0x32')]['mapKey']]=_0x559d5f[_0xb453('0x32')]['from'];return db['CmContact'][_0xb453('0x4b')](_0x5c5d6a);}else{throw new Error(_0xb453('0x4c'));}})['then'](function(_0x7d5092){_0x1e79c6['contact']=_0x7d5092;if(_0x7d5092){if(!_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x4d')]){_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x4d')]=rs['generate']()+'\x20'+_0x559d5f['body'][_0xb453('0x1c')]['from'];}var _0x4149b9={'ContactId':_0x7d5092['id'],'MailAccountId':_0x559d5f['account']['id'],'inReplyTo':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['messageId'],'to':_0x559d5f['body'][_0xb453('0x1c')][_0xb453('0x34')],'cc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['cc'],'subject':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['subject'],'attach':_0x559d5f['body']['message'][_0xb453('0x4e')],'lastMsgAt':moment()[_0xb453('0x4f')](_0xb453('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x559d5f[_0xb453('0x32')][_0xb453('0x32')]};return db['MailInteraction'][_0xb453('0x26')]({'where':{'closed':![],'MailAccountId':_0x559d5f['account']['id']},'include':[{'model':db[_0xb453('0x51')],'as':_0xb453('0x52'),'attributes':[_0xb453('0x4d')],'where':{'messageId':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x53')]}}]})[_0xb453('0x14')](function(_0x53468a){if(_0x53468a){return[_0x53468a,![]];}return db['MailInteraction'][_0xb453('0x4b')](_0x4149b9)[_0xb453('0x14')](function(_0x421eb1){return[_0x421eb1,!![]];});});}else{throw new Error(_0xb453('0x54'));}})[_0xb453('0x55')](function(_0xae6425,_0x4562c0){if(_0xae6425){_0x4f062c=_0x4562c0;if(!_0x4562c0){return _0xae6425[_0xb453('0x56')]({'inReplyTo':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x4d')],'to':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['from'],'cc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['cc'],'subject':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x57')],'attach':_0xae6425[_0xb453('0x4e')]?_0xae6425['attach']:_0x559d5f[_0xb453('0x32')]['message'][_0xb453('0x4e')],'substatus':null,'substatusAt':moment()[_0xb453('0x4f')](_0xb453('0x50')),'lastMsgAt':moment()[_0xb453('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x559d5f[_0xb453('0x32')][_0xb453('0x32')]});}else{return _0xae6425;}}})[_0xb453('0x14')](function(_0x2308c0){_0x1e79c6[_0xb453('0x58')]=_0x2308c0[_0xb453('0x43')]({'plain':!![]});_0x1e79c6[_0xb453('0x58')][_0xb453('0x59')]=_0x4f062c;return db[_0xb453('0x51')][_0xb453('0x4b')]({'body':_0x559d5f['body'][_0xb453('0x32')],'MailAccountId':_0x559d5f[_0xb453('0x3b')]['id'],'MailInteractionId':_0x2308c0['id'],'direction':'in','ContactId':_0x1e79c6[_0xb453('0x5a')]['id'],'messageId':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x4d')],'from':_0x559d5f['body'][_0xb453('0x1c')][_0xb453('0x34')],'to':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['to'],'cc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['cc'],'subject':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x57')],'attach':_0x559d5f[_0xb453('0x32')]['message'][_0xb453('0x4e')],'Attachments':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x5b')],'originTo':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x5c')],'originCc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x5d')],'bcc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x5e')]},{'include':[{'model':db[_0xb453('0x5f')],'as':_0xb453('0x60')}]});})[_0xb453('0x14')](function(_0x4f32ff){_0x1e79c6[_0xb453('0x1c')]=_0x4f32ff;if(_0x1e79c6[_0xb453('0x58')][_0xb453('0x61')]){return db['User'][_0xb453('0x26')]({'attributes':['id',_0xb453('0x62')],'where':{'id':_0x1e79c6[_0xb453('0x58')]['UserId']}})[_0xb453('0x14')](function(_0x593cd4){if(_0x593cd4){_0x1e79c6[_0xb453('0x45')][_0xb453('0x63')]({'id':0x0,'priority':0x0,'app':_0xb453('0x64'),'appdata':_0x593cd4[_0xb453('0x62')]+','+(_0x1e79c6[_0xb453('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0xb453('0x4a')});}return respondWithRpcPromise(_0xb453('0x65'),'startRouting',_0x1e79c6);});}return respondWithRpcPromise(_0xb453('0x65'),_0xb453('0x66'),_0x1e79c6);})['then'](function(_0x91e752){_0x499cdc(_0x91e752);})['catch'](function(_0x5d7ca3){_0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0x5d7ca3[_0xb453('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 2cb2982..0f150a5 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 _0x9829=['remove','update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x40453a,_0x1ff061){var _0x2da74d=function(_0x73e877){while(--_0x73e877){_0x40453a['push'](_0x40453a['shift']());}};_0x2da74d(++_0x1ff061);}(_0x9829,0xc4));var _0x9982=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x9829[_0x2f5a22];return _0x326b70;};'use strict';var MailAccountEvents=require(_0x9982('0x0'));var events=[_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3')];function createListener(_0x338564,_0x4c01a9){return function(_0x399b6c){_0x4c01a9[_0x9982('0x4')](_0x338564,_0x399b6c);};}function removeListener(_0x2f782a,_0x4bee19){return function(){MailAccountEvents[_0x9982('0x5')](_0x2f782a,_0x4bee19);};}exports[_0x9982('0x6')]=function(_0x58f8fe){for(var _0x500dfd=0x0,_0x340d62=events[_0x9982('0x7')];_0x500dfd<_0x340d62;_0x500dfd++){var _0x5d0824=events[_0x500dfd];var _0x25f30a=createListener(_0x9982('0x8')+_0x5d0824,_0x58f8fe);MailAccountEvents['on'](_0x5d0824,_0x25f30a);}}; \ No newline at end of file +var _0xadf0=['mailAccount:','save','remove','update','emit','length'];(function(_0x2f2b9d,_0x5dfe4b){var _0x3d73c9=function(_0x223bfd){while(--_0x223bfd){_0x2f2b9d['push'](_0x2f2b9d['shift']());}};_0x3d73c9(++_0x5dfe4b);}(_0xadf0,0x12d));var _0x0adf=function(_0x215fea,_0x3231e9){_0x215fea=_0x215fea-0x0;var _0x584624=_0xadf0[_0x215fea];return _0x584624;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x0adf('0x0'),_0x0adf('0x1'),_0x0adf('0x2')];function createListener(_0x1cbfcb,_0x92e952){return function(_0x174968){_0x92e952[_0x0adf('0x3')](_0x1cbfcb,_0x174968);};}function removeListener(_0x4b4b16,_0xb48987){return function(){MailAccountEvents['removeListener'](_0x4b4b16,_0xb48987);};}exports['register']=function(_0x5b01b9){for(var _0x516b05=0x0,_0xd1de43=events[_0x0adf('0x4')];_0x516b05<_0xd1de43;_0x516b05++){var _0x514e20=events[_0x516b05];var _0x58f618=createListener(_0x0adf('0x5')+_0x514e20,_0x5b01b9);MailAccountEvents['on'](_0x514e20,_0x58f618);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index cf54508..37daedb 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 _0xd4f4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x30acb9,_0x36cb4f){var _0x3b4db1=function(_0x5ede5a){while(--_0x5ede5a){_0x30acb9['push'](_0x30acb9['shift']());}};_0x3b4db1(++_0x36cb4f);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x5eb1d1,_0x79656a){_0x5eb1d1=_0x5eb1d1-0x0;var _0xc05d00=_0xd4f4[_0x5eb1d1];return _0xc05d00;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var auth=require(_0x4d4f('0x6'));var interaction=require(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));var controller=require(_0x4d4f('0x9'));router[_0x4d4f('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4d4f('0xb')](_0x4d4f('0xc'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0xe')]);router[_0x4d4f('0xf')](_0x4d4f('0xc'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x10')]);module[_0x4d4f('0x11')]=router; \ No newline at end of file +var _0xe511=['/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe511,0x16f));var _0x1e51=function(_0x17e174,_0x4991f8){_0x17e174=_0x17e174-0x0;var _0x3f26f1=_0xe511[_0x17e174];return _0x3f26f1;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var auth=require(_0x1e51('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1e51('0x5'));var controller=require(_0x1e51('0x6'));router[_0x1e51('0x7')](_0x1e51('0x8'),auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xd')]);module[_0x1e51('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b9e10c7..95a1f87 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 _0x4861=['sequelize','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4861,0x1e0));var _0x1486=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x4861[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0x1486('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1486('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1486('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1486('0x3')]()},'description':{'type':Sequelize[_0x1486('0x2')]},'interval':{'type':Sequelize[_0x1486('0x2')],'defaultValue':_0x1486('0x4')}}; \ No newline at end of file +var _0xd679=['noop','TEXT','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd679,0xec));var _0x9d67=function(_0x75b278,_0x36c456){_0x75b278=_0x75b278-0x0;var _0x25b42d=_0xd679[_0x75b278];return _0x25b42d;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9d67('0x0')],'allowNull':![],'defaultValue':_0x9d67('0x1')},'appdata':{'type':Sequelize[_0x9d67('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9d67('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 264c987..f22d863 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 _0x49be=['count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','find','catch','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0x1c1a4a,_0x2ece0c){var _0x1ba657=function(_0x5204bd){while(--_0x5204bd){_0x1c1a4a['push'](_0x1c1a4a['shift']());}};_0x1ba657(++_0x2ece0c);}(_0x49be,0x12b));var _0xe49b=function(_0x2bb9b3,_0x1d2c25){_0x2bb9b3=_0x2bb9b3-0x0;var _0x601b6=_0x49be[_0x2bb9b3];return _0x601b6;};'use strict';var pdf=require(_0xe49b('0x0'));var emlformat=require(_0xe49b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe49b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe49b('0x3'));var moment=require('moment');var BPromise=require(_0xe49b('0x4'));var Mustache=require('mustache');var util=require(_0xe49b('0x5'));var path=require(_0xe49b('0x6'));var sox=require(_0xe49b('0x7'));var csv=require(_0xe49b('0x8'));var ejs=require(_0xe49b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe49b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe49b('0xb'));var toCsv=require(_0xe49b('0x8'));var querystring=require(_0xe49b('0xc'));var Papa=require('papaparse');var Redis=require(_0xe49b('0xd'));var authService=require(_0xe49b('0xe'));var qs=require(_0xe49b('0xf'));var as=require(_0xe49b('0x10'));var hardwareService=require(_0xe49b('0x11'));var logger=require('../../config/logger')(_0xe49b('0x12'));var utils=require(_0xe49b('0x13'));var config=require(_0xe49b('0x14'));var db=require(_0xe49b('0x15'))['db'];function respondWithStatusCode(_0x4470bf,_0xf2f291){_0xf2f291=_0xf2f291||0xcc;return function(_0x2ac8c9){if(_0x2ac8c9){return _0x4470bf[_0xe49b('0x16')](_0xf2f291);}return _0x4470bf[_0xe49b('0x17')](_0xf2f291)['end']();};}function respondWithResult(_0x460c04,_0x2afc0f){_0x2afc0f=_0x2afc0f||0xc8;return function(_0x1f812d){if(_0x1f812d){return _0x460c04[_0xe49b('0x17')](_0x2afc0f)[_0xe49b('0x18')](_0x1f812d);}};}function respondWithFilteredResult(_0x1d74af,_0x59bd18){return function(_0x5a9b31){if(_0x5a9b31){var _0x483f8c=_0x5a9b31[_0xe49b('0x19')],_0x2aeff1=_0x59bd18[_0xe49b('0x1a')],_0x5031fe=_0x59bd18[_0xe49b('0x1a')]+_0x59bd18[_0xe49b('0x1b')],_0x3f5b89;if(_0x5031fe>=_0x483f8c){_0x5031fe=_0x483f8c;_0x3f5b89=0xc8;}else{_0x3f5b89=0xce;}_0x1d74af[_0xe49b('0x17')](_0x3f5b89);return _0x1d74af['set'](_0xe49b('0x1c'),_0x2aeff1+'-'+_0x5031fe+'/'+_0x483f8c)[_0xe49b('0x18')](_0x5a9b31);}return null;};}function patchUpdates(_0x50a62a){return function(_0x1f6cd9){try{jsonpatch[_0xe49b('0x1d')](_0x1f6cd9,_0x50a62a,!![]);}catch(_0x3c711c){return BPromise[_0xe49b('0x1e')](_0x3c711c);}return _0x1f6cd9[_0xe49b('0x1f')]();};}function saveUpdates(_0x4b665e,_0x2003c8){return function(_0x4cbfb8){if(_0x4cbfb8){return _0x4cbfb8[_0xe49b('0x20')](_0x4b665e)[_0xe49b('0x21')](function(_0x10d5cf){return _0x10d5cf;});}return null;};}function removeEntity(_0x378ae4,_0x2dd3b7){return function(_0x2632c9){if(_0x2632c9){return _0x2632c9[_0xe49b('0x22')]()[_0xe49b('0x21')](function(){_0x378ae4[_0xe49b('0x17')](0xcc)[_0xe49b('0x23')]();});}};}function handleEntityNotFound(_0x9828a8,_0x39c933){return function(_0x4058fc){if(!_0x4058fc){_0x9828a8[_0xe49b('0x16')](0x194);}return _0x4058fc;};}function handleError(_0x34a6c0,_0x59d1b6){_0x59d1b6=_0x59d1b6||0x1f4;return function(_0x5f7fa3){logger[_0xe49b('0x24')](_0x5f7fa3[_0xe49b('0x25')]);if(_0x5f7fa3['name']){delete _0x5f7fa3['name'];}_0x34a6c0[_0xe49b('0x17')](_0x59d1b6)['send'](_0x5f7fa3);};}exports[_0xe49b('0x26')]=function(_0x2519d3,_0x424b99){var _0x30c9f4={'raw':!![],'where':{'id':_0x2519d3[_0xe49b('0x27')]['id']}},_0x303462={};_0x303462[_0xe49b('0x28')]=_[_0xe49b('0x29')](db[_0xe49b('0x2a')][_0xe49b('0x2b')]);_0x303462[_0xe49b('0x2c')]=_[_0xe49b('0x29')](_0x2519d3[_0xe49b('0x2c')]);_0x303462[_0xe49b('0x2d')]=_[_0xe49b('0x2e')](_0x303462['model'],_0x303462[_0xe49b('0x2c')]);_0x30c9f4['attributes']=_[_0xe49b('0x2e')](_0x303462[_0xe49b('0x28')],qs[_0xe49b('0x2f')](_0x2519d3[_0xe49b('0x2c')][_0xe49b('0x2f')]));_0x30c9f4['attributes']=_0x30c9f4[_0xe49b('0x30')]['length']?_0x30c9f4['attributes']:_0x303462[_0xe49b('0x28')];if(_0x2519d3[_0xe49b('0x2c')][_0xe49b('0x31')]){_0x30c9f4[_0xe49b('0x32')]=[{'all':!![]}];}_0x30c9f4=_['merge']({},_0x30c9f4,_0x2519d3['options']);return db[_0xe49b('0x2a')][_0xe49b('0x33')](_0x30c9f4)[_0xe49b('0x21')](handleEntityNotFound(_0x424b99,null))['then'](respondWithResult(_0x424b99,null))[_0xe49b('0x34')](handleError(_0x424b99,null));};exports['update']=function(_0x13003f,_0x5ace73){if(_0x13003f[_0xe49b('0x35')]['id']){delete _0x13003f[_0xe49b('0x35')]['id'];}return db['MailApplication']['find']({'where':{'id':_0x13003f[_0xe49b('0x27')]['id']}})[_0xe49b('0x21')](handleEntityNotFound(_0x5ace73,null))[_0xe49b('0x21')](saveUpdates(_0x13003f['body'],null))['then'](respondWithResult(_0x5ace73,null))[_0xe49b('0x34')](handleError(_0x5ace73,null));};exports[_0xe49b('0x22')]=function(_0x497d64,_0x558a47){return db['MailApplication'][_0xe49b('0x33')]({'where':{'id':_0x497d64[_0xe49b('0x27')]['id']}})[_0xe49b('0x21')](handleEntityNotFound(_0x558a47,null))[_0xe49b('0x21')](removeEntity(_0x558a47,null))[_0xe49b('0x34')](handleError(_0x558a47,null));}; \ No newline at end of file +var _0x6dd1=['util','path','sox','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','MailApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','body','params','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x4057ba,_0x247285){var _0x3ae06=function(_0x2bc6e0){while(--_0x2bc6e0){_0x4057ba['push'](_0x4057ba['shift']());}};_0x3ae06(++_0x247285);}(_0x6dd1,0x111));var _0x16dd=function(_0x2d8b52,_0xc6c06f){_0x2d8b52=_0x2d8b52-0x0;var _0x15dae3=_0x6dd1[_0x2d8b52];return _0x15dae3;};'use strict';var pdf=require(_0x16dd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x16dd('0x1'));var zipdir=require(_0x16dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16dd('0x3'));var moment=require(_0x16dd('0x4'));var BPromise=require(_0x16dd('0x5'));var Mustache=require(_0x16dd('0x6'));var util=require(_0x16dd('0x7'));var path=require(_0x16dd('0x8'));var sox=require(_0x16dd('0x9'));var csv=require(_0x16dd('0xa'));var ejs=require(_0x16dd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x16dd('0xc'));var toCsv=require(_0x16dd('0xa'));var querystring=require(_0x16dd('0xd'));var Papa=require(_0x16dd('0xe'));var Redis=require('ioredis');var authService=require(_0x16dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x16dd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16dd('0x11'));var utils=require(_0x16dd('0x12'));var config=require('../../config/environment');var db=require(_0x16dd('0x13'))['db'];function respondWithStatusCode(_0x3a4916,_0x2b1de0){_0x2b1de0=_0x2b1de0||0xcc;return function(_0x5e24c8){if(_0x5e24c8){return _0x3a4916[_0x16dd('0x14')](_0x2b1de0);}return _0x3a4916[_0x16dd('0x15')](_0x2b1de0)[_0x16dd('0x16')]();};}function respondWithResult(_0x78caa4,_0x475e16){_0x475e16=_0x475e16||0xc8;return function(_0x4d460c){if(_0x4d460c){return _0x78caa4['status'](_0x475e16)[_0x16dd('0x17')](_0x4d460c);}};}function respondWithFilteredResult(_0x5e81b1,_0xb68f62){return function(_0x167c44){if(_0x167c44){var _0x31a026=_0x167c44[_0x16dd('0x18')],_0x1719ba=_0xb68f62[_0x16dd('0x19')],_0x3add51=_0xb68f62['offset']+_0xb68f62[_0x16dd('0x1a')],_0x25817d;if(_0x3add51>=_0x31a026){_0x3add51=_0x31a026;_0x25817d=0xc8;}else{_0x25817d=0xce;}_0x5e81b1[_0x16dd('0x15')](_0x25817d);return _0x5e81b1[_0x16dd('0x1b')](_0x16dd('0x1c'),_0x1719ba+'-'+_0x3add51+'/'+_0x31a026)[_0x16dd('0x17')](_0x167c44);}return null;};}function patchUpdates(_0x59fab3){return function(_0x1dcb48){try{jsonpatch[_0x16dd('0x1d')](_0x1dcb48,_0x59fab3,!![]);}catch(_0x3f36c0){return BPromise[_0x16dd('0x1e')](_0x3f36c0);}return _0x1dcb48[_0x16dd('0x1f')]();};}function saveUpdates(_0x2c0bd8,_0x3ac589){return function(_0x44464a){if(_0x44464a){return _0x44464a[_0x16dd('0x20')](_0x2c0bd8)[_0x16dd('0x21')](function(_0x5e4468){return _0x5e4468;});}return null;};}function removeEntity(_0x33b119,_0x82fb39){return function(_0x44f66b){if(_0x44f66b){return _0x44f66b[_0x16dd('0x22')]()[_0x16dd('0x21')](function(){_0x33b119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4445f8,_0x239e59){return function(_0x4d1f98){if(!_0x4d1f98){_0x4445f8[_0x16dd('0x14')](0x194);}return _0x4d1f98;};}function handleError(_0x1bb0d1,_0x11937c){_0x11937c=_0x11937c||0x1f4;return function(_0x5125fa){logger[_0x16dd('0x23')](_0x5125fa[_0x16dd('0x24')]);if(_0x5125fa[_0x16dd('0x25')]){delete _0x5125fa['name'];}_0x1bb0d1[_0x16dd('0x15')](_0x11937c)[_0x16dd('0x26')](_0x5125fa);};}exports[_0x16dd('0x27')]=function(_0x4a5dba,_0x4c1614){var _0x2dace6={'raw':!![],'where':{'id':_0x4a5dba['params']['id']}},_0x27b809={};_0x27b809['model']=_['keys'](db[_0x16dd('0x28')][_0x16dd('0x29')]);_0x27b809[_0x16dd('0x2a')]=_['keys'](_0x4a5dba[_0x16dd('0x2a')]);_0x27b809[_0x16dd('0x2b')]=_[_0x16dd('0x2c')](_0x27b809[_0x16dd('0x2d')],_0x27b809['query']);_0x2dace6[_0x16dd('0x2e')]=_[_0x16dd('0x2c')](_0x27b809['model'],qs[_0x16dd('0x2f')](_0x4a5dba[_0x16dd('0x2a')]['fields']));_0x2dace6[_0x16dd('0x2e')]=_0x2dace6['attributes'][_0x16dd('0x30')]?_0x2dace6['attributes']:_0x27b809[_0x16dd('0x2d')];if(_0x4a5dba[_0x16dd('0x2a')][_0x16dd('0x31')]){_0x2dace6['include']=[{'all':!![]}];}_0x2dace6=_[_0x16dd('0x32')]({},_0x2dace6,_0x4a5dba[_0x16dd('0x33')]);return db['MailApplication'][_0x16dd('0x34')](_0x2dace6)[_0x16dd('0x21')](handleEntityNotFound(_0x4c1614,null))[_0x16dd('0x21')](respondWithResult(_0x4c1614,null))[_0x16dd('0x35')](handleError(_0x4c1614,null));};exports['update']=function(_0x361f40,_0x101916){if(_0x361f40['body']['id']){delete _0x361f40[_0x16dd('0x36')]['id'];}return db['MailApplication'][_0x16dd('0x34')]({'where':{'id':_0x361f40[_0x16dd('0x37')]['id']}})['then'](handleEntityNotFound(_0x101916,null))['then'](saveUpdates(_0x361f40[_0x16dd('0x36')],null))[_0x16dd('0x21')](respondWithResult(_0x101916,null))[_0x16dd('0x35')](handleError(_0x101916,null));};exports[_0x16dd('0x22')]=function(_0x2134d2,_0x7edb3f){return db[_0x16dd('0x28')][_0x16dd('0x34')]({'where':{'id':_0x2134d2[_0x16dd('0x37')]['id']}})['then'](handleEntityNotFound(_0x7edb3f,null))[_0x16dd('0x21')](removeEntity(_0x7edb3f,null))[_0x16dd('0x35')](handleError(_0x7edb3f,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 94e7080..65aa6b7 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 _0x9bc1=['rimraf','../../config/environment','define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0xad7433,_0x328655){var _0x113410=function(_0x2ee73d){while(--_0x2ee73d){_0xad7433['push'](_0xad7433['shift']());}};_0x113410(++_0x328655);}(_0x9bc1,0x74));var _0x19bc=function(_0x2b2e44,_0x36b38a){_0x2b2e44=_0x2b2e44-0x0;var _0x2d0b45=_0x9bc1[_0x2b2e44];return _0x2d0b45;};'use strict';var _=require('lodash');var util=require(_0x19bc('0x0'));var logger=require(_0x19bc('0x1'))(_0x19bc('0x2'));var moment=require(_0x19bc('0x3'));var BPromise=require(_0x19bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x19bc('0x5'));var config=require(_0x19bc('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x2c4785,_0x1669c9){return _0x2c4785[_0x19bc('0x7')](_0x19bc('0x8'),attributes,{'tableName':_0x19bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x19bc('0xa')});}; \ No newline at end of file +var _0x14c4=['rimraf','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x14c4,0x1f0));var _0x414c=function(_0x24403d,_0x94ebf1){_0x24403d=_0x24403d-0x0;var _0x3fabf3=_0x14c4[_0x24403d];return _0x3fabf3;};'use strict';var _=require('lodash');var util=require(_0x414c('0x0'));var logger=require(_0x414c('0x1'))('api');var moment=require(_0x414c('0x2'));var BPromise=require(_0x414c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x414c('0x4'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x414c('0x5')]=function(_0x506bd7,_0x48e95f){return _0x506bd7['define'](_0x414c('0x6'),attributes,{'tableName':_0x414c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x414c('0x8'),'collate':_0x414c('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 07655a3..70d93ca 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 _0x10c5=['client','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','update','options','raw','attributes','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x45a044,_0x538a43){var _0x223939=function(_0x528451){while(--_0x528451){_0x45a044['push'](_0x45a044['shift']());}};_0x223939(++_0x538a43);}(_0x10c5,0x104));var _0x510c=function(_0x3c8dfc,_0x34f4df){_0x3c8dfc=_0x3c8dfc-0x0;var _0x17609d=_0x10c5[_0x3c8dfc];return _0x17609d;};'use strict';var _=require('lodash');var util=require(_0x510c('0x0'));var moment=require(_0x510c('0x1'));var BPromise=require('bluebird');var rs=require(_0x510c('0x2'));var fs=require('fs');var Redis=require(_0x510c('0x3'));var db=require(_0x510c('0x4'))['db'];var utils=require(_0x510c('0x5'));var logger=require(_0x510c('0x6'))(_0x510c('0x7'));var config=require(_0x510c('0x8'));var jayson=require(_0x510c('0x9'));var client=jayson[_0x510c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3891a8,_0x1afb89,_0x36ac3d){return new BPromise(function(_0x5c8fc3,_0x32f4f5){return client[_0x510c('0xb')](_0x3891a8,_0x36ac3d)['then'](function(_0x105bc2){logger[_0x510c('0xc')](_0x510c('0xd'),_0x1afb89,_0x510c('0xe'));logger[_0x510c('0xf')](_0x510c('0x10'),_0x1afb89,_0x510c('0xe'),JSON[_0x510c('0x11')](_0x105bc2));if(_0x105bc2[_0x510c('0x12')]){if(_0x105bc2[_0x510c('0x12')][_0x510c('0x13')]===0x1f4){logger['error'](_0x510c('0xd'),_0x1afb89,_0x105bc2[_0x510c('0x12')][_0x510c('0x14')]);return _0x32f4f5(_0x105bc2[_0x510c('0x12')][_0x510c('0x14')]);}logger[_0x510c('0x12')](_0x510c('0xd'),_0x1afb89,_0x105bc2[_0x510c('0x12')][_0x510c('0x14')]);return _0x5c8fc3(_0x105bc2['error'][_0x510c('0x14')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x1afb89,_0x510c('0xe'));_0x5c8fc3(_0x105bc2['result'][_0x510c('0x14')]);}})[_0x510c('0x15')](function(_0x49e93f){logger[_0x510c('0x12')](_0x510c('0xd'),_0x1afb89,_0x49e93f);_0x32f4f5(_0x49e93f);});});}exports['UpdateMailApplication']=function(_0x3c9819){var _0x3e197a=this;return new Promise(function(_0x2a66c9,_0x4cf371){return db['MailApplication'][_0x510c('0x16')](_0x3c9819['body'],{'raw':_0x3c9819[_0x510c('0x17')]?_0x3c9819[_0x510c('0x17')][_0x510c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c9819['options']?_0x3c9819[_0x510c('0x17')]['where']||null:null,'attributes':_0x3c9819[_0x510c('0x17')]?_0x3c9819['options'][_0x510c('0x19')]||null:null,'limit':_0x3c9819[_0x510c('0x17')]?_0x3c9819[_0x510c('0x17')]['limit']||null:null})[_0x510c('0x1a')](function(_0x271ffd){logger[_0x510c('0xc')]('UpdateMailApplication',_0x3c9819);logger['debug']('UpdateMailApplication',_0x3c9819,JSON[_0x510c('0x11')](_0x271ffd));_0x2a66c9(_0x271ffd);})[_0x510c('0x15')](function(_0x33cefc){logger[_0x510c('0x12')]('UpdateMailApplication',_0x33cefc['message'],_0x3c9819);_0x4cf371(_0x3e197a[_0x510c('0x12')](0x1f4,_0x33cefc[_0x510c('0x14')]));});});}; \ No newline at end of file +var _0x8dd0=['error','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x224a9a,_0x374004){var _0x2455cc=function(_0x54b78d){while(--_0x54b78d){_0x224a9a['push'](_0x224a9a['shift']());}};_0x2455cc(++_0x374004);}(_0x8dd0,0x6a));var _0x08dd=function(_0x43d723,_0x1c7fa5){_0x43d723=_0x43d723-0x0;var _0x5af076=_0x8dd0[_0x43d723];return _0x5af076;};'use strict';var _=require(_0x08dd('0x0'));var util=require('util');var moment=require(_0x08dd('0x1'));var BPromise=require(_0x08dd('0x2'));var rs=require(_0x08dd('0x3'));var fs=require('fs');var Redis=require(_0x08dd('0x4'));var db=require(_0x08dd('0x5'))['db'];var utils=require(_0x08dd('0x6'));var logger=require(_0x08dd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x08dd('0x8')][_0x08dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca965e,_0xde54a,_0x2d7748){return new BPromise(function(_0x1c5626,_0x5a6fdd){return client[_0x08dd('0xa')](_0xca965e,_0x2d7748)[_0x08dd('0xb')](function(_0x34e4c7){logger[_0x08dd('0xc')]('MailApplication,\x20%s,\x20%s',_0xde54a,_0x08dd('0xd'));logger[_0x08dd('0xe')](_0x08dd('0xf'),_0xde54a,_0x08dd('0xd'),JSON[_0x08dd('0x10')](_0x34e4c7));if(_0x34e4c7['error']){if(_0x34e4c7['error'][_0x08dd('0x11')]===0x1f4){logger[_0x08dd('0x12')](_0x08dd('0x13'),_0xde54a,_0x34e4c7[_0x08dd('0x12')][_0x08dd('0x14')]);return _0x5a6fdd(_0x34e4c7[_0x08dd('0x12')][_0x08dd('0x14')]);}logger['error'](_0x08dd('0x13'),_0xde54a,_0x34e4c7[_0x08dd('0x12')][_0x08dd('0x14')]);return _0x1c5626(_0x34e4c7[_0x08dd('0x12')][_0x08dd('0x14')]);}else{logger[_0x08dd('0xc')](_0x08dd('0x13'),_0xde54a,'request\x20sent');_0x1c5626(_0x34e4c7[_0x08dd('0x15')][_0x08dd('0x14')]);}})[_0x08dd('0x16')](function(_0x460544){logger[_0x08dd('0x12')](_0x08dd('0x13'),_0xde54a,_0x460544);_0x5a6fdd(_0x460544);});});}exports[_0x08dd('0x17')]=function(_0x177c36){var _0xcfef5f=this;return new Promise(function(_0x44ad0a,_0x2cdd12){return db[_0x08dd('0x18')][_0x08dd('0x19')](_0x177c36[_0x08dd('0x1a')],{'raw':_0x177c36['options']?_0x177c36[_0x08dd('0x1b')][_0x08dd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x177c36[_0x08dd('0x1b')]?_0x177c36[_0x08dd('0x1b')][_0x08dd('0x1d')]||null:null,'attributes':_0x177c36['options']?_0x177c36[_0x08dd('0x1b')]['attributes']||null:null,'limit':_0x177c36[_0x08dd('0x1b')]?_0x177c36[_0x08dd('0x1b')][_0x08dd('0x1e')]||null:null})[_0x08dd('0xb')](function(_0x5bc5a0){logger[_0x08dd('0xc')](_0x08dd('0x17'),_0x177c36);logger['debug'](_0x08dd('0x17'),_0x177c36,JSON[_0x08dd('0x10')](_0x5bc5a0));_0x44ad0a(_0x5bc5a0);})[_0x08dd('0x16')](function(_0x4c45c0){logger['error'](_0x08dd('0x17'),_0x4c45c0['message'],_0x177c36);_0x2cdd12(_0xcfef5f[_0x08dd('0x12')](0x1f4,_0x4c45c0[_0x08dd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e3c872b..148b10a 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 _0xeb76=['/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','/describe','describe','/:id','isAuthenticated','show'];(function(_0x27992c,_0x1ad209){var _0x5a77e5=function(_0x183abb){while(--_0x183abb){_0x27992c['push'](_0x27992c['shift']());}};_0x5a77e5(++_0x1ad209);}(_0xeb76,0x171));var _0x6eb7=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xeb76[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x6eb7('0x0'));var util=require(_0x6eb7('0x1'));var path=require(_0x6eb7('0x2'));var timeout=require(_0x6eb7('0x3'));var express=require('express');var router=express[_0x6eb7('0x4')]();var auth=require(_0x6eb7('0x5'));var interaction=require(_0x6eb7('0x6'));var config=require(_0x6eb7('0x7'));var controller=require(_0x6eb7('0x8'));router[_0x6eb7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6eb7('0x9')](_0x6eb7('0xa'),auth['isAuthenticated'](),controller[_0x6eb7('0xb')]);router[_0x6eb7('0x9')](_0x6eb7('0xc'),auth[_0x6eb7('0xd')](),controller[_0x6eb7('0xe')]);router[_0x6eb7('0x9')](_0x6eb7('0xf'),auth[_0x6eb7('0xd')](),controller[_0x6eb7('0x10')]);router[_0x6eb7('0x9')](_0x6eb7('0x11'),auth[_0x6eb7('0xd')](),controller['download']);router[_0x6eb7('0x12')]('/',auth['isAuthenticated'](),controller[_0x6eb7('0x13')]);router['post'](_0x6eb7('0xf'),auth[_0x6eb7('0xd')](),controller[_0x6eb7('0x14')]);router[_0x6eb7('0x12')](_0x6eb7('0x15'),auth[_0x6eb7('0xd')](),interaction[_0x6eb7('0x16')](_0x6eb7('0x17'),_0x6eb7('0x18')),controller[_0x6eb7('0x19')]);router[_0x6eb7('0x1a')](_0x6eb7('0xc'),auth[_0x6eb7('0xd')](),interaction['tracked'](_0x6eb7('0x17'),_0x6eb7('0x1b')),controller['update']);router[_0x6eb7('0x1c')]('/:id',auth['isAuthenticated'](),interaction[_0x6eb7('0x16')](_0x6eb7('0x17'),_0x6eb7('0x1d')),controller[_0x6eb7('0x1e')]);router['delete']('/:id/tags',auth[_0x6eb7('0xd')](),controller['removeTags']);module[_0x6eb7('0x1f')]=router; \ No newline at end of file +var _0xbcba=['/:id/tags','tracked','mail','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id/messages','getMessages','/:id/download','download','post','create','addMessage'];(function(_0x43cdc3,_0x9ccb13){var _0x2936bd=function(_0x3a6b1b){while(--_0x3a6b1b){_0x43cdc3['push'](_0x43cdc3['shift']());}};_0x2936bd(++_0x9ccb13);}(_0xbcba,0x6d));var _0xabcb=function(_0x4aad0d,_0x4d0202){_0x4aad0d=_0x4aad0d-0x0;var _0x43c2ba=_0xbcba[_0x4aad0d];return _0x43c2ba;};'use strict';var multer=require(_0xabcb('0x0'));var util=require(_0xabcb('0x1'));var path=require('path');var timeout=require(_0xabcb('0x2'));var express=require(_0xabcb('0x3'));var router=express[_0xabcb('0x4')]();var auth=require(_0xabcb('0x5'));var interaction=require(_0xabcb('0x6'));var config=require(_0xabcb('0x7'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0xabcb('0x8')](),controller[_0xabcb('0x9')]);router['get']('/describe',auth[_0xabcb('0x8')](),controller[_0xabcb('0xa')]);router['get']('/:id',auth[_0xabcb('0x8')](),controller['show']);router[_0xabcb('0xb')](_0xabcb('0xc'),auth[_0xabcb('0x8')](),controller[_0xabcb('0xd')]);router['get'](_0xabcb('0xe'),auth[_0xabcb('0x8')](),controller[_0xabcb('0xf')]);router[_0xabcb('0x10')]('/',auth[_0xabcb('0x8')](),controller[_0xabcb('0x11')]);router[_0xabcb('0x10')](_0xabcb('0xc'),auth['isAuthenticated'](),controller[_0xabcb('0x12')]);router[_0xabcb('0x10')](_0xabcb('0x13'),auth[_0xabcb('0x8')](),interaction[_0xabcb('0x14')](_0xabcb('0x15'),'mailinteraction:addtags'),controller[_0xabcb('0x16')]);router[_0xabcb('0x17')](_0xabcb('0x18'),auth[_0xabcb('0x8')](),interaction[_0xabcb('0x14')](_0xabcb('0x15'),_0xabcb('0x19')),controller[_0xabcb('0x1a')]);router[_0xabcb('0x1b')](_0xabcb('0x18'),auth['isAuthenticated'](),interaction[_0xabcb('0x14')](_0xabcb('0x15'),_0xabcb('0x1c')),controller[_0xabcb('0x1d')]);router[_0xabcb('0x1b')](_0xabcb('0x13'),auth[_0xabcb('0x8')](),controller[_0xabcb('0x1e')]);module[_0xabcb('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 6f4f2b5..44e41dc 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 _0x6677=['DATE','ENUM','out','iconv','BOOLEAN','STRING','TEXT','long'];(function(_0x28b1ff,_0x26a0aa){var _0x431f5d=function(_0x4b940e){while(--_0x4b940e){_0x28b1ff['push'](_0x28b1ff['shift']());}};_0x431f5d(++_0x26a0aa);}(_0x6677,0x93));var _0x7667=function(_0x1af0f4,_0x3a993f){_0x1af0f4=_0x1af0f4-0x0;var _0xc8ed09=_0x6677[_0x1af0f4];return _0xc8ed09;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x7667('0x0'));module['exports']={'closed':{'type':Sequelize[_0x7667('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7667('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7667('0x2')](0x1fe)},'to':{'type':Sequelize[_0x7667('0x2')]},'cc':{'type':Sequelize[_0x7667('0x3')](_0x7667('0x4'))},'subject':{'type':Sequelize[_0x7667('0x3')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7667('0x5')]},'substatus':{'type':Sequelize[_0x7667('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x7667('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x7667('0x6')]('in',_0x7667('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7667('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7667('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x7667('0x3')](_0x7667('0x4'))},'lastMsgText':{'type':Sequelize[_0x7667('0x3')](_0x7667('0x4'))}}; \ No newline at end of file +var _0x090d=['exports','BOOLEAN','DATE','STRING','TEXT','out','ENUM','long','sequelize','iconv'];(function(_0x535c2b,_0x13368b){var _0x347f9d=function(_0x1c3b4d){while(--_0x1c3b4d){_0x535c2b['push'](_0x535c2b['shift']());}};_0x347f9d(++_0x13368b);}(_0x090d,0xda));var _0xd090=function(_0x99a090,_0x94cf0a){_0x99a090=_0x99a090-0x0;var _0x13166b=_0x090d[_0x99a090];return _0x13166b;};'use strict';var Sequelize=require(_0xd090('0x0'));var iconv=require(_0xd090('0x1'));module[_0xd090('0x2')]={'closed':{'type':Sequelize[_0xd090('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd090('0x4')]},'disposition':{'type':Sequelize[_0xd090('0x5')]},'note':{'type':Sequelize[_0xd090('0x5')]},'inReplyTo':{'type':Sequelize[_0xd090('0x5')](0x1fe)},'to':{'type':Sequelize[_0xd090('0x5')]},'cc':{'type':Sequelize[_0xd090('0x6')]('long')},'subject':{'type':Sequelize[_0xd090('0x6')]()},'attach':{'type':Sequelize[_0xd090('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd090('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xd090('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd090('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd090('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd090('0x8')]('in',_0xd090('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd090('0x6')]('long')},'lastMsgText':{'type':Sequelize[_0xd090('0x6')](_0xd090('0x9'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 6ffcea8..b3a78fb 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x1cbb2f,_0xad3edb){var _0x44215c=function(_0x694281){while(--_0x694281){_0x1cbb2f['push'](_0x1cbb2f['shift']());}};_0x44215c(++_0xad3edb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x27a478,_0x1113bc){var _0xb9c7e2=function(_0x3be5b5){while(--_0x3be5b5){_0x27a478['push'](_0x27a478['shift']());}};_0xb9c7e2(++_0x1113bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index de149fb..25199e5 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 _0x17ef=['map','findAll','unreadMessages','length','emit','catch','events','../../mysqldb','MailMessage','setMaxListeners','update','getUsers','then','setDataValue','Users'];(function(_0x345631,_0xd88694){var _0x317713=function(_0x5d6afb){while(--_0x5d6afb){_0x345631['push'](_0x345631['shift']());}};_0x317713(++_0xd88694);}(_0x17ef,0x15f));var _0xf17e=function(_0x32858e,_0x47aaee){_0x32858e=_0x32858e-0x0;var _0x15c720=_0x17ef[_0x32858e];return _0x15c720;};'use strict';var EventEmitter=require(_0xf17e('0x0'));var MailInteraction=require(_0xf17e('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xf17e('0x1'))['db'][_0xf17e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf17e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf17e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b0efe){return function(_0x2f23a9,_0x3729a6,_0x5dbb66){_0x2f23a9[_0xf17e('0x5')]({'attributes':['id'],'raw':!![]})[_0xf17e('0x6')](function(_0x369c4e){_0x2f23a9[_0xf17e('0x7')](_0xf17e('0x8'),_0x369c4e[_0xf17e('0x9')](function(_0xe3b682){return{'id':_0xe3b682['id']};}));return MailMessage[_0xf17e('0xa')]({'where':{'MailInteractionId':_0x2f23a9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf17e('0x6')](function(_0x396446){_0x2f23a9['setDataValue'](_0xf17e('0xb'),_0x396446[_0xf17e('0xc')]);MailInteractionEvents[_0xf17e('0xd')](_0x3b0efe+':'+_0x2f23a9['id'],_0x2f23a9);MailInteractionEvents[_0xf17e('0xd')](_0x3b0efe,_0x2f23a9);_0x5dbb66(null);})[_0xf17e('0xe')](_0x5dbb66(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xf1ef=['remove','getUsers','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','MailInteraction','MailMessage','save','update'];(function(_0x4c645d,_0x48d0a1){var _0x1a0fb0=function(_0x563f2a){while(--_0x563f2a){_0x4c645d['push'](_0x4c645d['shift']());}};_0x1a0fb0(++_0x48d0a1);}(_0xf1ef,0x171));var _0xff1e=function(_0x17eab3,_0x45e1e8){_0x17eab3=_0x17eab3-0x0;var _0x390e4c=_0xf1ef[_0x17eab3];return _0x390e4c;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xff1e('0x0'))['db'][_0xff1e('0x1')];var MailMessage=require(_0xff1e('0x0'))['db'][_0xff1e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xff1e('0x3'),'afterUpdate':_0xff1e('0x4'),'afterDestroy':_0xff1e('0x5')};function emitEvent(_0x18381f){return function(_0x2788f0,_0x37164f,_0x234703){_0x2788f0[_0xff1e('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x28062b){_0x2788f0['setDataValue'](_0xff1e('0x7'),_0x28062b[_0xff1e('0x8')](function(_0x16c160){return{'id':_0x16c160['id']};}));return MailMessage[_0xff1e('0x9')]({'where':{'MailInteractionId':_0x2788f0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x528532){_0x2788f0[_0xff1e('0xa')](_0xff1e('0xb'),_0x528532[_0xff1e('0xc')]);MailInteractionEvents[_0xff1e('0xd')](_0x18381f+':'+_0x2788f0['id'],_0x2788f0);MailInteractionEvents[_0xff1e('0xd')](_0x18381f,_0x2788f0);_0x234703(null);})[_0xff1e('0xe')](_0x234703(null));};}for(var e in events){if(events[_0xff1e('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xff1e('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 2692037..1c02288 100644 --- a/server/api/mailInteraction/mailInteraction.model.js +++ b/server/api/mailInteraction/mailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['api','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','lodash','util','../../config/logger'];(function(_0x461d7b,_0x5a6003){var _0x40aff1=function(_0x4d2ee3){while(--_0x4d2ee3){_0x461d7b['push'](_0x461d7b['shift']());}};_0x40aff1(++_0x5a6003);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa2e5f0,_0x3116fb,_0x18c8a3){if(_0xa2e5f0[_0x7995('0xe')]){_0xa2e5f0[_0x7995('0xf')]=moment()[_0x7995('0x10')](_0x7995('0x11'));}if(_0xa2e5f0['closed']){_0xa2e5f0[_0x7995('0x12')]=moment()[_0x7995('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18c8a3(null,_0x3116fb);},'beforeUpdate':function(_0xb0c872,_0x2cb37a,_0x19a27e){if(_0xb0c872[_0x7995('0x13')](_0x7995('0xe'))){_0xb0c872[_0x7995('0xf')]=_0xb0c872[_0x7995('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xb0c872[_0x7995('0x13')](_0x7995('0x14'))){_0xb0c872[_0x7995('0x12')]=moment()[_0x7995('0x10')](_0x7995('0x11'));_0xb0c872[_0x7995('0xe')]=null;_0xb0c872[_0x7995('0xf')]=null;}_0x19a27e(null,_0xb0c872);},'afterUpdate':function(_0x41cbf0,_0x5377e5,_0x2eeacc){var _0x565d97=_0x137b6b[_0x7995('0x15')];var _0x37f297=_0x41cbf0[_0x7995('0x16')]({'plain':!![]});if(_0x37f297[_0x7995('0x14')]){return _0x565d97[_0x7995('0x17')][_0x7995('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x37f297['id']}})['then'](function(){_0x2eeacc();})['catch'](function(_0x2536c8){_0x2eeacc(_0x2536c8);});}else{_0x2eeacc();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9957=['api','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','lodash','util','../../config/logger'];(function(_0x1b0ac7,_0x1a757c){var _0x12841e=function(_0x355299){while(--_0x355299){_0x1b0ac7['push'](_0x1b0ac7['shift']());}};_0x12841e(++_0x1a757c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa2e5f0,_0x3116fb,_0x18c8a3){if(_0xa2e5f0[_0x7995('0xe')]){_0xa2e5f0[_0x7995('0xf')]=moment()[_0x7995('0x10')](_0x7995('0x11'));}if(_0xa2e5f0['closed']){_0xa2e5f0[_0x7995('0x12')]=moment()[_0x7995('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18c8a3(null,_0x3116fb);},'beforeUpdate':function(_0xb0c872,_0x2cb37a,_0x19a27e){if(_0xb0c872[_0x7995('0x13')](_0x7995('0xe'))){_0xb0c872[_0x7995('0xf')]=_0xb0c872[_0x7995('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xb0c872[_0x7995('0x13')](_0x7995('0x14'))){_0xb0c872[_0x7995('0x12')]=moment()[_0x7995('0x10')](_0x7995('0x11'));_0xb0c872[_0x7995('0xe')]=null;_0xb0c872[_0x7995('0xf')]=null;}_0x19a27e(null,_0xb0c872);},'afterUpdate':function(_0x41cbf0,_0x5377e5,_0x2eeacc){var _0x565d97=_0x137b6b[_0x7995('0x15')];var _0x37f297=_0x41cbf0[_0x7995('0x16')]({'plain':!![]});if(_0x37f297[_0x7995('0x14')]){return _0x565d97[_0x7995('0x17')][_0x7995('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x37f297['id']}})['then'](function(){_0x2eeacc();})['catch'](function(_0x2536c8){_0x2eeacc(_0x2536c8);});}else{_0x2eeacc();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 187a39f..8bd544c 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 _0xc36d=['AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','update','body','options','where','attributes','limit','MailInteraction','find','addTags','omit','ids','info'];(function(_0x56ebf3,_0x9d4baa){var _0x2cc060=function(_0x5e47a9){while(--_0x5e47a9){_0x56ebf3['push'](_0x56ebf3['shift']());}};_0x2cc060(++_0x9d4baa);}(_0xc36d,0x7d));var _0xdc36=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0xc36d[_0x27530d];return _0x59e561;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var moment=require(_0xdc36('0x2'));var BPromise=require(_0xdc36('0x3'));var rs=require(_0xdc36('0x4'));var fs=require('fs');var Redis=require(_0xdc36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc36('0x6'));var logger=require(_0xdc36('0x7'))('rpc');var config=require(_0xdc36('0x8'));var jayson=require(_0xdc36('0x9'));var client=jayson[_0xdc36('0xa')][_0xdc36('0xb')]({'port':0x232a});config[_0xdc36('0xc')]=_['defaults'](config[_0xdc36('0xc')],{'host':_0xdc36('0xd'),'port':0x18eb});var socket=require(_0xdc36('0xe'))(new Redis(config[_0xdc36('0xc')]));require('./mailInteraction.socket')[_0xdc36('0xf')](socket);function respondWithRpcPromise(_0x23956b,_0x573f8e,_0x1d0035){return new BPromise(function(_0x1cb73d,_0x2483bd){return client['request'](_0x23956b,_0x1d0035)[_0xdc36('0x10')](function(_0x18707d){logger['info']('MailInteraction,\x20%s,\x20%s',_0x573f8e,_0xdc36('0x11'));logger[_0xdc36('0x12')](_0xdc36('0x13'),_0x573f8e,_0xdc36('0x11'),JSON['stringify'](_0x18707d));if(_0x18707d[_0xdc36('0x14')]){if(_0x18707d[_0xdc36('0x14')][_0xdc36('0x15')]===0x1f4){logger[_0xdc36('0x14')](_0xdc36('0x16'),_0x573f8e,_0x18707d[_0xdc36('0x14')][_0xdc36('0x17')]);return _0x2483bd(_0x18707d[_0xdc36('0x14')]['message']);}logger[_0xdc36('0x14')]('MailInteraction,\x20%s,\x20%s',_0x573f8e,_0x18707d['error']['message']);return _0x1cb73d(_0x18707d[_0xdc36('0x14')][_0xdc36('0x17')]);}else{logger['info'](_0xdc36('0x16'),_0x573f8e,_0xdc36('0x11'));_0x1cb73d(_0x18707d[_0xdc36('0x18')][_0xdc36('0x17')]);}})[_0xdc36('0x19')](function(_0x46783d){logger['error'](_0xdc36('0x16'),_0x573f8e,_0x46783d);_0x2483bd(_0x46783d);});});}exports[_0xdc36('0x1a')]=function(_0x58eefb){var _0x414953=this;return new Promise(function(_0x197924,_0x3f25f0){return db['MailInteraction'][_0xdc36('0x1b')](_0x58eefb[_0xdc36('0x1c')],{'raw':_0x58eefb['options']?_0x58eefb[_0xdc36('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58eefb['options']?_0x58eefb[_0xdc36('0x1d')][_0xdc36('0x1e')]||null:null,'attributes':_0x58eefb[_0xdc36('0x1d')]?_0x58eefb[_0xdc36('0x1d')][_0xdc36('0x1f')]||null:null,'limit':_0x58eefb[_0xdc36('0x1d')]?_0x58eefb[_0xdc36('0x1d')][_0xdc36('0x20')]||null:null})['then'](function(_0x34057e){logger['info'](_0xdc36('0x1a'),_0x58eefb);logger[_0xdc36('0x12')](_0xdc36('0x1a'),_0x58eefb,JSON['stringify'](_0x34057e));_0x197924(_0x34057e);})[_0xdc36('0x19')](function(_0x6e3906){logger[_0xdc36('0x14')]('UpdateMailInteraction',_0x6e3906[_0xdc36('0x17')],_0x58eefb);_0x3f25f0(_0x414953[_0xdc36('0x14')](0x1f4,_0x6e3906[_0xdc36('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x3c39e3){return new Promise(function(_0x2dcef7,_0x4b15b4){return db[_0xdc36('0x21')][_0xdc36('0x22')]({'where':_0x3c39e3['options']?_0x3c39e3[_0xdc36('0x1d')]['where']||null:null})['then'](function(_0x57785d){if(_0x57785d){return _0x57785d[_0xdc36('0x23')](_0x3c39e3[_0xdc36('0x1c')]['ids'],_[_0xdc36('0x24')](_0x3c39e3[_0xdc36('0x1c')],[_0xdc36('0x25'),'id'])||{});}})['spread'](function(_0x2a4451){logger[_0xdc36('0x26')](_0xdc36('0x27'),_0x3c39e3);logger[_0xdc36('0x12')](_0xdc36('0x27'),_0x3c39e3,JSON[_0xdc36('0x28')](_0x2a4451));_0x2dcef7(_0x2a4451);})[_0xdc36('0x19')](function(_0x54eb86){logger[_0xdc36('0x14')](_0xdc36('0x27'),_0x54eb86['message'],_0x3c39e3);_0x4b15b4(_this['error'](0x1f4,_0x54eb86[_0xdc36('0x17')]));});});}; \ No newline at end of file +var _0xc577=['attributes','limit','then','stringify','AddTagsToMailInteraction','where','addTags','omit','ids','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options'];(function(_0x5e3115,_0x540600){var _0x5a1dc6=function(_0x1163f5){while(--_0x1163f5){_0x5e3115['push'](_0x5e3115['shift']());}};_0x5a1dc6(++_0x540600);}(_0xc577,0x172));var _0x7c57=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xc577[_0xa30766];return _0x24e780;};'use strict';var _=require(_0x7c57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c57('0x1'));var rs=require(_0x7c57('0x2'));var fs=require('fs');var Redis=require(_0x7c57('0x3'));var db=require(_0x7c57('0x4'))['db'];var utils=require(_0x7c57('0x5'));var logger=require(_0x7c57('0x6'))(_0x7c57('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c57('0x8'));var client=jayson[_0x7c57('0x9')][_0x7c57('0xa')]({'port':0x232a});config[_0x7c57('0xb')]=_[_0x7c57('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c57('0xb')]));require('./mailInteraction.socket')[_0x7c57('0xd')](socket);function respondWithRpcPromise(_0x2e63cc,_0x11dd41,_0x3665f9){return new BPromise(function(_0x4f8f51,_0x1e4a96){return client[_0x7c57('0xe')](_0x2e63cc,_0x3665f9)['then'](function(_0x20aae1){logger[_0x7c57('0xf')](_0x7c57('0x10'),_0x11dd41,_0x7c57('0x11'));logger[_0x7c57('0x12')](_0x7c57('0x13'),_0x11dd41,_0x7c57('0x11'),JSON['stringify'](_0x20aae1));if(_0x20aae1['error']){if(_0x20aae1['error'][_0x7c57('0x14')]===0x1f4){logger[_0x7c57('0x15')](_0x7c57('0x10'),_0x11dd41,_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);return _0x1e4a96(_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);}logger[_0x7c57('0x15')]('MailInteraction,\x20%s,\x20%s',_0x11dd41,_0x20aae1['error'][_0x7c57('0x16')]);return _0x4f8f51(_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);}else{logger[_0x7c57('0xf')](_0x7c57('0x10'),_0x11dd41,'request\x20sent');_0x4f8f51(_0x20aae1[_0x7c57('0x17')][_0x7c57('0x16')]);}})[_0x7c57('0x18')](function(_0x87617b){logger[_0x7c57('0x15')](_0x7c57('0x10'),_0x11dd41,_0x87617b);_0x1e4a96(_0x87617b);});});}exports[_0x7c57('0x19')]=function(_0x3a6dce){var _0x2ace9d=this;return new Promise(function(_0x5488b7,_0x45221e){return db[_0x7c57('0x1a')][_0x7c57('0x1b')](_0x3a6dce[_0x7c57('0x1c')],{'raw':_0x3a6dce['options']?_0x3a6dce['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a6dce[_0x7c57('0x1d')]?_0x3a6dce[_0x7c57('0x1d')]['where']||null:null,'attributes':_0x3a6dce[_0x7c57('0x1d')]?_0x3a6dce[_0x7c57('0x1d')][_0x7c57('0x1e')]||null:null,'limit':_0x3a6dce[_0x7c57('0x1d')]?_0x3a6dce[_0x7c57('0x1d')][_0x7c57('0x1f')]||null:null})[_0x7c57('0x20')](function(_0x56fd57){logger[_0x7c57('0xf')](_0x7c57('0x19'),_0x3a6dce);logger[_0x7c57('0x12')](_0x7c57('0x19'),_0x3a6dce,JSON[_0x7c57('0x21')](_0x56fd57));_0x5488b7(_0x56fd57);})[_0x7c57('0x18')](function(_0x41125b){logger[_0x7c57('0x15')](_0x7c57('0x19'),_0x41125b['message'],_0x3a6dce);_0x45221e(_0x2ace9d['error'](0x1f4,_0x41125b[_0x7c57('0x16')]));});});};exports[_0x7c57('0x22')]=function(_0x327575){return new Promise(function(_0x54b294,_0x9b9d1f){return db['MailInteraction']['find']({'where':_0x327575['options']?_0x327575[_0x7c57('0x1d')][_0x7c57('0x23')]||null:null})['then'](function(_0x423434){if(_0x423434){return _0x423434[_0x7c57('0x24')](_0x327575[_0x7c57('0x1c')]['ids'],_[_0x7c57('0x25')](_0x327575[_0x7c57('0x1c')],[_0x7c57('0x26'),'id'])||{});}})['spread'](function(_0x408860){logger[_0x7c57('0xf')](_0x7c57('0x27'),_0x327575);logger[_0x7c57('0x12')](_0x7c57('0x27'),_0x327575,JSON[_0x7c57('0x21')](_0x408860));_0x54b294(_0x408860);})[_0x7c57('0x18')](function(_0x299d22){logger[_0x7c57('0x15')](_0x7c57('0x27'),_0x299d22['message'],_0x327575);_0x9b9d1f(_this[_0x7c57('0x15')](0x1f4,_0x299d22[_0x7c57('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 3d54b46..6abadd7 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 _0x34c9=['register','length','remove','update','emit','removeListener'];(function(_0x39a14e,_0x42990e){var _0x5030b8=function(_0x578e0d){while(--_0x578e0d){_0x39a14e['push'](_0x39a14e['shift']());}};_0x5030b8(++_0x42990e);}(_0x34c9,0x92));var _0x934c=function(_0x4af250,_0x4b41cf){_0x4af250=_0x4af250-0x0;var _0xf68a14=_0x34c9[_0x4af250];return _0xf68a14;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x934c('0x0'),_0x934c('0x1')];function createListener(_0x457471,_0x290854){return function(_0x1a9654){_0x290854[_0x934c('0x2')](_0x457471,_0x1a9654);};}function removeListener(_0x1efed5,_0x81db15){return function(){MailInteractionEvents[_0x934c('0x3')](_0x1efed5,_0x81db15);};}exports[_0x934c('0x4')]=function(_0x5577d3){for(var _0x181a2e=0x0,_0x4e6187=events[_0x934c('0x5')];_0x181a2e<_0x4e6187;_0x181a2e++){var _0x3b4cf7=events[_0x181a2e];var _0x3944c6=createListener('mailInteraction:'+_0x3b4cf7,_0x5577d3);MailInteractionEvents['on'](_0x3b4cf7,_0x3944c6);}}; \ No newline at end of file +var _0xd1da=['./mailInteraction.events','save','remove','removeListener','register','length','mailInteraction:'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xd1da,0xe0));var _0xad1d=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xd1da[_0x251d9c];return _0x16ae64;};'use strict';var MailInteractionEvents=require(_0xad1d('0x0'));var events=[_0xad1d('0x1'),_0xad1d('0x2'),'update'];function createListener(_0x36200b,_0x46b231){return function(_0xfafb91){_0x46b231['emit'](_0x36200b,_0xfafb91);};}function removeListener(_0x4cee3a,_0x2589bb){return function(){MailInteractionEvents[_0xad1d('0x3')](_0x4cee3a,_0x2589bb);};}exports[_0xad1d('0x4')]=function(_0x50addc){for(var _0x4800ca=0x0,_0x13a2b2=events[_0xad1d('0x5')];_0x4800ca<_0x13a2b2;_0x4800ca++){var _0xcc74d2=events[_0x4800ca];var _0x57240c=createListener(_0xad1d('0x6')+_0xcc74d2,_0x50addc);MailInteractionEvents['on'](_0xcc74d2,_0x57240c);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ff22756..b2bfd9e 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x98a8,0x12c));var _0x898a=function(_0x359f8a,_0x2e7aad){_0x359f8a=_0x359f8a-0x0;var _0x235d44=_0x98a8[_0x359f8a];return _0x235d44;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file +var _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x98a8,0x12c));var _0x898a=function(_0x5f07df,_0x45339a){_0x5f07df=_0x5f07df-0x0;var _0x121b66=_0x98a8[_0x5f07df];return _0x121b66;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index a568651..8391fba 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 _0xcac2=['INTEGER','BOOLEAN','sequelize','lodash','exports','long','TEXT','out','STRING'];(function(_0x31a261,_0x4635ce){var _0x1a8230=function(_0x57dc81){while(--_0x57dc81){_0x31a261['push'](_0x31a261['shift']());}};_0x1a8230(++_0x4635ce);}(_0xcac2,0x1e8));var _0x2cac=function(_0x1fc584,_0x586a18){_0x1fc584=_0x1fc584-0x0;var _0x27a483=_0xcac2[_0x1fc584];return _0x27a483;};'use strict';var Sequelize=require(_0x2cac('0x0'));var _=require(_0x2cac('0x1'));module[_0x2cac('0x2')]={'body':{'type':Sequelize['TEXT'](_0x2cac('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2cac('0x4')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x2cac('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2cac('0x6')](0x1fe)},'from':{'type':Sequelize[_0x2cac('0x6')]},'to':{'type':Sequelize[_0x2cac('0x4')](_0x2cac('0x3'))},'cc':{'type':Sequelize[_0x2cac('0x4')](_0x2cac('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x2cac('0x4')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x2cac('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2cac('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x2cac('0x3'))},'originCc':{'type':Sequelize[_0x2cac('0x4')]('long')}}; \ No newline at end of file +var _0xc5df=['long','DATE','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x3df209,_0xcd5524){var _0x579787=function(_0x2ff443){while(--_0x2ff443){_0x3df209['push'](_0x3df209['shift']());}};_0x579787(++_0xcd5524);}(_0xc5df,0x80));var _0xfc5d=function(_0x387767,_0x3fc71e){_0x387767=_0x387767-0x0;var _0xb463d2=_0xc5df[_0x387767];return _0xb463d2;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xfc5d('0x0')]={'body':{'type':Sequelize[_0xfc5d('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xfc5d('0x2'))},'read':{'type':Sequelize[_0xfc5d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfc5d('0x4')]('in',_0xfc5d('0x5')),'defaultValue':_0xfc5d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xfc5d('0x6')]},'to':{'type':Sequelize[_0xfc5d('0x1')](_0xfc5d('0x7'))},'cc':{'type':Sequelize[_0xfc5d('0x1')](_0xfc5d('0x7'))},'bcc':{'type':Sequelize[_0xfc5d('0x1')]('long')},'subject':{'type':Sequelize[_0xfc5d('0x1')]},'sentAt':{'type':Sequelize[_0xfc5d('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfc5d('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xfc5d('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xfc5d('0x7'))},'originCc':{'type':Sequelize[_0xfc5d('0x1')](_0xfc5d('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0241959..3eac686 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 _0x572b=['name','filter','options','includeAll','findAll','rows','show','params','include','find','catch','body','describe','create','direction','out','secret','MailAccount','findOne','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','root','basename','defaults','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','readAt','format','UserId','Contact','get','MailInteraction','MailInteractionId','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','info','role','RejectMessage','rejectMessage','event','rejectmessage','download','unix','server','tmp','files','from','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','test','Sequelize','ValidationError','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','send','index','map','MailMessage','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x572b,0x1b2));var _0xb572=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x572b[_0x4d8a8f];return _0xfc4adc;};'use strict';var pdf=require(_0xb572('0x0'));var emlformat=require(_0xb572('0x1'));var rimraf=require(_0xb572('0x2'));var zipdir=require(_0xb572('0x3'));var jsonpatch=require(_0xb572('0x4'));var rp=require('request-promise');var moment=require(_0xb572('0x5'));var BPromise=require(_0xb572('0x6'));var Mustache=require(_0xb572('0x7'));var util=require('util');var path=require(_0xb572('0x8'));var sox=require(_0xb572('0x9'));var csv=require(_0xb572('0xa'));var ejs=require(_0xb572('0xb'));var fs=require('fs');var _=require(_0xb572('0xc'));var squel=require(_0xb572('0xd'));var crypto=require(_0xb572('0xe'));var jsforce=require(_0xb572('0xf'));var deskjs=require(_0xb572('0x10'));var toCsv=require(_0xb572('0xa'));var querystring=require('querystring');var Papa=require(_0xb572('0x11'));var Redis=require('ioredis');var authService=require(_0xb572('0x12'));var qs=require(_0xb572('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb572('0x14'))(_0xb572('0x15'));var utils=require(_0xb572('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb572('0x17')]=_['defaults'](config[_0xb572('0x17')],{'host':_0xb572('0x18'),'port':0x18eb});var socket=require(_0xb572('0x19'))(new Redis(config['redis']));require(_0xb572('0x1a'))[_0xb572('0x1b')](socket);var jayson=require(_0xb572('0x1c'));var client=jayson['client'][_0xb572('0x1d')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson['client'][_0xb572('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x436487,_0x1481be,_0x5098bc){if(_0x5098bc){var _0x3285f9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3285f9[_0xb572('0x1e')](_0x1481be)){return _0x436487;}else{throw new db[(_0xb572('0x1f'))][(_0xb572('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x436487;}}function respondWithRpcPromise(_0x2b9c04,_0x18597b,_0x5b9a16,_0x53074e){return new BPromise(function(_0x34a77f,_0x341432){var _0x580241=_0x53074e||client;return _0x580241[_0xb572('0x21')](_0x2b9c04,_0x5b9a16)['then'](function(_0x38bbc6){logger['info'](_0xb572('0x22'),_0x18597b,_0xb572('0x23'));logger[_0xb572('0x24')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x18597b,_0xb572('0x23'),JSON[_0xb572('0x25')](_0x38bbc6));if(_0x38bbc6[_0xb572('0x26')]){if(_0x38bbc6['error'][_0xb572('0x27')]===0x1f4){logger[_0xb572('0x26')](_0xb572('0x22'),_0x18597b,_0x38bbc6['error'][_0xb572('0x28')]);return _0x341432(_0x38bbc6[_0xb572('0x26')][_0xb572('0x28')]);}logger[_0xb572('0x26')]('MailMessage,\x20%s,\x20%s',_0x18597b,_0x38bbc6[_0xb572('0x26')][_0xb572('0x28')]);return _0x34a77f(_0x38bbc6[_0xb572('0x26')][_0xb572('0x28')]);}else{logger['info'](_0xb572('0x22'),_0x18597b,_0xb572('0x23'));_0x34a77f(_0x38bbc6[_0xb572('0x29')][_0xb572('0x28')]);}})['catch'](function(_0x330754){logger['error'](_0xb572('0x22'),_0x18597b,_0x330754);_0x341432(_0x330754);});});}function respondWithStatusCode(_0x574990,_0x908888){_0x908888=_0x908888||0xcc;return function(_0x2c4b07){if(_0x2c4b07){return _0x574990[_0xb572('0x2a')](_0x908888);}return _0x574990[_0xb572('0x2b')](_0x908888)[_0xb572('0x2c')]();};}function respondWithResult(_0x338cea,_0x2891bc){_0x2891bc=_0x2891bc||0xc8;return function(_0x1b60a5){if(_0x1b60a5){return _0x338cea[_0xb572('0x2b')](_0x2891bc)['json'](_0x1b60a5);}};}function respondWithFilteredResult(_0x29cf6a,_0x1f3ddb){return function(_0x36563d){if(_0x36563d){var _0x363782=_0x36563d[_0xb572('0x2d')],_0x1527f7=_0x1f3ddb[_0xb572('0x2e')],_0x53ef84=_0x1f3ddb['offset']+_0x1f3ddb[_0xb572('0x2f')],_0x1e6ee2;if(_0x53ef84>=_0x363782){_0x53ef84=_0x363782;_0x1e6ee2=0xc8;}else{_0x1e6ee2=0xce;}_0x29cf6a[_0xb572('0x2b')](_0x1e6ee2);return _0x29cf6a[_0xb572('0x30')](_0xb572('0x31'),_0x1527f7+'-'+_0x53ef84+'/'+_0x363782)[_0xb572('0x32')](_0x36563d);}return null;};}function patchUpdates(_0x474678){return function(_0x29b897){try{jsonpatch[_0xb572('0x33')](_0x29b897,_0x474678,!![]);}catch(_0x5cfb86){return BPromise[_0xb572('0x34')](_0x5cfb86);}return _0x29b897[_0xb572('0x35')]();};}function saveUpdates(_0x240f11,_0x234bc7){return function(_0x195427){if(_0x195427){return _0x195427[_0xb572('0x36')](_0x240f11)['then'](function(_0x376cca){return _0x376cca;});}return null;};}function removeEntity(_0x25661b,_0x2742f2){return function(_0x4b7842){if(_0x4b7842){return _0x4b7842[_0xb572('0x37')]()[_0xb572('0x38')](function(){_0x25661b['status'](0xcc)[_0xb572('0x2c')]();});}};}function handleEntityNotFound(_0x1b310c,_0x55dcf3){return function(_0x191a6c){if(!_0x191a6c){_0x1b310c[_0xb572('0x2a')](0x194);}return _0x191a6c;};}function handleError(_0x22caba,_0x723115){_0x723115=_0x723115||0x1f4;return function(_0x58b119){logger[_0xb572('0x26')](_0x58b119['stack']);if(_0x58b119['name']){delete _0x58b119['name'];}_0x22caba[_0xb572('0x2b')](_0x723115)[_0xb572('0x39')](_0x58b119);};}exports[_0xb572('0x3a')]=function(_0x3e70f3,_0x1042c3){var _0x3f1d5b={},_0x40c5f9={},_0x3e5826={'count':0x0,'rows':[]};var _0x1dc6e5=_[_0xb572('0x3b')](db[_0xb572('0x3c')][_0xb572('0x3d')],function(_0x4a96a5){return{'name':_0x4a96a5['fieldName'],'type':_0x4a96a5[_0xb572('0x3e')][_0xb572('0x3f')]};});_0x40c5f9['model']=_[_0xb572('0x3b')](_0x1dc6e5,'name');_0x40c5f9[_0xb572('0x40')]=_[_0xb572('0x41')](_0x3e70f3['query']);_0x40c5f9[_0xb572('0x42')]=_[_0xb572('0x43')](_0x40c5f9[_0xb572('0x44')],_0x40c5f9[_0xb572('0x40')]);_0x3f1d5b['attributes']=_[_0xb572('0x43')](_0x40c5f9[_0xb572('0x44')],qs[_0xb572('0x45')](_0x3e70f3[_0xb572('0x40')][_0xb572('0x45')]));_0x3f1d5b['attributes']=_0x3f1d5b[_0xb572('0x46')][_0xb572('0x47')]?_0x3f1d5b[_0xb572('0x46')]:_0x40c5f9[_0xb572('0x44')];if(!_0x3e70f3[_0xb572('0x40')][_0xb572('0x48')](_0xb572('0x49'))){_0x3f1d5b[_0xb572('0x2f')]=qs[_0xb572('0x2f')](_0x3e70f3[_0xb572('0x40')][_0xb572('0x2f')]);_0x3f1d5b[_0xb572('0x2e')]=qs[_0xb572('0x2e')](_0x3e70f3[_0xb572('0x40')][_0xb572('0x2e')]);}_0x3f1d5b[_0xb572('0x4a')]=qs[_0xb572('0x4b')](_0x3e70f3[_0xb572('0x40')]['sort']);_0x3f1d5b[_0xb572('0x4c')]=qs['filters'](_[_0xb572('0x4d')](_0x3e70f3[_0xb572('0x40')],_0x40c5f9[_0xb572('0x42')]),_0x1dc6e5);if(_0x3e70f3[_0xb572('0x40')]['filter']){_0x3f1d5b[_0xb572('0x4c')]=_[_0xb572('0x4e')](_0x3f1d5b[_0xb572('0x4c')],{'$or':_[_0xb572('0x3b')](_0x1dc6e5,function(_0x1d7da6){if(_0x1d7da6[_0xb572('0x3e')]!=='VIRTUAL'){var _0x45c694={};_0x45c694[_0x1d7da6[_0xb572('0x4f')]]={'$like':'%'+_0x3e70f3['query'][_0xb572('0x50')]+'%'};return _0x45c694;}})});}_0x3f1d5b=_[_0xb572('0x4e')]({},_0x3f1d5b,_0x3e70f3[_0xb572('0x51')]);var _0x551c39={'where':_0x3f1d5b[_0xb572('0x4c')]};return db['MailMessage'][_0xb572('0x2d')](_0x551c39)[_0xb572('0x38')](function(_0x545e17){_0x3e5826[_0xb572('0x2d')]=_0x545e17;if(_0x3e70f3['query'][_0xb572('0x52')]){_0x3f1d5b['include']=[{'all':!![]}];}return db[_0xb572('0x3c')][_0xb572('0x53')](_0x3f1d5b);})[_0xb572('0x38')](function(_0x3e80ad){_0x3e5826[_0xb572('0x54')]=_0x3e80ad;return _0x3e5826;})[_0xb572('0x38')](respondWithFilteredResult(_0x1042c3,_0x3f1d5b))['catch'](handleError(_0x1042c3,null));};exports[_0xb572('0x55')]=function(_0xcaaf01,_0x1a6339){var _0x1c7502={'raw':!![],'where':{'id':_0xcaaf01[_0xb572('0x56')]['id']}},_0x126951={};_0x126951[_0xb572('0x44')]=_[_0xb572('0x41')](db[_0xb572('0x3c')][_0xb572('0x3d')]);_0x126951['query']=_['keys'](_0xcaaf01['query']);_0x126951['filters']=_[_0xb572('0x43')](_0x126951['model'],_0x126951[_0xb572('0x40')]);_0x1c7502[_0xb572('0x46')]=_[_0xb572('0x43')](_0x126951[_0xb572('0x44')],qs[_0xb572('0x45')](_0xcaaf01[_0xb572('0x40')][_0xb572('0x45')]));_0x1c7502[_0xb572('0x46')]=_0x1c7502[_0xb572('0x46')][_0xb572('0x47')]?_0x1c7502[_0xb572('0x46')]:_0x126951['model'];if(_0xcaaf01[_0xb572('0x40')][_0xb572('0x52')]){_0x1c7502[_0xb572('0x57')]=[{'all':!![]}];}_0x1c7502=_[_0xb572('0x4e')]({},_0x1c7502,_0xcaaf01['options']);return db[_0xb572('0x3c')][_0xb572('0x58')](_0x1c7502)['then'](handleEntityNotFound(_0x1a6339,null))[_0xb572('0x38')](respondWithResult(_0x1a6339,null))[_0xb572('0x59')](handleError(_0x1a6339,null));};exports[_0xb572('0x36')]=function(_0x17ce6e,_0xe23510){if(_0x17ce6e[_0xb572('0x5a')]['id']){delete _0x17ce6e[_0xb572('0x5a')]['id'];}return db[_0xb572('0x3c')][_0xb572('0x58')]({'where':{'id':_0x17ce6e['params']['id']}})[_0xb572('0x38')](handleEntityNotFound(_0xe23510,null))[_0xb572('0x38')](saveUpdates(_0x17ce6e['body'],null))['then'](respondWithResult(_0xe23510,null))[_0xb572('0x59')](handleError(_0xe23510,null));};exports[_0xb572('0x37')]=function(_0x415df6,_0x45d99e){return db['MailMessage']['find']({'where':{'id':_0x415df6[_0xb572('0x56')]['id']}})[_0xb572('0x38')](handleEntityNotFound(_0x45d99e,null))[_0xb572('0x38')](removeEntity(_0x45d99e,null))[_0xb572('0x59')](handleError(_0x45d99e,null));};exports[_0xb572('0x5b')]=function(_0x459ed7,_0x344dca){return db[_0xb572('0x3c')][_0xb572('0x5b')]()['then'](respondWithResult(_0x344dca,null))[_0xb572('0x59')](handleError(_0x344dca,null));};exports[_0xb572('0x5c')]=function(_0x35a959,_0x3d0554){return db[_0xb572('0x3c')][_0xb572('0x5c')](_0x35a959[_0xb572('0x5a')])['then'](function(_0x5d034d){if(_0x5d034d){if(_0x5d034d[_0xb572('0x5d')]===_0xb572('0x5e')&&!_0x5d034d[_0xb572('0x5f')]){var _0x3a6e08,_0x3c46b8,_0x11e821;if(_0x35a959[_0xb572('0x5a')]['to']){_0x3c46b8=_0x35a959[_0xb572('0x5a')]['to']['split'](',')[0x0];}return db[_0xb572('0x60')][_0xb572('0x61')]({'where':{'id':_0x5d034d['MailAccountId']},'include':[{'model':db[_0xb572('0x62')],'as':_0xb572('0x63'),'include':[{'model':db[_0xb572('0x64')],'as':_0xb572('0x65'),'where':{'email':_0x3c46b8},'limit':0x1,'order':[['updatedAt',_0xb572('0x66')]]}]},{'model':db[_0xb572('0x67')],'as':_0xb572('0x68'),'raw':!![]}]})['then'](function(_0x5c56da){_0x3a6e08=_0x5c56da;if(_0x3a6e08&&_0x3a6e08[_0xb572('0x68')]){var _0x56a7af={'tls':{'rejectUnauthorized':![]}};if(_[_0xb572('0x69')](_0x3a6e08[_0xb572('0x68')][_0xb572('0x6a')])){_0x56a7af[_0xb572('0x6b')]=_0x3a6e08[_0xb572('0x68')][_0xb572('0x6b')];_0x56a7af[_0xb572('0x6c')]=_0x3a6e08['Smtp'][_0xb572('0x6c')];_0x56a7af[_0xb572('0x6d')]=_0x3a6e08['Smtp'][_0xb572('0x6d')];if(_0x3a6e08['Smtp']['authentication']){_0x56a7af[_0xb572('0x6e')]={'user':_0x3a6e08['Smtp']['user'],'pass':_0x3a6e08[_0xb572('0x68')]['pass']};}}else{_0x56a7af[_0xb572('0x6a')]=_0x3a6e08[_0xb572('0x68')]['service'];_0x56a7af[_0xb572('0x6e')]={'user':_0x3a6e08[_0xb572('0x68')][_0xb572('0x6f')],'pass':_0x3a6e08[_0xb572('0x68')][_0xb572('0x70')]};_0x56a7af[_0xb572('0x6d')]=_0x3a6e08[_0xb572('0x68')]['secure'];}if(_0x35a959[_0xb572('0x5a')][_0xb572('0x71')]&&_0x35a959[_0xb572('0x5a')][_0xb572('0x71')]['length']){for(var _0x33d5d7=0x0;_0x33d5d7<_0x35a959[_0xb572('0x5a')]['attachments'][_0xb572('0x47')];_0x33d5d7+=0x1){_0x35a959[_0xb572('0x5a')][_0xb572('0x71')][_0x33d5d7]={'filename':_0x35a959['body'][_0xb572('0x71')][_0x33d5d7]['name'],'path':path[_0xb572('0x72')](config[_0xb572('0x73')],'server/files/attachments',_0x35a959['body'][_0xb572('0x71')][_0x33d5d7][_0xb572('0x74')])};}}_0x11e821={'account':_0x56a7af,'message':_0x35a959[_0xb572('0x5a')]};return;}})['then'](function(){if(_0x3a6e08[_0xb572('0x63')]){if(_0x3a6e08[_0xb572('0x63')][_0xb572('0x65')][_0xb572('0x47')]){return _0x3a6e08[_0xb572('0x63')][_0xb572('0x65')][0x0];}else{return db['CmContact'][_0xb572('0x5c')](_[_0xb572('0x75')](_0x35a959[_0xb572('0x5a')],{'firstName':_0x35a959[_0xb572('0x5a')]['to'],'email':_0x35a959[_0xb572('0x5a')]['to'],'phone':_0x35a959[_0xb572('0x5a')]['to'],'ListId':_0x3a6e08[_0xb572('0x76')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xb572('0x38')](function(){if(_0x11e821){return respondWithRpcPromise(_0xb572('0x77'),_0xb572('0x78'),_0x11e821,client9003)[_0xb572('0x38')](function(_0x21c411){return _0x5d034d[_0xb572('0x36')]({'read':!![],'messageId':_0x21c411[_0xb572('0x79')],'sentAt':moment()['format'](_0xb572('0x7a'))});})[_0xb572('0x59')](function(_0x48e707){logger[_0xb572('0x26')]('%s',JSON[_0xb572('0x25')](_0x48e707));return _0x5d034d;});}return _0x5d034d;});}return _0x5d034d;}})['then'](respondWithResult(_0x3d0554,0xc9))[_0xb572('0x59')](handleError(_0x3d0554,null));};var interaction_log=require(_0xb572('0x14'))(_0xb572('0x7b'));exports[_0xb572('0x7c')]=function(_0x6fc672,_0x708d55,_0x224193){var _0x51bc10={'channel':_0xb572('0x7d')};if(_0x6fc672['body']['id']){delete _0x6fc672[_0xb572('0x5a')]['id'];}_0x6fc672[_0xb572('0x5a')]['read']=!![];_0x6fc672[_0xb572('0x5a')][_0xb572('0x7e')]=moment()[_0xb572('0x7f')](_0xb572('0x7a'));_0x6fc672[_0xb572('0x5a')]['UserId']=_0x6fc672['body'][_0xb572('0x80')]||_0x6fc672[_0xb572('0x6f')]['id'];return db[_0xb572('0x3c')]['find']({'where':{'id':_0x6fc672[_0xb572('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xb572('0x81')}]})[_0xb572('0x38')](handleEntityNotFound(_0x708d55,null))[_0xb572('0x38')](saveUpdates(_0x6fc672[_0xb572('0x5a')],null))['then'](function(_0x3f4f6e){if(_0x3f4f6e){_0x51bc10[_0xb572('0x28')]=_0x3f4f6e[_0xb572('0x82')]({'plain':!![]});return db[_0xb572('0x83')][_0xb572('0x58')]({'where':{'id':_0x3f4f6e[_0xb572('0x84')]}});}return null;})[_0xb572('0x38')](handleEntityNotFound(_0x708d55,null))[_0xb572('0x38')](function(_0xe62e4d){if(_0xe62e4d){return _0xe62e4d[_0xb572('0x36')]({'UserId':_0x6fc672[_0xb572('0x5a')]['UserId'],'read1stAt':_[_0xb572('0x69')](_0xe62e4d['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4449ff){if(_0x4449ff){_0x51bc10['interaction']=_0x4449ff['get']({'plain':!![]});interaction_log['info'](_0xb572('0x85'),_0x6fc672[_0xb572('0x6f')]['id'],_0x6fc672[_0xb572('0x6f')]['name'],_0x6fc672['user']['role'],_0x51bc10[_0xb572('0x86')]['id'],_0x6fc672[_0xb572('0x5a')]?JSON[_0xb572('0x25')](_0x6fc672[_0xb572('0x5a')]):_0xb572('0x87'));return respondWithRpcPromise('AcceptMessage',_0xb572('0x88'),_0x51bc10);}return null;})['then'](function(_0x426b5e){if(_0x426b5e){if(_0x6fc672['body'][_0xb572('0x89')]){_0x51bc10[_0xb572('0x28')][_0xb572('0x8a')]=util['format'](_0xb572('0x8b'),_0x6fc672['user']['name']);_0x51bc10['message']['channel']=_0x51bc10[_0xb572('0x8c')];_0x51bc10[_0xb572('0x28')]['event']=_0xb572('0x7c');return respondWithRpcPromise(_0xb572('0x8d'),_0xb572('0x8d'),{'event':_0xb572('0x8e'),'message':_0x51bc10['message']},client9002)['then'](function(){return _0x51bc10;});}return _0x51bc10;}return null;})[_0xb572('0x38')](respondWithResult(_0x708d55,null))[_0xb572('0x59')](handleError(_0x708d55,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0xb572('0x34')]=function(_0x33cecf,_0x3060a5,_0x451184){var _0x1f7b16={'agent':{},'channel':'mail'};if(_0x33cecf['body']['id']){delete _0x33cecf[_0xb572('0x5a')]['id'];}_0x33cecf[_0xb572('0x5a')][_0xb572('0x80')]=_0x33cecf['body'][_0xb572('0x80')]||_0x33cecf['user']['id'];_0x1f7b16[_0xb572('0x8f')]['id']=_0x33cecf['body']['UserId'];return db[_0xb572('0x3c')][_0xb572('0x58')]({'where':{'id':_0x33cecf['params']['id'],'UserId':null}})[_0xb572('0x38')](handleEntityNotFound(_0x3060a5,null))['then'](function(_0x2d6775){if(_0x2d6775){_0x1f7b16[_0xb572('0x28')]=_0x2d6775[_0xb572('0x82')]({'plain':!![]});return db[_0xb572('0x83')]['find']({'where':{'id':_0x2d6775[_0xb572('0x84')]}});}return null;})['then'](handleEntityNotFound(_0x3060a5,null))['then'](function(_0x26b1e8){if(_0x26b1e8){_0x1f7b16[_0xb572('0x86')]=_0x26b1e8[_0xb572('0x82')]({'plain':!![]});interaction_log[_0xb572('0x90')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33cecf['user']['id'],_0x33cecf[_0xb572('0x6f')][_0xb572('0x4f')],_0x33cecf[_0xb572('0x6f')][_0xb572('0x91')],_0x1f7b16['interaction']['id'],_0x33cecf[_0xb572('0x5a')]?JSON[_0xb572('0x25')](_0x33cecf[_0xb572('0x5a')]):'null');return respondWithRpcPromise(_0xb572('0x92'),_0xb572('0x93'),_0x1f7b16);}return null;})[_0xb572('0x38')](function(_0x2f7f45){if(_0x2f7f45){_0x2f7f45['message'][_0xb572('0x8a')]=util[_0xb572('0x7f')](_0xb572('0x8b'),_0x33cecf[_0xb572('0x6f')]['name']);_0x2f7f45['message'][_0xb572('0x8c')]=_0x1f7b16[_0xb572('0x8c')];_0x2f7f45[_0xb572('0x28')][_0xb572('0x94')]=_0xb572('0x34');respondWithRpcPromise(_0xb572('0x8d'),_0xb572('0x8d'),{'event':_0xb572('0x95'),'message':_0x2f7f45['message']},client9002);return _0x1f7b16;}return null;})[_0xb572('0x38')](respondWithResult(_0x3060a5,null))[_0xb572('0x59')](handleError(_0x3060a5,null));};exports[_0xb572('0x96')]=function(_0x5418da,_0x21b63c){var _0x154a5f=moment()[_0xb572('0x97')]()['toString']();var _0x22f647=path['join'](config[_0xb572('0x73')],_0xb572('0x98'),'files',_0xb572('0x99'));var _0x5271b1=path[_0xb572('0x72')](config[_0xb572('0x73')],_0xb572('0x98'),_0xb572('0x9a'),_0xb572('0x71'));var _0x1b33d2=util[_0xb572('0x7f')]('message-%s.eml',_0x154a5f);return db['MailMessage']['find']({'where':{'id':_0x5418da['params']['id']},'attributes':['id',_0xb572('0x5a'),_0xb572('0x9b'),'to','cc',_0xb572('0x9c'),_0xb572('0x9d'),_0xb572('0x9e')],'include':_0x5418da[_0xb572('0x40')][_0xb572('0x71')]?[{'model':db['Attachment'],'as':_0xb572('0x9f')}]:undefined})[_0xb572('0x38')](handleEntityNotFound(_0x21b63c,null))[_0xb572('0x38')](function(_0x1abeb4){if(_0x1abeb4){var _0x2e2544=_0x1abeb4;var _0xad669={'from':_0x2e2544['from'],'to':_0x2e2544['to'],'subject':_0x2e2544[_0xb572('0x9d')],'html':_0x2e2544[_0xb572('0x5a')],'headers':{'Date':moment(_0x2e2544[_0xb572('0x9e')])[_0xb572('0x7f')](_0xb572('0xa0'))},'attachments':[]};if(_0x1abeb4['cc']){_0xad669[_0xb572('0xa1')]['Cc']=_0x1abeb4['cc'];}if(_0x1abeb4[_0xb572('0x9c')]){_0xad669['headers'][_0xb572('0xa2')]=_0x1abeb4['bcc'];}return new BPromise(function(_0x38a75f,_0x2bc8f9){if(_0x1abeb4[_0xb572('0x9f')]){for(var _0xdb3a3d=0x0;_0xdb3a3d<_0x1abeb4['Attachments'][_0xb572('0x47')];_0xdb3a3d++){var _0x2194a3=_0x1abeb4[_0xb572('0x9f')][_0xdb3a3d];var _0x1334d5=path['join'](_0x5271b1,_0x2194a3[_0xb572('0x74')]);if(fs[_0xb572('0xa3')](_0x1334d5)){_0xad669['attachments'][_0xb572('0xa4')]({'name':_0x2194a3[_0xb572('0x4f')],'contentType':_0x2194a3['type'],'data':fs[_0xb572('0xa5')](_0x1334d5)});}}}emlformat[_0xb572('0xa6')](_0xad669,function(_0x41b611,_0x35a55c){if(_0x41b611)return _0x2bc8f9(_0x41b611);fs[_0xb572('0xa7')](path['join'](_0x22f647,_0x1b33d2),_0x35a55c);return _0x38a75f(_0x35a55c);});});}})[_0xb572('0x38')](function(_0x789b28){if(_0x789b28){return _0x21b63c[_0xb572('0x96')](path['join'](_0x22f647,_0x1b33d2),_0x1b33d2,function(_0x395440){if(_0x395440){console[_0xb572('0xa8')](_0xb572('0xa9'),_0x395440);}else{fs[_0xb572('0xaa')](path[_0xb572('0x72')](_0x22f647,_0x1b33d2));}});}})[_0xb572('0x59')](handleError(_0x21b63c,null));}; \ No newline at end of file +var _0xdf70=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','body','describe','create','direction','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','ListId','List\x20not\x20found','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','Contact','get','MailInteraction','read1stAt','interaction','role','AcceptMessage','manual','interface','channel','event','EventManager','MailInteractionId','RejectMessage','reject','rejectmessage','download','unix','toString','server','from','bcc','subject','Attachment','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','Sequelize'];(function(_0xe42905,_0x4e0e9a){var _0x23df4e=function(_0x3d16a6){while(--_0x3d16a6){_0xe42905['push'](_0xe42905['shift']());}};_0x23df4e(++_0x4e0e9a);}(_0xdf70,0x86));var _0x0df7=function(_0x168c41,_0x4d5871){_0x168c41=_0x168c41-0x0;var _0xed0f90=_0xdf70[_0x168c41];return _0xed0f90;};'use strict';var pdf=require(_0x0df7('0x0'));var emlformat=require(_0x0df7('0x1'));var rimraf=require(_0x0df7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0df7('0x3'));var rp=require(_0x0df7('0x4'));var moment=require('moment');var BPromise=require(_0x0df7('0x5'));var Mustache=require('mustache');var util=require(_0x0df7('0x6'));var path=require(_0x0df7('0x7'));var sox=require('sox');var csv=require(_0x0df7('0x8'));var ejs=require(_0x0df7('0x9'));var fs=require('fs');var _=require(_0x0df7('0xa'));var squel=require('squel');var crypto=require(_0x0df7('0xb'));var jsforce=require(_0x0df7('0xc'));var deskjs=require(_0x0df7('0xd'));var toCsv=require(_0x0df7('0x8'));var querystring=require(_0x0df7('0xe'));var Papa=require(_0x0df7('0xf'));var Redis=require('ioredis');var authService=require(_0x0df7('0x10'));var qs=require(_0x0df7('0x11'));var as=require(_0x0df7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0df7('0x13'))(_0x0df7('0x14'));var utils=require(_0x0df7('0x15'));var config=require('../../config/environment');var db=require(_0x0df7('0x16'))['db'];config[_0x0df7('0x17')]=_[_0x0df7('0x18')](config['redis'],{'host':_0x0df7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0df7('0x1a'))[_0x0df7('0x1b')](socket);var jayson=require(_0x0df7('0x1c'));var client=jayson[_0x0df7('0x1d')]['http']({'port':0x232c});var client9003=jayson[_0x0df7('0x1d')][_0x0df7('0x1e')]({'port':0x232b});var client9002=jayson[_0x0df7('0x1d')][_0x0df7('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x2c0399,_0x563951,_0x12945d){if(_0x12945d){var _0x4161d1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4161d1['test'](_0x563951)){return _0x2c0399;}else{throw new db[(_0x0df7('0x1f'))][(_0x0df7('0x20'))](_0x0df7('0x21'));}}else{return _0x2c0399;}}function respondWithRpcPromise(_0x124582,_0x32b3bd,_0x29ac87,_0x31a41c){return new BPromise(function(_0x501f13,_0x3339db){var _0x474004=_0x31a41c||client;return _0x474004['request'](_0x124582,_0x29ac87)[_0x0df7('0x22')](function(_0x51b3a5){logger[_0x0df7('0x23')](_0x0df7('0x24'),_0x32b3bd,_0x0df7('0x25'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x32b3bd,_0x0df7('0x25'),JSON[_0x0df7('0x26')](_0x51b3a5));if(_0x51b3a5[_0x0df7('0x27')]){if(_0x51b3a5['error'][_0x0df7('0x28')]===0x1f4){logger[_0x0df7('0x27')](_0x0df7('0x24'),_0x32b3bd,_0x51b3a5['error'][_0x0df7('0x29')]);return _0x3339db(_0x51b3a5[_0x0df7('0x27')]['message']);}logger[_0x0df7('0x27')](_0x0df7('0x24'),_0x32b3bd,_0x51b3a5[_0x0df7('0x27')][_0x0df7('0x29')]);return _0x501f13(_0x51b3a5['error'][_0x0df7('0x29')]);}else{logger[_0x0df7('0x23')](_0x0df7('0x24'),_0x32b3bd,'request\x20sent');_0x501f13(_0x51b3a5[_0x0df7('0x2a')][_0x0df7('0x29')]);}})['catch'](function(_0x41fbd8){logger[_0x0df7('0x27')](_0x0df7('0x24'),_0x32b3bd,_0x41fbd8);_0x3339db(_0x41fbd8);});});}function respondWithStatusCode(_0x5d104a,_0x1fe12a){_0x1fe12a=_0x1fe12a||0xcc;return function(_0x449966){if(_0x449966){return _0x5d104a[_0x0df7('0x2b')](_0x1fe12a);}return _0x5d104a[_0x0df7('0x2c')](_0x1fe12a)[_0x0df7('0x2d')]();};}function respondWithResult(_0x7437ff,_0x2d2acc){_0x2d2acc=_0x2d2acc||0xc8;return function(_0xe62dcf){if(_0xe62dcf){return _0x7437ff[_0x0df7('0x2c')](_0x2d2acc)[_0x0df7('0x2e')](_0xe62dcf);}};}function respondWithFilteredResult(_0x4a4880,_0x14d31c){return function(_0x1e88a9){if(_0x1e88a9){var _0x2f7ada=_0x1e88a9[_0x0df7('0x2f')],_0x19d002=_0x14d31c[_0x0df7('0x30')],_0x2422e2=_0x14d31c[_0x0df7('0x30')]+_0x14d31c[_0x0df7('0x31')],_0x578699;if(_0x2422e2>=_0x2f7ada){_0x2422e2=_0x2f7ada;_0x578699=0xc8;}else{_0x578699=0xce;}_0x4a4880[_0x0df7('0x2c')](_0x578699);return _0x4a4880[_0x0df7('0x32')](_0x0df7('0x33'),_0x19d002+'-'+_0x2422e2+'/'+_0x2f7ada)[_0x0df7('0x2e')](_0x1e88a9);}return null;};}function patchUpdates(_0x1071e5){return function(_0x1cf0d6){try{jsonpatch[_0x0df7('0x34')](_0x1cf0d6,_0x1071e5,!![]);}catch(_0x15ffca){return BPromise['reject'](_0x15ffca);}return _0x1cf0d6[_0x0df7('0x35')]();};}function saveUpdates(_0x5cd802,_0x34849b){return function(_0x58a43c){if(_0x58a43c){return _0x58a43c[_0x0df7('0x36')](_0x5cd802)['then'](function(_0x4122ec){return _0x4122ec;});}return null;};}function removeEntity(_0x3cf43e,_0x371d5b){return function(_0x47a9e3){if(_0x47a9e3){return _0x47a9e3[_0x0df7('0x37')]()[_0x0df7('0x22')](function(){_0x3cf43e[_0x0df7('0x2c')](0xcc)[_0x0df7('0x2d')]();});}};}function handleEntityNotFound(_0xe23c1b,_0x1a44dd){return function(_0x205c41){if(!_0x205c41){_0xe23c1b['sendStatus'](0x194);}return _0x205c41;};}function handleError(_0x522243,_0x537286){_0x537286=_0x537286||0x1f4;return function(_0x4d5aa2){logger['error'](_0x4d5aa2[_0x0df7('0x38')]);if(_0x4d5aa2['name']){delete _0x4d5aa2['name'];}_0x522243['status'](_0x537286)[_0x0df7('0x39')](_0x4d5aa2);};}exports[_0x0df7('0x3a')]=function(_0x240a3e,_0x768a12){var _0x2a997c={},_0x47aa1c={},_0x79718d={'count':0x0,'rows':[]};var _0x29f940=_['map'](db[_0x0df7('0x3b')][_0x0df7('0x3c')],function(_0x1285cb){return{'name':_0x1285cb[_0x0df7('0x3d')],'type':_0x1285cb[_0x0df7('0x3e')][_0x0df7('0x3f')]};});_0x47aa1c[_0x0df7('0x40')]=_[_0x0df7('0x41')](_0x29f940,_0x0df7('0x42'));_0x47aa1c[_0x0df7('0x43')]=_['keys'](_0x240a3e[_0x0df7('0x43')]);_0x47aa1c['filters']=_[_0x0df7('0x44')](_0x47aa1c[_0x0df7('0x40')],_0x47aa1c[_0x0df7('0x43')]);_0x2a997c[_0x0df7('0x45')]=_[_0x0df7('0x44')](_0x47aa1c['model'],qs[_0x0df7('0x46')](_0x240a3e[_0x0df7('0x43')][_0x0df7('0x46')]));_0x2a997c[_0x0df7('0x45')]=_0x2a997c['attributes'][_0x0df7('0x47')]?_0x2a997c['attributes']:_0x47aa1c['model'];if(!_0x240a3e[_0x0df7('0x43')][_0x0df7('0x48')](_0x0df7('0x49'))){_0x2a997c[_0x0df7('0x31')]=qs[_0x0df7('0x31')](_0x240a3e[_0x0df7('0x43')][_0x0df7('0x31')]);_0x2a997c[_0x0df7('0x30')]=qs[_0x0df7('0x30')](_0x240a3e['query']['offset']);}_0x2a997c[_0x0df7('0x4a')]=qs[_0x0df7('0x4b')](_0x240a3e['query'][_0x0df7('0x4b')]);_0x2a997c[_0x0df7('0x4c')]=qs['filters'](_['pick'](_0x240a3e[_0x0df7('0x43')],_0x47aa1c[_0x0df7('0x4d')]),_0x29f940);if(_0x240a3e[_0x0df7('0x43')][_0x0df7('0x4e')]){_0x2a997c[_0x0df7('0x4c')]=_[_0x0df7('0x4f')](_0x2a997c[_0x0df7('0x4c')],{'$or':_[_0x0df7('0x41')](_0x29f940,function(_0x1abd1f){if(_0x1abd1f[_0x0df7('0x3e')]!==_0x0df7('0x50')){var _0x1983de={};_0x1983de[_0x1abd1f[_0x0df7('0x42')]]={'$like':'%'+_0x240a3e[_0x0df7('0x43')]['filter']+'%'};return _0x1983de;}})});}_0x2a997c=_[_0x0df7('0x4f')]({},_0x2a997c,_0x240a3e[_0x0df7('0x51')]);var _0xc89edd={'where':_0x2a997c[_0x0df7('0x4c')]};return db[_0x0df7('0x3b')][_0x0df7('0x2f')](_0xc89edd)['then'](function(_0x4f12f3){_0x79718d[_0x0df7('0x2f')]=_0x4f12f3;if(_0x240a3e[_0x0df7('0x43')][_0x0df7('0x52')]){_0x2a997c['include']=[{'all':!![]}];}return db[_0x0df7('0x3b')][_0x0df7('0x53')](_0x2a997c);})[_0x0df7('0x22')](function(_0x1ecab5){_0x79718d['rows']=_0x1ecab5;return _0x79718d;})[_0x0df7('0x22')](respondWithFilteredResult(_0x768a12,_0x2a997c))[_0x0df7('0x54')](handleError(_0x768a12,null));};exports[_0x0df7('0x55')]=function(_0x570822,_0xc32ca5){var _0x8e3830={'raw':!![],'where':{'id':_0x570822[_0x0df7('0x56')]['id']}},_0x3d9189={};_0x3d9189[_0x0df7('0x40')]=_['keys'](db[_0x0df7('0x3b')][_0x0df7('0x3c')]);_0x3d9189[_0x0df7('0x43')]=_[_0x0df7('0x57')](_0x570822[_0x0df7('0x43')]);_0x3d9189['filters']=_[_0x0df7('0x44')](_0x3d9189[_0x0df7('0x40')],_0x3d9189[_0x0df7('0x43')]);_0x8e3830[_0x0df7('0x45')]=_[_0x0df7('0x44')](_0x3d9189[_0x0df7('0x40')],qs[_0x0df7('0x46')](_0x570822[_0x0df7('0x43')][_0x0df7('0x46')]));_0x8e3830[_0x0df7('0x45')]=_0x8e3830[_0x0df7('0x45')]['length']?_0x8e3830[_0x0df7('0x45')]:_0x3d9189[_0x0df7('0x40')];if(_0x570822[_0x0df7('0x43')][_0x0df7('0x52')]){_0x8e3830[_0x0df7('0x58')]=[{'all':!![]}];}_0x8e3830=_['merge']({},_0x8e3830,_0x570822['options']);return db[_0x0df7('0x3b')][_0x0df7('0x59')](_0x8e3830)['then'](handleEntityNotFound(_0xc32ca5,null))[_0x0df7('0x22')](respondWithResult(_0xc32ca5,null))['catch'](handleError(_0xc32ca5,null));};exports[_0x0df7('0x36')]=function(_0x36cba9,_0x2f8bcd){if(_0x36cba9[_0x0df7('0x5a')]['id']){delete _0x36cba9[_0x0df7('0x5a')]['id'];}return db[_0x0df7('0x3b')]['find']({'where':{'id':_0x36cba9[_0x0df7('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f8bcd,null))[_0x0df7('0x22')](saveUpdates(_0x36cba9[_0x0df7('0x5a')],null))[_0x0df7('0x22')](respondWithResult(_0x2f8bcd,null))[_0x0df7('0x54')](handleError(_0x2f8bcd,null));};exports['destroy']=function(_0x4c0ffa,_0x5d3f59){return db[_0x0df7('0x3b')]['find']({'where':{'id':_0x4c0ffa['params']['id']}})[_0x0df7('0x22')](handleEntityNotFound(_0x5d3f59,null))[_0x0df7('0x22')](removeEntity(_0x5d3f59,null))[_0x0df7('0x54')](handleError(_0x5d3f59,null));};exports[_0x0df7('0x5b')]=function(_0xb2a48a,_0x58c55e){return db[_0x0df7('0x3b')]['describe']()[_0x0df7('0x22')](respondWithResult(_0x58c55e,null))[_0x0df7('0x54')](handleError(_0x58c55e,null));};exports[_0x0df7('0x5c')]=function(_0x548128,_0x547ee6){return db['MailMessage']['create'](_0x548128['body'])['then'](function(_0xd719af){if(_0xd719af){if(_0xd719af[_0x0df7('0x5d')]==='out'&&!_0xd719af[_0x0df7('0x5e')]){var _0x550a79,_0x33f46c,_0x386e7b;if(_0x548128[_0x0df7('0x5a')]['to']){_0x33f46c=_0x548128['body']['to'][_0x0df7('0x5f')](',')[0x0];}return db['MailAccount'][_0x0df7('0x60')]({'where':{'id':_0xd719af[_0x0df7('0x61')]},'include':[{'model':db[_0x0df7('0x62')],'as':_0x0df7('0x63'),'include':[{'model':db[_0x0df7('0x64')],'as':_0x0df7('0x65'),'where':{'email':_0x33f46c},'limit':0x1,'order':[['updatedAt',_0x0df7('0x66')]]}]},{'model':db[_0x0df7('0x67')],'as':_0x0df7('0x68'),'raw':!![]}]})['then'](function(_0x33b64b){_0x550a79=_0x33b64b;if(_0x550a79&&_0x550a79[_0x0df7('0x68')]){var _0x86c26f={'tls':{'rejectUnauthorized':![]}};if(_[_0x0df7('0x69')](_0x550a79[_0x0df7('0x68')][_0x0df7('0x6a')])){_0x86c26f['host']=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6b')];_0x86c26f['port']=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6c')];_0x86c26f[_0x0df7('0x6d')]=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6d')];if(_0x550a79['Smtp'][_0x0df7('0x6e')]){_0x86c26f[_0x0df7('0x6f')]={'user':_0x550a79[_0x0df7('0x68')][_0x0df7('0x70')],'pass':_0x550a79['Smtp'][_0x0df7('0x71')]};}}else{_0x86c26f[_0x0df7('0x6a')]=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6a')];_0x86c26f[_0x0df7('0x6f')]={'user':_0x550a79[_0x0df7('0x68')]['user'],'pass':_0x550a79['Smtp'][_0x0df7('0x71')]};_0x86c26f['secure']=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6d')];}if(_0x548128[_0x0df7('0x5a')][_0x0df7('0x72')]&&_0x548128[_0x0df7('0x5a')][_0x0df7('0x72')][_0x0df7('0x47')]){for(var _0x3fdc47=0x0;_0x3fdc47<_0x548128[_0x0df7('0x5a')][_0x0df7('0x72')]['length'];_0x3fdc47+=0x1){_0x548128[_0x0df7('0x5a')]['attachments'][_0x3fdc47]={'filename':_0x548128[_0x0df7('0x5a')][_0x0df7('0x72')][_0x3fdc47][_0x0df7('0x42')],'path':path[_0x0df7('0x73')](config[_0x0df7('0x74')],_0x0df7('0x75'),_0x548128[_0x0df7('0x5a')]['attachments'][_0x3fdc47]['basename'])};}}_0x386e7b={'account':_0x86c26f,'message':_0x548128[_0x0df7('0x5a')]};return;}})[_0x0df7('0x22')](function(){if(_0x550a79['List']){if(_0x550a79['List']['Contacts'][_0x0df7('0x47')]){return _0x550a79[_0x0df7('0x63')][_0x0df7('0x65')][0x0];}else{return db[_0x0df7('0x64')][_0x0df7('0x5c')](_[_0x0df7('0x18')](_0x548128[_0x0df7('0x5a')],{'firstName':_0x548128[_0x0df7('0x5a')]['to'],'email':_0x548128[_0x0df7('0x5a')]['to'],'phone':_0x548128[_0x0df7('0x5a')]['to'],'ListId':_0x550a79[_0x0df7('0x76')]}));}}else{throw new Error(_0x0df7('0x77'));}})['then'](function(){if(_0x386e7b){return respondWithRpcPromise('SendMail',_0x0df7('0x78'),_0x386e7b,client9003)[_0x0df7('0x22')](function(_0x2709b3){return _0xd719af[_0x0df7('0x36')]({'read':!![],'messageId':_0x2709b3[_0x0df7('0x79')],'sentAt':moment()['format'](_0x0df7('0x7a'))});})[_0x0df7('0x54')](function(_0x58feec){logger[_0x0df7('0x27')]('%s',JSON[_0x0df7('0x26')](_0x58feec));return _0xd719af;});}return _0xd719af;});}return _0xd719af;}})[_0x0df7('0x22')](respondWithResult(_0x547ee6,0xc9))['catch'](handleError(_0x547ee6,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0x0df7('0x7b')]=function(_0x4ed97c,_0x246f1a,_0x924ba0){var _0x29bf63={'channel':_0x0df7('0x7c')};if(_0x4ed97c['body']['id']){delete _0x4ed97c['body']['id'];}_0x4ed97c['body'][_0x0df7('0x7d')]=!![];_0x4ed97c[_0x0df7('0x5a')][_0x0df7('0x7e')]=moment()[_0x0df7('0x7f')](_0x0df7('0x7a'));_0x4ed97c['body']['UserId']=_0x4ed97c[_0x0df7('0x5a')][_0x0df7('0x80')]||_0x4ed97c[_0x0df7('0x70')]['id'];return db[_0x0df7('0x3b')][_0x0df7('0x59')]({'where':{'id':_0x4ed97c[_0x0df7('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x0df7('0x64')],'as':_0x0df7('0x81')}]})[_0x0df7('0x22')](handleEntityNotFound(_0x246f1a,null))[_0x0df7('0x22')](saveUpdates(_0x4ed97c[_0x0df7('0x5a')],null))['then'](function(_0x7c1e2d){if(_0x7c1e2d){_0x29bf63[_0x0df7('0x29')]=_0x7c1e2d[_0x0df7('0x82')]({'plain':!![]});return db[_0x0df7('0x83')][_0x0df7('0x59')]({'where':{'id':_0x7c1e2d['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x246f1a,null))[_0x0df7('0x22')](function(_0x792577){if(_0x792577){return _0x792577[_0x0df7('0x36')]({'UserId':_0x4ed97c[_0x0df7('0x5a')][_0x0df7('0x80')],'read1stAt':_[_0x0df7('0x69')](_0x792577[_0x0df7('0x84')])?moment()[_0x0df7('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0df7('0x22')](function(_0x3a002c){if(_0x3a002c){_0x29bf63[_0x0df7('0x85')]=_0x3a002c['get']({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ed97c[_0x0df7('0x70')]['id'],_0x4ed97c['user']['name'],_0x4ed97c[_0x0df7('0x70')][_0x0df7('0x86')],_0x29bf63[_0x0df7('0x85')]['id'],_0x4ed97c[_0x0df7('0x5a')]?JSON[_0x0df7('0x26')](_0x4ed97c[_0x0df7('0x5a')]):'null');return respondWithRpcPromise(_0x0df7('0x87'),'acceptMessage',_0x29bf63);}return null;})['then'](function(_0xa38eb8){if(_0xa38eb8){if(_0x4ed97c[_0x0df7('0x5a')][_0x0df7('0x88')]){_0x29bf63[_0x0df7('0x29')][_0x0df7('0x89')]=util['format']('SIP/%s',_0x4ed97c['user']['name']);_0x29bf63[_0x0df7('0x29')][_0x0df7('0x8a')]=_0x29bf63[_0x0df7('0x8a')];_0x29bf63[_0x0df7('0x29')][_0x0df7('0x8b')]=_0x0df7('0x7b');return respondWithRpcPromise(_0x0df7('0x8c'),_0x0df7('0x8c'),{'event':'acceptmessage','message':_0x29bf63[_0x0df7('0x29')]},client9002)['then'](function(){return _0x29bf63;});}return _0x29bf63;}return null;})[_0x0df7('0x22')](respondWithResult(_0x246f1a,null))[_0x0df7('0x54')](handleError(_0x246f1a,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports['reject']=function(_0x4a0ddb,_0x3e8f0a,_0x31b4c7){var _0x24da7f={'agent':{},'channel':_0x0df7('0x7c')};if(_0x4a0ddb[_0x0df7('0x5a')]['id']){delete _0x4a0ddb[_0x0df7('0x5a')]['id'];}_0x4a0ddb[_0x0df7('0x5a')]['UserId']=_0x4a0ddb[_0x0df7('0x5a')]['UserId']||_0x4a0ddb[_0x0df7('0x70')]['id'];_0x24da7f['agent']['id']=_0x4a0ddb[_0x0df7('0x5a')]['UserId'];return db['MailMessage']['find']({'where':{'id':_0x4a0ddb['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e8f0a,null))[_0x0df7('0x22')](function(_0xb228d3){if(_0xb228d3){_0x24da7f[_0x0df7('0x29')]=_0xb228d3[_0x0df7('0x82')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0xb228d3[_0x0df7('0x8d')]}});}return null;})[_0x0df7('0x22')](handleEntityNotFound(_0x3e8f0a,null))['then'](function(_0x41576f){if(_0x41576f){_0x24da7f[_0x0df7('0x85')]=_0x41576f[_0x0df7('0x82')]({'plain':!![]});interaction_log[_0x0df7('0x23')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a0ddb[_0x0df7('0x70')]['id'],_0x4a0ddb[_0x0df7('0x70')][_0x0df7('0x42')],_0x4a0ddb[_0x0df7('0x70')][_0x0df7('0x86')],_0x24da7f['interaction']['id'],_0x4a0ddb[_0x0df7('0x5a')]?JSON[_0x0df7('0x26')](_0x4a0ddb[_0x0df7('0x5a')]):'null');return respondWithRpcPromise(_0x0df7('0x8e'),'rejectMessage',_0x24da7f);}return null;})[_0x0df7('0x22')](function(_0x4227be){if(_0x4227be){_0x4227be[_0x0df7('0x29')][_0x0df7('0x89')]=util['format']('SIP/%s',_0x4a0ddb['user']['name']);_0x4227be[_0x0df7('0x29')]['channel']=_0x24da7f[_0x0df7('0x8a')];_0x4227be[_0x0df7('0x29')]['event']=_0x0df7('0x8f');respondWithRpcPromise(_0x0df7('0x8c'),_0x0df7('0x8c'),{'event':_0x0df7('0x90'),'message':_0x4227be['message']},client9002);return _0x24da7f;}return null;})[_0x0df7('0x22')](respondWithResult(_0x3e8f0a,null))[_0x0df7('0x54')](handleError(_0x3e8f0a,null));};exports[_0x0df7('0x91')]=function(_0x2e3fcb,_0x169320){var _0xd0013a=moment()[_0x0df7('0x92')]()[_0x0df7('0x93')]();var _0x3798b5=path[_0x0df7('0x73')](config['root'],_0x0df7('0x94'),'files','tmp');var _0x1f9434=path[_0x0df7('0x73')](config[_0x0df7('0x74')],_0x0df7('0x94'),'files','attachments');var _0x1d9aab=util[_0x0df7('0x7f')]('message-%s.eml',_0xd0013a);return db[_0x0df7('0x3b')]['find']({'where':{'id':_0x2e3fcb['params']['id']},'attributes':['id',_0x0df7('0x5a'),_0x0df7('0x95'),'to','cc',_0x0df7('0x96'),_0x0df7('0x97'),'createdAt'],'include':_0x2e3fcb[_0x0df7('0x43')][_0x0df7('0x72')]?[{'model':db[_0x0df7('0x98')],'as':_0x0df7('0x99')}]:undefined})['then'](handleEntityNotFound(_0x169320,null))[_0x0df7('0x22')](function(_0xa57fff){if(_0xa57fff){var _0x154ad0=_0xa57fff;var _0x37415c={'from':_0x154ad0[_0x0df7('0x95')],'to':_0x154ad0['to'],'subject':_0x154ad0[_0x0df7('0x97')],'html':_0x154ad0[_0x0df7('0x5a')],'headers':{'Date':moment(_0x154ad0[_0x0df7('0x9a')])[_0x0df7('0x7f')](_0x0df7('0x9b'))},'attachments':[]};if(_0xa57fff['cc']){_0x37415c[_0x0df7('0x9c')]['Cc']=_0xa57fff['cc'];}if(_0xa57fff[_0x0df7('0x96')]){_0x37415c[_0x0df7('0x9c')][_0x0df7('0x9d')]=_0xa57fff[_0x0df7('0x96')];}return new BPromise(function(_0x3f6593,_0x9d97ec){if(_0xa57fff['Attachments']){for(var _0x1824e5=0x0;_0x1824e5<_0xa57fff[_0x0df7('0x99')][_0x0df7('0x47')];_0x1824e5++){var _0x4c1b1d=_0xa57fff[_0x0df7('0x99')][_0x1824e5];var _0x579806=path[_0x0df7('0x73')](_0x1f9434,_0x4c1b1d['basename']);if(fs[_0x0df7('0x9e')](_0x579806)){_0x37415c[_0x0df7('0x72')][_0x0df7('0x9f')]({'name':_0x4c1b1d[_0x0df7('0x42')],'contentType':_0x4c1b1d['type'],'data':fs[_0x0df7('0xa0')](_0x579806)});}}}emlformat[_0x0df7('0xa1')](_0x37415c,function(_0x4bf0a9,_0x156e42){if(_0x4bf0a9)return _0x9d97ec(_0x4bf0a9);fs[_0x0df7('0xa2')](path[_0x0df7('0x73')](_0x3798b5,_0x1d9aab),_0x156e42);return _0x3f6593(_0x156e42);});});}})[_0x0df7('0x22')](function(_0x216b8a){if(_0x216b8a){return _0x169320[_0x0df7('0x91')](path[_0x0df7('0x73')](_0x3798b5,_0x1d9aab),_0x1d9aab,function(_0x2d8b9d){if(_0x2d8b9d){console[_0x0df7('0xa3')](_0x0df7('0xa4'),_0x2d8b9d);}else{fs[_0x0df7('0xa5')](path[_0x0df7('0x73')](_0x3798b5,_0x1d9aab));}});}})[_0x0df7('0x54')](handleError(_0x169320,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index c4ba222..4b29d17 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 _0x1c36=['../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1c36,0x1cb));var _0x61c3=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x1c36[_0x5627e1];return _0x2f013f;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x61c3('0x0'))['db'][_0x61c3('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x61c3('0x2'),'afterUpdate':_0x61c3('0x3'),'afterDestroy':_0x61c3('0x4')};function emitEvent(_0x2a7509){return function(_0x547149,_0x2a4905,_0x223ef5){MailMessageEvents[_0x61c3('0x5')](_0x2a7509+':'+_0x547149['id'],_0x547149);MailMessageEvents[_0x61c3('0x5')](_0x2a7509,_0x547149);_0x223ef5(null);};}for(var e in events){if(events[_0x61c3('0x6')](e)){var event=events[e];MailMessage[_0x61c3('0x7')](e,emitEvent(event));}}module[_0x61c3('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x67ed=['remove','emit','hasOwnProperty','hook','events','MailMessage','setMaxListeners','save','update'];(function(_0x2e6b97,_0x23c3f2){var _0x55c2af=function(_0x5f20c8){while(--_0x5f20c8){_0x2e6b97['push'](_0x2e6b97['shift']());}};_0x55c2af(++_0x23c3f2);}(_0x67ed,0x70));var _0xd67e=function(_0x1ea6b9,_0x46fbfb){_0x1ea6b9=_0x1ea6b9-0x0;var _0x2c9b37=_0x67ed[_0x1ea6b9];return _0x2c9b37;};'use strict';var EventEmitter=require(_0xd67e('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xd67e('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd67e('0x2')](0x0);var events={'afterCreate':_0xd67e('0x3'),'afterUpdate':_0xd67e('0x4'),'afterDestroy':_0xd67e('0x5')};function emitEvent(_0xbc5774){return function(_0x33a6a4,_0x59acdd,_0x5548d9){MailMessageEvents['emit'](_0xbc5774+':'+_0x33a6a4['id'],_0x33a6a4);MailMessageEvents[_0xd67e('0x6')](_0xbc5774,_0x33a6a4);_0x5548d9(null);};}for(var e in events){if(events[_0xd67e('0x7')](e)){var event=events[e];MailMessage[_0xd67e('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e087f6d..07dbbb5 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 _0x1a10=['toLowerCase','out','isNil','UserId','MailInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString'];(function(_0x498381,_0x122bfc){var _0x7e0ae8=function(_0x5b3414){while(--_0x5b3414){_0x498381['push'](_0x498381['shift']());}};_0x7e0ae8(++_0x122bfc);}(_0x1a10,0xd2));var _0x01a1=function(_0x76fa2,_0x5630d7){_0x76fa2=_0x76fa2-0x0;var _0x4fe756=_0x1a10[_0x76fa2];return _0x4fe756;};'use strict';var _=require(_0x01a1('0x0'));var util=require(_0x01a1('0x1'));var logger=require('../../config/logger')(_0x01a1('0x2'));var moment=require(_0x01a1('0x3'));var BPromise=require(_0x01a1('0x4'));var rp=require(_0x01a1('0x5'));var htmlToText=require(_0x01a1('0x6'));var fs=require('fs');var path=require(_0x01a1('0x7'));var rimraf=require(_0x01a1('0x8'));var config=require(_0x01a1('0x9'));var attributes=require(_0x01a1('0xa'));module[_0x01a1('0xb')]=function(_0x16ffbc,_0x563310){return _0x16ffbc[_0x01a1('0xc')](_0x01a1('0xd'),attributes,{'tableName':_0x01a1('0xe'),'paranoid':![],'indexes':[{'name':_0x01a1('0xf'),'fields':[_0x01a1('0xf')]},{'name':_0x01a1('0x10'),'fields':[_0x01a1('0x11'),_0x01a1('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ab2b2,_0x5ea1e7,_0x13c051){if(_0x3ab2b2[_0x01a1('0x13')]){_0x3ab2b2[_0x01a1('0x11')]=htmlToText[_0x01a1('0x14')](_0x3ab2b2[_0x01a1('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x13c051(null,_0x5ea1e7);},'afterCreate':function(_0x30f53a,_0x134424,_0x264242){var _0xd45fad=_0x16ffbc['models'];var _0xfedfba=_0x30f53a['get']({'plain':!![]});if(_0xfedfba['direction'][_0x01a1('0x15')]()==='in'||_0xfedfba['direction']['toLowerCase']()===_0x01a1('0x16')&&!_0xfedfba['secret']&&!_[_0x01a1('0x17')](_0xfedfba[_0x01a1('0x18')])){_0xd45fad[_0x01a1('0x19')][_0x01a1('0x1a')]({'where':{'id':_0xfedfba['MailInteractionId']}})[_0x01a1('0x1b')](function(_0x987aff){if(_0x987aff){_0x987aff[_0x01a1('0x1c')]({'lastMsgAt':_0xfedfba['createdAt'],'lastMsgDirection':_0xfedfba['direction'][_0x01a1('0x15')](),'lastMsgBody':_0xfedfba[_0x01a1('0x13')]});}})[_0x01a1('0x1d')](function(_0x8125b6){console[_0x01a1('0x1e')](_0x8125b6);});}_0x264242();}},'charset':_0x01a1('0x1f'),'collate':_0x01a1('0x20')});}; \ No newline at end of file +var _0x2d84=['html-to-text','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x1ead2f,_0x4e5e24){var _0x1ad21d=function(_0x1f5ed3){while(--_0x1f5ed3){_0x1ead2f['push'](_0x1ead2f['shift']());}};_0x1ad21d(++_0x4e5e24);}(_0x2d84,0x181));var _0x42d8=function(_0x20b545,_0x4bba7c){_0x20b545=_0x20b545-0x0;var _0x1baaae=_0x2d84[_0x20b545];return _0x1baaae;};'use strict';var _=require('lodash');var util=require(_0x42d8('0x0'));var logger=require(_0x42d8('0x1'))(_0x42d8('0x2'));var moment=require(_0x42d8('0x3'));var BPromise=require(_0x42d8('0x4'));var rp=require('request-promise');var htmlToText=require(_0x42d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42d8('0x6'));var config=require('../../config/environment');var attributes=require(_0x42d8('0x7'));module[_0x42d8('0x8')]=function(_0x5d99b5,_0x4bab67){return _0x5d99b5[_0x42d8('0x9')](_0x42d8('0xa'),attributes,{'tableName':_0x42d8('0xb'),'paranoid':![],'indexes':[{'name':_0x42d8('0xc'),'fields':[_0x42d8('0xc')]},{'name':_0x42d8('0xd'),'fields':[_0x42d8('0xe'),'subject'],'type':_0x42d8('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x70a5a1,_0x585f7c,_0x2acb5c){if(_0x70a5a1[_0x42d8('0x10')]){_0x70a5a1[_0x42d8('0xe')]=htmlToText[_0x42d8('0x11')](_0x70a5a1[_0x42d8('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2acb5c(null,_0x585f7c);},'afterCreate':function(_0x2fcfd9,_0x5d4fcb,_0x2c7104){var _0x2f8e1c=_0x5d99b5[_0x42d8('0x12')];var _0x5733f7=_0x2fcfd9[_0x42d8('0x13')]({'plain':!![]});if(_0x5733f7[_0x42d8('0x14')][_0x42d8('0x15')]()==='in'||_0x5733f7[_0x42d8('0x14')][_0x42d8('0x15')]()===_0x42d8('0x16')&&!_0x5733f7[_0x42d8('0x17')]&&!_[_0x42d8('0x18')](_0x5733f7['UserId'])){_0x2f8e1c['MailInteraction']['findOne']({'where':{'id':_0x5733f7['MailInteractionId']}})['then'](function(_0x47bd11){if(_0x47bd11){_0x47bd11[_0x42d8('0x19')]({'lastMsgAt':_0x5733f7[_0x42d8('0x1a')],'lastMsgDirection':_0x5733f7[_0x42d8('0x14')][_0x42d8('0x15')](),'lastMsgBody':_0x5733f7[_0x42d8('0x10')]});}})['catch'](function(_0x8a19ab){console[_0x42d8('0x1b')](_0x8a19ab);});}_0x2c7104();}},'charset':_0x42d8('0x1c'),'collate':_0x42d8('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 2203256..8b74a91 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 _0x677a=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','moment','bluebird'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x677a,0xd6));var _0xa677=function(_0x27f87b,_0x52af51){_0x27f87b=_0x27f87b-0x0;var _0x410e0a=_0x677a[_0x27f87b];return _0x410e0a;};'use strict';var _=require(_0xa677('0x0'));var util=require('util');var moment=require(_0xa677('0x1'));var BPromise=require(_0xa677('0x2'));var rs=require(_0xa677('0x3'));var fs=require('fs');var Redis=require(_0xa677('0x4'));var db=require(_0xa677('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa677('0x6'))(_0xa677('0x7'));var config=require(_0xa677('0x8'));var jayson=require(_0xa677('0x9'));var client=jayson[_0xa677('0xa')]['http']({'port':0x232a});config[_0xa677('0xb')]=_[_0xa677('0xc')](config[_0xa677('0xb')],{'host':_0xa677('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0xa677('0xe')](socket);function respondWithRpcPromise(_0x4c9e8c,_0x3e5e2c,_0x1d6586){return new BPromise(function(_0x5d2451,_0xead831){return client[_0xa677('0xf')](_0x4c9e8c,_0x1d6586)[_0xa677('0x10')](function(_0x96f98d){logger['info'](_0xa677('0x11'),_0x3e5e2c,_0xa677('0x12'));logger[_0xa677('0x13')](_0xa677('0x14'),_0x3e5e2c,'request\x20sent',JSON[_0xa677('0x15')](_0x96f98d));if(_0x96f98d['error']){if(_0x96f98d[_0xa677('0x16')][_0xa677('0x17')]===0x1f4){logger[_0xa677('0x16')](_0xa677('0x11'),_0x3e5e2c,_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);return _0xead831(_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);}logger[_0xa677('0x16')](_0xa677('0x11'),_0x3e5e2c,_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);return _0x5d2451(_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);}else{logger['info'](_0xa677('0x11'),_0x3e5e2c,_0xa677('0x12'));_0x5d2451(_0x96f98d['result']['message']);}})[_0xa677('0x19')](function(_0x73350){logger[_0xa677('0x16')](_0xa677('0x11'),_0x3e5e2c,_0x73350);_0xead831(_0x73350);});});}exports['CreateMailMessage']=function(_0x2eab12){var _0x2122ac=this;return new Promise(function(_0xad957e,_0x44de05){return db[_0xa677('0x1a')][_0xa677('0x1b')](_0x2eab12['body'],{'raw':_0x2eab12[_0xa677('0x1c')]?_0x2eab12['options'][_0xa677('0x1d')]===undefined?!![]:![]:!![]})[_0xa677('0x10')](function(_0x45eb0f){logger['info'](_0xa677('0x1e'),_0x2eab12);logger[_0xa677('0x13')](_0xa677('0x1e'),_0x2eab12,JSON[_0xa677('0x15')](_0x45eb0f));_0xad957e(_0x45eb0f);})['catch'](function(_0x1aa82b){logger[_0xa677('0x16')]('CreateMailMessage',_0x1aa82b[_0xa677('0x18')],_0x2eab12);_0x44de05(_0x2122ac[_0xa677('0x16')](0x1f4,_0x1aa82b[_0xa677('0x18')]));});});}; \ No newline at end of file +var _0x042a=['request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','MailMessage','create','body','options','raw','then','CreateMailMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailMessage.socket','register'];(function(_0x114bdf,_0x119ada){var _0x5658f6=function(_0xff3dc){while(--_0xff3dc){_0x114bdf['push'](_0x114bdf['shift']());}};_0x5658f6(++_0x119ada);}(_0x042a,0x1d9));var _0xa042=function(_0x2b8aa7,_0xe29311){_0x2b8aa7=_0x2b8aa7-0x0;var _0x37ce35=_0x042a[_0x2b8aa7];return _0x37ce35;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var moment=require(_0xa042('0x1'));var BPromise=require(_0xa042('0x2'));var rs=require(_0xa042('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa042('0x4'))['db'];var utils=require(_0xa042('0x5'));var logger=require(_0xa042('0x6'))(_0xa042('0x7'));var config=require(_0xa042('0x8'));var jayson=require(_0xa042('0x9'));var client=jayson[_0xa042('0xa')][_0xa042('0xb')]({'port':0x232a});config['redis']=_[_0xa042('0xc')](config[_0xa042('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa042('0xe'))(new Redis(config['redis']));require(_0xa042('0xf'))[_0xa042('0x10')](socket);function respondWithRpcPromise(_0x15426e,_0x2f195a,_0x172c37){return new BPromise(function(_0x2146f3,_0x550ee2){return client[_0xa042('0x11')](_0x15426e,_0x172c37)['then'](function(_0x411e3c){logger['info'](_0xa042('0x12'),_0x2f195a,_0xa042('0x13'));logger[_0xa042('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2f195a,_0xa042('0x13'),JSON[_0xa042('0x15')](_0x411e3c));if(_0x411e3c[_0xa042('0x16')]){if(_0x411e3c['error'][_0xa042('0x17')]===0x1f4){logger[_0xa042('0x16')](_0xa042('0x12'),_0x2f195a,_0x411e3c[_0xa042('0x16')]['message']);return _0x550ee2(_0x411e3c[_0xa042('0x16')][_0xa042('0x18')]);}logger[_0xa042('0x16')](_0xa042('0x12'),_0x2f195a,_0x411e3c[_0xa042('0x16')][_0xa042('0x18')]);return _0x2146f3(_0x411e3c['error']['message']);}else{logger[_0xa042('0x19')](_0xa042('0x12'),_0x2f195a,_0xa042('0x13'));_0x2146f3(_0x411e3c[_0xa042('0x1a')][_0xa042('0x18')]);}})[_0xa042('0x1b')](function(_0x42f2e4){logger['error']('MailMessage,\x20%s,\x20%s',_0x2f195a,_0x42f2e4);_0x550ee2(_0x42f2e4);});});}exports['CreateMailMessage']=function(_0x57fc35){var _0x52d815=this;return new Promise(function(_0x1f5f41,_0x16319e){return db[_0xa042('0x1c')][_0xa042('0x1d')](_0x57fc35[_0xa042('0x1e')],{'raw':_0x57fc35[_0xa042('0x1f')]?_0x57fc35['options'][_0xa042('0x20')]===undefined?!![]:![]:!![]})[_0xa042('0x21')](function(_0x3e164f){logger[_0xa042('0x19')]('CreateMailMessage',_0x57fc35);logger[_0xa042('0x14')](_0xa042('0x22'),_0x57fc35,JSON[_0xa042('0x15')](_0x3e164f));_0x1f5f41(_0x3e164f);})[_0xa042('0x1b')](function(_0x1561f3){logger[_0xa042('0x16')](_0xa042('0x22'),_0x1561f3[_0xa042('0x18')],_0x57fc35);_0x16319e(_0x52d815[_0xa042('0x16')](0x1f4,_0x1561f3[_0xa042('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5c59e15..1bac4ca 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 _0x854a=['register','mailMessage:','./mailMessage.events','save','update','removeListener'];(function(_0x4fd507,_0x375e66){var _0x157917=function(_0xd97dd8){while(--_0xd97dd8){_0x4fd507['push'](_0x4fd507['shift']());}};_0x157917(++_0x375e66);}(_0x854a,0x1e8));var _0xa854=function(_0x39cba9,_0x4e0f68){_0x39cba9=_0x39cba9-0x0;var _0x32a89e=_0x854a[_0x39cba9];return _0x32a89e;};'use strict';var MailMessageEvents=require(_0xa854('0x0'));var events=[_0xa854('0x1'),'remove',_0xa854('0x2')];function createListener(_0xefccb6,_0x4c3191){return function(_0x506d4e){_0x4c3191['emit'](_0xefccb6,_0x506d4e);};}function removeListener(_0x4c912f,_0x540564){return function(){MailMessageEvents[_0xa854('0x3')](_0x4c912f,_0x540564);};}exports[_0xa854('0x4')]=function(_0x10050d){for(var _0x3456f2=0x0,_0x3e26f6=events['length'];_0x3456f2<_0x3e26f6;_0x3456f2++){var _0x55a0cb=events[_0x3456f2];var _0x5150fc=createListener(_0xa854('0x5')+_0x55a0cb,_0x10050d);MailMessageEvents['on'](_0x55a0cb,_0x5150fc);}}; \ No newline at end of file +var _0xace5=['remove','removeListener','register','length','mailMessage:','save'];(function(_0x3c5aa6,_0x4c4f86){var _0x49e397=function(_0x37004d){while(--_0x37004d){_0x3c5aa6['push'](_0x3c5aa6['shift']());}};_0x49e397(++_0x4c4f86);}(_0xace5,0x1df));var _0x5ace=function(_0x327079,_0x30f0d0){_0x327079=_0x327079-0x0;var _0x2f30ab=_0xace5[_0x327079];return _0x2f30ab;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x5ace('0x0'),_0x5ace('0x1'),'update'];function createListener(_0x4f9426,_0x5b18b2){return function(_0x35b72a){_0x5b18b2['emit'](_0x4f9426,_0x35b72a);};}function removeListener(_0x3bbadc,_0x478f15){return function(){MailMessageEvents[_0x5ace('0x2')](_0x3bbadc,_0x478f15);};}exports[_0x5ace('0x3')]=function(_0x12a832){for(var _0x53ffe7=0x0,_0x2c22e1=events[_0x5ace('0x4')];_0x53ffe7<_0x2c22e1;_0x53ffe7++){var _0xf5a570=events[_0x53ffe7];var _0x4cf63e=createListener(_0x5ace('0x5')+_0xf5a570,_0x12a832);MailMessageEvents['on'](_0xf5a570,_0x4cf63e);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index fbb55bd..e992fed 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 _0x9395=['express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','/:id/users','addAgents','put','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0x2ef714,_0x49e1c4){var _0x252ab0=function(_0x868e73){while(--_0x868e73){_0x2ef714['push'](_0x2ef714['shift']());}};_0x252ab0(++_0x49e1c4);}(_0x9395,0x114));var _0x5939=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9395[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5939('0x0'));var util=require(_0x5939('0x1'));var path=require(_0x5939('0x2'));var timeout=require(_0x5939('0x3'));var express=require(_0x5939('0x4'));var router=express[_0x5939('0x5')]();var auth=require(_0x5939('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5939('0x7'));var controller=require('./mailQueue.controller');router[_0x5939('0x8')]('/',auth['isAuthenticated'](),controller[_0x5939('0x9')]);router[_0x5939('0x8')](_0x5939('0xa'),auth[_0x5939('0xb')](),controller['describe']);router[_0x5939('0x8')](_0x5939('0xc'),auth[_0x5939('0xb')](),controller[_0x5939('0xd')]);router[_0x5939('0x8')](_0x5939('0xe'),auth['isAuthenticated'](),controller[_0x5939('0xf')]);router[_0x5939('0x8')](_0x5939('0x10'),auth['isAuthenticated'](),controller[_0x5939('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x5939('0x12')]);router[_0x5939('0x13')]('/',auth[_0x5939('0xb')](),controller['create']);router[_0x5939('0x13')](_0x5939('0x10'),auth[_0x5939('0xb')](),controller['addTeams']);router[_0x5939('0x13')](_0x5939('0x14'),auth[_0x5939('0xb')](),controller[_0x5939('0x15')]);router[_0x5939('0x16')](_0x5939('0xc'),auth[_0x5939('0xb')](),controller[_0x5939('0x17')]);router['delete'](_0x5939('0xc'),auth['isAuthenticated'](),controller[_0x5939('0x18')]);router[_0x5939('0x19')](_0x5939('0x10'),auth[_0x5939('0xb')](),controller[_0x5939('0x1a')]);router['delete'](_0x5939('0x14'),auth[_0x5939('0xb')](),controller['removeAgents']);module[_0x5939('0x1b')]=router; \ No newline at end of file +var _0xbe7c=['post','create','addTeams','/:id/users','addAgents','destroy','delete','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe7c,0xfc));var _0xcbe7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe7c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xcbe7('0x0'));var path=require(_0xcbe7('0x1'));var timeout=require(_0xcbe7('0x2'));var express=require(_0xcbe7('0x3'));var router=express[_0xcbe7('0x4')]();var auth=require(_0xcbe7('0x5'));var interaction=require(_0xcbe7('0x6'));var config=require(_0xcbe7('0x7'));var controller=require(_0xcbe7('0x8'));router[_0xcbe7('0x9')]('/',auth[_0xcbe7('0xa')](),controller[_0xcbe7('0xb')]);router[_0xcbe7('0x9')](_0xcbe7('0xc'),auth[_0xcbe7('0xa')](),controller['describe']);router[_0xcbe7('0x9')](_0xcbe7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcbe7('0x9')]('/:id/members',auth[_0xcbe7('0xa')](),controller[_0xcbe7('0xe')]);router[_0xcbe7('0x9')](_0xcbe7('0xf'),auth['isAuthenticated'](),controller[_0xcbe7('0x10')]);router[_0xcbe7('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xcbe7('0x11')]);router[_0xcbe7('0x12')]('/',auth[_0xcbe7('0xa')](),controller[_0xcbe7('0x13')]);router[_0xcbe7('0x12')](_0xcbe7('0xf'),auth[_0xcbe7('0xa')](),controller[_0xcbe7('0x14')]);router[_0xcbe7('0x12')](_0xcbe7('0x15'),auth['isAuthenticated'](),controller[_0xcbe7('0x16')]);router['put'](_0xcbe7('0xd'),auth[_0xcbe7('0xa')](),controller['update']);router['delete'](_0xcbe7('0xd'),auth[_0xcbe7('0xa')](),controller[_0xcbe7('0x17')]);router[_0xcbe7('0x18')]('/:id/teams',auth[_0xcbe7('0xa')](),controller['removeTeams']);router['delete'](_0xcbe7('0x15'),auth[_0xcbe7('0xa')](),controller[_0xcbe7('0x19')]);module[_0xcbe7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e856a49..4b10529 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 _0x2581=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2581,0xcb));var _0x1258=function(_0x1eab07,_0x2676f5){_0x1eab07=_0x1eab07-0x0;var _0x588016=_0x2581[_0x1eab07];return _0x588016;};'use strict';var Sequelize=require(_0x1258('0x0'));module[_0x1258('0x1')]={'name':{'type':Sequelize[_0x1258('0x2')],'unique':_0x1258('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1258('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1258('0x4')](_0x1258('0x5'),_0x1258('0x6'),_0x1258('0x7'))}}; \ No newline at end of file +var _0x955f=['exports','STRING','name','ENUM','roundrobin','sequelize'];(function(_0x4f67f9,_0x1a5be6){var _0x3338fa=function(_0x214300){while(--_0x214300){_0x4f67f9['push'](_0x4f67f9['shift']());}};_0x3338fa(++_0x1a5be6);}(_0x955f,0x1eb));var _0xf955=function(_0x29ae4c,_0x43ddb7){_0x29ae4c=_0x29ae4c-0x0;var _0x408ccd=_0x955f[_0x29ae4c];return _0x408ccd;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')],'unique':_0xf955('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf955('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf955('0x4')]('rrmemory','beepall',_0xf955('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6633dbd..c54ed40 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 _0x07e3=['send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','MailQueue','includeAll','include','findAll','rows','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','order','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','value','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','MailQueues','UserProfileResource','end','error','stack','name'];(function(_0xb23bfe,_0x54c0ce){var _0xe3d28e=function(_0x44e000){while(--_0x44e000){_0xb23bfe['push'](_0xb23bfe['shift']());}};_0xe3d28e(++_0x54c0ce);}(_0x07e3,0xed));var _0x307e=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x07e3[_0xbe40ad];return _0x50fac9;};'use strict';var pdf=require(_0x307e('0x0'));var emlformat=require(_0x307e('0x1'));var rimraf=require(_0x307e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x307e('0x3'));var rp=require(_0x307e('0x4'));var moment=require(_0x307e('0x5'));var BPromise=require(_0x307e('0x6'));var Mustache=require(_0x307e('0x7'));var util=require(_0x307e('0x8'));var path=require(_0x307e('0x9'));var sox=require('sox');var csv=require(_0x307e('0xa'));var ejs=require(_0x307e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x307e('0xc'));var crypto=require('crypto');var jsforce=require(_0x307e('0xd'));var deskjs=require(_0x307e('0xe'));var toCsv=require(_0x307e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x307e('0xf'));var authService=require(_0x307e('0x10'));var qs=require(_0x307e('0x11'));var as=require(_0x307e('0x12'));var hardwareService=require(_0x307e('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x307e('0x14'));var db=require(_0x307e('0x15'))['db'];config[_0x307e('0x16')]=_[_0x307e('0x17')](config[_0x307e('0x16')],{'host':_0x307e('0x18'),'port':0x18eb});var socket=require(_0x307e('0x19'))(new Redis(config[_0x307e('0x16')]));require(_0x307e('0x1a'))[_0x307e('0x1b')](socket);function respondWithStatusCode(_0x111b90,_0x55a7b9){_0x55a7b9=_0x55a7b9||0xcc;return function(_0x54f861){if(_0x54f861){return _0x111b90[_0x307e('0x1c')](_0x55a7b9);}return _0x111b90['status'](_0x55a7b9)['end']();};}function respondWithResult(_0xd79bd4,_0x22317b){_0x22317b=_0x22317b||0xc8;return function(_0x5f0c8c){if(_0x5f0c8c){return _0xd79bd4[_0x307e('0x1d')](_0x22317b)['json'](_0x5f0c8c);}};}function respondWithFilteredResult(_0x3756cb,_0x4de828){return function(_0x4a7f8e){if(_0x4a7f8e){var _0xb5906e=_0x4a7f8e[_0x307e('0x1e')],_0x12e3f7=_0x4de828['offset'],_0x4ee549=_0x4de828[_0x307e('0x1f')]+_0x4de828[_0x307e('0x20')],_0x57ad10;if(_0x4ee549>=_0xb5906e){_0x4ee549=_0xb5906e;_0x57ad10=0xc8;}else{_0x57ad10=0xce;}_0x3756cb[_0x307e('0x1d')](_0x57ad10);return _0x3756cb[_0x307e('0x21')](_0x307e('0x22'),_0x12e3f7+'-'+_0x4ee549+'/'+_0xb5906e)[_0x307e('0x23')](_0x4a7f8e);}return null;};}function patchUpdates(_0x8fe150){return function(_0x5b2981){try{jsonpatch['apply'](_0x5b2981,_0x8fe150,!![]);}catch(_0x299a38){return BPromise[_0x307e('0x24')](_0x299a38);}return _0x5b2981[_0x307e('0x25')]();};}function saveUpdates(_0x268c79,_0x2d388){return function(_0x28ed9d){if(_0x28ed9d){return _0x28ed9d[_0x307e('0x26')](_0x268c79)[_0x307e('0x27')](function(_0x32c97e){return _0x32c97e;});}return null;};}function removeEntity(_0x6929c0,_0xba9bc){return function(_0x22e614){if(_0x22e614){return _0x22e614[_0x307e('0x28')]()['then'](function(){var _0x334f8f=_0x22e614['get']({'plain':!![]});var _0x39a44c=_0x307e('0x29');return db[_0x307e('0x2a')][_0x307e('0x28')]({'where':{'type':_0x39a44c,'resourceId':_0x334f8f['id']}})[_0x307e('0x27')](function(){return _0x22e614;});})['then'](function(){_0x6929c0['status'](0xcc)[_0x307e('0x2b')]();});}};}function handleEntityNotFound(_0x27c6bb,_0x7f88a1){return function(_0x2d2e9c){if(!_0x2d2e9c){_0x27c6bb['sendStatus'](0x194);}return _0x2d2e9c;};}function handleError(_0x32393b,_0x56b9c5){_0x56b9c5=_0x56b9c5||0x1f4;return function(_0x3725b6){logger[_0x307e('0x2c')](_0x3725b6[_0x307e('0x2d')]);if(_0x3725b6[_0x307e('0x2e')]){delete _0x3725b6[_0x307e('0x2e')];}_0x32393b['status'](_0x56b9c5)[_0x307e('0x2f')](_0x3725b6);};}exports['index']=function(_0x2fc146,_0x6cff33){var _0x5e9755={},_0x18b7bc={},_0x1de137={'count':0x0,'rows':[]};var _0x42b02c=_[_0x307e('0x30')](db['MailQueue'][_0x307e('0x31')],function(_0x43b95c){return{'name':_0x43b95c[_0x307e('0x32')],'type':_0x43b95c['type'][_0x307e('0x33')]};});_0x18b7bc[_0x307e('0x34')]=_['map'](_0x42b02c,_0x307e('0x2e'));_0x18b7bc['query']=_[_0x307e('0x35')](_0x2fc146[_0x307e('0x36')]);_0x18b7bc[_0x307e('0x37')]=_[_0x307e('0x38')](_0x18b7bc[_0x307e('0x34')],_0x18b7bc[_0x307e('0x36')]);_0x5e9755['attributes']=_['intersection'](_0x18b7bc[_0x307e('0x34')],qs[_0x307e('0x39')](_0x2fc146['query'][_0x307e('0x39')]));_0x5e9755[_0x307e('0x3a')]=_0x5e9755[_0x307e('0x3a')][_0x307e('0x3b')]?_0x5e9755[_0x307e('0x3a')]:_0x18b7bc[_0x307e('0x34')];if(!_0x2fc146[_0x307e('0x36')][_0x307e('0x3c')](_0x307e('0x3d'))){_0x5e9755['limit']=qs[_0x307e('0x20')](_0x2fc146['query'][_0x307e('0x20')]);_0x5e9755[_0x307e('0x1f')]=qs[_0x307e('0x1f')](_0x2fc146[_0x307e('0x36')]['offset']);}_0x5e9755['order']=qs['sort'](_0x2fc146[_0x307e('0x36')][_0x307e('0x3e')]);_0x5e9755[_0x307e('0x3f')]=qs[_0x307e('0x37')](_['pick'](_0x2fc146[_0x307e('0x36')],_0x18b7bc[_0x307e('0x37')]),_0x42b02c);if(_0x2fc146[_0x307e('0x36')][_0x307e('0x40')]){_0x5e9755['where']=_['merge'](_0x5e9755[_0x307e('0x3f')],{'$or':_[_0x307e('0x30')](_0x42b02c,function(_0x27af77){if(_0x27af77['type']!=='VIRTUAL'){var _0x3ec956={};_0x3ec956[_0x27af77['name']]={'$like':'%'+_0x2fc146[_0x307e('0x36')][_0x307e('0x40')]+'%'};return _0x3ec956;}})});}_0x5e9755=_[_0x307e('0x41')]({},_0x5e9755,_0x2fc146[_0x307e('0x42')]);var _0x50cc4c={'where':_0x5e9755[_0x307e('0x3f')]};return db[_0x307e('0x43')]['count'](_0x50cc4c)[_0x307e('0x27')](function(_0x3d3a38){_0x1de137[_0x307e('0x1e')]=_0x3d3a38;if(_0x2fc146[_0x307e('0x36')][_0x307e('0x44')]){_0x5e9755[_0x307e('0x45')]=[{'all':!![]}];}return db[_0x307e('0x43')][_0x307e('0x46')](_0x5e9755);})[_0x307e('0x27')](function(_0x4ffe7c){_0x1de137[_0x307e('0x47')]=_0x4ffe7c;return _0x1de137;})[_0x307e('0x27')](respondWithFilteredResult(_0x6cff33,_0x5e9755))[_0x307e('0x48')](handleError(_0x6cff33,null));};exports[_0x307e('0x49')]=function(_0x550ffc,_0x1682fb){var _0xdcb384={'raw':!![],'where':{'id':_0x550ffc['params']['id']}},_0x228ac3={};_0x228ac3[_0x307e('0x34')]=_[_0x307e('0x35')](db[_0x307e('0x43')][_0x307e('0x31')]);_0x228ac3[_0x307e('0x36')]=_['keys'](_0x550ffc[_0x307e('0x36')]);_0x228ac3[_0x307e('0x37')]=_['intersection'](_0x228ac3[_0x307e('0x34')],_0x228ac3[_0x307e('0x36')]);_0xdcb384[_0x307e('0x3a')]=_['intersection'](_0x228ac3[_0x307e('0x34')],qs[_0x307e('0x39')](_0x550ffc[_0x307e('0x36')]['fields']));_0xdcb384[_0x307e('0x3a')]=_0xdcb384[_0x307e('0x3a')][_0x307e('0x3b')]?_0xdcb384[_0x307e('0x3a')]:_0x228ac3['model'];if(_0x550ffc['query'][_0x307e('0x44')]){_0xdcb384[_0x307e('0x45')]=[{'all':!![]}];}_0xdcb384=_[_0x307e('0x41')]({},_0xdcb384,_0x550ffc[_0x307e('0x42')]);return db[_0x307e('0x43')][_0x307e('0x4a')](_0xdcb384)[_0x307e('0x27')](handleEntityNotFound(_0x1682fb,null))[_0x307e('0x27')](respondWithResult(_0x1682fb,null))[_0x307e('0x48')](handleError(_0x1682fb,null));};exports[_0x307e('0x4b')]=function(_0x43ddaf,_0x482fa4){return db[_0x307e('0x43')][_0x307e('0x4b')](_0x43ddaf[_0x307e('0x4c')],{})[_0x307e('0x27')](function(_0x44c280){var _0x96b75f=_0x43ddaf['user'][_0x307e('0x4d')]({'plain':!![]});if(!_0x96b75f)throw new Error(_0x307e('0x4e'));if(_0x96b75f[_0x307e('0x4f')]===_0x307e('0x50')){var _0x104ef7=_0x44c280[_0x307e('0x4d')]({'plain':!![]});var _0xd6dd70=_0x307e('0x29');return db[_0x307e('0x51')][_0x307e('0x4a')]({'where':{'name':_0xd6dd70,'userProfileId':_0x96b75f['userProfileId']},'raw':!![]})[_0x307e('0x27')](function(_0x2d8a87){if(_0x2d8a87&&_0x2d8a87[_0x307e('0x52')]===0x0){return db[_0x307e('0x2a')]['create']({'name':_0x104ef7[_0x307e('0x2e')],'resourceId':_0x104ef7['id'],'type':_0x2d8a87['name'],'sectionId':_0x2d8a87['id']},{})['then'](function(){return _0x44c280;});}else{return _0x44c280;}})[_0x307e('0x48')](function(_0xc87b29){logger[_0x307e('0x2c')](_0x307e('0x53'),_0xc87b29);throw _0xc87b29;});}return _0x44c280;})[_0x307e('0x27')](respondWithResult(_0x482fa4,0xc9))[_0x307e('0x48')](handleError(_0x482fa4,null));};exports[_0x307e('0x26')]=function(_0x2b50b9,_0xee601c){if(_0x2b50b9['body']['id']){delete _0x2b50b9['body']['id'];}return db['MailQueue'][_0x307e('0x4a')]({'where':{'id':_0x2b50b9[_0x307e('0x54')]['id']}})[_0x307e('0x27')](handleEntityNotFound(_0xee601c,null))[_0x307e('0x27')](saveUpdates(_0x2b50b9[_0x307e('0x4c')],null))[_0x307e('0x27')](respondWithResult(_0xee601c,null))['catch'](handleError(_0xee601c,null));};exports[_0x307e('0x28')]=function(_0x337ba8,_0x188999){return db['MailQueue'][_0x307e('0x4a')]({'where':{'id':_0x337ba8[_0x307e('0x54')]['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x188999,null))['then'](removeEntity(_0x188999,null))['catch'](handleError(_0x188999,null));};exports[_0x307e('0x55')]=function(_0xb843a9,_0x43d163){return db[_0x307e('0x43')][_0x307e('0x55')]()['then'](respondWithResult(_0x43d163,null))[_0x307e('0x48')](handleError(_0x43d163,null));};exports['getMembers']=function(_0x94ee1b,_0x19b86e,_0x2cee4f){var _0x6e0f39={'raw':!![],'where':{}},_0x5ab580={},_0x10fb34;return db[_0x307e('0x43')][_0x307e('0x56')]({'where':{'id':_0x94ee1b['params']['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x19b86e,null))[_0x307e('0x27')](function(_0x40fb97){if(_0x40fb97){_0x10fb34=_0x40fb97[_0x307e('0x4d')]({'plain':!![]});_0x5ab580['model']=_[_0x307e('0x35')](db[_0x307e('0x57')]['rawAttributes']);_0x5ab580[_0x307e('0x36')]=_[_0x307e('0x35')](_0x94ee1b['query']);_0x5ab580[_0x307e('0x37')]=_[_0x307e('0x38')](_0x5ab580[_0x307e('0x34')],_0x5ab580[_0x307e('0x36')]);_0x6e0f39[_0x307e('0x3a')]=_[_0x307e('0x38')](_0x5ab580[_0x307e('0x34')],qs[_0x307e('0x39')](_0x94ee1b[_0x307e('0x36')]['fields']));_0x6e0f39['attributes']=_0x6e0f39[_0x307e('0x3a')]['length']?_0x6e0f39[_0x307e('0x3a')]:_0x5ab580[_0x307e('0x34')];if(!_0x94ee1b['query'][_0x307e('0x3c')](_0x307e('0x3d'))){_0x6e0f39[_0x307e('0x20')]=qs[_0x307e('0x20')](_0x94ee1b['query'][_0x307e('0x20')]);_0x6e0f39[_0x307e('0x1f')]=qs['offset'](_0x94ee1b[_0x307e('0x36')]['offset']);}_0x6e0f39['order']=qs['sort'](_0x94ee1b[_0x307e('0x36')][_0x307e('0x3e')]);_0x6e0f39[_0x307e('0x3f')]=qs['filters'](_['pick'](_0x94ee1b['query'],_0x5ab580[_0x307e('0x37')]));_0x6e0f39[_0x307e('0x3f')][_0x307e('0x58')]=_0x40fb97['id'];if(_0x94ee1b[_0x307e('0x36')][_0x307e('0x40')]){_0x6e0f39[_0x307e('0x3f')]=_[_0x307e('0x41')](_0x6e0f39[_0x307e('0x3f')],{'$or':_[_0x307e('0x30')](_0x6e0f39[_0x307e('0x3a')],function(_0x402d77){var _0x53d5f7={};_0x53d5f7[_0x402d77]={'$like':'%'+_0x94ee1b[_0x307e('0x36')][_0x307e('0x40')]+'%'};return _0x53d5f7;})});}_0x6e0f39=_['merge']({},_0x6e0f39,_0x94ee1b[_0x307e('0x42')]);return db[_0x307e('0x57')][_0x307e('0x46')](_0x6e0f39);}})[_0x307e('0x27')](function(_0x471091){if(_0x471091){return db[_0x307e('0x59')][_0x307e('0x5a')]({'where':{'id':_[_0x307e('0x30')](_0x471091,_0x307e('0x5b')),'role':'agent'},'attributes':['id',_0x307e('0x2e'),_0x307e('0x5c'),'updatedAt',_0x307e('0x5d')]});}})[_0x307e('0x27')](function(_0x206c93){if(_0x206c93){return{'count':_0x206c93[_0x307e('0x1e')],'rows':_[_0x307e('0x30')](_0x206c93[_0x307e('0x47')],function(_0x31149d){return{'membername':_0x31149d[_0x307e('0x2e')],'UserId':_0x31149d['id'],'queue_name':_0x10fb34[_0x307e('0x2e')],'MailQueueId':_0x10fb34['id'],'interface':util[_0x307e('0x5e')](_0x307e('0x5f'),_0x307e('0x60'),_0x31149d['name']),'penalty':0x0,'paused':_0x31149d[_0x307e('0x5c')],'createdAt':_0x31149d[_0x307e('0x5d')],'updatedAt':_0x31149d[_0x307e('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x307e('0x27')](respondWithFilteredResult(_0x19b86e,_0x6e0f39))[_0x307e('0x48')](handleError(_0x19b86e,null));};exports[_0x307e('0x62')]=function(_0x5a2ef0,_0x2b4489,_0x2de5ba){var _0x449322={};var _0x3290f1={};var _0x1b4ec2;var _0x1406dc;return db['MailQueue'][_0x307e('0x56')]({'where':{'id':_0x5a2ef0[_0x307e('0x54')]['id']}})['then'](handleEntityNotFound(_0x2b4489,null))[_0x307e('0x27')](function(_0x87e700){if(_0x87e700){_0x1b4ec2=_0x87e700;_0x3290f1['model']=_[_0x307e('0x35')](db[_0x307e('0x63')][_0x307e('0x31')]);_0x3290f1[_0x307e('0x36')]=_['keys'](_0x5a2ef0[_0x307e('0x36')]);_0x3290f1[_0x307e('0x37')]=_['intersection'](_0x3290f1[_0x307e('0x34')],_0x3290f1[_0x307e('0x36')]);_0x449322['attributes']=_['intersection'](_0x3290f1[_0x307e('0x34')],qs[_0x307e('0x39')](_0x5a2ef0[_0x307e('0x36')][_0x307e('0x39')]));_0x449322[_0x307e('0x3a')]=_0x449322[_0x307e('0x3a')]['length']?_0x449322[_0x307e('0x3a')]:_0x3290f1[_0x307e('0x34')];_0x449322[_0x307e('0x64')]=qs[_0x307e('0x3e')](_0x5a2ef0[_0x307e('0x36')][_0x307e('0x3e')]);_0x449322['where']=qs[_0x307e('0x37')](_[_0x307e('0x65')](_0x5a2ef0[_0x307e('0x36')],_0x3290f1['filters']));if(_0x5a2ef0[_0x307e('0x36')][_0x307e('0x40')]){_0x449322['where']=_[_0x307e('0x41')](_0x449322[_0x307e('0x3f')],{'$or':_[_0x307e('0x30')](_0x449322[_0x307e('0x3a')],function(_0x181af6){var _0xf3e75a={};_0xf3e75a[_0x181af6]={'$like':'%'+_0x5a2ef0[_0x307e('0x36')][_0x307e('0x40')]+'%'};return _0xf3e75a;})});}_0x449322=_['merge']({},_0x449322,_0x5a2ef0[_0x307e('0x42')]);return _0x1b4ec2['getTeams'](_0x449322);}})['then'](function(_0xe038c4){if(_0xe038c4){_0x1406dc=_0xe038c4[_0x307e('0x3b')];if(!_0x5a2ef0[_0x307e('0x36')][_0x307e('0x3c')](_0x307e('0x3d'))){_0x449322['limit']=qs['limit'](_0x5a2ef0[_0x307e('0x36')]['limit']);_0x449322['offset']=qs[_0x307e('0x1f')](_0x5a2ef0['query'][_0x307e('0x1f')]);}return _0x1b4ec2['getTeams'](_0x449322);}})[_0x307e('0x27')](function(_0x2e5514){if(_0x2e5514){return _0x2e5514?{'count':_0x1406dc,'rows':_0x2e5514}:null;}})[_0x307e('0x27')](respondWithResult(_0x2b4489,null))[_0x307e('0x48')](handleError(_0x2b4489,null));};exports[_0x307e('0x66')]=function(_0x3c72f1,_0x5e0efb,_0x59196b){var _0x5280ed=_0x3c72f1['body'][_0x307e('0x67')];return db[_0x307e('0x63')][_0x307e('0x46')]({'where':{'id':_0x5280ed},'attributes':['id'],'include':[{'model':db[_0x307e('0x59')],'as':_0x307e('0x68'),'attributes':['id',_0x307e('0x2e'),_0x307e('0x69'),_0x307e('0x6a'),_0x307e('0x6b')],'raw':!![]}]})[_0x307e('0x27')](function(_0x41501b){if(_0x41501b){var _0x1ec90c=_[_0x307e('0x6c')](_0x41501b,function(_0xee6f60){var _0x2f8e04=_0xee6f60['get']({'plain':!![]});return _0x2f8e04[_0x307e('0x68')];});return db[_0x307e('0x43')][_0x307e('0x4a')]({'where':{'id':_0x3c72f1[_0x307e('0x54')]['id']}})[_0x307e('0x27')](function(_0x58e0f3){return db[_0x307e('0x6d')][_0x307e('0x6e')](function(_0x467dc4){return _0x58e0f3[_0x307e('0x66')](_0x5280ed,{'transaction':_0x467dc4})[_0x307e('0x27')](function(){return BPromise[_0x307e('0x6f')](_0x1ec90c,function(_0x19fcba){return db[_0x307e('0x57')][_0x307e('0x70')]({'where':{'UserId':_0x19fcba['id'],'MailQueueId':_0x3c72f1[_0x307e('0x54')]['id']},'transaction':_0x467dc4});});})['then'](function(){_0x1ec90c[_0x307e('0x71')](function(_0x65359c){socket[_0x307e('0x72')](_0x307e('0x73'),{'UserId':_0x65359c['id'],'MailQueueId':_0x58e0f3['id']});});});});});}})[_0x307e('0x27')](respondWithStatusCode(_0x5e0efb,null))[_0x307e('0x48')](handleError(_0x5e0efb,null));};exports['removeTeams']=function(_0x2f40a1,_0x373857,_0x644d5c){return db[_0x307e('0x63')][_0x307e('0x46')]({'where':{'id':_0x2f40a1[_0x307e('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x307e('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x307e('0x27')](handleEntityNotFound(_0x373857,null))[_0x307e('0x27')](function(_0x1fb4b7){var _0x3a3ede=_[_0x307e('0x30')](_0x1fb4b7,'id');var _0x360d8e=[];var _0x56b382=[];var _0x30076e=squel[_0x307e('0x74')]();_0x30076e[_0x307e('0x75')](_0x307e('0x76'))[_0x307e('0x77')]('team_has_mail_queues','tq')[_0x307e('0x78')](_0x307e('0x79'),'ut',_0x307e('0x7a'))[_0x307e('0x3f')](_0x307e('0x7b'),_0x2f40a1[_0x307e('0x54')]['id']);for(var _0xa2c38b=0x0;_0xa2c38b<_0x1fb4b7['length'];_0xa2c38b+=0x1){let _0x141b19=_0x1fb4b7[_0xa2c38b];for(var _0x5752fa=0x0;_0x5752fa<_0x141b19['Agents'][_0x307e('0x3b')];_0x5752fa+=0x1){let _0x2621a9=_0x141b19[_0x307e('0x68')][_0x5752fa];var _0x46ef58=_0x30076e[_0x307e('0x7c')]();_0x46ef58['where'](_0x307e('0x7d'),_0x2621a9['id']);_0x56b382[_0x307e('0x7e')](db['sequelize']['query'](_0x46ef58['toString'](),{'type':db['sequelize'][_0x307e('0x7f')]['SELECT']})[_0x307e('0x27')](function(_0x45e07f){if(_0x45e07f[_0x307e('0x3b')]===0x1){return _0x2621a9['id'];}else{var _0x320200=_[_0x307e('0x80')](_['map'](_0x45e07f,_0x307e('0x81')),function(_0x1d0307){return _[_0x307e('0x82')](_0x3a3ede,_0x1d0307);});if(_0x320200){return _0x2621a9['id'];}}}));}}return BPromise[_0x307e('0x83')](_0x56b382)['then'](function(_0x37da29){_0x360d8e=_(_0x360d8e)[_0x307e('0x84')](_0x37da29)['compact']()[_0x307e('0x85')]();return db[_0x307e('0x43')][_0x307e('0x4a')]({'where':{'id':_0x2f40a1['params']['id']}})['then'](function(_0x411a33){return db[_0x307e('0x6d')][_0x307e('0x6e')](function(_0x3c01c4){return _0x411a33[_0x307e('0x86')](_0x2f40a1[_0x307e('0x36')][_0x307e('0x67')],{'transaction':_0x3c01c4})[_0x307e('0x27')](function(){if(!_[_0x307e('0x87')](_0x360d8e)){return _0x411a33['removeAgents'](_0x360d8e,{'transaction':_0x3c01c4});}})['then'](function(){_0x360d8e[_0x307e('0x71')](function(_0x1790a3){socket['emit'](_0x307e('0x88'),{'UserId':_0x1790a3,'MailQueueId':_0x411a33['id']});});});});});});})[_0x307e('0x27')](respondWithStatusCode(_0x373857,null))[_0x307e('0x48')](handleError(_0x373857,null));};exports[_0x307e('0x89')]=function(_0x49c906,_0x4a100e,_0xacd01b){return db[_0x307e('0x43')][_0x307e('0x4a')]({'where':{'id':_0x49c906[_0x307e('0x54')]['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x4a100e,null))[_0x307e('0x27')](function(_0x2922f9){if(_0x2922f9){return _0x2922f9[_0x307e('0x89')](_0x49c906['body'][_0x307e('0x67')],_[_0x307e('0x8a')](_0x49c906[_0x307e('0x4c')],[_0x307e('0x67'),'id'])||{})[_0x307e('0x8b')](function(_0x396b53){for(var _0x85503b=0x0;_0x85503b<_0x49c906[_0x307e('0x4c')][_0x307e('0x67')][_0x307e('0x3b')];_0x85503b+=0x1){socket[_0x307e('0x72')](_0x307e('0x73'),{'UserId':_0x49c906['body'][_0x307e('0x67')][_0x85503b],'MailQueueId':_0x49c906['params']['id']});}return _0x396b53;});}})[_0x307e('0x27')](respondWithResult(_0x4a100e,null))[_0x307e('0x48')](handleError(_0x4a100e,null));};exports[_0x307e('0x8c')]=function(_0x4e7d87,_0x39e8e3,_0x1db384){return db['MailQueue'][_0x307e('0x4a')]({'where':{'id':_0x4e7d87[_0x307e('0x54')]['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x39e8e3,null))[_0x307e('0x27')](function(_0x3a3bff){if(_0x3a3bff){return _0x3a3bff[_0x307e('0x8c')](_0x4e7d87[_0x307e('0x36')]['ids'])[_0x307e('0x27')](function(){if(_['isArray'](_0x4e7d87[_0x307e('0x36')][_0x307e('0x67')])){for(var _0x5602c3=0x0;_0x5602c3<_0x4e7d87[_0x307e('0x36')][_0x307e('0x67')][_0x307e('0x3b')];_0x5602c3+=0x1){socket[_0x307e('0x72')](_0x307e('0x88'),{'UserId':Number(_0x4e7d87[_0x307e('0x36')][_0x307e('0x67')][_0x5602c3]),'MailQueueId':Number(_0x4e7d87[_0x307e('0x54')]['id'])});}}else{socket['emit'](_0x307e('0x88'),{'UserId':Number(_0x4e7d87[_0x307e('0x36')][_0x307e('0x67')]),'MailQueueId':Number(_0x4e7d87['params']['id'])});}});}})[_0x307e('0x27')](respondWithStatusCode(_0x39e8e3,null))['catch'](handleError(_0x39e8e3,null));};exports[_0x307e('0x8d')]=function(_0x206765,_0x388704,_0x10578b){var _0x2bc164={};var _0x2cba80={};var _0x5a7e11;var _0x3a5e7d;return db[_0x307e('0x43')]['findOne']({'where':{'id':_0x206765['params']['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x388704,null))[_0x307e('0x27')](function(_0x373b70){if(_0x373b70){_0x5a7e11=_0x373b70;_0x2cba80[_0x307e('0x34')]=_['keys'](db[_0x307e('0x59')][_0x307e('0x31')]);_0x2cba80[_0x307e('0x36')]=_[_0x307e('0x35')](_0x206765[_0x307e('0x36')]);_0x2cba80[_0x307e('0x37')]=_[_0x307e('0x38')](_0x2cba80[_0x307e('0x34')],_0x2cba80['query']);_0x2bc164['attributes']=_[_0x307e('0x38')](_0x2cba80[_0x307e('0x34')],qs['fields'](_0x206765[_0x307e('0x36')]['fields']));_0x2bc164['attributes']=_0x2bc164[_0x307e('0x3a')]['length']?_0x2bc164[_0x307e('0x3a')]:_0x2cba80[_0x307e('0x34')];_0x2bc164[_0x307e('0x64')]=qs[_0x307e('0x3e')](_0x206765['query'][_0x307e('0x3e')]);_0x2bc164['where']=qs[_0x307e('0x37')](_['pick'](_0x206765[_0x307e('0x36')],_0x2cba80[_0x307e('0x37')]));if(_0x206765['query'][_0x307e('0x40')]){_0x2bc164[_0x307e('0x3f')]=_[_0x307e('0x41')](_0x2bc164['where'],{'$or':_['map'](_0x2bc164[_0x307e('0x3a')],function(_0x4e3de1){var _0x10a4a2={};_0x10a4a2[_0x4e3de1]={'$like':'%'+_0x206765[_0x307e('0x36')][_0x307e('0x40')]+'%'};return _0x10a4a2;})});}_0x2bc164=_[_0x307e('0x41')]({},_0x2bc164,_0x206765['options']);return _0x5a7e11[_0x307e('0x8d')](_0x2bc164);}})[_0x307e('0x27')](function(_0x30a990){if(_0x30a990){_0x3a5e7d=_0x30a990[_0x307e('0x3b')];if(!_0x206765[_0x307e('0x36')]['hasOwnProperty'](_0x307e('0x3d'))){_0x2bc164[_0x307e('0x20')]=qs['limit'](_0x206765['query'][_0x307e('0x20')]);_0x2bc164[_0x307e('0x1f')]=qs['offset'](_0x206765[_0x307e('0x36')][_0x307e('0x1f')]);}return _0x5a7e11[_0x307e('0x8d')](_0x2bc164);}})[_0x307e('0x27')](function(_0x15bee){if(_0x15bee){return _0x15bee?{'count':_0x3a5e7d,'rows':_0x15bee}:null;}})['then'](respondWithResult(_0x388704,null))[_0x307e('0x48')](handleError(_0x388704,null));}; \ No newline at end of file +var _0xc265=['getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','MailQueues','end','sendStatus','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','order','sort','MailQueueId','User','UserId','agent','mailPause','updatedAt','%s/%s','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userMailQueue:remove'];(function(_0x42caad,_0x3a0608){var _0x5668f2=function(_0x2e8ff8){while(--_0x2e8ff8){_0x42caad['push'](_0x42caad['shift']());}};_0x5668f2(++_0x3a0608);}(_0xc265,0x19c));var _0x5c26=function(_0x4f0306,_0x5e70d7){_0x4f0306=_0x4f0306-0x0;var _0x1416ac=_0xc265[_0x4f0306];return _0x1416ac;};'use strict';var pdf=require(_0x5c26('0x0'));var emlformat=require(_0x5c26('0x1'));var rimraf=require(_0x5c26('0x2'));var zipdir=require(_0x5c26('0x3'));var jsonpatch=require(_0x5c26('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c26('0x5'));var Mustache=require(_0x5c26('0x6'));var util=require(_0x5c26('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5c26('0x8'));var crypto=require(_0x5c26('0x9'));var jsforce=require(_0x5c26('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5c26('0xb'));var querystring=require('querystring');var Papa=require(_0x5c26('0xc'));var Redis=require(_0x5c26('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5c26('0xe'));var as=require(_0x5c26('0xf'));var hardwareService=require(_0x5c26('0x10'));var logger=require(_0x5c26('0x11'))(_0x5c26('0x12'));var utils=require('../../config/utils');var config=require(_0x5c26('0x13'));var db=require(_0x5c26('0x14'))['db'];config[_0x5c26('0x15')]=_[_0x5c26('0x16')](config[_0x5c26('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c26('0x17'))(new Redis(config['redis']));require(_0x5c26('0x18'))['register'](socket);function respondWithStatusCode(_0x3b2c62,_0x1719cf){_0x1719cf=_0x1719cf||0xcc;return function(_0x5806c6){if(_0x5806c6){return _0x3b2c62['sendStatus'](_0x1719cf);}return _0x3b2c62[_0x5c26('0x19')](_0x1719cf)['end']();};}function respondWithResult(_0x5a7eb0,_0x39db47){_0x39db47=_0x39db47||0xc8;return function(_0x522512){if(_0x522512){return _0x5a7eb0[_0x5c26('0x19')](_0x39db47)[_0x5c26('0x1a')](_0x522512);}};}function respondWithFilteredResult(_0x149a4e,_0x5ceb3a){return function(_0x2c01ee){if(_0x2c01ee){var _0x584f76=_0x2c01ee[_0x5c26('0x1b')],_0xf0abec=_0x5ceb3a[_0x5c26('0x1c')],_0x418018=_0x5ceb3a[_0x5c26('0x1c')]+_0x5ceb3a['limit'],_0x4c4146;if(_0x418018>=_0x584f76){_0x418018=_0x584f76;_0x4c4146=0xc8;}else{_0x4c4146=0xce;}_0x149a4e[_0x5c26('0x19')](_0x4c4146);return _0x149a4e[_0x5c26('0x1d')](_0x5c26('0x1e'),_0xf0abec+'-'+_0x418018+'/'+_0x584f76)[_0x5c26('0x1a')](_0x2c01ee);}return null;};}function patchUpdates(_0x192fbf){return function(_0x4a79ae){try{jsonpatch[_0x5c26('0x1f')](_0x4a79ae,_0x192fbf,!![]);}catch(_0x349556){return BPromise[_0x5c26('0x20')](_0x349556);}return _0x4a79ae['save']();};}function saveUpdates(_0x39adfc,_0x259cff){return function(_0x948087){if(_0x948087){return _0x948087[_0x5c26('0x21')](_0x39adfc)[_0x5c26('0x22')](function(_0x115bec){return _0x115bec;});}return null;};}function removeEntity(_0x23dadf,_0x40b2fa){return function(_0x5a98be){if(_0x5a98be){return _0x5a98be[_0x5c26('0x23')]()[_0x5c26('0x22')](function(){var _0xa7aee8=_0x5a98be[_0x5c26('0x24')]({'plain':!![]});var _0x4bc76b=_0x5c26('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4bc76b,'resourceId':_0xa7aee8['id']}})['then'](function(){return _0x5a98be;});})[_0x5c26('0x22')](function(){_0x23dadf[_0x5c26('0x19')](0xcc)[_0x5c26('0x26')]();});}};}function handleEntityNotFound(_0x44d4d8,_0x34902c){return function(_0x75ccb9){if(!_0x75ccb9){_0x44d4d8[_0x5c26('0x27')](0x194);}return _0x75ccb9;};}function handleError(_0x1681c7,_0x5c55cd){_0x5c55cd=_0x5c55cd||0x1f4;return function(_0x53c338){logger[_0x5c26('0x28')](_0x53c338[_0x5c26('0x29')]);if(_0x53c338['name']){delete _0x53c338[_0x5c26('0x2a')];}_0x1681c7[_0x5c26('0x19')](_0x5c55cd)[_0x5c26('0x2b')](_0x53c338);};}exports[_0x5c26('0x2c')]=function(_0x282b03,_0x5cc64f){var _0x4ae214={},_0x54b6f7={},_0x360e52={'count':0x0,'rows':[]};var _0x40b270=_['map'](db[_0x5c26('0x2d')][_0x5c26('0x2e')],function(_0x459f83){return{'name':_0x459f83[_0x5c26('0x2f')],'type':_0x459f83[_0x5c26('0x30')][_0x5c26('0x31')]};});_0x54b6f7['model']=_[_0x5c26('0x32')](_0x40b270,'name');_0x54b6f7[_0x5c26('0x33')]=_[_0x5c26('0x34')](_0x282b03[_0x5c26('0x33')]);_0x54b6f7[_0x5c26('0x35')]=_[_0x5c26('0x36')](_0x54b6f7[_0x5c26('0x37')],_0x54b6f7[_0x5c26('0x33')]);_0x4ae214['attributes']=_[_0x5c26('0x36')](_0x54b6f7['model'],qs[_0x5c26('0x38')](_0x282b03[_0x5c26('0x33')][_0x5c26('0x38')]));_0x4ae214[_0x5c26('0x39')]=_0x4ae214[_0x5c26('0x39')]['length']?_0x4ae214['attributes']:_0x54b6f7[_0x5c26('0x37')];if(!_0x282b03[_0x5c26('0x33')]['hasOwnProperty'](_0x5c26('0x3a'))){_0x4ae214[_0x5c26('0x3b')]=qs[_0x5c26('0x3b')](_0x282b03[_0x5c26('0x33')][_0x5c26('0x3b')]);_0x4ae214[_0x5c26('0x1c')]=qs[_0x5c26('0x1c')](_0x282b03['query'][_0x5c26('0x1c')]);}_0x4ae214['order']=qs['sort'](_0x282b03[_0x5c26('0x33')]['sort']);_0x4ae214[_0x5c26('0x3c')]=qs['filters'](_[_0x5c26('0x3d')](_0x282b03[_0x5c26('0x33')],_0x54b6f7[_0x5c26('0x35')]),_0x40b270);if(_0x282b03[_0x5c26('0x33')][_0x5c26('0x3e')]){_0x4ae214['where']=_['merge'](_0x4ae214[_0x5c26('0x3c')],{'$or':_[_0x5c26('0x32')](_0x40b270,function(_0x40ef31){if(_0x40ef31[_0x5c26('0x30')]!==_0x5c26('0x3f')){var _0x3327fd={};_0x3327fd[_0x40ef31[_0x5c26('0x2a')]]={'$like':'%'+_0x282b03[_0x5c26('0x33')]['filter']+'%'};return _0x3327fd;}})});}_0x4ae214=_[_0x5c26('0x40')]({},_0x4ae214,_0x282b03[_0x5c26('0x41')]);var _0x3243a7={'where':_0x4ae214[_0x5c26('0x3c')]};return db['MailQueue'][_0x5c26('0x1b')](_0x3243a7)[_0x5c26('0x22')](function(_0x5a00af){_0x360e52[_0x5c26('0x1b')]=_0x5a00af;if(_0x282b03[_0x5c26('0x33')][_0x5c26('0x42')]){_0x4ae214[_0x5c26('0x43')]=[{'all':!![]}];}return db[_0x5c26('0x2d')][_0x5c26('0x44')](_0x4ae214);})[_0x5c26('0x22')](function(_0x4ce12b){_0x360e52[_0x5c26('0x45')]=_0x4ce12b;return _0x360e52;})[_0x5c26('0x22')](respondWithFilteredResult(_0x5cc64f,_0x4ae214))[_0x5c26('0x46')](handleError(_0x5cc64f,null));};exports[_0x5c26('0x47')]=function(_0x5d036,_0x580d0d){var _0x2ff041={'raw':!![],'where':{'id':_0x5d036[_0x5c26('0x48')]['id']}},_0x34d0bb={};_0x34d0bb[_0x5c26('0x37')]=_[_0x5c26('0x34')](db[_0x5c26('0x2d')][_0x5c26('0x2e')]);_0x34d0bb[_0x5c26('0x33')]=_['keys'](_0x5d036[_0x5c26('0x33')]);_0x34d0bb['filters']=_[_0x5c26('0x36')](_0x34d0bb[_0x5c26('0x37')],_0x34d0bb[_0x5c26('0x33')]);_0x2ff041[_0x5c26('0x39')]=_[_0x5c26('0x36')](_0x34d0bb[_0x5c26('0x37')],qs[_0x5c26('0x38')](_0x5d036[_0x5c26('0x33')][_0x5c26('0x38')]));_0x2ff041[_0x5c26('0x39')]=_0x2ff041['attributes'][_0x5c26('0x49')]?_0x2ff041['attributes']:_0x34d0bb[_0x5c26('0x37')];if(_0x5d036[_0x5c26('0x33')][_0x5c26('0x42')]){_0x2ff041['include']=[{'all':!![]}];}_0x2ff041=_[_0x5c26('0x40')]({},_0x2ff041,_0x5d036[_0x5c26('0x41')]);return db[_0x5c26('0x2d')][_0x5c26('0x4a')](_0x2ff041)['then'](handleEntityNotFound(_0x580d0d,null))[_0x5c26('0x22')](respondWithResult(_0x580d0d,null))[_0x5c26('0x46')](handleError(_0x580d0d,null));};exports[_0x5c26('0x4b')]=function(_0x4e06a1,_0x86f7d9){return db['MailQueue'][_0x5c26('0x4b')](_0x4e06a1[_0x5c26('0x4c')],{})[_0x5c26('0x22')](function(_0xad80a8){var _0x49ef19=_0x4e06a1[_0x5c26('0x4d')][_0x5c26('0x24')]({'plain':!![]});if(!_0x49ef19)throw new Error(_0x5c26('0x4e'));if(_0x49ef19[_0x5c26('0x4f')]===_0x5c26('0x4d')){var _0x431daa=_0xad80a8['get']({'plain':!![]});var _0x564bc3=_0x5c26('0x25');return db[_0x5c26('0x50')][_0x5c26('0x4a')]({'where':{'name':_0x564bc3,'userProfileId':_0x49ef19[_0x5c26('0x51')]},'raw':!![]})[_0x5c26('0x22')](function(_0x50668d){if(_0x50668d&&_0x50668d[_0x5c26('0x52')]===0x0){return db[_0x5c26('0x53')][_0x5c26('0x4b')]({'name':_0x431daa[_0x5c26('0x2a')],'resourceId':_0x431daa['id'],'type':_0x50668d[_0x5c26('0x2a')],'sectionId':_0x50668d['id']},{})['then'](function(){return _0xad80a8;});}else{return _0xad80a8;}})[_0x5c26('0x46')](function(_0x515dc4){logger[_0x5c26('0x28')](_0x5c26('0x54'),_0x515dc4);throw _0x515dc4;});}return _0xad80a8;})[_0x5c26('0x22')](respondWithResult(_0x86f7d9,0xc9))['catch'](handleError(_0x86f7d9,null));};exports[_0x5c26('0x21')]=function(_0xbac8d,_0xc1c831){if(_0xbac8d[_0x5c26('0x4c')]['id']){delete _0xbac8d[_0x5c26('0x4c')]['id'];}return db[_0x5c26('0x2d')][_0x5c26('0x4a')]({'where':{'id':_0xbac8d[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0xc1c831,null))[_0x5c26('0x22')](saveUpdates(_0xbac8d['body'],null))['then'](respondWithResult(_0xc1c831,null))[_0x5c26('0x46')](handleError(_0xc1c831,null));};exports[_0x5c26('0x23')]=function(_0xe3be93,_0x131604){return db[_0x5c26('0x2d')][_0x5c26('0x4a')]({'where':{'id':_0xe3be93[_0x5c26('0x48')]['id']}})['then'](handleEntityNotFound(_0x131604,null))[_0x5c26('0x22')](removeEntity(_0x131604,null))[_0x5c26('0x46')](handleError(_0x131604,null));};exports[_0x5c26('0x55')]=function(_0x4bed98,_0x36d397){return db['MailQueue'][_0x5c26('0x55')]()['then'](respondWithResult(_0x36d397,null))['catch'](handleError(_0x36d397,null));};exports[_0x5c26('0x56')]=function(_0x359e01,_0x3b38b0,_0x2fba4b){var _0x4cf484={'raw':!![],'where':{}},_0x1c4907={},_0x3993de;return db[_0x5c26('0x2d')][_0x5c26('0x57')]({'where':{'id':_0x359e01['params']['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0x3b38b0,null))[_0x5c26('0x22')](function(_0x2c0e88){if(_0x2c0e88){_0x3993de=_0x2c0e88[_0x5c26('0x24')]({'plain':!![]});_0x1c4907[_0x5c26('0x37')]=_['keys'](db['UserMailQueue'][_0x5c26('0x2e')]);_0x1c4907[_0x5c26('0x33')]=_[_0x5c26('0x34')](_0x359e01['query']);_0x1c4907['filters']=_[_0x5c26('0x36')](_0x1c4907['model'],_0x1c4907[_0x5c26('0x33')]);_0x4cf484[_0x5c26('0x39')]=_[_0x5c26('0x36')](_0x1c4907[_0x5c26('0x37')],qs[_0x5c26('0x38')](_0x359e01[_0x5c26('0x33')][_0x5c26('0x38')]));_0x4cf484[_0x5c26('0x39')]=_0x4cf484[_0x5c26('0x39')][_0x5c26('0x49')]?_0x4cf484[_0x5c26('0x39')]:_0x1c4907[_0x5c26('0x37')];if(!_0x359e01[_0x5c26('0x33')][_0x5c26('0x58')](_0x5c26('0x3a'))){_0x4cf484[_0x5c26('0x3b')]=qs['limit'](_0x359e01['query'][_0x5c26('0x3b')]);_0x4cf484[_0x5c26('0x1c')]=qs['offset'](_0x359e01['query']['offset']);}_0x4cf484[_0x5c26('0x59')]=qs[_0x5c26('0x5a')](_0x359e01[_0x5c26('0x33')][_0x5c26('0x5a')]);_0x4cf484['where']=qs[_0x5c26('0x35')](_['pick'](_0x359e01[_0x5c26('0x33')],_0x1c4907['filters']));_0x4cf484[_0x5c26('0x3c')][_0x5c26('0x5b')]=_0x2c0e88['id'];if(_0x359e01[_0x5c26('0x33')][_0x5c26('0x3e')]){_0x4cf484[_0x5c26('0x3c')]=_[_0x5c26('0x40')](_0x4cf484[_0x5c26('0x3c')],{'$or':_[_0x5c26('0x32')](_0x4cf484[_0x5c26('0x39')],function(_0x3f2859){var _0xb2d402={};_0xb2d402[_0x3f2859]={'$like':'%'+_0x359e01[_0x5c26('0x33')]['filter']+'%'};return _0xb2d402;})});}_0x4cf484=_[_0x5c26('0x40')]({},_0x4cf484,_0x359e01[_0x5c26('0x41')]);return db['UserMailQueue']['findAll'](_0x4cf484);}})['then'](function(_0x390d48){if(_0x390d48){return db[_0x5c26('0x5c')]['findAndCountAll']({'where':{'id':_[_0x5c26('0x32')](_0x390d48,_0x5c26('0x5d')),'role':_0x5c26('0x5e')},'attributes':['id',_0x5c26('0x2a'),_0x5c26('0x5f'),_0x5c26('0x60'),'createdAt']});}})[_0x5c26('0x22')](function(_0x23662e){if(_0x23662e){return{'count':_0x23662e[_0x5c26('0x1b')],'rows':_[_0x5c26('0x32')](_0x23662e['rows'],function(_0x5be2f8){return{'membername':_0x5be2f8[_0x5c26('0x2a')],'UserId':_0x5be2f8['id'],'queue_name':_0x3993de[_0x5c26('0x2a')],'MailQueueId':_0x3993de['id'],'interface':util['format'](_0x5c26('0x61'),'SIP',_0x5be2f8[_0x5c26('0x2a')]),'penalty':0x0,'paused':_0x5be2f8[_0x5c26('0x5f')],'createdAt':_0x5be2f8['createdAt'],'updatedAt':_0x5be2f8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5c26('0x22')](respondWithFilteredResult(_0x3b38b0,_0x4cf484))[_0x5c26('0x46')](handleError(_0x3b38b0,null));};exports[_0x5c26('0x62')]=function(_0x596818,_0x54bc74,_0x53957c){var _0x2a1f13={};var _0x2f00ac={};var _0x2c4893;var _0xcb3f00;return db[_0x5c26('0x2d')][_0x5c26('0x57')]({'where':{'id':_0x596818[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0x54bc74,null))[_0x5c26('0x22')](function(_0x3b827b){if(_0x3b827b){_0x2c4893=_0x3b827b;_0x2f00ac[_0x5c26('0x37')]=_['keys'](db['Team'][_0x5c26('0x2e')]);_0x2f00ac[_0x5c26('0x33')]=_[_0x5c26('0x34')](_0x596818['query']);_0x2f00ac[_0x5c26('0x35')]=_['intersection'](_0x2f00ac[_0x5c26('0x37')],_0x2f00ac[_0x5c26('0x33')]);_0x2a1f13['attributes']=_['intersection'](_0x2f00ac['model'],qs['fields'](_0x596818[_0x5c26('0x33')]['fields']));_0x2a1f13[_0x5c26('0x39')]=_0x2a1f13[_0x5c26('0x39')][_0x5c26('0x49')]?_0x2a1f13['attributes']:_0x2f00ac[_0x5c26('0x37')];_0x2a1f13[_0x5c26('0x59')]=qs[_0x5c26('0x5a')](_0x596818[_0x5c26('0x33')][_0x5c26('0x5a')]);_0x2a1f13['where']=qs[_0x5c26('0x35')](_[_0x5c26('0x3d')](_0x596818[_0x5c26('0x33')],_0x2f00ac[_0x5c26('0x35')]));if(_0x596818[_0x5c26('0x33')][_0x5c26('0x3e')]){_0x2a1f13['where']=_[_0x5c26('0x40')](_0x2a1f13[_0x5c26('0x3c')],{'$or':_['map'](_0x2a1f13[_0x5c26('0x39')],function(_0x5bbd56){var _0x15f008={};_0x15f008[_0x5bbd56]={'$like':'%'+_0x596818[_0x5c26('0x33')]['filter']+'%'};return _0x15f008;})});}_0x2a1f13=_[_0x5c26('0x40')]({},_0x2a1f13,_0x596818[_0x5c26('0x41')]);return _0x2c4893['getTeams'](_0x2a1f13);}})[_0x5c26('0x22')](function(_0x46b24e){if(_0x46b24e){_0xcb3f00=_0x46b24e[_0x5c26('0x49')];if(!_0x596818[_0x5c26('0x33')][_0x5c26('0x58')](_0x5c26('0x3a'))){_0x2a1f13[_0x5c26('0x3b')]=qs[_0x5c26('0x3b')](_0x596818['query'][_0x5c26('0x3b')]);_0x2a1f13[_0x5c26('0x1c')]=qs['offset'](_0x596818[_0x5c26('0x33')][_0x5c26('0x1c')]);}return _0x2c4893[_0x5c26('0x62')](_0x2a1f13);}})[_0x5c26('0x22')](function(_0x3b59fc){if(_0x3b59fc){return _0x3b59fc?{'count':_0xcb3f00,'rows':_0x3b59fc}:null;}})[_0x5c26('0x22')](respondWithResult(_0x54bc74,null))[_0x5c26('0x46')](handleError(_0x54bc74,null));};exports[_0x5c26('0x63')]=function(_0x242780,_0x61593d,_0x2fe321){var _0x1511c8=_0x242780['body'][_0x5c26('0x64')];return db[_0x5c26('0x65')][_0x5c26('0x44')]({'where':{'id':_0x1511c8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5c26('0x66'),'attributes':['id',_0x5c26('0x2a'),_0x5c26('0x67'),_0x5c26('0x68'),'interface'],'raw':!![]}]})[_0x5c26('0x22')](function(_0x35d41d){if(_0x35d41d){var _0x199429=_[_0x5c26('0x69')](_0x35d41d,function(_0x13bd0c){var _0x3c7531=_0x13bd0c[_0x5c26('0x24')]({'plain':!![]});return _0x3c7531['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x242780[_0x5c26('0x48')]['id']}})['then'](function(_0x41da87){return db[_0x5c26('0x6a')][_0x5c26('0x6b')](function(_0x2c7f46){return _0x41da87[_0x5c26('0x63')](_0x1511c8,{'transaction':_0x2c7f46})[_0x5c26('0x22')](function(){return BPromise[_0x5c26('0x6c')](_0x199429,function(_0x218388){return db['UserMailQueue'][_0x5c26('0x6d')]({'where':{'UserId':_0x218388['id'],'MailQueueId':_0x242780[_0x5c26('0x48')]['id']},'transaction':_0x2c7f46});});})['then'](function(){_0x199429[_0x5c26('0x6e')](function(_0x5775f2){socket[_0x5c26('0x6f')](_0x5c26('0x70'),{'UserId':_0x5775f2['id'],'MailQueueId':_0x41da87['id']});});});});});}})[_0x5c26('0x22')](respondWithStatusCode(_0x61593d,null))[_0x5c26('0x46')](handleError(_0x61593d,null));};exports[_0x5c26('0x71')]=function(_0x13cec7,_0x4c4d5c,_0x42388f){return db[_0x5c26('0x65')]['findAll']({'where':{'id':_0x13cec7[_0x5c26('0x33')][_0x5c26('0x64')]},'attributes':['id'],'include':[{'model':db[_0x5c26('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c4d5c,null))['then'](function(_0x46f772){var _0x18edba=_[_0x5c26('0x32')](_0x46f772,'id');var _0x39e14b=[];var _0x56d9e9=[];var _0x27d870=squel[_0x5c26('0x72')]();_0x27d870['field'](_0x5c26('0x73'))['from']('team_has_mail_queues','tq')[_0x5c26('0x74')](_0x5c26('0x75'),'ut',_0x5c26('0x76'))[_0x5c26('0x3c')](_0x5c26('0x77'),_0x13cec7['params']['id']);for(var _0x54aa0f=0x0;_0x54aa0f<_0x46f772[_0x5c26('0x49')];_0x54aa0f+=0x1){let _0x2f6de0=_0x46f772[_0x54aa0f];for(var _0x38a6cc=0x0;_0x38a6cc<_0x2f6de0[_0x5c26('0x66')][_0x5c26('0x49')];_0x38a6cc+=0x1){let _0x230d3e=_0x2f6de0['Agents'][_0x38a6cc];var _0x13c3ed=_0x27d870[_0x5c26('0x78')]();_0x13c3ed['where']('ut.UserId\x20=\x20?',_0x230d3e['id']);_0x56d9e9[_0x5c26('0x79')](db[_0x5c26('0x6a')]['query'](_0x13c3ed['toString'](),{'type':db[_0x5c26('0x6a')][_0x5c26('0x7a')][_0x5c26('0x7b')]})[_0x5c26('0x22')](function(_0x41b580){if(_0x41b580['length']===0x1){return _0x230d3e['id'];}else{var _0xfe2f7a=_['every'](_[_0x5c26('0x32')](_0x41b580,_0x5c26('0x7c')),function(_0x5d6359){return _[_0x5c26('0x7d')](_0x18edba,_0x5d6359);});if(_0xfe2f7a){return _0x230d3e['id'];}}}));}}return BPromise[_0x5c26('0x7e')](_0x56d9e9)[_0x5c26('0x22')](function(_0x16b73a){_0x39e14b=_(_0x39e14b)[_0x5c26('0x7f')](_0x16b73a)[_0x5c26('0x80')]()[_0x5c26('0x81')]();return db[_0x5c26('0x2d')][_0x5c26('0x4a')]({'where':{'id':_0x13cec7[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](function(_0x238d80){return db[_0x5c26('0x6a')][_0x5c26('0x6b')](function(_0x13262f){return _0x238d80[_0x5c26('0x71')](_0x13cec7[_0x5c26('0x33')][_0x5c26('0x64')],{'transaction':_0x13262f})[_0x5c26('0x22')](function(){if(!_[_0x5c26('0x82')](_0x39e14b)){return _0x238d80[_0x5c26('0x83')](_0x39e14b,{'transaction':_0x13262f});}})[_0x5c26('0x22')](function(){_0x39e14b['forEach'](function(_0x41828a){socket['emit']('userMailQueue:remove',{'UserId':_0x41828a,'MailQueueId':_0x238d80['id']});});});});});});})[_0x5c26('0x22')](respondWithStatusCode(_0x4c4d5c,null))[_0x5c26('0x46')](handleError(_0x4c4d5c,null));};exports[_0x5c26('0x84')]=function(_0x158e29,_0x119154,_0x53ed85){return db[_0x5c26('0x2d')]['find']({'where':{'id':_0x158e29[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0x119154,null))[_0x5c26('0x22')](function(_0xde9c1c){if(_0xde9c1c){return _0xde9c1c[_0x5c26('0x84')](_0x158e29[_0x5c26('0x4c')]['ids'],_[_0x5c26('0x85')](_0x158e29[_0x5c26('0x4c')],[_0x5c26('0x64'),'id'])||{})[_0x5c26('0x86')](function(_0x28f5f0){for(var _0x571004=0x0;_0x571004<_0x158e29[_0x5c26('0x4c')]['ids'][_0x5c26('0x49')];_0x571004+=0x1){socket['emit'](_0x5c26('0x70'),{'UserId':_0x158e29[_0x5c26('0x4c')][_0x5c26('0x64')][_0x571004],'MailQueueId':_0x158e29['params']['id']});}return _0x28f5f0;});}})[_0x5c26('0x22')](respondWithResult(_0x119154,null))[_0x5c26('0x46')](handleError(_0x119154,null));};exports[_0x5c26('0x83')]=function(_0x3b6d77,_0x24367b,_0x4c500a){return db['MailQueue']['find']({'where':{'id':_0x3b6d77['params']['id']}})['then'](handleEntityNotFound(_0x24367b,null))[_0x5c26('0x22')](function(_0x48ecfe){if(_0x48ecfe){return _0x48ecfe[_0x5c26('0x83')](_0x3b6d77[_0x5c26('0x33')][_0x5c26('0x64')])[_0x5c26('0x22')](function(){if(_['isArray'](_0x3b6d77['query'][_0x5c26('0x64')])){for(var _0x59a1eb=0x0;_0x59a1eb<_0x3b6d77[_0x5c26('0x33')][_0x5c26('0x64')]['length'];_0x59a1eb+=0x1){socket[_0x5c26('0x6f')](_0x5c26('0x87'),{'UserId':Number(_0x3b6d77[_0x5c26('0x33')][_0x5c26('0x64')][_0x59a1eb]),'MailQueueId':Number(_0x3b6d77[_0x5c26('0x48')]['id'])});}}else{socket[_0x5c26('0x6f')](_0x5c26('0x87'),{'UserId':Number(_0x3b6d77[_0x5c26('0x33')][_0x5c26('0x64')]),'MailQueueId':Number(_0x3b6d77[_0x5c26('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x24367b,null))[_0x5c26('0x46')](handleError(_0x24367b,null));};exports['getAgents']=function(_0xeba5d1,_0x3ca2b3,_0x8d357d){var _0x369330={};var _0x2bb568={};var _0x1dc73a;var _0x2cdf7e;return db[_0x5c26('0x2d')][_0x5c26('0x57')]({'where':{'id':_0xeba5d1[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0x3ca2b3,null))[_0x5c26('0x22')](function(_0x5d0117){if(_0x5d0117){_0x1dc73a=_0x5d0117;_0x2bb568[_0x5c26('0x37')]=_['keys'](db[_0x5c26('0x5c')][_0x5c26('0x2e')]);_0x2bb568['query']=_[_0x5c26('0x34')](_0xeba5d1['query']);_0x2bb568['filters']=_[_0x5c26('0x36')](_0x2bb568[_0x5c26('0x37')],_0x2bb568[_0x5c26('0x33')]);_0x369330['attributes']=_[_0x5c26('0x36')](_0x2bb568[_0x5c26('0x37')],qs[_0x5c26('0x38')](_0xeba5d1[_0x5c26('0x33')]['fields']));_0x369330['attributes']=_0x369330[_0x5c26('0x39')][_0x5c26('0x49')]?_0x369330[_0x5c26('0x39')]:_0x2bb568[_0x5c26('0x37')];_0x369330[_0x5c26('0x59')]=qs['sort'](_0xeba5d1[_0x5c26('0x33')]['sort']);_0x369330[_0x5c26('0x3c')]=qs['filters'](_[_0x5c26('0x3d')](_0xeba5d1[_0x5c26('0x33')],_0x2bb568[_0x5c26('0x35')]));if(_0xeba5d1['query'][_0x5c26('0x3e')]){_0x369330[_0x5c26('0x3c')]=_['merge'](_0x369330[_0x5c26('0x3c')],{'$or':_['map'](_0x369330[_0x5c26('0x39')],function(_0x144cba){var _0x7ac508={};_0x7ac508[_0x144cba]={'$like':'%'+_0xeba5d1[_0x5c26('0x33')][_0x5c26('0x3e')]+'%'};return _0x7ac508;})});}_0x369330=_[_0x5c26('0x40')]({},_0x369330,_0xeba5d1[_0x5c26('0x41')]);return _0x1dc73a[_0x5c26('0x88')](_0x369330);}})[_0x5c26('0x22')](function(_0x14178d){if(_0x14178d){_0x2cdf7e=_0x14178d[_0x5c26('0x49')];if(!_0xeba5d1[_0x5c26('0x33')][_0x5c26('0x58')](_0x5c26('0x3a'))){_0x369330[_0x5c26('0x3b')]=qs[_0x5c26('0x3b')](_0xeba5d1['query'][_0x5c26('0x3b')]);_0x369330[_0x5c26('0x1c')]=qs[_0x5c26('0x1c')](_0xeba5d1[_0x5c26('0x33')][_0x5c26('0x1c')]);}return _0x1dc73a[_0x5c26('0x88')](_0x369330);}})[_0x5c26('0x22')](function(_0x1ea33e){if(_0x1ea33e){return _0x1ea33e?{'count':_0x2cdf7e,'rows':_0x1ea33e}:null;}})[_0x5c26('0x22')](respondWithResult(_0x3ca2b3,null))[_0x5c26('0x46')](handleError(_0x3ca2b3,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 53b98ef..58fc612 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 _0x1a65=['hook','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit'];(function(_0x1fcf1b,_0x214549){var _0x5d2952=function(_0x3331b7){while(--_0x3331b7){_0x1fcf1b['push'](_0x1fcf1b['shift']());}};_0x5d2952(++_0x214549);}(_0x1a65,0x151));var _0x51a6=function(_0x242369,_0x4b570b){_0x242369=_0x242369-0x0;var _0x28a5df=_0x1a65[_0x242369];return _0x28a5df;};'use strict';var EventEmitter=require(_0x51a6('0x0'));var MailQueue=require(_0x51a6('0x1'))['db'][_0x51a6('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x51a6('0x3')](0x0);var events={'afterCreate':_0x51a6('0x4'),'afterUpdate':'update','afterDestroy':_0x51a6('0x5')};function emitEvent(_0x5a283c){return function(_0x1c4935,_0x3cc2d9,_0x566c3c){MailQueueEvents['emit'](_0x5a283c+':'+_0x1c4935['id'],_0x1c4935);MailQueueEvents[_0x51a6('0x6')](_0x5a283c,_0x1c4935);_0x566c3c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x51a6('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x649c=['hook','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x649c,0xf9));var _0xc649=function(_0x5013b5,_0xaeb10d){_0x5013b5=_0x5013b5-0x0;var _0x5aa2e6=_0x649c[_0x5013b5];return _0x5aa2e6;};'use strict';var EventEmitter=require(_0xc649('0x0'));var MailQueue=require(_0xc649('0x1'))['db'][_0xc649('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc649('0x3')](0x0);var events={'afterCreate':_0xc649('0x4'),'afterUpdate':'update','afterDestroy':_0xc649('0x5')};function emitEvent(_0x14d9eb){return function(_0x41c136,_0x26e8f3,_0x980d05){MailQueueEvents[_0xc649('0x6')](_0x14d9eb+':'+_0x41c136['id'],_0x41c136);MailQueueEvents[_0xc649('0x6')](_0x14d9eb,_0x41c136);_0x980d05(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xc649('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9923425..e61c5b0 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 _0x779c=['MailQueue','mail_queues','lodash','moment','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0x779c,0x89));var _0xc779=function(_0x19bc01,_0x4fb8a7){_0x19bc01=_0x19bc01-0x0;var _0x414097=_0x779c[_0x19bc01];return _0x414097;};'use strict';var _=require(_0xc779('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc779('0x1'));var BPromise=require('bluebird');var rp=require(_0xc779('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc779('0x3'));var config=require(_0xc779('0x4'));var attributes=require(_0xc779('0x5'));module[_0xc779('0x6')]=function(_0x2522ee,_0x2952d5){return _0x2522ee['define'](_0xc779('0x7'),attributes,{'tableName':_0xc779('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0710=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x0710,0x1dd));var _0x0071=function(_0x586c70,_0x5b5294){_0x586c70=_0x586c70-0x0;var _0x1fd79d=_0x0710[_0x586c70];return _0x1fd79d;};'use strict';var _=require('lodash');var util=require(_0x0071('0x0'));var logger=require(_0x0071('0x1'))(_0x0071('0x2'));var moment=require('moment');var BPromise=require(_0x0071('0x3'));var rp=require(_0x0071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0071('0x5'));var config=require(_0x0071('0x6'));var attributes=require(_0x0071('0x7'));module[_0x0071('0x8')]=function(_0x5ad4d5,_0x24864f){return _0x5ad4d5['define']('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 7f55f1a..b3ab948 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 _0x7c1c=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','where','limit','map','include','model','attributes','stringify','ShowMailQueue','then','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xc9b988,_0x429150){var _0x5f14fe=function(_0x5c76a8){while(--_0x5c76a8){_0xc9b988['push'](_0xc9b988['shift']());}};_0x5f14fe(++_0x429150);}(_0x7c1c,0xe4));var _0xc7c1=function(_0x220419,_0x16987b){_0x220419=_0x220419-0x0;var _0x494842=_0x7c1c[_0x220419];return _0x494842;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc7c1('0x0'));var BPromise=require(_0xc7c1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7c1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7c1('0x3'));var logger=require(_0xc7c1('0x4'))(_0xc7c1('0x5'));var config=require(_0xc7c1('0x6'));var jayson=require(_0xc7c1('0x7'));var client=jayson[_0xc7c1('0x8')][_0xc7c1('0x9')]({'port':0x232a});config[_0xc7c1('0xa')]=_[_0xc7c1('0xb')](config['redis'],{'host':_0xc7c1('0xc'),'port':0x18eb});var socket=require(_0xc7c1('0xd'))(new Redis(config[_0xc7c1('0xa')]));require('./mailQueue.socket')[_0xc7c1('0xe')](socket);function respondWithRpcPromise(_0x4afdda,_0xce349c,_0x465647){return new BPromise(function(_0x28470c,_0x34e052){return client[_0xc7c1('0xf')](_0x4afdda,_0x465647)['then'](function(_0x348592){logger[_0xc7c1('0x10')](_0xc7c1('0x11'),_0xce349c,'request\x20sent');logger[_0xc7c1('0x12')](_0xc7c1('0x13'),_0xce349c,_0xc7c1('0x14'),JSON['stringify'](_0x348592));if(_0x348592['error']){if(_0x348592[_0xc7c1('0x15')][_0xc7c1('0x16')]===0x1f4){logger[_0xc7c1('0x15')]('MailQueue,\x20%s,\x20%s',_0xce349c,_0x348592[_0xc7c1('0x15')][_0xc7c1('0x17')]);return _0x34e052(_0x348592['error'][_0xc7c1('0x17')]);}logger[_0xc7c1('0x15')]('MailQueue,\x20%s,\x20%s',_0xce349c,_0x348592[_0xc7c1('0x15')]['message']);return _0x28470c(_0x348592[_0xc7c1('0x15')][_0xc7c1('0x17')]);}else{logger[_0xc7c1('0x10')]('MailQueue,\x20%s,\x20%s',_0xce349c,'request\x20sent');_0x28470c(_0x348592[_0xc7c1('0x18')][_0xc7c1('0x17')]);}})[_0xc7c1('0x19')](function(_0x3966a9){logger[_0xc7c1('0x15')](_0xc7c1('0x11'),_0xce349c,_0x3966a9);_0x34e052(_0x3966a9);});});}exports[_0xc7c1('0x1a')]=function(_0x1462f9){var _0xa1fbff=this;return new Promise(function(_0x2a683a,_0x268ac8){return db[_0xc7c1('0x1b')]['findAll']({'raw':_0x1462f9[_0xc7c1('0x1c')]?_0x1462f9[_0xc7c1('0x1c')][_0xc7c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x1462f9['options']?_0x1462f9[_0xc7c1('0x1c')][_0xc7c1('0x1e')]||null:null,'attributes':_0x1462f9[_0xc7c1('0x1c')]?_0x1462f9[_0xc7c1('0x1c')]['attributes']||null:null,'limit':_0x1462f9['options']?_0x1462f9['options'][_0xc7c1('0x1f')]||null:null,'include':_0x1462f9[_0xc7c1('0x1c')]?_0x1462f9['options']['include']?_[_0xc7c1('0x20')](_0x1462f9[_0xc7c1('0x1c')][_0xc7c1('0x21')],function(_0x3937a9){return{'model':db[_0x3937a9[_0xc7c1('0x22')]],'as':_0x3937a9['as'],'attributes':_0x3937a9[_0xc7c1('0x23')],'include':_0x3937a9[_0xc7c1('0x21')]?_[_0xc7c1('0x20')](_0x3937a9[_0xc7c1('0x21')],function(_0x1adb46){return{'model':db[_0x1adb46['model']],'as':_0x1adb46['as'],'attributes':_0x1adb46[_0xc7c1('0x23')],'include':_0x1adb46[_0xc7c1('0x21')]?_[_0xc7c1('0x20')](_0x1adb46[_0xc7c1('0x21')],function(_0x2213f6){return{'model':db[_0x2213f6['model']],'as':_0x2213f6['as'],'attributes':_0x2213f6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49cc10){logger['info'](_0xc7c1('0x1a'),_0x1462f9);logger[_0xc7c1('0x12')](_0xc7c1('0x1a'),_0x1462f9,JSON[_0xc7c1('0x24')](_0x49cc10));_0x2a683a(_0x49cc10);})[_0xc7c1('0x19')](function(_0x474442){logger[_0xc7c1('0x15')](_0xc7c1('0x1a'),_0x474442[_0xc7c1('0x17')],_0x1462f9);_0x268ac8(_0xa1fbff[_0xc7c1('0x15')](0x1f4,_0x474442[_0xc7c1('0x17')]));});});};exports[_0xc7c1('0x25')]=function(_0x11c6ab){var _0x81e8ee=this;return new Promise(function(_0xd44a0c,_0x28c7cb){return db['MailQueue']['find']({'raw':_0x11c6ab[_0xc7c1('0x1c')]?_0x11c6ab[_0xc7c1('0x1c')][_0xc7c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x11c6ab['options']?_0x11c6ab['options']['where']||null:null,'attributes':_0x11c6ab[_0xc7c1('0x1c')]?_0x11c6ab[_0xc7c1('0x1c')][_0xc7c1('0x23')]||null:null,'include':_0x11c6ab[_0xc7c1('0x1c')]?_0x11c6ab['options'][_0xc7c1('0x21')]?_[_0xc7c1('0x20')](_0x11c6ab[_0xc7c1('0x1c')]['include'],function(_0x6a903d){return{'model':db[_0x6a903d[_0xc7c1('0x22')]],'as':_0x6a903d['as'],'attributes':_0x6a903d['attributes'],'include':_0x6a903d[_0xc7c1('0x21')]?_['map'](_0x6a903d[_0xc7c1('0x21')],function(_0x14539f){return{'model':db[_0x14539f['model']],'as':_0x14539f['as'],'attributes':_0x14539f[_0xc7c1('0x23')],'include':_0x14539f['include']?_[_0xc7c1('0x20')](_0x14539f[_0xc7c1('0x21')],function(_0x132b51){return{'model':db[_0x132b51[_0xc7c1('0x22')]],'as':_0x132b51['as'],'attributes':_0x132b51[_0xc7c1('0x23')]};}):[]};}):[]};}):[]:[]})[_0xc7c1('0x26')](function(_0x323731){logger[_0xc7c1('0x10')]('ShowMailQueue',_0x11c6ab);logger[_0xc7c1('0x12')]('ShowMailQueue',_0x11c6ab,JSON[_0xc7c1('0x24')](_0x323731));_0xd44a0c(_0x323731);})[_0xc7c1('0x19')](function(_0xc7e99c){logger[_0xc7c1('0x15')]('ShowMailQueue',_0xc7e99c[_0xc7c1('0x17')],_0x11c6ab);_0x28c7cb(_0x81e8ee[_0xc7c1('0x15')](0x1f4,_0xc7e99c['message']));});});}; \ No newline at end of file +var _0xad77=['info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','map','include','model','ShowMailQueue','find','raw','where','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','./mailQueue.socket','register','then'];(function(_0x3c6743,_0x544a90){var _0x1e2b85=function(_0x7a5553){while(--_0x7a5553){_0x3c6743['push'](_0x3c6743['shift']());}};_0x1e2b85(++_0x544a90);}(_0xad77,0x122));var _0x7ad7=function(_0x1235a8,_0x2db48e){_0x1235a8=_0x1235a8-0x0;var _0x41a2cf=_0xad77[_0x1235a8];return _0x41a2cf;};'use strict';var _=require('lodash');var util=require(_0x7ad7('0x0'));var moment=require('moment');var BPromise=require(_0x7ad7('0x1'));var rs=require(_0x7ad7('0x2'));var fs=require('fs');var Redis=require(_0x7ad7('0x3'));var db=require(_0x7ad7('0x4'))['db'];var utils=require(_0x7ad7('0x5'));var logger=require('../../config/logger')(_0x7ad7('0x6'));var config=require(_0x7ad7('0x7'));var jayson=require(_0x7ad7('0x8'));var client=jayson[_0x7ad7('0x9')]['http']({'port':0x232a});config[_0x7ad7('0xa')]=_['defaults'](config[_0x7ad7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ad7('0xa')]));require(_0x7ad7('0xb'))[_0x7ad7('0xc')](socket);function respondWithRpcPromise(_0x359b90,_0x56a717,_0x3dbc83){return new BPromise(function(_0x409ba2,_0x3bcb2b){return client['request'](_0x359b90,_0x3dbc83)[_0x7ad7('0xd')](function(_0x3de340){logger[_0x7ad7('0xe')](_0x7ad7('0xf'),_0x56a717,'request\x20sent');logger['debug'](_0x7ad7('0x10'),_0x56a717,_0x7ad7('0x11'),JSON[_0x7ad7('0x12')](_0x3de340));if(_0x3de340[_0x7ad7('0x13')]){if(_0x3de340[_0x7ad7('0x13')][_0x7ad7('0x14')]===0x1f4){logger[_0x7ad7('0x13')]('MailQueue,\x20%s,\x20%s',_0x56a717,_0x3de340[_0x7ad7('0x13')][_0x7ad7('0x15')]);return _0x3bcb2b(_0x3de340['error'][_0x7ad7('0x15')]);}logger[_0x7ad7('0x13')](_0x7ad7('0xf'),_0x56a717,_0x3de340[_0x7ad7('0x13')][_0x7ad7('0x15')]);return _0x409ba2(_0x3de340['error'][_0x7ad7('0x15')]);}else{logger[_0x7ad7('0xe')]('MailQueue,\x20%s,\x20%s',_0x56a717,_0x7ad7('0x11'));_0x409ba2(_0x3de340[_0x7ad7('0x16')][_0x7ad7('0x15')]);}})[_0x7ad7('0x17')](function(_0x41f251){logger[_0x7ad7('0x13')]('MailQueue,\x20%s,\x20%s',_0x56a717,_0x41f251);_0x3bcb2b(_0x41f251);});});}exports[_0x7ad7('0x18')]=function(_0x40ffe5){var _0x5f32e6=this;return new Promise(function(_0x1e2f34,_0x353ef7){return db[_0x7ad7('0x19')][_0x7ad7('0x1a')]({'raw':_0x40ffe5['options']?_0x40ffe5[_0x7ad7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x40ffe5[_0x7ad7('0x1b')]?_0x40ffe5[_0x7ad7('0x1b')]['where']||null:null,'attributes':_0x40ffe5[_0x7ad7('0x1b')]?_0x40ffe5[_0x7ad7('0x1b')][_0x7ad7('0x1c')]||null:null,'limit':_0x40ffe5[_0x7ad7('0x1b')]?_0x40ffe5[_0x7ad7('0x1b')][_0x7ad7('0x1d')]||null:null,'include':_0x40ffe5[_0x7ad7('0x1b')]?_0x40ffe5[_0x7ad7('0x1b')]['include']?_[_0x7ad7('0x1e')](_0x40ffe5[_0x7ad7('0x1b')][_0x7ad7('0x1f')],function(_0x44f29f){return{'model':db[_0x44f29f['model']],'as':_0x44f29f['as'],'attributes':_0x44f29f[_0x7ad7('0x1c')],'include':_0x44f29f[_0x7ad7('0x1f')]?_[_0x7ad7('0x1e')](_0x44f29f[_0x7ad7('0x1f')],function(_0x1652a9){return{'model':db[_0x1652a9['model']],'as':_0x1652a9['as'],'attributes':_0x1652a9[_0x7ad7('0x1c')],'include':_0x1652a9[_0x7ad7('0x1f')]?_[_0x7ad7('0x1e')](_0x1652a9[_0x7ad7('0x1f')],function(_0x5000cc){return{'model':db[_0x5000cc[_0x7ad7('0x20')]],'as':_0x5000cc['as'],'attributes':_0x5000cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ad7('0xd')](function(_0x5152d6){logger[_0x7ad7('0xe')](_0x7ad7('0x18'),_0x40ffe5);logger['debug']('GetMailQueue',_0x40ffe5,JSON[_0x7ad7('0x12')](_0x5152d6));_0x1e2f34(_0x5152d6);})[_0x7ad7('0x17')](function(_0x3faf9f){logger['error'](_0x7ad7('0x18'),_0x3faf9f[_0x7ad7('0x15')],_0x40ffe5);_0x353ef7(_0x5f32e6[_0x7ad7('0x13')](0x1f4,_0x3faf9f[_0x7ad7('0x15')]));});});};exports[_0x7ad7('0x21')]=function(_0x2fb9c2){var _0x26a0fb=this;return new Promise(function(_0x356195,_0x1f1311){return db[_0x7ad7('0x19')][_0x7ad7('0x22')]({'raw':_0x2fb9c2['options']?_0x2fb9c2[_0x7ad7('0x1b')][_0x7ad7('0x23')]===undefined?!![]:![]:!![],'where':_0x2fb9c2[_0x7ad7('0x1b')]?_0x2fb9c2[_0x7ad7('0x1b')][_0x7ad7('0x24')]||null:null,'attributes':_0x2fb9c2[_0x7ad7('0x1b')]?_0x2fb9c2[_0x7ad7('0x1b')][_0x7ad7('0x1c')]||null:null,'include':_0x2fb9c2['options']?_0x2fb9c2['options'][_0x7ad7('0x1f')]?_[_0x7ad7('0x1e')](_0x2fb9c2['options'][_0x7ad7('0x1f')],function(_0x455260){return{'model':db[_0x455260[_0x7ad7('0x20')]],'as':_0x455260['as'],'attributes':_0x455260[_0x7ad7('0x1c')],'include':_0x455260['include']?_[_0x7ad7('0x1e')](_0x455260['include'],function(_0x134d7e){return{'model':db[_0x134d7e['model']],'as':_0x134d7e['as'],'attributes':_0x134d7e['attributes'],'include':_0x134d7e[_0x7ad7('0x1f')]?_['map'](_0x134d7e[_0x7ad7('0x1f')],function(_0x1487a0){return{'model':db[_0x1487a0['model']],'as':_0x1487a0['as'],'attributes':_0x1487a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ad7('0xd')](function(_0x284cd0){logger[_0x7ad7('0xe')](_0x7ad7('0x21'),_0x2fb9c2);logger[_0x7ad7('0x25')](_0x7ad7('0x21'),_0x2fb9c2,JSON[_0x7ad7('0x12')](_0x284cd0));_0x356195(_0x284cd0);})[_0x7ad7('0x17')](function(_0x3a20fd){logger[_0x7ad7('0x13')]('ShowMailQueue',_0x3a20fd[_0x7ad7('0x15')],_0x2fb9c2);_0x1f1311(_0x26a0fb['error'](0x1f4,_0x3a20fd[_0x7ad7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index aced34e..bc04453 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 _0x76c3=['update','removeListener','save'];(function(_0x647697,_0x19c2fa){var _0x38521f=function(_0x47c563){while(--_0x47c563){_0x647697['push'](_0x647697['shift']());}};_0x38521f(++_0x19c2fa);}(_0x76c3,0xd7));var _0x376c=function(_0x381999,_0xec65f){_0x381999=_0x381999-0x0;var _0x51e118=_0x76c3[_0x381999];return _0x51e118;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x376c('0x0'),'remove',_0x376c('0x1')];function createListener(_0x310b58,_0x16e363){return function(_0x541862){_0x16e363['emit'](_0x310b58,_0x541862);};}function removeListener(_0x2bcb5b,_0x16104b){return function(){MailQueueEvents[_0x376c('0x2')](_0x2bcb5b,_0x16104b);};}exports['register']=function(_0x4a04e9){for(var _0x135c98=0x0,_0xaaadef=events['length'];_0x135c98<_0xaaadef;_0x135c98++){var _0x5a157d=events[_0x135c98];var _0x51698d=createListener('mailQueue:'+_0x5a157d,_0x4a04e9);MailQueueEvents['on'](_0x5a157d,_0x51698d);}}; \ No newline at end of file +var _0x21c7=['length','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x21c7,0x182));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0x721c('0x0'));var events=[_0x721c('0x1'),_0x721c('0x2'),_0x721c('0x3')];function createListener(_0x13d446,_0x1afef2){return function(_0x25b732){_0x1afef2[_0x721c('0x4')](_0x13d446,_0x25b732);};}function removeListener(_0x5a840a,_0x925870){return function(){MailQueueEvents[_0x721c('0x5')](_0x5a840a,_0x925870);};}exports['register']=function(_0x193506){for(var _0x122a13=0x0,_0xdb61ac=events[_0x721c('0x6')];_0x122a13<_0xdb61ac;_0x122a13++){var _0x592d64=events[_0x122a13];var _0x5c70cc=createListener('mailQueue:'+_0x592d64,_0x193506);MailQueueEvents['on'](_0x592d64,_0x5c70cc);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index e849c20..3226fcc 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 _0x0127=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x0127,0x93));var _0x7012=function(_0xc465cb,_0xfff6dd){_0xc465cb=_0xc465cb-0x0;var _0x23a861=_0x0127[_0xc465cb];return _0x23a861;};'use strict';var multer=require(_0x7012('0x0'));var util=require(_0x7012('0x1'));var path=require(_0x7012('0x2'));var timeout=require(_0x7012('0x3'));var express=require(_0x7012('0x4'));var router=express[_0x7012('0x5')]();var auth=require(_0x7012('0x6'));var interaction=require(_0x7012('0x7'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x7012('0x8')]('/',auth[_0x7012('0x9')](),controller[_0x7012('0xa')]);router[_0x7012('0x8')](_0x7012('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7012('0x8')]('/:id',auth[_0x7012('0x9')](),controller['show']);router[_0x7012('0xc')]('/',auth[_0x7012('0x9')](),controller[_0x7012('0xd')]);router[_0x7012('0xe')]('/:id',auth[_0x7012('0x9')](),controller[_0x7012('0xf')]);router[_0x7012('0x10')](_0x7012('0x11'),auth[_0x7012('0x9')](),controller['destroy']);module[_0x7012('0x12')]=router; \ No newline at end of file +var _0x5e0d=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','multer','util','path'];(function(_0x31cd47,_0x8c1faf){var _0x1e1881=function(_0x4658db){while(--_0x4658db){_0x31cd47['push'](_0x31cd47['shift']());}};_0x1e1881(++_0x8c1faf);}(_0x5e0d,0xf9));var _0xd5e0=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x5e0d[_0x277107];return _0x1da046;};'use strict';var multer=require(_0xd5e0('0x0'));var util=require(_0xd5e0('0x1'));var path=require(_0xd5e0('0x2'));var timeout=require(_0xd5e0('0x3'));var express=require(_0xd5e0('0x4'));var router=express[_0xd5e0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd5e0('0x6'));var config=require(_0xd5e0('0x7'));var controller=require('./mailQueueReport.controller');router[_0xd5e0('0x8')]('/',auth[_0xd5e0('0x9')](),controller[_0xd5e0('0xa')]);router[_0xd5e0('0x8')](_0xd5e0('0xb'),auth[_0xd5e0('0x9')](),controller[_0xd5e0('0xc')]);router[_0xd5e0('0x8')](_0xd5e0('0xd'),auth[_0xd5e0('0x9')](),controller[_0xd5e0('0xe')]);router['post']('/',auth[_0xd5e0('0x9')](),controller['create']);router[_0xd5e0('0xf')](_0xd5e0('0xd'),auth['isAuthenticated'](),controller[_0xd5e0('0x10')]);router[_0xd5e0('0x11')](_0xd5e0('0xd'),auth[_0xd5e0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 5aa5854..a91e6bc 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 _0xfbce=['sequelize','exports','STRING','DATE','moment'];(function(_0x1fbcfd,_0xc573b4){var _0x4f7808=function(_0x1a68bb){while(--_0x1a68bb){_0x1fbcfd['push'](_0x1fbcfd['shift']());}};_0x4f7808(++_0xc573b4);}(_0xfbce,0x176));var _0xefbc=function(_0x1c526f,_0xad84c7){_0x1c526f=_0x1c526f-0x0;var _0x14f246=_0xfbce[_0x1c526f];return _0x14f246;};'use strict';var moment=require(_0xefbc('0x0'));var Sequelize=require(_0xefbc('0x1'));module[_0xefbc('0x2')]={'uniqueid':{'type':Sequelize[_0xefbc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xefbc('0x3')]},'joinAt':{'type':Sequelize[_0xefbc('0x4')]},'leaveAt':{'type':Sequelize[_0xefbc('0x4')]},'acceptAt':{'type':Sequelize[_0xefbc('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9f9a=['STRING','DATE','moment','exports'];(function(_0x273517,_0x50b234){var _0x2c6334=function(_0x26c055){while(--_0x26c055){_0x273517['push'](_0x273517['shift']());}};_0x2c6334(++_0x50b234);}(_0x9f9a,0x76));var _0xa9f9=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x9f9a[_0x454e6d];return _0x4bc294;};'use strict';var moment=require(_0xa9f9('0x0'));var Sequelize=require('sequelize');module[_0xa9f9('0x1')]={'uniqueid':{'type':Sequelize[_0xa9f9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa9f9('0x2')]},'joinAt':{'type':Sequelize[_0xa9f9('0x3')]},'leaveAt':{'type':Sequelize[_0xa9f9('0x3')]},'acceptAt':{'type':Sequelize[_0xa9f9('0x3')]},'exitAt':{'type':Sequelize[_0xa9f9('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 575fb5a..f0d1d67 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 _0xd0ae=['update','then','destroy','error','stack','name','send','index','map','MailQueueReport','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','apply','reject','save'];(function(_0x2379f2,_0x1c91bc){var _0x2015af=function(_0x432f30){while(--_0x432f30){_0x2379f2['push'](_0x2379f2['shift']());}};_0x2015af(++_0x1c91bc);}(_0xd0ae,0x160));var _0xed0a=function(_0x3952b4,_0x84d2ab){_0x3952b4=_0x3952b4-0x0;var _0x3e6c0d=_0xd0ae[_0x3952b4];return _0x3e6c0d;};'use strict';var pdf=require(_0xed0a('0x0'));var emlformat=require(_0xed0a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xed0a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed0a('0x3'));var moment=require(_0xed0a('0x4'));var BPromise=require(_0xed0a('0x5'));var Mustache=require(_0xed0a('0x6'));var util=require(_0xed0a('0x7'));var path=require('path');var sox=require(_0xed0a('0x8'));var csv=require(_0xed0a('0x9'));var ejs=require(_0xed0a('0xa'));var fs=require('fs');var _=require(_0xed0a('0xb'));var squel=require(_0xed0a('0xc'));var crypto=require(_0xed0a('0xd'));var jsforce=require(_0xed0a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xed0a('0x9'));var querystring=require(_0xed0a('0xf'));var Papa=require(_0xed0a('0x10'));var Redis=require(_0xed0a('0x11'));var authService=require(_0xed0a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xed0a('0x13'));var hardwareService=require(_0xed0a('0x14'));var logger=require(_0xed0a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xed0a('0x16'));var db=require(_0xed0a('0x17'))['db'];function respondWithStatusCode(_0x195257,_0xe0507a){_0xe0507a=_0xe0507a||0xcc;return function(_0x3497f2){if(_0x3497f2){return _0x195257[_0xed0a('0x18')](_0xe0507a);}return _0x195257[_0xed0a('0x19')](_0xe0507a)[_0xed0a('0x1a')]();};}function respondWithResult(_0xce85ff,_0x45443a){_0x45443a=_0x45443a||0xc8;return function(_0x8f141a){if(_0x8f141a){return _0xce85ff[_0xed0a('0x19')](_0x45443a)['json'](_0x8f141a);}};}function respondWithFilteredResult(_0x396dc5,_0x4ec61c){return function(_0x3f96de){if(_0x3f96de){var _0x3f622a=_0x3f96de[_0xed0a('0x1b')],_0x3201f1=_0x4ec61c[_0xed0a('0x1c')],_0x19d3cd=_0x4ec61c[_0xed0a('0x1c')]+_0x4ec61c['limit'],_0x5e53f3;if(_0x19d3cd>=_0x3f622a){_0x19d3cd=_0x3f622a;_0x5e53f3=0xc8;}else{_0x5e53f3=0xce;}_0x396dc5[_0xed0a('0x19')](_0x5e53f3);return _0x396dc5[_0xed0a('0x1d')]('Content-Range',_0x3201f1+'-'+_0x19d3cd+'/'+_0x3f622a)['json'](_0x3f96de);}return null;};}function patchUpdates(_0x6f23cd){return function(_0x34daae){try{jsonpatch[_0xed0a('0x1e')](_0x34daae,_0x6f23cd,!![]);}catch(_0x3700ad){return BPromise[_0xed0a('0x1f')](_0x3700ad);}return _0x34daae[_0xed0a('0x20')]();};}function saveUpdates(_0x285e0c,_0x3c63a4){return function(_0x51cb81){if(_0x51cb81){return _0x51cb81[_0xed0a('0x21')](_0x285e0c)[_0xed0a('0x22')](function(_0x18218b){return _0x18218b;});}return null;};}function removeEntity(_0x50a8d8,_0x5a8efe){return function(_0x20a3f6){if(_0x20a3f6){return _0x20a3f6[_0xed0a('0x23')]()['then'](function(){_0x50a8d8[_0xed0a('0x19')](0xcc)[_0xed0a('0x1a')]();});}};}function handleEntityNotFound(_0xd81ba8,_0x5ba3c6){return function(_0x296d43){if(!_0x296d43){_0xd81ba8[_0xed0a('0x18')](0x194);}return _0x296d43;};}function handleError(_0x214b08,_0x5bb2c9){_0x5bb2c9=_0x5bb2c9||0x1f4;return function(_0xf21bef){logger[_0xed0a('0x24')](_0xf21bef[_0xed0a('0x25')]);if(_0xf21bef[_0xed0a('0x26')]){delete _0xf21bef[_0xed0a('0x26')];}_0x214b08[_0xed0a('0x19')](_0x5bb2c9)[_0xed0a('0x27')](_0xf21bef);};}exports[_0xed0a('0x28')]=function(_0x3438d5,_0x2b9817){var _0x418fcc={},_0x5ef80d={},_0xfd4ab4={'count':0x0,'rows':[]};var _0x1b39bb=_[_0xed0a('0x29')](db[_0xed0a('0x2a')]['rawAttributes'],function(_0x233a6f){return{'name':_0x233a6f[_0xed0a('0x2b')],'type':_0x233a6f[_0xed0a('0x2c')][_0xed0a('0x2d')]};});_0x5ef80d[_0xed0a('0x2e')]=_['map'](_0x1b39bb,_0xed0a('0x26'));_0x5ef80d['query']=_[_0xed0a('0x2f')](_0x3438d5[_0xed0a('0x30')]);_0x5ef80d['filters']=_[_0xed0a('0x31')](_0x5ef80d[_0xed0a('0x2e')],_0x5ef80d[_0xed0a('0x30')]);_0x418fcc['attributes']=_['intersection'](_0x5ef80d[_0xed0a('0x2e')],qs[_0xed0a('0x32')](_0x3438d5['query'][_0xed0a('0x32')]));_0x418fcc[_0xed0a('0x33')]=_0x418fcc['attributes'][_0xed0a('0x34')]?_0x418fcc[_0xed0a('0x33')]:_0x5ef80d[_0xed0a('0x2e')];if(!_0x3438d5[_0xed0a('0x30')][_0xed0a('0x35')](_0xed0a('0x36'))){_0x418fcc[_0xed0a('0x37')]=qs[_0xed0a('0x37')](_0x3438d5['query'][_0xed0a('0x37')]);_0x418fcc['offset']=qs[_0xed0a('0x1c')](_0x3438d5[_0xed0a('0x30')]['offset']);}_0x418fcc[_0xed0a('0x38')]=qs[_0xed0a('0x39')](_0x3438d5[_0xed0a('0x30')][_0xed0a('0x39')]);_0x418fcc[_0xed0a('0x3a')]=qs[_0xed0a('0x3b')](_[_0xed0a('0x3c')](_0x3438d5[_0xed0a('0x30')],_0x5ef80d[_0xed0a('0x3b')]),_0x1b39bb);if(_0x3438d5[_0xed0a('0x30')][_0xed0a('0x3d')]){_0x418fcc[_0xed0a('0x3a')]=_['merge'](_0x418fcc[_0xed0a('0x3a')],{'$or':_[_0xed0a('0x29')](_0x1b39bb,function(_0x12f162){if(_0x12f162[_0xed0a('0x2c')]!==_0xed0a('0x3e')){var _0x369669={};_0x369669[_0x12f162[_0xed0a('0x26')]]={'$like':'%'+_0x3438d5[_0xed0a('0x30')][_0xed0a('0x3d')]+'%'};return _0x369669;}})});}_0x418fcc=_[_0xed0a('0x3f')]({},_0x418fcc,_0x3438d5[_0xed0a('0x40')]);var _0x8f8539={'where':_0x418fcc[_0xed0a('0x3a')]};return db[_0xed0a('0x2a')][_0xed0a('0x1b')](_0x8f8539)[_0xed0a('0x22')](function(_0x544dea){_0xfd4ab4[_0xed0a('0x1b')]=_0x544dea;if(_0x3438d5['query'][_0xed0a('0x41')]){_0x418fcc[_0xed0a('0x42')]=[{'all':!![]}];}return db[_0xed0a('0x2a')][_0xed0a('0x43')](_0x418fcc);})[_0xed0a('0x22')](function(_0x37cab3){_0xfd4ab4[_0xed0a('0x44')]=_0x37cab3;return _0xfd4ab4;})[_0xed0a('0x22')](respondWithFilteredResult(_0x2b9817,_0x418fcc))[_0xed0a('0x45')](handleError(_0x2b9817,null));};exports[_0xed0a('0x46')]=function(_0x53a49a,_0x3d99eb){var _0x2caf31={'raw':!![],'where':{'id':_0x53a49a[_0xed0a('0x47')]['id']}},_0x179756={};_0x179756[_0xed0a('0x2e')]=_[_0xed0a('0x2f')](db[_0xed0a('0x2a')][_0xed0a('0x48')]);_0x179756[_0xed0a('0x30')]=_[_0xed0a('0x2f')](_0x53a49a[_0xed0a('0x30')]);_0x179756[_0xed0a('0x3b')]=_[_0xed0a('0x31')](_0x179756[_0xed0a('0x2e')],_0x179756[_0xed0a('0x30')]);_0x2caf31['attributes']=_['intersection'](_0x179756[_0xed0a('0x2e')],qs['fields'](_0x53a49a['query'][_0xed0a('0x32')]));_0x2caf31[_0xed0a('0x33')]=_0x2caf31[_0xed0a('0x33')][_0xed0a('0x34')]?_0x2caf31[_0xed0a('0x33')]:_0x179756[_0xed0a('0x2e')];if(_0x53a49a['query'][_0xed0a('0x41')]){_0x2caf31[_0xed0a('0x42')]=[{'all':!![]}];}_0x2caf31=_[_0xed0a('0x3f')]({},_0x2caf31,_0x53a49a[_0xed0a('0x40')]);return db[_0xed0a('0x2a')][_0xed0a('0x49')](_0x2caf31)[_0xed0a('0x22')](handleEntityNotFound(_0x3d99eb,null))[_0xed0a('0x22')](respondWithResult(_0x3d99eb,null))[_0xed0a('0x45')](handleError(_0x3d99eb,null));};exports[_0xed0a('0x4a')]=function(_0x18351c,_0x511c3d){return db['MailQueueReport'][_0xed0a('0x4a')](_0x18351c['body'],{})['then'](respondWithResult(_0x511c3d,0xc9))[_0xed0a('0x45')](handleError(_0x511c3d,null));};exports[_0xed0a('0x21')]=function(_0x197207,_0x331fe8){if(_0x197207['body']['id']){delete _0x197207['body']['id'];}return db['MailQueueReport'][_0xed0a('0x49')]({'where':{'id':_0x197207[_0xed0a('0x47')]['id']}})[_0xed0a('0x22')](handleEntityNotFound(_0x331fe8,null))[_0xed0a('0x22')](saveUpdates(_0x197207[_0xed0a('0x4b')],null))[_0xed0a('0x22')](respondWithResult(_0x331fe8,null))[_0xed0a('0x45')](handleError(_0x331fe8,null));};exports['destroy']=function(_0x50f1e0,_0x14932d){return db[_0xed0a('0x2a')][_0xed0a('0x49')]({'where':{'id':_0x50f1e0['params']['id']}})[_0xed0a('0x22')](handleEntityNotFound(_0x14932d,null))[_0xed0a('0x22')](removeEntity(_0x14932d,null))[_0xed0a('0x45')](handleError(_0x14932d,null));};exports[_0xed0a('0x4c')]=function(_0x52affc,_0x3fe3e3){return db[_0xed0a('0x2a')][_0xed0a('0x4c')]()[_0xed0a('0x22')](respondWithResult(_0x3fe3e3,null))[_0xed0a('0x45')](handleError(_0x3fe3e3,null));}; \ No newline at end of file +var _0xe200=['jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','MailQueueReport','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','ejs','squel','crypto'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe200,0x8d));var _0x0e20=function(_0x182cb7,_0x37aded){_0x182cb7=_0x182cb7-0x0;var _0x71e9a3=_0xe200[_0x182cb7];return _0x71e9a3;};'use strict';var pdf=require(_0x0e20('0x0'));var emlformat=require(_0x0e20('0x1'));var rimraf=require(_0x0e20('0x2'));var zipdir=require(_0x0e20('0x3'));var jsonpatch=require(_0x0e20('0x4'));var rp=require(_0x0e20('0x5'));var moment=require(_0x0e20('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0e20('0x7'));var csv=require('to-csv');var ejs=require(_0x0e20('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0e20('0x9'));var crypto=require(_0x0e20('0xa'));var jsforce=require(_0x0e20('0xb'));var deskjs=require(_0x0e20('0xc'));var toCsv=require(_0x0e20('0xd'));var querystring=require(_0x0e20('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e20('0xf'));var authService=require(_0x0e20('0x10'));var qs=require(_0x0e20('0x11'));var as=require(_0x0e20('0x12'));var hardwareService=require(_0x0e20('0x13'));var logger=require(_0x0e20('0x14'))(_0x0e20('0x15'));var utils=require(_0x0e20('0x16'));var config=require(_0x0e20('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4357b0,_0x4660d8){_0x4660d8=_0x4660d8||0xcc;return function(_0x5afba7){if(_0x5afba7){return _0x4357b0['sendStatus'](_0x4660d8);}return _0x4357b0[_0x0e20('0x18')](_0x4660d8)[_0x0e20('0x19')]();};}function respondWithResult(_0x3beee9,_0x3acf2d){_0x3acf2d=_0x3acf2d||0xc8;return function(_0x3fec32){if(_0x3fec32){return _0x3beee9[_0x0e20('0x18')](_0x3acf2d)['json'](_0x3fec32);}};}function respondWithFilteredResult(_0x282825,_0xa02b33){return function(_0x5ddcaa){if(_0x5ddcaa){var _0x2fd969=_0x5ddcaa[_0x0e20('0x1a')],_0x2723a2=_0xa02b33[_0x0e20('0x1b')],_0x4a84b0=_0xa02b33['offset']+_0xa02b33[_0x0e20('0x1c')],_0x405084;if(_0x4a84b0>=_0x2fd969){_0x4a84b0=_0x2fd969;_0x405084=0xc8;}else{_0x405084=0xce;}_0x282825[_0x0e20('0x18')](_0x405084);return _0x282825['set'](_0x0e20('0x1d'),_0x2723a2+'-'+_0x4a84b0+'/'+_0x2fd969)[_0x0e20('0x1e')](_0x5ddcaa);}return null;};}function patchUpdates(_0x50f958){return function(_0x502c18){try{jsonpatch[_0x0e20('0x1f')](_0x502c18,_0x50f958,!![]);}catch(_0x419532){return BPromise[_0x0e20('0x20')](_0x419532);}return _0x502c18['save']();};}function saveUpdates(_0xc882b,_0x36b3b3){return function(_0x17e4ce){if(_0x17e4ce){return _0x17e4ce[_0x0e20('0x21')](_0xc882b)[_0x0e20('0x22')](function(_0x27fa19){return _0x27fa19;});}return null;};}function removeEntity(_0x2790b3,_0x5cc135){return function(_0x21542f){if(_0x21542f){return _0x21542f[_0x0e20('0x23')]()[_0x0e20('0x22')](function(){_0x2790b3[_0x0e20('0x18')](0xcc)[_0x0e20('0x19')]();});}};}function handleEntityNotFound(_0x2b516c,_0x23978f){return function(_0x2feb5a){if(!_0x2feb5a){_0x2b516c['sendStatus'](0x194);}return _0x2feb5a;};}function handleError(_0xbef29f,_0x41cbe0){_0x41cbe0=_0x41cbe0||0x1f4;return function(_0x56737a){logger[_0x0e20('0x24')](_0x56737a[_0x0e20('0x25')]);if(_0x56737a['name']){delete _0x56737a['name'];}_0xbef29f[_0x0e20('0x18')](_0x41cbe0)[_0x0e20('0x26')](_0x56737a);};}exports[_0x0e20('0x27')]=function(_0x6bbaa3,_0x4b8e93){var _0x104ae6={},_0x305286={},_0x51a36e={'count':0x0,'rows':[]};var _0x21685d=_[_0x0e20('0x28')](db['MailQueueReport'][_0x0e20('0x29')],function(_0x5daaea){return{'name':_0x5daaea[_0x0e20('0x2a')],'type':_0x5daaea[_0x0e20('0x2b')][_0x0e20('0x2c')]};});_0x305286['model']=_['map'](_0x21685d,_0x0e20('0x2d'));_0x305286['query']=_['keys'](_0x6bbaa3['query']);_0x305286[_0x0e20('0x2e')]=_[_0x0e20('0x2f')](_0x305286[_0x0e20('0x30')],_0x305286[_0x0e20('0x31')]);_0x104ae6[_0x0e20('0x32')]=_[_0x0e20('0x2f')](_0x305286['model'],qs[_0x0e20('0x33')](_0x6bbaa3[_0x0e20('0x31')][_0x0e20('0x33')]));_0x104ae6[_0x0e20('0x32')]=_0x104ae6['attributes'][_0x0e20('0x34')]?_0x104ae6['attributes']:_0x305286[_0x0e20('0x30')];if(!_0x6bbaa3[_0x0e20('0x31')][_0x0e20('0x35')](_0x0e20('0x36'))){_0x104ae6[_0x0e20('0x1c')]=qs['limit'](_0x6bbaa3[_0x0e20('0x31')][_0x0e20('0x1c')]);_0x104ae6[_0x0e20('0x1b')]=qs['offset'](_0x6bbaa3[_0x0e20('0x31')][_0x0e20('0x1b')]);}_0x104ae6[_0x0e20('0x37')]=qs['sort'](_0x6bbaa3['query'][_0x0e20('0x38')]);_0x104ae6[_0x0e20('0x39')]=qs[_0x0e20('0x2e')](_[_0x0e20('0x3a')](_0x6bbaa3['query'],_0x305286[_0x0e20('0x2e')]),_0x21685d);if(_0x6bbaa3['query'][_0x0e20('0x3b')]){_0x104ae6['where']=_['merge'](_0x104ae6[_0x0e20('0x39')],{'$or':_['map'](_0x21685d,function(_0x31c2d1){if(_0x31c2d1['type']!==_0x0e20('0x3c')){var _0x25e828={};_0x25e828[_0x31c2d1[_0x0e20('0x2d')]]={'$like':'%'+_0x6bbaa3[_0x0e20('0x31')]['filter']+'%'};return _0x25e828;}})});}_0x104ae6=_[_0x0e20('0x3d')]({},_0x104ae6,_0x6bbaa3['options']);var _0x4d6095={'where':_0x104ae6[_0x0e20('0x39')]};return db[_0x0e20('0x3e')][_0x0e20('0x1a')](_0x4d6095)['then'](function(_0x399cfb){_0x51a36e['count']=_0x399cfb;if(_0x6bbaa3['query'][_0x0e20('0x3f')]){_0x104ae6[_0x0e20('0x40')]=[{'all':!![]}];}return db[_0x0e20('0x3e')][_0x0e20('0x41')](_0x104ae6);})[_0x0e20('0x22')](function(_0x415bc4){_0x51a36e[_0x0e20('0x42')]=_0x415bc4;return _0x51a36e;})[_0x0e20('0x22')](respondWithFilteredResult(_0x4b8e93,_0x104ae6))['catch'](handleError(_0x4b8e93,null));};exports[_0x0e20('0x43')]=function(_0xf87182,_0x24564f){var _0x269a92={'raw':!![],'where':{'id':_0xf87182[_0x0e20('0x44')]['id']}},_0x51cb06={};_0x51cb06[_0x0e20('0x30')]=_[_0x0e20('0x45')](db[_0x0e20('0x3e')][_0x0e20('0x29')]);_0x51cb06[_0x0e20('0x31')]=_[_0x0e20('0x45')](_0xf87182['query']);_0x51cb06[_0x0e20('0x2e')]=_[_0x0e20('0x2f')](_0x51cb06[_0x0e20('0x30')],_0x51cb06[_0x0e20('0x31')]);_0x269a92[_0x0e20('0x32')]=_[_0x0e20('0x2f')](_0x51cb06[_0x0e20('0x30')],qs[_0x0e20('0x33')](_0xf87182[_0x0e20('0x31')][_0x0e20('0x33')]));_0x269a92['attributes']=_0x269a92[_0x0e20('0x32')][_0x0e20('0x34')]?_0x269a92[_0x0e20('0x32')]:_0x51cb06[_0x0e20('0x30')];if(_0xf87182[_0x0e20('0x31')]['includeAll']){_0x269a92[_0x0e20('0x40')]=[{'all':!![]}];}_0x269a92=_['merge']({},_0x269a92,_0xf87182[_0x0e20('0x46')]);return db[_0x0e20('0x3e')][_0x0e20('0x47')](_0x269a92)[_0x0e20('0x22')](handleEntityNotFound(_0x24564f,null))[_0x0e20('0x22')](respondWithResult(_0x24564f,null))[_0x0e20('0x48')](handleError(_0x24564f,null));};exports[_0x0e20('0x49')]=function(_0x3fc8f7,_0xd05698){return db[_0x0e20('0x3e')]['create'](_0x3fc8f7[_0x0e20('0x4a')],{})['then'](respondWithResult(_0xd05698,0xc9))[_0x0e20('0x48')](handleError(_0xd05698,null));};exports['update']=function(_0x35417d,_0x1b476b){if(_0x35417d['body']['id']){delete _0x35417d[_0x0e20('0x4a')]['id'];}return db['MailQueueReport'][_0x0e20('0x47')]({'where':{'id':_0x35417d[_0x0e20('0x44')]['id']}})[_0x0e20('0x22')](handleEntityNotFound(_0x1b476b,null))[_0x0e20('0x22')](saveUpdates(_0x35417d[_0x0e20('0x4a')],null))[_0x0e20('0x22')](respondWithResult(_0x1b476b,null))['catch'](handleError(_0x1b476b,null));};exports[_0x0e20('0x23')]=function(_0x4ba8ff,_0x1b16ef){return db[_0x0e20('0x3e')][_0x0e20('0x47')]({'where':{'id':_0x4ba8ff[_0x0e20('0x44')]['id']}})[_0x0e20('0x22')](handleEntityNotFound(_0x1b16ef,null))[_0x0e20('0x22')](removeEntity(_0x1b16ef,null))['catch'](handleError(_0x1b16ef,null));};exports['describe']=function(_0x26919b,_0x330746){return db[_0x0e20('0x3e')][_0x0e20('0x4b')]()[_0x0e20('0x22')](respondWithResult(_0x330746,null))[_0x0e20('0x48')](handleError(_0x330746,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3b26adb..1fa6186 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 _0xd052=['../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','../../config/logger','moment','path'];(function(_0x4271f0,_0x227df5){var _0x5064dc=function(_0x8864f9){while(--_0x8864f9){_0x4271f0['push'](_0x4271f0['shift']());}};_0x5064dc(++_0x227df5);}(_0xd052,0x69));var _0x2d05=function(_0x339ded,_0xb38a57){_0x339ded=_0x339ded-0x0;var _0x37f8dc=_0xd052[_0x339ded];return _0x37f8dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d05('0x0'))('api');var moment=require(_0x2d05('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d05('0x2'));var rimraf=require('rimraf');var config=require(_0x2d05('0x3'));var attributes=require(_0x2d05('0x4'));module['exports']=function(_0x380979,_0x15de1f){return _0x380979[_0x2d05('0x5')](_0x2d05('0x6'),attributes,{'tableName':_0x2d05('0x7'),'paranoid':![],'indexes':[{'name':_0x2d05('0x8'),'fields':[_0x2d05('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf108=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xf108,0x1d9));var _0x8f10=function(_0x1e1911,_0x1326ce){_0x1e1911=_0x1e1911-0x0;var _0x51f6c7=_0xf108[_0x1e1911];return _0x51f6c7;};'use strict';var _=require(_0x8f10('0x0'));var util=require('util');var logger=require(_0x8f10('0x1'))(_0x8f10('0x2'));var moment=require(_0x8f10('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f10('0x4'));var config=require(_0x8f10('0x5'));var attributes=require(_0x8f10('0x6'));module[_0x8f10('0x7')]=function(_0x2e3419,_0x235737){return _0x2e3419[_0x8f10('0x8')](_0x8f10('0x9'),attributes,{'tableName':_0x8f10('0xa'),'paranoid':![],'indexes':[{'name':_0x8f10('0xb'),'fields':[_0x8f10('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6a05b75..4193563 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 _0x187d=['MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','then','UpdateMailQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info'];(function(_0x51fb88,_0x1b5555){var _0x46c4d0=function(_0xaff8f2){while(--_0xaff8f2){_0x51fb88['push'](_0x51fb88['shift']());}};_0x46c4d0(++_0x1b5555);}(_0x187d,0x93));var _0xd187=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x187d[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});}exports[_0xd187('0x15')]=function(_0x374fe0){var _0x10d9fd=this;return new Promise(function(_0x21df74,_0x253a7e){return db[_0xd187('0x16')][_0xd187('0x17')](_0x374fe0[_0xd187('0x18')],{'raw':_0x374fe0[_0xd187('0x19')]?_0x374fe0[_0xd187('0x19')][_0xd187('0x1a')]===undefined?!![]:![]:!![]})[_0xd187('0x1b')](function(_0x5204ee){logger[_0xd187('0xc')](_0xd187('0x15'),_0x374fe0);logger[_0xd187('0xf')]('CreateMailQueueReport',_0x374fe0,JSON['stringify'](_0x5204ee));_0x21df74(_0x5204ee);})['catch'](function(_0x435d94){logger[_0xd187('0x12')](_0xd187('0x15'),_0x435d94['message'],_0x374fe0);_0x253a7e(_0x10d9fd[_0xd187('0x12')](0x1f4,_0x435d94['message']));});});};exports[_0xd187('0x1c')]=function(_0x5a7a23){var _0x1047f4=this;return new Promise(function(_0x54f340,_0x4f3879){return db[_0xd187('0x16')]['update'](_0x5a7a23[_0xd187('0x18')],{'raw':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23[_0xd187('0x19')][_0xd187('0x1d')]||null:null,'attributes':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23['options'][_0xd187('0x1e')]||null:null,'limit':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23['options'][_0xd187('0x1f')]||null:null})[_0xd187('0x1b')](function(_0x34febe){logger['info'](_0xd187('0x1c'),_0x5a7a23);logger['debug'](_0xd187('0x1c'),_0x5a7a23,JSON[_0xd187('0x11')](_0x34febe));_0x54f340(_0x34febe);})[_0xd187('0x14')](function(_0x352b66){logger['error'](_0xd187('0x1c'),_0x352b66[_0xd187('0x13')],_0x5a7a23);_0x4f3879(_0x1047f4['error'](0x1f4,_0x352b66['message']));});});}; \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateMailQueueReport','create','body','options','debug','stringify','UpdateMailQueueReport','MailQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0xf494,0x1c6));var _0x4f49=function(_0x4e14be,_0x582681){_0x4e14be=_0x4e14be-0x0;var _0x411d69=_0xf494[_0x4e14be];return _0x411d69;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['MailQueueReport'][_0x4f49('0x17')](_0x4e85df[_0x4f49('0x18')],{'raw':_0x4e85df[_0x4f49('0x19')]?_0x4e85df[_0x4f49('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4f49('0xe')](function(_0x2aed27){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1a')]('CreateMailQueueReport',_0x4e85df,JSON[_0x4f49('0x1b')](_0x2aed27));_0x5bb23b(_0x2aed27);})[_0x4f49('0x15')](function(_0x3ae590){logger['error'](_0x4f49('0x16'),_0x3ae590[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x3ae590[_0x4f49('0x14')]));});});};exports[_0x4f49('0x1c')]=function(_0x36187b){var _0x559d98=this;return new Promise(function(_0x4e9041,_0x3a947b){return db[_0x4f49('0x1d')]['update'](_0x36187b[_0x4f49('0x18')],{'raw':_0x36187b[_0x4f49('0x19')]?_0x36187b[_0x4f49('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36187b[_0x4f49('0x19')]?_0x36187b[_0x4f49('0x19')][_0x4f49('0x1e')]||null:null,'attributes':_0x36187b[_0x4f49('0x19')]?_0x36187b[_0x4f49('0x19')][_0x4f49('0x1f')]||null:null,'limit':_0x36187b['options']?_0x36187b['options'][_0x4f49('0x20')]||null:null})[_0x4f49('0xe')](function(_0x605c91){logger['info'](_0x4f49('0x1c'),_0x36187b);logger[_0x4f49('0x1a')](_0x4f49('0x1c'),_0x36187b,JSON['stringify'](_0x605c91));_0x4e9041(_0x605c91);})['catch'](function(_0x3e207f){logger[_0x4f49('0x13')](_0x4f49('0x1c'),_0x3e207f['message'],_0x36187b);_0x3a947b(_0x559d98[_0x4f49('0x13')](0x1f4,_0x3e207f[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index b4dd6df..fd0b9bb 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 _0x2fe7=['../../components/interaction/service','exports','util','path','express','Router'];(function(_0x256103,_0x4302f8){var _0x56e3c3=function(_0x139b72){while(--_0x139b72){_0x256103['push'](_0x256103['shift']());}};_0x56e3c3(++_0x4302f8);}(_0x2fe7,0x1ee));var _0x72fe=function(_0x5eac05,_0x15f2ba){_0x5eac05=_0x5eac05-0x0;var _0x28090b=_0x2fe7[_0x5eac05];return _0x28090b;};'use strict';var multer=require('multer');var util=require(_0x72fe('0x0'));var path=require(_0x72fe('0x1'));var timeout=require('connect-timeout');var express=require(_0x72fe('0x2'));var router=express[_0x72fe('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x72fe('0x4'));var config=require('../../config/environment');module[_0x72fe('0x5')]=router; \ No newline at end of file +var _0x182f=['util','connect-timeout','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x182f,0x113));var _0xf182=function(_0x37b286,_0x55435a){_0x37b286=_0x37b286-0x0;var _0x446179=_0x182f[_0x37b286];return _0x446179;};'use strict';var multer=require(_0xf182('0x0'));var util=require(_0xf182('0x1'));var path=require('path');var timeout=require(_0xf182('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf182('0x3'));var config=require(_0xf182('0x4'));module[_0xf182('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 8d25f13..7e3033b 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 _0x3155=['STRING','BOOLEAN','username','INTEGER','INBOX','sequelize'];(function(_0x4d15cd,_0x7dc2f7){var _0x15a57d=function(_0x26a59d){while(--_0x26a59d){_0x4d15cd['push'](_0x4d15cd['shift']());}};_0x15a57d(++_0x7dc2f7);}(_0x3155,0x125));var _0x5315=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x3155[_0x27d958];return _0x53e63e;};'use strict';var Sequelize=require(_0x5315('0x0'));module['exports']={'description':{'type':Sequelize[_0x5315('0x1')]},'host':{'type':Sequelize[_0x5315('0x1')]},'authentication':{'type':Sequelize[_0x5315('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x5315('0x3')},'password':{'type':Sequelize[_0x5315('0x1')]},'port':{'type':Sequelize[_0x5315('0x4')]},'tls':{'type':Sequelize[_0x5315('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5315('0x1')],'defaultValue':_0x5315('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5315('0x1')]}}; \ No newline at end of file +var _0xbc27=['STRING','BOOLEAN','username','INTEGER','sequelize','exports'];(function(_0x11cbcd,_0x13a2ce){var _0x597934=function(_0x253ba9){while(--_0x253ba9){_0x11cbcd['push'](_0x11cbcd['shift']());}};_0x597934(++_0x13a2ce);}(_0xbc27,0xdc));var _0x7bc2=function(_0x373d8,_0xb69e75){_0x373d8=_0x373d8-0x0;var _0x4d6d14=_0xbc27[_0x373d8];return _0x4d6d14;};'use strict';var Sequelize=require(_0x7bc2('0x0'));module[_0x7bc2('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7bc2('0x2')]},'authentication':{'type':Sequelize[_0x7bc2('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7bc2('0x2')],'unique':_0x7bc2('0x4')},'password':{'type':Sequelize[_0x7bc2('0x2')]},'port':{'type':Sequelize[_0x7bc2('0x5')]},'tls':{'type':Sequelize[_0x7bc2('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x7bc2('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7bc2('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x7bc2('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 87c52db..0128c11 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 _0x90b5=['exports','MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x27fdcb,_0xe5c55b){var _0x51b14d=function(_0x2ddaa5){while(--_0x2ddaa5){_0x27fdcb['push'](_0x27fdcb['shift']());}};_0x51b14d(++_0xe5c55b);}(_0x90b5,0x139));var _0x590b=function(_0x377949,_0x24acce){_0x377949=_0x377949-0x0;var _0xbcaa4d=_0x90b5[_0x377949];return _0xbcaa4d;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var logger=require(_0x590b('0x1'))(_0x590b('0x2'));var moment=require(_0x590b('0x3'));var BPromise=require(_0x590b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var attributes=require('./mailServerIn.attributes');module[_0x590b('0x7')]=function(_0x2059e4,_0x88a5f9){return _0x2059e4['define'](_0x590b('0x8'),attributes,{'tableName':_0x590b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbe=['mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x52b8a8,_0x383b86){var _0x49e67f=function(_0x55486e){while(--_0x55486e){_0x52b8a8['push'](_0x52b8a8['shift']());}};_0x49e67f(++_0x383b86);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x3dc2bf,_0x5c13dd){_0x3dc2bf=_0x3dc2bf-0x0;var _0x1c9865=_0xfcbe[_0x3dc2bf];return _0x1c9865;};'use strict';var _=require('lodash');var util=require(_0xefcb('0x0'));var logger=require(_0xefcb('0x1'))(_0xefcb('0x2'));var moment=require(_0xefcb('0x3'));var BPromise=require(_0xefcb('0x4'));var rp=require(_0xefcb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefcb('0x6'));var config=require(_0xefcb('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x50dcde,_0x3f322c){return _0x50dcde['define']('MailServerIn',attributes,{'tableName':_0xefcb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 8e46ef9..797f4e6 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 _0xe4ee=['info','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xe4ee,0x124));var _0xee4e=function(_0x34630a,_0x25691c){_0x34630a=_0x34630a-0x0;var _0x3169d8=_0xe4ee[_0x34630a];return _0x3169d8;};'use strict';var _=require('lodash');var util=require(_0xee4e('0x0'));var moment=require(_0xee4e('0x1'));var BPromise=require(_0xee4e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xee4e('0x3'))(_0xee4e('0x4'));var config=require(_0xee4e('0x5'));var jayson=require(_0xee4e('0x6'));var client=jayson[_0xee4e('0x7')][_0xee4e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc037f9,_0x2ae824,_0x2cd9e8){return new BPromise(function(_0x2b3a95,_0x40043b){return client[_0xee4e('0x9')](_0xc037f9,_0x2cd9e8)[_0xee4e('0xa')](function(_0x23dac0){logger['info'](_0xee4e('0xb'),_0x2ae824,_0xee4e('0xc'));logger[_0xee4e('0xd')](_0xee4e('0xe'),_0x2ae824,_0xee4e('0xc'),JSON[_0xee4e('0xf')](_0x23dac0));if(_0x23dac0[_0xee4e('0x10')]){if(_0x23dac0['error']['code']===0x1f4){logger[_0xee4e('0x10')](_0xee4e('0xb'),_0x2ae824,_0x23dac0[_0xee4e('0x10')]['message']);return _0x40043b(_0x23dac0[_0xee4e('0x10')][_0xee4e('0x11')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x2ae824,_0x23dac0[_0xee4e('0x10')][_0xee4e('0x11')]);return _0x2b3a95(_0x23dac0[_0xee4e('0x10')][_0xee4e('0x11')]);}else{logger[_0xee4e('0x12')](_0xee4e('0xb'),_0x2ae824,_0xee4e('0xc'));_0x2b3a95(_0x23dac0['result'][_0xee4e('0x11')]);}})[_0xee4e('0x13')](function(_0x5c12ff){logger[_0xee4e('0x10')](_0xee4e('0xb'),_0x2ae824,_0x5c12ff);_0x40043b(_0x5c12ff);});});}exports[_0xee4e('0x14')]=function(_0x190737){var _0x50f453=this;return new Promise(function(_0xb05edf,_0x48be3c){return db[_0xee4e('0x15')][_0xee4e('0x16')]({'raw':_0x190737[_0xee4e('0x17')]?_0x190737[_0xee4e('0x17')][_0xee4e('0x18')]===undefined?!![]:![]:!![],'where':_0x190737[_0xee4e('0x17')]?_0x190737[_0xee4e('0x17')][_0xee4e('0x19')]||null:null,'attributes':_0x190737[_0xee4e('0x17')]?_0x190737['options'][_0xee4e('0x1a')]||null:null,'limit':_0x190737[_0xee4e('0x17')]?_0x190737[_0xee4e('0x17')][_0xee4e('0x1b')]||null:null,'include':_0x190737[_0xee4e('0x17')]?_0x190737[_0xee4e('0x17')]['include']?_['map'](_0x190737[_0xee4e('0x17')][_0xee4e('0x1c')],function(_0x4e5fd2){return{'model':db[_0x4e5fd2['model']],'as':_0x4e5fd2['as'],'attributes':_0x4e5fd2[_0xee4e('0x1a')],'include':_0x4e5fd2[_0xee4e('0x1c')]?_[_0xee4e('0x1d')](_0x4e5fd2[_0xee4e('0x1c')],function(_0x311a16){return{'model':db[_0x311a16[_0xee4e('0x1e')]],'as':_0x311a16['as'],'attributes':_0x311a16[_0xee4e('0x1a')],'include':_0x311a16[_0xee4e('0x1c')]?_[_0xee4e('0x1d')](_0x311a16['include'],function(_0xaeb12b){return{'model':db[_0xaeb12b[_0xee4e('0x1e')]],'as':_0xaeb12b['as'],'attributes':_0xaeb12b[_0xee4e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xee4e('0xa')](function(_0x1d2aa3){logger[_0xee4e('0x12')](_0xee4e('0x14'),_0x190737);logger[_0xee4e('0xd')](_0xee4e('0x14'),_0x190737,JSON[_0xee4e('0xf')](_0x1d2aa3));_0xb05edf(_0x1d2aa3);})[_0xee4e('0x13')](function(_0x5e0536){logger['error'](_0xee4e('0x14'),_0x5e0536[_0xee4e('0x11')],_0x190737);_0x48be3c(_0x50f453[_0xee4e('0x10')](0x1f4,_0x5e0536['message']));});});}; \ No newline at end of file +var _0xce72=['attributes','limit','include','map','model','GetMailServerIn','catch','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','MailServerIn','raw','options'];(function(_0x2f97eb,_0x31e4cb){var _0x82abdb=function(_0x52f7a1){while(--_0x52f7a1){_0x2f97eb['push'](_0x2f97eb['shift']());}};_0x82abdb(++_0x31e4cb);}(_0xce72,0x115));var _0x2ce7=function(_0x3ed4f7,_0x521aa8){_0x3ed4f7=_0x3ed4f7-0x0;var _0x31cc7a=_0xce72[_0x3ed4f7];return _0x31cc7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2ce7('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ce7('0x1'))['db'];var utils=require(_0x2ce7('0x2'));var logger=require('../../config/logger')(_0x2ce7('0x3'));var config=require('../../config/environment');var jayson=require(_0x2ce7('0x4'));var client=jayson[_0x2ce7('0x5')][_0x2ce7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x187e10,_0xbbda4a,_0x410fe3){return new BPromise(function(_0x4f9e8e,_0x3369df){return client[_0x2ce7('0x7')](_0x187e10,_0x410fe3)[_0x2ce7('0x8')](function(_0x2d41ba){logger[_0x2ce7('0x9')](_0x2ce7('0xa'),_0xbbda4a,_0x2ce7('0xb'));logger[_0x2ce7('0xc')](_0x2ce7('0xd'),_0xbbda4a,_0x2ce7('0xb'),JSON[_0x2ce7('0xe')](_0x2d41ba));if(_0x2d41ba[_0x2ce7('0xf')]){if(_0x2d41ba['error']['code']===0x1f4){logger[_0x2ce7('0xf')]('MailServerIn,\x20%s,\x20%s',_0xbbda4a,_0x2d41ba[_0x2ce7('0xf')][_0x2ce7('0x10')]);return _0x3369df(_0x2d41ba[_0x2ce7('0xf')][_0x2ce7('0x10')]);}logger[_0x2ce7('0xf')](_0x2ce7('0xa'),_0xbbda4a,_0x2d41ba[_0x2ce7('0xf')]['message']);return _0x4f9e8e(_0x2d41ba['error'][_0x2ce7('0x10')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0xbbda4a,_0x2ce7('0xb'));_0x4f9e8e(_0x2d41ba['result'][_0x2ce7('0x10')]);}})['catch'](function(_0x431340){logger[_0x2ce7('0xf')](_0x2ce7('0xa'),_0xbbda4a,_0x431340);_0x3369df(_0x431340);});});}exports['GetMailServerIn']=function(_0x31d80c){var _0x57c83e=this;return new Promise(function(_0x46fd5f,_0x118758){return db[_0x2ce7('0x11')]['findAll']({'raw':_0x31d80c['options']?_0x31d80c['options'][_0x2ce7('0x12')]===undefined?!![]:![]:!![],'where':_0x31d80c[_0x2ce7('0x13')]?_0x31d80c[_0x2ce7('0x13')]['where']||null:null,'attributes':_0x31d80c['options']?_0x31d80c[_0x2ce7('0x13')][_0x2ce7('0x14')]||null:null,'limit':_0x31d80c[_0x2ce7('0x13')]?_0x31d80c[_0x2ce7('0x13')][_0x2ce7('0x15')]||null:null,'include':_0x31d80c[_0x2ce7('0x13')]?_0x31d80c[_0x2ce7('0x13')][_0x2ce7('0x16')]?_[_0x2ce7('0x17')](_0x31d80c[_0x2ce7('0x13')][_0x2ce7('0x16')],function(_0x4ef3a4){return{'model':db[_0x4ef3a4[_0x2ce7('0x18')]],'as':_0x4ef3a4['as'],'attributes':_0x4ef3a4[_0x2ce7('0x14')],'include':_0x4ef3a4[_0x2ce7('0x16')]?_[_0x2ce7('0x17')](_0x4ef3a4[_0x2ce7('0x16')],function(_0x2f12a6){return{'model':db[_0x2f12a6['model']],'as':_0x2f12a6['as'],'attributes':_0x2f12a6[_0x2ce7('0x14')],'include':_0x2f12a6[_0x2ce7('0x16')]?_[_0x2ce7('0x17')](_0x2f12a6['include'],function(_0x235656){return{'model':db[_0x235656[_0x2ce7('0x18')]],'as':_0x235656['as'],'attributes':_0x235656[_0x2ce7('0x14')]};}):[]};}):[]};}):[]:[]})[_0x2ce7('0x8')](function(_0x270b86){logger['info'](_0x2ce7('0x19'),_0x31d80c);logger[_0x2ce7('0xc')](_0x2ce7('0x19'),_0x31d80c,JSON[_0x2ce7('0xe')](_0x270b86));_0x46fd5f(_0x270b86);})[_0x2ce7('0x1a')](function(_0x412e10){logger[_0x2ce7('0xf')](_0x2ce7('0x19'),_0x412e10[_0x2ce7('0x10')],_0x31d80c);_0x118758(_0x57c83e[_0x2ce7('0xf')](0x1f4,_0x412e10[_0x2ce7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 91dbc96..fa3ae30 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 _0xb643=['post','isAuthenticated','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','show'];(function(_0x5be4a0,_0x291a73){var _0x247978=function(_0x5f1fe7){while(--_0x5f1fe7){_0x5be4a0['push'](_0x5be4a0['shift']());}};_0x247978(++_0x291a73);}(_0xb643,0xc4));var _0x3b64=function(_0x442863,_0x2d9dc6){_0x442863=_0x442863-0x0;var _0x38797c=_0xb643[_0x442863];return _0x38797c;};'use strict';var multer=require(_0x3b64('0x0'));var util=require(_0x3b64('0x1'));var path=require(_0x3b64('0x2'));var timeout=require(_0x3b64('0x3'));var express=require(_0x3b64('0x4'));var router=express['Router']();var auth=require(_0x3b64('0x5'));var interaction=require(_0x3b64('0x6'));var config=require(_0x3b64('0x7'));var controller=require(_0x3b64('0x8'));router[_0x3b64('0x9')]('/',auth['isAuthenticated'](),controller[_0x3b64('0xa')]);router[_0x3b64('0x9')](_0x3b64('0xb'),auth['isAuthenticated'](),controller[_0x3b64('0xc')]);router[_0x3b64('0xd')]('/',auth[_0x3b64('0xe')](),controller[_0x3b64('0xf')]);router['put'](_0x3b64('0xb'),auth['isAuthenticated'](),controller[_0x3b64('0x10')]);router['delete'](_0x3b64('0xb'),auth[_0x3b64('0xe')](),controller[_0x3b64('0x11')]);module[_0x3b64('0x12')]=router; \ No newline at end of file +var _0x1c71=['multer','util','path','express','Router','../../components/auth/service','./mailServerOut.controller','isAuthenticated','index','get','show','post','create','update','delete','exports'];(function(_0x27887b,_0x23a9d8){var _0x20d858=function(_0x4daf87){while(--_0x4daf87){_0x27887b['push'](_0x27887b['shift']());}};_0x20d858(++_0x23a9d8);}(_0x1c71,0x1b0));var _0x11c7=function(_0x216fd1,_0x34d5dc){_0x216fd1=_0x216fd1-0x0;var _0x1829c8=_0x1c71[_0x216fd1];return _0x1829c8;};'use strict';var multer=require(_0x11c7('0x0'));var util=require(_0x11c7('0x1'));var path=require(_0x11c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x11c7('0x3'));var router=express[_0x11c7('0x4')]();var auth=require(_0x11c7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x11c7('0x6'));router['get']('/',auth[_0x11c7('0x7')](),controller[_0x11c7('0x8')]);router[_0x11c7('0x9')]('/:id',auth[_0x11c7('0x7')](),controller[_0x11c7('0xa')]);router[_0x11c7('0xb')]('/',auth['isAuthenticated'](),controller[_0x11c7('0xc')]);router['put']('/:id',auth[_0x11c7('0x7')](),controller[_0x11c7('0xd')]);router[_0x11c7('0xe')]('/:id',auth[_0x11c7('0x7')](),controller['destroy']);module[_0x11c7('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index dd18920..3eddd50 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 _0xab00=['INTEGER','sequelize','exports','STRING'];(function(_0x193175,_0x21e038){var _0x11d51d=function(_0x1bad64){while(--_0x1bad64){_0x193175['push'](_0x193175['shift']());}};_0x11d51d(++_0x21e038);}(_0xab00,0x1b9));var _0x0ab0=function(_0x3a17cd,_0x5202a8){_0x3a17cd=_0x3a17cd-0x0;var _0x51a6ec=_0xab00[_0x3a17cd];return _0x51a6ec;};'use strict';var Sequelize=require(_0x0ab0('0x0'));module[_0x0ab0('0x1')]={'description':{'type':Sequelize[_0x0ab0('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x0ab0('0x2')]},'pass':{'type':Sequelize[_0x0ab0('0x2')]},'port':{'type':Sequelize[_0x0ab0('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x0ab0('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xea4e=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0xaecc27,_0x3b15ab){var _0x2203ec=function(_0x47efdf){while(--_0x47efdf){_0xaecc27['push'](_0xaecc27['shift']());}};_0x2203ec(++_0x3b15ab);}(_0xea4e,0x10c));var _0xeea4=function(_0x4383e9,_0xa4b307){_0x4383e9=_0x4383e9-0x0;var _0x355405=_0xea4e[_0x4383e9];return _0x355405;};'use strict';var Sequelize=require(_0xeea4('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xeea4('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xeea4('0x2')]},'secure':{'type':Sequelize[_0xeea4('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xeea4('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 8d5742c..caf8e3d 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 _0x98d2=['name','send','MailServerOut','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x59001a,_0x3a3a59){var _0x4a2aa0=function(_0x124eb3){while(--_0x124eb3){_0x59001a['push'](_0x59001a['shift']());}};_0x4a2aa0(++_0x3a3a59);}(_0x98d2,0xb3));var _0x298d=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x98d2[_0x1de43c];return _0x296d3e;};'use strict';var pdf=require(_0x298d('0x0'));var emlformat=require(_0x298d('0x1'));var rimraf=require(_0x298d('0x2'));var zipdir=require(_0x298d('0x3'));var jsonpatch=require(_0x298d('0x4'));var rp=require(_0x298d('0x5'));var moment=require(_0x298d('0x6'));var BPromise=require(_0x298d('0x7'));var Mustache=require(_0x298d('0x8'));var util=require('util');var path=require(_0x298d('0x9'));var sox=require(_0x298d('0xa'));var csv=require('to-csv');var ejs=require(_0x298d('0xb'));var fs=require('fs');var _=require(_0x298d('0xc'));var squel=require(_0x298d('0xd'));var crypto=require('crypto');var jsforce=require(_0x298d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x298d('0xf'));var Papa=require('papaparse');var Redis=require(_0x298d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x298d('0x11'));var as=require(_0x298d('0x12'));var hardwareService=require(_0x298d('0x13'));var logger=require(_0x298d('0x14'))(_0x298d('0x15'));var utils=require(_0x298d('0x16'));var config=require(_0x298d('0x17'));var db=require(_0x298d('0x18'))['db'];function respondWithStatusCode(_0xdda1cb,_0x5326ff){_0x5326ff=_0x5326ff||0xcc;return function(_0xcde3b1){if(_0xcde3b1){return _0xdda1cb['sendStatus'](_0x5326ff);}return _0xdda1cb['status'](_0x5326ff)[_0x298d('0x19')]();};}function respondWithResult(_0x3dea4a,_0x30c0e3){_0x30c0e3=_0x30c0e3||0xc8;return function(_0x2e06c1){if(_0x2e06c1){return _0x3dea4a[_0x298d('0x1a')](_0x30c0e3)[_0x298d('0x1b')](_0x2e06c1);}};}function respondWithFilteredResult(_0x4f634a,_0x4a641b){return function(_0x1c6b1e){if(_0x1c6b1e){var _0x5ba082=_0x1c6b1e['count'],_0x55f5a3=_0x4a641b[_0x298d('0x1c')],_0x424974=_0x4a641b[_0x298d('0x1c')]+_0x4a641b[_0x298d('0x1d')],_0x180366;if(_0x424974>=_0x5ba082){_0x424974=_0x5ba082;_0x180366=0xc8;}else{_0x180366=0xce;}_0x4f634a['status'](_0x180366);return _0x4f634a[_0x298d('0x1e')](_0x298d('0x1f'),_0x55f5a3+'-'+_0x424974+'/'+_0x5ba082)['json'](_0x1c6b1e);}return null;};}function patchUpdates(_0x19f153){return function(_0x5a9710){try{jsonpatch['apply'](_0x5a9710,_0x19f153,!![]);}catch(_0x37b119){return BPromise[_0x298d('0x20')](_0x37b119);}return _0x5a9710[_0x298d('0x21')]();};}function saveUpdates(_0x49bfc6,_0x59a5c2){return function(_0x39a942){if(_0x39a942){return _0x39a942[_0x298d('0x22')](_0x49bfc6)[_0x298d('0x23')](function(_0x2ece29){return _0x2ece29;});}return null;};}function removeEntity(_0x48f58a,_0xa51293){return function(_0x4cc025){if(_0x4cc025){return _0x4cc025[_0x298d('0x24')]()[_0x298d('0x23')](function(){_0x48f58a[_0x298d('0x1a')](0xcc)[_0x298d('0x19')]();});}};}function handleEntityNotFound(_0x4f2323,_0x10e07a){return function(_0x49599e){if(!_0x49599e){_0x4f2323[_0x298d('0x25')](0x194);}return _0x49599e;};}function handleError(_0x37ae33,_0x439911){_0x439911=_0x439911||0x1f4;return function(_0x4e37c0){logger[_0x298d('0x26')](_0x4e37c0[_0x298d('0x27')]);if(_0x4e37c0[_0x298d('0x28')]){delete _0x4e37c0[_0x298d('0x28')];}_0x37ae33[_0x298d('0x1a')](_0x439911)[_0x298d('0x29')](_0x4e37c0);};}exports['index']=function(_0x5e2da8,_0x5d2d26){var _0x1e2a52={},_0x55ec55={},_0x5370d8={'count':0x0,'rows':[]};var _0xb77f28=_['map'](db[_0x298d('0x2a')][_0x298d('0x2b')],function(_0x1b015e){return{'name':_0x1b015e[_0x298d('0x2c')],'type':_0x1b015e['type']['key']};});_0x55ec55[_0x298d('0x2d')]=_[_0x298d('0x2e')](_0xb77f28,_0x298d('0x28'));_0x55ec55[_0x298d('0x2f')]=_[_0x298d('0x30')](_0x5e2da8[_0x298d('0x2f')]);_0x55ec55[_0x298d('0x31')]=_[_0x298d('0x32')](_0x55ec55['model'],_0x55ec55[_0x298d('0x2f')]);_0x1e2a52[_0x298d('0x33')]=_['intersection'](_0x55ec55[_0x298d('0x2d')],qs[_0x298d('0x34')](_0x5e2da8['query']['fields']));_0x1e2a52['attributes']=_0x1e2a52['attributes'][_0x298d('0x35')]?_0x1e2a52['attributes']:_0x55ec55[_0x298d('0x2d')];if(!_0x5e2da8[_0x298d('0x2f')][_0x298d('0x36')](_0x298d('0x37'))){_0x1e2a52[_0x298d('0x1d')]=qs[_0x298d('0x1d')](_0x5e2da8[_0x298d('0x2f')][_0x298d('0x1d')]);_0x1e2a52[_0x298d('0x1c')]=qs[_0x298d('0x1c')](_0x5e2da8[_0x298d('0x2f')][_0x298d('0x1c')]);}_0x1e2a52['order']=qs[_0x298d('0x38')](_0x5e2da8['query'][_0x298d('0x38')]);_0x1e2a52[_0x298d('0x39')]=qs[_0x298d('0x31')](_['pick'](_0x5e2da8[_0x298d('0x2f')],_0x55ec55[_0x298d('0x31')]),_0xb77f28);if(_0x5e2da8[_0x298d('0x2f')][_0x298d('0x3a')]){_0x1e2a52[_0x298d('0x39')]=_[_0x298d('0x3b')](_0x1e2a52[_0x298d('0x39')],{'$or':_[_0x298d('0x2e')](_0xb77f28,function(_0x32de84){if(_0x32de84[_0x298d('0x3c')]!==_0x298d('0x3d')){var _0x2ca7a5={};_0x2ca7a5[_0x32de84[_0x298d('0x28')]]={'$like':'%'+_0x5e2da8[_0x298d('0x2f')][_0x298d('0x3a')]+'%'};return _0x2ca7a5;}})});}_0x1e2a52=_['merge']({},_0x1e2a52,_0x5e2da8[_0x298d('0x3e')]);var _0xed1c1c={'where':_0x1e2a52[_0x298d('0x39')]};return db[_0x298d('0x2a')][_0x298d('0x3f')](_0xed1c1c)[_0x298d('0x23')](function(_0x2ff8a4){_0x5370d8['count']=_0x2ff8a4;if(_0x5e2da8[_0x298d('0x2f')][_0x298d('0x40')]){_0x1e2a52[_0x298d('0x41')]=[{'all':!![]}];}return db[_0x298d('0x2a')][_0x298d('0x42')](_0x1e2a52);})['then'](function(_0x426b35){_0x5370d8['rows']=_0x426b35;return _0x5370d8;})[_0x298d('0x23')](respondWithFilteredResult(_0x5d2d26,_0x1e2a52))[_0x298d('0x43')](handleError(_0x5d2d26,null));};exports[_0x298d('0x44')]=function(_0x22eefd,_0x175856){var _0x253a42={'raw':!![],'where':{'id':_0x22eefd['params']['id']}},_0x3e99c3={};_0x3e99c3[_0x298d('0x2d')]=_[_0x298d('0x30')](db[_0x298d('0x2a')]['rawAttributes']);_0x3e99c3[_0x298d('0x2f')]=_[_0x298d('0x30')](_0x22eefd[_0x298d('0x2f')]);_0x3e99c3[_0x298d('0x31')]=_['intersection'](_0x3e99c3[_0x298d('0x2d')],_0x3e99c3['query']);_0x253a42['attributes']=_[_0x298d('0x32')](_0x3e99c3['model'],qs['fields'](_0x22eefd[_0x298d('0x2f')][_0x298d('0x34')]));_0x253a42['attributes']=_0x253a42['attributes'][_0x298d('0x35')]?_0x253a42[_0x298d('0x33')]:_0x3e99c3['model'];if(_0x22eefd['query'][_0x298d('0x40')]){_0x253a42[_0x298d('0x41')]=[{'all':!![]}];}_0x253a42=_[_0x298d('0x3b')]({},_0x253a42,_0x22eefd[_0x298d('0x3e')]);return db[_0x298d('0x2a')][_0x298d('0x45')](_0x253a42)['then'](handleEntityNotFound(_0x175856,null))['then'](respondWithResult(_0x175856,null))[_0x298d('0x43')](handleError(_0x175856,null));};exports[_0x298d('0x46')]=function(_0x5bab11,_0x519f13){return db['MailServerOut'][_0x298d('0x46')](_0x5bab11[_0x298d('0x47')],{})[_0x298d('0x23')](respondWithResult(_0x519f13,0xc9))[_0x298d('0x43')](handleError(_0x519f13,null));};exports[_0x298d('0x22')]=function(_0x5b497a,_0x3948dc){if(_0x5b497a[_0x298d('0x47')]['id']){delete _0x5b497a['body']['id'];}return db[_0x298d('0x2a')]['find']({'where':{'id':_0x5b497a[_0x298d('0x48')]['id']}})['then'](handleEntityNotFound(_0x3948dc,null))[_0x298d('0x23')](saveUpdates(_0x5b497a[_0x298d('0x47')],null))[_0x298d('0x23')](respondWithResult(_0x3948dc,null))[_0x298d('0x43')](handleError(_0x3948dc,null));};exports[_0x298d('0x24')]=function(_0x3f395d,_0x2502af){return db[_0x298d('0x2a')][_0x298d('0x45')]({'where':{'id':_0x3f395d['params']['id']}})['then'](handleEntityNotFound(_0x2502af,null))[_0x298d('0x23')](removeEntity(_0x2502af,null))[_0x298d('0x43')](handleError(_0x2502af,null));}; \ No newline at end of file +var _0x6488=['end','status','json','count','offset','limit','set','Content-Range','reject','then','error','name','send','index','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','map','type','filter','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6488,0x106));var _0x8648=function(_0x1501e2,_0x271210){_0x1501e2=_0x1501e2-0x0;var _0xfce8c5=_0x6488[_0x1501e2];return _0xfce8c5;};'use strict';var pdf=require(_0x8648('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8648('0x1'));var zipdir=require(_0x8648('0x2'));var jsonpatch=require(_0x8648('0x3'));var rp=require(_0x8648('0x4'));var moment=require(_0x8648('0x5'));var BPromise=require(_0x8648('0x6'));var Mustache=require(_0x8648('0x7'));var util=require(_0x8648('0x8'));var path=require(_0x8648('0x9'));var sox=require('sox');var csv=require(_0x8648('0xa'));var ejs=require(_0x8648('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8648('0xc'));var crypto=require(_0x8648('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8648('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8648('0xf'));var Papa=require('papaparse');var Redis=require(_0x8648('0x10'));var authService=require(_0x8648('0x11'));var qs=require(_0x8648('0x12'));var as=require(_0x8648('0x13'));var hardwareService=require(_0x8648('0x14'));var logger=require(_0x8648('0x15'))(_0x8648('0x16'));var utils=require(_0x8648('0x17'));var config=require(_0x8648('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a6afa,_0x245bc8){_0x245bc8=_0x245bc8||0xcc;return function(_0x23c547){if(_0x23c547){return _0x5a6afa[_0x8648('0x19')](_0x245bc8);}return _0x5a6afa['status'](_0x245bc8)[_0x8648('0x1a')]();};}function respondWithResult(_0x2944c2,_0x462d07){_0x462d07=_0x462d07||0xc8;return function(_0x209fb4){if(_0x209fb4){return _0x2944c2[_0x8648('0x1b')](_0x462d07)[_0x8648('0x1c')](_0x209fb4);}};}function respondWithFilteredResult(_0x4633aa,_0x9ae55c){return function(_0x7e432c){if(_0x7e432c){var _0x8e0aa4=_0x7e432c[_0x8648('0x1d')],_0x152a6a=_0x9ae55c[_0x8648('0x1e')],_0x3c4061=_0x9ae55c[_0x8648('0x1e')]+_0x9ae55c[_0x8648('0x1f')],_0x6cf922;if(_0x3c4061>=_0x8e0aa4){_0x3c4061=_0x8e0aa4;_0x6cf922=0xc8;}else{_0x6cf922=0xce;}_0x4633aa['status'](_0x6cf922);return _0x4633aa[_0x8648('0x20')](_0x8648('0x21'),_0x152a6a+'-'+_0x3c4061+'/'+_0x8e0aa4)[_0x8648('0x1c')](_0x7e432c);}return null;};}function patchUpdates(_0x49af2c){return function(_0x486bb6){try{jsonpatch['apply'](_0x486bb6,_0x49af2c,!![]);}catch(_0x1d81d5){return BPromise[_0x8648('0x22')](_0x1d81d5);}return _0x486bb6['save']();};}function saveUpdates(_0x11f7cd,_0x2a40af){return function(_0x259e69){if(_0x259e69){return _0x259e69['update'](_0x11f7cd)[_0x8648('0x23')](function(_0x5b9a27){return _0x5b9a27;});}return null;};}function removeEntity(_0xd047c6,_0x54709a){return function(_0x464248){if(_0x464248){return _0x464248['destroy']()[_0x8648('0x23')](function(){_0xd047c6['status'](0xcc)[_0x8648('0x1a')]();});}};}function handleEntityNotFound(_0x5b5ee6,_0x35b80b){return function(_0x2da08e){if(!_0x2da08e){_0x5b5ee6[_0x8648('0x19')](0x194);}return _0x2da08e;};}function handleError(_0x114fab,_0x1c0489){_0x1c0489=_0x1c0489||0x1f4;return function(_0x15326d){logger[_0x8648('0x24')](_0x15326d['stack']);if(_0x15326d['name']){delete _0x15326d[_0x8648('0x25')];}_0x114fab[_0x8648('0x1b')](_0x1c0489)[_0x8648('0x26')](_0x15326d);};}exports[_0x8648('0x27')]=function(_0x372106,_0x4bfc33){var _0x4b1c1f={},_0x131724={},_0x5e56c5={'count':0x0,'rows':[]};var _0x17b8fe=_['map'](db[_0x8648('0x28')][_0x8648('0x29')],function(_0x4d3eff){return{'name':_0x4d3eff[_0x8648('0x2a')],'type':_0x4d3eff['type'][_0x8648('0x2b')]};});_0x131724[_0x8648('0x2c')]=_['map'](_0x17b8fe,'name');_0x131724[_0x8648('0x2d')]=_[_0x8648('0x2e')](_0x372106[_0x8648('0x2d')]);_0x131724[_0x8648('0x2f')]=_['intersection'](_0x131724[_0x8648('0x2c')],_0x131724[_0x8648('0x2d')]);_0x4b1c1f[_0x8648('0x30')]=_['intersection'](_0x131724[_0x8648('0x2c')],qs[_0x8648('0x31')](_0x372106[_0x8648('0x2d')][_0x8648('0x31')]));_0x4b1c1f[_0x8648('0x30')]=_0x4b1c1f[_0x8648('0x30')]['length']?_0x4b1c1f['attributes']:_0x131724[_0x8648('0x2c')];if(!_0x372106[_0x8648('0x2d')][_0x8648('0x32')]('nolimit')){_0x4b1c1f[_0x8648('0x1f')]=qs[_0x8648('0x1f')](_0x372106[_0x8648('0x2d')][_0x8648('0x1f')]);_0x4b1c1f['offset']=qs[_0x8648('0x1e')](_0x372106[_0x8648('0x2d')][_0x8648('0x1e')]);}_0x4b1c1f[_0x8648('0x33')]=qs[_0x8648('0x34')](_0x372106[_0x8648('0x2d')][_0x8648('0x34')]);_0x4b1c1f[_0x8648('0x35')]=qs[_0x8648('0x2f')](_[_0x8648('0x36')](_0x372106[_0x8648('0x2d')],_0x131724['filters']),_0x17b8fe);if(_0x372106[_0x8648('0x2d')]['filter']){_0x4b1c1f[_0x8648('0x35')]=_[_0x8648('0x37')](_0x4b1c1f[_0x8648('0x35')],{'$or':_[_0x8648('0x38')](_0x17b8fe,function(_0x2bfa30){if(_0x2bfa30[_0x8648('0x39')]!=='VIRTUAL'){var _0x2fc4d9={};_0x2fc4d9[_0x2bfa30[_0x8648('0x25')]]={'$like':'%'+_0x372106[_0x8648('0x2d')][_0x8648('0x3a')]+'%'};return _0x2fc4d9;}})});}_0x4b1c1f=_[_0x8648('0x37')]({},_0x4b1c1f,_0x372106[_0x8648('0x3b')]);var _0x170903={'where':_0x4b1c1f[_0x8648('0x35')]};return db['MailServerOut'][_0x8648('0x1d')](_0x170903)[_0x8648('0x23')](function(_0x138365){_0x5e56c5[_0x8648('0x1d')]=_0x138365;if(_0x372106[_0x8648('0x2d')][_0x8648('0x3c')]){_0x4b1c1f[_0x8648('0x3d')]=[{'all':!![]}];}return db[_0x8648('0x28')][_0x8648('0x3e')](_0x4b1c1f);})[_0x8648('0x23')](function(_0x4db3ae){_0x5e56c5[_0x8648('0x3f')]=_0x4db3ae;return _0x5e56c5;})[_0x8648('0x23')](respondWithFilteredResult(_0x4bfc33,_0x4b1c1f))[_0x8648('0x40')](handleError(_0x4bfc33,null));};exports[_0x8648('0x41')]=function(_0xc5b4dd,_0x156182){var _0x592554={'raw':!![],'where':{'id':_0xc5b4dd['params']['id']}},_0x5377ae={};_0x5377ae[_0x8648('0x2c')]=_['keys'](db[_0x8648('0x28')][_0x8648('0x29')]);_0x5377ae[_0x8648('0x2d')]=_[_0x8648('0x2e')](_0xc5b4dd[_0x8648('0x2d')]);_0x5377ae['filters']=_['intersection'](_0x5377ae[_0x8648('0x2c')],_0x5377ae[_0x8648('0x2d')]);_0x592554['attributes']=_[_0x8648('0x42')](_0x5377ae[_0x8648('0x2c')],qs[_0x8648('0x31')](_0xc5b4dd[_0x8648('0x2d')]['fields']));_0x592554[_0x8648('0x30')]=_0x592554[_0x8648('0x30')][_0x8648('0x43')]?_0x592554[_0x8648('0x30')]:_0x5377ae[_0x8648('0x2c')];if(_0xc5b4dd['query'][_0x8648('0x3c')]){_0x592554[_0x8648('0x3d')]=[{'all':!![]}];}_0x592554=_[_0x8648('0x37')]({},_0x592554,_0xc5b4dd[_0x8648('0x3b')]);return db[_0x8648('0x28')][_0x8648('0x44')](_0x592554)['then'](handleEntityNotFound(_0x156182,null))[_0x8648('0x23')](respondWithResult(_0x156182,null))[_0x8648('0x40')](handleError(_0x156182,null));};exports[_0x8648('0x45')]=function(_0x3886e2,_0x209cdb){return db[_0x8648('0x28')][_0x8648('0x45')](_0x3886e2[_0x8648('0x46')],{})[_0x8648('0x23')](respondWithResult(_0x209cdb,0xc9))[_0x8648('0x40')](handleError(_0x209cdb,null));};exports['update']=function(_0x2da0f7,_0x517c62){if(_0x2da0f7['body']['id']){delete _0x2da0f7[_0x8648('0x46')]['id'];}return db[_0x8648('0x28')][_0x8648('0x44')]({'where':{'id':_0x2da0f7[_0x8648('0x47')]['id']}})[_0x8648('0x23')](handleEntityNotFound(_0x517c62,null))[_0x8648('0x23')](saveUpdates(_0x2da0f7[_0x8648('0x46')],null))[_0x8648('0x23')](respondWithResult(_0x517c62,null))['catch'](handleError(_0x517c62,null));};exports['destroy']=function(_0x297b29,_0x4cbe1a){return db['MailServerOut']['find']({'where':{'id':_0x297b29[_0x8648('0x47')]['id']}})[_0x8648('0x23')](handleEntityNotFound(_0x4cbe1a,null))[_0x8648('0x23')](removeEntity(_0x4cbe1a,null))[_0x8648('0x40')](handleError(_0x4cbe1a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 0f6aaea..c8b5f2f 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 _0x4824=['../../config/logger','api','request-promise','path','../../config/environment','./mailServerOut.attributes','define','mail_servers_out','util'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x4824,0xe9));var _0x4482=function(_0x4ecb4f,_0x2b5f7e){_0x4ecb4f=_0x4ecb4f-0x0;var _0x1305b6=_0x4824[_0x4ecb4f];return _0x1305b6;};'use strict';var _=require('lodash');var util=require(_0x4482('0x0'));var logger=require(_0x4482('0x1'))(_0x4482('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4482('0x3'));var fs=require('fs');var path=require(_0x4482('0x4'));var rimraf=require('rimraf');var config=require(_0x4482('0x5'));var attributes=require(_0x4482('0x6'));module['exports']=function(_0x5389da,_0x20bb5c){return _0x5389da[_0x4482('0x7')]('MailServerOut',attributes,{'tableName':_0x4482('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702b=['moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','util','../../config/logger'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0x702b,0x13d));var _0xb702=function(_0x41c8ac,_0x1ef222){_0x41c8ac=_0x41c8ac-0x0;var _0x1038d1=_0x702b[_0x41c8ac];return _0x1038d1;};'use strict';var _=require('lodash');var util=require(_0xb702('0x0'));var logger=require(_0xb702('0x1'))('api');var moment=require(_0xb702('0x2'));var BPromise=require(_0xb702('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb702('0x4'));var rimraf=require(_0xb702('0x5'));var config=require('../../config/environment');var attributes=require(_0xb702('0x6'));module[_0xb702('0x7')]=function(_0x45ffae,_0x473381){return _0x45ffae[_0xb702('0x8')](_0xb702('0x9'),attributes,{'tableName':_0xb702('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index a365465..4f64c09 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 _0x51e2=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x51e2,0x175));var _0x251e=function(_0x361d69,_0x18dbc3){_0x361d69=_0x361d69-0x0;var _0x57d702=_0x51e2[_0x361d69];return _0x57d702;};'use strict';var _=require(_0x251e('0x0'));var util=require(_0x251e('0x1'));var moment=require(_0x251e('0x2'));var BPromise=require(_0x251e('0x3'));var rs=require(_0x251e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x251e('0x5'));var logger=require('../../config/logger')(_0x251e('0x6'));var config=require(_0x251e('0x7'));var jayson=require(_0x251e('0x8'));var client=jayson[_0x251e('0x9')][_0x251e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5236fe,_0x3268cc,_0x49dfbe){return new BPromise(function(_0x3b8987,_0x14b91f){return client[_0x251e('0xb')](_0x5236fe,_0x49dfbe)[_0x251e('0xc')](function(_0x1dab47){logger[_0x251e('0xd')](_0x251e('0xe'),_0x3268cc,_0x251e('0xf'));logger[_0x251e('0x10')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3268cc,_0x251e('0xf'),JSON[_0x251e('0x11')](_0x1dab47));if(_0x1dab47[_0x251e('0x12')]){if(_0x1dab47['error']['code']===0x1f4){logger[_0x251e('0x12')](_0x251e('0xe'),_0x3268cc,_0x1dab47['error'][_0x251e('0x13')]);return _0x14b91f(_0x1dab47[_0x251e('0x12')]['message']);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x3268cc,_0x1dab47[_0x251e('0x12')]['message']);return _0x3b8987(_0x1dab47[_0x251e('0x12')][_0x251e('0x13')]);}else{logger[_0x251e('0xd')](_0x251e('0xe'),_0x3268cc,'request\x20sent');_0x3b8987(_0x1dab47['result'][_0x251e('0x13')]);}})[_0x251e('0x14')](function(_0x140498){logger[_0x251e('0x12')](_0x251e('0xe'),_0x3268cc,_0x140498);_0x14b91f(_0x140498);});});} \ No newline at end of file +var _0x96da=['error','MailServerOut,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','code'];(function(_0x3d8a8f,_0x39c60f){var _0x3ff82c=function(_0x2c64c3){while(--_0x2c64c3){_0x3d8a8f['push'](_0x3d8a8f['shift']());}};_0x3ff82c(++_0x39c60f);}(_0x96da,0xb5));var _0xa96d=function(_0x280493,_0x1ffba2){_0x280493=_0x280493-0x0;var _0x55363f=_0x96da[_0x280493];return _0x55363f;};'use strict';var _=require(_0xa96d('0x0'));var util=require(_0xa96d('0x1'));var moment=require(_0xa96d('0x2'));var BPromise=require(_0xa96d('0x3'));var rs=require(_0xa96d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa96d('0x5'))['db'];var utils=require(_0xa96d('0x6'));var logger=require(_0xa96d('0x7'))(_0xa96d('0x8'));var config=require(_0xa96d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa96d('0xa')][_0xa96d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43ec51,_0x534c34,_0xebf126){return new BPromise(function(_0x54b156,_0x25dba6){return client[_0xa96d('0xc')](_0x43ec51,_0xebf126)[_0xa96d('0xd')](function(_0x579452){logger[_0xa96d('0xe')]('MailServerOut,\x20%s,\x20%s',_0x534c34,'request\x20sent');logger[_0xa96d('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x534c34,'request\x20sent',JSON['stringify'](_0x579452));if(_0x579452['error']){if(_0x579452['error'][_0xa96d('0x10')]===0x1f4){logger[_0xa96d('0x11')](_0xa96d('0x12'),_0x534c34,_0x579452[_0xa96d('0x11')][_0xa96d('0x13')]);return _0x25dba6(_0x579452[_0xa96d('0x11')][_0xa96d('0x13')]);}logger[_0xa96d('0x11')]('MailServerOut,\x20%s,\x20%s',_0x534c34,_0x579452[_0xa96d('0x11')][_0xa96d('0x13')]);return _0x54b156(_0x579452['error'][_0xa96d('0x13')]);}else{logger[_0xa96d('0xe')](_0xa96d('0x12'),_0x534c34,_0xa96d('0x14'));_0x54b156(_0x579452[_0xa96d('0x15')][_0xa96d('0x13')]);}})['catch'](function(_0x4b6001){logger[_0xa96d('0x11')]('MailServerOut,\x20%s,\x20%s',_0x534c34,_0x4b6001);_0x25dba6(_0x4b6001);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2718318..c0baaf5 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 _0x475e=['../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','/describe','describe','/:id','isAuthenticated','show','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x33e982,_0x1d15b1){var _0x2d3668=function(_0x3c16d5){while(--_0x3c16d5){_0x33e982['push'](_0x33e982['shift']());}};_0x2d3668(++_0x1d15b1);}(_0x475e,0x17b));var _0xe475=function(_0x5b9153,_0x251fb3){_0x5b9153=_0x5b9153-0x0;var _0x1bde0f=_0x475e[_0x5b9153];return _0x1bde0f;};'use strict';var multer=require(_0xe475('0x0'));var util=require(_0xe475('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe475('0x2'));var router=express[_0xe475('0x3')]();var auth=require(_0xe475('0x4'));var interaction=require(_0xe475('0x5'));var config=require(_0xe475('0x6'));var controller=require(_0xe475('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe475('0x8')](_0xe475('0x9'),auth['isAuthenticated'](),controller[_0xe475('0xa')]);router[_0xe475('0x8')](_0xe475('0xb'),auth[_0xe475('0xc')](),controller[_0xe475('0xd')]);router['post']('/',auth[_0xe475('0xc')](),controller['create']);router['put'](_0xe475('0xb'),auth[_0xe475('0xc')](),controller['update']);router['delete'](_0xe475('0xb'),auth[_0xe475('0xc')](),controller[_0xe475('0xe')]);module[_0xe475('0xf')]=router; \ No newline at end of file +var _0xffac=['destroy','exports','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','show','put','/:id','update','delete'];(function(_0x5e90b2,_0x55399a){var _0x2e38f6=function(_0x23f876){while(--_0x23f876){_0x5e90b2['push'](_0x5e90b2['shift']());}};_0x2e38f6(++_0x55399a);}(_0xffac,0x1d3));var _0xcffa=function(_0x301df2,_0x40548c){_0x301df2=_0x301df2-0x0;var _0x37879a=_0xffac[_0x301df2];return _0x37879a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xcffa('0x0'));var interaction=require(_0xcffa('0x1'));var config=require(_0xcffa('0x2'));var controller=require(_0xcffa('0x3'));router[_0xcffa('0x4')]('/',auth[_0xcffa('0x5')](),controller['index']);router[_0xcffa('0x4')](_0xcffa('0x6'),auth[_0xcffa('0x5')](),controller[_0xcffa('0x7')]);router[_0xcffa('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xcffa('0x8')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xcffa('0x9')](_0xcffa('0xa'),auth['isAuthenticated'](),controller[_0xcffa('0xb')]);router[_0xcffa('0xc')](_0xcffa('0xa'),auth[_0xcffa('0x5')](),controller[_0xcffa('0xd')]);module[_0xcffa('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0745ea6..73e8fc2 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 _0x3e0c=['exports','STRING','sequelize'];(function(_0x5a7c1e,_0x17e6c1){var _0x33af8e=function(_0x5b6c17){while(--_0x5b6c17){_0x5a7c1e['push'](_0x5a7c1e['shift']());}};_0x33af8e(++_0x17e6c1);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x34360e,_0x1009d6){_0x34360e=_0x34360e-0x0;var _0x4c19c7=_0x3e0c[_0x34360e];return _0x4c19c7;};'use strict';var Sequelize=require(_0xc3e0('0x0'));module[_0xc3e0('0x1')]={'name':{'type':Sequelize[_0xc3e0('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc3e0('0x2')]}}; \ No newline at end of file +var _0x7d8a=['STRING','name','sequelize','exports'];(function(_0x389527,_0x15eb37){var _0x3e0f61=function(_0x127270){while(--_0x127270){_0x389527['push'](_0x389527['shift']());}};_0x3e0f61(++_0x15eb37);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7d8a[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xa7d8('0x0'));module[_0xa7d8('0x1')]={'name':{'type':Sequelize[_0xa7d8('0x2')],'unique':_0xa7d8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa7d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3ebb41f..1d7f7b9 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 _0xbca6=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailSubstatus','include','findAll','catch','show','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','save','then','destroy','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xbca6,0xf6));var _0x6bca=function(_0x16faf2,_0x45b50b){_0x16faf2=_0x16faf2-0x0;var _0x472a=_0xbca6[_0x16faf2];return _0x472a;};'use strict';var pdf=require(_0x6bca('0x0'));var emlformat=require(_0x6bca('0x1'));var rimraf=require(_0x6bca('0x2'));var zipdir=require(_0x6bca('0x3'));var jsonpatch=require(_0x6bca('0x4'));var rp=require(_0x6bca('0x5'));var moment=require(_0x6bca('0x6'));var BPromise=require(_0x6bca('0x7'));var Mustache=require(_0x6bca('0x8'));var util=require(_0x6bca('0x9'));var path=require(_0x6bca('0xa'));var sox=require(_0x6bca('0xb'));var csv=require(_0x6bca('0xc'));var ejs=require(_0x6bca('0xd'));var fs=require('fs');var _=require(_0x6bca('0xe'));var squel=require('squel');var crypto=require(_0x6bca('0xf'));var jsforce=require(_0x6bca('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6bca('0xc'));var querystring=require(_0x6bca('0x11'));var Papa=require('papaparse');var Redis=require(_0x6bca('0x12'));var authService=require(_0x6bca('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6bca('0x14'));var hardwareService=require(_0x6bca('0x15'));var logger=require(_0x6bca('0x16'))(_0x6bca('0x17'));var utils=require('../../config/utils');var config=require(_0x6bca('0x18'));var db=require(_0x6bca('0x19'))['db'];function respondWithStatusCode(_0x29cf16,_0x31b13e){_0x31b13e=_0x31b13e||0xcc;return function(_0x3f5c83){if(_0x3f5c83){return _0x29cf16['sendStatus'](_0x31b13e);}return _0x29cf16[_0x6bca('0x1a')](_0x31b13e)[_0x6bca('0x1b')]();};}function respondWithResult(_0x513fe2,_0x1ea531){_0x1ea531=_0x1ea531||0xc8;return function(_0x3460cf){if(_0x3460cf){return _0x513fe2['status'](_0x1ea531)['json'](_0x3460cf);}};}function respondWithFilteredResult(_0x87a85,_0x5ba59e){return function(_0x507e92){if(_0x507e92){var _0x2351d7=_0x507e92[_0x6bca('0x1c')],_0x4f8dc0=_0x5ba59e[_0x6bca('0x1d')],_0x282d3a=_0x5ba59e[_0x6bca('0x1d')]+_0x5ba59e['limit'],_0x554025;if(_0x282d3a>=_0x2351d7){_0x282d3a=_0x2351d7;_0x554025=0xc8;}else{_0x554025=0xce;}_0x87a85[_0x6bca('0x1a')](_0x554025);return _0x87a85[_0x6bca('0x1e')](_0x6bca('0x1f'),_0x4f8dc0+'-'+_0x282d3a+'/'+_0x2351d7)['json'](_0x507e92);}return null;};}function patchUpdates(_0x302f66){return function(_0x5df83d){try{jsonpatch['apply'](_0x5df83d,_0x302f66,!![]);}catch(_0x58362e){return BPromise['reject'](_0x58362e);}return _0x5df83d[_0x6bca('0x20')]();};}function saveUpdates(_0x599473,_0x470d3b){return function(_0x5099cb){if(_0x5099cb){return _0x5099cb['update'](_0x599473)[_0x6bca('0x21')](function(_0x5335b3){return _0x5335b3;});}return null;};}function removeEntity(_0x5a7aad,_0x4d5d5c){return function(_0x4062d1){if(_0x4062d1){return _0x4062d1[_0x6bca('0x22')]()['then'](function(){_0x5a7aad['status'](0xcc)[_0x6bca('0x1b')]();});}};}function handleEntityNotFound(_0xa9fbd1,_0x3f4eea){return function(_0x1134f8){if(!_0x1134f8){_0xa9fbd1['sendStatus'](0x194);}return _0x1134f8;};}function handleError(_0x42c3f6,_0x34f95d){_0x34f95d=_0x34f95d||0x1f4;return function(_0xaf8d02){logger['error'](_0xaf8d02[_0x6bca('0x23')]);if(_0xaf8d02['name']){delete _0xaf8d02[_0x6bca('0x24')];}_0x42c3f6[_0x6bca('0x1a')](_0x34f95d)[_0x6bca('0x25')](_0xaf8d02);};}exports['index']=function(_0x3cea8c,_0x2db392){var _0xba2661={},_0x287ea6={},_0xaf1685={'count':0x0,'rows':[]};var _0x2803c6=_[_0x6bca('0x26')](db['MailSubstatus'][_0x6bca('0x27')],function(_0x328f4f){return{'name':_0x328f4f[_0x6bca('0x28')],'type':_0x328f4f[_0x6bca('0x29')]['key']};});_0x287ea6[_0x6bca('0x2a')]=_[_0x6bca('0x26')](_0x2803c6,_0x6bca('0x24'));_0x287ea6[_0x6bca('0x2b')]=_[_0x6bca('0x2c')](_0x3cea8c[_0x6bca('0x2b')]);_0x287ea6[_0x6bca('0x2d')]=_[_0x6bca('0x2e')](_0x287ea6[_0x6bca('0x2a')],_0x287ea6['query']);_0xba2661[_0x6bca('0x2f')]=_[_0x6bca('0x2e')](_0x287ea6[_0x6bca('0x2a')],qs[_0x6bca('0x30')](_0x3cea8c[_0x6bca('0x2b')][_0x6bca('0x30')]));_0xba2661[_0x6bca('0x2f')]=_0xba2661[_0x6bca('0x2f')][_0x6bca('0x31')]?_0xba2661['attributes']:_0x287ea6[_0x6bca('0x2a')];if(!_0x3cea8c[_0x6bca('0x2b')][_0x6bca('0x32')](_0x6bca('0x33'))){_0xba2661[_0x6bca('0x34')]=qs[_0x6bca('0x34')](_0x3cea8c[_0x6bca('0x2b')][_0x6bca('0x34')]);_0xba2661['offset']=qs[_0x6bca('0x1d')](_0x3cea8c[_0x6bca('0x2b')][_0x6bca('0x1d')]);}_0xba2661[_0x6bca('0x35')]=qs[_0x6bca('0x36')](_0x3cea8c['query'][_0x6bca('0x36')]);_0xba2661['where']=qs[_0x6bca('0x2d')](_[_0x6bca('0x37')](_0x3cea8c[_0x6bca('0x2b')],_0x287ea6[_0x6bca('0x2d')]),_0x2803c6);if(_0x3cea8c['query'][_0x6bca('0x38')]){_0xba2661[_0x6bca('0x39')]=_[_0x6bca('0x3a')](_0xba2661[_0x6bca('0x39')],{'$or':_['map'](_0x2803c6,function(_0x3e9d1f){if(_0x3e9d1f[_0x6bca('0x29')]!==_0x6bca('0x3b')){var _0x385f26={};_0x385f26[_0x3e9d1f['name']]={'$like':'%'+_0x3cea8c['query'][_0x6bca('0x38')]+'%'};return _0x385f26;}})});}_0xba2661=_[_0x6bca('0x3a')]({},_0xba2661,_0x3cea8c[_0x6bca('0x3c')]);var _0xbdd169={'where':_0xba2661['where']};return db[_0x6bca('0x3d')][_0x6bca('0x1c')](_0xbdd169)[_0x6bca('0x21')](function(_0x50c54c){_0xaf1685[_0x6bca('0x1c')]=_0x50c54c;if(_0x3cea8c[_0x6bca('0x2b')]['includeAll']){_0xba2661[_0x6bca('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x6bca('0x3f')](_0xba2661);})[_0x6bca('0x21')](function(_0x17c99f){_0xaf1685['rows']=_0x17c99f;return _0xaf1685;})[_0x6bca('0x21')](respondWithFilteredResult(_0x2db392,_0xba2661))[_0x6bca('0x40')](handleError(_0x2db392,null));};exports[_0x6bca('0x41')]=function(_0x5ca064,_0x195fbc){var _0x7f91da={'raw':!![],'where':{'id':_0x5ca064['params']['id']}},_0x9e9e05={};_0x9e9e05[_0x6bca('0x2a')]=_['keys'](db[_0x6bca('0x3d')][_0x6bca('0x27')]);_0x9e9e05[_0x6bca('0x2b')]=_[_0x6bca('0x2c')](_0x5ca064[_0x6bca('0x2b')]);_0x9e9e05[_0x6bca('0x2d')]=_[_0x6bca('0x2e')](_0x9e9e05[_0x6bca('0x2a')],_0x9e9e05[_0x6bca('0x2b')]);_0x7f91da[_0x6bca('0x2f')]=_[_0x6bca('0x2e')](_0x9e9e05[_0x6bca('0x2a')],qs[_0x6bca('0x30')](_0x5ca064['query'][_0x6bca('0x30')]));_0x7f91da[_0x6bca('0x2f')]=_0x7f91da[_0x6bca('0x2f')][_0x6bca('0x31')]?_0x7f91da[_0x6bca('0x2f')]:_0x9e9e05[_0x6bca('0x2a')];if(_0x5ca064[_0x6bca('0x2b')]['includeAll']){_0x7f91da[_0x6bca('0x3e')]=[{'all':!![]}];}_0x7f91da=_['merge']({},_0x7f91da,_0x5ca064[_0x6bca('0x3c')]);return db[_0x6bca('0x3d')][_0x6bca('0x42')](_0x7f91da)[_0x6bca('0x21')](handleEntityNotFound(_0x195fbc,null))[_0x6bca('0x21')](respondWithResult(_0x195fbc,null))['catch'](handleError(_0x195fbc,null));};exports['create']=function(_0x12256d,_0x57bd2f){return db[_0x6bca('0x3d')][_0x6bca('0x43')](_0x12256d[_0x6bca('0x44')],{})[_0x6bca('0x21')](respondWithResult(_0x57bd2f,0xc9))[_0x6bca('0x40')](handleError(_0x57bd2f,null));};exports[_0x6bca('0x45')]=function(_0x241290,_0x97ff1e){if(_0x241290[_0x6bca('0x44')]['id']){delete _0x241290['body']['id'];}return db[_0x6bca('0x3d')][_0x6bca('0x42')]({'where':{'id':_0x241290[_0x6bca('0x46')]['id']}})[_0x6bca('0x21')](handleEntityNotFound(_0x97ff1e,null))[_0x6bca('0x21')](saveUpdates(_0x241290['body'],null))[_0x6bca('0x21')](respondWithResult(_0x97ff1e,null))['catch'](handleError(_0x97ff1e,null));};exports[_0x6bca('0x22')]=function(_0x5ea3f7,_0x2dbcec){return db[_0x6bca('0x3d')][_0x6bca('0x42')]({'where':{'id':_0x5ea3f7['params']['id']}})[_0x6bca('0x21')](handleEntityNotFound(_0x2dbcec,null))[_0x6bca('0x21')](removeEntity(_0x2dbcec,null))[_0x6bca('0x40')](handleError(_0x2dbcec,null));};exports[_0x6bca('0x47')]=function(_0x283af9,_0x27ff12){return db['MailSubstatus'][_0x6bca('0x47')]()[_0x6bca('0x21')](respondWithResult(_0x27ff12,null))[_0x6bca('0x40')](handleError(_0x27ff12,null));}; \ No newline at end of file +var _0x5946=['query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','MailSubstatus','findAll','rows','catch','show','keys','rawAttributes','includeAll','find','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','fieldName','type','key','map'];(function(_0x18ad70,_0x5ba075){var _0x1f747=function(_0x43a8e3){while(--_0x43a8e3){_0x18ad70['push'](_0x18ad70['shift']());}};_0x1f747(++_0x5ba075);}(_0x5946,0x157));var _0x6594=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x5946[_0x46aff0];return _0x9d78cf;};'use strict';var pdf=require(_0x6594('0x0'));var emlformat=require(_0x6594('0x1'));var rimraf=require(_0x6594('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6594('0x3'));var rp=require(_0x6594('0x4'));var moment=require('moment');var BPromise=require(_0x6594('0x5'));var Mustache=require(_0x6594('0x6'));var util=require(_0x6594('0x7'));var path=require(_0x6594('0x8'));var sox=require('sox');var csv=require(_0x6594('0x9'));var ejs=require(_0x6594('0xa'));var fs=require('fs');var _=require(_0x6594('0xb'));var squel=require(_0x6594('0xc'));var crypto=require(_0x6594('0xd'));var jsforce=require(_0x6594('0xe'));var deskjs=require(_0x6594('0xf'));var toCsv=require(_0x6594('0x9'));var querystring=require('querystring');var Papa=require(_0x6594('0x10'));var Redis=require(_0x6594('0x11'));var authService=require(_0x6594('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6594('0x13'));var hardwareService=require(_0x6594('0x14'));var logger=require(_0x6594('0x15'))(_0x6594('0x16'));var utils=require(_0x6594('0x17'));var config=require('../../config/environment');var db=require(_0x6594('0x18'))['db'];function respondWithStatusCode(_0x5e67f9,_0x3a6c42){_0x3a6c42=_0x3a6c42||0xcc;return function(_0x1691d8){if(_0x1691d8){return _0x5e67f9[_0x6594('0x19')](_0x3a6c42);}return _0x5e67f9[_0x6594('0x1a')](_0x3a6c42)['end']();};}function respondWithResult(_0x5962e1,_0x35de9f){_0x35de9f=_0x35de9f||0xc8;return function(_0x5b6160){if(_0x5b6160){return _0x5962e1['status'](_0x35de9f)[_0x6594('0x1b')](_0x5b6160);}};}function respondWithFilteredResult(_0x2f85db,_0x29258e){return function(_0x286522){if(_0x286522){var _0x5eeeb5=_0x286522['count'],_0x152295=_0x29258e['offset'],_0x2c2c96=_0x29258e[_0x6594('0x1c')]+_0x29258e[_0x6594('0x1d')],_0x5d5ac5;if(_0x2c2c96>=_0x5eeeb5){_0x2c2c96=_0x5eeeb5;_0x5d5ac5=0xc8;}else{_0x5d5ac5=0xce;}_0x2f85db['status'](_0x5d5ac5);return _0x2f85db[_0x6594('0x1e')](_0x6594('0x1f'),_0x152295+'-'+_0x2c2c96+'/'+_0x5eeeb5)[_0x6594('0x1b')](_0x286522);}return null;};}function patchUpdates(_0xaea2d){return function(_0x107e24){try{jsonpatch[_0x6594('0x20')](_0x107e24,_0xaea2d,!![]);}catch(_0x4dc9a6){return BPromise['reject'](_0x4dc9a6);}return _0x107e24[_0x6594('0x21')]();};}function saveUpdates(_0x252792,_0x1c585b){return function(_0x29c408){if(_0x29c408){return _0x29c408[_0x6594('0x22')](_0x252792)['then'](function(_0x3c599e){return _0x3c599e;});}return null;};}function removeEntity(_0xcda7ce,_0x7ff219){return function(_0x5f05ba){if(_0x5f05ba){return _0x5f05ba[_0x6594('0x23')]()[_0x6594('0x24')](function(){_0xcda7ce[_0x6594('0x1a')](0xcc)[_0x6594('0x25')]();});}};}function handleEntityNotFound(_0x3c67ad,_0x2d5192){return function(_0x5cc1f7){if(!_0x5cc1f7){_0x3c67ad[_0x6594('0x19')](0x194);}return _0x5cc1f7;};}function handleError(_0x47c1fb,_0x3e3d4){_0x3e3d4=_0x3e3d4||0x1f4;return function(_0x9b4fda){logger[_0x6594('0x26')](_0x9b4fda[_0x6594('0x27')]);if(_0x9b4fda[_0x6594('0x28')]){delete _0x9b4fda[_0x6594('0x28')];}_0x47c1fb[_0x6594('0x1a')](_0x3e3d4)[_0x6594('0x29')](_0x9b4fda);};}exports[_0x6594('0x2a')]=function(_0x2bb521,_0x3c8baf){var _0x3e68ae={},_0x351921={},_0x56b017={'count':0x0,'rows':[]};var _0x552f86=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x41f0f9){return{'name':_0x41f0f9[_0x6594('0x2b')],'type':_0x41f0f9[_0x6594('0x2c')][_0x6594('0x2d')]};});_0x351921['model']=_[_0x6594('0x2e')](_0x552f86,'name');_0x351921[_0x6594('0x2f')]=_['keys'](_0x2bb521[_0x6594('0x2f')]);_0x351921[_0x6594('0x30')]=_['intersection'](_0x351921['model'],_0x351921[_0x6594('0x2f')]);_0x3e68ae[_0x6594('0x31')]=_[_0x6594('0x32')](_0x351921[_0x6594('0x33')],qs[_0x6594('0x34')](_0x2bb521[_0x6594('0x2f')][_0x6594('0x34')]));_0x3e68ae[_0x6594('0x31')]=_0x3e68ae['attributes'][_0x6594('0x35')]?_0x3e68ae[_0x6594('0x31')]:_0x351921[_0x6594('0x33')];if(!_0x2bb521[_0x6594('0x2f')][_0x6594('0x36')](_0x6594('0x37'))){_0x3e68ae[_0x6594('0x1d')]=qs[_0x6594('0x1d')](_0x2bb521[_0x6594('0x2f')]['limit']);_0x3e68ae['offset']=qs['offset'](_0x2bb521[_0x6594('0x2f')][_0x6594('0x1c')]);}_0x3e68ae[_0x6594('0x38')]=qs[_0x6594('0x39')](_0x2bb521[_0x6594('0x2f')][_0x6594('0x39')]);_0x3e68ae[_0x6594('0x3a')]=qs['filters'](_[_0x6594('0x3b')](_0x2bb521[_0x6594('0x2f')],_0x351921[_0x6594('0x30')]),_0x552f86);if(_0x2bb521[_0x6594('0x2f')][_0x6594('0x3c')]){_0x3e68ae[_0x6594('0x3a')]=_[_0x6594('0x3d')](_0x3e68ae['where'],{'$or':_[_0x6594('0x2e')](_0x552f86,function(_0x441384){if(_0x441384[_0x6594('0x2c')]!==_0x6594('0x3e')){var _0x427694={};_0x427694[_0x441384[_0x6594('0x28')]]={'$like':'%'+_0x2bb521['query'][_0x6594('0x3c')]+'%'};return _0x427694;}})});}_0x3e68ae=_[_0x6594('0x3d')]({},_0x3e68ae,_0x2bb521[_0x6594('0x3f')]);var _0x175394={'where':_0x3e68ae['where']};return db['MailSubstatus'][_0x6594('0x40')](_0x175394)['then'](function(_0x3bf05b){_0x56b017['count']=_0x3bf05b;if(_0x2bb521[_0x6594('0x2f')]['includeAll']){_0x3e68ae[_0x6594('0x41')]=[{'all':!![]}];}return db[_0x6594('0x42')][_0x6594('0x43')](_0x3e68ae);})[_0x6594('0x24')](function(_0x529817){_0x56b017[_0x6594('0x44')]=_0x529817;return _0x56b017;})[_0x6594('0x24')](respondWithFilteredResult(_0x3c8baf,_0x3e68ae))[_0x6594('0x45')](handleError(_0x3c8baf,null));};exports[_0x6594('0x46')]=function(_0x3806f5,_0x545900){var _0x4c1b37={'raw':!![],'where':{'id':_0x3806f5['params']['id']}},_0x3a3d56={};_0x3a3d56[_0x6594('0x33')]=_[_0x6594('0x47')](db[_0x6594('0x42')][_0x6594('0x48')]);_0x3a3d56['query']=_[_0x6594('0x47')](_0x3806f5[_0x6594('0x2f')]);_0x3a3d56[_0x6594('0x30')]=_[_0x6594('0x32')](_0x3a3d56[_0x6594('0x33')],_0x3a3d56['query']);_0x4c1b37['attributes']=_[_0x6594('0x32')](_0x3a3d56[_0x6594('0x33')],qs[_0x6594('0x34')](_0x3806f5['query'][_0x6594('0x34')]));_0x4c1b37['attributes']=_0x4c1b37[_0x6594('0x31')][_0x6594('0x35')]?_0x4c1b37['attributes']:_0x3a3d56['model'];if(_0x3806f5[_0x6594('0x2f')][_0x6594('0x49')]){_0x4c1b37[_0x6594('0x41')]=[{'all':!![]}];}_0x4c1b37=_['merge']({},_0x4c1b37,_0x3806f5['options']);return db[_0x6594('0x42')][_0x6594('0x4a')](_0x4c1b37)[_0x6594('0x24')](handleEntityNotFound(_0x545900,null))['then'](respondWithResult(_0x545900,null))[_0x6594('0x45')](handleError(_0x545900,null));};exports['create']=function(_0x4c34c4,_0x115b09){return db[_0x6594('0x42')]['create'](_0x4c34c4[_0x6594('0x4b')],{})[_0x6594('0x24')](respondWithResult(_0x115b09,0xc9))[_0x6594('0x45')](handleError(_0x115b09,null));};exports[_0x6594('0x22')]=function(_0x3d99f7,_0x531225){if(_0x3d99f7[_0x6594('0x4b')]['id']){delete _0x3d99f7[_0x6594('0x4b')]['id'];}return db[_0x6594('0x42')]['find']({'where':{'id':_0x3d99f7[_0x6594('0x4c')]['id']}})['then'](handleEntityNotFound(_0x531225,null))[_0x6594('0x24')](saveUpdates(_0x3d99f7[_0x6594('0x4b')],null))[_0x6594('0x24')](respondWithResult(_0x531225,null))[_0x6594('0x45')](handleError(_0x531225,null));};exports['destroy']=function(_0x5c221c,_0x41f5f9){return db['MailSubstatus']['find']({'where':{'id':_0x5c221c[_0x6594('0x4c')]['id']}})[_0x6594('0x24')](handleEntityNotFound(_0x41f5f9,null))[_0x6594('0x24')](removeEntity(_0x41f5f9,null))[_0x6594('0x45')](handleError(_0x41f5f9,null));};exports[_0x6594('0x4d')]=function(_0x434971,_0x58a660){return db[_0x6594('0x42')][_0x6594('0x4d')]()[_0x6594('0x24')](respondWithResult(_0x58a660,null))[_0x6594('0x45')](handleError(_0x58a660,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 29ef751..4d71ff9 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 _0x318d=['rimraf','./mailSubstatus.attributes','define','MailSubstatus','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x318d,0x1b2));var _0xd318=function(_0x1db863,_0x8f181d){_0x1db863=_0x1db863-0x0;var _0x18b578=_0x318d[_0x1db863];return _0x18b578;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd318('0x0'))(_0xd318('0x1'));var moment=require(_0xd318('0x2'));var BPromise=require(_0xd318('0x3'));var rp=require(_0xd318('0x4'));var fs=require('fs');var path=require(_0xd318('0x5'));var rimraf=require(_0xd318('0x6'));var config=require('../../config/environment');var attributes=require(_0xd318('0x7'));module['exports']=function(_0x135336,_0x105940){return _0x135336[_0xd318('0x8')](_0xd318('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1732=['request-promise','path','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4e7af4,_0x758572){var _0x2548f1=function(_0xa849c){while(--_0xa849c){_0x4e7af4['push'](_0x4e7af4['shift']());}};_0x2548f1(++_0x758572);}(_0x1732,0xae));var _0x2173=function(_0x1e5599,_0x496aa0){_0x1e5599=_0x1e5599-0x0;var _0x454efa=_0x1732[_0x1e5599];return _0x454efa;};'use strict';var _=require(_0x2173('0x0'));var util=require(_0x2173('0x1'));var logger=require(_0x2173('0x2'))(_0x2173('0x3'));var moment=require(_0x2173('0x4'));var BPromise=require(_0x2173('0x5'));var rp=require(_0x2173('0x6'));var fs=require('fs');var path=require(_0x2173('0x7'));var rimraf=require('rimraf');var config=require(_0x2173('0x8'));var attributes=require(_0x2173('0x9'));module['exports']=function(_0x47f200,_0xe9df91){return _0x47f200[_0x2173('0xa')](_0x2173('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index b28ca81..2546de5 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 _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x19baab,_0x3b2716){var _0x317bf6=function(_0x1a2a92){while(--_0x1a2a92){_0x19baab['push'](_0x19baab['shift']());}};_0x317bf6(++_0x3b2716);}(_0x153f,0x15b));var _0xf153=function(_0x4a8491,_0xa492c1){_0x4a8491=_0x4a8491-0x0;var _0x99f365=_0x153f[_0x4a8491];return _0x99f365;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file +var _0xbec5=['info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','MailSubstatus,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2ae8d6,_0x4d7876){var _0x3d5145=function(_0x3c3638){while(--_0x3c3638){_0x2ae8d6['push'](_0x2ae8d6['shift']());}};_0x3d5145(++_0x4d7876);}(_0xbec5,0xe5));var _0x5bec=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0xbec5[_0x231b2e];return _0x3feb2a;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3b90bef..092417f 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 _0x581f=['index','/:id','show','post','put','delete','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5e8ff8,_0x3e8081){var _0x258962=function(_0x4e5023){while(--_0x4e5023){_0x5e8ff8['push'](_0x5e8ff8['shift']());}};_0x258962(++_0x3e8081);}(_0x581f,0x1b8));var _0xf581=function(_0x55c1a2,_0x44d9ca){_0x55c1a2=_0x55c1a2-0x0;var _0x410310=_0x581f[_0x55c1a2];return _0x410310;};'use strict';var multer=require('multer');var util=require(_0xf581('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf581('0x1'));var router=express[_0xf581('0x2')]();var auth=require(_0xf581('0x3'));var interaction=require(_0xf581('0x4'));var config=require(_0xf581('0x5'));var controller=require('./mailTransferReport.controller');router[_0xf581('0x6')]('/',auth[_0xf581('0x7')](),controller[_0xf581('0x8')]);router[_0xf581('0x6')]('/describe',auth[_0xf581('0x7')](),controller['describe']);router[_0xf581('0x6')](_0xf581('0x9'),auth[_0xf581('0x7')](),controller[_0xf581('0xa')]);router[_0xf581('0xb')]('/',auth[_0xf581('0x7')](),controller['create']);router[_0xf581('0xc')](_0xf581('0x9'),auth[_0xf581('0x7')](),controller['update']);router[_0xf581('0xd')](_0xf581('0x9'),auth[_0xf581('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1b12=['describe','show','post','create','put','/:id','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated'];(function(_0x55d6bb,_0x52cce3){var _0x3c1fad=function(_0x563e8c){while(--_0x563e8c){_0x55d6bb['push'](_0x55d6bb['shift']());}};_0x3c1fad(++_0x52cce3);}(_0x1b12,0xbc));var _0x21b1=function(_0x454b8d,_0xca91a8){_0x454b8d=_0x454b8d-0x0;var _0x388fe5=_0x1b12[_0x454b8d];return _0x388fe5;};'use strict';var multer=require(_0x21b1('0x0'));var util=require('util');var path=require(_0x21b1('0x1'));var timeout=require(_0x21b1('0x2'));var express=require(_0x21b1('0x3'));var router=express[_0x21b1('0x4')]();var auth=require(_0x21b1('0x5'));var interaction=require(_0x21b1('0x6'));var config=require(_0x21b1('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x21b1('0x8')]);router[_0x21b1('0x9')](_0x21b1('0xa'),auth[_0x21b1('0xb')](),controller[_0x21b1('0xc')]);router[_0x21b1('0x9')]('/:id',auth[_0x21b1('0xb')](),controller[_0x21b1('0xd')]);router[_0x21b1('0xe')]('/',auth['isAuthenticated'](),controller[_0x21b1('0xf')]);router[_0x21b1('0x10')](_0x21b1('0x11'),auth['isAuthenticated'](),controller[_0x21b1('0x12')]);router[_0x21b1('0x13')]('/:id',auth[_0x21b1('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index eb5d874..96b6310 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 _0xe3ec=['agent','queue','DATE','NOW','moment','exports','account'];(function(_0x2c1819,_0x1c726a){var _0x13e579=function(_0x58868b){while(--_0x58868b){_0x2c1819['push'](_0x2c1819['shift']());}};_0x13e579(++_0x1c726a);}(_0xe3ec,0x193));var _0xce3e=function(_0xd276d7,_0x3ac1b9){_0xd276d7=_0xd276d7-0x0;var _0x2b236c=_0xe3ec[_0xd276d7];return _0x2b236c;};'use strict';var moment=require(_0xce3e('0x0'));var Sequelize=require('sequelize');module[_0xce3e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xce3e('0x2'),_0xce3e('0x3'),_0xce3e('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xce3e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xce3e('0x6')]}}; \ No newline at end of file +var _0x4310=['agent','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x53fafe,_0x346055){var _0x171ab8=function(_0x42eee6){while(--_0x42eee6){_0x53fafe['push'](_0x53fafe['shift']());}};_0x171ab8(++_0x346055);}(_0x4310,0x183));var _0x0431=function(_0x1a660d,_0x182bba){_0x1a660d=_0x1a660d-0x0;var _0x3c1a19=_0x4310[_0x1a660d];return _0x3c1a19;};'use strict';var moment=require(_0x0431('0x0'));var Sequelize=require(_0x0431('0x1'));module[_0x0431('0x2')]={'uniqueid':{'type':Sequelize[_0x0431('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0431('0x4')]('account',_0x0431('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x0431('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x0431('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5fc2a13..93b1f7d 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 _0x7353=['attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','MailTransferReport','rawAttributes','key','model','query','keys','filters','intersection','fields'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7353,0x1dc));var _0x3735=function(_0x36b7c5,_0x2c3179){_0x36b7c5=_0x36b7c5-0x0;var _0x1aa40e=_0x7353[_0x36b7c5];return _0x1aa40e;};'use strict';var pdf=require(_0x3735('0x0'));var emlformat=require(_0x3735('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3735('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3735('0x3'));var moment=require('moment');var BPromise=require(_0x3735('0x4'));var Mustache=require(_0x3735('0x5'));var util=require(_0x3735('0x6'));var path=require(_0x3735('0x7'));var sox=require('sox');var csv=require(_0x3735('0x8'));var ejs=require(_0x3735('0x9'));var fs=require('fs');var _=require(_0x3735('0xa'));var squel=require(_0x3735('0xb'));var crypto=require(_0x3735('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3735('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3735('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3735('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3735('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x3735('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a3afa,_0x17ef2c){_0x17ef2c=_0x17ef2c||0xcc;return function(_0x391fef){if(_0x391fef){return _0x5a3afa[_0x3735('0x11')](_0x17ef2c);}return _0x5a3afa[_0x3735('0x12')](_0x17ef2c)['end']();};}function respondWithResult(_0x3f025d,_0x367e52){_0x367e52=_0x367e52||0xc8;return function(_0x3f4c97){if(_0x3f4c97){return _0x3f025d[_0x3735('0x12')](_0x367e52)[_0x3735('0x13')](_0x3f4c97);}};}function respondWithFilteredResult(_0x128106,_0x381660){return function(_0x36fc89){if(_0x36fc89){var _0x3c53d3=_0x36fc89[_0x3735('0x14')],_0x286e00=_0x381660[_0x3735('0x15')],_0x5702ca=_0x381660['offset']+_0x381660[_0x3735('0x16')],_0x166a6a;if(_0x5702ca>=_0x3c53d3){_0x5702ca=_0x3c53d3;_0x166a6a=0xc8;}else{_0x166a6a=0xce;}_0x128106['status'](_0x166a6a);return _0x128106[_0x3735('0x17')](_0x3735('0x18'),_0x286e00+'-'+_0x5702ca+'/'+_0x3c53d3)[_0x3735('0x13')](_0x36fc89);}return null;};}function patchUpdates(_0x2f8218){return function(_0x9f2a88){try{jsonpatch['apply'](_0x9f2a88,_0x2f8218,!![]);}catch(_0x77ab1e){return BPromise[_0x3735('0x19')](_0x77ab1e);}return _0x9f2a88['save']();};}function saveUpdates(_0x2fed98,_0x119248){return function(_0x54725c){if(_0x54725c){return _0x54725c[_0x3735('0x1a')](_0x2fed98)[_0x3735('0x1b')](function(_0x5203dc){return _0x5203dc;});}return null;};}function removeEntity(_0x31d9af,_0x23c5d5){return function(_0x1c6593){if(_0x1c6593){return _0x1c6593[_0x3735('0x1c')]()[_0x3735('0x1b')](function(){_0x31d9af[_0x3735('0x12')](0xcc)[_0x3735('0x1d')]();});}};}function handleEntityNotFound(_0x27801a,_0x2d9457){return function(_0x512e24){if(!_0x512e24){_0x27801a[_0x3735('0x11')](0x194);}return _0x512e24;};}function handleError(_0x271ee4,_0x378e36){_0x378e36=_0x378e36||0x1f4;return function(_0x2818ed){logger['error'](_0x2818ed[_0x3735('0x1e')]);if(_0x2818ed[_0x3735('0x1f')]){delete _0x2818ed[_0x3735('0x1f')];}_0x271ee4[_0x3735('0x12')](_0x378e36)[_0x3735('0x20')](_0x2818ed);};}exports[_0x3735('0x21')]=function(_0x5435be,_0x57ac28){var _0x5b8d38={},_0x11ee01={},_0x61b585={'count':0x0,'rows':[]};var _0x5e3518=_[_0x3735('0x22')](db[_0x3735('0x23')][_0x3735('0x24')],function(_0x5e85e8){return{'name':_0x5e85e8['fieldName'],'type':_0x5e85e8['type'][_0x3735('0x25')]};});_0x11ee01[_0x3735('0x26')]=_['map'](_0x5e3518,_0x3735('0x1f'));_0x11ee01[_0x3735('0x27')]=_[_0x3735('0x28')](_0x5435be[_0x3735('0x27')]);_0x11ee01[_0x3735('0x29')]=_[_0x3735('0x2a')](_0x11ee01[_0x3735('0x26')],_0x11ee01[_0x3735('0x27')]);_0x5b8d38['attributes']=_[_0x3735('0x2a')](_0x11ee01['model'],qs[_0x3735('0x2b')](_0x5435be[_0x3735('0x27')]['fields']));_0x5b8d38[_0x3735('0x2c')]=_0x5b8d38['attributes'][_0x3735('0x2d')]?_0x5b8d38[_0x3735('0x2c')]:_0x11ee01[_0x3735('0x26')];if(!_0x5435be[_0x3735('0x27')]['hasOwnProperty'](_0x3735('0x2e'))){_0x5b8d38[_0x3735('0x16')]=qs[_0x3735('0x16')](_0x5435be['query'][_0x3735('0x16')]);_0x5b8d38[_0x3735('0x15')]=qs[_0x3735('0x15')](_0x5435be[_0x3735('0x27')]['offset']);}_0x5b8d38[_0x3735('0x2f')]=qs[_0x3735('0x30')](_0x5435be['query'][_0x3735('0x30')]);_0x5b8d38[_0x3735('0x31')]=qs['filters'](_[_0x3735('0x32')](_0x5435be['query'],_0x11ee01['filters']),_0x5e3518);if(_0x5435be[_0x3735('0x27')][_0x3735('0x33')]){_0x5b8d38[_0x3735('0x31')]=_[_0x3735('0x34')](_0x5b8d38['where'],{'$or':_['map'](_0x5e3518,function(_0x523201){if(_0x523201['type']!==_0x3735('0x35')){var _0x2b2568={};_0x2b2568[_0x523201[_0x3735('0x1f')]]={'$like':'%'+_0x5435be['query'][_0x3735('0x33')]+'%'};return _0x2b2568;}})});}_0x5b8d38=_[_0x3735('0x34')]({},_0x5b8d38,_0x5435be['options']);var _0x14cba7={'where':_0x5b8d38['where']};return db['MailTransferReport'][_0x3735('0x14')](_0x14cba7)[_0x3735('0x1b')](function(_0x12ef00){_0x61b585['count']=_0x12ef00;if(_0x5435be[_0x3735('0x27')]['includeAll']){_0x5b8d38[_0x3735('0x36')]=[{'all':!![]}];}return db[_0x3735('0x23')][_0x3735('0x37')](_0x5b8d38);})['then'](function(_0x7da8b9){_0x61b585[_0x3735('0x38')]=_0x7da8b9;return _0x61b585;})[_0x3735('0x1b')](respondWithFilteredResult(_0x57ac28,_0x5b8d38))[_0x3735('0x39')](handleError(_0x57ac28,null));};exports[_0x3735('0x3a')]=function(_0x2771ea,_0x2476ae){var _0x56755c={'raw':!![],'where':{'id':_0x2771ea['params']['id']}},_0xf4631={};_0xf4631[_0x3735('0x26')]=_['keys'](db['MailTransferReport'][_0x3735('0x24')]);_0xf4631['query']=_[_0x3735('0x28')](_0x2771ea[_0x3735('0x27')]);_0xf4631[_0x3735('0x29')]=_[_0x3735('0x2a')](_0xf4631[_0x3735('0x26')],_0xf4631[_0x3735('0x27')]);_0x56755c[_0x3735('0x2c')]=_['intersection'](_0xf4631[_0x3735('0x26')],qs[_0x3735('0x2b')](_0x2771ea['query'][_0x3735('0x2b')]));_0x56755c[_0x3735('0x2c')]=_0x56755c[_0x3735('0x2c')][_0x3735('0x2d')]?_0x56755c[_0x3735('0x2c')]:_0xf4631['model'];if(_0x2771ea[_0x3735('0x27')][_0x3735('0x3b')]){_0x56755c[_0x3735('0x36')]=[{'all':!![]}];}_0x56755c=_[_0x3735('0x34')]({},_0x56755c,_0x2771ea['options']);return db[_0x3735('0x23')][_0x3735('0x3c')](_0x56755c)['then'](handleEntityNotFound(_0x2476ae,null))['then'](respondWithResult(_0x2476ae,null))['catch'](handleError(_0x2476ae,null));};exports[_0x3735('0x3d')]=function(_0x4b67b6,_0xdd5d91){return db[_0x3735('0x23')][_0x3735('0x3d')](_0x4b67b6['body'],{})['then'](respondWithResult(_0xdd5d91,0xc9))[_0x3735('0x39')](handleError(_0xdd5d91,null));};exports['update']=function(_0x2d9507,_0x11d0fd){if(_0x2d9507[_0x3735('0x3e')]['id']){delete _0x2d9507['body']['id'];}return db['MailTransferReport'][_0x3735('0x3c')]({'where':{'id':_0x2d9507['params']['id']}})[_0x3735('0x1b')](handleEntityNotFound(_0x11d0fd,null))['then'](saveUpdates(_0x2d9507['body'],null))['then'](respondWithResult(_0x11d0fd,null))[_0x3735('0x39')](handleError(_0x11d0fd,null));};exports['destroy']=function(_0x404358,_0x2aa57e){return db[_0x3735('0x23')][_0x3735('0x3c')]({'where':{'id':_0x404358[_0x3735('0x3f')]['id']}})[_0x3735('0x1b')](handleEntityNotFound(_0x2aa57e,null))[_0x3735('0x1b')](removeEntity(_0x2aa57e,null))[_0x3735('0x39')](handleError(_0x2aa57e,null));};exports[_0x3735('0x40')]=function(_0x1f8ea2,_0x4df4c8){return db['MailTransferReport'][_0x3735('0x40')]()[_0x3735('0x1b')](respondWithResult(_0x4df4c8,null))['catch'](handleError(_0x4df4c8,null));}; \ No newline at end of file +var _0x9eda=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x6e7fc0,_0x18b91e){var _0xf69948=function(_0x707782){while(--_0x707782){_0x6e7fc0['push'](_0x6e7fc0['shift']());}};_0xf69948(++_0x18b91e);}(_0x9eda,0x158));var _0xa9ed=function(_0x57208f,_0x5e8667){_0x57208f=_0x57208f-0x0;var _0x17508c=_0x9eda[_0x57208f];return _0x17508c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa9ed('0x0'));var zipdir=require(_0xa9ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ed('0x2'));var moment=require(_0xa9ed('0x3'));var BPromise=require(_0xa9ed('0x4'));var Mustache=require(_0xa9ed('0x5'));var util=require(_0xa9ed('0x6'));var path=require(_0xa9ed('0x7'));var sox=require('sox');var csv=require(_0xa9ed('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa9ed('0x9'));var crypto=require(_0xa9ed('0xa'));var jsforce=require(_0xa9ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa9ed('0x8'));var querystring=require('querystring');var Papa=require(_0xa9ed('0xc'));var Redis=require('ioredis');var authService=require(_0xa9ed('0xd'));var qs=require(_0xa9ed('0xe'));var as=require(_0xa9ed('0xf'));var hardwareService=require(_0xa9ed('0x10'));var logger=require(_0xa9ed('0x11'))(_0xa9ed('0x12'));var utils=require(_0xa9ed('0x13'));var config=require('../../config/environment');var db=require(_0xa9ed('0x14'))['db'];function respondWithStatusCode(_0x1bb7b9,_0xcb15ce){_0xcb15ce=_0xcb15ce||0xcc;return function(_0x512044){if(_0x512044){return _0x1bb7b9[_0xa9ed('0x15')](_0xcb15ce);}return _0x1bb7b9['status'](_0xcb15ce)[_0xa9ed('0x16')]();};}function respondWithResult(_0x39ac4b,_0x18f2ef){_0x18f2ef=_0x18f2ef||0xc8;return function(_0x12428c){if(_0x12428c){return _0x39ac4b[_0xa9ed('0x17')](_0x18f2ef)[_0xa9ed('0x18')](_0x12428c);}};}function respondWithFilteredResult(_0x41c855,_0x30a391){return function(_0x577213){if(_0x577213){var _0x2549a3=_0x577213[_0xa9ed('0x19')],_0x493ad0=_0x30a391[_0xa9ed('0x1a')],_0x1f1ff8=_0x30a391[_0xa9ed('0x1a')]+_0x30a391['limit'],_0x284681;if(_0x1f1ff8>=_0x2549a3){_0x1f1ff8=_0x2549a3;_0x284681=0xc8;}else{_0x284681=0xce;}_0x41c855[_0xa9ed('0x17')](_0x284681);return _0x41c855[_0xa9ed('0x1b')](_0xa9ed('0x1c'),_0x493ad0+'-'+_0x1f1ff8+'/'+_0x2549a3)[_0xa9ed('0x18')](_0x577213);}return null;};}function patchUpdates(_0x4ca7d7){return function(_0xc4a46b){try{jsonpatch[_0xa9ed('0x1d')](_0xc4a46b,_0x4ca7d7,!![]);}catch(_0xc1cbd){return BPromise[_0xa9ed('0x1e')](_0xc1cbd);}return _0xc4a46b[_0xa9ed('0x1f')]();};}function saveUpdates(_0x4dc98a,_0x3a72d6){return function(_0x57bda7){if(_0x57bda7){return _0x57bda7[_0xa9ed('0x20')](_0x4dc98a)['then'](function(_0x1b1382){return _0x1b1382;});}return null;};}function removeEntity(_0x40d7bb,_0x5a961c){return function(_0x5c5af8){if(_0x5c5af8){return _0x5c5af8[_0xa9ed('0x21')]()[_0xa9ed('0x22')](function(){_0x40d7bb[_0xa9ed('0x17')](0xcc)[_0xa9ed('0x16')]();});}};}function handleEntityNotFound(_0x449eee,_0x2f084d){return function(_0x537a1b){if(!_0x537a1b){_0x449eee[_0xa9ed('0x15')](0x194);}return _0x537a1b;};}function handleError(_0x3a3cef,_0xa00385){_0xa00385=_0xa00385||0x1f4;return function(_0x307dd5){logger['error'](_0x307dd5['stack']);if(_0x307dd5['name']){delete _0x307dd5[_0xa9ed('0x23')];}_0x3a3cef[_0xa9ed('0x17')](_0xa00385)[_0xa9ed('0x24')](_0x307dd5);};}exports[_0xa9ed('0x25')]=function(_0x1c7a00,_0x49b6c7){var _0x24aa79={},_0x552dfb={},_0x53ade1={'count':0x0,'rows':[]};var _0x14cbcf=_[_0xa9ed('0x26')](db[_0xa9ed('0x27')][_0xa9ed('0x28')],function(_0x4e353c){return{'name':_0x4e353c[_0xa9ed('0x29')],'type':_0x4e353c[_0xa9ed('0x2a')]['key']};});_0x552dfb['model']=_[_0xa9ed('0x26')](_0x14cbcf,_0xa9ed('0x23'));_0x552dfb[_0xa9ed('0x2b')]=_[_0xa9ed('0x2c')](_0x1c7a00[_0xa9ed('0x2b')]);_0x552dfb[_0xa9ed('0x2d')]=_['intersection'](_0x552dfb[_0xa9ed('0x2e')],_0x552dfb['query']);_0x24aa79[_0xa9ed('0x2f')]=_[_0xa9ed('0x30')](_0x552dfb[_0xa9ed('0x2e')],qs[_0xa9ed('0x31')](_0x1c7a00['query']['fields']));_0x24aa79[_0xa9ed('0x2f')]=_0x24aa79[_0xa9ed('0x2f')]['length']?_0x24aa79[_0xa9ed('0x2f')]:_0x552dfb[_0xa9ed('0x2e')];if(!_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x32')](_0xa9ed('0x33'))){_0x24aa79[_0xa9ed('0x34')]=qs[_0xa9ed('0x34')](_0x1c7a00[_0xa9ed('0x2b')]['limit']);_0x24aa79[_0xa9ed('0x1a')]=qs[_0xa9ed('0x1a')](_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x1a')]);}_0x24aa79['order']=qs[_0xa9ed('0x35')](_0x1c7a00['query'][_0xa9ed('0x35')]);_0x24aa79['where']=qs[_0xa9ed('0x2d')](_[_0xa9ed('0x36')](_0x1c7a00[_0xa9ed('0x2b')],_0x552dfb[_0xa9ed('0x2d')]),_0x14cbcf);if(_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x37')]){_0x24aa79[_0xa9ed('0x38')]=_[_0xa9ed('0x39')](_0x24aa79[_0xa9ed('0x38')],{'$or':_[_0xa9ed('0x26')](_0x14cbcf,function(_0x1d3667){if(_0x1d3667[_0xa9ed('0x2a')]!==_0xa9ed('0x3a')){var _0x502ed6={};_0x502ed6[_0x1d3667[_0xa9ed('0x23')]]={'$like':'%'+_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x37')]+'%'};return _0x502ed6;}})});}_0x24aa79=_[_0xa9ed('0x39')]({},_0x24aa79,_0x1c7a00['options']);var _0x4b7326={'where':_0x24aa79['where']};return db[_0xa9ed('0x27')]['count'](_0x4b7326)[_0xa9ed('0x22')](function(_0x271421){_0x53ade1['count']=_0x271421;if(_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x3b')]){_0x24aa79[_0xa9ed('0x3c')]=[{'all':!![]}];}return db['MailTransferReport'][_0xa9ed('0x3d')](_0x24aa79);})['then'](function(_0x18856b){_0x53ade1[_0xa9ed('0x3e')]=_0x18856b;return _0x53ade1;})[_0xa9ed('0x22')](respondWithFilteredResult(_0x49b6c7,_0x24aa79))[_0xa9ed('0x3f')](handleError(_0x49b6c7,null));};exports[_0xa9ed('0x40')]=function(_0x4b0a30,_0x15a8f5){var _0x4b2b03={'raw':!![],'where':{'id':_0x4b0a30['params']['id']}},_0x4303ec={};_0x4303ec[_0xa9ed('0x2e')]=_[_0xa9ed('0x2c')](db[_0xa9ed('0x27')][_0xa9ed('0x28')]);_0x4303ec[_0xa9ed('0x2b')]=_[_0xa9ed('0x2c')](_0x4b0a30[_0xa9ed('0x2b')]);_0x4303ec[_0xa9ed('0x2d')]=_[_0xa9ed('0x30')](_0x4303ec[_0xa9ed('0x2e')],_0x4303ec['query']);_0x4b2b03['attributes']=_[_0xa9ed('0x30')](_0x4303ec[_0xa9ed('0x2e')],qs[_0xa9ed('0x31')](_0x4b0a30['query'][_0xa9ed('0x31')]));_0x4b2b03['attributes']=_0x4b2b03[_0xa9ed('0x2f')][_0xa9ed('0x41')]?_0x4b2b03[_0xa9ed('0x2f')]:_0x4303ec[_0xa9ed('0x2e')];if(_0x4b0a30[_0xa9ed('0x2b')]['includeAll']){_0x4b2b03[_0xa9ed('0x3c')]=[{'all':!![]}];}_0x4b2b03=_[_0xa9ed('0x39')]({},_0x4b2b03,_0x4b0a30[_0xa9ed('0x42')]);return db[_0xa9ed('0x27')][_0xa9ed('0x43')](_0x4b2b03)['then'](handleEntityNotFound(_0x15a8f5,null))['then'](respondWithResult(_0x15a8f5,null))[_0xa9ed('0x3f')](handleError(_0x15a8f5,null));};exports[_0xa9ed('0x44')]=function(_0x3d45e1,_0x4b9884){return db[_0xa9ed('0x27')][_0xa9ed('0x44')](_0x3d45e1[_0xa9ed('0x45')],{})[_0xa9ed('0x22')](respondWithResult(_0x4b9884,0xc9))[_0xa9ed('0x3f')](handleError(_0x4b9884,null));};exports[_0xa9ed('0x20')]=function(_0x506266,_0x22ebb4){if(_0x506266['body']['id']){delete _0x506266[_0xa9ed('0x45')]['id'];}return db[_0xa9ed('0x27')][_0xa9ed('0x43')]({'where':{'id':_0x506266[_0xa9ed('0x46')]['id']}})[_0xa9ed('0x22')](handleEntityNotFound(_0x22ebb4,null))[_0xa9ed('0x22')](saveUpdates(_0x506266[_0xa9ed('0x45')],null))['then'](respondWithResult(_0x22ebb4,null))['catch'](handleError(_0x22ebb4,null));};exports[_0xa9ed('0x21')]=function(_0x2435a3,_0x57cb97){return db[_0xa9ed('0x27')][_0xa9ed('0x43')]({'where':{'id':_0x2435a3[_0xa9ed('0x46')]['id']}})[_0xa9ed('0x22')](handleEntityNotFound(_0x57cb97,null))[_0xa9ed('0x22')](removeEntity(_0x57cb97,null))[_0xa9ed('0x3f')](handleError(_0x57cb97,null));};exports[_0xa9ed('0x47')]=function(_0x41e2c5,_0x56b6aa){return db[_0xa9ed('0x27')]['describe']()[_0xa9ed('0x22')](respondWithResult(_0x56b6aa,null))[_0xa9ed('0x3f')](handleError(_0x56b6aa,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0c33dbe..3941f03 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 _0xfd17=['api','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport','uniqueid','lodash','../../config/logger'];(function(_0xee40b9,_0x283358){var _0x64ea28=function(_0x44bf2f){while(--_0x44bf2f){_0xee40b9['push'](_0xee40b9['shift']());}};_0x64ea28(++_0x283358);}(_0xfd17,0x18a));var _0x7fd1=function(_0x5e07a7,_0x1438b3){_0x5e07a7=_0x5e07a7-0x0;var _0x22ced5=_0xfd17[_0x5e07a7];return _0x22ced5;};'use strict';var _=require(_0x7fd1('0x0'));var util=require('util');var logger=require(_0x7fd1('0x1'))(_0x7fd1('0x2'));var moment=require('moment');var BPromise=require(_0x7fd1('0x3'));var rp=require(_0x7fd1('0x4'));var fs=require('fs');var path=require(_0x7fd1('0x5'));var rimraf=require(_0x7fd1('0x6'));var config=require('../../config/environment');var attributes=require(_0x7fd1('0x7'));module['exports']=function(_0x50fc07,_0xb9baf7){return _0x50fc07[_0x7fd1('0x8')](_0x7fd1('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x7fd1('0xa'),'fields':[_0x7fd1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2269=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x17d82f,_0x5d9172){var _0x58137b=function(_0x40e198){while(--_0x40e198){_0x17d82f['push'](_0x17d82f['shift']());}};_0x58137b(++_0x5d9172);}(_0x2269,0x1f2));var _0x9226=function(_0xcb067d,_0x389261){_0xcb067d=_0xcb067d-0x0;var _0x314f93=_0x2269[_0xcb067d];return _0x314f93;};'use strict';var _=require(_0x9226('0x0'));var util=require(_0x9226('0x1'));var logger=require(_0x9226('0x2'))(_0x9226('0x3'));var moment=require('moment');var BPromise=require(_0x9226('0x4'));var rp=require(_0x9226('0x5'));var fs=require('fs');var path=require(_0x9226('0x6'));var rimraf=require(_0x9226('0x7'));var config=require(_0x9226('0x8'));var attributes=require(_0x9226('0x9'));module[_0x9226('0xa')]=function(_0x4e36f8,_0x1a82c1){return _0x4e36f8[_0x9226('0xb')](_0x9226('0xc'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x9226('0xd'),'fields':[_0x9226('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index ecac430..c9dcf0a 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 _0x2784=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0xf806fa,_0x406459){var _0x58995b=function(_0x5ddc03){while(--_0x5ddc03){_0xf806fa['push'](_0xf806fa['shift']());}};_0x58995b(++_0x406459);}(_0x2784,0x1c3));var _0x4278=function(_0x12c695,_0x397a06){_0x12c695=_0x12c695-0x0;var _0x38d4f5=_0x2784[_0x12c695];return _0x38d4f5;};'use strict';var _=require('lodash');var util=require(_0x4278('0x0'));var moment=require('moment');var BPromise=require(_0x4278('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4278('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4278('0x3'));var logger=require(_0x4278('0x4'))(_0x4278('0x5'));var config=require(_0x4278('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4278('0x7')][_0x4278('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x526d52,_0x17f958,_0x474c4d){return new BPromise(function(_0x78d80b,_0x4a6a78){return client[_0x4278('0x9')](_0x526d52,_0x474c4d)[_0x4278('0xa')](function(_0x1f6068){logger[_0x4278('0xb')](_0x4278('0xc'),_0x17f958,_0x4278('0xd'));logger[_0x4278('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x17f958,_0x4278('0xd'),JSON[_0x4278('0xf')](_0x1f6068));if(_0x1f6068[_0x4278('0x10')]){if(_0x1f6068['error'][_0x4278('0x11')]===0x1f4){logger['error'](_0x4278('0xc'),_0x17f958,_0x1f6068[_0x4278('0x10')][_0x4278('0x12')]);return _0x4a6a78(_0x1f6068[_0x4278('0x10')]['message']);}logger[_0x4278('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x17f958,_0x1f6068[_0x4278('0x10')]['message']);return _0x78d80b(_0x1f6068[_0x4278('0x10')][_0x4278('0x12')]);}else{logger[_0x4278('0xb')](_0x4278('0xc'),_0x17f958,_0x4278('0xd'));_0x78d80b(_0x1f6068[_0x4278('0x13')]['message']);}})[_0x4278('0x14')](function(_0x4897eb){logger[_0x4278('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x17f958,_0x4897eb);_0x4a6a78(_0x4897eb);});});} \ No newline at end of file +var _0x2d90=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash'];(function(_0xab0d92,_0x4739da){var _0x56846b=function(_0x35f3fa){while(--_0x35f3fa){_0xab0d92['push'](_0xab0d92['shift']());}};_0x56846b(++_0x4739da);}(_0x2d90,0xbf));var _0x02d9=function(_0x11b56c,_0x3c2dc1){_0x11b56c=_0x11b56c-0x0;var _0x1ef82e=_0x2d90[_0x11b56c];return _0x1ef82e;};'use strict';var _=require(_0x02d9('0x0'));var util=require('util');var moment=require(_0x02d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x02d9('0x2'));var fs=require('fs');var Redis=require(_0x02d9('0x3'));var db=require(_0x02d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x02d9('0x5'))(_0x02d9('0x6'));var config=require(_0x02d9('0x7'));var jayson=require(_0x02d9('0x8'));var client=jayson[_0x02d9('0x9')][_0x02d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6b2f,_0x2cd295,_0x479fdd){return new BPromise(function(_0xeccb8b,_0x182bce){return client[_0x02d9('0xb')](_0x2c6b2f,_0x479fdd)[_0x02d9('0xc')](function(_0x5373f5){logger['info'](_0x02d9('0xd'),_0x2cd295,'request\x20sent');logger[_0x02d9('0xe')](_0x02d9('0xf'),_0x2cd295,'request\x20sent',JSON[_0x02d9('0x10')](_0x5373f5));if(_0x5373f5[_0x02d9('0x11')]){if(_0x5373f5[_0x02d9('0x11')][_0x02d9('0x12')]===0x1f4){logger[_0x02d9('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x2cd295,_0x5373f5[_0x02d9('0x11')][_0x02d9('0x13')]);return _0x182bce(_0x5373f5[_0x02d9('0x11')][_0x02d9('0x13')]);}logger[_0x02d9('0x11')](_0x02d9('0xd'),_0x2cd295,_0x5373f5[_0x02d9('0x11')][_0x02d9('0x13')]);return _0xeccb8b(_0x5373f5[_0x02d9('0x11')]['message']);}else{logger[_0x02d9('0x14')](_0x02d9('0xd'),_0x2cd295,_0x02d9('0x15'));_0xeccb8b(_0x5373f5[_0x02d9('0x16')]['message']);}})[_0x02d9('0x17')](function(_0x2d7a77){logger[_0x02d9('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x2cd295,_0x2d7a77);_0x182bce(_0x2d7a77);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 8aef2c3..9da2219 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 _0x288f=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','create','destroy','exports'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x288f,0x130));var _0xf288=function(_0x48bf52,_0x8c4a24){_0x48bf52=_0x48bf52-0x0;var _0x78d6a6=_0x288f[_0x48bf52];return _0x78d6a6;};'use strict';var multer=require(_0xf288('0x0'));var util=require(_0xf288('0x1'));var path=require(_0xf288('0x2'));var timeout=require(_0xf288('0x3'));var express=require(_0xf288('0x4'));var router=express['Router']();var auth=require(_0xf288('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf288('0x6'));var controller=require('./memberReport.controller');router['get']('/',auth[_0xf288('0x7')](),controller[_0xf288('0x8')]);router[_0xf288('0x9')](_0xf288('0xa'),auth[_0xf288('0x7')](),controller['describe']);router[_0xf288('0x9')](_0xf288('0xb'),auth[_0xf288('0x7')](),controller[_0xf288('0xc')]);router['post']('/',auth[_0xf288('0x7')](),controller[_0xf288('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xf288('0xb'),auth[_0xf288('0x7')](),controller[_0xf288('0xe')]);module[_0xf288('0xf')]=router; \ No newline at end of file +var _0xdb71=['describe','show','create','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','/describe'];(function(_0x29f232,_0xa42136){var _0x583b19=function(_0x5b92ae){while(--_0x5b92ae){_0x29f232['push'](_0x29f232['shift']());}};_0x583b19(++_0xa42136);}(_0xdb71,0xe4));var _0x1db7=function(_0x254bd0,_0x14e419){_0x254bd0=_0x254bd0-0x0;var _0x130355=_0xdb71[_0x254bd0];return _0x130355;};'use strict';var multer=require(_0x1db7('0x0'));var util=require(_0x1db7('0x1'));var path=require(_0x1db7('0x2'));var timeout=require('connect-timeout');var express=require(_0x1db7('0x3'));var router=express[_0x1db7('0x4')]();var auth=require(_0x1db7('0x5'));var interaction=require(_0x1db7('0x6'));var config=require(_0x1db7('0x7'));var controller=require(_0x1db7('0x8'));router['get']('/',auth[_0x1db7('0x9')](),controller[_0x1db7('0xa')]);router['get'](_0x1db7('0xb'),auth[_0x1db7('0x9')](),controller[_0x1db7('0xc')]);router['get']('/:id',auth[_0x1db7('0x9')](),controller[_0x1db7('0xd')]);router['post']('/',auth[_0x1db7('0x9')](),controller[_0x1db7('0xe')]);router['put']('/:id',auth[_0x1db7('0x9')](),controller[_0x1db7('0xf')]);router[_0x1db7('0x10')](_0x1db7('0x11'),auth[_0x1db7('0x9')](),controller[_0x1db7('0x12')]);module[_0x1db7('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 618e192..8e6272f 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 _0xb8aa=['INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]'];(function(_0x5a09ef,_0x1f65ef){var _0x238d29=function(_0x7fa1a5){while(--_0x7fa1a5){_0x5a09ef['push'](_0x5a09ef['shift']());}};_0x238d29(++_0x1f65ef);}(_0xb8aa,0xf1));var _0xab8a=function(_0x281375,_0x251289){_0x281375=_0x281375-0x0;var _0x5d05aa=_0xb8aa[_0x281375];return _0x5d05aa;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xab8a('0x0'));module[_0xab8a('0x1')]={'channel':{'type':Sequelize[_0xab8a('0x2')]},'membername':{'type':Sequelize[_0xab8a('0x2')]},'interface':{'type':Sequelize[_0xab8a('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xab8a('0x3'),'comment':_0xab8a('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xab8a('0x5')]},'exitAt':{'type':Sequelize[_0xab8a('0x5')],'set':function(_0x141f70){var _0x884d3e=moment(_0x141f70);var _0x582d06=moment(this[_0xab8a('0x6')](_0xab8a('0x7')));var _0x4685cb=_0x884d3e[_0xab8a('0x8')](_0x582d06,_0xab8a('0x9'));this[_0xab8a('0xa')]('exitAt',_0x141f70);this[_0xab8a('0xa')]('duration',_0x4685cb||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xab8a('0xb')},'data2':{'type':Sequelize[_0xab8a('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xab8a('0x2')],'comment':_0xab8a('0xc')},'data4':{'type':Sequelize[_0xab8a('0x2')],'comment':_0xab8a('0xd')},'data5':{'type':Sequelize[_0xab8a('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xab8a('0x2')]},'internal':{'type':Sequelize[_0xab8a('0xe')]},'uniqueid':{'type':Sequelize[_0xab8a('0x2')]}}; \ No newline at end of file +var _0x6414=['STRING','DEFAULT\x20PAUSE','DATE','getDataValue','diff','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','INTEGER','sequelize'];(function(_0x5b66b0,_0x3c535b){var _0x63df50=function(_0x5b6024){while(--_0x5b6024){_0x5b66b0['push'](_0x5b66b0['shift']());}};_0x63df50(++_0x3c535b);}(_0x6414,0x185));var _0x4641=function(_0x3b4278,_0x12cadb){_0x3b4278=_0x3b4278-0x0;var _0x29b01e=_0x6414[_0x3b4278];return _0x29b01e;};'use strict';var Sequelize=require(_0x4641('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4641('0x1')]},'interface':{'type':Sequelize[_0x4641('0x1')]},'type':{'type':Sequelize[_0x4641('0x1')],'defaultValue':_0x4641('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4641('0x3')],'set':function(_0x157451){var _0x4f3ad9=moment(_0x157451);var _0x5ba3bc=moment(this[_0x4641('0x4')]('enterAt'));var _0x3dfafb=_0x4f3ad9[_0x4641('0x5')](_0x5ba3bc,'seconds');this['setDataValue'](_0x4641('0x6'),_0x157451);this[_0x4641('0x7')]('duration',_0x3dfafb||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x4641('0x8')},'data2':{'type':Sequelize[_0x4641('0x1')],'comment':_0x4641('0x9')},'data3':{'type':Sequelize[_0x4641('0x1')],'comment':_0x4641('0xa')},'data4':{'type':Sequelize[_0x4641('0x1')],'comment':_0x4641('0xb')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x4641('0x1')]},'internal':{'type':Sequelize[_0x4641('0xc')]},'uniqueid':{'type':Sequelize[_0x4641('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 221c3f4..d5fde5f 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 _0x3e6d=['fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','include','params','keys','rawAttributes','length','includeAll','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','error','stack','name','send','MemberReport','fieldName','type','key','model','query','intersection'];(function(_0x146d8d,_0x2c42fc){var _0x95a74=function(_0x196ee2){while(--_0x196ee2){_0x146d8d['push'](_0x146d8d['shift']());}};_0x95a74(++_0x2c42fc);}(_0x3e6d,0x187));var _0xd3e6=function(_0x4e977f,_0x50ea87){_0x4e977f=_0x4e977f-0x0;var _0x3bbc90=_0x3e6d[_0x4e977f];return _0x3bbc90;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd3e6('0x0'));var rimraf=require(_0xd3e6('0x1'));var zipdir=require(_0xd3e6('0x2'));var jsonpatch=require(_0xd3e6('0x3'));var rp=require('request-promise');var moment=require(_0xd3e6('0x4'));var BPromise=require(_0xd3e6('0x5'));var Mustache=require(_0xd3e6('0x6'));var util=require(_0xd3e6('0x7'));var path=require('path');var sox=require(_0xd3e6('0x8'));var csv=require(_0xd3e6('0x9'));var ejs=require(_0xd3e6('0xa'));var fs=require('fs');var _=require(_0xd3e6('0xb'));var squel=require(_0xd3e6('0xc'));var crypto=require(_0xd3e6('0xd'));var jsforce=require(_0xd3e6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd3e6('0xf'));var Papa=require('papaparse');var Redis=require(_0xd3e6('0x10'));var authService=require(_0xd3e6('0x11'));var qs=require(_0xd3e6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3e6('0x13'));var logger=require(_0xd3e6('0x14'))(_0xd3e6('0x15'));var utils=require(_0xd3e6('0x16'));var config=require(_0xd3e6('0x17'));var db=require(_0xd3e6('0x18'))['db'];function respondWithStatusCode(_0x47707a,_0x49dad3){_0x49dad3=_0x49dad3||0xcc;return function(_0x28ad68){if(_0x28ad68){return _0x47707a[_0xd3e6('0x19')](_0x49dad3);}return _0x47707a[_0xd3e6('0x1a')](_0x49dad3)[_0xd3e6('0x1b')]();};}function respondWithResult(_0x1c8a69,_0x61d939){_0x61d939=_0x61d939||0xc8;return function(_0xb9d11d){if(_0xb9d11d){return _0x1c8a69['status'](_0x61d939)[_0xd3e6('0x1c')](_0xb9d11d);}};}function respondWithFilteredResult(_0x5471a6,_0x789bbe){return function(_0x666b01){if(_0x666b01){var _0x41d44f=_0x666b01[_0xd3e6('0x1d')],_0x32c9b8=_0x789bbe[_0xd3e6('0x1e')],_0x1ba193=_0x789bbe['offset']+_0x789bbe['limit'],_0x18a005;if(_0x1ba193>=_0x41d44f){_0x1ba193=_0x41d44f;_0x18a005=0xc8;}else{_0x18a005=0xce;}_0x5471a6['status'](_0x18a005);return _0x5471a6[_0xd3e6('0x1f')]('Content-Range',_0x32c9b8+'-'+_0x1ba193+'/'+_0x41d44f)[_0xd3e6('0x1c')](_0x666b01);}return null;};}function patchUpdates(_0x189fc3){return function(_0x3fd7d5){try{jsonpatch['apply'](_0x3fd7d5,_0x189fc3,!![]);}catch(_0x3d6729){return BPromise[_0xd3e6('0x20')](_0x3d6729);}return _0x3fd7d5[_0xd3e6('0x21')]();};}function saveUpdates(_0x5f3010,_0x1e6947){return function(_0x3c9525){if(_0x3c9525){return _0x3c9525[_0xd3e6('0x22')](_0x5f3010)[_0xd3e6('0x23')](function(_0x4ca6d6){return _0x4ca6d6;});}return null;};}function removeEntity(_0x5ebee6,_0x2fb049){return function(_0x713be0){if(_0x713be0){return _0x713be0['destroy']()[_0xd3e6('0x23')](function(){_0x5ebee6[_0xd3e6('0x1a')](0xcc)[_0xd3e6('0x1b')]();});}};}function handleEntityNotFound(_0x5525c4,_0x30722c){return function(_0x34ef3b){if(!_0x34ef3b){_0x5525c4[_0xd3e6('0x19')](0x194);}return _0x34ef3b;};}function handleError(_0x574ba5,_0x105b03){_0x105b03=_0x105b03||0x1f4;return function(_0xc080ab){logger[_0xd3e6('0x24')](_0xc080ab[_0xd3e6('0x25')]);if(_0xc080ab['name']){delete _0xc080ab[_0xd3e6('0x26')];}_0x574ba5[_0xd3e6('0x1a')](_0x105b03)[_0xd3e6('0x27')](_0xc080ab);};}exports['index']=function(_0x34370b,_0x2ccd74){var _0x33948f={},_0x3a1369={},_0x47ca26={'count':0x0,'rows':[]};var _0x2dbe1e=_['map'](db[_0xd3e6('0x28')]['rawAttributes'],function(_0x5a1c8b){return{'name':_0x5a1c8b[_0xd3e6('0x29')],'type':_0x5a1c8b[_0xd3e6('0x2a')][_0xd3e6('0x2b')]};});_0x3a1369[_0xd3e6('0x2c')]=_['map'](_0x2dbe1e,_0xd3e6('0x26'));_0x3a1369[_0xd3e6('0x2d')]=_['keys'](_0x34370b[_0xd3e6('0x2d')]);_0x3a1369['filters']=_['intersection'](_0x3a1369[_0xd3e6('0x2c')],_0x3a1369[_0xd3e6('0x2d')]);_0x33948f['attributes']=_[_0xd3e6('0x2e')](_0x3a1369[_0xd3e6('0x2c')],qs[_0xd3e6('0x2f')](_0x34370b['query']['fields']));_0x33948f[_0xd3e6('0x30')]=_0x33948f[_0xd3e6('0x30')]['length']?_0x33948f['attributes']:_0x3a1369['model'];if(!_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x31')](_0xd3e6('0x32'))){_0x33948f[_0xd3e6('0x33')]=qs[_0xd3e6('0x33')](_0x34370b['query'][_0xd3e6('0x33')]);_0x33948f['offset']=qs['offset'](_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x1e')]);}_0x33948f['order']=qs[_0xd3e6('0x34')](_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x34')]);_0x33948f[_0xd3e6('0x35')]=qs['filters'](_[_0xd3e6('0x36')](_0x34370b[_0xd3e6('0x2d')],_0x3a1369[_0xd3e6('0x37')]),_0x2dbe1e);if(_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x38')]){_0x33948f[_0xd3e6('0x35')]=_[_0xd3e6('0x39')](_0x33948f[_0xd3e6('0x35')],{'$or':_[_0xd3e6('0x3a')](_0x2dbe1e,function(_0x11ff1d){if(_0x11ff1d[_0xd3e6('0x2a')]!==_0xd3e6('0x3b')){var _0x277347={};_0x277347[_0x11ff1d[_0xd3e6('0x26')]]={'$like':'%'+_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x38')]+'%'};return _0x277347;}})});}_0x33948f=_[_0xd3e6('0x39')]({},_0x33948f,_0x34370b[_0xd3e6('0x3c')]);var _0x36cb4c={'where':_0x33948f['where']};return db['MemberReport'][_0xd3e6('0x1d')](_0x36cb4c)[_0xd3e6('0x23')](function(_0x1f5c82){_0x47ca26[_0xd3e6('0x1d')]=_0x1f5c82;if(_0x34370b[_0xd3e6('0x2d')]['includeAll']){_0x33948f[_0xd3e6('0x3d')]=[{'all':!![]}];}return db[_0xd3e6('0x28')]['findAll'](_0x33948f);})[_0xd3e6('0x23')](function(_0x11db22){_0x47ca26['rows']=_0x11db22;return _0x47ca26;})['then'](respondWithFilteredResult(_0x2ccd74,_0x33948f))['catch'](handleError(_0x2ccd74,null));};exports['show']=function(_0x2fc43a,_0x27b59a){var _0xd491b1={'raw':!![],'where':{'id':_0x2fc43a[_0xd3e6('0x3e')]['id']}},_0x3032de={};_0x3032de['model']=_[_0xd3e6('0x3f')](db['MemberReport'][_0xd3e6('0x40')]);_0x3032de['query']=_[_0xd3e6('0x3f')](_0x2fc43a[_0xd3e6('0x2d')]);_0x3032de[_0xd3e6('0x37')]=_[_0xd3e6('0x2e')](_0x3032de[_0xd3e6('0x2c')],_0x3032de[_0xd3e6('0x2d')]);_0xd491b1['attributes']=_[_0xd3e6('0x2e')](_0x3032de[_0xd3e6('0x2c')],qs[_0xd3e6('0x2f')](_0x2fc43a[_0xd3e6('0x2d')][_0xd3e6('0x2f')]));_0xd491b1[_0xd3e6('0x30')]=_0xd491b1['attributes'][_0xd3e6('0x41')]?_0xd491b1[_0xd3e6('0x30')]:_0x3032de[_0xd3e6('0x2c')];if(_0x2fc43a[_0xd3e6('0x2d')][_0xd3e6('0x42')]){_0xd491b1['include']=[{'all':!![]}];}_0xd491b1=_[_0xd3e6('0x39')]({},_0xd491b1,_0x2fc43a[_0xd3e6('0x3c')]);return db[_0xd3e6('0x28')][_0xd3e6('0x43')](_0xd491b1)['then'](handleEntityNotFound(_0x27b59a,null))[_0xd3e6('0x23')](respondWithResult(_0x27b59a,null))[_0xd3e6('0x44')](handleError(_0x27b59a,null));};exports[_0xd3e6('0x45')]=function(_0x2ddda4,_0x6b434a){return db[_0xd3e6('0x28')][_0xd3e6('0x45')](_0x2ddda4['body'],{})[_0xd3e6('0x23')](respondWithResult(_0x6b434a,0xc9))[_0xd3e6('0x44')](handleError(_0x6b434a,null));};exports['update']=function(_0x52e555,_0x1b3dd2){if(_0x52e555[_0xd3e6('0x46')]['id']){delete _0x52e555['body']['id'];}return db[_0xd3e6('0x28')]['find']({'where':{'id':_0x52e555[_0xd3e6('0x3e')]['id']}})[_0xd3e6('0x23')](handleEntityNotFound(_0x1b3dd2,null))[_0xd3e6('0x23')](saveUpdates(_0x52e555[_0xd3e6('0x46')],null))[_0xd3e6('0x23')](respondWithResult(_0x1b3dd2,null))[_0xd3e6('0x44')](handleError(_0x1b3dd2,null));};exports[_0xd3e6('0x47')]=function(_0x49da28,_0xe87268){return db[_0xd3e6('0x28')][_0xd3e6('0x43')]({'where':{'id':_0x49da28[_0xd3e6('0x3e')]['id']}})[_0xd3e6('0x23')](handleEntityNotFound(_0xe87268,null))['then'](removeEntity(_0xe87268,null))[_0xd3e6('0x44')](handleError(_0xe87268,null));};exports[_0xd3e6('0x48')]=function(_0x3370ec,_0x5e392c){return db[_0xd3e6('0x28')][_0xd3e6('0x48')]()[_0xd3e6('0x23')](respondWithResult(_0x5e392c,null))[_0xd3e6('0x44')](handleError(_0x5e392c,null));}; \ No newline at end of file +var _0xe61c=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','count','offset','set','Content-Range','save','update','then','sendStatus','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','MemberReport','includeAll','findAll','rows','show','params','include','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xe61c,0x127));var _0xce61=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0xe61c[_0x54ea7a];return _0x65a10d;};'use strict';var pdf=require(_0xce61('0x0'));var emlformat=require(_0xce61('0x1'));var rimraf=require(_0xce61('0x2'));var zipdir=require(_0xce61('0x3'));var jsonpatch=require(_0xce61('0x4'));var rp=require(_0xce61('0x5'));var moment=require(_0xce61('0x6'));var BPromise=require(_0xce61('0x7'));var Mustache=require(_0xce61('0x8'));var util=require(_0xce61('0x9'));var path=require('path');var sox=require(_0xce61('0xa'));var csv=require(_0xce61('0xb'));var ejs=require(_0xce61('0xc'));var fs=require('fs');var _=require(_0xce61('0xd'));var squel=require(_0xce61('0xe'));var crypto=require(_0xce61('0xf'));var jsforce=require(_0xce61('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xce61('0xb'));var querystring=require(_0xce61('0x11'));var Papa=require(_0xce61('0x12'));var Redis=require('ioredis');var authService=require(_0xce61('0x13'));var qs=require(_0xce61('0x14'));var as=require(_0xce61('0x15'));var hardwareService=require(_0xce61('0x16'));var logger=require(_0xce61('0x17'))(_0xce61('0x18'));var utils=require(_0xce61('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ffcd4,_0x5ee590){_0x5ee590=_0x5ee590||0xcc;return function(_0x2c798f){if(_0x2c798f){return _0x2ffcd4['sendStatus'](_0x5ee590);}return _0x2ffcd4[_0xce61('0x1a')](_0x5ee590)[_0xce61('0x1b')]();};}function respondWithResult(_0x29df5a,_0xa32788){_0xa32788=_0xa32788||0xc8;return function(_0x10bb20){if(_0x10bb20){return _0x29df5a[_0xce61('0x1a')](_0xa32788)[_0xce61('0x1c')](_0x10bb20);}};}function respondWithFilteredResult(_0x194b42,_0x39d8bf){return function(_0x568078){if(_0x568078){var _0x56bda0=_0x568078[_0xce61('0x1d')],_0x204430=_0x39d8bf[_0xce61('0x1e')],_0x3a2740=_0x39d8bf[_0xce61('0x1e')]+_0x39d8bf['limit'],_0x2b0701;if(_0x3a2740>=_0x56bda0){_0x3a2740=_0x56bda0;_0x2b0701=0xc8;}else{_0x2b0701=0xce;}_0x194b42['status'](_0x2b0701);return _0x194b42[_0xce61('0x1f')](_0xce61('0x20'),_0x204430+'-'+_0x3a2740+'/'+_0x56bda0)[_0xce61('0x1c')](_0x568078);}return null;};}function patchUpdates(_0x30635f){return function(_0x5189d4){try{jsonpatch['apply'](_0x5189d4,_0x30635f,!![]);}catch(_0x210d3c){return BPromise['reject'](_0x210d3c);}return _0x5189d4[_0xce61('0x21')]();};}function saveUpdates(_0x14b36e,_0x4a3640){return function(_0x1b78ac){if(_0x1b78ac){return _0x1b78ac[_0xce61('0x22')](_0x14b36e)[_0xce61('0x23')](function(_0x2bd717){return _0x2bd717;});}return null;};}function removeEntity(_0x2c3a10,_0x28ca69){return function(_0x3deeb3){if(_0x3deeb3){return _0x3deeb3['destroy']()[_0xce61('0x23')](function(){_0x2c3a10[_0xce61('0x1a')](0xcc)[_0xce61('0x1b')]();});}};}function handleEntityNotFound(_0x45419d,_0x4ab021){return function(_0x30bcc7){if(!_0x30bcc7){_0x45419d[_0xce61('0x24')](0x194);}return _0x30bcc7;};}function handleError(_0xe88fea,_0x40f3aa){_0x40f3aa=_0x40f3aa||0x1f4;return function(_0x2aa202){logger[_0xce61('0x25')](_0x2aa202['stack']);if(_0x2aa202[_0xce61('0x26')]){delete _0x2aa202[_0xce61('0x26')];}_0xe88fea[_0xce61('0x1a')](_0x40f3aa)[_0xce61('0x27')](_0x2aa202);};}exports['index']=function(_0x439d9e,_0x47fdfb){var _0x44a941={},_0x49a0ae={},_0xed1616={'count':0x0,'rows':[]};var _0x3e0052=_[_0xce61('0x28')](db['MemberReport'][_0xce61('0x29')],function(_0x43633f){return{'name':_0x43633f['fieldName'],'type':_0x43633f[_0xce61('0x2a')][_0xce61('0x2b')]};});_0x49a0ae[_0xce61('0x2c')]=_['map'](_0x3e0052,_0xce61('0x26'));_0x49a0ae[_0xce61('0x2d')]=_[_0xce61('0x2e')](_0x439d9e[_0xce61('0x2d')]);_0x49a0ae[_0xce61('0x2f')]=_[_0xce61('0x30')](_0x49a0ae[_0xce61('0x2c')],_0x49a0ae['query']);_0x44a941[_0xce61('0x31')]=_[_0xce61('0x30')](_0x49a0ae[_0xce61('0x2c')],qs['fields'](_0x439d9e['query'][_0xce61('0x32')]));_0x44a941[_0xce61('0x31')]=_0x44a941[_0xce61('0x31')][_0xce61('0x33')]?_0x44a941[_0xce61('0x31')]:_0x49a0ae[_0xce61('0x2c')];if(!_0x439d9e[_0xce61('0x2d')][_0xce61('0x34')](_0xce61('0x35'))){_0x44a941[_0xce61('0x36')]=qs[_0xce61('0x36')](_0x439d9e[_0xce61('0x2d')]['limit']);_0x44a941[_0xce61('0x1e')]=qs['offset'](_0x439d9e[_0xce61('0x2d')][_0xce61('0x1e')]);}_0x44a941[_0xce61('0x37')]=qs[_0xce61('0x38')](_0x439d9e[_0xce61('0x2d')]['sort']);_0x44a941[_0xce61('0x39')]=qs['filters'](_[_0xce61('0x3a')](_0x439d9e[_0xce61('0x2d')],_0x49a0ae[_0xce61('0x2f')]),_0x3e0052);if(_0x439d9e[_0xce61('0x2d')][_0xce61('0x3b')]){_0x44a941[_0xce61('0x39')]=_[_0xce61('0x3c')](_0x44a941[_0xce61('0x39')],{'$or':_[_0xce61('0x28')](_0x3e0052,function(_0x2da1a5){if(_0x2da1a5[_0xce61('0x2a')]!==_0xce61('0x3d')){var _0x9732fc={};_0x9732fc[_0x2da1a5[_0xce61('0x26')]]={'$like':'%'+_0x439d9e[_0xce61('0x2d')][_0xce61('0x3b')]+'%'};return _0x9732fc;}})});}_0x44a941=_[_0xce61('0x3c')]({},_0x44a941,_0x439d9e[_0xce61('0x3e')]);var _0x5869b5={'where':_0x44a941[_0xce61('0x39')]};return db[_0xce61('0x3f')]['count'](_0x5869b5)[_0xce61('0x23')](function(_0x3d548f){_0xed1616[_0xce61('0x1d')]=_0x3d548f;if(_0x439d9e[_0xce61('0x2d')][_0xce61('0x40')]){_0x44a941['include']=[{'all':!![]}];}return db['MemberReport'][_0xce61('0x41')](_0x44a941);})[_0xce61('0x23')](function(_0x4ea4ce){_0xed1616[_0xce61('0x42')]=_0x4ea4ce;return _0xed1616;})[_0xce61('0x23')](respondWithFilteredResult(_0x47fdfb,_0x44a941))['catch'](handleError(_0x47fdfb,null));};exports[_0xce61('0x43')]=function(_0x10d213,_0x5c5861){var _0x1c2896={'raw':!![],'where':{'id':_0x10d213[_0xce61('0x44')]['id']}},_0x4c049e={};_0x4c049e[_0xce61('0x2c')]=_[_0xce61('0x2e')](db[_0xce61('0x3f')][_0xce61('0x29')]);_0x4c049e[_0xce61('0x2d')]=_[_0xce61('0x2e')](_0x10d213[_0xce61('0x2d')]);_0x4c049e['filters']=_['intersection'](_0x4c049e['model'],_0x4c049e[_0xce61('0x2d')]);_0x1c2896['attributes']=_[_0xce61('0x30')](_0x4c049e[_0xce61('0x2c')],qs['fields'](_0x10d213[_0xce61('0x2d')]['fields']));_0x1c2896[_0xce61('0x31')]=_0x1c2896[_0xce61('0x31')]['length']?_0x1c2896['attributes']:_0x4c049e[_0xce61('0x2c')];if(_0x10d213[_0xce61('0x2d')][_0xce61('0x40')]){_0x1c2896[_0xce61('0x45')]=[{'all':!![]}];}_0x1c2896=_[_0xce61('0x3c')]({},_0x1c2896,_0x10d213[_0xce61('0x3e')]);return db['MemberReport'][_0xce61('0x46')](_0x1c2896)['then'](handleEntityNotFound(_0x5c5861,null))[_0xce61('0x23')](respondWithResult(_0x5c5861,null))[_0xce61('0x47')](handleError(_0x5c5861,null));};exports[_0xce61('0x48')]=function(_0x3d7b11,_0xc5338c){return db[_0xce61('0x3f')][_0xce61('0x48')](_0x3d7b11[_0xce61('0x49')],{})[_0xce61('0x23')](respondWithResult(_0xc5338c,0xc9))[_0xce61('0x47')](handleError(_0xc5338c,null));};exports['update']=function(_0xcfe2e0,_0x302f76){if(_0xcfe2e0['body']['id']){delete _0xcfe2e0[_0xce61('0x49')]['id'];}return db[_0xce61('0x3f')][_0xce61('0x46')]({'where':{'id':_0xcfe2e0[_0xce61('0x44')]['id']}})[_0xce61('0x23')](handleEntityNotFound(_0x302f76,null))[_0xce61('0x23')](saveUpdates(_0xcfe2e0[_0xce61('0x49')],null))[_0xce61('0x23')](respondWithResult(_0x302f76,null))['catch'](handleError(_0x302f76,null));};exports[_0xce61('0x4a')]=function(_0x3ac5c1,_0x25a736){return db[_0xce61('0x3f')][_0xce61('0x46')]({'where':{'id':_0x3ac5c1[_0xce61('0x44')]['id']}})['then'](handleEntityNotFound(_0x25a736,null))['then'](removeEntity(_0x25a736,null))[_0xce61('0x47')](handleError(_0x25a736,null));};exports[_0xce61('0x4b')]=function(_0x4a811b,_0xee7b51){return db[_0xce61('0x3f')]['describe']()[_0xce61('0x23')](respondWithResult(_0xee7b51,null))[_0xce61('0x47')](handleError(_0xee7b51,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index c2e8837..3ca938a 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 _0x24ca=['request-promise','path','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','api','bluebird'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0x24ca,0x8c));var _0xa24c=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x24ca[_0x355ce8];return _0x1db8b8;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa24c('0x1'));var moment=require('moment');var BPromise=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var fs=require('fs');var path=require(_0xa24c('0x4'));var rimraf=require('rimraf');var config=require(_0xa24c('0x5'));var attributes=require(_0xa24c('0x6'));module[_0xa24c('0x7')]=function(_0x5a37ae,_0x5377ed){return _0x5a37ae['define'](_0xa24c('0x8'),attributes,{'tableName':_0xa24c('0x9'),'paranoid':![],'indexes':[{'name':_0xa24c('0xa'),'fields':[_0xa24c('0xb'),_0xa24c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac31=['request-promise','rimraf','../../config/environment','define','MemberReport','report_member','membername','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4563cc,_0x48ec74){var _0x2c0bd1=function(_0x5d1359){while(--_0x5d1359){_0x4563cc['push'](_0x4563cc['shift']());}};_0x2c0bd1(++_0x48ec74);}(_0xac31,0xca));var _0x1ac3=function(_0x52973d,_0xfb612f){_0x52973d=_0x52973d-0x0;var _0x1feec0=_0xac31[_0x52973d];return _0x1feec0;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./memberReport.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x1ac3('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ea673dc..af9b63f 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 _0x93e9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','model','attributes','map','create','body','CreateMemberReport','UpdateMemberReport','util','moment','bluebird','randomstring'];(function(_0x33f6a9,_0x5e195c){var _0x36df01=function(_0x2225d9){while(--_0x2225d9){_0x33f6a9['push'](_0x33f6a9['shift']());}};_0x36df01(++_0x5e195c);}(_0x93e9,0x152));var _0x993e=function(_0x38ce02,_0x2cd026){_0x38ce02=_0x38ce02-0x0;var _0x43d1f2=_0x93e9[_0x38ce02];return _0x43d1f2;};'use strict';var _=require('lodash');var util=require(_0x993e('0x0'));var moment=require(_0x993e('0x1'));var BPromise=require(_0x993e('0x2'));var rs=require(_0x993e('0x3'));var fs=require('fs');var Redis=require(_0x993e('0x4'));var db=require(_0x993e('0x5'))['db'];var utils=require(_0x993e('0x6'));var logger=require(_0x993e('0x7'))(_0x993e('0x8'));var config=require('../../config/environment');var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9a9ec4,_0x3be3cb,_0x2fa4ce){return new BPromise(function(_0x40cc7e,_0x632f0a){return client['request'](_0x9a9ec4,_0x2fa4ce)[_0x993e('0xc')](function(_0x4c11a8){logger['info'](_0x993e('0xd'),_0x3be3cb,_0x993e('0xe'));logger[_0x993e('0xf')](_0x993e('0x10'),_0x3be3cb,_0x993e('0xe'),JSON[_0x993e('0x11')](_0x4c11a8));if(_0x4c11a8['error']){if(_0x4c11a8[_0x993e('0x12')][_0x993e('0x13')]===0x1f4){logger['error'](_0x993e('0xd'),_0x3be3cb,_0x4c11a8[_0x993e('0x12')]['message']);return _0x632f0a(_0x4c11a8[_0x993e('0x12')][_0x993e('0x14')]);}logger['error'](_0x993e('0xd'),_0x3be3cb,_0x4c11a8['error'][_0x993e('0x14')]);return _0x40cc7e(_0x4c11a8[_0x993e('0x12')]['message']);}else{logger[_0x993e('0x15')](_0x993e('0xd'),_0x3be3cb,_0x993e('0xe'));_0x40cc7e(_0x4c11a8['result']['message']);}})[_0x993e('0x16')](function(_0x1c5f63){logger[_0x993e('0x12')](_0x993e('0xd'),_0x3be3cb,_0x1c5f63);_0x632f0a(_0x1c5f63);});});}exports[_0x993e('0x17')]=function(_0x11588f){var _0x14e146=this;return new Promise(function(_0x78284d,_0x2619ac){return db[_0x993e('0x18')][_0x993e('0x19')]({'raw':_0x11588f['options']?_0x11588f[_0x993e('0x1a')][_0x993e('0x1b')]===undefined?!![]:![]:!![],'where':_0x11588f[_0x993e('0x1a')]?_0x11588f[_0x993e('0x1a')][_0x993e('0x1c')]||null:null,'attributes':_0x11588f[_0x993e('0x1a')]?_0x11588f[_0x993e('0x1a')]['attributes']||null:null,'limit':_0x11588f[_0x993e('0x1a')]?_0x11588f['options'][_0x993e('0x1d')]||null:null,'include':_0x11588f[_0x993e('0x1a')]?_0x11588f[_0x993e('0x1a')][_0x993e('0x1e')]?_['map'](_0x11588f['options'][_0x993e('0x1e')],function(_0x2d8595){return{'model':db[_0x2d8595[_0x993e('0x1f')]],'as':_0x2d8595['as'],'attributes':_0x2d8595[_0x993e('0x20')],'include':_0x2d8595[_0x993e('0x1e')]?_[_0x993e('0x21')](_0x2d8595['include'],function(_0x2b8800){return{'model':db[_0x2b8800[_0x993e('0x1f')]],'as':_0x2b8800['as'],'attributes':_0x2b8800['attributes'],'include':_0x2b8800[_0x993e('0x1e')]?_[_0x993e('0x21')](_0x2b8800['include'],function(_0x91d582){return{'model':db[_0x91d582[_0x993e('0x1f')]],'as':_0x91d582['as'],'attributes':_0x91d582[_0x993e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x993e('0xc')](function(_0x1f9ea7){logger[_0x993e('0x15')]('GetMemberReport',_0x11588f);logger[_0x993e('0xf')](_0x993e('0x17'),_0x11588f,JSON['stringify'](_0x1f9ea7));_0x78284d(_0x1f9ea7);})[_0x993e('0x16')](function(_0x4b6f50){logger[_0x993e('0x12')](_0x993e('0x17'),_0x4b6f50['message'],_0x11588f);_0x2619ac(_0x14e146['error'](0x1f4,_0x4b6f50[_0x993e('0x14')]));});});};exports['CreateMemberReport']=function(_0x598c93){var _0x5a5309=this;return new Promise(function(_0x5b259a,_0x49f953){return db[_0x993e('0x18')][_0x993e('0x22')](_0x598c93[_0x993e('0x23')],{'raw':_0x598c93[_0x993e('0x1a')]?_0x598c93[_0x993e('0x1a')][_0x993e('0x1b')]===undefined?!![]:![]:!![]})[_0x993e('0xc')](function(_0x5eea33){logger['info'](_0x993e('0x24'),_0x598c93);logger[_0x993e('0xf')](_0x993e('0x24'),_0x598c93,JSON[_0x993e('0x11')](_0x5eea33));_0x5b259a(_0x5eea33);})['catch'](function(_0x59cef1){logger[_0x993e('0x12')](_0x993e('0x24'),_0x59cef1[_0x993e('0x14')],_0x598c93);_0x49f953(_0x5a5309[_0x993e('0x12')](0x1f4,_0x59cef1[_0x993e('0x14')]));});});};exports[_0x993e('0x25')]=function(_0x2eb293){var _0x3c7451=this;return new Promise(function(_0xf6935b,_0x2bfce9){return db[_0x993e('0x18')]['update'](_0x2eb293[_0x993e('0x23')],{'raw':_0x2eb293[_0x993e('0x1a')]?_0x2eb293[_0x993e('0x1a')][_0x993e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eb293[_0x993e('0x1a')]?_0x2eb293[_0x993e('0x1a')][_0x993e('0x1c')]||null:null,'attributes':_0x2eb293['options']?_0x2eb293[_0x993e('0x1a')][_0x993e('0x20')]||null:null,'limit':_0x2eb293[_0x993e('0x1a')]?_0x2eb293[_0x993e('0x1a')]['limit']||null:null})['then'](function(_0x2f4f99){logger[_0x993e('0x15')](_0x993e('0x25'),_0x2eb293);logger[_0x993e('0xf')]('UpdateMemberReport',_0x2eb293,JSON['stringify'](_0x2f4f99));_0xf6935b(_0x2f4f99);})[_0x993e('0x16')](function(_0xbaab95){logger[_0x993e('0x12')](_0x993e('0x25'),_0xbaab95[_0x993e('0x14')],_0x2eb293);_0x2bfce9(_0x3c7451[_0x993e('0x12')](0x1f4,_0xbaab95[_0x993e('0x14')]));});});}; \ No newline at end of file +var _0x17d5=['debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','map','model','body','CreateMemberReport','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x17d5,0x197));var _0x517d=function(_0x3105be,_0x3dc57a){_0x3105be=_0x3105be-0x0;var _0x46c446=_0x17d5[_0x3105be];return _0x46c446;};'use strict';var _=require('lodash');var util=require(_0x517d('0x0'));var moment=require(_0x517d('0x1'));var BPromise=require(_0x517d('0x2'));var rs=require(_0x517d('0x3'));var fs=require('fs');var Redis=require(_0x517d('0x4'));var db=require(_0x517d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x517d('0x6'));var jayson=require(_0x517d('0x7'));var client=jayson[_0x517d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18ae1f,_0x4b2d6b,_0x28281a){return new BPromise(function(_0x544515,_0x3f7e40){return client[_0x517d('0x9')](_0x18ae1f,_0x28281a)[_0x517d('0xa')](function(_0x5577e2){logger['info'](_0x517d('0xb'),_0x4b2d6b,_0x517d('0xc'));logger[_0x517d('0xd')](_0x517d('0xe'),_0x4b2d6b,_0x517d('0xc'),JSON[_0x517d('0xf')](_0x5577e2));if(_0x5577e2[_0x517d('0x10')]){if(_0x5577e2[_0x517d('0x10')][_0x517d('0x11')]===0x1f4){logger[_0x517d('0x10')](_0x517d('0xb'),_0x4b2d6b,_0x5577e2[_0x517d('0x10')][_0x517d('0x12')]);return _0x3f7e40(_0x5577e2['error'][_0x517d('0x12')]);}logger[_0x517d('0x10')](_0x517d('0xb'),_0x4b2d6b,_0x5577e2[_0x517d('0x10')]['message']);return _0x544515(_0x5577e2['error']['message']);}else{logger[_0x517d('0x13')]('MemberReport,\x20%s,\x20%s',_0x4b2d6b,_0x517d('0xc'));_0x544515(_0x5577e2['result']['message']);}})[_0x517d('0x14')](function(_0x5cb068){logger['error'](_0x517d('0xb'),_0x4b2d6b,_0x5cb068);_0x3f7e40(_0x5cb068);});});}exports[_0x517d('0x15')]=function(_0x9af520){var _0x105210=this;return new Promise(function(_0x3836c0,_0x3f4059){return db[_0x517d('0x16')]['findAll']({'raw':_0x9af520[_0x517d('0x17')]?_0x9af520[_0x517d('0x17')][_0x517d('0x18')]===undefined?!![]:![]:!![],'where':_0x9af520[_0x517d('0x17')]?_0x9af520[_0x517d('0x17')][_0x517d('0x19')]||null:null,'attributes':_0x9af520[_0x517d('0x17')]?_0x9af520['options'][_0x517d('0x1a')]||null:null,'limit':_0x9af520['options']?_0x9af520['options'][_0x517d('0x1b')]||null:null,'include':_0x9af520[_0x517d('0x17')]?_0x9af520['options'][_0x517d('0x1c')]?_[_0x517d('0x1d')](_0x9af520[_0x517d('0x17')][_0x517d('0x1c')],function(_0x150718){return{'model':db[_0x150718[_0x517d('0x1e')]],'as':_0x150718['as'],'attributes':_0x150718[_0x517d('0x1a')],'include':_0x150718[_0x517d('0x1c')]?_[_0x517d('0x1d')](_0x150718[_0x517d('0x1c')],function(_0x2f28cb){return{'model':db[_0x2f28cb[_0x517d('0x1e')]],'as':_0x2f28cb['as'],'attributes':_0x2f28cb[_0x517d('0x1a')],'include':_0x2f28cb[_0x517d('0x1c')]?_[_0x517d('0x1d')](_0x2f28cb[_0x517d('0x1c')],function(_0x2005d4){return{'model':db[_0x2005d4[_0x517d('0x1e')]],'as':_0x2005d4['as'],'attributes':_0x2005d4[_0x517d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x517d('0xa')](function(_0x1e5d4a){logger['info'](_0x517d('0x15'),_0x9af520);logger[_0x517d('0xd')](_0x517d('0x15'),_0x9af520,JSON[_0x517d('0xf')](_0x1e5d4a));_0x3836c0(_0x1e5d4a);})[_0x517d('0x14')](function(_0x3e8209){logger[_0x517d('0x10')]('GetMemberReport',_0x3e8209[_0x517d('0x12')],_0x9af520);_0x3f4059(_0x105210[_0x517d('0x10')](0x1f4,_0x3e8209[_0x517d('0x12')]));});});};exports['CreateMemberReport']=function(_0xca317e){var _0x379e6f=this;return new Promise(function(_0x5bb830,_0x1dd4bd){return db['MemberReport']['create'](_0xca317e[_0x517d('0x1f')],{'raw':_0xca317e[_0x517d('0x17')]?_0xca317e['options']['raw']===undefined?!![]:![]:!![]})[_0x517d('0xa')](function(_0x9107ce){logger[_0x517d('0x13')](_0x517d('0x20'),_0xca317e);logger['debug'](_0x517d('0x20'),_0xca317e,JSON[_0x517d('0xf')](_0x9107ce));_0x5bb830(_0x9107ce);})[_0x517d('0x14')](function(_0x4c7673){logger['error'](_0x517d('0x20'),_0x4c7673[_0x517d('0x12')],_0xca317e);_0x1dd4bd(_0x379e6f[_0x517d('0x10')](0x1f4,_0x4c7673[_0x517d('0x12')]));});});};exports[_0x517d('0x21')]=function(_0x3be329){var _0x4d99b6=this;return new Promise(function(_0x178967,_0x1dbf82){return db[_0x517d('0x16')][_0x517d('0x22')](_0x3be329['body'],{'raw':_0x3be329[_0x517d('0x17')]?_0x3be329[_0x517d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3be329[_0x517d('0x17')]?_0x3be329['options'][_0x517d('0x19')]||null:null,'attributes':_0x3be329[_0x517d('0x17')]?_0x3be329[_0x517d('0x17')][_0x517d('0x1a')]||null:null,'limit':_0x3be329[_0x517d('0x17')]?_0x3be329['options'][_0x517d('0x1b')]||null:null})['then'](function(_0x1ef0c3){logger['info']('UpdateMemberReport',_0x3be329);logger[_0x517d('0xd')](_0x517d('0x21'),_0x3be329,JSON[_0x517d('0xf')](_0x1ef0c3));_0x178967(_0x1ef0c3);})['catch'](function(_0x9fd4ef){logger[_0x517d('0x10')]('UpdateMemberReport',_0x9fd4ef[_0x517d('0x12')],_0x3be329);_0x1dbf82(_0x4d99b6[_0x517d('0x10')](0x1f4,_0x9fd4ef['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 666d15a..c0f339f 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 _0x04b8=['index','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x144c51,_0x9327f0){var _0x24653f=function(_0x26ee50){while(--_0x26ee50){_0x144c51['push'](_0x144c51['shift']());}};_0x24653f(++_0x9327f0);}(_0x04b8,0x159));var _0x804b=function(_0x511f54,_0x1d891c){_0x511f54=_0x511f54-0x0;var _0x236bb=_0x04b8[_0x511f54];return _0x236bb;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var auth=require(_0x804b('0x3'));var interaction=require(_0x804b('0x4'));var config=require('../../config/environment');var controller=require(_0x804b('0x5'));router[_0x804b('0x6')]('/',controller[_0x804b('0x7')]);module['exports']=router; \ No newline at end of file +var _0x02ce=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x2c098a,_0xeab65c){var _0x2b2d0a=function(_0x176afb){while(--_0x176afb){_0x2c098a['push'](_0x2c098a['shift']());}};_0x2b2d0a(++_0xeab65c);}(_0x02ce,0x1ac));var _0xe02c=function(_0x478027,_0x2893f1){_0x478027=_0x478027-0x0;var _0x3f91a2=_0x02ce[_0x478027];return _0x3f91a2;};'use strict';var multer=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var path=require(_0xe02c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe02c('0x3'));var router=express['Router']();var auth=require(_0xe02c('0x4'));var interaction=require(_0xe02c('0x5'));var config=require(_0xe02c('0x6'));var controller=require(_0xe02c('0x7'));router[_0xe02c('0x8')]('/',controller[_0xe02c('0x9')]);module[_0xe02c('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 66f1e20..5df53db 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 _0xe4fc=['version','sequelize','exports','STRING'];(function(_0xd6f949,_0xb329b9){var _0x2cb800=function(_0x53efec){while(--_0x53efec){_0xd6f949['push'](_0xd6f949['shift']());}};_0x2cb800(++_0xb329b9);}(_0xe4fc,0xa1));var _0xce4f=function(_0x14d827,_0xe04570){_0x14d827=_0x14d827-0x0;var _0x3046d9=_0xe4fc[_0x14d827];return _0x3046d9;};'use strict';var Sequelize=require(_0xce4f('0x0'));module[_0xce4f('0x1')]={'version':{'type':Sequelize[_0xce4f('0x2')],'unique':_0xce4f('0x3')}}; \ No newline at end of file +var _0x94ff=['STRING','version','sequelize','exports'];(function(_0x4ba010,_0x5d3553){var _0xfcdb23=function(_0x3fd8f6){while(--_0x3fd8f6){_0x4ba010['push'](_0x4ba010['shift']());}};_0xfcdb23(++_0x5d3553);}(_0x94ff,0x86));var _0xf94f=function(_0xcbdce8,_0x241844){_0xcbdce8=_0xcbdce8-0x0;var _0x3f9817=_0x94ff[_0xcbdce8];return _0x3f9817;};'use strict';var Sequelize=require(_0xf94f('0x0'));module[_0xf94f('0x1')]={'version':{'type':Sequelize[_0xf94f('0x2')],'unique':_0xf94f('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index c688724..4fd6ac0 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 _0xf4eb=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','html-pdf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','Migration','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes'];(function(_0x1e7865,_0xb1c46f){var _0x4e5336=function(_0xcab4b8){while(--_0xcab4b8){_0x1e7865['push'](_0x1e7865['shift']());}};_0x4e5336(++_0xb1c46f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x382e5c,_0x32bbb7){_0x382e5c=_0x382e5c-0x0;var _0x28e5c4=_0xf4eb[_0x382e5c];return _0x28e5c4;};'use strict';var pdf=require(_0xbf4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4e('0x2'));var util=require(_0xbf4e('0x3'));var path=require(_0xbf4e('0x4'));var sox=require(_0xbf4e('0x5'));var csv=require(_0xbf4e('0x6'));var ejs=require(_0xbf4e('0x7'));var fs=require('fs');var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x6'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var db=require(_0xbf4e('0x12'))['db'];function respondWithStatusCode(_0x54a96e,_0x17fd01){_0x17fd01=_0x17fd01||0xcc;return function(_0x5a3035){if(_0x5a3035){return _0x54a96e['sendStatus'](_0x17fd01);}return _0x54a96e[_0xbf4e('0x13')](_0x17fd01)[_0xbf4e('0x14')]();};}function respondWithResult(_0x1e029b,_0x302841){_0x302841=_0x302841||0xc8;return function(_0x3b74bd){if(_0x3b74bd){return _0x1e029b[_0xbf4e('0x13')](_0x302841)['json'](_0x3b74bd);}};}function respondWithFilteredResult(_0x59fb15,_0x180432){return function(_0x1735ae){if(_0x1735ae){var _0x28fc6b=_0x1735ae[_0xbf4e('0x15')],_0x542909=_0x180432[_0xbf4e('0x16')],_0x14110b=_0x180432['offset']+_0x180432[_0xbf4e('0x17')],_0x2c292c;if(_0x14110b>=_0x28fc6b){_0x14110b=_0x28fc6b;_0x2c292c=0xc8;}else{_0x2c292c=0xce;}_0x59fb15['status'](_0x2c292c);return _0x59fb15['set']('Content-Range',_0x542909+'-'+_0x14110b+'/'+_0x28fc6b)['json'](_0x1735ae);}return null;};}function patchUpdates(_0x35992b){return function(_0x1ca73c){try{jsonpatch[_0xbf4e('0x18')](_0x1ca73c,_0x35992b,!![]);}catch(_0x4d9c2a){return BPromise['reject'](_0x4d9c2a);}return _0x1ca73c[_0xbf4e('0x19')]();};}function saveUpdates(_0x9a46ee,_0x3be138){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b[_0xbf4e('0x1a')](_0x9a46ee)[_0xbf4e('0x1b')](function(_0x415963){return _0x415963;});}return null;};}function removeEntity(_0x3d642a,_0xd09e12){return function(_0x376832){if(_0x376832){return _0x376832[_0xbf4e('0x1c')]()['then'](function(){_0x3d642a[_0xbf4e('0x13')](0xcc)[_0xbf4e('0x14')]();});}};}function handleEntityNotFound(_0x51648c,_0x31e3f5){return function(_0x30994d){if(!_0x30994d){_0x51648c[_0xbf4e('0x1d')](0x194);}return _0x30994d;};}function handleError(_0x1bda8b,_0x3a5d72){_0x3a5d72=_0x3a5d72||0x1f4;return function(_0x4a0243){logger[_0xbf4e('0x1e')](_0x4a0243[_0xbf4e('0x1f')]);if(_0x4a0243[_0xbf4e('0x20')]){delete _0x4a0243['name'];}_0x1bda8b[_0xbf4e('0x13')](_0x3a5d72)['send'](_0x4a0243);};}exports['index']=function(_0x2bfccf,_0x5a0a9b){var _0x38c923={},_0x315df3={},_0x4021a9={'count':0x0,'rows':[]};var _0x41f918=_['map'](db[_0xbf4e('0x21')][_0xbf4e('0x22')],function(_0x43879d){return{'name':_0x43879d['fieldName'],'type':_0x43879d[_0xbf4e('0x23')]['key']};});_0x315df3[_0xbf4e('0x24')]=_[_0xbf4e('0x25')](_0x41f918,_0xbf4e('0x20'));_0x315df3['query']=_[_0xbf4e('0x26')](_0x2bfccf[_0xbf4e('0x27')]);_0x315df3[_0xbf4e('0x28')]=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],_0x315df3[_0xbf4e('0x27')]);_0x38c923['attributes']=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],qs['fields'](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2a')]));_0x38c923['attributes']=_0x38c923[_0xbf4e('0x2b')]['length']?_0x38c923[_0xbf4e('0x2b')]:_0x315df3['model'];if(!_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2c')](_0xbf4e('0x2d'))){_0x38c923['limit']=qs[_0xbf4e('0x17')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x17')]);_0x38c923[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0x2bfccf[_0xbf4e('0x27')]['offset']);}_0x38c923[_0xbf4e('0x2e')]=qs[_0xbf4e('0x2f')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2f')]);_0x38c923[_0xbf4e('0x30')]=qs['filters'](_['pick'](_0x2bfccf['query'],_0x315df3['filters']),_0x41f918);if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]){_0x38c923[_0xbf4e('0x30')]=_[_0xbf4e('0x32')](_0x38c923[_0xbf4e('0x30')],{'$or':_[_0xbf4e('0x25')](_0x41f918,function(_0x355b42){if(_0x355b42[_0xbf4e('0x23')]!==_0xbf4e('0x33')){var _0x54527d={};_0x54527d[_0x355b42['name']]={'$like':'%'+_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]+'%'};return _0x54527d;}})});}_0x38c923=_[_0xbf4e('0x32')]({},_0x38c923,_0x2bfccf['options']);var _0x3f46f1={'where':_0x38c923['where']};return db[_0xbf4e('0x21')][_0xbf4e('0x15')](_0x3f46f1)[_0xbf4e('0x1b')](function(_0xb30f90){_0x4021a9['count']=_0xb30f90;if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x34')]){_0x38c923[_0xbf4e('0x35')]=[{'all':!![]}];}return db[_0xbf4e('0x21')]['findAll'](_0x38c923);})[_0xbf4e('0x1b')](function(_0x44e96b){_0x4021a9[_0xbf4e('0x36')]=_0x44e96b;return _0x4021a9;})[_0xbf4e('0x1b')](respondWithFilteredResult(_0x5a0a9b,_0x38c923))[_0xbf4e('0x37')](handleError(_0x5a0a9b,null));}; \ No newline at end of file +var _0x70e0=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','Migration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce'];(function(_0x3ecf95,_0x559a2c){var _0x3f1e72=function(_0x4160c0){while(--_0x4160c0){_0x3ecf95['push'](_0x3ecf95['shift']());}};_0x3f1e72(++_0x559a2c);}(_0x70e0,0x17b));var _0x070e=function(_0x993c5d,_0x135cf5){_0x993c5d=_0x993c5d-0x0;var _0x49760f=_0x70e0[_0x993c5d];return _0x49760f;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ae5db0b..34ac5e4 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 _0xd01f=['exports','define','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./migration.attributes'];(function(_0x44b863,_0x254828){var _0x257bcb=function(_0x452f0e){while(--_0x452f0e){_0x44b863['push'](_0x44b863['shift']());}};_0x257bcb(++_0x254828);}(_0xd01f,0x1d6));var _0xfd01=function(_0x7b261e,_0x32331c){_0x7b261e=_0x7b261e-0x0;var _0x55ab59=_0xd01f[_0x7b261e];return _0x55ab59;};'use strict';var _=require(_0xfd01('0x0'));var util=require('util');var logger=require(_0xfd01('0x1'))('api');var moment=require(_0xfd01('0x2'));var BPromise=require(_0xfd01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd01('0x4'));var rimraf=require('rimraf');var config=require(_0xfd01('0x5'));var attributes=require(_0xfd01('0x6'));module[_0xfd01('0x7')]=function(_0x570282,_0x145ebb){return _0x570282[_0xfd01('0x8')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12c9=['lodash','../../config/logger','api','moment','path','rimraf','./migration.attributes','exports','define','Migration'];(function(_0x3062cb,_0x44ca12){var _0xf29731=function(_0x11fc4b){while(--_0x11fc4b){_0x3062cb['push'](_0x3062cb['shift']());}};_0xf29731(++_0x44ca12);}(_0x12c9,0x10e));var _0x912c=function(_0x19589a,_0x3e3425){_0x19589a=_0x19589a-0x0;var _0x2dd263=_0x12c9[_0x19589a];return _0x2dd263;};'use strict';var _=require(_0x912c('0x0'));var util=require('util');var logger=require(_0x912c('0x1'))(_0x912c('0x2'));var moment=require(_0x912c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x912c('0x4'));var rimraf=require(_0x912c('0x5'));var config=require('../../config/environment');var attributes=require(_0x912c('0x6'));module[_0x912c('0x7')]=function(_0x51a277,_0x3c595c){return _0x51a277[_0x912c('0x8')](_0x912c('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 361d1bb..6ac2d39 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 _0x5ba3=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','Migration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5ba3,0x140));var _0x35ba=function(_0x20b7d1,_0x1f24eb){_0x20b7d1=_0x20b7d1-0x0;var _0x5a4a84=_0x5ba3[_0x20b7d1];return _0x5a4a84;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var moment=require(_0x35ba('0x1'));var BPromise=require(_0x35ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ba('0x3'));var db=require(_0x35ba('0x4'))['db'];var utils=require(_0x35ba('0x5'));var logger=require('../../config/logger')(_0x35ba('0x6'));var config=require(_0x35ba('0x7'));var jayson=require(_0x35ba('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20cd5f,_0x3264d3,_0x380ffb){return new BPromise(function(_0x4c55f3,_0x22bed8){return client['request'](_0x20cd5f,_0x380ffb)[_0x35ba('0x9')](function(_0x366ddc){logger[_0x35ba('0xa')](_0x35ba('0xb'),_0x3264d3,'request\x20sent');logger[_0x35ba('0xc')]('Migration,\x20%s,\x20%s,\x20%s',_0x3264d3,'request\x20sent',JSON['stringify'](_0x366ddc));if(_0x366ddc[_0x35ba('0xd')]){if(_0x366ddc[_0x35ba('0xd')][_0x35ba('0xe')]===0x1f4){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x22bed8(_0x366ddc[_0x35ba('0xd')]['message']);}logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x4c55f3(_0x366ddc['error'][_0x35ba('0xf')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x3264d3,_0x35ba('0x10'));_0x4c55f3(_0x366ddc[_0x35ba('0x11')]['message']);}})[_0x35ba('0x12')](function(_0x2b6b71){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x2b6b71);_0x22bed8(_0x2b6b71);});});} \ No newline at end of file +var _0xbb27=['../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5f44c5,_0x17ca95){var _0x2b3397=function(_0x66f36e){while(--_0x66f36e){_0x5f44c5['push'](_0x5f44c5['shift']());}};_0x2b3397(++_0x17ca95);}(_0xbb27,0xf6));var _0x7bb2=function(_0x3782f1,_0xdb9da7){_0x3782f1=_0x3782f1-0x0;var _0x59aa2c=_0xbb27[_0x3782f1];return _0x59aa2c;};'use strict';var _=require(_0x7bb2('0x0'));var util=require(_0x7bb2('0x1'));var moment=require('moment');var BPromise=require(_0x7bb2('0x2'));var rs=require(_0x7bb2('0x3'));var fs=require('fs');var Redis=require(_0x7bb2('0x4'));var db=require(_0x7bb2('0x5'))['db'];var utils=require(_0x7bb2('0x6'));var logger=require(_0x7bb2('0x7'))(_0x7bb2('0x8'));var config=require('../../config/environment');var jayson=require(_0x7bb2('0x9'));var client=jayson['client'][_0x7bb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48c160,_0x189da4,_0x3a0f2d){return new BPromise(function(_0x41e24d,_0x37d401){return client['request'](_0x48c160,_0x3a0f2d)[_0x7bb2('0xb')](function(_0xa3887e){logger[_0x7bb2('0xc')](_0x7bb2('0xd'),_0x189da4,'request\x20sent');logger[_0x7bb2('0xe')](_0x7bb2('0xf'),_0x189da4,'request\x20sent',JSON[_0x7bb2('0x10')](_0xa3887e));if(_0xa3887e[_0x7bb2('0x11')]){if(_0xa3887e['error']['code']===0x1f4){logger[_0x7bb2('0x11')]('Migration,\x20%s,\x20%s',_0x189da4,_0xa3887e[_0x7bb2('0x11')][_0x7bb2('0x12')]);return _0x37d401(_0xa3887e[_0x7bb2('0x11')][_0x7bb2('0x12')]);}logger[_0x7bb2('0x11')]('Migration,\x20%s,\x20%s',_0x189da4,_0xa3887e[_0x7bb2('0x11')][_0x7bb2('0x12')]);return _0x41e24d(_0xa3887e[_0x7bb2('0x11')][_0x7bb2('0x12')]);}else{logger[_0x7bb2('0xc')]('Migration,\x20%s,\x20%s',_0x189da4,_0x7bb2('0x13'));_0x41e24d(_0xa3887e['result'][_0x7bb2('0x12')]);}})[_0x7bb2('0x14')](function(_0x1caa6a){logger[_0x7bb2('0x11')](_0x7bb2('0xd'),_0x189da4,_0x1caa6a);_0x37d401(_0x1caa6a);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 04bbd5c..b2b34db 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 _0x3e6d=['delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e6d,0xdf));var _0xd3e6=function(_0x50c453,_0x3daa12){_0x50c453=_0x50c453-0x0;var _0x51f8e9=_0x3e6d[_0x50c453];return _0x51f8e9;};'use strict';var multer=require(_0xd3e6('0x0'));var util=require(_0xd3e6('0x1'));var path=require(_0xd3e6('0x2'));var timeout=require(_0xd3e6('0x3'));var express=require(_0xd3e6('0x4'));var router=express['Router']();var auth=require(_0xd3e6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3e6('0x6'));router[_0xd3e6('0x7')]('/',auth[_0xd3e6('0x8')](),controller[_0xd3e6('0x9')]);router[_0xd3e6('0x7')](_0xd3e6('0xa'),auth[_0xd3e6('0x8')](),controller[_0xd3e6('0xb')]);router[_0xd3e6('0xc')]('/',auth[_0xd3e6('0x8')](),controller[_0xd3e6('0xd')]);router['put'](_0xd3e6('0xa'),auth[_0xd3e6('0x8')](),controller[_0xd3e6('0xe')]);router[_0xd3e6('0xf')](_0xd3e6('0xa'),auth[_0xd3e6('0x8')](),controller['destroy']);module[_0xd3e6('0x10')]=router; \ No newline at end of file +var _0xdfc5=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x43d0a0,_0x2ffc23){var _0x369f2f=function(_0x1b2c87){while(--_0x1b2c87){_0x43d0a0['push'](_0x43d0a0['shift']());}};_0x369f2f(++_0x2ffc23);}(_0xdfc5,0x13d));var _0x5dfc=function(_0x4d89e2,_0xcfaa82){_0x4d89e2=_0x4d89e2-0x0;var _0x440ac1=_0xdfc5[_0x4d89e2];return _0x440ac1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5dfc('0x0'));var express=require(_0x5dfc('0x1'));var router=express[_0x5dfc('0x2')]();var auth=require(_0x5dfc('0x3'));var interaction=require(_0x5dfc('0x4'));var config=require(_0x5dfc('0x5'));var controller=require(_0x5dfc('0x6'));router[_0x5dfc('0x7')]('/',auth[_0x5dfc('0x8')](),controller[_0x5dfc('0x9')]);router[_0x5dfc('0x7')](_0x5dfc('0xa'),auth[_0x5dfc('0x8')](),controller[_0x5dfc('0xb')]);router['post']('/',auth[_0x5dfc('0x8')](),controller[_0x5dfc('0xc')]);router[_0x5dfc('0xd')](_0x5dfc('0xa'),auth['isAuthenticated'](),controller[_0x5dfc('0xe')]);router[_0x5dfc('0xf')]('/:id',auth[_0x5dfc('0x8')](),controller[_0x5dfc('0x10')]);module[_0x5dfc('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 8031a50..6071072 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(_0x2da521,_0x500b3d){var _0x68a10a=function(_0x1f4f50){while(--_0x1f4f50){_0x2da521['push'](_0x2da521['shift']());}};_0x68a10a(++_0x500b3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x22bbcc,_0x26593e){var _0x56cc53=function(_0x4c5976){while(--_0x4c5976){_0x22bbcc['push'](_0x22bbcc['shift']());}};_0x56cc53(++_0x26593e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b2c18e7..c6100b3 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 _0x6d4f=['rawAttributes','find','create','sequelize','transaction','body','findAll','STUN','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','params','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','Network','fieldName','type','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x6d4f,0xee));var _0xf6d4=function(_0xb9fe33,_0x47a545){_0xb9fe33=_0xb9fe33-0x0;var _0x15f7c2=_0x6d4f[_0xb9fe33];return _0x15f7c2;};'use strict';var pdf=require(_0xf6d4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6d4('0x1'));var rp=require(_0xf6d4('0x2'));var moment=require(_0xf6d4('0x3'));var BPromise=require(_0xf6d4('0x4'));var Mustache=require(_0xf6d4('0x5'));var util=require(_0xf6d4('0x6'));var path=require(_0xf6d4('0x7'));var sox=require(_0xf6d4('0x8'));var csv=require(_0xf6d4('0x9'));var ejs=require(_0xf6d4('0xa'));var fs=require('fs');var _=require(_0xf6d4('0xb'));var squel=require(_0xf6d4('0xc'));var crypto=require(_0xf6d4('0xd'));var jsforce=require(_0xf6d4('0xe'));var deskjs=require(_0xf6d4('0xf'));var toCsv=require(_0xf6d4('0x9'));var querystring=require('querystring');var Papa=require(_0xf6d4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf6d4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf6d4('0x12'));var config=require(_0xf6d4('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf6d4('0x14'));var client=jayson[_0xf6d4('0x15')][_0xf6d4('0x16')]({'port':0x232a});function checkPasswordPattern(_0x2e5a37,_0x2a3036,_0x355e38){if(_0x355e38){var _0x525c76=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x525c76['test'](_0x2a3036)){return _0x2e5a37;}else{throw new db[(_0xf6d4('0x17'))][(_0xf6d4('0x18'))](_0xf6d4('0x19'));}}else{return _0x2e5a37;}}function respondWithRpcPromise(_0x3fae79,_0x3584b9,_0x5d9f86,_0x459897){return new BPromise(function(_0x2adb02,_0xe6b9f7){var _0x2eb2e0=_0x459897||client;return _0x2eb2e0[_0xf6d4('0x1a')](_0x3fae79,_0x5d9f86)['then'](function(_0x1bd327){logger['info'](_0xf6d4('0x1b'),_0x3584b9,'request\x20sent');logger[_0xf6d4('0x1c')]('Network,\x20%s,\x20%s,\x20%s',_0x3584b9,_0xf6d4('0x1d'),JSON[_0xf6d4('0x1e')](_0x1bd327));if(_0x1bd327['error']){if(_0x1bd327[_0xf6d4('0x1f')][_0xf6d4('0x20')]===0x1f4){logger[_0xf6d4('0x1f')]('Network,\x20%s,\x20%s',_0x3584b9,_0x1bd327[_0xf6d4('0x1f')]['message']);return _0xe6b9f7(_0x1bd327[_0xf6d4('0x1f')][_0xf6d4('0x21')]);}logger[_0xf6d4('0x1f')](_0xf6d4('0x1b'),_0x3584b9,_0x1bd327[_0xf6d4('0x1f')][_0xf6d4('0x21')]);return _0x2adb02(_0x1bd327[_0xf6d4('0x1f')][_0xf6d4('0x21')]);}else{logger[_0xf6d4('0x22')](_0xf6d4('0x1b'),_0x3584b9,_0xf6d4('0x1d'));_0x2adb02(_0x1bd327[_0xf6d4('0x23')][_0xf6d4('0x21')]);}})[_0xf6d4('0x24')](function(_0x45dd00){logger[_0xf6d4('0x1f')](_0xf6d4('0x1b'),_0x3584b9,_0x45dd00);_0xe6b9f7(_0x45dd00);});});}function respondWithStatusCode(_0x4e1971,_0x3ce42e){_0x3ce42e=_0x3ce42e||0xcc;return function(_0x3f7937){if(_0x3f7937){return _0x4e1971[_0xf6d4('0x25')](_0x3ce42e);}return _0x4e1971[_0xf6d4('0x26')](_0x3ce42e)[_0xf6d4('0x27')]();};}function respondWithResult(_0x22f6ac,_0x2e52d3){_0x2e52d3=_0x2e52d3||0xc8;return function(_0x2714cc){if(_0x2714cc){return _0x22f6ac[_0xf6d4('0x26')](_0x2e52d3)[_0xf6d4('0x28')](_0x2714cc);}};}function respondWithFilteredResult(_0x1aa46e,_0x35177c){return function(_0x15f335){if(_0x15f335){var _0xfa6d2d=_0x15f335[_0xf6d4('0x29')],_0xfc0300=_0x35177c['offset'],_0x2ce6ee=_0x35177c[_0xf6d4('0x2a')]+_0x35177c[_0xf6d4('0x2b')],_0x530046;if(_0x2ce6ee>=_0xfa6d2d){_0x2ce6ee=_0xfa6d2d;_0x530046=0xc8;}else{_0x530046=0xce;}_0x1aa46e[_0xf6d4('0x26')](_0x530046);return _0x1aa46e[_0xf6d4('0x2c')](_0xf6d4('0x2d'),_0xfc0300+'-'+_0x2ce6ee+'/'+_0xfa6d2d)['json'](_0x15f335);}return null;};}function patchUpdates(_0x1b6bdd){return function(_0x33ebf3){try{jsonpatch[_0xf6d4('0x2e')](_0x33ebf3,_0x1b6bdd,!![]);}catch(_0x567ae4){return BPromise['reject'](_0x567ae4);}return _0x33ebf3[_0xf6d4('0x2f')]();};}function saveUpdates(_0x36d560,_0x5d5e36){return function(_0x2cac1c){if(_0x2cac1c){return _0x2cac1c['update'](_0x36d560)[_0xf6d4('0x30')](function(_0x3c9403){return _0x3c9403;});}return null;};}function removeEntity(_0x414cf1,_0x1f59fa){return function(_0x392e4f){if(_0x392e4f){return _0x392e4f[_0xf6d4('0x31')]()[_0xf6d4('0x30')](function(){_0x414cf1[_0xf6d4('0x26')](0xcc)[_0xf6d4('0x27')]();});}};}function handleEntityNotFound(_0x4b90cf,_0xcb8c50){return function(_0x19fb2d){if(!_0x19fb2d){_0x4b90cf[_0xf6d4('0x25')](0x194);}return _0x19fb2d;};}function handleError(_0x29efe6,_0x13edeb){_0x13edeb=_0x13edeb||0x1f4;return function(_0x19fa75){logger[_0xf6d4('0x1f')](_0x19fa75[_0xf6d4('0x32')]);if(_0x19fa75[_0xf6d4('0x33')]){delete _0x19fa75[_0xf6d4('0x33')];}_0x29efe6[_0xf6d4('0x26')](_0x13edeb)[_0xf6d4('0x34')](_0x19fa75);};}exports[_0xf6d4('0x35')]=function(_0x21407a,_0x3a055d){var _0x378306={},_0x3255c1={},_0x5be423={'count':0x0,'rows':[]};var _0x5e41ed=_[_0xf6d4('0x36')](db[_0xf6d4('0x37')]['rawAttributes'],function(_0x4ba438){return{'name':_0x4ba438[_0xf6d4('0x38')],'type':_0x4ba438[_0xf6d4('0x39')]['key']};});_0x3255c1['model']=_[_0xf6d4('0x36')](_0x5e41ed,_0xf6d4('0x33'));_0x3255c1['query']=_[_0xf6d4('0x3a')](_0x21407a['query']);_0x3255c1['filters']=_[_0xf6d4('0x3b')](_0x3255c1[_0xf6d4('0x3c')],_0x3255c1[_0xf6d4('0x3d')]);_0x378306[_0xf6d4('0x3e')]=_[_0xf6d4('0x3b')](_0x3255c1[_0xf6d4('0x3c')],qs[_0xf6d4('0x3f')](_0x21407a[_0xf6d4('0x3d')][_0xf6d4('0x3f')]));_0x378306[_0xf6d4('0x3e')]=_0x378306[_0xf6d4('0x3e')][_0xf6d4('0x40')]?_0x378306[_0xf6d4('0x3e')]:_0x3255c1[_0xf6d4('0x3c')];if(!_0x21407a[_0xf6d4('0x3d')][_0xf6d4('0x41')](_0xf6d4('0x42'))){_0x378306[_0xf6d4('0x2b')]=qs[_0xf6d4('0x2b')](_0x21407a[_0xf6d4('0x3d')]['limit']);_0x378306[_0xf6d4('0x2a')]=qs[_0xf6d4('0x2a')](_0x21407a[_0xf6d4('0x3d')][_0xf6d4('0x2a')]);}_0x378306['order']=qs[_0xf6d4('0x43')](_0x21407a['query'][_0xf6d4('0x43')]);_0x378306[_0xf6d4('0x44')]=qs['filters'](_[_0xf6d4('0x45')](_0x21407a['query'],_0x3255c1[_0xf6d4('0x46')]),_0x5e41ed);if(_0x21407a[_0xf6d4('0x3d')][_0xf6d4('0x47')]){_0x378306['where']=_[_0xf6d4('0x48')](_0x378306[_0xf6d4('0x44')],{'$or':_[_0xf6d4('0x36')](_0x5e41ed,function(_0x157db2){if(_0x157db2[_0xf6d4('0x39')]!==_0xf6d4('0x49')){var _0x21624f={};_0x21624f[_0x157db2[_0xf6d4('0x33')]]={'$like':'%'+_0x21407a[_0xf6d4('0x3d')]['filter']+'%'};return _0x21624f;}})});}_0x378306=_[_0xf6d4('0x48')]({},_0x378306,_0x21407a[_0xf6d4('0x4a')]);var _0x383c56={'where':_0x378306[_0xf6d4('0x44')]};return db['Network'][_0xf6d4('0x29')](_0x383c56)['then'](function(_0x4cb249){_0x5be423['count']=_0x4cb249;if(_0x21407a['query'][_0xf6d4('0x4b')]){_0x378306[_0xf6d4('0x4c')]=[{'all':!![]}];}return db[_0xf6d4('0x37')]['findAll'](_0x378306);})['then'](function(_0x143b78){_0x5be423['rows']=_0x143b78;return _0x5be423;})[_0xf6d4('0x30')](respondWithFilteredResult(_0x3a055d,_0x378306))[_0xf6d4('0x24')](handleError(_0x3a055d,null));};exports['show']=function(_0x52b661,_0x5b84d2){var _0x1069b7={'raw':!![],'where':{'id':_0x52b661['params']['id']}},_0x2a6d35={};_0x2a6d35['model']=_[_0xf6d4('0x3a')](db[_0xf6d4('0x37')][_0xf6d4('0x4d')]);_0x2a6d35[_0xf6d4('0x3d')]=_['keys'](_0x52b661[_0xf6d4('0x3d')]);_0x2a6d35[_0xf6d4('0x46')]=_[_0xf6d4('0x3b')](_0x2a6d35[_0xf6d4('0x3c')],_0x2a6d35['query']);_0x1069b7[_0xf6d4('0x3e')]=_[_0xf6d4('0x3b')](_0x2a6d35[_0xf6d4('0x3c')],qs[_0xf6d4('0x3f')](_0x52b661[_0xf6d4('0x3d')]['fields']));_0x1069b7['attributes']=_0x1069b7['attributes']['length']?_0x1069b7[_0xf6d4('0x3e')]:_0x2a6d35['model'];if(_0x52b661[_0xf6d4('0x3d')][_0xf6d4('0x4b')]){_0x1069b7[_0xf6d4('0x4c')]=[{'all':!![]}];}_0x1069b7=_[_0xf6d4('0x48')]({},_0x1069b7,_0x52b661['options']);return db[_0xf6d4('0x37')][_0xf6d4('0x4e')](_0x1069b7)[_0xf6d4('0x30')](handleEntityNotFound(_0x5b84d2,null))[_0xf6d4('0x30')](respondWithResult(_0x5b84d2,null))[_0xf6d4('0x24')](handleError(_0x5b84d2,null));};exports[_0xf6d4('0x4f')]=function(_0x56deb3,_0x5daaa3,_0x917813){var _0x1650b9;return db[_0xf6d4('0x50')][_0xf6d4('0x51')](function(_0x57f9f5){return db[_0xf6d4('0x37')][_0xf6d4('0x4f')](_0x56deb3[_0xf6d4('0x52')],{'raw':!![]})['then'](function(_0x5a8efa){_0x1650b9=_0x5a8efa;return db['Network'][_0xf6d4('0x53')]({'where':{'type':_0x56deb3['body'][_0xf6d4('0x39')]},'raw':!![]});})['then'](function(_0x41caec){if(_0x1650b9[_0xf6d4('0x39')]['toUpperCase']()==_0xf6d4('0x54')){var _0x1f3ea0=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xf6d4('0x57'));var _0x1bf713=ejs[_0xf6d4('0x58')](_0x1f3ea0,{'networks':_0x41caec||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x5a'),_0x1bf713);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x4f'),{'module':_0xf6d4('0x5c')});}else if(_0x1650b9[_0xf6d4('0x39')][_0xf6d4('0x5d')]()==_0xf6d4('0x5e')){var _0x21a7fe=fs['readFileSync'](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],_0xf6d4('0x60')),_0xf6d4('0x57'));var _0x5b92ad=ejs[_0xf6d4('0x58')](_0x21a7fe,{'networks':_0x41caec||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x61'),_0x5b92ad);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x4f'),{'module':_0xf6d4('0x5c')});}else{var _0x3135a3=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],_0xf6d4('0x62')),_0xf6d4('0x57'));var _0x19bce8=ejs[_0xf6d4('0x58')](_0x3135a3,{'networks':_0x41caec||[]});fs[_0xf6d4('0x59')](util[_0xf6d4('0x63')](_0xf6d4('0x64'),_0x56deb3['body'][_0xf6d4('0x39')][_0xf6d4('0x65')]()),_0x19bce8);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x4f'),{'module':_0xf6d4('0x66')});}return null;})[_0xf6d4('0x30')](function(){return _0x1650b9;});})[_0xf6d4('0x30')](respondWithResult(_0x5daaa3,0xc9))['catch'](handleError(_0x5daaa3,null));};exports[_0xf6d4('0x67')]=function(_0x4cbd4b,_0x1dbcfe,_0x180723){var _0x26ddb4;return db[_0xf6d4('0x50')][_0xf6d4('0x51')](function(_0x2d666c){return db[_0xf6d4('0x37')][_0xf6d4('0x4e')]({'where':{'id':_0x4cbd4b[_0xf6d4('0x68')]['id']}})[_0xf6d4('0x30')](handleEntityNotFound(_0x1dbcfe,null))[_0xf6d4('0x30')](saveUpdates(_0x4cbd4b[_0xf6d4('0x52')],null))[_0xf6d4('0x30')](function(_0x5e8503){if(_0x5e8503){_0x26ddb4=_0x5e8503;return db[_0xf6d4('0x37')]['findAll']({'where':{'type':_0x26ddb4[_0xf6d4('0x39')]},'raw':!![]});}return null;})[_0xf6d4('0x30')](function(_0x1a13e5){if(_0x26ddb4[_0xf6d4('0x39')][_0xf6d4('0x5d')]()=='STUN'){var _0x3583d5=fs['readFileSync'](path[_0xf6d4('0x56')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xf6d4('0x57'));var _0x1b0014=ejs[_0xf6d4('0x58')](_0x3583d5,{'networks':_0x1a13e5||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x5a'),_0x1b0014);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x67'),{'module':_0xf6d4('0x5c')});}else if(_0x26ddb4[_0xf6d4('0x39')]['toUpperCase']()==_0xf6d4('0x5e')){var _0x2c6a90=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x4498bd=ejs['render'](_0x2c6a90,{'networks':_0x1a13e5||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x61'),_0x4498bd);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x67'),{'module':_0xf6d4('0x5c')});}else{var _0x650fac=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],_0xf6d4('0x62')),_0xf6d4('0x57'));var _0x5eb59b=ejs[_0xf6d4('0x58')](_0x650fac,{'networks':_0x1a13e5||[]});fs[_0xf6d4('0x59')](util[_0xf6d4('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x4cbd4b[_0xf6d4('0x52')]['type'][_0xf6d4('0x65')]()),_0x5eb59b);return respondWithRpcPromise('Reload',_0xf6d4('0x67'),{'module':_0xf6d4('0x66')});}return null;})[_0xf6d4('0x30')](function(_0x16e7e5){if(_0x16e7e5){return _0x26ddb4;}return null;});})[_0xf6d4('0x30')](respondWithResult(_0x1dbcfe,null))[_0xf6d4('0x24')](handleError(_0x1dbcfe,null));};exports['destroy']=function(_0x3ee1e6,_0x550448,_0x8aa046){var _0x2736e2;return db[_0xf6d4('0x37')][_0xf6d4('0x4e')]({'where':{'id':_0x3ee1e6[_0xf6d4('0x68')]['id']}})[_0xf6d4('0x30')](function(_0x574c84){_0x2736e2=_0x574c84;return _0x574c84;})['then'](handleEntityNotFound(_0x550448,null))['then'](removeEntity(_0x550448,null))[_0xf6d4('0x30')](function(){if(_0x2736e2){return db['Network']['findAll']({'where':{'type':_0x2736e2[_0xf6d4('0x39')]},'raw':!![]});}})['then'](function(_0x344e1f){if(_0x2736e2[_0xf6d4('0x39')][_0xf6d4('0x5d')]()==_0xf6d4('0x54')){var _0x59ec1b=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x56f195=ejs[_0xf6d4('0x58')](_0x59ec1b,{'networks':_0x344e1f||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x5a'),_0x56f195);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x31'),{'module':'res_stun_monitor.so'});}else if(_0x2736e2[_0xf6d4('0x39')]['toUpperCase']()=='TURN'){var _0x1e7dac=fs[_0xf6d4('0x55')](path['join'](config[_0xf6d4('0x5f')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x24ca6b=ejs[_0xf6d4('0x58')](_0x1e7dac,{'networks':_0x344e1f||[]});fs[_0xf6d4('0x59')]('/etc/asterisk/turn_xcally.conf',_0x24ca6b);return respondWithRpcPromise(_0xf6d4('0x5b'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x98e451=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],_0xf6d4('0x62')),_0xf6d4('0x57'));var _0x4ffbe3=ejs[_0xf6d4('0x58')](_0x98e451,{'networks':_0x344e1f||[]});fs[_0xf6d4('0x59')](util[_0xf6d4('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x3ee1e6[_0xf6d4('0x52')]['type'][_0xf6d4('0x65')]()),_0x4ffbe3);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x31'),{'module':'chan_sip.so'});}return null;})[_0xf6d4('0x24')](handleError(_0x550448,null));}; \ No newline at end of file +var _0x2d81=['message','catch','end','status','json','count','offset','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','sequelize','transaction','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','update','/etc/asterisk/turn_xcally.conf','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','http','ValidationError','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x513356,_0x490e68){var _0xced1fd=function(_0x2b125f){while(--_0x2b125f){_0x513356['push'](_0x513356['shift']());}};_0xced1fd(++_0x490e68);}(_0x2d81,0x11c));var _0x12d8=function(_0x4d2698,_0x3a5517){_0x4d2698=_0x4d2698-0x0;var _0x1e6b1f=_0x2d81[_0x4d2698];return _0x1e6b1f;};'use strict';var pdf=require(_0x12d8('0x0'));var emlformat=require(_0x12d8('0x1'));var rimraf=require(_0x12d8('0x2'));var zipdir=require(_0x12d8('0x3'));var jsonpatch=require(_0x12d8('0x4'));var rp=require(_0x12d8('0x5'));var moment=require('moment');var BPromise=require(_0x12d8('0x6'));var Mustache=require(_0x12d8('0x7'));var util=require(_0x12d8('0x8'));var path=require(_0x12d8('0x9'));var sox=require(_0x12d8('0xa'));var csv=require(_0x12d8('0xb'));var ejs=require(_0x12d8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x12d8('0xd'));var crypto=require(_0x12d8('0xe'));var jsforce=require(_0x12d8('0xf'));var deskjs=require(_0x12d8('0x10'));var toCsv=require(_0x12d8('0xb'));var querystring=require(_0x12d8('0x11'));var Papa=require(_0x12d8('0x12'));var Redis=require(_0x12d8('0x13'));var authService=require(_0x12d8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12d8('0x15'));var logger=require(_0x12d8('0x16'))('api');var utils=require(_0x12d8('0x17'));var config=require('../../config/environment');var db=require(_0x12d8('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x12d8('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1061d9,_0x1662c0,_0x175c7e){if(_0x175c7e){var _0x5e5841=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e5841['test'](_0x1662c0)){return _0x1061d9;}else{throw new db['Sequelize'][(_0x12d8('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1061d9;}}function respondWithRpcPromise(_0x22a4b8,_0x46f537,_0x369d92,_0x1b867a){return new BPromise(function(_0x2d835b,_0x58d4d3){var _0x55e1d6=_0x1b867a||client;return _0x55e1d6[_0x12d8('0x1b')](_0x22a4b8,_0x369d92)['then'](function(_0xb2ae46){logger[_0x12d8('0x1c')](_0x12d8('0x1d'),_0x46f537,_0x12d8('0x1e'));logger['debug'](_0x12d8('0x1f'),_0x46f537,_0x12d8('0x1e'),JSON['stringify'](_0xb2ae46));if(_0xb2ae46[_0x12d8('0x20')]){if(_0xb2ae46[_0x12d8('0x20')][_0x12d8('0x21')]===0x1f4){logger[_0x12d8('0x20')]('Network,\x20%s,\x20%s',_0x46f537,_0xb2ae46[_0x12d8('0x20')][_0x12d8('0x22')]);return _0x58d4d3(_0xb2ae46[_0x12d8('0x20')]['message']);}logger[_0x12d8('0x20')](_0x12d8('0x1d'),_0x46f537,_0xb2ae46[_0x12d8('0x20')][_0x12d8('0x22')]);return _0x2d835b(_0xb2ae46[_0x12d8('0x20')][_0x12d8('0x22')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x46f537,_0x12d8('0x1e'));_0x2d835b(_0xb2ae46['result'][_0x12d8('0x22')]);}})[_0x12d8('0x23')](function(_0x1959d4){logger[_0x12d8('0x20')]('Network,\x20%s,\x20%s',_0x46f537,_0x1959d4);_0x58d4d3(_0x1959d4);});});}function respondWithStatusCode(_0x3d406e,_0x30bd96){_0x30bd96=_0x30bd96||0xcc;return function(_0x5c46c6){if(_0x5c46c6){return _0x3d406e['sendStatus'](_0x30bd96);}return _0x3d406e['status'](_0x30bd96)[_0x12d8('0x24')]();};}function respondWithResult(_0x159f22,_0x26c39e){_0x26c39e=_0x26c39e||0xc8;return function(_0x561a62){if(_0x561a62){return _0x159f22[_0x12d8('0x25')](_0x26c39e)[_0x12d8('0x26')](_0x561a62);}};}function respondWithFilteredResult(_0x3e36e4,_0x150720){return function(_0x2654f2){if(_0x2654f2){var _0x282a87=_0x2654f2[_0x12d8('0x27')],_0x1a4fb5=_0x150720['offset'],_0x23b3a3=_0x150720[_0x12d8('0x28')]+_0x150720['limit'],_0x34e9d3;if(_0x23b3a3>=_0x282a87){_0x23b3a3=_0x282a87;_0x34e9d3=0xc8;}else{_0x34e9d3=0xce;}_0x3e36e4[_0x12d8('0x25')](_0x34e9d3);return _0x3e36e4['set']('Content-Range',_0x1a4fb5+'-'+_0x23b3a3+'/'+_0x282a87)['json'](_0x2654f2);}return null;};}function patchUpdates(_0x3fcf03){return function(_0x3ffb1a){try{jsonpatch[_0x12d8('0x29')](_0x3ffb1a,_0x3fcf03,!![]);}catch(_0x4bb1bb){return BPromise[_0x12d8('0x2a')](_0x4bb1bb);}return _0x3ffb1a[_0x12d8('0x2b')]();};}function saveUpdates(_0x5b43ad,_0x30c2bb){return function(_0x22ebfe){if(_0x22ebfe){return _0x22ebfe['update'](_0x5b43ad)[_0x12d8('0x2c')](function(_0x5057da){return _0x5057da;});}return null;};}function removeEntity(_0x9f18a5,_0x9be095){return function(_0x38ad17){if(_0x38ad17){return _0x38ad17[_0x12d8('0x2d')]()[_0x12d8('0x2c')](function(){_0x9f18a5[_0x12d8('0x25')](0xcc)[_0x12d8('0x24')]();});}};}function handleEntityNotFound(_0x52a345,_0x35719d){return function(_0x2439b6){if(!_0x2439b6){_0x52a345[_0x12d8('0x2e')](0x194);}return _0x2439b6;};}function handleError(_0x71375e,_0x30b37b){_0x30b37b=_0x30b37b||0x1f4;return function(_0x333665){logger[_0x12d8('0x20')](_0x333665[_0x12d8('0x2f')]);if(_0x333665[_0x12d8('0x30')]){delete _0x333665['name'];}_0x71375e['status'](_0x30b37b)[_0x12d8('0x31')](_0x333665);};}exports[_0x12d8('0x32')]=function(_0x129b38,_0x3b7a6e){var _0x215b67={},_0x3856db={},_0x437677={'count':0x0,'rows':[]};var _0x3535cb=_['map'](db[_0x12d8('0x33')][_0x12d8('0x34')],function(_0x5925b7){return{'name':_0x5925b7[_0x12d8('0x35')],'type':_0x5925b7[_0x12d8('0x36')][_0x12d8('0x37')]};});_0x3856db[_0x12d8('0x38')]=_['map'](_0x3535cb,_0x12d8('0x30'));_0x3856db[_0x12d8('0x39')]=_[_0x12d8('0x3a')](_0x129b38[_0x12d8('0x39')]);_0x3856db[_0x12d8('0x3b')]=_[_0x12d8('0x3c')](_0x3856db[_0x12d8('0x38')],_0x3856db[_0x12d8('0x39')]);_0x215b67[_0x12d8('0x3d')]=_[_0x12d8('0x3c')](_0x3856db[_0x12d8('0x38')],qs['fields'](_0x129b38[_0x12d8('0x39')][_0x12d8('0x3e')]));_0x215b67[_0x12d8('0x3d')]=_0x215b67[_0x12d8('0x3d')][_0x12d8('0x3f')]?_0x215b67[_0x12d8('0x3d')]:_0x3856db[_0x12d8('0x38')];if(!_0x129b38['query'][_0x12d8('0x40')](_0x12d8('0x41'))){_0x215b67['limit']=qs[_0x12d8('0x42')](_0x129b38['query'][_0x12d8('0x42')]);_0x215b67['offset']=qs[_0x12d8('0x28')](_0x129b38[_0x12d8('0x39')][_0x12d8('0x28')]);}_0x215b67[_0x12d8('0x43')]=qs[_0x12d8('0x44')](_0x129b38[_0x12d8('0x39')]['sort']);_0x215b67[_0x12d8('0x45')]=qs[_0x12d8('0x3b')](_[_0x12d8('0x46')](_0x129b38[_0x12d8('0x39')],_0x3856db[_0x12d8('0x3b')]),_0x3535cb);if(_0x129b38['query'][_0x12d8('0x47')]){_0x215b67[_0x12d8('0x45')]=_[_0x12d8('0x48')](_0x215b67[_0x12d8('0x45')],{'$or':_['map'](_0x3535cb,function(_0x248822){if(_0x248822[_0x12d8('0x36')]!==_0x12d8('0x49')){var _0x4062f6={};_0x4062f6[_0x248822[_0x12d8('0x30')]]={'$like':'%'+_0x129b38[_0x12d8('0x39')][_0x12d8('0x47')]+'%'};return _0x4062f6;}})});}_0x215b67=_[_0x12d8('0x48')]({},_0x215b67,_0x129b38[_0x12d8('0x4a')]);var _0x2d1354={'where':_0x215b67[_0x12d8('0x45')]};return db[_0x12d8('0x33')]['count'](_0x2d1354)['then'](function(_0x597a18){_0x437677[_0x12d8('0x27')]=_0x597a18;if(_0x129b38[_0x12d8('0x39')][_0x12d8('0x4b')]){_0x215b67['include']=[{'all':!![]}];}return db[_0x12d8('0x33')][_0x12d8('0x4c')](_0x215b67);})[_0x12d8('0x2c')](function(_0x2459d4){_0x437677[_0x12d8('0x4d')]=_0x2459d4;return _0x437677;})['then'](respondWithFilteredResult(_0x3b7a6e,_0x215b67))[_0x12d8('0x23')](handleError(_0x3b7a6e,null));};exports[_0x12d8('0x4e')]=function(_0x52cd22,_0x2b8c45){var _0x595dce={'raw':!![],'where':{'id':_0x52cd22[_0x12d8('0x4f')]['id']}},_0x5e224d={};_0x5e224d[_0x12d8('0x38')]=_[_0x12d8('0x3a')](db[_0x12d8('0x33')][_0x12d8('0x34')]);_0x5e224d['query']=_['keys'](_0x52cd22[_0x12d8('0x39')]);_0x5e224d[_0x12d8('0x3b')]=_[_0x12d8('0x3c')](_0x5e224d[_0x12d8('0x38')],_0x5e224d[_0x12d8('0x39')]);_0x595dce[_0x12d8('0x3d')]=_[_0x12d8('0x3c')](_0x5e224d['model'],qs[_0x12d8('0x3e')](_0x52cd22['query']['fields']));_0x595dce[_0x12d8('0x3d')]=_0x595dce[_0x12d8('0x3d')][_0x12d8('0x3f')]?_0x595dce[_0x12d8('0x3d')]:_0x5e224d['model'];if(_0x52cd22[_0x12d8('0x39')][_0x12d8('0x4b')]){_0x595dce[_0x12d8('0x50')]=[{'all':!![]}];}_0x595dce=_[_0x12d8('0x48')]({},_0x595dce,_0x52cd22[_0x12d8('0x4a')]);return db[_0x12d8('0x33')][_0x12d8('0x51')](_0x595dce)[_0x12d8('0x2c')](handleEntityNotFound(_0x2b8c45,null))['then'](respondWithResult(_0x2b8c45,null))[_0x12d8('0x23')](handleError(_0x2b8c45,null));};exports[_0x12d8('0x52')]=function(_0x4a019d,_0x17eb06,_0x55c61d){var _0x3be7be;return db[_0x12d8('0x53')][_0x12d8('0x54')](function(_0x2e3bde){return db[_0x12d8('0x33')][_0x12d8('0x52')](_0x4a019d['body'],{'raw':!![]})['then'](function(_0xac7b){_0x3be7be=_0xac7b;return db[_0x12d8('0x33')][_0x12d8('0x4c')]({'where':{'type':_0x4a019d['body'][_0x12d8('0x36')]},'raw':!![]});})[_0x12d8('0x2c')](function(_0x1dfd6f){if(_0x3be7be['type'][_0x12d8('0x55')]()==_0x12d8('0x56')){var _0x2a374d=fs[_0x12d8('0x57')](path['join'](config[_0x12d8('0x58')],_0x12d8('0x59')),_0x12d8('0x5a'));var _0x148c8c=ejs[_0x12d8('0x5b')](_0x2a374d,{'networks':_0x1dfd6f||[]});fs[_0x12d8('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x148c8c);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x52'),{'module':_0x12d8('0x5e')});}else if(_0x3be7be['type'][_0x12d8('0x55')]()==_0x12d8('0x5f')){var _0x4a5102=fs['readFileSync'](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x61')),_0x12d8('0x5a'));var _0x41dc14=ejs[_0x12d8('0x5b')](_0x4a5102,{'networks':_0x1dfd6f||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x41dc14);return respondWithRpcPromise('Reload',_0x12d8('0x52'),{'module':_0x12d8('0x5e')});}else{var _0x28aa37=fs[_0x12d8('0x57')](path['join'](config[_0x12d8('0x58')],_0x12d8('0x62')),'utf8');var _0x2ba54f=ejs['render'](_0x28aa37,{'networks':_0x1dfd6f||[]});fs['writeFileSync'](util['format'](_0x12d8('0x63'),_0x4a019d[_0x12d8('0x64')][_0x12d8('0x36')][_0x12d8('0x65')]()),_0x2ba54f);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x52'),{'module':_0x12d8('0x66')});}return null;})[_0x12d8('0x2c')](function(){return _0x3be7be;});})['then'](respondWithResult(_0x17eb06,0xc9))[_0x12d8('0x23')](handleError(_0x17eb06,null));};exports[_0x12d8('0x67')]=function(_0xf369cd,_0x51cfd1,_0x567ddc){var _0x33bb4f;return db[_0x12d8('0x53')][_0x12d8('0x54')](function(_0x148e21){return db[_0x12d8('0x33')][_0x12d8('0x51')]({'where':{'id':_0xf369cd[_0x12d8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x51cfd1,null))[_0x12d8('0x2c')](saveUpdates(_0xf369cd[_0x12d8('0x64')],null))[_0x12d8('0x2c')](function(_0x85dc67){if(_0x85dc67){_0x33bb4f=_0x85dc67;return db['Network'][_0x12d8('0x4c')]({'where':{'type':_0x33bb4f[_0x12d8('0x36')]},'raw':!![]});}return null;})['then'](function(_0x497824){if(_0x33bb4f[_0x12d8('0x36')][_0x12d8('0x55')]()==_0x12d8('0x56')){var _0x4584fa=fs[_0x12d8('0x57')](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x59')),'utf8');var _0x13d17c=ejs['render'](_0x4584fa,{'networks':_0x497824||[]});fs[_0x12d8('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x13d17c);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x67'),{'module':_0x12d8('0x5e')});}else if(_0x33bb4f[_0x12d8('0x36')][_0x12d8('0x55')]()=='TURN'){var _0x317a31=fs['readFileSync'](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x61')),_0x12d8('0x5a'));var _0x41f9a3=ejs[_0x12d8('0x5b')](_0x317a31,{'networks':_0x497824||[]});fs[_0x12d8('0x5c')](_0x12d8('0x68'),_0x41f9a3);return respondWithRpcPromise('Reload',_0x12d8('0x67'),{'module':_0x12d8('0x5e')});}else{var _0x453bf8=fs['readFileSync'](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x62')),_0x12d8('0x5a'));var _0x1224db=ejs[_0x12d8('0x5b')](_0x453bf8,{'networks':_0x497824||[]});fs[_0x12d8('0x5c')](util[_0x12d8('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0xf369cd['body']['type'][_0x12d8('0x65')]()),_0x1224db);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x67'),{'module':_0x12d8('0x66')});}return null;})[_0x12d8('0x2c')](function(_0x320e0f){if(_0x320e0f){return _0x33bb4f;}return null;});})[_0x12d8('0x2c')](respondWithResult(_0x51cfd1,null))[_0x12d8('0x23')](handleError(_0x51cfd1,null));};exports[_0x12d8('0x2d')]=function(_0x2a472c,_0x4e09e0,_0x53f516){var _0x5ccb4e;return db[_0x12d8('0x33')][_0x12d8('0x51')]({'where':{'id':_0x2a472c['params']['id']}})[_0x12d8('0x2c')](function(_0xf9bb6e){_0x5ccb4e=_0xf9bb6e;return _0xf9bb6e;})[_0x12d8('0x2c')](handleEntityNotFound(_0x4e09e0,null))[_0x12d8('0x2c')](removeEntity(_0x4e09e0,null))[_0x12d8('0x2c')](function(){if(_0x5ccb4e){return db[_0x12d8('0x33')][_0x12d8('0x4c')]({'where':{'type':_0x5ccb4e[_0x12d8('0x36')]},'raw':!![]});}})['then'](function(_0x2255da){if(_0x5ccb4e['type']['toUpperCase']()=='STUN'){var _0x1912d6=fs['readFileSync'](path[_0x12d8('0x60')](config['root'],_0x12d8('0x59')),_0x12d8('0x5a'));var _0x43624d=ejs[_0x12d8('0x5b')](_0x1912d6,{'networks':_0x2255da||[]});fs[_0x12d8('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x43624d);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x2d'),{'module':'res_stun_monitor.so'});}else if(_0x5ccb4e[_0x12d8('0x36')][_0x12d8('0x55')]()==_0x12d8('0x5f')){var _0x3b1d55=fs[_0x12d8('0x57')](path[_0x12d8('0x60')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x12d8('0x5a'));var _0xef08de=ejs[_0x12d8('0x5b')](_0x3b1d55,{'networks':_0x2255da||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xef08de);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x2d'),{'module':_0x12d8('0x5e')});}else{var _0x1b79ce=fs[_0x12d8('0x57')](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x62')),_0x12d8('0x5a'));var _0x3e91f6=ejs[_0x12d8('0x5b')](_0x1b79ce,{'networks':_0x2255da||[]});fs['writeFileSync'](util[_0x12d8('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0x2a472c[_0x12d8('0x64')][_0x12d8('0x36')][_0x12d8('0x65')]()),_0x3e91f6);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x2d'),{'module':_0x12d8('0x66')});}return null;})['catch'](handleError(_0x4e09e0,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 68f4110..c29efbd 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 _0xde2c=['api','moment','bluebird','request-promise','path','../../config/environment','./network.attributes','exports','Network','network','lodash','util','../../config/logger'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xde2c,0x7f));var _0xcde2=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xde2c[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var moment=require(_0xcde2('0x4'));var BPromise=require(_0xcde2('0x5'));var rp=require(_0xcde2('0x6'));var fs=require('fs');var path=require(_0xcde2('0x7'));var rimraf=require('rimraf');var config=require(_0xcde2('0x8'));var attributes=require(_0xcde2('0x9'));module[_0xcde2('0xa')]=function(_0x1398de,_0x401b16){return _0x1398de['define'](_0xcde2('0xb'),attributes,{'tableName':_0xcde2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0bb=['Network','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x5534ea,_0x3dd8b1){var _0x4035d1=function(_0x339d87){while(--_0x339d87){_0x5534ea['push'](_0x5534ea['shift']());}};_0x4035d1(++_0x3dd8b1);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x33c562,_0x54f29c){_0x33c562=_0x33c562-0x0;var _0x4199e3=_0xd0bb[_0x33c562];return _0x4199e3;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./network.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 38bc396..ed1566c 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 _0x9b5d=['http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9b5d,0xd3));var _0xd9b5=function(_0xcd9302,_0x59074c){_0xcd9302=_0xcd9302-0x0;var _0x35b0c1=_0x9b5d[_0xcd9302];return _0x35b0c1;};'use strict';var _=require('lodash');var util=require(_0xd9b5('0x0'));var moment=require(_0xd9b5('0x1'));var BPromise=require('bluebird');var rs=require(_0xd9b5('0x2'));var fs=require('fs');var Redis=require(_0xd9b5('0x3'));var db=require(_0xd9b5('0x4'))['db'];var utils=require(_0xd9b5('0x5'));var logger=require('../../config/logger')(_0xd9b5('0x6'));var config=require(_0xd9b5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd9b5('0x8')][_0xd9b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x561fa2,_0x4ec5ff,_0x470e9e){return new BPromise(function(_0x5c3566,_0x819973){return client[_0xd9b5('0xa')](_0x561fa2,_0x470e9e)[_0xd9b5('0xb')](function(_0x535091){logger[_0xd9b5('0xc')](_0xd9b5('0xd'),_0x4ec5ff,_0xd9b5('0xe'));logger['debug'](_0xd9b5('0xf'),_0x4ec5ff,_0xd9b5('0xe'),JSON['stringify'](_0x535091));if(_0x535091[_0xd9b5('0x10')]){if(_0x535091[_0xd9b5('0x10')]['code']===0x1f4){logger[_0xd9b5('0x10')](_0xd9b5('0xd'),_0x4ec5ff,_0x535091[_0xd9b5('0x10')][_0xd9b5('0x11')]);return _0x819973(_0x535091[_0xd9b5('0x10')][_0xd9b5('0x11')]);}logger['error'](_0xd9b5('0xd'),_0x4ec5ff,_0x535091[_0xd9b5('0x10')][_0xd9b5('0x11')]);return _0x5c3566(_0x535091[_0xd9b5('0x10')][_0xd9b5('0x11')]);}else{logger['info'](_0xd9b5('0xd'),_0x4ec5ff,'request\x20sent');_0x5c3566(_0x535091[_0xd9b5('0x12')][_0xd9b5('0x11')]);}})[_0xd9b5('0x13')](function(_0x43ee4c){logger[_0xd9b5('0x10')](_0xd9b5('0xd'),_0x4ec5ff,_0x43ee4c);_0x819973(_0x43ee4c);});});} \ No newline at end of file +var _0x11a7=['debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Network,\x20%s,\x20%s','request\x20sent'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x11a7,0x11b));var _0x711a=function(_0x32e264,_0x41cee8){_0x32e264=_0x32e264-0x0;var _0x1d7175=_0x11a7[_0x32e264];return _0x1d7175;};'use strict';var _=require(_0x711a('0x0'));var util=require(_0x711a('0x1'));var moment=require(_0x711a('0x2'));var BPromise=require(_0x711a('0x3'));var rs=require(_0x711a('0x4'));var fs=require('fs');var Redis=require(_0x711a('0x5'));var db=require(_0x711a('0x6'))['db'];var utils=require(_0x711a('0x7'));var logger=require(_0x711a('0x8'))(_0x711a('0x9'));var config=require('../../config/environment');var jayson=require(_0x711a('0xa'));var client=jayson['client'][_0x711a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x183eb3,_0x547889,_0xe5ec7f){return new BPromise(function(_0x31d7a0,_0x463355){return client['request'](_0x183eb3,_0xe5ec7f)[_0x711a('0xc')](function(_0x225c22){logger[_0x711a('0xd')](_0x711a('0xe'),_0x547889,_0x711a('0xf'));logger[_0x711a('0x10')](_0x711a('0x11'),_0x547889,_0x711a('0xf'),JSON[_0x711a('0x12')](_0x225c22));if(_0x225c22[_0x711a('0x13')]){if(_0x225c22['error']['code']===0x1f4){logger[_0x711a('0x13')](_0x711a('0xe'),_0x547889,_0x225c22[_0x711a('0x13')]['message']);return _0x463355(_0x225c22[_0x711a('0x13')][_0x711a('0x14')]);}logger[_0x711a('0x13')](_0x711a('0xe'),_0x547889,_0x225c22[_0x711a('0x13')][_0x711a('0x14')]);return _0x31d7a0(_0x225c22['error'][_0x711a('0x14')]);}else{logger[_0x711a('0xd')](_0x711a('0xe'),_0x547889,'request\x20sent');_0x31d7a0(_0x225c22[_0x711a('0x15')]['message']);}})[_0x711a('0x16')](function(_0x46f5f2){logger[_0x711a('0x13')](_0x711a('0xe'),_0x547889,_0x46f5f2);_0x463355(_0x46f5f2);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index df6a0d5..09de59c 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe296=['../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e357d,_0x3cb775){var _0x1fa416=function(_0x1ee7d4){while(--_0x1ee7d4){_0x4e357d['push'](_0x4e357d['shift']());}};_0x1fa416(++_0x3cb775);}(_0xe296,0xf0));var _0x6e29=function(_0x14bb43,_0x512b78){_0x14bb43=_0x14bb43-0x0;var _0x1737a3=_0xe296[_0x14bb43];return _0x1737a3;};'use strict';var multer=require(_0x6e29('0x0'));var util=require(_0x6e29('0x1'));var path=require(_0x6e29('0x2'));var timeout=require(_0x6e29('0x3'));var express=require('express');var router=express[_0x6e29('0x4')]();var auth=require(_0x6e29('0x5'));var interaction=require(_0x6e29('0x6'));var config=require(_0x6e29('0x7'));var controller=require(_0x6e29('0x8'));router[_0x6e29('0x9')]('/',auth[_0x6e29('0xa')](),controller[_0x6e29('0xb')]);module[_0x6e29('0xc')]=router; \ No newline at end of file +var _0xc8d8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','exports','util','path'];(function(_0x2a51d0,_0x2dc9eb){var _0x1d2615=function(_0x518946){while(--_0x518946){_0x2a51d0['push'](_0x2a51d0['shift']());}};_0x1d2615(++_0x2dc9eb);}(_0xc8d8,0xee));var _0x8c8d=function(_0x122633,_0x22057b){_0x122633=_0x122633-0x0;var _0x2d02e5=_0xc8d8[_0x122633];return _0x2d02e5;};'use strict';var multer=require('multer');var util=require(_0x8c8d('0x0'));var path=require(_0x8c8d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c8d('0x2')]();var auth=require(_0x8c8d('0x3'));var interaction=require(_0x8c8d('0x4'));var config=require(_0x8c8d('0x5'));var controller=require(_0x8c8d('0x6'));router[_0x8c8d('0x7')]('/',auth[_0x8c8d('0x8')](),controller['sendNotification']);module[_0x8c8d('0x9')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 131dd19..07f6c07 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90ff=['BOOLEAN','sequelize'];(function(_0x132671,_0x26760e){var _0x4a3b55=function(_0xf011ca){while(--_0xf011ca){_0x132671['push'](_0x132671['shift']());}};_0x4a3b55(++_0x26760e);}(_0x90ff,0xbd));var _0xf90f=function(_0x148a4d,_0xe6f5e8){_0x148a4d=_0x148a4d-0x0;var _0x51018a=_0x90ff[_0x148a4d];return _0x51018a;};'use strict';var Sequelize=require(_0xf90f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xf90f('0x1')]}}; \ No newline at end of file +var _0x539e=['STRING','BOOLEAN','TEXT'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x539e,0x12e));var _0xe539=function(_0x33aa60,_0x416998){_0x33aa60=_0x33aa60-0x0;var _0x5ef4c1=_0x539e[_0x33aa60];return _0x5ef4c1;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xe539('0x0')]},'senderName':{'type':Sequelize[_0xe539('0x1')]},'recipientsId':{'type':Sequelize[_0xe539('0x0')]},'recipientsDescription':{'type':Sequelize[_0xe539('0x1')]},'beep':{'type':Sequelize[_0xe539('0x2')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index b823cdc..454dafd 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9442=['toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','sequelize','Notification','create','emit','notification:send','catch','Template','findOne','html','forEach','union','ids','queue','replace','push','all','flatten','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','status','end','stack','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model'];(function(_0x1d40a0,_0x1bc80d){var _0x4015a3=function(_0x95267c){while(--_0x95267c){_0x1d40a0['push'](_0x1d40a0['shift']());}};_0x4015a3(++_0x1bc80d);}(_0x9442,0x135));var _0x2944=function(_0x3f21f9,_0x5a04a9){_0x3f21f9=_0x3f21f9-0x0;var _0x2c83f7=_0x9442[_0x3f21f9];return _0x2c83f7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2944('0x0'));var zipdir=require(_0x2944('0x1'));var jsonpatch=require(_0x2944('0x2'));var rp=require(_0x2944('0x3'));var moment=require('moment');var BPromise=require(_0x2944('0x4'));var Mustache=require(_0x2944('0x5'));var util=require(_0x2944('0x6'));var path=require(_0x2944('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2944('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2944('0x9'));var crypto=require(_0x2944('0xa'));var jsforce=require(_0x2944('0xb'));var deskjs=require(_0x2944('0xc'));var toCsv=require(_0x2944('0xd'));var querystring=require(_0x2944('0xe'));var Papa=require(_0x2944('0xf'));var Redis=require(_0x2944('0x10'));var authService=require(_0x2944('0x11'));var qs=require(_0x2944('0x12'));var as=require(_0x2944('0x13'));var hardwareService=require(_0x2944('0x14'));var logger=require(_0x2944('0x15'))(_0x2944('0x16'));var utils=require(_0x2944('0x17'));var config=require(_0x2944('0x18'));var db=require(_0x2944('0x19'))['db'];config[_0x2944('0x1a')]=_[_0x2944('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2944('0x1a')]));require('./notification.socket')[_0x2944('0x1c')](socket);function respondWithStatusCode(_0x1a6401,_0x1ec1da){_0x1ec1da=_0x1ec1da||0xcc;return function(_0x505d83){if(_0x505d83){return _0x1a6401[_0x2944('0x1d')](_0x1ec1da);}return _0x1a6401['status'](_0x1ec1da)['end']();};}function respondWithResult(_0x302d34,_0x34ea0d){_0x34ea0d=_0x34ea0d||0xc8;return function(_0x3b8796){if(_0x3b8796){return _0x302d34['status'](_0x34ea0d)[_0x2944('0x1e')](_0x3b8796);}};}function respondWithFilteredResult(_0x44cdfe,_0x1004da){return function(_0x519102){if(_0x519102){var _0xddb70b=_0x519102[_0x2944('0x1f')],_0x3d1429=_0x1004da[_0x2944('0x20')],_0x1aa959=_0x1004da['offset']+_0x1004da[_0x2944('0x21')],_0x2964d2;if(_0x1aa959>=_0xddb70b){_0x1aa959=_0xddb70b;_0x2964d2=0xc8;}else{_0x2964d2=0xce;}_0x44cdfe['status'](_0x2964d2);return _0x44cdfe['set'](_0x2944('0x22'),_0x3d1429+'-'+_0x1aa959+'/'+_0xddb70b)[_0x2944('0x1e')](_0x519102);}return null;};}function patchUpdates(_0x57b4d4){return function(_0xe1c89f){try{jsonpatch['apply'](_0xe1c89f,_0x57b4d4,!![]);}catch(_0x497a54){return BPromise[_0x2944('0x23')](_0x497a54);}return _0xe1c89f[_0x2944('0x24')]();};}function saveUpdates(_0x2359c8,_0x29794a){return function(_0x5bf251){if(_0x5bf251){return _0x5bf251[_0x2944('0x25')](_0x2359c8)[_0x2944('0x26')](function(_0x581d1c){return _0x581d1c;});}return null;};}function removeEntity(_0x2be600,_0x5f1d94){return function(_0x533f64){if(_0x533f64){return _0x533f64[_0x2944('0x27')]()[_0x2944('0x26')](function(){_0x2be600[_0x2944('0x28')](0xcc)[_0x2944('0x29')]();});}};}function handleEntityNotFound(_0x80452e,_0x166214){return function(_0x3e466a){if(!_0x3e466a){_0x80452e['sendStatus'](0x194);}return _0x3e466a;};}function handleError(_0x2108c9,_0x54203a){_0x54203a=_0x54203a||0x1f4;return function(_0x28cc03){logger['error'](_0x28cc03[_0x2944('0x2a')]);if(_0x28cc03['name']){delete _0x28cc03['name'];}_0x2108c9[_0x2944('0x28')](_0x54203a)[_0x2944('0x2b')](_0x28cc03);};}exports[_0x2944('0x2c')]=function(_0xc19090,_0x53b336,_0x10e211){if(!_0xc19090[_0x2944('0x2d')][_0x2944('0x2e')](_0x2944('0x2f'))&&!_0xc19090[_0x2944('0x2d')][_0x2944('0x2e')](_0x2944('0x30'))){throw new db[(_0x2944('0x31'))]['ValidationError'](_0x2944('0x32'));}else{if(_0xc19090[_0x2944('0x2d')]['hasOwnProperty'](_0x2944('0x30'))&&!_0xc19090[_0x2944('0x2d')][_0x2944('0x2e')](_0x2944('0x33'))){throw new db['Sequelize'][(_0x2944('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xc19090[_0x2944('0x2d')]['hasOwnProperty'](_0x2944('0x35'))){throw new db['Sequelize'][(_0x2944('0x34'))](_0x2944('0x36'));}else{try{var _0x24c506=JSON['parse'](_0xc19090[_0x2944('0x2d')][_0x2944('0x35')]);}catch(_0x388f0b){logger[_0x2944('0x37')](_0x388f0b);throw new db['Sequelize'][(_0x2944('0x34'))](_0x2944('0x38'));}var _0x2df045=[_0x2944('0x39'),_0x2944('0x3a'),'mailqueue',_0x2944('0x3b'),'smsqueue',_0x2944('0x3c'),_0x2944('0x3d'),_0x2944('0x3e'),_0x2944('0x3f')];if(_[_0x2944('0x40')](_0x24c506,function(_0x291698){return!_[_0x2944('0x41')](_0x2df045,_0x291698[_0x2944('0x42')][_0x2944('0x43')]());})){throw new db[(_0x2944('0x31'))]['ValidationError'](_0x2944('0x44'));}}}var _0x1ffb9e={};_0x1ffb9e[_0x2944('0x45')]=_0xc19090['body'][_0x2944('0x2e')](_0x2944('0x45'))?_0xc19090['body'][_0x2944('0x45')]:_0xc19090['user'][_0x2944('0x46')];_0x1ffb9e[_0x2944('0x47')]=_[_0x2944('0x48')](_0xc19090[_0x2944('0x2d')][_0x2944('0x47')])?null:_0xc19090[_0x2944('0x2d')][_0x2944('0x47')];_0x1ffb9e[_0x2944('0x49')]=_0xc19090[_0x2944('0x2d')]['beep']||![];_0x1ffb9e['SenderId']=_0xc19090['user']['id'];return getContent(_0xc19090['body'])[_0x2944('0x26')](function(_0x4819e1){_0x1ffb9e[_0x2944('0x2d')]=_0x4819e1;return getRecipients(_0x24c506);})['then'](function(_0x59258d){_0x1ffb9e[_0x2944('0x4a')]=_[_0x2944('0x4b')](_0x59258d)['join'](',');return db[_0x2944('0x4c')]['transaction'](function(_0x1bfdd9){return db[_0x2944('0x4d')][_0x2944('0x4e')](_0x1ffb9e,{'raw':!![],'transaction':_0x1bfdd9})['then'](function(_0x46fdde){var _0xdfb58e={'sender':_0x1ffb9e[_0x2944('0x45')],'description':_0x1ffb9e['recipientsDescription'],'content':_0x1ffb9e['body'],'beep':_0x1ffb9e[_0x2944('0x49')]};_0x59258d['forEach'](function(_0x352093){_0xdfb58e['recipient']=_0x352093;socket[_0x2944('0x4f')](_0x2944('0x50'),_0xdfb58e);});return _0x46fdde;});});})[_0x2944('0x26')](respondWithResult(_0x53b336,0xc9))[_0x2944('0x51')](handleError(_0x53b336,null));};function getContent(_0x456809){return new BPromise(function(_0x298103,_0x2f8b88){if(_0x456809[_0x2944('0x2f')]){_0x298103(_0x456809[_0x2944('0x2f')]);return;}return db[_0x2944('0x52')][_0x2944('0x53')]({'attributes':[_0x2944('0x54')],'where':{'id':_0x456809[_0x2944('0x30')]},'raw':!![]})[_0x2944('0x26')](function(_0x286495){if(!_0x286495)throw new db[(_0x2944('0x31'))][(_0x2944('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3bce51=Mustache['render'](_0x286495[_0x2944('0x54')],_0x456809[_0x2944('0x33')]);_0x298103(_0x3bce51);})[_0x2944('0x51')](function(_0x457453){_0x2f8b88(_0x457453);});});}function getRecipients(_0x5a033){return new BPromise(function(_0x41f3f0,_0x542cd1){var _0x242308=[];var _0x516769=[];_0x5a033[_0x2944('0x55')](function(_0x54f23d){var _0x524fd2=_['startCase'](_0x54f23d[_0x2944('0x42')]['toLowerCase']());if(_0x524fd2==='User'){_0x242308=_[_0x2944('0x56')](_0x242308,_0x54f23d[_0x2944('0x57')]);}else{if(_['includes'](_0x524fd2,_0x2944('0x58')))_0x524fd2=_0x524fd2[_0x2944('0x59')](_0x2944('0x58'),'Queue');_0x54f23d['ids'][_0x2944('0x55')](function(_0x2a90bd){_0x516769[_0x2944('0x5a')](getAgents(_0x524fd2,_0x2a90bd));});}});return BPromise[_0x2944('0x5b')](_0x516769)[_0x2944('0x26')](function(_0x49292d){_0x242308=_[_0x2944('0x56')](_0x242308,_[_0x2944('0x5c')](_0x49292d));_0x41f3f0(_0x242308);})[_0x2944('0x51')](function(_0x35cd4e){_0x542cd1(_0x35cd4e);});});}function getAgents(_0x2047e8,_0x168da8){return new BPromise(function(_0x1ffd96,_0x2ee70c){return db[_0x2047e8]['findOne']({'where':{'id':_0x168da8}})[_0x2944('0x26')](function(_0x1b3479){return _0x1b3479[_0x2944('0x5d')]({'attributes':['id'],'raw':!![]})[_0x2944('0x26')](function(_0x236a71){var _0x3340f8=_['map'](_0x236a71,'id');_0x1ffd96(_0x3340f8);});})['catch'](function(_0x11cdb3){_0x2ee70c(_0x11cdb3);});});} \ No newline at end of file +var _0xd66f=['send','sendNotification','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','team','user','some','senderName','recipientsDescription','isEmpty','beep','recipientsId','join','sequelize','transaction','Notification','create','recipient','notification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','toLowerCase','User','union','includes','queue','Queue','forEach','push','all','getAgents','map','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name'];(function(_0x3b02da,_0x2795f6){var _0x138cf9=function(_0x3786d0){while(--_0x3786d0){_0x3b02da['push'](_0x3b02da['shift']());}};_0x138cf9(++_0x2795f6);}(_0xd66f,0x95));var _0xfd66=function(_0x32959e,_0x95c759){_0x32959e=_0x32959e-0x0;var _0x379025=_0xd66f[_0x32959e];return _0x379025;};'use strict';var pdf=require(_0xfd66('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfd66('0x1'));var zipdir=require(_0xfd66('0x2'));var jsonpatch=require(_0xfd66('0x3'));var rp=require(_0xfd66('0x4'));var moment=require('moment');var BPromise=require(_0xfd66('0x5'));var Mustache=require(_0xfd66('0x6'));var util=require(_0xfd66('0x7'));var path=require('path');var sox=require(_0xfd66('0x8'));var csv=require(_0xfd66('0x9'));var ejs=require(_0xfd66('0xa'));var fs=require('fs');var _=require(_0xfd66('0xb'));var squel=require(_0xfd66('0xc'));var crypto=require('crypto');var jsforce=require(_0xfd66('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfd66('0xe'));var Papa=require(_0xfd66('0xf'));var Redis=require(_0xfd66('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfd66('0x11'));var hardwareService=require(_0xfd66('0x12'));var logger=require(_0xfd66('0x13'))(_0xfd66('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfd66('0x15'))['db'];config[_0xfd66('0x16')]=_[_0xfd66('0x17')](config[_0xfd66('0x16')],{'host':_0xfd66('0x18'),'port':0x18eb});var socket=require(_0xfd66('0x19'))(new Redis(config[_0xfd66('0x16')]));require('./notification.socket')[_0xfd66('0x1a')](socket);function respondWithStatusCode(_0x357a23,_0x550454){_0x550454=_0x550454||0xcc;return function(_0x3c7a95){if(_0x3c7a95){return _0x357a23['sendStatus'](_0x550454);}return _0x357a23[_0xfd66('0x1b')](_0x550454)[_0xfd66('0x1c')]();};}function respondWithResult(_0x39d49a,_0xbf4a39){_0xbf4a39=_0xbf4a39||0xc8;return function(_0x42b18c){if(_0x42b18c){return _0x39d49a[_0xfd66('0x1b')](_0xbf4a39)[_0xfd66('0x1d')](_0x42b18c);}};}function respondWithFilteredResult(_0x366995,_0x2592b6){return function(_0x3c4759){if(_0x3c4759){var _0x97d2fc=_0x3c4759['count'],_0x4ef24c=_0x2592b6[_0xfd66('0x1e')],_0x11448d=_0x2592b6[_0xfd66('0x1e')]+_0x2592b6['limit'],_0xdd1f39;if(_0x11448d>=_0x97d2fc){_0x11448d=_0x97d2fc;_0xdd1f39=0xc8;}else{_0xdd1f39=0xce;}_0x366995[_0xfd66('0x1b')](_0xdd1f39);return _0x366995['set'](_0xfd66('0x1f'),_0x4ef24c+'-'+_0x11448d+'/'+_0x97d2fc)[_0xfd66('0x1d')](_0x3c4759);}return null;};}function patchUpdates(_0x34e315){return function(_0x53f83a){try{jsonpatch[_0xfd66('0x20')](_0x53f83a,_0x34e315,!![]);}catch(_0x5307d0){return BPromise[_0xfd66('0x21')](_0x5307d0);}return _0x53f83a[_0xfd66('0x22')]();};}function saveUpdates(_0x2e8756,_0x2c11bd){return function(_0x3c7da1){if(_0x3c7da1){return _0x3c7da1[_0xfd66('0x23')](_0x2e8756)[_0xfd66('0x24')](function(_0x1cd706){return _0x1cd706;});}return null;};}function removeEntity(_0x1023ba,_0xc71d65){return function(_0x393ae3){if(_0x393ae3){return _0x393ae3['destroy']()[_0xfd66('0x24')](function(){_0x1023ba[_0xfd66('0x1b')](0xcc)[_0xfd66('0x1c')]();});}};}function handleEntityNotFound(_0x4d3249,_0x3a9eee){return function(_0x28bedd){if(!_0x28bedd){_0x4d3249[_0xfd66('0x25')](0x194);}return _0x28bedd;};}function handleError(_0x59c337,_0x5f17da){_0x5f17da=_0x5f17da||0x1f4;return function(_0x4b3dfd){logger[_0xfd66('0x26')](_0x4b3dfd[_0xfd66('0x27')]);if(_0x4b3dfd['name']){delete _0x4b3dfd[_0xfd66('0x28')];}_0x59c337[_0xfd66('0x1b')](_0x5f17da)[_0xfd66('0x29')](_0x4b3dfd);};}exports[_0xfd66('0x2a')]=function(_0x2cba09,_0x5337e4,_0x99779e){if(!_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x2c')]('text')&&!_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x2c')]('TemplateId')){throw new db[(_0xfd66('0x2d'))][(_0xfd66('0x2e'))](_0xfd66('0x2f'));}else{if(_0x2cba09[_0xfd66('0x2b')]['hasOwnProperty'](_0xfd66('0x30'))&&!_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x2c')](_0xfd66('0x31'))){throw new db[(_0xfd66('0x2d'))]['ValidationError'](_0xfd66('0x32'));}if(!_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x2c')](_0xfd66('0x33'))){throw new db['Sequelize'][(_0xfd66('0x2e'))](_0xfd66('0x34'));}else{try{var _0x8f9103=JSON[_0xfd66('0x35')](_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x33')]);}catch(_0x268d5f){logger[_0xfd66('0x26')](_0x268d5f);throw new db['Sequelize'][(_0xfd66('0x2e'))](_0xfd66('0x36'));}var _0x34dae3=[_0xfd66('0x37'),_0xfd66('0x38'),_0xfd66('0x39'),'openchannelqueue',_0xfd66('0x3a'),_0xfd66('0x3b'),'whatsappqueue',_0xfd66('0x3c'),_0xfd66('0x3d')];if(_[_0xfd66('0x3e')](_0x8f9103,function(_0xbf9ba0){return!_['includes'](_0x34dae3,_0xbf9ba0['model']['toLowerCase']());})){throw new db['Sequelize'][(_0xfd66('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3b74d8={};_0x3b74d8[_0xfd66('0x3f')]=_0x2cba09['body'][_0xfd66('0x2c')](_0xfd66('0x3f'))?_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x3f')]:_0x2cba09[_0xfd66('0x3d')]['fullname'];_0x3b74d8[_0xfd66('0x40')]=_[_0xfd66('0x41')](_0x2cba09['body'][_0xfd66('0x40')])?null:_0x2cba09[_0xfd66('0x2b')]['recipientsDescription'];_0x3b74d8['beep']=_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x42')]||![];_0x3b74d8['SenderId']=_0x2cba09[_0xfd66('0x3d')]['id'];return getContent(_0x2cba09[_0xfd66('0x2b')])[_0xfd66('0x24')](function(_0x2b6ffe){_0x3b74d8[_0xfd66('0x2b')]=_0x2b6ffe;return getRecipients(_0x8f9103);})['then'](function(_0x38cdb6){_0x3b74d8[_0xfd66('0x43')]=_['sortBy'](_0x38cdb6)[_0xfd66('0x44')](',');return db[_0xfd66('0x45')][_0xfd66('0x46')](function(_0x929016){return db[_0xfd66('0x47')][_0xfd66('0x48')](_0x3b74d8,{'raw':!![],'transaction':_0x929016})[_0xfd66('0x24')](function(_0xa4a2ac){var _0x50132e={'sender':_0x3b74d8[_0xfd66('0x3f')],'description':_0x3b74d8[_0xfd66('0x40')],'content':_0x3b74d8[_0xfd66('0x2b')],'beep':_0x3b74d8[_0xfd66('0x42')]};_0x38cdb6['forEach'](function(_0x18c3c8){_0x50132e[_0xfd66('0x49')]=_0x18c3c8;socket['emit'](_0xfd66('0x4a'),_0x50132e);});return _0xa4a2ac;});});})[_0xfd66('0x24')](respondWithResult(_0x5337e4,0xc9))[_0xfd66('0x4b')](handleError(_0x5337e4,null));};function getContent(_0x31a9e7){return new BPromise(function(_0x408d51,_0x331f51){if(_0x31a9e7[_0xfd66('0x4c')]){_0x408d51(_0x31a9e7[_0xfd66('0x4c')]);return;}return db[_0xfd66('0x4d')][_0xfd66('0x4e')]({'attributes':[_0xfd66('0x4f')],'where':{'id':_0x31a9e7['TemplateId']},'raw':!![]})['then'](function(_0x41b6de){if(!_0x41b6de)throw new db['Sequelize'][(_0xfd66('0x2e'))](_0xfd66('0x50'));var _0x4bb541=Mustache[_0xfd66('0x51')](_0x41b6de[_0xfd66('0x4f')],_0x31a9e7[_0xfd66('0x31')]);_0x408d51(_0x4bb541);})[_0xfd66('0x4b')](function(_0xbcfee){_0x331f51(_0xbcfee);});});}function getRecipients(_0x209201){return new BPromise(function(_0x1a100f,_0x58ffc7){var _0x36a961=[];var _0x231739=[];_0x209201['forEach'](function(_0x32fa2d){var _0x1e1c58=_[_0xfd66('0x52')](_0x32fa2d[_0xfd66('0x53')][_0xfd66('0x54')]());if(_0x1e1c58===_0xfd66('0x55')){_0x36a961=_[_0xfd66('0x56')](_0x36a961,_0x32fa2d['ids']);}else{if(_[_0xfd66('0x57')](_0x1e1c58,_0xfd66('0x58')))_0x1e1c58=_0x1e1c58['replace'](_0xfd66('0x58'),_0xfd66('0x59'));_0x32fa2d['ids'][_0xfd66('0x5a')](function(_0x2ad148){_0x231739[_0xfd66('0x5b')](getAgents(_0x1e1c58,_0x2ad148));});}});return BPromise[_0xfd66('0x5c')](_0x231739)[_0xfd66('0x24')](function(_0x56b220){_0x36a961=_[_0xfd66('0x56')](_0x36a961,_['flatten'](_0x56b220));_0x1a100f(_0x36a961);})[_0xfd66('0x4b')](function(_0x18ced0){_0x58ffc7(_0x18ced0);});});}function getAgents(_0x3c7b10,_0x3e9f73){return new BPromise(function(_0x3a4320,_0xb53b67){return db[_0x3c7b10][_0xfd66('0x4e')]({'where':{'id':_0x3e9f73}})[_0xfd66('0x24')](function(_0x4ff198){return _0x4ff198[_0xfd66('0x5d')]({'attributes':['id'],'raw':!![]})[_0xfd66('0x24')](function(_0x2c4c79){var _0x435c3c=_[_0xfd66('0x5e')](_0x2c4c79,'id');_0x3a4320(_0x435c3c);});})[_0xfd66('0x4b')](function(_0x32f4f1){_0xb53b67(_0x32f4f1);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index a7876bc..fb5bc08 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x278f93,_0x5d74c6){var _0x47d224=function(_0x3acef8){while(--_0x3acef8){_0x278f93['push'](_0x278f93['shift']());}};_0x47d224(++_0x5d74c6);}(_0xdb28,0x106));var _0x8db2=function(_0x1a567d,_0x3e6af0){_0x1a567d=_0x1a567d-0x0;var _0x38cf8a=_0xdb28[_0x1a567d];return _0x38cf8a;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file +var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x19cfab,_0x20f3c0){var _0x5e186b=function(_0x55c1aa){while(--_0x55c1aa){_0x19cfab['push'](_0x19cfab['shift']());}};_0x5e186b(++_0x20f3c0);}(_0x757a,0xde));var _0xa757=function(_0x1b8570,_0x4a8149){_0x1b8570=_0x1b8570-0x0;var _0x550202=_0x757a[_0x1b8570];return _0x550202;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index fd29ac9..e73b2b5 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0972=['define','notifications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','rimraf','../../config/environment','./notification.attributes','exports'];(function(_0x1a72cb,_0x2ed497){var _0x271e70=function(_0x4a5c26){while(--_0x4a5c26){_0x1a72cb['push'](_0x1a72cb['shift']());}};_0x271e70(++_0x2ed497);}(_0x0972,0x64));var _0x2097=function(_0x32cfe6,_0x2a55bb){_0x32cfe6=_0x32cfe6-0x0;var _0xa13e0b=_0x0972[_0x32cfe6];return _0xa13e0b;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('Notification',attributes,{'tableName':_0x2097('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2097('0xa'),'collate':_0x2097('0xb')});}; \ No newline at end of file +var _0x6cb4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./notification.attributes','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6cb4,0xff));var _0x46cb=function(_0x51b654,_0xcb5006){_0x51b654=_0x51b654-0x0;var _0x26dedf=_0x6cb4[_0x51b654];return _0x26dedf;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46cb('0xd'),'collate':_0x46cb('0xe')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 9672e16..925429b 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf71=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x28a0b3,_0x39b7d1){var _0x4fd5f3=function(_0x507988){while(--_0x507988){_0x28a0b3['push'](_0x28a0b3['shift']());}};_0x4fd5f3(++_0x39b7d1);}(_0xbf71,0x127));var _0x1bf7=function(_0x425565,_0x4f15e1){_0x425565=_0x425565-0x0;var _0x3db3a9=_0xbf71[_0x425565];return _0x3db3a9;};'use strict';var _=require(_0x1bf7('0x0'));var util=require(_0x1bf7('0x1'));var moment=require('moment');var BPromise=require(_0x1bf7('0x2'));var rs=require(_0x1bf7('0x3'));var fs=require('fs');var Redis=require(_0x1bf7('0x4'));var db=require(_0x1bf7('0x5'))['db'];var utils=require(_0x1bf7('0x6'));var logger=require(_0x1bf7('0x7'))(_0x1bf7('0x8'));var config=require('../../config/environment');var jayson=require(_0x1bf7('0x9'));var client=jayson['client'][_0x1bf7('0xa')]({'port':0x232a});config['redis']=_[_0x1bf7('0xb')](config[_0x1bf7('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1bf7('0xc')]));require(_0x1bf7('0xd'))[_0x1bf7('0xe')](socket);function respondWithRpcPromise(_0x19e7ea,_0x3dc109,_0x436a9a){return new BPromise(function(_0x527d0b,_0x4610b7){return client[_0x1bf7('0xf')](_0x19e7ea,_0x436a9a)[_0x1bf7('0x10')](function(_0x17ab3d){logger[_0x1bf7('0x11')](_0x1bf7('0x12'),_0x3dc109,_0x1bf7('0x13'));logger[_0x1bf7('0x14')](_0x1bf7('0x15'),_0x3dc109,_0x1bf7('0x13'),JSON['stringify'](_0x17ab3d));if(_0x17ab3d[_0x1bf7('0x16')]){if(_0x17ab3d[_0x1bf7('0x16')][_0x1bf7('0x17')]===0x1f4){logger[_0x1bf7('0x16')](_0x1bf7('0x12'),_0x3dc109,_0x17ab3d[_0x1bf7('0x16')][_0x1bf7('0x18')]);return _0x4610b7(_0x17ab3d[_0x1bf7('0x16')][_0x1bf7('0x18')]);}logger[_0x1bf7('0x16')](_0x1bf7('0x12'),_0x3dc109,_0x17ab3d[_0x1bf7('0x16')][_0x1bf7('0x18')]);return _0x527d0b(_0x17ab3d['error'][_0x1bf7('0x18')]);}else{logger[_0x1bf7('0x11')](_0x1bf7('0x12'),_0x3dc109,_0x1bf7('0x13'));_0x527d0b(_0x17ab3d[_0x1bf7('0x19')]['message']);}})[_0x1bf7('0x1a')](function(_0x5132d6){logger[_0x1bf7('0x16')](_0x1bf7('0x12'),_0x3dc109,_0x5132d6);_0x4610b7(_0x5132d6);});});} \ No newline at end of file +var _0x9968=['Notification,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./notification.socket','request','Notification,\x20%s,\x20%s','request\x20sent'];(function(_0x3f29ce,_0x3d63ae){var _0x29a47e=function(_0x196596){while(--_0x196596){_0x3f29ce['push'](_0x3f29ce['shift']());}};_0x29a47e(++_0x3d63ae);}(_0x9968,0x9b));var _0x8996=function(_0x20f6c4,_0x657aaf){_0x20f6c4=_0x20f6c4-0x0;var _0x48f055=_0x9968[_0x20f6c4];return _0x48f055;};'use strict';var _=require(_0x8996('0x0'));var util=require(_0x8996('0x1'));var moment=require(_0x8996('0x2'));var BPromise=require(_0x8996('0x3'));var rs=require(_0x8996('0x4'));var fs=require('fs');var Redis=require(_0x8996('0x5'));var db=require(_0x8996('0x6'))['db'];var utils=require(_0x8996('0x7'));var logger=require(_0x8996('0x8'))(_0x8996('0x9'));var config=require('../../config/environment');var jayson=require(_0x8996('0xa'));var client=jayson[_0x8996('0xb')][_0x8996('0xc')]({'port':0x232a});config[_0x8996('0xd')]=_['defaults'](config[_0x8996('0xd')],{'host':_0x8996('0xe'),'port':0x18eb});var socket=require(_0x8996('0xf'))(new Redis(config['redis']));require(_0x8996('0x10'))['register'](socket);function respondWithRpcPromise(_0x36bbd7,_0x2a8086,_0x1330f9){return new BPromise(function(_0x2df763,_0x405b40){return client[_0x8996('0x11')](_0x36bbd7,_0x1330f9)['then'](function(_0x3b837c){logger['info'](_0x8996('0x12'),_0x2a8086,_0x8996('0x13'));logger['debug'](_0x8996('0x14'),_0x2a8086,'request\x20sent',JSON['stringify'](_0x3b837c));if(_0x3b837c[_0x8996('0x15')]){if(_0x3b837c[_0x8996('0x15')][_0x8996('0x16')]===0x1f4){logger[_0x8996('0x15')]('Notification,\x20%s,\x20%s',_0x2a8086,_0x3b837c['error'][_0x8996('0x17')]);return _0x405b40(_0x3b837c[_0x8996('0x15')][_0x8996('0x17')]);}logger['error']('Notification,\x20%s,\x20%s',_0x2a8086,_0x3b837c[_0x8996('0x15')][_0x8996('0x17')]);return _0x2df763(_0x3b837c[_0x8996('0x15')]['message']);}else{logger['info']('Notification,\x20%s,\x20%s',_0x2a8086,_0x8996('0x13'));_0x2df763(_0x3b837c['result'][_0x8996('0x17')]);}})[_0x8996('0x18')](function(_0x4fb705){logger[_0x8996('0x15')](_0x8996('0x12'),_0x2a8086,_0x4fb705);_0x405b40(_0x4fb705);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 272edf5..67db967 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x620f=['save','remove','update','emit','removeListener','register','length','notification:'];(function(_0x13e0ae,_0x8b5ca5){var _0x1dbc69=function(_0x2dfc90){while(--_0x2dfc90){_0x13e0ae['push'](_0x13e0ae['shift']());}};_0x1dbc69(++_0x8b5ca5);}(_0x620f,0xe8));var _0xf620=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x620f[_0x3ab51d];return _0x29a04e;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0xf620('0x0'),_0xf620('0x1'),_0xf620('0x2')];function createListener(_0x3c3b7f,_0x11ada5){return function(_0x5a956f){_0x11ada5[_0xf620('0x3')](_0x3c3b7f,_0x5a956f);};}function removeListener(_0x25df40,_0x3c865c){return function(){NotificationEvents[_0xf620('0x4')](_0x25df40,_0x3c865c);};}exports[_0xf620('0x5')]=function(_0x8dd0d7){for(var _0x1d0865=0x0,_0x57e9f4=events[_0xf620('0x6')];_0x1d0865<_0x57e9f4;_0x1d0865++){var _0x3c4121=events[_0x1d0865];var _0x3e74df=createListener(_0xf620('0x7')+_0x3c4121,_0x8dd0d7);NotificationEvents['on'](_0x3c4121,_0x3e74df);}}; \ No newline at end of file +var _0xd1a4=['emit','removeListener','register','length','notification:','./notification.events','save','remove','update'];(function(_0x3cfc6c,_0x56dd3d){var _0x4187c5=function(_0x321034){while(--_0x321034){_0x3cfc6c['push'](_0x3cfc6c['shift']());}};_0x4187c5(++_0x56dd3d);}(_0xd1a4,0x1b5));var _0x4d1a=function(_0x4b4132,_0x3ecb4e){_0x4b4132=_0x4b4132-0x0;var _0x2a89f3=_0xd1a4[_0x4b4132];return _0x2a89f3;};'use strict';var NotificationEvents=require(_0x4d1a('0x0'));var events=[_0x4d1a('0x1'),_0x4d1a('0x2'),_0x4d1a('0x3')];function createListener(_0x1866ea,_0x53661b){return function(_0x223834){_0x53661b[_0x4d1a('0x4')](_0x1866ea,_0x223834);};}function removeListener(_0x4af35a,_0x301c79){return function(){NotificationEvents[_0x4d1a('0x5')](_0x4af35a,_0x301c79);};}exports[_0x4d1a('0x6')]=function(_0x3c82ca){for(var _0xfe7deb=0x0,_0x58c3c7=events[_0x4d1a('0x7')];_0xfe7deb<_0x58c3c7;_0xfe7deb++){var _0x3ceec3=events[_0xfe7deb];var _0x50c6d3=createListener(_0x4d1a('0x8')+_0x3ceec3,_0x3c82ca);NotificationEvents['on'](_0x3ceec3,_0x50c6d3);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8b91871..4bb18c7 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 _0x80d6=['/:id/canned_answers','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','/:id/applications','addAgents','send','update','delete','destroy','removeDispositions'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x80d6,0xa0));var _0x680d=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0x80d6[_0x5f382f];return _0x3bb11b;};'use strict';var multer=require(_0x680d('0x0'));var util=require('util');var path=require(_0x680d('0x1'));var timeout=require(_0x680d('0x2'));var express=require(_0x680d('0x3'));var router=express['Router']();var auth=require(_0x680d('0x4'));var interaction=require(_0x680d('0x5'));var config=require(_0x680d('0x6'));var controller=require(_0x680d('0x7'));router[_0x680d('0x8')]('/',auth['isAuthenticated'](),controller[_0x680d('0x9')]);router[_0x680d('0x8')](_0x680d('0xa'),auth[_0x680d('0xb')](),controller[_0x680d('0xc')]);router[_0x680d('0x8')](_0x680d('0xd'),auth['isAuthenticated'](),controller[_0x680d('0xe')]);router[_0x680d('0x8')](_0x680d('0xf'),auth[_0x680d('0xb')](),controller[_0x680d('0x10')]);router[_0x680d('0x8')]('/:id/canned_answers',auth[_0x680d('0xb')](),controller[_0x680d('0x11')]);router[_0x680d('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x680d('0x12')]);router[_0x680d('0x8')](_0x680d('0x13'),auth['isAuthenticated'](),controller[_0x680d('0x14')]);router[_0x680d('0x8')](_0x680d('0x15'),auth['isAuthenticated'](),controller[_0x680d('0x16')]);router[_0x680d('0x17')]('/',auth[_0x680d('0xb')](),controller[_0x680d('0x18')]);router[_0x680d('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x680d('0x19')]);router[_0x680d('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x680d('0x1a')]);router[_0x680d('0x17')]('/:id/notify',controller[_0x680d('0x1b')]);router[_0x680d('0x17')](_0x680d('0x1c'),auth[_0x680d('0xb')](),controller['addApplications']);router[_0x680d('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x680d('0x1d')]);router[_0x680d('0x17')]('/:id/send',auth[_0x680d('0xb')](),controller[_0x680d('0x1e')]);router['put'](_0x680d('0xd'),auth[_0x680d('0xb')](),controller[_0x680d('0x1f')]);router[_0x680d('0x20')](_0x680d('0xd'),auth[_0x680d('0xb')](),controller[_0x680d('0x21')]);router[_0x680d('0x20')](_0x680d('0xf'),auth[_0x680d('0xb')](),controller[_0x680d('0x22')]);router[_0x680d('0x20')](_0x680d('0x23'),auth[_0x680d('0xb')](),controller[_0x680d('0x24')]);router[_0x680d('0x20')](_0x680d('0x15'),auth[_0x680d('0xb')](),controller[_0x680d('0x25')]);module[_0x680d('0x26')]=router; \ No newline at end of file +var _0x05f1=['multer','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','show','/:id/dispositions','isAuthenticated','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0x2bfa87,_0x3e4c3b){var _0xca164d=function(_0x2cfee3){while(--_0x2cfee3){_0x2bfa87['push'](_0x2bfa87['shift']());}};_0xca164d(++_0x3e4c3b);}(_0x05f1,0x88));var _0x105f=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x05f1[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x105f('0x0'));var util=require('util');var path=require(_0x105f('0x1'));var timeout=require('connect-timeout');var express=require(_0x105f('0x2'));var router=express[_0x105f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x105f('0x4'));var config=require(_0x105f('0x5'));var controller=require(_0x105f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x105f('0x7')]);router[_0x105f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x105f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x105f('0x9')]);router['get'](_0x105f('0xa'),auth[_0x105f('0xb')](),controller['getDispositions']);router['get'](_0x105f('0xc'),auth[_0x105f('0xb')](),controller[_0x105f('0xd')]);router[_0x105f('0x8')](_0x105f('0xe'),auth[_0x105f('0xb')](),controller[_0x105f('0xf')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x105f('0x10')]);router[_0x105f('0x8')](_0x105f('0x11'),auth[_0x105f('0xb')](),controller[_0x105f('0x12')]);router[_0x105f('0x13')]('/',auth[_0x105f('0xb')](),controller['create']);router[_0x105f('0x13')](_0x105f('0xa'),auth['isAuthenticated'](),controller[_0x105f('0x14')]);router['post'](_0x105f('0xc'),auth[_0x105f('0xb')](),controller[_0x105f('0x15')]);router['post']('/:id/notify',controller[_0x105f('0x16')]);router[_0x105f('0x13')]('/:id/applications',auth[_0x105f('0xb')](),controller[_0x105f('0x17')]);router[_0x105f('0x13')]('/:id/users',auth[_0x105f('0xb')](),controller[_0x105f('0x18')]);router[_0x105f('0x13')](_0x105f('0x19'),auth[_0x105f('0xb')](),controller['send']);router['put'](_0x105f('0x1a'),auth[_0x105f('0xb')](),controller[_0x105f('0x1b')]);router[_0x105f('0x1c')]('/:id',auth[_0x105f('0xb')](),controller[_0x105f('0x1d')]);router[_0x105f('0x1c')]('/:id/dispositions',auth[_0x105f('0xb')](),controller[_0x105f('0x1e')]);router[_0x105f('0x1c')](_0x105f('0xc'),auth[_0x105f('0xb')](),controller[_0x105f('0x1f')]);router[_0x105f('0x1c')](_0x105f('0x11'),auth[_0x105f('0xb')](),controller[_0x105f('0x20')]);module[_0x105f('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index dc85a42..22f1f07 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 _0x3828=['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','randomstring','exports','STRING','name'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x3828,0xe3));var _0x8382=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3828[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8382('0x0'));module[_0x8382('0x1')]={'name':{'type':Sequelize[_0x8382('0x2')],'unique':_0x8382('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8382('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8382('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8382('0x4')],'defaultValue':function(){return _0x8382('0x5');}},'notificationSound':{'type':Sequelize[_0x8382('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8382('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8382('0x2')]},'queueTransfer':{'type':Sequelize[_0x8382('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8382('0x7')],'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[_0x8382('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x8382('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8382('0x9'),'set':function(_0x28ded1){if(!_0x28ded1)this[_0x8382('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x28ded1);}}}; \ No newline at end of file +var _0x46fc=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x3efa2a,_0x4aa529){var _0x49b4f3=function(_0x5953bc){while(--_0x5953bc){_0x3efa2a['push'](_0x3efa2a['shift']());}};_0x49b4f3(++_0x4aa529);}(_0x46fc,0x1b1));var _0xc46f=function(_0x28e69f,_0x3ce461){_0x28e69f=_0x28e69f-0x0;var _0x1beff1=_0x46fc[_0x28e69f];return _0x1beff1;};'use strict';var Sequelize=require(_0xc46f('0x0'));var rs=require(_0xc46f('0x1'));module[_0xc46f('0x2')]={'name':{'type':Sequelize[_0xc46f('0x3')],'unique':_0xc46f('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xc46f('0x3')]},'token':{'type':Sequelize[_0xc46f('0x3')],'defaultValue':function(){return rs[_0xc46f('0x5')]();}},'replyUri':{'type':Sequelize[_0xc46f('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc46f('0x6')],'defaultValue':function(){return _0xc46f('0x7');}},'notificationSound':{'type':Sequelize[_0xc46f('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc46f('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc46f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xc46f('0x3')]},'queueTransfer':{'type':Sequelize[_0xc46f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc46f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc46f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc46f('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xc46f('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2e8551){if(!_0x2e8551)this[_0xc46f('0xb')](_0xc46f('0xc'),null);this[_0xc46f('0xb')]('mandatoryDisposition',_0x2e8551);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a0786c5..2975c1c 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 _0x8a8a=['map','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','type','VIRTUAL','filter','options','OpenchannelAccount','include','findAll','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','intersection','order','merge','includeAll','removeDispositions','ids','OpenchannelAccountId','CannedAnswer','rawAttributes','rows','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','account','Applications','list','applications','priority','asc','Contacts','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','get','created','autoclose','close','*,*,*,*','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','Start','EventManager','sequelize','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','fullname','internal','Tags','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','send','out','OpenchannelMessage','dataValues','Messages','push','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','OpenchannelAccounts','UserProfileResource','end','name','index','mandatoryDispositionPause'];(function(_0x2de7ce,_0x248799){var _0xa621d0=function(_0x440c62){while(--_0x440c62){_0x2de7ce['push'](_0x2de7ce['shift']());}};_0xa621d0(++_0x248799);}(_0x8a8a,0x1eb));var _0xa8a8=function(_0x58a57b,_0x176230){_0x58a57b=_0x58a57b-0x0;var _0x36c35e=_0x8a8a[_0x58a57b];return _0x36c35e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa8a8('0x0'));var rimraf=require(_0xa8a8('0x1'));var zipdir=require(_0xa8a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8a8('0x3'));var moment=require(_0xa8a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8a8('0x5'));var util=require(_0xa8a8('0x6'));var path=require(_0xa8a8('0x7'));var sox=require(_0xa8a8('0x8'));var csv=require(_0xa8a8('0x9'));var ejs=require(_0xa8a8('0xa'));var fs=require('fs');var _=require(_0xa8a8('0xb'));var squel=require(_0xa8a8('0xc'));var crypto=require(_0xa8a8('0xd'));var jsforce=require(_0xa8a8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa8a8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa8a8('0xf'));var authService=require(_0xa8a8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa8a8('0x11'));var hardwareService=require(_0xa8a8('0x12'));var logger=require('../../config/logger')(_0xa8a8('0x13'));var utils=require(_0xa8a8('0x14'));var config=require(_0xa8a8('0x15'));var db=require(_0xa8a8('0x16'))['db'];config[_0xa8a8('0x17')]=_[_0xa8a8('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa8a8('0x19'))(new Redis(config[_0xa8a8('0x17')]));require(_0xa8a8('0x1a'))[_0xa8a8('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xa8a8('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x1d2629,_0x506694,_0x31a33e){if(_0x31a33e){var _0x5b7f7c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b7f7c[_0xa8a8('0x1d')](_0x506694)){return _0x1d2629;}else{throw new db[(_0xa8a8('0x1e'))][(_0xa8a8('0x1f'))](_0xa8a8('0x20'));}}else{return _0x1d2629;}}function respondWithRpcPromise(_0x529e53,_0x33a75e,_0x2d2853,_0x1f47eb){return new BPromise(function(_0x2259b8,_0xeaefc5){var _0x564a08=_0x1f47eb||client;return _0x564a08[_0xa8a8('0x21')](_0x529e53,_0x2d2853)['then'](function(_0x197ae8){logger[_0xa8a8('0x22')](_0xa8a8('0x23'),_0x33a75e,'request\x20sent');logger[_0xa8a8('0x24')](_0xa8a8('0x25'),_0x33a75e,_0xa8a8('0x26'),JSON[_0xa8a8('0x27')](_0x197ae8));if(_0x197ae8[_0xa8a8('0x28')]){if(_0x197ae8['error'][_0xa8a8('0x29')]===0x1f4){logger[_0xa8a8('0x28')](_0xa8a8('0x23'),_0x33a75e,_0x197ae8[_0xa8a8('0x28')]['message']);return _0xeaefc5(_0x197ae8[_0xa8a8('0x28')]['message']);}logger[_0xa8a8('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x33a75e,_0x197ae8[_0xa8a8('0x28')][_0xa8a8('0x2a')]);return _0x2259b8(_0x197ae8[_0xa8a8('0x28')][_0xa8a8('0x2a')]);}else{logger['info'](_0xa8a8('0x23'),_0x33a75e,_0xa8a8('0x26'));_0x2259b8(_0x197ae8[_0xa8a8('0x2b')]['message']);}})[_0xa8a8('0x2c')](function(_0x1427a0){logger[_0xa8a8('0x28')](_0xa8a8('0x23'),_0x33a75e,_0x1427a0);_0xeaefc5(_0x1427a0);});});}function respondWithStatusCode(_0xee2e5a,_0x541aa0){_0x541aa0=_0x541aa0||0xcc;return function(_0x493db9){if(_0x493db9){return _0xee2e5a[_0xa8a8('0x2d')](_0x541aa0);}return _0xee2e5a[_0xa8a8('0x2e')](_0x541aa0)['end']();};}function respondWithResult(_0x2a4a75,_0x56d3f1){_0x56d3f1=_0x56d3f1||0xc8;return function(_0x5ccd5a){if(_0x5ccd5a){return _0x2a4a75[_0xa8a8('0x2e')](_0x56d3f1)['json'](_0x5ccd5a);}};}function respondWithFilteredResult(_0x79b60c,_0x24565a){return function(_0x34995e){if(_0x34995e){var _0x1a7c79=_0x34995e[_0xa8a8('0x2f')],_0x5d5da0=_0x24565a['offset'],_0x124afc=_0x24565a[_0xa8a8('0x30')]+_0x24565a[_0xa8a8('0x31')],_0x39b1e4;if(_0x124afc>=_0x1a7c79){_0x124afc=_0x1a7c79;_0x39b1e4=0xc8;}else{_0x39b1e4=0xce;}_0x79b60c['status'](_0x39b1e4);return _0x79b60c[_0xa8a8('0x32')](_0xa8a8('0x33'),_0x5d5da0+'-'+_0x124afc+'/'+_0x1a7c79)[_0xa8a8('0x34')](_0x34995e);}return null;};}function patchUpdates(_0x369b6d){return function(_0x506f79){try{jsonpatch[_0xa8a8('0x35')](_0x506f79,_0x369b6d,!![]);}catch(_0x96018f){return BPromise[_0xa8a8('0x36')](_0x96018f);}return _0x506f79['save']();};}function saveUpdates(_0xa57bf5,_0x1c1bbe){return function(_0x3cb0b9){if(_0x3cb0b9){return _0x3cb0b9[_0xa8a8('0x37')](_0xa57bf5)[_0xa8a8('0x38')](function(_0x37914a){return _0x37914a;});}return null;};}function removeEntity(_0x813c9f,_0x24ea86){return function(_0x39b6a2){if(_0x39b6a2){return _0x39b6a2[_0xa8a8('0x39')]()[_0xa8a8('0x38')](function(){var _0x443c44=_0x39b6a2['get']({'plain':!![]});var _0x7a5364=_0xa8a8('0x3a');return db[_0xa8a8('0x3b')][_0xa8a8('0x39')]({'where':{'type':_0x7a5364,'resourceId':_0x443c44['id']}})[_0xa8a8('0x38')](function(){return _0x39b6a2;});})[_0xa8a8('0x38')](function(){_0x813c9f[_0xa8a8('0x2e')](0xcc)[_0xa8a8('0x3c')]();});}};}function handleEntityNotFound(_0xf03f00,_0x42e435){return function(_0x10218d){if(!_0x10218d){_0xf03f00[_0xa8a8('0x2d')](0x194);}return _0x10218d;};}function handleError(_0x22ad12,_0x8f77cd){_0x8f77cd=_0x8f77cd||0x1f4;return function(_0x243bce){logger[_0xa8a8('0x28')](_0x243bce['stack']);if(_0x243bce[_0xa8a8('0x3d')]){delete _0x243bce['name'];}_0x22ad12[_0xa8a8('0x2e')](_0x8f77cd)['send'](_0x243bce);};}exports[_0xa8a8('0x3e')]=function(_0x132541,_0x296f1b){var _0x41a5ec={'include':[{'model':db['Pause'],'as':_0xa8a8('0x3f')}]},_0x5b24fb={},_0x392177={'count':0x0,'rows':[]};var _0x319485=_[_0xa8a8('0x40')](db['OpenchannelAccount']['rawAttributes'],function(_0x4487ce){return{'name':_0x4487ce[_0xa8a8('0x41')],'type':_0x4487ce['type']['key']};});_0x5b24fb[_0xa8a8('0x42')]=_[_0xa8a8('0x40')](_0x319485,_0xa8a8('0x3d'));_0x5b24fb[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x132541[_0xa8a8('0x43')]);_0x5b24fb[_0xa8a8('0x45')]=_['intersection'](_0x5b24fb[_0xa8a8('0x42')],_0x5b24fb[_0xa8a8('0x43')]);_0x41a5ec[_0xa8a8('0x46')]=_['intersection'](_0x5b24fb[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x132541[_0xa8a8('0x43')][_0xa8a8('0x47')]));_0x41a5ec[_0xa8a8('0x46')]=_0x41a5ec[_0xa8a8('0x46')][_0xa8a8('0x48')]?_0x41a5ec['attributes']:_0x5b24fb[_0xa8a8('0x42')];if(!_0x132541['query'][_0xa8a8('0x49')](_0xa8a8('0x4a'))){_0x41a5ec[_0xa8a8('0x31')]=qs[_0xa8a8('0x31')](_0x132541[_0xa8a8('0x43')][_0xa8a8('0x31')]);_0x41a5ec[_0xa8a8('0x30')]=qs[_0xa8a8('0x30')](_0x132541[_0xa8a8('0x43')]['offset']);}_0x41a5ec['order']=qs[_0xa8a8('0x4b')](_0x132541[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x41a5ec['where']=qs[_0xa8a8('0x45')](_[_0xa8a8('0x4c')](_0x132541[_0xa8a8('0x43')],_0x5b24fb[_0xa8a8('0x45')]),_0x319485);if(_0x132541[_0xa8a8('0x43')]['filter']){_0x41a5ec[_0xa8a8('0x4d')]=_['merge'](_0x41a5ec[_0xa8a8('0x4d')],{'$or':_['map'](_0x319485,function(_0x144dc3){if(_0x144dc3[_0xa8a8('0x4e')]!==_0xa8a8('0x4f')){var _0x5441f8={};_0x5441f8[_0x144dc3[_0xa8a8('0x3d')]]={'$like':'%'+_0x132541[_0xa8a8('0x43')][_0xa8a8('0x50')]+'%'};return _0x5441f8;}})});}_0x41a5ec=_['merge']({},_0x41a5ec,_0x132541[_0xa8a8('0x51')]);var _0x2dcb4d={'where':_0x41a5ec[_0xa8a8('0x4d')]};return db[_0xa8a8('0x52')]['count'](_0x2dcb4d)[_0xa8a8('0x38')](function(_0x1d3c1b){_0x392177[_0xa8a8('0x2f')]=_0x1d3c1b;if(_0x132541[_0xa8a8('0x43')]['includeAll']){_0x41a5ec[_0xa8a8('0x53')]=[{'all':!![]}];}return db[_0xa8a8('0x52')][_0xa8a8('0x54')](_0x41a5ec);})[_0xa8a8('0x38')](function(_0x8c3dc1){_0x392177['rows']=_0x8c3dc1;return _0x392177;})['then'](respondWithFilteredResult(_0x296f1b,_0x41a5ec))[_0xa8a8('0x2c')](handleError(_0x296f1b,null));};exports['show']=function(_0x50c3bc,_0x4f9cc0){var _0x35f816={'raw':![],'where':{'id':_0x50c3bc[_0xa8a8('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xa8a8('0x3f')}]},_0x26a998={};_0x26a998[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db['OpenchannelAccount']['rawAttributes']);_0x26a998[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x50c3bc['query']);_0x26a998[_0xa8a8('0x45')]=_['intersection'](_0x26a998['model'],_0x26a998[_0xa8a8('0x43')]);_0x35f816['attributes']=_['intersection'](_0x26a998[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x50c3bc[_0xa8a8('0x43')][_0xa8a8('0x47')]));_0x35f816[_0xa8a8('0x46')]=_0x35f816['attributes'][_0xa8a8('0x48')]?_0x35f816[_0xa8a8('0x46')]:_0x26a998[_0xa8a8('0x42')];if(_0x50c3bc[_0xa8a8('0x43')]['includeAll']){_0x35f816[_0xa8a8('0x53')]=[{'all':!![]}];}_0x35f816=_['merge']({},_0x35f816,_0x50c3bc[_0xa8a8('0x51')]);return db[_0xa8a8('0x52')][_0xa8a8('0x56')](_0x35f816)['then'](handleEntityNotFound(_0x4f9cc0,null))[_0xa8a8('0x38')](respondWithResult(_0x4f9cc0,null))[_0xa8a8('0x2c')](handleError(_0x4f9cc0,null));};exports[_0xa8a8('0x57')]=function(_0xa39012,_0x29b988){return db[_0xa8a8('0x52')][_0xa8a8('0x57')](_0xa39012[_0xa8a8('0x58')],{})['then'](function(_0xa73f54){var _0x548da1=_0xa39012[_0xa8a8('0x59')]['get']({'plain':!![]});if(!_0x548da1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x548da1[_0xa8a8('0x5a')]===_0xa8a8('0x59')){var _0xf0e5ca=_0xa73f54['get']({'plain':!![]});var _0x24f1ae='OpenchannelAccounts';return db[_0xa8a8('0x5b')][_0xa8a8('0x56')]({'where':{'name':_0x24f1ae,'userProfileId':_0x548da1[_0xa8a8('0x5c')]},'raw':!![]})['then'](function(_0x11d134){if(_0x11d134&&_0x11d134[_0xa8a8('0x5d')]===0x0){return db[_0xa8a8('0x3b')]['create']({'name':_0xf0e5ca['name'],'resourceId':_0xf0e5ca['id'],'type':_0x11d134[_0xa8a8('0x3d')],'sectionId':_0x11d134['id']},{})[_0xa8a8('0x38')](function(){return _0xa73f54;});}else{return _0xa73f54;}})[_0xa8a8('0x2c')](function(_0x2c1e6e){logger[_0xa8a8('0x28')](_0xa8a8('0x5e'),_0x2c1e6e);throw _0x2c1e6e;});}return _0xa73f54;})['then'](respondWithResult(_0x29b988,0xc9))[_0xa8a8('0x2c')](handleError(_0x29b988,null));};exports[_0xa8a8('0x37')]=function(_0x19e4ee,_0x4c6bc0){if(_0x19e4ee[_0xa8a8('0x58')]['id']){delete _0x19e4ee[_0xa8a8('0x58')]['id'];}return db[_0xa8a8('0x52')][_0xa8a8('0x56')]({'where':{'id':_0x19e4ee['params']['id']},'include':[{'model':db[_0xa8a8('0x5f')],'as':_0xa8a8('0x3f')}]})['then'](handleEntityNotFound(_0x4c6bc0,null))[_0xa8a8('0x38')](saveUpdates(_0x19e4ee['body'],null))[_0xa8a8('0x38')](respondWithResult(_0x4c6bc0,null))[_0xa8a8('0x2c')](handleError(_0x4c6bc0,null));};exports[_0xa8a8('0x39')]=function(_0x51be4f,_0x3e0f3d){return db[_0xa8a8('0x52')][_0xa8a8('0x56')]({'where':{'id':_0x51be4f['params']['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e0f3d,null))[_0xa8a8('0x38')](removeEntity(_0x3e0f3d,null))[_0xa8a8('0x2c')](handleError(_0x3e0f3d,null));};exports['describe']=function(_0x37e2d7,_0x4f8152){return db['OpenchannelAccount'][_0xa8a8('0x60')]()[_0xa8a8('0x38')](respondWithResult(_0x4f8152,null))['catch'](handleError(_0x4f8152,null));};exports[_0xa8a8('0x61')]=function(_0x65576b,_0x432269,_0x5ab1e6){if(_0x65576b[_0xa8a8('0x58')]['id']){delete _0x65576b[_0xa8a8('0x58')]['id'];}return db[_0xa8a8('0x52')][_0xa8a8('0x56')]({'where':{'id':_0x65576b['params']['id']}})['then'](handleEntityNotFound(_0x432269,null))[_0xa8a8('0x38')](function(_0x3639cf){if(_0x3639cf){_0x65576b[_0xa8a8('0x58')][_0xa8a8('0x62')]=_0x3639cf['id'];return db[_0xa8a8('0x63')]['create'](_0x65576b['body']);}})[_0xa8a8('0x38')](respondWithResult(_0x432269,null))['catch'](handleError(_0x432269,null));};exports[_0xa8a8('0x64')]=function(_0x4a1dda,_0x58f970,_0xd30d08){var _0x31efd9={'raw':![],'where':{}};var _0x5e3cc3={};var _0x401f00={'count':0x0,'rows':[]};return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x4a1dda[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x58f970,null))[_0xa8a8('0x38')](function(_0x1baf9b){if(_0x1baf9b){_0x5e3cc3[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db['Disposition']['rawAttributes']);_0x5e3cc3[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x4a1dda[_0xa8a8('0x43')]);_0x5e3cc3[_0xa8a8('0x45')]=_[_0xa8a8('0x66')](_0x5e3cc3[_0xa8a8('0x42')],_0x5e3cc3[_0xa8a8('0x43')]);_0x31efd9[_0xa8a8('0x46')]=_[_0xa8a8('0x66')](_0x5e3cc3[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x4a1dda['query'][_0xa8a8('0x47')]));_0x31efd9[_0xa8a8('0x46')]=_0x31efd9[_0xa8a8('0x46')][_0xa8a8('0x48')]?_0x31efd9['attributes']:_0x5e3cc3[_0xa8a8('0x42')];if(!_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x49')](_0xa8a8('0x4a'))){_0x31efd9[_0xa8a8('0x31')]=qs['limit'](_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x31')]);_0x31efd9[_0xa8a8('0x30')]=qs['offset'](_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x30')]);}_0x31efd9[_0xa8a8('0x67')]=qs[_0xa8a8('0x4b')](_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x31efd9[_0xa8a8('0x4d')]=qs[_0xa8a8('0x45')](_[_0xa8a8('0x4c')](_0x4a1dda[_0xa8a8('0x43')],_0x5e3cc3[_0xa8a8('0x45')]));_0x31efd9[_0xa8a8('0x4d')]['OpenchannelAccountId']=_0x1baf9b['id'];if(_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x50')]){_0x31efd9[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x31efd9['where'],{'$or':_[_0xa8a8('0x40')](_0x31efd9[_0xa8a8('0x46')],function(_0x5f41e0){var _0x5d55d1={};_0x5d55d1[_0x5f41e0]={'$like':'%'+_0x4a1dda[_0xa8a8('0x43')]['filter']+'%'};return _0x5d55d1;})});}_0x31efd9=_[_0xa8a8('0x68')]({},_0x31efd9,_0x4a1dda['options']);return db[_0xa8a8('0x63')][_0xa8a8('0x2f')]({'where':_0x31efd9[_0xa8a8('0x4d')]})[_0xa8a8('0x38')](function(_0x5a1596){_0x401f00[_0xa8a8('0x2f')]=_0x5a1596;if(_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x69')]){_0x31efd9[_0xa8a8('0x53')]=[{'all':!![]}];}return db[_0xa8a8('0x63')][_0xa8a8('0x54')](_0x31efd9);})[_0xa8a8('0x38')](function(_0x3bb738){_0x401f00['rows']=_0x3bb738;return _0x401f00;});}})[_0xa8a8('0x38')](respondWithFilteredResult(_0x58f970,_0x31efd9))[_0xa8a8('0x2c')](handleError(_0x58f970,null));};exports[_0xa8a8('0x6a')]=function(_0x151458,_0x418be3,_0x28c909){return db['OpenchannelAccount'][_0xa8a8('0x56')]({'where':{'id':_0x151458['params']['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x418be3,null))[_0xa8a8('0x38')](function(_0x940ddf){if(_0x940ddf){return _0x940ddf[_0xa8a8('0x6a')](_0x151458[_0xa8a8('0x43')][_0xa8a8('0x6b')]);}})[_0xa8a8('0x38')](respondWithStatusCode(_0x418be3,null))[_0xa8a8('0x2c')](handleError(_0x418be3,null));};exports['addAnswer']=function(_0xdf8174,_0x5d2c61,_0x2fa366){if(_0xdf8174[_0xa8a8('0x58')]['id']){delete _0xdf8174[_0xa8a8('0x58')]['id'];}return db[_0xa8a8('0x52')]['find']({'where':{'id':_0xdf8174['params']['id']}})['then'](handleEntityNotFound(_0x5d2c61,null))['then'](function(_0x3baec6){if(_0x3baec6){_0xdf8174[_0xa8a8('0x58')][_0xa8a8('0x6c')]=_0x3baec6['id'];return db[_0xa8a8('0x6d')][_0xa8a8('0x57')](_0xdf8174['body']);}})['then'](respondWithResult(_0x5d2c61,null))['catch'](handleError(_0x5d2c61,null));};exports['getAnswers']=function(_0x46207a,_0x4f003d,_0x5a26e8){var _0x1623af={'raw':![],'where':{}};var _0x1816a0={};var _0x25dce1={'count':0x0,'rows':[]};return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x46207a[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x4f003d,null))[_0xa8a8('0x38')](function(_0x31fbb1){if(_0x31fbb1){_0x1816a0[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db[_0xa8a8('0x6d')][_0xa8a8('0x6e')]);_0x1816a0[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x46207a['query']);_0x1816a0['filters']=_[_0xa8a8('0x66')](_0x1816a0['model'],_0x1816a0[_0xa8a8('0x43')]);_0x1623af['attributes']=_['intersection'](_0x1816a0[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x47')]));_0x1623af[_0xa8a8('0x46')]=_0x1623af[_0xa8a8('0x46')][_0xa8a8('0x48')]?_0x1623af[_0xa8a8('0x46')]:_0x1816a0[_0xa8a8('0x42')];if(!_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x49')](_0xa8a8('0x4a'))){_0x1623af[_0xa8a8('0x31')]=qs['limit'](_0x46207a['query'][_0xa8a8('0x31')]);_0x1623af['offset']=qs[_0xa8a8('0x30')](_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x30')]);}_0x1623af['order']=qs['sort'](_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x1623af[_0xa8a8('0x4d')]=qs[_0xa8a8('0x45')](_['pick'](_0x46207a[_0xa8a8('0x43')],_0x1816a0[_0xa8a8('0x45')]));_0x1623af[_0xa8a8('0x4d')]['OpenchannelAccountId']=_0x31fbb1['id'];if(_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x50')]){_0x1623af[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x1623af[_0xa8a8('0x4d')],{'$or':_[_0xa8a8('0x40')](_0x1623af[_0xa8a8('0x46')],function(_0x50866c){var _0x41504b={};_0x41504b[_0x50866c]={'$like':'%'+_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x50')]+'%'};return _0x41504b;})});}_0x1623af=_[_0xa8a8('0x68')]({},_0x1623af,_0x46207a[_0xa8a8('0x51')]);return db['CannedAnswer'][_0xa8a8('0x2f')]({'where':_0x1623af['where']})[_0xa8a8('0x38')](function(_0x15fdad){_0x25dce1[_0xa8a8('0x2f')]=_0x15fdad;if(_0x46207a[_0xa8a8('0x43')]['includeAll']){_0x1623af[_0xa8a8('0x53')]=[{'all':!![]}];}return db[_0xa8a8('0x6d')][_0xa8a8('0x54')](_0x1623af);})[_0xa8a8('0x38')](function(_0x1b3929){_0x25dce1[_0xa8a8('0x6f')]=_0x1b3929;return _0x25dce1;});}})['then'](respondWithFilteredResult(_0x4f003d,_0x1623af))[_0xa8a8('0x2c')](handleError(_0x4f003d,null));};exports[_0xa8a8('0x70')]=function(_0x2d40cf,_0x2292ce,_0x124df4){return db[_0xa8a8('0x52')][_0xa8a8('0x56')]({'where':{'id':_0x2d40cf[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x2292ce,null))[_0xa8a8('0x38')](function(_0x4f6c5e){if(_0x4f6c5e){return _0x4f6c5e[_0xa8a8('0x70')](_0x2d40cf[_0xa8a8('0x43')][_0xa8a8('0x6b')]);}})[_0xa8a8('0x38')](respondWithStatusCode(_0x2292ce,null))[_0xa8a8('0x2c')](handleError(_0x2292ce,null));};exports[_0xa8a8('0x71')]=function(_0xfcc7ab,_0x38c7cc,_0x370770){var _0x41d69a={'body':_0xfcc7ab[_0xa8a8('0x58')],'channel':_0xa8a8('0x72')};var _0x492001=[];var _0x524ae7=[];var _0x4cc046={};var _0x2bf347=![];return db[_0xa8a8('0x73')][_0xa8a8('0x60')]()[_0xa8a8('0x38')](function(_0x11f3d9){if(!_0x11f3d9){throw new db[(_0xa8a8('0x1e'))][(_0xa8a8('0x1f'))](_0xa8a8('0x74'));}_0x492001=_[_0xa8a8('0x75')](_[_0xa8a8('0x44')](_0x11f3d9),['createdAt',_0xa8a8('0x76')]);_0x524ae7=_[_0xa8a8('0x75')](_[_0xa8a8('0x44')](_0x11f3d9),[_0xa8a8('0x77'),_0xa8a8('0x76'),'CompanyId','ListId']);if(_0xfcc7ab[_0xa8a8('0x58')]['id']){delete _0xfcc7ab['body']['id'];}if(_[_0xa8a8('0x78')](_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x79')])){throw new db['Sequelize'][(_0xa8a8('0x1f'))](_0xa8a8('0x7a'));}if(_[_0xa8a8('0x78')](_0xfcc7ab['body'][_0xa8a8('0x58')])||_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x58')]===''){throw new db[(_0xa8a8('0x1e'))][(_0xa8a8('0x1f'))](_0xa8a8('0x7b'));}if(_[_0xa8a8('0x78')](_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x7c')])){throw new db[(_0xa8a8('0x1e'))]['ValidationError'](_0xa8a8('0x7d')+_0x524ae7);}if(!_[_0xa8a8('0x7e')](_0x524ae7,_0xfcc7ab[_0xa8a8('0x58')]['mapKey'])){throw new db[(_0xa8a8('0x1e'))][(_0xa8a8('0x1f'))](_0xa8a8('0x7f')+_0x524ae7);}_0x4cc046[_0xfcc7ab[_0xa8a8('0x58')]['mapKey']]=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x79')];})[_0xa8a8('0x38')](function(){return db[_0xa8a8('0x52')]['find']({'where':{'id':_0xfcc7ab[_0xa8a8('0x55')]['id']},'include':[{'model':db[_0xa8a8('0x80')],'as':_0xa8a8('0x81'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4cc046,'limit':0x1,'order':[[_0xa8a8('0x76'),_0xa8a8('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xa8a8('0x38')](handleEntityNotFound(_0x38c7cc,null))[_0xa8a8('0x38')](function(_0x9736fb){if(_0x9736fb&&_0x9736fb[_0xa8a8('0x81')]){_0x41d69a[_0xa8a8('0x83')]=_0x9736fb;_0x41d69a['applications']=_0x9736fb[_0xa8a8('0x84')];_0x41d69a[_0xa8a8('0x85')]=_0x9736fb[_0xa8a8('0x81')];_0x41d69a[_0xa8a8('0x86')]=_['orderBy'](_0x41d69a[_0xa8a8('0x86')],[_0xa8a8('0x87')],[_0xa8a8('0x88')]);if(_0x41d69a['account']['Applications']){delete _0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x84')];}if(_0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x81')]&&_0x41d69a['account'][_0xa8a8('0x81')][_0xa8a8('0x89')][_0xa8a8('0x48')]){return _0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x81')][_0xa8a8('0x89')][0x0];}var _0x4a7269=_[_0xa8a8('0x18')](_0xfcc7ab[_0xa8a8('0x58')],{'firstName':_0xfcc7ab['body'][_0xa8a8('0x79')],'ListId':_0x9736fb[_0xa8a8('0x8a')]});_0x4a7269[_0xfcc7ab[_0xa8a8('0x58')]['mapKey']]=_0xfcc7ab[_0xa8a8('0x58')]['from'];return db[_0xa8a8('0x73')][_0xa8a8('0x57')](_0x4a7269,{'fields':_0x492001,'raw':!![]});}})[_0xa8a8('0x38')](handleEntityNotFound(_0x38c7cc,null))[_0xa8a8('0x38')](function(_0x58c9e9){_0x41d69a[_0xa8a8('0x8b')]=_0x58c9e9;if(_0x58c9e9){var _0x131682={'ContactId':_0x58c9e9['id'],'OpenchannelAccountId':_0xfcc7ab[_0xa8a8('0x55')]['id'],'from':(_0x58c9e9[_0xa8a8('0x8c')]||'')+'\x20'+(_0x58c9e9['lastName']||'')};var _0x4b37cb={'OpenchannelAccountId':_0xfcc7ab[_0xa8a8('0x55')]['id'],'closed':![]};if(_0xfcc7ab[_0xa8a8('0x58')]['threadId']){_0x4b37cb[_0xa8a8('0x8d')]=_0xfcc7ab[_0xa8a8('0x58')]['threadId'];return db[_0xa8a8('0x8e')][_0xa8a8('0x56')]({'where':_0x4b37cb})[_0xa8a8('0x38')](function(_0x630181){if(_0x630181){return[_0x630181,![]];}_0x131682['threadId']=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x8d')];_0x131682[_0xa8a8('0x8f')]=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x8f')];return db[_0xa8a8('0x8e')][_0xa8a8('0x57')](_0x131682)[_0xa8a8('0x38')](function(_0x435c6d){return[_0x435c6d,!![]];});});}else{_0x4b37cb[_0xa8a8('0x8d')]=null;}_0x4b37cb[_0xa8a8('0x90')]=_0x58c9e9['id'];return db[_0xa8a8('0x8e')]['find']({'where':_0x4b37cb})[_0xa8a8('0x38')](function(_0x890d81){if(_0x890d81){return[_0x890d81,![]];}return db['OpenchannelInteraction'][_0xa8a8('0x57')](_0x131682)['then'](function(_0x4a8fcc){return[_0x4a8fcc,!![]];});});}})[_0xa8a8('0x91')](function(_0x428c61,_0x560c6e){if(_0x428c61){_0x2bf347=_0x560c6e;if(!_0x560c6e){var _0x5bb523={'from':(_0x41d69a[_0xa8a8('0x8b')][_0xa8a8('0x8c')]||'')+'\x20'+(_0x41d69a[_0xa8a8('0x8b')][_0xa8a8('0x92')]||'')};if(_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x8d')]&&_0xfcc7ab['body'][_0xa8a8('0x93')]&&_0xfcc7ab[_0xa8a8('0x58')]['threadId']!=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x93')]){_0x5bb523['threadId']=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x93')];}return _0x428c61[_0xa8a8('0x37')](_0x5bb523);}else{return _0x428c61;}}})[_0xa8a8('0x38')](function(_0x330279){_0x41d69a[_0xa8a8('0x94')]=_0x330279[_0xa8a8('0x95')]({'plain':!![]});_0x41d69a[_0xa8a8('0x94')][_0xa8a8('0x96')]=_0x2bf347;if(_0x41d69a[_0xa8a8('0x94')][_0xa8a8('0x96')]){if(_0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x97')]){_0x41d69a[_0xa8a8('0x86')]['push']({'id':0x0,'priority':_0x41d69a[_0xa8a8('0x86')][_0xa8a8('0x48')]+0x1,'app':_0xa8a8('0x98'),'appdata':'unmanaged','interval':_0xa8a8('0x99')});}}return db['OpenchannelMessage'][_0xa8a8('0x57')]({'body':_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x58')],'OpenchannelAccountId':_0xfcc7ab['params']['id'],'OpenchannelInteractionId':_0x330279['id'],'direction':'in','ContactId':_0x41d69a[_0xa8a8('0x8b')]['id'],'AttachmentId':_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x9a')]});})[_0xa8a8('0x38')](function(_0x37d945){_0x41d69a[_0xa8a8('0x2a')]=_0x37d945;if(_0x41d69a[_0xa8a8('0x94')]['UserId']){return db[_0xa8a8('0x9b')][_0xa8a8('0x56')]({'attributes':['id','name'],'where':{'id':_0x41d69a['interaction']['UserId']}})['then'](function(_0x1e53be){if(_0x1e53be){_0x41d69a['applications'][_0xa8a8('0x9c')]({'id':0x0,'priority':0x0,'app':_0xa8a8('0x9d'),'appdata':_0x1e53be[_0xa8a8('0x3d')]+','+(_0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x9e')]||0xa),'interval':'*,*,*,*'});_0x41d69a['forcedOwnership']=![];}return respondWithRpcPromise(_0xa8a8('0x9f'),'startRouting',_0x41d69a);});}return respondWithRpcPromise(_0xa8a8('0x9f'),'startRouting',_0x41d69a);})['then'](function(_0x3fcf95){respondWithRpcPromise(_0xa8a8('0xa0'),_0xa8a8('0xa0'),{'event':_0xa8a8('0x71'),'message':_0x3fcf95},client9002);return _0x3fcf95;})[_0xa8a8('0x38')](respondWithResult(_0x38c7cc,null))[_0xa8a8('0x2c')](handleError(_0x38c7cc,null));};exports['addApplications']=function(_0x43bf14,_0x3e0a0d,_0x59c8a5){return db['OpenchannelAccount'][_0xa8a8('0x65')]({'where':{'id':_0x43bf14[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e0a0d,null))[_0xa8a8('0x38')](function(_0x3102c3){if(_0x3102c3){return db[_0xa8a8('0xa1')]['transaction'](function(_0x133f8a){return db[_0xa8a8('0xa2')][_0xa8a8('0x39')]({'where':{'OpenchannelAccountId':_0x43bf14[_0xa8a8('0x55')]['id']},'transaction':_0x133f8a})[_0xa8a8('0x38')](function(_0x4dc53c){var _0x272c18=_[_0xa8a8('0x40')](_0x43bf14['body'],function(_0xe9655b){_0xe9655b[_0xa8a8('0x6c')]=_0x43bf14[_0xa8a8('0x55')]['id'];return _0xe9655b;});return db[_0xa8a8('0xa2')][_0xa8a8('0xa3')](_0x272c18,{'transaction':_0x133f8a});});})[_0xa8a8('0x38')](function(){return db[_0xa8a8('0xa2')][_0xa8a8('0xa4')]({'where':{'OpenchannelAccountId':_0x43bf14[_0xa8a8('0x55')]['id']},'order':_0xa8a8('0x87')});});}})[_0xa8a8('0x38')](respondWithResult(_0x3e0a0d,null))[_0xa8a8('0x2c')](handleError(_0x3e0a0d,null));};exports['getApplications']=function(_0x12f2d2,_0x14682a,_0x231f51){var _0x35f8f7={};var _0x40946b={};var _0x4e97f4;var _0x2d8490;return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x12f2d2[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x14682a,null))['then'](function(_0x1ecac5){if(_0x1ecac5){_0x4e97f4=_0x1ecac5;_0x40946b[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db[_0xa8a8('0xa2')][_0xa8a8('0x6e')]);_0x40946b[_0xa8a8('0x43')]=_['keys'](_0x12f2d2[_0xa8a8('0x43')]);_0x40946b[_0xa8a8('0x45')]=_[_0xa8a8('0x66')](_0x40946b[_0xa8a8('0x42')],_0x40946b['query']);_0x35f8f7['attributes']=_[_0xa8a8('0x66')](_0x40946b[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x12f2d2['query']['fields']));_0x35f8f7[_0xa8a8('0x46')]=_0x35f8f7[_0xa8a8('0x46')]['length']?_0x35f8f7[_0xa8a8('0x46')]:_0x40946b[_0xa8a8('0x42')];_0x35f8f7['order']=qs[_0xa8a8('0x4b')](_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x35f8f7[_0xa8a8('0x4d')]=qs[_0xa8a8('0x45')](_['pick'](_0x12f2d2['query'],_0x40946b[_0xa8a8('0x45')]));if(_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x50')]){_0x35f8f7[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x35f8f7[_0xa8a8('0x4d')],{'$or':_[_0xa8a8('0x40')](_0x35f8f7[_0xa8a8('0x46')],function(_0xa34daa){var _0xc221aa={};_0xc221aa[_0xa34daa]={'$like':'%'+_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x50')]+'%'};return _0xc221aa;})});}_0x35f8f7=_[_0xa8a8('0x68')]({},_0x35f8f7,_0x12f2d2[_0xa8a8('0x51')]);return _0x4e97f4[_0xa8a8('0xa5')](_0x35f8f7);}})[_0xa8a8('0x38')](function(_0x32dcfe){if(_0x32dcfe){_0x2d8490=_0x32dcfe[_0xa8a8('0x48')];if(!_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x49')]('nolimit')){_0x35f8f7[_0xa8a8('0x31')]=qs[_0xa8a8('0x31')](_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x31')]);_0x35f8f7[_0xa8a8('0x30')]=qs[_0xa8a8('0x30')](_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x30')]);}return _0x4e97f4[_0xa8a8('0xa5')](_0x35f8f7);}})['then'](function(_0x4edd5e){if(_0x4edd5e){return _0x4edd5e?{'count':_0x2d8490,'rows':_0x4edd5e}:null;}})['then'](respondWithResult(_0x14682a,null))[_0xa8a8('0x2c')](handleError(_0x14682a,null));};exports[_0xa8a8('0xa6')]=function(_0x454716,_0x2db7d1,_0x52b349){var _0x2a9d9a={'raw':![],'where':{}};var _0x55edb2={};var _0x248100={'count':0x0,'rows':[]};return db[_0xa8a8('0x52')]['findOne']({'where':{'id':_0x454716[_0xa8a8('0x55')]['id']}})['then'](handleEntityNotFound(_0x2db7d1,null))[_0xa8a8('0x38')](function(_0xa3ebb5){if(_0xa3ebb5){_0x55edb2[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db[_0xa8a8('0x8e')]['rawAttributes']);_0x55edb2[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x454716[_0xa8a8('0x43')]);_0x55edb2[_0xa8a8('0x45')]=_['intersection'](_0x55edb2[_0xa8a8('0x42')],_0x55edb2['query']);_0x2a9d9a[_0xa8a8('0x46')]=_[_0xa8a8('0x66')](_0x55edb2['model'],qs[_0xa8a8('0x47')](_0x454716[_0xa8a8('0x43')][_0xa8a8('0x47')]));_0x2a9d9a['attributes']=_0x2a9d9a[_0xa8a8('0x46')][_0xa8a8('0x48')]?_0x2a9d9a[_0xa8a8('0x46')]:_0x55edb2[_0xa8a8('0x42')];if(!_0x454716[_0xa8a8('0x43')][_0xa8a8('0x49')]('nolimit')){_0x2a9d9a[_0xa8a8('0x31')]=qs['limit'](_0x454716['query'][_0xa8a8('0x31')]);_0x2a9d9a[_0xa8a8('0x30')]=qs[_0xa8a8('0x30')](_0x454716[_0xa8a8('0x43')][_0xa8a8('0x30')]);}_0x2a9d9a['order']=qs[_0xa8a8('0x4b')](_0x454716[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x2a9d9a['where']=qs['filters'](_[_0xa8a8('0x4c')](_0x454716['query'],_0x55edb2[_0xa8a8('0x45')]));_0x2a9d9a['where'][_0xa8a8('0x6c')]=_0xa3ebb5['id'];if(_0x454716[_0xa8a8('0x43')]['filter']){_0x2a9d9a[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x2a9d9a['where'],{'$or':_['map'](_0x2a9d9a['attributes'],function(_0x156d40){var _0x16674e={};_0x16674e[_0x156d40]={'$like':'%'+_0x454716[_0xa8a8('0x43')][_0xa8a8('0x50')]+'%'};return _0x16674e;})});}_0x2a9d9a=_['merge']({},_0x2a9d9a,_0x454716[_0xa8a8('0x51')]);return db[_0xa8a8('0x8e')][_0xa8a8('0x2f')]({'where':_0x2a9d9a[_0xa8a8('0x4d')]})[_0xa8a8('0x38')](function(_0x77e5a4){_0x248100[_0xa8a8('0x2f')]=_0x77e5a4;if(_0x454716[_0xa8a8('0x43')]['includeAll']){_0x2a9d9a[_0xa8a8('0x53')]=[{'model':db[_0xa8a8('0x73')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xa8a8('0x3d'),_0xa8a8('0xa7'),_0xa8a8('0xa8')],'required':![]},{'model':db['Tag'],'as':_0xa8a8('0xa9'),'attributes':['id','name','color'],'where':_0x454716['query'][_0xa8a8('0xaa')]?{'id':_0x454716[_0xa8a8('0x43')][_0xa8a8('0xaa')]}:undefined,'required':_0x454716[_0xa8a8('0x43')][_0xa8a8('0xaa')]?!![]:![]}];}return db[_0xa8a8('0x8e')][_0xa8a8('0x54')](_0x2a9d9a);})['then'](function(_0x15c578){_0x248100[_0xa8a8('0x6f')]=_0x15c578;return _0x248100;});}})['then'](respondWithFilteredResult(_0x2db7d1,_0x2a9d9a))[_0xa8a8('0x2c')](handleError(_0x2db7d1,null));};exports[_0xa8a8('0xab')]=function(_0xc59a68,_0x313778,_0x4280e9){return db['OpenchannelAccount'][_0xa8a8('0x56')]({'where':{'id':_0xc59a68[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x313778,null))[_0xa8a8('0x38')](function(_0x10e26a){if(_0x10e26a){return _0x10e26a['addAgents'](_0xc59a68[_0xa8a8('0x58')]['ids'],_[_0xa8a8('0xac')](_0xc59a68[_0xa8a8('0x58')],[_0xa8a8('0x6b'),'id'])||{})[_0xa8a8('0x91')](function(_0x3f5fba){for(var _0x226a78=0x0;_0x226a78<_0xc59a68[_0xa8a8('0x58')][_0xa8a8('0x6b')][_0xa8a8('0x48')];_0x226a78+=0x1){socket['emit'](_0xa8a8('0xad'),{'UserId':_0xc59a68[_0xa8a8('0x58')]['ids'][_0x226a78],'OpenchannelAccountId':_0xc59a68['params']['id']});}return _0x3f5fba;});}})[_0xa8a8('0x38')](respondWithResult(_0x313778,null))[_0xa8a8('0x2c')](handleError(_0x313778,null));};exports[_0xa8a8('0xae')]=function(_0x2a4d75,_0x206f4f,_0x5093cd){return db[_0xa8a8('0x52')]['find']({'where':{'id':_0x2a4d75[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x206f4f,null))[_0xa8a8('0x38')](function(_0x226b50){if(_0x226b50){return _0x226b50[_0xa8a8('0xae')](_0x2a4d75[_0xa8a8('0x43')][_0xa8a8('0x6b')])['then'](function(){if(_[_0xa8a8('0xaf')](_0x2a4d75[_0xa8a8('0x43')][_0xa8a8('0x6b')])){for(var _0x2298b5=0x0;_0x2298b5<_0x2a4d75[_0xa8a8('0x43')][_0xa8a8('0x6b')][_0xa8a8('0x48')];_0x2298b5+=0x1){socket['emit'](_0xa8a8('0xb0'),{'UserId':Number(_0x2a4d75['query'][_0xa8a8('0x6b')][_0x2298b5]),'OpenchannelAccountId':Number(_0x2a4d75[_0xa8a8('0x55')]['id'])});}}else{socket[_0xa8a8('0xb1')](_0xa8a8('0xb0'),{'UserId':Number(_0x2a4d75[_0xa8a8('0x43')]['ids']),'OpenchannelAccountId':Number(_0x2a4d75[_0xa8a8('0x55')]['id'])});}});}})[_0xa8a8('0x38')](respondWithStatusCode(_0x206f4f,null))[_0xa8a8('0x2c')](handleError(_0x206f4f,null));};exports['getAgents']=function(_0x3e0e2a,_0x233ffa,_0x9abffb){var _0x3e1b69={};var _0x3ef305={};var _0x37f08c;var _0x3225e4;return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x3e0e2a[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x233ffa,null))[_0xa8a8('0x38')](function(_0x208fb3){if(_0x208fb3){_0x37f08c=_0x208fb3;_0x3ef305[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db[_0xa8a8('0x9b')][_0xa8a8('0x6e')]);_0x3ef305[_0xa8a8('0x43')]=_['keys'](_0x3e0e2a[_0xa8a8('0x43')]);_0x3ef305[_0xa8a8('0x45')]=_[_0xa8a8('0x66')](_0x3ef305[_0xa8a8('0x42')],_0x3ef305[_0xa8a8('0x43')]);_0x3e1b69[_0xa8a8('0x46')]=_['intersection'](_0x3ef305[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x3e0e2a['query'][_0xa8a8('0x47')]));_0x3e1b69[_0xa8a8('0x46')]=_0x3e1b69[_0xa8a8('0x46')]['length']?_0x3e1b69[_0xa8a8('0x46')]:_0x3ef305[_0xa8a8('0x42')];_0x3e1b69[_0xa8a8('0x67')]=qs['sort'](_0x3e0e2a[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x3e1b69['where']=qs['filters'](_['pick'](_0x3e0e2a[_0xa8a8('0x43')],_0x3ef305[_0xa8a8('0x45')]));if(_0x3e0e2a['query'][_0xa8a8('0x50')]){_0x3e1b69[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x3e1b69[_0xa8a8('0x4d')],{'$or':_[_0xa8a8('0x40')](_0x3e1b69[_0xa8a8('0x46')],function(_0x466ec0){var _0x45f502={};_0x45f502[_0x466ec0]={'$like':'%'+_0x3e0e2a[_0xa8a8('0x43')]['filter']+'%'};return _0x45f502;})});}_0x3e1b69=_[_0xa8a8('0x68')]({},_0x3e1b69,_0x3e0e2a[_0xa8a8('0x51')]);return _0x37f08c[_0xa8a8('0xb2')](_0x3e1b69);}})[_0xa8a8('0x38')](function(_0x5b897f){if(_0x5b897f){_0x3225e4=_0x5b897f[_0xa8a8('0x48')];if(!_0x3e0e2a[_0xa8a8('0x43')][_0xa8a8('0x49')](_0xa8a8('0x4a'))){_0x3e1b69[_0xa8a8('0x31')]=qs[_0xa8a8('0x31')](_0x3e0e2a[_0xa8a8('0x43')]['limit']);_0x3e1b69[_0xa8a8('0x30')]=qs[_0xa8a8('0x30')](_0x3e0e2a['query'][_0xa8a8('0x30')]);}return _0x37f08c[_0xa8a8('0xb2')](_0x3e1b69);}})['then'](function(_0x4bb633){if(_0x4bb633){return _0x4bb633?{'count':_0x3225e4,'rows':_0x4bb633}:null;}})[_0xa8a8('0x38')](respondWithResult(_0x233ffa,null))[_0xa8a8('0x2c')](handleError(_0x233ffa,null));};exports[_0xa8a8('0xb3')]=function(_0x12403e,_0x3e6e3c,_0xc16d19){var _0x5f148c,_0x173c82,_0x4a834b;if(_[_0xa8a8('0x78')](_0x12403e[_0xa8a8('0x58')]['body'])||_0x12403e['body'][_0xa8a8('0x58')]===''){throw new db[(_0xa8a8('0x1e'))]['ValidationError'](_0xa8a8('0x7b'));}if(_['isNil'](_0x12403e['body']['to'])){}_0x5f148c=_0x12403e[_0xa8a8('0x58')]['to'];return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x12403e[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e6e3c,null))['then'](function(_0x3a0ee8){if(_0x3a0ee8){return db[_0xa8a8('0x52')]['find']({'where':{'id':_0x3a0ee8['id']},'include':[{'model':db[_0xa8a8('0x80')],'as':_0xa8a8('0x81'),'include':[{'model':db['CmContact'],'as':_0xa8a8('0x89'),'where':{[_0x3a0ee8[_0xa8a8('0x7c')]]:_0x5f148c},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e6e3c,null))[_0xa8a8('0x38')](function(_0x54adb4){if(_0x54adb4&&_0x54adb4[_0xa8a8('0x81')]){_0x173c82=_0x54adb4['get']({'plain':!![]});if(_0x173c82[_0xa8a8('0x81')]&&_0x173c82[_0xa8a8('0x81')]['Contacts']['length']){return _0x173c82[_0xa8a8('0x81')][_0xa8a8('0x89')][0x0];}return db['CmContact'][_0xa8a8('0x57')](_[_0xa8a8('0x18')](_0x12403e[_0xa8a8('0x58')],{'firstName':_0x5f148c,[_0x54adb4['mapKey']]:_0x5f148c,'phone':_0x5f148c,'ListId':_0x173c82['ListId']}));}})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e6e3c,null))['then'](function(_0xda79e){if(_0xda79e){_0x4a834b=_0xda79e;return db['OpenchannelInteraction'][_0xa8a8('0x56')]({'where':{'ContactId':_0x4a834b['id'],'closed':![],'OpenchannelAccountId':_0x173c82['id']}})['then'](function(_0x332ac7){if(_0x332ac7){return[_0x332ac7,![]];}return db[_0xa8a8('0x8e')][_0xa8a8('0x57')]({'UserId':_0x12403e['user']['id'],'ContactId':_0x4a834b['id'],'OpenchannelAccountId':_0x173c82['id'],'lastMsgDirection':_0xa8a8('0xb4'),'Messages':[_[_0xa8a8('0x68')](_0x12403e[_0xa8a8('0x58')],{'read':![],'body':_0x12403e[_0xa8a8('0x58')]['body'],'OpenchannelAccountId':_0x173c82['id'],'UserId':_0x12403e[_0xa8a8('0x59')]['id'],'ContactId':_0x4a834b['id']})]},{'include':[{'model':db[_0xa8a8('0xb5')],'as':'Messages'}]})[_0xa8a8('0x38')](function(_0x29fa0f){return[_0x29fa0f,!![]];});});}})[_0xa8a8('0x91')](function(_0xa9c2ff,_0x5607dd){if(_0x5607dd){return _0xa9c2ff;}return db[_0xa8a8('0xb5')][_0xa8a8('0x57')](_[_0xa8a8('0x68')](_0x12403e[_0xa8a8('0x58')],{'read':![],'body':_0x12403e[_0xa8a8('0x58')][_0xa8a8('0x58')],'OpenchannelAccountId':_0x173c82['id'],'OpenchannelInteractionId':_0xa9c2ff['id'],'UserId':_0x12403e[_0xa8a8('0x59')]['id'],'ContactId':_0x4a834b['id']}))['then'](function(_0xa8b261){_0xa9c2ff[_0xa8a8('0xb6')][_0xa8a8('0xb7')]=[];_0xa9c2ff[_0xa8a8('0xb6')][_0xa8a8('0xb7')][_0xa8a8('0xb8')](_0xa8b261[_0xa8a8('0xb6')]);return _0xa9c2ff;});});}})[_0xa8a8('0x38')](respondWithResult(_0x3e6e3c,null))[_0xa8a8('0x2c')](handleError(_0x3e6e3c,null));}; \ No newline at end of file +var _0xae2d=['from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','User','Owner','fullname','internal','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','Pause','mandatoryDispositionPause','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','options','OpenchannelAccount','includeAll','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','order','OpenchannelAccountId','findAll','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','notify','openchannel','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae2d,0x1b3));var _0xdae2=function(_0x532d78,_0x25b6a8){_0x532d78=_0x532d78-0x0;var _0x5990c4=_0xae2d[_0x532d78];return _0x5990c4;};'use strict';var pdf=require(_0xdae2('0x0'));var emlformat=require(_0xdae2('0x1'));var rimraf=require(_0xdae2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdae2('0x3'));var rp=require(_0xdae2('0x4'));var moment=require(_0xdae2('0x5'));var BPromise=require(_0xdae2('0x6'));var Mustache=require(_0xdae2('0x7'));var util=require('util');var path=require(_0xdae2('0x8'));var sox=require('sox');var csv=require(_0xdae2('0x9'));var ejs=require(_0xdae2('0xa'));var fs=require('fs');var _=require(_0xdae2('0xb'));var squel=require(_0xdae2('0xc'));var crypto=require(_0xdae2('0xd'));var jsforce=require(_0xdae2('0xe'));var deskjs=require(_0xdae2('0xf'));var toCsv=require(_0xdae2('0x9'));var querystring=require(_0xdae2('0x10'));var Papa=require(_0xdae2('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdae2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdae2('0x13'));var logger=require('../../config/logger')(_0xdae2('0x14'));var utils=require(_0xdae2('0x15'));var config=require(_0xdae2('0x16'));var db=require(_0xdae2('0x17'))['db'];config[_0xdae2('0x18')]=_[_0xdae2('0x19')](config['redis'],{'host':_0xdae2('0x1a'),'port':0x18eb});var socket=require(_0xdae2('0x1b'))(new Redis(config['redis']));require(_0xdae2('0x1c'))[_0xdae2('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdae2('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xdae2('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0xa13a0,_0x42b374,_0x2e132b){if(_0x2e132b){var _0x2870e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2870e8[_0xdae2('0x1f')](_0x42b374)){return _0xa13a0;}else{throw new db[(_0xdae2('0x20'))][(_0xdae2('0x21'))](_0xdae2('0x22'));}}else{return _0xa13a0;}}function respondWithRpcPromise(_0x1fe085,_0x78324c,_0x1f2eeb,_0x273fd6){return new BPromise(function(_0x1b8757,_0x52cf42){var _0x568cad=_0x273fd6||client;return _0x568cad[_0xdae2('0x23')](_0x1fe085,_0x1f2eeb)[_0xdae2('0x24')](function(_0x373a42){logger[_0xdae2('0x25')](_0xdae2('0x26'),_0x78324c,_0xdae2('0x27'));logger[_0xdae2('0x28')](_0xdae2('0x29'),_0x78324c,_0xdae2('0x27'),JSON[_0xdae2('0x2a')](_0x373a42));if(_0x373a42[_0xdae2('0x2b')]){if(_0x373a42[_0xdae2('0x2b')][_0xdae2('0x2c')]===0x1f4){logger[_0xdae2('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x78324c,_0x373a42[_0xdae2('0x2b')][_0xdae2('0x2d')]);return _0x52cf42(_0x373a42[_0xdae2('0x2b')]['message']);}logger[_0xdae2('0x2b')](_0xdae2('0x26'),_0x78324c,_0x373a42['error']['message']);return _0x1b8757(_0x373a42[_0xdae2('0x2b')][_0xdae2('0x2d')]);}else{logger[_0xdae2('0x25')](_0xdae2('0x26'),_0x78324c,_0xdae2('0x27'));_0x1b8757(_0x373a42['result'][_0xdae2('0x2d')]);}})[_0xdae2('0x2e')](function(_0x312916){logger[_0xdae2('0x2b')](_0xdae2('0x26'),_0x78324c,_0x312916);_0x52cf42(_0x312916);});});}function respondWithStatusCode(_0x315c36,_0x500078){_0x500078=_0x500078||0xcc;return function(_0x314b5d){if(_0x314b5d){return _0x315c36['sendStatus'](_0x500078);}return _0x315c36['status'](_0x500078)['end']();};}function respondWithResult(_0x5966d9,_0x266137){_0x266137=_0x266137||0xc8;return function(_0x4dad41){if(_0x4dad41){return _0x5966d9['status'](_0x266137)[_0xdae2('0x2f')](_0x4dad41);}};}function respondWithFilteredResult(_0x1578fe,_0x320bab){return function(_0x33db2d){if(_0x33db2d){var _0x48e823=_0x33db2d[_0xdae2('0x30')],_0x20568f=_0x320bab[_0xdae2('0x31')],_0x1da29f=_0x320bab['offset']+_0x320bab[_0xdae2('0x32')],_0x18b3af;if(_0x1da29f>=_0x48e823){_0x1da29f=_0x48e823;_0x18b3af=0xc8;}else{_0x18b3af=0xce;}_0x1578fe[_0xdae2('0x33')](_0x18b3af);return _0x1578fe['set'](_0xdae2('0x34'),_0x20568f+'-'+_0x1da29f+'/'+_0x48e823)['json'](_0x33db2d);}return null;};}function patchUpdates(_0x744aea){return function(_0x3c5590){try{jsonpatch[_0xdae2('0x35')](_0x3c5590,_0x744aea,!![]);}catch(_0x58a5dc){return BPromise[_0xdae2('0x36')](_0x58a5dc);}return _0x3c5590[_0xdae2('0x37')]();};}function saveUpdates(_0x1e5e83,_0x4e58fb){return function(_0x1b5e99){if(_0x1b5e99){return _0x1b5e99[_0xdae2('0x38')](_0x1e5e83)['then'](function(_0x44af5f){return _0x44af5f;});}return null;};}function removeEntity(_0x3a372f,_0x511091){return function(_0xb418fc){if(_0xb418fc){return _0xb418fc[_0xdae2('0x39')]()[_0xdae2('0x24')](function(){var _0xb3fe7d=_0xb418fc['get']({'plain':!![]});var _0x1dc589='OpenchannelAccounts';return db['UserProfileResource'][_0xdae2('0x39')]({'where':{'type':_0x1dc589,'resourceId':_0xb3fe7d['id']}})[_0xdae2('0x24')](function(){return _0xb418fc;});})['then'](function(){_0x3a372f[_0xdae2('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d9630,_0x1a3f06){return function(_0x2bfc1e){if(!_0x2bfc1e){_0x8d9630[_0xdae2('0x3a')](0x194);}return _0x2bfc1e;};}function handleError(_0x5a70a7,_0x189be1){_0x189be1=_0x189be1||0x1f4;return function(_0x5f2567){logger[_0xdae2('0x2b')](_0x5f2567[_0xdae2('0x3b')]);if(_0x5f2567['name']){delete _0x5f2567[_0xdae2('0x3c')];}_0x5a70a7[_0xdae2('0x33')](_0x189be1)['send'](_0x5f2567);};}exports['index']=function(_0x151d97,_0x2e63d1){var _0x2d5837={'include':[{'model':db[_0xdae2('0x3d')],'as':_0xdae2('0x3e')}]},_0x2be23e={},_0x1f4f6c={'count':0x0,'rows':[]};var _0x2794e6=_['map'](db['OpenchannelAccount'][_0xdae2('0x3f')],function(_0x3f4d03){return{'name':_0x3f4d03[_0xdae2('0x40')],'type':_0x3f4d03['type']['key']};});_0x2be23e[_0xdae2('0x41')]=_['map'](_0x2794e6,_0xdae2('0x3c'));_0x2be23e['query']=_[_0xdae2('0x42')](_0x151d97[_0xdae2('0x43')]);_0x2be23e[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x2be23e[_0xdae2('0x41')],_0x2be23e['query']);_0x2d5837['attributes']=_[_0xdae2('0x45')](_0x2be23e[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x151d97[_0xdae2('0x43')][_0xdae2('0x46')]));_0x2d5837[_0xdae2('0x47')]=_0x2d5837[_0xdae2('0x47')][_0xdae2('0x48')]?_0x2d5837[_0xdae2('0x47')]:_0x2be23e['model'];if(!_0x151d97[_0xdae2('0x43')][_0xdae2('0x49')](_0xdae2('0x4a'))){_0x2d5837[_0xdae2('0x32')]=qs[_0xdae2('0x32')](_0x151d97[_0xdae2('0x43')][_0xdae2('0x32')]);_0x2d5837[_0xdae2('0x31')]=qs[_0xdae2('0x31')](_0x151d97[_0xdae2('0x43')][_0xdae2('0x31')]);}_0x2d5837['order']=qs[_0xdae2('0x4b')](_0x151d97[_0xdae2('0x43')][_0xdae2('0x4b')]);_0x2d5837[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_[_0xdae2('0x4d')](_0x151d97[_0xdae2('0x43')],_0x2be23e['filters']),_0x2794e6);if(_0x151d97[_0xdae2('0x43')]['filter']){_0x2d5837['where']=_[_0xdae2('0x4e')](_0x2d5837['where'],{'$or':_[_0xdae2('0x4f')](_0x2794e6,function(_0x43bd98){if(_0x43bd98['type']!==_0xdae2('0x50')){var _0x25ce4c={};_0x25ce4c[_0x43bd98[_0xdae2('0x3c')]]={'$like':'%'+_0x151d97['query'][_0xdae2('0x51')]+'%'};return _0x25ce4c;}})});}_0x2d5837=_[_0xdae2('0x4e')]({},_0x2d5837,_0x151d97[_0xdae2('0x52')]);var _0x24e60b={'where':_0x2d5837[_0xdae2('0x4c')]};return db[_0xdae2('0x53')]['count'](_0x24e60b)[_0xdae2('0x24')](function(_0x456f04){_0x1f4f6c['count']=_0x456f04;if(_0x151d97[_0xdae2('0x43')][_0xdae2('0x54')]){_0x2d5837['include']=[{'all':!![]}];}return db[_0xdae2('0x53')]['findAll'](_0x2d5837);})[_0xdae2('0x24')](function(_0x1920c0){_0x1f4f6c['rows']=_0x1920c0;return _0x1f4f6c;})['then'](respondWithFilteredResult(_0x2e63d1,_0x2d5837))[_0xdae2('0x2e')](handleError(_0x2e63d1,null));};exports['show']=function(_0x712572,_0x37bea2){var _0x495f2a={'raw':![],'where':{'id':_0x712572[_0xdae2('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x19ac30={};_0x19ac30[_0xdae2('0x41')]=_[_0xdae2('0x42')](db[_0xdae2('0x53')][_0xdae2('0x3f')]);_0x19ac30['query']=_['keys'](_0x712572[_0xdae2('0x43')]);_0x19ac30[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x19ac30['model'],_0x19ac30[_0xdae2('0x43')]);_0x495f2a['attributes']=_[_0xdae2('0x45')](_0x19ac30[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x712572[_0xdae2('0x43')][_0xdae2('0x46')]));_0x495f2a[_0xdae2('0x47')]=_0x495f2a[_0xdae2('0x47')][_0xdae2('0x48')]?_0x495f2a[_0xdae2('0x47')]:_0x19ac30[_0xdae2('0x41')];if(_0x712572[_0xdae2('0x43')][_0xdae2('0x54')]){_0x495f2a[_0xdae2('0x56')]=[{'all':!![]}];}_0x495f2a=_[_0xdae2('0x4e')]({},_0x495f2a,_0x712572[_0xdae2('0x52')]);return db[_0xdae2('0x53')][_0xdae2('0x57')](_0x495f2a)['then'](handleEntityNotFound(_0x37bea2,null))[_0xdae2('0x24')](respondWithResult(_0x37bea2,null))['catch'](handleError(_0x37bea2,null));};exports[_0xdae2('0x58')]=function(_0x44818e,_0x77486d){return db['OpenchannelAccount'][_0xdae2('0x58')](_0x44818e[_0xdae2('0x59')],{})['then'](function(_0x4f25a7){var _0x22292d=_0x44818e[_0xdae2('0x5a')][_0xdae2('0x5b')]({'plain':!![]});if(!_0x22292d)throw new Error(_0xdae2('0x5c'));if(_0x22292d[_0xdae2('0x5d')]===_0xdae2('0x5a')){var _0xecd71b=_0x4f25a7[_0xdae2('0x5b')]({'plain':!![]});var _0x382c67=_0xdae2('0x5e');return db['UserProfileSection'][_0xdae2('0x57')]({'where':{'name':_0x382c67,'userProfileId':_0x22292d[_0xdae2('0x5f')]},'raw':!![]})[_0xdae2('0x24')](function(_0x7b9e82){if(_0x7b9e82&&_0x7b9e82[_0xdae2('0x60')]===0x0){return db[_0xdae2('0x61')]['create']({'name':_0xecd71b[_0xdae2('0x3c')],'resourceId':_0xecd71b['id'],'type':_0x7b9e82[_0xdae2('0x3c')],'sectionId':_0x7b9e82['id']},{})[_0xdae2('0x24')](function(){return _0x4f25a7;});}else{return _0x4f25a7;}})[_0xdae2('0x2e')](function(_0x54aa65){logger['error'](_0xdae2('0x62'),_0x54aa65);throw _0x54aa65;});}return _0x4f25a7;})[_0xdae2('0x24')](respondWithResult(_0x77486d,0xc9))[_0xdae2('0x2e')](handleError(_0x77486d,null));};exports['update']=function(_0x29795c,_0x4f7f41){if(_0x29795c[_0xdae2('0x59')]['id']){delete _0x29795c['body']['id'];}return db['OpenchannelAccount'][_0xdae2('0x57')]({'where':{'id':_0x29795c[_0xdae2('0x55')]['id']},'include':[{'model':db[_0xdae2('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xdae2('0x24')](handleEntityNotFound(_0x4f7f41,null))[_0xdae2('0x24')](saveUpdates(_0x29795c[_0xdae2('0x59')],null))['then'](respondWithResult(_0x4f7f41,null))[_0xdae2('0x2e')](handleError(_0x4f7f41,null));};exports['destroy']=function(_0x19bfaf,_0x2e2e43){return db[_0xdae2('0x53')]['find']({'where':{'id':_0x19bfaf[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x2e2e43,null))[_0xdae2('0x24')](removeEntity(_0x2e2e43,null))[_0xdae2('0x2e')](handleError(_0x2e2e43,null));};exports[_0xdae2('0x63')]=function(_0x29a160,_0x261124){return db[_0xdae2('0x53')]['describe']()[_0xdae2('0x24')](respondWithResult(_0x261124,null))[_0xdae2('0x2e')](handleError(_0x261124,null));};exports[_0xdae2('0x64')]=function(_0x38c52f,_0x2ebdff,_0x22b533){if(_0x38c52f[_0xdae2('0x59')]['id']){delete _0x38c52f[_0xdae2('0x59')]['id'];}return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x38c52f[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x2ebdff,null))['then'](function(_0x4a83e9){if(_0x4a83e9){_0x38c52f[_0xdae2('0x59')][_0xdae2('0x65')]=_0x4a83e9['id'];return db[_0xdae2('0x66')]['create'](_0x38c52f['body']);}})['then'](respondWithResult(_0x2ebdff,null))['catch'](handleError(_0x2ebdff,null));};exports[_0xdae2('0x67')]=function(_0x4101dc,_0x2e4626,_0x3fae73){var _0x40a59d={'raw':![],'where':{}};var _0x1be11e={};var _0x5cf82a={'count':0x0,'rows':[]};return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x4101dc['params']['id']}})['then'](handleEntityNotFound(_0x2e4626,null))[_0xdae2('0x24')](function(_0x32c481){if(_0x32c481){_0x1be11e[_0xdae2('0x41')]=_[_0xdae2('0x42')](db['Disposition'][_0xdae2('0x3f')]);_0x1be11e[_0xdae2('0x43')]=_[_0xdae2('0x42')](_0x4101dc[_0xdae2('0x43')]);_0x1be11e[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x1be11e[_0xdae2('0x41')],_0x1be11e[_0xdae2('0x43')]);_0x40a59d[_0xdae2('0x47')]=_[_0xdae2('0x45')](_0x1be11e[_0xdae2('0x41')],qs['fields'](_0x4101dc['query'][_0xdae2('0x46')]));_0x40a59d[_0xdae2('0x47')]=_0x40a59d[_0xdae2('0x47')][_0xdae2('0x48')]?_0x40a59d['attributes']:_0x1be11e[_0xdae2('0x41')];if(!_0x4101dc[_0xdae2('0x43')][_0xdae2('0x49')](_0xdae2('0x4a'))){_0x40a59d[_0xdae2('0x32')]=qs[_0xdae2('0x32')](_0x4101dc[_0xdae2('0x43')][_0xdae2('0x32')]);_0x40a59d['offset']=qs[_0xdae2('0x31')](_0x4101dc['query'][_0xdae2('0x31')]);}_0x40a59d[_0xdae2('0x69')]=qs[_0xdae2('0x4b')](_0x4101dc['query'][_0xdae2('0x4b')]);_0x40a59d[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_[_0xdae2('0x4d')](_0x4101dc['query'],_0x1be11e[_0xdae2('0x44')]));_0x40a59d['where'][_0xdae2('0x6a')]=_0x32c481['id'];if(_0x4101dc[_0xdae2('0x43')]['filter']){_0x40a59d['where']=_[_0xdae2('0x4e')](_0x40a59d[_0xdae2('0x4c')],{'$or':_[_0xdae2('0x4f')](_0x40a59d[_0xdae2('0x47')],function(_0x5e1315){var _0x11c2a7={};_0x11c2a7[_0x5e1315]={'$like':'%'+_0x4101dc[_0xdae2('0x43')][_0xdae2('0x51')]+'%'};return _0x11c2a7;})});}_0x40a59d=_['merge']({},_0x40a59d,_0x4101dc[_0xdae2('0x52')]);return db[_0xdae2('0x66')]['count']({'where':_0x40a59d[_0xdae2('0x4c')]})[_0xdae2('0x24')](function(_0x5e13a0){_0x5cf82a[_0xdae2('0x30')]=_0x5e13a0;if(_0x4101dc[_0xdae2('0x43')][_0xdae2('0x54')]){_0x40a59d['include']=[{'all':!![]}];}return db['Disposition'][_0xdae2('0x6b')](_0x40a59d);})[_0xdae2('0x24')](function(_0x44d337){_0x5cf82a[_0xdae2('0x6c')]=_0x44d337;return _0x5cf82a;});}})[_0xdae2('0x24')](respondWithFilteredResult(_0x2e4626,_0x40a59d))['catch'](handleError(_0x2e4626,null));};exports[_0xdae2('0x6d')]=function(_0x5cec1f,_0x40c618,_0x54911a){return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x5cec1f['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x40c618,null))[_0xdae2('0x24')](function(_0x13b682){if(_0x13b682){return _0x13b682[_0xdae2('0x6d')](_0x5cec1f['query']['ids']);}})['then'](respondWithStatusCode(_0x40c618,null))[_0xdae2('0x2e')](handleError(_0x40c618,null));};exports[_0xdae2('0x6e')]=function(_0x542bcc,_0x3a0f34,_0x514b89){if(_0x542bcc[_0xdae2('0x59')]['id']){delete _0x542bcc[_0xdae2('0x59')]['id'];}return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x542bcc[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x3a0f34,null))[_0xdae2('0x24')](function(_0xe5b63b){if(_0xe5b63b){_0x542bcc[_0xdae2('0x59')][_0xdae2('0x6a')]=_0xe5b63b['id'];return db[_0xdae2('0x6f')][_0xdae2('0x58')](_0x542bcc[_0xdae2('0x59')]);}})[_0xdae2('0x24')](respondWithResult(_0x3a0f34,null))[_0xdae2('0x2e')](handleError(_0x3a0f34,null));};exports[_0xdae2('0x70')]=function(_0x2c45d8,_0x155515,_0x2abfce){var _0x4c03ba={'raw':![],'where':{}};var _0x4e14d9={};var _0x1c7ce2={'count':0x0,'rows':[]};return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x2c45d8[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x155515,null))[_0xdae2('0x24')](function(_0x4f2c72){if(_0x4f2c72){_0x4e14d9['model']=_[_0xdae2('0x42')](db[_0xdae2('0x6f')]['rawAttributes']);_0x4e14d9['query']=_[_0xdae2('0x42')](_0x2c45d8[_0xdae2('0x43')]);_0x4e14d9['filters']=_['intersection'](_0x4e14d9[_0xdae2('0x41')],_0x4e14d9[_0xdae2('0x43')]);_0x4c03ba[_0xdae2('0x47')]=_[_0xdae2('0x45')](_0x4e14d9[_0xdae2('0x41')],qs['fields'](_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x46')]));_0x4c03ba[_0xdae2('0x47')]=_0x4c03ba[_0xdae2('0x47')][_0xdae2('0x48')]?_0x4c03ba['attributes']:_0x4e14d9[_0xdae2('0x41')];if(!_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x49')](_0xdae2('0x4a'))){_0x4c03ba[_0xdae2('0x32')]=qs[_0xdae2('0x32')](_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x32')]);_0x4c03ba[_0xdae2('0x31')]=qs[_0xdae2('0x31')](_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x31')]);}_0x4c03ba['order']=qs['sort'](_0x2c45d8[_0xdae2('0x43')]['sort']);_0x4c03ba[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_['pick'](_0x2c45d8[_0xdae2('0x43')],_0x4e14d9[_0xdae2('0x44')]));_0x4c03ba[_0xdae2('0x4c')][_0xdae2('0x6a')]=_0x4f2c72['id'];if(_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x51')]){_0x4c03ba[_0xdae2('0x4c')]=_[_0xdae2('0x4e')](_0x4c03ba[_0xdae2('0x4c')],{'$or':_[_0xdae2('0x4f')](_0x4c03ba['attributes'],function(_0x3a3fd4){var _0x22928f={};_0x22928f[_0x3a3fd4]={'$like':'%'+_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x51')]+'%'};return _0x22928f;})});}_0x4c03ba=_['merge']({},_0x4c03ba,_0x2c45d8[_0xdae2('0x52')]);return db[_0xdae2('0x6f')]['count']({'where':_0x4c03ba[_0xdae2('0x4c')]})[_0xdae2('0x24')](function(_0x38e911){_0x1c7ce2[_0xdae2('0x30')]=_0x38e911;if(_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x54')]){_0x4c03ba['include']=[{'all':!![]}];}return db[_0xdae2('0x6f')]['findAll'](_0x4c03ba);})['then'](function(_0x1638c8){_0x1c7ce2[_0xdae2('0x6c')]=_0x1638c8;return _0x1c7ce2;});}})[_0xdae2('0x24')](respondWithFilteredResult(_0x155515,_0x4c03ba))[_0xdae2('0x2e')](handleError(_0x155515,null));};exports['removeAnswers']=function(_0x2b5acd,_0x5d83df,_0x84c2ca){return db['OpenchannelAccount'][_0xdae2('0x57')]({'where':{'id':_0x2b5acd[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x5d83df,null))[_0xdae2('0x24')](function(_0x16e4fb){if(_0x16e4fb){return _0x16e4fb['removeAnswers'](_0x2b5acd[_0xdae2('0x43')][_0xdae2('0x71')]);}})['then'](respondWithStatusCode(_0x5d83df,null))[_0xdae2('0x2e')](handleError(_0x5d83df,null));};exports[_0xdae2('0x72')]=function(_0xd17a34,_0x36a9dc,_0x5c6daa){var _0x467a6c={'body':_0xd17a34['body'],'channel':_0xdae2('0x73')};var _0x1b79a0=[];var _0x220f7c=[];var _0x5a1c20={};var _0x541cdd=![];return db['CmContact']['describe']()[_0xdae2('0x24')](function(_0x241c9e){if(!_0x241c9e){throw new db[(_0xdae2('0x20'))][(_0xdae2('0x21'))](_0xdae2('0x74'));}_0x1b79a0=_[_0xdae2('0x75')](_[_0xdae2('0x42')](_0x241c9e),[_0xdae2('0x76'),_0xdae2('0x77')]);_0x220f7c=_[_0xdae2('0x75')](_[_0xdae2('0x42')](_0x241c9e),[_0xdae2('0x76'),'updatedAt',_0xdae2('0x78'),_0xdae2('0x79')]);if(_0xd17a34[_0xdae2('0x59')]['id']){delete _0xd17a34[_0xdae2('0x59')]['id'];}if(_[_0xdae2('0x7a')](_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7b')])){throw new db['Sequelize'][(_0xdae2('0x21'))](_0xdae2('0x7c'));}if(_[_0xdae2('0x7a')](_0xd17a34[_0xdae2('0x59')]['body'])||_0xd17a34[_0xdae2('0x59')][_0xdae2('0x59')]===''){throw new db[(_0xdae2('0x20'))][(_0xdae2('0x21'))](_0xdae2('0x7d'));}if(_[_0xdae2('0x7a')](_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7e')])){throw new db[(_0xdae2('0x20'))][(_0xdae2('0x21'))](_0xdae2('0x7f')+_0x220f7c);}if(!_[_0xdae2('0x80')](_0x220f7c,_0xd17a34[_0xdae2('0x59')]['mapKey'])){throw new db[(_0xdae2('0x20'))]['ValidationError'](_0xdae2('0x81')+_0x220f7c);}_0x5a1c20[_0xd17a34[_0xdae2('0x59')]['mapKey']]=_0xd17a34[_0xdae2('0x59')]['from'];})[_0xdae2('0x24')](function(){return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0xd17a34[_0xdae2('0x55')]['id']},'include':[{'model':db[_0xdae2('0x82')],'as':_0xdae2('0x83'),'include':[{'model':db[_0xdae2('0x84')],'as':_0xdae2('0x85'),'where':_0x5a1c20,'limit':0x1,'order':[[_0xdae2('0x77'),_0xdae2('0x86')]]}]},{'model':db[_0xdae2('0x87')],'as':_0xdae2('0x88')}]});})[_0xdae2('0x24')](handleEntityNotFound(_0x36a9dc,null))['then'](function(_0x3fcdd2){if(_0x3fcdd2&&_0x3fcdd2[_0xdae2('0x83')]){_0x467a6c[_0xdae2('0x89')]=_0x3fcdd2;_0x467a6c['applications']=_0x3fcdd2[_0xdae2('0x88')];_0x467a6c['list']=_0x3fcdd2[_0xdae2('0x83')];_0x467a6c[_0xdae2('0x8a')]=_['orderBy'](_0x467a6c[_0xdae2('0x8a')],[_0xdae2('0x8b')],[_0xdae2('0x8c')]);if(_0x467a6c[_0xdae2('0x89')][_0xdae2('0x88')]){delete _0x467a6c[_0xdae2('0x89')][_0xdae2('0x88')];}if(_0x467a6c[_0xdae2('0x89')][_0xdae2('0x83')]&&_0x467a6c[_0xdae2('0x89')][_0xdae2('0x83')][_0xdae2('0x85')][_0xdae2('0x48')]){return _0x467a6c['account']['List'][_0xdae2('0x85')][0x0];}var _0x17f8ac=_[_0xdae2('0x19')](_0xd17a34['body'],{'firstName':_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7b')],'ListId':_0x3fcdd2[_0xdae2('0x79')]});_0x17f8ac[_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7e')]]=_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7b')];return db[_0xdae2('0x84')][_0xdae2('0x58')](_0x17f8ac,{'fields':_0x1b79a0,'raw':!![]});}})[_0xdae2('0x24')](handleEntityNotFound(_0x36a9dc,null))['then'](function(_0x1b43d1){_0x467a6c[_0xdae2('0x8d')]=_0x1b43d1;if(_0x1b43d1){var _0x380aaa={'ContactId':_0x1b43d1['id'],'OpenchannelAccountId':_0xd17a34['params']['id'],'from':(_0x1b43d1[_0xdae2('0x8e')]||'')+'\x20'+(_0x1b43d1[_0xdae2('0x8f')]||'')};var _0x4431d5={'OpenchannelAccountId':_0xd17a34[_0xdae2('0x55')]['id'],'closed':![]};if(_0xd17a34[_0xdae2('0x59')][_0xdae2('0x90')]){_0x4431d5[_0xdae2('0x90')]=_0xd17a34[_0xdae2('0x59')][_0xdae2('0x90')];return db[_0xdae2('0x91')][_0xdae2('0x57')]({'where':_0x4431d5})['then'](function(_0x50dd64){if(_0x50dd64){return[_0x50dd64,![]];}_0x380aaa['threadId']=_0xd17a34['body'][_0xdae2('0x90')];_0x380aaa[_0xdae2('0x92')]=_0xd17a34[_0xdae2('0x59')][_0xdae2('0x92')];return db[_0xdae2('0x91')]['create'](_0x380aaa)['then'](function(_0x401ecd){return[_0x401ecd,!![]];});});}else{_0x4431d5['threadId']=null;}_0x4431d5['ContactId']=_0x1b43d1['id'];return db[_0xdae2('0x91')][_0xdae2('0x57')]({'where':_0x4431d5})[_0xdae2('0x24')](function(_0x1fafba){if(_0x1fafba){return[_0x1fafba,![]];}return db['OpenchannelInteraction'][_0xdae2('0x58')](_0x380aaa)[_0xdae2('0x24')](function(_0x207dd6){return[_0x207dd6,!![]];});});}})[_0xdae2('0x93')](function(_0x46f684,_0x279141){if(_0x46f684){_0x541cdd=_0x279141;if(!_0x279141){var _0x433d62={'from':(_0x467a6c[_0xdae2('0x8d')][_0xdae2('0x8e')]||'')+'\x20'+(_0x467a6c[_0xdae2('0x8d')]['lastName']||'')};if(_0xd17a34[_0xdae2('0x59')]['threadId']&&_0xd17a34[_0xdae2('0x59')][_0xdae2('0x94')]&&_0xd17a34['body'][_0xdae2('0x90')]!=_0xd17a34[_0xdae2('0x59')][_0xdae2('0x94')]){_0x433d62['threadId']=_0xd17a34['body'][_0xdae2('0x94')];}return _0x46f684[_0xdae2('0x38')](_0x433d62);}else{return _0x46f684;}}})[_0xdae2('0x24')](function(_0x1abc90){_0x467a6c[_0xdae2('0x95')]=_0x1abc90[_0xdae2('0x5b')]({'plain':!![]});_0x467a6c[_0xdae2('0x95')][_0xdae2('0x96')]=_0x541cdd;if(_0x467a6c[_0xdae2('0x95')][_0xdae2('0x96')]){if(_0x467a6c[_0xdae2('0x89')][_0xdae2('0x97')]){_0x467a6c[_0xdae2('0x8a')]['push']({'id':0x0,'priority':_0x467a6c[_0xdae2('0x8a')][_0xdae2('0x48')]+0x1,'app':'close','appdata':_0xdae2('0x98'),'interval':_0xdae2('0x99')});}}return db[_0xdae2('0x9a')][_0xdae2('0x58')]({'body':_0xd17a34['body'][_0xdae2('0x59')],'OpenchannelAccountId':_0xd17a34[_0xdae2('0x55')]['id'],'OpenchannelInteractionId':_0x1abc90['id'],'direction':'in','ContactId':_0x467a6c[_0xdae2('0x8d')]['id'],'AttachmentId':_0xd17a34[_0xdae2('0x59')][_0xdae2('0x9b')]});})[_0xdae2('0x24')](function(_0x325fca){_0x467a6c['message']=_0x325fca;if(_0x467a6c['interaction']['UserId']){return db['User']['find']({'attributes':['id',_0xdae2('0x3c')],'where':{'id':_0x467a6c[_0xdae2('0x95')][_0xdae2('0x9c')]}})[_0xdae2('0x24')](function(_0x49f21b){if(_0x49f21b){_0x467a6c[_0xdae2('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdae2('0x9d'),'appdata':_0x49f21b[_0xdae2('0x3c')]+','+(_0x467a6c[_0xdae2('0x89')][_0xdae2('0x9e')]||0xa),'interval':_0xdae2('0x99')});_0x467a6c['forcedOwnership']=![];}return respondWithRpcPromise(_0xdae2('0x9f'),_0xdae2('0xa0'),_0x467a6c);});}return respondWithRpcPromise(_0xdae2('0x9f'),_0xdae2('0xa0'),_0x467a6c);})[_0xdae2('0x24')](function(_0x199306){respondWithRpcPromise(_0xdae2('0xa1'),_0xdae2('0xa1'),{'event':_0xdae2('0x72'),'message':_0x199306},client9002);return _0x199306;})['then'](respondWithResult(_0x36a9dc,null))[_0xdae2('0x2e')](handleError(_0x36a9dc,null));};exports[_0xdae2('0xa2')]=function(_0x1189c5,_0x2afb30,_0x4417c7){return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x1189c5['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x2afb30,null))['then'](function(_0x1bd278){if(_0x1bd278){return db[_0xdae2('0xa3')][_0xdae2('0xa4')](function(_0x23837e){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x1189c5[_0xdae2('0x55')]['id']},'transaction':_0x23837e})[_0xdae2('0x24')](function(_0x139980){var _0x270d45=_[_0xdae2('0x4f')](_0x1189c5[_0xdae2('0x59')],function(_0x2c3c41){_0x2c3c41[_0xdae2('0x6a')]=_0x1189c5[_0xdae2('0x55')]['id'];return _0x2c3c41;});return db[_0xdae2('0x87')][_0xdae2('0xa5')](_0x270d45,{'transaction':_0x23837e});});})[_0xdae2('0x24')](function(){return db[_0xdae2('0x87')][_0xdae2('0xa6')]({'where':{'OpenchannelAccountId':_0x1189c5['params']['id']},'order':_0xdae2('0x8b')});});}})[_0xdae2('0x24')](respondWithResult(_0x2afb30,null))[_0xdae2('0x2e')](handleError(_0x2afb30,null));};exports[_0xdae2('0xa7')]=function(_0x260091,_0x46596f,_0x339a98){var _0x35a941={};var _0x4956b4={};var _0x41ec99;var _0x4ee71c;return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x260091['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x46596f,null))[_0xdae2('0x24')](function(_0x418811){if(_0x418811){_0x41ec99=_0x418811;_0x4956b4[_0xdae2('0x41')]=_[_0xdae2('0x42')](db['OpenchannelApplication'][_0xdae2('0x3f')]);_0x4956b4[_0xdae2('0x43')]=_[_0xdae2('0x42')](_0x260091[_0xdae2('0x43')]);_0x4956b4[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x4956b4[_0xdae2('0x41')],_0x4956b4['query']);_0x35a941[_0xdae2('0x47')]=_[_0xdae2('0x45')](_0x4956b4[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x260091[_0xdae2('0x43')][_0xdae2('0x46')]));_0x35a941[_0xdae2('0x47')]=_0x35a941[_0xdae2('0x47')][_0xdae2('0x48')]?_0x35a941[_0xdae2('0x47')]:_0x4956b4[_0xdae2('0x41')];_0x35a941[_0xdae2('0x69')]=qs['sort'](_0x260091[_0xdae2('0x43')]['sort']);_0x35a941['where']=qs[_0xdae2('0x44')](_[_0xdae2('0x4d')](_0x260091[_0xdae2('0x43')],_0x4956b4['filters']));if(_0x260091['query'][_0xdae2('0x51')]){_0x35a941['where']=_[_0xdae2('0x4e')](_0x35a941[_0xdae2('0x4c')],{'$or':_[_0xdae2('0x4f')](_0x35a941[_0xdae2('0x47')],function(_0x137a5f){var _0x46b9ac={};_0x46b9ac[_0x137a5f]={'$like':'%'+_0x260091[_0xdae2('0x43')][_0xdae2('0x51')]+'%'};return _0x46b9ac;})});}_0x35a941=_[_0xdae2('0x4e')]({},_0x35a941,_0x260091['options']);return _0x41ec99[_0xdae2('0xa7')](_0x35a941);}})[_0xdae2('0x24')](function(_0x2739a4){if(_0x2739a4){_0x4ee71c=_0x2739a4[_0xdae2('0x48')];if(!_0x260091[_0xdae2('0x43')]['hasOwnProperty'](_0xdae2('0x4a'))){_0x35a941[_0xdae2('0x32')]=qs['limit'](_0x260091[_0xdae2('0x43')][_0xdae2('0x32')]);_0x35a941[_0xdae2('0x31')]=qs['offset'](_0x260091['query'][_0xdae2('0x31')]);}return _0x41ec99[_0xdae2('0xa7')](_0x35a941);}})[_0xdae2('0x24')](function(_0x2694ee){if(_0x2694ee){return _0x2694ee?{'count':_0x4ee71c,'rows':_0x2694ee}:null;}})['then'](respondWithResult(_0x46596f,null))['catch'](handleError(_0x46596f,null));};exports[_0xdae2('0xa8')]=function(_0x5eca34,_0x29d160,_0x11ca71){var _0x4885fc={'raw':![],'where':{}};var _0x3ce2ab={};var _0x9ef1a2={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5eca34[_0xdae2('0x55')]['id']}})['then'](handleEntityNotFound(_0x29d160,null))[_0xdae2('0x24')](function(_0x1a9b95){if(_0x1a9b95){_0x3ce2ab[_0xdae2('0x41')]=_['keys'](db['OpenchannelInteraction'][_0xdae2('0x3f')]);_0x3ce2ab[_0xdae2('0x43')]=_[_0xdae2('0x42')](_0x5eca34['query']);_0x3ce2ab[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x3ce2ab[_0xdae2('0x41')],_0x3ce2ab[_0xdae2('0x43')]);_0x4885fc[_0xdae2('0x47')]=_[_0xdae2('0x45')](_0x3ce2ab[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x5eca34[_0xdae2('0x43')][_0xdae2('0x46')]));_0x4885fc['attributes']=_0x4885fc[_0xdae2('0x47')][_0xdae2('0x48')]?_0x4885fc[_0xdae2('0x47')]:_0x3ce2ab[_0xdae2('0x41')];if(!_0x5eca34[_0xdae2('0x43')][_0xdae2('0x49')]('nolimit')){_0x4885fc[_0xdae2('0x32')]=qs[_0xdae2('0x32')](_0x5eca34[_0xdae2('0x43')]['limit']);_0x4885fc[_0xdae2('0x31')]=qs[_0xdae2('0x31')](_0x5eca34[_0xdae2('0x43')][_0xdae2('0x31')]);}_0x4885fc[_0xdae2('0x69')]=qs[_0xdae2('0x4b')](_0x5eca34[_0xdae2('0x43')][_0xdae2('0x4b')]);_0x4885fc[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_['pick'](_0x5eca34['query'],_0x3ce2ab[_0xdae2('0x44')]));_0x4885fc[_0xdae2('0x4c')]['OpenchannelAccountId']=_0x1a9b95['id'];if(_0x5eca34['query'][_0xdae2('0x51')]){_0x4885fc['where']=_[_0xdae2('0x4e')](_0x4885fc[_0xdae2('0x4c')],{'$or':_['map'](_0x4885fc[_0xdae2('0x47')],function(_0x305eb1){var _0x3f3df8={};_0x3f3df8[_0x305eb1]={'$like':'%'+_0x5eca34[_0xdae2('0x43')]['filter']+'%'};return _0x3f3df8;})});}_0x4885fc=_[_0xdae2('0x4e')]({},_0x4885fc,_0x5eca34['options']);return db[_0xdae2('0x91')][_0xdae2('0x30')]({'where':_0x4885fc[_0xdae2('0x4c')]})[_0xdae2('0x24')](function(_0x3fa02e){_0x9ef1a2[_0xdae2('0x30')]=_0x3fa02e;if(_0x5eca34[_0xdae2('0x43')][_0xdae2('0x54')]){_0x4885fc['include']=[{'model':db[_0xdae2('0x84')],'as':'Contact','required':![]},{'model':db[_0xdae2('0xa9')],'as':_0xdae2('0xaa'),'attributes':[_0xdae2('0x3c'),_0xdae2('0xab'),_0xdae2('0xac')],'required':![]},{'model':db['Tag'],'as':_0xdae2('0xad'),'attributes':['id','name','color'],'where':_0x5eca34[_0xdae2('0x43')][_0xdae2('0xae')]?{'id':_0x5eca34['query'][_0xdae2('0xae')]}:undefined,'required':_0x5eca34[_0xdae2('0x43')][_0xdae2('0xae')]?!![]:![]}];}return db[_0xdae2('0x91')]['findAll'](_0x4885fc);})[_0xdae2('0x24')](function(_0x3ec2dd){_0x9ef1a2[_0xdae2('0x6c')]=_0x3ec2dd;return _0x9ef1a2;});}})[_0xdae2('0x24')](respondWithFilteredResult(_0x29d160,_0x4885fc))['catch'](handleError(_0x29d160,null));};exports[_0xdae2('0xaf')]=function(_0x228b09,_0x4a9c91,_0x28b970){return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x228b09['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x4a9c91,null))[_0xdae2('0x24')](function(_0x5a263c){if(_0x5a263c){return _0x5a263c[_0xdae2('0xaf')](_0x228b09['body'][_0xdae2('0x71')],_[_0xdae2('0xb0')](_0x228b09[_0xdae2('0x59')],[_0xdae2('0x71'),'id'])||{})['spread'](function(_0x2d9c67){for(var _0x57835b=0x0;_0x57835b<_0x228b09['body'][_0xdae2('0x71')]['length'];_0x57835b+=0x1){socket[_0xdae2('0xb1')](_0xdae2('0xb2'),{'UserId':_0x228b09[_0xdae2('0x59')][_0xdae2('0x71')][_0x57835b],'OpenchannelAccountId':_0x228b09[_0xdae2('0x55')]['id']});}return _0x2d9c67;});}})[_0xdae2('0x24')](respondWithResult(_0x4a9c91,null))['catch'](handleError(_0x4a9c91,null));};exports['removeAgents']=function(_0x3a3857,_0x42d3f8,_0x38a5cc){return db['OpenchannelAccount'][_0xdae2('0x57')]({'where':{'id':_0x3a3857[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x42d3f8,null))['then'](function(_0x4a7f74){if(_0x4a7f74){return _0x4a7f74[_0xdae2('0xb3')](_0x3a3857['query'][_0xdae2('0x71')])[_0xdae2('0x24')](function(){if(_['isArray'](_0x3a3857['query'][_0xdae2('0x71')])){for(var _0x30d694=0x0;_0x30d694<_0x3a3857['query'][_0xdae2('0x71')][_0xdae2('0x48')];_0x30d694+=0x1){socket[_0xdae2('0xb1')](_0xdae2('0xb4'),{'UserId':Number(_0x3a3857[_0xdae2('0x43')][_0xdae2('0x71')][_0x30d694]),'OpenchannelAccountId':Number(_0x3a3857[_0xdae2('0x55')]['id'])});}}else{socket[_0xdae2('0xb1')](_0xdae2('0xb4'),{'UserId':Number(_0x3a3857[_0xdae2('0x43')][_0xdae2('0x71')]),'OpenchannelAccountId':Number(_0x3a3857[_0xdae2('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x42d3f8,null))[_0xdae2('0x2e')](handleError(_0x42d3f8,null));};exports['getAgents']=function(_0x2411db,_0x2d9fdf,_0x42080e){var _0x5b7504={};var _0x160b9f={};var _0x2b911d;var _0x65ad2;return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x2411db['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x2d9fdf,null))[_0xdae2('0x24')](function(_0x400b15){if(_0x400b15){_0x2b911d=_0x400b15;_0x160b9f[_0xdae2('0x41')]=_[_0xdae2('0x42')](db['User'][_0xdae2('0x3f')]);_0x160b9f['query']=_['keys'](_0x2411db['query']);_0x160b9f[_0xdae2('0x44')]=_['intersection'](_0x160b9f[_0xdae2('0x41')],_0x160b9f['query']);_0x5b7504['attributes']=_[_0xdae2('0x45')](_0x160b9f[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x2411db[_0xdae2('0x43')][_0xdae2('0x46')]));_0x5b7504[_0xdae2('0x47')]=_0x5b7504[_0xdae2('0x47')][_0xdae2('0x48')]?_0x5b7504[_0xdae2('0x47')]:_0x160b9f['model'];_0x5b7504['order']=qs[_0xdae2('0x4b')](_0x2411db[_0xdae2('0x43')][_0xdae2('0x4b')]);_0x5b7504[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_[_0xdae2('0x4d')](_0x2411db[_0xdae2('0x43')],_0x160b9f['filters']));if(_0x2411db[_0xdae2('0x43')][_0xdae2('0x51')]){_0x5b7504[_0xdae2('0x4c')]=_[_0xdae2('0x4e')](_0x5b7504[_0xdae2('0x4c')],{'$or':_[_0xdae2('0x4f')](_0x5b7504['attributes'],function(_0x13c2ac){var _0x8b5a7a={};_0x8b5a7a[_0x13c2ac]={'$like':'%'+_0x2411db[_0xdae2('0x43')]['filter']+'%'};return _0x8b5a7a;})});}_0x5b7504=_[_0xdae2('0x4e')]({},_0x5b7504,_0x2411db[_0xdae2('0x52')]);return _0x2b911d[_0xdae2('0xb5')](_0x5b7504);}})[_0xdae2('0x24')](function(_0x18fe8f){if(_0x18fe8f){_0x65ad2=_0x18fe8f['length'];if(!_0x2411db[_0xdae2('0x43')][_0xdae2('0x49')](_0xdae2('0x4a'))){_0x5b7504['limit']=qs[_0xdae2('0x32')](_0x2411db[_0xdae2('0x43')][_0xdae2('0x32')]);_0x5b7504['offset']=qs[_0xdae2('0x31')](_0x2411db[_0xdae2('0x43')][_0xdae2('0x31')]);}return _0x2b911d[_0xdae2('0xb5')](_0x5b7504);}})[_0xdae2('0x24')](function(_0x56d5be){if(_0x56d5be){return _0x56d5be?{'count':_0x65ad2,'rows':_0x56d5be}:null;}})[_0xdae2('0x24')](respondWithResult(_0x2d9fdf,null))[_0xdae2('0x2e')](handleError(_0x2d9fdf,null));};exports[_0xdae2('0xb6')]=function(_0x41af76,_0x18c7ab,_0x49f447){var _0x2f22ac,_0x4807e1,_0x47ad00;if(_[_0xdae2('0x7a')](_0x41af76[_0xdae2('0x59')]['body'])||_0x41af76[_0xdae2('0x59')][_0xdae2('0x59')]===''){throw new db[(_0xdae2('0x20'))]['ValidationError'](_0xdae2('0x7d'));}if(_['isNil'](_0x41af76[_0xdae2('0x59')]['to'])){}_0x2f22ac=_0x41af76[_0xdae2('0x59')]['to'];return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x41af76['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x18c7ab,null))[_0xdae2('0x24')](function(_0x4b9b07){if(_0x4b9b07){return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x4b9b07['id']},'include':[{'model':db[_0xdae2('0x82')],'as':_0xdae2('0x83'),'include':[{'model':db[_0xdae2('0x84')],'as':_0xdae2('0x85'),'where':{[_0x4b9b07[_0xdae2('0x7e')]]:_0x2f22ac},'limit':0x1,'order':[[_0xdae2('0x77'),_0xdae2('0x86')]]}]}]})[_0xdae2('0x24')](handleEntityNotFound(_0x18c7ab,null))[_0xdae2('0x24')](function(_0x125d3f){if(_0x125d3f&&_0x125d3f[_0xdae2('0x83')]){_0x4807e1=_0x125d3f[_0xdae2('0x5b')]({'plain':!![]});if(_0x4807e1[_0xdae2('0x83')]&&_0x4807e1[_0xdae2('0x83')]['Contacts'][_0xdae2('0x48')]){return _0x4807e1['List'][_0xdae2('0x85')][0x0];}return db[_0xdae2('0x84')][_0xdae2('0x58')](_['defaults'](_0x41af76['body'],{'firstName':_0x2f22ac,[_0x125d3f[_0xdae2('0x7e')]]:_0x2f22ac,'phone':_0x2f22ac,'ListId':_0x4807e1[_0xdae2('0x79')]}));}})['then'](handleEntityNotFound(_0x18c7ab,null))['then'](function(_0x19c36a){if(_0x19c36a){_0x47ad00=_0x19c36a;return db[_0xdae2('0x91')][_0xdae2('0x57')]({'where':{'ContactId':_0x47ad00['id'],'closed':![],'OpenchannelAccountId':_0x4807e1['id']}})[_0xdae2('0x24')](function(_0x3ec9ba){if(_0x3ec9ba){return[_0x3ec9ba,![]];}return db[_0xdae2('0x91')][_0xdae2('0x58')]({'UserId':_0x41af76[_0xdae2('0x5a')]['id'],'ContactId':_0x47ad00['id'],'OpenchannelAccountId':_0x4807e1['id'],'lastMsgDirection':_0xdae2('0xb7'),'Messages':[_[_0xdae2('0x4e')](_0x41af76[_0xdae2('0x59')],{'read':![],'body':_0x41af76[_0xdae2('0x59')]['body'],'OpenchannelAccountId':_0x4807e1['id'],'UserId':_0x41af76[_0xdae2('0x5a')]['id'],'ContactId':_0x47ad00['id']})]},{'include':[{'model':db[_0xdae2('0x9a')],'as':'Messages'}]})[_0xdae2('0x24')](function(_0x29395e){return[_0x29395e,!![]];});});}})[_0xdae2('0x93')](function(_0x4f0359,_0x277809){if(_0x277809){return _0x4f0359;}return db['OpenchannelMessage'][_0xdae2('0x58')](_[_0xdae2('0x4e')](_0x41af76[_0xdae2('0x59')],{'read':![],'body':_0x41af76[_0xdae2('0x59')][_0xdae2('0x59')],'OpenchannelAccountId':_0x4807e1['id'],'OpenchannelInteractionId':_0x4f0359['id'],'UserId':_0x41af76['user']['id'],'ContactId':_0x47ad00['id']}))[_0xdae2('0x24')](function(_0x13e10d){_0x4f0359['dataValues'][_0xdae2('0xb8')]=[];_0x4f0359[_0xdae2('0xb9')][_0xdae2('0xb8')]['push'](_0x13e10d[_0xdae2('0xb9')]);return _0x4f0359;});});}})[_0xdae2('0x24')](respondWithResult(_0x18c7ab,null))[_0xdae2('0x2e')](handleError(_0x18c7ab,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 5d2da2d..bd8a23d 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 _0x5e5b=['remove','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0x3de2ca,_0x51e1ba){var _0x2e9106=function(_0x381663){while(--_0x381663){_0x3de2ca['push'](_0x3de2ca['shift']());}};_0x2e9106(++_0x51e1ba);}(_0x5e5b,0xbc));var _0xb5e5=function(_0x3ee6ba,_0x10d1ca){_0x3ee6ba=_0x3ee6ba-0x0;var _0x59e95f=_0x5e5b[_0x3ee6ba];return _0x59e95f;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xb5e5('0x0'))['db'][_0xb5e5('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb5e5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb5e5('0x3'),'afterDestroy':_0xb5e5('0x4')};function emitEvent(_0x507fdf){return function(_0x3a804f,_0x1e8e48,_0x7b6eba){OpenchannelAccountEvents['emit'](_0x507fdf+':'+_0x3a804f['id'],_0x3a804f);OpenchannelAccountEvents['emit'](_0x507fdf,_0x3a804f);_0x7b6eba(null);};}for(var e in events){if(events[_0xb5e5('0x5')](e)){var event=events[e];OpenchannelAccount[_0xb5e5('0x6')](e,emitEvent(event));}}module[_0xb5e5('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x4153=['hook','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4a66b6,_0x13b579){var _0x2fb1d3=function(_0x17c333){while(--_0x17c333){_0x4a66b6['push'](_0x4a66b6['shift']());}};_0x2fb1d3(++_0x13b579);}(_0x4153,0xd9));var _0x3415=function(_0x5b8922,_0x56729d){_0x5b8922=_0x5b8922-0x0;var _0x5237ef=_0x4153[_0x5b8922];return _0x5237ef;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x3415('0x0'))['db'][_0x3415('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3415('0x2')](0x0);var events={'afterCreate':_0x3415('0x3'),'afterUpdate':_0x3415('0x4'),'afterDestroy':_0x3415('0x5')};function emitEvent(_0x2f9ee7){return function(_0x38ed01,_0x20b74f,_0x2d27a7){OpenchannelAccountEvents[_0x3415('0x6')](_0x2f9ee7+':'+_0x38ed01['id'],_0x38ed01);OpenchannelAccountEvents[_0x3415('0x6')](_0x2f9ee7,_0x38ed01);_0x2d27a7(null);};}for(var e in events){if(events[_0x3415('0x7')](e)){var event=events[e];OpenchannelAccount[_0x3415('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 063747c..d3e4135 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 _0x1977=['./openchannelAccount.attributes','define','openchannel_accounts','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x1ee366,_0xe80d55){var _0x5e9c66=function(_0x45f986){while(--_0x45f986){_0x1ee366['push'](_0x1ee366['shift']());}};_0x5e9c66(++_0xe80d55);}(_0x1977,0xb7));var _0x7197=function(_0x262f7c,_0x56b881){_0x262f7c=_0x262f7c-0x0;var _0x572d92=_0x1977[_0x262f7c];return _0x572d92;};'use strict';var _=require(_0x7197('0x0'));var util=require(_0x7197('0x1'));var logger=require('../../config/logger')(_0x7197('0x2'));var moment=require(_0x7197('0x3'));var BPromise=require('bluebird');var rp=require(_0x7197('0x4'));var fs=require('fs');var path=require(_0x7197('0x5'));var rimraf=require('rimraf');var config=require(_0x7197('0x6'));var attributes=require(_0x7197('0x7'));module['exports']=function(_0x53018b,_0x5c7eef){return _0x53018b[_0x7197('0x8')]('OpenchannelAccount',attributes,{'tableName':_0x7197('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb14e=['openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount'];(function(_0x4647f2,_0x2c0692){var _0x2b440a=function(_0x2aca44){while(--_0x2aca44){_0x4647f2['push'](_0x4647f2['shift']());}};_0x2b440a(++_0x2c0692);}(_0xb14e,0xd3));var _0xeb14=function(_0x30d866,_0x4fc349){_0x30d866=_0x30d866-0x0;var _0x58526b=_0xb14e[_0x30d866];return _0x58526b;};'use strict';var _=require(_0xeb14('0x0'));var util=require(_0xeb14('0x1'));var logger=require(_0xeb14('0x2'))(_0xeb14('0x3'));var moment=require(_0xeb14('0x4'));var BPromise=require(_0xeb14('0x5'));var rp=require(_0xeb14('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb14('0x7'));var config=require(_0xeb14('0x8'));var attributes=require(_0xeb14('0x9'));module[_0xeb14('0xa')]=function(_0x5bbbfc,_0x4ca06c){return _0x5bbbfc[_0xeb14('0xb')](_0xeb14('0xc'),attributes,{'tableName':_0xeb14('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 70d7dd8..baa5f98 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 _0x5e9d=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5e9d,0x1f1));var _0xd5e9=function(_0x2eed5a,_0x4cbf4a){_0x2eed5a=_0x2eed5a-0x0;var _0x51d67d=_0x5e9d[_0x2eed5a];return _0x51d67d;};'use strict';var _=require(_0xd5e9('0x0'));var util=require(_0xd5e9('0x1'));var moment=require('moment');var BPromise=require(_0xd5e9('0x2'));var rs=require(_0xd5e9('0x3'));var fs=require('fs');var Redis=require(_0xd5e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5e9('0x5'));var logger=require(_0xd5e9('0x6'))(_0xd5e9('0x7'));var config=require(_0xd5e9('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd5e9('0x9')]=_[_0xd5e9('0xa')](config['redis'],{'host':_0xd5e9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5e9('0x9')]));require(_0xd5e9('0xc'))[_0xd5e9('0xd')](socket);function respondWithRpcPromise(_0x5616c5,_0x259741,_0x2e7810){return new BPromise(function(_0x2f426f,_0x11c641){return client[_0xd5e9('0xe')](_0x5616c5,_0x2e7810)[_0xd5e9('0xf')](function(_0x163fb6){logger[_0xd5e9('0x10')](_0xd5e9('0x11'),_0x259741,_0xd5e9('0x12'));logger['debug'](_0xd5e9('0x13'),_0x259741,'request\x20sent',JSON[_0xd5e9('0x14')](_0x163fb6));if(_0x163fb6[_0xd5e9('0x15')]){if(_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x16')]===0x1f4){logger[_0xd5e9('0x15')](_0xd5e9('0x11'),_0x259741,_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x17')]);return _0x11c641(_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x17')]);}logger['error'](_0xd5e9('0x11'),_0x259741,_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x17')]);return _0x2f426f(_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x17')]);}else{logger[_0xd5e9('0x10')](_0xd5e9('0x11'),_0x259741,'request\x20sent');_0x2f426f(_0x163fb6[_0xd5e9('0x18')][_0xd5e9('0x17')]);}})[_0xd5e9('0x19')](function(_0x565790){logger['error'](_0xd5e9('0x11'),_0x259741,_0x565790);_0x11c641(_0x565790);});});} \ No newline at end of file +var _0xb860=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5bd64f,_0x47e5b7){var _0x4b0240=function(_0x55b15a){while(--_0x55b15a){_0x5bd64f['push'](_0x5bd64f['shift']());}};_0x4b0240(++_0x47e5b7);}(_0xb860,0x18c));var _0x0b86=function(_0x13a14d,_0x1e10d2){_0x13a14d=_0x13a14d-0x0;var _0x4772c6=_0xb860[_0x13a14d];return _0x4772c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b86('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b86('0x1'))['db'];var utils=require(_0x0b86('0x2'));var logger=require(_0x0b86('0x3'))(_0x0b86('0x4'));var config=require(_0x0b86('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0b86('0x6')]({'port':0x232a});config[_0x0b86('0x7')]=_[_0x0b86('0x8')](config[_0x0b86('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b86('0x9'))(new Redis(config[_0x0b86('0x7')]));require('./openchannelAccount.socket')[_0x0b86('0xa')](socket);function respondWithRpcPromise(_0x35a22b,_0x2a9631,_0x428196){return new BPromise(function(_0x77d4ba,_0x30929c){return client[_0x0b86('0xb')](_0x35a22b,_0x428196)[_0x0b86('0xc')](function(_0xd04892){logger[_0x0b86('0xd')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0x0b86('0xe'));logger['debug'](_0x0b86('0xf'),_0x2a9631,'request\x20sent',JSON[_0x0b86('0x10')](_0xd04892));if(_0xd04892[_0x0b86('0x11')]){if(_0xd04892['error'][_0x0b86('0x12')]===0x1f4){logger[_0x0b86('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0xd04892[_0x0b86('0x11')][_0x0b86('0x13')]);return _0x30929c(_0xd04892[_0x0b86('0x11')]['message']);}logger[_0x0b86('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0xd04892[_0x0b86('0x11')]['message']);return _0x77d4ba(_0xd04892['error'][_0x0b86('0x13')]);}else{logger[_0x0b86('0xd')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0x0b86('0xe'));_0x77d4ba(_0xd04892[_0x0b86('0x14')][_0x0b86('0x13')]);}})[_0x0b86('0x15')](function(_0x18439e){logger[_0x0b86('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0x18439e);_0x30929c(_0x18439e);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index deae032..2990f50 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 _0xab01=['length','openchannelAccount:','save','remove','emit','removeListener','register'];(function(_0x17c66c,_0x57de99){var _0x346258=function(_0x2b5a2a){while(--_0x2b5a2a){_0x17c66c['push'](_0x17c66c['shift']());}};_0x346258(++_0x57de99);}(_0xab01,0xc6));var _0x1ab0=function(_0x442f5b,_0x39d79d){_0x442f5b=_0x442f5b-0x0;var _0x19fd96=_0xab01[_0x442f5b];return _0x19fd96;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x1ab0('0x0'),_0x1ab0('0x1'),'update'];function createListener(_0x251415,_0x360a04){return function(_0x581f0e){_0x360a04[_0x1ab0('0x2')](_0x251415,_0x581f0e);};}function removeListener(_0x444601,_0x71b9c1){return function(){OpenchannelAccountEvents[_0x1ab0('0x3')](_0x444601,_0x71b9c1);};}exports[_0x1ab0('0x4')]=function(_0x17c42b){for(var _0x26c910=0x0,_0x4bb8bb=events[_0x1ab0('0x5')];_0x26c910<_0x4bb8bb;_0x26c910++){var _0x41dbd1=events[_0x26c910];var _0xa436ec=createListener(_0x1ab0('0x6')+_0x41dbd1,_0x17c42b);OpenchannelAccountEvents['on'](_0x41dbd1,_0xa436ec);}}; \ No newline at end of file +var _0x307f=['remove','removeListener','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x1322d7,_0xbdf1c0){var _0x55d13b=function(_0x54129b){while(--_0x54129b){_0x1322d7['push'](_0x1322d7['shift']());}};_0x55d13b(++_0xbdf1c0);}(_0x307f,0x1de));var _0xf307=function(_0x4f116f,_0x32a0f3){_0x4f116f=_0x4f116f-0x0;var _0x55d850=_0x307f[_0x4f116f];return _0x55d850;};'use strict';var OpenchannelAccountEvents=require(_0xf307('0x0'));var events=[_0xf307('0x1'),_0xf307('0x2'),'update'];function createListener(_0x2750ee,_0x13f7d3){return function(_0x470ff8){_0x13f7d3['emit'](_0x2750ee,_0x470ff8);};}function removeListener(_0x43d8c3,_0x151a4f){return function(){OpenchannelAccountEvents[_0xf307('0x3')](_0x43d8c3,_0x151a4f);};}exports['register']=function(_0x58a3f9){for(var _0x41a981=0x0,_0x4c91c2=events['length'];_0x41a981<_0x4c91c2;_0x41a981++){var _0x2f9230=events[_0x41a981];var _0x2ac1e0=createListener(_0xf307('0x4')+_0x2f9230,_0x58a3f9);OpenchannelAccountEvents['on'](_0x2f9230,_0x2ac1e0);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index d7b33af..2a2b14d 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 _0xef64=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x56e8cc,_0x12992e){var _0x34d867=function(_0x593f68){while(--_0x593f68){_0x56e8cc['push'](_0x56e8cc['shift']());}};_0x34d867(++_0x12992e);}(_0xef64,0x16d));var _0x4ef6=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xef64[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0x4ef6('0x0'));var util=require(_0x4ef6('0x1'));var path=require(_0x4ef6('0x2'));var timeout=require(_0x4ef6('0x3'));var express=require(_0x4ef6('0x4'));var router=express['Router']();var auth=require(_0x4ef6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ef6('0x6'));var controller=require(_0x4ef6('0x7'));router['get']('/',auth[_0x4ef6('0x8')](),controller[_0x4ef6('0x9')]);router[_0x4ef6('0xa')](_0x4ef6('0xb'),auth[_0x4ef6('0x8')](),controller[_0x4ef6('0xc')]);router['post']('/',auth[_0x4ef6('0x8')](),controller[_0x4ef6('0xd')]);router[_0x4ef6('0xe')](_0x4ef6('0xb'),auth[_0x4ef6('0x8')](),controller[_0x4ef6('0xf')]);router[_0x4ef6('0x10')](_0x4ef6('0xb'),auth[_0x4ef6('0x8')](),controller[_0x4ef6('0x11')]);module[_0x4ef6('0x12')]=router; \ No newline at end of file +var _0x1d7f=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x4f592a,_0x5a6135){var _0x3b6069=function(_0x29a44e){while(--_0x29a44e){_0x4f592a['push'](_0x4f592a['shift']());}};_0x3b6069(++_0x5a6135);}(_0x1d7f,0x6a));var _0xf1d7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1d7f[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xf1d7('0x0'));var util=require(_0xf1d7('0x1'));var path=require('path');var timeout=require(_0xf1d7('0x2'));var express=require(_0xf1d7('0x3'));var router=express[_0xf1d7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf1d7('0x5'));var config=require(_0xf1d7('0x6'));var controller=require(_0xf1d7('0x7'));router[_0xf1d7('0x8')]('/',auth[_0xf1d7('0x9')](),controller[_0xf1d7('0xa')]);router[_0xf1d7('0x8')](_0xf1d7('0xb'),auth['isAuthenticated'](),controller[_0xf1d7('0xc')]);router[_0xf1d7('0xd')]('/',auth[_0xf1d7('0x9')](),controller[_0xf1d7('0xe')]);router['put'](_0xf1d7('0xb'),auth[_0xf1d7('0x9')](),controller[_0xf1d7('0xf')]);router[_0xf1d7('0x10')]('/:id',auth[_0xf1d7('0x9')](),controller['destroy']);module[_0xf1d7('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 93e8208..efc7837 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 _0x5d69=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1f5ee3,_0x42d31b){var _0x2db824=function(_0xa3030b){while(--_0xa3030b){_0x1f5ee3['push'](_0x1f5ee3['shift']());}};_0x2db824(++_0x42d31b);}(_0x5d69,0x87));var _0x95d6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5d69[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x95d6('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x95d6('0x1')],'allowNull':![],'defaultValue':_0x95d6('0x2')},'appdata':{'type':Sequelize[_0x95d6('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x95d6('0x1')],'defaultValue':_0x95d6('0x4')}}; \ No newline at end of file +var _0xd73a=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x173b68,_0x5d9619){var _0x48991f=function(_0x261ee9){while(--_0x261ee9){_0x173b68['push'](_0x173b68['shift']());}};_0x48991f(++_0x5d9619);}(_0xd73a,0xcf));var _0xad73=function(_0x114450,_0x28fc12){_0x114450=_0x114450-0x0;var _0x1e4b65=_0xd73a[_0x114450];return _0x1e4b65;};'use strict';var Sequelize=require(_0xad73('0x0'));module[_0xad73('0x1')]={'priority':{'type':Sequelize[_0xad73('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad73('0x3')},'appdata':{'type':Sequelize[_0xad73('0x4')]()},'description':{'type':Sequelize[_0xad73('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xad73('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 954212e..009df0d 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 _0xb0b3=['json','apply','save','destroy','then','name','map','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','OpenchannelApplication','findAll','rows','show','params','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xb0b3,0x69));var _0x3b0b=function(_0x16478e,_0x544885){_0x16478e=_0x16478e-0x0;var _0x177b0f=_0xb0b3[_0x16478e];return _0x177b0f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b0b('0x0'));var rimraf=require(_0x3b0b('0x1'));var zipdir=require(_0x3b0b('0x2'));var jsonpatch=require(_0x3b0b('0x3'));var rp=require('request-promise');var moment=require(_0x3b0b('0x4'));var BPromise=require(_0x3b0b('0x5'));var Mustache=require(_0x3b0b('0x6'));var util=require(_0x3b0b('0x7'));var path=require(_0x3b0b('0x8'));var sox=require('sox');var csv=require(_0x3b0b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b0b('0xa'));var squel=require(_0x3b0b('0xb'));var crypto=require(_0x3b0b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3b0b('0x9'));var querystring=require(_0x3b0b('0xd'));var Papa=require('papaparse');var Redis=require(_0x3b0b('0xe'));var authService=require(_0x3b0b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3b0b('0x10'));var hardwareService=require(_0x3b0b('0x11'));var logger=require(_0x3b0b('0x12'))(_0x3b0b('0x13'));var utils=require(_0x3b0b('0x14'));var config=require(_0x3b0b('0x15'));var db=require(_0x3b0b('0x16'))['db'];function respondWithStatusCode(_0x55ad19,_0x59be49){_0x59be49=_0x59be49||0xcc;return function(_0x283303){if(_0x283303){return _0x55ad19[_0x3b0b('0x17')](_0x59be49);}return _0x55ad19['status'](_0x59be49)[_0x3b0b('0x18')]();};}function respondWithResult(_0x35090c,_0x2ebfbe){_0x2ebfbe=_0x2ebfbe||0xc8;return function(_0x222a2c){if(_0x222a2c){return _0x35090c[_0x3b0b('0x19')](_0x2ebfbe)['json'](_0x222a2c);}};}function respondWithFilteredResult(_0x3a3efe,_0x2dc420){return function(_0x53b2ff){if(_0x53b2ff){var _0x2a4e98=_0x53b2ff[_0x3b0b('0x1a')],_0x3ae83d=_0x2dc420[_0x3b0b('0x1b')],_0x4b504a=_0x2dc420[_0x3b0b('0x1b')]+_0x2dc420[_0x3b0b('0x1c')],_0x4535ec;if(_0x4b504a>=_0x2a4e98){_0x4b504a=_0x2a4e98;_0x4535ec=0xc8;}else{_0x4535ec=0xce;}_0x3a3efe[_0x3b0b('0x19')](_0x4535ec);return _0x3a3efe[_0x3b0b('0x1d')](_0x3b0b('0x1e'),_0x3ae83d+'-'+_0x4b504a+'/'+_0x2a4e98)[_0x3b0b('0x1f')](_0x53b2ff);}return null;};}function patchUpdates(_0xafb3f5){return function(_0x46668c){try{jsonpatch[_0x3b0b('0x20')](_0x46668c,_0xafb3f5,!![]);}catch(_0x4d0c6d){return BPromise['reject'](_0x4d0c6d);}return _0x46668c[_0x3b0b('0x21')]();};}function saveUpdates(_0x52cee2,_0x1a2e98){return function(_0x27ab83){if(_0x27ab83){return _0x27ab83['update'](_0x52cee2)['then'](function(_0x2a190b){return _0x2a190b;});}return null;};}function removeEntity(_0x1def77,_0x5412b4){return function(_0x39a24b){if(_0x39a24b){return _0x39a24b[_0x3b0b('0x22')]()[_0x3b0b('0x23')](function(){_0x1def77['status'](0xcc)[_0x3b0b('0x18')]();});}};}function handleEntityNotFound(_0x595fd5,_0x567cbb){return function(_0x1a1d47){if(!_0x1a1d47){_0x595fd5[_0x3b0b('0x17')](0x194);}return _0x1a1d47;};}function handleError(_0x5aaf9e,_0x3da0ef){_0x3da0ef=_0x3da0ef||0x1f4;return function(_0x527f02){logger['error'](_0x527f02['stack']);if(_0x527f02[_0x3b0b('0x24')]){delete _0x527f02[_0x3b0b('0x24')];}_0x5aaf9e[_0x3b0b('0x19')](_0x3da0ef)['send'](_0x527f02);};}exports['index']=function(_0x2ea561,_0x53f81c){var _0x432d01={},_0x51d693={},_0x2e0ab6={'count':0x0,'rows':[]};var _0x51bcd6=_[_0x3b0b('0x25')](db['OpenchannelApplication']['rawAttributes'],function(_0x15628d){return{'name':_0x15628d['fieldName'],'type':_0x15628d[_0x3b0b('0x26')][_0x3b0b('0x27')]};});_0x51d693[_0x3b0b('0x28')]=_[_0x3b0b('0x25')](_0x51bcd6,_0x3b0b('0x24'));_0x51d693[_0x3b0b('0x29')]=_[_0x3b0b('0x2a')](_0x2ea561[_0x3b0b('0x29')]);_0x51d693['filters']=_[_0x3b0b('0x2b')](_0x51d693[_0x3b0b('0x28')],_0x51d693['query']);_0x432d01[_0x3b0b('0x2c')]=_['intersection'](_0x51d693[_0x3b0b('0x28')],qs[_0x3b0b('0x2d')](_0x2ea561[_0x3b0b('0x29')]['fields']));_0x432d01[_0x3b0b('0x2c')]=_0x432d01['attributes'][_0x3b0b('0x2e')]?_0x432d01['attributes']:_0x51d693[_0x3b0b('0x28')];if(!_0x2ea561['query']['hasOwnProperty'](_0x3b0b('0x2f'))){_0x432d01[_0x3b0b('0x1c')]=qs[_0x3b0b('0x1c')](_0x2ea561['query'][_0x3b0b('0x1c')]);_0x432d01[_0x3b0b('0x1b')]=qs[_0x3b0b('0x1b')](_0x2ea561[_0x3b0b('0x29')][_0x3b0b('0x1b')]);}_0x432d01[_0x3b0b('0x30')]=qs[_0x3b0b('0x31')](_0x2ea561[_0x3b0b('0x29')][_0x3b0b('0x31')]);_0x432d01[_0x3b0b('0x32')]=qs[_0x3b0b('0x33')](_[_0x3b0b('0x34')](_0x2ea561[_0x3b0b('0x29')],_0x51d693[_0x3b0b('0x33')]),_0x51bcd6);if(_0x2ea561['query']['filter']){_0x432d01[_0x3b0b('0x32')]=_[_0x3b0b('0x35')](_0x432d01[_0x3b0b('0x32')],{'$or':_[_0x3b0b('0x25')](_0x51bcd6,function(_0x3fa66d){if(_0x3fa66d[_0x3b0b('0x26')]!==_0x3b0b('0x36')){var _0x1845f1={};_0x1845f1[_0x3fa66d[_0x3b0b('0x24')]]={'$like':'%'+_0x2ea561[_0x3b0b('0x29')]['filter']+'%'};return _0x1845f1;}})});}_0x432d01=_['merge']({},_0x432d01,_0x2ea561[_0x3b0b('0x37')]);var _0x2db9c8={'where':_0x432d01[_0x3b0b('0x32')]};return db['OpenchannelApplication'][_0x3b0b('0x1a')](_0x2db9c8)[_0x3b0b('0x23')](function(_0x16cb98){_0x2e0ab6['count']=_0x16cb98;if(_0x2ea561['query'][_0x3b0b('0x38')]){_0x432d01[_0x3b0b('0x39')]=[{'all':!![]}];}return db[_0x3b0b('0x3a')][_0x3b0b('0x3b')](_0x432d01);})[_0x3b0b('0x23')](function(_0x41b542){_0x2e0ab6[_0x3b0b('0x3c')]=_0x41b542;return _0x2e0ab6;})[_0x3b0b('0x23')](respondWithFilteredResult(_0x53f81c,_0x432d01))['catch'](handleError(_0x53f81c,null));};exports[_0x3b0b('0x3d')]=function(_0x43b576,_0x6c568f){var _0x13dd79={'raw':!![],'where':{'id':_0x43b576[_0x3b0b('0x3e')]['id']}},_0x9e7902={};_0x9e7902[_0x3b0b('0x28')]=_[_0x3b0b('0x2a')](db[_0x3b0b('0x3a')]['rawAttributes']);_0x9e7902['query']=_[_0x3b0b('0x2a')](_0x43b576[_0x3b0b('0x29')]);_0x9e7902[_0x3b0b('0x33')]=_[_0x3b0b('0x2b')](_0x9e7902[_0x3b0b('0x28')],_0x9e7902[_0x3b0b('0x29')]);_0x13dd79['attributes']=_[_0x3b0b('0x2b')](_0x9e7902['model'],qs[_0x3b0b('0x2d')](_0x43b576[_0x3b0b('0x29')][_0x3b0b('0x2d')]));_0x13dd79[_0x3b0b('0x2c')]=_0x13dd79[_0x3b0b('0x2c')]['length']?_0x13dd79['attributes']:_0x9e7902['model'];if(_0x43b576[_0x3b0b('0x29')][_0x3b0b('0x38')]){_0x13dd79[_0x3b0b('0x39')]=[{'all':!![]}];}_0x13dd79=_[_0x3b0b('0x35')]({},_0x13dd79,_0x43b576[_0x3b0b('0x37')]);return db['OpenchannelApplication'][_0x3b0b('0x3f')](_0x13dd79)['then'](handleEntityNotFound(_0x6c568f,null))['then'](respondWithResult(_0x6c568f,null))['catch'](handleError(_0x6c568f,null));};exports[_0x3b0b('0x40')]=function(_0x37f8d8,_0x490caa){return db[_0x3b0b('0x3a')]['create'](_0x37f8d8[_0x3b0b('0x41')],{})[_0x3b0b('0x23')](respondWithResult(_0x490caa,0xc9))[_0x3b0b('0x42')](handleError(_0x490caa,null));};exports[_0x3b0b('0x43')]=function(_0x4632d1,_0x1dbd2d){if(_0x4632d1[_0x3b0b('0x41')]['id']){delete _0x4632d1[_0x3b0b('0x41')]['id'];}return db[_0x3b0b('0x3a')][_0x3b0b('0x3f')]({'where':{'id':_0x4632d1[_0x3b0b('0x3e')]['id']}})[_0x3b0b('0x23')](handleEntityNotFound(_0x1dbd2d,null))[_0x3b0b('0x23')](saveUpdates(_0x4632d1[_0x3b0b('0x41')],null))['then'](respondWithResult(_0x1dbd2d,null))[_0x3b0b('0x42')](handleError(_0x1dbd2d,null));};exports['destroy']=function(_0x5ef9d6,_0x38193b){return db['OpenchannelApplication'][_0x3b0b('0x3f')]({'where':{'id':_0x5ef9d6['params']['id']}})[_0x3b0b('0x23')](handleEntityNotFound(_0x38193b,null))['then'](removeEntity(_0x38193b,null))[_0x3b0b('0x42')](handleError(_0x38193b,null));}; \ No newline at end of file +var _0xf23e=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','OpenchannelApplication','rows','catch','show','params','options','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xf23e,0xff));var _0xef23=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xf23e[_0x2642cb];return _0xe6e41;};'use strict';var pdf=require(_0xef23('0x0'));var emlformat=require(_0xef23('0x1'));var rimraf=require(_0xef23('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xef23('0x3'));var moment=require(_0xef23('0x4'));var BPromise=require(_0xef23('0x5'));var Mustache=require('mustache');var util=require(_0xef23('0x6'));var path=require(_0xef23('0x7'));var sox=require(_0xef23('0x8'));var csv=require(_0xef23('0x9'));var ejs=require(_0xef23('0xa'));var fs=require('fs');var _=require(_0xef23('0xb'));var squel=require(_0xef23('0xc'));var crypto=require('crypto');var jsforce=require(_0xef23('0xd'));var deskjs=require(_0xef23('0xe'));var toCsv=require(_0xef23('0x9'));var querystring=require(_0xef23('0xf'));var Papa=require('papaparse');var Redis=require(_0xef23('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xef23('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef23('0x12'));var logger=require(_0xef23('0x13'))(_0xef23('0x14'));var utils=require(_0xef23('0x15'));var config=require(_0xef23('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe461bb,_0x1abb66){_0x1abb66=_0x1abb66||0xcc;return function(_0x3ad43d){if(_0x3ad43d){return _0xe461bb[_0xef23('0x17')](_0x1abb66);}return _0xe461bb['status'](_0x1abb66)['end']();};}function respondWithResult(_0x467d49,_0x3acfef){_0x3acfef=_0x3acfef||0xc8;return function(_0x5aa039){if(_0x5aa039){return _0x467d49[_0xef23('0x18')](_0x3acfef)[_0xef23('0x19')](_0x5aa039);}};}function respondWithFilteredResult(_0x319377,_0x176a1c){return function(_0x69ed47){if(_0x69ed47){var _0x4f4fb3=_0x69ed47[_0xef23('0x1a')],_0x32fe51=_0x176a1c[_0xef23('0x1b')],_0x58583b=_0x176a1c[_0xef23('0x1b')]+_0x176a1c[_0xef23('0x1c')],_0x21a562;if(_0x58583b>=_0x4f4fb3){_0x58583b=_0x4f4fb3;_0x21a562=0xc8;}else{_0x21a562=0xce;}_0x319377[_0xef23('0x18')](_0x21a562);return _0x319377[_0xef23('0x1d')](_0xef23('0x1e'),_0x32fe51+'-'+_0x58583b+'/'+_0x4f4fb3)[_0xef23('0x19')](_0x69ed47);}return null;};}function patchUpdates(_0x5696b9){return function(_0x4fe0b){try{jsonpatch[_0xef23('0x1f')](_0x4fe0b,_0x5696b9,!![]);}catch(_0x5f8738){return BPromise[_0xef23('0x20')](_0x5f8738);}return _0x4fe0b[_0xef23('0x21')]();};}function saveUpdates(_0x199a9b,_0x338dbb){return function(_0x2c3177){if(_0x2c3177){return _0x2c3177['update'](_0x199a9b)[_0xef23('0x22')](function(_0x5236f1){return _0x5236f1;});}return null;};}function removeEntity(_0x2d4068,_0x1a690e){return function(_0x72744){if(_0x72744){return _0x72744[_0xef23('0x23')]()[_0xef23('0x22')](function(){_0x2d4068['status'](0xcc)[_0xef23('0x24')]();});}};}function handleEntityNotFound(_0xb86c1a,_0x314816){return function(_0x1da6ef){if(!_0x1da6ef){_0xb86c1a[_0xef23('0x17')](0x194);}return _0x1da6ef;};}function handleError(_0x3aca35,_0x49bc94){_0x49bc94=_0x49bc94||0x1f4;return function(_0x1216bf){logger[_0xef23('0x25')](_0x1216bf[_0xef23('0x26')]);if(_0x1216bf['name']){delete _0x1216bf[_0xef23('0x27')];}_0x3aca35[_0xef23('0x18')](_0x49bc94)[_0xef23('0x28')](_0x1216bf);};}exports[_0xef23('0x29')]=function(_0x53716f,_0x4cfdf8){var _0x4972d3={},_0x3d3c66={},_0x4b2cc0={'count':0x0,'rows':[]};var _0x26b1cd=_['map'](db['OpenchannelApplication']['rawAttributes'],function(_0x235dae){return{'name':_0x235dae['fieldName'],'type':_0x235dae[_0xef23('0x2a')][_0xef23('0x2b')]};});_0x3d3c66[_0xef23('0x2c')]=_[_0xef23('0x2d')](_0x26b1cd,_0xef23('0x27'));_0x3d3c66[_0xef23('0x2e')]=_[_0xef23('0x2f')](_0x53716f[_0xef23('0x2e')]);_0x3d3c66[_0xef23('0x30')]=_[_0xef23('0x31')](_0x3d3c66[_0xef23('0x2c')],_0x3d3c66['query']);_0x4972d3[_0xef23('0x32')]=_['intersection'](_0x3d3c66[_0xef23('0x2c')],qs[_0xef23('0x33')](_0x53716f[_0xef23('0x2e')][_0xef23('0x33')]));_0x4972d3[_0xef23('0x32')]=_0x4972d3['attributes'][_0xef23('0x34')]?_0x4972d3[_0xef23('0x32')]:_0x3d3c66[_0xef23('0x2c')];if(!_0x53716f[_0xef23('0x2e')][_0xef23('0x35')](_0xef23('0x36'))){_0x4972d3[_0xef23('0x1c')]=qs[_0xef23('0x1c')](_0x53716f[_0xef23('0x2e')][_0xef23('0x1c')]);_0x4972d3['offset']=qs[_0xef23('0x1b')](_0x53716f[_0xef23('0x2e')][_0xef23('0x1b')]);}_0x4972d3['order']=qs[_0xef23('0x37')](_0x53716f[_0xef23('0x2e')][_0xef23('0x37')]);_0x4972d3[_0xef23('0x38')]=qs['filters'](_[_0xef23('0x39')](_0x53716f['query'],_0x3d3c66[_0xef23('0x30')]),_0x26b1cd);if(_0x53716f[_0xef23('0x2e')]['filter']){_0x4972d3[_0xef23('0x38')]=_[_0xef23('0x3a')](_0x4972d3[_0xef23('0x38')],{'$or':_[_0xef23('0x2d')](_0x26b1cd,function(_0x48e420){if(_0x48e420['type']!=='VIRTUAL'){var _0x5ba4cc={};_0x5ba4cc[_0x48e420[_0xef23('0x27')]]={'$like':'%'+_0x53716f[_0xef23('0x2e')]['filter']+'%'};return _0x5ba4cc;}})});}_0x4972d3=_['merge']({},_0x4972d3,_0x53716f['options']);var _0x1cf864={'where':_0x4972d3[_0xef23('0x38')]};return db['OpenchannelApplication'][_0xef23('0x1a')](_0x1cf864)[_0xef23('0x22')](function(_0x277b3f){_0x4b2cc0[_0xef23('0x1a')]=_0x277b3f;if(_0x53716f[_0xef23('0x2e')][_0xef23('0x3b')]){_0x4972d3[_0xef23('0x3c')]=[{'all':!![]}];}return db[_0xef23('0x3d')]['findAll'](_0x4972d3);})[_0xef23('0x22')](function(_0x39d746){_0x4b2cc0[_0xef23('0x3e')]=_0x39d746;return _0x4b2cc0;})[_0xef23('0x22')](respondWithFilteredResult(_0x4cfdf8,_0x4972d3))[_0xef23('0x3f')](handleError(_0x4cfdf8,null));};exports[_0xef23('0x40')]=function(_0x454a81,_0x73d5d5){var _0x48fc8a={'raw':!![],'where':{'id':_0x454a81[_0xef23('0x41')]['id']}},_0x293ccf={};_0x293ccf['model']=_[_0xef23('0x2f')](db[_0xef23('0x3d')]['rawAttributes']);_0x293ccf[_0xef23('0x2e')]=_[_0xef23('0x2f')](_0x454a81[_0xef23('0x2e')]);_0x293ccf[_0xef23('0x30')]=_['intersection'](_0x293ccf['model'],_0x293ccf['query']);_0x48fc8a[_0xef23('0x32')]=_[_0xef23('0x31')](_0x293ccf['model'],qs[_0xef23('0x33')](_0x454a81['query'][_0xef23('0x33')]));_0x48fc8a['attributes']=_0x48fc8a[_0xef23('0x32')]['length']?_0x48fc8a[_0xef23('0x32')]:_0x293ccf[_0xef23('0x2c')];if(_0x454a81[_0xef23('0x2e')][_0xef23('0x3b')]){_0x48fc8a[_0xef23('0x3c')]=[{'all':!![]}];}_0x48fc8a=_[_0xef23('0x3a')]({},_0x48fc8a,_0x454a81[_0xef23('0x42')]);return db[_0xef23('0x3d')][_0xef23('0x43')](_0x48fc8a)[_0xef23('0x22')](handleEntityNotFound(_0x73d5d5,null))[_0xef23('0x22')](respondWithResult(_0x73d5d5,null))[_0xef23('0x3f')](handleError(_0x73d5d5,null));};exports['create']=function(_0xeb7b6e,_0xea5591){return db['OpenchannelApplication'][_0xef23('0x44')](_0xeb7b6e['body'],{})[_0xef23('0x22')](respondWithResult(_0xea5591,0xc9))[_0xef23('0x3f')](handleError(_0xea5591,null));};exports['update']=function(_0xa6f8fa,_0x4c8788){if(_0xa6f8fa['body']['id']){delete _0xa6f8fa[_0xef23('0x45')]['id'];}return db[_0xef23('0x3d')][_0xef23('0x43')]({'where':{'id':_0xa6f8fa[_0xef23('0x41')]['id']}})[_0xef23('0x22')](handleEntityNotFound(_0x4c8788,null))[_0xef23('0x22')](saveUpdates(_0xa6f8fa[_0xef23('0x45')],null))[_0xef23('0x22')](respondWithResult(_0x4c8788,null))[_0xef23('0x3f')](handleError(_0x4c8788,null));};exports['destroy']=function(_0x374ba1,_0x2ccbcc){return db['OpenchannelApplication']['find']({'where':{'id':_0x374ba1[_0xef23('0x41')]['id']}})[_0xef23('0x22')](handleEntityNotFound(_0x2ccbcc,null))[_0xef23('0x22')](removeEntity(_0x2ccbcc,null))[_0xef23('0x3f')](handleError(_0x2ccbcc,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 63cae7b..a35f578 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 _0x75a3=['utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x75a3,0xd1));var _0x375a=function(_0x87c726,_0x2235d3){_0x87c726=_0x87c726-0x0;var _0xbcdcdd=_0x75a3[_0x87c726];return _0xbcdcdd;};'use strict';var _=require(_0x375a('0x0'));var util=require('util');var logger=require(_0x375a('0x1'))(_0x375a('0x2'));var moment=require('moment');var BPromise=require(_0x375a('0x3'));var rp=require(_0x375a('0x4'));var fs=require('fs');var path=require(_0x375a('0x5'));var rimraf=require('rimraf');var config=require(_0x375a('0x6'));var attributes=require(_0x375a('0x7'));module[_0x375a('0x8')]=function(_0x4c23ee,_0x1f6975){return _0x4c23ee[_0x375a('0x9')](_0x375a('0xa'),attributes,{'tableName':_0x375a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x375a('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7880=['bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','api','moment'];(function(_0x55b142,_0x547c52){var _0x408769=function(_0x1d89e1){while(--_0x1d89e1){_0x55b142['push'](_0x55b142['shift']());}};_0x408769(++_0x547c52);}(_0x7880,0x1f4));var _0x0788=function(_0x153c6a,_0x2a217a){_0x153c6a=_0x153c6a-0x0;var _0xce898f=_0x7880[_0x153c6a];return _0xce898f;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));module[_0x0788('0x9')]=function(_0x262f5c,_0x775629){return _0x262f5c[_0x0788('0xa')](_0x0788('0xb'),attributes,{'tableName':_0x0788('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0788('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index aef3309..2721ab6 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x48e046,_0x113479){var _0x5bdf06=function(_0x53302f){while(--_0x53302f){_0x48e046['push'](_0x48e046['shift']());}};_0x5bdf06(++_0x113479);}(_0xb10b,0x12a));var _0xbb10=function(_0x388ccc,_0x2a24fd){_0x388ccc=_0x388ccc-0x0;var _0x570c20=_0xb10b[_0x388ccc];return _0x570c20;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xf810be,_0x4c896c){var _0x161387=function(_0x135582){while(--_0x135582){_0xf810be['push'](_0xf810be['shift']());}};_0x161387(++_0x4c896c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f8bc6,_0x4dc869){_0x2f8bc6=_0x2f8bc6-0x0;var _0x2d008a=_0xb10b[_0x2f8bc6];return _0x2d008a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 48344bd..e215ca7 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 _0x3913=['removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','addTags','put','tracked','openchannel','openchannelinteraction:update','delete','destroy'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x3913,0x182));var _0x3391=function(_0x5c77c2,_0x59b073){_0x5c77c2=_0x5c77c2-0x0;var _0x4f404b=_0x3913[_0x5c77c2];return _0x4f404b;};'use strict';var multer=require(_0x3391('0x0'));var util=require(_0x3391('0x1'));var path=require(_0x3391('0x2'));var timeout=require(_0x3391('0x3'));var express=require(_0x3391('0x4'));var router=express[_0x3391('0x5')]();var auth=require(_0x3391('0x6'));var interaction=require(_0x3391('0x7'));var config=require('../../config/environment');var controller=require(_0x3391('0x8'));router[_0x3391('0x9')]('/',auth[_0x3391('0xa')](),controller[_0x3391('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3391('0xc')]);router[_0x3391('0x9')](_0x3391('0xd'),auth[_0x3391('0xa')](),controller[_0x3391('0xe')]);router[_0x3391('0x9')](_0x3391('0xf'),auth['isAuthenticated'](),controller[_0x3391('0x10')]);router[_0x3391('0x9')](_0x3391('0x11'),auth['isAuthenticated'](),controller[_0x3391('0x12')]);router[_0x3391('0x13')]('/',auth[_0x3391('0xa')](),controller[_0x3391('0x14')]);router['post'](_0x3391('0xf'),auth[_0x3391('0xa')](),controller[_0x3391('0x15')]);router[_0x3391('0x13')](_0x3391('0x16'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller[_0x3391('0x17')]);router[_0x3391('0x18')](_0x3391('0xd'),auth['isAuthenticated'](),interaction[_0x3391('0x19')](_0x3391('0x1a'),_0x3391('0x1b')),controller['update']);router[_0x3391('0x1c')]('/:id',auth[_0x3391('0xa')](),interaction['tracked'](_0x3391('0x1a'),'openchannelinteraction:destroy'),controller[_0x3391('0x1d')]);router['delete'](_0x3391('0x16'),auth['isAuthenticated'](),controller[_0x3391('0x1e')]);module[_0x3391('0x1f')]=router; \ No newline at end of file +var _0xd755=['openchannelinteraction:destroy','destroy','removeTags','exports','util','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','/:id','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','addTags','put','update','delete'];(function(_0x3c2fd8,_0x2e7324){var _0x1e1b5e=function(_0x278d00){while(--_0x278d00){_0x3c2fd8['push'](_0x3c2fd8['shift']());}};_0x1e1b5e(++_0x2e7324);}(_0xd755,0x130));var _0x5d75=function(_0x336adb,_0x1c3608){_0x336adb=_0x336adb-0x0;var _0x5be7f5=_0xd755[_0x336adb];return _0x5be7f5;};'use strict';var multer=require('multer');var util=require(_0x5d75('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5d75('0x1'));var config=require(_0x5d75('0x2'));var controller=require(_0x5d75('0x3'));router[_0x5d75('0x4')]('/',auth[_0x5d75('0x5')](),controller['index']);router['get'](_0x5d75('0x6'),auth[_0x5d75('0x5')](),controller['describe']);router['get'](_0x5d75('0x7'),auth[_0x5d75('0x5')](),controller['show']);router[_0x5d75('0x4')]('/:id/messages',auth[_0x5d75('0x5')](),controller[_0x5d75('0x8')]);router[_0x5d75('0x4')](_0x5d75('0x9'),auth[_0x5d75('0x5')](),controller['download']);router[_0x5d75('0xa')]('/',auth[_0x5d75('0x5')](),controller[_0x5d75('0xb')]);router[_0x5d75('0xa')](_0x5d75('0xc'),auth['isAuthenticated'](),controller[_0x5d75('0xd')]);router[_0x5d75('0xa')](_0x5d75('0xe'),auth[_0x5d75('0x5')](),interaction[_0x5d75('0xf')](_0x5d75('0x10'),'openchannelinteraction:addtags'),controller[_0x5d75('0x11')]);router[_0x5d75('0x12')](_0x5d75('0x7'),auth['isAuthenticated'](),interaction[_0x5d75('0xf')](_0x5d75('0x10'),'openchannelinteraction:update'),controller[_0x5d75('0x13')]);router[_0x5d75('0x14')](_0x5d75('0x7'),auth[_0x5d75('0x5')](),interaction[_0x5d75('0xf')](_0x5d75('0x10'),_0x5d75('0x15')),controller[_0x5d75('0x16')]);router[_0x5d75('0x14')](_0x5d75('0xe'),auth[_0x5d75('0x5')](),controller[_0x5d75('0x17')]);module[_0x5d75('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5c67de0..ac1f16f 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 _0xee00=['out','exports','DATE','STRING','ENUM'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0xee00,0x123));var _0x0ee0=function(_0x17d8ef,_0x2d6a9f){_0x17d8ef=_0x17d8ef-0x0;var _0x297377=_0xee00[_0x17d8ef];return _0x297377;};'use strict';var Sequelize=require('sequelize');module[_0x0ee0('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0ee0('0x1')]},'disposition':{'type':Sequelize[_0x0ee0('0x2')]},'note':{'type':Sequelize[_0x0ee0('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x0ee0('0x2')]},'lastMsgAt':{'type':Sequelize[_0x0ee0('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x0ee0('0x3')]('in',_0x0ee0('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0ee0('0x2')]}}; \ No newline at end of file +var _0xadb3=['out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xadb3,0x97));var _0x3adb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xadb3[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x3adb('0x0'));module[_0x3adb('0x1')]={'closed':{'type':Sequelize[_0x3adb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3adb('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3adb('0x4')]},'threadId':{'type':Sequelize[_0x3adb('0x3')]},'externalUrl':{'type':Sequelize[_0x3adb('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3adb('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3adb('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3473bb1..2a2920a 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 _0x07a4=['\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','firstName','renderFile','server','views','downloadInteraction.html','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','destroy','stack','name','send','Users','map','fullname','Tags','TagIds','split','push','catch','index','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','isEmpty','sequelize','toString','count','keyBy','OpenchannelInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','show','includeAll','include','merge','options','create','body','params','OpenchannelMessage','ids','omit','getMessages','findOne','rawAttributes','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','join','root','files','tmp','attachments','format','transcript-%d-%s.zip','lastName','Attachment','Messages','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'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x07a4,0x1ef));var _0x407a=function(_0x323eeb,_0x3d168d){_0x323eeb=_0x323eeb-0x0;var _0x116de9=_0x07a4[_0x323eeb];return _0x116de9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x407a('0x0'));var rimraf=require(_0x407a('0x1'));var zipdir=require(_0x407a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x407a('0x3'));var moment=require(_0x407a('0x4'));var BPromise=require(_0x407a('0x5'));var Mustache=require(_0x407a('0x6'));var util=require(_0x407a('0x7'));var path=require(_0x407a('0x8'));var sox=require(_0x407a('0x9'));var csv=require(_0x407a('0xa'));var ejs=require(_0x407a('0xb'));var fs=require('fs');var _=require(_0x407a('0xc'));var squel=require(_0x407a('0xd'));var crypto=require(_0x407a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x407a('0xf'));var toCsv=require(_0x407a('0xa'));var querystring=require('querystring');var Papa=require(_0x407a('0x10'));var Redis=require(_0x407a('0x11'));var authService=require(_0x407a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x407a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x407a('0x14'))(_0x407a('0x15'));var utils=require('../../config/utils');var config=require(_0x407a('0x16'));var db=require(_0x407a('0x17'))['db'];config[_0x407a('0x18')]=_['defaults'](config['redis'],{'host':_0x407a('0x19'),'port':0x18eb});var socket=require(_0x407a('0x1a'))(new Redis(config['redis']));require(_0x407a('0x1b'))[_0x407a('0x1c')](socket);function respondWithStatusCode(_0x629221,_0x5e912c){_0x5e912c=_0x5e912c||0xcc;return function(_0x114fa8){if(_0x114fa8){return _0x629221[_0x407a('0x1d')](_0x5e912c);}return _0x629221[_0x407a('0x1e')](_0x5e912c)[_0x407a('0x1f')]();};}function respondWithResult(_0xd764e6,_0x25cf1a){_0x25cf1a=_0x25cf1a||0xc8;return function(_0x1651f3){if(_0x1651f3){return _0xd764e6[_0x407a('0x1e')](_0x25cf1a)[_0x407a('0x20')](_0x1651f3);}};}function respondWithFilteredResult(_0x5e27be,_0x22ae07){return function(_0x3119ea){if(_0x3119ea){var _0x129737=_0x3119ea['count'],_0xef8046=_0x22ae07[_0x407a('0x21')],_0x175321=_0x22ae07[_0x407a('0x21')]+_0x22ae07['limit'],_0xcd49a2;if(_0x175321>=_0x129737){_0x175321=_0x129737;_0xcd49a2=0xc8;}else{_0xcd49a2=0xce;}_0x5e27be['status'](_0xcd49a2);return _0x5e27be[_0x407a('0x22')]('Content-Range',_0xef8046+'-'+_0x175321+'/'+_0x129737)[_0x407a('0x20')](_0x3119ea);}return null;};}function patchUpdates(_0x4c9df6){return function(_0x28cb8c){try{jsonpatch[_0x407a('0x23')](_0x28cb8c,_0x4c9df6,!![]);}catch(_0x4d1800){return BPromise[_0x407a('0x24')](_0x4d1800);}return _0x28cb8c[_0x407a('0x25')]();};}function saveUpdates(_0x5b3780,_0x1e0c64){return function(_0x5ec91b){if(_0x5ec91b){return _0x5ec91b[_0x407a('0x26')](_0x5b3780)[_0x407a('0x27')](function(_0x4bdbd0){return _0x4bdbd0;});}return null;};}function removeEntity(_0x22c649,_0x5cdcc9){return function(_0x4b78ca){if(_0x4b78ca){return _0x4b78ca[_0x407a('0x28')]()[_0x407a('0x27')](function(){_0x22c649['status'](0xcc)[_0x407a('0x1f')]();});}};}function handleEntityNotFound(_0x580647,_0x5f2586){return function(_0x368715){if(!_0x368715){_0x580647[_0x407a('0x1d')](0x194);}return _0x368715;};}function handleError(_0xde8c65,_0x2ad01c){_0x2ad01c=_0x2ad01c||0x1f4;return function(_0x269c9c){logger['error'](_0x269c9c[_0x407a('0x29')]);if(_0x269c9c[_0x407a('0x2a')]){delete _0x269c9c[_0x407a('0x2a')];}_0xde8c65['status'](_0x2ad01c)[_0x407a('0x2b')](_0x269c9c);};}function getInteractionUsers(_0x1062e0,_0x1baaf3){return new BPromise(function(_0x452a46,_0x186b67){try{if(_0x1baaf3[_0x1062e0['id']]){_0x1062e0[_0x407a('0x2c')]=_[_0x407a('0x2d')](_0x1baaf3[_0x1062e0['id']],function(_0x45dfb7){return{'id':_0x45dfb7['id'],'fullname':_0x45dfb7[_0x407a('0x2e')]};});}}catch(_0x52d130){_0x186b67(_0x52d130);}_0x452a46(_0x1062e0);});}function getInteractionTags(_0x731bf2,_0x148c98){return new BPromise(function(_0x42576b,_0x229228){try{if(_0x731bf2['TagIds']){_0x731bf2[_0x407a('0x2f')]=[];_0x731bf2[_0x407a('0x30')][_0x407a('0x31')](',')['forEach'](function(_0x16700c){_0x731bf2[_0x407a('0x2f')][_0x407a('0x32')](_0x148c98[_0x16700c]);});}delete _0x731bf2[_0x407a('0x30')];}catch(_0x972ff4){_0x229228(_0x972ff4);}_0x42576b(_0x731bf2);});}function updateOpenchannelInteraction(_0x1a8a12,_0x526a90,_0x52c3dd){return new BPromise(function(_0x29d4ed,_0x13a3a9){return getInteractionUsers(_0x1a8a12,_0x52c3dd)[_0x407a('0x27')](function(_0x46d814){return getInteractionTags(_0x46d814,_0x526a90);})[_0x407a('0x27')](function(_0x20e434){_0x29d4ed(_0x20e434);})[_0x407a('0x33')](function(_0x355d71){_0x13a3a9(_0x355d71);});});}exports[_0x407a('0x34')]=function(_0x2020cf,_0x4e6911){var _0x6e9c86={},_0x2ee968={},_0x345ad8={'count':0x0,'rows':[]};var _0x35a016=_[_0x407a('0x2d')](db['OpenchannelInteraction']['rawAttributes'],function(_0x167b2b){return{'name':_0x167b2b[_0x407a('0x35')],'type':_0x167b2b[_0x407a('0x36')][_0x407a('0x37')]};});_0x2ee968['model']=_[_0x407a('0x2d')](_0x35a016,'name');_0x2ee968['query']=_[_0x407a('0x38')](_0x2020cf[_0x407a('0x39')]);_0x2ee968[_0x407a('0x3a')]=_[_0x407a('0x3b')](_0x2ee968[_0x407a('0x3c')],_0x2ee968[_0x407a('0x39')]);_0x6e9c86[_0x407a('0x3d')]=_['intersection'](_0x2ee968[_0x407a('0x3c')],qs[_0x407a('0x3e')](_0x2020cf[_0x407a('0x39')]['fields']));_0x6e9c86[_0x407a('0x3d')]=_0x6e9c86[_0x407a('0x3d')][_0x407a('0x3f')]?_0x6e9c86[_0x407a('0x3d')]:_0x2ee968[_0x407a('0x3c')];if(!_0x2020cf['query'][_0x407a('0x40')](_0x407a('0x41'))){_0x6e9c86[_0x407a('0x42')]=qs[_0x407a('0x42')](_0x2020cf[_0x407a('0x39')]['limit']);_0x6e9c86[_0x407a('0x21')]=qs[_0x407a('0x21')](_0x2020cf['query'][_0x407a('0x21')]);}_0x6e9c86[_0x407a('0x43')]=qs[_0x407a('0x44')](_0x2020cf[_0x407a('0x39')][_0x407a('0x44')]);_0x6e9c86[_0x407a('0x45')]=qs[_0x407a('0x3a')](_[_0x407a('0x46')](_0x2020cf['query'],_0x2ee968[_0x407a('0x3a')]),_0x35a016);var _0xd67be8=[];var _0x220795=squel['select']()[_0x407a('0x47')]('id')[_0x407a('0x47')]('name')[_0x407a('0x47')](_0x407a('0x48'))[_0x407a('0x49')](_0x407a('0x4a'));var _0x111a50=squel[_0x407a('0x4b')]()[_0x407a('0x47')](_0x407a('0x4c'))[_0x407a('0x47')]('u.fullname')['field'](_0x407a('0x4d'))[_0x407a('0x49')](_0x407a('0x4e'),'ui')['left_join']('users','u',_0x407a('0x4f'));var _0x18ee56=squel[_0x407a('0x4b')]()['from'](_0x407a('0x50'),'i')[_0x407a('0x51')](_0x407a('0x52'),'c',_0x407a('0x53'))['left_join'](_0x407a('0x54'),'o','o.id\x20=\x20i.UserId')[_0x407a('0x51')](_0x407a('0x55'),'a',_0x407a('0x56'))[_0x407a('0x51')]('openchannel_messages','me',_0x407a('0x57'))[_0x407a('0x51')](_0x407a('0x58'),'it',_0x407a('0x59'))['left_join']('tools_tags','t',_0x407a('0x5a'));var _0x1c624c=squel[_0x407a('0x5b')]();var _0x1fb812=[];var _0x4c2d11=squel[_0x407a('0x5b')]();var _0x39672e;if(_0x2020cf['query'][_0x407a('0x5c')]){_0x39672e=as[_0x407a('0x5d')](_0x2020cf['query'][_0x407a('0x5c')]);var _0x44dc57=_0x39672e[_0x407a('0x5e')];for(var _0x3f5814=0x0;_0x3f5814<_0x39672e[_0x407a('0x5f')][_0x407a('0x3f')];_0x3f5814++){var _0x4c6388=_0x39672e[_0x407a('0x5f')][_0x3f5814];var _0x12b80e='i';var _0x48b9c3=_['find'](_0x35a016,['name',_0x4c6388['field']]);if(!_0x48b9c3){switch(_0x4c6388[_0x407a('0x47')]){case _0x407a('0x60'):if(_0x4c6388[_0x407a('0x61')]==0x1){_0x18ee56[_0x407a('0x62')]('`'+_0x4c6388['field']+'`\x20=\x200');}else{_0x18ee56[_0x407a('0x62')]('`'+_0x4c6388[_0x407a('0x47')]+_0x407a('0x63'));}break;case _0x407a('0x64'):if(_0x4c6388[_0x407a('0x65')]===_0x407a('0x66')){if(_0x4c6388[_0x407a('0x61')][_0x407a('0x31')]('\x20')[_0x407a('0x3f')]>0x1){_0x1c624c[_0x44dc57](_0x407a('0x67'),qs['getFullTextValue'](_0x4c6388['value']),null);}else{var _0xe37d05='%'+_0x4c6388[_0x407a('0x61')]+'%';_0x1c624c[_0x44dc57](_0x407a('0x68'),_0xe37d05,_0xe37d05,_0xe37d05);}}else{_0x48b9c3=_[_0x407a('0x69')](_0x35a016,[_0x407a('0x2a'),_0x407a('0x6a')]);_0x4c6388[_0x407a('0x47')]=_0x407a('0x6a');_0x24af91=as[_0x407a('0x6b')](_0x12b80e,_0x48b9c3[_0x407a('0x36')],_0x4c6388);_0x1c624c[_0x44dc57](_0x24af91[_0x407a('0x6c')],_0x24af91[_0x407a('0x61')][_0x407a('0x6d')],_0x24af91[_0x407a('0x61')][_0x407a('0x1f')]);}break;case _0x407a('0x6e'):var _0xc7f2b9=_0x4c6388['value'][_0x407a('0x31')](',')[_0x407a('0x2d')](function(_0x18d64b){return Number(_0x18d64b);});_0xc7f2b9[_0x407a('0x6f')](function(_0x3c9945){_0x4c2d11['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c9945+',%');});_0x1fb812=_[_0x407a('0x70')](_0x1fb812,_0xc7f2b9);break;case _0x407a('0x71'):if(_0x4c6388[_0x407a('0x65')]===_0x407a('0x66')){_0x1c624c[_0x44dc57](_0x407a('0x72'),'%'+_0x4c6388[_0x407a('0x61')]+'%',null);}else{_0x48b9c3=_['find'](_0x35a016,[_0x407a('0x2a'),'UserId']);_0x4c6388['field']='UserId';_0x24af91=as['buildExpression'](_0x12b80e,_0x48b9c3['type'],_0x4c6388);_0x1c624c[_0x44dc57](_0x24af91[_0x407a('0x6c')],_0x24af91[_0x407a('0x61')][_0x407a('0x6d')],_0x24af91[_0x407a('0x61')]['end']);}break;case'body':_0x24af91=as[_0x407a('0x6b')]('me',null,_0x4c6388);_0x1c624c[_0x44dc57](_0x24af91[_0x407a('0x6c')],_0x24af91[_0x407a('0x61')][_0x407a('0x6d')],_0x24af91[_0x407a('0x61')]['end']);break;}}else{var _0x24af91=as[_0x407a('0x6b')](_0x12b80e,_0x48b9c3['type'],_0x4c6388);_0x1c624c[_0x44dc57](_0x24af91['text'],_0x24af91[_0x407a('0x61')]['start'],_0x24af91[_0x407a('0x61')][_0x407a('0x1f')]);}}}else{var _0x36222a=_(_0x2020cf['query'])[_0x407a('0x38')]()[_0x407a('0x2d')](function(_0x5d94bd){return _['some'](_0x35a016,['name',_0x5d94bd])?_0x5d94bd:undefined;})[_0x407a('0x73')]()[_0x407a('0x61')]();if(!_['isEmpty'](_0x36222a)){_0x36222a['forEach'](function(_0x4eefe5){if(_0x4eefe5===_0x407a('0x74')){_0x18ee56[_0x407a('0x45')](_0x407a('0x75'),[][_0x407a('0x76')](_0x2020cf[_0x407a('0x39')][_0x4eefe5]));}else if(_0x4eefe5===_0x407a('0x77')){var _0x5c053c=JSON[_0x407a('0x78')](_0x2020cf[_0x407a('0x39')][_0x4eefe5])[_0x407a('0x79')];var _0x2fb960=JSON[_0x407a('0x78')](_0x2020cf[_0x407a('0x39')][_0x4eefe5])['$lte'];_0x18ee56[_0x407a('0x45')](_0x407a('0x7a'),_0x5c053c,_0x2fb960);}else{if(_0x2020cf[_0x407a('0x39')][_0x4eefe5]===_0x407a('0x7b')){_0x18ee56['where']('i.'+_0x4eefe5+'\x20IS\x20NULL');}else{_0x18ee56[_0x407a('0x45')]('i.'+_0x4eefe5+_0x407a('0x7c'),_0x2020cf[_0x407a('0x39')][_0x4eefe5]);}}});}if(_0x2020cf[_0x407a('0x39')][_0x407a('0x7d')]){if(_0x2020cf['query'][_0x407a('0x7d')]==0x1){_0x18ee56[_0x407a('0x62')]('`unreadMessages`\x20=\x200');}else{_0x18ee56[_0x407a('0x62')](_0x407a('0x7e'));}}if(_0x2020cf[_0x407a('0x39')]['tag']){_0x1fb812=_[_0x407a('0x7f')](_0x2020cf[_0x407a('0x39')]['tag'])?_0x2020cf['query'][_0x407a('0x80')]:new Array(_0x2020cf[_0x407a('0x39')][_0x407a('0x80')]);_0x1fb812['forEach'](function(_0x1cd53d){_0x4c2d11['or'](_0x407a('0x81'),'%,'+_0x1cd53d+',%');});}if(_0x2020cf[_0x407a('0x39')]['filter']){var _0x196a4c=_0x2020cf['query'][_0x407a('0x82')][_0x407a('0x83')]('\x5c','\x5c\x5c')[_0x407a('0x83')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x407a('0x84')](_0x196a4c)){_0x1c624c['or'](_0x407a('0x85'),_0x196a4c+'%');}else{_0x1c624c['or'](_0x407a('0x86'),qs['getFullTextValue'](_0x196a4c))['or']('i.from\x20LIKE\x20?',_0x196a4c+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x196a4c+'%');}}}_0x18ee56['where'](_0x1c624c);_0x18ee56['group'](_0x407a('0x87'));var _0x2711fe={'type':db['Sequelize'][_0x407a('0x88')][_0x407a('0x89')],'raw':!![]};var _0x151d5c=_0x18ee56[_0x407a('0x8a')]();_0x151d5c['field'](_0x407a('0x87'));_0x151d5c[_0x407a('0x47')](_0x407a('0x8b'),_0x407a('0x60'));if(_0x6e9c86[_0x407a('0x43')]){_0x6e9c86[_0x407a('0x43')][_0x407a('0x6f')](function(_0x2c07b7){_0x18ee56['order']('i.'+_0x2c07b7[0x0],_0x2c07b7[0x1]===_0x407a('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x1fb812)){_0x18ee56[_0x407a('0x62')](_0x4c2d11);_0x151d5c[_0x407a('0x45')]('t.id\x20IN\x20?',_0x1fb812);}BPromise[_0x407a('0x8d')]()[_0x407a('0x27')](function(){if(!_0x39672e){if(_0x2020cf[_0x407a('0x39')][_0x407a('0x74')]||_0x2020cf[_0x407a('0x39')]['journey'])return;_0x151d5c['where'](_0x407a('0x8e'));_0x18ee56[_0x407a('0x45')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x2020cf[_0x407a('0x8f')][_0x407a('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x101df9){if(_[_0x407a('0x91')](_0x101df9)){_0x151d5c[_0x407a('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x18ee56[_0x407a('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x151d5c['where'](_0x407a('0x75'),_[_0x407a('0x2d')](_0x101df9,'id'));_0x18ee56[_0x407a('0x45')](_0x407a('0x75'),_[_0x407a('0x2d')](_0x101df9,'id'));}});})[_0x407a('0x27')](function(){db[_0x407a('0x92')][_0x407a('0x39')](_0x151d5c[_0x407a('0x93')](),_0x2711fe)[_0x407a('0x27')](function(_0x1ad34d){_0x345ad8[_0x407a('0x94')]=_0x1ad34d['length'];if(_0x345ad8['count']===0x0)return[];return db[_0x407a('0x92')][_0x407a('0x39')](_0x220795[_0x407a('0x93')](),_0x2711fe)['then'](function(_0x2581e4){_0xd67be8=_[_0x407a('0x95')](_0x2581e4,'id');_0x2711fe=_['merge'](_0x2711fe,{'model':db[_0x407a('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2020cf[_0x407a('0x39')][_0x407a('0x3e')]){_0x6e9c86['attributes'][_0x407a('0x6f')](function(_0x34c801){_0x18ee56['field']('i.'+_0x34c801);});}else{_0x18ee56['field'](_0x407a('0x8b'),_0x407a('0x60'));_0x18ee56[_0x407a('0x47')](_0x407a('0x97'),'Account.key');_0x18ee56[_0x407a('0x47')](_0x407a('0x98'),_0x407a('0x99'));_0x18ee56['field'](_0x407a('0x9a'));_0x18ee56[_0x407a('0x47')](_0x407a('0x9b'),_0x407a('0x9c'));_0x18ee56[_0x407a('0x47')](_0x407a('0x9d'),_0x407a('0x9e'));_0x18ee56['field'](_0x407a('0x9f'),_0x407a('0xa0'));_0x18ee56[_0x407a('0x47')](_0x407a('0xa1'),_0x407a('0xa2'));_0x18ee56[_0x407a('0x47')]('c.mobile',_0x407a('0xa3'));_0x18ee56[_0x407a('0x47')](_0x407a('0xa4'),_0x407a('0xa5'));_0x18ee56[_0x407a('0x47')]('o.fullname',_0x407a('0xa6'));_0x18ee56[_0x407a('0x47')](_0x407a('0xa7'),_0x407a('0xa8'));_0x18ee56['field'](_0x407a('0xa9'),_0x407a('0x30'));}if(_0x6e9c86[_0x407a('0x42')])_0x18ee56['limit'](_0x6e9c86[_0x407a('0x42')]);if(_0x6e9c86[_0x407a('0x21')])_0x18ee56[_0x407a('0x21')](_0x6e9c86['offset']);return db[_0x407a('0x92')][_0x407a('0x39')](_0x18ee56['toString'](),_0x2711fe);})[_0x407a('0x27')](function(_0x386bf8){_0x111a50[_0x407a('0x45')](_0x407a('0xaa'),_['map'](_0x386bf8,'id'));return db[_0x407a('0x92')][_0x407a('0x39')](_0x111a50[_0x407a('0x93')](),_0x2711fe)[_0x407a('0x27')](function(_0x3803b8){var _0x56713e=_['groupBy'](_0x3803b8,_0x407a('0xab'));var _0x4b980b=[];_0x386bf8[_0x407a('0x6f')](function(_0x8af1d1){_0x4b980b['push'](updateOpenchannelInteraction(_0x8af1d1,_0xd67be8,_0x56713e));});return BPromise['all'](_0x4b980b);});});})['then'](function(_0x146062){_0x345ad8[_0x407a('0xac')]=_0x146062;return _0x345ad8;})[_0x407a('0x27')](respondWithFilteredResult(_0x4e6911,_0x6e9c86));})[_0x407a('0x33')](handleError(_0x4e6911,null));};exports[_0x407a('0xad')]=function(_0x36467a,_0x335b52){var _0x1e8b68={'raw':![],'where':{'id':_0x36467a['params']['id']}},_0x3ada83={};_0x3ada83['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x3ada83[_0x407a('0x39')]=_[_0x407a('0x38')](_0x36467a[_0x407a('0x39')]);_0x3ada83[_0x407a('0x3a')]=_[_0x407a('0x3b')](_0x3ada83[_0x407a('0x3c')],_0x3ada83[_0x407a('0x39')]);_0x1e8b68[_0x407a('0x3d')]=_['intersection'](_0x3ada83[_0x407a('0x3c')],qs[_0x407a('0x3e')](_0x36467a[_0x407a('0x39')][_0x407a('0x3e')]));_0x1e8b68[_0x407a('0x3d')]=_0x1e8b68[_0x407a('0x3d')]['length']?_0x1e8b68[_0x407a('0x3d')]:_0x3ada83['model'];if(_0x36467a['query'][_0x407a('0xae')]){_0x1e8b68[_0x407a('0xaf')]=[{'all':!![]}];}_0x1e8b68=_[_0x407a('0xb0')]({},_0x1e8b68,_0x36467a[_0x407a('0xb1')]);return db[_0x407a('0x96')][_0x407a('0x69')](_0x1e8b68)[_0x407a('0x27')](handleEntityNotFound(_0x335b52,null))[_0x407a('0x27')](respondWithResult(_0x335b52,null))['catch'](handleError(_0x335b52,null));};exports['create']=function(_0x2d1fa,_0x521852){return db[_0x407a('0x96')][_0x407a('0xb2')](_0x2d1fa[_0x407a('0xb3')],{})[_0x407a('0x27')](respondWithResult(_0x521852,0xc9))['catch'](handleError(_0x521852,null));};exports[_0x407a('0x26')]=function(_0x19e6b1,_0x4d902b){if(_0x19e6b1[_0x407a('0xb3')]['id']){delete _0x19e6b1[_0x407a('0xb3')]['id'];}return db['OpenchannelInteraction'][_0x407a('0x69')]({'where':{'id':_0x19e6b1[_0x407a('0xb4')]['id']}})[_0x407a('0x27')](handleEntityNotFound(_0x4d902b,null))[_0x407a('0x27')](saveUpdates(_0x19e6b1['body'],null))[_0x407a('0x27')](respondWithResult(_0x4d902b,null))[_0x407a('0x33')](handleError(_0x4d902b,null));};exports[_0x407a('0x28')]=function(_0xe9eedf,_0x3d3148){return db[_0x407a('0x96')][_0x407a('0x69')]({'where':{'id':_0xe9eedf['params']['id']}})[_0x407a('0x27')](handleEntityNotFound(_0x3d3148,null))[_0x407a('0x27')](removeEntity(_0x3d3148,null))[_0x407a('0x33')](handleError(_0x3d3148,null));};exports['describe']=function(_0x269395,_0xcff0d4){return db['OpenchannelInteraction']['describe']()[_0x407a('0x27')](respondWithResult(_0xcff0d4,null))['catch'](handleError(_0xcff0d4,null));};exports['addMessage']=function(_0x10b3b4,_0x88be7c,_0x4856db){return db[_0x407a('0xb5')][_0x407a('0x69')]({'where':{'id':_0x10b3b4['params']['id']}})[_0x407a('0x27')](handleEntityNotFound(_0x88be7c,null))['then'](function(_0x193c93){if(_0x193c93){return _0x193c93['addMessage'](_0x10b3b4[_0x407a('0xb3')][_0x407a('0xb6')],_[_0x407a('0xb7')](_0x10b3b4[_0x407a('0xb3')],[_0x407a('0xb6'),'id'])||{});}})[_0x407a('0x27')](respondWithResult(_0x88be7c,null))[_0x407a('0x33')](handleError(_0x88be7c,null));};exports[_0x407a('0xb8')]=function(_0x383fbe,_0x46c5b5,_0x237176){var _0x155c75={'raw':![],'where':{}};var _0x3aefa3={};var _0x1fb908={'count':0x0,'rows':[]};return db[_0x407a('0x96')][_0x407a('0xb9')]({'where':{'id':_0x383fbe[_0x407a('0xb4')]['id']}})['then'](handleEntityNotFound(_0x46c5b5,null))[_0x407a('0x27')](function(_0x202db7){if(_0x202db7){_0x3aefa3['model']=_[_0x407a('0x38')](db[_0x407a('0xb5')][_0x407a('0xba')]);_0x3aefa3[_0x407a('0x39')]=_['keys'](_0x383fbe[_0x407a('0x39')]);_0x3aefa3[_0x407a('0x3a')]=_[_0x407a('0x3b')](_0x3aefa3[_0x407a('0x3c')],_0x3aefa3[_0x407a('0x39')]);_0x155c75['attributes']=_[_0x407a('0x3b')](_0x3aefa3[_0x407a('0x3c')],qs[_0x407a('0x3e')](_0x383fbe['query']['fields']));_0x155c75[_0x407a('0x3d')]=_0x155c75['attributes']['length']?_0x155c75[_0x407a('0x3d')]:_0x3aefa3['model'];if(!_0x383fbe[_0x407a('0x39')]['hasOwnProperty'](_0x407a('0x41'))){_0x155c75[_0x407a('0x42')]=qs[_0x407a('0x42')](_0x383fbe['query']['limit']);_0x155c75[_0x407a('0x21')]=qs[_0x407a('0x21')](_0x383fbe[_0x407a('0x39')][_0x407a('0x21')]);}_0x155c75['order']=qs['sort'](_0x383fbe[_0x407a('0x39')]['sort']);_0x155c75[_0x407a('0x45')]=qs[_0x407a('0x3a')](_[_0x407a('0x46')](_0x383fbe[_0x407a('0x39')],_0x3aefa3[_0x407a('0x3a')]));_0x155c75[_0x407a('0x45')][_0x407a('0xab')]=_0x202db7['id'];if(_0x383fbe[_0x407a('0x39')][_0x407a('0x82')]){_0x155c75['where']=_[_0x407a('0xb0')](_0x155c75['where'],{'$or':_[_0x407a('0x2d')](_0x155c75[_0x407a('0x3d')],function(_0xa5d9cc){var _0x2df8af={};_0x2df8af[_0xa5d9cc]={'$like':'%'+_0x383fbe['query'][_0x407a('0x82')]+'%'};return _0x2df8af;})});}if(_0x383fbe['query'][_0x407a('0x79')]){var _0x376582=_0x383fbe[_0x407a('0x39')][_0x407a('0x79')]['split'](',');var _0x3647cf={};_0x3647cf[_0x376582[0x0]]={'$gte':moment(_0x376582[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x155c75[_0x407a('0x45')]=_[_0x407a('0xb0')](_0x155c75[_0x407a('0x45')],_0x3647cf);}_0x155c75=_[_0x407a('0xb0')]({},_0x155c75,_0x383fbe['options']);return db[_0x407a('0xb5')][_0x407a('0x94')]({'where':_0x155c75[_0x407a('0x45')]})['then'](function(_0x400793){_0x1fb908[_0x407a('0x94')]=_0x400793;if(_0x383fbe[_0x407a('0x39')][_0x407a('0xae')]){_0x155c75[_0x407a('0xaf')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x155c75);})[_0x407a('0x27')](function(_0x3220fb){_0x1fb908[_0x407a('0xac')]=_0x3220fb;return _0x1fb908;});}})[_0x407a('0x27')](respondWithFilteredResult(_0x46c5b5,_0x155c75))['catch'](handleError(_0x46c5b5,null));};exports[_0x407a('0xbb')]=function(_0x5c54ac,_0x1224bf,_0x76bddd){return db[_0x407a('0x96')][_0x407a('0x69')]({'where':{'id':_0x5c54ac[_0x407a('0xb4')]['id']}})[_0x407a('0x27')](handleEntityNotFound(_0x1224bf,null))[_0x407a('0x27')](function(_0x94fd49){if(_0x94fd49){return _0x94fd49['setTags'](_0x5c54ac[_0x407a('0xb3')][_0x407a('0xb6')],_['omit'](_0x5c54ac[_0x407a('0xb3')],[_0x407a('0xb6'),'id'])||{})[_0x407a('0xbc')](function(){return db['Tag']['findAll']({'attributes':['id',_0x407a('0x2a'),_0x407a('0x48')],'where':{'id':_0x5c54ac[_0x407a('0xb3')][_0x407a('0xb6')]}});})[_0x407a('0x27')](function(_0x492de0){socket[_0x407a('0xbd')](_0x407a('0xbe'),{'id':Number(_0x5c54ac[_0x407a('0xb4')]['id']),'tags':_0x492de0||[]});return{'id':Number(_0x5c54ac['params']['id']),'tags':_0x492de0||[]};});}})[_0x407a('0x27')](respondWithResult(_0x1224bf,null))[_0x407a('0x33')](handleError(_0x1224bf,null));};exports[_0x407a('0xbf')]=function(_0x15d1b0,_0xa3facf,_0x880ef1){return db[_0x407a('0x96')][_0x407a('0x69')]({'where':{'id':_0x15d1b0['params']['id']}})[_0x407a('0x27')](handleEntityNotFound(_0xa3facf,null))['then'](function(_0x70e720){if(_0x70e720){return _0x70e720[_0x407a('0xbf')](_0x15d1b0[_0x407a('0x39')][_0x407a('0xb6')]);}})[_0x407a('0x27')](respondWithStatusCode(_0xa3facf,null))[_0x407a('0x33')](handleError(_0xa3facf,null));};exports[_0x407a('0xc0')]=function(_0x47ec6e,_0x4fa130){var _0x3723e2=moment()['unix']()[_0x407a('0x93')]();var _0x468fa0=path[_0x407a('0xc1')](config[_0x407a('0xc2')],'server',_0x407a('0xc3'),_0x407a('0xc4'));var _0x4b5345=path[_0x407a('0xc1')](config[_0x407a('0xc2')],'server',_0x407a('0xc3'),_0x407a('0xc5'));var _0x2433cd=path[_0x407a('0xc1')](_0x468fa0,_0x3723e2);var _0x55bce9=util[_0x407a('0xc6')](_0x407a('0xc7'),_0x47ec6e[_0x407a('0xb4')]['id'],_0x3723e2);var _0x45a3f4=path[_0x407a('0xc1')](_0x468fa0,_0x55bce9);var _0x2e4694=[];_0x2e4694[_0x407a('0x32')]({'model':db[_0x407a('0x71')],'as':_0x407a('0x71'),'attributes':['id',_0x407a('0x2e')],'raw':!![]});_0x2e4694[_0x407a('0x32')]({'model':db['CmContact'],'as':_0x407a('0x64'),'attributes':['id','firstName',_0x407a('0xc8')],'raw':!![]});if(_0x47ec6e[_0x407a('0x39')][_0x407a('0xc5')]){_0x2e4694[_0x407a('0x32')]({'model':db[_0x407a('0xc9')],'as':_0x407a('0xc9'),'raw':!![]});}var _0x3b864c=[{'model':db['OpenchannelMessage'],'as':_0x407a('0xca'),'attributes':['id','body',_0x407a('0x77'),_0x407a('0xcb'),_0x407a('0xcc'),_0x407a('0x7d')],'include':_0x2e4694}];_0x3b864c['push']({'model':db[_0x407a('0xcd')],'as':_0x407a('0xce'),'attributes':['id',_0x407a('0x2a')]});_0x3b864c[_0x407a('0x32')]({'model':db[_0x407a('0x71')],'as':_0x407a('0xcf'),'attributes':['id',_0x407a('0x2e')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x47ec6e[_0x407a('0xb4')]['id']},'include':_0x3b864c})[_0x407a('0x27')](handleEntityNotFound(_0x4fa130,null))[_0x407a('0x27')](function(_0x18c2fe){if(_0x18c2fe){var _0x4ac300=_0x18c2fe[_0x407a('0xd0')]({'plain':!![]});fs[_0x407a('0xd1')](_0x2433cd);var _0x599783={'format':'A4','border':_0x407a('0xd2'),'header':{'height':_0x407a('0xd3'),'contents':{'first':_0x407a('0xd4')}},'footer':{'height':'30px','contents':{'default':util[_0x407a('0xc6')](_0x407a('0xd5'),util[_0x407a('0xc6')](_0x407a('0xd6'),'Openchannel',_0x4ac300['id']),moment()['format']('YYYY-MM-DD')[_0x407a('0x93')]())}}};var _0x278cde={'channel':'Openchannel','account':_0x4ac300['Account'][_0x407a('0x2a')],'agent':_0x4ac300[_0x407a('0xcf')]?_0x4ac300['Owner'][_0x407a('0x2e')]:_0x407a('0xd7'),'createdAt':moment(_0x4ac300[_0x407a('0x77')])[_0x407a('0xc6')](_0x407a('0xd8'))['toString'](),'closedAt':_0x4ac300[_0x407a('0xd9')]?moment(_0x4ac300['closedAt'])[_0x407a('0xc6')](_0x407a('0xd8'))[_0x407a('0x93')]():'','disposition':_0x4ac300['disposition'],'visibility':_0x4ac300[_0x407a('0xda')]?_0x407a('0xdb'):_0x407a('0xdc'),'messages':_(_0x4ac300[_0x407a('0xca')])[_0x407a('0x82')]({'secret':![]})[_0x407a('0x2d')](function(_0x470a28){if(_0x470a28['Attachment']){var _0x5e70c1=path['join'](_0x4b5345,_0x470a28[_0x407a('0xc9')]['basename']);if(fs[_0x407a('0xdd')](_0x5e70c1)){fs[_0x407a('0xde')](_0x5e70c1)[_0x407a('0xdf')](fs[_0x407a('0xe0')](path[_0x407a('0xc1')](_0x2433cd,_0x470a28[_0x407a('0xc9')][_0x407a('0xe1')])));}}return{'date':moment(_0x470a28['createdAt'])['format'](_0x407a('0xd8'))[_0x407a('0x93')](),'sender':_0x470a28[_0x407a('0xcb')]===_0x407a('0xe2')?_0x470a28[_0x407a('0x71')]?_0x470a28[_0x407a('0x71')]['fullname']:_0x407a('0xe3'):_0x470a28['Contact'][_0x407a('0xe4')]+(_0x470a28[_0x407a('0x64')][_0x407a('0xc8')]?'\x20'+_0x470a28['Contact'][_0x407a('0xc8')]:''),'body':_0x470a28[_0x407a('0xc9')]?_0x470a28['Attachment'][_0x407a('0xe1')]:_0x470a28[_0x407a('0xb3')],'direction':_0x470a28[_0x407a('0xcb')]==='out'?'A':'C','secret':_0x470a28[_0x407a('0xcc')],'read':_0x470a28['read'],'attachment':_0x470a28[_0x407a('0xc9')]};})['value']()};return ejs[_0x407a('0xe5')](path[_0x407a('0xc1')](config['root'],_0x407a('0xe6'),_0x407a('0xe7'),_0x407a('0xe8')),{'interaction':_0x278cde})['then'](function(_0x282298){return new BPromise(function(_0x149aa6,_0x53c4f2){pdf[_0x407a('0xb2')](_0x282298,_0x599783)['toFile'](path[_0x407a('0xc1')](_0x2433cd,'transcript-'+_0x4ac300['id']+'-'+_0x3723e2+'.pdf'),function(_0x51511f,_0x5b5c9e){if(_0x51511f)return _0x53c4f2(_0x51511f);_0x149aa6(_0x5b5c9e);});});})[_0x407a('0x27')](function(){return new BPromise(function(_0x5b086a,_0x5799d0){zipdir(_0x2433cd,{'saveTo':_0x45a3f4},function(_0x27c3b8,_0x5ac875){if(_0x27c3b8)return _0x5799d0(_0x27c3b8);return _0x5b086a(_0x5ac875);});})[_0x407a('0x27')](function(){return new BPromise(function(_0x35cfc9,_0x3a75ee){rimraf(_0x2433cd,function(_0x359e8c){if(_0x359e8c)_0x3a75ee(_0x359e8c);return _0x35cfc9();});});})[_0x407a('0x27')](function(){return _0x4fa130['download'](_0x45a3f4,_0x55bce9,function(_0x1e82bd){if(_0x1e82bd){console[_0x407a('0xe9')](_0x407a('0xea'),_0x1e82bd);}else{fs[_0x407a('0xeb')](_0x45a3f4);}});});});}else{return _0x4fa130[_0x407a('0x1d')](0xc8);}})['catch'](handleError(_0x4fa130,null));}; \ No newline at end of file +var _0x3a9a=['OpenchannelMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','omit','color','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','get','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','closed','closedAt','disposition','threadId','Private','existsSync','createReadStream','basename','out','System','lastName','secret','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','OpenchannelInteraction','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','from','select','u.id','u.fullname','user_has_openchannel_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','params','rawAttributes','includeAll','options','create','body','describe','addMessage'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x3a9a,0x122));var _0xa3a9=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x3a9a[_0x1da527];return _0x40fc7c;};'use strict';var pdf=require(_0xa3a9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3a9('0x1'));var zipdir=require(_0xa3a9('0x2'));var jsonpatch=require(_0xa3a9('0x3'));var rp=require(_0xa3a9('0x4'));var moment=require(_0xa3a9('0x5'));var BPromise=require(_0xa3a9('0x6'));var Mustache=require('mustache');var util=require(_0xa3a9('0x7'));var path=require('path');var sox=require(_0xa3a9('0x8'));var csv=require('to-csv');var ejs=require(_0xa3a9('0x9'));var fs=require('fs');var _=require(_0xa3a9('0xa'));var squel=require(_0xa3a9('0xb'));var crypto=require(_0xa3a9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa3a9('0xd'));var toCsv=require(_0xa3a9('0xe'));var querystring=require(_0xa3a9('0xf'));var Papa=require('papaparse');var Redis=require(_0xa3a9('0x10'));var authService=require(_0xa3a9('0x11'));var qs=require(_0xa3a9('0x12'));var as=require(_0xa3a9('0x13'));var hardwareService=require(_0xa3a9('0x14'));var logger=require(_0xa3a9('0x15'))(_0xa3a9('0x16'));var utils=require('../../config/utils');var config=require(_0xa3a9('0x17'));var db=require(_0xa3a9('0x18'))['db'];config[_0xa3a9('0x19')]=_[_0xa3a9('0x1a')](config[_0xa3a9('0x19')],{'host':_0xa3a9('0x1b'),'port':0x18eb});var socket=require(_0xa3a9('0x1c'))(new Redis(config['redis']));require(_0xa3a9('0x1d'))[_0xa3a9('0x1e')](socket);function respondWithStatusCode(_0x119b06,_0x43c0fe){_0x43c0fe=_0x43c0fe||0xcc;return function(_0x35db61){if(_0x35db61){return _0x119b06[_0xa3a9('0x1f')](_0x43c0fe);}return _0x119b06[_0xa3a9('0x20')](_0x43c0fe)[_0xa3a9('0x21')]();};}function respondWithResult(_0x3fc2d4,_0x26a526){_0x26a526=_0x26a526||0xc8;return function(_0x38f708){if(_0x38f708){return _0x3fc2d4[_0xa3a9('0x20')](_0x26a526)[_0xa3a9('0x22')](_0x38f708);}};}function respondWithFilteredResult(_0x520c36,_0x174ded){return function(_0x5b5138){if(_0x5b5138){var _0x56d3f8=_0x5b5138[_0xa3a9('0x23')],_0x3cbb7b=_0x174ded[_0xa3a9('0x24')],_0x163f6e=_0x174ded[_0xa3a9('0x24')]+_0x174ded['limit'],_0x3d455d;if(_0x163f6e>=_0x56d3f8){_0x163f6e=_0x56d3f8;_0x3d455d=0xc8;}else{_0x3d455d=0xce;}_0x520c36['status'](_0x3d455d);return _0x520c36['set'](_0xa3a9('0x25'),_0x3cbb7b+'-'+_0x163f6e+'/'+_0x56d3f8)[_0xa3a9('0x22')](_0x5b5138);}return null;};}function patchUpdates(_0x4df82a){return function(_0xc3c871){try{jsonpatch[_0xa3a9('0x26')](_0xc3c871,_0x4df82a,!![]);}catch(_0x4055af){return BPromise[_0xa3a9('0x27')](_0x4055af);}return _0xc3c871['save']();};}function saveUpdates(_0x532c15,_0x25b7ae){return function(_0x43e751){if(_0x43e751){return _0x43e751[_0xa3a9('0x28')](_0x532c15)[_0xa3a9('0x29')](function(_0x416e79){return _0x416e79;});}return null;};}function removeEntity(_0x4ef9c1,_0xd31f52){return function(_0x2485e2){if(_0x2485e2){return _0x2485e2[_0xa3a9('0x2a')]()[_0xa3a9('0x29')](function(){_0x4ef9c1[_0xa3a9('0x20')](0xcc)[_0xa3a9('0x21')]();});}};}function handleEntityNotFound(_0x352abe,_0x427b9a){return function(_0x41ac07){if(!_0x41ac07){_0x352abe[_0xa3a9('0x1f')](0x194);}return _0x41ac07;};}function handleError(_0x5a4de8,_0x9af353){_0x9af353=_0x9af353||0x1f4;return function(_0x5e1f5e){logger['error'](_0x5e1f5e[_0xa3a9('0x2b')]);if(_0x5e1f5e['name']){delete _0x5e1f5e[_0xa3a9('0x2c')];}_0x5a4de8[_0xa3a9('0x20')](_0x9af353)['send'](_0x5e1f5e);};}function getInteractionUsers(_0x2a8428,_0x399718){return new BPromise(function(_0x5d3069,_0x39e492){try{if(_0x399718[_0x2a8428['id']]){_0x2a8428[_0xa3a9('0x2d')]=_[_0xa3a9('0x2e')](_0x399718[_0x2a8428['id']],function(_0x564e7e){return{'id':_0x564e7e['id'],'fullname':_0x564e7e[_0xa3a9('0x2f')]};});}}catch(_0x5ab637){_0x39e492(_0x5ab637);}_0x5d3069(_0x2a8428);});}function getInteractionTags(_0x587989,_0x4e2136){return new BPromise(function(_0x30df50,_0x31d549){try{if(_0x587989[_0xa3a9('0x30')]){_0x587989[_0xa3a9('0x31')]=[];_0x587989['TagIds']['split'](',')[_0xa3a9('0x32')](function(_0x1fe318){_0x587989[_0xa3a9('0x31')][_0xa3a9('0x33')](_0x4e2136[_0x1fe318]);});}delete _0x587989[_0xa3a9('0x30')];}catch(_0x8f1265){_0x31d549(_0x8f1265);}_0x30df50(_0x587989);});}function updateOpenchannelInteraction(_0x1eaec4,_0x572122,_0x2ab3c9){return new BPromise(function(_0x1efd23,_0xa968de){return getInteractionUsers(_0x1eaec4,_0x2ab3c9)[_0xa3a9('0x29')](function(_0x412329){return getInteractionTags(_0x412329,_0x572122);})[_0xa3a9('0x29')](function(_0x36d46a){_0x1efd23(_0x36d46a);})[_0xa3a9('0x34')](function(_0x28269e){_0xa968de(_0x28269e);});});}exports[_0xa3a9('0x35')]=function(_0x34337a,_0xb01f5e){var _0x4c5fd3={},_0x1a6e28={},_0x1681ef={'count':0x0,'rows':[]};var _0x5b091d=_[_0xa3a9('0x2e')](db[_0xa3a9('0x36')]['rawAttributes'],function(_0x5a05ae){return{'name':_0x5a05ae['fieldName'],'type':_0x5a05ae[_0xa3a9('0x37')][_0xa3a9('0x38')]};});_0x1a6e28['model']=_[_0xa3a9('0x2e')](_0x5b091d,_0xa3a9('0x2c'));_0x1a6e28[_0xa3a9('0x39')]=_[_0xa3a9('0x3a')](_0x34337a['query']);_0x1a6e28[_0xa3a9('0x3b')]=_[_0xa3a9('0x3c')](_0x1a6e28[_0xa3a9('0x3d')],_0x1a6e28[_0xa3a9('0x39')]);_0x4c5fd3[_0xa3a9('0x3e')]=_[_0xa3a9('0x3c')](_0x1a6e28[_0xa3a9('0x3d')],qs['fields'](_0x34337a['query'][_0xa3a9('0x3f')]));_0x4c5fd3['attributes']=_0x4c5fd3[_0xa3a9('0x3e')][_0xa3a9('0x40')]?_0x4c5fd3[_0xa3a9('0x3e')]:_0x1a6e28['model'];if(!_0x34337a['query'][_0xa3a9('0x41')](_0xa3a9('0x42'))){_0x4c5fd3[_0xa3a9('0x43')]=qs[_0xa3a9('0x43')](_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x43')]);_0x4c5fd3['offset']=qs[_0xa3a9('0x24')](_0x34337a[_0xa3a9('0x39')]['offset']);}_0x4c5fd3[_0xa3a9('0x44')]=qs[_0xa3a9('0x45')](_0x34337a['query']['sort']);_0x4c5fd3[_0xa3a9('0x46')]=qs[_0xa3a9('0x3b')](_[_0xa3a9('0x47')](_0x34337a['query'],_0x1a6e28[_0xa3a9('0x3b')]),_0x5b091d);var _0xe09690=[];var _0x5331d6=squel['select']()[_0xa3a9('0x48')]('id')[_0xa3a9('0x48')]('name')[_0xa3a9('0x48')]('color')[_0xa3a9('0x49')]('tools_tags');var _0x402d3e=squel[_0xa3a9('0x4a')]()[_0xa3a9('0x48')](_0xa3a9('0x4b'))[_0xa3a9('0x48')](_0xa3a9('0x4c'))['field']('ui.OpenchannelInteractionId')[_0xa3a9('0x49')](_0xa3a9('0x4d'),'ui')[_0xa3a9('0x4e')]('users','u','u.id\x20=\x20ui.UserId');var _0x2dd9dd=squel['select']()[_0xa3a9('0x49')]('openchannel_interactions','i')['left_join'](_0xa3a9('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa3a9('0x4e')](_0xa3a9('0x50'),'o',_0xa3a9('0x51'))[_0xa3a9('0x4e')](_0xa3a9('0x52'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xa3a9('0x4e')](_0xa3a9('0x53'),'me',_0xa3a9('0x54'))[_0xa3a9('0x4e')](_0xa3a9('0x55'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xa3a9('0x56'),'t',_0xa3a9('0x57'));var _0x14bdff=squel['expr']();var _0x1dbf44=[];var _0xed4831=squel[_0xa3a9('0x58')]();var _0x58881b;if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x59')]){_0x58881b=as[_0xa3a9('0x5a')](_0x34337a[_0xa3a9('0x39')]['search']);var _0x15c075=_0x58881b[_0xa3a9('0x5b')];for(var _0x34bfd7=0x0;_0x34bfd7<_0x58881b[_0xa3a9('0x5c')]['length'];_0x34bfd7++){var _0x239d69=_0x58881b['conditions'][_0x34bfd7];var _0x528f61='i';var _0x497311=_[_0xa3a9('0x5d')](_0x5b091d,[_0xa3a9('0x2c'),_0x239d69[_0xa3a9('0x48')]]);if(!_0x497311){switch(_0x239d69[_0xa3a9('0x48')]){case _0xa3a9('0x5e'):if(_0x239d69[_0xa3a9('0x5f')]==0x1){_0x2dd9dd[_0xa3a9('0x60')]('`'+_0x239d69['field']+'`\x20=\x200');}else{_0x2dd9dd[_0xa3a9('0x60')]('`'+_0x239d69[_0xa3a9('0x48')]+_0xa3a9('0x61'));}break;case _0xa3a9('0x62'):if(_0x239d69[_0xa3a9('0x63')]===_0xa3a9('0x64')){if(_0x239d69[_0xa3a9('0x5f')][_0xa3a9('0x65')]('\x20')[_0xa3a9('0x40')]>0x1){_0x14bdff[_0x15c075](_0xa3a9('0x66'),qs[_0xa3a9('0x67')](_0x239d69[_0xa3a9('0x5f')]),null);}else{var _0x1f6e5f='%'+_0x239d69['value']+'%';_0x14bdff[_0x15c075](_0xa3a9('0x68'),_0x1f6e5f,_0x1f6e5f,_0x1f6e5f);}}else{_0x497311=_[_0xa3a9('0x5d')](_0x5b091d,['name',_0xa3a9('0x69')]);_0x239d69[_0xa3a9('0x48')]=_0xa3a9('0x69');_0x159736=as[_0xa3a9('0x6a')](_0x528f61,_0x497311[_0xa3a9('0x37')],_0x239d69);_0x14bdff[_0x15c075](_0x159736['text'],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x6b')],_0x159736[_0xa3a9('0x5f')]['end']);}break;case _0xa3a9('0x6c'):var _0x5ede46=_0x239d69[_0xa3a9('0x5f')]['split'](',')[_0xa3a9('0x2e')](function(_0x5c37cc){return Number(_0x5c37cc);});_0x5ede46[_0xa3a9('0x32')](function(_0x341a01){_0xed4831['or'](_0xa3a9('0x6d'),'%,'+_0x341a01+',%');});_0x1dbf44=_[_0xa3a9('0x6e')](_0x1dbf44,_0x5ede46);break;case _0xa3a9('0x6f'):if(_0x239d69[_0xa3a9('0x63')]===_0xa3a9('0x64')){_0x14bdff[_0x15c075](_0xa3a9('0x70'),'%'+_0x239d69[_0xa3a9('0x5f')]+'%',null);}else{_0x497311=_[_0xa3a9('0x5d')](_0x5b091d,[_0xa3a9('0x2c'),_0xa3a9('0x71')]);_0x239d69[_0xa3a9('0x48')]=_0xa3a9('0x71');_0x159736=as[_0xa3a9('0x6a')](_0x528f61,_0x497311['type'],_0x239d69);_0x14bdff[_0x15c075](_0x159736[_0xa3a9('0x72')],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x6b')],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x21')]);}break;case'body':_0x159736=as[_0xa3a9('0x6a')]('me',null,_0x239d69);_0x14bdff[_0x15c075](_0x159736[_0xa3a9('0x72')],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x6b')],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x21')]);break;}}else{var _0x159736=as[_0xa3a9('0x6a')](_0x528f61,_0x497311[_0xa3a9('0x37')],_0x239d69);_0x14bdff[_0x15c075](_0x159736[_0xa3a9('0x72')],_0x159736[_0xa3a9('0x5f')]['start'],_0x159736[_0xa3a9('0x5f')]['end']);}}}else{var _0x264a3f=_(_0x34337a['query'])[_0xa3a9('0x3a')]()[_0xa3a9('0x2e')](function(_0x35d562){return _[_0xa3a9('0x73')](_0x5b091d,[_0xa3a9('0x2c'),_0x35d562])?_0x35d562:undefined;})[_0xa3a9('0x74')]()[_0xa3a9('0x5f')]();if(!_['isEmpty'](_0x264a3f)){_0x264a3f['forEach'](function(_0x2411e7){if(_0x2411e7===_0xa3a9('0x75')){_0x2dd9dd['where'](_0xa3a9('0x76'),[][_0xa3a9('0x77')](_0x34337a[_0xa3a9('0x39')][_0x2411e7]));}else if(_0x2411e7===_0xa3a9('0x78')){var _0x313aef=JSON[_0xa3a9('0x79')](_0x34337a[_0xa3a9('0x39')][_0x2411e7])[_0xa3a9('0x7a')];var _0x2500dc=JSON[_0xa3a9('0x79')](_0x34337a['query'][_0x2411e7])[_0xa3a9('0x7b')];_0x2dd9dd['where'](_0xa3a9('0x7c'),_0x313aef,_0x2500dc);}else{if(_0x34337a['query'][_0x2411e7]===_0xa3a9('0x7d')){_0x2dd9dd[_0xa3a9('0x46')]('i.'+_0x2411e7+_0xa3a9('0x7e'));}else{_0x2dd9dd[_0xa3a9('0x46')]('i.'+_0x2411e7+_0xa3a9('0x7f'),_0x34337a['query'][_0x2411e7]);}}});}if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x80')]){if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x80')]==0x1){_0x2dd9dd[_0xa3a9('0x60')](_0xa3a9('0x81'));}else{_0x2dd9dd[_0xa3a9('0x60')]('`unreadMessages`\x20>\x200');}}if(_0x34337a['query'][_0xa3a9('0x82')]){_0x1dbf44=_[_0xa3a9('0x83')](_0x34337a['query'][_0xa3a9('0x82')])?_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x82')]:new Array(_0x34337a['query']['tag']);_0x1dbf44['forEach'](function(_0x1ac91a){_0xed4831['or'](_0xa3a9('0x6d'),'%,'+_0x1ac91a+',%');});}if(_0x34337a['query'][_0xa3a9('0x84')]){var _0x407bb7=_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x84')][_0xa3a9('0x85')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xa3a9('0x86')](_0x407bb7)){_0x14bdff['or'](_0xa3a9('0x87'),_0x407bb7+'%');}else{_0x14bdff['or'](_0xa3a9('0x88'),qs[_0xa3a9('0x67')](_0x407bb7))['or']('i.from\x20LIKE\x20?',_0x407bb7+'%')['or'](_0xa3a9('0x89'),_0x407bb7+'%');}}}_0x2dd9dd['where'](_0x14bdff);_0x2dd9dd[_0xa3a9('0x8a')]('i.id');var _0x26257b={'type':db[_0xa3a9('0x8b')]['QueryTypes'][_0xa3a9('0x8c')],'raw':!![]};var _0x532feb=_0x2dd9dd[_0xa3a9('0x8d')]();_0x532feb[_0xa3a9('0x48')]('i.id');_0x532feb[_0xa3a9('0x48')](_0xa3a9('0x8e'),_0xa3a9('0x5e'));if(_0x4c5fd3[_0xa3a9('0x44')]){_0x4c5fd3['order'][_0xa3a9('0x32')](function(_0x45a90a){_0x2dd9dd[_0xa3a9('0x44')]('i.'+_0x45a90a[0x0],_0x45a90a[0x1]==='DESC'?![]:!![]);});}if(!_[_0xa3a9('0x8f')](_0x1dbf44)){_0x2dd9dd[_0xa3a9('0x60')](_0xed4831);_0x532feb[_0xa3a9('0x46')](_0xa3a9('0x90'),_0x1dbf44);}BPromise[_0xa3a9('0x91')]()['then'](function(){if(!_0x58881b){if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x75')]||_0x34337a[_0xa3a9('0x39')]['journey'])return;_0x532feb['where'](_0xa3a9('0x92'));_0x2dd9dd[_0xa3a9('0x46')](_0xa3a9('0x92'));return;}return _0x34337a['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xa3a9('0x29')](function(_0x45838c){if(_[_0xa3a9('0x8f')](_0x45838c)){_0x532feb[_0xa3a9('0x46')](_0xa3a9('0x93'));_0x2dd9dd['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x532feb[_0xa3a9('0x46')](_0xa3a9('0x76'),_['map'](_0x45838c,'id'));_0x2dd9dd[_0xa3a9('0x46')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xa3a9('0x2e')](_0x45838c,'id'));}});})[_0xa3a9('0x29')](function(){db[_0xa3a9('0x94')]['query'](_0x532feb['toString'](),_0x26257b)[_0xa3a9('0x29')](function(_0x2ab5d2){_0x1681ef[_0xa3a9('0x23')]=_0x2ab5d2['length'];if(_0x1681ef[_0xa3a9('0x23')]===0x0)return[];return db[_0xa3a9('0x94')][_0xa3a9('0x39')](_0x5331d6['toString'](),_0x26257b)[_0xa3a9('0x29')](function(_0x18082a){_0xe09690=_[_0xa3a9('0x95')](_0x18082a,'id');_0x26257b=_[_0xa3a9('0x96')](_0x26257b,{'model':db[_0xa3a9('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x3f')]){_0x4c5fd3[_0xa3a9('0x3e')]['forEach'](function(_0x13f22d){_0x2dd9dd[_0xa3a9('0x48')]('i.'+_0x13f22d);});}else{_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0x8e'),_0xa3a9('0x5e'));_0x2dd9dd[_0xa3a9('0x48')]('a.key',_0xa3a9('0x97'));_0x2dd9dd['field']('a.mandatoryDisposition',_0xa3a9('0x98'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0x99'));_0x2dd9dd['field'](_0xa3a9('0x9a'),'Contact.firstName');_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0x9b'),'Contact.lastName');_0x2dd9dd['field'](_0xa3a9('0x9c'),_0xa3a9('0x9d'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0x9e'),_0xa3a9('0x9f'));_0x2dd9dd['field'](_0xa3a9('0xa0'),_0xa3a9('0xa1'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0xa2'),_0xa3a9('0xa3'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0xa4'),'Owner.fullname');_0x2dd9dd[_0xa3a9('0x48')]('o.internal',_0xa3a9('0xa5'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0xa6'),_0xa3a9('0x30'));}if(_0x4c5fd3[_0xa3a9('0x43')])_0x2dd9dd[_0xa3a9('0x43')](_0x4c5fd3['limit']);if(_0x4c5fd3[_0xa3a9('0x24')])_0x2dd9dd[_0xa3a9('0x24')](_0x4c5fd3[_0xa3a9('0x24')]);return db[_0xa3a9('0x94')][_0xa3a9('0x39')](_0x2dd9dd[_0xa3a9('0xa7')](),_0x26257b);})[_0xa3a9('0x29')](function(_0x3011eb){_0x402d3e[_0xa3a9('0x46')](_0xa3a9('0xa8'),_[_0xa3a9('0x2e')](_0x3011eb,'id'));return db['sequelize'][_0xa3a9('0x39')](_0x402d3e['toString'](),_0x26257b)[_0xa3a9('0x29')](function(_0x28e88d){var _0x13e73e=_[_0xa3a9('0xa9')](_0x28e88d,_0xa3a9('0xaa'));var _0x4149fe=[];_0x3011eb[_0xa3a9('0x32')](function(_0x37f529){_0x4149fe[_0xa3a9('0x33')](updateOpenchannelInteraction(_0x37f529,_0xe09690,_0x13e73e));});return BPromise[_0xa3a9('0xab')](_0x4149fe);});});})[_0xa3a9('0x29')](function(_0x49e2fc){_0x1681ef['rows']=_0x49e2fc;return _0x1681ef;})[_0xa3a9('0x29')](respondWithFilteredResult(_0xb01f5e,_0x4c5fd3));})[_0xa3a9('0x34')](handleError(_0xb01f5e,null));};exports['show']=function(_0x4b0dd9,_0x42ac28){var _0x5313f6={'raw':![],'where':{'id':_0x4b0dd9[_0xa3a9('0xac')]['id']}},_0x38d5f2={};_0x38d5f2[_0xa3a9('0x3d')]=_[_0xa3a9('0x3a')](db[_0xa3a9('0x36')][_0xa3a9('0xad')]);_0x38d5f2[_0xa3a9('0x39')]=_['keys'](_0x4b0dd9['query']);_0x38d5f2[_0xa3a9('0x3b')]=_['intersection'](_0x38d5f2[_0xa3a9('0x3d')],_0x38d5f2[_0xa3a9('0x39')]);_0x5313f6[_0xa3a9('0x3e')]=_[_0xa3a9('0x3c')](_0x38d5f2[_0xa3a9('0x3d')],qs[_0xa3a9('0x3f')](_0x4b0dd9['query'][_0xa3a9('0x3f')]));_0x5313f6['attributes']=_0x5313f6[_0xa3a9('0x3e')]['length']?_0x5313f6[_0xa3a9('0x3e')]:_0x38d5f2[_0xa3a9('0x3d')];if(_0x4b0dd9[_0xa3a9('0x39')][_0xa3a9('0xae')]){_0x5313f6['include']=[{'all':!![]}];}_0x5313f6=_[_0xa3a9('0x96')]({},_0x5313f6,_0x4b0dd9[_0xa3a9('0xaf')]);return db[_0xa3a9('0x36')][_0xa3a9('0x5d')](_0x5313f6)[_0xa3a9('0x29')](handleEntityNotFound(_0x42ac28,null))['then'](respondWithResult(_0x42ac28,null))[_0xa3a9('0x34')](handleError(_0x42ac28,null));};exports[_0xa3a9('0xb0')]=function(_0x56ec8e,_0x3457ca){return db[_0xa3a9('0x36')]['create'](_0x56ec8e['body'],{})[_0xa3a9('0x29')](respondWithResult(_0x3457ca,0xc9))['catch'](handleError(_0x3457ca,null));};exports['update']=function(_0x2b3607,_0x49dedd){if(_0x2b3607[_0xa3a9('0xb1')]['id']){delete _0x2b3607[_0xa3a9('0xb1')]['id'];}return db['OpenchannelInteraction'][_0xa3a9('0x5d')]({'where':{'id':_0x2b3607[_0xa3a9('0xac')]['id']}})['then'](handleEntityNotFound(_0x49dedd,null))['then'](saveUpdates(_0x2b3607[_0xa3a9('0xb1')],null))[_0xa3a9('0x29')](respondWithResult(_0x49dedd,null))[_0xa3a9('0x34')](handleError(_0x49dedd,null));};exports[_0xa3a9('0x2a')]=function(_0xadbc2b,_0x34a62d){return db[_0xa3a9('0x36')][_0xa3a9('0x5d')]({'where':{'id':_0xadbc2b[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x34a62d,null))['then'](removeEntity(_0x34a62d,null))['catch'](handleError(_0x34a62d,null));};exports[_0xa3a9('0xb2')]=function(_0xfd4ac1,_0x28887c){return db[_0xa3a9('0x36')][_0xa3a9('0xb2')]()[_0xa3a9('0x29')](respondWithResult(_0x28887c,null))['catch'](handleError(_0x28887c,null));};exports[_0xa3a9('0xb3')]=function(_0x3ece88,_0x2e0e16,_0x5d175b){return db[_0xa3a9('0xb4')][_0xa3a9('0x5d')]({'where':{'id':_0x3ece88[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x2e0e16,null))[_0xa3a9('0x29')](function(_0x2d1dcd){if(_0x2d1dcd){return _0x2d1dcd[_0xa3a9('0xb3')](_0x3ece88[_0xa3a9('0xb1')]['ids'],_['omit'](_0x3ece88['body'],[_0xa3a9('0xb5'),'id'])||{});}})[_0xa3a9('0x29')](respondWithResult(_0x2e0e16,null))[_0xa3a9('0x34')](handleError(_0x2e0e16,null));};exports[_0xa3a9('0xb6')]=function(_0x320575,_0x5b5d4b,_0x48fa0c){var _0x138afc={'raw':![],'where':{}};var _0x508076={};var _0x34283e={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xa3a9('0xb7')]({'where':{'id':_0x320575[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x5b5d4b,null))[_0xa3a9('0x29')](function(_0x5a772b){if(_0x5a772b){_0x508076[_0xa3a9('0x3d')]=_[_0xa3a9('0x3a')](db['OpenchannelMessage'][_0xa3a9('0xad')]);_0x508076['query']=_[_0xa3a9('0x3a')](_0x320575[_0xa3a9('0x39')]);_0x508076[_0xa3a9('0x3b')]=_[_0xa3a9('0x3c')](_0x508076[_0xa3a9('0x3d')],_0x508076['query']);_0x138afc[_0xa3a9('0x3e')]=_['intersection'](_0x508076[_0xa3a9('0x3d')],qs[_0xa3a9('0x3f')](_0x320575[_0xa3a9('0x39')][_0xa3a9('0x3f')]));_0x138afc[_0xa3a9('0x3e')]=_0x138afc[_0xa3a9('0x3e')][_0xa3a9('0x40')]?_0x138afc[_0xa3a9('0x3e')]:_0x508076[_0xa3a9('0x3d')];if(!_0x320575[_0xa3a9('0x39')][_0xa3a9('0x41')](_0xa3a9('0x42'))){_0x138afc[_0xa3a9('0x43')]=qs[_0xa3a9('0x43')](_0x320575[_0xa3a9('0x39')]['limit']);_0x138afc['offset']=qs['offset'](_0x320575[_0xa3a9('0x39')]['offset']);}_0x138afc[_0xa3a9('0x44')]=qs[_0xa3a9('0x45')](_0x320575[_0xa3a9('0x39')][_0xa3a9('0x45')]);_0x138afc[_0xa3a9('0x46')]=qs['filters'](_[_0xa3a9('0x47')](_0x320575[_0xa3a9('0x39')],_0x508076[_0xa3a9('0x3b')]));_0x138afc['where']['OpenchannelInteractionId']=_0x5a772b['id'];if(_0x320575['query'][_0xa3a9('0x84')]){_0x138afc[_0xa3a9('0x46')]=_['merge'](_0x138afc[_0xa3a9('0x46')],{'$or':_[_0xa3a9('0x2e')](_0x138afc[_0xa3a9('0x3e')],function(_0x1f3351){var _0x220d94={};_0x220d94[_0x1f3351]={'$like':'%'+_0x320575[_0xa3a9('0x39')][_0xa3a9('0x84')]+'%'};return _0x220d94;})});}if(_0x320575[_0xa3a9('0x39')][_0xa3a9('0x7a')]){var _0x368181=_0x320575[_0xa3a9('0x39')]['$gte'][_0xa3a9('0x65')](',');var _0x15bf08={};_0x15bf08[_0x368181[0x0]]={'$gte':moment(_0x368181[0x1])[_0xa3a9('0xb8')](_0xa3a9('0xb9'))};_0x138afc[_0xa3a9('0x46')]=_['merge'](_0x138afc['where'],_0x15bf08);}_0x138afc=_[_0xa3a9('0x96')]({},_0x138afc,_0x320575[_0xa3a9('0xaf')]);return db[_0xa3a9('0xb4')][_0xa3a9('0x23')]({'where':_0x138afc[_0xa3a9('0x46')]})[_0xa3a9('0x29')](function(_0x41f71f){_0x34283e[_0xa3a9('0x23')]=_0x41f71f;if(_0x320575[_0xa3a9('0x39')][_0xa3a9('0xae')]){_0x138afc[_0xa3a9('0xba')]=[{'all':!![]}];}return db[_0xa3a9('0xb4')][_0xa3a9('0xbb')](_0x138afc);})[_0xa3a9('0x29')](function(_0x4a8642){_0x34283e['rows']=_0x4a8642;return _0x34283e;});}})[_0xa3a9('0x29')](respondWithFilteredResult(_0x5b5d4b,_0x138afc))['catch'](handleError(_0x5b5d4b,null));};exports[_0xa3a9('0xbc')]=function(_0x5c41a9,_0x3a718a,_0x525b6f){return db[_0xa3a9('0x36')]['find']({'where':{'id':_0x5c41a9[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x3a718a,null))[_0xa3a9('0x29')](function(_0x4a1c7e){if(_0x4a1c7e){return _0x4a1c7e[_0xa3a9('0xbd')](_0x5c41a9['body'][_0xa3a9('0xb5')],_[_0xa3a9('0xbe')](_0x5c41a9[_0xa3a9('0xb1')],[_0xa3a9('0xb5'),'id'])||{})['spread'](function(){return db[_0xa3a9('0x6c')]['findAll']({'attributes':['id',_0xa3a9('0x2c'),_0xa3a9('0xbf')],'where':{'id':_0x5c41a9[_0xa3a9('0xb1')]['ids']}});})[_0xa3a9('0x29')](function(_0x18a8ba){socket['emit'](_0xa3a9('0xc0'),{'id':Number(_0x5c41a9['params']['id']),'tags':_0x18a8ba||[]});return{'id':Number(_0x5c41a9[_0xa3a9('0xac')]['id']),'tags':_0x18a8ba||[]};});}})[_0xa3a9('0x29')](respondWithResult(_0x3a718a,null))[_0xa3a9('0x34')](handleError(_0x3a718a,null));};exports[_0xa3a9('0xc1')]=function(_0x337905,_0x5ee177,_0x8547f4){return db[_0xa3a9('0x36')][_0xa3a9('0x5d')]({'where':{'id':_0x337905[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x5ee177,null))['then'](function(_0x219a09){if(_0x219a09){return _0x219a09[_0xa3a9('0xc1')](_0x337905[_0xa3a9('0x39')]['ids']);}})[_0xa3a9('0x29')](respondWithStatusCode(_0x5ee177,null))[_0xa3a9('0x34')](handleError(_0x5ee177,null));};exports[_0xa3a9('0xc2')]=function(_0x2c1dc7,_0x3b441b){var _0x44a79e=moment()['unix']()[_0xa3a9('0xa7')]();var _0x184507=path[_0xa3a9('0xc3')](config[_0xa3a9('0xc4')],_0xa3a9('0xc5'),_0xa3a9('0xc6'),_0xa3a9('0xc7'));var _0x1590ee=path[_0xa3a9('0xc3')](config[_0xa3a9('0xc4')],_0xa3a9('0xc5'),'files',_0xa3a9('0xc8'));var _0x2c6f66=path[_0xa3a9('0xc3')](_0x184507,_0x44a79e);var _0x50a003=util[_0xa3a9('0xb8')](_0xa3a9('0xc9'),_0x2c1dc7[_0xa3a9('0xac')]['id'],_0x44a79e);var _0x1665cb=path[_0xa3a9('0xc3')](_0x184507,_0x50a003);var _0x30a828=[];_0x30a828[_0xa3a9('0x33')]({'model':db[_0xa3a9('0x6f')],'as':'User','attributes':['id',_0xa3a9('0x2f')],'raw':!![]});_0x30a828['push']({'model':db[_0xa3a9('0xca')],'as':_0xa3a9('0x62'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x2c1dc7[_0xa3a9('0x39')][_0xa3a9('0xc8')]){_0x30a828['push']({'model':db['Attachment'],'as':_0xa3a9('0xcb'),'raw':!![]});}var _0x561ce6=[{'model':db[_0xa3a9('0xb4')],'as':_0xa3a9('0xcc'),'attributes':['id',_0xa3a9('0xb1'),_0xa3a9('0x78'),_0xa3a9('0xcd'),'secret',_0xa3a9('0x80')],'include':_0x30a828}];_0x561ce6[_0xa3a9('0x33')]({'model':db[_0xa3a9('0xce')],'as':_0xa3a9('0xcf'),'attributes':['id','name']});_0x561ce6[_0xa3a9('0x33')]({'model':db[_0xa3a9('0x6f')],'as':_0xa3a9('0xd0'),'attributes':['id',_0xa3a9('0x2f')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2c1dc7[_0xa3a9('0xac')]['id']},'include':_0x561ce6})[_0xa3a9('0x29')](handleEntityNotFound(_0x3b441b,null))[_0xa3a9('0x29')](function(_0x226583){if(_0x226583){var _0x450c15=_0x226583[_0xa3a9('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x2c6f66);var _0x181086={'format':'A4','border':_0xa3a9('0xd2'),'header':{'height':_0xa3a9('0xd3'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xa3a9('0xd4'),'contents':{'default':util[_0xa3a9('0xb8')](_0xa3a9('0xd5'),util['format'](_0xa3a9('0xd6'),'Openchannel',_0x450c15['id']),moment()[_0xa3a9('0xb8')](_0xa3a9('0xd7'))[_0xa3a9('0xa7')]())}}};var _0x5e62a0={'channel':'Openchannel','account':_0x450c15['Account']['name'],'agent':_0x450c15[_0xa3a9('0xd0')]?_0x450c15['Owner'][_0xa3a9('0x2f')]:'N.A.','createdAt':moment(_0x450c15['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa3a9('0xa7')](),'closedAt':_0x450c15[_0xa3a9('0xd8')]?moment(_0x450c15[_0xa3a9('0xd9')])[_0xa3a9('0xb8')](_0xa3a9('0xb9'))[_0xa3a9('0xa7')]():'','disposition':_0x450c15[_0xa3a9('0xda')],'visibility':_0x450c15[_0xa3a9('0xdb')]?'Public':_0xa3a9('0xdc'),'messages':_(_0x450c15[_0xa3a9('0xcc')])['filter']({'secret':![]})[_0xa3a9('0x2e')](function(_0xad45fc){if(_0xad45fc[_0xa3a9('0xcb')]){var _0xc343af=path[_0xa3a9('0xc3')](_0x1590ee,_0xad45fc['Attachment']['basename']);if(fs[_0xa3a9('0xdd')](_0xc343af)){fs[_0xa3a9('0xde')](_0xc343af)['pipe'](fs['createWriteStream'](path[_0xa3a9('0xc3')](_0x2c6f66,_0xad45fc[_0xa3a9('0xcb')][_0xa3a9('0xdf')])));}}return{'date':moment(_0xad45fc[_0xa3a9('0x78')])[_0xa3a9('0xb8')](_0xa3a9('0xb9'))[_0xa3a9('0xa7')](),'sender':_0xad45fc[_0xa3a9('0xcd')]===_0xa3a9('0xe0')?_0xad45fc['User']?_0xad45fc[_0xa3a9('0x6f')][_0xa3a9('0x2f')]:_0xa3a9('0xe1'):_0xad45fc['Contact']['firstName']+(_0xad45fc[_0xa3a9('0x62')][_0xa3a9('0xe2')]?'\x20'+_0xad45fc[_0xa3a9('0x62')]['lastName']:''),'body':_0xad45fc[_0xa3a9('0xcb')]?_0xad45fc[_0xa3a9('0xcb')][_0xa3a9('0xdf')]:_0xad45fc[_0xa3a9('0xb1')],'direction':_0xad45fc[_0xa3a9('0xcd')]==='out'?'A':'C','secret':_0xad45fc[_0xa3a9('0xe3')],'read':_0xad45fc[_0xa3a9('0x80')],'attachment':_0xad45fc[_0xa3a9('0xcb')]};})[_0xa3a9('0x5f')]()};return ejs['renderFile'](path[_0xa3a9('0xc3')](config[_0xa3a9('0xc4')],'server',_0xa3a9('0xe4'),_0xa3a9('0xe5')),{'interaction':_0x5e62a0})['then'](function(_0x595216){return new BPromise(function(_0x7b85e,_0x1d4549){pdf[_0xa3a9('0xb0')](_0x595216,_0x181086)[_0xa3a9('0xe6')](path[_0xa3a9('0xc3')](_0x2c6f66,_0xa3a9('0xe7')+_0x450c15['id']+'-'+_0x44a79e+_0xa3a9('0xe8')),function(_0x2fdf21,_0x3bb7c5){if(_0x2fdf21)return _0x1d4549(_0x2fdf21);_0x7b85e(_0x3bb7c5);});});})[_0xa3a9('0x29')](function(){return new BPromise(function(_0x123fc2,_0x194417){zipdir(_0x2c6f66,{'saveTo':_0x1665cb},function(_0xfa9445,_0x41c615){if(_0xfa9445)return _0x194417(_0xfa9445);return _0x123fc2(_0x41c615);});})['then'](function(){return new BPromise(function(_0x46c616,_0x43039c){rimraf(_0x2c6f66,function(_0x221a89){if(_0x221a89)_0x43039c(_0x221a89);return _0x46c616();});});})['then'](function(){return _0x3b441b[_0xa3a9('0xc2')](_0x1665cb,_0x50a003,function(_0x425f4f){if(_0x425f4f){console['log'](_0xa3a9('0xe9'),_0x425f4f);}else{fs[_0xa3a9('0xea')](_0x1665cb);}});});});}else{return _0x3b441b['sendStatus'](0xc8);}})['catch'](handleError(_0x3b441b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8d9cb8e..05c802b 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 _0xc2a7=['length','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x5c53be,_0x5677a5){var _0x2d5fda=function(_0x584cdb){while(--_0x584cdb){_0x5c53be['push'](_0x5c53be['shift']());}};_0x2d5fda(++_0x5677a5);}(_0xc2a7,0xd0));var _0x7c2a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc2a7[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x7c2a('0x0'))['db'][_0x7c2a('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x7c2a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7c2a('0x3')](0x0);var events={'afterCreate':_0x7c2a('0x4'),'afterUpdate':_0x7c2a('0x5'),'afterDestroy':_0x7c2a('0x6')};function emitEvent(_0x4bb3fa){return function(_0x2fe7b7,_0x9d9868,_0x4a4a16){_0x2fe7b7['getUsers']({'attributes':['id'],'raw':!![]})[_0x7c2a('0x7')](function(_0x1152bc){_0x2fe7b7[_0x7c2a('0x8')](_0x7c2a('0x9'),_0x1152bc[_0x7c2a('0xa')](function(_0x41850b){return{'id':_0x41850b['id']};}));return OpenchannelMessage[_0x7c2a('0xb')]({'where':{'OpenchannelInteractionId':_0x2fe7b7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c2a('0x7')](function(_0x2af2a1){_0x2fe7b7[_0x7c2a('0x8')](_0x7c2a('0xc'),_0x2af2a1[_0x7c2a('0xd')]);OpenchannelInteractionEvents['emit'](_0x4bb3fa+':'+_0x2fe7b7['id'],_0x2fe7b7);OpenchannelInteractionEvents['emit'](_0x4bb3fa,_0x2fe7b7);_0x4a4a16(null);})[_0x7c2a('0xe')](_0x4a4a16(null));};}for(var e in events){if(events[_0x7c2a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7c2a('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x03ac=['unreadMessages','length','emit','catch','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0x03ac,0x1c0));var _0xc03a=function(_0x1e2e8e,_0x43109a){_0x1e2e8e=_0x1e2e8e-0x0;var _0xff6b63=_0x03ac[_0x1e2e8e];return _0xff6b63;};'use strict';var EventEmitter=require(_0xc03a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xc03a('0x1')];var OpenchannelMessage=require(_0xc03a('0x2'))['db'][_0xc03a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc03a('0x4'),'afterUpdate':_0xc03a('0x5'),'afterDestroy':_0xc03a('0x6')};function emitEvent(_0x59fc9e){return function(_0x4327a1,_0x40a3cf,_0x472d53){_0x4327a1[_0xc03a('0x7')]({'attributes':['id'],'raw':!![]})[_0xc03a('0x8')](function(_0x25eda3){_0x4327a1[_0xc03a('0x9')](_0xc03a('0xa'),_0x25eda3['map'](function(_0x16546d){return{'id':_0x16546d['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4327a1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3e1b43){_0x4327a1[_0xc03a('0x9')](_0xc03a('0xb'),_0x3e1b43[_0xc03a('0xc')]);OpenchannelInteractionEvents[_0xc03a('0xd')](_0x59fc9e+':'+_0x4327a1['id'],_0x4327a1);OpenchannelInteractionEvents[_0xc03a('0xd')](_0x59fc9e,_0x4327a1);_0x472d53(null);})[_0xc03a('0xe')](_0x472d53(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xc03a('0xf')](e,emitEvent(event));}}module[_0xc03a('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index dcd10cd..27457f0 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 _0xadd0=['../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','format','util','api','moment','bluebird','path','rimraf'];(function(_0x38cb7c,_0xf33f42){var _0x2a5f5e=function(_0x54b3ac){while(--_0x54b3ac){_0x38cb7c['push'](_0x38cb7c['shift']());}};_0x2a5f5e(++_0xf33f42);}(_0xadd0,0x158));var _0x0add=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xadd0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0add('0x0'));var logger=require('../../config/logger')(_0x0add('0x1'));var moment=require(_0x0add('0x2'));var BPromise=require(_0x0add('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0add('0x4'));var rimraf=require(_0x0add('0x5'));var config=require(_0x0add('0x6'));var attributes=require(_0x0add('0x7'));module[_0x0add('0x8')]=function(_0x41d0c0,_0xc471f3){return _0x41d0c0[_0x0add('0x9')](_0x0add('0xa'),attributes,{'tableName':_0x0add('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x471594,_0x3c102c,_0x1ca5c6){if(_0x471594[_0x0add('0xc')]('closed')){_0x471594['closedAt']=moment()[_0x0add('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1ca5c6(null,_0x471594);}}});}; \ No newline at end of file +var _0xdf13=['format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closedAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf13,0x1b4));var _0x3df1=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0xdf13[_0x507ac5];return _0x12c1bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3df1('0x0'))(_0x3df1('0x1'));var moment=require(_0x3df1('0x2'));var BPromise=require(_0x3df1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3df1('0x4'));var config=require('../../config/environment');var attributes=require(_0x3df1('0x5'));module[_0x3df1('0x6')]=function(_0x2dc1af,_0x26d273){return _0x2dc1af[_0x3df1('0x7')](_0x3df1('0x8'),attributes,{'tableName':_0x3df1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1875ff,_0x59ed97,_0x53b4ee){if(_0x1875ff[_0x3df1('0xa')]('closed')){_0x1875ff[_0x3df1('0xb')]=moment()[_0x3df1('0xc')](_0x3df1('0xd'));}_0x53b4ee(null,_0x1875ff);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 9a00dee..798c5ca 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 _0x9478=['AddTags','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateOpenchannelInteraction','body','raw','options','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','ids','spread'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x9478,0x173));var _0x8947=function(_0x2304a8,_0x559d22){_0x2304a8=_0x2304a8-0x0;var _0x44668b=_0x9478[_0x2304a8];return _0x44668b;};'use strict';var _=require(_0x8947('0x0'));var util=require(_0x8947('0x1'));var moment=require('moment');var BPromise=require(_0x8947('0x2'));var rs=require(_0x8947('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8947('0x4'))['db'];var utils=require(_0x8947('0x5'));var logger=require(_0x8947('0x6'))('rpc');var config=require(_0x8947('0x7'));var jayson=require(_0x8947('0x8'));var client=jayson[_0x8947('0x9')][_0x8947('0xa')]({'port':0x232a});config[_0x8947('0xb')]=_[_0x8947('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8947('0xb')]));require(_0x8947('0xd'))[_0x8947('0xe')](socket);function respondWithRpcPromise(_0x2e623b,_0xfb3f77,_0xa690b4){return new BPromise(function(_0x5616fe,_0x53fda0){return client[_0x8947('0xf')](_0x2e623b,_0xa690b4)[_0x8947('0x10')](function(_0x105f87){logger['info'](_0x8947('0x11'),_0xfb3f77,_0x8947('0x12'));logger[_0x8947('0x13')](_0x8947('0x14'),_0xfb3f77,_0x8947('0x12'),JSON['stringify'](_0x105f87));if(_0x105f87[_0x8947('0x15')]){if(_0x105f87['error'][_0x8947('0x16')]===0x1f4){logger[_0x8947('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xfb3f77,_0x105f87[_0x8947('0x15')][_0x8947('0x17')]);return _0x53fda0(_0x105f87[_0x8947('0x15')][_0x8947('0x17')]);}logger[_0x8947('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xfb3f77,_0x105f87[_0x8947('0x15')][_0x8947('0x17')]);return _0x5616fe(_0x105f87['error'][_0x8947('0x17')]);}else{logger[_0x8947('0x18')](_0x8947('0x11'),_0xfb3f77,_0x8947('0x12'));_0x5616fe(_0x105f87[_0x8947('0x19')][_0x8947('0x17')]);}})[_0x8947('0x1a')](function(_0x5252d4){logger['error'](_0x8947('0x11'),_0xfb3f77,_0x5252d4);_0x53fda0(_0x5252d4);});});}exports[_0x8947('0x1b')]=function(_0x4f0d69){var _0x2ef74f=this;return new Promise(function(_0x5cf6e4,_0x1c3a66){return db['OpenchannelInteraction']['update'](_0x4f0d69[_0x8947('0x1c')],{'raw':_0x4f0d69['options']?_0x4f0d69['options'][_0x8947('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f0d69[_0x8947('0x1e')]?_0x4f0d69['options']['where']||null:null,'attributes':_0x4f0d69[_0x8947('0x1e')]?_0x4f0d69[_0x8947('0x1e')][_0x8947('0x1f')]||null:null,'limit':_0x4f0d69[_0x8947('0x1e')]?_0x4f0d69[_0x8947('0x1e')][_0x8947('0x20')]||null:null})[_0x8947('0x10')](function(_0x552140){logger[_0x8947('0x18')](_0x8947('0x1b'),_0x4f0d69);logger[_0x8947('0x13')](_0x8947('0x1b'),_0x4f0d69,JSON['stringify'](_0x552140));_0x5cf6e4(_0x552140);})[_0x8947('0x1a')](function(_0x4aef35){logger[_0x8947('0x15')](_0x8947('0x1b'),_0x4aef35[_0x8947('0x17')],_0x4f0d69);_0x1c3a66(_0x2ef74f[_0x8947('0x15')](0x1f4,_0x4aef35['message']));});});};exports[_0x8947('0x21')]=function(_0x230533){return new Promise(function(_0x3f2b3c,_0x46a201){return db[_0x8947('0x22')][_0x8947('0x23')]({'where':_0x230533['options']?_0x230533[_0x8947('0x1e')][_0x8947('0x24')]||null:null})[_0x8947('0x10')](function(_0x1915af){if(_0x1915af){return _0x1915af['addTags'](_0x230533[_0x8947('0x1c')][_0x8947('0x25')],_['omit'](_0x230533['body'],[_0x8947('0x25'),'id'])||{});}})[_0x8947('0x26')](function(_0x246a80){logger[_0x8947('0x18')](_0x8947('0x27'),_0x230533);logger['debug'](_0x8947('0x27'),_0x230533,JSON[_0x8947('0x28')](_0x246a80));_0x3f2b3c(_0x246a80);})[_0x8947('0x1a')](function(_0x22f711){logger['error'](_0x8947('0x27'),_0x22f711[_0x8947('0x17')],_0x230533);_0x46a201(_this[_0x8947('0x15')](0x1f4,_0x22f711[_0x8947('0x17')]));});});}; \ No newline at end of file +var _0xa3ec=['OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','stringify','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','./openchannelInteraction.socket','request','info'];(function(_0x5e59f2,_0x4d7f88){var _0x15de7b=function(_0x1babe1){while(--_0x1babe1){_0x5e59f2['push'](_0x5e59f2['shift']());}};_0x15de7b(++_0x4d7f88);}(_0xa3ec,0x193));var _0xca3e=function(_0x2ac882,_0x4d1788){_0x2ac882=_0x2ac882-0x0;var _0x5721ab=_0xa3ec[_0x2ac882];return _0x5721ab;};'use strict';var _=require(_0xca3e('0x0'));var util=require(_0xca3e('0x1'));var moment=require('moment');var BPromise=require(_0xca3e('0x2'));var rs=require(_0xca3e('0x3'));var fs=require('fs');var Redis=require(_0xca3e('0x4'));var db=require(_0xca3e('0x5'))['db'];var utils=require(_0xca3e('0x6'));var logger=require(_0xca3e('0x7'))('rpc');var config=require(_0xca3e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca3e('0x9')]({'port':0x232a});config[_0xca3e('0xa')]=_[_0xca3e('0xb')](config[_0xca3e('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca3e('0xa')]));require(_0xca3e('0xc'))['register'](socket);function respondWithRpcPromise(_0x571ae3,_0x449c7b,_0x480dad){return new BPromise(function(_0x178b77,_0x2d6ca3){return client[_0xca3e('0xd')](_0x571ae3,_0x480dad)['then'](function(_0x121387){logger[_0xca3e('0xe')](_0xca3e('0xf'),_0x449c7b,'request\x20sent');logger[_0xca3e('0x10')](_0xca3e('0x11'),_0x449c7b,'request\x20sent',JSON['stringify'](_0x121387));if(_0x121387[_0xca3e('0x12')]){if(_0x121387[_0xca3e('0x12')][_0xca3e('0x13')]===0x1f4){logger[_0xca3e('0x12')](_0xca3e('0xf'),_0x449c7b,_0x121387['error'][_0xca3e('0x14')]);return _0x2d6ca3(_0x121387['error']['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x449c7b,_0x121387[_0xca3e('0x12')][_0xca3e('0x14')]);return _0x178b77(_0x121387[_0xca3e('0x12')][_0xca3e('0x14')]);}else{logger[_0xca3e('0xe')](_0xca3e('0xf'),_0x449c7b,'request\x20sent');_0x178b77(_0x121387[_0xca3e('0x15')][_0xca3e('0x14')]);}})[_0xca3e('0x16')](function(_0x56ade2){logger[_0xca3e('0x12')](_0xca3e('0xf'),_0x449c7b,_0x56ade2);_0x2d6ca3(_0x56ade2);});});}exports[_0xca3e('0x17')]=function(_0x2aee79){var _0x3dd0a8=this;return new Promise(function(_0x266a48,_0x1a45bb){return db[_0xca3e('0x18')][_0xca3e('0x19')](_0x2aee79[_0xca3e('0x1a')],{'raw':_0x2aee79[_0xca3e('0x1b')]?_0x2aee79[_0xca3e('0x1b')][_0xca3e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aee79[_0xca3e('0x1b')]?_0x2aee79[_0xca3e('0x1b')][_0xca3e('0x1d')]||null:null,'attributes':_0x2aee79[_0xca3e('0x1b')]?_0x2aee79['options']['attributes']||null:null,'limit':_0x2aee79['options']?_0x2aee79[_0xca3e('0x1b')][_0xca3e('0x1e')]||null:null})['then'](function(_0x3a4189){logger['info'](_0xca3e('0x17'),_0x2aee79);logger[_0xca3e('0x10')](_0xca3e('0x17'),_0x2aee79,JSON[_0xca3e('0x1f')](_0x3a4189));_0x266a48(_0x3a4189);})[_0xca3e('0x16')](function(_0x44eeec){logger[_0xca3e('0x12')](_0xca3e('0x17'),_0x44eeec[_0xca3e('0x14')],_0x2aee79);_0x1a45bb(_0x3dd0a8[_0xca3e('0x12')](0x1f4,_0x44eeec[_0xca3e('0x14')]));});});};exports[_0xca3e('0x20')]=function(_0x125b7b){return new Promise(function(_0x650952,_0xe6f9ea){return db[_0xca3e('0x18')]['find']({'where':_0x125b7b[_0xca3e('0x1b')]?_0x125b7b['options']['where']||null:null})['then'](function(_0x4af8f7){if(_0x4af8f7){return _0x4af8f7[_0xca3e('0x21')](_0x125b7b['body'][_0xca3e('0x22')],_[_0xca3e('0x23')](_0x125b7b['body'],[_0xca3e('0x22'),'id'])||{});}})[_0xca3e('0x24')](function(_0x39b9d5){logger['info']('AddTags',_0x125b7b);logger[_0xca3e('0x10')]('AddTags',_0x125b7b,JSON[_0xca3e('0x1f')](_0x39b9d5));_0x650952(_0x39b9d5);})[_0xca3e('0x16')](function(_0x144473){logger[_0xca3e('0x12')](_0xca3e('0x25'),_0x144473[_0xca3e('0x14')],_0x125b7b);_0xe6f9ea(_this[_0xca3e('0x12')](0x1f4,_0x144473['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ae5966b..79f5aa9 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 _0x16e8=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener'];(function(_0x493030,_0x29ec7e){var _0x56f5e4=function(_0xb929a1){while(--_0xb929a1){_0x493030['push'](_0x493030['shift']());}};_0x56f5e4(++_0x29ec7e);}(_0x16e8,0x183));var _0x816e=function(_0x596f90,_0x305ed5){_0x596f90=_0x596f90-0x0;var _0x2897e9=_0x16e8[_0x596f90];return _0x2897e9;};'use strict';var OpenchannelInteractionEvents=require(_0x816e('0x0'));var events=[_0x816e('0x1'),_0x816e('0x2'),_0x816e('0x3')];function createListener(_0x1be59a,_0x3f2a4a){return function(_0x53be3d){_0x3f2a4a['emit'](_0x1be59a,_0x53be3d);};}function removeListener(_0x174f10,_0x195610){return function(){OpenchannelInteractionEvents[_0x816e('0x4')](_0x174f10,_0x195610);};}exports[_0x816e('0x5')]=function(_0x564ce4){for(var _0x4157bb=0x0,_0x3cdc8c=events['length'];_0x4157bb<_0x3cdc8c;_0x4157bb++){var _0x418de6=events[_0x4157bb];var _0x3d425d=createListener(_0x816e('0x6')+_0x418de6,_0x564ce4);OpenchannelInteractionEvents['on'](_0x418de6,_0x3d425d);}}; \ No newline at end of file +var _0xe2cd=['register','openchannelInteraction:','save','emit'];(function(_0x3c6fae,_0x39f261){var _0x2ba9ab=function(_0x4e78ff){while(--_0x4e78ff){_0x3c6fae['push'](_0x3c6fae['shift']());}};_0x2ba9ab(++_0x39f261);}(_0xe2cd,0x76));var _0xde2c=function(_0x3353b6,_0x59c7b3){_0x3353b6=_0x3353b6-0x0;var _0x133fa1=_0xe2cd[_0x3353b6];return _0x133fa1;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xde2c('0x0'),'remove','update'];function createListener(_0x27ded7,_0x55f0b4){return function(_0x4771d7){_0x55f0b4[_0xde2c('0x1')](_0x27ded7,_0x4771d7);};}function removeListener(_0x2a9c4a,_0x37c98c){return function(){OpenchannelInteractionEvents['removeListener'](_0x2a9c4a,_0x37c98c);};}exports[_0xde2c('0x2')]=function(_0x140298){for(var _0x5c70d3=0x0,_0x3e5451=events['length'];_0x5c70d3<_0x3e5451;_0x5c70d3++){var _0x5d5dca=events[_0x5c70d3];var _0x2580ad=createListener(_0xde2c('0x3')+_0x5d5dca,_0x140298);OpenchannelInteractionEvents['on'](_0x5d5dca,_0x2580ad);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index aa4d6e5..02e8a34 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 _0x42fa=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/:id','post','tracked','openchannel','openchannelmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4b1c8e,_0x164bd7){var _0x4f38c9=function(_0x3fd138){while(--_0x3fd138){_0x4b1c8e['push'](_0x4b1c8e['shift']());}};_0x4f38c9(++_0x164bd7);}(_0x42fa,0x97));var _0xa42f=function(_0x7beda5,_0x5d855c){_0x7beda5=_0x7beda5-0x0;var _0x5cea6b=_0x42fa[_0x7beda5];return _0x5cea6b;};'use strict';var multer=require(_0xa42f('0x0'));var util=require(_0xa42f('0x1'));var path=require(_0xa42f('0x2'));var timeout=require(_0xa42f('0x3'));var express=require(_0xa42f('0x4'));var router=express[_0xa42f('0x5')]();var auth=require(_0xa42f('0x6'));var interaction=require(_0xa42f('0x7'));var config=require(_0xa42f('0x8'));var controller=require(_0xa42f('0x9'));router[_0xa42f('0xa')]('/',auth[_0xa42f('0xb')](),controller[_0xa42f('0xc')]);router[_0xa42f('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xa42f('0xd'),auth[_0xa42f('0xb')](),controller['show']);router[_0xa42f('0xe')]('/',auth['isAuthenticated'](),interaction[_0xa42f('0xf')](_0xa42f('0x10'),_0xa42f('0x11')),controller[_0xa42f('0x12')]);router[_0xa42f('0x13')]('/:id',auth[_0xa42f('0xb')](),controller[_0xa42f('0x14')]);router[_0xa42f('0x13')](_0xa42f('0x15'),auth['isAuthenticated'](),controller[_0xa42f('0x16')]);router['put']('/:id/reject',auth[_0xa42f('0xb')](),controller['reject']);router[_0xa42f('0x17')](_0xa42f('0xd'),auth['isAuthenticated'](),controller[_0xa42f('0x18')]);module[_0xa42f('0x19')]=router; \ No newline at end of file +var _0xf726=['../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','get','describe','/:id','show','post','tracked','openchannel','create','/:id/accept','put','/:id/reject','reject','delete','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1b39bf,_0x2d9bb5){var _0x2548e7=function(_0x32d37b){while(--_0x32d37b){_0x1b39bf['push'](_0x1b39bf['shift']());}};_0x2548e7(++_0x2d9bb5);}(_0xf726,0xc1));var _0x6f72=function(_0x403eb7,_0x1fca8b){_0x403eb7=_0x403eb7-0x0;var _0x1b5bf4=_0xf726[_0x403eb7];return _0x1b5bf4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f72('0x0'));var timeout=require(_0x6f72('0x1'));var express=require(_0x6f72('0x2'));var router=express[_0x6f72('0x3')]();var auth=require(_0x6f72('0x4'));var interaction=require(_0x6f72('0x5'));var config=require('../../config/environment');var controller=require(_0x6f72('0x6'));router['get']('/',auth[_0x6f72('0x7')](),controller['index']);router[_0x6f72('0x8')]('/describe',auth[_0x6f72('0x7')](),controller[_0x6f72('0x9')]);router[_0x6f72('0x8')](_0x6f72('0xa'),auth[_0x6f72('0x7')](),controller[_0x6f72('0xb')]);router[_0x6f72('0xc')]('/',auth['isAuthenticated'](),interaction[_0x6f72('0xd')](_0x6f72('0xe'),'openchannelmessage:create'),controller[_0x6f72('0xf')]);router['put'](_0x6f72('0xa'),auth[_0x6f72('0x7')](),controller['update']);router['put'](_0x6f72('0x10'),auth['isAuthenticated'](),controller['accept']);router[_0x6f72('0x11')](_0x6f72('0x12'),auth[_0x6f72('0x7')](),controller[_0x6f72('0x13')]);router[_0x6f72('0x14')](_0x6f72('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f72('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 58e168f..c25ab26 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 _0x94d3=['out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x1cfc2b,_0x206b9d){var _0xd46e6e=function(_0x591f7a){while(--_0x591f7a){_0x1cfc2b['push'](_0x1cfc2b['shift']());}};_0xd46e6e(++_0x206b9d);}(_0x94d3,0x188));var _0x394d=function(_0x1adbb5,_0x5e988e){_0x1adbb5=_0x1adbb5-0x0;var _0x41e36c=_0x94d3[_0x1adbb5];return _0x41e36c;};'use strict';var Sequelize=require(_0x394d('0x0'));module['exports']={'body':{'type':Sequelize[_0x394d('0x1')](_0x394d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x394d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x394d('0x4')),'defaultValue':_0x394d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x394d('0x5')]}}; \ No newline at end of file +var _0x2f81=['DATE','sequelize','medium','BOOLEAN','ENUM'];(function(_0x3ab6cb,_0x591249){var _0x108ae5=function(_0x54be0c){while(--_0x54be0c){_0x3ab6cb['push'](_0x3ab6cb['shift']());}};_0x108ae5(++_0x591249);}(_0x2f81,0x146));var _0x12f8=function(_0x5aab0d,_0x5f328c){_0x5aab0d=_0x5aab0d-0x0;var _0x272b83=_0x2f81[_0x5aab0d];return _0x272b83;};'use strict';var Sequelize=require(_0x12f8('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x12f8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x12f8('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x12f8('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x12f8('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index a668c2b..7837957 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 _0xc3fc=['accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','name','send','index','map','OpenchannelMessage','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','length','find','create','body','update','describe','openchannel-interactions'];(function(_0x177654,_0x3e78eb){var _0x394e97=function(_0x43b013){while(--_0x43b013){_0x177654['push'](_0x177654['shift']());}};_0x394e97(++_0x3e78eb);}(_0xc3fc,0x194));var _0xcc3f=function(_0x9f6913,_0xd3f9e1){_0x9f6913=_0x9f6913-0x0;var _0x22507c=_0xc3fc[_0x9f6913];return _0x22507c;};'use strict';var pdf=require(_0xcc3f('0x0'));var emlformat=require(_0xcc3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcc3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc3f('0x3'));var moment=require(_0xcc3f('0x4'));var BPromise=require(_0xcc3f('0x5'));var Mustache=require(_0xcc3f('0x6'));var util=require(_0xcc3f('0x7'));var path=require(_0xcc3f('0x8'));var sox=require(_0xcc3f('0x9'));var csv=require(_0xcc3f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcc3f('0xb'));var crypto=require(_0xcc3f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcc3f('0xd'));var toCsv=require(_0xcc3f('0xa'));var querystring=require(_0xcc3f('0xe'));var Papa=require(_0xcc3f('0xf'));var Redis=require(_0xcc3f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcc3f('0x11'));var as=require(_0xcc3f('0x12'));var hardwareService=require(_0xcc3f('0x13'));var logger=require(_0xcc3f('0x14'))(_0xcc3f('0x15'));var utils=require(_0xcc3f('0x16'));var config=require(_0xcc3f('0x17'));var db=require(_0xcc3f('0x18'))['db'];config[_0xcc3f('0x19')]=_['defaults'](config[_0xcc3f('0x19')],{'host':_0xcc3f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc3f('0x19')]));require('./openchannelMessage.socket')[_0xcc3f('0x1b')](socket);var jayson=require(_0xcc3f('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xcc3f('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x4f1ce6,_0x5950cd,_0x5f501f){if(_0x5f501f){var _0x16a101=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16a101['test'](_0x5950cd)){return _0x4f1ce6;}else{throw new db['Sequelize'][(_0xcc3f('0x1e'))](_0xcc3f('0x1f'));}}else{return _0x4f1ce6;}}function respondWithRpcPromise(_0x12ec2b,_0x57af27,_0x454c83,_0x3fdd4b){return new BPromise(function(_0x40dcf7,_0x4209e3){var _0x1886f2=_0x3fdd4b||client;return _0x1886f2[_0xcc3f('0x20')](_0x12ec2b,_0x454c83)[_0xcc3f('0x21')](function(_0x1f899e){logger[_0xcc3f('0x22')](_0xcc3f('0x23'),_0x57af27,_0xcc3f('0x24'));logger[_0xcc3f('0x25')](_0xcc3f('0x26'),_0x57af27,_0xcc3f('0x24'),JSON[_0xcc3f('0x27')](_0x1f899e));if(_0x1f899e[_0xcc3f('0x28')]){if(_0x1f899e[_0xcc3f('0x28')]['code']===0x1f4){logger[_0xcc3f('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x57af27,_0x1f899e[_0xcc3f('0x28')][_0xcc3f('0x29')]);return _0x4209e3(_0x1f899e['error'][_0xcc3f('0x29')]);}logger[_0xcc3f('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x57af27,_0x1f899e[_0xcc3f('0x28')][_0xcc3f('0x29')]);return _0x40dcf7(_0x1f899e['error'][_0xcc3f('0x29')]);}else{logger[_0xcc3f('0x22')](_0xcc3f('0x23'),_0x57af27,_0xcc3f('0x24'));_0x40dcf7(_0x1f899e[_0xcc3f('0x2a')][_0xcc3f('0x29')]);}})[_0xcc3f('0x2b')](function(_0x3da7ed){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x57af27,_0x3da7ed);_0x4209e3(_0x3da7ed);});});}function respondWithStatusCode(_0x2b7039,_0x18862e){_0x18862e=_0x18862e||0xcc;return function(_0x298f7e){if(_0x298f7e){return _0x2b7039[_0xcc3f('0x2c')](_0x18862e);}return _0x2b7039[_0xcc3f('0x2d')](_0x18862e)[_0xcc3f('0x2e')]();};}function respondWithResult(_0x1a5a34,_0x2ed90e){_0x2ed90e=_0x2ed90e||0xc8;return function(_0x29a2d6){if(_0x29a2d6){return _0x1a5a34['status'](_0x2ed90e)[_0xcc3f('0x2f')](_0x29a2d6);}};}function respondWithFilteredResult(_0x4e6eb1,_0x3021d5){return function(_0x49c91a){if(_0x49c91a){var _0xcc8029=_0x49c91a[_0xcc3f('0x30')],_0x5b542c=_0x3021d5['offset'],_0x115456=_0x3021d5[_0xcc3f('0x31')]+_0x3021d5[_0xcc3f('0x32')],_0x42628e;if(_0x115456>=_0xcc8029){_0x115456=_0xcc8029;_0x42628e=0xc8;}else{_0x42628e=0xce;}_0x4e6eb1['status'](_0x42628e);return _0x4e6eb1[_0xcc3f('0x33')](_0xcc3f('0x34'),_0x5b542c+'-'+_0x115456+'/'+_0xcc8029)[_0xcc3f('0x2f')](_0x49c91a);}return null;};}function patchUpdates(_0xc1e97a){return function(_0x43e4b9){try{jsonpatch['apply'](_0x43e4b9,_0xc1e97a,!![]);}catch(_0x398581){return BPromise[_0xcc3f('0x35')](_0x398581);}return _0x43e4b9[_0xcc3f('0x36')]();};}function saveUpdates(_0x54e16e,_0x374629){return function(_0x4441a7){if(_0x4441a7){return _0x4441a7['update'](_0x54e16e)['then'](function(_0x30b668){return _0x30b668;});}return null;};}function removeEntity(_0x2ce792,_0x45a737){return function(_0x1ba8f5){if(_0x1ba8f5){return _0x1ba8f5[_0xcc3f('0x37')]()[_0xcc3f('0x21')](function(){_0x2ce792['status'](0xcc)[_0xcc3f('0x2e')]();});}};}function handleEntityNotFound(_0x6c6b71,_0x17c855){return function(_0x13c43a){if(!_0x13c43a){_0x6c6b71['sendStatus'](0x194);}return _0x13c43a;};}function handleError(_0x333b5c,_0x39ec3c){_0x39ec3c=_0x39ec3c||0x1f4;return function(_0x37a500){logger[_0xcc3f('0x28')](_0x37a500['stack']);if(_0x37a500[_0xcc3f('0x38')]){delete _0x37a500[_0xcc3f('0x38')];}_0x333b5c[_0xcc3f('0x2d')](_0x39ec3c)[_0xcc3f('0x39')](_0x37a500);};}exports[_0xcc3f('0x3a')]=function(_0x695365,_0x54bc08){var _0x221f78={},_0x46faf1={},_0x3abd1f={'count':0x0,'rows':[]};var _0x451781=_[_0xcc3f('0x3b')](db[_0xcc3f('0x3c')]['rawAttributes'],function(_0x5dd108){return{'name':_0x5dd108[_0xcc3f('0x3d')],'type':_0x5dd108['type'][_0xcc3f('0x3e')]};});_0x46faf1[_0xcc3f('0x3f')]=_['map'](_0x451781,_0xcc3f('0x38'));_0x46faf1[_0xcc3f('0x40')]=_['keys'](_0x695365[_0xcc3f('0x40')]);_0x46faf1[_0xcc3f('0x41')]=_[_0xcc3f('0x42')](_0x46faf1['model'],_0x46faf1[_0xcc3f('0x40')]);_0x221f78[_0xcc3f('0x43')]=_[_0xcc3f('0x42')](_0x46faf1['model'],qs[_0xcc3f('0x44')](_0x695365[_0xcc3f('0x40')][_0xcc3f('0x44')]));_0x221f78[_0xcc3f('0x43')]=_0x221f78['attributes']['length']?_0x221f78[_0xcc3f('0x43')]:_0x46faf1[_0xcc3f('0x3f')];if(!_0x695365[_0xcc3f('0x40')][_0xcc3f('0x45')]('nolimit')){_0x221f78[_0xcc3f('0x32')]=qs[_0xcc3f('0x32')](_0x695365[_0xcc3f('0x40')][_0xcc3f('0x32')]);_0x221f78[_0xcc3f('0x31')]=qs['offset'](_0x695365[_0xcc3f('0x40')][_0xcc3f('0x31')]);}_0x221f78[_0xcc3f('0x46')]=qs[_0xcc3f('0x47')](_0x695365[_0xcc3f('0x40')][_0xcc3f('0x47')]);_0x221f78['where']=qs[_0xcc3f('0x41')](_[_0xcc3f('0x48')](_0x695365[_0xcc3f('0x40')],_0x46faf1[_0xcc3f('0x41')]),_0x451781);if(_0x695365[_0xcc3f('0x40')][_0xcc3f('0x49')]){_0x221f78['where']=_['merge'](_0x221f78[_0xcc3f('0x4a')],{'$or':_['map'](_0x451781,function(_0x54208f){if(_0x54208f[_0xcc3f('0x4b')]!==_0xcc3f('0x4c')){var _0x4bd7e0={};_0x4bd7e0[_0x54208f[_0xcc3f('0x38')]]={'$like':'%'+_0x695365[_0xcc3f('0x40')][_0xcc3f('0x49')]+'%'};return _0x4bd7e0;}})});}_0x221f78=_['merge']({},_0x221f78,_0x695365[_0xcc3f('0x4d')]);var _0x1176bc={'where':_0x221f78[_0xcc3f('0x4a')]};return db[_0xcc3f('0x3c')][_0xcc3f('0x30')](_0x1176bc)[_0xcc3f('0x21')](function(_0x136610){_0x3abd1f[_0xcc3f('0x30')]=_0x136610;if(_0x695365['query'][_0xcc3f('0x4e')]){_0x221f78[_0xcc3f('0x4f')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xcc3f('0x50')](_0x221f78);})['then'](function(_0x4ed351){_0x3abd1f['rows']=_0x4ed351;return _0x3abd1f;})[_0xcc3f('0x21')](respondWithFilteredResult(_0x54bc08,_0x221f78))[_0xcc3f('0x2b')](handleError(_0x54bc08,null));};exports[_0xcc3f('0x51')]=function(_0x1ff2e5,_0x4a797f){var _0xf12e83={'raw':!![],'where':{'id':_0x1ff2e5[_0xcc3f('0x52')]['id']}},_0x272b83={};_0x272b83['model']=_[_0xcc3f('0x53')](db[_0xcc3f('0x3c')][_0xcc3f('0x54')]);_0x272b83['query']=_[_0xcc3f('0x53')](_0x1ff2e5[_0xcc3f('0x40')]);_0x272b83['filters']=_['intersection'](_0x272b83['model'],_0x272b83[_0xcc3f('0x40')]);_0xf12e83[_0xcc3f('0x43')]=_[_0xcc3f('0x42')](_0x272b83[_0xcc3f('0x3f')],qs[_0xcc3f('0x44')](_0x1ff2e5[_0xcc3f('0x40')][_0xcc3f('0x44')]));_0xf12e83[_0xcc3f('0x43')]=_0xf12e83[_0xcc3f('0x43')][_0xcc3f('0x55')]?_0xf12e83[_0xcc3f('0x43')]:_0x272b83['model'];if(_0x1ff2e5[_0xcc3f('0x40')][_0xcc3f('0x4e')]){_0xf12e83[_0xcc3f('0x4f')]=[{'all':!![]}];}_0xf12e83=_['merge']({},_0xf12e83,_0x1ff2e5[_0xcc3f('0x4d')]);return db[_0xcc3f('0x3c')][_0xcc3f('0x56')](_0xf12e83)[_0xcc3f('0x21')](handleEntityNotFound(_0x4a797f,null))[_0xcc3f('0x21')](respondWithResult(_0x4a797f,null))[_0xcc3f('0x2b')](handleError(_0x4a797f,null));};exports[_0xcc3f('0x57')]=function(_0x510f1a,_0x242751){return db[_0xcc3f('0x3c')][_0xcc3f('0x57')](_0x510f1a[_0xcc3f('0x58')],{})[_0xcc3f('0x21')](respondWithResult(_0x242751,0xc9))[_0xcc3f('0x2b')](handleError(_0x242751,null));};exports[_0xcc3f('0x59')]=function(_0xe5715f,_0x490402){if(_0xe5715f['body']['id']){delete _0xe5715f[_0xcc3f('0x58')]['id'];}return db[_0xcc3f('0x3c')]['find']({'where':{'id':_0xe5715f[_0xcc3f('0x52')]['id']}})['then'](handleEntityNotFound(_0x490402,null))['then'](saveUpdates(_0xe5715f[_0xcc3f('0x58')],null))[_0xcc3f('0x21')](respondWithResult(_0x490402,null))['catch'](handleError(_0x490402,null));};exports[_0xcc3f('0x37')]=function(_0x4fc6f6,_0x55cc11){return db[_0xcc3f('0x3c')]['find']({'where':{'id':_0x4fc6f6[_0xcc3f('0x52')]['id']}})[_0xcc3f('0x21')](handleEntityNotFound(_0x55cc11,null))[_0xcc3f('0x21')](removeEntity(_0x55cc11,null))[_0xcc3f('0x2b')](handleError(_0x55cc11,null));};exports[_0xcc3f('0x5a')]=function(_0xe4b102,_0x3f78a3){return db[_0xcc3f('0x3c')]['describe']()[_0xcc3f('0x21')](respondWithResult(_0x3f78a3,null))['catch'](handleError(_0x3f78a3,null));};var interaction_log=require(_0xcc3f('0x14'))(_0xcc3f('0x5b'));exports[_0xcc3f('0x5c')]=function(_0x125b13,_0x24307d,_0x5c7887){var _0x3f4f8d={'channel':_0xcc3f('0x5d')};if(_0x125b13[_0xcc3f('0x58')]['id']){delete _0x125b13['body']['id'];}_0x125b13['body'][_0xcc3f('0x5e')]=!![];_0x125b13[_0xcc3f('0x58')][_0xcc3f('0x5f')]=moment()[_0xcc3f('0x60')](_0xcc3f('0x61'));_0x125b13[_0xcc3f('0x58')][_0xcc3f('0x62')]=_0x125b13['body']['UserId']||_0x125b13[_0xcc3f('0x63')]['id'];return db[_0xcc3f('0x3c')][_0xcc3f('0x56')]({'where':{'id':_0x125b13[_0xcc3f('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xcc3f('0x64')}]})['then'](handleEntityNotFound(_0x24307d,null))[_0xcc3f('0x21')](saveUpdates(_0x125b13[_0xcc3f('0x58')],null))['then'](function(_0xce6594){if(_0xce6594){_0x3f4f8d[_0xcc3f('0x29')]=_0xce6594[_0xcc3f('0x65')]({'plain':!![]});return db[_0xcc3f('0x66')][_0xcc3f('0x56')]({'where':{'id':_0xce6594[_0xcc3f('0x67')]}});}return null;})[_0xcc3f('0x21')](handleEntityNotFound(_0x24307d,null))[_0xcc3f('0x21')](function(_0x1ae44e){if(_0x1ae44e){return _0x1ae44e[_0xcc3f('0x59')]({'UserId':_0x125b13[_0xcc3f('0x58')]['UserId'],'read1stAt':_[_0xcc3f('0x68')](_0x1ae44e[_0xcc3f('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x26c854){if(_0x26c854){_0x3f4f8d[_0xcc3f('0x6a')]=_0x26c854['get']({'plain':!![]});interaction_log[_0xcc3f('0x22')](_0xcc3f('0x6b'),_0x125b13[_0xcc3f('0x63')]['id'],_0x125b13[_0xcc3f('0x63')][_0xcc3f('0x38')],_0x125b13['user'][_0xcc3f('0x6c')],_0x3f4f8d[_0xcc3f('0x6a')]['id'],_0x125b13[_0xcc3f('0x58')]?JSON['stringify'](_0x125b13[_0xcc3f('0x58')]):_0xcc3f('0x6d'));return respondWithRpcPromise(_0xcc3f('0x6e'),_0xcc3f('0x6f'),_0x3f4f8d);}return null;})['then'](function(_0xcf436a){if(_0xcf436a){if(_0x125b13['body'][_0xcc3f('0x70')]){_0x3f4f8d[_0xcc3f('0x29')][_0xcc3f('0x71')]=util['format'](_0xcc3f('0x72'),_0x125b13[_0xcc3f('0x63')][_0xcc3f('0x38')]);_0x3f4f8d['message']['channel']=_0x3f4f8d[_0xcc3f('0x73')];_0x3f4f8d[_0xcc3f('0x29')]['event']=_0xcc3f('0x5c');return respondWithRpcPromise('EventManager',_0xcc3f('0x74'),{'event':_0xcc3f('0x75'),'message':_0x3f4f8d['message']},client9002)[_0xcc3f('0x21')](function(){return _0x3f4f8d;});}return _0x3f4f8d;}return null;})[_0xcc3f('0x21')](respondWithResult(_0x24307d,null))[_0xcc3f('0x2b')](handleError(_0x24307d,null));};var interaction_log=require('../../config/logger')(_0xcc3f('0x5b'));exports['reject']=function(_0x419eb9,_0x378680,_0x1d073f){var _0x604924={'agent':{},'channel':'openchannel'};if(_0x419eb9[_0xcc3f('0x58')]['id']){delete _0x419eb9['body']['id'];}_0x419eb9[_0xcc3f('0x58')][_0xcc3f('0x62')]=_0x419eb9[_0xcc3f('0x58')]['UserId']||_0x419eb9[_0xcc3f('0x63')]['id'];_0x604924[_0xcc3f('0x76')]['id']=_0x419eb9[_0xcc3f('0x58')]['UserId'];return db['OpenchannelMessage'][_0xcc3f('0x56')]({'where':{'id':_0x419eb9[_0xcc3f('0x52')]['id'],'UserId':null}})[_0xcc3f('0x21')](handleEntityNotFound(_0x378680,null))['then'](function(_0xbbf5ab){if(_0xbbf5ab){_0x604924[_0xcc3f('0x29')]=_0xbbf5ab[_0xcc3f('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0xcc3f('0x56')]({'where':{'id':_0xbbf5ab['OpenchannelInteractionId']}});}return null;})[_0xcc3f('0x21')](handleEntityNotFound(_0x378680,null))[_0xcc3f('0x21')](function(_0x7452ea){if(_0x7452ea){_0x604924['interaction']=_0x7452ea['get']({'plain':!![]});interaction_log['info'](_0xcc3f('0x77'),_0x419eb9[_0xcc3f('0x63')]['id'],_0x419eb9[_0xcc3f('0x63')]['name'],_0x419eb9[_0xcc3f('0x63')][_0xcc3f('0x6c')],_0x604924[_0xcc3f('0x6a')]['id'],_0x419eb9[_0xcc3f('0x58')]?JSON[_0xcc3f('0x27')](_0x419eb9[_0xcc3f('0x58')]):_0xcc3f('0x6d'));return respondWithRpcPromise(_0xcc3f('0x78'),_0xcc3f('0x79'),_0x604924);}return null;})['then'](function(_0x3783a1){if(_0x3783a1){_0x3783a1['message'][_0xcc3f('0x71')]=util['format']('SIP/%s',_0x419eb9[_0xcc3f('0x63')][_0xcc3f('0x38')]);_0x3783a1[_0xcc3f('0x29')][_0xcc3f('0x73')]=_0x604924['channel'];_0x3783a1[_0xcc3f('0x29')][_0xcc3f('0x7a')]=_0xcc3f('0x35');respondWithRpcPromise(_0xcc3f('0x74'),_0xcc3f('0x74'),{'event':_0xcc3f('0x7b'),'message':_0x3783a1['message']},client9002);return _0x604924;}return null;})['then'](respondWithResult(_0x378680,null))[_0xcc3f('0x2b')](handleError(_0x378680,null));}; \ No newline at end of file +var _0x4ae2=['EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','jayson/promise','http','client','test','Sequelize','ValidationError','request','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','update','then','destroy','stack','name','send','OpenchannelMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','include','rows','show','includeAll','find','body','params','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','event'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4ae2,0xff));var _0x24ae=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x4ae2[_0x28aea5];return _0x6a55f9;};'use strict';var pdf=require(_0x24ae('0x0'));var emlformat=require(_0x24ae('0x1'));var rimraf=require(_0x24ae('0x2'));var zipdir=require(_0x24ae('0x3'));var jsonpatch=require(_0x24ae('0x4'));var rp=require(_0x24ae('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x24ae('0x6'));var util=require(_0x24ae('0x7'));var path=require(_0x24ae('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x24ae('0x9'));var fs=require('fs');var _=require(_0x24ae('0xa'));var squel=require(_0x24ae('0xb'));var crypto=require(_0x24ae('0xc'));var jsforce=require(_0x24ae('0xd'));var deskjs=require(_0x24ae('0xe'));var toCsv=require(_0x24ae('0xf'));var querystring=require('querystring');var Papa=require(_0x24ae('0x10'));var Redis=require(_0x24ae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x24ae('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24ae('0x13'));var logger=require('../../config/logger')(_0x24ae('0x14'));var utils=require(_0x24ae('0x15'));var config=require(_0x24ae('0x16'));var db=require(_0x24ae('0x17'))['db'];config[_0x24ae('0x18')]=_[_0x24ae('0x19')](config[_0x24ae('0x18')],{'host':_0x24ae('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x24ae('0x1b'))['register'](socket);var jayson=require(_0x24ae('0x1c'));var client=jayson['client'][_0x24ae('0x1d')]({'port':0x232c});var client9002=jayson[_0x24ae('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x3462dc,_0x1ed6a2,_0x46e357){if(_0x46e357){var _0xe33bc9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe33bc9[_0x24ae('0x1f')](_0x1ed6a2)){return _0x3462dc;}else{throw new db[(_0x24ae('0x20'))][(_0x24ae('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3462dc;}}function respondWithRpcPromise(_0x384506,_0x1b9705,_0x28384e,_0x498b00){return new BPromise(function(_0x44fda3,_0x138603){var _0x2bf921=_0x498b00||client;return _0x2bf921[_0x24ae('0x22')](_0x384506,_0x28384e)['then'](function(_0x356f59){logger[_0x24ae('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b9705,'request\x20sent');logger[_0x24ae('0x24')](_0x24ae('0x25'),_0x1b9705,_0x24ae('0x26'),JSON[_0x24ae('0x27')](_0x356f59));if(_0x356f59['error']){if(_0x356f59[_0x24ae('0x28')][_0x24ae('0x29')]===0x1f4){logger[_0x24ae('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b9705,_0x356f59[_0x24ae('0x28')]['message']);return _0x138603(_0x356f59[_0x24ae('0x28')][_0x24ae('0x2a')]);}logger[_0x24ae('0x28')](_0x24ae('0x2b'),_0x1b9705,_0x356f59[_0x24ae('0x28')][_0x24ae('0x2a')]);return _0x44fda3(_0x356f59[_0x24ae('0x28')][_0x24ae('0x2a')]);}else{logger[_0x24ae('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b9705,_0x24ae('0x26'));_0x44fda3(_0x356f59[_0x24ae('0x2c')][_0x24ae('0x2a')]);}})[_0x24ae('0x2d')](function(_0x4c1002){logger[_0x24ae('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b9705,_0x4c1002);_0x138603(_0x4c1002);});});}function respondWithStatusCode(_0x273224,_0x3666a2){_0x3666a2=_0x3666a2||0xcc;return function(_0x1912c6){if(_0x1912c6){return _0x273224[_0x24ae('0x2e')](_0x3666a2);}return _0x273224[_0x24ae('0x2f')](_0x3666a2)[_0x24ae('0x30')]();};}function respondWithResult(_0x20fb21,_0xe11315){_0xe11315=_0xe11315||0xc8;return function(_0x55a429){if(_0x55a429){return _0x20fb21['status'](_0xe11315)['json'](_0x55a429);}};}function respondWithFilteredResult(_0x4ff81f,_0x24a09a){return function(_0x352e0e){if(_0x352e0e){var _0x34cf84=_0x352e0e[_0x24ae('0x31')],_0x150faa=_0x24a09a[_0x24ae('0x32')],_0x28b061=_0x24a09a[_0x24ae('0x32')]+_0x24a09a[_0x24ae('0x33')],_0x3f5961;if(_0x28b061>=_0x34cf84){_0x28b061=_0x34cf84;_0x3f5961=0xc8;}else{_0x3f5961=0xce;}_0x4ff81f['status'](_0x3f5961);return _0x4ff81f['set'](_0x24ae('0x34'),_0x150faa+'-'+_0x28b061+'/'+_0x34cf84)[_0x24ae('0x35')](_0x352e0e);}return null;};}function patchUpdates(_0x1e0a95){return function(_0x3e6cdb){try{jsonpatch['apply'](_0x3e6cdb,_0x1e0a95,!![]);}catch(_0x4e1cb9){return BPromise[_0x24ae('0x36')](_0x4e1cb9);}return _0x3e6cdb['save']();};}function saveUpdates(_0xc66706,_0x266df8){return function(_0xcff4e5){if(_0xcff4e5){return _0xcff4e5[_0x24ae('0x37')](_0xc66706)[_0x24ae('0x38')](function(_0x4185b0){return _0x4185b0;});}return null;};}function removeEntity(_0x4862a5,_0x23a5de){return function(_0x38694e){if(_0x38694e){return _0x38694e[_0x24ae('0x39')]()['then'](function(){_0x4862a5[_0x24ae('0x2f')](0xcc)[_0x24ae('0x30')]();});}};}function handleEntityNotFound(_0x17163d,_0x363be8){return function(_0x346960){if(!_0x346960){_0x17163d[_0x24ae('0x2e')](0x194);}return _0x346960;};}function handleError(_0x3051f9,_0x45caff){_0x45caff=_0x45caff||0x1f4;return function(_0x41b5f2){logger[_0x24ae('0x28')](_0x41b5f2[_0x24ae('0x3a')]);if(_0x41b5f2[_0x24ae('0x3b')]){delete _0x41b5f2[_0x24ae('0x3b')];}_0x3051f9['status'](_0x45caff)[_0x24ae('0x3c')](_0x41b5f2);};}exports['index']=function(_0x28feb7,_0x302662){var _0x361036={},_0x38cb26={},_0x2822b1={'count':0x0,'rows':[]};var _0x374ce1=_['map'](db[_0x24ae('0x3d')][_0x24ae('0x3e')],function(_0xf3141c){return{'name':_0xf3141c[_0x24ae('0x3f')],'type':_0xf3141c['type'][_0x24ae('0x40')]};});_0x38cb26[_0x24ae('0x41')]=_[_0x24ae('0x42')](_0x374ce1,'name');_0x38cb26[_0x24ae('0x43')]=_[_0x24ae('0x44')](_0x28feb7[_0x24ae('0x43')]);_0x38cb26[_0x24ae('0x45')]=_[_0x24ae('0x46')](_0x38cb26[_0x24ae('0x41')],_0x38cb26[_0x24ae('0x43')]);_0x361036[_0x24ae('0x47')]=_[_0x24ae('0x46')](_0x38cb26['model'],qs[_0x24ae('0x48')](_0x28feb7[_0x24ae('0x43')][_0x24ae('0x48')]));_0x361036[_0x24ae('0x47')]=_0x361036[_0x24ae('0x47')][_0x24ae('0x49')]?_0x361036[_0x24ae('0x47')]:_0x38cb26[_0x24ae('0x41')];if(!_0x28feb7[_0x24ae('0x43')]['hasOwnProperty'](_0x24ae('0x4a'))){_0x361036[_0x24ae('0x33')]=qs[_0x24ae('0x33')](_0x28feb7['query'][_0x24ae('0x33')]);_0x361036[_0x24ae('0x32')]=qs[_0x24ae('0x32')](_0x28feb7['query'][_0x24ae('0x32')]);}_0x361036[_0x24ae('0x4b')]=qs[_0x24ae('0x4c')](_0x28feb7[_0x24ae('0x43')][_0x24ae('0x4c')]);_0x361036[_0x24ae('0x4d')]=qs[_0x24ae('0x45')](_[_0x24ae('0x4e')](_0x28feb7[_0x24ae('0x43')],_0x38cb26[_0x24ae('0x45')]),_0x374ce1);if(_0x28feb7[_0x24ae('0x43')]['filter']){_0x361036[_0x24ae('0x4d')]=_[_0x24ae('0x4f')](_0x361036[_0x24ae('0x4d')],{'$or':_[_0x24ae('0x42')](_0x374ce1,function(_0x1dd1f3){if(_0x1dd1f3[_0x24ae('0x50')]!==_0x24ae('0x51')){var _0x29ccba={};_0x29ccba[_0x1dd1f3['name']]={'$like':'%'+_0x28feb7['query']['filter']+'%'};return _0x29ccba;}})});}_0x361036=_[_0x24ae('0x4f')]({},_0x361036,_0x28feb7[_0x24ae('0x52')]);var _0x237b70={'where':_0x361036[_0x24ae('0x4d')]};return db[_0x24ae('0x3d')][_0x24ae('0x31')](_0x237b70)[_0x24ae('0x38')](function(_0x584d9d){_0x2822b1[_0x24ae('0x31')]=_0x584d9d;if(_0x28feb7[_0x24ae('0x43')]['includeAll']){_0x361036[_0x24ae('0x53')]=[{'all':!![]}];}return db[_0x24ae('0x3d')]['findAll'](_0x361036);})[_0x24ae('0x38')](function(_0x432060){_0x2822b1[_0x24ae('0x54')]=_0x432060;return _0x2822b1;})[_0x24ae('0x38')](respondWithFilteredResult(_0x302662,_0x361036))[_0x24ae('0x2d')](handleError(_0x302662,null));};exports[_0x24ae('0x55')]=function(_0x5bb4c8,_0x17225b){var _0x128cb0={'raw':!![],'where':{'id':_0x5bb4c8['params']['id']}},_0xc80673={};_0xc80673['model']=_[_0x24ae('0x44')](db[_0x24ae('0x3d')]['rawAttributes']);_0xc80673['query']=_[_0x24ae('0x44')](_0x5bb4c8[_0x24ae('0x43')]);_0xc80673[_0x24ae('0x45')]=_['intersection'](_0xc80673[_0x24ae('0x41')],_0xc80673[_0x24ae('0x43')]);_0x128cb0[_0x24ae('0x47')]=_[_0x24ae('0x46')](_0xc80673[_0x24ae('0x41')],qs[_0x24ae('0x48')](_0x5bb4c8['query'][_0x24ae('0x48')]));_0x128cb0[_0x24ae('0x47')]=_0x128cb0[_0x24ae('0x47')]['length']?_0x128cb0[_0x24ae('0x47')]:_0xc80673['model'];if(_0x5bb4c8['query'][_0x24ae('0x56')]){_0x128cb0[_0x24ae('0x53')]=[{'all':!![]}];}_0x128cb0=_[_0x24ae('0x4f')]({},_0x128cb0,_0x5bb4c8['options']);return db[_0x24ae('0x3d')][_0x24ae('0x57')](_0x128cb0)[_0x24ae('0x38')](handleEntityNotFound(_0x17225b,null))[_0x24ae('0x38')](respondWithResult(_0x17225b,null))[_0x24ae('0x2d')](handleError(_0x17225b,null));};exports['create']=function(_0x5afd66,_0x12de37){return db['OpenchannelMessage']['create'](_0x5afd66['body'],{})[_0x24ae('0x38')](respondWithResult(_0x12de37,0xc9))[_0x24ae('0x2d')](handleError(_0x12de37,null));};exports[_0x24ae('0x37')]=function(_0x18226a,_0x44bfe0){if(_0x18226a['body']['id']){delete _0x18226a[_0x24ae('0x58')]['id'];}return db[_0x24ae('0x3d')]['find']({'where':{'id':_0x18226a[_0x24ae('0x59')]['id']}})['then'](handleEntityNotFound(_0x44bfe0,null))[_0x24ae('0x38')](saveUpdates(_0x18226a['body'],null))[_0x24ae('0x38')](respondWithResult(_0x44bfe0,null))[_0x24ae('0x2d')](handleError(_0x44bfe0,null));};exports[_0x24ae('0x39')]=function(_0x43e2ae,_0x1f763e){return db['OpenchannelMessage']['find']({'where':{'id':_0x43e2ae[_0x24ae('0x59')]['id']}})[_0x24ae('0x38')](handleEntityNotFound(_0x1f763e,null))[_0x24ae('0x38')](removeEntity(_0x1f763e,null))[_0x24ae('0x2d')](handleError(_0x1f763e,null));};exports['describe']=function(_0xfe1040,_0x4e4e97){return db[_0x24ae('0x3d')][_0x24ae('0x5a')]()[_0x24ae('0x38')](respondWithResult(_0x4e4e97,null))['catch'](handleError(_0x4e4e97,null));};var interaction_log=require(_0x24ae('0x5b'))(_0x24ae('0x5c'));exports[_0x24ae('0x5d')]=function(_0x114795,_0x12c091,_0xe54a4f){var _0x11294e={'channel':_0x24ae('0x5e')};if(_0x114795[_0x24ae('0x58')]['id']){delete _0x114795[_0x24ae('0x58')]['id'];}_0x114795['body'][_0x24ae('0x5f')]=!![];_0x114795[_0x24ae('0x58')][_0x24ae('0x60')]=moment()[_0x24ae('0x61')](_0x24ae('0x62'));_0x114795['body'][_0x24ae('0x63')]=_0x114795[_0x24ae('0x58')][_0x24ae('0x63')]||_0x114795[_0x24ae('0x64')]['id'];return db[_0x24ae('0x3d')][_0x24ae('0x57')]({'where':{'id':_0x114795[_0x24ae('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x24ae('0x65')}]})[_0x24ae('0x38')](handleEntityNotFound(_0x12c091,null))[_0x24ae('0x38')](saveUpdates(_0x114795['body'],null))[_0x24ae('0x38')](function(_0x2730a8){if(_0x2730a8){_0x11294e['message']=_0x2730a8[_0x24ae('0x66')]({'plain':!![]});return db[_0x24ae('0x67')][_0x24ae('0x57')]({'where':{'id':_0x2730a8[_0x24ae('0x68')]}});}return null;})[_0x24ae('0x38')](handleEntityNotFound(_0x12c091,null))[_0x24ae('0x38')](function(_0x31d0a){if(_0x31d0a){return _0x31d0a[_0x24ae('0x37')]({'UserId':_0x114795[_0x24ae('0x58')][_0x24ae('0x63')],'read1stAt':_[_0x24ae('0x69')](_0x31d0a[_0x24ae('0x6a')])?moment()[_0x24ae('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3027cd){if(_0x3027cd){_0x11294e[_0x24ae('0x6b')]=_0x3027cd[_0x24ae('0x66')]({'plain':!![]});interaction_log['info'](_0x24ae('0x6c'),_0x114795[_0x24ae('0x64')]['id'],_0x114795[_0x24ae('0x64')][_0x24ae('0x3b')],_0x114795[_0x24ae('0x64')][_0x24ae('0x6d')],_0x11294e[_0x24ae('0x6b')]['id'],_0x114795['body']?JSON[_0x24ae('0x27')](_0x114795[_0x24ae('0x58')]):_0x24ae('0x6e'));return respondWithRpcPromise(_0x24ae('0x6f'),_0x24ae('0x70'),_0x11294e);}return null;})[_0x24ae('0x38')](function(_0x17aca4){if(_0x17aca4){if(_0x114795[_0x24ae('0x58')][_0x24ae('0x71')]){_0x11294e[_0x24ae('0x2a')][_0x24ae('0x72')]=util[_0x24ae('0x61')](_0x24ae('0x73'),_0x114795[_0x24ae('0x64')][_0x24ae('0x3b')]);_0x11294e['message']['channel']=_0x11294e['channel'];_0x11294e[_0x24ae('0x2a')][_0x24ae('0x74')]=_0x24ae('0x5d');return respondWithRpcPromise(_0x24ae('0x75'),_0x24ae('0x75'),{'event':_0x24ae('0x76'),'message':_0x11294e[_0x24ae('0x2a')]},client9002)[_0x24ae('0x38')](function(){return _0x11294e;});}return _0x11294e;}return null;})[_0x24ae('0x38')](respondWithResult(_0x12c091,null))[_0x24ae('0x2d')](handleError(_0x12c091,null));};var interaction_log=require(_0x24ae('0x5b'))('openchannel-interactions');exports[_0x24ae('0x36')]=function(_0x53cdfb,_0x3c3bc7,_0x2d5c87){var _0xa33ec3={'agent':{},'channel':'openchannel'};if(_0x53cdfb[_0x24ae('0x58')]['id']){delete _0x53cdfb['body']['id'];}_0x53cdfb[_0x24ae('0x58')]['UserId']=_0x53cdfb[_0x24ae('0x58')][_0x24ae('0x63')]||_0x53cdfb[_0x24ae('0x64')]['id'];_0xa33ec3[_0x24ae('0x77')]['id']=_0x53cdfb[_0x24ae('0x58')][_0x24ae('0x63')];return db['OpenchannelMessage']['find']({'where':{'id':_0x53cdfb['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c3bc7,null))[_0x24ae('0x38')](function(_0x3e6605){if(_0x3e6605){_0xa33ec3['message']=_0x3e6605[_0x24ae('0x66')]({'plain':!![]});return db[_0x24ae('0x67')][_0x24ae('0x57')]({'where':{'id':_0x3e6605[_0x24ae('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x3c3bc7,null))['then'](function(_0x1c92a2){if(_0x1c92a2){_0xa33ec3[_0x24ae('0x6b')]=_0x1c92a2[_0x24ae('0x66')]({'plain':!![]});interaction_log['info'](_0x24ae('0x78'),_0x53cdfb[_0x24ae('0x64')]['id'],_0x53cdfb[_0x24ae('0x64')][_0x24ae('0x3b')],_0x53cdfb[_0x24ae('0x64')][_0x24ae('0x6d')],_0xa33ec3[_0x24ae('0x6b')]['id'],_0x53cdfb[_0x24ae('0x58')]?JSON[_0x24ae('0x27')](_0x53cdfb[_0x24ae('0x58')]):'null');return respondWithRpcPromise(_0x24ae('0x79'),_0x24ae('0x7a'),_0xa33ec3);}return null;})['then'](function(_0x4ce59e){if(_0x4ce59e){_0x4ce59e[_0x24ae('0x2a')][_0x24ae('0x72')]=util['format'](_0x24ae('0x73'),_0x53cdfb[_0x24ae('0x64')][_0x24ae('0x3b')]);_0x4ce59e[_0x24ae('0x2a')][_0x24ae('0x7b')]=_0xa33ec3[_0x24ae('0x7b')];_0x4ce59e[_0x24ae('0x2a')]['event']=_0x24ae('0x36');respondWithRpcPromise(_0x24ae('0x75'),'EventManager',{'event':'rejectmessage','message':_0x4ce59e[_0x24ae('0x2a')]},client9002);return _0xa33ec3;}return null;})[_0x24ae('0x38')](respondWithResult(_0x3c3bc7,null))['catch'](handleError(_0x3c3bc7,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9e60911..11225c1 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 _0x19bb=['../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x19bb,0x1d8));var _0xb19b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x19bb[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xb19b('0x0'))['db'][_0xb19b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb19b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb19b('0x3'),'afterDestroy':_0xb19b('0x4')};function emitEvent(_0x57cc6a){return function(_0x46022e,_0x4cb517,_0x2834ff){OpenchannelMessageEvents[_0xb19b('0x5')](_0x57cc6a+':'+_0x46022e['id'],_0x46022e);OpenchannelMessageEvents['emit'](_0x57cc6a,_0x46022e);_0x2834ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xb19b('0x6')](e,emitEvent(event));}}module[_0xb19b('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xfc76=['hasOwnProperty','exports','events','OpenchannelMessage','setMaxListeners','save','remove','emit'];(function(_0x313883,_0x291b07){var _0x6544e6=function(_0x19bb38){while(--_0x19bb38){_0x313883['push'](_0x313883['shift']());}};_0x6544e6(++_0x291b07);}(_0xfc76,0x112));var _0x6fc7=function(_0x3cc977,_0x22a445){_0x3cc977=_0x3cc977-0x0;var _0x21a17f=_0xfc76[_0x3cc977];return _0x21a17f;};'use strict';var EventEmitter=require(_0x6fc7('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x6fc7('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6fc7('0x2')](0x0);var events={'afterCreate':_0x6fc7('0x3'),'afterUpdate':'update','afterDestroy':_0x6fc7('0x4')};function emitEvent(_0x195590){return function(_0x34fdda,_0xe9a03d,_0x371d85){OpenchannelMessageEvents[_0x6fc7('0x5')](_0x195590+':'+_0x34fdda['id'],_0x34fdda);OpenchannelMessageEvents[_0x6fc7('0x5')](_0x195590,_0x34fdda);_0x371d85(null);};}for(var e in events){if(events[_0x6fc7('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x6fc7('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 53d1244..73412cd 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 _0x4986=['method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT','models','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','update','createdAt','direction','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Interactions'];(function(_0x32df3f,_0x32976f){var _0x4b9d2f=function(_0x2e38ff){while(--_0x2e38ff){_0x32df3f['push'](_0x32df3f['shift']());}};_0x4b9d2f(++_0x32976f);}(_0x4986,0x6e));var _0x6498=function(_0x10a38c,_0x12a90){_0x10a38c=_0x10a38c-0x0;var _0x4cea26=_0x4986[_0x10a38c];return _0x4cea26;};'use strict';var _=require(_0x6498('0x0'));var util=require(_0x6498('0x1'));var logger=require(_0x6498('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6498('0x3'));var rp=require(_0x6498('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6498('0x5'));var config=require(_0x6498('0x6'));var attributes=require(_0x6498('0x7'));module[_0x6498('0x8')]=function(_0x117a31,_0x8d1853){return _0x117a31[_0x6498('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x6498('0xa'),'fields':[_0x6498('0xb')],'type':_0x6498('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x465333,_0x1c590e,_0x5f14e4){var _0x3edea9=_0x117a31[_0x6498('0xd')];var _0x3fe456=_0x465333['get']({'plain':!![]});if(_0x3fe456['direction'][_0x6498('0xe')]()==='in'||_0x3fe456['direction'][_0x6498('0xe')]()===_0x6498('0xf')&&!_0x3fe456[_0x6498('0x10')]&&!_[_0x6498('0x11')](_0x3fe456[_0x6498('0x12')])){_0x3edea9[_0x6498('0x13')][_0x6498('0x14')]({'where':{'id':_0x3fe456['OpenchannelInteractionId']}})['then'](function(_0x4769ab){if(_0x4769ab){_0x4769ab[_0x6498('0x15')]({'lastMsgAt':_0x3fe456[_0x6498('0x16')],'lastMsgDirection':_0x3fe456[_0x6498('0x17')][_0x6498('0xe')]()});}})['catch'](function(_0x318b75){console[_0x6498('0x18')](_0x318b75);});}if(_0x3fe456[_0x6498('0x17')]===_0x6498('0xf')&&!_0x3fe456[_0x6498('0x10')]){var _0x1b4083;_0x3edea9[_0x6498('0x19')]['describe']()[_0x6498('0x1a')](function(_0x8b41fe){return _0x3edea9[_0x6498('0x1b')][_0x6498('0x1c')]({'where':{'id':_0x3fe456[_0x6498('0x1d')]},'include':[{'model':_0x3edea9['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x3fe456[_0x6498('0x1e')]},'limit':0x1,'include':[{'model':_0x3edea9[_0x6498('0x19')],'as':_0x6498('0x1f'),'attributes':_[_0x6498('0x20')](_0x8b41fe)}]}]});})[_0x6498('0x1a')](function(_0x46c830){_0x1b4083=_0x46c830[_0x6498('0x21')]({'plain':!![]});if(_0x1b4083&&_0x1b4083[_0x6498('0x22')]){logger[_0x6498('0x23')](_0x6498('0x24'),_0x6498('0x25'),util[_0x6498('0x26')](_0x6498('0x27'),_0x3fe456['id'],_0x1b4083[_0x6498('0x22')]));if(_0x1b4083['Interactions']&&_0x1b4083['Interactions'][_0x6498('0x28')]){_0x3fe456['Interaction']=_[_0x6498('0x29')](_0x1b4083[_0x6498('0x2a')][0x0],_0x6498('0x1f'));_0x3fe456[_0x6498('0x1f')]=_0x1b4083['Interactions'][0x0]['Contact'];}var _0x1c590e={'method':'POST','uri':encodeURI(_0x1b4083[_0x6498('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1c590e[_0x6498('0x2b')]){case _0x6498('0x2c'):_0x1c590e['qs']=_0x3fe456;break;case _0x6498('0x2d'):_0x1c590e[_0x6498('0xb')]=_0x3fe456;break;}return rp(_0x1c590e)[_0x6498('0x1a')](function(_0x1bb97c){logger[_0x6498('0x23')](_0x6498('0x24'),_0x6498('0x25'),util[_0x6498('0x26')](_0x6498('0x2e'),_0x3fe456['id'],_0x1b4083[_0x6498('0x22')]));if(_0x1bb97c['body'][_0x6498('0x2f')]&&_0x1bb97c[_0x6498('0xb')]['threadId']!=_0x3fe456['Interaction']['threadId']){return _0x3edea9['OpenchannelInteraction'][_0x6498('0x15')]({'threadId':_0x1bb97c[_0x6498('0xb')][_0x6498('0x2f')]},{'logging':!![],'where':{'id':_0x3fe456[_0x6498('0x30')]['id']}});}else{return;}})['then'](function(){return _0x465333[_0x6498('0x15')]({'read':!![]});})['catch'](function(_0x4ef1bf){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x6498('0x25'),util[_0x6498('0x31')](_0x4ef1bf,{'showHidden':![],'depth':null}));_0x5f14e4();});}else{_0x5f14e4();}})['finally'](function(){_0x5f14e4();});}else{_0x5f14e4();}}},'charset':_0x6498('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5089=['inspect','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','error','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch'];(function(_0x2cb3cd,_0x290f72){var _0x1b63cf=function(_0x39467a){while(--_0x39467a){_0x2cb3cd['push'](_0x2cb3cd['shift']());}};_0x1b63cf(++_0x290f72);}(_0x5089,0x1bb));var _0x9508=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x5089[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var logger=require('../../config/logger')(_0x9508('0x2'));var moment=require(_0x9508('0x3'));var BPromise=require(_0x9508('0x4'));var rp=require(_0x9508('0x5'));var fs=require('fs');var path=require(_0x9508('0x6'));var rimraf=require('rimraf');var config=require(_0x9508('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x9508('0x8')]=function(_0x4538dd,_0x257318){return _0x4538dd['define'](_0x9508('0x9'),attributes,{'tableName':_0x9508('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x9508('0xb')],'type':_0x9508('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f6720,_0x342ddd,_0x5c9dc9){var _0x424e6a=_0x4538dd[_0x9508('0xd')];var _0x852feb=_0x4f6720[_0x9508('0xe')]({'plain':!![]});if(_0x852feb[_0x9508('0xf')][_0x9508('0x10')]()==='in'||_0x852feb['direction'][_0x9508('0x10')]()==='out'&&!_0x852feb[_0x9508('0x11')]&&!_[_0x9508('0x12')](_0x852feb['UserId'])){_0x424e6a[_0x9508('0x13')][_0x9508('0x14')]({'where':{'id':_0x852feb[_0x9508('0x15')]}})[_0x9508('0x16')](function(_0x51ef92){if(_0x51ef92){_0x51ef92[_0x9508('0x17')]({'lastMsgAt':_0x852feb[_0x9508('0x18')],'lastMsgDirection':_0x852feb['direction'][_0x9508('0x10')]()});}})['catch'](function(_0x25d4d6){console[_0x9508('0x19')](_0x25d4d6);});}if(_0x852feb[_0x9508('0xf')]===_0x9508('0x1a')&&!_0x852feb[_0x9508('0x11')]){var _0x343802;_0x424e6a[_0x9508('0x1b')][_0x9508('0x1c')]()['then'](function(_0x22ba9c){return _0x424e6a[_0x9508('0x1d')][_0x9508('0x1e')]({'where':{'id':_0x852feb[_0x9508('0x1f')]},'include':[{'model':_0x424e6a[_0x9508('0x13')],'as':_0x9508('0x20'),'where':{'id':_0x852feb['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x424e6a['CmContact'],'as':_0x9508('0x21'),'attributes':_['keys'](_0x22ba9c)}]}]});})[_0x9508('0x16')](function(_0x4e9e9f){_0x343802=_0x4e9e9f[_0x9508('0xe')]({'plain':!![]});if(_0x343802&&_0x343802[_0x9508('0x22')]){logger[_0x9508('0x23')](_0x9508('0x24'),_0x9508('0x25'),util[_0x9508('0x26')](_0x9508('0x27'),_0x852feb['id'],_0x343802['replyUri']));if(_0x343802['Interactions']&&_0x343802[_0x9508('0x20')][_0x9508('0x28')]){_0x852feb[_0x9508('0x29')]=_[_0x9508('0x2a')](_0x343802[_0x9508('0x20')][0x0],_0x9508('0x21'));_0x852feb['Contact']=_0x343802['Interactions'][0x0][_0x9508('0x21')];}var _0x342ddd={'method':'POST','uri':encodeURI(_0x343802[_0x9508('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x342ddd['method']){case'GET':_0x342ddd['qs']=_0x852feb;break;case _0x9508('0x2b'):_0x342ddd[_0x9508('0xb')]=_0x852feb;break;}return rp(_0x342ddd)['then'](function(_0x49246b){logger[_0x9508('0x23')](_0x9508('0x24'),_0x9508('0x25'),util[_0x9508('0x26')](_0x9508('0x2c'),_0x852feb['id'],_0x343802[_0x9508('0x22')]));if(_0x49246b[_0x9508('0xb')][_0x9508('0x2d')]&&_0x49246b[_0x9508('0xb')][_0x9508('0x2d')]!=_0x852feb['Interaction'][_0x9508('0x2d')]){return _0x424e6a[_0x9508('0x13')][_0x9508('0x17')]({'threadId':_0x49246b['body'][_0x9508('0x2d')]},{'logging':!![],'where':{'id':_0x852feb[_0x9508('0x29')]['id']}});}else{return;}})['then'](function(){return _0x4f6720[_0x9508('0x17')]({'read':!![]});})[_0x9508('0x2e')](function(_0x5cbee3){logger[_0x9508('0x19')](_0x9508('0x24'),_0x9508('0x25'),util[_0x9508('0x2f')](_0x5cbee3,{'showHidden':![],'depth':null}));_0x5c9dc9();});}else{_0x5c9dc9();}})['finally'](function(){_0x5c9dc9();});}else{_0x5c9dc9();}}},'charset':'utf8mb4','collate':_0x9508('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1e002f9..0508933 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 _0x09d2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelMessage.socket','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','catch','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x09d2,0x1d2));var _0x209d=function(_0x756a4b,_0x52d392){_0x756a4b=_0x756a4b-0x0;var _0x3a272d=_0x09d2[_0x756a4b];return _0x3a272d;};'use strict';var _=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var moment=require(_0x209d('0x2'));var BPromise=require(_0x209d('0x3'));var rs=require(_0x209d('0x4'));var fs=require('fs');var Redis=require(_0x209d('0x5'));var db=require(_0x209d('0x6'))['db'];var utils=require(_0x209d('0x7'));var logger=require(_0x209d('0x8'))(_0x209d('0x9'));var config=require('../../config/environment');var jayson=require(_0x209d('0xa'));var client=jayson[_0x209d('0xb')][_0x209d('0xc')]({'port':0x232a});config[_0x209d('0xd')]=_[_0x209d('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x209d('0xf'))(new Redis(config[_0x209d('0xd')]));require(_0x209d('0x10'))['register'](socket);function respondWithRpcPromise(_0x6b5375,_0x580742,_0x33caba){return new BPromise(function(_0x446eb0,_0x3ee1eb){return client[_0x209d('0x11')](_0x6b5375,_0x33caba)[_0x209d('0x12')](function(_0x30052a){logger[_0x209d('0x13')](_0x209d('0x14'),_0x580742,_0x209d('0x15'));logger[_0x209d('0x16')](_0x209d('0x17'),_0x580742,_0x209d('0x15'),JSON['stringify'](_0x30052a));if(_0x30052a[_0x209d('0x18')]){if(_0x30052a[_0x209d('0x18')][_0x209d('0x19')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x580742,_0x30052a[_0x209d('0x18')]['message']);return _0x3ee1eb(_0x30052a['error'][_0x209d('0x1a')]);}logger[_0x209d('0x18')](_0x209d('0x14'),_0x580742,_0x30052a['error'][_0x209d('0x1a')]);return _0x446eb0(_0x30052a[_0x209d('0x18')][_0x209d('0x1a')]);}else{logger[_0x209d('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x580742,_0x209d('0x15'));_0x446eb0(_0x30052a[_0x209d('0x1b')][_0x209d('0x1a')]);}})['catch'](function(_0x47daf8){logger[_0x209d('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x580742,_0x47daf8);_0x3ee1eb(_0x47daf8);});});}exports[_0x209d('0x1c')]=function(_0x3c139e){var _0xa72210=this;return new Promise(function(_0x1eec9f,_0x3d8854){return db[_0x209d('0x1d')][_0x209d('0x1e')](_0x3c139e[_0x209d('0x1f')],{'raw':_0x3c139e[_0x209d('0x20')]?_0x3c139e[_0x209d('0x20')][_0x209d('0x21')]===undefined?!![]:![]:!![]})[_0x209d('0x12')](function(_0x61a720){logger[_0x209d('0x13')](_0x209d('0x1c'),_0x3c139e);logger[_0x209d('0x16')](_0x209d('0x1c'),_0x3c139e,JSON[_0x209d('0x22')](_0x61a720));_0x1eec9f(_0x61a720);})[_0x209d('0x23')](function(_0x183767){logger[_0x209d('0x18')]('CreateOpenchannelMessage',_0x183767[_0x209d('0x1a')],_0x3c139e);_0x3d8854(_0xa72210[_0x209d('0x18')](0x1f4,_0x183767['message']));});});}; \ No newline at end of file +var _0xcefd=['CreateOpenchannelMessage','OpenchannelMessage','body','options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','request','info','OpenchannelMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch'];(function(_0x450958,_0x2c6887){var _0x1a974f=function(_0xcf6fe1){while(--_0xcf6fe1){_0x450958['push'](_0x450958['shift']());}};_0x1a974f(++_0x2c6887);}(_0xcefd,0x126));var _0xdcef=function(_0x5038e3,_0x29855b){_0x5038e3=_0x5038e3-0x0;var _0x593c8d=_0xcefd[_0x5038e3];return _0x593c8d;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var moment=require(_0xdcef('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcef('0x6'))(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdcef('0x9')][_0xdcef('0xa')]({'port':0x232a});config[_0xdcef('0xb')]=_[_0xdcef('0xc')](config['redis'],{'host':_0xdcef('0xd'),'port':0x18eb});var socket=require(_0xdcef('0xe'))(new Redis(config[_0xdcef('0xb')]));require(_0xdcef('0xf'))['register'](socket);function respondWithRpcPromise(_0x1946c9,_0x451606,_0x28ac35){return new BPromise(function(_0x37c1c3,_0x3fd234){return client[_0xdcef('0x10')](_0x1946c9,_0x28ac35)['then'](function(_0x4a2973){logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,'request\x20sent');logger[_0xdcef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x451606,'request\x20sent',JSON[_0xdcef('0x14')](_0x4a2973));if(_0x4a2973[_0xdcef('0x15')]){if(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x16')]===0x1f4){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);return _0x3fd234(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);}logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973['error'][_0xdcef('0x17')]);return _0x37c1c3(_0x4a2973['error'][_0xdcef('0x17')]);}else{logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,_0xdcef('0x18'));_0x37c1c3(_0x4a2973['result']['message']);}})[_0xdcef('0x19')](function(_0x19283a){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x19283a);_0x3fd234(_0x19283a);});});}exports[_0xdcef('0x1a')]=function(_0x465fed){var _0x43d0f1=this;return new Promise(function(_0x510d1e,_0x417de7){return db[_0xdcef('0x1b')]['create'](_0x465fed[_0xdcef('0x1c')],{'raw':_0x465fed[_0xdcef('0x1d')]?_0x465fed[_0xdcef('0x1d')][_0xdcef('0x1e')]===undefined?!![]:![]:!![]})[_0xdcef('0x1f')](function(_0x1082eb){logger[_0xdcef('0x11')](_0xdcef('0x1a'),_0x465fed);logger[_0xdcef('0x13')](_0xdcef('0x1a'),_0x465fed,JSON[_0xdcef('0x14')](_0x1082eb));_0x510d1e(_0x1082eb);})[_0xdcef('0x19')](function(_0x32d0ee){logger[_0xdcef('0x15')]('CreateOpenchannelMessage',_0x32d0ee[_0xdcef('0x17')],_0x465fed);_0x417de7(_0x43d0f1[_0xdcef('0x15')](0x1f4,_0x32d0ee[_0xdcef('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index dd837a2..3a2ce67 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(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x87021e,_0x4b0232){_0x87021e=_0x87021e-0x0;var _0x26b66e=_0x9bde[_0x87021e];return _0x26b66e;};'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 _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index fd6324e..6dd1d36 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 _0xb491=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents'];(function(_0x5d3276,_0xd38063){var _0x3562f5=function(_0x5c5594){while(--_0x5c5594){_0x5d3276['push'](_0x5d3276['shift']());}};_0x3562f5(++_0xd38063);}(_0xb491,0x18c));var _0x1b49=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0xb491[_0x148879];return _0x4f7027;};'use strict';var multer=require(_0x1b49('0x0'));var util=require(_0x1b49('0x1'));var path=require(_0x1b49('0x2'));var timeout=require(_0x1b49('0x3'));var express=require(_0x1b49('0x4'));var router=express[_0x1b49('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1b49('0x6'));var config=require(_0x1b49('0x7'));var controller=require('./openchannelQueue.controller');router[_0x1b49('0x8')]('/',auth[_0x1b49('0x9')](),controller[_0x1b49('0xa')]);router['get'](_0x1b49('0xb'),auth['isAuthenticated'](),controller[_0x1b49('0xc')]);router[_0x1b49('0x8')](_0x1b49('0xd'),auth[_0x1b49('0x9')](),controller[_0x1b49('0xe')]);router[_0x1b49('0x8')](_0x1b49('0xf'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x10')]);router[_0x1b49('0x8')](_0x1b49('0x11'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x12')]);router[_0x1b49('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x1b49('0x13')]);router[_0x1b49('0x14')]('/',auth[_0x1b49('0x9')](),controller[_0x1b49('0x15')]);router[_0x1b49('0x14')]('/:id/teams',auth[_0x1b49('0x9')](),controller['addTeams']);router[_0x1b49('0x14')](_0x1b49('0x16'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x17')]);router['put'](_0x1b49('0xd'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x18')]);router[_0x1b49('0x19')](_0x1b49('0xd'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x1a')]);router[_0x1b49('0x19')]('/:id/teams',auth[_0x1b49('0x9')](),controller[_0x1b49('0x1b')]);router['delete'](_0x1b49('0x16'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x1c')]);module[_0x1b49('0x1d')]=router; \ No newline at end of file +var _0x038b=['show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','/:id','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x1dfce3,_0x491d21){var _0x127504=function(_0x3028cb){while(--_0x3028cb){_0x1dfce3['push'](_0x1dfce3['shift']());}};_0x127504(++_0x491d21);}(_0x038b,0x114));var _0xb038=function(_0x59a4e9,_0x4e4e3f){_0x59a4e9=_0x59a4e9-0x0;var _0x3c44d9=_0x038b[_0x59a4e9];return _0x3c44d9;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb038('0x4'));var config=require(_0xb038('0x5'));var controller=require('./openchannelQueue.controller');router[_0xb038('0x6')]('/',auth[_0xb038('0x7')](),controller['index']);router['get'](_0xb038('0x8'),auth[_0xb038('0x7')](),controller[_0xb038('0x9')]);router['get']('/:id',auth[_0xb038('0x7')](),controller[_0xb038('0xa')]);router['get']('/:id/members',auth[_0xb038('0x7')](),controller[_0xb038('0xb')]);router['get'](_0xb038('0xc'),auth[_0xb038('0x7')](),controller[_0xb038('0xd')]);router[_0xb038('0x6')](_0xb038('0xe'),auth[_0xb038('0x7')](),controller[_0xb038('0xf')]);router[_0xb038('0x10')]('/',auth[_0xb038('0x7')](),controller[_0xb038('0x11')]);router[_0xb038('0x10')](_0xb038('0xc'),auth[_0xb038('0x7')](),controller[_0xb038('0x12')]);router[_0xb038('0x10')](_0xb038('0xe'),auth[_0xb038('0x7')](),controller['addAgents']);router[_0xb038('0x13')](_0xb038('0x14'),auth[_0xb038('0x7')](),controller[_0xb038('0x15')]);router[_0xb038('0x16')](_0xb038('0x14'),auth['isAuthenticated'](),controller[_0xb038('0x17')]);router[_0xb038('0x16')](_0xb038('0xc'),auth[_0xb038('0x7')](),controller['removeTeams']);router['delete'](_0xb038('0xe'),auth[_0xb038('0x7')](),controller[_0xb038('0x18')]);module[_0xb038('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index fe02a81..6595df2 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 _0xe511=['exports','STRING','INTEGER','rrmemory','beepall','sequelize'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0xe511,0x143));var _0x1e51=function(_0x2eedb5,_0x2e1801){_0x2eedb5=_0x2eedb5-0x0;var _0x534cd6=_0xe511[_0x2eedb5];return _0x534cd6;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'name':{'type':Sequelize[_0x1e51('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1e51('0x2')]},'timeout':{'type':Sequelize[_0x1e51('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1e51('0x4'),_0x1e51('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x06ae=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xe06a('0x0')]={'name':{'type':Sequelize[_0xe06a('0x1')],'unique':_0xe06a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe06a('0x1')]},'timeout':{'type':Sequelize[_0xe06a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe06a('0x4')](_0xe06a('0x5'),_0xe06a('0x6'),_0xe06a('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0454107..57a228b 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 _0xc56c=['../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','map','OpenchannelQueue','rawAttributes','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','every','TeamId','includes','union','compact','value','isEmpty','forEach','addAgents','omit','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x390908,_0x27dd28){var _0x2ac84f=function(_0x477568){while(--_0x477568){_0x390908['push'](_0x390908['shift']());}};_0x2ac84f(++_0x27dd28);}(_0xc56c,0xfb));var _0xcc56=function(_0x738958,_0x54e241){_0x738958=_0x738958-0x0;var _0x4f32de=_0xc56c[_0x738958];return _0x4f32de;};'use strict';var pdf=require(_0xcc56('0x0'));var emlformat=require(_0xcc56('0x1'));var rimraf=require(_0xcc56('0x2'));var zipdir=require(_0xcc56('0x3'));var jsonpatch=require(_0xcc56('0x4'));var rp=require('request-promise');var moment=require(_0xcc56('0x5'));var BPromise=require(_0xcc56('0x6'));var Mustache=require(_0xcc56('0x7'));var util=require(_0xcc56('0x8'));var path=require(_0xcc56('0x9'));var sox=require(_0xcc56('0xa'));var csv=require(_0xcc56('0xb'));var ejs=require(_0xcc56('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcc56('0xd'));var deskjs=require(_0xcc56('0xe'));var toCsv=require(_0xcc56('0xb'));var querystring=require('querystring');var Papa=require(_0xcc56('0xf'));var Redis=require(_0xcc56('0x10'));var authService=require(_0xcc56('0x11'));var qs=require(_0xcc56('0x12'));var as=require(_0xcc56('0x13'));var hardwareService=require(_0xcc56('0x14'));var logger=require(_0xcc56('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcc56('0x16'));var db=require(_0xcc56('0x17'))['db'];config[_0xcc56('0x18')]=_['defaults'](config['redis'],{'host':_0xcc56('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc56('0x18')]));require(_0xcc56('0x1a'))[_0xcc56('0x1b')](socket);function respondWithStatusCode(_0x47bc1b,_0x3a4577){_0x3a4577=_0x3a4577||0xcc;return function(_0x5ee216){if(_0x5ee216){return _0x47bc1b[_0xcc56('0x1c')](_0x3a4577);}return _0x47bc1b[_0xcc56('0x1d')](_0x3a4577)[_0xcc56('0x1e')]();};}function respondWithResult(_0x18111b,_0x33135d){_0x33135d=_0x33135d||0xc8;return function(_0x28ab9b){if(_0x28ab9b){return _0x18111b[_0xcc56('0x1d')](_0x33135d)[_0xcc56('0x1f')](_0x28ab9b);}};}function respondWithFilteredResult(_0x1b1660,_0x943b92){return function(_0x5605f5){if(_0x5605f5){var _0x195e79=_0x5605f5[_0xcc56('0x20')],_0x455618=_0x943b92[_0xcc56('0x21')],_0x519c36=_0x943b92['offset']+_0x943b92['limit'],_0x2e7b6f;if(_0x519c36>=_0x195e79){_0x519c36=_0x195e79;_0x2e7b6f=0xc8;}else{_0x2e7b6f=0xce;}_0x1b1660[_0xcc56('0x1d')](_0x2e7b6f);return _0x1b1660[_0xcc56('0x22')](_0xcc56('0x23'),_0x455618+'-'+_0x519c36+'/'+_0x195e79)['json'](_0x5605f5);}return null;};}function patchUpdates(_0x4e0e95){return function(_0x124ee2){try{jsonpatch[_0xcc56('0x24')](_0x124ee2,_0x4e0e95,!![]);}catch(_0x17625e){return BPromise['reject'](_0x17625e);}return _0x124ee2[_0xcc56('0x25')]();};}function saveUpdates(_0x66e78,_0x518336){return function(_0x250a02){if(_0x250a02){return _0x250a02[_0xcc56('0x26')](_0x66e78)[_0xcc56('0x27')](function(_0x12a5a9){return _0x12a5a9;});}return null;};}function removeEntity(_0x16b393,_0x20b503){return function(_0x17b8de){if(_0x17b8de){return _0x17b8de[_0xcc56('0x28')]()[_0xcc56('0x27')](function(){var _0x3f925e=_0x17b8de[_0xcc56('0x29')]({'plain':!![]});var _0x478113=_0xcc56('0x2a');return db[_0xcc56('0x2b')][_0xcc56('0x28')]({'where':{'type':_0x478113,'resourceId':_0x3f925e['id']}})[_0xcc56('0x27')](function(){return _0x17b8de;});})[_0xcc56('0x27')](function(){_0x16b393[_0xcc56('0x1d')](0xcc)[_0xcc56('0x1e')]();});}};}function handleEntityNotFound(_0x15f162,_0x5225b0){return function(_0x127114){if(!_0x127114){_0x15f162[_0xcc56('0x1c')](0x194);}return _0x127114;};}function handleError(_0xd9bd2f,_0x23dd2b){_0x23dd2b=_0x23dd2b||0x1f4;return function(_0x141c7d){logger[_0xcc56('0x2c')](_0x141c7d['stack']);if(_0x141c7d[_0xcc56('0x2d')]){delete _0x141c7d['name'];}_0xd9bd2f['status'](_0x23dd2b)[_0xcc56('0x2e')](_0x141c7d);};}exports['index']=function(_0x48d413,_0x516cac){var _0x177f90={},_0x5750bc={},_0x3b873b={'count':0x0,'rows':[]};var _0x3493af=_[_0xcc56('0x2f')](db[_0xcc56('0x30')][_0xcc56('0x31')],function(_0x55a01e){return{'name':_0x55a01e['fieldName'],'type':_0x55a01e[_0xcc56('0x32')]['key']};});_0x5750bc['model']=_[_0xcc56('0x2f')](_0x3493af,'name');_0x5750bc[_0xcc56('0x33')]=_['keys'](_0x48d413[_0xcc56('0x33')]);_0x5750bc['filters']=_[_0xcc56('0x34')](_0x5750bc[_0xcc56('0x35')],_0x5750bc[_0xcc56('0x33')]);_0x177f90[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x5750bc[_0xcc56('0x35')],qs[_0xcc56('0x37')](_0x48d413[_0xcc56('0x33')][_0xcc56('0x37')]));_0x177f90[_0xcc56('0x36')]=_0x177f90[_0xcc56('0x36')][_0xcc56('0x38')]?_0x177f90[_0xcc56('0x36')]:_0x5750bc[_0xcc56('0x35')];if(!_0x48d413[_0xcc56('0x33')][_0xcc56('0x39')](_0xcc56('0x3a'))){_0x177f90[_0xcc56('0x3b')]=qs[_0xcc56('0x3b')](_0x48d413[_0xcc56('0x33')][_0xcc56('0x3b')]);_0x177f90[_0xcc56('0x21')]=qs['offset'](_0x48d413[_0xcc56('0x33')][_0xcc56('0x21')]);}_0x177f90[_0xcc56('0x3c')]=qs[_0xcc56('0x3d')](_0x48d413[_0xcc56('0x33')][_0xcc56('0x3d')]);_0x177f90[_0xcc56('0x3e')]=qs['filters'](_[_0xcc56('0x3f')](_0x48d413[_0xcc56('0x33')],_0x5750bc[_0xcc56('0x40')]),_0x3493af);if(_0x48d413[_0xcc56('0x33')][_0xcc56('0x41')]){_0x177f90[_0xcc56('0x3e')]=_[_0xcc56('0x42')](_0x177f90[_0xcc56('0x3e')],{'$or':_[_0xcc56('0x2f')](_0x3493af,function(_0x5ad824){if(_0x5ad824[_0xcc56('0x32')]!==_0xcc56('0x43')){var _0x29b8c9={};_0x29b8c9[_0x5ad824[_0xcc56('0x2d')]]={'$like':'%'+_0x48d413[_0xcc56('0x33')]['filter']+'%'};return _0x29b8c9;}})});}_0x177f90=_['merge']({},_0x177f90,_0x48d413['options']);var _0x4d29c7={'where':_0x177f90[_0xcc56('0x3e')]};return db[_0xcc56('0x30')]['count'](_0x4d29c7)[_0xcc56('0x27')](function(_0x594bd2){_0x3b873b['count']=_0x594bd2;if(_0x48d413[_0xcc56('0x33')][_0xcc56('0x44')]){_0x177f90[_0xcc56('0x45')]=[{'all':!![]}];}return db[_0xcc56('0x30')][_0xcc56('0x46')](_0x177f90);})['then'](function(_0x226e54){_0x3b873b[_0xcc56('0x47')]=_0x226e54;return _0x3b873b;})[_0xcc56('0x27')](respondWithFilteredResult(_0x516cac,_0x177f90))[_0xcc56('0x48')](handleError(_0x516cac,null));};exports[_0xcc56('0x49')]=function(_0x5c210f,_0x4e6c2d){var _0x9c7b6c={'raw':!![],'where':{'id':_0x5c210f[_0xcc56('0x4a')]['id']}},_0x2491e6={};_0x2491e6[_0xcc56('0x35')]=_[_0xcc56('0x4b')](db['OpenchannelQueue'][_0xcc56('0x31')]);_0x2491e6[_0xcc56('0x33')]=_[_0xcc56('0x4b')](_0x5c210f[_0xcc56('0x33')]);_0x2491e6['filters']=_[_0xcc56('0x34')](_0x2491e6[_0xcc56('0x35')],_0x2491e6[_0xcc56('0x33')]);_0x9c7b6c[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x2491e6['model'],qs[_0xcc56('0x37')](_0x5c210f[_0xcc56('0x33')][_0xcc56('0x37')]));_0x9c7b6c[_0xcc56('0x36')]=_0x9c7b6c[_0xcc56('0x36')][_0xcc56('0x38')]?_0x9c7b6c[_0xcc56('0x36')]:_0x2491e6['model'];if(_0x5c210f['query'][_0xcc56('0x44')]){_0x9c7b6c[_0xcc56('0x45')]=[{'all':!![]}];}_0x9c7b6c=_[_0xcc56('0x42')]({},_0x9c7b6c,_0x5c210f[_0xcc56('0x4c')]);return db[_0xcc56('0x30')][_0xcc56('0x4d')](_0x9c7b6c)[_0xcc56('0x27')](handleEntityNotFound(_0x4e6c2d,null))['then'](respondWithResult(_0x4e6c2d,null))['catch'](handleError(_0x4e6c2d,null));};exports[_0xcc56('0x4e')]=function(_0x167fbd,_0x2dc09c){return db[_0xcc56('0x30')][_0xcc56('0x4e')](_0x167fbd[_0xcc56('0x4f')],{})['then'](function(_0x5809f2){var _0x2a4ff5=_0x167fbd[_0xcc56('0x50')]['get']({'plain':!![]});if(!_0x2a4ff5)throw new Error(_0xcc56('0x51'));if(_0x2a4ff5['role']===_0xcc56('0x50')){var _0x1ad4d7=_0x5809f2['get']({'plain':!![]});var _0x568f78=_0xcc56('0x2a');return db[_0xcc56('0x52')]['find']({'where':{'name':_0x568f78,'userProfileId':_0x2a4ff5[_0xcc56('0x53')]},'raw':!![]})[_0xcc56('0x27')](function(_0x3cdc78){if(_0x3cdc78&&_0x3cdc78[_0xcc56('0x54')]===0x0){return db[_0xcc56('0x2b')][_0xcc56('0x4e')]({'name':_0x1ad4d7['name'],'resourceId':_0x1ad4d7['id'],'type':_0x3cdc78['name'],'sectionId':_0x3cdc78['id']},{})[_0xcc56('0x27')](function(){return _0x5809f2;});}else{return _0x5809f2;}})[_0xcc56('0x48')](function(_0x4110aa){logger[_0xcc56('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4110aa);throw _0x4110aa;});}return _0x5809f2;})[_0xcc56('0x27')](respondWithResult(_0x2dc09c,0xc9))[_0xcc56('0x48')](handleError(_0x2dc09c,null));};exports[_0xcc56('0x26')]=function(_0x10851a,_0x3b6444){if(_0x10851a[_0xcc56('0x4f')]['id']){delete _0x10851a['body']['id'];}return db[_0xcc56('0x30')]['find']({'where':{'id':_0x10851a[_0xcc56('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b6444,null))['then'](saveUpdates(_0x10851a[_0xcc56('0x4f')],null))['then'](respondWithResult(_0x3b6444,null))[_0xcc56('0x48')](handleError(_0x3b6444,null));};exports[_0xcc56('0x28')]=function(_0x2f1813,_0x4c4c05){return db[_0xcc56('0x30')][_0xcc56('0x4d')]({'where':{'id':_0x2f1813[_0xcc56('0x4a')]['id']}})[_0xcc56('0x27')](handleEntityNotFound(_0x4c4c05,null))['then'](removeEntity(_0x4c4c05,null))[_0xcc56('0x48')](handleError(_0x4c4c05,null));};exports[_0xcc56('0x55')]=function(_0x231ba4,_0xa97f52){return db[_0xcc56('0x30')][_0xcc56('0x55')]()[_0xcc56('0x27')](respondWithResult(_0xa97f52,null))[_0xcc56('0x48')](handleError(_0xa97f52,null));};exports[_0xcc56('0x56')]=function(_0x4c080a,_0x4322e5,_0x12e1bf){var _0x41f885={'raw':!![],'where':{}},_0x17c1ec={},_0x3cdf56;return db[_0xcc56('0x30')][_0xcc56('0x57')]({'where':{'id':_0x4c080a[_0xcc56('0x4a')]['id']}})[_0xcc56('0x27')](handleEntityNotFound(_0x4322e5,null))[_0xcc56('0x27')](function(_0x38144c){if(_0x38144c){_0x3cdf56=_0x38144c[_0xcc56('0x29')]({'plain':!![]});_0x17c1ec[_0xcc56('0x35')]=_[_0xcc56('0x4b')](db[_0xcc56('0x58')]['rawAttributes']);_0x17c1ec[_0xcc56('0x33')]=_[_0xcc56('0x4b')](_0x4c080a[_0xcc56('0x33')]);_0x17c1ec[_0xcc56('0x40')]=_['intersection'](_0x17c1ec['model'],_0x17c1ec[_0xcc56('0x33')]);_0x41f885[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x17c1ec[_0xcc56('0x35')],qs['fields'](_0x4c080a['query'][_0xcc56('0x37')]));_0x41f885[_0xcc56('0x36')]=_0x41f885[_0xcc56('0x36')][_0xcc56('0x38')]?_0x41f885['attributes']:_0x17c1ec[_0xcc56('0x35')];if(!_0x4c080a[_0xcc56('0x33')]['hasOwnProperty'](_0xcc56('0x3a'))){_0x41f885[_0xcc56('0x3b')]=qs[_0xcc56('0x3b')](_0x4c080a['query'][_0xcc56('0x3b')]);_0x41f885[_0xcc56('0x21')]=qs['offset'](_0x4c080a[_0xcc56('0x33')][_0xcc56('0x21')]);}_0x41f885[_0xcc56('0x3c')]=qs[_0xcc56('0x3d')](_0x4c080a[_0xcc56('0x33')]['sort']);_0x41f885['where']=qs[_0xcc56('0x40')](_['pick'](_0x4c080a[_0xcc56('0x33')],_0x17c1ec[_0xcc56('0x40')]));_0x41f885['where'][_0xcc56('0x59')]=_0x38144c['id'];if(_0x4c080a['query'][_0xcc56('0x41')]){_0x41f885['where']=_[_0xcc56('0x42')](_0x41f885['where'],{'$or':_[_0xcc56('0x2f')](_0x41f885[_0xcc56('0x36')],function(_0x336543){var _0x23a212={};_0x23a212[_0x336543]={'$like':'%'+_0x4c080a[_0xcc56('0x33')][_0xcc56('0x41')]+'%'};return _0x23a212;})});}_0x41f885=_[_0xcc56('0x42')]({},_0x41f885,_0x4c080a['options']);return db[_0xcc56('0x58')][_0xcc56('0x46')](_0x41f885);}})[_0xcc56('0x27')](function(_0x1bec83){if(_0x1bec83){return db['User'][_0xcc56('0x5a')]({'where':{'id':_['map'](_0x1bec83,'UserId'),'role':_0xcc56('0x5b')},'attributes':['id','name',_0xcc56('0x5c'),_0xcc56('0x5d'),_0xcc56('0x5e')]});}})['then'](function(_0x3b081e){if(_0x3b081e){return{'count':_0x3b081e['count'],'rows':_[_0xcc56('0x2f')](_0x3b081e['rows'],function(_0xbd6364){return{'membername':_0xbd6364[_0xcc56('0x2d')],'UserId':_0xbd6364['id'],'queue_name':_0x3cdf56[_0xcc56('0x2d')],'OpenchannelQueueId':_0x3cdf56['id'],'interface':util[_0xcc56('0x5f')](_0xcc56('0x60'),_0xcc56('0x61'),_0xbd6364[_0xcc56('0x2d')]),'penalty':0x0,'paused':_0xbd6364[_0xcc56('0x5c')],'createdAt':_0xbd6364[_0xcc56('0x5e')],'updatedAt':_0xbd6364[_0xcc56('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcc56('0x27')](respondWithFilteredResult(_0x4322e5,_0x41f885))['catch'](handleError(_0x4322e5,null));};exports[_0xcc56('0x62')]=function(_0x268766,_0x57f67f,_0x17b169){var _0x68ffa8={};var _0x105695={};var _0x2f95c3;var _0x3d190e;return db[_0xcc56('0x30')][_0xcc56('0x57')]({'where':{'id':_0x268766[_0xcc56('0x4a')]['id']}})[_0xcc56('0x27')](handleEntityNotFound(_0x57f67f,null))[_0xcc56('0x27')](function(_0x1fde3f){if(_0x1fde3f){_0x2f95c3=_0x1fde3f;_0x105695['model']=_[_0xcc56('0x4b')](db[_0xcc56('0x63')][_0xcc56('0x31')]);_0x105695['query']=_[_0xcc56('0x4b')](_0x268766[_0xcc56('0x33')]);_0x105695[_0xcc56('0x40')]=_['intersection'](_0x105695[_0xcc56('0x35')],_0x105695[_0xcc56('0x33')]);_0x68ffa8[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x105695[_0xcc56('0x35')],qs[_0xcc56('0x37')](_0x268766[_0xcc56('0x33')][_0xcc56('0x37')]));_0x68ffa8['attributes']=_0x68ffa8[_0xcc56('0x36')][_0xcc56('0x38')]?_0x68ffa8[_0xcc56('0x36')]:_0x105695[_0xcc56('0x35')];_0x68ffa8[_0xcc56('0x3c')]=qs[_0xcc56('0x3d')](_0x268766[_0xcc56('0x33')][_0xcc56('0x3d')]);_0x68ffa8[_0xcc56('0x3e')]=qs['filters'](_[_0xcc56('0x3f')](_0x268766[_0xcc56('0x33')],_0x105695['filters']));if(_0x268766[_0xcc56('0x33')][_0xcc56('0x41')]){_0x68ffa8['where']=_[_0xcc56('0x42')](_0x68ffa8['where'],{'$or':_[_0xcc56('0x2f')](_0x68ffa8[_0xcc56('0x36')],function(_0x55f8c3){var _0x592f56={};_0x592f56[_0x55f8c3]={'$like':'%'+_0x268766['query']['filter']+'%'};return _0x592f56;})});}_0x68ffa8=_['merge']({},_0x68ffa8,_0x268766[_0xcc56('0x4c')]);return _0x2f95c3[_0xcc56('0x62')](_0x68ffa8);}})['then'](function(_0x55ad4e){if(_0x55ad4e){_0x3d190e=_0x55ad4e['length'];if(!_0x268766[_0xcc56('0x33')][_0xcc56('0x39')](_0xcc56('0x3a'))){_0x68ffa8[_0xcc56('0x3b')]=qs['limit'](_0x268766[_0xcc56('0x33')]['limit']);_0x68ffa8[_0xcc56('0x21')]=qs[_0xcc56('0x21')](_0x268766[_0xcc56('0x33')][_0xcc56('0x21')]);}return _0x2f95c3[_0xcc56('0x62')](_0x68ffa8);}})[_0xcc56('0x27')](function(_0x133d3b){if(_0x133d3b){return _0x133d3b?{'count':_0x3d190e,'rows':_0x133d3b}:null;}})['then'](respondWithResult(_0x57f67f,null))[_0xcc56('0x48')](handleError(_0x57f67f,null));};exports[_0xcc56('0x64')]=function(_0x547ad5,_0x1d590c,_0x2ac917){var _0x573541=_0x547ad5['body'][_0xcc56('0x65')];return db[_0xcc56('0x63')][_0xcc56('0x46')]({'where':{'id':_0x573541},'attributes':['id'],'include':[{'model':db[_0xcc56('0x66')],'as':_0xcc56('0x67'),'attributes':['id',_0xcc56('0x2d'),_0xcc56('0x68'),'voicePause',_0xcc56('0x69')],'raw':!![]}]})['then'](function(_0x36d710){if(_0x36d710){var _0x1ef53e=_[_0xcc56('0x6a')](_0x36d710,function(_0x2acd19){var _0x103dca=_0x2acd19[_0xcc56('0x29')]({'plain':!![]});return _0x103dca[_0xcc56('0x67')];});return db[_0xcc56('0x30')]['find']({'where':{'id':_0x547ad5[_0xcc56('0x4a')]['id']}})['then'](function(_0x46c9a5){return db[_0xcc56('0x6b')][_0xcc56('0x6c')](function(_0x26cf4b){return _0x46c9a5[_0xcc56('0x64')](_0x573541,{'transaction':_0x26cf4b})[_0xcc56('0x27')](function(){return BPromise[_0xcc56('0x6d')](_0x1ef53e,function(_0x2a4dcc){return db[_0xcc56('0x58')][_0xcc56('0x6e')]({'where':{'UserId':_0x2a4dcc['id'],'OpenchannelQueueId':_0x547ad5[_0xcc56('0x4a')]['id']},'transaction':_0x26cf4b});});})['then'](function(){_0x1ef53e['forEach'](function(_0x482d25){socket[_0xcc56('0x6f')](_0xcc56('0x70'),{'UserId':_0x482d25['id'],'OpenchannelQueueId':_0x46c9a5['id']});});});});});}})[_0xcc56('0x27')](respondWithStatusCode(_0x1d590c,null))[_0xcc56('0x48')](handleError(_0x1d590c,null));};exports[_0xcc56('0x71')]=function(_0x2c68e3,_0x297917,_0x320079){return db[_0xcc56('0x63')]['findAll']({'where':{'id':_0x2c68e3['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xcc56('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xcc56('0x27')](handleEntityNotFound(_0x297917,null))['then'](function(_0x4b1e71){var _0x3a4f8a=_[_0xcc56('0x2f')](_0x4b1e71,'id');var _0x568a11=[];var _0xb214d3=[];var _0x12c9d5=squel[_0xcc56('0x72')]();_0x12c9d5[_0xcc56('0x73')](_0xcc56('0x74'))[_0xcc56('0x75')](_0xcc56('0x76'),'tq')[_0xcc56('0x77')](_0xcc56('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcc56('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x2c68e3[_0xcc56('0x4a')]['id']);for(var _0x500785=0x0;_0x500785<_0x4b1e71['length'];_0x500785+=0x1){let _0x4f1d8b=_0x4b1e71[_0x500785];for(var _0x16d1e2=0x0;_0x16d1e2<_0x4f1d8b['Agents']['length'];_0x16d1e2+=0x1){let _0x427c1a=_0x4f1d8b[_0xcc56('0x67')][_0x16d1e2];var _0x1c66e8=_0x12c9d5['clone']();_0x1c66e8['where'](_0xcc56('0x79'),_0x427c1a['id']);_0xb214d3[_0xcc56('0x7a')](db[_0xcc56('0x6b')][_0xcc56('0x33')](_0x1c66e8['toString'](),{'type':db[_0xcc56('0x6b')]['QueryTypes']['SELECT']})[_0xcc56('0x27')](function(_0x57e4d1){if(_0x57e4d1['length']===0x1){return _0x427c1a['id'];}else{var _0x427d4f=_[_0xcc56('0x7b')](_[_0xcc56('0x2f')](_0x57e4d1,_0xcc56('0x7c')),function(_0x3d1f4c){return _[_0xcc56('0x7d')](_0x3a4f8a,_0x3d1f4c);});if(_0x427d4f){return _0x427c1a['id'];}}}));}}return BPromise['all'](_0xb214d3)[_0xcc56('0x27')](function(_0x583778){_0x568a11=_(_0x568a11)[_0xcc56('0x7e')](_0x583778)[_0xcc56('0x7f')]()[_0xcc56('0x80')]();return db[_0xcc56('0x30')][_0xcc56('0x4d')]({'where':{'id':_0x2c68e3[_0xcc56('0x4a')]['id']}})['then'](function(_0x214d7e){return db[_0xcc56('0x6b')][_0xcc56('0x6c')](function(_0x2aacbb){return _0x214d7e[_0xcc56('0x71')](_0x2c68e3[_0xcc56('0x33')][_0xcc56('0x65')],{'transaction':_0x2aacbb})[_0xcc56('0x27')](function(){if(!_[_0xcc56('0x81')](_0x568a11)){return _0x214d7e['removeAgents'](_0x568a11,{'transaction':_0x2aacbb});}})[_0xcc56('0x27')](function(){_0x568a11[_0xcc56('0x82')](function(_0x59863f){socket[_0xcc56('0x6f')]('userOpenchannelQueue:remove',{'UserId':_0x59863f,'OpenchannelQueueId':_0x214d7e['id']});});});});});});})['then'](respondWithStatusCode(_0x297917,null))[_0xcc56('0x48')](handleError(_0x297917,null));};exports['addAgents']=function(_0x5cb73f,_0x23ee75,_0x38673c){return db['OpenchannelQueue']['find']({'where':{'id':_0x5cb73f[_0xcc56('0x4a')]['id']}})['then'](handleEntityNotFound(_0x23ee75,null))['then'](function(_0x3eb6e6){if(_0x3eb6e6){return _0x3eb6e6[_0xcc56('0x83')](_0x5cb73f[_0xcc56('0x4f')]['ids'],_[_0xcc56('0x84')](_0x5cb73f[_0xcc56('0x4f')],[_0xcc56('0x65'),'id'])||{})['spread'](function(_0x290af5){for(var _0x4153e0=0x0;_0x4153e0<_0x5cb73f[_0xcc56('0x4f')]['ids'][_0xcc56('0x38')];_0x4153e0+=0x1){socket['emit'](_0xcc56('0x70'),{'UserId':_0x5cb73f[_0xcc56('0x4f')][_0xcc56('0x65')][_0x4153e0],'OpenchannelQueueId':_0x5cb73f['params']['id']});}return _0x290af5;});}})[_0xcc56('0x27')](respondWithResult(_0x23ee75,null))[_0xcc56('0x48')](handleError(_0x23ee75,null));};exports['removeAgents']=function(_0x18f143,_0x34326b,_0x70552a){return db[_0xcc56('0x30')][_0xcc56('0x4d')]({'where':{'id':_0x18f143[_0xcc56('0x4a')]['id']}})[_0xcc56('0x27')](handleEntityNotFound(_0x34326b,null))[_0xcc56('0x27')](function(_0x246057){if(_0x246057){return _0x246057[_0xcc56('0x85')](_0x18f143[_0xcc56('0x33')]['ids'])[_0xcc56('0x27')](function(){if(_[_0xcc56('0x86')](_0x18f143['query'][_0xcc56('0x65')])){for(var _0xfd5ed3=0x0;_0xfd5ed3<_0x18f143[_0xcc56('0x33')][_0xcc56('0x65')][_0xcc56('0x38')];_0xfd5ed3+=0x1){socket[_0xcc56('0x6f')](_0xcc56('0x87'),{'UserId':Number(_0x18f143[_0xcc56('0x33')][_0xcc56('0x65')][_0xfd5ed3]),'OpenchannelQueueId':Number(_0x18f143[_0xcc56('0x4a')]['id'])});}}else{socket['emit'](_0xcc56('0x87'),{'UserId':Number(_0x18f143[_0xcc56('0x33')][_0xcc56('0x65')]),'OpenchannelQueueId':Number(_0x18f143[_0xcc56('0x4a')]['id'])});}});}})[_0xcc56('0x27')](respondWithStatusCode(_0x34326b,null))[_0xcc56('0x48')](handleError(_0x34326b,null));};exports[_0xcc56('0x88')]=function(_0x127185,_0x113299,_0x5a9307){var _0x4e53de={};var _0x14d032={};var _0x980faf;var _0x56b248;return db[_0xcc56('0x30')][_0xcc56('0x57')]({'where':{'id':_0x127185[_0xcc56('0x4a')]['id']}})['then'](handleEntityNotFound(_0x113299,null))['then'](function(_0x4cd7cc){if(_0x4cd7cc){_0x980faf=_0x4cd7cc;_0x14d032[_0xcc56('0x35')]=_[_0xcc56('0x4b')](db[_0xcc56('0x66')][_0xcc56('0x31')]);_0x14d032[_0xcc56('0x33')]=_[_0xcc56('0x4b')](_0x127185[_0xcc56('0x33')]);_0x14d032[_0xcc56('0x40')]=_[_0xcc56('0x34')](_0x14d032[_0xcc56('0x35')],_0x14d032[_0xcc56('0x33')]);_0x4e53de[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x14d032[_0xcc56('0x35')],qs[_0xcc56('0x37')](_0x127185[_0xcc56('0x33')][_0xcc56('0x37')]));_0x4e53de[_0xcc56('0x36')]=_0x4e53de[_0xcc56('0x36')][_0xcc56('0x38')]?_0x4e53de[_0xcc56('0x36')]:_0x14d032[_0xcc56('0x35')];_0x4e53de[_0xcc56('0x3c')]=qs['sort'](_0x127185[_0xcc56('0x33')][_0xcc56('0x3d')]);_0x4e53de[_0xcc56('0x3e')]=qs[_0xcc56('0x40')](_['pick'](_0x127185[_0xcc56('0x33')],_0x14d032['filters']));if(_0x127185[_0xcc56('0x33')][_0xcc56('0x41')]){_0x4e53de[_0xcc56('0x3e')]=_[_0xcc56('0x42')](_0x4e53de[_0xcc56('0x3e')],{'$or':_[_0xcc56('0x2f')](_0x4e53de[_0xcc56('0x36')],function(_0xfb75cc){var _0x5129bb={};_0x5129bb[_0xfb75cc]={'$like':'%'+_0x127185['query'][_0xcc56('0x41')]+'%'};return _0x5129bb;})});}_0x4e53de=_[_0xcc56('0x42')]({},_0x4e53de,_0x127185['options']);return _0x980faf['getAgents'](_0x4e53de);}})[_0xcc56('0x27')](function(_0x1b9c1a){if(_0x1b9c1a){_0x56b248=_0x1b9c1a[_0xcc56('0x38')];if(!_0x127185[_0xcc56('0x33')][_0xcc56('0x39')](_0xcc56('0x3a'))){_0x4e53de[_0xcc56('0x3b')]=qs[_0xcc56('0x3b')](_0x127185[_0xcc56('0x33')][_0xcc56('0x3b')]);_0x4e53de['offset']=qs['offset'](_0x127185[_0xcc56('0x33')][_0xcc56('0x21')]);}return _0x980faf[_0xcc56('0x88')](_0x4e53de);}})[_0xcc56('0x27')](function(_0x334465){if(_0x334465){return _0x334465?{'count':_0x56b248,'rows':_0x334465}:null;}})['then'](respondWithResult(_0x113299,null))['catch'](handleError(_0x113299,null));}; \ No newline at end of file +var _0x8250=['find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','getMembers','findOne','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','ids','Agents','online','voicePause','sequelize','transaction','addTeams','each','UserOpenchannelQueue','findOrCreate','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./openchannelQueue.socket','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','destroy','OpenchannelQueues','UserProfileResource','then','error','stack','name','send','OpenchannelQueue','rawAttributes','type','key','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','fields','length','include'];(function(_0x5226ec,_0x115d08){var _0x5c1101=function(_0xb271af){while(--_0xb271af){_0x5226ec['push'](_0x5226ec['shift']());}};_0x5c1101(++_0x115d08);}(_0x8250,0xc4));var _0x0825=function(_0x56ef93,_0x28687c){_0x56ef93=_0x56ef93-0x0;var _0x45e0e7=_0x8250[_0x56ef93];return _0x45e0e7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0825('0x0'));var rimraf=require(_0x0825('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0825('0x2'));var rp=require('request-promise');var moment=require(_0x0825('0x3'));var BPromise=require(_0x0825('0x4'));var Mustache=require(_0x0825('0x5'));var util=require(_0x0825('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0825('0x7'));var ejs=require(_0x0825('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0825('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0825('0xa'));var toCsv=require(_0x0825('0x7'));var querystring=require(_0x0825('0xb'));var Papa=require('papaparse');var Redis=require(_0x0825('0xc'));var authService=require(_0x0825('0xd'));var qs=require(_0x0825('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0825('0xf'));var logger=require(_0x0825('0x10'))(_0x0825('0x11'));var utils=require(_0x0825('0x12'));var config=require(_0x0825('0x13'));var db=require('../../mysqldb')['db'];config[_0x0825('0x14')]=_[_0x0825('0x15')](config[_0x0825('0x14')],{'host':_0x0825('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0825('0x14')]));require(_0x0825('0x17'))['register'](socket);function respondWithStatusCode(_0x23b311,_0x188202){_0x188202=_0x188202||0xcc;return function(_0x314c18){if(_0x314c18){return _0x23b311[_0x0825('0x18')](_0x188202);}return _0x23b311[_0x0825('0x19')](_0x188202)[_0x0825('0x1a')]();};}function respondWithResult(_0x5c3a88,_0x1eb0f4){_0x1eb0f4=_0x1eb0f4||0xc8;return function(_0x17a08f){if(_0x17a08f){return _0x5c3a88['status'](_0x1eb0f4)[_0x0825('0x1b')](_0x17a08f);}};}function respondWithFilteredResult(_0x23eeab,_0x1b1b9f){return function(_0x3d4f4f){if(_0x3d4f4f){var _0x2a5c7d=_0x3d4f4f['count'],_0x55132b=_0x1b1b9f[_0x0825('0x1c')],_0x1bed8a=_0x1b1b9f[_0x0825('0x1c')]+_0x1b1b9f['limit'],_0x150dc1;if(_0x1bed8a>=_0x2a5c7d){_0x1bed8a=_0x2a5c7d;_0x150dc1=0xc8;}else{_0x150dc1=0xce;}_0x23eeab['status'](_0x150dc1);return _0x23eeab['set'](_0x0825('0x1d'),_0x55132b+'-'+_0x1bed8a+'/'+_0x2a5c7d)[_0x0825('0x1b')](_0x3d4f4f);}return null;};}function patchUpdates(_0x1877e8){return function(_0x472583){try{jsonpatch[_0x0825('0x1e')](_0x472583,_0x1877e8,!![]);}catch(_0x54d848){return BPromise[_0x0825('0x1f')](_0x54d848);}return _0x472583[_0x0825('0x20')]();};}function saveUpdates(_0x1a7df2,_0x706d69){return function(_0x3aaffd){if(_0x3aaffd){return _0x3aaffd['update'](_0x1a7df2)['then'](function(_0x2506ad){return _0x2506ad;});}return null;};}function removeEntity(_0x471e66,_0x31b5f3){return function(_0x3906ae){if(_0x3906ae){return _0x3906ae[_0x0825('0x21')]()['then'](function(){var _0xb3affb=_0x3906ae['get']({'plain':!![]});var _0x535e06=_0x0825('0x22');return db[_0x0825('0x23')][_0x0825('0x21')]({'where':{'type':_0x535e06,'resourceId':_0xb3affb['id']}})[_0x0825('0x24')](function(){return _0x3906ae;});})[_0x0825('0x24')](function(){_0x471e66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x369bf6,_0x2edb42){return function(_0x3b10f4){if(!_0x3b10f4){_0x369bf6[_0x0825('0x18')](0x194);}return _0x3b10f4;};}function handleError(_0x38eaf9,_0xd4c714){_0xd4c714=_0xd4c714||0x1f4;return function(_0x86f42b){logger[_0x0825('0x25')](_0x86f42b[_0x0825('0x26')]);if(_0x86f42b[_0x0825('0x27')]){delete _0x86f42b[_0x0825('0x27')];}_0x38eaf9['status'](_0xd4c714)[_0x0825('0x28')](_0x86f42b);};}exports['index']=function(_0x4c50df,_0x1fc380){var _0x229126={},_0x1f2ca5={},_0x1e1b2b={'count':0x0,'rows':[]};var _0x3bac66=_['map'](db[_0x0825('0x29')][_0x0825('0x2a')],function(_0x57e91e){return{'name':_0x57e91e['fieldName'],'type':_0x57e91e[_0x0825('0x2b')][_0x0825('0x2c')]};});_0x1f2ca5[_0x0825('0x2d')]=_[_0x0825('0x2e')](_0x3bac66,_0x0825('0x27'));_0x1f2ca5[_0x0825('0x2f')]=_[_0x0825('0x30')](_0x4c50df[_0x0825('0x2f')]);_0x1f2ca5['filters']=_[_0x0825('0x31')](_0x1f2ca5[_0x0825('0x2d')],_0x1f2ca5['query']);_0x229126[_0x0825('0x32')]=_[_0x0825('0x31')](_0x1f2ca5[_0x0825('0x2d')],qs['fields'](_0x4c50df['query']['fields']));_0x229126[_0x0825('0x32')]=_0x229126[_0x0825('0x32')]['length']?_0x229126[_0x0825('0x32')]:_0x1f2ca5[_0x0825('0x2d')];if(!_0x4c50df[_0x0825('0x2f')][_0x0825('0x33')](_0x0825('0x34'))){_0x229126[_0x0825('0x35')]=qs[_0x0825('0x35')](_0x4c50df['query'][_0x0825('0x35')]);_0x229126[_0x0825('0x1c')]=qs['offset'](_0x4c50df[_0x0825('0x2f')][_0x0825('0x1c')]);}_0x229126['order']=qs[_0x0825('0x36')](_0x4c50df[_0x0825('0x2f')][_0x0825('0x36')]);_0x229126[_0x0825('0x37')]=qs['filters'](_[_0x0825('0x38')](_0x4c50df[_0x0825('0x2f')],_0x1f2ca5[_0x0825('0x39')]),_0x3bac66);if(_0x4c50df['query'][_0x0825('0x3a')]){_0x229126['where']=_[_0x0825('0x3b')](_0x229126[_0x0825('0x37')],{'$or':_[_0x0825('0x2e')](_0x3bac66,function(_0x2cbd04){if(_0x2cbd04[_0x0825('0x2b')]!==_0x0825('0x3c')){var _0x1ea1cf={};_0x1ea1cf[_0x2cbd04[_0x0825('0x27')]]={'$like':'%'+_0x4c50df[_0x0825('0x2f')]['filter']+'%'};return _0x1ea1cf;}})});}_0x229126=_[_0x0825('0x3b')]({},_0x229126,_0x4c50df[_0x0825('0x3d')]);var _0x131dab={'where':_0x229126[_0x0825('0x37')]};return db[_0x0825('0x29')][_0x0825('0x3e')](_0x131dab)[_0x0825('0x24')](function(_0x3b1ed0){_0x1e1b2b['count']=_0x3b1ed0;if(_0x4c50df[_0x0825('0x2f')][_0x0825('0x3f')]){_0x229126['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x0825('0x40')](_0x229126);})[_0x0825('0x24')](function(_0x31b3a7){_0x1e1b2b[_0x0825('0x41')]=_0x31b3a7;return _0x1e1b2b;})['then'](respondWithFilteredResult(_0x1fc380,_0x229126))[_0x0825('0x42')](handleError(_0x1fc380,null));};exports[_0x0825('0x43')]=function(_0x46f245,_0x298e84){var _0x5443e1={'raw':!![],'where':{'id':_0x46f245[_0x0825('0x44')]['id']}},_0x40fe76={};_0x40fe76[_0x0825('0x2d')]=_[_0x0825('0x30')](db['OpenchannelQueue'][_0x0825('0x2a')]);_0x40fe76[_0x0825('0x2f')]=_[_0x0825('0x30')](_0x46f245[_0x0825('0x2f')]);_0x40fe76[_0x0825('0x39')]=_[_0x0825('0x31')](_0x40fe76[_0x0825('0x2d')],_0x40fe76['query']);_0x5443e1['attributes']=_[_0x0825('0x31')](_0x40fe76[_0x0825('0x2d')],qs[_0x0825('0x45')](_0x46f245[_0x0825('0x2f')][_0x0825('0x45')]));_0x5443e1['attributes']=_0x5443e1[_0x0825('0x32')][_0x0825('0x46')]?_0x5443e1[_0x0825('0x32')]:_0x40fe76[_0x0825('0x2d')];if(_0x46f245['query'][_0x0825('0x3f')]){_0x5443e1[_0x0825('0x47')]=[{'all':!![]}];}_0x5443e1=_[_0x0825('0x3b')]({},_0x5443e1,_0x46f245[_0x0825('0x3d')]);return db[_0x0825('0x29')][_0x0825('0x48')](_0x5443e1)['then'](handleEntityNotFound(_0x298e84,null))[_0x0825('0x24')](respondWithResult(_0x298e84,null))['catch'](handleError(_0x298e84,null));};exports[_0x0825('0x49')]=function(_0x42679f,_0x5eee47){return db[_0x0825('0x29')][_0x0825('0x49')](_0x42679f[_0x0825('0x4a')],{})[_0x0825('0x24')](function(_0xf952cc){var _0x1870d4=_0x42679f[_0x0825('0x4b')][_0x0825('0x4c')]({'plain':!![]});if(!_0x1870d4)throw new Error(_0x0825('0x4d'));if(_0x1870d4[_0x0825('0x4e')]===_0x0825('0x4b')){var _0x9a7bc4=_0xf952cc[_0x0825('0x4c')]({'plain':!![]});var _0x333353=_0x0825('0x22');return db[_0x0825('0x4f')][_0x0825('0x48')]({'where':{'name':_0x333353,'userProfileId':_0x1870d4[_0x0825('0x50')]},'raw':!![]})[_0x0825('0x24')](function(_0x3d6a20){if(_0x3d6a20&&_0x3d6a20[_0x0825('0x51')]===0x0){return db[_0x0825('0x23')][_0x0825('0x49')]({'name':_0x9a7bc4[_0x0825('0x27')],'resourceId':_0x9a7bc4['id'],'type':_0x3d6a20['name'],'sectionId':_0x3d6a20['id']},{})[_0x0825('0x24')](function(){return _0xf952cc;});}else{return _0xf952cc;}})[_0x0825('0x42')](function(_0x5b847b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b847b);throw _0x5b847b;});}return _0xf952cc;})[_0x0825('0x24')](respondWithResult(_0x5eee47,0xc9))[_0x0825('0x42')](handleError(_0x5eee47,null));};exports[_0x0825('0x52')]=function(_0x400fa9,_0x3260fb){if(_0x400fa9[_0x0825('0x4a')]['id']){delete _0x400fa9['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x400fa9[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x3260fb,null))['then'](saveUpdates(_0x400fa9['body'],null))[_0x0825('0x24')](respondWithResult(_0x3260fb,null))[_0x0825('0x42')](handleError(_0x3260fb,null));};exports['destroy']=function(_0x4fecd5,_0x3a1889){return db[_0x0825('0x29')]['find']({'where':{'id':_0x4fecd5[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x3a1889,null))[_0x0825('0x24')](removeEntity(_0x3a1889,null))['catch'](handleError(_0x3a1889,null));};exports[_0x0825('0x53')]=function(_0x10503e,_0x57231e){return db['OpenchannelQueue'][_0x0825('0x53')]()[_0x0825('0x24')](respondWithResult(_0x57231e,null))[_0x0825('0x42')](handleError(_0x57231e,null));};exports[_0x0825('0x54')]=function(_0x845b25,_0x21f47b,_0x119cda){var _0x15073f={'raw':!![],'where':{}},_0x1252ce={},_0x2450ef;return db['OpenchannelQueue'][_0x0825('0x55')]({'where':{'id':_0x845b25[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x21f47b,null))[_0x0825('0x24')](function(_0x17831c){if(_0x17831c){_0x2450ef=_0x17831c['get']({'plain':!![]});_0x1252ce[_0x0825('0x2d')]=_[_0x0825('0x30')](db['UserOpenchannelQueue']['rawAttributes']);_0x1252ce[_0x0825('0x2f')]=_[_0x0825('0x30')](_0x845b25[_0x0825('0x2f')]);_0x1252ce['filters']=_[_0x0825('0x31')](_0x1252ce[_0x0825('0x2d')],_0x1252ce['query']);_0x15073f[_0x0825('0x32')]=_[_0x0825('0x31')](_0x1252ce[_0x0825('0x2d')],qs[_0x0825('0x45')](_0x845b25['query'][_0x0825('0x45')]));_0x15073f[_0x0825('0x32')]=_0x15073f[_0x0825('0x32')]['length']?_0x15073f[_0x0825('0x32')]:_0x1252ce[_0x0825('0x2d')];if(!_0x845b25[_0x0825('0x2f')][_0x0825('0x33')](_0x0825('0x34'))){_0x15073f[_0x0825('0x35')]=qs[_0x0825('0x35')](_0x845b25['query'][_0x0825('0x35')]);_0x15073f[_0x0825('0x1c')]=qs[_0x0825('0x1c')](_0x845b25[_0x0825('0x2f')][_0x0825('0x1c')]);}_0x15073f[_0x0825('0x56')]=qs[_0x0825('0x36')](_0x845b25[_0x0825('0x2f')]['sort']);_0x15073f['where']=qs[_0x0825('0x39')](_[_0x0825('0x38')](_0x845b25[_0x0825('0x2f')],_0x1252ce[_0x0825('0x39')]));_0x15073f[_0x0825('0x37')][_0x0825('0x57')]=_0x17831c['id'];if(_0x845b25[_0x0825('0x2f')][_0x0825('0x3a')]){_0x15073f[_0x0825('0x37')]=_[_0x0825('0x3b')](_0x15073f[_0x0825('0x37')],{'$or':_[_0x0825('0x2e')](_0x15073f[_0x0825('0x32')],function(_0x17703c){var _0x24a804={};_0x24a804[_0x17703c]={'$like':'%'+_0x845b25[_0x0825('0x2f')][_0x0825('0x3a')]+'%'};return _0x24a804;})});}_0x15073f=_['merge']({},_0x15073f,_0x845b25[_0x0825('0x3d')]);return db['UserOpenchannelQueue'][_0x0825('0x40')](_0x15073f);}})[_0x0825('0x24')](function(_0x5ccc8a){if(_0x5ccc8a){return db[_0x0825('0x58')][_0x0825('0x59')]({'where':{'id':_[_0x0825('0x2e')](_0x5ccc8a,_0x0825('0x5a')),'role':_0x0825('0x5b')},'attributes':['id',_0x0825('0x27'),_0x0825('0x5c'),_0x0825('0x5d'),_0x0825('0x5e')]});}})['then'](function(_0x1afaf4){if(_0x1afaf4){return{'count':_0x1afaf4['count'],'rows':_[_0x0825('0x2e')](_0x1afaf4[_0x0825('0x41')],function(_0x4b4991){return{'membername':_0x4b4991['name'],'UserId':_0x4b4991['id'],'queue_name':_0x2450ef[_0x0825('0x27')],'OpenchannelQueueId':_0x2450ef['id'],'interface':util[_0x0825('0x5f')](_0x0825('0x60'),'SIP',_0x4b4991['name']),'penalty':0x0,'paused':_0x4b4991[_0x0825('0x5c')],'createdAt':_0x4b4991[_0x0825('0x5e')],'updatedAt':_0x4b4991[_0x0825('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0825('0x24')](respondWithFilteredResult(_0x21f47b,_0x15073f))[_0x0825('0x42')](handleError(_0x21f47b,null));};exports[_0x0825('0x61')]=function(_0x1b28d6,_0x13efdf,_0x7ac588){var _0x4894c3={};var _0x339ec6={};var _0x197267;var _0x3c1c6c;return db[_0x0825('0x29')][_0x0825('0x55')]({'where':{'id':_0x1b28d6[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x13efdf,null))[_0x0825('0x24')](function(_0x125da7){if(_0x125da7){_0x197267=_0x125da7;_0x339ec6[_0x0825('0x2d')]=_['keys'](db[_0x0825('0x62')]['rawAttributes']);_0x339ec6[_0x0825('0x2f')]=_[_0x0825('0x30')](_0x1b28d6[_0x0825('0x2f')]);_0x339ec6[_0x0825('0x39')]=_['intersection'](_0x339ec6[_0x0825('0x2d')],_0x339ec6[_0x0825('0x2f')]);_0x4894c3[_0x0825('0x32')]=_[_0x0825('0x31')](_0x339ec6[_0x0825('0x2d')],qs[_0x0825('0x45')](_0x1b28d6[_0x0825('0x2f')][_0x0825('0x45')]));_0x4894c3[_0x0825('0x32')]=_0x4894c3['attributes'][_0x0825('0x46')]?_0x4894c3[_0x0825('0x32')]:_0x339ec6[_0x0825('0x2d')];_0x4894c3[_0x0825('0x56')]=qs[_0x0825('0x36')](_0x1b28d6['query'][_0x0825('0x36')]);_0x4894c3[_0x0825('0x37')]=qs[_0x0825('0x39')](_[_0x0825('0x38')](_0x1b28d6['query'],_0x339ec6[_0x0825('0x39')]));if(_0x1b28d6['query']['filter']){_0x4894c3[_0x0825('0x37')]=_[_0x0825('0x3b')](_0x4894c3[_0x0825('0x37')],{'$or':_[_0x0825('0x2e')](_0x4894c3[_0x0825('0x32')],function(_0x7d3977){var _0x286ae0={};_0x286ae0[_0x7d3977]={'$like':'%'+_0x1b28d6[_0x0825('0x2f')]['filter']+'%'};return _0x286ae0;})});}_0x4894c3=_[_0x0825('0x3b')]({},_0x4894c3,_0x1b28d6['options']);return _0x197267[_0x0825('0x61')](_0x4894c3);}})[_0x0825('0x24')](function(_0x4b051d){if(_0x4b051d){_0x3c1c6c=_0x4b051d[_0x0825('0x46')];if(!_0x1b28d6['query'][_0x0825('0x33')]('nolimit')){_0x4894c3[_0x0825('0x35')]=qs['limit'](_0x1b28d6[_0x0825('0x2f')][_0x0825('0x35')]);_0x4894c3[_0x0825('0x1c')]=qs[_0x0825('0x1c')](_0x1b28d6[_0x0825('0x2f')][_0x0825('0x1c')]);}return _0x197267[_0x0825('0x61')](_0x4894c3);}})[_0x0825('0x24')](function(_0xb1c38b){if(_0xb1c38b){return _0xb1c38b?{'count':_0x3c1c6c,'rows':_0xb1c38b}:null;}})[_0x0825('0x24')](respondWithResult(_0x13efdf,null))['catch'](handleError(_0x13efdf,null));};exports['addTeams']=function(_0x170f4f,_0x499d9d,_0x34a7c5){var _0x594e20=_0x170f4f['body'][_0x0825('0x63')];return db[_0x0825('0x62')][_0x0825('0x40')]({'where':{'id':_0x594e20},'attributes':['id'],'include':[{'model':db[_0x0825('0x58')],'as':_0x0825('0x64'),'attributes':['id','name',_0x0825('0x65'),_0x0825('0x66'),'interface'],'raw':!![]}]})['then'](function(_0x593bc5){if(_0x593bc5){var _0x21b90a=_['flatMap'](_0x593bc5,function(_0x38fe7c){var _0x41b8a7=_0x38fe7c[_0x0825('0x4c')]({'plain':!![]});return _0x41b8a7[_0x0825('0x64')];});return db[_0x0825('0x29')][_0x0825('0x48')]({'where':{'id':_0x170f4f[_0x0825('0x44')]['id']}})[_0x0825('0x24')](function(_0x2bf558){return db[_0x0825('0x67')][_0x0825('0x68')](function(_0x5f6804){return _0x2bf558[_0x0825('0x69')](_0x594e20,{'transaction':_0x5f6804})[_0x0825('0x24')](function(){return BPromise[_0x0825('0x6a')](_0x21b90a,function(_0x3c1fbd){return db[_0x0825('0x6b')][_0x0825('0x6c')]({'where':{'UserId':_0x3c1fbd['id'],'OpenchannelQueueId':_0x170f4f[_0x0825('0x44')]['id']},'transaction':_0x5f6804});});})['then'](function(){_0x21b90a['forEach'](function(_0x2822c8){socket[_0x0825('0x6d')](_0x0825('0x6e'),{'UserId':_0x2822c8['id'],'OpenchannelQueueId':_0x2bf558['id']});});});});});}})[_0x0825('0x24')](respondWithStatusCode(_0x499d9d,null))[_0x0825('0x42')](handleError(_0x499d9d,null));};exports['removeTeams']=function(_0x79811,_0xec23ce,_0x525493){return db[_0x0825('0x62')][_0x0825('0x40')]({'where':{'id':_0x79811[_0x0825('0x2f')][_0x0825('0x63')]},'attributes':['id'],'include':[{'model':db[_0x0825('0x58')],'as':_0x0825('0x64'),'attributes':['id'],'raw':!![]}]})[_0x0825('0x24')](handleEntityNotFound(_0xec23ce,null))['then'](function(_0x2ecc13){var _0x15b923=_[_0x0825('0x2e')](_0x2ecc13,'id');var _0x23eadb=[];var _0xb670c2=[];var _0x2cd6cd=squel[_0x0825('0x6f')]();_0x2cd6cd['field'](_0x0825('0x70'))[_0x0825('0x71')](_0x0825('0x72'),'tq')[_0x0825('0x73')](_0x0825('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0825('0x37')]('OpenchannelQueueId\x20=\x20?',_0x79811[_0x0825('0x44')]['id']);for(var _0x5c731b=0x0;_0x5c731b<_0x2ecc13[_0x0825('0x46')];_0x5c731b+=0x1){let _0x1a9133=_0x2ecc13[_0x5c731b];for(var _0x2ca08e=0x0;_0x2ca08e<_0x1a9133[_0x0825('0x64')][_0x0825('0x46')];_0x2ca08e+=0x1){let _0x2ed932=_0x1a9133['Agents'][_0x2ca08e];var _0x1ab35f=_0x2cd6cd['clone']();_0x1ab35f[_0x0825('0x37')](_0x0825('0x75'),_0x2ed932['id']);_0xb670c2[_0x0825('0x76')](db[_0x0825('0x67')][_0x0825('0x2f')](_0x1ab35f[_0x0825('0x77')](),{'type':db['sequelize'][_0x0825('0x78')][_0x0825('0x79')]})[_0x0825('0x24')](function(_0xeccbd4){if(_0xeccbd4[_0x0825('0x46')]===0x1){return _0x2ed932['id'];}else{var _0x41636d=_[_0x0825('0x7a')](_['map'](_0xeccbd4,_0x0825('0x7b')),function(_0xe998af){return _[_0x0825('0x7c')](_0x15b923,_0xe998af);});if(_0x41636d){return _0x2ed932['id'];}}}));}}return BPromise['all'](_0xb670c2)[_0x0825('0x24')](function(_0x1b488c){_0x23eadb=_(_0x23eadb)['union'](_0x1b488c)[_0x0825('0x7d')]()['value']();return db[_0x0825('0x29')][_0x0825('0x48')]({'where':{'id':_0x79811['params']['id']}})[_0x0825('0x24')](function(_0x3b5074){return db[_0x0825('0x67')][_0x0825('0x68')](function(_0x3b5bb4){return _0x3b5074['removeTeams'](_0x79811[_0x0825('0x2f')][_0x0825('0x63')],{'transaction':_0x3b5bb4})[_0x0825('0x24')](function(){if(!_[_0x0825('0x7e')](_0x23eadb)){return _0x3b5074[_0x0825('0x7f')](_0x23eadb,{'transaction':_0x3b5bb4});}})['then'](function(){_0x23eadb['forEach'](function(_0x4b17e7){socket['emit'](_0x0825('0x80'),{'UserId':_0x4b17e7,'OpenchannelQueueId':_0x3b5074['id']});});});});});});})[_0x0825('0x24')](respondWithStatusCode(_0xec23ce,null))[_0x0825('0x42')](handleError(_0xec23ce,null));};exports[_0x0825('0x81')]=function(_0x4ffba6,_0x4f9411,_0x3f3996){return db['OpenchannelQueue'][_0x0825('0x48')]({'where':{'id':_0x4ffba6[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x4f9411,null))[_0x0825('0x24')](function(_0x5a2371){if(_0x5a2371){return _0x5a2371['addAgents'](_0x4ffba6['body']['ids'],_[_0x0825('0x82')](_0x4ffba6[_0x0825('0x4a')],['ids','id'])||{})[_0x0825('0x83')](function(_0x18d674){for(var _0x4dca26=0x0;_0x4dca26<_0x4ffba6[_0x0825('0x4a')][_0x0825('0x63')][_0x0825('0x46')];_0x4dca26+=0x1){socket['emit'](_0x0825('0x6e'),{'UserId':_0x4ffba6[_0x0825('0x4a')][_0x0825('0x63')][_0x4dca26],'OpenchannelQueueId':_0x4ffba6['params']['id']});}return _0x18d674;});}})[_0x0825('0x24')](respondWithResult(_0x4f9411,null))['catch'](handleError(_0x4f9411,null));};exports[_0x0825('0x7f')]=function(_0x244520,_0x5cd017,_0x43ff6d){return db[_0x0825('0x29')][_0x0825('0x48')]({'where':{'id':_0x244520[_0x0825('0x44')]['id']}})['then'](handleEntityNotFound(_0x5cd017,null))[_0x0825('0x24')](function(_0x2f4f1c){if(_0x2f4f1c){return _0x2f4f1c[_0x0825('0x7f')](_0x244520[_0x0825('0x2f')]['ids'])[_0x0825('0x24')](function(){if(_[_0x0825('0x84')](_0x244520[_0x0825('0x2f')][_0x0825('0x63')])){for(var _0x4fb72b=0x0;_0x4fb72b<_0x244520[_0x0825('0x2f')][_0x0825('0x63')]['length'];_0x4fb72b+=0x1){socket[_0x0825('0x6d')](_0x0825('0x80'),{'UserId':Number(_0x244520[_0x0825('0x2f')]['ids'][_0x4fb72b]),'OpenchannelQueueId':Number(_0x244520[_0x0825('0x44')]['id'])});}}else{socket['emit'](_0x0825('0x80'),{'UserId':Number(_0x244520[_0x0825('0x2f')][_0x0825('0x63')]),'OpenchannelQueueId':Number(_0x244520[_0x0825('0x44')]['id'])});}});}})[_0x0825('0x24')](respondWithStatusCode(_0x5cd017,null))['catch'](handleError(_0x5cd017,null));};exports[_0x0825('0x85')]=function(_0xe380c6,_0x4990f1,_0xdbf245){var _0x178a69={};var _0x47260e={};var _0x1bb4a2;var _0x1ff15c;return db[_0x0825('0x29')]['findOne']({'where':{'id':_0xe380c6[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x4990f1,null))['then'](function(_0xbfe7ab){if(_0xbfe7ab){_0x1bb4a2=_0xbfe7ab;_0x47260e[_0x0825('0x2d')]=_[_0x0825('0x30')](db[_0x0825('0x58')][_0x0825('0x2a')]);_0x47260e['query']=_['keys'](_0xe380c6[_0x0825('0x2f')]);_0x47260e[_0x0825('0x39')]=_[_0x0825('0x31')](_0x47260e[_0x0825('0x2d')],_0x47260e[_0x0825('0x2f')]);_0x178a69['attributes']=_['intersection'](_0x47260e[_0x0825('0x2d')],qs[_0x0825('0x45')](_0xe380c6['query'][_0x0825('0x45')]));_0x178a69[_0x0825('0x32')]=_0x178a69['attributes'][_0x0825('0x46')]?_0x178a69[_0x0825('0x32')]:_0x47260e[_0x0825('0x2d')];_0x178a69[_0x0825('0x56')]=qs[_0x0825('0x36')](_0xe380c6['query'][_0x0825('0x36')]);_0x178a69[_0x0825('0x37')]=qs[_0x0825('0x39')](_[_0x0825('0x38')](_0xe380c6[_0x0825('0x2f')],_0x47260e['filters']));if(_0xe380c6[_0x0825('0x2f')][_0x0825('0x3a')]){_0x178a69[_0x0825('0x37')]=_[_0x0825('0x3b')](_0x178a69['where'],{'$or':_[_0x0825('0x2e')](_0x178a69[_0x0825('0x32')],function(_0x411d1c){var _0x47e24b={};_0x47e24b[_0x411d1c]={'$like':'%'+_0xe380c6['query']['filter']+'%'};return _0x47e24b;})});}_0x178a69=_[_0x0825('0x3b')]({},_0x178a69,_0xe380c6[_0x0825('0x3d')]);return _0x1bb4a2[_0x0825('0x85')](_0x178a69);}})[_0x0825('0x24')](function(_0xc4dae5){if(_0xc4dae5){_0x1ff15c=_0xc4dae5[_0x0825('0x46')];if(!_0xe380c6['query'][_0x0825('0x33')](_0x0825('0x34'))){_0x178a69[_0x0825('0x35')]=qs[_0x0825('0x35')](_0xe380c6[_0x0825('0x2f')]['limit']);_0x178a69[_0x0825('0x1c')]=qs[_0x0825('0x1c')](_0xe380c6[_0x0825('0x2f')][_0x0825('0x1c')]);}return _0x1bb4a2['getAgents'](_0x178a69);}})[_0x0825('0x24')](function(_0x39b8a6){if(_0x39b8a6){return _0x39b8a6?{'count':_0x1ff15c,'rows':_0x39b8a6}:null;}})[_0x0825('0x24')](respondWithResult(_0x4990f1,null))[_0x0825('0x42')](handleError(_0x4990f1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2fab714..da72ae4 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 _0xfcbd=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xfcbd,0x129));var _0xdfcb=function(_0x560a6d,_0x42c234){_0x560a6d=_0x560a6d-0x0;var _0x4b29aa=_0xfcbd[_0x560a6d];return _0x4b29aa;};'use strict';var EventEmitter=require(_0xdfcb('0x0'));var OpenchannelQueue=require(_0xdfcb('0x1'))['db'][_0xdfcb('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xdfcb('0x3')](0x0);var events={'afterCreate':_0xdfcb('0x4'),'afterUpdate':_0xdfcb('0x5'),'afterDestroy':_0xdfcb('0x6')};function emitEvent(_0x499e63){return function(_0x1377a8,_0x51bdd4,_0x9a2619){OpenchannelQueueEvents[_0xdfcb('0x7')](_0x499e63+':'+_0x1377a8['id'],_0x1377a8);OpenchannelQueueEvents[_0xdfcb('0x7')](_0x499e63,_0x1377a8);_0x9a2619(null);};}for(var e in events){if(events[_0xdfcb('0x8')](e)){var event=events[e];OpenchannelQueue[_0xdfcb('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x74f6=['OpenchannelQueue','save','update','remove','emit','hook','../../mysqldb'];(function(_0x19cbcc,_0x44384e){var _0x44d405=function(_0x475354){while(--_0x475354){_0x19cbcc['push'](_0x19cbcc['shift']());}};_0x44d405(++_0x44384e);}(_0x74f6,0x102));var _0x674f=function(_0x8a8e00,_0x5daa2d){_0x8a8e00=_0x8a8e00-0x0;var _0x888bdd=_0x74f6[_0x8a8e00];return _0x888bdd;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x674f('0x0'))['db'][_0x674f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x674f('0x2'),'afterUpdate':_0x674f('0x3'),'afterDestroy':_0x674f('0x4')};function emitEvent(_0x313b7f){return function(_0x7efb51,_0x3f860d,_0x2d70f0){OpenchannelQueueEvents[_0x674f('0x5')](_0x313b7f+':'+_0x7efb51['id'],_0x7efb51);OpenchannelQueueEvents[_0x674f('0x5')](_0x313b7f,_0x7efb51);_0x2d70f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x674f('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index a21d2ac..8af9942 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 _0x3930=['OpenchannelQueue','openchannel_queues','util','../../config/logger','api','request-promise','path','./openchannelQueue.attributes','exports','define'];(function(_0x49376c,_0x4a82e9){var _0x246ddc=function(_0x36be9f){while(--_0x36be9f){_0x49376c['push'](_0x49376c['shift']());}};_0x246ddc(++_0x4a82e9);}(_0x3930,0x98));var _0x0393=function(_0x59ae56,_0x1a1aaf){_0x59ae56=_0x59ae56-0x0;var _0x839b0f=_0x3930[_0x59ae56];return _0x839b0f;};'use strict';var _=require('lodash');var util=require(_0x0393('0x0'));var logger=require(_0x0393('0x1'))(_0x0393('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0393('0x3'));var fs=require('fs');var path=require(_0x0393('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0393('0x5'));module[_0x0393('0x6')]=function(_0x545f70,_0x5cf4d4){return _0x545f70[_0x0393('0x7')](_0x0393('0x8'),attributes,{'tableName':_0x0393('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ac=['moment','bluebird','path','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','util','../../config/logger','api'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x53ac,0x16f));var _0xc53a=function(_0x10e0c7,_0x2c288b){_0x10e0c7=_0x10e0c7-0x0;var _0x5e8083=_0x53ac[_0x10e0c7];return _0x5e8083;};'use strict';var _=require('lodash');var util=require(_0xc53a('0x0'));var logger=require(_0xc53a('0x1'))(_0xc53a('0x2'));var moment=require(_0xc53a('0x3'));var BPromise=require(_0xc53a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53a('0x5'));var rimraf=require('rimraf');var config=require(_0xc53a('0x6'));var attributes=require(_0xc53a('0x7'));module['exports']=function(_0x49f1e0,_0x57d3af){return _0x49f1e0[_0xc53a('0x8')](_0xc53a('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index f180ab3..7bf1016 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 _0x5590=['code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','attributes','limit','include','map','model','find','where','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5590,0x1bc));var _0x0559=function(_0x4ebe00,_0x1ad85f){_0x4ebe00=_0x4ebe00-0x0;var _0x38a280=_0x5590[_0x4ebe00];return _0x38a280;};'use strict';var _=require('lodash');var util=require(_0x0559('0x0'));var moment=require(_0x0559('0x1'));var BPromise=require(_0x0559('0x2'));var rs=require(_0x0559('0x3'));var fs=require('fs');var Redis=require(_0x0559('0x4'));var db=require(_0x0559('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0559('0x6'))('rpc');var config=require(_0x0559('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0559('0x8')][_0x0559('0x9')]({'port':0x232a});config[_0x0559('0xa')]=_[_0x0559('0xb')](config[_0x0559('0xa')],{'host':_0x0559('0xc'),'port':0x18eb});var socket=require(_0x0559('0xd'))(new Redis(config[_0x0559('0xa')]));require('./openchannelQueue.socket')[_0x0559('0xe')](socket);function respondWithRpcPromise(_0x3cc30d,_0x584228,_0x5a2fb4){return new BPromise(function(_0x5131be,_0x50368f){return client[_0x0559('0xf')](_0x3cc30d,_0x5a2fb4)[_0x0559('0x10')](function(_0x499a8d){logger[_0x0559('0x11')](_0x0559('0x12'),_0x584228,_0x0559('0x13'));logger[_0x0559('0x14')](_0x0559('0x15'),_0x584228,_0x0559('0x13'),JSON[_0x0559('0x16')](_0x499a8d));if(_0x499a8d[_0x0559('0x17')]){if(_0x499a8d['error'][_0x0559('0x18')]===0x1f4){logger[_0x0559('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x584228,_0x499a8d[_0x0559('0x17')][_0x0559('0x19')]);return _0x50368f(_0x499a8d[_0x0559('0x17')][_0x0559('0x19')]);}logger[_0x0559('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x584228,_0x499a8d['error'][_0x0559('0x19')]);return _0x5131be(_0x499a8d[_0x0559('0x17')][_0x0559('0x19')]);}else{logger[_0x0559('0x11')](_0x0559('0x12'),_0x584228,_0x0559('0x13'));_0x5131be(_0x499a8d['result'][_0x0559('0x19')]);}})[_0x0559('0x1a')](function(_0x2e3eb0){logger[_0x0559('0x17')](_0x0559('0x12'),_0x584228,_0x2e3eb0);_0x50368f(_0x2e3eb0);});});}exports[_0x0559('0x1b')]=function(_0x4a0939){var _0xb9c25d=this;return new Promise(function(_0x1f3c4e,_0x4ecf8f){return db[_0x0559('0x1c')][_0x0559('0x1d')]({'raw':_0x4a0939[_0x0559('0x1e')]?_0x4a0939['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a0939[_0x0559('0x1e')]?_0x4a0939[_0x0559('0x1e')]['where']||null:null,'attributes':_0x4a0939['options']?_0x4a0939[_0x0559('0x1e')][_0x0559('0x1f')]||null:null,'limit':_0x4a0939[_0x0559('0x1e')]?_0x4a0939[_0x0559('0x1e')][_0x0559('0x20')]||null:null,'include':_0x4a0939[_0x0559('0x1e')]?_0x4a0939[_0x0559('0x1e')][_0x0559('0x21')]?_[_0x0559('0x22')](_0x4a0939[_0x0559('0x1e')][_0x0559('0x21')],function(_0x50753d){return{'model':db[_0x50753d[_0x0559('0x23')]],'as':_0x50753d['as'],'attributes':_0x50753d[_0x0559('0x1f')],'include':_0x50753d['include']?_[_0x0559('0x22')](_0x50753d[_0x0559('0x21')],function(_0x42ed9e){return{'model':db[_0x42ed9e[_0x0559('0x23')]],'as':_0x42ed9e['as'],'attributes':_0x42ed9e[_0x0559('0x1f')],'include':_0x42ed9e[_0x0559('0x21')]?_[_0x0559('0x22')](_0x42ed9e['include'],function(_0x1ac24c){return{'model':db[_0x1ac24c[_0x0559('0x23')]],'as':_0x1ac24c['as'],'attributes':_0x1ac24c[_0x0559('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0559('0x10')](function(_0x10eb8f){logger[_0x0559('0x11')](_0x0559('0x1b'),_0x4a0939);logger['debug'](_0x0559('0x1b'),_0x4a0939,JSON[_0x0559('0x16')](_0x10eb8f));_0x1f3c4e(_0x10eb8f);})[_0x0559('0x1a')](function(_0x475f2b){logger[_0x0559('0x17')](_0x0559('0x1b'),_0x475f2b[_0x0559('0x19')],_0x4a0939);_0x4ecf8f(_0xb9c25d['error'](0x1f4,_0x475f2b['message']));});});};exports['ShowOpenchannelQueue']=function(_0x461bb9){var _0x5dd16a=this;return new Promise(function(_0x43e57c,_0x188cdf){return db[_0x0559('0x1c')][_0x0559('0x24')]({'raw':_0x461bb9['options']?_0x461bb9[_0x0559('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x461bb9[_0x0559('0x1e')]?_0x461bb9['options'][_0x0559('0x25')]||null:null,'attributes':_0x461bb9[_0x0559('0x1e')]?_0x461bb9[_0x0559('0x1e')][_0x0559('0x1f')]||null:null,'include':_0x461bb9['options']?_0x461bb9[_0x0559('0x1e')]['include']?_[_0x0559('0x22')](_0x461bb9[_0x0559('0x1e')][_0x0559('0x21')],function(_0x4a3422){return{'model':db[_0x4a3422[_0x0559('0x23')]],'as':_0x4a3422['as'],'attributes':_0x4a3422[_0x0559('0x1f')],'include':_0x4a3422[_0x0559('0x21')]?_[_0x0559('0x22')](_0x4a3422['include'],function(_0x51f5da){return{'model':db[_0x51f5da['model']],'as':_0x51f5da['as'],'attributes':_0x51f5da[_0x0559('0x1f')],'include':_0x51f5da[_0x0559('0x21')]?_[_0x0559('0x22')](_0x51f5da['include'],function(_0x49304c){return{'model':db[_0x49304c[_0x0559('0x23')]],'as':_0x49304c['as'],'attributes':_0x49304c[_0x0559('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0559('0x10')](function(_0x42d32f){logger[_0x0559('0x11')](_0x0559('0x26'),_0x461bb9);logger['debug'](_0x0559('0x26'),_0x461bb9,JSON[_0x0559('0x16')](_0x42d32f));_0x43e57c(_0x42d32f);})[_0x0559('0x1a')](function(_0x11961d){logger[_0x0559('0x17')](_0x0559('0x26'),_0x11961d['message'],_0x461bb9);_0x188cdf(_0x5dd16a[_0x0559('0x17')](0x1f4,_0x11961d[_0x0559('0x19')]));});});}; \ No newline at end of file +var _0x3ea7=['jayson/promise','client','redis','defaults','localhost','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','find','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x3ea7,0x1cd));var _0x73ea=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0x3ea7[_0x3f6e26];return _0x474345;};'use strict';var _=require(_0x73ea('0x0'));var util=require('util');var moment=require(_0x73ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x73ea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73ea('0x3'))['db'];var utils=require(_0x73ea('0x4'));var logger=require('../../config/logger')(_0x73ea('0x5'));var config=require(_0x73ea('0x6'));var jayson=require(_0x73ea('0x7'));var client=jayson[_0x73ea('0x8')]['http']({'port':0x232a});config[_0x73ea('0x9')]=_[_0x73ea('0xa')](config[_0x73ea('0x9')],{'host':_0x73ea('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73ea('0x9')]));require(_0x73ea('0xc'))[_0x73ea('0xd')](socket);function respondWithRpcPromise(_0x4aab60,_0xfd1e6,_0x3c49be){return new BPromise(function(_0x1977ff,_0x25be58){return client['request'](_0x4aab60,_0x3c49be)[_0x73ea('0xe')](function(_0x4f6243){logger[_0x73ea('0xf')](_0x73ea('0x10'),_0xfd1e6,_0x73ea('0x11'));logger[_0x73ea('0x12')](_0x73ea('0x13'),_0xfd1e6,_0x73ea('0x11'),JSON[_0x73ea('0x14')](_0x4f6243));if(_0x4f6243['error']){if(_0x4f6243[_0x73ea('0x15')][_0x73ea('0x16')]===0x1f4){logger['error'](_0x73ea('0x10'),_0xfd1e6,_0x4f6243[_0x73ea('0x15')][_0x73ea('0x17')]);return _0x25be58(_0x4f6243[_0x73ea('0x15')]['message']);}logger[_0x73ea('0x15')](_0x73ea('0x10'),_0xfd1e6,_0x4f6243[_0x73ea('0x15')][_0x73ea('0x17')]);return _0x1977ff(_0x4f6243[_0x73ea('0x15')][_0x73ea('0x17')]);}else{logger[_0x73ea('0xf')](_0x73ea('0x10'),_0xfd1e6,_0x73ea('0x11'));_0x1977ff(_0x4f6243['result'][_0x73ea('0x17')]);}})['catch'](function(_0x3ddd6b){logger[_0x73ea('0x15')](_0x73ea('0x10'),_0xfd1e6,_0x3ddd6b);_0x25be58(_0x3ddd6b);});});}exports[_0x73ea('0x18')]=function(_0xd5a98){var _0x1195ee=this;return new Promise(function(_0x1ced5a,_0x848244){return db[_0x73ea('0x19')]['findAll']({'raw':_0xd5a98[_0x73ea('0x1a')]?_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1b')]===undefined?!![]:![]:!![],'where':_0xd5a98[_0x73ea('0x1a')]?_0xd5a98[_0x73ea('0x1a')]['where']||null:null,'attributes':_0xd5a98['options']?_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1c')]||null:null,'limit':_0xd5a98[_0x73ea('0x1a')]?_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1d')]||null:null,'include':_0xd5a98[_0x73ea('0x1a')]?_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1e')]?_[_0x73ea('0x1f')](_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1e')],function(_0x5d4b06){return{'model':db[_0x5d4b06['model']],'as':_0x5d4b06['as'],'attributes':_0x5d4b06[_0x73ea('0x1c')],'include':_0x5d4b06[_0x73ea('0x1e')]?_[_0x73ea('0x1f')](_0x5d4b06[_0x73ea('0x1e')],function(_0x4f714f){return{'model':db[_0x4f714f[_0x73ea('0x20')]],'as':_0x4f714f['as'],'attributes':_0x4f714f[_0x73ea('0x1c')],'include':_0x4f714f['include']?_[_0x73ea('0x1f')](_0x4f714f[_0x73ea('0x1e')],function(_0x2107cc){return{'model':db[_0x2107cc[_0x73ea('0x20')]],'as':_0x2107cc['as'],'attributes':_0x2107cc[_0x73ea('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59e6af){logger[_0x73ea('0xf')](_0x73ea('0x18'),_0xd5a98);logger[_0x73ea('0x12')](_0x73ea('0x18'),_0xd5a98,JSON[_0x73ea('0x14')](_0x59e6af));_0x1ced5a(_0x59e6af);})['catch'](function(_0x60f27f){logger[_0x73ea('0x15')](_0x73ea('0x18'),_0x60f27f[_0x73ea('0x17')],_0xd5a98);_0x848244(_0x1195ee[_0x73ea('0x15')](0x1f4,_0x60f27f[_0x73ea('0x17')]));});});};exports[_0x73ea('0x21')]=function(_0x3aff8c){var _0x14ddca=this;return new Promise(function(_0x149df0,_0x2c7da1){return db[_0x73ea('0x19')][_0x73ea('0x22')]({'raw':_0x3aff8c[_0x73ea('0x1a')]?_0x3aff8c['options'][_0x73ea('0x1b')]===undefined?!![]:![]:!![],'where':_0x3aff8c[_0x73ea('0x1a')]?_0x3aff8c[_0x73ea('0x1a')]['where']||null:null,'attributes':_0x3aff8c['options']?_0x3aff8c[_0x73ea('0x1a')]['attributes']||null:null,'include':_0x3aff8c['options']?_0x3aff8c[_0x73ea('0x1a')][_0x73ea('0x1e')]?_[_0x73ea('0x1f')](_0x3aff8c['options'][_0x73ea('0x1e')],function(_0x5f4202){return{'model':db[_0x5f4202['model']],'as':_0x5f4202['as'],'attributes':_0x5f4202[_0x73ea('0x1c')],'include':_0x5f4202[_0x73ea('0x1e')]?_['map'](_0x5f4202['include'],function(_0x17848b){return{'model':db[_0x17848b[_0x73ea('0x20')]],'as':_0x17848b['as'],'attributes':_0x17848b['attributes'],'include':_0x17848b[_0x73ea('0x1e')]?_[_0x73ea('0x1f')](_0x17848b['include'],function(_0x427f3c){return{'model':db[_0x427f3c[_0x73ea('0x20')]],'as':_0x427f3c['as'],'attributes':_0x427f3c[_0x73ea('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x73ea('0xe')](function(_0x1bedb6){logger[_0x73ea('0xf')](_0x73ea('0x21'),_0x3aff8c);logger[_0x73ea('0x12')](_0x73ea('0x21'),_0x3aff8c,JSON[_0x73ea('0x14')](_0x1bedb6));_0x149df0(_0x1bedb6);})[_0x73ea('0x23')](function(_0x4ef4b7){logger[_0x73ea('0x15')](_0x73ea('0x21'),_0x4ef4b7[_0x73ea('0x17')],_0x3aff8c);_0x2c7da1(_0x14ddca[_0x73ea('0x15')](0x1f4,_0x4ef4b7[_0x73ea('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b89066d..6e10bb5 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 _0xc578=['length','openchannelQueue:','./openchannelQueue.events','save','update','emit','register'];(function(_0x1531a9,_0x30bd51){var _0x11b216=function(_0x3cc88f){while(--_0x3cc88f){_0x1531a9['push'](_0x1531a9['shift']());}};_0x11b216(++_0x30bd51);}(_0xc578,0x72));var _0x8c57=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xc578[_0x138adb];return _0x1b27f2;};'use strict';var OpenchannelQueueEvents=require(_0x8c57('0x0'));var events=[_0x8c57('0x1'),'remove',_0x8c57('0x2')];function createListener(_0x4b9302,_0x4731a2){return function(_0x44e77a){_0x4731a2[_0x8c57('0x3')](_0x4b9302,_0x44e77a);};}function removeListener(_0x3a3f82,_0x53fd88){return function(){OpenchannelQueueEvents['removeListener'](_0x3a3f82,_0x53fd88);};}exports[_0x8c57('0x4')]=function(_0x347557){for(var _0xcad46e=0x0,_0x413627=events[_0x8c57('0x5')];_0xcad46e<_0x413627;_0xcad46e++){var _0x1ae685=events[_0xcad46e];var _0x444131=createListener(_0x8c57('0x6')+_0x1ae685,_0x347557);OpenchannelQueueEvents['on'](_0x1ae685,_0x444131);}}; \ No newline at end of file +var _0xaab7=['save','remove','update','emit','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xaab7,0xd8));var _0x7aab=function(_0x39405d,_0x3aba83){_0x39405d=_0x39405d-0x0;var _0x104590=_0xaab7[_0x39405d];return _0x104590;};'use strict';var OpenchannelQueueEvents=require(_0x7aab('0x0'));var events=[_0x7aab('0x1'),_0x7aab('0x2'),_0x7aab('0x3')];function createListener(_0x2c1c19,_0x58a1bc){return function(_0x5ae5bf){_0x58a1bc[_0x7aab('0x4')](_0x2c1c19,_0x5ae5bf);};}function removeListener(_0x26787f,_0x5738f7){return function(){OpenchannelQueueEvents['removeListener'](_0x26787f,_0x5738f7);};}exports[_0x7aab('0x5')]=function(_0x508da8){for(var _0x32248f=0x0,_0x3d8d01=events['length'];_0x32248f<_0x3d8d01;_0x32248f++){var _0x2299c5=events[_0x32248f];var _0x72a360=createListener(_0x7aab('0x6')+_0x2299c5,_0x508da8);OpenchannelQueueEvents['on'](_0x2299c5,_0x72a360);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2a1d96b..6f0d5b8 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 _0x9086=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2d9582,_0x4fbf5e){var _0x38a35d=function(_0x5f871c){while(--_0x5f871c){_0x2d9582['push'](_0x2d9582['shift']());}};_0x38a35d(++_0x4fbf5e);}(_0x9086,0x17f));var _0x6908=function(_0x524d24,_0x20b81e){_0x524d24=_0x524d24-0x0;var _0x17e372=_0x9086[_0x524d24];return _0x17e372;};'use strict';var multer=require(_0x6908('0x0'));var util=require(_0x6908('0x1'));var path=require(_0x6908('0x2'));var timeout=require(_0x6908('0x3'));var express=require(_0x6908('0x4'));var router=express[_0x6908('0x5')]();var auth=require(_0x6908('0x6'));var interaction=require(_0x6908('0x7'));var config=require(_0x6908('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0x6908('0x9')]('/',auth[_0x6908('0xa')](),controller[_0x6908('0xb')]);router[_0x6908('0x9')](_0x6908('0xc'),auth['isAuthenticated'](),controller[_0x6908('0xd')]);router['get']('/:id',auth[_0x6908('0xa')](),controller[_0x6908('0xe')]);router[_0x6908('0xf')]('/',auth[_0x6908('0xa')](),controller[_0x6908('0x10')]);router[_0x6908('0x11')]('/:id',auth[_0x6908('0xa')](),controller[_0x6908('0x12')]);router[_0x6908('0x13')](_0x6908('0x14'),auth[_0x6908('0xa')](),controller[_0x6908('0x15')]);module[_0x6908('0x16')]=router; \ No newline at end of file +var _0x2d2d=['/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','/describe','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d2d,0x1f4));var _0xd2d2=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x2d2d[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require('multer');var util=require(_0xd2d2('0x0'));var path=require(_0xd2d2('0x1'));var timeout=require(_0xd2d2('0x2'));var express=require(_0xd2d2('0x3'));var router=express[_0xd2d2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd2d2('0x5'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0xd2d2('0x6')](),controller[_0xd2d2('0x7')]);router['get'](_0xd2d2('0x8'),auth[_0xd2d2('0x6')](),controller['describe']);router[_0xd2d2('0x9')](_0xd2d2('0xa'),auth[_0xd2d2('0x6')](),controller[_0xd2d2('0xb')]);router[_0xd2d2('0xc')]('/',auth[_0xd2d2('0x6')](),controller[_0xd2d2('0xd')]);router[_0xd2d2('0xe')](_0xd2d2('0xa'),auth[_0xd2d2('0x6')](),controller[_0xd2d2('0xf')]);router['delete'](_0xd2d2('0xa'),auth['isAuthenticated'](),controller[_0xd2d2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 4627b28..26ec839 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 _0x3f82=['moment','STRING','DATE'];(function(_0x57311b,_0x2b709b){var _0x3e6385=function(_0x48ad74){while(--_0x48ad74){_0x57311b['push'](_0x57311b['shift']());}};_0x3e6385(++_0x2b709b);}(_0x3f82,0x1f2));var _0x23f8=function(_0x2520de,_0x39b56b){_0x2520de=_0x2520de-0x0;var _0x2bbe9c=_0x3f82[_0x2520de];return _0x2bbe9c;};'use strict';var moment=require(_0x23f8('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x23f8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x23f8('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x23f8('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x23f8('0x2')]},'reason':{'type':Sequelize[_0x23f8('0x1')]}}; \ No newline at end of file +var _0x179f=['STRING','DATE','moment','sequelize','exports'];(function(_0x21adfd,_0x59e3ed){var _0x49909b=function(_0x497842){while(--_0x497842){_0x21adfd['push'](_0x21adfd['shift']());}};_0x49909b(++_0x59e3ed);}(_0x179f,0x1ec));var _0xf179=function(_0x3fd85b,_0x5dbe9f){_0x3fd85b=_0x3fd85b-0x0;var _0x1f8822=_0x179f[_0x3fd85b];return _0x1f8822;};'use strict';var moment=require(_0xf179('0x0'));var Sequelize=require(_0xf179('0x1'));module[_0xf179('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf179('0x3')]},'joinAt':{'type':Sequelize[_0xf179('0x4')]},'leaveAt':{'type':Sequelize[_0xf179('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf179('0x4')]},'reason':{'type':Sequelize[_0xf179('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 7d6966a..c2dce17 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 _0x3b94=['reject','save','destroy','then','name','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','params','keys','length','include','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','apply'];(function(_0x3a33d7,_0x428ab0){var _0x2ad048=function(_0x1e18cf){while(--_0x1e18cf){_0x3a33d7['push'](_0x3a33d7['shift']());}};_0x2ad048(++_0x428ab0);}(_0x3b94,0xb3));var _0x43b9=function(_0x41acf4,_0x45f994){_0x41acf4=_0x41acf4-0x0;var _0x5a2eab=_0x3b94[_0x41acf4];return _0x5a2eab;};'use strict';var pdf=require(_0x43b9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43b9('0x1'));var zipdir=require(_0x43b9('0x2'));var jsonpatch=require(_0x43b9('0x3'));var rp=require(_0x43b9('0x4'));var moment=require('moment');var BPromise=require(_0x43b9('0x5'));var Mustache=require('mustache');var util=require(_0x43b9('0x6'));var path=require('path');var sox=require(_0x43b9('0x7'));var csv=require('to-csv');var ejs=require(_0x43b9('0x8'));var fs=require('fs');var _=require(_0x43b9('0x9'));var squel=require(_0x43b9('0xa'));var crypto=require(_0x43b9('0xb'));var jsforce=require(_0x43b9('0xc'));var deskjs=require(_0x43b9('0xd'));var toCsv=require(_0x43b9('0xe'));var querystring=require(_0x43b9('0xf'));var Papa=require(_0x43b9('0x10'));var Redis=require('ioredis');var authService=require(_0x43b9('0x11'));var qs=require(_0x43b9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43b9('0x13'));var logger=require(_0x43b9('0x14'))(_0x43b9('0x15'));var utils=require(_0x43b9('0x16'));var config=require(_0x43b9('0x17'));var db=require(_0x43b9('0x18'))['db'];function respondWithStatusCode(_0x227f0b,_0x43abdb){_0x43abdb=_0x43abdb||0xcc;return function(_0x22ad83){if(_0x22ad83){return _0x227f0b[_0x43b9('0x19')](_0x43abdb);}return _0x227f0b[_0x43b9('0x1a')](_0x43abdb)[_0x43b9('0x1b')]();};}function respondWithResult(_0x3edd06,_0x1aef77){_0x1aef77=_0x1aef77||0xc8;return function(_0xc1b8f5){if(_0xc1b8f5){return _0x3edd06[_0x43b9('0x1a')](_0x1aef77)[_0x43b9('0x1c')](_0xc1b8f5);}};}function respondWithFilteredResult(_0x4cdd4c,_0x53d974){return function(_0x3df370){if(_0x3df370){var _0x3bd84f=_0x3df370['count'],_0xbeb065=_0x53d974['offset'],_0x2f3b5f=_0x53d974['offset']+_0x53d974[_0x43b9('0x1d')],_0x312116;if(_0x2f3b5f>=_0x3bd84f){_0x2f3b5f=_0x3bd84f;_0x312116=0xc8;}else{_0x312116=0xce;}_0x4cdd4c['status'](_0x312116);return _0x4cdd4c['set']('Content-Range',_0xbeb065+'-'+_0x2f3b5f+'/'+_0x3bd84f)[_0x43b9('0x1c')](_0x3df370);}return null;};}function patchUpdates(_0xa3efde){return function(_0x5382ca){try{jsonpatch[_0x43b9('0x1e')](_0x5382ca,_0xa3efde,!![]);}catch(_0x4b41aa){return BPromise[_0x43b9('0x1f')](_0x4b41aa);}return _0x5382ca[_0x43b9('0x20')]();};}function saveUpdates(_0x5dd817,_0x58f5a2){return function(_0x5a97fc){if(_0x5a97fc){return _0x5a97fc['update'](_0x5dd817)['then'](function(_0x19cbd7){return _0x19cbd7;});}return null;};}function removeEntity(_0x48c7be,_0x296660){return function(_0x5db5c5){if(_0x5db5c5){return _0x5db5c5[_0x43b9('0x21')]()[_0x43b9('0x22')](function(){_0x48c7be[_0x43b9('0x1a')](0xcc)[_0x43b9('0x1b')]();});}};}function handleEntityNotFound(_0x5218a8,_0x3730b4){return function(_0x12e02e){if(!_0x12e02e){_0x5218a8['sendStatus'](0x194);}return _0x12e02e;};}function handleError(_0x47a85d,_0x1db45c){_0x1db45c=_0x1db45c||0x1f4;return function(_0x87be88){logger['error'](_0x87be88['stack']);if(_0x87be88[_0x43b9('0x23')]){delete _0x87be88[_0x43b9('0x23')];}_0x47a85d[_0x43b9('0x1a')](_0x1db45c)['send'](_0x87be88);};}exports[_0x43b9('0x24')]=function(_0x3a25ed,_0x27a68a){var _0x5ab635={},_0x129982={},_0x486794={'count':0x0,'rows':[]};var _0x15faef=_['map'](db[_0x43b9('0x25')][_0x43b9('0x26')],function(_0x116890){return{'name':_0x116890[_0x43b9('0x27')],'type':_0x116890[_0x43b9('0x28')][_0x43b9('0x29')]};});_0x129982[_0x43b9('0x2a')]=_[_0x43b9('0x2b')](_0x15faef,_0x43b9('0x23'));_0x129982[_0x43b9('0x2c')]=_['keys'](_0x3a25ed[_0x43b9('0x2c')]);_0x129982[_0x43b9('0x2d')]=_[_0x43b9('0x2e')](_0x129982[_0x43b9('0x2a')],_0x129982[_0x43b9('0x2c')]);_0x5ab635['attributes']=_[_0x43b9('0x2e')](_0x129982['model'],qs[_0x43b9('0x2f')](_0x3a25ed[_0x43b9('0x2c')]['fields']));_0x5ab635['attributes']=_0x5ab635[_0x43b9('0x30')]['length']?_0x5ab635[_0x43b9('0x30')]:_0x129982[_0x43b9('0x2a')];if(!_0x3a25ed[_0x43b9('0x2c')][_0x43b9('0x31')](_0x43b9('0x32'))){_0x5ab635[_0x43b9('0x1d')]=qs['limit'](_0x3a25ed['query']['limit']);_0x5ab635['offset']=qs['offset'](_0x3a25ed[_0x43b9('0x2c')][_0x43b9('0x33')]);}_0x5ab635['order']=qs[_0x43b9('0x34')](_0x3a25ed['query'][_0x43b9('0x34')]);_0x5ab635['where']=qs[_0x43b9('0x2d')](_['pick'](_0x3a25ed['query'],_0x129982[_0x43b9('0x2d')]),_0x15faef);if(_0x3a25ed[_0x43b9('0x2c')][_0x43b9('0x35')]){_0x5ab635[_0x43b9('0x36')]=_[_0x43b9('0x37')](_0x5ab635[_0x43b9('0x36')],{'$or':_[_0x43b9('0x2b')](_0x15faef,function(_0x43230d){if(_0x43230d[_0x43b9('0x28')]!==_0x43b9('0x38')){var _0x5d7f31={};_0x5d7f31[_0x43230d[_0x43b9('0x23')]]={'$like':'%'+_0x3a25ed[_0x43b9('0x2c')]['filter']+'%'};return _0x5d7f31;}})});}_0x5ab635=_[_0x43b9('0x37')]({},_0x5ab635,_0x3a25ed['options']);var _0x30cd6c={'where':_0x5ab635[_0x43b9('0x36')]};return db['OpenchannelQueueReport']['count'](_0x30cd6c)[_0x43b9('0x22')](function(_0x1ada05){_0x486794[_0x43b9('0x39')]=_0x1ada05;if(_0x3a25ed['query'][_0x43b9('0x3a')]){_0x5ab635['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x43b9('0x3b')](_0x5ab635);})[_0x43b9('0x22')](function(_0x35e6af){_0x486794[_0x43b9('0x3c')]=_0x35e6af;return _0x486794;})['then'](respondWithFilteredResult(_0x27a68a,_0x5ab635))[_0x43b9('0x3d')](handleError(_0x27a68a,null));};exports['show']=function(_0x3570a6,_0x228bb6){var _0x1858f0={'raw':!![],'where':{'id':_0x3570a6[_0x43b9('0x3e')]['id']}},_0x524c3d={};_0x524c3d[_0x43b9('0x2a')]=_[_0x43b9('0x3f')](db[_0x43b9('0x25')][_0x43b9('0x26')]);_0x524c3d[_0x43b9('0x2c')]=_[_0x43b9('0x3f')](_0x3570a6[_0x43b9('0x2c')]);_0x524c3d[_0x43b9('0x2d')]=_['intersection'](_0x524c3d[_0x43b9('0x2a')],_0x524c3d[_0x43b9('0x2c')]);_0x1858f0[_0x43b9('0x30')]=_[_0x43b9('0x2e')](_0x524c3d[_0x43b9('0x2a')],qs['fields'](_0x3570a6['query']['fields']));_0x1858f0['attributes']=_0x1858f0[_0x43b9('0x30')][_0x43b9('0x40')]?_0x1858f0[_0x43b9('0x30')]:_0x524c3d[_0x43b9('0x2a')];if(_0x3570a6['query']['includeAll']){_0x1858f0[_0x43b9('0x41')]=[{'all':!![]}];}_0x1858f0=_['merge']({},_0x1858f0,_0x3570a6['options']);return db[_0x43b9('0x25')][_0x43b9('0x42')](_0x1858f0)[_0x43b9('0x22')](handleEntityNotFound(_0x228bb6,null))['then'](respondWithResult(_0x228bb6,null))[_0x43b9('0x3d')](handleError(_0x228bb6,null));};exports[_0x43b9('0x43')]=function(_0x3e7eab,_0x5613d9){return db['OpenchannelQueueReport'][_0x43b9('0x43')](_0x3e7eab[_0x43b9('0x44')],{})[_0x43b9('0x22')](respondWithResult(_0x5613d9,0xc9))[_0x43b9('0x3d')](handleError(_0x5613d9,null));};exports['update']=function(_0x3c27ac,_0x39eebe){if(_0x3c27ac[_0x43b9('0x44')]['id']){delete _0x3c27ac['body']['id'];}return db[_0x43b9('0x25')][_0x43b9('0x42')]({'where':{'id':_0x3c27ac[_0x43b9('0x3e')]['id']}})[_0x43b9('0x22')](handleEntityNotFound(_0x39eebe,null))[_0x43b9('0x22')](saveUpdates(_0x3c27ac[_0x43b9('0x44')],null))[_0x43b9('0x22')](respondWithResult(_0x39eebe,null))[_0x43b9('0x3d')](handleError(_0x39eebe,null));};exports[_0x43b9('0x21')]=function(_0x3ba1f6,_0x39ebc3){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3ba1f6['params']['id']}})[_0x43b9('0x22')](handleEntityNotFound(_0x39ebc3,null))[_0x43b9('0x22')](removeEntity(_0x39ebc3,null))['catch'](handleError(_0x39ebc3,null));};exports[_0x43b9('0x45')]=function(_0x374c5a,_0x2b0657){return db[_0x43b9('0x25')]['describe']()[_0x43b9('0x22')](respondWithResult(_0x2b0657,null))[_0x43b9('0x3d')](handleError(_0x2b0657,null));}; \ No newline at end of file +var _0x94d4=['type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','findAll','show','params','length','options','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName'];(function(_0x4d830c,_0x459112){var _0x5913a4=function(_0x559421){while(--_0x559421){_0x4d830c['push'](_0x4d830c['shift']());}};_0x5913a4(++_0x459112);}(_0x94d4,0xa5));var _0x494d=function(_0x4e8975,_0xabfb8b){_0x4e8975=_0x4e8975-0x0;var _0x437b49=_0x94d4[_0x4e8975];return _0x437b49;};'use strict';var pdf=require(_0x494d('0x0'));var emlformat=require(_0x494d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x494d('0x2'));var jsonpatch=require(_0x494d('0x3'));var rp=require(_0x494d('0x4'));var moment=require('moment');var BPromise=require(_0x494d('0x5'));var Mustache=require(_0x494d('0x6'));var util=require(_0x494d('0x7'));var path=require(_0x494d('0x8'));var sox=require(_0x494d('0x9'));var csv=require(_0x494d('0xa'));var ejs=require(_0x494d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x494d('0xc'));var deskjs=require(_0x494d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x494d('0xe'));var Redis=require(_0x494d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x494d('0x10'));var as=require(_0x494d('0x11'));var hardwareService=require(_0x494d('0x12'));var logger=require(_0x494d('0x13'))('api');var utils=require(_0x494d('0x14'));var config=require(_0x494d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50c3db,_0x56fc3a){_0x56fc3a=_0x56fc3a||0xcc;return function(_0x12ca37){if(_0x12ca37){return _0x50c3db[_0x494d('0x16')](_0x56fc3a);}return _0x50c3db[_0x494d('0x17')](_0x56fc3a)[_0x494d('0x18')]();};}function respondWithResult(_0x3bc5c9,_0x2c89c9){_0x2c89c9=_0x2c89c9||0xc8;return function(_0x2dc608){if(_0x2dc608){return _0x3bc5c9[_0x494d('0x17')](_0x2c89c9)[_0x494d('0x19')](_0x2dc608);}};}function respondWithFilteredResult(_0x441d77,_0x263405){return function(_0x5c2c67){if(_0x5c2c67){var _0x22f04f=_0x5c2c67[_0x494d('0x1a')],_0x215a65=_0x263405[_0x494d('0x1b')],_0x2a2917=_0x263405[_0x494d('0x1b')]+_0x263405[_0x494d('0x1c')],_0x3012e3;if(_0x2a2917>=_0x22f04f){_0x2a2917=_0x22f04f;_0x3012e3=0xc8;}else{_0x3012e3=0xce;}_0x441d77[_0x494d('0x17')](_0x3012e3);return _0x441d77[_0x494d('0x1d')](_0x494d('0x1e'),_0x215a65+'-'+_0x2a2917+'/'+_0x22f04f)[_0x494d('0x19')](_0x5c2c67);}return null;};}function patchUpdates(_0xb2fc39){return function(_0x23997d){try{jsonpatch[_0x494d('0x1f')](_0x23997d,_0xb2fc39,!![]);}catch(_0x3e4be3){return BPromise[_0x494d('0x20')](_0x3e4be3);}return _0x23997d['save']();};}function saveUpdates(_0x2be3b5,_0x172763){return function(_0xb7ed29){if(_0xb7ed29){return _0xb7ed29[_0x494d('0x21')](_0x2be3b5)['then'](function(_0x5ea684){return _0x5ea684;});}return null;};}function removeEntity(_0x3eaf7e,_0x15a532){return function(_0x56e992){if(_0x56e992){return _0x56e992['destroy']()[_0x494d('0x22')](function(){_0x3eaf7e['status'](0xcc)[_0x494d('0x18')]();});}};}function handleEntityNotFound(_0x52f26d,_0x2be6f0){return function(_0x29220e){if(!_0x29220e){_0x52f26d['sendStatus'](0x194);}return _0x29220e;};}function handleError(_0x2fdb5b,_0xc107f4){_0xc107f4=_0xc107f4||0x1f4;return function(_0x2ca20c){logger[_0x494d('0x23')](_0x2ca20c[_0x494d('0x24')]);if(_0x2ca20c['name']){delete _0x2ca20c[_0x494d('0x25')];}_0x2fdb5b[_0x494d('0x17')](_0xc107f4)['send'](_0x2ca20c);};}exports['index']=function(_0x180b0d,_0x43a3a5){var _0x37253a={},_0x2c025d={},_0xf466f={'count':0x0,'rows':[]};var _0x3a181b=_[_0x494d('0x26')](db[_0x494d('0x27')][_0x494d('0x28')],function(_0x2d9615){return{'name':_0x2d9615[_0x494d('0x29')],'type':_0x2d9615[_0x494d('0x2a')][_0x494d('0x2b')]};});_0x2c025d['model']=_[_0x494d('0x26')](_0x3a181b,_0x494d('0x25'));_0x2c025d[_0x494d('0x2c')]=_[_0x494d('0x2d')](_0x180b0d[_0x494d('0x2c')]);_0x2c025d[_0x494d('0x2e')]=_[_0x494d('0x2f')](_0x2c025d[_0x494d('0x30')],_0x2c025d[_0x494d('0x2c')]);_0x37253a[_0x494d('0x31')]=_['intersection'](_0x2c025d[_0x494d('0x30')],qs[_0x494d('0x32')](_0x180b0d['query'][_0x494d('0x32')]));_0x37253a[_0x494d('0x31')]=_0x37253a['attributes']['length']?_0x37253a[_0x494d('0x31')]:_0x2c025d['model'];if(!_0x180b0d[_0x494d('0x2c')][_0x494d('0x33')](_0x494d('0x34'))){_0x37253a[_0x494d('0x1c')]=qs['limit'](_0x180b0d['query'][_0x494d('0x1c')]);_0x37253a[_0x494d('0x1b')]=qs[_0x494d('0x1b')](_0x180b0d['query']['offset']);}_0x37253a[_0x494d('0x35')]=qs[_0x494d('0x36')](_0x180b0d['query'][_0x494d('0x36')]);_0x37253a[_0x494d('0x37')]=qs[_0x494d('0x2e')](_['pick'](_0x180b0d['query'],_0x2c025d['filters']),_0x3a181b);if(_0x180b0d[_0x494d('0x2c')]['filter']){_0x37253a['where']=_[_0x494d('0x38')](_0x37253a[_0x494d('0x37')],{'$or':_[_0x494d('0x26')](_0x3a181b,function(_0x3ac9fb){if(_0x3ac9fb[_0x494d('0x2a')]!=='VIRTUAL'){var _0x25aa0b={};_0x25aa0b[_0x3ac9fb[_0x494d('0x25')]]={'$like':'%'+_0x180b0d[_0x494d('0x2c')][_0x494d('0x39')]+'%'};return _0x25aa0b;}})});}_0x37253a=_[_0x494d('0x38')]({},_0x37253a,_0x180b0d['options']);var _0x2a8d3a={'where':_0x37253a[_0x494d('0x37')]};return db['OpenchannelQueueReport'][_0x494d('0x1a')](_0x2a8d3a)[_0x494d('0x22')](function(_0x28223f){_0xf466f['count']=_0x28223f;if(_0x180b0d[_0x494d('0x2c')][_0x494d('0x3a')]){_0x37253a['include']=[{'all':!![]}];}return db[_0x494d('0x27')][_0x494d('0x3b')](_0x37253a);})[_0x494d('0x22')](function(_0x554239){_0xf466f['rows']=_0x554239;return _0xf466f;})[_0x494d('0x22')](respondWithFilteredResult(_0x43a3a5,_0x37253a))['catch'](handleError(_0x43a3a5,null));};exports[_0x494d('0x3c')]=function(_0x3c1a8c,_0x201a93){var _0x5ce269={'raw':!![],'where':{'id':_0x3c1a8c[_0x494d('0x3d')]['id']}},_0x3a9a30={};_0x3a9a30['model']=_[_0x494d('0x2d')](db[_0x494d('0x27')]['rawAttributes']);_0x3a9a30[_0x494d('0x2c')]=_[_0x494d('0x2d')](_0x3c1a8c['query']);_0x3a9a30[_0x494d('0x2e')]=_[_0x494d('0x2f')](_0x3a9a30[_0x494d('0x30')],_0x3a9a30[_0x494d('0x2c')]);_0x5ce269['attributes']=_[_0x494d('0x2f')](_0x3a9a30[_0x494d('0x30')],qs[_0x494d('0x32')](_0x3c1a8c[_0x494d('0x2c')]['fields']));_0x5ce269['attributes']=_0x5ce269[_0x494d('0x31')][_0x494d('0x3e')]?_0x5ce269['attributes']:_0x3a9a30[_0x494d('0x30')];if(_0x3c1a8c[_0x494d('0x2c')][_0x494d('0x3a')]){_0x5ce269['include']=[{'all':!![]}];}_0x5ce269=_['merge']({},_0x5ce269,_0x3c1a8c[_0x494d('0x3f')]);return db[_0x494d('0x27')][_0x494d('0x40')](_0x5ce269)[_0x494d('0x22')](handleEntityNotFound(_0x201a93,null))[_0x494d('0x22')](respondWithResult(_0x201a93,null))[_0x494d('0x41')](handleError(_0x201a93,null));};exports[_0x494d('0x42')]=function(_0x3e34a8,_0x4155ac){return db[_0x494d('0x27')][_0x494d('0x42')](_0x3e34a8[_0x494d('0x43')],{})['then'](respondWithResult(_0x4155ac,0xc9))[_0x494d('0x41')](handleError(_0x4155ac,null));};exports[_0x494d('0x21')]=function(_0x184027,_0x284e64){if(_0x184027[_0x494d('0x43')]['id']){delete _0x184027[_0x494d('0x43')]['id'];}return db[_0x494d('0x27')][_0x494d('0x40')]({'where':{'id':_0x184027['params']['id']}})[_0x494d('0x22')](handleEntityNotFound(_0x284e64,null))[_0x494d('0x22')](saveUpdates(_0x184027[_0x494d('0x43')],null))[_0x494d('0x22')](respondWithResult(_0x284e64,null))[_0x494d('0x41')](handleError(_0x284e64,null));};exports['destroy']=function(_0x526bda,_0x261a92){return db['OpenchannelQueueReport'][_0x494d('0x40')]({'where':{'id':_0x526bda[_0x494d('0x3d')]['id']}})[_0x494d('0x22')](handleEntityNotFound(_0x261a92,null))[_0x494d('0x22')](removeEntity(_0x261a92,null))['catch'](handleError(_0x261a92,null));};exports[_0x494d('0x44')]=function(_0xbfb68,_0x529e3b){return db[_0x494d('0x27')][_0x494d('0x44')]()[_0x494d('0x22')](respondWithResult(_0x529e3b,null))[_0x494d('0x41')](handleError(_0x529e3b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 1f6e52b..453364d 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 _0xb203=['request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x92e8f3,_0x3bedc5){var _0x319e72=function(_0x33b484){while(--_0x33b484){_0x92e8f3['push'](_0x92e8f3['shift']());}};_0x319e72(++_0x3bedc5);}(_0xb203,0x78));var _0x3b20=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb203[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x3b20('0x0'));var util=require(_0x3b20('0x1'));var logger=require(_0x3b20('0x2'))(_0x3b20('0x3'));var moment=require(_0x3b20('0x4'));var BPromise=require(_0x3b20('0x5'));var rp=require(_0x3b20('0x6'));var fs=require('fs');var path=require(_0x3b20('0x7'));var rimraf=require(_0x3b20('0x8'));var config=require(_0x3b20('0x9'));var attributes=require('./openchannelQueueReport.attributes');module[_0x3b20('0xa')]=function(_0x214fb2,_0x31f78e){return _0x214fb2[_0x3b20('0xb')](_0x3b20('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x3b20('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x11b1=['lodash','moment','bluebird','request-promise','rimraf','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid'];(function(_0x1c6f10,_0x5eed05){var _0x5a9683=function(_0x1ea102){while(--_0x1ea102){_0x1c6f10['push'](_0x1c6f10['shift']());}};_0x5a9683(++_0x5eed05);}(_0x11b1,0xfa));var _0x111b=function(_0x3e04f3,_0x18b199){_0x3e04f3=_0x3e04f3-0x0;var _0xe992ce=_0x11b1[_0x3e04f3];return _0xe992ce;};'use strict';var _=require(_0x111b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x111b('0x1'));var BPromise=require(_0x111b('0x2'));var rp=require(_0x111b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x111b('0x4'));var config=require('../../config/environment');var attributes=require(_0x111b('0x5'));module['exports']=function(_0x194cd5,_0x2e5260){return _0x194cd5[_0x111b('0x6')](_0x111b('0x7'),attributes,{'tableName':_0x111b('0x8'),'paranoid':![],'indexes':[{'name':_0x111b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 6f71574..1c880be 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 _0xa3e8=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','where','attributes','limit','debug','lodash','util'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xa3e8,0x127));var _0x8a3e=function(_0x384ca2,_0x520a6c){_0x384ca2=_0x384ca2-0x0;var _0x489427=_0xa3e8[_0x384ca2];return _0x489427;};'use strict';var _=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var moment=require(_0x8a3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a3e('0x3'));var fs=require('fs');var Redis=require(_0x8a3e('0x4'));var db=require(_0x8a3e('0x5'))['db'];var utils=require(_0x8a3e('0x6'));var logger=require(_0x8a3e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a3e('0x8')][_0x8a3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2052a8,_0x5a2a25,_0x27f08d){return new BPromise(function(_0x4c7f41,_0x437cde){return client[_0x8a3e('0xa')](_0x2052a8,_0x27f08d)[_0x8a3e('0xb')](function(_0x402a96){logger[_0x8a3e('0xc')](_0x8a3e('0xd'),_0x5a2a25,_0x8a3e('0xe'));logger['debug'](_0x8a3e('0xf'),_0x5a2a25,_0x8a3e('0xe'),JSON[_0x8a3e('0x10')](_0x402a96));if(_0x402a96['error']){if(_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x12')]===0x1f4){logger[_0x8a3e('0x11')](_0x8a3e('0xd'),_0x5a2a25,_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x13')]);return _0x437cde(_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x13')]);}logger[_0x8a3e('0x11')](_0x8a3e('0xd'),_0x5a2a25,_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x13')]);return _0x4c7f41(_0x402a96[_0x8a3e('0x11')]['message']);}else{logger[_0x8a3e('0xc')](_0x8a3e('0xd'),_0x5a2a25,_0x8a3e('0xe'));_0x4c7f41(_0x402a96[_0x8a3e('0x14')][_0x8a3e('0x13')]);}})[_0x8a3e('0x15')](function(_0x48e5a8){logger[_0x8a3e('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5a2a25,_0x48e5a8);_0x437cde(_0x48e5a8);});});}exports['CreateOpenchannelQueueReport']=function(_0x2f0b46){var _0xb2f9c3=this;return new Promise(function(_0xcb1a1f,_0xe36063){return db[_0x8a3e('0x16')][_0x8a3e('0x17')](_0x2f0b46[_0x8a3e('0x18')],{'raw':_0x2f0b46[_0x8a3e('0x19')]?_0x2f0b46['options'][_0x8a3e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x103eab){logger[_0x8a3e('0xc')](_0x8a3e('0x1b'),_0x2f0b46);logger['debug'](_0x8a3e('0x1b'),_0x2f0b46,JSON[_0x8a3e('0x10')](_0x103eab));_0xcb1a1f(_0x103eab);})['catch'](function(_0x316594){logger[_0x8a3e('0x11')](_0x8a3e('0x1b'),_0x316594[_0x8a3e('0x13')],_0x2f0b46);_0xe36063(_0xb2f9c3[_0x8a3e('0x11')](0x1f4,_0x316594[_0x8a3e('0x13')]));});});};exports[_0x8a3e('0x1c')]=function(_0x422303){var _0x328c45=this;return new Promise(function(_0x36d365,_0x41a6ff){return db[_0x8a3e('0x16')]['update'](_0x422303[_0x8a3e('0x18')],{'raw':_0x422303['options']?_0x422303[_0x8a3e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x422303[_0x8a3e('0x19')]?_0x422303[_0x8a3e('0x19')][_0x8a3e('0x1d')]||null:null,'attributes':_0x422303[_0x8a3e('0x19')]?_0x422303[_0x8a3e('0x19')][_0x8a3e('0x1e')]||null:null,'limit':_0x422303[_0x8a3e('0x19')]?_0x422303['options'][_0x8a3e('0x1f')]||null:null})[_0x8a3e('0xb')](function(_0xf80a64){logger[_0x8a3e('0xc')](_0x8a3e('0x1c'),_0x422303);logger[_0x8a3e('0x20')](_0x8a3e('0x1c'),_0x422303,JSON['stringify'](_0xf80a64));_0x36d365(_0xf80a64);})[_0x8a3e('0x15')](function(_0x463efc){logger[_0x8a3e('0x11')](_0x8a3e('0x1c'),_0x463efc[_0x8a3e('0x13')],_0x422303);_0x41a6ff(_0x328c45[_0x8a3e('0x11')](0x1f4,_0x463efc[_0x8a3e('0x13')]));});});}; \ No newline at end of file +var _0xd906=['http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','then','catch','UpdateOpenchannelQueueReport','where','attributes','limit','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x38e136,_0x3936b5){var _0x4146fd=function(_0x1e5a58){while(--_0x1e5a58){_0x38e136['push'](_0x38e136['shift']());}};_0x4146fd(++_0x3936b5);}(_0xd906,0x6b));var _0x6d90=function(_0x4c9cb5,_0xcf85d4){_0x4c9cb5=_0x4c9cb5-0x0;var _0x20310b=_0xd906[_0x4c9cb5];return _0x20310b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d90('0x0'));var BPromise=require(_0x6d90('0x1'));var rs=require(_0x6d90('0x2'));var fs=require('fs');var Redis=require(_0x6d90('0x3'));var db=require(_0x6d90('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d90('0x5'))(_0x6d90('0x6'));var config=require(_0x6d90('0x7'));var jayson=require(_0x6d90('0x8'));var client=jayson['client'][_0x6d90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19eb61,_0xd120f6,_0x160c7d){return new BPromise(function(_0x219737,_0x5d0ed4){return client['request'](_0x19eb61,_0x160c7d)['then'](function(_0x41c0a3){logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));logger[_0x6d90('0xd')](_0x6d90('0xe'),_0xd120f6,_0x6d90('0xc'),JSON['stringify'](_0x41c0a3));if(_0x41c0a3[_0x6d90('0xf')]){if(_0x41c0a3['error'][_0x6d90('0x10')]===0x1f4){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);return _0x5d0ed4(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}logger[_0x6d90('0xf')](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')]['message']);return _0x219737(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}else{logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));_0x219737(_0x41c0a3['result'][_0x6d90('0x11')]);}})['catch'](function(_0x379439){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x379439);_0x5d0ed4(_0x379439);});});}exports[_0x6d90('0x12')]=function(_0x352736){var _0x3d37c6=this;return new Promise(function(_0x4e6682,_0x5dd53c){return db[_0x6d90('0x13')]['create'](_0x352736[_0x6d90('0x14')],{'raw':_0x352736[_0x6d90('0x15')]?_0x352736['options']['raw']===undefined?!![]:![]:!![]})[_0x6d90('0x16')](function(_0x2ca50e){logger[_0x6d90('0xa')]('CreateOpenchannelQueueReport',_0x352736);logger['debug']('CreateOpenchannelQueueReport',_0x352736,JSON['stringify'](_0x2ca50e));_0x4e6682(_0x2ca50e);})[_0x6d90('0x17')](function(_0x5703e6){logger[_0x6d90('0xf')](_0x6d90('0x12'),_0x5703e6[_0x6d90('0x11')],_0x352736);_0x5dd53c(_0x3d37c6[_0x6d90('0xf')](0x1f4,_0x5703e6[_0x6d90('0x11')]));});});};exports[_0x6d90('0x18')]=function(_0x3aef5b){var _0x43c927=this;return new Promise(function(_0x243a32,_0x3b62da){return db[_0x6d90('0x13')]['update'](_0x3aef5b[_0x6d90('0x14')],{'raw':_0x3aef5b[_0x6d90('0x15')]?_0x3aef5b[_0x6d90('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aef5b[_0x6d90('0x15')]?_0x3aef5b[_0x6d90('0x15')][_0x6d90('0x19')]||null:null,'attributes':_0x3aef5b[_0x6d90('0x15')]?_0x3aef5b[_0x6d90('0x15')][_0x6d90('0x1a')]||null:null,'limit':_0x3aef5b[_0x6d90('0x15')]?_0x3aef5b[_0x6d90('0x15')][_0x6d90('0x1b')]||null:null})[_0x6d90('0x16')](function(_0x5eea54){logger['info']('UpdateOpenchannelQueueReport',_0x3aef5b);logger[_0x6d90('0xd')]('UpdateOpenchannelQueueReport',_0x3aef5b,JSON[_0x6d90('0x1c')](_0x5eea54));_0x243a32(_0x5eea54);})[_0x6d90('0x17')](function(_0x148cf5){logger[_0x6d90('0xf')](_0x6d90('0x18'),_0x148cf5[_0x6d90('0x11')],_0x3aef5b);_0x3b62da(_0x43c927[_0x6d90('0xf')](0x1f4,_0x148cf5[_0x6d90('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 50a46b9..64378b9 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 328b954..dc9dc40 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 _0x9b96=['exports','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x29a0a4,_0x1141cf){var _0x642458=function(_0x34627b){while(--_0x34627b){_0x29a0a4['push'](_0x29a0a4['shift']());}};_0x642458(++_0x1141cf);}(_0x9b96,0xbb));var _0x69b9=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x9b96[_0x4baae2];return _0x1a2285;};'use strict';var moment=require(_0x69b9('0x0'));var Sequelize=require(_0x69b9('0x1'));module[_0x69b9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x69b9('0x3')](_0x69b9('0x4'),'agent',_0x69b9('0x5')),'allowNull':![],'defaultValue':_0x69b9('0x5')},'transferredAt':{'type':Sequelize[_0x69b9('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x8d03=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x13661b,_0x48fb39){var _0x4b8e30=function(_0x35f657){while(--_0x35f657){_0x13661b['push'](_0x13661b['shift']());}};_0x4b8e30(++_0x48fb39);}(_0x8d03,0x122));var _0x38d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8d03[_0x397e5f];return _0x5302b8;};'use strict';var moment=require('moment');var Sequelize=require(_0x38d0('0x0'));module[_0x38d0('0x1')]={'uniqueid':{'type':Sequelize[_0x38d0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x38d0('0x3')]('account',_0x38d0('0x4'),_0x38d0('0x5')),'allowNull':![],'defaultValue':_0x38d0('0x5')},'transferredAt':{'type':Sequelize[_0x38d0('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 0af48b4..bb47c2f 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 _0x9c0d=['rows','show','params','options','find','catch','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x42c3b8,_0x2a76ac){var _0x82276f=function(_0x1b8471){while(--_0x1b8471){_0x42c3b8['push'](_0x42c3b8['shift']());}};_0x82276f(++_0x2a76ac);}(_0x9c0d,0x97));var _0xd9c0=function(_0xd92652,_0x59f24a){_0xd92652=_0xd92652-0x0;var _0x17ba47=_0x9c0d[_0xd92652];return _0x17ba47;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd9c0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9c0('0x1'));var moment=require(_0xd9c0('0x2'));var BPromise=require(_0xd9c0('0x3'));var Mustache=require(_0xd9c0('0x4'));var util=require(_0xd9c0('0x5'));var path=require(_0xd9c0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9c0('0x7'));var fs=require('fs');var _=require(_0xd9c0('0x8'));var squel=require(_0xd9c0('0x9'));var crypto=require(_0xd9c0('0xa'));var jsforce=require(_0xd9c0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd9c0('0xc'));var querystring=require(_0xd9c0('0xd'));var Papa=require('papaparse');var Redis=require(_0xd9c0('0xe'));var authService=require(_0xd9c0('0xf'));var qs=require(_0xd9c0('0x10'));var as=require(_0xd9c0('0x11'));var hardwareService=require(_0xd9c0('0x12'));var logger=require(_0xd9c0('0x13'))(_0xd9c0('0x14'));var utils=require(_0xd9c0('0x15'));var config=require('../../config/environment');var db=require(_0xd9c0('0x16'))['db'];function respondWithStatusCode(_0x1061f0,_0xd6189c){_0xd6189c=_0xd6189c||0xcc;return function(_0x37be6c){if(_0x37be6c){return _0x1061f0[_0xd9c0('0x17')](_0xd6189c);}return _0x1061f0[_0xd9c0('0x18')](_0xd6189c)[_0xd9c0('0x19')]();};}function respondWithResult(_0x40225c,_0x24a7ec){_0x24a7ec=_0x24a7ec||0xc8;return function(_0xe06d18){if(_0xe06d18){return _0x40225c[_0xd9c0('0x18')](_0x24a7ec)[_0xd9c0('0x1a')](_0xe06d18);}};}function respondWithFilteredResult(_0x232687,_0x2d5e9b){return function(_0x3cd844){if(_0x3cd844){var _0x4de75b=_0x3cd844[_0xd9c0('0x1b')],_0x3e3df1=_0x2d5e9b[_0xd9c0('0x1c')],_0x406ebc=_0x2d5e9b['offset']+_0x2d5e9b[_0xd9c0('0x1d')],_0x177fa5;if(_0x406ebc>=_0x4de75b){_0x406ebc=_0x4de75b;_0x177fa5=0xc8;}else{_0x177fa5=0xce;}_0x232687[_0xd9c0('0x18')](_0x177fa5);return _0x232687[_0xd9c0('0x1e')](_0xd9c0('0x1f'),_0x3e3df1+'-'+_0x406ebc+'/'+_0x4de75b)[_0xd9c0('0x1a')](_0x3cd844);}return null;};}function patchUpdates(_0x4238f3){return function(_0x278868){try{jsonpatch['apply'](_0x278868,_0x4238f3,!![]);}catch(_0x1303b5){return BPromise[_0xd9c0('0x20')](_0x1303b5);}return _0x278868['save']();};}function saveUpdates(_0x13b76b,_0xd5ee4a){return function(_0x354510){if(_0x354510){return _0x354510[_0xd9c0('0x21')](_0x13b76b)[_0xd9c0('0x22')](function(_0x5e17ce){return _0x5e17ce;});}return null;};}function removeEntity(_0x183c4d,_0x45cbd3){return function(_0x207e3f){if(_0x207e3f){return _0x207e3f[_0xd9c0('0x23')]()[_0xd9c0('0x22')](function(){_0x183c4d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa4847f,_0x34a2a8){return function(_0x392376){if(!_0x392376){_0xa4847f['sendStatus'](0x194);}return _0x392376;};}function handleError(_0x515367,_0x3a3089){_0x3a3089=_0x3a3089||0x1f4;return function(_0xc0c48f){logger['error'](_0xc0c48f['stack']);if(_0xc0c48f[_0xd9c0('0x24')]){delete _0xc0c48f['name'];}_0x515367[_0xd9c0('0x18')](_0x3a3089)[_0xd9c0('0x25')](_0xc0c48f);};}exports['index']=function(_0x850fdf,_0x129820){var _0x132477={},_0x4247f9={},_0x72b7e2={'count':0x0,'rows':[]};var _0x313e72=_[_0xd9c0('0x26')](db[_0xd9c0('0x27')][_0xd9c0('0x28')],function(_0x464192){return{'name':_0x464192[_0xd9c0('0x29')],'type':_0x464192[_0xd9c0('0x2a')]['key']};});_0x4247f9[_0xd9c0('0x2b')]=_[_0xd9c0('0x26')](_0x313e72,_0xd9c0('0x24'));_0x4247f9[_0xd9c0('0x2c')]=_[_0xd9c0('0x2d')](_0x850fdf['query']);_0x4247f9[_0xd9c0('0x2e')]=_[_0xd9c0('0x2f')](_0x4247f9['model'],_0x4247f9[_0xd9c0('0x2c')]);_0x132477[_0xd9c0('0x30')]=_[_0xd9c0('0x2f')](_0x4247f9[_0xd9c0('0x2b')],qs['fields'](_0x850fdf[_0xd9c0('0x2c')][_0xd9c0('0x31')]));_0x132477[_0xd9c0('0x30')]=_0x132477['attributes'][_0xd9c0('0x32')]?_0x132477[_0xd9c0('0x30')]:_0x4247f9['model'];if(!_0x850fdf[_0xd9c0('0x2c')][_0xd9c0('0x33')](_0xd9c0('0x34'))){_0x132477[_0xd9c0('0x1d')]=qs['limit'](_0x850fdf[_0xd9c0('0x2c')][_0xd9c0('0x1d')]);_0x132477[_0xd9c0('0x1c')]=qs['offset'](_0x850fdf['query'][_0xd9c0('0x1c')]);}_0x132477[_0xd9c0('0x35')]=qs[_0xd9c0('0x36')](_0x850fdf['query']['sort']);_0x132477[_0xd9c0('0x37')]=qs[_0xd9c0('0x2e')](_[_0xd9c0('0x38')](_0x850fdf[_0xd9c0('0x2c')],_0x4247f9[_0xd9c0('0x2e')]),_0x313e72);if(_0x850fdf[_0xd9c0('0x2c')][_0xd9c0('0x39')]){_0x132477[_0xd9c0('0x37')]=_[_0xd9c0('0x3a')](_0x132477[_0xd9c0('0x37')],{'$or':_['map'](_0x313e72,function(_0x5466b4){if(_0x5466b4[_0xd9c0('0x2a')]!==_0xd9c0('0x3b')){var _0x3f863b={};_0x3f863b[_0x5466b4[_0xd9c0('0x24')]]={'$like':'%'+_0x850fdf[_0xd9c0('0x2c')]['filter']+'%'};return _0x3f863b;}})});}_0x132477=_['merge']({},_0x132477,_0x850fdf['options']);var _0x46ccd9={'where':_0x132477[_0xd9c0('0x37')]};return db[_0xd9c0('0x27')]['count'](_0x46ccd9)[_0xd9c0('0x22')](function(_0x1e05a8){_0x72b7e2[_0xd9c0('0x1b')]=_0x1e05a8;if(_0x850fdf['query'][_0xd9c0('0x3c')]){_0x132477[_0xd9c0('0x3d')]=[{'all':!![]}];}return db[_0xd9c0('0x27')]['findAll'](_0x132477);})[_0xd9c0('0x22')](function(_0x47b3b3){_0x72b7e2[_0xd9c0('0x3e')]=_0x47b3b3;return _0x72b7e2;})[_0xd9c0('0x22')](respondWithFilteredResult(_0x129820,_0x132477))['catch'](handleError(_0x129820,null));};exports[_0xd9c0('0x3f')]=function(_0x20beff,_0x4d455d){var _0x5e7de7={'raw':!![],'where':{'id':_0x20beff[_0xd9c0('0x40')]['id']}},_0x14310f={};_0x14310f['model']=_['keys'](db[_0xd9c0('0x27')]['rawAttributes']);_0x14310f['query']=_['keys'](_0x20beff[_0xd9c0('0x2c')]);_0x14310f[_0xd9c0('0x2e')]=_[_0xd9c0('0x2f')](_0x14310f['model'],_0x14310f['query']);_0x5e7de7[_0xd9c0('0x30')]=_[_0xd9c0('0x2f')](_0x14310f['model'],qs[_0xd9c0('0x31')](_0x20beff['query'][_0xd9c0('0x31')]));_0x5e7de7['attributes']=_0x5e7de7[_0xd9c0('0x30')][_0xd9c0('0x32')]?_0x5e7de7[_0xd9c0('0x30')]:_0x14310f[_0xd9c0('0x2b')];if(_0x20beff['query'][_0xd9c0('0x3c')]){_0x5e7de7[_0xd9c0('0x3d')]=[{'all':!![]}];}_0x5e7de7=_[_0xd9c0('0x3a')]({},_0x5e7de7,_0x20beff[_0xd9c0('0x41')]);return db[_0xd9c0('0x27')][_0xd9c0('0x42')](_0x5e7de7)[_0xd9c0('0x22')](handleEntityNotFound(_0x4d455d,null))[_0xd9c0('0x22')](respondWithResult(_0x4d455d,null))[_0xd9c0('0x43')](handleError(_0x4d455d,null));};exports[_0xd9c0('0x44')]=function(_0x38bfc0,_0x93048){return db['OpenchannelTransferReport'][_0xd9c0('0x44')](_0x38bfc0['body'],{})[_0xd9c0('0x22')](respondWithResult(_0x93048,0xc9))['catch'](handleError(_0x93048,null));};exports['update']=function(_0x5e2db6,_0x27aac3){if(_0x5e2db6[_0xd9c0('0x45')]['id']){delete _0x5e2db6[_0xd9c0('0x45')]['id'];}return db[_0xd9c0('0x27')]['find']({'where':{'id':_0x5e2db6[_0xd9c0('0x40')]['id']}})[_0xd9c0('0x22')](handleEntityNotFound(_0x27aac3,null))[_0xd9c0('0x22')](saveUpdates(_0x5e2db6[_0xd9c0('0x45')],null))[_0xd9c0('0x22')](respondWithResult(_0x27aac3,null))[_0xd9c0('0x43')](handleError(_0x27aac3,null));};exports[_0xd9c0('0x23')]=function(_0x1630fa,_0x5c65be){return db[_0xd9c0('0x27')]['find']({'where':{'id':_0x1630fa[_0xd9c0('0x40')]['id']}})[_0xd9c0('0x22')](handleEntityNotFound(_0x5c65be,null))[_0xd9c0('0x22')](removeEntity(_0x5c65be,null))[_0xd9c0('0x43')](handleError(_0x5c65be,null));};exports[_0xd9c0('0x46')]=function(_0x373802,_0x518473){return db[_0xd9c0('0x27')]['describe']()[_0xd9c0('0x22')](respondWithResult(_0x518473,null))[_0xd9c0('0x43')](handleError(_0x518473,null));}; \ No newline at end of file +var _0xe8c8=['options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL'];(function(_0x5a58e1,_0x5cf833){var _0x1061d4=function(_0x54071d){while(--_0x54071d){_0x5a58e1['push'](_0x5a58e1['shift']());}};_0x1061d4(++_0x5cf833);}(_0xe8c8,0x13d));var _0x8e8c=function(_0x5e1c16,_0x279767){_0x5e1c16=_0x5e1c16-0x0;var _0x9ad669=_0xe8c8[_0x5e1c16];return _0x9ad669;};'use strict';var pdf=require(_0x8e8c('0x0'));var emlformat=require(_0x8e8c('0x1'));var rimraf=require(_0x8e8c('0x2'));var zipdir=require(_0x8e8c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e8c('0x4'));var moment=require(_0x8e8c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8e8c('0x6'));var path=require('path');var sox=require(_0x8e8c('0x7'));var csv=require('to-csv');var ejs=require(_0x8e8c('0x8'));var fs=require('fs');var _=require(_0x8e8c('0x9'));var squel=require('squel');var crypto=require(_0x8e8c('0xa'));var jsforce=require(_0x8e8c('0xb'));var deskjs=require(_0x8e8c('0xc'));var toCsv=require(_0x8e8c('0xd'));var querystring=require(_0x8e8c('0xe'));var Papa=require(_0x8e8c('0xf'));var Redis=require('ioredis');var authService=require(_0x8e8c('0x10'));var qs=require(_0x8e8c('0x11'));var as=require(_0x8e8c('0x12'));var hardwareService=require(_0x8e8c('0x13'));var logger=require(_0x8e8c('0x14'))(_0x8e8c('0x15'));var utils=require(_0x8e8c('0x16'));var config=require(_0x8e8c('0x17'));var db=require(_0x8e8c('0x18'))['db'];function respondWithStatusCode(_0x3b0a48,_0x375030){_0x375030=_0x375030||0xcc;return function(_0xe83374){if(_0xe83374){return _0x3b0a48[_0x8e8c('0x19')](_0x375030);}return _0x3b0a48['status'](_0x375030)[_0x8e8c('0x1a')]();};}function respondWithResult(_0x55fde3,_0x25b8bf){_0x25b8bf=_0x25b8bf||0xc8;return function(_0x465b08){if(_0x465b08){return _0x55fde3[_0x8e8c('0x1b')](_0x25b8bf)[_0x8e8c('0x1c')](_0x465b08);}};}function respondWithFilteredResult(_0x4d6e0c,_0x12cbbc){return function(_0x26400f){if(_0x26400f){var _0x4a3302=_0x26400f['count'],_0x2196d4=_0x12cbbc[_0x8e8c('0x1d')],_0x28dae5=_0x12cbbc[_0x8e8c('0x1d')]+_0x12cbbc[_0x8e8c('0x1e')],_0x1fe98e;if(_0x28dae5>=_0x4a3302){_0x28dae5=_0x4a3302;_0x1fe98e=0xc8;}else{_0x1fe98e=0xce;}_0x4d6e0c['status'](_0x1fe98e);return _0x4d6e0c[_0x8e8c('0x1f')](_0x8e8c('0x20'),_0x2196d4+'-'+_0x28dae5+'/'+_0x4a3302)['json'](_0x26400f);}return null;};}function patchUpdates(_0x2f8626){return function(_0x44d4f1){try{jsonpatch[_0x8e8c('0x21')](_0x44d4f1,_0x2f8626,!![]);}catch(_0x569a12){return BPromise[_0x8e8c('0x22')](_0x569a12);}return _0x44d4f1[_0x8e8c('0x23')]();};}function saveUpdates(_0x318a27,_0x1464fb){return function(_0x18d2a2){if(_0x18d2a2){return _0x18d2a2[_0x8e8c('0x24')](_0x318a27)[_0x8e8c('0x25')](function(_0x457aed){return _0x457aed;});}return null;};}function removeEntity(_0x35b956,_0x15dcff){return function(_0x431244){if(_0x431244){return _0x431244[_0x8e8c('0x26')]()[_0x8e8c('0x25')](function(){_0x35b956[_0x8e8c('0x1b')](0xcc)[_0x8e8c('0x1a')]();});}};}function handleEntityNotFound(_0x5123db,_0xe40b17){return function(_0x51ab94){if(!_0x51ab94){_0x5123db[_0x8e8c('0x19')](0x194);}return _0x51ab94;};}function handleError(_0x2d8d77,_0x5646d4){_0x5646d4=_0x5646d4||0x1f4;return function(_0x13efa3){logger[_0x8e8c('0x27')](_0x13efa3[_0x8e8c('0x28')]);if(_0x13efa3['name']){delete _0x13efa3['name'];}_0x2d8d77['status'](_0x5646d4)[_0x8e8c('0x29')](_0x13efa3);};}exports['index']=function(_0x398813,_0x3e8769){var _0x5494c3={},_0x4fa88={},_0x153202={'count':0x0,'rows':[]};var _0x2d2cc1=_['map'](db[_0x8e8c('0x2a')][_0x8e8c('0x2b')],function(_0x4d7dc5){return{'name':_0x4d7dc5[_0x8e8c('0x2c')],'type':_0x4d7dc5[_0x8e8c('0x2d')][_0x8e8c('0x2e')]};});_0x4fa88[_0x8e8c('0x2f')]=_[_0x8e8c('0x30')](_0x2d2cc1,_0x8e8c('0x31'));_0x4fa88[_0x8e8c('0x32')]=_[_0x8e8c('0x33')](_0x398813[_0x8e8c('0x32')]);_0x4fa88[_0x8e8c('0x34')]=_['intersection'](_0x4fa88[_0x8e8c('0x2f')],_0x4fa88[_0x8e8c('0x32')]);_0x5494c3[_0x8e8c('0x35')]=_['intersection'](_0x4fa88[_0x8e8c('0x2f')],qs[_0x8e8c('0x36')](_0x398813['query']['fields']));_0x5494c3[_0x8e8c('0x35')]=_0x5494c3[_0x8e8c('0x35')][_0x8e8c('0x37')]?_0x5494c3[_0x8e8c('0x35')]:_0x4fa88['model'];if(!_0x398813[_0x8e8c('0x32')][_0x8e8c('0x38')](_0x8e8c('0x39'))){_0x5494c3[_0x8e8c('0x1e')]=qs[_0x8e8c('0x1e')](_0x398813[_0x8e8c('0x32')][_0x8e8c('0x1e')]);_0x5494c3[_0x8e8c('0x1d')]=qs[_0x8e8c('0x1d')](_0x398813[_0x8e8c('0x32')]['offset']);}_0x5494c3['order']=qs[_0x8e8c('0x3a')](_0x398813[_0x8e8c('0x32')][_0x8e8c('0x3a')]);_0x5494c3[_0x8e8c('0x3b')]=qs[_0x8e8c('0x34')](_['pick'](_0x398813['query'],_0x4fa88['filters']),_0x2d2cc1);if(_0x398813[_0x8e8c('0x32')][_0x8e8c('0x3c')]){_0x5494c3[_0x8e8c('0x3b')]=_[_0x8e8c('0x3d')](_0x5494c3['where'],{'$or':_['map'](_0x2d2cc1,function(_0x29df88){if(_0x29df88[_0x8e8c('0x2d')]!==_0x8e8c('0x3e')){var _0x2512e5={};_0x2512e5[_0x29df88[_0x8e8c('0x31')]]={'$like':'%'+_0x398813['query'][_0x8e8c('0x3c')]+'%'};return _0x2512e5;}})});}_0x5494c3=_[_0x8e8c('0x3d')]({},_0x5494c3,_0x398813[_0x8e8c('0x3f')]);var _0x364104={'where':_0x5494c3[_0x8e8c('0x3b')]};return db['OpenchannelTransferReport'][_0x8e8c('0x40')](_0x364104)[_0x8e8c('0x25')](function(_0x2abe91){_0x153202[_0x8e8c('0x40')]=_0x2abe91;if(_0x398813[_0x8e8c('0x32')][_0x8e8c('0x41')]){_0x5494c3[_0x8e8c('0x42')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x8e8c('0x43')](_0x5494c3);})['then'](function(_0x2ed99e){_0x153202[_0x8e8c('0x44')]=_0x2ed99e;return _0x153202;})['then'](respondWithFilteredResult(_0x3e8769,_0x5494c3))[_0x8e8c('0x45')](handleError(_0x3e8769,null));};exports[_0x8e8c('0x46')]=function(_0x2bb9ba,_0x2ee611){var _0x1e57ff={'raw':!![],'where':{'id':_0x2bb9ba[_0x8e8c('0x47')]['id']}},_0x276e9b={};_0x276e9b[_0x8e8c('0x2f')]=_[_0x8e8c('0x33')](db[_0x8e8c('0x2a')][_0x8e8c('0x2b')]);_0x276e9b[_0x8e8c('0x32')]=_[_0x8e8c('0x33')](_0x2bb9ba[_0x8e8c('0x32')]);_0x276e9b[_0x8e8c('0x34')]=_['intersection'](_0x276e9b[_0x8e8c('0x2f')],_0x276e9b[_0x8e8c('0x32')]);_0x1e57ff[_0x8e8c('0x35')]=_['intersection'](_0x276e9b[_0x8e8c('0x2f')],qs[_0x8e8c('0x36')](_0x2bb9ba[_0x8e8c('0x32')][_0x8e8c('0x36')]));_0x1e57ff[_0x8e8c('0x35')]=_0x1e57ff[_0x8e8c('0x35')]['length']?_0x1e57ff[_0x8e8c('0x35')]:_0x276e9b[_0x8e8c('0x2f')];if(_0x2bb9ba[_0x8e8c('0x32')][_0x8e8c('0x41')]){_0x1e57ff['include']=[{'all':!![]}];}_0x1e57ff=_[_0x8e8c('0x3d')]({},_0x1e57ff,_0x2bb9ba[_0x8e8c('0x3f')]);return db['OpenchannelTransferReport'][_0x8e8c('0x48')](_0x1e57ff)[_0x8e8c('0x25')](handleEntityNotFound(_0x2ee611,null))[_0x8e8c('0x25')](respondWithResult(_0x2ee611,null))[_0x8e8c('0x45')](handleError(_0x2ee611,null));};exports[_0x8e8c('0x49')]=function(_0x5349e6,_0x9b6b6d){return db['OpenchannelTransferReport'][_0x8e8c('0x49')](_0x5349e6[_0x8e8c('0x4a')],{})[_0x8e8c('0x25')](respondWithResult(_0x9b6b6d,0xc9))[_0x8e8c('0x45')](handleError(_0x9b6b6d,null));};exports[_0x8e8c('0x24')]=function(_0x2f2c24,_0xae35cf){if(_0x2f2c24[_0x8e8c('0x4a')]['id']){delete _0x2f2c24[_0x8e8c('0x4a')]['id'];}return db['OpenchannelTransferReport'][_0x8e8c('0x48')]({'where':{'id':_0x2f2c24[_0x8e8c('0x47')]['id']}})['then'](handleEntityNotFound(_0xae35cf,null))[_0x8e8c('0x25')](saveUpdates(_0x2f2c24['body'],null))[_0x8e8c('0x25')](respondWithResult(_0xae35cf,null))[_0x8e8c('0x45')](handleError(_0xae35cf,null));};exports[_0x8e8c('0x26')]=function(_0x4c3f3e,_0x226039){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4c3f3e[_0x8e8c('0x47')]['id']}})[_0x8e8c('0x25')](handleEntityNotFound(_0x226039,null))[_0x8e8c('0x25')](removeEntity(_0x226039,null))[_0x8e8c('0x45')](handleError(_0x226039,null));};exports['describe']=function(_0x12c36d,_0x56645a){return db[_0x8e8c('0x2a')][_0x8e8c('0x4b')]()[_0x8e8c('0x25')](respondWithResult(_0x56645a,null))[_0x8e8c('0x45')](handleError(_0x56645a,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 69a0edd..4a7abf0 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 _0xa46e=['path','../../config/environment','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x25b827,_0x2dedc1){var _0x4b7dfd=function(_0x2e8201){while(--_0x2e8201){_0x25b827['push'](_0x25b827['shift']());}};_0x4b7dfd(++_0x2dedc1);}(_0xa46e,0x8a));var _0xea46=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xa46e[_0x5e6ea3];return _0x4048b5;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb7e=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport'];(function(_0x350b36,_0x5c3f6a){var _0x3258e2=function(_0x405da9){while(--_0x405da9){_0x350b36['push'](_0x350b36['shift']());}};_0x3258e2(++_0x5c3f6a);}(_0xdb7e,0x11a));var _0xedb7=function(_0x571a11,_0x1007bf){_0x571a11=_0x571a11-0x0;var _0x2a39ea=_0xdb7e[_0x571a11];return _0x2a39ea;};'use strict';var _=require(_0xedb7('0x0'));var util=require(_0xedb7('0x1'));var logger=require(_0xedb7('0x2'))('api');var moment=require(_0xedb7('0x3'));var BPromise=require(_0xedb7('0x4'));var rp=require(_0xedb7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xedb7('0x6'));var config=require(_0xedb7('0x7'));var attributes=require(_0xedb7('0x8'));module[_0xedb7('0x9')]=function(_0xea2925,_0x153a3a){return _0xea2925[_0xedb7('0xa')](_0xedb7('0xb'),attributes,{'tableName':_0xedb7('0xc'),'paranoid':![],'indexes':[{'name':_0xedb7('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a3a2e63..0d473d9 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 _0x8f85=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x32897b,_0x21bee8){var _0x4394ce=function(_0x2b7a5b){while(--_0x2b7a5b){_0x32897b['push'](_0x32897b['shift']());}};_0x4394ce(++_0x21bee8);}(_0x8f85,0x1b5));var _0x58f8=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x8f85[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x58f8('0x0'));var util=require(_0x58f8('0x1'));var moment=require('moment');var BPromise=require(_0x58f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58f8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x58f8('0x4'))(_0x58f8('0x5'));var config=require(_0x58f8('0x6'));var jayson=require(_0x58f8('0x7'));var client=jayson[_0x58f8('0x8')][_0x58f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad1c1,_0x481e3b,_0x4190ef){return new BPromise(function(_0x26b365,_0x51f7f1){return client[_0x58f8('0xa')](_0x3ad1c1,_0x4190ef)[_0x58f8('0xb')](function(_0xeb7bfc){logger[_0x58f8('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x481e3b,_0x58f8('0xd'));logger['debug'](_0x58f8('0xe'),_0x481e3b,_0x58f8('0xd'),JSON[_0x58f8('0xf')](_0xeb7bfc));if(_0xeb7bfc[_0x58f8('0x10')]){if(_0xeb7bfc[_0x58f8('0x10')][_0x58f8('0x11')]===0x1f4){logger[_0x58f8('0x10')](_0x58f8('0x12'),_0x481e3b,_0xeb7bfc['error'][_0x58f8('0x13')]);return _0x51f7f1(_0xeb7bfc[_0x58f8('0x10')]['message']);}logger[_0x58f8('0x10')](_0x58f8('0x12'),_0x481e3b,_0xeb7bfc[_0x58f8('0x10')][_0x58f8('0x13')]);return _0x26b365(_0xeb7bfc[_0x58f8('0x10')][_0x58f8('0x13')]);}else{logger['info'](_0x58f8('0x12'),_0x481e3b,_0x58f8('0xd'));_0x26b365(_0xeb7bfc[_0x58f8('0x14')][_0x58f8('0x13')]);}})[_0x58f8('0x15')](function(_0x57a0a4){logger[_0x58f8('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x481e3b,_0x57a0a4);_0x51f7f1(_0x57a0a4);});});} \ No newline at end of file +var _0x57c2=['error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x57c2,0x113));var _0x257c=function(_0x2011c3,_0x2ce439){_0x2011c3=_0x2011c3-0x0;var _0x363b12=_0x57c2[_0x2011c3];return _0x363b12;};'use strict';var _=require(_0x257c('0x0'));var util=require('util');var moment=require(_0x257c('0x1'));var BPromise=require(_0x257c('0x2'));var rs=require(_0x257c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x257c('0x4'))['db'];var utils=require(_0x257c('0x5'));var logger=require('../../config/logger')(_0x257c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x257c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dad00,_0x38326f,_0x5cfd3a){return new BPromise(function(_0x312f0a,_0x1f9b93){return client[_0x257c('0x8')](_0x5dad00,_0x5cfd3a)['then'](function(_0x503b61){logger['info'](_0x257c('0x9'),_0x38326f,_0x257c('0xa'));logger[_0x257c('0xb')](_0x257c('0xc'),_0x38326f,_0x257c('0xa'),JSON['stringify'](_0x503b61));if(_0x503b61[_0x257c('0xd')]){if(_0x503b61['error'][_0x257c('0xe')]===0x1f4){logger[_0x257c('0xd')](_0x257c('0x9'),_0x38326f,_0x503b61[_0x257c('0xd')]['message']);return _0x1f9b93(_0x503b61[_0x257c('0xd')][_0x257c('0xf')]);}logger['error'](_0x257c('0x9'),_0x38326f,_0x503b61[_0x257c('0xd')][_0x257c('0xf')]);return _0x312f0a(_0x503b61[_0x257c('0xd')][_0x257c('0xf')]);}else{logger[_0x257c('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38326f,_0x257c('0xa'));_0x312f0a(_0x503b61['result'][_0x257c('0xf')]);}})[_0x257c('0x11')](function(_0x19750d){logger[_0x257c('0xd')](_0x257c('0x9'),_0x38326f,_0x19750d);_0x1f9b93(_0x19750d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index eecda6c..e9258e9 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 _0x60a7=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x60a7,0x130));var _0x760a=function(_0x4da368,_0x15a3f7){_0x4da368=_0x4da368-0x0;var _0xc3b022=_0x60a7[_0x4da368];return _0xc3b022;};'use strict';var multer=require(_0x760a('0x0'));var util=require('util');var path=require(_0x760a('0x1'));var timeout=require(_0x760a('0x2'));var express=require(_0x760a('0x3'));var router=express[_0x760a('0x4')]();var auth=require(_0x760a('0x5'));var interaction=require(_0x760a('0x6'));var config=require(_0x760a('0x7'));var controller=require('./pause.controller');router[_0x760a('0x8')]('/',auth[_0x760a('0x9')](),controller['index']);router[_0x760a('0x8')](_0x760a('0xa'),auth[_0x760a('0x9')](),controller[_0x760a('0xb')]);router[_0x760a('0xc')]('/',auth['isAuthenticated'](),controller[_0x760a('0xd')]);router[_0x760a('0xe')](_0x760a('0xa'),auth[_0x760a('0x9')](),controller[_0x760a('0xf')]);router['delete'](_0x760a('0xa'),auth[_0x760a('0x9')](),controller['destroy']);module[_0x760a('0x10')]=router; \ No newline at end of file +var _0x3d95=['get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x5250ee,_0x46e3ed){var _0x83882a=function(_0x59566f){while(--_0x59566f){_0x5250ee['push'](_0x5250ee['shift']());}};_0x83882a(++_0x46e3ed);}(_0x3d95,0x82));var _0x53d9=function(_0x51759e,_0x45fcf8){_0x51759e=_0x51759e-0x0;var _0x384ec7=_0x3d95[_0x51759e];return _0x384ec7;};'use strict';var multer=require(_0x53d9('0x0'));var util=require(_0x53d9('0x1'));var path=require(_0x53d9('0x2'));var timeout=require(_0x53d9('0x3'));var express=require(_0x53d9('0x4'));var router=express[_0x53d9('0x5')]();var auth=require(_0x53d9('0x6'));var interaction=require(_0x53d9('0x7'));var config=require(_0x53d9('0x8'));var controller=require(_0x53d9('0x9'));router[_0x53d9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x53d9('0xa')](_0x53d9('0xb'),auth[_0x53d9('0xc')](),controller[_0x53d9('0xd')]);router[_0x53d9('0xe')]('/',auth[_0x53d9('0xc')](),controller[_0x53d9('0xf')]);router[_0x53d9('0x10')](_0x53d9('0xb'),auth[_0x53d9('0xc')](),controller[_0x53d9('0x11')]);router['delete']('/:id',auth[_0x53d9('0xc')](),controller[_0x53d9('0x12')]);module[_0x53d9('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index f175ccc..5e324b0 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 _0x8782=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8782,0x17a));var _0x2878=function(_0x1d48e9,_0x5f4e70){_0x1d48e9=_0x1d48e9-0x0;var _0x2d9b80=_0x8782[_0x1d48e9];return _0x2d9b80;};'use strict';var Sequelize=require(_0x2878('0x0'));module[_0x2878('0x1')]={'name':{'type':Sequelize[_0x2878('0x2')],'unique':_0x2878('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2878('0x2')]}}; \ No newline at end of file +var _0xabf6=['STRING','sequelize','exports'];(function(_0x4fbbfd,_0x40823a){var _0x1f761c=function(_0x404e7e){while(--_0x404e7e){_0x4fbbfd['push'](_0x4fbbfd['shift']());}};_0x1f761c(++_0x40823a);}(_0xabf6,0xb5));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6abf('0x0'));module[_0x6abf('0x1')]={'name':{'type':Sequelize[_0x6abf('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6abf('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 90f55e7..0d4b72a 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 _0x6048=['Pauses','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6048,0x82));var _0x8604=function(_0x32f616,_0x373411){_0x32f616=_0x32f616-0x0;var _0x52f6ee=_0x6048[_0x32f616];return _0x52f6ee;};'use strict';var pdf=require(_0x8604('0x0'));var emlformat=require(_0x8604('0x1'));var rimraf=require(_0x8604('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8604('0x3'));var moment=require('moment');var BPromise=require(_0x8604('0x4'));var Mustache=require(_0x8604('0x5'));var util=require(_0x8604('0x6'));var path=require(_0x8604('0x7'));var sox=require(_0x8604('0x8'));var csv=require(_0x8604('0x9'));var ejs=require(_0x8604('0xa'));var fs=require('fs');var _=require(_0x8604('0xb'));var squel=require(_0x8604('0xc'));var crypto=require(_0x8604('0xd'));var jsforce=require(_0x8604('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8604('0xf'));var Papa=require(_0x8604('0x10'));var Redis=require(_0x8604('0x11'));var authService=require(_0x8604('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8604('0x13'));var hardwareService=require(_0x8604('0x14'));var logger=require(_0x8604('0x15'))(_0x8604('0x16'));var utils=require('../../config/utils');var config=require(_0x8604('0x17'));var db=require(_0x8604('0x18'))['db'];function respondWithStatusCode(_0xec39b5,_0xff57ae){_0xff57ae=_0xff57ae||0xcc;return function(_0x16758c){if(_0x16758c){return _0xec39b5['sendStatus'](_0xff57ae);}return _0xec39b5[_0x8604('0x19')](_0xff57ae)['end']();};}function respondWithResult(_0x3ec451,_0x3c1338){_0x3c1338=_0x3c1338||0xc8;return function(_0x198e79){if(_0x198e79){return _0x3ec451[_0x8604('0x19')](_0x3c1338)[_0x8604('0x1a')](_0x198e79);}};}function respondWithFilteredResult(_0x4641f1,_0x414924){return function(_0x2b340b){if(_0x2b340b){var _0x3fc0d6=_0x2b340b['count'],_0x2120ac=_0x414924[_0x8604('0x1b')],_0x4a1d62=_0x414924[_0x8604('0x1b')]+_0x414924['limit'],_0x47dce5;if(_0x4a1d62>=_0x3fc0d6){_0x4a1d62=_0x3fc0d6;_0x47dce5=0xc8;}else{_0x47dce5=0xce;}_0x4641f1[_0x8604('0x19')](_0x47dce5);return _0x4641f1['set'](_0x8604('0x1c'),_0x2120ac+'-'+_0x4a1d62+'/'+_0x3fc0d6)[_0x8604('0x1a')](_0x2b340b);}return null;};}function patchUpdates(_0x58ef52){return function(_0x5afc91){try{jsonpatch[_0x8604('0x1d')](_0x5afc91,_0x58ef52,!![]);}catch(_0x45ee47){return BPromise[_0x8604('0x1e')](_0x45ee47);}return _0x5afc91[_0x8604('0x1f')]();};}function saveUpdates(_0x2238f7,_0x3b94d0){return function(_0x349e7b){if(_0x349e7b){return _0x349e7b[_0x8604('0x20')](_0x2238f7)[_0x8604('0x21')](function(_0x19183d){return _0x19183d;});}return null;};}function removeEntity(_0x57bcfa,_0xfafcc){return function(_0x540fce){if(_0x540fce){return _0x540fce[_0x8604('0x22')]()[_0x8604('0x21')](function(){var _0x2848b9=_0x540fce[_0x8604('0x23')]({'plain':!![]});var _0x5a9105=_0x8604('0x24');return db[_0x8604('0x25')]['destroy']({'where':{'type':_0x5a9105,'resourceId':_0x2848b9['id']}})[_0x8604('0x21')](function(){return _0x540fce;});})['then'](function(){_0x57bcfa['status'](0xcc)[_0x8604('0x26')]();});}};}function handleEntityNotFound(_0xf12726,_0x36b9b7){return function(_0x23ddb5){if(!_0x23ddb5){_0xf12726[_0x8604('0x27')](0x194);}return _0x23ddb5;};}function handleError(_0x5b02c5,_0x3efaaf){_0x3efaaf=_0x3efaaf||0x1f4;return function(_0x282f68){logger[_0x8604('0x28')](_0x282f68[_0x8604('0x29')]);if(_0x282f68[_0x8604('0x2a')]){delete _0x282f68[_0x8604('0x2a')];}_0x5b02c5[_0x8604('0x19')](_0x3efaaf)[_0x8604('0x2b')](_0x282f68);};}exports[_0x8604('0x2c')]=function(_0x2526f3,_0x2f9a4e){var _0x12ca82={},_0x122162={},_0x39765e={'count':0x0,'rows':[]};var _0x459dc7=_[_0x8604('0x2d')](db[_0x8604('0x2e')][_0x8604('0x2f')],function(_0x1e894f){return{'name':_0x1e894f[_0x8604('0x30')],'type':_0x1e894f['type'][_0x8604('0x31')]};});_0x122162[_0x8604('0x32')]=_[_0x8604('0x2d')](_0x459dc7,_0x8604('0x2a'));_0x122162[_0x8604('0x33')]=_[_0x8604('0x34')](_0x2526f3[_0x8604('0x33')]);_0x122162[_0x8604('0x35')]=_['intersection'](_0x122162[_0x8604('0x32')],_0x122162[_0x8604('0x33')]);_0x12ca82[_0x8604('0x36')]=_[_0x8604('0x37')](_0x122162[_0x8604('0x32')],qs[_0x8604('0x38')](_0x2526f3['query'][_0x8604('0x38')]));_0x12ca82['attributes']=_0x12ca82[_0x8604('0x36')][_0x8604('0x39')]?_0x12ca82[_0x8604('0x36')]:_0x122162['model'];if(!_0x2526f3['query'][_0x8604('0x3a')]('nolimit')){_0x12ca82[_0x8604('0x3b')]=qs[_0x8604('0x3b')](_0x2526f3[_0x8604('0x33')]['limit']);_0x12ca82[_0x8604('0x1b')]=qs[_0x8604('0x1b')](_0x2526f3[_0x8604('0x33')][_0x8604('0x1b')]);}_0x12ca82['order']=qs['sort'](_0x2526f3[_0x8604('0x33')]['sort']);_0x12ca82[_0x8604('0x3c')]=qs['filters'](_[_0x8604('0x3d')](_0x2526f3[_0x8604('0x33')],_0x122162[_0x8604('0x35')]),_0x459dc7);if(_0x2526f3[_0x8604('0x33')][_0x8604('0x3e')]){_0x12ca82['where']=_[_0x8604('0x3f')](_0x12ca82['where'],{'$or':_[_0x8604('0x2d')](_0x459dc7,function(_0x3d8037){if(_0x3d8037[_0x8604('0x40')]!==_0x8604('0x41')){var _0x203db2={};_0x203db2[_0x3d8037[_0x8604('0x2a')]]={'$like':'%'+_0x2526f3[_0x8604('0x33')]['filter']+'%'};return _0x203db2;}})});}_0x12ca82=_[_0x8604('0x3f')]({},_0x12ca82,_0x2526f3[_0x8604('0x42')]);var _0x606eb0={'where':_0x12ca82[_0x8604('0x3c')]};return db[_0x8604('0x2e')][_0x8604('0x43')](_0x606eb0)[_0x8604('0x21')](function(_0x455a98){_0x39765e[_0x8604('0x43')]=_0x455a98;if(_0x2526f3['query'][_0x8604('0x44')]){_0x12ca82[_0x8604('0x45')]=[{'all':!![]}];}return db[_0x8604('0x2e')][_0x8604('0x46')](_0x12ca82);})[_0x8604('0x21')](function(_0x4a0d9c){_0x39765e[_0x8604('0x47')]=_0x4a0d9c;return _0x39765e;})[_0x8604('0x21')](respondWithFilteredResult(_0x2f9a4e,_0x12ca82))[_0x8604('0x48')](handleError(_0x2f9a4e,null));};exports[_0x8604('0x49')]=function(_0x36e5c0,_0x5f3c6e){var _0x8e02c8={'raw':!![],'where':{'id':_0x36e5c0[_0x8604('0x4a')]['id']}},_0x194404={};_0x194404[_0x8604('0x32')]=_[_0x8604('0x34')](db[_0x8604('0x2e')][_0x8604('0x2f')]);_0x194404[_0x8604('0x33')]=_[_0x8604('0x34')](_0x36e5c0['query']);_0x194404[_0x8604('0x35')]=_[_0x8604('0x37')](_0x194404[_0x8604('0x32')],_0x194404[_0x8604('0x33')]);_0x8e02c8['attributes']=_['intersection'](_0x194404['model'],qs[_0x8604('0x38')](_0x36e5c0[_0x8604('0x33')][_0x8604('0x38')]));_0x8e02c8['attributes']=_0x8e02c8[_0x8604('0x36')][_0x8604('0x39')]?_0x8e02c8[_0x8604('0x36')]:_0x194404[_0x8604('0x32')];if(_0x36e5c0['query'][_0x8604('0x44')]){_0x8e02c8[_0x8604('0x45')]=[{'all':!![]}];}_0x8e02c8=_[_0x8604('0x3f')]({},_0x8e02c8,_0x36e5c0[_0x8604('0x42')]);return db[_0x8604('0x2e')][_0x8604('0x4b')](_0x8e02c8)[_0x8604('0x21')](handleEntityNotFound(_0x5f3c6e,null))[_0x8604('0x21')](respondWithResult(_0x5f3c6e,null))[_0x8604('0x48')](handleError(_0x5f3c6e,null));};exports[_0x8604('0x4c')]=function(_0x4604e3,_0x532c5e){return db[_0x8604('0x2e')]['create'](_0x4604e3[_0x8604('0x4d')],{})[_0x8604('0x21')](function(_0x5ed3eb){var _0x3ca2a2=_0x4604e3[_0x8604('0x4e')][_0x8604('0x23')]({'plain':!![]});if(!_0x3ca2a2)throw new Error(_0x8604('0x4f'));if(_0x3ca2a2[_0x8604('0x50')]===_0x8604('0x4e')){var _0x17b4cb=_0x5ed3eb[_0x8604('0x23')]({'plain':!![]});var _0x39d33e='Pauses';return db['UserProfileSection'][_0x8604('0x4b')]({'where':{'name':_0x39d33e,'userProfileId':_0x3ca2a2['userProfileId']},'raw':!![]})['then'](function(_0x49dc2a){if(_0x49dc2a&&_0x49dc2a[_0x8604('0x51')]===0x0){return db[_0x8604('0x25')]['create']({'name':_0x17b4cb[_0x8604('0x2a')],'resourceId':_0x17b4cb['id'],'type':_0x49dc2a[_0x8604('0x2a')],'sectionId':_0x49dc2a['id']},{})[_0x8604('0x21')](function(){return _0x5ed3eb;});}else{return _0x5ed3eb;}})[_0x8604('0x48')](function(_0x1785fd){logger[_0x8604('0x28')](_0x8604('0x52'),_0x1785fd);throw _0x1785fd;});}return _0x5ed3eb;})[_0x8604('0x21')](respondWithResult(_0x532c5e,0xc9))['catch'](handleError(_0x532c5e,null));};exports[_0x8604('0x20')]=function(_0x2879aa,_0x3a5e94){if(_0x2879aa[_0x8604('0x4d')]['id']){delete _0x2879aa[_0x8604('0x4d')]['id'];}return db[_0x8604('0x2e')][_0x8604('0x4b')]({'where':{'id':_0x2879aa[_0x8604('0x4a')]['id']}})[_0x8604('0x21')](handleEntityNotFound(_0x3a5e94,null))[_0x8604('0x21')](saveUpdates(_0x2879aa[_0x8604('0x4d')],null))[_0x8604('0x21')](respondWithResult(_0x3a5e94,null))['catch'](handleError(_0x3a5e94,null));};exports[_0x8604('0x22')]=function(_0x1d3811,_0x2c7436){return db[_0x8604('0x2e')][_0x8604('0x4b')]({'where':{'id':_0x1d3811[_0x8604('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2c7436,null))[_0x8604('0x21')](removeEntity(_0x2c7436,null))[_0x8604('0x48')](handleError(_0x2c7436,null));}; \ No newline at end of file +var _0xf008=['attributes','length','nolimit','limit','order','sort','pick','where','VIRTUAL','merge','options','Pause','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','fields'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xf008,0x6b));var _0x8f00=function(_0x3b2769,_0x2f3e04){_0x3b2769=_0x3b2769-0x0;var _0x56ba95=_0xf008[_0x3b2769];return _0x56ba95;};'use strict';var pdf=require(_0x8f00('0x0'));var emlformat=require(_0x8f00('0x1'));var rimraf=require(_0x8f00('0x2'));var zipdir=require(_0x8f00('0x3'));var jsonpatch=require(_0x8f00('0x4'));var rp=require(_0x8f00('0x5'));var moment=require(_0x8f00('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8f00('0x7'));var util=require('util');var path=require(_0x8f00('0x8'));var sox=require(_0x8f00('0x9'));var csv=require(_0x8f00('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8f00('0xb'));var jsforce=require(_0x8f00('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8f00('0xa'));var querystring=require(_0x8f00('0xd'));var Papa=require(_0x8f00('0xe'));var Redis=require(_0x8f00('0xf'));var authService=require(_0x8f00('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8f00('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f00('0x12'));var utils=require('../../config/utils');var config=require(_0x8f00('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x168b48,_0x40b69d){_0x40b69d=_0x40b69d||0xcc;return function(_0x2d9e76){if(_0x2d9e76){return _0x168b48[_0x8f00('0x14')](_0x40b69d);}return _0x168b48[_0x8f00('0x15')](_0x40b69d)[_0x8f00('0x16')]();};}function respondWithResult(_0x50d9e8,_0x273c2e){_0x273c2e=_0x273c2e||0xc8;return function(_0x39e953){if(_0x39e953){return _0x50d9e8['status'](_0x273c2e)[_0x8f00('0x17')](_0x39e953);}};}function respondWithFilteredResult(_0x5df630,_0x254b5a){return function(_0x5f20ae){if(_0x5f20ae){var _0x4ecac2=_0x5f20ae[_0x8f00('0x18')],_0x3f2daf=_0x254b5a[_0x8f00('0x19')],_0x4a30db=_0x254b5a[_0x8f00('0x19')]+_0x254b5a['limit'],_0x24d02b;if(_0x4a30db>=_0x4ecac2){_0x4a30db=_0x4ecac2;_0x24d02b=0xc8;}else{_0x24d02b=0xce;}_0x5df630[_0x8f00('0x15')](_0x24d02b);return _0x5df630[_0x8f00('0x1a')](_0x8f00('0x1b'),_0x3f2daf+'-'+_0x4a30db+'/'+_0x4ecac2)['json'](_0x5f20ae);}return null;};}function patchUpdates(_0x2e4cad){return function(_0x5d99a0){try{jsonpatch[_0x8f00('0x1c')](_0x5d99a0,_0x2e4cad,!![]);}catch(_0x56b82c){return BPromise['reject'](_0x56b82c);}return _0x5d99a0[_0x8f00('0x1d')]();};}function saveUpdates(_0x4962f4,_0x47e5ad){return function(_0x25297f){if(_0x25297f){return _0x25297f[_0x8f00('0x1e')](_0x4962f4)[_0x8f00('0x1f')](function(_0x127a74){return _0x127a74;});}return null;};}function removeEntity(_0x34f6d7,_0x4ca955){return function(_0x4424ac){if(_0x4424ac){return _0x4424ac[_0x8f00('0x20')]()[_0x8f00('0x1f')](function(){var _0x306a0a=_0x4424ac[_0x8f00('0x21')]({'plain':!![]});var _0x58f1bf=_0x8f00('0x22');return db[_0x8f00('0x23')][_0x8f00('0x20')]({'where':{'type':_0x58f1bf,'resourceId':_0x306a0a['id']}})[_0x8f00('0x1f')](function(){return _0x4424ac;});})[_0x8f00('0x1f')](function(){_0x34f6d7[_0x8f00('0x15')](0xcc)[_0x8f00('0x16')]();});}};}function handleEntityNotFound(_0x1d0379,_0x1d873b){return function(_0x5b5543){if(!_0x5b5543){_0x1d0379[_0x8f00('0x14')](0x194);}return _0x5b5543;};}function handleError(_0x29c77c,_0x2a1bd5){_0x2a1bd5=_0x2a1bd5||0x1f4;return function(_0x17f851){logger[_0x8f00('0x24')](_0x17f851[_0x8f00('0x25')]);if(_0x17f851['name']){delete _0x17f851['name'];}_0x29c77c[_0x8f00('0x15')](_0x2a1bd5)['send'](_0x17f851);};}exports[_0x8f00('0x26')]=function(_0x59d3c0,_0x11273a){var _0x690a5={},_0x43bdbb={},_0x552665={'count':0x0,'rows':[]};var _0x210cad=_[_0x8f00('0x27')](db['Pause'][_0x8f00('0x28')],function(_0x59648e){return{'name':_0x59648e[_0x8f00('0x29')],'type':_0x59648e[_0x8f00('0x2a')][_0x8f00('0x2b')]};});_0x43bdbb['model']=_['map'](_0x210cad,_0x8f00('0x2c'));_0x43bdbb['query']=_[_0x8f00('0x2d')](_0x59d3c0[_0x8f00('0x2e')]);_0x43bdbb[_0x8f00('0x2f')]=_[_0x8f00('0x30')](_0x43bdbb[_0x8f00('0x31')],_0x43bdbb[_0x8f00('0x2e')]);_0x690a5['attributes']=_[_0x8f00('0x30')](_0x43bdbb['model'],qs[_0x8f00('0x32')](_0x59d3c0[_0x8f00('0x2e')][_0x8f00('0x32')]));_0x690a5[_0x8f00('0x33')]=_0x690a5[_0x8f00('0x33')][_0x8f00('0x34')]?_0x690a5[_0x8f00('0x33')]:_0x43bdbb['model'];if(!_0x59d3c0[_0x8f00('0x2e')]['hasOwnProperty'](_0x8f00('0x35'))){_0x690a5[_0x8f00('0x36')]=qs['limit'](_0x59d3c0['query'][_0x8f00('0x36')]);_0x690a5[_0x8f00('0x19')]=qs['offset'](_0x59d3c0[_0x8f00('0x2e')][_0x8f00('0x19')]);}_0x690a5[_0x8f00('0x37')]=qs[_0x8f00('0x38')](_0x59d3c0['query'][_0x8f00('0x38')]);_0x690a5['where']=qs['filters'](_[_0x8f00('0x39')](_0x59d3c0['query'],_0x43bdbb[_0x8f00('0x2f')]),_0x210cad);if(_0x59d3c0[_0x8f00('0x2e')]['filter']){_0x690a5[_0x8f00('0x3a')]=_['merge'](_0x690a5[_0x8f00('0x3a')],{'$or':_['map'](_0x210cad,function(_0x16ef4e){if(_0x16ef4e['type']!==_0x8f00('0x3b')){var _0x449a25={};_0x449a25[_0x16ef4e[_0x8f00('0x2c')]]={'$like':'%'+_0x59d3c0[_0x8f00('0x2e')]['filter']+'%'};return _0x449a25;}})});}_0x690a5=_[_0x8f00('0x3c')]({},_0x690a5,_0x59d3c0[_0x8f00('0x3d')]);var _0x3ab6a3={'where':_0x690a5['where']};return db[_0x8f00('0x3e')][_0x8f00('0x18')](_0x3ab6a3)[_0x8f00('0x1f')](function(_0x30aa7d){_0x552665['count']=_0x30aa7d;if(_0x59d3c0[_0x8f00('0x2e')][_0x8f00('0x3f')]){_0x690a5['include']=[{'all':!![]}];}return db[_0x8f00('0x3e')][_0x8f00('0x40')](_0x690a5);})[_0x8f00('0x1f')](function(_0x107df0){_0x552665[_0x8f00('0x41')]=_0x107df0;return _0x552665;})[_0x8f00('0x1f')](respondWithFilteredResult(_0x11273a,_0x690a5))[_0x8f00('0x42')](handleError(_0x11273a,null));};exports[_0x8f00('0x43')]=function(_0x1ca37a,_0x2f05d8){var _0xca0e8a={'raw':!![],'where':{'id':_0x1ca37a[_0x8f00('0x44')]['id']}},_0x14d018={};_0x14d018[_0x8f00('0x31')]=_[_0x8f00('0x2d')](db[_0x8f00('0x3e')][_0x8f00('0x28')]);_0x14d018[_0x8f00('0x2e')]=_[_0x8f00('0x2d')](_0x1ca37a[_0x8f00('0x2e')]);_0x14d018['filters']=_['intersection'](_0x14d018['model'],_0x14d018[_0x8f00('0x2e')]);_0xca0e8a['attributes']=_[_0x8f00('0x30')](_0x14d018[_0x8f00('0x31')],qs[_0x8f00('0x32')](_0x1ca37a['query'][_0x8f00('0x32')]));_0xca0e8a['attributes']=_0xca0e8a['attributes'][_0x8f00('0x34')]?_0xca0e8a['attributes']:_0x14d018[_0x8f00('0x31')];if(_0x1ca37a['query']['includeAll']){_0xca0e8a[_0x8f00('0x45')]=[{'all':!![]}];}_0xca0e8a=_[_0x8f00('0x3c')]({},_0xca0e8a,_0x1ca37a[_0x8f00('0x3d')]);return db[_0x8f00('0x3e')][_0x8f00('0x46')](_0xca0e8a)['then'](handleEntityNotFound(_0x2f05d8,null))[_0x8f00('0x1f')](respondWithResult(_0x2f05d8,null))[_0x8f00('0x42')](handleError(_0x2f05d8,null));};exports['create']=function(_0x5d94a3,_0x5e8100){return db['Pause'][_0x8f00('0x47')](_0x5d94a3[_0x8f00('0x48')],{})['then'](function(_0x546604){var _0x39f956=_0x5d94a3[_0x8f00('0x49')]['get']({'plain':!![]});if(!_0x39f956)throw new Error(_0x8f00('0x4a'));if(_0x39f956[_0x8f00('0x4b')]===_0x8f00('0x49')){var _0x185e9f=_0x546604['get']({'plain':!![]});var _0x27959f='Pauses';return db['UserProfileSection'][_0x8f00('0x46')]({'where':{'name':_0x27959f,'userProfileId':_0x39f956[_0x8f00('0x4c')]},'raw':!![]})['then'](function(_0x1da874){if(_0x1da874&&_0x1da874[_0x8f00('0x4d')]===0x0){return db['UserProfileResource'][_0x8f00('0x47')]({'name':_0x185e9f['name'],'resourceId':_0x185e9f['id'],'type':_0x1da874[_0x8f00('0x2c')],'sectionId':_0x1da874['id']},{})[_0x8f00('0x1f')](function(){return _0x546604;});}else{return _0x546604;}})[_0x8f00('0x42')](function(_0x3cd85e){logger[_0x8f00('0x24')](_0x8f00('0x4e'),_0x3cd85e);throw _0x3cd85e;});}return _0x546604;})[_0x8f00('0x1f')](respondWithResult(_0x5e8100,0xc9))['catch'](handleError(_0x5e8100,null));};exports[_0x8f00('0x1e')]=function(_0x416510,_0x29abf4){if(_0x416510[_0x8f00('0x48')]['id']){delete _0x416510[_0x8f00('0x48')]['id'];}return db[_0x8f00('0x3e')][_0x8f00('0x46')]({'where':{'id':_0x416510[_0x8f00('0x44')]['id']}})[_0x8f00('0x1f')](handleEntityNotFound(_0x29abf4,null))[_0x8f00('0x1f')](saveUpdates(_0x416510[_0x8f00('0x48')],null))[_0x8f00('0x1f')](respondWithResult(_0x29abf4,null))[_0x8f00('0x42')](handleError(_0x29abf4,null));};exports[_0x8f00('0x20')]=function(_0x1a41ef,_0x55ac9d){return db['Pause'][_0x8f00('0x46')]({'where':{'id':_0x1a41ef[_0x8f00('0x44')]['id']}})[_0x8f00('0x1f')](handleEntityNotFound(_0x55ac9d,null))[_0x8f00('0x1f')](removeEntity(_0x55ac9d,null))[_0x8f00('0x42')](handleError(_0x55ac9d,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index e55e067..45882a2 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 _0x95f9=['rimraf','../../config/environment','exports','define','Pause','tools_pauses','util','../../config/logger','api','moment','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x95f9,0xae));var _0x995f=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x95f9[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0x995f('0x0'));var logger=require(_0x995f('0x1'))(_0x995f('0x2'));var moment=require(_0x995f('0x3'));var BPromise=require('bluebird');var rp=require(_0x995f('0x4'));var fs=require('fs');var path=require(_0x995f('0x5'));var rimraf=require(_0x995f('0x6'));var config=require(_0x995f('0x7'));var attributes=require('./pause.attributes');module[_0x995f('0x8')]=function(_0x382f70,_0x124837){return _0x382f70[_0x995f('0x9')](_0x995f('0xa'),attributes,{'tableName':_0x995f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6562=['tools_pauses','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x162c58,_0xc0b48b){var _0x328838=function(_0x33204e){while(--_0x33204e){_0x162c58['push'](_0x162c58['shift']());}};_0x328838(++_0xc0b48b);}(_0x6562,0x1ae));var _0x2656=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x6562[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0x2656('0x0'));var util=require(_0x2656('0x1'));var logger=require(_0x2656('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2656('0x3'));var rp=require(_0x2656('0x4'));var fs=require('fs');var path=require(_0x2656('0x5'));var rimraf=require(_0x2656('0x6'));var config=require(_0x2656('0x7'));var attributes=require(_0x2656('0x8'));module[_0x2656('0x9')]=function(_0x305cb4,_0x4ffbfc){return _0x305cb4[_0x2656('0xa')](_0x2656('0xb'),attributes,{'tableName':_0x2656('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 439a6d7..16dc1d9 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 _0x77f2=['util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','find','options','raw','where','map','include','attributes','model','ShowPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77f2,0x188));var _0x277f=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x77f2[_0x2e3545];return _0xcf18f;};'use strict';var _=require('lodash');var util=require(_0x277f('0x0'));var moment=require('moment');var BPromise=require(_0x277f('0x1'));var rs=require(_0x277f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x277f('0x3'))(_0x277f('0x4'));var config=require('../../config/environment');var jayson=require(_0x277f('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cfad8,_0xec2684,_0x24b21a){return new BPromise(function(_0x422495,_0x548c80){return client[_0x277f('0x6')](_0x5cfad8,_0x24b21a)[_0x277f('0x7')](function(_0xd946bc){logger[_0x277f('0x8')](_0x277f('0x9'),_0xec2684,'request\x20sent');logger[_0x277f('0xa')](_0x277f('0xb'),_0xec2684,_0x277f('0xc'),JSON[_0x277f('0xd')](_0xd946bc));if(_0xd946bc[_0x277f('0xe')]){if(_0xd946bc[_0x277f('0xe')][_0x277f('0xf')]===0x1f4){logger[_0x277f('0xe')](_0x277f('0x9'),_0xec2684,_0xd946bc['error'][_0x277f('0x10')]);return _0x548c80(_0xd946bc[_0x277f('0xe')][_0x277f('0x10')]);}logger[_0x277f('0xe')](_0x277f('0x9'),_0xec2684,_0xd946bc[_0x277f('0xe')][_0x277f('0x10')]);return _0x422495(_0xd946bc['error'][_0x277f('0x10')]);}else{logger[_0x277f('0x8')]('Pause,\x20%s,\x20%s',_0xec2684,_0x277f('0xc'));_0x422495(_0xd946bc[_0x277f('0x11')]['message']);}})[_0x277f('0x12')](function(_0x2017e8){logger['error'](_0x277f('0x9'),_0xec2684,_0x2017e8);_0x548c80(_0x2017e8);});});}exports['ShowPause']=function(_0x59312a){var _0x168a33=this;return new Promise(function(_0x1f6372,_0x48c578){return db['Pause'][_0x277f('0x13')]({'raw':_0x59312a[_0x277f('0x14')]?_0x59312a[_0x277f('0x14')][_0x277f('0x15')]===undefined?!![]:![]:!![],'where':_0x59312a['options']?_0x59312a[_0x277f('0x14')][_0x277f('0x16')]||null:null,'attributes':_0x59312a[_0x277f('0x14')]?_0x59312a[_0x277f('0x14')]['attributes']||null:null,'include':_0x59312a[_0x277f('0x14')]?_0x59312a['options']['include']?_[_0x277f('0x17')](_0x59312a[_0x277f('0x14')][_0x277f('0x18')],function(_0x45cb6c){return{'model':db[_0x45cb6c['model']],'as':_0x45cb6c['as'],'attributes':_0x45cb6c[_0x277f('0x19')],'include':_0x45cb6c['include']?_[_0x277f('0x17')](_0x45cb6c[_0x277f('0x18')],function(_0x279989){return{'model':db[_0x279989[_0x277f('0x1a')]],'as':_0x279989['as'],'attributes':_0x279989[_0x277f('0x19')],'include':_0x279989['include']?_[_0x277f('0x17')](_0x279989[_0x277f('0x18')],function(_0xf7eacc){return{'model':db[_0xf7eacc[_0x277f('0x1a')]],'as':_0xf7eacc['as'],'attributes':_0xf7eacc[_0x277f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x61b2fb){logger['info']('ShowPause',_0x59312a);logger[_0x277f('0xa')]('ShowPause',_0x59312a,JSON[_0x277f('0xd')](_0x61b2fb));_0x1f6372(_0x61b2fb);})[_0x277f('0x12')](function(_0x518ff0){logger[_0x277f('0xe')](_0x277f('0x1b'),_0x518ff0['message'],_0x59312a);_0x48c578(_0x168a33[_0x277f('0xe')](0x1f4,_0x518ff0[_0x277f('0x10')]));});});}; \ No newline at end of file +var _0xcb39=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','Pause,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','ShowPause','Pause','find','raw','options','where','attributes','include','map','model','catch','lodash','util'];(function(_0x4cad4a,_0x16f8eb){var _0x4851e0=function(_0x2a54fa){while(--_0x2a54fa){_0x4cad4a['push'](_0x4cad4a['shift']());}};_0x4851e0(++_0x16f8eb);}(_0xcb39,0x76));var _0x9cb3=function(_0x4afa19,_0x4440ef){_0x4afa19=_0x4afa19-0x0;var _0x2e6278=_0xcb39[_0x4afa19];return _0x2e6278;};'use strict';var _=require(_0x9cb3('0x0'));var util=require(_0x9cb3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9cb3('0x2'));var fs=require('fs');var Redis=require(_0x9cb3('0x3'));var db=require(_0x9cb3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9cb3('0x5'))('rpc');var config=require(_0x9cb3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cb3('0x7')][_0x9cb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28e765,_0x36586b,_0x48f9d8){return new BPromise(function(_0x3be64d,_0x155af8){return client[_0x9cb3('0x9')](_0x28e765,_0x48f9d8)[_0x9cb3('0xa')](function(_0x2ce173){logger['info'](_0x9cb3('0xb'),_0x36586b,'request\x20sent');logger[_0x9cb3('0xc')]('Pause,\x20%s,\x20%s,\x20%s',_0x36586b,_0x9cb3('0xd'),JSON[_0x9cb3('0xe')](_0x2ce173));if(_0x2ce173[_0x9cb3('0xf')]){if(_0x2ce173[_0x9cb3('0xf')]['code']===0x1f4){logger[_0x9cb3('0xf')](_0x9cb3('0xb'),_0x36586b,_0x2ce173[_0x9cb3('0xf')]['message']);return _0x155af8(_0x2ce173['error'][_0x9cb3('0x10')]);}logger[_0x9cb3('0xf')]('Pause,\x20%s,\x20%s',_0x36586b,_0x2ce173[_0x9cb3('0xf')]['message']);return _0x3be64d(_0x2ce173[_0x9cb3('0xf')][_0x9cb3('0x10')]);}else{logger[_0x9cb3('0x11')](_0x9cb3('0xb'),_0x36586b,_0x9cb3('0xd'));_0x3be64d(_0x2ce173[_0x9cb3('0x12')][_0x9cb3('0x10')]);}})['catch'](function(_0x4eff4b){logger['error'](_0x9cb3('0xb'),_0x36586b,_0x4eff4b);_0x155af8(_0x4eff4b);});});}exports[_0x9cb3('0x13')]=function(_0x238227){var _0x3aa0a5=this;return new Promise(function(_0x57e039,_0x158754){return db[_0x9cb3('0x14')][_0x9cb3('0x15')]({'raw':_0x238227['options']?_0x238227['options'][_0x9cb3('0x16')]===undefined?!![]:![]:!![],'where':_0x238227['options']?_0x238227[_0x9cb3('0x17')][_0x9cb3('0x18')]||null:null,'attributes':_0x238227[_0x9cb3('0x17')]?_0x238227[_0x9cb3('0x17')][_0x9cb3('0x19')]||null:null,'include':_0x238227[_0x9cb3('0x17')]?_0x238227[_0x9cb3('0x17')][_0x9cb3('0x1a')]?_[_0x9cb3('0x1b')](_0x238227[_0x9cb3('0x17')][_0x9cb3('0x1a')],function(_0x5489bb){return{'model':db[_0x5489bb[_0x9cb3('0x1c')]],'as':_0x5489bb['as'],'attributes':_0x5489bb[_0x9cb3('0x19')],'include':_0x5489bb[_0x9cb3('0x1a')]?_[_0x9cb3('0x1b')](_0x5489bb[_0x9cb3('0x1a')],function(_0x45f6c1){return{'model':db[_0x45f6c1[_0x9cb3('0x1c')]],'as':_0x45f6c1['as'],'attributes':_0x45f6c1[_0x9cb3('0x19')],'include':_0x45f6c1[_0x9cb3('0x1a')]?_[_0x9cb3('0x1b')](_0x45f6c1[_0x9cb3('0x1a')],function(_0x31d83e){return{'model':db[_0x31d83e[_0x9cb3('0x1c')]],'as':_0x31d83e['as'],'attributes':_0x31d83e[_0x9cb3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9cb3('0xa')](function(_0x18bfd8){logger[_0x9cb3('0x11')]('ShowPause',_0x238227);logger[_0x9cb3('0xc')](_0x9cb3('0x13'),_0x238227,JSON[_0x9cb3('0xe')](_0x18bfd8));_0x57e039(_0x18bfd8);})[_0x9cb3('0x1d')](function(_0x5fc3a4){logger[_0x9cb3('0xf')](_0x9cb3('0x13'),_0x5fc3a4['message'],_0x238227);_0x158754(_0x3aa0a5['error'](0x1f4,_0x5fc3a4[_0x9cb3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 2fc9e32..eac9f80 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 _0x6d1c=['download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','now','post','single','file','upload','/webhook','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','webhookGet','isAuthenticated','show','/:id/download'];(function(_0x179ff7,_0x441c07){var _0x4d26cf=function(_0x498ece){while(--_0x498ece){_0x179ff7['push'](_0x179ff7['shift']());}};_0x4d26cf(++_0x441c07);}(_0x6d1c,0x1ce));var _0xc6d1=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x6d1c[_0x337a10];return _0x575f98;};'use strict';var multer=require(_0xc6d1('0x0'));var util=require(_0xc6d1('0x1'));var path=require(_0xc6d1('0x2'));var timeout=require(_0xc6d1('0x3'));var express=require(_0xc6d1('0x4'));var router=express[_0xc6d1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc6d1('0x6'));var config=require(_0xc6d1('0x7'));var controller=require('./plugin.controller');router[_0xc6d1('0x8')]('/',auth['isAuthenticated'](),controller[_0xc6d1('0x9')]);router[_0xc6d1('0x8')]('/webhook',controller[_0xc6d1('0xa')]);router[_0xc6d1('0x8')]('/:id',auth[_0xc6d1('0xb')](),controller[_0xc6d1('0xc')]);router['get'](_0xc6d1('0xd'),auth['isAuthenticated'](),controller[_0xc6d1('0xe')]);var upload=multer({'storage':multer[_0xc6d1('0xf')]({'destination':function(_0x18b588,_0x551757,_0x2f1076){_0x2f1076(null,path[_0xc6d1('0x10')](config[_0xc6d1('0x11')],_0xc6d1('0x12')));},'filename':function(_0x288584,_0x5714ea,_0x4135c1){_0x5714ea[_0xc6d1('0x13')]=_0x5714ea[_0xc6d1('0x13')][_0xc6d1('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4135c1(null,util[_0xc6d1('0x15')]('%s-%s%s',path['basename'](_0x5714ea[_0xc6d1('0x13')],path[_0xc6d1('0x16')](_0x5714ea[_0xc6d1('0x13')])),Date[_0xc6d1('0x17')](),path[_0xc6d1('0x16')](_0x5714ea['originalname'])));}})});router[_0xc6d1('0x18')]('/',upload[_0xc6d1('0x19')](_0xc6d1('0x1a')),controller[_0xc6d1('0x1b')]);router['post'](_0xc6d1('0x1c'),controller['webhookPost']);router[_0xc6d1('0x1d')](_0xc6d1('0x1e'),auth['isAuthenticated'](),controller[_0xc6d1('0x1f')]);router[_0xc6d1('0x20')](_0xc6d1('0x1e'),auth[_0xc6d1('0xb')](),controller[_0xc6d1('0x20')]);module[_0xc6d1('0x21')]=router; \ No newline at end of file +var _0xc12b=['isAuthenticated','/webhook','/:id','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','upload','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get'];(function(_0x513997,_0x3a9d0c){var _0x4c88e3=function(_0x3fa8c4){while(--_0x3fa8c4){_0x513997['push'](_0x513997['shift']());}};_0x4c88e3(++_0x3a9d0c);}(_0xc12b,0x105));var _0xbc12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc12b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbc12('0x0'));var util=require('util');var path=require(_0xbc12('0x1'));var timeout=require(_0xbc12('0x2'));var express=require(_0xbc12('0x3'));var router=express[_0xbc12('0x4')]();var auth=require(_0xbc12('0x5'));var interaction=require(_0xbc12('0x6'));var config=require('../../config/environment');var controller=require(_0xbc12('0x7'));router[_0xbc12('0x8')]('/',auth[_0xbc12('0x9')](),controller['index']);router[_0xbc12('0x8')](_0xbc12('0xa'),controller['webhookGet']);router['get'](_0xbc12('0xb'),auth['isAuthenticated'](),controller[_0xbc12('0xc')]);router[_0xbc12('0x8')](_0xbc12('0xd'),auth[_0xbc12('0x9')](),controller[_0xbc12('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd0d583,_0x51974a,_0x1c93de){_0x1c93de(null,path[_0xbc12('0xf')](config['root'],_0xbc12('0x10')));},'filename':function(_0x3e5400,_0x35578f,_0x405cf2){_0x35578f[_0xbc12('0x11')]=_0x35578f['originalname'][_0xbc12('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x405cf2(null,util[_0xbc12('0x13')](_0xbc12('0x14'),path[_0xbc12('0x15')](_0x35578f[_0xbc12('0x11')],path['extname'](_0x35578f[_0xbc12('0x11')])),Date[_0xbc12('0x16')](),path[_0xbc12('0x17')](_0x35578f['originalname'])));}})});router[_0xbc12('0x18')]('/',upload['single']('file'),controller[_0xbc12('0x19')]);router[_0xbc12('0x18')](_0xbc12('0xa'),controller['webhookPost']);router[_0xbc12('0x1a')]('/:id',auth[_0xbc12('0x9')](),controller[_0xbc12('0x1b')]);router[_0xbc12('0x1c')]('/:id',auth[_0xbc12('0x9')](),controller[_0xbc12('0x1c')]);module[_0xbc12('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d2aa2fb..ef063cb 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 _0xf925=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xf925,0xeb));var _0x5f92=function(_0x420a7c,_0x3ef0bc){_0x420a7c=_0x420a7c-0x0;var _0x311c52=_0xf925[_0x420a7c];return _0x311c52;};'use strict';var Sequelize=require(_0x5f92('0x0'));module[_0x5f92('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5f92('0x2')](_0x5f92('0x3'),_0x5f92('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x5f92('0x5')],'comment':_0x5f92('0x6')},'active':{'type':Sequelize[_0x5f92('0x7')],'defaultValue':0x0,'comment':_0x5f92('0x8')},'sidebar':{'type':Sequelize[_0x5f92('0x2')](_0x5f92('0x9'),'agentOnly',_0x5f92('0xa'),_0x5f92('0xb')),'defaultValue':_0x5f92('0xa'),'comment':_0x5f92('0xc')},'icon':{'type':Sequelize[_0x5f92('0x5')]},'adminUrl':{'type':Sequelize[_0x5f92('0x5')]},'agentUrl':{'type':Sequelize[_0x5f92('0x5')]},'scriptName':{'type':Sequelize[_0x5f92('0x5')]},'scriptPath':{'type':Sequelize[_0x5f92('0x5')]}}; \ No newline at end of file +var _0xe0f0=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly'];(function(_0x41a21c,_0x30ace9){var _0x24025c=function(_0x4cb178){while(--_0x4cb178){_0x41a21c['push'](_0x41a21c['shift']());}};_0x24025c(++_0x30ace9);}(_0xe0f0,0x9e));var _0x0e0f=function(_0x247c71,_0x2254e2){_0x247c71=_0x247c71-0x0;var _0x202a3c=_0xe0f0[_0x247c71];return _0x202a3c;};'use strict';var Sequelize=require(_0x0e0f('0x0'));module[_0x0e0f('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0e0f('0x2')](_0x0e0f('0x3'),_0x0e0f('0x4'))},'description':{'type':Sequelize[_0x0e0f('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x0e0f('0x6')],'comment':_0x0e0f('0x7')},'active':{'type':Sequelize[_0x0e0f('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x0e0f('0x2')](_0x0e0f('0x9'),_0x0e0f('0xa'),_0x0e0f('0xb'),'never'),'defaultValue':_0x0e0f('0xb'),'comment':_0x0e0f('0xc')},'icon':{'type':Sequelize[_0x0e0f('0x6')]},'adminUrl':{'type':Sequelize[_0x0e0f('0x6')]},'agentUrl':{'type':Sequelize[_0x0e0f('0x6')]},'scriptName':{'type':Sequelize[_0x0e0f('0x6')]},'scriptPath':{'type':Sequelize[_0x0e0f('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 276169b..34e9be1 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 _0x2640=['sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','merge','where','type','filter','options','includeAll','include','findAll','rows','catch','show','params','download','find','join','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','pipe','glob','**/*','root','server/files/plugins','finalize','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','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','extract-zip','archiver','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then'];(function(_0x2762eb,_0x34b29b){var _0x5765f0=function(_0x38a77e){while(--_0x38a77e){_0x2762eb['push'](_0x2762eb['shift']());}};_0x5765f0(++_0x34b29b);}(_0x2640,0x12d));var _0x0264=function(_0x400542,_0x3ab703){_0x400542=_0x400542-0x0;var _0x490a04=_0x2640[_0x400542];return _0x490a04;};'use strict';var pdf=require(_0x0264('0x0'));var emlformat=require(_0x0264('0x1'));var rimraf=require(_0x0264('0x2'));var zipdir=require(_0x0264('0x3'));var jsonpatch=require(_0x0264('0x4'));var rp=require(_0x0264('0x5'));var moment=require(_0x0264('0x6'));var BPromise=require(_0x0264('0x7'));var Mustache=require(_0x0264('0x8'));var util=require(_0x0264('0x9'));var path=require(_0x0264('0xa'));var sox=require(_0x0264('0xb'));var csv=require(_0x0264('0xc'));var ejs=require(_0x0264('0xd'));var fs=require('fs');var _=require(_0x0264('0xe'));var squel=require(_0x0264('0xf'));var crypto=require(_0x0264('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x0264('0x11'));var toCsv=require(_0x0264('0xc'));var querystring=require(_0x0264('0x12'));var Papa=require('papaparse');var extract=require(_0x0264('0x13'));var rimraf=require('rimraf');var archiver=require(_0x0264('0x14'));var Redis=require('ioredis');var authService=require(_0x0264('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x0264('0x16'));var hardwareService=require(_0x0264('0x17'));var logger=require(_0x0264('0x18'))(_0x0264('0x19'));var utils=require(_0x0264('0x1a'));var config=require(_0x0264('0x1b'));var db=require(_0x0264('0x1c'))['db'];config[_0x0264('0x1d')]=_[_0x0264('0x1e')](config[_0x0264('0x1d')],{'host':_0x0264('0x1f'),'port':0x18eb});var socket=require(_0x0264('0x20'))(new Redis(config[_0x0264('0x1d')]));require(_0x0264('0x21'))[_0x0264('0x22')](socket);function respondWithStatusCode(_0x20f64f,_0x18ae91){_0x18ae91=_0x18ae91||0xcc;return function(_0x3b5fd9){if(_0x3b5fd9){return _0x20f64f['sendStatus'](_0x18ae91);}return _0x20f64f[_0x0264('0x23')](_0x18ae91)[_0x0264('0x24')]();};}function respondWithResult(_0x516d61,_0x3209b5){_0x3209b5=_0x3209b5||0xc8;return function(_0x282d7c){if(_0x282d7c){return _0x516d61[_0x0264('0x23')](_0x3209b5)[_0x0264('0x25')](_0x282d7c);}};}function respondWithFilteredResult(_0x304a0c,_0x1cd80f){return function(_0x112b57){if(_0x112b57){var _0x4884dc=_0x112b57[_0x0264('0x26')],_0xb3d669=_0x1cd80f[_0x0264('0x27')],_0xc05aef=_0x1cd80f[_0x0264('0x27')]+_0x1cd80f[_0x0264('0x28')],_0x1ad815;if(_0xc05aef>=_0x4884dc){_0xc05aef=_0x4884dc;_0x1ad815=0xc8;}else{_0x1ad815=0xce;}_0x304a0c[_0x0264('0x23')](_0x1ad815);return _0x304a0c[_0x0264('0x29')](_0x0264('0x2a'),_0xb3d669+'-'+_0xc05aef+'/'+_0x4884dc)[_0x0264('0x25')](_0x112b57);}return null;};}function patchUpdates(_0x28454c){return function(_0xb8a215){try{jsonpatch[_0x0264('0x2b')](_0xb8a215,_0x28454c,!![]);}catch(_0x45eeef){return BPromise[_0x0264('0x2c')](_0x45eeef);}return _0xb8a215[_0x0264('0x2d')]();};}function saveUpdates(_0x21b3c8,_0x3d638b){return function(_0x2fc693){if(_0x2fc693){return _0x2fc693[_0x0264('0x2e')](_0x21b3c8)['then'](function(_0x2adc86){return _0x2adc86;});}return null;};}function removeEntity(_0x29478a,_0x32941a){return function(_0x50be1b){if(_0x50be1b){return _0x50be1b[_0x0264('0x2f')]()['then'](function(){var _0x44ae78=_0x50be1b[_0x0264('0x30')]({'plain':!![]});var _0xdfb519='Plugins';return db[_0x0264('0x31')]['destroy']({'where':{'type':_0xdfb519,'resourceId':_0x44ae78['id']}})[_0x0264('0x32')](function(){return _0x50be1b;});})[_0x0264('0x32')](function(){_0x29478a[_0x0264('0x23')](0xcc)[_0x0264('0x24')]();});}};}function handleEntityNotFound(_0x47d6b8,_0x42401e){return function(_0x363cb0){if(!_0x363cb0){_0x47d6b8[_0x0264('0x33')](0x194);}return _0x363cb0;};}function handleError(_0x26820d,_0x4ce948){_0x4ce948=_0x4ce948||0x1f4;return function(_0x175b70){logger[_0x0264('0x34')](_0x175b70[_0x0264('0x35')]);if(_0x175b70['name']){delete _0x175b70[_0x0264('0x36')];}_0x26820d['status'](_0x4ce948)[_0x0264('0x37')](_0x175b70);};}exports[_0x0264('0x38')]=function(_0xd5e386,_0x1dd4f1){var _0x2eb814={},_0x35191b={},_0x3862b1={'count':0x0,'rows':[]};var _0x75f32a=_[_0x0264('0x39')](db[_0x0264('0x3a')][_0x0264('0x3b')],function(_0xc9ae6e){return{'name':_0xc9ae6e[_0x0264('0x3c')],'type':_0xc9ae6e['type'][_0x0264('0x3d')]};});_0x35191b[_0x0264('0x3e')]=_[_0x0264('0x39')](_0x75f32a,_0x0264('0x36'));_0x35191b[_0x0264('0x3f')]=_[_0x0264('0x40')](_0xd5e386[_0x0264('0x3f')]);_0x35191b[_0x0264('0x41')]=_[_0x0264('0x42')](_0x35191b[_0x0264('0x3e')],_0x35191b['query']);_0x2eb814[_0x0264('0x43')]=_['intersection'](_0x35191b['model'],qs['fields'](_0xd5e386[_0x0264('0x3f')][_0x0264('0x44')]));_0x2eb814[_0x0264('0x43')]=_0x2eb814[_0x0264('0x43')][_0x0264('0x45')]?_0x2eb814[_0x0264('0x43')]:_0x35191b['model'];if(!_0xd5e386[_0x0264('0x3f')][_0x0264('0x46')]('nolimit')){_0x2eb814[_0x0264('0x28')]=qs[_0x0264('0x28')](_0xd5e386['query']['limit']);_0x2eb814['offset']=qs['offset'](_0xd5e386['query'][_0x0264('0x27')]);}_0x2eb814['order']=qs[_0x0264('0x47')](_0xd5e386[_0x0264('0x3f')][_0x0264('0x47')]);_0x2eb814['where']=qs[_0x0264('0x41')](_['pick'](_0xd5e386[_0x0264('0x3f')],_0x35191b['filters']),_0x75f32a);if(_0xd5e386[_0x0264('0x3f')]['filter']){_0x2eb814['where']=_[_0x0264('0x48')](_0x2eb814[_0x0264('0x49')],{'$or':_['map'](_0x75f32a,function(_0x40d922){if(_0x40d922[_0x0264('0x4a')]!=='VIRTUAL'){var _0x2e1742={};_0x2e1742[_0x40d922['name']]={'$like':'%'+_0xd5e386['query'][_0x0264('0x4b')]+'%'};return _0x2e1742;}})});}_0x2eb814=_['merge']({},_0x2eb814,_0xd5e386[_0x0264('0x4c')]);var _0x1b6453={'where':_0x2eb814[_0x0264('0x49')]};return db[_0x0264('0x3a')][_0x0264('0x26')](_0x1b6453)[_0x0264('0x32')](function(_0xe6093c){_0x3862b1[_0x0264('0x26')]=_0xe6093c;if(_0xd5e386[_0x0264('0x3f')][_0x0264('0x4d')]){_0x2eb814[_0x0264('0x4e')]=[{'all':!![]}];}return db[_0x0264('0x3a')][_0x0264('0x4f')](_0x2eb814);})[_0x0264('0x32')](function(_0x35742e){_0x3862b1[_0x0264('0x50')]=_0x35742e;return _0x3862b1;})[_0x0264('0x32')](respondWithFilteredResult(_0x1dd4f1,_0x2eb814))[_0x0264('0x51')](handleError(_0x1dd4f1,null));};exports[_0x0264('0x52')]=function(_0x115dfe,_0x46a8e4){var _0x53c6f9={'raw':!![],'where':{'id':_0x115dfe[_0x0264('0x53')]['id']}},_0x3d78e3={};_0x3d78e3['model']=_[_0x0264('0x40')](db[_0x0264('0x3a')][_0x0264('0x3b')]);_0x3d78e3[_0x0264('0x3f')]=_[_0x0264('0x40')](_0x115dfe[_0x0264('0x3f')]);_0x3d78e3[_0x0264('0x41')]=_[_0x0264('0x42')](_0x3d78e3['model'],_0x3d78e3[_0x0264('0x3f')]);_0x53c6f9[_0x0264('0x43')]=_[_0x0264('0x42')](_0x3d78e3[_0x0264('0x3e')],qs[_0x0264('0x44')](_0x115dfe[_0x0264('0x3f')][_0x0264('0x44')]));_0x53c6f9[_0x0264('0x43')]=_0x53c6f9[_0x0264('0x43')]['length']?_0x53c6f9[_0x0264('0x43')]:_0x3d78e3[_0x0264('0x3e')];if(_0x115dfe[_0x0264('0x3f')][_0x0264('0x4d')]){_0x53c6f9[_0x0264('0x4e')]=[{'all':!![]}];}_0x53c6f9=_[_0x0264('0x48')]({},_0x53c6f9,_0x115dfe[_0x0264('0x4c')]);return db[_0x0264('0x3a')]['find'](_0x53c6f9)[_0x0264('0x32')](handleEntityNotFound(_0x46a8e4,null))[_0x0264('0x32')](respondWithResult(_0x46a8e4,null))[_0x0264('0x51')](handleError(_0x46a8e4,null));};exports[_0x0264('0x54')]=function(_0x537915,_0x5ef84f,_0x46f347){return db[_0x0264('0x3a')][_0x0264('0x55')]({'where':{'id':_0x537915[_0x0264('0x53')]['id']},'attributes':[_0x0264('0x36'),'path'],'raw':!![]})[_0x0264('0x32')](handleEntityNotFound(_0x5ef84f,null))[_0x0264('0x32')](function(_0x52fae3){if(_0x52fae3){var _0x13e3fc=path[_0x0264('0x56')](config['root'],'server/files/plugins',util[_0x0264('0x57')](_0x0264('0x58'),path[_0x0264('0x59')](_0x52fae3[_0x0264('0xa')])));var _0xc3e987=fs[_0x0264('0x5a')](_0x13e3fc);var _0x49b6f2=archiver(_0x0264('0x5b'),{'zlib':{'level':0x9}});_0x49b6f2['on'](_0x0264('0x5c'),function(_0x4492c0){if(_0x4492c0[_0x0264('0x5d')]===_0x0264('0x5e')){logger[_0x0264('0x34')](_0x4492c0);}else{throw new db[(_0x0264('0x5f'))][(_0x0264('0x60'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x49b6f2['on']('error',function(_0x2b45f3){throw new db[(_0x0264('0x5f'))][(_0x0264('0x60'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x49b6f2[_0x0264('0x61')](_0xc3e987);_0x49b6f2[_0x0264('0x62')](_0x0264('0x63'),{'cwd':path[_0x0264('0x56')](config[_0x0264('0x64')],_0x0264('0x65'),path['dirname'](_0x52fae3[_0x0264('0xa')])),'ignore':[path[_0x0264('0x56')](path['basename'](_0x52fae3[_0x0264('0xa')]),'node_modules/**/*'),path['join'](path[_0x0264('0x59')](_0x52fae3[_0x0264('0xa')]),'attachments/**/*')],'nodir':!![]})[_0x0264('0x66')]();_0xc3e987['on']('close',function(){if(!fs[_0x0264('0x67')](_0x13e3fc)){throw new db[(_0x0264('0x5f'))][(_0x0264('0x60'))](_0x0264('0x68'));}return _0x5ef84f[_0x0264('0x54')](_0x13e3fc,util[_0x0264('0x57')](_0x0264('0x58'),path[_0x0264('0x59')](_0x52fae3[_0x0264('0xa')])),function(_0x441ac5){if(_0x441ac5){throw new db['Sequelize'][(_0x0264('0x60'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x0264('0x69')](_0x13e3fc);logger[_0x0264('0x6a')](_0x0264('0x6b'));logger[_0x0264('0x6a')](_0x0264('0x6c'));});});}return null;})[_0x0264('0x51')](handleError(_0x5ef84f,null));};exports['upload']=function(_0x492fad,_0x859459,_0xddb51a){var _0x22407a=path[_0x0264('0x59')](_0x492fad[_0x0264('0x6d')][_0x0264('0x6e')],path[_0x0264('0x6f')](_0x492fad['file'][_0x0264('0x6e')]));var _0x384ad7=path[_0x0264('0x56')](config[_0x0264('0x64')],'server/files/plugins',_0x492fad[_0x0264('0x6d')][_0x0264('0x6e')]);var _0x3aee45=path[_0x0264('0x56')](config[_0x0264('0x64')],_0x0264('0x65'),_0x22407a);logger[_0x0264('0x6a')](_0x0264('0x70'),_0x384ad7);logger[_0x0264('0x6a')]('Plugin\x20upload\x20destination:\x20%s',_0x3aee45);try{fs[_0x0264('0x71')](_0x384ad7,parseInt('0777',0x8));extract(_0x384ad7,{'dir':_0x3aee45},function(_0x5aad74){if(_0x5aad74){logger['error'](_0x5aad74);handleError(_0x5aad74,!![]);};var _0x3b454d=fs[_0x0264('0x72')](_0x3aee45);if(_0x3b454d[_0x0264('0x45')]>0x1){removeReferences(_0x384ad7,_0x3aee45);logger[_0x0264('0x34')](_0x0264('0x73'));return _0xddb51a(new Error(_0x0264('0x73')));}var _0x1fadaa=fs[_0x0264('0x74')](path[_0x0264('0x56')](_0x3aee45,_0x3b454d[0x0]));if(_0x1fadaa[_0x0264('0x75')]()){removeReferences(_0x384ad7,_0x3aee45);logger[_0x0264('0x34')](_0x0264('0x73'));return _0xddb51a(new Error(_0x0264('0x73')));}if(_0x1fadaa[_0x0264('0x76')]()){var _0x433a6f=fs[_0x0264('0x72')](path[_0x0264('0x56')](_0x3aee45,_0x3b454d[0x0]));if(_0x433a6f['length']===0x0){removeReferences(_0x384ad7,_0x3aee45);logger[_0x0264('0x34')]('Invalid\x20plugin\x20structure');return _0xddb51a(new Error(_0x0264('0x73')));}var _0x16b658=_0x433a6f[_0x0264('0x77')](function(_0x4fc4cd){return _0x4fc4cd===_0x0264('0x78');});if(!_0x16b658){return _0xddb51a(new Error(_0x0264('0x79')));}var _0x4eff46=fs[_0x0264('0x7a')](path[_0x0264('0x56')](_0x3aee45,_0x3b454d[0x0],_0x0264('0x78')));var _0x271761=JSON[_0x0264('0x7b')](_0x4eff46);if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x36')]){return _0xddb51a(new Error(_0x0264('0x7d')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x4a')]){return _0xddb51a(new Error(_0x0264('0x7e')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x7f')]){return _0xddb51a(new Error(_0x0264('0x80')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')]){return _0xddb51a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x271761['type']===_0x0264('0x82')){if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')]){return _0xddb51a(new Error(_0x0264('0x84')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')][_0x0264('0x85')]&&_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')][_0x0264('0x86')]){return _0xddb51a(new Error(_0x0264('0x87')));}}else if(_0x271761[_0x0264('0x4a')]===_0x0264('0x88')){if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x89')]){return _0xddb51a(new Error(_0x0264('0x8a')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x8b')]){return _0xddb51a(new Error(_0x0264('0x8c')));}}else{return _0xddb51a(new Error(_0x0264('0x8d')));}var _0x4d083d=_0x271761[_0x0264('0x36')];var _0x21bd66=_0x271761[_0x0264('0x8e')];var _0x356c68=_0x271761[_0x0264('0x4a')];var _0x3b1f48=_0x271761[_0x0264('0x8f')]?_0x271761[_0x0264('0x8f')]:'always';var _0x4241e5=_0x271761[_0x0264('0x90')]?_0x271761[_0x0264('0x90')]:_0x0264('0x91');var _0x3f756d='';var _0x1650b8='';var _0x37e325='';var _0x429179='';var _0x1dc929=_0x271761[_0x0264('0x7f')];if(_0x356c68===_0x0264('0x82')){if(_0x0264('0x7c')!=typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')]['admin']){var _0x1ef882=_0x271761[_0x0264('0x81')][_0x0264('0x83')][_0x0264('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x0264('0x92')](_0x1ef882)){_0x3f756d=path[_0x0264('0x56')]('plugins',_0x22407a,_0x3b454d[0x0],_0x1ef882);}else{_0x3f756d=_0x1ef882;}}else{logger[_0x0264('0x6a')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x0264('0x7c')!=typeof _0x271761[_0x0264('0x81')]['views'][_0x0264('0x86')]){var _0x202b62=_0x271761[_0x0264('0x81')][_0x0264('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x0264('0x92')](_0x202b62)){_0x1650b8=path[_0x0264('0x56')](_0x0264('0x93'),_0x22407a,_0x3b454d[0x0],_0x202b62);}else{_0x1650b8=_0x202b62;}}else{logger[_0x0264('0x6a')](_0x0264('0x94'));}}else if(_0x356c68===_0x0264('0x88')){_0x37e325=_0x271761[_0x0264('0x81')]['scriptName'];_0x429179=_0x271761[_0x0264('0x81')][_0x0264('0x8b')];if('undefined'!=typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')]){if('undefined'!=typeof _0x271761['parameters'][_0x0264('0x83')]['admin']){var _0x1ef882=_0x271761[_0x0264('0x81')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1ef882)){_0x3f756d=path['join'](_0x0264('0x93'),_0x22407a,_0x3b454d[0x0],_0x1ef882);}else{_0x3f756d=_0x1ef882;}}if('undefined'!=typeof _0x271761['parameters'][_0x0264('0x83')][_0x0264('0x86')]){var _0x202b62=_0x271761[_0x0264('0x81')]['views'][_0x0264('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x0264('0x92')](_0x202b62)){_0x1650b8=path[_0x0264('0x56')](_0x0264('0x93'),_0x22407a,_0x3b454d[0x0],_0x202b62);}else{_0x1650b8=_0x202b62;}}}}var _0x1f80c9={'name':_0x4d083d,'description':_0x21bd66,'path':path[_0x0264('0x56')](_0x22407a,_0x3b454d[0x0]),'type':_0x356c68,'sidebar':_0x3b1f48,'icon':_0x4241e5,'adminUrl':_0x3f756d,'agentUrl':_0x1650b8,'scriptName':_0x37e325,'scriptPath':_0x429179,'version':_0x1dc929};removeReferences(_0x384ad7,null);return db[_0x0264('0x3a')][_0x0264('0x95')](_0x1f80c9)[_0x0264('0x32')](function(_0x2dda59){var _0xe4700c={'role':_0x492fad[_0x0264('0x96')][_0x0264('0x97')],'userProfileId':_0x492fad[_0x0264('0x96')][_0x0264('0x98')]};if(!_0xe4700c)throw new Error(_0x0264('0x99'));if(_0xe4700c[_0x0264('0x97')]==='user'){var _0x3e0274=_0x2dda59['get']({'plain':!![]});return db[_0x0264('0x9a')][_0x0264('0x55')]({'where':{'name':_0x0264('0x9b'),'userProfileId':_0xe4700c[_0x0264('0x98')]},'raw':!![]})['then'](function(_0x236470){if(_0x236470&&_0x236470['autoAssociation']===0x0){return db['UserProfileResource'][_0x0264('0x95')]({'name':_0x3e0274[_0x0264('0x36')],'resourceId':_0x3e0274['id'],'type':_0x236470[_0x0264('0x36')],'sectionId':_0x236470['id']},{})[_0x0264('0x32')](function(){return _0x2dda59;});}else{return _0x2dda59;}})[_0x0264('0x51')](function(_0x4be295){logger[_0x0264('0x34')](_0x0264('0x9c'),_0x4be295);throw _0x4be295;});}return _0x2dda59;})[_0x0264('0x32')](respondWithResult(_0x859459,null))[_0x0264('0x51')](handleError(_0x859459,null));}});}catch(_0x4279d5){_0x859459[_0x0264('0x23')](0x1f4)['send'](_0x4279d5);}};function removeReferences(_0x5bb671,_0x3f6998){try{if(_0x5bb671){fs['unlinkSync'](_0x5bb671);logger[_0x0264('0x6a')](_0x0264('0x9d'));}if(_0x3f6998){rimraf(_0x3f6998,function(){});logger['info'](_0x0264('0x9e'));}}catch(_0x34b646){logger['error'](_0x34b646);}}exports[_0x0264('0x2e')]=function(_0x1c8f0b,_0x406129,_0x1720a7){return db[_0x0264('0x3a')][_0x0264('0x55')]({'where':{'id':_0x1c8f0b[_0x0264('0x53')]['id']}})[_0x0264('0x32')](handleEntityNotFound(_0x406129,null))[_0x0264('0x32')](saveUpdates(_0x1c8f0b[_0x0264('0x96')],null))[_0x0264('0x32')](respondWithResult(_0x406129,null))[_0x0264('0x51')](handleError(_0x406129,null));};exports['delete']=function(_0x242d31,_0x57a461,_0x39e50e){return db[_0x0264('0x3a')][_0x0264('0x55')]({'where':{'id':_0x242d31[_0x0264('0x53')]['id']}})[_0x0264('0x32')](function(_0x5be6bb){if(_0x5be6bb){return _0x5be6bb[_0x0264('0x2f')]();}})[_0x0264('0x32')](function(_0x4d8b7a){rimraf(path['join'](config['root'],_0x0264('0x65'),path[_0x0264('0x9f')](_0x4d8b7a[_0x0264('0xa')])),function(){});return _0x4d8b7a;})[_0x0264('0x32')](handleEntityNotFound(_0x57a461,null))[_0x0264('0x32')](respondWithStatusCode(_0x57a461,null))['catch'](handleError(_0x57a461,null));};exports[_0x0264('0xa0')]=function(_0xc6982b,_0x68d446,_0x15e170){return BPromise[_0x0264('0xa1')]()['then'](function(){if(!_0xc6982b[_0x0264('0x3f')][_0x0264('0xa')]){throw new Error(_0x0264('0xa2'));}if(!_0xc6982b[_0x0264('0x3f')][_0x0264('0xa3')]){throw new Error(_0x0264('0xa4'));}var _0x26bcb3=_0xc6982b[_0x0264('0x3f')][_0x0264('0xa5')]?_0xc6982b[_0x0264('0x3f')][_0x0264('0xa5')]+':'+_0xc6982b[_0x0264('0x3f')]['port']:'http://localhost:'+_0xc6982b[_0x0264('0x3f')]['port'];var _0x4b3b3d=_0xc6982b[_0x0264('0x3f')][_0x0264('0x25')]?_0xc6982b[_0x0264('0x3f')][_0x0264('0x25')]:!![];var _0x5202ae=_0xc6982b[_0x0264('0x3f')][_0x0264('0xa6')]?_0xc6982b[_0x0264('0x3f')]['encoding']:null;var _0xce4b69={'method':_0xc6982b[_0x0264('0xa7')],'uri':util[_0x0264('0x57')](_0x0264('0xa8'),_0x26bcb3,_0xc6982b[_0x0264('0x3f')][_0x0264('0xa')]),'json':_0x4b3b3d,'resolveWithFullResponse':!![],'encoding':_0x5202ae,'qs':_0xc6982b[_0x0264('0x3f')]};if(_0xc6982b[_0x0264('0xa9')]){_0xce4b69[_0x0264('0xa9')]=_0xc6982b['headers'];if(_0xce4b69['headers'][_0x0264('0xaa')]){delete _0xce4b69['headers'][_0x0264('0xaa')];}}if(_0xce4b69[_0x0264('0xa9')][_0x0264('0xab')]){delete _0xce4b69[_0x0264('0xa9')]['content-type'];}return rp(_0xce4b69);})['then'](function(_0x3e0d8c){if(_0x3e0d8c){_0x68d446[_0x0264('0x29')](_0x3e0d8c[_0x0264('0xa9')]);logger[_0x0264('0x6a')](_0x3e0d8c[_0x0264('0x96')]);if(_[_0x0264('0xac')](_0xc6982b[_0x0264('0x3f')][_0x0264('0xa')],_0x0264('0x54'))&&_0x3e0d8c['statusCode']==0x1f4){return _0x68d446[_0x0264('0x33')](_0x3e0d8c[_0x0264('0xad')]);}else{return _0x68d446[_0x0264('0x23')](_0x3e0d8c[_0x0264('0xad')])[_0x0264('0x37')](_0x3e0d8c[_0x0264('0x96')]);}}else{return _0x68d446[_0x0264('0x33')](0xc8);}})[_0x0264('0x51')](handleError(_0x68d446,null));};exports[_0x0264('0xae')]=function(_0x4b54e3,_0x30dbba,_0x5520ed){return BPromise[_0x0264('0xa1')]()[_0x0264('0x32')](function(){if(!_0x4b54e3['query']['path']){throw new Error(_0x0264('0xa2'));}if(!_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa3')]){throw new Error(_0x0264('0xa4'));}var _0x1b721c=_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa5')]?_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa5')]+':'+_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa3')]:_0x0264('0xaf')+_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa3')];var _0x35d62d=_0x4b54e3['query'][_0x0264('0x25')]?_0x4b54e3[_0x0264('0x3f')][_0x0264('0x25')]:!![];var _0x2d640d=_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa6')]?_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa6')]:null;var _0x296bfa={'method':_0x4b54e3[_0x0264('0xa7')],'uri':util[_0x0264('0x57')](_0x0264('0xa8'),_0x1b721c,_0x4b54e3[_0x0264('0x3f')]['path']),'json':_0x35d62d,'resolveWithFullResponse':!![],'encoding':_0x2d640d,'body':_0x4b54e3[_0x0264('0x96')]};if(_0x4b54e3[_0x0264('0xa9')]){_0x296bfa['headers']=_0x4b54e3[_0x0264('0xa9')];if(_0x296bfa[_0x0264('0xa9')][_0x0264('0xaa')]){delete _0x296bfa[_0x0264('0xa9')][_0x0264('0xaa')];}}if(_0x296bfa[_0x0264('0xa9')][_0x0264('0xab')]){delete _0x296bfa[_0x0264('0xa9')]['content-type'];}return rp(_0x296bfa);})[_0x0264('0x32')](function(_0x1df936){if(_0x1df936){_0x30dbba['set'](_0x1df936[_0x0264('0xa9')]);logger[_0x0264('0x6a')](_0x1df936[_0x0264('0x96')]);return _0x30dbba[_0x0264('0x23')](_0x1df936[_0x0264('0xad')])[_0x0264('0x37')](_0x1df936[_0x0264('0x96')]);}else{return _0x30dbba['sendStatus'](0xc8);}})[_0x0264('0x51')](handleError(_0x30dbba,null));}; \ No newline at end of file +var _0x5db3=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Plugins','end','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','findAll','catch','params','find','download','join','root','server/files/plugins','format','basename','zip','code','ENOENT','error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileResource','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','port','hostname','encoding','method','%s%s','headers','content-length','content-type','statusCode','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','extract-zip','archiver','ioredis'];(function(_0x26b636,_0x255e53){var _0x21604a=function(_0xffae0a){while(--_0xffae0a){_0x26b636['push'](_0x26b636['shift']());}};_0x21604a(++_0x255e53);}(_0x5db3,0x1ee));var _0x35db=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x5db3[_0x243b59];return _0x3e1676;};'use strict';var pdf=require(_0x35db('0x0'));var emlformat=require(_0x35db('0x1'));var rimraf=require(_0x35db('0x2'));var zipdir=require(_0x35db('0x3'));var jsonpatch=require(_0x35db('0x4'));var rp=require(_0x35db('0x5'));var moment=require(_0x35db('0x6'));var BPromise=require(_0x35db('0x7'));var Mustache=require(_0x35db('0x8'));var util=require(_0x35db('0x9'));var path=require(_0x35db('0xa'));var sox=require(_0x35db('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35db('0xc'));var squel=require(_0x35db('0xd'));var crypto=require(_0x35db('0xe'));var jsforce=require(_0x35db('0xf'));var deskjs=require(_0x35db('0x10'));var toCsv=require(_0x35db('0x11'));var querystring=require('querystring');var Papa=require(_0x35db('0x12'));var extract=require(_0x35db('0x13'));var rimraf=require(_0x35db('0x2'));var archiver=require(_0x35db('0x14'));var Redis=require(_0x35db('0x15'));var authService=require(_0x35db('0x16'));var qs=require(_0x35db('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35db('0x18'))(_0x35db('0x19'));var utils=require(_0x35db('0x1a'));var config=require(_0x35db('0x1b'));var db=require(_0x35db('0x1c'))['db'];config['redis']=_[_0x35db('0x1d')](config['redis'],{'host':_0x35db('0x1e'),'port':0x18eb});var socket=require(_0x35db('0x1f'))(new Redis(config[_0x35db('0x20')]));require(_0x35db('0x21'))[_0x35db('0x22')](socket);function respondWithStatusCode(_0x2da0d5,_0x59274a){_0x59274a=_0x59274a||0xcc;return function(_0xab083c){if(_0xab083c){return _0x2da0d5[_0x35db('0x23')](_0x59274a);}return _0x2da0d5['status'](_0x59274a)['end']();};}function respondWithResult(_0x1ed81f,_0x2e09b6){_0x2e09b6=_0x2e09b6||0xc8;return function(_0x1cc0c4){if(_0x1cc0c4){return _0x1ed81f[_0x35db('0x24')](_0x2e09b6)[_0x35db('0x25')](_0x1cc0c4);}};}function respondWithFilteredResult(_0x4928aa,_0x2f5964){return function(_0x388202){if(_0x388202){var _0x237188=_0x388202[_0x35db('0x26')],_0x4affe5=_0x2f5964[_0x35db('0x27')],_0x411a25=_0x2f5964[_0x35db('0x27')]+_0x2f5964[_0x35db('0x28')],_0xc841b5;if(_0x411a25>=_0x237188){_0x411a25=_0x237188;_0xc841b5=0xc8;}else{_0xc841b5=0xce;}_0x4928aa['status'](_0xc841b5);return _0x4928aa[_0x35db('0x29')](_0x35db('0x2a'),_0x4affe5+'-'+_0x411a25+'/'+_0x237188)['json'](_0x388202);}return null;};}function patchUpdates(_0x43d705){return function(_0x41d337){try{jsonpatch[_0x35db('0x2b')](_0x41d337,_0x43d705,!![]);}catch(_0x58ec45){return BPromise[_0x35db('0x2c')](_0x58ec45);}return _0x41d337['save']();};}function saveUpdates(_0x5f4de4,_0x25db0f){return function(_0x1d33f3){if(_0x1d33f3){return _0x1d33f3[_0x35db('0x2d')](_0x5f4de4)[_0x35db('0x2e')](function(_0x1f48fb){return _0x1f48fb;});}return null;};}function removeEntity(_0x12b767,_0x5a9fcf){return function(_0x455937){if(_0x455937){return _0x455937[_0x35db('0x2f')]()[_0x35db('0x2e')](function(){var _0x86d603=_0x455937[_0x35db('0x30')]({'plain':!![]});var _0x2b5191=_0x35db('0x31');return db['UserProfileResource']['destroy']({'where':{'type':_0x2b5191,'resourceId':_0x86d603['id']}})[_0x35db('0x2e')](function(){return _0x455937;});})['then'](function(){_0x12b767[_0x35db('0x24')](0xcc)[_0x35db('0x32')]();});}};}function handleEntityNotFound(_0x9d0d2c,_0x19c47c){return function(_0x478d8b){if(!_0x478d8b){_0x9d0d2c[_0x35db('0x23')](0x194);}return _0x478d8b;};}function handleError(_0x505ebd,_0x3f9cc4){_0x3f9cc4=_0x3f9cc4||0x1f4;return function(_0x1e129a){logger['error'](_0x1e129a[_0x35db('0x33')]);if(_0x1e129a[_0x35db('0x34')]){delete _0x1e129a['name'];}_0x505ebd[_0x35db('0x24')](_0x3f9cc4)[_0x35db('0x35')](_0x1e129a);};}exports[_0x35db('0x36')]=function(_0x4a8a18,_0x41ab53){var _0x4d2edb={},_0xe446cf={},_0x4f25a6={'count':0x0,'rows':[]};var _0x13da53=_['map'](db[_0x35db('0x37')][_0x35db('0x38')],function(_0x57974b){return{'name':_0x57974b[_0x35db('0x39')],'type':_0x57974b[_0x35db('0x3a')][_0x35db('0x3b')]};});_0xe446cf['model']=_['map'](_0x13da53,'name');_0xe446cf[_0x35db('0x3c')]=_[_0x35db('0x3d')](_0x4a8a18[_0x35db('0x3c')]);_0xe446cf[_0x35db('0x3e')]=_[_0x35db('0x3f')](_0xe446cf['model'],_0xe446cf[_0x35db('0x3c')]);_0x4d2edb['attributes']=_[_0x35db('0x3f')](_0xe446cf[_0x35db('0x40')],qs[_0x35db('0x41')](_0x4a8a18[_0x35db('0x3c')][_0x35db('0x41')]));_0x4d2edb[_0x35db('0x42')]=_0x4d2edb['attributes'][_0x35db('0x43')]?_0x4d2edb[_0x35db('0x42')]:_0xe446cf['model'];if(!_0x4a8a18[_0x35db('0x3c')][_0x35db('0x44')](_0x35db('0x45'))){_0x4d2edb[_0x35db('0x28')]=qs[_0x35db('0x28')](_0x4a8a18[_0x35db('0x3c')][_0x35db('0x28')]);_0x4d2edb['offset']=qs[_0x35db('0x27')](_0x4a8a18[_0x35db('0x3c')][_0x35db('0x27')]);}_0x4d2edb[_0x35db('0x46')]=qs[_0x35db('0x47')](_0x4a8a18[_0x35db('0x3c')][_0x35db('0x47')]);_0x4d2edb[_0x35db('0x48')]=qs[_0x35db('0x3e')](_['pick'](_0x4a8a18[_0x35db('0x3c')],_0xe446cf[_0x35db('0x3e')]),_0x13da53);if(_0x4a8a18['query'][_0x35db('0x49')]){_0x4d2edb[_0x35db('0x48')]=_[_0x35db('0x4a')](_0x4d2edb[_0x35db('0x48')],{'$or':_[_0x35db('0x4b')](_0x13da53,function(_0x1b4cca){if(_0x1b4cca[_0x35db('0x3a')]!==_0x35db('0x4c')){var _0x52c2c0={};_0x52c2c0[_0x1b4cca['name']]={'$like':'%'+_0x4a8a18[_0x35db('0x3c')][_0x35db('0x49')]+'%'};return _0x52c2c0;}})});}_0x4d2edb=_[_0x35db('0x4a')]({},_0x4d2edb,_0x4a8a18[_0x35db('0x4d')]);var _0x284a77={'where':_0x4d2edb['where']};return db['Plugin'][_0x35db('0x26')](_0x284a77)[_0x35db('0x2e')](function(_0x5d20f0){_0x4f25a6[_0x35db('0x26')]=_0x5d20f0;if(_0x4a8a18[_0x35db('0x3c')][_0x35db('0x4e')]){_0x4d2edb['include']=[{'all':!![]}];}return db[_0x35db('0x37')][_0x35db('0x4f')](_0x4d2edb);})[_0x35db('0x2e')](function(_0x628dc1){_0x4f25a6['rows']=_0x628dc1;return _0x4f25a6;})['then'](respondWithFilteredResult(_0x41ab53,_0x4d2edb))[_0x35db('0x50')](handleError(_0x41ab53,null));};exports['show']=function(_0x4623d2,_0x416e97){var _0xf6f29b={'raw':!![],'where':{'id':_0x4623d2[_0x35db('0x51')]['id']}},_0x5c035a={};_0x5c035a['model']=_[_0x35db('0x3d')](db['Plugin'][_0x35db('0x38')]);_0x5c035a[_0x35db('0x3c')]=_['keys'](_0x4623d2[_0x35db('0x3c')]);_0x5c035a[_0x35db('0x3e')]=_[_0x35db('0x3f')](_0x5c035a[_0x35db('0x40')],_0x5c035a[_0x35db('0x3c')]);_0xf6f29b[_0x35db('0x42')]=_['intersection'](_0x5c035a[_0x35db('0x40')],qs[_0x35db('0x41')](_0x4623d2[_0x35db('0x3c')][_0x35db('0x41')]));_0xf6f29b[_0x35db('0x42')]=_0xf6f29b[_0x35db('0x42')][_0x35db('0x43')]?_0xf6f29b[_0x35db('0x42')]:_0x5c035a[_0x35db('0x40')];if(_0x4623d2[_0x35db('0x3c')][_0x35db('0x4e')]){_0xf6f29b['include']=[{'all':!![]}];}_0xf6f29b=_['merge']({},_0xf6f29b,_0x4623d2[_0x35db('0x4d')]);return db[_0x35db('0x37')][_0x35db('0x52')](_0xf6f29b)[_0x35db('0x2e')](handleEntityNotFound(_0x416e97,null))['then'](respondWithResult(_0x416e97,null))[_0x35db('0x50')](handleError(_0x416e97,null));};exports[_0x35db('0x53')]=function(_0x46d8e3,_0x193859,_0x1dc0e1){return db[_0x35db('0x37')][_0x35db('0x52')]({'where':{'id':_0x46d8e3['params']['id']},'attributes':[_0x35db('0x34'),'path'],'raw':!![]})[_0x35db('0x2e')](handleEntityNotFound(_0x193859,null))[_0x35db('0x2e')](function(_0xf1279a){if(_0xf1279a){var _0x5050e3=path[_0x35db('0x54')](config[_0x35db('0x55')],_0x35db('0x56'),util[_0x35db('0x57')]('%s.zip',path[_0x35db('0x58')](_0xf1279a[_0x35db('0xa')])));var _0x295f46=fs['createWriteStream'](_0x5050e3);var _0xb86e62=archiver(_0x35db('0x59'),{'zlib':{'level':0x9}});_0xb86e62['on']('warning',function(_0x5a6d57){if(_0x5a6d57[_0x35db('0x5a')]===_0x35db('0x5b')){logger[_0x35db('0x5c')](_0x5a6d57);}else{throw new db['Sequelize']['Error'](_0x35db('0x5d'));}});_0xb86e62['on'](_0x35db('0x5c'),function(_0x29c2c3){throw new db[(_0x35db('0x5e'))][(_0x35db('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xb86e62[_0x35db('0x60')](_0x295f46);_0xb86e62[_0x35db('0x61')](_0x35db('0x62'),{'cwd':path['join'](config['root'],_0x35db('0x56'),path[_0x35db('0x63')](_0xf1279a[_0x35db('0xa')])),'ignore':[path[_0x35db('0x54')](path[_0x35db('0x58')](_0xf1279a[_0x35db('0xa')]),_0x35db('0x64')),path[_0x35db('0x54')](path[_0x35db('0x58')](_0xf1279a[_0x35db('0xa')]),_0x35db('0x65'))],'nodir':!![]})[_0x35db('0x66')]();_0x295f46['on'](_0x35db('0x67'),function(){if(!fs[_0x35db('0x68')](_0x5050e3)){throw new db['Sequelize'][(_0x35db('0x5f'))]('Plugin\x20not\x20found');}return _0x193859[_0x35db('0x53')](_0x5050e3,util['format'](_0x35db('0x69'),path[_0x35db('0x58')](_0xf1279a[_0x35db('0xa')])),function(_0x15b971){if(_0x15b971){throw new db[(_0x35db('0x5e'))]['Error'](_0x35db('0x6a'));}fs['unlinkSync'](_0x5050e3);logger[_0x35db('0x6b')]('Download\x20completed');logger[_0x35db('0x6b')](_0x35db('0x6c'));});});}return null;})[_0x35db('0x50')](handleError(_0x193859,null));};exports['upload']=function(_0x516311,_0x123f35,_0x305b8b){var _0x20cd36=path[_0x35db('0x58')](_0x516311[_0x35db('0x6d')][_0x35db('0x6e')],path['extname'](_0x516311[_0x35db('0x6d')][_0x35db('0x6e')]));var _0x3570a4=path[_0x35db('0x54')](config[_0x35db('0x55')],_0x35db('0x56'),_0x516311[_0x35db('0x6d')][_0x35db('0x6e')]);var _0x5d9ed7=path[_0x35db('0x54')](config[_0x35db('0x55')],_0x35db('0x56'),_0x20cd36);logger[_0x35db('0x6b')](_0x35db('0x6f'),_0x3570a4);logger[_0x35db('0x6b')](_0x35db('0x70'),_0x5d9ed7);try{fs[_0x35db('0x71')](_0x3570a4,parseInt(_0x35db('0x72'),0x8));extract(_0x3570a4,{'dir':_0x5d9ed7},function(_0x265d74){if(_0x265d74){logger[_0x35db('0x5c')](_0x265d74);handleError(_0x265d74,!![]);};var _0x196676=fs[_0x35db('0x73')](_0x5d9ed7);if(_0x196676[_0x35db('0x43')]>0x1){removeReferences(_0x3570a4,_0x5d9ed7);logger[_0x35db('0x5c')](_0x35db('0x74'));return _0x305b8b(new Error(_0x35db('0x74')));}var _0x146b04=fs[_0x35db('0x75')](path['join'](_0x5d9ed7,_0x196676[0x0]));if(_0x146b04['isFile']()){removeReferences(_0x3570a4,_0x5d9ed7);logger[_0x35db('0x5c')](_0x35db('0x74'));return _0x305b8b(new Error(_0x35db('0x74')));}if(_0x146b04[_0x35db('0x76')]()){var _0x338ccc=fs[_0x35db('0x73')](path['join'](_0x5d9ed7,_0x196676[0x0]));if(_0x338ccc[_0x35db('0x43')]===0x0){removeReferences(_0x3570a4,_0x5d9ed7);logger[_0x35db('0x5c')](_0x35db('0x74'));return _0x305b8b(new Error(_0x35db('0x74')));}var _0x9111f7=_0x338ccc[_0x35db('0x77')](function(_0x4ad6fd){return _0x4ad6fd===_0x35db('0x78');});if(!_0x9111f7){return _0x305b8b(new Error(_0x35db('0x79')));}var _0x2765d5=fs[_0x35db('0x7a')](path[_0x35db('0x54')](_0x5d9ed7,_0x196676[0x0],_0x35db('0x78')));var _0x4ca549=JSON['parse'](_0x2765d5);if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x34')]){return _0x305b8b(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x3a')]){return _0x305b8b(new Error(_0x35db('0x7c')));}if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7d')]){return _0x305b8b(new Error(_0x35db('0x7e')));}if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7f')]){return _0x305b8b(new Error(_0x35db('0x80')));}if(_0x4ca549[_0x35db('0x3a')]==='html'){if('undefined'==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x81')]){return _0x305b8b(new Error(_0x35db('0x82')));}if('undefined'==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x81')]['admin']&&_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x81')][_0x35db('0x83')]){return _0x305b8b(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4ca549[_0x35db('0x3a')]===_0x35db('0x84')){if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x85')]){return _0x305b8b(new Error(_0x35db('0x86')));}if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x87')]){return _0x305b8b(new Error(_0x35db('0x88')));}}else{return _0x305b8b(new Error(_0x35db('0x89')));}var _0x48528f=_0x4ca549[_0x35db('0x34')];var _0x2ca2ed=_0x4ca549['description'];var _0x152484=_0x4ca549[_0x35db('0x3a')];var _0x4cf204=_0x4ca549['sidebar']?_0x4ca549[_0x35db('0x8a')]:_0x35db('0x8b');var _0x1dea79=_0x4ca549[_0x35db('0x8c')]?_0x4ca549[_0x35db('0x8c')]:_0x35db('0x8d');var _0x204613='';var _0x4d11e2='';var _0x2d6d11='';var _0x37df7e='';var _0x160604=_0x4ca549[_0x35db('0x7d')];if(_0x152484===_0x35db('0x8e')){if(_0x35db('0x7b')!=typeof _0x4ca549['parameters'][_0x35db('0x81')][_0x35db('0x8f')]){var _0x7ff33c=_0x4ca549['parameters']['views'][_0x35db('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x35db('0x90')](_0x7ff33c)){_0x204613=path[_0x35db('0x54')](_0x35db('0x91'),_0x20cd36,_0x196676[0x0],_0x7ff33c);}else{_0x204613=_0x7ff33c;}}else{logger['info'](_0x35db('0x92'));}if(_0x35db('0x7b')!=typeof _0x4ca549['parameters'][_0x35db('0x81')][_0x35db('0x83')]){var _0x18b768=_0x4ca549['parameters'][_0x35db('0x81')][_0x35db('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x35db('0x90')](_0x18b768)){_0x4d11e2=path['join']('plugins',_0x20cd36,_0x196676[0x0],_0x18b768);}else{_0x4d11e2=_0x18b768;}}else{logger[_0x35db('0x6b')](_0x35db('0x93'));}}else if(_0x152484===_0x35db('0x84')){_0x2d6d11=_0x4ca549[_0x35db('0x7f')][_0x35db('0x85')];_0x37df7e=_0x4ca549[_0x35db('0x7f')][_0x35db('0x87')];if(_0x35db('0x7b')!=typeof _0x4ca549[_0x35db('0x7f')]['views']){if(_0x35db('0x7b')!=typeof _0x4ca549[_0x35db('0x7f')]['views'][_0x35db('0x8f')]){var _0x7ff33c=_0x4ca549[_0x35db('0x7f')][_0x35db('0x81')][_0x35db('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x35db('0x90')](_0x7ff33c)){_0x204613=path[_0x35db('0x54')]('plugins',_0x20cd36,_0x196676[0x0],_0x7ff33c);}else{_0x204613=_0x7ff33c;}}if(_0x35db('0x7b')!=typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x81')][_0x35db('0x83')]){var _0x18b768=_0x4ca549[_0x35db('0x7f')]['views'][_0x35db('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x35db('0x90')](_0x18b768)){_0x4d11e2=path[_0x35db('0x54')](_0x35db('0x91'),_0x20cd36,_0x196676[0x0],_0x18b768);}else{_0x4d11e2=_0x18b768;}}}}var _0x40b0b1={'name':_0x48528f,'description':_0x2ca2ed,'path':path[_0x35db('0x54')](_0x20cd36,_0x196676[0x0]),'type':_0x152484,'sidebar':_0x4cf204,'icon':_0x1dea79,'adminUrl':_0x204613,'agentUrl':_0x4d11e2,'scriptName':_0x2d6d11,'scriptPath':_0x37df7e,'version':_0x160604};removeReferences(_0x3570a4,null);return db[_0x35db('0x37')][_0x35db('0x94')](_0x40b0b1)[_0x35db('0x2e')](function(_0x58fbc7){var _0x4bc968={'role':_0x516311[_0x35db('0x95')][_0x35db('0x96')],'userProfileId':_0x516311[_0x35db('0x95')][_0x35db('0x97')]};if(!_0x4bc968)throw new Error(_0x35db('0x98'));if(_0x4bc968['role']===_0x35db('0x99')){var _0x4f8fe7=_0x58fbc7['get']({'plain':!![]});return db['UserProfileSection'][_0x35db('0x52')]({'where':{'name':'Plugins','userProfileId':_0x4bc968[_0x35db('0x97')]},'raw':!![]})[_0x35db('0x2e')](function(_0x249c9e){if(_0x249c9e&&_0x249c9e['autoAssociation']===0x0){return db[_0x35db('0x9a')][_0x35db('0x94')]({'name':_0x4f8fe7[_0x35db('0x34')],'resourceId':_0x4f8fe7['id'],'type':_0x249c9e[_0x35db('0x34')],'sectionId':_0x249c9e['id']},{})['then'](function(){return _0x58fbc7;});}else{return _0x58fbc7;}})['catch'](function(_0x1e3dac){logger[_0x35db('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e3dac);throw _0x1e3dac;});}return _0x58fbc7;})['then'](respondWithResult(_0x123f35,null))['catch'](handleError(_0x123f35,null));}});}catch(_0x3655d6){_0x123f35[_0x35db('0x24')](0x1f4)[_0x35db('0x35')](_0x3655d6);}};function removeReferences(_0x301170,_0x3d0c48){try{if(_0x301170){fs[_0x35db('0x9b')](_0x301170);logger[_0x35db('0x6b')](_0x35db('0x9c'));}if(_0x3d0c48){rimraf(_0x3d0c48,function(){});logger[_0x35db('0x6b')](_0x35db('0x9d'));}}catch(_0x3097f4){logger['error'](_0x3097f4);}}exports[_0x35db('0x2d')]=function(_0x1f219f,_0x444526,_0x11b3e1){return db[_0x35db('0x37')][_0x35db('0x52')]({'where':{'id':_0x1f219f[_0x35db('0x51')]['id']}})['then'](handleEntityNotFound(_0x444526,null))[_0x35db('0x2e')](saveUpdates(_0x1f219f['body'],null))['then'](respondWithResult(_0x444526,null))[_0x35db('0x50')](handleError(_0x444526,null));};exports[_0x35db('0x9e')]=function(_0x1a1e5e,_0x9b3c25,_0x2a8467){return db[_0x35db('0x37')][_0x35db('0x52')]({'where':{'id':_0x1a1e5e[_0x35db('0x51')]['id']}})[_0x35db('0x2e')](function(_0x154a2f){if(_0x154a2f){return _0x154a2f[_0x35db('0x2f')]();}})[_0x35db('0x2e')](function(_0x3b32ea){rimraf(path[_0x35db('0x54')](config[_0x35db('0x55')],'server/files/plugins',path['dirname'](_0x3b32ea[_0x35db('0xa')])),function(){});return _0x3b32ea;})[_0x35db('0x2e')](handleEntityNotFound(_0x9b3c25,null))[_0x35db('0x2e')](respondWithStatusCode(_0x9b3c25,null))[_0x35db('0x50')](handleError(_0x9b3c25,null));};exports[_0x35db('0x9f')]=function(_0x50cd8b,_0x174e14,_0x5f2b50){return BPromise['resolve']()[_0x35db('0x2e')](function(){if(!_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x280883=_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa1')]?_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa1')]+':'+_0x50cd8b[_0x35db('0x3c')]['port']:'http://localhost:'+_0x50cd8b[_0x35db('0x3c')]['port'];var _0xfd7e24=_0x50cd8b['query'][_0x35db('0x25')]?_0x50cd8b[_0x35db('0x3c')][_0x35db('0x25')]:!![];var _0x387d59=_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa2')]?_0x50cd8b['query']['encoding']:null;var _0x38c3f1={'method':_0x50cd8b[_0x35db('0xa3')],'uri':util[_0x35db('0x57')](_0x35db('0xa4'),_0x280883,_0x50cd8b['query'][_0x35db('0xa')]),'json':_0xfd7e24,'resolveWithFullResponse':!![],'encoding':_0x387d59,'qs':_0x50cd8b['query']};if(_0x50cd8b[_0x35db('0xa5')]){_0x38c3f1['headers']=_0x50cd8b[_0x35db('0xa5')];if(_0x38c3f1[_0x35db('0xa5')][_0x35db('0xa6')]){delete _0x38c3f1[_0x35db('0xa5')][_0x35db('0xa6')];}}if(_0x38c3f1[_0x35db('0xa5')]['content-type']){delete _0x38c3f1[_0x35db('0xa5')][_0x35db('0xa7')];}return rp(_0x38c3f1);})['then'](function(_0x521937){if(_0x521937){_0x174e14[_0x35db('0x29')](_0x521937[_0x35db('0xa5')]);logger[_0x35db('0x6b')](_0x521937[_0x35db('0x95')]);if(_['endsWith'](_0x50cd8b['query'][_0x35db('0xa')],_0x35db('0x53'))&&_0x521937[_0x35db('0xa8')]==0x1f4){return _0x174e14['sendStatus'](_0x521937['statusCode']);}else{return _0x174e14['status'](_0x521937['statusCode'])[_0x35db('0x35')](_0x521937[_0x35db('0x95')]);}}else{return _0x174e14[_0x35db('0x23')](0xc8);}})[_0x35db('0x50')](handleError(_0x174e14,null));};exports['webhookPost']=function(_0x313ff7,_0x571ece,_0x4c15e4){return BPromise[_0x35db('0xa9')]()[_0x35db('0x2e')](function(){if(!_0x313ff7['query'][_0x35db('0xa')]){throw new Error(_0x35db('0xaa'));}if(!_0x313ff7[_0x35db('0x3c')][_0x35db('0xa0')]){throw new Error(_0x35db('0xab'));}var _0x5010da=_0x313ff7['query'][_0x35db('0xa1')]?_0x313ff7[_0x35db('0x3c')][_0x35db('0xa1')]+':'+_0x313ff7[_0x35db('0x3c')][_0x35db('0xa0')]:'http://localhost:'+_0x313ff7[_0x35db('0x3c')]['port'];var _0x5161e0=_0x313ff7[_0x35db('0x3c')][_0x35db('0x25')]?_0x313ff7[_0x35db('0x3c')][_0x35db('0x25')]:!![];var _0x1a76c7=_0x313ff7[_0x35db('0x3c')][_0x35db('0xa2')]?_0x313ff7[_0x35db('0x3c')]['encoding']:null;var _0x1dae03={'method':_0x313ff7[_0x35db('0xa3')],'uri':util['format'](_0x35db('0xa4'),_0x5010da,_0x313ff7[_0x35db('0x3c')][_0x35db('0xa')]),'json':_0x5161e0,'resolveWithFullResponse':!![],'encoding':_0x1a76c7,'body':_0x313ff7[_0x35db('0x95')]};if(_0x313ff7['headers']){_0x1dae03[_0x35db('0xa5')]=_0x313ff7['headers'];if(_0x1dae03[_0x35db('0xa5')]['content-length']){delete _0x1dae03['headers'][_0x35db('0xa6')];}}if(_0x1dae03['headers']['content-type']){delete _0x1dae03[_0x35db('0xa5')][_0x35db('0xa7')];}return rp(_0x1dae03);})[_0x35db('0x2e')](function(_0xce0105){if(_0xce0105){_0x571ece['set'](_0xce0105[_0x35db('0xa5')]);logger[_0x35db('0x6b')](_0xce0105['body']);return _0x571ece['status'](_0xce0105['statusCode'])[_0x35db('0x35')](_0xce0105[_0x35db('0x95')]);}else{return _0x571ece[_0x35db('0x23')](0xc8);}})['catch'](handleError(_0x571ece,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a912672..eecc42b 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 _0xdf55=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xb70919,_0x360b63){var _0x285189=function(_0x3f7964){while(--_0x3f7964){_0xb70919['push'](_0xb70919['shift']());}};_0x285189(++_0x360b63);}(_0xdf55,0x83));var _0x5df5=function(_0x11fd4e,_0x1a32ec){_0x11fd4e=_0x11fd4e-0x0;var _0x324371=_0xdf55[_0x11fd4e];return _0x324371;};'use strict';var EventEmitter=require(_0x5df5('0x0'));var Plugin=require(_0x5df5('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5df5('0x2')](0x0);var events={'afterCreate':_0x5df5('0x3'),'afterUpdate':'update','afterDestroy':_0x5df5('0x4')};function emitEvent(_0x773e15){return function(_0x381a4c,_0x521007,_0x289af4){PluginEvents[_0x5df5('0x5')](_0x773e15+':'+_0x381a4c['id'],_0x381a4c);PluginEvents[_0x5df5('0x5')](_0x773e15,_0x381a4c);_0x289af4(null);};}for(var e in events){if(events[_0x5df5('0x6')](e)){var event=events[e];Plugin[_0x5df5('0x7')](e,emitEvent(event));}}module[_0x5df5('0x8')]=PluginEvents; \ No newline at end of file +var _0x1eba=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','emit'];(function(_0x483f52,_0x8466d7){var _0x1b9605=function(_0x42eceb){while(--_0x42eceb){_0x483f52['push'](_0x483f52['shift']());}};_0x1b9605(++_0x8466d7);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x1eba[_0x218994];return _0x3f350b;};'use strict';var EventEmitter=require(_0xa1eb('0x0'));var Plugin=require(_0xa1eb('0x1'))['db'][_0xa1eb('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xa1eb('0x3')](0x0);var events={'afterCreate':_0xa1eb('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x205802){return function(_0x34be5a,_0x16a13a,_0xf9d704){PluginEvents[_0xa1eb('0x5')](_0x205802+':'+_0x34be5a['id'],_0x34be5a);PluginEvents[_0xa1eb('0x5')](_0x205802,_0x34be5a);_0xf9d704(null);};}for(var e in events){if(events[_0xa1eb('0x6')](e)){var event=events[e];Plugin[_0xa1eb('0x7')](e,emitEvent(event));}}module[_0xa1eb('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index d48b4ba..3936632 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 _0x9a04=['bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','lodash','util','api','moment'];(function(_0x12c654,_0x40c772){var _0x136ecc=function(_0x18cd9d){while(--_0x18cd9d){_0x12c654['push'](_0x12c654['shift']());}};_0x136ecc(++_0x40c772);}(_0x9a04,0xf8));var _0x49a0=function(_0x212ab5,_0x42ebb0){_0x212ab5=_0x212ab5-0x0;var _0x475366=_0x9a04[_0x212ab5];return _0x475366;};'use strict';var _=require(_0x49a0('0x0'));var util=require(_0x49a0('0x1'));var logger=require('../../config/logger')(_0x49a0('0x2'));var moment=require(_0x49a0('0x3'));var BPromise=require(_0x49a0('0x4'));var rp=require(_0x49a0('0x5'));var fs=require('fs');var path=require(_0x49a0('0x6'));var rimraf=require(_0x49a0('0x7'));var config=require(_0x49a0('0x8'));var attributes=require(_0x49a0('0x9'));module[_0x49a0('0xa')]=function(_0x570c7d,_0x2f4789){return _0x570c7d['define'](_0x49a0('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38e3=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','Plugin','plugins','lodash'];(function(_0x27653b,_0x360f5d){var _0x31a80e=function(_0x3eb8d5){while(--_0x3eb8d5){_0x27653b['push'](_0x27653b['shift']());}};_0x31a80e(++_0x360f5d);}(_0x38e3,0x107));var _0x338e=function(_0x4f6de9,_0x169839){_0x4f6de9=_0x4f6de9-0x0;var _0x24aaca=_0x38e3[_0x4f6de9];return _0x24aaca;};'use strict';var _=require(_0x338e('0x0'));var util=require(_0x338e('0x1'));var logger=require(_0x338e('0x2'))(_0x338e('0x3'));var moment=require('moment');var BPromise=require(_0x338e('0x4'));var rp=require(_0x338e('0x5'));var fs=require('fs');var path=require(_0x338e('0x6'));var rimraf=require(_0x338e('0x7'));var config=require('../../config/environment');var attributes=require(_0x338e('0x8'));module[_0x338e('0x9')]=function(_0x55d781,_0x148562){return _0x55d781['define'](_0x338e('0xa'),attributes,{'tableName':_0x338e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 3560fbe..a2ca23f 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 _0x7a37=['error','code','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','moment','bluebird','../../config/logger','../../config/environment','client','defaults','localhost','redis','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x33a7a9,_0xb33ec5){var _0x53b7af=function(_0x56bb7d){while(--_0x56bb7d){_0x33a7a9['push'](_0x33a7a9['shift']());}};_0x53b7af(++_0xb33ec5);}(_0x7a37,0x184));var _0x77a3=function(_0x3f731b,_0x4d4d7e){_0x3f731b=_0x3f731b-0x0;var _0x5e0592=_0x7a37[_0x3f731b];return _0x5e0592;};'use strict';var _=require(_0x77a3('0x0'));var util=require('util');var moment=require(_0x77a3('0x1'));var BPromise=require(_0x77a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x77a3('0x3'))('rpc');var config=require(_0x77a3('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x77a3('0x5')]['http']({'port':0x232a});config['redis']=_[_0x77a3('0x6')](config['redis'],{'host':_0x77a3('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77a3('0x8')]));require(_0x77a3('0x9'))['register'](socket);function respondWithRpcPromise(_0x1b3b0d,_0x4a2e40,_0xc4d232){return new BPromise(function(_0x2b8499,_0x1038e9){return client[_0x77a3('0xa')](_0x1b3b0d,_0xc4d232)[_0x77a3('0xb')](function(_0x3e43ea){logger[_0x77a3('0xc')](_0x77a3('0xd'),_0x4a2e40,_0x77a3('0xe'));logger[_0x77a3('0xf')](_0x77a3('0x10'),_0x4a2e40,_0x77a3('0xe'),JSON[_0x77a3('0x11')](_0x3e43ea));if(_0x3e43ea[_0x77a3('0x12')]){if(_0x3e43ea['error'][_0x77a3('0x13')]===0x1f4){logger[_0x77a3('0x12')]('Plugin,\x20%s,\x20%s',_0x4a2e40,_0x3e43ea[_0x77a3('0x12')][_0x77a3('0x14')]);return _0x1038e9(_0x3e43ea['error']['message']);}logger['error'](_0x77a3('0xd'),_0x4a2e40,_0x3e43ea['error'][_0x77a3('0x14')]);return _0x2b8499(_0x3e43ea[_0x77a3('0x12')][_0x77a3('0x14')]);}else{logger[_0x77a3('0xc')](_0x77a3('0xd'),_0x4a2e40,_0x77a3('0xe'));_0x2b8499(_0x3e43ea[_0x77a3('0x15')][_0x77a3('0x14')]);}})[_0x77a3('0x16')](function(_0x3273e3){logger['error'](_0x77a3('0xd'),_0x4a2e40,_0x3273e3);_0x1038e9(_0x3273e3);});});}exports['CreatePlugin']=function(_0x128a1b){var _0x1b0759=this;return new Promise(function(_0x1cdd55,_0xaa9540){return db[_0x77a3('0x17')][_0x77a3('0x18')](_0x128a1b[_0x77a3('0x19')],{'raw':_0x128a1b[_0x77a3('0x1a')]?_0x128a1b[_0x77a3('0x1a')][_0x77a3('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xf9d33f){logger[_0x77a3('0xc')](_0x77a3('0x1c'),_0x128a1b);logger[_0x77a3('0xf')]('CreatePlugin',_0x128a1b,JSON[_0x77a3('0x11')](_0xf9d33f));_0x1cdd55(_0xf9d33f);})[_0x77a3('0x16')](function(_0x3acfad){logger['error'](_0x77a3('0x1c'),_0x3acfad['message'],_0x128a1b);_0xaa9540(_0x1b0759[_0x77a3('0x12')](0x1f4,_0x3acfad[_0x77a3('0x14')]));});});}; \ No newline at end of file +var _0x76b7=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreatePlugin','Plugin','body','options','raw','debug','stringify','util','moment','bluebird','ioredis'];(function(_0x2c0c40,_0x29f6da){var _0x16b689=function(_0x15e592){while(--_0x15e592){_0x2c0c40['push'](_0x2c0c40['shift']());}};_0x16b689(++_0x29f6da);}(_0x76b7,0x80));var _0x776b=function(_0x442e0d,_0x4c325d){_0x442e0d=_0x442e0d-0x0;var _0xa809b6=_0x76b7[_0x442e0d];return _0xa809b6;};'use strict';var _=require('lodash');var util=require(_0x776b('0x0'));var moment=require(_0x776b('0x1'));var BPromise=require(_0x776b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x776b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x776b('0x4'));var logger=require(_0x776b('0x5'))(_0x776b('0x6'));var config=require(_0x776b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x776b('0x8')][_0x776b('0x9')]({'port':0x232a});config['redis']=_[_0x776b('0xa')](config['redis'],{'host':_0x776b('0xb'),'port':0x18eb});var socket=require(_0x776b('0xc'))(new Redis(config[_0x776b('0xd')]));require(_0x776b('0xe'))[_0x776b('0xf')](socket);function respondWithRpcPromise(_0x5bfd9b,_0x5c2487,_0x1d156a){return new BPromise(function(_0x419498,_0x48a4bf){return client['request'](_0x5bfd9b,_0x1d156a)[_0x776b('0x10')](function(_0x5a01a6){logger[_0x776b('0x11')](_0x776b('0x12'),_0x5c2487,'request\x20sent');logger['debug'](_0x776b('0x13'),_0x5c2487,_0x776b('0x14'),JSON['stringify'](_0x5a01a6));if(_0x5a01a6[_0x776b('0x15')]){if(_0x5a01a6['error'][_0x776b('0x16')]===0x1f4){logger[_0x776b('0x15')]('Plugin,\x20%s,\x20%s',_0x5c2487,_0x5a01a6[_0x776b('0x15')][_0x776b('0x17')]);return _0x48a4bf(_0x5a01a6[_0x776b('0x15')][_0x776b('0x17')]);}logger['error'](_0x776b('0x12'),_0x5c2487,_0x5a01a6[_0x776b('0x15')][_0x776b('0x17')]);return _0x419498(_0x5a01a6[_0x776b('0x15')][_0x776b('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x5c2487,_0x776b('0x14'));_0x419498(_0x5a01a6[_0x776b('0x18')][_0x776b('0x17')]);}})[_0x776b('0x19')](function(_0x2f3dab){logger['error'](_0x776b('0x12'),_0x5c2487,_0x2f3dab);_0x48a4bf(_0x2f3dab);});});}exports[_0x776b('0x1a')]=function(_0x535486){var _0x414355=this;return new Promise(function(_0x1fb8ea,_0x315f67){return db[_0x776b('0x1b')]['create'](_0x535486[_0x776b('0x1c')],{'raw':_0x535486[_0x776b('0x1d')]?_0x535486[_0x776b('0x1d')][_0x776b('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x163c33){logger[_0x776b('0x11')](_0x776b('0x1a'),_0x535486);logger[_0x776b('0x1f')](_0x776b('0x1a'),_0x535486,JSON[_0x776b('0x20')](_0x163c33));_0x1fb8ea(_0x163c33);})['catch'](function(_0x2a03ff){logger['error'](_0x776b('0x1a'),_0x2a03ff[_0x776b('0x17')],_0x535486);_0x315f67(_0x414355[_0x776b('0x15')](0x1f4,_0x2a03ff[_0x776b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9cfd238..224d685 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 _0x7e22=['update','emit','register','plugin:','./plugin.events','remove'];(function(_0x27332e,_0x247ad6){var _0x5882fc=function(_0x263c21){while(--_0x263c21){_0x27332e['push'](_0x27332e['shift']());}};_0x5882fc(++_0x247ad6);}(_0x7e22,0x1d8));var _0x27e2=function(_0x568a91,_0x19aaa7){_0x568a91=_0x568a91-0x0;var _0x764498=_0x7e22[_0x568a91];return _0x764498;};'use strict';var PluginEvents=require(_0x27e2('0x0'));var events=['save',_0x27e2('0x1'),_0x27e2('0x2')];function createListener(_0x34245e,_0x317692){return function(_0x1b0477){_0x317692[_0x27e2('0x3')](_0x34245e,_0x1b0477);};}function removeListener(_0x5e5b08,_0x43868c){return function(){PluginEvents['removeListener'](_0x5e5b08,_0x43868c);};}exports[_0x27e2('0x4')]=function(_0x350996){for(var _0x3eb3cd=0x0,_0x8ec259=events['length'];_0x3eb3cd<_0x8ec259;_0x3eb3cd++){var _0x207ab6=events[_0x3eb3cd];var _0x419985=createListener(_0x27e2('0x5')+_0x207ab6,_0x350996);PluginEvents['on'](_0x207ab6,_0x419985);}}; \ No newline at end of file +var _0x6743=['plugin:','./plugin.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2426d6,_0x1ce8c2){var _0x2fbcb8=function(_0x7ede11){while(--_0x7ede11){_0x2426d6['push'](_0x2426d6['shift']());}};_0x2fbcb8(++_0x1ce8c2);}(_0x6743,0xd0));var _0x3674=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x6743[_0x6a0266];return _0x309e00;};'use strict';var PluginEvents=require(_0x3674('0x0'));var events=[_0x3674('0x1'),_0x3674('0x2'),_0x3674('0x3')];function createListener(_0xfe27aa,_0x99946b){return function(_0x188d96){_0x99946b[_0x3674('0x4')](_0xfe27aa,_0x188d96);};}function removeListener(_0xa75fc3,_0x4b813c){return function(){PluginEvents[_0x3674('0x5')](_0xa75fc3,_0x4b813c);};}exports[_0x3674('0x6')]=function(_0x389012){for(var _0x4b203f=0x0,_0x3673b5=events[_0x3674('0x7')];_0x4b203f<_0x3673b5;_0x4b203f++){var _0x46628=events[_0x4b203f];var _0xa634b2=createListener(_0x3674('0x8')+_0x46628,_0x389012);PluginEvents['on'](_0x46628,_0xa634b2);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 20b8e87..2bee05a 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 _0x51bc=['Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x49dd44,_0x2d169a){var _0x40ec9f=function(_0x582ae9){while(--_0x582ae9){_0x49dd44['push'](_0x49dd44['shift']());}};_0x40ec9f(++_0x2d169a);}(_0x51bc,0x179));var _0xc51b=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x51bc[_0x100682];return _0xcb6e87;};'use strict';var express=require('express');var router=express[_0xc51b('0x0')]();var auth=require(_0xc51b('0x1'));var controller=require(_0xc51b('0x2'));router[_0xc51b('0x3')]('/',auth[_0xc51b('0x4')](),controller[_0xc51b('0x5')]);router['get'](_0xc51b('0x6'),auth['isAuthenticated'](),controller[_0xc51b('0x7')]);router[_0xc51b('0x8')]('/',auth[_0xc51b('0x4')](),controller[_0xc51b('0x9')]);router['put']('/:id',auth[_0xc51b('0x4')](),controller[_0xc51b('0xa')]);router[_0xc51b('0xb')](_0xc51b('0x6'),auth[_0xc51b('0x4')](),controller[_0xc51b('0xc')]);module['exports']=router; \ No newline at end of file +var _0xc3aa=['/:id','show','create','put','update','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','index'];(function(_0x10af78,_0x27fb9d){var _0x14573d=function(_0x22dadd){while(--_0x22dadd){_0x10af78['push'](_0x10af78['shift']());}};_0x14573d(++_0x27fb9d);}(_0xc3aa,0x18e));var _0xac3a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc3aa[_0x2be8c2];return _0x97f531;};'use strict';var express=require(_0xac3a('0x0'));var router=express[_0xac3a('0x1')]();var auth=require(_0xac3a('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0xac3a('0x3')](),controller[_0xac3a('0x4')]);router['get'](_0xac3a('0x5'),auth['isAuthenticated'](),controller[_0xac3a('0x6')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac3a('0x7')]);router[_0xac3a('0x8')](_0xac3a('0x5'),auth['isAuthenticated'](),controller[_0xac3a('0x9')]);router[_0xac3a('0xa')](_0xac3a('0x5'),auth[_0xac3a('0x3')](),controller[_0xac3a('0xb')]);module[_0xac3a('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 529b6f6..beeebfa 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 _0x0fe9=['../../config/logger','child_process','exec','bluebird','json','stack','status','send','npm\x20install','info','index','list','then','reject','name','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0x0fe9,0x18e));var _0x90fe=function(_0x348126,_0x148d92){_0x348126=_0x348126-0x0;var _0x3b19f5=_0x0fe9[_0x348126];return _0x3b19f5;};'use strict';var _=require(_0x90fe('0x0'));var pm2=require(_0x90fe('0x1'));var logger=require(_0x90fe('0x2'))('api');var path=require('path');var exec=require(_0x90fe('0x3'))[_0x90fe('0x4')];var BPromise=require(_0x90fe('0x5'));function handleEntityNotFound(_0x1c98fc,_0x36f5c4){return function(_0x409016){if(!_0x409016){_0x1c98fc['sendStatus'](0x194);;}return _0x409016;};}function respondWithResult(_0xebc5d1,_0x372536){_0x372536=_0x372536||0xc8;return function(_0x731a){if(_0x731a){return _0xebc5d1['status'](_0x372536)[_0x90fe('0x6')](_0x731a);}return null;};}function handleError(_0x5d39de,_0xaf31e8){_0xaf31e8=_0xaf31e8||0x1f4;return function(_0x3a8216){logger['error'](_0x3a8216[_0x90fe('0x7')]);if(_0x3a8216['name']){delete _0x3a8216['name'];}_0x5d39de[_0x90fe('0x8')](_0xaf31e8)[_0x90fe('0x9')](_0x3a8216);};}function execChildProcess(){return new BPromise(function(_0x147e86,_0x5ee1fb){exec(_0x90fe('0xa'),function(_0x49dc5c,_0x421d1d,_0xed19c0){logger[_0x90fe('0xb')](_0x421d1d);logger[_0x90fe('0xb')](_0xed19c0);if(_0x49dc5c){logger['error'](_0x49dc5c);return _0x5ee1fb(_0x49dc5c);}return _0x147e86(_0x421d1d);});});}exports[_0x90fe('0xc')]=function(_0x546470,_0x706879){return pm2[_0x90fe('0xd')]()[_0x90fe('0xe')](function(_0x2776f1){if(_0x2776f1){var _0xdc29d=_[_0x90fe('0xf')](_0x2776f1,function(_0x29a194){return _0x29a194[_0x90fe('0x10')]===_0x90fe('0x11')||_0x29a194[_0x90fe('0x10')]===_0x90fe('0x12');});return{'rows':_0xdc29d,'count':_0xdc29d[_0x90fe('0x13')]};}return null;})['then'](respondWithResult(_0x706879,null))[_0x90fe('0x14')](handleError(_0x706879,null));};exports[_0x90fe('0x15')]=function(_0x482ee4,_0xe00888){return pm2[_0x90fe('0x16')](_0x482ee4[_0x90fe('0x17')]['id'])[_0x90fe('0xe')](respondWithResult(_0xe00888,null))[_0x90fe('0xe')](handleEntityNotFound(_0xe00888,null))['catch'](handleError(_0xe00888,null));};exports['create']=function(_0x392f8e,_0x378a45){if(_0x392f8e[_0x90fe('0x18')][_0x90fe('0x10')]&&_0x392f8e[_0x90fe('0x18')][_0x90fe('0x19')]){var _0x1275fe=path[_0x90fe('0x1a')](__dirname,_0x90fe('0x1b'),_0x392f8e[_0x90fe('0x18')][_0x90fe('0x19')]);var _0x4730d0=process[_0x90fe('0x1c')]();process[_0x90fe('0x1d')](path['dirname'](_0x1275fe));return execChildProcess()[_0x90fe('0xe')](function(_0x4254ab){process[_0x90fe('0x1d')](_0x4730d0);return pm2[_0x90fe('0x1e')]({'name':_0x392f8e[_0x90fe('0x18')]['name'],'script':_0x1275fe});})[_0x90fe('0xe')](function(_0x3cee85){pm2[_0x90fe('0x1f')]();return _0x3cee85[0x0];})[_0x90fe('0xe')](respondWithResult(_0x378a45,0xc9))[_0x90fe('0x14')](handleError(_0x378a45,null));}else{return _0x378a45[_0x90fe('0x8')](0x1f4)['send']({'message':_0x90fe('0x20')});}};exports[_0x90fe('0x21')]=function(_0x2444fb,_0x4c8ab5){if(_0x2444fb[_0x90fe('0x18')]['id']){delete _0x2444fb['body']['id'];}var _0x5b4da5={'online':'restart','stopped':_0x90fe('0x22')};if(_0x5b4da5[_0x90fe('0x23')](_0x2444fb[_0x90fe('0x18')][_0x90fe('0x8')])){return pm2[_0x5b4da5[_0x2444fb[_0x90fe('0x18')][_0x90fe('0x8')]]](_0x2444fb[_0x90fe('0x17')]['id'])['then'](respondWithResult(_0x4c8ab5,0xc8))['catch'](handleError(_0x4c8ab5,null));}else{return _0x4c8ab5['status'](0x1f4)[_0x90fe('0x9')]({'message':_0x90fe('0x24')});}};exports[_0x90fe('0x25')]=function(_0x4bfd74,_0x161d8d){if(_0x4bfd74[_0x90fe('0x18')]['id']){delete _0x4bfd74['body']['id'];}if(_0x4bfd74[_0x90fe('0x17')]['id']){return pm2[_0x90fe('0x26')](_0x4bfd74[_0x90fe('0x17')]['id'])[_0x90fe('0xe')](function(_0x2f5143){pm2[_0x90fe('0x1f')]();return _0x2f5143[0x0];})[_0x90fe('0xe')](respondWithResult(_0x161d8d,null))['catch'](handleError(_0x161d8d,null));}else{return _0x161d8d[_0x90fe('0x8')](0x1f4)[_0x90fe('0x9')]({'message':_0x90fe('0x27')});}}; \ No newline at end of file +var _0x270b=['delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','exec','bluebird','sendStatus','status','json','stack','name','npm\x20install','info','error','index','list','then','reject','express','motion2','length','show','params','catch','create','body','script','join','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','destroy'];(function(_0x4f698e,_0x17fcac){var _0x107668=function(_0x2d0e56){while(--_0x2d0e56){_0x4f698e['push'](_0x4f698e['shift']());}};_0x107668(++_0x17fcac);}(_0x270b,0x173));var _0xb270=function(_0x3090b9,_0x44b3e7){_0x3090b9=_0x3090b9-0x0;var _0x5ab367=_0x270b[_0x3090b9];return _0x5ab367;};'use strict';var _=require(_0xb270('0x0'));var pm2=require(_0xb270('0x1'));var logger=require(_0xb270('0x2'))('api');var path=require(_0xb270('0x3'));var exec=require('child_process')[_0xb270('0x4')];var BPromise=require(_0xb270('0x5'));function handleEntityNotFound(_0x4db732,_0x787652){return function(_0x44fbcd){if(!_0x44fbcd){_0x4db732[_0xb270('0x6')](0x194);;}return _0x44fbcd;};}function respondWithResult(_0x22be85,_0xcf3c55){_0xcf3c55=_0xcf3c55||0xc8;return function(_0x49d31c){if(_0x49d31c){return _0x22be85[_0xb270('0x7')](_0xcf3c55)[_0xb270('0x8')](_0x49d31c);}return null;};}function handleError(_0x14f362,_0x3d3723){_0x3d3723=_0x3d3723||0x1f4;return function(_0x2b94f1){logger['error'](_0x2b94f1[_0xb270('0x9')]);if(_0x2b94f1[_0xb270('0xa')]){delete _0x2b94f1['name'];}_0x14f362[_0xb270('0x7')](_0x3d3723)['send'](_0x2b94f1);};}function execChildProcess(){return new BPromise(function(_0x6a3b4b,_0x410fc0){exec(_0xb270('0xb'),function(_0x403e65,_0x4fbb9d,_0x2ecf20){logger[_0xb270('0xc')](_0x4fbb9d);logger[_0xb270('0xc')](_0x2ecf20);if(_0x403e65){logger[_0xb270('0xd')](_0x403e65);return _0x410fc0(_0x403e65);}return _0x6a3b4b(_0x4fbb9d);});});}exports[_0xb270('0xe')]=function(_0x5656d4,_0x4da5eb){return pm2[_0xb270('0xf')]()[_0xb270('0x10')](function(_0xe7eb22){if(_0xe7eb22){var _0x4c3dd1=_[_0xb270('0x11')](_0xe7eb22,function(_0x35f8d3){return _0x35f8d3[_0xb270('0xa')]===_0xb270('0x12')||_0x35f8d3['name']===_0xb270('0x13');});return{'rows':_0x4c3dd1,'count':_0x4c3dd1[_0xb270('0x14')]};}return null;})[_0xb270('0x10')](respondWithResult(_0x4da5eb,null))['catch'](handleError(_0x4da5eb,null));};exports[_0xb270('0x15')]=function(_0x1b1734,_0x15bde6){return pm2['describe'](_0x1b1734[_0xb270('0x16')]['id'])[_0xb270('0x10')](respondWithResult(_0x15bde6,null))['then'](handleEntityNotFound(_0x15bde6,null))[_0xb270('0x17')](handleError(_0x15bde6,null));};exports[_0xb270('0x18')]=function(_0x59bb0b,_0x4736ef){if(_0x59bb0b[_0xb270('0x19')][_0xb270('0xa')]&&_0x59bb0b['body'][_0xb270('0x1a')]){var _0x1da86b=path[_0xb270('0x1b')](__dirname,'../../files/plugins',_0x59bb0b[_0xb270('0x19')][_0xb270('0x1a')]);var _0x36384f=process[_0xb270('0x1c')]();process[_0xb270('0x1d')](path[_0xb270('0x1e')](_0x1da86b));return execChildProcess()[_0xb270('0x10')](function(_0x533a87){process[_0xb270('0x1d')](_0x36384f);return pm2[_0xb270('0x1f')]({'name':_0x59bb0b[_0xb270('0x19')][_0xb270('0xa')],'script':_0x1da86b});})['then'](function(_0x3eba40){pm2[_0xb270('0x20')]();return _0x3eba40[0x0];})[_0xb270('0x10')](respondWithResult(_0x4736ef,0xc9))[_0xb270('0x17')](handleError(_0x4736ef,null));}else{return _0x4736ef[_0xb270('0x7')](0x1f4)[_0xb270('0x21')]({'message':_0xb270('0x22')});}};exports[_0xb270('0x23')]=function(_0xa326eb,_0x33b07e){if(_0xa326eb[_0xb270('0x19')]['id']){delete _0xa326eb[_0xb270('0x19')]['id'];}var _0x1bbcb8={'online':_0xb270('0x24'),'stopped':_0xb270('0x25')};if(_0x1bbcb8['hasOwnProperty'](_0xa326eb[_0xb270('0x19')][_0xb270('0x7')])){return pm2[_0x1bbcb8[_0xa326eb[_0xb270('0x19')][_0xb270('0x7')]]](_0xa326eb[_0xb270('0x16')]['id'])['then'](respondWithResult(_0x33b07e,0xc8))[_0xb270('0x17')](handleError(_0x33b07e,null));}else{return _0x33b07e[_0xb270('0x7')](0x1f4)[_0xb270('0x21')]({'message':'Unknown\x20status'});}};exports[_0xb270('0x26')]=function(_0x51630d,_0x535470){if(_0x51630d['body']['id']){delete _0x51630d[_0xb270('0x19')]['id'];}if(_0x51630d[_0xb270('0x16')]['id']){return pm2[_0xb270('0x27')](_0x51630d[_0xb270('0x16')]['id'])[_0xb270('0x10')](function(_0x38949a){pm2[_0xb270('0x20')]();return _0x38949a[0x0];})[_0xb270('0x10')](respondWithResult(_0x535470,null))[_0xb270('0x17')](handleError(_0x535470,null));}else{return _0x535470[_0xb270('0x7')](0x1f4)[_0xb270('0x21')]({'message':_0xb270('0x28')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0633d71..e448a84 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 _0xf925=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x5d3076,_0x225f7f){var _0x150ef2=function(_0x34b015){while(--_0x34b015){_0x5d3076['push'](_0x5d3076['shift']());}};_0x150ef2(++_0x225f7f);}(_0xf925,0x17c));var _0x5f92=function(_0x229cfd,_0x3d7b4c){_0x229cfd=_0x229cfd-0x0;var _0x5621a3=_0xf925[_0x229cfd];return _0x5621a3;};'use strict';var multer=require(_0x5f92('0x0'));var util=require(_0x5f92('0x1'));var path=require(_0x5f92('0x2'));var timeout=require(_0x5f92('0x3'));var express=require(_0x5f92('0x4'));var router=express[_0x5f92('0x5')]();var auth=require(_0x5f92('0x6'));var interaction=require(_0x5f92('0x7'));var config=require(_0x5f92('0x8'));module[_0x5f92('0x9')]=router; \ No newline at end of file +var _0xb78c=['express','../../components/auth/service','../../components/interaction/service','multer','path'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xb78c,0x1cf));var _0xcb78=function(_0x539ce2,_0x54efa0){_0x539ce2=_0x539ce2-0x0;var _0x1c85b0=_0xb78c[_0x539ce2];return _0x1c85b0;};'use strict';var multer=require(_0xcb78('0x0'));var util=require('util');var path=require(_0xcb78('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb78('0x2'));var router=express['Router']();var auth=require(_0xcb78('0x3'));var interaction=require(_0xcb78('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 792e993..eb7840e 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 _0x75a0=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x42c810,_0x3786c9){var _0x32466f=function(_0x31e26b){while(--_0x31e26b){_0x42c810['push'](_0x42c810['shift']());}};_0x32466f(++_0x3786c9);}(_0x75a0,0x19a));var _0x075a=function(_0x53f3ad,_0x39163e){_0x53f3ad=_0x53f3ad-0x0;var _0x48b203=_0x75a0[_0x53f3ad];return _0x48b203;};'use strict';var Sequelize=require(_0x075a('0x0'));module[_0x075a('0x1')]={'state':{'type':Sequelize[_0x075a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x075a('0x3')]},'scheduledat':{'type':Sequelize[_0x075a('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x075a('0x4')]},'responsetime':{'type':Sequelize[_0x075a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x075a('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x075a('0x3')]}}; \ No newline at end of file +var _0x83dd=['INTEGER','STRING','DATE','exports'];(function(_0x3d75d5,_0x41f0ac){var _0x3263d3=function(_0x1c7108){while(--_0x1c7108){_0x3d75d5['push'](_0x3d75d5['shift']());}};_0x3263d3(++_0x41f0ac);}(_0x83dd,0xdb));var _0xd83d=function(_0x230798,_0xabdd81){_0x230798=_0x230798-0x0;var _0x43a98d=_0x83dd[_0x230798];return _0x43a98d;};'use strict';var Sequelize=require('sequelize');module[_0xd83d('0x0')]={'state':{'type':Sequelize[_0xd83d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xd83d('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd83d('0x3')]},'responsetime':{'type':Sequelize[_0xd83d('0x3')]},'ringtime':{'type':Sequelize[_0xd83d('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd83d('0x2')]},'campaigntype':{'type':Sequelize[_0xd83d('0x2')]},'membername':{'type':Sequelize[_0xd83d('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5b79e8a..0cf2517 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 _0xbc02=['../../config/logger','api','moment','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview'];(function(_0x1493fa,_0x29d372){var _0x3a3dd2=function(_0x3ec61a){while(--_0x3ec61a){_0x1493fa['push'](_0x1493fa['shift']());}};_0x3a3dd2(++_0x29d372);}(_0xbc02,0x1f4));var _0x2bc0=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0xbc02[_0x17784a];return _0x41aded;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2bc0('0x0'))(_0x2bc0('0x1'));var moment=require(_0x2bc0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bc0('0x3'));var rimraf=require(_0x2bc0('0x4'));var config=require(_0x2bc0('0x5'));var attributes=require(_0x2bc0('0x6'));module[_0x2bc0('0x7')]=function(_0x2e8bc7,_0x59a3d4){return _0x2e8bc7[_0x2bc0('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x2bc0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae53=['rimraf','../../config/environment','exports','ReportAgentPreview','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0xae53,0xea));var _0x3ae5=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xae53[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x3ae5('0x0'));var util=require('util');var logger=require(_0x3ae5('0x1'))(_0x3ae5('0x2'));var moment=require(_0x3ae5('0x3'));var BPromise=require(_0x3ae5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ae5('0x5'));var rimraf=require(_0x3ae5('0x6'));var config=require(_0x3ae5('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0x3ae5('0x8')]=function(_0x25c4c0,_0x183569){return _0x25c4c0['define'](_0x3ae5('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 57de7ef..e9abc1c 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 _0xd8f9=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','ReportAgentPreview','body','options','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x53e54e,_0x1d3f75){var _0x505560=function(_0x17fda6){while(--_0x17fda6){_0x53e54e['push'](_0x53e54e['shift']());}};_0x505560(++_0x1d3f75);}(_0xd8f9,0xa3));var _0x9d8f=function(_0x5ccaad,_0x521445){_0x5ccaad=_0x5ccaad-0x0;var _0x20a9c8=_0xd8f9[_0x5ccaad];return _0x20a9c8;};'use strict';var _=require(_0x9d8f('0x0'));var util=require(_0x9d8f('0x1'));var moment=require('moment');var BPromise=require(_0x9d8f('0x2'));var rs=require(_0x9d8f('0x3'));var fs=require('fs');var Redis=require(_0x9d8f('0x4'));var db=require(_0x9d8f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d8f('0x6'))(_0x9d8f('0x7'));var config=require(_0x9d8f('0x8'));var jayson=require(_0x9d8f('0x9'));var client=jayson[_0x9d8f('0xa')][_0x9d8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fe960,_0x4ed79d,_0x5ead25){return new BPromise(function(_0x366291,_0x279d98){return client['request'](_0x1fe960,_0x5ead25)[_0x9d8f('0xc')](function(_0x3aff4c){logger[_0x9d8f('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x4ed79d,'request\x20sent');logger[_0x9d8f('0xe')](_0x9d8f('0xf'),_0x4ed79d,_0x9d8f('0x10'),JSON[_0x9d8f('0x11')](_0x3aff4c));if(_0x3aff4c[_0x9d8f('0x12')]){if(_0x3aff4c[_0x9d8f('0x12')][_0x9d8f('0x13')]===0x1f4){logger['error'](_0x9d8f('0x14'),_0x4ed79d,_0x3aff4c['error'][_0x9d8f('0x15')]);return _0x279d98(_0x3aff4c['error'][_0x9d8f('0x15')]);}logger['error'](_0x9d8f('0x14'),_0x4ed79d,_0x3aff4c['error']['message']);return _0x366291(_0x3aff4c['error'][_0x9d8f('0x15')]);}else{logger[_0x9d8f('0xd')](_0x9d8f('0x14'),_0x4ed79d,_0x9d8f('0x10'));_0x366291(_0x3aff4c[_0x9d8f('0x16')][_0x9d8f('0x15')]);}})['catch'](function(_0x169952){logger['error'](_0x9d8f('0x14'),_0x4ed79d,_0x169952);_0x279d98(_0x169952);});});}exports[_0x9d8f('0x17')]=function(_0x13427b){var _0x5370e1=this;return new Promise(function(_0x591d9a,_0x373a23){return db[_0x9d8f('0x18')]['create'](_0x13427b[_0x9d8f('0x19')],{'raw':_0x13427b[_0x9d8f('0x1a')]?_0x13427b[_0x9d8f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9d8f('0xc')](function(_0x197283){logger[_0x9d8f('0xd')]('CreateReportAgentPreview',_0x13427b);logger['debug']('CreateReportAgentPreview',_0x13427b,JSON['stringify'](_0x197283));_0x591d9a(_0x197283);})[_0x9d8f('0x1b')](function(_0xbea633){logger['error'](_0x9d8f('0x17'),_0xbea633['message'],_0x13427b);_0x373a23(_0x5370e1[_0x9d8f('0x12')](0x1f4,_0xbea633['message']));});});}; \ No newline at end of file +var _0xe3ec=['raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ReportAgentPreview','create','body','options'];(function(_0x2f2e0e,_0x21a555){var _0xe1467c=function(_0x59e5b1){while(--_0x59e5b1){_0x2f2e0e['push'](_0x2f2e0e['shift']());}};_0xe1467c(++_0x21a555);}(_0xe3ec,0x122));var _0xce3e=function(_0x53f5eb,_0x585522){_0x53f5eb=_0x53f5eb-0x0;var _0x3a7230=_0xe3ec[_0x53f5eb];return _0x3a7230;};'use strict';var _=require(_0xce3e('0x0'));var util=require(_0xce3e('0x1'));var moment=require(_0xce3e('0x2'));var BPromise=require(_0xce3e('0x3'));var rs=require(_0xce3e('0x4'));var fs=require('fs');var Redis=require(_0xce3e('0x5'));var db=require(_0xce3e('0x6'))['db'];var utils=require(_0xce3e('0x7'));var logger=require(_0xce3e('0x8'))(_0xce3e('0x9'));var config=require(_0xce3e('0xa'));var jayson=require(_0xce3e('0xb'));var client=jayson[_0xce3e('0xc')][_0xce3e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x9a7507,_0x4c4245,_0xf40c2a){return new BPromise(function(_0x337b4f,_0x550dae){return client[_0xce3e('0xe')](_0x9a7507,_0xf40c2a)[_0xce3e('0xf')](function(_0x476cb1){logger[_0xce3e('0x10')](_0xce3e('0x11'),_0x4c4245,_0xce3e('0x12'));logger[_0xce3e('0x13')](_0xce3e('0x14'),_0x4c4245,_0xce3e('0x12'),JSON[_0xce3e('0x15')](_0x476cb1));if(_0x476cb1[_0xce3e('0x16')]){if(_0x476cb1[_0xce3e('0x16')]['code']===0x1f4){logger[_0xce3e('0x16')]('ReportAgentPreview,\x20%s,\x20%s',_0x4c4245,_0x476cb1['error'][_0xce3e('0x17')]);return _0x550dae(_0x476cb1[_0xce3e('0x16')][_0xce3e('0x17')]);}logger[_0xce3e('0x16')](_0xce3e('0x11'),_0x4c4245,_0x476cb1[_0xce3e('0x16')]['message']);return _0x337b4f(_0x476cb1['error'][_0xce3e('0x17')]);}else{logger[_0xce3e('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x4c4245,'request\x20sent');_0x337b4f(_0x476cb1[_0xce3e('0x18')][_0xce3e('0x17')]);}})[_0xce3e('0x19')](function(_0x3ca934){logger[_0xce3e('0x16')](_0xce3e('0x11'),_0x4c4245,_0x3ca934);_0x550dae(_0x3ca934);});});}exports['CreateReportAgentPreview']=function(_0x243bb0){var _0x373447=this;return new Promise(function(_0x13721a,_0x17ea96){return db[_0xce3e('0x1a')][_0xce3e('0x1b')](_0x243bb0[_0xce3e('0x1c')],{'raw':_0x243bb0['options']?_0x243bb0[_0xce3e('0x1d')][_0xce3e('0x1e')]===undefined?!![]:![]:!![]})[_0xce3e('0xf')](function(_0x219acf){logger[_0xce3e('0x10')](_0xce3e('0x1f'),_0x243bb0);logger['debug'](_0xce3e('0x1f'),_0x243bb0,JSON[_0xce3e('0x15')](_0x219acf));_0x13721a(_0x219acf);})[_0xce3e('0x19')](function(_0x1d10a8){logger['error'](_0xce3e('0x1f'),_0x1d10a8[_0xce3e('0x17')],_0x243bb0);_0x17ea96(_0x373447['error'](0x1f4,_0x1d10a8[_0xce3e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b90e9c0..d357365 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 _0xd924=['/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','faxQueues','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/chat/queues/:id/notify','/chat/queues/:id','post','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','multer','util','path','Router','get','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues'];(function(_0x249a4d,_0x49c4f1){var _0x151da6=function(_0x507e19){while(--_0x507e19){_0x249a4d['push'](_0x249a4d['shift']());}};_0x151da6(++_0x49c4f1);}(_0xd924,0x74));var _0x4d92=function(_0x3674d4,_0x4ce93b){_0x3674d4=_0x3674d4-0x0;var _0x4b5cd4=_0xd924[_0x3674d4];return _0x4b5cd4;};'use strict';var multer=require(_0x4d92('0x0'));var util=require(_0x4d92('0x1'));var path=require(_0x4d92('0x2'));var express=require('express');var router=express[_0x4d92('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x4d92('0x4')]('/voice/channels',auth[_0x4d92('0x5')](),controller[_0x4d92('0x6')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x4d92('0x7')]);router[_0x4d92('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x4d92('0x5')](),controller[_0x4d92('0x8')]);router[_0x4d92('0x4')](_0x4d92('0x9'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x4d92('0x4')](_0x4d92('0xa'),auth[_0x4d92('0x5')](),controller[_0x4d92('0xb')]);router['get'](_0x4d92('0xc'),auth[_0x4d92('0x5')](),controller[_0x4d92('0xd')]);router[_0x4d92('0x4')](_0x4d92('0xe'),auth[_0x4d92('0x5')](),controller['mailAccounts']);router[_0x4d92('0x4')](_0x4d92('0xf'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x10')]);router[_0x4d92('0x4')]('/sms/queues',auth[_0x4d92('0x5')](),controller[_0x4d92('0x11')]);router[_0x4d92('0x4')]('/whatsapp/queues',auth[_0x4d92('0x5')](),controller[_0x4d92('0x12')]);router[_0x4d92('0x4')]('/fax/queues',auth[_0x4d92('0x5')](),controller[_0x4d92('0x13')]);router[_0x4d92('0x4')]('/voice/queues/preview/:id',auth[_0x4d92('0x5')](),controller['voiceQueuesPreview']);router[_0x4d92('0x4')](_0x4d92('0x14'),auth['isAuthenticated'](),controller[_0x4d92('0x15')]);router[_0x4d92('0x4')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x4d92('0x16')]);router[_0x4d92('0x4')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x4d92('0x5')](),controller['voiceQueuesChannelHangup']);router[_0x4d92('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x4d92('0x5')](),controller[_0x4d92('0x17')]);router[_0x4d92('0x4')](_0x4d92('0x18'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x19')]);router[_0x4d92('0x4')]('/outbound',auth['isAuthenticated'](),controller[_0x4d92('0x1a')]);router[_0x4d92('0x4')](_0x4d92('0x1b'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x1c')]);router[_0x4d92('0x4')](_0x4d92('0x1d'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x1e')]);router[_0x4d92('0x1f')](_0x4d92('0x20'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x21')]);router[_0x4d92('0x4')](_0x4d92('0x22'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x23')]);router[_0x4d92('0x4')](_0x4d92('0x24'),auth['isAuthenticated'](),controller[_0x4d92('0x25')]);router[_0x4d92('0x4')]('/campaigns',auth['isAuthenticated'](),controller[_0x4d92('0x26')]);router[_0x4d92('0x4')](_0x4d92('0x27'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x4d92('0x4')](_0x4d92('0x28'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x29')]);router['get']('/mail/queues/waitinginteractions',auth[_0x4d92('0x5')](),controller['mailQueuesWaitingInteractions']);router[_0x4d92('0x4')](_0x4d92('0x2a'),auth['isAuthenticated'](),controller[_0x4d92('0x2b')]);router['get']('/sms/queues/waitinginteractions',auth[_0x4d92('0x5')](),controller[_0x4d92('0x2c')]);router[_0x4d92('0x4')](_0x4d92('0x2d'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x4d92('0x4')]('/fax/queues/waitinginteractions',auth[_0x4d92('0x5')](),controller[_0x4d92('0x2e')]);router['post']('/mail/queues/:id/notify',auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')](_0x4d92('0x30')));router['get']('/mail/queues/:id',auth[_0x4d92('0x5')](),controller['showMailQueues']);router['post'](_0x4d92('0x31'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')]('chat'));router[_0x4d92('0x4')](_0x4d92('0x32'),auth[_0x4d92('0x5')](),controller['showChatQueues']);router[_0x4d92('0x33')](_0x4d92('0x34'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')](_0x4d92('0x35')));router[_0x4d92('0x4')](_0x4d92('0x36'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x37')]);router[_0x4d92('0x33')](_0x4d92('0x38'),auth['isAuthenticated'](),controller[_0x4d92('0x2f')](_0x4d92('0x39')));router['get']('/openchannel/queues/:id',auth[_0x4d92('0x5')](),controller['showOpenchannelQueues']);router[_0x4d92('0x33')](_0x4d92('0x3a'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')](_0x4d92('0x3b')));router['post'](_0x4d92('0x3c'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')](_0x4d92('0x3d')));router[_0x4d92('0x4')](_0x4d92('0x3e'),auth[_0x4d92('0x5')](),controller['showSmsQueues']);router[_0x4d92('0x4')](_0x4d92('0x3f'),auth[_0x4d92('0x5')](),controller['showWhatsappQueues']);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0xa5af=['agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/whatsapp/queues','whatsappQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','/outbound/channels','put','/agents/:id/capacity'];(function(_0x2e714d,_0xc07a1d){var _0x2d0a0d=function(_0x39ec2a){while(--_0x39ec2a){_0x2e714d['push'](_0x2e714d['shift']());}};_0x2d0a0d(++_0xc07a1d);}(_0xa5af,0x1bc));var _0xfa5a=function(_0x49bbe3,_0x9dca2f){_0x49bbe3=_0x49bbe3-0x0;var _0x2dc15f=_0xa5af[_0x49bbe3];return _0x2dc15f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require('express');var router=express[_0xfa5a('0x0')]();var auth=require(_0xfa5a('0x1'));var controller=require(_0xfa5a('0x2'));router['get']('/voice/channels',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x4')]);router['get'](_0xfa5a('0x5'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x6')]);router[_0xfa5a('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0xfa5a('0x7')](_0xfa5a('0x8'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x9')]);router[_0xfa5a('0x7')](_0xfa5a('0xa'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0xb')]);router[_0xfa5a('0x7')](_0xfa5a('0xc'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0xd')]);router['get'](_0xfa5a('0xe'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0xf')]);router[_0xfa5a('0x7')]('/openchannel/queues',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x10')]);router['get']('/sms/queues',auth[_0xfa5a('0x3')](),controller['smsQueues']);router['get'](_0xfa5a('0x11'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x12')]);router[_0xfa5a('0x7')]('/fax/queues',auth[_0xfa5a('0x3')](),controller['faxQueues']);router[_0xfa5a('0x7')](_0xfa5a('0x13'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x14')]);router[_0xfa5a('0x7')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0xfa5a('0x15')]);router[_0xfa5a('0x7')]('/voice/queues/channels/:uniqueid',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x16')]);router[_0xfa5a('0x7')](_0xfa5a('0x17'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x18')]);router[_0xfa5a('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x19')]);router[_0xfa5a('0x7')](_0xfa5a('0x1a'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xfa5a('0x7')](_0xfa5a('0x1b'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x1c')]);router[_0xfa5a('0x7')](_0xfa5a('0x1d'),auth[_0xfa5a('0x3')](),controller['outboundChannels']);router[_0xfa5a('0x7')]('/agents',auth[_0xfa5a('0x3')](),controller['agents']);router[_0xfa5a('0x1e')](_0xfa5a('0x1f'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x20')]);router[_0xfa5a('0x7')](_0xfa5a('0x21'),auth['isAuthenticated'](),controller[_0xfa5a('0x22')]);router['get'](_0xfa5a('0x23'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x24')]);router[_0xfa5a('0x7')](_0xfa5a('0x25'),auth['isAuthenticated'](),controller['campaigns']);router[_0xfa5a('0x7')]('/fax/accounts',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x26')]);router[_0xfa5a('0x7')](_0xfa5a('0x27'),auth[_0xfa5a('0x3')](),controller['chatQueuesWaitingInteractions']);router[_0xfa5a('0x7')]('/mail/queues/waitinginteractions',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x28')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xfa5a('0x29')]);router[_0xfa5a('0x7')]('/sms/queues/waitinginteractions',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2a')]);router['get'](_0xfa5a('0x2b'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2c')]);router[_0xfa5a('0x7')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xfa5a('0x2d')]);router[_0xfa5a('0x2e')]('/mail/queues/:id/notify',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x30')));router[_0xfa5a('0x7')](_0xfa5a('0x31'),auth[_0xfa5a('0x3')](),controller['showMailQueues']);router['post'](_0xfa5a('0x32'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x33')));router['get'](_0xfa5a('0x34'),auth['isAuthenticated'](),controller[_0xfa5a('0x35')]);router[_0xfa5a('0x2e')]('/fax/queues/:id/notify',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x36')));router[_0xfa5a('0x7')](_0xfa5a('0x37'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x38')]);router[_0xfa5a('0x2e')](_0xfa5a('0x39'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router['get']('/openchannel/queues/:id',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x3a')]);router[_0xfa5a('0x2e')](_0xfa5a('0x3b'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x3c')));router['post'](_0xfa5a('0x3d'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x3e')));router[_0xfa5a('0x7')](_0xfa5a('0x3f'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x40')]);router[_0xfa5a('0x7')](_0xfa5a('0x41'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x42')]);router[_0xfa5a('0x2e')](_0xfa5a('0x43'),auth['isAuthenticated'](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 8062077..8cd4c97 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 _0x42b2=['VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','query','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','TransferReport','create','bluebird','lodash','util','../../config/logger','api','client','http','request','then','error','code','message','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42b2,0x1b2));var _0x242b=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x42b2[_0x5c3c0b];return _0x52ecd2;};'use strict';var BPromise=require(_0x242b('0x0'));var moment=require('moment');var _=require(_0x242b('0x1'));var util=require(_0x242b('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x242b('0x3'))(_0x242b('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x242b('0x5')][_0x242b('0x6')]({'port':0x232a});var mailClient=jayson[_0x242b('0x5')][_0x242b('0x6')]({'port':0x232b});var routingClient=jayson[_0x242b('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x12fb40,_0x5ada21,_0x5aa0bf){return new BPromise(function(_0x267f26,_0x49c96a){var _0x3367ba=_0x5aa0bf?_0x5aa0bf:amiClient;return _0x3367ba[_0x242b('0x7')](_0x12fb40,_0x5ada21)[_0x242b('0x8')](function(_0x75c885){if(_0x75c885[_0x242b('0x9')]){if(_0x75c885[_0x242b('0x9')][_0x242b('0xa')]===0x1f4){return _0x49c96a(_0x75c885['error']['message']);}return _0x267f26(_0x75c885[_0x242b('0x9')][_0x242b('0xb')]);}else{_0x267f26(_0x75c885['result']);}})[_0x242b('0xc')](function(_0x529d7c){_0x49c96a(_0x529d7c);});});}function respondWithResult(_0x5d88a3,_0x50b756){_0x50b756=_0x50b756||0xc8;return function(_0x38c6c9){if(_0x38c6c9){return _0x5d88a3[_0x242b('0xd')](_0x50b756)[_0x242b('0xe')](_0x38c6c9);}return _0x5d88a3[_0x242b('0xf')](0x194);};}function handleError(_0x578cd9,_0x812c3a){_0x812c3a=_0x812c3a||0x1f4;return function(_0x3a1f28){logger[_0x242b('0x9')](_0x3a1f28['stack']);if(_0x3a1f28['name']){delete _0x3a1f28[_0x242b('0x10')];}_0x578cd9['status'](_0x812c3a)[_0x242b('0x11')](_0x3a1f28);};}function findById(_0x1158fa){return function(_0x560a92){if(!_[_0x242b('0x12')](_0x1158fa)&&!_['isNil'](_0x560a92)&&!_[_0x242b('0x12')](_0x560a92[_0x242b('0x13')])){return _[_0x242b('0x14')](_0x560a92[_0x242b('0x13')],function(_0x5d688a){return _0x5d688a['id']==_0x1158fa;});}return null;};}exports[_0x242b('0x15')]=function(_0x318c6f,_0x212015){return respondWithRpcPromise(_0x242b('0x16'),_0x318c6f['query'])[_0x242b('0x8')](respondWithResult(_0x212015,null))[_0x242b('0xc')](handleError(_0x212015,null));};exports[_0x242b('0x17')]=function(_0x255995,_0x37dbe9){return respondWithRpcPromise(_0x242b('0x18'),_['merge'](_0x255995['query'],_0x255995[_0x242b('0x19')]))['then'](respondWithResult(_0x37dbe9,null))[_0x242b('0xc')](handleError(_0x37dbe9,null));};exports['voiceChannelStopMixMonitor']=function(_0x446b64,_0x32c1af){return respondWithRpcPromise(_0x242b('0x1a'),_[_0x242b('0x1b')](_0x446b64[_0x242b('0x1c')],_0x446b64[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x32c1af,null))['catch'](handleError(_0x32c1af,null));};exports['voiceQueues']=function(_0x537f95,_0x45cfb8){return respondWithRpcPromise(_0x242b('0x1d'),_0x537f95['query'])[_0x242b('0x8')](respondWithResult(_0x45cfb8,null))[_0x242b('0xc')](handleError(_0x45cfb8,null));};exports[_0x242b('0x1e')]=function(_0xf1859f,_0xc905bf){return respondWithRpcPromise(_0x242b('0x1d'),_0xf1859f[_0x242b('0x1c')])['then'](findById(_0xf1859f['params']['id']))[_0x242b('0x8')](respondWithResult(_0xc905bf,null))[_0x242b('0xc')](handleError(_0xc905bf,null));};exports['voiceQueuesPreview']=function(_0x3529bb,_0x4a8b10){return respondWithRpcPromise(_0x242b('0x1f'),_[_0x242b('0x1b')](_0x3529bb['query'],_0x3529bb[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x4a8b10,null))[_0x242b('0xc')](handleError(_0x4a8b10,null));};exports[_0x242b('0x20')]=function(_0x123829,_0x475e21){return respondWithRpcPromise(_0x242b('0x21'),_0x123829['query'])[_0x242b('0x8')](respondWithResult(_0x475e21,null))[_0x242b('0xc')](handleError(_0x475e21,null));};exports[_0x242b('0x22')]=function(_0x5845f8,_0x3b5711){return respondWithRpcPromise(_0x242b('0x23'),_['merge'](_0x5845f8['query'],_0x5845f8[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x3b5711,null))['catch'](handleError(_0x3b5711,null));};exports['voiceQueuesChannelHangup']=function(_0x32b949,_0x37c8e2){return respondWithRpcPromise(_0x242b('0x24'),_[_0x242b('0x1b')](_0x32b949[_0x242b('0x1c')],_0x32b949[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x37c8e2,null))[_0x242b('0xc')](handleError(_0x37c8e2,null));};exports['voiceQueuesChannelRedirect']=function(_0x149810,_0x3a5b82){return respondWithRpcPromise(_0x242b('0x25'),_[_0x242b('0x1b')](_0x149810[_0x242b('0x1c')],_0x149810[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x3a5b82,null))['catch'](handleError(_0x3a5b82,null));};exports[_0x242b('0x26')]=function(_0x5eb3c1,_0x21c925){return respondWithRpcPromise('Outbound',_0x5eb3c1[_0x242b('0x1c')])[_0x242b('0x8')](respondWithResult(_0x21c925,null))[_0x242b('0xc')](handleError(_0x21c925,null));};exports[_0x242b('0x27')]=function(_0x55cae2,_0x1f6f3e){return respondWithRpcPromise(_0x242b('0x28'),_0x55cae2[_0x242b('0x1c')])[_0x242b('0x8')](respondWithResult(_0x1f6f3e,null))[_0x242b('0xc')](handleError(_0x1f6f3e,null));};exports[_0x242b('0x29')]=function(_0x3a7b2a,_0x464099){var _0x30abd1;return respondWithRpcPromise(_0x242b('0x2a'),_0x3a7b2a[_0x242b('0x1c')])['then'](function(_0x3babd4){_0x30abd1=_0x3babd4;return respondWithRpcPromise('Agents',_0x3a7b2a[_0x242b('0x1c')],routingClient);})[_0x242b('0x8')](function(_0x2eb340){return _[_0x242b('0x1b')]({},_0x2eb340,_0x30abd1);})[_0x242b('0x8')](respondWithResult(_0x464099,null))['catch'](handleError(_0x464099,null));};exports[_0x242b('0x2b')]=function(_0x23238c,_0x562a7d){if(_0x23238c[_0x242b('0x2c')]&&_0x23238c[_0x242b('0x2c')]['interaction']&&_0x23238c[_0x242b('0x2d')]&&_0x23238c[_0x242b('0x2d')][_0x242b('0x10')]){for(var _0xe7ef28 in _0x23238c['body']['interaction']){if(_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0x242b('0x2f')](_0xe7ef28)){db[_0x242b('0x30')][_0x242b('0x31')]({'where':{'channel':_0xe7ef28,'membername':_0x23238c[_0x242b('0x2d')]['name'],'type':_0x242b('0x32'),'exitAt':null,'uniqueid':_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0xe7ef28]&&_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0xe7ef28]['length']?{'$notIn':_0x23238c[_0x242b('0x2c')]['interaction'][_0xe7ef28]}:{'$ne':null}}})['then'](function(_0x20ed75){var _0x10f7b7=moment()[_0x242b('0x33')](_0x242b('0x34'));for(var _0x431c08=0x0,_0xa8b5fa=_0x20ed75[_0x242b('0x35')];_0x431c08<_0xa8b5fa;_0x431c08+=0x1){_0x20ed75[_0x431c08][_0x242b('0x36')]({'exitAt':_0x10f7b7});}});for(var _0xd0bb9b=0x0;_0xd0bb9b<_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0xe7ef28][_0x242b('0x35')];_0xd0bb9b+=0x1){db[_0x242b('0x30')][_0x242b('0x37')]({'where':{'channel':_0xe7ef28,'membername':_0x23238c[_0x242b('0x2d')][_0x242b('0x10')],'type':'INTERACTION','uniqueid':_0x23238c['body'][_0x242b('0x2e')][_0xe7ef28][_0xd0bb9b],'exitAt':null},'defaults':{'channel':_0xe7ef28,'membername':_0x23238c[_0x242b('0x2d')][_0x242b('0x10')],'interface':_['isNil'](_0x23238c[_0x242b('0x2d')]['interface'])?util[_0x242b('0x33')](_0x242b('0x38'),_0x23238c[_0x242b('0x2d')]['name']):_0x23238c['user'][_0x242b('0x39')],'type':_0x242b('0x32'),'enterAt':moment()['format'](_0x242b('0x34')),'role':_0x242b('0x3a'),'internal':_0x23238c['user']['internal'],'uniqueid':_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0xe7ef28][_0xd0bb9b]}});}}}}return respondWithRpcPromise(_0x242b('0x3b'),{'id':_0x23238c[_0x242b('0x19')]['id'],'capacity':_0x23238c[_0x242b('0x2c')][_0x242b('0x3c')]},routingClient)[_0x242b('0x8')](respondWithResult(_0x562a7d,null))[_0x242b('0xc')](handleError(_0x562a7d,null));};exports['telephones']=function(_0x4baa17,_0x947d39){return respondWithRpcPromise(_0x242b('0x3d'),_0x4baa17[_0x242b('0x1c')])['then'](respondWithResult(_0x947d39,null))[_0x242b('0xc')](handleError(_0x947d39,null));};exports[_0x242b('0x3e')]=function(_0x1dbe7e,_0x505018){return respondWithRpcPromise(_0x242b('0x3f'),_0x1dbe7e[_0x242b('0x1c')])['then'](respondWithResult(_0x505018,null))['catch'](handleError(_0x505018,null));};exports[_0x242b('0x40')]=function(_0x50f5bb,_0x4932a6){return respondWithRpcPromise(_0x242b('0x41'),_0x50f5bb[_0x242b('0x1c')])[_0x242b('0x8')](respondWithResult(_0x4932a6,null))[_0x242b('0xc')](handleError(_0x4932a6,null));};exports[_0x242b('0x42')]=function(_0x27d751,_0x1e7184){return respondWithRpcPromise('ChatQueues',_0x27d751[_0x242b('0x1c')],routingClient)['then'](respondWithResult(_0x1e7184,null))['catch'](handleError(_0x1e7184,null));};exports[_0x242b('0x43')]=function(_0x4fd419,_0x3b3d2f){return respondWithRpcPromise(_0x242b('0x44'),_0x4fd419[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x4fd419[_0x242b('0x19')]['id']))['then'](respondWithResult(_0x3b3d2f,null))[_0x242b('0xc')](handleError(_0x3b3d2f,null));};exports['mailQueues']=function(_0x164e0d,_0x3ce758){return respondWithRpcPromise(_0x242b('0x45'),_0x164e0d[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](respondWithResult(_0x3ce758,null))[_0x242b('0xc')](handleError(_0x3ce758,null));};exports['showMailQueues']=function(_0x409d38,_0x5ef676){return respondWithRpcPromise('MailQueues',_0x409d38[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x409d38[_0x242b('0x19')]['id']))[_0x242b('0x8')](respondWithResult(_0x5ef676,null))[_0x242b('0xc')](handleError(_0x5ef676,null));};exports[_0x242b('0x46')]=function(_0x389915,_0x4e305b){return respondWithRpcPromise(_0x242b('0x47'),_0x389915[_0x242b('0x1c')],mailClient)[_0x242b('0x8')](respondWithResult(_0x4e305b,null))[_0x242b('0xc')](handleError(_0x4e305b,null));};exports[_0x242b('0x48')]=function(_0x29f52c,_0x479ca5){return respondWithRpcPromise(_0x242b('0x49'),_0x29f52c[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](respondWithResult(_0x479ca5,null))[_0x242b('0xc')](handleError(_0x479ca5,null));};exports['showOpenchannelQueues']=function(_0x58a7b2,_0x53c8e0){return respondWithRpcPromise(_0x242b('0x49'),_0x58a7b2[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x58a7b2[_0x242b('0x19')]['id']))[_0x242b('0x8')](respondWithResult(_0x53c8e0,null))[_0x242b('0xc')](handleError(_0x53c8e0,null));};exports[_0x242b('0x4a')]=function(_0x361f4e,_0x15cded){return respondWithRpcPromise(_0x242b('0x4b'),_0x361f4e[_0x242b('0x1c')],routingClient)['then'](respondWithResult(_0x15cded,null))[_0x242b('0xc')](handleError(_0x15cded,null));};exports[_0x242b('0x4c')]=function(_0x3082fd,_0x2285ba){return respondWithRpcPromise(_0x242b('0x4b'),_0x3082fd[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x3082fd[_0x242b('0x19')]['id']))['then'](respondWithResult(_0x2285ba,null))[_0x242b('0xc')](handleError(_0x2285ba,null));};exports['whatsappQueues']=function(_0x204d0,_0x7baacb){return respondWithRpcPromise(_0x242b('0x4d'),_0x204d0['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x7baacb,null))['catch'](handleError(_0x7baacb,null));};exports[_0x242b('0x4e')]=function(_0x453919,_0x2512eb){return respondWithRpcPromise('WhatsappQueues',_0x453919[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x453919[_0x242b('0x19')]['id']))[_0x242b('0x8')](respondWithResult(_0x2512eb,null))[_0x242b('0xc')](handleError(_0x2512eb,null));};exports[_0x242b('0x4f')]=function(_0x587c96,_0x5cb0c4){return respondWithRpcPromise('FaxQueues',_0x587c96['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x5cb0c4,null))[_0x242b('0xc')](handleError(_0x5cb0c4,null));};exports[_0x242b('0x50')]=function(_0x520142,_0x337bc2){return respondWithRpcPromise('FaxQueues',_0x520142['query'],routingClient)[_0x242b('0x8')](findById(_0x520142[_0x242b('0x19')]['id']))[_0x242b('0x8')](respondWithResult(_0x337bc2,null))[_0x242b('0xc')](handleError(_0x337bc2,null));};exports['faxAccounts']=function(_0x5d1d60,_0x3d40dd){return respondWithRpcPromise('FaxAccounts',_0x5d1d60[_0x242b('0x1c')])[_0x242b('0x8')](respondWithResult(_0x3d40dd,null))[_0x242b('0xc')](handleError(_0x3d40dd,null));};exports['chatQueuesWaitingInteractions']=function(_0x27b06e,_0x4f33fc){return respondWithRpcPromise(_0x242b('0x51'),_0x27b06e['query'],routingClient)['then'](respondWithResult(_0x4f33fc,null))[_0x242b('0xc')](handleError(_0x4f33fc,null));};exports[_0x242b('0x52')]=function(_0x458af7,_0x112203){return respondWithRpcPromise(_0x242b('0x53'),_0x458af7[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](respondWithResult(_0x112203,null))['catch'](handleError(_0x112203,null));};exports[_0x242b('0x54')]=function(_0x482a1d,_0x3deebd){return respondWithRpcPromise(_0x242b('0x55'),_0x482a1d['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x3deebd,null))['catch'](handleError(_0x3deebd,null));};exports[_0x242b('0x56')]=function(_0x5caed2,_0xada2d1){return respondWithRpcPromise(_0x242b('0x57'),_0x5caed2[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](respondWithResult(_0xada2d1,null))[_0x242b('0xc')](handleError(_0xada2d1,null));};exports[_0x242b('0x58')]=function(_0x48e311,_0x317f39){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x48e311['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x317f39,null))[_0x242b('0xc')](handleError(_0x317f39,null));};exports[_0x242b('0x59')]=function(_0x17735d,_0x86c41b){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x17735d['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x86c41b,null))[_0x242b('0xc')](handleError(_0x86c41b,null));};exports['queueNotify']=function(_0x550b88){return function(_0x59bb9e,_0x4605da){var _0xbdadce,_0x2d14d0;var _0x397ace=_[_0x242b('0x5a')](_0x550b88);var _0x3e2542=_0x550b88===_0x242b('0x5b')?_0x242b('0x5c'):_0x242b('0x5d');return db[_0x397ace+_0x242b('0x5e')]['findOne']({'raw':!![],'where':{'id':_0x59bb9e['params']['id']}})['then'](function(_0x331e0e){if(_[_0x242b('0x12')](_0x331e0e)){throw new Error(_0x397ace+_0x242b('0x5f'));}_0xbdadce=_0x331e0e;return db[_0x397ace+_0x242b('0x60')][_0x242b('0x61')]({'where':{'id':_0x59bb9e[_0x242b('0x2c')]['messageId']},'include':[{'model':db[_0x397ace+_0x242b('0x62')],'as':_0x242b('0x62')},{'model':db[_0x397ace+_0x3e2542],'as':_0x242b('0x5d')}]});})[_0x242b('0x8')](function(_0x57a000){if(_[_0x242b('0x12')](_0x57a000)){throw new Error(_0x397ace+'\x20Message\x20not\x20found');}_0x2d14d0=_0x57a000;return _0x57a000['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x242b('0x8')](function(){var _0xc6a336={'uniqueid':_0x550b88+'.'+_0x2d14d0['id']+'.'+_0x2d14d0[_0x242b('0x62')]['id'],'FromUserId':_0x59bb9e[_0x242b('0x2d')]['id'],'type':_0x242b('0x63')};_0xc6a336[_0x397ace+_0x242b('0x64')]=_0x2d14d0['id'];_0xc6a336[_0x397ace+_0x242b('0x65')]=_0x2d14d0[_0x242b('0x62')]['id'];_0xc6a336[_0x242b('0x66')+_0x397ace+_0x3e2542+'Id']=_0x2d14d0[_0x242b('0x5d')]['id'];_0xc6a336['To'+_0x397ace+_0x242b('0x67')]=_0xbdadce['id'];return db[_0x397ace+'TransferReport']['create'](_0xc6a336);})[_0x242b('0x8')](function(){return respondWithRpcPromise(_0x242b('0x68'),{'channel':_0x550b88,'interaction':_0x2d14d0['Interaction'],'message':_0x2d14d0,'account':_0x2d14d0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0xbdadce[_0x242b('0x10')]+','+(_0x2d14d0['Account'][_0x242b('0x69')]||0x12c),'interval':_0x242b('0x6a')}]},routingClient);})['then'](respondWithResult(_0x4605da,null))[_0x242b('0xc')](handleError(_0x4605da,null));};};exports['agentNotify']=function(_0x50dfea,_0x1558a4){var _0x1dd5f5,_0x3a1a10;if(_['isNil'](_0x50dfea['body'][_0x242b('0x6b')])){throw new Error(_0x242b('0x6c'));}var _0x4e6417=_0x50dfea[_0x242b('0x2c')][_0x242b('0x6b')];var _0x188ce5=_[_0x242b('0x5a')](_0x4e6417);var _0x20eb48=_0x4e6417===_0x242b('0x5b')?_0x242b('0x5c'):_0x242b('0x5d');return db[_0x242b('0x6d')][_0x242b('0x61')]({'raw':!![],'where':{'id':_0x50dfea[_0x242b('0x19')]['id'],'role':_0x242b('0x3a')}})[_0x242b('0x8')](function(_0x402386){if(_[_0x242b('0x12')](_0x402386)){throw new Error(_0x242b('0x6e'));}_0x1dd5f5=_0x402386;return db[_0x188ce5+_0x242b('0x60')][_0x242b('0x61')]({'where':{'id':_0x50dfea[_0x242b('0x2c')][_0x242b('0x6f')]},'include':[{'model':db[_0x188ce5+'Interaction'],'as':_0x242b('0x62')},{'model':db[_0x188ce5+_0x20eb48],'as':_0x242b('0x5d')}]});})['then'](function(_0x262c81){if(_['isNil'](_0x262c81)){throw new Error(_0x188ce5+'\x20Message\x20not\x20found');}_0x3a1a10=_0x262c81;return _0x262c81['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x242b('0x8')](function(){var _0x14c850={'uniqueid':_0x4e6417+'.'+_0x3a1a10['id']+'.'+_0x3a1a10[_0x242b('0x62')]['id'],'FromUserId':_0x50dfea[_0x242b('0x2d')]['id'],'type':_0x242b('0x63'),'ToUserId':_0x1dd5f5['id']};_0x14c850[_0x188ce5+'MessageId']=_0x3a1a10['id'];_0x14c850[_0x188ce5+_0x242b('0x65')]=_0x3a1a10[_0x242b('0x62')]['id'];_0x14c850[_0x242b('0x66')+_0x188ce5+_0x20eb48+'Id']=_0x3a1a10['Account']['id'];return db[_0x188ce5+_0x242b('0x70')][_0x242b('0x71')](_0x14c850);})[_0x242b('0x8')](function(){return respondWithRpcPromise(_0x242b('0x68'),{'channel':_0x4e6417,'interaction':_0x3a1a10['Interaction'],'message':_0x3a1a10,'account':_0x3a1a10[_0x242b('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1dd5f5[_0x242b('0x10')]+','+(_0x3a1a10[_0x242b('0x5d')]['agentTransferTimeout']||0x12c),'interval':_0x242b('0x6a')}]},routingClient);})[_0x242b('0x8')](respondWithResult(_0x1558a4,null))['catch'](handleError(_0x1558a4,null));}; \ No newline at end of file +var _0x8c54=['VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','body','interaction','user','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','interface','format','SIP/%s','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','InteractionId','QueueId','TransferReport','create','Start','agentNotify','User','Agent\x20not\x20found','queue','MessageId','*,*,*,*','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','error','message','catch','status','sendStatus','name','send','isNil','rows','find','voiceChannels','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview'];(function(_0x480916,_0x490863){var _0x44f48c=function(_0xbfbec1){while(--_0xbfbec1){_0x480916['push'](_0x480916['shift']());}};_0x44f48c(++_0x490863);}(_0x8c54,0xb8));var _0x48c5=function(_0x292928,_0x14dfa6){_0x292928=_0x292928-0x0;var _0x30d9b2=_0x8c54[_0x292928];return _0x30d9b2;};'use strict';var BPromise=require(_0x48c5('0x0'));var moment=require(_0x48c5('0x1'));var _=require(_0x48c5('0x2'));var util=require(_0x48c5('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x48c5('0x4'))(_0x48c5('0x5'));var jayson=require(_0x48c5('0x6'));var amiClient=jayson[_0x48c5('0x7')][_0x48c5('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0x48c5('0x8')]({'port':0x232b});var routingClient=jayson[_0x48c5('0x7')][_0x48c5('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x724cbb,_0x4485a8,_0x20fc4b){return new BPromise(function(_0x3e5361,_0x45ac10){var _0x1795bf=_0x20fc4b?_0x20fc4b:amiClient;return _0x1795bf[_0x48c5('0x9')](_0x724cbb,_0x4485a8)['then'](function(_0xb0dd6c){if(_0xb0dd6c['error']){if(_0xb0dd6c['error']['code']===0x1f4){return _0x45ac10(_0xb0dd6c[_0x48c5('0xa')][_0x48c5('0xb')]);}return _0x3e5361(_0xb0dd6c[_0x48c5('0xa')][_0x48c5('0xb')]);}else{_0x3e5361(_0xb0dd6c['result']);}})[_0x48c5('0xc')](function(_0x736e57){_0x45ac10(_0x736e57);});});}function respondWithResult(_0x46174d,_0x4bf31b){_0x4bf31b=_0x4bf31b||0xc8;return function(_0x30a8fb){if(_0x30a8fb){return _0x46174d[_0x48c5('0xd')](_0x4bf31b)['json'](_0x30a8fb);}return _0x46174d[_0x48c5('0xe')](0x194);};}function handleError(_0x46d4ef,_0x7417a9){_0x7417a9=_0x7417a9||0x1f4;return function(_0xfd1145){logger[_0x48c5('0xa')](_0xfd1145['stack']);if(_0xfd1145[_0x48c5('0xf')]){delete _0xfd1145[_0x48c5('0xf')];}_0x46d4ef['status'](_0x7417a9)[_0x48c5('0x10')](_0xfd1145);};}function findById(_0x525b39){return function(_0x14d446){if(!_['isNil'](_0x525b39)&&!_[_0x48c5('0x11')](_0x14d446)&&!_[_0x48c5('0x11')](_0x14d446[_0x48c5('0x12')])){return _[_0x48c5('0x13')](_0x14d446[_0x48c5('0x12')],function(_0x4cee6a){return _0x4cee6a['id']==_0x525b39;});}return null;};}exports[_0x48c5('0x14')]=function(_0x1e3435,_0x75f95a){return respondWithRpcPromise('VoiceChannels',_0x1e3435['query'])[_0x48c5('0x15')](respondWithResult(_0x75f95a,null))[_0x48c5('0xc')](handleError(_0x75f95a,null));};exports[_0x48c5('0x16')]=function(_0xab85d4,_0x3bba41){return respondWithRpcPromise(_0x48c5('0x17'),_[_0x48c5('0x18')](_0xab85d4[_0x48c5('0x19')],_0xab85d4['params']))[_0x48c5('0x15')](respondWithResult(_0x3bba41,null))['catch'](handleError(_0x3bba41,null));};exports['voiceChannelStopMixMonitor']=function(_0x2774a6,_0x7a7d3a){return respondWithRpcPromise(_0x48c5('0x1a'),_[_0x48c5('0x18')](_0x2774a6[_0x48c5('0x19')],_0x2774a6[_0x48c5('0x1b')]))[_0x48c5('0x15')](respondWithResult(_0x7a7d3a,null))[_0x48c5('0xc')](handleError(_0x7a7d3a,null));};exports[_0x48c5('0x1c')]=function(_0x299052,_0x42b1a5){return respondWithRpcPromise(_0x48c5('0x1d'),_0x299052['query'])[_0x48c5('0x15')](respondWithResult(_0x42b1a5,null))[_0x48c5('0xc')](handleError(_0x42b1a5,null));};exports['showVoiceQueues']=function(_0x3f741a,_0x2a9d50){return respondWithRpcPromise(_0x48c5('0x1d'),_0x3f741a[_0x48c5('0x19')])[_0x48c5('0x15')](findById(_0x3f741a[_0x48c5('0x1b')]['id']))['then'](respondWithResult(_0x2a9d50,null))['catch'](handleError(_0x2a9d50,null));};exports[_0x48c5('0x1e')]=function(_0x367e67,_0x5b68d2){return respondWithRpcPromise(_0x48c5('0x1f'),_[_0x48c5('0x18')](_0x367e67[_0x48c5('0x19')],_0x367e67[_0x48c5('0x1b')]))['then'](respondWithResult(_0x5b68d2,null))['catch'](handleError(_0x5b68d2,null));};exports['voiceQueuesChannels']=function(_0x30e021,_0x347d56){return respondWithRpcPromise(_0x48c5('0x20'),_0x30e021[_0x48c5('0x19')])[_0x48c5('0x15')](respondWithResult(_0x347d56,null))['catch'](handleError(_0x347d56,null));};exports['voiceQueuesChannel']=function(_0xf60077,_0x3f12e2){return respondWithRpcPromise(_0x48c5('0x21'),_[_0x48c5('0x18')](_0xf60077[_0x48c5('0x19')],_0xf60077[_0x48c5('0x1b')]))[_0x48c5('0x15')](respondWithResult(_0x3f12e2,null))[_0x48c5('0xc')](handleError(_0x3f12e2,null));};exports[_0x48c5('0x22')]=function(_0x3e91ee,_0x534bb1){return respondWithRpcPromise(_0x48c5('0x23'),_[_0x48c5('0x18')](_0x3e91ee[_0x48c5('0x19')],_0x3e91ee['params']))[_0x48c5('0x15')](respondWithResult(_0x534bb1,null))[_0x48c5('0xc')](handleError(_0x534bb1,null));};exports['voiceQueuesChannelRedirect']=function(_0xb8c860,_0x468067){return respondWithRpcPromise(_0x48c5('0x24'),_[_0x48c5('0x18')](_0xb8c860[_0x48c5('0x19')],_0xb8c860[_0x48c5('0x1b')]))[_0x48c5('0x15')](respondWithResult(_0x468067,null))['catch'](handleError(_0x468067,null));};exports[_0x48c5('0x25')]=function(_0x496521,_0x5303ba){return respondWithRpcPromise('Outbound',_0x496521[_0x48c5('0x19')])[_0x48c5('0x15')](respondWithResult(_0x5303ba,null))['catch'](handleError(_0x5303ba,null));};exports[_0x48c5('0x26')]=function(_0x353ede,_0x563bb2){return respondWithRpcPromise(_0x48c5('0x27'),_0x353ede['query'])[_0x48c5('0x15')](respondWithResult(_0x563bb2,null))[_0x48c5('0xc')](handleError(_0x563bb2,null));};exports[_0x48c5('0x28')]=function(_0x7d8dd8,_0x770525){var _0x55420b;return respondWithRpcPromise('Agents',_0x7d8dd8[_0x48c5('0x19')])[_0x48c5('0x15')](function(_0x227e51){_0x55420b=_0x227e51;return respondWithRpcPromise('Agents',_0x7d8dd8[_0x48c5('0x19')],routingClient);})[_0x48c5('0x15')](function(_0x59ec92){return _['merge']({},_0x59ec92,_0x55420b);})[_0x48c5('0x15')](respondWithResult(_0x770525,null))[_0x48c5('0xc')](handleError(_0x770525,null));};exports['agentCapacity']=function(_0x1bb5c7,_0x528f4a){if(_0x1bb5c7[_0x48c5('0x29')]&&_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')]&&_0x1bb5c7[_0x48c5('0x2b')]&&_0x1bb5c7[_0x48c5('0x2b')][_0x48c5('0xf')]){for(var _0x59a277 in _0x1bb5c7['body'][_0x48c5('0x2a')]){if(_0x1bb5c7['body'][_0x48c5('0x2a')]['hasOwnProperty'](_0x59a277)){db[_0x48c5('0x2c')][_0x48c5('0x2d')]({'where':{'channel':_0x59a277,'membername':_0x1bb5c7[_0x48c5('0x2b')][_0x48c5('0xf')],'type':_0x48c5('0x2e'),'exitAt':null,'uniqueid':_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')][_0x59a277]&&_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')][_0x59a277][_0x48c5('0x2f')]?{'$notIn':_0x1bb5c7['body']['interaction'][_0x59a277]}:{'$ne':null}}})[_0x48c5('0x15')](function(_0x3373e7){var _0x23943f=moment()['format'](_0x48c5('0x30'));for(var _0x11b13c=0x0,_0x484a8f=_0x3373e7[_0x48c5('0x2f')];_0x11b13c<_0x484a8f;_0x11b13c+=0x1){_0x3373e7[_0x11b13c]['updateAttributes']({'exitAt':_0x23943f});}});for(var _0x3d7484=0x0;_0x3d7484<_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')][_0x59a277][_0x48c5('0x2f')];_0x3d7484+=0x1){db[_0x48c5('0x2c')]['findOrCreate']({'where':{'channel':_0x59a277,'membername':_0x1bb5c7[_0x48c5('0x2b')][_0x48c5('0xf')],'type':_0x48c5('0x2e'),'uniqueid':_0x1bb5c7[_0x48c5('0x29')]['interaction'][_0x59a277][_0x3d7484],'exitAt':null},'defaults':{'channel':_0x59a277,'membername':_0x1bb5c7[_0x48c5('0x2b')]['name'],'interface':_[_0x48c5('0x11')](_0x1bb5c7['user'][_0x48c5('0x31')])?util[_0x48c5('0x32')](_0x48c5('0x33'),_0x1bb5c7['user'][_0x48c5('0xf')]):_0x1bb5c7['user'][_0x48c5('0x31')],'type':'INTERACTION','enterAt':moment()[_0x48c5('0x32')](_0x48c5('0x30')),'role':_0x48c5('0x34'),'internal':_0x1bb5c7[_0x48c5('0x2b')]['internal'],'uniqueid':_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')][_0x59a277][_0x3d7484]}});}}}}return respondWithRpcPromise(_0x48c5('0x35'),{'id':_0x1bb5c7[_0x48c5('0x1b')]['id'],'capacity':_0x1bb5c7['body'][_0x48c5('0x36')]},routingClient)[_0x48c5('0x15')](respondWithResult(_0x528f4a,null))['catch'](handleError(_0x528f4a,null));};exports[_0x48c5('0x37')]=function(_0x596d9c,_0x1a5a6c){return respondWithRpcPromise(_0x48c5('0x38'),_0x596d9c['query'])[_0x48c5('0x15')](respondWithResult(_0x1a5a6c,null))['catch'](handleError(_0x1a5a6c,null));};exports[_0x48c5('0x39')]=function(_0x41cce3,_0x4c046c){return respondWithRpcPromise('Trunks',_0x41cce3['query'])[_0x48c5('0x15')](respondWithResult(_0x4c046c,null))[_0x48c5('0xc')](handleError(_0x4c046c,null));};exports[_0x48c5('0x3a')]=function(_0x2ae062,_0x37b9ef){return respondWithRpcPromise('Campaigns',_0x2ae062[_0x48c5('0x19')])[_0x48c5('0x15')](respondWithResult(_0x37b9ef,null))[_0x48c5('0xc')](handleError(_0x37b9ef,null));};exports[_0x48c5('0x3b')]=function(_0x42d723,_0x99b723){return respondWithRpcPromise(_0x48c5('0x3c'),_0x42d723[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x99b723,null))[_0x48c5('0xc')](handleError(_0x99b723,null));};exports[_0x48c5('0x3d')]=function(_0x42f476,_0x5704a1){return respondWithRpcPromise(_0x48c5('0x3c'),_0x42f476['query'],routingClient)[_0x48c5('0x15')](findById(_0x42f476[_0x48c5('0x1b')]['id']))['then'](respondWithResult(_0x5704a1,null))[_0x48c5('0xc')](handleError(_0x5704a1,null));};exports[_0x48c5('0x3e')]=function(_0x15c82a,_0x35d400){return respondWithRpcPromise(_0x48c5('0x3f'),_0x15c82a[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x35d400,null))[_0x48c5('0xc')](handleError(_0x35d400,null));};exports[_0x48c5('0x40')]=function(_0x1f27e8,_0xe6bf8b){return respondWithRpcPromise('MailQueues',_0x1f27e8[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](findById(_0x1f27e8[_0x48c5('0x1b')]['id']))['then'](respondWithResult(_0xe6bf8b,null))[_0x48c5('0xc')](handleError(_0xe6bf8b,null));};exports[_0x48c5('0x41')]=function(_0x13faff,_0x4c54ef){return respondWithRpcPromise(_0x48c5('0x42'),_0x13faff[_0x48c5('0x19')],mailClient)[_0x48c5('0x15')](respondWithResult(_0x4c54ef,null))[_0x48c5('0xc')](handleError(_0x4c54ef,null));};exports[_0x48c5('0x43')]=function(_0xd7e594,_0x11e607){return respondWithRpcPromise(_0x48c5('0x44'),_0xd7e594[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x11e607,null))[_0x48c5('0xc')](handleError(_0x11e607,null));};exports[_0x48c5('0x45')]=function(_0x5706c5,_0x5cd1bc){return respondWithRpcPromise(_0x48c5('0x44'),_0x5706c5['query'],routingClient)['then'](findById(_0x5706c5[_0x48c5('0x1b')]['id']))['then'](respondWithResult(_0x5cd1bc,null))[_0x48c5('0xc')](handleError(_0x5cd1bc,null));};exports[_0x48c5('0x46')]=function(_0x645a5b,_0x5d5966){return respondWithRpcPromise('SmsQueues',_0x645a5b[_0x48c5('0x19')],routingClient)['then'](respondWithResult(_0x5d5966,null))['catch'](handleError(_0x5d5966,null));};exports[_0x48c5('0x47')]=function(_0x5ee934,_0x5220ea){return respondWithRpcPromise('SmsQueues',_0x5ee934[_0x48c5('0x19')],routingClient)['then'](findById(_0x5ee934[_0x48c5('0x1b')]['id']))[_0x48c5('0x15')](respondWithResult(_0x5220ea,null))[_0x48c5('0xc')](handleError(_0x5220ea,null));};exports[_0x48c5('0x48')]=function(_0x3bde67,_0x145866){return respondWithRpcPromise(_0x48c5('0x49'),_0x3bde67[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x145866,null))[_0x48c5('0xc')](handleError(_0x145866,null));};exports['showWhatsappQueues']=function(_0x4ab599,_0x44bb43){return respondWithRpcPromise(_0x48c5('0x49'),_0x4ab599[_0x48c5('0x19')],routingClient)['then'](findById(_0x4ab599[_0x48c5('0x1b')]['id']))[_0x48c5('0x15')](respondWithResult(_0x44bb43,null))[_0x48c5('0xc')](handleError(_0x44bb43,null));};exports[_0x48c5('0x4a')]=function(_0x199cd6,_0x5e98c9){return respondWithRpcPromise(_0x48c5('0x4b'),_0x199cd6[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x5e98c9,null))['catch'](handleError(_0x5e98c9,null));};exports[_0x48c5('0x4c')]=function(_0x20af32,_0x53f810){return respondWithRpcPromise('FaxQueues',_0x20af32['query'],routingClient)[_0x48c5('0x15')](findById(_0x20af32[_0x48c5('0x1b')]['id']))[_0x48c5('0x15')](respondWithResult(_0x53f810,null))[_0x48c5('0xc')](handleError(_0x53f810,null));};exports[_0x48c5('0x4d')]=function(_0x5db078,_0x1fe421){return respondWithRpcPromise('FaxAccounts',_0x5db078[_0x48c5('0x19')])[_0x48c5('0x15')](respondWithResult(_0x1fe421,null))[_0x48c5('0xc')](handleError(_0x1fe421,null));};exports['chatQueuesWaitingInteractions']=function(_0x4f8b6f,_0x8f26c9){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4f8b6f['query'],routingClient)['then'](respondWithResult(_0x8f26c9,null))[_0x48c5('0xc')](handleError(_0x8f26c9,null));};exports[_0x48c5('0x4e')]=function(_0x350a38,_0x3200eb){return respondWithRpcPromise(_0x48c5('0x4f'),_0x350a38[_0x48c5('0x19')],routingClient)['then'](respondWithResult(_0x3200eb,null))[_0x48c5('0xc')](handleError(_0x3200eb,null));};exports[_0x48c5('0x50')]=function(_0x24d237,_0x42ad19){return respondWithRpcPromise(_0x48c5('0x51'),_0x24d237['query'],routingClient)[_0x48c5('0x15')](respondWithResult(_0x42ad19,null))['catch'](handleError(_0x42ad19,null));};exports[_0x48c5('0x52')]=function(_0x579137,_0x5723a3){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x579137['query'],routingClient)[_0x48c5('0x15')](respondWithResult(_0x5723a3,null))[_0x48c5('0xc')](handleError(_0x5723a3,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x39bccd,_0x48650a){return respondWithRpcPromise(_0x48c5('0x53'),_0x39bccd[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x48650a,null))[_0x48c5('0xc')](handleError(_0x48650a,null));};exports[_0x48c5('0x54')]=function(_0x1a1b4b,_0x32e0d8){return respondWithRpcPromise(_0x48c5('0x55'),_0x1a1b4b[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x32e0d8,null))[_0x48c5('0xc')](handleError(_0x32e0d8,null));};exports[_0x48c5('0x56')]=function(_0x2afe1a){return function(_0x10d335,_0xbf04d4){var _0x2ca3d5,_0x15323a;var _0x28c10c=_[_0x48c5('0x57')](_0x2afe1a);var _0x4970cb=_0x2afe1a===_0x48c5('0x58')?_0x48c5('0x59'):_0x48c5('0x5a');return db[_0x28c10c+'Queue'][_0x48c5('0x5b')]({'raw':!![],'where':{'id':_0x10d335[_0x48c5('0x1b')]['id']}})['then'](function(_0x333d65){if(_[_0x48c5('0x11')](_0x333d65)){throw new Error(_0x28c10c+_0x48c5('0x5c'));}_0x2ca3d5=_0x333d65;return db[_0x28c10c+'Message'][_0x48c5('0x5b')]({'where':{'id':_0x10d335[_0x48c5('0x29')][_0x48c5('0x5d')]},'include':[{'model':db[_0x28c10c+'Interaction'],'as':_0x48c5('0x5e')},{'model':db[_0x28c10c+_0x4970cb],'as':_0x48c5('0x5a')}]});})[_0x48c5('0x15')](function(_0x3714f6){if(_[_0x48c5('0x11')](_0x3714f6)){throw new Error(_0x28c10c+_0x48c5('0x5f'));}_0x15323a=_0x3714f6;return _0x3714f6[_0x48c5('0x60')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x110023={'uniqueid':_0x2afe1a+'.'+_0x15323a['id']+'.'+_0x15323a[_0x48c5('0x5e')]['id'],'FromUserId':_0x10d335[_0x48c5('0x2b')]['id'],'type':'queue'};_0x110023[_0x28c10c+'MessageId']=_0x15323a['id'];_0x110023[_0x28c10c+_0x48c5('0x61')]=_0x15323a[_0x48c5('0x5e')]['id'];_0x110023['From'+_0x28c10c+_0x4970cb+'Id']=_0x15323a[_0x48c5('0x5a')]['id'];_0x110023['To'+_0x28c10c+_0x48c5('0x62')]=_0x2ca3d5['id'];return db[_0x28c10c+_0x48c5('0x63')][_0x48c5('0x64')](_0x110023);})[_0x48c5('0x15')](function(){return respondWithRpcPromise(_0x48c5('0x65'),{'channel':_0x2afe1a,'interaction':_0x15323a['Interaction'],'message':_0x15323a,'account':_0x15323a[_0x48c5('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2ca3d5['name']+','+(_0x15323a[_0x48c5('0x5a')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0xbf04d4,null))[_0x48c5('0xc')](handleError(_0xbf04d4,null));};};exports[_0x48c5('0x66')]=function(_0x59b542,_0x19c7b7){var _0x3bfeea,_0x3c415a;if(_[_0x48c5('0x11')](_0x59b542[_0x48c5('0x29')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1c9ddd=_0x59b542['body']['channel'];var _0x1600b2=_['capitalize'](_0x1c9ddd);var _0x52e708=_0x1c9ddd===_0x48c5('0x58')?_0x48c5('0x59'):_0x48c5('0x5a');return db[_0x48c5('0x67')][_0x48c5('0x5b')]({'raw':!![],'where':{'id':_0x59b542['params']['id'],'role':_0x48c5('0x34')}})[_0x48c5('0x15')](function(_0x1a8038){if(_[_0x48c5('0x11')](_0x1a8038)){throw new Error(_0x48c5('0x68'));}_0x3bfeea=_0x1a8038;return db[_0x1600b2+'Message'][_0x48c5('0x5b')]({'where':{'id':_0x59b542[_0x48c5('0x29')][_0x48c5('0x5d')]},'include':[{'model':db[_0x1600b2+'Interaction'],'as':_0x48c5('0x5e')},{'model':db[_0x1600b2+_0x52e708],'as':_0x48c5('0x5a')}]});})[_0x48c5('0x15')](function(_0xbcd818){if(_[_0x48c5('0x11')](_0xbcd818)){throw new Error(_0x1600b2+_0x48c5('0x5f'));}_0x3c415a=_0xbcd818;return _0xbcd818[_0x48c5('0x60')]({'read':0x0,'readAt':null,'UserId':null});})[_0x48c5('0x15')](function(){var _0x1c94f1={'uniqueid':_0x1c9ddd+'.'+_0x3c415a['id']+'.'+_0x3c415a[_0x48c5('0x5e')]['id'],'FromUserId':_0x59b542['user']['id'],'type':_0x48c5('0x69'),'ToUserId':_0x3bfeea['id']};_0x1c94f1[_0x1600b2+_0x48c5('0x6a')]=_0x3c415a['id'];_0x1c94f1[_0x1600b2+'InteractionId']=_0x3c415a[_0x48c5('0x5e')]['id'];_0x1c94f1['From'+_0x1600b2+_0x52e708+'Id']=_0x3c415a[_0x48c5('0x5a')]['id'];return db[_0x1600b2+'TransferReport'][_0x48c5('0x64')](_0x1c94f1);})['then'](function(){return respondWithRpcPromise(_0x48c5('0x65'),{'channel':_0x1c9ddd,'interaction':_0x3c415a[_0x48c5('0x5e')],'message':_0x3c415a,'account':_0x3c415a['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x48c5('0x34'),'appdata':_0x3bfeea[_0x48c5('0xf')]+','+(_0x3c415a[_0x48c5('0x5a')]['agentTransferTimeout']||0x12c),'interval':_0x48c5('0x6b')}]},routingClient);})[_0x48c5('0x15')](respondWithResult(_0x19c7b7,null))['catch'](handleError(_0x19c7b7,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index f42c60e..607d4a9 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 _0x8248=['index','show','run','create','/:id','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x30a92c,_0x2c3e60){var _0x10356f=function(_0xe3bfee){while(--_0xe3bfee){_0x30a92c['push'](_0x30a92c['shift']());}};_0x10356f(++_0x2c3e60);}(_0x8248,0x16d));var _0x8824=function(_0x3fab74,_0x5bbebe){_0x3fab74=_0x3fab74-0x0;var _0x4e0112=_0x8248[_0x3fab74];return _0x4e0112;};'use strict';var multer=require(_0x8824('0x0'));var util=require('util');var path=require(_0x8824('0x1'));var timeout=require(_0x8824('0x2'));var express=require('express');var router=express[_0x8824('0x3')]();var auth=require(_0x8824('0x4'));var interaction=require(_0x8824('0x5'));var config=require(_0x8824('0x6'));var controller=require('./schedule.controller');router[_0x8824('0x7')]('/',auth[_0x8824('0x8')](),controller[_0x8824('0x9')]);router[_0x8824('0x7')]('/:id',auth[_0x8824('0x8')](),controller[_0x8824('0xa')]);router[_0x8824('0x7')]('/:id/run',auth[_0x8824('0x8')](),controller[_0x8824('0xb')]);router['post']('/',auth[_0x8824('0x8')](),controller[_0x8824('0xc')]);router['put'](_0x8824('0xd'),auth['isAuthenticated'](),controller[_0x8824('0xe')]);router['delete'](_0x8824('0xd'),auth[_0x8824('0x8')](),controller[_0x8824('0xf')]);module[_0x8824('0x10')]=router; \ No newline at end of file +var _0x056b=['run','create','put','update','delete','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id'];(function(_0x20a5df,_0x4e1567){var _0x2124e4=function(_0x174f7d){while(--_0x174f7d){_0x20a5df['push'](_0x20a5df['shift']());}};_0x2124e4(++_0x4e1567);}(_0x056b,0x66));var _0xb056=function(_0x158064,_0x1762ac){_0x158064=_0x158064-0x0;var _0x2e159b=_0x056b[_0x158064];return _0x2e159b;};'use strict';var multer=require('multer');var util=require(_0xb056('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb056('0x1')]();var auth=require(_0xb056('0x2'));var interaction=require(_0xb056('0x3'));var config=require(_0xb056('0x4'));var controller=require(_0xb056('0x5'));router[_0xb056('0x6')]('/',auth[_0xb056('0x7')](),controller[_0xb056('0x8')]);router[_0xb056('0x6')](_0xb056('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xb056('0x6')]('/:id/run',auth['isAuthenticated'](),controller[_0xb056('0xa')]);router['post']('/',auth[_0xb056('0x7')](),controller[_0xb056('0xb')]);router[_0xb056('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb056('0xd')]);router[_0xb056('0xe')](_0xb056('0x9'),auth[_0xb056('0x7')](),controller['destroy']);module[_0xb056('0xf')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 7363b3b..a780cd8 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 _0xfb67=['pdf','xlsx','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks','days','hours'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0xfb67,0xdd));var _0x7fb6=function(_0x544723,_0x32fa49){_0x544723=_0x544723-0x0;var _0x3373e5=_0xfb67[_0x544723];return _0x3373e5;};'use strict';var Sequelize=require(_0x7fb6('0x0'));module[_0x7fb6('0x1')]={'name':{'type':Sequelize[_0x7fb6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7fb6('0x2')]},'active':{'type':Sequelize[_0x7fb6('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7fb6('0x2')],'allowNull':![],'defaultValue':_0x7fb6('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x7fb6('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7fb6('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7fb6('0x7')](_0x7fb6('0x8'),_0x7fb6('0x9'),'months',_0x7fb6('0xa'),_0x7fb6('0xb'),_0x7fb6('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x7fb6('0xb')},'output':{'type':Sequelize[_0x7fb6('0x7')]('csv',_0x7fb6('0xd'),_0x7fb6('0xe')),'allowNull':![],'defaultValue':_0x7fb6('0xf')},'type':{'type':Sequelize['ENUM'](_0x7fb6('0x10'),'default'),'allowNull':![],'defaultValue':_0x7fb6('0x10')},'sendMail':{'type':Sequelize[_0x7fb6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7fb6('0x2')]},'cc':{'type':Sequelize[_0x7fb6('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x7fb6('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf8af=['pdf','xlsx','custom','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','months','days','hours','minutes','csv'];(function(_0x23de45,_0x6bb3f0){var _0xd82bf0=function(_0x159797){while(--_0x159797){_0x23de45['push'](_0x23de45['shift']());}};_0xd82bf0(++_0x6bb3f0);}(_0xf8af,0x8b));var _0xff8a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf8af[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xff8a('0x0'));module['exports']={'name':{'type':Sequelize[_0xff8a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xff8a('0x1')]},'active':{'type':Sequelize[_0xff8a('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xff8a('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xff8a('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xff8a('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xff8a('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xff8a('0x5')]('years','quarters',_0xff8a('0x6'),'weeks',_0xff8a('0x7'),_0xff8a('0x8'),_0xff8a('0x9')),'allowNull':![],'defaultValue':_0xff8a('0x7')},'output':{'type':Sequelize[_0xff8a('0x5')](_0xff8a('0xa'),_0xff8a('0xb'),_0xff8a('0xc')),'allowNull':![],'defaultValue':_0xff8a('0xa')},'type':{'type':Sequelize[_0xff8a('0x5')](_0xff8a('0xd'),'default'),'allowNull':![],'defaultValue':_0xff8a('0xd')},'sendMail':{'type':Sequelize[_0xff8a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xff8a('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xff8a('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xff8a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 3bf1f79..74ba272 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 _0xba22=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','then','get','Scheduler','UserProfileResource','destroy','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x34b9c5,_0x42700f){var _0x10b193=function(_0x14df10){while(--_0x14df10){_0x34b9c5['push'](_0x34b9c5['shift']());}};_0x10b193(++_0x42700f);}(_0xba22,0x150));var _0x2ba2=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xba22[_0x16d10f];return _0x50c823;};'use strict';var pdf=require(_0x2ba2('0x0'));var emlformat=require(_0x2ba2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2ba2('0x2'));var jsonpatch=require(_0x2ba2('0x3'));var rp=require(_0x2ba2('0x4'));var moment=require('moment');var BPromise=require(_0x2ba2('0x5'));var Mustache=require(_0x2ba2('0x6'));var util=require(_0x2ba2('0x7'));var path=require(_0x2ba2('0x8'));var sox=require(_0x2ba2('0x9'));var csv=require(_0x2ba2('0xa'));var ejs=require(_0x2ba2('0xb'));var fs=require('fs');var _=require(_0x2ba2('0xc'));var squel=require('squel');var crypto=require(_0x2ba2('0xd'));var jsforce=require(_0x2ba2('0xe'));var deskjs=require(_0x2ba2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2ba2('0x10'));var Papa=require(_0x2ba2('0x11'));var Redis=require(_0x2ba2('0x12'));var authService=require(_0x2ba2('0x13'));var qs=require(_0x2ba2('0x14'));var as=require(_0x2ba2('0x15'));var hardwareService=require(_0x2ba2('0x16'));var logger=require(_0x2ba2('0x17'))(_0x2ba2('0x18'));var utils=require(_0x2ba2('0x19'));var config=require(_0x2ba2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf239bf,_0x467973){_0x467973=_0x467973||0xcc;return function(_0x458f81){if(_0x458f81){return _0xf239bf[_0x2ba2('0x1b')](_0x467973);}return _0xf239bf['status'](_0x467973)[_0x2ba2('0x1c')]();};}function respondWithResult(_0x5a748c,_0x6aa7f7){_0x6aa7f7=_0x6aa7f7||0xc8;return function(_0x56fc80){if(_0x56fc80){return _0x5a748c[_0x2ba2('0x1d')](_0x6aa7f7)[_0x2ba2('0x1e')](_0x56fc80);}};}function respondWithFilteredResult(_0xb20e38,_0x3531dd){return function(_0x568e84){if(_0x568e84){var _0x47888d=_0x568e84[_0x2ba2('0x1f')],_0x1ae8ad=_0x3531dd['offset'],_0x180117=_0x3531dd[_0x2ba2('0x20')]+_0x3531dd[_0x2ba2('0x21')],_0x2406b9;if(_0x180117>=_0x47888d){_0x180117=_0x47888d;_0x2406b9=0xc8;}else{_0x2406b9=0xce;}_0xb20e38['status'](_0x2406b9);return _0xb20e38[_0x2ba2('0x22')]('Content-Range',_0x1ae8ad+'-'+_0x180117+'/'+_0x47888d)[_0x2ba2('0x1e')](_0x568e84);}return null;};}function patchUpdates(_0x543264){return function(_0x460c72){try{jsonpatch[_0x2ba2('0x23')](_0x460c72,_0x543264,!![]);}catch(_0x3a22a9){return BPromise[_0x2ba2('0x24')](_0x3a22a9);}return _0x460c72[_0x2ba2('0x25')]();};}function saveUpdates(_0x1fbb36,_0x1b91d4){return function(_0xd728ad){if(_0xd728ad){return _0xd728ad['update'](_0x1fbb36)[_0x2ba2('0x26')](function(_0x517e84){return _0x517e84;});}return null;};}function removeEntity(_0x346c9e,_0x306403){return function(_0x5e15a4){if(_0x5e15a4){return _0x5e15a4['destroy']()[_0x2ba2('0x26')](function(){var _0x4154d2=_0x5e15a4[_0x2ba2('0x27')]({'plain':!![]});var _0x31bc13=_0x2ba2('0x28');return db[_0x2ba2('0x29')][_0x2ba2('0x2a')]({'where':{'type':_0x31bc13,'resourceId':_0x4154d2['id']}})[_0x2ba2('0x26')](function(){return _0x5e15a4;});})['then'](function(){_0x346c9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x414e07,_0x407ec2){return function(_0x1967d5){if(!_0x1967d5){_0x414e07[_0x2ba2('0x1b')](0x194);}return _0x1967d5;};}function handleError(_0x5629bf,_0x1067b9){_0x1067b9=_0x1067b9||0x1f4;return function(_0x5aead4){logger[_0x2ba2('0x2b')](_0x5aead4['stack']);if(_0x5aead4[_0x2ba2('0x2c')]){delete _0x5aead4[_0x2ba2('0x2c')];}_0x5629bf[_0x2ba2('0x1d')](_0x1067b9)[_0x2ba2('0x2d')](_0x5aead4);};}exports[_0x2ba2('0x2e')]=function(_0x569cfd,_0x382f1d){var _0x1a71bc={},_0x5df92d={},_0x2fc320={'count':0x0,'rows':[]};var _0x1dfea1=_[_0x2ba2('0x2f')](db[_0x2ba2('0x30')][_0x2ba2('0x31')],function(_0x378638){return{'name':_0x378638[_0x2ba2('0x32')],'type':_0x378638[_0x2ba2('0x33')][_0x2ba2('0x34')]};});_0x5df92d['model']=_[_0x2ba2('0x2f')](_0x1dfea1,_0x2ba2('0x2c'));_0x5df92d[_0x2ba2('0x35')]=_[_0x2ba2('0x36')](_0x569cfd[_0x2ba2('0x35')]);_0x5df92d[_0x2ba2('0x37')]=_[_0x2ba2('0x38')](_0x5df92d[_0x2ba2('0x39')],_0x5df92d['query']);_0x1a71bc[_0x2ba2('0x3a')]=_[_0x2ba2('0x38')](_0x5df92d[_0x2ba2('0x39')],qs[_0x2ba2('0x3b')](_0x569cfd[_0x2ba2('0x35')][_0x2ba2('0x3b')]));_0x1a71bc[_0x2ba2('0x3a')]=_0x1a71bc['attributes'][_0x2ba2('0x3c')]?_0x1a71bc[_0x2ba2('0x3a')]:_0x5df92d[_0x2ba2('0x39')];if(!_0x569cfd['query']['hasOwnProperty'](_0x2ba2('0x3d'))){_0x1a71bc[_0x2ba2('0x21')]=qs[_0x2ba2('0x21')](_0x569cfd[_0x2ba2('0x35')]['limit']);_0x1a71bc[_0x2ba2('0x20')]=qs['offset'](_0x569cfd[_0x2ba2('0x35')][_0x2ba2('0x20')]);}_0x1a71bc['order']=qs[_0x2ba2('0x3e')](_0x569cfd['query'][_0x2ba2('0x3e')]);_0x1a71bc[_0x2ba2('0x3f')]=qs[_0x2ba2('0x37')](_[_0x2ba2('0x40')](_0x569cfd[_0x2ba2('0x35')],_0x5df92d['filters']),_0x1dfea1);if(_0x569cfd[_0x2ba2('0x35')][_0x2ba2('0x41')]){_0x1a71bc[_0x2ba2('0x3f')]=_['merge'](_0x1a71bc[_0x2ba2('0x3f')],{'$or':_[_0x2ba2('0x2f')](_0x1dfea1,function(_0x964cfe){if(_0x964cfe[_0x2ba2('0x33')]!=='VIRTUAL'){var _0x94a030={};_0x94a030[_0x964cfe[_0x2ba2('0x2c')]]={'$like':'%'+_0x569cfd[_0x2ba2('0x35')]['filter']+'%'};return _0x94a030;}})});}_0x1a71bc=_[_0x2ba2('0x42')]({},_0x1a71bc,_0x569cfd[_0x2ba2('0x43')]);var _0x134175={'where':_0x1a71bc[_0x2ba2('0x3f')]};return db[_0x2ba2('0x30')][_0x2ba2('0x1f')](_0x134175)[_0x2ba2('0x26')](function(_0x29a177){_0x2fc320[_0x2ba2('0x1f')]=_0x29a177;if(_0x569cfd[_0x2ba2('0x35')][_0x2ba2('0x44')]){_0x1a71bc['include']=[{'all':!![]}];}return db[_0x2ba2('0x30')][_0x2ba2('0x45')](_0x1a71bc);})[_0x2ba2('0x26')](function(_0x2bb925){_0x2fc320[_0x2ba2('0x46')]=_0x2bb925;return _0x2fc320;})[_0x2ba2('0x26')](respondWithFilteredResult(_0x382f1d,_0x1a71bc))['catch'](handleError(_0x382f1d,null));};exports[_0x2ba2('0x47')]=function(_0x393c3d,_0x58d89a){var _0x28c5b5={'raw':![],'where':{'id':_0x393c3d[_0x2ba2('0x48')]['id']}},_0x5b7def={};_0x5b7def[_0x2ba2('0x39')]=_['keys'](db[_0x2ba2('0x30')][_0x2ba2('0x31')]);_0x5b7def[_0x2ba2('0x35')]=_['keys'](_0x393c3d[_0x2ba2('0x35')]);_0x5b7def['filters']=_['intersection'](_0x5b7def[_0x2ba2('0x39')],_0x5b7def[_0x2ba2('0x35')]);_0x28c5b5[_0x2ba2('0x3a')]=_[_0x2ba2('0x38')](_0x5b7def[_0x2ba2('0x39')],qs[_0x2ba2('0x3b')](_0x393c3d[_0x2ba2('0x35')][_0x2ba2('0x3b')]));_0x28c5b5['attributes']=_0x28c5b5['attributes'][_0x2ba2('0x3c')]?_0x28c5b5['attributes']:_0x5b7def[_0x2ba2('0x39')];if(_0x393c3d['query'][_0x2ba2('0x44')]){_0x28c5b5[_0x2ba2('0x49')]=[{'all':!![]}];}_0x28c5b5=_[_0x2ba2('0x42')]({},_0x28c5b5,_0x393c3d['options']);return db[_0x2ba2('0x30')][_0x2ba2('0x4a')](_0x28c5b5)[_0x2ba2('0x26')](handleEntityNotFound(_0x58d89a,null))[_0x2ba2('0x26')](respondWithResult(_0x58d89a,null))['catch'](handleError(_0x58d89a,null));};exports['create']=function(_0x221bd0,_0x5edd3b){return db['Schedule'][_0x2ba2('0x4b')](_0x221bd0[_0x2ba2('0x4c')],{})[_0x2ba2('0x26')](function(_0x45c361){var _0x174d34=_0x221bd0[_0x2ba2('0x4d')][_0x2ba2('0x27')]({'plain':!![]});if(!_0x174d34)throw new Error(_0x2ba2('0x4e'));if(_0x174d34[_0x2ba2('0x4f')]===_0x2ba2('0x4d')){var _0x201503=_0x45c361[_0x2ba2('0x27')]({'plain':!![]});var _0xff4b93=_0x2ba2('0x28');return db[_0x2ba2('0x50')][_0x2ba2('0x4a')]({'where':{'name':_0xff4b93,'userProfileId':_0x174d34[_0x2ba2('0x51')]},'raw':!![]})[_0x2ba2('0x26')](function(_0x3efc12){if(_0x3efc12&&_0x3efc12[_0x2ba2('0x52')]===0x0){return db['UserProfileResource'][_0x2ba2('0x4b')]({'name':_0x201503[_0x2ba2('0x2c')],'resourceId':_0x201503['id'],'type':_0x3efc12['name'],'sectionId':_0x3efc12['id']},{})[_0x2ba2('0x26')](function(){return _0x45c361;});}else{return _0x45c361;}})[_0x2ba2('0x53')](function(_0x21c88d){logger[_0x2ba2('0x2b')](_0x2ba2('0x54'),_0x21c88d);throw _0x21c88d;});}return _0x45c361;})[_0x2ba2('0x26')](respondWithResult(_0x5edd3b,0xc9))[_0x2ba2('0x53')](handleError(_0x5edd3b,null));};exports[_0x2ba2('0x55')]=function(_0x3deb2b,_0x18e235){if(_0x3deb2b[_0x2ba2('0x4c')]['id']){delete _0x3deb2b[_0x2ba2('0x4c')]['id'];}return db[_0x2ba2('0x30')]['find']({'where':{'id':_0x3deb2b[_0x2ba2('0x48')]['id']}})['then'](handleEntityNotFound(_0x18e235,null))[_0x2ba2('0x26')](saveUpdates(_0x3deb2b[_0x2ba2('0x4c')],null))[_0x2ba2('0x26')](respondWithResult(_0x18e235,null))[_0x2ba2('0x53')](handleError(_0x18e235,null));};exports['destroy']=function(_0x56fb48,_0x347542){return db[_0x2ba2('0x30')][_0x2ba2('0x4a')]({'where':{'id':_0x56fb48['params']['id']}})[_0x2ba2('0x26')](handleEntityNotFound(_0x347542,null))[_0x2ba2('0x26')](removeEntity(_0x347542,null))[_0x2ba2('0x53')](handleError(_0x347542,null));};exports[_0x2ba2('0x56')]=function(_0x17c850,_0x792a8b,_0x35c1a2){var _0x48f102=require(_0x2ba2('0x57'));return db[_0x2ba2('0x30')][_0x2ba2('0x4a')]({'where':{'id':_0x17c850['params']['id']},'raw':!![]})[_0x2ba2('0x26')](handleEntityNotFound(_0x792a8b,null))[_0x2ba2('0x26')](function(){_0x48f102[_0x2ba2('0x56')](_0x17c850[_0x2ba2('0x48')]['id']);})['then'](respondWithStatusCode(_0x792a8b,null))[_0x2ba2('0x53')](handleError(_0x792a8b,null));}; \ No newline at end of file +var _0x6438=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','json','count','offset','status','apply','reject','save','then','get','destroy','end','sendStatus','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','update','run'];(function(_0x5f2202,_0x387878){var _0x3bbc7b=function(_0x295ebb){while(--_0x295ebb){_0x5f2202['push'](_0x5f2202['shift']());}};_0x3bbc7b(++_0x387878);}(_0x6438,0x1e0));var _0x8643=function(_0x49ee71,_0x491e2b){_0x49ee71=_0x49ee71-0x0;var _0x569548=_0x6438[_0x49ee71];return _0x569548;};'use strict';var pdf=require(_0x8643('0x0'));var emlformat=require(_0x8643('0x1'));var rimraf=require(_0x8643('0x2'));var zipdir=require(_0x8643('0x3'));var jsonpatch=require(_0x8643('0x4'));var rp=require(_0x8643('0x5'));var moment=require('moment');var BPromise=require(_0x8643('0x6'));var Mustache=require(_0x8643('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8643('0x8'));var csv=require('to-csv');var ejs=require(_0x8643('0x9'));var fs=require('fs');var _=require(_0x8643('0xa'));var squel=require(_0x8643('0xb'));var crypto=require('crypto');var jsforce=require(_0x8643('0xc'));var deskjs=require(_0x8643('0xd'));var toCsv=require(_0x8643('0xe'));var querystring=require(_0x8643('0xf'));var Papa=require('papaparse');var Redis=require(_0x8643('0x10'));var authService=require(_0x8643('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8643('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8643('0x13'))('api');var utils=require(_0x8643('0x14'));var config=require('../../config/environment');var db=require(_0x8643('0x15'))['db'];function respondWithStatusCode(_0x4030a2,_0x4d919a){_0x4d919a=_0x4d919a||0xcc;return function(_0x1ac8b2){if(_0x1ac8b2){return _0x4030a2['sendStatus'](_0x4d919a);}return _0x4030a2['status'](_0x4d919a)['end']();};}function respondWithResult(_0x448c49,_0x3e1141){_0x3e1141=_0x3e1141||0xc8;return function(_0x59f1fc){if(_0x59f1fc){return _0x448c49['status'](_0x3e1141)[_0x8643('0x16')](_0x59f1fc);}};}function respondWithFilteredResult(_0x1df151,_0x482406){return function(_0x5c8b83){if(_0x5c8b83){var _0x39b758=_0x5c8b83[_0x8643('0x17')],_0x48ac0a=_0x482406[_0x8643('0x18')],_0x356151=_0x482406['offset']+_0x482406['limit'],_0x1bebf7;if(_0x356151>=_0x39b758){_0x356151=_0x39b758;_0x1bebf7=0xc8;}else{_0x1bebf7=0xce;}_0x1df151[_0x8643('0x19')](_0x1bebf7);return _0x1df151['set']('Content-Range',_0x48ac0a+'-'+_0x356151+'/'+_0x39b758)[_0x8643('0x16')](_0x5c8b83);}return null;};}function patchUpdates(_0x2c37c9){return function(_0x3dc56e){try{jsonpatch[_0x8643('0x1a')](_0x3dc56e,_0x2c37c9,!![]);}catch(_0xf59312){return BPromise[_0x8643('0x1b')](_0xf59312);}return _0x3dc56e[_0x8643('0x1c')]();};}function saveUpdates(_0x402165,_0x32d498){return function(_0x52a975){if(_0x52a975){return _0x52a975['update'](_0x402165)['then'](function(_0x427e5e){return _0x427e5e;});}return null;};}function removeEntity(_0x270160,_0x480807){return function(_0x5cbe1d){if(_0x5cbe1d){return _0x5cbe1d['destroy']()[_0x8643('0x1d')](function(){var _0x12054c=_0x5cbe1d[_0x8643('0x1e')]({'plain':!![]});var _0x30e3c4='Scheduler';return db['UserProfileResource'][_0x8643('0x1f')]({'where':{'type':_0x30e3c4,'resourceId':_0x12054c['id']}})[_0x8643('0x1d')](function(){return _0x5cbe1d;});})['then'](function(){_0x270160[_0x8643('0x19')](0xcc)[_0x8643('0x20')]();});}};}function handleEntityNotFound(_0x47e439,_0x5a5b25){return function(_0x74eb9d){if(!_0x74eb9d){_0x47e439[_0x8643('0x21')](0x194);}return _0x74eb9d;};}function handleError(_0x461640,_0x36e21b){_0x36e21b=_0x36e21b||0x1f4;return function(_0x392773){logger[_0x8643('0x22')](_0x392773[_0x8643('0x23')]);if(_0x392773[_0x8643('0x24')]){delete _0x392773[_0x8643('0x24')];}_0x461640[_0x8643('0x19')](_0x36e21b)[_0x8643('0x25')](_0x392773);};}exports[_0x8643('0x26')]=function(_0x57531d,_0xe74eee){var _0x200371={},_0xe3a3e7={},_0x226404={'count':0x0,'rows':[]};var _0x42e57c=_[_0x8643('0x27')](db[_0x8643('0x28')][_0x8643('0x29')],function(_0x4c52bb){return{'name':_0x4c52bb[_0x8643('0x2a')],'type':_0x4c52bb['type'][_0x8643('0x2b')]};});_0xe3a3e7[_0x8643('0x2c')]=_[_0x8643('0x27')](_0x42e57c,_0x8643('0x24'));_0xe3a3e7[_0x8643('0x2d')]=_['keys'](_0x57531d[_0x8643('0x2d')]);_0xe3a3e7[_0x8643('0x2e')]=_[_0x8643('0x2f')](_0xe3a3e7[_0x8643('0x2c')],_0xe3a3e7['query']);_0x200371[_0x8643('0x30')]=_[_0x8643('0x2f')](_0xe3a3e7['model'],qs['fields'](_0x57531d[_0x8643('0x2d')][_0x8643('0x31')]));_0x200371['attributes']=_0x200371['attributes'][_0x8643('0x32')]?_0x200371[_0x8643('0x30')]:_0xe3a3e7[_0x8643('0x2c')];if(!_0x57531d[_0x8643('0x2d')][_0x8643('0x33')]('nolimit')){_0x200371[_0x8643('0x34')]=qs[_0x8643('0x34')](_0x57531d[_0x8643('0x2d')]['limit']);_0x200371['offset']=qs[_0x8643('0x18')](_0x57531d['query'][_0x8643('0x18')]);}_0x200371[_0x8643('0x35')]=qs[_0x8643('0x36')](_0x57531d['query'][_0x8643('0x36')]);_0x200371[_0x8643('0x37')]=qs['filters'](_[_0x8643('0x38')](_0x57531d['query'],_0xe3a3e7[_0x8643('0x2e')]),_0x42e57c);if(_0x57531d['query'][_0x8643('0x39')]){_0x200371[_0x8643('0x37')]=_[_0x8643('0x3a')](_0x200371[_0x8643('0x37')],{'$or':_[_0x8643('0x27')](_0x42e57c,function(_0x43bb3f){if(_0x43bb3f[_0x8643('0x3b')]!=='VIRTUAL'){var _0x2edfde={};_0x2edfde[_0x43bb3f[_0x8643('0x24')]]={'$like':'%'+_0x57531d[_0x8643('0x2d')][_0x8643('0x39')]+'%'};return _0x2edfde;}})});}_0x200371=_[_0x8643('0x3a')]({},_0x200371,_0x57531d['options']);var _0x2426dd={'where':_0x200371[_0x8643('0x37')]};return db[_0x8643('0x28')]['count'](_0x2426dd)[_0x8643('0x1d')](function(_0x5c28c0){_0x226404['count']=_0x5c28c0;if(_0x57531d[_0x8643('0x2d')][_0x8643('0x3c')]){_0x200371[_0x8643('0x3d')]=[{'all':!![]}];}return db[_0x8643('0x28')]['findAll'](_0x200371);})[_0x8643('0x1d')](function(_0x4f11d5){_0x226404[_0x8643('0x3e')]=_0x4f11d5;return _0x226404;})[_0x8643('0x1d')](respondWithFilteredResult(_0xe74eee,_0x200371))[_0x8643('0x3f')](handleError(_0xe74eee,null));};exports[_0x8643('0x40')]=function(_0x49b809,_0x457811){var _0x18b8cf={'raw':![],'where':{'id':_0x49b809[_0x8643('0x41')]['id']}},_0x5d95c1={};_0x5d95c1[_0x8643('0x2c')]=_[_0x8643('0x42')](db[_0x8643('0x28')][_0x8643('0x29')]);_0x5d95c1[_0x8643('0x2d')]=_[_0x8643('0x42')](_0x49b809['query']);_0x5d95c1[_0x8643('0x2e')]=_[_0x8643('0x2f')](_0x5d95c1['model'],_0x5d95c1['query']);_0x18b8cf[_0x8643('0x30')]=_[_0x8643('0x2f')](_0x5d95c1[_0x8643('0x2c')],qs[_0x8643('0x31')](_0x49b809['query']['fields']));_0x18b8cf[_0x8643('0x30')]=_0x18b8cf[_0x8643('0x30')][_0x8643('0x32')]?_0x18b8cf[_0x8643('0x30')]:_0x5d95c1[_0x8643('0x2c')];if(_0x49b809[_0x8643('0x2d')][_0x8643('0x3c')]){_0x18b8cf['include']=[{'all':!![]}];}_0x18b8cf=_[_0x8643('0x3a')]({},_0x18b8cf,_0x49b809[_0x8643('0x43')]);return db[_0x8643('0x28')][_0x8643('0x44')](_0x18b8cf)[_0x8643('0x1d')](handleEntityNotFound(_0x457811,null))[_0x8643('0x1d')](respondWithResult(_0x457811,null))[_0x8643('0x3f')](handleError(_0x457811,null));};exports['create']=function(_0x1280df,_0x2f610c){return db['Schedule'][_0x8643('0x45')](_0x1280df[_0x8643('0x46')],{})[_0x8643('0x1d')](function(_0x4a3e60){var _0x1d07b9=_0x1280df[_0x8643('0x47')]['get']({'plain':!![]});if(!_0x1d07b9)throw new Error(_0x8643('0x48'));if(_0x1d07b9[_0x8643('0x49')]===_0x8643('0x47')){var _0x3462b5=_0x4a3e60[_0x8643('0x1e')]({'plain':!![]});var _0x499e75=_0x8643('0x4a');return db[_0x8643('0x4b')][_0x8643('0x44')]({'where':{'name':_0x499e75,'userProfileId':_0x1d07b9[_0x8643('0x4c')]},'raw':!![]})[_0x8643('0x1d')](function(_0x2b7f2e){if(_0x2b7f2e&&_0x2b7f2e[_0x8643('0x4d')]===0x0){return db['UserProfileResource'][_0x8643('0x45')]({'name':_0x3462b5['name'],'resourceId':_0x3462b5['id'],'type':_0x2b7f2e[_0x8643('0x24')],'sectionId':_0x2b7f2e['id']},{})[_0x8643('0x1d')](function(){return _0x4a3e60;});}else{return _0x4a3e60;}})[_0x8643('0x3f')](function(_0x13ad3b){logger[_0x8643('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13ad3b);throw _0x13ad3b;});}return _0x4a3e60;})[_0x8643('0x1d')](respondWithResult(_0x2f610c,0xc9))['catch'](handleError(_0x2f610c,null));};exports[_0x8643('0x4e')]=function(_0x411421,_0x5c0514){if(_0x411421[_0x8643('0x46')]['id']){delete _0x411421[_0x8643('0x46')]['id'];}return db['Schedule'][_0x8643('0x44')]({'where':{'id':_0x411421['params']['id']}})[_0x8643('0x1d')](handleEntityNotFound(_0x5c0514,null))['then'](saveUpdates(_0x411421[_0x8643('0x46')],null))[_0x8643('0x1d')](respondWithResult(_0x5c0514,null))['catch'](handleError(_0x5c0514,null));};exports[_0x8643('0x1f')]=function(_0x3206c5,_0xe87a74){return db['Schedule'][_0x8643('0x44')]({'where':{'id':_0x3206c5[_0x8643('0x41')]['id']}})[_0x8643('0x1d')](handleEntityNotFound(_0xe87a74,null))['then'](removeEntity(_0xe87a74,null))[_0x8643('0x3f')](handleError(_0xe87a74,null));};exports[_0x8643('0x4f')]=function(_0x3c7b12,_0x182d3f,_0x5e0718){var _0x1d3b1c=require('../../config/schedule');return db[_0x8643('0x28')][_0x8643('0x44')]({'where':{'id':_0x3c7b12[_0x8643('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x182d3f,null))['then'](function(){_0x1d3b1c[_0x8643('0x4f')](_0x3c7b12[_0x8643('0x41')]['id']);})[_0x8643('0x1d')](respondWithStatusCode(_0x182d3f,null))['catch'](handleError(_0x182d3f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 487a843..1bf28e4 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 _0xd377=['request-promise','path','rimraf','../../config/environment','exports','define','tools_schedules','lodash','../../config/logger','api','moment','bluebird'];(function(_0x978b14,_0x45a8ab){var _0x8dbf9c=function(_0x186b34){while(--_0x186b34){_0x978b14['push'](_0x978b14['shift']());}};_0x8dbf9c(++_0x45a8ab);}(_0xd377,0x1db));var _0x7d37=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd377[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7d37('0x0'));var util=require('util');var logger=require(_0x7d37('0x1'))(_0x7d37('0x2'));var moment=require(_0x7d37('0x3'));var BPromise=require(_0x7d37('0x4'));var rp=require(_0x7d37('0x5'));var fs=require('fs');var path=require(_0x7d37('0x6'));var rimraf=require(_0x7d37('0x7'));var config=require(_0x7d37('0x8'));var attributes=require('./schedule.attributes');module[_0x7d37('0x9')]=function(_0x47300b,_0x581000){return _0x47300b[_0x7d37('0xa')]('Schedule',attributes,{'tableName':_0x7d37('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce0=['rimraf','../../config/environment','./schedule.attributes','define','Schedule','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x21b670,_0x55a7ae){var _0x1a7cb5=function(_0xf02806){while(--_0xf02806){_0x21b670['push'](_0x21b670['shift']());}};_0x1a7cb5(++_0x55a7ae);}(_0x8ce0,0x1a7));var _0x08ce=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8ce0[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x08ce('0x0'));var util=require(_0x08ce('0x1'));var logger=require(_0x08ce('0x2'))('api');var moment=require('moment');var BPromise=require(_0x08ce('0x3'));var rp=require(_0x08ce('0x4'));var fs=require('fs');var path=require(_0x08ce('0x5'));var rimraf=require(_0x08ce('0x6'));var config=require(_0x08ce('0x7'));var attributes=require(_0x08ce('0x8'));module['exports']=function(_0xd72abc,_0x540fc6){return _0xd72abc[_0x08ce('0x9')](_0x08ce('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index c9f6ff7..c9bbf88 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 _0x9315=['then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2af9c5,_0x1eccae){var _0x198e3b=function(_0x5c9ee8){while(--_0x5c9ee8){_0x2af9c5['push'](_0x2af9c5['shift']());}};_0x198e3b(++_0x1eccae);}(_0x9315,0x14e));var _0x5931=function(_0x305a6c,_0x53df99){_0x305a6c=_0x305a6c-0x0;var _0x5cacbe=_0x9315[_0x305a6c];return _0x5cacbe;};'use strict';var _=require('lodash');var util=require(_0x5931('0x0'));var moment=require(_0x5931('0x1'));var BPromise=require('bluebird');var rs=require(_0x5931('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5931('0x3'))['db'];var utils=require(_0x5931('0x4'));var logger=require(_0x5931('0x5'))(_0x5931('0x6'));var config=require(_0x5931('0x7'));var jayson=require(_0x5931('0x8'));var client=jayson['client'][_0x5931('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49d172,_0x3b440,_0x19a144){return new BPromise(function(_0x1241a5,_0x1acd67){return client[_0x5931('0xa')](_0x49d172,_0x19a144)[_0x5931('0xb')](function(_0x34d40c){logger[_0x5931('0xc')](_0x5931('0xd'),_0x3b440,_0x5931('0xe'));logger[_0x5931('0xf')](_0x5931('0x10'),_0x3b440,_0x5931('0xe'),JSON[_0x5931('0x11')](_0x34d40c));if(_0x34d40c[_0x5931('0x12')]){if(_0x34d40c[_0x5931('0x12')][_0x5931('0x13')]===0x1f4){logger[_0x5931('0x12')](_0x5931('0xd'),_0x3b440,_0x34d40c['error'][_0x5931('0x14')]);return _0x1acd67(_0x34d40c[_0x5931('0x12')][_0x5931('0x14')]);}logger['error'](_0x5931('0xd'),_0x3b440,_0x34d40c[_0x5931('0x12')][_0x5931('0x14')]);return _0x1241a5(_0x34d40c[_0x5931('0x12')]['message']);}else{logger[_0x5931('0xc')](_0x5931('0xd'),_0x3b440,'request\x20sent');_0x1241a5(_0x34d40c[_0x5931('0x15')][_0x5931('0x14')]);}})[_0x5931('0x16')](function(_0x2f151e){logger[_0x5931('0x12')](_0x5931('0xd'),_0x3b440,_0x2f151e);_0x1acd67(_0x2f151e);});});} \ No newline at end of file +var _0x8e41=['message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x35994e,_0x3968be){var _0x1dc2e=function(_0x5443ed){while(--_0x5443ed){_0x35994e['push'](_0x35994e['shift']());}};_0x1dc2e(++_0x3968be);}(_0x8e41,0x173));var _0x18e4=function(_0x7eee15,_0x3fe21a){_0x7eee15=_0x7eee15-0x0;var _0x7ad23=_0x8e41[_0x7eee15];return _0x7ad23;};'use strict';var _=require(_0x18e4('0x0'));var util=require(_0x18e4('0x1'));var moment=require(_0x18e4('0x2'));var BPromise=require('bluebird');var rs=require(_0x18e4('0x3'));var fs=require('fs');var Redis=require(_0x18e4('0x4'));var db=require(_0x18e4('0x5'))['db'];var utils=require(_0x18e4('0x6'));var logger=require(_0x18e4('0x7'))(_0x18e4('0x8'));var config=require(_0x18e4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x18e4('0xa')][_0x18e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4618a1,_0x40dfd2,_0x56ffed){return new BPromise(function(_0x4dcfaf,_0x59a038){return client[_0x18e4('0xc')](_0x4618a1,_0x56ffed)[_0x18e4('0xd')](function(_0x3c44be){logger['info'](_0x18e4('0xe'),_0x40dfd2,'request\x20sent');logger[_0x18e4('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x40dfd2,_0x18e4('0x10'),JSON[_0x18e4('0x11')](_0x3c44be));if(_0x3c44be[_0x18e4('0x12')]){if(_0x3c44be['error'][_0x18e4('0x13')]===0x1f4){logger[_0x18e4('0x12')]('Schedule,\x20%s,\x20%s',_0x40dfd2,_0x3c44be[_0x18e4('0x12')][_0x18e4('0x14')]);return _0x59a038(_0x3c44be['error'][_0x18e4('0x14')]);}logger[_0x18e4('0x12')]('Schedule,\x20%s,\x20%s',_0x40dfd2,_0x3c44be[_0x18e4('0x12')][_0x18e4('0x14')]);return _0x4dcfaf(_0x3c44be[_0x18e4('0x12')]['message']);}else{logger[_0x18e4('0x15')](_0x18e4('0xe'),_0x40dfd2,_0x18e4('0x10'));_0x4dcfaf(_0x3c44be[_0x18e4('0x16')][_0x18e4('0x14')]);}})['catch'](function(_0x2500e8){logger[_0x18e4('0x12')](_0x18e4('0xe'),_0x40dfd2,_0x2500e8);_0x59a038(_0x2500e8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d01d9a8..3814c37 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 _0x2941=['download','post','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download'];(function(_0x26dc96,_0x10c6f5){var _0x30b7be=function(_0x47de22){while(--_0x47de22){_0x26dc96['push'](_0x26dc96['shift']());}};_0x30b7be(++_0x10c6f5);}(_0x2941,0x151));var _0x1294=function(_0x9e7f3a,_0x37105f){_0x9e7f3a=_0x9e7f3a-0x0;var _0x5ab145=_0x2941[_0x9e7f3a];return _0x5ab145;};'use strict';var multer=require(_0x1294('0x0'));var util=require('util');var path=require(_0x1294('0x1'));var timeout=require(_0x1294('0x2'));var express=require(_0x1294('0x3'));var router=express[_0x1294('0x4')]();var auth=require(_0x1294('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1294('0x6'));var controller=require(_0x1294('0x7'));router[_0x1294('0x8')]('/',auth[_0x1294('0x9')](),controller[_0x1294('0xa')]);router[_0x1294('0x8')](_0x1294('0xb'),auth[_0x1294('0x9')](),controller[_0x1294('0xc')]);router[_0x1294('0x8')]('/:id',auth[_0x1294('0x9')](),controller[_0x1294('0xd')]);router['get'](_0x1294('0xe'),auth['isAuthenticated'](),controller[_0x1294('0xf')]);router[_0x1294('0x10')]('/',auth[_0x1294('0x9')](),controller['create']);router[_0x1294('0x11')](_0x1294('0x12'),auth[_0x1294('0x9')](),controller[_0x1294('0x13')]);router['delete'](_0x1294('0x12'),auth[_0x1294('0x9')](),controller[_0x1294('0x14')]);module[_0x1294('0x15')]=router; \ No newline at end of file +var _0xd27c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','put','delete','destroy','exports','multer','util','path'];(function(_0x15a3f6,_0x38bdeb){var _0x1948bc=function(_0x250a3a){while(--_0x250a3a){_0x15a3f6['push'](_0x15a3f6['shift']());}};_0x1948bc(++_0x38bdeb);}(_0xd27c,0xad));var _0xcd27=function(_0x212960,_0x520f14){_0x212960=_0x212960-0x0;var _0x4f5a8a=_0xd27c[_0x212960];return _0x4f5a8a;};'use strict';var multer=require(_0xcd27('0x0'));var util=require(_0xcd27('0x1'));var path=require(_0xcd27('0x2'));var timeout=require(_0xcd27('0x3'));var express=require(_0xcd27('0x4'));var router=express[_0xcd27('0x5')]();var auth=require(_0xcd27('0x6'));var interaction=require(_0xcd27('0x7'));var config=require(_0xcd27('0x8'));var controller=require('./screenRecording.controller');router[_0xcd27('0x9')]('/',auth[_0xcd27('0xa')](),controller[_0xcd27('0xb')]);router['get'](_0xcd27('0xc'),auth[_0xcd27('0xa')](),controller[_0xcd27('0xd')]);router[_0xcd27('0x9')](_0xcd27('0xe'),auth[_0xcd27('0xa')](),controller[_0xcd27('0xf')]);router[_0xcd27('0x9')]('/:id/download',auth[_0xcd27('0xa')](),controller[_0xcd27('0x10')]);router[_0xcd27('0x11')]('/',auth[_0xcd27('0xa')](),controller['create']);router[_0xcd27('0x12')](_0xcd27('0xe'),auth[_0xcd27('0xa')](),controller['update']);router[_0xcd27('0x13')]('/:id',auth[_0xcd27('0xa')](),controller[_0xcd27('0x14')]);module[_0xcd27('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8195c99..9144537 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 _0xdc97=['startedAt','subtract','closedAt','duration','DATE','toString','format','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','moment','path','exports','getDataValue','value','STRING','setDataValue','INTEGER'];(function(_0x1c1996,_0xb8413e){var _0x30dff0=function(_0x57aeba){while(--_0x57aeba){_0x1c1996['push'](_0x1c1996['shift']());}};_0x30dff0(++_0xb8413e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x57c929,_0x56bd48){_0x57c929=_0x57c929-0x0;var _0x12858a=_0xdc97[_0x57c929];return _0x12858a;};'use strict';var Sequelize=require(_0x7dc9('0x0'));var moment=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var config=require('../../config/environment');module[_0x7dc9('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7dc9('0x4')](_0x7dc9('0x5'))?path['extname'](this[_0x7dc9('0x4')](_0x7dc9('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x7dc9('0x6')]},'channel':{'type':Sequelize[_0x7dc9('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2636ef){var _0x4f91c7=_0x2636ef['replace'](/\\/g,'/');this[_0x7dc9('0x7')](_0x7dc9('0x5'),_0x4f91c7);}},'rating':{'type':Sequelize[_0x7dc9('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7dc9('0x8')],'set':function(_0x3dd07e){this['setDataValue'](_0x7dc9('0x9'),moment()[_0x7dc9('0xa')](_0x3dd07e,'ms'));this[_0x7dc9('0x7')](_0x7dc9('0xb'),moment());this[_0x7dc9('0x7')](_0x7dc9('0xc'),_0x3dd07e);}},'startedAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this['getDataValue']('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x7dc9('0xe')]();}},'closedAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this['getDataValue'](_0x7dc9('0xb')))[_0x7dc9('0xf')](_0x7dc9('0x10'))[_0x7dc9('0xe')]();}},'createdAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this[_0x7dc9('0x4')]('createdAt'))[_0x7dc9('0xf')](_0x7dc9('0x10'))[_0x7dc9('0xe')]();}},'updatedAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this[_0x7dc9('0x4')](_0x7dc9('0x11')))[_0x7dc9('0xf')](_0x7dc9('0x10'))[_0x7dc9('0xe')]();}}}; \ No newline at end of file +var _0x3e74=['path','../../config/environment','exports','value','getDataValue','STRING','replace','setDataValue','INTEGER','subtract','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize'];(function(_0x28810a,_0x274285){var _0x2f52d1=function(_0xc707c4){while(--_0xc707c4){_0x28810a['push'](_0x28810a['shift']());}};_0x2f52d1(++_0x274285);}(_0x3e74,0x175));var _0x43e7=function(_0x3c67da,_0x525094){_0x3c67da=_0x3c67da-0x0;var _0x5cca28=_0x3e74[_0x3c67da];return _0x5cca28;};'use strict';var Sequelize=require(_0x43e7('0x0'));var moment=require('moment');var path=require(_0x43e7('0x1'));var config=require(_0x43e7('0x2'));module[_0x43e7('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x43e7('0x4'))?path['extname'](this[_0x43e7('0x5')](_0x43e7('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x43e7('0x6')]},'channel':{'type':Sequelize[_0x43e7('0x6')]},'value':{'type':Sequelize[_0x43e7('0x6')],'set':function(_0x503698){var _0x45a0d1=_0x503698[_0x43e7('0x7')](/\\/g,'/');this[_0x43e7('0x8')](_0x43e7('0x4'),_0x45a0d1);}},'rating':{'type':Sequelize[_0x43e7('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x212c6c){this['setDataValue']('startedAt',moment()[_0x43e7('0xa')](_0x212c6c,'ms'));this[_0x43e7('0x8')]('closedAt',moment());this[_0x43e7('0x8')]('duration',_0x212c6c);}},'startedAt':{'type':Sequelize[_0x43e7('0xb')],'get':function(){return moment(this[_0x43e7('0x5')]('startedAt'))[_0x43e7('0xc')](_0x43e7('0xd'))[_0x43e7('0xe')]();}},'closedAt':{'type':Sequelize[_0x43e7('0xb')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x43e7('0xc')](_0x43e7('0xd'))[_0x43e7('0xe')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x43e7('0xf')))[_0x43e7('0xc')](_0x43e7('0xd'))[_0x43e7('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x43e7('0x10')))[_0x43e7('0xc')](_0x43e7('0xd'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c2597e8..87fdc33 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 _0xaa00=['where','filter','merge','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','sendStatus','status','end','count','offset','limit','set','json','save','update','then','destroy','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort'];(function(_0x51cefc,_0x27e236){var _0x44a4f5=function(_0x569232){while(--_0x569232){_0x51cefc['push'](_0x51cefc['shift']());}};_0x44a4f5(++_0x27e236);}(_0xaa00,0x1f4));var _0x0aa0=function(_0x3220ea,_0x32c573){_0x3220ea=_0x3220ea-0x0;var _0x447d35=_0xaa00[_0x3220ea];return _0x447d35;};'use strict';var pdf=require(_0x0aa0('0x0'));var emlformat=require(_0x0aa0('0x1'));var rimraf=require(_0x0aa0('0x2'));var zipdir=require(_0x0aa0('0x3'));var jsonpatch=require(_0x0aa0('0x4'));var rp=require(_0x0aa0('0x5'));var moment=require(_0x0aa0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0aa0('0x7'));var util=require(_0x0aa0('0x8'));var path=require(_0x0aa0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0aa0('0xa'));var fs=require('fs');var _=require(_0x0aa0('0xb'));var squel=require('squel');var crypto=require(_0x0aa0('0xc'));var jsforce=require(_0x0aa0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0aa0('0xe'));var querystring=require(_0x0aa0('0xf'));var Papa=require(_0x0aa0('0x10'));var Redis=require('ioredis');var authService=require(_0x0aa0('0x11'));var qs=require(_0x0aa0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0aa0('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b128c,_0x212af9){_0x212af9=_0x212af9||0xcc;return function(_0x258f86){if(_0x258f86){return _0x5b128c[_0x0aa0('0x14')](_0x212af9);}return _0x5b128c[_0x0aa0('0x15')](_0x212af9)[_0x0aa0('0x16')]();};}function respondWithResult(_0x43c814,_0x1d3ff5){_0x1d3ff5=_0x1d3ff5||0xc8;return function(_0x2745d7){if(_0x2745d7){return _0x43c814[_0x0aa0('0x15')](_0x1d3ff5)['json'](_0x2745d7);}};}function respondWithFilteredResult(_0x352db0,_0x40e408){return function(_0x4ef18e){if(_0x4ef18e){var _0x5c953f=_0x4ef18e[_0x0aa0('0x17')],_0x57ce4e=_0x40e408[_0x0aa0('0x18')],_0x5b482c=_0x40e408['offset']+_0x40e408[_0x0aa0('0x19')],_0x49e29e;if(_0x5b482c>=_0x5c953f){_0x5b482c=_0x5c953f;_0x49e29e=0xc8;}else{_0x49e29e=0xce;}_0x352db0['status'](_0x49e29e);return _0x352db0[_0x0aa0('0x1a')]('Content-Range',_0x57ce4e+'-'+_0x5b482c+'/'+_0x5c953f)[_0x0aa0('0x1b')](_0x4ef18e);}return null;};}function patchUpdates(_0x5b14a0){return function(_0x50a1f9){try{jsonpatch['apply'](_0x50a1f9,_0x5b14a0,!![]);}catch(_0x4413f4){return BPromise['reject'](_0x4413f4);}return _0x50a1f9[_0x0aa0('0x1c')]();};}function saveUpdates(_0x214114,_0x523387){return function(_0x1dd9bf){if(_0x1dd9bf){return _0x1dd9bf[_0x0aa0('0x1d')](_0x214114)[_0x0aa0('0x1e')](function(_0x304f0f){return _0x304f0f;});}return null;};}function removeEntity(_0x43c8e1,_0x978ef9){return function(_0x5401df){if(_0x5401df){return _0x5401df[_0x0aa0('0x1f')]()['then'](function(){_0x43c8e1[_0x0aa0('0x15')](0xcc)[_0x0aa0('0x16')]();});}};}function handleEntityNotFound(_0x506e92,_0xa47abe){return function(_0x411bb1){if(!_0x411bb1){_0x506e92[_0x0aa0('0x14')](0x194);}return _0x411bb1;};}function handleError(_0x397f64,_0x2fa37e){_0x2fa37e=_0x2fa37e||0x1f4;return function(_0x1ac9fe){logger['error'](_0x1ac9fe[_0x0aa0('0x20')]);if(_0x1ac9fe[_0x0aa0('0x21')]){delete _0x1ac9fe[_0x0aa0('0x21')];}_0x397f64['status'](_0x2fa37e)['send'](_0x1ac9fe);};}exports[_0x0aa0('0x22')]=function(_0x537d56,_0x55b8c9){var _0x27cae3={},_0x23b550={},_0x2a76ad={'count':0x0,'rows':[]};var _0xce7916=_[_0x0aa0('0x23')](db[_0x0aa0('0x24')][_0x0aa0('0x25')],function(_0x3c1cab){return{'name':_0x3c1cab[_0x0aa0('0x26')],'type':_0x3c1cab[_0x0aa0('0x27')][_0x0aa0('0x28')]};});_0x23b550[_0x0aa0('0x29')]=_[_0x0aa0('0x2a')](_[_0x0aa0('0x23')](_0xce7916,_0x0aa0('0x21')),['format']);_0x23b550['query']=_['keys'](_0x537d56['query']);_0x23b550[_0x0aa0('0x2b')]=_[_0x0aa0('0x2c')](_0x23b550[_0x0aa0('0x29')],_0x23b550['query']);_0x27cae3[_0x0aa0('0x2d')]=_[_0x0aa0('0x2c')](_0x23b550[_0x0aa0('0x29')],qs[_0x0aa0('0x2e')](_0x537d56[_0x0aa0('0x2f')][_0x0aa0('0x2e')]));_0x27cae3[_0x0aa0('0x2d')]=_0x27cae3[_0x0aa0('0x2d')][_0x0aa0('0x30')]?_0x27cae3[_0x0aa0('0x2d')]:_0x23b550[_0x0aa0('0x29')];if(!_0x537d56['query'][_0x0aa0('0x31')](_0x0aa0('0x32'))){_0x27cae3[_0x0aa0('0x19')]=qs['limit'](_0x537d56[_0x0aa0('0x2f')]['limit']);_0x27cae3[_0x0aa0('0x18')]=qs['offset'](_0x537d56['query'][_0x0aa0('0x18')]);}_0x27cae3['order']=qs['sort'](_0x537d56[_0x0aa0('0x2f')][_0x0aa0('0x33')]);_0x27cae3[_0x0aa0('0x34')]=qs[_0x0aa0('0x2b')](_['pick'](_0x537d56[_0x0aa0('0x2f')],_0x23b550['filters']),_0xce7916);if(_0x537d56['query'][_0x0aa0('0x35')]){_0x27cae3[_0x0aa0('0x34')]=_[_0x0aa0('0x36')](_0x27cae3['where'],{'$or':_['map'](_0xce7916,function(_0x257391){if(_0x257391[_0x0aa0('0x27')]!=='VIRTUAL'){var _0x5d4f6d={};_0x5d4f6d[_0x257391[_0x0aa0('0x21')]]={'$like':'%'+_0x537d56[_0x0aa0('0x2f')][_0x0aa0('0x35')]+'%'};return _0x5d4f6d;}})});}_0x27cae3=_[_0x0aa0('0x36')]({},_0x27cae3,_0x537d56['options']);var _0x487d4d={'where':_0x27cae3[_0x0aa0('0x34')]};return db[_0x0aa0('0x24')]['count'](_0x487d4d)[_0x0aa0('0x1e')](function(_0x4e5736){_0x2a76ad['count']=_0x4e5736;if(_0x537d56[_0x0aa0('0x2f')][_0x0aa0('0x37')]){_0x27cae3[_0x0aa0('0x38')]=[{'all':!![]}];}return db[_0x0aa0('0x24')][_0x0aa0('0x39')](_0x27cae3);})[_0x0aa0('0x1e')](function(_0x78f173){_0x2a76ad[_0x0aa0('0x3a')]=_0x78f173;return _0x2a76ad;})['then'](respondWithFilteredResult(_0x55b8c9,_0x27cae3))['catch'](handleError(_0x55b8c9,null));};exports[_0x0aa0('0x3b')]=function(_0x500ec9,_0x129e44){var _0xf4cc09={'raw':![],'where':{'id':_0x500ec9[_0x0aa0('0x3c')]['id']}},_0xaf0adc={};_0xaf0adc['model']=_[_0x0aa0('0x3d')](db[_0x0aa0('0x24')][_0x0aa0('0x25')]);_0xaf0adc[_0x0aa0('0x2f')]=_[_0x0aa0('0x3d')](_0x500ec9[_0x0aa0('0x2f')]);_0xaf0adc['filters']=_[_0x0aa0('0x2c')](_0xaf0adc[_0x0aa0('0x29')],_0xaf0adc[_0x0aa0('0x2f')]);_0xf4cc09[_0x0aa0('0x2d')]=_[_0x0aa0('0x2c')](_0xaf0adc[_0x0aa0('0x29')],qs['fields'](_0x500ec9[_0x0aa0('0x2f')]['fields']));_0xf4cc09[_0x0aa0('0x2d')]=_0xf4cc09['attributes'][_0x0aa0('0x30')]?_0xf4cc09[_0x0aa0('0x2d')]:_0xaf0adc['model'];if(_0x500ec9['query'][_0x0aa0('0x37')]){_0xf4cc09['include']=[{'all':!![]}];}_0xf4cc09=_['merge']({},_0xf4cc09,_0x500ec9['options']);return db[_0x0aa0('0x24')][_0x0aa0('0x3e')](_0xf4cc09)[_0x0aa0('0x1e')](handleEntityNotFound(_0x129e44,null))[_0x0aa0('0x1e')](respondWithResult(_0x129e44,null))[_0x0aa0('0x3f')](handleError(_0x129e44,null));};exports['create']=function(_0x52567c,_0x1396a9){return db[_0x0aa0('0x24')][_0x0aa0('0x40')](_0x52567c['body'],{})['then'](respondWithResult(_0x1396a9,0xc9))[_0x0aa0('0x3f')](handleError(_0x1396a9,null));};exports[_0x0aa0('0x1d')]=function(_0x2f55af,_0x3bc805){if(_0x2f55af[_0x0aa0('0x41')]['id']){delete _0x2f55af[_0x0aa0('0x41')]['id'];}delete _0x2f55af[_0x0aa0('0x41')]['duration'];delete _0x2f55af[_0x0aa0('0x41')][_0x0aa0('0x42')];delete _0x2f55af[_0x0aa0('0x41')][_0x0aa0('0x43')];delete _0x2f55af[_0x0aa0('0x41')][_0x0aa0('0x44')];return db[_0x0aa0('0x24')][_0x0aa0('0x3e')]({'where':{'id':_0x2f55af[_0x0aa0('0x3c')]['id']}})[_0x0aa0('0x1e')](handleEntityNotFound(_0x3bc805,null))[_0x0aa0('0x1e')](saveUpdates(_0x2f55af[_0x0aa0('0x41')],null))['then'](respondWithResult(_0x3bc805,null))[_0x0aa0('0x3f')](handleError(_0x3bc805,null));};exports[_0x0aa0('0x45')]=function(_0x410674,_0xb892ab){return db[_0x0aa0('0x24')][_0x0aa0('0x45')]()['then'](respondWithResult(_0xb892ab,null))[_0x0aa0('0x3f')](handleError(_0xb892ab,null));};exports[_0x0aa0('0x46')]=function(_0x1cb40b,_0x1e7909,_0x3e4b8d){var _0x4e717e=require(_0x0aa0('0x47'));var _0x540f62=![];var _0x204369={};if(_0x1cb40b[_0x0aa0('0x2f')][_0x0aa0('0x27')]&&_0x1cb40b['query'][_0x0aa0('0x27')]==='uniqueid'){_0x204369['uniqueid']=_0x1cb40b['params']['id'];}else{_0x204369['id']=_0x1cb40b[_0x0aa0('0x3c')]['id'];}return db[_0x0aa0('0x24')]['find']({'where':_0x204369,'attributes':['id',_0x0aa0('0x44')],'raw':!![]})['then'](handleEntityNotFound(_0x1e7909,null))['then'](function(_0x1c246e){if(_0x1c246e){var _0x186969=path[_0x0aa0('0x48')](config[_0x0aa0('0x49')],_0x0aa0('0x4a'),_0x1c246e[_0x0aa0('0x44')]);var _0x53ba27=util['format'](_0x0aa0('0x4b'),_0x186969);if(fs['existsSync'](_0x53ba27)){_0x540f62=!![];return _0x4e717e['decryptFile'](_0x53ba27,_0x186969,config[_0x0aa0('0x4c')][_0x0aa0('0x4d')])[_0x0aa0('0x1e')](function(){return _0x1c246e;});}return _0x1c246e;}})[_0x0aa0('0x1e')](function(_0x17cea6){if(_0x17cea6){var _0xf7c371=path[_0x0aa0('0x48')](config[_0x0aa0('0x49')],'server/files/screen_recordings',_0x17cea6[_0x0aa0('0x44')]);if(!fs[_0x0aa0('0x4e')](_0xf7c371)){throw new db['Sequelize'][(_0x0aa0('0x4f'))](_0x0aa0('0x50'));}if(_0x17cea6[_0x0aa0('0x51')]){return _0x1e7909[_0x0aa0('0x46')](_0xf7c371,_0x17cea6[_0x0aa0('0x51')]+path[_0x0aa0('0x52')](_0xf7c371),function(){if(_0x540f62){fs[_0x0aa0('0x53')](_0xf7c371);}});}else{return _0x1e7909[_0x0aa0('0x46')](_0xf7c371,function(_0x2813aa){if(_0x540f62){fs[_0x0aa0('0x53')](_0xf7c371);}});}}})[_0x0aa0('0x3f')](function(_0x3e18de){if(_0x3e18de[_0x0aa0('0x54')]==='ScreenRecording\x20not\x20found'){_0x1e7909['status'](0x194)[_0x0aa0('0x55')]('Not\x20found');}else{return handleError(_0x1e7909,null);}});};exports[_0x0aa0('0x1f')]=function(_0x43a37a,_0xdab2fe){return db[_0x0aa0('0x24')][_0x0aa0('0x3e')]({'where':{'id':_0x43a37a[_0x0aa0('0x3c')]['id']}})['then'](function(_0x49a22a){if(!_0x49a22a)throw new ReferenceError('Entity\x20not\x20found');return _0x49a22a;})[_0x0aa0('0x1e')](function(_0x53be1d){var _0x2289b6=path['join'](config[_0x0aa0('0x49')],_0x0aa0('0x4a'),_0x53be1d[_0x0aa0('0x44')]);logger[_0x0aa0('0x56')]('cancellazione\x20fisica\x20documento\x20%s',_0x2289b6);if(!_[_0x0aa0('0x57')](_0x53be1d[_0x0aa0('0x44')])&&fs[_0x0aa0('0x4e')](_0x2289b6)){logger[_0x0aa0('0x56')]('File:\x20\x22'+_0x2289b6+_0x0aa0('0x58'));fs[_0x0aa0('0x59')](_0x2289b6);}_0x2289b6=_0x2289b6+_0x0aa0('0x5a');if(!_[_0x0aa0('0x57')](_0x53be1d[_0x0aa0('0x44')])&&fs[_0x0aa0('0x4e')](_0x2289b6)){logger[_0x0aa0('0x56')](_0x0aa0('0x5b')+_0x2289b6+_0x0aa0('0x58'));fs[_0x0aa0('0x59')](_0x2289b6);}return _0x53be1d;})[_0x0aa0('0x1e')](function(_0x4db6cd){if(!_0x4db6cd)throw new InternalError();return _0x4db6cd[_0x0aa0('0x1f')]();})[_0x0aa0('0x1e')](function(){_0xdab2fe[_0x0aa0('0x15')](0xcc)[_0x0aa0('0x16')]();})['catch'](handleError(_0xdab2fe,null));}; \ No newline at end of file +var _0x446d=['isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','existsSync','info','File:\x20\x22','.cypher'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0x446d,0x126));var _0xd446=function(_0xcb48ca,_0x540ecb){_0xcb48ca=_0xcb48ca-0x0;var _0x37be10=_0x446d[_0xcb48ca];return _0x37be10;};'use strict';var pdf=require(_0xd446('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd446('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd446('0x2'));var rp=require(_0xd446('0x3'));var moment=require('moment');var BPromise=require(_0xd446('0x4'));var Mustache=require('mustache');var util=require(_0xd446('0x5'));var path=require(_0xd446('0x6'));var sox=require(_0xd446('0x7'));var csv=require(_0xd446('0x8'));var ejs=require(_0xd446('0x9'));var fs=require('fs');var _=require(_0xd446('0xa'));var squel=require(_0xd446('0xb'));var crypto=require('crypto');var jsforce=require(_0xd446('0xc'));var deskjs=require(_0xd446('0xd'));var toCsv=require(_0xd446('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd446('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd446('0xf'));var hardwareService=require(_0xd446('0x10'));var logger=require('../../config/logger')(_0xd446('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12fcec,_0x3fae22){_0x3fae22=_0x3fae22||0xcc;return function(_0x5d5e74){if(_0x5d5e74){return _0x12fcec[_0xd446('0x12')](_0x3fae22);}return _0x12fcec[_0xd446('0x13')](_0x3fae22)[_0xd446('0x14')]();};}function respondWithResult(_0x261443,_0x31d0c6){_0x31d0c6=_0x31d0c6||0xc8;return function(_0x42b388){if(_0x42b388){return _0x261443[_0xd446('0x13')](_0x31d0c6)[_0xd446('0x15')](_0x42b388);}};}function respondWithFilteredResult(_0x1b605e,_0x36483b){return function(_0x574e52){if(_0x574e52){var _0x56fbcb=_0x574e52[_0xd446('0x16')],_0x2ffbfd=_0x36483b['offset'],_0x53a76f=_0x36483b[_0xd446('0x17')]+_0x36483b[_0xd446('0x18')],_0x3dd24f;if(_0x53a76f>=_0x56fbcb){_0x53a76f=_0x56fbcb;_0x3dd24f=0xc8;}else{_0x3dd24f=0xce;}_0x1b605e[_0xd446('0x13')](_0x3dd24f);return _0x1b605e[_0xd446('0x19')]('Content-Range',_0x2ffbfd+'-'+_0x53a76f+'/'+_0x56fbcb)[_0xd446('0x15')](_0x574e52);}return null;};}function patchUpdates(_0x163cb3){return function(_0x41d301){try{jsonpatch['apply'](_0x41d301,_0x163cb3,!![]);}catch(_0x563423){return BPromise[_0xd446('0x1a')](_0x563423);}return _0x41d301['save']();};}function saveUpdates(_0x365d34,_0xc6b80d){return function(_0x494b20){if(_0x494b20){return _0x494b20[_0xd446('0x1b')](_0x365d34)[_0xd446('0x1c')](function(_0x5e0d1f){return _0x5e0d1f;});}return null;};}function removeEntity(_0x4171bf,_0x2cbdb0){return function(_0x3e1243){if(_0x3e1243){return _0x3e1243[_0xd446('0x1d')]()[_0xd446('0x1c')](function(){_0x4171bf[_0xd446('0x13')](0xcc)[_0xd446('0x14')]();});}};}function handleEntityNotFound(_0x3f96c8,_0x544e61){return function(_0x610c93){if(!_0x610c93){_0x3f96c8[_0xd446('0x12')](0x194);}return _0x610c93;};}function handleError(_0x3f775f,_0x157cde){_0x157cde=_0x157cde||0x1f4;return function(_0x4ee2c9){logger[_0xd446('0x1e')](_0x4ee2c9[_0xd446('0x1f')]);if(_0x4ee2c9[_0xd446('0x20')]){delete _0x4ee2c9[_0xd446('0x20')];}_0x3f775f[_0xd446('0x13')](_0x157cde)[_0xd446('0x21')](_0x4ee2c9);};}exports[_0xd446('0x22')]=function(_0x48e40d,_0x5a9ce6){var _0x3ac3c7={},_0xb43acf={},_0x5c84de={'count':0x0,'rows':[]};var _0x1f1287=_[_0xd446('0x23')](db[_0xd446('0x24')][_0xd446('0x25')],function(_0xec95cc){return{'name':_0xec95cc[_0xd446('0x26')],'type':_0xec95cc['type'][_0xd446('0x27')]};});_0xb43acf[_0xd446('0x28')]=_[_0xd446('0x29')](_['map'](_0x1f1287,'name'),[_0xd446('0x2a')]);_0xb43acf[_0xd446('0x2b')]=_['keys'](_0x48e40d[_0xd446('0x2b')]);_0xb43acf[_0xd446('0x2c')]=_[_0xd446('0x2d')](_0xb43acf['model'],_0xb43acf[_0xd446('0x2b')]);_0x3ac3c7['attributes']=_[_0xd446('0x2d')](_0xb43acf[_0xd446('0x28')],qs[_0xd446('0x2e')](_0x48e40d[_0xd446('0x2b')]['fields']));_0x3ac3c7[_0xd446('0x2f')]=_0x3ac3c7[_0xd446('0x2f')]['length']?_0x3ac3c7[_0xd446('0x2f')]:_0xb43acf[_0xd446('0x28')];if(!_0x48e40d[_0xd446('0x2b')]['hasOwnProperty'](_0xd446('0x30'))){_0x3ac3c7[_0xd446('0x18')]=qs[_0xd446('0x18')](_0x48e40d['query']['limit']);_0x3ac3c7[_0xd446('0x17')]=qs[_0xd446('0x17')](_0x48e40d[_0xd446('0x2b')]['offset']);}_0x3ac3c7[_0xd446('0x31')]=qs[_0xd446('0x32')](_0x48e40d[_0xd446('0x2b')][_0xd446('0x32')]);_0x3ac3c7[_0xd446('0x33')]=qs[_0xd446('0x2c')](_[_0xd446('0x34')](_0x48e40d[_0xd446('0x2b')],_0xb43acf[_0xd446('0x2c')]),_0x1f1287);if(_0x48e40d[_0xd446('0x2b')][_0xd446('0x35')]){_0x3ac3c7[_0xd446('0x33')]=_[_0xd446('0x36')](_0x3ac3c7['where'],{'$or':_['map'](_0x1f1287,function(_0x4c56d4){if(_0x4c56d4[_0xd446('0x37')]!==_0xd446('0x38')){var _0x2130c2={};_0x2130c2[_0x4c56d4[_0xd446('0x20')]]={'$like':'%'+_0x48e40d[_0xd446('0x2b')][_0xd446('0x35')]+'%'};return _0x2130c2;}})});}_0x3ac3c7=_[_0xd446('0x36')]({},_0x3ac3c7,_0x48e40d[_0xd446('0x39')]);var _0xc6fec7={'where':_0x3ac3c7[_0xd446('0x33')]};return db[_0xd446('0x24')][_0xd446('0x16')](_0xc6fec7)['then'](function(_0x4cba15){_0x5c84de[_0xd446('0x16')]=_0x4cba15;if(_0x48e40d[_0xd446('0x2b')][_0xd446('0x3a')]){_0x3ac3c7[_0xd446('0x3b')]=[{'all':!![]}];}return db['ScreenRecording'][_0xd446('0x3c')](_0x3ac3c7);})['then'](function(_0x23a5ef){_0x5c84de[_0xd446('0x3d')]=_0x23a5ef;return _0x5c84de;})[_0xd446('0x1c')](respondWithFilteredResult(_0x5a9ce6,_0x3ac3c7))[_0xd446('0x3e')](handleError(_0x5a9ce6,null));};exports[_0xd446('0x3f')]=function(_0x3667d3,_0x280265){var _0x5ce5da={'raw':![],'where':{'id':_0x3667d3[_0xd446('0x40')]['id']}},_0x2714f0={};_0x2714f0['model']=_['keys'](db[_0xd446('0x24')][_0xd446('0x25')]);_0x2714f0[_0xd446('0x2b')]=_[_0xd446('0x41')](_0x3667d3[_0xd446('0x2b')]);_0x2714f0[_0xd446('0x2c')]=_[_0xd446('0x2d')](_0x2714f0[_0xd446('0x28')],_0x2714f0[_0xd446('0x2b')]);_0x5ce5da[_0xd446('0x2f')]=_['intersection'](_0x2714f0[_0xd446('0x28')],qs[_0xd446('0x2e')](_0x3667d3['query'][_0xd446('0x2e')]));_0x5ce5da[_0xd446('0x2f')]=_0x5ce5da[_0xd446('0x2f')][_0xd446('0x42')]?_0x5ce5da[_0xd446('0x2f')]:_0x2714f0[_0xd446('0x28')];if(_0x3667d3[_0xd446('0x2b')]['includeAll']){_0x5ce5da[_0xd446('0x3b')]=[{'all':!![]}];}_0x5ce5da=_['merge']({},_0x5ce5da,_0x3667d3[_0xd446('0x39')]);return db[_0xd446('0x24')][_0xd446('0x43')](_0x5ce5da)['then'](handleEntityNotFound(_0x280265,null))[_0xd446('0x1c')](respondWithResult(_0x280265,null))[_0xd446('0x3e')](handleError(_0x280265,null));};exports[_0xd446('0x44')]=function(_0x3e4d08,_0x3fd1ac){return db[_0xd446('0x24')][_0xd446('0x44')](_0x3e4d08['body'],{})[_0xd446('0x1c')](respondWithResult(_0x3fd1ac,0xc9))[_0xd446('0x3e')](handleError(_0x3fd1ac,null));};exports[_0xd446('0x1b')]=function(_0x49e001,_0x4d0da3){if(_0x49e001[_0xd446('0x45')]['id']){delete _0x49e001['body']['id'];}delete _0x49e001[_0xd446('0x45')]['duration'];delete _0x49e001[_0xd446('0x45')]['createdAt'];delete _0x49e001[_0xd446('0x45')][_0xd446('0x46')];delete _0x49e001['body'][_0xd446('0x47')];return db[_0xd446('0x24')][_0xd446('0x43')]({'where':{'id':_0x49e001[_0xd446('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d0da3,null))['then'](saveUpdates(_0x49e001['body'],null))[_0xd446('0x1c')](respondWithResult(_0x4d0da3,null))['catch'](handleError(_0x4d0da3,null));};exports[_0xd446('0x48')]=function(_0x525a1f,_0x4b1296){return db['ScreenRecording'][_0xd446('0x48')]()['then'](respondWithResult(_0x4b1296,null))[_0xd446('0x3e')](handleError(_0x4b1296,null));};exports[_0xd446('0x49')]=function(_0x31b24d,_0x58e951,_0x123419){var _0x43f770=require(_0xd446('0x4a'));var _0x24a110=![];var _0x298c48={};if(_0x31b24d[_0xd446('0x2b')][_0xd446('0x37')]&&_0x31b24d[_0xd446('0x2b')]['type']==='uniqueid'){_0x298c48['uniqueid']=_0x31b24d[_0xd446('0x40')]['id'];}else{_0x298c48['id']=_0x31b24d[_0xd446('0x40')]['id'];}return db[_0xd446('0x24')][_0xd446('0x43')]({'where':_0x298c48,'attributes':['id','value'],'raw':!![]})[_0xd446('0x1c')](handleEntityNotFound(_0x58e951,null))[_0xd446('0x1c')](function(_0x3f19d1){if(_0x3f19d1){var _0x19abd4=path[_0xd446('0x4b')](config[_0xd446('0x4c')],_0xd446('0x4d'),_0x3f19d1[_0xd446('0x47')]);var _0x5ee448=util[_0xd446('0x2a')](_0xd446('0x4e'),_0x19abd4);if(fs['existsSync'](_0x5ee448)){_0x24a110=!![];return _0x43f770[_0xd446('0x4f')](_0x5ee448,_0x19abd4,config[_0xd446('0x50')]['recording'])[_0xd446('0x1c')](function(){return _0x3f19d1;});}return _0x3f19d1;}})[_0xd446('0x1c')](function(_0x7a88b5){if(_0x7a88b5){var _0x259130=path[_0xd446('0x4b')](config[_0xd446('0x4c')],_0xd446('0x4d'),_0x7a88b5[_0xd446('0x47')]);if(!fs['existsSync'](_0x259130)){throw new db[(_0xd446('0x51'))][(_0xd446('0x52'))]('ScreenRecording\x20not\x20found');}if(_0x7a88b5[_0xd446('0x53')]){return _0x58e951[_0xd446('0x49')](_0x259130,_0x7a88b5[_0xd446('0x53')]+path[_0xd446('0x54')](_0x259130),function(){if(_0x24a110){fs[_0xd446('0x55')](_0x259130);}});}else{return _0x58e951['download'](_0x259130,function(_0x555489){if(_0x24a110){fs['unlink'](_0x259130);}});}}})['catch'](function(_0x1114a5){if(_0x1114a5[_0xd446('0x56')]===_0xd446('0x57')){_0x58e951['status'](0x194)['send'](_0xd446('0x58'));}else{return handleError(_0x58e951,null);}});};exports[_0xd446('0x1d')]=function(_0x3ca0eb,_0x39c837){return db['ScreenRecording'][_0xd446('0x43')]({'where':{'id':_0x3ca0eb[_0xd446('0x40')]['id']}})['then'](function(_0xb8569f){if(!_0xb8569f)throw new ReferenceError('Entity\x20not\x20found');return _0xb8569f;})[_0xd446('0x1c')](function(_0xa72302){var _0x14829e=path[_0xd446('0x4b')](config[_0xd446('0x4c')],_0xd446('0x4d'),_0xa72302[_0xd446('0x47')]);logger['info'](_0xd446('0x59'),_0x14829e);if(!_['isNil'](_0xa72302[_0xd446('0x47')])&&fs[_0xd446('0x5a')](_0x14829e)){logger[_0xd446('0x5b')](_0xd446('0x5c')+_0x14829e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x14829e);}_0x14829e=_0x14829e+_0xd446('0x5d');if(!_[_0xd446('0x5e')](_0xa72302['value'])&&fs[_0xd446('0x5a')](_0x14829e)){logger[_0xd446('0x5b')](_0xd446('0x5c')+_0x14829e+_0xd446('0x5f'));fs[_0xd446('0x60')](_0x14829e);}return _0xa72302;})[_0xd446('0x1c')](function(_0x306fd2){if(!_0x306fd2)throw new InternalError();return _0x306fd2[_0xd446('0x1d')]();})[_0xd446('0x1c')](function(){_0x39c837[_0xd446('0x13')](0xcc)[_0xd446('0x14')]();})[_0xd446('0x3e')](handleError(_0x39c837,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3ccd2f3..8b66ed2 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 _0x38c9=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','moment','request-promise','path','../../config/environment','./screenRecording.attributes','exports'];(function(_0x48497f,_0x5a901f){var _0x440c1d=function(_0x5e5f7d){while(--_0x5e5f7d){_0x48497f['push'](_0x48497f['shift']());}};_0x440c1d(++_0x5a901f);}(_0x38c9,0x64));var _0x938c=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x38c9[_0x36bf88];return _0x332914;};'use strict';var _=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x938c('0x2'));var BPromise=require('bluebird');var rp=require(_0x938c('0x3'));var fs=require('fs');var path=require(_0x938c('0x4'));var rimraf=require('rimraf');var config=require(_0x938c('0x5'));var attributes=require(_0x938c('0x6'));module[_0x938c('0x7')]=function(_0x3a9654,_0x2cd56e){return _0x3a9654[_0x938c('0x8')](_0x938c('0x9'),attributes,{'tableName':_0x938c('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x938c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb03e=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment'];(function(_0x7d1b89,_0x58faa5){var _0x435a5b=function(_0x358473){while(--_0x358473){_0x7d1b89['push'](_0x7d1b89['shift']());}};_0x435a5b(++_0x58faa5);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1e2334,_0x2967e5){_0x1e2334=_0x1e2334-0x0;var _0x465420=_0xb03e[_0x1e2334];return _0x465420;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[{'name':_0xeb03('0xe'),'fields':[_0xeb03('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a980d1f..b35be4b 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(_0x32470f,_0x1c8d19){var _0x3db4cc=function(_0x263a4e){while(--_0x263a4e){_0x32470f['push'](_0x32470f['shift']());}};_0x3db4cc(++_0x1c8d19);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x80f018,_0x2aab0c){var _0x4e113a=function(_0x1999ab){while(--_0x1999ab){_0x80f018['push'](_0x80f018['shift']());}};_0x4e113a(++_0x2aab0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4443075..5c093e9 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 _0x56d5=['addLogoLogin','preferred','/:id/preferred','file','addPreferred','addFavicon','put','/:id','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','show','getLogo','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','diskStorage','join','root','format','logo','originalname','/:id/logo','single','server/files/images/logos/','%s%s','post','/:id/logo_login'];(function(_0x28f35,_0x327f7b){var _0x53cc46=function(_0x3bc9ea){while(--_0x3bc9ea){_0x28f35['push'](_0x28f35['shift']());}};_0x53cc46(++_0x327f7b);}(_0x56d5,0xd7));var _0x556d=function(_0x43e9b3,_0x5acc9e){_0x43e9b3=_0x43e9b3-0x0;var _0x48fb7f=_0x56d5[_0x43e9b3];return _0x48fb7f;};'use strict';var multer=require(_0x556d('0x0'));var util=require(_0x556d('0x1'));var path=require('path');var timeout=require(_0x556d('0x2'));var express=require(_0x556d('0x3'));var router=express[_0x556d('0x4')]();var auth=require(_0x556d('0x5'));var interaction=require(_0x556d('0x6'));var config=require(_0x556d('0x7'));var controller=require(_0x556d('0x8'));router[_0x556d('0x9')]('/',auth[_0x556d('0xa')](),controller[_0x556d('0xb')]);router[_0x556d('0x9')]('/:id',controller[_0x556d('0xc')]);router[_0x556d('0x9')]('/:id/logo',controller[_0x556d('0xd')]);router[_0x556d('0x9')]('/:id/logo_login',controller[_0x556d('0xe')]);router[_0x556d('0x9')](_0x556d('0xf'),controller[_0x556d('0x10')]);router['get']('/:id/preferred',controller[_0x556d('0x11')]);router[_0x556d('0x9')](_0x556d('0x12'),controller['getFavicon']);var upload=multer({'storage':multer[_0x556d('0x13')]({'destination':function(_0x1426ad,_0x5ce558,_0xbdf9da){_0xbdf9da(null,path[_0x556d('0x14')](config[_0x556d('0x15')],'server/files/images/logos/'));},'filename':function(_0x1c27df,_0x9e4542,_0x4e9cd9){_0x4e9cd9(null,util[_0x556d('0x16')]('%s%s',_0x556d('0x17'),path['extname'](_0x9e4542[_0x556d('0x18')])));}})});router['post'](_0x556d('0x19'),upload[_0x556d('0x1a')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x556d('0x13')]({'destination':function(_0x4b9841,_0x42b8e7,_0x22fb1a){_0x22fb1a(null,path['join'](config[_0x556d('0x15')],_0x556d('0x1b')));},'filename':function(_0x573ee0,_0xe6abbe,_0x3eb2dd){_0x3eb2dd(null,util[_0x556d('0x16')](_0x556d('0x1c'),'logologin',path['extname'](_0xe6abbe[_0x556d('0x18')])));}})});router[_0x556d('0x1d')](_0x556d('0x1e'),upload['single']('file'),controller[_0x556d('0x1f')]);var upload=multer({'storage':multer[_0x556d('0x13')]({'destination':function(_0x3b8c7c,_0x570781,_0x5dbe23){_0x5dbe23(null,path[_0x556d('0x14')](config[_0x556d('0x15')],_0x556d('0x1b')));},'filename':function(_0x4436e1,_0x38c9f4,_0x2696c1){_0x2696c1(null,util[_0x556d('0x16')]('%s%s',_0x556d('0x20'),path['extname'](_0x38c9f4[_0x556d('0x18')])));}})});router[_0x556d('0x1d')](_0x556d('0x21'),upload['single'](_0x556d('0x22')),controller[_0x556d('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xbec702,_0x36fbac,_0x443a6d){_0x443a6d(null,path['join'](config[_0x556d('0x15')],_0x556d('0x1b')));},'filename':function(_0x1cc301,_0x2a772c,_0x5f5587){_0x5f5587(null,util[_0x556d('0x16')]('%s%s','favicon',path['extname'](_0x2a772c[_0x556d('0x18')])));}})});router['post'](_0x556d('0x12'),upload[_0x556d('0x1a')](_0x556d('0x22')),controller[_0x556d('0x24')]);router[_0x556d('0x25')](_0x556d('0x26'),auth['isAuthenticated'](),controller[_0x556d('0x27')]);module[_0x556d('0x28')]=router; \ No newline at end of file +var _0xf549=['post','/:id/logo','single','file','addLogo','diskStorage','join','root','server/files/images/logos/','logologin','addLogoLogin','preferred','extname','addPreferred','favicon','addFavicon','/:id','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','format','%s%s','originalname'];(function(_0x4f53dc,_0x297f6a){var _0x1e8e9b=function(_0x337c3b){while(--_0x337c3b){_0x4f53dc['push'](_0x4f53dc['shift']());}};_0x1e8e9b(++_0x297f6a);}(_0xf549,0x1cf));var _0x9f54=function(_0xe1dbe4,_0x470e9d){_0xe1dbe4=_0xe1dbe4-0x0;var _0x547d48=_0xf549[_0xe1dbe4];return _0x547d48;};'use strict';var multer=require('multer');var util=require(_0x9f54('0x0'));var path=require(_0x9f54('0x1'));var timeout=require(_0x9f54('0x2'));var express=require(_0x9f54('0x3'));var router=express[_0x9f54('0x4')]();var auth=require(_0x9f54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f54('0x6'));var controller=require(_0x9f54('0x7'));router[_0x9f54('0x8')]('/',auth[_0x9f54('0x9')](),controller[_0x9f54('0xa')]);router['get']('/:id',controller['show']);router[_0x9f54('0x8')]('/:id/logo',controller['getLogo']);router[_0x9f54('0x8')](_0x9f54('0xb'),controller[_0x9f54('0xc')]);router[_0x9f54('0x8')](_0x9f54('0xd'),controller['gdpr']);router[_0x9f54('0x8')](_0x9f54('0xe'),controller['getPreferred']);router[_0x9f54('0x8')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb0c69c,_0x3e2eda,_0x15b387){_0x15b387(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x3f7ec8,_0x5b6447,_0x18886c){_0x18886c(null,util[_0x9f54('0xf')](_0x9f54('0x10'),'logo',path['extname'](_0x5b6447[_0x9f54('0x11')])));}})});router[_0x9f54('0x12')](_0x9f54('0x13'),upload[_0x9f54('0x14')](_0x9f54('0x15')),controller[_0x9f54('0x16')]);var upload=multer({'storage':multer[_0x9f54('0x17')]({'destination':function(_0x5a2c5a,_0x156b25,_0x21814b){_0x21814b(null,path[_0x9f54('0x18')](config[_0x9f54('0x19')],_0x9f54('0x1a')));},'filename':function(_0x5f135b,_0x283399,_0x4cbe00){_0x4cbe00(null,util[_0x9f54('0xf')](_0x9f54('0x10'),_0x9f54('0x1b'),path['extname'](_0x283399['originalname'])));}})});router[_0x9f54('0x12')]('/:id/logo_login',upload[_0x9f54('0x14')]('file'),controller[_0x9f54('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19f6d4,_0xa27799,_0x515347){_0x515347(null,path[_0x9f54('0x18')](config[_0x9f54('0x19')],_0x9f54('0x1a')));},'filename':function(_0x10ffd6,_0x1616ad,_0x3b35d3){_0x3b35d3(null,util[_0x9f54('0xf')]('%s%s',_0x9f54('0x1d'),path[_0x9f54('0x1e')](_0x1616ad[_0x9f54('0x11')])));}})});router[_0x9f54('0x12')](_0x9f54('0xe'),upload[_0x9f54('0x14')](_0x9f54('0x15')),controller[_0x9f54('0x1f')]);var upload=multer({'storage':multer[_0x9f54('0x17')]({'destination':function(_0x3043c8,_0x59502d,_0x4cc62e){_0x4cc62e(null,path[_0x9f54('0x18')](config[_0x9f54('0x19')],'server/files/images/logos/'));},'filename':function(_0x13ec03,_0x15e8c2,_0x37277d){_0x37277d(null,util['format'](_0x9f54('0x10'),_0x9f54('0x20'),path[_0x9f54('0x1e')](_0x15e8c2[_0x9f54('0x11')])));}})});router['post']('/:id/favicon',upload[_0x9f54('0x14')](_0x9f54('0x15')),controller[_0x9f54('0x21')]);router['put'](_0x9f54('0x22'),auth[_0x9f54('0x9')](),controller[_0x9f54('0x23')]);module[_0x9f54('0x24')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 1e9ac88..1fad84b 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 _0x6e24=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x2a426a,_0x3b308d){var _0xfa9fd7=function(_0x1e0666){while(--_0x1e0666){_0x2a426a['push'](_0x2a426a['shift']());}};_0xfa9fd7(++_0x3b308d);}(_0x6e24,0xcb));var _0x46e2=function(_0x4dd310,_0xbb1a15){_0x4dd310=_0x4dd310-0x0;var _0x1d98ed=_0x6e24[_0x4dd310];return _0x1d98ed;};'use strict';var Sequelize=require('sequelize');module[_0x46e2('0x0')]={'min_internal':{'type':Sequelize[_0x46e2('0x1')](0xb),'unique':_0x46e2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x46e2('0x1')](0xb),'unique':_0x46e2('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x46e2('0x4')],'defaultValue':_0x46e2('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x46e2('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x46e2('0x4')]},'pageTitle':{'type':Sequelize[_0x46e2('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x46e2('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x46e2('0x4')],'defaultValue':_0x46e2('0x7')},'enableEmailPreview':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x46e2('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x46e2('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x46e2('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x46e2('0x4')]},'defaultFavicon':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x46e2('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x46e2('0x1')]},'transcribeRegion':{'type':Sequelize[_0x46e2('0x4')]},'sentiment':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x46e2('0x4')]},'language':{'type':Sequelize[_0x46e2('0x4')]},'bucket':{'type':Sequelize[_0x46e2('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe415=['INTEGER','min_mailbox','STRING','BOOLEAN','sequelize','exports','min_internal'];(function(_0x53b1ab,_0x10af71){var _0x778622=function(_0x21a727){while(--_0x21a727){_0x53b1ab['push'](_0x53b1ab['shift']());}};_0x778622(++_0x10af71);}(_0xe415,0x107));var _0x5e41=function(_0x30b768,_0x5ea605){_0x30b768=_0x30b768-0x0;var _0x53cba3=_0xe415[_0x30b768];return _0x53cba3;};'use strict';var Sequelize=require(_0x5e41('0x0'));module[_0x5e41('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5e41('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5e41('0x3')](0xb),'unique':_0x5e41('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x5e41('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5e41('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x5e41('0x5')]},'defaultLogo':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5e41('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5e41('0x5')]},'turnaddr':{'type':Sequelize[_0x5e41('0x5')]},'turnusername':{'type':Sequelize[_0x5e41('0x5')]},'turnpassword':{'type':Sequelize[_0x5e41('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5e41('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5e41('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5e41('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5e41('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5e41('0x3')]},'transcribeRegion':{'type':Sequelize[_0x5e41('0x5')]},'sentiment':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5e41('0x3')]},'sentimentRegion':{'type':Sequelize[_0x5e41('0x5')]},'language':{'type':Sequelize[_0x5e41('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 3167eac..487636f 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 _0x6a5e=['toLower','join','default_logo.svg','default','custom','existsSync','upperFirst','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','options','Setting','includeAll','include','findAll','rows','show','params','fields','merge','find','body','addLogo','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','root'];(function(_0x3826c3,_0x4781b9){var _0x5d9d6d=function(_0x202119){while(--_0x202119){_0x3826c3['push'](_0x3826c3['shift']());}};_0x5d9d6d(++_0x4781b9);}(_0x6a5e,0x174));var _0xe6a5=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6a5e[_0x4154a6];return _0x3b2786;};'use strict';var pdf=require(_0xe6a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe6a5('0x1'));var zipdir=require(_0xe6a5('0x2'));var jsonpatch=require(_0xe6a5('0x3'));var rp=require(_0xe6a5('0x4'));var moment=require('moment');var BPromise=require(_0xe6a5('0x5'));var Mustache=require(_0xe6a5('0x6'));var util=require(_0xe6a5('0x7'));var path=require('path');var sox=require(_0xe6a5('0x8'));var csv=require(_0xe6a5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe6a5('0xa'));var squel=require(_0xe6a5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe6a5('0xc'));var toCsv=require(_0xe6a5('0x9'));var querystring=require(_0xe6a5('0xd'));var Papa=require(_0xe6a5('0xe'));var Redis=require(_0xe6a5('0xf'));var authService=require(_0xe6a5('0x10'));var qs=require(_0xe6a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6a5('0x12'))(_0xe6a5('0x13'));var utils=require('../../config/utils');var config=require(_0xe6a5('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe6a5('0x15'));var client=jayson[_0xe6a5('0x16')][_0xe6a5('0x17')]({'port':0x232a});function checkPasswordPattern(_0x33ad6d,_0x4f6c22,_0x13be51){if(_0x13be51){var _0x53bd6e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53bd6e[_0xe6a5('0x18')](_0x4f6c22)){return _0x33ad6d;}else{throw new db[(_0xe6a5('0x19'))][(_0xe6a5('0x1a'))](_0xe6a5('0x1b'));}}else{return _0x33ad6d;}}function respondWithRpcPromise(_0x2f6f2a,_0x177ee2,_0x720425,_0x3dcdea){return new BPromise(function(_0x55b825,_0xc6f2d3){var _0x16630a=_0x3dcdea||client;return _0x16630a[_0xe6a5('0x1c')](_0x2f6f2a,_0x720425)[_0xe6a5('0x1d')](function(_0x5abc7d){logger['info']('Setting,\x20%s,\x20%s',_0x177ee2,_0xe6a5('0x1e'));logger['debug'](_0xe6a5('0x1f'),_0x177ee2,_0xe6a5('0x1e'),JSON[_0xe6a5('0x20')](_0x5abc7d));if(_0x5abc7d[_0xe6a5('0x21')]){if(_0x5abc7d[_0xe6a5('0x21')][_0xe6a5('0x22')]===0x1f4){logger[_0xe6a5('0x21')](_0xe6a5('0x23'),_0x177ee2,_0x5abc7d[_0xe6a5('0x21')][_0xe6a5('0x24')]);return _0xc6f2d3(_0x5abc7d['error'][_0xe6a5('0x24')]);}logger[_0xe6a5('0x21')](_0xe6a5('0x23'),_0x177ee2,_0x5abc7d[_0xe6a5('0x21')][_0xe6a5('0x24')]);return _0x55b825(_0x5abc7d['error'][_0xe6a5('0x24')]);}else{logger[_0xe6a5('0x25')]('Setting,\x20%s,\x20%s',_0x177ee2,_0xe6a5('0x1e'));_0x55b825(_0x5abc7d[_0xe6a5('0x26')][_0xe6a5('0x24')]);}})[_0xe6a5('0x27')](function(_0x2eaa23){logger['error'](_0xe6a5('0x23'),_0x177ee2,_0x2eaa23);_0xc6f2d3(_0x2eaa23);});});}function respondWithStatusCode(_0x4e9377,_0x5e4bf2){_0x5e4bf2=_0x5e4bf2||0xcc;return function(_0x264a89){if(_0x264a89){return _0x4e9377[_0xe6a5('0x28')](_0x5e4bf2);}return _0x4e9377[_0xe6a5('0x29')](_0x5e4bf2)[_0xe6a5('0x2a')]();};}function respondWithResult(_0x488f5e,_0x1c9fa7){_0x1c9fa7=_0x1c9fa7||0xc8;return function(_0x2df86c){if(_0x2df86c){return _0x488f5e[_0xe6a5('0x29')](_0x1c9fa7)[_0xe6a5('0x2b')](_0x2df86c);}};}function respondWithFilteredResult(_0xbf0424,_0x848c96){return function(_0x4af71c){if(_0x4af71c){var _0x57d908=_0x4af71c[_0xe6a5('0x2c')],_0x46a718=_0x848c96[_0xe6a5('0x2d')],_0x7324ca=_0x848c96[_0xe6a5('0x2d')]+_0x848c96['limit'],_0x184b39;if(_0x7324ca>=_0x57d908){_0x7324ca=_0x57d908;_0x184b39=0xc8;}else{_0x184b39=0xce;}_0xbf0424[_0xe6a5('0x29')](_0x184b39);return _0xbf0424['set'](_0xe6a5('0x2e'),_0x46a718+'-'+_0x7324ca+'/'+_0x57d908)[_0xe6a5('0x2b')](_0x4af71c);}return null;};}function patchUpdates(_0x2f197f){return function(_0x54f09e){try{jsonpatch[_0xe6a5('0x2f')](_0x54f09e,_0x2f197f,!![]);}catch(_0x27742c){return BPromise[_0xe6a5('0x30')](_0x27742c);}return _0x54f09e['save']();};}function saveUpdates(_0x10a045,_0x4c9003){return function(_0x30ec73){if(_0x30ec73){return _0x30ec73[_0xe6a5('0x31')](_0x10a045)['then'](function(_0x3789ae){return _0x3789ae;});}return null;};}function removeEntity(_0x3bd275,_0x5c6056){return function(_0x276de9){if(_0x276de9){return _0x276de9[_0xe6a5('0x32')]()[_0xe6a5('0x1d')](function(){_0x3bd275['status'](0xcc)[_0xe6a5('0x2a')]();});}};}function handleEntityNotFound(_0x414823,_0x30ef4b){return function(_0x158e87){if(!_0x158e87){_0x414823[_0xe6a5('0x28')](0x194);}return _0x158e87;};}function handleError(_0x4e768d,_0xa4b58f){_0xa4b58f=_0xa4b58f||0x1f4;return function(_0x280727){logger['error'](_0x280727[_0xe6a5('0x33')]);if(_0x280727[_0xe6a5('0x34')]){delete _0x280727['name'];}_0x4e768d[_0xe6a5('0x29')](_0xa4b58f)[_0xe6a5('0x35')](_0x280727);};}exports[_0xe6a5('0x36')]=function(_0x4f75e0,_0x337a37){var _0x298711={},_0x287892={},_0x4f3154={'count':0x0,'rows':[]};var _0x57658f=_[_0xe6a5('0x37')](db['Setting'][_0xe6a5('0x38')],function(_0x187bee){return{'name':_0x187bee['fieldName'],'type':_0x187bee['type'][_0xe6a5('0x39')]};});_0x287892[_0xe6a5('0x3a')]=_['map'](_0x57658f,'name');_0x287892[_0xe6a5('0x3b')]=_[_0xe6a5('0x3c')](_0x4f75e0[_0xe6a5('0x3b')]);_0x287892['filters']=_['intersection'](_0x287892[_0xe6a5('0x3a')],_0x287892[_0xe6a5('0x3b')]);_0x298711[_0xe6a5('0x3d')]=_[_0xe6a5('0x3e')](_0x287892['model'],qs['fields'](_0x4f75e0[_0xe6a5('0x3b')]['fields']));_0x298711[_0xe6a5('0x3d')]=_0x298711[_0xe6a5('0x3d')][_0xe6a5('0x3f')]?_0x298711[_0xe6a5('0x3d')]:_0x287892[_0xe6a5('0x3a')];if(!_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x40')](_0xe6a5('0x41'))){_0x298711[_0xe6a5('0x42')]=qs[_0xe6a5('0x42')](_0x4f75e0[_0xe6a5('0x3b')]['limit']);_0x298711[_0xe6a5('0x2d')]=qs[_0xe6a5('0x2d')](_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x2d')]);}_0x298711[_0xe6a5('0x43')]=qs[_0xe6a5('0x44')](_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x44')]);_0x298711[_0xe6a5('0x45')]=qs[_0xe6a5('0x46')](_['pick'](_0x4f75e0[_0xe6a5('0x3b')],_0x287892[_0xe6a5('0x46')]),_0x57658f);if(_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x47')]){_0x298711[_0xe6a5('0x45')]=_['merge'](_0x298711['where'],{'$or':_[_0xe6a5('0x37')](_0x57658f,function(_0x4d2f48){if(_0x4d2f48[_0xe6a5('0x48')]!=='VIRTUAL'){var _0x247d64={};_0x247d64[_0x4d2f48[_0xe6a5('0x34')]]={'$like':'%'+_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x47')]+'%'};return _0x247d64;}})});}_0x298711=_['merge']({},_0x298711,_0x4f75e0[_0xe6a5('0x49')]);var _0x5abfe1={'where':_0x298711[_0xe6a5('0x45')]};return db[_0xe6a5('0x4a')][_0xe6a5('0x2c')](_0x5abfe1)['then'](function(_0x4aace1){_0x4f3154[_0xe6a5('0x2c')]=_0x4aace1;if(_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x4b')]){_0x298711[_0xe6a5('0x4c')]=[{'all':!![]}];}return db['Setting'][_0xe6a5('0x4d')](_0x298711);})[_0xe6a5('0x1d')](function(_0x2a47b8){_0x4f3154[_0xe6a5('0x4e')]=_0x2a47b8;return _0x4f3154;})[_0xe6a5('0x1d')](respondWithFilteredResult(_0x337a37,_0x298711))[_0xe6a5('0x27')](handleError(_0x337a37,null));};exports[_0xe6a5('0x4f')]=function(_0x56db02,_0x145ad1){var _0xb5f416={'raw':![],'where':{'id':_0x56db02[_0xe6a5('0x50')]['id']}},_0x44825d={};_0x44825d[_0xe6a5('0x3a')]=_['keys'](db[_0xe6a5('0x4a')]['rawAttributes']);_0x44825d[_0xe6a5('0x3b')]=_[_0xe6a5('0x3c')](_0x56db02[_0xe6a5('0x3b')]);_0x44825d[_0xe6a5('0x46')]=_[_0xe6a5('0x3e')](_0x44825d[_0xe6a5('0x3a')],_0x44825d[_0xe6a5('0x3b')]);_0xb5f416['attributes']=_[_0xe6a5('0x3e')](_0x44825d[_0xe6a5('0x3a')],qs['fields'](_0x56db02['query'][_0xe6a5('0x51')]));_0xb5f416['attributes']=_0xb5f416['attributes'][_0xe6a5('0x3f')]?_0xb5f416[_0xe6a5('0x3d')]:_0x44825d[_0xe6a5('0x3a')];if(_0x56db02[_0xe6a5('0x3b')][_0xe6a5('0x4b')]){_0xb5f416[_0xe6a5('0x4c')]=[{'all':!![]}];}_0xb5f416=_[_0xe6a5('0x52')]({},_0xb5f416,_0x56db02[_0xe6a5('0x49')]);return db['Setting'][_0xe6a5('0x53')](_0xb5f416)[_0xe6a5('0x1d')](handleEntityNotFound(_0x145ad1,null))[_0xe6a5('0x1d')](respondWithResult(_0x145ad1,null))[_0xe6a5('0x27')](handleError(_0x145ad1,null));};exports[_0xe6a5('0x31')]=function(_0x547933,_0x433b95){if(_0x547933['body']['id']){delete _0x547933[_0xe6a5('0x54')]['id'];}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x547933['params']['id']}})['then'](handleEntityNotFound(_0x433b95,null))['then'](saveUpdates(_0x547933['body'],null))[_0xe6a5('0x1d')](respondWithResult(_0x433b95,null))[_0xe6a5('0x27')](handleError(_0x433b95,null));};exports[_0xe6a5('0x55')]=function(_0x40dc93,_0xe9fee4,_0x10c801){if(_0x40dc93[_0xe6a5('0x56')]&&_0x40dc93[_0xe6a5('0x56')][_0xe6a5('0x57')]){_0x40dc93[_0xe6a5('0x54')][_0xe6a5('0x58')]=_0x40dc93[_0xe6a5('0x56')][_0xe6a5('0x57')];}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x40dc93['params']['id']}})[_0xe6a5('0x1d')](handleEntityNotFound(_0xe9fee4,null))[_0xe6a5('0x1d')](saveUpdates(_0x40dc93[_0xe6a5('0x54')],null))[_0xe6a5('0x1d')](respondWithResult(_0xe9fee4,null))[_0xe6a5('0x27')](handleError(_0xe9fee4,null));};exports['addLogoLogin']=function(_0x397b8d,_0x5a1fcd,_0x190794){if(_0x397b8d[_0xe6a5('0x56')]&&_0x397b8d[_0xe6a5('0x56')][_0xe6a5('0x57')]){_0x397b8d[_0xe6a5('0x54')][_0xe6a5('0x59')]=_0x397b8d[_0xe6a5('0x56')][_0xe6a5('0x57')];}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x397b8d['params']['id']}})[_0xe6a5('0x1d')](handleEntityNotFound(_0x5a1fcd,null))[_0xe6a5('0x1d')](saveUpdates(_0x397b8d[_0xe6a5('0x54')],null))[_0xe6a5('0x1d')](respondWithResult(_0x5a1fcd,null))['catch'](handleError(_0x5a1fcd,null));};var utilLicense=require(_0xe6a5('0x5a'));exports[_0xe6a5('0x5b')]=function(_0x908a5a,_0x56d0ac,_0xf1d4c9){var _0x310a44=_0xe6a5('0x5c');var _0x4c2f5e={'custom':![]};return utilLicense[_0xe6a5('0x5d')]()[_0xe6a5('0x1d')](function(_0x37afdf){if(_0x37afdf){_0x4c2f5e=_0x37afdf;}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x908a5a[_0xe6a5('0x50')]['id']},'attributes':[_0xe6a5('0x58'),_0xe6a5('0x59'),_0xe6a5('0x5e'),_0xe6a5('0x5f'),_0xe6a5('0x60'),_0xe6a5('0x61'),'defaultPreferred',_0xe6a5('0x62')],'raw':!![]});})[_0xe6a5('0x1d')](handleEntityNotFound(_0x56d0ac,null))['then'](function(_0x34c9b5){if(_0x34c9b5){var _0x24bbc6=_0x34c9b5['logo']&&fs['existsSync'](path['join'](config[_0xe6a5('0x63')],_0x310a44,_[_0xe6a5('0x64')](_0x34c9b5[_0xe6a5('0x58')])))?path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x310a44,_[_0xe6a5('0x64')](_0x34c9b5['logo'])):path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x310a44,_[_0xe6a5('0x64')](_0xe6a5('0x66')));var _0x4c6bc9=_0xe6a5('0x67')+_['upperFirst'](_0xe6a5('0x58'));if(_0x34c9b5[_0x4c6bc9]||!_0x4c2f5e[_0xe6a5('0x68')]){_0x24bbc6=path['join'](config[_0xe6a5('0x63')],_0x310a44,_[_0xe6a5('0x64')](_0xe6a5('0x66')));}if(!fs[_0xe6a5('0x69')](_0x24bbc6)){throw new db[(_0xe6a5('0x19'))][(_0xe6a5('0x1a'))](_[_0xe6a5('0x6a')](_0xe6a5('0x58'))+_0xe6a5('0x6b'));}return _0x56d0ac[_0xe6a5('0x6c')](_0x24bbc6);}})[_0xe6a5('0x27')](handleError(_0x56d0ac,null));};var utilLicense=require('../../config/license/util');exports[_0xe6a5('0x6d')]=function(_0x3a3c44,_0x25c83f,_0x1d6632){var _0x35bdf5=_0xe6a5('0x5c');var _0x1a14b4={'custom':![]};return utilLicense[_0xe6a5('0x5d')]()[_0xe6a5('0x1d')](function(_0x528b24){if(_0x528b24){_0x1a14b4=_0x528b24;}return db[_0xe6a5('0x4a')]['find']({'where':{'id':_0x3a3c44[_0xe6a5('0x50')]['id']},'attributes':['logo',_0xe6a5('0x59'),_0xe6a5('0x5e'),_0xe6a5('0x5f'),_0xe6a5('0x60'),_0xe6a5('0x61'),_0xe6a5('0x6e'),_0xe6a5('0x62')],'raw':!![]});})[_0xe6a5('0x1d')](handleEntityNotFound(_0x25c83f,null))[_0xe6a5('0x1d')](function(_0xfd93f7){if(_0xfd93f7){var _0x18af30=_0xfd93f7[_0xe6a5('0x59')]&&fs[_0xe6a5('0x69')](path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x35bdf5,_[_0xe6a5('0x64')](_0xfd93f7['loginLogo'])))?path[_0xe6a5('0x65')](config['root'],_0x35bdf5,_[_0xe6a5('0x64')](_0xfd93f7['loginLogo'])):path['join'](config['root'],_0x35bdf5,_[_0xe6a5('0x64')](_0xe6a5('0x6f')));var _0x1d36a7='default'+_[_0xe6a5('0x6a')](_0xe6a5('0x59'));if(_0xfd93f7[_0x1d36a7]||!_0x1a14b4[_0xe6a5('0x68')]){_0x18af30=path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x35bdf5,_[_0xe6a5('0x64')]('default_loginLogo.svg'));}if(!fs[_0xe6a5('0x69')](_0x18af30)){throw new db['Sequelize'][(_0xe6a5('0x1a'))](_['upperFirst'](_0xe6a5('0x59'))+_0xe6a5('0x6b'));}return _0x25c83f[_0xe6a5('0x6c')](_0x18af30);}})[_0xe6a5('0x27')](handleError(_0x25c83f,null));};exports[_0xe6a5('0x70')]=function(_0x11985a,_0x32b888){return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x11985a[_0xe6a5('0x50')]['id']},'attributes':[_0xe6a5('0x71')]})['then'](respondWithResult(_0x32b888,null))[_0xe6a5('0x27')](handleError(_0x32b888,null));};exports['addPreferred']=function(_0x1b8f3c,_0x536396,_0x176314){if(_0x1b8f3c[_0xe6a5('0x56')]&&_0x1b8f3c[_0xe6a5('0x56')][_0xe6a5('0x57')]){_0x1b8f3c[_0xe6a5('0x54')][_0xe6a5('0x5e')]=_0x1b8f3c[_0xe6a5('0x56')][_0xe6a5('0x57')];}return db[_0xe6a5('0x4a')]['find']({'where':{'id':_0x1b8f3c['params']['id']}})['then'](handleEntityNotFound(_0x536396,null))[_0xe6a5('0x1d')](saveUpdates(_0x1b8f3c[_0xe6a5('0x54')],null))[_0xe6a5('0x1d')](respondWithResult(_0x536396,null))[_0xe6a5('0x27')](handleError(_0x536396,null));};var utilLicense=require(_0xe6a5('0x5a'));exports[_0xe6a5('0x72')]=function(_0x2085c1,_0xf582f1,_0x4ddb6c){var _0x42d91d=_0xe6a5('0x5c');var _0x339902={'custom':![]};return utilLicense[_0xe6a5('0x5d')]()[_0xe6a5('0x1d')](function(_0x455afd){if(_0x455afd){_0x339902=_0x455afd;}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x2085c1[_0xe6a5('0x50')]['id']},'attributes':[_0xe6a5('0x58'),_0xe6a5('0x59'),_0xe6a5('0x5e'),'favicon',_0xe6a5('0x60'),_0xe6a5('0x61'),_0xe6a5('0x6e'),_0xe6a5('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0xf582f1,null))[_0xe6a5('0x1d')](function(_0x46e77e){if(_0x46e77e){var _0x127cfc=_0x46e77e[_0xe6a5('0x5e')]&&fs['existsSync'](path['join'](config[_0xe6a5('0x63')],_0x42d91d,_[_0xe6a5('0x64')](_0x46e77e[_0xe6a5('0x5e')])))?path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x42d91d,_[_0xe6a5('0x64')](_0x46e77e[_0xe6a5('0x5e')])):path['join'](config[_0xe6a5('0x63')],_0x42d91d,_[_0xe6a5('0x64')](_0xe6a5('0x73')));var _0x3bbbf5=_0xe6a5('0x67')+_[_0xe6a5('0x6a')]('preferred');if(_0x46e77e[_0x3bbbf5]||!_0x339902[_0xe6a5('0x68')]||!_0x339902['preferred']){_0x127cfc=path[_0xe6a5('0x65')](config['root'],_0x42d91d,_[_0xe6a5('0x64')](_0xe6a5('0x73')));}if(!fs['existsSync'](_0x127cfc)){throw new db[(_0xe6a5('0x19'))]['ValidationError'](_[_0xe6a5('0x6a')]('preferred')+_0xe6a5('0x6b'));}return _0xf582f1[_0xe6a5('0x6c')](_0x127cfc);}})[_0xe6a5('0x27')](handleError(_0xf582f1,null));};exports[_0xe6a5('0x74')]=function(_0x1e1382,_0x38771c,_0x5a4b58){if(_0x1e1382[_0xe6a5('0x56')]&&_0x1e1382[_0xe6a5('0x56')][_0xe6a5('0x57')]){_0x1e1382[_0xe6a5('0x54')][_0xe6a5('0x5f')]=_0x1e1382['file'][_0xe6a5('0x57')];}return db['Setting'][_0xe6a5('0x53')]({'where':{'id':_0x1e1382['params']['id']}})[_0xe6a5('0x1d')](handleEntityNotFound(_0x38771c,null))['then'](saveUpdates(_0x1e1382[_0xe6a5('0x54')],null))[_0xe6a5('0x1d')](respondWithResult(_0x38771c,null))[_0xe6a5('0x27')](handleError(_0x38771c,null));};var utilLicense=require(_0xe6a5('0x5a'));exports[_0xe6a5('0x75')]=function(_0x11017a,_0x1ba7be,_0x3f75fd){var _0x427093=_0xe6a5('0x5c');var _0x382bb2={'custom':![]};return utilLicense[_0xe6a5('0x5d')]()[_0xe6a5('0x1d')](function(_0x3a17f0){if(_0x3a17f0){_0x382bb2=_0x3a17f0;}return db[_0xe6a5('0x4a')]['find']({'where':{'id':_0x11017a[_0xe6a5('0x50')]['id']},'attributes':[_0xe6a5('0x58'),_0xe6a5('0x59'),_0xe6a5('0x5e'),_0xe6a5('0x5f'),_0xe6a5('0x60'),_0xe6a5('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x1ba7be,null))['then'](function(_0x583573){if(_0x583573){var _0xd0165b=_0x583573[_0xe6a5('0x5f')]&&fs['existsSync'](path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x427093,_['toLower'](_0x583573[_0xe6a5('0x5f')])))?path[_0xe6a5('0x65')](config['root'],_0x427093,_[_0xe6a5('0x64')](_0x583573['favicon'])):path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x427093,_[_0xe6a5('0x64')]('default_favicon.ico'));var _0x216775=_0xe6a5('0x67')+_[_0xe6a5('0x6a')](_0xe6a5('0x5f'));if(_0x583573[_0x216775]||!_0x382bb2[_0xe6a5('0x68')]){_0xd0165b=path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x427093,_[_0xe6a5('0x64')]('default_favicon.ico'));}if(!fs[_0xe6a5('0x69')](_0xd0165b)){throw new db[(_0xe6a5('0x19'))][(_0xe6a5('0x1a'))](_[_0xe6a5('0x6a')](_0xe6a5('0x5f'))+'\x20not\x20found');}return _0x1ba7be[_0xe6a5('0x6c')](_0xd0165b);}})[_0xe6a5('0x27')](handleError(_0x1ba7be,null));}; \ No newline at end of file +var _0x9b78=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','params','rawAttributes','include','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','default_loginLogo.svg','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','sendStatus','status','json','count','offset','limit','apply','reject','update','end','name','send','index','map','Setting','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x436728,_0x23fa62){var _0x30927e=function(_0x18c40e){while(--_0x18c40e){_0x436728['push'](_0x436728['shift']());}};_0x30927e(++_0x23fa62);}(_0x9b78,0x179));var _0x89b7=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x9b78[_0x503950];return _0x1657a9;};'use strict';var pdf=require(_0x89b7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x89b7('0x1'));var zipdir=require(_0x89b7('0x2'));var jsonpatch=require(_0x89b7('0x3'));var rp=require(_0x89b7('0x4'));var moment=require(_0x89b7('0x5'));var BPromise=require(_0x89b7('0x6'));var Mustache=require(_0x89b7('0x7'));var util=require(_0x89b7('0x8'));var path=require(_0x89b7('0x9'));var sox=require(_0x89b7('0xa'));var csv=require(_0x89b7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x89b7('0xc'));var squel=require(_0x89b7('0xd'));var crypto=require(_0x89b7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x89b7('0xb'));var querystring=require(_0x89b7('0xf'));var Papa=require(_0x89b7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x89b7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x89b7('0x12'))(_0x89b7('0x13'));var utils=require('../../config/utils');var config=require(_0x89b7('0x14'));var db=require(_0x89b7('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x89b7('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x5c44f6,_0xa85289,_0xa27027){if(_0xa27027){var _0x2a9703=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a9703['test'](_0xa85289)){return _0x5c44f6;}else{throw new db['Sequelize'][(_0x89b7('0x17'))](_0x89b7('0x18'));}}else{return _0x5c44f6;}}function respondWithRpcPromise(_0x281dd3,_0x636abf,_0x136003,_0x343d70){return new BPromise(function(_0x1e9873,_0x15e2bf){var _0x1b1582=_0x343d70||client;return _0x1b1582[_0x89b7('0x19')](_0x281dd3,_0x136003)[_0x89b7('0x1a')](function(_0x45ec0e){logger[_0x89b7('0x1b')](_0x89b7('0x1c'),_0x636abf,_0x89b7('0x1d'));logger[_0x89b7('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x636abf,_0x89b7('0x1d'),JSON['stringify'](_0x45ec0e));if(_0x45ec0e[_0x89b7('0x1f')]){if(_0x45ec0e[_0x89b7('0x1f')][_0x89b7('0x20')]===0x1f4){logger[_0x89b7('0x1f')](_0x89b7('0x1c'),_0x636abf,_0x45ec0e['error']['message']);return _0x15e2bf(_0x45ec0e['error'][_0x89b7('0x21')]);}logger['error'](_0x89b7('0x1c'),_0x636abf,_0x45ec0e[_0x89b7('0x1f')][_0x89b7('0x21')]);return _0x1e9873(_0x45ec0e[_0x89b7('0x1f')]['message']);}else{logger[_0x89b7('0x1b')]('Setting,\x20%s,\x20%s',_0x636abf,_0x89b7('0x1d'));_0x1e9873(_0x45ec0e['result'][_0x89b7('0x21')]);}})['catch'](function(_0x54fd6f){logger[_0x89b7('0x1f')]('Setting,\x20%s,\x20%s',_0x636abf,_0x54fd6f);_0x15e2bf(_0x54fd6f);});});}function respondWithStatusCode(_0xc40e69,_0x138aa2){_0x138aa2=_0x138aa2||0xcc;return function(_0x4a38a5){if(_0x4a38a5){return _0xc40e69[_0x89b7('0x22')](_0x138aa2);}return _0xc40e69[_0x89b7('0x23')](_0x138aa2)['end']();};}function respondWithResult(_0x296a17,_0x4074bb){_0x4074bb=_0x4074bb||0xc8;return function(_0x477f14){if(_0x477f14){return _0x296a17['status'](_0x4074bb)[_0x89b7('0x24')](_0x477f14);}};}function respondWithFilteredResult(_0x23c7ba,_0xb98a96){return function(_0x1d163f){if(_0x1d163f){var _0x1d3fa5=_0x1d163f[_0x89b7('0x25')],_0x2b1fa4=_0xb98a96[_0x89b7('0x26')],_0x35cad9=_0xb98a96[_0x89b7('0x26')]+_0xb98a96[_0x89b7('0x27')],_0x51d6d5;if(_0x35cad9>=_0x1d3fa5){_0x35cad9=_0x1d3fa5;_0x51d6d5=0xc8;}else{_0x51d6d5=0xce;}_0x23c7ba[_0x89b7('0x23')](_0x51d6d5);return _0x23c7ba['set']('Content-Range',_0x2b1fa4+'-'+_0x35cad9+'/'+_0x1d3fa5)[_0x89b7('0x24')](_0x1d163f);}return null;};}function patchUpdates(_0x2d5415){return function(_0x58ce8b){try{jsonpatch[_0x89b7('0x28')](_0x58ce8b,_0x2d5415,!![]);}catch(_0xa422d7){return BPromise[_0x89b7('0x29')](_0xa422d7);}return _0x58ce8b['save']();};}function saveUpdates(_0xc7521b,_0x1d4f43){return function(_0x37049a){if(_0x37049a){return _0x37049a[_0x89b7('0x2a')](_0xc7521b)[_0x89b7('0x1a')](function(_0x1e221e){return _0x1e221e;});}return null;};}function removeEntity(_0x2d7e3c,_0x5909d9){return function(_0x227a6f){if(_0x227a6f){return _0x227a6f['destroy']()[_0x89b7('0x1a')](function(){_0x2d7e3c[_0x89b7('0x23')](0xcc)[_0x89b7('0x2b')]();});}};}function handleEntityNotFound(_0x355133,_0x4a9d46){return function(_0xb2c076){if(!_0xb2c076){_0x355133[_0x89b7('0x22')](0x194);}return _0xb2c076;};}function handleError(_0xf0f5d7,_0xca073a){_0xca073a=_0xca073a||0x1f4;return function(_0x3dd6ca){logger[_0x89b7('0x1f')](_0x3dd6ca['stack']);if(_0x3dd6ca[_0x89b7('0x2c')]){delete _0x3dd6ca[_0x89b7('0x2c')];}_0xf0f5d7[_0x89b7('0x23')](_0xca073a)[_0x89b7('0x2d')](_0x3dd6ca);};}exports[_0x89b7('0x2e')]=function(_0x21f32f,_0x3c9159){var _0x4f5136={},_0x4172fa={},_0x369d0f={'count':0x0,'rows':[]};var _0x5f4fe5=_[_0x89b7('0x2f')](db[_0x89b7('0x30')]['rawAttributes'],function(_0xe14254){return{'name':_0xe14254['fieldName'],'type':_0xe14254['type'][_0x89b7('0x31')]};});_0x4172fa[_0x89b7('0x32')]=_[_0x89b7('0x2f')](_0x5f4fe5,_0x89b7('0x2c'));_0x4172fa[_0x89b7('0x33')]=_[_0x89b7('0x34')](_0x21f32f['query']);_0x4172fa[_0x89b7('0x35')]=_[_0x89b7('0x36')](_0x4172fa[_0x89b7('0x32')],_0x4172fa['query']);_0x4f5136[_0x89b7('0x37')]=_['intersection'](_0x4172fa[_0x89b7('0x32')],qs[_0x89b7('0x38')](_0x21f32f['query']['fields']));_0x4f5136[_0x89b7('0x37')]=_0x4f5136[_0x89b7('0x37')][_0x89b7('0x39')]?_0x4f5136[_0x89b7('0x37')]:_0x4172fa[_0x89b7('0x32')];if(!_0x21f32f[_0x89b7('0x33')][_0x89b7('0x3a')](_0x89b7('0x3b'))){_0x4f5136[_0x89b7('0x27')]=qs[_0x89b7('0x27')](_0x21f32f[_0x89b7('0x33')][_0x89b7('0x27')]);_0x4f5136[_0x89b7('0x26')]=qs['offset'](_0x21f32f[_0x89b7('0x33')][_0x89b7('0x26')]);}_0x4f5136[_0x89b7('0x3c')]=qs[_0x89b7('0x3d')](_0x21f32f[_0x89b7('0x33')][_0x89b7('0x3d')]);_0x4f5136[_0x89b7('0x3e')]=qs[_0x89b7('0x35')](_['pick'](_0x21f32f[_0x89b7('0x33')],_0x4172fa['filters']),_0x5f4fe5);if(_0x21f32f[_0x89b7('0x33')][_0x89b7('0x3f')]){_0x4f5136[_0x89b7('0x3e')]=_[_0x89b7('0x40')](_0x4f5136['where'],{'$or':_[_0x89b7('0x2f')](_0x5f4fe5,function(_0x52bac2){if(_0x52bac2['type']!==_0x89b7('0x41')){var _0x57c1b4={};_0x57c1b4[_0x52bac2[_0x89b7('0x2c')]]={'$like':'%'+_0x21f32f[_0x89b7('0x33')]['filter']+'%'};return _0x57c1b4;}})});}_0x4f5136=_['merge']({},_0x4f5136,_0x21f32f[_0x89b7('0x42')]);var _0x592f20={'where':_0x4f5136['where']};return db[_0x89b7('0x30')][_0x89b7('0x25')](_0x592f20)[_0x89b7('0x1a')](function(_0x5b40fc){_0x369d0f[_0x89b7('0x25')]=_0x5b40fc;if(_0x21f32f['query']['includeAll']){_0x4f5136['include']=[{'all':!![]}];}return db[_0x89b7('0x30')]['findAll'](_0x4f5136);})[_0x89b7('0x1a')](function(_0x53bd5a){_0x369d0f[_0x89b7('0x43')]=_0x53bd5a;return _0x369d0f;})[_0x89b7('0x1a')](respondWithFilteredResult(_0x3c9159,_0x4f5136))[_0x89b7('0x44')](handleError(_0x3c9159,null));};exports[_0x89b7('0x45')]=function(_0xb25496,_0x4d6d75){var _0x10e359={'raw':![],'where':{'id':_0xb25496[_0x89b7('0x46')]['id']}},_0x5d3224={};_0x5d3224[_0x89b7('0x32')]=_[_0x89b7('0x34')](db[_0x89b7('0x30')][_0x89b7('0x47')]);_0x5d3224[_0x89b7('0x33')]=_['keys'](_0xb25496[_0x89b7('0x33')]);_0x5d3224[_0x89b7('0x35')]=_[_0x89b7('0x36')](_0x5d3224[_0x89b7('0x32')],_0x5d3224[_0x89b7('0x33')]);_0x10e359[_0x89b7('0x37')]=_[_0x89b7('0x36')](_0x5d3224[_0x89b7('0x32')],qs['fields'](_0xb25496[_0x89b7('0x33')]['fields']));_0x10e359[_0x89b7('0x37')]=_0x10e359[_0x89b7('0x37')][_0x89b7('0x39')]?_0x10e359['attributes']:_0x5d3224[_0x89b7('0x32')];if(_0xb25496[_0x89b7('0x33')]['includeAll']){_0x10e359[_0x89b7('0x48')]=[{'all':!![]}];}_0x10e359=_['merge']({},_0x10e359,_0xb25496[_0x89b7('0x42')]);return db['Setting'][_0x89b7('0x49')](_0x10e359)[_0x89b7('0x1a')](handleEntityNotFound(_0x4d6d75,null))[_0x89b7('0x1a')](respondWithResult(_0x4d6d75,null))[_0x89b7('0x44')](handleError(_0x4d6d75,null));};exports['update']=function(_0x5e67d7,_0x203eb9){if(_0x5e67d7[_0x89b7('0x4a')]['id']){delete _0x5e67d7[_0x89b7('0x4a')]['id'];}return db[_0x89b7('0x30')]['find']({'where':{'id':_0x5e67d7['params']['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0x203eb9,null))[_0x89b7('0x1a')](saveUpdates(_0x5e67d7[_0x89b7('0x4a')],null))[_0x89b7('0x1a')](respondWithResult(_0x203eb9,null))['catch'](handleError(_0x203eb9,null));};exports[_0x89b7('0x4b')]=function(_0x4ae136,_0x3b1b80,_0xc1017){if(_0x4ae136['file']&&_0x4ae136[_0x89b7('0x4c')][_0x89b7('0x4d')]){_0x4ae136[_0x89b7('0x4a')][_0x89b7('0x4e')]=_0x4ae136[_0x89b7('0x4c')][_0x89b7('0x4d')];}return db['Setting']['find']({'where':{'id':_0x4ae136[_0x89b7('0x46')]['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0x3b1b80,null))['then'](saveUpdates(_0x4ae136[_0x89b7('0x4a')],null))['then'](respondWithResult(_0x3b1b80,null))[_0x89b7('0x44')](handleError(_0x3b1b80,null));};exports[_0x89b7('0x4f')]=function(_0x37bd4f,_0x6dff9b,_0x33e0c3){if(_0x37bd4f[_0x89b7('0x4c')]&&_0x37bd4f[_0x89b7('0x4c')][_0x89b7('0x4d')]){_0x37bd4f[_0x89b7('0x4a')][_0x89b7('0x50')]=_0x37bd4f['file']['filename'];}return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0x37bd4f['params']['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0x6dff9b,null))[_0x89b7('0x1a')](saveUpdates(_0x37bd4f[_0x89b7('0x4a')],null))[_0x89b7('0x1a')](respondWithResult(_0x6dff9b,null))[_0x89b7('0x44')](handleError(_0x6dff9b,null));};var utilLicense=require(_0x89b7('0x51'));exports[_0x89b7('0x52')]=function(_0x46d865,_0x21bd0b,_0x49cb5b){var _0x3c53a7=_0x89b7('0x53');var _0x1fc123={'custom':![]};return utilLicense[_0x89b7('0x54')]()['then'](function(_0x1659a5){if(_0x1659a5){_0x1fc123=_0x1659a5;}return db['Setting'][_0x89b7('0x49')]({'where':{'id':_0x46d865[_0x89b7('0x46')]['id']},'attributes':[_0x89b7('0x4e'),_0x89b7('0x50'),_0x89b7('0x55'),_0x89b7('0x56'),_0x89b7('0x57'),_0x89b7('0x58'),_0x89b7('0x59'),_0x89b7('0x5a')],'raw':!![]});})[_0x89b7('0x1a')](handleEntityNotFound(_0x21bd0b,null))['then'](function(_0x7cebcf){if(_0x7cebcf){var _0x1b8cfc=_0x7cebcf[_0x89b7('0x4e')]&&fs[_0x89b7('0x5b')](path[_0x89b7('0x5c')](config['root'],_0x3c53a7,_[_0x89b7('0x5d')](_0x7cebcf['logo'])))?path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x3c53a7,_[_0x89b7('0x5d')](_0x7cebcf[_0x89b7('0x4e')])):path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x3c53a7,_[_0x89b7('0x5d')](_0x89b7('0x5f')));var _0x1d88f7=_0x89b7('0x60')+_[_0x89b7('0x61')](_0x89b7('0x4e'));if(_0x7cebcf[_0x1d88f7]||!_0x1fc123[_0x89b7('0x62')]){_0x1b8cfc=path['join'](config[_0x89b7('0x5e')],_0x3c53a7,_[_0x89b7('0x5d')](_0x89b7('0x5f')));}if(!fs[_0x89b7('0x5b')](_0x1b8cfc)){throw new db[(_0x89b7('0x63'))]['ValidationError'](_[_0x89b7('0x61')](_0x89b7('0x4e'))+_0x89b7('0x64'));}return _0x21bd0b[_0x89b7('0x65')](_0x1b8cfc);}})['catch'](handleError(_0x21bd0b,null));};var utilLicense=require(_0x89b7('0x51'));exports['getLogoLogin']=function(_0x32f608,_0x3c91e7,_0x570051){var _0x221bda='server/files/images/logos';var _0x453696={'custom':![]};return utilLicense[_0x89b7('0x54')]()[_0x89b7('0x1a')](function(_0x332833){if(_0x332833){_0x453696=_0x332833;}return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0x32f608[_0x89b7('0x46')]['id']},'attributes':['logo',_0x89b7('0x50'),_0x89b7('0x55'),_0x89b7('0x56'),'defaultLogo',_0x89b7('0x58'),'defaultPreferred',_0x89b7('0x5a')],'raw':!![]});})[_0x89b7('0x1a')](handleEntityNotFound(_0x3c91e7,null))[_0x89b7('0x1a')](function(_0xb885a6){if(_0xb885a6){var _0x3c898f=_0xb885a6[_0x89b7('0x50')]&&fs[_0x89b7('0x5b')](path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x221bda,_[_0x89b7('0x5d')](_0xb885a6[_0x89b7('0x50')])))?path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x221bda,_[_0x89b7('0x5d')](_0xb885a6['loginLogo'])):path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x221bda,_['toLower'](_0x89b7('0x66')));var _0x24f8df=_0x89b7('0x60')+_['upperFirst'](_0x89b7('0x50'));if(_0xb885a6[_0x24f8df]||!_0x453696[_0x89b7('0x62')]){_0x3c898f=path[_0x89b7('0x5c')](config['root'],_0x221bda,_[_0x89b7('0x5d')](_0x89b7('0x66')));}if(!fs[_0x89b7('0x5b')](_0x3c898f)){throw new db[(_0x89b7('0x63'))][(_0x89b7('0x17'))](_[_0x89b7('0x61')]('loginLogo')+_0x89b7('0x64'));}return _0x3c91e7[_0x89b7('0x65')](_0x3c898f);}})[_0x89b7('0x44')](handleError(_0x3c91e7,null));};exports[_0x89b7('0x67')]=function(_0xbaf847,_0x198cc5){return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0xbaf847[_0x89b7('0x46')]['id']},'attributes':[_0x89b7('0x68')]})['then'](respondWithResult(_0x198cc5,null))[_0x89b7('0x44')](handleError(_0x198cc5,null));};exports['addPreferred']=function(_0x2eb1ee,_0xca1c80,_0x43c185){if(_0x2eb1ee[_0x89b7('0x4c')]&&_0x2eb1ee['file']['filename']){_0x2eb1ee['body'][_0x89b7('0x55')]=_0x2eb1ee[_0x89b7('0x4c')]['filename'];}return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0x2eb1ee[_0x89b7('0x46')]['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0xca1c80,null))[_0x89b7('0x1a')](saveUpdates(_0x2eb1ee['body'],null))['then'](respondWithResult(_0xca1c80,null))['catch'](handleError(_0xca1c80,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x176b64,_0x4e5cb6,_0x17de67){var _0x9816e0=_0x89b7('0x53');var _0x346ac7={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2247c3){if(_0x2247c3){_0x346ac7=_0x2247c3;}return db[_0x89b7('0x30')]['find']({'where':{'id':_0x176b64[_0x89b7('0x46')]['id']},'attributes':[_0x89b7('0x4e'),_0x89b7('0x50'),_0x89b7('0x55'),_0x89b7('0x56'),_0x89b7('0x57'),_0x89b7('0x58'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x4e5cb6,null))['then'](function(_0x3873da){if(_0x3873da){var _0x413e60=_0x3873da[_0x89b7('0x55')]&&fs[_0x89b7('0x5b')](path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x9816e0,_[_0x89b7('0x5d')](_0x3873da[_0x89b7('0x55')])))?path[_0x89b7('0x5c')](config['root'],_0x9816e0,_['toLower'](_0x3873da['preferred'])):path['join'](config[_0x89b7('0x5e')],_0x9816e0,_[_0x89b7('0x5d')](_0x89b7('0x69')));var _0xf5e650=_0x89b7('0x60')+_[_0x89b7('0x61')](_0x89b7('0x55'));if(_0x3873da[_0xf5e650]||!_0x346ac7[_0x89b7('0x62')]||!_0x346ac7[_0x89b7('0x55')]){_0x413e60=path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x9816e0,_[_0x89b7('0x5d')](_0x89b7('0x69')));}if(!fs[_0x89b7('0x5b')](_0x413e60)){throw new db[(_0x89b7('0x63'))][(_0x89b7('0x17'))](_['upperFirst']('preferred')+_0x89b7('0x64'));}return _0x4e5cb6[_0x89b7('0x65')](_0x413e60);}})['catch'](handleError(_0x4e5cb6,null));};exports[_0x89b7('0x6a')]=function(_0x5091c5,_0x384e85,_0x536c8e){if(_0x5091c5['file']&&_0x5091c5['file']['filename']){_0x5091c5['body'][_0x89b7('0x56')]=_0x5091c5['file']['filename'];}return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0x5091c5[_0x89b7('0x46')]['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0x384e85,null))[_0x89b7('0x1a')](saveUpdates(_0x5091c5['body'],null))[_0x89b7('0x1a')](respondWithResult(_0x384e85,null))[_0x89b7('0x44')](handleError(_0x384e85,null));};var utilLicense=require(_0x89b7('0x51'));exports[_0x89b7('0x6b')]=function(_0x34b93b,_0x1bf0a2,_0x553163){var _0x16d10b=_0x89b7('0x53');var _0x3c6485={'custom':![]};return utilLicense[_0x89b7('0x54')]()[_0x89b7('0x1a')](function(_0xdd936b){if(_0xdd936b){_0x3c6485=_0xdd936b;}return db[_0x89b7('0x30')]['find']({'where':{'id':_0x34b93b[_0x89b7('0x46')]['id']},'attributes':[_0x89b7('0x4e'),'loginLogo',_0x89b7('0x55'),_0x89b7('0x56'),_0x89b7('0x57'),_0x89b7('0x58'),_0x89b7('0x59'),_0x89b7('0x5a')],'raw':!![]});})[_0x89b7('0x1a')](handleEntityNotFound(_0x1bf0a2,null))[_0x89b7('0x1a')](function(_0x20a8b9){if(_0x20a8b9){var _0x367020=_0x20a8b9[_0x89b7('0x56')]&&fs[_0x89b7('0x5b')](path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x16d10b,_[_0x89b7('0x5d')](_0x20a8b9['favicon'])))?path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x16d10b,_[_0x89b7('0x5d')](_0x20a8b9['favicon'])):path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x16d10b,_['toLower'](_0x89b7('0x6c')));var _0x40c40c=_0x89b7('0x60')+_[_0x89b7('0x61')](_0x89b7('0x56'));if(_0x20a8b9[_0x40c40c]||!_0x3c6485[_0x89b7('0x62')]){_0x367020=path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x16d10b,_[_0x89b7('0x5d')](_0x89b7('0x6c')));}if(!fs[_0x89b7('0x5b')](_0x367020)){throw new db['Sequelize'][(_0x89b7('0x17'))](_[_0x89b7('0x61')](_0x89b7('0x56'))+_0x89b7('0x64'));}return _0x1bf0a2[_0x89b7('0x65')](_0x367020);}})[_0x89b7('0x44')](handleError(_0x1bf0a2,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index fcf5c89..8d5c0b2 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 _0x0d71=['request-promise','rimraf','../../config/environment','./setting.attributes','define','Setting','settings','util','api','bluebird'];(function(_0x1e060e,_0x4cbc40){var _0x54d047=function(_0x488563){while(--_0x488563){_0x1e060e['push'](_0x1e060e['shift']());}};_0x54d047(++_0x4cbc40);}(_0x0d71,0x1ab));var _0x10d7=function(_0x29a5a9,_0x30e45d){_0x29a5a9=_0x29a5a9-0x0;var _0x274863=_0x0d71[_0x29a5a9];return _0x274863;};'use strict';var _=require('lodash');var util=require(_0x10d7('0x0'));var logger=require('../../config/logger')(_0x10d7('0x1'));var moment=require('moment');var BPromise=require(_0x10d7('0x2'));var rp=require(_0x10d7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10d7('0x4'));var config=require(_0x10d7('0x5'));var attributes=require(_0x10d7('0x6'));module['exports']=function(_0x20f831,_0x517a84){return _0x20f831[_0x10d7('0x7')](_0x10d7('0x8'),attributes,{'tableName':_0x10d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff2b=['exports','settings','api','moment','bluebird','rimraf','../../config/environment','./setting.attributes'];(function(_0x3434d7,_0x4d4eb0){var _0x51eebd=function(_0x37161c){while(--_0x37161c){_0x3434d7['push'](_0x3434d7['shift']());}};_0x51eebd(++_0x4d4eb0);}(_0xff2b,0x112));var _0xbff2=function(_0x43d42c,_0x463065){_0x43d42c=_0x43d42c-0x0;var _0x30bee9=_0xff2b[_0x43d42c];return _0x30bee9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbff2('0x0'));var moment=require(_0xbff2('0x1'));var BPromise=require(_0xbff2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbff2('0x3'));var config=require(_0xbff2('0x4'));var attributes=require(_0xbff2('0x5'));module[_0xbff2('0x6')]=function(_0x347259,_0x384c0b){return _0x347259['define']('Setting',attributes,{'tableName':_0xbff2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 0711895..7f5b776 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 _0xad80=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s'];(function(_0x1114dc,_0x39389b){var _0x3c70f2=function(_0x2c9043){while(--_0x2c9043){_0x1114dc['push'](_0x1114dc['shift']());}};_0x3c70f2(++_0x39389b);}(_0xad80,0x11b));var _0x0ad8=function(_0x5ae9c3,_0x3fc8b1){_0x5ae9c3=_0x5ae9c3-0x0;var _0x58913d=_0xad80[_0x5ae9c3];return _0x58913d;};'use strict';var _=require(_0x0ad8('0x0'));var util=require(_0x0ad8('0x1'));var moment=require(_0x0ad8('0x2'));var BPromise=require(_0x0ad8('0x3'));var rs=require(_0x0ad8('0x4'));var fs=require('fs');var Redis=require(_0x0ad8('0x5'));var db=require(_0x0ad8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ad8('0x7'))(_0x0ad8('0x8'));var config=require(_0x0ad8('0x9'));var jayson=require(_0x0ad8('0xa'));var client=jayson[_0x0ad8('0xb')][_0x0ad8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56965d,_0x229c43,_0x2f4922){return new BPromise(function(_0x407303,_0x246073){return client[_0x0ad8('0xd')](_0x56965d,_0x2f4922)[_0x0ad8('0xe')](function(_0x24dc63){logger[_0x0ad8('0xf')](_0x0ad8('0x10'),_0x229c43,_0x0ad8('0x11'));logger[_0x0ad8('0x12')](_0x0ad8('0x13'),_0x229c43,_0x0ad8('0x11'),JSON[_0x0ad8('0x14')](_0x24dc63));if(_0x24dc63[_0x0ad8('0x15')]){if(_0x24dc63[_0x0ad8('0x15')]['code']===0x1f4){logger[_0x0ad8('0x15')](_0x0ad8('0x10'),_0x229c43,_0x24dc63[_0x0ad8('0x15')]['message']);return _0x246073(_0x24dc63[_0x0ad8('0x15')][_0x0ad8('0x16')]);}logger[_0x0ad8('0x15')](_0x0ad8('0x10'),_0x229c43,_0x24dc63[_0x0ad8('0x15')][_0x0ad8('0x16')]);return _0x407303(_0x24dc63['error'][_0x0ad8('0x16')]);}else{logger[_0x0ad8('0xf')](_0x0ad8('0x10'),_0x229c43,_0x0ad8('0x11'));_0x407303(_0x24dc63[_0x0ad8('0x17')][_0x0ad8('0x16')]);}})[_0x0ad8('0x18')](function(_0x10d0a1){logger['error'](_0x0ad8('0x10'),_0x229c43,_0x10d0a1);_0x246073(_0x10d0a1);});});} \ No newline at end of file +var _0xadd1=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s'];(function(_0x22d7bb,_0x4c158e){var _0x40a737=function(_0xd85bab){while(--_0xd85bab){_0x22d7bb['push'](_0x22d7bb['shift']());}};_0x40a737(++_0x4c158e);}(_0xadd1,0x1e5));var _0x1add=function(_0x330a89,_0xa76f3e){_0x330a89=_0x330a89-0x0;var _0x5c45ca=_0xadd1[_0x330a89];return _0x5c45ca;};'use strict';var _=require(_0x1add('0x0'));var util=require('util');var moment=require(_0x1add('0x1'));var BPromise=require(_0x1add('0x2'));var rs=require(_0x1add('0x3'));var fs=require('fs');var Redis=require(_0x1add('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1add('0x5'));var logger=require(_0x1add('0x6'))('rpc');var config=require(_0x1add('0x7'));var jayson=require(_0x1add('0x8'));var client=jayson[_0x1add('0x9')][_0x1add('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa76400,_0x3a07bd,_0x407174){return new BPromise(function(_0x1db71c,_0x1aded1){return client[_0x1add('0xb')](_0xa76400,_0x407174)[_0x1add('0xc')](function(_0x3899a8){logger[_0x1add('0xd')]('Setting,\x20%s,\x20%s',_0x3a07bd,_0x1add('0xe'));logger[_0x1add('0xf')](_0x1add('0x10'),_0x3a07bd,_0x1add('0xe'),JSON[_0x1add('0x11')](_0x3899a8));if(_0x3899a8[_0x1add('0x12')]){if(_0x3899a8[_0x1add('0x12')][_0x1add('0x13')]===0x1f4){logger['error'](_0x1add('0x14'),_0x3a07bd,_0x3899a8[_0x1add('0x12')]['message']);return _0x1aded1(_0x3899a8[_0x1add('0x12')][_0x1add('0x15')]);}logger[_0x1add('0x12')](_0x1add('0x14'),_0x3a07bd,_0x3899a8['error']['message']);return _0x1db71c(_0x3899a8[_0x1add('0x12')][_0x1add('0x15')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x3a07bd,_0x1add('0xe'));_0x1db71c(_0x3899a8['result']['message']);}})[_0x1add('0x16')](function(_0x14d27){logger[_0x1add('0x12')](_0x1add('0x14'),_0x3a07bd,_0x14d27);_0x1aded1(_0x14d27);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 541c990..f1374e4 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 _0x5f57=['getApplications','getInteractions','/:id/users','post','create','notify','addApplications','/:id/status','status','put','update','delete','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x5a1d58,_0x42ab8d){var _0x5911a9=function(_0x3769a4){while(--_0x3769a4){_0x5a1d58['push'](_0x5a1d58['shift']());}};_0x5911a9(++_0x42ab8d);}(_0x5f57,0xf6));var _0x75f5=function(_0x240a59,_0x38b69f){_0x240a59=_0x240a59-0x0;var _0x4bfa34=_0x5f57[_0x240a59];return _0x4bfa34;};'use strict';var multer=require('multer');var util=require(_0x75f5('0x0'));var path=require(_0x75f5('0x1'));var timeout=require(_0x75f5('0x2'));var express=require(_0x75f5('0x3'));var router=express[_0x75f5('0x4')]();var auth=require(_0x75f5('0x5'));var interaction=require(_0x75f5('0x6'));var config=require(_0x75f5('0x7'));var controller=require('./smsAccount.controller');router[_0x75f5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x75f5('0x8')](_0x75f5('0x9'),auth[_0x75f5('0xa')](),controller[_0x75f5('0xb')]);router['get'](_0x75f5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x75f5('0x8')](_0x75f5('0xd'),auth['isAuthenticated'](),controller[_0x75f5('0xe')]);router[_0x75f5('0x8')](_0x75f5('0xf'),auth[_0x75f5('0xa')](),controller[_0x75f5('0x10')]);router[_0x75f5('0x8')](_0x75f5('0x11'),auth[_0x75f5('0xa')](),controller[_0x75f5('0x12')]);router[_0x75f5('0x8')]('/:id/interactions',auth[_0x75f5('0xa')](),controller[_0x75f5('0x13')]);router[_0x75f5('0x8')]('/:id/status',controller['statusGet']);router[_0x75f5('0x8')](_0x75f5('0x14'),auth[_0x75f5('0xa')](),controller['getAgents']);router[_0x75f5('0x15')]('/',auth[_0x75f5('0xa')](),controller[_0x75f5('0x16')]);router[_0x75f5('0x15')](_0x75f5('0xd'),auth[_0x75f5('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x75f5('0x17')]);router['post'](_0x75f5('0x11'),auth['isAuthenticated'](),controller[_0x75f5('0x18')]);router['post']('/:id/send',auth[_0x75f5('0xa')](),controller['send']);router[_0x75f5('0x15')](_0x75f5('0x19'),controller[_0x75f5('0x1a')]);router[_0x75f5('0x15')](_0x75f5('0x14'),auth[_0x75f5('0xa')](),controller['addAgents']);router[_0x75f5('0x1b')](_0x75f5('0xc'),auth[_0x75f5('0xa')](),controller[_0x75f5('0x1c')]);router['delete'](_0x75f5('0xc'),auth[_0x75f5('0xa')](),controller['destroy']);router[_0x75f5('0x1d')]('/:id/dispositions',auth[_0x75f5('0xa')](),controller[_0x75f5('0x1e')]);router[_0x75f5('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x75f5('0x1f')]);router[_0x75f5('0x1d')](_0x75f5('0x14'),auth['isAuthenticated'](),controller[_0x75f5('0x20')]);module['exports']=router; \ No newline at end of file +var _0x2b34=['status','addAgents','/:id','update','delete','/:id/canned_answers','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','addApplications','/:id/send','send'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x2b34,0x81));var _0x42b3=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0x2b34[_0x644560];return _0x41b76b;};'use strict';var multer=require('multer');var util=require(_0x42b3('0x0'));var path=require(_0x42b3('0x1'));var timeout=require(_0x42b3('0x2'));var express=require(_0x42b3('0x3'));var router=express[_0x42b3('0x4')]();var auth=require(_0x42b3('0x5'));var interaction=require(_0x42b3('0x6'));var config=require(_0x42b3('0x7'));var controller=require(_0x42b3('0x8'));router[_0x42b3('0x9')]('/',auth[_0x42b3('0xa')](),controller['index']);router[_0x42b3('0x9')](_0x42b3('0xb'),auth[_0x42b3('0xa')](),controller[_0x42b3('0xc')]);router[_0x42b3('0x9')]('/:id',auth[_0x42b3('0xa')](),controller[_0x42b3('0xd')]);router[_0x42b3('0x9')](_0x42b3('0xe'),auth[_0x42b3('0xa')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x42b3('0xf'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x10')]);router[_0x42b3('0x9')](_0x42b3('0x11'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x12')]);router[_0x42b3('0x9')](_0x42b3('0x13'),controller[_0x42b3('0x14')]);router[_0x42b3('0x9')](_0x42b3('0x15'),auth['isAuthenticated'](),controller[_0x42b3('0x16')]);router[_0x42b3('0x17')]('/',auth[_0x42b3('0xa')](),controller[_0x42b3('0x18')]);router['post'](_0x42b3('0xe'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x19')]);router[_0x42b3('0x17')]('/:id/canned_answers',auth[_0x42b3('0xa')](),controller[_0x42b3('0x1a')]);router[_0x42b3('0x17')](_0x42b3('0x1b'),controller['notify']);router[_0x42b3('0x17')](_0x42b3('0xf'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x1c')]);router[_0x42b3('0x17')](_0x42b3('0x1d'),auth['isAuthenticated'](),controller[_0x42b3('0x1e')]);router[_0x42b3('0x17')](_0x42b3('0x13'),controller[_0x42b3('0x1f')]);router[_0x42b3('0x17')](_0x42b3('0x15'),auth['isAuthenticated'](),controller[_0x42b3('0x20')]);router['put'](_0x42b3('0x21'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x22')]);router[_0x42b3('0x23')]('/:id',auth[_0x42b3('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x42b3('0x23')](_0x42b3('0x24'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x25')]);router[_0x42b3('0x23')](_0x42b3('0x15'),auth['isAuthenticated'](),controller[_0x42b3('0x26')]);module[_0x42b3('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index a4a91fa..66674f1 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 _0xe116=['randomstring','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','clickatell','csc','infobip','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'];(function(_0x273bbc,_0x40f0d3){var _0x51587f=function(_0x5bc8bb){while(--_0x5bc8bb){_0x273bbc['push'](_0x273bbc['shift']());}};_0x51587f(++_0x40f0d3);}(_0xe116,0x159));var _0x6e11=function(_0x2917f0,_0x1cd7fb){_0x2917f0=_0x2917f0-0x0;var _0x41602e=_0xe116[_0x2917f0];return _0x41602e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6e11('0x0'));module[_0x6e11('0x1')]={'name':{'type':Sequelize[_0x6e11('0x2')],'unique':_0x6e11('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6e11('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6e11('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6e11('0x4')]();}},'phone':{'type':Sequelize[_0x6e11('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6e11('0x5'),_0x6e11('0x6'),_0x6e11('0x7'),_0x6e11('0x8'),'plivo',_0x6e11('0x9'),_0x6e11('0xa'),_0x6e11('0xb'),_0x6e11('0xc'))},'accountSid':{'type':Sequelize[_0x6e11('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6e11('0x2')]},'smsMethod':{'type':Sequelize[_0x6e11('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6e11('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x6e11('0x2')]},'senderString':{'type':Sequelize[_0x6e11('0x2')]},'deliveryReport':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x6e11('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6e11('0xf')],'defaultValue':function(){return _0x6e11('0x10');}},'notificationSound':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e11('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6e11('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e11('0x11')],'comment':_0x6e11('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![],'comment':_0x6e11('0x13'),'set':function(_0x14e491){if(!_0x14e491)this[_0x6e11('0x14')](_0x6e11('0x15'),null);this[_0x6e11('0x14')](_0x6e11('0x16'),_0x14e491);}}}; \ No newline at end of file +var _0x64ba=['name','generate','ENUM','twilio','skebby','clickatell','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x64ba,0xfd));var _0xa64b=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x64ba[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0xa64b('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa64b('0x1')],'unique':_0xa64b('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xa64b('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa64b('0x3')]();}},'phone':{'type':Sequelize[_0xa64b('0x1')]},'type':{'type':Sequelize[_0xa64b('0x4')](_0xa64b('0x5'),_0xa64b('0x6'),'connectel','clicksend','plivo',_0xa64b('0x7'),'csc','infobip',_0xa64b('0x8'))},'accountSid':{'type':Sequelize[_0xa64b('0x1')]},'authId':{'type':Sequelize[_0xa64b('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa64b('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa64b('0x1')]},'password':{'type':Sequelize[_0xa64b('0x1')]},'apiKey':{'type':Sequelize[_0xa64b('0x1')]},'senderString':{'type':Sequelize[_0xa64b('0x1')]},'deliveryReport':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![]},'description':{'type':Sequelize[_0xa64b('0x1')]},'notificationTemplate':{'type':Sequelize[_0xa64b('0xa')],'defaultValue':function(){return _0xa64b('0xb');}},'notificationSound':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa64b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa64b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa64b('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa64b('0xc')],'comment':_0xa64b('0xd')},'mandatoryDisposition':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![],'comment':_0xa64b('0xe'),'set':function(_0x1fe05e){if(!_0x1fe05e)this[_0xa64b('0xf')]('mandatoryDispositionPauseId',null);this[_0xa64b('0xf')](_0xa64b('0x10'),_0x1fe05e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index cb22f6f..a15e1e0 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x457863,_0x5f277b){var _0x46b2db=function(_0x1ee5ff){while(--_0x1ee5ff){_0x457863['push'](_0x457863['shift']());}};_0x46b2db(++_0x5f277b);}(_0x7a54,0x106));var _0x47a5=function(_0x459245,_0xbe7b34){_0x459245=_0x459245-0x0;var _0x37a9c7=_0x7a54[_0x459245];return _0x37a9c7;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file +var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x2c3e78,_0x57aad1){var _0xd90a41=function(_0x583eee){while(--_0x583eee){_0x2c3e78['push'](_0x2c3e78['shift']());}};_0xd90a41(++_0x57aad1);}(_0x7a54,0x106));var _0x47a5=function(_0x277c77,_0x2232f2){_0x277c77=_0x277c77-0x0;var _0x1990ef=_0x7a54[_0x277c77];return _0x1990ef;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 07d3ac6..86f03a6 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 _0xf63d=['update','emit','hasOwnProperty','hook','events','SmsAccount','setMaxListeners'];(function(_0x3ead04,_0x39bccf){var _0x142c29=function(_0x394f0a){while(--_0x394f0a){_0x3ead04['push'](_0x3ead04['shift']());}};_0x142c29(++_0x39bccf);}(_0xf63d,0x123));var _0xdf63=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xf63d[_0x37b3e5];return _0x207f20;};'use strict';var EventEmitter=require(_0xdf63('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xdf63('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdf63('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdf63('0x3'),'afterDestroy':'remove'};function emitEvent(_0x844f0d){return function(_0x432e32,_0x4a7934,_0x37c8b0){SmsAccountEvents[_0xdf63('0x4')](_0x844f0d+':'+_0x432e32['id'],_0x432e32);SmsAccountEvents['emit'](_0x844f0d,_0x432e32);_0x37c8b0(null);};}for(var e in events){if(events[_0xdf63('0x5')](e)){var event=events[e];SmsAccount[_0xdf63('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xdc91=['events','../../mysqldb','SmsAccount','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2c24df,_0x2e46a3){var _0x309b15=function(_0x5d525b){while(--_0x5d525b){_0x2c24df['push'](_0x2c24df['shift']());}};_0x309b15(++_0x2e46a3);}(_0xdc91,0x172));var _0x1dc9=function(_0x519a1b,_0x2ed3a1){_0x519a1b=_0x519a1b-0x0;var _0x3c4b42=_0xdc91[_0x519a1b];return _0x3c4b42;};'use strict';var EventEmitter=require(_0x1dc9('0x0'));var SmsAccount=require(_0x1dc9('0x1'))['db'][_0x1dc9('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1dc9('0x3'),'afterUpdate':_0x1dc9('0x4'),'afterDestroy':_0x1dc9('0x5')};function emitEvent(_0x862f95){return function(_0x473c46,_0x2bfa89,_0x1ddb64){SmsAccountEvents[_0x1dc9('0x6')](_0x862f95+':'+_0x473c46['id'],_0x473c46);SmsAccountEvents['emit'](_0x862f95,_0x473c46);_0x1ddb64(null);};}for(var e in events){if(events[_0x1dc9('0x7')](e)){var event=events[e];SmsAccount[_0x1dc9('0x8')](e,emitEvent(event));}}module[_0x1dc9('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 1c92ba1..848eb5b 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2775f6,_0x122445){var _0x41de0c=function(_0x1cf85c){while(--_0x1cf85c){_0x2775f6['push'](_0x2775f6['shift']());}};_0x41de0c(++_0x122445);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x47218c,_0x2d6072){var _0x4ef22d=function(_0x5ebca5){while(--_0x5ebca5){_0x47218c['push'](_0x47218c['shift']());}};_0x4ef22d(++_0x2d6072);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b198017..14fb2ab 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 _0x2c54=['../../config/environment','jayson/promise','client','redis','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','SmsAccount','find','options','raw','where','attributes','include','map','model','debug','ShowSmsAccount','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x41ebbb,_0x45b3a5){var _0x5848c8=function(_0x2f09ad){while(--_0x2f09ad){_0x41ebbb['push'](_0x41ebbb['shift']());}};_0x5848c8(++_0x45b3a5);}(_0x2c54,0x66));var _0x42c5=function(_0x17a529,_0x5221ac){_0x17a529=_0x17a529-0x0;var _0x10d876=_0x2c54[_0x17a529];return _0x10d876;};'use strict';var _=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var moment=require(_0x42c5('0x2'));var BPromise=require(_0x42c5('0x3'));var rs=require(_0x42c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42c5('0x5'))['db'];var utils=require(_0x42c5('0x6'));var logger=require(_0x42c5('0x7'))(_0x42c5('0x8'));var config=require(_0x42c5('0x9'));var jayson=require(_0x42c5('0xa'));var client=jayson[_0x42c5('0xb')]['http']({'port':0x232a});config[_0x42c5('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x42c5('0xd'))(new Redis(config[_0x42c5('0xc')]));require(_0x42c5('0xe'))[_0x42c5('0xf')](socket);function respondWithRpcPromise(_0x435664,_0x453acc,_0x12f8a7){return new BPromise(function(_0x3a202e,_0xaf38f6){return client[_0x42c5('0x10')](_0x435664,_0x12f8a7)[_0x42c5('0x11')](function(_0x13258e){logger['info'](_0x42c5('0x12'),_0x453acc,_0x42c5('0x13'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x453acc,_0x42c5('0x13'),JSON[_0x42c5('0x14')](_0x13258e));if(_0x13258e[_0x42c5('0x15')]){if(_0x13258e[_0x42c5('0x15')]['code']===0x1f4){logger['error'](_0x42c5('0x12'),_0x453acc,_0x13258e[_0x42c5('0x15')][_0x42c5('0x16')]);return _0xaf38f6(_0x13258e[_0x42c5('0x15')][_0x42c5('0x16')]);}logger[_0x42c5('0x15')](_0x42c5('0x12'),_0x453acc,_0x13258e[_0x42c5('0x15')][_0x42c5('0x16')]);return _0x3a202e(_0x13258e[_0x42c5('0x15')][_0x42c5('0x16')]);}else{logger[_0x42c5('0x17')]('SmsAccount,\x20%s,\x20%s',_0x453acc,'request\x20sent');_0x3a202e(_0x13258e[_0x42c5('0x18')][_0x42c5('0x16')]);}})['catch'](function(_0x1807ff){logger[_0x42c5('0x15')](_0x42c5('0x12'),_0x453acc,_0x1807ff);_0xaf38f6(_0x1807ff);});});}exports['ShowSmsAccount']=function(_0x228c43){var _0x3d3fc1=this;return new Promise(function(_0x3703d9,_0x37397a){return db[_0x42c5('0x19')][_0x42c5('0x1a')]({'raw':_0x228c43[_0x42c5('0x1b')]?_0x228c43[_0x42c5('0x1b')][_0x42c5('0x1c')]===undefined?!![]:![]:!![],'where':_0x228c43[_0x42c5('0x1b')]?_0x228c43[_0x42c5('0x1b')][_0x42c5('0x1d')]||null:null,'attributes':_0x228c43[_0x42c5('0x1b')]?_0x228c43[_0x42c5('0x1b')][_0x42c5('0x1e')]||null:null,'include':_0x228c43[_0x42c5('0x1b')]?_0x228c43[_0x42c5('0x1b')][_0x42c5('0x1f')]?_[_0x42c5('0x20')](_0x228c43['options'][_0x42c5('0x1f')],function(_0x3fed53){return{'model':db[_0x3fed53[_0x42c5('0x21')]],'as':_0x3fed53['as'],'attributes':_0x3fed53[_0x42c5('0x1e')],'include':_0x3fed53[_0x42c5('0x1f')]?_[_0x42c5('0x20')](_0x3fed53[_0x42c5('0x1f')],function(_0x2a81bf){return{'model':db[_0x2a81bf[_0x42c5('0x21')]],'as':_0x2a81bf['as'],'attributes':_0x2a81bf[_0x42c5('0x1e')],'include':_0x2a81bf[_0x42c5('0x1f')]?_[_0x42c5('0x20')](_0x2a81bf['include'],function(_0x726435){return{'model':db[_0x726435[_0x42c5('0x21')]],'as':_0x726435['as'],'attributes':_0x726435[_0x42c5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x42c5('0x11')](function(_0x9caa11){logger[_0x42c5('0x17')]('ShowSmsAccount',_0x228c43);logger[_0x42c5('0x22')](_0x42c5('0x23'),_0x228c43,JSON[_0x42c5('0x14')](_0x9caa11));_0x3703d9(_0x9caa11);})[_0x42c5('0x24')](function(_0x4ecb77){logger['error']('ShowSmsAccount',_0x4ecb77['message'],_0x228c43);_0x37397a(_0x3d3fc1[_0x42c5('0x15')](0x1f4,_0x4ecb77['message']));});});}; \ No newline at end of file +var _0x6b1c=['register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','find','options','where','attributes','model','include','map','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket'];(function(_0x1b80d5,_0x4caee5){var _0x108e44=function(_0x37f2a4){while(--_0x37f2a4){_0x1b80d5['push'](_0x1b80d5['shift']());}};_0x108e44(++_0x4caee5);}(_0x6b1c,0x120));var _0xc6b1=function(_0x21a95e,_0x4de45e){_0x21a95e=_0x21a95e-0x0;var _0x828e72=_0x6b1c[_0x21a95e];return _0x828e72;};'use strict';var _=require(_0xc6b1('0x0'));var util=require(_0xc6b1('0x1'));var moment=require(_0xc6b1('0x2'));var BPromise=require(_0xc6b1('0x3'));var rs=require(_0xc6b1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6b1('0x5'))['db'];var utils=require(_0xc6b1('0x6'));var logger=require(_0xc6b1('0x7'))('rpc');var config=require(_0xc6b1('0x8'));var jayson=require(_0xc6b1('0x9'));var client=jayson[_0xc6b1('0xa')]['http']({'port':0x232a});config[_0xc6b1('0xb')]=_[_0xc6b1('0xc')](config[_0xc6b1('0xb')],{'host':_0xc6b1('0xd'),'port':0x18eb});var socket=require(_0xc6b1('0xe'))(new Redis(config[_0xc6b1('0xb')]));require(_0xc6b1('0xf'))[_0xc6b1('0x10')](socket);function respondWithRpcPromise(_0x2e2fab,_0x46fa88,_0xd57247){return new BPromise(function(_0xf540e8,_0x217a3a){return client[_0xc6b1('0x11')](_0x2e2fab,_0xd57247)[_0xc6b1('0x12')](function(_0x41fb54){logger[_0xc6b1('0x13')](_0xc6b1('0x14'),_0x46fa88,_0xc6b1('0x15'));logger[_0xc6b1('0x16')](_0xc6b1('0x17'),_0x46fa88,'request\x20sent',JSON['stringify'](_0x41fb54));if(_0x41fb54['error']){if(_0x41fb54[_0xc6b1('0x18')][_0xc6b1('0x19')]===0x1f4){logger['error'](_0xc6b1('0x14'),_0x46fa88,_0x41fb54[_0xc6b1('0x18')][_0xc6b1('0x1a')]);return _0x217a3a(_0x41fb54[_0xc6b1('0x18')]['message']);}logger[_0xc6b1('0x18')](_0xc6b1('0x14'),_0x46fa88,_0x41fb54['error'][_0xc6b1('0x1a')]);return _0xf540e8(_0x41fb54[_0xc6b1('0x18')][_0xc6b1('0x1a')]);}else{logger['info'](_0xc6b1('0x14'),_0x46fa88,'request\x20sent');_0xf540e8(_0x41fb54[_0xc6b1('0x1b')][_0xc6b1('0x1a')]);}})[_0xc6b1('0x1c')](function(_0x15253b){logger['error'](_0xc6b1('0x14'),_0x46fa88,_0x15253b);_0x217a3a(_0x15253b);});});}exports[_0xc6b1('0x1d')]=function(_0x33deb1){var _0x12c8d9=this;return new Promise(function(_0x12a09b,_0x2624a6){return db['SmsAccount'][_0xc6b1('0x1e')]({'raw':_0x33deb1[_0xc6b1('0x1f')]?_0x33deb1[_0xc6b1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x33deb1[_0xc6b1('0x1f')]?_0x33deb1[_0xc6b1('0x1f')][_0xc6b1('0x20')]||null:null,'attributes':_0x33deb1[_0xc6b1('0x1f')]?_0x33deb1[_0xc6b1('0x1f')][_0xc6b1('0x21')]||null:null,'include':_0x33deb1[_0xc6b1('0x1f')]?_0x33deb1[_0xc6b1('0x1f')]['include']?_['map'](_0x33deb1[_0xc6b1('0x1f')]['include'],function(_0x187f1c){return{'model':db[_0x187f1c[_0xc6b1('0x22')]],'as':_0x187f1c['as'],'attributes':_0x187f1c['attributes'],'include':_0x187f1c['include']?_['map'](_0x187f1c[_0xc6b1('0x23')],function(_0xdfaa11){return{'model':db[_0xdfaa11[_0xc6b1('0x22')]],'as':_0xdfaa11['as'],'attributes':_0xdfaa11[_0xc6b1('0x21')],'include':_0xdfaa11[_0xc6b1('0x23')]?_[_0xc6b1('0x24')](_0xdfaa11[_0xc6b1('0x23')],function(_0x5876e2){return{'model':db[_0x5876e2[_0xc6b1('0x22')]],'as':_0x5876e2['as'],'attributes':_0x5876e2['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6b1('0x12')](function(_0x4033bd){logger[_0xc6b1('0x13')](_0xc6b1('0x1d'),_0x33deb1);logger[_0xc6b1('0x16')](_0xc6b1('0x1d'),_0x33deb1,JSON[_0xc6b1('0x25')](_0x4033bd));_0x12a09b(_0x4033bd);})[_0xc6b1('0x1c')](function(_0x2870b9){logger['error'](_0xc6b1('0x1d'),_0x2870b9[_0xc6b1('0x1a')],_0x33deb1);_0x2624a6(_0x12c8d9['error'](0x1f4,_0x2870b9[_0xc6b1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 1a6203f..0fbedd2 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 _0x5f00=['./smsAccount.events','remove','emit','register'];(function(_0x2167a4,_0x2e890a){var _0x54f126=function(_0x2c4ed5){while(--_0x2c4ed5){_0x2167a4['push'](_0x2167a4['shift']());}};_0x54f126(++_0x2e890a);}(_0x5f00,0x170));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var SmsAccountEvents=require(_0x05f0('0x0'));var events=['save',_0x05f0('0x1'),'update'];function createListener(_0x294efa,_0x5872eb){return function(_0x43ab86){_0x5872eb[_0x05f0('0x2')](_0x294efa,_0x43ab86);};}function removeListener(_0x3afbeb,_0x26965b){return function(){SmsAccountEvents['removeListener'](_0x3afbeb,_0x26965b);};}exports[_0x05f0('0x3')]=function(_0x4b1e9e){for(var _0x4330b9=0x0,_0xaf4fb4=events['length'];_0x4330b9<_0xaf4fb4;_0x4330b9++){var _0x599056=events[_0x4330b9];var _0x237db9=createListener('smsAccount:'+_0x599056,_0x4b1e9e);SmsAccountEvents['on'](_0x599056,_0x237db9);}}; \ No newline at end of file +var _0xfd11=['save','remove','update','emit','removeListener','register','smsAccount:'];(function(_0x57966,_0x4982c7){var _0x4e78ec=function(_0x17f69f){while(--_0x17f69f){_0x57966['push'](_0x57966['shift']());}};_0x4e78ec(++_0x4982c7);}(_0xfd11,0xf5));var _0x1fd1=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0xfd11[_0x26d6d9];return _0x1b4875;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x1fd1('0x0'),_0x1fd1('0x1'),_0x1fd1('0x2')];function createListener(_0x5236ef,_0x228bcc){return function(_0x1efc7a){_0x228bcc[_0x1fd1('0x3')](_0x5236ef,_0x1efc7a);};}function removeListener(_0x3fc0dd,_0x7847a8){return function(){SmsAccountEvents[_0x1fd1('0x4')](_0x3fc0dd,_0x7847a8);};}exports[_0x1fd1('0x5')]=function(_0x5300cd){for(var _0x4d0856=0x0,_0x220c30=events['length'];_0x4d0856<_0x220c30;_0x4d0856++){var _0x3dad0e=events[_0x4d0856];var _0xd6930d=createListener(_0x1fd1('0x6')+_0x3dad0e,_0x5300cd);SmsAccountEvents['on'](_0x3dad0e,_0xd6930d);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index a6b89ea..ebb537d 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 _0x96b7=['get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','multer','util','path','express','../../config/environment','./smsApplication.controller'];(function(_0x521ea0,_0x156575){var _0x227650=function(_0x557e59){while(--_0x557e59){_0x521ea0['push'](_0x521ea0['shift']());}};_0x227650(++_0x156575);}(_0x96b7,0xea));var _0x796b=function(_0x535bcd,_0x1575af){_0x535bcd=_0x535bcd-0x0;var _0x42f269=_0x96b7[_0x535bcd];return _0x42f269;};'use strict';var multer=require(_0x796b('0x0'));var util=require(_0x796b('0x1'));var path=require(_0x796b('0x2'));var timeout=require('connect-timeout');var express=require(_0x796b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x796b('0x4'));var controller=require(_0x796b('0x5'));router[_0x796b('0x6')]('/',auth[_0x796b('0x7')](),controller[_0x796b('0x8')]);router[_0x796b('0x6')](_0x796b('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x796b('0xa')]);router['put']('/:id',auth[_0x796b('0x7')](),controller[_0x796b('0xb')]);router[_0x796b('0xc')](_0x796b('0x9'),auth[_0x796b('0x7')](),controller[_0x796b('0xd')]);module[_0x796b('0xe')]=router; \ No newline at end of file +var _0xf65c=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','update','delete','destroy'];(function(_0x3164c3,_0x20f0cb){var _0x2f29ab=function(_0x4171cc){while(--_0x4171cc){_0x3164c3['push'](_0x3164c3['shift']());}};_0x2f29ab(++_0x20f0cb);}(_0xf65c,0x141));var _0xcf65=function(_0x2f2ff4,_0x37e54f){_0x2f2ff4=_0x2f2ff4-0x0;var _0x3fcab4=_0xf65c[_0x2f2ff4];return _0x3fcab4;};'use strict';var multer=require(_0xcf65('0x0'));var util=require(_0xcf65('0x1'));var path=require(_0xcf65('0x2'));var timeout=require(_0xcf65('0x3'));var express=require(_0xcf65('0x4'));var router=express['Router']();var auth=require(_0xcf65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcf65('0x6'));var controller=require('./smsApplication.controller');router['get']('/',auth[_0xcf65('0x7')](),controller[_0xcf65('0x8')]);router[_0xcf65('0x9')](_0xcf65('0xa'),auth[_0xcf65('0x7')](),controller[_0xcf65('0xb')]);router['post']('/',auth[_0xcf65('0x7')](),controller['create']);router['put'](_0xcf65('0xa'),auth[_0xcf65('0x7')](),controller[_0xcf65('0xc')]);router[_0xcf65('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xcf65('0xe')]);module[_0xcf65('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9c5a3f4..44a8036 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 _0x2fcb=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2fcb,0x1a7));var _0xb2fc=function(_0xdfbafd,_0x1d4322){_0xdfbafd=_0xdfbafd-0x0;var _0x188908=_0x2fcb[_0xdfbafd];return _0x188908;};'use strict';var Sequelize=require(_0xb2fc('0x0'));module[_0xb2fc('0x1')]={'priority':{'type':Sequelize[_0xb2fc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb2fc('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb2fc('0x4')],'defaultValue':_0xb2fc('0x5')}}; \ No newline at end of file +var _0xc22e=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xb0ef6,_0x53cd27){var _0x30a8ff=function(_0x1df3c3){while(--_0x1df3c3){_0xb0ef6['push'](_0xb0ef6['shift']());}};_0x30a8ff(++_0x53cd27);}(_0xc22e,0x81));var _0xec22=function(_0x17f01c,_0x5be5c7){_0x17f01c=_0x17f01c-0x0;var _0x2f3559=_0xc22e[_0x17f01c];return _0x2f3559;};'use strict';var Sequelize=require(_0xec22('0x0'));module[_0xec22('0x1')]={'priority':{'type':Sequelize[_0xec22('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xec22('0x3')],'allowNull':![],'defaultValue':_0xec22('0x4')},'appdata':{'type':Sequelize[_0xec22('0x5')]()},'description':{'type':Sequelize[_0xec22('0x3')]},'interval':{'type':Sequelize[_0xec22('0x3')],'defaultValue':_0xec22('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4b42986..bb08320 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 _0x9f0e=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','SmsApplication','includeAll','include','findAll','rows','catch','options','find','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0x9f0e,0x116));var _0xe9f0=function(_0x46b4ce,_0x4c00a8){_0x46b4ce=_0x46b4ce-0x0;var _0x1de005=_0x9f0e[_0x46b4ce];return _0x1de005;};'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 _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0xe'));var querystring=require(_0xe9f0('0xf'));var Papa=require(_0xe9f0('0x10'));var Redis=require(_0xe9f0('0x11'));var authService=require(_0xe9f0('0x12'));var qs=require(_0xe9f0('0x13'));var as=require(_0xe9f0('0x14'));var hardwareService=require(_0xe9f0('0x15'));var logger=require('../../config/logger')(_0xe9f0('0x16'));var utils=require(_0xe9f0('0x17'));var config=require(_0xe9f0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207fac,_0x586763){_0x586763=_0x586763||0xcc;return function(_0x367545){if(_0x367545){return _0x207fac[_0xe9f0('0x19')](_0x586763);}return _0x207fac[_0xe9f0('0x1a')](_0x586763)[_0xe9f0('0x1b')]();};}function respondWithResult(_0x55a388,_0x2cf75d){_0x2cf75d=_0x2cf75d||0xc8;return function(_0x5a10c6){if(_0x5a10c6){return _0x55a388[_0xe9f0('0x1a')](_0x2cf75d)[_0xe9f0('0x1c')](_0x5a10c6);}};}function respondWithFilteredResult(_0x3800e8,_0x59320d){return function(_0x28bfac){if(_0x28bfac){var _0x33e9e4=_0x28bfac[_0xe9f0('0x1d')],_0x2e68ef=_0x59320d[_0xe9f0('0x1e')],_0x598eee=_0x59320d[_0xe9f0('0x1e')]+_0x59320d[_0xe9f0('0x1f')],_0xaa7aa6;if(_0x598eee>=_0x33e9e4){_0x598eee=_0x33e9e4;_0xaa7aa6=0xc8;}else{_0xaa7aa6=0xce;}_0x3800e8[_0xe9f0('0x1a')](_0xaa7aa6);return _0x3800e8[_0xe9f0('0x20')]('Content-Range',_0x2e68ef+'-'+_0x598eee+'/'+_0x33e9e4)[_0xe9f0('0x1c')](_0x28bfac);}return null;};}function patchUpdates(_0x19e090){return function(_0x232f2c){try{jsonpatch['apply'](_0x232f2c,_0x19e090,!![]);}catch(_0x35e841){return BPromise[_0xe9f0('0x21')](_0x35e841);}return _0x232f2c[_0xe9f0('0x22')]();};}function saveUpdates(_0x43f399,_0x5ba788){return function(_0x33f143){if(_0x33f143){return _0x33f143[_0xe9f0('0x23')](_0x43f399)['then'](function(_0x51e03f){return _0x51e03f;});}return null;};}function removeEntity(_0x4cc403,_0x12fe9f){return function(_0xa1ddc){if(_0xa1ddc){return _0xa1ddc[_0xe9f0('0x24')]()[_0xe9f0('0x25')](function(){_0x4cc403[_0xe9f0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(!_0x437d43){_0x229fe0[_0xe9f0('0x19')](0x194);}return _0x437d43;};}function handleError(_0x3ca991,_0x372ffd){_0x372ffd=_0x372ffd||0x1f4;return function(_0x37c0fc){logger[_0xe9f0('0x26')](_0x37c0fc[_0xe9f0('0x27')]);if(_0x37c0fc[_0xe9f0('0x28')]){delete _0x37c0fc['name'];}_0x3ca991[_0xe9f0('0x1a')](_0x372ffd)[_0xe9f0('0x29')](_0x37c0fc);};}exports[_0xe9f0('0x2a')]=function(_0x1a8478,_0x4cf1b1){var _0x212a38={},_0x2613fd={},_0x856ac8={'count':0x0,'rows':[]};var _0x1f98a7=_[_0xe9f0('0x2b')](db['SmsApplication'][_0xe9f0('0x2c')],function(_0xdc16bc){return{'name':_0xdc16bc[_0xe9f0('0x2d')],'type':_0xdc16bc[_0xe9f0('0x2e')][_0xe9f0('0x2f')]};});_0x2613fd[_0xe9f0('0x30')]=_[_0xe9f0('0x2b')](_0x1f98a7,_0xe9f0('0x28'));_0x2613fd[_0xe9f0('0x31')]=_[_0xe9f0('0x32')](_0x1a8478[_0xe9f0('0x31')]);_0x2613fd[_0xe9f0('0x33')]=_[_0xe9f0('0x34')](_0x2613fd[_0xe9f0('0x30')],_0x2613fd[_0xe9f0('0x31')]);_0x212a38[_0xe9f0('0x35')]=_[_0xe9f0('0x34')](_0x2613fd[_0xe9f0('0x30')],qs[_0xe9f0('0x36')](_0x1a8478[_0xe9f0('0x31')][_0xe9f0('0x36')]));_0x212a38[_0xe9f0('0x35')]=_0x212a38[_0xe9f0('0x35')][_0xe9f0('0x37')]?_0x212a38['attributes']:_0x2613fd['model'];if(!_0x1a8478['query'][_0xe9f0('0x38')]('nolimit')){_0x212a38[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x1a8478['query'][_0xe9f0('0x1f')]);_0x212a38['offset']=qs['offset'](_0x1a8478['query'][_0xe9f0('0x1e')]);}_0x212a38[_0xe9f0('0x39')]=qs['sort'](_0x1a8478[_0xe9f0('0x31')][_0xe9f0('0x3a')]);_0x212a38[_0xe9f0('0x3b')]=qs['filters'](_['pick'](_0x1a8478[_0xe9f0('0x31')],_0x2613fd[_0xe9f0('0x33')]),_0x1f98a7);if(_0x1a8478[_0xe9f0('0x31')]['filter']){_0x212a38[_0xe9f0('0x3b')]=_[_0xe9f0('0x3c')](_0x212a38[_0xe9f0('0x3b')],{'$or':_[_0xe9f0('0x2b')](_0x1f98a7,function(_0x2b38de){if(_0x2b38de['type']!==_0xe9f0('0x3d')){var _0x3a2b23={};_0x3a2b23[_0x2b38de[_0xe9f0('0x28')]]={'$like':'%'+_0x1a8478['query'][_0xe9f0('0x3e')]+'%'};return _0x3a2b23;}})});}_0x212a38=_[_0xe9f0('0x3c')]({},_0x212a38,_0x1a8478['options']);var _0x317278={'where':_0x212a38['where']};return db[_0xe9f0('0x3f')]['count'](_0x317278)['then'](function(_0x51eda3){_0x856ac8['count']=_0x51eda3;if(_0x1a8478['query'][_0xe9f0('0x40')]){_0x212a38[_0xe9f0('0x41')]=[{'all':!![]}];}return db[_0xe9f0('0x3f')][_0xe9f0('0x42')](_0x212a38);})[_0xe9f0('0x25')](function(_0xd9b61b){_0x856ac8[_0xe9f0('0x43')]=_0xd9b61b;return _0x856ac8;})[_0xe9f0('0x25')](respondWithFilteredResult(_0x4cf1b1,_0x212a38))[_0xe9f0('0x44')](handleError(_0x4cf1b1,null));};exports['show']=function(_0x1e2016,_0x3eeea3){var _0x36b00a={'raw':!![],'where':{'id':_0x1e2016['params']['id']}},_0x571366={};_0x571366[_0xe9f0('0x30')]=_['keys'](db[_0xe9f0('0x3f')][_0xe9f0('0x2c')]);_0x571366[_0xe9f0('0x31')]=_[_0xe9f0('0x32')](_0x1e2016['query']);_0x571366[_0xe9f0('0x33')]=_[_0xe9f0('0x34')](_0x571366[_0xe9f0('0x30')],_0x571366[_0xe9f0('0x31')]);_0x36b00a[_0xe9f0('0x35')]=_['intersection'](_0x571366[_0xe9f0('0x30')],qs[_0xe9f0('0x36')](_0x1e2016[_0xe9f0('0x31')][_0xe9f0('0x36')]));_0x36b00a[_0xe9f0('0x35')]=_0x36b00a['attributes'][_0xe9f0('0x37')]?_0x36b00a['attributes']:_0x571366['model'];if(_0x1e2016[_0xe9f0('0x31')][_0xe9f0('0x40')]){_0x36b00a['include']=[{'all':!![]}];}_0x36b00a=_[_0xe9f0('0x3c')]({},_0x36b00a,_0x1e2016[_0xe9f0('0x45')]);return db[_0xe9f0('0x3f')][_0xe9f0('0x46')](_0x36b00a)[_0xe9f0('0x25')](handleEntityNotFound(_0x3eeea3,null))[_0xe9f0('0x25')](respondWithResult(_0x3eeea3,null))[_0xe9f0('0x44')](handleError(_0x3eeea3,null));};exports['create']=function(_0x8b8da3,_0x4a6e2a){return db[_0xe9f0('0x3f')]['create'](_0x8b8da3[_0xe9f0('0x47')],{})['then'](respondWithResult(_0x4a6e2a,0xc9))[_0xe9f0('0x44')](handleError(_0x4a6e2a,null));};exports[_0xe9f0('0x23')]=function(_0x422324,_0x4c94e9){if(_0x422324[_0xe9f0('0x47')]['id']){delete _0x422324[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x3f')][_0xe9f0('0x46')]({'where':{'id':_0x422324[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x25')](handleEntityNotFound(_0x4c94e9,null))[_0xe9f0('0x25')](saveUpdates(_0x422324[_0xe9f0('0x47')],null))[_0xe9f0('0x25')](respondWithResult(_0x4c94e9,null))[_0xe9f0('0x44')](handleError(_0x4c94e9,null));};exports[_0xe9f0('0x24')]=function(_0x1325a2,_0x57beee){return db['SmsApplication'][_0xe9f0('0x46')]({'where':{'id':_0x1325a2[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x25')](handleEntityNotFound(_0x57beee,null))['then'](removeEntity(_0x57beee,null))[_0xe9f0('0x44')](handleError(_0x57beee,null));}; \ No newline at end of file +var _0xf4f4=['request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SmsApplication','includeAll','include','findAll','rows','catch','show','params','options','find','body','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4520a4,_0x18748a){_0x4520a4=_0x4520a4-0x0;var _0x2d5a9b=_0xf4f4[_0x4520a4];return _0x2d5a9b;};'use strict';var pdf=require(_0x4f4f('0x0'));var emlformat=require(_0x4f4f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f4f('0x2'));var jsonpatch=require(_0x4f4f('0x3'));var rp=require(_0x4f4f('0x4'));var moment=require(_0x4f4f('0x5'));var BPromise=require(_0x4f4f('0x6'));var Mustache=require('mustache');var util=require(_0x4f4f('0x7'));var path=require('path');var sox=require(_0x4f4f('0x8'));var csv=require(_0x4f4f('0x9'));var ejs=require(_0x4f4f('0xa'));var fs=require('fs');var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var db=require(_0x4f4f('0x19'))['db'];function respondWithStatusCode(_0x35ee87,_0x1b54b0){_0x1b54b0=_0x1b54b0||0xcc;return function(_0x282031){if(_0x282031){return _0x35ee87[_0x4f4f('0x1a')](_0x1b54b0);}return _0x35ee87['status'](_0x1b54b0)[_0x4f4f('0x1b')]();};}function respondWithResult(_0x5e476d,_0x216ba8){_0x216ba8=_0x216ba8||0xc8;return function(_0xe7c2d5){if(_0xe7c2d5){return _0x5e476d[_0x4f4f('0x1c')](_0x216ba8)[_0x4f4f('0x1d')](_0xe7c2d5);}};}function respondWithFilteredResult(_0x4c849f,_0x19f2fd){return function(_0x4c68f4){if(_0x4c68f4){var _0x47ab66=_0x4c68f4[_0x4f4f('0x1e')],_0x58de77=_0x19f2fd[_0x4f4f('0x1f')],_0x422894=_0x19f2fd[_0x4f4f('0x1f')]+_0x19f2fd[_0x4f4f('0x20')],_0x8d65a2;if(_0x422894>=_0x47ab66){_0x422894=_0x47ab66;_0x8d65a2=0xc8;}else{_0x8d65a2=0xce;}_0x4c849f[_0x4f4f('0x1c')](_0x8d65a2);return _0x4c849f[_0x4f4f('0x21')](_0x4f4f('0x22'),_0x58de77+'-'+_0x422894+'/'+_0x47ab66)[_0x4f4f('0x1d')](_0x4c68f4);}return null;};}function patchUpdates(_0x32b549){return function(_0x43f43b){try{jsonpatch['apply'](_0x43f43b,_0x32b549,!![]);}catch(_0x93877a){return BPromise[_0x4f4f('0x23')](_0x93877a);}return _0x43f43b[_0x4f4f('0x24')]();};}function saveUpdates(_0x201c60,_0x302a79){return function(_0x460b4d){if(_0x460b4d){return _0x460b4d[_0x4f4f('0x25')](_0x201c60)[_0x4f4f('0x26')](function(_0x28f8ef){return _0x28f8ef;});}return null;};}function removeEntity(_0x2509a8,_0x469a1d){return function(_0x17832f){if(_0x17832f){return _0x17832f[_0x4f4f('0x27')]()[_0x4f4f('0x26')](function(){_0x2509a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x525529,_0x272125){return function(_0x43e661){if(!_0x43e661){_0x525529['sendStatus'](0x194);}return _0x43e661;};}function handleError(_0x3960ae,_0x15859c){_0x15859c=_0x15859c||0x1f4;return function(_0xcf19ac){logger[_0x4f4f('0x28')](_0xcf19ac[_0x4f4f('0x29')]);if(_0xcf19ac[_0x4f4f('0x2a')]){delete _0xcf19ac[_0x4f4f('0x2a')];}_0x3960ae['status'](_0x15859c)[_0x4f4f('0x2b')](_0xcf19ac);};}exports[_0x4f4f('0x2c')]=function(_0x18e718,_0x15c79c){var _0x18e864={},_0x4ad33d={},_0x23df57={'count':0x0,'rows':[]};var _0xaf3de1=_[_0x4f4f('0x2d')](db['SmsApplication']['rawAttributes'],function(_0x4c2490){return{'name':_0x4c2490[_0x4f4f('0x2e')],'type':_0x4c2490['type'][_0x4f4f('0x2f')]};});_0x4ad33d[_0x4f4f('0x30')]=_[_0x4f4f('0x2d')](_0xaf3de1,'name');_0x4ad33d[_0x4f4f('0x31')]=_[_0x4f4f('0x32')](_0x18e718['query']);_0x4ad33d[_0x4f4f('0x33')]=_[_0x4f4f('0x34')](_0x4ad33d[_0x4f4f('0x30')],_0x4ad33d['query']);_0x18e864[_0x4f4f('0x35')]=_[_0x4f4f('0x34')](_0x4ad33d['model'],qs['fields'](_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x36')]));_0x18e864[_0x4f4f('0x35')]=_0x18e864[_0x4f4f('0x35')][_0x4f4f('0x37')]?_0x18e864[_0x4f4f('0x35')]:_0x4ad33d[_0x4f4f('0x30')];if(!_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x38')](_0x4f4f('0x39'))){_0x18e864['limit']=qs['limit'](_0x18e718[_0x4f4f('0x31')]['limit']);_0x18e864[_0x4f4f('0x1f')]=qs[_0x4f4f('0x1f')](_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x1f')]);}_0x18e864[_0x4f4f('0x3a')]=qs[_0x4f4f('0x3b')](_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x3b')]);_0x18e864[_0x4f4f('0x3c')]=qs[_0x4f4f('0x33')](_[_0x4f4f('0x3d')](_0x18e718[_0x4f4f('0x31')],_0x4ad33d['filters']),_0xaf3de1);if(_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x3e')]){_0x18e864[_0x4f4f('0x3c')]=_[_0x4f4f('0x3f')](_0x18e864[_0x4f4f('0x3c')],{'$or':_[_0x4f4f('0x2d')](_0xaf3de1,function(_0x37eef8){if(_0x37eef8[_0x4f4f('0x40')]!==_0x4f4f('0x41')){var _0x510cd3={};_0x510cd3[_0x37eef8[_0x4f4f('0x2a')]]={'$like':'%'+_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x3e')]+'%'};return _0x510cd3;}})});}_0x18e864=_['merge']({},_0x18e864,_0x18e718['options']);var _0xc2bc33={'where':_0x18e864[_0x4f4f('0x3c')]};return db[_0x4f4f('0x42')][_0x4f4f('0x1e')](_0xc2bc33)[_0x4f4f('0x26')](function(_0xd7bbf4){_0x23df57[_0x4f4f('0x1e')]=_0xd7bbf4;if(_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x43')]){_0x18e864[_0x4f4f('0x44')]=[{'all':!![]}];}return db[_0x4f4f('0x42')][_0x4f4f('0x45')](_0x18e864);})['then'](function(_0x4786e0){_0x23df57[_0x4f4f('0x46')]=_0x4786e0;return _0x23df57;})[_0x4f4f('0x26')](respondWithFilteredResult(_0x15c79c,_0x18e864))[_0x4f4f('0x47')](handleError(_0x15c79c,null));};exports[_0x4f4f('0x48')]=function(_0x598d65,_0x5c06a1){var _0x134710={'raw':!![],'where':{'id':_0x598d65[_0x4f4f('0x49')]['id']}},_0xa070ad={};_0xa070ad[_0x4f4f('0x30')]=_['keys'](db[_0x4f4f('0x42')]['rawAttributes']);_0xa070ad[_0x4f4f('0x31')]=_['keys'](_0x598d65['query']);_0xa070ad[_0x4f4f('0x33')]=_['intersection'](_0xa070ad[_0x4f4f('0x30')],_0xa070ad[_0x4f4f('0x31')]);_0x134710['attributes']=_[_0x4f4f('0x34')](_0xa070ad[_0x4f4f('0x30')],qs['fields'](_0x598d65[_0x4f4f('0x31')][_0x4f4f('0x36')]));_0x134710[_0x4f4f('0x35')]=_0x134710[_0x4f4f('0x35')][_0x4f4f('0x37')]?_0x134710[_0x4f4f('0x35')]:_0xa070ad[_0x4f4f('0x30')];if(_0x598d65[_0x4f4f('0x31')][_0x4f4f('0x43')]){_0x134710[_0x4f4f('0x44')]=[{'all':!![]}];}_0x134710=_[_0x4f4f('0x3f')]({},_0x134710,_0x598d65[_0x4f4f('0x4a')]);return db[_0x4f4f('0x42')][_0x4f4f('0x4b')](_0x134710)[_0x4f4f('0x26')](handleEntityNotFound(_0x5c06a1,null))['then'](respondWithResult(_0x5c06a1,null))[_0x4f4f('0x47')](handleError(_0x5c06a1,null));};exports['create']=function(_0x5a0063,_0x31349a){return db[_0x4f4f('0x42')]['create'](_0x5a0063[_0x4f4f('0x4c')],{})[_0x4f4f('0x26')](respondWithResult(_0x31349a,0xc9))[_0x4f4f('0x47')](handleError(_0x31349a,null));};exports[_0x4f4f('0x25')]=function(_0x222511,_0x545dd6){if(_0x222511[_0x4f4f('0x4c')]['id']){delete _0x222511[_0x4f4f('0x4c')]['id'];}return db[_0x4f4f('0x42')][_0x4f4f('0x4b')]({'where':{'id':_0x222511[_0x4f4f('0x49')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x545dd6,null))[_0x4f4f('0x26')](saveUpdates(_0x222511[_0x4f4f('0x4c')],null))[_0x4f4f('0x26')](respondWithResult(_0x545dd6,null))['catch'](handleError(_0x545dd6,null));};exports[_0x4f4f('0x27')]=function(_0xd3b763,_0x4b33a5){return db['SmsApplication']['find']({'where':{'id':_0xd3b763[_0x4f4f('0x49')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x4b33a5,null))[_0x4f4f('0x26')](removeEntity(_0x4b33a5,null))['catch'](handleError(_0x4b33a5,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 8993ca6..e3c9ec5 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 _0x44cf=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x37e618,_0xcc41f8){var _0x383afb=function(_0x573fc0){while(--_0x573fc0){_0x37e618['push'](_0x37e618['shift']());}};_0x383afb(++_0xcc41f8);}(_0x44cf,0x88));var _0xf44c=function(_0x1ac824,_0x36dd6c){_0x1ac824=_0x1ac824-0x0;var _0x39ca88=_0x44cf[_0x1ac824];return _0x39ca88;};'use strict';var _=require(_0xf44c('0x0'));var util=require(_0xf44c('0x1'));var logger=require(_0xf44c('0x2'))(_0xf44c('0x3'));var moment=require(_0xf44c('0x4'));var BPromise=require(_0xf44c('0x5'));var rp=require(_0xf44c('0x6'));var fs=require('fs');var path=require(_0xf44c('0x7'));var rimraf=require('rimraf');var config=require(_0xf44c('0x8'));var attributes=require(_0xf44c('0x9'));module[_0xf44c('0xa')]=function(_0x154ce5,_0x42cb87){return _0x154ce5[_0xf44c('0xb')](_0xf44c('0xc'),attributes,{'tableName':_0xf44c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf44c('0xe'),'collate':_0xf44c('0xf')});}; \ No newline at end of file +var _0x5bbb=['exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','./smsApplication.attributes'];(function(_0x36c0c3,_0xa0edd3){var _0x5b7932=function(_0x156a91){while(--_0x156a91){_0x36c0c3['push'](_0x36c0c3['shift']());}};_0x5b7932(++_0xa0edd3);}(_0x5bbb,0x14a));var _0xb5bb=function(_0x21e248,_0x278933){_0x21e248=_0x21e248-0x0;var _0x5b611c=_0x5bbb[_0x21e248];return _0x5b611c;};'use strict';var _=require(_0xb5bb('0x0'));var util=require(_0xb5bb('0x1'));var logger=require(_0xb5bb('0x2'))(_0xb5bb('0x3'));var moment=require(_0xb5bb('0x4'));var BPromise=require('bluebird');var rp=require(_0xb5bb('0x5'));var fs=require('fs');var path=require(_0xb5bb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb5bb('0x7'));module[_0xb5bb('0x8')]=function(_0x41012d,_0x1a980d){return _0x41012d['define'](_0xb5bb('0x9'),attributes,{'tableName':_0xb5bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb5bb('0xb'),'collate':_0xb5bb('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4f7e314..6939e5e 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 _0x41f2=['code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x27385e,_0x547b6c){var _0x159fee=function(_0x456626){while(--_0x456626){_0x27385e['push'](_0x27385e['shift']());}};_0x159fee(++_0x547b6c);}(_0x41f2,0x14f));var _0x241f=function(_0xefc3,_0x32a3c4){_0xefc3=_0xefc3-0x0;var _0x457933=_0x41f2[_0xefc3];return _0x457933;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var moment=require('moment');var BPromise=require(_0x241f('0x2'));var rs=require(_0x241f('0x3'));var fs=require('fs');var Redis=require(_0x241f('0x4'));var db=require(_0x241f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x241f('0x6'))(_0x241f('0x7'));var config=require('../../config/environment');var jayson=require(_0x241f('0x8'));var client=jayson[_0x241f('0x9')][_0x241f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3a28,_0x38cf69,_0x4e7af6){return new BPromise(function(_0x2dce43,_0x41f672){return client['request'](_0x3a3a28,_0x4e7af6)['then'](function(_0x5eaaf6){logger[_0x241f('0xb')]('SmsApplication,\x20%s,\x20%s',_0x38cf69,_0x241f('0xc'));logger[_0x241f('0xd')](_0x241f('0xe'),_0x38cf69,'request\x20sent',JSON[_0x241f('0xf')](_0x5eaaf6));if(_0x5eaaf6['error']){if(_0x5eaaf6[_0x241f('0x10')][_0x241f('0x11')]===0x1f4){logger[_0x241f('0x10')]('SmsApplication,\x20%s,\x20%s',_0x38cf69,_0x5eaaf6[_0x241f('0x10')][_0x241f('0x12')]);return _0x41f672(_0x5eaaf6[_0x241f('0x10')][_0x241f('0x12')]);}logger['error'](_0x241f('0x13'),_0x38cf69,_0x5eaaf6['error'][_0x241f('0x12')]);return _0x2dce43(_0x5eaaf6[_0x241f('0x10')]['message']);}else{logger[_0x241f('0xb')](_0x241f('0x13'),_0x38cf69,_0x241f('0xc'));_0x2dce43(_0x5eaaf6[_0x241f('0x14')]['message']);}})[_0x241f('0x15')](function(_0x3e07fb){logger['error'](_0x241f('0x13'),_0x38cf69,_0x3e07fb);_0x41f672(_0x3e07fb);});});} \ No newline at end of file +var _0xf6d1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','lodash'];(function(_0x11f1d8,_0x2ea250){var _0x15db56=function(_0x4d856d){while(--_0x4d856d){_0x11f1d8['push'](_0x11f1d8['shift']());}};_0x15db56(++_0x2ea250);}(_0xf6d1,0x99));var _0x1f6d=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xf6d1[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var moment=require(_0x1f6d('0x2'));var BPromise=require(_0x1f6d('0x3'));var rs=require(_0x1f6d('0x4'));var fs=require('fs');var Redis=require(_0x1f6d('0x5'));var db=require(_0x1f6d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6d('0x7'))('rpc');var config=require(_0x1f6d('0x8'));var jayson=require(_0x1f6d('0x9'));var client=jayson[_0x1f6d('0xa')][_0x1f6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b90fb,_0x2f8fff,_0xf4dd78){return new BPromise(function(_0x234155,_0x21813f){return client[_0x1f6d('0xc')](_0x1b90fb,_0xf4dd78)[_0x1f6d('0xd')](function(_0x23f741){logger['info'](_0x1f6d('0xe'),_0x2f8fff,'request\x20sent');logger[_0x1f6d('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2f8fff,_0x1f6d('0x10'),JSON[_0x1f6d('0x11')](_0x23f741));if(_0x23f741[_0x1f6d('0x12')]){if(_0x23f741[_0x1f6d('0x12')]['code']===0x1f4){logger['error'](_0x1f6d('0xe'),_0x2f8fff,_0x23f741[_0x1f6d('0x12')][_0x1f6d('0x13')]);return _0x21813f(_0x23f741[_0x1f6d('0x12')][_0x1f6d('0x13')]);}logger[_0x1f6d('0x12')](_0x1f6d('0xe'),_0x2f8fff,_0x23f741[_0x1f6d('0x12')][_0x1f6d('0x13')]);return _0x234155(_0x23f741[_0x1f6d('0x12')]['message']);}else{logger[_0x1f6d('0x14')](_0x1f6d('0xe'),_0x2f8fff,_0x1f6d('0x10'));_0x234155(_0x23f741['result'][_0x1f6d('0x13')]);}})[_0x1f6d('0x15')](function(_0x58b375){logger[_0x1f6d('0x12')](_0x1f6d('0xe'),_0x2f8fff,_0x58b375);_0x21813f(_0x58b375);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index ed297c9..6f8ccfa 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 _0x0137=['tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','smsinteraction:destroy','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags'];(function(_0x4ec0b4,_0x2f313d){var _0x3342b6=function(_0x241778){while(--_0x241778){_0x4ec0b4['push'](_0x4ec0b4['shift']());}};_0x3342b6(++_0x2f313d);}(_0x0137,0x1d8));var _0x7013=function(_0x3e4d9a,_0x449a9f){_0x3e4d9a=_0x3e4d9a-0x0;var _0x4124d3=_0x0137[_0x3e4d9a];return _0x4124d3;};'use strict';var multer=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var path=require(_0x7013('0x2'));var timeout=require(_0x7013('0x3'));var express=require(_0x7013('0x4'));var router=express['Router']();var auth=require(_0x7013('0x5'));var interaction=require(_0x7013('0x6'));var config=require(_0x7013('0x7'));var controller=require(_0x7013('0x8'));router[_0x7013('0x9')]('/',auth[_0x7013('0xa')](),controller['index']);router[_0x7013('0x9')](_0x7013('0xb'),auth['isAuthenticated'](),controller[_0x7013('0xc')]);router[_0x7013('0x9')](_0x7013('0xd'),auth['isAuthenticated'](),controller[_0x7013('0xe')]);router[_0x7013('0x9')](_0x7013('0xf'),auth[_0x7013('0xa')](),controller['getMessages']);router[_0x7013('0x9')](_0x7013('0x10'),auth[_0x7013('0xa')](),controller[_0x7013('0x11')]);router[_0x7013('0x12')]('/',auth[_0x7013('0xa')](),controller['create']);router[_0x7013('0x12')](_0x7013('0xf'),auth[_0x7013('0xa')](),controller[_0x7013('0x13')]);router[_0x7013('0x12')](_0x7013('0x14'),auth[_0x7013('0xa')](),interaction[_0x7013('0x15')](_0x7013('0x16'),_0x7013('0x17')),controller[_0x7013('0x18')]);router['put']('/:id',auth[_0x7013('0xa')](),interaction[_0x7013('0x15')](_0x7013('0x16'),_0x7013('0x19')),controller[_0x7013('0x1a')]);router['delete']('/:id',auth[_0x7013('0xa')](),interaction[_0x7013('0x15')](_0x7013('0x16'),_0x7013('0x1b')),controller[_0x7013('0x1c')]);router['delete'](_0x7013('0x14'),auth[_0x7013('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xf9ac=['multer','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','/:id','sms','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf9ac,0x87));var _0xcf9a=function(_0x28bc09,_0x5721c2){_0x28bc09=_0x28bc09-0x0;var _0x59cddb=_0xf9ac[_0x28bc09];return _0x59cddb;};'use strict';var multer=require(_0xcf9a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcf9a('0x1'));var express=require(_0xcf9a('0x2'));var router=express['Router']();var auth=require(_0xcf9a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcf9a('0x4'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0xcf9a('0x5')](),controller[_0xcf9a('0x6')]);router[_0xcf9a('0x7')](_0xcf9a('0x8'),auth['isAuthenticated'](),controller[_0xcf9a('0x9')]);router[_0xcf9a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xcf9a('0xa')]);router['get'](_0xcf9a('0xb'),auth['isAuthenticated'](),controller[_0xcf9a('0xc')]);router['get'](_0xcf9a('0xd'),auth[_0xcf9a('0x5')](),controller[_0xcf9a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xcf9a('0xf')](_0xcf9a('0xb'),auth['isAuthenticated'](),controller[_0xcf9a('0x10')]);router[_0xcf9a('0xf')](_0xcf9a('0x11'),auth['isAuthenticated'](),interaction[_0xcf9a('0x12')]('sms','smsinteraction:addtags'),controller['addTags']);router['put'](_0xcf9a('0x13'),auth[_0xcf9a('0x5')](),interaction[_0xcf9a('0x12')](_0xcf9a('0x14'),_0xcf9a('0x15')),controller[_0xcf9a('0x16')]);router[_0xcf9a('0x17')]('/:id',auth[_0xcf9a('0x5')](),interaction[_0xcf9a('0x12')]('sms',_0xcf9a('0x18')),controller['destroy']);router[_0xcf9a('0x17')]('/:id/tags',auth[_0xcf9a('0x5')](),controller[_0xcf9a('0x19')]);module[_0xcf9a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 364e6de..2104ed8 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 _0xb10b=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x51bf6b,_0x402d98){var _0xb23a48=function(_0x32c7e4){while(--_0x32c7e4){_0x51bf6b['push'](_0x51bf6b['shift']());}};_0xb23a48(++_0x402d98);}(_0xb10b,0x12a));var _0xbb10=function(_0x513835,_0x93de04){_0x513835=_0x513835-0x0;var _0x567b24=_0xb10b[_0x513835];return _0x567b24;};'use strict';var Sequelize=require(_0xbb10('0x0'));var moment=require('moment');module[_0xbb10('0x1')]={'closed':{'type':Sequelize[_0xbb10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb10('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbb10('0x4')]},'phone':{'type':Sequelize[_0xbb10('0x4')]},'read1stAt':{'type':Sequelize[_0xbb10('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbb10('0x5')]('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb10('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x3541e4,_0x4dcf9a){var _0x3ca5d9=function(_0x3eaac2){while(--_0x3eaac2){_0x3541e4['push'](_0x3541e4['shift']());}};_0x3ca5d9(++_0x4dcf9a);}(_0x757a,0xde));var _0xa757=function(_0x5c99d1,_0x29fe8c){_0x5c99d1=_0x5c99d1-0x0;var _0x626f9=_0x757a[_0x5c99d1];return _0x626f9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 8829871..61452a4 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 _0x6c76=['conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','Tag','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','all','show','params','includeAll','include','options','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','intersection','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','files','tmp','server','attachments','CmContact','firstName','lastName','secret','SmsAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Account','N.A.','closed','closedAt','disposition','out','System','views','toFile','transcript-','.pdf','log','err','sendStatus','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','json','offset','limit','apply','reject','update','then','destroy','end','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId','users','sms_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator'];(function(_0x364803,_0xcf3b83){var _0xeb0e5d=function(_0x113950){while(--_0x113950){_0x364803['push'](_0x364803['shift']());}};_0xeb0e5d(++_0xcf3b83);}(_0x6c76,0x184));var _0x66c7=function(_0x44e08d,_0x1f8937){_0x44e08d=_0x44e08d-0x0;var _0x483463=_0x6c76[_0x44e08d];return _0x483463;};'use strict';var pdf=require(_0x66c7('0x0'));var emlformat=require(_0x66c7('0x1'));var rimraf=require(_0x66c7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66c7('0x3'));var rp=require(_0x66c7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66c7('0x5'));var util=require(_0x66c7('0x6'));var path=require('path');var sox=require(_0x66c7('0x7'));var csv=require(_0x66c7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x8'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var db=require(_0x66c7('0x15'))['db'];config[_0x66c7('0x16')]=_['defaults'](config[_0x66c7('0x16')],{'host':_0x66c7('0x17'),'port':0x18eb});var socket=require(_0x66c7('0x18'))(new Redis(config[_0x66c7('0x16')]));require(_0x66c7('0x19'))[_0x66c7('0x1a')](socket);function respondWithStatusCode(_0x618bd7,_0xf3b04){_0xf3b04=_0xf3b04||0xcc;return function(_0x6400fe){if(_0x6400fe){return _0x618bd7['sendStatus'](_0xf3b04);}return _0x618bd7[_0x66c7('0x1b')](_0xf3b04)['end']();};}function respondWithResult(_0x208010,_0x39f951){_0x39f951=_0x39f951||0xc8;return function(_0x3c81c0){if(_0x3c81c0){return _0x208010[_0x66c7('0x1b')](_0x39f951)[_0x66c7('0x1c')](_0x3c81c0);}};}function respondWithFilteredResult(_0x4e229a,_0x5cf913){return function(_0x53fb36){if(_0x53fb36){var _0x5129f6=_0x53fb36['count'],_0x8ad572=_0x5cf913[_0x66c7('0x1d')],_0x19f29d=_0x5cf913[_0x66c7('0x1d')]+_0x5cf913[_0x66c7('0x1e')],_0x47a299;if(_0x19f29d>=_0x5129f6){_0x19f29d=_0x5129f6;_0x47a299=0xc8;}else{_0x47a299=0xce;}_0x4e229a[_0x66c7('0x1b')](_0x47a299);return _0x4e229a['set']('Content-Range',_0x8ad572+'-'+_0x19f29d+'/'+_0x5129f6)[_0x66c7('0x1c')](_0x53fb36);}return null;};}function patchUpdates(_0x237177){return function(_0xf30f9){try{jsonpatch[_0x66c7('0x1f')](_0xf30f9,_0x237177,!![]);}catch(_0x465457){return BPromise[_0x66c7('0x20')](_0x465457);}return _0xf30f9['save']();};}function saveUpdates(_0x4ddbd2,_0x366e9b){return function(_0x4a2b90){if(_0x4a2b90){return _0x4a2b90[_0x66c7('0x21')](_0x4ddbd2)[_0x66c7('0x22')](function(_0x44bdef){return _0x44bdef;});}return null;};}function removeEntity(_0x1fc9d3,_0x5bfaf6){return function(_0x2736df){if(_0x2736df){return _0x2736df[_0x66c7('0x23')]()['then'](function(){_0x1fc9d3[_0x66c7('0x1b')](0xcc)[_0x66c7('0x24')]();});}};}function handleEntityNotFound(_0x2bb86d,_0x2ef6a2){return function(_0x2af0a3){if(!_0x2af0a3){_0x2bb86d['sendStatus'](0x194);}return _0x2af0a3;};}function handleError(_0x5bc4e6,_0x4e514a){_0x4e514a=_0x4e514a||0x1f4;return function(_0x2dd131){logger[_0x66c7('0x25')](_0x2dd131['stack']);if(_0x2dd131[_0x66c7('0x26')]){delete _0x2dd131[_0x66c7('0x26')];}_0x5bc4e6[_0x66c7('0x1b')](_0x4e514a)[_0x66c7('0x27')](_0x2dd131);};}function getInteractionUsers(_0x36a830,_0x27be81){return new BPromise(function(_0x570f0d,_0xccefb2){try{if(_0x27be81[_0x36a830['id']]){_0x36a830[_0x66c7('0x28')]=_[_0x66c7('0x29')](_0x27be81[_0x36a830['id']],function(_0x33be23){return{'id':_0x33be23['id'],'fullname':_0x33be23[_0x66c7('0x2a')]};});}}catch(_0x592f0e){_0xccefb2(_0x592f0e);}_0x570f0d(_0x36a830);});}function getInteractionTags(_0x263b48,_0x4f1a34){return new BPromise(function(_0xfbd97,_0x543fbf){try{if(_0x263b48[_0x66c7('0x2b')]){_0x263b48[_0x66c7('0x2c')]=[];_0x263b48[_0x66c7('0x2b')][_0x66c7('0x2d')](',')[_0x66c7('0x2e')](function(_0x24e776){_0x263b48['Tags']['push'](_0x4f1a34[_0x24e776]);});}delete _0x263b48[_0x66c7('0x2b')];}catch(_0x12e7c6){_0x543fbf(_0x12e7c6);}_0xfbd97(_0x263b48);});}function updateSmsInteraction(_0x827cbc,_0x3f657e,_0x344345){return new BPromise(function(_0x131f24,_0x44dcde){return getInteractionUsers(_0x827cbc,_0x344345)[_0x66c7('0x22')](function(_0x15edc8){return getInteractionTags(_0x15edc8,_0x3f657e);})[_0x66c7('0x22')](function(_0x1fd460){_0x131f24(_0x1fd460);})[_0x66c7('0x2f')](function(_0x4eb03f){_0x44dcde(_0x4eb03f);});});}exports['index']=function(_0x446bd8,_0x13e7a2){var _0x367ad5={},_0x1b2849={},_0x45050c={'count':0x0,'rows':[]};var _0x2bf7c2=_[_0x66c7('0x29')](db['SmsInteraction'][_0x66c7('0x30')],function(_0x33b7ff){return{'name':_0x33b7ff[_0x66c7('0x31')],'type':_0x33b7ff[_0x66c7('0x32')][_0x66c7('0x33')]};});_0x1b2849[_0x66c7('0x34')]=_[_0x66c7('0x29')](_0x2bf7c2,_0x66c7('0x26'));_0x1b2849[_0x66c7('0x35')]=_[_0x66c7('0x36')](_0x446bd8[_0x66c7('0x35')]);_0x1b2849['filters']=_['intersection'](_0x1b2849[_0x66c7('0x34')],_0x1b2849[_0x66c7('0x35')]);_0x367ad5[_0x66c7('0x37')]=_['intersection'](_0x1b2849['model'],qs[_0x66c7('0x38')](_0x446bd8[_0x66c7('0x35')]['fields']));_0x367ad5[_0x66c7('0x37')]=_0x367ad5[_0x66c7('0x37')][_0x66c7('0x39')]?_0x367ad5['attributes']:_0x1b2849[_0x66c7('0x34')];if(!_0x446bd8[_0x66c7('0x35')][_0x66c7('0x3a')](_0x66c7('0x3b'))){_0x367ad5[_0x66c7('0x1e')]=qs[_0x66c7('0x1e')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x1e')]);_0x367ad5[_0x66c7('0x1d')]=qs['offset'](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x1d')]);}_0x367ad5[_0x66c7('0x3c')]=qs[_0x66c7('0x3d')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x3d')]);_0x367ad5[_0x66c7('0x3e')]=qs[_0x66c7('0x3f')](_[_0x66c7('0x40')](_0x446bd8[_0x66c7('0x35')],_0x1b2849['filters']),_0x2bf7c2);var _0x5bb5fc=[];var _0x528f5c=squel[_0x66c7('0x41')]()[_0x66c7('0x42')]('id')['field']('name')[_0x66c7('0x42')](_0x66c7('0x43'))[_0x66c7('0x44')](_0x66c7('0x45'));var _0x2c5269=squel['select']()[_0x66c7('0x42')]('u.id')['field'](_0x66c7('0x46'))[_0x66c7('0x42')](_0x66c7('0x47'))[_0x66c7('0x44')]('user_has_sms_interactions','ui')['left_join'](_0x66c7('0x48'),'u','u.id\x20=\x20ui.UserId');var _0x4e0c89=squel[_0x66c7('0x41')]()[_0x66c7('0x44')](_0x66c7('0x49'),'i')[_0x66c7('0x4a')]('cm_contacts','c',_0x66c7('0x4b'))[_0x66c7('0x4a')](_0x66c7('0x48'),'o','o.id\x20=\x20i.UserId')[_0x66c7('0x4a')](_0x66c7('0x4c'),'a',_0x66c7('0x4d'))[_0x66c7('0x4a')](_0x66c7('0x4e'),'me',_0x66c7('0x4f'))[_0x66c7('0x4a')](_0x66c7('0x50'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x66c7('0x4a')](_0x66c7('0x45'),'t',_0x66c7('0x51'));var _0x1386a2=squel[_0x66c7('0x52')]();var _0x2f766e=[];var _0x2cd0c6=squel[_0x66c7('0x52')]();var _0x1b3dc2;if(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x53')]){_0x1b3dc2=as[_0x66c7('0x54')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x53')]);var _0x47e766=_0x1b3dc2[_0x66c7('0x55')];for(var _0x225fb6=0x0;_0x225fb6<_0x1b3dc2[_0x66c7('0x56')][_0x66c7('0x39')];_0x225fb6++){var _0x533ff5=_0x1b3dc2[_0x66c7('0x56')][_0x225fb6];var _0x1a159f='i';var _0x55e026=_[_0x66c7('0x57')](_0x2bf7c2,[_0x66c7('0x26'),_0x533ff5[_0x66c7('0x42')]]);if(!_0x55e026){switch(_0x533ff5[_0x66c7('0x42')]){case _0x66c7('0x58'):if(_0x533ff5[_0x66c7('0x59')]==0x1){_0x4e0c89[_0x66c7('0x5a')]('`'+_0x533ff5['field']+_0x66c7('0x5b'));}else{_0x4e0c89[_0x66c7('0x5a')]('`'+_0x533ff5['field']+_0x66c7('0x5c'));}break;case _0x66c7('0x5d'):if(_0x533ff5[_0x66c7('0x5e')]==='$substring'){if(_0x533ff5[_0x66c7('0x59')][_0x66c7('0x2d')]('\x20')[_0x66c7('0x39')]>0x1){_0x1386a2[_0x47e766](_0x66c7('0x5f'),qs[_0x66c7('0x60')](_0x533ff5[_0x66c7('0x59')]),null);}else{var _0x1d8313='%'+_0x533ff5[_0x66c7('0x59')]+'%';_0x1386a2[_0x47e766]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1d8313,_0x1d8313,_0x1d8313);}}else{_0x55e026=_[_0x66c7('0x57')](_0x2bf7c2,[_0x66c7('0x26'),'ContactId']);_0x533ff5[_0x66c7('0x42')]=_0x66c7('0x61');_0xa75268=as[_0x66c7('0x62')](_0x1a159f,_0x55e026['type'],_0x533ff5);_0x1386a2[_0x47e766](_0xa75268['text'],_0xa75268[_0x66c7('0x59')]['start'],_0xa75268[_0x66c7('0x59')][_0x66c7('0x24')]);}break;case _0x66c7('0x63'):var _0x106b1e=_0x533ff5[_0x66c7('0x59')][_0x66c7('0x2d')](',')['map'](function(_0x58f938){return Number(_0x58f938);});_0x106b1e[_0x66c7('0x2e')](function(_0x3c3c63){_0x2cd0c6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c3c63+',%');});_0x2f766e=_['union'](_0x2f766e,_0x106b1e);break;case _0x66c7('0x64'):if(_0x533ff5['operator']===_0x66c7('0x65')){_0x1386a2[_0x47e766](_0x66c7('0x66'),'%'+_0x533ff5[_0x66c7('0x59')]+'%',null);}else{_0x55e026=_[_0x66c7('0x57')](_0x2bf7c2,['name',_0x66c7('0x67')]);_0x533ff5[_0x66c7('0x42')]=_0x66c7('0x67');_0xa75268=as[_0x66c7('0x62')](_0x1a159f,_0x55e026[_0x66c7('0x32')],_0x533ff5);_0x1386a2[_0x47e766](_0xa75268[_0x66c7('0x68')],_0xa75268['value'][_0x66c7('0x69')],_0xa75268[_0x66c7('0x59')][_0x66c7('0x24')]);}break;case'body':_0xa75268=as[_0x66c7('0x62')]('me',null,_0x533ff5);_0x1386a2[_0x47e766](_0xa75268['text'],_0xa75268[_0x66c7('0x59')][_0x66c7('0x69')],_0xa75268[_0x66c7('0x59')][_0x66c7('0x24')]);break;}}else{var _0xa75268=as[_0x66c7('0x62')](_0x1a159f,_0x55e026['type'],_0x533ff5);_0x1386a2[_0x47e766](_0xa75268[_0x66c7('0x68')],_0xa75268[_0x66c7('0x59')][_0x66c7('0x69')],_0xa75268[_0x66c7('0x59')][_0x66c7('0x24')]);}}}else{var _0x50e4be=_(_0x446bd8[_0x66c7('0x35')])[_0x66c7('0x36')]()[_0x66c7('0x29')](function(_0x37f244){return _[_0x66c7('0x6a')](_0x2bf7c2,[_0x66c7('0x26'),_0x37f244])?_0x37f244:undefined;})[_0x66c7('0x6b')]()[_0x66c7('0x59')]();if(!_[_0x66c7('0x6c')](_0x50e4be)){_0x50e4be[_0x66c7('0x2e')](function(_0x2e26e){if(_0x2e26e===_0x66c7('0x6d')){_0x4e0c89['where'](_0x66c7('0x6e'),[][_0x66c7('0x6f')](_0x446bd8[_0x66c7('0x35')][_0x2e26e]));}else if(_0x2e26e===_0x66c7('0x70')){var _0x1a7e10=JSON[_0x66c7('0x71')](_0x446bd8[_0x66c7('0x35')][_0x2e26e])['$gte'];var _0xe3f51=JSON[_0x66c7('0x71')](_0x446bd8[_0x66c7('0x35')][_0x2e26e])[_0x66c7('0x72')];_0x4e0c89[_0x66c7('0x3e')](_0x66c7('0x73'),_0x1a7e10,_0xe3f51);}else{if(_0x446bd8[_0x66c7('0x35')][_0x2e26e]===_0x66c7('0x74')){_0x4e0c89[_0x66c7('0x3e')]('i.'+_0x2e26e+_0x66c7('0x75'));}else{_0x4e0c89[_0x66c7('0x3e')]('i.'+_0x2e26e+_0x66c7('0x76'),_0x446bd8[_0x66c7('0x35')][_0x2e26e]);}}});}if(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x77')]){if(_0x446bd8[_0x66c7('0x35')]['read']==0x1){_0x4e0c89[_0x66c7('0x5a')](_0x66c7('0x78'));}else{_0x4e0c89[_0x66c7('0x5a')](_0x66c7('0x79'));}}if(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7a')]){_0x2f766e=_[_0x66c7('0x7b')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7a')])?_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7a')]:new Array(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7a')]);_0x2f766e[_0x66c7('0x2e')](function(_0x3263ab){_0x2cd0c6['or'](_0x66c7('0x7c'),'%,'+_0x3263ab+',%');});}if(_0x446bd8[_0x66c7('0x35')]['filter']){var _0x42485b=_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7d')][_0x66c7('0x7e')]('\x5c','\x5c\x5c')[_0x66c7('0x7e')]('\x27\x27',_0x66c7('0x7f'));if(qs['isNumeric'](_0x42485b)){_0x1386a2['or']('i.id\x20LIKE\x20?',_0x42485b+'%')['or'](_0x66c7('0x80'),_0x42485b+'%');}else{_0x1386a2['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x66c7('0x60')](_0x42485b))['or'](_0x66c7('0x81'),_0x42485b+'%');}}}_0x4e0c89[_0x66c7('0x3e')](_0x1386a2);_0x4e0c89[_0x66c7('0x82')](_0x66c7('0x83'));var _0x1d800e={'type':db[_0x66c7('0x84')][_0x66c7('0x85')][_0x66c7('0x86')],'raw':!![]};var _0x35ad88=_0x4e0c89[_0x66c7('0x87')]();_0x35ad88[_0x66c7('0x42')]('i.id');_0x35ad88[_0x66c7('0x42')](_0x66c7('0x88'),_0x66c7('0x58'));if(_0x367ad5[_0x66c7('0x3c')]){_0x367ad5['order'][_0x66c7('0x2e')](function(_0x1ed044){_0x4e0c89['order']('i.'+_0x1ed044[0x0],_0x1ed044[0x1]===_0x66c7('0x89')?![]:!![]);});}if(!_[_0x66c7('0x6c')](_0x2f766e)){_0x4e0c89[_0x66c7('0x5a')](_0x2cd0c6);_0x35ad88[_0x66c7('0x3e')](_0x66c7('0x8a'),_0x2f766e);}BPromise[_0x66c7('0x8b')]()['then'](function(){if(!_0x1b3dc2){if(_0x446bd8['query'][_0x66c7('0x6d')]||_0x446bd8['query']['journey'])return;_0x35ad88[_0x66c7('0x3e')](_0x66c7('0x8c'));_0x4e0c89[_0x66c7('0x3e')](_0x66c7('0x8c'));return;}return _0x446bd8[_0x66c7('0x8d')][_0x66c7('0x8e')]({'attributes':['id'],'raw':!![]})[_0x66c7('0x22')](function(_0x41b4f0){if(_['isEmpty'](_0x41b4f0)){_0x35ad88[_0x66c7('0x3e')](_0x66c7('0x8f'));_0x4e0c89[_0x66c7('0x3e')](_0x66c7('0x8f'));}else{_0x35ad88[_0x66c7('0x3e')](_0x66c7('0x6e'),_[_0x66c7('0x29')](_0x41b4f0,'id'));_0x4e0c89[_0x66c7('0x3e')](_0x66c7('0x6e'),_[_0x66c7('0x29')](_0x41b4f0,'id'));}});})[_0x66c7('0x22')](function(){db[_0x66c7('0x90')][_0x66c7('0x35')](_0x35ad88[_0x66c7('0x91')](),_0x1d800e)[_0x66c7('0x22')](function(_0x2aaba9){_0x45050c[_0x66c7('0x92')]=_0x2aaba9[_0x66c7('0x39')];if(_0x45050c[_0x66c7('0x92')]===0x0)return[];return db[_0x66c7('0x90')][_0x66c7('0x35')](_0x528f5c[_0x66c7('0x91')](),_0x1d800e)[_0x66c7('0x22')](function(_0x300ff4){_0x5bb5fc=_[_0x66c7('0x93')](_0x300ff4,'id');_0x1d800e=_[_0x66c7('0x94')](_0x1d800e,{'model':db[_0x66c7('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x446bd8['query'][_0x66c7('0x38')]){_0x367ad5[_0x66c7('0x37')][_0x66c7('0x2e')](function(_0x5a163c){_0x4e0c89[_0x66c7('0x42')]('i.'+_0x5a163c);});}else{_0x4e0c89[_0x66c7('0x42')](_0x66c7('0x88'),'unreadMessages');_0x4e0c89[_0x66c7('0x42')](_0x66c7('0x96'),_0x66c7('0x97'));_0x4e0c89['field'](_0x66c7('0x98'),_0x66c7('0x99'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0x9a'));_0x4e0c89['field'](_0x66c7('0x9b'),_0x66c7('0x9c'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0x9d'),'Contact.lastName');_0x4e0c89['field'](_0x66c7('0x9e'),_0x66c7('0x9f'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0xa0'),_0x66c7('0xa1'));_0x4e0c89['field'](_0x66c7('0xa2'),_0x66c7('0xa3'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0xa4'),_0x66c7('0xa5'));_0x4e0c89['field'](_0x66c7('0xa6'),_0x66c7('0xa7'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0xa8'),_0x66c7('0xa9'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0xaa'),_0x66c7('0x2b'));}if(_0x367ad5['limit'])_0x4e0c89[_0x66c7('0x1e')](_0x367ad5[_0x66c7('0x1e')]);if(_0x367ad5[_0x66c7('0x1d')])_0x4e0c89['offset'](_0x367ad5[_0x66c7('0x1d')]);return db[_0x66c7('0x90')][_0x66c7('0x35')](_0x4e0c89[_0x66c7('0x91')](),_0x1d800e);})[_0x66c7('0x22')](function(_0x2e528e){_0x2c5269[_0x66c7('0x3e')](_0x66c7('0xab'),_['map'](_0x2e528e,'id'));return db[_0x66c7('0x90')][_0x66c7('0x35')](_0x2c5269[_0x66c7('0x91')](),_0x1d800e)[_0x66c7('0x22')](function(_0x3d12ed){var _0x39f425=_['groupBy'](_0x3d12ed,_0x66c7('0xac'));var _0x446e40=[];_0x2e528e[_0x66c7('0x2e')](function(_0x223ab1){_0x446e40[_0x66c7('0xad')](updateSmsInteraction(_0x223ab1,_0x5bb5fc,_0x39f425));});return BPromise[_0x66c7('0xae')](_0x446e40);});});})[_0x66c7('0x22')](function(_0xbeab37){_0x45050c['rows']=_0xbeab37;return _0x45050c;})[_0x66c7('0x22')](respondWithFilteredResult(_0x13e7a2,_0x367ad5));})[_0x66c7('0x2f')](handleError(_0x13e7a2,null));};exports[_0x66c7('0xaf')]=function(_0x54cb09,_0x176d9d){var _0x2f0bf0={'raw':![],'where':{'id':_0x54cb09[_0x66c7('0xb0')]['id']}},_0x46aa68={};_0x46aa68[_0x66c7('0x34')]=_[_0x66c7('0x36')](db[_0x66c7('0x95')]['rawAttributes']);_0x46aa68[_0x66c7('0x35')]=_['keys'](_0x54cb09['query']);_0x46aa68['filters']=_['intersection'](_0x46aa68[_0x66c7('0x34')],_0x46aa68[_0x66c7('0x35')]);_0x2f0bf0['attributes']=_['intersection'](_0x46aa68[_0x66c7('0x34')],qs[_0x66c7('0x38')](_0x54cb09['query']['fields']));_0x2f0bf0[_0x66c7('0x37')]=_0x2f0bf0['attributes']['length']?_0x2f0bf0[_0x66c7('0x37')]:_0x46aa68[_0x66c7('0x34')];if(_0x54cb09['query'][_0x66c7('0xb1')]){_0x2f0bf0[_0x66c7('0xb2')]=[{'all':!![]}];}_0x2f0bf0=_[_0x66c7('0x94')]({},_0x2f0bf0,_0x54cb09[_0x66c7('0xb3')]);return db[_0x66c7('0x95')][_0x66c7('0x57')](_0x2f0bf0)[_0x66c7('0x22')](handleEntityNotFound(_0x176d9d,null))[_0x66c7('0x22')](respondWithResult(_0x176d9d,null))[_0x66c7('0x2f')](handleError(_0x176d9d,null));};exports['create']=function(_0x1ea4c2,_0x5337d5){return db[_0x66c7('0x95')][_0x66c7('0xb4')](_0x1ea4c2['body'],{})[_0x66c7('0x22')](respondWithResult(_0x5337d5,0xc9))[_0x66c7('0x2f')](handleError(_0x5337d5,null));};exports[_0x66c7('0x21')]=function(_0x12bcbf,_0x2c735a){if(_0x12bcbf['body']['id']){delete _0x12bcbf[_0x66c7('0xb5')]['id'];}return db['SmsInteraction'][_0x66c7('0x57')]({'where':{'id':_0x12bcbf[_0x66c7('0xb0')]['id']}})[_0x66c7('0x22')](handleEntityNotFound(_0x2c735a,null))[_0x66c7('0x22')](saveUpdates(_0x12bcbf[_0x66c7('0xb5')],null))[_0x66c7('0x22')](respondWithResult(_0x2c735a,null))[_0x66c7('0x2f')](handleError(_0x2c735a,null));};exports['destroy']=function(_0x54fb36,_0x2ed11c){return db['SmsInteraction']['find']({'where':{'id':_0x54fb36['params']['id']}})[_0x66c7('0x22')](handleEntityNotFound(_0x2ed11c,null))['then'](removeEntity(_0x2ed11c,null))[_0x66c7('0x2f')](handleError(_0x2ed11c,null));};exports[_0x66c7('0xb6')]=function(_0x40d269,_0x4c23c7){return db[_0x66c7('0x95')]['describe']()[_0x66c7('0x22')](respondWithResult(_0x4c23c7,null))['catch'](handleError(_0x4c23c7,null));};exports[_0x66c7('0xb7')]=function(_0x248b31,_0xca6817,_0x3c8c2b){return db[_0x66c7('0xb8')][_0x66c7('0x57')]({'where':{'id':_0x248b31[_0x66c7('0xb0')]['id']}})['then'](handleEntityNotFound(_0xca6817,null))[_0x66c7('0x22')](function(_0x4f728a){if(_0x4f728a){return _0x4f728a['addMessage'](_0x248b31[_0x66c7('0xb5')][_0x66c7('0xb9')],_[_0x66c7('0xba')](_0x248b31[_0x66c7('0xb5')],[_0x66c7('0xb9'),'id'])||{});}})[_0x66c7('0x22')](respondWithResult(_0xca6817,null))[_0x66c7('0x2f')](handleError(_0xca6817,null));};exports[_0x66c7('0xbb')]=function(_0x30c228,_0x73399,_0x34ac80){var _0x12bca4={'raw':![],'where':{}};var _0x1bd864={};var _0x4fa142={'count':0x0,'rows':[]};return db[_0x66c7('0x95')]['findOne']({'where':{'id':_0x30c228[_0x66c7('0xb0')]['id']}})[_0x66c7('0x22')](handleEntityNotFound(_0x73399,null))[_0x66c7('0x22')](function(_0x3826e4){if(_0x3826e4){_0x1bd864[_0x66c7('0x34')]=_[_0x66c7('0x36')](db['SmsMessage']['rawAttributes']);_0x1bd864['query']=_['keys'](_0x30c228['query']);_0x1bd864[_0x66c7('0x3f')]=_[_0x66c7('0xbc')](_0x1bd864[_0x66c7('0x34')],_0x1bd864[_0x66c7('0x35')]);_0x12bca4['attributes']=_['intersection'](_0x1bd864[_0x66c7('0x34')],qs[_0x66c7('0x38')](_0x30c228['query'][_0x66c7('0x38')]));_0x12bca4[_0x66c7('0x37')]=_0x12bca4['attributes'][_0x66c7('0x39')]?_0x12bca4[_0x66c7('0x37')]:_0x1bd864[_0x66c7('0x34')];if(!_0x30c228[_0x66c7('0x35')]['hasOwnProperty']('nolimit')){_0x12bca4[_0x66c7('0x1e')]=qs[_0x66c7('0x1e')](_0x30c228[_0x66c7('0x35')][_0x66c7('0x1e')]);_0x12bca4[_0x66c7('0x1d')]=qs[_0x66c7('0x1d')](_0x30c228[_0x66c7('0x35')][_0x66c7('0x1d')]);}_0x12bca4[_0x66c7('0x3c')]=qs[_0x66c7('0x3d')](_0x30c228['query'][_0x66c7('0x3d')]);_0x12bca4[_0x66c7('0x3e')]=qs[_0x66c7('0x3f')](_[_0x66c7('0x40')](_0x30c228[_0x66c7('0x35')],_0x1bd864[_0x66c7('0x3f')]));_0x12bca4[_0x66c7('0x3e')][_0x66c7('0xac')]=_0x3826e4['id'];if(_0x30c228[_0x66c7('0x35')][_0x66c7('0x7d')]){_0x12bca4['where']=_[_0x66c7('0x94')](_0x12bca4[_0x66c7('0x3e')],{'$or':_[_0x66c7('0x29')](_0x12bca4[_0x66c7('0x37')],function(_0x2fcf9e){var _0x1a9c73={};_0x1a9c73[_0x2fcf9e]={'$like':'%'+_0x30c228[_0x66c7('0x35')][_0x66c7('0x7d')]+'%'};return _0x1a9c73;})});}if(_0x30c228['query'][_0x66c7('0xbd')]){var _0x2bac63=_0x30c228[_0x66c7('0x35')][_0x66c7('0xbd')][_0x66c7('0x2d')](',');var _0x433147={};_0x433147[_0x2bac63[0x0]]={'$gte':moment(_0x2bac63[0x1])[_0x66c7('0xbe')](_0x66c7('0xbf'))};_0x12bca4[_0x66c7('0x3e')]=_[_0x66c7('0x94')](_0x12bca4[_0x66c7('0x3e')],_0x433147);}_0x12bca4=_[_0x66c7('0x94')]({},_0x12bca4,_0x30c228['options']);return db['SmsMessage'][_0x66c7('0x92')]({'where':_0x12bca4[_0x66c7('0x3e')]})[_0x66c7('0x22')](function(_0x6a57c6){_0x4fa142[_0x66c7('0x92')]=_0x6a57c6;if(_0x30c228[_0x66c7('0x35')][_0x66c7('0xb1')]){_0x12bca4[_0x66c7('0xb2')]=[{'all':!![]}];}return db['SmsMessage'][_0x66c7('0xc0')](_0x12bca4);})[_0x66c7('0x22')](function(_0x498698){_0x4fa142[_0x66c7('0xc1')]=_0x498698;return _0x4fa142;});}})[_0x66c7('0x22')](respondWithFilteredResult(_0x73399,_0x12bca4))[_0x66c7('0x2f')](handleError(_0x73399,null));};exports[_0x66c7('0xc2')]=function(_0x5c97da,_0xa292ce,_0x224406){return db[_0x66c7('0x95')][_0x66c7('0x57')]({'where':{'id':_0x5c97da['params']['id']}})['then'](handleEntityNotFound(_0xa292ce,null))[_0x66c7('0x22')](function(_0x46eb2e){if(_0x46eb2e){return _0x46eb2e[_0x66c7('0xc3')](_0x5c97da[_0x66c7('0xb5')][_0x66c7('0xb9')],_[_0x66c7('0xba')](_0x5c97da['body'],[_0x66c7('0xb9'),'id'])||{})[_0x66c7('0xc4')](function(){return db[_0x66c7('0x63')][_0x66c7('0xc0')]({'attributes':['id','name',_0x66c7('0x43')],'where':{'id':_0x5c97da['body'][_0x66c7('0xb9')]}});})['then'](function(_0x492f77){socket[_0x66c7('0xc5')](_0x66c7('0xc6'),{'id':Number(_0x5c97da['params']['id']),'tags':_0x492f77||[]});return{'id':Number(_0x5c97da['params']['id']),'tags':_0x492f77||[]};});}})[_0x66c7('0x22')](respondWithResult(_0xa292ce,null))['catch'](handleError(_0xa292ce,null));};exports[_0x66c7('0xc7')]=function(_0xa1dc6a,_0x2358e9,_0xba7a89){return db['SmsInteraction'][_0x66c7('0x57')]({'where':{'id':_0xa1dc6a[_0x66c7('0xb0')]['id']}})[_0x66c7('0x22')](handleEntityNotFound(_0x2358e9,null))[_0x66c7('0x22')](function(_0xc4d935){if(_0xc4d935){return _0xc4d935['removeTags'](_0xa1dc6a['query'][_0x66c7('0xb9')]);}})[_0x66c7('0x22')](respondWithStatusCode(_0x2358e9,null))[_0x66c7('0x2f')](handleError(_0x2358e9,null));};exports[_0x66c7('0xc8')]=function(_0x3bae47,_0x501a80){var _0x290fcc=moment()[_0x66c7('0xc9')]()[_0x66c7('0x91')]();var _0x20d8f8=path[_0x66c7('0xca')](config['root'],'server',_0x66c7('0xcb'),_0x66c7('0xcc'));var _0x4e683b=path[_0x66c7('0xca')](config['root'],_0x66c7('0xcd'),_0x66c7('0xcb'),_0x66c7('0xce'));var _0x4dc210=path[_0x66c7('0xca')](_0x20d8f8,_0x290fcc);var _0x5013a7=util[_0x66c7('0xbe')]('transcript-%d-%s.zip',_0x3bae47[_0x66c7('0xb0')]['id'],_0x290fcc);var _0x361fe0=path[_0x66c7('0xca')](_0x20d8f8,_0x5013a7);var _0x3eff3a=[];_0x3eff3a['push']({'model':db[_0x66c7('0x64')],'as':_0x66c7('0x64'),'attributes':['id','fullname'],'raw':!![]});_0x3eff3a[_0x66c7('0xad')]({'model':db[_0x66c7('0xcf')],'as':'Contact','attributes':['id',_0x66c7('0xd0'),_0x66c7('0xd1')],'raw':!![]});var _0x4aadc8=[{'model':db[_0x66c7('0xb8')],'as':'Messages','attributes':['id','body',_0x66c7('0x70'),'direction',_0x66c7('0xd2'),_0x66c7('0x77')],'include':_0x3eff3a}];_0x4aadc8['push']({'model':db[_0x66c7('0xd3')],'as':'Account','attributes':['id',_0x66c7('0x26')]});_0x4aadc8[_0x66c7('0xad')]({'model':db[_0x66c7('0x64')],'as':_0x66c7('0xd4'),'attributes':['id','fullname']});return db[_0x66c7('0x95')][_0x66c7('0x57')]({'where':{'id':_0x3bae47['params']['id']},'include':_0x4aadc8})[_0x66c7('0x22')](handleEntityNotFound(_0x501a80,null))[_0x66c7('0x22')](function(_0x2f2024){if(_0x2f2024){var _0x158887=_0x2f2024[_0x66c7('0xd5')]({'plain':!![]});fs[_0x66c7('0xd6')](_0x4dc210);var _0x41804e={'format':'A4','border':_0x66c7('0xd7'),'header':{'height':_0x66c7('0xd8'),'contents':{'first':_0x66c7('0xd9')}},'footer':{'height':_0x66c7('0xda'),'contents':{'default':util[_0x66c7('0xbe')](_0x66c7('0xdb'),util[_0x66c7('0xbe')](_0x66c7('0xdc'),_0x66c7('0xdd'),_0x158887['id']),moment()['format'](_0x66c7('0xde'))['toString']())}}};var _0x4b44a3={'channel':_0x66c7('0xdd'),'account':_0x158887[_0x66c7('0xdf')]['name'],'agent':_0x158887[_0x66c7('0xd4')]?_0x158887[_0x66c7('0xd4')][_0x66c7('0x2a')]:_0x66c7('0xe0'),'createdAt':moment(_0x158887[_0x66c7('0x70')])['format'](_0x66c7('0xbf'))[_0x66c7('0x91')](),'closedAt':_0x158887[_0x66c7('0xe1')]?moment(_0x158887[_0x66c7('0xe2')])[_0x66c7('0xbe')](_0x66c7('0xbf'))['toString']():'','disposition':_0x158887[_0x66c7('0xe3')],'messages':_(_0x158887['Messages'])[_0x66c7('0x7d')]({'secret':![]})['map'](function(_0x3c60d7){return{'date':moment(_0x3c60d7[_0x66c7('0x70')])[_0x66c7('0xbe')](_0x66c7('0xbf'))[_0x66c7('0x91')](),'sender':_0x3c60d7['direction']===_0x66c7('0xe4')?_0x3c60d7[_0x66c7('0x64')]?_0x3c60d7[_0x66c7('0x64')]['fullname']:_0x66c7('0xe5'):_0x3c60d7['Contact'][_0x66c7('0xd0')]+(_0x3c60d7[_0x66c7('0x5d')]['lastName']?'\x20'+_0x3c60d7[_0x66c7('0x5d')][_0x66c7('0xd1')]:''),'body':_0x3c60d7[_0x66c7('0xb5')],'direction':_0x3c60d7['direction']===_0x66c7('0xe4')?'A':'C','secret':_0x3c60d7[_0x66c7('0xd2')],'read':_0x3c60d7[_0x66c7('0x77')]};})['value']()};return ejs['renderFile'](path[_0x66c7('0xca')](config['root'],_0x66c7('0xcd'),_0x66c7('0xe6'),'downloadInteraction.html'),{'interaction':_0x4b44a3})[_0x66c7('0x22')](function(_0x49f915){return new BPromise(function(_0x5e98f6,_0x3c0cfd){pdf[_0x66c7('0xb4')](_0x49f915,_0x41804e)[_0x66c7('0xe7')](path['join'](_0x4dc210,_0x66c7('0xe8')+_0x158887['id']+'-'+_0x290fcc+_0x66c7('0xe9')),function(_0x46a220,_0x28612f){if(_0x46a220)return _0x3c0cfd(_0x46a220);_0x5e98f6(_0x28612f);});});})[_0x66c7('0x22')](function(){return new BPromise(function(_0x49fe5a,_0x2ce2c2){zipdir(_0x4dc210,{'saveTo':_0x361fe0},function(_0x319ae6,_0x2462c6){if(_0x319ae6)return _0x2ce2c2(_0x319ae6);return _0x49fe5a(_0x2462c6);});})['then'](function(){return new BPromise(function(_0x1d329d,_0x5d6306){rimraf(_0x4dc210,function(_0x42119f){if(_0x42119f)_0x5d6306(_0x42119f);return _0x1d329d();});});})[_0x66c7('0x22')](function(){return _0x501a80[_0x66c7('0xc8')](_0x361fe0,_0x5013a7,function(_0x22a363){if(_0x22a363){console[_0x66c7('0xea')](_0x66c7('0xeb'),_0x22a363);}else{fs['unlinkSync'](_0x361fe0);}});});});}else{return _0x501a80[_0x66c7('0xec')](0xc8);}})[_0x66c7('0x2f')](handleError(_0x501a80,null));}; \ No newline at end of file +var _0x8ce3=['then','error','stack','name','send','map','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','params','includeAll','include','create','describe','addMessage','SmsMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','spread','smsInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','format','transcript-%d-%s.zip','User','fullname','firstName','lastName','Messages','direction','secret','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Sms','YYYY-MM-DD','Account','N.A.','closed','closedAt','disposition','out','System','renderFile','views','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x8ce3,0xc3));var _0x38ce=function(_0x295df8,_0x1f9924){_0x295df8=_0x295df8-0x0;var _0x1c4b61=_0x8ce3[_0x295df8];return _0x1c4b61;};'use strict';var pdf=require(_0x38ce('0x0'));var emlformat=require(_0x38ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x38ce('0x2'));var jsonpatch=require(_0x38ce('0x3'));var rp=require(_0x38ce('0x4'));var moment=require(_0x38ce('0x5'));var BPromise=require(_0x38ce('0x6'));var Mustache=require(_0x38ce('0x7'));var util=require(_0x38ce('0x8'));var path=require(_0x38ce('0x9'));var sox=require('sox');var csv=require(_0x38ce('0xa'));var ejs=require(_0x38ce('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xa'));var querystring=require('querystring');var Papa=require(_0x38ce('0xf'));var Redis=require('ioredis');var authService=require(_0x38ce('0x10'));var qs=require(_0x38ce('0x11'));var as=require(_0x38ce('0x12'));var hardwareService=require(_0x38ce('0x13'));var logger=require(_0x38ce('0x14'))(_0x38ce('0x15'));var utils=require(_0x38ce('0x16'));var config=require(_0x38ce('0x17'));var db=require(_0x38ce('0x18'))['db'];config[_0x38ce('0x19')]=_[_0x38ce('0x1a')](config[_0x38ce('0x19')],{'host':_0x38ce('0x1b'),'port':0x18eb});var socket=require(_0x38ce('0x1c'))(new Redis(config[_0x38ce('0x19')]));require(_0x38ce('0x1d'))['register'](socket);function respondWithStatusCode(_0x48ba7c,_0x3c4d7f){_0x3c4d7f=_0x3c4d7f||0xcc;return function(_0x2aabd8){if(_0x2aabd8){return _0x48ba7c[_0x38ce('0x1e')](_0x3c4d7f);}return _0x48ba7c['status'](_0x3c4d7f)[_0x38ce('0x1f')]();};}function respondWithResult(_0x54fcd3,_0x2771ec){_0x2771ec=_0x2771ec||0xc8;return function(_0xe858f0){if(_0xe858f0){return _0x54fcd3['status'](_0x2771ec)[_0x38ce('0x20')](_0xe858f0);}};}function respondWithFilteredResult(_0x2dddc1,_0x1dfaba){return function(_0x51f670){if(_0x51f670){var _0xe4099a=_0x51f670[_0x38ce('0x21')],_0x2efd6f=_0x1dfaba[_0x38ce('0x22')],_0x3df527=_0x1dfaba[_0x38ce('0x22')]+_0x1dfaba['limit'],_0x311734;if(_0x3df527>=_0xe4099a){_0x3df527=_0xe4099a;_0x311734=0xc8;}else{_0x311734=0xce;}_0x2dddc1[_0x38ce('0x23')](_0x311734);return _0x2dddc1[_0x38ce('0x24')](_0x38ce('0x25'),_0x2efd6f+'-'+_0x3df527+'/'+_0xe4099a)[_0x38ce('0x20')](_0x51f670);}return null;};}function patchUpdates(_0x30b060){return function(_0x434c31){try{jsonpatch[_0x38ce('0x26')](_0x434c31,_0x30b060,!![]);}catch(_0x42ec06){return BPromise[_0x38ce('0x27')](_0x42ec06);}return _0x434c31[_0x38ce('0x28')]();};}function saveUpdates(_0x1aace7,_0x580cf3){return function(_0x1cc10b){if(_0x1cc10b){return _0x1cc10b[_0x38ce('0x29')](_0x1aace7)[_0x38ce('0x2a')](function(_0xcf5d9e){return _0xcf5d9e;});}return null;};}function removeEntity(_0x4a56b0,_0x2c85e6){return function(_0x1d192d){if(_0x1d192d){return _0x1d192d['destroy']()[_0x38ce('0x2a')](function(){_0x4a56b0[_0x38ce('0x23')](0xcc)[_0x38ce('0x1f')]();});}};}function handleEntityNotFound(_0x5b330c,_0x4a7e8e){return function(_0x3f3516){if(!_0x3f3516){_0x5b330c[_0x38ce('0x1e')](0x194);}return _0x3f3516;};}function handleError(_0x142d72,_0x21d4e7){_0x21d4e7=_0x21d4e7||0x1f4;return function(_0x264cf0){logger[_0x38ce('0x2b')](_0x264cf0[_0x38ce('0x2c')]);if(_0x264cf0[_0x38ce('0x2d')]){delete _0x264cf0[_0x38ce('0x2d')];}_0x142d72[_0x38ce('0x23')](_0x21d4e7)[_0x38ce('0x2e')](_0x264cf0);};}function getInteractionUsers(_0x381703,_0x50692a){return new BPromise(function(_0x1212dd,_0x1538a0){try{if(_0x50692a[_0x381703['id']]){_0x381703['Users']=_[_0x38ce('0x2f')](_0x50692a[_0x381703['id']],function(_0x3cbead){return{'id':_0x3cbead['id'],'fullname':_0x3cbead['fullname']};});}}catch(_0xd96d33){_0x1538a0(_0xd96d33);}_0x1212dd(_0x381703);});}function getInteractionTags(_0x282ee4,_0x568d94){return new BPromise(function(_0x28d775,_0x53f2c9){try{if(_0x282ee4[_0x38ce('0x30')]){_0x282ee4[_0x38ce('0x31')]=[];_0x282ee4[_0x38ce('0x30')][_0x38ce('0x32')](',')[_0x38ce('0x33')](function(_0x23019f){_0x282ee4[_0x38ce('0x31')][_0x38ce('0x34')](_0x568d94[_0x23019f]);});}delete _0x282ee4['TagIds'];}catch(_0x4e5bf6){_0x53f2c9(_0x4e5bf6);}_0x28d775(_0x282ee4);});}function updateSmsInteraction(_0x469b65,_0xc4dd0f,_0x3cba20){return new BPromise(function(_0x34cb97,_0x3fe430){return getInteractionUsers(_0x469b65,_0x3cba20)['then'](function(_0x23208f){return getInteractionTags(_0x23208f,_0xc4dd0f);})[_0x38ce('0x2a')](function(_0x37f696){_0x34cb97(_0x37f696);})[_0x38ce('0x35')](function(_0x3a4895){_0x3fe430(_0x3a4895);});});}exports[_0x38ce('0x36')]=function(_0x3d7f64,_0x54050a){var _0x2297e5={},_0x73cbd2={},_0x5b8c69={'count':0x0,'rows':[]};var _0x3069aa=_[_0x38ce('0x2f')](db[_0x38ce('0x37')][_0x38ce('0x38')],function(_0x1eb47e){return{'name':_0x1eb47e[_0x38ce('0x39')],'type':_0x1eb47e[_0x38ce('0x3a')][_0x38ce('0x3b')]};});_0x73cbd2['model']=_[_0x38ce('0x2f')](_0x3069aa,_0x38ce('0x2d'));_0x73cbd2[_0x38ce('0x3c')]=_[_0x38ce('0x3d')](_0x3d7f64['query']);_0x73cbd2[_0x38ce('0x3e')]=_['intersection'](_0x73cbd2[_0x38ce('0x3f')],_0x73cbd2[_0x38ce('0x3c')]);_0x2297e5[_0x38ce('0x40')]=_[_0x38ce('0x41')](_0x73cbd2[_0x38ce('0x3f')],qs[_0x38ce('0x42')](_0x3d7f64['query'][_0x38ce('0x42')]));_0x2297e5['attributes']=_0x2297e5[_0x38ce('0x40')][_0x38ce('0x43')]?_0x2297e5[_0x38ce('0x40')]:_0x73cbd2[_0x38ce('0x3f')];if(!_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x44')]('nolimit')){_0x2297e5[_0x38ce('0x45')]=qs[_0x38ce('0x45')](_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x45')]);_0x2297e5[_0x38ce('0x22')]=qs[_0x38ce('0x22')](_0x3d7f64['query']['offset']);}_0x2297e5[_0x38ce('0x46')]=qs[_0x38ce('0x47')](_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x47')]);_0x2297e5[_0x38ce('0x48')]=qs[_0x38ce('0x3e')](_[_0x38ce('0x49')](_0x3d7f64['query'],_0x73cbd2[_0x38ce('0x3e')]),_0x3069aa);var _0x30cfe3=[];var _0x5a689b=squel[_0x38ce('0x4a')]()[_0x38ce('0x4b')]('id')[_0x38ce('0x4b')]('name')[_0x38ce('0x4b')](_0x38ce('0x4c'))[_0x38ce('0x4d')](_0x38ce('0x4e'));var _0x24cf78=squel[_0x38ce('0x4a')]()['field'](_0x38ce('0x4f'))[_0x38ce('0x4b')](_0x38ce('0x50'))[_0x38ce('0x4b')](_0x38ce('0x51'))[_0x38ce('0x4d')]('user_has_sms_interactions','ui')[_0x38ce('0x52')](_0x38ce('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x502430=squel['select']()[_0x38ce('0x4d')](_0x38ce('0x54'),'i')['left_join']('cm_contacts','c',_0x38ce('0x55'))['left_join'](_0x38ce('0x53'),'o','o.id\x20=\x20i.UserId')[_0x38ce('0x52')](_0x38ce('0x56'),'a','a.id\x20=\x20i.SmsAccountId')[_0x38ce('0x52')](_0x38ce('0x57'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x38ce('0x52')](_0x38ce('0x58'),'it',_0x38ce('0x59'))[_0x38ce('0x52')](_0x38ce('0x4e'),'t',_0x38ce('0x5a'));var _0x58cc6f=squel[_0x38ce('0x5b')]();var _0x1d25b2=[];var _0x53bbc3=squel[_0x38ce('0x5b')]();var _0x316eec;if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x5c')]){_0x316eec=as[_0x38ce('0x5d')](_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x5c')]);var _0x5f2e8d=_0x316eec[_0x38ce('0x5e')];for(var _0x34a118=0x0;_0x34a118<_0x316eec[_0x38ce('0x5f')][_0x38ce('0x43')];_0x34a118++){var _0x2264f9=_0x316eec[_0x38ce('0x5f')][_0x34a118];var _0x5f145d='i';var _0x50c3b8=_[_0x38ce('0x60')](_0x3069aa,[_0x38ce('0x2d'),_0x2264f9[_0x38ce('0x4b')]]);if(!_0x50c3b8){switch(_0x2264f9[_0x38ce('0x4b')]){case _0x38ce('0x61'):if(_0x2264f9[_0x38ce('0x62')]==0x1){_0x502430['having']('`'+_0x2264f9['field']+_0x38ce('0x63'));}else{_0x502430['having']('`'+_0x2264f9['field']+_0x38ce('0x64'));}break;case _0x38ce('0x65'):if(_0x2264f9[_0x38ce('0x66')]===_0x38ce('0x67')){if(_0x2264f9[_0x38ce('0x62')]['split']('\x20')[_0x38ce('0x43')]>0x1){_0x58cc6f[_0x5f2e8d](_0x38ce('0x68'),qs[_0x38ce('0x69')](_0x2264f9[_0x38ce('0x62')]),null);}else{var _0x6b381f='%'+_0x2264f9[_0x38ce('0x62')]+'%';_0x58cc6f[_0x5f2e8d](_0x38ce('0x6a'),_0x6b381f,_0x6b381f,_0x6b381f);}}else{_0x50c3b8=_[_0x38ce('0x60')](_0x3069aa,[_0x38ce('0x2d'),_0x38ce('0x6b')]);_0x2264f9[_0x38ce('0x4b')]='ContactId';_0x51adaa=as['buildExpression'](_0x5f145d,_0x50c3b8[_0x38ce('0x3a')],_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa[_0x38ce('0x6c')],_0x51adaa[_0x38ce('0x62')][_0x38ce('0x6d')],_0x51adaa['value'][_0x38ce('0x1f')]);}break;case _0x38ce('0x6e'):var _0x3b4e47=_0x2264f9[_0x38ce('0x62')][_0x38ce('0x32')](',')[_0x38ce('0x2f')](function(_0x1534ca){return Number(_0x1534ca);});_0x3b4e47['forEach'](function(_0x7f2eea){_0x53bbc3['or'](_0x38ce('0x6f'),'%,'+_0x7f2eea+',%');});_0x1d25b2=_['union'](_0x1d25b2,_0x3b4e47);break;case'User':if(_0x2264f9[_0x38ce('0x66')]===_0x38ce('0x67')){_0x58cc6f[_0x5f2e8d](_0x38ce('0x70'),'%'+_0x2264f9['value']+'%',null);}else{_0x50c3b8=_['find'](_0x3069aa,[_0x38ce('0x2d'),'UserId']);_0x2264f9[_0x38ce('0x4b')]=_0x38ce('0x71');_0x51adaa=as[_0x38ce('0x72')](_0x5f145d,_0x50c3b8[_0x38ce('0x3a')],_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa['text'],_0x51adaa[_0x38ce('0x62')][_0x38ce('0x6d')],_0x51adaa[_0x38ce('0x62')]['end']);}break;case _0x38ce('0x73'):_0x51adaa=as[_0x38ce('0x72')]('me',null,_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa[_0x38ce('0x6c')],_0x51adaa['value'][_0x38ce('0x6d')],_0x51adaa['value'][_0x38ce('0x1f')]);break;}}else{var _0x51adaa=as[_0x38ce('0x72')](_0x5f145d,_0x50c3b8[_0x38ce('0x3a')],_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa[_0x38ce('0x6c')],_0x51adaa[_0x38ce('0x62')]['start'],_0x51adaa[_0x38ce('0x62')][_0x38ce('0x1f')]);}}}else{var _0x425002=_(_0x3d7f64[_0x38ce('0x3c')])[_0x38ce('0x3d')]()[_0x38ce('0x2f')](function(_0x5b8fb5){return _[_0x38ce('0x74')](_0x3069aa,['name',_0x5b8fb5])?_0x5b8fb5:undefined;})[_0x38ce('0x75')]()[_0x38ce('0x62')]();if(!_[_0x38ce('0x76')](_0x425002)){_0x425002[_0x38ce('0x33')](function(_0x32290f){if(_0x32290f===_0x38ce('0x77')){_0x502430[_0x38ce('0x48')](_0x38ce('0x78'),[]['concat'](_0x3d7f64[_0x38ce('0x3c')][_0x32290f]));}else if(_0x32290f===_0x38ce('0x79')){var _0x204e91=JSON[_0x38ce('0x7a')](_0x3d7f64[_0x38ce('0x3c')][_0x32290f])[_0x38ce('0x7b')];var _0x3122da=JSON[_0x38ce('0x7a')](_0x3d7f64[_0x38ce('0x3c')][_0x32290f])[_0x38ce('0x7c')];_0x502430[_0x38ce('0x48')](_0x38ce('0x7d'),_0x204e91,_0x3122da);}else{if(_0x3d7f64[_0x38ce('0x3c')][_0x32290f]===_0x38ce('0x7e')){_0x502430[_0x38ce('0x48')]('i.'+_0x32290f+_0x38ce('0x7f'));}else{_0x502430[_0x38ce('0x48')]('i.'+_0x32290f+_0x38ce('0x80'),_0x3d7f64[_0x38ce('0x3c')][_0x32290f]);}}});}if(_0x3d7f64[_0x38ce('0x3c')]['read']){if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x81')]==0x1){_0x502430[_0x38ce('0x82')]('`unreadMessages`\x20=\x200');}else{_0x502430['having'](_0x38ce('0x83'));}}if(_0x3d7f64[_0x38ce('0x3c')]['tag']){_0x1d25b2=_[_0x38ce('0x84')](_0x3d7f64[_0x38ce('0x3c')]['tag'])?_0x3d7f64['query'][_0x38ce('0x85')]:new Array(_0x3d7f64[_0x38ce('0x3c')]['tag']);_0x1d25b2[_0x38ce('0x33')](function(_0x2732ac){_0x53bbc3['or'](_0x38ce('0x6f'),'%,'+_0x2732ac+',%');});}if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x86')]){var _0x163d35=_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x86')]['replace']('\x5c','\x5c\x5c')[_0x38ce('0x87')]('\x27\x27',_0x38ce('0x88'));if(qs[_0x38ce('0x89')](_0x163d35)){_0x58cc6f['or'](_0x38ce('0x8a'),_0x163d35+'%')['or'](_0x38ce('0x8b'),_0x163d35+'%');}else{_0x58cc6f['or'](_0x38ce('0x8c'),qs[_0x38ce('0x69')](_0x163d35))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x163d35+'%');}}}_0x502430['where'](_0x58cc6f);_0x502430['group'](_0x38ce('0x8d'));var _0x384671={'type':db[_0x38ce('0x8e')][_0x38ce('0x8f')][_0x38ce('0x90')],'raw':!![]};var _0x26ca11=_0x502430[_0x38ce('0x91')]();_0x26ca11['field'](_0x38ce('0x8d'));_0x26ca11['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x2297e5[_0x38ce('0x46')]){_0x2297e5[_0x38ce('0x46')][_0x38ce('0x33')](function(_0x585fe0){_0x502430[_0x38ce('0x46')]('i.'+_0x585fe0[0x0],_0x585fe0[0x1]===_0x38ce('0x92')?![]:!![]);});}if(!_[_0x38ce('0x76')](_0x1d25b2)){_0x502430[_0x38ce('0x82')](_0x53bbc3);_0x26ca11[_0x38ce('0x48')]('t.id\x20IN\x20?',_0x1d25b2);}BPromise[_0x38ce('0x93')]()['then'](function(){if(!_0x316eec){if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x77')]||_0x3d7f64['query'][_0x38ce('0x94')])return;_0x26ca11[_0x38ce('0x48')](_0x38ce('0x95'));_0x502430[_0x38ce('0x48')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d7f64['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x4961b8){if(_['isEmpty'](_0x4961b8)){_0x26ca11[_0x38ce('0x48')](_0x38ce('0x96'));_0x502430[_0x38ce('0x48')](_0x38ce('0x96'));}else{_0x26ca11['where'](_0x38ce('0x78'),_[_0x38ce('0x2f')](_0x4961b8,'id'));_0x502430['where'](_0x38ce('0x78'),_[_0x38ce('0x2f')](_0x4961b8,'id'));}});})[_0x38ce('0x2a')](function(){db[_0x38ce('0x97')][_0x38ce('0x3c')](_0x26ca11[_0x38ce('0x98')](),_0x384671)[_0x38ce('0x2a')](function(_0x386b51){_0x5b8c69[_0x38ce('0x21')]=_0x386b51['length'];if(_0x5b8c69[_0x38ce('0x21')]===0x0)return[];return db[_0x38ce('0x97')][_0x38ce('0x3c')](_0x5a689b['toString'](),_0x384671)['then'](function(_0x4fa65f){_0x30cfe3=_[_0x38ce('0x99')](_0x4fa65f,'id');_0x384671=_[_0x38ce('0x9a')](_0x384671,{'model':db[_0x38ce('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x42')]){_0x2297e5[_0x38ce('0x40')][_0x38ce('0x33')](function(_0x345ba4){_0x502430[_0x38ce('0x4b')]('i.'+_0x345ba4);});}else{_0x502430[_0x38ce('0x4b')](_0x38ce('0x9b'),_0x38ce('0x61'));_0x502430[_0x38ce('0x4b')](_0x38ce('0x9c'),_0x38ce('0x9d'));_0x502430[_0x38ce('0x4b')](_0x38ce('0x9e'),_0x38ce('0x9f'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xa0'));_0x502430['field'](_0x38ce('0xa1'),_0x38ce('0xa2'));_0x502430[_0x38ce('0x4b')]('c.lastName',_0x38ce('0xa3'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xa4'),_0x38ce('0xa5'));_0x502430['field'](_0x38ce('0xa6'),_0x38ce('0xa7'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xa8'),'Contact.mobile');_0x502430[_0x38ce('0x4b')](_0x38ce('0xa9'),_0x38ce('0xaa'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xab'),_0x38ce('0xac'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xad'),_0x38ce('0xae'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xaf'),_0x38ce('0x30'));}if(_0x2297e5['limit'])_0x502430[_0x38ce('0x45')](_0x2297e5[_0x38ce('0x45')]);if(_0x2297e5[_0x38ce('0x22')])_0x502430[_0x38ce('0x22')](_0x2297e5[_0x38ce('0x22')]);return db['sequelize']['query'](_0x502430[_0x38ce('0x98')](),_0x384671);})['then'](function(_0xed7dcc){_0x24cf78[_0x38ce('0x48')]('ui.SmsInteractionId\x20IN\x20?',_[_0x38ce('0x2f')](_0xed7dcc,'id'));return db[_0x38ce('0x97')]['query'](_0x24cf78[_0x38ce('0x98')](),_0x384671)[_0x38ce('0x2a')](function(_0x20db5f){var _0x3dc4e5=_[_0x38ce('0xb0')](_0x20db5f,_0x38ce('0xb1'));var _0x5b6014=[];_0xed7dcc[_0x38ce('0x33')](function(_0x2077ca){_0x5b6014['push'](updateSmsInteraction(_0x2077ca,_0x30cfe3,_0x3dc4e5));});return BPromise['all'](_0x5b6014);});});})[_0x38ce('0x2a')](function(_0x576530){_0x5b8c69[_0x38ce('0xb2')]=_0x576530;return _0x5b8c69;})[_0x38ce('0x2a')](respondWithFilteredResult(_0x54050a,_0x2297e5));})[_0x38ce('0x35')](handleError(_0x54050a,null));};exports[_0x38ce('0xb3')]=function(_0x1eab01,_0x20e6a4){var _0x46f224={'raw':![],'where':{'id':_0x1eab01[_0x38ce('0xb4')]['id']}},_0x4df3d5={};_0x4df3d5[_0x38ce('0x3f')]=_[_0x38ce('0x3d')](db['SmsInteraction'][_0x38ce('0x38')]);_0x4df3d5['query']=_[_0x38ce('0x3d')](_0x1eab01[_0x38ce('0x3c')]);_0x4df3d5['filters']=_['intersection'](_0x4df3d5[_0x38ce('0x3f')],_0x4df3d5['query']);_0x46f224[_0x38ce('0x40')]=_[_0x38ce('0x41')](_0x4df3d5[_0x38ce('0x3f')],qs[_0x38ce('0x42')](_0x1eab01[_0x38ce('0x3c')]['fields']));_0x46f224[_0x38ce('0x40')]=_0x46f224[_0x38ce('0x40')][_0x38ce('0x43')]?_0x46f224['attributes']:_0x4df3d5['model'];if(_0x1eab01[_0x38ce('0x3c')][_0x38ce('0xb5')]){_0x46f224[_0x38ce('0xb6')]=[{'all':!![]}];}_0x46f224=_[_0x38ce('0x9a')]({},_0x46f224,_0x1eab01['options']);return db[_0x38ce('0x37')][_0x38ce('0x60')](_0x46f224)[_0x38ce('0x2a')](handleEntityNotFound(_0x20e6a4,null))[_0x38ce('0x2a')](respondWithResult(_0x20e6a4,null))['catch'](handleError(_0x20e6a4,null));};exports[_0x38ce('0xb7')]=function(_0x27fd03,_0x5d61ab){return db[_0x38ce('0x37')]['create'](_0x27fd03[_0x38ce('0x73')],{})['then'](respondWithResult(_0x5d61ab,0xc9))[_0x38ce('0x35')](handleError(_0x5d61ab,null));};exports[_0x38ce('0x29')]=function(_0x53d474,_0x192b69){if(_0x53d474['body']['id']){delete _0x53d474[_0x38ce('0x73')]['id'];}return db[_0x38ce('0x37')]['find']({'where':{'id':_0x53d474[_0x38ce('0xb4')]['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0x192b69,null))['then'](saveUpdates(_0x53d474['body'],null))[_0x38ce('0x2a')](respondWithResult(_0x192b69,null))['catch'](handleError(_0x192b69,null));};exports['destroy']=function(_0x354543,_0x4390bc){return db[_0x38ce('0x37')]['find']({'where':{'id':_0x354543[_0x38ce('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4390bc,null))['then'](removeEntity(_0x4390bc,null))['catch'](handleError(_0x4390bc,null));};exports[_0x38ce('0xb8')]=function(_0x4f1c7e,_0x33dafc){return db[_0x38ce('0x37')][_0x38ce('0xb8')]()[_0x38ce('0x2a')](respondWithResult(_0x33dafc,null))['catch'](handleError(_0x33dafc,null));};exports[_0x38ce('0xb9')]=function(_0x2ef91e,_0xdca2f3,_0x3c98ae){return db[_0x38ce('0xba')][_0x38ce('0x60')]({'where':{'id':_0x2ef91e['params']['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0xdca2f3,null))['then'](function(_0x454596){if(_0x454596){return _0x454596[_0x38ce('0xb9')](_0x2ef91e[_0x38ce('0x73')][_0x38ce('0xbb')],_[_0x38ce('0xbc')](_0x2ef91e[_0x38ce('0x73')],[_0x38ce('0xbb'),'id'])||{});}})['then'](respondWithResult(_0xdca2f3,null))[_0x38ce('0x35')](handleError(_0xdca2f3,null));};exports[_0x38ce('0xbd')]=function(_0x4f2542,_0x32c0dd,_0x31ddf7){var _0x57ca62={'raw':![],'where':{}};var _0x14811b={};var _0x20f9bf={'count':0x0,'rows':[]};return db[_0x38ce('0x37')]['findOne']({'where':{'id':_0x4f2542[_0x38ce('0xb4')]['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0x32c0dd,null))['then'](function(_0x2faf1e){if(_0x2faf1e){_0x14811b['model']=_[_0x38ce('0x3d')](db['SmsMessage'][_0x38ce('0x38')]);_0x14811b[_0x38ce('0x3c')]=_['keys'](_0x4f2542[_0x38ce('0x3c')]);_0x14811b[_0x38ce('0x3e')]=_[_0x38ce('0x41')](_0x14811b[_0x38ce('0x3f')],_0x14811b['query']);_0x57ca62[_0x38ce('0x40')]=_['intersection'](_0x14811b[_0x38ce('0x3f')],qs[_0x38ce('0x42')](_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x42')]));_0x57ca62[_0x38ce('0x40')]=_0x57ca62[_0x38ce('0x40')][_0x38ce('0x43')]?_0x57ca62['attributes']:_0x14811b[_0x38ce('0x3f')];if(!_0x4f2542['query'][_0x38ce('0x44')](_0x38ce('0xbe'))){_0x57ca62[_0x38ce('0x45')]=qs['limit'](_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x45')]);_0x57ca62[_0x38ce('0x22')]=qs[_0x38ce('0x22')](_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x22')]);}_0x57ca62[_0x38ce('0x46')]=qs[_0x38ce('0x47')](_0x4f2542[_0x38ce('0x3c')]['sort']);_0x57ca62[_0x38ce('0x48')]=qs[_0x38ce('0x3e')](_[_0x38ce('0x49')](_0x4f2542[_0x38ce('0x3c')],_0x14811b[_0x38ce('0x3e')]));_0x57ca62['where'][_0x38ce('0xb1')]=_0x2faf1e['id'];if(_0x4f2542['query'][_0x38ce('0x86')]){_0x57ca62['where']=_[_0x38ce('0x9a')](_0x57ca62[_0x38ce('0x48')],{'$or':_[_0x38ce('0x2f')](_0x57ca62[_0x38ce('0x40')],function(_0x2b67af){var _0x283d90={};_0x283d90[_0x2b67af]={'$like':'%'+_0x4f2542['query'][_0x38ce('0x86')]+'%'};return _0x283d90;})});}if(_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x7b')]){var _0x569641=_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x7b')][_0x38ce('0x32')](',');var _0x2a8203={};_0x2a8203[_0x569641[0x0]]={'$gte':moment(_0x569641[0x1])['format'](_0x38ce('0xbf'))};_0x57ca62['where']=_[_0x38ce('0x9a')](_0x57ca62[_0x38ce('0x48')],_0x2a8203);}_0x57ca62=_[_0x38ce('0x9a')]({},_0x57ca62,_0x4f2542[_0x38ce('0xc0')]);return db[_0x38ce('0xba')]['count']({'where':_0x57ca62[_0x38ce('0x48')]})[_0x38ce('0x2a')](function(_0x3da4c7){_0x20f9bf['count']=_0x3da4c7;if(_0x4f2542[_0x38ce('0x3c')][_0x38ce('0xb5')]){_0x57ca62['include']=[{'all':!![]}];}return db['SmsMessage'][_0x38ce('0xc1')](_0x57ca62);})[_0x38ce('0x2a')](function(_0x3d8dec){_0x20f9bf[_0x38ce('0xb2')]=_0x3d8dec;return _0x20f9bf;});}})['then'](respondWithFilteredResult(_0x32c0dd,_0x57ca62))[_0x38ce('0x35')](handleError(_0x32c0dd,null));};exports['addTags']=function(_0x4b0a3b,_0x37572e,_0x420457){return db[_0x38ce('0x37')][_0x38ce('0x60')]({'where':{'id':_0x4b0a3b['params']['id']}})['then'](handleEntityNotFound(_0x37572e,null))[_0x38ce('0x2a')](function(_0x162f5d){if(_0x162f5d){return _0x162f5d[_0x38ce('0xc2')](_0x4b0a3b[_0x38ce('0x73')]['ids'],_['omit'](_0x4b0a3b[_0x38ce('0x73')],[_0x38ce('0xbb'),'id'])||{})[_0x38ce('0xc3')](function(){return db[_0x38ce('0x6e')][_0x38ce('0xc1')]({'attributes':['id',_0x38ce('0x2d'),_0x38ce('0x4c')],'where':{'id':_0x4b0a3b[_0x38ce('0x73')]['ids']}});})[_0x38ce('0x2a')](function(_0x1c0372){socket['emit'](_0x38ce('0xc4'),{'id':Number(_0x4b0a3b[_0x38ce('0xb4')]['id']),'tags':_0x1c0372||[]});return{'id':Number(_0x4b0a3b[_0x38ce('0xb4')]['id']),'tags':_0x1c0372||[]};});}})[_0x38ce('0x2a')](respondWithResult(_0x37572e,null))['catch'](handleError(_0x37572e,null));};exports['removeTags']=function(_0x4a528f,_0x167030,_0x5af247){return db['SmsInteraction'][_0x38ce('0x60')]({'where':{'id':_0x4a528f[_0x38ce('0xb4')]['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0x167030,null))[_0x38ce('0x2a')](function(_0x302600){if(_0x302600){return _0x302600[_0x38ce('0xc5')](_0x4a528f[_0x38ce('0x3c')][_0x38ce('0xbb')]);}})['then'](respondWithStatusCode(_0x167030,null))[_0x38ce('0x35')](handleError(_0x167030,null));};exports[_0x38ce('0xc6')]=function(_0x1042a4,_0x2f843b){var _0x1e976f=moment()[_0x38ce('0xc7')]()['toString']();var _0x1be555=path[_0x38ce('0xc8')](config['root'],_0x38ce('0xc9'),'files',_0x38ce('0xca'));var _0x45680c=path[_0x38ce('0xc8')](config[_0x38ce('0xcb')],_0x38ce('0xc9'),_0x38ce('0xcc'),_0x38ce('0xcd'));var _0x4439b2=path['join'](_0x1be555,_0x1e976f);var _0xeec46=util[_0x38ce('0xce')](_0x38ce('0xcf'),_0x1042a4[_0x38ce('0xb4')]['id'],_0x1e976f);var _0x25072b=path['join'](_0x1be555,_0xeec46);var _0x2f8251=[];_0x2f8251[_0x38ce('0x34')]({'model':db[_0x38ce('0xd0')],'as':'User','attributes':['id',_0x38ce('0xd1')],'raw':!![]});_0x2f8251['push']({'model':db['CmContact'],'as':_0x38ce('0x65'),'attributes':['id',_0x38ce('0xd2'),_0x38ce('0xd3')],'raw':!![]});var _0x27f880=[{'model':db[_0x38ce('0xba')],'as':_0x38ce('0xd4'),'attributes':['id',_0x38ce('0x73'),_0x38ce('0x79'),_0x38ce('0xd5'),_0x38ce('0xd6'),'read'],'include':_0x2f8251}];_0x27f880[_0x38ce('0x34')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x27f880[_0x38ce('0x34')]({'model':db[_0x38ce('0xd0')],'as':_0x38ce('0xd7'),'attributes':['id',_0x38ce('0xd1')]});return db[_0x38ce('0x37')]['find']({'where':{'id':_0x1042a4[_0x38ce('0xb4')]['id']},'include':_0x27f880})['then'](handleEntityNotFound(_0x2f843b,null))['then'](function(_0x599fa7){if(_0x599fa7){var _0x279799=_0x599fa7[_0x38ce('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x4439b2);var _0x2686f2={'format':'A4','border':_0x38ce('0xd9'),'header':{'height':_0x38ce('0xda'),'contents':{'first':_0x38ce('0xdb')}},'footer':{'height':_0x38ce('0xdc'),'contents':{'default':util[_0x38ce('0xce')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x38ce('0xdd'),_0x38ce('0xde'),_0x279799['id']),moment()[_0x38ce('0xce')](_0x38ce('0xdf'))['toString']())}}};var _0x461da3={'channel':_0x38ce('0xde'),'account':_0x279799[_0x38ce('0xe0')]['name'],'agent':_0x279799[_0x38ce('0xd7')]?_0x279799['Owner'][_0x38ce('0xd1')]:_0x38ce('0xe1'),'createdAt':moment(_0x279799['createdAt'])['format'](_0x38ce('0xbf'))[_0x38ce('0x98')](),'closedAt':_0x279799[_0x38ce('0xe2')]?moment(_0x279799[_0x38ce('0xe3')])[_0x38ce('0xce')](_0x38ce('0xbf'))[_0x38ce('0x98')]():'','disposition':_0x279799[_0x38ce('0xe4')],'messages':_(_0x279799[_0x38ce('0xd4')])[_0x38ce('0x86')]({'secret':![]})['map'](function(_0x5bb7e5){return{'date':moment(_0x5bb7e5[_0x38ce('0x79')])[_0x38ce('0xce')](_0x38ce('0xbf'))[_0x38ce('0x98')](),'sender':_0x5bb7e5[_0x38ce('0xd5')]===_0x38ce('0xe5')?_0x5bb7e5[_0x38ce('0xd0')]?_0x5bb7e5[_0x38ce('0xd0')][_0x38ce('0xd1')]:_0x38ce('0xe6'):_0x5bb7e5['Contact'][_0x38ce('0xd2')]+(_0x5bb7e5[_0x38ce('0x65')][_0x38ce('0xd3')]?'\x20'+_0x5bb7e5['Contact'][_0x38ce('0xd3')]:''),'body':_0x5bb7e5[_0x38ce('0x73')],'direction':_0x5bb7e5[_0x38ce('0xd5')]===_0x38ce('0xe5')?'A':'C','secret':_0x5bb7e5['secret'],'read':_0x5bb7e5['read']};})['value']()};return ejs[_0x38ce('0xe7')](path[_0x38ce('0xc8')](config[_0x38ce('0xcb')],'server',_0x38ce('0xe8'),'downloadInteraction.html'),{'interaction':_0x461da3})[_0x38ce('0x2a')](function(_0xd94aeb){return new BPromise(function(_0x27dde5,_0x169908){pdf[_0x38ce('0xb7')](_0xd94aeb,_0x2686f2)['toFile'](path[_0x38ce('0xc8')](_0x4439b2,'transcript-'+_0x279799['id']+'-'+_0x1e976f+_0x38ce('0xe9')),function(_0x292bb6,_0x317bf0){if(_0x292bb6)return _0x169908(_0x292bb6);_0x27dde5(_0x317bf0);});});})['then'](function(){return new BPromise(function(_0x4c6b80,_0x55050e){zipdir(_0x4439b2,{'saveTo':_0x25072b},function(_0x2bc199,_0x3d6817){if(_0x2bc199)return _0x55050e(_0x2bc199);return _0x4c6b80(_0x3d6817);});})[_0x38ce('0x2a')](function(){return new BPromise(function(_0x436315,_0x293123){rimraf(_0x4439b2,function(_0x182abc){if(_0x182abc)_0x293123(_0x182abc);return _0x436315();});});})[_0x38ce('0x2a')](function(){return _0x2f843b[_0x38ce('0xc6')](_0x25072b,_0xeec46,function(_0x585c9f){if(_0x585c9f){console[_0x38ce('0xea')](_0x38ce('0xeb'),_0x585c9f);}else{fs[_0x38ce('0xec')](_0x25072b);}});});});}else{return _0x2f843b['sendStatus'](0xc8);}})[_0x38ce('0x35')](handleError(_0x2f843b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a34a31d..908a621 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 _0x1dcc=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction'];(function(_0xcfd748,_0x3a5bcb){var _0x294ff3=function(_0x560165){while(--_0x560165){_0xcfd748['push'](_0xcfd748['shift']());}};_0x294ff3(++_0x3a5bcb);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x3b03e7,_0x5a8ee2){_0x3b03e7=_0x3b03e7-0x0;var _0x50d8d7=_0x1dcc[_0x3b03e7];return _0x50d8d7;};'use strict';var EventEmitter=require(_0xc1dc('0x0'));var SmsInteraction=require(_0xc1dc('0x1'))['db'][_0xc1dc('0x2')];var SmsMessage=require(_0xc1dc('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc1dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1dc('0x4'),'afterDestroy':_0xc1dc('0x5')};function emitEvent(_0x2a8ff9){return function(_0x5deaf7,_0x4ad50f,_0x1e57ba){_0x5deaf7[_0xc1dc('0x6')]({'attributes':['id'],'raw':!![]})[_0xc1dc('0x7')](function(_0x4dab41){_0x5deaf7[_0xc1dc('0x8')](_0xc1dc('0x9'),_0x4dab41['map'](function(_0x6aad09){return{'id':_0x6aad09['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x5deaf7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc1dc('0x7')](function(_0x49ef48){_0x5deaf7[_0xc1dc('0x8')](_0xc1dc('0xa'),_0x49ef48[_0xc1dc('0xb')]);SmsInteractionEvents[_0xc1dc('0xc')](_0x2a8ff9+':'+_0x5deaf7['id'],_0x5deaf7);SmsInteractionEvents[_0xc1dc('0xc')](_0x2a8ff9,_0x5deaf7);_0x1e57ba(null);})[_0xc1dc('0xd')](_0x1e57ba(null));};}for(var e in events){if(events[_0xc1dc('0xe')](e)){var event=events[e];SmsInteraction[_0xc1dc('0xf')](e,emitEvent(event));}}module[_0xc1dc('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xaa7c=['remove','then','Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x4f53f2,_0x3b9532){var _0x51aecb=function(_0xef0ef5){while(--_0xef0ef5){_0x4f53f2['push'](_0x4f53f2['shift']());}};_0x51aecb(++_0x3b9532);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x54ac96,_0x3ed0a9){_0x54ac96=_0x54ac96-0x0;var _0x1f7ee5=_0xaa7c[_0x54ac96];return _0x1f7ee5;};'use strict';var EventEmitter=require(_0xcaa7('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xcaa7('0x1')](0x0);var events={'afterCreate':_0xcaa7('0x2'),'afterUpdate':'update','afterDestroy':_0xcaa7('0x3')};function emitEvent(_0xc85ba0){return function(_0x3e1543,_0x17d8cf,_0x27e610){_0x3e1543['getUsers']({'attributes':['id'],'raw':!![]})[_0xcaa7('0x4')](function(_0x5bd940){_0x3e1543['setDataValue'](_0xcaa7('0x5'),_0x5bd940[_0xcaa7('0x6')](function(_0x4e74c5){return{'id':_0x4e74c5['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3e1543['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcaa7('0x4')](function(_0x1de70a){_0x3e1543[_0xcaa7('0x7')](_0xcaa7('0x8'),_0x1de70a[_0xcaa7('0x9')]);SmsInteractionEvents['emit'](_0xc85ba0+':'+_0x3e1543['id'],_0x3e1543);SmsInteractionEvents[_0xcaa7('0xa')](_0xc85ba0,_0x3e1543);_0x27e610(null);})[_0xcaa7('0xb')](_0x27e610(null));};}for(var e in events){if(events[_0xcaa7('0xc')](e)){var event=events[e];SmsInteraction[_0xcaa7('0xd')](e,emitEvent(event));}}module[_0xcaa7('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2929a92..cdd4a50 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 _0xca8d=['changed','closed','closedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction'];(function(_0xf09021,_0x4aa5ac){var _0x54741f=function(_0x39f37c){while(--_0x39f37c){_0xf09021['push'](_0xf09021['shift']());}};_0x54741f(++_0x4aa5ac);}(_0xca8d,0x10d));var _0xdca8=function(_0x16d6a2,_0x266958){_0x16d6a2=_0x16d6a2-0x0;var _0x681283=_0xca8d[_0x16d6a2];return _0x681283;};'use strict';var _=require(_0xdca8('0x0'));var util=require('util');var logger=require(_0xdca8('0x1'))(_0xdca8('0x2'));var moment=require(_0xdca8('0x3'));var BPromise=require(_0xdca8('0x4'));var rp=require(_0xdca8('0x5'));var fs=require('fs');var path=require(_0xdca8('0x6'));var rimraf=require('rimraf');var config=require(_0xdca8('0x7'));var attributes=require(_0xdca8('0x8'));module[_0xdca8('0x9')]=function(_0x7d3563,_0x4320d7){return _0x7d3563['define'](_0xdca8('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a6f86,_0x5c7a52,_0x5b8a42){if(_0x2a6f86[_0xdca8('0xb')](_0xdca8('0xc'))){_0x2a6f86[_0xdca8('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5b8a42(null,_0x2a6f86);}}});}; \ No newline at end of file +var _0xd0ee=['request-promise','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird'];(function(_0x4fd6d5,_0x5161e3){var _0x34ada6=function(_0x325479){while(--_0x325479){_0x4fd6d5['push'](_0x4fd6d5['shift']());}};_0x34ada6(++_0x5161e3);}(_0xd0ee,0x12f));var _0xed0e=function(_0x2858af,_0x16e49b){_0x2858af=_0x2858af-0x0;var _0x3aaa45=_0xd0ee[_0x2858af];return _0x3aaa45;};'use strict';var _=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var logger=require(_0xed0e('0x2'))(_0xed0e('0x3'));var moment=require('moment');var BPromise=require(_0xed0e('0x4'));var rp=require(_0xed0e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xed0e('0x6'));var attributes=require(_0xed0e('0x7'));module[_0xed0e('0x8')]=function(_0x326947,_0x39e4ca){return _0x326947['define'](_0xed0e('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x295a00,_0x3015cd,_0x7f85fb){if(_0x295a00['changed']('closed')){_0x295a00['closedAt']=moment()['format'](_0xed0e('0xa'));}_0x7f85fb(null,_0x295a00);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c1cecff..4b2950a 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 _0xdb8a=['code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','body','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x59aeb3,_0x32f513){var _0x3c6521=function(_0x1129b2){while(--_0x1129b2){_0x59aeb3['push'](_0x59aeb3['shift']());}};_0x3c6521(++_0x32f513);}(_0xdb8a,0xbf));var _0xadb8=function(_0x4f3af4,_0x2d048c){_0x4f3af4=_0x4f3af4-0x0;var _0x557e86=_0xdb8a[_0x4f3af4];return _0x557e86;};'use strict';var _=require(_0xadb8('0x0'));var util=require(_0xadb8('0x1'));var moment=require(_0xadb8('0x2'));var BPromise=require(_0xadb8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb8('0x4'));var db=require(_0xadb8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xadb8('0x6'));var config=require(_0xadb8('0x7'));var jayson=require(_0xadb8('0x8'));var client=jayson[_0xadb8('0x9')][_0xadb8('0xa')]({'port':0x232a});config[_0xadb8('0xb')]=_['defaults'](config[_0xadb8('0xb')],{'host':_0xadb8('0xc'),'port':0x18eb});var socket=require(_0xadb8('0xd'))(new Redis(config[_0xadb8('0xb')]));require(_0xadb8('0xe'))[_0xadb8('0xf')](socket);function respondWithRpcPromise(_0x538f6b,_0x4d7482,_0x4c4a9c){return new BPromise(function(_0x153774,_0x1ec609){return client[_0xadb8('0x10')](_0x538f6b,_0x4c4a9c)[_0xadb8('0x11')](function(_0x17cc40){logger[_0xadb8('0x12')](_0xadb8('0x13'),_0x4d7482,_0xadb8('0x14'));logger[_0xadb8('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x4d7482,_0xadb8('0x14'),JSON[_0xadb8('0x16')](_0x17cc40));if(_0x17cc40[_0xadb8('0x17')]){if(_0x17cc40[_0xadb8('0x17')][_0xadb8('0x18')]===0x1f4){logger[_0xadb8('0x17')](_0xadb8('0x13'),_0x4d7482,_0x17cc40[_0xadb8('0x17')][_0xadb8('0x19')]);return _0x1ec609(_0x17cc40[_0xadb8('0x17')][_0xadb8('0x19')]);}logger[_0xadb8('0x17')](_0xadb8('0x13'),_0x4d7482,_0x17cc40[_0xadb8('0x17')][_0xadb8('0x19')]);return _0x153774(_0x17cc40[_0xadb8('0x17')][_0xadb8('0x19')]);}else{logger[_0xadb8('0x12')](_0xadb8('0x13'),_0x4d7482,_0xadb8('0x14'));_0x153774(_0x17cc40[_0xadb8('0x1a')][_0xadb8('0x19')]);}})[_0xadb8('0x1b')](function(_0x431369){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x4d7482,_0x431369);_0x1ec609(_0x431369);});});}exports[_0xadb8('0x1c')]=function(_0x47772c){var _0x1c3560=this;return new Promise(function(_0x1ff486,_0x2a4d19){return db[_0xadb8('0x1d')][_0xadb8('0x1e')](_0x47772c['body'],{'raw':_0x47772c[_0xadb8('0x1f')]?_0x47772c['options'][_0xadb8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47772c['options']?_0x47772c[_0xadb8('0x1f')][_0xadb8('0x21')]||null:null,'attributes':_0x47772c[_0xadb8('0x1f')]?_0x47772c[_0xadb8('0x1f')][_0xadb8('0x22')]||null:null,'limit':_0x47772c[_0xadb8('0x1f')]?_0x47772c[_0xadb8('0x1f')][_0xadb8('0x23')]||null:null})[_0xadb8('0x11')](function(_0x1ff447){logger[_0xadb8('0x12')](_0xadb8('0x1c'),_0x47772c);logger[_0xadb8('0x15')](_0xadb8('0x1c'),_0x47772c,JSON[_0xadb8('0x16')](_0x1ff447));_0x1ff486(_0x1ff447);})['catch'](function(_0x431a74){logger[_0xadb8('0x17')](_0xadb8('0x1c'),_0x431a74[_0xadb8('0x19')],_0x47772c);_0x2a4d19(_0x1c3560[_0xadb8('0x17')](0x1f4,_0x431a74['message']));});});};exports[_0xadb8('0x24')]=function(_0x487232){return new Promise(function(_0x1be984,_0x3fe228){return db[_0xadb8('0x1d')][_0xadb8('0x25')]({'where':_0x487232['options']?_0x487232['options'][_0xadb8('0x21')]||null:null})[_0xadb8('0x11')](function(_0x4f0f2c){if(_0x4f0f2c){return _0x4f0f2c[_0xadb8('0x26')](_0x487232[_0xadb8('0x27')]['ids'],_[_0xadb8('0x28')](_0x487232['body'],['ids','id'])||{});}})[_0xadb8('0x29')](function(_0x323a7d){logger['info'](_0xadb8('0x2a'),_0x487232);logger[_0xadb8('0x15')]('AddTags',_0x487232,JSON[_0xadb8('0x16')](_0x323a7d));_0x1be984(_0x323a7d);})[_0xadb8('0x1b')](function(_0x248e4c){logger[_0xadb8('0x17')](_0xadb8('0x2a'),_0x248e4c['message'],_0x487232);_0x3fe228(_this[_0xadb8('0x17')](0x1f4,_0x248e4c[_0xadb8('0x19')]));});});}; \ No newline at end of file +var _0xfcac=['request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','options','raw','where','limit','UpdateSmsInteraction','stringify','find','then','body','ids','omit','AddTags','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xfcac,0x1a9));var _0xcfca=function(_0x1d998c,_0x39a46c){_0x1d998c=_0x1d998c-0x0;var _0x1ca8d1=_0xfcac[_0x1d998c];return _0x1ca8d1;};'use strict';var _=require(_0xcfca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcfca('0x1'));var rs=require(_0xcfca('0x2'));var fs=require('fs');var Redis=require(_0xcfca('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfca('0x4'));var logger=require(_0xcfca('0x5'))(_0xcfca('0x6'));var config=require(_0xcfca('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfca('0x8')]({'port':0x232a});config[_0xcfca('0x9')]=_[_0xcfca('0xa')](config[_0xcfca('0x9')],{'host':_0xcfca('0xb'),'port':0x18eb});var socket=require(_0xcfca('0xc'))(new Redis(config[_0xcfca('0x9')]));require(_0xcfca('0xd'))[_0xcfca('0xe')](socket);function respondWithRpcPromise(_0x5432e2,_0x42878e,_0x26c0fa){return new BPromise(function(_0x2069ee,_0x4d2c81){return client[_0xcfca('0xf')](_0x5432e2,_0x26c0fa)['then'](function(_0xefc658){logger[_0xcfca('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x42878e,_0xcfca('0x11'));logger[_0xcfca('0x12')](_0xcfca('0x13'),_0x42878e,_0xcfca('0x11'),JSON['stringify'](_0xefc658));if(_0xefc658['error']){if(_0xefc658[_0xcfca('0x14')][_0xcfca('0x15')]===0x1f4){logger[_0xcfca('0x14')](_0xcfca('0x16'),_0x42878e,_0xefc658['error']['message']);return _0x4d2c81(_0xefc658[_0xcfca('0x14')][_0xcfca('0x17')]);}logger[_0xcfca('0x14')](_0xcfca('0x16'),_0x42878e,_0xefc658[_0xcfca('0x14')][_0xcfca('0x17')]);return _0x2069ee(_0xefc658[_0xcfca('0x14')]['message']);}else{logger[_0xcfca('0x10')](_0xcfca('0x16'),_0x42878e,_0xcfca('0x11'));_0x2069ee(_0xefc658[_0xcfca('0x18')][_0xcfca('0x17')]);}})[_0xcfca('0x19')](function(_0x10c505){logger[_0xcfca('0x14')](_0xcfca('0x16'),_0x42878e,_0x10c505);_0x4d2c81(_0x10c505);});});}exports['UpdateSmsInteraction']=function(_0x5a13a9){var _0xbf0607=this;return new Promise(function(_0x3096e3,_0x55c933){return db[_0xcfca('0x1a')][_0xcfca('0x1b')](_0x5a13a9['body'],{'raw':_0x5a13a9['options']?_0x5a13a9[_0xcfca('0x1c')][_0xcfca('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a13a9[_0xcfca('0x1c')]?_0x5a13a9[_0xcfca('0x1c')][_0xcfca('0x1e')]||null:null,'attributes':_0x5a13a9[_0xcfca('0x1c')]?_0x5a13a9[_0xcfca('0x1c')]['attributes']||null:null,'limit':_0x5a13a9['options']?_0x5a13a9[_0xcfca('0x1c')][_0xcfca('0x1f')]||null:null})['then'](function(_0x3784b7){logger['info']('UpdateSmsInteraction',_0x5a13a9);logger[_0xcfca('0x12')](_0xcfca('0x20'),_0x5a13a9,JSON[_0xcfca('0x21')](_0x3784b7));_0x3096e3(_0x3784b7);})[_0xcfca('0x19')](function(_0x1b6a93){logger['error'](_0xcfca('0x20'),_0x1b6a93['message'],_0x5a13a9);_0x55c933(_0xbf0607['error'](0x1f4,_0x1b6a93[_0xcfca('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1a2980){return new Promise(function(_0x1df92e,_0x3c2669){return db[_0xcfca('0x1a')][_0xcfca('0x22')]({'where':_0x1a2980[_0xcfca('0x1c')]?_0x1a2980['options'][_0xcfca('0x1e')]||null:null})[_0xcfca('0x23')](function(_0x48dae7){if(_0x48dae7){return _0x48dae7['addTags'](_0x1a2980[_0xcfca('0x24')][_0xcfca('0x25')],_[_0xcfca('0x26')](_0x1a2980[_0xcfca('0x24')],['ids','id'])||{});}})['spread'](function(_0x3fc722){logger[_0xcfca('0x10')](_0xcfca('0x27'),_0x1a2980);logger[_0xcfca('0x12')](_0xcfca('0x27'),_0x1a2980,JSON[_0xcfca('0x21')](_0x3fc722));_0x1df92e(_0x3fc722);})[_0xcfca('0x19')](function(_0x4795dc){logger[_0xcfca('0x14')](_0xcfca('0x27'),_0x4795dc[_0xcfca('0x17')],_0x1a2980);_0x3c2669(_this[_0xcfca('0x14')](0x1f4,_0x4795dc[_0xcfca('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a0bd798..09de08e 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 _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x3317ed,_0x5b0845){var _0x57da18=function(_0x3c005b){while(--_0x3c005b){_0x3317ed['push'](_0x3317ed['shift']());}};_0x57da18(++_0x5b0845);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb7e7[_0x5037ab];return _0x512adb;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file +var _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0xfe0696,_0xd59e08){var _0x5b515f=function(_0x294ba8){while(--_0x294ba8){_0xfe0696['push'](_0xfe0696['shift']());}};_0x5b515f(++_0xd59e08);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0x0b0e[_0x4ed37d];return _0x4fb2c5;};'use strict';var SmsInteractionEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){SmsInteractionEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0be3d45..9bf1b0b 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 _0xec9d=['status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','../../components/interaction/service','../../config/environment','./smsMessage.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','sms','smsmessage:create','/:id/status'];(function(_0x59ce68,_0x98d1b5){var _0x37c816=function(_0x33e81b){while(--_0x33e81b){_0x59ce68['push'](_0x59ce68['shift']());}};_0x37c816(++_0x98d1b5);}(_0xec9d,0x133));var _0xdec9=function(_0x7ecdad,_0x44bfba){_0x7ecdad=_0x7ecdad-0x0;var _0x325013=_0xec9d[_0x7ecdad];return _0x325013;};'use strict';var multer=require(_0xdec9('0x0'));var util=require(_0xdec9('0x1'));var path=require(_0xdec9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdec9('0x3'));var config=require(_0xdec9('0x4'));var controller=require(_0xdec9('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xdec9('0x6')]);router[_0xdec9('0x7')](_0xdec9('0x8'),auth['isAuthenticated'](),controller[_0xdec9('0x9')]);router['get'](_0xdec9('0xa'),auth[_0xdec9('0xb')](),controller[_0xdec9('0xc')]);router[_0xdec9('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xdec9('0xe'),_0xdec9('0xf')),controller['create']);router[_0xdec9('0xd')](_0xdec9('0x10'),controller[_0xdec9('0x11')]);router['put'](_0xdec9('0xa'),auth[_0xdec9('0xb')](),controller[_0xdec9('0x12')]);router[_0xdec9('0x13')](_0xdec9('0x14'),auth[_0xdec9('0xb')](),controller[_0xdec9('0x15')]);router[_0xdec9('0x13')](_0xdec9('0x16'),auth[_0xdec9('0xb')](),controller[_0xdec9('0x17')]);router[_0xdec9('0x18')](_0xdec9('0xa'),auth[_0xdec9('0xb')](),controller[_0xdec9('0x19')]);module[_0xdec9('0x1a')]=router; \ No newline at end of file +var _0x1b19=['sms','create','/:id/status','status','put','update','/:id/accept','accept','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','index','get','/describe','isAuthenticated','/:id','show','post'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1b19,0x129));var _0x91b1=function(_0x4c1726,_0xb73af5){_0x4c1726=_0x4c1726-0x0;var _0x3acdae=_0x1b19[_0x4c1726];return _0x3acdae;};'use strict';var multer=require(_0x91b1('0x0'));var util=require(_0x91b1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x91b1('0x2'));var router=express[_0x91b1('0x3')]();var auth=require(_0x91b1('0x4'));var interaction=require(_0x91b1('0x5'));var config=require(_0x91b1('0x6'));var controller=require(_0x91b1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x91b1('0x8')]);router[_0x91b1('0x9')](_0x91b1('0xa'),auth[_0x91b1('0xb')](),controller['describe']);router[_0x91b1('0x9')](_0x91b1('0xc'),auth['isAuthenticated'](),controller[_0x91b1('0xd')]);router[_0x91b1('0xe')]('/',auth[_0x91b1('0xb')](),interaction['tracked'](_0x91b1('0xf'),'smsmessage:create'),controller[_0x91b1('0x10')]);router['post'](_0x91b1('0x11'),controller[_0x91b1('0x12')]);router[_0x91b1('0x13')](_0x91b1('0xc'),auth[_0x91b1('0xb')](),controller[_0x91b1('0x14')]);router[_0x91b1('0x13')](_0x91b1('0x15'),auth['isAuthenticated'](),controller[_0x91b1('0x16')]);router[_0x91b1('0x13')]('/:id/reject',auth[_0x91b1('0xb')](),controller['reject']);router[_0x91b1('0x17')](_0x91b1('0xc'),auth[_0x91b1('0xb')](),controller[_0x91b1('0x18')]);module[_0x91b1('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index bfb233e..a25ea9e 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 _0x2e35=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4f7b43,_0x119c22){var _0x2fcdf3=function(_0xaeee0c){while(--_0xaeee0c){_0x4f7b43['push'](_0x4f7b43['shift']());}};_0x2fcdf3(++_0x119c22);}(_0x2e35,0x1d0));var _0x52e3=function(_0x444b61,_0x27b182){_0x444b61=_0x444b61-0x0;var _0x4f7a21=_0x2e35[_0x444b61];return _0x4f7a21;};'use strict';var Sequelize=require(_0x52e3('0x0'));module[_0x52e3('0x1')]={'body':{'type':Sequelize[_0x52e3('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x52e3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x52e3('0x4')]('in',_0x52e3('0x5')),'defaultValue':_0x52e3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x52e3('0x6')]},'readAt':{'type':Sequelize[_0x52e3('0x7')]},'secret':{'type':Sequelize[_0x52e3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2b95=['STRING','DATE','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x54fc4d,_0x38a6e6){var _0x2df06c=function(_0x4467b6){while(--_0x4467b6){_0x54fc4d['push'](_0x54fc4d['shift']());}};_0x2df06c(++_0x38a6e6);}(_0x2b95,0x159));var _0x52b9=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x2b95[_0x57d13b];return _0x467696;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x52b9('0x0')](_0x52b9('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x52b9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x52b9('0x3')]('in',_0x52b9('0x4')),'defaultValue':_0x52b9('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x52b9('0x5')](0xbe)},'phone':{'type':Sequelize[_0x52b9('0x5')]},'readAt':{'type':Sequelize[_0x52b9('0x6')]},'secret':{'type':Sequelize[_0x52b9('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 86a93f2..eb8806a 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 _0x2f3a=['jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','stack','send','map','SmsMessage','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','rows','show','keys','rawAttributes','length','include','options','find','body','update','params','destroy','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','role','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','format','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','DELIVERED','infobip','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x450e61,_0x2aebc0){_0x450e61=_0x450e61-0x0;var _0x303f67=_0x2f3a[_0x450e61];return _0x303f67;};'use strict';var pdf=require(_0xa2f3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa2f3('0x1'));var jsonpatch=require(_0xa2f3('0x2'));var rp=require(_0xa2f3('0x3'));var moment=require(_0xa2f3('0x4'));var BPromise=require(_0xa2f3('0x5'));var Mustache=require(_0xa2f3('0x6'));var util=require('util');var path=require(_0xa2f3('0x7'));var sox=require('sox');var csv=require(_0xa2f3('0x8'));var ejs=require(_0xa2f3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2f3('0xa'));var jsforce=require(_0xa2f3('0xb'));var deskjs=require(_0xa2f3('0xc'));var toCsv=require(_0xa2f3('0x8'));var querystring=require('querystring');var Papa=require(_0xa2f3('0xd'));var Redis=require(_0xa2f3('0xe'));var authService=require(_0xa2f3('0xf'));var qs=require(_0xa2f3('0x10'));var as=require(_0xa2f3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2f3('0x12'))(_0xa2f3('0x13'));var utils=require('../../config/utils');var config=require(_0xa2f3('0x14'));var db=require(_0xa2f3('0x15'))['db'];config[_0xa2f3('0x16')]=_['defaults'](config[_0xa2f3('0x16')],{'host':_0xa2f3('0x17'),'port':0x18eb});var socket=require(_0xa2f3('0x18'))(new Redis(config[_0xa2f3('0x16')]));require(_0xa2f3('0x19'))[_0xa2f3('0x1a')](socket);var jayson=require(_0xa2f3('0x1b'));var client=jayson[_0xa2f3('0x1c')][_0xa2f3('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xa2f3('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x33bf10,_0x74fb58,_0x51d297){if(_0x51d297){var _0x3f9782=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f9782[_0xa2f3('0x1e')](_0x74fb58)){return _0x33bf10;}else{throw new db['Sequelize']['ValidationError'](_0xa2f3('0x1f'));}}else{return _0x33bf10;}}function respondWithRpcPromise(_0x7706bd,_0x2db0d2,_0x1c5c62,_0x205578){return new BPromise(function(_0x23309e,_0x30be69){var _0xde603d=_0x205578||client;return _0xde603d['request'](_0x7706bd,_0x1c5c62)[_0xa2f3('0x20')](function(_0x24850a){logger['info']('SmsMessage,\x20%s,\x20%s',_0x2db0d2,_0xa2f3('0x21'));logger['debug'](_0xa2f3('0x22'),_0x2db0d2,_0xa2f3('0x21'),JSON['stringify'](_0x24850a));if(_0x24850a[_0xa2f3('0x23')]){if(_0x24850a[_0xa2f3('0x23')][_0xa2f3('0x24')]===0x1f4){logger[_0xa2f3('0x23')](_0xa2f3('0x25'),_0x2db0d2,_0x24850a[_0xa2f3('0x23')][_0xa2f3('0x26')]);return _0x30be69(_0x24850a[_0xa2f3('0x23')]['message']);}logger[_0xa2f3('0x23')](_0xa2f3('0x25'),_0x2db0d2,_0x24850a[_0xa2f3('0x23')][_0xa2f3('0x26')]);return _0x23309e(_0x24850a[_0xa2f3('0x23')][_0xa2f3('0x26')]);}else{logger[_0xa2f3('0x27')]('SmsMessage,\x20%s,\x20%s',_0x2db0d2,'request\x20sent');_0x23309e(_0x24850a[_0xa2f3('0x28')][_0xa2f3('0x26')]);}})[_0xa2f3('0x29')](function(_0x13982c){logger['error'](_0xa2f3('0x25'),_0x2db0d2,_0x13982c);_0x30be69(_0x13982c);});});}function respondWithStatusCode(_0x1eb1cc,_0x3cbeeb){_0x3cbeeb=_0x3cbeeb||0xcc;return function(_0x5afda4){if(_0x5afda4){return _0x1eb1cc[_0xa2f3('0x2a')](_0x3cbeeb);}return _0x1eb1cc['status'](_0x3cbeeb)[_0xa2f3('0x2b')]();};}function respondWithResult(_0x5b868c,_0x452142){_0x452142=_0x452142||0xc8;return function(_0x52f211){if(_0x52f211){return _0x5b868c[_0xa2f3('0x2c')](_0x452142)['json'](_0x52f211);}};}function respondWithFilteredResult(_0xb65c3e,_0x210a42){return function(_0x2e8291){if(_0x2e8291){var _0x253fed=_0x2e8291[_0xa2f3('0x2d')],_0x94ddd8=_0x210a42[_0xa2f3('0x2e')],_0x50ae25=_0x210a42[_0xa2f3('0x2e')]+_0x210a42[_0xa2f3('0x2f')],_0x27351d;if(_0x50ae25>=_0x253fed){_0x50ae25=_0x253fed;_0x27351d=0xc8;}else{_0x27351d=0xce;}_0xb65c3e[_0xa2f3('0x2c')](_0x27351d);return _0xb65c3e[_0xa2f3('0x30')](_0xa2f3('0x31'),_0x94ddd8+'-'+_0x50ae25+'/'+_0x253fed)[_0xa2f3('0x32')](_0x2e8291);}return null;};}function patchUpdates(_0x4a0d9f){return function(_0x20d9b1){try{jsonpatch[_0xa2f3('0x33')](_0x20d9b1,_0x4a0d9f,!![]);}catch(_0x3bbd87){return BPromise[_0xa2f3('0x34')](_0x3bbd87);}return _0x20d9b1[_0xa2f3('0x35')]();};}function saveUpdates(_0x48b584,_0x334be6){return function(_0x5bd47c){if(_0x5bd47c){return _0x5bd47c['update'](_0x48b584)[_0xa2f3('0x20')](function(_0x1c96e6){return _0x1c96e6;});}return null;};}function removeEntity(_0x4fad9a,_0x3f4ea0){return function(_0x41770c){if(_0x41770c){return _0x41770c['destroy']()[_0xa2f3('0x20')](function(){_0x4fad9a[_0xa2f3('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8b7a,_0x281541){return function(_0x406358){if(!_0x406358){_0x5d8b7a[_0xa2f3('0x2a')](0x194);}return _0x406358;};}function handleError(_0x1219aa,_0x57c7c5){_0x57c7c5=_0x57c7c5||0x1f4;return function(_0x170b07){logger['error'](_0x170b07[_0xa2f3('0x36')]);if(_0x170b07['name']){delete _0x170b07['name'];}_0x1219aa[_0xa2f3('0x2c')](_0x57c7c5)[_0xa2f3('0x37')](_0x170b07);};}exports['index']=function(_0x1c49b1,_0x5a0f36){var _0x399f3f={},_0x3390fe={},_0x306b75={'count':0x0,'rows':[]};var _0x11dade=_[_0xa2f3('0x38')](db[_0xa2f3('0x39')]['rawAttributes'],function(_0x354554){return{'name':_0x354554[_0xa2f3('0x3a')],'type':_0x354554[_0xa2f3('0x3b')][_0xa2f3('0x3c')]};});_0x3390fe[_0xa2f3('0x3d')]=_[_0xa2f3('0x38')](_0x11dade,_0xa2f3('0x3e'));_0x3390fe[_0xa2f3('0x3f')]=_['keys'](_0x1c49b1[_0xa2f3('0x3f')]);_0x3390fe[_0xa2f3('0x40')]=_[_0xa2f3('0x41')](_0x3390fe[_0xa2f3('0x3d')],_0x3390fe[_0xa2f3('0x3f')]);_0x399f3f['attributes']=_[_0xa2f3('0x41')](_0x3390fe[_0xa2f3('0x3d')],qs['fields'](_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x42')]));_0x399f3f[_0xa2f3('0x43')]=_0x399f3f[_0xa2f3('0x43')]['length']?_0x399f3f[_0xa2f3('0x43')]:_0x3390fe[_0xa2f3('0x3d')];if(!_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x44')](_0xa2f3('0x45'))){_0x399f3f[_0xa2f3('0x2f')]=qs[_0xa2f3('0x2f')](_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x2f')]);_0x399f3f[_0xa2f3('0x2e')]=qs[_0xa2f3('0x2e')](_0x1c49b1[_0xa2f3('0x3f')]['offset']);}_0x399f3f[_0xa2f3('0x46')]=qs['sort'](_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x47')]);_0x399f3f[_0xa2f3('0x48')]=qs[_0xa2f3('0x40')](_['pick'](_0x1c49b1[_0xa2f3('0x3f')],_0x3390fe[_0xa2f3('0x40')]),_0x11dade);if(_0x1c49b1['query']['filter']){_0x399f3f[_0xa2f3('0x48')]=_[_0xa2f3('0x49')](_0x399f3f[_0xa2f3('0x48')],{'$or':_[_0xa2f3('0x38')](_0x11dade,function(_0x2477e0){if(_0x2477e0['type']!=='VIRTUAL'){var _0x510bfa={};_0x510bfa[_0x2477e0[_0xa2f3('0x3e')]]={'$like':'%'+_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x4a')]+'%'};return _0x510bfa;}})});}_0x399f3f=_[_0xa2f3('0x49')]({},_0x399f3f,_0x1c49b1['options']);var _0x1b68ac={'where':_0x399f3f[_0xa2f3('0x48')]};return db[_0xa2f3('0x39')][_0xa2f3('0x2d')](_0x1b68ac)['then'](function(_0x5cacfc){_0x306b75[_0xa2f3('0x2d')]=_0x5cacfc;if(_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x4b')]){_0x399f3f['include']=[{'all':!![]}];}return db[_0xa2f3('0x39')]['findAll'](_0x399f3f);})[_0xa2f3('0x20')](function(_0x598a54){_0x306b75[_0xa2f3('0x4c')]=_0x598a54;return _0x306b75;})[_0xa2f3('0x20')](respondWithFilteredResult(_0x5a0f36,_0x399f3f))[_0xa2f3('0x29')](handleError(_0x5a0f36,null));};exports[_0xa2f3('0x4d')]=function(_0x11315d,_0x26a51a){var _0x33a700={'raw':!![],'where':{'id':_0x11315d['params']['id']}},_0x570a4b={};_0x570a4b[_0xa2f3('0x3d')]=_[_0xa2f3('0x4e')](db[_0xa2f3('0x39')][_0xa2f3('0x4f')]);_0x570a4b[_0xa2f3('0x3f')]=_[_0xa2f3('0x4e')](_0x11315d['query']);_0x570a4b[_0xa2f3('0x40')]=_[_0xa2f3('0x41')](_0x570a4b['model'],_0x570a4b[_0xa2f3('0x3f')]);_0x33a700['attributes']=_[_0xa2f3('0x41')](_0x570a4b[_0xa2f3('0x3d')],qs[_0xa2f3('0x42')](_0x11315d['query'][_0xa2f3('0x42')]));_0x33a700[_0xa2f3('0x43')]=_0x33a700[_0xa2f3('0x43')][_0xa2f3('0x50')]?_0x33a700[_0xa2f3('0x43')]:_0x570a4b[_0xa2f3('0x3d')];if(_0x11315d[_0xa2f3('0x3f')][_0xa2f3('0x4b')]){_0x33a700[_0xa2f3('0x51')]=[{'all':!![]}];}_0x33a700=_['merge']({},_0x33a700,_0x11315d[_0xa2f3('0x52')]);return db[_0xa2f3('0x39')][_0xa2f3('0x53')](_0x33a700)[_0xa2f3('0x20')](handleEntityNotFound(_0x26a51a,null))[_0xa2f3('0x20')](respondWithResult(_0x26a51a,null))[_0xa2f3('0x29')](handleError(_0x26a51a,null));};exports['create']=function(_0x475c42,_0x4f7585){return db['SmsMessage']['create'](_0x475c42[_0xa2f3('0x54')],{})[_0xa2f3('0x20')](respondWithResult(_0x4f7585,0xc9))[_0xa2f3('0x29')](handleError(_0x4f7585,null));};exports[_0xa2f3('0x55')]=function(_0x5d5004,_0x39c2f9){if(_0x5d5004[_0xa2f3('0x54')]['id']){delete _0x5d5004['body']['id'];}return db[_0xa2f3('0x39')][_0xa2f3('0x53')]({'where':{'id':_0x5d5004[_0xa2f3('0x56')]['id']}})['then'](handleEntityNotFound(_0x39c2f9,null))[_0xa2f3('0x20')](saveUpdates(_0x5d5004['body'],null))[_0xa2f3('0x20')](respondWithResult(_0x39c2f9,null))[_0xa2f3('0x29')](handleError(_0x39c2f9,null));};exports[_0xa2f3('0x57')]=function(_0x349159,_0x206e65){return db[_0xa2f3('0x39')][_0xa2f3('0x53')]({'where':{'id':_0x349159[_0xa2f3('0x56')]['id']}})['then'](handleEntityNotFound(_0x206e65,null))[_0xa2f3('0x20')](removeEntity(_0x206e65,null))[_0xa2f3('0x29')](handleError(_0x206e65,null));};exports[_0xa2f3('0x58')]=function(_0x5ed510,_0x36d2e6){return db['SmsMessage']['describe']()[_0xa2f3('0x20')](respondWithResult(_0x36d2e6,null))[_0xa2f3('0x29')](handleError(_0x36d2e6,null));};var interaction_log=require('../../config/logger')(_0xa2f3('0x59'));exports[_0xa2f3('0x5a')]=function(_0x4e96e0,_0x257d9b,_0x4cc71c){var _0x41f629={'channel':'sms'};if(_0x4e96e0[_0xa2f3('0x54')]['id']){delete _0x4e96e0[_0xa2f3('0x54')]['id'];}_0x4e96e0[_0xa2f3('0x54')][_0xa2f3('0x5b')]=!![];_0x4e96e0['body'][_0xa2f3('0x5c')]=moment()['format'](_0xa2f3('0x5d'));_0x4e96e0[_0xa2f3('0x54')][_0xa2f3('0x5e')]=_0x4e96e0[_0xa2f3('0x54')]['UserId']||_0x4e96e0[_0xa2f3('0x5f')]['id'];return db[_0xa2f3('0x39')][_0xa2f3('0x53')]({'where':{'id':_0x4e96e0[_0xa2f3('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xa2f3('0x60')],'as':_0xa2f3('0x61')}]})['then'](handleEntityNotFound(_0x257d9b,null))['then'](saveUpdates(_0x4e96e0[_0xa2f3('0x54')],null))[_0xa2f3('0x20')](function(_0x208ee5){if(_0x208ee5){_0x41f629[_0xa2f3('0x26')]=_0x208ee5[_0xa2f3('0x62')]({'plain':!![]});return db[_0xa2f3('0x63')][_0xa2f3('0x53')]({'where':{'id':_0x208ee5[_0xa2f3('0x64')]}});}return null;})[_0xa2f3('0x20')](handleEntityNotFound(_0x257d9b,null))[_0xa2f3('0x20')](function(_0x34f5e5){if(_0x34f5e5){return _0x34f5e5[_0xa2f3('0x55')]({'UserId':_0x4e96e0['body']['UserId'],'read1stAt':_['isNil'](_0x34f5e5[_0xa2f3('0x65')])?moment()['format'](_0xa2f3('0x5d')):undefined});}return null;})[_0xa2f3('0x20')](function(_0xae17a5){if(_0xae17a5){_0x41f629[_0xa2f3('0x66')]=_0xae17a5[_0xa2f3('0x62')]({'plain':!![]});interaction_log[_0xa2f3('0x27')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e96e0[_0xa2f3('0x5f')]['id'],_0x4e96e0['user'][_0xa2f3('0x3e')],_0x4e96e0[_0xa2f3('0x5f')][_0xa2f3('0x67')],_0x41f629['interaction']['id'],_0x4e96e0[_0xa2f3('0x54')]?JSON[_0xa2f3('0x68')](_0x4e96e0['body']):_0xa2f3('0x69'));return respondWithRpcPromise(_0xa2f3('0x6a'),_0xa2f3('0x6b'),_0x41f629);}return null;})[_0xa2f3('0x20')](function(_0x4fcec7){if(_0x4fcec7){if(_0x4e96e0[_0xa2f3('0x54')][_0xa2f3('0x6c')]){_0x41f629[_0xa2f3('0x26')]['interface']=util['format'](_0xa2f3('0x6d'),_0x4e96e0[_0xa2f3('0x5f')][_0xa2f3('0x3e')]);_0x41f629[_0xa2f3('0x26')][_0xa2f3('0x6e')]=_0x41f629[_0xa2f3('0x6e')];_0x41f629[_0xa2f3('0x26')][_0xa2f3('0x6f')]=_0xa2f3('0x5a');return respondWithRpcPromise(_0xa2f3('0x70'),'EventManager',{'event':_0xa2f3('0x71'),'message':_0x41f629['message']},client9002)['then'](function(){return _0x41f629;});}return _0x41f629;}return null;})[_0xa2f3('0x20')](respondWithResult(_0x257d9b,null))[_0xa2f3('0x29')](handleError(_0x257d9b,null));};var interaction_log=require(_0xa2f3('0x12'))('sms-interactions');exports[_0xa2f3('0x34')]=function(_0x4013b6,_0x11e7ee,_0x440450){var _0xfb23ad={'agent':{},'channel':_0xa2f3('0x72')};if(_0x4013b6['body']['id']){delete _0x4013b6[_0xa2f3('0x54')]['id'];}_0x4013b6['body'][_0xa2f3('0x5e')]=_0x4013b6[_0xa2f3('0x54')][_0xa2f3('0x5e')]||_0x4013b6[_0xa2f3('0x5f')]['id'];_0xfb23ad[_0xa2f3('0x73')]['id']=_0x4013b6[_0xa2f3('0x54')]['UserId'];return db[_0xa2f3('0x39')][_0xa2f3('0x53')]({'where':{'id':_0x4013b6[_0xa2f3('0x56')]['id'],'UserId':null}})[_0xa2f3('0x20')](handleEntityNotFound(_0x11e7ee,null))[_0xa2f3('0x20')](function(_0x646351){if(_0x646351){_0xfb23ad[_0xa2f3('0x26')]=_0x646351[_0xa2f3('0x62')]({'plain':!![]});return db[_0xa2f3('0x63')][_0xa2f3('0x53')]({'where':{'id':_0x646351['SmsInteractionId']}});}return null;})[_0xa2f3('0x20')](handleEntityNotFound(_0x11e7ee,null))[_0xa2f3('0x20')](function(_0x4511ca){if(_0x4511ca){_0xfb23ad[_0xa2f3('0x66')]=_0x4511ca[_0xa2f3('0x62')]({'plain':!![]});interaction_log[_0xa2f3('0x27')](_0xa2f3('0x74'),_0x4013b6['user']['id'],_0x4013b6[_0xa2f3('0x5f')][_0xa2f3('0x3e')],_0x4013b6[_0xa2f3('0x5f')][_0xa2f3('0x67')],_0xfb23ad[_0xa2f3('0x66')]['id'],_0x4013b6['body']?JSON[_0xa2f3('0x68')](_0x4013b6['body']):_0xa2f3('0x69'));return respondWithRpcPromise(_0xa2f3('0x75'),_0xa2f3('0x76'),_0xfb23ad);}return null;})[_0xa2f3('0x20')](function(_0x1ad2d3){if(_0x1ad2d3){_0x1ad2d3[_0xa2f3('0x26')][_0xa2f3('0x77')]=util[_0xa2f3('0x78')]('SIP/%s',_0x4013b6['user']['name']);_0x1ad2d3['message'][_0xa2f3('0x6e')]=_0xfb23ad[_0xa2f3('0x6e')];_0x1ad2d3['message'][_0xa2f3('0x6f')]=_0xa2f3('0x34');respondWithRpcPromise(_0xa2f3('0x70'),_0xa2f3('0x70'),{'event':'rejectmessage','message':_0x1ad2d3[_0xa2f3('0x26')]},client9002);return _0xfb23ad;}return null;})['then'](respondWithResult(_0x11e7ee,null))[_0xa2f3('0x29')](handleError(_0x11e7ee,null));};exports[_0xa2f3('0x2c')]=function(_0x867ffb,_0x51cc78,_0x18db96){if(_0x867ffb['body']['id']){delete _0x867ffb[_0xa2f3('0x54')]['id'];}var _0x1595e7;return db['SmsMessage'][_0xa2f3('0x53')]({'where':{'id':_0x867ffb[_0xa2f3('0x56')]['id']}})[_0xa2f3('0x20')](handleEntityNotFound(_0x51cc78,null))[_0xa2f3('0x20')](function(_0x4bd99f){if(_0x4bd99f){_0x1595e7=_0x4bd99f;return db[_0xa2f3('0x79')][_0xa2f3('0x53')]({'where':{'id':_0x4bd99f[_0xa2f3('0x7a')]}});}})[_0xa2f3('0x20')](handleEntityNotFound(_0x51cc78,null))['then'](function(_0x444e13){if(_0x444e13){logger['debug'](_0xa2f3('0x22'),_0xa2f3('0x2c'),_0xa2f3('0x7b'),_0x444e13[_0xa2f3('0x3b')],util['inspect'](_0x867ffb[_0xa2f3('0x54')],{'showHidden':![],'depth':null}));switch(_0x444e13['type']){case _0xa2f3('0x7c'):if(_0x867ffb[_0xa2f3('0x54')]['MessageSid']&&_0x867ffb['body'][_0xa2f3('0x7d')]===_0x1595e7[_0xa2f3('0x7e')]){return _0x1595e7['update']({'read':!![]});}else{logger['error'](_0xa2f3('0x7f'),_0xa2f3('0x2c'),_0xa2f3('0x7c'),util[_0xa2f3('0x80')](_0x867ffb[_0xa2f3('0x54')],{'showHidden':![],'depth':null}));}break;case _0xa2f3('0x81'):if(_0x867ffb[_0xa2f3('0x54')][_0xa2f3('0x82')]&&_0x867ffb[_0xa2f3('0x54')][_0xa2f3('0x82')]===_0x1595e7[_0xa2f3('0x7e')]&&_[_0xa2f3('0x83')]([_0xa2f3('0x84'),_0xa2f3('0x85')],_0x867ffb[_0xa2f3('0x54')][_0xa2f3('0x86')])>=0x0){return _0x1595e7[_0xa2f3('0x55')]({'read':!![]});}else{logger['error'](_0xa2f3('0x7f'),_0xa2f3('0x2c'),_0xa2f3('0x87'),util[_0xa2f3('0x80')](_0x867ffb[_0xa2f3('0x54')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xe8d68c=_0x867ffb['body'][_0xa2f3('0x88')][0x0];if(_0xe8d68c[_0xa2f3('0x2c')]['groupName']===_0xa2f3('0x89')){return _0x1595e7[_0xa2f3('0x55')]({'read':!![]});}else{logger[_0xa2f3('0x23')](_0xa2f3('0x7f'),_0xa2f3('0x2c'),_0xa2f3('0x8a'),util[_0xa2f3('0x80')](_0x867ffb[_0xa2f3('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x1595e7;}})[_0xa2f3('0x20')](respondWithResult(_0x51cc78,null))[_0xa2f3('0x29')](handleError(_0x51cc78,null));}; \ No newline at end of file +var _0xc2da=['RejectMessage','SmsAccount','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','request','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','stack','name','send','index','map','SmsMessage','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','then','rows','show','params','rawAttributes','find','create','body','destroy','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','SmsInteraction','SmsInteractionId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc2da,0x124));var _0xac2d=function(_0x5cedbc,_0x48fc4d){_0x5cedbc=_0x5cedbc-0x0;var _0x5d73a0=_0xc2da[_0x5cedbc];return _0x5d73a0;};'use strict';var pdf=require(_0xac2d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xac2d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac2d('0x2'));var rp=require('request-promise');var moment=require(_0xac2d('0x3'));var BPromise=require(_0xac2d('0x4'));var Mustache=require(_0xac2d('0x5'));var util=require(_0xac2d('0x6'));var path=require(_0xac2d('0x7'));var sox=require(_0xac2d('0x8'));var csv=require(_0xac2d('0x9'));var ejs=require(_0xac2d('0xa'));var fs=require('fs');var _=require(_0xac2d('0xb'));var squel=require(_0xac2d('0xc'));var crypto=require(_0xac2d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac2d('0x9'));var querystring=require('querystring');var Papa=require(_0xac2d('0xe'));var Redis=require(_0xac2d('0xf'));var authService=require(_0xac2d('0x10'));var qs=require(_0xac2d('0x11'));var as=require(_0xac2d('0x12'));var hardwareService=require(_0xac2d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xac2d('0x14'));var config=require(_0xac2d('0x15'));var db=require(_0xac2d('0x16'))['db'];config[_0xac2d('0x17')]=_['defaults'](config[_0xac2d('0x17')],{'host':_0xac2d('0x18'),'port':0x18eb});var socket=require(_0xac2d('0x19'))(new Redis(config[_0xac2d('0x17')]));require(_0xac2d('0x1a'))[_0xac2d('0x1b')](socket);var jayson=require(_0xac2d('0x1c'));var client=jayson[_0xac2d('0x1d')][_0xac2d('0x1e')]({'port':0x232c});var client9002=jayson[_0xac2d('0x1d')][_0xac2d('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x33d014,_0x74853a,_0x2d92b5){if(_0x2d92b5){var _0x324978=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x324978['test'](_0x74853a)){return _0x33d014;}else{throw new db[(_0xac2d('0x1f'))][(_0xac2d('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x33d014;}}function respondWithRpcPromise(_0x453113,_0xed956b,_0x1d8e9f,_0x4d34fa){return new BPromise(function(_0x45c12b,_0x5da81c){var _0x20266d=_0x4d34fa||client;return _0x20266d[_0xac2d('0x21')](_0x453113,_0x1d8e9f)['then'](function(_0x23ed75){logger['info']('SmsMessage,\x20%s,\x20%s',_0xed956b,'request\x20sent');logger['debug'](_0xac2d('0x22'),_0xed956b,_0xac2d('0x23'),JSON[_0xac2d('0x24')](_0x23ed75));if(_0x23ed75[_0xac2d('0x25')]){if(_0x23ed75[_0xac2d('0x25')][_0xac2d('0x26')]===0x1f4){logger[_0xac2d('0x25')](_0xac2d('0x27'),_0xed956b,_0x23ed75[_0xac2d('0x25')][_0xac2d('0x28')]);return _0x5da81c(_0x23ed75[_0xac2d('0x25')][_0xac2d('0x28')]);}logger[_0xac2d('0x25')](_0xac2d('0x27'),_0xed956b,_0x23ed75[_0xac2d('0x25')][_0xac2d('0x28')]);return _0x45c12b(_0x23ed75[_0xac2d('0x25')][_0xac2d('0x28')]);}else{logger[_0xac2d('0x29')]('SmsMessage,\x20%s,\x20%s',_0xed956b,_0xac2d('0x23'));_0x45c12b(_0x23ed75[_0xac2d('0x2a')][_0xac2d('0x28')]);}})[_0xac2d('0x2b')](function(_0x563f19){logger['error'](_0xac2d('0x27'),_0xed956b,_0x563f19);_0x5da81c(_0x563f19);});});}function respondWithStatusCode(_0x1c69f1,_0x2ad9b1){_0x2ad9b1=_0x2ad9b1||0xcc;return function(_0x8c3390){if(_0x8c3390){return _0x1c69f1[_0xac2d('0x2c')](_0x2ad9b1);}return _0x1c69f1[_0xac2d('0x2d')](_0x2ad9b1)[_0xac2d('0x2e')]();};}function respondWithResult(_0x42aa82,_0x2ac875){_0x2ac875=_0x2ac875||0xc8;return function(_0x530149){if(_0x530149){return _0x42aa82['status'](_0x2ac875)[_0xac2d('0x2f')](_0x530149);}};}function respondWithFilteredResult(_0xe3670d,_0x3f1094){return function(_0x44b9d0){if(_0x44b9d0){var _0x15776b=_0x44b9d0['count'],_0x49d63f=_0x3f1094[_0xac2d('0x30')],_0x778407=_0x3f1094[_0xac2d('0x30')]+_0x3f1094[_0xac2d('0x31')],_0x37f7ad;if(_0x778407>=_0x15776b){_0x778407=_0x15776b;_0x37f7ad=0xc8;}else{_0x37f7ad=0xce;}_0xe3670d[_0xac2d('0x2d')](_0x37f7ad);return _0xe3670d['set'](_0xac2d('0x32'),_0x49d63f+'-'+_0x778407+'/'+_0x15776b)['json'](_0x44b9d0);}return null;};}function patchUpdates(_0x1ff4a6){return function(_0x4185f2){try{jsonpatch['apply'](_0x4185f2,_0x1ff4a6,!![]);}catch(_0x8402a7){return BPromise[_0xac2d('0x33')](_0x8402a7);}return _0x4185f2[_0xac2d('0x34')]();};}function saveUpdates(_0x1d9da4,_0x2e6733){return function(_0x4eac98){if(_0x4eac98){return _0x4eac98[_0xac2d('0x35')](_0x1d9da4)['then'](function(_0x2d2a36){return _0x2d2a36;});}return null;};}function removeEntity(_0x4bb473,_0x337905){return function(_0x4b16bd){if(_0x4b16bd){return _0x4b16bd['destroy']()['then'](function(){_0x4bb473[_0xac2d('0x2d')](0xcc)[_0xac2d('0x2e')]();});}};}function handleEntityNotFound(_0x24ce3c,_0x1f91f4){return function(_0x3c0533){if(!_0x3c0533){_0x24ce3c[_0xac2d('0x2c')](0x194);}return _0x3c0533;};}function handleError(_0x2144ee,_0x5406a7){_0x5406a7=_0x5406a7||0x1f4;return function(_0xdbc61f){logger[_0xac2d('0x25')](_0xdbc61f[_0xac2d('0x36')]);if(_0xdbc61f[_0xac2d('0x37')]){delete _0xdbc61f[_0xac2d('0x37')];}_0x2144ee['status'](_0x5406a7)[_0xac2d('0x38')](_0xdbc61f);};}exports[_0xac2d('0x39')]=function(_0x2a5723,_0x1e7577){var _0x1ce9ad={},_0x43aa06={},_0x18ca80={'count':0x0,'rows':[]};var _0x3cf517=_[_0xac2d('0x3a')](db[_0xac2d('0x3b')]['rawAttributes'],function(_0x1642ce){return{'name':_0x1642ce['fieldName'],'type':_0x1642ce[_0xac2d('0x3c')][_0xac2d('0x3d')]};});_0x43aa06[_0xac2d('0x3e')]=_[_0xac2d('0x3a')](_0x3cf517,_0xac2d('0x37'));_0x43aa06['query']=_[_0xac2d('0x3f')](_0x2a5723[_0xac2d('0x40')]);_0x43aa06[_0xac2d('0x41')]=_[_0xac2d('0x42')](_0x43aa06[_0xac2d('0x3e')],_0x43aa06['query']);_0x1ce9ad['attributes']=_['intersection'](_0x43aa06[_0xac2d('0x3e')],qs[_0xac2d('0x43')](_0x2a5723[_0xac2d('0x40')][_0xac2d('0x43')]));_0x1ce9ad[_0xac2d('0x44')]=_0x1ce9ad['attributes'][_0xac2d('0x45')]?_0x1ce9ad[_0xac2d('0x44')]:_0x43aa06['model'];if(!_0x2a5723[_0xac2d('0x40')][_0xac2d('0x46')](_0xac2d('0x47'))){_0x1ce9ad[_0xac2d('0x31')]=qs[_0xac2d('0x31')](_0x2a5723['query'][_0xac2d('0x31')]);_0x1ce9ad[_0xac2d('0x30')]=qs[_0xac2d('0x30')](_0x2a5723[_0xac2d('0x40')]['offset']);}_0x1ce9ad['order']=qs[_0xac2d('0x48')](_0x2a5723['query'][_0xac2d('0x48')]);_0x1ce9ad[_0xac2d('0x49')]=qs['filters'](_['pick'](_0x2a5723[_0xac2d('0x40')],_0x43aa06['filters']),_0x3cf517);if(_0x2a5723['query']['filter']){_0x1ce9ad[_0xac2d('0x49')]=_[_0xac2d('0x4a')](_0x1ce9ad[_0xac2d('0x49')],{'$or':_['map'](_0x3cf517,function(_0x32c260){if(_0x32c260['type']!==_0xac2d('0x4b')){var _0xd18bcb={};_0xd18bcb[_0x32c260['name']]={'$like':'%'+_0x2a5723[_0xac2d('0x40')][_0xac2d('0x4c')]+'%'};return _0xd18bcb;}})});}_0x1ce9ad=_[_0xac2d('0x4a')]({},_0x1ce9ad,_0x2a5723[_0xac2d('0x4d')]);var _0x1c7ab9={'where':_0x1ce9ad['where']};return db[_0xac2d('0x3b')][_0xac2d('0x4e')](_0x1c7ab9)['then'](function(_0x850268){_0x18ca80['count']=_0x850268;if(_0x2a5723['query'][_0xac2d('0x4f')]){_0x1ce9ad[_0xac2d('0x50')]=[{'all':!![]}];}return db['SmsMessage'][_0xac2d('0x51')](_0x1ce9ad);})[_0xac2d('0x52')](function(_0x29935b){_0x18ca80[_0xac2d('0x53')]=_0x29935b;return _0x18ca80;})[_0xac2d('0x52')](respondWithFilteredResult(_0x1e7577,_0x1ce9ad))[_0xac2d('0x2b')](handleError(_0x1e7577,null));};exports[_0xac2d('0x54')]=function(_0x57bf66,_0x1975fb){var _0x2df040={'raw':!![],'where':{'id':_0x57bf66[_0xac2d('0x55')]['id']}},_0x4f2a37={};_0x4f2a37[_0xac2d('0x3e')]=_[_0xac2d('0x3f')](db[_0xac2d('0x3b')][_0xac2d('0x56')]);_0x4f2a37['query']=_[_0xac2d('0x3f')](_0x57bf66['query']);_0x4f2a37['filters']=_[_0xac2d('0x42')](_0x4f2a37['model'],_0x4f2a37[_0xac2d('0x40')]);_0x2df040[_0xac2d('0x44')]=_[_0xac2d('0x42')](_0x4f2a37[_0xac2d('0x3e')],qs[_0xac2d('0x43')](_0x57bf66[_0xac2d('0x40')]['fields']));_0x2df040['attributes']=_0x2df040[_0xac2d('0x44')][_0xac2d('0x45')]?_0x2df040[_0xac2d('0x44')]:_0x4f2a37[_0xac2d('0x3e')];if(_0x57bf66['query'][_0xac2d('0x4f')]){_0x2df040[_0xac2d('0x50')]=[{'all':!![]}];}_0x2df040=_[_0xac2d('0x4a')]({},_0x2df040,_0x57bf66['options']);return db[_0xac2d('0x3b')][_0xac2d('0x57')](_0x2df040)[_0xac2d('0x52')](handleEntityNotFound(_0x1975fb,null))[_0xac2d('0x52')](respondWithResult(_0x1975fb,null))['catch'](handleError(_0x1975fb,null));};exports[_0xac2d('0x58')]=function(_0x2d6b2,_0xdd4505){return db['SmsMessage'][_0xac2d('0x58')](_0x2d6b2['body'],{})[_0xac2d('0x52')](respondWithResult(_0xdd4505,0xc9))[_0xac2d('0x2b')](handleError(_0xdd4505,null));};exports['update']=function(_0x244bdd,_0x281566){if(_0x244bdd[_0xac2d('0x59')]['id']){delete _0x244bdd[_0xac2d('0x59')]['id'];}return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0x244bdd['params']['id']}})['then'](handleEntityNotFound(_0x281566,null))[_0xac2d('0x52')](saveUpdates(_0x244bdd[_0xac2d('0x59')],null))[_0xac2d('0x52')](respondWithResult(_0x281566,null))[_0xac2d('0x2b')](handleError(_0x281566,null));};exports[_0xac2d('0x5a')]=function(_0x13ffff,_0x5bcf45){return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0x13ffff[_0xac2d('0x55')]['id']}})[_0xac2d('0x52')](handleEntityNotFound(_0x5bcf45,null))[_0xac2d('0x52')](removeEntity(_0x5bcf45,null))[_0xac2d('0x2b')](handleError(_0x5bcf45,null));};exports[_0xac2d('0x5b')]=function(_0x343002,_0x188746){return db['SmsMessage'][_0xac2d('0x5b')]()[_0xac2d('0x52')](respondWithResult(_0x188746,null))[_0xac2d('0x2b')](handleError(_0x188746,null));};var interaction_log=require(_0xac2d('0x5c'))(_0xac2d('0x5d'));exports[_0xac2d('0x5e')]=function(_0x2eab04,_0x108102,_0x5e7c06){var _0x540af1={'channel':_0xac2d('0x5f')};if(_0x2eab04[_0xac2d('0x59')]['id']){delete _0x2eab04[_0xac2d('0x59')]['id'];}_0x2eab04[_0xac2d('0x59')][_0xac2d('0x60')]=!![];_0x2eab04[_0xac2d('0x59')][_0xac2d('0x61')]=moment()[_0xac2d('0x62')](_0xac2d('0x63'));_0x2eab04[_0xac2d('0x59')]['UserId']=_0x2eab04[_0xac2d('0x59')][_0xac2d('0x64')]||_0x2eab04['user']['id'];return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0x2eab04['params']['id'],'UserId':null},'include':[{'model':db[_0xac2d('0x65')],'as':_0xac2d('0x66')}]})[_0xac2d('0x52')](handleEntityNotFound(_0x108102,null))[_0xac2d('0x52')](saveUpdates(_0x2eab04['body'],null))['then'](function(_0x5130c0){if(_0x5130c0){_0x540af1[_0xac2d('0x28')]=_0x5130c0['get']({'plain':!![]});return db[_0xac2d('0x67')][_0xac2d('0x57')]({'where':{'id':_0x5130c0[_0xac2d('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x108102,null))['then'](function(_0x21907b){if(_0x21907b){return _0x21907b[_0xac2d('0x35')]({'UserId':_0x2eab04[_0xac2d('0x59')][_0xac2d('0x64')],'read1stAt':_[_0xac2d('0x69')](_0x21907b['read1stAt'])?moment()['format'](_0xac2d('0x63')):undefined});}return null;})['then'](function(_0x53450e){if(_0x53450e){_0x540af1[_0xac2d('0x6a')]=_0x53450e[_0xac2d('0x6b')]({'plain':!![]});interaction_log[_0xac2d('0x29')](_0xac2d('0x6c'),_0x2eab04[_0xac2d('0x6d')]['id'],_0x2eab04[_0xac2d('0x6d')][_0xac2d('0x37')],_0x2eab04[_0xac2d('0x6d')][_0xac2d('0x6e')],_0x540af1[_0xac2d('0x6a')]['id'],_0x2eab04[_0xac2d('0x59')]?JSON['stringify'](_0x2eab04['body']):_0xac2d('0x6f'));return respondWithRpcPromise(_0xac2d('0x70'),_0xac2d('0x71'),_0x540af1);}return null;})[_0xac2d('0x52')](function(_0x5d7f26){if(_0x5d7f26){if(_0x2eab04[_0xac2d('0x59')][_0xac2d('0x72')]){_0x540af1[_0xac2d('0x28')][_0xac2d('0x73')]=util['format'](_0xac2d('0x74'),_0x2eab04[_0xac2d('0x6d')][_0xac2d('0x37')]);_0x540af1[_0xac2d('0x28')][_0xac2d('0x75')]=_0x540af1[_0xac2d('0x75')];_0x540af1[_0xac2d('0x28')][_0xac2d('0x76')]=_0xac2d('0x5e');return respondWithRpcPromise(_0xac2d('0x77'),'EventManager',{'event':_0xac2d('0x78'),'message':_0x540af1[_0xac2d('0x28')]},client9002)[_0xac2d('0x52')](function(){return _0x540af1;});}return _0x540af1;}return null;})[_0xac2d('0x52')](respondWithResult(_0x108102,null))['catch'](handleError(_0x108102,null));};var interaction_log=require(_0xac2d('0x5c'))(_0xac2d('0x5d'));exports[_0xac2d('0x33')]=function(_0xec4bf0,_0x2898c4,_0x667e82){var _0xdbbd92={'agent':{},'channel':'sms'};if(_0xec4bf0[_0xac2d('0x59')]['id']){delete _0xec4bf0[_0xac2d('0x59')]['id'];}_0xec4bf0[_0xac2d('0x59')]['UserId']=_0xec4bf0[_0xac2d('0x59')][_0xac2d('0x64')]||_0xec4bf0[_0xac2d('0x6d')]['id'];_0xdbbd92[_0xac2d('0x79')]['id']=_0xec4bf0['body'][_0xac2d('0x64')];return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0xec4bf0[_0xac2d('0x55')]['id'],'UserId':null}})[_0xac2d('0x52')](handleEntityNotFound(_0x2898c4,null))[_0xac2d('0x52')](function(_0xe1ea34){if(_0xe1ea34){_0xdbbd92[_0xac2d('0x28')]=_0xe1ea34['get']({'plain':!![]});return db['SmsInteraction'][_0xac2d('0x57')]({'where':{'id':_0xe1ea34[_0xac2d('0x68')]}});}return null;})[_0xac2d('0x52')](handleEntityNotFound(_0x2898c4,null))[_0xac2d('0x52')](function(_0x4ebde2){if(_0x4ebde2){_0xdbbd92[_0xac2d('0x6a')]=_0x4ebde2[_0xac2d('0x6b')]({'plain':!![]});interaction_log[_0xac2d('0x29')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xec4bf0[_0xac2d('0x6d')]['id'],_0xec4bf0['user']['name'],_0xec4bf0['user'][_0xac2d('0x6e')],_0xdbbd92[_0xac2d('0x6a')]['id'],_0xec4bf0['body']?JSON['stringify'](_0xec4bf0[_0xac2d('0x59')]):_0xac2d('0x6f'));return respondWithRpcPromise(_0xac2d('0x7a'),'rejectMessage',_0xdbbd92);}return null;})[_0xac2d('0x52')](function(_0x388536){if(_0x388536){_0x388536['message']['interface']=util[_0xac2d('0x62')](_0xac2d('0x74'),_0xec4bf0[_0xac2d('0x6d')]['name']);_0x388536[_0xac2d('0x28')]['channel']=_0xdbbd92[_0xac2d('0x75')];_0x388536['message'][_0xac2d('0x76')]='reject';respondWithRpcPromise(_0xac2d('0x77'),'EventManager',{'event':'rejectmessage','message':_0x388536[_0xac2d('0x28')]},client9002);return _0xdbbd92;}return null;})[_0xac2d('0x52')](respondWithResult(_0x2898c4,null))[_0xac2d('0x2b')](handleError(_0x2898c4,null));};exports[_0xac2d('0x2d')]=function(_0x5e099f,_0xf77b1d,_0x1e802f){if(_0x5e099f['body']['id']){delete _0x5e099f['body']['id'];}var _0x346499;return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0x5e099f[_0xac2d('0x55')]['id']}})['then'](handleEntityNotFound(_0xf77b1d,null))[_0xac2d('0x52')](function(_0x280fe9){if(_0x280fe9){_0x346499=_0x280fe9;return db[_0xac2d('0x7b')][_0xac2d('0x57')]({'where':{'id':_0x280fe9['SmsAccountId']}});}})['then'](handleEntityNotFound(_0xf77b1d,null))['then'](function(_0x5840f9){if(_0x5840f9){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xac2d('0x2d'),'received\x20delivery\x20report\x20from',_0x5840f9[_0xac2d('0x3c')],util[_0xac2d('0x7c')](_0x5e099f['body'],{'showHidden':![],'depth':null}));switch(_0x5840f9[_0xac2d('0x3c')]){case _0xac2d('0x7d'):if(_0x5e099f[_0xac2d('0x59')]['MessageSid']&&_0x5e099f[_0xac2d('0x59')][_0xac2d('0x7e')]===_0x346499[_0xac2d('0x7f')]){return _0x346499[_0xac2d('0x35')]({'read':!![]});}else{logger[_0xac2d('0x25')](_0xac2d('0x80'),_0xac2d('0x2d'),_0xac2d('0x7d'),util[_0xac2d('0x7c')](_0x5e099f[_0xac2d('0x59')],{'showHidden':![],'depth':null}));}break;case _0xac2d('0x81'):if(_0x5e099f[_0xac2d('0x59')][_0xac2d('0x82')]&&_0x5e099f[_0xac2d('0x59')][_0xac2d('0x82')]===_0x346499['messageId']&&_[_0xac2d('0x83')]([_0xac2d('0x84'),_0xac2d('0x85')],_0x5e099f[_0xac2d('0x59')][_0xac2d('0x86')])>=0x0){return _0x346499[_0xac2d('0x35')]({'read':!![]});}else{logger[_0xac2d('0x25')](_0xac2d('0x80'),_0xac2d('0x2d'),'plivio',util['inspect'](_0x5e099f[_0xac2d('0x59')],{'showHidden':![],'depth':null}));}break;case _0xac2d('0x87'):var _0x403a8f=_0x5e099f[_0xac2d('0x59')][_0xac2d('0x88')][0x0];if(_0x403a8f[_0xac2d('0x2d')][_0xac2d('0x89')]==='DELIVERED'){return _0x346499[_0xac2d('0x35')]({'read':!![]});}else{logger[_0xac2d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util[_0xac2d('0x7c')](_0x5e099f[_0xac2d('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x346499;}})['then'](respondWithResult(_0xf77b1d,null))[_0xac2d('0x2b')](handleError(_0xf77b1d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f45f861..dd1a4bd 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 _0x65fd=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save','update'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x65fd,0x1db));var _0xd65f=function(_0x6134aa,_0xabf3cc){_0x6134aa=_0x6134aa-0x0;var _0x24bf6f=_0x65fd[_0x6134aa];return _0x24bf6f;};'use strict';var EventEmitter=require(_0xd65f('0x0'));var SmsMessage=require(_0xd65f('0x1'))['db'][_0xd65f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd65f('0x3'),'afterUpdate':_0xd65f('0x4'),'afterDestroy':_0xd65f('0x5')};function emitEvent(_0x19f032){return function(_0x9ca3a6,_0x1f863d,_0x5ebde0){SmsMessageEvents['emit'](_0x19f032+':'+_0x9ca3a6['id'],_0x9ca3a6);SmsMessageEvents[_0xd65f('0x6')](_0x19f032,_0x9ca3a6);_0x5ebde0(null);};}for(var e in events){if(events[_0xd65f('0x7')](e)){var event=events[e];SmsMessage[_0xd65f('0x8')](e,emitEvent(event));}}module[_0xd65f('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x1107=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','hook','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1107,0x7d));var _0x7110=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1107[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x7110('0x0'));var SmsMessage=require(_0x7110('0x1'))['db'][_0x7110('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7110('0x3')](0x0);var events={'afterCreate':_0x7110('0x4'),'afterUpdate':_0x7110('0x5'),'afterDestroy':_0x7110('0x6')};function emitEvent(_0x463857){return function(_0x4c9b20,_0x590064,_0x5c790b){SmsMessageEvents['emit'](_0x463857+':'+_0x4c9b20['id'],_0x4c9b20);SmsMessageEvents['emit'](_0x463857,_0x4c9b20);_0x5c790b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7110('0x7')](e,emitEvent(event));}}module[_0x7110('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 5da05ae..2037300 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 _0x7f81=['POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','password','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','/api/sms/messages/','IBSSO\x20','infobip','csc','crypto','apiKey','login','md5','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','SmsInteractionId','update','createdAt','catch','secret','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','sms'];(function(_0x4afe31,_0x126fed){var _0x235433=function(_0x686e98){while(--_0x686e98){_0x4afe31['push'](_0x4afe31['shift']());}};_0x235433(++_0x126fed);}(_0x7f81,0x1ac));var _0x17f8=function(_0x1bf977,_0xbb8a6b){_0x1bf977=_0x1bf977-0x0;var _0x559680=_0x7f81[_0x1bf977];return _0x559680;};'use strict';var _=require(_0x17f8('0x0'));var util=require(_0x17f8('0x1'));var logger=require(_0x17f8('0x2'))(_0x17f8('0x3'));var moment=require('moment');var BPromise=require(_0x17f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17f8('0x5'));var rimraf=require(_0x17f8('0x6'));var config=require(_0x17f8('0x7'));var attributes=require(_0x17f8('0x8'));module[_0x17f8('0x9')]=function(_0x4066b2,_0x53438d){return _0x4066b2[_0x17f8('0xa')](_0x17f8('0xb'),attributes,{'tableName':_0x17f8('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x17f8('0xd'),'fields':[_0x17f8('0xe')],'type':_0x17f8('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36728e,_0x47ab34,_0x1642cf){var _0x5b92cc=_0x4066b2[_0x17f8('0x10')];var _0x3220f5=_0x36728e[_0x17f8('0x11')]({'plain':!![]});if(_0x3220f5[_0x17f8('0x12')][_0x17f8('0x13')]()==='in'||_0x3220f5[_0x17f8('0x12')][_0x17f8('0x13')]()===_0x17f8('0x14')&&!_0x3220f5['secret']&&!_[_0x17f8('0x15')](_0x3220f5[_0x17f8('0x16')])){_0x5b92cc[_0x17f8('0x17')]['findOne']({'where':{'id':_0x3220f5[_0x17f8('0x18')]}})['then'](function(_0x25d72f){if(_0x25d72f){_0x25d72f[_0x17f8('0x19')]({'lastMsgAt':_0x3220f5[_0x17f8('0x1a')],'lastMsgDirection':_0x3220f5[_0x17f8('0x12')][_0x17f8('0x13')]()});}})[_0x17f8('0x1b')](function(_0xe6be41){console['error'](_0xe6be41);});}if(_0x3220f5[_0x17f8('0x12')]===_0x17f8('0x14')&&!_0x3220f5[_0x17f8('0x1c')]){var _0x65b7c5;_0x5b92cc[_0x17f8('0x1d')][_0x17f8('0x1e')]({'where':{'id':_0x3220f5[_0x17f8('0x1f')]},'raw':!![]})[_0x17f8('0x20')](function(_0x2a1a53){_0x65b7c5=_0x2a1a53;if(_0x65b7c5&&_0x65b7c5[_0x17f8('0x21')]){switch(_0x65b7c5[_0x17f8('0x21')]){case _0x17f8('0x22'):var _0x52117d=require(_0x17f8('0x22'));if(_0x65b7c5[_0x17f8('0x23')]&&_0x65b7c5[_0x17f8('0x24')]&&_0x65b7c5[_0x17f8('0x25')]){var _0x1b9ba7=new _0x52117d(_0x65b7c5[_0x17f8('0x23')],_0x65b7c5[_0x17f8('0x24')]);_0x1b9ba7['messages']['create']({'body':_0x3220f5['body'],'to':_0x3220f5[_0x17f8('0x25')],'from':_0x65b7c5[_0x17f8('0x25')],'statusCallback':_0x65b7c5['remote']+'/api/sms/messages/'+_0x3220f5['id']+_0x17f8('0x26')+_0x65b7c5[_0x17f8('0x27')]})['then'](function(_0x3a63ce){if(_0x3a63ce[_0x17f8('0x28')]){return _0x36728e[_0x17f8('0x19')]({'messageId':_0x3a63ce[_0x17f8('0x28')]});}})[_0x17f8('0x1b')](function(_0x174ecf){logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x22'),util[_0x17f8('0x2c')](_0x174ecf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x22'),_0x17f8('0x2d'));}break;case _0x17f8('0x2e'):var _0x5ed964='https://api.skebby.it/API/v1.0/REST/';if(_0x65b7c5[_0x17f8('0x2f')]&&_0x65b7c5['password']){var _0x40d610={'recipient':[_0x3220f5[_0x17f8('0x25')]],'message':_0x3220f5[_0x17f8('0xe')],'message_type':_0x65b7c5[_0x17f8('0x30')]};if(_0x65b7c5[_0x17f8('0x30')]&&_0x65b7c5[_0x17f8('0x30')]!=='SI'){_0x40d610[_0x17f8('0x31')]=_0x65b7c5['phone'];}var _0x1c255f={'url':_0x5ed964+_0x17f8('0x32')+_0x65b7c5[_0x17f8('0x2f')]+'&password='+_0x65b7c5['password'],'method':'GET'};rp(_0x1c255f)[_0x17f8('0x20')](function(_0x432a9d){var _0x224733=_0x432a9d['split'](';');var _0x23f83a={'user_key':_0x224733[0x0],'session_key':_0x224733[0x1]};_0x1c255f={'url':_0x5ed964+_0x17f8('0x33'),'method':_0x17f8('0x34'),'headers':{'user_key':_0x23f83a[_0x17f8('0x35')],'Session_key':_0x23f83a[_0x17f8('0x36')]},'json':!![],'body':_0x40d610};return rp(_0x1c255f);})[_0x17f8('0x20')](function(_0x294df8){if(_0x294df8[_0x17f8('0x37')]>=0x1){var _0x2954aa={'messageId':_0x294df8[_0x17f8('0x38')]};if(_0x65b7c5[_0x17f8('0x30')]!=='GP'||!_0x65b7c5[_0x17f8('0x39')]){_0x2954aa[_0x17f8('0x3a')]=!![];}return _0x36728e[_0x17f8('0x19')](_0x2954aa);}else{return logger['error'](_0x17f8('0x2a'),_0x17f8('0x2b'),'skebby',util[_0x17f8('0x2c')](_0x294df8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e6653){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x2e'),util[_0x17f8('0x2c')](_0x4e6653,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x2e'),_0x17f8('0x3b'));}break;case _0x17f8('0x3c'):if(_0x65b7c5[_0x17f8('0x24')]){var _0x148a44={'recipient':_0x3220f5[_0x17f8('0x25')],'message':_0x3220f5['body'],'sender':_0x65b7c5[_0x17f8('0x3d')]||_0x65b7c5[_0x17f8('0x25')],'authorization':_0x65b7c5['authToken']};var _0x47ab34={'method':_0x17f8('0x34'),'uri':_0x17f8('0x3e'),'body':_0x148a44,'json':!![]};rp(_0x47ab34)[_0x17f8('0x20')](function(_0x45bacf){var _0x182c64={'messageId':_0x45bacf[_0x17f8('0x3f')]};if(!_0x65b7c5[_0x17f8('0x39')]){_0x182c64[_0x17f8('0x3a')]=!![];}return _0x36728e['update'](_0x182c64);})[_0x17f8('0x1b')](function(_0x405365){logger['error'](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x3c'),util[_0x17f8('0x2c')](_0x405365,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x3c'),_0x17f8('0x40'));}break;case _0x17f8('0x41'):if(_0x65b7c5[_0x17f8('0x2f')]&&_0x65b7c5['password']){var _0x148a44={'messages':[{'source':_0x17f8('0x42'),'to':_0x3220f5[_0x17f8('0x25')],'body':_0x3220f5['body'],'from':_0x65b7c5[_0x17f8('0x3d')]||_0x65b7c5[_0x17f8('0x25')]}]};var _0x206383=util[_0x17f8('0x43')]('%s:%s',_0x65b7c5['username'],_0x65b7c5[_0x17f8('0x44')]);var _0x47ab34={'method':'POST','uri':_0x17f8('0x45'),'body':_0x148a44,'headers':{'Authorization':util[_0x17f8('0x43')](_0x17f8('0x46'),new Buffer(_0x206383)['toString'](_0x17f8('0x47')))},'json':!![]};rp(_0x47ab34)[_0x17f8('0x20')](function(_0x141d31){if(_0x141d31['http_code']>=0xc8&&_0x141d31[_0x17f8('0x48')]<=0xce){if(_0x141d31['data']&&_0x141d31[_0x17f8('0x49')][_0x17f8('0x4a')]>0x0){var _0x3470f7=_[_0x17f8('0x4b')](_0x141d31['data'][_0x17f8('0x4c')]);var _0x1acef1={'messageId':_0x3470f7[_0x17f8('0x4d')]};if(!_0x65b7c5[_0x17f8('0x39')]){_0x1acef1[_0x17f8('0x3a')]=!![];}return _0x36728e[_0x17f8('0x19')](_0x1acef1);}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x4e'),util[_0x17f8('0x2c')](_0x141d31,{'showHidden':![],'depth':null}));}}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x4e'),util[_0x17f8('0x2c')](_0x141d31,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb41210){logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x4e'),util['inspect'](_0xb41210,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x17f8('0x2a'),_0x17f8('0x2b'),'clickSend',_0x17f8('0x3b'));}break;case _0x17f8('0x4f'):if(_0x65b7c5[_0x17f8('0x50')]&&_0x65b7c5['authToken']){var _0x148a44={'dst':_0x3220f5[_0x17f8('0x25')],'text':_0x3220f5[_0x17f8('0xe')],'src':_0x65b7c5[_0x17f8('0x3d')]||_0x65b7c5['phone'],'url':_0x65b7c5[_0x17f8('0x51')]+'/api/sms/messages/'+_0x3220f5['id']+_0x17f8('0x26')+_0x65b7c5[_0x17f8('0x27')]};var _0x206383=util[_0x17f8('0x43')]('%s:%s',_0x65b7c5['authId'],_0x65b7c5[_0x17f8('0x24')]);var _0x47ab34={'method':_0x17f8('0x34'),'uri':util[_0x17f8('0x43')](_0x17f8('0x52'),_0x65b7c5['authId']),'body':_0x148a44,'headers':{'Authorization':util[_0x17f8('0x43')](_0x17f8('0x46'),new Buffer(_0x206383)[_0x17f8('0x53')](_0x17f8('0x47')))},'json':!![]};rp(_0x47ab34)['then'](function(_0x30258c){var _0x4cdbb1={'messageId':_0x30258c[_0x17f8('0x54')][0x0]};return _0x36728e['update'](_0x4cdbb1);})['catch'](function(_0x3e9544){logger[_0x17f8('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17f8('0x2b'),_0x17f8('0x4f'),util['inspect'](_0x3e9544,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17f8('0x2b'),_0x17f8('0x4f'),_0x17f8('0x55'));}break;case'infobip':if(_0x65b7c5[_0x17f8('0x2f')]&&_0x65b7c5[_0x17f8('0x44')]){if(_0x65b7c5[_0x17f8('0x56')]){var _0x32335c={'method':_0x17f8('0x34'),'uri':_0x65b7c5[_0x17f8('0x56')]+_0x17f8('0x57'),'body':{'username':_0x65b7c5[_0x17f8('0x2f')],'password':_0x65b7c5[_0x17f8('0x44')]},'json':!![]};return rp(_0x32335c)['then'](function(_0x376223){var _0x56f643={'method':'POST','uri':_0x65b7c5[_0x17f8('0x56')]+_0x17f8('0x58'),'body':{'messages':[{'from':_0x65b7c5[_0x17f8('0x25')],'destinations':[{'to':_0x3220f5[_0x17f8('0x25')]}],'text':_0x3220f5[_0x17f8('0xe')],'notifyUrl':_0x65b7c5[_0x17f8('0x51')]+_0x17f8('0x59')+_0x3220f5['id']+_0x17f8('0x26')+_0x65b7c5[_0x17f8('0x27')],'notifyContentType':'application/json','callbackData':_0x65b7c5[_0x17f8('0x25')]+';'+_0x3220f5[_0x17f8('0xe')]}]},'headers':{'Authorization':_0x17f8('0x5a')+_0x376223[_0x17f8('0x27')]},'json':!![]};return rp(_0x56f643)[_0x17f8('0x20')](function(_0x1d7499){if(_0x1d7499[_0x17f8('0x4c')]){var _0x351a80={'messageId':_0x1d7499['messages'][0x0]['messageId']};if(!_0x65b7c5[_0x17f8('0x39')]){_0x351a80[_0x17f8('0x3a')]=!![];}return _0x36728e[_0x17f8('0x19')](_0x351a80);}else{return logger['error'](_0x17f8('0x2a'),'afterCreate','infobip',util[_0x17f8('0x2c')](_0x1d7499,{'showHidden':![],'depth':null}));}});})[_0x17f8('0x1b')](function(_0x30c143){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x5b'),util[_0x17f8('0x2c')](_0x30c143,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x5b'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x17f8('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x17f8('0x5b'),_0x17f8('0x3b'));}break;case _0x17f8('0x5c'):var _0x10aa6f=require(_0x17f8('0x5d'));if(_0x65b7c5[_0x17f8('0x5e')]){var _0x452a73={};_0x452a73[_0x17f8('0x5f')]=_0x65b7c5['username'];_0x452a73[_0x17f8('0x25')]=_0x3220f5[_0x17f8('0x25')];_0x452a73['sender']=_0x65b7c5[_0x17f8('0x25')];_0x452a73['text']=_0x3220f5[_0x17f8('0xe')];_0x452a73['timestamp']=+new Date();var _0x21bb02='';var _0x34612e='';var _0x500bec=Object['keys'](_0x452a73);_0x500bec['sort']();for(var _0x56569d=0x0;_0x56569d<_0x500bec['length'];_0x56569d++){if(_0x21bb02!=''){_0x21bb02+='&';}_0x21bb02+=_0x500bec[_0x56569d]+'='+encodeURIComponent(_0x452a73[_0x500bec[_0x56569d]]);_0x34612e+=_0x452a73[_0x500bec[_0x56569d]];}_0x34612e+=_0x65b7c5[_0x17f8('0x5e')];_0x34612e=_0x10aa6f['createHash'](_0x17f8('0x60'))[_0x17f8('0x19')](_0x34612e)[_0x17f8('0x61')](_0x17f8('0x62'));if(_0x21bb02!==''){_0x21bb02+='&';}_0x21bb02+=_0x17f8('0x63')+_0x34612e;var _0x1c255f={'method':_0x17f8('0x64'),'uri':_0x65b7c5['baseUrl']+_0x17f8('0x65')+_0x21bb02,'json':!![]};return rp(_0x1c255f)[_0x17f8('0x20')](function(_0xcf0cf){var _0x3c94eb=Object[_0x17f8('0x66')](_0xcf0cf);if(_0xcf0cf[_0x3c94eb[0x0]]['error']&&parseInt(_0xcf0cf[_0x3c94eb[0x0]][_0x17f8('0x29')])===0x0){var _0x31d507={'messageId':_0xcf0cf[_0x3c94eb[0x0]][_0x17f8('0x67')]};if(!_0x65b7c5[_0x17f8('0x39')]){_0x31d507[_0x17f8('0x3a')]=!![];}return _0x36728e[_0x17f8('0x19')](_0x31d507);}else{return logger['error'](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x5c'),util[_0x17f8('0x2c')](_0xcf0cf[_0x17f8('0x29')],{'showHidden':![],'depth':null}));}})[_0x17f8('0x1b')](function(_0x278a4f){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x5c'),util[_0x17f8('0x2c')](_0x278a4f,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x5c'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x65b7c5[_0x17f8('0x5e')]){var _0x385897={'method':_0x17f8('0x34'),'uri':_0x17f8('0x68'),'headers':{'Authorization':_0x65b7c5[_0x17f8('0x5e')]},'body':{'content':_0x3220f5[_0x17f8('0xe')],'to':[_0x3220f5[_0x17f8('0x25')]],'from':_0x65b7c5[_0x17f8('0x25')],'binary':![],'clientMessageId':'uuid','charset':_0x17f8('0x69')},'json':!![]};rp(_0x385897)[_0x17f8('0x20')](function(_0x472bc2){if(!_0x472bc2[_0x17f8('0x29')]){var _0x206eba={'messageId':_0x472bc2[_0x17f8('0x4c')][0x0][_0x17f8('0x6a')]};if(!_0x65b7c5[_0x17f8('0x39')]){_0x206eba[_0x17f8('0x3a')]=!![];}return _0x36728e['update'](_0x206eba);}else{return logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x6b'),util[_0x17f8('0x2c')](_0x472bc2['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3e8714){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x6b'),util[_0x17f8('0x2c')](_0x3e8714,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x6b'),_0x17f8('0x6c'));}break;case'intelepeer':if(_0x65b7c5[_0x17f8('0x5e')]){var _0x445644={};var _0x1c255f={'method':'POST','uri':_0x17f8('0x6d'),'headers':{'Authorization':_0x17f8('0x6e')+_0x65b7c5[_0x17f8('0x5e')],'Content-Type':_0x17f8('0x6f')},'body':{'from':_0x65b7c5[_0x17f8('0x25')],'to':_0x3220f5[_0x17f8('0x25')],'text':_0x3220f5[_0x17f8('0xe')]},'json':!![]};return rp(_0x1c255f)[_0x17f8('0x20')](function(_0x46938c){if(_0x46938c[_0x17f8('0x70')]==0xca){_0x445644[_0x17f8('0x71')]=_0x46938c;var _0x485e5b={'method':_0x17f8('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x17f8('0x6e')+_0x65b7c5['apiKey'],'Content-Type':_0x17f8('0x6f')},'body':{'refid':_0x445644['message'][_0x17f8('0x72')]},'json':!![]};return rp(_0x485e5b)[_0x17f8('0x20')](function(_0x4e39a1){_0x445644[_0x17f8('0x73')]=_0x4e39a1;var _0x278681={'messageId':_0x445644[_0x17f8('0x71')]['refid'],'read':!![]};return _0x36728e[_0x17f8('0x19')](_0x278681);});}else{return logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x74'),util[_0x17f8('0x2c')](_0x46938c,{'showHidden':![],'depth':null}));}})[_0x17f8('0x1b')](function(_0x59a4e1){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate','intelepeer',util[_0x17f8('0x2c')](_0x59a4e1,{'showHidden':![],'depth':null}));});}else{return logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x74'),_0x17f8('0x75'));}break;}}})[_0x17f8('0x76')](function(){_0x1642cf();});}else{_0x1642cf();}}},'charset':_0x17f8('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4f98=['SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','senderString','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','remote','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','sort','createHash','digest','signature=','GET','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','out','SmsAccount','SmsAccountId','type','twilio','authToken','accountSid','messages','phone','/api/sms/messages/','token','sid','error'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x4f98,0xc1));var _0x84f9=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x4f98[_0xcfeda9];return _0x4826c7;};'use strict';var _=require(_0x84f9('0x0'));var util=require(_0x84f9('0x1'));var logger=require(_0x84f9('0x2'))(_0x84f9('0x3'));var moment=require(_0x84f9('0x4'));var BPromise=require(_0x84f9('0x5'));var rp=require(_0x84f9('0x6'));var fs=require('fs');var path=require(_0x84f9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x84f9('0x8'));module['exports']=function(_0x137dbe,_0x3ad165){return _0x137dbe[_0x84f9('0x9')](_0x84f9('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x84f9('0xb'),'fields':[_0x84f9('0xb')]},{'name':_0x84f9('0xc'),'fields':[_0x84f9('0xd')],'type':_0x84f9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19ba13,_0x50ce54,_0x1ca981){var _0x4f8d89=_0x137dbe[_0x84f9('0xf')];var _0x1ad4a2=_0x19ba13['get']({'plain':!![]});if(_0x1ad4a2[_0x84f9('0x10')][_0x84f9('0x11')]()==='in'||_0x1ad4a2[_0x84f9('0x10')]['toLowerCase']()==='out'&&!_0x1ad4a2[_0x84f9('0x12')]&&!_[_0x84f9('0x13')](_0x1ad4a2['UserId'])){_0x4f8d89[_0x84f9('0x14')]['findOne']({'where':{'id':_0x1ad4a2[_0x84f9('0x15')]}})[_0x84f9('0x16')](function(_0x508d01){if(_0x508d01){_0x508d01[_0x84f9('0x17')]({'lastMsgAt':_0x1ad4a2[_0x84f9('0x18')],'lastMsgDirection':_0x1ad4a2[_0x84f9('0x10')]['toLowerCase']()});}})[_0x84f9('0x19')](function(_0x1a3ece){console['error'](_0x1a3ece);});}if(_0x1ad4a2[_0x84f9('0x10')]===_0x84f9('0x1a')&&!_0x1ad4a2[_0x84f9('0x12')]){var _0xbcde4;_0x4f8d89[_0x84f9('0x1b')]['find']({'where':{'id':_0x1ad4a2[_0x84f9('0x1c')]},'raw':!![]})[_0x84f9('0x16')](function(_0x32012c){_0xbcde4=_0x32012c;if(_0xbcde4&&_0xbcde4[_0x84f9('0x1d')]){switch(_0xbcde4[_0x84f9('0x1d')]){case'twilio':var _0x1c4e8c=require(_0x84f9('0x1e'));if(_0xbcde4['accountSid']&&_0xbcde4[_0x84f9('0x1f')]&&_0xbcde4['phone']){var _0x57de34=new _0x1c4e8c(_0xbcde4[_0x84f9('0x20')],_0xbcde4[_0x84f9('0x1f')]);_0x57de34[_0x84f9('0x21')]['create']({'body':_0x1ad4a2[_0x84f9('0xd')],'to':_0x1ad4a2['phone'],'from':_0xbcde4[_0x84f9('0x22')],'statusCallback':_0xbcde4['remote']+_0x84f9('0x23')+_0x1ad4a2['id']+'/status?token='+_0xbcde4[_0x84f9('0x24')]})[_0x84f9('0x16')](function(_0x134a2e){if(_0x134a2e['sid']){return _0x19ba13['update']({'messageId':_0x134a2e[_0x84f9('0x25')]});}})[_0x84f9('0x19')](function(_0x1bc7a9){logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x1e'),util[_0x84f9('0x29')](_0x1bc7a9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x1e'),_0x84f9('0x2a'));}break;case _0x84f9('0x2b'):var _0x208495=_0x84f9('0x2c');if(_0xbcde4[_0x84f9('0x2d')]&&_0xbcde4[_0x84f9('0x2e')]){var _0x1b8dd6={'recipient':[_0x1ad4a2[_0x84f9('0x22')]],'message':_0x1ad4a2['body'],'message_type':_0xbcde4[_0x84f9('0x2f')]};if(_0xbcde4[_0x84f9('0x2f')]&&_0xbcde4[_0x84f9('0x2f')]!=='SI'){_0x1b8dd6[_0x84f9('0x30')]=_0xbcde4['phone'];}var _0x3e30f8={'url':_0x208495+'login?username='+_0xbcde4['username']+_0x84f9('0x31')+_0xbcde4[_0x84f9('0x2e')],'method':'GET'};rp(_0x3e30f8)[_0x84f9('0x16')](function(_0x3faae0){var _0x45b531=_0x3faae0['split'](';');var _0x11003f={'user_key':_0x45b531[0x0],'session_key':_0x45b531[0x1]};_0x3e30f8={'url':_0x208495+_0x84f9('0x32'),'method':_0x84f9('0x33'),'headers':{'user_key':_0x11003f['user_key'],'Session_key':_0x11003f[_0x84f9('0x34')]},'json':!![],'body':_0x1b8dd6};return rp(_0x3e30f8);})[_0x84f9('0x16')](function(_0x4c873b){if(_0x4c873b[_0x84f9('0x35')]>=0x1){var _0x34c697={'messageId':_0x4c873b[_0x84f9('0x36')]};if(_0xbcde4[_0x84f9('0x2f')]!=='GP'||!_0xbcde4[_0x84f9('0x37')]){_0x34c697[_0x84f9('0x38')]=!![];}return _0x19ba13[_0x84f9('0x17')](_0x34c697);}else{return logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),'skebby',util[_0x84f9('0x29')](_0x4c873b,{'showHidden':![],'depth':null}));}})[_0x84f9('0x19')](function(_0x27f4f9){return logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x2b'),util[_0x84f9('0x29')](_0x27f4f9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x2b'),_0x84f9('0x39'));}break;case'connectel':if(_0xbcde4['authToken']){var _0x55798d={'recipient':_0x1ad4a2[_0x84f9('0x22')],'message':_0x1ad4a2[_0x84f9('0xd')],'sender':_0xbcde4['senderString']||_0xbcde4[_0x84f9('0x22')],'authorization':_0xbcde4[_0x84f9('0x1f')]};var _0x50ce54={'method':_0x84f9('0x33'),'uri':_0x84f9('0x3a'),'body':_0x55798d,'json':!![]};rp(_0x50ce54)[_0x84f9('0x16')](function(_0x25f6a0){var _0x597f8f={'messageId':_0x25f6a0[_0x84f9('0x3b')]};if(!_0xbcde4[_0x84f9('0x37')]){_0x597f8f['read']=!![];}return _0x19ba13[_0x84f9('0x17')](_0x597f8f);})['catch'](function(_0x3f6613){logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x84f9('0x3c'),util[_0x84f9('0x29')](_0x3f6613,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x3c'),_0x84f9('0x3d'));}break;case _0x84f9('0x3e'):if(_0xbcde4[_0x84f9('0x2d')]&&_0xbcde4[_0x84f9('0x2e')]){var _0x55798d={'messages':[{'source':'xCALLY\x20Motion','to':_0x1ad4a2[_0x84f9('0x22')],'body':_0x1ad4a2['body'],'from':_0xbcde4[_0x84f9('0x3f')]||_0xbcde4[_0x84f9('0x22')]}]};var _0x15cc37=util[_0x84f9('0x40')](_0x84f9('0x41'),_0xbcde4[_0x84f9('0x2d')],_0xbcde4[_0x84f9('0x2e')]);var _0x50ce54={'method':_0x84f9('0x33'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x55798d,'headers':{'Authorization':util['format'](_0x84f9('0x42'),new Buffer(_0x15cc37)[_0x84f9('0x43')](_0x84f9('0x44')))},'json':!![]};rp(_0x50ce54)['then'](function(_0x46aac2){if(_0x46aac2[_0x84f9('0x45')]>=0xc8&&_0x46aac2[_0x84f9('0x45')]<=0xce){if(_0x46aac2[_0x84f9('0x46')]&&_0x46aac2['data']['queued_count']>0x0){var _0x3d523c=_[_0x84f9('0x47')](_0x46aac2['data'][_0x84f9('0x21')]);var _0x369892={'messageId':_0x3d523c[_0x84f9('0x48')]};if(!_0xbcde4[_0x84f9('0x37')]){_0x369892[_0x84f9('0x38')]=!![];}return _0x19ba13['update'](_0x369892);}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x49'),util[_0x84f9('0x29')](_0x46aac2,{'showHidden':![],'depth':null}));}}else{logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x49'),util[_0x84f9('0x29')](_0x46aac2,{'showHidden':![],'depth':null}));}})[_0x84f9('0x19')](function(_0x1f1b7d){logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x49'),util[_0x84f9('0x29')](_0x1f1b7d,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x49'),_0x84f9('0x39'));}break;case _0x84f9('0x4a'):if(_0xbcde4[_0x84f9('0x4b')]&&_0xbcde4[_0x84f9('0x1f')]){var _0x55798d={'dst':_0x1ad4a2[_0x84f9('0x22')],'text':_0x1ad4a2[_0x84f9('0xd')],'src':_0xbcde4[_0x84f9('0x3f')]||_0xbcde4['phone'],'url':_0xbcde4[_0x84f9('0x4c')]+'/api/sms/messages/'+_0x1ad4a2['id']+_0x84f9('0x4d')+_0xbcde4[_0x84f9('0x24')]};var _0x15cc37=util[_0x84f9('0x40')]('%s:%s',_0xbcde4['authId'],_0xbcde4['authToken']);var _0x50ce54={'method':'POST','uri':util[_0x84f9('0x40')](_0x84f9('0x4e'),_0xbcde4[_0x84f9('0x4b')]),'body':_0x55798d,'headers':{'Authorization':util[_0x84f9('0x40')](_0x84f9('0x42'),new Buffer(_0x15cc37)[_0x84f9('0x43')](_0x84f9('0x44')))},'json':!![]};rp(_0x50ce54)[_0x84f9('0x16')](function(_0x5eff26){var _0x233d38={'messageId':_0x5eff26[_0x84f9('0x4f')][0x0]};return _0x19ba13[_0x84f9('0x17')](_0x233d38);})[_0x84f9('0x19')](function(_0x12f30e){logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x84f9('0x4a'),util[_0x84f9('0x29')](_0x12f30e,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x4a'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x84f9('0x50'):if(_0xbcde4[_0x84f9('0x2d')]&&_0xbcde4[_0x84f9('0x2e')]){if(_0xbcde4['baseUrl']){var _0x55755a={'method':_0x84f9('0x33'),'uri':_0xbcde4[_0x84f9('0x51')]+_0x84f9('0x52'),'body':{'username':_0xbcde4[_0x84f9('0x2d')],'password':_0xbcde4[_0x84f9('0x2e')]},'json':!![]};return rp(_0x55755a)['then'](function(_0x3d61df){var _0x1ef3d1={'method':_0x84f9('0x33'),'uri':_0xbcde4['baseUrl']+_0x84f9('0x53'),'body':{'messages':[{'from':_0xbcde4[_0x84f9('0x22')],'destinations':[{'to':_0x1ad4a2[_0x84f9('0x22')]}],'text':_0x1ad4a2[_0x84f9('0xd')],'notifyUrl':_0xbcde4['remote']+_0x84f9('0x23')+_0x1ad4a2['id']+'/status?token='+_0xbcde4[_0x84f9('0x24')],'notifyContentType':_0x84f9('0x54'),'callbackData':_0xbcde4[_0x84f9('0x22')]+';'+_0x1ad4a2[_0x84f9('0xd')]}]},'headers':{'Authorization':_0x84f9('0x55')+_0x3d61df[_0x84f9('0x24')]},'json':!![]};return rp(_0x1ef3d1)[_0x84f9('0x16')](function(_0x380da0){if(_0x380da0['messages']){var _0x1942d8={'messageId':_0x380da0[_0x84f9('0x21')][0x0]['messageId']};if(!_0xbcde4[_0x84f9('0x37')]){_0x1942d8[_0x84f9('0x38')]=!![];}return _0x19ba13[_0x84f9('0x17')](_0x1942d8);}else{return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x50'),util[_0x84f9('0x29')](_0x380da0,{'showHidden':![],'depth':null}));}});})[_0x84f9('0x19')](function(_0x27b57a){return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x50'),util[_0x84f9('0x29')](_0x27b57a,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x50'),_0x84f9('0x56'));}}else{logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x50'),_0x84f9('0x39'));}break;case _0x84f9('0x57'):var _0x563d16=require(_0x84f9('0x58'));if(_0xbcde4[_0x84f9('0x59')]){var _0x4df613={};_0x4df613[_0x84f9('0x5a')]=_0xbcde4['username'];_0x4df613['phone']=_0x1ad4a2[_0x84f9('0x22')];_0x4df613[_0x84f9('0x30')]=_0xbcde4[_0x84f9('0x22')];_0x4df613[_0x84f9('0x5b')]=_0x1ad4a2['body'];_0x4df613['timestamp']=+new Date();var _0x386882='';var _0x3248b4='';var _0x333d20=Object['keys'](_0x4df613);_0x333d20[_0x84f9('0x5c')]();for(var _0x59e0ce=0x0;_0x59e0ce<_0x333d20['length'];_0x59e0ce++){if(_0x386882!=''){_0x386882+='&';}_0x386882+=_0x333d20[_0x59e0ce]+'='+encodeURIComponent(_0x4df613[_0x333d20[_0x59e0ce]]);_0x3248b4+=_0x4df613[_0x333d20[_0x59e0ce]];}_0x3248b4+=_0xbcde4[_0x84f9('0x59')];_0x3248b4=_0x563d16[_0x84f9('0x5d')]('md5')[_0x84f9('0x17')](_0x3248b4)[_0x84f9('0x5e')]('hex');if(_0x386882!==''){_0x386882+='&';}_0x386882+=_0x84f9('0x5f')+_0x3248b4;var _0x3e30f8={'method':_0x84f9('0x60'),'uri':_0xbcde4[_0x84f9('0x51')]+_0x84f9('0x61')+_0x386882,'json':!![]};return rp(_0x3e30f8)[_0x84f9('0x16')](function(_0x42f55e){var _0x17ee51=Object[_0x84f9('0x62')](_0x42f55e);if(_0x42f55e[_0x17ee51[0x0]]['error']&&parseInt(_0x42f55e[_0x17ee51[0x0]][_0x84f9('0x26')])===0x0){var _0x23aeb7={'messageId':_0x42f55e[_0x17ee51[0x0]]['id_sms']};if(!_0xbcde4['deliveryReport']){_0x23aeb7['read']=!![];}return _0x19ba13[_0x84f9('0x17')](_0x23aeb7);}else{return logger[_0x84f9('0x26')](_0x84f9('0x27'),'afterCreate',_0x84f9('0x57'),util['inspect'](_0x42f55e[_0x84f9('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4deee3){return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x57'),util[_0x84f9('0x29')](_0x4deee3,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x57'),_0x84f9('0x63'));}break;case _0x84f9('0x64'):if(_0xbcde4[_0x84f9('0x59')]){var _0x24ab29={'method':'POST','uri':_0x84f9('0x65'),'headers':{'Authorization':_0xbcde4[_0x84f9('0x59')]},'body':{'content':_0x1ad4a2[_0x84f9('0xd')],'to':[_0x1ad4a2[_0x84f9('0x22')]],'from':_0xbcde4[_0x84f9('0x22')],'binary':![],'clientMessageId':_0x84f9('0x66'),'charset':_0x84f9('0x67')},'json':!![]};rp(_0x24ab29)[_0x84f9('0x16')](function(_0x414eff){if(!_0x414eff[_0x84f9('0x26')]){var _0x131ed1={'messageId':_0x414eff[_0x84f9('0x21')][0x0][_0x84f9('0x68')]};if(!_0xbcde4['deliveryReport']){_0x131ed1[_0x84f9('0x38')]=!![];}return _0x19ba13[_0x84f9('0x17')](_0x131ed1);}else{return logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x64'),util[_0x84f9('0x29')](_0x414eff[_0x84f9('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x39ac23){return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x64'),util[_0x84f9('0x29')](_0x39ac23,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),'clickatell',_0x84f9('0x63'));}break;case _0x84f9('0x69'):if(_0xbcde4['apiKey']){var _0x6a567={};var _0x3e30f8={'method':'POST','uri':_0x84f9('0x6a'),'headers':{'Authorization':_0x84f9('0x6b')+_0xbcde4[_0x84f9('0x59')],'Content-Type':_0x84f9('0x54')},'body':{'from':_0xbcde4[_0x84f9('0x22')],'to':_0x1ad4a2[_0x84f9('0x22')],'text':_0x1ad4a2[_0x84f9('0xd')]},'json':!![]};return rp(_0x3e30f8)[_0x84f9('0x16')](function(_0x102c06){if(_0x102c06[_0x84f9('0x6c')]==0xca){_0x6a567[_0x84f9('0x6d')]=_0x102c06;var _0x3165da={'method':_0x84f9('0x33'),'uri':_0x84f9('0x6e'),'headers':{'Authorization':_0x84f9('0x6b')+_0xbcde4[_0x84f9('0x59')],'Content-Type':_0x84f9('0x54')},'body':{'refid':_0x6a567['message']['refid']},'json':!![]};return rp(_0x3165da)[_0x84f9('0x16')](function(_0x3386cc){_0x6a567[_0x84f9('0x6f')]=_0x3386cc;var _0x11d68c={'messageId':_0x6a567['message'][_0x84f9('0x70')],'read':!![]};return _0x19ba13[_0x84f9('0x17')](_0x11d68c);});}else{return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x69'),util[_0x84f9('0x29')](_0x102c06,{'showHidden':![],'depth':null}));}})[_0x84f9('0x19')](function(_0x3c3aca){return logger[_0x84f9('0x26')](_0x84f9('0x27'),'afterCreate',_0x84f9('0x69'),util[_0x84f9('0x29')](_0x3c3aca,{'showHidden':![],'depth':null}));});}else{return logger[_0x84f9('0x26')](_0x84f9('0x27'),'afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0x84f9('0x71')](function(){_0x1ca981();});}else{_0x1ca981();}}},'charset':_0x84f9('0x72'),'collate':_0x84f9('0x73')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d9a82c7..2c3b78d 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 _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateSmsMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x252e0e,_0x12108e){var _0x158349=function(_0x456117){while(--_0x456117){_0x252e0e['push'](_0x252e0e['shift']());}};_0x158349(++_0x12108e);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x5eb8[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./smsMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateSmsMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['SmsMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateSmsMessage',_0x24cf28);logger['debug']('CreateSmsMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});}; \ No newline at end of file +var _0x4fc2=['message','info','result','catch','CreateSmsMessage','SmsMessage','body','options','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x4fc2,0x111));var _0x24fc=function(_0x42f036,_0x5e6443){_0x42f036=_0x42f036-0x0;var _0xcda4b=_0x4fc2[_0x42f036];return _0xcda4b;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});config['redis']=_[_0x24fc('0xb')](config[_0x24fc('0xc')],{'host':_0x24fc('0xd'),'port':0x18eb});var socket=require(_0x24fc('0xe'))(new Redis(config[_0x24fc('0xc')]));require(_0x24fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x44caca,_0x1819a5,_0x1a4462){return new BPromise(function(_0x133438,_0x24998d){return client[_0x24fc('0x10')](_0x44caca,_0x1a4462)[_0x24fc('0x11')](function(_0x9a1673){logger['info'](_0x24fc('0x12'),_0x1819a5,_0x24fc('0x13'));logger['debug'](_0x24fc('0x14'),_0x1819a5,_0x24fc('0x13'),JSON[_0x24fc('0x15')](_0x9a1673));if(_0x9a1673[_0x24fc('0x16')]){if(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x17')]===0x1f4){logger['error'](_0x24fc('0x12'),_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x24998d(_0x9a1673[_0x24fc('0x16')]['message']);}logger[_0x24fc('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x133438(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);}else{logger[_0x24fc('0x19')]('SmsMessage,\x20%s,\x20%s',_0x1819a5,_0x24fc('0x13'));_0x133438(_0x9a1673[_0x24fc('0x1a')][_0x24fc('0x18')]);}})[_0x24fc('0x1b')](function(_0x4c5a43){logger[_0x24fc('0x16')](_0x24fc('0x12'),_0x1819a5,_0x4c5a43);_0x24998d(_0x4c5a43);});});}exports[_0x24fc('0x1c')]=function(_0x5b0516){var _0x32a57d=this;return new Promise(function(_0x36a771,_0xbf1d6b){return db[_0x24fc('0x1d')]['create'](_0x5b0516[_0x24fc('0x1e')],{'raw':_0x5b0516['options']?_0x5b0516[_0x24fc('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x24fc('0x11')](function(_0x44c121){logger[_0x24fc('0x19')]('CreateSmsMessage',_0x5b0516);logger[_0x24fc('0x20')]('CreateSmsMessage',_0x5b0516,JSON[_0x24fc('0x15')](_0x44c121));_0x36a771(_0x44c121);})[_0x24fc('0x1b')](function(_0x36a9b4){logger[_0x24fc('0x16')](_0x24fc('0x1c'),_0x36a9b4[_0x24fc('0x18')],_0x5b0516);_0xbf1d6b(_0x32a57d[_0x24fc('0x16')](0x1f4,_0x36a9b4[_0x24fc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 5377a52..806ea9b 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 _0xc2b9=['smsMessage:','./smsMessage.events','save','remove','update','removeListener','register','length'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc2b9,0x101));var _0x9c2b=function(_0x5a7180,_0x1af60c){_0x5a7180=_0x5a7180-0x0;var _0x49a441=_0xc2b9[_0x5a7180];return _0x49a441;};'use strict';var SmsMessageEvents=require(_0x9c2b('0x0'));var events=[_0x9c2b('0x1'),_0x9c2b('0x2'),_0x9c2b('0x3')];function createListener(_0x5a0406,_0x3a3f36){return function(_0x50f6aa){_0x3a3f36['emit'](_0x5a0406,_0x50f6aa);};}function removeListener(_0x557b1e,_0x443733){return function(){SmsMessageEvents[_0x9c2b('0x4')](_0x557b1e,_0x443733);};}exports[_0x9c2b('0x5')]=function(_0x4f7d91){for(var _0x585aeb=0x0,_0x4e1753=events[_0x9c2b('0x6')];_0x585aeb<_0x4e1753;_0x585aeb++){var _0x35cc22=events[_0x585aeb];var _0x3e9c91=createListener(_0x9c2b('0x7')+_0x35cc22,_0x4f7d91);SmsMessageEvents['on'](_0x35cc22,_0x3e9c91);}}; \ No newline at end of file +var _0xad63=['emit','removeListener','save'];(function(_0x1a5946,_0x426991){var _0x25e9d5=function(_0x44e1ce){while(--_0x44e1ce){_0x1a5946['push'](_0x1a5946['shift']());}};_0x25e9d5(++_0x426991);}(_0xad63,0x158));var _0x3ad6=function(_0x4e3f02,_0x598f48){_0x4e3f02=_0x4e3f02-0x0;var _0x500f69=_0xad63[_0x4e3f02];return _0x500f69;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x3ad6('0x0'),'remove','update'];function createListener(_0x3b52f3,_0x7f1d5b){return function(_0x217835){_0x7f1d5b[_0x3ad6('0x1')](_0x3b52f3,_0x217835);};}function removeListener(_0x3dd1a0,_0x16c31f){return function(){SmsMessageEvents[_0x3ad6('0x2')](_0x3dd1a0,_0x16c31f);};}exports['register']=function(_0x1f7979){for(var _0x272e90=0x0,_0x563cb9=events['length'];_0x272e90<_0x563cb9;_0x272e90++){var _0x5eea7a=events[_0x272e90];var _0x2da484=createListener('smsMessage:'+_0x5eea7a,_0x1f7979);SmsMessageEvents['on'](_0x5eea7a,_0x2da484);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7acd790..8bb91a5 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 _0x9536=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer'];(function(_0x12dfeb,_0x3fe94f){var _0x3f2fb8=function(_0x2770e5){while(--_0x2770e5){_0x12dfeb['push'](_0x12dfeb['shift']());}};_0x3f2fb8(++_0x3fe94f);}(_0x9536,0x179));var _0x6953=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x9536[_0x413727];return _0x5f46d7;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6953('0x5'));var config=require(_0x6953('0x6'));var controller=require(_0x6953('0x7'));router[_0x6953('0x8')]('/',auth[_0x6953('0x9')](),controller['index']);router[_0x6953('0x8')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0xb')]);router[_0x6953('0x8')]('/:id',auth[_0x6953('0x9')](),controller[_0x6953('0xc')]);router[_0x6953('0x8')]('/:id/members',auth[_0x6953('0x9')](),controller[_0x6953('0xd')]);router[_0x6953('0x8')](_0x6953('0xe'),auth[_0x6953('0x9')](),controller[_0x6953('0xf')]);router[_0x6953('0x8')](_0x6953('0x10'),auth[_0x6953('0x9')](),controller['getAgents']);router[_0x6953('0x11')]('/',auth['isAuthenticated'](),controller[_0x6953('0x12')]);router[_0x6953('0x11')](_0x6953('0xe'),auth[_0x6953('0x9')](),controller[_0x6953('0x13')]);router[_0x6953('0x11')](_0x6953('0x10'),auth[_0x6953('0x9')](),controller[_0x6953('0x14')]);router[_0x6953('0x15')](_0x6953('0x16'),auth['isAuthenticated'](),controller['update']);router[_0x6953('0x17')](_0x6953('0x16'),auth[_0x6953('0x9')](),controller[_0x6953('0x18')]);router['delete'](_0x6953('0xe'),auth[_0x6953('0x9')](),controller['removeTeams']);router[_0x6953('0x17')](_0x6953('0x10'),auth[_0x6953('0x9')](),controller[_0x6953('0x19')]);module[_0x6953('0x1a')]=router; \ No newline at end of file +var _0x9fd4=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x53576e,_0x1e9802){var _0x4c14c7=function(_0x2bdce8){while(--_0x2bdce8){_0x53576e['push'](_0x53576e['shift']());}};_0x4c14c7(++_0x1e9802);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x9fd4[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var auth=require(_0x49fd('0x6'));var interaction=require(_0x49fd('0x7'));var config=require(_0x49fd('0x8'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x49fd('0x9')](),controller[_0x49fd('0xa')]);router[_0x49fd('0xb')](_0x49fd('0xc'),auth['isAuthenticated'](),controller[_0x49fd('0xd')]);router[_0x49fd('0xb')](_0x49fd('0xe'),auth[_0x49fd('0x9')](),controller[_0x49fd('0xf')]);router['get'](_0x49fd('0x10'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x11')]);router[_0x49fd('0xb')](_0x49fd('0x12'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x13')]);router['get'](_0x49fd('0x14'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x15')]);router[_0x49fd('0x16')]('/',auth[_0x49fd('0x9')](),controller[_0x49fd('0x17')]);router[_0x49fd('0x16')](_0x49fd('0x12'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x18')]);router[_0x49fd('0x16')](_0x49fd('0x14'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x19')]);router[_0x49fd('0x1a')](_0x49fd('0xe'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x1b')]);router[_0x49fd('0x1c')](_0x49fd('0xe'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x1d')]);router[_0x49fd('0x1c')](_0x49fd('0x12'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x1e')]);router['delete'](_0x49fd('0x14'),auth[_0x49fd('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7f5c68b..c0a751b 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 _0x035f=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x19c39c,_0x3e2dc2){var _0x24c24c=function(_0x171b8c){while(--_0x171b8c){_0x19c39c['push'](_0x19c39c['shift']());}};_0x24c24c(++_0x3e2dc2);}(_0x035f,0x66));var _0xf035=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0x035f[_0x8cb2f9];return _0x164887;};'use strict';var Sequelize=require(_0xf035('0x0'));module['exports']={'name':{'type':Sequelize[_0xf035('0x1')],'unique':_0xf035('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf035('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf035('0x3')](_0xf035('0x4'),_0xf035('0x5'),_0xf035('0x6'))}}; \ No newline at end of file +var _0xb2fc=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x522e98,_0x44cc17){var _0x3243aa=function(_0x5cb86c){while(--_0x5cb86c){_0x522e98['push'](_0x522e98['shift']());}};_0x3243aa(++_0x44cc17);}(_0xb2fc,0x1e1));var _0xcb2f=function(_0x1a5c15,_0x10cbc6){_0x1a5c15=_0x1a5c15-0x0;var _0x446dae=_0xb2fc[_0x1a5c15];return _0x446dae;};'use strict';var Sequelize=require(_0xcb2f('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb2f('0x1')],'unique':_0xcb2f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcb2f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcb2f('0x4'),_0xcb2f('0x5'),_0xcb2f('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5ea7f66..4de72e1 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 _0x700f=['save','update','destroy','then','get','SmsQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','catch','show','params','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','order','SmsQueueId','UserSmsQueue','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','offset','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userSmsQueue:save','getAgents','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','status','count','limit','set','Content-Range','reject'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x700f,0x17e));var _0xf700=function(_0xe75e84,_0x3dce66){_0xe75e84=_0xe75e84-0x0;var _0x101995=_0x700f[_0xe75e84];return _0x101995;};'use strict';var pdf=require(_0xf700('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf700('0x1'));var zipdir=require(_0xf700('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf700('0x3'));var moment=require('moment');var BPromise=require(_0xf700('0x4'));var Mustache=require('mustache');var util=require(_0xf700('0x5'));var path=require(_0xf700('0x6'));var sox=require(_0xf700('0x7'));var csv=require('to-csv');var ejs=require(_0xf700('0x8'));var fs=require('fs');var _=require(_0xf700('0x9'));var squel=require(_0xf700('0xa'));var crypto=require(_0xf700('0xb'));var jsforce=require(_0xf700('0xc'));var deskjs=require(_0xf700('0xd'));var toCsv=require(_0xf700('0xe'));var querystring=require(_0xf700('0xf'));var Papa=require(_0xf700('0x10'));var Redis=require(_0xf700('0x11'));var authService=require(_0xf700('0x12'));var qs=require(_0xf700('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf700('0x14'));var logger=require(_0xf700('0x15'))('api');var utils=require(_0xf700('0x16'));var config=require(_0xf700('0x17'));var db=require(_0xf700('0x18'))['db'];config[_0xf700('0x19')]=_[_0xf700('0x1a')](config[_0xf700('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf700('0x1b'))(new Redis(config[_0xf700('0x19')]));require(_0xf700('0x1c'))['register'](socket);function respondWithStatusCode(_0x54bd5b,_0x1cfb1f){_0x1cfb1f=_0x1cfb1f||0xcc;return function(_0x1dc7bc){if(_0x1dc7bc){return _0x54bd5b['sendStatus'](_0x1cfb1f);}return _0x54bd5b[_0xf700('0x1d')](_0x1cfb1f)['end']();};}function respondWithResult(_0x42fab6,_0x63ffd9){_0x63ffd9=_0x63ffd9||0xc8;return function(_0x62add3){if(_0x62add3){return _0x42fab6[_0xf700('0x1d')](_0x63ffd9)['json'](_0x62add3);}};}function respondWithFilteredResult(_0x411bf6,_0x4d9585){return function(_0xd1abb7){if(_0xd1abb7){var _0x10b8ea=_0xd1abb7[_0xf700('0x1e')],_0x35bba4=_0x4d9585['offset'],_0x46f1c1=_0x4d9585['offset']+_0x4d9585[_0xf700('0x1f')],_0x225666;if(_0x46f1c1>=_0x10b8ea){_0x46f1c1=_0x10b8ea;_0x225666=0xc8;}else{_0x225666=0xce;}_0x411bf6[_0xf700('0x1d')](_0x225666);return _0x411bf6[_0xf700('0x20')](_0xf700('0x21'),_0x35bba4+'-'+_0x46f1c1+'/'+_0x10b8ea)['json'](_0xd1abb7);}return null;};}function patchUpdates(_0xc94157){return function(_0x5edbac){try{jsonpatch['apply'](_0x5edbac,_0xc94157,!![]);}catch(_0x33bc00){return BPromise[_0xf700('0x22')](_0x33bc00);}return _0x5edbac[_0xf700('0x23')]();};}function saveUpdates(_0x3dfb65,_0x27b96c){return function(_0x167aab){if(_0x167aab){return _0x167aab[_0xf700('0x24')](_0x3dfb65)['then'](function(_0x4744d4){return _0x4744d4;});}return null;};}function removeEntity(_0x172666,_0xdd6c6e){return function(_0x3d10a2){if(_0x3d10a2){return _0x3d10a2[_0xf700('0x25')]()[_0xf700('0x26')](function(){var _0x4670e7=_0x3d10a2[_0xf700('0x27')]({'plain':!![]});var _0x44b4fb=_0xf700('0x28');return db[_0xf700('0x29')][_0xf700('0x25')]({'where':{'type':_0x44b4fb,'resourceId':_0x4670e7['id']}})[_0xf700('0x26')](function(){return _0x3d10a2;});})[_0xf700('0x26')](function(){_0x172666['status'](0xcc)[_0xf700('0x2a')]();});}};}function handleEntityNotFound(_0x1f17a7,_0x277a47){return function(_0x215ef5){if(!_0x215ef5){_0x1f17a7[_0xf700('0x2b')](0x194);}return _0x215ef5;};}function handleError(_0x46b1e3,_0x4704f0){_0x4704f0=_0x4704f0||0x1f4;return function(_0x4d522b){logger[_0xf700('0x2c')](_0x4d522b[_0xf700('0x2d')]);if(_0x4d522b[_0xf700('0x2e')]){delete _0x4d522b['name'];}_0x46b1e3[_0xf700('0x1d')](_0x4704f0)[_0xf700('0x2f')](_0x4d522b);};}exports[_0xf700('0x30')]=function(_0x58c295,_0x5a1e4b){var _0x8ec7da={},_0x47e980={},_0x73973e={'count':0x0,'rows':[]};var _0xa23b20=_[_0xf700('0x31')](db[_0xf700('0x32')][_0xf700('0x33')],function(_0x3740f5){return{'name':_0x3740f5[_0xf700('0x34')],'type':_0x3740f5['type'][_0xf700('0x35')]};});_0x47e980[_0xf700('0x36')]=_[_0xf700('0x31')](_0xa23b20,_0xf700('0x2e'));_0x47e980['query']=_[_0xf700('0x37')](_0x58c295[_0xf700('0x38')]);_0x47e980[_0xf700('0x39')]=_[_0xf700('0x3a')](_0x47e980[_0xf700('0x36')],_0x47e980[_0xf700('0x38')]);_0x8ec7da['attributes']=_[_0xf700('0x3a')](_0x47e980[_0xf700('0x36')],qs['fields'](_0x58c295['query'][_0xf700('0x3b')]));_0x8ec7da['attributes']=_0x8ec7da[_0xf700('0x3c')]['length']?_0x8ec7da[_0xf700('0x3c')]:_0x47e980[_0xf700('0x36')];if(!_0x58c295[_0xf700('0x38')][_0xf700('0x3d')](_0xf700('0x3e'))){_0x8ec7da[_0xf700('0x1f')]=qs['limit'](_0x58c295[_0xf700('0x38')][_0xf700('0x1f')]);_0x8ec7da['offset']=qs['offset'](_0x58c295[_0xf700('0x38')]['offset']);}_0x8ec7da['order']=qs[_0xf700('0x3f')](_0x58c295[_0xf700('0x38')][_0xf700('0x3f')]);_0x8ec7da[_0xf700('0x40')]=qs[_0xf700('0x39')](_[_0xf700('0x41')](_0x58c295[_0xf700('0x38')],_0x47e980['filters']),_0xa23b20);if(_0x58c295[_0xf700('0x38')][_0xf700('0x42')]){_0x8ec7da[_0xf700('0x40')]=_[_0xf700('0x43')](_0x8ec7da['where'],{'$or':_[_0xf700('0x31')](_0xa23b20,function(_0x41bcf5){if(_0x41bcf5[_0xf700('0x44')]!=='VIRTUAL'){var _0x423936={};_0x423936[_0x41bcf5[_0xf700('0x2e')]]={'$like':'%'+_0x58c295[_0xf700('0x38')]['filter']+'%'};return _0x423936;}})});}_0x8ec7da=_[_0xf700('0x43')]({},_0x8ec7da,_0x58c295['options']);var _0x5788b8={'where':_0x8ec7da['where']};return db['SmsQueue'][_0xf700('0x1e')](_0x5788b8)[_0xf700('0x26')](function(_0x30fadd){_0x73973e[_0xf700('0x1e')]=_0x30fadd;if(_0x58c295[_0xf700('0x38')][_0xf700('0x45')]){_0x8ec7da['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x8ec7da);})[_0xf700('0x26')](function(_0xc5ce85){_0x73973e['rows']=_0xc5ce85;return _0x73973e;})['then'](respondWithFilteredResult(_0x5a1e4b,_0x8ec7da))[_0xf700('0x46')](handleError(_0x5a1e4b,null));};exports[_0xf700('0x47')]=function(_0x3ea3a3,_0x4ae7b8){var _0xa60cb1={'raw':!![],'where':{'id':_0x3ea3a3[_0xf700('0x48')]['id']}},_0x5d6020={};_0x5d6020[_0xf700('0x36')]=_[_0xf700('0x37')](db[_0xf700('0x32')][_0xf700('0x33')]);_0x5d6020[_0xf700('0x38')]=_['keys'](_0x3ea3a3[_0xf700('0x38')]);_0x5d6020['filters']=_[_0xf700('0x3a')](_0x5d6020[_0xf700('0x36')],_0x5d6020[_0xf700('0x38')]);_0xa60cb1[_0xf700('0x3c')]=_[_0xf700('0x3a')](_0x5d6020[_0xf700('0x36')],qs[_0xf700('0x3b')](_0x3ea3a3[_0xf700('0x38')][_0xf700('0x3b')]));_0xa60cb1['attributes']=_0xa60cb1[_0xf700('0x3c')][_0xf700('0x49')]?_0xa60cb1['attributes']:_0x5d6020[_0xf700('0x36')];if(_0x3ea3a3[_0xf700('0x38')][_0xf700('0x45')]){_0xa60cb1[_0xf700('0x4a')]=[{'all':!![]}];}_0xa60cb1=_[_0xf700('0x43')]({},_0xa60cb1,_0x3ea3a3[_0xf700('0x4b')]);return db[_0xf700('0x32')][_0xf700('0x4c')](_0xa60cb1)['then'](handleEntityNotFound(_0x4ae7b8,null))[_0xf700('0x26')](respondWithResult(_0x4ae7b8,null))[_0xf700('0x46')](handleError(_0x4ae7b8,null));};exports[_0xf700('0x4d')]=function(_0x216fe7,_0x15744c){return db['SmsQueue']['create'](_0x216fe7[_0xf700('0x4e')],{})['then'](function(_0x5d9181){var _0x49940a=_0x216fe7[_0xf700('0x4f')]['get']({'plain':!![]});if(!_0x49940a)throw new Error(_0xf700('0x50'));if(_0x49940a[_0xf700('0x51')]===_0xf700('0x4f')){var _0x4bb4b6=_0x5d9181[_0xf700('0x27')]({'plain':!![]});var _0x4eac2b=_0xf700('0x28');return db['UserProfileSection'][_0xf700('0x4c')]({'where':{'name':_0x4eac2b,'userProfileId':_0x49940a[_0xf700('0x52')]},'raw':!![]})[_0xf700('0x26')](function(_0x5851c1){if(_0x5851c1&&_0x5851c1[_0xf700('0x53')]===0x0){return db[_0xf700('0x29')][_0xf700('0x4d')]({'name':_0x4bb4b6[_0xf700('0x2e')],'resourceId':_0x4bb4b6['id'],'type':_0x5851c1[_0xf700('0x2e')],'sectionId':_0x5851c1['id']},{})[_0xf700('0x26')](function(){return _0x5d9181;});}else{return _0x5d9181;}})[_0xf700('0x46')](function(_0x31d0a0){logger[_0xf700('0x2c')](_0xf700('0x54'),_0x31d0a0);throw _0x31d0a0;});}return _0x5d9181;})[_0xf700('0x26')](respondWithResult(_0x15744c,0xc9))[_0xf700('0x46')](handleError(_0x15744c,null));};exports[_0xf700('0x24')]=function(_0x237744,_0x48e908){if(_0x237744[_0xf700('0x4e')]['id']){delete _0x237744[_0xf700('0x4e')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x237744[_0xf700('0x48')]['id']}})['then'](handleEntityNotFound(_0x48e908,null))[_0xf700('0x26')](saveUpdates(_0x237744[_0xf700('0x4e')],null))[_0xf700('0x26')](respondWithResult(_0x48e908,null))[_0xf700('0x46')](handleError(_0x48e908,null));};exports[_0xf700('0x25')]=function(_0x12a2fd,_0xd39b33){return db[_0xf700('0x32')][_0xf700('0x4c')]({'where':{'id':_0x12a2fd[_0xf700('0x48')]['id']}})[_0xf700('0x26')](handleEntityNotFound(_0xd39b33,null))['then'](removeEntity(_0xd39b33,null))['catch'](handleError(_0xd39b33,null));};exports['describe']=function(_0x6aed23,_0x4ba651){return db['SmsQueue']['describe']()[_0xf700('0x26')](respondWithResult(_0x4ba651,null))['catch'](handleError(_0x4ba651,null));};exports[_0xf700('0x55')]=function(_0x4afaac,_0x45a6aa,_0x3c224f){var _0x2a2c8b={'raw':!![],'where':{}},_0xa68670={},_0x488ef3;return db[_0xf700('0x32')][_0xf700('0x56')]({'where':{'id':_0x4afaac['params']['id']}})[_0xf700('0x26')](handleEntityNotFound(_0x45a6aa,null))['then'](function(_0xb31cc3){if(_0xb31cc3){_0x488ef3=_0xb31cc3[_0xf700('0x27')]({'plain':!![]});_0xa68670[_0xf700('0x36')]=_[_0xf700('0x37')](db['UserSmsQueue'][_0xf700('0x33')]);_0xa68670[_0xf700('0x38')]=_[_0xf700('0x37')](_0x4afaac[_0xf700('0x38')]);_0xa68670[_0xf700('0x39')]=_[_0xf700('0x3a')](_0xa68670[_0xf700('0x36')],_0xa68670['query']);_0x2a2c8b['attributes']=_[_0xf700('0x3a')](_0xa68670[_0xf700('0x36')],qs[_0xf700('0x3b')](_0x4afaac[_0xf700('0x38')][_0xf700('0x3b')]));_0x2a2c8b[_0xf700('0x3c')]=_0x2a2c8b[_0xf700('0x3c')][_0xf700('0x49')]?_0x2a2c8b['attributes']:_0xa68670[_0xf700('0x36')];if(!_0x4afaac[_0xf700('0x38')][_0xf700('0x3d')](_0xf700('0x3e'))){_0x2a2c8b[_0xf700('0x1f')]=qs['limit'](_0x4afaac['query'][_0xf700('0x1f')]);_0x2a2c8b['offset']=qs['offset'](_0x4afaac['query']['offset']);}_0x2a2c8b[_0xf700('0x57')]=qs[_0xf700('0x3f')](_0x4afaac[_0xf700('0x38')][_0xf700('0x3f')]);_0x2a2c8b[_0xf700('0x40')]=qs[_0xf700('0x39')](_[_0xf700('0x41')](_0x4afaac[_0xf700('0x38')],_0xa68670[_0xf700('0x39')]));_0x2a2c8b[_0xf700('0x40')][_0xf700('0x58')]=_0xb31cc3['id'];if(_0x4afaac[_0xf700('0x38')][_0xf700('0x42')]){_0x2a2c8b[_0xf700('0x40')]=_['merge'](_0x2a2c8b[_0xf700('0x40')],{'$or':_[_0xf700('0x31')](_0x2a2c8b['attributes'],function(_0x43cfb4){var _0xe639b5={};_0xe639b5[_0x43cfb4]={'$like':'%'+_0x4afaac[_0xf700('0x38')][_0xf700('0x42')]+'%'};return _0xe639b5;})});}_0x2a2c8b=_[_0xf700('0x43')]({},_0x2a2c8b,_0x4afaac[_0xf700('0x4b')]);return db[_0xf700('0x59')][_0xf700('0x5a')](_0x2a2c8b);}})[_0xf700('0x26')](function(_0x993033){if(_0x993033){return db[_0xf700('0x5b')][_0xf700('0x5c')]({'where':{'id':_['map'](_0x993033,_0xf700('0x5d')),'role':_0xf700('0x5e')},'attributes':['id','name',_0xf700('0x5f'),_0xf700('0x60'),_0xf700('0x61')]});}})[_0xf700('0x26')](function(_0x5c973d){if(_0x5c973d){return{'count':_0x5c973d[_0xf700('0x1e')],'rows':_['map'](_0x5c973d[_0xf700('0x62')],function(_0x395107){return{'membername':_0x395107['name'],'UserId':_0x395107['id'],'queue_name':_0x488ef3['name'],'SmsQueueId':_0x488ef3['id'],'interface':util[_0xf700('0x63')](_0xf700('0x64'),'SIP',_0x395107[_0xf700('0x2e')]),'penalty':0x0,'paused':_0x395107[_0xf700('0x5f')],'createdAt':_0x395107[_0xf700('0x61')],'updatedAt':_0x395107[_0xf700('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x45a6aa,_0x2a2c8b))['catch'](handleError(_0x45a6aa,null));};exports[_0xf700('0x65')]=function(_0x1f191e,_0x5dc303,_0x24261b){var _0x199a5b={};var _0x13a845={};var _0x2264d8;var _0xeb3891;return db['SmsQueue'][_0xf700('0x56')]({'where':{'id':_0x1f191e[_0xf700('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dc303,null))[_0xf700('0x26')](function(_0x5e12f9){if(_0x5e12f9){_0x2264d8=_0x5e12f9;_0x13a845[_0xf700('0x36')]=_[_0xf700('0x37')](db['Team']['rawAttributes']);_0x13a845[_0xf700('0x38')]=_[_0xf700('0x37')](_0x1f191e[_0xf700('0x38')]);_0x13a845[_0xf700('0x39')]=_[_0xf700('0x3a')](_0x13a845['model'],_0x13a845['query']);_0x199a5b['attributes']=_['intersection'](_0x13a845[_0xf700('0x36')],qs[_0xf700('0x3b')](_0x1f191e[_0xf700('0x38')][_0xf700('0x3b')]));_0x199a5b[_0xf700('0x3c')]=_0x199a5b[_0xf700('0x3c')][_0xf700('0x49')]?_0x199a5b['attributes']:_0x13a845[_0xf700('0x36')];_0x199a5b[_0xf700('0x57')]=qs[_0xf700('0x3f')](_0x1f191e[_0xf700('0x38')][_0xf700('0x3f')]);_0x199a5b[_0xf700('0x40')]=qs[_0xf700('0x39')](_[_0xf700('0x41')](_0x1f191e['query'],_0x13a845[_0xf700('0x39')]));if(_0x1f191e[_0xf700('0x38')]['filter']){_0x199a5b[_0xf700('0x40')]=_[_0xf700('0x43')](_0x199a5b[_0xf700('0x40')],{'$or':_[_0xf700('0x31')](_0x199a5b[_0xf700('0x3c')],function(_0x3ba9c4){var _0x6e53cf={};_0x6e53cf[_0x3ba9c4]={'$like':'%'+_0x1f191e[_0xf700('0x38')][_0xf700('0x42')]+'%'};return _0x6e53cf;})});}_0x199a5b=_[_0xf700('0x43')]({},_0x199a5b,_0x1f191e[_0xf700('0x4b')]);return _0x2264d8[_0xf700('0x65')](_0x199a5b);}})[_0xf700('0x26')](function(_0x774ef2){if(_0x774ef2){_0xeb3891=_0x774ef2[_0xf700('0x49')];if(!_0x1f191e['query']['hasOwnProperty'](_0xf700('0x3e'))){_0x199a5b['limit']=qs['limit'](_0x1f191e['query']['limit']);_0x199a5b[_0xf700('0x66')]=qs[_0xf700('0x66')](_0x1f191e[_0xf700('0x38')][_0xf700('0x66')]);}return _0x2264d8[_0xf700('0x65')](_0x199a5b);}})['then'](function(_0x114b41){if(_0x114b41){return _0x114b41?{'count':_0xeb3891,'rows':_0x114b41}:null;}})[_0xf700('0x26')](respondWithResult(_0x5dc303,null))[_0xf700('0x46')](handleError(_0x5dc303,null));};exports[_0xf700('0x67')]=function(_0xc2859d,_0x4161b0,_0x21122a){var _0x4fdf73=_0xc2859d['body'][_0xf700('0x68')];return db[_0xf700('0x69')][_0xf700('0x5a')]({'where':{'id':_0x4fdf73},'attributes':['id'],'include':[{'model':db[_0xf700('0x5b')],'as':_0xf700('0x6a'),'attributes':['id','name',_0xf700('0x6b'),_0xf700('0x6c'),_0xf700('0x6d')],'raw':!![]}]})[_0xf700('0x26')](function(_0x2e1a71){if(_0x2e1a71){var _0x5d2780=_['flatMap'](_0x2e1a71,function(_0x371d04){var _0x7214d7=_0x371d04['get']({'plain':!![]});return _0x7214d7[_0xf700('0x6a')];});return db[_0xf700('0x32')][_0xf700('0x4c')]({'where':{'id':_0xc2859d[_0xf700('0x48')]['id']}})['then'](function(_0x1a89b0){return db[_0xf700('0x6e')][_0xf700('0x6f')](function(_0x576ac0){return _0x1a89b0[_0xf700('0x67')](_0x4fdf73,{'transaction':_0x576ac0})['then'](function(){return BPromise['each'](_0x5d2780,function(_0x51c0a5){return db['UserSmsQueue'][_0xf700('0x70')]({'where':{'UserId':_0x51c0a5['id'],'SmsQueueId':_0xc2859d[_0xf700('0x48')]['id']},'transaction':_0x576ac0});});})[_0xf700('0x26')](function(){_0x5d2780[_0xf700('0x71')](function(_0x3f3e47){socket[_0xf700('0x72')]('userSmsQueue:save',{'UserId':_0x3f3e47['id'],'SmsQueueId':_0x1a89b0['id']});});});});});}})[_0xf700('0x26')](respondWithStatusCode(_0x4161b0,null))[_0xf700('0x46')](handleError(_0x4161b0,null));};exports[_0xf700('0x73')]=function(_0x2e64ae,_0x396969,_0x208467){return db[_0xf700('0x69')]['findAll']({'where':{'id':_0x2e64ae['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf700('0x5b')],'as':_0xf700('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf700('0x26')](handleEntityNotFound(_0x396969,null))[_0xf700('0x26')](function(_0x396604){var _0x3b0f16=_['map'](_0x396604,'id');var _0x44fb55=[];var _0x3349b5=[];var _0x1dc29b=squel['select']();_0x1dc29b['field']('tq.TeamId')[_0xf700('0x74')](_0xf700('0x75'),'tq')['join'](_0xf700('0x76'),'ut',_0xf700('0x77'))['where']('SmsQueueId\x20=\x20?',_0x2e64ae[_0xf700('0x48')]['id']);for(var _0x57f281=0x0;_0x57f281<_0x396604['length'];_0x57f281+=0x1){let _0x407500=_0x396604[_0x57f281];for(var _0x5d8bff=0x0;_0x5d8bff<_0x407500[_0xf700('0x6a')][_0xf700('0x49')];_0x5d8bff+=0x1){let _0x1bd27a=_0x407500[_0xf700('0x6a')][_0x5d8bff];var _0x19a02f=_0x1dc29b[_0xf700('0x78')]();_0x19a02f['where'](_0xf700('0x79'),_0x1bd27a['id']);_0x3349b5[_0xf700('0x7a')](db[_0xf700('0x6e')][_0xf700('0x38')](_0x19a02f[_0xf700('0x7b')](),{'type':db[_0xf700('0x6e')][_0xf700('0x7c')][_0xf700('0x7d')]})[_0xf700('0x26')](function(_0x1a426c){if(_0x1a426c[_0xf700('0x49')]===0x1){return _0x1bd27a['id'];}else{var _0x5a150e=_[_0xf700('0x7e')](_[_0xf700('0x31')](_0x1a426c,_0xf700('0x7f')),function(_0x5b6b24){return _['includes'](_0x3b0f16,_0x5b6b24);});if(_0x5a150e){return _0x1bd27a['id'];}}}));}}return BPromise[_0xf700('0x80')](_0x3349b5)[_0xf700('0x26')](function(_0x5897b3){_0x44fb55=_(_0x44fb55)[_0xf700('0x81')](_0x5897b3)[_0xf700('0x82')]()[_0xf700('0x83')]();return db[_0xf700('0x32')][_0xf700('0x4c')]({'where':{'id':_0x2e64ae[_0xf700('0x48')]['id']}})[_0xf700('0x26')](function(_0x5c73f8){return db['sequelize'][_0xf700('0x6f')](function(_0x4ea609){return _0x5c73f8[_0xf700('0x73')](_0x2e64ae[_0xf700('0x38')]['ids'],{'transaction':_0x4ea609})['then'](function(){if(!_[_0xf700('0x84')](_0x44fb55)){return _0x5c73f8[_0xf700('0x85')](_0x44fb55,{'transaction':_0x4ea609});}})[_0xf700('0x26')](function(){_0x44fb55[_0xf700('0x71')](function(_0x56fce9){socket[_0xf700('0x72')]('userSmsQueue:remove',{'UserId':_0x56fce9,'SmsQueueId':_0x5c73f8['id']});});});});});});})[_0xf700('0x26')](respondWithStatusCode(_0x396969,null))[_0xf700('0x46')](handleError(_0x396969,null));};exports[_0xf700('0x86')]=function(_0x160f68,_0xf38b65,_0x53bdf4){return db['SmsQueue'][_0xf700('0x4c')]({'where':{'id':_0x160f68[_0xf700('0x48')]['id']}})['then'](handleEntityNotFound(_0xf38b65,null))[_0xf700('0x26')](function(_0x59c3eb){if(_0x59c3eb){return _0x59c3eb[_0xf700('0x86')](_0x160f68[_0xf700('0x4e')][_0xf700('0x68')],_[_0xf700('0x87')](_0x160f68['body'],[_0xf700('0x68'),'id'])||{})[_0xf700('0x88')](function(_0x4e39a2){for(var _0x4d9320=0x0;_0x4d9320<_0x160f68['body'][_0xf700('0x68')][_0xf700('0x49')];_0x4d9320+=0x1){socket[_0xf700('0x72')](_0xf700('0x89'),{'UserId':_0x160f68[_0xf700('0x4e')][_0xf700('0x68')][_0x4d9320],'SmsQueueId':_0x160f68[_0xf700('0x48')]['id']});}return _0x4e39a2;});}})[_0xf700('0x26')](respondWithResult(_0xf38b65,null))[_0xf700('0x46')](handleError(_0xf38b65,null));};exports[_0xf700('0x85')]=function(_0x4c99ec,_0x2edb85,_0x5c1af1){return db[_0xf700('0x32')][_0xf700('0x4c')]({'where':{'id':_0x4c99ec['params']['id']}})[_0xf700('0x26')](handleEntityNotFound(_0x2edb85,null))[_0xf700('0x26')](function(_0x204209){if(_0x204209){return _0x204209[_0xf700('0x85')](_0x4c99ec[_0xf700('0x38')]['ids'])[_0xf700('0x26')](function(){if(_['isArray'](_0x4c99ec[_0xf700('0x38')][_0xf700('0x68')])){for(var _0x124df0=0x0;_0x124df0<_0x4c99ec[_0xf700('0x38')]['ids']['length'];_0x124df0+=0x1){socket[_0xf700('0x72')]('userSmsQueue:remove',{'UserId':Number(_0x4c99ec[_0xf700('0x38')][_0xf700('0x68')][_0x124df0]),'SmsQueueId':Number(_0x4c99ec[_0xf700('0x48')]['id'])});}}else{socket[_0xf700('0x72')]('userSmsQueue:remove',{'UserId':Number(_0x4c99ec[_0xf700('0x38')][_0xf700('0x68')]),'SmsQueueId':Number(_0x4c99ec[_0xf700('0x48')]['id'])});}});}})[_0xf700('0x26')](respondWithStatusCode(_0x2edb85,null))[_0xf700('0x46')](handleError(_0x2edb85,null));};exports[_0xf700('0x8a')]=function(_0x167f84,_0x502ad8,_0x3838ee){var _0x462728={};var _0x192e71={};var _0x370f87;var _0x49dfa5;return db[_0xf700('0x32')]['findOne']({'where':{'id':_0x167f84[_0xf700('0x48')]['id']}})['then'](handleEntityNotFound(_0x502ad8,null))[_0xf700('0x26')](function(_0x471c89){if(_0x471c89){_0x370f87=_0x471c89;_0x192e71['model']=_[_0xf700('0x37')](db[_0xf700('0x5b')]['rawAttributes']);_0x192e71[_0xf700('0x38')]=_[_0xf700('0x37')](_0x167f84[_0xf700('0x38')]);_0x192e71[_0xf700('0x39')]=_[_0xf700('0x3a')](_0x192e71[_0xf700('0x36')],_0x192e71['query']);_0x462728['attributes']=_[_0xf700('0x3a')](_0x192e71[_0xf700('0x36')],qs[_0xf700('0x3b')](_0x167f84[_0xf700('0x38')][_0xf700('0x3b')]));_0x462728[_0xf700('0x3c')]=_0x462728[_0xf700('0x3c')][_0xf700('0x49')]?_0x462728[_0xf700('0x3c')]:_0x192e71['model'];_0x462728[_0xf700('0x57')]=qs[_0xf700('0x3f')](_0x167f84[_0xf700('0x38')]['sort']);_0x462728[_0xf700('0x40')]=qs[_0xf700('0x39')](_[_0xf700('0x41')](_0x167f84[_0xf700('0x38')],_0x192e71['filters']));if(_0x167f84[_0xf700('0x38')]['filter']){_0x462728[_0xf700('0x40')]=_[_0xf700('0x43')](_0x462728[_0xf700('0x40')],{'$or':_[_0xf700('0x31')](_0x462728[_0xf700('0x3c')],function(_0x583bf0){var _0x2d9a08={};_0x2d9a08[_0x583bf0]={'$like':'%'+_0x167f84[_0xf700('0x38')][_0xf700('0x42')]+'%'};return _0x2d9a08;})});}_0x462728=_[_0xf700('0x43')]({},_0x462728,_0x167f84[_0xf700('0x4b')]);return _0x370f87[_0xf700('0x8a')](_0x462728);}})['then'](function(_0x2aec16){if(_0x2aec16){_0x49dfa5=_0x2aec16[_0xf700('0x49')];if(!_0x167f84[_0xf700('0x38')][_0xf700('0x3d')](_0xf700('0x3e'))){_0x462728['limit']=qs[_0xf700('0x1f')](_0x167f84[_0xf700('0x38')][_0xf700('0x1f')]);_0x462728['offset']=qs[_0xf700('0x66')](_0x167f84['query'][_0xf700('0x66')]);}return _0x370f87[_0xf700('0x8a')](_0x462728);}})[_0xf700('0x26')](function(_0x4ddd0d){if(_0x4ddd0d){return _0x4ddd0d?{'count':_0x49dfa5,'rows':_0x4ddd0d}:null;}})['then'](respondWithResult(_0x502ad8,null))[_0xf700('0x46')](handleError(_0x502ad8,null));}; \ No newline at end of file +var _0x6d49=['find','userProfileId','autoAssociation','update','describe','getMembers','UserSmsQueue','pick','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','getTeams','findOne','Team','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','type','VIRTUAL','options','includeAll','findAll','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6d49,0x158));var _0x96d4=function(_0x497ef0,_0x599204){_0x497ef0=_0x497ef0-0x0;var _0x295b11=_0x6d49[_0x497ef0];return _0x295b11;};'use strict';var pdf=require(_0x96d4('0x0'));var emlformat=require(_0x96d4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x96d4('0x2'));var rp=require(_0x96d4('0x3'));var moment=require(_0x96d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96d4('0x5'));var util=require(_0x96d4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x96d4('0x7'));var ejs=require(_0x96d4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x96d4('0x9'));var crypto=require(_0x96d4('0xa'));var jsforce=require(_0x96d4('0xb'));var deskjs=require(_0x96d4('0xc'));var toCsv=require(_0x96d4('0x7'));var querystring=require(_0x96d4('0xd'));var Papa=require(_0x96d4('0xe'));var Redis=require(_0x96d4('0xf'));var authService=require(_0x96d4('0x10'));var qs=require(_0x96d4('0x11'));var as=require(_0x96d4('0x12'));var hardwareService=require(_0x96d4('0x13'));var logger=require(_0x96d4('0x14'))(_0x96d4('0x15'));var utils=require(_0x96d4('0x16'));var config=require(_0x96d4('0x17'));var db=require(_0x96d4('0x18'))['db'];config[_0x96d4('0x19')]=_[_0x96d4('0x1a')](config[_0x96d4('0x19')],{'host':_0x96d4('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96d4('0x19')]));require(_0x96d4('0x1c'))[_0x96d4('0x1d')](socket);function respondWithStatusCode(_0x4e17c4,_0x48469d){_0x48469d=_0x48469d||0xcc;return function(_0x42ca41){if(_0x42ca41){return _0x4e17c4[_0x96d4('0x1e')](_0x48469d);}return _0x4e17c4[_0x96d4('0x1f')](_0x48469d)[_0x96d4('0x20')]();};}function respondWithResult(_0x5e0637,_0x17f70d){_0x17f70d=_0x17f70d||0xc8;return function(_0x48e9b2){if(_0x48e9b2){return _0x5e0637[_0x96d4('0x1f')](_0x17f70d)[_0x96d4('0x21')](_0x48e9b2);}};}function respondWithFilteredResult(_0x122433,_0x59cdf3){return function(_0x306ac2){if(_0x306ac2){var _0x3c4ef0=_0x306ac2[_0x96d4('0x22')],_0x3089a7=_0x59cdf3[_0x96d4('0x23')],_0x19e813=_0x59cdf3[_0x96d4('0x23')]+_0x59cdf3[_0x96d4('0x24')],_0x35af19;if(_0x19e813>=_0x3c4ef0){_0x19e813=_0x3c4ef0;_0x35af19=0xc8;}else{_0x35af19=0xce;}_0x122433[_0x96d4('0x1f')](_0x35af19);return _0x122433[_0x96d4('0x25')](_0x96d4('0x26'),_0x3089a7+'-'+_0x19e813+'/'+_0x3c4ef0)[_0x96d4('0x21')](_0x306ac2);}return null;};}function patchUpdates(_0x42aa87){return function(_0x1f69e5){try{jsonpatch[_0x96d4('0x27')](_0x1f69e5,_0x42aa87,!![]);}catch(_0x8348c3){return BPromise[_0x96d4('0x28')](_0x8348c3);}return _0x1f69e5[_0x96d4('0x29')]();};}function saveUpdates(_0x34cd59,_0x194c63){return function(_0x28e5b6){if(_0x28e5b6){return _0x28e5b6['update'](_0x34cd59)[_0x96d4('0x2a')](function(_0x28f626){return _0x28f626;});}return null;};}function removeEntity(_0x16c010,_0x49cdc4){return function(_0x15ea65){if(_0x15ea65){return _0x15ea65['destroy']()[_0x96d4('0x2a')](function(){var _0x529bbf=_0x15ea65[_0x96d4('0x2b')]({'plain':!![]});var _0x1aaf4c=_0x96d4('0x2c');return db[_0x96d4('0x2d')][_0x96d4('0x2e')]({'where':{'type':_0x1aaf4c,'resourceId':_0x529bbf['id']}})[_0x96d4('0x2a')](function(){return _0x15ea65;});})[_0x96d4('0x2a')](function(){_0x16c010['status'](0xcc)[_0x96d4('0x20')]();});}};}function handleEntityNotFound(_0x2deb26,_0x178e02){return function(_0x2af63b){if(!_0x2af63b){_0x2deb26[_0x96d4('0x1e')](0x194);}return _0x2af63b;};}function handleError(_0x522421,_0x3d3f12){_0x3d3f12=_0x3d3f12||0x1f4;return function(_0x8dd025){logger[_0x96d4('0x2f')](_0x8dd025[_0x96d4('0x30')]);if(_0x8dd025['name']){delete _0x8dd025[_0x96d4('0x31')];}_0x522421[_0x96d4('0x1f')](_0x3d3f12)[_0x96d4('0x32')](_0x8dd025);};}exports[_0x96d4('0x33')]=function(_0x304baa,_0x24e118){var _0xad7143={},_0x4839c5={},_0x4de365={'count':0x0,'rows':[]};var _0x48cc2d=_['map'](db[_0x96d4('0x34')][_0x96d4('0x35')],function(_0x2d50ff){return{'name':_0x2d50ff[_0x96d4('0x36')],'type':_0x2d50ff['type'][_0x96d4('0x37')]};});_0x4839c5[_0x96d4('0x38')]=_['map'](_0x48cc2d,_0x96d4('0x31'));_0x4839c5[_0x96d4('0x39')]=_['keys'](_0x304baa[_0x96d4('0x39')]);_0x4839c5[_0x96d4('0x3a')]=_['intersection'](_0x4839c5[_0x96d4('0x38')],_0x4839c5['query']);_0xad7143[_0x96d4('0x3b')]=_[_0x96d4('0x3c')](_0x4839c5[_0x96d4('0x38')],qs[_0x96d4('0x3d')](_0x304baa[_0x96d4('0x39')][_0x96d4('0x3d')]));_0xad7143[_0x96d4('0x3b')]=_0xad7143['attributes'][_0x96d4('0x3e')]?_0xad7143[_0x96d4('0x3b')]:_0x4839c5[_0x96d4('0x38')];if(!_0x304baa[_0x96d4('0x39')][_0x96d4('0x3f')](_0x96d4('0x40'))){_0xad7143[_0x96d4('0x24')]=qs[_0x96d4('0x24')](_0x304baa['query']['limit']);_0xad7143['offset']=qs[_0x96d4('0x23')](_0x304baa[_0x96d4('0x39')][_0x96d4('0x23')]);}_0xad7143[_0x96d4('0x41')]=qs[_0x96d4('0x42')](_0x304baa['query']['sort']);_0xad7143['where']=qs[_0x96d4('0x3a')](_['pick'](_0x304baa['query'],_0x4839c5[_0x96d4('0x3a')]),_0x48cc2d);if(_0x304baa[_0x96d4('0x39')][_0x96d4('0x43')]){_0xad7143[_0x96d4('0x44')]=_[_0x96d4('0x45')](_0xad7143[_0x96d4('0x44')],{'$or':_[_0x96d4('0x46')](_0x48cc2d,function(_0xe4996){if(_0xe4996[_0x96d4('0x47')]!==_0x96d4('0x48')){var _0x1b89f6={};_0x1b89f6[_0xe4996[_0x96d4('0x31')]]={'$like':'%'+_0x304baa[_0x96d4('0x39')][_0x96d4('0x43')]+'%'};return _0x1b89f6;}})});}_0xad7143=_[_0x96d4('0x45')]({},_0xad7143,_0x304baa[_0x96d4('0x49')]);var _0x264e14={'where':_0xad7143[_0x96d4('0x44')]};return db['SmsQueue']['count'](_0x264e14)[_0x96d4('0x2a')](function(_0x1ff2f8){_0x4de365[_0x96d4('0x22')]=_0x1ff2f8;if(_0x304baa[_0x96d4('0x39')][_0x96d4('0x4a')]){_0xad7143['include']=[{'all':!![]}];}return db[_0x96d4('0x34')][_0x96d4('0x4b')](_0xad7143);})['then'](function(_0x130718){_0x4de365['rows']=_0x130718;return _0x4de365;})[_0x96d4('0x2a')](respondWithFilteredResult(_0x24e118,_0xad7143))[_0x96d4('0x4c')](handleError(_0x24e118,null));};exports['show']=function(_0x161344,_0x228d34){var _0xc3e54={'raw':!![],'where':{'id':_0x161344[_0x96d4('0x4d')]['id']}},_0x2030da={};_0x2030da[_0x96d4('0x38')]=_[_0x96d4('0x4e')](db[_0x96d4('0x34')][_0x96d4('0x35')]);_0x2030da[_0x96d4('0x39')]=_[_0x96d4('0x4e')](_0x161344[_0x96d4('0x39')]);_0x2030da[_0x96d4('0x3a')]=_[_0x96d4('0x3c')](_0x2030da[_0x96d4('0x38')],_0x2030da[_0x96d4('0x39')]);_0xc3e54[_0x96d4('0x3b')]=_[_0x96d4('0x3c')](_0x2030da[_0x96d4('0x38')],qs[_0x96d4('0x3d')](_0x161344[_0x96d4('0x39')][_0x96d4('0x3d')]));_0xc3e54[_0x96d4('0x3b')]=_0xc3e54[_0x96d4('0x3b')]['length']?_0xc3e54[_0x96d4('0x3b')]:_0x2030da[_0x96d4('0x38')];if(_0x161344[_0x96d4('0x39')][_0x96d4('0x4a')]){_0xc3e54['include']=[{'all':!![]}];}_0xc3e54=_['merge']({},_0xc3e54,_0x161344[_0x96d4('0x49')]);return db[_0x96d4('0x34')]['find'](_0xc3e54)[_0x96d4('0x2a')](handleEntityNotFound(_0x228d34,null))['then'](respondWithResult(_0x228d34,null))[_0x96d4('0x4c')](handleError(_0x228d34,null));};exports[_0x96d4('0x4f')]=function(_0x3ab6ee,_0x381048){return db['SmsQueue']['create'](_0x3ab6ee[_0x96d4('0x50')],{})[_0x96d4('0x2a')](function(_0x4d0099){var _0x2e755f=_0x3ab6ee[_0x96d4('0x51')][_0x96d4('0x2b')]({'plain':!![]});if(!_0x2e755f)throw new Error(_0x96d4('0x52'));if(_0x2e755f[_0x96d4('0x53')]==='user'){var _0x23a02b=_0x4d0099[_0x96d4('0x2b')]({'plain':!![]});var _0x5910bb=_0x96d4('0x2c');return db[_0x96d4('0x54')][_0x96d4('0x55')]({'where':{'name':_0x5910bb,'userProfileId':_0x2e755f[_0x96d4('0x56')]},'raw':!![]})[_0x96d4('0x2a')](function(_0x214368){if(_0x214368&&_0x214368[_0x96d4('0x57')]===0x0){return db[_0x96d4('0x2d')]['create']({'name':_0x23a02b[_0x96d4('0x31')],'resourceId':_0x23a02b['id'],'type':_0x214368[_0x96d4('0x31')],'sectionId':_0x214368['id']},{})['then'](function(){return _0x4d0099;});}else{return _0x4d0099;}})[_0x96d4('0x4c')](function(_0x2898c6){logger[_0x96d4('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2898c6);throw _0x2898c6;});}return _0x4d0099;})[_0x96d4('0x2a')](respondWithResult(_0x381048,0xc9))[_0x96d4('0x4c')](handleError(_0x381048,null));};exports[_0x96d4('0x58')]=function(_0x207775,_0x486f42){if(_0x207775[_0x96d4('0x50')]['id']){delete _0x207775['body']['id'];}return db[_0x96d4('0x34')]['find']({'where':{'id':_0x207775[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](handleEntityNotFound(_0x486f42,null))[_0x96d4('0x2a')](saveUpdates(_0x207775[_0x96d4('0x50')],null))['then'](respondWithResult(_0x486f42,null))[_0x96d4('0x4c')](handleError(_0x486f42,null));};exports[_0x96d4('0x2e')]=function(_0x3d2c86,_0x53f0e3){return db[_0x96d4('0x34')][_0x96d4('0x55')]({'where':{'id':_0x3d2c86[_0x96d4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x53f0e3,null))['then'](removeEntity(_0x53f0e3,null))[_0x96d4('0x4c')](handleError(_0x53f0e3,null));};exports[_0x96d4('0x59')]=function(_0x281e81,_0x2a6599){return db[_0x96d4('0x34')][_0x96d4('0x59')]()[_0x96d4('0x2a')](respondWithResult(_0x2a6599,null))[_0x96d4('0x4c')](handleError(_0x2a6599,null));};exports[_0x96d4('0x5a')]=function(_0xf2520c,_0x5612b3,_0x11e074){var _0xcfcfd1={'raw':!![],'where':{}},_0x4471de={},_0x260c45;return db['SmsQueue']['findOne']({'where':{'id':_0xf2520c[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](handleEntityNotFound(_0x5612b3,null))['then'](function(_0x2889c9){if(_0x2889c9){_0x260c45=_0x2889c9[_0x96d4('0x2b')]({'plain':!![]});_0x4471de[_0x96d4('0x38')]=_['keys'](db[_0x96d4('0x5b')][_0x96d4('0x35')]);_0x4471de['query']=_[_0x96d4('0x4e')](_0xf2520c[_0x96d4('0x39')]);_0x4471de[_0x96d4('0x3a')]=_[_0x96d4('0x3c')](_0x4471de[_0x96d4('0x38')],_0x4471de[_0x96d4('0x39')]);_0xcfcfd1[_0x96d4('0x3b')]=_[_0x96d4('0x3c')](_0x4471de['model'],qs['fields'](_0xf2520c[_0x96d4('0x39')][_0x96d4('0x3d')]));_0xcfcfd1[_0x96d4('0x3b')]=_0xcfcfd1['attributes'][_0x96d4('0x3e')]?_0xcfcfd1['attributes']:_0x4471de[_0x96d4('0x38')];if(!_0xf2520c[_0x96d4('0x39')][_0x96d4('0x3f')](_0x96d4('0x40'))){_0xcfcfd1['limit']=qs[_0x96d4('0x24')](_0xf2520c['query'][_0x96d4('0x24')]);_0xcfcfd1[_0x96d4('0x23')]=qs[_0x96d4('0x23')](_0xf2520c[_0x96d4('0x39')][_0x96d4('0x23')]);}_0xcfcfd1['order']=qs[_0x96d4('0x42')](_0xf2520c[_0x96d4('0x39')][_0x96d4('0x42')]);_0xcfcfd1['where']=qs[_0x96d4('0x3a')](_[_0x96d4('0x5c')](_0xf2520c[_0x96d4('0x39')],_0x4471de[_0x96d4('0x3a')]));_0xcfcfd1['where']['SmsQueueId']=_0x2889c9['id'];if(_0xf2520c[_0x96d4('0x39')]['filter']){_0xcfcfd1[_0x96d4('0x44')]=_[_0x96d4('0x45')](_0xcfcfd1['where'],{'$or':_[_0x96d4('0x46')](_0xcfcfd1[_0x96d4('0x3b')],function(_0x34b4dd){var _0x2becef={};_0x2becef[_0x34b4dd]={'$like':'%'+_0xf2520c['query'][_0x96d4('0x43')]+'%'};return _0x2becef;})});}_0xcfcfd1=_[_0x96d4('0x45')]({},_0xcfcfd1,_0xf2520c['options']);return db['UserSmsQueue'][_0x96d4('0x4b')](_0xcfcfd1);}})['then'](function(_0x1a2a1e){if(_0x1a2a1e){return db[_0x96d4('0x5d')][_0x96d4('0x5e')]({'where':{'id':_['map'](_0x1a2a1e,_0x96d4('0x5f')),'role':_0x96d4('0x60')},'attributes':['id',_0x96d4('0x31'),_0x96d4('0x61'),_0x96d4('0x62'),_0x96d4('0x63')]});}})[_0x96d4('0x2a')](function(_0x4cc549){if(_0x4cc549){return{'count':_0x4cc549[_0x96d4('0x22')],'rows':_['map'](_0x4cc549['rows'],function(_0x51788b){return{'membername':_0x51788b['name'],'UserId':_0x51788b['id'],'queue_name':_0x260c45[_0x96d4('0x31')],'SmsQueueId':_0x260c45['id'],'interface':util['format'](_0x96d4('0x64'),'SIP',_0x51788b[_0x96d4('0x31')]),'penalty':0x0,'paused':_0x51788b[_0x96d4('0x61')],'createdAt':_0x51788b[_0x96d4('0x63')],'updatedAt':_0x51788b[_0x96d4('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5612b3,_0xcfcfd1))['catch'](handleError(_0x5612b3,null));};exports[_0x96d4('0x65')]=function(_0x526f5e,_0x227f14,_0x8f9e88){var _0x4f5006={};var _0x54f446={};var _0x1905e3;var _0x2a9c10;return db[_0x96d4('0x34')][_0x96d4('0x66')]({'where':{'id':_0x526f5e[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](handleEntityNotFound(_0x227f14,null))[_0x96d4('0x2a')](function(_0x5830d8){if(_0x5830d8){_0x1905e3=_0x5830d8;_0x54f446[_0x96d4('0x38')]=_[_0x96d4('0x4e')](db[_0x96d4('0x67')]['rawAttributes']);_0x54f446[_0x96d4('0x39')]=_[_0x96d4('0x4e')](_0x526f5e['query']);_0x54f446['filters']=_['intersection'](_0x54f446[_0x96d4('0x38')],_0x54f446[_0x96d4('0x39')]);_0x4f5006[_0x96d4('0x3b')]=_[_0x96d4('0x3c')](_0x54f446[_0x96d4('0x38')],qs[_0x96d4('0x3d')](_0x526f5e[_0x96d4('0x39')][_0x96d4('0x3d')]));_0x4f5006[_0x96d4('0x3b')]=_0x4f5006[_0x96d4('0x3b')]['length']?_0x4f5006[_0x96d4('0x3b')]:_0x54f446['model'];_0x4f5006['order']=qs['sort'](_0x526f5e['query']['sort']);_0x4f5006['where']=qs['filters'](_['pick'](_0x526f5e[_0x96d4('0x39')],_0x54f446['filters']));if(_0x526f5e[_0x96d4('0x39')][_0x96d4('0x43')]){_0x4f5006['where']=_[_0x96d4('0x45')](_0x4f5006[_0x96d4('0x44')],{'$or':_[_0x96d4('0x46')](_0x4f5006[_0x96d4('0x3b')],function(_0x5e7d52){var _0x2880e5={};_0x2880e5[_0x5e7d52]={'$like':'%'+_0x526f5e['query']['filter']+'%'};return _0x2880e5;})});}_0x4f5006=_['merge']({},_0x4f5006,_0x526f5e[_0x96d4('0x49')]);return _0x1905e3[_0x96d4('0x65')](_0x4f5006);}})[_0x96d4('0x2a')](function(_0x6ca9c5){if(_0x6ca9c5){_0x2a9c10=_0x6ca9c5[_0x96d4('0x3e')];if(!_0x526f5e[_0x96d4('0x39')][_0x96d4('0x3f')](_0x96d4('0x40'))){_0x4f5006['limit']=qs[_0x96d4('0x24')](_0x526f5e[_0x96d4('0x39')][_0x96d4('0x24')]);_0x4f5006['offset']=qs[_0x96d4('0x23')](_0x526f5e['query']['offset']);}return _0x1905e3[_0x96d4('0x65')](_0x4f5006);}})['then'](function(_0x175816){if(_0x175816){return _0x175816?{'count':_0x2a9c10,'rows':_0x175816}:null;}})[_0x96d4('0x2a')](respondWithResult(_0x227f14,null))['catch'](handleError(_0x227f14,null));};exports['addTeams']=function(_0x162682,_0x50ce0c,_0x4f6d88){var _0x1a227b=_0x162682[_0x96d4('0x50')][_0x96d4('0x68')];return db['Team']['findAll']({'where':{'id':_0x1a227b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x96d4('0x69'),'attributes':['id',_0x96d4('0x31'),_0x96d4('0x6a'),'voicePause',_0x96d4('0x6b')],'raw':!![]}]})['then'](function(_0x4fc696){if(_0x4fc696){var _0x59015c=_[_0x96d4('0x6c')](_0x4fc696,function(_0x258158){var _0x848b2e=_0x258158[_0x96d4('0x2b')]({'plain':!![]});return _0x848b2e[_0x96d4('0x69')];});return db['SmsQueue'][_0x96d4('0x55')]({'where':{'id':_0x162682['params']['id']}})[_0x96d4('0x2a')](function(_0x30fcda){return db[_0x96d4('0x6d')][_0x96d4('0x6e')](function(_0x5070fa){return _0x30fcda['addTeams'](_0x1a227b,{'transaction':_0x5070fa})['then'](function(){return BPromise[_0x96d4('0x6f')](_0x59015c,function(_0x4dd2a7){return db[_0x96d4('0x5b')][_0x96d4('0x70')]({'where':{'UserId':_0x4dd2a7['id'],'SmsQueueId':_0x162682['params']['id']},'transaction':_0x5070fa});});})[_0x96d4('0x2a')](function(){_0x59015c['forEach'](function(_0x4625ba){socket[_0x96d4('0x71')](_0x96d4('0x72'),{'UserId':_0x4625ba['id'],'SmsQueueId':_0x30fcda['id']});});});});});}})[_0x96d4('0x2a')](respondWithStatusCode(_0x50ce0c,null))[_0x96d4('0x4c')](handleError(_0x50ce0c,null));};exports[_0x96d4('0x73')]=function(_0x4e581b,_0x12e517,_0x5e0c37){return db[_0x96d4('0x67')][_0x96d4('0x4b')]({'where':{'id':_0x4e581b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x96d4('0x5d')],'as':_0x96d4('0x69'),'attributes':['id'],'raw':!![]}]})[_0x96d4('0x2a')](handleEntityNotFound(_0x12e517,null))[_0x96d4('0x2a')](function(_0x274931){var _0x15e2de=_[_0x96d4('0x46')](_0x274931,'id');var _0x1f775b=[];var _0x9d1a95=[];var _0x3b6171=squel[_0x96d4('0x74')]();_0x3b6171[_0x96d4('0x75')](_0x96d4('0x76'))[_0x96d4('0x77')](_0x96d4('0x78'),'tq')[_0x96d4('0x79')](_0x96d4('0x7a'),'ut',_0x96d4('0x7b'))[_0x96d4('0x44')](_0x96d4('0x7c'),_0x4e581b[_0x96d4('0x4d')]['id']);for(var _0x81736c=0x0;_0x81736c<_0x274931[_0x96d4('0x3e')];_0x81736c+=0x1){let _0x2354b2=_0x274931[_0x81736c];for(var _0x401fca=0x0;_0x401fca<_0x2354b2[_0x96d4('0x69')]['length'];_0x401fca+=0x1){let _0x41a45d=_0x2354b2[_0x96d4('0x69')][_0x401fca];var _0x23ec84=_0x3b6171['clone']();_0x23ec84[_0x96d4('0x44')](_0x96d4('0x7d'),_0x41a45d['id']);_0x9d1a95[_0x96d4('0x7e')](db['sequelize'][_0x96d4('0x39')](_0x23ec84[_0x96d4('0x7f')](),{'type':db[_0x96d4('0x6d')]['QueryTypes'][_0x96d4('0x80')]})[_0x96d4('0x2a')](function(_0x460c02){if(_0x460c02[_0x96d4('0x3e')]===0x1){return _0x41a45d['id'];}else{var _0x5e5fd9=_['every'](_['map'](_0x460c02,_0x96d4('0x81')),function(_0x275009){return _[_0x96d4('0x82')](_0x15e2de,_0x275009);});if(_0x5e5fd9){return _0x41a45d['id'];}}}));}}return BPromise[_0x96d4('0x83')](_0x9d1a95)[_0x96d4('0x2a')](function(_0x34d6ea){_0x1f775b=_(_0x1f775b)[_0x96d4('0x84')](_0x34d6ea)[_0x96d4('0x85')]()[_0x96d4('0x86')]();return db[_0x96d4('0x34')][_0x96d4('0x55')]({'where':{'id':_0x4e581b[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](function(_0xbad903){return db[_0x96d4('0x6d')]['transaction'](function(_0x417612){return _0xbad903[_0x96d4('0x73')](_0x4e581b[_0x96d4('0x39')][_0x96d4('0x68')],{'transaction':_0x417612})[_0x96d4('0x2a')](function(){if(!_[_0x96d4('0x87')](_0x1f775b)){return _0xbad903[_0x96d4('0x88')](_0x1f775b,{'transaction':_0x417612});}})[_0x96d4('0x2a')](function(){_0x1f775b[_0x96d4('0x89')](function(_0x5a6f48){socket[_0x96d4('0x71')](_0x96d4('0x8a'),{'UserId':_0x5a6f48,'SmsQueueId':_0xbad903['id']});});});});});});})[_0x96d4('0x2a')](respondWithStatusCode(_0x12e517,null))[_0x96d4('0x4c')](handleError(_0x12e517,null));};exports[_0x96d4('0x8b')]=function(_0x557dd4,_0x2a9ae0,_0x11b983){return db[_0x96d4('0x34')][_0x96d4('0x55')]({'where':{'id':_0x557dd4['params']['id']}})['then'](handleEntityNotFound(_0x2a9ae0,null))[_0x96d4('0x2a')](function(_0x28b7eb){if(_0x28b7eb){return _0x28b7eb[_0x96d4('0x8b')](_0x557dd4['body'][_0x96d4('0x68')],_['omit'](_0x557dd4[_0x96d4('0x50')],[_0x96d4('0x68'),'id'])||{})[_0x96d4('0x8c')](function(_0x37972c){for(var _0x4daa23=0x0;_0x4daa23<_0x557dd4[_0x96d4('0x50')][_0x96d4('0x68')][_0x96d4('0x3e')];_0x4daa23+=0x1){socket['emit'](_0x96d4('0x72'),{'UserId':_0x557dd4[_0x96d4('0x50')][_0x96d4('0x68')][_0x4daa23],'SmsQueueId':_0x557dd4['params']['id']});}return _0x37972c;});}})[_0x96d4('0x2a')](respondWithResult(_0x2a9ae0,null))['catch'](handleError(_0x2a9ae0,null));};exports['removeAgents']=function(_0xae98f3,_0x2bddd6,_0x46190f){return db[_0x96d4('0x34')][_0x96d4('0x55')]({'where':{'id':_0xae98f3[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](handleEntityNotFound(_0x2bddd6,null))['then'](function(_0x4dacec){if(_0x4dacec){return _0x4dacec[_0x96d4('0x88')](_0xae98f3['query']['ids'])[_0x96d4('0x2a')](function(){if(_[_0x96d4('0x8d')](_0xae98f3[_0x96d4('0x39')]['ids'])){for(var _0x16620e=0x0;_0x16620e<_0xae98f3['query'][_0x96d4('0x68')][_0x96d4('0x3e')];_0x16620e+=0x1){socket[_0x96d4('0x71')](_0x96d4('0x8a'),{'UserId':Number(_0xae98f3[_0x96d4('0x39')][_0x96d4('0x68')][_0x16620e]),'SmsQueueId':Number(_0xae98f3[_0x96d4('0x4d')]['id'])});}}else{socket['emit'](_0x96d4('0x8a'),{'UserId':Number(_0xae98f3['query'][_0x96d4('0x68')]),'SmsQueueId':Number(_0xae98f3[_0x96d4('0x4d')]['id'])});}});}})[_0x96d4('0x2a')](respondWithStatusCode(_0x2bddd6,null))[_0x96d4('0x4c')](handleError(_0x2bddd6,null));};exports[_0x96d4('0x8e')]=function(_0x352005,_0xb45d87,_0x99aca3){var _0xd62ecf={};var _0x210adf={};var _0x9d9dd3;var _0x2829cc;return db[_0x96d4('0x34')][_0x96d4('0x66')]({'where':{'id':_0x352005['params']['id']}})['then'](handleEntityNotFound(_0xb45d87,null))[_0x96d4('0x2a')](function(_0x9783bb){if(_0x9783bb){_0x9d9dd3=_0x9783bb;_0x210adf['model']=_[_0x96d4('0x4e')](db[_0x96d4('0x5d')][_0x96d4('0x35')]);_0x210adf[_0x96d4('0x39')]=_[_0x96d4('0x4e')](_0x352005[_0x96d4('0x39')]);_0x210adf['filters']=_[_0x96d4('0x3c')](_0x210adf['model'],_0x210adf[_0x96d4('0x39')]);_0xd62ecf['attributes']=_[_0x96d4('0x3c')](_0x210adf['model'],qs['fields'](_0x352005[_0x96d4('0x39')][_0x96d4('0x3d')]));_0xd62ecf[_0x96d4('0x3b')]=_0xd62ecf[_0x96d4('0x3b')][_0x96d4('0x3e')]?_0xd62ecf['attributes']:_0x210adf[_0x96d4('0x38')];_0xd62ecf[_0x96d4('0x41')]=qs['sort'](_0x352005[_0x96d4('0x39')]['sort']);_0xd62ecf[_0x96d4('0x44')]=qs[_0x96d4('0x3a')](_['pick'](_0x352005['query'],_0x210adf[_0x96d4('0x3a')]));if(_0x352005[_0x96d4('0x39')][_0x96d4('0x43')]){_0xd62ecf[_0x96d4('0x44')]=_[_0x96d4('0x45')](_0xd62ecf[_0x96d4('0x44')],{'$or':_['map'](_0xd62ecf[_0x96d4('0x3b')],function(_0x52516d){var _0x6265af={};_0x6265af[_0x52516d]={'$like':'%'+_0x352005[_0x96d4('0x39')][_0x96d4('0x43')]+'%'};return _0x6265af;})});}_0xd62ecf=_[_0x96d4('0x45')]({},_0xd62ecf,_0x352005[_0x96d4('0x49')]);return _0x9d9dd3['getAgents'](_0xd62ecf);}})[_0x96d4('0x2a')](function(_0x1f5faa){if(_0x1f5faa){_0x2829cc=_0x1f5faa[_0x96d4('0x3e')];if(!_0x352005[_0x96d4('0x39')][_0x96d4('0x3f')]('nolimit')){_0xd62ecf[_0x96d4('0x24')]=qs[_0x96d4('0x24')](_0x352005[_0x96d4('0x39')][_0x96d4('0x24')]);_0xd62ecf[_0x96d4('0x23')]=qs['offset'](_0x352005['query'][_0x96d4('0x23')]);}return _0x9d9dd3[_0x96d4('0x8e')](_0xd62ecf);}})[_0x96d4('0x2a')](function(_0x10c79b){if(_0x10c79b){return _0x10c79b?{'count':_0x2829cc,'rows':_0x10c79b}:null;}})[_0x96d4('0x2a')](respondWithResult(_0xb45d87,null))['catch'](handleError(_0xb45d87,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 645ec3d..bcacef0 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 _0xf19d=['save','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0xf19d,0x164));var _0xdf19=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xf19d[_0x1ddedd];return _0xa3e1ac;};'use strict';var EventEmitter=require(_0xdf19('0x0'));var SmsQueue=require(_0xdf19('0x1'))['db'][_0xdf19('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xdf19('0x3')](0x0);var events={'afterCreate':_0xdf19('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38efa2){return function(_0x533cbe,_0x31dd7e,_0x223f0c){SmsQueueEvents[_0xdf19('0x5')](_0x38efa2+':'+_0x533cbe['id'],_0x533cbe);SmsQueueEvents[_0xdf19('0x5')](_0x38efa2,_0x533cbe);_0x223f0c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xdf19('0x6')](e,emitEvent(event));}}module[_0xdf19('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xc8cc=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x483567,_0xe3b4ca){var _0x34cbd6=function(_0x509004){while(--_0x509004){_0x483567['push'](_0x483567['shift']());}};_0x34cbd6(++_0xe3b4ca);}(_0xc8cc,0x8f));var _0xcc8c=function(_0x388bfa,_0x1f518c){_0x388bfa=_0x388bfa-0x0;var _0x11d6a6=_0xc8cc[_0x388bfa];return _0x11d6a6;};'use strict';var EventEmitter=require(_0xcc8c('0x0'));var SmsQueue=require(_0xcc8c('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xcc8c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc8c('0x3'),'afterDestroy':_0xcc8c('0x4')};function emitEvent(_0x291e72){return function(_0x4b79ce,_0x321ee9,_0x4c96d8){SmsQueueEvents[_0xcc8c('0x5')](_0x291e72+':'+_0x4b79ce['id'],_0x4b79ce);SmsQueueEvents[_0xcc8c('0x5')](_0x291e72,_0x4b79ce);_0x4c96d8(null);};}for(var e in events){if(events[_0xcc8c('0x6')](e)){var event=events[e];SmsQueue[_0xcc8c('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 9bc0da4..7b2a10b 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 _0xb66c=['sms_queues','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x362e84,_0x40af12){var _0x292bde=function(_0x472193){while(--_0x472193){_0x362e84['push'](_0x362e84['shift']());}};_0x292bde(++_0x40af12);}(_0xb66c,0x175));var _0xcb66=function(_0x207193,_0x3c6339){_0x207193=_0x207193-0x0;var _0x17e8be=_0xb66c[_0x207193];return _0x17e8be;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var attributes=require(_0xcb66('0x7'));module[_0xcb66('0x8')]=function(_0x5d766d,_0x518163){return _0x5d766d[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa98d=['moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsQueue','sms_queues','lodash','../../config/logger'];(function(_0x58dc87,_0x3f22d1){var _0xb8ec8=function(_0x2a9429){while(--_0x2a9429){_0x58dc87['push'](_0x58dc87['shift']());}};_0xb8ec8(++_0x3f22d1);}(_0xa98d,0xa3));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xda98('0x0'));var util=require('util');var logger=require(_0xda98('0x1'))('api');var moment=require(_0xda98('0x2'));var BPromise=require(_0xda98('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda98('0x4'));var rimraf=require(_0xda98('0x5'));var config=require(_0xda98('0x6'));var attributes=require('./smsQueue.attributes');module[_0xda98('0x7')]=function(_0x39acbf,_0x218e43){return _0x39acbf[_0xda98('0x8')](_0xda98('0x9'),attributes,{'tableName':_0xda98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 5476701..b49bdda 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 _0x58fb=['map','include','model','attributes','ShowSmsQueue','SmsQueue','find','info','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','findAll','options','raw','where','limit'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0x58fb,0x148));var _0xb58f=function(_0x179edb,_0x45fb9d){_0x179edb=_0x179edb-0x0;var _0x8dceae=_0x58fb[_0x179edb];return _0x8dceae;};'use strict';var _=require(_0xb58f('0x0'));var util=require(_0xb58f('0x1'));var moment=require(_0xb58f('0x2'));var BPromise=require('bluebird');var rs=require(_0xb58f('0x3'));var fs=require('fs');var Redis=require(_0xb58f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb58f('0x5'));var logger=require(_0xb58f('0x6'))(_0xb58f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb58f('0x8')][_0xb58f('0x9')]({'port':0x232a});config[_0xb58f('0xa')]=_[_0xb58f('0xb')](config[_0xb58f('0xa')],{'host':_0xb58f('0xc'),'port':0x18eb});var socket=require(_0xb58f('0xd'))(new Redis(config[_0xb58f('0xa')]));require('./smsQueue.socket')[_0xb58f('0xe')](socket);function respondWithRpcPromise(_0x24bd92,_0x5e408d,_0x5aee6c){return new BPromise(function(_0x2c8f74,_0x421705){return client[_0xb58f('0xf')](_0x24bd92,_0x5aee6c)[_0xb58f('0x10')](function(_0x5d445e){logger['info'](_0xb58f('0x11'),_0x5e408d,_0xb58f('0x12'));logger[_0xb58f('0x13')](_0xb58f('0x14'),_0x5e408d,_0xb58f('0x12'),JSON[_0xb58f('0x15')](_0x5d445e));if(_0x5d445e[_0xb58f('0x16')]){if(_0x5d445e['error']['code']===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x5e408d,_0x5d445e[_0xb58f('0x16')][_0xb58f('0x17')]);return _0x421705(_0x5d445e[_0xb58f('0x16')][_0xb58f('0x17')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x5e408d,_0x5d445e[_0xb58f('0x16')][_0xb58f('0x17')]);return _0x2c8f74(_0x5d445e[_0xb58f('0x16')][_0xb58f('0x17')]);}else{logger['info'](_0xb58f('0x11'),_0x5e408d,_0xb58f('0x12'));_0x2c8f74(_0x5d445e[_0xb58f('0x18')]['message']);}})[_0xb58f('0x19')](function(_0x2bc543){logger['error']('SmsQueue,\x20%s,\x20%s',_0x5e408d,_0x2bc543);_0x421705(_0x2bc543);});});}exports[_0xb58f('0x1a')]=function(_0x38540e){var _0x7f64ef=this;return new Promise(function(_0x30965e,_0x19c3a3){return db['SmsQueue'][_0xb58f('0x1b')]({'raw':_0x38540e[_0xb58f('0x1c')]?_0x38540e['options'][_0xb58f('0x1d')]===undefined?!![]:![]:!![],'where':_0x38540e[_0xb58f('0x1c')]?_0x38540e[_0xb58f('0x1c')][_0xb58f('0x1e')]||null:null,'attributes':_0x38540e[_0xb58f('0x1c')]?_0x38540e[_0xb58f('0x1c')]['attributes']||null:null,'limit':_0x38540e[_0xb58f('0x1c')]?_0x38540e[_0xb58f('0x1c')][_0xb58f('0x1f')]||null:null,'include':_0x38540e[_0xb58f('0x1c')]?_0x38540e[_0xb58f('0x1c')]['include']?_[_0xb58f('0x20')](_0x38540e[_0xb58f('0x1c')][_0xb58f('0x21')],function(_0x1d323a){return{'model':db[_0x1d323a[_0xb58f('0x22')]],'as':_0x1d323a['as'],'attributes':_0x1d323a['attributes'],'include':_0x1d323a[_0xb58f('0x21')]?_[_0xb58f('0x20')](_0x1d323a[_0xb58f('0x21')],function(_0x3578fd){return{'model':db[_0x3578fd['model']],'as':_0x3578fd['as'],'attributes':_0x3578fd[_0xb58f('0x23')],'include':_0x3578fd[_0xb58f('0x21')]?_[_0xb58f('0x20')](_0x3578fd['include'],function(_0x5d1f13){return{'model':db[_0x5d1f13[_0xb58f('0x22')]],'as':_0x5d1f13['as'],'attributes':_0x5d1f13[_0xb58f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f552d){logger['info']('GetSmsQueue',_0x38540e);logger[_0xb58f('0x13')](_0xb58f('0x1a'),_0x38540e,JSON[_0xb58f('0x15')](_0x1f552d));_0x30965e(_0x1f552d);})[_0xb58f('0x19')](function(_0x8aae3f){logger['error'](_0xb58f('0x1a'),_0x8aae3f[_0xb58f('0x17')],_0x38540e);_0x19c3a3(_0x7f64ef[_0xb58f('0x16')](0x1f4,_0x8aae3f[_0xb58f('0x17')]));});});};exports[_0xb58f('0x24')]=function(_0x423778){var _0x453d4c=this;return new Promise(function(_0x1bc046,_0x26b949){return db[_0xb58f('0x25')][_0xb58f('0x26')]({'raw':_0x423778[_0xb58f('0x1c')]?_0x423778[_0xb58f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x423778[_0xb58f('0x1c')]?_0x423778[_0xb58f('0x1c')][_0xb58f('0x1e')]||null:null,'attributes':_0x423778['options']?_0x423778[_0xb58f('0x1c')]['attributes']||null:null,'include':_0x423778['options']?_0x423778['options'][_0xb58f('0x21')]?_[_0xb58f('0x20')](_0x423778[_0xb58f('0x1c')][_0xb58f('0x21')],function(_0x5319c3){return{'model':db[_0x5319c3['model']],'as':_0x5319c3['as'],'attributes':_0x5319c3[_0xb58f('0x23')],'include':_0x5319c3[_0xb58f('0x21')]?_[_0xb58f('0x20')](_0x5319c3[_0xb58f('0x21')],function(_0x1397d0){return{'model':db[_0x1397d0[_0xb58f('0x22')]],'as':_0x1397d0['as'],'attributes':_0x1397d0['attributes'],'include':_0x1397d0['include']?_[_0xb58f('0x20')](_0x1397d0['include'],function(_0xa29866){return{'model':db[_0xa29866[_0xb58f('0x22')]],'as':_0xa29866['as'],'attributes':_0xa29866['attributes']};}):[]};}):[]};}):[]:[]})[_0xb58f('0x10')](function(_0x1f6b72){logger[_0xb58f('0x27')](_0xb58f('0x24'),_0x423778);logger['debug'](_0xb58f('0x24'),_0x423778,JSON[_0xb58f('0x15')](_0x1f6b72));_0x1bc046(_0x1f6b72);})[_0xb58f('0x19')](function(_0x47fd7a){logger[_0xb58f('0x16')](_0xb58f('0x24'),_0x47fd7a[_0xb58f('0x17')],_0x423778);_0x26b949(_0x453d4c[_0xb58f('0x16')](0x1f4,_0x47fd7a['message']));});});}; \ No newline at end of file +var _0x4b56=['code','message','info','result','catch','SmsQueue','findAll','options','raw','where','attributes','include','map','model','GetSmsQueue','find','lodash','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x4b56,0x19c));var _0x64b5=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x4b56[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x64b5('0x0'));var util=require('util');var moment=require(_0x64b5('0x1'));var BPromise=require(_0x64b5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64b5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x64b5('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64b5('0x5'));var client=jayson[_0x64b5('0x6')]['http']({'port':0x232a});config[_0x64b5('0x7')]=_[_0x64b5('0x8')](config[_0x64b5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x64b5('0x9'))(new Redis(config['redis']));require(_0x64b5('0xa'))[_0x64b5('0xb')](socket);function respondWithRpcPromise(_0x3a7e21,_0x550d3a,_0x5a900e){return new BPromise(function(_0x4ca2d6,_0x4fd6ad){return client[_0x64b5('0xc')](_0x3a7e21,_0x5a900e)[_0x64b5('0xd')](function(_0x538ab1){logger['info'](_0x64b5('0xe'),_0x550d3a,_0x64b5('0xf'));logger[_0x64b5('0x10')](_0x64b5('0x11'),_0x550d3a,_0x64b5('0xf'),JSON[_0x64b5('0x12')](_0x538ab1));if(_0x538ab1[_0x64b5('0x13')]){if(_0x538ab1[_0x64b5('0x13')][_0x64b5('0x14')]===0x1f4){logger[_0x64b5('0x13')]('SmsQueue,\x20%s,\x20%s',_0x550d3a,_0x538ab1[_0x64b5('0x13')][_0x64b5('0x15')]);return _0x4fd6ad(_0x538ab1[_0x64b5('0x13')][_0x64b5('0x15')]);}logger['error'](_0x64b5('0xe'),_0x550d3a,_0x538ab1[_0x64b5('0x13')][_0x64b5('0x15')]);return _0x4ca2d6(_0x538ab1[_0x64b5('0x13')][_0x64b5('0x15')]);}else{logger[_0x64b5('0x16')](_0x64b5('0xe'),_0x550d3a,_0x64b5('0xf'));_0x4ca2d6(_0x538ab1[_0x64b5('0x17')][_0x64b5('0x15')]);}})[_0x64b5('0x18')](function(_0x65185a){logger[_0x64b5('0x13')]('SmsQueue,\x20%s,\x20%s',_0x550d3a,_0x65185a);_0x4fd6ad(_0x65185a);});});}exports['GetSmsQueue']=function(_0x15b8fe){var _0x1e9cda=this;return new Promise(function(_0x233169,_0x2361ed){return db[_0x64b5('0x19')][_0x64b5('0x1a')]({'raw':_0x15b8fe['options']?_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1c')]===undefined?!![]:![]:!![],'where':_0x15b8fe['options']?_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1d')]||null:null,'attributes':_0x15b8fe[_0x64b5('0x1b')]?_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1e')]||null:null,'limit':_0x15b8fe[_0x64b5('0x1b')]?_0x15b8fe['options']['limit']||null:null,'include':_0x15b8fe[_0x64b5('0x1b')]?_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1f')]?_[_0x64b5('0x20')](_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1f')],function(_0x3878e2){return{'model':db[_0x3878e2[_0x64b5('0x21')]],'as':_0x3878e2['as'],'attributes':_0x3878e2[_0x64b5('0x1e')],'include':_0x3878e2[_0x64b5('0x1f')]?_[_0x64b5('0x20')](_0x3878e2['include'],function(_0x14f162){return{'model':db[_0x14f162[_0x64b5('0x21')]],'as':_0x14f162['as'],'attributes':_0x14f162[_0x64b5('0x1e')],'include':_0x14f162[_0x64b5('0x1f')]?_[_0x64b5('0x20')](_0x14f162[_0x64b5('0x1f')],function(_0x1b2bd8){return{'model':db[_0x1b2bd8[_0x64b5('0x21')]],'as':_0x1b2bd8['as'],'attributes':_0x1b2bd8[_0x64b5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47608e){logger[_0x64b5('0x16')](_0x64b5('0x22'),_0x15b8fe);logger['debug']('GetSmsQueue',_0x15b8fe,JSON['stringify'](_0x47608e));_0x233169(_0x47608e);})[_0x64b5('0x18')](function(_0x3c9470){logger['error'](_0x64b5('0x22'),_0x3c9470[_0x64b5('0x15')],_0x15b8fe);_0x2361ed(_0x1e9cda[_0x64b5('0x13')](0x1f4,_0x3c9470['message']));});});};exports['ShowSmsQueue']=function(_0x2f490d){var _0x2885d8=this;return new Promise(function(_0x424db6,_0xc63aeb){return db[_0x64b5('0x19')][_0x64b5('0x23')]({'raw':_0x2f490d[_0x64b5('0x1b')]?_0x2f490d['options'][_0x64b5('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f490d['options']?_0x2f490d['options'][_0x64b5('0x1d')]||null:null,'attributes':_0x2f490d[_0x64b5('0x1b')]?_0x2f490d['options'][_0x64b5('0x1e')]||null:null,'include':_0x2f490d['options']?_0x2f490d[_0x64b5('0x1b')][_0x64b5('0x1f')]?_['map'](_0x2f490d[_0x64b5('0x1b')][_0x64b5('0x1f')],function(_0x3c8529){return{'model':db[_0x3c8529['model']],'as':_0x3c8529['as'],'attributes':_0x3c8529['attributes'],'include':_0x3c8529['include']?_['map'](_0x3c8529[_0x64b5('0x1f')],function(_0x1e0b62){return{'model':db[_0x1e0b62[_0x64b5('0x21')]],'as':_0x1e0b62['as'],'attributes':_0x1e0b62[_0x64b5('0x1e')],'include':_0x1e0b62['include']?_[_0x64b5('0x20')](_0x1e0b62[_0x64b5('0x1f')],function(_0x58bb14){return{'model':db[_0x58bb14[_0x64b5('0x21')]],'as':_0x58bb14['as'],'attributes':_0x58bb14['attributes']};}):[]};}):[]};}):[]:[]})[_0x64b5('0xd')](function(_0x404704){logger[_0x64b5('0x16')]('ShowSmsQueue',_0x2f490d);logger[_0x64b5('0x10')]('ShowSmsQueue',_0x2f490d,JSON[_0x64b5('0x12')](_0x404704));_0x424db6(_0x404704);})[_0x64b5('0x18')](function(_0xebab1){logger[_0x64b5('0x13')]('ShowSmsQueue',_0xebab1[_0x64b5('0x15')],_0x2f490d);_0xc63aeb(_0x2885d8[_0x64b5('0x13')](0x1f4,_0xebab1[_0x64b5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index bbf686a..e299c37 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 _0xc318=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x4bf78e,_0x5b7a3b){var _0x495abb=function(_0x3f7e46){while(--_0x3f7e46){_0x4bf78e['push'](_0x4bf78e['shift']());}};_0x495abb(++_0x5b7a3b);}(_0xc318,0x104));var _0x8c31=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc318[_0x6c993a];return _0x27f547;};'use strict';var SmsQueueEvents=require(_0x8c31('0x0'));var events=[_0x8c31('0x1'),_0x8c31('0x2'),_0x8c31('0x3')];function createListener(_0x2dcf1d,_0x133264){return function(_0x529f5d){_0x133264['emit'](_0x2dcf1d,_0x529f5d);};}function removeListener(_0xbac655,_0x1042d2){return function(){SmsQueueEvents[_0x8c31('0x4')](_0xbac655,_0x1042d2);};}exports[_0x8c31('0x5')]=function(_0x1c5df5){for(var _0x104c2b=0x0,_0x1e184d=events[_0x8c31('0x6')];_0x104c2b<_0x1e184d;_0x104c2b++){var _0x4d18e1=events[_0x104c2b];var _0xb91a20=createListener(_0x8c31('0x7')+_0x4d18e1,_0x1c5df5);SmsQueueEvents['on'](_0x4d18e1,_0xb91a20);}}; \ No newline at end of file +var _0xe248=['./smsQueue.events','save','remove','update','emit','removeListener','register','length','smsQueue:'];(function(_0x22dd2b,_0x3b116a){var _0x2c816c=function(_0x4f2765){while(--_0x4f2765){_0x22dd2b['push'](_0x22dd2b['shift']());}};_0x2c816c(++_0x3b116a);}(_0xe248,0x1b0));var _0x8e24=function(_0x138eb3,_0x13396c){_0x138eb3=_0x138eb3-0x0;var _0x5706f9=_0xe248[_0x138eb3];return _0x5706f9;};'use strict';var SmsQueueEvents=require(_0x8e24('0x0'));var events=[_0x8e24('0x1'),_0x8e24('0x2'),_0x8e24('0x3')];function createListener(_0x3f23cc,_0x2a7b6b){return function(_0x2c4912){_0x2a7b6b[_0x8e24('0x4')](_0x3f23cc,_0x2c4912);};}function removeListener(_0x2229f2,_0x598451){return function(){SmsQueueEvents[_0x8e24('0x5')](_0x2229f2,_0x598451);};}exports[_0x8e24('0x6')]=function(_0xc43139){for(var _0x4c7da1=0x0,_0x54cd04=events[_0x8e24('0x7')];_0x4c7da1<_0x54cd04;_0x4c7da1++){var _0x466313=events[_0x4c7da1];var _0x1081b1=createListener(_0x8e24('0x8')+_0x466313,_0xc43139);SmsQueueEvents['on'](_0x466313,_0x1081b1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f1e9f51..9b14a2b 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 _0x0737=['destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete'];(function(_0x40f194,_0x1fe87c){var _0x350349=function(_0x43f95c){while(--_0x43f95c){_0x40f194['push'](_0x40f194['shift']());}};_0x350349(++_0x1fe87c);}(_0x0737,0xa3));var _0x7073=function(_0xcd9190,_0x46a9af){_0xcd9190=_0xcd9190-0x0;var _0xdd4bee=_0x0737[_0xcd9190];return _0xdd4bee;};'use strict';var multer=require(_0x7073('0x0'));var util=require(_0x7073('0x1'));var path=require('path');var timeout=require(_0x7073('0x2'));var express=require(_0x7073('0x3'));var router=express['Router']();var auth=require(_0x7073('0x4'));var interaction=require(_0x7073('0x5'));var config=require(_0x7073('0x6'));var controller=require(_0x7073('0x7'));router[_0x7073('0x8')]('/',auth[_0x7073('0x9')](),controller['index']);router[_0x7073('0x8')]('/describe',auth[_0x7073('0x9')](),controller[_0x7073('0xa')]);router['get'](_0x7073('0xb'),auth[_0x7073('0x9')](),controller[_0x7073('0xc')]);router['post']('/',auth[_0x7073('0x9')](),controller[_0x7073('0xd')]);router[_0x7073('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7073('0xf')]);router[_0x7073('0x10')](_0x7073('0xb'),auth[_0x7073('0x9')](),controller[_0x7073('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd246=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x36886d,_0xff9165){var _0x1815b7=function(_0x3ca328){while(--_0x3ca328){_0x36886d['push'](_0x36886d['shift']());}};_0x1815b7(++_0xff9165);}(_0xd246,0x1c1));var _0x6d24=function(_0x1988b0,_0x1fa6a0){_0x1988b0=_0x1988b0-0x0;var _0x1240b2=_0xd246[_0x1988b0];return _0x1240b2;};'use strict';var multer=require(_0x6d24('0x0'));var util=require(_0x6d24('0x1'));var path=require(_0x6d24('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d24('0x3')]();var auth=require(_0x6d24('0x4'));var interaction=require(_0x6d24('0x5'));var config=require(_0x6d24('0x6'));var controller=require('./smsQueueReport.controller');router[_0x6d24('0x7')]('/',auth[_0x6d24('0x8')](),controller[_0x6d24('0x9')]);router[_0x6d24('0x7')]('/describe',auth[_0x6d24('0x8')](),controller[_0x6d24('0xa')]);router[_0x6d24('0x7')](_0x6d24('0xb'),auth[_0x6d24('0x8')](),controller[_0x6d24('0xc')]);router[_0x6d24('0xd')]('/',auth[_0x6d24('0x8')](),controller[_0x6d24('0xe')]);router['put']('/:id',auth[_0x6d24('0x8')](),controller['update']);router[_0x6d24('0xf')](_0x6d24('0xb'),auth[_0x6d24('0x8')](),controller[_0x6d24('0x10')]);module[_0x6d24('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a64d5aa..9710ec0 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 _0x4871=['exports','STRING','DATE','moment','sequelize'];(function(_0x32be62,_0x22e6fd){var _0x1a37e9=function(_0x35a9c1){while(--_0x35a9c1){_0x32be62['push'](_0x32be62['shift']());}};_0x1a37e9(++_0x22e6fd);}(_0x4871,0x14d));var _0x1487=function(_0x1560bd,_0x3318fd){_0x1560bd=_0x1560bd-0x0;var _0x1ef369=_0x4871[_0x1560bd];return _0x1ef369;};'use strict';var moment=require(_0x1487('0x0'));var Sequelize=require(_0x1487('0x1'));module[_0x1487('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1487('0x3')]},'joinAt':{'type':Sequelize[_0x1487('0x4')]},'leaveAt':{'type':Sequelize[_0x1487('0x4')]},'acceptAt':{'type':Sequelize[_0x1487('0x4')]},'exitAt':{'type':Sequelize[_0x1487('0x4')]},'reason':{'type':Sequelize[_0x1487('0x3')]}}; \ No newline at end of file +var _0x2aed=['DATE','moment','exports','STRING'];(function(_0x18d4b2,_0x3060ea){var _0xa5aca1=function(_0x458c68){while(--_0x458c68){_0x18d4b2['push'](_0x18d4b2['shift']());}};_0xa5aca1(++_0x3060ea);}(_0x2aed,0x8d));var _0xd2ae=function(_0x28a84a,_0x366493){_0x28a84a=_0x28a84a-0x0;var _0x2bfb0c=_0x2aed[_0x28a84a];return _0x2bfb0c;};'use strict';var moment=require(_0xd2ae('0x0'));var Sequelize=require('sequelize');module[_0xd2ae('0x1')]={'uniqueid':{'type':Sequelize[_0xd2ae('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd2ae('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd2ae('0x3')]},'acceptAt':{'type':Sequelize[_0xd2ae('0x3')]},'exitAt':{'type':Sequelize[_0xd2ae('0x3')]},'reason':{'type':Sequelize[_0xd2ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 477bd20..96ea334 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x19dd8a,_0x4af545){var _0x6245d3=function(_0x16e70b){while(--_0x16e70b){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x6245d3(++_0x4af545);}(_0x814b,0x1a2));var _0xb814=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x814b[_0x1af5b2];return _0xf1aa2d;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0x3e74=['save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','count','offset','status','set','Content-Range','json','apply','reject'];(function(_0x627e34,_0x55ec3c){var _0x4c1e75=function(_0x565768){while(--_0x565768){_0x627e34['push'](_0x627e34['shift']());}};_0x4c1e75(++_0x55ec3c);}(_0x3e74,0x175));var _0x43e7=function(_0x37e680,_0x218c18){_0x37e680=_0x37e680-0x0;var _0x4ea103=_0x3e74[_0x37e680];return _0x4ea103;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb206,_0xc960ea){_0xc960ea=_0xc960ea||0xcc;return function(_0x2718d3){if(_0x2718d3){return _0x3eb206[_0x43e7('0x14')](_0xc960ea);}return _0x3eb206['status'](_0xc960ea)['end']();};}function respondWithResult(_0x2fcb36,_0x21fdd3){_0x21fdd3=_0x21fdd3||0xc8;return function(_0x44b0bd){if(_0x44b0bd){return _0x2fcb36['status'](_0x21fdd3)['json'](_0x44b0bd);}};}function respondWithFilteredResult(_0x16849c,_0x14c146){return function(_0x203378){if(_0x203378){var _0x328445=_0x203378[_0x43e7('0x15')],_0x4de324=_0x14c146[_0x43e7('0x16')],_0x5c4eaa=_0x14c146['offset']+_0x14c146['limit'],_0xdf16c;if(_0x5c4eaa>=_0x328445){_0x5c4eaa=_0x328445;_0xdf16c=0xc8;}else{_0xdf16c=0xce;}_0x16849c[_0x43e7('0x17')](_0xdf16c);return _0x16849c[_0x43e7('0x18')](_0x43e7('0x19'),_0x4de324+'-'+_0x5c4eaa+'/'+_0x328445)[_0x43e7('0x1a')](_0x203378);}return null;};}function patchUpdates(_0x3776f5){return function(_0x1f24fb){try{jsonpatch[_0x43e7('0x1b')](_0x1f24fb,_0x3776f5,!![]);}catch(_0x1441ef){return BPromise[_0x43e7('0x1c')](_0x1441ef);}return _0x1f24fb[_0x43e7('0x1d')]();};}function saveUpdates(_0x191dd5,_0x177ee1){return function(_0x4b5d64){if(_0x4b5d64){return _0x4b5d64[_0x43e7('0x1e')](_0x191dd5)[_0x43e7('0x1f')](function(_0x4b386b){return _0x4b386b;});}return null;};}function removeEntity(_0x2898b5,_0x3e281e){return function(_0x3945bb){if(_0x3945bb){return _0x3945bb[_0x43e7('0x20')]()[_0x43e7('0x1f')](function(){_0x2898b5[_0x43e7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454359,_0x4eea52){return function(_0x4c9df3){if(!_0x4c9df3){_0x454359[_0x43e7('0x14')](0x194);}return _0x4c9df3;};}function handleError(_0x43f4ff,_0x4b2b9f){_0x4b2b9f=_0x4b2b9f||0x1f4;return function(_0x1f0673){logger['error'](_0x1f0673[_0x43e7('0x21')]);if(_0x1f0673['name']){delete _0x1f0673[_0x43e7('0x22')];}_0x43f4ff[_0x43e7('0x17')](_0x4b2b9f)[_0x43e7('0x23')](_0x1f0673);};}exports[_0x43e7('0x24')]=function(_0x51f4d7,_0x52b7b3){var _0x805b54={},_0x501551={},_0x2dd5f={'count':0x0,'rows':[]};var _0x40dc8f=_[_0x43e7('0x25')](db[_0x43e7('0x26')]['rawAttributes'],function(_0x33a1a5){return{'name':_0x33a1a5[_0x43e7('0x27')],'type':_0x33a1a5[_0x43e7('0x28')][_0x43e7('0x29')]};});_0x501551[_0x43e7('0x2a')]=_[_0x43e7('0x25')](_0x40dc8f,_0x43e7('0x22'));_0x501551[_0x43e7('0x2b')]=_[_0x43e7('0x2c')](_0x51f4d7[_0x43e7('0x2b')]);_0x501551[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],_0x501551[_0x43e7('0x2b')]);_0x805b54['attributes']=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x2f')]));_0x805b54['attributes']=_0x805b54[_0x43e7('0x30')][_0x43e7('0x31')]?_0x805b54[_0x43e7('0x30')]:_0x501551[_0x43e7('0x2a')];if(!_0x51f4d7['query']['hasOwnProperty']('nolimit')){_0x805b54[_0x43e7('0x32')]=qs[_0x43e7('0x32')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x32')]);_0x805b54[_0x43e7('0x16')]=qs[_0x43e7('0x16')](_0x51f4d7['query']['offset']);}_0x805b54['order']=qs['sort'](_0x51f4d7['query']['sort']);_0x805b54['where']=qs[_0x43e7('0x2d')](_['pick'](_0x51f4d7[_0x43e7('0x2b')],_0x501551[_0x43e7('0x2d')]),_0x40dc8f);if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]){_0x805b54[_0x43e7('0x34')]=_[_0x43e7('0x35')](_0x805b54[_0x43e7('0x34')],{'$or':_['map'](_0x40dc8f,function(_0x5332d9){if(_0x5332d9['type']!==_0x43e7('0x36')){var _0xfe70e9={};_0xfe70e9[_0x5332d9[_0x43e7('0x22')]]={'$like':'%'+_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]+'%'};return _0xfe70e9;}})});}_0x805b54=_[_0x43e7('0x35')]({},_0x805b54,_0x51f4d7[_0x43e7('0x37')]);var _0x2ffd43={'where':_0x805b54['where']};return db[_0x43e7('0x26')][_0x43e7('0x15')](_0x2ffd43)['then'](function(_0x2d54c1){_0x2dd5f['count']=_0x2d54c1;if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x38')]){_0x805b54[_0x43e7('0x39')]=[{'all':!![]}];}return db[_0x43e7('0x26')][_0x43e7('0x3a')](_0x805b54);})[_0x43e7('0x1f')](function(_0x5e731b){_0x2dd5f['rows']=_0x5e731b;return _0x2dd5f;})[_0x43e7('0x1f')](respondWithFilteredResult(_0x52b7b3,_0x805b54))[_0x43e7('0x3b')](handleError(_0x52b7b3,null));};exports[_0x43e7('0x3c')]=function(_0xc8ffa5,_0x127d77){var _0x4a4a85={'raw':!![],'where':{'id':_0xc8ffa5[_0x43e7('0x3d')]['id']}},_0x32a451={};_0x32a451['model']=_[_0x43e7('0x2c')](db['SmsQueueReport'][_0x43e7('0x3e')]);_0x32a451['query']=_[_0x43e7('0x2c')](_0xc8ffa5[_0x43e7('0x2b')]);_0x32a451[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x32a451['model'],_0x32a451['query']);_0x4a4a85[_0x43e7('0x30')]=_[_0x43e7('0x2e')](_0x32a451[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0xc8ffa5['query']['fields']));_0x4a4a85['attributes']=_0x4a4a85[_0x43e7('0x30')]['length']?_0x4a4a85[_0x43e7('0x30')]:_0x32a451['model'];if(_0xc8ffa5['query'][_0x43e7('0x38')]){_0x4a4a85['include']=[{'all':!![]}];}_0x4a4a85=_[_0x43e7('0x35')]({},_0x4a4a85,_0xc8ffa5[_0x43e7('0x37')]);return db[_0x43e7('0x26')][_0x43e7('0x3f')](_0x4a4a85)['then'](handleEntityNotFound(_0x127d77,null))[_0x43e7('0x1f')](respondWithResult(_0x127d77,null))[_0x43e7('0x3b')](handleError(_0x127d77,null));};exports[_0x43e7('0x40')]=function(_0x1fd277,_0x296dc8){return db[_0x43e7('0x26')]['create'](_0x1fd277['body'],{})[_0x43e7('0x1f')](respondWithResult(_0x296dc8,0xc9))[_0x43e7('0x3b')](handleError(_0x296dc8,null));};exports[_0x43e7('0x1e')]=function(_0x4c00a8,_0x5c1c18){if(_0x4c00a8['body']['id']){delete _0x4c00a8[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x26')]['find']({'where':{'id':_0x4c00a8[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x5c1c18,null))[_0x43e7('0x1f')](saveUpdates(_0x4c00a8['body'],null))['then'](respondWithResult(_0x5c1c18,null))['catch'](handleError(_0x5c1c18,null));};exports['destroy']=function(_0x214e7e,_0xe955fc){return db['SmsQueueReport'][_0x43e7('0x3f')]({'where':{'id':_0x214e7e[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x1f')](removeEntity(_0xe955fc,null))['catch'](handleError(_0xe955fc,null));};exports[_0x43e7('0x42')]=function(_0x483f20,_0x4bebd4){return db[_0x43e7('0x26')][_0x43e7('0x42')]()[_0x43e7('0x1f')](respondWithResult(_0x4bebd4,null))[_0x43e7('0x3b')](handleError(_0x4bebd4,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 0ad5a45..09d531a 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 _0x4a44=['request-promise','path','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','api','moment','bluebird'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x4a44,0xf8));var _0x44a4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4a44[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x44a4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x44a4('0x1'));var moment=require(_0x44a4('0x2'));var BPromise=require(_0x44a4('0x3'));var rp=require(_0x44a4('0x4'));var fs=require('fs');var path=require(_0x44a4('0x5'));var rimraf=require('rimraf');var config=require(_0x44a4('0x6'));var attributes=require(_0x44a4('0x7'));module['exports']=function(_0x55c537,_0x5a2c3d){return _0x55c537[_0x44a4('0x8')](_0x44a4('0x9'),attributes,{'tableName':_0x44a4('0xa'),'paranoid':![],'indexes':[{'name':_0x44a4('0xb'),'fields':[_0x44a4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8dd2=['path','rimraf','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0xf16650,_0x13397f){var _0x1b1abb=function(_0x1a4ab4){while(--_0x1a4ab4){_0xf16650['push'](_0xf16650['shift']());}};_0x1b1abb(++_0x13397f);}(_0x8dd2,0x15a));var _0x28dd=function(_0x285d29,_0x52c639){_0x285d29=_0x285d29-0x0;var _0x202256=_0x8dd2[_0x285d29];return _0x202256;};'use strict';var _=require(_0x28dd('0x0'));var util=require('util');var logger=require(_0x28dd('0x1'))(_0x28dd('0x2'));var moment=require(_0x28dd('0x3'));var BPromise=require(_0x28dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x28dd('0x5'));var rimraf=require(_0x28dd('0x6'));var config=require('../../config/environment');var attributes=require(_0x28dd('0x7'));module[_0x28dd('0x8')]=function(_0x57db5c,_0x3a024b){return _0x57db5c[_0x28dd('0x9')](_0x28dd('0xa'),attributes,{'tableName':_0x28dd('0xb'),'paranoid':![],'indexes':[{'name':_0x28dd('0xc'),'fields':[_0x28dd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 8fbb2f7..223e6bf 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 _0x7828=['SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','debug','UpdateSmsQueueReport','update','body','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x18d1ce,_0x2cf546){var _0x473ea5=function(_0x2d1bea){while(--_0x2d1bea){_0x18d1ce['push'](_0x18d1ce['shift']());}};_0x473ea5(++_0x2cf546);}(_0x7828,0x15e));var _0x8782=function(_0x438525,_0x16ea09){_0x438525=_0x438525-0x0;var _0x288a50=_0x7828[_0x438525];return _0x288a50;};'use strict';var _=require('lodash');var util=require(_0x8782('0x0'));var moment=require(_0x8782('0x1'));var BPromise=require(_0x8782('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8782('0x3'));var db=require(_0x8782('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8782('0x5'))('rpc');var config=require(_0x8782('0x6'));var jayson=require(_0x8782('0x7'));var client=jayson[_0x8782('0x8')][_0x8782('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x479bd6,_0xc1fae6,_0x927a27){return new BPromise(function(_0x502bf7,_0x28b272){return client[_0x8782('0xa')](_0x479bd6,_0x927a27)[_0x8782('0xb')](function(_0x4f4824){logger[_0x8782('0xc')](_0x8782('0xd'),_0xc1fae6,_0x8782('0xe'));logger['debug'](_0x8782('0xf'),_0xc1fae6,'request\x20sent',JSON[_0x8782('0x10')](_0x4f4824));if(_0x4f4824[_0x8782('0x11')]){if(_0x4f4824['error']['code']===0x1f4){logger[_0x8782('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0xc1fae6,_0x4f4824[_0x8782('0x11')][_0x8782('0x12')]);return _0x28b272(_0x4f4824[_0x8782('0x11')]['message']);}logger[_0x8782('0x11')](_0x8782('0xd'),_0xc1fae6,_0x4f4824[_0x8782('0x11')][_0x8782('0x12')]);return _0x502bf7(_0x4f4824[_0x8782('0x11')][_0x8782('0x12')]);}else{logger[_0x8782('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0xc1fae6,_0x8782('0xe'));_0x502bf7(_0x4f4824[_0x8782('0x13')]['message']);}})[_0x8782('0x14')](function(_0x588d1b){logger[_0x8782('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0xc1fae6,_0x588d1b);_0x28b272(_0x588d1b);});});}exports[_0x8782('0x15')]=function(_0x46d426){var _0x19e1e6=this;return new Promise(function(_0x5e249f,_0x8a5266){return db[_0x8782('0x16')][_0x8782('0x17')](_0x46d426['body'],{'raw':_0x46d426[_0x8782('0x18')]?_0x46d426[_0x8782('0x18')][_0x8782('0x19')]===undefined?!![]:![]:!![]})[_0x8782('0xb')](function(_0x43e36f){logger['info'](_0x8782('0x15'),_0x46d426);logger[_0x8782('0x1a')](_0x8782('0x15'),_0x46d426,JSON['stringify'](_0x43e36f));_0x5e249f(_0x43e36f);})[_0x8782('0x14')](function(_0x5b4d53){logger[_0x8782('0x11')](_0x8782('0x15'),_0x5b4d53[_0x8782('0x12')],_0x46d426);_0x8a5266(_0x19e1e6[_0x8782('0x11')](0x1f4,_0x5b4d53[_0x8782('0x12')]));});});};exports[_0x8782('0x1b')]=function(_0x5a4aaa){var _0x593bc3=this;return new Promise(function(_0x2efcac,_0x36fdd9){return db['SmsQueueReport'][_0x8782('0x1c')](_0x5a4aaa[_0x8782('0x1d')],{'raw':_0x5a4aaa['options']?_0x5a4aaa[_0x8782('0x18')][_0x8782('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a4aaa['options']?_0x5a4aaa[_0x8782('0x18')][_0x8782('0x1e')]||null:null,'attributes':_0x5a4aaa[_0x8782('0x18')]?_0x5a4aaa['options'][_0x8782('0x1f')]||null:null,'limit':_0x5a4aaa[_0x8782('0x18')]?_0x5a4aaa[_0x8782('0x18')][_0x8782('0x20')]||null:null})['then'](function(_0xef3660){logger[_0x8782('0xc')](_0x8782('0x1b'),_0x5a4aaa);logger['debug'](_0x8782('0x1b'),_0x5a4aaa,JSON[_0x8782('0x10')](_0xef3660));_0x2efcac(_0xef3660);})[_0x8782('0x14')](function(_0x49fb36){logger[_0x8782('0x11')]('UpdateSmsQueueReport',_0x49fb36[_0x8782('0x12')],_0x5a4aaa);_0x36fdd9(_0x593bc3['error'](0x1f4,_0x49fb36[_0x8782('0x12')]));});});}; \ No newline at end of file +var _0xeae1=['randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','where','limit','UpdateSmsQueueReport','util','bluebird'];(function(_0x37cebe,_0x5be2e4){var _0x3275e9=function(_0x3bced2){while(--_0x3bced2){_0x37cebe['push'](_0x37cebe['shift']());}};_0x3275e9(++_0x5be2e4);}(_0xeae1,0x1de));var _0x1eae=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xeae1[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var util=require(_0x1eae('0x0'));var moment=require('moment');var BPromise=require(_0x1eae('0x1'));var rs=require(_0x1eae('0x2'));var fs=require('fs');var Redis=require(_0x1eae('0x3'));var db=require(_0x1eae('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1eae('0x5'));var config=require('../../config/environment');var jayson=require(_0x1eae('0x6'));var client=jayson[_0x1eae('0x7')][_0x1eae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x387af2,_0x3e68f6,_0x4cb523){return new BPromise(function(_0x4d35ad,_0x440bbe){return client[_0x1eae('0x9')](_0x387af2,_0x4cb523)[_0x1eae('0xa')](function(_0x4c532f){logger['info'](_0x1eae('0xb'),_0x3e68f6,_0x1eae('0xc'));logger[_0x1eae('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3e68f6,'request\x20sent',JSON[_0x1eae('0xe')](_0x4c532f));if(_0x4c532f[_0x1eae('0xf')]){if(_0x4c532f[_0x1eae('0xf')][_0x1eae('0x10')]===0x1f4){logger[_0x1eae('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x3e68f6,_0x4c532f[_0x1eae('0xf')][_0x1eae('0x11')]);return _0x440bbe(_0x4c532f[_0x1eae('0xf')][_0x1eae('0x11')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3e68f6,_0x4c532f[_0x1eae('0xf')]['message']);return _0x4d35ad(_0x4c532f[_0x1eae('0xf')][_0x1eae('0x11')]);}else{logger[_0x1eae('0x12')](_0x1eae('0xb'),_0x3e68f6,'request\x20sent');_0x4d35ad(_0x4c532f[_0x1eae('0x13')]['message']);}})[_0x1eae('0x14')](function(_0x4dc02c){logger[_0x1eae('0xf')](_0x1eae('0xb'),_0x3e68f6,_0x4dc02c);_0x440bbe(_0x4dc02c);});});}exports[_0x1eae('0x15')]=function(_0x190736){var _0x4b6c31=this;return new Promise(function(_0x564295,_0x4cfcb1){return db[_0x1eae('0x16')][_0x1eae('0x17')](_0x190736[_0x1eae('0x18')],{'raw':_0x190736['options']?_0x190736[_0x1eae('0x19')][_0x1eae('0x1a')]===undefined?!![]:![]:!![]})[_0x1eae('0xa')](function(_0x432cc6){logger[_0x1eae('0x12')]('CreateSmsQueueReport',_0x190736);logger[_0x1eae('0xd')](_0x1eae('0x15'),_0x190736,JSON['stringify'](_0x432cc6));_0x564295(_0x432cc6);})[_0x1eae('0x14')](function(_0x2d52b0){logger[_0x1eae('0xf')](_0x1eae('0x15'),_0x2d52b0[_0x1eae('0x11')],_0x190736);_0x4cfcb1(_0x4b6c31[_0x1eae('0xf')](0x1f4,_0x2d52b0['message']));});});};exports['UpdateSmsQueueReport']=function(_0x3b2e2e){var _0x4cc4ae=this;return new Promise(function(_0xe446e8,_0x1d190c){return db[_0x1eae('0x16')]['update'](_0x3b2e2e[_0x1eae('0x18')],{'raw':_0x3b2e2e[_0x1eae('0x19')]?_0x3b2e2e['options'][_0x1eae('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b2e2e['options']?_0x3b2e2e[_0x1eae('0x19')][_0x1eae('0x1b')]||null:null,'attributes':_0x3b2e2e[_0x1eae('0x19')]?_0x3b2e2e[_0x1eae('0x19')]['attributes']||null:null,'limit':_0x3b2e2e['options']?_0x3b2e2e['options'][_0x1eae('0x1c')]||null:null})[_0x1eae('0xa')](function(_0x3dff7b){logger[_0x1eae('0x12')](_0x1eae('0x1d'),_0x3b2e2e);logger[_0x1eae('0xd')]('UpdateSmsQueueReport',_0x3b2e2e,JSON[_0x1eae('0xe')](_0x3dff7b));_0xe446e8(_0x3dff7b);})['catch'](function(_0x507c66){logger['error'](_0x1eae('0x1d'),_0x507c66[_0x1eae('0x11')],_0x3b2e2e);_0x1d190c(_0x4cc4ae[_0x1eae('0xf')](0x1f4,_0x507c66[_0x1eae('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 4639470..78640f8 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 _0x6324=['util','path','connect-timeout','Router','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x42d285,_0x48dda9){var _0x5c88a6=function(_0x58a3db){while(--_0x58a3db){_0x42d285['push'](_0x42d285['shift']());}};_0x5c88a6(++_0x48dda9);}(_0x6324,0x142));var _0x4632=function(_0x479988,_0x17b763){_0x479988=_0x479988-0x0;var _0x17610c=_0x6324[_0x479988];return _0x17610c;};'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 auth=require('../../components/auth/service');var interaction=require(_0x4632('0x5'));var config=require('../../config/environment');var controller=require(_0x4632('0x6'));router['get']('/',auth[_0x4632('0x7')](),controller[_0x4632('0x8')]);router[_0x4632('0x9')](_0x4632('0xa'),auth['isAuthenticated'](),controller[_0x4632('0xb')]);router[_0x4632('0x9')](_0x4632('0xc'),auth['isAuthenticated'](),controller[_0x4632('0xd')]);router[_0x4632('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4632('0xf')](_0x4632('0xc'),auth[_0x4632('0x7')](),controller[_0x4632('0x10')]);router[_0x4632('0x11')](_0x4632('0xc'),auth[_0x4632('0x7')](),controller[_0x4632('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6e6c=['get','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc6e6('0x4'));var config=require('../../config/environment');var controller=require(_0xc6e6('0x5'));router['get']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x7')]);router['get'](_0xc6e6('0x8'),auth[_0xc6e6('0x6')](),controller['describe']);router[_0xc6e6('0x9')](_0xc6e6('0xa'),auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['post']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0xa'),auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xe')]);router[_0xc6e6('0xf')](_0xc6e6('0xa'),auth[_0xc6e6('0x6')](),controller['destroy']);module[_0xc6e6('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f8003df..1e0fb42 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 _0x32f5=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x1879f6,_0x447434){var _0x455909=function(_0x443507){while(--_0x443507){_0x1879f6['push'](_0x1879f6['shift']());}};_0x455909(++_0x447434);}(_0x32f5,0x130));var _0x532f=function(_0x5b47af,_0x3dc3f2){_0x5b47af=_0x5b47af-0x0;var _0xc50dee=_0x32f5[_0x5b47af];return _0xc50dee;};'use strict';var moment=require('moment');var Sequelize=require(_0x532f('0x0'));module[_0x532f('0x1')]={'uniqueid':{'type':Sequelize[_0x532f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x532f('0x3')]('account',_0x532f('0x4'),'queue'),'allowNull':![],'defaultValue':_0x532f('0x5')},'transferredAt':{'type':Sequelize[_0x532f('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x2895=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0xd77e22,_0x810874){var _0x4aef0f=function(_0x5e8582){while(--_0x5e8582){_0xd77e22['push'](_0xd77e22['shift']());}};_0x4aef0f(++_0x810874);}(_0x2895,0x198));var _0x5289=function(_0x3c16fa,_0x255c10){_0x3c16fa=_0x3c16fa-0x0;var _0x2f329a=_0x2895[_0x3c16fa];return _0x2f329a;};'use strict';var moment=require(_0x5289('0x0'));var Sequelize=require(_0x5289('0x1'));module[_0x5289('0x2')]={'uniqueid':{'type':Sequelize[_0x5289('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5289('0x4')](_0x5289('0x5'),_0x5289('0x6'),_0x5289('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x5289('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x5289('0x9')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4fa1f87..fea1da1 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 _0x70e0=['attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','keys','query','filters'];(function(_0x412c66,_0x1e5067){var _0x2df7cb=function(_0x34f094){while(--_0x34f094){_0x412c66['push'](_0x412c66['shift']());}};_0x2df7cb(++_0x1e5067);}(_0x70e0,0x17b));var _0x070e=function(_0x51878c,_0x54d5d0){_0x51878c=_0x51878c-0x0;var _0x2a9401=_0x70e0[_0x51878c];return _0x2a9401;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));};exports['show']=function(_0x5bd39a,_0x398168){var _0x42c448={'raw':!![],'where':{'id':_0x5bd39a['params']['id']}},_0x38879f={};_0x38879f[_0x070e('0x2b')]=_[_0x070e('0x2c')](db[_0x070e('0x27')][_0x070e('0x28')]);_0x38879f['query']=_[_0x070e('0x2c')](_0x5bd39a['query']);_0x38879f['filters']=_['intersection'](_0x38879f[_0x070e('0x2b')],_0x38879f[_0x070e('0x2d')]);_0x42c448[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x38879f[_0x070e('0x2b')],qs['fields'](_0x5bd39a[_0x070e('0x2d')]['fields']));_0x42c448[_0x070e('0x2f')]=_0x42c448[_0x070e('0x2f')][_0x070e('0x31')]?_0x42c448['attributes']:_0x38879f['model'];if(_0x5bd39a[_0x070e('0x2d')]['includeAll']){_0x42c448[_0x070e('0x41')]=[{'all':!![]}];}_0x42c448=_[_0x070e('0x3a')]({},_0x42c448,_0x5bd39a[_0x070e('0x3b')]);return db['SmsTransferReport'][_0x070e('0x42')](_0x42c448)[_0x070e('0x20')](handleEntityNotFound(_0x398168,null))['then'](respondWithResult(_0x398168,null))['catch'](handleError(_0x398168,null));};exports[_0x070e('0x43')]=function(_0x945901,_0x2d43ce){return db[_0x070e('0x27')][_0x070e('0x43')](_0x945901['body'],{})[_0x070e('0x20')](respondWithResult(_0x2d43ce,0xc9))[_0x070e('0x40')](handleError(_0x2d43ce,null));};exports[_0x070e('0x1f')]=function(_0x391dee,_0x79eaa0){if(_0x391dee[_0x070e('0x44')]['id']){delete _0x391dee[_0x070e('0x44')]['id'];}return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x391dee[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x79eaa0,null))[_0x070e('0x20')](saveUpdates(_0x391dee[_0x070e('0x44')],null))[_0x070e('0x20')](respondWithResult(_0x79eaa0,null))[_0x070e('0x40')](handleError(_0x79eaa0,null));};exports['destroy']=function(_0x171621,_0xa7a41b){return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x171621[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xa7a41b,null))[_0x070e('0x20')](removeEntity(_0xa7a41b,null))[_0x070e('0x40')](handleError(_0xa7a41b,null));};exports[_0x070e('0x46')]=function(_0x5744c5,_0x251696){return db['SmsTransferReport'][_0x070e('0x46')]()[_0x070e('0x20')](respondWithResult(_0x251696,null))['catch'](handleError(_0x251696,null));}; \ No newline at end of file +var _0xa9e0=['merge','options','include','findAll','catch','params','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL'];(function(_0xfeca92,_0x42379b){var _0xdce620=function(_0xf7a8de){while(--_0xf7a8de){_0xfeca92['push'](_0xfeca92['shift']());}};_0xdce620(++_0x42379b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));};exports[_0x0a9e('0x45')]=function(_0x3fe430,_0x4f7240){return db['SmsTransferReport']['describe']()[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,null))[_0x0a9e('0x3f')](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6c4d644..a581088 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 _0x3f54=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f54,0xe4));var _0x43f5=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x3f54[_0x5ce15c];return _0x36e4f5;};'use strict';var _=require(_0x43f5('0x0'));var util=require(_0x43f5('0x1'));var logger=require(_0x43f5('0x2'))(_0x43f5('0x3'));var moment=require(_0x43f5('0x4'));var BPromise=require('bluebird');var rp=require(_0x43f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43f5('0x6'));var config=require(_0x43f5('0x7'));var attributes=require(_0x43f5('0x8'));module[_0x43f5('0x9')]=function(_0x54ba91,_0x1f0ca7){return _0x54ba91[_0x43f5('0xa')]('SmsTransferReport',attributes,{'tableName':_0x43f5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x43f5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa99c=['bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xa99c,0x15a));var _0xca99=function(_0x3949bd,_0x21356c){_0x3949bd=_0x3949bd-0x0;var _0x5003b7=_0xa99c[_0x3949bd];return _0x5003b7;};'use strict';var _=require(_0xca99('0x0'));var util=require(_0xca99('0x1'));var logger=require('../../config/logger')(_0xca99('0x2'));var moment=require(_0xca99('0x3'));var BPromise=require(_0xca99('0x4'));var rp=require(_0xca99('0x5'));var fs=require('fs');var path=require(_0xca99('0x6'));var rimraf=require('rimraf');var config=require(_0xca99('0x7'));var attributes=require(_0xca99('0x8'));module[_0xca99('0x9')]=function(_0x559665,_0x243187){return _0x559665[_0xca99('0xa')](_0xca99('0xb'),attributes,{'tableName':_0xca99('0xc'),'paranoid':![],'indexes':[{'name':_0xca99('0xd'),'fields':[_0xca99('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 036d4eb..9504dfa 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 _0xce7b=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce7b,0xc3));var _0xbce7=function(_0x3532f3,_0x19c533){_0x3532f3=_0x3532f3-0x0;var _0x4e86ac=_0xce7b[_0x3532f3];return _0x4e86ac;};'use strict';var _=require('lodash');var util=require(_0xbce7('0x0'));var moment=require(_0xbce7('0x1'));var BPromise=require(_0xbce7('0x2'));var rs=require(_0xbce7('0x3'));var fs=require('fs');var Redis=require(_0xbce7('0x4'));var db=require(_0xbce7('0x5'))['db'];var utils=require(_0xbce7('0x6'));var logger=require(_0xbce7('0x7'))(_0xbce7('0x8'));var config=require(_0xbce7('0x9'));var jayson=require(_0xbce7('0xa'));var client=jayson[_0xbce7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x182364,_0x356df1,_0x12d511){return new BPromise(function(_0xd4a214,_0x1a42bd){return client[_0xbce7('0xc')](_0x182364,_0x12d511)[_0xbce7('0xd')](function(_0x260eec){logger[_0xbce7('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x356df1,_0xbce7('0xf'));logger['debug'](_0xbce7('0x10'),_0x356df1,_0xbce7('0xf'),JSON[_0xbce7('0x11')](_0x260eec));if(_0x260eec['error']){if(_0x260eec[_0xbce7('0x12')][_0xbce7('0x13')]===0x1f4){logger[_0xbce7('0x12')](_0xbce7('0x14'),_0x356df1,_0x260eec['error'][_0xbce7('0x15')]);return _0x1a42bd(_0x260eec[_0xbce7('0x12')][_0xbce7('0x15')]);}logger['error'](_0xbce7('0x14'),_0x356df1,_0x260eec['error'][_0xbce7('0x15')]);return _0xd4a214(_0x260eec[_0xbce7('0x12')][_0xbce7('0x15')]);}else{logger[_0xbce7('0xe')](_0xbce7('0x14'),_0x356df1,_0xbce7('0xf'));_0xd4a214(_0x260eec[_0xbce7('0x16')][_0xbce7('0x15')]);}})[_0xbce7('0x17')](function(_0x1b7014){logger[_0xbce7('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x356df1,_0x1b7014);_0x1a42bd(_0x1b7014);});});} \ No newline at end of file +var _0x9309=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9309,0x13b));var _0x9930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9309[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9930('0x0'));var util=require(_0x9930('0x1'));var moment=require(_0x9930('0x2'));var BPromise=require(_0x9930('0x3'));var rs=require(_0x9930('0x4'));var fs=require('fs');var Redis=require(_0x9930('0x5'));var db=require(_0x9930('0x6'))['db'];var utils=require(_0x9930('0x7'));var logger=require(_0x9930('0x8'))(_0x9930('0x9'));var config=require(_0x9930('0xa'));var jayson=require(_0x9930('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13d10f,_0x2ce40d,_0x2fbf39){return new BPromise(function(_0xbc0764,_0x4ccf98){return client[_0x9930('0xc')](_0x13d10f,_0x2fbf39)[_0x9930('0xd')](function(_0x3a95e5){logger[_0x9930('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x2ce40d,'request\x20sent');logger['debug'](_0x9930('0xf'),_0x2ce40d,_0x9930('0x10'),JSON[_0x9930('0x11')](_0x3a95e5));if(_0x3a95e5[_0x9930('0x12')]){if(_0x3a95e5[_0x9930('0x12')][_0x9930('0x13')]===0x1f4){logger[_0x9930('0x12')](_0x9930('0x14'),_0x2ce40d,_0x3a95e5['error'][_0x9930('0x15')]);return _0x4ccf98(_0x3a95e5[_0x9930('0x12')][_0x9930('0x15')]);}logger[_0x9930('0x12')](_0x9930('0x14'),_0x2ce40d,_0x3a95e5[_0x9930('0x12')]['message']);return _0xbc0764(_0x3a95e5['error'][_0x9930('0x15')]);}else{logger[_0x9930('0xe')](_0x9930('0x14'),_0x2ce40d,_0x9930('0x10'));_0xbc0764(_0x3a95e5[_0x9930('0x16')][_0x9930('0x15')]);}})[_0x9930('0x17')](function(_0xfe3900){logger[_0x9930('0x12')](_0x9930('0x14'),_0x2ce40d,_0xfe3900);_0x4ccf98(_0xfe3900);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a74dc8a..ad65668 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 _0xaafe=['update','delete','exports','util','path','connect-timeout','express','./sound.controller','isAuthenticated','index','/:id','show','get','download','root','server/files/sounds/original/','originalname','format','basename','extname','now','single','file','create','put'];(function(_0x5328b4,_0x1475d6){var _0x287638=function(_0x54da66){while(--_0x54da66){_0x5328b4['push'](_0x5328b4['shift']());}};_0x287638(++_0x1475d6);}(_0xaafe,0xb2));var _0xeaaf=function(_0x5da78c,_0xfc64e0){_0x5da78c=_0x5da78c-0x0;var _0x3ce0e0=_0xaafe[_0x5da78c];return _0x3ce0e0;};'use strict';var multer=require('multer');var util=require(_0xeaaf('0x0'));var path=require(_0xeaaf('0x1'));var timeout=require(_0xeaaf('0x2'));var express=require(_0xeaaf('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeaaf('0x4'));router['get']('/',auth[_0xeaaf('0x5')](),controller[_0xeaaf('0x6')]);router['get'](_0xeaaf('0x7'),auth[_0xeaaf('0x5')](),controller[_0xeaaf('0x8')]);router[_0xeaaf('0x9')]('/:id/download',auth[_0xeaaf('0x5')](),controller[_0xeaaf('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x50b810,_0x21e907,_0xb4cba1){_0xb4cba1(null,path['join'](config[_0xeaaf('0xb')],_0xeaaf('0xc')));},'filename':function(_0x48a0c5,_0x44e318,_0xd5c55c){_0x44e318['originalname']=_0x44e318[_0xeaaf('0xd')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xd5c55c(null,util[_0xeaaf('0xe')]('%s-%s%s',path[_0xeaaf('0xf')](_0x44e318[_0xeaaf('0xd')],path[_0xeaaf('0x10')](_0x44e318['originalname'])),Date[_0xeaaf('0x11')](),path[_0xeaaf('0x10')](_0x44e318[_0xeaaf('0xd')])));}})});router['post']('/',upload[_0xeaaf('0x12')](_0xeaaf('0x13')),controller[_0xeaaf('0x14')]);router[_0xeaaf('0x15')](_0xeaaf('0x7'),auth[_0xeaaf('0x5')](),controller[_0xeaaf('0x16')]);router[_0xeaaf('0x17')](_0xeaaf('0x7'),auth[_0xeaaf('0x5')](),controller[_0xeaaf('0x17')]);module[_0xeaaf('0x18')]=router; \ No newline at end of file +var _0xc0fb=['create','put','/:id','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc0fb,0xa6));var _0xbc0f=function(_0x1d6937,_0x20904b){_0x1d6937=_0x1d6937-0x0;var _0x35b5a4=_0xc0fb[_0x1d6937];return _0x35b5a4;};'use strict';var multer=require(_0xbc0f('0x0'));var util=require(_0xbc0f('0x1'));var path=require(_0xbc0f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbc0f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbc0f('0x4'));var config=require(_0xbc0f('0x5'));var controller=require(_0xbc0f('0x6'));router[_0xbc0f('0x7')]('/',auth[_0xbc0f('0x8')](),controller['index']);router[_0xbc0f('0x7')]('/:id',auth[_0xbc0f('0x8')](),controller[_0xbc0f('0x9')]);router['get'](_0xbc0f('0xa'),auth['isAuthenticated'](),controller[_0xbc0f('0xb')]);var upload=multer({'storage':multer[_0xbc0f('0xc')]({'destination':function(_0x235a37,_0xe2b208,_0x570c12){_0x570c12(null,path[_0xbc0f('0xd')](config[_0xbc0f('0xe')],_0xbc0f('0xf')));},'filename':function(_0x3c2403,_0x27eb6c,_0x5246dc){_0x27eb6c[_0xbc0f('0x10')]=_0x27eb6c['originalname'][_0xbc0f('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5246dc(null,util[_0xbc0f('0x12')](_0xbc0f('0x13'),path[_0xbc0f('0x14')](_0x27eb6c['originalname'],path[_0xbc0f('0x15')](_0x27eb6c[_0xbc0f('0x10')])),Date[_0xbc0f('0x16')](),path['extname'](_0x27eb6c[_0xbc0f('0x10')])));}})});router[_0xbc0f('0x17')]('/',upload[_0xbc0f('0x18')](_0xbc0f('0x19')),controller[_0xbc0f('0x1a')]);router[_0xbc0f('0x1b')](_0xbc0f('0x1c'),auth[_0xbc0f('0x8')](),controller[_0xbc0f('0x1d')]);router[_0xbc0f('0x1e')]('/:id',auth[_0xbc0f('0x8')](),controller['delete']);module[_0xbc0f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b4ecda6..16beebe 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 _0xe71d=['INTEGER','exports','STRING','name','FLOAT','BIGINT'];(function(_0x12b146,_0x4a2efc){var _0x28879a=function(_0x1256a2){while(--_0x1256a2){_0x12b146['push'](_0x12b146['shift']());}};_0x28879a(++_0x4a2efc);}(_0xe71d,0x1b7));var _0xde71=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xe71d[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module[_0xde71('0x0')]={'name':{'type':Sequelize[_0xde71('0x1')],'unique':_0xde71('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xde71('0x1')]},'display_name':{'type':Sequelize[_0xde71('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xde71('0x1')]},'original_format':{'type':Sequelize[_0xde71('0x1')]},'original_duration':{'type':Sequelize[_0xde71('0x3')]},'original_sampleCount':{'type':Sequelize[_0xde71('0x4')]},'original_channelCount':{'type':Sequelize[_0xde71('0x5')]},'original_bitRate':{'type':Sequelize[_0xde71('0x4')]},'original_sampleRate':{'type':Sequelize[_0xde71('0x5')]},'converted_format':{'type':Sequelize[_0xde71('0x1')]},'converted_duration':{'type':Sequelize[_0xde71('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xde71('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0e5f=['sequelize','exports','STRING','name','INTEGER','BIGINT'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x0e5f,0x1f2));var _0xf0e5=function(_0x1e8ba8,_0x3c6f20){_0x1e8ba8=_0x1e8ba8-0x0;var _0x57df43=_0x0e5f[_0x1e8ba8];return _0x57df43;};'use strict';var Sequelize=require(_0xf0e5('0x0'));module[_0xf0e5('0x1')]={'name':{'type':Sequelize[_0xf0e5('0x2')],'unique':_0xf0e5('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf0e5('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf0e5('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xf0e5('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xf0e5('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xf0e5('0x5')]},'converted_channelCount':{'type':Sequelize[_0xf0e5('0x4')]},'converted_bitRate':{'type':Sequelize[_0xf0e5('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index fb4dea7..a902bde 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 _0x53e3=['body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','%s.%s','original_format','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','find','download','save_name','existsSync','join','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','converted_format','create','file','originalname','basename','filename','extname','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_sampleRate'];(function(_0x309378,_0x51581c){var _0xad3422=function(_0x2b6c0e){while(--_0x2b6c0e){_0x309378['push'](_0x309378['shift']());}};_0xad3422(++_0x51581c);}(_0x53e3,0x82));var _0x353e=function(_0x246490,_0x529de9){_0x246490=_0x246490-0x0;var _0xff2551=_0x53e3[_0x246490];return _0xff2551;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x353e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x353e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x353e('0x2'));var moment=require(_0x353e('0x3'));var BPromise=require(_0x353e('0x4'));var Mustache=require(_0x353e('0x5'));var util=require(_0x353e('0x6'));var path=require('path');var sox=require(_0x353e('0x7'));var csv=require('to-csv');var ejs=require(_0x353e('0x8'));var fs=require('fs');var _=require(_0x353e('0x9'));var squel=require(_0x353e('0xa'));var crypto=require('crypto');var jsforce=require(_0x353e('0xb'));var deskjs=require(_0x353e('0xc'));var toCsv=require(_0x353e('0xd'));var querystring=require(_0x353e('0xe'));var Papa=require(_0x353e('0xf'));var Redis=require('ioredis');var authService=require(_0x353e('0x10'));var qs=require(_0x353e('0x11'));var as=require(_0x353e('0x12'));var hardwareService=require(_0x353e('0x13'));var logger=require('../../config/logger')(_0x353e('0x14'));var utils=require('../../config/utils');var config=require(_0x353e('0x15'));var db=require(_0x353e('0x16'))['db'];function respondWithStatusCode(_0x30b0ca,_0x1bb707){_0x1bb707=_0x1bb707||0xcc;return function(_0x4f3de4){if(_0x4f3de4){return _0x30b0ca[_0x353e('0x17')](_0x1bb707);}return _0x30b0ca[_0x353e('0x18')](_0x1bb707)[_0x353e('0x19')]();};}function respondWithResult(_0x201a90,_0x434031){_0x434031=_0x434031||0xc8;return function(_0x5b0c19){if(_0x5b0c19){return _0x201a90['status'](_0x434031)[_0x353e('0x1a')](_0x5b0c19);}};}function respondWithFilteredResult(_0x4ebe88,_0x1c21cb){return function(_0x268edb){if(_0x268edb){var _0x51c05e=_0x268edb[_0x353e('0x1b')],_0xf12589=_0x1c21cb[_0x353e('0x1c')],_0x5c4825=_0x1c21cb[_0x353e('0x1c')]+_0x1c21cb['limit'],_0x5ac5df;if(_0x5c4825>=_0x51c05e){_0x5c4825=_0x51c05e;_0x5ac5df=0xc8;}else{_0x5ac5df=0xce;}_0x4ebe88['status'](_0x5ac5df);return _0x4ebe88[_0x353e('0x1d')](_0x353e('0x1e'),_0xf12589+'-'+_0x5c4825+'/'+_0x51c05e)[_0x353e('0x1a')](_0x268edb);}return null;};}function patchUpdates(_0x47f0f7){return function(_0x538f44){try{jsonpatch[_0x353e('0x1f')](_0x538f44,_0x47f0f7,!![]);}catch(_0x299b88){return BPromise['reject'](_0x299b88);}return _0x538f44[_0x353e('0x20')]();};}function saveUpdates(_0x31e4ad,_0x5a67e7){return function(_0x4be1dc){if(_0x4be1dc){return _0x4be1dc[_0x353e('0x21')](_0x31e4ad)[_0x353e('0x22')](function(_0x54e62f){return _0x54e62f;});}return null;};}function removeEntity(_0x54dcd3,_0x17a7fe){return function(_0x48189e){if(_0x48189e){return _0x48189e[_0x353e('0x23')]()['then'](function(){var _0x348dba=_0x48189e[_0x353e('0x24')]({'plain':!![]});var _0x1b3734=_0x353e('0x25');return db[_0x353e('0x26')]['destroy']({'where':{'type':_0x1b3734,'resourceId':_0x348dba['id']}})[_0x353e('0x22')](function(){return _0x48189e;});})[_0x353e('0x22')](function(){_0x54dcd3[_0x353e('0x18')](0xcc)[_0x353e('0x19')]();});}};}function handleEntityNotFound(_0x4a8c05,_0x7bd336){return function(_0x3e4cff){if(!_0x3e4cff){_0x4a8c05[_0x353e('0x17')](0x194);}return _0x3e4cff;};}function handleError(_0x25122b,_0x6bfc87){_0x6bfc87=_0x6bfc87||0x1f4;return function(_0x4ed9f1){logger[_0x353e('0x27')](_0x4ed9f1[_0x353e('0x28')]);if(_0x4ed9f1[_0x353e('0x29')]){delete _0x4ed9f1[_0x353e('0x29')];}_0x25122b['status'](_0x6bfc87)[_0x353e('0x2a')](_0x4ed9f1);};}exports[_0x353e('0x2b')]=function(_0x744eb7,_0x38f7e9){var _0x58bcdd={},_0x37dfc0={},_0x5392e1={'count':0x0,'rows':[]};var _0x15103c=_[_0x353e('0x2c')](db[_0x353e('0x2d')][_0x353e('0x2e')],function(_0x23efee){return{'name':_0x23efee[_0x353e('0x2f')],'type':_0x23efee[_0x353e('0x30')]['key']};});_0x37dfc0[_0x353e('0x31')]=_['map'](_0x15103c,_0x353e('0x29'));_0x37dfc0[_0x353e('0x32')]=_['keys'](_0x744eb7['query']);_0x37dfc0[_0x353e('0x33')]=_[_0x353e('0x34')](_0x37dfc0[_0x353e('0x31')],_0x37dfc0['query']);_0x58bcdd[_0x353e('0x35')]=_[_0x353e('0x34')](_0x37dfc0[_0x353e('0x31')],qs[_0x353e('0x36')](_0x744eb7[_0x353e('0x32')][_0x353e('0x36')]));_0x58bcdd['attributes']=_0x58bcdd[_0x353e('0x35')][_0x353e('0x37')]?_0x58bcdd['attributes']:_0x37dfc0[_0x353e('0x31')];if(!_0x744eb7[_0x353e('0x32')][_0x353e('0x38')](_0x353e('0x39'))){_0x58bcdd['limit']=qs['limit'](_0x744eb7[_0x353e('0x32')]['limit']);_0x58bcdd[_0x353e('0x1c')]=qs[_0x353e('0x1c')](_0x744eb7[_0x353e('0x32')][_0x353e('0x1c')]);}_0x58bcdd['order']=qs[_0x353e('0x3a')](_0x744eb7[_0x353e('0x32')][_0x353e('0x3a')]);_0x58bcdd[_0x353e('0x3b')]=qs[_0x353e('0x33')](_[_0x353e('0x3c')](_0x744eb7[_0x353e('0x32')],_0x37dfc0['filters']),_0x15103c);if(_0x744eb7['query'][_0x353e('0x3d')]){_0x58bcdd[_0x353e('0x3b')]=_[_0x353e('0x3e')](_0x58bcdd[_0x353e('0x3b')],{'$or':_[_0x353e('0x2c')](_0x15103c,function(_0x1adff1){if(_0x1adff1[_0x353e('0x30')]!==_0x353e('0x3f')){var _0x50e0ca={};_0x50e0ca[_0x1adff1[_0x353e('0x29')]]={'$like':'%'+_0x744eb7[_0x353e('0x32')]['filter']+'%'};return _0x50e0ca;}})});}_0x58bcdd=_[_0x353e('0x3e')]({},_0x58bcdd,_0x744eb7[_0x353e('0x40')]);var _0x2fca0a={'where':_0x58bcdd[_0x353e('0x3b')]};return db[_0x353e('0x2d')][_0x353e('0x1b')](_0x2fca0a)[_0x353e('0x22')](function(_0xab0009){_0x5392e1['count']=_0xab0009;if(_0x744eb7[_0x353e('0x32')][_0x353e('0x41')]){_0x58bcdd['include']=[{'all':!![]}];}return db[_0x353e('0x2d')][_0x353e('0x42')](_0x58bcdd);})['then'](function(_0x21649a){_0x5392e1[_0x353e('0x43')]=_0x21649a;return _0x5392e1;})[_0x353e('0x22')](respondWithFilteredResult(_0x38f7e9,_0x58bcdd))[_0x353e('0x44')](handleError(_0x38f7e9,null));};exports[_0x353e('0x45')]=function(_0x29efe2,_0x19c7f3){var _0x3f53d1={'raw':!![],'where':{'id':_0x29efe2[_0x353e('0x46')]['id']}},_0x4f6193={};_0x4f6193[_0x353e('0x31')]=_['keys'](db[_0x353e('0x2d')][_0x353e('0x2e')]);_0x4f6193[_0x353e('0x32')]=_[_0x353e('0x47')](_0x29efe2[_0x353e('0x32')]);_0x4f6193[_0x353e('0x33')]=_['intersection'](_0x4f6193['model'],_0x4f6193['query']);_0x3f53d1['attributes']=_[_0x353e('0x34')](_0x4f6193[_0x353e('0x31')],qs['fields'](_0x29efe2[_0x353e('0x32')][_0x353e('0x36')]));_0x3f53d1[_0x353e('0x35')]=_0x3f53d1['attributes'][_0x353e('0x37')]?_0x3f53d1[_0x353e('0x35')]:_0x4f6193['model'];if(_0x29efe2[_0x353e('0x32')][_0x353e('0x41')]){_0x3f53d1['include']=[{'all':!![]}];}_0x3f53d1=_['merge']({},_0x3f53d1,_0x29efe2[_0x353e('0x40')]);return db['Sound'][_0x353e('0x48')](_0x3f53d1)['then'](handleEntityNotFound(_0x19c7f3,null))[_0x353e('0x22')](respondWithResult(_0x19c7f3,null))['catch'](handleError(_0x19c7f3,null));};exports[_0x353e('0x49')]=function(_0x42e15b,_0x20ffd3,_0x580ca9){return db['Sound']['find']({'where':{'id':_0x42e15b[_0x353e('0x46')]['id']},'attributes':['name',_0x353e('0x4a'),'converted_format'],'raw':!![]})[_0x353e('0x22')](handleEntityNotFound(_0x20ffd3,null))['then'](function(_0x9e0dd0){if(_0x9e0dd0){if(!fs[_0x353e('0x4b')](path[_0x353e('0x4c')](config['root'],'server/files/sounds/converted',_0x9e0dd0[_0x353e('0x4a')]+'.'+_0x9e0dd0['converted_format']))){throw new db[(_0x353e('0x4d'))][(_0x353e('0x4e'))](_0x353e('0x4f'));}return _0x20ffd3[_0x353e('0x49')](path[_0x353e('0x4c')](config['root'],_0x353e('0x50'),util[_0x353e('0x51')]('%s.%s',_0x9e0dd0[_0x353e('0x4a')],_0x9e0dd0[_0x353e('0x52')])),util[_0x353e('0x51')]('%s.%s',_0x9e0dd0['name'],_0x9e0dd0[_0x353e('0x52')]));}return null;})['catch'](handleError(_0x20ffd3,null));};exports[_0x353e('0x53')]=function(_0x45417f,_0xd6d2d2,_0x42c27c){var _0x53dc3b={'name':path['basename'](_0x45417f[_0x353e('0x54')][_0x353e('0x55')],path['extname'](_0x45417f[_0x353e('0x54')][_0x353e('0x55')])),'save_name':path[_0x353e('0x56')](_0x45417f[_0x353e('0x54')][_0x353e('0x57')],path[_0x353e('0x58')](_0x45417f[_0x353e('0x54')][_0x353e('0x57')])),'original_format':path['extname'](_0x45417f[_0x353e('0x54')]['originalname'])['substring'](0x1),'converted_format':_0x353e('0x59')};var _0x5182d1=path['join'](config[_0x353e('0x5a')],_0x353e('0x5b'),_0x45417f[_0x353e('0x54')]['filename']);var _0x485294=path[_0x353e('0x4c')](config[_0x353e('0x5a')],_0x353e('0x50'),util['format']('%s.%s',path[_0x353e('0x56')](_0x45417f[_0x353e('0x54')][_0x353e('0x57')],path['extname'](_0x45417f[_0x353e('0x54')][_0x353e('0x57')])),_0x53dc3b[_0x353e('0x52')]));logger[_0x353e('0x5c')](_0x353e('0x5d'),_0x5182d1);logger[_0x353e('0x5c')](_0x353e('0x5e'),_0x485294);try{fs[_0x353e('0x5f')](_0x5182d1,parseInt(_0x353e('0x60'),0x8));var _0x442d31=sox[_0x353e('0x61')](_0x5182d1,_0x485294,{'sampleRate':0x1f40,'format':_0x353e('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x442d31['on'](_0x353e('0x27'),function(_0x3df3be){fs[_0x353e('0x62')](_0x5182d1);_0xd6d2d2[_0x353e('0x18')](0x1f4)[_0x353e('0x2a')](_0x3df3be);});_0x442d31['on'](_0x353e('0x63'),function(_0xb68970){_0x53dc3b['original_duration']=isNaN(_0xb68970[_0x353e('0x64')])?null:_0xb68970['duration']*0x3e8;_0x53dc3b[_0x353e('0x65')]=isNaN(_0xb68970[_0x353e('0x66')])?null:_0xb68970[_0x353e('0x66')];_0x53dc3b[_0x353e('0x67')]=isNaN(_0xb68970[_0x353e('0x68')])?null:_0xb68970[_0x353e('0x68')];_0x53dc3b[_0x353e('0x69')]=isNaN(_0xb68970['bitRate'])?null:_0xb68970[_0x353e('0x6a')];_0x53dc3b['original_sampleRate']=isNaN(_0xb68970[_0x353e('0x6b')])?null:_0xb68970['sampleRate'];});_0x442d31['on'](_0x353e('0x6c'),function(_0x410832){_0x53dc3b[_0x353e('0x6d')]=isNaN(_0x410832[_0x353e('0x64')])?null:_0x410832['duration']*0x3e8;_0x53dc3b['converted_sampleCount']=isNaN(_0x410832['sampleCount'])?null:_0x410832[_0x353e('0x66')];_0x53dc3b[_0x353e('0x6e')]=isNaN(_0x410832[_0x353e('0x68')])?null:_0x410832[_0x353e('0x68')];_0x53dc3b['converted_bitRate']=isNaN(_0x410832[_0x353e('0x6a')])?null:_0x410832[_0x353e('0x6a')];_0x53dc3b[_0x353e('0x6f')]=isNaN(_0x410832[_0x353e('0x6b')])?null:_0x410832[_0x353e('0x6b')];});_0x442d31['on'](_0x353e('0x19'),function(){fs[_0x353e('0x5f')](_0x485294,parseInt(_0x353e('0x60'),0x8));return db['Sound'][_0x353e('0x53')](_0x53dc3b)[_0x353e('0x22')](function(_0x5d83d5){var _0x49a046={'role':_0x45417f[_0x353e('0x70')]['role'],'userProfileId':_0x45417f[_0x353e('0x70')]['userProfileId']};if(!_0x49a046)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49a046[_0x353e('0x71')]===_0x353e('0x72')){var _0x1d8f12=_0x5d83d5[_0x353e('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x353e('0x48')]({'where':{'name':'Sounds','userProfileId':_0x49a046[_0x353e('0x73')]},'raw':!![]})['then'](function(_0x24934f){if(_0x24934f&&_0x24934f[_0x353e('0x74')]===0x0){return db[_0x353e('0x26')]['create']({'name':_0x1d8f12[_0x353e('0x29')],'resourceId':_0x1d8f12['id'],'type':_0x24934f[_0x353e('0x29')],'sectionId':_0x24934f['id']},{})[_0x353e('0x22')](function(){return _0x5d83d5;});}else{return _0x5d83d5;}})[_0x353e('0x44')](function(_0x22310a){logger['error'](_0x353e('0x75'),_0x22310a);throw _0x22310a;});}return _0x5d83d5;})[_0x353e('0x22')](respondWithResult(_0xd6d2d2,null))[_0x353e('0x44')](handleError(_0xd6d2d2,null));});_0x442d31[_0x353e('0x76')]();}catch(_0x450201){_0xd6d2d2[_0x353e('0x18')](0x1f4)[_0x353e('0x2a')](_0x450201);}};exports[_0x353e('0x21')]=function(_0x254042,_0xacb72a,_0x1675e7){return db[_0x353e('0x2d')][_0x353e('0x48')]({'where':{'id':_0x254042[_0x353e('0x46')]['id']}})['then'](handleEntityNotFound(_0xacb72a,null))[_0x353e('0x22')](saveUpdates(_[_0x353e('0x3c')](_0x254042[_0x353e('0x70')],['name','description']),null))[_0x353e('0x22')](respondWithResult(_0xacb72a,null))[_0x353e('0x44')](handleError(_0xacb72a,null));};exports['delete']=function(_0x744993,_0x15c7a5,_0xcbb737){return db[_0x353e('0x2d')]['find']({'where':{'id':_0x744993['params']['id']}})[_0x353e('0x22')](function(_0x37283c){if(_0x37283c){return _0x37283c[_0x353e('0x23')]();}})[_0x353e('0x22')](function(_0x2af531){var _0x3e54fd=path[_0x353e('0x4c')](config[_0x353e('0x5a')],_0x353e('0x5b'),util[_0x353e('0x51')](_0x353e('0x77'),_0x2af531[_0x353e('0x4a')],_0x2af531[_0x353e('0x78')]));var _0xeab4e1=path[_0x353e('0x4c')](config[_0x353e('0x5a')],_0x353e('0x50'),util['format'](_0x353e('0x77'),_0x2af531[_0x353e('0x4a')],_0x2af531['converted_format']));fs[_0x353e('0x62')](_0x3e54fd);fs[_0x353e('0x62')](_0xeab4e1);return _0x2af531;})[_0x353e('0x22')](function(_0x36d0e4){if(_0x36d0e4){return _0x15c7a5[_0x353e('0x18')](0xcc)[_0x353e('0x19')]();}})[_0x353e('0x22')](handleEntityNotFound(_0x15c7a5,null))[_0x353e('0x44')](handleError(_0x15c7a5,null));}; \ No newline at end of file +var _0x0428=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Sounds','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','rows','catch','show','length','find','params','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0428,0xed));var _0x8042=function(_0x2eaed1,_0x18a888){_0x2eaed1=_0x2eaed1-0x0;var _0x2bd6b5=_0x0428[_0x2eaed1];return _0x2bd6b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8042('0x0'));var rimraf=require(_0x8042('0x1'));var zipdir=require(_0x8042('0x2'));var jsonpatch=require(_0x8042('0x3'));var rp=require(_0x8042('0x4'));var moment=require(_0x8042('0x5'));var BPromise=require(_0x8042('0x6'));var Mustache=require(_0x8042('0x7'));var util=require(_0x8042('0x8'));var path=require(_0x8042('0x9'));var sox=require(_0x8042('0xa'));var csv=require(_0x8042('0xb'));var ejs=require(_0x8042('0xc'));var fs=require('fs');var _=require(_0x8042('0xd'));var squel=require(_0x8042('0xe'));var crypto=require('crypto');var jsforce=require(_0x8042('0xf'));var deskjs=require(_0x8042('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8042('0x11'));var Papa=require(_0x8042('0x12'));var Redis=require(_0x8042('0x13'));var authService=require(_0x8042('0x14'));var qs=require(_0x8042('0x15'));var as=require(_0x8042('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8042('0x17'));var config=require(_0x8042('0x18'));var db=require(_0x8042('0x19'))['db'];function respondWithStatusCode(_0x4815af,_0x3f3f5b){_0x3f3f5b=_0x3f3f5b||0xcc;return function(_0x408b6b){if(_0x408b6b){return _0x4815af[_0x8042('0x1a')](_0x3f3f5b);}return _0x4815af['status'](_0x3f3f5b)[_0x8042('0x1b')]();};}function respondWithResult(_0x5566f,_0x2b8240){_0x2b8240=_0x2b8240||0xc8;return function(_0x3e7dd9){if(_0x3e7dd9){return _0x5566f[_0x8042('0x1c')](_0x2b8240)[_0x8042('0x1d')](_0x3e7dd9);}};}function respondWithFilteredResult(_0x5196e0,_0x1dedd8){return function(_0x50e9dd){if(_0x50e9dd){var _0x28dcd8=_0x50e9dd[_0x8042('0x1e')],_0x380c0f=_0x1dedd8[_0x8042('0x1f')],_0x22cd2a=_0x1dedd8[_0x8042('0x1f')]+_0x1dedd8['limit'],_0x37cc2a;if(_0x22cd2a>=_0x28dcd8){_0x22cd2a=_0x28dcd8;_0x37cc2a=0xc8;}else{_0x37cc2a=0xce;}_0x5196e0[_0x8042('0x1c')](_0x37cc2a);return _0x5196e0[_0x8042('0x20')](_0x8042('0x21'),_0x380c0f+'-'+_0x22cd2a+'/'+_0x28dcd8)[_0x8042('0x1d')](_0x50e9dd);}return null;};}function patchUpdates(_0x141724){return function(_0xed5e30){try{jsonpatch[_0x8042('0x22')](_0xed5e30,_0x141724,!![]);}catch(_0x1c8da8){return BPromise[_0x8042('0x23')](_0x1c8da8);}return _0xed5e30[_0x8042('0x24')]();};}function saveUpdates(_0x307df7,_0x2b4b22){return function(_0x1cfae6){if(_0x1cfae6){return _0x1cfae6['update'](_0x307df7)[_0x8042('0x25')](function(_0x4958a6){return _0x4958a6;});}return null;};}function removeEntity(_0x287490,_0x5c3a74){return function(_0x2e827a){if(_0x2e827a){return _0x2e827a[_0x8042('0x26')]()[_0x8042('0x25')](function(){var _0x29e5f1=_0x2e827a[_0x8042('0x27')]({'plain':!![]});var _0x4fd53e=_0x8042('0x28');return db[_0x8042('0x29')][_0x8042('0x26')]({'where':{'type':_0x4fd53e,'resourceId':_0x29e5f1['id']}})[_0x8042('0x25')](function(){return _0x2e827a;});})['then'](function(){_0x287490[_0x8042('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59394c,_0x33a9c9){return function(_0x1f7dd7){if(!_0x1f7dd7){_0x59394c[_0x8042('0x1a')](0x194);}return _0x1f7dd7;};}function handleError(_0x20da36,_0x296b27){_0x296b27=_0x296b27||0x1f4;return function(_0x312fcd){logger['error'](_0x312fcd['stack']);if(_0x312fcd[_0x8042('0x2a')]){delete _0x312fcd[_0x8042('0x2a')];}_0x20da36[_0x8042('0x1c')](_0x296b27)[_0x8042('0x2b')](_0x312fcd);};}exports[_0x8042('0x2c')]=function(_0x337000,_0x677810){var _0x66096={},_0x8aeca1={},_0x504165={'count':0x0,'rows':[]};var _0x3a0ae7=_[_0x8042('0x2d')](db['Sound'][_0x8042('0x2e')],function(_0x53586a){return{'name':_0x53586a[_0x8042('0x2f')],'type':_0x53586a[_0x8042('0x30')][_0x8042('0x31')]};});_0x8aeca1[_0x8042('0x32')]=_[_0x8042('0x2d')](_0x3a0ae7,_0x8042('0x2a'));_0x8aeca1[_0x8042('0x33')]=_[_0x8042('0x34')](_0x337000[_0x8042('0x33')]);_0x8aeca1[_0x8042('0x35')]=_[_0x8042('0x36')](_0x8aeca1[_0x8042('0x32')],_0x8aeca1[_0x8042('0x33')]);_0x66096[_0x8042('0x37')]=_[_0x8042('0x36')](_0x8aeca1[_0x8042('0x32')],qs['fields'](_0x337000[_0x8042('0x33')][_0x8042('0x38')]));_0x66096[_0x8042('0x37')]=_0x66096[_0x8042('0x37')]['length']?_0x66096[_0x8042('0x37')]:_0x8aeca1['model'];if(!_0x337000[_0x8042('0x33')]['hasOwnProperty'](_0x8042('0x39'))){_0x66096[_0x8042('0x3a')]=qs[_0x8042('0x3a')](_0x337000[_0x8042('0x33')][_0x8042('0x3a')]);_0x66096['offset']=qs['offset'](_0x337000[_0x8042('0x33')][_0x8042('0x1f')]);}_0x66096['order']=qs[_0x8042('0x3b')](_0x337000[_0x8042('0x33')][_0x8042('0x3b')]);_0x66096[_0x8042('0x3c')]=qs['filters'](_[_0x8042('0x3d')](_0x337000['query'],_0x8aeca1[_0x8042('0x35')]),_0x3a0ae7);if(_0x337000[_0x8042('0x33')][_0x8042('0x3e')]){_0x66096[_0x8042('0x3c')]=_[_0x8042('0x3f')](_0x66096['where'],{'$or':_['map'](_0x3a0ae7,function(_0x110f9b){if(_0x110f9b[_0x8042('0x30')]!==_0x8042('0x40')){var _0x960cef={};_0x960cef[_0x110f9b[_0x8042('0x2a')]]={'$like':'%'+_0x337000[_0x8042('0x33')][_0x8042('0x3e')]+'%'};return _0x960cef;}})});}_0x66096=_[_0x8042('0x3f')]({},_0x66096,_0x337000[_0x8042('0x41')]);var _0x371120={'where':_0x66096['where']};return db[_0x8042('0x42')]['count'](_0x371120)[_0x8042('0x25')](function(_0x5a835e){_0x504165[_0x8042('0x1e')]=_0x5a835e;if(_0x337000[_0x8042('0x33')][_0x8042('0x43')]){_0x66096[_0x8042('0x44')]=[{'all':!![]}];}return db['Sound'][_0x8042('0x45')](_0x66096);})[_0x8042('0x25')](function(_0x456363){_0x504165[_0x8042('0x46')]=_0x456363;return _0x504165;})[_0x8042('0x25')](respondWithFilteredResult(_0x677810,_0x66096))[_0x8042('0x47')](handleError(_0x677810,null));};exports[_0x8042('0x48')]=function(_0x47e15c,_0x29f03f){var _0x311084={'raw':!![],'where':{'id':_0x47e15c['params']['id']}},_0x2c007f={};_0x2c007f['model']=_[_0x8042('0x34')](db[_0x8042('0x42')][_0x8042('0x2e')]);_0x2c007f[_0x8042('0x33')]=_[_0x8042('0x34')](_0x47e15c[_0x8042('0x33')]);_0x2c007f[_0x8042('0x35')]=_['intersection'](_0x2c007f[_0x8042('0x32')],_0x2c007f['query']);_0x311084['attributes']=_[_0x8042('0x36')](_0x2c007f[_0x8042('0x32')],qs[_0x8042('0x38')](_0x47e15c[_0x8042('0x33')]['fields']));_0x311084[_0x8042('0x37')]=_0x311084[_0x8042('0x37')][_0x8042('0x49')]?_0x311084[_0x8042('0x37')]:_0x2c007f[_0x8042('0x32')];if(_0x47e15c[_0x8042('0x33')][_0x8042('0x43')]){_0x311084['include']=[{'all':!![]}];}_0x311084=_[_0x8042('0x3f')]({},_0x311084,_0x47e15c['options']);return db[_0x8042('0x42')]['find'](_0x311084)[_0x8042('0x25')](handleEntityNotFound(_0x29f03f,null))[_0x8042('0x25')](respondWithResult(_0x29f03f,null))[_0x8042('0x47')](handleError(_0x29f03f,null));};exports['download']=function(_0x328519,_0x29cdc6,_0x30370c){return db[_0x8042('0x42')][_0x8042('0x4a')]({'where':{'id':_0x328519[_0x8042('0x4b')]['id']},'attributes':[_0x8042('0x2a'),_0x8042('0x4c'),_0x8042('0x4d')],'raw':!![]})[_0x8042('0x25')](handleEntityNotFound(_0x29cdc6,null))[_0x8042('0x25')](function(_0x355135){if(_0x355135){if(!fs[_0x8042('0x4e')](path[_0x8042('0x4f')](config['root'],_0x8042('0x50'),_0x355135[_0x8042('0x4c')]+'.'+_0x355135['converted_format']))){throw new db[(_0x8042('0x51'))][(_0x8042('0x52'))](_0x8042('0x53'));}return _0x29cdc6[_0x8042('0x54')](path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x50'),util[_0x8042('0x56')](_0x8042('0x57'),_0x355135[_0x8042('0x4c')],_0x355135[_0x8042('0x4d')])),util[_0x8042('0x56')](_0x8042('0x57'),_0x355135[_0x8042('0x2a')],_0x355135['converted_format']));}return null;})[_0x8042('0x47')](handleError(_0x29cdc6,null));};exports['create']=function(_0x1158c7,_0x9b94a5,_0x4c0714){var _0x3944a1={'name':path[_0x8042('0x58')](_0x1158c7[_0x8042('0x59')]['originalname'],path['extname'](_0x1158c7['file'][_0x8042('0x5a')])),'save_name':path['basename'](_0x1158c7['file'][_0x8042('0x5b')],path[_0x8042('0x5c')](_0x1158c7[_0x8042('0x59')][_0x8042('0x5b')])),'original_format':path[_0x8042('0x5c')](_0x1158c7[_0x8042('0x59')]['originalname'])[_0x8042('0x5d')](0x1),'converted_format':_0x8042('0x5e')};var _0x1cbfb2=path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x5f'),_0x1158c7[_0x8042('0x59')]['filename']);var _0x2a8beb=path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x50'),util[_0x8042('0x56')]('%s.%s',path[_0x8042('0x58')](_0x1158c7[_0x8042('0x59')][_0x8042('0x5b')],path['extname'](_0x1158c7[_0x8042('0x59')]['filename'])),_0x3944a1[_0x8042('0x4d')]));logger[_0x8042('0x60')](_0x8042('0x61'),_0x1cbfb2);logger[_0x8042('0x60')](_0x8042('0x62'),_0x2a8beb);try{fs[_0x8042('0x63')](_0x1cbfb2,parseInt(_0x8042('0x64'),0x8));var _0x16b111=sox['transcode'](_0x1cbfb2,_0x2a8beb,{'sampleRate':0x1f40,'format':_0x8042('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x16b111['on'](_0x8042('0x65'),function(_0x18a9a9){fs['unlinkSync'](_0x1cbfb2);_0x9b94a5[_0x8042('0x1c')](0x1f4)[_0x8042('0x2b')](_0x18a9a9);});_0x16b111['on'](_0x8042('0x66'),function(_0x3ae2cf){_0x3944a1['original_duration']=isNaN(_0x3ae2cf['duration'])?null:_0x3ae2cf[_0x8042('0x67')]*0x3e8;_0x3944a1['original_sampleCount']=isNaN(_0x3ae2cf[_0x8042('0x68')])?null:_0x3ae2cf[_0x8042('0x68')];_0x3944a1[_0x8042('0x69')]=isNaN(_0x3ae2cf['channelCount'])?null:_0x3ae2cf[_0x8042('0x6a')];_0x3944a1[_0x8042('0x6b')]=isNaN(_0x3ae2cf[_0x8042('0x6c')])?null:_0x3ae2cf['bitRate'];_0x3944a1[_0x8042('0x6d')]=isNaN(_0x3ae2cf[_0x8042('0x6e')])?null:_0x3ae2cf[_0x8042('0x6e')];});_0x16b111['on'](_0x8042('0x6f'),function(_0x275738){_0x3944a1[_0x8042('0x70')]=isNaN(_0x275738[_0x8042('0x67')])?null:_0x275738['duration']*0x3e8;_0x3944a1[_0x8042('0x71')]=isNaN(_0x275738[_0x8042('0x68')])?null:_0x275738[_0x8042('0x68')];_0x3944a1[_0x8042('0x72')]=isNaN(_0x275738[_0x8042('0x6a')])?null:_0x275738[_0x8042('0x6a')];_0x3944a1[_0x8042('0x73')]=isNaN(_0x275738[_0x8042('0x6c')])?null:_0x275738[_0x8042('0x6c')];_0x3944a1[_0x8042('0x74')]=isNaN(_0x275738[_0x8042('0x6e')])?null:_0x275738[_0x8042('0x6e')];});_0x16b111['on']('end',function(){fs[_0x8042('0x63')](_0x2a8beb,parseInt(_0x8042('0x64'),0x8));return db[_0x8042('0x42')]['create'](_0x3944a1)[_0x8042('0x25')](function(_0x1465a4){var _0x35541b={'role':_0x1158c7[_0x8042('0x75')][_0x8042('0x76')],'userProfileId':_0x1158c7[_0x8042('0x75')][_0x8042('0x77')]};if(!_0x35541b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35541b[_0x8042('0x76')]===_0x8042('0x78')){var _0x157888=_0x1465a4[_0x8042('0x27')]({'plain':!![]});return db[_0x8042('0x79')][_0x8042('0x4a')]({'where':{'name':_0x8042('0x28'),'userProfileId':_0x35541b[_0x8042('0x77')]},'raw':!![]})[_0x8042('0x25')](function(_0x68c747){if(_0x68c747&&_0x68c747[_0x8042('0x7a')]===0x0){return db[_0x8042('0x29')]['create']({'name':_0x157888['name'],'resourceId':_0x157888['id'],'type':_0x68c747[_0x8042('0x2a')],'sectionId':_0x68c747['id']},{})[_0x8042('0x25')](function(){return _0x1465a4;});}else{return _0x1465a4;}})[_0x8042('0x47')](function(_0x5e71f8){logger[_0x8042('0x65')](_0x8042('0x7b'),_0x5e71f8);throw _0x5e71f8;});}return _0x1465a4;})[_0x8042('0x25')](respondWithResult(_0x9b94a5,null))[_0x8042('0x47')](handleError(_0x9b94a5,null));});_0x16b111[_0x8042('0x7c')]();}catch(_0x512489){_0x9b94a5['status'](0x1f4)[_0x8042('0x2b')](_0x512489);}};exports[_0x8042('0x7d')]=function(_0x2fd40f,_0x19e273,_0x47b512){return db[_0x8042('0x42')][_0x8042('0x4a')]({'where':{'id':_0x2fd40f[_0x8042('0x4b')]['id']}})[_0x8042('0x25')](handleEntityNotFound(_0x19e273,null))['then'](saveUpdates(_[_0x8042('0x3d')](_0x2fd40f[_0x8042('0x75')],[_0x8042('0x2a'),_0x8042('0x7e')]),null))[_0x8042('0x25')](respondWithResult(_0x19e273,null))[_0x8042('0x47')](handleError(_0x19e273,null));};exports[_0x8042('0x7f')]=function(_0x4d10f1,_0x48bee5,_0xa58f41){return db['Sound'][_0x8042('0x4a')]({'where':{'id':_0x4d10f1[_0x8042('0x4b')]['id']}})[_0x8042('0x25')](function(_0x2dd2df){if(_0x2dd2df){return _0x2dd2df[_0x8042('0x26')]();}})[_0x8042('0x25')](function(_0x674855){var _0x3259c4=path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x5f'),util['format']('%s.%s',_0x674855[_0x8042('0x4c')],_0x674855[_0x8042('0x80')]));var _0x506723=path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x50'),util[_0x8042('0x56')]('%s.%s',_0x674855[_0x8042('0x4c')],_0x674855[_0x8042('0x4d')]));fs[_0x8042('0x81')](_0x3259c4);fs[_0x8042('0x81')](_0x506723);return _0x674855;})[_0x8042('0x25')](function(_0x8d5b0d){if(_0x8d5b0d){return _0x48bee5[_0x8042('0x1c')](0xcc)[_0x8042('0x1b')]();}})['then'](handleEntityNotFound(_0x48bee5,null))['catch'](handleError(_0x48bee5,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7d924c8..98cb410 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 _0xd8cd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x59ab7b,_0x4cfd23){var _0x1ee027=function(_0x53b229){while(--_0x53b229){_0x59ab7b['push'](_0x59ab7b['shift']());}};_0x1ee027(++_0x4cfd23);}(_0xd8cd,0x15c));var _0xdd8c=function(_0x53f808,_0x33901b){_0x53f808=_0x53f808-0x0;var _0x23a15a=_0xd8cd[_0x53f808];return _0x23a15a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xdd8c('0x0'));var moment=require(_0xdd8c('0x1'));var BPromise=require(_0xdd8c('0x2'));var rp=require(_0xdd8c('0x3'));var fs=require('fs');var path=require(_0xdd8c('0x4'));var rimraf=require(_0xdd8c('0x5'));var config=require(_0xdd8c('0x6'));var attributes=require(_0xdd8c('0x7'));module[_0xdd8c('0x8')]=function(_0x208afc,_0x5b6353){return _0x208afc[_0xdd8c('0x9')](_0xdd8c('0xa'),attributes,{'tableName':_0xdd8c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32d1=['Sound','lodash','../../config/logger','api','moment','request-promise','path','exports','define'];(function(_0x3d7cfe,_0x1f86c8){var _0x58dda0=function(_0x15789c){while(--_0x15789c){_0x3d7cfe['push'](_0x3d7cfe['shift']());}};_0x58dda0(++_0x1f86c8);}(_0x32d1,0xc7));var _0x132d=function(_0x1bf8f5,_0x28f62c){_0x1bf8f5=_0x1bf8f5-0x0;var _0x36a54e=_0x32d1[_0x1bf8f5];return _0x36a54e;};'use strict';var _=require(_0x132d('0x0'));var util=require('util');var logger=require(_0x132d('0x1'))(_0x132d('0x2'));var moment=require(_0x132d('0x3'));var BPromise=require('bluebird');var rp=require(_0x132d('0x4'));var fs=require('fs');var path=require(_0x132d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x132d('0x6')]=function(_0x58c71d,_0x49296c){return _0x58c71d[_0x132d('0x7')](_0x132d('0x8'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index cf1851d..78229f7 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 _0x6221=['Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','ShowSound','Sound','find','options','raw','where','attributes','include','model','map','debug','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x107d84,_0x4d826b){var _0x128546=function(_0x5a26d5){while(--_0x5a26d5){_0x107d84['push'](_0x107d84['shift']());}};_0x128546(++_0x4d826b);}(_0x6221,0x1f2));var _0x1622=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0x6221[_0x5959c9];return _0x4ffcbc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1622('0x0'));var BPromise=require(_0x1622('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1622('0x2'));var db=require(_0x1622('0x3'))['db'];var utils=require(_0x1622('0x4'));var logger=require('../../config/logger')(_0x1622('0x5'));var config=require(_0x1622('0x6'));var jayson=require(_0x1622('0x7'));var client=jayson['client'][_0x1622('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44495d,_0x402e98,_0x3ff5a5){return new BPromise(function(_0x3441fa,_0x2a20d8){return client[_0x1622('0x9')](_0x44495d,_0x3ff5a5)[_0x1622('0xa')](function(_0x25154a){logger[_0x1622('0xb')](_0x1622('0xc'),_0x402e98,_0x1622('0xd'));logger['debug'](_0x1622('0xe'),_0x402e98,_0x1622('0xd'),JSON['stringify'](_0x25154a));if(_0x25154a[_0x1622('0xf')]){if(_0x25154a[_0x1622('0xf')][_0x1622('0x10')]===0x1f4){logger[_0x1622('0xf')](_0x1622('0xc'),_0x402e98,_0x25154a['error'][_0x1622('0x11')]);return _0x2a20d8(_0x25154a[_0x1622('0xf')][_0x1622('0x11')]);}logger['error'](_0x1622('0xc'),_0x402e98,_0x25154a[_0x1622('0xf')][_0x1622('0x11')]);return _0x3441fa(_0x25154a[_0x1622('0xf')][_0x1622('0x11')]);}else{logger['info'](_0x1622('0xc'),_0x402e98,_0x1622('0xd'));_0x3441fa(_0x25154a['result'][_0x1622('0x11')]);}})['catch'](function(_0x12b2af){logger[_0x1622('0xf')](_0x1622('0xc'),_0x402e98,_0x12b2af);_0x2a20d8(_0x12b2af);});});}exports[_0x1622('0x12')]=function(_0xe971db){var _0x2059fe=this;return new Promise(function(_0x7325af,_0xddfa4c){return db[_0x1622('0x13')][_0x1622('0x14')]({'raw':_0xe971db[_0x1622('0x15')]?_0xe971db[_0x1622('0x15')][_0x1622('0x16')]===undefined?!![]:![]:!![],'where':_0xe971db[_0x1622('0x15')]?_0xe971db['options'][_0x1622('0x17')]||null:null,'attributes':_0xe971db['options']?_0xe971db['options'][_0x1622('0x18')]||null:null,'include':_0xe971db[_0x1622('0x15')]?_0xe971db[_0x1622('0x15')][_0x1622('0x19')]?_['map'](_0xe971db[_0x1622('0x15')]['include'],function(_0x241a78){return{'model':db[_0x241a78[_0x1622('0x1a')]],'as':_0x241a78['as'],'attributes':_0x241a78[_0x1622('0x18')],'include':_0x241a78[_0x1622('0x19')]?_['map'](_0x241a78[_0x1622('0x19')],function(_0x44063b){return{'model':db[_0x44063b[_0x1622('0x1a')]],'as':_0x44063b['as'],'attributes':_0x44063b['attributes'],'include':_0x44063b[_0x1622('0x19')]?_[_0x1622('0x1b')](_0x44063b['include'],function(_0x5b5321){return{'model':db[_0x5b5321[_0x1622('0x1a')]],'as':_0x5b5321['as'],'attributes':_0x5b5321['attributes']};}):[]};}):[]};}):[]:[]})[_0x1622('0xa')](function(_0x1b9ed0){logger[_0x1622('0xb')]('ShowSound',_0xe971db);logger[_0x1622('0x1c')]('ShowSound',_0xe971db,JSON['stringify'](_0x1b9ed0));_0x7325af(_0x1b9ed0);})[_0x1622('0x1d')](function(_0x251125){logger[_0x1622('0xf')](_0x1622('0x12'),_0x251125['message'],_0xe971db);_0xddfa4c(_0x2059fe[_0x1622('0xf')](0x1f4,_0x251125[_0x1622('0x11')]));});});}; \ No newline at end of file +var _0x9f95=['request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x28d3f2,_0x49138a){var _0x58dd17=function(_0x5b7881){while(--_0x5b7881){_0x28d3f2['push'](_0x28d3f2['shift']());}};_0x58dd17(++_0x49138a);}(_0x9f95,0x1e3));var _0x59f9=function(_0x4cfd78,_0x52355e){_0x4cfd78=_0x4cfd78-0x0;var _0xf4a95a=_0x9f95[_0x4cfd78];return _0xf4a95a;};'use strict';var _=require(_0x59f9('0x0'));var util=require(_0x59f9('0x1'));var moment=require(_0x59f9('0x2'));var BPromise=require(_0x59f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59f9('0x4'));var db=require(_0x59f9('0x5'))['db'];var utils=require(_0x59f9('0x6'));var logger=require(_0x59f9('0x7'))(_0x59f9('0x8'));var config=require(_0x59f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x59f9('0xa')][_0x59f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423c15,_0x21eb42,_0x3f0eee){return new BPromise(function(_0x479501,_0x2d38d2){return client[_0x59f9('0xc')](_0x423c15,_0x3f0eee)[_0x59f9('0xd')](function(_0x1dc943){logger[_0x59f9('0xe')](_0x59f9('0xf'),_0x21eb42,'request\x20sent');logger[_0x59f9('0x10')](_0x59f9('0x11'),_0x21eb42,_0x59f9('0x12'),JSON[_0x59f9('0x13')](_0x1dc943));if(_0x1dc943[_0x59f9('0x14')]){if(_0x1dc943['error'][_0x59f9('0x15')]===0x1f4){logger['error'](_0x59f9('0xf'),_0x21eb42,_0x1dc943[_0x59f9('0x14')][_0x59f9('0x16')]);return _0x2d38d2(_0x1dc943[_0x59f9('0x14')]['message']);}logger[_0x59f9('0x14')](_0x59f9('0xf'),_0x21eb42,_0x1dc943[_0x59f9('0x14')][_0x59f9('0x16')]);return _0x479501(_0x1dc943[_0x59f9('0x14')][_0x59f9('0x16')]);}else{logger[_0x59f9('0xe')](_0x59f9('0xf'),_0x21eb42,_0x59f9('0x12'));_0x479501(_0x1dc943[_0x59f9('0x17')][_0x59f9('0x16')]);}})[_0x59f9('0x18')](function(_0xd9f489){logger[_0x59f9('0x14')](_0x59f9('0xf'),_0x21eb42,_0xd9f489);_0x2d38d2(_0xd9f489);});});}exports[_0x59f9('0x19')]=function(_0x5f524){var _0x2394c3=this;return new Promise(function(_0x378dc9,_0x4ba902){return db[_0x59f9('0x1a')]['find']({'raw':_0x5f524[_0x59f9('0x1b')]?_0x5f524[_0x59f9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5f524[_0x59f9('0x1b')]?_0x5f524[_0x59f9('0x1b')][_0x59f9('0x1c')]||null:null,'attributes':_0x5f524[_0x59f9('0x1b')]?_0x5f524[_0x59f9('0x1b')][_0x59f9('0x1d')]||null:null,'include':_0x5f524[_0x59f9('0x1b')]?_0x5f524[_0x59f9('0x1b')][_0x59f9('0x1e')]?_[_0x59f9('0x1f')](_0x5f524[_0x59f9('0x1b')][_0x59f9('0x1e')],function(_0x21a0ea){return{'model':db[_0x21a0ea[_0x59f9('0x20')]],'as':_0x21a0ea['as'],'attributes':_0x21a0ea[_0x59f9('0x1d')],'include':_0x21a0ea[_0x59f9('0x1e')]?_[_0x59f9('0x1f')](_0x21a0ea[_0x59f9('0x1e')],function(_0x40fd2e){return{'model':db[_0x40fd2e[_0x59f9('0x20')]],'as':_0x40fd2e['as'],'attributes':_0x40fd2e[_0x59f9('0x1d')],'include':_0x40fd2e['include']?_[_0x59f9('0x1f')](_0x40fd2e['include'],function(_0x1f6015){return{'model':db[_0x1f6015[_0x59f9('0x20')]],'as':_0x1f6015['as'],'attributes':_0x1f6015['attributes']};}):[]};}):[]};}):[]:[]})[_0x59f9('0xd')](function(_0x4e81fe){logger[_0x59f9('0xe')](_0x59f9('0x19'),_0x5f524);logger[_0x59f9('0x10')]('ShowSound',_0x5f524,JSON[_0x59f9('0x13')](_0x4e81fe));_0x378dc9(_0x4e81fe);})[_0x59f9('0x18')](function(_0x5cd6f2){logger[_0x59f9('0x14')](_0x59f9('0x19'),_0x5cd6f2[_0x59f9('0x16')],_0x5f524);_0x4ba902(_0x2394c3['error'](0x1f4,_0x5cd6f2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a30c186..c91bb4d 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 _0x82d6=['index','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareMessage.controller','get'];(function(_0x4c87bf,_0x50eaa2){var _0x59f320=function(_0x53a5dd){while(--_0x53a5dd){_0x4c87bf['push'](_0x4c87bf['shift']());}};_0x59f320(++_0x50eaa2);}(_0x82d6,0xb4));var _0x682d=function(_0x4cb462,_0x2210cf){_0x4cb462=_0x4cb462-0x0;var _0x3e6296=_0x82d6[_0x4cb462];return _0x3e6296;};'use strict';var multer=require(_0x682d('0x0'));var util=require(_0x682d('0x1'));var path=require(_0x682d('0x2'));var timeout=require(_0x682d('0x3'));var express=require(_0x682d('0x4'));var router=express[_0x682d('0x5')]();var auth=require(_0x682d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x682d('0x7'));var controller=require(_0x682d('0x8'));router[_0x682d('0x9')]('/',auth['isAuthenticated'](),controller[_0x682d('0xa')]);router['get'](_0x682d('0xb'),auth[_0x682d('0xc')](),controller[_0x682d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x682d('0xe')]);router[_0x682d('0xf')](_0x682d('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x682d('0x10')]('/:id',auth[_0x682d('0xc')](),controller[_0x682d('0x11')]);module[_0x682d('0x12')]=router; \ No newline at end of file +var _0x9ab9=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x654cfc,_0x4b9dc7){var _0x20a072=function(_0x2e63b1){while(--_0x2e63b1){_0x654cfc['push'](_0x654cfc['shift']());}};_0x20a072(++_0x4b9dc7);}(_0x9ab9,0x1cb));var _0x99ab=function(_0x20926f,_0x179176){_0x20926f=_0x20926f-0x0;var _0x5c260e=_0x9ab9[_0x20926f];return _0x5c260e;};'use strict';var multer=require(_0x99ab('0x0'));var util=require(_0x99ab('0x1'));var path=require(_0x99ab('0x2'));var timeout=require(_0x99ab('0x3'));var express=require(_0x99ab('0x4'));var router=express[_0x99ab('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x99ab('0x6'));var controller=require(_0x99ab('0x7'));router[_0x99ab('0x8')]('/',auth[_0x99ab('0x9')](),controller[_0x99ab('0xa')]);router[_0x99ab('0x8')](_0x99ab('0xb'),auth[_0x99ab('0x9')](),controller[_0x99ab('0xc')]);router[_0x99ab('0xd')]('/',auth['isAuthenticated'](),controller[_0x99ab('0xe')]);router[_0x99ab('0xf')](_0x99ab('0xb'),auth['isAuthenticated'](),controller[_0x99ab('0x10')]);router[_0x99ab('0x11')](_0x99ab('0xb'),auth[_0x99ab('0x9')](),controller[_0x99ab('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b3fc86f..cbe973d 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 _0xc37e=['exports','TEXT','medium','ENUM','out'];(function(_0xe6b369,_0x33a05a){var _0x566653=function(_0xcf0a8b){while(--_0xcf0a8b){_0xe6b369['push'](_0xe6b369['shift']());}};_0x566653(++_0x33a05a);}(_0xc37e,0xbe));var _0xec37=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc37e[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module[_0xec37('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xec37('0x1')](_0xec37('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xec37('0x3')]('in',_0xec37('0x4')),'defaultValue':_0xec37('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0x91db=['STRING','medium','ENUM','out','exports'];(function(_0x3a113d,_0x1ea01b){var _0x578db6=function(_0x1924f1){while(--_0x1924f1){_0x3a113d['push'](_0x3a113d['shift']());}};_0x578db6(++_0x1ea01b);}(_0x91db,0xc2));var _0xb91d=function(_0x18934a,_0x1c2b84){_0x18934a=_0x18934a-0x0;var _0x5c731f=_0x91db[_0x18934a];return _0x5c731f;};'use strict';var Sequelize=require('sequelize');module[_0xb91d('0x0')]={'uniqueid':{'type':Sequelize[_0xb91d('0x1')]},'body':{'type':Sequelize['TEXT'](_0xb91d('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xb91d('0x3')]('in',_0xb91d('0x4')),'defaultValue':_0xb91d('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c380590..39cd197 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 _0x0653=['type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','merge','where','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','limit','set','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes'];(function(_0xf09798,_0x37ea4a){var _0x343b2=function(_0xad1523){while(--_0xad1523){_0xf09798['push'](_0xf09798['shift']());}};_0x343b2(++_0x37ea4a);}(_0x0653,0x12e));var _0x3065=function(_0x1f1b39,_0x327afc){_0x1f1b39=_0x1f1b39-0x0;var _0x186af7=_0x0653[_0x1f1b39];return _0x186af7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3065('0x0'));var rimraf=require(_0x3065('0x1'));var zipdir=require(_0x3065('0x2'));var jsonpatch=require(_0x3065('0x3'));var rp=require('request-promise');var moment=require(_0x3065('0x4'));var BPromise=require(_0x3065('0x5'));var Mustache=require(_0x3065('0x6'));var util=require('util');var path=require(_0x3065('0x7'));var sox=require(_0x3065('0x8'));var csv=require(_0x3065('0x9'));var ejs=require(_0x3065('0xa'));var fs=require('fs');var _=require(_0x3065('0xb'));var squel=require(_0x3065('0xc'));var crypto=require(_0x3065('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3065('0x9'));var querystring=require(_0x3065('0xe'));var Papa=require(_0x3065('0xf'));var Redis=require(_0x3065('0x10'));var authService=require(_0x3065('0x11'));var qs=require(_0x3065('0x12'));var as=require(_0x3065('0x13'));var hardwareService=require(_0x3065('0x14'));var logger=require(_0x3065('0x15'))('api');var utils=require(_0x3065('0x16'));var config=require(_0x3065('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x423e9c,_0x27d85b){_0x27d85b=_0x27d85b||0xcc;return function(_0x1f8c50){if(_0x1f8c50){return _0x423e9c['sendStatus'](_0x27d85b);}return _0x423e9c[_0x3065('0x18')](_0x27d85b)[_0x3065('0x19')]();};}function respondWithResult(_0x29e79d,_0x3a3adf){_0x3a3adf=_0x3a3adf||0xc8;return function(_0x5b9d3d){if(_0x5b9d3d){return _0x29e79d[_0x3065('0x18')](_0x3a3adf)[_0x3065('0x1a')](_0x5b9d3d);}};}function respondWithFilteredResult(_0x550746,_0x175d0d){return function(_0x436ddf){if(_0x436ddf){var _0x1d7d87=_0x436ddf['count'],_0x1c2d5d=_0x175d0d[_0x3065('0x1b')],_0x13f52b=_0x175d0d['offset']+_0x175d0d[_0x3065('0x1c')],_0x5cde41;if(_0x13f52b>=_0x1d7d87){_0x13f52b=_0x1d7d87;_0x5cde41=0xc8;}else{_0x5cde41=0xce;}_0x550746['status'](_0x5cde41);return _0x550746[_0x3065('0x1d')]('Content-Range',_0x1c2d5d+'-'+_0x13f52b+'/'+_0x1d7d87)[_0x3065('0x1a')](_0x436ddf);}return null;};}function patchUpdates(_0x4bcc55){return function(_0x12ec88){try{jsonpatch[_0x3065('0x1e')](_0x12ec88,_0x4bcc55,!![]);}catch(_0x462df4){return BPromise[_0x3065('0x1f')](_0x462df4);}return _0x12ec88['save']();};}function saveUpdates(_0x15efe1,_0x25491e){return function(_0x58f59c){if(_0x58f59c){return _0x58f59c['update'](_0x15efe1)['then'](function(_0x3b6020){return _0x3b6020;});}return null;};}function removeEntity(_0x3e830c,_0x40d667){return function(_0x133452){if(_0x133452){return _0x133452[_0x3065('0x20')]()[_0x3065('0x21')](function(){_0x3e830c[_0x3065('0x18')](0xcc)[_0x3065('0x19')]();});}};}function handleEntityNotFound(_0x44a7d8,_0x489f55){return function(_0x528604){if(!_0x528604){_0x44a7d8[_0x3065('0x22')](0x194);}return _0x528604;};}function handleError(_0x3cec4e,_0x34f6fc){_0x34f6fc=_0x34f6fc||0x1f4;return function(_0x41935a){logger[_0x3065('0x23')](_0x41935a[_0x3065('0x24')]);if(_0x41935a[_0x3065('0x25')]){delete _0x41935a['name'];}_0x3cec4e[_0x3065('0x18')](_0x34f6fc)[_0x3065('0x26')](_0x41935a);};}exports[_0x3065('0x27')]=function(_0x41bc1b,_0x679ec){var _0x42154f={},_0x2a6794={},_0x2d8225={'count':0x0,'rows':[]};var _0x323a85=_[_0x3065('0x28')](db[_0x3065('0x29')][_0x3065('0x2a')],function(_0x24e03a){return{'name':_0x24e03a['fieldName'],'type':_0x24e03a[_0x3065('0x2b')]['key']};});_0x2a6794[_0x3065('0x2c')]=_[_0x3065('0x28')](_0x323a85,_0x3065('0x25'));_0x2a6794[_0x3065('0x2d')]=_[_0x3065('0x2e')](_0x41bc1b[_0x3065('0x2d')]);_0x2a6794[_0x3065('0x2f')]=_[_0x3065('0x30')](_0x2a6794[_0x3065('0x2c')],_0x2a6794[_0x3065('0x2d')]);_0x42154f[_0x3065('0x31')]=_[_0x3065('0x30')](_0x2a6794[_0x3065('0x2c')],qs[_0x3065('0x32')](_0x41bc1b[_0x3065('0x2d')][_0x3065('0x32')]));_0x42154f[_0x3065('0x31')]=_0x42154f[_0x3065('0x31')]['length']?_0x42154f[_0x3065('0x31')]:_0x2a6794['model'];if(!_0x41bc1b[_0x3065('0x2d')]['hasOwnProperty'](_0x3065('0x33'))){_0x42154f['limit']=qs[_0x3065('0x1c')](_0x41bc1b[_0x3065('0x2d')]['limit']);_0x42154f[_0x3065('0x1b')]=qs[_0x3065('0x1b')](_0x41bc1b[_0x3065('0x2d')]['offset']);}_0x42154f['order']=qs[_0x3065('0x34')](_0x41bc1b['query'][_0x3065('0x34')]);_0x42154f['where']=qs[_0x3065('0x2f')](_[_0x3065('0x35')](_0x41bc1b['query'],_0x2a6794['filters']),_0x323a85);if(_0x41bc1b[_0x3065('0x2d')]['filter']){_0x42154f['where']=_[_0x3065('0x36')](_0x42154f[_0x3065('0x37')],{'$or':_[_0x3065('0x28')](_0x323a85,function(_0x1b13af){if(_0x1b13af[_0x3065('0x2b')]!=='VIRTUAL'){var _0x26e1d8={};_0x26e1d8[_0x1b13af[_0x3065('0x25')]]={'$like':'%'+_0x41bc1b[_0x3065('0x2d')]['filter']+'%'};return _0x26e1d8;}})});}_0x42154f=_[_0x3065('0x36')]({},_0x42154f,_0x41bc1b[_0x3065('0x38')]);var _0xb087da={'where':_0x42154f[_0x3065('0x37')]};return db[_0x3065('0x29')][_0x3065('0x39')](_0xb087da)[_0x3065('0x21')](function(_0x29e6b5){_0x2d8225[_0x3065('0x39')]=_0x29e6b5;if(_0x41bc1b['query']['includeAll']){_0x42154f[_0x3065('0x3a')]=[{'all':!![]}];}return db[_0x3065('0x29')][_0x3065('0x3b')](_0x42154f);})[_0x3065('0x21')](function(_0x550879){_0x2d8225[_0x3065('0x3c')]=_0x550879;return _0x2d8225;})[_0x3065('0x21')](respondWithFilteredResult(_0x679ec,_0x42154f))[_0x3065('0x3d')](handleError(_0x679ec,null));};exports[_0x3065('0x3e')]=function(_0x4d44ad,_0x1086ff){var _0x25e0d1={'raw':!![],'where':{'id':_0x4d44ad['params']['id']}},_0x9b5c9e={};_0x9b5c9e[_0x3065('0x2c')]=_[_0x3065('0x2e')](db[_0x3065('0x29')][_0x3065('0x2a')]);_0x9b5c9e[_0x3065('0x2d')]=_[_0x3065('0x2e')](_0x4d44ad[_0x3065('0x2d')]);_0x9b5c9e[_0x3065('0x2f')]=_[_0x3065('0x30')](_0x9b5c9e[_0x3065('0x2c')],_0x9b5c9e['query']);_0x25e0d1[_0x3065('0x31')]=_[_0x3065('0x30')](_0x9b5c9e[_0x3065('0x2c')],qs['fields'](_0x4d44ad['query'][_0x3065('0x32')]));_0x25e0d1[_0x3065('0x31')]=_0x25e0d1['attributes']['length']?_0x25e0d1[_0x3065('0x31')]:_0x9b5c9e[_0x3065('0x2c')];if(_0x4d44ad['query'][_0x3065('0x3f')]){_0x25e0d1[_0x3065('0x3a')]=[{'all':!![]}];}_0x25e0d1=_[_0x3065('0x36')]({},_0x25e0d1,_0x4d44ad[_0x3065('0x38')]);return db[_0x3065('0x29')][_0x3065('0x40')](_0x25e0d1)[_0x3065('0x21')](handleEntityNotFound(_0x1086ff,null))['then'](respondWithResult(_0x1086ff,null))['catch'](handleError(_0x1086ff,null));};exports['create']=function(_0x1cd5e5,_0x260866){return db[_0x3065('0x29')][_0x3065('0x41')](_0x1cd5e5[_0x3065('0x42')],{})[_0x3065('0x21')](respondWithResult(_0x260866,0xc9))[_0x3065('0x3d')](handleError(_0x260866,null));};exports[_0x3065('0x43')]=function(_0xa78c59,_0x203261){if(_0xa78c59[_0x3065('0x42')]['id']){delete _0xa78c59[_0x3065('0x42')]['id'];}return db[_0x3065('0x29')][_0x3065('0x40')]({'where':{'id':_0xa78c59[_0x3065('0x44')]['id']}})[_0x3065('0x21')](handleEntityNotFound(_0x203261,null))[_0x3065('0x21')](saveUpdates(_0xa78c59[_0x3065('0x42')],null))[_0x3065('0x21')](respondWithResult(_0x203261,null))[_0x3065('0x3d')](handleError(_0x203261,null));};exports[_0x3065('0x20')]=function(_0x3cb2ef,_0x47a2a5){return db[_0x3065('0x29')][_0x3065('0x40')]({'where':{'id':_0x3cb2ef[_0x3065('0x44')]['id']}})[_0x3065('0x21')](handleEntityNotFound(_0x47a2a5,null))['then'](removeEntity(_0x47a2a5,null))[_0x3065('0x3d')](handleError(_0x47a2a5,null));}; \ No newline at end of file +var _0x5fad=['body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','SquareMessage','count','includeAll','include','findAll','catch','show','params','find','create'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0x5fad,0xd0));var _0xd5fa=function(_0x22d300,_0x23c213){_0x22d300=_0x22d300-0x0;var _0x4d2a92=_0x5fad[_0x22d300];return _0x4d2a92;};'use strict';var pdf=require(_0xd5fa('0x0'));var emlformat=require(_0xd5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd5fa('0x2'));var jsonpatch=require(_0xd5fa('0x3'));var rp=require(_0xd5fa('0x4'));var moment=require(_0xd5fa('0x5'));var BPromise=require(_0xd5fa('0x6'));var Mustache=require(_0xd5fa('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd5fa('0x8'));var csv=require(_0xd5fa('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd5fa('0xa'));var squel=require(_0xd5fa('0xb'));var crypto=require('crypto');var jsforce=require(_0xd5fa('0xc'));var deskjs=require(_0xd5fa('0xd'));var toCsv=require(_0xd5fa('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd5fa('0xe'));var authService=require(_0xd5fa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd5fa('0x10'));var hardwareService=require(_0xd5fa('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xd5fa('0x12'));var config=require(_0xd5fa('0x13'));var db=require(_0xd5fa('0x14'))['db'];function respondWithStatusCode(_0x20f8bb,_0x36d0db){_0x36d0db=_0x36d0db||0xcc;return function(_0x44665d){if(_0x44665d){return _0x20f8bb['sendStatus'](_0x36d0db);}return _0x20f8bb[_0xd5fa('0x15')](_0x36d0db)[_0xd5fa('0x16')]();};}function respondWithResult(_0x16f210,_0x2dfaf0){_0x2dfaf0=_0x2dfaf0||0xc8;return function(_0x384a7c){if(_0x384a7c){return _0x16f210[_0xd5fa('0x15')](_0x2dfaf0)['json'](_0x384a7c);}};}function respondWithFilteredResult(_0x5a22e5,_0x2ea4b2){return function(_0x2337a0){if(_0x2337a0){var _0xf64996=_0x2337a0['count'],_0x1e52c9=_0x2ea4b2[_0xd5fa('0x17')],_0xa18b64=_0x2ea4b2[_0xd5fa('0x17')]+_0x2ea4b2['limit'],_0x551053;if(_0xa18b64>=_0xf64996){_0xa18b64=_0xf64996;_0x551053=0xc8;}else{_0x551053=0xce;}_0x5a22e5['status'](_0x551053);return _0x5a22e5['set'](_0xd5fa('0x18'),_0x1e52c9+'-'+_0xa18b64+'/'+_0xf64996)[_0xd5fa('0x19')](_0x2337a0);}return null;};}function patchUpdates(_0x31a453){return function(_0x4415b6){try{jsonpatch[_0xd5fa('0x1a')](_0x4415b6,_0x31a453,!![]);}catch(_0x2a3ea0){return BPromise[_0xd5fa('0x1b')](_0x2a3ea0);}return _0x4415b6[_0xd5fa('0x1c')]();};}function saveUpdates(_0x5a7119,_0x197705){return function(_0x23fd1e){if(_0x23fd1e){return _0x23fd1e[_0xd5fa('0x1d')](_0x5a7119)[_0xd5fa('0x1e')](function(_0x1f1201){return _0x1f1201;});}return null;};}function removeEntity(_0xe2e783,_0x94371f){return function(_0x4b5af7){if(_0x4b5af7){return _0x4b5af7[_0xd5fa('0x1f')]()[_0xd5fa('0x1e')](function(){_0xe2e783['status'](0xcc)[_0xd5fa('0x16')]();});}};}function handleEntityNotFound(_0x1faad6,_0x56ffb9){return function(_0x2405ed){if(!_0x2405ed){_0x1faad6[_0xd5fa('0x20')](0x194);}return _0x2405ed;};}function handleError(_0x3b9301,_0x12fb72){_0x12fb72=_0x12fb72||0x1f4;return function(_0x3f8059){logger['error'](_0x3f8059['stack']);if(_0x3f8059[_0xd5fa('0x21')]){delete _0x3f8059[_0xd5fa('0x21')];}_0x3b9301[_0xd5fa('0x15')](_0x12fb72)[_0xd5fa('0x22')](_0x3f8059);};}exports[_0xd5fa('0x23')]=function(_0x2a303f,_0x59b414){var _0x33fe29={},_0x566fe0={},_0x5cce41={'count':0x0,'rows':[]};var _0x9435b7=_[_0xd5fa('0x24')](db['SquareMessage'][_0xd5fa('0x25')],function(_0xc326ca){return{'name':_0xc326ca[_0xd5fa('0x26')],'type':_0xc326ca[_0xd5fa('0x27')]['key']};});_0x566fe0[_0xd5fa('0x28')]=_['map'](_0x9435b7,_0xd5fa('0x21'));_0x566fe0['query']=_['keys'](_0x2a303f[_0xd5fa('0x29')]);_0x566fe0[_0xd5fa('0x2a')]=_['intersection'](_0x566fe0[_0xd5fa('0x28')],_0x566fe0[_0xd5fa('0x29')]);_0x33fe29[_0xd5fa('0x2b')]=_[_0xd5fa('0x2c')](_0x566fe0[_0xd5fa('0x28')],qs[_0xd5fa('0x2d')](_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x2d')]));_0x33fe29[_0xd5fa('0x2b')]=_0x33fe29['attributes'][_0xd5fa('0x2e')]?_0x33fe29[_0xd5fa('0x2b')]:_0x566fe0[_0xd5fa('0x28')];if(!_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x2f')](_0xd5fa('0x30'))){_0x33fe29['limit']=qs[_0xd5fa('0x31')](_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x31')]);_0x33fe29[_0xd5fa('0x17')]=qs[_0xd5fa('0x17')](_0x2a303f['query'][_0xd5fa('0x17')]);}_0x33fe29[_0xd5fa('0x32')]=qs['sort'](_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x33')]);_0x33fe29[_0xd5fa('0x34')]=qs[_0xd5fa('0x2a')](_[_0xd5fa('0x35')](_0x2a303f[_0xd5fa('0x29')],_0x566fe0['filters']),_0x9435b7);if(_0x2a303f[_0xd5fa('0x29')]['filter']){_0x33fe29[_0xd5fa('0x34')]=_['merge'](_0x33fe29['where'],{'$or':_[_0xd5fa('0x24')](_0x9435b7,function(_0x36961a){if(_0x36961a['type']!==_0xd5fa('0x36')){var _0x1d6539={};_0x1d6539[_0x36961a['name']]={'$like':'%'+_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x37')]+'%'};return _0x1d6539;}})});}_0x33fe29=_[_0xd5fa('0x38')]({},_0x33fe29,_0x2a303f[_0xd5fa('0x39')]);var _0xf5e5f5={'where':_0x33fe29['where']};return db[_0xd5fa('0x3a')][_0xd5fa('0x3b')](_0xf5e5f5)[_0xd5fa('0x1e')](function(_0x320ab0){_0x5cce41[_0xd5fa('0x3b')]=_0x320ab0;if(_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x3c')]){_0x33fe29[_0xd5fa('0x3d')]=[{'all':!![]}];}return db[_0xd5fa('0x3a')][_0xd5fa('0x3e')](_0x33fe29);})['then'](function(_0xae23c5){_0x5cce41['rows']=_0xae23c5;return _0x5cce41;})[_0xd5fa('0x1e')](respondWithFilteredResult(_0x59b414,_0x33fe29))[_0xd5fa('0x3f')](handleError(_0x59b414,null));};exports[_0xd5fa('0x40')]=function(_0x2c7975,_0x3b154c){var _0x10e0e6={'raw':!![],'where':{'id':_0x2c7975[_0xd5fa('0x41')]['id']}},_0x2096ac={};_0x2096ac[_0xd5fa('0x28')]=_['keys'](db[_0xd5fa('0x3a')]['rawAttributes']);_0x2096ac['query']=_['keys'](_0x2c7975[_0xd5fa('0x29')]);_0x2096ac[_0xd5fa('0x2a')]=_[_0xd5fa('0x2c')](_0x2096ac[_0xd5fa('0x28')],_0x2096ac[_0xd5fa('0x29')]);_0x10e0e6[_0xd5fa('0x2b')]=_[_0xd5fa('0x2c')](_0x2096ac['model'],qs[_0xd5fa('0x2d')](_0x2c7975[_0xd5fa('0x29')][_0xd5fa('0x2d')]));_0x10e0e6[_0xd5fa('0x2b')]=_0x10e0e6[_0xd5fa('0x2b')]['length']?_0x10e0e6[_0xd5fa('0x2b')]:_0x2096ac[_0xd5fa('0x28')];if(_0x2c7975[_0xd5fa('0x29')][_0xd5fa('0x3c')]){_0x10e0e6[_0xd5fa('0x3d')]=[{'all':!![]}];}_0x10e0e6=_['merge']({},_0x10e0e6,_0x2c7975[_0xd5fa('0x39')]);return db[_0xd5fa('0x3a')][_0xd5fa('0x42')](_0x10e0e6)['then'](handleEntityNotFound(_0x3b154c,null))[_0xd5fa('0x1e')](respondWithResult(_0x3b154c,null))[_0xd5fa('0x3f')](handleError(_0x3b154c,null));};exports[_0xd5fa('0x43')]=function(_0x4bf6c7,_0x204b43){return db[_0xd5fa('0x3a')]['create'](_0x4bf6c7['body'],{})[_0xd5fa('0x1e')](respondWithResult(_0x204b43,0xc9))[_0xd5fa('0x3f')](handleError(_0x204b43,null));};exports[_0xd5fa('0x1d')]=function(_0x2ea897,_0x462afa){if(_0x2ea897[_0xd5fa('0x44')]['id']){delete _0x2ea897[_0xd5fa('0x44')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x2ea897[_0xd5fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x462afa,null))[_0xd5fa('0x1e')](saveUpdates(_0x2ea897[_0xd5fa('0x44')],null))['then'](respondWithResult(_0x462afa,null))[_0xd5fa('0x3f')](handleError(_0x462afa,null));};exports[_0xd5fa('0x1f')]=function(_0x7bf451,_0x9698db){return db[_0xd5fa('0x3a')][_0xd5fa('0x42')]({'where':{'id':_0x7bf451[_0xd5fa('0x41')]['id']}})[_0xd5fa('0x1e')](handleEntityNotFound(_0x9698db,null))[_0xd5fa('0x1e')](removeEntity(_0x9698db,null))[_0xd5fa('0x3f')](handleError(_0x9698db,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 0299a08..6f5bf87 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['lodash','moment','bluebird','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x4bc4f3,_0xb93bd2){var _0x478fab=function(_0x2404ea){while(--_0x2404ea){_0x4bc4f3['push'](_0x4bc4f3['shift']());}};_0x478fab(++_0xb93bd2);}(_0x2675,0x75));var _0x5267=function(_0x49cf1a,_0x98f6ed){_0x49cf1a=_0x49cf1a-0x0;var _0x5ab8ba=_0x2675[_0x49cf1a];return _0x5ab8ba;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./squareMessage.attributes','define','square_messages','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2847ec,_0x123650){var _0x504b67=function(_0x5448d4){while(--_0x5448d4){_0x2847ec['push'](_0x2847ec['shift']());}};_0x504b67(++_0x123650);}(_0x31f0,0xb7));var _0x031f=function(_0x5ef6af,_0x534c46){_0x5ef6af=_0x5ef6af-0x0;var _0x3c1b5c=_0x31f0[_0x5ef6af];return _0x3c1b5c;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('SquareMessage',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 253e2f5..49b0ffc 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 _0xe2fe=['request\x20sent','result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','stringify','error','message'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});}exports[_0xee2f('0x12')]=function(_0x502eb6){var _0x550da7=this;return new Promise(function(_0x40b5bc,_0x5a5078){return db[_0xee2f('0x13')][_0xee2f('0x14')](_0x502eb6[_0xee2f('0x15')],{'raw':_0x502eb6['options']?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x17')]===undefined?!![]:![]:!![]})[_0xee2f('0xa')](function(_0x21fdf4){logger[_0xee2f('0xb')]('CreateSquareMessage',_0x502eb6);logger['debug'](_0xee2f('0x12'),_0x502eb6,JSON[_0xee2f('0xd')](_0x21fdf4));_0x40b5bc(_0x21fdf4);})[_0xee2f('0x18')](function(_0x203b2f){logger[_0xee2f('0xe')](_0xee2f('0x12'),_0x203b2f[_0xee2f('0xf')],_0x502eb6);_0x5a5078(_0x550da7['error'](0x1f4,_0x203b2f[_0xee2f('0xf')]));});});}; \ No newline at end of file +var _0x446c=['http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x37a516,_0x9a71bb){var _0x5ca4c9=function(_0xcd8711){while(--_0xcd8711){_0x37a516['push'](_0x37a516['shift']());}};_0x5ca4c9(++_0x9a71bb);}(_0x446c,0x156));var _0xc446=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0x446c[_0x290694];return _0x5a0f2e;};'use strict';var _=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var moment=require(_0xc446('0x2'));var BPromise=require(_0xc446('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc446('0x4'));var db=require(_0xc446('0x5'))['db'];var utils=require(_0xc446('0x6'));var logger=require('../../config/logger')(_0xc446('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc446('0x8')][_0xc446('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578895,_0x549fac,_0x2eea75){return new BPromise(function(_0x3e9e70,_0x1ddeaf){return client[_0xc446('0xa')](_0x578895,_0x2eea75)[_0xc446('0xb')](function(_0x4a2a80){logger[_0xc446('0xc')](_0xc446('0xd'),_0x549fac,_0xc446('0xe'));logger[_0xc446('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x549fac,_0xc446('0xe'),JSON[_0xc446('0x10')](_0x4a2a80));if(_0x4a2a80[_0xc446('0x11')]){if(_0x4a2a80[_0xc446('0x11')][_0xc446('0x12')]===0x1f4){logger[_0xc446('0x11')](_0xc446('0xd'),_0x549fac,_0x4a2a80[_0xc446('0x11')][_0xc446('0x13')]);return _0x1ddeaf(_0x4a2a80[_0xc446('0x11')][_0xc446('0x13')]);}logger[_0xc446('0x11')](_0xc446('0xd'),_0x549fac,_0x4a2a80[_0xc446('0x11')][_0xc446('0x13')]);return _0x3e9e70(_0x4a2a80[_0xc446('0x11')][_0xc446('0x13')]);}else{logger[_0xc446('0xc')](_0xc446('0xd'),_0x549fac,'request\x20sent');_0x3e9e70(_0x4a2a80[_0xc446('0x14')][_0xc446('0x13')]);}})[_0xc446('0x15')](function(_0x4690c5){logger[_0xc446('0x11')](_0xc446('0xd'),_0x549fac,_0x4690c5);_0x1ddeaf(_0x4690c5);});});}exports[_0xc446('0x16')]=function(_0x30038f){var _0x16f337=this;return new Promise(function(_0x606af1,_0x51fa01){return db[_0xc446('0x17')][_0xc446('0x18')](_0x30038f['body'],{'raw':_0x30038f[_0xc446('0x19')]?_0x30038f[_0xc446('0x19')][_0xc446('0x1a')]===undefined?!![]:![]:!![]})[_0xc446('0xb')](function(_0x409a8e){logger[_0xc446('0xc')](_0xc446('0x16'),_0x30038f);logger[_0xc446('0xf')](_0xc446('0x16'),_0x30038f,JSON[_0xc446('0x10')](_0x409a8e));_0x606af1(_0x409a8e);})['catch'](function(_0x35aedc){logger[_0xc446('0x11')](_0xc446('0x16'),_0x35aedc[_0xc446('0x13')],_0x30038f);_0x51fa01(_0x16f337[_0xc446('0x11')](0x1f4,_0x35aedc[_0xc446('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 677edb6..37cd390 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 _0xf0cf=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0cf,0x1a4));var _0xff0c=function(_0x2024a8,_0x1f88bb){_0x2024a8=_0x2024a8-0x0;var _0x4bdf10=_0xf0cf[_0x2024a8];return _0x4bdf10;};'use strict';var multer=require(_0xff0c('0x0'));var util=require(_0xff0c('0x1'));var path=require(_0xff0c('0x2'));var timeout=require(_0xff0c('0x3'));var express=require(_0xff0c('0x4'));var router=express[_0xff0c('0x5')]();var auth=require(_0xff0c('0x6'));var interaction=require(_0xff0c('0x7'));var config=require(_0xff0c('0x8'));var controller=require(_0xff0c('0x9'));router[_0xff0c('0xa')]('/',auth[_0xff0c('0xb')](),controller[_0xff0c('0xc')]);router[_0xff0c('0xa')](_0xff0c('0xd'),auth[_0xff0c('0xb')](),controller['show']);router[_0xff0c('0xa')](_0xff0c('0xe'),auth[_0xff0c('0xb')](),timeout(_0xff0c('0xf')),controller[_0xff0c('0x10')]);router[_0xff0c('0x11')]('/',auth[_0xff0c('0xb')](),controller[_0xff0c('0x12')]);router['put'](_0xff0c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xff0c('0x13')](_0xff0c('0xd'),auth[_0xff0c('0xb')](),controller[_0xff0c('0x14')]);module[_0xff0c('0x15')]=router; \ No newline at end of file +var _0xd4f7=['isAuthenticated','/:id','get','/:id/test','15s','test','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x279294,_0x45231d){var _0x43df63=function(_0x4fa3ce){while(--_0x4fa3ce){_0x279294['push'](_0x279294['shift']());}};_0x43df63(++_0x45231d);}(_0xd4f7,0x11d));var _0x7d4f=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xd4f7[_0x4c1ec2];return _0x3f6f1c;};'use strict';var multer=require('multer');var util=require(_0x7d4f('0x0'));var path=require(_0x7d4f('0x1'));var timeout=require(_0x7d4f('0x2'));var express=require(_0x7d4f('0x3'));var router=express[_0x7d4f('0x4')]();var auth=require(_0x7d4f('0x5'));var interaction=require(_0x7d4f('0x6'));var config=require(_0x7d4f('0x7'));var controller=require(_0x7d4f('0x8'));router['get']('/',auth[_0x7d4f('0x9')](),controller['index']);router['get'](_0x7d4f('0xa'),auth[_0x7d4f('0x9')](),controller['show']);router[_0x7d4f('0xb')](_0x7d4f('0xc'),auth[_0x7d4f('0x9')](),timeout(_0x7d4f('0xd')),controller[_0x7d4f('0xe')]);router[_0x7d4f('0xf')]('/',auth[_0x7d4f('0x9')](),controller[_0x7d4f('0x10')]);router[_0x7d4f('0x11')](_0x7d4f('0xa'),auth[_0x7d4f('0x9')](),controller[_0x7d4f('0x12')]);router[_0x7d4f('0x13')](_0x7d4f('0xa'),auth[_0x7d4f('0x9')](),controller[_0x7d4f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0af42ad..8a2f5b8 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 _0x5944=['exports'];(function(_0xce7128,_0x2620dd){var _0x355e8d=function(_0x43483d){while(--_0x43483d){_0xce7128['push'](_0xce7128['shift']());}};_0x355e8d(++_0x2620dd);}(_0x5944,0x108));var _0x4594=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5944[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x4594('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5ddf=['sequelize','exports','STRING'];(function(_0x151452,_0x4c13bb){var _0xe79264=function(_0x4d098a){while(--_0x4d098a){_0x151452['push'](_0x151452['shift']());}};_0xe79264(++_0x4c13bb);}(_0x5ddf,0x150));var _0xf5dd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5ddf[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xf5dd('0x0'));module[_0xf5dd('0x1')]={'name':{'type':Sequelize[_0xf5dd('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 6d8f4cb..1b85fa3 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 _0x4e1f=['options','includeAll','include','findAll','rows','catch','show','params','attributes','find','create','body','user','role','ODBC','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter'];(function(_0x450381,_0x490f08){var _0x150dc3=function(_0x47e3bf){while(--_0x47e3bf){_0x450381['push'](_0x450381['shift']());}};_0x150dc3(++_0x490f08);}(_0x4e1f,0xc4));var _0xf4e1=function(_0x42fd3e,_0x3850fe){_0x42fd3e=_0x42fd3e-0x0;var _0x3f9609=_0x4e1f[_0x42fd3e];return _0x3f9609;};'use strict';var pdf=require(_0xf4e1('0x0'));var emlformat=require(_0xf4e1('0x1'));var rimraf=require(_0xf4e1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4e1('0x3'));var rp=require(_0xf4e1('0x4'));var moment=require(_0xf4e1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf4e1('0x6'));var util=require(_0xf4e1('0x7'));var path=require('path');var sox=require(_0xf4e1('0x8'));var csv=require(_0xf4e1('0x9'));var ejs=require(_0xf4e1('0xa'));var fs=require('fs');var _=require(_0xf4e1('0xb'));var squel=require('squel');var crypto=require(_0xf4e1('0xc'));var jsforce=require(_0xf4e1('0xd'));var deskjs=require(_0xf4e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf4e1('0xf'));var Papa=require(_0xf4e1('0x10'));var Redis=require(_0xf4e1('0x11'));var authService=require(_0xf4e1('0x12'));var qs=require(_0xf4e1('0x13'));var as=require(_0xf4e1('0x14'));var hardwareService=require(_0xf4e1('0x15'));var logger=require(_0xf4e1('0x16'))(_0xf4e1('0x17'));var utils=require(_0xf4e1('0x18'));var config=require(_0xf4e1('0x19'));var db=require(_0xf4e1('0x1a'))['db'];function respondWithStatusCode(_0x2eb3ed,_0x471f9c){_0x471f9c=_0x471f9c||0xcc;return function(_0x318249){if(_0x318249){return _0x2eb3ed[_0xf4e1('0x1b')](_0x471f9c);}return _0x2eb3ed['status'](_0x471f9c)[_0xf4e1('0x1c')]();};}function respondWithResult(_0x5b4328,_0x325b31){_0x325b31=_0x325b31||0xc8;return function(_0x529083){if(_0x529083){return _0x5b4328[_0xf4e1('0x1d')](_0x325b31)['json'](_0x529083);}};}function respondWithFilteredResult(_0x700802,_0x50cd2e){return function(_0x23c287){if(_0x23c287){var _0x1e5c95=_0x23c287[_0xf4e1('0x1e')],_0x2c626b=_0x50cd2e[_0xf4e1('0x1f')],_0x495763=_0x50cd2e['offset']+_0x50cd2e[_0xf4e1('0x20')],_0x1bbada;if(_0x495763>=_0x1e5c95){_0x495763=_0x1e5c95;_0x1bbada=0xc8;}else{_0x1bbada=0xce;}_0x700802['status'](_0x1bbada);return _0x700802[_0xf4e1('0x21')](_0xf4e1('0x22'),_0x2c626b+'-'+_0x495763+'/'+_0x1e5c95)[_0xf4e1('0x23')](_0x23c287);}return null;};}function patchUpdates(_0x2308f8){return function(_0x5929a2){try{jsonpatch[_0xf4e1('0x24')](_0x5929a2,_0x2308f8,!![]);}catch(_0x3e04b0){return BPromise[_0xf4e1('0x25')](_0x3e04b0);}return _0x5929a2['save']();};}function saveUpdates(_0x7c3c73,_0x48729f){return function(_0x3bd54e){if(_0x3bd54e){return _0x3bd54e[_0xf4e1('0x26')](_0x7c3c73)[_0xf4e1('0x27')](function(_0x177557){return _0x177557;});}return null;};}function removeEntity(_0x5c91e3,_0x335bf1){return function(_0x3fa8ea){if(_0x3fa8ea){return _0x3fa8ea[_0xf4e1('0x28')]()['then'](function(){var _0x3ba3c6=_0x3fa8ea[_0xf4e1('0x29')]({'plain':!![]});var _0x406ac6='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x406ac6,'resourceId':_0x3ba3c6['id']}})[_0xf4e1('0x27')](function(){return _0x3fa8ea;});})[_0xf4e1('0x27')](function(){_0x5c91e3[_0xf4e1('0x1d')](0xcc)[_0xf4e1('0x1c')]();});}};}function handleEntityNotFound(_0x9dc7de,_0x56826c){return function(_0x4ae598){if(!_0x4ae598){_0x9dc7de['sendStatus'](0x194);}return _0x4ae598;};}function handleError(_0x22e730,_0x2a314b){_0x2a314b=_0x2a314b||0x1f4;return function(_0x58d872){logger['error'](_0x58d872['stack']);if(_0x58d872[_0xf4e1('0x2a')]){delete _0x58d872[_0xf4e1('0x2a')];}_0x22e730[_0xf4e1('0x1d')](_0x2a314b)[_0xf4e1('0x2b')](_0x58d872);};}exports[_0xf4e1('0x2c')]=function(_0x34bb94,_0xd7fac9){var _0x237727={},_0x55f950={},_0x24267c={'count':0x0,'rows':[]};var _0x44d962=_[_0xf4e1('0x2d')](db[_0xf4e1('0x2e')][_0xf4e1('0x2f')],function(_0x21a1e3){return{'name':_0x21a1e3['fieldName'],'type':_0x21a1e3[_0xf4e1('0x30')][_0xf4e1('0x31')]};});_0x55f950[_0xf4e1('0x32')]=_[_0xf4e1('0x2d')](_0x44d962,_0xf4e1('0x2a'));_0x55f950[_0xf4e1('0x33')]=_[_0xf4e1('0x34')](_0x34bb94['query']);_0x55f950[_0xf4e1('0x35')]=_[_0xf4e1('0x36')](_0x55f950['model'],_0x55f950['query']);_0x237727['attributes']=_[_0xf4e1('0x36')](_0x55f950['model'],qs[_0xf4e1('0x37')](_0x34bb94[_0xf4e1('0x33')]['fields']));_0x237727['attributes']=_0x237727['attributes'][_0xf4e1('0x38')]?_0x237727['attributes']:_0x55f950[_0xf4e1('0x32')];if(!_0x34bb94[_0xf4e1('0x33')][_0xf4e1('0x39')](_0xf4e1('0x3a'))){_0x237727[_0xf4e1('0x20')]=qs[_0xf4e1('0x20')](_0x34bb94[_0xf4e1('0x33')][_0xf4e1('0x20')]);_0x237727['offset']=qs[_0xf4e1('0x1f')](_0x34bb94['query'][_0xf4e1('0x1f')]);}_0x237727[_0xf4e1('0x3b')]=qs[_0xf4e1('0x3c')](_0x34bb94[_0xf4e1('0x33')][_0xf4e1('0x3c')]);_0x237727['where']=qs[_0xf4e1('0x35')](_[_0xf4e1('0x3d')](_0x34bb94['query'],_0x55f950[_0xf4e1('0x35')]),_0x44d962);if(_0x34bb94[_0xf4e1('0x33')]['filter']){_0x237727['where']=_[_0xf4e1('0x3e')](_0x237727[_0xf4e1('0x3f')],{'$or':_[_0xf4e1('0x2d')](_0x44d962,function(_0x50366d){if(_0x50366d[_0xf4e1('0x30')]!=='VIRTUAL'){var _0x452bbe={};_0x452bbe[_0x50366d[_0xf4e1('0x2a')]]={'$like':'%'+_0x34bb94[_0xf4e1('0x33')][_0xf4e1('0x40')]+'%'};return _0x452bbe;}})});}_0x237727=_[_0xf4e1('0x3e')]({},_0x237727,_0x34bb94[_0xf4e1('0x41')]);var _0x3e2e1d={'where':_0x237727[_0xf4e1('0x3f')]};return db[_0xf4e1('0x2e')][_0xf4e1('0x1e')](_0x3e2e1d)[_0xf4e1('0x27')](function(_0x89bfa8){_0x24267c['count']=_0x89bfa8;if(_0x34bb94['query'][_0xf4e1('0x42')]){_0x237727[_0xf4e1('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0xf4e1('0x44')](_0x237727);})[_0xf4e1('0x27')](function(_0xd03d3){_0x24267c[_0xf4e1('0x45')]=_0xd03d3;return _0x24267c;})[_0xf4e1('0x27')](respondWithFilteredResult(_0xd7fac9,_0x237727))[_0xf4e1('0x46')](handleError(_0xd7fac9,null));};exports[_0xf4e1('0x47')]=function(_0x2d9666,_0xf0bc0){var _0x58fb75={'raw':!![],'where':{'id':_0x2d9666[_0xf4e1('0x48')]['id']}},_0x50317e={};_0x50317e[_0xf4e1('0x32')]=_[_0xf4e1('0x34')](db[_0xf4e1('0x2e')][_0xf4e1('0x2f')]);_0x50317e[_0xf4e1('0x33')]=_[_0xf4e1('0x34')](_0x2d9666[_0xf4e1('0x33')]);_0x50317e[_0xf4e1('0x35')]=_['intersection'](_0x50317e[_0xf4e1('0x32')],_0x50317e[_0xf4e1('0x33')]);_0x58fb75[_0xf4e1('0x49')]=_[_0xf4e1('0x36')](_0x50317e['model'],qs['fields'](_0x2d9666[_0xf4e1('0x33')][_0xf4e1('0x37')]));_0x58fb75[_0xf4e1('0x49')]=_0x58fb75[_0xf4e1('0x49')][_0xf4e1('0x38')]?_0x58fb75['attributes']:_0x50317e['model'];if(_0x2d9666['query']['includeAll']){_0x58fb75[_0xf4e1('0x43')]=[{'all':!![]}];}_0x58fb75=_[_0xf4e1('0x3e')]({},_0x58fb75,_0x2d9666[_0xf4e1('0x41')]);return db[_0xf4e1('0x2e')][_0xf4e1('0x4a')](_0x58fb75)['then'](handleEntityNotFound(_0xf0bc0,null))[_0xf4e1('0x27')](respondWithResult(_0xf0bc0,null))[_0xf4e1('0x46')](handleError(_0xf0bc0,null));};exports[_0xf4e1('0x4b')]=function(_0x491602,_0x582c93){return db[_0xf4e1('0x2e')][_0xf4e1('0x4b')](_0x491602[_0xf4e1('0x4c')],{})[_0xf4e1('0x27')](function(_0x190bc0){var _0x39b130=_0x491602[_0xf4e1('0x4d')][_0xf4e1('0x29')]({'plain':!![]});if(!_0x39b130)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39b130[_0xf4e1('0x4e')]===_0xf4e1('0x4d')){var _0x132e51=_0x190bc0[_0xf4e1('0x29')]({'plain':!![]});var _0x487afa=_0xf4e1('0x4f');return db[_0xf4e1('0x50')]['find']({'where':{'name':_0x487afa,'userProfileId':_0x39b130[_0xf4e1('0x51')]},'raw':!![]})['then'](function(_0x372491){if(_0x372491&&_0x372491['autoAssociation']===0x0){return db[_0xf4e1('0x52')]['create']({'name':_0x132e51[_0xf4e1('0x2a')],'resourceId':_0x132e51['id'],'type':_0x372491[_0xf4e1('0x2a')],'sectionId':_0x372491['id']},{})['then'](function(){return _0x190bc0;});}else{return _0x190bc0;}})[_0xf4e1('0x46')](function(_0x1e8137){logger['error'](_0xf4e1('0x53'),_0x1e8137);throw _0x1e8137;});}return _0x190bc0;})['then'](respondWithResult(_0x582c93,0xc9))['catch'](handleError(_0x582c93,null));};exports['update']=function(_0x3d2a32,_0x46ffaa){if(_0x3d2a32[_0xf4e1('0x4c')]['id']){delete _0x3d2a32[_0xf4e1('0x4c')]['id'];}return db[_0xf4e1('0x2e')][_0xf4e1('0x4a')]({'where':{'id':_0x3d2a32[_0xf4e1('0x48')]['id']}})[_0xf4e1('0x27')](handleEntityNotFound(_0x46ffaa,null))[_0xf4e1('0x27')](saveUpdates(_0x3d2a32[_0xf4e1('0x4c')],null))['then'](respondWithResult(_0x46ffaa,null))[_0xf4e1('0x46')](handleError(_0x46ffaa,null));};exports['destroy']=function(_0x5bc23f,_0x2e04b6){return db['SquareOdbc'][_0xf4e1('0x4a')]({'where':{'id':_0x5bc23f[_0xf4e1('0x48')]['id']}})[_0xf4e1('0x27')](handleEntityNotFound(_0x2e04b6,null))[_0xf4e1('0x27')](removeEntity(_0x2e04b6,null))[_0xf4e1('0x46')](handleError(_0x2e04b6,null));};exports[_0xf4e1('0x54')]=function(_0x26a7f7,_0x160c51,_0x5d22a2){var _0x3193ec;return db[_0xf4e1('0x2e')][_0xf4e1('0x4a')]({'where':{'id':_0x26a7f7['params']['id']},'attributes':['id',_0xf4e1('0x55')]})[_0xf4e1('0x27')](handleEntityNotFound(_0x160c51,null))[_0xf4e1('0x27')](function(_0x364942){if(_0x364942){var _0x1b4e31=require(_0xf4e1('0x56'))();_0x1b4e31['openSync'](_0x364942['dsn']);_0x1b4e31['closeSync']();return _0x364942;}})['then'](respondWithResult(_0x160c51,null))['catch'](handleError(_0x160c51,null));}; \ No newline at end of file +var _0xcf8d=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','catch','show','params','SquareOdbc','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation'];(function(_0x433c1e,_0x16780a){var _0xa86681=function(_0x30bb29){while(--_0x30bb29){_0x433c1e['push'](_0x433c1e['shift']());}};_0xa86681(++_0x16780a);}(_0xcf8d,0x1f0));var _0xdcf8=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xcf8d[_0x9c2427];return _0x51984f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdcf8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcf8('0x1'));var jsonpatch=require(_0xdcf8('0x2'));var rp=require(_0xdcf8('0x3'));var moment=require('moment');var BPromise=require(_0xdcf8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdcf8('0x5'));var sox=require(_0xdcf8('0x6'));var csv=require(_0xdcf8('0x7'));var ejs=require(_0xdcf8('0x8'));var fs=require('fs');var _=require(_0xdcf8('0x9'));var squel=require(_0xdcf8('0xa'));var crypto=require(_0xdcf8('0xb'));var jsforce=require(_0xdcf8('0xc'));var deskjs=require(_0xdcf8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdcf8('0xe'));var Papa=require(_0xdcf8('0xf'));var Redis=require(_0xdcf8('0x10'));var authService=require(_0xdcf8('0x11'));var qs=require(_0xdcf8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdcf8('0x13'));var logger=require(_0xdcf8('0x14'))(_0xdcf8('0x15'));var utils=require('../../config/utils');var config=require(_0xdcf8('0x16'));var db=require(_0xdcf8('0x17'))['db'];function respondWithStatusCode(_0x1ef73f,_0x21b8a6){_0x21b8a6=_0x21b8a6||0xcc;return function(_0x473fb6){if(_0x473fb6){return _0x1ef73f[_0xdcf8('0x18')](_0x21b8a6);}return _0x1ef73f[_0xdcf8('0x19')](_0x21b8a6)[_0xdcf8('0x1a')]();};}function respondWithResult(_0x25719d,_0x55d426){_0x55d426=_0x55d426||0xc8;return function(_0x571770){if(_0x571770){return _0x25719d[_0xdcf8('0x19')](_0x55d426)[_0xdcf8('0x1b')](_0x571770);}};}function respondWithFilteredResult(_0x1cadbe,_0x367371){return function(_0x4c0733){if(_0x4c0733){var _0x478cf5=_0x4c0733[_0xdcf8('0x1c')],_0x29a76f=_0x367371[_0xdcf8('0x1d')],_0xdced19=_0x367371[_0xdcf8('0x1d')]+_0x367371['limit'],_0x3faa9b;if(_0xdced19>=_0x478cf5){_0xdced19=_0x478cf5;_0x3faa9b=0xc8;}else{_0x3faa9b=0xce;}_0x1cadbe[_0xdcf8('0x19')](_0x3faa9b);return _0x1cadbe['set'](_0xdcf8('0x1e'),_0x29a76f+'-'+_0xdced19+'/'+_0x478cf5)[_0xdcf8('0x1b')](_0x4c0733);}return null;};}function patchUpdates(_0x1b3fdd){return function(_0x2d255e){try{jsonpatch[_0xdcf8('0x1f')](_0x2d255e,_0x1b3fdd,!![]);}catch(_0x884832){return BPromise['reject'](_0x884832);}return _0x2d255e['save']();};}function saveUpdates(_0x3e9d35,_0x4d8eda){return function(_0xe914f2){if(_0xe914f2){return _0xe914f2[_0xdcf8('0x20')](_0x3e9d35)[_0xdcf8('0x21')](function(_0x5a6d2f){return _0x5a6d2f;});}return null;};}function removeEntity(_0x1df55f,_0x5b71b3){return function(_0x1c33a3){if(_0x1c33a3){return _0x1c33a3['destroy']()[_0xdcf8('0x21')](function(){var _0x4da3ed=_0x1c33a3['get']({'plain':!![]});var _0x16b735=_0xdcf8('0x22');return db[_0xdcf8('0x23')][_0xdcf8('0x24')]({'where':{'type':_0x16b735,'resourceId':_0x4da3ed['id']}})['then'](function(){return _0x1c33a3;});})['then'](function(){_0x1df55f[_0xdcf8('0x19')](0xcc)[_0xdcf8('0x1a')]();});}};}function handleEntityNotFound(_0x35db4c,_0x5928e6){return function(_0x30e7de){if(!_0x30e7de){_0x35db4c[_0xdcf8('0x18')](0x194);}return _0x30e7de;};}function handleError(_0x156e9f,_0x2b2175){_0x2b2175=_0x2b2175||0x1f4;return function(_0x522258){logger[_0xdcf8('0x25')](_0x522258[_0xdcf8('0x26')]);if(_0x522258[_0xdcf8('0x27')]){delete _0x522258[_0xdcf8('0x27')];}_0x156e9f[_0xdcf8('0x19')](_0x2b2175)[_0xdcf8('0x28')](_0x522258);};}exports[_0xdcf8('0x29')]=function(_0x4b8a59,_0x5d3572){var _0x1e58cb={},_0x3307b5={},_0x3dc355={'count':0x0,'rows':[]};var _0x300c93=_[_0xdcf8('0x2a')](db['SquareOdbc'][_0xdcf8('0x2b')],function(_0x1559db){return{'name':_0x1559db['fieldName'],'type':_0x1559db['type']['key']};});_0x3307b5[_0xdcf8('0x2c')]=_['map'](_0x300c93,_0xdcf8('0x27'));_0x3307b5['query']=_[_0xdcf8('0x2d')](_0x4b8a59[_0xdcf8('0x2e')]);_0x3307b5[_0xdcf8('0x2f')]=_[_0xdcf8('0x30')](_0x3307b5[_0xdcf8('0x2c')],_0x3307b5['query']);_0x1e58cb['attributes']=_['intersection'](_0x3307b5[_0xdcf8('0x2c')],qs[_0xdcf8('0x31')](_0x4b8a59[_0xdcf8('0x2e')][_0xdcf8('0x31')]));_0x1e58cb[_0xdcf8('0x32')]=_0x1e58cb[_0xdcf8('0x32')][_0xdcf8('0x33')]?_0x1e58cb['attributes']:_0x3307b5[_0xdcf8('0x2c')];if(!_0x4b8a59['query']['hasOwnProperty'](_0xdcf8('0x34'))){_0x1e58cb[_0xdcf8('0x35')]=qs[_0xdcf8('0x35')](_0x4b8a59['query'][_0xdcf8('0x35')]);_0x1e58cb[_0xdcf8('0x1d')]=qs[_0xdcf8('0x1d')](_0x4b8a59[_0xdcf8('0x2e')][_0xdcf8('0x1d')]);}_0x1e58cb[_0xdcf8('0x36')]=qs[_0xdcf8('0x37')](_0x4b8a59[_0xdcf8('0x2e')][_0xdcf8('0x37')]);_0x1e58cb[_0xdcf8('0x38')]=qs[_0xdcf8('0x2f')](_[_0xdcf8('0x39')](_0x4b8a59[_0xdcf8('0x2e')],_0x3307b5[_0xdcf8('0x2f')]),_0x300c93);if(_0x4b8a59[_0xdcf8('0x2e')]['filter']){_0x1e58cb[_0xdcf8('0x38')]=_['merge'](_0x1e58cb[_0xdcf8('0x38')],{'$or':_[_0xdcf8('0x2a')](_0x300c93,function(_0x5ea5d2){if(_0x5ea5d2[_0xdcf8('0x3a')]!=='VIRTUAL'){var _0x13f91b={};_0x13f91b[_0x5ea5d2[_0xdcf8('0x27')]]={'$like':'%'+_0x4b8a59['query'][_0xdcf8('0x3b')]+'%'};return _0x13f91b;}})});}_0x1e58cb=_[_0xdcf8('0x3c')]({},_0x1e58cb,_0x4b8a59[_0xdcf8('0x3d')]);var _0x144afc={'where':_0x1e58cb['where']};return db['SquareOdbc'][_0xdcf8('0x1c')](_0x144afc)[_0xdcf8('0x21')](function(_0x3ba2ac){_0x3dc355[_0xdcf8('0x1c')]=_0x3ba2ac;if(_0x4b8a59[_0xdcf8('0x2e')][_0xdcf8('0x3e')]){_0x1e58cb[_0xdcf8('0x3f')]=[{'all':!![]}];}return db['SquareOdbc'][_0xdcf8('0x40')](_0x1e58cb);})['then'](function(_0x21f24b){_0x3dc355['rows']=_0x21f24b;return _0x3dc355;})[_0xdcf8('0x21')](respondWithFilteredResult(_0x5d3572,_0x1e58cb))[_0xdcf8('0x41')](handleError(_0x5d3572,null));};exports[_0xdcf8('0x42')]=function(_0x139c66,_0x39129c){var _0x4ca6f6={'raw':!![],'where':{'id':_0x139c66[_0xdcf8('0x43')]['id']}},_0x271311={};_0x271311['model']=_['keys'](db[_0xdcf8('0x44')][_0xdcf8('0x2b')]);_0x271311[_0xdcf8('0x2e')]=_[_0xdcf8('0x2d')](_0x139c66[_0xdcf8('0x2e')]);_0x271311[_0xdcf8('0x2f')]=_[_0xdcf8('0x30')](_0x271311['model'],_0x271311[_0xdcf8('0x2e')]);_0x4ca6f6['attributes']=_[_0xdcf8('0x30')](_0x271311[_0xdcf8('0x2c')],qs[_0xdcf8('0x31')](_0x139c66[_0xdcf8('0x2e')][_0xdcf8('0x31')]));_0x4ca6f6[_0xdcf8('0x32')]=_0x4ca6f6[_0xdcf8('0x32')][_0xdcf8('0x33')]?_0x4ca6f6['attributes']:_0x271311[_0xdcf8('0x2c')];if(_0x139c66[_0xdcf8('0x2e')]['includeAll']){_0x4ca6f6['include']=[{'all':!![]}];}_0x4ca6f6=_[_0xdcf8('0x3c')]({},_0x4ca6f6,_0x139c66[_0xdcf8('0x3d')]);return db['SquareOdbc'][_0xdcf8('0x45')](_0x4ca6f6)[_0xdcf8('0x21')](handleEntityNotFound(_0x39129c,null))[_0xdcf8('0x21')](respondWithResult(_0x39129c,null))[_0xdcf8('0x41')](handleError(_0x39129c,null));};exports[_0xdcf8('0x46')]=function(_0x24df97,_0x1126aa){return db[_0xdcf8('0x44')]['create'](_0x24df97[_0xdcf8('0x47')],{})[_0xdcf8('0x21')](function(_0x72a3e7){var _0x361e7c=_0x24df97['user'][_0xdcf8('0x48')]({'plain':!![]});if(!_0x361e7c)throw new Error(_0xdcf8('0x49'));if(_0x361e7c[_0xdcf8('0x4a')]===_0xdcf8('0x4b')){var _0x39096b=_0x72a3e7[_0xdcf8('0x48')]({'plain':!![]});var _0x49d8a8='ODBC';return db['UserProfileSection'][_0xdcf8('0x45')]({'where':{'name':_0x49d8a8,'userProfileId':_0x361e7c[_0xdcf8('0x4c')]},'raw':!![]})[_0xdcf8('0x21')](function(_0x4ea565){if(_0x4ea565&&_0x4ea565[_0xdcf8('0x4d')]===0x0){return db[_0xdcf8('0x23')][_0xdcf8('0x46')]({'name':_0x39096b[_0xdcf8('0x27')],'resourceId':_0x39096b['id'],'type':_0x4ea565[_0xdcf8('0x27')],'sectionId':_0x4ea565['id']},{})[_0xdcf8('0x21')](function(){return _0x72a3e7;});}else{return _0x72a3e7;}})[_0xdcf8('0x41')](function(_0x35c708){logger[_0xdcf8('0x25')](_0xdcf8('0x4e'),_0x35c708);throw _0x35c708;});}return _0x72a3e7;})[_0xdcf8('0x21')](respondWithResult(_0x1126aa,0xc9))[_0xdcf8('0x41')](handleError(_0x1126aa,null));};exports['update']=function(_0x19a713,_0xe0259b){if(_0x19a713[_0xdcf8('0x47')]['id']){delete _0x19a713[_0xdcf8('0x47')]['id'];}return db[_0xdcf8('0x44')][_0xdcf8('0x45')]({'where':{'id':_0x19a713[_0xdcf8('0x43')]['id']}})['then'](handleEntityNotFound(_0xe0259b,null))[_0xdcf8('0x21')](saveUpdates(_0x19a713[_0xdcf8('0x47')],null))[_0xdcf8('0x21')](respondWithResult(_0xe0259b,null))['catch'](handleError(_0xe0259b,null));};exports[_0xdcf8('0x24')]=function(_0x14c2df,_0x4aad6d){return db[_0xdcf8('0x44')][_0xdcf8('0x45')]({'where':{'id':_0x14c2df[_0xdcf8('0x43')]['id']}})[_0xdcf8('0x21')](handleEntityNotFound(_0x4aad6d,null))[_0xdcf8('0x21')](removeEntity(_0x4aad6d,null))[_0xdcf8('0x41')](handleError(_0x4aad6d,null));};exports['test']=function(_0x47d5a5,_0x237877,_0xa03857){var _0x31a747;return db[_0xdcf8('0x44')][_0xdcf8('0x45')]({'where':{'id':_0x47d5a5[_0xdcf8('0x43')]['id']},'attributes':['id',_0xdcf8('0x4f')]})['then'](handleEntityNotFound(_0x237877,null))[_0xdcf8('0x21')](function(_0x258fa8){if(_0x258fa8){var _0x5a078c=require('odbc')();_0x5a078c[_0xdcf8('0x50')](_0x258fa8[_0xdcf8('0x4f')]);_0x5a078c[_0xdcf8('0x51')]();return _0x258fa8;}})[_0xdcf8('0x21')](respondWithResult(_0x237877,null))['catch'](handleError(_0x237877,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 4a9f3b6..90a808d 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 _0x48dd=['../../config/logger','moment','request-promise','path','rimraf','./squareOdbc.attributes','exports','SquareOdbc','square_odbc'];(function(_0x4c15b3,_0x3aa9f8){var _0x1f4bd8=function(_0x441165){while(--_0x441165){_0x4c15b3['push'](_0x4c15b3['shift']());}};_0x1f4bd8(++_0x3aa9f8);}(_0x48dd,0x99));var _0xd48d=function(_0x4e4a6e,_0x1f9653){_0x4e4a6e=_0x4e4a6e-0x0;var _0x95553=_0x48dd[_0x4e4a6e];return _0x95553;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd48d('0x0'))('api');var moment=require(_0xd48d('0x1'));var BPromise=require('bluebird');var rp=require(_0xd48d('0x2'));var fs=require('fs');var path=require(_0xd48d('0x3'));var rimraf=require(_0xd48d('0x4'));var config=require('../../config/environment');var attributes=require(_0xd48d('0x5'));module[_0xd48d('0x6')]=function(_0x1bbde1,_0x1e7521){return _0x1bbde1['define'](_0xd48d('0x7'),attributes,{'tableName':_0xd48d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a3f=['./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x30d6f2,_0x1a205d){var _0x19700c=function(_0x4ae9fb){while(--_0x4ae9fb){_0x30d6f2['push'](_0x30d6f2['shift']());}};_0x19700c(++_0x1a205d);}(_0x2a3f,0x126));var _0xf2a3=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x2a3f[_0x479650];return _0x26b288;};'use strict';var _=require(_0xf2a3('0x0'));var util=require('util');var logger=require(_0xf2a3('0x1'))(_0xf2a3('0x2'));var moment=require('moment');var BPromise=require(_0xf2a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2a3('0x4'));var rimraf=require(_0xf2a3('0x5'));var config=require('../../config/environment');var attributes=require(_0xf2a3('0x6'));module[_0xf2a3('0x7')]=function(_0x7c2b69,_0x164c20){return _0x7c2b69['define'](_0xf2a3('0x8'),attributes,{'tableName':_0xf2a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 8e2e7f5..145bf6b 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0xe14b,0x93));var _0xbe14=function(_0x2b1fd6,_0x1c1aaa){_0x2b1fd6=_0x2b1fd6-0x0;var _0x2bc96e=_0xe14b[_0x2b1fd6];return _0x2bc96e;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x45f6cb,_0x531af6){var _0x5b7f93=function(_0x1296ba){while(--_0x1296ba){_0x45f6cb['push'](_0x45f6cb['shift']());}};_0x5b7f93(++_0x531af6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x5fc3[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5bbee28..4c3972b 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 _0x9c00=['express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x9c00,0x1a0));var _0x09c0=function(_0xd49e15,_0x5e34ac){_0xd49e15=_0xd49e15-0x0;var _0x306b6a=_0x9c00[_0xd49e15];return _0x306b6a;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x09c0('0x4'));var config=require(_0x09c0('0x5'));var controller=require(_0x09c0('0x6'));router[_0x09c0('0x7')]('/',auth[_0x09c0('0x8')](),controller['index']);router['get'](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0xa')]);router[_0x09c0('0x7')](_0x09c0('0xb'),auth['isAuthenticated'](),controller[_0x09c0('0xc')]);router[_0x09c0('0xd')]('/',auth[_0x09c0('0x8')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xd')](_0x09c0('0xb'),auth[_0x09c0('0x8')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0x11')]);router[_0x09c0('0x12')](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0x13')]);router[_0x09c0('0x12')](_0x09c0('0xb'),auth[_0x09c0('0x8')](),controller[_0x09c0('0x14')]);module[_0x09c0('0x15')]=router; \ No newline at end of file +var _0xbee3=['destroy','removeUsers','exports','util','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','/:id','show','get','/:id/users','getUsers','create','post','addUsers','update','delete'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0xbee3,0xd5));var _0x3bee=function(_0x30e675,_0x4eebc7){_0x30e675=_0x30e675-0x0;var _0x258b27=_0xbee3[_0x30e675];return _0x258b27;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3bee('0x3'));var config=require(_0x3bee('0x4'));var controller=require(_0x3bee('0x5'));router['get']('/',auth[_0x3bee('0x6')](),controller[_0x3bee('0x7')]);router['get'](_0x3bee('0x8'),auth[_0x3bee('0x6')](),controller[_0x3bee('0x9')]);router[_0x3bee('0xa')](_0x3bee('0xb'),auth[_0x3bee('0x6')](),controller[_0x3bee('0xc')]);router['post']('/',auth[_0x3bee('0x6')](),controller[_0x3bee('0xd')]);router[_0x3bee('0xe')](_0x3bee('0xb'),auth[_0x3bee('0x6')](),controller[_0x3bee('0xf')]);router['put'](_0x3bee('0x8'),auth['isAuthenticated'](),controller[_0x3bee('0x10')]);router[_0x3bee('0x11')](_0x3bee('0x8'),auth[_0x3bee('0x6')](),controller[_0x3bee('0x12')]);router[_0x3bee('0x11')](_0x3bee('0xb'),auth['isAuthenticated'](),controller[_0x3bee('0x13')]);module[_0x3bee('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0ea66ff..d120e2d 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 _0xe2f9=['preproduction','toString','utf8','production','sequelize','exports','name','STRING','TEXT','long','getDataValue'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xe2f9,0x10c));var _0x9e2f=function(_0x5a4650,_0x30d108){_0x5a4650=_0x5a4650-0x0;var _0x12ec86=_0xe2f9[_0x5a4650];return _0x12ec86;};'use strict';var Sequelize=require(_0x9e2f('0x0'));module[_0x9e2f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e2f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9e2f('0x3')]},'notes':{'type':Sequelize[_0x9e2f('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x9e2f('0x5')),'get':function(){if(this[_0x9e2f('0x6')](_0x9e2f('0x7'))){return this[_0x9e2f('0x6')](_0x9e2f('0x7'))[_0x9e2f('0x8')](_0x9e2f('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x9e2f('0x5')),'get':function(){if(this['getDataValue'](_0x9e2f('0xa'))){return this[_0x9e2f('0x6')](_0x9e2f('0xa'))[_0x9e2f('0x8')](_0x9e2f('0x9'));}}}}; \ No newline at end of file +var _0xf515=['exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0xf515,0xcb));var _0x5f51=function(_0x4eb9e5,_0x5b7e95){_0x4eb9e5=_0x4eb9e5-0x0;var _0x355e2f=_0xf515[_0x4eb9e5];return _0x355e2f;};'use strict';var Sequelize=require(_0x5f51('0x0'));module[_0x5f51('0x1')]={'name':{'type':Sequelize[_0x5f51('0x2')],'unique':_0x5f51('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x5f51('0x4')]},'preproduction':{'type':Sequelize[_0x5f51('0x5')](_0x5f51('0x6')),'get':function(){if(this[_0x5f51('0x7')](_0x5f51('0x8'))){return this[_0x5f51('0x7')](_0x5f51('0x8'))[_0x5f51('0x9')](_0x5f51('0xa'));}}},'production':{'type':Sequelize[_0x5f51('0x5')]('long'),'get':function(){if(this['getDataValue'](_0x5f51('0xb'))){return this[_0x5f51('0x7')]('production')[_0x5f51('0x9')](_0x5f51('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2befc59..e24bc25 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 _0x72a5=['fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','error','stack','name','map','SquareProject','rawAttributes'];(function(_0x296516,_0x2c99e1){var _0x464c97=function(_0x4fd9b0){while(--_0x4fd9b0){_0x296516['push'](_0x296516['shift']());}};_0x464c97(++_0x2c99e1);}(_0x72a5,0x1a3));var _0x572a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72a5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x572a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x572a('0x1'));var jsonpatch=require(_0x572a('0x2'));var rp=require(_0x572a('0x3'));var moment=require(_0x572a('0x4'));var BPromise=require(_0x572a('0x5'));var Mustache=require(_0x572a('0x6'));var util=require(_0x572a('0x7'));var path=require(_0x572a('0x8'));var sox=require(_0x572a('0x9'));var csv=require(_0x572a('0xa'));var ejs=require(_0x572a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x572a('0xc'));var crypto=require(_0x572a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x572a('0xa'));var querystring=require(_0x572a('0xe'));var Papa=require(_0x572a('0xf'));var Redis=require(_0x572a('0x10'));var authService=require(_0x572a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x572a('0x12'));var logger=require(_0x572a('0x13'))(_0x572a('0x14'));var utils=require(_0x572a('0x15'));var config=require(_0x572a('0x16'));var db=require(_0x572a('0x17'))['db'];config[_0x572a('0x18')]=_[_0x572a('0x19')](config['redis'],{'host':_0x572a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x572a('0x18')]));require(_0x572a('0x1b'))['register'](socket);function respondWithStatusCode(_0x25be41,_0xf8cf88){_0xf8cf88=_0xf8cf88||0xcc;return function(_0x2758fa){if(_0x2758fa){return _0x25be41[_0x572a('0x1c')](_0xf8cf88);}return _0x25be41['status'](_0xf8cf88)[_0x572a('0x1d')]();};}function respondWithResult(_0x4049bc,_0x4c466c){_0x4c466c=_0x4c466c||0xc8;return function(_0x11de81){if(_0x11de81){return _0x4049bc[_0x572a('0x1e')](_0x4c466c)[_0x572a('0x1f')](_0x11de81);}};}function respondWithFilteredResult(_0x25cc47,_0xab72d9){return function(_0x21cba0){if(_0x21cba0){var _0x4f6953=_0x21cba0[_0x572a('0x20')],_0x3b0407=_0xab72d9['offset'],_0x669500=_0xab72d9[_0x572a('0x21')]+_0xab72d9[_0x572a('0x22')],_0xa16a2a;if(_0x669500>=_0x4f6953){_0x669500=_0x4f6953;_0xa16a2a=0xc8;}else{_0xa16a2a=0xce;}_0x25cc47[_0x572a('0x1e')](_0xa16a2a);return _0x25cc47[_0x572a('0x23')](_0x572a('0x24'),_0x3b0407+'-'+_0x669500+'/'+_0x4f6953)[_0x572a('0x1f')](_0x21cba0);}return null;};}function patchUpdates(_0x39eec5){return function(_0x5b6c80){try{jsonpatch[_0x572a('0x25')](_0x5b6c80,_0x39eec5,!![]);}catch(_0x5a14ae){return BPromise[_0x572a('0x26')](_0x5a14ae);}return _0x5b6c80[_0x572a('0x27')]();};}function saveUpdates(_0x4a5645,_0x4bdb3c){return function(_0x43adc0){if(_0x43adc0){return _0x43adc0[_0x572a('0x28')](_0x4a5645)[_0x572a('0x29')](function(_0x574af1){return _0x574af1;});}return null;};}function removeEntity(_0x49a555,_0x3a2be8){return function(_0x17b788){if(_0x17b788){return _0x17b788[_0x572a('0x2a')]()[_0x572a('0x29')](function(){var _0x198fec=_0x17b788[_0x572a('0x2b')]({'plain':!![]});var _0x404899=_0x572a('0x2c');return db['UserProfileResource'][_0x572a('0x2a')]({'where':{'type':_0x404899,'resourceId':_0x198fec['id']}})[_0x572a('0x29')](function(){return _0x17b788;});})['then'](function(){_0x49a555['status'](0xcc)[_0x572a('0x1d')]();});}};}function handleEntityNotFound(_0x5081d6,_0xb51b81){return function(_0x589762){if(!_0x589762){_0x5081d6['sendStatus'](0x194);}return _0x589762;};}function handleError(_0x42e081,_0x22c545){_0x22c545=_0x22c545||0x1f4;return function(_0x251abc){logger[_0x572a('0x2d')](_0x251abc[_0x572a('0x2e')]);if(_0x251abc[_0x572a('0x2f')]){delete _0x251abc[_0x572a('0x2f')];}_0x42e081[_0x572a('0x1e')](_0x22c545)['send'](_0x251abc);};}exports['index']=function(_0x40efc2,_0x12a8fa){var _0x425c36={},_0x4ce7c5={},_0x2da4fb={'count':0x0,'rows':[]};var _0x5c0e74=_[_0x572a('0x30')](db[_0x572a('0x31')][_0x572a('0x32')],function(_0x3650f7){return{'name':_0x3650f7[_0x572a('0x33')],'type':_0x3650f7[_0x572a('0x34')][_0x572a('0x35')]};});_0x4ce7c5[_0x572a('0x36')]=_['map'](_0x5c0e74,'name');_0x4ce7c5[_0x572a('0x37')]=_['keys'](_0x40efc2[_0x572a('0x37')]);_0x4ce7c5[_0x572a('0x38')]=_[_0x572a('0x39')](_0x4ce7c5['model'],_0x4ce7c5[_0x572a('0x37')]);_0x425c36['attributes']=_[_0x572a('0x39')](_0x4ce7c5['model'],qs[_0x572a('0x3a')](_0x40efc2['query']['fields']));_0x425c36[_0x572a('0x3b')]=_0x425c36['attributes'][_0x572a('0x3c')]?_0x425c36[_0x572a('0x3b')]:_0x4ce7c5[_0x572a('0x36')];if(!_0x40efc2[_0x572a('0x37')]['hasOwnProperty'](_0x572a('0x3d'))){_0x425c36[_0x572a('0x22')]=qs[_0x572a('0x22')](_0x40efc2[_0x572a('0x37')][_0x572a('0x22')]);_0x425c36[_0x572a('0x21')]=qs[_0x572a('0x21')](_0x40efc2[_0x572a('0x37')][_0x572a('0x21')]);}_0x425c36[_0x572a('0x3e')]=qs['sort'](_0x40efc2['query'][_0x572a('0x3f')]);_0x425c36[_0x572a('0x40')]=qs[_0x572a('0x38')](_[_0x572a('0x41')](_0x40efc2[_0x572a('0x37')],_0x4ce7c5[_0x572a('0x38')]),_0x5c0e74);if(_0x40efc2[_0x572a('0x37')][_0x572a('0x42')]){_0x425c36[_0x572a('0x40')]=_[_0x572a('0x43')](_0x425c36['where'],{'$or':_[_0x572a('0x30')](_0x5c0e74,function(_0x2b5a55){if(_0x2b5a55[_0x572a('0x34')]!==_0x572a('0x44')){var _0x139bd7={};_0x139bd7[_0x2b5a55[_0x572a('0x2f')]]={'$like':'%'+_0x40efc2[_0x572a('0x37')]['filter']+'%'};return _0x139bd7;}})});}_0x425c36=_[_0x572a('0x43')]({},_0x425c36,_0x40efc2['options']);var _0x773d72={'where':_0x425c36[_0x572a('0x40')]};return db[_0x572a('0x31')][_0x572a('0x20')](_0x773d72)[_0x572a('0x29')](function(_0x3dafce){_0x2da4fb[_0x572a('0x20')]=_0x3dafce;if(_0x40efc2[_0x572a('0x37')][_0x572a('0x45')]){_0x425c36[_0x572a('0x46')]=[{'all':!![]}];}return db['SquareProject'][_0x572a('0x47')](_0x425c36);})[_0x572a('0x29')](function(_0x14aec5){_0x2da4fb[_0x572a('0x48')]=_0x14aec5;return _0x2da4fb;})[_0x572a('0x29')](respondWithFilteredResult(_0x12a8fa,_0x425c36))[_0x572a('0x49')](handleError(_0x12a8fa,null));};exports[_0x572a('0x4a')]=function(_0x543ed2,_0x74dea9){var _0x37842e={'raw':![],'where':{'id':_0x543ed2[_0x572a('0x4b')]['id']}},_0x58496a={};_0x58496a['model']=_[_0x572a('0x4c')](db[_0x572a('0x31')][_0x572a('0x32')]);_0x58496a[_0x572a('0x37')]=_[_0x572a('0x4c')](_0x543ed2['query']);_0x58496a[_0x572a('0x38')]=_[_0x572a('0x39')](_0x58496a[_0x572a('0x36')],_0x58496a['query']);_0x37842e[_0x572a('0x3b')]=_[_0x572a('0x39')](_0x58496a['model'],qs[_0x572a('0x3a')](_0x543ed2['query'][_0x572a('0x3a')]));_0x37842e[_0x572a('0x3b')]=_0x37842e[_0x572a('0x3b')][_0x572a('0x3c')]?_0x37842e[_0x572a('0x3b')]:_0x58496a[_0x572a('0x36')];if(_0x543ed2[_0x572a('0x37')][_0x572a('0x45')]){_0x37842e[_0x572a('0x46')]=[{'all':!![]}];}_0x37842e=_[_0x572a('0x43')]({},_0x37842e,_0x543ed2[_0x572a('0x4d')]);return db['SquareProject'][_0x572a('0x4e')](_0x37842e)['then'](handleEntityNotFound(_0x74dea9,null))['then'](respondWithResult(_0x74dea9,null))[_0x572a('0x49')](handleError(_0x74dea9,null));};exports['create']=function(_0x513c06,_0x75eea9){return db['SquareProject'][_0x572a('0x4f')](_0x513c06[_0x572a('0x50')],{})[_0x572a('0x29')](function(_0xe04dd9){var _0x47350d=_0x513c06[_0x572a('0x51')][_0x572a('0x2b')]({'plain':!![]});if(!_0x47350d)throw new Error(_0x572a('0x52'));if(_0x47350d['role']===_0x572a('0x51')){var _0x19bdd2=_0xe04dd9[_0x572a('0x2b')]({'plain':!![]});var _0x2bfcac=_0x572a('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x2bfcac,'userProfileId':_0x47350d['userProfileId']},'raw':!![]})[_0x572a('0x29')](function(_0x500edb){if(_0x500edb&&_0x500edb[_0x572a('0x53')]===0x0){return db[_0x572a('0x54')]['create']({'name':_0x19bdd2[_0x572a('0x2f')],'resourceId':_0x19bdd2['id'],'type':_0x500edb[_0x572a('0x2f')],'sectionId':_0x500edb['id']},{})[_0x572a('0x29')](function(){return _0xe04dd9;});}else{return _0xe04dd9;}})[_0x572a('0x49')](function(_0x167a3b){logger[_0x572a('0x2d')](_0x572a('0x55'),_0x167a3b);throw _0x167a3b;});}return _0xe04dd9;})[_0x572a('0x29')](respondWithResult(_0x75eea9,0xc9))['catch'](handleError(_0x75eea9,null));};exports[_0x572a('0x28')]=function(_0x5f088b,_0x40d8d8){if(_0x5f088b[_0x572a('0x50')]['id']){delete _0x5f088b[_0x572a('0x50')]['id'];}return db[_0x572a('0x31')]['find']({'where':{'id':_0x5f088b[_0x572a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x40d8d8,null))[_0x572a('0x29')](saveUpdates(_0x5f088b[_0x572a('0x50')],null))[_0x572a('0x29')](respondWithResult(_0x40d8d8,null))[_0x572a('0x49')](handleError(_0x40d8d8,null));};exports[_0x572a('0x2a')]=function(_0xa88ea8,_0x293f59){return db[_0x572a('0x31')][_0x572a('0x4e')]({'where':{'id':_0xa88ea8['params']['id']}})[_0x572a('0x29')](handleEntityNotFound(_0x293f59,null))['then'](removeEntity(_0x293f59,null))[_0x572a('0x49')](handleError(_0x293f59,null));};exports['addUsers']=function(_0x338e60,_0xa1f495,_0x243d28){return db[_0x572a('0x31')][_0x572a('0x4e')]({'where':{'id':_0x338e60[_0x572a('0x4b')]['id']}})['then'](handleEntityNotFound(_0xa1f495,null))[_0x572a('0x29')](function(_0x324b2c){if(_0x324b2c){return _0x324b2c['addUsers'](_0x338e60[_0x572a('0x50')][_0x572a('0x56')],_['omit'](_0x338e60[_0x572a('0x50')],[_0x572a('0x56'),'id'])||{});}})[_0x572a('0x29')](respondWithResult(_0xa1f495,null))['catch'](handleError(_0xa1f495,null));};exports['removeUsers']=function(_0x13786e,_0x364978,_0x1d2165){return db[_0x572a('0x31')][_0x572a('0x4e')]({'where':{'id':_0x13786e[_0x572a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x364978,null))[_0x572a('0x29')](function(_0x387cbc){if(_0x387cbc){return _0x387cbc[_0x572a('0x57')](_0x13786e[_0x572a('0x37')][_0x572a('0x56')])['then'](function(){if(_[_0x572a('0x58')](_0x13786e[_0x572a('0x37')]['ids'])){for(var _0x42cdda=0x0;_0x42cdda<_0x13786e['query'][_0x572a('0x56')][_0x572a('0x3c')];_0x42cdda+=0x1){socket[_0x572a('0x59')](_0x572a('0x5a'),{'UserId':Number(_0x13786e[_0x572a('0x37')][_0x572a('0x56')][_0x42cdda]),'SquareProjectId':Number(_0x13786e['params']['id'])});}}else{socket[_0x572a('0x59')](_0x572a('0x5a'),{'UserId':Number(_0x13786e[_0x572a('0x37')]['ids']),'SquareProjectId':Number(_0x13786e[_0x572a('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x364978,null))[_0x572a('0x49')](handleError(_0x364978,null));};exports[_0x572a('0x5b')]=function(_0x33e389,_0x5d78d3,_0x346c3){var _0x149afc={};var _0x4f83fb={};var _0x586bae;var _0x255e78;return db[_0x572a('0x31')][_0x572a('0x5c')]({'where':{'id':_0x33e389[_0x572a('0x4b')]['id']}})[_0x572a('0x29')](handleEntityNotFound(_0x5d78d3,null))['then'](function(_0x126a35){if(_0x126a35){_0x586bae=_0x126a35;_0x4f83fb['model']=_[_0x572a('0x4c')](db['User']['rawAttributes']);_0x4f83fb[_0x572a('0x37')]=_[_0x572a('0x4c')](_0x33e389[_0x572a('0x37')]);_0x4f83fb['filters']=_[_0x572a('0x39')](_0x4f83fb['model'],_0x4f83fb[_0x572a('0x37')]);_0x149afc['attributes']=_[_0x572a('0x39')](_0x4f83fb[_0x572a('0x36')],qs['fields'](_0x33e389[_0x572a('0x37')][_0x572a('0x3a')]));_0x149afc[_0x572a('0x3b')]=_0x149afc[_0x572a('0x3b')][_0x572a('0x3c')]?_0x149afc[_0x572a('0x3b')]:_0x4f83fb['model'];_0x149afc[_0x572a('0x3e')]=qs[_0x572a('0x3f')](_0x33e389[_0x572a('0x37')][_0x572a('0x3f')]);_0x149afc['where']=qs[_0x572a('0x38')](_[_0x572a('0x41')](_0x33e389[_0x572a('0x37')],_0x4f83fb[_0x572a('0x38')]));if(_0x33e389[_0x572a('0x37')][_0x572a('0x42')]){_0x149afc[_0x572a('0x40')]=_['merge'](_0x149afc[_0x572a('0x40')],{'$or':_['map'](_0x149afc[_0x572a('0x3b')],function(_0x2ec64c){var _0x344331={};_0x344331[_0x2ec64c]={'$like':'%'+_0x33e389[_0x572a('0x37')][_0x572a('0x42')]+'%'};return _0x344331;})});}_0x149afc=_[_0x572a('0x43')]({},_0x149afc,_0x33e389[_0x572a('0x4d')]);return _0x586bae[_0x572a('0x5b')](_0x149afc);}})[_0x572a('0x29')](function(_0x13a5a7){if(_0x13a5a7){_0x255e78=_0x13a5a7[_0x572a('0x3c')];if(!_0x33e389[_0x572a('0x37')][_0x572a('0x5d')](_0x572a('0x3d'))){_0x149afc[_0x572a('0x22')]=qs[_0x572a('0x22')](_0x33e389[_0x572a('0x37')][_0x572a('0x22')]);_0x149afc[_0x572a('0x21')]=qs[_0x572a('0x21')](_0x33e389[_0x572a('0x37')][_0x572a('0x21')]);}return _0x586bae[_0x572a('0x5b')](_0x149afc);}})['then'](function(_0x4dd897){if(_0x4dd897){return _0x4dd897?{'count':_0x255e78,'rows':_0x4dd897}:null;}})[_0x572a('0x29')](respondWithResult(_0x5d78d3,null))[_0x572a('0x49')](handleError(_0x5d78d3,null));}; \ No newline at end of file +var _0xf874=['util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','SquareProject','findAll','rows','catch','show','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xf874,0x1dd));var _0x4f87=function(_0x28679a,_0x4221d2){_0x28679a=_0x28679a-0x0;var _0x2edea6=_0xf874[_0x28679a];return _0x2edea6;};'use strict';var pdf=require(_0x4f87('0x0'));var emlformat=require(_0x4f87('0x1'));var rimraf=require(_0x4f87('0x2'));var zipdir=require(_0x4f87('0x3'));var jsonpatch=require(_0x4f87('0x4'));var rp=require(_0x4f87('0x5'));var moment=require(_0x4f87('0x6'));var BPromise=require(_0x4f87('0x7'));var Mustache=require('mustache');var util=require(_0x4f87('0x8'));var path=require(_0x4f87('0x9'));var sox=require(_0x4f87('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f87('0xb'));var squel=require(_0x4f87('0xc'));var crypto=require(_0x4f87('0xd'));var jsforce=require(_0x4f87('0xe'));var deskjs=require(_0x4f87('0xf'));var toCsv=require(_0x4f87('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f87('0x11'));var authService=require(_0x4f87('0x12'));var qs=require(_0x4f87('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f87('0x14'))('api');var utils=require(_0x4f87('0x15'));var config=require(_0x4f87('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4f87('0x17')](config[_0x4f87('0x18')],{'host':_0x4f87('0x19'),'port':0x18eb});var socket=require(_0x4f87('0x1a'))(new Redis(config[_0x4f87('0x18')]));require(_0x4f87('0x1b'))['register'](socket);function respondWithStatusCode(_0x15d586,_0x4ae348){_0x4ae348=_0x4ae348||0xcc;return function(_0x4eada5){if(_0x4eada5){return _0x15d586[_0x4f87('0x1c')](_0x4ae348);}return _0x15d586[_0x4f87('0x1d')](_0x4ae348)[_0x4f87('0x1e')]();};}function respondWithResult(_0x2c2c48,_0x3ab717){_0x3ab717=_0x3ab717||0xc8;return function(_0x450661){if(_0x450661){return _0x2c2c48[_0x4f87('0x1d')](_0x3ab717)[_0x4f87('0x1f')](_0x450661);}};}function respondWithFilteredResult(_0x5301b3,_0x546973){return function(_0x11ae04){if(_0x11ae04){var _0x8c683b=_0x11ae04[_0x4f87('0x20')],_0x3441dc=_0x546973['offset'],_0x1506c4=_0x546973[_0x4f87('0x21')]+_0x546973[_0x4f87('0x22')],_0x3aaf67;if(_0x1506c4>=_0x8c683b){_0x1506c4=_0x8c683b;_0x3aaf67=0xc8;}else{_0x3aaf67=0xce;}_0x5301b3[_0x4f87('0x1d')](_0x3aaf67);return _0x5301b3[_0x4f87('0x23')](_0x4f87('0x24'),_0x3441dc+'-'+_0x1506c4+'/'+_0x8c683b)[_0x4f87('0x1f')](_0x11ae04);}return null;};}function patchUpdates(_0x58a606){return function(_0x5dbc9e){try{jsonpatch['apply'](_0x5dbc9e,_0x58a606,!![]);}catch(_0x10d875){return BPromise['reject'](_0x10d875);}return _0x5dbc9e[_0x4f87('0x25')]();};}function saveUpdates(_0x32d869,_0x589fa3){return function(_0x5875f7){if(_0x5875f7){return _0x5875f7[_0x4f87('0x26')](_0x32d869)[_0x4f87('0x27')](function(_0x34a6bc){return _0x34a6bc;});}return null;};}function removeEntity(_0xe2f977,_0x49ee5e){return function(_0xa31c10){if(_0xa31c10){return _0xa31c10[_0x4f87('0x28')]()[_0x4f87('0x27')](function(){var _0xaf40e7=_0xa31c10[_0x4f87('0x29')]({'plain':!![]});var _0x1f659a='SquareProjects';return db['UserProfileResource'][_0x4f87('0x28')]({'where':{'type':_0x1f659a,'resourceId':_0xaf40e7['id']}})['then'](function(){return _0xa31c10;});})[_0x4f87('0x27')](function(){_0xe2f977['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a625,_0x304348){return function(_0x381fba){if(!_0x381fba){_0x45a625[_0x4f87('0x1c')](0x194);}return _0x381fba;};}function handleError(_0x4e670e,_0x5ea42b){_0x5ea42b=_0x5ea42b||0x1f4;return function(_0x219dd0){logger[_0x4f87('0x2a')](_0x219dd0[_0x4f87('0x2b')]);if(_0x219dd0[_0x4f87('0x2c')]){delete _0x219dd0[_0x4f87('0x2c')];}_0x4e670e[_0x4f87('0x1d')](_0x5ea42b)[_0x4f87('0x2d')](_0x219dd0);};}exports[_0x4f87('0x2e')]=function(_0x131494,_0x108206){var _0x284233={},_0x39d782={},_0xa1f2e1={'count':0x0,'rows':[]};var _0x46777f=_['map'](db['SquareProject'][_0x4f87('0x2f')],function(_0x42c574){return{'name':_0x42c574[_0x4f87('0x30')],'type':_0x42c574['type'][_0x4f87('0x31')]};});_0x39d782[_0x4f87('0x32')]=_['map'](_0x46777f,'name');_0x39d782[_0x4f87('0x33')]=_[_0x4f87('0x34')](_0x131494[_0x4f87('0x33')]);_0x39d782[_0x4f87('0x35')]=_['intersection'](_0x39d782['model'],_0x39d782['query']);_0x284233[_0x4f87('0x36')]=_[_0x4f87('0x37')](_0x39d782[_0x4f87('0x32')],qs[_0x4f87('0x38')](_0x131494['query'][_0x4f87('0x38')]));_0x284233[_0x4f87('0x36')]=_0x284233[_0x4f87('0x36')][_0x4f87('0x39')]?_0x284233['attributes']:_0x39d782[_0x4f87('0x32')];if(!_0x131494[_0x4f87('0x33')]['hasOwnProperty']('nolimit')){_0x284233[_0x4f87('0x22')]=qs[_0x4f87('0x22')](_0x131494['query'][_0x4f87('0x22')]);_0x284233[_0x4f87('0x21')]=qs['offset'](_0x131494[_0x4f87('0x33')][_0x4f87('0x21')]);}_0x284233[_0x4f87('0x3a')]=qs[_0x4f87('0x3b')](_0x131494[_0x4f87('0x33')]['sort']);_0x284233[_0x4f87('0x3c')]=qs[_0x4f87('0x35')](_[_0x4f87('0x3d')](_0x131494[_0x4f87('0x33')],_0x39d782[_0x4f87('0x35')]),_0x46777f);if(_0x131494[_0x4f87('0x33')]['filter']){_0x284233['where']=_[_0x4f87('0x3e')](_0x284233[_0x4f87('0x3c')],{'$or':_[_0x4f87('0x3f')](_0x46777f,function(_0x593cf2){if(_0x593cf2['type']!==_0x4f87('0x40')){var _0x3b522e={};_0x3b522e[_0x593cf2[_0x4f87('0x2c')]]={'$like':'%'+_0x131494[_0x4f87('0x33')][_0x4f87('0x41')]+'%'};return _0x3b522e;}})});}_0x284233=_[_0x4f87('0x3e')]({},_0x284233,_0x131494[_0x4f87('0x42')]);var _0x1e3c0b={'where':_0x284233['where']};return db['SquareProject']['count'](_0x1e3c0b)['then'](function(_0x2f3435){_0xa1f2e1[_0x4f87('0x20')]=_0x2f3435;if(_0x131494[_0x4f87('0x33')][_0x4f87('0x43')]){_0x284233['include']=[{'all':!![]}];}return db[_0x4f87('0x44')][_0x4f87('0x45')](_0x284233);})[_0x4f87('0x27')](function(_0x527269){_0xa1f2e1[_0x4f87('0x46')]=_0x527269;return _0xa1f2e1;})[_0x4f87('0x27')](respondWithFilteredResult(_0x108206,_0x284233))[_0x4f87('0x47')](handleError(_0x108206,null));};exports[_0x4f87('0x48')]=function(_0x31ddec,_0x569baf){var _0x2a901f={'raw':![],'where':{'id':_0x31ddec['params']['id']}},_0x255f44={};_0x255f44[_0x4f87('0x32')]=_[_0x4f87('0x34')](db['SquareProject'][_0x4f87('0x2f')]);_0x255f44[_0x4f87('0x33')]=_[_0x4f87('0x34')](_0x31ddec[_0x4f87('0x33')]);_0x255f44[_0x4f87('0x35')]=_[_0x4f87('0x37')](_0x255f44['model'],_0x255f44[_0x4f87('0x33')]);_0x2a901f['attributes']=_[_0x4f87('0x37')](_0x255f44[_0x4f87('0x32')],qs[_0x4f87('0x38')](_0x31ddec[_0x4f87('0x33')][_0x4f87('0x38')]));_0x2a901f[_0x4f87('0x36')]=_0x2a901f[_0x4f87('0x36')][_0x4f87('0x39')]?_0x2a901f[_0x4f87('0x36')]:_0x255f44['model'];if(_0x31ddec['query'][_0x4f87('0x43')]){_0x2a901f[_0x4f87('0x49')]=[{'all':!![]}];}_0x2a901f=_['merge']({},_0x2a901f,_0x31ddec[_0x4f87('0x42')]);return db[_0x4f87('0x44')]['find'](_0x2a901f)['then'](handleEntityNotFound(_0x569baf,null))[_0x4f87('0x27')](respondWithResult(_0x569baf,null))[_0x4f87('0x47')](handleError(_0x569baf,null));};exports[_0x4f87('0x4a')]=function(_0x1e2676,_0x1cf8c5){return db[_0x4f87('0x44')]['create'](_0x1e2676[_0x4f87('0x4b')],{})['then'](function(_0x17e5a0){var _0x455557=_0x1e2676['user'][_0x4f87('0x29')]({'plain':!![]});if(!_0x455557)throw new Error(_0x4f87('0x4c'));if(_0x455557[_0x4f87('0x4d')]===_0x4f87('0x4e')){var _0x3ccd39=_0x17e5a0[_0x4f87('0x29')]({'plain':!![]});var _0xebb5eb=_0x4f87('0x4f');return db[_0x4f87('0x50')]['find']({'where':{'name':_0xebb5eb,'userProfileId':_0x455557[_0x4f87('0x51')]},'raw':!![]})[_0x4f87('0x27')](function(_0x22bbfa){if(_0x22bbfa&&_0x22bbfa[_0x4f87('0x52')]===0x0){return db[_0x4f87('0x53')][_0x4f87('0x4a')]({'name':_0x3ccd39['name'],'resourceId':_0x3ccd39['id'],'type':_0x22bbfa['name'],'sectionId':_0x22bbfa['id']},{})['then'](function(){return _0x17e5a0;});}else{return _0x17e5a0;}})[_0x4f87('0x47')](function(_0x469246){logger[_0x4f87('0x2a')](_0x4f87('0x54'),_0x469246);throw _0x469246;});}return _0x17e5a0;})['then'](respondWithResult(_0x1cf8c5,0xc9))[_0x4f87('0x47')](handleError(_0x1cf8c5,null));};exports['update']=function(_0x4215cb,_0x5cabb8){if(_0x4215cb[_0x4f87('0x4b')]['id']){delete _0x4215cb[_0x4f87('0x4b')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x4215cb[_0x4f87('0x55')]['id']}})[_0x4f87('0x27')](handleEntityNotFound(_0x5cabb8,null))['then'](saveUpdates(_0x4215cb[_0x4f87('0x4b')],null))[_0x4f87('0x27')](respondWithResult(_0x5cabb8,null))[_0x4f87('0x47')](handleError(_0x5cabb8,null));};exports[_0x4f87('0x28')]=function(_0x66b9f0,_0x11ab06){return db['SquareProject'][_0x4f87('0x56')]({'where':{'id':_0x66b9f0[_0x4f87('0x55')]['id']}})[_0x4f87('0x27')](handleEntityNotFound(_0x11ab06,null))[_0x4f87('0x27')](removeEntity(_0x11ab06,null))[_0x4f87('0x47')](handleError(_0x11ab06,null));};exports[_0x4f87('0x57')]=function(_0x201561,_0x290c83,_0x4576e7){return db[_0x4f87('0x44')][_0x4f87('0x56')]({'where':{'id':_0x201561[_0x4f87('0x55')]['id']}})['then'](handleEntityNotFound(_0x290c83,null))[_0x4f87('0x27')](function(_0x2bea65){if(_0x2bea65){return _0x2bea65[_0x4f87('0x57')](_0x201561['body'][_0x4f87('0x58')],_['omit'](_0x201561[_0x4f87('0x4b')],[_0x4f87('0x58'),'id'])||{});}})['then'](respondWithResult(_0x290c83,null))[_0x4f87('0x47')](handleError(_0x290c83,null));};exports[_0x4f87('0x59')]=function(_0xcc2141,_0x12af39,_0x5b7868){return db['SquareProject'][_0x4f87('0x56')]({'where':{'id':_0xcc2141[_0x4f87('0x55')]['id']}})[_0x4f87('0x27')](handleEntityNotFound(_0x12af39,null))[_0x4f87('0x27')](function(_0x2d12a9){if(_0x2d12a9){return _0x2d12a9['removeUsers'](_0xcc2141[_0x4f87('0x33')][_0x4f87('0x58')])[_0x4f87('0x27')](function(){if(_[_0x4f87('0x5a')](_0xcc2141[_0x4f87('0x33')][_0x4f87('0x58')])){for(var _0x1d6d7c=0x0;_0x1d6d7c<_0xcc2141['query']['ids'][_0x4f87('0x39')];_0x1d6d7c+=0x1){socket[_0x4f87('0x5b')](_0x4f87('0x5c'),{'UserId':Number(_0xcc2141[_0x4f87('0x33')][_0x4f87('0x58')][_0x1d6d7c]),'SquareProjectId':Number(_0xcc2141[_0x4f87('0x55')]['id'])});}}else{socket[_0x4f87('0x5b')](_0x4f87('0x5c'),{'UserId':Number(_0xcc2141['query'][_0x4f87('0x58')]),'SquareProjectId':Number(_0xcc2141[_0x4f87('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x12af39,null))[_0x4f87('0x47')](handleError(_0x12af39,null));};exports[_0x4f87('0x5d')]=function(_0x314578,_0x5a1903,_0x1ed052){var _0x1def6b={};var _0x21e417={};var _0xa739c0;var _0x2cd726;return db['SquareProject']['findOne']({'where':{'id':_0x314578[_0x4f87('0x55')]['id']}})[_0x4f87('0x27')](handleEntityNotFound(_0x5a1903,null))['then'](function(_0x7dcde){if(_0x7dcde){_0xa739c0=_0x7dcde;_0x21e417[_0x4f87('0x32')]=_['keys'](db[_0x4f87('0x5e')][_0x4f87('0x2f')]);_0x21e417[_0x4f87('0x33')]=_[_0x4f87('0x34')](_0x314578['query']);_0x21e417[_0x4f87('0x35')]=_[_0x4f87('0x37')](_0x21e417[_0x4f87('0x32')],_0x21e417['query']);_0x1def6b['attributes']=_[_0x4f87('0x37')](_0x21e417[_0x4f87('0x32')],qs[_0x4f87('0x38')](_0x314578['query']['fields']));_0x1def6b[_0x4f87('0x36')]=_0x1def6b[_0x4f87('0x36')][_0x4f87('0x39')]?_0x1def6b[_0x4f87('0x36')]:_0x21e417['model'];_0x1def6b[_0x4f87('0x3a')]=qs[_0x4f87('0x3b')](_0x314578[_0x4f87('0x33')][_0x4f87('0x3b')]);_0x1def6b[_0x4f87('0x3c')]=qs[_0x4f87('0x35')](_[_0x4f87('0x3d')](_0x314578[_0x4f87('0x33')],_0x21e417[_0x4f87('0x35')]));if(_0x314578[_0x4f87('0x33')][_0x4f87('0x41')]){_0x1def6b[_0x4f87('0x3c')]=_[_0x4f87('0x3e')](_0x1def6b[_0x4f87('0x3c')],{'$or':_[_0x4f87('0x3f')](_0x1def6b[_0x4f87('0x36')],function(_0x44c79a){var _0x585dbf={};_0x585dbf[_0x44c79a]={'$like':'%'+_0x314578[_0x4f87('0x33')]['filter']+'%'};return _0x585dbf;})});}_0x1def6b=_[_0x4f87('0x3e')]({},_0x1def6b,_0x314578[_0x4f87('0x42')]);return _0xa739c0[_0x4f87('0x5d')](_0x1def6b);}})[_0x4f87('0x27')](function(_0xbe9277){if(_0xbe9277){_0x2cd726=_0xbe9277[_0x4f87('0x39')];if(!_0x314578['query'][_0x4f87('0x5f')](_0x4f87('0x60'))){_0x1def6b[_0x4f87('0x22')]=qs['limit'](_0x314578['query']['limit']);_0x1def6b[_0x4f87('0x21')]=qs['offset'](_0x314578[_0x4f87('0x33')][_0x4f87('0x21')]);}return _0xa739c0[_0x4f87('0x5d')](_0x1def6b);}})[_0x4f87('0x27')](function(_0x10e0bf){if(_0x10e0bf){return _0x10e0bf?{'count':_0x2cd726,'rows':_0x10e0bf}:null;}})[_0x4f87('0x27')](respondWithResult(_0x5a1903,null))[_0x4f87('0x47')](handleError(_0x5a1903,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0890fc3..a89d3ce 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 _0xc178=['setMaxListeners','update','emit','events'];(function(_0x5ee211,_0x3f31a3){var _0x46fc90=function(_0x44f6d8){while(--_0x44f6d8){_0x5ee211['push'](_0x5ee211['shift']());}};_0x46fc90(++_0x3f31a3);}(_0xc178,0xeb));var _0x8c17=function(_0x55e092,_0x563fce){_0x55e092=_0x55e092-0x0;var _0x2aa26b=_0xc178[_0x55e092];return _0x2aa26b;};'use strict';var EventEmitter=require(_0x8c17('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8c17('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c17('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3a9640){return function(_0x1dba22,_0x3a2046,_0x51c1e5){SquareProjectEvents[_0x8c17('0x3')](_0x3a9640+':'+_0x1dba22['id'],_0x1dba22);SquareProjectEvents[_0x8c17('0x3')](_0x3a9640,_0x1dba22);_0x51c1e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x9f94=['exports','events','../../mysqldb','SquareProject','update','remove','emit','hasOwnProperty','hook'];(function(_0x33ef98,_0x5ed445){var _0x19d2d1=function(_0x343da0){while(--_0x343da0){_0x33ef98['push'](_0x33ef98['shift']());}};_0x19d2d1(++_0x5ed445);}(_0x9f94,0x1e7));var _0x49f9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9f94[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x49f9('0x0'));var SquareProject=require(_0x49f9('0x1'))['db'][_0x49f9('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x49f9('0x3'),'afterDestroy':_0x49f9('0x4')};function emitEvent(_0xb643ef){return function(_0x375856,_0x18492d,_0x483eed){SquareProjectEvents[_0x49f9('0x5')](_0xb643ef+':'+_0x375856['id'],_0x375856);SquareProjectEvents[_0x49f9('0x5')](_0xb643ef,_0x375856);_0x483eed(null);};}for(var e in events){if(events[_0x49f9('0x6')](e)){var event=events[e];SquareProject[_0x49f9('0x7')](e,emitEvent(event));}}module[_0x49f9('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 8b9e50a..487e520 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 _0x1967=['path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2fc6cf,_0x2bb133){var _0xf2ade3=function(_0x522b04){while(--_0x522b04){_0x2fc6cf['push'](_0x2fc6cf['shift']());}};_0xf2ade3(++_0x2bb133);}(_0x1967,0x173));var _0x7196=function(_0x13c99b,_0x3122aa){_0x13c99b=_0x13c99b-0x0;var _0x21f56d=_0x1967[_0x13c99b];return _0x21f56d;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['path','rimraf','../../config/environment','./squareProject.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x47a6b6,_0x3118ed){var _0xfaf92d=function(_0x56958d){while(--_0x56958d){_0x47a6b6['push'](_0x47a6b6['shift']());}};_0xfaf92d(++_0x3118ed);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1233d2,_0x5416f4){_0x1233d2=_0x1233d2-0x0;var _0x22759e=_0x0b0e[_0x1233d2];return _0x22759e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3df34b2..b4ff00c 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 _0x721b=['request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareProject','SquareProject','options','raw','where','include','map','attributes','model','then','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register'];(function(_0x3f8282,_0x11b607){var _0x50f918=function(_0x3a37de){while(--_0x3a37de){_0x3f8282['push'](_0x3f8282['shift']());}};_0x50f918(++_0x11b607);}(_0x721b,0x64));var _0xb721=function(_0x396c5d,_0x1aa264){_0x396c5d=_0x396c5d-0x0;var _0x54de24=_0x721b[_0x396c5d];return _0x54de24;};'use strict';var _=require('lodash');var util=require(_0xb721('0x0'));var moment=require(_0xb721('0x1'));var BPromise=require(_0xb721('0x2'));var rs=require(_0xb721('0x3'));var fs=require('fs');var Redis=require(_0xb721('0x4'));var db=require(_0xb721('0x5'))['db'];var utils=require(_0xb721('0x6'));var logger=require('../../config/logger')(_0xb721('0x7'));var config=require(_0xb721('0x8'));var jayson=require(_0xb721('0x9'));var client=jayson['client'][_0xb721('0xa')]({'port':0x232a});config[_0xb721('0xb')]=_[_0xb721('0xc')](config[_0xb721('0xb')],{'host':_0xb721('0xd'),'port':0x18eb});var socket=require(_0xb721('0xe'))(new Redis(config[_0xb721('0xb')]));require(_0xb721('0xf'))[_0xb721('0x10')](socket);function respondWithRpcPromise(_0x43b6db,_0x5d99ff,_0x160cf4){return new BPromise(function(_0x391211,_0x299148){return client[_0xb721('0x11')](_0x43b6db,_0x160cf4)['then'](function(_0x55cc0a){logger[_0xb721('0x12')](_0xb721('0x13'),_0x5d99ff,_0xb721('0x14'));logger[_0xb721('0x15')](_0xb721('0x16'),_0x5d99ff,_0xb721('0x14'),JSON[_0xb721('0x17')](_0x55cc0a));if(_0x55cc0a[_0xb721('0x18')]){if(_0x55cc0a[_0xb721('0x18')][_0xb721('0x19')]===0x1f4){logger[_0xb721('0x18')](_0xb721('0x13'),_0x5d99ff,_0x55cc0a[_0xb721('0x18')]['message']);return _0x299148(_0x55cc0a[_0xb721('0x18')]['message']);}logger[_0xb721('0x18')](_0xb721('0x13'),_0x5d99ff,_0x55cc0a['error'][_0xb721('0x1a')]);return _0x391211(_0x55cc0a[_0xb721('0x18')][_0xb721('0x1a')]);}else{logger[_0xb721('0x12')](_0xb721('0x13'),_0x5d99ff,_0xb721('0x14'));_0x391211(_0x55cc0a[_0xb721('0x1b')][_0xb721('0x1a')]);}})['catch'](function(_0x308b3c){logger['error'](_0xb721('0x13'),_0x5d99ff,_0x308b3c);_0x299148(_0x308b3c);});});}exports[_0xb721('0x1c')]=function(_0x31d0c4){var _0x384aec=this;return new Promise(function(_0x4e8c75,_0x29b2ec){return db[_0xb721('0x1d')]['find']({'raw':_0x31d0c4['options']?_0x31d0c4[_0xb721('0x1e')][_0xb721('0x1f')]===undefined?!![]:![]:!![],'where':_0x31d0c4[_0xb721('0x1e')]?_0x31d0c4[_0xb721('0x1e')][_0xb721('0x20')]||null:null,'attributes':_0x31d0c4[_0xb721('0x1e')]?_0x31d0c4[_0xb721('0x1e')]['attributes']||null:null,'include':_0x31d0c4[_0xb721('0x1e')]?_0x31d0c4[_0xb721('0x1e')][_0xb721('0x21')]?_[_0xb721('0x22')](_0x31d0c4[_0xb721('0x1e')]['include'],function(_0x5de36d){return{'model':db[_0x5de36d['model']],'as':_0x5de36d['as'],'attributes':_0x5de36d[_0xb721('0x23')],'include':_0x5de36d['include']?_[_0xb721('0x22')](_0x5de36d[_0xb721('0x21')],function(_0x58cbde){return{'model':db[_0x58cbde[_0xb721('0x24')]],'as':_0x58cbde['as'],'attributes':_0x58cbde[_0xb721('0x23')],'include':_0x58cbde[_0xb721('0x21')]?_[_0xb721('0x22')](_0x58cbde[_0xb721('0x21')],function(_0xd0fc06){return{'model':db[_0xd0fc06[_0xb721('0x24')]],'as':_0xd0fc06['as'],'attributes':_0xd0fc06[_0xb721('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb721('0x25')](function(_0x17c49c){logger['info']('ShowSquareProject',_0x31d0c4);logger[_0xb721('0x15')](_0xb721('0x1c'),_0x31d0c4,JSON[_0xb721('0x17')](_0x17c49c));_0x4e8c75(_0x17c49c);})[_0xb721('0x26')](function(_0x53211d){logger['error']('ShowSquareProject',_0x53211d['message'],_0x31d0c4);_0x29b2ec(_0x384aec['error'](0x1f4,_0x53211d[_0xb721('0x1a')]));});});}; \ No newline at end of file +var _0x0c2f=['where','attributes','include','map','model','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject','find','options','raw'];(function(_0x561bf3,_0x3a6436){var _0x5ea5ac=function(_0x29a565){while(--_0x29a565){_0x561bf3['push'](_0x561bf3['shift']());}};_0x5ea5ac(++_0x3a6436);}(_0x0c2f,0x1be));var _0xf0c2=function(_0x57062a,_0x123026){_0x57062a=_0x57062a-0x0;var _0xa178da=_0x0c2f[_0x57062a];return _0xa178da;};'use strict';var _=require(_0xf0c2('0x0'));var util=require(_0xf0c2('0x1'));var moment=require(_0xf0c2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0c2('0x3'));var db=require(_0xf0c2('0x4'))['db'];var utils=require(_0xf0c2('0x5'));var logger=require(_0xf0c2('0x6'))(_0xf0c2('0x7'));var config=require(_0xf0c2('0x8'));var jayson=require(_0xf0c2('0x9'));var client=jayson[_0xf0c2('0xa')][_0xf0c2('0xb')]({'port':0x232a});config[_0xf0c2('0xc')]=_[_0xf0c2('0xd')](config[_0xf0c2('0xc')],{'host':_0xf0c2('0xe'),'port':0x18eb});var socket=require(_0xf0c2('0xf'))(new Redis(config[_0xf0c2('0xc')]));require('./squareProject.socket')[_0xf0c2('0x10')](socket);function respondWithRpcPromise(_0x172a16,_0x98b1f1,_0x12c6f1){return new BPromise(function(_0x1b6f74,_0x52cee4){return client[_0xf0c2('0x11')](_0x172a16,_0x12c6f1)[_0xf0c2('0x12')](function(_0xff6d12){logger[_0xf0c2('0x13')]('SquareProject,\x20%s,\x20%s',_0x98b1f1,'request\x20sent');logger[_0xf0c2('0x14')](_0xf0c2('0x15'),_0x98b1f1,_0xf0c2('0x16'),JSON['stringify'](_0xff6d12));if(_0xff6d12[_0xf0c2('0x17')]){if(_0xff6d12['error'][_0xf0c2('0x18')]===0x1f4){logger[_0xf0c2('0x17')](_0xf0c2('0x19'),_0x98b1f1,_0xff6d12[_0xf0c2('0x17')]['message']);return _0x52cee4(_0xff6d12[_0xf0c2('0x17')][_0xf0c2('0x1a')]);}logger[_0xf0c2('0x17')]('SquareProject,\x20%s,\x20%s',_0x98b1f1,_0xff6d12[_0xf0c2('0x17')]['message']);return _0x1b6f74(_0xff6d12[_0xf0c2('0x17')][_0xf0c2('0x1a')]);}else{logger[_0xf0c2('0x13')](_0xf0c2('0x19'),_0x98b1f1,'request\x20sent');_0x1b6f74(_0xff6d12[_0xf0c2('0x1b')][_0xf0c2('0x1a')]);}})[_0xf0c2('0x1c')](function(_0x21d5b7){logger['error'](_0xf0c2('0x19'),_0x98b1f1,_0x21d5b7);_0x52cee4(_0x21d5b7);});});}exports[_0xf0c2('0x1d')]=function(_0x50f299){var _0x493081=this;return new Promise(function(_0x151a54,_0x221286){return db[_0xf0c2('0x1e')][_0xf0c2('0x1f')]({'raw':_0x50f299[_0xf0c2('0x20')]?_0x50f299[_0xf0c2('0x20')][_0xf0c2('0x21')]===undefined?!![]:![]:!![],'where':_0x50f299[_0xf0c2('0x20')]?_0x50f299[_0xf0c2('0x20')][_0xf0c2('0x22')]||null:null,'attributes':_0x50f299[_0xf0c2('0x20')]?_0x50f299[_0xf0c2('0x20')][_0xf0c2('0x23')]||null:null,'include':_0x50f299[_0xf0c2('0x20')]?_0x50f299[_0xf0c2('0x20')][_0xf0c2('0x24')]?_[_0xf0c2('0x25')](_0x50f299['options'][_0xf0c2('0x24')],function(_0x2b6dd7){return{'model':db[_0x2b6dd7[_0xf0c2('0x26')]],'as':_0x2b6dd7['as'],'attributes':_0x2b6dd7[_0xf0c2('0x23')],'include':_0x2b6dd7['include']?_[_0xf0c2('0x25')](_0x2b6dd7[_0xf0c2('0x24')],function(_0x56bb79){return{'model':db[_0x56bb79['model']],'as':_0x56bb79['as'],'attributes':_0x56bb79[_0xf0c2('0x23')],'include':_0x56bb79['include']?_[_0xf0c2('0x25')](_0x56bb79[_0xf0c2('0x24')],function(_0x59d77d){return{'model':db[_0x59d77d[_0xf0c2('0x26')]],'as':_0x59d77d['as'],'attributes':_0x59d77d[_0xf0c2('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd74938){logger[_0xf0c2('0x13')](_0xf0c2('0x1d'),_0x50f299);logger[_0xf0c2('0x14')](_0xf0c2('0x1d'),_0x50f299,JSON[_0xf0c2('0x27')](_0xd74938));_0x151a54(_0xd74938);})[_0xf0c2('0x1c')](function(_0x217b99){logger[_0xf0c2('0x17')](_0xf0c2('0x1d'),_0x217b99[_0xf0c2('0x1a')],_0x50f299);_0x221286(_0x493081[_0xf0c2('0x17')](0x1f4,_0x217b99[_0xf0c2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 63ca75c..6e11ae0 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 _0x9536=['length','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x9536,0x179));var _0x6953=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x9536[_0x3cea78];return _0x33b66b;};'use strict';var SquareProjectEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),_0x6953('0x2'),_0x6953('0x3')];function createListener(_0x4d218f,_0xc3e4dd){return function(_0x53b172){_0xc3e4dd[_0x6953('0x4')](_0x4d218f,_0x53b172);};}function removeListener(_0x3c32c7,_0x1dee7c){return function(){SquareProjectEvents[_0x6953('0x5')](_0x3c32c7,_0x1dee7c);};}exports[_0x6953('0x6')]=function(_0x494ac2){for(var _0x2b273e=0x0,_0x2bb026=events[_0x6953('0x7')];_0x2b273e<_0x2bb026;_0x2b273e++){var _0x3e1aff=events[_0x2b273e];var _0x1c8225=createListener('squareProject:'+_0x3e1aff,_0x494ac2);SquareProjectEvents['on'](_0x3e1aff,_0x1c8225);}}; \ No newline at end of file +var _0xe3da=['length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x26053b,_0x4947c5){var _0x8b1471=function(_0x5ef424){while(--_0x5ef424){_0x26053b['push'](_0x26053b['shift']());}};_0x8b1471(++_0x4947c5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var SquareProjectEvents=require(_0xae3d('0x0'));var events=[_0xae3d('0x1'),_0xae3d('0x2'),_0xae3d('0x3')];function createListener(_0x2bba92,_0x190f0d){return function(_0x109dca){_0x190f0d[_0xae3d('0x4')](_0x2bba92,_0x109dca);};}function removeListener(_0xb2dfd3,_0x22bacf){return function(){SquareProjectEvents[_0xae3d('0x5')](_0xb2dfd3,_0x22bacf);};}exports[_0xae3d('0x6')]=function(_0xa9a1a){for(var _0xa54808=0x0,_0x476579=events[_0xae3d('0x7')];_0xa54808<_0x476579;_0xa54808++){var _0x583b98=events[_0xa54808];var _0x2a5c45=createListener(_0xae3d('0x8')+_0x583b98,_0xa9a1a);SquareProjectEvents['on'](_0x583b98,_0x2a5c45);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 4669171..039311b 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 _0x1e9e=['update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','download','post','create','/:id'];(function(_0x58778d,_0x33c861){var _0x4be98f=function(_0x580b64){while(--_0x580b64){_0x58778d['push'](_0x58778d['shift']());}};_0x4be98f(++_0x33c861);}(_0x1e9e,0x15e));var _0xe1e9=function(_0x19b6a7,_0x58a4ed){_0x19b6a7=_0x19b6a7-0x0;var _0x76f1f4=_0x1e9e[_0x19b6a7];return _0x76f1f4;};'use strict';var multer=require(_0xe1e9('0x0'));var util=require(_0xe1e9('0x1'));var path=require(_0xe1e9('0x2'));var timeout=require(_0xe1e9('0x3'));var express=require(_0xe1e9('0x4'));var router=express[_0xe1e9('0x5')]();var auth=require(_0xe1e9('0x6'));var interaction=require(_0xe1e9('0x7'));var config=require(_0xe1e9('0x8'));var controller=require(_0xe1e9('0x9'));router[_0xe1e9('0xa')]('/',auth[_0xe1e9('0xb')](),controller[_0xe1e9('0xc')]);router['get']('/:id',auth[_0xe1e9('0xb')](),controller[_0xe1e9('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xe1e9('0xe')]);router[_0xe1e9('0xf')]('/',auth[_0xe1e9('0xb')](),controller[_0xe1e9('0x10')]);router['put'](_0xe1e9('0x11'),auth[_0xe1e9('0xb')](),controller[_0xe1e9('0x12')]);router[_0xe1e9('0x13')](_0xe1e9('0x14'),auth[_0xe1e9('0xb')](),controller[_0xe1e9('0x15')]);module[_0xe1e9('0x16')]=router; \ No newline at end of file +var _0x8957=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','/:id/download','download','post','create','put','/:id/delete','destroy','exports','multer','util'];(function(_0x5b89bb,_0x2c7298){var _0x5f41d1=function(_0xc0de81){while(--_0xc0de81){_0x5b89bb['push'](_0x5b89bb['shift']());}};_0x5f41d1(++_0x2c7298);}(_0x8957,0xf5));var _0x7895=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7895('0x0'));var util=require(_0x7895('0x1'));var path=require(_0x7895('0x2'));var timeout=require(_0x7895('0x3'));var express=require(_0x7895('0x4'));var router=express[_0x7895('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7895('0x6'));var config=require(_0x7895('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0x7895('0x8')](),controller[_0x7895('0x9')]);router['get'](_0x7895('0xa'),auth[_0x7895('0x8')](),controller['show']);router['get'](_0x7895('0xb'),auth[_0x7895('0x8')](),controller[_0x7895('0xc')]);router[_0x7895('0xd')]('/',auth[_0x7895('0x8')](),controller[_0x7895('0xe')]);router[_0x7895('0xf')](_0x7895('0xa'),auth[_0x7895('0x8')](),controller['update']);router['delete'](_0x7895('0x10'),auth[_0x7895('0x8')](),controller[_0x7895('0x11')]);module[_0x7895('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 83b2e7a..eb9fddd 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 _0xd09b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x509da2,_0xd2f81a){var _0x277535=function(_0x4823bb){while(--_0x4823bb){_0x509da2['push'](_0x509da2['shift']());}};_0x277535(++_0xd2f81a);}(_0xd09b,0x1da));var _0xbd09=function(_0x5699bd,_0x6dc496){_0x5699bd=_0x5699bd-0x0;var _0x117b17=_0xd09b[_0x5699bd];return _0x117b17;};'use strict';var Sequelize=require(_0xbd09('0x0'));module[_0xbd09('0x1')]={'uniqueid':{'type':Sequelize[_0xbd09('0x2')]},'callerid':{'type':Sequelize[_0xbd09('0x2')]},'calleridname':{'type':Sequelize[_0xbd09('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbd09('0x2')]},'priority':{'type':Sequelize[_0xbd09('0x2')]},'accountcode':{'type':Sequelize[_0xbd09('0x2')]},'dnid':{'type':Sequelize[_0xbd09('0x2')]},'projectName':{'type':Sequelize[_0xbd09('0x2')]},'saveName':{'type':Sequelize[_0xbd09('0x2')]},'filename':{'type':Sequelize[_0xbd09('0x2')]},'savePath':{'type':Sequelize[_0xbd09('0x2')]},'format':{'type':Sequelize[_0xbd09('0x3')],'get':function(){var _0x7bcae8='';var _0x3609f4=this[_0xbd09('0x4')](_0xbd09('0x5'));if(_0x3609f4){_0x7bcae8=_0x3609f4[_0xbd09('0x6')](_0x3609f4[_0xbd09('0x7')]('.'));}return _0x7bcae8;}}}; \ No newline at end of file +var _0xa729=['STRING','VIRTUAL','substring','lastIndexOf','sequelize','exports'];(function(_0x56eacb,_0x2c5f66){var _0x1b7ee9=function(_0x285236){while(--_0x285236){_0x56eacb['push'](_0x56eacb['shift']());}};_0x1b7ee9(++_0x2c5f66);}(_0xa729,0x160));var _0x9a72=function(_0x4e0772,_0x3acd20){_0x4e0772=_0x4e0772-0x0;var _0x1e91d7=_0xa729[_0x4e0772];return _0x1e91d7;};'use strict';var Sequelize=require(_0x9a72('0x0'));module[_0x9a72('0x1')]={'uniqueid':{'type':Sequelize[_0x9a72('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9a72('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9a72('0x2')]},'accountcode':{'type':Sequelize[_0x9a72('0x2')]},'dnid':{'type':Sequelize[_0x9a72('0x2')]},'projectName':{'type':Sequelize[_0x9a72('0x2')]},'saveName':{'type':Sequelize[_0x9a72('0x2')]},'filename':{'type':Sequelize[_0x9a72('0x2')]},'savePath':{'type':Sequelize[_0x9a72('0x2')]},'format':{'type':Sequelize[_0x9a72('0x3')],'get':function(){var _0x5671c9='';var _0x55f567=this['getDataValue']('savePath');if(_0x55f567){_0x5671c9=_0x55f567[_0x9a72('0x4')](_0x55f567[_0x9a72('0x5')]('.'));}return _0x5671c9;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f86f641..6a4b4ec 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 _0x070a=['catch','show','params','keys','rawAttributes','find','create','body','download','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','filename','unlink','message','send','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','end','error','stack','name','index','SquareRecording','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows'];(function(_0x1ad7d5,_0x4e06db){var _0x100716=function(_0x3d4de2){while(--_0x3d4de2){_0x1ad7d5['push'](_0x1ad7d5['shift']());}};_0x100716(++_0x4e06db);}(_0x070a,0x19c));var _0xa070=function(_0x2b2aea,_0xd77e72){_0x2b2aea=_0x2b2aea-0x0;var _0x56a379=_0x070a[_0x2b2aea];return _0x56a379;};'use strict';var pdf=require(_0xa070('0x0'));var emlformat=require(_0xa070('0x1'));var rimraf=require(_0xa070('0x2'));var zipdir=require(_0xa070('0x3'));var jsonpatch=require(_0xa070('0x4'));var rp=require('request-promise');var moment=require(_0xa070('0x5'));var BPromise=require(_0xa070('0x6'));var Mustache=require(_0xa070('0x7'));var util=require(_0xa070('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa070('0x9'));var ejs=require(_0xa070('0xa'));var fs=require('fs');var _=require(_0xa070('0xb'));var squel=require('squel');var crypto=require(_0xa070('0xc'));var jsforce=require(_0xa070('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa070('0xe'));var Papa=require(_0xa070('0xf'));var Redis=require(_0xa070('0x10'));var authService=require(_0xa070('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa070('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa070('0x13'))(_0xa070('0x14'));var utils=require(_0xa070('0x15'));var config=require(_0xa070('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4703e9,_0x1835e6){_0x1835e6=_0x1835e6||0xcc;return function(_0x14b19c){if(_0x14b19c){return _0x4703e9[_0xa070('0x17')](_0x1835e6);}return _0x4703e9[_0xa070('0x18')](_0x1835e6)['end']();};}function respondWithResult(_0x416115,_0x1af920){_0x1af920=_0x1af920||0xc8;return function(_0x4052ca){if(_0x4052ca){return _0x416115[_0xa070('0x18')](_0x1af920)[_0xa070('0x19')](_0x4052ca);}};}function respondWithFilteredResult(_0x52f475,_0x151dac){return function(_0x3bfe1f){if(_0x3bfe1f){var _0x2f0be3=_0x3bfe1f[_0xa070('0x1a')],_0x4931e2=_0x151dac[_0xa070('0x1b')],_0x8030c9=_0x151dac[_0xa070('0x1b')]+_0x151dac[_0xa070('0x1c')],_0x4f2a2b;if(_0x8030c9>=_0x2f0be3){_0x8030c9=_0x2f0be3;_0x4f2a2b=0xc8;}else{_0x4f2a2b=0xce;}_0x52f475[_0xa070('0x18')](_0x4f2a2b);return _0x52f475[_0xa070('0x1d')](_0xa070('0x1e'),_0x4931e2+'-'+_0x8030c9+'/'+_0x2f0be3)['json'](_0x3bfe1f);}return null;};}function patchUpdates(_0x5aa1da){return function(_0x583557){try{jsonpatch[_0xa070('0x1f')](_0x583557,_0x5aa1da,!![]);}catch(_0x3529d4){return BPromise['reject'](_0x3529d4);}return _0x583557[_0xa070('0x20')]();};}function saveUpdates(_0x4ee6e7,_0x5c92d6){return function(_0x11ce23){if(_0x11ce23){return _0x11ce23['update'](_0x4ee6e7)[_0xa070('0x21')](function(_0x2c3386){return _0x2c3386;});}return null;};}function removeEntity(_0x4a0691,_0x1ac167){return function(_0x25f4f3){if(_0x25f4f3){return _0x25f4f3['destroy']()[_0xa070('0x21')](function(){_0x4a0691[_0xa070('0x18')](0xcc)[_0xa070('0x22')]();});}};}function handleEntityNotFound(_0x272253,_0x11a832){return function(_0x2fbdce){if(!_0x2fbdce){_0x272253[_0xa070('0x17')](0x194);}return _0x2fbdce;};}function handleError(_0x404bef,_0x1d9594){_0x1d9594=_0x1d9594||0x1f4;return function(_0x4e18fe){logger[_0xa070('0x23')](_0x4e18fe[_0xa070('0x24')]);if(_0x4e18fe[_0xa070('0x25')]){delete _0x4e18fe[_0xa070('0x25')];}_0x404bef[_0xa070('0x18')](_0x1d9594)['send'](_0x4e18fe);};}exports[_0xa070('0x26')]=function(_0x4d5960,_0x3182d8){var _0x548890={},_0x266bd6={},_0x30741a={'count':0x0,'rows':[]};var _0x1a7920=_['map'](db[_0xa070('0x27')]['rawAttributes'],function(_0x247fd2){return{'name':_0x247fd2[_0xa070('0x28')],'type':_0x247fd2[_0xa070('0x29')]['key']};});_0x266bd6[_0xa070('0x2a')]=_[_0xa070('0x2b')](_0x1a7920,_0xa070('0x25'));_0x266bd6[_0xa070('0x2c')]=_['keys'](_0x4d5960[_0xa070('0x2c')]);_0x266bd6[_0xa070('0x2d')]=_[_0xa070('0x2e')](_0x266bd6[_0xa070('0x2a')],_0x266bd6[_0xa070('0x2c')]);_0x548890[_0xa070('0x2f')]=_[_0xa070('0x2e')](_0x266bd6[_0xa070('0x2a')],qs[_0xa070('0x30')](_0x4d5960[_0xa070('0x2c')][_0xa070('0x30')]));_0x548890['attributes']=_0x548890[_0xa070('0x2f')][_0xa070('0x31')]?_0x548890[_0xa070('0x2f')]:_0x266bd6[_0xa070('0x2a')];if(!_0x4d5960['query'][_0xa070('0x32')](_0xa070('0x33'))){_0x548890['limit']=qs[_0xa070('0x1c')](_0x4d5960[_0xa070('0x2c')]['limit']);_0x548890[_0xa070('0x1b')]=qs['offset'](_0x4d5960[_0xa070('0x2c')]['offset']);}_0x548890[_0xa070('0x34')]=qs['sort'](_0x4d5960['query'][_0xa070('0x35')]);_0x548890['where']=qs[_0xa070('0x2d')](_[_0xa070('0x36')](_0x4d5960[_0xa070('0x2c')],_0x266bd6['filters']),_0x1a7920);if(_0x4d5960[_0xa070('0x2c')]['filter']){_0x548890['where']=_[_0xa070('0x37')](_0x548890[_0xa070('0x38')],{'$or':_[_0xa070('0x2b')](_0x1a7920,function(_0x451f5a){if(_0x451f5a[_0xa070('0x29')]!==_0xa070('0x39')){var _0x84fc41={};_0x84fc41[_0x451f5a[_0xa070('0x25')]]={'$like':'%'+_0x4d5960[_0xa070('0x2c')][_0xa070('0x3a')]+'%'};return _0x84fc41;}})});}_0x548890=_['merge']({},_0x548890,_0x4d5960[_0xa070('0x3b')]);var _0x12ff36={'where':_0x548890[_0xa070('0x38')]};return db[_0xa070('0x27')][_0xa070('0x1a')](_0x12ff36)[_0xa070('0x21')](function(_0xdb65e){_0x30741a[_0xa070('0x1a')]=_0xdb65e;if(_0x4d5960[_0xa070('0x2c')][_0xa070('0x3c')]){_0x548890[_0xa070('0x3d')]=[{'all':!![]}];}return db[_0xa070('0x27')]['findAll'](_0x548890);})['then'](function(_0x312cdd){_0x30741a[_0xa070('0x3e')]=_0x312cdd;return _0x30741a;})[_0xa070('0x21')](respondWithFilteredResult(_0x3182d8,_0x548890))[_0xa070('0x3f')](handleError(_0x3182d8,null));};exports[_0xa070('0x40')]=function(_0x1eca16,_0xff9322){var _0x3ebf38={'raw':!![],'where':{'id':_0x1eca16[_0xa070('0x41')]['id']}},_0x361c37={};_0x361c37[_0xa070('0x2a')]=_[_0xa070('0x42')](db[_0xa070('0x27')][_0xa070('0x43')]);_0x361c37[_0xa070('0x2c')]=_[_0xa070('0x42')](_0x1eca16[_0xa070('0x2c')]);_0x361c37[_0xa070('0x2d')]=_['intersection'](_0x361c37['model'],_0x361c37['query']);_0x3ebf38['attributes']=_[_0xa070('0x2e')](_0x361c37[_0xa070('0x2a')],qs[_0xa070('0x30')](_0x1eca16[_0xa070('0x2c')][_0xa070('0x30')]));_0x3ebf38['attributes']=_0x3ebf38[_0xa070('0x2f')][_0xa070('0x31')]?_0x3ebf38['attributes']:_0x361c37[_0xa070('0x2a')];if(_0x1eca16['query']['includeAll']){_0x3ebf38['include']=[{'all':!![]}];}_0x3ebf38=_[_0xa070('0x37')]({},_0x3ebf38,_0x1eca16[_0xa070('0x3b')]);return db['SquareRecording'][_0xa070('0x44')](_0x3ebf38)[_0xa070('0x21')](handleEntityNotFound(_0xff9322,null))[_0xa070('0x21')](respondWithResult(_0xff9322,null))[_0xa070('0x3f')](handleError(_0xff9322,null));};exports['create']=function(_0x34ba09,_0x26f863){return db[_0xa070('0x27')][_0xa070('0x45')](_0x34ba09['body'],{})[_0xa070('0x21')](respondWithResult(_0x26f863,0xc9))[_0xa070('0x3f')](handleError(_0x26f863,null));};exports['update']=function(_0x53aab3,_0x363fff){if(_0x53aab3[_0xa070('0x46')]['id']){delete _0x53aab3[_0xa070('0x46')]['id'];}return db['SquareRecording'][_0xa070('0x44')]({'where':{'id':_0x53aab3[_0xa070('0x41')]['id']}})[_0xa070('0x21')](handleEntityNotFound(_0x363fff,null))[_0xa070('0x21')](saveUpdates(_0x53aab3[_0xa070('0x46')],null))[_0xa070('0x21')](respondWithResult(_0x363fff,null))[_0xa070('0x3f')](handleError(_0x363fff,null));};exports[_0xa070('0x47')]=function(_0x49ef40,_0x2dd8c1,_0x571c31){var _0x3b4104=require('../../components/encryptor');var _0x3ddf33=![];var _0x48c6d1={};if(_0x49ef40[_0xa070('0x2c')][_0xa070('0x29')]&&_0x49ef40[_0xa070('0x2c')][_0xa070('0x29')]===_0xa070('0x48')){_0x48c6d1[_0xa070('0x48')]=_0x49ef40['params']['id'];}else{_0x48c6d1['id']=_0x49ef40['params']['id'];}return db[_0xa070('0x27')][_0xa070('0x44')]({'where':_0x48c6d1,'attributes':['id',_0xa070('0x49'),'filename'],'raw':!![]})[_0xa070('0x21')](handleEntityNotFound(_0x2dd8c1,null))[_0xa070('0x21')](function(_0x12c079){if(_0x12c079){var _0x3a9b82=_0x12c079[_0xa070('0x49')];var _0x1b84e6=util[_0xa070('0x4a')](_0xa070('0x4b'),_0x3a9b82);if(fs['existsSync'](_0x1b84e6)){_0x3ddf33=!![];return _0x3b4104[_0xa070('0x4c')](_0x1b84e6,_0x3a9b82,config[_0xa070('0x4d')][_0xa070('0x4e')])[_0xa070('0x21')](function(){return _0x12c079;});}return _0x12c079;}})[_0xa070('0x21')](function(_0x1e2982){if(_0x1e2982){var _0x1c1bce=_0x1e2982['savePath'];if(!fs[_0xa070('0x4f')](_0x1c1bce)){throw new db[(_0xa070('0x50'))]['ValidationError'](_0xa070('0x51'));}if(_0x1e2982['filename']){return _0x2dd8c1[_0xa070('0x47')](_0x1c1bce,_0x1e2982[_0xa070('0x52')]+path['extname'](_0x1c1bce),function(){if(_0x3ddf33){fs[_0xa070('0x53')](_0x1c1bce);}});}else{return _0x2dd8c1[_0xa070('0x47')](_0x1c1bce,function(_0x5ce355){if(_0x3ddf33){fs[_0xa070('0x53')](_0x1c1bce);}});}}})[_0xa070('0x3f')](function(_0x72b017){if(_0x72b017[_0xa070('0x54')]==='SquareRecording\x20not\x20found'){_0x2dd8c1[_0xa070('0x18')](0x194)[_0xa070('0x55')](_0xa070('0x56'));}else{return handleError(_0x2dd8c1,null);}});};exports['destroy']=function(_0x2e0b2c,_0xa06e41){return db[_0xa070('0x27')][_0xa070('0x44')]({'where':{'id':_0x2e0b2c[_0xa070('0x41')]['id']}})['then'](function(_0x47724a){if(!_0x47724a)throw new ReferenceError(_0xa070('0x57'));return _0x47724a;})[_0xa070('0x21')](function(_0x5382dc){var _0x2e31a0=_0x5382dc[_0xa070('0x49')];logger[_0xa070('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x2e31a0);if(!_[_0xa070('0x59')](_0x5382dc[_0xa070('0x49')])&&fs[_0xa070('0x4f')](_0x2e31a0)){logger[_0xa070('0x58')](_0xa070('0x5a')+_0x2e31a0+_0xa070('0x5b'));fs['unlinkSync'](_0x2e31a0);}_0x2e31a0=_0x2e31a0+_0xa070('0x5c');if(!_[_0xa070('0x59')](_0x5382dc[_0xa070('0x49')])&&fs[_0xa070('0x4f')](_0x2e31a0)){logger[_0xa070('0x58')](_0xa070('0x5a')+_0x2e31a0+_0xa070('0x5b'));fs[_0xa070('0x5d')](_0x2e31a0);}return _0x5382dc;})[_0xa070('0x21')](function(_0xd0f2b0){if(!_0xd0f2b0)throw new InternalError();return _0xd0f2b0[_0xa070('0x5e')]();})[_0xa070('0x21')](function(){_0xa06e41['status'](0xcc)['end']();})['catch'](handleError(_0xa06e41,null));}; \ No newline at end of file +var _0x86e6=['where','pick','filter','merge','options','includeAll','include','catch','show','length','find','create','update','body','params','download','../../components/encryptor','filename','%s.cypher','existsSync','decryptFile','savePath','Sequelize','ValidationError','unlink','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0x86e6,0x82));var _0x686e=function(_0x2750d0,_0xd8d5ea){_0x2750d0=_0x2750d0-0x0;var _0x17f60c=_0x86e6[_0x2750d0];return _0x17f60c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x686e('0x0'));var rimraf=require(_0x686e('0x1'));var zipdir=require(_0x686e('0x2'));var jsonpatch=require(_0x686e('0x3'));var rp=require(_0x686e('0x4'));var moment=require(_0x686e('0x5'));var BPromise=require(_0x686e('0x6'));var Mustache=require('mustache');var util=require(_0x686e('0x7'));var path=require(_0x686e('0x8'));var sox=require(_0x686e('0x9'));var csv=require(_0x686e('0xa'));var ejs=require(_0x686e('0xb'));var fs=require('fs');var _=require(_0x686e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x686e('0xd'));var toCsv=require(_0x686e('0xa'));var querystring=require(_0x686e('0xe'));var Papa=require(_0x686e('0xf'));var Redis=require(_0x686e('0x10'));var authService=require(_0x686e('0x11'));var qs=require(_0x686e('0x12'));var as=require(_0x686e('0x13'));var hardwareService=require(_0x686e('0x14'));var logger=require(_0x686e('0x15'))(_0x686e('0x16'));var utils=require(_0x686e('0x17'));var config=require(_0x686e('0x18'));var db=require(_0x686e('0x19'))['db'];function respondWithStatusCode(_0x164565,_0x7f741c){_0x7f741c=_0x7f741c||0xcc;return function(_0x3279e1){if(_0x3279e1){return _0x164565[_0x686e('0x1a')](_0x7f741c);}return _0x164565['status'](_0x7f741c)[_0x686e('0x1b')]();};}function respondWithResult(_0x1e0536,_0x5ccfc0){_0x5ccfc0=_0x5ccfc0||0xc8;return function(_0x3fc656){if(_0x3fc656){return _0x1e0536[_0x686e('0x1c')](_0x5ccfc0)[_0x686e('0x1d')](_0x3fc656);}};}function respondWithFilteredResult(_0x38b719,_0x48b794){return function(_0x20ca0b){if(_0x20ca0b){var _0x36bca8=_0x20ca0b[_0x686e('0x1e')],_0x3a55fa=_0x48b794[_0x686e('0x1f')],_0x4f23a5=_0x48b794[_0x686e('0x1f')]+_0x48b794[_0x686e('0x20')],_0xa1e30c;if(_0x4f23a5>=_0x36bca8){_0x4f23a5=_0x36bca8;_0xa1e30c=0xc8;}else{_0xa1e30c=0xce;}_0x38b719[_0x686e('0x1c')](_0xa1e30c);return _0x38b719[_0x686e('0x21')](_0x686e('0x22'),_0x3a55fa+'-'+_0x4f23a5+'/'+_0x36bca8)[_0x686e('0x1d')](_0x20ca0b);}return null;};}function patchUpdates(_0x4e31ac){return function(_0x62c268){try{jsonpatch['apply'](_0x62c268,_0x4e31ac,!![]);}catch(_0x4f22bd){return BPromise[_0x686e('0x23')](_0x4f22bd);}return _0x62c268[_0x686e('0x24')]();};}function saveUpdates(_0x1c974a,_0x39d82b){return function(_0x34869f){if(_0x34869f){return _0x34869f['update'](_0x1c974a)[_0x686e('0x25')](function(_0x574152){return _0x574152;});}return null;};}function removeEntity(_0x5d17d2,_0x2f1a10){return function(_0x2a9917){if(_0x2a9917){return _0x2a9917[_0x686e('0x26')]()['then'](function(){_0x5d17d2[_0x686e('0x1c')](0xcc)[_0x686e('0x1b')]();});}};}function handleEntityNotFound(_0x11dc9f,_0x5cb9c8){return function(_0x3fa3cc){if(!_0x3fa3cc){_0x11dc9f[_0x686e('0x1a')](0x194);}return _0x3fa3cc;};}function handleError(_0x374366,_0x11e4aa){_0x11e4aa=_0x11e4aa||0x1f4;return function(_0x5b2f1b){logger[_0x686e('0x27')](_0x5b2f1b[_0x686e('0x28')]);if(_0x5b2f1b[_0x686e('0x29')]){delete _0x5b2f1b[_0x686e('0x29')];}_0x374366[_0x686e('0x1c')](_0x11e4aa)[_0x686e('0x2a')](_0x5b2f1b);};}exports[_0x686e('0x2b')]=function(_0xe13068,_0x4d1689){var _0x3d55e1={},_0x416bbb={},_0x520601={'count':0x0,'rows':[]};var _0x2b55ba=_[_0x686e('0x2c')](db[_0x686e('0x2d')][_0x686e('0x2e')],function(_0x1858f){return{'name':_0x1858f[_0x686e('0x2f')],'type':_0x1858f[_0x686e('0x30')]['key']};});_0x416bbb['model']=_[_0x686e('0x2c')](_0x2b55ba,_0x686e('0x29'));_0x416bbb[_0x686e('0x31')]=_[_0x686e('0x32')](_0xe13068[_0x686e('0x31')]);_0x416bbb[_0x686e('0x33')]=_[_0x686e('0x34')](_0x416bbb[_0x686e('0x35')],_0x416bbb[_0x686e('0x31')]);_0x3d55e1[_0x686e('0x36')]=_[_0x686e('0x34')](_0x416bbb[_0x686e('0x35')],qs[_0x686e('0x37')](_0xe13068[_0x686e('0x31')][_0x686e('0x37')]));_0x3d55e1[_0x686e('0x36')]=_0x3d55e1[_0x686e('0x36')]['length']?_0x3d55e1[_0x686e('0x36')]:_0x416bbb[_0x686e('0x35')];if(!_0xe13068[_0x686e('0x31')][_0x686e('0x38')](_0x686e('0x39'))){_0x3d55e1['limit']=qs[_0x686e('0x20')](_0xe13068['query'][_0x686e('0x20')]);_0x3d55e1[_0x686e('0x1f')]=qs[_0x686e('0x1f')](_0xe13068[_0x686e('0x31')]['offset']);}_0x3d55e1[_0x686e('0x3a')]=qs[_0x686e('0x3b')](_0xe13068[_0x686e('0x31')][_0x686e('0x3b')]);_0x3d55e1[_0x686e('0x3c')]=qs['filters'](_[_0x686e('0x3d')](_0xe13068[_0x686e('0x31')],_0x416bbb[_0x686e('0x33')]),_0x2b55ba);if(_0xe13068[_0x686e('0x31')][_0x686e('0x3e')]){_0x3d55e1[_0x686e('0x3c')]=_[_0x686e('0x3f')](_0x3d55e1[_0x686e('0x3c')],{'$or':_['map'](_0x2b55ba,function(_0x44bf85){if(_0x44bf85['type']!=='VIRTUAL'){var _0x4c6dc7={};_0x4c6dc7[_0x44bf85[_0x686e('0x29')]]={'$like':'%'+_0xe13068['query'][_0x686e('0x3e')]+'%'};return _0x4c6dc7;}})});}_0x3d55e1=_[_0x686e('0x3f')]({},_0x3d55e1,_0xe13068[_0x686e('0x40')]);var _0x2b8ac3={'where':_0x3d55e1[_0x686e('0x3c')]};return db['SquareRecording'][_0x686e('0x1e')](_0x2b8ac3)['then'](function(_0x51007a){_0x520601[_0x686e('0x1e')]=_0x51007a;if(_0xe13068['query'][_0x686e('0x41')]){_0x3d55e1[_0x686e('0x42')]=[{'all':!![]}];}return db[_0x686e('0x2d')]['findAll'](_0x3d55e1);})[_0x686e('0x25')](function(_0x24d8b1){_0x520601['rows']=_0x24d8b1;return _0x520601;})[_0x686e('0x25')](respondWithFilteredResult(_0x4d1689,_0x3d55e1))[_0x686e('0x43')](handleError(_0x4d1689,null));};exports[_0x686e('0x44')]=function(_0x1bf13b,_0x298b0c){var _0x21c783={'raw':!![],'where':{'id':_0x1bf13b['params']['id']}},_0x7ba9a0={};_0x7ba9a0[_0x686e('0x35')]=_['keys'](db[_0x686e('0x2d')][_0x686e('0x2e')]);_0x7ba9a0[_0x686e('0x31')]=_[_0x686e('0x32')](_0x1bf13b[_0x686e('0x31')]);_0x7ba9a0[_0x686e('0x33')]=_['intersection'](_0x7ba9a0[_0x686e('0x35')],_0x7ba9a0['query']);_0x21c783[_0x686e('0x36')]=_[_0x686e('0x34')](_0x7ba9a0['model'],qs[_0x686e('0x37')](_0x1bf13b[_0x686e('0x31')][_0x686e('0x37')]));_0x21c783[_0x686e('0x36')]=_0x21c783[_0x686e('0x36')][_0x686e('0x45')]?_0x21c783['attributes']:_0x7ba9a0[_0x686e('0x35')];if(_0x1bf13b[_0x686e('0x31')][_0x686e('0x41')]){_0x21c783[_0x686e('0x42')]=[{'all':!![]}];}_0x21c783=_[_0x686e('0x3f')]({},_0x21c783,_0x1bf13b[_0x686e('0x40')]);return db[_0x686e('0x2d')][_0x686e('0x46')](_0x21c783)['then'](handleEntityNotFound(_0x298b0c,null))[_0x686e('0x25')](respondWithResult(_0x298b0c,null))[_0x686e('0x43')](handleError(_0x298b0c,null));};exports['create']=function(_0x5d0c17,_0x110c84){return db[_0x686e('0x2d')][_0x686e('0x47')](_0x5d0c17['body'],{})[_0x686e('0x25')](respondWithResult(_0x110c84,0xc9))[_0x686e('0x43')](handleError(_0x110c84,null));};exports[_0x686e('0x48')]=function(_0x421f92,_0x21290d){if(_0x421f92[_0x686e('0x49')]['id']){delete _0x421f92[_0x686e('0x49')]['id'];}return db[_0x686e('0x2d')][_0x686e('0x46')]({'where':{'id':_0x421f92[_0x686e('0x4a')]['id']}})[_0x686e('0x25')](handleEntityNotFound(_0x21290d,null))[_0x686e('0x25')](saveUpdates(_0x421f92['body'],null))[_0x686e('0x25')](respondWithResult(_0x21290d,null))['catch'](handleError(_0x21290d,null));};exports[_0x686e('0x4b')]=function(_0x21c13e,_0x4f3838,_0xa21303){var _0x290b9d=require(_0x686e('0x4c'));var _0x1c81d7=![];var _0x320e5a={};if(_0x21c13e['query'][_0x686e('0x30')]&&_0x21c13e['query'][_0x686e('0x30')]==='uniqueid'){_0x320e5a['uniqueid']=_0x21c13e[_0x686e('0x4a')]['id'];}else{_0x320e5a['id']=_0x21c13e['params']['id'];}return db[_0x686e('0x2d')]['find']({'where':_0x320e5a,'attributes':['id','savePath',_0x686e('0x4d')],'raw':!![]})[_0x686e('0x25')](handleEntityNotFound(_0x4f3838,null))[_0x686e('0x25')](function(_0x2b4489){if(_0x2b4489){var _0x3c9407=_0x2b4489['savePath'];var _0x313d4f=util['format'](_0x686e('0x4e'),_0x3c9407);if(fs[_0x686e('0x4f')](_0x313d4f)){_0x1c81d7=!![];return _0x290b9d[_0x686e('0x50')](_0x313d4f,_0x3c9407,config['secrets']['recording'])[_0x686e('0x25')](function(){return _0x2b4489;});}return _0x2b4489;}})[_0x686e('0x25')](function(_0x2540f0){if(_0x2540f0){var _0x5ada2f=_0x2540f0[_0x686e('0x51')];if(!fs[_0x686e('0x4f')](_0x5ada2f)){throw new db[(_0x686e('0x52'))][(_0x686e('0x53'))]('SquareRecording\x20not\x20found');}if(_0x2540f0['filename']){return _0x4f3838['download'](_0x5ada2f,_0x2540f0[_0x686e('0x4d')]+path['extname'](_0x5ada2f),function(){if(_0x1c81d7){fs[_0x686e('0x54')](_0x5ada2f);}});}else{return _0x4f3838['download'](_0x5ada2f,function(_0x6cb04a){if(_0x1c81d7){fs[_0x686e('0x54')](_0x5ada2f);}});}}})[_0x686e('0x43')](function(_0x972273){if(_0x972273[_0x686e('0x55')]===_0x686e('0x56')){_0x4f3838[_0x686e('0x1c')](0x194)[_0x686e('0x2a')](_0x686e('0x57'));}else{return handleError(_0x4f3838,null);}});};exports[_0x686e('0x26')]=function(_0x67fa66,_0x253941){return db[_0x686e('0x2d')][_0x686e('0x46')]({'where':{'id':_0x67fa66[_0x686e('0x4a')]['id']}})[_0x686e('0x25')](function(_0x35e959){if(!_0x35e959)throw new ReferenceError(_0x686e('0x58'));return _0x35e959;})['then'](function(_0x598108){var _0x71e991=_0x598108[_0x686e('0x51')];logger[_0x686e('0x59')](_0x686e('0x5a'),_0x71e991);if(!_[_0x686e('0x5b')](_0x598108[_0x686e('0x51')])&&fs['existsSync'](_0x71e991)){logger[_0x686e('0x59')](_0x686e('0x5c')+_0x71e991+_0x686e('0x5d'));fs['unlinkSync'](_0x71e991);}_0x71e991=_0x71e991+'.cypher';if(!_[_0x686e('0x5b')](_0x598108[_0x686e('0x51')])&&fs['existsSync'](_0x71e991)){logger['info'](_0x686e('0x5c')+_0x71e991+_0x686e('0x5d'));fs[_0x686e('0x5e')](_0x71e991);}return _0x598108;})[_0x686e('0x25')](function(_0x39eb57){if(!_0x39eb57)throw new InternalError();return _0x39eb57[_0x686e('0x26')]();})['then'](function(){_0x253941[_0x686e('0x1c')](0xcc)[_0x686e('0x1b')]();})[_0x686e('0x43')](handleError(_0x253941,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8ade3bb..55446e1 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 _0x65e7=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0xe9724d,_0x4fd40d){var _0x1c7489=function(_0x4075a3){while(--_0x4075a3){_0xe9724d['push'](_0xe9724d['shift']());}};_0x1c7489(++_0x4fd40d);}(_0x65e7,0xb6));var _0x765e=function(_0x4be914,_0x2be70d){_0x4be914=_0x4be914-0x0;var _0x17d1b2=_0x65e7[_0x4be914];return _0x17d1b2;};'use strict';var _=require(_0x765e('0x0'));var util=require('util');var logger=require(_0x765e('0x1'))(_0x765e('0x2'));var moment=require(_0x765e('0x3'));var BPromise=require(_0x765e('0x4'));var rp=require(_0x765e('0x5'));var fs=require('fs');var path=require(_0x765e('0x6'));var rimraf=require(_0x765e('0x7'));var config=require(_0x765e('0x8'));var attributes=require(_0x765e('0x9'));module[_0x765e('0xa')]=function(_0x430440,_0x405d56){return _0x430440[_0x765e('0xb')](_0x765e('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f75=['square_recordings','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording'];(function(_0x15669d,_0x1f73da){var _0x16d102=function(_0x25e0cb){while(--_0x25e0cb){_0x15669d['push'](_0x15669d['shift']());}};_0x16d102(++_0x1f73da);}(_0x6f75,0xd2));var _0x56f7=function(_0x41424e,_0x5eca0f){_0x41424e=_0x41424e-0x0;var _0x217b49=_0x6f75[_0x41424e];return _0x217b49;};'use strict';var _=require('lodash');var util=require(_0x56f7('0x0'));var logger=require(_0x56f7('0x1'))(_0x56f7('0x2'));var moment=require(_0x56f7('0x3'));var BPromise=require(_0x56f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x56f7('0x5'));var config=require(_0x56f7('0x6'));var attributes=require(_0x56f7('0x7'));module[_0x56f7('0x8')]=function(_0x245a86,_0x2d85d5){return _0x245a86['define'](_0x56f7('0x9'),attributes,{'tableName':_0x56f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index d239f88..f682bf2 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 _0x2b69=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','body','raw','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x2b69,0x89));var _0x92b6=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2b69[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x92b6('0x0'));var util=require(_0x92b6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b6('0x2'))['db'];var utils=require(_0x92b6('0x3'));var logger=require(_0x92b6('0x4'))(_0x92b6('0x5'));var config=require(_0x92b6('0x6'));var jayson=require(_0x92b6('0x7'));var client=jayson['client'][_0x92b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x83778f,_0x25f6a2,_0x15e1ff){return new BPromise(function(_0x405687,_0x18ea3e){return client[_0x92b6('0x9')](_0x83778f,_0x15e1ff)[_0x92b6('0xa')](function(_0x136eff){logger[_0x92b6('0xb')](_0x92b6('0xc'),_0x25f6a2,_0x92b6('0xd'));logger[_0x92b6('0xe')](_0x92b6('0xf'),_0x25f6a2,_0x92b6('0xd'),JSON[_0x92b6('0x10')](_0x136eff));if(_0x136eff['error']){if(_0x136eff[_0x92b6('0x11')][_0x92b6('0x12')]===0x1f4){logger[_0x92b6('0x11')](_0x92b6('0xc'),_0x25f6a2,_0x136eff['error'][_0x92b6('0x13')]);return _0x18ea3e(_0x136eff['error'][_0x92b6('0x13')]);}logger[_0x92b6('0x11')](_0x92b6('0xc'),_0x25f6a2,_0x136eff[_0x92b6('0x11')]['message']);return _0x405687(_0x136eff[_0x92b6('0x11')][_0x92b6('0x13')]);}else{logger[_0x92b6('0xb')](_0x92b6('0xc'),_0x25f6a2,_0x92b6('0xd'));_0x405687(_0x136eff[_0x92b6('0x14')]['message']);}})[_0x92b6('0x15')](function(_0x4ec386){logger['error'](_0x92b6('0xc'),_0x25f6a2,_0x4ec386);_0x18ea3e(_0x4ec386);});});}exports[_0x92b6('0x16')]=function(_0x30677b){var _0x21302d=this;return new Promise(function(_0x4de903,_0x29be1){return db['SquareRecording']['create'](_0x30677b[_0x92b6('0x17')],{'raw':_0x30677b['options']?_0x30677b['options'][_0x92b6('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x51d405){logger['info'](_0x92b6('0x16'),_0x30677b);logger[_0x92b6('0xe')](_0x92b6('0x16'),_0x30677b,JSON[_0x92b6('0x10')](_0x51d405));_0x4de903(_0x51d405);})[_0x92b6('0x15')](function(_0x3a04ec){logger[_0x92b6('0x11')](_0x92b6('0x16'),_0x3a04ec['message'],_0x30677b);_0x29be1(_0x21302d[_0x92b6('0x11')](0x1f4,_0x3a04ec[_0x92b6('0x13')]));});});}; \ No newline at end of file +var _0xb7e0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','then','CreateSquareRecording','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2312e9,_0x4bfc73){var _0x390832=function(_0x4ee284){while(--_0x4ee284){_0x2312e9['push'](_0x2312e9['shift']());}};_0x390832(++_0x4bfc73);}(_0xb7e0,0x119));var _0x0b7e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb7e0[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x0b7e('0x0'));var util=require('util');var moment=require(_0x0b7e('0x1'));var BPromise=require(_0x0b7e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b7e('0x3'));var db=require(_0x0b7e('0x4'))['db'];var utils=require(_0x0b7e('0x5'));var logger=require(_0x0b7e('0x6'))(_0x0b7e('0x7'));var config=require(_0x0b7e('0x8'));var jayson=require(_0x0b7e('0x9'));var client=jayson[_0x0b7e('0xa')][_0x0b7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x590636,_0x46f83b,_0x452db4){return new BPromise(function(_0x5ef3b7,_0x3e4522){return client['request'](_0x590636,_0x452db4)['then'](function(_0x14a4ed){logger[_0x0b7e('0xc')](_0x0b7e('0xd'),_0x46f83b,_0x0b7e('0xe'));logger[_0x0b7e('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x46f83b,_0x0b7e('0xe'),JSON[_0x0b7e('0x10')](_0x14a4ed));if(_0x14a4ed[_0x0b7e('0x11')]){if(_0x14a4ed[_0x0b7e('0x11')][_0x0b7e('0x12')]===0x1f4){logger[_0x0b7e('0x11')]('SquareRecording,\x20%s,\x20%s',_0x46f83b,_0x14a4ed[_0x0b7e('0x11')][_0x0b7e('0x13')]);return _0x3e4522(_0x14a4ed[_0x0b7e('0x11')][_0x0b7e('0x13')]);}logger[_0x0b7e('0x11')]('SquareRecording,\x20%s,\x20%s',_0x46f83b,_0x14a4ed[_0x0b7e('0x11')]['message']);return _0x5ef3b7(_0x14a4ed['error'][_0x0b7e('0x13')]);}else{logger[_0x0b7e('0xc')](_0x0b7e('0xd'),_0x46f83b,_0x0b7e('0xe'));_0x5ef3b7(_0x14a4ed[_0x0b7e('0x14')]['message']);}})[_0x0b7e('0x15')](function(_0x2e67aa){logger[_0x0b7e('0x11')]('SquareRecording,\x20%s,\x20%s',_0x46f83b,_0x2e67aa);_0x3e4522(_0x2e67aa);});});}exports['CreateSquareRecording']=function(_0x1ce17b){var _0x4df331=this;return new Promise(function(_0x2d00f5,_0x2325ff){return db['SquareRecording']['create'](_0x1ce17b['body'],{'raw':_0x1ce17b[_0x0b7e('0x16')]?_0x1ce17b['options'][_0x0b7e('0x17')]===undefined?!![]:![]:!![]})[_0x0b7e('0x18')](function(_0x175d05){logger[_0x0b7e('0xc')]('CreateSquareRecording',_0x1ce17b);logger[_0x0b7e('0xf')]('CreateSquareRecording',_0x1ce17b,JSON['stringify'](_0x175d05));_0x2d00f5(_0x175d05);})[_0x0b7e('0x15')](function(_0x4c63bd){logger['error'](_0x0b7e('0x19'),_0x4c63bd[_0x0b7e('0x13')],_0x1ce17b);_0x2325ff(_0x4df331['error'](0x1f4,_0x4c63bd[_0x0b7e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 667b65e..8a1c2f3 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 _0xca49=['get','index','/describe','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller'];(function(_0x131556,_0x10cd42){var _0x2dd4ce=function(_0xbc9186){while(--_0xbc9186){_0x131556['push'](_0x131556['shift']());}};_0x2dd4ce(++_0x10cd42);}(_0xca49,0x13b));var _0x9ca4=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xca49[_0xd02bb];return _0x1cdf23;};'use strict';var multer=require(_0x9ca4('0x0'));var util=require('util');var path=require(_0x9ca4('0x1'));var timeout=require(_0x9ca4('0x2'));var express=require(_0x9ca4('0x3'));var router=express[_0x9ca4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9ca4('0x5'));var config=require(_0x9ca4('0x6'));var controller=require(_0x9ca4('0x7'));router[_0x9ca4('0x8')]('/',auth['isAuthenticated'](),controller[_0x9ca4('0x9')]);router[_0x9ca4('0x8')](_0x9ca4('0xa'),auth[_0x9ca4('0xb')](),controller[_0x9ca4('0xc')]);router[_0x9ca4('0x8')](_0x9ca4('0xd'),auth[_0x9ca4('0xb')](),controller['show']);router['post']('/',auth[_0x9ca4('0xb')](),controller['create']);router[_0x9ca4('0xe')](_0x9ca4('0xd'),auth[_0x9ca4('0xb')](),controller[_0x9ca4('0xf')]);router[_0x9ca4('0x10')](_0x9ca4('0xd'),auth[_0x9ca4('0xb')](),controller[_0x9ca4('0x11')]);module[_0x9ca4('0x12')]=router; \ No newline at end of file +var _0xfa5e=['index','/describe','/:id','show','post','put','update','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated'];(function(_0x5661e2,_0x3ac219){var _0x4333a7=function(_0x19c591){while(--_0x19c591){_0x5661e2['push'](_0x5661e2['shift']());}};_0x4333a7(++_0x3ac219);}(_0xfa5e,0xcf));var _0xefa5=function(_0x392190,_0x2b917d){_0x392190=_0x392190-0x0;var _0x1b90f0=_0xfa5e[_0x392190];return _0x1b90f0;};'use strict';var multer=require(_0xefa5('0x0'));var util=require(_0xefa5('0x1'));var path=require(_0xefa5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xefa5('0x3'));var interaction=require(_0xefa5('0x4'));var config=require(_0xefa5('0x5'));var controller=require(_0xefa5('0x6'));router[_0xefa5('0x7')]('/',auth[_0xefa5('0x8')](),controller[_0xefa5('0x9')]);router[_0xefa5('0x7')](_0xefa5('0xa'),auth[_0xefa5('0x8')](),controller['describe']);router[_0xefa5('0x7')](_0xefa5('0xb'),auth[_0xefa5('0x8')](),controller[_0xefa5('0xc')]);router[_0xefa5('0xd')]('/',auth[_0xefa5('0x8')](),controller['create']);router[_0xefa5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xefa5('0xf')]);router[_0xefa5('0x10')](_0xefa5('0xb'),auth[_0xefa5('0x8')](),controller['destroy']);module[_0xefa5('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 53cd943..cae019f 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 _0x555c=['sequelize','exports','STRING','DATE'];(function(_0x96fa85,_0x3b8c3d){var _0x5a0967=function(_0xc7e828){while(--_0xc7e828){_0x96fa85['push'](_0x96fa85['shift']());}};_0x5a0967(++_0x3b8c3d);}(_0x555c,0x18c));var _0xc555=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x555c[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0xc555('0x0'));module[_0xc555('0x1')]={'network':{'type':Sequelize[_0xc555('0x2')]},'network_script':{'type':Sequelize[_0xc555('0x2')]},'request':{'type':Sequelize[_0xc555('0x2')]},'channel':{'type':Sequelize[_0xc555('0x2')]},'language':{'type':Sequelize[_0xc555('0x2')]},'type':{'type':Sequelize[_0xc555('0x2')]},'uniqueid':{'type':Sequelize[_0xc555('0x2')]},'version':{'type':Sequelize[_0xc555('0x2')]},'callerid':{'type':Sequelize[_0xc555('0x2')]},'calleridname':{'type':Sequelize[_0xc555('0x2')]},'callingpres':{'type':Sequelize[_0xc555('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xc555('0x2')]},'dnid':{'type':Sequelize[_0xc555('0x2')]},'rdnis':{'type':Sequelize[_0xc555('0x2')]},'context':{'type':Sequelize[_0xc555('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc555('0x2')]},'enhanced':{'type':Sequelize[_0xc555('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xc555('0x2')]},'joinAt':{'type':Sequelize[_0xc555('0x3')]},'leaveAt':{'type':Sequelize[_0xc555('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xcb78=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x32e33a,_0x4f0946){var _0x3cdeeb=function(_0x59555f){while(--_0x59555f){_0x32e33a['push'](_0x32e33a['shift']());}};_0x3cdeeb(++_0x4f0946);}(_0xcb78,0x137));var _0x8cb7=function(_0x6be627,_0x463257){_0x6be627=_0x6be627-0x0;var _0x3d1d4d=_0xcb78[_0x6be627];return _0x3d1d4d;};'use strict';var Sequelize=require(_0x8cb7('0x0'));module[_0x8cb7('0x1')]={'network':{'type':Sequelize[_0x8cb7('0x2')]},'network_script':{'type':Sequelize[_0x8cb7('0x2')]},'request':{'type':Sequelize[_0x8cb7('0x2')]},'channel':{'type':Sequelize[_0x8cb7('0x2')]},'language':{'type':Sequelize[_0x8cb7('0x2')]},'type':{'type':Sequelize[_0x8cb7('0x2')]},'uniqueid':{'type':Sequelize[_0x8cb7('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8cb7('0x2')]},'calleridname':{'type':Sequelize[_0x8cb7('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x8cb7('0x2')]},'callingtns':{'type':Sequelize[_0x8cb7('0x2')]},'dnid':{'type':Sequelize[_0x8cb7('0x2')]},'rdnis':{'type':Sequelize[_0x8cb7('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8cb7('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x8cb7('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x8cb7('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8cb7('0x3')]},'leaveAt':{'type':Sequelize[_0x8cb7('0x3')]},'bot':{'type':Sequelize[_0x8cb7('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 263869a..1f58a45 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 _0x5945=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','SquareReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x517e74,_0x2740fe){var _0x108b45=function(_0xf64eb){while(--_0xf64eb){_0x517e74['push'](_0x517e74['shift']());}};_0x108b45(++_0x2740fe);}(_0x5945,0x16c));var _0x5594=function(_0x4093bb,_0x12d5d8){_0x4093bb=_0x4093bb-0x0;var _0x349327=_0x5945[_0x4093bb];return _0x349327;};'use strict';var pdf=require(_0x5594('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5594('0x1'));var zipdir=require(_0x5594('0x2'));var jsonpatch=require(_0x5594('0x3'));var rp=require('request-promise');var moment=require(_0x5594('0x4'));var BPromise=require(_0x5594('0x5'));var Mustache=require(_0x5594('0x6'));var util=require(_0x5594('0x7'));var path=require(_0x5594('0x8'));var sox=require(_0x5594('0x9'));var csv=require(_0x5594('0xa'));var ejs=require(_0x5594('0xb'));var fs=require('fs');var _=require(_0x5594('0xc'));var squel=require(_0x5594('0xd'));var crypto=require('crypto');var jsforce=require(_0x5594('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5594('0xf'));var Papa=require(_0x5594('0x10'));var Redis=require(_0x5594('0x11'));var authService=require(_0x5594('0x12'));var qs=require(_0x5594('0x13'));var as=require(_0x5594('0x14'));var hardwareService=require(_0x5594('0x15'));var logger=require(_0x5594('0x16'))(_0x5594('0x17'));var utils=require(_0x5594('0x18'));var config=require(_0x5594('0x19'));var db=require(_0x5594('0x1a'))['db'];function respondWithStatusCode(_0x463357,_0x36dc7d){_0x36dc7d=_0x36dc7d||0xcc;return function(_0xeb63e6){if(_0xeb63e6){return _0x463357['sendStatus'](_0x36dc7d);}return _0x463357[_0x5594('0x1b')](_0x36dc7d)[_0x5594('0x1c')]();};}function respondWithResult(_0xec756e,_0x52f4ca){_0x52f4ca=_0x52f4ca||0xc8;return function(_0x2d47c8){if(_0x2d47c8){return _0xec756e[_0x5594('0x1b')](_0x52f4ca)[_0x5594('0x1d')](_0x2d47c8);}};}function respondWithFilteredResult(_0x4a79d4,_0x139232){return function(_0x2972e2){if(_0x2972e2){var _0x21576c=_0x2972e2[_0x5594('0x1e')],_0x4db1a7=_0x139232['offset'],_0x42706e=_0x139232[_0x5594('0x1f')]+_0x139232[_0x5594('0x20')],_0x176384;if(_0x42706e>=_0x21576c){_0x42706e=_0x21576c;_0x176384=0xc8;}else{_0x176384=0xce;}_0x4a79d4['status'](_0x176384);return _0x4a79d4[_0x5594('0x21')](_0x5594('0x22'),_0x4db1a7+'-'+_0x42706e+'/'+_0x21576c)[_0x5594('0x1d')](_0x2972e2);}return null;};}function patchUpdates(_0x524354){return function(_0x3304b8){try{jsonpatch[_0x5594('0x23')](_0x3304b8,_0x524354,!![]);}catch(_0x1e4335){return BPromise[_0x5594('0x24')](_0x1e4335);}return _0x3304b8[_0x5594('0x25')]();};}function saveUpdates(_0x3df36f,_0x1f2362){return function(_0x24baeb){if(_0x24baeb){return _0x24baeb['update'](_0x3df36f)['then'](function(_0x579fad){return _0x579fad;});}return null;};}function removeEntity(_0x3bb330,_0x452abb){return function(_0x4c61f5){if(_0x4c61f5){return _0x4c61f5['destroy']()[_0x5594('0x26')](function(){_0x3bb330[_0x5594('0x1b')](0xcc)[_0x5594('0x1c')]();});}};}function handleEntityNotFound(_0x1e30a4,_0xee1f7){return function(_0x5788eb){if(!_0x5788eb){_0x1e30a4[_0x5594('0x27')](0x194);}return _0x5788eb;};}function handleError(_0x3883cf,_0x2d65e9){_0x2d65e9=_0x2d65e9||0x1f4;return function(_0x1606be){logger[_0x5594('0x28')](_0x1606be['stack']);if(_0x1606be[_0x5594('0x29')]){delete _0x1606be[_0x5594('0x29')];}_0x3883cf[_0x5594('0x1b')](_0x2d65e9)[_0x5594('0x2a')](_0x1606be);};}exports[_0x5594('0x2b')]=function(_0x348979,_0x4647fb){var _0x2cf088={},_0x206dd0={},_0x1e5cd9={'count':0x0,'rows':[]};var _0x2f3cc2=_[_0x5594('0x2c')](db[_0x5594('0x2d')][_0x5594('0x2e')],function(_0x1f49e4){return{'name':_0x1f49e4[_0x5594('0x2f')],'type':_0x1f49e4['type'][_0x5594('0x30')]};});_0x206dd0[_0x5594('0x31')]=_[_0x5594('0x2c')](_0x2f3cc2,'name');_0x206dd0['query']=_[_0x5594('0x32')](_0x348979[_0x5594('0x33')]);_0x206dd0[_0x5594('0x34')]=_[_0x5594('0x35')](_0x206dd0[_0x5594('0x31')],_0x206dd0[_0x5594('0x33')]);_0x2cf088['attributes']=_[_0x5594('0x35')](_0x206dd0[_0x5594('0x31')],qs[_0x5594('0x36')](_0x348979['query'][_0x5594('0x36')]));_0x2cf088[_0x5594('0x37')]=_0x2cf088[_0x5594('0x37')][_0x5594('0x38')]?_0x2cf088[_0x5594('0x37')]:_0x206dd0[_0x5594('0x31')];if(!_0x348979[_0x5594('0x33')]['hasOwnProperty'](_0x5594('0x39'))){_0x2cf088[_0x5594('0x20')]=qs[_0x5594('0x20')](_0x348979[_0x5594('0x33')][_0x5594('0x20')]);_0x2cf088[_0x5594('0x1f')]=qs[_0x5594('0x1f')](_0x348979[_0x5594('0x33')][_0x5594('0x1f')]);}_0x2cf088['order']=qs[_0x5594('0x3a')](_0x348979[_0x5594('0x33')][_0x5594('0x3a')]);_0x2cf088[_0x5594('0x3b')]=qs['filters'](_['pick'](_0x348979[_0x5594('0x33')],_0x206dd0[_0x5594('0x34')]),_0x2f3cc2);if(_0x348979[_0x5594('0x33')][_0x5594('0x3c')]){_0x2cf088[_0x5594('0x3b')]=_['merge'](_0x2cf088[_0x5594('0x3b')],{'$or':_['map'](_0x2f3cc2,function(_0x46e5e2){if(_0x46e5e2[_0x5594('0x3d')]!==_0x5594('0x3e')){var _0x5d1973={};_0x5d1973[_0x46e5e2[_0x5594('0x29')]]={'$like':'%'+_0x348979[_0x5594('0x33')][_0x5594('0x3c')]+'%'};return _0x5d1973;}})});}_0x2cf088=_[_0x5594('0x3f')]({},_0x2cf088,_0x348979['options']);var _0x1f0323={'where':_0x2cf088['where']};return db['SquareReport'][_0x5594('0x1e')](_0x1f0323)[_0x5594('0x26')](function(_0x2ca82d){_0x1e5cd9[_0x5594('0x1e')]=_0x2ca82d;if(_0x348979[_0x5594('0x33')][_0x5594('0x40')]){_0x2cf088[_0x5594('0x41')]=[{'all':!![]}];}return db[_0x5594('0x2d')][_0x5594('0x42')](_0x2cf088);})[_0x5594('0x26')](function(_0x4d12c7){_0x1e5cd9[_0x5594('0x43')]=_0x4d12c7;return _0x1e5cd9;})[_0x5594('0x26')](respondWithFilteredResult(_0x4647fb,_0x2cf088))[_0x5594('0x44')](handleError(_0x4647fb,null));};exports[_0x5594('0x45')]=function(_0x373169,_0x4a2939){var _0x4a1eb9={'raw':!![],'where':{'id':_0x373169[_0x5594('0x46')]['id']}},_0x2b7bdb={};_0x2b7bdb[_0x5594('0x31')]=_[_0x5594('0x32')](db[_0x5594('0x2d')][_0x5594('0x2e')]);_0x2b7bdb[_0x5594('0x33')]=_[_0x5594('0x32')](_0x373169[_0x5594('0x33')]);_0x2b7bdb[_0x5594('0x34')]=_[_0x5594('0x35')](_0x2b7bdb[_0x5594('0x31')],_0x2b7bdb[_0x5594('0x33')]);_0x4a1eb9[_0x5594('0x37')]=_[_0x5594('0x35')](_0x2b7bdb[_0x5594('0x31')],qs[_0x5594('0x36')](_0x373169['query'][_0x5594('0x36')]));_0x4a1eb9[_0x5594('0x37')]=_0x4a1eb9['attributes'][_0x5594('0x38')]?_0x4a1eb9[_0x5594('0x37')]:_0x2b7bdb[_0x5594('0x31')];if(_0x373169[_0x5594('0x33')]['includeAll']){_0x4a1eb9[_0x5594('0x41')]=[{'all':!![]}];}_0x4a1eb9=_['merge']({},_0x4a1eb9,_0x373169['options']);return db['SquareReport'][_0x5594('0x47')](_0x4a1eb9)['then'](handleEntityNotFound(_0x4a2939,null))[_0x5594('0x26')](respondWithResult(_0x4a2939,null))[_0x5594('0x44')](handleError(_0x4a2939,null));};exports[_0x5594('0x48')]=function(_0x137546,_0x2ea73a){return db[_0x5594('0x2d')][_0x5594('0x48')](_0x137546[_0x5594('0x49')],{})[_0x5594('0x26')](respondWithResult(_0x2ea73a,0xc9))[_0x5594('0x44')](handleError(_0x2ea73a,null));};exports[_0x5594('0x4a')]=function(_0x50ef2d,_0x564a4c){if(_0x50ef2d[_0x5594('0x49')]['id']){delete _0x50ef2d[_0x5594('0x49')]['id'];}return db[_0x5594('0x2d')][_0x5594('0x47')]({'where':{'id':_0x50ef2d[_0x5594('0x46')]['id']}})[_0x5594('0x26')](handleEntityNotFound(_0x564a4c,null))[_0x5594('0x26')](saveUpdates(_0x50ef2d[_0x5594('0x49')],null))['then'](respondWithResult(_0x564a4c,null))[_0x5594('0x44')](handleError(_0x564a4c,null));};exports[_0x5594('0x4b')]=function(_0x5c15fe,_0x38f562){return db[_0x5594('0x2d')]['find']({'where':{'id':_0x5c15fe[_0x5594('0x46')]['id']}})[_0x5594('0x26')](handleEntityNotFound(_0x38f562,null))[_0x5594('0x26')](removeEntity(_0x38f562,null))[_0x5594('0x44')](handleError(_0x38f562,null));};exports[_0x5594('0x4c')]=function(_0x4548e9,_0x44ad55){return db['SquareReport'][_0x5594('0x4c')]()[_0x5594('0x26')](respondWithResult(_0x44ad55,null))[_0x5594('0x44')](handleError(_0x44ad55,null));}; \ No newline at end of file +var _0x9e91=['length','nolimit','order','sort','pick','filter','where','merge','map','options','includeAll','include','SquareReport','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','error','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x9e91,0x197));var _0x19e9=function(_0x20cfb6,_0x16d69e){_0x20cfb6=_0x20cfb6-0x0;var _0x2ea53a=_0x9e91[_0x20cfb6];return _0x2ea53a;};'use strict';var pdf=require(_0x19e9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x19e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19e9('0x2'));var rp=require(_0x19e9('0x3'));var moment=require(_0x19e9('0x4'));var BPromise=require(_0x19e9('0x5'));var Mustache=require(_0x19e9('0x6'));var util=require(_0x19e9('0x7'));var path=require(_0x19e9('0x8'));var sox=require(_0x19e9('0x9'));var csv=require(_0x19e9('0xa'));var ejs=require(_0x19e9('0xb'));var fs=require('fs');var _=require(_0x19e9('0xc'));var squel=require(_0x19e9('0xd'));var crypto=require(_0x19e9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x19e9('0xf'));var toCsv=require(_0x19e9('0xa'));var querystring=require(_0x19e9('0x10'));var Papa=require(_0x19e9('0x11'));var Redis=require(_0x19e9('0x12'));var authService=require(_0x19e9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x19e9('0x14'));var hardwareService=require(_0x19e9('0x15'));var logger=require(_0x19e9('0x16'))(_0x19e9('0x17'));var utils=require(_0x19e9('0x18'));var config=require(_0x19e9('0x19'));var db=require(_0x19e9('0x1a'))['db'];function respondWithStatusCode(_0x2e22e7,_0x3d7fe4){_0x3d7fe4=_0x3d7fe4||0xcc;return function(_0x168177){if(_0x168177){return _0x2e22e7[_0x19e9('0x1b')](_0x3d7fe4);}return _0x2e22e7[_0x19e9('0x1c')](_0x3d7fe4)['end']();};}function respondWithResult(_0x4b74cd,_0x2d0351){_0x2d0351=_0x2d0351||0xc8;return function(_0x42637f){if(_0x42637f){return _0x4b74cd[_0x19e9('0x1c')](_0x2d0351)[_0x19e9('0x1d')](_0x42637f);}};}function respondWithFilteredResult(_0x20a069,_0x1bd276){return function(_0x45ce7d){if(_0x45ce7d){var _0x5105a3=_0x45ce7d[_0x19e9('0x1e')],_0x547046=_0x1bd276[_0x19e9('0x1f')],_0x598899=_0x1bd276[_0x19e9('0x1f')]+_0x1bd276[_0x19e9('0x20')],_0x193b9c;if(_0x598899>=_0x5105a3){_0x598899=_0x5105a3;_0x193b9c=0xc8;}else{_0x193b9c=0xce;}_0x20a069[_0x19e9('0x1c')](_0x193b9c);return _0x20a069[_0x19e9('0x21')]('Content-Range',_0x547046+'-'+_0x598899+'/'+_0x5105a3)[_0x19e9('0x1d')](_0x45ce7d);}return null;};}function patchUpdates(_0x3e9361){return function(_0x778973){try{jsonpatch[_0x19e9('0x22')](_0x778973,_0x3e9361,!![]);}catch(_0x7c785f){return BPromise[_0x19e9('0x23')](_0x7c785f);}return _0x778973['save']();};}function saveUpdates(_0x15b3c5,_0x1420c7){return function(_0x277bb1){if(_0x277bb1){return _0x277bb1[_0x19e9('0x24')](_0x15b3c5)[_0x19e9('0x25')](function(_0x4a5034){return _0x4a5034;});}return null;};}function removeEntity(_0x361d11,_0x5e050e){return function(_0x123303){if(_0x123303){return _0x123303[_0x19e9('0x26')]()[_0x19e9('0x25')](function(){_0x361d11['status'](0xcc)[_0x19e9('0x27')]();});}};}function handleEntityNotFound(_0x19ae4e,_0x27cdac){return function(_0x57125a){if(!_0x57125a){_0x19ae4e['sendStatus'](0x194);}return _0x57125a;};}function handleError(_0x424275,_0x13aaf6){_0x13aaf6=_0x13aaf6||0x1f4;return function(_0xce7ddd){logger[_0x19e9('0x28')](_0xce7ddd['stack']);if(_0xce7ddd[_0x19e9('0x29')]){delete _0xce7ddd[_0x19e9('0x29')];}_0x424275[_0x19e9('0x1c')](_0x13aaf6)[_0x19e9('0x2a')](_0xce7ddd);};}exports[_0x19e9('0x2b')]=function(_0x236b0d,_0xff3cf8){var _0x4237d2={},_0x29bed3={},_0x4d2a23={'count':0x0,'rows':[]};var _0x17b01a=_['map'](db['SquareReport'][_0x19e9('0x2c')],function(_0x3f4e58){return{'name':_0x3f4e58[_0x19e9('0x2d')],'type':_0x3f4e58[_0x19e9('0x2e')][_0x19e9('0x2f')]};});_0x29bed3[_0x19e9('0x30')]=_['map'](_0x17b01a,_0x19e9('0x29'));_0x29bed3[_0x19e9('0x31')]=_[_0x19e9('0x32')](_0x236b0d[_0x19e9('0x31')]);_0x29bed3[_0x19e9('0x33')]=_[_0x19e9('0x34')](_0x29bed3['model'],_0x29bed3[_0x19e9('0x31')]);_0x4237d2[_0x19e9('0x35')]=_[_0x19e9('0x34')](_0x29bed3[_0x19e9('0x30')],qs[_0x19e9('0x36')](_0x236b0d[_0x19e9('0x31')][_0x19e9('0x36')]));_0x4237d2[_0x19e9('0x35')]=_0x4237d2['attributes'][_0x19e9('0x37')]?_0x4237d2['attributes']:_0x29bed3[_0x19e9('0x30')];if(!_0x236b0d[_0x19e9('0x31')]['hasOwnProperty'](_0x19e9('0x38'))){_0x4237d2[_0x19e9('0x20')]=qs[_0x19e9('0x20')](_0x236b0d['query'][_0x19e9('0x20')]);_0x4237d2[_0x19e9('0x1f')]=qs[_0x19e9('0x1f')](_0x236b0d['query'][_0x19e9('0x1f')]);}_0x4237d2[_0x19e9('0x39')]=qs[_0x19e9('0x3a')](_0x236b0d[_0x19e9('0x31')][_0x19e9('0x3a')]);_0x4237d2['where']=qs[_0x19e9('0x33')](_[_0x19e9('0x3b')](_0x236b0d[_0x19e9('0x31')],_0x29bed3['filters']),_0x17b01a);if(_0x236b0d[_0x19e9('0x31')][_0x19e9('0x3c')]){_0x4237d2[_0x19e9('0x3d')]=_[_0x19e9('0x3e')](_0x4237d2['where'],{'$or':_[_0x19e9('0x3f')](_0x17b01a,function(_0x3fbc42){if(_0x3fbc42[_0x19e9('0x2e')]!=='VIRTUAL'){var _0x2edfc7={};_0x2edfc7[_0x3fbc42[_0x19e9('0x29')]]={'$like':'%'+_0x236b0d[_0x19e9('0x31')][_0x19e9('0x3c')]+'%'};return _0x2edfc7;}})});}_0x4237d2=_[_0x19e9('0x3e')]({},_0x4237d2,_0x236b0d[_0x19e9('0x40')]);var _0x49ae83={'where':_0x4237d2['where']};return db['SquareReport'][_0x19e9('0x1e')](_0x49ae83)[_0x19e9('0x25')](function(_0xf23bf3){_0x4d2a23['count']=_0xf23bf3;if(_0x236b0d[_0x19e9('0x31')][_0x19e9('0x41')]){_0x4237d2[_0x19e9('0x42')]=[{'all':!![]}];}return db[_0x19e9('0x43')][_0x19e9('0x44')](_0x4237d2);})[_0x19e9('0x25')](function(_0xe344ba){_0x4d2a23[_0x19e9('0x45')]=_0xe344ba;return _0x4d2a23;})[_0x19e9('0x25')](respondWithFilteredResult(_0xff3cf8,_0x4237d2))[_0x19e9('0x46')](handleError(_0xff3cf8,null));};exports[_0x19e9('0x47')]=function(_0x4e4e04,_0x5d5cc0){var _0xeb29c0={'raw':!![],'where':{'id':_0x4e4e04[_0x19e9('0x48')]['id']}},_0x34bbce={};_0x34bbce['model']=_[_0x19e9('0x32')](db[_0x19e9('0x43')][_0x19e9('0x2c')]);_0x34bbce[_0x19e9('0x31')]=_[_0x19e9('0x32')](_0x4e4e04['query']);_0x34bbce['filters']=_['intersection'](_0x34bbce[_0x19e9('0x30')],_0x34bbce[_0x19e9('0x31')]);_0xeb29c0[_0x19e9('0x35')]=_[_0x19e9('0x34')](_0x34bbce[_0x19e9('0x30')],qs[_0x19e9('0x36')](_0x4e4e04[_0x19e9('0x31')]['fields']));_0xeb29c0[_0x19e9('0x35')]=_0xeb29c0[_0x19e9('0x35')]['length']?_0xeb29c0['attributes']:_0x34bbce[_0x19e9('0x30')];if(_0x4e4e04['query'][_0x19e9('0x41')]){_0xeb29c0[_0x19e9('0x42')]=[{'all':!![]}];}_0xeb29c0=_[_0x19e9('0x3e')]({},_0xeb29c0,_0x4e4e04[_0x19e9('0x40')]);return db[_0x19e9('0x43')][_0x19e9('0x49')](_0xeb29c0)['then'](handleEntityNotFound(_0x5d5cc0,null))[_0x19e9('0x25')](respondWithResult(_0x5d5cc0,null))[_0x19e9('0x46')](handleError(_0x5d5cc0,null));};exports['create']=function(_0x6d4a2c,_0x5a4884){return db[_0x19e9('0x43')][_0x19e9('0x4a')](_0x6d4a2c[_0x19e9('0x4b')],{})['then'](respondWithResult(_0x5a4884,0xc9))['catch'](handleError(_0x5a4884,null));};exports['update']=function(_0x1c098c,_0x55b651){if(_0x1c098c[_0x19e9('0x4b')]['id']){delete _0x1c098c[_0x19e9('0x4b')]['id'];}return db['SquareReport'][_0x19e9('0x49')]({'where':{'id':_0x1c098c[_0x19e9('0x48')]['id']}})[_0x19e9('0x25')](handleEntityNotFound(_0x55b651,null))[_0x19e9('0x25')](saveUpdates(_0x1c098c[_0x19e9('0x4b')],null))[_0x19e9('0x25')](respondWithResult(_0x55b651,null))[_0x19e9('0x46')](handleError(_0x55b651,null));};exports[_0x19e9('0x26')]=function(_0x39953d,_0x3ac70d){return db['SquareReport'][_0x19e9('0x49')]({'where':{'id':_0x39953d['params']['id']}})['then'](handleEntityNotFound(_0x3ac70d,null))[_0x19e9('0x25')](removeEntity(_0x3ac70d,null))[_0x19e9('0x46')](handleError(_0x3ac70d,null));};exports[_0x19e9('0x4c')]=function(_0x5670a4,_0x4fd75b){return db[_0x19e9('0x43')]['describe']()[_0x19e9('0x25')](respondWithResult(_0x4fd75b,null))[_0x19e9('0x46')](handleError(_0x4fd75b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c9b0a4f..b8b1f93 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 _0x187e=['../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x187e,0x94));var _0xe187=function(_0x24cc52,_0x2527a6){_0x24cc52=_0x24cc52-0x0;var _0x5a8039=_0x187e[_0x24cc52];return _0x5a8039;};'use strict';var _=require(_0xe187('0x0'));var util=require(_0xe187('0x1'));var logger=require(_0xe187('0x2'))(_0xe187('0x3'));var moment=require('moment');var BPromise=require(_0xe187('0x4'));var rp=require(_0xe187('0x5'));var fs=require('fs');var path=require(_0xe187('0x6'));var rimraf=require(_0xe187('0x7'));var config=require('../../config/environment');var attributes=require(_0xe187('0x8'));module[_0xe187('0x9')]=function(_0x82bcc7,_0x10a459){return _0x82bcc7['define'](_0xe187('0xa'),attributes,{'tableName':_0xe187('0xb'),'paranoid':![],'indexes':[{'name':_0xe187('0xc'),'fields':['uniqueid',_0xe187('0xd')]},{'name':_0xe187('0xe'),'fields':[_0xe187('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26c0=['leaveAt','util','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','report_square','uid_pname','project_name'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x26c0,0x105));var _0x026c=function(_0x46dfbe,_0x2d44ad){_0x46dfbe=_0x46dfbe-0x0;var _0x488a4e=_0x26c0[_0x46dfbe];return _0x488a4e;};'use strict';var _=require('lodash');var util=require(_0x026c('0x0'));var logger=require('../../config/logger')(_0x026c('0x1'));var moment=require(_0x026c('0x2'));var BPromise=require(_0x026c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x026c('0x4'));var rimraf=require(_0x026c('0x5'));var config=require(_0x026c('0x6'));var attributes=require(_0x026c('0x7'));module[_0x026c('0x8')]=function(_0x2470bd,_0x5ed9e3){return _0x2470bd['define']('SquareReport',attributes,{'tableName':_0x026c('0x9'),'paranoid':![],'indexes':[{'name':_0x026c('0xa'),'fields':['uniqueid',_0x026c('0xb')]},{'name':_0x026c('0xc'),'fields':[_0x026c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 0cc8aea..ac432d8 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 _0xca38=['limit','then','UpdateSquareReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','options','raw','attributes'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0xca38,0x1a7));var _0x8ca3=function(_0x3d7de8,_0x2a2ec4){_0x3d7de8=_0x3d7de8-0x0;var _0x5e9a0c=_0xca38[_0x3d7de8];return _0x5e9a0c;};'use strict';var _=require(_0x8ca3('0x0'));var util=require('util');var moment=require(_0x8ca3('0x1'));var BPromise=require(_0x8ca3('0x2'));var rs=require(_0x8ca3('0x3'));var fs=require('fs');var Redis=require(_0x8ca3('0x4'));var db=require(_0x8ca3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ca3('0x6'));var config=require('../../config/environment');var jayson=require(_0x8ca3('0x7'));var client=jayson[_0x8ca3('0x8')][_0x8ca3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33e6fb,_0x59ede2,_0x1dccf8){return new BPromise(function(_0x2cd9af,_0x1ee4ac){return client[_0x8ca3('0xa')](_0x33e6fb,_0x1dccf8)['then'](function(_0x5671ef){logger[_0x8ca3('0xb')]('SquareReport,\x20%s,\x20%s',_0x59ede2,_0x8ca3('0xc'));logger[_0x8ca3('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x59ede2,'request\x20sent',JSON[_0x8ca3('0xe')](_0x5671ef));if(_0x5671ef['error']){if(_0x5671ef[_0x8ca3('0xf')][_0x8ca3('0x10')]===0x1f4){logger[_0x8ca3('0xf')](_0x8ca3('0x11'),_0x59ede2,_0x5671ef[_0x8ca3('0xf')][_0x8ca3('0x12')]);return _0x1ee4ac(_0x5671ef[_0x8ca3('0xf')][_0x8ca3('0x12')]);}logger['error'](_0x8ca3('0x11'),_0x59ede2,_0x5671ef[_0x8ca3('0xf')][_0x8ca3('0x12')]);return _0x2cd9af(_0x5671ef['error'][_0x8ca3('0x12')]);}else{logger[_0x8ca3('0xb')](_0x8ca3('0x11'),_0x59ede2,_0x8ca3('0xc'));_0x2cd9af(_0x5671ef[_0x8ca3('0x13')]['message']);}})[_0x8ca3('0x14')](function(_0x512f67){logger['error'](_0x8ca3('0x11'),_0x59ede2,_0x512f67);_0x1ee4ac(_0x512f67);});});}exports[_0x8ca3('0x15')]=function(_0x1fdfef){var _0x17a5e6=this;return new Promise(function(_0x49b99a,_0x34e53f){return db['SquareReport'][_0x8ca3('0x16')](_0x1fdfef[_0x8ca3('0x17')],{'raw':_0x1fdfef[_0x8ca3('0x18')]?_0x1fdfef[_0x8ca3('0x18')][_0x8ca3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2a6bfa){logger[_0x8ca3('0xb')](_0x8ca3('0x15'),_0x1fdfef);logger[_0x8ca3('0xd')](_0x8ca3('0x15'),_0x1fdfef,JSON['stringify'](_0x2a6bfa));_0x49b99a(_0x2a6bfa);})[_0x8ca3('0x14')](function(_0x16140f){logger[_0x8ca3('0xf')](_0x8ca3('0x15'),_0x16140f[_0x8ca3('0x12')],_0x1fdfef);_0x34e53f(_0x17a5e6[_0x8ca3('0xf')](0x1f4,_0x16140f[_0x8ca3('0x12')]));});});};exports['UpdateSquareReport']=function(_0x3a5748){var _0xcb8b11=this;return new Promise(function(_0x96a2e8,_0x42b6d0){return db['SquareReport']['update'](_0x3a5748[_0x8ca3('0x17')],{'raw':_0x3a5748[_0x8ca3('0x18')]?_0x3a5748[_0x8ca3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5748['options']?_0x3a5748[_0x8ca3('0x18')]['where']||null:null,'attributes':_0x3a5748[_0x8ca3('0x18')]?_0x3a5748[_0x8ca3('0x18')][_0x8ca3('0x1a')]||null:null,'limit':_0x3a5748['options']?_0x3a5748[_0x8ca3('0x18')][_0x8ca3('0x1b')]||null:null})[_0x8ca3('0x1c')](function(_0x105115){logger[_0x8ca3('0xb')](_0x8ca3('0x1d'),_0x3a5748);logger['debug'](_0x8ca3('0x1d'),_0x3a5748,JSON[_0x8ca3('0xe')](_0x105115));_0x96a2e8(_0x105115);})[_0x8ca3('0x14')](function(_0x5bee97){logger['error'](_0x8ca3('0x1d'),_0x5bee97[_0x8ca3('0x12')],_0x3a5748);_0x42b6d0(_0xcb8b11[_0x8ca3('0xf')](0x1f4,_0x5bee97[_0x8ca3('0x12')]));});});}; \ No newline at end of file +var _0x2320=['CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x2dd19a,_0x211dd8){var _0x3c853d=function(_0x5f04a0){while(--_0x5f04a0){_0x2dd19a['push'](_0x2dd19a['shift']());}};_0x3c853d(++_0x211dd8);}(_0x2320,0xf2));var _0x0232=function(_0x2102e6,_0x500300){_0x2102e6=_0x2102e6-0x0;var _0x9dc46e=_0x2320[_0x2102e6];return _0x9dc46e;};'use strict';var _=require('lodash');var util=require(_0x0232('0x0'));var moment=require(_0x0232('0x1'));var BPromise=require(_0x0232('0x2'));var rs=require(_0x0232('0x3'));var fs=require('fs');var Redis=require(_0x0232('0x4'));var db=require(_0x0232('0x5'))['db'];var utils=require(_0x0232('0x6'));var logger=require(_0x0232('0x7'))(_0x0232('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0232('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eea8b,_0x5b64ca,_0x1384f1){return new BPromise(function(_0x40866b,_0x1d0d7c){return client['request'](_0x4eea8b,_0x1384f1)[_0x0232('0xa')](function(_0x1e4a12){logger['info']('SquareReport,\x20%s,\x20%s',_0x5b64ca,_0x0232('0xb'));logger[_0x0232('0xc')](_0x0232('0xd'),_0x5b64ca,_0x0232('0xb'),JSON[_0x0232('0xe')](_0x1e4a12));if(_0x1e4a12[_0x0232('0xf')]){if(_0x1e4a12[_0x0232('0xf')][_0x0232('0x10')]===0x1f4){logger[_0x0232('0xf')](_0x0232('0x11'),_0x5b64ca,_0x1e4a12[_0x0232('0xf')][_0x0232('0x12')]);return _0x1d0d7c(_0x1e4a12['error'][_0x0232('0x12')]);}logger[_0x0232('0xf')](_0x0232('0x11'),_0x5b64ca,_0x1e4a12[_0x0232('0xf')]['message']);return _0x40866b(_0x1e4a12[_0x0232('0xf')][_0x0232('0x12')]);}else{logger[_0x0232('0x13')](_0x0232('0x11'),_0x5b64ca,'request\x20sent');_0x40866b(_0x1e4a12[_0x0232('0x14')][_0x0232('0x12')]);}})[_0x0232('0x15')](function(_0x49ff9b){logger[_0x0232('0xf')]('SquareReport,\x20%s,\x20%s',_0x5b64ca,_0x49ff9b);_0x1d0d7c(_0x49ff9b);});});}exports[_0x0232('0x16')]=function(_0x3410d8){var _0x1c6be2=this;return new Promise(function(_0x36a02b,_0x59bc12){return db['SquareReport'][_0x0232('0x17')](_0x3410d8[_0x0232('0x18')],{'raw':_0x3410d8[_0x0232('0x19')]?_0x3410d8[_0x0232('0x19')][_0x0232('0x1a')]===undefined?!![]:![]:!![]})[_0x0232('0xa')](function(_0x2bc20b){logger['info'](_0x0232('0x16'),_0x3410d8);logger[_0x0232('0xc')](_0x0232('0x16'),_0x3410d8,JSON[_0x0232('0xe')](_0x2bc20b));_0x36a02b(_0x2bc20b);})[_0x0232('0x15')](function(_0x1dcc5d){logger['error']('CreateSquareReport',_0x1dcc5d[_0x0232('0x12')],_0x3410d8);_0x59bc12(_0x1c6be2['error'](0x1f4,_0x1dcc5d[_0x0232('0x12')]));});});};exports[_0x0232('0x1b')]=function(_0x3739af){var _0x18635f=this;return new Promise(function(_0x2d7c9e,_0x1301a8){return db[_0x0232('0x1c')][_0x0232('0x1d')](_0x3739af[_0x0232('0x18')],{'raw':_0x3739af['options']?_0x3739af[_0x0232('0x19')][_0x0232('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3739af[_0x0232('0x19')]?_0x3739af[_0x0232('0x19')][_0x0232('0x1e')]||null:null,'attributes':_0x3739af['options']?_0x3739af[_0x0232('0x19')][_0x0232('0x1f')]||null:null,'limit':_0x3739af[_0x0232('0x19')]?_0x3739af[_0x0232('0x19')][_0x0232('0x20')]||null:null})[_0x0232('0xa')](function(_0x51d5f2){logger[_0x0232('0x13')]('UpdateSquareReport',_0x3739af);logger[_0x0232('0xc')]('UpdateSquareReport',_0x3739af,JSON[_0x0232('0xe')](_0x51d5f2));_0x2d7c9e(_0x51d5f2);})[_0x0232('0x15')](function(_0xc1c2aa){logger[_0x0232('0xf')](_0x0232('0x1b'),_0xc1c2aa[_0x0232('0x12')],_0x3739af);_0x1301a8(_0x18635f[_0x0232('0xf')](0x1f4,_0xc1c2aa[_0x0232('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f835be6..70e253c 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x444afa,_0x55e9fe){var _0x3fe253=function(_0x137aee){while(--_0x137aee){_0x444afa['push'](_0x444afa['shift']());}};_0x3fe253(++_0x55e9fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32dd50,_0x5cde6b){_0x32dd50=_0x32dd50-0x0;var _0x52d87f=_0x5f2f[_0x32dd50];return _0x52d87f;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x391779,_0x1fbd79){var _0x104f1e=function(_0x220fd7){while(--_0x220fd7){_0x391779['push'](_0x391779['shift']());}};_0x104f1e(++_0x1fbd79);}(_0x5f2f,0x73));var _0xf5f2=function(_0x71e9e4,_0x2b8f91){_0x71e9e4=_0x71e9e4-0x0;var _0x44f29d=_0x5f2f[_0x71e9e4];return _0x44f29d;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 783d24d..bb76717 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 _0x6b67=['STRING','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6b67,0x115));var _0x76b6=function(_0x38894d,_0x1883d8){_0x38894d=_0x38894d-0x0;var _0x5614fe=_0x6b67[_0x38894d];return _0x5614fe;};'use strict';var Sequelize=require('sequelize');module[_0x76b6('0x0')]={'uniqueid':{'type':Sequelize[_0x76b6('0x1')]},'node':{'type':Sequelize[_0x76b6('0x1')]},'application':{'type':Sequelize[_0x76b6('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x76b6('0x1')]}}; \ No newline at end of file +var _0x6795=['STRING','TEXT','sequelize','exports'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x6795,0x106));var _0x5679=function(_0x1a8dc7,_0x2835f1){_0x1a8dc7=_0x1a8dc7-0x0;var _0x306cf0=_0x6795[_0x1a8dc7];return _0x306cf0;};'use strict';var Sequelize=require(_0x5679('0x0'));module[_0x5679('0x1')]={'uniqueid':{'type':Sequelize[_0x5679('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x5679('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5679('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 2299999..06704bb 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 _0xa019=['merge','SquareDetailsReport','count','includeAll','include','findAll','rows','catch','params','length','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter'];(function(_0x2e6704,_0x2c5a44){var _0x1815da=function(_0x22bf61){while(--_0x22bf61){_0x2e6704['push'](_0x2e6704['shift']());}};_0x1815da(++_0x2c5a44);}(_0xa019,0x9d));var _0x9a01=function(_0x5aa8ac,_0x37f6e8){_0x5aa8ac=_0x5aa8ac-0x0;var _0x4b382d=_0xa019[_0x5aa8ac];return _0x4b382d;};'use strict';var pdf=require(_0x9a01('0x0'));var emlformat=require(_0x9a01('0x1'));var rimraf=require(_0x9a01('0x2'));var zipdir=require(_0x9a01('0x3'));var jsonpatch=require(_0x9a01('0x4'));var rp=require('request-promise');var moment=require(_0x9a01('0x5'));var BPromise=require(_0x9a01('0x6'));var Mustache=require(_0x9a01('0x7'));var util=require('util');var path=require(_0x9a01('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a01('0x9'));var fs=require('fs');var _=require(_0x9a01('0xa'));var squel=require(_0x9a01('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a01('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9a01('0xd'));var Papa=require(_0x9a01('0xe'));var Redis=require('ioredis');var authService=require(_0x9a01('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9a01('0x10'));var hardwareService=require(_0x9a01('0x11'));var logger=require(_0x9a01('0x12'))(_0x9a01('0x13'));var utils=require(_0x9a01('0x14'));var config=require('../../config/environment');var db=require(_0x9a01('0x15'))['db'];function respondWithStatusCode(_0x41b901,_0x337060){_0x337060=_0x337060||0xcc;return function(_0x2ce89c){if(_0x2ce89c){return _0x41b901[_0x9a01('0x16')](_0x337060);}return _0x41b901[_0x9a01('0x17')](_0x337060)[_0x9a01('0x18')]();};}function respondWithResult(_0x54b8c1,_0x39a7eb){_0x39a7eb=_0x39a7eb||0xc8;return function(_0x5419d8){if(_0x5419d8){return _0x54b8c1['status'](_0x39a7eb)[_0x9a01('0x19')](_0x5419d8);}};}function respondWithFilteredResult(_0x23ad7d,_0x13f5a7){return function(_0x5bd4e5){if(_0x5bd4e5){var _0x4cff5e=_0x5bd4e5['count'],_0x518913=_0x13f5a7[_0x9a01('0x1a')],_0x22660f=_0x13f5a7[_0x9a01('0x1a')]+_0x13f5a7[_0x9a01('0x1b')],_0x390c9f;if(_0x22660f>=_0x4cff5e){_0x22660f=_0x4cff5e;_0x390c9f=0xc8;}else{_0x390c9f=0xce;}_0x23ad7d[_0x9a01('0x17')](_0x390c9f);return _0x23ad7d[_0x9a01('0x1c')](_0x9a01('0x1d'),_0x518913+'-'+_0x22660f+'/'+_0x4cff5e)[_0x9a01('0x19')](_0x5bd4e5);}return null;};}function patchUpdates(_0x31a4b6){return function(_0x531550){try{jsonpatch[_0x9a01('0x1e')](_0x531550,_0x31a4b6,!![]);}catch(_0x3d729b){return BPromise[_0x9a01('0x1f')](_0x3d729b);}return _0x531550[_0x9a01('0x20')]();};}function saveUpdates(_0x1659f9,_0xb62fe4){return function(_0x418c53){if(_0x418c53){return _0x418c53[_0x9a01('0x21')](_0x1659f9)[_0x9a01('0x22')](function(_0x40fcc1){return _0x40fcc1;});}return null;};}function removeEntity(_0x1ae92e,_0x51a55b){return function(_0xeb7eea){if(_0xeb7eea){return _0xeb7eea[_0x9a01('0x23')]()[_0x9a01('0x22')](function(){_0x1ae92e[_0x9a01('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a772,_0x3681a2){return function(_0x506cca){if(!_0x506cca){_0x51a772[_0x9a01('0x16')](0x194);}return _0x506cca;};}function handleError(_0x1e4e43,_0x1423d9){_0x1423d9=_0x1423d9||0x1f4;return function(_0x4a251c){logger[_0x9a01('0x24')](_0x4a251c[_0x9a01('0x25')]);if(_0x4a251c[_0x9a01('0x26')]){delete _0x4a251c['name'];}_0x1e4e43[_0x9a01('0x17')](_0x1423d9)['send'](_0x4a251c);};}exports[_0x9a01('0x27')]=function(_0xb0ee71,_0x4e9450){var _0x46968a={},_0x38d547={},_0x1c8cfb={'count':0x0,'rows':[]};var _0x528e9e=_[_0x9a01('0x28')](db['SquareDetailsReport'][_0x9a01('0x29')],function(_0x1fa2a3){return{'name':_0x1fa2a3['fieldName'],'type':_0x1fa2a3[_0x9a01('0x2a')]['key']};});_0x38d547['model']=_[_0x9a01('0x28')](_0x528e9e,'name');_0x38d547['query']=_[_0x9a01('0x2b')](_0xb0ee71[_0x9a01('0x2c')]);_0x38d547[_0x9a01('0x2d')]=_[_0x9a01('0x2e')](_0x38d547[_0x9a01('0x2f')],_0x38d547[_0x9a01('0x2c')]);_0x46968a[_0x9a01('0x30')]=_[_0x9a01('0x2e')](_0x38d547['model'],qs['fields'](_0xb0ee71[_0x9a01('0x2c')][_0x9a01('0x31')]));_0x46968a[_0x9a01('0x30')]=_0x46968a[_0x9a01('0x30')]['length']?_0x46968a['attributes']:_0x38d547[_0x9a01('0x2f')];if(!_0xb0ee71[_0x9a01('0x2c')]['hasOwnProperty'](_0x9a01('0x32'))){_0x46968a['limit']=qs['limit'](_0xb0ee71[_0x9a01('0x2c')]['limit']);_0x46968a[_0x9a01('0x1a')]=qs['offset'](_0xb0ee71[_0x9a01('0x2c')][_0x9a01('0x1a')]);}_0x46968a[_0x9a01('0x33')]=qs['sort'](_0xb0ee71[_0x9a01('0x2c')][_0x9a01('0x34')]);_0x46968a['where']=qs[_0x9a01('0x2d')](_['pick'](_0xb0ee71['query'],_0x38d547[_0x9a01('0x2d')]),_0x528e9e);if(_0xb0ee71['query']['filter']){_0x46968a[_0x9a01('0x35')]=_['merge'](_0x46968a[_0x9a01('0x35')],{'$or':_[_0x9a01('0x28')](_0x528e9e,function(_0x4e78c2){if(_0x4e78c2[_0x9a01('0x2a')]!==_0x9a01('0x36')){var _0x17fccf={};_0x17fccf[_0x4e78c2[_0x9a01('0x26')]]={'$like':'%'+_0xb0ee71['query'][_0x9a01('0x37')]+'%'};return _0x17fccf;}})});}_0x46968a=_[_0x9a01('0x38')]({},_0x46968a,_0xb0ee71['options']);var _0x2145a8={'where':_0x46968a[_0x9a01('0x35')]};return db[_0x9a01('0x39')][_0x9a01('0x3a')](_0x2145a8)['then'](function(_0x5b9382){_0x1c8cfb[_0x9a01('0x3a')]=_0x5b9382;if(_0xb0ee71['query'][_0x9a01('0x3b')]){_0x46968a[_0x9a01('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x9a01('0x3d')](_0x46968a);})[_0x9a01('0x22')](function(_0x3f7d93){_0x1c8cfb[_0x9a01('0x3e')]=_0x3f7d93;return _0x1c8cfb;})['then'](respondWithFilteredResult(_0x4e9450,_0x46968a))[_0x9a01('0x3f')](handleError(_0x4e9450,null));};exports['show']=function(_0x3604a7,_0x52cb61){var _0x506526={'raw':!![],'where':{'id':_0x3604a7[_0x9a01('0x40')]['id']}},_0x7c932b={};_0x7c932b[_0x9a01('0x2f')]=_[_0x9a01('0x2b')](db[_0x9a01('0x39')][_0x9a01('0x29')]);_0x7c932b['query']=_['keys'](_0x3604a7[_0x9a01('0x2c')]);_0x7c932b['filters']=_[_0x9a01('0x2e')](_0x7c932b[_0x9a01('0x2f')],_0x7c932b[_0x9a01('0x2c')]);_0x506526[_0x9a01('0x30')]=_['intersection'](_0x7c932b[_0x9a01('0x2f')],qs['fields'](_0x3604a7[_0x9a01('0x2c')][_0x9a01('0x31')]));_0x506526[_0x9a01('0x30')]=_0x506526[_0x9a01('0x30')][_0x9a01('0x41')]?_0x506526[_0x9a01('0x30')]:_0x7c932b[_0x9a01('0x2f')];if(_0x3604a7[_0x9a01('0x2c')]['includeAll']){_0x506526[_0x9a01('0x3c')]=[{'all':!![]}];}_0x506526=_[_0x9a01('0x38')]({},_0x506526,_0x3604a7[_0x9a01('0x42')]);return db[_0x9a01('0x39')]['find'](_0x506526)[_0x9a01('0x22')](handleEntityNotFound(_0x52cb61,null))[_0x9a01('0x22')](respondWithResult(_0x52cb61,null))[_0x9a01('0x3f')](handleError(_0x52cb61,null));};exports[_0x9a01('0x43')]=function(_0x1e9b29,_0x45dc36){return db[_0x9a01('0x39')][_0x9a01('0x43')](_0x1e9b29['body'],{})[_0x9a01('0x22')](respondWithResult(_0x45dc36,0xc9))[_0x9a01('0x3f')](handleError(_0x45dc36,null));};exports['update']=function(_0x301d7c,_0x257f7c){if(_0x301d7c[_0x9a01('0x44')]['id']){delete _0x301d7c[_0x9a01('0x44')]['id'];}return db[_0x9a01('0x39')][_0x9a01('0x45')]({'where':{'id':_0x301d7c[_0x9a01('0x40')]['id']}})[_0x9a01('0x22')](handleEntityNotFound(_0x257f7c,null))[_0x9a01('0x22')](saveUpdates(_0x301d7c[_0x9a01('0x44')],null))[_0x9a01('0x22')](respondWithResult(_0x257f7c,null))[_0x9a01('0x3f')](handleError(_0x257f7c,null));};exports[_0x9a01('0x23')]=function(_0x21ede5,_0x60a007){return db[_0x9a01('0x39')]['find']({'where':{'id':_0x21ede5[_0x9a01('0x40')]['id']}})[_0x9a01('0x22')](handleEntityNotFound(_0x60a007,null))[_0x9a01('0x22')](removeEntity(_0x60a007,null))[_0x9a01('0x3f')](handleError(_0x60a007,null));};exports[_0x9a01('0x46')]=function(_0x30cf3b,_0x203494){return db[_0x9a01('0x39')][_0x9a01('0x46')]()[_0x9a01('0x22')](respondWithResult(_0x203494,null))[_0x9a01('0x3f')](handleError(_0x203494,null));}; \ No newline at end of file +var _0xd2cc=['stack','name','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','error'];(function(_0x31e876,_0x1c42ef){var _0x59d945=function(_0x4cf41d){while(--_0x4cf41d){_0x31e876['push'](_0x31e876['shift']());}};_0x59d945(++_0x1c42ef);}(_0xd2cc,0x107));var _0xcd2c=function(_0x3405bc,_0x478030){_0x3405bc=_0x3405bc-0x0;var _0xb1a44=_0xd2cc[_0x3405bc];return _0xb1a44;};'use strict';var pdf=require(_0xcd2c('0x0'));var emlformat=require(_0xcd2c('0x1'));var rimraf=require(_0xcd2c('0x2'));var zipdir=require(_0xcd2c('0x3'));var jsonpatch=require(_0xcd2c('0x4'));var rp=require(_0xcd2c('0x5'));var moment=require(_0xcd2c('0x6'));var BPromise=require(_0xcd2c('0x7'));var Mustache=require(_0xcd2c('0x8'));var util=require(_0xcd2c('0x9'));var path=require('path');var sox=require(_0xcd2c('0xa'));var csv=require('to-csv');var ejs=require(_0xcd2c('0xb'));var fs=require('fs');var _=require(_0xcd2c('0xc'));var squel=require(_0xcd2c('0xd'));var crypto=require(_0xcd2c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcd2c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcd2c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd2c('0x11'));var as=require(_0xcd2c('0x12'));var hardwareService=require(_0xcd2c('0x13'));var logger=require(_0xcd2c('0x14'))(_0xcd2c('0x15'));var utils=require('../../config/utils');var config=require(_0xcd2c('0x16'));var db=require(_0xcd2c('0x17'))['db'];function respondWithStatusCode(_0x32849a,_0x95ae34){_0x95ae34=_0x95ae34||0xcc;return function(_0x412e74){if(_0x412e74){return _0x32849a[_0xcd2c('0x18')](_0x95ae34);}return _0x32849a[_0xcd2c('0x19')](_0x95ae34)['end']();};}function respondWithResult(_0x3f99e7,_0x455e7d){_0x455e7d=_0x455e7d||0xc8;return function(_0x1d7aac){if(_0x1d7aac){return _0x3f99e7[_0xcd2c('0x19')](_0x455e7d)[_0xcd2c('0x1a')](_0x1d7aac);}};}function respondWithFilteredResult(_0x2de767,_0x599c90){return function(_0x5721db){if(_0x5721db){var _0xab996c=_0x5721db[_0xcd2c('0x1b')],_0x541729=_0x599c90[_0xcd2c('0x1c')],_0x71621a=_0x599c90[_0xcd2c('0x1c')]+_0x599c90['limit'],_0x5c52e7;if(_0x71621a>=_0xab996c){_0x71621a=_0xab996c;_0x5c52e7=0xc8;}else{_0x5c52e7=0xce;}_0x2de767[_0xcd2c('0x19')](_0x5c52e7);return _0x2de767[_0xcd2c('0x1d')](_0xcd2c('0x1e'),_0x541729+'-'+_0x71621a+'/'+_0xab996c)[_0xcd2c('0x1a')](_0x5721db);}return null;};}function patchUpdates(_0x178273){return function(_0x538cf1){try{jsonpatch[_0xcd2c('0x1f')](_0x538cf1,_0x178273,!![]);}catch(_0x1bd387){return BPromise[_0xcd2c('0x20')](_0x1bd387);}return _0x538cf1[_0xcd2c('0x21')]();};}function saveUpdates(_0x37ab7d,_0x5d8361){return function(_0x18aace){if(_0x18aace){return _0x18aace[_0xcd2c('0x22')](_0x37ab7d)[_0xcd2c('0x23')](function(_0x1ad456){return _0x1ad456;});}return null;};}function removeEntity(_0x5d8ca4,_0x5e7fcc){return function(_0x154f62){if(_0x154f62){return _0x154f62['destroy']()['then'](function(){_0x5d8ca4[_0xcd2c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321bdd,_0x8b8516){return function(_0x2b42af){if(!_0x2b42af){_0x321bdd[_0xcd2c('0x18')](0x194);}return _0x2b42af;};}function handleError(_0x158eb7,_0x37ce75){_0x37ce75=_0x37ce75||0x1f4;return function(_0x3ba5e9){logger[_0xcd2c('0x24')](_0x3ba5e9[_0xcd2c('0x25')]);if(_0x3ba5e9[_0xcd2c('0x26')]){delete _0x3ba5e9['name'];}_0x158eb7[_0xcd2c('0x19')](_0x37ce75)['send'](_0x3ba5e9);};}exports[_0xcd2c('0x27')]=function(_0x4381f3,_0x3b8d6b){var _0x1bf530={},_0x5475b8={},_0xe8ad68={'count':0x0,'rows':[]};var _0x4b24ba=_['map'](db[_0xcd2c('0x28')][_0xcd2c('0x29')],function(_0x15eadb){return{'name':_0x15eadb[_0xcd2c('0x2a')],'type':_0x15eadb[_0xcd2c('0x2b')][_0xcd2c('0x2c')]};});_0x5475b8[_0xcd2c('0x2d')]=_[_0xcd2c('0x2e')](_0x4b24ba,_0xcd2c('0x26'));_0x5475b8[_0xcd2c('0x2f')]=_['keys'](_0x4381f3[_0xcd2c('0x2f')]);_0x5475b8[_0xcd2c('0x30')]=_['intersection'](_0x5475b8[_0xcd2c('0x2d')],_0x5475b8['query']);_0x1bf530[_0xcd2c('0x31')]=_[_0xcd2c('0x32')](_0x5475b8[_0xcd2c('0x2d')],qs[_0xcd2c('0x33')](_0x4381f3['query'][_0xcd2c('0x33')]));_0x1bf530[_0xcd2c('0x31')]=_0x1bf530[_0xcd2c('0x31')][_0xcd2c('0x34')]?_0x1bf530['attributes']:_0x5475b8[_0xcd2c('0x2d')];if(!_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x35')]('nolimit')){_0x1bf530[_0xcd2c('0x36')]=qs['limit'](_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x36')]);_0x1bf530[_0xcd2c('0x1c')]=qs['offset'](_0x4381f3['query'][_0xcd2c('0x1c')]);}_0x1bf530[_0xcd2c('0x37')]=qs[_0xcd2c('0x38')](_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x38')]);_0x1bf530[_0xcd2c('0x39')]=qs[_0xcd2c('0x30')](_[_0xcd2c('0x3a')](_0x4381f3['query'],_0x5475b8[_0xcd2c('0x30')]),_0x4b24ba);if(_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x3b')]){_0x1bf530[_0xcd2c('0x39')]=_['merge'](_0x1bf530[_0xcd2c('0x39')],{'$or':_[_0xcd2c('0x2e')](_0x4b24ba,function(_0x4579f3){if(_0x4579f3[_0xcd2c('0x2b')]!=='VIRTUAL'){var _0x38fee8={};_0x38fee8[_0x4579f3['name']]={'$like':'%'+_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x3b')]+'%'};return _0x38fee8;}})});}_0x1bf530=_[_0xcd2c('0x3c')]({},_0x1bf530,_0x4381f3['options']);var _0x451e07={'where':_0x1bf530[_0xcd2c('0x39')]};return db['SquareDetailsReport'][_0xcd2c('0x1b')](_0x451e07)[_0xcd2c('0x23')](function(_0x3d2eb6){_0xe8ad68[_0xcd2c('0x1b')]=_0x3d2eb6;if(_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x3d')]){_0x1bf530[_0xcd2c('0x3e')]=[{'all':!![]}];}return db[_0xcd2c('0x28')][_0xcd2c('0x3f')](_0x1bf530);})[_0xcd2c('0x23')](function(_0x5bf24d){_0xe8ad68[_0xcd2c('0x40')]=_0x5bf24d;return _0xe8ad68;})[_0xcd2c('0x23')](respondWithFilteredResult(_0x3b8d6b,_0x1bf530))[_0xcd2c('0x41')](handleError(_0x3b8d6b,null));};exports[_0xcd2c('0x42')]=function(_0x10a33d,_0x35eafe){var _0x119be8={'raw':!![],'where':{'id':_0x10a33d['params']['id']}},_0x48d236={};_0x48d236['model']=_[_0xcd2c('0x43')](db[_0xcd2c('0x28')][_0xcd2c('0x29')]);_0x48d236[_0xcd2c('0x2f')]=_[_0xcd2c('0x43')](_0x10a33d[_0xcd2c('0x2f')]);_0x48d236['filters']=_[_0xcd2c('0x32')](_0x48d236[_0xcd2c('0x2d')],_0x48d236[_0xcd2c('0x2f')]);_0x119be8['attributes']=_['intersection'](_0x48d236[_0xcd2c('0x2d')],qs[_0xcd2c('0x33')](_0x10a33d[_0xcd2c('0x2f')]['fields']));_0x119be8['attributes']=_0x119be8[_0xcd2c('0x31')][_0xcd2c('0x34')]?_0x119be8[_0xcd2c('0x31')]:_0x48d236['model'];if(_0x10a33d['query'][_0xcd2c('0x3d')]){_0x119be8[_0xcd2c('0x3e')]=[{'all':!![]}];}_0x119be8=_[_0xcd2c('0x3c')]({},_0x119be8,_0x10a33d[_0xcd2c('0x44')]);return db['SquareDetailsReport'][_0xcd2c('0x45')](_0x119be8)[_0xcd2c('0x23')](handleEntityNotFound(_0x35eafe,null))['then'](respondWithResult(_0x35eafe,null))[_0xcd2c('0x41')](handleError(_0x35eafe,null));};exports['create']=function(_0x2c4805,_0x499cdb){return db[_0xcd2c('0x28')][_0xcd2c('0x46')](_0x2c4805[_0xcd2c('0x47')],{})[_0xcd2c('0x23')](respondWithResult(_0x499cdb,0xc9))[_0xcd2c('0x41')](handleError(_0x499cdb,null));};exports[_0xcd2c('0x22')]=function(_0x556326,_0x15a6a9){if(_0x556326[_0xcd2c('0x47')]['id']){delete _0x556326[_0xcd2c('0x47')]['id'];}return db[_0xcd2c('0x28')][_0xcd2c('0x45')]({'where':{'id':_0x556326[_0xcd2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x15a6a9,null))[_0xcd2c('0x23')](saveUpdates(_0x556326[_0xcd2c('0x47')],null))[_0xcd2c('0x23')](respondWithResult(_0x15a6a9,null))[_0xcd2c('0x41')](handleError(_0x15a6a9,null));};exports[_0xcd2c('0x49')]=function(_0x5620d0,_0x3b47df){return db[_0xcd2c('0x28')][_0xcd2c('0x45')]({'where':{'id':_0x5620d0[_0xcd2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b47df,null))['then'](removeEntity(_0x3b47df,null))[_0xcd2c('0x41')](handleError(_0x3b47df,null));};exports['describe']=function(_0x4c05fa,_0x51984c){return db['SquareDetailsReport'][_0xcd2c('0x4a')]()[_0xcd2c('0x23')](respondWithResult(_0x51984c,null))[_0xcd2c('0x41')](handleError(_0x51984c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 84484dc..f335d0f 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 _0xc074=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','../../config/logger','moment','bluebird'];(function(_0x2afe47,_0x398584){var _0x226203=function(_0x56cce4){while(--_0x56cce4){_0x2afe47['push'](_0x2afe47['shift']());}};_0x226203(++_0x398584);}(_0xc074,0xec));var _0x4c07=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0xc074[_0x420b24];return _0x4da552;};'use strict';var _=require(_0x4c07('0x0'));var util=require('util');var logger=require(_0x4c07('0x1'))('api');var moment=require(_0x4c07('0x2'));var BPromise=require(_0x4c07('0x3'));var rp=require(_0x4c07('0x4'));var fs=require('fs');var path=require(_0x4c07('0x5'));var rimraf=require(_0x4c07('0x6'));var config=require(_0x4c07('0x7'));var attributes=require(_0x4c07('0x8'));module[_0x4c07('0x9')]=function(_0x40bce1,_0x1f571b){return _0x40bce1[_0x4c07('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x4c07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd98=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash'];(function(_0x4fa723,_0x4565e0){var _0x1f6279=function(_0x19e11a){while(--_0x19e11a){_0x4fa723['push'](_0x4fa723['shift']());}};_0x1f6279(++_0x4565e0);}(_0xdd98,0x1eb));var _0x8dd9=function(_0x30ebbc,_0x481b0f){_0x30ebbc=_0x30ebbc-0x0;var _0x2fd850=_0xdd98[_0x30ebbc];return _0x2fd850;};'use strict';var _=require(_0x8dd9('0x0'));var util=require(_0x8dd9('0x1'));var logger=require(_0x8dd9('0x2'))('api');var moment=require(_0x8dd9('0x3'));var BPromise=require('bluebird');var rp=require(_0x8dd9('0x4'));var fs=require('fs');var path=require(_0x8dd9('0x5'));var rimraf=require(_0x8dd9('0x6'));var config=require(_0x8dd9('0x7'));var attributes=require(_0x8dd9('0x8'));module[_0x8dd9('0x9')]=function(_0xfd4f2c,_0x345650){return _0xfd4f2c['define'](_0x8dd9('0xa'),attributes,{'tableName':_0x8dd9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index e933c44..471f147 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 _0x6eb5=['options','raw','lodash','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','create'];(function(_0x2f031b,_0x2faef1){var _0x488b0d=function(_0x2a3dad){while(--_0x2a3dad){_0x2f031b['push'](_0x2f031b['shift']());}};_0x488b0d(++_0x2faef1);}(_0x6eb5,0xf4));var _0x56eb=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0x6eb5[_0xe39824];return _0x4bc31e;};'use strict';var _=require(_0x56eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56eb('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56eb('0x2'));var config=require(_0x56eb('0x3'));var jayson=require(_0x56eb('0x4'));var client=jayson[_0x56eb('0x5')][_0x56eb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2000d2,_0x372672,_0x406d7a){return new BPromise(function(_0x5c815c,_0x216161){return client[_0x56eb('0x7')](_0x2000d2,_0x406d7a)[_0x56eb('0x8')](function(_0x568d30){logger[_0x56eb('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x372672,_0x56eb('0xa'));logger[_0x56eb('0xb')](_0x56eb('0xc'),_0x372672,'request\x20sent',JSON[_0x56eb('0xd')](_0x568d30));if(_0x568d30['error']){if(_0x568d30[_0x56eb('0xe')]['code']===0x1f4){logger[_0x56eb('0xe')](_0x56eb('0xf'),_0x372672,_0x568d30['error'][_0x56eb('0x10')]);return _0x216161(_0x568d30[_0x56eb('0xe')][_0x56eb('0x10')]);}logger['error'](_0x56eb('0xf'),_0x372672,_0x568d30[_0x56eb('0xe')]['message']);return _0x5c815c(_0x568d30[_0x56eb('0xe')][_0x56eb('0x10')]);}else{logger[_0x56eb('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x372672,_0x56eb('0xa'));_0x5c815c(_0x568d30['result']['message']);}})[_0x56eb('0x11')](function(_0x1c4c50){logger[_0x56eb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x372672,_0x1c4c50);_0x216161(_0x1c4c50);});});}exports[_0x56eb('0x12')]=function(_0x3aeee3){var _0x5a8592=this;return new Promise(function(_0x3025b6,_0xa833e9){return db['SquareDetailsReport'][_0x56eb('0x13')](_0x3aeee3['body'],{'raw':_0x3aeee3[_0x56eb('0x14')]?_0x3aeee3[_0x56eb('0x14')][_0x56eb('0x15')]===undefined?!![]:![]:!![]})[_0x56eb('0x8')](function(_0x423abd){logger[_0x56eb('0x9')]('CreateSquareDetailsReport',_0x3aeee3);logger[_0x56eb('0xb')](_0x56eb('0x12'),_0x3aeee3,JSON['stringify'](_0x423abd));_0x3025b6(_0x423abd);})[_0x56eb('0x11')](function(_0x39fa9a){logger['error'](_0x56eb('0x12'),_0x39fa9a[_0x56eb('0x10')],_0x3aeee3);_0xa833e9(_0x5a8592[_0x56eb('0xe')](0x1f4,_0x39fa9a[_0x56eb('0x10')]));});});}; \ No newline at end of file +var _0x7586=['then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateSquareDetailsReport','create','body','options','raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x54daf6,_0xcacf2b){var _0x11798d=function(_0x3f3efd){while(--_0x3f3efd){_0x54daf6['push'](_0x54daf6['shift']());}};_0x11798d(++_0xcacf2b);}(_0x7586,0x78));var _0x6758=function(_0x41d364,_0xdfdc1a){_0x41d364=_0x41d364-0x0;var _0x5ace98=_0x7586[_0x41d364];return _0x5ace98;};'use strict';var _=require(_0x6758('0x0'));var util=require('util');var moment=require(_0x6758('0x1'));var BPromise=require('bluebird');var rs=require(_0x6758('0x2'));var fs=require('fs');var Redis=require(_0x6758('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6758('0x4'));var logger=require(_0x6758('0x5'))(_0x6758('0x6'));var config=require('../../config/environment');var jayson=require(_0x6758('0x7'));var client=jayson[_0x6758('0x8')][_0x6758('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56eba9,_0xdc5e90,_0x21e82f){return new BPromise(function(_0x322a6d,_0x45305d){return client['request'](_0x56eba9,_0x21e82f)[_0x6758('0xa')](function(_0x37cadd){logger[_0x6758('0xb')](_0x6758('0xc'),_0xdc5e90,'request\x20sent');logger[_0x6758('0xd')](_0x6758('0xe'),_0xdc5e90,'request\x20sent',JSON[_0x6758('0xf')](_0x37cadd));if(_0x37cadd[_0x6758('0x10')]){if(_0x37cadd[_0x6758('0x10')][_0x6758('0x11')]===0x1f4){logger[_0x6758('0x10')](_0x6758('0xc'),_0xdc5e90,_0x37cadd[_0x6758('0x10')][_0x6758('0x12')]);return _0x45305d(_0x37cadd[_0x6758('0x10')][_0x6758('0x12')]);}logger[_0x6758('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0xdc5e90,_0x37cadd[_0x6758('0x10')][_0x6758('0x12')]);return _0x322a6d(_0x37cadd[_0x6758('0x10')]['message']);}else{logger[_0x6758('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xdc5e90,_0x6758('0x13'));_0x322a6d(_0x37cadd[_0x6758('0x14')][_0x6758('0x12')]);}})['catch'](function(_0x1b8299){logger[_0x6758('0x10')](_0x6758('0xc'),_0xdc5e90,_0x1b8299);_0x45305d(_0x1b8299);});});}exports[_0x6758('0x15')]=function(_0x5b49f8){var _0x25bc2b=this;return new Promise(function(_0x114032,_0x40a20e){return db['SquareDetailsReport'][_0x6758('0x16')](_0x5b49f8[_0x6758('0x17')],{'raw':_0x5b49f8[_0x6758('0x18')]?_0x5b49f8[_0x6758('0x18')][_0x6758('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4db42c){logger[_0x6758('0xb')](_0x6758('0x15'),_0x5b49f8);logger[_0x6758('0xd')](_0x6758('0x15'),_0x5b49f8,JSON[_0x6758('0xf')](_0x4db42c));_0x114032(_0x4db42c);})['catch'](function(_0x2c701d){logger[_0x6758('0x10')](_0x6758('0x15'),_0x2c701d['message'],_0x5b49f8);_0x40a20e(_0x25bc2b[_0x6758('0x10')](0x1f4,_0x2c701d[_0x6758('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index a548f5e..1f0b1b0 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 _0xa329=['isAuthenticated','index','killProcess','exports','express','Router','./system.controller'];(function(_0x17c262,_0x1bf7f8){var _0x220a71=function(_0x37c4a5){while(--_0x37c4a5){_0x17c262['push'](_0x17c262['shift']());}};_0x220a71(++_0x1bf7f8);}(_0xa329,0x162));var _0x9a32=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0xa329[_0x59145a];return _0xf04d7;};'use strict';var express=require(_0x9a32('0x0'));var router=express[_0x9a32('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9a32('0x2'));router['get']('/',auth[_0x9a32('0x3')](),controller[_0x9a32('0x4')]);router['get']('/process/:pid/kill',auth[_0x9a32('0x3')](),controller[_0x9a32('0x5')]);module[_0x9a32('0x6')]=router; \ No newline at end of file +var _0x9749=['../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','express','Router'];(function(_0x4b8ecc,_0x4cd01c){var _0x48c1b9=function(_0x308aa3){while(--_0x308aa3){_0x4b8ecc['push'](_0x4b8ecc['shift']());}};_0x48c1b9(++_0x4cd01c);}(_0x9749,0xde));var _0x9974=function(_0xdb64e1,_0x3bea0c){_0xdb64e1=_0xdb64e1-0x0;var _0x5d00ae=_0x9749[_0xdb64e1];return _0x5d00ae;};'use strict';var express=require(_0x9974('0x0'));var router=express[_0x9974('0x1')]();var auth=require(_0x9974('0x2'));var controller=require(_0x9974('0x3'));router[_0x9974('0x4')]('/',auth['isAuthenticated'](),controller[_0x9974('0x5')]);router['get'](_0x9974('0x6'),auth[_0x9974('0x7')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index be362fe..6f629ed 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 _0xb2ec=['catch','json','killProcess','components/import/cm','format','params','pid','length','Process\x20with\x20pid\x20%s\x20not\x20found!','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','then','status'];(function(_0x29d18c,_0x13622a){var _0x3b4059=function(_0x2bb94f){while(--_0x2bb94f){_0x29d18c['push'](_0x29d18c['shift']());}};_0x3b4059(++_0x13622a);}(_0xb2ec,0x1de));var _0xcb2e=function(_0x388c5b,_0xa1bd9a){_0x388c5b=_0x388c5b-0x0;var _0x336ddc=_0xb2ec[_0x388c5b];return _0x336ddc;};'use strict';var info=require(_0xcb2e('0x0'));var exec=require(_0xcb2e('0x1'))[_0xcb2e('0x2')];var logger=require(_0xcb2e('0x3'))(_0xcb2e('0x4'));var util=require(_0xcb2e('0x5'));var BPromise=require(_0xcb2e('0x6'));var _=require(_0xcb2e('0x7'));function handleError(_0x5ebc16,_0x55602e,_0x11623d){_0x55602e=_0x55602e||0x1f4;return function(_0x425518){logger[_0xcb2e('0x8')](_0xcb2e('0x9'),_0x11623d,_0x55602e,util['inspect'](_0x425518,{'showHidden':![],'depth':null}));delete _0x425518[_0xcb2e('0xa')];_0x5ebc16['status'](_0x55602e)[_0xcb2e('0xb')](_0x425518);};}exports[_0xcb2e('0xc')]=function(_0x5bce35,_0x3c95ea){return info[_0xcb2e('0xd')]()[_0xcb2e('0xe')](function(_0x207948){return _0x3c95ea[_0xcb2e('0xf')](0xc8)['json'](_0x207948);})[_0xcb2e('0x10')](function(_0xe9100b){return _0x3c95ea[_0xcb2e('0xf')](0x1f4)[_0xcb2e('0x11')](_0xe9100b);});};exports[_0xcb2e('0x12')]=function(_0x1b4b5d,_0x5103a3){var _0x370fc4=[_0xcb2e('0x13')];return new BPromise(function(_0x41fff3,_0x1a657d){return exec(util[_0xcb2e('0x14')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1b4b5d[_0xcb2e('0x15')][_0xcb2e('0x16')]),function(_0x1abd48,_0x49f695,_0x59d01a){if(_0x1abd48){return _0x1a657d(_0x1abd48);}return _0x41fff3(_0x49f695);});})[_0xcb2e('0xe')](function(_0x37b1e3){var _0x10e89f=![];var _0x359b66=_0x37b1e3['split'](/\n/);for(var _0x8b9ef0=0x0,_0x428644=_0x370fc4[_0xcb2e('0x17')];_0x8b9ef0<_0x428644,_0x10e89f===![];_0x8b9ef0+=0x1){if(_0x37b1e3['indexOf'](_0x370fc4[_0x8b9ef0])>=0x0){_0x10e89f=!![];}}if(!_0x10e89f){throw new Error(util[_0xcb2e('0x14')](_0xcb2e('0x18'),_0x1b4b5d[_0xcb2e('0x15')][_0xcb2e('0x16')]));}process['kill'](_0x1b4b5d[_0xcb2e('0x15')]['pid'],'SIGINT');return _0x5103a3['status'](0xc8)['json']({'message':util[_0xcb2e('0x14')](_0xcb2e('0x19'),_0x1b4b5d[_0xcb2e('0x15')][_0xcb2e('0x16')])});})['catch'](handleError(_0x5103a3,null,_0xcb2e('0x12')));}; \ No newline at end of file +var _0x8bcc=['child_process','exec','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','index','getAllData','then','status','json','catch','killProcess','components/import/cm','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0x8bcc,0x82));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var info=require('systeminformation');var exec=require(_0xc8bc('0x0'))[_0xc8bc('0x1')];var logger=require('../../config/logger')(_0xc8bc('0x2'));var util=require(_0xc8bc('0x3'));var BPromise=require(_0xc8bc('0x4'));var _=require(_0xc8bc('0x5'));function handleError(_0x1dbc13,_0x35e0b5,_0x377e2f){_0x35e0b5=_0x35e0b5||0x1f4;return function(_0x36f56e){logger['error'](_0xc8bc('0x6'),_0x377e2f,_0x35e0b5,util[_0xc8bc('0x7')](_0x36f56e,{'showHidden':![],'depth':null}));delete _0x36f56e['name'];_0x1dbc13['status'](_0x35e0b5)['send'](_0x36f56e);};}exports[_0xc8bc('0x8')]=function(_0x286148,_0x20fa6a){return info[_0xc8bc('0x9')]()[_0xc8bc('0xa')](function(_0x6e66e3){return _0x20fa6a[_0xc8bc('0xb')](0xc8)[_0xc8bc('0xc')](_0x6e66e3);})[_0xc8bc('0xd')](function(_0x591ba5){return _0x20fa6a[_0xc8bc('0xb')](0x1f4)[_0xc8bc('0xc')](_0x591ba5);});};exports[_0xc8bc('0xe')]=function(_0x20393f,_0x3e6d5c){var _0x543fe6=[_0xc8bc('0xf')];return new BPromise(function(_0xaf1186,_0xa80a7c){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x20393f[_0xc8bc('0x10')][_0xc8bc('0x11')]),function(_0x543425,_0x945e3d,_0xe88b9b){if(_0x543425){return _0xa80a7c(_0x543425);}return _0xaf1186(_0x945e3d);});})['then'](function(_0x5a598f){var _0x216343=![];var _0x381eab=_0x5a598f[_0xc8bc('0x12')](/\n/);for(var _0x4b8b61=0x0,_0x1cc757=_0x543fe6[_0xc8bc('0x13')];_0x4b8b61<_0x1cc757,_0x216343===![];_0x4b8b61+=0x1){if(_0x5a598f[_0xc8bc('0x14')](_0x543fe6[_0x4b8b61])>=0x0){_0x216343=!![];}}if(!_0x216343){throw new Error(util[_0xc8bc('0x15')](_0xc8bc('0x16'),_0x20393f['params'][_0xc8bc('0x11')]));}process[_0xc8bc('0x17')](_0x20393f[_0xc8bc('0x10')][_0xc8bc('0x11')],_0xc8bc('0x18'));return _0x3e6d5c[_0xc8bc('0xb')](0xc8)[_0xc8bc('0xc')]({'message':util[_0xc8bc('0x15')](_0xc8bc('0x19'),_0x20393f['params'][_0xc8bc('0x11')])});})[_0xc8bc('0xd')](handleError(_0x3e6d5c,null,_0xc8bc('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8fb949d..1c95309 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['show','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0x3aceaf,_0x3710da){var _0x2f0ead=function(_0x176c52){while(--_0x176c52){_0x3aceaf['push'](_0x3aceaf['shift']());}};_0x2f0ead(++_0x3710da);}(_0x91a7,0xe7));var _0x791a=function(_0x5bbfc7,_0x32321c){_0x5bbfc7=_0x5bbfc7-0x0;var _0x5f4d86=_0x91a7[_0x5bbfc7];return _0x5f4d86;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x791a('0x4'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x791a('0x5')]('/',auth[_0x791a('0x6')](),controller['index']);router[_0x791a('0x5')]('/:id',auth[_0x791a('0x6')](),controller[_0x791a('0x7')]);router['post']('/',auth[_0x791a('0x6')](),controller[_0x791a('0x8')]);router[_0x791a('0x9')](_0x791a('0xa'),auth[_0x791a('0x6')](),controller['update']);router[_0x791a('0xb')](_0x791a('0xa'),auth['isAuthenticated'](),controller[_0x791a('0xc')]);module[_0x791a('0xd')]=router; \ No newline at end of file +var _0x91a7=['show','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0x5d5ba7,_0x35c34c){var _0x145641=function(_0x2e4955){while(--_0x2e4955){_0x5d5ba7['push'](_0x5d5ba7['shift']());}};_0x145641(++_0x35c34c);}(_0x91a7,0xe7));var _0x791a=function(_0xddb854,_0x24e109){_0xddb854=_0xddb854-0x0;var _0x598620=_0x91a7[_0xddb854];return _0x598620;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x791a('0x4'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x791a('0x5')]('/',auth[_0x791a('0x6')](),controller['index']);router[_0x791a('0x5')]('/:id',auth[_0x791a('0x6')](),controller[_0x791a('0x7')]);router['post']('/',auth[_0x791a('0x6')](),controller[_0x791a('0x8')]);router[_0x791a('0x9')](_0x791a('0xa'),auth[_0x791a('0x6')](),controller['update']);router[_0x791a('0xb')](_0x791a('0xa'),auth['isAuthenticated'](),controller[_0x791a('0xc')]);module[_0x791a('0xd')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 05c96ca..214409d 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','#0091EA','exports','STRING'];(function(_0x4c056a,_0xb0dfac){var _0x10e613=function(_0x12f97e){while(--_0x12f97e){_0x4c056a['push'](_0x4c056a['shift']());}};_0x10e613(++_0xb0dfac);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'unique':_0x0baf('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x3')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x0abf=['name','sequelize','STRING'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0ab('0x1')],'unique':_0xf0ab('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xf0ab('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fd08515..fba4106 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 _0x4b07=['filter','where','merge','options','count','includeAll','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','save','get','Tags','UserProfileResource','then','error','name','send','index','map','Tag','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','sort'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x4b07,0x66));var _0x74b0=function(_0xbdf519,_0x455616){_0xbdf519=_0xbdf519-0x0;var _0x52ac7c=_0x4b07[_0xbdf519];return _0x52ac7c;};'use strict';var pdf=require(_0x74b0('0x0'));var emlformat=require(_0x74b0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x74b0('0x2'));var rp=require(_0x74b0('0x3'));var moment=require(_0x74b0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x74b0('0x5'));var path=require(_0x74b0('0x6'));var sox=require(_0x74b0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x74b0('0x8'));var squel=require(_0x74b0('0x9'));var crypto=require(_0x74b0('0xa'));var jsforce=require(_0x74b0('0xb'));var deskjs=require(_0x74b0('0xc'));var toCsv=require(_0x74b0('0xd'));var querystring=require(_0x74b0('0xe'));var Papa=require(_0x74b0('0xf'));var Redis=require(_0x74b0('0x10'));var authService=require(_0x74b0('0x11'));var qs=require(_0x74b0('0x12'));var as=require(_0x74b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b0('0x14'))(_0x74b0('0x15'));var utils=require('../../config/utils');var config=require(_0x74b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3527cb,_0x350aef){_0x350aef=_0x350aef||0xcc;return function(_0x4d8a79){if(_0x4d8a79){return _0x3527cb[_0x74b0('0x17')](_0x350aef);}return _0x3527cb[_0x74b0('0x18')](_0x350aef)[_0x74b0('0x19')]();};}function respondWithResult(_0x3344be,_0x36a375){_0x36a375=_0x36a375||0xc8;return function(_0x518489){if(_0x518489){return _0x3344be[_0x74b0('0x18')](_0x36a375)[_0x74b0('0x1a')](_0x518489);}};}function respondWithFilteredResult(_0x476335,_0x498002){return function(_0x4f6a15){if(_0x4f6a15){var _0x124ff7=_0x4f6a15['count'],_0xc71965=_0x498002[_0x74b0('0x1b')],_0xd4a545=_0x498002[_0x74b0('0x1b')]+_0x498002[_0x74b0('0x1c')],_0x22c518;if(_0xd4a545>=_0x124ff7){_0xd4a545=_0x124ff7;_0x22c518=0xc8;}else{_0x22c518=0xce;}_0x476335[_0x74b0('0x18')](_0x22c518);return _0x476335[_0x74b0('0x1d')](_0x74b0('0x1e'),_0xc71965+'-'+_0xd4a545+'/'+_0x124ff7)[_0x74b0('0x1a')](_0x4f6a15);}return null;};}function patchUpdates(_0x2537db){return function(_0xe8872e){try{jsonpatch['apply'](_0xe8872e,_0x2537db,!![]);}catch(_0x230e1f){return BPromise['reject'](_0x230e1f);}return _0xe8872e[_0x74b0('0x1f')]();};}function saveUpdates(_0x55cde4,_0x244fe0){return function(_0x3e279e){if(_0x3e279e){return _0x3e279e['update'](_0x55cde4)['then'](function(_0x18b833){return _0x18b833;});}return null;};}function removeEntity(_0xbc9442,_0x3c37b6){return function(_0x52e3a6){if(_0x52e3a6){return _0x52e3a6['destroy']()['then'](function(){var _0x3a8bde=_0x52e3a6[_0x74b0('0x20')]({'plain':!![]});var _0x1c7b70=_0x74b0('0x21');return db[_0x74b0('0x22')]['destroy']({'where':{'type':_0x1c7b70,'resourceId':_0x3a8bde['id']}})[_0x74b0('0x23')](function(){return _0x52e3a6;});})[_0x74b0('0x23')](function(){_0xbc9442[_0x74b0('0x18')](0xcc)[_0x74b0('0x19')]();});}};}function handleEntityNotFound(_0x29e728,_0x4cf607){return function(_0x2dee11){if(!_0x2dee11){_0x29e728[_0x74b0('0x17')](0x194);}return _0x2dee11;};}function handleError(_0x5720f1,_0x485558){_0x485558=_0x485558||0x1f4;return function(_0x61f902){logger[_0x74b0('0x24')](_0x61f902['stack']);if(_0x61f902[_0x74b0('0x25')]){delete _0x61f902['name'];}_0x5720f1[_0x74b0('0x18')](_0x485558)[_0x74b0('0x26')](_0x61f902);};}exports[_0x74b0('0x27')]=function(_0x49b71f,_0x19fc13){var _0x5ae279={},_0x330963={},_0x2f9b89={'count':0x0,'rows':[]};var _0x34577c=_[_0x74b0('0x28')](db[_0x74b0('0x29')]['rawAttributes'],function(_0x331783){return{'name':_0x331783['fieldName'],'type':_0x331783[_0x74b0('0x2a')][_0x74b0('0x2b')]};});_0x330963[_0x74b0('0x2c')]=_[_0x74b0('0x28')](_0x34577c,'name');_0x330963[_0x74b0('0x2d')]=_['keys'](_0x49b71f[_0x74b0('0x2d')]);_0x330963[_0x74b0('0x2e')]=_['intersection'](_0x330963[_0x74b0('0x2c')],_0x330963[_0x74b0('0x2d')]);_0x5ae279[_0x74b0('0x2f')]=_[_0x74b0('0x30')](_0x330963[_0x74b0('0x2c')],qs['fields'](_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x31')]));_0x5ae279[_0x74b0('0x2f')]=_0x5ae279[_0x74b0('0x2f')]['length']?_0x5ae279[_0x74b0('0x2f')]:_0x330963['model'];if(!_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x32')]('nolimit')){_0x5ae279[_0x74b0('0x1c')]=qs[_0x74b0('0x1c')](_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x1c')]);_0x5ae279[_0x74b0('0x1b')]=qs[_0x74b0('0x1b')](_0x49b71f[_0x74b0('0x2d')]['offset']);}_0x5ae279['order']=qs[_0x74b0('0x33')](_0x49b71f['query'][_0x74b0('0x33')]);_0x5ae279['where']=qs[_0x74b0('0x2e')](_['pick'](_0x49b71f[_0x74b0('0x2d')],_0x330963[_0x74b0('0x2e')]),_0x34577c);if(_0x49b71f['query'][_0x74b0('0x34')]){_0x5ae279[_0x74b0('0x35')]=_[_0x74b0('0x36')](_0x5ae279[_0x74b0('0x35')],{'$or':_[_0x74b0('0x28')](_0x34577c,function(_0x49f5dc){if(_0x49f5dc[_0x74b0('0x2a')]!=='VIRTUAL'){var _0x413f75={};_0x413f75[_0x49f5dc['name']]={'$like':'%'+_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x34')]+'%'};return _0x413f75;}})});}_0x5ae279=_[_0x74b0('0x36')]({},_0x5ae279,_0x49b71f[_0x74b0('0x37')]);var _0x48524a={'where':_0x5ae279['where']};return db[_0x74b0('0x29')][_0x74b0('0x38')](_0x48524a)[_0x74b0('0x23')](function(_0x18b159){_0x2f9b89[_0x74b0('0x38')]=_0x18b159;if(_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x39')]){_0x5ae279['include']=[{'all':!![]}];}return db[_0x74b0('0x29')]['findAll'](_0x5ae279);})[_0x74b0('0x23')](function(_0x250aa9){_0x2f9b89[_0x74b0('0x3a')]=_0x250aa9;return _0x2f9b89;})[_0x74b0('0x23')](respondWithFilteredResult(_0x19fc13,_0x5ae279))[_0x74b0('0x3b')](handleError(_0x19fc13,null));};exports[_0x74b0('0x3c')]=function(_0x403477,_0x18ab4b){var _0xe3cd32={'raw':!![],'where':{'id':_0x403477[_0x74b0('0x3d')]['id']}},_0x401850={};_0x401850['model']=_[_0x74b0('0x3e')](db[_0x74b0('0x29')][_0x74b0('0x3f')]);_0x401850[_0x74b0('0x2d')]=_[_0x74b0('0x3e')](_0x403477[_0x74b0('0x2d')]);_0x401850['filters']=_[_0x74b0('0x30')](_0x401850[_0x74b0('0x2c')],_0x401850[_0x74b0('0x2d')]);_0xe3cd32['attributes']=_['intersection'](_0x401850[_0x74b0('0x2c')],qs[_0x74b0('0x31')](_0x403477[_0x74b0('0x2d')][_0x74b0('0x31')]));_0xe3cd32['attributes']=_0xe3cd32['attributes'][_0x74b0('0x40')]?_0xe3cd32[_0x74b0('0x2f')]:_0x401850['model'];if(_0x403477[_0x74b0('0x2d')][_0x74b0('0x39')]){_0xe3cd32[_0x74b0('0x41')]=[{'all':!![]}];}_0xe3cd32=_[_0x74b0('0x36')]({},_0xe3cd32,_0x403477[_0x74b0('0x37')]);return db[_0x74b0('0x29')][_0x74b0('0x42')](_0xe3cd32)[_0x74b0('0x23')](handleEntityNotFound(_0x18ab4b,null))[_0x74b0('0x23')](respondWithResult(_0x18ab4b,null))[_0x74b0('0x3b')](handleError(_0x18ab4b,null));};exports[_0x74b0('0x43')]=function(_0x4d4585,_0x5c9e3a){return db['Tag']['create'](_0x4d4585[_0x74b0('0x44')],{})['then'](function(_0x5d8089){var _0xf3f691=_0x4d4585[_0x74b0('0x45')][_0x74b0('0x20')]({'plain':!![]});if(!_0xf3f691)throw new Error(_0x74b0('0x46'));if(_0xf3f691[_0x74b0('0x47')]===_0x74b0('0x45')){var _0x434533=_0x5d8089['get']({'plain':!![]});var _0x52e678=_0x74b0('0x21');return db[_0x74b0('0x48')]['find']({'where':{'name':_0x52e678,'userProfileId':_0xf3f691[_0x74b0('0x49')]},'raw':!![]})['then'](function(_0x3adfd1){if(_0x3adfd1&&_0x3adfd1[_0x74b0('0x4a')]===0x0){return db[_0x74b0('0x22')][_0x74b0('0x43')]({'name':_0x434533[_0x74b0('0x25')],'resourceId':_0x434533['id'],'type':_0x3adfd1[_0x74b0('0x25')],'sectionId':_0x3adfd1['id']},{})[_0x74b0('0x23')](function(){return _0x5d8089;});}else{return _0x5d8089;}})[_0x74b0('0x3b')](function(_0x97136d){logger[_0x74b0('0x24')](_0x74b0('0x4b'),_0x97136d);throw _0x97136d;});}return _0x5d8089;})['then'](respondWithResult(_0x5c9e3a,0xc9))[_0x74b0('0x3b')](handleError(_0x5c9e3a,null));};exports[_0x74b0('0x4c')]=function(_0x5a031b,_0x508962){if(_0x5a031b[_0x74b0('0x44')]['id']){delete _0x5a031b[_0x74b0('0x44')]['id'];}return db[_0x74b0('0x29')]['find']({'where':{'id':_0x5a031b[_0x74b0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x508962,null))[_0x74b0('0x23')](saveUpdates(_0x5a031b[_0x74b0('0x44')],null))[_0x74b0('0x23')](respondWithResult(_0x508962,null))[_0x74b0('0x3b')](handleError(_0x508962,null));};exports['destroy']=function(_0x5e42db,_0x3ee2c7){return db[_0x74b0('0x29')][_0x74b0('0x42')]({'where':{'id':_0x5e42db[_0x74b0('0x3d')]['id']}})[_0x74b0('0x23')](handleEntityNotFound(_0x3ee2c7,null))[_0x74b0('0x23')](removeEntity(_0x3ee2c7,null))[_0x74b0('0x3b')](handleError(_0x3ee2c7,null));}; \ No newline at end of file +var _0x8da4=['attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','includeAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0x8da4,0x1ab));var _0x48da=function(_0x50d567,_0x2be785){_0x50d567=_0x50d567-0x0;var _0x2e3d8f=_0x8da4[_0x50d567];return _0x2e3d8f;};'use strict';var pdf=require(_0x48da('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x48da('0x1'));var jsonpatch=require(_0x48da('0x2'));var rp=require(_0x48da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x48da('0x4'));var util=require(_0x48da('0x5'));var path=require(_0x48da('0x6'));var sox=require(_0x48da('0x7'));var csv=require('to-csv');var ejs=require(_0x48da('0x8'));var fs=require('fs');var _=require(_0x48da('0x9'));var squel=require(_0x48da('0xa'));var crypto=require(_0x48da('0xb'));var jsforce=require(_0x48da('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x48da('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x48da('0xe'));var authService=require(_0x48da('0xf'));var qs=require(_0x48da('0x10'));var as=require(_0x48da('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48da('0x12'))(_0x48da('0x13'));var utils=require(_0x48da('0x14'));var config=require(_0x48da('0x15'));var db=require(_0x48da('0x16'))['db'];function respondWithStatusCode(_0x4a2f32,_0x4e35f4){_0x4e35f4=_0x4e35f4||0xcc;return function(_0x24f46f){if(_0x24f46f){return _0x4a2f32[_0x48da('0x17')](_0x4e35f4);}return _0x4a2f32[_0x48da('0x18')](_0x4e35f4)[_0x48da('0x19')]();};}function respondWithResult(_0x3d0aea,_0x8c56cc){_0x8c56cc=_0x8c56cc||0xc8;return function(_0x3ac4b3){if(_0x3ac4b3){return _0x3d0aea['status'](_0x8c56cc)[_0x48da('0x1a')](_0x3ac4b3);}};}function respondWithFilteredResult(_0xc21393,_0x3d0616){return function(_0x47f453){if(_0x47f453){var _0x505abb=_0x47f453[_0x48da('0x1b')],_0x3d496b=_0x3d0616[_0x48da('0x1c')],_0x117345=_0x3d0616[_0x48da('0x1c')]+_0x3d0616['limit'],_0x15c150;if(_0x117345>=_0x505abb){_0x117345=_0x505abb;_0x15c150=0xc8;}else{_0x15c150=0xce;}_0xc21393[_0x48da('0x18')](_0x15c150);return _0xc21393[_0x48da('0x1d')]('Content-Range',_0x3d496b+'-'+_0x117345+'/'+_0x505abb)[_0x48da('0x1a')](_0x47f453);}return null;};}function patchUpdates(_0x1802c3){return function(_0x5b5259){try{jsonpatch['apply'](_0x5b5259,_0x1802c3,!![]);}catch(_0x1757c3){return BPromise[_0x48da('0x1e')](_0x1757c3);}return _0x5b5259[_0x48da('0x1f')]();};}function saveUpdates(_0x8c323e,_0x429d1d){return function(_0x3a43ba){if(_0x3a43ba){return _0x3a43ba['update'](_0x8c323e)[_0x48da('0x20')](function(_0x2465c3){return _0x2465c3;});}return null;};}function removeEntity(_0x64c4cb,_0x5a850f){return function(_0x5d025c){if(_0x5d025c){return _0x5d025c[_0x48da('0x21')]()[_0x48da('0x20')](function(){var _0x4f587e=_0x5d025c[_0x48da('0x22')]({'plain':!![]});var _0x284cae=_0x48da('0x23');return db[_0x48da('0x24')][_0x48da('0x21')]({'where':{'type':_0x284cae,'resourceId':_0x4f587e['id']}})[_0x48da('0x20')](function(){return _0x5d025c;});})[_0x48da('0x20')](function(){_0x64c4cb['status'](0xcc)[_0x48da('0x19')]();});}};}function handleEntityNotFound(_0x3487d1,_0x391b07){return function(_0x1322ad){if(!_0x1322ad){_0x3487d1[_0x48da('0x17')](0x194);}return _0x1322ad;};}function handleError(_0x29e899,_0x18d13c){_0x18d13c=_0x18d13c||0x1f4;return function(_0x23d641){logger[_0x48da('0x25')](_0x23d641[_0x48da('0x26')]);if(_0x23d641[_0x48da('0x27')]){delete _0x23d641[_0x48da('0x27')];}_0x29e899['status'](_0x18d13c)[_0x48da('0x28')](_0x23d641);};}exports[_0x48da('0x29')]=function(_0x5c50be,_0x2a307c){var _0x4d476b={},_0x4be378={},_0x3508b4={'count':0x0,'rows':[]};var _0x428975=_['map'](db[_0x48da('0x2a')][_0x48da('0x2b')],function(_0x30c5ca){return{'name':_0x30c5ca[_0x48da('0x2c')],'type':_0x30c5ca[_0x48da('0x2d')][_0x48da('0x2e')]};});_0x4be378[_0x48da('0x2f')]=_[_0x48da('0x30')](_0x428975,_0x48da('0x27'));_0x4be378['query']=_[_0x48da('0x31')](_0x5c50be['query']);_0x4be378[_0x48da('0x32')]=_[_0x48da('0x33')](_0x4be378[_0x48da('0x2f')],_0x4be378[_0x48da('0x34')]);_0x4d476b[_0x48da('0x35')]=_['intersection'](_0x4be378[_0x48da('0x2f')],qs[_0x48da('0x36')](_0x5c50be['query'][_0x48da('0x36')]));_0x4d476b[_0x48da('0x35')]=_0x4d476b[_0x48da('0x35')]['length']?_0x4d476b[_0x48da('0x35')]:_0x4be378[_0x48da('0x2f')];if(!_0x5c50be['query'][_0x48da('0x37')](_0x48da('0x38'))){_0x4d476b[_0x48da('0x39')]=qs['limit'](_0x5c50be[_0x48da('0x34')][_0x48da('0x39')]);_0x4d476b[_0x48da('0x1c')]=qs[_0x48da('0x1c')](_0x5c50be['query']['offset']);}_0x4d476b['order']=qs[_0x48da('0x3a')](_0x5c50be['query']['sort']);_0x4d476b[_0x48da('0x3b')]=qs[_0x48da('0x32')](_[_0x48da('0x3c')](_0x5c50be[_0x48da('0x34')],_0x4be378['filters']),_0x428975);if(_0x5c50be['query'][_0x48da('0x3d')]){_0x4d476b['where']=_[_0x48da('0x3e')](_0x4d476b[_0x48da('0x3b')],{'$or':_['map'](_0x428975,function(_0xe91e6d){if(_0xe91e6d[_0x48da('0x2d')]!=='VIRTUAL'){var _0xbc855c={};_0xbc855c[_0xe91e6d[_0x48da('0x27')]]={'$like':'%'+_0x5c50be[_0x48da('0x34')]['filter']+'%'};return _0xbc855c;}})});}_0x4d476b=_['merge']({},_0x4d476b,_0x5c50be['options']);var _0x3d80a1={'where':_0x4d476b[_0x48da('0x3b')]};return db[_0x48da('0x2a')]['count'](_0x3d80a1)['then'](function(_0x2d216d){_0x3508b4[_0x48da('0x1b')]=_0x2d216d;if(_0x5c50be[_0x48da('0x34')][_0x48da('0x3f')]){_0x4d476b['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x4d476b);})['then'](function(_0x3ea669){_0x3508b4[_0x48da('0x40')]=_0x3ea669;return _0x3508b4;})[_0x48da('0x20')](respondWithFilteredResult(_0x2a307c,_0x4d476b))[_0x48da('0x41')](handleError(_0x2a307c,null));};exports[_0x48da('0x42')]=function(_0x51d087,_0x1100de){var _0x402d13={'raw':!![],'where':{'id':_0x51d087[_0x48da('0x43')]['id']}},_0xa56e7b={};_0xa56e7b[_0x48da('0x2f')]=_['keys'](db[_0x48da('0x2a')][_0x48da('0x2b')]);_0xa56e7b['query']=_['keys'](_0x51d087['query']);_0xa56e7b[_0x48da('0x32')]=_['intersection'](_0xa56e7b[_0x48da('0x2f')],_0xa56e7b['query']);_0x402d13[_0x48da('0x35')]=_[_0x48da('0x33')](_0xa56e7b['model'],qs[_0x48da('0x36')](_0x51d087[_0x48da('0x34')][_0x48da('0x36')]));_0x402d13[_0x48da('0x35')]=_0x402d13[_0x48da('0x35')]['length']?_0x402d13[_0x48da('0x35')]:_0xa56e7b[_0x48da('0x2f')];if(_0x51d087[_0x48da('0x34')][_0x48da('0x3f')]){_0x402d13['include']=[{'all':!![]}];}_0x402d13=_['merge']({},_0x402d13,_0x51d087[_0x48da('0x44')]);return db[_0x48da('0x2a')][_0x48da('0x45')](_0x402d13)[_0x48da('0x20')](handleEntityNotFound(_0x1100de,null))['then'](respondWithResult(_0x1100de,null))[_0x48da('0x41')](handleError(_0x1100de,null));};exports[_0x48da('0x46')]=function(_0x3cfcb9,_0xc784e6){return db[_0x48da('0x2a')][_0x48da('0x46')](_0x3cfcb9[_0x48da('0x47')],{})[_0x48da('0x20')](function(_0x23a7d7){var _0x131a1e=_0x3cfcb9[_0x48da('0x48')]['get']({'plain':!![]});if(!_0x131a1e)throw new Error(_0x48da('0x49'));if(_0x131a1e[_0x48da('0x4a')]===_0x48da('0x48')){var _0x365c07=_0x23a7d7[_0x48da('0x22')]({'plain':!![]});var _0x471079=_0x48da('0x23');return db[_0x48da('0x4b')][_0x48da('0x45')]({'where':{'name':_0x471079,'userProfileId':_0x131a1e[_0x48da('0x4c')]},'raw':!![]})[_0x48da('0x20')](function(_0x1dfff3){if(_0x1dfff3&&_0x1dfff3[_0x48da('0x4d')]===0x0){return db[_0x48da('0x24')][_0x48da('0x46')]({'name':_0x365c07[_0x48da('0x27')],'resourceId':_0x365c07['id'],'type':_0x1dfff3[_0x48da('0x27')],'sectionId':_0x1dfff3['id']},{})['then'](function(){return _0x23a7d7;});}else{return _0x23a7d7;}})[_0x48da('0x41')](function(_0x56ca7b){logger['error'](_0x48da('0x4e'),_0x56ca7b);throw _0x56ca7b;});}return _0x23a7d7;})['then'](respondWithResult(_0xc784e6,0xc9))[_0x48da('0x41')](handleError(_0xc784e6,null));};exports[_0x48da('0x4f')]=function(_0x46d57e,_0x10b244){if(_0x46d57e[_0x48da('0x47')]['id']){delete _0x46d57e[_0x48da('0x47')]['id'];}return db['Tag'][_0x48da('0x45')]({'where':{'id':_0x46d57e[_0x48da('0x43')]['id']}})[_0x48da('0x20')](handleEntityNotFound(_0x10b244,null))[_0x48da('0x20')](saveUpdates(_0x46d57e['body'],null))[_0x48da('0x20')](respondWithResult(_0x10b244,null))[_0x48da('0x41')](handleError(_0x10b244,null));};exports[_0x48da('0x21')]=function(_0x4c730d,_0x52db87){return db['Tag']['find']({'where':{'id':_0x4c730d[_0x48da('0x43')]['id']}})[_0x48da('0x20')](handleEntityNotFound(_0x52db87,null))[_0x48da('0x20')](removeEntity(_0x52db87,null))['catch'](handleError(_0x52db87,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b8b99c4..ac662f7 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 _0x687b=['moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','api'];(function(_0x4be14a,_0x50e1ca){var _0x143618=function(_0xd7ce4d){while(--_0xd7ce4d){_0x4be14a['push'](_0x4be14a['shift']());}};_0x143618(++_0x50e1ca);}(_0x687b,0x1eb));var _0xb687=function(_0x396dc6,_0x529342){_0x396dc6=_0x396dc6-0x0;var _0x285078=_0x687b[_0x396dc6];return _0x285078;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require('../../config/logger')(_0xb687('0x2'));var moment=require(_0xb687('0x3'));var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0xfdc315,_0x396831){return _0xfdc315[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19a0=['exports','Tag','tools_tags','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0xf2f9e7,_0x5a528b){var _0x217a45=function(_0x1f4617){while(--_0x1f4617){_0xf2f9e7['push'](_0xf2f9e7['shift']());}};_0x217a45(++_0x5a528b);}(_0x19a0,0x1b1));var _0x019a=function(_0x2e5468,_0x78d3a){_0x2e5468=_0x2e5468-0x0;var _0x1f292e=_0x19a0[_0x2e5468];return _0x1f292e;};'use strict';var _=require(_0x019a('0x0'));var util=require(_0x019a('0x1'));var logger=require(_0x019a('0x2'))('api');var moment=require(_0x019a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x019a('0x4'));var rimraf=require(_0x019a('0x5'));var config=require(_0x019a('0x6'));var attributes=require('./tag.attributes');module[_0x019a('0x7')]=function(_0x50939b,_0x388ad3){return _0x50939b['define'](_0x019a('0x8'),attributes,{'tableName':_0x019a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 0f0b8d8..72ede2d 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 _0x39cb=['code','Tag,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39c('0x2'));var fs=require('fs');var Redis=require(_0xb39c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var jayson=require(_0xb39c('0x8'));var client=jayson['client'][_0xb39c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc868,_0x40112f,_0x3f2fbe){return new BPromise(function(_0x47d6d7,_0x5ae14a){return client[_0xb39c('0xa')](_0x2fc868,_0x3f2fbe)[_0xb39c('0xb')](function(_0x3ffb94){logger[_0xb39c('0xc')]('Tag,\x20%s,\x20%s',_0x40112f,'request\x20sent');logger['debug'](_0xb39c('0xd'),_0x40112f,_0xb39c('0xe'),JSON[_0xb39c('0xf')](_0x3ffb94));if(_0x3ffb94[_0xb39c('0x10')]){if(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x11')]===0x1f4){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x3ffb94['error'][_0xb39c('0x13')]);return _0x5ae14a(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}logger['error'](_0xb39c('0x12'),_0x40112f,_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);return _0x47d6d7(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}else{logger[_0xb39c('0xc')](_0xb39c('0x12'),_0x40112f,'request\x20sent');_0x47d6d7(_0x3ffb94[_0xb39c('0x14')][_0xb39c('0x13')]);}})[_0xb39c('0x15')](function(_0x1c2c5f){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x1c2c5f);_0x5ae14a(_0x1c2c5f);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x2c9d22,_0x28f65a){var _0x160346=function(_0x14e429){while(--_0x14e429){_0x2c9d22['push'](_0x2c9d22['shift']());}};_0x160346(++_0x28f65a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index aa8ebf6..f317d49 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 _0x1a26=['exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','post','create','addQueues','/:id/users','addAgents','update','delete','destroy','removeQueues','removeAgents'];(function(_0x4f4cdc,_0x4cb0b){var _0x15a8fe=function(_0x5bf529){while(--_0x5bf529){_0x4f4cdc['push'](_0x4f4cdc['shift']());}};_0x15a8fe(++_0x4cb0b);}(_0x1a26,0x1e1));var _0x61a2=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x1a26[_0x39e84d];return _0x1991bc;};'use strict';var multer=require('multer');var util=require(_0x61a2('0x0'));var path=require('path');var timeout=require(_0x61a2('0x1'));var express=require('express');var router=express[_0x61a2('0x2')]();var auth=require(_0x61a2('0x3'));var interaction=require(_0x61a2('0x4'));var config=require('../../config/environment');var controller=require(_0x61a2('0x5'));router[_0x61a2('0x6')]('/',auth[_0x61a2('0x7')](),controller[_0x61a2('0x8')]);router[_0x61a2('0x6')](_0x61a2('0x9'),auth[_0x61a2('0x7')](),controller[_0x61a2('0xa')]);router[_0x61a2('0x6')](_0x61a2('0xb'),auth[_0x61a2('0x7')](),controller[_0x61a2('0xc')]);router[_0x61a2('0x6')]('/:id/users',auth[_0x61a2('0x7')](),controller['getAgents']);router[_0x61a2('0xd')]('/',auth[_0x61a2('0x7')](),controller[_0x61a2('0xe')]);router['post']('/:id/queues',auth[_0x61a2('0x7')](),controller[_0x61a2('0xf')]);router['post'](_0x61a2('0x10'),auth[_0x61a2('0x7')](),controller[_0x61a2('0x11')]);router['put'](_0x61a2('0x9'),auth['isAuthenticated'](),controller[_0x61a2('0x12')]);router[_0x61a2('0x13')]('/:id',auth[_0x61a2('0x7')](),controller[_0x61a2('0x14')]);router[_0x61a2('0x13')](_0x61a2('0xb'),auth[_0x61a2('0x7')](),controller[_0x61a2('0x15')]);router[_0x61a2('0x13')](_0x61a2('0x10'),auth['isAuthenticated'](),controller[_0x61a2('0x16')]);module[_0x61a2('0x17')]=router; \ No newline at end of file +var _0x6a88=['removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','update','delete','destroy','removeQueues'];(function(_0x29a4c2,_0x473cde){var _0x204a96=function(_0x9be6fe){while(--_0x9be6fe){_0x29a4c2['push'](_0x29a4c2['shift']());}};_0x204a96(++_0x473cde);}(_0x6a88,0x1bc));var _0x86a8=function(_0x4b332a,_0x5ec2db){_0x4b332a=_0x4b332a-0x0;var _0x115a04=_0x6a88[_0x4b332a];return _0x115a04;};'use strict';var multer=require('multer');var util=require(_0x86a8('0x0'));var path=require('path');var timeout=require(_0x86a8('0x1'));var express=require(_0x86a8('0x2'));var router=express[_0x86a8('0x3')]();var auth=require(_0x86a8('0x4'));var interaction=require(_0x86a8('0x5'));var config=require(_0x86a8('0x6'));var controller=require(_0x86a8('0x7'));router[_0x86a8('0x8')]('/',auth[_0x86a8('0x9')](),controller[_0x86a8('0xa')]);router['get'](_0x86a8('0xb'),auth[_0x86a8('0x9')](),controller['show']);router[_0x86a8('0x8')](_0x86a8('0xc'),auth[_0x86a8('0x9')](),controller[_0x86a8('0xd')]);router[_0x86a8('0x8')](_0x86a8('0xe'),auth[_0x86a8('0x9')](),controller[_0x86a8('0xf')]);router[_0x86a8('0x10')]('/',auth[_0x86a8('0x9')](),controller[_0x86a8('0x11')]);router[_0x86a8('0x10')](_0x86a8('0xc'),auth[_0x86a8('0x9')](),controller[_0x86a8('0x12')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x86a8('0x13')]);router['put'](_0x86a8('0xb'),auth[_0x86a8('0x9')](),controller[_0x86a8('0x14')]);router[_0x86a8('0x15')](_0x86a8('0xb'),auth[_0x86a8('0x9')](),controller[_0x86a8('0x16')]);router[_0x86a8('0x15')]('/:id/queues',auth['isAuthenticated'](),controller[_0x86a8('0x17')]);router[_0x86a8('0x15')](_0x86a8('0xe'),auth[_0x86a8('0x9')](),controller[_0x86a8('0x18')]);module[_0x86a8('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index ac1aa7d..7eaca07 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 _0xe900=['exports','STRING','name','sequelize'];(function(_0x2fef52,_0x2ae797){var _0x5f484c=function(_0x3b1036){while(--_0x3b1036){_0x2fef52['push'](_0x2fef52['shift']());}};_0x5f484c(++_0x2ae797);}(_0xe900,0x1a7));var _0x0e90=function(_0x4f3c4f,_0x4be3ac){_0x4f3c4f=_0x4f3c4f-0x0;var _0x38a198=_0xe900[_0x4f3c4f];return _0x38a198;};'use strict';var Sequelize=require(_0x0e90('0x0'));module[_0x0e90('0x1')]={'name':{'type':Sequelize[_0x0e90('0x2')],'allowNull':![],'unique':_0x0e90('0x3')},'description':{'type':Sequelize[_0x0e90('0x2')]}}; \ No newline at end of file +var _0xcaa2=['STRING','sequelize','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xcaa2,0xe5));var _0x2caa=function(_0x2ae2bc,_0x177514){_0x2ae2bc=_0x2ae2bc-0x0;var _0x53c290=_0xcaa2[_0x2ae2bc];return _0x53c290;};'use strict';var Sequelize=require(_0x2caa('0x0'));module[_0x2caa('0x1')]={'name':{'type':Sequelize[_0x2caa('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 0980a84..ec6c73c 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 _0xabe8=['sms','fax','openchannel','whatsapp','removeAgents','isArray','userTeam:remove','User','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','end','error','stack','name','map','Team','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','Sequelize','Unknown\x20channel','add','ids','removeQueues','addAgents','Chat','Sms','Fax','Openchannel','Whatsapp','each','findAll','online','voicePause','interface','upsert','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','voice','mail'];(function(_0x4e4a09,_0xe4eac8){var _0x17a756=function(_0x23b5ef){while(--_0x23b5ef){_0x4e4a09['push'](_0x4e4a09['shift']());}};_0x17a756(++_0xe4eac8);}(_0xabe8,0x8c));var _0x8abe=function(_0xd7d2,_0x5ad1cd){_0xd7d2=_0xd7d2-0x0;var _0x58ef71=_0xabe8[_0xd7d2];return _0x58ef71;};'use strict';var pdf=require(_0x8abe('0x0'));var emlformat=require(_0x8abe('0x1'));var rimraf=require(_0x8abe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8abe('0x3'));var rp=require(_0x8abe('0x4'));var moment=require('moment');var BPromise=require(_0x8abe('0x5'));var Mustache=require('mustache');var util=require(_0x8abe('0x6'));var path=require(_0x8abe('0x7'));var sox=require(_0x8abe('0x8'));var csv=require(_0x8abe('0x9'));var ejs=require(_0x8abe('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8abe('0xb'));var jsforce=require(_0x8abe('0xc'));var deskjs=require(_0x8abe('0xd'));var toCsv=require(_0x8abe('0x9'));var querystring=require(_0x8abe('0xe'));var Papa=require(_0x8abe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8abe('0x10'));var hardwareService=require(_0x8abe('0x11'));var logger=require(_0x8abe('0x12'))(_0x8abe('0x13'));var utils=require(_0x8abe('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x8abe('0x15')]=_[_0x8abe('0x16')](config[_0x8abe('0x15')],{'host':_0x8abe('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0x8abe('0x18')](socket);function respondWithStatusCode(_0x5e7c8b,_0x1c407d){_0x1c407d=_0x1c407d||0xcc;return function(_0x5d25ab){if(_0x5d25ab){return _0x5e7c8b[_0x8abe('0x19')](_0x1c407d);}return _0x5e7c8b[_0x8abe('0x1a')](_0x1c407d)['end']();};}function respondWithResult(_0x1bcd6d,_0x5bc34a){_0x5bc34a=_0x5bc34a||0xc8;return function(_0x2ca971){if(_0x2ca971){return _0x1bcd6d[_0x8abe('0x1a')](_0x5bc34a)[_0x8abe('0x1b')](_0x2ca971);}};}function respondWithFilteredResult(_0x2609f4,_0x3f5d9b){return function(_0x1d8aec){if(_0x1d8aec){var _0x1cd7c9=_0x1d8aec[_0x8abe('0x1c')],_0x297c10=_0x3f5d9b['offset'],_0x45905e=_0x3f5d9b[_0x8abe('0x1d')]+_0x3f5d9b[_0x8abe('0x1e')],_0x344fd2;if(_0x45905e>=_0x1cd7c9){_0x45905e=_0x1cd7c9;_0x344fd2=0xc8;}else{_0x344fd2=0xce;}_0x2609f4[_0x8abe('0x1a')](_0x344fd2);return _0x2609f4[_0x8abe('0x1f')](_0x8abe('0x20'),_0x297c10+'-'+_0x45905e+'/'+_0x1cd7c9)['json'](_0x1d8aec);}return null;};}function patchUpdates(_0x4f6c1c){return function(_0x455677){try{jsonpatch[_0x8abe('0x21')](_0x455677,_0x4f6c1c,!![]);}catch(_0x2626e7){return BPromise[_0x8abe('0x22')](_0x2626e7);}return _0x455677[_0x8abe('0x23')]();};}function saveUpdates(_0x2f7e3c,_0x113ab2){return function(_0x4d5f2d){if(_0x4d5f2d){return _0x4d5f2d[_0x8abe('0x24')](_0x2f7e3c)[_0x8abe('0x25')](function(_0x383ca7){return _0x383ca7;});}return null;};}function removeEntity(_0x1873d5,_0x1f9bde){return function(_0x198aa9){if(_0x198aa9){return _0x198aa9[_0x8abe('0x26')]()[_0x8abe('0x25')](function(){var _0x8df196=_0x198aa9[_0x8abe('0x27')]({'plain':!![]});var _0x40f33a=_0x8abe('0x28');return db[_0x8abe('0x29')][_0x8abe('0x26')]({'where':{'type':_0x40f33a,'resourceId':_0x8df196['id']}})[_0x8abe('0x25')](function(){return _0x198aa9;});})[_0x8abe('0x25')](function(){_0x1873d5[_0x8abe('0x1a')](0xcc)[_0x8abe('0x2a')]();});}};}function handleEntityNotFound(_0x4be22d,_0x468cb0){return function(_0x43530f){if(!_0x43530f){_0x4be22d[_0x8abe('0x19')](0x194);}return _0x43530f;};}function handleError(_0x4bcbb6,_0xca4d){_0xca4d=_0xca4d||0x1f4;return function(_0x4a899c){logger[_0x8abe('0x2b')](_0x4a899c[_0x8abe('0x2c')]);if(_0x4a899c['name']){delete _0x4a899c[_0x8abe('0x2d')];}_0x4bcbb6['status'](_0xca4d)['send'](_0x4a899c);};}exports['index']=function(_0x51f8ac,_0x248abd){var _0x4bd195={},_0x7c04dc={},_0x16ba7e={'count':0x0,'rows':[]};var _0x24ce27=_[_0x8abe('0x2e')](db[_0x8abe('0x2f')][_0x8abe('0x30')],function(_0x101ae0){return{'name':_0x101ae0['fieldName'],'type':_0x101ae0[_0x8abe('0x31')][_0x8abe('0x32')]};});_0x7c04dc[_0x8abe('0x33')]=_[_0x8abe('0x2e')](_0x24ce27,_0x8abe('0x2d'));_0x7c04dc[_0x8abe('0x34')]=_['keys'](_0x51f8ac[_0x8abe('0x34')]);_0x7c04dc[_0x8abe('0x35')]=_[_0x8abe('0x36')](_0x7c04dc[_0x8abe('0x33')],_0x7c04dc[_0x8abe('0x34')]);_0x4bd195[_0x8abe('0x37')]=_[_0x8abe('0x36')](_0x7c04dc[_0x8abe('0x33')],qs[_0x8abe('0x38')](_0x51f8ac['query'][_0x8abe('0x38')]));_0x4bd195['attributes']=_0x4bd195[_0x8abe('0x37')][_0x8abe('0x39')]?_0x4bd195['attributes']:_0x7c04dc['model'];if(!_0x51f8ac[_0x8abe('0x34')]['hasOwnProperty'](_0x8abe('0x3a'))){_0x4bd195[_0x8abe('0x1e')]=qs[_0x8abe('0x1e')](_0x51f8ac[_0x8abe('0x34')][_0x8abe('0x1e')]);_0x4bd195['offset']=qs[_0x8abe('0x1d')](_0x51f8ac['query']['offset']);}_0x4bd195[_0x8abe('0x3b')]=qs[_0x8abe('0x3c')](_0x51f8ac[_0x8abe('0x34')][_0x8abe('0x3c')]);_0x4bd195['where']=qs[_0x8abe('0x35')](_[_0x8abe('0x3d')](_0x51f8ac['query'],_0x7c04dc[_0x8abe('0x35')]),_0x24ce27);if(_0x51f8ac[_0x8abe('0x34')]['filter']){_0x4bd195[_0x8abe('0x3e')]=_['merge'](_0x4bd195[_0x8abe('0x3e')],{'$or':_[_0x8abe('0x2e')](_0x24ce27,function(_0x2ff789){if(_0x2ff789[_0x8abe('0x31')]!==_0x8abe('0x3f')){var _0x38fb89={};_0x38fb89[_0x2ff789[_0x8abe('0x2d')]]={'$like':'%'+_0x51f8ac['query'][_0x8abe('0x40')]+'%'};return _0x38fb89;}})});}_0x4bd195=_[_0x8abe('0x41')]({},_0x4bd195,_0x51f8ac['options']);var _0x4378bd={'where':_0x4bd195['where']};return db[_0x8abe('0x2f')][_0x8abe('0x1c')](_0x4378bd)[_0x8abe('0x25')](function(_0x19c83b){_0x16ba7e[_0x8abe('0x1c')]=_0x19c83b;if(_0x51f8ac[_0x8abe('0x34')][_0x8abe('0x42')]){_0x4bd195[_0x8abe('0x43')]=[{'all':!![]}];}return db[_0x8abe('0x2f')]['findAll'](_0x4bd195);})[_0x8abe('0x25')](function(_0x1a8ea9){_0x16ba7e[_0x8abe('0x44')]=_0x1a8ea9;return _0x16ba7e;})[_0x8abe('0x25')](respondWithFilteredResult(_0x248abd,_0x4bd195))[_0x8abe('0x45')](handleError(_0x248abd,null));};exports[_0x8abe('0x46')]=function(_0x202a12,_0x469fe9){var _0x4005bf={'raw':![],'where':{'id':_0x202a12[_0x8abe('0x47')]['id']}},_0x51d7e7={};_0x51d7e7[_0x8abe('0x33')]=_[_0x8abe('0x48')](db['Team'][_0x8abe('0x30')]);_0x51d7e7['query']=_['keys'](_0x202a12[_0x8abe('0x34')]);_0x51d7e7['filters']=_['intersection'](_0x51d7e7['model'],_0x51d7e7['query']);_0x4005bf[_0x8abe('0x37')]=_['intersection'](_0x51d7e7[_0x8abe('0x33')],qs[_0x8abe('0x38')](_0x202a12[_0x8abe('0x34')]['fields']));_0x4005bf[_0x8abe('0x37')]=_0x4005bf[_0x8abe('0x37')]['length']?_0x4005bf[_0x8abe('0x37')]:_0x51d7e7['model'];if(_0x202a12[_0x8abe('0x34')]['includeAll']){_0x4005bf[_0x8abe('0x43')]=[{'all':!![]}];}_0x4005bf=_[_0x8abe('0x41')]({},_0x4005bf,_0x202a12[_0x8abe('0x49')]);return db[_0x8abe('0x2f')][_0x8abe('0x4a')](_0x4005bf)[_0x8abe('0x25')](handleEntityNotFound(_0x469fe9,null))['then'](respondWithResult(_0x469fe9,null))[_0x8abe('0x45')](handleError(_0x469fe9,null));};exports[_0x8abe('0x4b')]=function(_0x490069,_0x472128){return db['Team']['create'](_0x490069[_0x8abe('0x4c')],{})[_0x8abe('0x25')](function(_0x70cabc){var _0x5c3946=_0x490069['user'][_0x8abe('0x27')]({'plain':!![]});if(!_0x5c3946)throw new Error(_0x8abe('0x4d'));if(_0x5c3946[_0x8abe('0x4e')]===_0x8abe('0x4f')){var _0x3068b9=_0x70cabc[_0x8abe('0x27')]({'plain':!![]});var _0x35edd8=_0x8abe('0x28');return db[_0x8abe('0x50')][_0x8abe('0x4a')]({'where':{'name':_0x35edd8,'userProfileId':_0x5c3946[_0x8abe('0x51')]},'raw':!![]})['then'](function(_0x1d35d2){if(_0x1d35d2&&_0x1d35d2[_0x8abe('0x52')]===0x0){return db['UserProfileResource'][_0x8abe('0x4b')]({'name':_0x3068b9[_0x8abe('0x2d')],'resourceId':_0x3068b9['id'],'type':_0x1d35d2[_0x8abe('0x2d')],'sectionId':_0x1d35d2['id']},{})[_0x8abe('0x25')](function(){return _0x70cabc;});}else{return _0x70cabc;}})['catch'](function(_0x39f1c6){logger['error'](_0x8abe('0x53'),_0x39f1c6);throw _0x39f1c6;});}return _0x70cabc;})[_0x8abe('0x25')](respondWithResult(_0x472128,0xc9))[_0x8abe('0x45')](handleError(_0x472128,null));};exports[_0x8abe('0x24')]=function(_0x59e399,_0xefc047){if(_0x59e399[_0x8abe('0x4c')]['id']){delete _0x59e399[_0x8abe('0x4c')]['id'];}return db[_0x8abe('0x2f')][_0x8abe('0x4a')]({'where':{'id':_0x59e399[_0x8abe('0x47')]['id']}})[_0x8abe('0x25')](handleEntityNotFound(_0xefc047,null))[_0x8abe('0x25')](saveUpdates(_0x59e399[_0x8abe('0x4c')],null))[_0x8abe('0x25')](respondWithResult(_0xefc047,null))[_0x8abe('0x45')](handleError(_0xefc047,null));};exports[_0x8abe('0x26')]=function(_0x52ed62,_0x3bcabc){return db[_0x8abe('0x2f')][_0x8abe('0x4a')]({'where':{'id':_0x52ed62[_0x8abe('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bcabc,null))['then'](removeEntity(_0x3bcabc,null))[_0x8abe('0x45')](handleError(_0x3bcabc,null));};exports[_0x8abe('0x54')]=function(_0x566941,_0x5b18dd,_0x112e67){return db[_0x8abe('0x2f')][_0x8abe('0x55')]({'where':{'id':_0x566941['params']['id']}})[_0x8abe('0x25')](handleEntityNotFound(_0x5b18dd,null))[_0x8abe('0x25')](function(_0x3cd910){if(!_0x566941[_0x8abe('0x34')][_0x8abe('0x56')]||!utils[_0x8abe('0x57')](_0x566941['query']['channel'])){throw new db['Sequelize'][(_0x8abe('0x58'))]('Unknown\x20channel');}var _0x16b034={};var _0x4fa1fc={};_0x4fa1fc[_0x8abe('0x33')]=_[_0x8abe('0x48')](db[_[_0x8abe('0x59')](_0x566941['query'][_0x8abe('0x56')][_0x8abe('0x5a')]())+_0x8abe('0x5b')]['rawAttributes']);_0x4fa1fc['query']=_[_0x8abe('0x48')](_0x566941[_0x8abe('0x34')]);_0x4fa1fc[_0x8abe('0x35')]=_[_0x8abe('0x36')](_0x4fa1fc['model'],_0x4fa1fc[_0x8abe('0x34')]);_0x16b034[_0x8abe('0x37')]=_[_0x8abe('0x36')](_0x4fa1fc[_0x8abe('0x33')],qs[_0x8abe('0x38')](_0x566941[_0x8abe('0x34')][_0x8abe('0x38')]));_0x16b034[_0x8abe('0x37')]=_0x16b034[_0x8abe('0x37')][_0x8abe('0x39')]?_0x16b034[_0x8abe('0x37')]:_0x4fa1fc[_0x8abe('0x33')];_0x16b034[_0x8abe('0x1e')]=qs[_0x8abe('0x1e')](_0x566941[_0x8abe('0x34')][_0x8abe('0x1e')]);_0x16b034[_0x8abe('0x1d')]=qs[_0x8abe('0x1d')](_0x566941['query'][_0x8abe('0x1d')]);_0x16b034[_0x8abe('0x3b')]=qs[_0x8abe('0x3c')](_0x566941[_0x8abe('0x34')][_0x8abe('0x3c')]);_0x16b034['where']=qs[_0x8abe('0x35')](_[_0x8abe('0x3d')](_0x566941[_0x8abe('0x34')],_0x4fa1fc[_0x8abe('0x35')]));_0x16b034=_['merge']({},_0x16b034,_0x566941[_0x8abe('0x49')]);return _0x3cd910[_0x8abe('0x27')+_['capitalize'](_0x566941[_0x8abe('0x34')][_0x8abe('0x56')][_0x8abe('0x5a')]())+_0x8abe('0x5c')](_0x16b034);})[_0x8abe('0x25')](respondWithResult(_0x5b18dd,null))[_0x8abe('0x45')](handleError(_0x5b18dd,null));};exports[_0x8abe('0x5d')]=function(_0x189c19,_0x260c48,_0x59c2dc){return db[_0x8abe('0x2f')][_0x8abe('0x55')]({'where':{'id':_0x189c19[_0x8abe('0x47')]['id']}})[_0x8abe('0x25')](function(_0x307fe9){if(_0x307fe9){if(!_0x189c19[_0x8abe('0x4c')]['channel']||!utils['isValidChannel'](_0x189c19[_0x8abe('0x4c')][_0x8abe('0x56')])){throw new db[(_0x8abe('0x5e'))][(_0x8abe('0x58'))](_0x8abe('0x5f'));}return _0x307fe9[_0x8abe('0x60')+_[_0x8abe('0x59')](_0x189c19[_0x8abe('0x4c')]['channel'][_0x8abe('0x5a')]())+_0x8abe('0x5c')](_0x189c19['body'][_0x8abe('0x61')]);}return null;})[_0x8abe('0x25')](handleEntityNotFound(_0x260c48,null))['then'](respondWithStatusCode(_0x260c48,null))[_0x8abe('0x45')](handleError(_0x260c48,null));};exports[_0x8abe('0x62')]=function(_0x4d4945,_0x47ecaf,_0x50c3b5){return db[_0x8abe('0x2f')][_0x8abe('0x55')]({'where':{'id':_0x4d4945['params']['id']}})['then'](function(_0x518918){if(_0x518918){if(!_0x4d4945[_0x8abe('0x34')]['channel']||!utils['isValidChannel'](_0x4d4945[_0x8abe('0x34')][_0x8abe('0x56')])){throw new db[(_0x8abe('0x5e'))][(_0x8abe('0x58'))](_0x8abe('0x5f'));}return _0x518918['remove'+_[_0x8abe('0x59')](_0x4d4945[_0x8abe('0x34')][_0x8abe('0x56')][_0x8abe('0x5a')]())+_0x8abe('0x5c')](_0x4d4945[_0x8abe('0x34')][_0x8abe('0x61')]);}return null;})[_0x8abe('0x25')](handleEntityNotFound(_0x47ecaf,null))[_0x8abe('0x25')](respondWithStatusCode(_0x47ecaf,null))[_0x8abe('0x45')](handleError(_0x47ecaf,null));};exports[_0x8abe('0x63')]=function(_0x19a07e,_0x75436f,_0x4859a0){return db['Team'][_0x8abe('0x4a')]({'where':{'id':_0x19a07e[_0x8abe('0x47')]['id']}})['then'](handleEntityNotFound(_0x75436f,null))[_0x8abe('0x25')](function(_0x4241f8){if(_0x4241f8){var _0x14d6c9=['Voice',_0x8abe('0x64'),'Mail',_0x8abe('0x65'),_0x8abe('0x66'),_0x8abe('0x67'),_0x8abe('0x68')];return BPromise[_0x8abe('0x69')](_0x14d6c9,function(_0x65a15f){return _0x4241f8[_0x8abe('0x27')+_0x65a15f+'Queues']({'attributes':['id','name']})['then'](function(_0x23f991){return BPromise[_0x8abe('0x69')](_0x23f991,function(_0x2a5289){return _0x2a5289[_0x8abe('0x63')](_0x19a07e[_0x8abe('0x4c')][_0x8abe('0x61')])[_0x8abe('0x25')](function(){if(_0x65a15f==='Voice'){return db['User'][_0x8abe('0x6a')]({'where':{'id':_0x19a07e[_0x8abe('0x4c')]['ids']},'attributes':['id',_0x8abe('0x2d'),_0x8abe('0x6b'),_0x8abe('0x6c'),_0x8abe('0x6d')],'raw':!![]})[_0x8abe('0x25')](function(_0x353aa3){return BPromise[_0x8abe('0x69')](_[_0x8abe('0x40')](_0x353aa3,{'online':0x1}),function(_0x569843){return db['UserVoiceQueueRt'][_0x8abe('0x6e')]({'membername':_0x569843[_0x8abe('0x2d')],'UserId':_0x569843['id'],'queue_name':_0x2a5289['name'],'VoiceQueueId':_0x2a5289['id'],'interface':_[_0x8abe('0x6f')](_0x569843['interface'])?util[_0x8abe('0x70')](_0x8abe('0x71'),_0x569843[_0x8abe('0x2d')]):_0x569843[_0x8abe('0x6d')],'paused':_0x569843[_0x8abe('0x6c')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x4241f8;});})['then'](function(){return _0x4241f8;});}})['then'](function(_0x5d1078){if(_0x5d1078){return _0x5d1078[_0x8abe('0x63')](_0x19a07e['body'][_0x8abe('0x61')],_[_0x8abe('0x72')](_0x19a07e[_0x8abe('0x4c')],[_0x8abe('0x61'),'id'])||{})[_0x8abe('0x73')](function(_0x33cf92){for(var _0x18a6ac=0x0;_0x18a6ac<_0x19a07e[_0x8abe('0x4c')]['ids'][_0x8abe('0x39')];_0x18a6ac+=0x1){socket[_0x8abe('0x74')](_0x8abe('0x75'),{'UserId':_0x19a07e['body'][_0x8abe('0x61')][_0x18a6ac],'TeamId':_0x19a07e[_0x8abe('0x47')]['id']});}return _0x33cf92;});}})['then'](respondWithResult(_0x75436f,null))[_0x8abe('0x45')](handleError(_0x75436f,null));};exports['removeAgents']=function(_0x19bdf4,_0x12a968,_0x4499fa){return db[_0x8abe('0x2f')][_0x8abe('0x4a')]({'where':{'id':_0x19bdf4[_0x8abe('0x47')]['id']}})['then'](handleEntityNotFound(_0x12a968,null))['then'](function(_0x44097c){if(_0x44097c){return BPromise[_0x8abe('0x69')]([_0x8abe('0x76'),'chat',_0x8abe('0x77'),_0x8abe('0x78'),_0x8abe('0x79'),_0x8abe('0x7a'),_0x8abe('0x7b')],function(_0xdf05d3){return _0x44097c[_0x8abe('0x27')+_['capitalize'](_0xdf05d3)+_0x8abe('0x5c')]({'attributes':['id',_0x8abe('0x2d')]})[_0x8abe('0x25')](function(_0x8bad71){return BPromise['each'](_0x8bad71,function(_0x6600b0){return _0x6600b0[_0x8abe('0x7c')](_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')])['then'](function(){if(_0xdf05d3===_0x8abe('0x76')){return db['UserVoiceQueueRt'][_0x8abe('0x26')]({'where':{'VoiceQueueId':_0x6600b0['id'],'UserId':_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')]}});}});});})['then'](function(){return _0x44097c;});})[_0x8abe('0x25')](function(){return _0x44097c;});}})[_0x8abe('0x25')](function(_0x5e8948){if(_0x5e8948){return _0x5e8948['removeAgents'](_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')])[_0x8abe('0x25')](function(){if(_[_0x8abe('0x7d')](_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')])){for(var _0x308515=0x0;_0x308515<_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')][_0x8abe('0x39')];_0x308515+=0x1){socket['emit']('userTeam:remove',{'UserId':Number(_0x19bdf4['query']['ids'][_0x308515]),'TeamId':Number(_0x19bdf4[_0x8abe('0x47')]['id'])});}}else{socket[_0x8abe('0x74')](_0x8abe('0x7e'),{'UserId':Number(_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')]),'TeamId':Number(_0x19bdf4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x12a968,null))[_0x8abe('0x45')](handleError(_0x12a968,null));};exports['getAgents']=function(_0x36ceea,_0x332486,_0x18fae5){var _0x45deb9={};var _0xc8d1c7={};var _0x7a19a9;var _0x16a150;return db[_0x8abe('0x2f')][_0x8abe('0x55')]({'where':{'id':_0x36ceea[_0x8abe('0x47')]['id']}})[_0x8abe('0x25')](handleEntityNotFound(_0x332486,null))['then'](function(_0x58223d){if(_0x58223d){_0x7a19a9=_0x58223d;_0xc8d1c7['model']=_[_0x8abe('0x48')](db[_0x8abe('0x7f')]['rawAttributes']);_0xc8d1c7['query']=_[_0x8abe('0x48')](_0x36ceea[_0x8abe('0x34')]);_0xc8d1c7['filters']=_['intersection'](_0xc8d1c7['model'],_0xc8d1c7['query']);_0x45deb9[_0x8abe('0x37')]=_['intersection'](_0xc8d1c7[_0x8abe('0x33')],qs[_0x8abe('0x38')](_0x36ceea['query'][_0x8abe('0x38')]));_0x45deb9['attributes']=_0x45deb9[_0x8abe('0x37')][_0x8abe('0x39')]?_0x45deb9[_0x8abe('0x37')]:_0xc8d1c7[_0x8abe('0x33')];_0x45deb9[_0x8abe('0x3b')]=qs[_0x8abe('0x3c')](_0x36ceea[_0x8abe('0x34')][_0x8abe('0x3c')]);_0x45deb9[_0x8abe('0x3e')]=qs[_0x8abe('0x35')](_[_0x8abe('0x3d')](_0x36ceea[_0x8abe('0x34')],_0xc8d1c7[_0x8abe('0x35')]));if(_0x36ceea[_0x8abe('0x34')]['filter']){_0x45deb9[_0x8abe('0x3e')]=_[_0x8abe('0x41')](_0x45deb9[_0x8abe('0x3e')],{'$or':_['map'](_0x45deb9['attributes'],function(_0x48b6c0){var _0x3117d4={};_0x3117d4[_0x48b6c0]={'$like':'%'+_0x36ceea[_0x8abe('0x34')][_0x8abe('0x40')]+'%'};return _0x3117d4;})});}_0x45deb9=_[_0x8abe('0x41')]({},_0x45deb9,_0x36ceea[_0x8abe('0x49')]);return _0x7a19a9[_0x8abe('0x80')](_0x45deb9);}})['then'](function(_0x14bbdf){if(_0x14bbdf){_0x16a150=_0x14bbdf[_0x8abe('0x39')];if(!_0x36ceea[_0x8abe('0x34')][_0x8abe('0x81')](_0x8abe('0x3a'))){_0x45deb9[_0x8abe('0x1e')]=qs[_0x8abe('0x1e')](_0x36ceea[_0x8abe('0x34')]['limit']);_0x45deb9[_0x8abe('0x1d')]=qs['offset'](_0x36ceea[_0x8abe('0x34')][_0x8abe('0x1d')]);}return _0x7a19a9[_0x8abe('0x80')](_0x45deb9);}})[_0x8abe('0x25')](function(_0x2948f9){if(_0x2948f9){return _0x2948f9?{'count':_0x16a150,'rows':_0x2948f9}:null;}})[_0x8abe('0x25')](respondWithResult(_0x332486,null))[_0x8abe('0x45')](handleError(_0x332486,null));}; \ No newline at end of file +var _0x32cd=['getAgents','pick','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Teams','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','type','VIRTUAL','options','include','Team','findAll','rows','show','params','keys','includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Openchannel','Whatsapp','each','User','online','voicePause','filter','UserVoiceQueueRt','isNil','interface','format','SIP/%s','omit','spread','emit','removeAgents','voice','chat','mail','sms','fax','openchannel','whatsapp','userTeam:remove'];(function(_0x25980c,_0x188482){var _0x453695=function(_0x2851ee){while(--_0x2851ee){_0x25980c['push'](_0x25980c['shift']());}};_0x453695(++_0x188482);}(_0x32cd,0x89));var _0xd32c=function(_0x32376b,_0x8afd6f){_0x32376b=_0x32376b-0x0;var _0xb1371e=_0x32cd[_0x32376b];return _0xb1371e;};'use strict';var pdf=require(_0xd32c('0x0'));var emlformat=require(_0xd32c('0x1'));var rimraf=require(_0xd32c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd32c('0x3'));var rp=require(_0xd32c('0x4'));var moment=require(_0xd32c('0x5'));var BPromise=require(_0xd32c('0x6'));var Mustache=require(_0xd32c('0x7'));var util=require(_0xd32c('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd32c('0x9'));var fs=require('fs');var _=require(_0xd32c('0xa'));var squel=require(_0xd32c('0xb'));var crypto=require('crypto');var jsforce=require(_0xd32c('0xc'));var deskjs=require(_0xd32c('0xd'));var toCsv=require(_0xd32c('0xe'));var querystring=require(_0xd32c('0xf'));var Papa=require('papaparse');var Redis=require(_0xd32c('0x10'));var authService=require(_0xd32c('0x11'));var qs=require(_0xd32c('0x12'));var as=require(_0xd32c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd32c('0x14'));var utils=require(_0xd32c('0x15'));var config=require(_0xd32c('0x16'));var db=require(_0xd32c('0x17'))['db'];config[_0xd32c('0x18')]=_['defaults'](config[_0xd32c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd32c('0x19'))(new Redis(config[_0xd32c('0x18')]));require(_0xd32c('0x1a'))[_0xd32c('0x1b')](socket);function respondWithStatusCode(_0x2bd531,_0x4346e6){_0x4346e6=_0x4346e6||0xcc;return function(_0x5dc571){if(_0x5dc571){return _0x2bd531[_0xd32c('0x1c')](_0x4346e6);}return _0x2bd531[_0xd32c('0x1d')](_0x4346e6)[_0xd32c('0x1e')]();};}function respondWithResult(_0x3ae13e,_0x1ed1a9){_0x1ed1a9=_0x1ed1a9||0xc8;return function(_0x490585){if(_0x490585){return _0x3ae13e[_0xd32c('0x1d')](_0x1ed1a9)[_0xd32c('0x1f')](_0x490585);}};}function respondWithFilteredResult(_0x2cbbb6,_0x2e1b9c){return function(_0x559acd){if(_0x559acd){var _0xbb462a=_0x559acd[_0xd32c('0x20')],_0x56faa9=_0x2e1b9c[_0xd32c('0x21')],_0x949983=_0x2e1b9c[_0xd32c('0x21')]+_0x2e1b9c[_0xd32c('0x22')],_0x2ef543;if(_0x949983>=_0xbb462a){_0x949983=_0xbb462a;_0x2ef543=0xc8;}else{_0x2ef543=0xce;}_0x2cbbb6['status'](_0x2ef543);return _0x2cbbb6[_0xd32c('0x23')](_0xd32c('0x24'),_0x56faa9+'-'+_0x949983+'/'+_0xbb462a)[_0xd32c('0x1f')](_0x559acd);}return null;};}function patchUpdates(_0x49c30d){return function(_0x488e33){try{jsonpatch[_0xd32c('0x25')](_0x488e33,_0x49c30d,!![]);}catch(_0x2da50a){return BPromise[_0xd32c('0x26')](_0x2da50a);}return _0x488e33[_0xd32c('0x27')]();};}function saveUpdates(_0x52ed47,_0x8aa402){return function(_0x31c501){if(_0x31c501){return _0x31c501[_0xd32c('0x28')](_0x52ed47)[_0xd32c('0x29')](function(_0x19293a){return _0x19293a;});}return null;};}function removeEntity(_0xf385cd,_0x47bcd7){return function(_0xd091d){if(_0xd091d){return _0xd091d[_0xd32c('0x2a')]()[_0xd32c('0x29')](function(){var _0x4b2d84=_0xd091d['get']({'plain':!![]});var _0x770547=_0xd32c('0x2b');return db[_0xd32c('0x2c')][_0xd32c('0x2a')]({'where':{'type':_0x770547,'resourceId':_0x4b2d84['id']}})[_0xd32c('0x29')](function(){return _0xd091d;});})[_0xd32c('0x29')](function(){_0xf385cd[_0xd32c('0x1d')](0xcc)[_0xd32c('0x1e')]();});}};}function handleEntityNotFound(_0x1bc89d,_0x33e8d1){return function(_0x2f6314){if(!_0x2f6314){_0x1bc89d[_0xd32c('0x1c')](0x194);}return _0x2f6314;};}function handleError(_0x42fbef,_0x5a02c8){_0x5a02c8=_0x5a02c8||0x1f4;return function(_0x37e9a9){logger['error'](_0x37e9a9[_0xd32c('0x2d')]);if(_0x37e9a9[_0xd32c('0x2e')]){delete _0x37e9a9[_0xd32c('0x2e')];}_0x42fbef['status'](_0x5a02c8)['send'](_0x37e9a9);};}exports[_0xd32c('0x2f')]=function(_0xcee075,_0x5cd404){var _0x2813aa={},_0x381910={},_0x4dafa2={'count':0x0,'rows':[]};var _0x2cd802=_[_0xd32c('0x30')](db['Team'][_0xd32c('0x31')],function(_0x3ae5f8){return{'name':_0x3ae5f8[_0xd32c('0x32')],'type':_0x3ae5f8['type'][_0xd32c('0x33')]};});_0x381910[_0xd32c('0x34')]=_[_0xd32c('0x30')](_0x2cd802,'name');_0x381910[_0xd32c('0x35')]=_['keys'](_0xcee075[_0xd32c('0x35')]);_0x381910[_0xd32c('0x36')]=_[_0xd32c('0x37')](_0x381910[_0xd32c('0x34')],_0x381910[_0xd32c('0x35')]);_0x2813aa['attributes']=_[_0xd32c('0x37')](_0x381910[_0xd32c('0x34')],qs[_0xd32c('0x38')](_0xcee075[_0xd32c('0x35')][_0xd32c('0x38')]));_0x2813aa[_0xd32c('0x39')]=_0x2813aa[_0xd32c('0x39')][_0xd32c('0x3a')]?_0x2813aa[_0xd32c('0x39')]:_0x381910[_0xd32c('0x34')];if(!_0xcee075[_0xd32c('0x35')]['hasOwnProperty'](_0xd32c('0x3b'))){_0x2813aa[_0xd32c('0x22')]=qs[_0xd32c('0x22')](_0xcee075[_0xd32c('0x35')]['limit']);_0x2813aa[_0xd32c('0x21')]=qs[_0xd32c('0x21')](_0xcee075['query'][_0xd32c('0x21')]);}_0x2813aa[_0xd32c('0x3c')]=qs[_0xd32c('0x3d')](_0xcee075[_0xd32c('0x35')][_0xd32c('0x3d')]);_0x2813aa[_0xd32c('0x3e')]=qs[_0xd32c('0x36')](_['pick'](_0xcee075[_0xd32c('0x35')],_0x381910[_0xd32c('0x36')]),_0x2cd802);if(_0xcee075[_0xd32c('0x35')]['filter']){_0x2813aa['where']=_['merge'](_0x2813aa[_0xd32c('0x3e')],{'$or':_['map'](_0x2cd802,function(_0x4540f4){if(_0x4540f4[_0xd32c('0x3f')]!==_0xd32c('0x40')){var _0x785f76={};_0x785f76[_0x4540f4['name']]={'$like':'%'+_0xcee075[_0xd32c('0x35')]['filter']+'%'};return _0x785f76;}})});}_0x2813aa=_['merge']({},_0x2813aa,_0xcee075[_0xd32c('0x41')]);var _0x167c5a={'where':_0x2813aa[_0xd32c('0x3e')]};return db['Team'][_0xd32c('0x20')](_0x167c5a)['then'](function(_0x303fb9){_0x4dafa2[_0xd32c('0x20')]=_0x303fb9;if(_0xcee075[_0xd32c('0x35')]['includeAll']){_0x2813aa[_0xd32c('0x42')]=[{'all':!![]}];}return db[_0xd32c('0x43')][_0xd32c('0x44')](_0x2813aa);})[_0xd32c('0x29')](function(_0x18fe5b){_0x4dafa2[_0xd32c('0x45')]=_0x18fe5b;return _0x4dafa2;})[_0xd32c('0x29')](respondWithFilteredResult(_0x5cd404,_0x2813aa))['catch'](handleError(_0x5cd404,null));};exports[_0xd32c('0x46')]=function(_0x575ca5,_0x478a65){var _0x20a1a3={'raw':![],'where':{'id':_0x575ca5[_0xd32c('0x47')]['id']}},_0x56ab83={};_0x56ab83[_0xd32c('0x34')]=_[_0xd32c('0x48')](db['Team']['rawAttributes']);_0x56ab83[_0xd32c('0x35')]=_[_0xd32c('0x48')](_0x575ca5[_0xd32c('0x35')]);_0x56ab83[_0xd32c('0x36')]=_[_0xd32c('0x37')](_0x56ab83[_0xd32c('0x34')],_0x56ab83[_0xd32c('0x35')]);_0x20a1a3[_0xd32c('0x39')]=_['intersection'](_0x56ab83[_0xd32c('0x34')],qs['fields'](_0x575ca5[_0xd32c('0x35')]['fields']));_0x20a1a3[_0xd32c('0x39')]=_0x20a1a3[_0xd32c('0x39')][_0xd32c('0x3a')]?_0x20a1a3[_0xd32c('0x39')]:_0x56ab83[_0xd32c('0x34')];if(_0x575ca5[_0xd32c('0x35')][_0xd32c('0x49')]){_0x20a1a3[_0xd32c('0x42')]=[{'all':!![]}];}_0x20a1a3=_[_0xd32c('0x4a')]({},_0x20a1a3,_0x575ca5[_0xd32c('0x41')]);return db[_0xd32c('0x43')][_0xd32c('0x4b')](_0x20a1a3)[_0xd32c('0x29')](handleEntityNotFound(_0x478a65,null))[_0xd32c('0x29')](respondWithResult(_0x478a65,null))['catch'](handleError(_0x478a65,null));};exports[_0xd32c('0x4c')]=function(_0x41ffdd,_0x1fa722){return db['Team']['create'](_0x41ffdd[_0xd32c('0x4d')],{})[_0xd32c('0x29')](function(_0x140b9e){var _0x434dce=_0x41ffdd[_0xd32c('0x4e')][_0xd32c('0x4f')]({'plain':!![]});if(!_0x434dce)throw new Error(_0xd32c('0x50'));if(_0x434dce[_0xd32c('0x51')]===_0xd32c('0x4e')){var _0x1ccb3d=_0x140b9e[_0xd32c('0x4f')]({'plain':!![]});var _0x527703=_0xd32c('0x2b');return db[_0xd32c('0x52')][_0xd32c('0x4b')]({'where':{'name':_0x527703,'userProfileId':_0x434dce[_0xd32c('0x53')]},'raw':!![]})[_0xd32c('0x29')](function(_0x3b2080){if(_0x3b2080&&_0x3b2080[_0xd32c('0x54')]===0x0){return db[_0xd32c('0x2c')][_0xd32c('0x4c')]({'name':_0x1ccb3d[_0xd32c('0x2e')],'resourceId':_0x1ccb3d['id'],'type':_0x3b2080[_0xd32c('0x2e')],'sectionId':_0x3b2080['id']},{})[_0xd32c('0x29')](function(){return _0x140b9e;});}else{return _0x140b9e;}})[_0xd32c('0x55')](function(_0x3e3e19){logger[_0xd32c('0x56')](_0xd32c('0x57'),_0x3e3e19);throw _0x3e3e19;});}return _0x140b9e;})[_0xd32c('0x29')](respondWithResult(_0x1fa722,0xc9))[_0xd32c('0x55')](handleError(_0x1fa722,null));};exports['update']=function(_0x5a6e69,_0xca290d){if(_0x5a6e69[_0xd32c('0x4d')]['id']){delete _0x5a6e69[_0xd32c('0x4d')]['id'];}return db[_0xd32c('0x43')][_0xd32c('0x4b')]({'where':{'id':_0x5a6e69[_0xd32c('0x47')]['id']}})[_0xd32c('0x29')](handleEntityNotFound(_0xca290d,null))['then'](saveUpdates(_0x5a6e69[_0xd32c('0x4d')],null))['then'](respondWithResult(_0xca290d,null))[_0xd32c('0x55')](handleError(_0xca290d,null));};exports['destroy']=function(_0xf1edd9,_0x485917){return db[_0xd32c('0x43')]['find']({'where':{'id':_0xf1edd9['params']['id']}})[_0xd32c('0x29')](handleEntityNotFound(_0x485917,null))[_0xd32c('0x29')](removeEntity(_0x485917,null))[_0xd32c('0x55')](handleError(_0x485917,null));};exports['getQueues']=function(_0x4fbd66,_0x22d22c,_0x1db8bc){return db['Team'][_0xd32c('0x58')]({'where':{'id':_0x4fbd66[_0xd32c('0x47')]['id']}})['then'](handleEntityNotFound(_0x22d22c,null))[_0xd32c('0x29')](function(_0x5e9e99){if(!_0x4fbd66['query'][_0xd32c('0x59')]||!utils[_0xd32c('0x5a')](_0x4fbd66['query']['channel'])){throw new db[(_0xd32c('0x5b'))][(_0xd32c('0x5c'))](_0xd32c('0x5d'));}var _0x4bfc7d={};var _0x96bc95={};_0x96bc95[_0xd32c('0x34')]=_[_0xd32c('0x48')](db[_[_0xd32c('0x5e')](_0x4fbd66['query'][_0xd32c('0x59')][_0xd32c('0x5f')]())+_0xd32c('0x60')][_0xd32c('0x31')]);_0x96bc95[_0xd32c('0x35')]=_[_0xd32c('0x48')](_0x4fbd66[_0xd32c('0x35')]);_0x96bc95[_0xd32c('0x36')]=_[_0xd32c('0x37')](_0x96bc95[_0xd32c('0x34')],_0x96bc95[_0xd32c('0x35')]);_0x4bfc7d[_0xd32c('0x39')]=_[_0xd32c('0x37')](_0x96bc95[_0xd32c('0x34')],qs[_0xd32c('0x38')](_0x4fbd66[_0xd32c('0x35')][_0xd32c('0x38')]));_0x4bfc7d[_0xd32c('0x39')]=_0x4bfc7d[_0xd32c('0x39')][_0xd32c('0x3a')]?_0x4bfc7d[_0xd32c('0x39')]:_0x96bc95[_0xd32c('0x34')];_0x4bfc7d[_0xd32c('0x22')]=qs['limit'](_0x4fbd66[_0xd32c('0x35')]['limit']);_0x4bfc7d[_0xd32c('0x21')]=qs[_0xd32c('0x21')](_0x4fbd66[_0xd32c('0x35')][_0xd32c('0x21')]);_0x4bfc7d[_0xd32c('0x3c')]=qs['sort'](_0x4fbd66[_0xd32c('0x35')][_0xd32c('0x3d')]);_0x4bfc7d[_0xd32c('0x3e')]=qs[_0xd32c('0x36')](_['pick'](_0x4fbd66[_0xd32c('0x35')],_0x96bc95['filters']));_0x4bfc7d=_[_0xd32c('0x4a')]({},_0x4bfc7d,_0x4fbd66[_0xd32c('0x41')]);return _0x5e9e99[_0xd32c('0x4f')+_['capitalize'](_0x4fbd66[_0xd32c('0x35')][_0xd32c('0x59')][_0xd32c('0x5f')]())+'Queues'](_0x4bfc7d);})['then'](respondWithResult(_0x22d22c,null))['catch'](handleError(_0x22d22c,null));};exports[_0xd32c('0x61')]=function(_0xacffba,_0x1f491a,_0x378ccf){return db[_0xd32c('0x43')][_0xd32c('0x58')]({'where':{'id':_0xacffba['params']['id']}})[_0xd32c('0x29')](function(_0x3ae773){if(_0x3ae773){if(!_0xacffba[_0xd32c('0x4d')][_0xd32c('0x59')]||!utils[_0xd32c('0x5a')](_0xacffba[_0xd32c('0x4d')][_0xd32c('0x59')])){throw new db[(_0xd32c('0x5b'))][(_0xd32c('0x5c'))](_0xd32c('0x5d'));}return _0x3ae773[_0xd32c('0x62')+_[_0xd32c('0x5e')](_0xacffba[_0xd32c('0x4d')][_0xd32c('0x59')]['toLowerCase']())+_0xd32c('0x63')](_0xacffba['body'][_0xd32c('0x64')]);}return null;})[_0xd32c('0x29')](handleEntityNotFound(_0x1f491a,null))['then'](respondWithStatusCode(_0x1f491a,null))[_0xd32c('0x55')](handleError(_0x1f491a,null));};exports[_0xd32c('0x65')]=function(_0x3a5a1d,_0x30246d,_0x79f37c){return db[_0xd32c('0x43')]['findOne']({'where':{'id':_0x3a5a1d[_0xd32c('0x47')]['id']}})[_0xd32c('0x29')](function(_0x80397d){if(_0x80397d){if(!_0x3a5a1d['query'][_0xd32c('0x59')]||!utils[_0xd32c('0x5a')](_0x3a5a1d['query']['channel'])){throw new db['Sequelize'][(_0xd32c('0x5c'))](_0xd32c('0x5d'));}return _0x80397d[_0xd32c('0x66')+_[_0xd32c('0x5e')](_0x3a5a1d[_0xd32c('0x35')][_0xd32c('0x59')][_0xd32c('0x5f')]())+_0xd32c('0x63')](_0x3a5a1d[_0xd32c('0x35')][_0xd32c('0x64')]);}return null;})[_0xd32c('0x29')](handleEntityNotFound(_0x30246d,null))[_0xd32c('0x29')](respondWithStatusCode(_0x30246d,null))[_0xd32c('0x55')](handleError(_0x30246d,null));};exports[_0xd32c('0x67')]=function(_0x11cb38,_0x399d53,_0x41eabe){return db[_0xd32c('0x43')]['find']({'where':{'id':_0x11cb38[_0xd32c('0x47')]['id']}})['then'](handleEntityNotFound(_0x399d53,null))['then'](function(_0x394c08){if(_0x394c08){var _0x24b057=[_0xd32c('0x68'),_0xd32c('0x69'),_0xd32c('0x6a'),'Sms','Fax',_0xd32c('0x6b'),_0xd32c('0x6c')];return BPromise['each'](_0x24b057,function(_0x59f649){return _0x394c08[_0xd32c('0x4f')+_0x59f649+_0xd32c('0x63')]({'attributes':['id',_0xd32c('0x2e')]})[_0xd32c('0x29')](function(_0x24cdc0){return BPromise[_0xd32c('0x6d')](_0x24cdc0,function(_0x1491dc){return _0x1491dc[_0xd32c('0x67')](_0x11cb38['body'][_0xd32c('0x64')])[_0xd32c('0x29')](function(){if(_0x59f649==='Voice'){return db[_0xd32c('0x6e')][_0xd32c('0x44')]({'where':{'id':_0x11cb38[_0xd32c('0x4d')][_0xd32c('0x64')]},'attributes':['id','name',_0xd32c('0x6f'),_0xd32c('0x70'),'interface'],'raw':!![]})[_0xd32c('0x29')](function(_0x355bc0){return BPromise[_0xd32c('0x6d')](_[_0xd32c('0x71')](_0x355bc0,{'online':0x1}),function(_0x5b3324){return db[_0xd32c('0x72')]['upsert']({'membername':_0x5b3324[_0xd32c('0x2e')],'UserId':_0x5b3324['id'],'queue_name':_0x1491dc[_0xd32c('0x2e')],'VoiceQueueId':_0x1491dc['id'],'interface':_[_0xd32c('0x73')](_0x5b3324[_0xd32c('0x74')])?util[_0xd32c('0x75')](_0xd32c('0x76'),_0x5b3324[_0xd32c('0x2e')]):_0x5b3324[_0xd32c('0x74')],'paused':_0x5b3324[_0xd32c('0x70')]||![],'penalty':0x0});});});}});});})[_0xd32c('0x29')](function(){return _0x394c08;});})['then'](function(){return _0x394c08;});}})[_0xd32c('0x29')](function(_0xdf89ed){if(_0xdf89ed){return _0xdf89ed[_0xd32c('0x67')](_0x11cb38[_0xd32c('0x4d')]['ids'],_[_0xd32c('0x77')](_0x11cb38[_0xd32c('0x4d')],[_0xd32c('0x64'),'id'])||{})[_0xd32c('0x78')](function(_0x5d4e96){for(var _0x557ff1=0x0;_0x557ff1<_0x11cb38[_0xd32c('0x4d')][_0xd32c('0x64')][_0xd32c('0x3a')];_0x557ff1+=0x1){socket[_0xd32c('0x79')]('userTeam:save',{'UserId':_0x11cb38[_0xd32c('0x4d')]['ids'][_0x557ff1],'TeamId':_0x11cb38[_0xd32c('0x47')]['id']});}return _0x5d4e96;});}})[_0xd32c('0x29')](respondWithResult(_0x399d53,null))['catch'](handleError(_0x399d53,null));};exports[_0xd32c('0x7a')]=function(_0x469f33,_0x34370a,_0x20ccfb){return db[_0xd32c('0x43')][_0xd32c('0x4b')]({'where':{'id':_0x469f33['params']['id']}})[_0xd32c('0x29')](handleEntityNotFound(_0x34370a,null))['then'](function(_0x149181){if(_0x149181){return BPromise[_0xd32c('0x6d')]([_0xd32c('0x7b'),_0xd32c('0x7c'),_0xd32c('0x7d'),_0xd32c('0x7e'),_0xd32c('0x7f'),_0xd32c('0x80'),_0xd32c('0x81')],function(_0x6c62a6){return _0x149181[_0xd32c('0x4f')+_[_0xd32c('0x5e')](_0x6c62a6)+_0xd32c('0x63')]({'attributes':['id',_0xd32c('0x2e')]})[_0xd32c('0x29')](function(_0x870ad){return BPromise[_0xd32c('0x6d')](_0x870ad,function(_0x1c31c5){return _0x1c31c5['removeAgents'](_0x469f33[_0xd32c('0x35')]['ids'])['then'](function(){if(_0x6c62a6===_0xd32c('0x7b')){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x1c31c5['id'],'UserId':_0x469f33[_0xd32c('0x35')][_0xd32c('0x64')]}});}});});})[_0xd32c('0x29')](function(){return _0x149181;});})[_0xd32c('0x29')](function(){return _0x149181;});}})[_0xd32c('0x29')](function(_0x2434cb){if(_0x2434cb){return _0x2434cb['removeAgents'](_0x469f33['query'][_0xd32c('0x64')])[_0xd32c('0x29')](function(){if(_['isArray'](_0x469f33[_0xd32c('0x35')]['ids'])){for(var _0x539a05=0x0;_0x539a05<_0x469f33[_0xd32c('0x35')]['ids'][_0xd32c('0x3a')];_0x539a05+=0x1){socket[_0xd32c('0x79')](_0xd32c('0x82'),{'UserId':Number(_0x469f33[_0xd32c('0x35')][_0xd32c('0x64')][_0x539a05]),'TeamId':Number(_0x469f33[_0xd32c('0x47')]['id'])});}}else{socket[_0xd32c('0x79')]('userTeam:remove',{'UserId':Number(_0x469f33['query'][_0xd32c('0x64')]),'TeamId':Number(_0x469f33[_0xd32c('0x47')]['id'])});}});}})[_0xd32c('0x29')](respondWithStatusCode(_0x34370a,null))[_0xd32c('0x55')](handleError(_0x34370a,null));};exports[_0xd32c('0x83')]=function(_0x68a5f4,_0x10adfa,_0x577b3e){var _0x53bc76={};var _0x15f39d={};var _0x189f76;var _0x1b2de8;return db['Team'][_0xd32c('0x58')]({'where':{'id':_0x68a5f4['params']['id']}})[_0xd32c('0x29')](handleEntityNotFound(_0x10adfa,null))['then'](function(_0x297fd3){if(_0x297fd3){_0x189f76=_0x297fd3;_0x15f39d[_0xd32c('0x34')]=_[_0xd32c('0x48')](db[_0xd32c('0x6e')][_0xd32c('0x31')]);_0x15f39d[_0xd32c('0x35')]=_[_0xd32c('0x48')](_0x68a5f4[_0xd32c('0x35')]);_0x15f39d[_0xd32c('0x36')]=_[_0xd32c('0x37')](_0x15f39d[_0xd32c('0x34')],_0x15f39d[_0xd32c('0x35')]);_0x53bc76[_0xd32c('0x39')]=_[_0xd32c('0x37')](_0x15f39d['model'],qs[_0xd32c('0x38')](_0x68a5f4[_0xd32c('0x35')][_0xd32c('0x38')]));_0x53bc76['attributes']=_0x53bc76[_0xd32c('0x39')][_0xd32c('0x3a')]?_0x53bc76[_0xd32c('0x39')]:_0x15f39d[_0xd32c('0x34')];_0x53bc76[_0xd32c('0x3c')]=qs[_0xd32c('0x3d')](_0x68a5f4[_0xd32c('0x35')][_0xd32c('0x3d')]);_0x53bc76['where']=qs['filters'](_[_0xd32c('0x84')](_0x68a5f4[_0xd32c('0x35')],_0x15f39d['filters']));if(_0x68a5f4[_0xd32c('0x35')]['filter']){_0x53bc76[_0xd32c('0x3e')]=_[_0xd32c('0x4a')](_0x53bc76['where'],{'$or':_[_0xd32c('0x30')](_0x53bc76[_0xd32c('0x39')],function(_0x3d88f5){var _0x2fb71c={};_0x2fb71c[_0x3d88f5]={'$like':'%'+_0x68a5f4[_0xd32c('0x35')]['filter']+'%'};return _0x2fb71c;})});}_0x53bc76=_['merge']({},_0x53bc76,_0x68a5f4[_0xd32c('0x41')]);return _0x189f76[_0xd32c('0x83')](_0x53bc76);}})[_0xd32c('0x29')](function(_0x39b711){if(_0x39b711){_0x1b2de8=_0x39b711['length'];if(!_0x68a5f4[_0xd32c('0x35')][_0xd32c('0x85')](_0xd32c('0x3b'))){_0x53bc76['limit']=qs[_0xd32c('0x22')](_0x68a5f4['query'][_0xd32c('0x22')]);_0x53bc76[_0xd32c('0x21')]=qs[_0xd32c('0x21')](_0x68a5f4[_0xd32c('0x35')][_0xd32c('0x21')]);}return _0x189f76[_0xd32c('0x83')](_0x53bc76);}})[_0xd32c('0x29')](function(_0x474fba){if(_0x474fba){return _0x474fba?{'count':_0x1b2de8,'rows':_0x474fba}:null;}})[_0xd32c('0x29')](respondWithResult(_0x10adfa,null))[_0xd32c('0x55')](handleError(_0x10adfa,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6bf323f..266f369 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 _0x24dd=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x2f003f,_0x45d36f){var _0x38442a=function(_0x3f1ca0){while(--_0x3f1ca0){_0x2f003f['push'](_0x2f003f['shift']());}};_0x38442a(++_0x45d36f);}(_0x24dd,0x97));var _0xd24d=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x24dd[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require(_0xd24d('0x0'));var Team=require(_0xd24d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xd24d('0x2')](0x0);var events={'afterCreate':_0xd24d('0x3'),'afterUpdate':'update','afterDestroy':_0xd24d('0x4')};function emitEvent(_0x18d6f4){return function(_0x10a60b,_0x10bc7d,_0x372495){TeamEvents[_0xd24d('0x5')](_0x18d6f4+':'+_0x10a60b['id'],_0x10a60b);TeamEvents[_0xd24d('0x5')](_0x18d6f4,_0x10a60b);_0x372495(null);};}for(var e in events){if(events[_0xd24d('0x6')](e)){var event=events[e];Team[_0xd24d('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x95e0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x28f1c9,_0x24934e){var _0x36567d=function(_0x1404bb){while(--_0x1404bb){_0x28f1c9['push'](_0x28f1c9['shift']());}};_0x36567d(++_0x24934e);}(_0x95e0,0xa6));var _0x095e=function(_0xca355e,_0x414d18){_0xca355e=_0xca355e-0x0;var _0x35114d=_0x95e0[_0xca355e];return _0x35114d;};'use strict';var EventEmitter=require(_0x095e('0x0'));var Team=require(_0x095e('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x095e('0x2'),'afterUpdate':_0x095e('0x3'),'afterDestroy':_0x095e('0x4')};function emitEvent(_0x44e198){return function(_0x534f35,_0x3d1657,_0x170627){TeamEvents[_0x095e('0x5')](_0x44e198+':'+_0x534f35['id'],_0x534f35);TeamEvents[_0x095e('0x5')](_0x44e198,_0x534f35);_0x170627(null);};}for(var e in events){if(events[_0x095e('0x6')](e)){var event=events[e];Team[_0x095e('0x7')](e,emitEvent(event));}}module[_0x095e('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2deaac1..2b0c611 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 _0x14a7=['Team','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define'];(function(_0x513c93,_0x189225){var _0x1699cc=function(_0x33a425){while(--_0x33a425){_0x513c93['push'](_0x513c93['shift']());}};_0x1699cc(++_0x189225);}(_0x14a7,0x16d));var _0x714a=function(_0x5c4ba6,_0x11a3ff){_0x5c4ba6=_0x5c4ba6-0x0;var _0x5e1715=_0x14a7[_0x5c4ba6];return _0x5e1715;};'use strict';var _=require(_0x714a('0x0'));var util=require('util');var logger=require(_0x714a('0x1'))(_0x714a('0x2'));var moment=require(_0x714a('0x3'));var BPromise=require(_0x714a('0x4'));var rp=require(_0x714a('0x5'));var fs=require('fs');var path=require(_0x714a('0x6'));var rimraf=require(_0x714a('0x7'));var config=require(_0x714a('0x8'));var attributes=require(_0x714a('0x9'));module[_0x714a('0xa')]=function(_0x5d6733,_0xab7b57){return _0x5d6733[_0x714a('0xb')](_0x714a('0xc'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x518d=['define','lodash','util','moment','request-promise','path','./team.attributes','exports'];(function(_0x4b83f9,_0x5a8dc5){var _0x46c4d1=function(_0x2aeb1f){while(--_0x2aeb1f){_0x4b83f9['push'](_0x4b83f9['shift']());}};_0x46c4d1(++_0x5a8dc5);}(_0x518d,0x141));var _0xd518=function(_0x2d7892,_0x41e176){_0x2d7892=_0x2d7892-0x0;var _0x8ad21c=_0x518d[_0x2d7892];return _0x8ad21c;};'use strict';var _=require(_0xd518('0x0'));var util=require(_0xd518('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd518('0x2'));var BPromise=require('bluebird');var rp=require(_0xd518('0x3'));var fs=require('fs');var path=require(_0xd518('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd518('0x5'));module[_0xd518('0x6')]=function(_0x19c1e2,_0x40627c){return _0x19c1e2[_0xd518('0x7')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index a606105..def4542 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 _0x6c05=['info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./team.socket','register','then'];(function(_0x408e5f,_0x57d4b4){var _0x4405e6=function(_0x450962){while(--_0x450962){_0x408e5f['push'](_0x408e5f['shift']());}};_0x4405e6(++_0x57d4b4);}(_0x6c05,0x18e));var _0x56c0=function(_0xe19dcf,_0x248748){_0xe19dcf=_0xe19dcf-0x0;var _0x686aa8=_0x6c05[_0xe19dcf];return _0x686aa8;};'use strict';var _=require(_0x56c0('0x0'));var util=require(_0x56c0('0x1'));var moment=require(_0x56c0('0x2'));var BPromise=require(_0x56c0('0x3'));var rs=require(_0x56c0('0x4'));var fs=require('fs');var Redis=require(_0x56c0('0x5'));var db=require(_0x56c0('0x6'))['db'];var utils=require(_0x56c0('0x7'));var logger=require(_0x56c0('0x8'))('rpc');var config=require(_0x56c0('0x9'));var jayson=require(_0x56c0('0xa'));var client=jayson[_0x56c0('0xb')]['http']({'port':0x232a});config[_0x56c0('0xc')]=_[_0x56c0('0xd')](config[_0x56c0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x56c0('0xe'))(new Redis(config[_0x56c0('0xc')]));require(_0x56c0('0xf'))[_0x56c0('0x10')](socket);function respondWithRpcPromise(_0x4592ae,_0xb35602,_0x46d3c1){return new BPromise(function(_0x1efd41,_0x5800e6){return client['request'](_0x4592ae,_0x46d3c1)[_0x56c0('0x11')](function(_0x3ff4d4){logger[_0x56c0('0x12')](_0x56c0('0x13'),_0xb35602,_0x56c0('0x14'));logger['debug'](_0x56c0('0x15'),_0xb35602,'request\x20sent',JSON['stringify'](_0x3ff4d4));if(_0x3ff4d4[_0x56c0('0x16')]){if(_0x3ff4d4['error'][_0x56c0('0x17')]===0x1f4){logger[_0x56c0('0x16')](_0x56c0('0x13'),_0xb35602,_0x3ff4d4[_0x56c0('0x16')][_0x56c0('0x18')]);return _0x5800e6(_0x3ff4d4['error']['message']);}logger[_0x56c0('0x16')](_0x56c0('0x13'),_0xb35602,_0x3ff4d4[_0x56c0('0x16')][_0x56c0('0x18')]);return _0x1efd41(_0x3ff4d4[_0x56c0('0x16')][_0x56c0('0x18')]);}else{logger[_0x56c0('0x12')](_0x56c0('0x13'),_0xb35602,_0x56c0('0x14'));_0x1efd41(_0x3ff4d4[_0x56c0('0x19')][_0x56c0('0x18')]);}})['catch'](function(_0x38724b){logger['error'](_0x56c0('0x13'),_0xb35602,_0x38724b);_0x5800e6(_0x38724b);});});} \ No newline at end of file +var _0x9462=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird'];(function(_0x108cdf,_0x4d7ad4){var _0x2ed007=function(_0x50f119){while(--_0x50f119){_0x108cdf['push'](_0x108cdf['shift']());}};_0x2ed007(++_0x4d7ad4);}(_0x9462,0x127));var _0x2946=function(_0x257dda,_0x3bbea5){_0x257dda=_0x257dda-0x0;var _0x3c77ab=_0x9462[_0x257dda];return _0x3c77ab;};'use strict';var _=require(_0x2946('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2946('0x1'));var rs=require(_0x2946('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2946('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2946('0x4'))(_0x2946('0x5'));var config=require(_0x2946('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2946('0x7')][_0x2946('0x8')]({'port':0x232a});config[_0x2946('0x9')]=_[_0x2946('0xa')](config[_0x2946('0x9')],{'host':_0x2946('0xb'),'port':0x18eb});var socket=require(_0x2946('0xc'))(new Redis(config[_0x2946('0x9')]));require(_0x2946('0xd'))[_0x2946('0xe')](socket);function respondWithRpcPromise(_0x518bd8,_0x10150c,_0x1c282e){return new BPromise(function(_0x583a5a,_0x2605a4){return client[_0x2946('0xf')](_0x518bd8,_0x1c282e)[_0x2946('0x10')](function(_0x4d7cf9){logger['info'](_0x2946('0x11'),_0x10150c,_0x2946('0x12'));logger[_0x2946('0x13')](_0x2946('0x14'),_0x10150c,_0x2946('0x12'),JSON[_0x2946('0x15')](_0x4d7cf9));if(_0x4d7cf9[_0x2946('0x16')]){if(_0x4d7cf9[_0x2946('0x16')][_0x2946('0x17')]===0x1f4){logger[_0x2946('0x16')](_0x2946('0x11'),_0x10150c,_0x4d7cf9[_0x2946('0x16')][_0x2946('0x18')]);return _0x2605a4(_0x4d7cf9[_0x2946('0x16')][_0x2946('0x18')]);}logger[_0x2946('0x16')](_0x2946('0x11'),_0x10150c,_0x4d7cf9[_0x2946('0x16')][_0x2946('0x18')]);return _0x583a5a(_0x4d7cf9[_0x2946('0x16')]['message']);}else{logger[_0x2946('0x19')]('Team,\x20%s,\x20%s',_0x10150c,_0x2946('0x12'));_0x583a5a(_0x4d7cf9['result']['message']);}})[_0x2946('0x1a')](function(_0x453bae){logger[_0x2946('0x16')]('Team,\x20%s,\x20%s',_0x10150c,_0x453bae);_0x2605a4(_0x453bae);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index bfeeef4..5037dac 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 _0x1115=['save','remove','update','emit','length','team:'];(function(_0x4cd4f5,_0x1b6ea6){var _0x37423d=function(_0x31a954){while(--_0x31a954){_0x4cd4f5['push'](_0x4cd4f5['shift']());}};_0x37423d(++_0x1b6ea6);}(_0x1115,0x1b6));var _0x5111=function(_0xed17a5,_0xfe43f6){_0xed17a5=_0xed17a5-0x0;var _0x45671e=_0x1115[_0xed17a5];return _0x45671e;};'use strict';var TeamEvents=require('./team.events');var events=[_0x5111('0x0'),_0x5111('0x1'),_0x5111('0x2')];function createListener(_0x20e2ee,_0x39a422){return function(_0x118ead){_0x39a422[_0x5111('0x3')](_0x20e2ee,_0x118ead);};}function removeListener(_0x2cd14a,_0xe7b51f){return function(){TeamEvents['removeListener'](_0x2cd14a,_0xe7b51f);};}exports['register']=function(_0x467c3a){for(var _0x115ba7=0x0,_0x50f0a3=events[_0x5111('0x4')];_0x115ba7<_0x50f0a3;_0x115ba7++){var _0x2d2777=events[_0x115ba7];var _0x54d5ae=createListener(_0x5111('0x5')+_0x2d2777,_0x467c3a);TeamEvents['on'](_0x2d2777,_0x54d5ae);}}; \ No newline at end of file +var _0x4672=['length','team:','./team.events','remove','update','emit','removeListener'];(function(_0x5852f3,_0x35dbb7){var _0x463142=function(_0x28c1eb){while(--_0x28c1eb){_0x5852f3['push'](_0x5852f3['shift']());}};_0x463142(++_0x35dbb7);}(_0x4672,0x18a));var _0x2467=function(_0xd71ff9,_0x36cd21){_0xd71ff9=_0xd71ff9-0x0;var _0x2834ef=_0x4672[_0xd71ff9];return _0x2834ef;};'use strict';var TeamEvents=require(_0x2467('0x0'));var events=['save',_0x2467('0x1'),_0x2467('0x2')];function createListener(_0x57972f,_0x3d4246){return function(_0x56aa2b){_0x3d4246[_0x2467('0x3')](_0x57972f,_0x56aa2b);};}function removeListener(_0x228e2f,_0x1368f7){return function(){TeamEvents[_0x2467('0x4')](_0x228e2f,_0x1368f7);};}exports['register']=function(_0x19e085){for(var _0x48674e=0x0,_0x741c4d=events[_0x2467('0x5')];_0x48674e<_0x741c4d;_0x48674e++){var _0x1e91f3=events[_0x48674e];var _0x19e43a=createListener(_0x2467('0x6')+_0x1e91f3,_0x19e085);TeamEvents['on'](_0x1e91f3,_0x19e43a);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 04e75ad..8703c1f 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 _0x5a2f=['post','create','put','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a2f,0xaa));var _0xf5a2=function(_0x160dc2,_0x7cc777){_0x160dc2=_0x160dc2-0x0;var _0x457e76=_0x5a2f[_0x160dc2];return _0x457e76;};'use strict';var multer=require('multer');var util=require(_0xf5a2('0x0'));var path=require('path');var timeout=require(_0xf5a2('0x1'));var express=require(_0xf5a2('0x2'));var router=express[_0xf5a2('0x3')]();var auth=require(_0xf5a2('0x4'));var interaction=require(_0xf5a2('0x5'));var config=require('../../config/environment');var controller=require(_0xf5a2('0x6'));router[_0xf5a2('0x7')]('/',auth[_0xf5a2('0x8')](),controller[_0xf5a2('0x9')]);router[_0xf5a2('0x7')]('/:id',auth[_0xf5a2('0x8')](),controller['show']);router[_0xf5a2('0xa')]('/',auth['isAuthenticated'](),controller[_0xf5a2('0xb')]);router[_0xf5a2('0xc')]('/:id',auth[_0xf5a2('0x8')](),controller[_0xf5a2('0xd')]);router[_0xf5a2('0xe')](_0xf5a2('0xf'),auth['isAuthenticated'](),controller[_0xf5a2('0x10')]);module[_0xf5a2('0x11')]=router; \ No newline at end of file +var _0x6aef=['get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x1e9980,_0x37fd4c){var _0x5921b8=function(_0x1c07b8){while(--_0x1c07b8){_0x1e9980['push'](_0x1e9980['shift']());}};_0x5921b8(++_0x37fd4c);}(_0x6aef,0x65));var _0xf6ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aef[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf6ae('0x0'));var path=require('path');var timeout=require(_0xf6ae('0x1'));var express=require(_0xf6ae('0x2'));var router=express['Router']();var auth=require(_0xf6ae('0x3'));var interaction=require(_0xf6ae('0x4'));var config=require(_0xf6ae('0x5'));var controller=require(_0xf6ae('0x6'));router[_0xf6ae('0x7')]('/',auth[_0xf6ae('0x8')](),controller[_0xf6ae('0x9')]);router[_0xf6ae('0x7')](_0xf6ae('0xa'),auth[_0xf6ae('0x8')](),controller[_0xf6ae('0xb')]);router[_0xf6ae('0xc')]('/',auth[_0xf6ae('0x8')](),controller['create']);router[_0xf6ae('0xd')]('/:id',auth[_0xf6ae('0x8')](),controller[_0xf6ae('0xe')]);router[_0xf6ae('0xf')](_0xf6ae('0xa'),auth[_0xf6ae('0x8')](),controller[_0xf6ae('0x10')]);module[_0xf6ae('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index ee2effd..9655c35 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 _0x7700=['STRING','sequelize','exports'];(function(_0x70e40,_0x95c147){var _0x1e9b98=function(_0xd23be6){while(--_0xd23be6){_0x70e40['push'](_0x70e40['shift']());}};_0x1e9b98(++_0x95c147);}(_0x7700,0x151));var _0x0770=function(_0x2b29ab,_0x201845){_0x2b29ab=_0x2b29ab-0x0;var _0x16e64b=_0x7700[_0x2b29ab];return _0x16e64b;};'use strict';var Sequelize=require(_0x0770('0x0'));module[_0x0770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0770('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa957=['exports','STRING','TEXT'];(function(_0x480470,_0x36f644){var _0x4360a0=function(_0x32a63f){while(--_0x32a63f){_0x480470['push'](_0x480470['shift']());}};_0x4360a0(++_0x36f644);}(_0xa957,0x111));var _0x7a95=function(_0x25681c,_0x34ec93){_0x25681c=_0x25681c-0x0;var _0x383a4a=_0xa957[_0x25681c];return _0x383a4a;};'use strict';var Sequelize=require('sequelize');module[_0x7a95('0x0')]={'name':{'type':Sequelize[_0x7a95('0x1')]},'description':{'type':Sequelize[_0x7a95('0x1')]},'html':{'type':Sequelize[_0x7a95('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index de22315..324c427 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 _0xb230=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Template','count','include','findAll','catch','show','params','includeAll','find','create','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','sendStatus','error','stack','send','index','rawAttributes','fieldName','type','key','map','name','query'];(function(_0x567bcb,_0x4978c1){var _0x4eebc2=function(_0x42a456){while(--_0x42a456){_0x567bcb['push'](_0x567bcb['shift']());}};_0x4eebc2(++_0x4978c1);}(_0xb230,0x14b));var _0x0b23=function(_0x246179,_0x4b378a){_0x246179=_0x246179-0x0;var _0x138aa9=_0xb230[_0x246179];return _0x138aa9;};'use strict';var pdf=require(_0x0b23('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0b23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b23('0x2'));var rp=require(_0x0b23('0x3'));var moment=require(_0x0b23('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0b23('0x5'));var path=require(_0x0b23('0x6'));var sox=require(_0x0b23('0x7'));var csv=require('to-csv');var ejs=require(_0x0b23('0x8'));var fs=require('fs');var _=require(_0x0b23('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0b23('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b23('0xb'));var Redis=require(_0x0b23('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b23('0xd'));var hardwareService=require(_0x0b23('0xe'));var logger=require(_0x0b23('0xf'))(_0x0b23('0x10'));var utils=require('../../config/utils');var config=require(_0x0b23('0x11'));var db=require(_0x0b23('0x12'))['db'];function respondWithStatusCode(_0x5df937,_0x3f0873){_0x3f0873=_0x3f0873||0xcc;return function(_0x278601){if(_0x278601){return _0x5df937['sendStatus'](_0x3f0873);}return _0x5df937[_0x0b23('0x13')](_0x3f0873)[_0x0b23('0x14')]();};}function respondWithResult(_0x7be17c,_0xa28864){_0xa28864=_0xa28864||0xc8;return function(_0x3199d2){if(_0x3199d2){return _0x7be17c[_0x0b23('0x13')](_0xa28864)[_0x0b23('0x15')](_0x3199d2);}};}function respondWithFilteredResult(_0x4a7b49,_0x3bec9b){return function(_0x4cd2d7){if(_0x4cd2d7){var _0x243243=_0x4cd2d7['count'],_0x46faec=_0x3bec9b[_0x0b23('0x16')],_0x42dc57=_0x3bec9b[_0x0b23('0x16')]+_0x3bec9b['limit'],_0x1c0418;if(_0x42dc57>=_0x243243){_0x42dc57=_0x243243;_0x1c0418=0xc8;}else{_0x1c0418=0xce;}_0x4a7b49[_0x0b23('0x13')](_0x1c0418);return _0x4a7b49['set']('Content-Range',_0x46faec+'-'+_0x42dc57+'/'+_0x243243)['json'](_0x4cd2d7);}return null;};}function patchUpdates(_0x4424d6){return function(_0x4d125a){try{jsonpatch[_0x0b23('0x17')](_0x4d125a,_0x4424d6,!![]);}catch(_0xe9350c){return BPromise[_0x0b23('0x18')](_0xe9350c);}return _0x4d125a[_0x0b23('0x19')]();};}function saveUpdates(_0x2495cc,_0xb176d0){return function(_0x45783c){if(_0x45783c){return _0x45783c[_0x0b23('0x1a')](_0x2495cc)['then'](function(_0x1328ce){return _0x1328ce;});}return null;};}function removeEntity(_0x5581a2,_0xa4bef1){return function(_0x1e7759){if(_0x1e7759){return _0x1e7759['destroy']()[_0x0b23('0x1b')](function(){var _0x590a3b=_0x1e7759[_0x0b23('0x1c')]({'plain':!![]});var _0x1b9900=_0x0b23('0x1d');return db[_0x0b23('0x1e')][_0x0b23('0x1f')]({'where':{'type':_0x1b9900,'resourceId':_0x590a3b['id']}})['then'](function(){return _0x1e7759;});})[_0x0b23('0x1b')](function(){_0x5581a2[_0x0b23('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1079fe,_0x55aac2){return function(_0x27599d){if(!_0x27599d){_0x1079fe[_0x0b23('0x20')](0x194);}return _0x27599d;};}function handleError(_0x9fba09,_0x5459bb){_0x5459bb=_0x5459bb||0x1f4;return function(_0x2f5006){logger[_0x0b23('0x21')](_0x2f5006[_0x0b23('0x22')]);if(_0x2f5006['name']){delete _0x2f5006['name'];}_0x9fba09['status'](_0x5459bb)[_0x0b23('0x23')](_0x2f5006);};}exports[_0x0b23('0x24')]=function(_0x548a12,_0x41ed46){var _0x3652cd={},_0x15367e={},_0xaa2bb6={'count':0x0,'rows':[]};var _0x1bace2=_['map'](db['Template'][_0x0b23('0x25')],function(_0x54e742){return{'name':_0x54e742[_0x0b23('0x26')],'type':_0x54e742[_0x0b23('0x27')][_0x0b23('0x28')]};});_0x15367e['model']=_[_0x0b23('0x29')](_0x1bace2,_0x0b23('0x2a'));_0x15367e[_0x0b23('0x2b')]=_[_0x0b23('0x2c')](_0x548a12[_0x0b23('0x2b')]);_0x15367e[_0x0b23('0x2d')]=_['intersection'](_0x15367e['model'],_0x15367e[_0x0b23('0x2b')]);_0x3652cd['attributes']=_[_0x0b23('0x2e')](_0x15367e[_0x0b23('0x2f')],qs[_0x0b23('0x30')](_0x548a12[_0x0b23('0x2b')][_0x0b23('0x30')]));_0x3652cd[_0x0b23('0x31')]=_0x3652cd[_0x0b23('0x31')][_0x0b23('0x32')]?_0x3652cd['attributes']:_0x15367e[_0x0b23('0x2f')];if(!_0x548a12[_0x0b23('0x2b')][_0x0b23('0x33')](_0x0b23('0x34'))){_0x3652cd[_0x0b23('0x35')]=qs[_0x0b23('0x35')](_0x548a12[_0x0b23('0x2b')][_0x0b23('0x35')]);_0x3652cd[_0x0b23('0x16')]=qs['offset'](_0x548a12[_0x0b23('0x2b')][_0x0b23('0x16')]);}_0x3652cd[_0x0b23('0x36')]=qs[_0x0b23('0x37')](_0x548a12[_0x0b23('0x2b')]['sort']);_0x3652cd[_0x0b23('0x38')]=qs[_0x0b23('0x2d')](_[_0x0b23('0x39')](_0x548a12[_0x0b23('0x2b')],_0x15367e[_0x0b23('0x2d')]),_0x1bace2);if(_0x548a12[_0x0b23('0x2b')][_0x0b23('0x3a')]){_0x3652cd['where']=_[_0x0b23('0x3b')](_0x3652cd[_0x0b23('0x38')],{'$or':_[_0x0b23('0x29')](_0x1bace2,function(_0x47bcac){if(_0x47bcac[_0x0b23('0x27')]!==_0x0b23('0x3c')){var _0x1eeae7={};_0x1eeae7[_0x47bcac['name']]={'$like':'%'+_0x548a12[_0x0b23('0x2b')][_0x0b23('0x3a')]+'%'};return _0x1eeae7;}})});}_0x3652cd=_[_0x0b23('0x3b')]({},_0x3652cd,_0x548a12[_0x0b23('0x3d')]);var _0x4aec8e={'where':_0x3652cd[_0x0b23('0x38')]};return db[_0x0b23('0x3e')][_0x0b23('0x3f')](_0x4aec8e)[_0x0b23('0x1b')](function(_0x15363c){_0xaa2bb6[_0x0b23('0x3f')]=_0x15363c;if(_0x548a12[_0x0b23('0x2b')]['includeAll']){_0x3652cd[_0x0b23('0x40')]=[{'all':!![]}];}return db[_0x0b23('0x3e')][_0x0b23('0x41')](_0x3652cd);})[_0x0b23('0x1b')](function(_0x57e5c9){_0xaa2bb6['rows']=_0x57e5c9;return _0xaa2bb6;})['then'](respondWithFilteredResult(_0x41ed46,_0x3652cd))[_0x0b23('0x42')](handleError(_0x41ed46,null));};exports[_0x0b23('0x43')]=function(_0x57e77f,_0x529914){var _0x4e4706={'raw':!![],'where':{'id':_0x57e77f[_0x0b23('0x44')]['id']}},_0x5c86a8={};_0x5c86a8[_0x0b23('0x2f')]=_[_0x0b23('0x2c')](db[_0x0b23('0x3e')][_0x0b23('0x25')]);_0x5c86a8[_0x0b23('0x2b')]=_[_0x0b23('0x2c')](_0x57e77f[_0x0b23('0x2b')]);_0x5c86a8[_0x0b23('0x2d')]=_['intersection'](_0x5c86a8[_0x0b23('0x2f')],_0x5c86a8[_0x0b23('0x2b')]);_0x4e4706[_0x0b23('0x31')]=_[_0x0b23('0x2e')](_0x5c86a8[_0x0b23('0x2f')],qs['fields'](_0x57e77f[_0x0b23('0x2b')][_0x0b23('0x30')]));_0x4e4706['attributes']=_0x4e4706[_0x0b23('0x31')][_0x0b23('0x32')]?_0x4e4706['attributes']:_0x5c86a8[_0x0b23('0x2f')];if(_0x57e77f[_0x0b23('0x2b')][_0x0b23('0x45')]){_0x4e4706[_0x0b23('0x40')]=[{'all':!![]}];}_0x4e4706=_[_0x0b23('0x3b')]({},_0x4e4706,_0x57e77f[_0x0b23('0x3d')]);return db[_0x0b23('0x3e')][_0x0b23('0x46')](_0x4e4706)[_0x0b23('0x1b')](handleEntityNotFound(_0x529914,null))[_0x0b23('0x1b')](respondWithResult(_0x529914,null))[_0x0b23('0x42')](handleError(_0x529914,null));};exports[_0x0b23('0x47')]=function(_0x46ae30,_0xc12109){return db[_0x0b23('0x3e')]['create'](_0x46ae30['body'],{})[_0x0b23('0x1b')](function(_0x4c3752){var _0xacc4ef=_0x46ae30[_0x0b23('0x48')][_0x0b23('0x1c')]({'plain':!![]});if(!_0xacc4ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xacc4ef['role']===_0x0b23('0x48')){var _0x4f5db4=_0x4c3752[_0x0b23('0x1c')]({'plain':!![]});var _0x10e11c=_0x0b23('0x1d');return db['UserProfileSection'][_0x0b23('0x46')]({'where':{'name':_0x10e11c,'userProfileId':_0xacc4ef['userProfileId']},'raw':!![]})[_0x0b23('0x1b')](function(_0x1a7640){if(_0x1a7640&&_0x1a7640['autoAssociation']===0x0){return db[_0x0b23('0x1e')][_0x0b23('0x47')]({'name':_0x4f5db4[_0x0b23('0x2a')],'resourceId':_0x4f5db4['id'],'type':_0x1a7640[_0x0b23('0x2a')],'sectionId':_0x1a7640['id']},{})[_0x0b23('0x1b')](function(){return _0x4c3752;});}else{return _0x4c3752;}})[_0x0b23('0x42')](function(_0x13ec59){logger[_0x0b23('0x21')](_0x0b23('0x49'),_0x13ec59);throw _0x13ec59;});}return _0x4c3752;})['then'](respondWithResult(_0xc12109,0xc9))[_0x0b23('0x42')](handleError(_0xc12109,null));};exports['update']=function(_0x124be6,_0x219d98){if(_0x124be6['body']['id']){delete _0x124be6[_0x0b23('0x4a')]['id'];}return db[_0x0b23('0x3e')][_0x0b23('0x46')]({'where':{'id':_0x124be6[_0x0b23('0x44')]['id']}})[_0x0b23('0x1b')](handleEntityNotFound(_0x219d98,null))['then'](saveUpdates(_0x124be6[_0x0b23('0x4a')],null))[_0x0b23('0x1b')](respondWithResult(_0x219d98,null))[_0x0b23('0x42')](handleError(_0x219d98,null));};exports['destroy']=function(_0x30bc37,_0x2391bb){return db[_0x0b23('0x3e')][_0x0b23('0x46')]({'where':{'id':_0x30bc37[_0x0b23('0x44')]['id']}})[_0x0b23('0x1b')](handleEntityNotFound(_0x2391bb,null))[_0x0b23('0x1b')](removeEntity(_0x2391bb,null))[_0x0b23('0x42')](handleError(_0x2391bb,null));}; \ No newline at end of file +var _0x0c40=['Content-Range','apply','save','update','then','destroy','Templates','UserProfileResource','error','stack','name','send','index','map','Template','type','model','query','intersection','attributes','fields','nolimit','limit','order','sort','filters','pick','filter','merge','VIRTUAL','where','findAll','catch','show','keys','rawAttributes','includeAll','include','body','user','get','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','end','status','count','offset'];(function(_0x511e52,_0x3990f0){var _0x168590=function(_0x4fa1b2){while(--_0x4fa1b2){_0x511e52['push'](_0x511e52['shift']());}};_0x168590(++_0x3990f0);}(_0x0c40,0x10e));var _0x00c4=function(_0x48ecd2,_0x481ad3){_0x48ecd2=_0x48ecd2-0x0;var _0x5a4457=_0x0c40[_0x48ecd2];return _0x5a4457;};'use strict';var pdf=require(_0x00c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x00c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00c4('0x2'));var rp=require(_0x00c4('0x3'));var moment=require(_0x00c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x00c4('0x5'));var util=require(_0x00c4('0x6'));var path=require('path');var sox=require(_0x00c4('0x7'));var csv=require(_0x00c4('0x8'));var ejs=require(_0x00c4('0x9'));var fs=require('fs');var _=require(_0x00c4('0xa'));var squel=require(_0x00c4('0xb'));var crypto=require(_0x00c4('0xc'));var jsforce=require(_0x00c4('0xd'));var deskjs=require(_0x00c4('0xe'));var toCsv=require(_0x00c4('0x8'));var querystring=require('querystring');var Papa=require(_0x00c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x00c4('0x10'));var as=require(_0x00c4('0x11'));var hardwareService=require(_0x00c4('0x12'));var logger=require('../../config/logger')(_0x00c4('0x13'));var utils=require(_0x00c4('0x14'));var config=require(_0x00c4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cc0b8,_0x13c407){_0x13c407=_0x13c407||0xcc;return function(_0x113bd1){if(_0x113bd1){return _0x1cc0b8['sendStatus'](_0x13c407);}return _0x1cc0b8['status'](_0x13c407)[_0x00c4('0x16')]();};}function respondWithResult(_0x478ecb,_0x4172c3){_0x4172c3=_0x4172c3||0xc8;return function(_0x2c24b3){if(_0x2c24b3){return _0x478ecb[_0x00c4('0x17')](_0x4172c3)['json'](_0x2c24b3);}};}function respondWithFilteredResult(_0x3f1343,_0x3e9c1e){return function(_0x145b69){if(_0x145b69){var _0x2b73cc=_0x145b69[_0x00c4('0x18')],_0x2376b3=_0x3e9c1e[_0x00c4('0x19')],_0x254c99=_0x3e9c1e[_0x00c4('0x19')]+_0x3e9c1e['limit'],_0x27757d;if(_0x254c99>=_0x2b73cc){_0x254c99=_0x2b73cc;_0x27757d=0xc8;}else{_0x27757d=0xce;}_0x3f1343[_0x00c4('0x17')](_0x27757d);return _0x3f1343['set'](_0x00c4('0x1a'),_0x2376b3+'-'+_0x254c99+'/'+_0x2b73cc)['json'](_0x145b69);}return null;};}function patchUpdates(_0x48183f){return function(_0x446dc5){try{jsonpatch[_0x00c4('0x1b')](_0x446dc5,_0x48183f,!![]);}catch(_0x5c7c93){return BPromise['reject'](_0x5c7c93);}return _0x446dc5[_0x00c4('0x1c')]();};}function saveUpdates(_0x5c900f,_0x5cb7e9){return function(_0x160b18){if(_0x160b18){return _0x160b18[_0x00c4('0x1d')](_0x5c900f)[_0x00c4('0x1e')](function(_0x557307){return _0x557307;});}return null;};}function removeEntity(_0x11536e,_0x4933e0){return function(_0x380a1e){if(_0x380a1e){return _0x380a1e[_0x00c4('0x1f')]()['then'](function(){var _0x1e8862=_0x380a1e['get']({'plain':!![]});var _0xf0a9a4=_0x00c4('0x20');return db[_0x00c4('0x21')][_0x00c4('0x1f')]({'where':{'type':_0xf0a9a4,'resourceId':_0x1e8862['id']}})[_0x00c4('0x1e')](function(){return _0x380a1e;});})[_0x00c4('0x1e')](function(){_0x11536e[_0x00c4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16fe78,_0x38b0c9){return function(_0x127018){if(!_0x127018){_0x16fe78['sendStatus'](0x194);}return _0x127018;};}function handleError(_0x2bddee,_0x1be000){_0x1be000=_0x1be000||0x1f4;return function(_0x4c6120){logger[_0x00c4('0x22')](_0x4c6120[_0x00c4('0x23')]);if(_0x4c6120[_0x00c4('0x24')]){delete _0x4c6120['name'];}_0x2bddee[_0x00c4('0x17')](_0x1be000)[_0x00c4('0x25')](_0x4c6120);};}exports[_0x00c4('0x26')]=function(_0x148f67,_0x248a3b){var _0x16a160={},_0x46e98b={},_0x2d65db={'count':0x0,'rows':[]};var _0x39b629=_[_0x00c4('0x27')](db[_0x00c4('0x28')]['rawAttributes'],function(_0x40e8c1){return{'name':_0x40e8c1['fieldName'],'type':_0x40e8c1[_0x00c4('0x29')]['key']};});_0x46e98b[_0x00c4('0x2a')]=_['map'](_0x39b629,_0x00c4('0x24'));_0x46e98b['query']=_['keys'](_0x148f67[_0x00c4('0x2b')]);_0x46e98b['filters']=_[_0x00c4('0x2c')](_0x46e98b[_0x00c4('0x2a')],_0x46e98b[_0x00c4('0x2b')]);_0x16a160[_0x00c4('0x2d')]=_[_0x00c4('0x2c')](_0x46e98b['model'],qs[_0x00c4('0x2e')](_0x148f67[_0x00c4('0x2b')][_0x00c4('0x2e')]));_0x16a160['attributes']=_0x16a160[_0x00c4('0x2d')]['length']?_0x16a160['attributes']:_0x46e98b[_0x00c4('0x2a')];if(!_0x148f67[_0x00c4('0x2b')]['hasOwnProperty'](_0x00c4('0x2f'))){_0x16a160[_0x00c4('0x30')]=qs['limit'](_0x148f67[_0x00c4('0x2b')][_0x00c4('0x30')]);_0x16a160[_0x00c4('0x19')]=qs[_0x00c4('0x19')](_0x148f67[_0x00c4('0x2b')][_0x00c4('0x19')]);}_0x16a160[_0x00c4('0x31')]=qs[_0x00c4('0x32')](_0x148f67['query']['sort']);_0x16a160['where']=qs[_0x00c4('0x33')](_[_0x00c4('0x34')](_0x148f67['query'],_0x46e98b[_0x00c4('0x33')]),_0x39b629);if(_0x148f67[_0x00c4('0x2b')][_0x00c4('0x35')]){_0x16a160['where']=_[_0x00c4('0x36')](_0x16a160['where'],{'$or':_[_0x00c4('0x27')](_0x39b629,function(_0x18bd19){if(_0x18bd19[_0x00c4('0x29')]!==_0x00c4('0x37')){var _0x290b51={};_0x290b51[_0x18bd19[_0x00c4('0x24')]]={'$like':'%'+_0x148f67[_0x00c4('0x2b')][_0x00c4('0x35')]+'%'};return _0x290b51;}})});}_0x16a160=_['merge']({},_0x16a160,_0x148f67['options']);var _0x2737bc={'where':_0x16a160[_0x00c4('0x38')]};return db[_0x00c4('0x28')][_0x00c4('0x18')](_0x2737bc)['then'](function(_0x1fa3e0){_0x2d65db[_0x00c4('0x18')]=_0x1fa3e0;if(_0x148f67[_0x00c4('0x2b')]['includeAll']){_0x16a160['include']=[{'all':!![]}];}return db['Template'][_0x00c4('0x39')](_0x16a160);})[_0x00c4('0x1e')](function(_0x1a97ab){_0x2d65db['rows']=_0x1a97ab;return _0x2d65db;})['then'](respondWithFilteredResult(_0x248a3b,_0x16a160))[_0x00c4('0x3a')](handleError(_0x248a3b,null));};exports[_0x00c4('0x3b')]=function(_0x132da2,_0x3bdbfb){var _0xa69629={'raw':!![],'where':{'id':_0x132da2['params']['id']}},_0x6ff7d3={};_0x6ff7d3['model']=_[_0x00c4('0x3c')](db[_0x00c4('0x28')][_0x00c4('0x3d')]);_0x6ff7d3['query']=_[_0x00c4('0x3c')](_0x132da2[_0x00c4('0x2b')]);_0x6ff7d3[_0x00c4('0x33')]=_['intersection'](_0x6ff7d3[_0x00c4('0x2a')],_0x6ff7d3[_0x00c4('0x2b')]);_0xa69629[_0x00c4('0x2d')]=_['intersection'](_0x6ff7d3[_0x00c4('0x2a')],qs[_0x00c4('0x2e')](_0x132da2[_0x00c4('0x2b')]['fields']));_0xa69629[_0x00c4('0x2d')]=_0xa69629['attributes']['length']?_0xa69629[_0x00c4('0x2d')]:_0x6ff7d3['model'];if(_0x132da2[_0x00c4('0x2b')][_0x00c4('0x3e')]){_0xa69629[_0x00c4('0x3f')]=[{'all':!![]}];}_0xa69629=_[_0x00c4('0x36')]({},_0xa69629,_0x132da2['options']);return db['Template']['find'](_0xa69629)[_0x00c4('0x1e')](handleEntityNotFound(_0x3bdbfb,null))[_0x00c4('0x1e')](respondWithResult(_0x3bdbfb,null))['catch'](handleError(_0x3bdbfb,null));};exports['create']=function(_0x493400,_0x1f7b7b){return db['Template']['create'](_0x493400[_0x00c4('0x40')],{})[_0x00c4('0x1e')](function(_0x363d82){var _0x1676c8=_0x493400[_0x00c4('0x41')]['get']({'plain':!![]});if(!_0x1676c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1676c8['role']===_0x00c4('0x41')){var _0x2f7761=_0x363d82[_0x00c4('0x42')]({'plain':!![]});var _0x58a295='Templates';return db[_0x00c4('0x43')]['find']({'where':{'name':_0x58a295,'userProfileId':_0x1676c8[_0x00c4('0x44')]},'raw':!![]})['then'](function(_0x54c81b){if(_0x54c81b&&_0x54c81b[_0x00c4('0x45')]===0x0){return db[_0x00c4('0x21')][_0x00c4('0x46')]({'name':_0x2f7761['name'],'resourceId':_0x2f7761['id'],'type':_0x54c81b[_0x00c4('0x24')],'sectionId':_0x54c81b['id']},{})[_0x00c4('0x1e')](function(){return _0x363d82;});}else{return _0x363d82;}})[_0x00c4('0x3a')](function(_0x20a235){logger[_0x00c4('0x22')](_0x00c4('0x47'),_0x20a235);throw _0x20a235;});}return _0x363d82;})['then'](respondWithResult(_0x1f7b7b,0xc9))['catch'](handleError(_0x1f7b7b,null));};exports[_0x00c4('0x1d')]=function(_0x5cd19b,_0xab4b13){if(_0x5cd19b[_0x00c4('0x40')]['id']){delete _0x5cd19b[_0x00c4('0x40')]['id'];}return db[_0x00c4('0x28')][_0x00c4('0x48')]({'where':{'id':_0x5cd19b[_0x00c4('0x49')]['id']}})[_0x00c4('0x1e')](handleEntityNotFound(_0xab4b13,null))[_0x00c4('0x1e')](saveUpdates(_0x5cd19b[_0x00c4('0x40')],null))[_0x00c4('0x1e')](respondWithResult(_0xab4b13,null))[_0x00c4('0x3a')](handleError(_0xab4b13,null));};exports[_0x00c4('0x1f')]=function(_0x1e5ec2,_0x16c133){return db[_0x00c4('0x28')]['find']({'where':{'id':_0x1e5ec2[_0x00c4('0x49')]['id']}})[_0x00c4('0x1e')](handleEntityNotFound(_0x16c133,null))[_0x00c4('0x1e')](removeEntity(_0x16c133,null))[_0x00c4('0x3a')](handleError(_0x16c133,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9450f05..e126d88 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 _0x74bd=['exports','define','Template','tools_templates','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./template.attributes'];(function(_0x2413b6,_0x3c1379){var _0x30791f=function(_0x2c3bb0){while(--_0x2c3bb0){_0x2413b6['push'](_0x2413b6['shift']());}};_0x30791f(++_0x3c1379);}(_0x74bd,0xdc));var _0xd74b=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0x74bd[_0x5e4b85];return _0x5cd3cb;};'use strict';var _=require(_0xd74b('0x0'));var util=require('util');var logger=require(_0xd74b('0x1'))(_0xd74b('0x2'));var moment=require(_0xd74b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd74b('0x4'));var rimraf=require(_0xd74b('0x5'));var config=require(_0xd74b('0x6'));var attributes=require(_0xd74b('0x7'));module[_0xd74b('0x8')]=function(_0x3ce21a,_0x1726d3){return _0x3ce21a[_0xd74b('0x9')](_0xd74b('0xa'),attributes,{'tableName':_0xd74b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc748=['rimraf','./template.attributes','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3086e3,_0x42bab4){var _0x46369a=function(_0x17c8c6){while(--_0x17c8c6){_0x3086e3['push'](_0x3086e3['shift']());}};_0x46369a(++_0x42bab4);}(_0xc748,0x13a));var _0x8c74=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xc748[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require(_0x8c74('0x0'));var logger=require(_0x8c74('0x1'))(_0x8c74('0x2'));var moment=require(_0x8c74('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c74('0x4'));var fs=require('fs');var path=require(_0x8c74('0x5'));var rimraf=require(_0x8c74('0x6'));var config=require('../../config/environment');var attributes=require(_0x8c74('0x7'));module['exports']=function(_0x5ace59,_0x187800){return _0x5ace59['define']('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 7948dfa..957617c 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 _0x864b=['options','where','limit','include','map','model','attributes','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTemplate','findAll'];(function(_0x347ae9,_0x8979ce){var _0x401103=function(_0x14cea9){while(--_0x14cea9){_0x347ae9['push'](_0x347ae9['shift']());}};_0x401103(++_0x8979ce);}(_0x864b,0x91));var _0xb864=function(_0x53565a,_0x40648b){_0x53565a=_0x53565a-0x0;var _0x387936=_0x864b[_0x53565a];return _0x387936;};'use strict';var _=require(_0xb864('0x0'));var util=require(_0xb864('0x1'));var moment=require(_0xb864('0x2'));var BPromise=require(_0xb864('0x3'));var rs=require(_0xb864('0x4'));var fs=require('fs');var Redis=require(_0xb864('0x5'));var db=require(_0xb864('0x6'))['db'];var utils=require(_0xb864('0x7'));var logger=require(_0xb864('0x8'))('rpc');var config=require(_0xb864('0x9'));var jayson=require(_0xb864('0xa'));var client=jayson[_0xb864('0xb')][_0xb864('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31d22c,_0x3e8506,_0x2a6c99){return new BPromise(function(_0xa51fe8,_0x46954b){return client['request'](_0x31d22c,_0x2a6c99)['then'](function(_0x44c799){logger[_0xb864('0xd')](_0xb864('0xe'),_0x3e8506,'request\x20sent');logger[_0xb864('0xf')](_0xb864('0x10'),_0x3e8506,_0xb864('0x11'),JSON[_0xb864('0x12')](_0x44c799));if(_0x44c799[_0xb864('0x13')]){if(_0x44c799['error'][_0xb864('0x14')]===0x1f4){logger[_0xb864('0x13')](_0xb864('0xe'),_0x3e8506,_0x44c799[_0xb864('0x13')][_0xb864('0x15')]);return _0x46954b(_0x44c799['error'][_0xb864('0x15')]);}logger['error'](_0xb864('0xe'),_0x3e8506,_0x44c799[_0xb864('0x13')][_0xb864('0x15')]);return _0xa51fe8(_0x44c799[_0xb864('0x13')]['message']);}else{logger[_0xb864('0xd')](_0xb864('0xe'),_0x3e8506,'request\x20sent');_0xa51fe8(_0x44c799[_0xb864('0x16')][_0xb864('0x15')]);}})['catch'](function(_0x3704a1){logger[_0xb864('0x13')](_0xb864('0xe'),_0x3e8506,_0x3704a1);_0x46954b(_0x3704a1);});});}exports[_0xb864('0x17')]=function(_0x497db6){var _0x25bb10=this;return new Promise(function(_0x9bf066,_0x5cc5de){return db['Template'][_0xb864('0x18')]({'raw':_0x497db6['options']?_0x497db6[_0xb864('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x497db6[_0xb864('0x19')]?_0x497db6['options'][_0xb864('0x1a')]||null:null,'attributes':_0x497db6['options']?_0x497db6[_0xb864('0x19')]['attributes']||null:null,'limit':_0x497db6['options']?_0x497db6[_0xb864('0x19')][_0xb864('0x1b')]||null:null,'include':_0x497db6[_0xb864('0x19')]?_0x497db6['options'][_0xb864('0x1c')]?_[_0xb864('0x1d')](_0x497db6[_0xb864('0x19')]['include'],function(_0x1cc32f){return{'model':db[_0x1cc32f[_0xb864('0x1e')]],'as':_0x1cc32f['as'],'attributes':_0x1cc32f[_0xb864('0x1f')],'include':_0x1cc32f['include']?_[_0xb864('0x1d')](_0x1cc32f[_0xb864('0x1c')],function(_0xf8e197){return{'model':db[_0xf8e197[_0xb864('0x1e')]],'as':_0xf8e197['as'],'attributes':_0xf8e197[_0xb864('0x1f')],'include':_0xf8e197[_0xb864('0x1c')]?_[_0xb864('0x1d')](_0xf8e197['include'],function(_0x487e62){return{'model':db[_0x487e62['model']],'as':_0x487e62['as'],'attributes':_0x487e62[_0xb864('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb864('0x20')](function(_0x553591){logger[_0xb864('0xd')](_0xb864('0x17'),_0x497db6);logger['debug']('GetTemplate',_0x497db6,JSON['stringify'](_0x553591));_0x9bf066(_0x553591);})[_0xb864('0x21')](function(_0x2698ce){logger[_0xb864('0x13')](_0xb864('0x17'),_0x2698ce[_0xb864('0x15')],_0x497db6);_0x5cc5de(_0x25bb10['error'](0x1f4,_0x2698ce[_0xb864('0x15')]));});});}; \ No newline at end of file +var _0x7095=['error','Template,\x20%s,\x20%s','message','catch','options','include','map','model','attributes','info','GetTemplate','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7095,0xb3));var _0x5709=function(_0x22ae4f,_0x2837f6){_0x22ae4f=_0x22ae4f-0x0;var _0x27e200=_0x7095[_0x22ae4f];return _0x27e200;};'use strict';var _=require(_0x5709('0x0'));var util=require(_0x5709('0x1'));var moment=require('moment');var BPromise=require(_0x5709('0x2'));var rs=require(_0x5709('0x3'));var fs=require('fs');var Redis=require(_0x5709('0x4'));var db=require(_0x5709('0x5'))['db'];var utils=require(_0x5709('0x6'));var logger=require(_0x5709('0x7'))(_0x5709('0x8'));var config=require(_0x5709('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5709('0xa')][_0x5709('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfc627,_0x90e6c1,_0x56f635){return new BPromise(function(_0x24f551,_0x3ee5fb){return client[_0x5709('0xc')](_0xfc627,_0x56f635)[_0x5709('0xd')](function(_0x2fe3ba){logger['info']('Template,\x20%s,\x20%s',_0x90e6c1,_0x5709('0xe'));logger[_0x5709('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x90e6c1,'request\x20sent',JSON[_0x5709('0x10')](_0x2fe3ba));if(_0x2fe3ba[_0x5709('0x11')]){if(_0x2fe3ba['error']['code']===0x1f4){logger['error'](_0x5709('0x12'),_0x90e6c1,_0x2fe3ba['error'][_0x5709('0x13')]);return _0x3ee5fb(_0x2fe3ba[_0x5709('0x11')]['message']);}logger[_0x5709('0x11')](_0x5709('0x12'),_0x90e6c1,_0x2fe3ba[_0x5709('0x11')]['message']);return _0x24f551(_0x2fe3ba[_0x5709('0x11')][_0x5709('0x13')]);}else{logger['info'](_0x5709('0x12'),_0x90e6c1,_0x5709('0xe'));_0x24f551(_0x2fe3ba['result'][_0x5709('0x13')]);}})[_0x5709('0x14')](function(_0x453b54){logger[_0x5709('0x11')](_0x5709('0x12'),_0x90e6c1,_0x453b54);_0x3ee5fb(_0x453b54);});});}exports['GetTemplate']=function(_0x35d255){var _0x8b3974=this;return new Promise(function(_0x360493,_0x2d3eaa){return db['Template']['findAll']({'raw':_0x35d255[_0x5709('0x15')]?_0x35d255[_0x5709('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x35d255['options']?_0x35d255[_0x5709('0x15')]['where']||null:null,'attributes':_0x35d255[_0x5709('0x15')]?_0x35d255['options']['attributes']||null:null,'limit':_0x35d255[_0x5709('0x15')]?_0x35d255[_0x5709('0x15')]['limit']||null:null,'include':_0x35d255[_0x5709('0x15')]?_0x35d255['options'][_0x5709('0x16')]?_[_0x5709('0x17')](_0x35d255[_0x5709('0x15')][_0x5709('0x16')],function(_0x33f5bf){return{'model':db[_0x33f5bf[_0x5709('0x18')]],'as':_0x33f5bf['as'],'attributes':_0x33f5bf[_0x5709('0x19')],'include':_0x33f5bf[_0x5709('0x16')]?_[_0x5709('0x17')](_0x33f5bf[_0x5709('0x16')],function(_0x404296){return{'model':db[_0x404296['model']],'as':_0x404296['as'],'attributes':_0x404296[_0x5709('0x19')],'include':_0x404296['include']?_[_0x5709('0x17')](_0x404296[_0x5709('0x16')],function(_0x84fdd1){return{'model':db[_0x84fdd1[_0x5709('0x18')]],'as':_0x84fdd1['as'],'attributes':_0x84fdd1[_0x5709('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5709('0xd')](function(_0x1954f1){logger[_0x5709('0x1a')](_0x5709('0x1b'),_0x35d255);logger['debug'](_0x5709('0x1b'),_0x35d255,JSON[_0x5709('0x10')](_0x1954f1));_0x360493(_0x1954f1);})[_0x5709('0x14')](function(_0x3afa52){logger[_0x5709('0x11')](_0x5709('0x1b'),_0x3afa52[_0x5709('0x13')],_0x35d255);_0x2d3eaa(_0x8b3974[_0x5709('0x11')](0x1f4,_0x3afa52[_0x5709('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 493aeaa..11ecdcf 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 _0x715d=['../../config/environment','./trigger.controller','isAuthenticated','get','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x715d,0x18a));var _0xd715=function(_0x22f077,_0x4e99a4){_0x22f077=_0x22f077-0x0;var _0x3a92c=_0x715d[_0x22f077];return _0x3a92c;};'use strict';var multer=require(_0xd715('0x0'));var util=require(_0xd715('0x1'));var path=require('path');var timeout=require(_0xd715('0x2'));var express=require('express');var router=express[_0xd715('0x3')]();var auth=require(_0xd715('0x4'));var interaction=require(_0xd715('0x5'));var config=require(_0xd715('0x6'));var controller=require(_0xd715('0x7'));router['get']('/',auth[_0xd715('0x8')](),controller['index']);router[_0xd715('0x9')]('/:id',auth[_0xd715('0x8')](),controller['show']);router[_0xd715('0x9')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xd715('0xa')]);router[_0xd715('0x9')](_0xd715('0xb'),auth[_0xd715('0x8')](),controller[_0xd715('0xc')]);router[_0xd715('0x9')](_0xd715('0xd'),auth[_0xd715('0x8')](),controller[_0xd715('0xe')]);router[_0xd715('0xf')]('/',auth[_0xd715('0x8')](),controller['create']);router[_0xd715('0xf')]('/:id/all_conditions',auth[_0xd715('0x8')](),controller[_0xd715('0x10')]);router['post'](_0xd715('0xb'),auth[_0xd715('0x8')](),controller[_0xd715('0x11')]);router[_0xd715('0xf')]('/:id/actions',auth[_0xd715('0x8')](),controller[_0xd715('0x12')]);router[_0xd715('0x13')](_0xd715('0x14'),auth[_0xd715('0x8')](),controller[_0xd715('0x15')]);router[_0xd715('0x16')](_0xd715('0x14'),auth[_0xd715('0x8')](),controller[_0xd715('0x17')]);module[_0xd715('0x18')]=router; \ No newline at end of file +var _0xa2b9=['destroy','exports','multer','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAction','update','delete'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa2b9,0x8e));var _0x9a2b=function(_0x3966a3,_0x1fd1a2){_0x3966a3=_0x3966a3-0x0;var _0x482dc7=_0xa2b9[_0x3966a3];return _0x482dc7;};'use strict';var multer=require(_0x9a2b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9a2b('0x1'));var express=require(_0x9a2b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a2b('0x3'));var controller=require('./trigger.controller');router[_0x9a2b('0x4')]('/',auth[_0x9a2b('0x5')](),controller[_0x9a2b('0x6')]);router['get'](_0x9a2b('0x7'),auth[_0x9a2b('0x5')](),controller[_0x9a2b('0x8')]);router[_0x9a2b('0x4')](_0x9a2b('0x9'),auth[_0x9a2b('0x5')](),controller['getAllConditions']);router['get'](_0x9a2b('0xa'),auth[_0x9a2b('0x5')](),controller[_0x9a2b('0xb')]);router[_0x9a2b('0x4')](_0x9a2b('0xc'),auth[_0x9a2b('0x5')](),controller['getActions']);router['post']('/',auth[_0x9a2b('0x5')](),controller[_0x9a2b('0xd')]);router[_0x9a2b('0xe')]('/:id/all_conditions',auth[_0x9a2b('0x5')](),controller['addAllCondition']);router[_0x9a2b('0xe')](_0x9a2b('0xa'),auth[_0x9a2b('0x5')](),controller['addAnyCondition']);router[_0x9a2b('0xe')]('/:id/actions',auth[_0x9a2b('0x5')](),controller[_0x9a2b('0xf')]);router['put'](_0x9a2b('0x7'),auth['isAuthenticated'](),controller[_0x9a2b('0x10')]);router[_0x9a2b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9a2b('0x12')]);module[_0x9a2b('0x13')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index c1d0303..ea909c6 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 _0xba80=['STRING','sequelize','exports'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0xba80,0x1a8));var _0x0ba8=function(_0x207fd5,_0x417b97){_0x207fd5=_0x207fd5-0x0;var _0x5c06d8=_0xba80[_0x207fd5];return _0x5c06d8;};'use strict';var Sequelize=require(_0x0ba8('0x0'));module[_0x0ba8('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0ba8('0x2')]},'description':{'type':Sequelize[_0x0ba8('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x021a=['STRING','BOOLEAN','exports'];(function(_0x59c294,_0x546ef3){var _0x330ccf=function(_0xe41bd6){while(--_0xe41bd6){_0x59c294['push'](_0x59c294['shift']());}};_0x330ccf(++_0x546ef3);}(_0x021a,0x16d));var _0xa021=function(_0x2cdd4d,_0x394c2f){_0x2cdd4d=_0x2cdd4d-0x0;var _0x55cbc8=_0x021a[_0x2cdd4d];return _0x55cbc8;};'use strict';var Sequelize=require('sequelize');module[_0xa021('0x0')]={'name':{'type':Sequelize[_0xa021('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa021('0x1')]},'status':{'type':Sequelize[_0xa021('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index fd412ac..87bb848 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 _0xac5e=['api','../../config/environment','sendStatus','status','json','count','offset','limit','set','then','destroy','Triggers','UserProfileResource','end','stack','name','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','TriggerAllId','Condition','addAnyCondition','findOne','order','getAllConditions','getAnyConditions','addAction','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xac5e,0x97));var _0xeac5=function(_0x3966be,_0x58e253){_0x3966be=_0x3966be-0x0;var _0x35ca31=_0xac5e[_0x3966be];return _0x35ca31;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeac5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeac5('0x1'));var jsonpatch=require(_0xeac5('0x2'));var rp=require(_0xeac5('0x3'));var moment=require(_0xeac5('0x4'));var BPromise=require(_0xeac5('0x5'));var Mustache=require('mustache');var util=require(_0xeac5('0x6'));var path=require(_0xeac5('0x7'));var sox=require(_0xeac5('0x8'));var csv=require('to-csv');var ejs=require(_0xeac5('0x9'));var fs=require('fs');var _=require(_0xeac5('0xa'));var squel=require(_0xeac5('0xb'));var crypto=require(_0xeac5('0xc'));var jsforce=require(_0xeac5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeac5('0xe'));var querystring=require(_0xeac5('0xf'));var Papa=require('papaparse');var Redis=require(_0xeac5('0x10'));var authService=require(_0xeac5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeac5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeac5('0x13'));var utils=require('../../config/utils');var config=require(_0xeac5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59a7a7,_0x105de1){_0x105de1=_0x105de1||0xcc;return function(_0x3894fd){if(_0x3894fd){return _0x59a7a7[_0xeac5('0x15')](_0x105de1);}return _0x59a7a7[_0xeac5('0x16')](_0x105de1)['end']();};}function respondWithResult(_0x3ef412,_0x594d8c){_0x594d8c=_0x594d8c||0xc8;return function(_0x4f813b){if(_0x4f813b){return _0x3ef412['status'](_0x594d8c)[_0xeac5('0x17')](_0x4f813b);}};}function respondWithFilteredResult(_0xb71d65,_0x35f969){return function(_0x5ada30){if(_0x5ada30){var _0x47eff4=_0x5ada30[_0xeac5('0x18')],_0x3baac6=_0x35f969[_0xeac5('0x19')],_0x23ede6=_0x35f969[_0xeac5('0x19')]+_0x35f969[_0xeac5('0x1a')],_0xd580e7;if(_0x23ede6>=_0x47eff4){_0x23ede6=_0x47eff4;_0xd580e7=0xc8;}else{_0xd580e7=0xce;}_0xb71d65[_0xeac5('0x16')](_0xd580e7);return _0xb71d65[_0xeac5('0x1b')]('Content-Range',_0x3baac6+'-'+_0x23ede6+'/'+_0x47eff4)[_0xeac5('0x17')](_0x5ada30);}return null;};}function patchUpdates(_0x447855){return function(_0x36f265){try{jsonpatch['apply'](_0x36f265,_0x447855,!![]);}catch(_0x2fe430){return BPromise['reject'](_0x2fe430);}return _0x36f265['save']();};}function saveUpdates(_0x2a906c,_0x3c620e){return function(_0x1c4996){if(_0x1c4996){return _0x1c4996['update'](_0x2a906c)[_0xeac5('0x1c')](function(_0x7c7df3){return _0x7c7df3;});}return null;};}function removeEntity(_0x286da6,_0x50bf28){return function(_0xedd700){if(_0xedd700){return _0xedd700[_0xeac5('0x1d')]()['then'](function(){var _0xe840f8=_0xedd700['get']({'plain':!![]});var _0x114b67=_0xeac5('0x1e');return db[_0xeac5('0x1f')][_0xeac5('0x1d')]({'where':{'type':_0x114b67,'resourceId':_0xe840f8['id']}})[_0xeac5('0x1c')](function(){return _0xedd700;});})[_0xeac5('0x1c')](function(){_0x286da6[_0xeac5('0x16')](0xcc)[_0xeac5('0x20')]();});}};}function handleEntityNotFound(_0x64ca50,_0x329f18){return function(_0x4b5238){if(!_0x4b5238){_0x64ca50[_0xeac5('0x15')](0x194);}return _0x4b5238;};}function handleError(_0xa61d16,_0xd53daa){_0xd53daa=_0xd53daa||0x1f4;return function(_0x263f2c){logger['error'](_0x263f2c[_0xeac5('0x21')]);if(_0x263f2c[_0xeac5('0x22')]){delete _0x263f2c[_0xeac5('0x22')];}_0xa61d16[_0xeac5('0x16')](_0xd53daa)['send'](_0x263f2c);};}exports['index']=function(_0xb52b00,_0x520306){var _0x19cfff={},_0x2f435d={},_0x4b07ee={'count':0x0,'rows':[]};var _0x327714=_[_0xeac5('0x23')](db[_0xeac5('0x24')][_0xeac5('0x25')],function(_0x584d18){return{'name':_0x584d18[_0xeac5('0x26')],'type':_0x584d18[_0xeac5('0x27')][_0xeac5('0x28')]};});_0x2f435d[_0xeac5('0x29')]=_['map'](_0x327714,_0xeac5('0x22'));_0x2f435d[_0xeac5('0x2a')]=_[_0xeac5('0x2b')](_0xb52b00['query']);_0x2f435d[_0xeac5('0x2c')]=_[_0xeac5('0x2d')](_0x2f435d[_0xeac5('0x29')],_0x2f435d[_0xeac5('0x2a')]);_0x19cfff[_0xeac5('0x2e')]=_[_0xeac5('0x2d')](_0x2f435d[_0xeac5('0x29')],qs[_0xeac5('0x2f')](_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x2f')]));_0x19cfff[_0xeac5('0x2e')]=_0x19cfff[_0xeac5('0x2e')]['length']?_0x19cfff[_0xeac5('0x2e')]:_0x2f435d[_0xeac5('0x29')];if(!_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x30')](_0xeac5('0x31'))){_0x19cfff['limit']=qs[_0xeac5('0x1a')](_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x1a')]);_0x19cfff['offset']=qs['offset'](_0xb52b00['query'][_0xeac5('0x19')]);}_0x19cfff['order']=qs['sort'](_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x32')]);_0x19cfff[_0xeac5('0x33')]=qs['filters'](_[_0xeac5('0x34')](_0xb52b00['query'],_0x2f435d[_0xeac5('0x2c')]),_0x327714);if(_0xb52b00['query'][_0xeac5('0x35')]){_0x19cfff[_0xeac5('0x33')]=_[_0xeac5('0x36')](_0x19cfff[_0xeac5('0x33')],{'$or':_[_0xeac5('0x23')](_0x327714,function(_0x19d83b){if(_0x19d83b[_0xeac5('0x27')]!==_0xeac5('0x37')){var _0xd84471={};_0xd84471[_0x19d83b[_0xeac5('0x22')]]={'$like':'%'+_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x35')]+'%'};return _0xd84471;}})});}_0x19cfff=_['merge']({},_0x19cfff,_0xb52b00[_0xeac5('0x38')]);var _0x226d2a={'where':_0x19cfff[_0xeac5('0x33')]};return db[_0xeac5('0x24')][_0xeac5('0x18')](_0x226d2a)[_0xeac5('0x1c')](function(_0x5d31a1){_0x4b07ee[_0xeac5('0x18')]=_0x5d31a1;if(_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x39')]){_0x19cfff[_0xeac5('0x3a')]=[{'all':!![]}];}return db[_0xeac5('0x24')]['findAll'](_0x19cfff);})[_0xeac5('0x1c')](function(_0x3ce894){_0x4b07ee[_0xeac5('0x3b')]=_0x3ce894;return _0x4b07ee;})[_0xeac5('0x1c')](respondWithFilteredResult(_0x520306,_0x19cfff))[_0xeac5('0x3c')](handleError(_0x520306,null));};exports[_0xeac5('0x3d')]=function(_0xa104f4,_0x35d036){var _0x503369={'raw':![],'where':{'id':_0xa104f4[_0xeac5('0x3e')]['id']}},_0x27fb69={};_0x27fb69[_0xeac5('0x29')]=_[_0xeac5('0x2b')](db[_0xeac5('0x24')]['rawAttributes']);_0x27fb69[_0xeac5('0x2a')]=_[_0xeac5('0x2b')](_0xa104f4[_0xeac5('0x2a')]);_0x27fb69[_0xeac5('0x2c')]=_[_0xeac5('0x2d')](_0x27fb69[_0xeac5('0x29')],_0x27fb69['query']);_0x503369[_0xeac5('0x2e')]=_[_0xeac5('0x2d')](_0x27fb69[_0xeac5('0x29')],qs[_0xeac5('0x2f')](_0xa104f4[_0xeac5('0x2a')]['fields']));_0x503369[_0xeac5('0x2e')]=_0x503369[_0xeac5('0x2e')][_0xeac5('0x3f')]?_0x503369[_0xeac5('0x2e')]:_0x27fb69[_0xeac5('0x29')];if(_0xa104f4[_0xeac5('0x2a')][_0xeac5('0x39')]){_0x503369['include']=[{'all':!![]}];}_0x503369=_['merge']({},_0x503369,_0xa104f4[_0xeac5('0x38')]);return db[_0xeac5('0x24')]['find'](_0x503369)['then'](handleEntityNotFound(_0x35d036,null))['then'](respondWithResult(_0x35d036,null))[_0xeac5('0x3c')](handleError(_0x35d036,null));};exports['create']=function(_0x2c2d63,_0x4d715f){return db['Trigger'][_0xeac5('0x40')](_0x2c2d63['body'],{})['then'](function(_0x31ae5d){var _0x157308=_0x2c2d63[_0xeac5('0x41')][_0xeac5('0x42')]({'plain':!![]});if(!_0x157308)throw new Error(_0xeac5('0x43'));if(_0x157308['role']===_0xeac5('0x41')){var _0x172bf4=_0x31ae5d[_0xeac5('0x42')]({'plain':!![]});var _0x153269=_0xeac5('0x1e');return db['UserProfileSection']['find']({'where':{'name':_0x153269,'userProfileId':_0x157308[_0xeac5('0x44')]},'raw':!![]})[_0xeac5('0x1c')](function(_0x1856b3){if(_0x1856b3&&_0x1856b3[_0xeac5('0x45')]===0x0){return db['UserProfileResource'][_0xeac5('0x40')]({'name':_0x172bf4[_0xeac5('0x22')],'resourceId':_0x172bf4['id'],'type':_0x1856b3[_0xeac5('0x22')],'sectionId':_0x1856b3['id']},{})[_0xeac5('0x1c')](function(){return _0x31ae5d;});}else{return _0x31ae5d;}})['catch'](function(_0x4613e0){logger[_0xeac5('0x46')](_0xeac5('0x47'),_0x4613e0);throw _0x4613e0;});}return _0x31ae5d;})['then'](respondWithResult(_0x4d715f,0xc9))['catch'](handleError(_0x4d715f,null));};exports[_0xeac5('0x48')]=function(_0x5175a0,_0x3d242a){if(_0x5175a0[_0xeac5('0x49')]['id']){delete _0x5175a0[_0xeac5('0x49')]['id'];}return db[_0xeac5('0x24')]['find']({'where':{'id':_0x5175a0[_0xeac5('0x3e')]['id']}})[_0xeac5('0x1c')](handleEntityNotFound(_0x3d242a,null))[_0xeac5('0x1c')](saveUpdates(_0x5175a0['body'],null))['then'](respondWithResult(_0x3d242a,null))[_0xeac5('0x3c')](handleError(_0x3d242a,null));};exports[_0xeac5('0x1d')]=function(_0x21b802,_0x5dac3c){return db['Trigger'][_0xeac5('0x4a')]({'where':{'id':_0x21b802[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5dac3c,null))[_0xeac5('0x1c')](removeEntity(_0x5dac3c,null))[_0xeac5('0x3c')](handleError(_0x5dac3c,null));};exports['addAllCondition']=function(_0x102ec3,_0xae7d76,_0x7d8b9b){if(_0x102ec3[_0xeac5('0x49')]['id']){delete _0x102ec3[_0xeac5('0x49')]['id'];}return db[_0xeac5('0x24')]['find']({'where':{'id':_0x102ec3[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0xae7d76,null))[_0xeac5('0x1c')](function(_0x2aae17){if(_0x2aae17){_0x102ec3[_0xeac5('0x49')][_0xeac5('0x4b')]=_0x2aae17['id'];return db[_0xeac5('0x4c')][_0xeac5('0x40')](_0x102ec3[_0xeac5('0x49')]);}})[_0xeac5('0x1c')](respondWithResult(_0xae7d76,null))[_0xeac5('0x3c')](handleError(_0xae7d76,null));};exports[_0xeac5('0x4d')]=function(_0x42279a,_0x27bc42,_0x23db5d){if(_0x42279a[_0xeac5('0x49')]['id']){delete _0x42279a['body']['id'];}return db[_0xeac5('0x24')][_0xeac5('0x4a')]({'where':{'id':_0x42279a[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x27bc42,null))[_0xeac5('0x1c')](function(_0xc70a1e){if(_0xc70a1e){_0x42279a[_0xeac5('0x49')]['TriggerAnyId']=_0xc70a1e['id'];return db['Condition'][_0xeac5('0x40')](_0x42279a[_0xeac5('0x49')]);}})[_0xeac5('0x1c')](respondWithResult(_0x27bc42,null))['catch'](handleError(_0x27bc42,null));};exports['getAllConditions']=function(_0x48049c,_0x4940d1,_0x43fdf8){var _0x491947={};var _0x4cdb1c={};var _0x2b23a9;var _0x5493b2;return db[_0xeac5('0x24')][_0xeac5('0x4e')]({'where':{'id':_0x48049c[_0xeac5('0x3e')]['id']}})[_0xeac5('0x1c')](handleEntityNotFound(_0x4940d1,null))['then'](function(_0x40da6b){if(_0x40da6b){_0x2b23a9=_0x40da6b;_0x4cdb1c['model']=_[_0xeac5('0x2b')](db['Condition'][_0xeac5('0x25')]);_0x4cdb1c[_0xeac5('0x2a')]=_[_0xeac5('0x2b')](_0x48049c['query']);_0x4cdb1c[_0xeac5('0x2c')]=_['intersection'](_0x4cdb1c[_0xeac5('0x29')],_0x4cdb1c[_0xeac5('0x2a')]);_0x491947[_0xeac5('0x2e')]=_['intersection'](_0x4cdb1c[_0xeac5('0x29')],qs[_0xeac5('0x2f')](_0x48049c['query'][_0xeac5('0x2f')]));_0x491947[_0xeac5('0x2e')]=_0x491947[_0xeac5('0x2e')][_0xeac5('0x3f')]?_0x491947[_0xeac5('0x2e')]:_0x4cdb1c[_0xeac5('0x29')];_0x491947[_0xeac5('0x4f')]=qs[_0xeac5('0x32')](_0x48049c['query'][_0xeac5('0x32')]);_0x491947['where']=qs['filters'](_[_0xeac5('0x34')](_0x48049c['query'],_0x4cdb1c[_0xeac5('0x2c')]));if(_0x48049c[_0xeac5('0x2a')][_0xeac5('0x35')]){_0x491947['where']=_[_0xeac5('0x36')](_0x491947['where'],{'$or':_[_0xeac5('0x23')](_0x491947[_0xeac5('0x2e')],function(_0x2fc853){var _0x14b527={};_0x14b527[_0x2fc853]={'$like':'%'+_0x48049c['query'][_0xeac5('0x35')]+'%'};return _0x14b527;})});}_0x491947=_['merge']({},_0x491947,_0x48049c[_0xeac5('0x38')]);return _0x2b23a9[_0xeac5('0x50')](_0x491947);}})[_0xeac5('0x1c')](function(_0x333244){if(_0x333244){_0x5493b2=_0x333244[_0xeac5('0x3f')];if(!_0x48049c[_0xeac5('0x2a')]['hasOwnProperty']('nolimit')){_0x491947['limit']=qs[_0xeac5('0x1a')](_0x48049c['query'][_0xeac5('0x1a')]);_0x491947[_0xeac5('0x19')]=qs['offset'](_0x48049c['query'][_0xeac5('0x19')]);}return _0x2b23a9[_0xeac5('0x50')](_0x491947);}})[_0xeac5('0x1c')](function(_0xa63cc1){if(_0xa63cc1){return _0xa63cc1?{'count':_0x5493b2,'rows':_0xa63cc1}:null;}})[_0xeac5('0x1c')](respondWithResult(_0x4940d1,null))[_0xeac5('0x3c')](handleError(_0x4940d1,null));};exports[_0xeac5('0x51')]=function(_0x9f47c9,_0x3e3a8d,_0x5bf3f6){var _0x1cec6e={};var _0x32f3de={};var _0x217ef1;var _0x42fcbc;return db[_0xeac5('0x24')][_0xeac5('0x4e')]({'where':{'id':_0x9f47c9[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3e3a8d,null))[_0xeac5('0x1c')](function(_0x13524f){if(_0x13524f){_0x217ef1=_0x13524f;_0x32f3de[_0xeac5('0x29')]=_['keys'](db['Condition'][_0xeac5('0x25')]);_0x32f3de['query']=_['keys'](_0x9f47c9[_0xeac5('0x2a')]);_0x32f3de[_0xeac5('0x2c')]=_[_0xeac5('0x2d')](_0x32f3de[_0xeac5('0x29')],_0x32f3de[_0xeac5('0x2a')]);_0x1cec6e['attributes']=_[_0xeac5('0x2d')](_0x32f3de[_0xeac5('0x29')],qs[_0xeac5('0x2f')](_0x9f47c9[_0xeac5('0x2a')][_0xeac5('0x2f')]));_0x1cec6e[_0xeac5('0x2e')]=_0x1cec6e[_0xeac5('0x2e')][_0xeac5('0x3f')]?_0x1cec6e[_0xeac5('0x2e')]:_0x32f3de[_0xeac5('0x29')];_0x1cec6e[_0xeac5('0x4f')]=qs[_0xeac5('0x32')](_0x9f47c9[_0xeac5('0x2a')][_0xeac5('0x32')]);_0x1cec6e[_0xeac5('0x33')]=qs[_0xeac5('0x2c')](_['pick'](_0x9f47c9[_0xeac5('0x2a')],_0x32f3de['filters']));if(_0x9f47c9[_0xeac5('0x2a')][_0xeac5('0x35')]){_0x1cec6e['where']=_[_0xeac5('0x36')](_0x1cec6e[_0xeac5('0x33')],{'$or':_[_0xeac5('0x23')](_0x1cec6e[_0xeac5('0x2e')],function(_0x2aadaa){var _0x232fca={};_0x232fca[_0x2aadaa]={'$like':'%'+_0x9f47c9[_0xeac5('0x2a')][_0xeac5('0x35')]+'%'};return _0x232fca;})});}_0x1cec6e=_['merge']({},_0x1cec6e,_0x9f47c9[_0xeac5('0x38')]);return _0x217ef1[_0xeac5('0x51')](_0x1cec6e);}})[_0xeac5('0x1c')](function(_0xd6481e){if(_0xd6481e){_0x42fcbc=_0xd6481e['length'];if(!_0x9f47c9['query'][_0xeac5('0x30')](_0xeac5('0x31'))){_0x1cec6e['limit']=qs[_0xeac5('0x1a')](_0x9f47c9[_0xeac5('0x2a')]['limit']);_0x1cec6e[_0xeac5('0x19')]=qs[_0xeac5('0x19')](_0x9f47c9['query'][_0xeac5('0x19')]);}return _0x217ef1['getAnyConditions'](_0x1cec6e);}})[_0xeac5('0x1c')](function(_0x49c9f5){if(_0x49c9f5){return _0x49c9f5?{'count':_0x42fcbc,'rows':_0x49c9f5}:null;}})['then'](respondWithResult(_0x3e3a8d,null))[_0xeac5('0x3c')](handleError(_0x3e3a8d,null));};exports[_0xeac5('0x52')]=function(_0xef6fc5,_0xe4f9ab,_0x3d646c){if(_0xef6fc5[_0xeac5('0x49')]['id']){delete _0xef6fc5['body']['id'];}return db[_0xeac5('0x24')]['find']({'where':{'id':_0xef6fc5[_0xeac5('0x3e')]['id']}})[_0xeac5('0x1c')](handleEntityNotFound(_0xe4f9ab,null))[_0xeac5('0x1c')](function(_0x161f42){if(_0x161f42){_0xef6fc5['body']['TriggerId']=_0x161f42['id'];return db[_0xeac5('0x53')][_0xeac5('0x40')](_0xef6fc5[_0xeac5('0x49')]);}})[_0xeac5('0x1c')](respondWithResult(_0xe4f9ab,null))[_0xeac5('0x3c')](handleError(_0xe4f9ab,null));};exports[_0xeac5('0x54')]=function(_0x58fa19,_0x2c23a8,_0x3af377){var _0x22aeb2={};var _0x43d591={};var _0x1b8b14;var _0x4d8da4;return db[_0xeac5('0x24')]['findOne']({'where':{'id':_0x58fa19[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2c23a8,null))['then'](function(_0x254f60){if(_0x254f60){_0x1b8b14=_0x254f60;_0x43d591['model']=_[_0xeac5('0x2b')](db[_0xeac5('0x53')][_0xeac5('0x25')]);_0x43d591['query']=_[_0xeac5('0x2b')](_0x58fa19['query']);_0x43d591[_0xeac5('0x2c')]=_[_0xeac5('0x2d')](_0x43d591['model'],_0x43d591[_0xeac5('0x2a')]);_0x22aeb2[_0xeac5('0x2e')]=_['intersection'](_0x43d591[_0xeac5('0x29')],qs['fields'](_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x2f')]));_0x22aeb2[_0xeac5('0x2e')]=_0x22aeb2[_0xeac5('0x2e')][_0xeac5('0x3f')]?_0x22aeb2['attributes']:_0x43d591[_0xeac5('0x29')];_0x22aeb2[_0xeac5('0x4f')]=qs[_0xeac5('0x32')](_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x32')]);_0x22aeb2['where']=qs['filters'](_[_0xeac5('0x34')](_0x58fa19['query'],_0x43d591[_0xeac5('0x2c')]));if(_0x58fa19['query'][_0xeac5('0x35')]){_0x22aeb2[_0xeac5('0x33')]=_[_0xeac5('0x36')](_0x22aeb2[_0xeac5('0x33')],{'$or':_[_0xeac5('0x23')](_0x22aeb2['attributes'],function(_0x219dfe){var _0x43a73d={};_0x43a73d[_0x219dfe]={'$like':'%'+_0x58fa19[_0xeac5('0x2a')]['filter']+'%'};return _0x43a73d;})});}_0x22aeb2=_[_0xeac5('0x36')]({},_0x22aeb2,_0x58fa19[_0xeac5('0x38')]);return _0x1b8b14[_0xeac5('0x54')](_0x22aeb2);}})[_0xeac5('0x1c')](function(_0x567eaf){if(_0x567eaf){_0x4d8da4=_0x567eaf[_0xeac5('0x3f')];if(!_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x30')](_0xeac5('0x31'))){_0x22aeb2[_0xeac5('0x1a')]=qs['limit'](_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x1a')]);_0x22aeb2[_0xeac5('0x19')]=qs[_0xeac5('0x19')](_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x19')]);}return _0x1b8b14[_0xeac5('0x54')](_0x22aeb2);}})[_0xeac5('0x1c')](function(_0x5db5f2){if(_0x5db5f2){return _0x5db5f2?{'count':_0x4d8da4,'rows':_0x5db5f2}:null;}})[_0xeac5('0x1c')](respondWithResult(_0x2c23a8,null))[_0xeac5('0x3c')](handleError(_0x2c23a8,null));}; \ No newline at end of file +var _0xbbba=['Triggers','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','options','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','Trigger','fieldName','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','count','includeAll','include','findAll','show','params','rawAttributes','length','create','user','get','role'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xbbba,0x1f2));var _0xabbb=function(_0x414ff1,_0xf0462b){_0x414ff1=_0x414ff1-0x0;var _0x29c53f=_0xbbba[_0x414ff1];return _0x29c53f;};'use strict';var pdf=require(_0xabbb('0x0'));var emlformat=require(_0xabbb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xabbb('0x2'));var jsonpatch=require(_0xabbb('0x3'));var rp=require(_0xabbb('0x4'));var moment=require(_0xabbb('0x5'));var BPromise=require(_0xabbb('0x6'));var Mustache=require('mustache');var util=require(_0xabbb('0x7'));var path=require(_0xabbb('0x8'));var sox=require(_0xabbb('0x9'));var csv=require(_0xabbb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xabbb('0xb'));var squel=require(_0xabbb('0xc'));var crypto=require(_0xabbb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xabbb('0xe'));var toCsv=require(_0xabbb('0xa'));var querystring=require(_0xabbb('0xf'));var Papa=require(_0xabbb('0x10'));var Redis=require(_0xabbb('0x11'));var authService=require(_0xabbb('0x12'));var qs=require(_0xabbb('0x13'));var as=require(_0xabbb('0x14'));var hardwareService=require(_0xabbb('0x15'));var logger=require(_0xabbb('0x16'))(_0xabbb('0x17'));var utils=require(_0xabbb('0x18'));var config=require(_0xabbb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x880e33,_0x4d5ef8){_0x4d5ef8=_0x4d5ef8||0xcc;return function(_0x240855){if(_0x240855){return _0x880e33[_0xabbb('0x1a')](_0x4d5ef8);}return _0x880e33[_0xabbb('0x1b')](_0x4d5ef8)[_0xabbb('0x1c')]();};}function respondWithResult(_0x4bf26e,_0x129387){_0x129387=_0x129387||0xc8;return function(_0xa99f03){if(_0xa99f03){return _0x4bf26e['status'](_0x129387)[_0xabbb('0x1d')](_0xa99f03);}};}function respondWithFilteredResult(_0x3a7153,_0x5b2254){return function(_0x34e665){if(_0x34e665){var _0x27e4d6=_0x34e665['count'],_0x31078b=_0x5b2254[_0xabbb('0x1e')],_0x1780e5=_0x5b2254[_0xabbb('0x1e')]+_0x5b2254[_0xabbb('0x1f')],_0x515312;if(_0x1780e5>=_0x27e4d6){_0x1780e5=_0x27e4d6;_0x515312=0xc8;}else{_0x515312=0xce;}_0x3a7153['status'](_0x515312);return _0x3a7153[_0xabbb('0x20')](_0xabbb('0x21'),_0x31078b+'-'+_0x1780e5+'/'+_0x27e4d6)[_0xabbb('0x1d')](_0x34e665);}return null;};}function patchUpdates(_0x3438ca){return function(_0x1886e8){try{jsonpatch[_0xabbb('0x22')](_0x1886e8,_0x3438ca,!![]);}catch(_0x5e66c1){return BPromise[_0xabbb('0x23')](_0x5e66c1);}return _0x1886e8[_0xabbb('0x24')]();};}function saveUpdates(_0x4ea6a1,_0x3cfd49){return function(_0x419e9b){if(_0x419e9b){return _0x419e9b[_0xabbb('0x25')](_0x4ea6a1)[_0xabbb('0x26')](function(_0x3e490a){return _0x3e490a;});}return null;};}function removeEntity(_0x3fbcaf,_0x293b26){return function(_0x50d215){if(_0x50d215){return _0x50d215[_0xabbb('0x27')]()['then'](function(){var _0x3fdb06=_0x50d215['get']({'plain':!![]});var _0x19cefb='Triggers';return db[_0xabbb('0x28')][_0xabbb('0x27')]({'where':{'type':_0x19cefb,'resourceId':_0x3fdb06['id']}})['then'](function(){return _0x50d215;});})[_0xabbb('0x26')](function(){_0x3fbcaf[_0xabbb('0x1b')](0xcc)[_0xabbb('0x1c')]();});}};}function handleEntityNotFound(_0x356682,_0x577881){return function(_0x2c92f0){if(!_0x2c92f0){_0x356682[_0xabbb('0x1a')](0x194);}return _0x2c92f0;};}function handleError(_0x72b83e,_0xdba5b7){_0xdba5b7=_0xdba5b7||0x1f4;return function(_0x5af9db){logger[_0xabbb('0x29')](_0x5af9db[_0xabbb('0x2a')]);if(_0x5af9db[_0xabbb('0x2b')]){delete _0x5af9db[_0xabbb('0x2b')];}_0x72b83e[_0xabbb('0x1b')](_0xdba5b7)[_0xabbb('0x2c')](_0x5af9db);};}exports['index']=function(_0x2cc8bb,_0x3c226a){var _0x1937bf={},_0x40ec87={},_0x4a0cdb={'count':0x0,'rows':[]};var _0xc4bdd9=_[_0xabbb('0x2d')](db[_0xabbb('0x2e')]['rawAttributes'],function(_0x4faf30){return{'name':_0x4faf30[_0xabbb('0x2f')],'type':_0x4faf30['type'][_0xabbb('0x30')]};});_0x40ec87['model']=_[_0xabbb('0x2d')](_0xc4bdd9,_0xabbb('0x2b'));_0x40ec87[_0xabbb('0x31')]=_[_0xabbb('0x32')](_0x2cc8bb[_0xabbb('0x31')]);_0x40ec87[_0xabbb('0x33')]=_[_0xabbb('0x34')](_0x40ec87['model'],_0x40ec87['query']);_0x1937bf[_0xabbb('0x35')]=_[_0xabbb('0x34')](_0x40ec87['model'],qs[_0xabbb('0x36')](_0x2cc8bb['query'][_0xabbb('0x36')]));_0x1937bf[_0xabbb('0x35')]=_0x1937bf[_0xabbb('0x35')]['length']?_0x1937bf[_0xabbb('0x35')]:_0x40ec87[_0xabbb('0x37')];if(!_0x2cc8bb['query'][_0xabbb('0x38')](_0xabbb('0x39'))){_0x1937bf[_0xabbb('0x1f')]=qs[_0xabbb('0x1f')](_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x1f')]);_0x1937bf[_0xabbb('0x1e')]=qs[_0xabbb('0x1e')](_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x1e')]);}_0x1937bf[_0xabbb('0x3a')]=qs[_0xabbb('0x3b')](_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x3b')]);_0x1937bf[_0xabbb('0x3c')]=qs[_0xabbb('0x33')](_[_0xabbb('0x3d')](_0x2cc8bb[_0xabbb('0x31')],_0x40ec87[_0xabbb('0x33')]),_0xc4bdd9);if(_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x3e')]){_0x1937bf['where']=_['merge'](_0x1937bf[_0xabbb('0x3c')],{'$or':_[_0xabbb('0x2d')](_0xc4bdd9,function(_0x4666d9){if(_0x4666d9[_0xabbb('0x3f')]!==_0xabbb('0x40')){var _0x27f735={};_0x27f735[_0x4666d9['name']]={'$like':'%'+_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x3e')]+'%'};return _0x27f735;}})});}_0x1937bf=_[_0xabbb('0x41')]({},_0x1937bf,_0x2cc8bb['options']);var _0x209d1b={'where':_0x1937bf[_0xabbb('0x3c')]};return db['Trigger'][_0xabbb('0x42')](_0x209d1b)['then'](function(_0x29d54b){_0x4a0cdb['count']=_0x29d54b;if(_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x43')]){_0x1937bf[_0xabbb('0x44')]=[{'all':!![]}];}return db['Trigger'][_0xabbb('0x45')](_0x1937bf);})[_0xabbb('0x26')](function(_0x568eae){_0x4a0cdb['rows']=_0x568eae;return _0x4a0cdb;})['then'](respondWithFilteredResult(_0x3c226a,_0x1937bf))['catch'](handleError(_0x3c226a,null));};exports[_0xabbb('0x46')]=function(_0xd061f8,_0xc0311){var _0x579c99={'raw':![],'where':{'id':_0xd061f8[_0xabbb('0x47')]['id']}},_0x25c596={};_0x25c596['model']=_['keys'](db[_0xabbb('0x2e')][_0xabbb('0x48')]);_0x25c596[_0xabbb('0x31')]=_[_0xabbb('0x32')](_0xd061f8['query']);_0x25c596['filters']=_[_0xabbb('0x34')](_0x25c596[_0xabbb('0x37')],_0x25c596[_0xabbb('0x31')]);_0x579c99[_0xabbb('0x35')]=_['intersection'](_0x25c596[_0xabbb('0x37')],qs[_0xabbb('0x36')](_0xd061f8[_0xabbb('0x31')][_0xabbb('0x36')]));_0x579c99[_0xabbb('0x35')]=_0x579c99[_0xabbb('0x35')][_0xabbb('0x49')]?_0x579c99['attributes']:_0x25c596[_0xabbb('0x37')];if(_0xd061f8[_0xabbb('0x31')]['includeAll']){_0x579c99[_0xabbb('0x44')]=[{'all':!![]}];}_0x579c99=_[_0xabbb('0x41')]({},_0x579c99,_0xd061f8['options']);return db['Trigger']['find'](_0x579c99)[_0xabbb('0x26')](handleEntityNotFound(_0xc0311,null))[_0xabbb('0x26')](respondWithResult(_0xc0311,null))['catch'](handleError(_0xc0311,null));};exports[_0xabbb('0x4a')]=function(_0x1611e8,_0x5c5e3b){return db['Trigger'][_0xabbb('0x4a')](_0x1611e8['body'],{})[_0xabbb('0x26')](function(_0x1bfdca){var _0x456786=_0x1611e8[_0xabbb('0x4b')][_0xabbb('0x4c')]({'plain':!![]});if(!_0x456786)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x456786[_0xabbb('0x4d')]===_0xabbb('0x4b')){var _0x3d1ee2=_0x1bfdca['get']({'plain':!![]});var _0x4db4bd=_0xabbb('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x4db4bd,'userProfileId':_0x456786[_0xabbb('0x4f')]},'raw':!![]})[_0xabbb('0x26')](function(_0x3984c5){if(_0x3984c5&&_0x3984c5[_0xabbb('0x50')]===0x0){return db['UserProfileResource'][_0xabbb('0x4a')]({'name':_0x3d1ee2[_0xabbb('0x2b')],'resourceId':_0x3d1ee2['id'],'type':_0x3984c5[_0xabbb('0x2b')],'sectionId':_0x3984c5['id']},{})['then'](function(){return _0x1bfdca;});}else{return _0x1bfdca;}})[_0xabbb('0x51')](function(_0xc93b86){logger[_0xabbb('0x29')](_0xabbb('0x52'),_0xc93b86);throw _0xc93b86;});}return _0x1bfdca;})['then'](respondWithResult(_0x5c5e3b,0xc9))[_0xabbb('0x51')](handleError(_0x5c5e3b,null));};exports[_0xabbb('0x25')]=function(_0x400857,_0x4c858a){if(_0x400857[_0xabbb('0x53')]['id']){delete _0x400857[_0xabbb('0x53')]['id'];}return db[_0xabbb('0x2e')][_0xabbb('0x54')]({'where':{'id':_0x400857['params']['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x4c858a,null))[_0xabbb('0x26')](saveUpdates(_0x400857[_0xabbb('0x53')],null))[_0xabbb('0x26')](respondWithResult(_0x4c858a,null))[_0xabbb('0x51')](handleError(_0x4c858a,null));};exports[_0xabbb('0x27')]=function(_0x46d994,_0x1e53f2){return db[_0xabbb('0x2e')][_0xabbb('0x54')]({'where':{'id':_0x46d994['params']['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x1e53f2,null))[_0xabbb('0x26')](removeEntity(_0x1e53f2,null))['catch'](handleError(_0x1e53f2,null));};exports[_0xabbb('0x55')]=function(_0x2447d5,_0x2a54bb,_0xc88ed3){if(_0x2447d5['body']['id']){delete _0x2447d5[_0xabbb('0x53')]['id'];}return db[_0xabbb('0x2e')][_0xabbb('0x54')]({'where':{'id':_0x2447d5[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x2a54bb,null))['then'](function(_0x297a3c){if(_0x297a3c){_0x2447d5['body']['TriggerAllId']=_0x297a3c['id'];return db[_0xabbb('0x56')][_0xabbb('0x4a')](_0x2447d5['body']);}})[_0xabbb('0x26')](respondWithResult(_0x2a54bb,null))['catch'](handleError(_0x2a54bb,null));};exports[_0xabbb('0x57')]=function(_0x18475b,_0x417564,_0x1fb381){if(_0x18475b[_0xabbb('0x53')]['id']){delete _0x18475b['body']['id'];}return db['Trigger'][_0xabbb('0x54')]({'where':{'id':_0x18475b[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x417564,null))[_0xabbb('0x26')](function(_0x1ea654){if(_0x1ea654){_0x18475b[_0xabbb('0x53')]['TriggerAnyId']=_0x1ea654['id'];return db[_0xabbb('0x56')][_0xabbb('0x4a')](_0x18475b[_0xabbb('0x53')]);}})['then'](respondWithResult(_0x417564,null))[_0xabbb('0x51')](handleError(_0x417564,null));};exports[_0xabbb('0x58')]=function(_0x29add6,_0x1cd107,_0x542476){var _0x539deb={};var _0x486da7={};var _0x4bd43a;var _0x1fe6fc;return db['Trigger'][_0xabbb('0x59')]({'where':{'id':_0x29add6[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x1cd107,null))[_0xabbb('0x26')](function(_0x4e807b){if(_0x4e807b){_0x4bd43a=_0x4e807b;_0x486da7['model']=_[_0xabbb('0x32')](db[_0xabbb('0x56')][_0xabbb('0x48')]);_0x486da7['query']=_['keys'](_0x29add6['query']);_0x486da7[_0xabbb('0x33')]=_[_0xabbb('0x34')](_0x486da7['model'],_0x486da7['query']);_0x539deb[_0xabbb('0x35')]=_[_0xabbb('0x34')](_0x486da7[_0xabbb('0x37')],qs[_0xabbb('0x36')](_0x29add6['query'][_0xabbb('0x36')]));_0x539deb[_0xabbb('0x35')]=_0x539deb[_0xabbb('0x35')]['length']?_0x539deb[_0xabbb('0x35')]:_0x486da7['model'];_0x539deb['order']=qs[_0xabbb('0x3b')](_0x29add6[_0xabbb('0x31')][_0xabbb('0x3b')]);_0x539deb['where']=qs[_0xabbb('0x33')](_[_0xabbb('0x3d')](_0x29add6['query'],_0x486da7['filters']));if(_0x29add6['query'][_0xabbb('0x3e')]){_0x539deb[_0xabbb('0x3c')]=_[_0xabbb('0x41')](_0x539deb[_0xabbb('0x3c')],{'$or':_['map'](_0x539deb[_0xabbb('0x35')],function(_0xe7108f){var _0x1ebf0a={};_0x1ebf0a[_0xe7108f]={'$like':'%'+_0x29add6['query']['filter']+'%'};return _0x1ebf0a;})});}_0x539deb=_[_0xabbb('0x41')]({},_0x539deb,_0x29add6[_0xabbb('0x5a')]);return _0x4bd43a['getAllConditions'](_0x539deb);}})[_0xabbb('0x26')](function(_0x579bfb){if(_0x579bfb){_0x1fe6fc=_0x579bfb[_0xabbb('0x49')];if(!_0x29add6[_0xabbb('0x31')][_0xabbb('0x38')](_0xabbb('0x39'))){_0x539deb[_0xabbb('0x1f')]=qs[_0xabbb('0x1f')](_0x29add6['query'][_0xabbb('0x1f')]);_0x539deb['offset']=qs['offset'](_0x29add6['query'][_0xabbb('0x1e')]);}return _0x4bd43a[_0xabbb('0x58')](_0x539deb);}})[_0xabbb('0x26')](function(_0x21658f){if(_0x21658f){return _0x21658f?{'count':_0x1fe6fc,'rows':_0x21658f}:null;}})[_0xabbb('0x26')](respondWithResult(_0x1cd107,null))[_0xabbb('0x51')](handleError(_0x1cd107,null));};exports[_0xabbb('0x5b')]=function(_0x785fab,_0x332eac,_0x5b84af){var _0xa2e871={};var _0x367d9c={};var _0x175d14;var _0x53da56;return db[_0xabbb('0x2e')][_0xabbb('0x59')]({'where':{'id':_0x785fab[_0xabbb('0x47')]['id']}})['then'](handleEntityNotFound(_0x332eac,null))[_0xabbb('0x26')](function(_0x5e2bcf){if(_0x5e2bcf){_0x175d14=_0x5e2bcf;_0x367d9c[_0xabbb('0x37')]=_[_0xabbb('0x32')](db[_0xabbb('0x56')][_0xabbb('0x48')]);_0x367d9c[_0xabbb('0x31')]=_[_0xabbb('0x32')](_0x785fab['query']);_0x367d9c[_0xabbb('0x33')]=_[_0xabbb('0x34')](_0x367d9c['model'],_0x367d9c['query']);_0xa2e871[_0xabbb('0x35')]=_['intersection'](_0x367d9c[_0xabbb('0x37')],qs[_0xabbb('0x36')](_0x785fab[_0xabbb('0x31')][_0xabbb('0x36')]));_0xa2e871[_0xabbb('0x35')]=_0xa2e871[_0xabbb('0x35')][_0xabbb('0x49')]?_0xa2e871[_0xabbb('0x35')]:_0x367d9c[_0xabbb('0x37')];_0xa2e871[_0xabbb('0x3a')]=qs[_0xabbb('0x3b')](_0x785fab['query'][_0xabbb('0x3b')]);_0xa2e871[_0xabbb('0x3c')]=qs[_0xabbb('0x33')](_[_0xabbb('0x3d')](_0x785fab['query'],_0x367d9c[_0xabbb('0x33')]));if(_0x785fab[_0xabbb('0x31')][_0xabbb('0x3e')]){_0xa2e871[_0xabbb('0x3c')]=_[_0xabbb('0x41')](_0xa2e871[_0xabbb('0x3c')],{'$or':_['map'](_0xa2e871['attributes'],function(_0x254b2b){var _0xd0bb95={};_0xd0bb95[_0x254b2b]={'$like':'%'+_0x785fab[_0xabbb('0x31')][_0xabbb('0x3e')]+'%'};return _0xd0bb95;})});}_0xa2e871=_[_0xabbb('0x41')]({},_0xa2e871,_0x785fab[_0xabbb('0x5a')]);return _0x175d14['getAnyConditions'](_0xa2e871);}})[_0xabbb('0x26')](function(_0x461472){if(_0x461472){_0x53da56=_0x461472[_0xabbb('0x49')];if(!_0x785fab[_0xabbb('0x31')]['hasOwnProperty'](_0xabbb('0x39'))){_0xa2e871[_0xabbb('0x1f')]=qs[_0xabbb('0x1f')](_0x785fab[_0xabbb('0x31')]['limit']);_0xa2e871[_0xabbb('0x1e')]=qs[_0xabbb('0x1e')](_0x785fab[_0xabbb('0x31')]['offset']);}return _0x175d14[_0xabbb('0x5b')](_0xa2e871);}})[_0xabbb('0x26')](function(_0x1671d4){if(_0x1671d4){return _0x1671d4?{'count':_0x53da56,'rows':_0x1671d4}:null;}})['then'](respondWithResult(_0x332eac,null))[_0xabbb('0x51')](handleError(_0x332eac,null));};exports[_0xabbb('0x5c')]=function(_0x4dde8f,_0x3d6708,_0x29d729){if(_0x4dde8f[_0xabbb('0x53')]['id']){delete _0x4dde8f['body']['id'];}return db[_0xabbb('0x2e')][_0xabbb('0x54')]({'where':{'id':_0x4dde8f[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x3d6708,null))['then'](function(_0x376a5a){if(_0x376a5a){_0x4dde8f[_0xabbb('0x53')][_0xabbb('0x5d')]=_0x376a5a['id'];return db[_0xabbb('0x5e')][_0xabbb('0x4a')](_0x4dde8f['body']);}})[_0xabbb('0x26')](respondWithResult(_0x3d6708,null))[_0xabbb('0x51')](handleError(_0x3d6708,null));};exports['getActions']=function(_0x4f8efc,_0xf9fcfb,_0x2be3ab){var _0x242d2a={};var _0x5b296d={};var _0x39990d;var _0x3941e4;return db['Trigger']['findOne']({'where':{'id':_0x4f8efc[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0xf9fcfb,null))[_0xabbb('0x26')](function(_0x378d51){if(_0x378d51){_0x39990d=_0x378d51;_0x5b296d[_0xabbb('0x37')]=_[_0xabbb('0x32')](db[_0xabbb('0x5e')][_0xabbb('0x48')]);_0x5b296d[_0xabbb('0x31')]=_[_0xabbb('0x32')](_0x4f8efc['query']);_0x5b296d[_0xabbb('0x33')]=_[_0xabbb('0x34')](_0x5b296d[_0xabbb('0x37')],_0x5b296d['query']);_0x242d2a['attributes']=_[_0xabbb('0x34')](_0x5b296d[_0xabbb('0x37')],qs[_0xabbb('0x36')](_0x4f8efc[_0xabbb('0x31')][_0xabbb('0x36')]));_0x242d2a[_0xabbb('0x35')]=_0x242d2a[_0xabbb('0x35')]['length']?_0x242d2a[_0xabbb('0x35')]:_0x5b296d[_0xabbb('0x37')];_0x242d2a[_0xabbb('0x3a')]=qs[_0xabbb('0x3b')](_0x4f8efc[_0xabbb('0x31')]['sort']);_0x242d2a[_0xabbb('0x3c')]=qs[_0xabbb('0x33')](_[_0xabbb('0x3d')](_0x4f8efc[_0xabbb('0x31')],_0x5b296d[_0xabbb('0x33')]));if(_0x4f8efc[_0xabbb('0x31')]['filter']){_0x242d2a[_0xabbb('0x3c')]=_[_0xabbb('0x41')](_0x242d2a[_0xabbb('0x3c')],{'$or':_[_0xabbb('0x2d')](_0x242d2a[_0xabbb('0x35')],function(_0x3f8315){var _0x2f5fa2={};_0x2f5fa2[_0x3f8315]={'$like':'%'+_0x4f8efc[_0xabbb('0x31')][_0xabbb('0x3e')]+'%'};return _0x2f5fa2;})});}_0x242d2a=_[_0xabbb('0x41')]({},_0x242d2a,_0x4f8efc[_0xabbb('0x5a')]);return _0x39990d[_0xabbb('0x5f')](_0x242d2a);}})[_0xabbb('0x26')](function(_0x3c5968){if(_0x3c5968){_0x3941e4=_0x3c5968[_0xabbb('0x49')];if(!_0x4f8efc['query']['hasOwnProperty'](_0xabbb('0x39'))){_0x242d2a[_0xabbb('0x1f')]=qs['limit'](_0x4f8efc[_0xabbb('0x31')][_0xabbb('0x1f')]);_0x242d2a[_0xabbb('0x1e')]=qs[_0xabbb('0x1e')](_0x4f8efc[_0xabbb('0x31')][_0xabbb('0x1e')]);}return _0x39990d[_0xabbb('0x5f')](_0x242d2a);}})[_0xabbb('0x26')](function(_0x1dd3e5){if(_0x1dd3e5){return _0x1dd3e5?{'count':_0x3941e4,'rows':_0x1dd3e5}:null;}})['then'](respondWithResult(_0xf9fcfb,null))[_0xabbb('0x51')](handleError(_0xf9fcfb,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8a27a23..5b38483 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['request-promise','path','../../config/environment','exports','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./trigger.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','tools_triggers'];(function(_0xe6a3ab,_0x1dc2e5){var _0x33688e=function(_0x62c36e){while(--_0x62c36e){_0xe6a3ab['push'](_0xe6a3ab['shift']());}};_0x33688e(++_0x1dc2e5);}(_0x1261,0x144));var _0x1126=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x1261[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('Trigger',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 377061c..c27d865 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 _0x4213=['then','ShowTrigger','find','where','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trigger,\x20%s,\x20%s','info','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x3dbae4,_0x2a0a5a){var _0x2cffe6=function(_0x49650c){while(--_0x49650c){_0x3dbae4['push'](_0x3dbae4['shift']());}};_0x2cffe6(++_0x2a0a5a);}(_0x4213,0x77));var _0x3421=function(_0xeb888d,_0xb9ed5){_0xeb888d=_0xeb888d-0x0;var _0x106329=_0x4213[_0xeb888d];return _0x106329;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));var BPromise=require(_0x3421('0x3'));var rs=require(_0x3421('0x4'));var fs=require('fs');var Redis=require(_0x3421('0x5'));var db=require(_0x3421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3421('0x7'))('rpc');var config=require(_0x3421('0x8'));var jayson=require(_0x3421('0x9'));var client=jayson[_0x3421('0xa')][_0x3421('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5469d8,_0x50e464,_0x1b152f){return new BPromise(function(_0x130625,_0x1cf6a0){return client[_0x3421('0xc')](_0x5469d8,_0x1b152f)['then'](function(_0x1f20cf){logger['info']('Trigger,\x20%s,\x20%s',_0x50e464,_0x3421('0xd'));logger['debug'](_0x3421('0xe'),_0x50e464,_0x3421('0xd'),JSON[_0x3421('0xf')](_0x1f20cf));if(_0x1f20cf[_0x3421('0x10')]){if(_0x1f20cf[_0x3421('0x10')][_0x3421('0x11')]===0x1f4){logger[_0x3421('0x10')]('Trigger,\x20%s,\x20%s',_0x50e464,_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);return _0x1cf6a0(_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);}logger[_0x3421('0x10')](_0x3421('0x13'),_0x50e464,_0x1f20cf[_0x3421('0x10')]['message']);return _0x130625(_0x1f20cf[_0x3421('0x10')]['message']);}else{logger[_0x3421('0x14')](_0x3421('0x13'),_0x50e464,'request\x20sent');_0x130625(_0x1f20cf[_0x3421('0x15')]['message']);}})[_0x3421('0x16')](function(_0x23694b){logger['error'](_0x3421('0x13'),_0x50e464,_0x23694b);_0x1cf6a0(_0x23694b);});});}exports[_0x3421('0x17')]=function(_0x130d3c){var _0x104cc5=this;return new Promise(function(_0x18acc1,_0x200fdd){return db[_0x3421('0x18')][_0x3421('0x19')]({'raw':_0x130d3c[_0x3421('0x1a')]?_0x130d3c[_0x3421('0x1a')][_0x3421('0x1b')]===undefined?!![]:![]:!![],'where':_0x130d3c['options']?_0x130d3c[_0x3421('0x1a')]['where']||null:null,'attributes':_0x130d3c['options']?_0x130d3c['options'][_0x3421('0x1c')]||null:null,'limit':_0x130d3c[_0x3421('0x1a')]?_0x130d3c[_0x3421('0x1a')][_0x3421('0x1d')]||null:null,'include':_0x130d3c[_0x3421('0x1a')]?_0x130d3c[_0x3421('0x1a')][_0x3421('0x1e')]?_[_0x3421('0x1f')](_0x130d3c[_0x3421('0x1a')][_0x3421('0x1e')],function(_0x48fb3d){return{'model':db[_0x48fb3d['model']],'as':_0x48fb3d['as'],'attributes':_0x48fb3d['attributes'],'include':_0x48fb3d[_0x3421('0x1e')]?_[_0x3421('0x1f')](_0x48fb3d[_0x3421('0x1e')],function(_0x5bc28a){return{'model':db[_0x5bc28a['model']],'as':_0x5bc28a['as'],'attributes':_0x5bc28a[_0x3421('0x1c')],'include':_0x5bc28a['include']?_[_0x3421('0x1f')](_0x5bc28a['include'],function(_0x15e73c){return{'model':db[_0x15e73c[_0x3421('0x20')]],'as':_0x15e73c['as'],'attributes':_0x15e73c[_0x3421('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3421('0x21')](function(_0x186885){logger['info'](_0x3421('0x17'),_0x130d3c);logger['debug']('GetTrigger',_0x130d3c,JSON[_0x3421('0xf')](_0x186885));_0x18acc1(_0x186885);})['catch'](function(_0x5074a2){logger[_0x3421('0x10')]('GetTrigger',_0x5074a2[_0x3421('0x12')],_0x130d3c);_0x200fdd(_0x104cc5['error'](0x1f4,_0x5074a2[_0x3421('0x12')]));});});};exports[_0x3421('0x22')]=function(_0x48d828){var _0x3f7c0b=this;return new Promise(function(_0x3bc7c1,_0x420349){return db['Trigger'][_0x3421('0x23')]({'raw':_0x48d828['options']?_0x48d828[_0x3421('0x1a')][_0x3421('0x1b')]===undefined?!![]:![]:!![],'where':_0x48d828[_0x3421('0x1a')]?_0x48d828[_0x3421('0x1a')][_0x3421('0x24')]||null:null,'attributes':_0x48d828[_0x3421('0x1a')]?_0x48d828[_0x3421('0x1a')][_0x3421('0x1c')]||null:null,'include':_0x48d828[_0x3421('0x1a')]?_0x48d828[_0x3421('0x1a')]['include']?_['map'](_0x48d828[_0x3421('0x1a')][_0x3421('0x1e')],function(_0x5218cd){return{'model':db[_0x5218cd[_0x3421('0x20')]],'as':_0x5218cd['as'],'attributes':_0x5218cd[_0x3421('0x1c')],'include':_0x5218cd[_0x3421('0x1e')]?_[_0x3421('0x1f')](_0x5218cd[_0x3421('0x1e')],function(_0x4a33f8){return{'model':db[_0x4a33f8[_0x3421('0x20')]],'as':_0x4a33f8['as'],'attributes':_0x4a33f8[_0x3421('0x1c')],'include':_0x4a33f8[_0x3421('0x1e')]?_['map'](_0x4a33f8[_0x3421('0x1e')],function(_0x4ba1b9){return{'model':db[_0x4ba1b9[_0x3421('0x20')]],'as':_0x4ba1b9['as'],'attributes':_0x4ba1b9[_0x3421('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3421('0x21')](function(_0xcda5ee){logger[_0x3421('0x14')](_0x3421('0x22'),_0x48d828);logger[_0x3421('0x25')]('ShowTrigger',_0x48d828,JSON['stringify'](_0xcda5ee));_0x3bc7c1(_0xcda5ee);})['catch'](function(_0x4696f3){logger['error']('ShowTrigger',_0x4696f3[_0x3421('0x12')],_0x48d828);_0x420349(_0x3f7c0b['error'](0x1f4,_0x4696f3[_0x3421('0x12')]));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','ShowTrigger','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x37290d,_0x44a198){var _0x8b9862=function(_0x38a723){while(--_0x38a723){_0x37290d['push'](_0x37290d['shift']());}};_0x8b9862(++_0x44a198);}(_0x757a,0xde));var _0xa757=function(_0x4fc319,_0x2c7034){_0x4fc319=_0x4fc319-0x0;var _0x167e54=_0x757a[_0x4fc319];return _0x167e54;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetTrigger',_0x4d9f58);logger['debug']('GetTrigger',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrigger',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index edaf44e..89747d7 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 _0xd2ea=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0xd2ea,0x15f));var _0xad2e=function(_0x305ba2,_0x4e9ffe){_0x305ba2=_0x305ba2-0x0;var _0xb79482=_0xd2ea[_0x305ba2];return _0xb79482;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var auth=require(_0xad2e('0x5'));var interaction=require(_0xad2e('0x6'));var config=require(_0xad2e('0x7'));var controller=require(_0xad2e('0x8'));router[_0xad2e('0x9')]('/',auth[_0xad2e('0xa')](),controller[_0xad2e('0xb')]);router['get'](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller[_0xad2e('0xd')]);router['post'](_0xad2e('0xe'),auth[_0xad2e('0xa')](),controller['clone']);router[_0xad2e('0xf')]('/',auth['isAuthenticated'](),controller[_0xad2e('0x10')]);router[_0xad2e('0x11')](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller['update']);router[_0xad2e('0x12')]('/:id',auth[_0xad2e('0xa')](),controller[_0xad2e('0x13')]);module[_0xad2e('0x14')]=router; \ No newline at end of file +var _0x0a9a=['clone','post','create','put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','/:id/clone'];(function(_0x2c69a1,_0x201903){var _0x24bb91=function(_0x3131ac){while(--_0x3131ac){_0x2c69a1['push'](_0x2c69a1['shift']());}};_0x24bb91(++_0x201903);}(_0x0a9a,0x183));var _0xa0a9=function(_0x115e18,_0xb17e8d){_0x115e18=_0x115e18-0x0;var _0x2ceab5=_0x0a9a[_0x115e18];return _0x2ceab5;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['post'](_0xa0a9('0xc'),auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xd')]);router[_0xa0a9('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0a9('0xf')]);router[_0xa0a9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x11')]);router[_0xa0a9('0x12')]('/:id',auth[_0xa0a9('0x7')](),controller['destroy']);module[_0xa0a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index a250e62..1dcfa4f 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 _0x2522=['ENUM','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','join','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]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','BOOLEAN','sequelize','STRING','name'];(function(_0x56fcfe,_0x543a44){var _0x4759f9=function(_0x5c01ec){while(--_0x5c01ec){_0x56fcfe['push'](_0x56fcfe['shift']());}};_0x4759f9(++_0x543a44);}(_0x2522,0x15b));var _0x2252=function(_0x5abf93,_0x3750cd){_0x5abf93=_0x5abf93-0x0;var _0x1a59cf=_0x2522[_0x5abf93];return _0x1a59cf;};'use strict';var Sequelize=require(_0x2252('0x0'));module['exports']={'name':{'type':Sequelize[_0x2252('0x1')],'allowNull':![],'unique':_0x2252('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x4'),'user','peer'),'allowNull':![],'defaultValue':_0x2252('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2252('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x2252('0x6'),_0x2252('0x7'),_0x2252('0x8'),_0x2252('0x9'),_0x2252('0xa'),_0x2252('0xb'),_0x2252('0xc'),_0x2252('0xd'))},'deny':{'type':Sequelize[_0x2252('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'udp','set':function(_0x2fb95f){this[_0x2252('0xe')](_0x2252('0xf'),_0x2fb95f?_0x2fb95f['join'](','):null);},'get':function(){return this[_0x2252('0x10')](_0x2252('0xf'))?this['getDataValue'](_0x2252('0xf'))[_0x2252('0x11')](','):null;},'comment':_0x2252('0x12')},'dtmfmode':{'type':Sequelize[_0x2252('0x3')]('rfc2833',_0x2252('0x13'),_0x2252('0x14'),_0x2252('0x15'),_0x2252('0x16')),'defaultValue':_0x2252('0x17')},'directmedia':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no',_0x2252('0x19'),_0x2252('0x1a'),_0x2252('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2252('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x2252('0x1')],'defaultValue':_0x2252('0x1c'),'set':function(_0x2ae7f3){this[_0x2252('0xe')](_0x2252('0x1d'),_0x2ae7f3?_0x2ae7f3[_0x2252('0x1e')](','):null);},'get':function(){return this[_0x2252('0x10')](_0x2252('0x1d'))?this[_0x2252('0x10')]('nat')[_0x2252('0x11')](','):null;},'comment':_0x2252('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2252('0x1')]},'pickupgroup':{'type':Sequelize[_0x2252('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2252('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2252('0x1')],'defaultValue':_0x2252('0x20')},'allow':{'type':Sequelize[_0x2252('0x1')],'allowNull':![],'defaultValue':_0x2252('0x21'),'set':function(_0x262db0){this[_0x2252('0xe')](_0x2252('0x22'),_0x262db0?_0x262db0['join'](';'):_0x2252('0x21'));},'get':function(){return this[_0x2252('0x10')](_0x2252('0x22'))?this[_0x2252('0x10')](_0x2252('0x22'))[_0x2252('0x11')](';'):null;},'comment':_0x2252('0x23')},'autoframing':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no')},'insecure':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'port,invite','set':function(_0x5b2971){this['setDataValue']('insecure',_0x5b2971?_0x5b2971[_0x2252('0x1e')](','):null);},'get':function(){return this[_0x2252('0x10')](_0x2252('0x24'))?this[_0x2252('0x10')]('insecure')[_0x2252('0x11')](','):null;},'comment':_0x2252('0x25')},'trustrpid':{'type':Sequelize[_0x2252('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x2252('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x2252('0x26')](0xb)},'setvar':{'type':Sequelize[_0x2252('0x1')]},'callerid':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':_0x2252('0x18')},'busylevel':{'type':Sequelize[_0x2252('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2252('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x2252('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no',_0x2252('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2252('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'mailbox':{'type':Sequelize[_0x2252('0x1')]},'session_timers':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x28'),_0x2252('0x29'),_0x2252('0x2a'))},'session_expires':{'type':Sequelize[_0x2252('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x2b'),'uas'),'defaultValue':_0x2252('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x2252('0x1')]},'regexten':{'type':Sequelize[_0x2252('0x1')]},'fromdomain':{'type':Sequelize[_0x2252('0x1')]},'fromuser':{'type':Sequelize[_0x2252('0x1')]},'port':{'type':Sequelize[_0x2252('0x26')](0x5)},'qualify':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2252('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x2252('0x1')]},'rtptimeout':{'type':Sequelize[_0x2252('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2252('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2252('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2252('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x2252('0x26')](0xb)},'timerb':{'type':Sequelize[_0x2252('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2252('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x2252('0x1')]},'contactdeny':{'type':Sequelize[_0x2252('0x1')]},'contactacl':{'type':Sequelize[_0x2252('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x2252('0x1')]},'use_q850_reason':{'type':Sequelize[_0x2252('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x2252('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'force_avp':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no','fingerprint',_0x2252('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x2252('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2252('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2252('0x1')]},'dtlscapath':{'type':Sequelize[_0x2252('0x1')]},'dtlssetup':{'type':Sequelize[_0x2252('0x3')]('active',_0x2252('0x2e'),_0x2252('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2252('0x1')]},'usereqphone':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2252('0x1')]},'call_limit':{'type':Sequelize[_0x2252('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2252('0x1')]},'mohsuggest':{'type':Sequelize[_0x2252('0x1')]},'parkinglot':{'type':Sequelize[_0x2252('0x1')]},'description':{'type':Sequelize[_0x2252('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no',_0x2252('0x19'),_0x2252('0x1a'),_0x2252('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2252('0x1')]},'otherFields':{'type':Sequelize[_0x2252('0x1')]},'active':{'type':Sequelize[_0x2252('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xee62=['transport','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join'];(function(_0x4a9b0e,_0x13ae85){var _0x4e83a9=function(_0x597fa4){while(--_0x597fa4){_0x4a9b0e['push'](_0x4a9b0e['shift']());}};_0x4e83a9(++_0x13ae85);}(_0xee62,0x12c));var _0x2ee6=function(_0xe82fdc,_0x542530){_0xe82fdc=_0xe82fdc-0x0;var _0x266382=_0xee62[_0xe82fdc];return _0x266382;};'use strict';var Sequelize=require(_0x2ee6('0x0'));module[_0x2ee6('0x1')]={'name':{'type':Sequelize[_0x2ee6('0x2')],'allowNull':![],'unique':_0x2ee6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2ee6('0x4'),_0x2ee6('0x5'),_0x2ee6('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2ee6('0x7')},'callingpres':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x9'),_0x2ee6('0xa'),_0x2ee6('0xb'),'ALLOWED','PROHIB_NOT_SCREENED',_0x2ee6('0xc'),_0x2ee6('0xd'),_0x2ee6('0xe'))},'deny':{'type':Sequelize[_0x2ee6('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x2ee6('0x2')]},'md5secret':{'type':Sequelize[_0x2ee6('0x2')]},'remotesecret':{'type':Sequelize[_0x2ee6('0x2')]},'transport':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':_0x2ee6('0xf'),'set':function(_0x55f0c8){this[_0x2ee6('0x10')]('transport',_0x55f0c8?_0x55f0c8[_0x2ee6('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x2ee6('0x12'))?this[_0x2ee6('0x13')](_0x2ee6('0x12'))[_0x2ee6('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x2ee6('0x15'),_0x2ee6('0x16'),_0x2ee6('0x17'),_0x2ee6('0x18'),_0x2ee6('0x19')),'defaultValue':_0x2ee6('0x15')},'directmedia':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no',_0x2ee6('0x1b'),_0x2ee6('0x1c'),_0x2ee6('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2ee6('0x2')]},'directmediadeny':{'type':Sequelize[_0x2ee6('0x2')]},'nat':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':_0x2ee6('0x1e'),'set':function(_0x3d6f84){this['setDataValue'](_0x2ee6('0x1f'),_0x3d6f84?_0x3d6f84[_0x2ee6('0x11')](','):null);},'get':function(){return this[_0x2ee6('0x13')](_0x2ee6('0x1f'))?this[_0x2ee6('0x13')]('nat')[_0x2ee6('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x2ee6('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2ee6('0x2')]},'pickupgroup':{'type':Sequelize[_0x2ee6('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2ee6('0x2')]},'language':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2ee6('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2ee6('0x20')},'allow':{'type':Sequelize[_0x2ee6('0x2')],'allowNull':![],'defaultValue':_0x2ee6('0x21'),'set':function(_0x3536d5){this[_0x2ee6('0x10')](_0x2ee6('0x22'),_0x3536d5?_0x3536d5[_0x2ee6('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x2ee6('0x22'))?this[_0x2ee6('0x13')](_0x2ee6('0x22'))[_0x2ee6('0x14')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'insecure':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':_0x2ee6('0x23'),'set':function(_0x1a4f11){this[_0x2ee6('0x10')](_0x2ee6('0x24'),_0x1a4f11?_0x1a4f11[_0x2ee6('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x2ee6('0x24'))?this[_0x2ee6('0x13')](_0x2ee6('0x24'))[_0x2ee6('0x14')](','):null;},'comment':_0x2ee6('0x25')},'trustrpid':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no',_0x2ee6('0x26'))},'promiscredir':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x2ee6('0x2')]},'callerid':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':_0x2ee6('0x27')},'amaflags':{'type':Sequelize[_0x2ee6('0x2')]},'callcounter':{'type':Sequelize[_0x2ee6('0x8')]('yes','no'),'defaultValue':_0x2ee6('0x1a')},'busylevel':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0x2ee6('0x8')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x2ee6('0x8')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x2ee6('0x2')]},'template':{'type':Sequelize[_0x2ee6('0x2')]},'videosupport':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no',_0x2ee6('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x2ee6('0x2')]},'session_timers':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x2a'),_0x2ee6('0x2b'),_0x2ee6('0x2c'))},'session_expires':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2ee6('0x2d'),_0x2ee6('0x2e')),'defaultValue':_0x2ee6('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0x2ee6('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x2ee6('0x2')]},'port':{'type':Sequelize[_0x2ee6('0x28')](0x5)},'qualify':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':_0x2ee6('0x1a')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x2ee6('0x2')]},'defaultuser':{'type':Sequelize[_0x2ee6('0x2')]},'rtptimeout':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2ee6('0x2')]},'callbackextension':{'type':Sequelize[_0x2ee6('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x2ee6('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2ee6('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2ee6('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2ee6('0x2')]},'maxforwards':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'encryption':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2ee6('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2ee6('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2ee6('0x2')]},'dtlscapath':{'type':Sequelize[_0x2ee6('0x2')]},'dtlssetup':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x2f'),_0x2ee6('0x30'),_0x2ee6('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2ee6('0x2')]},'recordofffeature':{'type':Sequelize[_0x2ee6('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x2ee6('0x2')]},'mohinterpret':{'type':Sequelize[_0x2ee6('0x2')]},'mohsuggest':{'type':Sequelize[_0x2ee6('0x2')]},'parkinglot':{'type':Sequelize[_0x2ee6('0x2')]},'description':{'type':Sequelize[_0x2ee6('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2ee6('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no',_0x2ee6('0x1b'),_0x2ee6('0x1c'),_0x2ee6('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2ee6('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2ee6('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 5697caf..8ed6622 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 _0x0c1a=['count','offset','limit','set','apply','reject','destroy','Trunks','UserProfileResource','end','stack','send','index','map','Trunk','type','key','model','query','filters','attributes','intersection','nolimit','order','sort','where','pick','merge','filter','include','findAll','rows','show','keys','rawAttributes','fields','length','includeAll','options','find','catch','clone','params','get','omit','createdAt','updatedAt','body','user','UserProfileSection','userProfileId','autoAssociation','create','name','readFileSync','join','root','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','update','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','json'];(function(_0x591707,_0x44302b){var _0x3df29c=function(_0x310ee2){while(--_0x310ee2){_0x591707['push'](_0x591707['shift']());}};_0x3df29c(++_0x44302b);}(_0x0c1a,0x127));var _0xa0c1=function(_0x30ffde,_0x4e07a4){_0x30ffde=_0x30ffde-0x0;var _0x16c4cd=_0x0c1a[_0x30ffde];return _0x16c4cd;};'use strict';var pdf=require(_0xa0c1('0x0'));var emlformat=require(_0xa0c1('0x1'));var rimraf=require(_0xa0c1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa0c1('0x3'));var moment=require('moment');var BPromise=require(_0xa0c1('0x4'));var Mustache=require(_0xa0c1('0x5'));var util=require(_0xa0c1('0x6'));var path=require(_0xa0c1('0x7'));var sox=require(_0xa0c1('0x8'));var csv=require(_0xa0c1('0x9'));var ejs=require(_0xa0c1('0xa'));var fs=require('fs');var _=require(_0xa0c1('0xb'));var squel=require(_0xa0c1('0xc'));var crypto=require(_0xa0c1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa0c1('0xe'));var toCsv=require(_0xa0c1('0x9'));var querystring=require(_0xa0c1('0xf'));var Papa=require(_0xa0c1('0x10'));var Redis=require(_0xa0c1('0x11'));var authService=require(_0xa0c1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa0c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0c1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa0c1('0x15'));var db=require(_0xa0c1('0x16'))['db'];var jayson=require(_0xa0c1('0x17'));var client=jayson['client'][_0xa0c1('0x18')]({'port':0x232a});function checkPasswordPattern(_0xd201d8,_0x2a453b,_0xc4de3b){if(_0xc4de3b){var _0x1cafb2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cafb2[_0xa0c1('0x19')](_0x2a453b)){return _0xd201d8;}else{throw new db['Sequelize']['ValidationError'](_0xa0c1('0x1a'));}}else{return _0xd201d8;}}function respondWithRpcPromise(_0x35c8fd,_0x11e1f4,_0xf87af8,_0x10f3dc){return new BPromise(function(_0x4813ba,_0x5ca8f3){var _0x3f70a4=_0x10f3dc||client;return _0x3f70a4[_0xa0c1('0x1b')](_0x35c8fd,_0xf87af8)[_0xa0c1('0x1c')](function(_0x458137){logger['info'](_0xa0c1('0x1d'),_0x11e1f4,'request\x20sent');logger[_0xa0c1('0x1e')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11e1f4,_0xa0c1('0x1f'),JSON[_0xa0c1('0x20')](_0x458137));if(_0x458137[_0xa0c1('0x21')]){if(_0x458137[_0xa0c1('0x21')][_0xa0c1('0x22')]===0x1f4){logger['error'](_0xa0c1('0x1d'),_0x11e1f4,_0x458137[_0xa0c1('0x21')][_0xa0c1('0x23')]);return _0x5ca8f3(_0x458137[_0xa0c1('0x21')][_0xa0c1('0x23')]);}logger['error'](_0xa0c1('0x1d'),_0x11e1f4,_0x458137[_0xa0c1('0x21')][_0xa0c1('0x23')]);return _0x4813ba(_0x458137['error'][_0xa0c1('0x23')]);}else{logger[_0xa0c1('0x24')]('Trunk,\x20%s,\x20%s',_0x11e1f4,'request\x20sent');_0x4813ba(_0x458137[_0xa0c1('0x25')][_0xa0c1('0x23')]);}})['catch'](function(_0x2efcfc){logger[_0xa0c1('0x21')](_0xa0c1('0x1d'),_0x11e1f4,_0x2efcfc);_0x5ca8f3(_0x2efcfc);});});}function respondWithStatusCode(_0x408538,_0x483936){_0x483936=_0x483936||0xcc;return function(_0x1861d5){if(_0x1861d5){return _0x408538[_0xa0c1('0x26')](_0x483936);}return _0x408538[_0xa0c1('0x27')](_0x483936)['end']();};}function respondWithResult(_0x30c757,_0x2fdcbe){_0x2fdcbe=_0x2fdcbe||0xc8;return function(_0x20344b){if(_0x20344b){return _0x30c757[_0xa0c1('0x27')](_0x2fdcbe)[_0xa0c1('0x28')](_0x20344b);}};}function respondWithFilteredResult(_0x49530b,_0x4a5d0b){return function(_0x43e519){if(_0x43e519){var _0x369919=_0x43e519[_0xa0c1('0x29')],_0x3be9e2=_0x4a5d0b[_0xa0c1('0x2a')],_0x28f16c=_0x4a5d0b[_0xa0c1('0x2a')]+_0x4a5d0b[_0xa0c1('0x2b')],_0x26a286;if(_0x28f16c>=_0x369919){_0x28f16c=_0x369919;_0x26a286=0xc8;}else{_0x26a286=0xce;}_0x49530b[_0xa0c1('0x27')](_0x26a286);return _0x49530b[_0xa0c1('0x2c')]('Content-Range',_0x3be9e2+'-'+_0x28f16c+'/'+_0x369919)[_0xa0c1('0x28')](_0x43e519);}return null;};}function patchUpdates(_0x49fd04){return function(_0xcd1f57){try{jsonpatch[_0xa0c1('0x2d')](_0xcd1f57,_0x49fd04,!![]);}catch(_0x5d3344){return BPromise[_0xa0c1('0x2e')](_0x5d3344);}return _0xcd1f57['save']();};}function saveUpdates(_0x28fb4e,_0x4e4498){return function(_0x575e98){if(_0x575e98){return _0x575e98['update'](_0x28fb4e)['then'](function(_0x123318){return _0x123318;});}return null;};}function removeEntity(_0x3cc3bf,_0x1db772){return function(_0xc2252c){if(_0xc2252c){return _0xc2252c[_0xa0c1('0x2f')]()[_0xa0c1('0x1c')](function(){var _0x31a7fd=_0xc2252c['get']({'plain':!![]});var _0x34410b=_0xa0c1('0x30');return db[_0xa0c1('0x31')][_0xa0c1('0x2f')]({'where':{'type':_0x34410b,'resourceId':_0x31a7fd['id']}})[_0xa0c1('0x1c')](function(){return _0xc2252c;});})[_0xa0c1('0x1c')](function(){_0x3cc3bf[_0xa0c1('0x27')](0xcc)[_0xa0c1('0x32')]();});}};}function handleEntityNotFound(_0x49fa0e,_0x38fcbb){return function(_0x48ca75){if(!_0x48ca75){_0x49fa0e[_0xa0c1('0x26')](0x194);}return _0x48ca75;};}function handleError(_0x2f025b,_0x4d52f9){_0x4d52f9=_0x4d52f9||0x1f4;return function(_0xbea0a){logger[_0xa0c1('0x21')](_0xbea0a[_0xa0c1('0x33')]);if(_0xbea0a['name']){delete _0xbea0a['name'];}_0x2f025b[_0xa0c1('0x27')](_0x4d52f9)[_0xa0c1('0x34')](_0xbea0a);};}exports[_0xa0c1('0x35')]=function(_0x3565f7,_0x527d0b){var _0x2c5ef3={},_0x4bfcc6={},_0x263e53={'count':0x0,'rows':[]};var _0x2542d8=_[_0xa0c1('0x36')](db[_0xa0c1('0x37')]['rawAttributes'],function(_0x24ab3d){return{'name':_0x24ab3d['fieldName'],'type':_0x24ab3d[_0xa0c1('0x38')][_0xa0c1('0x39')]};});_0x4bfcc6[_0xa0c1('0x3a')]=_[_0xa0c1('0x36')](_0x2542d8,'name');_0x4bfcc6[_0xa0c1('0x3b')]=_['keys'](_0x3565f7[_0xa0c1('0x3b')]);_0x4bfcc6[_0xa0c1('0x3c')]=_['intersection'](_0x4bfcc6[_0xa0c1('0x3a')],_0x4bfcc6[_0xa0c1('0x3b')]);_0x2c5ef3[_0xa0c1('0x3d')]=_[_0xa0c1('0x3e')](_0x4bfcc6[_0xa0c1('0x3a')],qs['fields'](_0x3565f7[_0xa0c1('0x3b')]['fields']));_0x2c5ef3[_0xa0c1('0x3d')]=_0x2c5ef3[_0xa0c1('0x3d')]['length']?_0x2c5ef3[_0xa0c1('0x3d')]:_0x4bfcc6['model'];if(!_0x3565f7[_0xa0c1('0x3b')]['hasOwnProperty'](_0xa0c1('0x3f'))){_0x2c5ef3[_0xa0c1('0x2b')]=qs[_0xa0c1('0x2b')](_0x3565f7[_0xa0c1('0x3b')][_0xa0c1('0x2b')]);_0x2c5ef3[_0xa0c1('0x2a')]=qs[_0xa0c1('0x2a')](_0x3565f7['query'][_0xa0c1('0x2a')]);}_0x2c5ef3[_0xa0c1('0x40')]=qs['sort'](_0x3565f7['query'][_0xa0c1('0x41')]);_0x2c5ef3[_0xa0c1('0x42')]=qs[_0xa0c1('0x3c')](_[_0xa0c1('0x43')](_0x3565f7['query'],_0x4bfcc6[_0xa0c1('0x3c')]),_0x2542d8);if(_0x3565f7['query']['filter']){_0x2c5ef3[_0xa0c1('0x42')]=_[_0xa0c1('0x44')](_0x2c5ef3['where'],{'$or':_[_0xa0c1('0x36')](_0x2542d8,function(_0x489426){if(_0x489426[_0xa0c1('0x38')]!=='VIRTUAL'){var _0xe5a1fc={};_0xe5a1fc[_0x489426['name']]={'$like':'%'+_0x3565f7[_0xa0c1('0x3b')][_0xa0c1('0x45')]+'%'};return _0xe5a1fc;}})});}_0x2c5ef3=_[_0xa0c1('0x44')]({},_0x2c5ef3,_0x3565f7['options']);var _0x1ea033={'where':_0x2c5ef3[_0xa0c1('0x42')]};return db[_0xa0c1('0x37')][_0xa0c1('0x29')](_0x1ea033)[_0xa0c1('0x1c')](function(_0x1048b0){_0x263e53[_0xa0c1('0x29')]=_0x1048b0;if(_0x3565f7[_0xa0c1('0x3b')]['includeAll']){_0x2c5ef3[_0xa0c1('0x46')]=[{'all':!![]}];}return db['Trunk'][_0xa0c1('0x47')](_0x2c5ef3);})['then'](function(_0x5479d7){_0x263e53[_0xa0c1('0x48')]=_0x5479d7;return _0x263e53;})[_0xa0c1('0x1c')](respondWithFilteredResult(_0x527d0b,_0x2c5ef3))['catch'](handleError(_0x527d0b,null));};exports[_0xa0c1('0x49')]=function(_0x5df18c,_0x2c3416){var _0x2b09c3={'raw':![],'where':{'id':_0x5df18c['params']['id']}},_0x559a9c={};_0x559a9c['model']=_[_0xa0c1('0x4a')](db['Trunk'][_0xa0c1('0x4b')]);_0x559a9c['query']=_[_0xa0c1('0x4a')](_0x5df18c[_0xa0c1('0x3b')]);_0x559a9c[_0xa0c1('0x3c')]=_[_0xa0c1('0x3e')](_0x559a9c[_0xa0c1('0x3a')],_0x559a9c[_0xa0c1('0x3b')]);_0x2b09c3[_0xa0c1('0x3d')]=_[_0xa0c1('0x3e')](_0x559a9c[_0xa0c1('0x3a')],qs[_0xa0c1('0x4c')](_0x5df18c[_0xa0c1('0x3b')][_0xa0c1('0x4c')]));_0x2b09c3[_0xa0c1('0x3d')]=_0x2b09c3['attributes'][_0xa0c1('0x4d')]?_0x2b09c3[_0xa0c1('0x3d')]:_0x559a9c[_0xa0c1('0x3a')];if(_0x5df18c[_0xa0c1('0x3b')][_0xa0c1('0x4e')]){_0x2b09c3[_0xa0c1('0x46')]=[{'all':!![]}];}_0x2b09c3=_[_0xa0c1('0x44')]({},_0x2b09c3,_0x5df18c[_0xa0c1('0x4f')]);return db[_0xa0c1('0x37')][_0xa0c1('0x50')](_0x2b09c3)[_0xa0c1('0x1c')](handleEntityNotFound(_0x2c3416,null))[_0xa0c1('0x1c')](respondWithResult(_0x2c3416,null))[_0xa0c1('0x51')](handleError(_0x2c3416,null));};exports[_0xa0c1('0x52')]=function(_0x2fa897,_0x280d8b){var _0x212902={'where':{'id':_0x2fa897[_0xa0c1('0x53')]['id']}},_0x7fc4be={};_0x7fc4be[_0xa0c1('0x3a')]=_[_0xa0c1('0x4a')](db['Trunk'][_0xa0c1('0x4b')]);_0x212902[_0xa0c1('0x3d')]=_[_0xa0c1('0x3e')](_0x7fc4be[_0xa0c1('0x3a')],qs['fields'](_0x2fa897[_0xa0c1('0x3b')][_0xa0c1('0x4c')]));_0x212902[_0xa0c1('0x3d')]=_0x212902['attributes'][_0xa0c1('0x4d')]?_0x212902[_0xa0c1('0x3d')]:_0x7fc4be[_0xa0c1('0x3a')];if(_0x2fa897[_0xa0c1('0x3b')][_0xa0c1('0x4e')]){_0x212902[_0xa0c1('0x46')]=[{'all':!![]}];}_0x212902=_[_0xa0c1('0x44')]({},_0x212902,_0x2fa897['options']);return db['Trunk']['find'](_0x212902)[_0xa0c1('0x1c')](handleEntityNotFound(_0x280d8b,null))[_0xa0c1('0x1c')](function(_0x3e7375){if(_0x3e7375){var _0x24a32e=_0x3e7375[_0xa0c1('0x54')]({'plain':!![]});_0x24a32e=qs[_0xa0c1('0x55')](_0x24a32e,['id',_0xa0c1('0x56'),_0xa0c1('0x57')]);_0x2fa897[_0xa0c1('0x58')]=_[_0xa0c1('0x55')](_0x2fa897[_0xa0c1('0x58')],['id',_0xa0c1('0x56'),_0xa0c1('0x57')]);return db['Trunk']['create'](_[_0xa0c1('0x44')](_0x24a32e,_0x2fa897['body']),{'include':_0x2fa897[_0xa0c1('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xa0c1('0x1c')](function(_0x22cef2){var _0x291230=_0x2fa897['user'][_0xa0c1('0x54')]({'plain':!![]});if(!_0x291230)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x291230['role']===_0xa0c1('0x59')){var _0x48753a=_0x22cef2[_0xa0c1('0x54')]({'plain':!![]});var _0x1820ef=_0xa0c1('0x30');return db[_0xa0c1('0x5a')]['find']({'where':{'name':_0x1820ef,'userProfileId':_0x291230[_0xa0c1('0x5b')]},'raw':!![]})[_0xa0c1('0x1c')](function(_0x1e3a9f){if(_0x1e3a9f&&_0x1e3a9f[_0xa0c1('0x5c')]===0x0){return db['UserProfileResource'][_0xa0c1('0x5d')]({'name':_0x48753a[_0xa0c1('0x5e')],'resourceId':_0x48753a['id'],'type':_0x1e3a9f[_0xa0c1('0x5e')],'sectionId':_0x1e3a9f['id']},{})[_0xa0c1('0x1c')](function(){return _0x22cef2;});}else{return _0x22cef2;}})[_0xa0c1('0x51')](function(_0x4d55ed){logger[_0xa0c1('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d55ed);throw _0x4d55ed;});}return _0x22cef2;});}})['then'](respondWithResult(_0x280d8b,0xc9))['catch'](handleError(_0x280d8b,null));};exports['create']=function(_0x587f0c,_0x774926,_0x2dbd81){var _0x1e4b6e;return db[_0xa0c1('0x37')]['create'](_0x587f0c[_0xa0c1('0x58')],{'raw':!![]})[_0xa0c1('0x1c')](function(_0x13ebb0){_0x1e4b6e=_0x13ebb0;return db[_0xa0c1('0x37')][_0xa0c1('0x47')]({'raw':!![]});})['then'](function(_0x6df200){var _0x4dd640=fs[_0xa0c1('0x5f')](path[_0xa0c1('0x60')](config[_0xa0c1('0x61')],'server/files/templates/trunk.ejs'),_0xa0c1('0x62'));var _0x416404=fs[_0xa0c1('0x5f')](path[_0xa0c1('0x60')](config['root'],_0xa0c1('0x63')),_0xa0c1('0x62'));var _0x2452ed=ejs[_0xa0c1('0x64')](_0x4dd640,{'trunks':_0x6df200||[]});fs[_0xa0c1('0x65')](_0xa0c1('0x66'),_0x2452ed);if(_0x1e4b6e[_0xa0c1('0x67')]){var _0x14d7fe=ejs[_0xa0c1('0x64')](_0x416404,{'trunks':_0x6df200||[]});fs['writeFileSync'](_0xa0c1('0x68'),_0x14d7fe);}})[_0xa0c1('0x1c')](function(){return respondWithRpcPromise(_0xa0c1('0x69'),_0xa0c1('0x5d'),{'module':_0xa0c1('0x6a')});})[_0xa0c1('0x1c')](function(){var _0x5f3e53=_0x587f0c['user'][_0xa0c1('0x54')]({'plain':!![]});if(!_0x5f3e53)throw new Error(_0xa0c1('0x6b'));if(_0x5f3e53[_0xa0c1('0x6c')]===_0xa0c1('0x59')){var _0xf336=_0x1e4b6e[_0xa0c1('0x54')]({'plain':!![]});return db[_0xa0c1('0x5a')][_0xa0c1('0x50')]({'where':{'name':_0xa0c1('0x30'),'userProfileId':_0x5f3e53[_0xa0c1('0x5b')]},'raw':!![]})[_0xa0c1('0x1c')](function(_0x4f3db4){if(_0x4f3db4&&_0x4f3db4[_0xa0c1('0x5c')]===0x0){return db[_0xa0c1('0x31')][_0xa0c1('0x5d')]({'name':_0xf336[_0xa0c1('0x5e')],'resourceId':_0xf336['id'],'type':_0x4f3db4['name'],'sectionId':_0x4f3db4['id']},{})[_0xa0c1('0x1c')](function(){return _0x1e4b6e;});}else{return _0x1e4b6e;}})[_0xa0c1('0x51')](function(_0x4ef956){logger['error'](_0xa0c1('0x6d'),_0x4ef956);throw _0x4ef956;});}return _0x1e4b6e;})[_0xa0c1('0x1c')](respondWithResult(_0x774926,0xc9))[_0xa0c1('0x51')](handleError(_0x774926,null));};exports['update']=function(_0x280795,_0x19024a,_0x394942){var _0x530b30;return db[_0xa0c1('0x37')][_0xa0c1('0x50')]({'where':{'id':_0x280795[_0xa0c1('0x53')]['id']}})['then'](handleEntityNotFound(_0x19024a,null))[_0xa0c1('0x1c')](saveUpdates(_0x280795[_0xa0c1('0x58')],null))[_0xa0c1('0x1c')](function(_0x25eb52){if(_0x25eb52){_0x530b30=_0x25eb52;return db[_0xa0c1('0x37')][_0xa0c1('0x47')]({'raw':!![]});}})[_0xa0c1('0x1c')](function(_0x4d0bc7){if(_0x4d0bc7){var _0x55676f=fs[_0xa0c1('0x5f')](path['join'](config[_0xa0c1('0x61')],_0xa0c1('0x6e')),_0xa0c1('0x62'));var _0x20dfd3=fs[_0xa0c1('0x5f')](path[_0xa0c1('0x60')](config['root'],_0xa0c1('0x63')),'utf8');var _0x3f064d=ejs[_0xa0c1('0x64')](_0x55676f,{'trunks':_0x4d0bc7||[]});fs[_0xa0c1('0x65')](_0xa0c1('0x66'),_0x3f064d);var _0x4ad0ff=ejs[_0xa0c1('0x64')](_0x20dfd3,{'trunks':_0x4d0bc7||[]});fs['writeFileSync'](_0xa0c1('0x68'),_0x4ad0ff);return respondWithRpcPromise(_0xa0c1('0x69'),_0xa0c1('0x6f'),{'module':_0xa0c1('0x6a')});}return null;})[_0xa0c1('0x1c')](function(_0x26db4d){if(_0x26db4d){return _0x530b30;}})[_0xa0c1('0x1c')](respondWithResult(_0x19024a,null))[_0xa0c1('0x51')](handleError(_0x19024a,null));};exports[_0xa0c1('0x2f')]=function(_0x449dd1,_0x2b186d,_0x3e711a){var _0x3200ff;return db['Trunk'][_0xa0c1('0x50')]({'where':{'id':_0x449dd1[_0xa0c1('0x53')]['id']}})[_0xa0c1('0x1c')](handleEntityNotFound(_0x2b186d,null))['then'](removeEntity(_0x2b186d,null))[_0xa0c1('0x1c')](function(){return db['Trunk'][_0xa0c1('0x47')]({'raw':!![]});})['then'](function(_0x45ef2f){var _0x2bbb2a=fs[_0xa0c1('0x5f')](path['join'](config[_0xa0c1('0x61')],'server/files/templates/trunk.ejs'),'utf8');var _0xe520e5=fs[_0xa0c1('0x5f')](path['join'](config[_0xa0c1('0x61')],_0xa0c1('0x63')),_0xa0c1('0x62'));var _0x3435c4=ejs['render'](_0x2bbb2a,{'trunks':_0x45ef2f});var _0x9e7281=ejs[_0xa0c1('0x64')](_0xe520e5,{'trunks':_0x45ef2f});fs[_0xa0c1('0x65')](_0xa0c1('0x66'),_0x3435c4);fs[_0xa0c1('0x65')](_0xa0c1('0x68'),_0x9e7281);return respondWithRpcPromise('Reload',_0xa0c1('0x2f'),{'module':_0xa0c1('0x6a')});})[_0xa0c1('0x51')](handleError(_0x2b186d,null));}; \ No newline at end of file +var _0x8227=['ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','apply','save','destroy','Trunks','UserProfileResource','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','Trunk','includeAll','include','findAll','rows','show','params','options','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','readFileSync','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x506e5d,_0x5a8473){var _0x458646=function(_0x2a9219){while(--_0x2a9219){_0x506e5d['push'](_0x506e5d['shift']());}};_0x458646(++_0x5a8473);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7822('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7822('0x1'));var jsonpatch=require(_0x7822('0x2'));var rp=require(_0x7822('0x3'));var moment=require(_0x7822('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7822('0x5'));var util=require(_0x7822('0x6'));var path=require(_0x7822('0x7'));var sox=require(_0x7822('0x8'));var csv=require(_0x7822('0x9'));var ejs=require(_0x7822('0xa'));var fs=require('fs');var _=require(_0x7822('0xb'));var squel=require(_0x7822('0xc'));var crypto=require('crypto');var jsforce=require(_0x7822('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7822('0x9'));var querystring=require(_0x7822('0xe'));var Papa=require(_0x7822('0xf'));var Redis=require(_0x7822('0x10'));var authService=require(_0x7822('0x11'));var qs=require(_0x7822('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7822('0x13'))('api');var utils=require(_0x7822('0x14'));var config=require(_0x7822('0x15'));var db=require(_0x7822('0x16'))['db'];var jayson=require(_0x7822('0x17'));var client=jayson[_0x7822('0x18')][_0x7822('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5e4623,_0x58f462,_0xb0b5c){if(_0xb0b5c){var _0x10703c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10703c['test'](_0x58f462)){return _0x5e4623;}else{throw new db[(_0x7822('0x1a'))][(_0x7822('0x1b'))](_0x7822('0x1c'));}}else{return _0x5e4623;}}function respondWithRpcPromise(_0x438b8d,_0x411d99,_0x5c13de,_0x4a8b06){return new BPromise(function(_0x154c49,_0x228381){var _0x65b961=_0x4a8b06||client;return _0x65b961[_0x7822('0x1d')](_0x438b8d,_0x5c13de)[_0x7822('0x1e')](function(_0x9ec4ee){logger[_0x7822('0x1f')](_0x7822('0x20'),_0x411d99,_0x7822('0x21'));logger[_0x7822('0x22')](_0x7822('0x23'),_0x411d99,_0x7822('0x21'),JSON[_0x7822('0x24')](_0x9ec4ee));if(_0x9ec4ee[_0x7822('0x25')]){if(_0x9ec4ee[_0x7822('0x25')][_0x7822('0x26')]===0x1f4){logger['error'](_0x7822('0x20'),_0x411d99,_0x9ec4ee[_0x7822('0x25')][_0x7822('0x27')]);return _0x228381(_0x9ec4ee[_0x7822('0x25')][_0x7822('0x27')]);}logger['error'](_0x7822('0x20'),_0x411d99,_0x9ec4ee['error']['message']);return _0x154c49(_0x9ec4ee[_0x7822('0x25')][_0x7822('0x27')]);}else{logger[_0x7822('0x1f')](_0x7822('0x20'),_0x411d99,'request\x20sent');_0x154c49(_0x9ec4ee['result'][_0x7822('0x27')]);}})[_0x7822('0x28')](function(_0x12e581){logger['error'](_0x7822('0x20'),_0x411d99,_0x12e581);_0x228381(_0x12e581);});});}function respondWithStatusCode(_0x202c97,_0x47c424){_0x47c424=_0x47c424||0xcc;return function(_0x4bbcae){if(_0x4bbcae){return _0x202c97[_0x7822('0x29')](_0x47c424);}return _0x202c97[_0x7822('0x2a')](_0x47c424)['end']();};}function respondWithResult(_0x20bc5a,_0xef55f2){_0xef55f2=_0xef55f2||0xc8;return function(_0x30d46d){if(_0x30d46d){return _0x20bc5a[_0x7822('0x2a')](_0xef55f2)[_0x7822('0x2b')](_0x30d46d);}};}function respondWithFilteredResult(_0x324258,_0x54aa99){return function(_0x2dd015){if(_0x2dd015){var _0x190cb2=_0x2dd015[_0x7822('0x2c')],_0x19173e=_0x54aa99[_0x7822('0x2d')],_0x8ce726=_0x54aa99[_0x7822('0x2d')]+_0x54aa99[_0x7822('0x2e')],_0x3df5ff;if(_0x8ce726>=_0x190cb2){_0x8ce726=_0x190cb2;_0x3df5ff=0xc8;}else{_0x3df5ff=0xce;}_0x324258['status'](_0x3df5ff);return _0x324258['set']('Content-Range',_0x19173e+'-'+_0x8ce726+'/'+_0x190cb2)[_0x7822('0x2b')](_0x2dd015);}return null;};}function patchUpdates(_0x2fe314){return function(_0x53e41a){try{jsonpatch[_0x7822('0x2f')](_0x53e41a,_0x2fe314,!![]);}catch(_0x1b072f){return BPromise['reject'](_0x1b072f);}return _0x53e41a[_0x7822('0x30')]();};}function saveUpdates(_0xe6e88,_0x11c9c4){return function(_0x56b2fb){if(_0x56b2fb){return _0x56b2fb['update'](_0xe6e88)[_0x7822('0x1e')](function(_0x48b1df){return _0x48b1df;});}return null;};}function removeEntity(_0x4792f5,_0x22357a){return function(_0x54544b){if(_0x54544b){return _0x54544b[_0x7822('0x31')]()[_0x7822('0x1e')](function(){var _0x188702=_0x54544b['get']({'plain':!![]});var _0x37a9c8=_0x7822('0x32');return db[_0x7822('0x33')][_0x7822('0x31')]({'where':{'type':_0x37a9c8,'resourceId':_0x188702['id']}})[_0x7822('0x1e')](function(){return _0x54544b;});})[_0x7822('0x1e')](function(){_0x4792f5[_0x7822('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2b1f,_0x2746fb){return function(_0x1d9ef8){if(!_0x1d9ef8){_0x1c2b1f[_0x7822('0x29')](0x194);}return _0x1d9ef8;};}function handleError(_0x4481c0,_0x47b3bf){_0x47b3bf=_0x47b3bf||0x1f4;return function(_0x5cf6a3){logger[_0x7822('0x25')](_0x5cf6a3['stack']);if(_0x5cf6a3[_0x7822('0x34')]){delete _0x5cf6a3[_0x7822('0x34')];}_0x4481c0[_0x7822('0x2a')](_0x47b3bf)[_0x7822('0x35')](_0x5cf6a3);};}exports['index']=function(_0x569434,_0x1dceac){var _0x33f4ab={},_0x5a6cf0={},_0x7399f5={'count':0x0,'rows':[]};var _0x44fced=_['map'](db['Trunk'][_0x7822('0x36')],function(_0x41d628){return{'name':_0x41d628[_0x7822('0x37')],'type':_0x41d628['type'][_0x7822('0x38')]};});_0x5a6cf0[_0x7822('0x39')]=_[_0x7822('0x3a')](_0x44fced,_0x7822('0x34'));_0x5a6cf0[_0x7822('0x3b')]=_[_0x7822('0x3c')](_0x569434['query']);_0x5a6cf0[_0x7822('0x3d')]=_[_0x7822('0x3e')](_0x5a6cf0[_0x7822('0x39')],_0x5a6cf0[_0x7822('0x3b')]);_0x33f4ab[_0x7822('0x3f')]=_['intersection'](_0x5a6cf0[_0x7822('0x39')],qs[_0x7822('0x40')](_0x569434[_0x7822('0x3b')][_0x7822('0x40')]));_0x33f4ab['attributes']=_0x33f4ab[_0x7822('0x3f')][_0x7822('0x41')]?_0x33f4ab['attributes']:_0x5a6cf0[_0x7822('0x39')];if(!_0x569434[_0x7822('0x3b')][_0x7822('0x42')](_0x7822('0x43'))){_0x33f4ab[_0x7822('0x2e')]=qs[_0x7822('0x2e')](_0x569434['query'][_0x7822('0x2e')]);_0x33f4ab[_0x7822('0x2d')]=qs['offset'](_0x569434[_0x7822('0x3b')]['offset']);}_0x33f4ab[_0x7822('0x44')]=qs[_0x7822('0x45')](_0x569434[_0x7822('0x3b')][_0x7822('0x45')]);_0x33f4ab[_0x7822('0x46')]=qs[_0x7822('0x3d')](_[_0x7822('0x47')](_0x569434[_0x7822('0x3b')],_0x5a6cf0[_0x7822('0x3d')]),_0x44fced);if(_0x569434['query']['filter']){_0x33f4ab[_0x7822('0x46')]=_['merge'](_0x33f4ab['where'],{'$or':_[_0x7822('0x3a')](_0x44fced,function(_0xf82992){if(_0xf82992[_0x7822('0x48')]!==_0x7822('0x49')){var _0x384061={};_0x384061[_0xf82992[_0x7822('0x34')]]={'$like':'%'+_0x569434[_0x7822('0x3b')][_0x7822('0x4a')]+'%'};return _0x384061;}})});}_0x33f4ab=_[_0x7822('0x4b')]({},_0x33f4ab,_0x569434['options']);var _0x39c79c={'where':_0x33f4ab[_0x7822('0x46')]};return db[_0x7822('0x4c')][_0x7822('0x2c')](_0x39c79c)[_0x7822('0x1e')](function(_0x3c1707){_0x7399f5['count']=_0x3c1707;if(_0x569434[_0x7822('0x3b')][_0x7822('0x4d')]){_0x33f4ab[_0x7822('0x4e')]=[{'all':!![]}];}return db[_0x7822('0x4c')][_0x7822('0x4f')](_0x33f4ab);})[_0x7822('0x1e')](function(_0x34c682){_0x7399f5[_0x7822('0x50')]=_0x34c682;return _0x7399f5;})['then'](respondWithFilteredResult(_0x1dceac,_0x33f4ab))['catch'](handleError(_0x1dceac,null));};exports[_0x7822('0x51')]=function(_0x5010f1,_0x1452b2){var _0x415a11={'raw':![],'where':{'id':_0x5010f1[_0x7822('0x52')]['id']}},_0x41809b={};_0x41809b['model']=_[_0x7822('0x3c')](db[_0x7822('0x4c')][_0x7822('0x36')]);_0x41809b['query']=_[_0x7822('0x3c')](_0x5010f1[_0x7822('0x3b')]);_0x41809b[_0x7822('0x3d')]=_[_0x7822('0x3e')](_0x41809b['model'],_0x41809b['query']);_0x415a11['attributes']=_[_0x7822('0x3e')](_0x41809b[_0x7822('0x39')],qs[_0x7822('0x40')](_0x5010f1[_0x7822('0x3b')][_0x7822('0x40')]));_0x415a11['attributes']=_0x415a11[_0x7822('0x3f')][_0x7822('0x41')]?_0x415a11[_0x7822('0x3f')]:_0x41809b[_0x7822('0x39')];if(_0x5010f1[_0x7822('0x3b')][_0x7822('0x4d')]){_0x415a11[_0x7822('0x4e')]=[{'all':!![]}];}_0x415a11=_[_0x7822('0x4b')]({},_0x415a11,_0x5010f1[_0x7822('0x53')]);return db[_0x7822('0x4c')][_0x7822('0x54')](_0x415a11)[_0x7822('0x1e')](handleEntityNotFound(_0x1452b2,null))['then'](respondWithResult(_0x1452b2,null))['catch'](handleError(_0x1452b2,null));};exports['clone']=function(_0x2f4723,_0x19a673){var _0x4803dd={'where':{'id':_0x2f4723[_0x7822('0x52')]['id']}},_0x351951={};_0x351951[_0x7822('0x39')]=_[_0x7822('0x3c')](db[_0x7822('0x4c')][_0x7822('0x36')]);_0x4803dd['attributes']=_[_0x7822('0x3e')](_0x351951[_0x7822('0x39')],qs[_0x7822('0x40')](_0x2f4723['query'][_0x7822('0x40')]));_0x4803dd[_0x7822('0x3f')]=_0x4803dd['attributes'][_0x7822('0x41')]?_0x4803dd[_0x7822('0x3f')]:_0x351951['model'];if(_0x2f4723[_0x7822('0x3b')][_0x7822('0x4d')]){_0x4803dd[_0x7822('0x4e')]=[{'all':!![]}];}_0x4803dd=_[_0x7822('0x4b')]({},_0x4803dd,_0x2f4723[_0x7822('0x53')]);return db[_0x7822('0x4c')][_0x7822('0x54')](_0x4803dd)[_0x7822('0x1e')](handleEntityNotFound(_0x19a673,null))[_0x7822('0x1e')](function(_0x4ffcd3){if(_0x4ffcd3){var _0x1aca64=_0x4ffcd3[_0x7822('0x55')]({'plain':!![]});_0x1aca64=qs[_0x7822('0x56')](_0x1aca64,['id',_0x7822('0x57'),_0x7822('0x58')]);_0x2f4723[_0x7822('0x59')]=_['omit'](_0x2f4723[_0x7822('0x59')],['id','createdAt',_0x7822('0x58')]);return db[_0x7822('0x4c')][_0x7822('0x5a')](_[_0x7822('0x4b')](_0x1aca64,_0x2f4723[_0x7822('0x59')]),{'include':_0x2f4723[_0x7822('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0x7822('0x1e')](function(_0x112727){var _0x280c65=_0x2f4723[_0x7822('0x5b')]['get']({'plain':!![]});if(!_0x280c65)throw new Error(_0x7822('0x5c'));if(_0x280c65[_0x7822('0x5d')]===_0x7822('0x5b')){var _0x3faaea=_0x112727[_0x7822('0x55')]({'plain':!![]});var _0x50be76=_0x7822('0x32');return db[_0x7822('0x5e')][_0x7822('0x54')]({'where':{'name':_0x50be76,'userProfileId':_0x280c65[_0x7822('0x5f')]},'raw':!![]})[_0x7822('0x1e')](function(_0x540a8a){if(_0x540a8a&&_0x540a8a[_0x7822('0x60')]===0x0){return db[_0x7822('0x33')][_0x7822('0x5a')]({'name':_0x3faaea[_0x7822('0x34')],'resourceId':_0x3faaea['id'],'type':_0x540a8a[_0x7822('0x34')],'sectionId':_0x540a8a['id']},{})[_0x7822('0x1e')](function(){return _0x112727;});}else{return _0x112727;}})[_0x7822('0x28')](function(_0x402950){logger[_0x7822('0x25')](_0x7822('0x61'),_0x402950);throw _0x402950;});}return _0x112727;});}})[_0x7822('0x1e')](respondWithResult(_0x19a673,0xc9))[_0x7822('0x28')](handleError(_0x19a673,null));};exports['create']=function(_0x4b3186,_0x2e1b20,_0x653181){var _0x41bf9a;return db[_0x7822('0x4c')][_0x7822('0x5a')](_0x4b3186[_0x7822('0x59')],{'raw':!![]})[_0x7822('0x1e')](function(_0xaf30a){_0x41bf9a=_0xaf30a;return db[_0x7822('0x4c')][_0x7822('0x4f')]({'raw':!![]});})[_0x7822('0x1e')](function(_0x17d51f){var _0x56bf33=fs['readFileSync'](path[_0x7822('0x62')](config[_0x7822('0x63')],'server/files/templates/trunk.ejs'),'utf8');var _0x3f4a72=fs[_0x7822('0x64')](path['join'](config['root'],_0x7822('0x65')),_0x7822('0x66'));var _0x30f0f7=ejs[_0x7822('0x67')](_0x56bf33,{'trunks':_0x17d51f||[]});fs['writeFileSync'](_0x7822('0x68'),_0x30f0f7);if(_0x41bf9a[_0x7822('0x69')]){var _0x25c7e2=ejs[_0x7822('0x67')](_0x3f4a72,{'trunks':_0x17d51f||[]});fs[_0x7822('0x6a')](_0x7822('0x6b'),_0x25c7e2);}})[_0x7822('0x1e')](function(){return respondWithRpcPromise(_0x7822('0x6c'),_0x7822('0x5a'),{'module':_0x7822('0x6d')});})['then'](function(){var _0x4b8aad=_0x4b3186[_0x7822('0x5b')][_0x7822('0x55')]({'plain':!![]});if(!_0x4b8aad)throw new Error(_0x7822('0x5c'));if(_0x4b8aad[_0x7822('0x5d')]===_0x7822('0x5b')){var _0x2ee80e=_0x41bf9a[_0x7822('0x55')]({'plain':!![]});return db[_0x7822('0x5e')][_0x7822('0x54')]({'where':{'name':_0x7822('0x32'),'userProfileId':_0x4b8aad[_0x7822('0x5f')]},'raw':!![]})['then'](function(_0x1001bd){if(_0x1001bd&&_0x1001bd[_0x7822('0x60')]===0x0){return db['UserProfileResource'][_0x7822('0x5a')]({'name':_0x2ee80e['name'],'resourceId':_0x2ee80e['id'],'type':_0x1001bd['name'],'sectionId':_0x1001bd['id']},{})[_0x7822('0x1e')](function(){return _0x41bf9a;});}else{return _0x41bf9a;}})[_0x7822('0x28')](function(_0x2bbf57){logger[_0x7822('0x25')](_0x7822('0x61'),_0x2bbf57);throw _0x2bbf57;});}return _0x41bf9a;})[_0x7822('0x1e')](respondWithResult(_0x2e1b20,0xc9))[_0x7822('0x28')](handleError(_0x2e1b20,null));};exports[_0x7822('0x6e')]=function(_0x3d6342,_0x56d6b8,_0x5d74b6){var _0xff3812;return db['Trunk']['find']({'where':{'id':_0x3d6342[_0x7822('0x52')]['id']}})[_0x7822('0x1e')](handleEntityNotFound(_0x56d6b8,null))[_0x7822('0x1e')](saveUpdates(_0x3d6342[_0x7822('0x59')],null))[_0x7822('0x1e')](function(_0x1eb6f0){if(_0x1eb6f0){_0xff3812=_0x1eb6f0;return db[_0x7822('0x4c')][_0x7822('0x4f')]({'raw':!![]});}})['then'](function(_0x5103ed){if(_0x5103ed){var _0x5d2b19=fs[_0x7822('0x64')](path[_0x7822('0x62')](config['root'],_0x7822('0x6f')),_0x7822('0x66'));var _0x3a3ae1=fs[_0x7822('0x64')](path['join'](config[_0x7822('0x63')],_0x7822('0x65')),'utf8');var _0x530484=ejs[_0x7822('0x67')](_0x5d2b19,{'trunks':_0x5103ed||[]});fs[_0x7822('0x6a')](_0x7822('0x68'),_0x530484);var _0x13f536=ejs[_0x7822('0x67')](_0x3a3ae1,{'trunks':_0x5103ed||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x13f536);return respondWithRpcPromise(_0x7822('0x6c'),_0x7822('0x6e'),{'module':_0x7822('0x6d')});}return null;})[_0x7822('0x1e')](function(_0x5d770b){if(_0x5d770b){return _0xff3812;}})['then'](respondWithResult(_0x56d6b8,null))[_0x7822('0x28')](handleError(_0x56d6b8,null));};exports[_0x7822('0x31')]=function(_0x5c9f6e,_0x548ad5,_0x1cc540){var _0x654da7;return db[_0x7822('0x4c')][_0x7822('0x54')]({'where':{'id':_0x5c9f6e['params']['id']}})[_0x7822('0x1e')](handleEntityNotFound(_0x548ad5,null))[_0x7822('0x1e')](removeEntity(_0x548ad5,null))[_0x7822('0x1e')](function(){return db[_0x7822('0x4c')][_0x7822('0x4f')]({'raw':!![]});})['then'](function(_0x141e31){var _0x20e7a0=fs[_0x7822('0x64')](path[_0x7822('0x62')](config[_0x7822('0x63')],_0x7822('0x6f')),_0x7822('0x66'));var _0x4eb624=fs[_0x7822('0x64')](path[_0x7822('0x62')](config[_0x7822('0x63')],_0x7822('0x65')),_0x7822('0x66'));var _0x249d1b=ejs['render'](_0x20e7a0,{'trunks':_0x141e31});var _0x24692a=ejs['render'](_0x4eb624,{'trunks':_0x141e31});fs['writeFileSync'](_0x7822('0x68'),_0x249d1b);fs['writeFileSync'](_0x7822('0x6b'),_0x24692a);return respondWithRpcPromise(_0x7822('0x6c'),_0x7822('0x31'),{'module':_0x7822('0x6d')});})[_0x7822('0x28')](handleError(_0x548ad5,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b98cc3f..590aa2f 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 _0x7647=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment'];(function(_0xf9e76,_0x2e6b9a){var _0x119a9b=function(_0x146396){while(--_0x146396){_0xf9e76['push'](_0xf9e76['shift']());}};_0x119a9b(++_0x2e6b9a);}(_0x7647,0x95));var _0x7764=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7647[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7764('0x0'));var util=require(_0x7764('0x1'));var logger=require(_0x7764('0x2'))(_0x7764('0x3'));var moment=require(_0x7764('0x4'));var BPromise=require('bluebird');var rp=require(_0x7764('0x5'));var fs=require('fs');var path=require(_0x7764('0x6'));var rimraf=require(_0x7764('0x7'));var config=require(_0x7764('0x8'));var attributes=require(_0x7764('0x9'));module[_0x7764('0xa')]=function(_0x41ac82,_0x367992){return _0x41ac82[_0x7764('0xb')](_0x7764('0xc'),attributes,{'tableName':_0x7764('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ceb=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5226bc,_0x38bf1d){var _0x244ca4=function(_0x25de9b){while(--_0x25de9b){_0x5226bc['push'](_0x5226bc['shift']());}};_0x244ca4(++_0x38bf1d);}(_0x3ceb,0x131));var _0xb3ce=function(_0x1cbcec,_0x33c001){_0x1cbcec=_0x1cbcec-0x0;var _0x54c8ca=_0x3ceb[_0x1cbcec];return _0x54c8ca;};'use strict';var _=require(_0xb3ce('0x0'));var util=require(_0xb3ce('0x1'));var logger=require(_0xb3ce('0x2'))(_0xb3ce('0x3'));var moment=require('moment');var BPromise=require(_0xb3ce('0x4'));var rp=require(_0xb3ce('0x5'));var fs=require('fs');var path=require(_0xb3ce('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3ce('0x7'));module[_0xb3ce('0x8')]=function(_0x7891b2,_0x3abbe3){return _0x7891b2[_0xb3ce('0x9')](_0xb3ce('0xa'),attributes,{'tableName':_0xb3ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index d0de8ae..49ef9bc 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 _0x5f2f=['map','include','model','attributes','then','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','limit'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x5f2f,0x73));var _0xf5f2=function(_0x18c639,_0xb8c920){_0x18c639=_0x18c639-0x0;var _0x16a68f=_0x5f2f[_0x18c639];return _0x16a68f;};'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')]('Trunk,\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')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetTrunk',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetTrunk',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowTrunk',_0x153924);logger[_0xf5f2('0xf')]('ShowTrunk',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowTrunk',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x211a02,_0x3b5362){var _0x13d91c=function(_0x559b49){while(--_0x559b49){_0x211a02['push'](_0x211a02['shift']());}};_0x13d91c(++_0x3b5362);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 6c937ed..058a63d 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 _0xf7e9=['getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','bulkCreate','post','addContacts','create','addQueues','diskStorage','server/files/images/','format','%s-%s','originalname','single','/:id/login','login','/:id/logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','delete','removeQueues','destroy','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists'];(function(_0x574250,_0x3ec0d7){var _0x5e3d92=function(_0x5b3fe7){while(--_0x5b3fe7){_0x574250['push'](_0x574250['shift']());}};_0x5e3d92(++_0x3ec0d7);}(_0xf7e9,0xb2));var _0x9f7e=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0xf7e9[_0x687ddc];return _0x441991;};'use strict';var multer=require(_0x9f7e('0x0'));var util=require('util');var path=require(_0x9f7e('0x1'));var timeout=require(_0x9f7e('0x2'));var express=require(_0x9f7e('0x3'));var router=express[_0x9f7e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9f7e('0x5'));var config=require(_0x9f7e('0x6'));var controller=require('./user.controller');router[_0x9f7e('0x7')]('/',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x9')]);router[_0x9f7e('0x7')](_0x9f7e('0xa'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0xb')]);router[_0x9f7e('0x7')](_0x9f7e('0xc'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0xd')]);router[_0x9f7e('0x7')]('/:id',auth[_0x9f7e('0x8')](),controller['show']);router[_0x9f7e('0x7')](_0x9f7e('0xe'),controller[_0x9f7e('0xf')]);router[_0x9f7e('0x7')](_0x9f7e('0x10'),auth[_0x9f7e('0x8')](),controller['getContacts']);router[_0x9f7e('0x7')](_0x9f7e('0x11'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x12')]);router['get']('/:id/queues_rt',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x13')]);router[_0x9f7e('0x7')](_0x9f7e('0x14'),auth['isAuthenticated'](),controller['getGroups']);router[_0x9f7e('0x7')]('/:id/recordings',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x15')]);router[_0x9f7e('0x7')](_0x9f7e('0x16'),auth[_0x9f7e('0x8')](),controller['getScreenRecordings']);router[_0x9f7e('0x7')](_0x9f7e('0x17'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x18')]);router[_0x9f7e('0x7')]('/:id/openchannel/interactions',auth[_0x9f7e('0x8')](),controller['getOpenchannelInteractions']);router[_0x9f7e('0x7')]('/:id/mail/interactions',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x19')]);router[_0x9f7e('0x7')](_0x9f7e('0x1a'),auth['isAuthenticated'](),controller[_0x9f7e('0x1b')]);router[_0x9f7e('0x7')](_0x9f7e('0x1c'),auth['isAuthenticated'](),controller[_0x9f7e('0x1d')]);router['get'](_0x9f7e('0x1e'),auth[_0x9f7e('0x8')](),controller['getWhatsappInteractions']);router[_0x9f7e('0x7')](_0x9f7e('0x1f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x20')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0x9f7e('0x21')]);router['get']('/:id/agents',auth['isAuthenticated'](),controller[_0x9f7e('0x22')]);router[_0x9f7e('0x7')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x9f7e('0x23')]);router[_0x9f7e('0x7')]('/:id/fax_accounts',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x24')]);router[_0x9f7e('0x7')](_0x9f7e('0x25'),auth['isAuthenticated'](),controller[_0x9f7e('0x26')]);router[_0x9f7e('0x7')](_0x9f7e('0x27'),auth['isAuthenticated'](),controller[_0x9f7e('0x28')]);router[_0x9f7e('0x7')](_0x9f7e('0x29'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x2a')]);router[_0x9f7e('0x7')](_0x9f7e('0x2b'),auth['isAuthenticated'](),controller[_0x9f7e('0x2c')]);router[_0x9f7e('0x7')](_0x9f7e('0x2d'),auth['isAuthenticated'](),controller[_0x9f7e('0x2e')]);router['get'](_0x9f7e('0x2f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x30')]);router[_0x9f7e('0x7')](_0x9f7e('0x31'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x32')]);router[_0x9f7e('0x7')](_0x9f7e('0x33'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x34')]);router['post']('/create_many',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x35')]);router[_0x9f7e('0x36')](_0x9f7e('0x10'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x37')]);router[_0x9f7e('0x36')]('/',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x38')]);router[_0x9f7e('0x36')](_0x9f7e('0x11'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x39')]);var upload=multer({'storage':multer[_0x9f7e('0x3a')]({'destination':function(_0x136c3c,_0x36fa52,_0x4497d0){_0x4497d0(null,path['join'](config['root'],_0x9f7e('0x3b')));},'filename':function(_0x4cf2a6,_0x59dcf3,_0x4fe598){_0x4fe598(null,util[_0x9f7e('0x3c')](_0x9f7e('0x3d'),Date['now'](),_0x59dcf3[_0x9f7e('0x3e')]));}})});router[_0x9f7e('0x36')](_0x9f7e('0xe'),upload[_0x9f7e('0x3f')]('file'),controller['addAvatar']);router['post'](_0x9f7e('0x40'),auth['isAuthenticated'](),controller[_0x9f7e('0x41')]);router[_0x9f7e('0x36')](_0x9f7e('0x42'),auth[_0x9f7e('0x8')](),controller['logout']);router['post']('/:id/pause',auth[_0x9f7e('0x8')](),controller['pause']);router['post'](_0x9f7e('0x43'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x44')]);router['post'](_0x9f7e('0x1f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x45')]);router[_0x9f7e('0x36')](_0x9f7e('0x46'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x47')]);router[_0x9f7e('0x36')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x9f7e('0x48')]);router[_0x9f7e('0x36')](_0x9f7e('0x49'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x4a')]);router['post'](_0x9f7e('0x4b'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x4c')]);router[_0x9f7e('0x36')](_0x9f7e('0x4d'),auth[_0x9f7e('0x8')](),controller['addOpenchannelInteractions']);router['post']('/:id/whatsapp_interactions',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x4e')]);router[_0x9f7e('0x36')](_0x9f7e('0x4f'),auth['isAuthenticated'](),controller[_0x9f7e('0x50')]);router[_0x9f7e('0x36')](_0x9f7e('0x25'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x51')]);router[_0x9f7e('0x36')](_0x9f7e('0x27'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x52')]);router[_0x9f7e('0x36')]('/:id/sms_accounts',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x53')]);router['post']('/:id/chat_websites',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x54')]);router[_0x9f7e('0x36')](_0x9f7e('0x2d'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x55')]);router[_0x9f7e('0x36')](_0x9f7e('0x2f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x56')]);router[_0x9f7e('0x36')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x9f7e('0x57')]);router[_0x9f7e('0x58')](_0x9f7e('0x59'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x5a')]);router['put'](_0x9f7e('0x5b'),auth[_0x9f7e('0x8')](),controller['changePassword']);router[_0x9f7e('0x5c')](_0x9f7e('0x11'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x5d')]);router[_0x9f7e('0x5c')](_0x9f7e('0x1f'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x9f7e('0x5c')](_0x9f7e('0x59'),auth['isAuthenticated'](),controller[_0x9f7e('0x5e')]);router[_0x9f7e('0x5c')](_0x9f7e('0x46'),auth[_0x9f7e('0x8')](),controller['removeChatInteractions']);router['delete'](_0x9f7e('0x5f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x60')]);router['delete'](_0x9f7e('0x49'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router['delete'](_0x9f7e('0x4b'),auth['isAuthenticated'](),controller[_0x9f7e('0x61')]);router[_0x9f7e('0x5c')]('/:id/openchannel_interactions',auth[_0x9f7e('0x8')](),controller['removeOpenchannelInteractions']);router[_0x9f7e('0x5c')](_0x9f7e('0x62'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x63')]);router[_0x9f7e('0x5c')](_0x9f7e('0x4f'),auth['isAuthenticated'](),controller[_0x9f7e('0x64')]);router[_0x9f7e('0x5c')](_0x9f7e('0x25'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x65')]);router['delete'](_0x9f7e('0x27'),auth['isAuthenticated'](),controller[_0x9f7e('0x66')]);router[_0x9f7e('0x5c')](_0x9f7e('0x29'),auth[_0x9f7e('0x8')](),controller['removeSmsAccounts']);router[_0x9f7e('0x5c')](_0x9f7e('0x2b'),auth['isAuthenticated'](),controller[_0x9f7e('0x67')]);router[_0x9f7e('0x5c')](_0x9f7e('0x2d'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x68')]);router[_0x9f7e('0x5c')](_0x9f7e('0x2f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x69')]);router[_0x9f7e('0x5c')](_0x9f7e('0x33'),auth[_0x9f7e('0x8')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0xf70c=['addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','removeApiKey','exports','util','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/:id','show','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','/create_many','bulkCreate','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','/:id/avatar','addAvatar','login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts'];(function(_0x5b68ae,_0x376e32){var _0x337c85=function(_0x4954e8){while(--_0x4954e8){_0x5b68ae['push'](_0x5b68ae['shift']());}};_0x337c85(++_0x376e32);}(_0xf70c,0x17e));var _0xcf70=function(_0x5b8e16,_0x3268c6){_0x5b8e16=_0x5b8e16-0x0;var _0x2144e8=_0xf70c[_0x5b8e16];return _0x2144e8;};'use strict';var multer=require('multer');var util=require(_0xcf70('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf70('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xcf70('0x2'));var config=require(_0xcf70('0x3'));var controller=require(_0xcf70('0x4'));router['get']('/',auth[_0xcf70('0x5')](),controller[_0xcf70('0x6')]);router[_0xcf70('0x7')](_0xcf70('0x8'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x9')]);router[_0xcf70('0x7')](_0xcf70('0xa'),auth[_0xcf70('0x5')](),controller[_0xcf70('0xb')]);router[_0xcf70('0x7')](_0xcf70('0xc'),auth[_0xcf70('0x5')](),controller[_0xcf70('0xd')]);router[_0xcf70('0x7')]('/:id/avatar',controller['getAvatar']);router[_0xcf70('0x7')](_0xcf70('0xe'),auth[_0xcf70('0x5')](),controller[_0xcf70('0xf')]);router[_0xcf70('0x7')](_0xcf70('0x10'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x11')]);router[_0xcf70('0x7')](_0xcf70('0x12'),auth[_0xcf70('0x5')](),controller['getVoiceQueuesRt']);router['get']('/:id/groups',auth[_0xcf70('0x5')](),controller[_0xcf70('0x13')]);router[_0xcf70('0x7')](_0xcf70('0x14'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x15')]);router[_0xcf70('0x7')](_0xcf70('0x16'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x17')]);router[_0xcf70('0x7')](_0xcf70('0x18'),auth['isAuthenticated'](),controller[_0xcf70('0x19')]);router[_0xcf70('0x7')](_0xcf70('0x1a'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x1b')]);router['get'](_0xcf70('0x1c'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x1d')]);router[_0xcf70('0x7')](_0xcf70('0x1e'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x1f')]);router[_0xcf70('0x7')](_0xcf70('0x20'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x21')]);router[_0xcf70('0x7')](_0xcf70('0x22'),auth['isAuthenticated'](),controller[_0xcf70('0x23')]);router[_0xcf70('0x7')](_0xcf70('0x24'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x25')]);router[_0xcf70('0x7')](_0xcf70('0x26'),auth[_0xcf70('0x5')](),controller['getLists']);router['get'](_0xcf70('0x27'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x28')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0xcf70('0x29')]);router[_0xcf70('0x7')](_0xcf70('0x2a'),auth['isAuthenticated'](),controller[_0xcf70('0x2b')]);router[_0xcf70('0x7')]('/:id/mail_accounts',auth[_0xcf70('0x5')](),controller['getMailAccounts']);router[_0xcf70('0x7')](_0xcf70('0x2c'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xcf70('0x2d')]);router['get'](_0xcf70('0x2e'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x2f')]);router[_0xcf70('0x7')](_0xcf70('0x30'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x31')]);router[_0xcf70('0x7')](_0xcf70('0x32'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x33')]);router[_0xcf70('0x7')](_0xcf70('0x34'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x35')]);router[_0xcf70('0x7')]('/:id/api_key',auth[_0xcf70('0x5')](),controller['getApiKey']);router[_0xcf70('0x36')](_0xcf70('0x37'),auth['isAuthenticated'](),controller[_0xcf70('0x38')]);router[_0xcf70('0x36')](_0xcf70('0xe'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x39')]);router[_0xcf70('0x36')]('/',auth[_0xcf70('0x5')](),controller[_0xcf70('0x3a')]);router[_0xcf70('0x36')](_0xcf70('0x10'),auth['isAuthenticated'](),controller[_0xcf70('0x3b')]);var upload=multer({'storage':multer[_0xcf70('0x3c')]({'destination':function(_0x486a03,_0x481623,_0x3f62cb){_0x3f62cb(null,path[_0xcf70('0x3d')](config[_0xcf70('0x3e')],_0xcf70('0x3f')));},'filename':function(_0x3582be,_0x12d12e,_0x1eccc6){_0x1eccc6(null,util['format'](_0xcf70('0x40'),Date[_0xcf70('0x41')](),_0x12d12e[_0xcf70('0x42')]));}})});router[_0xcf70('0x36')](_0xcf70('0x43'),upload['single']('file'),controller[_0xcf70('0x44')]);router[_0xcf70('0x36')]('/:id/login',auth['isAuthenticated'](),controller[_0xcf70('0x45')]);router[_0xcf70('0x36')](_0xcf70('0x46'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x47')]);router[_0xcf70('0x36')]('/:id/pause',auth[_0xcf70('0x5')](),controller[_0xcf70('0x48')]);router[_0xcf70('0x36')](_0xcf70('0x49'),auth[_0xcf70('0x5')](),controller['unpause']);router['post']('/:id/teams',auth[_0xcf70('0x5')](),controller[_0xcf70('0x4a')]);router[_0xcf70('0x36')](_0xcf70('0x4b'),auth['isAuthenticated'](),controller[_0xcf70('0x4c')]);router['post'](_0xcf70('0x4d'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x4e')]);router[_0xcf70('0x36')](_0xcf70('0x4f'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x50')]);router[_0xcf70('0x36')]('/:id/sms_interactions',auth[_0xcf70('0x5')](),controller[_0xcf70('0x51')]);router[_0xcf70('0x36')]('/:id/openchannel_interactions',auth[_0xcf70('0x5')](),controller[_0xcf70('0x52')]);router[_0xcf70('0x36')](_0xcf70('0x53'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x54')]);router[_0xcf70('0x36')]('/:id/fax_accounts',auth[_0xcf70('0x5')](),controller['addFaxAccounts']);router[_0xcf70('0x36')](_0xcf70('0x55'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x56')]);router[_0xcf70('0x36')](_0xcf70('0x2c'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x57')]);router[_0xcf70('0x36')](_0xcf70('0x58'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x59')]);router['post'](_0xcf70('0x2e'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x5a')]);router[_0xcf70('0x36')](_0xcf70('0x30'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x5b')]);router[_0xcf70('0x36')](_0xcf70('0x32'),auth['isAuthenticated'](),controller[_0xcf70('0x5c')]);router[_0xcf70('0x36')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xcf70('0x5d')]);router['put']('/:id',auth[_0xcf70('0x5')](),controller[_0xcf70('0x5e')]);router[_0xcf70('0x5f')](_0xcf70('0x60'),auth['isAuthenticated'](),controller[_0xcf70('0x61')]);router[_0xcf70('0x62')]('/:id/queues',auth[_0xcf70('0x5')](),controller[_0xcf70('0x63')]);router['delete'](_0xcf70('0x24'),auth[_0xcf70('0x5')](),controller['removeTeams']);router[_0xcf70('0x62')]('/:id',auth[_0xcf70('0x5')](),controller[_0xcf70('0x64')]);router[_0xcf70('0x62')](_0xcf70('0x4b'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x65')]);router[_0xcf70('0x62')]('/:id/mail_interactions',auth[_0xcf70('0x5')](),controller[_0xcf70('0x66')]);router[_0xcf70('0x62')](_0xcf70('0x4f'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x67')]);router[_0xcf70('0x62')](_0xcf70('0x68'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x69')]);router[_0xcf70('0x62')](_0xcf70('0x6a'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x6b')]);router[_0xcf70('0x62')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xcf70('0x6c')]);router['delete'](_0xcf70('0x2a'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x6d')]);router['delete'](_0xcf70('0x55'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x6e')]);router[_0xcf70('0x62')](_0xcf70('0x2c'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x6f')]);router[_0xcf70('0x62')](_0xcf70('0x58'),auth[_0xcf70('0x5')](),controller['removeSmsAccounts']);router[_0xcf70('0x62')](_0xcf70('0x2e'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x70')]);router[_0xcf70('0x62')](_0xcf70('0x30'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x71')]);router['delete']('/:id/square_projects',auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0xcf70('0x62')](_0xcf70('0x72'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x73')]);module[_0xcf70('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c76314e..4d71c0a 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 _0x12f4=['auto','rfc2833','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','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','nonat','showWebBar','get','udp','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','map','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','lodash','STRING','setDataValue','name','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','DATE','BOOLEAN','DEFAULT\x20PAUSE','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband'];(function(_0x4ab6a2,_0x17b9d6){var _0x2ce0a6=function(_0x6fcdbf){while(--_0x6fcdbf){_0x4ab6a2['push'](_0x4ab6a2['shift']());}};_0x2ce0a6(++_0x17b9d6);}(_0x12f4,0x1f1));var _0x412f=function(_0x43cbe0,_0x3e7a42){_0x43cbe0=_0x43cbe0-0x0;var _0x121cb8=_0x12f4[_0x43cbe0];return _0x121cb8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require(_0x412f('0x0'));module['exports']={'name':{'type':Sequelize[_0x412f('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2545e1){this[_0x412f('0x2')](_0x412f('0x3'),_0x2545e1);this['setDataValue']('defaultuser',_0x2545e1);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x22573c){this[_0x412f('0x2')](_0x412f('0x4'),_0x22573c);this[_0x412f('0x2')](_0x412f('0x5'),util[_0x412f('0x6')]('\x22%s\x22\x20<%s>',_0x22573c,this[_0x412f('0x7')](_0x412f('0x8'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x412f('0x9'),'validate':{'isEmail':!![]},'set':function(_0x22dd52){if(_0x22dd52){this[_0x412f('0x2')](_0x412f('0x9'),_0x22dd52[_0x412f('0xa')]());}}},'role':{'type':Sequelize[_0x412f('0xb')]('admin',_0x412f('0xc'),_0x412f('0xd'),_0x412f('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x412f('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x412f('0x1')],'defaultValue':_0x412f('0xf')},'internal':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':![],'unique':_0x412f('0x8'),'set':function(_0xc0bfef){this['setDataValue'](_0x412f('0x8'),_0xc0bfef);this['setDataValue'](_0x412f('0x11'),_0xc0bfef);this[_0x412f('0x2')](_0x412f('0x5'),util['format'](_0x412f('0x12'),this[_0x412f('0x7')](_0x412f('0x4')),_0xc0bfef));}},'salt':{'type':Sequelize[_0x412f('0x1')]},'phone':{'type':Sequelize[_0x412f('0x1')]},'mobile':{'type':Sequelize[_0x412f('0x1')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x412f('0x1')]},'userpic':{'type':Sequelize[_0x412f('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x412f('0x1')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x412f('0x13')]},'voicePause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x412f('0x1')],'defaultValue':_0x412f('0x15')},'lastPauseAt':{'type':Sequelize[_0x412f('0x13')]},'chatCapacity':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x412f('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x412f('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'port':{'type':Sequelize[_0x412f('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x16'),'user',_0x412f('0x17')),'allowNull':!![],'defaultValue':_0x412f('0x16')},'context':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x18'),_0x412f('0x19'),_0x412f('0x1a'),_0x412f('0x1b'),_0x412f('0x1c'),'PROHIB_PASSED_SCREEN',_0x412f('0x1d'),_0x412f('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'transport':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![],'defaultValue':'udp','set':function(_0x218f12){this[_0x412f('0x2')](_0x412f('0x1f'),_0x218f12?_0x218f12[_0x412f('0x20')](','):null);},'get':function(){return this[_0x412f('0x7')](_0x412f('0x1f'))?this[_0x412f('0x7')](_0x412f('0x1f'))[_0x412f('0x21')](','):null;},'comment':_0x412f('0x22')},'dtmfmode':{'type':Sequelize[_0x412f('0xb')]('rfc2833',_0x412f('0x23'),'shortinfo',_0x412f('0x24'),_0x412f('0x25')),'allowNull':!![],'defaultValue':_0x412f('0x26')},'directmedia':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no','nonat',_0x412f('0x28'),_0x412f('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x412f('0x2a'),'set':function(_0xc58ac1){this[_0x412f('0x2')]('nat',_0xc58ac1?_0xc58ac1[_0x412f('0x20')](','):null);},'get':function(){return this[_0x412f('0x7')](_0x412f('0x2b'))?this['getDataValue'](_0x412f('0x2b'))[_0x412f('0x21')](','):null;},'comment':_0x412f('0x2c')},'callgroup':{'type':Sequelize[_0x412f('0x1')]},'namedcallgroup':{'type':Sequelize[_0x412f('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x412f('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x412f('0x1')]},'disallow':{'type':Sequelize[_0x412f('0x1')],'allowNull':![],'defaultValue':_0x412f('0x2d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x412f('0x2e'),'set':function(_0x3e46fb){this[_0x412f('0x2')]('allow',_0x3e46fb?_0x3e46fb[_0x412f('0x20')](';'):_0x412f('0x2e'));},'get':function(){return this['getDataValue'](_0x412f('0x2f'))?this[_0x412f('0x7')](_0x412f('0x2f'))['split'](';'):null;},'comment':_0x412f('0x30')},'autoframing':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![],'set':function(_0x3bc2f8){this[_0x412f('0x2')](_0x412f('0x31'),_0x3bc2f8?_0x3bc2f8[_0x412f('0x20')](','):null);},'get':function(){return this[_0x412f('0x7')](_0x412f('0x31'))?this['getDataValue'](_0x412f('0x31'))[_0x412f('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no',_0x412f('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x412f('0xb')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x412f('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':_0x412f('0x27')},'busylevel':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'template':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no',_0x412f('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x412f('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x35'),_0x412f('0x36'),_0x412f('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x412f('0xb')]('uac',_0x412f('0x38')),'allowNull':!![],'defaultValue':_0x412f('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no',_0x412f('0x39'),_0x412f('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x412f('0x3b'),_0x412f('0x3c'),_0x412f('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x412f('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x412f('0xb')]('yes','no',_0x412f('0x3e'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x412f('0x13')]},'showWebBar':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0,'set':function(_0x305757){this['setDataValue'](_0x412f('0x3f'),_0x305757);var _0x32c9be=this[_0x412f('0x40')]({'plain':!![]});switch(_0x305757){case 0x0:case 0x1:var _0x46da37=_0x32c9be[_0x412f('0x1f')]?_['isArray'](_0x32c9be[_0x412f('0x1f')])?_0x32c9be[_0x412f('0x1f')][_0x412f('0x20')]():_0x32c9be[_0x412f('0x1f')]:_0x412f('0x41');if(_0x46da37==='wss'){_0x46da37=_0x412f('0x41');}this['setDataValue'](_0x412f('0x1f'),_0x46da37);this[_0x412f('0x2')]('encryption','no');this['setDataValue'](_0x412f('0x42'),null);this[_0x412f('0x2')](_0x412f('0x43'),null);this[_0x412f('0x2')]('icesupport',null);this[_0x412f('0x2')](_0x412f('0x44'),null);this[_0x412f('0x2')](_0x412f('0x45'),null);this[_0x412f('0x2')](_0x412f('0x46'),null);this[_0x412f('0x2')](_0x412f('0x47'),null);this[_0x412f('0x2')](_0x412f('0x48'),null);this[_0x412f('0x2')](_0x412f('0x49'),'no');break;case 0x2:this[_0x412f('0x2')]('transport','wss');this[_0x412f('0x2')]('encryption',_0x412f('0x27'));this[_0x412f('0x2')](_0x412f('0x42'),_0x412f('0x27'));this[_0x412f('0x2')](_0x412f('0x43'),_0x412f('0x27'));this[_0x412f('0x2')](_0x412f('0x4a'),_0x412f('0x27'));this[_0x412f('0x2')](_0x412f('0x44'),_0x412f('0x27'));this[_0x412f('0x2')]('dtlsverify','no');this[_0x412f('0x2')](_0x412f('0x46'),_0x412f('0x3d'));this['setDataValue'](_0x412f('0x47'),_0x32c9be[_0x412f('0x47')]||_0x412f('0x4b'));this[_0x412f('0x2')]('dtlsprivatekey',_0x32c9be['dtlsprivatekey']||_0x412f('0x4c'));this[_0x412f('0x2')]('rtcp_mux',_0x412f('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x412f('0x4d')],'set':function(_0x3bdfec){this[_0x412f('0x2')]('permissions',_0x3bdfec?_0x3bdfec[_0x412f('0x20')](','):[]);},'get':function(){return this[_0x412f('0x7')]('permissions')?_[_0x412f('0x4e')](this[_0x412f('0x7')](_0x412f('0x4f'))[_0x412f('0x21')](','),function(_0x362eb0){return parseInt(_0x362eb0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x412f('0x1')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x412f('0x1')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x412f('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x412f('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x412f('0x1')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x412f('0x50')],'get':function(){return this[_0x412f('0x7')](_0x412f('0x51'))?this[_0x412f('0x7')](_0x412f('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x412f('0x1')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![],'set':function(_0x389fa0){if(typeof _0x389fa0===_0x412f('0x52')){var _0x175692=_0x389fa0==='1'?!![]:_0x389fa0==='0'?![]:_0x389fa0===_0x412f('0x53')?!![]:_0x389fa0===_0x412f('0x54')?![]:![];this[_0x412f('0x2')](_0x412f('0x55'),_0x175692);}else{this[_0x412f('0x2')](_0x412f('0x55'),_0x389fa0);}}},'blocked':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![],'set':function(_0x22123f){this[_0x412f('0x2')](_0x412f('0x56'),_0x22123f);if(_0x22123f===!![]){this[_0x412f('0x2')]('blockedAt',moment());this[_0x412f('0x2')](_0x412f('0x57'),0x0);}else{this[_0x412f('0x2')](_0x412f('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x412f('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0x1c1b=['active','actpass','showWebBar','isArray','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','icesupport','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','getDataValue','internal','email','ENUM','admin','user','agent','telephone','INTEGER','callerid','format','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate'];(function(_0x32436e,_0x1cfe36){var _0x34b29d=function(_0x37ca56){while(--_0x37ca56){_0x32436e['push'](_0x32436e['shift']());}};_0x34b29d(++_0x1cfe36);}(_0x1c1b,0x1e2));var _0xb1c1=function(_0x5061c9,_0x525996){_0x5061c9=_0x5061c9-0x0;var _0x1770f9=_0x1c1b[_0x5061c9];return _0x1770f9;};'use strict';var Sequelize=require(_0xb1c1('0x0'));var moment=require(_0xb1c1('0x1'));var util=require(_0xb1c1('0x2'));var _=require(_0xb1c1('0x3'));module[_0xb1c1('0x4')]={'name':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'unique':_0xb1c1('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x28bbb3){this[_0xb1c1('0x7')](_0xb1c1('0x6'),_0x28bbb3);this['setDataValue'](_0xb1c1('0x8'),_0x28bbb3);},'comment':_0xb1c1('0x9')},'fullname':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'set':function(_0x4cd851){this[_0xb1c1('0x7')](_0xb1c1('0xa'),_0x4cd851);this[_0xb1c1('0x7')]('callerid',util['format']('\x22%s\x22\x20<%s>',_0x4cd851,this[_0xb1c1('0xb')](_0xb1c1('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'unique':_0xb1c1('0xd'),'validate':{'isEmail':!![]},'set':function(_0x191b81){if(_0x191b81){this['setDataValue']('email',_0x191b81['toLowerCase']());}}},'role':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0xf'),_0xb1c1('0x10'),_0xb1c1('0x11'),_0xb1c1('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb1c1('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':![],'unique':_0xb1c1('0xc'),'set':function(_0xa33d95){this['setDataValue']('internal',_0xa33d95);this[_0xb1c1('0x7')]('accountcode',_0xa33d95);this[_0xb1c1('0x7')](_0xb1c1('0x14'),util[_0xb1c1('0x15')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0xb1c1('0xa')),_0xa33d95));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb1c1('0x5')]},'mobile':{'type':Sequelize[_0xb1c1('0x5')]},'address':{'type':Sequelize[_0xb1c1('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xb1c1('0x5')]},'city':{'type':Sequelize[_0xb1c1('0x5')]},'country':{'type':Sequelize[_0xb1c1('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xb1c1('0x17')]},'chatCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb1c1('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb1c1('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x18')},'ipaddr':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xb1c1('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x19'),_0xb1c1('0x10'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x1a')},'callingpres':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x1b'),_0xb1c1('0x1c'),_0xb1c1('0x1d'),_0xb1c1('0x1e'),_0xb1c1('0x1f'),'PROHIB_PASSED_SCREEN',_0xb1c1('0x20'),_0xb1c1('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x22'),'set':function(_0x345adf){this['setDataValue'](_0xb1c1('0x23'),_0x345adf?_0x345adf['join'](','):null);},'get':function(){return this['getDataValue'](_0xb1c1('0x23'))?this[_0xb1c1('0xb')](_0xb1c1('0x23'))['split'](','):null;},'comment':_0xb1c1('0x24')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xb1c1('0x25'),_0xb1c1('0x26'),_0xb1c1('0x27'),_0xb1c1('0x28')),'allowNull':!![],'defaultValue':_0xb1c1('0x29')},'directmedia':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no',_0xb1c1('0x2b'),_0xb1c1('0x2c'),_0xb1c1('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x2e'),'set':function(_0x3b51fc){this[_0xb1c1('0x7')](_0xb1c1('0x2f'),_0x3b51fc?_0x3b51fc[_0xb1c1('0x30')](','):null);},'get':function(){return this[_0xb1c1('0xb')](_0xb1c1('0x2f'))?this['getDataValue'](_0xb1c1('0x2f'))[_0xb1c1('0x31')](','):null;},'comment':_0xb1c1('0x32')},'callgroup':{'type':Sequelize[_0xb1c1('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xb1c1('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xb1c1('0x5')]},'language':{'type':Sequelize[_0xb1c1('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb1c1('0x5')]},'disallow':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'defaultValue':_0xb1c1('0x33')},'allow':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x7a12c5){this[_0xb1c1('0x7')](_0xb1c1('0x34'),_0x7a12c5?_0x7a12c5[_0xb1c1('0x30')](';'):_0xb1c1('0x35'));},'get':function(){return this[_0xb1c1('0xb')](_0xb1c1('0x34'))?this[_0xb1c1('0xb')](_0xb1c1('0x34'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'set':function(_0x5bafd8){this[_0xb1c1('0x7')](_0xb1c1('0x36'),_0x5bafd8?_0x5bafd8[_0xb1c1('0x30')](','):null);},'get':function(){return this['getDataValue'](_0xb1c1('0x36'))?this['getDataValue']('insecure')[_0xb1c1('0x31')](','):null;},'comment':_0xb1c1('0x37')},'trustrpid':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb1c1('0xe')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x38')},'amaflags':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0xb1c1('0x2a')},'busylevel':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x39'),_0xb1c1('0x3a'),_0xb1c1('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xb1c1('0x3c'),_0xb1c1('0x3d')),'allowNull':!![],'defaultValue':_0xb1c1('0x3d')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0xb1c1('0x2a')},'keepalive':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xb1c1('0x3e'),_0xb1c1('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x40'),'passive',_0xb1c1('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no',_0xb1c1('0x2b'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb1c1('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xb1c1('0x17')]},'showWebBar':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0,'set':function(_0x1dca34){this[_0xb1c1('0x7')](_0xb1c1('0x42'),_0x1dca34);var _0x4da700=this['get']({'plain':!![]});switch(_0x1dca34){case 0x0:case 0x1:var _0x3d39a8=_0x4da700[_0xb1c1('0x23')]?_[_0xb1c1('0x43')](_0x4da700[_0xb1c1('0x23')])?_0x4da700[_0xb1c1('0x23')][_0xb1c1('0x30')]():_0x4da700[_0xb1c1('0x23')]:_0xb1c1('0x22');if(_0x3d39a8==='wss'){_0x3d39a8=_0xb1c1('0x22');}this[_0xb1c1('0x7')](_0xb1c1('0x23'),_0x3d39a8);this[_0xb1c1('0x7')](_0xb1c1('0x44'),'no');this[_0xb1c1('0x7')](_0xb1c1('0x45'),null);this[_0xb1c1('0x7')](_0xb1c1('0x46'),null);this[_0xb1c1('0x7')]('icesupport',null);this[_0xb1c1('0x7')](_0xb1c1('0x47'),null);this[_0xb1c1('0x7')](_0xb1c1('0x48'),null);this[_0xb1c1('0x7')](_0xb1c1('0x49'),null);this[_0xb1c1('0x7')](_0xb1c1('0x4a'),null);this[_0xb1c1('0x7')](_0xb1c1('0x4b'),null);this[_0xb1c1('0x7')](_0xb1c1('0x4c'),'no');break;case 0x2:this[_0xb1c1('0x7')](_0xb1c1('0x23'),_0xb1c1('0x4d'));this[_0xb1c1('0x7')](_0xb1c1('0x44'),'yes');this['setDataValue'](_0xb1c1('0x45'),_0xb1c1('0x2a'));this[_0xb1c1('0x7')](_0xb1c1('0x46'),'yes');this[_0xb1c1('0x7')](_0xb1c1('0x4e'),'yes');this[_0xb1c1('0x7')]('dtlsenable','yes');this[_0xb1c1('0x7')]('dtlsverify','no');this[_0xb1c1('0x7')](_0xb1c1('0x49'),_0xb1c1('0x41'));this[_0xb1c1('0x7')](_0xb1c1('0x4a'),_0x4da700[_0xb1c1('0x4a')]||_0xb1c1('0x4f'));this['setDataValue']('dtlsprivatekey',_0x4da700[_0xb1c1('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0xb1c1('0x7')](_0xb1c1('0x4c'),_0xb1c1('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xb1c1('0x50')],'set':function(_0x596f5e){this[_0xb1c1('0x7')](_0xb1c1('0x51'),_0x596f5e?_0x596f5e[_0xb1c1('0x30')](','):[]);},'get':function(){return this[_0xb1c1('0xb')](_0xb1c1('0x51'))?_[_0xb1c1('0x52')](this['getDataValue'](_0xb1c1('0x51'))[_0xb1c1('0x31')](','),function(_0x4ceafa){return parseInt(_0x4ceafa,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb1c1('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb1c1('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb1c1('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb1c1('0x5')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb1c1('0x53')],'get':function(){return this[_0xb1c1('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0xb1c1('0xb')](_0xb1c1('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb1c1('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4006ad){if(typeof _0x4006ad==='string'){var _0x8178bc=_0x4006ad==='1'?!![]:_0x4006ad==='0'?![]:_0x4006ad===_0xb1c1('0x55')?!![]:_0x4006ad===_0xb1c1('0x56')?![]:![];this[_0xb1c1('0x7')](_0xb1c1('0x57'),_0x8178bc);}else{this[_0xb1c1('0x7')]('screenrecording',_0x4006ad);}}},'blocked':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![],'set':function(_0x4249a7){this[_0xb1c1('0x7')](_0xb1c1('0x58'),_0x4249a7);if(_0x4249a7===!![]){this[_0xb1c1('0x7')](_0xb1c1('0x59'),moment());this[_0xb1c1('0x7')](_0xb1c1('0x5a'),0x0);}else{this[_0xb1c1('0x7')](_0xb1c1('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0xb1c1('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 7b29b30..15d2660 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 _0x7530=['../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./user.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','end','json','count','offset','limit','status','apply','update','get','Users','user','agent','Telephones','telephone','filter','ignore','value','includes','find','role','name','destroy','sendStatus','stack','send','index','rawAttributes','type','key','model','map','password','salt','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','sequelize','lower','options','User','includeAll','include','findAll','rows','params','differenceBy','bulkCreate','body','describe','addContacts','ids','omit','admin','../../config/license/util','telephones','users','create','findById','min_internal','isNil','internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','113','110','104','105','106','108','111','114','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','Setting','findOne','securePassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','online','Unknown\x20channel','capitalize','Queues','spread','toLowerCase','QueueId','voice','VoiceQueue','push','interface','format','SIP/%s','voicePause','penalty','each','upsert','channel','isValidChannel','remove','emit','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','download','existsSync','server/files/images/','getContacts','fields','order','CmList','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','UserVoiceQueueRt','getGroups','ChatGroup','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','device','PAUSE','concat','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','unpause','mail','chat','fax','sms','whatsapp','openchannel','manual','set','Pause','getTeams','addTeams','setDataValue','Voice','getChatQueues','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','Fax','getOpenchannelQueues','Openchannel','flatten','addAgent','getDataValue','Queue:save','Team','Chat','Whatsapp','getFaxQueues','transaction','removeAgent','getLists','getAgents','values','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','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','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$contains','$contained','$any','lastName','phone','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0xd31621,_0x17b567){var _0x2e7ac0=function(_0x3c5a8d){while(--_0x3c5a8d){_0xd31621['push'](_0xd31621['shift']());}};_0x2e7ac0(++_0x17b567);}(_0x7530,0x15b));var _0x0753=function(_0x2e7025,_0x187270){_0x2e7025=_0x2e7025-0x0;var _0x5373ed=_0x7530[_0x2e7025];return _0x5373ed;};'use strict';var pdf=require(_0x0753('0x0'));var emlformat=require(_0x0753('0x1'));var rimraf=require(_0x0753('0x2'));var zipdir=require(_0x0753('0x3'));var jsonpatch=require(_0x0753('0x4'));var rp=require('request-promise');var moment=require(_0x0753('0x5'));var BPromise=require(_0x0753('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0753('0x7'));var sox=require('sox');var csv=require(_0x0753('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0753('0x9'));var squel=require(_0x0753('0xa'));var crypto=require('crypto');var jsforce=require(_0x0753('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0753('0xc'));var Papa=require(_0x0753('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0753('0xe'));var as=require(_0x0753('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0753('0x10'))(_0x0753('0x11'));var utils=require('../../config/utils');var config=require(_0x0753('0x12'));var db=require(_0x0753('0x13'))['db'];config[_0x0753('0x14')]=_['defaults'](config[_0x0753('0x14')],{'host':_0x0753('0x15'),'port':0x18eb});var socket=require(_0x0753('0x16'))(new Redis(config[_0x0753('0x14')]));require(_0x0753('0x17'))[_0x0753('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0753('0x19')][_0x0753('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4b7ce0,_0x122996,_0x2621e0){if(_0x2621e0){var _0x374a58=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x374a58[_0x0753('0x1b')](_0x122996)){return _0x4b7ce0;}else{throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x1e'));}}else{return _0x4b7ce0;}}function respondWithRpcPromise(_0x52164c,_0x2be0ed,_0x26a808,_0x174d8d){return new BPromise(function(_0x2a93fd,_0x2a521e){var _0x72c1e4=_0x174d8d||client;return _0x72c1e4[_0x0753('0x1f')](_0x52164c,_0x26a808)[_0x0753('0x20')](function(_0x215840){logger['info'](_0x0753('0x21'),_0x2be0ed,_0x0753('0x22'));logger[_0x0753('0x23')]('User,\x20%s,\x20%s,\x20%s',_0x2be0ed,_0x0753('0x22'),JSON[_0x0753('0x24')](_0x215840));if(_0x215840[_0x0753('0x25')]){if(_0x215840[_0x0753('0x25')][_0x0753('0x26')]===0x1f4){logger[_0x0753('0x25')](_0x0753('0x21'),_0x2be0ed,_0x215840[_0x0753('0x25')][_0x0753('0x27')]);return _0x2a521e(_0x215840['error'][_0x0753('0x27')]);}logger['error'](_0x0753('0x21'),_0x2be0ed,_0x215840[_0x0753('0x25')][_0x0753('0x27')]);return _0x2a93fd(_0x215840[_0x0753('0x25')][_0x0753('0x27')]);}else{logger[_0x0753('0x28')](_0x0753('0x21'),_0x2be0ed,'request\x20sent');_0x2a93fd(_0x215840['result'][_0x0753('0x27')]);}})[_0x0753('0x29')](function(_0xbd2550){logger['error']('User,\x20%s,\x20%s',_0x2be0ed,_0xbd2550);_0x2a521e(_0xbd2550);});});}function respondWithStatusCode(_0x4367b4,_0x22b0cf){_0x22b0cf=_0x22b0cf||0xcc;return function(_0x4a2640){if(_0x4a2640){return _0x4367b4['sendStatus'](_0x22b0cf);}return _0x4367b4['status'](_0x22b0cf)[_0x0753('0x2a')]();};}function respondWithResult(_0x269bb3,_0x12a5c8){_0x12a5c8=_0x12a5c8||0xc8;return function(_0x3d51c2){if(_0x3d51c2){return _0x269bb3['status'](_0x12a5c8)[_0x0753('0x2b')](_0x3d51c2);}};}function respondWithFilteredResult(_0x42e4d1,_0x24cd17){return function(_0x50e814){if(_0x50e814){var _0x437a5c=_0x50e814[_0x0753('0x2c')],_0x3d4ef5=_0x24cd17[_0x0753('0x2d')],_0xbb2120=_0x24cd17[_0x0753('0x2d')]+_0x24cd17[_0x0753('0x2e')],_0x4a30cd;if(_0xbb2120>=_0x437a5c){_0xbb2120=_0x437a5c;_0x4a30cd=0xc8;}else{_0x4a30cd=0xce;}_0x42e4d1[_0x0753('0x2f')](_0x4a30cd);return _0x42e4d1['set']('Content-Range',_0x3d4ef5+'-'+_0xbb2120+'/'+_0x437a5c)[_0x0753('0x2b')](_0x50e814);}return null;};}function patchUpdates(_0x12af7a){return function(_0x5cd9bf){try{jsonpatch[_0x0753('0x30')](_0x5cd9bf,_0x12af7a,!![]);}catch(_0x1a92ab){return BPromise['reject'](_0x1a92ab);}return _0x5cd9bf['save']();};}function saveUpdates(_0xd69c6f,_0x52e231){return function(_0x266576){if(_0x266576){return _0x266576[_0x0753('0x31')](_0xd69c6f)[_0x0753('0x20')](function(_0x3d7141){return _0x3d7141;});}return null;};}function removeEntity(_0x2ba724,_0x1a92d9){return function(_0x59d427){if(_0x59d427){return _0x59d427['destroy']()[_0x0753('0x20')](function(){var _0x5ed4e7=_0x59d427[_0x0753('0x32')]({'plain':!![]});var _0x41e2da=[{'name':_0x0753('0x33'),'value':_0x0753('0x34'),'ignore':!![]},{'name':'Agents','value':_0x0753('0x35'),'ignore':![]},{'name':_0x0753('0x36'),'value':_0x0753('0x37'),'ignore':![]}];var _0x4debae=_(_0x41e2da)[_0x0753('0x38')](_0x0753('0x39'))['map']('value')[_0x0753('0x3a')]();if(_[_0x0753('0x3b')](_0x4debae,_0x5ed4e7['role'])){return;}var _0x11435e=_[_0x0753('0x3c')](_0x41e2da,['value',_0x5ed4e7[_0x0753('0x3d')]])[_0x0753('0x3e')];return db['UserProfileResource'][_0x0753('0x3f')]({'where':{'type':_0x11435e,'resourceId':_0x5ed4e7['id']}})[_0x0753('0x20')](function(){return _0x59d427;});})[_0x0753('0x20')](function(){_0x2ba724[_0x0753('0x2f')](0xcc)[_0x0753('0x2a')]();});}};}function handleEntityNotFound(_0x2c8f25,_0x42b2c8){return function(_0x2f7ebc){if(!_0x2f7ebc){_0x2c8f25[_0x0753('0x40')](0x194);}return _0x2f7ebc;};}function handleError(_0x42f44e,_0x2c18c8){_0x2c18c8=_0x2c18c8||0x1f4;return function(_0x5c3d56){logger[_0x0753('0x25')](_0x5c3d56[_0x0753('0x41')]);if(_0x5c3d56[_0x0753('0x3e')]){delete _0x5c3d56[_0x0753('0x3e')];}_0x42f44e[_0x0753('0x2f')](_0x2c18c8)[_0x0753('0x42')](_0x5c3d56);};}exports[_0x0753('0x43')]=function(_0x307d4e,_0x5aa451){var _0x3f5560={},_0x2106ca={},_0x3f553c={'count':0x0,'rows':[]};var _0x1f8283=_['map'](db['User'][_0x0753('0x44')],function(_0x3bd66c){return{'name':_0x3bd66c['fieldName'],'type':_0x3bd66c[_0x0753('0x45')][_0x0753('0x46')]};});_0x2106ca[_0x0753('0x47')]=_['differenceBy'](_[_0x0753('0x48')](_0x1f8283,_0x0753('0x3e')),[_0x0753('0x49'),_0x0753('0x4a')]);_0x2106ca['query']=_[_0x0753('0x4b')](_0x307d4e[_0x0753('0x4c')]);_0x2106ca[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x2106ca[_0x0753('0x47')],_0x2106ca[_0x0753('0x4c')]);_0x3f5560[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x2106ca[_0x0753('0x47')],qs['fields'](_0x307d4e['query']['fields']));_0x3f5560[_0x0753('0x4f')]=_0x3f5560[_0x0753('0x4f')][_0x0753('0x50')]?_0x3f5560[_0x0753('0x4f')]:_0x2106ca[_0x0753('0x47')];if(!_0x307d4e[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x3f5560[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x307d4e[_0x0753('0x4c')][_0x0753('0x2e')]);_0x3f5560['offset']=qs['offset'](_0x307d4e[_0x0753('0x4c')][_0x0753('0x2d')]);}_0x3f5560['order']=qs[_0x0753('0x53')](_0x307d4e[_0x0753('0x4c')][_0x0753('0x53')]);_0x3f5560[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x307d4e[_0x0753('0x4c')],_0x2106ca[_0x0753('0x4d')]),_0x1f8283);if(_0x307d4e[_0x0753('0x4c')]['filter']){_0x3f5560[_0x0753('0x54')]=_[_0x0753('0x56')](_0x3f5560[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x1f8283,function(_0x3790e9){if(_0x3790e9[_0x0753('0x45')]!==_0x0753('0x57')){return db[_0x0753('0x58')][_0x0753('0x54')](db[_0x0753('0x58')]['fn'](_0x0753('0x59'),db['sequelize']['col'](_0x3790e9[_0x0753('0x3e')])),{'$like':db['sequelize']['fn'](_0x0753('0x59'),'%'+_0x307d4e['query'][_0x0753('0x38')]+'%')});}})});}_0x3f5560=_['merge']({},_0x3f5560,_0x307d4e[_0x0753('0x5a')]);var _0x2d6dd3={'where':_0x3f5560['where']};return db[_0x0753('0x5b')][_0x0753('0x2c')](_0x2d6dd3)[_0x0753('0x20')](function(_0x2b58a0){_0x3f553c[_0x0753('0x2c')]=_0x2b58a0;if(_0x307d4e[_0x0753('0x4c')][_0x0753('0x5c')]){_0x3f5560[_0x0753('0x5d')]=[{'all':!![]}];}return db['User'][_0x0753('0x5e')](_0x3f5560);})['then'](function(_0x4bc1d3){_0x3f553c[_0x0753('0x5f')]=_0x4bc1d3;return _0x3f553c;})['then'](respondWithFilteredResult(_0x5aa451,_0x3f5560))[_0x0753('0x29')](handleError(_0x5aa451,null));};exports['show']=function(_0x22f33d,_0x2ffed5){var _0x4f6fc9={'raw':![],'where':{'id':_0x22f33d[_0x0753('0x60')]['id']}},_0x52e4d2={};_0x52e4d2[_0x0753('0x47')]=_[_0x0753('0x61')](_['keys'](db[_0x0753('0x5b')][_0x0753('0x44')]),[_0x0753('0x49'),_0x0753('0x4a')]);_0x52e4d2[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x22f33d[_0x0753('0x4c')]);_0x52e4d2[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x52e4d2[_0x0753('0x47')],_0x52e4d2[_0x0753('0x4c')]);_0x4f6fc9[_0x0753('0x4f')]=_['intersection'](_0x52e4d2[_0x0753('0x47')],qs['fields'](_0x22f33d['query']['fields']));_0x4f6fc9[_0x0753('0x4f')]=_0x4f6fc9['attributes'][_0x0753('0x50')]?_0x4f6fc9[_0x0753('0x4f')]:_0x52e4d2['model'];if(_0x22f33d[_0x0753('0x4c')]['includeAll']){_0x4f6fc9[_0x0753('0x5d')]=[{'all':!![]}];}_0x4f6fc9=_['merge']({},_0x4f6fc9,_0x22f33d[_0x0753('0x5a')]);return db['User'][_0x0753('0x3c')](_0x4f6fc9)[_0x0753('0x20')](handleEntityNotFound(_0x2ffed5,null))[_0x0753('0x20')](respondWithResult(_0x2ffed5,null))[_0x0753('0x29')](handleError(_0x2ffed5,null));};exports[_0x0753('0x62')]=function(_0x22b039,_0x4a8c60){return db[_0x0753('0x5b')][_0x0753('0x62')](_0x22b039['body'],{'raw':![],'individualHooks':!![]})[_0x0753('0x20')](respondWithResult(_0x4a8c60,0xc9))['catch'](handleError(_0x4a8c60,null));};exports['update']=function(_0x4df65b,_0x2e5dcf){if(_0x4df65b[_0x0753('0x63')]['id']){delete _0x4df65b[_0x0753('0x63')]['id'];}delete _0x4df65b[_0x0753('0x63')][_0x0753('0x3d')];return db[_0x0753('0x5b')]['find']({'where':{'id':_0x4df65b[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2e5dcf,null))[_0x0753('0x20')](saveUpdates(_0x4df65b[_0x0753('0x63')],null))[_0x0753('0x20')](respondWithResult(_0x2e5dcf,null))['catch'](handleError(_0x2e5dcf,null));};exports[_0x0753('0x64')]=function(_0xb6bcc6,_0x36ac46){return db['User'][_0x0753('0x64')]()['then'](respondWithResult(_0x36ac46,null))['catch'](handleError(_0x36ac46,null));};exports[_0x0753('0x65')]=function(_0x4a9b03,_0x3848a1,_0x2c2c9d){return db[_0x0753('0x5b')]['find']({'where':{'id':_0x4a9b03['params']['id']}})['then'](handleEntityNotFound(_0x3848a1,null))[_0x0753('0x20')](function(_0x5af1fd){if(_0x5af1fd){return _0x5af1fd[_0x0753('0x65')](_0x4a9b03[_0x0753('0x63')][_0x0753('0x66')],_[_0x0753('0x67')](_0x4a9b03[_0x0753('0x63')],[_0x0753('0x66'),'id'])||{});}})[_0x0753('0x20')](respondWithResult(_0x3848a1,null))[_0x0753('0x29')](handleError(_0x3848a1,null));};var getLicense=function(_0x303f58){return new BPromise(function(_0x2a771e,_0x3a626a){var _0x1bbd42=0x0;_0x303f58['body']['role']==='agent'&&_0x2a771e('agent\x20role');return db['User'][_0x0753('0x2c')]({'where':{'$or':[{'role':_0x303f58['body'][_0x0753('0x3d')]===_0x0753('0x37')?_0x0753('0x37'):[_0x0753('0x68'),'user']}]}})[_0x0753('0x20')](function(_0x652fe8){_0x1bbd42=_0x652fe8;return require(_0x0753('0x69'))['getLicense']();})[_0x0753('0x20')](function(_0x2d797f){var _0x15e57f=_0x303f58[_0x0753('0x63')][_0x0753('0x3d')]==='telephone'?_0x0753('0x6a'):_0x0753('0x6b');if(!_['isNil'](_0x2d797f[_0x15e57f])&&_0x1bbd42>=_0x2d797f[_0x15e57f]){return _0x3a626a({'message':'License\x20limit\x20reached'});}return _0x2a771e(util['format']('count\x20%s:\x20%s',_0x15e57f,_0x1bbd42));})[_0x0753('0x29')](function(_0x148d34){return _0x3a626a(_0x148d34);});});};exports[_0x0753('0x6c')]=function(_0x4dedf1,_0x57b019){return getLicense(_0x4dedf1)[_0x0753('0x20')](function(_0x439453){if(!_0x4dedf1[_0x0753('0x63')]['internal']){var _0x382699;return db['Setting'][_0x0753('0x6d')](0x1)[_0x0753('0x20')](function(_0x584f9b){return checkPasswordPattern(_0x584f9b,_0x4dedf1['body'][_0x0753('0x49')],_0x584f9b['securePassword']);})[_0x0753('0x20')](function(_0x26c0c6){_0x382699=_0x26c0c6[_0x0753('0x6e')];return db['User']['max']('internal');})[_0x0753('0x20')](function(_0x42ba3e){if(_[_0x0753('0x6f')](_0x42ba3e)){if(_0x382699){_0x4dedf1[_0x0753('0x63')]['internal']=_0x382699;}else{_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')]=0x1;}}else{if(_[_0x0753('0x6f')](_0x382699)||_0x382699==_0x42ba3e){_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')]=_0x42ba3e+0x1;}else if(_0x382699>_0x42ba3e){_0x4dedf1['body']['internal']=_0x382699;}else{return db[_0x0753('0x58')]['query'](_0x0753('0x71'),{'type':db[_0x0753('0x58')]['QueryTypes'][_0x0753('0x72')]})[_0x0753('0x20')](function(_0x2b2d57){if(_0x2b2d57&&_0x2b2d57[_0x0753('0x50')]){for(var _0x89255e=0x0,_0x3a4d64=_0x2b2d57[_0x0753('0x50')];_0x89255e<_0x3a4d64&&_[_0x0753('0x6f')](_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')]);_0x89255e++){if(_0x382699<=_0x2b2d57[_0x89255e]['from']){_0x4dedf1[_0x0753('0x63')]['internal']=_0x2b2d57[_0x89255e][_0x0753('0x73')];}else if(_0x382699>_0x2b2d57[_0x89255e][_0x0753('0x73')]&&_0x382699<=_0x2b2d57[_0x89255e]['to']){_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')]=_0x382699;}}}if(_['isNil'](_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')])){_0x4dedf1['body'][_0x0753('0x70')]=_0x42ba3e+0x1;}});}}});}})[_0x0753('0x20')](function(){if(_0x4dedf1[_0x0753('0x63')][_0x0753('0x74')]){_0x4dedf1[_0x0753('0x63')][_0x0753('0x75')]=_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')];_0x4dedf1['body'][_0x0753('0x76')]={'mailbox':_0x4dedf1[_0x0753('0x63')]['internal'],'password':_0x4dedf1['body']['password'],'fullname':_0x4dedf1[_0x0753('0x63')][_0x0753('0x77')],'email':_0x4dedf1[_0x0753('0x63')][_0x0753('0x78')]};}if(_0x4dedf1[_0x0753('0x63')]&&_0x4dedf1[_0x0753('0x63')]['role']===_0x0753('0x35')){if(!_0x4dedf1['body'][_0x0753('0x79')]){_0x4dedf1[_0x0753('0x63')][_0x0753('0x79')]=[_0x0753('0x7a'),_0x0753('0x7b'),'103',_0x0753('0x7c'),_0x0753('0x7d'),_0x0753('0x7e'),_0x0753('0x7f'),_0x0753('0x80'),'107',_0x0753('0x81'),'109','100',_0x0753('0x82'),_0x0753('0x83')];}}return db[_0x0753('0x5b')][_0x0753('0x6c')](_0x4dedf1[_0x0753('0x63')],{'include':[{'model':db['VoiceMail'],'as':_0x0753('0x76')}]});})['then'](function(_0x560fd2){if(_0x4dedf1[_0x0753('0x63')][_0x0753('0x3d')]===_0x0753('0x34'))return _0x560fd2;var _0x56ed53=_0x4dedf1[_0x0753('0x34')][_0x0753('0x32')]({'plain':!![]});if(!_0x56ed53)throw new Error(_0x0753('0x84'));if(_0x56ed53[_0x0753('0x3d')]===_0x0753('0x34')){var _0x527889=_0x560fd2['get']({'plain':!![]});var _0x592e8d=[{'name':_0x0753('0x85'),'value':_0x0753('0x35')},{'name':'Telephones','value':'telephone'}];var _0x23854a=_[_0x0753('0x3c')](_0x592e8d,['value',_0x527889['role']])['name'];return db[_0x0753('0x86')][_0x0753('0x3c')]({'where':{'name':_0x23854a,'userProfileId':_0x56ed53['userProfileId']},'raw':!![]})['then'](function(_0x3b4e63){if(_0x3b4e63&&_0x3b4e63['autoAssociation']===0x0){return db[_0x0753('0x87')][_0x0753('0x6c')]({'name':_0x527889['name'],'resourceId':_0x527889['id'],'type':_0x3b4e63['name'],'sectionId':_0x3b4e63['id']},{})[_0x0753('0x20')](function(){return _0x560fd2;});}else{return _0x560fd2;}})[_0x0753('0x29')](function(_0x3b55fc){logger[_0x0753('0x25')](_0x0753('0x88'),_0x3b55fc);throw _0x3b55fc;});}return _0x560fd2;})[_0x0753('0x20')](respondWithResult(_0x57b019,0xc9))['catch'](handleError(_0x57b019,null));};exports[_0x0753('0x89')]=function(_0x4daae5,_0x4b73aa,_0x14ff33){var _0x398d78=![];if(_0x4daae5[_0x0753('0x63')]['id']){delete _0x4daae5[_0x0753('0x63')]['id'];}return db[_0x0753('0x8a')][_0x0753('0x8b')]({'attributes':['id',_0x0753('0x8c')]})['then'](function(_0x1b6ece){_0x398d78=_0x1b6ece[_0x0753('0x8c')];return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x4daae5[_0x0753('0x60')]['id']}});})[_0x0753('0x20')](function(_0x2d72b1){if(_0x2d72b1){if(_0x2d72b1['id']==_0x4daae5['user']['id']){if(!_0x4daae5[_0x0753('0x63')]['oldPassword']||!_0x4daae5[_0x0753('0x63')][_0x0753('0x8d')]){throw new db[(_0x0753('0x1c'))]['ValidationError'](_0x0753('0x8e'));}if(!_0x2d72b1['authenticate'](_0x4daae5['body']['oldPassword'])){throw new db['Sequelize'][(_0x0753('0x1d'))](_0x0753('0x8f'));}if(_0x4daae5[_0x0753('0x63')]['oldPassword']==_0x4daae5[_0x0753('0x63')]['newPassword']){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x90'));}return _0x2d72b1;}else if(_0x4daae5['user'][_0x0753('0x3d')]==_0x0753('0x68')){if(!_0x4daae5[_0x0753('0x63')]['newPassword']){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x2d72b1;}else if(_0x4daae5[_0x0753('0x34')][_0x0753('0x3d')]=='user'){if(!_0x4daae5[_0x0753('0x63')][_0x0753('0x8d')]){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x91'));}if(_0x2d72b1[_0x0753('0x3d')]!=_0x0753('0x35')){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x92'));}return _0x2d72b1;}else{throw new db['Sequelize'][(_0x0753('0x1d'))](_0x0753('0x92'));}}return null;})[_0x0753('0x20')](handleEntityNotFound(_0x4b73aa,null))[_0x0753('0x20')](function(_0x3bc356){return checkPasswordPattern(_0x3bc356,_0x4daae5[_0x0753('0x63')]['newPassword'],_0x398d78);})[_0x0753('0x20')](saveUpdates({'password':_0x4daae5['body'][_0x0753('0x8d')],'passwordResetAt':_0x4daae5['user']['id']==_0x4daae5[_0x0753('0x60')]['id']?moment():null},null))[_0x0753('0x20')](respondWithResult(_0x4b73aa,null))[_0x0753('0x29')](handleError(_0x4b73aa,null));};exports[_0x0753('0x93')]=function(_0x1cc794,_0x5b1ed8,_0x331432){var _0x3f5ef9=_0x1cc794[_0x0753('0x63')]['channel'];return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x1cc794['params']['id']},'attributes':['id',_0x0753('0x3e'),'role',_0x0753('0x94'),'loginInPause','voicePause','interface']})[_0x0753('0x20')](handleEntityNotFound(_0x5b1ed8,null))[_0x0753('0x20')](function(_0x45ec26){if(_0x45ec26){if(!utils['isValidChannel'](_0x3f5ef9)){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x95'));}return _0x45ec26['add'+_[_0x0753('0x96')](_0x3f5ef9['toLowerCase']())+_0x0753('0x97')](_0x1cc794[_0x0753('0x63')][_0x0753('0x66')],{'penalty':_0x1cc794['body']['penalty']||0x0})[_0x0753('0x98')](function(_0x259f59){for(var _0x2582db=0x0;_0x2582db<_0x1cc794[_0x0753('0x63')][_0x0753('0x66')][_0x0753('0x50')];_0x2582db+=0x1){var _0x4f997f={'UserId':_0x1cc794[_0x0753('0x60')]['id']};_0x4f997f[_[_0x0753('0x96')](_0x3f5ef9[_0x0753('0x99')]())+_0x0753('0x9a')]=_0x1cc794['body'][_0x0753('0x66')][_0x2582db];socket['emit'](_0x0753('0x34')+_[_0x0753('0x96')](_0x3f5ef9[_0x0753('0x99')]())+'Queue:save',_0x4f997f);}return _0x259f59;})['then'](function(){if(_0x3f5ef9===_0x0753('0x9b')){return db[_0x0753('0x9c')][_0x0753('0x5e')]({'where':{'id':_0x1cc794[_0x0753('0x63')][_0x0753('0x66')]||[]},'raw':!![],'attributes':['id',_0x0753('0x3e')]});}})['then'](function(_0xa50efe){var _0xd6575d=_0x45ec26[_0x0753('0x32')]({'plain':!![]});var _0x1800a7=[];if(_0x3f5ef9===_0x0753('0x9b')&&_0xd6575d['role']===_0x0753('0x35')&&_0xd6575d[_0x0753('0x94')]){for(var _0xfb15c1=0x0;_0xfb15c1<_0xa50efe[_0x0753('0x50')];_0xfb15c1+=0x1){_0x1800a7[_0x0753('0x9d')]({'membername':_0xd6575d[_0x0753('0x3e')],'UserId':_0xd6575d['id'],'queue_name':_0xa50efe[_0xfb15c1]['name'],'VoiceQueueId':_0xa50efe[_0xfb15c1]['id'],'interface':_['isNil'](_0xd6575d[_0x0753('0x9e')])?util[_0x0753('0x9f')](_0x0753('0xa0'),_0xd6575d[_0x0753('0x3e')]):_0xd6575d[_0x0753('0x9e')],'paused':_0xd6575d[_0x0753('0xa1')]||![],'penalty':_0x1cc794[_0x0753('0x63')][_0x0753('0xa2')]||0x0});}return BPromise[_0x0753('0xa3')](_0x1800a7,function(_0x5af10a){return db['UserVoiceQueueRt'][_0x0753('0xa4')](_0x5af10a);});}return _0x45ec26;});}})[_0x0753('0x20')](respondWithStatusCode(_0x5b1ed8,null))[_0x0753('0x29')](handleError(_0x5b1ed8,null));};exports['removeQueues']=function(_0x25341f,_0x514af9,_0x4077b3){var _0x2d706a;return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x25341f['params']['id']},'attributes':['id','name','role']})[_0x0753('0x20')](handleEntityNotFound(_0x514af9,null))['then'](function(_0x11c5cc){if(_0x11c5cc){_0x2d706a=_0x11c5cc;if(!_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')]||!utils[_0x0753('0xa6')](_0x25341f['query'][_0x0753('0xa5')])){throw new db[(_0x0753('0x1c'))]['ValidationError'](_0x0753('0x95'));}return _0x11c5cc[_0x0753('0xa7')+_[_0x0753('0x96')](_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')][_0x0753('0x99')]())+_0x0753('0x97')](_0x25341f[_0x0753('0x4c')][_0x0753('0x66')]);}})['then'](function(_0x5ee888){for(var _0x3c1975=0x0;_0x3c1975<_0x25341f[_0x0753('0x4c')]['ids'][_0x0753('0x50')];_0x3c1975+=0x1){var _0x4b92c5={'UserId':_0x25341f[_0x0753('0x60')]['id']};_0x4b92c5[_[_0x0753('0x96')](_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')][_0x0753('0x99')]())+'QueueId']=_0x25341f[_0x0753('0x4c')][_0x0753('0x66')][_0x3c1975];socket[_0x0753('0xa8')](_0x0753('0x34')+_['capitalize'](_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')][_0x0753('0x99')]())+_0x0753('0xa9'),_0x4b92c5);}return _0x5ee888;})[_0x0753('0x20')](function(){if(_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')]===_0x0753('0x9b')){return db['UserVoiceQueueRt'][_0x0753('0x3f')]({'where':{'UserId':_0x25341f[_0x0753('0x60')]['id'],'VoiceQueueId':_0x25341f[_0x0753('0x4c')]['ids']},'individualHooks':!![]})[_0x0753('0x20')](function(){return _0x2d706a;});}return _0x2d706a;})[_0x0753('0x20')](respondWithStatusCode(_0x514af9,null))[_0x0753('0x29')](handleError(_0x514af9,null));};exports[_0x0753('0xaa')]=function(_0xd8cb23,_0x3e3d2d,_0x260fc8){_0xd8cb23['body'][_0x0753('0xab')]=_0xd8cb23[_0x0753('0xac')][_0x0753('0xad')];return db['User'][_0x0753('0x3c')]({'where':{'id':_0xd8cb23[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x3e3d2d,null))['then'](saveUpdates(_0xd8cb23['body'],null))[_0x0753('0x20')](respondWithResult(_0x3e3d2d,null))[_0x0753('0x29')](handleError(_0x3e3d2d,null));};exports[_0x0753('0xae')]=function(_0x30abd3,_0x24dda9,_0x4d0b5e){var _0xc4f059=path[_0x0753('0xaf')](config[_0x0753('0xb0')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x30abd3[_0x0753('0x60')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x0753('0x20')](handleEntityNotFound(_0x24dda9,null))[_0x0753('0x20')](function(_0x7f8218){if(_0x7f8218){if(_[_0x0753('0x6f')](_0x7f8218[_0x0753('0xab')])){return _0x24dda9[_0x0753('0xb1')](_0xc4f059);}else{if(!fs[_0x0753('0xb2')](path[_0x0753('0xaf')](config['root'],_0x0753('0xb3'),_0x7f8218['userpic']))){return _0x24dda9[_0x0753('0xb1')](_0xc4f059);}return _0x24dda9['download'](path[_0x0753('0xaf')](config['root'],_0x0753('0xb3'),_0x7f8218[_0x0753('0xab')]));}}})['catch'](handleError(_0x24dda9,null));};exports[_0x0753('0xb4')]=function(_0x34b9ff,_0xce010a,_0x36b12f){var _0x23be06={};var _0x594721={};var _0x1b8900;var _0x240fb6;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x34b9ff[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0xce010a,null))[_0x0753('0x20')](function(_0x5efbff){if(_0x5efbff){_0x1b8900=_0x5efbff;_0x594721['model']=_[_0x0753('0x4b')](db['CmContact'][_0x0753('0x44')]);_0x594721['query']=_[_0x0753('0x4b')](_0x34b9ff[_0x0753('0x4c')]);_0x594721['filters']=_['intersection'](_0x594721['model'],_0x594721[_0x0753('0x4c')]);_0x23be06[_0x0753('0x4f')]=_['intersection'](_0x594721[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x34b9ff[_0x0753('0x4c')][_0x0753('0xb5')]));_0x23be06['attributes']=_0x23be06[_0x0753('0x4f')]['length']?_0x23be06['attributes']:_0x594721[_0x0753('0x47')];_0x23be06[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x34b9ff[_0x0753('0x4c')][_0x0753('0x53')]);_0x23be06['where']=qs['filters'](_[_0x0753('0x55')](_0x34b9ff[_0x0753('0x4c')],_0x594721[_0x0753('0x4d')]));if(_0x34b9ff['query'][_0x0753('0x38')]){_0x23be06[_0x0753('0x54')]=_[_0x0753('0x56')](_0x23be06[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x23be06[_0x0753('0x4f')],function(_0x1cedd9){var _0x3655c1={};_0x3655c1[_0x1cedd9]={'$like':'%'+_0x34b9ff[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x3655c1;})});}_0x23be06=_[_0x0753('0x56')]({},_0x23be06,_0x34b9ff[_0x0753('0x5a')]);return _0x1b8900['getContacts'](_0x23be06);}})[_0x0753('0x20')](function(_0x4f1b03){if(_0x4f1b03){_0x240fb6=_0x4f1b03[_0x0753('0x50')];if(_0x34b9ff[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x5c'))){_0x23be06[_0x0753('0x5d')]=[{'model':db[_0x0753('0xb7')],'as':_0x0753('0xb8'),'required':![]},{'model':db[_0x0753('0xb9')],'as':_0x0753('0xba'),'attributes':['id',_0x0753('0x3e'),_0x0753('0xbb')],'where':_0x34b9ff[_0x0753('0x4c')][_0x0753('0xbc')]?{'id':_0x34b9ff[_0x0753('0x4c')][_0x0753('0xbc')]}:undefined,'required':_0x34b9ff[_0x0753('0x4c')]['tag']?!![]:![]}];}if(!_0x34b9ff['query'][_0x0753('0x51')](_0x0753('0x52'))){_0x23be06[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x34b9ff[_0x0753('0x4c')]['limit']);_0x23be06[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x34b9ff[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x1b8900[_0x0753('0xb4')](_0x23be06);}})['then'](function(_0x3f973c){if(_0x3f973c){return _0x3f973c?{'count':_0x240fb6,'rows':_0x3f973c}:null;}})['then'](respondWithResult(_0xce010a,null))['catch'](handleError(_0xce010a,null));};exports[_0x0753('0xbd')]=function(_0x18185e,_0x568959,_0x382b6b){var _0x1a4ce3;var _0x6a2f40;var _0xa2263c={};var _0x2e4dd1;return db['User']['findOne']({'where':{'id':_0x18185e[_0x0753('0x60')]['id']},'attributes':['id','name',_0x0753('0x3d')]})[_0x0753('0x20')](handleEntityNotFound(_0x568959,null))[_0x0753('0x20')](function(_0x3299c9){if(!utils[_0x0753('0xa6')](_0x18185e[_0x0753('0x4c')][_0x0753('0xa5')])){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x95'));}_0x1a4ce3=_0x3299c9;var _0x5ea118={};_0x5ea118['model']=_[_0x0753('0x4b')](db[_[_0x0753('0x96')](_0x18185e[_0x0753('0x4c')][_0x0753('0xa5')])+_0x0753('0xbe')]['rawAttributes']);_0x5ea118['query']=_['keys'](_0x18185e[_0x0753('0x4c')]);_0x5ea118['filters']=_[_0x0753('0x4e')](_0x5ea118['model'],_0x5ea118[_0x0753('0x4c')]);_0xa2263c['attributes']=_[_0x0753('0x4e')](_0x5ea118[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x18185e[_0x0753('0x4c')][_0x0753('0xb5')]));_0xa2263c[_0x0753('0x4f')]=_0xa2263c['attributes']['length']?_0xa2263c['attributes']:_0x5ea118[_0x0753('0x47')];_0xa2263c['order']=qs[_0x0753('0x53')](_0x18185e['query']['sort']);_0xa2263c[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x18185e[_0x0753('0x4c')],_0x5ea118[_0x0753('0x4d')]));if(_0x18185e[_0x0753('0x4c')][_0x0753('0x38')]){_0xa2263c[_0x0753('0x54')]=_['merge'](_0xa2263c[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0xa2263c[_0x0753('0x4f')],function(_0x48bace){var _0x3747c1={};_0x3747c1[_0x48bace]={'$like':'%'+_0x18185e[_0x0753('0x4c')]['filter']+'%'};return _0x3747c1;})});}_0xa2263c=_[_0x0753('0x56')]({},_0xa2263c,_0x18185e['options']);switch(_0x1a4ce3[_0x0753('0x3d')]){case _0x0753('0x68'):return db[_[_0x0753('0x96')](_0x18185e[_0x0753('0x4c')][_0x0753('0xa5')])+_0x0753('0xbe')][_0x0753('0x5e')](_0xa2263c);case _0x0753('0x34'):case _0x0753('0x35'):return _0x1a4ce3['get'+_[_0x0753('0x96')](_0x18185e[_0x0753('0x4c')]['channel'])+_0x0753('0x97')](_0xa2263c);default:throw new db['Sequelize'][(_0x0753('0x1d'))](_0x0753('0xbf'));}})[_0x0753('0x20')](function(_0xb59a6c){_0x2e4dd1=_0xb59a6c[_0x0753('0x50')];if(!_0x18185e[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0xa2263c[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x18185e['query'][_0x0753('0x2e')]);_0xa2263c[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x18185e[_0x0753('0x4c')]['offset']);}switch(_0x1a4ce3['role']){case _0x0753('0x68'):return db[_['capitalize'](_0x18185e['query'][_0x0753('0xa5')])+_0x0753('0xbe')]['findAll'](_0xa2263c);case _0x0753('0x34'):case _0x0753('0x35'):return _0x1a4ce3[_0x0753('0x32')+_[_0x0753('0x96')](_0x18185e[_0x0753('0x4c')]['channel'])+_0x0753('0x97')](_0xa2263c);}})[_0x0753('0x20')](function(_0x3d0b9a){return{'count':_0x2e4dd1,'rows':_0x3d0b9a};})[_0x0753('0x20')](respondWithResult(_0x568959,null))[_0x0753('0x29')](handleError(_0x568959,null));};exports[_0x0753('0xc0')]=function(_0x1628a4,_0x91a1d9,_0x44b24f){var _0x30ad0f={};var _0x453eff={};var _0x1d3896;var _0x793eb3;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x1628a4[_0x0753('0x60')]['id']}})['then'](handleEntityNotFound(_0x91a1d9,null))[_0x0753('0x20')](function(_0x30ddf6){if(_0x30ddf6){_0x1d3896=_0x30ddf6;_0x453eff['model']=_[_0x0753('0x4b')](db[_0x0753('0xc1')][_0x0753('0x44')]);_0x453eff['query']=_['keys'](_0x1628a4[_0x0753('0x4c')]);_0x453eff[_0x0753('0x4d')]=_['intersection'](_0x453eff['model'],_0x453eff[_0x0753('0x4c')]);_0x30ad0f[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x453eff['model'],qs['fields'](_0x1628a4[_0x0753('0x4c')][_0x0753('0xb5')]));_0x30ad0f['attributes']=_0x30ad0f[_0x0753('0x4f')][_0x0753('0x50')]?_0x30ad0f[_0x0753('0x4f')]:_0x453eff['model'];_0x30ad0f[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x1628a4[_0x0753('0x4c')][_0x0753('0x53')]);_0x30ad0f[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x1628a4[_0x0753('0x4c')],_0x453eff[_0x0753('0x4d')]));if(_0x1628a4[_0x0753('0x4c')][_0x0753('0x38')]){_0x30ad0f['where']=_['merge'](_0x30ad0f[_0x0753('0x54')],{'$or':_['map'](_0x30ad0f[_0x0753('0x4f')],function(_0x43291b){var _0x4eaee2={};_0x4eaee2[_0x43291b]={'$like':'%'+_0x1628a4['query']['filter']+'%'};return _0x4eaee2;})});}_0x30ad0f=_[_0x0753('0x56')]({},_0x30ad0f,_0x1628a4[_0x0753('0x5a')]);return _0x1d3896[_0x0753('0xc0')](_0x30ad0f);}})['then'](function(_0x42ddf2){if(_0x42ddf2){_0x793eb3=_0x42ddf2['length'];if(!_0x1628a4[_0x0753('0x4c')]['hasOwnProperty']('nolimit')){_0x30ad0f[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x1628a4[_0x0753('0x4c')][_0x0753('0x2e')]);_0x30ad0f[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x1628a4['query'][_0x0753('0x2d')]);}return _0x1d3896[_0x0753('0xc0')](_0x30ad0f);}})[_0x0753('0x20')](function(_0x242940){if(_0x242940){return _0x242940?{'count':_0x793eb3,'rows':_0x242940}:null;}})['then'](respondWithResult(_0x91a1d9,null))[_0x0753('0x29')](handleError(_0x91a1d9,null));};exports[_0x0753('0xc2')]=function(_0x1c9a17,_0x5587b5,_0x89c107){var _0x621401={};var _0x42ae51={};var _0x59d0d7;var _0x2f4210;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x1c9a17['params']['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x5587b5,null))[_0x0753('0x20')](function(_0x338d0d){if(_0x338d0d){_0x59d0d7=_0x338d0d;_0x42ae51[_0x0753('0x47')]=_[_0x0753('0x4b')](db[_0x0753('0xc3')]['rawAttributes']);_0x42ae51[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x1c9a17[_0x0753('0x4c')]);_0x42ae51[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x42ae51['model'],_0x42ae51[_0x0753('0x4c')]);_0x621401[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x42ae51[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x1c9a17[_0x0753('0x4c')][_0x0753('0xb5')]));_0x621401[_0x0753('0x4f')]=_0x621401[_0x0753('0x4f')][_0x0753('0x50')]?_0x621401[_0x0753('0x4f')]:_0x42ae51[_0x0753('0x47')];_0x621401[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x1c9a17[_0x0753('0x4c')][_0x0753('0x53')]);_0x621401[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x1c9a17[_0x0753('0x4c')],_0x42ae51['filters']));if(_0x1c9a17[_0x0753('0x4c')]['filter']){_0x621401[_0x0753('0x54')]=_[_0x0753('0x56')](_0x621401['where'],{'$or':_['map'](_0x621401['attributes'],function(_0x119d80){var _0x30536e={};_0x30536e[_0x119d80]={'$like':'%'+_0x1c9a17[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x30536e;})});}_0x621401=_['merge']({},_0x621401,_0x1c9a17[_0x0753('0x5a')]);return _0x59d0d7[_0x0753('0xc2')](_0x621401);}})[_0x0753('0x20')](function(_0x3754b2){if(_0x3754b2){_0x2f4210=_0x3754b2[_0x0753('0x50')];if(!_0x1c9a17[_0x0753('0x4c')]['hasOwnProperty'](_0x0753('0x52'))){_0x621401['limit']=qs[_0x0753('0x2e')](_0x1c9a17['query']['limit']);_0x621401[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x1c9a17[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x59d0d7['getGroups'](_0x621401);}})[_0x0753('0x20')](function(_0x5073a1){if(_0x5073a1){return _0x5073a1?{'count':_0x2f4210,'rows':_0x5073a1}:null;}})['then'](respondWithResult(_0x5587b5,null))[_0x0753('0x29')](handleError(_0x5587b5,null));};exports['getRecordings']=function(_0x139511,_0x2d6411,_0x1b7939){var _0x2c05d3={'raw':!![],'where':{}};var _0x29b772={};var _0x5db6a8={'count':0x0,'rows':[]};return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x139511[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2d6411,null))[_0x0753('0x20')](function(_0x15bc4c){if(_0x15bc4c){_0x29b772[_0x0753('0x47')]=_[_0x0753('0x4b')](db['VoiceRecording'][_0x0753('0x44')]);_0x29b772['query']=_[_0x0753('0x4b')](_0x139511[_0x0753('0x4c')]);_0x29b772[_0x0753('0x4d')]=_['intersection'](_0x29b772[_0x0753('0x47')],_0x29b772[_0x0753('0x4c')]);_0x2c05d3['attributes']=_['intersection'](_0x29b772['model'],qs[_0x0753('0xb5')](_0x139511[_0x0753('0x4c')][_0x0753('0xb5')]));_0x2c05d3['attributes']=_0x2c05d3[_0x0753('0x4f')]['length']?_0x2c05d3[_0x0753('0x4f')]:_0x29b772['model'];if(!_0x139511['query'][_0x0753('0x51')](_0x0753('0x52'))){_0x2c05d3[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x139511[_0x0753('0x4c')][_0x0753('0x2e')]);_0x2c05d3[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x139511['query'][_0x0753('0x2d')]);}_0x2c05d3['order']=qs[_0x0753('0x53')](_0x139511[_0x0753('0x4c')][_0x0753('0x53')]);_0x2c05d3['where']=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x139511[_0x0753('0x4c')],_0x29b772[_0x0753('0x4d')]));_0x2c05d3[_0x0753('0x54')]['UserId']=_0x15bc4c['id'];if(_0x139511[_0x0753('0x4c')][_0x0753('0x38')]){_0x2c05d3[_0x0753('0x54')]=_[_0x0753('0x56')](_0x2c05d3[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x2c05d3[_0x0753('0x4f')],function(_0xadb867){var _0x2d17ab={};_0x2d17ab[_0xadb867]={'$like':'%'+_0x139511[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x2d17ab;})});}_0x2c05d3=_[_0x0753('0x56')]({},_0x2c05d3,_0x139511[_0x0753('0x5a')]);return db['VoiceRecording']['count']({'where':_0x2c05d3[_0x0753('0x54')]})[_0x0753('0x20')](function(_0x21ad0d){_0x5db6a8[_0x0753('0x2c')]=_0x21ad0d;if(_0x139511[_0x0753('0x4c')][_0x0753('0x5c')]){_0x2c05d3[_0x0753('0x5d')]=[{'all':!![]}];}return db[_0x0753('0xc4')]['findAll'](_0x2c05d3);})[_0x0753('0x20')](function(_0x302367){_0x5db6a8[_0x0753('0x5f')]=_0x302367;return _0x5db6a8;});}})['then'](respondWithFilteredResult(_0x2d6411,_0x2c05d3))[_0x0753('0x29')](handleError(_0x2d6411,null));};exports['getScreenRecordings']=function(_0x5d4832,_0x4ac3ad,_0x4aea12){var _0x127990={'raw':!![],'where':{}};var _0xc43e9d={};var _0x2cb70d={'count':0x0,'rows':[]};return db['User'][_0x0753('0x8b')]({'where':{'id':_0x5d4832[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x4ac3ad,null))['then'](function(_0x4ac757){if(_0x4ac757){_0xc43e9d['model']=_[_0x0753('0x4b')](db['ScreenRecording'][_0x0753('0x44')]);_0xc43e9d[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x5d4832[_0x0753('0x4c')]);_0xc43e9d[_0x0753('0x4d')]=_['intersection'](_0xc43e9d[_0x0753('0x47')],_0xc43e9d[_0x0753('0x4c')]);_0x127990['attributes']=_[_0x0753('0x4e')](_0xc43e9d[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x5d4832[_0x0753('0x4c')][_0x0753('0xb5')]));_0x127990[_0x0753('0x4f')]=_0x127990[_0x0753('0x4f')]['length']?_0x127990[_0x0753('0x4f')]:_0xc43e9d[_0x0753('0x47')];if(!_0x5d4832[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x127990['limit']=qs[_0x0753('0x2e')](_0x5d4832['query'][_0x0753('0x2e')]);_0x127990[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x5d4832['query']['offset']);}_0x127990[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x5d4832[_0x0753('0x4c')][_0x0753('0x53')]);_0x127990[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x5d4832[_0x0753('0x4c')],_0xc43e9d[_0x0753('0x4d')]));_0x127990[_0x0753('0x54')][_0x0753('0xc5')]=_0x4ac757['id'];if(_0x5d4832['query'][_0x0753('0x38')]){_0x127990[_0x0753('0x54')]=_[_0x0753('0x56')](_0x127990[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x127990['attributes'],function(_0x2eba8b){var _0x4d56d8={};_0x4d56d8[_0x2eba8b]={'$like':'%'+_0x5d4832[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x4d56d8;})});}_0x127990=_[_0x0753('0x56')]({},_0x127990,_0x5d4832[_0x0753('0x5a')]);return db[_0x0753('0xc6')]['count']({'where':_0x127990['where']})[_0x0753('0x20')](function(_0x24f02a){_0x2cb70d['count']=_0x24f02a;if(_0x5d4832['query'][_0x0753('0x5c')]){_0x127990[_0x0753('0x5d')]=[{'all':!![]}];}return db[_0x0753('0xc6')][_0x0753('0x5e')](_0x127990);})['then'](function(_0x4d80f0){_0x2cb70d['rows']=_0x4d80f0;return _0x2cb70d;});}})[_0x0753('0x20')](respondWithFilteredResult(_0x4ac3ad,_0x127990))[_0x0753('0x29')](handleError(_0x4ac3ad,null));};exports[_0x0753('0xc7')]=function(_0x364b1a,_0x2488e8,_0x5c3a46){var _0x437c6b={};var _0x519758={};var _0x3a82fc;var _0x7e56c6;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x364b1a[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2488e8,null))['then'](function(_0x1b6e5e){if(_0x1b6e5e){_0x3a82fc=_0x1b6e5e;_0x519758[_0x0753('0x47')]=_['keys'](db[_0x0753('0xc8')][_0x0753('0x44')]);_0x519758[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x364b1a[_0x0753('0x4c')]);_0x519758[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x519758[_0x0753('0x47')],_0x519758[_0x0753('0x4c')]);_0x437c6b[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x519758[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x364b1a['query'][_0x0753('0xb5')]));_0x437c6b[_0x0753('0x4f')]=_0x437c6b[_0x0753('0x4f')][_0x0753('0x50')]?_0x437c6b[_0x0753('0x4f')]:_0x519758[_0x0753('0x47')];_0x437c6b[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x364b1a[_0x0753('0x4c')]['sort']);_0x437c6b[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x364b1a['query'],_0x519758[_0x0753('0x4d')]));if(_0x364b1a[_0x0753('0x4c')][_0x0753('0x38')]){_0x437c6b[_0x0753('0x54')]=_[_0x0753('0x56')](_0x437c6b[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x437c6b[_0x0753('0x4f')],function(_0x938cc7){var _0x1491f1={};_0x1491f1[_0x938cc7]={'$like':'%'+_0x364b1a[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x1491f1;})});}_0x437c6b=_[_0x0753('0x56')]({},_0x437c6b,_0x364b1a['options']);return _0x3a82fc[_0x0753('0xc7')](_0x437c6b);}})[_0x0753('0x20')](function(_0x1619e9){if(_0x1619e9){_0x7e56c6=_0x1619e9[_0x0753('0x50')];if(!_0x364b1a['query'][_0x0753('0x51')]('nolimit')){_0x437c6b[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x364b1a[_0x0753('0x4c')][_0x0753('0x2e')]);_0x437c6b[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x364b1a['query'][_0x0753('0x2d')]);}return _0x3a82fc[_0x0753('0xc7')](_0x437c6b);}})[_0x0753('0x20')](function(_0x2e80ad){if(_0x2e80ad){return _0x2e80ad?{'count':_0x7e56c6,'rows':_0x2e80ad}:null;}})[_0x0753('0x20')](respondWithResult(_0x2488e8,null))['catch'](handleError(_0x2488e8,null));};exports[_0x0753('0xc9')]=function(_0x42434a,_0x302e42,_0x55c240){var _0x2bb47f={};var _0x218e84={};var _0x1b1acb;var _0x31a7eb;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x42434a[_0x0753('0x60')]['id']}})['then'](handleEntityNotFound(_0x302e42,null))[_0x0753('0x20')](function(_0x362c8e){if(_0x362c8e){_0x1b1acb=_0x362c8e;_0x218e84['model']=_[_0x0753('0x4b')](db[_0x0753('0xca')][_0x0753('0x44')]);_0x218e84['query']=_[_0x0753('0x4b')](_0x42434a[_0x0753('0x4c')]);_0x218e84['filters']=_[_0x0753('0x4e')](_0x218e84[_0x0753('0x47')],_0x218e84[_0x0753('0x4c')]);_0x2bb47f[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x218e84[_0x0753('0x47')],qs['fields'](_0x42434a['query'][_0x0753('0xb5')]));_0x2bb47f[_0x0753('0x4f')]=_0x2bb47f['attributes'][_0x0753('0x50')]?_0x2bb47f[_0x0753('0x4f')]:_0x218e84[_0x0753('0x47')];_0x2bb47f[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x42434a['query'][_0x0753('0x53')]);_0x2bb47f['where']=qs['filters'](_['pick'](_0x42434a[_0x0753('0x4c')],_0x218e84[_0x0753('0x4d')]));if(_0x42434a['query'][_0x0753('0x38')]){_0x2bb47f[_0x0753('0x54')]=_[_0x0753('0x56')](_0x2bb47f[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x2bb47f[_0x0753('0x4f')],function(_0xb6b35a){var _0x417f45={};_0x417f45[_0xb6b35a]={'$like':'%'+_0x42434a[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x417f45;})});}_0x2bb47f=_['merge']({},_0x2bb47f,_0x42434a[_0x0753('0x5a')]);return _0x1b1acb[_0x0753('0xc9')](_0x2bb47f);}})['then'](function(_0x1e7246){if(_0x1e7246){_0x31a7eb=_0x1e7246['length'];if(!_0x42434a[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x2bb47f[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x42434a['query']['limit']);_0x2bb47f['offset']=qs[_0x0753('0x2d')](_0x42434a[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x1b1acb[_0x0753('0xc9')](_0x2bb47f);}})['then'](function(_0x14089f){if(_0x14089f){return _0x14089f?{'count':_0x31a7eb,'rows':_0x14089f}:null;}})[_0x0753('0x20')](respondWithResult(_0x302e42,null))[_0x0753('0x29')](handleError(_0x302e42,null));};exports['getMailInteractions']=function(_0x16f7ae,_0xdbaeea,_0x21e432){var _0x5c4bb7={'raw':!![],'where':{}};var _0x517d58={};var _0x33db34={'count':0x0,'rows':[]};return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x16f7ae[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0xdbaeea,null))[_0x0753('0x20')](function(_0x1c5e81){if(_0x1c5e81){_0x517d58['model']=_['keys'](db[_0x0753('0xcb')][_0x0753('0x44')]);_0x517d58[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x16f7ae['query']);_0x517d58[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x517d58['model'],_0x517d58[_0x0753('0x4c')]);_0x5c4bb7[_0x0753('0x4f')]=_['intersection'](_0x517d58[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x16f7ae[_0x0753('0x4c')][_0x0753('0xb5')]));_0x5c4bb7['attributes']=_0x5c4bb7[_0x0753('0x4f')][_0x0753('0x50')]?_0x5c4bb7[_0x0753('0x4f')]:_0x517d58[_0x0753('0x47')];if(!_0x16f7ae[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x5c4bb7['limit']=qs[_0x0753('0x2e')](_0x16f7ae[_0x0753('0x4c')][_0x0753('0x2e')]);_0x5c4bb7[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x16f7ae[_0x0753('0x4c')]['offset']);}_0x5c4bb7[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x16f7ae[_0x0753('0x4c')][_0x0753('0x53')]);_0x5c4bb7['where']=qs[_0x0753('0x4d')](_['pick'](_0x16f7ae[_0x0753('0x4c')],_0x517d58[_0x0753('0x4d')]));_0x5c4bb7[_0x0753('0x54')][_0x0753('0xc5')]=_0x1c5e81['id'];if(_0x16f7ae[_0x0753('0x4c')][_0x0753('0x38')]){_0x5c4bb7['where']=_[_0x0753('0x56')](_0x5c4bb7[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x5c4bb7['attributes'],function(_0x1773c4){var _0x1415ad={};_0x1415ad[_0x1773c4]={'$like':'%'+_0x16f7ae[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x1415ad;})});}_0x5c4bb7=_['merge']({},_0x5c4bb7,_0x16f7ae[_0x0753('0x5a')]);return db['MailInteraction'][_0x0753('0x2c')]({'where':_0x5c4bb7[_0x0753('0x54')]})[_0x0753('0x20')](function(_0x320a93){_0x33db34[_0x0753('0x2c')]=_0x320a93;if(_0x16f7ae['query']['includeAll']){_0x5c4bb7[_0x0753('0x5d')]=[{'all':!![]}];}return db[_0x0753('0xcb')][_0x0753('0x5e')](_0x5c4bb7);})[_0x0753('0x20')](function(_0x12db45){_0x33db34['rows']=_0x12db45;return _0x33db34;});}})[_0x0753('0x20')](respondWithFilteredResult(_0xdbaeea,_0x5c4bb7))[_0x0753('0x29')](handleError(_0xdbaeea,null));};exports[_0x0753('0xcc')]=function(_0x4e8093,_0x3d56bd,_0x1c20af){var _0x2480a7={};var _0x496214={};var _0x4f7cc4;var _0x498bf2;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x4e8093[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x3d56bd,null))[_0x0753('0x20')](function(_0x180c44){if(_0x180c44){_0x4f7cc4=_0x180c44;_0x496214[_0x0753('0x47')]=_[_0x0753('0x4b')](db[_0x0753('0xcd')][_0x0753('0x44')]);_0x496214[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x4e8093[_0x0753('0x4c')]);_0x496214[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x496214[_0x0753('0x47')],_0x496214['query']);_0x2480a7[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x496214[_0x0753('0x47')],qs['fields'](_0x4e8093['query'][_0x0753('0xb5')]));_0x2480a7[_0x0753('0x4f')]=_0x2480a7[_0x0753('0x4f')][_0x0753('0x50')]?_0x2480a7['attributes']:_0x496214[_0x0753('0x47')];_0x2480a7[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x4e8093['query']['sort']);_0x2480a7[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x4e8093['query'],_0x496214[_0x0753('0x4d')]));if(_0x4e8093['query'][_0x0753('0x38')]){_0x2480a7[_0x0753('0x54')]=_['merge'](_0x2480a7[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x2480a7[_0x0753('0x4f')],function(_0x5b7d07){var _0x3b80a6={};_0x3b80a6[_0x5b7d07]={'$like':'%'+_0x4e8093[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x3b80a6;})});}_0x2480a7=_[_0x0753('0x56')]({},_0x2480a7,_0x4e8093[_0x0753('0x5a')]);return _0x4f7cc4['getSmsInteractions'](_0x2480a7);}})['then'](function(_0x1dd7cb){if(_0x1dd7cb){_0x498bf2=_0x1dd7cb[_0x0753('0x50')];if(!_0x4e8093[_0x0753('0x4c')]['hasOwnProperty'](_0x0753('0x52'))){_0x2480a7[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x4e8093[_0x0753('0x4c')][_0x0753('0x2e')]);_0x2480a7[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x4e8093[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x4f7cc4[_0x0753('0xcc')](_0x2480a7);}})['then'](function(_0x37b97b){if(_0x37b97b){return _0x37b97b?{'count':_0x498bf2,'rows':_0x37b97b}:null;}})[_0x0753('0x20')](respondWithResult(_0x3d56bd,null))[_0x0753('0x29')](handleError(_0x3d56bd,null));};exports['getFaxInteractions']=function(_0x4f4027,_0x513bf9,_0x3b3eff){var _0x2a48f2={};var _0xe1776b={};var _0x2b2585;var _0x56bbfe;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x4f4027['params']['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x513bf9,null))[_0x0753('0x20')](function(_0x47df79){if(_0x47df79){_0x2b2585=_0x47df79;_0xe1776b[_0x0753('0x47')]=_[_0x0753('0x4b')](db['FaxInteraction']['rawAttributes']);_0xe1776b[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x4f4027[_0x0753('0x4c')]);_0xe1776b['filters']=_[_0x0753('0x4e')](_0xe1776b[_0x0753('0x47')],_0xe1776b[_0x0753('0x4c')]);_0x2a48f2[_0x0753('0x4f')]=_['intersection'](_0xe1776b[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x4f4027[_0x0753('0x4c')][_0x0753('0xb5')]));_0x2a48f2[_0x0753('0x4f')]=_0x2a48f2[_0x0753('0x4f')][_0x0753('0x50')]?_0x2a48f2['attributes']:_0xe1776b[_0x0753('0x47')];_0x2a48f2[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x4f4027[_0x0753('0x4c')][_0x0753('0x53')]);_0x2a48f2[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x4f4027[_0x0753('0x4c')],_0xe1776b[_0x0753('0x4d')]));if(_0x4f4027[_0x0753('0x4c')][_0x0753('0x38')]){_0x2a48f2['where']=_[_0x0753('0x56')](_0x2a48f2['where'],{'$or':_[_0x0753('0x48')](_0x2a48f2[_0x0753('0x4f')],function(_0x2b4af2){var _0x20ac81={};_0x20ac81[_0x2b4af2]={'$like':'%'+_0x4f4027[_0x0753('0x4c')]['filter']+'%'};return _0x20ac81;})});}_0x2a48f2=_[_0x0753('0x56')]({},_0x2a48f2,_0x4f4027[_0x0753('0x5a')]);return _0x2b2585[_0x0753('0xce')](_0x2a48f2);}})[_0x0753('0x20')](function(_0x345954){if(_0x345954){_0x56bbfe=_0x345954[_0x0753('0x50')];if(!_0x4f4027[_0x0753('0x4c')]['hasOwnProperty'](_0x0753('0x52'))){_0x2a48f2[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x4f4027[_0x0753('0x4c')][_0x0753('0x2e')]);_0x2a48f2['offset']=qs[_0x0753('0x2d')](_0x4f4027[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x2b2585[_0x0753('0xce')](_0x2a48f2);}})[_0x0753('0x20')](function(_0x4d0569){if(_0x4d0569){return _0x4d0569?{'count':_0x56bbfe,'rows':_0x4d0569}:null;}})[_0x0753('0x20')](respondWithResult(_0x513bf9,null))[_0x0753('0x29')](handleError(_0x513bf9,null));};exports['getWhatsappInteractions']=function(_0x244732,_0x3bbb5f,_0x31ad78){var _0x432a30={};var _0x451de5={};var _0x176c07;var _0x3d6561;return db['User']['findOne']({'where':{'id':_0x244732[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x3bbb5f,null))[_0x0753('0x20')](function(_0x24794c){if(_0x24794c){_0x176c07=_0x24794c;_0x451de5[_0x0753('0x47')]=_['keys'](db[_0x0753('0xcf')][_0x0753('0x44')]);_0x451de5[_0x0753('0x4c')]=_['keys'](_0x244732['query']);_0x451de5[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x451de5[_0x0753('0x47')],_0x451de5[_0x0753('0x4c')]);_0x432a30[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x451de5['model'],qs[_0x0753('0xb5')](_0x244732[_0x0753('0x4c')]['fields']));_0x432a30[_0x0753('0x4f')]=_0x432a30[_0x0753('0x4f')][_0x0753('0x50')]?_0x432a30['attributes']:_0x451de5[_0x0753('0x47')];_0x432a30[_0x0753('0xb6')]=qs['sort'](_0x244732['query'][_0x0753('0x53')]);_0x432a30['where']=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x244732[_0x0753('0x4c')],_0x451de5[_0x0753('0x4d')]));if(_0x244732[_0x0753('0x4c')][_0x0753('0x38')]){_0x432a30[_0x0753('0x54')]=_[_0x0753('0x56')](_0x432a30[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x432a30[_0x0753('0x4f')],function(_0x1e4371){var _0x505d4c={};_0x505d4c[_0x1e4371]={'$like':'%'+_0x244732['query']['filter']+'%'};return _0x505d4c;})});}_0x432a30=_['merge']({},_0x432a30,_0x244732['options']);return _0x176c07[_0x0753('0xd0')](_0x432a30);}})[_0x0753('0x20')](function(_0x410f49){if(_0x410f49){_0x3d6561=_0x410f49[_0x0753('0x50')];if(!_0x244732[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x432a30[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x244732[_0x0753('0x4c')][_0x0753('0x2e')]);_0x432a30[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x244732[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x176c07[_0x0753('0xd0')](_0x432a30);}})['then'](function(_0x49725b){if(_0x49725b){return _0x49725b?{'count':_0x3d6561,'rows':_0x49725b}:null;}})['then'](respondWithResult(_0x3bbb5f,null))['catch'](handleError(_0x3bbb5f,null));};exports['login']=function(_0x43107b,_0x2294f2,_0x4bb095){var _0x27b133;var _0x289fe3;var _0x2296ad;var _0x570661=!_[_0x0753('0x6f')](_0x43107b[_0x0753('0x60')]['id'])?_0x43107b['params']['id']:!_[_0x0753('0x6f')](_0x43107b[_0x0753('0x34')]['id'])?_0x43107b['user']['id']:null;return db['User'][_0x0753('0x3c')]({'where':{'id':_0x570661,'role':{'$or':['admin',_0x0753('0x34'),_0x0753('0x35')]}},'attributes':['id',_0x0753('0x3e'),'phone',_0x0753('0xd1'),_0x0753('0x3d'),'internal',_0x0753('0xd2')]})[_0x0753('0x20')](function(_0x8d357b){if(_0x8d357b){if(_0x8d357b['role']===_0x0753('0x35')){_0x27b133=_0x8d357b;if(_0x43107b[_0x0753('0x63')][_0x0753('0x9e')]){_0x2296ad=util['format'](_0x0753('0xd3'),_0x27b133[_0x43107b['body'][_0x0753('0x9e')]]);}else if(_0x43107b[_0x0753('0x63')]['intrf']){_0x2296ad=util['format'](_0x0753('0xa0'),_0x43107b[_0x0753('0x63')][_0x0753('0xd4')]);}else{_0x2296ad=util[_0x0753('0x9f')]('SIP/%s',_0x27b133['name']);}socket['to'](util[_0x0753('0x9f')](_0x0753('0xd5'),_0x27b133[_0x0753('0x3e')]))[_0x0753('0xa8')]('user:forcelogout',{'ip':_0x43107b[_0x0753('0xd6')][_0x0753('0xd7')]||_0x43107b[_0x0753('0xd8')][_0x0753('0xd9')]||_0x43107b['socket'][_0x0753('0xd9')]||_0x43107b[_0x0753('0xd8')][_0x0753('0xda')]['remoteAddress']});return db[_0x0753('0xc1')][_0x0753('0x3f')]({'where':{'membername':_0x27b133['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x0753('0x1d'))](_0x0753('0xdb'));}})[_0x0753('0x20')](function(){if(_0x27b133){return _0x27b133[_0x0753('0xdc')]({'raw':!![]});}})[_0x0753('0x20')](function(_0x89d4a3){if(_0x27b133){var _0x369e29=[];if(_0x89d4a3){_0x289fe3=_0x89d4a3;if(_0x289fe3['length']){for(var _0x181e5c=0x0;_0x181e5c<_0x289fe3[_0x0753('0x50')];_0x181e5c++){_0x369e29[_0x0753('0x9d')]({'membername':_0x27b133['name'],'UserId':_0x27b133['id'],'queue_name':_0x289fe3[_0x181e5c]['name'],'VoiceQueueId':_0x289fe3[_0x181e5c]['id'],'interface':_0x2296ad,'paused':_0x27b133[_0x0753('0xd2')]||![],'penalty':_0x289fe3[_0x181e5c][_0x0753('0xdd')]||0x0});}return BPromise[_0x0753('0xa3')](_0x369e29,function(_0x5a85b5){return db['UserVoiceQueueRt'][_0x0753('0xa4')](_0x5a85b5);});}}}})[_0x0753('0x20')](function(){if(_0x27b133){return db[_0x0753('0xde')][_0x0753('0x5e')]({'where':{'membername':_0x27b133[_0x0753('0x3e')],'exitAt':null}});}})[_0x0753('0x20')](function(_0x108c9e){if(_0x27b133){var _0x232bba=[];_0x108c9e[_0x0753('0xdf')](function(_0x50b1bf){_0x232bba[_0x0753('0x9d')](_0x50b1bf[_0x0753('0x31')]({'exitAt':moment()[_0x0753('0x9f')](_0x0753('0xe0'))}));});return BPromise[_0x0753('0xe1')](_0x232bba);}})[_0x0753('0x20')](function(){if(_0x27b133){var _0x5e3115=[];var _0x5151cc=[];var _0x2cd092=utils[_0x0753('0xe2')]();var _0x4bed59={'membername':_0x27b133['name'],'interface':_0x2296ad,'enterAt':moment()[_0x0753('0x9f')](_0x0753('0xe0')),'role':_0x27b133[_0x0753('0x3d')],'internal':_0x27b133[_0x0753('0x70')]};_0x2cd092['forEach'](function(_0x4094c9){_0x5e3115[_0x0753('0x9d')](_[_0x0753('0x56')]({'channel':_0x4094c9,'type':'LOGIN','data1':_0x43107b[_0x0753('0x63')][_0x0753('0xe3')],'data2':_0x2296ad},_0x4bed59));if(_0x27b133[_0x0753('0xd2')]){_0x5151cc[_0x0753('0x9d')](_['merge']({'channel':_0x4094c9,'type':_0x0753('0xe4'),'data1':'LOGININPAUSE'},_0x4bed59));}});return db[_0x0753('0xde')][_0x0753('0x62')](_0x5e3115[_0x0753('0xe5')](_0x5151cc),{'individualHooks':!![]});}})[_0x0753('0x20')](function(){if(_0x27b133){return _0x27b133[_0x0753('0x31')]({'online':!![],'lastLoginAt':moment()[_0x0753('0x9f')](_0x0753('0xe0')),'voicePause':_0x27b133[_0x0753('0xd2')]||![],'mailPause':_0x27b133[_0x0753('0xd2')]||![],'chatPause':_0x27b133[_0x0753('0xd2')]||![],'faxPause':_0x27b133['loginInPause']||![],'smsPause':_0x27b133[_0x0753('0xd2')]||![],'openchannelPause':_0x27b133['loginInPause']||![],'whatsappPause':_0x27b133[_0x0753('0xd2')]||![],'pauseType':_0x27b133[_0x0753('0xd2')]?'LOGININPAUSE':null,'interface':_0x2296ad,'lastPauseAt':moment()[_0x0753('0x9f')](_0x0753('0xe0'))});}})[_0x0753('0x20')](function(_0x4ba045){if(_0x43107b['isMiddleware']){return _0x4bb095();}else{return BPromise[_0x0753('0xe6')](_0x4ba045)[_0x0753('0x20')](respondWithResult(_0x2294f2,null));}})[_0x0753('0x29')](handleError(_0x2294f2,null));};exports[_0x0753('0xe7')]=function(_0x5c55a8,_0x4c89c7,_0x22db39){var _0x2ae6e0;return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x5c55a8[_0x0753('0x60')]['id'],'role':'agent'},'attributes':['id','name',_0x0753('0x3d')]})[_0x0753('0x20')](handleEntityNotFound(_0x4c89c7,null))[_0x0753('0x20')](function(_0x34ea0d){if(_0x34ea0d){_0x2ae6e0=_0x34ea0d;return db[_0x0753('0xc1')][_0x0753('0x3f')]({'where':{'membername':_0x2ae6e0[_0x0753('0x3e')]},'individualHooks':!![]});}})[_0x0753('0x20')](function(){return db[_0x0753('0xde')][_0x0753('0x5e')]({'where':{'membername':_0x2ae6e0[_0x0753('0x3e')],'exitAt':null}});})[_0x0753('0x20')](function(_0x4682e8){var _0xadafb2=[];_0x4682e8[_0x0753('0xdf')](function(_0x2c85d4){_0xadafb2[_0x0753('0x9d')](_0x2c85d4[_0x0753('0x31')]({'exitAt':moment()[_0x0753('0x9f')](_0x0753('0xe0'))}));});return BPromise['all'](_0xadafb2);})[_0x0753('0x20')](function(){return _0x2ae6e0['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0753('0x20')](respondWithResult(_0x4c89c7,null))[_0x0753('0x29')](handleError(_0x4c89c7,null));};exports[_0x0753('0xe8')]=function(_0x544365,_0x4db9fe,_0x59576e){var _0x43b45e;return db['UserVoiceQueueRt'][_0x0753('0x31')]({'paused':0x1},{'where':{'UserId':_0x544365[_0x0753('0x60')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x544365[_0x0753('0x60')]['id'],'role':_0x0753('0x35')},'attributes':['id',_0x0753('0x3e'),_0x0753('0x3d'),'internal',_0x0753('0x9e')]});})['then'](handleEntityNotFound(_0x4db9fe,null))['then'](function(_0x26991f){if(_0x26991f){_0x43b45e=_0x26991f;return respondWithRpcPromise(_0x0753('0xe9'),_0x0753('0xe8'),{'id':_0x43b45e['id'],'name':_0x43b45e[_0x0753('0x3e')],'pause':!![]});}})[_0x0753('0x20')](function(){if(_0x43b45e){return db['MemberReport'][_0x0753('0x5e')]({'where':{'membername':_0x43b45e[_0x0753('0x3e')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x494112){if(_0x494112[_0x0753('0x50')]){var _0x507410=moment()[_0x0753('0x9f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x561714=0x0,_0x27286b=_0x494112[_0x0753('0x50')];_0x561714<_0x27286b;_0x561714++){_0x494112[_0x561714][_0x0753('0xea')]({'exitAt':_0x507410});}}})[_0x0753('0x20')](function(){var _0x34d50b=[];var _0x35dd84=utils[_0x0753('0xe2')]();_0x35dd84[_0x0753('0xdf')](function(_0x31a118){_0x34d50b['push']({'channel':_0x31a118,'membername':_0x43b45e[_0x0753('0x3e')],'interface':_[_0x0753('0x6f')](_0x43b45e[_0x0753('0x9e')])?util['format'](_0x0753('0xa0'),_0x43b45e[_0x0753('0x3e')]):_0x43b45e['interface'],'type':_0x0753('0xe4'),'enterAt':moment()[_0x0753('0x9f')](_0x0753('0xe0')),'data1':_0x544365[_0x0753('0x63')][_0x0753('0x45')]||_0x0753('0xeb'),'role':_0x43b45e['role'],'internal':_0x43b45e[_0x0753('0x70')]});});return db[_0x0753('0xde')]['bulkCreate'](_0x34d50b,{'individualHooks':!![]});})[_0x0753('0x20')](function(){return _0x43b45e[_0x0753('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x544365[_0x0753('0x63')][_0x0753('0x45')]||_0x0753('0xeb'),'lastPauseAt':moment()[_0x0753('0x9f')](_0x0753('0xe0'))});})[_0x0753('0x20')](respondWithResult(_0x4db9fe,null))[_0x0753('0x29')](handleError(_0x4db9fe,null));};exports['unpause']=function(_0x306c94,_0x226ea2,_0x16ccf1){var _0x54fe44;return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x306c94[_0x0753('0x60')]['id']},'attributes':['id',_0x0753('0x3e'),_0x0753('0x3d'),_0x0753('0xa1'),_0x0753('0xec'),_0x0753('0xed'),_0x0753('0xee'),_0x0753('0xef'),'smsPause',_0x0753('0xf0'),_0x0753('0xf1'),_0x0753('0xf2')]})[_0x0753('0x20')](handleEntityNotFound(_0x226ea2,null))[_0x0753('0x20')](function(_0x34fe2b){if(_0x34fe2b){_0x54fe44=_0x34fe2b;if(_0x306c94[_0x0753('0x63')][_0x0753('0xa5')]&&!utils[_0x0753('0xa6')](_0x306c94[_0x0753('0x63')]['channel'])){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x95'));}switch(_0x306c94[_0x0753('0x63')][_0x0753('0xa5')]){case _0x0753('0x9b'):return respondWithRpcPromise(_0x0753('0xe9'),_0x0753('0xf3'),{'id':_0x54fe44['id'],'name':_0x54fe44[_0x0753('0x3e')],'pause':![]})[_0x0753('0x20')](function(){return db[_0x0753('0xc1')]['update']({'paused':0x0},{'where':{'UserId':_0x54fe44['id']},'individualHooks':!![]});})[_0x0753('0x20')](function(){return db['MemberReport'][_0x0753('0x3c')]({'where':{'channel':_0x306c94[_0x0753('0x63')][_0x0753('0xa5')],'membername':_0x54fe44['name'],'type':'PAUSE','exitAt':null}});})[_0x0753('0x20')](function(_0x4980d4){if(_0x4980d4){return _0x4980d4[_0x0753('0x31')]({'exitAt':moment()['format'](_0x0753('0xe0')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x54fe44[_0x0753('0x31')]({'voicePause':![]});});case _0x0753('0xf4'):case _0x0753('0xf5'):case _0x0753('0xf6'):case _0x0753('0xf7'):case _0x0753('0xf8'):case _0x0753('0xf9'):return db[_0x0753('0xde')][_0x0753('0x3c')]({'where':{'channel':_0x306c94[_0x0753('0x63')][_0x0753('0xa5')],'membername':_0x54fe44[_0x0753('0x3e')],'type':_0x0753('0xe4'),'exitAt':null}})[_0x0753('0x20')](function(_0x797a16){if(_0x797a16){return _0x797a16[_0x0753('0x31')]({'exitAt':moment()[_0x0753('0x9f')](_0x0753('0xe0')),'data2':_0x0753('0xfa')},{'individualHooks':!![]});}return null;})[_0x0753('0x20')](function(){var _0x591b30={};_[_0x0753('0xfb')](_0x591b30,util[_0x0753('0x9f')]('%s%s',_0x306c94[_0x0753('0x63')][_0x0753('0xa5')],_0x0753('0xfc')),![]);return _0x54fe44['update'](_0x591b30);});default:return respondWithRpcPromise(_0x0753('0xe9'),_0x0753('0xf3'),{'id':_0x54fe44['id'],'name':_0x54fe44[_0x0753('0x3e')],'pause':![]})[_0x0753('0x20')](function(){return db[_0x0753('0xc1')][_0x0753('0x31')]({'paused':0x0},{'where':{'UserId':_0x54fe44['id']}});})[_0x0753('0x20')](function(){return db[_0x0753('0xde')]['findAll']({'where':{'membername':_0x54fe44[_0x0753('0x3e')],'type':_0x0753('0xe4'),'exitAt':null}});})[_0x0753('0x20')](function(_0x4e9fb6){var _0x20d1c5=[];_0x4e9fb6[_0x0753('0xdf')](function(_0x1179b1){_0x20d1c5[_0x0753('0x9d')](_0x1179b1['update']({'exitAt':moment()['format'](_0x0753('0xe0')),'data2':'manual'}));});return BPromise[_0x0753('0xe1')](_0x20d1c5);})[_0x0753('0x20')](function(){return _0x54fe44[_0x0753('0x31')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0753('0x20')](respondWithResult(_0x226ea2,null))[_0x0753('0x29')](handleError(_0x226ea2,null));};exports[_0x0753('0xfd')]=function(_0x280133,_0xe13ec4,_0x53e66f){var _0x3ec0f={};var _0x5f5db6={};var _0x4e5272;var _0x699eb;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x280133['params']['id']}})[_0x0753('0x20')](handleEntityNotFound(_0xe13ec4,null))[_0x0753('0x20')](function(_0x3b1050){if(_0x3b1050){_0x4e5272=_0x3b1050;_0x5f5db6[_0x0753('0x47')]=_['keys'](db['Team'][_0x0753('0x44')]);_0x5f5db6['query']=_[_0x0753('0x4b')](_0x280133[_0x0753('0x4c')]);_0x5f5db6['filters']=_[_0x0753('0x4e')](_0x5f5db6[_0x0753('0x47')],_0x5f5db6[_0x0753('0x4c')]);_0x3ec0f[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x5f5db6[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x280133['query']['fields']));_0x3ec0f[_0x0753('0x4f')]=_0x3ec0f[_0x0753('0x4f')][_0x0753('0x50')]?_0x3ec0f['attributes']:_0x5f5db6[_0x0753('0x47')];_0x3ec0f[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x280133[_0x0753('0x4c')][_0x0753('0x53')]);_0x3ec0f[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x280133['query'],_0x5f5db6[_0x0753('0x4d')]));if(_0x280133[_0x0753('0x4c')][_0x0753('0x38')]){_0x3ec0f['where']=_[_0x0753('0x56')](_0x3ec0f[_0x0753('0x54')],{'$or':_['map'](_0x3ec0f[_0x0753('0x4f')],function(_0x2bbf7a){var _0x3349b0={};_0x3349b0[_0x2bbf7a]={'$like':'%'+_0x280133[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x3349b0;})});}_0x3ec0f=_[_0x0753('0x56')]({},_0x3ec0f,_0x280133[_0x0753('0x5a')]);return _0x4e5272[_0x0753('0xfd')](_0x3ec0f);}})[_0x0753('0x20')](function(_0x5711f3){if(_0x5711f3){_0x699eb=_0x5711f3[_0x0753('0x50')];if(!_0x280133[_0x0753('0x4c')][_0x0753('0x51')]('nolimit')){_0x3ec0f[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x280133[_0x0753('0x4c')][_0x0753('0x2e')]);_0x3ec0f[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x280133[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x4e5272[_0x0753('0xfd')](_0x3ec0f);}})[_0x0753('0x20')](function(_0x411a4e){if(_0x411a4e){return _0x411a4e?{'count':_0x699eb,'rows':_0x411a4e}:null;}})[_0x0753('0x20')](respondWithResult(_0xe13ec4,null))[_0x0753('0x29')](handleError(_0xe13ec4,null));};exports[_0x0753('0xfe')]=function(_0x239bdf,_0x5548aa){return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x239bdf[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x5548aa,null))[_0x0753('0x20')](function(_0x5c90c0){if(_0x5c90c0){var _0x5027fb=_0x5c90c0[_0x0753('0x32')]({'plain':!![]});return _0x5c90c0[_0x0753('0xfe')](_0x239bdf[_0x0753('0x63')][_0x0753('0x66')],_['omit'](_0x239bdf[_0x0753('0x63')],['ids','id'])||{})[_0x0753('0x20')](function(){for(var _0x149e0b=0x0;_0x149e0b<_0x239bdf[_0x0753('0x63')][_0x0753('0x66')][_0x0753('0x50')];_0x149e0b++){var _0x1c7d24=[];db['Team'][_0x0753('0x8b')]({'where':{'id':_0x239bdf[_0x0753('0x63')][_0x0753('0x66')][_0x149e0b]}})[_0x0753('0x20')](function(_0x35d425){_0x1c7d24['push'](_0x35d425['getVoiceQueues']()[_0x0753('0x20')](function(_0x330d03){for(var _0x4d5c11=0x0;_0x4d5c11<_0x330d03[_0x0753('0x50')];_0x4d5c11++){_0x330d03[_0x4d5c11][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x100'));}return _0x330d03;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x101')]()[_0x0753('0x20')](function(_0x3b1c1d){for(var _0xec1c50=0x0;_0xec1c50<_0x3b1c1d['length'];_0xec1c50++){_0x3b1c1d[_0xec1c50]['setDataValue']('channel','Chat');}return _0x3b1c1d;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x102')]()[_0x0753('0x20')](function(_0x4f7576){for(var _0x2051da=0x0;_0x2051da<_0x4f7576[_0x0753('0x50')];_0x2051da++){_0x4f7576[_0x2051da][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x103'));}return _0x4f7576;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x104')]()[_0x0753('0x20')](function(_0xaa2f77){for(var _0x5cbda4=0x0;_0x5cbda4<_0xaa2f77[_0x0753('0x50')];_0x5cbda4++){_0xaa2f77[_0x5cbda4]['setDataValue']('channel','Sms');}return _0xaa2f77;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x105')]()[_0x0753('0x20')](function(_0x1bb2a9){for(var _0x2cfc7a=0x0;_0x2cfc7a<_0x1bb2a9[_0x0753('0x50')];_0x2cfc7a++){_0x1bb2a9[_0x2cfc7a][_0x0753('0xff')](_0x0753('0xa5'),'Whatsapp');}return _0x1bb2a9;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425['getFaxQueues']()[_0x0753('0x20')](function(_0x2fbae0){for(var _0x1a190f=0x0;_0x1a190f<_0x2fbae0[_0x0753('0x50')];_0x1a190f++){_0x2fbae0[_0x1a190f][_0x0753('0xff')]('channel',_0x0753('0x106'));}return _0x2fbae0;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x107')]()[_0x0753('0x20')](function(_0x36e1dd){for(var _0x504a9d=0x0;_0x504a9d<_0x36e1dd[_0x0753('0x50')];_0x504a9d++){_0x36e1dd[_0x504a9d][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x108'));}return _0x36e1dd;}));return BPromise[_0x0753('0xe1')](_0x1c7d24);})['then'](function(_0x5739e8){var _0x3a6ef5=_[_0x0753('0x109')](_0x5739e8);_0x1c7d24=[];return db[_0x0753('0x58')]['transaction'](function(_0x16bcdc){for(var _0x2c9158=0x0;_0x2c9158<_0x3a6ef5[_0x0753('0x50')];_0x2c9158++){_0x1c7d24[_0x0753('0x9d')](_0x3a6ef5[_0x2c9158][_0x0753('0x10a')](_0x5027fb['id']),{'transaction':_0x16bcdc});}return BPromise['all'](_0x1c7d24)[_0x0753('0x20')](function(){if(_0x5027fb[_0x0753('0x94')]){return BPromise['each'](_[_0x0753('0x38')](_0x3a6ef5,function(_0x42d017){return _0x42d017[_0x0753('0x10b')](_0x0753('0xa5'))===_0x0753('0x100');}),function(_0x575d22){return db[_0x0753('0xc1')][_0x0753('0xa4')]({'membername':_0x5027fb[_0x0753('0x3e')],'UserId':_0x5027fb['id'],'queue_name':_0x575d22['name'],'VoiceQueueId':_0x575d22['id'],'interface':_[_0x0753('0x6f')](_0x5027fb[_0x0753('0x9e')])?util[_0x0753('0x9f')](_0x0753('0xa0'),_0x5027fb['name']):_0x5027fb[_0x0753('0x9e')],'paused':_0x5027fb[_0x0753('0xa1')]||![],'penalty':_0x5027fb[_0x0753('0xa2')]},{'transaction':_0x16bcdc});});}else{return;}})[_0x0753('0x20')](function(){for(var _0x12f34e=0x0;_0x12f34e<_0x3a6ef5[_0x0753('0x50')];_0x12f34e++){var _0x44fc89=_0x3a6ef5[_0x12f34e]['getDataValue'](_0x0753('0xa5'));var _0x2db3b2=_0x44fc89+_0x0753('0x9a');socket[_0x0753('0xa8')]('user'+_0x44fc89+_0x0753('0x10c'),{'UserId':_0x5027fb['id'],['queueField']:_0x3a6ef5[_0x12f34e]['id']});}});});});}});}})[_0x0753('0x20')](respondWithStatusCode(_0x5548aa,null))['catch'](handleError(_0x5548aa,null));};exports['removeTeams']=function(_0x28b7b1,_0x31efec){return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x28b7b1[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x31efec,null))[_0x0753('0x20')](function(_0x5a17ab){if(_0x5a17ab){var _0x1b6716=_0x5a17ab['get']({'plain':!![]});var _0x1f0369=_0x28b7b1[_0x0753('0x4c')][_0x0753('0x66')];return _0x5a17ab['removeTeams'](_0x1f0369)['then'](function(){for(var _0x2ba3f9=0x0;_0x2ba3f9<_0x1f0369[_0x0753('0x50')];_0x2ba3f9++){var _0x4b6ee2=[];db[_0x0753('0x10d')]['findOne']({'where':{'id':_0x1f0369[_0x2ba3f9]}})[_0x0753('0x20')](function(_0xae0d79){_0x4b6ee2['push'](_0xae0d79[_0x0753('0xdc')]()[_0x0753('0x20')](function(_0x1f2a01){for(var _0x22cdae=0x0;_0x22cdae<_0x1f2a01[_0x0753('0x50')];_0x22cdae++){_0x1f2a01[_0x22cdae][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x100'));}return _0x1f2a01;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x101')]()[_0x0753('0x20')](function(_0x27371b){for(var _0x37a8ec=0x0;_0x37a8ec<_0x27371b[_0x0753('0x50')];_0x37a8ec++){_0x27371b[_0x37a8ec][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x10e'));}return _0x27371b;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x102')]()[_0x0753('0x20')](function(_0x410b03){for(var _0x27f661=0x0;_0x27f661<_0x410b03[_0x0753('0x50')];_0x27f661++){_0x410b03[_0x27f661][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x103'));}return _0x410b03;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x104')]()['then'](function(_0x10e2a9){for(var _0x5e32e6=0x0;_0x5e32e6<_0x10e2a9[_0x0753('0x50')];_0x5e32e6++){_0x10e2a9[_0x5e32e6]['setDataValue'](_0x0753('0xa5'),'Sms');}return _0x10e2a9;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x105')]()[_0x0753('0x20')](function(_0x52a782){for(var _0x549a00=0x0;_0x549a00<_0x52a782[_0x0753('0x50')];_0x549a00++){_0x52a782[_0x549a00][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x10f'));}return _0x52a782;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x110')]()[_0x0753('0x20')](function(_0x12cb67){for(var _0x6663ec=0x0;_0x6663ec<_0x12cb67[_0x0753('0x50')];_0x6663ec++){_0x12cb67[_0x6663ec][_0x0753('0xff')](_0x0753('0xa5'),'Fax');}return _0x12cb67;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x107')]()[_0x0753('0x20')](function(_0x3d4382){for(var _0x432e3c=0x0;_0x432e3c<_0x3d4382[_0x0753('0x50')];_0x432e3c++){_0x3d4382[_0x432e3c]['setDataValue'](_0x0753('0xa5'),'Openchannel');}return _0x3d4382;}));return BPromise[_0x0753('0xe1')](_0x4b6ee2);})['then'](function(_0x10ae9e){var _0x16faf3=_[_0x0753('0x109')](_0x10ae9e);_0x4b6ee2=[];return db[_0x0753('0x58')][_0x0753('0x111')](function(_0x3eaeb4){for(var _0x5128dc=0x0;_0x5128dc<_0x16faf3[_0x0753('0x50')];_0x5128dc++){_0x4b6ee2['push'](_0x16faf3[_0x5128dc][_0x0753('0x112')](_0x1b6716['id']),{'transaction':_0x3eaeb4});}return BPromise[_0x0753('0xe1')](_0x4b6ee2)[_0x0753('0x20')](function(){if(_0x1b6716[_0x0753('0x94')]){return BPromise[_0x0753('0xa3')](_[_0x0753('0x38')](_0x16faf3,function(_0x4e16f6){return _0x4e16f6[_0x0753('0x10b')](_0x0753('0xa5'))===_0x0753('0x100');}),function(_0x5489cd){return db[_0x0753('0xc1')]['destroy']({'where':{'VoiceQueueId':_0x5489cd['id'],'UserId':_0x1b6716['id']},'transaction':_0x3eaeb4});});}else{return;}})[_0x0753('0x20')](function(){for(var _0x2d5169=0x0;_0x2d5169<_0x16faf3[_0x0753('0x50')];_0x2d5169++){var _0x302569=_0x16faf3[_0x2d5169][_0x0753('0x10b')]('channel');var _0x23bf4d=_0x302569+_0x0753('0x9a');socket[_0x0753('0xa8')]('user'+_0x302569+'Queue:remove',{'UserId':_0x1b6716['id'],['queueField']:_0x16faf3[_0x2d5169]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x31efec,null))['catch'](handleError(_0x31efec,null));};exports[_0x0753('0x113')]=function(_0x3bdc6b,_0x2e28ec,_0x56d73c){var _0x2fb8d0={};var _0xbfbcfd={};var _0x3dfdfc;var _0x3b8726;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x3bdc6b[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2e28ec,null))[_0x0753('0x20')](function(_0x5e5999){if(_0x5e5999){_0x3dfdfc=_0x5e5999;_0xbfbcfd[_0x0753('0x47')]=_['keys'](db[_0x0753('0xb7')][_0x0753('0x44')]);_0xbfbcfd['query']=_[_0x0753('0x4b')](_0x3bdc6b[_0x0753('0x4c')]);_0xbfbcfd['filters']=_[_0x0753('0x4e')](_0xbfbcfd[_0x0753('0x47')],_0xbfbcfd['query']);_0x2fb8d0[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0xbfbcfd['model'],qs[_0x0753('0xb5')](_0x3bdc6b['query'][_0x0753('0xb5')]));_0x2fb8d0[_0x0753('0x4f')]=_0x2fb8d0[_0x0753('0x4f')]['length']?_0x2fb8d0[_0x0753('0x4f')]:_0xbfbcfd['model'];_0x2fb8d0[_0x0753('0xb6')]=qs['sort'](_0x3bdc6b['query']['sort']);_0x2fb8d0['where']=qs['filters'](_[_0x0753('0x55')](_0x3bdc6b[_0x0753('0x4c')],_0xbfbcfd[_0x0753('0x4d')]));if(_0x3bdc6b[_0x0753('0x4c')][_0x0753('0x38')]){_0x2fb8d0[_0x0753('0x54')]=_[_0x0753('0x56')](_0x2fb8d0[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x2fb8d0['attributes'],function(_0x286658){var _0x4ef7a2={};_0x4ef7a2[_0x286658]={'$like':'%'+_0x3bdc6b[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x4ef7a2;})});}_0x2fb8d0=_[_0x0753('0x56')]({},_0x2fb8d0,_0x3bdc6b[_0x0753('0x5a')]);return _0x3dfdfc['getLists'](_0x2fb8d0);}})[_0x0753('0x20')](function(_0x6daf08){if(_0x6daf08){_0x3b8726=_0x6daf08[_0x0753('0x50')];if(!_0x3bdc6b[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x2fb8d0[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x3bdc6b['query'][_0x0753('0x2e')]);_0x2fb8d0[_0x0753('0x2d')]=qs['offset'](_0x3bdc6b[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x3dfdfc[_0x0753('0x113')](_0x2fb8d0);}})[_0x0753('0x20')](function(_0x4135f8){if(_0x4135f8){return _0x4135f8?{'count':_0x3b8726,'rows':_0x4135f8}:null;}})[_0x0753('0x20')](respondWithResult(_0x2e28ec,null))[_0x0753('0x29')](handleError(_0x2e28ec,null));};exports[_0x0753('0x114')]=function(_0x617177,_0x2caf28,_0x5ecde0){var _0xfb62cf={};var _0x2f5d34={};var _0x31e4fa;var _0x260880;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x617177['params']['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2caf28,null))[_0x0753('0x20')](function(_0x41e22d){if(_0x41e22d){_0x31e4fa=_0x41e22d;_0x2f5d34[_0x0753('0x47')]=_[_0x0753('0x4b')](db[_0x0753('0x5b')][_0x0753('0x44')]);_0x2f5d34['query']=_[_0x0753('0x4b')](_0x617177['query']);_0x2f5d34[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x2f5d34['model'],_0x2f5d34[_0x0753('0x4c')]);_0xfb62cf[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x2f5d34[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x617177['query'][_0x0753('0xb5')]));_0xfb62cf[_0x0753('0x4f')]=_0xfb62cf[_0x0753('0x4f')]['length']?_0xfb62cf['attributes']:_0x2f5d34[_0x0753('0x47')];_0xfb62cf[_0x0753('0xb6')]=qs['sort'](_0x617177[_0x0753('0x4c')]['sort']);_0xfb62cf['where']=qs['filters'](_[_0x0753('0x55')](_0x617177[_0x0753('0x4c')],_0x2f5d34[_0x0753('0x4d')]));if(_0x617177[_0x0753('0x4c')][_0x0753('0x38')]){_0xfb62cf[_0x0753('0x54')]=_['merge'](_0xfb62cf[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0xfb62cf[_0x0753('0x4f')],function(_0x1ddbb8){var _0x2e5783={};_0x2e5783[_0x1ddbb8]={'$like':'%'+_0x617177[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x2e5783;})});}_0xfb62cf[_0x0753('0x47')]=db['User'];_0xfb62cf['as']='Agents';_0xfb62cf=_['merge']({},_0xfb62cf,_0x617177[_0x0753('0x5a')]);return _0x31e4fa[_0x0753('0xdc')]({'include':[_0xfb62cf]});}})[_0x0753('0x20')](function(_0x4fa660){if(_0x4fa660){var _0xcfe8df={},_0x13e0ab=[],_0x206913=0x0;for(var _0x56f242=0x0;_0x56f242<_0x4fa660[_0x0753('0x50')];_0x56f242+=0x1){for(var _0x31a8d0=0x0,_0x1ec78a;_0x31a8d0<_0x4fa660[_0x56f242][_0x0753('0x85')]['length'];_0x31a8d0+=0x1){_0x1ec78a=_0x4fa660[_0x56f242]['Agents'][_0x31a8d0][_0x0753('0x32')]({'plain':!![]});_0xcfe8df[_0x1ec78a['id']]=_0x1ec78a;}}_0xcfe8df=_[_0x0753('0x115')](_0xcfe8df);for(var _0x5331ff=qs[_0x0753('0x2d')](_0x617177['query'][_0x0753('0x2d')]);_0x5331ff<_0xcfe8df[_0x0753('0x50')]&&_0x13e0ab[_0x0753('0x50')]=_0x24ad64){_0x1d7c12=_0x24ad64;_0x66e375=0xc8;}else{_0x66e375=0xce;}_0x2e937f[_0x17d3('0x2e')](_0x66e375);return _0x2e937f['set'](_0x17d3('0x33'),_0xac36df+'-'+_0x1d7c12+'/'+_0x24ad64)[_0x17d3('0x2f')](_0x2f892a);}return null;};}function patchUpdates(_0x5905bc){return function(_0x9ebb6e){try{jsonpatch[_0x17d3('0x34')](_0x9ebb6e,_0x5905bc,!![]);}catch(_0x3c79fd){return BPromise[_0x17d3('0x35')](_0x3c79fd);}return _0x9ebb6e[_0x17d3('0x36')]();};}function saveUpdates(_0x222679,_0x57f523){return function(_0x1dfae7){if(_0x1dfae7){return _0x1dfae7[_0x17d3('0x37')](_0x222679)['then'](function(_0x1e7060){return _0x1e7060;});}return null;};}function removeEntity(_0x23f3cb,_0x202433){return function(_0x49ca39){if(_0x49ca39){return _0x49ca39[_0x17d3('0x38')]()['then'](function(){var _0x38401e=_0x49ca39[_0x17d3('0x39')]({'plain':!![]});var _0x273dfe=[{'name':_0x17d3('0x3a'),'value':_0x17d3('0x3b'),'ignore':!![]},{'name':_0x17d3('0x3c'),'value':_0x17d3('0x3d'),'ignore':![]},{'name':_0x17d3('0x3e'),'value':_0x17d3('0x3f'),'ignore':![]}];var _0x45f8d2=_(_0x273dfe)['filter'](_0x17d3('0x40'))[_0x17d3('0x41')](_0x17d3('0x42'))[_0x17d3('0x42')]();if(_['includes'](_0x45f8d2,_0x38401e[_0x17d3('0x43')])){return;}var _0x1b89bf=_[_0x17d3('0x44')](_0x273dfe,[_0x17d3('0x42'),_0x38401e[_0x17d3('0x43')]])[_0x17d3('0x45')];return db[_0x17d3('0x46')][_0x17d3('0x38')]({'where':{'type':_0x1b89bf,'resourceId':_0x38401e['id']}})[_0x17d3('0x22')](function(){return _0x49ca39;});})[_0x17d3('0x22')](function(){_0x23f3cb[_0x17d3('0x2e')](0xcc)[_0x17d3('0x2d')]();});}};}function handleEntityNotFound(_0xa09e22,_0x4ee417){return function(_0x50eb18){if(!_0x50eb18){_0xa09e22[_0x17d3('0x47')](0x194);}return _0x50eb18;};}function handleError(_0x5e8cde,_0xcec95f){_0xcec95f=_0xcec95f||0x1f4;return function(_0x146fa8){logger['error'](_0x146fa8[_0x17d3('0x48')]);if(_0x146fa8[_0x17d3('0x45')]){delete _0x146fa8['name'];}_0x5e8cde[_0x17d3('0x2e')](_0xcec95f)[_0x17d3('0x49')](_0x146fa8);};}exports[_0x17d3('0x4a')]=function(_0x4c5a76,_0x2f2661){var _0x518e29={},_0x463776={},_0x35b177={'count':0x0,'rows':[]};var _0x4b6e04=_['map'](db['User'][_0x17d3('0x4b')],function(_0x43b6d3){return{'name':_0x43b6d3['fieldName'],'type':_0x43b6d3['type']['key']};});_0x463776['model']=_[_0x17d3('0x4c')](_[_0x17d3('0x41')](_0x4b6e04,_0x17d3('0x45')),['password','salt']);_0x463776['query']=_[_0x17d3('0x4d')](_0x4c5a76['query']);_0x463776[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x463776['model'],_0x463776[_0x17d3('0x50')]);_0x518e29['attributes']=_[_0x17d3('0x4f')](_0x463776[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x52')]));_0x518e29[_0x17d3('0x53')]=_0x518e29['attributes'][_0x17d3('0x54')]?_0x518e29[_0x17d3('0x53')]:_0x463776[_0x17d3('0x51')];if(!_0x4c5a76['query'][_0x17d3('0x55')](_0x17d3('0x56'))){_0x518e29[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x32')]);_0x518e29[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x31')]);}_0x518e29['order']=qs[_0x17d3('0x57')](_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x57')]);_0x518e29['where']=qs['filters'](_[_0x17d3('0x58')](_0x4c5a76[_0x17d3('0x50')],_0x463776[_0x17d3('0x4e')]),_0x4b6e04);if(_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x59')]){_0x518e29[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x518e29[_0x17d3('0x5a')],{'$or':_[_0x17d3('0x41')](_0x4b6e04,function(_0x47d70a){if(_0x47d70a[_0x17d3('0x5c')]!==_0x17d3('0x5d')){return db['sequelize']['where'](db['sequelize']['fn']('lower',db[_0x17d3('0x5e')][_0x17d3('0x5f')](_0x47d70a[_0x17d3('0x45')])),{'$like':db[_0x17d3('0x5e')]['fn']('lower','%'+_0x4c5a76['query'][_0x17d3('0x59')]+'%')});}})});}_0x518e29=_[_0x17d3('0x5b')]({},_0x518e29,_0x4c5a76[_0x17d3('0x60')]);var _0xd58d1c={'where':_0x518e29[_0x17d3('0x5a')]};return db[_0x17d3('0x61')][_0x17d3('0x30')](_0xd58d1c)['then'](function(_0xf9e35){_0x35b177[_0x17d3('0x30')]=_0xf9e35;if(_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x62')]){_0x518e29['include']=[{'all':!![]}];}return db[_0x17d3('0x61')][_0x17d3('0x63')](_0x518e29);})[_0x17d3('0x22')](function(_0xeda3a8){_0x35b177[_0x17d3('0x64')]=_0xeda3a8;return _0x35b177;})[_0x17d3('0x22')](respondWithFilteredResult(_0x2f2661,_0x518e29))[_0x17d3('0x2c')](handleError(_0x2f2661,null));};exports['show']=function(_0x3c0734,_0xf36bfe){var _0x135b7f={'raw':![],'where':{'id':_0x3c0734[_0x17d3('0x65')]['id']}},_0x43df8={};_0x43df8['model']=_[_0x17d3('0x4c')](_[_0x17d3('0x4d')](db[_0x17d3('0x61')][_0x17d3('0x4b')]),[_0x17d3('0x66'),'salt']);_0x43df8[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x3c0734[_0x17d3('0x50')]);_0x43df8[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x43df8[_0x17d3('0x51')],_0x43df8[_0x17d3('0x50')]);_0x135b7f[_0x17d3('0x53')]=_['intersection'](_0x43df8[_0x17d3('0x51')],qs['fields'](_0x3c0734[_0x17d3('0x50')][_0x17d3('0x52')]));_0x135b7f[_0x17d3('0x53')]=_0x135b7f['attributes']['length']?_0x135b7f['attributes']:_0x43df8['model'];if(_0x3c0734[_0x17d3('0x50')][_0x17d3('0x62')]){_0x135b7f[_0x17d3('0x67')]=[{'all':!![]}];}_0x135b7f=_[_0x17d3('0x5b')]({},_0x135b7f,_0x3c0734['options']);return db[_0x17d3('0x61')][_0x17d3('0x44')](_0x135b7f)[_0x17d3('0x22')](handleEntityNotFound(_0xf36bfe,null))['then'](respondWithResult(_0xf36bfe,null))[_0x17d3('0x2c')](handleError(_0xf36bfe,null));};exports[_0x17d3('0x68')]=function(_0x1efb76,_0x1ad8a6){return db[_0x17d3('0x61')][_0x17d3('0x68')](_0x1efb76[_0x17d3('0x69')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1ad8a6,0xc9))[_0x17d3('0x2c')](handleError(_0x1ad8a6,null));};exports[_0x17d3('0x37')]=function(_0x4c49a4,_0x2680e4){if(_0x4c49a4['body']['id']){delete _0x4c49a4[_0x17d3('0x69')]['id'];}delete _0x4c49a4[_0x17d3('0x69')][_0x17d3('0x43')];return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x4c49a4['params']['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x2680e4,null))[_0x17d3('0x22')](saveUpdates(_0x4c49a4['body'],null))['then'](respondWithResult(_0x2680e4,null))[_0x17d3('0x2c')](handleError(_0x2680e4,null));};exports[_0x17d3('0x6a')]=function(_0xedb038,_0x4cea69){return db[_0x17d3('0x61')][_0x17d3('0x6a')]()[_0x17d3('0x22')](respondWithResult(_0x4cea69,null))[_0x17d3('0x2c')](handleError(_0x4cea69,null));};exports[_0x17d3('0x6b')]=function(_0x472826,_0xa4dc63,_0x30b54b){return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x472826[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0xa4dc63,null))['then'](function(_0x34c8d2){if(_0x34c8d2){return _0x34c8d2[_0x17d3('0x6b')](_0x472826[_0x17d3('0x69')]['ids'],_['omit'](_0x472826[_0x17d3('0x69')],[_0x17d3('0x6c'),'id'])||{});}})[_0x17d3('0x22')](respondWithResult(_0xa4dc63,null))[_0x17d3('0x2c')](handleError(_0xa4dc63,null));};var getLicense=function(_0x3b1624){return new BPromise(function(_0x53d609,_0x293403){var _0x39080b=0x0;_0x3b1624[_0x17d3('0x69')][_0x17d3('0x43')]===_0x17d3('0x3d')&&_0x53d609('agent\x20role');return db[_0x17d3('0x61')]['count']({'where':{'$or':[{'role':_0x3b1624['body'][_0x17d3('0x43')]===_0x17d3('0x3f')?'telephone':[_0x17d3('0x6d'),_0x17d3('0x3b')]}]}})[_0x17d3('0x22')](function(_0x22b8a8){_0x39080b=_0x22b8a8;return require(_0x17d3('0x6e'))[_0x17d3('0x6f')]();})[_0x17d3('0x22')](function(_0x573e0f){var _0x1058b1=_0x3b1624[_0x17d3('0x69')]['role']===_0x17d3('0x3f')?_0x17d3('0x70'):_0x17d3('0x71');if(!_[_0x17d3('0x72')](_0x573e0f[_0x1058b1])&&_0x39080b>=_0x573e0f[_0x1058b1]){return _0x293403({'message':_0x17d3('0x73')});}return _0x53d609(util['format'](_0x17d3('0x74'),_0x1058b1,_0x39080b));})['catch'](function(_0x41dca8){return _0x293403(_0x41dca8);});});};exports[_0x17d3('0x75')]=function(_0x16869d,_0x99106){return getLicense(_0x16869d)['then'](function(_0x5ef94d){if(!_0x16869d[_0x17d3('0x69')]['internal']){var _0x521bd6;return db[_0x17d3('0x76')][_0x17d3('0x77')](0x1)[_0x17d3('0x22')](function(_0x5213ad){return checkPasswordPattern(_0x5213ad,_0x16869d[_0x17d3('0x69')]['password'],_0x5213ad['securePassword']);})['then'](function(_0x51af9a){_0x521bd6=_0x51af9a[_0x17d3('0x78')];return db[_0x17d3('0x61')][_0x17d3('0x79')](_0x17d3('0x7a'));})['then'](function(_0x2b43f5){if(_[_0x17d3('0x72')](_0x2b43f5)){if(_0x521bd6){_0x16869d['body'][_0x17d3('0x7a')]=_0x521bd6;}else{_0x16869d['body'][_0x17d3('0x7a')]=0x1;}}else{if(_[_0x17d3('0x72')](_0x521bd6)||_0x521bd6==_0x2b43f5){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x2b43f5+0x1;}else if(_0x521bd6>_0x2b43f5){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x521bd6;}else{return db[_0x17d3('0x5e')][_0x17d3('0x50')](_0x17d3('0x7b'),{'type':db[_0x17d3('0x5e')][_0x17d3('0x7c')][_0x17d3('0x7d')]})[_0x17d3('0x22')](function(_0x2f2bbb){if(_0x2f2bbb&&_0x2f2bbb['length']){for(var _0x5f1d3d=0x0,_0x2628e3=_0x2f2bbb[_0x17d3('0x54')];_0x5f1d3d<_0x2628e3&&_['isNil'](_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]);_0x5f1d3d++){if(_0x521bd6<=_0x2f2bbb[_0x5f1d3d][_0x17d3('0x7e')]){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x2f2bbb[_0x5f1d3d][_0x17d3('0x7e')];}else if(_0x521bd6>_0x2f2bbb[_0x5f1d3d][_0x17d3('0x7e')]&&_0x521bd6<=_0x2f2bbb[_0x5f1d3d]['to']){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x521bd6;}}}if(_['isNil'](_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')])){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x2b43f5+0x1;}});}}});}})[_0x17d3('0x22')](function(){if(_0x16869d[_0x17d3('0x69')]['voicemail']){_0x16869d[_0x17d3('0x69')]['mailbox']=_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')];_0x16869d['body'][_0x17d3('0x7f')]={'mailbox':_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')],'password':_0x16869d[_0x17d3('0x69')]['password'],'fullname':_0x16869d[_0x17d3('0x69')][_0x17d3('0x80')],'email':_0x16869d[_0x17d3('0x69')][_0x17d3('0x81')]};}if(_0x16869d[_0x17d3('0x69')]&&_0x16869d[_0x17d3('0x69')]['role']==='agent'){if(!_0x16869d['body']['permissions']){_0x16869d[_0x17d3('0x69')][_0x17d3('0x82')]=['101',_0x17d3('0x83'),_0x17d3('0x84'),_0x17d3('0x85'),_0x17d3('0x86'),_0x17d3('0x87'),_0x17d3('0x88'),_0x17d3('0x89'),_0x17d3('0x8a'),_0x17d3('0x8b'),'109',_0x17d3('0x8c'),_0x17d3('0x8d'),_0x17d3('0x8e')];}}return db['User']['create'](_0x16869d['body'],{'include':[{'model':db[_0x17d3('0x7f')],'as':_0x17d3('0x7f')}]});})[_0x17d3('0x22')](function(_0xa631d9){if(_0x16869d[_0x17d3('0x69')]['role']==='user')return _0xa631d9;var _0xa44436=_0x16869d['user'][_0x17d3('0x39')]({'plain':!![]});if(!_0xa44436)throw new Error(_0x17d3('0x8f'));if(_0xa44436['role']===_0x17d3('0x3b')){var _0x471352=_0xa631d9['get']({'plain':!![]});var _0x170a93=[{'name':_0x17d3('0x3c'),'value':_0x17d3('0x3d')},{'name':'Telephones','value':_0x17d3('0x3f')}];var _0x52d77a=_['find'](_0x170a93,[_0x17d3('0x42'),_0x471352[_0x17d3('0x43')]])[_0x17d3('0x45')];return db[_0x17d3('0x90')][_0x17d3('0x44')]({'where':{'name':_0x52d77a,'userProfileId':_0xa44436[_0x17d3('0x91')]},'raw':!![]})[_0x17d3('0x22')](function(_0x3013f7){if(_0x3013f7&&_0x3013f7['autoAssociation']===0x0){return db['UserProfileResource'][_0x17d3('0x75')]({'name':_0x471352[_0x17d3('0x45')],'resourceId':_0x471352['id'],'type':_0x3013f7[_0x17d3('0x45')],'sectionId':_0x3013f7['id']},{})['then'](function(){return _0xa631d9;});}else{return _0xa631d9;}})['catch'](function(_0x1080dd){logger[_0x17d3('0x26')](_0x17d3('0x92'),_0x1080dd);throw _0x1080dd;});}return _0xa631d9;})[_0x17d3('0x22')](respondWithResult(_0x99106,0xc9))[_0x17d3('0x2c')](handleError(_0x99106,null));};exports[_0x17d3('0x93')]=function(_0x212862,_0x3a657a,_0x4e0eb7){var _0x17db04=![];if(_0x212862[_0x17d3('0x69')]['id']){delete _0x212862[_0x17d3('0x69')]['id'];}return db[_0x17d3('0x76')][_0x17d3('0x94')]({'attributes':['id',_0x17d3('0x95')]})[_0x17d3('0x22')](function(_0x4e934a){_0x17db04=_0x4e934a[_0x17d3('0x95')];return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x212862['params']['id']}});})[_0x17d3('0x22')](function(_0x39898b){if(_0x39898b){if(_0x39898b['id']==_0x212862[_0x17d3('0x3b')]['id']){if(!_0x212862[_0x17d3('0x69')][_0x17d3('0x96')]||!_0x212862[_0x17d3('0x69')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x17d3('0x97'));}if(!_0x39898b[_0x17d3('0x98')](_0x212862['body'][_0x17d3('0x96')])){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))](_0x17d3('0x9b'));}if(_0x212862[_0x17d3('0x69')]['oldPassword']==_0x212862[_0x17d3('0x69')][_0x17d3('0x9c')]){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x39898b;}else if(_0x212862['user']['role']==_0x17d3('0x6d')){if(!_0x212862[_0x17d3('0x69')][_0x17d3('0x9c')]){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))](_0x17d3('0x9d'));}return _0x39898b;}else if(_0x212862[_0x17d3('0x3b')]['role']==_0x17d3('0x3b')){if(!_0x212862[_0x17d3('0x69')]['newPassword']){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x39898b[_0x17d3('0x43')]!='agent'){throw new db[(_0x17d3('0x99'))]['ValidationError'](_0x17d3('0x9e'));}return _0x39898b;}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}}return null;})['then'](handleEntityNotFound(_0x3a657a,null))['then'](function(_0x3d4056){return checkPasswordPattern(_0x3d4056,_0x212862[_0x17d3('0x69')]['newPassword'],_0x17db04);})['then'](saveUpdates({'password':_0x212862['body'][_0x17d3('0x9c')],'passwordResetAt':_0x212862[_0x17d3('0x3b')]['id']==_0x212862[_0x17d3('0x65')]['id']?moment():null},null))[_0x17d3('0x22')](respondWithResult(_0x3a657a,null))[_0x17d3('0x2c')](handleError(_0x3a657a,null));};exports[_0x17d3('0x9f')]=function(_0x5d651a,_0x1e26c4,_0x34ee02){var _0x3ce02f=_0x5d651a[_0x17d3('0x69')]['channel'];return db['User']['find']({'where':{'id':_0x5d651a[_0x17d3('0x65')]['id']},'attributes':['id','name',_0x17d3('0x43'),'online',_0x17d3('0xa0'),_0x17d3('0xa1'),_0x17d3('0xa2')]})[_0x17d3('0x22')](handleEntityNotFound(_0x1e26c4,null))[_0x17d3('0x22')](function(_0x35e5ac){if(_0x35e5ac){if(!utils[_0x17d3('0xa3')](_0x3ce02f)){throw new db[(_0x17d3('0x99'))]['ValidationError'](_0x17d3('0xa4'));}return _0x35e5ac[_0x17d3('0xa5')+_[_0x17d3('0xa6')](_0x3ce02f[_0x17d3('0xa7')]())+'Queues'](_0x5d651a['body'][_0x17d3('0x6c')],{'penalty':_0x5d651a['body'][_0x17d3('0xa8')]||0x0})[_0x17d3('0xa9')](function(_0x4333ba){for(var _0x33b48a=0x0;_0x33b48a<_0x5d651a['body'][_0x17d3('0x6c')][_0x17d3('0x54')];_0x33b48a+=0x1){var _0x598954={'UserId':_0x5d651a['params']['id']};_0x598954[_[_0x17d3('0xa6')](_0x3ce02f[_0x17d3('0xa7')]())+_0x17d3('0xaa')]=_0x5d651a[_0x17d3('0x69')]['ids'][_0x33b48a];socket[_0x17d3('0xab')](_0x17d3('0x3b')+_[_0x17d3('0xa6')](_0x3ce02f[_0x17d3('0xa7')]())+'Queue:save',_0x598954);}return _0x4333ba;})['then'](function(){if(_0x3ce02f==='voice'){return db[_0x17d3('0xac')][_0x17d3('0x63')]({'where':{'id':_0x5d651a[_0x17d3('0x69')][_0x17d3('0x6c')]||[]},'raw':!![],'attributes':['id',_0x17d3('0x45')]});}})[_0x17d3('0x22')](function(_0x32fb0c){var _0x393583=_0x35e5ac[_0x17d3('0x39')]({'plain':!![]});var _0x572777=[];if(_0x3ce02f==='voice'&&_0x393583[_0x17d3('0x43')]===_0x17d3('0x3d')&&_0x393583[_0x17d3('0xad')]){for(var _0x2cab66=0x0;_0x2cab66<_0x32fb0c[_0x17d3('0x54')];_0x2cab66+=0x1){_0x572777[_0x17d3('0xae')]({'membername':_0x393583[_0x17d3('0x45')],'UserId':_0x393583['id'],'queue_name':_0x32fb0c[_0x2cab66][_0x17d3('0x45')],'VoiceQueueId':_0x32fb0c[_0x2cab66]['id'],'interface':_['isNil'](_0x393583['interface'])?util[_0x17d3('0xaf')](_0x17d3('0xb0'),_0x393583[_0x17d3('0x45')]):_0x393583[_0x17d3('0xa2')],'paused':_0x393583[_0x17d3('0xa1')]||![],'penalty':_0x5d651a[_0x17d3('0x69')][_0x17d3('0xa8')]||0x0});}return BPromise[_0x17d3('0xb1')](_0x572777,function(_0x1e8490){return db['UserVoiceQueueRt']['upsert'](_0x1e8490);});}return _0x35e5ac;});}})['then'](respondWithStatusCode(_0x1e26c4,null))[_0x17d3('0x2c')](handleError(_0x1e26c4,null));};exports[_0x17d3('0xb2')]=function(_0x3f5eb2,_0x54da57,_0x52467c){var _0x211ca6;return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x3f5eb2[_0x17d3('0x65')]['id']},'attributes':['id',_0x17d3('0x45'),_0x17d3('0x43')]})['then'](handleEntityNotFound(_0x54da57,null))[_0x17d3('0x22')](function(_0x10c5c3){if(_0x10c5c3){_0x211ca6=_0x10c5c3;if(!_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0xb3')]||!utils[_0x17d3('0xa3')](_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0xb3')])){throw new db['Sequelize'][(_0x17d3('0x9a'))](_0x17d3('0xa4'));}return _0x10c5c3[_0x17d3('0xb4')+_['capitalize'](_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0xb3')][_0x17d3('0xa7')]())+_0x17d3('0xb5')](_0x3f5eb2['query'][_0x17d3('0x6c')]);}})['then'](function(_0x435536){for(var _0x2ca112=0x0;_0x2ca112<_0x3f5eb2['query'][_0x17d3('0x6c')][_0x17d3('0x54')];_0x2ca112+=0x1){var _0x31679a={'UserId':_0x3f5eb2[_0x17d3('0x65')]['id']};_0x31679a[_['capitalize'](_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0xb3')][_0x17d3('0xa7')]())+_0x17d3('0xaa')]=_0x3f5eb2[_0x17d3('0x50')]['ids'][_0x2ca112];socket[_0x17d3('0xab')](_0x17d3('0x3b')+_[_0x17d3('0xa6')](_0x3f5eb2['query'][_0x17d3('0xb3')][_0x17d3('0xa7')]())+_0x17d3('0xb6'),_0x31679a);}return _0x435536;})[_0x17d3('0x22')](function(){if(_0x3f5eb2[_0x17d3('0x50')]['channel']===_0x17d3('0xb7')){return db[_0x17d3('0xb8')][_0x17d3('0x38')]({'where':{'UserId':_0x3f5eb2['params']['id'],'VoiceQueueId':_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0x6c')]},'individualHooks':!![]})[_0x17d3('0x22')](function(){return _0x211ca6;});}return _0x211ca6;})[_0x17d3('0x22')](respondWithStatusCode(_0x54da57,null))[_0x17d3('0x2c')](handleError(_0x54da57,null));};exports[_0x17d3('0xb9')]=function(_0x1850d3,_0x123526,_0x18b806){_0x1850d3['body'][_0x17d3('0xba')]=_0x1850d3['file'][_0x17d3('0xbb')];return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x1850d3[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x123526,null))[_0x17d3('0x22')](saveUpdates(_0x1850d3[_0x17d3('0x69')],null))[_0x17d3('0x22')](respondWithResult(_0x123526,null))[_0x17d3('0x2c')](handleError(_0x123526,null));};exports[_0x17d3('0xbc')]=function(_0x1cde94,_0x1daa08,_0x1bde46){var _0x57370b=path[_0x17d3('0xbd')](config[_0x17d3('0xbe')],'server/files/images/logos/default_profile.png');return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x1cde94[_0x17d3('0x65')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x1daa08,null))[_0x17d3('0x22')](function(_0x486822){if(_0x486822){if(_[_0x17d3('0x72')](_0x486822[_0x17d3('0xba')])){return _0x1daa08[_0x17d3('0xbf')](_0x57370b);}else{if(!fs['existsSync'](path[_0x17d3('0xbd')](config[_0x17d3('0xbe')],_0x17d3('0xc0'),_0x486822[_0x17d3('0xba')]))){return _0x1daa08[_0x17d3('0xbf')](_0x57370b);}return _0x1daa08[_0x17d3('0xbf')](path['join'](config[_0x17d3('0xbe')],_0x17d3('0xc0'),_0x486822[_0x17d3('0xba')]));}}})[_0x17d3('0x2c')](handleError(_0x1daa08,null));};exports[_0x17d3('0xc1')]=function(_0x2e8fcc,_0x36a47b,_0x410014){var _0xeeb008={};var _0x4e154e={};var _0x8491b4;var _0x6e098a;return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x2e8fcc[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x36a47b,null))[_0x17d3('0x22')](function(_0x5da1b4){if(_0x5da1b4){_0x8491b4=_0x5da1b4;_0x4e154e[_0x17d3('0x51')]=_[_0x17d3('0x4d')](db[_0x17d3('0xc2')][_0x17d3('0x4b')]);_0x4e154e['query']=_[_0x17d3('0x4d')](_0x2e8fcc[_0x17d3('0x50')]);_0x4e154e[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x4e154e['model'],_0x4e154e[_0x17d3('0x50')]);_0xeeb008[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x4e154e[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x2e8fcc['query'][_0x17d3('0x52')]));_0xeeb008[_0x17d3('0x53')]=_0xeeb008[_0x17d3('0x53')][_0x17d3('0x54')]?_0xeeb008[_0x17d3('0x53')]:_0x4e154e['model'];_0xeeb008[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x57')]);_0xeeb008[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x2e8fcc[_0x17d3('0x50')],_0x4e154e[_0x17d3('0x4e')]));if(_0x2e8fcc['query'][_0x17d3('0x59')]){_0xeeb008[_0x17d3('0x5a')]=_['merge'](_0xeeb008['where'],{'$or':_['map'](_0xeeb008[_0x17d3('0x53')],function(_0x581b3d){var _0x26079e={};_0x26079e[_0x581b3d]={'$like':'%'+_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x26079e;})});}_0xeeb008=_['merge']({},_0xeeb008,_0x2e8fcc[_0x17d3('0x60')]);return _0x8491b4[_0x17d3('0xc1')](_0xeeb008);}})[_0x17d3('0x22')](function(_0x496c72){if(_0x496c72){_0x6e098a=_0x496c72['length'];if(_0x2e8fcc['query']['hasOwnProperty'](_0x17d3('0x62'))){_0xeeb008[_0x17d3('0x67')]=[{'model':db[_0x17d3('0xc4')],'as':_0x17d3('0xc5'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x17d3('0x45'),_0x17d3('0xc6')],'where':_0x2e8fcc['query'][_0x17d3('0xc7')]?{'id':_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0xc7')]}:undefined,'required':_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0xc7')]?!![]:![]}];}if(!_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x55')]('nolimit')){_0xeeb008[_0x17d3('0x32')]=qs['limit'](_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x32')]);_0xeeb008[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x8491b4['getContacts'](_0xeeb008);}})[_0x17d3('0x22')](function(_0x2b80fb){if(_0x2b80fb){return _0x2b80fb?{'count':_0x6e098a,'rows':_0x2b80fb}:null;}})[_0x17d3('0x22')](respondWithResult(_0x36a47b,null))[_0x17d3('0x2c')](handleError(_0x36a47b,null));};exports[_0x17d3('0xc8')]=function(_0x14aa31,_0x57e9bc,_0x5591fa){var _0x28e993;var _0x417b70;var _0x4d4982={};var _0x372571;return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x14aa31['params']['id']},'attributes':['id',_0x17d3('0x45'),'role']})[_0x17d3('0x22')](handleEntityNotFound(_0x57e9bc,null))[_0x17d3('0x22')](function(_0x4570cf){if(!utils[_0x17d3('0xa3')](_0x14aa31['query'][_0x17d3('0xb3')])){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))](_0x17d3('0xa4'));}_0x28e993=_0x4570cf;var _0x4c8b0c={};_0x4c8b0c['model']=_[_0x17d3('0x4d')](db[_[_0x17d3('0xa6')](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+'Queue'][_0x17d3('0x4b')]);_0x4c8b0c[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x14aa31[_0x17d3('0x50')]);_0x4c8b0c[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x4c8b0c[_0x17d3('0x51')],_0x4c8b0c[_0x17d3('0x50')]);_0x4d4982[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x4c8b0c[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x14aa31['query'][_0x17d3('0x52')]));_0x4d4982[_0x17d3('0x53')]=_0x4d4982[_0x17d3('0x53')][_0x17d3('0x54')]?_0x4d4982[_0x17d3('0x53')]:_0x4c8b0c['model'];_0x4d4982['order']=qs['sort'](_0x14aa31[_0x17d3('0x50')][_0x17d3('0x57')]);_0x4d4982[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_['pick'](_0x14aa31[_0x17d3('0x50')],_0x4c8b0c[_0x17d3('0x4e')]));if(_0x14aa31['query'][_0x17d3('0x59')]){_0x4d4982[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x4d4982['where'],{'$or':_[_0x17d3('0x41')](_0x4d4982['attributes'],function(_0x408e97){var _0x1724f5={};_0x1724f5[_0x408e97]={'$like':'%'+_0x14aa31['query'][_0x17d3('0x59')]+'%'};return _0x1724f5;})});}_0x4d4982=_[_0x17d3('0x5b')]({},_0x4d4982,_0x14aa31[_0x17d3('0x60')]);switch(_0x28e993[_0x17d3('0x43')]){case'admin':return db[_['capitalize'](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+_0x17d3('0xc9')][_0x17d3('0x63')](_0x4d4982);case _0x17d3('0x3b'):case _0x17d3('0x3d'):return _0x28e993[_0x17d3('0x39')+_['capitalize'](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+_0x17d3('0xb5')](_0x4d4982);default:throw new db[(_0x17d3('0x99'))]['ValidationError'](_0x17d3('0xca'));}})[_0x17d3('0x22')](function(_0x458d42){_0x372571=_0x458d42[_0x17d3('0x54')];if(!_0x14aa31[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x4d4982['limit']=qs[_0x17d3('0x32')](_0x14aa31[_0x17d3('0x50')][_0x17d3('0x32')]);_0x4d4982['offset']=qs['offset'](_0x14aa31[_0x17d3('0x50')][_0x17d3('0x31')]);}switch(_0x28e993[_0x17d3('0x43')]){case _0x17d3('0x6d'):return db[_[_0x17d3('0xa6')](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+_0x17d3('0xc9')][_0x17d3('0x63')](_0x4d4982);case _0x17d3('0x3b'):case _0x17d3('0x3d'):return _0x28e993[_0x17d3('0x39')+_[_0x17d3('0xa6')](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+_0x17d3('0xb5')](_0x4d4982);}})[_0x17d3('0x22')](function(_0x16d0e2){return{'count':_0x372571,'rows':_0x16d0e2};})[_0x17d3('0x22')](respondWithResult(_0x57e9bc,null))['catch'](handleError(_0x57e9bc,null));};exports['getVoiceQueuesRt']=function(_0xe29fb4,_0x114e6e,_0x3cab52){var _0x572fe2={};var _0x2ea167={};var _0x39cb7a;var _0xc540a5;return db['User'][_0x17d3('0x94')]({'where':{'id':_0xe29fb4[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x114e6e,null))['then'](function(_0x3235d0){if(_0x3235d0){_0x39cb7a=_0x3235d0;_0x2ea167['model']=_[_0x17d3('0x4d')](db[_0x17d3('0xb8')][_0x17d3('0x4b')]);_0x2ea167[_0x17d3('0x50')]=_['keys'](_0xe29fb4[_0x17d3('0x50')]);_0x2ea167[_0x17d3('0x4e')]=_['intersection'](_0x2ea167[_0x17d3('0x51')],_0x2ea167[_0x17d3('0x50')]);_0x572fe2[_0x17d3('0x53')]=_['intersection'](_0x2ea167[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0xe29fb4['query'][_0x17d3('0x52')]));_0x572fe2[_0x17d3('0x53')]=_0x572fe2[_0x17d3('0x53')][_0x17d3('0x54')]?_0x572fe2['attributes']:_0x2ea167[_0x17d3('0x51')];_0x572fe2[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0xe29fb4[_0x17d3('0x50')]['sort']);_0x572fe2[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0xe29fb4['query'],_0x2ea167['filters']));if(_0xe29fb4['query'][_0x17d3('0x59')]){_0x572fe2[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x572fe2['where'],{'$or':_[_0x17d3('0x41')](_0x572fe2[_0x17d3('0x53')],function(_0x3f7ccf){var _0x2e5631={};_0x2e5631[_0x3f7ccf]={'$like':'%'+_0xe29fb4['query']['filter']+'%'};return _0x2e5631;})});}_0x572fe2=_[_0x17d3('0x5b')]({},_0x572fe2,_0xe29fb4[_0x17d3('0x60')]);return _0x39cb7a[_0x17d3('0xcb')](_0x572fe2);}})[_0x17d3('0x22')](function(_0x2da750){if(_0x2da750){_0xc540a5=_0x2da750[_0x17d3('0x54')];if(!_0xe29fb4[_0x17d3('0x50')]['hasOwnProperty'](_0x17d3('0x56'))){_0x572fe2[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0xe29fb4[_0x17d3('0x50')][_0x17d3('0x32')]);_0x572fe2[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0xe29fb4[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x39cb7a[_0x17d3('0xcb')](_0x572fe2);}})[_0x17d3('0x22')](function(_0x3dc68c){if(_0x3dc68c){return _0x3dc68c?{'count':_0xc540a5,'rows':_0x3dc68c}:null;}})['then'](respondWithResult(_0x114e6e,null))[_0x17d3('0x2c')](handleError(_0x114e6e,null));};exports['getGroups']=function(_0x5ad128,_0x2c3738,_0x163a33){var _0x528d98={};var _0x13e62e={};var _0x4faaac;var _0x2adc66;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x5ad128[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x2c3738,null))[_0x17d3('0x22')](function(_0x596554){if(_0x596554){_0x4faaac=_0x596554;_0x13e62e['model']=_[_0x17d3('0x4d')](db['ChatGroup'][_0x17d3('0x4b')]);_0x13e62e[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x5ad128[_0x17d3('0x50')]);_0x13e62e[_0x17d3('0x4e')]=_['intersection'](_0x13e62e['model'],_0x13e62e[_0x17d3('0x50')]);_0x528d98[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x13e62e[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x5ad128[_0x17d3('0x50')][_0x17d3('0x52')]));_0x528d98[_0x17d3('0x53')]=_0x528d98[_0x17d3('0x53')][_0x17d3('0x54')]?_0x528d98['attributes']:_0x13e62e['model'];_0x528d98['order']=qs[_0x17d3('0x57')](_0x5ad128[_0x17d3('0x50')][_0x17d3('0x57')]);_0x528d98[_0x17d3('0x5a')]=qs['filters'](_[_0x17d3('0x58')](_0x5ad128[_0x17d3('0x50')],_0x13e62e[_0x17d3('0x4e')]));if(_0x5ad128['query'][_0x17d3('0x59')]){_0x528d98[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x528d98[_0x17d3('0x5a')],{'$or':_['map'](_0x528d98['attributes'],function(_0x2e3cda){var _0x10f29c={};_0x10f29c[_0x2e3cda]={'$like':'%'+_0x5ad128[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x10f29c;})});}_0x528d98=_[_0x17d3('0x5b')]({},_0x528d98,_0x5ad128[_0x17d3('0x60')]);return _0x4faaac[_0x17d3('0xcc')](_0x528d98);}})[_0x17d3('0x22')](function(_0x4fc825){if(_0x4fc825){_0x2adc66=_0x4fc825[_0x17d3('0x54')];if(!_0x5ad128[_0x17d3('0x50')][_0x17d3('0x55')]('nolimit')){_0x528d98[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x5ad128[_0x17d3('0x50')][_0x17d3('0x32')]);_0x528d98['offset']=qs['offset'](_0x5ad128[_0x17d3('0x50')]['offset']);}return _0x4faaac[_0x17d3('0xcc')](_0x528d98);}})[_0x17d3('0x22')](function(_0x11f619){if(_0x11f619){return _0x11f619?{'count':_0x2adc66,'rows':_0x11f619}:null;}})[_0x17d3('0x22')](respondWithResult(_0x2c3738,null))['catch'](handleError(_0x2c3738,null));};exports[_0x17d3('0xcd')]=function(_0x59388f,_0x5708e2,_0x5a1ab5){var _0x543371={'raw':!![],'where':{}};var _0x5f79d0={};var _0x165244={'count':0x0,'rows':[]};return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x59388f[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x5708e2,null))[_0x17d3('0x22')](function(_0x22b9b6){if(_0x22b9b6){_0x5f79d0[_0x17d3('0x51')]=_[_0x17d3('0x4d')](db['VoiceRecording'][_0x17d3('0x4b')]);_0x5f79d0[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x59388f[_0x17d3('0x50')]);_0x5f79d0[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x5f79d0['model'],_0x5f79d0[_0x17d3('0x50')]);_0x543371[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x5f79d0[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x59388f['query'][_0x17d3('0x52')]));_0x543371[_0x17d3('0x53')]=_0x543371[_0x17d3('0x53')][_0x17d3('0x54')]?_0x543371[_0x17d3('0x53')]:_0x5f79d0['model'];if(!_0x59388f['query'][_0x17d3('0x55')](_0x17d3('0x56'))){_0x543371[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x59388f['query']['limit']);_0x543371[_0x17d3('0x31')]=qs['offset'](_0x59388f[_0x17d3('0x50')]['offset']);}_0x543371['order']=qs[_0x17d3('0x57')](_0x59388f['query'][_0x17d3('0x57')]);_0x543371[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x59388f[_0x17d3('0x50')],_0x5f79d0[_0x17d3('0x4e')]));_0x543371['where'][_0x17d3('0xce')]=_0x22b9b6['id'];if(_0x59388f[_0x17d3('0x50')][_0x17d3('0x59')]){_0x543371[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x543371[_0x17d3('0x5a')],{'$or':_['map'](_0x543371[_0x17d3('0x53')],function(_0x259be5){var _0x48b97d={};_0x48b97d[_0x259be5]={'$like':'%'+_0x59388f[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x48b97d;})});}_0x543371=_[_0x17d3('0x5b')]({},_0x543371,_0x59388f[_0x17d3('0x60')]);return db[_0x17d3('0xcf')][_0x17d3('0x30')]({'where':_0x543371[_0x17d3('0x5a')]})['then'](function(_0x5c346b){_0x165244[_0x17d3('0x30')]=_0x5c346b;if(_0x59388f['query'][_0x17d3('0x62')]){_0x543371[_0x17d3('0x67')]=[{'all':!![]}];}return db[_0x17d3('0xcf')][_0x17d3('0x63')](_0x543371);})['then'](function(_0xe383ef){_0x165244['rows']=_0xe383ef;return _0x165244;});}})[_0x17d3('0x22')](respondWithFilteredResult(_0x5708e2,_0x543371))[_0x17d3('0x2c')](handleError(_0x5708e2,null));};exports['getScreenRecordings']=function(_0x2ae667,_0x5b8f7e,_0x3e8d3e){var _0x2fe020={'raw':!![],'where':{}};var _0x39ea22={};var _0xae1988={'count':0x0,'rows':[]};return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x2ae667[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x5b8f7e,null))[_0x17d3('0x22')](function(_0x5ef08a){if(_0x5ef08a){_0x39ea22['model']=_[_0x17d3('0x4d')](db[_0x17d3('0xd0')][_0x17d3('0x4b')]);_0x39ea22[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x2ae667[_0x17d3('0x50')]);_0x39ea22[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x39ea22[_0x17d3('0x51')],_0x39ea22[_0x17d3('0x50')]);_0x2fe020[_0x17d3('0x53')]=_['intersection'](_0x39ea22[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x2ae667['query'][_0x17d3('0x52')]));_0x2fe020[_0x17d3('0x53')]=_0x2fe020[_0x17d3('0x53')]['length']?_0x2fe020['attributes']:_0x39ea22[_0x17d3('0x51')];if(!_0x2ae667[_0x17d3('0x50')][_0x17d3('0x55')]('nolimit')){_0x2fe020[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x2ae667['query'][_0x17d3('0x32')]);_0x2fe020['offset']=qs[_0x17d3('0x31')](_0x2ae667['query']['offset']);}_0x2fe020['order']=qs[_0x17d3('0x57')](_0x2ae667[_0x17d3('0x50')][_0x17d3('0x57')]);_0x2fe020[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x2ae667[_0x17d3('0x50')],_0x39ea22[_0x17d3('0x4e')]));_0x2fe020[_0x17d3('0x5a')][_0x17d3('0xce')]=_0x5ef08a['id'];if(_0x2ae667['query'][_0x17d3('0x59')]){_0x2fe020['where']=_['merge'](_0x2fe020[_0x17d3('0x5a')],{'$or':_['map'](_0x2fe020[_0x17d3('0x53')],function(_0x5e43f4){var _0x2327b={};_0x2327b[_0x5e43f4]={'$like':'%'+_0x2ae667[_0x17d3('0x50')]['filter']+'%'};return _0x2327b;})});}_0x2fe020=_[_0x17d3('0x5b')]({},_0x2fe020,_0x2ae667[_0x17d3('0x60')]);return db[_0x17d3('0xd0')][_0x17d3('0x30')]({'where':_0x2fe020['where']})[_0x17d3('0x22')](function(_0x3bbd9c){_0xae1988['count']=_0x3bbd9c;if(_0x2ae667[_0x17d3('0x50')][_0x17d3('0x62')]){_0x2fe020[_0x17d3('0x67')]=[{'all':!![]}];}return db['ScreenRecording'][_0x17d3('0x63')](_0x2fe020);})[_0x17d3('0x22')](function(_0x35a234){_0xae1988[_0x17d3('0x64')]=_0x35a234;return _0xae1988;});}})['then'](respondWithFilteredResult(_0x5b8f7e,_0x2fe020))[_0x17d3('0x2c')](handleError(_0x5b8f7e,null));};exports['getChatInteractions']=function(_0x30b5ac,_0x471b3f,_0x569f63){var _0x3ac26b={};var _0x374d2={};var _0x4604cf;var _0xaee36b;return db['User'][_0x17d3('0x94')]({'where':{'id':_0x30b5ac[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x471b3f,null))[_0x17d3('0x22')](function(_0x2247ad){if(_0x2247ad){_0x4604cf=_0x2247ad;_0x374d2['model']=_[_0x17d3('0x4d')](db['ChatInteraction'][_0x17d3('0x4b')]);_0x374d2['query']=_['keys'](_0x30b5ac[_0x17d3('0x50')]);_0x374d2['filters']=_[_0x17d3('0x4f')](_0x374d2[_0x17d3('0x51')],_0x374d2[_0x17d3('0x50')]);_0x3ac26b[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x374d2[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x52')]));_0x3ac26b[_0x17d3('0x53')]=_0x3ac26b[_0x17d3('0x53')]['length']?_0x3ac26b[_0x17d3('0x53')]:_0x374d2[_0x17d3('0x51')];_0x3ac26b[_0x17d3('0xc3')]=qs['sort'](_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x57')]);_0x3ac26b[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_['pick'](_0x30b5ac[_0x17d3('0x50')],_0x374d2['filters']));if(_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x59')]){_0x3ac26b[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x3ac26b[_0x17d3('0x5a')],{'$or':_['map'](_0x3ac26b[_0x17d3('0x53')],function(_0xeba50c){var _0x4def64={};_0x4def64[_0xeba50c]={'$like':'%'+_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x4def64;})});}_0x3ac26b=_[_0x17d3('0x5b')]({},_0x3ac26b,_0x30b5ac[_0x17d3('0x60')]);return _0x4604cf['getChatInteractions'](_0x3ac26b);}})[_0x17d3('0x22')](function(_0x9253f6){if(_0x9253f6){_0xaee36b=_0x9253f6[_0x17d3('0x54')];if(!_0x30b5ac['query']['hasOwnProperty'](_0x17d3('0x56'))){_0x3ac26b[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x32')]);_0x3ac26b[_0x17d3('0x31')]=qs['offset'](_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x4604cf[_0x17d3('0xd1')](_0x3ac26b);}})[_0x17d3('0x22')](function(_0x577c98){if(_0x577c98){return _0x577c98?{'count':_0xaee36b,'rows':_0x577c98}:null;}})['then'](respondWithResult(_0x471b3f,null))['catch'](handleError(_0x471b3f,null));};exports['getOpenchannelInteractions']=function(_0x3a2ff6,_0x67a705,_0x19fe96){var _0x26b448={};var _0x1cdc5b={};var _0x52d6f4;var _0x5a2af1;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x3a2ff6[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x67a705,null))[_0x17d3('0x22')](function(_0x1bc5b7){if(_0x1bc5b7){_0x52d6f4=_0x1bc5b7;_0x1cdc5b[_0x17d3('0x51')]=_['keys'](db['OpenchannelInteraction'][_0x17d3('0x4b')]);_0x1cdc5b[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x3a2ff6[_0x17d3('0x50')]);_0x1cdc5b[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x1cdc5b['model'],_0x1cdc5b['query']);_0x26b448['attributes']=_[_0x17d3('0x4f')](_0x1cdc5b['model'],qs['fields'](_0x3a2ff6['query'][_0x17d3('0x52')]));_0x26b448[_0x17d3('0x53')]=_0x26b448[_0x17d3('0x53')][_0x17d3('0x54')]?_0x26b448['attributes']:_0x1cdc5b[_0x17d3('0x51')];_0x26b448[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x3a2ff6[_0x17d3('0x50')][_0x17d3('0x57')]);_0x26b448[_0x17d3('0x5a')]=qs['filters'](_['pick'](_0x3a2ff6['query'],_0x1cdc5b[_0x17d3('0x4e')]));if(_0x3a2ff6[_0x17d3('0x50')][_0x17d3('0x59')]){_0x26b448[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x26b448['where'],{'$or':_[_0x17d3('0x41')](_0x26b448['attributes'],function(_0x30266e){var _0x4a7287={};_0x4a7287[_0x30266e]={'$like':'%'+_0x3a2ff6['query'][_0x17d3('0x59')]+'%'};return _0x4a7287;})});}_0x26b448=_[_0x17d3('0x5b')]({},_0x26b448,_0x3a2ff6[_0x17d3('0x60')]);return _0x52d6f4[_0x17d3('0xd2')](_0x26b448);}})['then'](function(_0x2c2b8f){if(_0x2c2b8f){_0x5a2af1=_0x2c2b8f[_0x17d3('0x54')];if(!_0x3a2ff6['query'][_0x17d3('0x55')]('nolimit')){_0x26b448[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x3a2ff6['query'][_0x17d3('0x32')]);_0x26b448['offset']=qs['offset'](_0x3a2ff6[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x52d6f4[_0x17d3('0xd2')](_0x26b448);}})['then'](function(_0x39aba3){if(_0x39aba3){return _0x39aba3?{'count':_0x5a2af1,'rows':_0x39aba3}:null;}})[_0x17d3('0x22')](respondWithResult(_0x67a705,null))['catch'](handleError(_0x67a705,null));};exports[_0x17d3('0xd3')]=function(_0x47f512,_0x37057d,_0xaeb0b7){var _0x275209={'raw':!![],'where':{}};var _0x2c6ae6={};var _0x13e3b1={'count':0x0,'rows':[]};return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x47f512[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x37057d,null))[_0x17d3('0x22')](function(_0x40a2ae){if(_0x40a2ae){_0x2c6ae6['model']=_[_0x17d3('0x4d')](db['MailInteraction']['rawAttributes']);_0x2c6ae6[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x47f512[_0x17d3('0x50')]);_0x2c6ae6[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x2c6ae6[_0x17d3('0x51')],_0x2c6ae6[_0x17d3('0x50')]);_0x275209[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x2c6ae6['model'],qs[_0x17d3('0x52')](_0x47f512[_0x17d3('0x50')][_0x17d3('0x52')]));_0x275209['attributes']=_0x275209[_0x17d3('0x53')]['length']?_0x275209[_0x17d3('0x53')]:_0x2c6ae6[_0x17d3('0x51')];if(!_0x47f512[_0x17d3('0x50')]['hasOwnProperty'](_0x17d3('0x56'))){_0x275209[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x47f512[_0x17d3('0x50')][_0x17d3('0x32')]);_0x275209['offset']=qs['offset'](_0x47f512[_0x17d3('0x50')][_0x17d3('0x31')]);}_0x275209[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x47f512['query'][_0x17d3('0x57')]);_0x275209[_0x17d3('0x5a')]=qs['filters'](_[_0x17d3('0x58')](_0x47f512['query'],_0x2c6ae6['filters']));_0x275209[_0x17d3('0x5a')][_0x17d3('0xce')]=_0x40a2ae['id'];if(_0x47f512['query']['filter']){_0x275209['where']=_[_0x17d3('0x5b')](_0x275209[_0x17d3('0x5a')],{'$or':_['map'](_0x275209[_0x17d3('0x53')],function(_0x2dd6d2){var _0x4f4162={};_0x4f4162[_0x2dd6d2]={'$like':'%'+_0x47f512[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x4f4162;})});}_0x275209=_[_0x17d3('0x5b')]({},_0x275209,_0x47f512[_0x17d3('0x60')]);return db['MailInteraction'][_0x17d3('0x30')]({'where':_0x275209['where']})[_0x17d3('0x22')](function(_0x369f58){_0x13e3b1[_0x17d3('0x30')]=_0x369f58;if(_0x47f512[_0x17d3('0x50')][_0x17d3('0x62')]){_0x275209[_0x17d3('0x67')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x275209);})[_0x17d3('0x22')](function(_0x3e3d2a){_0x13e3b1['rows']=_0x3e3d2a;return _0x13e3b1;});}})[_0x17d3('0x22')](respondWithFilteredResult(_0x37057d,_0x275209))['catch'](handleError(_0x37057d,null));};exports[_0x17d3('0xd4')]=function(_0x4081ba,_0xef569f,_0x60500d){var _0x5734f9={};var _0xbcf92a={};var _0x4a6b1d;var _0x5c3e50;return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x4081ba[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0xef569f,null))[_0x17d3('0x22')](function(_0x1e4657){if(_0x1e4657){_0x4a6b1d=_0x1e4657;_0xbcf92a['model']=_[_0x17d3('0x4d')](db['SmsInteraction'][_0x17d3('0x4b')]);_0xbcf92a[_0x17d3('0x50')]=_['keys'](_0x4081ba['query']);_0xbcf92a[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0xbcf92a['model'],_0xbcf92a['query']);_0x5734f9[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0xbcf92a[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x4081ba[_0x17d3('0x50')][_0x17d3('0x52')]));_0x5734f9[_0x17d3('0x53')]=_0x5734f9['attributes'][_0x17d3('0x54')]?_0x5734f9[_0x17d3('0x53')]:_0xbcf92a[_0x17d3('0x51')];_0x5734f9[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x4081ba[_0x17d3('0x50')]['sort']);_0x5734f9[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x4081ba['query'],_0xbcf92a[_0x17d3('0x4e')]));if(_0x4081ba[_0x17d3('0x50')]['filter']){_0x5734f9[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x5734f9[_0x17d3('0x5a')],{'$or':_[_0x17d3('0x41')](_0x5734f9[_0x17d3('0x53')],function(_0xc07681){var _0x11efaf={};_0x11efaf[_0xc07681]={'$like':'%'+_0x4081ba[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x11efaf;})});}_0x5734f9=_[_0x17d3('0x5b')]({},_0x5734f9,_0x4081ba['options']);return _0x4a6b1d[_0x17d3('0xd4')](_0x5734f9);}})['then'](function(_0x631cc6){if(_0x631cc6){_0x5c3e50=_0x631cc6[_0x17d3('0x54')];if(!_0x4081ba[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x5734f9[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x4081ba[_0x17d3('0x50')][_0x17d3('0x32')]);_0x5734f9[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x4081ba['query'][_0x17d3('0x31')]);}return _0x4a6b1d['getSmsInteractions'](_0x5734f9);}})['then'](function(_0x2949ad){if(_0x2949ad){return _0x2949ad?{'count':_0x5c3e50,'rows':_0x2949ad}:null;}})['then'](respondWithResult(_0xef569f,null))[_0x17d3('0x2c')](handleError(_0xef569f,null));};exports[_0x17d3('0xd5')]=function(_0x3c3ed8,_0x146cba,_0xa43960){var _0x241722={};var _0x50f77f={};var _0x5909ea;var _0x10fac3;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x3c3ed8[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x146cba,null))[_0x17d3('0x22')](function(_0x4f8e45){if(_0x4f8e45){_0x5909ea=_0x4f8e45;_0x50f77f[_0x17d3('0x51')]=_['keys'](db[_0x17d3('0xd6')][_0x17d3('0x4b')]);_0x50f77f[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x3c3ed8[_0x17d3('0x50')]);_0x50f77f[_0x17d3('0x4e')]=_['intersection'](_0x50f77f[_0x17d3('0x51')],_0x50f77f[_0x17d3('0x50')]);_0x241722[_0x17d3('0x53')]=_['intersection'](_0x50f77f['model'],qs[_0x17d3('0x52')](_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x52')]));_0x241722[_0x17d3('0x53')]=_0x241722[_0x17d3('0x53')][_0x17d3('0x54')]?_0x241722[_0x17d3('0x53')]:_0x50f77f[_0x17d3('0x51')];_0x241722['order']=qs[_0x17d3('0x57')](_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x57')]);_0x241722['where']=qs[_0x17d3('0x4e')](_['pick'](_0x3c3ed8[_0x17d3('0x50')],_0x50f77f[_0x17d3('0x4e')]));if(_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x59')]){_0x241722[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x241722[_0x17d3('0x5a')],{'$or':_[_0x17d3('0x41')](_0x241722['attributes'],function(_0x6a9896){var _0xf13191={};_0xf13191[_0x6a9896]={'$like':'%'+_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0xf13191;})});}_0x241722=_[_0x17d3('0x5b')]({},_0x241722,_0x3c3ed8['options']);return _0x5909ea[_0x17d3('0xd5')](_0x241722);}})[_0x17d3('0x22')](function(_0x2a39e5){if(_0x2a39e5){_0x10fac3=_0x2a39e5['length'];if(!_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x241722[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x3c3ed8['query'][_0x17d3('0x32')]);_0x241722[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x3c3ed8['query'][_0x17d3('0x31')]);}return _0x5909ea['getFaxInteractions'](_0x241722);}})[_0x17d3('0x22')](function(_0x23a544){if(_0x23a544){return _0x23a544?{'count':_0x10fac3,'rows':_0x23a544}:null;}})['then'](respondWithResult(_0x146cba,null))['catch'](handleError(_0x146cba,null));};exports['getWhatsappInteractions']=function(_0xaab73e,_0x33c2b2,_0x49be9d){var _0x243e31={};var _0x276561={};var _0x56701a;var _0x24a0f9;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0xaab73e['params']['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x33c2b2,null))[_0x17d3('0x22')](function(_0x491ddb){if(_0x491ddb){_0x56701a=_0x491ddb;_0x276561['model']=_[_0x17d3('0x4d')](db[_0x17d3('0xd7')]['rawAttributes']);_0x276561[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0xaab73e[_0x17d3('0x50')]);_0x276561['filters']=_[_0x17d3('0x4f')](_0x276561[_0x17d3('0x51')],_0x276561['query']);_0x243e31[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x276561['model'],qs[_0x17d3('0x52')](_0xaab73e[_0x17d3('0x50')][_0x17d3('0x52')]));_0x243e31['attributes']=_0x243e31['attributes']['length']?_0x243e31[_0x17d3('0x53')]:_0x276561['model'];_0x243e31[_0x17d3('0xc3')]=qs['sort'](_0xaab73e[_0x17d3('0x50')]['sort']);_0x243e31['where']=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0xaab73e[_0x17d3('0x50')],_0x276561[_0x17d3('0x4e')]));if(_0xaab73e[_0x17d3('0x50')][_0x17d3('0x59')]){_0x243e31[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x243e31[_0x17d3('0x5a')],{'$or':_[_0x17d3('0x41')](_0x243e31[_0x17d3('0x53')],function(_0x4cc806){var _0xae8341={};_0xae8341[_0x4cc806]={'$like':'%'+_0xaab73e[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0xae8341;})});}_0x243e31=_[_0x17d3('0x5b')]({},_0x243e31,_0xaab73e[_0x17d3('0x60')]);return _0x56701a[_0x17d3('0xd8')](_0x243e31);}})['then'](function(_0x16a6b2){if(_0x16a6b2){_0x24a0f9=_0x16a6b2[_0x17d3('0x54')];if(!_0xaab73e[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x243e31[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0xaab73e['query'][_0x17d3('0x32')]);_0x243e31[_0x17d3('0x31')]=qs['offset'](_0xaab73e[_0x17d3('0x50')]['offset']);}return _0x56701a[_0x17d3('0xd8')](_0x243e31);}})[_0x17d3('0x22')](function(_0x3afe7a){if(_0x3afe7a){return _0x3afe7a?{'count':_0x24a0f9,'rows':_0x3afe7a}:null;}})['then'](respondWithResult(_0x33c2b2,null))[_0x17d3('0x2c')](handleError(_0x33c2b2,null));};exports[_0x17d3('0xd9')]=function(_0xeb460f,_0x2173fc,_0x2ce401){var _0x562d08;var _0x1e8e88;var _0xb47249;var _0x456a48=!_[_0x17d3('0x72')](_0xeb460f['params']['id'])?_0xeb460f['params']['id']:!_['isNil'](_0xeb460f[_0x17d3('0x3b')]['id'])?_0xeb460f[_0x17d3('0x3b')]['id']:null;return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x456a48,'role':{'$or':[_0x17d3('0x6d'),_0x17d3('0x3b'),'agent']}},'attributes':['id',_0x17d3('0x45'),_0x17d3('0xda'),'mobile',_0x17d3('0x43'),_0x17d3('0x7a'),_0x17d3('0xa0')]})[_0x17d3('0x22')](function(_0x8ffb32){if(_0x8ffb32){if(_0x8ffb32[_0x17d3('0x43')]===_0x17d3('0x3d')){_0x562d08=_0x8ffb32;if(_0xeb460f[_0x17d3('0x69')][_0x17d3('0xa2')]){_0xb47249=util[_0x17d3('0xaf')](_0x17d3('0xdb'),_0x562d08[_0xeb460f['body']['interface']]);}else if(_0xeb460f[_0x17d3('0x69')][_0x17d3('0xdc')]){_0xb47249=util[_0x17d3('0xaf')](_0x17d3('0xb0'),_0xeb460f[_0x17d3('0x69')][_0x17d3('0xdc')]);}else{_0xb47249=util[_0x17d3('0xaf')]('SIP/%s',_0x562d08[_0x17d3('0x45')]);}socket['to'](util['format'](_0x17d3('0xdd'),_0x562d08['name']))[_0x17d3('0xab')](_0x17d3('0xde'),{'ip':_0xeb460f[_0x17d3('0xdf')][_0x17d3('0xe0')]||_0xeb460f['connection'][_0x17d3('0xe1')]||_0xeb460f['socket'][_0x17d3('0xe1')]||_0xeb460f[_0x17d3('0xe2')][_0x17d3('0xe3')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x17d3('0x38')]({'where':{'membername':_0x562d08[_0x17d3('0x45')]},'individualHooks':!![]});}}else{throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))](_0x17d3('0xe4'));}})[_0x17d3('0x22')](function(){if(_0x562d08){return _0x562d08[_0x17d3('0xe5')]({'raw':!![]});}})['then'](function(_0x3ffbc3){if(_0x562d08){var _0x58ac1e=[];if(_0x3ffbc3){_0x1e8e88=_0x3ffbc3;if(_0x1e8e88['length']){for(var _0x5c2abf=0x0;_0x5c2abf<_0x1e8e88[_0x17d3('0x54')];_0x5c2abf++){_0x58ac1e[_0x17d3('0xae')]({'membername':_0x562d08[_0x17d3('0x45')],'UserId':_0x562d08['id'],'queue_name':_0x1e8e88[_0x5c2abf][_0x17d3('0x45')],'VoiceQueueId':_0x1e8e88[_0x5c2abf]['id'],'interface':_0xb47249,'paused':_0x562d08['loginInPause']||![],'penalty':_0x1e8e88[_0x5c2abf][_0x17d3('0xe6')]||0x0});}return BPromise[_0x17d3('0xb1')](_0x58ac1e,function(_0x31fbad){return db['UserVoiceQueueRt'][_0x17d3('0xe7')](_0x31fbad);});}}}})[_0x17d3('0x22')](function(){if(_0x562d08){return db[_0x17d3('0xe8')][_0x17d3('0x63')]({'where':{'membername':_0x562d08['name'],'exitAt':null}});}})['then'](function(_0x4d119b){if(_0x562d08){var _0xeb1a17=[];_0x4d119b['forEach'](function(_0x58ba6e){_0xeb1a17[_0x17d3('0xae')](_0x58ba6e[_0x17d3('0x37')]({'exitAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9'))}));});return BPromise[_0x17d3('0xea')](_0xeb1a17);}})['then'](function(){if(_0x562d08){var _0x4c7740=[];var _0x4ab00b=[];var _0x5c1277=utils[_0x17d3('0xeb')]();var _0x1ba714={'membername':_0x562d08[_0x17d3('0x45')],'interface':_0xb47249,'enterAt':moment()[_0x17d3('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x562d08[_0x17d3('0x43')],'internal':_0x562d08['internal']};_0x5c1277['forEach'](function(_0x134193){_0x4c7740['push'](_[_0x17d3('0x5b')]({'channel':_0x134193,'type':_0x17d3('0xec'),'data1':_0xeb460f[_0x17d3('0x69')][_0x17d3('0xed')],'data2':_0xb47249},_0x1ba714));if(_0x562d08[_0x17d3('0xa0')]){_0x4ab00b[_0x17d3('0xae')](_[_0x17d3('0x5b')]({'channel':_0x134193,'type':_0x17d3('0xee'),'data1':'LOGININPAUSE'},_0x1ba714));}});return db['MemberReport'][_0x17d3('0x68')](_0x4c7740[_0x17d3('0xef')](_0x4ab00b),{'individualHooks':!![]});}})[_0x17d3('0x22')](function(){if(_0x562d08){return _0x562d08[_0x17d3('0x37')]({'online':!![],'lastLoginAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'voicePause':_0x562d08['loginInPause']||![],'mailPause':_0x562d08[_0x17d3('0xa0')]||![],'chatPause':_0x562d08[_0x17d3('0xa0')]||![],'faxPause':_0x562d08[_0x17d3('0xa0')]||![],'smsPause':_0x562d08[_0x17d3('0xa0')]||![],'openchannelPause':_0x562d08['loginInPause']||![],'whatsappPause':_0x562d08[_0x17d3('0xa0')]||![],'pauseType':_0x562d08[_0x17d3('0xa0')]?'LOGININPAUSE':null,'interface':_0xb47249,'lastPauseAt':moment()['format'](_0x17d3('0xe9'))});}})[_0x17d3('0x22')](function(_0x44cc23){if(_0xeb460f[_0x17d3('0xf0')]){return _0x2ce401();}else{return BPromise['resolve'](_0x44cc23)[_0x17d3('0x22')](respondWithResult(_0x2173fc,null));}})[_0x17d3('0x2c')](handleError(_0x2173fc,null));};exports[_0x17d3('0xf1')]=function(_0x372465,_0x3358ce,_0x3fa8c4){var _0x3a482a;return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x372465[_0x17d3('0x65')]['id'],'role':'agent'},'attributes':['id',_0x17d3('0x45'),_0x17d3('0x43')]})['then'](handleEntityNotFound(_0x3358ce,null))[_0x17d3('0x22')](function(_0x5b7dff){if(_0x5b7dff){_0x3a482a=_0x5b7dff;return db[_0x17d3('0xb8')][_0x17d3('0x38')]({'where':{'membername':_0x3a482a[_0x17d3('0x45')]},'individualHooks':!![]});}})[_0x17d3('0x22')](function(){return db[_0x17d3('0xe8')][_0x17d3('0x63')]({'where':{'membername':_0x3a482a[_0x17d3('0x45')],'exitAt':null}});})[_0x17d3('0x22')](function(_0x560ff6){var _0x2b5253=[];_0x560ff6[_0x17d3('0xf2')](function(_0x5d0e70){_0x2b5253[_0x17d3('0xae')](_0x5d0e70[_0x17d3('0x37')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x17d3('0xea')](_0x2b5253);})[_0x17d3('0x22')](function(){return _0x3a482a[_0x17d3('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x17d3('0x22')](respondWithResult(_0x3358ce,null))[_0x17d3('0x2c')](handleError(_0x3358ce,null));};exports[_0x17d3('0xf3')]=function(_0x5b9b54,_0x5e9ce8,_0x4ae8a0){var _0x294955;return db[_0x17d3('0xb8')][_0x17d3('0x37')]({'paused':0x1},{'where':{'UserId':_0x5b9b54[_0x17d3('0x65')]['id']},'individualHooks':!![]})[_0x17d3('0x22')](function(){return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x5b9b54[_0x17d3('0x65')]['id'],'role':_0x17d3('0x3d')},'attributes':['id',_0x17d3('0x45'),_0x17d3('0x43'),_0x17d3('0x7a'),_0x17d3('0xa2')]});})['then'](handleEntityNotFound(_0x5e9ce8,null))[_0x17d3('0x22')](function(_0x565d3e){if(_0x565d3e){_0x294955=_0x565d3e;return respondWithRpcPromise(_0x17d3('0xf4'),_0x17d3('0xf3'),{'id':_0x294955['id'],'name':_0x294955[_0x17d3('0x45')],'pause':!![]});}})[_0x17d3('0x22')](function(){if(_0x294955){return db[_0x17d3('0xe8')][_0x17d3('0x63')]({'where':{'membername':_0x294955[_0x17d3('0x45')],'type':_0x17d3('0xee'),'exitAt':null}});}})[_0x17d3('0x22')](function(_0x29d72c){if(_0x29d72c[_0x17d3('0x54')]){var _0x2e22ac=moment()[_0x17d3('0xaf')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1a1a75=0x0,_0x2a714a=_0x29d72c['length'];_0x1a1a75<_0x2a714a;_0x1a1a75++){_0x29d72c[_0x1a1a75][_0x17d3('0xf5')]({'exitAt':_0x2e22ac});}}})['then'](function(){var _0x5d8753=[];var _0x1578ac=utils[_0x17d3('0xeb')]();_0x1578ac[_0x17d3('0xf2')](function(_0x437ef1){_0x5d8753[_0x17d3('0xae')]({'channel':_0x437ef1,'membername':_0x294955[_0x17d3('0x45')],'interface':_[_0x17d3('0x72')](_0x294955[_0x17d3('0xa2')])?util[_0x17d3('0xaf')](_0x17d3('0xb0'),_0x294955[_0x17d3('0x45')]):_0x294955[_0x17d3('0xa2')],'type':_0x17d3('0xee'),'enterAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'data1':_0x5b9b54[_0x17d3('0x69')][_0x17d3('0x5c')]||_0x17d3('0xf6'),'role':_0x294955[_0x17d3('0x43')],'internal':_0x294955[_0x17d3('0x7a')]});});return db[_0x17d3('0xe8')][_0x17d3('0x68')](_0x5d8753,{'individualHooks':!![]});})[_0x17d3('0x22')](function(){return _0x294955[_0x17d3('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5b9b54[_0x17d3('0x69')]['type']||_0x17d3('0xf6'),'lastPauseAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9'))});})[_0x17d3('0x22')](respondWithResult(_0x5e9ce8,null))['catch'](handleError(_0x5e9ce8,null));};exports[_0x17d3('0xf7')]=function(_0x4c3420,_0x412e52,_0x572388){var _0xb20911;return db[_0x17d3('0x61')]['find']({'where':{'id':_0x4c3420[_0x17d3('0x65')]['id']},'attributes':['id',_0x17d3('0x45'),'role',_0x17d3('0xa1'),_0x17d3('0xf8'),'chatPause',_0x17d3('0xf9'),_0x17d3('0xfa'),_0x17d3('0xfb'),'whatsapppause','pauseType',_0x17d3('0xfc')]})[_0x17d3('0x22')](handleEntityNotFound(_0x412e52,null))[_0x17d3('0x22')](function(_0x9706f2){if(_0x9706f2){_0xb20911=_0x9706f2;if(_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')]&&!utils['isValidChannel'](_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')])){throw new db['Sequelize'][(_0x17d3('0x9a'))](_0x17d3('0xa4'));}switch(_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')]){case'voice':return respondWithRpcPromise(_0x17d3('0xf4'),_0x17d3('0xf7'),{'id':_0xb20911['id'],'name':_0xb20911['name'],'pause':![]})['then'](function(){return db[_0x17d3('0xb8')][_0x17d3('0x37')]({'paused':0x0},{'where':{'UserId':_0xb20911['id']},'individualHooks':!![]});})[_0x17d3('0x22')](function(){return db[_0x17d3('0xe8')][_0x17d3('0x44')]({'where':{'channel':_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')],'membername':_0xb20911[_0x17d3('0x45')],'type':_0x17d3('0xee'),'exitAt':null}});})['then'](function(_0xce4923){if(_0xce4923){return _0xce4923[_0x17d3('0x37')]({'exitAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'data2':_0x17d3('0xfd')},{'individualHooks':!![]});}return null;})[_0x17d3('0x22')](function(){return _0xb20911['update']({'voicePause':![]});});case _0x17d3('0xfe'):case _0x17d3('0xff'):case _0x17d3('0x100'):case'sms':case _0x17d3('0x101'):case _0x17d3('0x102'):return db[_0x17d3('0xe8')][_0x17d3('0x44')]({'where':{'channel':_0x4c3420['body'][_0x17d3('0xb3')],'membername':_0xb20911[_0x17d3('0x45')],'type':_0x17d3('0xee'),'exitAt':null}})[_0x17d3('0x22')](function(_0x119c5b){if(_0x119c5b){return _0x119c5b[_0x17d3('0x37')]({'exitAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'data2':_0x17d3('0xfd')},{'individualHooks':!![]});}return null;})[_0x17d3('0x22')](function(){var _0x263b8f={};_[_0x17d3('0x103')](_0x263b8f,util[_0x17d3('0xaf')](_0x17d3('0x104'),_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')],_0x17d3('0x105')),![]);return _0xb20911[_0x17d3('0x37')](_0x263b8f);});default:return respondWithRpcPromise(_0x17d3('0xf4'),_0x17d3('0xf7'),{'id':_0xb20911['id'],'name':_0xb20911[_0x17d3('0x45')],'pause':![]})[_0x17d3('0x22')](function(){return db[_0x17d3('0xb8')][_0x17d3('0x37')]({'paused':0x0},{'where':{'UserId':_0xb20911['id']}});})[_0x17d3('0x22')](function(){return db[_0x17d3('0xe8')][_0x17d3('0x63')]({'where':{'membername':_0xb20911[_0x17d3('0x45')],'type':_0x17d3('0xee'),'exitAt':null}});})[_0x17d3('0x22')](function(_0x46c91a){var _0x5ba804=[];_0x46c91a[_0x17d3('0xf2')](function(_0x2678ca){_0x5ba804['push'](_0x2678ca[_0x17d3('0x37')]({'exitAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'data2':_0x17d3('0xfd')}));});return BPromise['all'](_0x5ba804);})[_0x17d3('0x22')](function(){return _0xb20911[_0x17d3('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x412e52,null))[_0x17d3('0x2c')](handleError(_0x412e52,null));};exports[_0x17d3('0x106')]=function(_0x4d7b7b,_0x5ec27e,_0x1b1c5f){var _0x3214a4={};var _0x13ef4e={};var _0x12456a;var _0x3ab9e1;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x4d7b7b[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x5ec27e,null))[_0x17d3('0x22')](function(_0x175f3a){if(_0x175f3a){_0x12456a=_0x175f3a;_0x13ef4e[_0x17d3('0x51')]=_[_0x17d3('0x4d')](db[_0x17d3('0x107')][_0x17d3('0x4b')]);_0x13ef4e[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x4d7b7b[_0x17d3('0x50')]);_0x13ef4e[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x13ef4e[_0x17d3('0x51')],_0x13ef4e[_0x17d3('0x50')]);_0x3214a4[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x13ef4e[_0x17d3('0x51')],qs['fields'](_0x4d7b7b['query'][_0x17d3('0x52')]));_0x3214a4[_0x17d3('0x53')]=_0x3214a4[_0x17d3('0x53')][_0x17d3('0x54')]?_0x3214a4[_0x17d3('0x53')]:_0x13ef4e['model'];_0x3214a4['order']=qs[_0x17d3('0x57')](_0x4d7b7b[_0x17d3('0x50')]['sort']);_0x3214a4['where']=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x4d7b7b['query'],_0x13ef4e[_0x17d3('0x4e')]));if(_0x4d7b7b[_0x17d3('0x50')][_0x17d3('0x59')]){_0x3214a4[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x3214a4[_0x17d3('0x5a')],{'$or':_['map'](_0x3214a4[_0x17d3('0x53')],function(_0x1758cc){var _0x1d9c65={};_0x1d9c65[_0x1758cc]={'$like':'%'+_0x4d7b7b[_0x17d3('0x50')]['filter']+'%'};return _0x1d9c65;})});}_0x3214a4=_[_0x17d3('0x5b')]({},_0x3214a4,_0x4d7b7b[_0x17d3('0x60')]);return _0x12456a[_0x17d3('0x106')](_0x3214a4);}})[_0x17d3('0x22')](function(_0x119d7f){if(_0x119d7f){_0x3ab9e1=_0x119d7f[_0x17d3('0x54')];if(!_0x4d7b7b['query'][_0x17d3('0x55')](_0x17d3('0x56'))){_0x3214a4[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x4d7b7b[_0x17d3('0x50')][_0x17d3('0x32')]);_0x3214a4[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x4d7b7b[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x12456a['getTeams'](_0x3214a4);}})[_0x17d3('0x22')](function(_0x4b8ca8){if(_0x4b8ca8){return _0x4b8ca8?{'count':_0x3ab9e1,'rows':_0x4b8ca8}:null;}})[_0x17d3('0x22')](respondWithResult(_0x5ec27e,null))[_0x17d3('0x2c')](handleError(_0x5ec27e,null));};exports['addTeams']=function(_0x2efa36,_0xbc144e){return db[_0x17d3('0x61')]['find']({'where':{'id':_0x2efa36[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0xbc144e,null))[_0x17d3('0x22')](function(_0x10b0ac){if(_0x10b0ac){var _0x1e2f90=_0x10b0ac[_0x17d3('0x39')]({'plain':!![]});return _0x10b0ac[_0x17d3('0x108')](_0x2efa36[_0x17d3('0x69')]['ids'],_[_0x17d3('0x109')](_0x2efa36[_0x17d3('0x69')],[_0x17d3('0x6c'),'id'])||{})['then'](function(){for(var _0xe892e8=0x0;_0xe892e8<_0x2efa36[_0x17d3('0x69')]['ids'][_0x17d3('0x54')];_0xe892e8++){var _0x42a9a7=[];db['Team'][_0x17d3('0x94')]({'where':{'id':_0x2efa36[_0x17d3('0x69')]['ids'][_0xe892e8]}})[_0x17d3('0x22')](function(_0x2bf6ed){_0x42a9a7['push'](_0x2bf6ed['getVoiceQueues']()[_0x17d3('0x22')](function(_0x5826cd){for(var _0x2e4d00=0x0;_0x2e4d00<_0x5826cd[_0x17d3('0x54')];_0x2e4d00++){_0x5826cd[_0x2e4d00]['setDataValue'](_0x17d3('0xb3'),'Voice');}return _0x5826cd;}));_0x42a9a7[_0x17d3('0xae')](_0x2bf6ed[_0x17d3('0x10a')]()[_0x17d3('0x22')](function(_0x396533){for(var _0x5657d5=0x0;_0x5657d5<_0x396533[_0x17d3('0x54')];_0x5657d5++){_0x396533[_0x5657d5]['setDataValue'](_0x17d3('0xb3'),_0x17d3('0x10b'));}return _0x396533;}));_0x42a9a7[_0x17d3('0xae')](_0x2bf6ed[_0x17d3('0x10c')]()['then'](function(_0x3a0bf3){for(var _0x50ba0d=0x0;_0x50ba0d<_0x3a0bf3[_0x17d3('0x54')];_0x50ba0d++){_0x3a0bf3[_0x50ba0d]['setDataValue']('channel',_0x17d3('0x10d'));}return _0x3a0bf3;}));_0x42a9a7['push'](_0x2bf6ed[_0x17d3('0x10e')]()[_0x17d3('0x22')](function(_0xa45dfe){for(var _0x3aec34=0x0;_0x3aec34<_0xa45dfe['length'];_0x3aec34++){_0xa45dfe[_0x3aec34][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x110'));}return _0xa45dfe;}));_0x42a9a7['push'](_0x2bf6ed[_0x17d3('0x111')]()[_0x17d3('0x22')](function(_0x10c75e){for(var _0x442257=0x0;_0x442257<_0x10c75e[_0x17d3('0x54')];_0x442257++){_0x10c75e[_0x442257][_0x17d3('0x10f')]('channel',_0x17d3('0x112'));}return _0x10c75e;}));_0x42a9a7[_0x17d3('0xae')](_0x2bf6ed['getFaxQueues']()[_0x17d3('0x22')](function(_0x1926eb){for(var _0x42897a=0x0;_0x42897a<_0x1926eb[_0x17d3('0x54')];_0x42897a++){_0x1926eb[_0x42897a][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x113'));}return _0x1926eb;}));_0x42a9a7[_0x17d3('0xae')](_0x2bf6ed[_0x17d3('0x114')]()[_0x17d3('0x22')](function(_0x293df7){for(var _0x4dcb5c=0x0;_0x4dcb5c<_0x293df7[_0x17d3('0x54')];_0x4dcb5c++){_0x293df7[_0x4dcb5c]['setDataValue'](_0x17d3('0xb3'),_0x17d3('0x115'));}return _0x293df7;}));return BPromise['all'](_0x42a9a7);})['then'](function(_0x3794f2){var _0x5aa6bf=_[_0x17d3('0x116')](_0x3794f2);_0x42a9a7=[];return db[_0x17d3('0x5e')]['transaction'](function(_0x351e45){for(var _0x32a750=0x0;_0x32a750<_0x5aa6bf[_0x17d3('0x54')];_0x32a750++){_0x42a9a7['push'](_0x5aa6bf[_0x32a750]['addAgent'](_0x1e2f90['id']),{'transaction':_0x351e45});}return BPromise[_0x17d3('0xea')](_0x42a9a7)[_0x17d3('0x22')](function(){if(_0x1e2f90[_0x17d3('0xad')]){return BPromise[_0x17d3('0xb1')](_[_0x17d3('0x59')](_0x5aa6bf,function(_0x150265){return _0x150265['getDataValue']('channel')===_0x17d3('0x117');}),function(_0x36d4d7){return db[_0x17d3('0xb8')]['upsert']({'membername':_0x1e2f90[_0x17d3('0x45')],'UserId':_0x1e2f90['id'],'queue_name':_0x36d4d7[_0x17d3('0x45')],'VoiceQueueId':_0x36d4d7['id'],'interface':_['isNil'](_0x1e2f90[_0x17d3('0xa2')])?util['format']('SIP/%s',_0x1e2f90[_0x17d3('0x45')]):_0x1e2f90[_0x17d3('0xa2')],'paused':_0x1e2f90['voicePause']||![],'penalty':_0x1e2f90['penalty']},{'transaction':_0x351e45});});}else{return;}})['then'](function(){for(var _0x4557f1=0x0;_0x4557f1<_0x5aa6bf['length'];_0x4557f1++){var _0x48d201=_0x5aa6bf[_0x4557f1]['getDataValue']('channel');var _0x5ecfc4=_0x48d201+'QueueId';socket['emit'](_0x17d3('0x3b')+_0x48d201+_0x17d3('0x118'),{'UserId':_0x1e2f90['id'],['queueField']:_0x5aa6bf[_0x4557f1]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xbc144e,null))[_0x17d3('0x2c')](handleError(_0xbc144e,null));};exports[_0x17d3('0x119')]=function(_0x10525a,_0x24e6d6){return db['User'][_0x17d3('0x94')]({'where':{'id':_0x10525a[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x24e6d6,null))[_0x17d3('0x22')](function(_0x5cc649){if(_0x5cc649){var _0xe86b73=_0x5cc649[_0x17d3('0x39')]({'plain':!![]});var _0x497e71=_0x10525a[_0x17d3('0x50')][_0x17d3('0x6c')];return _0x5cc649['removeTeams'](_0x497e71)[_0x17d3('0x22')](function(){for(var _0x2ff0ab=0x0;_0x2ff0ab<_0x497e71[_0x17d3('0x54')];_0x2ff0ab++){var _0x12bb3b=[];db[_0x17d3('0x107')][_0x17d3('0x94')]({'where':{'id':_0x497e71[_0x2ff0ab]}})[_0x17d3('0x22')](function(_0x264f87){_0x12bb3b['push'](_0x264f87[_0x17d3('0xe5')]()['then'](function(_0x1ec9fc){for(var _0x1d7862=0x0;_0x1d7862<_0x1ec9fc['length'];_0x1d7862++){_0x1ec9fc[_0x1d7862][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x117'));}return _0x1ec9fc;}));_0x12bb3b[_0x17d3('0xae')](_0x264f87['getChatQueues']()[_0x17d3('0x22')](function(_0x2736c0){for(var _0x14d544=0x0;_0x14d544<_0x2736c0[_0x17d3('0x54')];_0x14d544++){_0x2736c0[_0x14d544]['setDataValue']('channel',_0x17d3('0x10b'));}return _0x2736c0;}));_0x12bb3b['push'](_0x264f87[_0x17d3('0x10c')]()['then'](function(_0x22baaa){for(var _0x58a876=0x0;_0x58a876<_0x22baaa[_0x17d3('0x54')];_0x58a876++){_0x22baaa[_0x58a876][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x10d'));}return _0x22baaa;}));_0x12bb3b[_0x17d3('0xae')](_0x264f87[_0x17d3('0x10e')]()['then'](function(_0x5632f0){for(var _0xaf524f=0x0;_0xaf524f<_0x5632f0['length'];_0xaf524f++){_0x5632f0[_0xaf524f][_0x17d3('0x10f')](_0x17d3('0xb3'),'Sms');}return _0x5632f0;}));_0x12bb3b[_0x17d3('0xae')](_0x264f87['getWhatsappQueues']()['then'](function(_0x361fbf){for(var _0x30c720=0x0;_0x30c720<_0x361fbf[_0x17d3('0x54')];_0x30c720++){_0x361fbf[_0x30c720][_0x17d3('0x10f')]('channel','Whatsapp');}return _0x361fbf;}));_0x12bb3b['push'](_0x264f87['getFaxQueues']()['then'](function(_0x44b471){for(var _0x4ea2cd=0x0;_0x4ea2cd<_0x44b471['length'];_0x4ea2cd++){_0x44b471[_0x4ea2cd][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x113'));}return _0x44b471;}));_0x12bb3b['push'](_0x264f87[_0x17d3('0x114')]()[_0x17d3('0x22')](function(_0x749667){for(var _0x35a73b=0x0;_0x35a73b<_0x749667[_0x17d3('0x54')];_0x35a73b++){_0x749667[_0x35a73b][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x115'));}return _0x749667;}));return BPromise[_0x17d3('0xea')](_0x12bb3b);})[_0x17d3('0x22')](function(_0x4dd4ca){var _0x2e94ef=_['flatten'](_0x4dd4ca);_0x12bb3b=[];return db[_0x17d3('0x5e')][_0x17d3('0x11a')](function(_0x399d8f){for(var _0x460b15=0x0;_0x460b15<_0x2e94ef['length'];_0x460b15++){_0x12bb3b[_0x17d3('0xae')](_0x2e94ef[_0x460b15]['removeAgent'](_0xe86b73['id']),{'transaction':_0x399d8f});}return BPromise['all'](_0x12bb3b)[_0x17d3('0x22')](function(){if(_0xe86b73[_0x17d3('0xad')]){return BPromise['each'](_[_0x17d3('0x59')](_0x2e94ef,function(_0x4e1db9){return _0x4e1db9[_0x17d3('0x11b')](_0x17d3('0xb3'))==='Voice';}),function(_0x3bc607){return db[_0x17d3('0xb8')][_0x17d3('0x38')]({'where':{'VoiceQueueId':_0x3bc607['id'],'UserId':_0xe86b73['id']},'transaction':_0x399d8f});});}else{return;}})[_0x17d3('0x22')](function(){for(var _0x582296=0x0;_0x582296<_0x2e94ef['length'];_0x582296++){var _0x520296=_0x2e94ef[_0x582296][_0x17d3('0x11b')](_0x17d3('0xb3'));var _0x3cbbd6=_0x520296+_0x17d3('0xaa');socket[_0x17d3('0xab')](_0x17d3('0x3b')+_0x520296+_0x17d3('0xb6'),{'UserId':_0xe86b73['id'],['queueField']:_0x2e94ef[_0x582296]['id']});}});});});}});}})[_0x17d3('0x22')](respondWithStatusCode(_0x24e6d6,null))[_0x17d3('0x2c')](handleError(_0x24e6d6,null));};exports[_0x17d3('0x11c')]=function(_0x55b7b1,_0x1d5908,_0x38fcf4){var _0x4ca2a9={};var _0x5d0152={};var _0x3f3370;var _0x26562d;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x55b7b1[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x1d5908,null))[_0x17d3('0x22')](function(_0x3befaa){if(_0x3befaa){_0x3f3370=_0x3befaa;_0x5d0152[_0x17d3('0x51')]=_[_0x17d3('0x4d')](db[_0x17d3('0xc4')][_0x17d3('0x4b')]);_0x5d0152[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x55b7b1[_0x17d3('0x50')]);_0x5d0152[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x5d0152[_0x17d3('0x51')],_0x5d0152[_0x17d3('0x50')]);_0x4ca2a9[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x5d0152['model'],qs['fields'](_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x52')]));_0x4ca2a9[_0x17d3('0x53')]=_0x4ca2a9[_0x17d3('0x53')][_0x17d3('0x54')]?_0x4ca2a9[_0x17d3('0x53')]:_0x5d0152[_0x17d3('0x51')];_0x4ca2a9['order']=qs[_0x17d3('0x57')](_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x57')]);_0x4ca2a9[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x55b7b1[_0x17d3('0x50')],_0x5d0152[_0x17d3('0x4e')]));if(_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x59')]){_0x4ca2a9[_0x17d3('0x5a')]=_['merge'](_0x4ca2a9['where'],{'$or':_[_0x17d3('0x41')](_0x4ca2a9['attributes'],function(_0x492cb4){var _0x27e357={};_0x27e357[_0x492cb4]={'$like':'%'+_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x27e357;})});}_0x4ca2a9=_['merge']({},_0x4ca2a9,_0x55b7b1[_0x17d3('0x60')]);return _0x3f3370[_0x17d3('0x11c')](_0x4ca2a9);}})[_0x17d3('0x22')](function(_0x1b2584){if(_0x1b2584){_0x26562d=_0x1b2584[_0x17d3('0x54')];if(!_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x4ca2a9['limit']=qs['limit'](_0x55b7b1[_0x17d3('0x50')]['limit']);_0x4ca2a9['offset']=qs['offset'](_0x55b7b1[_0x17d3('0x50')]['offset']);}return _0x3f3370[_0x17d3('0x11c')](_0x4ca2a9);}})['then'](function(_0x8d8711){if(_0x8d8711){return _0x8d8711?{'count':_0x26562d,'rows':_0x8d8711}:null;}})[_0x17d3('0x22')](respondWithResult(_0x1d5908,null))['catch'](handleError(_0x1d5908,null));};exports[_0x17d3('0x11d')]=function(_0x58ce97,_0x29f0e5,_0x51534d){var _0x2779b5={};var _0x348dcf={};var _0x3488e7;var _0x5c13b3;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x58ce97['params']['id']}})['then'](handleEntityNotFound(_0x29f0e5,null))['then'](function(_0x387564){if(_0x387564){_0x3488e7=_0x387564;_0x348dcf['model']=_['keys'](db[_0x17d3('0x61')][_0x17d3('0x4b')]);_0x348dcf[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x58ce97[_0x17d3('0x50')]);_0x348dcf[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x348dcf[_0x17d3('0x51')],_0x348dcf[_0x17d3('0x50')]);_0x2779b5[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x348dcf[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x58ce97['query'][_0x17d3('0x52')]));_0x2779b5[_0x17d3('0x53')]=_0x2779b5[_0x17d3('0x53')][_0x17d3('0x54')]?_0x2779b5[_0x17d3('0x53')]:_0x348dcf[_0x17d3('0x51')];_0x2779b5[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x58ce97['query'][_0x17d3('0x57')]);_0x2779b5[_0x17d3('0x5a')]=qs['filters'](_[_0x17d3('0x58')](_0x58ce97[_0x17d3('0x50')],_0x348dcf[_0x17d3('0x4e')]));if(_0x58ce97[_0x17d3('0x50')][_0x17d3('0x59')]){_0x2779b5[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x2779b5[_0x17d3('0x5a')],{'$or':_['map'](_0x2779b5[_0x17d3('0x53')],function(_0x34b29d){var _0x6943a4={};_0x6943a4[_0x34b29d]={'$like':'%'+_0x58ce97[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x6943a4;})});}_0x2779b5['model']=db[_0x17d3('0x61')];_0x2779b5['as']=_0x17d3('0x3c');_0x2779b5=_[_0x17d3('0x5b')]({},_0x2779b5,_0x58ce97[_0x17d3('0x60')]);return _0x3488e7[_0x17d3('0xe5')]({'include':[_0x2779b5]});}})['then'](function(_0x2cfbe9){if(_0x2cfbe9){var _0x439fcc={},_0x2d87fe=[],_0x29b171=0x0;for(var _0x118bdc=0x0;_0x118bdc<_0x2cfbe9[_0x17d3('0x54')];_0x118bdc+=0x1){for(var _0x103451=0x0,_0x5410cc;_0x103451<_0x2cfbe9[_0x118bdc]['Agents'][_0x17d3('0x54')];_0x103451+=0x1){_0x5410cc=_0x2cfbe9[_0x118bdc][_0x17d3('0x3c')][_0x103451]['get']({'plain':!![]});_0x439fcc[_0x5410cc['id']]=_0x5410cc;}}_0x439fcc=_[_0x17d3('0x11e')](_0x439fcc);for(var _0x5c4ed3=qs['offset'](_0x58ce97[_0x17d3('0x50')][_0x17d3('0x31')]);_0x5c4ed3<_0x439fcc['length']&&_0x2d87fe[_0x17d3('0x54')]=_0x1f53e4[_0xa133('0x51')]){throw new Error(_0xa133('0x52'));}})[_0xa133('0x10')](function(){if(_0xb50843){return db[_0xa133('0x29')]['destroy']({'where':{'membername':_0xb50843['name']},'individualHooks':!![]});}})[_0xa133('0x10')](function(){if(_0xb50843){return _0xb50843[_0xa133('0x53')]({'raw':!![]});}})['then'](function(_0x363387){if(_0xb50843){if(_0x363387){var _0x46d1b7=[];_0x56237b=_0x363387;if(_0x56237b[_0xa133('0x2c')]){for(var _0x3c3639=0x0;_0x3c3639<_0x56237b['length'];_0x3c3639++){_0x46d1b7['push'](db[_0xa133('0x29')]['upsert']({'membername':_0xb50843[_0xa133('0x26')],'UserId':_0xb50843['id'],'queue_name':_0x56237b[_0x3c3639][_0xa133('0x26')],'VoiceQueueId':_0x56237b[_0x3c3639]['id'],'interface':_0x2ad672,'paused':_0xb50843['loginInPause']||![],'penalty':_0x56237b[_0x3c3639][_0xa133('0x54')]||0x0}));}return BPromise['all'](_0x46d1b7);}}}})[_0xa133('0x10')](function(){if(_0xb50843){return db['MemberReport'][_0xa133('0x46')]({'where':{'membername':_0xb50843['name'],'exitAt':null}});}})[_0xa133('0x10')](function(_0x5718d8){if(_0xb50843){if(_0x5718d8&&_0x5718d8[_0xa133('0x2c')]){var _0x20dd1a=[];_0x5718d8['forEach'](function(_0x339182){_0x20dd1a[_0xa133('0x32')](_0x339182[_0xa133('0x39')]({'exitAt':moment()[_0xa133('0x2d')](_0xa133('0x2e'))}));});return BPromise[_0xa133('0x47')](_0x20dd1a);}}})[_0xa133('0x10')](function(_0x2d4081){if(_0xb50843){var _0x35b6a1=[];var _0x59e9d6=[];var _0x49d1c4=utils[_0xa133('0x30')]();var _0x4ed249={'membername':_0xb50843['name'],'interface':_0x2ad672,'enterAt':moment()[_0xa133('0x2d')](_0xa133('0x2e')),'role':_0xb50843[_0xa133('0x27')],'internal':_0xb50843['internal']};_0x49d1c4[_0xa133('0x31')](function(_0x579ae1){_0x35b6a1[_0xa133('0x32')](_[_0xa133('0x55')]({'channel':_0x579ae1,'type':'LOGIN','data1':_0xa133('0x56'),'data2':_0x2ad672},_0x4ed249));if(_0xb50843['loginInPause']){_0x59e9d6[_0xa133('0x32')](_[_0xa133('0x55')]({'channel':_0x579ae1,'type':_0xa133('0x2b'),'data1':_0xa133('0x57')},_0x4ed249));}});return db[_0xa133('0x2a')][_0xa133('0x38')](_0x35b6a1[_0xa133('0x58')](_0x59e9d6),{'individualHooks':!![]});}})[_0xa133('0x10')](function(){if(_0xb50843){return _0xb50843[_0xa133('0x39')]({'online':!![],'lastLoginAt':moment()[_0xa133('0x2d')](_0xa133('0x2e')),'voicePause':_0xb50843[_0xa133('0x4c')]||![],'mailPause':_0xb50843[_0xa133('0x4c')]||![],'chatPause':_0xb50843[_0xa133('0x4c')]||![],'faxPause':_0xb50843[_0xa133('0x4c')]||![],'smsPause':_0xb50843[_0xa133('0x4c')]||![],'openchannelPause':_0xb50843['loginInPause']||![],'pauseType':_0xb50843[_0xa133('0x4c')]?_0xa133('0x57'):null,'lastPauseAt':moment()[_0xa133('0x2d')](_0xa133('0x2e')),'interface':_0x2ad672});}})['then'](function(_0x2d9681){_0x46015a(_0x2d9681);})[_0xa133('0x19')](function(_0x1e0121){_0x255454(_0x13e835['error'](0x1f4,_0x1e0121[_0xa133('0x17')]));});});}; \ No newline at end of file +var _0x9005=['map','then','catch','ShowUser','find','name','role','internal','interface','UserVoiceQueueRt','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','update','UnpauseUser','findOne','channel','Unknown\x20channel','voice','system','mail','fax','sms','openchannel','set','%s%s','Pause','push','all','LogoutUser','length','LoginUser','mobile','count','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','UserVoiceQueue.penalty','merge','LOGIN','callysquare','loginInPause','LOGININPAUSE','concat','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./user.socket','register','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetUser','User','findAll','options','raw','where','limit','include','model','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9005,0x142));var _0x5900=function(_0x49fa6e,_0x2e53e8){_0x49fa6e=_0x49fa6e-0x0;var _0x447f5b=_0x9005[_0x49fa6e];return _0x447f5b;};'use strict';var _=require(_0x5900('0x0'));var util=require('util');var moment=require(_0x5900('0x1'));var BPromise=require(_0x5900('0x2'));var rs=require(_0x5900('0x3'));var fs=require('fs');var Redis=require(_0x5900('0x4'));var db=require(_0x5900('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5900('0x6'))('rpc');var config=require(_0x5900('0x7'));var jayson=require(_0x5900('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x5900('0x9')](config['redis'],{'host':_0x5900('0xa'),'port':0x18eb});var socket=require(_0x5900('0xb'))(new Redis(config['redis']));require(_0x5900('0xc'))[_0x5900('0xd')](socket);function respondWithRpcPromise(_0x21b738,_0x539d54,_0x53ec9c){return new BPromise(function(_0x1d5630,_0x41c960){return client['request'](_0x21b738,_0x53ec9c)['then'](function(_0x1eb8ba){logger[_0x5900('0xe')](_0x5900('0xf'),_0x539d54,_0x5900('0x10'));logger[_0x5900('0x11')](_0x5900('0x12'),_0x539d54,_0x5900('0x10'),JSON[_0x5900('0x13')](_0x1eb8ba));if(_0x1eb8ba[_0x5900('0x14')]){if(_0x1eb8ba[_0x5900('0x14')][_0x5900('0x15')]===0x1f4){logger[_0x5900('0x14')](_0x5900('0xf'),_0x539d54,_0x1eb8ba['error']['message']);return _0x41c960(_0x1eb8ba[_0x5900('0x14')][_0x5900('0x16')]);}logger['error'](_0x5900('0xf'),_0x539d54,_0x1eb8ba[_0x5900('0x14')][_0x5900('0x16')]);return _0x1d5630(_0x1eb8ba[_0x5900('0x14')][_0x5900('0x16')]);}else{logger[_0x5900('0xe')](_0x5900('0xf'),_0x539d54,'request\x20sent');_0x1d5630(_0x1eb8ba[_0x5900('0x17')][_0x5900('0x16')]);}})['catch'](function(_0x3e3fe5){logger[_0x5900('0x14')](_0x5900('0xf'),_0x539d54,_0x3e3fe5);_0x41c960(_0x3e3fe5);});});}exports[_0x5900('0x18')]=function(_0x25392e){var _0x11a6d3=this;return new Promise(function(_0x42b869,_0x22c549){return db[_0x5900('0x19')][_0x5900('0x1a')]({'raw':_0x25392e[_0x5900('0x1b')]?_0x25392e['options'][_0x5900('0x1c')]===undefined?!![]:![]:!![],'where':_0x25392e['options']?_0x25392e[_0x5900('0x1b')][_0x5900('0x1d')]||null:null,'attributes':_0x25392e['options']?_0x25392e[_0x5900('0x1b')]['attributes']||null:null,'limit':_0x25392e[_0x5900('0x1b')]?_0x25392e[_0x5900('0x1b')][_0x5900('0x1e')]||null:null,'include':_0x25392e[_0x5900('0x1b')]?_0x25392e['options'][_0x5900('0x1f')]?_['map'](_0x25392e[_0x5900('0x1b')][_0x5900('0x1f')],function(_0x14f49e){return{'model':db[_0x14f49e[_0x5900('0x20')]],'as':_0x14f49e['as'],'attributes':_0x14f49e[_0x5900('0x21')],'include':_0x14f49e[_0x5900('0x1f')]?_[_0x5900('0x22')](_0x14f49e[_0x5900('0x1f')],function(_0x55e2c3){return{'model':db[_0x55e2c3[_0x5900('0x20')]],'as':_0x55e2c3['as'],'attributes':_0x55e2c3[_0x5900('0x21')],'include':_0x55e2c3[_0x5900('0x1f')]?_[_0x5900('0x22')](_0x55e2c3[_0x5900('0x1f')],function(_0xe203e5){return{'model':db[_0xe203e5[_0x5900('0x20')]],'as':_0xe203e5['as'],'attributes':_0xe203e5[_0x5900('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5900('0x23')](function(_0x5aa01c){logger[_0x5900('0xe')](_0x5900('0x18'),_0x25392e);logger[_0x5900('0x11')]('GetUser',_0x25392e,JSON['stringify'](_0x5aa01c));_0x42b869(_0x5aa01c);})[_0x5900('0x24')](function(_0x1dc957){logger['error']('GetUser',_0x1dc957['message'],_0x25392e);_0x22c549(_0x11a6d3[_0x5900('0x14')](0x1f4,_0x1dc957['message']));});});};exports[_0x5900('0x25')]=function(_0x3d41d7){var _0x325bf2=this;return new Promise(function(_0x4ab0b1,_0x53d53a){return db[_0x5900('0x19')][_0x5900('0x26')]({'raw':_0x3d41d7[_0x5900('0x1b')]?_0x3d41d7['options'][_0x5900('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d41d7['options']?_0x3d41d7[_0x5900('0x1b')][_0x5900('0x1d')]||null:null,'attributes':_0x3d41d7[_0x5900('0x1b')]?_0x3d41d7[_0x5900('0x1b')][_0x5900('0x21')]||null:null,'include':_0x3d41d7['options']?_0x3d41d7[_0x5900('0x1b')][_0x5900('0x1f')]?_[_0x5900('0x22')](_0x3d41d7[_0x5900('0x1b')][_0x5900('0x1f')],function(_0x1292a7){return{'model':db[_0x1292a7[_0x5900('0x20')]],'as':_0x1292a7['as'],'attributes':_0x1292a7[_0x5900('0x21')],'include':_0x1292a7[_0x5900('0x1f')]?_[_0x5900('0x22')](_0x1292a7[_0x5900('0x1f')],function(_0x5aeac9){return{'model':db[_0x5aeac9[_0x5900('0x20')]],'as':_0x5aeac9['as'],'attributes':_0x5aeac9[_0x5900('0x21')],'include':_0x5aeac9[_0x5900('0x1f')]?_[_0x5900('0x22')](_0x5aeac9[_0x5900('0x1f')],function(_0x314b3d){return{'model':db[_0x314b3d[_0x5900('0x20')]],'as':_0x314b3d['as'],'attributes':_0x314b3d[_0x5900('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5900('0x23')](function(_0x30e262){logger[_0x5900('0xe')](_0x5900('0x25'),_0x3d41d7);logger[_0x5900('0x11')](_0x5900('0x25'),_0x3d41d7,JSON[_0x5900('0x13')](_0x30e262));_0x4ab0b1(_0x30e262);})[_0x5900('0x24')](function(_0x50db32){logger['error'](_0x5900('0x25'),_0x50db32[_0x5900('0x16')],_0x3d41d7);_0x53d53a(_0x325bf2[_0x5900('0x14')](0x1f4,_0x50db32['message']));});});};exports['PauseUser']=function(_0x14bef2){var _0x27e150=this;return new Promise(function(_0x6a04d0,_0x3057fb){var _0x4efb89;return db['User'][_0x5900('0x26')]({'where':_0x14bef2[_0x5900('0x1b')][_0x5900('0x1d')]||{},'attributes':['id',_0x5900('0x27'),_0x5900('0x28'),_0x5900('0x29'),_0x5900('0x2a')]})[_0x5900('0x23')](function(_0x41c74e){if(_0x41c74e){_0x4efb89=_0x41c74e;return db[_0x5900('0x2b')]['update']({'paused':0x1},{'where':{'UserId':_0x4efb89['id']},'individualHooks':!![]});}})[_0x5900('0x23')](function(){if(_0x4efb89){return db[_0x5900('0x2c')]['findAll']({'where':{'membername':_0x4efb89[_0x5900('0x27')],'type':_0x5900('0x2d'),'exitAt':null}});}})[_0x5900('0x23')](function(_0x533fa8){if(_0x4efb89){if(_0x533fa8&&_0x533fa8['length']){var _0x3536c4=moment()[_0x5900('0x2e')](_0x5900('0x2f'));for(var _0x30f122=0x0,_0x1369d4=_0x533fa8['length'];_0x30f122<_0x1369d4;_0x30f122++){_0x533fa8[_0x30f122][_0x5900('0x30')]({'exitAt':_0x3536c4});}}}})['then'](function(){if(_0x4efb89){var _0x37ca0a=[];var _0x13d8a2=utils[_0x5900('0x31')]();_0x13d8a2[_0x5900('0x32')](function(_0x3a7114){_0x37ca0a['push']({'channel':_0x3a7114,'membername':_0x4efb89[_0x5900('0x27')],'interface':_[_0x5900('0x33')](_0x4efb89[_0x5900('0x2a')])?util['format'](_0x5900('0x34'),_0x4efb89['name']):_0x4efb89[_0x5900('0x2a')],'type':_0x5900('0x2d'),'enterAt':moment()[_0x5900('0x2e')](_0x5900('0x2f')),'data1':_0x14bef2[_0x5900('0x35')][_0x5900('0x36')]||_0x5900('0x37'),'role':_0x4efb89[_0x5900('0x28')],'internal':_0x4efb89[_0x5900('0x29')],'uniqueid':_0x14bef2[_0x5900('0x35')][_0x5900('0x38')]||null});});return db[_0x5900('0x2c')][_0x5900('0x39')](_0x37ca0a,{'individualHooks':!![]});}})[_0x5900('0x23')](function(){if(_0x4efb89){return _0x4efb89[_0x5900('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x14bef2[_0x5900('0x35')][_0x5900('0x36')]||_0x5900('0x37'),'lastPauseAt':moment()[_0x5900('0x2e')](_0x5900('0x2f'))});}})[_0x5900('0x23')](function(_0x328a79){_0x6a04d0(_0x328a79);})['catch'](function(_0x8d28b8){_0x3057fb(_0x27e150[_0x5900('0x14')](0x1f4,_0x8d28b8[_0x5900('0x16')]));});});};exports[_0x5900('0x3b')]=function(_0x158421){var _0x1c5476=this;return new Promise(function(_0x30f77c,_0x218a97){var _0x54de12;return db[_0x5900('0x19')][_0x5900('0x3c')]({'where':_0x158421[_0x5900('0x1b')][_0x5900('0x1d')]||{},'attributes':['id',_0x5900('0x27')]})[_0x5900('0x23')](function(_0x1e3ddb){if(_0x1e3ddb){_0x54de12=_0x1e3ddb;if(_0x158421['body'][_0x5900('0x3d')]&&!utils['isValidChannel'](_0x158421[_0x5900('0x35')][_0x5900('0x3d')])){throw new Error(_0x5900('0x3e'));}switch(_0x158421['body']['channel']){case _0x5900('0x3f'):return db[_0x5900('0x2b')][_0x5900('0x3a')]({'paused':0x0},{'where':{'UserId':_0x54de12['id']}})[_0x5900('0x23')](function(){return db['MemberReport'][_0x5900('0x26')]({'where':{'channel':_0x158421[_0x5900('0x35')][_0x5900('0x3d')],'membername':_0x54de12[_0x5900('0x27')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x335ff2){if(_0x335ff2){return _0x335ff2[_0x5900('0x3a')]({'exitAt':moment()[_0x5900('0x2e')](_0x5900('0x2f')),'data2':_0x5900('0x40')},{'individualHooks':!![]});}return null;})[_0x5900('0x23')](function(){return _0x54de12[_0x5900('0x3a')]({'voicePause':![]});});case _0x5900('0x41'):case'chat':case _0x5900('0x42'):case _0x5900('0x43'):case _0x5900('0x44'):return db[_0x5900('0x2c')][_0x5900('0x26')]({'where':{'channel':_0x158421[_0x5900('0x35')][_0x5900('0x3d')],'membername':_0x54de12[_0x5900('0x27')],'type':_0x5900('0x2d'),'exitAt':null}})[_0x5900('0x23')](function(_0x47bf16){return _0x47bf16['update']({'exitAt':moment()[_0x5900('0x2e')](_0x5900('0x2f')),'data2':_0x5900('0x40')},{'individualHooks':!![]});})['then'](function(){var _0x490762={};_[_0x5900('0x45')](_0x490762,util[_0x5900('0x2e')](_0x5900('0x46'),_0x158421[_0x5900('0x35')][_0x5900('0x3d')],_0x5900('0x47')),![]);return _0x54de12[_0x5900('0x3a')](_0x490762);});default:return db[_0x5900('0x2b')]['update']({'paused':0x0},{'where':{'UserId':_0x54de12['id']}})[_0x5900('0x23')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x54de12['name'],'type':_0x5900('0x2d'),'exitAt':null}});})['then'](function(_0xea049b){var _0x28919f=[];_0xea049b[_0x5900('0x32')](function(_0x395697){_0x28919f[_0x5900('0x48')](_0x395697[_0x5900('0x3a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x5900('0x40')}));});return BPromise[_0x5900('0x49')](_0x28919f);})[_0x5900('0x23')](function(){return _0x54de12[_0x5900('0x3a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x5900('0x23')](function(_0x4867ec){_0x30f77c(_0x4867ec);})[_0x5900('0x24')](function(_0x44348b){_0x218a97(_0x1c5476[_0x5900('0x14')](0x1f4,_0x44348b[_0x5900('0x16')]));});});};exports[_0x5900('0x4a')]=function(_0xf2c698){var _0x8b7e1e=this;return new Promise(function(_0x3cc1ab,_0x500156){var _0x2fd227;return db[_0x5900('0x19')][_0x5900('0x3c')]({'where':_0xf2c698['options'][_0x5900('0x1d')]||{},'attributes':['id',_0x5900('0x27')]})['then'](function(_0x409109){if(_0x409109){_0x2fd227=_0x409109;return db[_0x5900('0x2b')]['destroy']({'where':{'membername':_0x2fd227['name']},'individualHooks':!![]});}})[_0x5900('0x23')](function(){if(_0x2fd227){return db[_0x5900('0x2c')][_0x5900('0x1a')]({'where':{'membername':_0x2fd227[_0x5900('0x27')],'exitAt':null}});}})[_0x5900('0x23')](function(_0x18ba70){if(_0x2fd227){if(_0x18ba70&&_0x18ba70[_0x5900('0x4b')]){var _0x2ddd3d=[];_0x18ba70['forEach'](function(_0x435feb){_0x2ddd3d[_0x5900('0x48')](_0x435feb[_0x5900('0x3a')]({'exitAt':moment()[_0x5900('0x2e')](_0x5900('0x2f'))}));});return BPromise['all'](_0x2ddd3d);}}})[_0x5900('0x23')](function(){if(_0x2fd227){return _0x2fd227[_0x5900('0x3a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x5900('0x23')](function(_0x2ed2e8){_0x3cc1ab(_0x2ed2e8);})[_0x5900('0x24')](function(_0x4465c6){_0x500156(_0x8b7e1e[_0x5900('0x14')](0x1f4,_0x4465c6[_0x5900('0x16')]));});});};exports[_0x5900('0x4c')]=function(_0x324743){var _0x551e74=this;return new Promise(function(_0x2adf2d,_0x565d1f){var _0x5a8f0b;var _0x5c797f;var _0x2d93ff;var _0x23f1f4;return db[_0x5900('0x19')]['findOne']({'where':_0x324743[_0x5900('0x1b')]['where']||{},'attributes':['id',_0x5900('0x27'),_0x5900('0x28'),_0x5900('0x4d'),'phone',_0x5900('0x29'),'loginInPause',_0x5900('0x2a')]})[_0x5900('0x23')](function(_0x3bc381){if(_0x3bc381){_0x5a8f0b=_0x3bc381;_0x23f1f4=_0x324743[_0x5900('0x35')][_0x5900('0x2a')]?_0x324743['body'][_0x5900('0x2a')]:util[_0x5900('0x2e')](_0x5900('0x34'),_0x5a8f0b[_0x5900('0x27')]);return db['User'][_0x5900('0x4e')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x5a8f0b['id']}}});}})[_0x5900('0x23')](function(_0x13a5b8){if(_0x13a5b8){_0x2d93ff=_0x13a5b8;return require('../../config/license/util')['getLicense']();}})[_0x5900('0x23')](function(_0x574ca8){if(_0x574ca8&&_0x574ca8[_0x5900('0x4f')]&&_0x2d93ff>=_0x574ca8[_0x5900('0x4f')]){throw new Error(_0x5900('0x50'));}})['then'](function(){if(_0x5a8f0b){return db[_0x5900('0x2b')][_0x5900('0x51')]({'where':{'membername':_0x5a8f0b[_0x5900('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x5a8f0b){return _0x5a8f0b['getVoiceQueues']({'raw':!![]});}})[_0x5900('0x23')](function(_0x48ccc4){if(_0x5a8f0b){if(_0x48ccc4){var _0x404571=[];_0x5c797f=_0x48ccc4;if(_0x5c797f[_0x5900('0x4b')]){for(var _0x4e9dc4=0x0;_0x4e9dc4<_0x5c797f[_0x5900('0x4b')];_0x4e9dc4++){_0x404571[_0x5900('0x48')](db[_0x5900('0x2b')]['upsert']({'membername':_0x5a8f0b[_0x5900('0x27')],'UserId':_0x5a8f0b['id'],'queue_name':_0x5c797f[_0x4e9dc4]['name'],'VoiceQueueId':_0x5c797f[_0x4e9dc4]['id'],'interface':_0x23f1f4,'paused':_0x5a8f0b['loginInPause']||![],'penalty':_0x5c797f[_0x4e9dc4][_0x5900('0x52')]||0x0}));}return BPromise[_0x5900('0x49')](_0x404571);}}}})[_0x5900('0x23')](function(){if(_0x5a8f0b){return db[_0x5900('0x2c')][_0x5900('0x1a')]({'where':{'membername':_0x5a8f0b[_0x5900('0x27')],'exitAt':null}});}})[_0x5900('0x23')](function(_0x5283aa){if(_0x5a8f0b){if(_0x5283aa&&_0x5283aa[_0x5900('0x4b')]){var _0x43ece7=[];_0x5283aa['forEach'](function(_0x52cbb8){_0x43ece7[_0x5900('0x48')](_0x52cbb8[_0x5900('0x3a')]({'exitAt':moment()['format'](_0x5900('0x2f'))}));});return BPromise['all'](_0x43ece7);}}})[_0x5900('0x23')](function(_0xb64cd4){if(_0x5a8f0b){var _0x53a566=[];var _0x155f82=[];var _0x558cec=utils[_0x5900('0x31')]();var _0x1e9bf4={'membername':_0x5a8f0b[_0x5900('0x27')],'interface':_0x23f1f4,'enterAt':moment()['format'](_0x5900('0x2f')),'role':_0x5a8f0b[_0x5900('0x28')],'internal':_0x5a8f0b['internal']};_0x558cec[_0x5900('0x32')](function(_0x137855){_0x53a566[_0x5900('0x48')](_[_0x5900('0x53')]({'channel':_0x137855,'type':_0x5900('0x54'),'data1':_0x5900('0x55'),'data2':_0x23f1f4},_0x1e9bf4));if(_0x5a8f0b[_0x5900('0x56')]){_0x155f82[_0x5900('0x48')](_[_0x5900('0x53')]({'channel':_0x137855,'type':_0x5900('0x2d'),'data1':_0x5900('0x57')},_0x1e9bf4));}});return db[_0x5900('0x2c')][_0x5900('0x39')](_0x53a566[_0x5900('0x58')](_0x155f82),{'individualHooks':!![]});}})['then'](function(){if(_0x5a8f0b){return _0x5a8f0b[_0x5900('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x5900('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5a8f0b[_0x5900('0x56')]||![],'mailPause':_0x5a8f0b[_0x5900('0x56')]||![],'chatPause':_0x5a8f0b[_0x5900('0x56')]||![],'faxPause':_0x5a8f0b[_0x5900('0x56')]||![],'smsPause':_0x5a8f0b[_0x5900('0x56')]||![],'openchannelPause':_0x5a8f0b[_0x5900('0x56')]||![],'pauseType':_0x5a8f0b[_0x5900('0x56')]?_0x5900('0x57'):null,'lastPauseAt':moment()[_0x5900('0x2e')](_0x5900('0x2f')),'interface':_0x23f1f4});}})[_0x5900('0x23')](function(_0x326f9f){_0x2adf2d(_0x326f9f);})[_0x5900('0x24')](function(_0x222c4d){_0x565d1f(_0x551e74[_0x5900('0x14')](0x1f4,_0x222c4d[_0x5900('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 4f9b58d..d1efe12 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 _0xd772=['emit','length','./user.events','save'];(function(_0x2778bb,_0x26e882){var _0x316daa=function(_0x26f317){while(--_0x26f317){_0x2778bb['push'](_0x2778bb['shift']());}};_0x316daa(++_0x26e882);}(_0xd772,0x1b6));var _0x2d77=function(_0x555f56,_0x334d65){_0x555f56=_0x555f56-0x0;var _0x56db9a=_0xd772[_0x555f56];return _0x56db9a;};'use strict';var UserEvents=require(_0x2d77('0x0'));var events=[_0x2d77('0x1'),'remove','update'];function createListener(_0x33ec65,_0x4cf839){return function(_0x54285f){_0x4cf839[_0x2d77('0x2')](_0x33ec65,_0x54285f);};}function removeListener(_0x127b2d,_0x2ec8b7){return function(){UserEvents['removeListener'](_0x127b2d,_0x2ec8b7);};}exports['register']=function(_0x209b72){for(var _0x59820e=0x0,_0xdbb4fd=events[_0x2d77('0x3')];_0x59820e<_0xdbb4fd;_0x59820e++){var _0x3b0071=events[_0x59820e];var _0x3cacee=createListener('user:'+_0x3b0071,_0x209b72);UserEvents['on'](_0x3b0071,_0x3cacee);}}; \ No newline at end of file +var _0xcb29=['user:','./user.events','save','remove','update','emit','removeListener','register'];(function(_0x2706bb,_0x148079){var _0xef24d2=function(_0x58bab8){while(--_0x58bab8){_0x2706bb['push'](_0x2706bb['shift']());}};_0xef24d2(++_0x148079);}(_0xcb29,0xa9));var _0x9cb2=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xcb29[_0x39c734];return _0xb2a2f9;};'use strict';var UserEvents=require(_0x9cb2('0x0'));var events=[_0x9cb2('0x1'),_0x9cb2('0x2'),_0x9cb2('0x3')];function createListener(_0x23d86a,_0x3730f3){return function(_0x49e910){_0x3730f3[_0x9cb2('0x4')](_0x23d86a,_0x49e910);};}function removeListener(_0x2bcff0,_0x594749){return function(){UserEvents[_0x9cb2('0x5')](_0x2bcff0,_0x594749);};}exports[_0x9cb2('0x6')]=function(_0x2fff7b){for(var _0x44352b=0x0,_0x149139=events['length'];_0x44352b<_0x149139;_0x44352b++){var _0x57a0d4=events[_0x44352b];var _0x23b5ac=createListener(_0x9cb2('0x7')+_0x57a0d4,_0x2fff7b);UserEvents['on'](_0x57a0d4,_0x23b5ac);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b7b2959..83dbe45 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 _0x6b86=['path','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0x6b86,0x199));var _0x66b8=function(_0x22f9e6,_0x55e049){_0x22f9e6=_0x22f9e6-0x0;var _0xb47c38=_0x6b86[_0x22f9e6];return _0xb47c38;};'use strict';var multer=require(_0x66b8('0x0'));var util=require('util');var path=require(_0x66b8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x66b8('0x2'));var config=require(_0x66b8('0x3'));module[_0x66b8('0x4')]=router; \ No newline at end of file +var _0xc11d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0x814988,_0x49cc27){var _0x336703=function(_0x15272c){while(--_0x15272c){_0x814988['push'](_0x814988['shift']());}};_0x336703(++_0x49cc27);}(_0xc11d,0x163));var _0xdc11=function(_0x5e0544,_0x4c7fa5){_0x5e0544=_0x5e0544-0x0;var _0xf1bb8a=_0xc11d[_0x5e0544];return _0xf1bb8a;};'use strict';var multer=require(_0xdc11('0x0'));var util=require(_0xdc11('0x1'));var path=require(_0xdc11('0x2'));var timeout=require(_0xdc11('0x3'));var express=require(_0xdc11('0x4'));var router=express[_0xdc11('0x5')]();var auth=require(_0xdc11('0x6'));var interaction=require(_0xdc11('0x7'));var config=require(_0xdc11('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 859f3fc..53a8cc7 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(_0xca0aae,_0x73d195){var _0x52bf57=function(_0x2aa299){while(--_0x2aa299){_0xca0aae['push'](_0xca0aae['shift']());}};_0x52bf57(++_0x73d195);}(_0xe706,0xa3));var _0x6e70=function(_0x10b4d3,_0x12e69b){_0x10b4d3=_0x10b4d3-0x0;var _0x12615b=_0xe706[_0x10b4d3];return _0x12615b;};'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(_0x4b1945,_0x48a2bb){var _0x996004=function(_0xaf6276){while(--_0xaf6276){_0x4b1945['push'](_0x4b1945['shift']());}};_0x996004(++_0x48a2bb);}(_0xe706,0xa3));var _0x6e70=function(_0x57746e,_0x45093f){_0x57746e=_0x57746e-0x0;var _0x5caeaa=_0xe706[_0x57746e];return _0x5caeaa;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 2d86872..35ad69b 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 _0x4d76=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userChatQueue.attributes','define'];(function(_0x49e61c,_0xba133c){var _0x2d4d06=function(_0x514908){while(--_0x514908){_0x49e61c['push'](_0x49e61c['shift']());}};_0x2d4d06(++_0xba133c);}(_0x4d76,0xc2));var _0x64d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x64d7('0x0'));var util=require(_0x64d7('0x1'));var logger=require(_0x64d7('0x2'))(_0x64d7('0x3'));var moment=require(_0x64d7('0x4'));var BPromise=require(_0x64d7('0x5'));var rp=require(_0x64d7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x64d7('0x7'));var attributes=require(_0x64d7('0x8'));module['exports']=function(_0x57f99f,_0x366b4c){return _0x57f99f[_0x64d7('0x9')](_0x64d7('0xa'),attributes,{'tableName':_0x64d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe08b=['path','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe08b,0xb0));var _0xbe08=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xe08b[_0x295314];return _0x584b0c;};'use strict';var _=require(_0xbe08('0x0'));var util=require(_0xbe08('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbe08('0x2'));var rp=require(_0xbe08('0x3'));var fs=require('fs');var path=require(_0xbe08('0x4'));var rimraf=require(_0xbe08('0x5'));var config=require('../../config/environment');var attributes=require(_0xbe08('0x6'));module['exports']=function(_0x3ae9d7,_0x50aeba){return _0x3ae9d7[_0xbe08('0x7')](_0xbe08('0x8'),attributes,{'tableName':_0xbe08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index c2765b6..10195ce 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 _0xd923=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x214183,_0xa5dbb5){var _0x1712d8=function(_0x215a1f){while(--_0x215a1f){_0x214183['push'](_0x214183['shift']());}};_0x1712d8(++_0xa5dbb5);}(_0xd923,0x72));var _0x3d92=function(_0x1bf18c,_0x25439f){_0x1bf18c=_0x1bf18c-0x0;var _0xe819c3=_0xd923[_0x1bf18c];return _0xe819c3;};'use strict';var _=require('lodash');var util=require(_0x3d92('0x0'));var moment=require('moment');var BPromise=require(_0x3d92('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d92('0x2'));var db=require(_0x3d92('0x3'))['db'];var utils=require(_0x3d92('0x4'));var logger=require('../../config/logger')(_0x3d92('0x5'));var config=require(_0x3d92('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3d92('0x7')][_0x3d92('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ebd6b,_0x10ec2c,_0x4effd7){return new BPromise(function(_0x4b6a13,_0x1ebe15){return client[_0x3d92('0x9')](_0x1ebd6b,_0x4effd7)[_0x3d92('0xa')](function(_0x5564e3){logger[_0x3d92('0xb')](_0x3d92('0xc'),_0x10ec2c,_0x3d92('0xd'));logger[_0x3d92('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x10ec2c,_0x3d92('0xd'),JSON['stringify'](_0x5564e3));if(_0x5564e3[_0x3d92('0xf')]){if(_0x5564e3[_0x3d92('0xf')]['code']===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x10ec2c,_0x5564e3[_0x3d92('0xf')][_0x3d92('0x10')]);return _0x1ebe15(_0x5564e3[_0x3d92('0xf')][_0x3d92('0x10')]);}logger[_0x3d92('0xf')](_0x3d92('0xc'),_0x10ec2c,_0x5564e3[_0x3d92('0xf')][_0x3d92('0x10')]);return _0x4b6a13(_0x5564e3[_0x3d92('0xf')]['message']);}else{logger[_0x3d92('0xb')](_0x3d92('0xc'),_0x10ec2c,_0x3d92('0xd'));_0x4b6a13(_0x5564e3['result']['message']);}})[_0x3d92('0x11')](function(_0x3a39d5){logger['error'](_0x3d92('0xc'),_0x10ec2c,_0x3a39d5);_0x1ebe15(_0x3a39d5);});});} \ No newline at end of file +var _0x964f=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x3319f8,_0x3bb8db){var _0x3d4fe7=function(_0x3e2b32){while(--_0x3e2b32){_0x3319f8['push'](_0x3319f8['shift']());}};_0x3d4fe7(++_0x3bb8db);}(_0x964f,0x156));var _0xf964=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x964f[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xf964('0x0'));var moment=require(_0xf964('0x1'));var BPromise=require(_0xf964('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf964('0x3'));var db=require(_0xf964('0x4'))['db'];var utils=require(_0xf964('0x5'));var logger=require('../../config/logger')(_0xf964('0x6'));var config=require(_0xf964('0x7'));var jayson=require(_0xf964('0x8'));var client=jayson[_0xf964('0x9')][_0xf964('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e334,_0x29ac9b,_0x4cee06){return new BPromise(function(_0x1b1106,_0x3ce526){return client[_0xf964('0xb')](_0x32e334,_0x4cee06)[_0xf964('0xc')](function(_0x247a5e){logger['info'](_0xf964('0xd'),_0x29ac9b,_0xf964('0xe'));logger[_0xf964('0xf')](_0xf964('0x10'),_0x29ac9b,_0xf964('0xe'),JSON['stringify'](_0x247a5e));if(_0x247a5e[_0xf964('0x11')]){if(_0x247a5e[_0xf964('0x11')][_0xf964('0x12')]===0x1f4){logger[_0xf964('0x11')](_0xf964('0xd'),_0x29ac9b,_0x247a5e['error']['message']);return _0x3ce526(_0x247a5e['error']['message']);}logger[_0xf964('0x11')](_0xf964('0xd'),_0x29ac9b,_0x247a5e[_0xf964('0x11')]['message']);return _0x1b1106(_0x247a5e[_0xf964('0x11')][_0xf964('0x13')]);}else{logger[_0xf964('0x14')](_0xf964('0xd'),_0x29ac9b,_0xf964('0xe'));_0x1b1106(_0x247a5e[_0xf964('0x15')]['message']);}})[_0xf964('0x16')](function(_0x531fbe){logger[_0xf964('0x11')](_0xf964('0xd'),_0x29ac9b,_0x531fbe);_0x3ce526(_0x531fbe);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 0298881..a750785 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 _0xecc0=['Router','../../components/auth/service','../../components/interaction/service','exports','util','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecc0,0x97));var _0x0ecc=function(_0x159922,_0x16f6da){_0x159922=_0x159922-0x0;var _0x2ed37c=_0xecc0[_0x159922];return _0x2ed37c;};'use strict';var multer=require('multer');var util=require(_0x0ecc('0x0'));var path=require('path');var timeout=require(_0x0ecc('0x1'));var express=require(_0x0ecc('0x2'));var router=express[_0x0ecc('0x3')]();var auth=require(_0x0ecc('0x4'));var interaction=require(_0x0ecc('0x5'));var config=require('../../config/environment');module[_0x0ecc('0x6')]=router; \ No newline at end of file +var _0x3df6=['connect-timeout','Router','../../config/environment','exports','multer','util','path'];(function(_0x50c15c,_0x5610ea){var _0x57502b=function(_0x412ff9){while(--_0x412ff9){_0x50c15c['push'](_0x50c15c['shift']());}};_0x57502b(++_0x5610ea);}(_0x3df6,0x131));var _0x63df=function(_0x24273c,_0x4e152b){_0x24273c=_0x24273c-0x0;var _0x5edde1=_0x3df6[_0x24273c];return _0x5edde1;};'use strict';var multer=require(_0x63df('0x0'));var util=require(_0x63df('0x1'));var path=require(_0x63df('0x2'));var timeout=require(_0x63df('0x3'));var express=require('express');var router=express[_0x63df('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x63df('0x5'));module[_0x63df('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 0672815..6c319bb 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 _0xefda=['sequelize','INTEGER','STRING'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xefda,0x96));var _0xaefd=function(_0xe8a458,_0x55d3d6){_0xe8a458=_0xe8a458-0x0;var _0x468347=_0xefda[_0xe8a458];return _0x468347;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaefd('0x2')]}}; \ No newline at end of file +var _0x6e6c=['exports','INTEGER','STRING','sequelize'];(function(_0x13a1f4,_0x50619e){var _0x40e0df=function(_0x577fed){while(--_0x577fed){_0x13a1f4['push'](_0x13a1f4['shift']());}};_0x40e0df(++_0x50619e);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc6e6('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc6e6('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 2a2ac9a..4053b28 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xb10b,0x12a));var _0xbb10=function(_0x201211,_0x2e2788){_0x201211=_0x201211-0x0;var _0x3641da=_0xb10b[_0x201211];return _0x3641da;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ddb2,_0x386ec3){_0x3ddb2=_0x3ddb2-0x0;var _0x41cc1f=_0xb10b[_0x3ddb2];return _0x41cc1f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 82d467f..84c4901 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 _0x2b30=['UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x50c227,_0x55ffdc){var _0x1c51f3=function(_0x2c1ff2){while(--_0x2c1ff2){_0x50c227['push'](_0x50c227['shift']());}};_0x1c51f3(++_0x55ffdc);}(_0x2b30,0x171));var _0x02b3=function(_0x2e8525,_0x281b40){_0x2e8525=_0x2e8525-0x0;var _0x42fc54=_0x2b30[_0x2e8525];return _0x42fc54;};'use strict';var _=require(_0x02b3('0x0'));var util=require(_0x02b3('0x1'));var moment=require('moment');var BPromise=require(_0x02b3('0x2'));var rs=require(_0x02b3('0x3'));var fs=require('fs');var Redis=require(_0x02b3('0x4'));var db=require(_0x02b3('0x5'))['db'];var utils=require(_0x02b3('0x6'));var logger=require(_0x02b3('0x7'))('rpc');var config=require(_0x02b3('0x8'));var jayson=require(_0x02b3('0x9'));var client=jayson[_0x02b3('0xa')][_0x02b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36a491,_0x5098ef,_0x2544d5){return new BPromise(function(_0x260a03,_0x457a16){return client[_0x02b3('0xc')](_0x36a491,_0x2544d5)[_0x02b3('0xd')](function(_0x7b7ddb){logger[_0x02b3('0xe')](_0x02b3('0xf'),_0x5098ef,'request\x20sent');logger[_0x02b3('0x10')](_0x02b3('0x11'),_0x5098ef,_0x02b3('0x12'),JSON['stringify'](_0x7b7ddb));if(_0x7b7ddb[_0x02b3('0x13')]){if(_0x7b7ddb[_0x02b3('0x13')][_0x02b3('0x14')]===0x1f4){logger['error'](_0x02b3('0xf'),_0x5098ef,_0x7b7ddb[_0x02b3('0x13')][_0x02b3('0x15')]);return _0x457a16(_0x7b7ddb['error']['message']);}logger[_0x02b3('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x5098ef,_0x7b7ddb['error'][_0x02b3('0x15')]);return _0x260a03(_0x7b7ddb[_0x02b3('0x13')][_0x02b3('0x15')]);}else{logger[_0x02b3('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x5098ef,_0x02b3('0x12'));_0x260a03(_0x7b7ddb[_0x02b3('0x16')]['message']);}})[_0x02b3('0x17')](function(_0x54096e){logger[_0x02b3('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x5098ef,_0x54096e);_0x457a16(_0x54096e);});});} \ No newline at end of file +var _0xfac7=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x598932,_0x34dc46){var _0x5f4142=function(_0x30b091){while(--_0x30b091){_0x598932['push'](_0x598932['shift']());}};_0x5f4142(++_0x34dc46);}(_0xfac7,0x1c9));var _0x7fac=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0xfac7[_0x24f326];return _0x488e2d;};'use strict';var _=require(_0x7fac('0x0'));var util=require(_0x7fac('0x1'));var moment=require(_0x7fac('0x2'));var BPromise=require(_0x7fac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7fac('0x5'))('rpc');var config=require(_0x7fac('0x6'));var jayson=require(_0x7fac('0x7'));var client=jayson[_0x7fac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x565449,_0x487da8,_0x175a48){return new BPromise(function(_0x40d351,_0x16d52c){return client[_0x7fac('0x9')](_0x565449,_0x175a48)[_0x7fac('0xa')](function(_0x1fc666){logger[_0x7fac('0xb')](_0x7fac('0xc'),_0x487da8,_0x7fac('0xd'));logger[_0x7fac('0xe')](_0x7fac('0xf'),_0x487da8,_0x7fac('0xd'),JSON['stringify'](_0x1fc666));if(_0x1fc666[_0x7fac('0x10')]){if(_0x1fc666[_0x7fac('0x10')][_0x7fac('0x11')]===0x1f4){logger[_0x7fac('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x487da8,_0x1fc666[_0x7fac('0x10')]['message']);return _0x16d52c(_0x1fc666['error'][_0x7fac('0x12')]);}logger['error'](_0x7fac('0xc'),_0x487da8,_0x1fc666['error'][_0x7fac('0x12')]);return _0x40d351(_0x1fc666['error'][_0x7fac('0x12')]);}else{logger[_0x7fac('0xb')](_0x7fac('0xc'),_0x487da8,'request\x20sent');_0x40d351(_0x1fc666[_0x7fac('0x13')][_0x7fac('0x12')]);}})[_0x7fac('0x14')](function(_0x2a0255){logger[_0x7fac('0x10')](_0x7fac('0xc'),_0x487da8,_0x2a0255);_0x16d52c(_0x2a0255);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index cf003cc..5ee084e 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 _0x48f4=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1cbe53,_0x2acb6e){var _0x1323fc=function(_0x32a816){while(--_0x32a816){_0x1cbe53['push'](_0x1cbe53['shift']());}};_0x1323fc(++_0x2acb6e);}(_0x48f4,0x64));var _0x448f=function(_0x446789,_0x40aa74){_0x446789=_0x446789-0x0;var _0x534e45=_0x48f4[_0x446789];return _0x534e45;};'use strict';var multer=require(_0x448f('0x0'));var util=require('util');var path=require(_0x448f('0x1'));var timeout=require(_0x448f('0x2'));var express=require(_0x448f('0x3'));var router=express[_0x448f('0x4')]();var auth=require(_0x448f('0x5'));var interaction=require(_0x448f('0x6'));var config=require(_0x448f('0x7'));module[_0x448f('0x8')]=router; \ No newline at end of file +var _0xe3f1=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x301ce1,_0x4ed4e2){var _0x4baf55=function(_0x2d7789){while(--_0x2d7789){_0x301ce1['push'](_0x301ce1['shift']());}};_0x4baf55(++_0x4ed4e2);}(_0xe3f1,0xd3));var _0x1e3f=function(_0x38bc45,_0x29fcd2){_0x38bc45=_0x38bc45-0x0;var _0x2a756a=_0xe3f1[_0x38bc45];return _0x2a756a;};'use strict';var multer=require(_0x1e3f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1e3f('0x1'));var express=require(_0x1e3f('0x2'));var router=express[_0x1e3f('0x3')]();var auth=require(_0x1e3f('0x4'));var interaction=require(_0x1e3f('0x5'));var config=require('../../config/environment');module[_0x1e3f('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 1cef40b..8065ca5 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 _0xb10b=['sequelize','INTEGER'];(function(_0x586a96,_0x4d4778){var _0x1b3b3c=function(_0x27e970){while(--_0x27e970){_0x586a96['push'](_0x586a96['shift']());}};_0x1b3b3c(++_0x4d4778);}(_0xb10b,0x12a));var _0xbb10=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0xb10b[_0x51b80a];return _0x22fdf0;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index ddc7753..b151f7d 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4358eb,_0x285726){var _0x5399c3=function(_0x2ebbdb){while(--_0x2ebbdb){_0x4358eb['push'](_0x4358eb['shift']());}};_0x5399c3(++_0x285726);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4fd255,_0x4e67c9){var _0x55c6cb=function(_0x2ed981){while(--_0x2ed981){_0x4fd255['push'](_0x4fd255['shift']());}};_0x55c6cb(++_0x4e67c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index d82624f..00a90cf 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 _0x3c2a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d7803,_0x30e9aa){var _0x1a43b2=function(_0x1359df){while(--_0x1359df){_0x5d7803['push'](_0x5d7803['shift']());}};_0x1a43b2(++_0x30e9aa);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x40a509,_0x58018f){_0x40a509=_0x40a509-0x0;var _0x45d0be=_0x3c2a[_0x40a509];return _0x45d0be;};'use strict';var _=require(_0xa3c2('0x0'));var util=require(_0xa3c2('0x1'));var moment=require('moment');var BPromise=require(_0xa3c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3c2('0x3'));var db=require(_0xa3c2('0x4'))['db'];var utils=require(_0xa3c2('0x5'));var logger=require(_0xa3c2('0x6'))(_0xa3c2('0x7'));var config=require(_0xa3c2('0x8'));var jayson=require(_0xa3c2('0x9'));var client=jayson[_0xa3c2('0xa')][_0xa3c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x113c67,_0xe1037d,_0x1975f3){return new BPromise(function(_0x1d8df4,_0x1ef2d3){return client['request'](_0x113c67,_0x1975f3)['then'](function(_0x23497b){logger[_0xa3c2('0xc')](_0xa3c2('0xd'),_0xe1037d,_0xa3c2('0xe'));logger[_0xa3c2('0xf')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0xe1037d,_0xa3c2('0xe'),JSON['stringify'](_0x23497b));if(_0x23497b[_0xa3c2('0x10')]){if(_0x23497b['error']['code']===0x1f4){logger[_0xa3c2('0x10')](_0xa3c2('0xd'),_0xe1037d,_0x23497b['error'][_0xa3c2('0x11')]);return _0x1ef2d3(_0x23497b[_0xa3c2('0x10')][_0xa3c2('0x11')]);}logger[_0xa3c2('0x10')](_0xa3c2('0xd'),_0xe1037d,_0x23497b[_0xa3c2('0x10')]['message']);return _0x1d8df4(_0x23497b[_0xa3c2('0x10')][_0xa3c2('0x11')]);}else{logger[_0xa3c2('0xc')](_0xa3c2('0xd'),_0xe1037d,_0xa3c2('0xe'));_0x1d8df4(_0x23497b[_0xa3c2('0x12')][_0xa3c2('0x11')]);}})[_0xa3c2('0x13')](function(_0x1d544f){logger[_0xa3c2('0x10')](_0xa3c2('0xd'),_0xe1037d,_0x1d544f);_0x1ef2d3(_0x1d544f);});});} \ No newline at end of file +var _0x2eb2=['request','then','info','request\x20sent','error','UserMailQueue,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x592704,_0x521b4d){var _0x1083fe=function(_0x2963c0){while(--_0x2963c0){_0x592704['push'](_0x592704['shift']());}};_0x1083fe(++_0x521b4d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x2eb2[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d0a95b0..5d713e2 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 _0x31dd=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x4eca83,_0x46750c){var _0x3ec0cd=function(_0x17e9d9){while(--_0x17e9d9){_0x4eca83['push'](_0x4eca83['shift']());}};_0x3ec0cd(++_0x46750c);}(_0x31dd,0x175));var _0xd31d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x31dd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd31d('0x0'));var path=require(_0xd31d('0x1'));var timeout=require(_0xd31d('0x2'));var express=require(_0xd31d('0x3'));var router=express['Router']();var auth=require(_0xd31d('0x4'));var interaction=require(_0xd31d('0x5'));var config=require(_0xd31d('0x6'));module[_0xd31d('0x7')]=router; \ No newline at end of file +var _0x0b15=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x365a9a,_0x2ed4a9){var _0xff0e4=function(_0x353b9d){while(--_0x353b9d){_0x365a9a['push'](_0x365a9a['shift']());}};_0xff0e4(++_0x2ed4a9);}(_0x0b15,0x1a2));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x50b1('0x0'));var util=require(_0x50b1('0x1'));var path=require(_0x50b1('0x2'));var timeout=require(_0x50b1('0x3'));var express=require(_0x50b1('0x4'));var router=express[_0x50b1('0x5')]();var auth=require(_0x50b1('0x6'));var interaction=require(_0x50b1('0x7'));var config=require(_0x50b1('0x8'));module[_0x50b1('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0849348..f2d04de 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 _0xb10b=['sequelize','INTEGER'];(function(_0x43d51a,_0x16f288){var _0x3fc5f3=function(_0x5b4fa6){while(--_0x5b4fa6){_0x43d51a['push'](_0x43d51a['shift']());}};_0x3fc5f3(++_0x16f288);}(_0xb10b,0x12a));var _0xbb10=function(_0x304bf7,_0x4fcafc){_0x304bf7=_0x304bf7-0x0;var _0x5036cd=_0xb10b[_0x304bf7];return _0x5036cd;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x486dc0,_0x2b4a6f){var _0xd786b1=function(_0x5b422b){while(--_0x5b422b){_0x486dc0['push'](_0x486dc0['shift']());}};_0xd786b1(++_0x2b4a6f);}(_0xe706,0xa3));var _0x6e70=function(_0x54822d,_0xe2a19f){_0x54822d=_0x54822d-0x0;var _0x2f688e=_0xe706[_0x54822d];return _0x2f688e;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 803726a..7d69617 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 _0xf4cc=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x54bdf9,_0x1d58a5){var _0x447729=function(_0x378d07){while(--_0x378d07){_0x54bdf9['push'](_0x54bdf9['shift']());}};_0x447729(++_0x1d58a5);}(_0xf4cc,0x69));var _0xcf4c=function(_0x101070,_0x4b6a91){_0x101070=_0x101070-0x0;var _0x4aac36=_0xf4cc[_0x101070];return _0x4aac36;};'use strict';var _=require(_0xcf4c('0x0'));var util=require(_0xcf4c('0x1'));var logger=require(_0xcf4c('0x2'))(_0xcf4c('0x3'));var moment=require(_0xcf4c('0x4'));var BPromise=require(_0xcf4c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf4c('0x6'));var rimraf=require(_0xcf4c('0x7'));var config=require(_0xcf4c('0x8'));var attributes=require(_0xcf4c('0x9'));module[_0xcf4c('0xa')]=function(_0x5c3160,_0x5444b9){return _0x5c3160[_0xcf4c('0xb')](_0xcf4c('0xc'),attributes,{'tableName':_0xcf4c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd00=['moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','api'];(function(_0x4b99d6,_0x4ac49e){var _0x3c5b15=function(_0x34ef85){while(--_0x34ef85){_0x4b99d6['push'](_0x4b99d6['shift']());}};_0x3c5b15(++_0x4ac49e);}(_0xfd00,0xfa));var _0x0fd0=function(_0x33350a,_0x4bd328){_0x33350a=_0x33350a-0x0;var _0x1739b2=_0xfd00[_0x33350a];return _0x1739b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0fd0('0x0'))(_0x0fd0('0x1'));var moment=require(_0x0fd0('0x2'));var BPromise=require(_0x0fd0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fd0('0x4'));var rimraf=require(_0x0fd0('0x5'));var config=require(_0x0fd0('0x6'));var attributes=require(_0x0fd0('0x7'));module[_0x0fd0('0x8')]=function(_0x3f49cc,_0x7919eb){return _0x3f49cc[_0x0fd0('0x9')](_0x0fd0('0xa'),attributes,{'tableName':_0x0fd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 627bb02..0aec0b8 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 _0x22b6=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0xfb6d6,_0x284cde){var _0xd46966=function(_0x3c6a0e){while(--_0x3c6a0e){_0xfb6d6['push'](_0xfb6d6['shift']());}};_0xd46966(++_0x284cde);}(_0x22b6,0xc7));var _0x622b=function(_0x4b9b58,_0x1d96a8){_0x4b9b58=_0x4b9b58-0x0;var _0x440d29=_0x22b6[_0x4b9b58];return _0x440d29;};'use strict';var _=require(_0x622b('0x0'));var util=require(_0x622b('0x1'));var moment=require(_0x622b('0x2'));var BPromise=require('bluebird');var rs=require(_0x622b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x622b('0x4'))['db'];var utils=require(_0x622b('0x5'));var logger=require(_0x622b('0x6'))(_0x622b('0x7'));var config=require(_0x622b('0x8'));var jayson=require(_0x622b('0x9'));var client=jayson[_0x622b('0xa')][_0x622b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5181e9,_0x470dd9,_0x20dc39){return new BPromise(function(_0x5b0345,_0x298066){return client[_0x622b('0xc')](_0x5181e9,_0x20dc39)[_0x622b('0xd')](function(_0x464682){logger[_0x622b('0xe')](_0x622b('0xf'),_0x470dd9,'request\x20sent');logger[_0x622b('0x10')](_0x622b('0x11'),_0x470dd9,_0x622b('0x12'),JSON[_0x622b('0x13')](_0x464682));if(_0x464682[_0x622b('0x14')]){if(_0x464682[_0x622b('0x14')][_0x622b('0x15')]===0x1f4){logger[_0x622b('0x14')](_0x622b('0xf'),_0x470dd9,_0x464682[_0x622b('0x14')][_0x622b('0x16')]);return _0x298066(_0x464682['error'][_0x622b('0x16')]);}logger['error'](_0x622b('0xf'),_0x470dd9,_0x464682[_0x622b('0x14')]['message']);return _0x5b0345(_0x464682[_0x622b('0x14')][_0x622b('0x16')]);}else{logger['info'](_0x622b('0xf'),_0x470dd9,_0x622b('0x12'));_0x5b0345(_0x464682[_0x622b('0x17')][_0x622b('0x16')]);}})[_0x622b('0x18')](function(_0xe24740){logger[_0x622b('0x14')](_0x622b('0xf'),_0x470dd9,_0xe24740);_0x298066(_0xe24740);});});} \ No newline at end of file +var _0x0fb8=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19b320,_0x17c4f9){var _0x509fab=function(_0x4362de){while(--_0x4362de){_0x19b320['push'](_0x19b320['shift']());}};_0x509fab(++_0x17c4f9);}(_0x0fb8,0x1d5));var _0x80fb=function(_0x289479,_0x4c742a){_0x289479=_0x289479-0x0;var _0x35fd61=_0x0fb8[_0x289479];return _0x35fd61;};'use strict';var _=require('lodash');var util=require(_0x80fb('0x0'));var moment=require(_0x80fb('0x1'));var BPromise=require(_0x80fb('0x2'));var rs=require(_0x80fb('0x3'));var fs=require('fs');var Redis=require(_0x80fb('0x4'));var db=require(_0x80fb('0x5'))['db'];var utils=require(_0x80fb('0x6'));var logger=require(_0x80fb('0x7'))('rpc');var config=require(_0x80fb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x80fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47875c,_0x1a2f30,_0xa03161){return new BPromise(function(_0x338f84,_0x5c3a8b){return client['request'](_0x47875c,_0xa03161)[_0x80fb('0xa')](function(_0x5c5753){logger[_0x80fb('0xb')](_0x80fb('0xc'),_0x1a2f30,_0x80fb('0xd'));logger[_0x80fb('0xe')](_0x80fb('0xf'),_0x1a2f30,_0x80fb('0xd'),JSON[_0x80fb('0x10')](_0x5c5753));if(_0x5c5753[_0x80fb('0x11')]){if(_0x5c5753[_0x80fb('0x11')][_0x80fb('0x12')]===0x1f4){logger[_0x80fb('0x11')](_0x80fb('0xc'),_0x1a2f30,_0x5c5753[_0x80fb('0x11')][_0x80fb('0x13')]);return _0x5c3a8b(_0x5c5753[_0x80fb('0x11')][_0x80fb('0x13')]);}logger[_0x80fb('0x11')](_0x80fb('0xc'),_0x1a2f30,_0x5c5753[_0x80fb('0x11')]['message']);return _0x338f84(_0x5c5753['error'][_0x80fb('0x13')]);}else{logger['info'](_0x80fb('0xc'),_0x1a2f30,_0x80fb('0xd'));_0x338f84(_0x5c5753[_0x80fb('0x14')][_0x80fb('0x13')]);}})[_0x80fb('0x15')](function(_0x3db79a){logger[_0x80fb('0x11')](_0x80fb('0xc'),_0x1a2f30,_0x3db79a);_0x5c3a8b(_0x3db79a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6c56d44..94795b4 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 _0x7554=['describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','put','delete','destroy','removeSections','removeResources','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated'];(function(_0x53acc0,_0x488d85){var _0x5240db=function(_0x44b9be){while(--_0x44b9be){_0x53acc0['push'](_0x53acc0['shift']());}};_0x5240db(++_0x488d85);}(_0x7554,0x199));var _0x4755=function(_0x1174f2,_0x14ae38){_0x1174f2=_0x1174f2-0x0;var _0x1de599=_0x7554[_0x1174f2];return _0x1de599;};'use strict';var multer=require(_0x4755('0x0'));var util=require('util');var path=require(_0x4755('0x1'));var timeout=require(_0x4755('0x2'));var express=require(_0x4755('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4755('0x4'));var config=require(_0x4755('0x5'));var controller=require(_0x4755('0x6'));router[_0x4755('0x7')]('/',auth['isAuthenticated'](),controller[_0x4755('0x8')]);router[_0x4755('0x7')](_0x4755('0x9'),auth[_0x4755('0xa')](),controller[_0x4755('0xb')]);router[_0x4755('0x7')](_0x4755('0xc'),auth[_0x4755('0xa')](),controller[_0x4755('0xd')]);router[_0x4755('0x7')](_0x4755('0xe'),auth['isAuthenticated'](),controller[_0x4755('0xf')]);router[_0x4755('0x7')](_0x4755('0x10'),auth['isAuthenticated'](),controller['getResources']);router[_0x4755('0x11')]('/',auth[_0x4755('0xa')](),controller[_0x4755('0x12')]);router[_0x4755('0x11')](_0x4755('0x13'),auth['isAuthenticated'](),controller[_0x4755('0x14')]);router[_0x4755('0x11')](_0x4755('0xe'),auth[_0x4755('0xa')](),controller[_0x4755('0x15')]);router['post'](_0x4755('0x10'),auth[_0x4755('0xa')](),controller[_0x4755('0x16')]);router[_0x4755('0x17')]('/:id',auth[_0x4755('0xa')](),controller['update']);router[_0x4755('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x4755('0x19')]);router[_0x4755('0x18')](_0x4755('0xe'),auth[_0x4755('0xa')](),controller[_0x4755('0x1a')]);router[_0x4755('0x18')]('/:id/resources',auth[_0x4755('0xa')](),controller[_0x4755('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x1981=['/:id/clone','clone','/:id/sections','addSections','addResources','put','delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','create','post'];(function(_0x3e9030,_0x16c384){var _0x526b49=function(_0x3228fe){while(--_0x3228fe){_0x3e9030['push'](_0x3e9030['shift']());}};_0x526b49(++_0x16c384);}(_0x1981,0xf3));var _0x1198=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x1981[_0x40b2ed];return _0x18397d;};'use strict';var multer=require(_0x1198('0x0'));var util=require('util');var path=require(_0x1198('0x1'));var timeout=require(_0x1198('0x2'));var express=require('express');var router=express[_0x1198('0x3')]();var auth=require(_0x1198('0x4'));var interaction=require(_0x1198('0x5'));var config=require(_0x1198('0x6'));var controller=require('./userProfile.controller');router[_0x1198('0x7')]('/',auth[_0x1198('0x8')](),controller[_0x1198('0x9')]);router[_0x1198('0x7')](_0x1198('0xa'),auth['isAuthenticated'](),controller[_0x1198('0xb')]);router[_0x1198('0x7')](_0x1198('0xc'),auth['isAuthenticated'](),controller[_0x1198('0xd')]);router[_0x1198('0x7')]('/:id/sections',auth[_0x1198('0x8')](),controller[_0x1198('0xe')]);router[_0x1198('0x7')](_0x1198('0xf'),auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x1198('0x8')](),controller[_0x1198('0x10')]);router[_0x1198('0x11')](_0x1198('0x12'),auth[_0x1198('0x8')](),controller[_0x1198('0x13')]);router[_0x1198('0x11')](_0x1198('0x14'),auth[_0x1198('0x8')](),controller[_0x1198('0x15')]);router[_0x1198('0x11')](_0x1198('0xf'),auth[_0x1198('0x8')](),controller[_0x1198('0x16')]);router[_0x1198('0x17')]('/:id',auth[_0x1198('0x8')](),controller['update']);router[_0x1198('0x18')](_0x1198('0xc'),auth[_0x1198('0x8')](),controller[_0x1198('0x19')]);router[_0x1198('0x18')](_0x1198('0x14'),auth[_0x1198('0x8')](),controller[_0x1198('0x1a')]);router[_0x1198('0x18')]('/:id/resources',auth[_0x1198('0x8')](),controller[_0x1198('0x1b')]);module[_0x1198('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 611f7d7..f84c730 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 _0xa0ed=['join','getDataValue','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0xa0ed,0x1a2));var _0xda0e=function(_0x41882a,_0x1a450b){_0x41882a=_0x41882a-0x0;var _0x278068=_0xa0ed[_0x41882a];return _0x278068;};'use strict';var Sequelize=require(_0xda0e('0x0'));module[_0xda0e('0x1')]={'name':{'type':Sequelize[_0xda0e('0x2')],'allowNull':![],'unique':_0xda0e('0x3')},'crudPermissions':{'type':Sequelize[_0xda0e('0x2')],'set':function(_0xf3eb4d){this[_0xda0e('0x4')](_0xda0e('0x5'),_0xf3eb4d?_0xf3eb4d[_0xda0e('0x6')](''):[]);},'get':function(){return this[_0xda0e('0x7')](_0xda0e('0x5'))?this['getDataValue'](_0xda0e('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xda0e('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1f93=['getDataValue','split','sequelize','name','STRING','setDataValue','crudPermissions','join'];(function(_0x630b91,_0x466bcb){var _0x3e16bc=function(_0x57c878){while(--_0x57c878){_0x630b91['push'](_0x630b91['shift']());}};_0x3e16bc(++_0x466bcb);}(_0x1f93,0x112));var _0x31f9=function(_0x2403b0,_0x53207c){_0x2403b0=_0x2403b0-0x0;var _0x2a6db7=_0x1f93[_0x2403b0];return _0x2a6db7;};'use strict';var Sequelize=require(_0x31f9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x31f9('0x1')},'crudPermissions':{'type':Sequelize[_0x31f9('0x2')],'set':function(_0x1a0726){this[_0x31f9('0x3')](_0x31f9('0x4'),_0x1a0726?_0x1a0726[_0x31f9('0x5')](''):[]);},'get':function(){return this[_0x31f9('0x6')]('crudPermissions')?this['getDataValue'](_0x31f9('0x4'))[_0x31f9('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x31f9('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index cc0fff8..bd9e153 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 _0xfc20=['triggers','Trigger','Trunk','Variable','plugins','metrics','AnalyticMetric','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','length','include','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','push','ids','getSections','includes','subsections','enabled','findOne','findAll','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','isEmpty','parentSections','all','ignore','union','childModel','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','Lists','ListId','CmList','companies','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','templates','Template'];(function(_0x4ae1b0,_0x265fb1){var _0xf716c7=function(_0x2cc3ab){while(--_0x2cc3ab){_0x4ae1b0['push'](_0x4ae1b0['shift']());}};_0xf716c7(++_0x265fb1);}(_0xfc20,0x1df));var _0x0fc2=function(_0x49f823,_0x49bc41){_0x49f823=_0x49f823-0x0;var _0x443e8a=_0xfc20[_0x49f823];return _0x443e8a;};'use strict';var pdf=require(_0x0fc2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0fc2('0x1'));var jsonpatch=require(_0x0fc2('0x2'));var rp=require(_0x0fc2('0x3'));var moment=require(_0x0fc2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0fc2('0x5'));var util=require('util');var path=require(_0x0fc2('0x6'));var sox=require(_0x0fc2('0x7'));var csv=require(_0x0fc2('0x8'));var ejs=require(_0x0fc2('0x9'));var fs=require('fs');var _=require(_0x0fc2('0xa'));var squel=require(_0x0fc2('0xb'));var crypto=require(_0x0fc2('0xc'));var jsforce=require(_0x0fc2('0xd'));var deskjs=require(_0x0fc2('0xe'));var toCsv=require(_0x0fc2('0x8'));var querystring=require(_0x0fc2('0xf'));var Papa=require(_0x0fc2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0fc2('0x11'));var as=require(_0x0fc2('0x12'));var hardwareService=require(_0x0fc2('0x13'));var logger=require(_0x0fc2('0x14'))(_0x0fc2('0x15'));var utils=require('../../config/utils');var config=require(_0x0fc2('0x16'));var db=require(_0x0fc2('0x17'))['db'];config[_0x0fc2('0x18')]=_[_0x0fc2('0x19')](config['redis'],{'host':_0x0fc2('0x1a'),'port':0x18eb});var socket=require(_0x0fc2('0x1b'))(new Redis(config[_0x0fc2('0x18')]));require(_0x0fc2('0x1c'))[_0x0fc2('0x1d')](socket);function respondWithStatusCode(_0x1c58a5,_0x3b012c){_0x3b012c=_0x3b012c||0xcc;return function(_0x180633){if(_0x180633){return _0x1c58a5['sendStatus'](_0x3b012c);}return _0x1c58a5[_0x0fc2('0x1e')](_0x3b012c)[_0x0fc2('0x1f')]();};}function respondWithResult(_0x61829a,_0x40cfbb){_0x40cfbb=_0x40cfbb||0xc8;return function(_0x41562d){if(_0x41562d){return _0x61829a['status'](_0x40cfbb)['json'](_0x41562d);}};}function respondWithFilteredResult(_0x14b83c,_0x1cfc9a){return function(_0x345e3c){if(_0x345e3c){var _0x1cb177=_0x345e3c[_0x0fc2('0x20')],_0x38dffb=_0x1cfc9a[_0x0fc2('0x21')],_0x4911bb=_0x1cfc9a[_0x0fc2('0x21')]+_0x1cfc9a[_0x0fc2('0x22')],_0x178b8e;if(_0x4911bb>=_0x1cb177){_0x4911bb=_0x1cb177;_0x178b8e=0xc8;}else{_0x178b8e=0xce;}_0x14b83c[_0x0fc2('0x1e')](_0x178b8e);return _0x14b83c[_0x0fc2('0x23')](_0x0fc2('0x24'),_0x38dffb+'-'+_0x4911bb+'/'+_0x1cb177)[_0x0fc2('0x25')](_0x345e3c);}return null;};}function patchUpdates(_0x299f25){return function(_0x20c1f4){try{jsonpatch[_0x0fc2('0x26')](_0x20c1f4,_0x299f25,!![]);}catch(_0xe4991b){return BPromise[_0x0fc2('0x27')](_0xe4991b);}return _0x20c1f4['save']();};}function saveUpdates(_0x38af34,_0x990f4a){return function(_0x84ab09){if(_0x84ab09){return _0x84ab09[_0x0fc2('0x28')](_0x38af34)[_0x0fc2('0x29')](function(_0x4bbde6){return _0x4bbde6;});}return null;};}function removeEntity(_0x51c2c2,_0x4a48ae){return function(_0x2a9773){if(_0x2a9773){return _0x2a9773[_0x0fc2('0x2a')]()[_0x0fc2('0x29')](function(){_0x51c2c2[_0x0fc2('0x1e')](0xcc)[_0x0fc2('0x1f')]();});}};}function handleEntityNotFound(_0x4467ac,_0x2263a9){return function(_0x3f2968){if(!_0x3f2968){_0x4467ac[_0x0fc2('0x2b')](0x194);}return _0x3f2968;};}function handleError(_0x5d252a,_0x25d2ef){_0x25d2ef=_0x25d2ef||0x1f4;return function(_0x1b4deb){logger['error'](_0x1b4deb[_0x0fc2('0x2c')]);if(_0x1b4deb[_0x0fc2('0x2d')]){delete _0x1b4deb['name'];}_0x5d252a[_0x0fc2('0x1e')](_0x25d2ef)['send'](_0x1b4deb);};}exports[_0x0fc2('0x2e')]=function(_0x4bf673,_0x271bbf){var _0xd77766={},_0x299a70={},_0x191aec={'count':0x0,'rows':[]};var _0x529271=_[_0x0fc2('0x2f')](db[_0x0fc2('0x30')][_0x0fc2('0x31')],function(_0x1fdca6){return{'name':_0x1fdca6[_0x0fc2('0x32')],'type':_0x1fdca6[_0x0fc2('0x33')][_0x0fc2('0x34')]};});_0x299a70['model']=_[_0x0fc2('0x2f')](_0x529271,_0x0fc2('0x2d'));_0x299a70[_0x0fc2('0x35')]=_[_0x0fc2('0x36')](_0x4bf673[_0x0fc2('0x35')]);_0x299a70[_0x0fc2('0x37')]=_['intersection'](_0x299a70[_0x0fc2('0x38')],_0x299a70[_0x0fc2('0x35')]);_0xd77766[_0x0fc2('0x39')]=_[_0x0fc2('0x3a')](_0x299a70[_0x0fc2('0x38')],qs[_0x0fc2('0x3b')](_0x4bf673[_0x0fc2('0x35')][_0x0fc2('0x3b')]));_0xd77766[_0x0fc2('0x39')]=_0xd77766[_0x0fc2('0x39')]['length']?_0xd77766[_0x0fc2('0x39')]:_0x299a70[_0x0fc2('0x38')];if(!_0x4bf673['query'][_0x0fc2('0x3c')](_0x0fc2('0x3d'))){_0xd77766['limit']=qs['limit'](_0x4bf673['query']['limit']);_0xd77766[_0x0fc2('0x21')]=qs[_0x0fc2('0x21')](_0x4bf673[_0x0fc2('0x35')][_0x0fc2('0x21')]);}_0xd77766[_0x0fc2('0x3e')]=qs[_0x0fc2('0x3f')](_0x4bf673[_0x0fc2('0x35')][_0x0fc2('0x3f')]);_0xd77766[_0x0fc2('0x40')]=qs[_0x0fc2('0x37')](_[_0x0fc2('0x41')](_0x4bf673['query'],_0x299a70[_0x0fc2('0x37')]),_0x529271);if(_0x4bf673['query'][_0x0fc2('0x42')]){_0xd77766[_0x0fc2('0x40')]=_[_0x0fc2('0x43')](_0xd77766[_0x0fc2('0x40')],{'$or':_[_0x0fc2('0x2f')](_0x529271,function(_0x5084cf){if(_0x5084cf['type']!=='VIRTUAL'){var _0x72262={};_0x72262[_0x5084cf[_0x0fc2('0x2d')]]={'$like':'%'+_0x4bf673[_0x0fc2('0x35')]['filter']+'%'};return _0x72262;}})});}_0xd77766=_[_0x0fc2('0x43')]({},_0xd77766,_0x4bf673[_0x0fc2('0x44')]);var _0x48c0cb={'where':_0xd77766['where']};return db[_0x0fc2('0x30')]['count'](_0x48c0cb)['then'](function(_0xc7a189){_0x191aec[_0x0fc2('0x20')]=_0xc7a189;if(_0x4bf673[_0x0fc2('0x35')][_0x0fc2('0x45')]){_0xd77766['include']=[{'all':!![]}];}return db[_0x0fc2('0x30')]['findAll'](_0xd77766);})[_0x0fc2('0x29')](function(_0x3db1d5){_0x191aec[_0x0fc2('0x46')]=_0x3db1d5;return _0x191aec;})['then'](respondWithFilteredResult(_0x271bbf,_0xd77766))[_0x0fc2('0x47')](handleError(_0x271bbf,null));};exports[_0x0fc2('0x48')]=function(_0x3757a5,_0x2817eb){var _0x1fd998={'raw':![],'where':{'id':_0x3757a5[_0x0fc2('0x49')]['id']}},_0x52ad7c={};_0x52ad7c['model']=_[_0x0fc2('0x36')](db['UserProfile'][_0x0fc2('0x31')]);_0x52ad7c[_0x0fc2('0x35')]=_[_0x0fc2('0x36')](_0x3757a5[_0x0fc2('0x35')]);_0x52ad7c['filters']=_['intersection'](_0x52ad7c[_0x0fc2('0x38')],_0x52ad7c[_0x0fc2('0x35')]);_0x1fd998['attributes']=_[_0x0fc2('0x3a')](_0x52ad7c[_0x0fc2('0x38')],qs[_0x0fc2('0x3b')](_0x3757a5['query']['fields']));_0x1fd998[_0x0fc2('0x39')]=_0x1fd998[_0x0fc2('0x39')][_0x0fc2('0x4a')]?_0x1fd998[_0x0fc2('0x39')]:_0x52ad7c[_0x0fc2('0x38')];if(_0x3757a5[_0x0fc2('0x35')][_0x0fc2('0x45')]){_0x1fd998[_0x0fc2('0x4b')]=[{'all':!![]}];}_0x1fd998=_['merge']({},_0x1fd998,_0x3757a5[_0x0fc2('0x44')]);return db[_0x0fc2('0x30')][_0x0fc2('0x4c')](_0x1fd998)[_0x0fc2('0x29')](handleEntityNotFound(_0x2817eb,null))[_0x0fc2('0x29')](respondWithResult(_0x2817eb,null))[_0x0fc2('0x47')](handleError(_0x2817eb,null));};exports[_0x0fc2('0x4d')]=function(_0x548718,_0x516fb1){return db[_0x0fc2('0x30')][_0x0fc2('0x4d')](_0x548718['body'],{})[_0x0fc2('0x29')](respondWithResult(_0x516fb1,0xc9))['catch'](handleError(_0x516fb1,null));};exports[_0x0fc2('0x4e')]=function(_0xcb5d43,_0x4afaa7){var _0x13f477={'where':{'id':_0xcb5d43[_0x0fc2('0x49')]['id']}},_0x3b1a07={};_0x3b1a07['model']=_[_0x0fc2('0x36')](db[_0x0fc2('0x30')][_0x0fc2('0x31')]);_0x13f477['attributes']=_[_0x0fc2('0x3a')](_0x3b1a07[_0x0fc2('0x38')],qs[_0x0fc2('0x3b')](_0xcb5d43['query'][_0x0fc2('0x3b')]));_0x13f477[_0x0fc2('0x39')]=_0x13f477[_0x0fc2('0x39')]['length']?_0x13f477[_0x0fc2('0x39')]:_0x3b1a07['model'];if(_0xcb5d43[_0x0fc2('0x35')][_0x0fc2('0x45')]){_0x13f477[_0x0fc2('0x4b')]=[{'all':!![]}];}_0x13f477=_[_0x0fc2('0x43')]({},_0x13f477,_0xcb5d43[_0x0fc2('0x44')]);return db[_0x0fc2('0x30')][_0x0fc2('0x4c')](_0x13f477)[_0x0fc2('0x29')](handleEntityNotFound(_0x4afaa7,null))['then'](function(_0x4c8ec1){if(_0x4c8ec1){var _0x4b4adf=_0x4c8ec1[_0x0fc2('0x4f')]({'plain':!![]});_0x4b4adf=qs[_0x0fc2('0x50')](_0x4b4adf,['id',_0x0fc2('0x51'),_0x0fc2('0x52'),_0x0fc2('0x53')]);_0xcb5d43[_0x0fc2('0x54')]=_[_0x0fc2('0x50')](_0xcb5d43[_0x0fc2('0x54')],['id',_0x0fc2('0x51'),_0x0fc2('0x52')]);return db[_0x0fc2('0x55')][_0x0fc2('0x56')](function(_0x164836){return db['UserProfile'][_0x0fc2('0x4d')](_[_0x0fc2('0x43')](_0x4b4adf,_0xcb5d43[_0x0fc2('0x54')]),{'include':_0xcb5d43[_0x0fc2('0x35')][_0x0fc2('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x164836})[_0x0fc2('0x29')](function(_0x2ddf70){var _0x4e6a09=_0x2ddf70[_0x0fc2('0x4f')]({'plain':!![]});return db[_0x0fc2('0x57')]['findAll']({'where':{'userProfileId':_0xcb5d43[_0x0fc2('0x49')]['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x1d86fb){if(_0x1d86fb){return BPromise[_0x0fc2('0x58')](_0x1d86fb,function(_0x15c9e1){return new BPromise(function(_0x4aeb9d,_0x2c406f){if(_0x15c9e1['autoAssociation']===null||_0x15c9e1[_0x0fc2('0x59')]===0x1)_0x4aeb9d(null);return db[_0x0fc2('0x5a')]['findAll']({'where':{'sectionId':_0x15c9e1['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x4830b4){var _0x2bab85=_[_0x0fc2('0x2f')](_0x4830b4,function(_0x5d8219){return qs[_0x0fc2('0x50')](_0x5d8219,['id','createdAt',_0x0fc2('0x52'),_0x0fc2('0x5b')]);});_0x4aeb9d(_0x2bab85);})[_0x0fc2('0x47')](function(_0x14f442){_0x2c406f(_0x14f442);});})['then'](function(_0x4058fd){var _0x31310f=qs[_0x0fc2('0x50')](_0x15c9e1,['id',_0x0fc2('0x51'),'updatedAt']);_0x31310f[_0x0fc2('0x5c')]=_0x4e6a09['id'];if(_0x4058fd)_0x31310f[_0x0fc2('0x5d')]=_0x4058fd;return _0x31310f;})[_0x0fc2('0x29')](function(_0x59e066){return db[_0x0fc2('0x57')][_0x0fc2('0x4d')](_0x59e066,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x164836});});})[_0x0fc2('0x29')](function(){return _0x4e6a09;});}});});});}})[_0x0fc2('0x29')](respondWithResult(_0x4afaa7,0xc9))['catch'](handleError(_0x4afaa7,null));};exports[_0x0fc2('0x28')]=function(_0x587976,_0x49815d){if(_0x587976[_0x0fc2('0x54')]['id']){delete _0x587976['body']['id'];}return db[_0x0fc2('0x30')]['find']({'where':{'id':_0x587976[_0x0fc2('0x49')]['id']}})[_0x0fc2('0x29')](handleEntityNotFound(_0x49815d,null))[_0x0fc2('0x29')](saveUpdates(_0x587976[_0x0fc2('0x54')],null))[_0x0fc2('0x29')](respondWithResult(_0x49815d,null))[_0x0fc2('0x47')](handleError(_0x49815d,null));};exports[_0x0fc2('0x2a')]=function(_0x5075b9,_0x1b84d7){return db[_0x0fc2('0x30')]['find']({'where':{'id':_0x5075b9[_0x0fc2('0x49')]['id']}})[_0x0fc2('0x29')](handleEntityNotFound(_0x1b84d7,null))[_0x0fc2('0x29')](removeEntity(_0x1b84d7,null))[_0x0fc2('0x47')](handleError(_0x1b84d7,null));};exports[_0x0fc2('0x5e')]=function(_0x276484,_0x88dc67){return db[_0x0fc2('0x30')][_0x0fc2('0x5e')]()[_0x0fc2('0x29')](respondWithResult(_0x88dc67,null))[_0x0fc2('0x47')](handleError(_0x88dc67,null));};exports[_0x0fc2('0x5f')]=function(_0x52d8b6,_0x311a69){var _0x2ac947=_0x52d8b6[_0x0fc2('0x54')];return db[_0x0fc2('0x30')][_0x0fc2('0x4c')]({'where':{'id':_0x52d8b6['params']['id']}})['then'](handleEntityNotFound(_0x311a69,null))['then'](function(_0x326af7){if(_0x326af7){return db[_0x0fc2('0x55')]['transaction'](function(_0xb51fc6){return db[_0x0fc2('0x57')]['destroy']({'where':{'userProfileId':_0x52d8b6[_0x0fc2('0x49')]['id'],'sectionId':_['map'](_0x2ac947,function(_0x1c38e7){return _0x1c38e7[_0x0fc2('0x5b')];})},'transaction':_0xb51fc6})[_0x0fc2('0x29')](function(){var _0x47b998=_[_0x0fc2('0x2f')](_0x2ac947,function(_0x16732f){_0x16732f[_0x0fc2('0x5c')]=_0x52d8b6['params']['id'];return _0x16732f;});var _0x2c57a2=[];return BPromise['each'](_0x47b998,function(_0x44e364){return db['UserProfileSection'][_0x0fc2('0x4d')](_0x44e364,{'include':[{'model':db[_0x0fc2('0x5a')],'as':_0x0fc2('0x5d')}],'raw':!![],'transaction':_0xb51fc6})[_0x0fc2('0x29')](function(_0x12a464){_0x2c57a2[_0x0fc2('0x60')](_0x12a464['get']({'plain':!![]}));});})[_0x0fc2('0x29')](function(){return _0x2c57a2;});});});}})[_0x0fc2('0x29')](function(_0x1e96e8){return _0x1e96e8;})[_0x0fc2('0x29')](respondWithResult(_0x311a69,null))['catch'](handleError(_0x311a69,null));};exports['removeSections']=function(_0x3f89da,_0x32c3a7){var _0x14e993;return db['UserProfile'][_0x0fc2('0x4c')]({'where':{'id':_0x3f89da[_0x0fc2('0x49')]['id']},'attributes':['id',_0x0fc2('0x2d')]})['then'](handleEntityNotFound(_0x32c3a7,null))[_0x0fc2('0x29')](function(_0x494296){if(_0x494296){_0x14e993=_0x494296;return db['UserProfileSection'][_0x0fc2('0x2a')]({'where':{'userProfileId':_0x3f89da[_0x0fc2('0x49')]['id'],'sectionId':_0x3f89da[_0x0fc2('0x35')][_0x0fc2('0x61')]}});}})[_0x0fc2('0x29')](function(){return _0x14e993;})[_0x0fc2('0x29')](respondWithStatusCode(_0x32c3a7,null))[_0x0fc2('0x47')](handleError(_0x32c3a7,null));};exports[_0x0fc2('0x62')]=function(_0x59387e,_0x18bfdb){var _0x36c9a1=[];var _0x33d625=[];return db[_0x0fc2('0x57')]['findAll']({'where':{'userProfileId':_0x59387e['params']['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x250754){_0x36c9a1=_[_0x0fc2('0x42')](_0x250754,function(_0xb334f4){return _0xb334f4['enabled']===0x1||_[_0x0fc2('0x63')]([0x3eb,0x709],_0xb334f4[_0x0fc2('0x5b')]);});if(!_['isEmpty'](_0x36c9a1)){return _[_0x0fc2('0x2f')](_0x36c9a1,function(_0x3b0c8b){return _0x3b0c8b[_0x0fc2('0x5b')];});}else{return;}})[_0x0fc2('0x29')](function(_0x4cc48f){if(_0x4cc48f)_0x33d625=_0x4cc48f;if(_[_0x0fc2('0x63')](_0x33d625,0x64)){var _0x1442ca=_[_0x0fc2('0x4c')](_0x36c9a1,{'sectionId':0x64});return hasDefaultDashboard(_0x1442ca)[_0x0fc2('0x29')](function(_0x1214dc){return _[_0x0fc2('0x2f')](_0x36c9a1,function(_0x2f7af6){if(_0x2f7af6[_0x0fc2('0x5b')]===0x64){_0x2f7af6[_0x0fc2('0x64')]=_0x1214dc;}return _0x2f7af6;});});}else{return;}})[_0x0fc2('0x29')](function(_0x1841ad){if(_0x1841ad)_0x36c9a1=_0x1841ad;if(_[_0x0fc2('0x63')](_0x33d625,0x3eb)){var _0x495122=_[_0x0fc2('0x4c')](_0x36c9a1,{'sectionId':0x3eb});return getCustomDashboards(_0x495122)[_0x0fc2('0x29')](function(_0x4dd938){return _[_0x0fc2('0x2f')](_0x36c9a1,function(_0x3eb750){if(_0x495122[_0x0fc2('0x65')]){if(_0x3eb750[_0x0fc2('0x5b')]===0x3eb){_0x3eb750['subsections']=_0x4dd938;}}else{if(_0x3eb750[_0x0fc2('0x5b')]===0x64){_0x3eb750[_0x0fc2('0x64')]=_0x4dd938;}}return _0x3eb750;});});}else{return;}})['then'](function(_0x29bc2f){if(_0x29bc2f)_0x36c9a1=_0x29bc2f;if(_[_0x0fc2('0x63')](_0x33d625,0x709)){var _0x180b30=_[_0x0fc2('0x4c')](_0x36c9a1,{'sectionId':0x709});return getPlugins(_0x180b30)[_0x0fc2('0x29')](function(_0x4e443a){if(_0x180b30[_0x0fc2('0x65')]){return _[_0x0fc2('0x2f')](_0x36c9a1,function(_0x1cf67a){if(_0x1cf67a[_0x0fc2('0x5b')]===0x709){_0x1cf67a[_0x0fc2('0x64')]=_0x4e443a;}return _0x1cf67a;});}else{var _0x5c9d0c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4e443a};var _0x2803b9=_[_0x0fc2('0x2f')](_0x36c9a1);_0x2803b9[_0x0fc2('0x60')](_0x5c9d0c);return _0x2803b9;}});}else{return;}})['then'](function(_0x46d800){if(_0x46d800)_0x36c9a1=_0x46d800;return _[_0x0fc2('0x42')](_0x36c9a1,[_0x0fc2('0x65'),0x1]);})['then'](respondWithResult(_0x18bfdb,null))[_0x0fc2('0x47')](handleError(_0x18bfdb,null));};function hasDefaultDashboard(_0x498296){var _0x4fd4a5=[0x65];return new BPromise(function(_0x5791a6,_0x30aeb7){try{if(_0x498296[_0x0fc2('0x59')]){_0x5791a6(_0x4fd4a5);}else{return db[_0x0fc2('0x5a')][_0x0fc2('0x66')]({'where':{'sectionId':_0x498296['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0xb5153e){_0xb5153e?_0x5791a6(_0x4fd4a5):_0x5791a6();});}}catch(_0x1155db){_0x30aeb7(_0x1155db);}});}function getCustomDashboards(_0x582356){var _0x59f65d=[];return new BPromise(function(_0x5235c0,_0x475799){try{if(_0x582356[_0x0fc2('0x59')]){return db['Dashboard'][_0x0fc2('0x67')]({'raw':!![]})[_0x0fc2('0x29')](function(_0x4d8215){_0x4d8215[_0x0fc2('0x68')](function(_0x3e2d56){_0x59f65d[_0x0fc2('0x60')](_0x3e2d56['id']+0x1869f);});_0x5235c0(_0x59f65d);});}else{return db[_0x0fc2('0x5a')][_0x0fc2('0x67')]({'where':{'sectionId':_0x582356['id']},'raw':!![]})['then'](function(_0xfa6b15){_0xfa6b15[_0x0fc2('0x68')](function(_0x3a51c9){_0x59f65d[_0x0fc2('0x60')](_0x3a51c9[_0x0fc2('0x69')]+0x1869f);});_0x5235c0(_0x59f65d);});}}catch(_0x21609c){_0x475799(_0x21609c);}});}function getPlugins(_0x2aa648){var _0xfb522c=[];return new BPromise(function(_0x3f227e,_0x129b49){try{if(_0x2aa648[_0x0fc2('0x59')]){return db[_0x0fc2('0x6a')]['findAll']({'raw':!![]})[_0x0fc2('0x29')](function(_0x190f1b){_0x190f1b[_0x0fc2('0x68')](function(_0x3674ed){_0xfb522c['push'](_0x3674ed['id']+0x15b38);});_0x3f227e(_0xfb522c);});}else{return db[_0x0fc2('0x5a')][_0x0fc2('0x67')]({'where':{'sectionId':_0x2aa648['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x22a474){_0x22a474[_0x0fc2('0x68')](function(_0x3a2579){_0xfb522c['push'](_0x3a2579[_0x0fc2('0x69')]+0x15b38);});_0x3f227e(_0xfb522c);});}}catch(_0x24cae7){_0x129b49(_0x24cae7);}});}exports[_0x0fc2('0x6b')]=function(_0x59df06,_0x329db6){return db[_0x0fc2('0x30')][_0x0fc2('0x4c')]({'where':{'id':_0x59df06[_0x0fc2('0x49')]['id']}})[_0x0fc2('0x29')](handleEntityNotFound(_0x329db6,null))[_0x0fc2('0x29')](function(_0x220618){if(_0x220618){return db['sequelize']['transaction'](function(_0x5eeead){return db[_0x0fc2('0x57')]['findAll']({'where':{'userProfileId':_0x59df06[_0x0fc2('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x0fc2('0x29')](function(_0x2ac0aa){if(_0x2ac0aa){return db[_0x0fc2('0x57')][_0x0fc2('0x2a')]({'where':{'userProfileId':_0x59df06[_0x0fc2('0x49')]['id'],'id':_[_0x0fc2('0x2f')](_0x2ac0aa,function(_0x43e727){return _0x43e727['id'];})},'transaction':_0x5eeead});}})[_0x0fc2('0x29')](function(_0x2714d6){var _0x300811=_[_0x0fc2('0x2f')](_0x59df06['body'],function(_0x32f710){_0x32f710[_0x0fc2('0x5c')]=_0x59df06[_0x0fc2('0x49')]['id'];return _0x32f710;});return db[_0x0fc2('0x57')][_0x0fc2('0x6c')](_0x300811,{'raw':!![],'transaction':_0x5eeead});})['then'](function(_0x2d10c6){var _0x1a719b=_[_0x0fc2('0x42')](_[_0x0fc2('0x2f')](_0x2d10c6,function(_0x1a8314){return _0x1a8314['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1a719b){return db[_0x0fc2('0x57')][_0x0fc2('0x67')]({'where':{'userProfileId':_0x59df06['params']['id'],'sectionId':_[_0x0fc2('0x2f')](_0x1a719b,function(_0x22f4c8){return _0x22f4c8[_0x0fc2('0x5b')];})},'attributes':['id',_0x0fc2('0x5b')],'raw':!![]})['then'](function(_0x206762){var _0x2613aa=_[_0x0fc2('0x2f')](_0x59df06[_0x0fc2('0x54')],function(_0xd20943){_0xd20943[_0x0fc2('0x5c')]=_0x59df06['params']['id'];return _0xd20943;});return db[_0x0fc2('0x5a')][_0x0fc2('0x6c')](_0x2613aa,{'raw':!![],'transaction':_0x5eeead});});}})[_0x0fc2('0x47')](handleError(_0x329db6,null));});}})[_0x0fc2('0x29')](function(_0x35d2cd){var _0x4dca22=_[_0x0fc2('0x2f')](_0x35d2cd,function(_0x58d4dc){return _0x58d4dc[_0x0fc2('0x4f')]({'plain':!![]});});})[_0x0fc2('0x29')](respondWithResult(_0x329db6,null))['catch'](handleError(_0x329db6,null));};exports[_0x0fc2('0x6d')]=function(_0x29aba9,_0x5414a8,_0xdadda2){return db[_0x0fc2('0x30')]['find']({'where':{'id':_0x29aba9[_0x0fc2('0x49')]['id']}})['then'](handleEntityNotFound(_0x5414a8,null))[_0x0fc2('0x29')](function(_0x507d69){if(_0x507d69){return _0x507d69['removeResources'](_0x29aba9['query'][_0x0fc2('0x61')]);}})[_0x0fc2('0x29')](respondWithStatusCode(_0x5414a8,null))[_0x0fc2('0x47')](handleError(_0x5414a8,null));};exports[_0x0fc2('0x6e')]=function(_0x35ca05,_0x240e8f){var _0x1e5ce3={'raw':![],'where':{}};var _0x1e81d1={};var _0x557816={'count':0x0,'rows':[]};var _0x57c479=_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x6f')];if(typeof _0x57c479===_0x0fc2('0x70')){throw new db[(_0x0fc2('0x71'))][(_0x0fc2('0x72'))](_0x0fc2('0x73'));}var _0x1edbce=_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x74')]||![];var _0x330003=getQueryModels(_0x57c479,_0x1edbce);if(typeof _0x330003['childModel']==='undefined'){throw new db[(_0x0fc2('0x71'))][(_0x0fc2('0x72'))](_0x0fc2('0x75')+_0x57c479+'\x27');}var _0x12223b=[];if(!_[_0x0fc2('0x76')](_0x330003[_0x0fc2('0x77')])){_0x12223b=_0x330003[_0x0fc2('0x77')];}else{_0x12223b=[{'name':_0x57c479}];}return db['UserProfile'][_0x0fc2('0x66')]({'where':{'id':_0x35ca05[_0x0fc2('0x49')]['id']}})[_0x0fc2('0x29')](handleEntityNotFound(_0x240e8f,null))[_0x0fc2('0x29')](function(_0x1d9690){if(_0x1d9690){var _0x14f1b9=[];for(var _0x54858b=0x0;_0x54858b<_0x12223b[_0x0fc2('0x4a')];_0x54858b++){_0x14f1b9['push'](db[_0x0fc2('0x57')]['findOne']({'where':{'userProfileId':_0x1d9690['id'],'name':_0x12223b[_0x54858b][_0x0fc2('0x2d')]},'raw':!![]}));}return BPromise[_0x0fc2('0x78')](_0x14f1b9);}})['then'](function(_0x1c0d2e){var _0x14d6ca=_[_0x0fc2('0x42')](_0x1c0d2e,function(_0x15adf7){return _0x15adf7?_0x15adf7:undefined;});var _0x160274=_['filter'](_0x12223b,[_0x0fc2('0x79'),!![]]);var _0x33c464=_[_0x0fc2('0x76')](_0x14d6ca)&&_[_0x0fc2('0x76')](_0x160274)?null:_[_0x0fc2('0x7a')](_0x160274,_0x14d6ca);if(_0x33c464){var _0x4c9842=[];for(var _0x2f293c=0x0;_0x2f293c<_0x33c464['length'];_0x2f293c++){var _0x439253=_['find'](_0x12223b,function(_0x3a7f2b){return _0x33c464[_0x2f293c]?_0x3a7f2b[_0x0fc2('0x2d')]===_0x33c464[_0x2f293c][_0x0fc2('0x2d')]:null;});if(_0x439253){if(_0x33c464[_0x2f293c]['ignore']){_0x4c9842[_0x0fc2('0x60')](getAllResources(_0x330003[_0x0fc2('0x7b')],_0x33c464[_0x2f293c]));}else{if(!_0x33c464[_0x2f293c][_0x0fc2('0x59')]){_0x4c9842['push'](getAllowedResources(_0x439253,_0x33c464[_0x2f293c],_0x330003[_0x0fc2('0x7b')]));}else{if(_0x439253[_0x0fc2('0x38')]){_0x4c9842[_0x0fc2('0x60')](getAllFilteredResources(_0x439253,_0x33c464[_0x2f293c]));}}}}}return BPromise[_0x0fc2('0x78')](_0x4c9842);}else{return null;}})[_0x0fc2('0x29')](function(_0x58dfa1){var _0x19fbdd=_0x58dfa1;var _0x262d8b=null;if(_0x19fbdd){_0x262d8b=_0x19fbdd[_0x0fc2('0x4a')]===0x1?_0x19fbdd[0x0]:null;}if(_0x262d8b||_0x19fbdd){var _0x27b14a=db[_0x330003[_0x0fc2('0x7b')]]['rawAttributes'];_0x1e81d1[_0x0fc2('0x38')]=_['keys'](_0x27b14a);_0x1e81d1[_0x0fc2('0x35')]=_[_0x0fc2('0x36')](_0x35ca05[_0x0fc2('0x35')]);_0x1e81d1[_0x0fc2('0x37')]=_[_0x0fc2('0x3a')](_0x1e81d1[_0x0fc2('0x38')],_0x1e81d1[_0x0fc2('0x35')]);_0x1e5ce3[_0x0fc2('0x39')]=_['intersection'](_0x1e81d1[_0x0fc2('0x38')],qs[_0x0fc2('0x3b')](_0x35ca05['query'][_0x0fc2('0x3b')]));_0x1e5ce3[_0x0fc2('0x39')]=_0x1e5ce3['attributes']['length']?_0x1e5ce3['attributes']:_0x1e81d1['model'];if(!_0x35ca05['query'][_0x0fc2('0x3c')](_0x0fc2('0x3d'))){_0x1e5ce3[_0x0fc2('0x22')]=qs[_0x0fc2('0x22')](_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x22')]);_0x1e5ce3[_0x0fc2('0x21')]=qs['offset'](_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x21')]);}_0x1e5ce3[_0x0fc2('0x3e')]=qs[_0x0fc2('0x3f')](_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x3f')]);_0x1e5ce3[_0x0fc2('0x40')]=qs[_0x0fc2('0x37')](_['pick'](_0x35ca05[_0x0fc2('0x35')],_0x1e81d1[_0x0fc2('0x37')]));if(_0x35ca05[_0x0fc2('0x35')]['filter']){_0x1e5ce3[_0x0fc2('0x40')]=_[_0x0fc2('0x43')](_0x1e5ce3[_0x0fc2('0x40')],{'$or':_[_0x0fc2('0x2f')](_0x27b14a,function(_0x3568a9){if(_0x3568a9[_0x0fc2('0x33')][_0x0fc2('0x34')]!==_0x0fc2('0x7c')){var _0x412e28={};_0x412e28[_0x3568a9[_0x0fc2('0x7d')]]={'$like':'%'+_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x42')]+'%'};return _0x412e28;}})});}var _0x408c71=[];if(_0x262d8b){var _0x1b1d2d=_[_0x0fc2('0x4c')](_0x12223b,[_0x0fc2('0x2d'),_0x262d8b[_0x0fc2('0x2d')]]);if(_0x1b1d2d[_0x0fc2('0x7d')]){var _0x5986c8={};if(_0x330003[_0x0fc2('0x7b')]===_0x0fc2('0x7e')){_0x5986c8[_0x1b1d2d[_0x0fc2('0x7f')]]=_[_0x0fc2('0x2f')](_0x262d8b['associatedResources'],'id');}else{_0x5986c8[_0x1b1d2d[_0x0fc2('0x7f')]]=_0x262d8b[_0x0fc2('0x80')];}_0x408c71[_0x0fc2('0x60')](_0x5986c8);}else{_0x1e5ce3[_0x0fc2('0x40')]['id']=_0x262d8b['associatedResources'];}}else{for(var _0x27f5e6=0x0;_0x27f5e6<_0x19fbdd[_0x0fc2('0x4a')];_0x27f5e6++){var _0x1b1d2d=_[_0x0fc2('0x4c')](_0x12223b,[_0x0fc2('0x2d'),_0x19fbdd[_0x27f5e6]['name']]);if(_0x1b1d2d['field']){var _0x5986c8={};_0x5986c8[_0x1b1d2d[_0x0fc2('0x7f')]]=_0x19fbdd[_0x27f5e6][_0x0fc2('0x80')];_0x408c71[_0x0fc2('0x60')](_0x5986c8);}else{if(!_0x1e5ce3['where']['id'])_0x1e5ce3[_0x0fc2('0x40')]['id']=[];_0x19fbdd[_0x27f5e6][_0x0fc2('0x80')][_0x0fc2('0x68')](function(_0x29312f){_0x1e5ce3[_0x0fc2('0x40')]['id']['push'](_0x29312f);});}}}if(!_[_0x0fc2('0x76')](_0x408c71)){_0x1e5ce3[_0x0fc2('0x40')]=_[_0x0fc2('0x43')](_0x1e5ce3[_0x0fc2('0x40')],{'$and':{'$or':_0x408c71}});}_0x1e5ce3=_[_0x0fc2('0x43')]({},_0x1e5ce3,_0x35ca05[_0x0fc2('0x44')]);if(_0x262d8b&&!_0x262d8b[_0x0fc2('0x59')]&&_0x330003[_0x0fc2('0x7b')]==='AnalyticExtractedReport'){if(_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x45')]){_0x1e5ce3[_0x0fc2('0x4b')]=[{'all':!![]}];}return db[_0x330003[_0x0fc2('0x7b')]][_0x0fc2('0x67')](_0x1e5ce3)[_0x0fc2('0x29')](function(_0xfd615a){var _0x3b7e3f=[];_0xfd615a[_0x0fc2('0x68')](function(_0x20533c){var _0x3f587a;switch(_0x20533c[_0x0fc2('0x81')]){case _0x0fc2('0x82'):_0x3f587a=_[_0x0fc2('0x4c')](_0x262d8b[_0x0fc2('0x80')],function(_0x4a8f4f){return _0x4a8f4f['id']===_0x20533c[_0x0fc2('0x83')]&&_0x4a8f4f[_0x0fc2('0x33')]===_0x0fc2('0x84');});break;case'custom':_0x3f587a=_[_0x0fc2('0x4c')](_0x262d8b['associatedResources'],function(_0x4d4eff){return _0x4d4eff['id']===_0x20533c[_0x0fc2('0x83')]&&_0x4d4eff['type']===_0x0fc2('0x85');});break;}if(_0x3f587a)_0x3b7e3f[_0x0fc2('0x60')](_0x20533c);});_0x557816[_0x0fc2('0x20')]=_0x3b7e3f[_0x0fc2('0x4a')];_0x557816[_0x0fc2('0x46')]=_0x3b7e3f;return _0x557816;});}else{return db[_0x330003[_0x0fc2('0x7b')]][_0x0fc2('0x20')]({'where':_0x1e5ce3['where']})[_0x0fc2('0x29')](function(_0x4c3976){_0x557816['count']=_0x4c3976;if(_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x45')]){if(_0x330003[_0x0fc2('0x7b')]===_0x0fc2('0x86')){_0x1e5ce3[_0x0fc2('0x4b')]=[{'model':db[_0x0fc2('0x87')],'as':_0x0fc2('0x88'),'attributes':['id',_0x0fc2('0x2d'),_0x0fc2('0x89')],'required':_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x8a')]?!![]:![]},{'model':db['Tag'],'as':_0x0fc2('0x8b'),'attributes':['id',_0x0fc2('0x2d'),'color'],'through':_0x35ca05['query'][_0x0fc2('0x8a')]?{'attributes':[],'where':{'TagId':_0x35ca05['query'][_0x0fc2('0x8a')]||undefined}}:{},'required':_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x8a')]?!![]:![]}];}else{_0x1e5ce3[_0x0fc2('0x4b')]=[{'all':!![]}];}}return db[_0x330003[_0x0fc2('0x7b')]][_0x0fc2('0x67')](_0x1e5ce3);})[_0x0fc2('0x29')](function(_0x1c25af){_0x557816[_0x0fc2('0x46')]=_0x1c25af;return _0x557816;});}}else{return _0x557816;}})[_0x0fc2('0x29')](respondWithFilteredResult(_0x240e8f,_0x1e5ce3))[_0x0fc2('0x47')](handleError(_0x240e8f,null));};function getAllResources(_0x31c54a,_0x51dad3){return new BPromise(function(_0x59f7f0,_0x2d133a){if(_0x51dad3){var _0x5f31a7=_0x51dad3[_0x0fc2('0x42')]?{[_0x51dad3['filter'][_0x0fc2('0x7d')]]:_0x51dad3[_0x0fc2('0x42')]['value']}:undefined;return db[_0x31c54a][_0x0fc2('0x67')]({'where':_0x5f31a7,'raw':!![]})[_0x0fc2('0x29')](function(_0x4b9e25){_0x51dad3[_0x0fc2('0x80')]=_['map'](_0x4b9e25,'id');_0x59f7f0(_0x51dad3);})[_0x0fc2('0x47')](function(_0x3ff048){_0x2d133a(_0x3ff048);});}else{_0x59f7f0(null);}});}function getAllFilteredResources(_0x32ba0f,_0xe105e4){return new BPromise(function(_0x13f98a,_0x353c50){var _0x1f6261=_0x32ba0f[_0x0fc2('0x42')]?{[_0x32ba0f[_0x0fc2('0x42')]['field']]:_0x32ba0f[_0x0fc2('0x42')][_0x0fc2('0x8c')]}:undefined;return db[_0x32ba0f[_0x0fc2('0x38')]][_0x0fc2('0x67')]({'where':_0x1f6261,'raw':!![]})[_0x0fc2('0x29')](function(_0x2ae304){_0xe105e4[_0x0fc2('0x80')]=_[_0x0fc2('0x2f')](_0x2ae304,function(_0x406601){return _0x406601[_0x0fc2('0x2d')];});_0x13f98a(_0xe105e4);})['catch'](function(_0x2c0f5b){_0x353c50(_0x2c0f5b);});});}function getAllowedResources(_0x595620,_0x16dc6c,_0x45a21a){return new BPromise(function(_0x159bb5,_0x34ef13){if(_0x16dc6c){return db[_0x0fc2('0x5a')][_0x0fc2('0x67')]({'where':{'sectionId':_0x16dc6c['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x1c3838){if(_0x595620[_0x0fc2('0x7d')]&&_0x595620[_0x0fc2('0x7d')]!=='id'){_0x16dc6c[_0x0fc2('0x80')]=_[_0x0fc2('0x2f')](_0x1c3838,function(_0x588904){return _0x588904[_0x595620[_0x0fc2('0x7d')]];});}else{if(_0x45a21a==='AnalyticExtractedReport'){_0x16dc6c[_0x0fc2('0x80')]=_[_0x0fc2('0x2f')](_0x1c3838,function(_0x4808a0){return{'id':_0x4808a0[_0x0fc2('0x69')],'type':_0x4808a0[_0x0fc2('0x33')]};});}else{_0x16dc6c['associatedResources']=_['map'](_0x1c3838,function(_0x35746d){return _0x35746d[_0x0fc2('0x69')];});}}_0x159bb5(_0x16dc6c);})[_0x0fc2('0x47')](function(_0x36d60b){_0x34ef13(_0x36d60b);});}else{_0x159bb5(null);}});}function getQueryModels(_0x181ab3,_0x6d5772){var _0x22025d=_0x181ab3[_0x0fc2('0x8d')]();var _0x539682={'childModel':undefined,'parentSections':[]};switch(_0x22025d){case'squareprojects':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x8e');break;case _0x0fc2('0x8f'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x90');break;case'squarerecordings':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x91');_0x539682[_0x0fc2('0x77')]=[{'name':_0x0fc2('0x92'),'field':'name','foreignKey':_0x0fc2('0x93')}];break;case _0x0fc2('0x94'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x95');break;case'contacts':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x86');_0x539682[_0x0fc2('0x77')]=[{'name':_0x0fc2('0x96'),'field':'id','foreignKey':_0x0fc2('0x97')}];break;case'lists':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x98');break;case _0x0fc2('0x99'):_0x539682[_0x0fc2('0x7b')]='CmCompany';break;case _0x0fc2('0x9a'):_0x539682['childModel']='CmCustomField';break;case _0x0fc2('0x9b'):_0x539682[_0x0fc2('0x7b')]='ChatQueue';break;case _0x0fc2('0x9c'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x9d');break;case'faxqueues':_0x539682[_0x0fc2('0x7b')]='FaxQueue';break;case'faxaccounts':_0x539682[_0x0fc2('0x7b')]='FaxAccount';break;case'inboundroutes':case _0x0fc2('0x9e'):case _0x0fc2('0x9f'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa0');break;case _0x0fc2('0xa1'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa2');break;case'voicemails':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa3');break;case _0x0fc2('0xa4'):_0x539682['childModel']='VoiceRecording';_0x539682[_0x0fc2('0x77')]=[{'name':_0x0fc2('0xa5'),'field':_0x0fc2('0x2d'),'foreignKey':_0x0fc2('0xa6'),'model':_0x0fc2('0xa7'),'filter':{'field':'role','value':[_0x0fc2('0xa8')]}},{'name':_0x0fc2('0xa9'),'field':'name','foreignKey':_0x0fc2('0xa6'),'model':_0x0fc2('0xa7'),'filter':{'field':_0x0fc2('0xaa'),'value':[_0x0fc2('0xab')]}},{'name':_0x0fc2('0xac'),'field':_0x0fc2('0x2d'),'foreignKey':_0x0fc2('0xad'),'model':_0x0fc2('0xae'),'filter':{'field':_0x0fc2('0x33'),'value':['inbound']}},{'name':_0x0fc2('0xaf'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x0fc2('0x33'),'value':[_0x0fc2('0xb0')]}}];break;case _0x0fc2('0xb1'):_0x539682[_0x0fc2('0x7b')]='VoiceMusicOnHold';break;case _0x0fc2('0xb2'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xb3');break;case _0x0fc2('0xb4'):_0x539682[_0x0fc2('0x7b')]='VoicePrefix';break;case _0x0fc2('0xb5'):_0x539682[_0x0fc2('0x7b')]='Campaign';break;case _0x0fc2('0xb6'):_0x539682['childModel']=_0x0fc2('0xb7');break;case'mailaccounts':_0x539682['childModel']=_0x0fc2('0xb8');break;case _0x0fc2('0xb9'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xba');break;case _0x0fc2('0xbb'):_0x539682['childModel']='OpenchannelQueue';break;case'openchannelaccounts':_0x539682[_0x0fc2('0x7b')]='OpenchannelAccount';break;case _0x0fc2('0xbc'):_0x539682['childModel']=_0x0fc2('0xbd');break;case _0x0fc2('0xbe'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xbf');break;case'whatsappqueues':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xc0');break;case _0x0fc2('0xc1'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xc2');break;case _0x0fc2('0xc3'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xc4');break;case _0x0fc2('0xc5'):case _0x0fc2('0xc6'):_0x539682['childModel']=_0x0fc2('0xae');if(_0x6d5772){_0x539682[_0x0fc2('0x77')]=[{'name':'VoiceQueues'},{'name':_0x0fc2('0xaf')}];}break;case _0x0fc2('0xc7'):case _0x0fc2('0xc8'):case'telephones':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa7');if(_0x6d5772){_0x539682['parentSections']=[{'name':_0x0fc2('0xc9'),'filter':{'field':_0x0fc2('0xaa'),'value':[_0x0fc2('0xca'),_0x0fc2('0xcb')]},'ignore':!![]},{'name':_0x0fc2('0xa5')},{'name':_0x0fc2('0xa9')}];}break;case _0x0fc2('0xcc'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xcd');break;case _0x0fc2('0xce'):_0x539682['childModel']=_0x0fc2('0xcf');break;case'freshdeskaccounts':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xd0');break;case _0x0fc2('0xd1'):_0x539682[_0x0fc2('0x7b')]='SugarcrmAccount';break;case _0x0fc2('0xd2'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xd3');break;case _0x0fc2('0xd4'):_0x539682[_0x0fc2('0x7b')]='ZohoAccount';break;case _0x0fc2('0xd5'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa7');break;case _0x0fc2('0xd6'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xd7');break;case _0x0fc2('0xd8'):_0x539682['childModel']=_0x0fc2('0xd9');break;case _0x0fc2('0xda'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xdb');break;case _0x0fc2('0xdc'):_0x539682['childModel']=_0x0fc2('0xdd');break;case _0x0fc2('0xde'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xdf');break;case _0x0fc2('0xe0'):_0x539682['childModel']=_0x0fc2('0xe1');break;case'sounds':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xe2');break;case'tags':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x87');break;case _0x0fc2('0xe3'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xe4');break;case _0x0fc2('0xe5'):_0x539682['childModel']=_0x0fc2('0xe6');break;case'trunks':_0x539682['childModel']=_0x0fc2('0xe7');break;case'variables':_0x539682['childModel']=_0x0fc2('0xe8');break;case _0x0fc2('0xe9'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x6a');break;case'extractedreports':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x7e');_0x539682['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x0fc2('0x83')}];break;case _0x0fc2('0xea'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xeb');break;case _0x0fc2('0xc1'):_0x539682['childModel']=_0x0fc2('0xc2');break;default:return _0x539682;}return _0x539682;} \ No newline at end of file +var _0x67f7=['mergeResources','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','childModel','key','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','tag','ThroughTags','color','value','toLowerCase','squareprojects','SquareProject','odbc','SquareRecording','SquareProjects','JscriptyProject','contacts','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Interval','pauses','Pause','scheduler','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','Plugin','extractedreports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','UserProfile','rawAttributes','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','clone','get','createdAt','updatedAt','crudPermissions','omit','sequelize','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','addSections','transaction','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','getResources','section','undefined','Sequelize'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0x67f7,0x16d));var _0x767f=function(_0x1ac27e,_0x95a2f6){_0x1ac27e=_0x1ac27e-0x0;var _0x59e9ff=_0x67f7[_0x1ac27e];return _0x59e9ff;};'use strict';var pdf=require(_0x767f('0x0'));var emlformat=require(_0x767f('0x1'));var rimraf=require(_0x767f('0x2'));var zipdir=require(_0x767f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x767f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x767f('0x5'));var util=require(_0x767f('0x6'));var path=require(_0x767f('0x7'));var sox=require(_0x767f('0x8'));var csv=require('to-csv');var ejs=require(_0x767f('0x9'));var fs=require('fs');var _=require(_0x767f('0xa'));var squel=require(_0x767f('0xb'));var crypto=require(_0x767f('0xc'));var jsforce=require(_0x767f('0xd'));var deskjs=require(_0x767f('0xe'));var toCsv=require(_0x767f('0xf'));var querystring=require('querystring');var Papa=require(_0x767f('0x10'));var Redis=require(_0x767f('0x11'));var authService=require(_0x767f('0x12'));var qs=require(_0x767f('0x13'));var as=require(_0x767f('0x14'));var hardwareService=require(_0x767f('0x15'));var logger=require(_0x767f('0x16'))(_0x767f('0x17'));var utils=require(_0x767f('0x18'));var config=require(_0x767f('0x19'));var db=require(_0x767f('0x1a'))['db'];config[_0x767f('0x1b')]=_['defaults'](config[_0x767f('0x1b')],{'host':_0x767f('0x1c'),'port':0x18eb});var socket=require(_0x767f('0x1d'))(new Redis(config[_0x767f('0x1b')]));require(_0x767f('0x1e'))['register'](socket);function respondWithStatusCode(_0x2c1f37,_0x4919b2){_0x4919b2=_0x4919b2||0xcc;return function(_0x31c64b){if(_0x31c64b){return _0x2c1f37[_0x767f('0x1f')](_0x4919b2);}return _0x2c1f37[_0x767f('0x20')](_0x4919b2)[_0x767f('0x21')]();};}function respondWithResult(_0x43a3c5,_0x62fde0){_0x62fde0=_0x62fde0||0xc8;return function(_0x74dc13){if(_0x74dc13){return _0x43a3c5[_0x767f('0x20')](_0x62fde0)[_0x767f('0x22')](_0x74dc13);}};}function respondWithFilteredResult(_0x202227,_0xa739b0){return function(_0x234078){if(_0x234078){var _0x28f18b=_0x234078['count'],_0x7d6945=_0xa739b0[_0x767f('0x23')],_0x54ba9d=_0xa739b0[_0x767f('0x23')]+_0xa739b0[_0x767f('0x24')],_0x4585cf;if(_0x54ba9d>=_0x28f18b){_0x54ba9d=_0x28f18b;_0x4585cf=0xc8;}else{_0x4585cf=0xce;}_0x202227['status'](_0x4585cf);return _0x202227[_0x767f('0x25')](_0x767f('0x26'),_0x7d6945+'-'+_0x54ba9d+'/'+_0x28f18b)[_0x767f('0x22')](_0x234078);}return null;};}function patchUpdates(_0x1687b2){return function(_0x50d876){try{jsonpatch[_0x767f('0x27')](_0x50d876,_0x1687b2,!![]);}catch(_0x155d07){return BPromise[_0x767f('0x28')](_0x155d07);}return _0x50d876['save']();};}function saveUpdates(_0x5012c3,_0x38344a){return function(_0x4fee58){if(_0x4fee58){return _0x4fee58[_0x767f('0x29')](_0x5012c3)['then'](function(_0x5c6d48){return _0x5c6d48;});}return null;};}function removeEntity(_0x57d9d5,_0x51a2bc){return function(_0x12f4e7){if(_0x12f4e7){return _0x12f4e7[_0x767f('0x2a')]()[_0x767f('0x2b')](function(){_0x57d9d5['status'](0xcc)[_0x767f('0x21')]();});}};}function handleEntityNotFound(_0x1b5735,_0x165778){return function(_0x1c6aab){if(!_0x1c6aab){_0x1b5735[_0x767f('0x1f')](0x194);}return _0x1c6aab;};}function handleError(_0x44aa5e,_0x3d5dce){_0x3d5dce=_0x3d5dce||0x1f4;return function(_0x3deec3){logger[_0x767f('0x2c')](_0x3deec3[_0x767f('0x2d')]);if(_0x3deec3[_0x767f('0x2e')]){delete _0x3deec3['name'];}_0x44aa5e[_0x767f('0x20')](_0x3d5dce)[_0x767f('0x2f')](_0x3deec3);};}exports[_0x767f('0x30')]=function(_0x3286e6,_0x30b59d){var _0x36ad64={},_0x1e5518={},_0xf722a9={'count':0x0,'rows':[]};var _0x178282=_['map'](db[_0x767f('0x31')][_0x767f('0x32')],function(_0x2feafc){return{'name':_0x2feafc['fieldName'],'type':_0x2feafc['type']['key']};});_0x1e5518[_0x767f('0x33')]=_[_0x767f('0x34')](_0x178282,_0x767f('0x2e'));_0x1e5518[_0x767f('0x35')]=_['keys'](_0x3286e6[_0x767f('0x35')]);_0x1e5518[_0x767f('0x36')]=_[_0x767f('0x37')](_0x1e5518[_0x767f('0x33')],_0x1e5518[_0x767f('0x35')]);_0x36ad64[_0x767f('0x38')]=_[_0x767f('0x37')](_0x1e5518[_0x767f('0x33')],qs[_0x767f('0x39')](_0x3286e6[_0x767f('0x35')][_0x767f('0x39')]));_0x36ad64['attributes']=_0x36ad64[_0x767f('0x38')]['length']?_0x36ad64[_0x767f('0x38')]:_0x1e5518['model'];if(!_0x3286e6['query'][_0x767f('0x3a')](_0x767f('0x3b'))){_0x36ad64[_0x767f('0x24')]=qs['limit'](_0x3286e6[_0x767f('0x35')][_0x767f('0x24')]);_0x36ad64['offset']=qs[_0x767f('0x23')](_0x3286e6['query']['offset']);}_0x36ad64['order']=qs['sort'](_0x3286e6[_0x767f('0x35')][_0x767f('0x3c')]);_0x36ad64[_0x767f('0x3d')]=qs['filters'](_[_0x767f('0x3e')](_0x3286e6[_0x767f('0x35')],_0x1e5518[_0x767f('0x36')]),_0x178282);if(_0x3286e6[_0x767f('0x35')][_0x767f('0x3f')]){_0x36ad64[_0x767f('0x3d')]=_[_0x767f('0x40')](_0x36ad64[_0x767f('0x3d')],{'$or':_[_0x767f('0x34')](_0x178282,function(_0xb9911f){if(_0xb9911f[_0x767f('0x41')]!=='VIRTUAL'){var _0x55d539={};_0x55d539[_0xb9911f[_0x767f('0x2e')]]={'$like':'%'+_0x3286e6[_0x767f('0x35')]['filter']+'%'};return _0x55d539;}})});}_0x36ad64=_[_0x767f('0x40')]({},_0x36ad64,_0x3286e6[_0x767f('0x42')]);var _0x10e30d={'where':_0x36ad64['where']};return db[_0x767f('0x31')][_0x767f('0x43')](_0x10e30d)['then'](function(_0x69f7ab){_0xf722a9[_0x767f('0x43')]=_0x69f7ab;if(_0x3286e6[_0x767f('0x35')][_0x767f('0x44')]){_0x36ad64[_0x767f('0x45')]=[{'all':!![]}];}return db[_0x767f('0x31')][_0x767f('0x46')](_0x36ad64);})[_0x767f('0x2b')](function(_0x22ca03){_0xf722a9[_0x767f('0x47')]=_0x22ca03;return _0xf722a9;})['then'](respondWithFilteredResult(_0x30b59d,_0x36ad64))[_0x767f('0x48')](handleError(_0x30b59d,null));};exports['show']=function(_0x41328b,_0x27d20c){var _0x2f1e6b={'raw':![],'where':{'id':_0x41328b[_0x767f('0x49')]['id']}},_0x9ff7ad={};_0x9ff7ad['model']=_['keys'](db[_0x767f('0x31')]['rawAttributes']);_0x9ff7ad[_0x767f('0x35')]=_[_0x767f('0x4a')](_0x41328b[_0x767f('0x35')]);_0x9ff7ad[_0x767f('0x36')]=_[_0x767f('0x37')](_0x9ff7ad['model'],_0x9ff7ad[_0x767f('0x35')]);_0x2f1e6b[_0x767f('0x38')]=_['intersection'](_0x9ff7ad[_0x767f('0x33')],qs[_0x767f('0x39')](_0x41328b[_0x767f('0x35')][_0x767f('0x39')]));_0x2f1e6b[_0x767f('0x38')]=_0x2f1e6b[_0x767f('0x38')][_0x767f('0x4b')]?_0x2f1e6b[_0x767f('0x38')]:_0x9ff7ad[_0x767f('0x33')];if(_0x41328b[_0x767f('0x35')][_0x767f('0x44')]){_0x2f1e6b[_0x767f('0x45')]=[{'all':!![]}];}_0x2f1e6b=_['merge']({},_0x2f1e6b,_0x41328b[_0x767f('0x42')]);return db['UserProfile'][_0x767f('0x4c')](_0x2f1e6b)[_0x767f('0x2b')](handleEntityNotFound(_0x27d20c,null))['then'](respondWithResult(_0x27d20c,null))['catch'](handleError(_0x27d20c,null));};exports[_0x767f('0x4d')]=function(_0x30b319,_0x51f003){return db[_0x767f('0x31')][_0x767f('0x4d')](_0x30b319[_0x767f('0x4e')],{})[_0x767f('0x2b')](respondWithResult(_0x51f003,0xc9))[_0x767f('0x48')](handleError(_0x51f003,null));};exports[_0x767f('0x4f')]=function(_0x3726b9,_0x2989a6){var _0x3d77d9={'where':{'id':_0x3726b9[_0x767f('0x49')]['id']}},_0xbd4a39={};_0xbd4a39[_0x767f('0x33')]=_['keys'](db['UserProfile'][_0x767f('0x32')]);_0x3d77d9[_0x767f('0x38')]=_[_0x767f('0x37')](_0xbd4a39[_0x767f('0x33')],qs[_0x767f('0x39')](_0x3726b9[_0x767f('0x35')][_0x767f('0x39')]));_0x3d77d9[_0x767f('0x38')]=_0x3d77d9[_0x767f('0x38')][_0x767f('0x4b')]?_0x3d77d9[_0x767f('0x38')]:_0xbd4a39[_0x767f('0x33')];if(_0x3726b9[_0x767f('0x35')][_0x767f('0x44')]){_0x3d77d9[_0x767f('0x45')]=[{'all':!![]}];}_0x3d77d9=_[_0x767f('0x40')]({},_0x3d77d9,_0x3726b9['options']);return db[_0x767f('0x31')][_0x767f('0x4c')](_0x3d77d9)[_0x767f('0x2b')](handleEntityNotFound(_0x2989a6,null))['then'](function(_0x1fce49){if(_0x1fce49){var _0x45c30d=_0x1fce49[_0x767f('0x50')]({'plain':!![]});_0x45c30d=qs['omit'](_0x45c30d,['id',_0x767f('0x51'),_0x767f('0x52'),_0x767f('0x53')]);_0x3726b9[_0x767f('0x4e')]=_[_0x767f('0x54')](_0x3726b9[_0x767f('0x4e')],['id','createdAt',_0x767f('0x52')]);return db[_0x767f('0x55')]['transaction'](function(_0x219a76){return db[_0x767f('0x31')][_0x767f('0x4d')](_[_0x767f('0x40')](_0x45c30d,_0x3726b9[_0x767f('0x4e')]),{'include':_0x3726b9[_0x767f('0x35')][_0x767f('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x219a76})['then'](function(_0xb38b3c){var _0x5905bd=_0xb38b3c[_0x767f('0x50')]({'plain':!![]});return db[_0x767f('0x56')][_0x767f('0x46')]({'where':{'userProfileId':_0x3726b9[_0x767f('0x49')]['id']},'raw':!![]})['then'](function(_0x2511a8){if(_0x2511a8){return BPromise[_0x767f('0x57')](_0x2511a8,function(_0x30d9e5){return new BPromise(function(_0x4ca347,_0xb345b6){if(_0x30d9e5['autoAssociation']===null||_0x30d9e5[_0x767f('0x58')]===0x1)_0x4ca347(null);return db['UserProfileResource'][_0x767f('0x46')]({'where':{'sectionId':_0x30d9e5['id']},'raw':!![]})['then'](function(_0x28c299){var _0x4c99f7=_[_0x767f('0x34')](_0x28c299,function(_0xa86782){return qs[_0x767f('0x54')](_0xa86782,['id',_0x767f('0x51'),'updatedAt',_0x767f('0x59')]);});_0x4ca347(_0x4c99f7);})['catch'](function(_0x2b6987){_0xb345b6(_0x2b6987);});})[_0x767f('0x2b')](function(_0x16f65d){var _0x1d88ca=qs['omit'](_0x30d9e5,['id','createdAt',_0x767f('0x52')]);_0x1d88ca[_0x767f('0x5a')]=_0x5905bd['id'];if(_0x16f65d)_0x1d88ca[_0x767f('0x5b')]=_0x16f65d;return _0x1d88ca;})['then'](function(_0x179379){return db[_0x767f('0x56')][_0x767f('0x4d')](_0x179379,{'include':[{'model':db[_0x767f('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x219a76});});})['then'](function(){return _0x5905bd;});}});});});}})[_0x767f('0x2b')](respondWithResult(_0x2989a6,0xc9))[_0x767f('0x48')](handleError(_0x2989a6,null));};exports[_0x767f('0x29')]=function(_0xfce106,_0x324d4e){if(_0xfce106['body']['id']){delete _0xfce106[_0x767f('0x4e')]['id'];}return db[_0x767f('0x31')][_0x767f('0x4c')]({'where':{'id':_0xfce106[_0x767f('0x49')]['id']}})[_0x767f('0x2b')](handleEntityNotFound(_0x324d4e,null))[_0x767f('0x2b')](saveUpdates(_0xfce106[_0x767f('0x4e')],null))[_0x767f('0x2b')](respondWithResult(_0x324d4e,null))[_0x767f('0x48')](handleError(_0x324d4e,null));};exports[_0x767f('0x2a')]=function(_0x3f9d5c,_0x3cd052){return db[_0x767f('0x31')]['find']({'where':{'id':_0x3f9d5c[_0x767f('0x49')]['id']}})[_0x767f('0x2b')](handleEntityNotFound(_0x3cd052,null))['then'](removeEntity(_0x3cd052,null))[_0x767f('0x48')](handleError(_0x3cd052,null));};exports['describe']=function(_0x3cc91f,_0x11cc06){return db[_0x767f('0x31')]['describe']()[_0x767f('0x2b')](respondWithResult(_0x11cc06,null))['catch'](handleError(_0x11cc06,null));};exports[_0x767f('0x5d')]=function(_0x2580cf,_0x2a0f03){var _0x459c36=_0x2580cf[_0x767f('0x4e')];return db[_0x767f('0x31')][_0x767f('0x4c')]({'where':{'id':_0x2580cf['params']['id']}})['then'](handleEntityNotFound(_0x2a0f03,null))[_0x767f('0x2b')](function(_0x32df2a){if(_0x32df2a){return db[_0x767f('0x55')][_0x767f('0x5e')](function(_0x12679b){return db[_0x767f('0x56')]['destroy']({'where':{'userProfileId':_0x2580cf['params']['id'],'sectionId':_['map'](_0x459c36,function(_0x111292){return _0x111292['sectionId'];})},'transaction':_0x12679b})['then'](function(){var _0x28b998=_[_0x767f('0x34')](_0x459c36,function(_0x1b34e8){_0x1b34e8['userProfileId']=_0x2580cf[_0x767f('0x49')]['id'];return _0x1b34e8;});var _0x3ecdd5=[];return BPromise['each'](_0x28b998,function(_0x34b628){return db['UserProfileSection'][_0x767f('0x4d')](_0x34b628,{'include':[{'model':db[_0x767f('0x5c')],'as':_0x767f('0x5b')}],'raw':!![],'transaction':_0x12679b})[_0x767f('0x2b')](function(_0xcdaa94){_0x3ecdd5[_0x767f('0x5f')](_0xcdaa94[_0x767f('0x50')]({'plain':!![]}));});})[_0x767f('0x2b')](function(){return _0x3ecdd5;});});});}})[_0x767f('0x2b')](function(_0xe75908){return _0xe75908;})[_0x767f('0x2b')](respondWithResult(_0x2a0f03,null))[_0x767f('0x48')](handleError(_0x2a0f03,null));};exports[_0x767f('0x60')]=function(_0x1d058f,_0x4883df){var _0xa69325;return db[_0x767f('0x31')][_0x767f('0x4c')]({'where':{'id':_0x1d058f[_0x767f('0x49')]['id']},'attributes':['id',_0x767f('0x2e')]})[_0x767f('0x2b')](handleEntityNotFound(_0x4883df,null))[_0x767f('0x2b')](function(_0x2ee2f8){if(_0x2ee2f8){_0xa69325=_0x2ee2f8;return db[_0x767f('0x56')][_0x767f('0x2a')]({'where':{'userProfileId':_0x1d058f[_0x767f('0x49')]['id'],'sectionId':_0x1d058f[_0x767f('0x35')][_0x767f('0x61')]}});}})[_0x767f('0x2b')](function(){return _0xa69325;})[_0x767f('0x2b')](respondWithStatusCode(_0x4883df,null))['catch'](handleError(_0x4883df,null));};exports[_0x767f('0x62')]=function(_0x395ede,_0x28706f){var _0x111c2b=[];var _0x1a7d47=[];return db[_0x767f('0x56')]['findAll']({'where':{'userProfileId':_0x395ede[_0x767f('0x49')]['id']},'raw':!![]})[_0x767f('0x2b')](function(_0x5a0c5d){_0x111c2b=_[_0x767f('0x3f')](_0x5a0c5d,function(_0x4faa02){return _0x4faa02[_0x767f('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x4faa02[_0x767f('0x59')]);});if(!_[_0x767f('0x64')](_0x111c2b)){return _[_0x767f('0x34')](_0x111c2b,function(_0x2227e5){return _0x2227e5[_0x767f('0x59')];});}else{return;}})[_0x767f('0x2b')](function(_0x16827c){if(_0x16827c)_0x1a7d47=_0x16827c;if(_[_0x767f('0x65')](_0x1a7d47,0x64)){var _0x1cde26=_[_0x767f('0x4c')](_0x111c2b,{'sectionId':0x64});return hasDefaultDashboard(_0x1cde26)[_0x767f('0x2b')](function(_0x5c0334){return _['map'](_0x111c2b,function(_0x5725c2){if(_0x5725c2[_0x767f('0x59')]===0x64){_0x5725c2[_0x767f('0x66')]=_0x5c0334;}return _0x5725c2;});});}else{return;}})['then'](function(_0x433520){if(_0x433520)_0x111c2b=_0x433520;if(_[_0x767f('0x65')](_0x1a7d47,0x3eb)){var _0x55ac87=_[_0x767f('0x4c')](_0x111c2b,{'sectionId':0x3eb});return getCustomDashboards(_0x55ac87)[_0x767f('0x2b')](function(_0x57800f){return _[_0x767f('0x34')](_0x111c2b,function(_0x49ad08){if(_0x55ac87[_0x767f('0x63')]){if(_0x49ad08[_0x767f('0x59')]===0x3eb){_0x49ad08[_0x767f('0x66')]=_0x57800f;}}else{if(_0x49ad08['sectionId']===0x64){_0x49ad08[_0x767f('0x66')]=_0x57800f;}}return _0x49ad08;});});}else{return;}})['then'](function(_0x43a039){if(_0x43a039)_0x111c2b=_0x43a039;if(_[_0x767f('0x65')](_0x1a7d47,0x709)){var _0x26ed6c=_[_0x767f('0x4c')](_0x111c2b,{'sectionId':0x709});return getPlugins(_0x26ed6c)[_0x767f('0x2b')](function(_0x5a7123){if(_0x26ed6c['enabled']){return _[_0x767f('0x34')](_0x111c2b,function(_0x233697){if(_0x233697[_0x767f('0x59')]===0x709){_0x233697[_0x767f('0x66')]=_0x5a7123;}return _0x233697;});}else{var _0x4b775a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5a7123};var _0x3880e3=_[_0x767f('0x34')](_0x111c2b);_0x3880e3[_0x767f('0x5f')](_0x4b775a);return _0x3880e3;}});}else{return;}})[_0x767f('0x2b')](function(_0x22e6e7){if(_0x22e6e7)_0x111c2b=_0x22e6e7;return _[_0x767f('0x3f')](_0x111c2b,[_0x767f('0x63'),0x1]);})['then'](respondWithResult(_0x28706f,null))[_0x767f('0x48')](handleError(_0x28706f,null));};function hasDefaultDashboard(_0x544259){var _0x3f0c10=[0x65];return new BPromise(function(_0x24a0fe,_0x316ff7){try{if(_0x544259[_0x767f('0x58')]){_0x24a0fe(_0x3f0c10);}else{return db[_0x767f('0x5c')][_0x767f('0x67')]({'where':{'sectionId':_0x544259['id']},'raw':!![]})[_0x767f('0x2b')](function(_0x4f5b57){_0x4f5b57?_0x24a0fe(_0x3f0c10):_0x24a0fe();});}}catch(_0x36eb4c){_0x316ff7(_0x36eb4c);}});}function getCustomDashboards(_0x4548d3){var _0x1d6c21=[];return new BPromise(function(_0x1af68e,_0xb21ea6){try{if(_0x4548d3['autoAssociation']){return db[_0x767f('0x68')][_0x767f('0x46')]({'raw':!![]})[_0x767f('0x2b')](function(_0x492efa){_0x492efa[_0x767f('0x69')](function(_0x2d762a){_0x1d6c21[_0x767f('0x5f')](_0x2d762a['id']+0x1869f);});_0x1af68e(_0x1d6c21);});}else{return db[_0x767f('0x5c')]['findAll']({'where':{'sectionId':_0x4548d3['id']},'raw':!![]})[_0x767f('0x2b')](function(_0x5eab4d){_0x5eab4d[_0x767f('0x69')](function(_0x47abda){_0x1d6c21[_0x767f('0x5f')](_0x47abda[_0x767f('0x6a')]+0x1869f);});_0x1af68e(_0x1d6c21);});}}catch(_0x4a661f){_0xb21ea6(_0x4a661f);}});}function getPlugins(_0xf3f66){var _0x100d27=[];return new BPromise(function(_0x56aee2,_0xd79a2d){try{if(_0xf3f66[_0x767f('0x58')]){return db['Plugin'][_0x767f('0x46')]({'raw':!![]})[_0x767f('0x2b')](function(_0x3dda19){_0x3dda19[_0x767f('0x69')](function(_0x52b1c8){_0x100d27[_0x767f('0x5f')](_0x52b1c8['id']+0x15b38);});_0x56aee2(_0x100d27);});}else{return db[_0x767f('0x5c')][_0x767f('0x46')]({'where':{'sectionId':_0xf3f66['id']},'raw':!![]})[_0x767f('0x2b')](function(_0xed67ef){_0xed67ef['forEach'](function(_0x6b694e){_0x100d27[_0x767f('0x5f')](_0x6b694e[_0x767f('0x6a')]+0x15b38);});_0x56aee2(_0x100d27);});}}catch(_0x251d5f){_0xd79a2d(_0x251d5f);}});}exports['addResources']=function(_0x120c19,_0x100907){return db[_0x767f('0x31')][_0x767f('0x4c')]({'where':{'id':_0x120c19[_0x767f('0x49')]['id']}})[_0x767f('0x2b')](handleEntityNotFound(_0x100907,null))[_0x767f('0x2b')](function(_0x49765f){if(_0x49765f){return db['sequelize'][_0x767f('0x5e')](function(_0x5caa22){return db[_0x767f('0x56')][_0x767f('0x46')]({'where':{'userProfileId':_0x120c19[_0x767f('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x767f('0x2b')](function(_0x3d2e75){if(_0x3d2e75){return db[_0x767f('0x56')][_0x767f('0x2a')]({'where':{'userProfileId':_0x120c19[_0x767f('0x49')]['id'],'id':_[_0x767f('0x34')](_0x3d2e75,function(_0x167438){return _0x167438['id'];})},'transaction':_0x5caa22});}})[_0x767f('0x2b')](function(_0x476592){var _0x2a11d1=_[_0x767f('0x34')](_0x120c19[_0x767f('0x4e')],function(_0xb786c7){_0xb786c7[_0x767f('0x5a')]=_0x120c19[_0x767f('0x49')]['id'];return _0xb786c7;});return db['UserProfileSection'][_0x767f('0x6b')](_0x2a11d1,{'raw':!![],'transaction':_0x5caa22});})['then'](function(_0x22c5ba){var _0xb2de3=_[_0x767f('0x3f')](_[_0x767f('0x34')](_0x22c5ba,function(_0x4f0206){return _0x4f0206[_0x767f('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0xb2de3){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x120c19[_0x767f('0x49')]['id'],'sectionId':_[_0x767f('0x34')](_0xb2de3,function(_0x11d510){return _0x11d510['sectionId'];})},'attributes':['id',_0x767f('0x59')],'raw':!![]})[_0x767f('0x2b')](function(_0x3acb87){var _0x592cc3=_['map'](_0x120c19[_0x767f('0x4e')],function(_0x1a0695){_0x1a0695[_0x767f('0x5a')]=_0x120c19['params']['id'];return _0x1a0695;});return db[_0x767f('0x5c')][_0x767f('0x6b')](_0x592cc3,{'raw':!![],'transaction':_0x5caa22});});}})[_0x767f('0x48')](handleError(_0x100907,null));});}})[_0x767f('0x2b')](function(_0x390a9c){var _0x5bc74b=_[_0x767f('0x34')](_0x390a9c,function(_0x481171){return _0x481171[_0x767f('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x100907,null))[_0x767f('0x48')](handleError(_0x100907,null));};exports[_0x767f('0x6c')]=function(_0x239eb7,_0x21dd8e,_0x21fb8f){return db[_0x767f('0x31')]['find']({'where':{'id':_0x239eb7[_0x767f('0x49')]['id']}})['then'](handleEntityNotFound(_0x21dd8e,null))[_0x767f('0x2b')](function(_0x624dc6){if(_0x624dc6){return _0x624dc6[_0x767f('0x6c')](_0x239eb7[_0x767f('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x21dd8e,null))['catch'](handleError(_0x21dd8e,null));};exports[_0x767f('0x6d')]=function(_0x35378b,_0x52e6dd){var _0x3f6e4c={'raw':![],'where':{}};var _0x929bfd={};var _0x286106={'count':0x0,'rows':[]};var _0x4faaa5=_0x35378b[_0x767f('0x35')][_0x767f('0x6e')];if(typeof _0x4faaa5===_0x767f('0x6f')){throw new db[(_0x767f('0x70'))]['ValidationError']('Unknown\x20section');}var _0x329d0f=_0x35378b['query'][_0x767f('0x71')]||![];var _0x524bfb=getQueryModels(_0x4faaa5,_0x329d0f);if(typeof _0x524bfb['childModel']===_0x767f('0x6f')){throw new db['Sequelize'][(_0x767f('0x72'))](_0x767f('0x73')+_0x4faaa5+'\x27');}var _0x6f2561=[];if(!_[_0x767f('0x64')](_0x524bfb[_0x767f('0x74')])){_0x6f2561=_0x524bfb[_0x767f('0x74')];}else{_0x6f2561=[{'name':_0x4faaa5}];}return db[_0x767f('0x31')][_0x767f('0x67')]({'where':{'id':_0x35378b[_0x767f('0x49')]['id']}})['then'](handleEntityNotFound(_0x52e6dd,null))[_0x767f('0x2b')](function(_0x5b52b4){if(_0x5b52b4){var _0x291772=[];for(var _0x582a2e=0x0;_0x582a2e<_0x6f2561[_0x767f('0x4b')];_0x582a2e++){_0x291772[_0x767f('0x5f')](db['UserProfileSection'][_0x767f('0x67')]({'where':{'userProfileId':_0x5b52b4['id'],'name':_0x6f2561[_0x582a2e][_0x767f('0x2e')]},'raw':!![]}));}return BPromise[_0x767f('0x75')](_0x291772);}})[_0x767f('0x2b')](function(_0x111e9b){var _0x21bbf6=_[_0x767f('0x3f')](_0x111e9b,function(_0x14dd46){return _0x14dd46?_0x14dd46:undefined;});var _0x14f5d6=_[_0x767f('0x3f')](_0x6f2561,[_0x767f('0x76'),!![]]);var _0x121bc7=_['isEmpty'](_0x21bbf6)&&_['isEmpty'](_0x14f5d6)?null:_['union'](_0x14f5d6,_0x21bbf6);if(_0x121bc7){var _0x3914d2=[];for(var _0x50b4cf=0x0;_0x50b4cf<_0x121bc7[_0x767f('0x4b')];_0x50b4cf++){var _0x331b6f=_['find'](_0x6f2561,function(_0x134e12){return _0x121bc7[_0x50b4cf]?_0x134e12[_0x767f('0x2e')]===_0x121bc7[_0x50b4cf][_0x767f('0x2e')]:null;});if(_0x331b6f){if(_0x121bc7[_0x50b4cf][_0x767f('0x76')]){_0x3914d2['push'](getAllResources(_0x524bfb[_0x767f('0x77')],_0x121bc7[_0x50b4cf]));}else{if(!_0x121bc7[_0x50b4cf][_0x767f('0x58')]){_0x3914d2[_0x767f('0x5f')](getAllowedResources(_0x331b6f,_0x121bc7[_0x50b4cf],_0x524bfb['childModel']));}else{if(_0x331b6f['model']){_0x3914d2[_0x767f('0x5f')](getAllFilteredResources(_0x331b6f,_0x121bc7[_0x50b4cf]));}}}}}return BPromise[_0x767f('0x75')](_0x3914d2);}else{return null;}})[_0x767f('0x2b')](function(_0xe92111){var _0x215bec=_0xe92111;var _0x4d3192=null;if(_0x215bec){_0x4d3192=_0x215bec['length']===0x1?_0x215bec[0x0]:null;}if(_0x4d3192||_0x215bec){var _0x4ad902=db[_0x524bfb[_0x767f('0x77')]][_0x767f('0x32')];_0x929bfd[_0x767f('0x33')]=_[_0x767f('0x4a')](_0x4ad902);_0x929bfd[_0x767f('0x35')]=_['keys'](_0x35378b[_0x767f('0x35')]);_0x929bfd[_0x767f('0x36')]=_['intersection'](_0x929bfd[_0x767f('0x33')],_0x929bfd[_0x767f('0x35')]);_0x3f6e4c[_0x767f('0x38')]=_[_0x767f('0x37')](_0x929bfd[_0x767f('0x33')],qs['fields'](_0x35378b[_0x767f('0x35')][_0x767f('0x39')]));_0x3f6e4c[_0x767f('0x38')]=_0x3f6e4c[_0x767f('0x38')][_0x767f('0x4b')]?_0x3f6e4c[_0x767f('0x38')]:_0x929bfd[_0x767f('0x33')];if(!_0x35378b['query'][_0x767f('0x3a')](_0x767f('0x3b'))){_0x3f6e4c['limit']=qs[_0x767f('0x24')](_0x35378b['query'][_0x767f('0x24')]);_0x3f6e4c[_0x767f('0x23')]=qs['offset'](_0x35378b[_0x767f('0x35')][_0x767f('0x23')]);}_0x3f6e4c['order']=qs[_0x767f('0x3c')](_0x35378b['query'][_0x767f('0x3c')]);_0x3f6e4c[_0x767f('0x3d')]=qs[_0x767f('0x36')](_[_0x767f('0x3e')](_0x35378b['query'],_0x929bfd[_0x767f('0x36')]));if(_0x35378b['query']['filter']){_0x3f6e4c['where']=_[_0x767f('0x40')](_0x3f6e4c['where'],{'$or':_[_0x767f('0x34')](_0x4ad902,function(_0x12a2af){if(_0x12a2af[_0x767f('0x41')][_0x767f('0x78')]!==_0x767f('0x79')){var _0x54d5d3={};_0x54d5d3[_0x12a2af[_0x767f('0x7a')]]={'$like':'%'+_0x35378b[_0x767f('0x35')][_0x767f('0x3f')]+'%'};return _0x54d5d3;}})});}var _0x478e31=[];if(_0x4d3192){var _0x9f159d=_['find'](_0x6f2561,['name',_0x4d3192[_0x767f('0x2e')]]);if(_0x9f159d[_0x767f('0x7a')]){var _0xd0a570={};if(_0x524bfb[_0x767f('0x77')]===_0x767f('0x7b')){_0xd0a570[_0x9f159d[_0x767f('0x7c')]]=_[_0x767f('0x34')](_0x4d3192[_0x767f('0x7d')],'id');}else{_0xd0a570[_0x9f159d[_0x767f('0x7c')]]=_0x4d3192[_0x767f('0x7d')];}_0x478e31['push'](_0xd0a570);}else{_0x3f6e4c[_0x767f('0x3d')]['id']=_0x4d3192[_0x767f('0x7d')];}}else{for(var _0x38ac60=0x0;_0x38ac60<_0x215bec[_0x767f('0x4b')];_0x38ac60++){var _0x9f159d=_[_0x767f('0x4c')](_0x6f2561,['name',_0x215bec[_0x38ac60][_0x767f('0x2e')]]);if(_0x9f159d['field']){var _0xd0a570={};_0xd0a570[_0x9f159d['foreignKey']]=_0x215bec[_0x38ac60][_0x767f('0x7d')];_0x478e31[_0x767f('0x5f')](_0xd0a570);}else{if(!_0x3f6e4c['where']['id'])_0x3f6e4c[_0x767f('0x3d')]['id']=[];_0x215bec[_0x38ac60][_0x767f('0x7d')]['forEach'](function(_0x4b5008){_0x3f6e4c[_0x767f('0x3d')]['id']['push'](_0x4b5008);});}}}if(!_['isEmpty'](_0x478e31)){_0x3f6e4c[_0x767f('0x3d')]=_[_0x767f('0x40')](_0x3f6e4c[_0x767f('0x3d')],{'$and':{'$or':_0x478e31}});}_0x3f6e4c=_[_0x767f('0x40')]({},_0x3f6e4c,_0x35378b[_0x767f('0x42')]);if(_0x4d3192&&!_0x4d3192[_0x767f('0x58')]&&_0x524bfb[_0x767f('0x77')]===_0x767f('0x7b')){if(_0x35378b['query']['includeAll']){_0x3f6e4c[_0x767f('0x45')]=[{'all':!![]}];}return db[_0x524bfb[_0x767f('0x77')]][_0x767f('0x46')](_0x3f6e4c)[_0x767f('0x2b')](function(_0x199887){var _0x207a89=[];_0x199887[_0x767f('0x69')](function(_0x326243){var _0x48abcb;switch(_0x326243[_0x767f('0x7e')]){case _0x767f('0x7f'):_0x48abcb=_['find'](_0x4d3192['associatedResources'],function(_0x5b7b56){return _0x5b7b56['id']===_0x326243[_0x767f('0x80')]&&_0x5b7b56['type']===_0x767f('0x81');});break;case _0x767f('0x82'):_0x48abcb=_[_0x767f('0x4c')](_0x4d3192['associatedResources'],function(_0x64666c){return _0x64666c['id']===_0x326243['reportId']&&_0x64666c[_0x767f('0x41')]===_0x767f('0x83');});break;}if(_0x48abcb)_0x207a89[_0x767f('0x5f')](_0x326243);});_0x286106[_0x767f('0x43')]=_0x207a89['length'];_0x286106['rows']=_0x207a89;return _0x286106;});}else{return db[_0x524bfb[_0x767f('0x77')]][_0x767f('0x43')]({'where':_0x3f6e4c[_0x767f('0x3d')]})[_0x767f('0x2b')](function(_0x1ba70b){_0x286106['count']=_0x1ba70b;if(_0x35378b[_0x767f('0x35')]['includeAll']){if(_0x524bfb['childModel']===_0x767f('0x84')){_0x3f6e4c['include']=[{'model':db[_0x767f('0x85')],'as':'Tags','attributes':['id',_0x767f('0x2e'),'color'],'required':_0x35378b[_0x767f('0x35')][_0x767f('0x86')]?!![]:![]},{'model':db[_0x767f('0x85')],'as':_0x767f('0x87'),'attributes':['id','name',_0x767f('0x88')],'through':_0x35378b[_0x767f('0x35')][_0x767f('0x86')]?{'attributes':[],'where':{'TagId':_0x35378b[_0x767f('0x35')][_0x767f('0x86')]||undefined}}:{},'required':_0x35378b[_0x767f('0x35')]['tag']?!![]:![]}];}else{_0x3f6e4c[_0x767f('0x45')]=[{'all':!![]}];}}return db[_0x524bfb['childModel']][_0x767f('0x46')](_0x3f6e4c);})[_0x767f('0x2b')](function(_0xe76aae){_0x286106[_0x767f('0x47')]=_0xe76aae;return _0x286106;});}}else{return _0x286106;}})[_0x767f('0x2b')](respondWithFilteredResult(_0x52e6dd,_0x3f6e4c))[_0x767f('0x48')](handleError(_0x52e6dd,null));};function getAllResources(_0x216a84,_0x35627d){return new BPromise(function(_0x128848,_0x2f43cd){if(_0x35627d){var _0x320a46=_0x35627d['filter']?{[_0x35627d[_0x767f('0x3f')][_0x767f('0x7a')]]:_0x35627d[_0x767f('0x3f')]['value']}:undefined;return db[_0x216a84][_0x767f('0x46')]({'where':_0x320a46,'raw':!![]})[_0x767f('0x2b')](function(_0x28deba){_0x35627d[_0x767f('0x7d')]=_[_0x767f('0x34')](_0x28deba,'id');_0x128848(_0x35627d);})['catch'](function(_0x111ad3){_0x2f43cd(_0x111ad3);});}else{_0x128848(null);}});}function getAllFilteredResources(_0x2373e6,_0x5b4a23){return new BPromise(function(_0x24ff8a,_0x330ae2){var _0x5aa35d=_0x2373e6[_0x767f('0x3f')]?{[_0x2373e6[_0x767f('0x3f')][_0x767f('0x7a')]]:_0x2373e6['filter'][_0x767f('0x89')]}:undefined;return db[_0x2373e6[_0x767f('0x33')]][_0x767f('0x46')]({'where':_0x5aa35d,'raw':!![]})[_0x767f('0x2b')](function(_0x321263){_0x5b4a23[_0x767f('0x7d')]=_[_0x767f('0x34')](_0x321263,function(_0x48040c){return _0x48040c['name'];});_0x24ff8a(_0x5b4a23);})[_0x767f('0x48')](function(_0x5c3217){_0x330ae2(_0x5c3217);});});}function getAllowedResources(_0x325539,_0x27b570,_0x4876b9){return new BPromise(function(_0x933f46,_0x4f0b3c){if(_0x27b570){return db[_0x767f('0x5c')][_0x767f('0x46')]({'where':{'sectionId':_0x27b570['id']},'raw':!![]})['then'](function(_0xe77446){if(_0x325539['field']&&_0x325539[_0x767f('0x7a')]!=='id'){_0x27b570['associatedResources']=_[_0x767f('0x34')](_0xe77446,function(_0x30b5b9){return _0x30b5b9[_0x325539[_0x767f('0x7a')]];});}else{if(_0x4876b9==='AnalyticExtractedReport'){_0x27b570['associatedResources']=_[_0x767f('0x34')](_0xe77446,function(_0x5b264e){return{'id':_0x5b264e[_0x767f('0x6a')],'type':_0x5b264e[_0x767f('0x41')]};});}else{_0x27b570[_0x767f('0x7d')]=_[_0x767f('0x34')](_0xe77446,function(_0xecc6c9){return _0xecc6c9[_0x767f('0x6a')];});}}_0x933f46(_0x27b570);})[_0x767f('0x48')](function(_0x48ad0d){_0x4f0b3c(_0x48ad0d);});}else{_0x933f46(null);}});}function getQueryModels(_0x2e5b01,_0x3fd777){var _0x2ba25c=_0x2e5b01[_0x767f('0x8a')]();var _0x3a5ecc={'childModel':undefined,'parentSections':[]};switch(_0x2ba25c){case _0x767f('0x8b'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x8c');break;case _0x767f('0x8d'):_0x3a5ecc['childModel']='SquareOdbc';break;case'squarerecordings':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x8e');_0x3a5ecc[_0x767f('0x74')]=[{'name':_0x767f('0x8f'),'field':_0x767f('0x2e'),'foreignKey':'projectName'}];break;case'projects':_0x3a5ecc['childModel']=_0x767f('0x90');break;case _0x767f('0x91'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x84');_0x3a5ecc['parentSections']=[{'name':_0x767f('0x92'),'field':'id','foreignKey':_0x767f('0x93')}];break;case'lists':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x94');break;case'companies':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x95');break;case _0x767f('0x96'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x97');break;case _0x767f('0x98'):_0x3a5ecc[_0x767f('0x77')]='ChatQueue';break;case _0x767f('0x99'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x9a');break;case _0x767f('0x9b'):_0x3a5ecc['childModel']=_0x767f('0x9c');break;case'faxaccounts':_0x3a5ecc[_0x767f('0x77')]='FaxAccount';break;case'inboundroutes':case _0x767f('0x9d'):case'outboundroutes':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x9e');break;case _0x767f('0x9f'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xa0');break;case _0x767f('0xa1'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xa2');break;case _0x767f('0xa3'):_0x3a5ecc['childModel']=_0x767f('0xa4');_0x3a5ecc[_0x767f('0x74')]=[{'name':_0x767f('0xa5'),'field':_0x767f('0x2e'),'foreignKey':_0x767f('0xa6'),'model':_0x767f('0xa7'),'filter':{'field':_0x767f('0xa8'),'value':[_0x767f('0xa9')]}},{'name':_0x767f('0xaa'),'field':_0x767f('0x2e'),'foreignKey':_0x767f('0xa6'),'model':'User','filter':{'field':'role','value':['telephone']}},{'name':'VoiceQueues','field':_0x767f('0x2e'),'foreignKey':_0x767f('0xab'),'model':_0x767f('0xac'),'filter':{'field':_0x767f('0x41'),'value':[_0x767f('0xad')]}},{'name':_0x767f('0xae'),'field':_0x767f('0x2e'),'foreignKey':_0x767f('0xab'),'model':'VoiceQueue','filter':{'field':_0x767f('0x41'),'value':[_0x767f('0xaf')]}}];break;case _0x767f('0xb0'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xb1');break;case _0x767f('0xb2'):_0x3a5ecc['childModel']=_0x767f('0xb3');break;case _0x767f('0xb4'):_0x3a5ecc['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xb5');break;case _0x767f('0xb6'):_0x3a5ecc[_0x767f('0x77')]='MailQueue';break;case _0x767f('0xb7'):_0x3a5ecc['childModel']='MailAccount';break;case _0x767f('0xb8'):_0x3a5ecc['childModel']=_0x767f('0xb9');break;case _0x767f('0xba'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xbb');break;case _0x767f('0xbc'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xbd');break;case _0x767f('0xbe'):_0x3a5ecc['childModel']=_0x767f('0xbf');break;case _0x767f('0xc0'):_0x3a5ecc['childModel']=_0x767f('0xc1');break;case _0x767f('0xc2'):_0x3a5ecc['childModel']=_0x767f('0xc3');break;case _0x767f('0xc4'):_0x3a5ecc['childModel']=_0x767f('0xc5');break;case'teams':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xc6');break;case _0x767f('0xc7'):case _0x767f('0xc8'):_0x3a5ecc[_0x767f('0x77')]='VoiceQueue';if(_0x3fd777){_0x3a5ecc[_0x767f('0x74')]=[{'name':_0x767f('0xc9')},{'name':_0x767f('0xae')}];}break;case _0x767f('0xca'):case _0x767f('0xcb'):case'telephones':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xa7');if(_0x3fd777){_0x3a5ecc[_0x767f('0x74')]=[{'name':_0x767f('0xcc'),'filter':{'field':_0x767f('0xa8'),'value':[_0x767f('0xcd'),_0x767f('0xce')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x767f('0xcf'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xd0');break;case'salesforceaccounts':_0x3a5ecc['childModel']=_0x767f('0xd1');break;case _0x767f('0xd2'):_0x3a5ecc['childModel']=_0x767f('0xd3');break;case _0x767f('0xd4'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xd5');break;case'deskaccounts':_0x3a5ecc['childModel']=_0x767f('0xd6');break;case _0x767f('0xd7'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xd8');break;case _0x767f('0xd9'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xa7');break;case _0x767f('0xda'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xdb');break;case _0x767f('0xdc'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xdd');break;case'customdashboards':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x68');break;case'intervals':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xde');break;case _0x767f('0xdf'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xe0');break;case _0x767f('0xe1'):_0x3a5ecc[_0x767f('0x77')]='Schedule';break;case _0x767f('0xe2'):_0x3a5ecc['childModel']=_0x767f('0xe3');break;case _0x767f('0xe4'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x85');break;case _0x767f('0xe5'):_0x3a5ecc['childModel']=_0x767f('0xe6');break;case _0x767f('0xe7'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xe8');break;case _0x767f('0xe9'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xea');break;case'variables':_0x3a5ecc[_0x767f('0x77')]='Variable';break;case'plugins':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xeb');break;case _0x767f('0xec'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x7b');_0x3a5ecc[_0x767f('0x74')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x767f('0xed'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xee');break;case _0x767f('0xc4'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xc5');break;default:return _0x3a5ecc;}return _0x3a5ecc;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 0804eda..73d3981 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 _0x005b=['exports','events','../../mysqldb','UserProfile','save','update','emit','hook'];(function(_0x1bb768,_0x325823){var _0x1817fc=function(_0x390db8){while(--_0x390db8){_0x1bb768['push'](_0x1bb768['shift']());}};_0x1817fc(++_0x325823);}(_0x005b,0x1a1));var _0xb005=function(_0x58e85b,_0x45680e){_0x58e85b=_0x58e85b-0x0;var _0x2c5859=_0x005b[_0x58e85b];return _0x2c5859;};'use strict';var EventEmitter=require(_0xb005('0x0'));var UserProfile=require(_0xb005('0x1'))['db'][_0xb005('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb005('0x3'),'afterUpdate':_0xb005('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20ab7b){return function(_0x2ebb67,_0x38dad1,_0x52b01f){UserProfileEvents[_0xb005('0x5')](_0x20ab7b+':'+_0x2ebb67['id'],_0x2ebb67);UserProfileEvents[_0xb005('0x5')](_0x20ab7b,_0x2ebb67);_0x52b01f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xb005('0x6')](e,emitEvent(event));}}module[_0xb005('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x297c=['remove','emit','hook','exports','events','UserProfile','setMaxListeners','save','update'];(function(_0x3b2b6a,_0x172d8e){var _0xb7f2a=function(_0x35d08f){while(--_0x35d08f){_0x3b2b6a['push'](_0x3b2b6a['shift']());}};_0xb7f2a(++_0x172d8e);}(_0x297c,0xe5));var _0xc297=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x297c[_0x18cd5b];return _0x5eaa52;};'use strict';var EventEmitter=require(_0xc297('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xc297('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc297('0x2')](0x0);var events={'afterCreate':_0xc297('0x3'),'afterUpdate':_0xc297('0x4'),'afterDestroy':_0xc297('0x5')};function emitEvent(_0x21eb4d){return function(_0x1fc262,_0x2fdfd3,_0x7da889){UserProfileEvents[_0xc297('0x6')](_0x21eb4d+':'+_0x1fc262['id'],_0x1fc262);UserProfileEvents['emit'](_0x21eb4d,_0x1fc262);_0x7da889(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xc297('0x7')](e,emitEvent(event));}}module[_0xc297('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2cc04c0..95c0950 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 _0xc7c8=['bluebird','request-promise','path','rimraf','exports','user_profiles','lodash','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc7c8,0x1df));var _0x8c7c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc7c8[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x8c7c('0x0'));var util=require(_0x8c7c('0x1'));var logger=require(_0x8c7c('0x2'))(_0x8c7c('0x3'));var moment=require(_0x8c7c('0x4'));var BPromise=require(_0x8c7c('0x5'));var rp=require(_0x8c7c('0x6'));var fs=require('fs');var path=require(_0x8c7c('0x7'));var rimraf=require(_0x8c7c('0x8'));var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module[_0x8c7c('0x9')]=function(_0x24d915,_0x2144fd){return _0x24d915['define']('UserProfile',attributes,{'tableName':_0x8c7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9c5=['define','UserProfile','user_profiles','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userProfile.attributes','exports'];(function(_0x1e22a4,_0x1dba54){var _0x8e8535=function(_0x10ddd2){while(--_0x10ddd2){_0x1e22a4['push'](_0x1e22a4['shift']());}};_0x8e8535(++_0x1dba54);}(_0xf9c5,0xb9));var _0x5f9c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf9c5[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x5f9c('0x0'));var util=require(_0x5f9c('0x1'));var logger=require('../../config/logger')(_0x5f9c('0x2'));var moment=require(_0x5f9c('0x3'));var BPromise=require(_0x5f9c('0x4'));var rp=require(_0x5f9c('0x5'));var fs=require('fs');var path=require(_0x5f9c('0x6'));var rimraf=require('rimraf');var config=require(_0x5f9c('0x7'));var attributes=require(_0x5f9c('0x8'));module[_0x5f9c('0x9')]=function(_0x169b60,_0x170bc0){return _0x169b60[_0x5f9c('0xa')](_0x5f9c('0xb'),attributes,{'tableName':_0x5f9c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index fd9eff3..a5cc030 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 _0x5d58=['localhost','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d58,0x187));var _0x85d5=function(_0x36608d,_0x16a803){_0x36608d=_0x36608d-0x0;var _0x5a8f09=_0x5d58[_0x36608d];return _0x5a8f09;};'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(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});config[_0x85d5('0x7')]=_['defaults'](config[_0x85d5('0x7')],{'host':_0x85d5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85d5('0x7')]));require('./userProfile.socket')[_0x85d5('0x9')](socket);function respondWithRpcPromise(_0x2ce6b9,_0x258f0c,_0x488dcb){return new BPromise(function(_0x499b36,_0x4e147a){return client[_0x85d5('0xa')](_0x2ce6b9,_0x488dcb)[_0x85d5('0xb')](function(_0xde1063){logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));logger[_0x85d5('0xf')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x258f0c,'request\x20sent',JSON['stringify'](_0xde1063));if(_0xde1063[_0x85d5('0x10')]){if(_0xde1063[_0x85d5('0x10')][_0x85d5('0x11')]===0x1f4){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x4e147a(_0xde1063['error'][_0x85d5('0x12')]);}logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x499b36(_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);}else{logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));_0x499b36(_0xde1063[_0x85d5('0x13')][_0x85d5('0x12')]);}})[_0x85d5('0x14')](function(_0x3df634){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0x3df634);_0x4e147a(_0x3df634);});});} \ No newline at end of file +var _0xeda8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xeda8,0x104));var _0x8eda=function(_0x2baa81,_0x4789cb){_0x2baa81=_0x2baa81-0x0;var _0x427f8f=_0xeda8[_0x2baa81];return _0x427f8f;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});config[_0x8eda('0xd')]=_['defaults'](config[_0x8eda('0xd')],{'host':_0x8eda('0xe'),'port':0x18eb});var socket=require(_0x8eda('0xf'))(new Redis(config[_0x8eda('0xd')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x488849,_0x4fbf0a,_0xe69181){return new BPromise(function(_0x2d3739,_0x41442d){return client['request'](_0x488849,_0xe69181)[_0x8eda('0x10')](function(_0x5a80ca){logger[_0x8eda('0x11')](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));logger[_0x8eda('0x14')](_0x8eda('0x15'),_0x4fbf0a,_0x8eda('0x13'),JSON[_0x8eda('0x16')](_0x5a80ca));if(_0x5a80ca[_0x8eda('0x17')]){if(_0x5a80ca['error']['code']===0x1f4){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x41442d(_0x5a80ca[_0x8eda('0x17')][_0x8eda('0x18')]);}logger['error'](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x2d3739(_0x5a80ca['error'][_0x8eda('0x18')]);}else{logger['info'](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));_0x2d3739(_0x5a80ca['result']['message']);}})[_0x8eda('0x19')](function(_0x1b7e94){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x1b7e94);_0x41442d(_0x1b7e94);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3f10790..e0eaf36 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 _0x3729=['update','removeListener','register','length','userProfile:','./userProfile.events','save','remove'];(function(_0x5c956b,_0xa87d11){var _0xaff46a=function(_0x463d89){while(--_0x463d89){_0x5c956b['push'](_0x5c956b['shift']());}};_0xaff46a(++_0xa87d11);}(_0x3729,0x155));var _0x9372=function(_0x25777f,_0x4dd156){_0x25777f=_0x25777f-0x0;var _0x2df6a3=_0x3729[_0x25777f];return _0x2df6a3;};'use strict';var UserProfileEvents=require(_0x9372('0x0'));var events=[_0x9372('0x1'),_0x9372('0x2'),_0x9372('0x3')];function createListener(_0x3d03f6,_0x2f0a50){return function(_0x57d9c3){_0x2f0a50['emit'](_0x3d03f6,_0x57d9c3);};}function removeListener(_0x4de3cb,_0x23adca){return function(){UserProfileEvents[_0x9372('0x4')](_0x4de3cb,_0x23adca);};}exports[_0x9372('0x5')]=function(_0x15c606){for(var _0x1c9714=0x0,_0x2f3327=events[_0x9372('0x6')];_0x1c9714<_0x2f3327;_0x1c9714++){var _0x4bd96f=events[_0x1c9714];var _0x5033a0=createListener(_0x9372('0x7')+_0x4bd96f,_0x15c606);UserProfileEvents['on'](_0x4bd96f,_0x5033a0);}}; \ No newline at end of file +var _0xfdd5=['./userProfile.events','save','remove','emit','removeListener','length','userProfile:'];(function(_0x5901b9,_0x3c3829){var _0x43cd20=function(_0x17a3bd){while(--_0x17a3bd){_0x5901b9['push'](_0x5901b9['shift']());}};_0x43cd20(++_0x3c3829);}(_0xfdd5,0xee));var _0x5fdd=function(_0x13e8b1,_0x3300a1){_0x13e8b1=_0x13e8b1-0x0;var _0x5d2409=_0xfdd5[_0x13e8b1];return _0x5d2409;};'use strict';var UserProfileEvents=require(_0x5fdd('0x0'));var events=[_0x5fdd('0x1'),_0x5fdd('0x2'),'update'];function createListener(_0xf96b6b,_0x5ef167){return function(_0x24e0ac){_0x5ef167[_0x5fdd('0x3')](_0xf96b6b,_0x24e0ac);};}function removeListener(_0x1a0253,_0xb40f74){return function(){UserProfileEvents[_0x5fdd('0x4')](_0x1a0253,_0xb40f74);};}exports['register']=function(_0x178389){for(var _0x1b0915=0x0,_0x28d6a1=events[_0x5fdd('0x5')];_0x1b0915<_0x28d6a1;_0x1b0915++){var _0x2b90e6=events[_0x1b0915];var _0xdd22d5=createListener(_0x5fdd('0x6')+_0x2b90e6,_0x178389);UserProfileEvents['on'](_0x2b90e6,_0xdd22d5);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 7989cb4..79d34d7 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 _0xaca0=['delete','destroy','util','path','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x3604fd,_0x3c6297){var _0x18c989=function(_0x465f63){while(--_0x465f63){_0x3604fd['push'](_0x3604fd['shift']());}};_0x18c989(++_0x3c6297);}(_0xaca0,0xd2));var _0x0aca=function(_0x33116f,_0xcc6aef){_0x33116f=_0x33116f-0x0;var _0x364b5c=_0xaca0[_0x33116f];return _0x364b5c;};'use strict';var multer=require('multer');var util=require(_0x0aca('0x0'));var path=require(_0x0aca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0aca('0x2'));var config=require('../../config/environment');var controller=require(_0x0aca('0x3'));router[_0x0aca('0x4')]('/',auth[_0x0aca('0x5')](),controller[_0x0aca('0x6')]);router[_0x0aca('0x4')]('/describe',auth[_0x0aca('0x5')](),controller[_0x0aca('0x7')]);router['get'](_0x0aca('0x8'),auth[_0x0aca('0x5')](),controller[_0x0aca('0x9')]);router[_0x0aca('0xa')]('/',auth[_0x0aca('0x5')](),controller[_0x0aca('0xb')]);router[_0x0aca('0xc')](_0x0aca('0x8'),auth['isAuthenticated'](),controller[_0x0aca('0xd')]);router[_0x0aca('0xe')](_0x0aca('0x8'),auth['isAuthenticated'](),controller[_0x0aca('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7e37=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy'];(function(_0x3bd37a,_0x4a5ec3){var _0x1c9134=function(_0x392176){while(--_0x392176){_0x3bd37a['push'](_0x3bd37a['shift']());}};_0x1c9134(++_0x4a5ec3);}(_0x7e37,0xf3));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x77e3('0x0'));var util=require(_0x77e3('0x1'));var path=require(_0x77e3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77e3('0x3')]();var auth=require(_0x77e3('0x4'));var interaction=require(_0x77e3('0x5'));var config=require(_0x77e3('0x6'));var controller=require(_0x77e3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x77e3('0x8')]);router[_0x77e3('0x9')](_0x77e3('0xa'),auth[_0x77e3('0xb')](),controller[_0x77e3('0xc')]);router[_0x77e3('0x9')]('/:id',auth[_0x77e3('0xb')](),controller[_0x77e3('0xd')]);router[_0x77e3('0xe')]('/',auth['isAuthenticated'](),controller[_0x77e3('0xf')]);router[_0x77e3('0x10')](_0x77e3('0x11'),auth[_0x77e3('0xb')](),controller[_0x77e3('0x12')]);router[_0x77e3('0x13')](_0x77e3('0x11'),auth['isAuthenticated'](),controller[_0x77e3('0x14')]);module[_0x77e3('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index dd949b2..22a3ce9 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 _0xb007=['INTEGER','sequelize'];(function(_0x5060b9,_0x5ad2a9){var _0x492912=function(_0x3bc514){while(--_0x3bc514){_0x5060b9['push'](_0x5060b9['shift']());}};_0x492912(++_0x5ad2a9);}(_0xb007,0x1bb));var _0x7b00=function(_0x3fcaa7,_0x308f38){_0x3fcaa7=_0x3fcaa7-0x0;var _0x3b4015=_0xb007[_0x3fcaa7];return _0x3b4015;};'use strict';var Sequelize=require(_0x7b00('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7b00('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa93e=['STRING','sequelize','exports','INTEGER'];(function(_0x4ce9ac,_0xa01374){var _0x1d132a=function(_0x4c1498){while(--_0x4c1498){_0x4ce9ac['push'](_0x4ce9ac['shift']());}};_0x1d132a(++_0xa01374);}(_0xa93e,0x109));var _0xea93=function(_0x5ee58a,_0xdd4a44){_0x5ee58a=_0x5ee58a-0x0;var _0x29bbe6=_0xa93e[_0x5ee58a];return _0x29bbe6;};'use strict';var Sequelize=require(_0xea93('0x0'));module[_0xea93('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xea93('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xea93('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9d76518..7f68af5 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 _0x3eea=['UserProfileResource','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xd58fc1,_0x1d931c){var _0xc71c40=function(_0x8f4d82){while(--_0x8f4d82){_0xd58fc1['push'](_0xd58fc1['shift']());}};_0xc71c40(++_0x1d931c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x475e2e,_0x59d51d){_0x475e2e=_0x475e2e-0x0;var _0x47987d=_0x3eea[_0x475e2e];return _0x47987d;};'use strict';var pdf=require(_0xa3ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3ee('0x1'));var zipdir=require(_0xa3ee('0x2'));var jsonpatch=require(_0xa3ee('0x3'));var rp=require(_0xa3ee('0x4'));var moment=require(_0xa3ee('0x5'));var BPromise=require(_0xa3ee('0x6'));var Mustache=require(_0xa3ee('0x7'));var util=require(_0xa3ee('0x8'));var path=require(_0xa3ee('0x9'));var sox=require(_0xa3ee('0xa'));var csv=require(_0xa3ee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xb'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa3ee('0x14'))['db'];function respondWithStatusCode(_0x30e652,_0x403518){_0x403518=_0x403518||0xcc;return function(_0x4363d1){if(_0x4363d1){return _0x30e652['sendStatus'](_0x403518);}return _0x30e652[_0xa3ee('0x15')](_0x403518)['end']();};}function respondWithResult(_0x43b3bc,_0x20535f){_0x20535f=_0x20535f||0xc8;return function(_0x2c34cf){if(_0x2c34cf){return _0x43b3bc[_0xa3ee('0x15')](_0x20535f)['json'](_0x2c34cf);}};}function respondWithFilteredResult(_0x2a82e5,_0x23df7d){return function(_0x5da681){if(_0x5da681){var _0x5358aa=_0x5da681[_0xa3ee('0x16')],_0x4b2c66=_0x23df7d[_0xa3ee('0x17')],_0x40decb=_0x23df7d['offset']+_0x23df7d[_0xa3ee('0x18')],_0x7277cd;if(_0x40decb>=_0x5358aa){_0x40decb=_0x5358aa;_0x7277cd=0xc8;}else{_0x7277cd=0xce;}_0x2a82e5[_0xa3ee('0x15')](_0x7277cd);return _0x2a82e5[_0xa3ee('0x19')](_0xa3ee('0x1a'),_0x4b2c66+'-'+_0x40decb+'/'+_0x5358aa)[_0xa3ee('0x1b')](_0x5da681);}return null;};}function patchUpdates(_0x4aac0e){return function(_0x377b9d){try{jsonpatch[_0xa3ee('0x1c')](_0x377b9d,_0x4aac0e,!![]);}catch(_0x35fbb2){return BPromise[_0xa3ee('0x1d')](_0x35fbb2);}return _0x377b9d[_0xa3ee('0x1e')]();};}function saveUpdates(_0x3195a7,_0x4f8c56){return function(_0x3f5d70){if(_0x3f5d70){return _0x3f5d70[_0xa3ee('0x1f')](_0x3195a7)['then'](function(_0x3a7cd3){return _0x3a7cd3;});}return null;};}function removeEntity(_0x4e7f32,_0x2fab5){return function(_0x29df43){if(_0x29df43){return _0x29df43[_0xa3ee('0x20')]()[_0xa3ee('0x21')](function(){_0x4e7f32[_0xa3ee('0x15')](0xcc)[_0xa3ee('0x22')]();});}};}function handleEntityNotFound(_0x3ce61b,_0x12108e){return function(_0x5ae0a1){if(!_0x5ae0a1){_0x3ce61b[_0xa3ee('0x23')](0x194);}return _0x5ae0a1;};}function handleError(_0x5b682b,_0x1998b9){_0x1998b9=_0x1998b9||0x1f4;return function(_0x1dca29){logger[_0xa3ee('0x24')](_0x1dca29[_0xa3ee('0x25')]);if(_0x1dca29[_0xa3ee('0x26')]){delete _0x1dca29['name'];}_0x5b682b[_0xa3ee('0x15')](_0x1998b9)[_0xa3ee('0x27')](_0x1dca29);};}exports[_0xa3ee('0x28')]=function(_0xd9a7f8,_0x42e97c){var _0xa9e4d6={},_0x443507={},_0x30b12b={'count':0x0,'rows':[]};var _0xea54fe=_[_0xa3ee('0x29')](db['UserProfileResource']['rawAttributes'],function(_0x4abf49){return{'name':_0x4abf49[_0xa3ee('0x2a')],'type':_0x4abf49['type'][_0xa3ee('0x2b')]};});_0x443507[_0xa3ee('0x2c')]=_[_0xa3ee('0x29')](_0xea54fe,_0xa3ee('0x26'));_0x443507[_0xa3ee('0x2d')]=_[_0xa3ee('0x2e')](_0xd9a7f8[_0xa3ee('0x2d')]);_0x443507[_0xa3ee('0x2f')]=_[_0xa3ee('0x30')](_0x443507[_0xa3ee('0x2c')],_0x443507['query']);_0xa9e4d6[_0xa3ee('0x31')]=_['intersection'](_0x443507[_0xa3ee('0x2c')],qs[_0xa3ee('0x32')](_0xd9a7f8['query'][_0xa3ee('0x32')]));_0xa9e4d6['attributes']=_0xa9e4d6[_0xa3ee('0x31')]['length']?_0xa9e4d6[_0xa3ee('0x31')]:_0x443507[_0xa3ee('0x2c')];if(!_0xd9a7f8[_0xa3ee('0x2d')][_0xa3ee('0x33')](_0xa3ee('0x34'))){_0xa9e4d6['limit']=qs[_0xa3ee('0x18')](_0xd9a7f8[_0xa3ee('0x2d')][_0xa3ee('0x18')]);_0xa9e4d6['offset']=qs[_0xa3ee('0x17')](_0xd9a7f8['query'][_0xa3ee('0x17')]);}_0xa9e4d6['order']=qs[_0xa3ee('0x35')](_0xd9a7f8['query'][_0xa3ee('0x35')]);_0xa9e4d6[_0xa3ee('0x36')]=qs[_0xa3ee('0x2f')](_[_0xa3ee('0x37')](_0xd9a7f8[_0xa3ee('0x2d')],_0x443507[_0xa3ee('0x2f')]),_0xea54fe);if(_0xd9a7f8[_0xa3ee('0x2d')][_0xa3ee('0x38')]){_0xa9e4d6[_0xa3ee('0x36')]=_[_0xa3ee('0x39')](_0xa9e4d6[_0xa3ee('0x36')],{'$or':_[_0xa3ee('0x29')](_0xea54fe,function(_0x447efd){if(_0x447efd['type']!==_0xa3ee('0x3a')){var _0x2ee492={};_0x2ee492[_0x447efd[_0xa3ee('0x26')]]={'$like':'%'+_0xd9a7f8[_0xa3ee('0x2d')]['filter']+'%'};return _0x2ee492;}})});}_0xa9e4d6=_[_0xa3ee('0x39')]({},_0xa9e4d6,_0xd9a7f8[_0xa3ee('0x3b')]);var _0x1a9b63={'where':_0xa9e4d6['where']};return db[_0xa3ee('0x3c')][_0xa3ee('0x16')](_0x1a9b63)['then'](function(_0x319c26){_0x30b12b[_0xa3ee('0x16')]=_0x319c26;if(_0xd9a7f8['query'][_0xa3ee('0x3d')]){_0xa9e4d6[_0xa3ee('0x3e')]=[{'all':!![]}];}return db[_0xa3ee('0x3c')][_0xa3ee('0x3f')](_0xa9e4d6);})[_0xa3ee('0x21')](function(_0x28e8c3){_0x30b12b[_0xa3ee('0x40')]=_0x28e8c3;return _0x30b12b;})[_0xa3ee('0x21')](respondWithFilteredResult(_0x42e97c,_0xa9e4d6))[_0xa3ee('0x41')](handleError(_0x42e97c,null));};exports[_0xa3ee('0x42')]=function(_0xa0d2d5,_0x549d74){var _0x5aa4b3={'raw':![],'where':{'id':_0xa0d2d5[_0xa3ee('0x43')]['id']}},_0x548534={};_0x548534[_0xa3ee('0x2c')]=_['keys'](db[_0xa3ee('0x3c')][_0xa3ee('0x44')]);_0x548534[_0xa3ee('0x2d')]=_['keys'](_0xa0d2d5[_0xa3ee('0x2d')]);_0x548534['filters']=_[_0xa3ee('0x30')](_0x548534[_0xa3ee('0x2c')],_0x548534[_0xa3ee('0x2d')]);_0x5aa4b3[_0xa3ee('0x31')]=_[_0xa3ee('0x30')](_0x548534[_0xa3ee('0x2c')],qs[_0xa3ee('0x32')](_0xa0d2d5[_0xa3ee('0x2d')][_0xa3ee('0x32')]));_0x5aa4b3[_0xa3ee('0x31')]=_0x5aa4b3[_0xa3ee('0x31')][_0xa3ee('0x45')]?_0x5aa4b3[_0xa3ee('0x31')]:_0x548534[_0xa3ee('0x2c')];if(_0xa0d2d5[_0xa3ee('0x2d')][_0xa3ee('0x3d')]){_0x5aa4b3[_0xa3ee('0x3e')]=[{'all':!![]}];}_0x5aa4b3=_[_0xa3ee('0x39')]({},_0x5aa4b3,_0xa0d2d5['options']);return db[_0xa3ee('0x3c')][_0xa3ee('0x46')](_0x5aa4b3)[_0xa3ee('0x21')](handleEntityNotFound(_0x549d74,null))[_0xa3ee('0x21')](respondWithResult(_0x549d74,null))['catch'](handleError(_0x549d74,null));};exports[_0xa3ee('0x47')]=function(_0x4bd451,_0x3d6512){return db[_0xa3ee('0x3c')][_0xa3ee('0x47')](_0x4bd451[_0xa3ee('0x48')],{})[_0xa3ee('0x21')](respondWithResult(_0x3d6512,0xc9))[_0xa3ee('0x41')](handleError(_0x3d6512,null));};exports[_0xa3ee('0x1f')]=function(_0xbb0148,_0x3c3677){if(_0xbb0148[_0xa3ee('0x48')]['id']){delete _0xbb0148['body']['id'];}return db[_0xa3ee('0x3c')]['find']({'where':{'id':_0xbb0148['params']['id']}})[_0xa3ee('0x21')](handleEntityNotFound(_0x3c3677,null))[_0xa3ee('0x21')](saveUpdates(_0xbb0148[_0xa3ee('0x48')],null))[_0xa3ee('0x21')](respondWithResult(_0x3c3677,null))[_0xa3ee('0x41')](handleError(_0x3c3677,null));};exports[_0xa3ee('0x20')]=function(_0x1f8699,_0x501dad){return db[_0xa3ee('0x3c')][_0xa3ee('0x46')]({'where':{'id':_0x1f8699['params']['id']}})[_0xa3ee('0x21')](handleEntityNotFound(_0x501dad,null))[_0xa3ee('0x21')](removeEntity(_0x501dad,null))[_0xa3ee('0x41')](handleError(_0x501dad,null));};exports['describe']=function(_0x587a1a,_0x14335c){return db[_0xa3ee('0x3c')][_0xa3ee('0x49')]()[_0xa3ee('0x21')](respondWithResult(_0x14335c,null))[_0xa3ee('0x41')](handleError(_0x14335c,null));}; \ No newline at end of file +var _0xdb94=['type','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','filter','merge'];(function(_0x59631f,_0x178e26){var _0x1746be=function(_0x308ddf){while(--_0x308ddf){_0x59631f['push'](_0x59631f['shift']());}};_0x1746be(++_0x178e26);}(_0xdb94,0xe5));var _0x4db9=function(_0x589750,_0x5efe1a){_0x589750=_0x589750-0x0;var _0x49b7ab=_0xdb94[_0x589750];return _0x49b7ab;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4db9('0x2'));var rp=require(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require(_0x4db9('0x7'));var sox=require('sox');var csv=require(_0x4db9('0x8'));var ejs=require(_0x4db9('0x9'));var fs=require('fs');var _=require(_0x4db9('0xa'));var squel=require(_0x4db9('0xb'));var crypto=require(_0x4db9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4db9('0xd'));var toCsv=require(_0x4db9('0x8'));var querystring=require(_0x4db9('0xe'));var Papa=require(_0x4db9('0xf'));var Redis=require(_0x4db9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))(_0x4db9('0x15'));var utils=require(_0x4db9('0x16'));var config=require('../../config/environment');var db=require(_0x4db9('0x17'))['db'];function respondWithStatusCode(_0x4397fc,_0x59f01c){_0x59f01c=_0x59f01c||0xcc;return function(_0x549c92){if(_0x549c92){return _0x4397fc[_0x4db9('0x18')](_0x59f01c);}return _0x4397fc[_0x4db9('0x19')](_0x59f01c)[_0x4db9('0x1a')]();};}function respondWithResult(_0x4d4046,_0x1a93be){_0x1a93be=_0x1a93be||0xc8;return function(_0x3dde55){if(_0x3dde55){return _0x4d4046[_0x4db9('0x19')](_0x1a93be)[_0x4db9('0x1b')](_0x3dde55);}};}function respondWithFilteredResult(_0x2d89a7,_0x585230){return function(_0x1b1062){if(_0x1b1062){var _0x1a5a9c=_0x1b1062[_0x4db9('0x1c')],_0x5d4d70=_0x585230['offset'],_0x27b387=_0x585230[_0x4db9('0x1d')]+_0x585230[_0x4db9('0x1e')],_0x7df575;if(_0x27b387>=_0x1a5a9c){_0x27b387=_0x1a5a9c;_0x7df575=0xc8;}else{_0x7df575=0xce;}_0x2d89a7['status'](_0x7df575);return _0x2d89a7['set']('Content-Range',_0x5d4d70+'-'+_0x27b387+'/'+_0x1a5a9c)[_0x4db9('0x1b')](_0x1b1062);}return null;};}function patchUpdates(_0x4235ab){return function(_0x48ff99){try{jsonpatch[_0x4db9('0x1f')](_0x48ff99,_0x4235ab,!![]);}catch(_0x1f6b24){return BPromise[_0x4db9('0x20')](_0x1f6b24);}return _0x48ff99[_0x4db9('0x21')]();};}function saveUpdates(_0x439433,_0x28b7f6){return function(_0x34a6ed){if(_0x34a6ed){return _0x34a6ed[_0x4db9('0x22')](_0x439433)[_0x4db9('0x23')](function(_0x41d0c1){return _0x41d0c1;});}return null;};}function removeEntity(_0x29b4ff,_0x102402){return function(_0x4d56a1){if(_0x4d56a1){return _0x4d56a1[_0x4db9('0x24')]()[_0x4db9('0x23')](function(){_0x29b4ff['status'](0xcc)[_0x4db9('0x1a')]();});}};}function handleEntityNotFound(_0x3f4931,_0x4419af){return function(_0x402898){if(!_0x402898){_0x3f4931['sendStatus'](0x194);}return _0x402898;};}function handleError(_0xe3dbe,_0x506cc9){_0x506cc9=_0x506cc9||0x1f4;return function(_0x1cf805){logger[_0x4db9('0x25')](_0x1cf805[_0x4db9('0x26')]);if(_0x1cf805[_0x4db9('0x27')]){delete _0x1cf805[_0x4db9('0x27')];}_0xe3dbe[_0x4db9('0x19')](_0x506cc9)[_0x4db9('0x28')](_0x1cf805);};}exports['index']=function(_0x5f59be,_0x1b2647){var _0x5ce6cc={},_0x910137={},_0x2653be={'count':0x0,'rows':[]};var _0x38d5e2=_[_0x4db9('0x29')](db[_0x4db9('0x2a')][_0x4db9('0x2b')],function(_0x1d0dc2){return{'name':_0x1d0dc2[_0x4db9('0x2c')],'type':_0x1d0dc2['type'][_0x4db9('0x2d')]};});_0x910137['model']=_[_0x4db9('0x29')](_0x38d5e2,_0x4db9('0x27'));_0x910137[_0x4db9('0x2e')]=_[_0x4db9('0x2f')](_0x5f59be[_0x4db9('0x2e')]);_0x910137['filters']=_[_0x4db9('0x30')](_0x910137[_0x4db9('0x31')],_0x910137[_0x4db9('0x2e')]);_0x5ce6cc[_0x4db9('0x32')]=_['intersection'](_0x910137['model'],qs[_0x4db9('0x33')](_0x5f59be[_0x4db9('0x2e')]['fields']));_0x5ce6cc['attributes']=_0x5ce6cc[_0x4db9('0x32')]['length']?_0x5ce6cc['attributes']:_0x910137[_0x4db9('0x31')];if(!_0x5f59be[_0x4db9('0x2e')]['hasOwnProperty'](_0x4db9('0x34'))){_0x5ce6cc[_0x4db9('0x1e')]=qs[_0x4db9('0x1e')](_0x5f59be[_0x4db9('0x2e')]['limit']);_0x5ce6cc[_0x4db9('0x1d')]=qs['offset'](_0x5f59be['query']['offset']);}_0x5ce6cc[_0x4db9('0x35')]=qs[_0x4db9('0x36')](_0x5f59be['query'][_0x4db9('0x36')]);_0x5ce6cc[_0x4db9('0x37')]=qs['filters'](_['pick'](_0x5f59be['query'],_0x910137[_0x4db9('0x38')]),_0x38d5e2);if(_0x5f59be['query'][_0x4db9('0x39')]){_0x5ce6cc['where']=_[_0x4db9('0x3a')](_0x5ce6cc[_0x4db9('0x37')],{'$or':_[_0x4db9('0x29')](_0x38d5e2,function(_0x10ccbc){if(_0x10ccbc[_0x4db9('0x3b')]!=='VIRTUAL'){var _0x1cf917={};_0x1cf917[_0x10ccbc['name']]={'$like':'%'+_0x5f59be[_0x4db9('0x2e')][_0x4db9('0x39')]+'%'};return _0x1cf917;}})});}_0x5ce6cc=_[_0x4db9('0x3a')]({},_0x5ce6cc,_0x5f59be[_0x4db9('0x3c')]);var _0x146850={'where':_0x5ce6cc[_0x4db9('0x37')]};return db['UserProfileResource'][_0x4db9('0x1c')](_0x146850)[_0x4db9('0x23')](function(_0x5ba7df){_0x2653be['count']=_0x5ba7df;if(_0x5f59be[_0x4db9('0x2e')][_0x4db9('0x3d')]){_0x5ce6cc[_0x4db9('0x3e')]=[{'all':!![]}];}return db[_0x4db9('0x2a')][_0x4db9('0x3f')](_0x5ce6cc);})[_0x4db9('0x23')](function(_0x1a9fe7){_0x2653be[_0x4db9('0x40')]=_0x1a9fe7;return _0x2653be;})[_0x4db9('0x23')](respondWithFilteredResult(_0x1b2647,_0x5ce6cc))[_0x4db9('0x41')](handleError(_0x1b2647,null));};exports[_0x4db9('0x42')]=function(_0x3254d1,_0x489967){var _0x2716d6={'raw':![],'where':{'id':_0x3254d1[_0x4db9('0x43')]['id']}},_0x4a2121={};_0x4a2121[_0x4db9('0x31')]=_['keys'](db['UserProfileResource'][_0x4db9('0x2b')]);_0x4a2121[_0x4db9('0x2e')]=_[_0x4db9('0x2f')](_0x3254d1['query']);_0x4a2121[_0x4db9('0x38')]=_['intersection'](_0x4a2121[_0x4db9('0x31')],_0x4a2121[_0x4db9('0x2e')]);_0x2716d6[_0x4db9('0x32')]=_[_0x4db9('0x30')](_0x4a2121[_0x4db9('0x31')],qs['fields'](_0x3254d1[_0x4db9('0x2e')][_0x4db9('0x33')]));_0x2716d6[_0x4db9('0x32')]=_0x2716d6[_0x4db9('0x32')][_0x4db9('0x44')]?_0x2716d6['attributes']:_0x4a2121[_0x4db9('0x31')];if(_0x3254d1[_0x4db9('0x2e')][_0x4db9('0x3d')]){_0x2716d6[_0x4db9('0x3e')]=[{'all':!![]}];}_0x2716d6=_[_0x4db9('0x3a')]({},_0x2716d6,_0x3254d1[_0x4db9('0x3c')]);return db[_0x4db9('0x2a')][_0x4db9('0x45')](_0x2716d6)[_0x4db9('0x23')](handleEntityNotFound(_0x489967,null))['then'](respondWithResult(_0x489967,null))[_0x4db9('0x41')](handleError(_0x489967,null));};exports['create']=function(_0x53f3bb,_0x21d18d){return db[_0x4db9('0x2a')]['create'](_0x53f3bb['body'],{})[_0x4db9('0x23')](respondWithResult(_0x21d18d,0xc9))[_0x4db9('0x41')](handleError(_0x21d18d,null));};exports[_0x4db9('0x22')]=function(_0x7f0aac,_0x2c2c17){if(_0x7f0aac[_0x4db9('0x46')]['id']){delete _0x7f0aac[_0x4db9('0x46')]['id'];}return db[_0x4db9('0x2a')][_0x4db9('0x45')]({'where':{'id':_0x7f0aac[_0x4db9('0x43')]['id']}})[_0x4db9('0x23')](handleEntityNotFound(_0x2c2c17,null))['then'](saveUpdates(_0x7f0aac[_0x4db9('0x46')],null))[_0x4db9('0x23')](respondWithResult(_0x2c2c17,null))['catch'](handleError(_0x2c2c17,null));};exports[_0x4db9('0x24')]=function(_0x5a461d,_0x26ae1a){return db[_0x4db9('0x2a')][_0x4db9('0x45')]({'where':{'id':_0x5a461d[_0x4db9('0x43')]['id']}})[_0x4db9('0x23')](handleEntityNotFound(_0x26ae1a,null))[_0x4db9('0x23')](removeEntity(_0x26ae1a,null))[_0x4db9('0x41')](handleError(_0x26ae1a,null));};exports[_0x4db9('0x47')]=function(_0x2f77f9,_0x30aa0a){return db[_0x4db9('0x2a')][_0x4db9('0x47')]()[_0x4db9('0x23')](respondWithResult(_0x30aa0a,null))['catch'](handleError(_0x30aa0a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 96bf01a..dc9b628 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 _0x6c76=['define','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x6f116f,_0x48c8bd){var _0x120342=function(_0xa8e20a){while(--_0xa8e20a){_0x6f116f['push'](_0x6f116f['shift']());}};_0x120342(++_0x48c8bd);}(_0x6c76,0x184));var _0x66c7=function(_0x338f5a,_0x74ceb){_0x338f5a=_0x338f5a-0x0;var _0x5ba9cd=_0x6c76[_0x338f5a];return _0x5ba9cd;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x66c7('0x9'),'fields':[_0x66c7('0xa'),_0x66c7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['request-promise','path','rimraf','../../config/environment','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util','bluebird'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserProfileResource',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['resourceId',_0x0d8b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b483158..db09f3c 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 _0xabb3=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x588d79,_0x34bdbe){var _0x5c5cc8=function(_0x1a2543){while(--_0x1a2543){_0x588d79['push'](_0x588d79['shift']());}};_0x5c5cc8(++_0x34bdbe);}(_0xabb3,0x17b));var _0x3abb=function(_0x15fd2c,_0x2efe29){_0x15fd2c=_0x15fd2c-0x0;var _0x314c47=_0xabb3[_0x15fd2c];return _0x314c47;};'use strict';var _=require(_0x3abb('0x0'));var util=require(_0x3abb('0x1'));var moment=require(_0x3abb('0x2'));var BPromise=require(_0x3abb('0x3'));var rs=require(_0x3abb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3abb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3abb('0x6'))(_0x3abb('0x7'));var config=require(_0x3abb('0x8'));var jayson=require(_0x3abb('0x9'));var client=jayson[_0x3abb('0xa')][_0x3abb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b88f,_0x5997cb,_0xe76fe0){return new BPromise(function(_0x23116d,_0x388d3d){return client[_0x3abb('0xc')](_0x52b88f,_0xe76fe0)[_0x3abb('0xd')](function(_0xfb6b02){logger[_0x3abb('0xe')](_0x3abb('0xf'),_0x5997cb,'request\x20sent');logger[_0x3abb('0x10')](_0x3abb('0x11'),_0x5997cb,_0x3abb('0x12'),JSON[_0x3abb('0x13')](_0xfb6b02));if(_0xfb6b02[_0x3abb('0x14')]){if(_0xfb6b02[_0x3abb('0x14')][_0x3abb('0x15')]===0x1f4){logger[_0x3abb('0x14')](_0x3abb('0xf'),_0x5997cb,_0xfb6b02[_0x3abb('0x14')][_0x3abb('0x16')]);return _0x388d3d(_0xfb6b02[_0x3abb('0x14')][_0x3abb('0x16')]);}logger[_0x3abb('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x5997cb,_0xfb6b02['error'][_0x3abb('0x16')]);return _0x23116d(_0xfb6b02[_0x3abb('0x14')][_0x3abb('0x16')]);}else{logger['info'](_0x3abb('0xf'),_0x5997cb,_0x3abb('0x12'));_0x23116d(_0xfb6b02[_0x3abb('0x17')][_0x3abb('0x16')]);}})[_0x3abb('0x18')](function(_0x5f028f){logger[_0x3abb('0x14')](_0x3abb('0xf'),_0x5997cb,_0x5f028f);_0x388d3d(_0x5f028f);});});} \ No newline at end of file +var _0x9d85=['stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x27668f,_0x585edf){var _0x364100=function(_0x393eea){while(--_0x393eea){_0x27668f['push'](_0x27668f['shift']());}};_0x364100(++_0x585edf);}(_0x9d85,0x1a7));var _0x59d8=function(_0x406bb9,_0x11e58f){_0x406bb9=_0x406bb9-0x0;var _0x98bce1=_0x9d85[_0x406bb9];return _0x98bce1;};'use strict';var _=require(_0x59d8('0x0'));var util=require('util');var moment=require(_0x59d8('0x1'));var BPromise=require(_0x59d8('0x2'));var rs=require(_0x59d8('0x3'));var fs=require('fs');var Redis=require(_0x59d8('0x4'));var db=require(_0x59d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x59d8('0x6'));var config=require(_0x59d8('0x7'));var jayson=require(_0x59d8('0x8'));var client=jayson['client'][_0x59d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31e523,_0x52f60f,_0xd7a7c3){return new BPromise(function(_0x354ab9,_0x2e1c08){return client[_0x59d8('0xa')](_0x31e523,_0xd7a7c3)[_0x59d8('0xb')](function(_0x45fda9){logger[_0x59d8('0xc')](_0x59d8('0xd'),_0x52f60f,_0x59d8('0xe'));logger[_0x59d8('0xf')](_0x59d8('0x10'),_0x52f60f,_0x59d8('0xe'),JSON[_0x59d8('0x11')](_0x45fda9));if(_0x45fda9['error']){if(_0x45fda9[_0x59d8('0x12')][_0x59d8('0x13')]===0x1f4){logger[_0x59d8('0x12')](_0x59d8('0xd'),_0x52f60f,_0x45fda9[_0x59d8('0x12')][_0x59d8('0x14')]);return _0x2e1c08(_0x45fda9[_0x59d8('0x12')][_0x59d8('0x14')]);}logger[_0x59d8('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x52f60f,_0x45fda9[_0x59d8('0x12')][_0x59d8('0x14')]);return _0x354ab9(_0x45fda9['error'][_0x59d8('0x14')]);}else{logger[_0x59d8('0xc')](_0x59d8('0xd'),_0x52f60f,_0x59d8('0xe'));_0x354ab9(_0x45fda9['result'][_0x59d8('0x14')]);}})[_0x59d8('0x15')](function(_0xd80992){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x52f60f,_0xd80992);_0x2e1c08(_0xd80992);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 304032d..11ee422 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 _0xf5a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','show','create','/:id','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3438c9,_0x4fe558){var _0x5b4df7=function(_0x474a96){while(--_0x474a96){_0x3438c9['push'](_0x3438c9['shift']());}};_0x5b4df7(++_0x4fe558);}(_0xf5a7,0xba));var _0x7f5a=function(_0x5622e4,_0x228d5f){_0x5622e4=_0x5622e4-0x0;var _0x39c928=_0xf5a7[_0x5622e4];return _0x39c928;};'use strict';var multer=require(_0x7f5a('0x0'));var util=require(_0x7f5a('0x1'));var path=require('path');var timeout=require(_0x7f5a('0x2'));var express=require(_0x7f5a('0x3'));var router=express['Router']();var auth=require(_0x7f5a('0x4'));var interaction=require(_0x7f5a('0x5'));var config=require(_0x7f5a('0x6'));var controller=require(_0x7f5a('0x7'));router['get']('/',auth[_0x7f5a('0x8')](),controller[_0x7f5a('0x9')]);router[_0x7f5a('0xa')](_0x7f5a('0xb'),auth[_0x7f5a('0x8')](),controller[_0x7f5a('0xc')]);router['get']('/:id',auth[_0x7f5a('0x8')](),controller[_0x7f5a('0xd')]);router['post']('/',auth[_0x7f5a('0x8')](),controller[_0x7f5a('0xe')]);router['put'](_0x7f5a('0xf'),auth[_0x7f5a('0x8')](),controller['update']);router[_0x7f5a('0x10')](_0x7f5a('0xf'),auth[_0x7f5a('0x8')](),controller[_0x7f5a('0x11')]);module[_0x7f5a('0x12')]=router; \ No newline at end of file +var _0x7aa2=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x51efbc,_0x8e401a){var _0x5e0d85=function(_0xe9d8fa){while(--_0xe9d8fa){_0x51efbc['push'](_0x51efbc['shift']());}};_0x5e0d85(++_0x8e401a);}(_0x7aa2,0x132));var _0x27aa=function(_0xdbfe3,_0x4ebddd){_0xdbfe3=_0xdbfe3-0x0;var _0x3454b0=_0x7aa2[_0xdbfe3];return _0x3454b0;};'use strict';var multer=require(_0x27aa('0x0'));var util=require(_0x27aa('0x1'));var path=require(_0x27aa('0x2'));var timeout=require(_0x27aa('0x3'));var express=require(_0x27aa('0x4'));var router=express[_0x27aa('0x5')]();var auth=require(_0x27aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x27aa('0x7'));var controller=require(_0x27aa('0x8'));router[_0x27aa('0x9')]('/',auth['isAuthenticated'](),controller[_0x27aa('0xa')]);router[_0x27aa('0x9')](_0x27aa('0xb'),auth[_0x27aa('0xc')](),controller[_0x27aa('0xd')]);router[_0x27aa('0x9')]('/:id',auth[_0x27aa('0xc')](),controller[_0x27aa('0xe')]);router[_0x27aa('0xf')]('/',auth[_0x27aa('0xc')](),controller[_0x27aa('0x10')]);router[_0x27aa('0x11')](_0x27aa('0x12'),auth['isAuthenticated'](),controller[_0x27aa('0x13')]);router[_0x27aa('0x14')]('/:id',auth[_0x27aa('0xc')](),controller[_0x27aa('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 03188a9..21df3b4 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 _0xb38e=['INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb38e,0xa7));var _0xeb38=function(_0x5356a3,_0x28d279){_0x5356a3=_0x5356a3-0x0;var _0x363bda=_0xb38e[_0x5356a3];return _0x363bda;};'use strict';var Sequelize=require(_0xeb38('0x0'));module[_0xeb38('0x1')]={'name':{'type':Sequelize[_0xeb38('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb38('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb38('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb38('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb38('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x33e6e9){this[_0xeb38('0x5')]('crudPermissions',_0x33e6e9?_0x33e6e9[_0xeb38('0x6')](''):[]);},'get':function(){return this[_0xeb38('0x7')](_0xeb38('0x8'))?this[_0xeb38('0x7')]('crudPermissions')[_0xeb38('0x9')](''):[];}}}; \ No newline at end of file +var _0x7b6f=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x394d13,_0x5adb71){var _0x4e4178=function(_0xf4f1d5){while(--_0xf4f1d5){_0x394d13['push'](_0x394d13['shift']());}};_0x4e4178(++_0x5adb71);}(_0x7b6f,0x6c));var _0xf7b6=function(_0x297220,_0x49bec5){_0x297220=_0x297220-0x0;var _0x532a3e=_0x7b6f[_0x297220];return _0x532a3e;};'use strict';var Sequelize=require(_0xf7b6('0x0'));module['exports']={'name':{'type':Sequelize[_0xf7b6('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xf7b6('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf7b6('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xf7b6('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf7b6('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xf7b6('0x1')],'set':function(_0x5105eb){this[_0xf7b6('0x4')](_0xf7b6('0x5'),_0x5105eb?_0x5105eb[_0xf7b6('0x6')](''):[]);},'get':function(){return this[_0xf7b6('0x7')](_0xf7b6('0x5'))?this[_0xf7b6('0x7')](_0xf7b6('0x5'))[_0xf7b6('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index d76eb5c..c892431 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 _0x713d=['squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x713d,0x16f));var _0xd713=function(_0x1b69f9,_0xe342c5){_0x1b69f9=_0x1b69f9-0x0;var _0x23a34b=_0x713d[_0x1b69f9];return _0x23a34b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd713('0x0'));var rimraf=require(_0xd713('0x1'));var zipdir=require(_0xd713('0x2'));var jsonpatch=require(_0xd713('0x3'));var rp=require(_0xd713('0x4'));var moment=require(_0xd713('0x5'));var BPromise=require(_0xd713('0x6'));var Mustache=require(_0xd713('0x7'));var util=require(_0xd713('0x8'));var path=require(_0xd713('0x9'));var sox=require(_0xd713('0xa'));var csv=require('to-csv');var ejs=require(_0xd713('0xb'));var fs=require('fs');var _=require(_0xd713('0xc'));var squel=require(_0xd713('0xd'));var crypto=require(_0xd713('0xe'));var jsforce=require(_0xd713('0xf'));var deskjs=require(_0xd713('0x10'));var toCsv=require(_0xd713('0x11'));var querystring=require(_0xd713('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd713('0x13'));var hardwareService=require(_0xd713('0x14'));var logger=require('../../config/logger')(_0xd713('0x15'));var utils=require(_0xd713('0x16'));var config=require(_0xd713('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e57f5,_0x22ac28){_0x22ac28=_0x22ac28||0xcc;return function(_0x1c4592){if(_0x1c4592){return _0x5e57f5['sendStatus'](_0x22ac28);}return _0x5e57f5[_0xd713('0x18')](_0x22ac28)[_0xd713('0x19')]();};}function respondWithResult(_0x4e3557,_0x5de2ab){_0x5de2ab=_0x5de2ab||0xc8;return function(_0x538d4e){if(_0x538d4e){return _0x4e3557['status'](_0x5de2ab)['json'](_0x538d4e);}};}function respondWithFilteredResult(_0x104e21,_0x1225a6){return function(_0x5be7e7){if(_0x5be7e7){var _0x44801e=_0x5be7e7[_0xd713('0x1a')],_0x4f36fd=_0x1225a6[_0xd713('0x1b')],_0x1e2605=_0x1225a6['offset']+_0x1225a6[_0xd713('0x1c')],_0x3dd240;if(_0x1e2605>=_0x44801e){_0x1e2605=_0x44801e;_0x3dd240=0xc8;}else{_0x3dd240=0xce;}_0x104e21[_0xd713('0x18')](_0x3dd240);return _0x104e21[_0xd713('0x1d')](_0xd713('0x1e'),_0x4f36fd+'-'+_0x1e2605+'/'+_0x44801e)['json'](_0x5be7e7);}return null;};}function patchUpdates(_0x38a526){return function(_0x2615a0){try{jsonpatch[_0xd713('0x1f')](_0x2615a0,_0x38a526,!![]);}catch(_0x3cd638){return BPromise[_0xd713('0x20')](_0x3cd638);}return _0x2615a0[_0xd713('0x21')]();};}function saveUpdates(_0x2711c7,_0x49e634){return function(_0xc16b38){if(_0xc16b38){return _0xc16b38[_0xd713('0x22')](_0x2711c7)[_0xd713('0x23')](function(_0x1c1500){return _0x1c1500;});}return null;};}function removeEntity(_0x3cfa58,_0xa1b51c){return function(_0x37fcb2){if(_0x37fcb2){return _0x37fcb2[_0xd713('0x24')]()[_0xd713('0x23')](function(){_0x3cfa58[_0xd713('0x18')](0xcc)[_0xd713('0x19')]();});}};}function handleEntityNotFound(_0x8b6721,_0x4ecb92){return function(_0x3bf033){if(!_0x3bf033){_0x8b6721[_0xd713('0x25')](0x194);}return _0x3bf033;};}function handleError(_0x440922,_0x4b5abe){_0x4b5abe=_0x4b5abe||0x1f4;return function(_0x8835d2){logger[_0xd713('0x26')](_0x8835d2[_0xd713('0x27')]);if(_0x8835d2['name']){delete _0x8835d2[_0xd713('0x28')];}_0x440922[_0xd713('0x18')](_0x4b5abe)[_0xd713('0x29')](_0x8835d2);};}exports[_0xd713('0x2a')]=function(_0x170652,_0x3f11a4){var _0x47c10d={},_0x178442={},_0x4e7226={'count':0x0,'rows':[]};var _0x3d1a1c=_[_0xd713('0x2b')](db[_0xd713('0x2c')][_0xd713('0x2d')],function(_0x396e45){return{'name':_0x396e45[_0xd713('0x2e')],'type':_0x396e45['type'][_0xd713('0x2f')]};});_0x178442[_0xd713('0x30')]=_[_0xd713('0x2b')](_0x3d1a1c,_0xd713('0x28'));_0x178442['query']=_[_0xd713('0x31')](_0x170652['query']);_0x178442[_0xd713('0x32')]=_['intersection'](_0x178442[_0xd713('0x30')],_0x178442[_0xd713('0x33')]);_0x47c10d[_0xd713('0x34')]=_[_0xd713('0x35')](_0x178442[_0xd713('0x30')],qs['fields'](_0x170652[_0xd713('0x33')][_0xd713('0x36')]));_0x47c10d[_0xd713('0x34')]=_0x47c10d[_0xd713('0x34')][_0xd713('0x37')]?_0x47c10d['attributes']:_0x178442[_0xd713('0x30')];if(!_0x170652[_0xd713('0x33')][_0xd713('0x38')](_0xd713('0x39'))){_0x47c10d[_0xd713('0x1c')]=qs[_0xd713('0x1c')](_0x170652[_0xd713('0x33')][_0xd713('0x1c')]);_0x47c10d[_0xd713('0x1b')]=qs[_0xd713('0x1b')](_0x170652['query'][_0xd713('0x1b')]);}_0x47c10d[_0xd713('0x3a')]=qs[_0xd713('0x3b')](_0x170652['query']['sort']);_0x47c10d['where']=qs['filters'](_['pick'](_0x170652[_0xd713('0x33')],_0x178442[_0xd713('0x32')]),_0x3d1a1c);if(_0x170652[_0xd713('0x33')][_0xd713('0x3c')]){_0x47c10d['where']=_[_0xd713('0x3d')](_0x47c10d['where'],{'$or':_['map'](_0x3d1a1c,function(_0x14ecee){if(_0x14ecee[_0xd713('0x3e')]!==_0xd713('0x3f')){var _0x35ce2b={};_0x35ce2b[_0x14ecee[_0xd713('0x28')]]={'$like':'%'+_0x170652[_0xd713('0x33')]['filter']+'%'};return _0x35ce2b;}})});}_0x47c10d=_['merge']({},_0x47c10d,_0x170652[_0xd713('0x40')]);var _0xd186f8={'where':_0x47c10d[_0xd713('0x41')]};return db[_0xd713('0x2c')][_0xd713('0x1a')](_0xd186f8)[_0xd713('0x23')](function(_0x551184){_0x4e7226[_0xd713('0x1a')]=_0x551184;if(_0x170652[_0xd713('0x33')][_0xd713('0x42')]){_0x47c10d[_0xd713('0x43')]=[{'all':!![]}];}return db['UserProfileSection'][_0xd713('0x44')](_0x47c10d);})['then'](function(_0x277a43){_0x4e7226[_0xd713('0x45')]=_0x277a43;return _0x4e7226;})['then'](respondWithFilteredResult(_0x3f11a4,_0x47c10d))[_0xd713('0x46')](handleError(_0x3f11a4,null));};exports['show']=function(_0x5460d0,_0x5bc4dc){var _0x26497c={'raw':![],'where':{'id':_0x5460d0[_0xd713('0x47')]['id']}},_0x439d48={};_0x439d48[_0xd713('0x30')]=_[_0xd713('0x31')](db[_0xd713('0x2c')][_0xd713('0x2d')]);_0x439d48[_0xd713('0x33')]=_['keys'](_0x5460d0[_0xd713('0x33')]);_0x439d48['filters']=_['intersection'](_0x439d48[_0xd713('0x30')],_0x439d48['query']);_0x26497c[_0xd713('0x34')]=_['intersection'](_0x439d48['model'],qs[_0xd713('0x36')](_0x5460d0[_0xd713('0x33')][_0xd713('0x36')]));_0x26497c[_0xd713('0x34')]=_0x26497c[_0xd713('0x34')][_0xd713('0x37')]?_0x26497c[_0xd713('0x34')]:_0x439d48[_0xd713('0x30')];if(_0x5460d0[_0xd713('0x33')][_0xd713('0x42')]){_0x26497c[_0xd713('0x43')]=[{'all':!![]}];}_0x26497c=_[_0xd713('0x3d')]({},_0x26497c,_0x5460d0[_0xd713('0x40')]);return db[_0xd713('0x2c')][_0xd713('0x48')](_0x26497c)[_0xd713('0x23')](handleEntityNotFound(_0x5bc4dc,null))[_0xd713('0x23')](respondWithResult(_0x5bc4dc,null))[_0xd713('0x46')](handleError(_0x5bc4dc,null));};exports[_0xd713('0x49')]=function(_0x529be3,_0x432fb6){return db['UserProfileSection'][_0xd713('0x49')](_0x529be3[_0xd713('0x4a')],{})[_0xd713('0x23')](respondWithResult(_0x432fb6,0xc9))['catch'](handleError(_0x432fb6,null));};exports[_0xd713('0x22')]=function(_0x1db5e8,_0x529aaf){if(_0x1db5e8[_0xd713('0x4a')]['id']){delete _0x1db5e8['body']['id'];}return db['UserProfileSection'][_0xd713('0x48')]({'where':{'id':_0x1db5e8['params']['id']}})[_0xd713('0x23')](handleEntityNotFound(_0x529aaf,null))[_0xd713('0x23')](saveUpdates(_0x1db5e8[_0xd713('0x4a')],null))[_0xd713('0x23')](respondWithResult(_0x529aaf,null))['catch'](handleError(_0x529aaf,null));};exports[_0xd713('0x24')]=function(_0x19ff91,_0x3f57bf){return db['UserProfileSection']['find']({'where':{'id':_0x19ff91[_0xd713('0x47')]['id']}})[_0xd713('0x23')](handleEntityNotFound(_0x3f57bf,null))['then'](removeEntity(_0x3f57bf,null))[_0xd713('0x46')](handleError(_0x3f57bf,null));};exports['describe']=function(_0x4de9cc,_0x1475e2){return db[_0xd713('0x2c')][_0xd713('0x4b')]()[_0xd713('0x23')](respondWithResult(_0x1475e2,null))['catch'](handleError(_0x1475e2,null));}; \ No newline at end of file +var _0x88b4=['order','sort','where','pick','filter','VIRTUAL','merge','options','UserProfileSection','count','includeAll','include','catch','params','intersection','length','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','limit','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','offset'];(function(_0x1da140,_0x16683e){var _0x16461f=function(_0x439b09){while(--_0x439b09){_0x1da140['push'](_0x1da140['shift']());}};_0x16461f(++_0x16683e);}(_0x88b4,0xa8));var _0x488b=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x88b4[_0x468b0f];return _0x3e74d9;};'use strict';var pdf=require(_0x488b('0x0'));var emlformat=require(_0x488b('0x1'));var rimraf=require(_0x488b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x488b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x488b('0x4'));var Mustache=require(_0x488b('0x5'));var util=require(_0x488b('0x6'));var path=require(_0x488b('0x7'));var sox=require(_0x488b('0x8'));var csv=require(_0x488b('0x9'));var ejs=require(_0x488b('0xa'));var fs=require('fs');var _=require(_0x488b('0xb'));var squel=require(_0x488b('0xc'));var crypto=require(_0x488b('0xd'));var jsforce=require(_0x488b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x488b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x488b('0x10'));var qs=require(_0x488b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x488b('0x12'));var logger=require(_0x488b('0x13'))(_0x488b('0x14'));var utils=require(_0x488b('0x15'));var config=require(_0x488b('0x16'));var db=require(_0x488b('0x17'))['db'];function respondWithStatusCode(_0x2bb39a,_0x2744bf){_0x2744bf=_0x2744bf||0xcc;return function(_0x46d7cb){if(_0x46d7cb){return _0x2bb39a[_0x488b('0x18')](_0x2744bf);}return _0x2bb39a[_0x488b('0x19')](_0x2744bf)['end']();};}function respondWithResult(_0x2ec5bc,_0x1700bc){_0x1700bc=_0x1700bc||0xc8;return function(_0x198f46){if(_0x198f46){return _0x2ec5bc[_0x488b('0x19')](_0x1700bc)['json'](_0x198f46);}};}function respondWithFilteredResult(_0x3cfd90,_0x26797d){return function(_0x555be4){if(_0x555be4){var _0x5d189c=_0x555be4['count'],_0x5f390b=_0x26797d['offset'],_0x2d6e71=_0x26797d['offset']+_0x26797d[_0x488b('0x1a')],_0x4a33b3;if(_0x2d6e71>=_0x5d189c){_0x2d6e71=_0x5d189c;_0x4a33b3=0xc8;}else{_0x4a33b3=0xce;}_0x3cfd90[_0x488b('0x19')](_0x4a33b3);return _0x3cfd90[_0x488b('0x1b')](_0x488b('0x1c'),_0x5f390b+'-'+_0x2d6e71+'/'+_0x5d189c)[_0x488b('0x1d')](_0x555be4);}return null;};}function patchUpdates(_0x4f6edb){return function(_0x54c68d){try{jsonpatch[_0x488b('0x1e')](_0x54c68d,_0x4f6edb,!![]);}catch(_0x21894f){return BPromise['reject'](_0x21894f);}return _0x54c68d[_0x488b('0x1f')]();};}function saveUpdates(_0x341a17,_0x2193d7){return function(_0x20b584){if(_0x20b584){return _0x20b584[_0x488b('0x20')](_0x341a17)['then'](function(_0x17f239){return _0x17f239;});}return null;};}function removeEntity(_0x4ec8d8,_0x235075){return function(_0x2aec09){if(_0x2aec09){return _0x2aec09[_0x488b('0x21')]()[_0x488b('0x22')](function(){_0x4ec8d8[_0x488b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57c0d5,_0x56a145){return function(_0x364b88){if(!_0x364b88){_0x57c0d5[_0x488b('0x18')](0x194);}return _0x364b88;};}function handleError(_0x1297d5,_0x18b626){_0x18b626=_0x18b626||0x1f4;return function(_0x3ab91d){logger[_0x488b('0x23')](_0x3ab91d[_0x488b('0x24')]);if(_0x3ab91d[_0x488b('0x25')]){delete _0x3ab91d[_0x488b('0x25')];}_0x1297d5[_0x488b('0x19')](_0x18b626)[_0x488b('0x26')](_0x3ab91d);};}exports[_0x488b('0x27')]=function(_0x2be593,_0x2a71ba){var _0x4c57e5={},_0x3d0cd3={},_0x337b7b={'count':0x0,'rows':[]};var _0x186fea=_['map'](db['UserProfileSection'][_0x488b('0x28')],function(_0x8f36f1){return{'name':_0x8f36f1[_0x488b('0x29')],'type':_0x8f36f1[_0x488b('0x2a')][_0x488b('0x2b')]};});_0x3d0cd3[_0x488b('0x2c')]=_[_0x488b('0x2d')](_0x186fea,'name');_0x3d0cd3[_0x488b('0x2e')]=_[_0x488b('0x2f')](_0x2be593[_0x488b('0x2e')]);_0x3d0cd3[_0x488b('0x30')]=_['intersection'](_0x3d0cd3['model'],_0x3d0cd3['query']);_0x4c57e5[_0x488b('0x31')]=_['intersection'](_0x3d0cd3[_0x488b('0x2c')],qs[_0x488b('0x32')](_0x2be593[_0x488b('0x2e')][_0x488b('0x32')]));_0x4c57e5[_0x488b('0x31')]=_0x4c57e5[_0x488b('0x31')]['length']?_0x4c57e5[_0x488b('0x31')]:_0x3d0cd3['model'];if(!_0x2be593[_0x488b('0x2e')][_0x488b('0x33')](_0x488b('0x34'))){_0x4c57e5[_0x488b('0x1a')]=qs[_0x488b('0x1a')](_0x2be593[_0x488b('0x2e')][_0x488b('0x1a')]);_0x4c57e5[_0x488b('0x35')]=qs[_0x488b('0x35')](_0x2be593[_0x488b('0x2e')][_0x488b('0x35')]);}_0x4c57e5[_0x488b('0x36')]=qs[_0x488b('0x37')](_0x2be593[_0x488b('0x2e')][_0x488b('0x37')]);_0x4c57e5[_0x488b('0x38')]=qs['filters'](_[_0x488b('0x39')](_0x2be593['query'],_0x3d0cd3[_0x488b('0x30')]),_0x186fea);if(_0x2be593['query'][_0x488b('0x3a')]){_0x4c57e5[_0x488b('0x38')]=_['merge'](_0x4c57e5['where'],{'$or':_[_0x488b('0x2d')](_0x186fea,function(_0x39d694){if(_0x39d694[_0x488b('0x2a')]!==_0x488b('0x3b')){var _0x4b5b8a={};_0x4b5b8a[_0x39d694[_0x488b('0x25')]]={'$like':'%'+_0x2be593[_0x488b('0x2e')][_0x488b('0x3a')]+'%'};return _0x4b5b8a;}})});}_0x4c57e5=_[_0x488b('0x3c')]({},_0x4c57e5,_0x2be593[_0x488b('0x3d')]);var _0x40bd4c={'where':_0x4c57e5[_0x488b('0x38')]};return db[_0x488b('0x3e')][_0x488b('0x3f')](_0x40bd4c)[_0x488b('0x22')](function(_0x2f82a6){_0x337b7b[_0x488b('0x3f')]=_0x2f82a6;if(_0x2be593[_0x488b('0x2e')][_0x488b('0x40')]){_0x4c57e5[_0x488b('0x41')]=[{'all':!![]}];}return db[_0x488b('0x3e')]['findAll'](_0x4c57e5);})['then'](function(_0x4fee4c){_0x337b7b['rows']=_0x4fee4c;return _0x337b7b;})[_0x488b('0x22')](respondWithFilteredResult(_0x2a71ba,_0x4c57e5))[_0x488b('0x42')](handleError(_0x2a71ba,null));};exports['show']=function(_0x7a164e,_0x99a9f6){var _0x89749c={'raw':![],'where':{'id':_0x7a164e[_0x488b('0x43')]['id']}},_0x4945e9={};_0x4945e9[_0x488b('0x2c')]=_['keys'](db[_0x488b('0x3e')][_0x488b('0x28')]);_0x4945e9['query']=_[_0x488b('0x2f')](_0x7a164e[_0x488b('0x2e')]);_0x4945e9[_0x488b('0x30')]=_[_0x488b('0x44')](_0x4945e9[_0x488b('0x2c')],_0x4945e9[_0x488b('0x2e')]);_0x89749c[_0x488b('0x31')]=_[_0x488b('0x44')](_0x4945e9[_0x488b('0x2c')],qs[_0x488b('0x32')](_0x7a164e[_0x488b('0x2e')]['fields']));_0x89749c['attributes']=_0x89749c[_0x488b('0x31')][_0x488b('0x45')]?_0x89749c[_0x488b('0x31')]:_0x4945e9[_0x488b('0x2c')];if(_0x7a164e[_0x488b('0x2e')][_0x488b('0x40')]){_0x89749c[_0x488b('0x41')]=[{'all':!![]}];}_0x89749c=_['merge']({},_0x89749c,_0x7a164e[_0x488b('0x3d')]);return db['UserProfileSection'][_0x488b('0x46')](_0x89749c)[_0x488b('0x22')](handleEntityNotFound(_0x99a9f6,null))[_0x488b('0x22')](respondWithResult(_0x99a9f6,null))[_0x488b('0x42')](handleError(_0x99a9f6,null));};exports[_0x488b('0x47')]=function(_0x502f36,_0x1f3ac8){return db['UserProfileSection'][_0x488b('0x47')](_0x502f36[_0x488b('0x48')],{})[_0x488b('0x22')](respondWithResult(_0x1f3ac8,0xc9))[_0x488b('0x42')](handleError(_0x1f3ac8,null));};exports[_0x488b('0x20')]=function(_0x2836c8,_0x43755d){if(_0x2836c8[_0x488b('0x48')]['id']){delete _0x2836c8[_0x488b('0x48')]['id'];}return db[_0x488b('0x3e')][_0x488b('0x46')]({'where':{'id':_0x2836c8[_0x488b('0x43')]['id']}})[_0x488b('0x22')](handleEntityNotFound(_0x43755d,null))['then'](saveUpdates(_0x2836c8['body'],null))[_0x488b('0x22')](respondWithResult(_0x43755d,null))[_0x488b('0x42')](handleError(_0x43755d,null));};exports[_0x488b('0x21')]=function(_0x1b955b,_0x35dd3d){return db[_0x488b('0x3e')][_0x488b('0x46')]({'where':{'id':_0x1b955b[_0x488b('0x43')]['id']}})[_0x488b('0x22')](handleEntityNotFound(_0x35dd3d,null))[_0x488b('0x22')](removeEntity(_0x35dd3d,null))[_0x488b('0x42')](handleError(_0x35dd3d,null));};exports['describe']=function(_0x5dee48,_0x26f6c1){return db['UserProfileSection'][_0x488b('0x49')]()[_0x488b('0x22')](respondWithResult(_0x26f6c1,null))['catch'](handleError(_0x26f6c1,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6077c1e..5c5b163 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 _0xcda6=['rimraf','../../config/environment','exports','define','compositeIndex','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcda6,0x15a));var _0x6cda=function(_0x4cfcbf,_0x357d6b){_0x4cfcbf=_0x4cfcbf-0x0;var _0x47e573=_0xcda6[_0x4cfcbf];return _0x47e573;};'use strict';var _=require(_0x6cda('0x0'));var util=require('util');var logger=require(_0x6cda('0x1'))(_0x6cda('0x2'));var moment=require('moment');var BPromise=require(_0x6cda('0x3'));var rp=require(_0x6cda('0x4'));var fs=require('fs');var path=require(_0x6cda('0x5'));var rimraf=require(_0x6cda('0x6'));var config=require(_0x6cda('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x6cda('0x8')]=function(_0x484bd8,_0x3a32f4){return _0x484bd8[_0x6cda('0x9')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x6cda('0xa'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xff5d=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection'];(function(_0x1084af,_0x3c1eb2){var _0xe61732=function(_0x1daf63){while(--_0x1daf63){_0x1084af['push'](_0x1084af['shift']());}};_0xe61732(++_0x3c1eb2);}(_0xff5d,0xf4));var _0xdff5=function(_0x3e0913,_0x28e7a7){_0x3e0913=_0x3e0913-0x0;var _0x457825=_0xff5d[_0x3e0913];return _0x457825;};'use strict';var _=require(_0xdff5('0x0'));var util=require(_0xdff5('0x1'));var logger=require('../../config/logger')(_0xdff5('0x2'));var moment=require(_0xdff5('0x3'));var BPromise=require(_0xdff5('0x4'));var rp=require(_0xdff5('0x5'));var fs=require('fs');var path=require(_0xdff5('0x6'));var rimraf=require(_0xdff5('0x7'));var config=require(_0xdff5('0x8'));var attributes=require(_0xdff5('0x9'));module[_0xdff5('0xa')]=function(_0x454bb4,_0x3e5946){return _0x454bb4['define'](_0xdff5('0xb'),attributes,{'tableName':_0xdff5('0xc'),'paranoid':![],'indexes':[{'name':_0xdff5('0xd'),'fields':[_0xdff5('0xe'),_0xdff5('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 1fadac3..4330580 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 _0xf4e3=['../../config/environment','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf4e3,0x12e));var _0x3f4e=function(_0x3c40f4,_0x500b8a){_0x3c40f4=_0x3c40f4-0x0;var _0x1209d=_0xf4e3[_0x3c40f4];return _0x1209d;};'use strict';var _=require(_0x3f4e('0x0'));var util=require(_0x3f4e('0x1'));var moment=require(_0x3f4e('0x2'));var BPromise=require(_0x3f4e('0x3'));var rs=require(_0x3f4e('0x4'));var fs=require('fs');var Redis=require(_0x3f4e('0x5'));var db=require(_0x3f4e('0x6'))['db'];var utils=require(_0x3f4e('0x7'));var logger=require(_0x3f4e('0x8'))(_0x3f4e('0x9'));var config=require(_0x3f4e('0xa'));var jayson=require(_0x3f4e('0xb'));var client=jayson[_0x3f4e('0xc')][_0x3f4e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ae617,_0x11409f,_0x1eb383){return new BPromise(function(_0x12abae,_0x29a52d){return client['request'](_0x3ae617,_0x1eb383)['then'](function(_0xf8be92){logger[_0x3f4e('0xe')](_0x3f4e('0xf'),_0x11409f,_0x3f4e('0x10'));logger[_0x3f4e('0x11')](_0x3f4e('0x12'),_0x11409f,_0x3f4e('0x10'),JSON[_0x3f4e('0x13')](_0xf8be92));if(_0xf8be92[_0x3f4e('0x14')]){if(_0xf8be92[_0x3f4e('0x14')][_0x3f4e('0x15')]===0x1f4){logger[_0x3f4e('0x14')](_0x3f4e('0xf'),_0x11409f,_0xf8be92[_0x3f4e('0x14')]['message']);return _0x29a52d(_0xf8be92[_0x3f4e('0x14')][_0x3f4e('0x16')]);}logger['error'](_0x3f4e('0xf'),_0x11409f,_0xf8be92[_0x3f4e('0x14')][_0x3f4e('0x16')]);return _0x12abae(_0xf8be92[_0x3f4e('0x14')][_0x3f4e('0x16')]);}else{logger[_0x3f4e('0xe')](_0x3f4e('0xf'),_0x11409f,_0x3f4e('0x10'));_0x12abae(_0xf8be92['result'][_0x3f4e('0x16')]);}})[_0x3f4e('0x17')](function(_0x140c94){logger[_0x3f4e('0x14')](_0x3f4e('0xf'),_0x11409f,_0x140c94);_0x29a52d(_0x140c94);});});} \ No newline at end of file +var _0x7f86=['rpc','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x54caf4,_0x129baa){var _0x4b7650=function(_0x29233d){while(--_0x29233d){_0x54caf4['push'](_0x54caf4['shift']());}};_0x4b7650(++_0x129baa);}(_0x7f86,0xea));var _0x67f8=function(_0x26c4c5,_0x493d6d){_0x26c4c5=_0x26c4c5-0x0;var _0x23152b=_0x7f86[_0x26c4c5];return _0x23152b;};'use strict';var _=require(_0x67f8('0x0'));var util=require(_0x67f8('0x1'));var moment=require(_0x67f8('0x2'));var BPromise=require(_0x67f8('0x3'));var rs=require(_0x67f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67f8('0x5'))['db'];var utils=require(_0x67f8('0x6'));var logger=require(_0x67f8('0x7'))(_0x67f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x67f8('0x9'));var client=jayson[_0x67f8('0xa')][_0x67f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d8d1a,_0x4eb036,_0x8bf433){return new BPromise(function(_0xe4b2f1,_0xfc0abf){return client[_0x67f8('0xc')](_0x5d8d1a,_0x8bf433)['then'](function(_0x3601c0){logger[_0x67f8('0xd')](_0x67f8('0xe'),_0x4eb036,_0x67f8('0xf'));logger[_0x67f8('0x10')](_0x67f8('0x11'),_0x4eb036,'request\x20sent',JSON[_0x67f8('0x12')](_0x3601c0));if(_0x3601c0['error']){if(_0x3601c0['error']['code']===0x1f4){logger[_0x67f8('0x13')](_0x67f8('0xe'),_0x4eb036,_0x3601c0[_0x67f8('0x13')]['message']);return _0xfc0abf(_0x3601c0[_0x67f8('0x13')][_0x67f8('0x14')]);}logger[_0x67f8('0x13')](_0x67f8('0xe'),_0x4eb036,_0x3601c0[_0x67f8('0x13')][_0x67f8('0x14')]);return _0xe4b2f1(_0x3601c0[_0x67f8('0x13')]['message']);}else{logger['info'](_0x67f8('0xe'),_0x4eb036,_0x67f8('0xf'));_0xe4b2f1(_0x3601c0[_0x67f8('0x15')][_0x67f8('0x14')]);}})['catch'](function(_0x33ed8f){logger[_0x67f8('0x13')](_0x67f8('0xe'),_0x4eb036,_0x33ed8f);_0xfc0abf(_0x33ed8f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index f99589a..05ae491 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 _0x5ab2=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x5ab2,0xc0));var _0x25ab=function(_0x1c84cd,_0x47e634){_0x1c84cd=_0x1c84cd-0x0;var _0x4e2b23=_0x5ab2[_0x1c84cd];return _0x4e2b23;};'use strict';var multer=require(_0x25ab('0x0'));var util=require(_0x25ab('0x1'));var path=require('path');var timeout=require(_0x25ab('0x2'));var express=require('express');var router=express[_0x25ab('0x3')]();var auth=require(_0x25ab('0x4'));var interaction=require(_0x25ab('0x5'));var config=require(_0x25ab('0x6'));module[_0x25ab('0x7')]=router; \ No newline at end of file +var _0x7e8a=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e8a,0x1b2));var _0xa7e8=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x7e8a[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0xa7e8('0x0'));var util=require(_0xa7e8('0x1'));var path=require(_0xa7e8('0x2'));var timeout=require(_0xa7e8('0x3'));var express=require(_0xa7e8('0x4'));var router=express[_0xa7e8('0x5')]();var auth=require(_0xa7e8('0x6'));var interaction=require(_0xa7e8('0x7'));var config=require('../../config/environment');module[_0xa7e8('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index eb32ef0..bd4ebde 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 _0xbaf0=['exports','INTEGER'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x5325c0,_0x2d411f){var _0x14e031=function(_0x5e5262){while(--_0x5e5262){_0x5325c0['push'](_0x5325c0['shift']());}};_0x14e031(++_0x2d411f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index eb50671..5eaf230 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 _0x5825=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues'];(function(_0x15a357,_0x5701c3){var _0x485d96=function(_0x31ffa0){while(--_0x31ffa0){_0x15a357['push'](_0x15a357['shift']());}};_0x485d96(++_0x5701c3);}(_0x5825,0x78));var _0x5582=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5825[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x5582('0x0'));var util=require(_0x5582('0x1'));var logger=require(_0x5582('0x2'))(_0x5582('0x3'));var moment=require('moment');var BPromise=require(_0x5582('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5582('0x5'));var rimraf=require(_0x5582('0x6'));var config=require(_0x5582('0x7'));var attributes=require(_0x5582('0x8'));module[_0x5582('0x9')]=function(_0x11eb87,_0x17a897){return _0x11eb87['define'](_0x5582('0xa'),attributes,{'tableName':_0x5582('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa588=['exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x571609,_0x18ea2c){var _0x13840a=function(_0x53fd92){while(--_0x53fd92){_0x571609['push'](_0x571609['shift']());}};_0x13840a(++_0x18ea2c);}(_0xa588,0xe1));var _0x8a58=function(_0xdf9b3c,_0xb472f0){_0xdf9b3c=_0xdf9b3c-0x0;var _0x5d7d6b=_0xa588[_0xdf9b3c];return _0x5d7d6b;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var logger=require(_0x8a58('0x1'))(_0x8a58('0x2'));var moment=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var rp=require(_0x8a58('0x5'));var fs=require('fs');var path=require(_0x8a58('0x6'));var rimraf=require(_0x8a58('0x7'));var config=require(_0x8a58('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x8a58('0x9')]=function(_0x408a4a,_0x448366){return _0x408a4a[_0x8a58('0xa')](_0x8a58('0xb'),attributes,{'tableName':_0x8a58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 0c59c2b..ee7d45c 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 _0xaafe=['http','request','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x21e2c6,_0x15548c){var _0xce8ddf=function(_0x28ece6){while(--_0x28ece6){_0x21e2c6['push'](_0x21e2c6['shift']());}};_0xce8ddf(++_0x15548c);}(_0xaafe,0x186));var _0xeaaf=function(_0x5365a3,_0x3552de){_0x5365a3=_0x5365a3-0x0;var _0x2fa252=_0xaafe[_0x5365a3];return _0x2fa252;};'use strict';var _=require(_0xeaaf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeaaf('0x1'));var rs=require(_0xeaaf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaaf('0x3'))['db'];var utils=require(_0xeaaf('0x4'));var logger=require(_0xeaaf('0x5'))(_0xeaaf('0x6'));var config=require(_0xeaaf('0x7'));var jayson=require(_0xeaaf('0x8'));var client=jayson[_0xeaaf('0x9')][_0xeaaf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16bddf,_0x3fdf1c,_0x514b4e){return new BPromise(function(_0x3dcf95,_0xa555da){return client[_0xeaaf('0xb')](_0x16bddf,_0x514b4e)['then'](function(_0x4ad53f){logger[_0xeaaf('0xc')](_0xeaaf('0xd'),_0x3fdf1c,'request\x20sent');logger['debug'](_0xeaaf('0xe'),_0x3fdf1c,_0xeaaf('0xf'),JSON[_0xeaaf('0x10')](_0x4ad53f));if(_0x4ad53f['error']){if(_0x4ad53f['error'][_0xeaaf('0x11')]===0x1f4){logger[_0xeaaf('0x12')](_0xeaaf('0xd'),_0x3fdf1c,_0x4ad53f[_0xeaaf('0x12')][_0xeaaf('0x13')]);return _0xa555da(_0x4ad53f['error'][_0xeaaf('0x13')]);}logger['error'](_0xeaaf('0xd'),_0x3fdf1c,_0x4ad53f[_0xeaaf('0x12')][_0xeaaf('0x13')]);return _0x3dcf95(_0x4ad53f[_0xeaaf('0x12')]['message']);}else{logger[_0xeaaf('0xc')](_0xeaaf('0xd'),_0x3fdf1c,_0xeaaf('0xf'));_0x3dcf95(_0x4ad53f['result'][_0xeaaf('0x13')]);}})['catch'](function(_0x48537d){logger['error'](_0xeaaf('0xd'),_0x3fdf1c,_0x48537d);_0xa555da(_0x48537d);});});} \ No newline at end of file +var _0x6031=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserSmsQueue,\x20%s,\x20%s','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x6031,0x1d3));var _0x1603=function(_0x3ad0ed,_0x1bb71c){_0x3ad0ed=_0x3ad0ed-0x0;var _0x6849c7=_0x6031[_0x3ad0ed];return _0x6849c7;};'use strict';var _=require(_0x1603('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1603('0x1'));var db=require(_0x1603('0x2'))['db'];var utils=require(_0x1603('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x1603('0x4'));var jayson=require(_0x1603('0x5'));var client=jayson[_0x1603('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ce0ef,_0x6c0ff8,_0x4f1523){return new BPromise(function(_0x4f3ec0,_0x59b873){return client['request'](_0x5ce0ef,_0x4f1523)[_0x1603('0x7')](function(_0x3dd7b0){logger[_0x1603('0x8')]('UserSmsQueue,\x20%s,\x20%s',_0x6c0ff8,_0x1603('0x9'));logger[_0x1603('0xa')](_0x1603('0xb'),_0x6c0ff8,_0x1603('0x9'),JSON[_0x1603('0xc')](_0x3dd7b0));if(_0x3dd7b0[_0x1603('0xd')]){if(_0x3dd7b0[_0x1603('0xd')]['code']===0x1f4){logger[_0x1603('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x6c0ff8,_0x3dd7b0[_0x1603('0xd')]['message']);return _0x59b873(_0x3dd7b0[_0x1603('0xd')][_0x1603('0xe')]);}logger[_0x1603('0xd')](_0x1603('0xf'),_0x6c0ff8,_0x3dd7b0[_0x1603('0xd')][_0x1603('0xe')]);return _0x4f3ec0(_0x3dd7b0['error'][_0x1603('0xe')]);}else{logger['info'](_0x1603('0xf'),_0x6c0ff8,_0x1603('0x9'));_0x4f3ec0(_0x3dd7b0['result'][_0x1603('0xe')]);}})[_0x1603('0x10')](function(_0x1e15df){logger[_0x1603('0xd')](_0x1603('0xf'),_0x6c0ff8,_0x1e15df);_0x59b873(_0x1e15df);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 2c77cbf..e0e431a 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 _0xe3a1=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3a1,0x1e9));var _0x1e3a=function(_0x1b4e42,_0x298ecb){_0x1b4e42=_0x1b4e42-0x0;var _0x4b6ac9=_0xe3a1[_0x1b4e42];return _0x4b6ac9;};'use strict';var multer=require(_0x1e3a('0x0'));var util=require(_0x1e3a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e3a('0x2'));var router=express[_0x1e3a('0x3')]();var auth=require(_0x1e3a('0x4'));var interaction=require(_0x1e3a('0x5'));var config=require(_0x1e3a('0x6'));module['exports']=router; \ No newline at end of file +var _0x450c=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x11883b,_0x21c6af){var _0x169e65=function(_0x44aefd){while(--_0x44aefd){_0x11883b['push'](_0x11883b['shift']());}};_0x169e65(++_0x21c6af);}(_0x450c,0x130));var _0xc450=function(_0x22e7c4,_0x1a2942){_0x22e7c4=_0x22e7c4-0x0;var _0xc91e03=_0x450c[_0x22e7c4];return _0xc91e03;};'use strict';var multer=require(_0xc450('0x0'));var util=require(_0xc450('0x1'));var path=require(_0xc450('0x2'));var timeout=require('connect-timeout');var express=require(_0xc450('0x3'));var router=express[_0xc450('0x4')]();var auth=require(_0xc450('0x5'));var interaction=require(_0xc450('0x6'));var config=require(_0xc450('0x7'));module[_0xc450('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2d81095..2575c2d 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(_0x1ce20f,_0x1e0e71){var _0x2458a4=function(_0x138760){while(--_0x138760){_0x1ce20f['push'](_0x1ce20f['shift']());}};_0x2458a4(++_0x1e0e71);}(_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 _0xbaf0=['exports','INTEGER'];(function(_0x3ee5df,_0x583073){var _0x446d24=function(_0x12e54e){while(--_0x12e54e){_0x3ee5df['push'](_0x3ee5df['shift']());}};_0x446d24(++_0x583073);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 20d8f2e..6f797d0 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 _0x0c7a=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x10142c,_0x1ef1a8){var _0x12f44f=function(_0x3edb5c){while(--_0x3edb5c){_0x10142c['push'](_0x10142c['shift']());}};_0x12f44f(++_0x1ef1a8);}(_0x0c7a,0x167));var _0xa0c7=function(_0x4c5f77,_0xcbcf0){_0x4c5f77=_0x4c5f77-0x0;var _0xd0fd5f=_0x0c7a[_0x4c5f77];return _0xd0fd5f;};'use strict';var _=require(_0xa0c7('0x0'));var util=require(_0xa0c7('0x1'));var logger=require(_0xa0c7('0x2'))(_0xa0c7('0x3'));var moment=require('moment');var BPromise=require(_0xa0c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0c7('0x5'));var rimraf=require(_0xa0c7('0x6'));var config=require(_0xa0c7('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0xa0c7('0x8')]=function(_0xcfd2c,_0x5c4c7a){return _0xcfd2c[_0xa0c7('0x9')](_0xa0c7('0xa'),attributes,{'tableName':_0xa0c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b25=['define','user_has_voice_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x566474,_0x497a56){var _0x5f187f=function(_0x3c94b6){while(--_0x3c94b6){_0x566474['push'](_0x566474['shift']());}};_0x5f187f(++_0x497a56);}(_0x4b25,0x9e));var _0x54b2=function(_0x18b37a,_0x2c1fd2){_0x18b37a=_0x18b37a-0x0;var _0x2217c8=_0x4b25[_0x18b37a];return _0x2217c8;};'use strict';var _=require(_0x54b2('0x0'));var util=require(_0x54b2('0x1'));var logger=require('../../config/logger')(_0x54b2('0x2'));var moment=require(_0x54b2('0x3'));var BPromise=require(_0x54b2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54b2('0x5'));var rimraf=require(_0x54b2('0x6'));var config=require(_0x54b2('0x7'));var attributes=require(_0x54b2('0x8'));module[_0x54b2('0x9')]=function(_0x345e91,_0x5c9bf4){return _0x345e91[_0x54b2('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x54b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index fca8362..0d9ec3d 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 _0xac4f=['stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x55ed76,_0x55d575){var _0x212c9b=function(_0x305179){while(--_0x305179){_0x55ed76['push'](_0x55ed76['shift']());}};_0x212c9b(++_0x55d575);}(_0xac4f,0xcf));var _0xfac4=function(_0x6eb02d,_0x20bdf5){_0x6eb02d=_0x6eb02d-0x0;var _0xb756de=_0xac4f[_0x6eb02d];return _0xb756de;};'use strict';var _=require(_0xfac4('0x0'));var util=require(_0xfac4('0x1'));var moment=require('moment');var BPromise=require(_0xfac4('0x2'));var rs=require(_0xfac4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfac4('0x4'))['db'];var utils=require(_0xfac4('0x5'));var logger=require('../../config/logger')(_0xfac4('0x6'));var config=require(_0xfac4('0x7'));var jayson=require(_0xfac4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52fac5,_0x1f4df6,_0x5c62b6){return new BPromise(function(_0x2084e0,_0x54f914){return client[_0xfac4('0x9')](_0x52fac5,_0x5c62b6)[_0xfac4('0xa')](function(_0x306118){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x1f4df6,'request\x20sent');logger[_0xfac4('0xb')](_0xfac4('0xc'),_0x1f4df6,'request\x20sent',JSON[_0xfac4('0xd')](_0x306118));if(_0x306118[_0xfac4('0xe')]){if(_0x306118[_0xfac4('0xe')][_0xfac4('0xf')]===0x1f4){logger[_0xfac4('0xe')](_0xfac4('0x10'),_0x1f4df6,_0x306118[_0xfac4('0xe')][_0xfac4('0x11')]);return _0x54f914(_0x306118[_0xfac4('0xe')][_0xfac4('0x11')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1f4df6,_0x306118[_0xfac4('0xe')][_0xfac4('0x11')]);return _0x2084e0(_0x306118['error'][_0xfac4('0x11')]);}else{logger[_0xfac4('0x12')](_0xfac4('0x10'),_0x1f4df6,_0xfac4('0x13'));_0x2084e0(_0x306118[_0xfac4('0x14')][_0xfac4('0x11')]);}})[_0xfac4('0x15')](function(_0x1eefd6){logger['error'](_0xfac4('0x10'),_0x1f4df6,_0x1eefd6);_0x54f914(_0x1eefd6);});});} \ No newline at end of file +var _0xa728=['UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa728,0x64));var _0x8a72=function(_0x22e94e,_0x4f748e){_0x22e94e=_0x22e94e-0x0;var _0x5deac7=_0xa728[_0x22e94e];return _0x5deac7;};'use strict';var _=require(_0x8a72('0x0'));var util=require(_0x8a72('0x1'));var moment=require(_0x8a72('0x2'));var BPromise=require(_0x8a72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a72('0x4'));var db=require(_0x8a72('0x5'))['db'];var utils=require(_0x8a72('0x6'));var logger=require(_0x8a72('0x7'))(_0x8a72('0x8'));var config=require(_0x8a72('0x9'));var jayson=require(_0x8a72('0xa'));var client=jayson[_0x8a72('0xb')][_0x8a72('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe872f4,_0x30b529,_0x4d77f6){return new BPromise(function(_0x1adf0c,_0x36ecc7){return client[_0x8a72('0xd')](_0xe872f4,_0x4d77f6)['then'](function(_0x5bd953){logger[_0x8a72('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x30b529,_0x8a72('0xf'));logger[_0x8a72('0x10')](_0x8a72('0x11'),_0x30b529,'request\x20sent',JSON[_0x8a72('0x12')](_0x5bd953));if(_0x5bd953['error']){if(_0x5bd953['error']['code']===0x1f4){logger[_0x8a72('0x13')](_0x8a72('0x14'),_0x30b529,_0x5bd953['error'][_0x8a72('0x15')]);return _0x36ecc7(_0x5bd953[_0x8a72('0x13')][_0x8a72('0x15')]);}logger[_0x8a72('0x13')](_0x8a72('0x14'),_0x30b529,_0x5bd953['error'][_0x8a72('0x15')]);return _0x1adf0c(_0x5bd953[_0x8a72('0x13')]['message']);}else{logger[_0x8a72('0xe')](_0x8a72('0x14'),_0x30b529,_0x8a72('0xf'));_0x1adf0c(_0x5bd953[_0x8a72('0x16')][_0x8a72('0x15')]);}})[_0x8a72('0x17')](function(_0x189c22){logger['error'](_0x8a72('0x14'),_0x30b529,_0x189c22);_0x36ecc7(_0x189c22);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 748f884..6b5612f 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 _0xd4ff=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0xfe0b5f,_0x4bf7aa){var _0x4c0bde=function(_0x108a63){while(--_0x108a63){_0xfe0b5f['push'](_0xfe0b5f['shift']());}};_0x4c0bde(++_0x4bf7aa);}(_0xd4ff,0x68));var _0xfd4f=function(_0x1934fc,_0x437669){_0x1934fc=_0x1934fc-0x0;var _0x4c2de0=_0xd4ff[_0x1934fc];return _0x4c2de0;};'use strict';var multer=require(_0xfd4f('0x0'));var util=require('util');var path=require(_0xfd4f('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd4f('0x2'));var router=express[_0xfd4f('0x3')]();var auth=require(_0xfd4f('0x4'));var interaction=require(_0xfd4f('0x5'));var config=require(_0xfd4f('0x6'));module[_0xfd4f('0x7')]=router; \ No newline at end of file +var _0xd95d=['express','../../components/auth/service','exports','multer','path','connect-timeout'];(function(_0x327765,_0x11a5dd){var _0x5285a6=function(_0x56091b){while(--_0x56091b){_0x327765['push'](_0x327765['shift']());}};_0x5285a6(++_0x11a5dd);}(_0xd95d,0x159));var _0xdd95=function(_0x3611f2,_0x4ef70c){_0x3611f2=_0x3611f2-0x0;var _0x3d6c0c=_0xd95d[_0x3611f2];return _0x3d6c0c;};'use strict';var multer=require(_0xdd95('0x0'));var util=require('util');var path=require(_0xdd95('0x1'));var timeout=require(_0xdd95('0x2'));var express=require(_0xdd95('0x3'));var router=express['Router']();var auth=require(_0xdd95('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xdd95('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 0a9e319..72c4e8e 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 _0x2706=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3ad017,_0x436bef){var _0x40a3db=function(_0x3b0631){while(--_0x3b0631){_0x3ad017['push'](_0x3ad017['shift']());}};_0x40a3db(++_0x436bef);}(_0x2706,0xf2));var _0x6270=function(_0x94030f,_0x476ed2){_0x94030f=_0x94030f-0x0;var _0x9f7747=_0x2706[_0x94030f];return _0x9f7747;};'use strict';var Sequelize=require('sequelize');module[_0x6270('0x0')]={'uniqueid':{'type':Sequelize[_0x6270('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6270('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x6270('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6270('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x6270('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6270('0x4'),'comment':_0x6270('0x2')},'penalty':{'type':Sequelize[_0x6270('0x1')](0xb),'defaultValue':0x0,'comment':_0x6270('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6270('0x2')}}; \ No newline at end of file +var _0x48c0=['exports','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x3d1026,_0x5f0251){var _0x4a9f2a=function(_0x1a97cf){while(--_0x1a97cf){_0x3d1026['push'](_0x3d1026['shift']());}};_0x4a9f2a(++_0x5f0251);}(_0x48c0,0x18b));var _0x048c=function(_0x44e329,_0x4187b9){_0x44e329=_0x44e329-0x0;var _0x238822=_0x48c0[_0x44e329];return _0x238822;};'use strict';var Sequelize=require(_0x048c('0x0'));module[_0x048c('0x1')]={'uniqueid':{'type':Sequelize[_0x048c('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x048c('0x3')],'allowNull':![],'comment':_0x048c('0x4')},'UserId':{'type':Sequelize[_0x048c('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x048c('0x3')],'allowNull':![],'unique':_0x048c('0x5'),'comment':_0x048c('0x4')},'VoiceQueueId':{'type':Sequelize[_0x048c('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x048c('0x5'),'comment':_0x048c('0x4')},'penalty':{'type':Sequelize[_0x048c('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index a942a63..32ae695 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 _0x8b5b=['../../mysqldb','UserVoiceQueueRt','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x50ad95,_0x530cfe){var _0xfc94ee=function(_0x1e7720){while(--_0x1e7720){_0x50ad95['push'](_0x50ad95['shift']());}};_0xfc94ee(++_0x530cfe);}(_0x8b5b,0x170));var _0xb8b5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8b5b[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xb8b5('0x0'));var UserVoiceQueueRt=require(_0xb8b5('0x1'))['db'][_0xb8b5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb8b5('0x3'),'afterDestroy':_0xb8b5('0x4')};function emitEvent(_0x5b47b6){return function(_0x1f83a0,_0x5b27bf,_0x1386d9){UserVoiceQueueRtEvents[_0xb8b5('0x5')](_0x5b47b6+':'+_0x1f83a0['id'],_0x1f83a0);UserVoiceQueueRtEvents[_0xb8b5('0x5')](_0x5b47b6,_0x1f83a0);_0x1386d9(null);};}for(var e in events){if(events[_0xb8b5('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xb8b5('0x7')](e,emitEvent(event));}}module[_0xb8b5('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x8985=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x8985,0xe8));var _0x5898=function(_0x3fde1f,_0x2fe5c7){_0x3fde1f=_0x3fde1f-0x0;var _0x46e413=_0x8985[_0x3fde1f];return _0x46e413;};'use strict';var EventEmitter=require(_0x5898('0x0'));var UserVoiceQueueRt=require(_0x5898('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5898('0x2')](0x0);var events={'afterCreate':_0x5898('0x3'),'afterUpdate':_0x5898('0x4'),'afterDestroy':_0x5898('0x5')};function emitEvent(_0xe9e1b2){return function(_0x3b20b0,_0x272222,_0x100094){UserVoiceQueueRtEvents['emit'](_0xe9e1b2+':'+_0x3b20b0['id'],_0x3b20b0);UserVoiceQueueRtEvents[_0x5898('0x6')](_0xe9e1b2,_0x3b20b0);_0x100094(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5898('0x7')](e,emitEvent(event));}}module[_0x5898('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 38bbf03..8735efc 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 _0x3c1b=['../../config/logger','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x56cd16,_0x3db791){var _0x519d7a=function(_0x3fe80a){while(--_0x3fe80a){_0x56cd16['push'](_0x56cd16['shift']());}};_0x519d7a(++_0x3db791);}(_0x3c1b,0xb2));var _0xb3c1=function(_0x184fec,_0x5ba796){_0x184fec=_0x184fec-0x0;var _0x5aa2a9=_0x3c1b[_0x184fec];return _0x5aa2a9;};'use strict';var _=require(_0xb3c1('0x0'));var util=require(_0xb3c1('0x1'));var logger=require(_0xb3c1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb3c1('0x3'));var rp=require(_0xb3c1('0x4'));var fs=require('fs');var path=require(_0xb3c1('0x5'));var rimraf=require(_0xb3c1('0x6'));var config=require('../../config/environment');var attributes=require(_0xb3c1('0x7'));module[_0xb3c1('0x8')]=function(_0x54705a,_0x1d62a4){return _0x54705a[_0xb3c1('0x9')](_0xb3c1('0xa'),attributes,{'tableName':_0xb3c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c79=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x3c79,0x1c5));var _0x93c7=function(_0x1a5c42,_0x407c0b){_0x1a5c42=_0x1a5c42-0x0;var _0x175861=_0x3c79[_0x1a5c42];return _0x175861;};'use strict';var _=require(_0x93c7('0x0'));var util=require(_0x93c7('0x1'));var logger=require(_0x93c7('0x2'))(_0x93c7('0x3'));var moment=require(_0x93c7('0x4'));var BPromise=require(_0x93c7('0x5'));var rp=require(_0x93c7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x93c7('0x7'));var attributes=require(_0x93c7('0x8'));module[_0x93c7('0x9')]=function(_0x5f19e3,_0x28fca9){return _0x5f19e3[_0x93c7('0xa')](_0x93c7('0xb'),attributes,{'tableName':_0x93c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index bbdd2ee..16a3d92 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 _0xab46=['error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','stringify','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x4b0c3e,_0x5e5611){var _0x25643b=function(_0x37222f){while(--_0x37222f){_0x4b0c3e['push'](_0x4b0c3e['shift']());}};_0x25643b(++_0x5e5611);}(_0xab46,0x7b));var _0x6ab4=function(_0x2d0d97,_0x2d9560){_0x2d0d97=_0x2d0d97-0x0;var _0xfb96e9=_0xab46[_0x2d0d97];return _0xfb96e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ab4('0x0'));var BPromise=require(_0x6ab4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ab4('0x3'));var logger=require(_0x6ab4('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ab4('0x5'));var client=jayson[_0x6ab4('0x6')][_0x6ab4('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6ab4('0x8')],{'host':_0x6ab4('0x9'),'port':0x18eb});var socket=require(_0x6ab4('0xa'))(new Redis(config[_0x6ab4('0x8')]));require(_0x6ab4('0xb'))[_0x6ab4('0xc')](socket);function respondWithRpcPromise(_0x5a520f,_0x425b58,_0x2cf451){return new BPromise(function(_0x19cc95,_0x2e9cfb){return client['request'](_0x5a520f,_0x2cf451)['then'](function(_0x4f9d60){logger[_0x6ab4('0xd')](_0x6ab4('0xe'),_0x425b58,_0x6ab4('0xf'));logger['debug'](_0x6ab4('0x10'),_0x425b58,'request\x20sent',JSON['stringify'](_0x4f9d60));if(_0x4f9d60[_0x6ab4('0x11')]){if(_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x12')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x425b58,_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x13')]);return _0x2e9cfb(_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x13')]);}logger[_0x6ab4('0x11')](_0x6ab4('0xe'),_0x425b58,_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x13')]);return _0x19cc95(_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x13')]);}else{logger[_0x6ab4('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x425b58,_0x6ab4('0xf'));_0x19cc95(_0x4f9d60[_0x6ab4('0x14')][_0x6ab4('0x13')]);}})[_0x6ab4('0x15')](function(_0x236317){logger[_0x6ab4('0x11')](_0x6ab4('0xe'),_0x425b58,_0x236317);_0x2e9cfb(_0x236317);});});}exports['GetVoiceQueueRtPauses']=function(_0x1ce55b){var _0x3734cb=this;return new Promise(function(_0x1686b7,_0x5654d3){return db[_0x6ab4('0x16')][_0x6ab4('0x17')]({'raw':_0x1ce55b[_0x6ab4('0x18')]?_0x1ce55b['options'][_0x6ab4('0x19')]===undefined?!![]:![]:!![],'where':_0x1ce55b[_0x6ab4('0x18')]?_0x1ce55b[_0x6ab4('0x18')][_0x6ab4('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6ab4('0x1b'),db['sequelize']['fn']('IF',db[_0x6ab4('0x1c')][_0x6ab4('0x1d')](_0x6ab4('0x1e')))),_0x6ab4('0x1f')]]})[_0x6ab4('0x20')](function(_0x6ef5c0){logger[_0x6ab4('0xd')](_0x6ab4('0x21'),_0x1ce55b);logger['debug'](_0x6ab4('0x21'),_0x1ce55b,JSON[_0x6ab4('0x22')](_0x6ef5c0));_0x1686b7(_0x6ef5c0);})['catch'](function(_0x2ee250){logger[_0x6ab4('0x11')](_0x6ab4('0x21'),_0x2ee250['message'],_0x1ce55b);_0x5654d3(_0x3734cb[_0x6ab4('0x11')](0x1f4,_0x2ee250[_0x6ab4('0x13')]));});});}; \ No newline at end of file +var _0xd3cc=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','then','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3cc,0x11d));var _0xcd3c=function(_0x2f8a2d,_0x14e926){_0x2f8a2d=_0x2f8a2d-0x0;var _0x4be556=_0xd3cc[_0x2f8a2d];return _0x4be556;};'use strict';var _=require(_0xcd3c('0x0'));var util=require(_0xcd3c('0x1'));var moment=require(_0xcd3c('0x2'));var BPromise=require(_0xcd3c('0x3'));var rs=require(_0xcd3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd3c('0x5'))['db'];var utils=require(_0xcd3c('0x6'));var logger=require('../../config/logger')(_0xcd3c('0x7'));var config=require(_0xcd3c('0x8'));var jayson=require(_0xcd3c('0x9'));var client=jayson[_0xcd3c('0xa')][_0xcd3c('0xb')]({'port':0x232a});config[_0xcd3c('0xc')]=_['defaults'](config[_0xcd3c('0xc')],{'host':_0xcd3c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd3c('0xc')]));require(_0xcd3c('0xe'))[_0xcd3c('0xf')](socket);function respondWithRpcPromise(_0x398ad0,_0x198700,_0x151a7a){return new BPromise(function(_0x44069f,_0x3ddbc3){return client[_0xcd3c('0x10')](_0x398ad0,_0x151a7a)['then'](function(_0x333325){logger[_0xcd3c('0x11')](_0xcd3c('0x12'),_0x198700,_0xcd3c('0x13'));logger[_0xcd3c('0x14')](_0xcd3c('0x15'),_0x198700,'request\x20sent',JSON[_0xcd3c('0x16')](_0x333325));if(_0x333325[_0xcd3c('0x17')]){if(_0x333325[_0xcd3c('0x17')]['code']===0x1f4){logger[_0xcd3c('0x17')](_0xcd3c('0x12'),_0x198700,_0x333325[_0xcd3c('0x17')][_0xcd3c('0x18')]);return _0x3ddbc3(_0x333325[_0xcd3c('0x17')][_0xcd3c('0x18')]);}logger[_0xcd3c('0x17')](_0xcd3c('0x12'),_0x198700,_0x333325[_0xcd3c('0x17')][_0xcd3c('0x18')]);return _0x44069f(_0x333325[_0xcd3c('0x17')][_0xcd3c('0x18')]);}else{logger[_0xcd3c('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x198700,_0xcd3c('0x13'));_0x44069f(_0x333325[_0xcd3c('0x19')][_0xcd3c('0x18')]);}})['catch'](function(_0x5cdd92){logger[_0xcd3c('0x17')](_0xcd3c('0x12'),_0x198700,_0x5cdd92);_0x3ddbc3(_0x5cdd92);});});}exports[_0xcd3c('0x1a')]=function(_0x492a58){var _0x39e0f7=this;return new Promise(function(_0xd83364,_0x46130e){return db[_0xcd3c('0x1b')][_0xcd3c('0x1c')]({'raw':_0x492a58[_0xcd3c('0x1d')]?_0x492a58[_0xcd3c('0x1d')][_0xcd3c('0x1e')]===undefined?!![]:![]:!![],'where':_0x492a58['options']?_0x492a58['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xcd3c('0x1f'),db[_0xcd3c('0x20')]['fn']('IF',db[_0xcd3c('0x20')]['literal'](_0xcd3c('0x21')))),'outboundQueuePauses']]})[_0xcd3c('0x22')](function(_0x48f33b){logger[_0xcd3c('0x11')](_0xcd3c('0x1a'),_0x492a58);logger[_0xcd3c('0x14')](_0xcd3c('0x1a'),_0x492a58,JSON['stringify'](_0x48f33b));_0xd83364(_0x48f33b);})[_0xcd3c('0x23')](function(_0x4dd833){logger[_0xcd3c('0x17')](_0xcd3c('0x1a'),_0x4dd833[_0xcd3c('0x18')],_0x492a58);_0x46130e(_0x39e0f7['error'](0x1f4,_0x4dd833[_0xcd3c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d892b43..bd39c80 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 _0x9e5d=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','save'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x9e5d,0x8f));var _0xd9e5=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x9e5d[_0xf2628e];return _0x13863a;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xd9e5('0x0'),_0xd9e5('0x1'),_0xd9e5('0x2')];function createListener(_0x13b670,_0x410e69){return function(_0x293d4a){_0x410e69[_0xd9e5('0x3')](_0x13b670,_0x293d4a);};}function removeListener(_0x15f016,_0x39c37c){return function(){UserVoiceQueueRtEvents[_0xd9e5('0x4')](_0x15f016,_0x39c37c);};}exports[_0xd9e5('0x5')]=function(_0x4334cf){for(var _0x18ac60=0x0,_0x586016=events[_0xd9e5('0x6')];_0x18ac60<_0x586016;_0x18ac60++){var _0x2caf92=events[_0x18ac60];var _0x2fc2ca=createListener(_0xd9e5('0x7')+_0x2caf92,_0x4334cf);UserVoiceQueueRtEvents['on'](_0x2caf92,_0x2fc2ca);}}; \ No newline at end of file +var _0xd9dc=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','length','userVoiceQueueRt:'];(function(_0x2bf22d,_0x179e7a){var _0x324ad7=function(_0xa0f187){while(--_0xa0f187){_0x2bf22d['push'](_0x2bf22d['shift']());}};_0x324ad7(++_0x179e7a);}(_0xd9dc,0x130));var _0xcd9d=function(_0x265793,_0x1184c5){_0x265793=_0x265793-0x0;var _0x1fbad1=_0xd9dc[_0x265793];return _0x1fbad1;};'use strict';var UserVoiceQueueRtEvents=require(_0xcd9d('0x0'));var events=[_0xcd9d('0x1'),_0xcd9d('0x2'),_0xcd9d('0x3')];function createListener(_0x40f1e0,_0x306753){return function(_0x1962c9){_0x306753[_0xcd9d('0x4')](_0x40f1e0,_0x1962c9);};}function removeListener(_0x115a53,_0x923a70){return function(){UserVoiceQueueRtEvents[_0xcd9d('0x5')](_0x115a53,_0x923a70);};}exports['register']=function(_0x4298cd){for(var _0x4967e1=0x0,_0x303ecb=events[_0xcd9d('0x6')];_0x4967e1<_0x303ecb;_0x4967e1++){var _0x3733ff=events[_0x4967e1];var _0x53bf94=createListener(_0xcd9d('0x7')+_0x3733ff,_0x4298cd);UserVoiceQueueRtEvents['on'](_0x3733ff,_0x53bf94);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 0f756d5..cf0c9cb 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 _0x6adb=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x20f244,_0xf8a3f6){var _0x197443=function(_0x222b91){while(--_0x222b91){_0x20f244['push'](_0x20f244['shift']());}};_0x197443(++_0xf8a3f6);}(_0x6adb,0x105));var _0xb6ad=function(_0x222f42,_0x54f2f5){_0x222f42=_0x222f42-0x0;var _0x28251a=_0x6adb[_0x222f42];return _0x28251a;};'use strict';var multer=require(_0xb6ad('0x0'));var util=require(_0xb6ad('0x1'));var path=require(_0xb6ad('0x2'));var timeout=require(_0xb6ad('0x3'));var express=require('express');var router=express[_0xb6ad('0x4')]();var auth=require(_0xb6ad('0x5'));var interaction=require(_0xb6ad('0x6'));var config=require(_0xb6ad('0x7'));module['exports']=router; \ No newline at end of file +var _0x3596=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','path','connect-timeout'];(function(_0x2e7d24,_0x4cfa1c){var _0x30285d=function(_0x421b46){while(--_0x421b46){_0x2e7d24['push'](_0x2e7d24['shift']());}};_0x30285d(++_0x4cfa1c);}(_0x3596,0xd6));var _0x6359=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x3596[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6359('0x0'));var timeout=require(_0x6359('0x1'));var express=require(_0x6359('0x2'));var router=express[_0x6359('0x3')]();var auth=require(_0x6359('0x4'));var interaction=require(_0x6359('0x5'));var config=require(_0x6359('0x6'));module[_0x6359('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 42d5eee..d1dbfcc 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0xe1fb9c,_0x264431){var _0x48b5ea=function(_0x384966){while(--_0x384966){_0xe1fb9c['push'](_0xe1fb9c['shift']());}};_0x48b5ea(++_0x264431);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index da47baa..da7fafb 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 _0x35c5=['user_has_whatsapp_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','UserWhatsappQueue'];(function(_0x4acdd0,_0x4d1f59){var _0x392ba5=function(_0x30cab7){while(--_0x30cab7){_0x4acdd0['push'](_0x4acdd0['shift']());}};_0x392ba5(++_0x4d1f59);}(_0x35c5,0x9b));var _0x535c=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x35c5[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x535c('0x0'));var util=require('util');var logger=require(_0x535c('0x1'))('api');var moment=require(_0x535c('0x2'));var BPromise=require(_0x535c('0x3'));var rp=require(_0x535c('0x4'));var fs=require('fs');var path=require(_0x535c('0x5'));var rimraf=require(_0x535c('0x6'));var config=require('../../config/environment');var attributes=require(_0x535c('0x7'));module[_0x535c('0x8')]=function(_0x3c6e0b,_0xb670c7){return _0x3c6e0b['define'](_0x535c('0x9'),attributes,{'tableName':_0x535c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb76e=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x498211,_0x1acae3){var _0x45d639=function(_0x18ef22){while(--_0x18ef22){_0x498211['push'](_0x498211['shift']());}};_0x45d639(++_0x1acae3);}(_0xb76e,0x85));var _0xeb76=function(_0xe7e134,_0x290de6){_0xe7e134=_0xe7e134-0x0;var _0x57fe21=_0xb76e[_0xe7e134];return _0x57fe21;};'use strict';var _=require(_0xeb76('0x0'));var util=require(_0xeb76('0x1'));var logger=require(_0xeb76('0x2'))('api');var moment=require(_0xeb76('0x3'));var BPromise=require(_0xeb76('0x4'));var rp=require(_0xeb76('0x5'));var fs=require('fs');var path=require(_0xeb76('0x6'));var rimraf=require(_0xeb76('0x7'));var config=require(_0xeb76('0x8'));var attributes=require(_0xeb76('0x9'));module[_0xeb76('0xa')]=function(_0x361c20,_0x219303){return _0x361c20[_0xeb76('0xb')](_0xeb76('0xc'),attributes,{'tableName':_0xeb76('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 3d5455c..95649a3 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(_0x50ea27,_0x54fe9b){var _0x59cfe5=function(_0x4e676d){while(--_0x4e676d){_0x50ea27['push'](_0x50ea27['shift']());}};_0x59cfe5(++_0x54fe9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2ec4b7,_0x46f8b8){var _0x14916f=function(_0x542814){while(--_0x542814){_0x2ec4b7['push'](_0x2ec4b7['shift']());}};_0x14916f(++_0x46f8b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f52a1d4..0d19e26 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 _0xe8fe=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x4fb001,_0x3f9e2e){var _0x207eda=function(_0x2d5b05){while(--_0x2d5b05){_0x4fb001['push'](_0x4fb001['shift']());}};_0x207eda(++_0x3f9e2e);}(_0xe8fe,0x1cf));var _0xee8f=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0xe8fe[_0x3f25b2];return _0xd8caeb;};'use strict';var multer=require(_0xee8f('0x0'));var util=require(_0xee8f('0x1'));var path=require(_0xee8f('0x2'));var timeout=require(_0xee8f('0x3'));var express=require(_0xee8f('0x4'));var router=express['Router']();var auth=require(_0xee8f('0x5'));var interaction=require(_0xee8f('0x6'));var config=require(_0xee8f('0x7'));var controller=require(_0xee8f('0x8'));router[_0xee8f('0x9')]('/',auth[_0xee8f('0xa')](),controller[_0xee8f('0xb')]);router[_0xee8f('0x9')](_0xee8f('0xc'),auth[_0xee8f('0xa')](),controller[_0xee8f('0xd')]);router[_0xee8f('0xe')]('/',auth['isAuthenticated'](),controller[_0xee8f('0xf')]);router[_0xee8f('0x10')](_0xee8f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xee8f('0x11')](_0xee8f('0xc'),auth[_0xee8f('0xa')](),controller[_0xee8f('0x12')]);module[_0xee8f('0x13')]=router; \ No newline at end of file +var _0x449f=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index'];(function(_0x16390c,_0x33a0b4){var _0x1140c1=function(_0x1400f4){while(--_0x1400f4){_0x16390c['push'](_0x16390c['shift']());}};_0x1140c1(++_0x33a0b4);}(_0x449f,0xb2));var _0xf449=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x449f[_0x1f7201];return _0x289fd2;};'use strict';var multer=require(_0xf449('0x0'));var util=require(_0xf449('0x1'));var path=require(_0xf449('0x2'));var timeout=require(_0xf449('0x3'));var express=require(_0xf449('0x4'));var router=express[_0xf449('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./variable.controller');router[_0xf449('0x6')]('/',auth[_0xf449('0x7')](),controller[_0xf449('0x8')]);router['get'](_0xf449('0x9'),auth[_0xf449('0x7')](),controller[_0xf449('0xa')]);router[_0xf449('0xb')]('/',auth[_0xf449('0x7')](),controller[_0xf449('0xc')]);router[_0xf449('0xd')](_0xf449('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xf449('0xe')]('/:id',auth[_0xf449('0x7')](),controller[_0xf449('0xf')]);module[_0xf449('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 4b94713..b56c830 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 _0xb9dc=['STRING','sequelize','exports'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0xb9dc,0x1a2));var _0xcb9d=function(_0x17b6fc,_0x56f490){_0x17b6fc=_0x17b6fc-0x0;var _0x226bd0=_0xb9dc[_0x17b6fc];return _0x226bd0;};'use strict';var Sequelize=require(_0xcb9d('0x0'));module[_0xcb9d('0x1')]={'name':{'type':Sequelize[_0xcb9d('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcb9d('0x2')]}}; \ No newline at end of file +var _0x6843=['sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6843,0x140));var _0x3684=function(_0x3c448e,_0x17ff6e){_0x3c448e=_0x3c448e-0x0;var _0x25a9e8=_0x6843[_0x3c448e];return _0x25a9e8;};'use strict';var Sequelize=require(_0x3684('0x0'));module[_0x3684('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 96f3d18..d41de58 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 _0x569e=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','get','Variables','destroy','then','error','name','send','index','Variable','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','where','filter','includeAll','findAll','catch','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x569e,0x199));var _0xe569=function(_0x15482e,_0x25b23c){_0x15482e=_0x15482e-0x0;var _0x4a0651=_0x569e[_0x15482e];return _0x4a0651;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe569('0x0'));var zipdir=require(_0xe569('0x1'));var jsonpatch=require(_0xe569('0x2'));var rp=require(_0xe569('0x3'));var moment=require(_0xe569('0x4'));var BPromise=require(_0xe569('0x5'));var Mustache=require(_0xe569('0x6'));var util=require(_0xe569('0x7'));var path=require('path');var sox=require(_0xe569('0x8'));var csv=require('to-csv');var ejs=require(_0xe569('0x9'));var fs=require('fs');var _=require(_0xe569('0xa'));var squel=require('squel');var crypto=require(_0xe569('0xb'));var jsforce=require(_0xe569('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe569('0xd'));var Papa=require('papaparse');var Redis=require(_0xe569('0xe'));var authService=require(_0xe569('0xf'));var qs=require(_0xe569('0x10'));var as=require(_0xe569('0x11'));var hardwareService=require(_0xe569('0x12'));var logger=require(_0xe569('0x13'))(_0xe569('0x14'));var utils=require(_0xe569('0x15'));var config=require(_0xe569('0x16'));var db=require(_0xe569('0x17'))['db'];function respondWithStatusCode(_0x79083e,_0xde3820){_0xde3820=_0xde3820||0xcc;return function(_0x51c813){if(_0x51c813){return _0x79083e[_0xe569('0x18')](_0xde3820);}return _0x79083e['status'](_0xde3820)[_0xe569('0x19')]();};}function respondWithResult(_0x5249a8,_0x32b126){_0x32b126=_0x32b126||0xc8;return function(_0x4b5554){if(_0x4b5554){return _0x5249a8['status'](_0x32b126)[_0xe569('0x1a')](_0x4b5554);}};}function respondWithFilteredResult(_0x223800,_0x3f7699){return function(_0x3a0705){if(_0x3a0705){var _0x10638c=_0x3a0705[_0xe569('0x1b')],_0x19a0f2=_0x3f7699[_0xe569('0x1c')],_0x4a19d3=_0x3f7699['offset']+_0x3f7699[_0xe569('0x1d')],_0x49a5d0;if(_0x4a19d3>=_0x10638c){_0x4a19d3=_0x10638c;_0x49a5d0=0xc8;}else{_0x49a5d0=0xce;}_0x223800[_0xe569('0x1e')](_0x49a5d0);return _0x223800[_0xe569('0x1f')]('Content-Range',_0x19a0f2+'-'+_0x4a19d3+'/'+_0x10638c)[_0xe569('0x1a')](_0x3a0705);}return null;};}function patchUpdates(_0x407e26){return function(_0x2bd1a7){try{jsonpatch[_0xe569('0x20')](_0x2bd1a7,_0x407e26,!![]);}catch(_0x1d0b1a){return BPromise[_0xe569('0x21')](_0x1d0b1a);}return _0x2bd1a7[_0xe569('0x22')]();};}function saveUpdates(_0x58de82,_0x2f7b74){return function(_0x4e9fcb){if(_0x4e9fcb){return _0x4e9fcb[_0xe569('0x23')](_0x58de82)['then'](function(_0x2bd43b){return _0x2bd43b;});}return null;};}function removeEntity(_0x3c1580,_0xb49045){return function(_0xc9e6c7){if(_0xc9e6c7){return _0xc9e6c7['destroy']()['then'](function(){var _0x55eb8a=_0xc9e6c7[_0xe569('0x24')]({'plain':!![]});var _0x5b7f4a=_0xe569('0x25');return db['UserProfileResource'][_0xe569('0x26')]({'where':{'type':_0x5b7f4a,'resourceId':_0x55eb8a['id']}})[_0xe569('0x27')](function(){return _0xc9e6c7;});})[_0xe569('0x27')](function(){_0x3c1580[_0xe569('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a359b,_0x5f3f9a){return function(_0x241088){if(!_0x241088){_0x5a359b[_0xe569('0x18')](0x194);}return _0x241088;};}function handleError(_0x1229cf,_0x33ad55){_0x33ad55=_0x33ad55||0x1f4;return function(_0x57dd0f){logger[_0xe569('0x28')](_0x57dd0f['stack']);if(_0x57dd0f[_0xe569('0x29')]){delete _0x57dd0f[_0xe569('0x29')];}_0x1229cf[_0xe569('0x1e')](_0x33ad55)[_0xe569('0x2a')](_0x57dd0f);};}exports[_0xe569('0x2b')]=function(_0x2d58f4,_0x1e7a74){var _0x3ad70e={},_0x5615d5={},_0x24a03c={'count':0x0,'rows':[]};var _0x876e7=_['map'](db[_0xe569('0x2c')][_0xe569('0x2d')],function(_0x433ddc){return{'name':_0x433ddc[_0xe569('0x2e')],'type':_0x433ddc['type'][_0xe569('0x2f')]};});_0x5615d5[_0xe569('0x30')]=_[_0xe569('0x31')](_0x876e7,'name');_0x5615d5[_0xe569('0x32')]=_[_0xe569('0x33')](_0x2d58f4[_0xe569('0x32')]);_0x5615d5[_0xe569('0x34')]=_[_0xe569('0x35')](_0x5615d5[_0xe569('0x30')],_0x5615d5[_0xe569('0x32')]);_0x3ad70e[_0xe569('0x36')]=_[_0xe569('0x35')](_0x5615d5['model'],qs[_0xe569('0x37')](_0x2d58f4[_0xe569('0x32')][_0xe569('0x37')]));_0x3ad70e[_0xe569('0x36')]=_0x3ad70e[_0xe569('0x36')]['length']?_0x3ad70e[_0xe569('0x36')]:_0x5615d5['model'];if(!_0x2d58f4['query'][_0xe569('0x38')](_0xe569('0x39'))){_0x3ad70e[_0xe569('0x1d')]=qs[_0xe569('0x1d')](_0x2d58f4[_0xe569('0x32')]['limit']);_0x3ad70e[_0xe569('0x1c')]=qs[_0xe569('0x1c')](_0x2d58f4[_0xe569('0x32')][_0xe569('0x1c')]);}_0x3ad70e['order']=qs[_0xe569('0x3a')](_0x2d58f4[_0xe569('0x32')][_0xe569('0x3a')]);_0x3ad70e['where']=qs['filters'](_[_0xe569('0x3b')](_0x2d58f4[_0xe569('0x32')],_0x5615d5[_0xe569('0x34')]),_0x876e7);if(_0x2d58f4[_0xe569('0x32')]['filter']){_0x3ad70e['where']=_[_0xe569('0x3c')](_0x3ad70e[_0xe569('0x3d')],{'$or':_[_0xe569('0x31')](_0x876e7,function(_0x508ad3){if(_0x508ad3['type']!=='VIRTUAL'){var _0x210e49={};_0x210e49[_0x508ad3[_0xe569('0x29')]]={'$like':'%'+_0x2d58f4['query'][_0xe569('0x3e')]+'%'};return _0x210e49;}})});}_0x3ad70e=_[_0xe569('0x3c')]({},_0x3ad70e,_0x2d58f4['options']);var _0x3a105c={'where':_0x3ad70e[_0xe569('0x3d')]};return db[_0xe569('0x2c')][_0xe569('0x1b')](_0x3a105c)[_0xe569('0x27')](function(_0xb59968){_0x24a03c[_0xe569('0x1b')]=_0xb59968;if(_0x2d58f4[_0xe569('0x32')][_0xe569('0x3f')]){_0x3ad70e['include']=[{'all':!![]}];}return db[_0xe569('0x2c')][_0xe569('0x40')](_0x3ad70e);})[_0xe569('0x27')](function(_0x2ffafe){_0x24a03c['rows']=_0x2ffafe;return _0x24a03c;})['then'](respondWithFilteredResult(_0x1e7a74,_0x3ad70e))[_0xe569('0x41')](handleError(_0x1e7a74,null));};exports[_0xe569('0x42')]=function(_0x2e53b4,_0x1f7cee){var _0x536583={'raw':!![],'where':{'id':_0x2e53b4[_0xe569('0x43')]['id']}},_0x376694={};_0x376694[_0xe569('0x30')]=_[_0xe569('0x33')](db[_0xe569('0x2c')][_0xe569('0x2d')]);_0x376694[_0xe569('0x32')]=_['keys'](_0x2e53b4['query']);_0x376694[_0xe569('0x34')]=_[_0xe569('0x35')](_0x376694[_0xe569('0x30')],_0x376694['query']);_0x536583[_0xe569('0x36')]=_['intersection'](_0x376694[_0xe569('0x30')],qs[_0xe569('0x37')](_0x2e53b4[_0xe569('0x32')][_0xe569('0x37')]));_0x536583[_0xe569('0x36')]=_0x536583['attributes']['length']?_0x536583[_0xe569('0x36')]:_0x376694[_0xe569('0x30')];if(_0x2e53b4[_0xe569('0x32')][_0xe569('0x3f')]){_0x536583[_0xe569('0x44')]=[{'all':!![]}];}_0x536583=_[_0xe569('0x3c')]({},_0x536583,_0x2e53b4[_0xe569('0x45')]);return db[_0xe569('0x2c')]['find'](_0x536583)[_0xe569('0x27')](handleEntityNotFound(_0x1f7cee,null))[_0xe569('0x27')](respondWithResult(_0x1f7cee,null))[_0xe569('0x41')](handleError(_0x1f7cee,null));};exports[_0xe569('0x46')]=function(_0x27d233,_0x2ed684){return db[_0xe569('0x2c')]['create'](_0x27d233[_0xe569('0x47')],{})[_0xe569('0x27')](function(_0x14d513){var _0x11f6b9=_0x27d233[_0xe569('0x48')][_0xe569('0x24')]({'plain':!![]});if(!_0x11f6b9)throw new Error(_0xe569('0x49'));if(_0x11f6b9[_0xe569('0x4a')]==='user'){var _0x2133c6=_0x14d513['get']({'plain':!![]});var _0x34d072='Variables';return db[_0xe569('0x4b')][_0xe569('0x4c')]({'where':{'name':_0x34d072,'userProfileId':_0x11f6b9[_0xe569('0x4d')]},'raw':!![]})['then'](function(_0x22265a){if(_0x22265a&&_0x22265a[_0xe569('0x4e')]===0x0){return db[_0xe569('0x4f')][_0xe569('0x46')]({'name':_0x2133c6[_0xe569('0x29')],'resourceId':_0x2133c6['id'],'type':_0x22265a['name'],'sectionId':_0x22265a['id']},{})['then'](function(){return _0x14d513;});}else{return _0x14d513;}})[_0xe569('0x41')](function(_0x4cfb25){logger[_0xe569('0x28')](_0xe569('0x50'),_0x4cfb25);throw _0x4cfb25;});}return _0x14d513;})[_0xe569('0x27')](respondWithResult(_0x2ed684,0xc9))[_0xe569('0x41')](handleError(_0x2ed684,null));};exports[_0xe569('0x23')]=function(_0x1a9b6e,_0x1bbf8e){if(_0x1a9b6e[_0xe569('0x47')]['id']){delete _0x1a9b6e[_0xe569('0x47')]['id'];}return db[_0xe569('0x2c')]['find']({'where':{'id':_0x1a9b6e[_0xe569('0x43')]['id']}})[_0xe569('0x27')](handleEntityNotFound(_0x1bbf8e,null))[_0xe569('0x27')](saveUpdates(_0x1a9b6e[_0xe569('0x47')],null))[_0xe569('0x27')](respondWithResult(_0x1bbf8e,null))['catch'](handleError(_0x1bbf8e,null));};exports[_0xe569('0x26')]=function(_0x26a8ef,_0x3ec97e){return db[_0xe569('0x2c')][_0xe569('0x4c')]({'where':{'id':_0x26a8ef[_0xe569('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ec97e,null))[_0xe569('0x27')](removeEntity(_0x3ec97e,null))[_0xe569('0x41')](handleError(_0x3ec97e,null));}; \ No newline at end of file +var _0x571a=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','end','error','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','role'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x571a,0xf6));var _0xa571=function(_0x1a9e2b,_0x8e5550){_0x1a9e2b=_0x1a9e2b-0x0;var _0x435919=_0x571a[_0x1a9e2b];return _0x435919;};'use strict';var pdf=require(_0xa571('0x0'));var emlformat=require(_0xa571('0x1'));var rimraf=require(_0xa571('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa571('0x3'));var moment=require(_0xa571('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa571('0x5'));var util=require(_0xa571('0x6'));var path=require('path');var sox=require(_0xa571('0x7'));var csv=require(_0xa571('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa571('0x9'));var crypto=require(_0xa571('0xa'));var jsforce=require(_0xa571('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa571('0x8'));var querystring=require('querystring');var Papa=require(_0xa571('0xc'));var Redis=require(_0xa571('0xd'));var authService=require(_0xa571('0xe'));var qs=require(_0xa571('0xf'));var as=require(_0xa571('0x10'));var hardwareService=require(_0xa571('0x11'));var logger=require('../../config/logger')(_0xa571('0x12'));var utils=require(_0xa571('0x13'));var config=require(_0xa571('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2303c8,_0x5e1259){_0x5e1259=_0x5e1259||0xcc;return function(_0x53c829){if(_0x53c829){return _0x2303c8[_0xa571('0x15')](_0x5e1259);}return _0x2303c8[_0xa571('0x16')](_0x5e1259)['end']();};}function respondWithResult(_0xdf035c,_0x322388){_0x322388=_0x322388||0xc8;return function(_0x4f5704){if(_0x4f5704){return _0xdf035c[_0xa571('0x16')](_0x322388)[_0xa571('0x17')](_0x4f5704);}};}function respondWithFilteredResult(_0x1d9b1b,_0x36b230){return function(_0x27c46d){if(_0x27c46d){var _0x4fc53b=_0x27c46d[_0xa571('0x18')],_0x3597ab=_0x36b230[_0xa571('0x19')],_0xb3afc1=_0x36b230[_0xa571('0x19')]+_0x36b230[_0xa571('0x1a')],_0x5802a5;if(_0xb3afc1>=_0x4fc53b){_0xb3afc1=_0x4fc53b;_0x5802a5=0xc8;}else{_0x5802a5=0xce;}_0x1d9b1b[_0xa571('0x16')](_0x5802a5);return _0x1d9b1b[_0xa571('0x1b')](_0xa571('0x1c'),_0x3597ab+'-'+_0xb3afc1+'/'+_0x4fc53b)[_0xa571('0x17')](_0x27c46d);}return null;};}function patchUpdates(_0x2d7fcb){return function(_0x201d33){try{jsonpatch[_0xa571('0x1d')](_0x201d33,_0x2d7fcb,!![]);}catch(_0x13652b){return BPromise[_0xa571('0x1e')](_0x13652b);}return _0x201d33[_0xa571('0x1f')]();};}function saveUpdates(_0x1d3bf4,_0x503bcc){return function(_0x5e6267){if(_0x5e6267){return _0x5e6267[_0xa571('0x20')](_0x1d3bf4)[_0xa571('0x21')](function(_0x2615ba){return _0x2615ba;});}return null;};}function removeEntity(_0x49ab8a,_0x7b8101){return function(_0x20679b){if(_0x20679b){return _0x20679b[_0xa571('0x22')]()[_0xa571('0x21')](function(){var _0x225e47=_0x20679b[_0xa571('0x23')]({'plain':!![]});var _0x11c0d9=_0xa571('0x24');return db[_0xa571('0x25')][_0xa571('0x22')]({'where':{'type':_0x11c0d9,'resourceId':_0x225e47['id']}})[_0xa571('0x21')](function(){return _0x20679b;});})[_0xa571('0x21')](function(){_0x49ab8a['status'](0xcc)[_0xa571('0x26')]();});}};}function handleEntityNotFound(_0x427ed7,_0x480a13){return function(_0x2eb3f2){if(!_0x2eb3f2){_0x427ed7['sendStatus'](0x194);}return _0x2eb3f2;};}function handleError(_0x5aad2d,_0x52ba26){_0x52ba26=_0x52ba26||0x1f4;return function(_0x2a9680){logger[_0xa571('0x27')](_0x2a9680['stack']);if(_0x2a9680[_0xa571('0x28')]){delete _0x2a9680['name'];}_0x5aad2d[_0xa571('0x16')](_0x52ba26)[_0xa571('0x29')](_0x2a9680);};}exports[_0xa571('0x2a')]=function(_0x1a42e9,_0x24d9b0){var _0x3d3522={},_0xac40da={},_0x14bf55={'count':0x0,'rows':[]};var _0x5aedd5=_[_0xa571('0x2b')](db[_0xa571('0x2c')][_0xa571('0x2d')],function(_0x4a10d4){return{'name':_0x4a10d4[_0xa571('0x2e')],'type':_0x4a10d4[_0xa571('0x2f')][_0xa571('0x30')]};});_0xac40da[_0xa571('0x31')]=_['map'](_0x5aedd5,'name');_0xac40da['query']=_[_0xa571('0x32')](_0x1a42e9[_0xa571('0x33')]);_0xac40da[_0xa571('0x34')]=_[_0xa571('0x35')](_0xac40da[_0xa571('0x31')],_0xac40da[_0xa571('0x33')]);_0x3d3522['attributes']=_[_0xa571('0x35')](_0xac40da['model'],qs['fields'](_0x1a42e9[_0xa571('0x33')][_0xa571('0x36')]));_0x3d3522[_0xa571('0x37')]=_0x3d3522[_0xa571('0x37')][_0xa571('0x38')]?_0x3d3522[_0xa571('0x37')]:_0xac40da[_0xa571('0x31')];if(!_0x1a42e9[_0xa571('0x33')][_0xa571('0x39')](_0xa571('0x3a'))){_0x3d3522[_0xa571('0x1a')]=qs[_0xa571('0x1a')](_0x1a42e9['query']['limit']);_0x3d3522[_0xa571('0x19')]=qs['offset'](_0x1a42e9[_0xa571('0x33')][_0xa571('0x19')]);}_0x3d3522[_0xa571('0x3b')]=qs[_0xa571('0x3c')](_0x1a42e9[_0xa571('0x33')]['sort']);_0x3d3522[_0xa571('0x3d')]=qs[_0xa571('0x34')](_[_0xa571('0x3e')](_0x1a42e9[_0xa571('0x33')],_0xac40da['filters']),_0x5aedd5);if(_0x1a42e9[_0xa571('0x33')][_0xa571('0x3f')]){_0x3d3522[_0xa571('0x3d')]=_[_0xa571('0x40')](_0x3d3522[_0xa571('0x3d')],{'$or':_['map'](_0x5aedd5,function(_0x1bba96){if(_0x1bba96[_0xa571('0x2f')]!=='VIRTUAL'){var _0x5d823b={};_0x5d823b[_0x1bba96['name']]={'$like':'%'+_0x1a42e9['query'][_0xa571('0x3f')]+'%'};return _0x5d823b;}})});}_0x3d3522=_[_0xa571('0x40')]({},_0x3d3522,_0x1a42e9['options']);var _0x1ad343={'where':_0x3d3522[_0xa571('0x3d')]};return db['Variable'][_0xa571('0x18')](_0x1ad343)[_0xa571('0x21')](function(_0xd303cb){_0x14bf55[_0xa571('0x18')]=_0xd303cb;if(_0x1a42e9['query']['includeAll']){_0x3d3522[_0xa571('0x41')]=[{'all':!![]}];}return db[_0xa571('0x2c')][_0xa571('0x42')](_0x3d3522);})[_0xa571('0x21')](function(_0x1fc421){_0x14bf55[_0xa571('0x43')]=_0x1fc421;return _0x14bf55;})['then'](respondWithFilteredResult(_0x24d9b0,_0x3d3522))[_0xa571('0x44')](handleError(_0x24d9b0,null));};exports[_0xa571('0x45')]=function(_0x25d85f,_0x5bcbc4){var _0xf9dc64={'raw':!![],'where':{'id':_0x25d85f[_0xa571('0x46')]['id']}},_0xd53024={};_0xd53024[_0xa571('0x31')]=_['keys'](db[_0xa571('0x2c')]['rawAttributes']);_0xd53024['query']=_[_0xa571('0x32')](_0x25d85f[_0xa571('0x33')]);_0xd53024[_0xa571('0x34')]=_[_0xa571('0x35')](_0xd53024[_0xa571('0x31')],_0xd53024[_0xa571('0x33')]);_0xf9dc64[_0xa571('0x37')]=_[_0xa571('0x35')](_0xd53024[_0xa571('0x31')],qs[_0xa571('0x36')](_0x25d85f[_0xa571('0x33')]['fields']));_0xf9dc64[_0xa571('0x37')]=_0xf9dc64['attributes'][_0xa571('0x38')]?_0xf9dc64['attributes']:_0xd53024['model'];if(_0x25d85f[_0xa571('0x33')][_0xa571('0x47')]){_0xf9dc64['include']=[{'all':!![]}];}_0xf9dc64=_[_0xa571('0x40')]({},_0xf9dc64,_0x25d85f[_0xa571('0x48')]);return db[_0xa571('0x2c')][_0xa571('0x49')](_0xf9dc64)['then'](handleEntityNotFound(_0x5bcbc4,null))['then'](respondWithResult(_0x5bcbc4,null))[_0xa571('0x44')](handleError(_0x5bcbc4,null));};exports[_0xa571('0x4a')]=function(_0x5b652c,_0x52ac69){return db[_0xa571('0x2c')]['create'](_0x5b652c[_0xa571('0x4b')],{})[_0xa571('0x21')](function(_0x1fd71d){var _0x42c265=_0x5b652c[_0xa571('0x4c')][_0xa571('0x23')]({'plain':!![]});if(!_0x42c265)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42c265[_0xa571('0x4d')]==='user'){var _0x131178=_0x1fd71d[_0xa571('0x23')]({'plain':!![]});var _0x3e75c7='Variables';return db[_0xa571('0x4e')]['find']({'where':{'name':_0x3e75c7,'userProfileId':_0x42c265['userProfileId']},'raw':!![]})[_0xa571('0x21')](function(_0x279d72){if(_0x279d72&&_0x279d72[_0xa571('0x4f')]===0x0){return db[_0xa571('0x25')][_0xa571('0x4a')]({'name':_0x131178['name'],'resourceId':_0x131178['id'],'type':_0x279d72[_0xa571('0x28')],'sectionId':_0x279d72['id']},{})[_0xa571('0x21')](function(){return _0x1fd71d;});}else{return _0x1fd71d;}})[_0xa571('0x44')](function(_0x4671e3){logger['error'](_0xa571('0x50'),_0x4671e3);throw _0x4671e3;});}return _0x1fd71d;})[_0xa571('0x21')](respondWithResult(_0x52ac69,0xc9))[_0xa571('0x44')](handleError(_0x52ac69,null));};exports[_0xa571('0x20')]=function(_0x1348e9,_0x5635f3){if(_0x1348e9[_0xa571('0x4b')]['id']){delete _0x1348e9['body']['id'];}return db[_0xa571('0x2c')][_0xa571('0x49')]({'where':{'id':_0x1348e9[_0xa571('0x46')]['id']}})['then'](handleEntityNotFound(_0x5635f3,null))['then'](saveUpdates(_0x1348e9[_0xa571('0x4b')],null))[_0xa571('0x21')](respondWithResult(_0x5635f3,null))['catch'](handleError(_0x5635f3,null));};exports[_0xa571('0x22')]=function(_0x59e82b,_0x48eee4){return db[_0xa571('0x2c')]['find']({'where':{'id':_0x59e82b[_0xa571('0x46')]['id']}})['then'](handleEntityNotFound(_0x48eee4,null))[_0xa571('0x21')](removeEntity(_0x48eee4,null))[_0xa571('0x44')](handleError(_0x48eee4,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2cf0f8b..1cac437 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 _0xe2d9=['define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x2c68a5,_0x380684){var _0x656f6c=function(_0x38a8dd){while(--_0x38a8dd){_0x2c68a5['push'](_0x2c68a5['shift']());}};_0x656f6c(++_0x380684);}(_0xe2d9,0x137));var _0x9e2d=function(_0x393877,_0x146f4c){_0x393877=_0x393877-0x0;var _0x34707c=_0xe2d9[_0x393877];return _0x34707c;};'use strict';var _=require(_0x9e2d('0x0'));var util=require(_0x9e2d('0x1'));var logger=require(_0x9e2d('0x2'))(_0x9e2d('0x3'));var moment=require(_0x9e2d('0x4'));var BPromise=require(_0x9e2d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e2d('0x6'));var rimraf=require(_0x9e2d('0x7'));var config=require(_0x9e2d('0x8'));var attributes=require(_0x9e2d('0x9'));module[_0x9e2d('0xa')]=function(_0x3029f8,_0x38ec18){return _0x3029f8[_0x9e2d('0xb')](_0x9e2d('0xc'),attributes,{'tableName':_0x9e2d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x474b=['rimraf','../../config/environment','exports','Variable','tools_variables','lodash','util','../../config/logger','api','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x474b,0x177));var _0xb474=function(_0x3034bd,_0x35e5bc){_0x3034bd=_0x3034bd-0x0;var _0x58ace1=_0x474b[_0x3034bd];return _0x58ace1;};'use strict';var _=require(_0xb474('0x0'));var util=require(_0xb474('0x1'));var logger=require(_0xb474('0x2'))(_0xb474('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb474('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb474('0x5'));var config=require(_0xb474('0x6'));var attributes=require('./variable.attributes');module[_0xb474('0x7')]=function(_0x43334a,_0x462560){return _0x43334a['define'](_0xb474('0x8'),attributes,{'tableName':_0xb474('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 17cd743..80da235 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 _0x53be=['attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','Variable','options'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x53be,0x109));var _0xe53b=function(_0x509d67,_0x4c0ce7){_0x509d67=_0x509d67-0x0;var _0x1de97d=_0x53be[_0x509d67];return _0x1de97d;};'use strict';var _=require(_0xe53b('0x0'));var util=require(_0xe53b('0x1'));var moment=require(_0xe53b('0x2'));var BPromise=require(_0xe53b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe53b('0x4'));var db=require(_0xe53b('0x5'))['db'];var utils=require(_0xe53b('0x6'));var logger=require(_0xe53b('0x7'))(_0xe53b('0x8'));var config=require(_0xe53b('0x9'));var jayson=require(_0xe53b('0xa'));var client=jayson['client'][_0xe53b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfbffc5,_0x3ea0f7,_0x14036f){return new BPromise(function(_0x5061b0,_0x5b1093){return client[_0xe53b('0xc')](_0xfbffc5,_0x14036f)[_0xe53b('0xd')](function(_0x2f84d1){logger[_0xe53b('0xe')](_0xe53b('0xf'),_0x3ea0f7,_0xe53b('0x10'));logger[_0xe53b('0x11')](_0xe53b('0x12'),_0x3ea0f7,_0xe53b('0x10'),JSON['stringify'](_0x2f84d1));if(_0x2f84d1['error']){if(_0x2f84d1[_0xe53b('0x13')]['code']===0x1f4){logger[_0xe53b('0x13')](_0xe53b('0xf'),_0x3ea0f7,_0x2f84d1['error'][_0xe53b('0x14')]);return _0x5b1093(_0x2f84d1[_0xe53b('0x13')]['message']);}logger[_0xe53b('0x13')](_0xe53b('0xf'),_0x3ea0f7,_0x2f84d1[_0xe53b('0x13')][_0xe53b('0x14')]);return _0x5061b0(_0x2f84d1[_0xe53b('0x13')][_0xe53b('0x14')]);}else{logger[_0xe53b('0xe')](_0xe53b('0xf'),_0x3ea0f7,_0xe53b('0x10'));_0x5061b0(_0x2f84d1['result'][_0xe53b('0x14')]);}})[_0xe53b('0x15')](function(_0x5373b0){logger[_0xe53b('0x13')]('Variable,\x20%s,\x20%s',_0x3ea0f7,_0x5373b0);_0x5b1093(_0x5373b0);});});}exports[_0xe53b('0x16')]=function(_0x5a79fb){var _0x1110f5=this;return new Promise(function(_0x220587,_0x18778c){return db[_0xe53b('0x17')]['find']({'raw':_0x5a79fb[_0xe53b('0x18')]?_0x5a79fb[_0xe53b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a79fb[_0xe53b('0x18')]?_0x5a79fb['options']['where']||null:null,'attributes':_0x5a79fb[_0xe53b('0x18')]?_0x5a79fb[_0xe53b('0x18')][_0xe53b('0x19')]||null:null,'include':_0x5a79fb[_0xe53b('0x18')]?_0x5a79fb[_0xe53b('0x18')][_0xe53b('0x1a')]?_[_0xe53b('0x1b')](_0x5a79fb[_0xe53b('0x18')][_0xe53b('0x1a')],function(_0x4b11bd){return{'model':db[_0x4b11bd[_0xe53b('0x1c')]],'as':_0x4b11bd['as'],'attributes':_0x4b11bd[_0xe53b('0x19')],'include':_0x4b11bd[_0xe53b('0x1a')]?_['map'](_0x4b11bd[_0xe53b('0x1a')],function(_0x182738){return{'model':db[_0x182738[_0xe53b('0x1c')]],'as':_0x182738['as'],'attributes':_0x182738[_0xe53b('0x19')],'include':_0x182738[_0xe53b('0x1a')]?_[_0xe53b('0x1b')](_0x182738[_0xe53b('0x1a')],function(_0x260135){return{'model':db[_0x260135[_0xe53b('0x1c')]],'as':_0x260135['as'],'attributes':_0x260135['attributes']};}):[]};}):[]};}):[]:[]})[_0xe53b('0xd')](function(_0x354d49){logger[_0xe53b('0xe')](_0xe53b('0x16'),_0x5a79fb);logger[_0xe53b('0x11')](_0xe53b('0x16'),_0x5a79fb,JSON['stringify'](_0x354d49));_0x220587(_0x354d49);})[_0xe53b('0x15')](function(_0x487c60){logger[_0xe53b('0x13')](_0xe53b('0x16'),_0x487c60[_0xe53b('0x14')],_0x5a79fb);_0x18778c(_0x1110f5['error'](0x1f4,_0x487c60['message']));});});}; \ No newline at end of file +var _0x8a30=['where','include','map','model','attributes','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowVariable','Variable','find','options','raw'];(function(_0x467c4a,_0x4c50cc){var _0x4a5f7e=function(_0x1f3952){while(--_0x1f3952){_0x467c4a['push'](_0x467c4a['shift']());}};_0x4a5f7e(++_0x4c50cc);}(_0x8a30,0x1e6));var _0x08a3=function(_0x39e97f,_0x2ed5bc){_0x39e97f=_0x39e97f-0x0;var _0x28d55c=_0x8a30[_0x39e97f];return _0x28d55c;};'use strict';var _=require(_0x08a3('0x0'));var util=require(_0x08a3('0x1'));var moment=require('moment');var BPromise=require(_0x08a3('0x2'));var rs=require(_0x08a3('0x3'));var fs=require('fs');var Redis=require(_0x08a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x08a3('0x5'));var logger=require(_0x08a3('0x6'))(_0x08a3('0x7'));var config=require(_0x08a3('0x8'));var jayson=require(_0x08a3('0x9'));var client=jayson['client'][_0x08a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x108a7d,_0x216457,_0x3772c4){return new BPromise(function(_0x41346a,_0x341fee){return client['request'](_0x108a7d,_0x3772c4)[_0x08a3('0xb')](function(_0x182ec9){logger[_0x08a3('0xc')](_0x08a3('0xd'),_0x216457,_0x08a3('0xe'));logger[_0x08a3('0xf')](_0x08a3('0x10'),_0x216457,_0x08a3('0xe'),JSON[_0x08a3('0x11')](_0x182ec9));if(_0x182ec9[_0x08a3('0x12')]){if(_0x182ec9[_0x08a3('0x12')][_0x08a3('0x13')]===0x1f4){logger[_0x08a3('0x12')](_0x08a3('0xd'),_0x216457,_0x182ec9[_0x08a3('0x12')][_0x08a3('0x14')]);return _0x341fee(_0x182ec9[_0x08a3('0x12')]['message']);}logger['error'](_0x08a3('0xd'),_0x216457,_0x182ec9[_0x08a3('0x12')][_0x08a3('0x14')]);return _0x41346a(_0x182ec9[_0x08a3('0x12')][_0x08a3('0x14')]);}else{logger[_0x08a3('0xc')](_0x08a3('0xd'),_0x216457,_0x08a3('0xe'));_0x41346a(_0x182ec9['result'][_0x08a3('0x14')]);}})['catch'](function(_0xa3a0b2){logger[_0x08a3('0x12')](_0x08a3('0xd'),_0x216457,_0xa3a0b2);_0x341fee(_0xa3a0b2);});});}exports[_0x08a3('0x15')]=function(_0x4f345a){var _0x479360=this;return new Promise(function(_0x322db2,_0x4ba63f){return db[_0x08a3('0x16')][_0x08a3('0x17')]({'raw':_0x4f345a[_0x08a3('0x18')]?_0x4f345a[_0x08a3('0x18')][_0x08a3('0x19')]===undefined?!![]:![]:!![],'where':_0x4f345a['options']?_0x4f345a[_0x08a3('0x18')][_0x08a3('0x1a')]||null:null,'attributes':_0x4f345a[_0x08a3('0x18')]?_0x4f345a[_0x08a3('0x18')]['attributes']||null:null,'include':_0x4f345a[_0x08a3('0x18')]?_0x4f345a[_0x08a3('0x18')][_0x08a3('0x1b')]?_[_0x08a3('0x1c')](_0x4f345a[_0x08a3('0x18')]['include'],function(_0x4bfb06){return{'model':db[_0x4bfb06[_0x08a3('0x1d')]],'as':_0x4bfb06['as'],'attributes':_0x4bfb06['attributes'],'include':_0x4bfb06[_0x08a3('0x1b')]?_[_0x08a3('0x1c')](_0x4bfb06[_0x08a3('0x1b')],function(_0x1bd66d){return{'model':db[_0x1bd66d[_0x08a3('0x1d')]],'as':_0x1bd66d['as'],'attributes':_0x1bd66d[_0x08a3('0x1e')],'include':_0x1bd66d['include']?_[_0x08a3('0x1c')](_0x1bd66d[_0x08a3('0x1b')],function(_0x10f131){return{'model':db[_0x10f131['model']],'as':_0x10f131['as'],'attributes':_0x10f131['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xdf9d25){logger[_0x08a3('0xc')](_0x08a3('0x15'),_0x4f345a);logger[_0x08a3('0xf')](_0x08a3('0x15'),_0x4f345a,JSON['stringify'](_0xdf9d25));_0x322db2(_0xdf9d25);})[_0x08a3('0x1f')](function(_0x440d7f){logger[_0x08a3('0x12')](_0x08a3('0x15'),_0x440d7f[_0x08a3('0x14')],_0x4f345a);_0x4ba63f(_0x479360['error'](0x1f4,_0x440d7f['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index dcc69de..b540819 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 _0x4651=['/migrations','migrations','Router','../../components/auth/service','./version.controller','get','index','/fetch','fetch','/reset','canUpdate','/pull','pull','/restart','isAuthenticated','restart'];(function(_0x4004c4,_0x162b2d){var _0x2a63a9=function(_0x1a4775){while(--_0x1a4775){_0x4004c4['push'](_0x4004c4['shift']());}};_0x2a63a9(++_0x162b2d);}(_0x4651,0x1f2));var _0x1465=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4651[_0x14add3];return _0x4a174f;};'use strict';var express=require('express');var router=express[_0x1465('0x0')]();var auth=require(_0x1465('0x1'));var controller=require(_0x1465('0x2'));router[_0x1465('0x3')]('/',controller[_0x1465('0x4')]);router[_0x1465('0x3')](_0x1465('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x1465('0x6')]);router[_0x1465('0x3')](_0x1465('0x7'),auth['isAuthenticated'](),auth[_0x1465('0x8')](),controller['reset']);router[_0x1465('0x3')](_0x1465('0x9'),auth['isAuthenticated'](),auth[_0x1465('0x8')](),controller[_0x1465('0xa')]);router[_0x1465('0x3')](_0x1465('0xb'),auth[_0x1465('0xc')](),controller[_0x1465('0xd')]);router[_0x1465('0x3')](_0x1465('0xe'),controller[_0x1465('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6467=['express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations'];(function(_0x30a8ee,_0x2ffb71){var _0x337657=function(_0x418bc8){while(--_0x418bc8){_0x30a8ee['push'](_0x30a8ee['shift']());}};_0x337657(++_0x2ffb71);}(_0x6467,0x110));var _0x7646=function(_0x420de5,_0x37b9a3){_0x420de5=_0x420de5-0x0;var _0xc06fd9=_0x6467[_0x420de5];return _0xc06fd9;};'use strict';var express=require(_0x7646('0x0'));var router=express[_0x7646('0x1')]();var auth=require(_0x7646('0x2'));var controller=require(_0x7646('0x3'));router[_0x7646('0x4')]('/',controller['index']);router['get'](_0x7646('0x5'),auth[_0x7646('0x6')](),auth[_0x7646('0x7')](),controller[_0x7646('0x8')]);router[_0x7646('0x4')](_0x7646('0x9'),auth[_0x7646('0x6')](),auth[_0x7646('0x7')](),controller[_0x7646('0xa')]);router['get'](_0x7646('0xb'),auth[_0x7646('0x6')](),auth[_0x7646('0x7')](),controller[_0x7646('0xc')]);router[_0x7646('0x4')](_0x7646('0xd'),auth[_0x7646('0x6')](),controller[_0x7646('0xe')]);router[_0x7646('0x4')](_0x7646('0xf'),controller['migrations']);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a74d2c1..6ad142b 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 _0xd26f=['motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','replace','push','length','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','fetch','tags','json','origin','master','error','status','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart'];(function(_0x4d3f40,_0x384509){var _0x26e7cd=function(_0x3ab9cd){while(--_0x3ab9cd){_0x4d3f40['push'](_0x4d3f40['shift']());}};_0x26e7cd(++_0x384509);}(_0xd26f,0x113));var _0xfd26=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xd26f[_0x411add];return _0x238242;};'use strict';var Umzug=require(_0xfd26('0x0'));var path=require(_0xfd26('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xfd26('0x2'));var compareVersions=require(_0xfd26('0x3'));var exec=require(_0xfd26('0x4'))[_0xfd26('0x5')];var db=require(_0xfd26('0x6'))['db'];var config=require(_0xfd26('0x7'));var pm2=require(_0xfd26('0x8'));var logger=require(_0xfd26('0x9'))(_0xfd26('0xa'));var git=require('simple-git')(config[_0xfd26('0xb')]);exports[_0xfd26('0xc')]=function(_0x1905a2,_0x3d405f){var _0x3c9154={'current':module[_0xfd26('0xd')]['version'],'phonebar':0x2};if(_0x1905a2[_0xfd26('0xe')]&&_0x1905a2[_0xfd26('0xe')][_0xfd26('0xf')]){return git[_0xfd26('0x10')]()[_0xfd26('0x11')](function(_0x1aa684,_0x56f02e){_0x3c9154[_0xfd26('0xf')]=(_0x1aa684?module['exports'][_0xfd26('0x2')]:_0x56f02e['latest'])||'2.0.0';return _0x3d405f['status'](0xc8)['json'](_0x3c9154);});}else{return _0x3d405f['status'](0xc8)[_0xfd26('0x12')](_0x3c9154);}};exports[_0xfd26('0x10')]=function(_0x37ef27,_0x28d319){return git[_0xfd26('0x10')]([_0xfd26('0x13'),_0xfd26('0x14')],function(_0x2e6b83){if(_0x2e6b83){logger[_0xfd26('0x15')](_0x2e6b83);return _0x28d319[_0xfd26('0x16')](0x1f4)[_0xfd26('0x12')](_0x2e6b83);}logger[_0xfd26('0x17')](_0xfd26('0x18'));return _0x28d319[_0xfd26('0x16')](0xc8)[_0xfd26('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xfd26('0x19')]=function(_0x1426b2,_0xeb7aeb){return git[_0xfd26('0x19')]([_0xfd26('0x1a'),'FETCH_HEAD'],function(_0x3a2725){if(_0x3a2725){logger['error'](_0x3a2725);return _0xeb7aeb['status'](0x1f4)['json'](_0x3a2725);}logger[_0xfd26('0x17')](_0xfd26('0x1b'));return _0xeb7aeb['status'](0xc8)['json']({'output':_0xfd26('0x1c')});});};exports[_0xfd26('0x1d')]=function(_0x5b4004,_0xe7d6d9){exec('npm\x20install\x20--production',function(_0x8c6df1,_0x531bf7,_0x44a16a){logger['info'](_0x531bf7);logger[_0xfd26('0x17')](_0x44a16a);if(_0x8c6df1){logger[_0xfd26('0x15')](_0x8c6df1);return _0xe7d6d9['status'](0x1f4)['json'](_0x8c6df1);}return _0xe7d6d9[_0xfd26('0x16')](0xc8)['json']({'output':_0x531bf7});});};exports[_0xfd26('0x1e')]=function(_0xebbab7,_0x162a04){return pm2[_0xfd26('0x1e')](_0xfd26('0x1f'))['then'](function(_0xd0ed59){logger['info'](_0xfd26('0x20'),_0xd0ed59);return _0x162a04[_0xfd26('0x16')](0xc8)['json']({'output':_0xfd26('0x21')});})[_0xfd26('0x22')](function(_0x375c98){logger[_0xfd26('0x15')](_0x375c98);return _0x162a04[_0xfd26('0x16')](0x1f4)[_0xfd26('0x12')](_0x375c98);});};exports[_0xfd26('0x23')]=function(_0x565c0,_0x3cdef1){var _0x5b3be9=fs['readdirSync'](path['join'](config['root'],_0xfd26('0x24'),'migrations'));var _0x21df6d=[];for(var _0x944d20=0x0;_0x944d20<_0x5b3be9['length'];_0x944d20++){var _0x5d8dab=_0x5b3be9[_0x944d20][_0xfd26('0x25')]('.js','');if(compareVersions(module['exports'][_0xfd26('0x2')],_0x5d8dab)===-0x1){_0x21df6d[_0xfd26('0x26')](_0x5d8dab);}}if(_0x21df6d[_0xfd26('0x27')]){var _0x23d516=_0x21df6d[_0xfd26('0x28')](compareVersions);var _0x5d7886=new Umzug({'storage':_0xfd26('0x29'),'storageOptions':{'model':db[_0xfd26('0x2a')],'modelName':_0xfd26('0x2a'),'columnName':_0xfd26('0x2')},'migrations':{'params':[db[_0xfd26('0x29')]['getQueryInterface'](),db[_0xfd26('0x29')]['constructor'],function(){throw new Error(_0xfd26('0x2b'));}],'path':path[_0xfd26('0x2c')](config[_0xfd26('0xb')],'server',_0xfd26('0x23')),'pattern':/\.js$/}});_0x5d7886['up']({'migrations':_[_0xfd26('0x2d')](_0x23d516,function(_0x477f13){return _0x477f13+_0xfd26('0x2e');})})['then'](function(){return _0x3cdef1['status'](0xc8)[_0xfd26('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xfd26('0xd')]['version']+_0xfd26('0x2f')+_[_0xfd26('0x30')](_0x23d516),'migrations':_[_0xfd26('0x2c')](_0x23d516)});})['catch'](function(_0x12774d){if(_0x12774d instanceof db[_0xfd26('0x29')][_0xfd26('0x31')]){return _0x3cdef1[_0xfd26('0x16')](0xc8)['json']({'output':_0xfd26('0x32')});}else{return _0x3cdef1['status'](0x1f4)[_0xfd26('0x12')](_0x12774d);}});}else{return _0x3cdef1['status'](0xc8)[_0xfd26('0x12')]({'output':_0xfd26('0x32')});}}; \ No newline at end of file +var _0x6fc2=['error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.js','push','length','sort','Migration','sequelize','getQueryInterface','constructor','server','map','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','../../config/environment','../../config/pm2','update','simple-git','root','index','query','fetch','tags','latest','exports','2.0.0','status','json','origin','master'];(function(_0x2ccbc0,_0x36bae4){var _0x43469a=function(_0x1c769e){while(--_0x1c769e){_0x2ccbc0['push'](_0x2ccbc0['shift']());}};_0x43469a(++_0x36bae4);}(_0x6fc2,0x117));var _0x26fc=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6fc2[_0x27af45];return _0x18df21;};'use strict';var Umzug=require(_0x26fc('0x0'));var path=require(_0x26fc('0x1'));var fs=require('fs');var _=require(_0x26fc('0x2'));var pkginfo=require('pkginfo')(module,_0x26fc('0x3'));var compareVersions=require(_0x26fc('0x4'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x26fc('0x5'));var pm2=require(_0x26fc('0x6'));var logger=require('../../config/logger')(_0x26fc('0x7'));var git=require(_0x26fc('0x8'))(config[_0x26fc('0x9')]);exports[_0x26fc('0xa')]=function(_0x5c87f2,_0x23c15a){var _0x5616eb={'current':module['exports'][_0x26fc('0x3')],'phonebar':0x2};if(_0x5c87f2[_0x26fc('0xb')]&&_0x5c87f2[_0x26fc('0xb')]['latest']){return git[_0x26fc('0xc')]()[_0x26fc('0xd')](function(_0x23171d,_0x1fe47f){_0x5616eb[_0x26fc('0xe')]=(_0x23171d?module[_0x26fc('0xf')][_0x26fc('0x3')]:_0x1fe47f[_0x26fc('0xe')])||_0x26fc('0x10');return _0x23c15a[_0x26fc('0x11')](0xc8)[_0x26fc('0x12')](_0x5616eb);});}else{return _0x23c15a[_0x26fc('0x11')](0xc8)[_0x26fc('0x12')](_0x5616eb);}};exports[_0x26fc('0xc')]=function(_0x1c7f2c,_0x178667){return git['fetch']([_0x26fc('0x13'),_0x26fc('0x14')],function(_0x1f1903){if(_0x1f1903){logger[_0x26fc('0x15')](_0x1f1903);return _0x178667[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x1f1903);}logger[_0x26fc('0x16')](_0x26fc('0x17'));return _0x178667[_0x26fc('0x11')](0xc8)['json']({'output':_0x26fc('0x18')});});};exports['reset']=function(_0x2da252,_0x3507b1){return git[_0x26fc('0x19')]([_0x26fc('0x1a'),'FETCH_HEAD'],function(_0x463117){if(_0x463117){logger[_0x26fc('0x15')](_0x463117);return _0x3507b1[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x463117);}logger[_0x26fc('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3507b1['status'](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x4fa549,_0x2339ad){exec('npm\x20install\x20--production',function(_0x2fb061,_0x1b05d1,_0x562c00){logger[_0x26fc('0x16')](_0x1b05d1);logger[_0x26fc('0x16')](_0x562c00);if(_0x2fb061){logger[_0x26fc('0x15')](_0x2fb061);return _0x2339ad[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x2fb061);}return _0x2339ad[_0x26fc('0x11')](0xc8)['json']({'output':_0x1b05d1});});};exports[_0x26fc('0x1b')]=function(_0x435d72,_0x1a9313){return pm2[_0x26fc('0x1b')](_0x26fc('0x1c'))[_0x26fc('0x1d')](function(_0x430a98){logger['info'](_0x26fc('0x1e'),_0x430a98);return _0x1a9313[_0x26fc('0x11')](0xc8)[_0x26fc('0x12')]({'output':_0x26fc('0x1f')});})[_0x26fc('0x20')](function(_0x12ecb7){logger['error'](_0x12ecb7);return _0x1a9313[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x12ecb7);});};exports[_0x26fc('0x21')]=function(_0x32088c,_0x2bde13){var _0x14ecff=fs[_0x26fc('0x22')](path[_0x26fc('0x23')](config['root'],'server','migrations'));var _0x297e53=[];for(var _0x4b7ee4=0x0;_0x4b7ee4<_0x14ecff['length'];_0x4b7ee4++){var _0x20e995=_0x14ecff[_0x4b7ee4][_0x26fc('0x24')](_0x26fc('0x25'),'');if(compareVersions(module[_0x26fc('0xf')][_0x26fc('0x3')],_0x20e995)===-0x1){_0x297e53[_0x26fc('0x26')](_0x20e995);}}if(_0x297e53[_0x26fc('0x27')]){var _0x1661cd=_0x297e53[_0x26fc('0x28')](compareVersions);var _0x2466ab=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x26fc('0x29')],'modelName':_0x26fc('0x29'),'columnName':_0x26fc('0x3')},'migrations':{'params':[db[_0x26fc('0x2a')][_0x26fc('0x2b')](),db[_0x26fc('0x2a')][_0x26fc('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x26fc('0x23')](config['root'],_0x26fc('0x2d'),_0x26fc('0x21')),'pattern':/\.js$/}});_0x2466ab['up']({'migrations':_[_0x26fc('0x2e')](_0x1661cd,function(_0x324e43){return _0x324e43+_0x26fc('0x25');})})['then'](function(){return _0x2bde13[_0x26fc('0x11')](0xc8)[_0x26fc('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x26fc('0xf')]['version']+_0x26fc('0x2f')+_[_0x26fc('0x30')](_0x1661cd),'migrations':_[_0x26fc('0x23')](_0x1661cd)});})[_0x26fc('0x20')](function(_0x39b202){if(_0x39b202 instanceof db[_0x26fc('0x2a')]['UniqueConstraintError']){return _0x2bde13['status'](0xc8)[_0x26fc('0x12')]({'output':_0x26fc('0x31')});}else{return _0x2bde13[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x39b202);}});}else{return _0x2bde13['status'](0xc8)[_0x26fc('0x12')]({'output':_0x26fc('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1fcec92..d1a2b91 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 _0xae18=['util','path','connect-timeout','express','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0xf73dcd,_0x15c363){var _0x44c1e2=function(_0x5f1996){while(--_0x5f1996){_0xf73dcd['push'](_0xf73dcd['shift']());}};_0x44c1e2(++_0x15c363);}(_0xae18,0x8f));var _0x8ae1=function(_0x439d93,_0xf51f08){_0x439d93=_0x439d93-0x0;var _0x353934=_0xae18[_0x439d93];return _0x353934;};'use strict';var multer=require(_0x8ae1('0x0'));var util=require(_0x8ae1('0x1'));var path=require(_0x8ae1('0x2'));var timeout=require(_0x8ae1('0x3'));var express=require(_0x8ae1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8ae1('0x5'));var controller=require('./voiceAgentReport.controller');router[_0x8ae1('0x6')]('/',auth[_0x8ae1('0x7')](),controller['index']);router['get'](_0x8ae1('0x8'),auth[_0x8ae1('0x7')](),controller[_0x8ae1('0x9')]);router[_0x8ae1('0x6')](_0x8ae1('0xa'),auth[_0x8ae1('0x7')](),controller[_0x8ae1('0xb')]);router[_0x8ae1('0xc')]('/',auth[_0x8ae1('0x7')](),controller[_0x8ae1('0xd')]);router[_0x8ae1('0xe')](_0x8ae1('0xa'),auth['isAuthenticated'](),controller[_0x8ae1('0xf')]);router[_0x8ae1('0x10')](_0x8ae1('0xa'),auth[_0x8ae1('0x7')](),controller['destroy']);module[_0x8ae1('0x11')]=router; \ No newline at end of file +var _0xa21f=['delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','update'];(function(_0xe78d3,_0x805b82){var _0x53dbe0=function(_0x52aa66){while(--_0x52aa66){_0xe78d3['push'](_0xe78d3['shift']());}};_0x53dbe0(++_0x805b82);}(_0xa21f,0x1b3));var _0xfa21=function(_0x5378ef,_0x5abb1c){_0x5378ef=_0x5378ef-0x0;var _0x9095cb=_0xa21f[_0x5378ef];return _0x9095cb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfa21('0x0'));var express=require(_0xfa21('0x1'));var router=express[_0xfa21('0x2')]();var auth=require(_0xfa21('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfa21('0x4'));var controller=require('./voiceAgentReport.controller');router[_0xfa21('0x5')]('/',auth[_0xfa21('0x6')](),controller[_0xfa21('0x7')]);router[_0xfa21('0x5')]('/describe',auth[_0xfa21('0x6')](),controller[_0xfa21('0x8')]);router[_0xfa21('0x5')](_0xfa21('0x9'),auth[_0xfa21('0x6')](),controller['show']);router[_0xfa21('0xa')]('/',auth[_0xfa21('0x6')](),controller[_0xfa21('0xb')]);router['put'](_0xfa21('0x9'),auth[_0xfa21('0x6')](),controller[_0xfa21('0xc')]);router[_0xfa21('0xd')]('/:id',auth[_0xfa21('0x6')](),controller[_0xfa21('0xe')]);module[_0xfa21('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 94d2d08..0f30379 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 _0xeec6=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x41fd9c,_0x2a4b10){var _0x3bfe5a=function(_0x112af9){while(--_0x112af9){_0x41fd9c['push'](_0x41fd9c['shift']());}};_0x3bfe5a(++_0x2a4b10);}(_0xeec6,0x1c2));var _0x6eec=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xeec6[_0x454165];return _0x56db53;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'type':{'type':Sequelize[_0x6eec('0x2')]},'uniqueid':{'type':Sequelize[_0x6eec('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6eec('0x2')]},'queue':{'type':Sequelize[_0x6eec('0x2')]},'interface':{'type':Sequelize[_0x6eec('0x2')]},'membername':{'type':Sequelize[_0x6eec('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6eec('0x3')]},'agentconnectAt':{'type':Sequelize[_0x6eec('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x6eec('0x3')]},'agentdumpAt':{'type':Sequelize[_0x6eec('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6eec('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6eec('0x5')]},'reason':{'type':Sequelize[_0x6eec('0x2')]},'lastevent':{'type':Sequelize[_0x6eec('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6eec('0x2')]},'connectedlinename':{'type':Sequelize[_0x6eec('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eec('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6eec('0x2')]},'destchannel':{'type':Sequelize[_0x6eec('0x2')]},'destchannelstate':{'type':Sequelize[_0x6eec('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x6eec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6eec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6eec('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6eec('0x2')]},'destlanguage':{'type':Sequelize[_0x6eec('0x2')]},'destaccountcode':{'type':Sequelize[_0x6eec('0x2')]},'destcontext':{'type':Sequelize[_0x6eec('0x2')]},'destexten':{'type':Sequelize[_0x6eec('0x2')]},'destpriority':{'type':Sequelize[_0x6eec('0x2')]},'destuniqueid':{'type':Sequelize[_0x6eec('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6eec('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x6eec('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6eec('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6eec('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6eec('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x31cdf3,_0x4f2183){var _0x5623f8=function(_0x4377bc){while(--_0x4377bc){_0x31cdf3['push'](_0x31cdf3['shift']());}};_0x5623f8(++_0x4f2183);}(_0xe14b,0x93));var _0xbe14=function(_0x518bdd,_0x8a8199){_0x518bdd=_0x518bdd-0x0;var _0x2f5202=_0xe14b[_0x518bdd];return _0x2f5202;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbe14('0x2')]},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbe14('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbe14('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xbe14('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xbe14('0x3')]},'agentdumpAt':{'type':Sequelize[_0xbe14('0x3')]},'holdtime':{'type':Sequelize[_0xbe14('0x4')]},'agentcomplete':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbe14('0x4')]},'reason':{'type':Sequelize[_0xbe14('0x2')]},'lastevent':{'type':Sequelize[_0xbe14('0x2')]},'channel':{'type':Sequelize[_0xbe14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbe14('0x2')]},'connectedlinename':{'type':Sequelize[_0xbe14('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'exten':{'type':Sequelize[_0xbe14('0x2')]},'priority':{'type':Sequelize[_0xbe14('0x2')]},'destchannel':{'type':Sequelize[_0xbe14('0x2')]},'destchannelstate':{'type':Sequelize[_0xbe14('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xbe14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbe14('0x2')]},'destcalleridname':{'type':Sequelize[_0xbe14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbe14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbe14('0x2')]},'destlanguage':{'type':Sequelize[_0xbe14('0x2')]},'destaccountcode':{'type':Sequelize[_0xbe14('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xbe14('0x2')]},'destuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xbe14('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbe14('0x2')],'comment':_0xbe14('0x6')},'transferexten':{'type':Sequelize[_0xbe14('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'agententerreason':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index a1cbe9e..1a657d6 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 _0xdfeb=['update','then','end','error','name','send','index','VoiceAgentReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0xc59cc2,_0x47a6c4){var _0x15859b=function(_0x24d5bd){while(--_0x24d5bd){_0xc59cc2['push'](_0xc59cc2['shift']());}};_0x15859b(++_0x47a6c4);}(_0xdfeb,0x1be));var _0xbdfe=function(_0x310e38,_0x1fd0b2){_0x310e38=_0x310e38-0x0;var _0x1f6a91=_0xdfeb[_0x310e38];return _0x1f6a91;};'use strict';var pdf=require(_0xbdfe('0x0'));var emlformat=require(_0xbdfe('0x1'));var rimraf=require(_0xbdfe('0x2'));var zipdir=require(_0xbdfe('0x3'));var jsonpatch=require(_0xbdfe('0x4'));var rp=require(_0xbdfe('0x5'));var moment=require('moment');var BPromise=require(_0xbdfe('0x6'));var Mustache=require(_0xbdfe('0x7'));var util=require('util');var path=require('path');var sox=require(_0xbdfe('0x8'));var csv=require(_0xbdfe('0x9'));var ejs=require(_0xbdfe('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbdfe('0xb'));var crypto=require(_0xbdfe('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbdfe('0x9'));var querystring=require(_0xbdfe('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbdfe('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbdfe('0xf'));var hardwareService=require(_0xbdfe('0x10'));var logger=require(_0xbdfe('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xbdfe('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36a631,_0x397eeb){_0x397eeb=_0x397eeb||0xcc;return function(_0x4964ed){if(_0x4964ed){return _0x36a631[_0xbdfe('0x13')](_0x397eeb);}return _0x36a631[_0xbdfe('0x14')](_0x397eeb)['end']();};}function respondWithResult(_0x585c71,_0x39db93){_0x39db93=_0x39db93||0xc8;return function(_0x309f23){if(_0x309f23){return _0x585c71[_0xbdfe('0x14')](_0x39db93)[_0xbdfe('0x15')](_0x309f23);}};}function respondWithFilteredResult(_0x188b97,_0x4384d2){return function(_0x165dda){if(_0x165dda){var _0x5452d6=_0x165dda[_0xbdfe('0x16')],_0x4405ef=_0x4384d2[_0xbdfe('0x17')],_0x266742=_0x4384d2[_0xbdfe('0x17')]+_0x4384d2[_0xbdfe('0x18')],_0x125aee;if(_0x266742>=_0x5452d6){_0x266742=_0x5452d6;_0x125aee=0xc8;}else{_0x125aee=0xce;}_0x188b97[_0xbdfe('0x14')](_0x125aee);return _0x188b97[_0xbdfe('0x19')](_0xbdfe('0x1a'),_0x4405ef+'-'+_0x266742+'/'+_0x5452d6)[_0xbdfe('0x15')](_0x165dda);}return null;};}function patchUpdates(_0xc3a721){return function(_0xd8be0a){try{jsonpatch[_0xbdfe('0x1b')](_0xd8be0a,_0xc3a721,!![]);}catch(_0x118697){return BPromise[_0xbdfe('0x1c')](_0x118697);}return _0xd8be0a[_0xbdfe('0x1d')]();};}function saveUpdates(_0x11db79,_0x56ac2a){return function(_0x3ffbfa){if(_0x3ffbfa){return _0x3ffbfa[_0xbdfe('0x1e')](_0x11db79)[_0xbdfe('0x1f')](function(_0x2e008b){return _0x2e008b;});}return null;};}function removeEntity(_0x375312,_0x3dda51){return function(_0x49d078){if(_0x49d078){return _0x49d078['destroy']()['then'](function(){_0x375312[_0xbdfe('0x14')](0xcc)[_0xbdfe('0x20')]();});}};}function handleEntityNotFound(_0xb07db6,_0x234ca3){return function(_0x289f36){if(!_0x289f36){_0xb07db6[_0xbdfe('0x13')](0x194);}return _0x289f36;};}function handleError(_0xd78a0a,_0x17e310){_0x17e310=_0x17e310||0x1f4;return function(_0x2c54f3){logger[_0xbdfe('0x21')](_0x2c54f3['stack']);if(_0x2c54f3['name']){delete _0x2c54f3[_0xbdfe('0x22')];}_0xd78a0a[_0xbdfe('0x14')](_0x17e310)[_0xbdfe('0x23')](_0x2c54f3);};}exports[_0xbdfe('0x24')]=function(_0x3286cf,_0x4b5cf7){var _0x35a458={},_0x32745d={},_0x3ed35f={'count':0x0,'rows':[]};var _0x3a209b=_['map'](db[_0xbdfe('0x25')][_0xbdfe('0x26')],function(_0x5219c5){return{'name':_0x5219c5['fieldName'],'type':_0x5219c5[_0xbdfe('0x27')][_0xbdfe('0x28')]};});_0x32745d[_0xbdfe('0x29')]=_[_0xbdfe('0x2a')](_0x3a209b,_0xbdfe('0x22'));_0x32745d[_0xbdfe('0x2b')]=_[_0xbdfe('0x2c')](_0x3286cf[_0xbdfe('0x2b')]);_0x32745d[_0xbdfe('0x2d')]=_[_0xbdfe('0x2e')](_0x32745d['model'],_0x32745d[_0xbdfe('0x2b')]);_0x35a458[_0xbdfe('0x2f')]=_[_0xbdfe('0x2e')](_0x32745d[_0xbdfe('0x29')],qs['fields'](_0x3286cf['query'][_0xbdfe('0x30')]));_0x35a458[_0xbdfe('0x2f')]=_0x35a458[_0xbdfe('0x2f')]['length']?_0x35a458[_0xbdfe('0x2f')]:_0x32745d[_0xbdfe('0x29')];if(!_0x3286cf[_0xbdfe('0x2b')]['hasOwnProperty'](_0xbdfe('0x31'))){_0x35a458[_0xbdfe('0x18')]=qs[_0xbdfe('0x18')](_0x3286cf['query']['limit']);_0x35a458[_0xbdfe('0x17')]=qs[_0xbdfe('0x17')](_0x3286cf[_0xbdfe('0x2b')][_0xbdfe('0x17')]);}_0x35a458[_0xbdfe('0x32')]=qs[_0xbdfe('0x33')](_0x3286cf[_0xbdfe('0x2b')][_0xbdfe('0x33')]);_0x35a458[_0xbdfe('0x34')]=qs[_0xbdfe('0x2d')](_['pick'](_0x3286cf[_0xbdfe('0x2b')],_0x32745d[_0xbdfe('0x2d')]),_0x3a209b);if(_0x3286cf[_0xbdfe('0x2b')][_0xbdfe('0x35')]){_0x35a458[_0xbdfe('0x34')]=_['merge'](_0x35a458['where'],{'$or':_[_0xbdfe('0x2a')](_0x3a209b,function(_0x58c8a1){if(_0x58c8a1[_0xbdfe('0x27')]!==_0xbdfe('0x36')){var _0x7aec86={};_0x7aec86[_0x58c8a1['name']]={'$like':'%'+_0x3286cf[_0xbdfe('0x2b')][_0xbdfe('0x35')]+'%'};return _0x7aec86;}})});}_0x35a458=_[_0xbdfe('0x37')]({},_0x35a458,_0x3286cf[_0xbdfe('0x38')]);var _0x397a73={'where':_0x35a458['where']};return db[_0xbdfe('0x25')][_0xbdfe('0x16')](_0x397a73)['then'](function(_0x298935){_0x3ed35f['count']=_0x298935;if(_0x3286cf['query'][_0xbdfe('0x39')]){_0x35a458[_0xbdfe('0x3a')]=[{'all':!![]}];}return db[_0xbdfe('0x25')]['findAll'](_0x35a458);})[_0xbdfe('0x1f')](function(_0x3f4075){_0x3ed35f['rows']=_0x3f4075;return _0x3ed35f;})['then'](respondWithFilteredResult(_0x4b5cf7,_0x35a458))[_0xbdfe('0x3b')](handleError(_0x4b5cf7,null));};exports[_0xbdfe('0x3c')]=function(_0x5e14ff,_0x1f9c7e){var _0x35aba3={'raw':![],'where':{'id':_0x5e14ff[_0xbdfe('0x3d')]['id']}},_0x53d84a={};_0x53d84a[_0xbdfe('0x29')]=_[_0xbdfe('0x2c')](db[_0xbdfe('0x25')][_0xbdfe('0x26')]);_0x53d84a[_0xbdfe('0x2b')]=_[_0xbdfe('0x2c')](_0x5e14ff['query']);_0x53d84a[_0xbdfe('0x2d')]=_[_0xbdfe('0x2e')](_0x53d84a['model'],_0x53d84a[_0xbdfe('0x2b')]);_0x35aba3[_0xbdfe('0x2f')]=_['intersection'](_0x53d84a['model'],qs[_0xbdfe('0x30')](_0x5e14ff[_0xbdfe('0x2b')][_0xbdfe('0x30')]));_0x35aba3['attributes']=_0x35aba3[_0xbdfe('0x2f')][_0xbdfe('0x3e')]?_0x35aba3['attributes']:_0x53d84a[_0xbdfe('0x29')];if(_0x5e14ff[_0xbdfe('0x2b')]['includeAll']){_0x35aba3[_0xbdfe('0x3a')]=[{'all':!![]}];}_0x35aba3=_[_0xbdfe('0x37')]({},_0x35aba3,_0x5e14ff[_0xbdfe('0x38')]);return db[_0xbdfe('0x25')][_0xbdfe('0x3f')](_0x35aba3)[_0xbdfe('0x1f')](handleEntityNotFound(_0x1f9c7e,null))[_0xbdfe('0x1f')](respondWithResult(_0x1f9c7e,null))[_0xbdfe('0x3b')](handleError(_0x1f9c7e,null));};exports[_0xbdfe('0x40')]=function(_0x5b3279,_0x4e8fb2){return db[_0xbdfe('0x25')][_0xbdfe('0x40')](_0x5b3279[_0xbdfe('0x41')],{})[_0xbdfe('0x1f')](respondWithResult(_0x4e8fb2,0xc9))[_0xbdfe('0x3b')](handleError(_0x4e8fb2,null));};exports[_0xbdfe('0x1e')]=function(_0x5b5494,_0x156549){if(_0x5b5494[_0xbdfe('0x41')]['id']){delete _0x5b5494['body']['id'];}return db[_0xbdfe('0x25')][_0xbdfe('0x3f')]({'where':{'id':_0x5b5494['params']['id']}})[_0xbdfe('0x1f')](handleEntityNotFound(_0x156549,null))[_0xbdfe('0x1f')](saveUpdates(_0x5b5494['body'],null))[_0xbdfe('0x1f')](respondWithResult(_0x156549,null))[_0xbdfe('0x3b')](handleError(_0x156549,null));};exports[_0xbdfe('0x42')]=function(_0x51a4bd,_0x552836){return db[_0xbdfe('0x25')][_0xbdfe('0x3f')]({'where':{'id':_0x51a4bd[_0xbdfe('0x3d')]['id']}})['then'](handleEntityNotFound(_0x552836,null))[_0xbdfe('0x1f')](removeEntity(_0x552836,null))[_0xbdfe('0x3b')](handleError(_0x552836,null));};exports['describe']=function(_0x2f05ae,_0x55565e){return db[_0xbdfe('0x25')][_0xbdfe('0x43')]()[_0xbdfe('0x1f')](respondWithResult(_0x55565e,null))[_0xbdfe('0x3b')](handleError(_0x55565e,null));}; \ No newline at end of file +var _0x9d72=['model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','params','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','count','offset','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key'];(function(_0x655485,_0x3c8573){var _0x1071f5=function(_0x25c5c6){while(--_0x25c5c6){_0x655485['push'](_0x655485['shift']());}};_0x1071f5(++_0x3c8573);}(_0x9d72,0x1ca));var _0x29d7=function(_0x56adfc,_0x4e5c0d){_0x56adfc=_0x56adfc-0x0;var _0x3064cf=_0x9d72[_0x56adfc];return _0x3064cf;};'use strict';var pdf=require(_0x29d7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x29d7('0x1'));var zipdir=require(_0x29d7('0x2'));var jsonpatch=require(_0x29d7('0x3'));var rp=require(_0x29d7('0x4'));var moment=require('moment');var BPromise=require(_0x29d7('0x5'));var Mustache=require('mustache');var util=require(_0x29d7('0x6'));var path=require(_0x29d7('0x7'));var sox=require(_0x29d7('0x8'));var csv=require(_0x29d7('0x9'));var ejs=require(_0x29d7('0xa'));var fs=require('fs');var _=require(_0x29d7('0xb'));var squel=require(_0x29d7('0xc'));var crypto=require(_0x29d7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x29d7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x29d7('0xf'));var Papa=require(_0x29d7('0x10'));var Redis=require(_0x29d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x29d7('0x12'));var as=require(_0x29d7('0x13'));var hardwareService=require(_0x29d7('0x14'));var logger=require('../../config/logger')(_0x29d7('0x15'));var utils=require(_0x29d7('0x16'));var config=require('../../config/environment');var db=require(_0x29d7('0x17'))['db'];function respondWithStatusCode(_0x30d6b3,_0x485732){_0x485732=_0x485732||0xcc;return function(_0x37fcd8){if(_0x37fcd8){return _0x30d6b3['sendStatus'](_0x485732);}return _0x30d6b3['status'](_0x485732)['end']();};}function respondWithResult(_0x242f10,_0x5bbaac){_0x5bbaac=_0x5bbaac||0xc8;return function(_0x508a29){if(_0x508a29){return _0x242f10[_0x29d7('0x18')](_0x5bbaac)[_0x29d7('0x19')](_0x508a29);}};}function respondWithFilteredResult(_0x5f3ae1,_0x31bc9b){return function(_0x526cc0){if(_0x526cc0){var _0x4f22ba=_0x526cc0[_0x29d7('0x1a')],_0x1877ca=_0x31bc9b[_0x29d7('0x1b')],_0x4b9d75=_0x31bc9b[_0x29d7('0x1b')]+_0x31bc9b['limit'],_0x4477ed;if(_0x4b9d75>=_0x4f22ba){_0x4b9d75=_0x4f22ba;_0x4477ed=0xc8;}else{_0x4477ed=0xce;}_0x5f3ae1[_0x29d7('0x18')](_0x4477ed);return _0x5f3ae1['set'](_0x29d7('0x1c'),_0x1877ca+'-'+_0x4b9d75+'/'+_0x4f22ba)[_0x29d7('0x19')](_0x526cc0);}return null;};}function patchUpdates(_0x363ab6){return function(_0x53dd7c){try{jsonpatch['apply'](_0x53dd7c,_0x363ab6,!![]);}catch(_0x10877e){return BPromise[_0x29d7('0x1d')](_0x10877e);}return _0x53dd7c[_0x29d7('0x1e')]();};}function saveUpdates(_0xa9a59f,_0x7ad32c){return function(_0x4a393c){if(_0x4a393c){return _0x4a393c[_0x29d7('0x1f')](_0xa9a59f)['then'](function(_0x1117da){return _0x1117da;});}return null;};}function removeEntity(_0x2b719d,_0x4dcc2a){return function(_0x2663cf){if(_0x2663cf){return _0x2663cf['destroy']()[_0x29d7('0x20')](function(){_0x2b719d['status'](0xcc)[_0x29d7('0x21')]();});}};}function handleEntityNotFound(_0x51de95,_0x535865){return function(_0x1e23bb){if(!_0x1e23bb){_0x51de95[_0x29d7('0x22')](0x194);}return _0x1e23bb;};}function handleError(_0x3ea1bf,_0x1e2080){_0x1e2080=_0x1e2080||0x1f4;return function(_0x2a5221){logger[_0x29d7('0x23')](_0x2a5221[_0x29d7('0x24')]);if(_0x2a5221[_0x29d7('0x25')]){delete _0x2a5221[_0x29d7('0x25')];}_0x3ea1bf['status'](_0x1e2080)[_0x29d7('0x26')](_0x2a5221);};}exports[_0x29d7('0x27')]=function(_0x3f937b,_0x4daa6d){var _0x4026ab={},_0x19b1ec={},_0x48348d={'count':0x0,'rows':[]};var _0x364e58=_[_0x29d7('0x28')](db[_0x29d7('0x29')][_0x29d7('0x2a')],function(_0x25b66b){return{'name':_0x25b66b[_0x29d7('0x2b')],'type':_0x25b66b[_0x29d7('0x2c')][_0x29d7('0x2d')]};});_0x19b1ec[_0x29d7('0x2e')]=_[_0x29d7('0x28')](_0x364e58,_0x29d7('0x25'));_0x19b1ec['query']=_[_0x29d7('0x2f')](_0x3f937b['query']);_0x19b1ec[_0x29d7('0x30')]=_['intersection'](_0x19b1ec[_0x29d7('0x2e')],_0x19b1ec[_0x29d7('0x31')]);_0x4026ab[_0x29d7('0x32')]=_[_0x29d7('0x33')](_0x19b1ec[_0x29d7('0x2e')],qs[_0x29d7('0x34')](_0x3f937b[_0x29d7('0x31')][_0x29d7('0x34')]));_0x4026ab[_0x29d7('0x32')]=_0x4026ab[_0x29d7('0x32')][_0x29d7('0x35')]?_0x4026ab['attributes']:_0x19b1ec[_0x29d7('0x2e')];if(!_0x3f937b[_0x29d7('0x31')][_0x29d7('0x36')](_0x29d7('0x37'))){_0x4026ab[_0x29d7('0x38')]=qs['limit'](_0x3f937b['query'][_0x29d7('0x38')]);_0x4026ab[_0x29d7('0x1b')]=qs['offset'](_0x3f937b['query'][_0x29d7('0x1b')]);}_0x4026ab[_0x29d7('0x39')]=qs[_0x29d7('0x3a')](_0x3f937b['query'][_0x29d7('0x3a')]);_0x4026ab[_0x29d7('0x3b')]=qs[_0x29d7('0x30')](_['pick'](_0x3f937b['query'],_0x19b1ec[_0x29d7('0x30')]),_0x364e58);if(_0x3f937b['query'][_0x29d7('0x3c')]){_0x4026ab[_0x29d7('0x3b')]=_[_0x29d7('0x3d')](_0x4026ab['where'],{'$or':_[_0x29d7('0x28')](_0x364e58,function(_0x37ddf9){if(_0x37ddf9['type']!=='VIRTUAL'){var _0x178e61={};_0x178e61[_0x37ddf9[_0x29d7('0x25')]]={'$like':'%'+_0x3f937b[_0x29d7('0x31')]['filter']+'%'};return _0x178e61;}})});}_0x4026ab=_[_0x29d7('0x3d')]({},_0x4026ab,_0x3f937b['options']);var _0x5978da={'where':_0x4026ab[_0x29d7('0x3b')]};return db['VoiceAgentReport'][_0x29d7('0x1a')](_0x5978da)[_0x29d7('0x20')](function(_0x29b81d){_0x48348d[_0x29d7('0x1a')]=_0x29b81d;if(_0x3f937b[_0x29d7('0x31')][_0x29d7('0x3e')]){_0x4026ab['include']=[{'all':!![]}];}return db[_0x29d7('0x29')][_0x29d7('0x3f')](_0x4026ab);})[_0x29d7('0x20')](function(_0x2ba14a){_0x48348d[_0x29d7('0x40')]=_0x2ba14a;return _0x48348d;})[_0x29d7('0x20')](respondWithFilteredResult(_0x4daa6d,_0x4026ab))[_0x29d7('0x41')](handleError(_0x4daa6d,null));};exports['show']=function(_0x50a000,_0x5c3135){var _0x101c05={'raw':![],'where':{'id':_0x50a000[_0x29d7('0x42')]['id']}},_0x398ffb={};_0x398ffb[_0x29d7('0x2e')]=_['keys'](db[_0x29d7('0x29')][_0x29d7('0x2a')]);_0x398ffb[_0x29d7('0x31')]=_[_0x29d7('0x2f')](_0x50a000['query']);_0x398ffb[_0x29d7('0x30')]=_['intersection'](_0x398ffb[_0x29d7('0x2e')],_0x398ffb[_0x29d7('0x31')]);_0x101c05[_0x29d7('0x32')]=_[_0x29d7('0x33')](_0x398ffb[_0x29d7('0x2e')],qs[_0x29d7('0x34')](_0x50a000[_0x29d7('0x31')][_0x29d7('0x34')]));_0x101c05[_0x29d7('0x32')]=_0x101c05[_0x29d7('0x32')][_0x29d7('0x35')]?_0x101c05[_0x29d7('0x32')]:_0x398ffb['model'];if(_0x50a000[_0x29d7('0x31')][_0x29d7('0x3e')]){_0x101c05['include']=[{'all':!![]}];}_0x101c05=_['merge']({},_0x101c05,_0x50a000[_0x29d7('0x43')]);return db[_0x29d7('0x29')][_0x29d7('0x44')](_0x101c05)[_0x29d7('0x20')](handleEntityNotFound(_0x5c3135,null))['then'](respondWithResult(_0x5c3135,null))[_0x29d7('0x41')](handleError(_0x5c3135,null));};exports[_0x29d7('0x45')]=function(_0x264769,_0x2826c4){return db[_0x29d7('0x29')][_0x29d7('0x45')](_0x264769[_0x29d7('0x46')],{})[_0x29d7('0x20')](respondWithResult(_0x2826c4,0xc9))[_0x29d7('0x41')](handleError(_0x2826c4,null));};exports['update']=function(_0x28ba18,_0x1d16dc){if(_0x28ba18[_0x29d7('0x46')]['id']){delete _0x28ba18[_0x29d7('0x46')]['id'];}return db[_0x29d7('0x29')][_0x29d7('0x44')]({'where':{'id':_0x28ba18[_0x29d7('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d16dc,null))[_0x29d7('0x20')](saveUpdates(_0x28ba18['body'],null))[_0x29d7('0x20')](respondWithResult(_0x1d16dc,null))[_0x29d7('0x41')](handleError(_0x1d16dc,null));};exports['destroy']=function(_0x4024bb,_0x57c967){return db['VoiceAgentReport'][_0x29d7('0x44')]({'where':{'id':_0x4024bb['params']['id']}})['then'](handleEntityNotFound(_0x57c967,null))['then'](removeEntity(_0x57c967,null))[_0x29d7('0x41')](handleError(_0x57c967,null));};exports[_0x29d7('0x47')]=function(_0x10cb71,_0x38699b){return db[_0x29d7('0x29')][_0x29d7('0x47')]()[_0x29d7('0x20')](respondWithResult(_0x38699b,null))['catch'](handleError(_0x38699b,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 8810b80..2cb459f 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 _0xcb91=['path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4a520f,_0x43798b){var _0x18740e=function(_0x8df422){while(--_0x8df422){_0x4a520f['push'](_0x4a520f['shift']());}};_0x18740e(++_0x43798b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xcb91[_0x46efd7];return _0x5637e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb9('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x34e8,0x12c));var _0x834e=function(_0x21db1c,_0x23fb08){_0x21db1c=_0x21db1c-0x0;var _0x153933=_0x34e8[_0x21db1c];return _0x153933;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'fields':[_0x834e('0xd'),_0x834e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 27c9ef3..273e33e 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 _0xcf70=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','debug','UpdateVoiceAgentReport','update','body','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4be5b0,_0x4fbc16){var _0x50c376=function(_0x10fa43){while(--_0x10fa43){_0x4be5b0['push'](_0x4be5b0['shift']());}};_0x50c376(++_0x4fbc16);}(_0xcf70,0x11b));var _0x0cf7=function(_0xa48cd5,_0x4c11ee){_0xa48cd5=_0xa48cd5-0x0;var _0x49272e=_0xcf70[_0xa48cd5];return _0x49272e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0cf7('0x0'));var BPromise=require(_0x0cf7('0x1'));var rs=require(_0x0cf7('0x2'));var fs=require('fs');var Redis=require(_0x0cf7('0x3'));var db=require(_0x0cf7('0x4'))['db'];var utils=require(_0x0cf7('0x5'));var logger=require(_0x0cf7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0cf7('0x7')][_0x0cf7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239e54,_0x20ebd7,_0x4820c2){return new BPromise(function(_0x25371a,_0x58d275){return client[_0x0cf7('0x9')](_0x239e54,_0x4820c2)[_0x0cf7('0xa')](function(_0x16330d){logger[_0x0cf7('0xb')](_0x0cf7('0xc'),_0x20ebd7,_0x0cf7('0xd'));logger['debug'](_0x0cf7('0xe'),_0x20ebd7,_0x0cf7('0xd'),JSON[_0x0cf7('0xf')](_0x16330d));if(_0x16330d['error']){if(_0x16330d[_0x0cf7('0x10')][_0x0cf7('0x11')]===0x1f4){logger[_0x0cf7('0x10')](_0x0cf7('0xc'),_0x20ebd7,_0x16330d['error'][_0x0cf7('0x12')]);return _0x58d275(_0x16330d[_0x0cf7('0x10')][_0x0cf7('0x12')]);}logger['error'](_0x0cf7('0xc'),_0x20ebd7,_0x16330d[_0x0cf7('0x10')]['message']);return _0x25371a(_0x16330d[_0x0cf7('0x10')][_0x0cf7('0x12')]);}else{logger[_0x0cf7('0xb')](_0x0cf7('0xc'),_0x20ebd7,_0x0cf7('0xd'));_0x25371a(_0x16330d[_0x0cf7('0x13')][_0x0cf7('0x12')]);}})[_0x0cf7('0x14')](function(_0x220a54){logger[_0x0cf7('0x10')](_0x0cf7('0xc'),_0x20ebd7,_0x220a54);_0x58d275(_0x220a54);});});}exports[_0x0cf7('0x15')]=function(_0x5cf536){var _0x123a0a=this;return new Promise(function(_0x240486,_0x4a0eb9){return db[_0x0cf7('0x16')][_0x0cf7('0x17')](_0x5cf536['body'],{'raw':_0x5cf536[_0x0cf7('0x18')]?_0x5cf536['options']['raw']===undefined?!![]:![]:!![]})[_0x0cf7('0xa')](function(_0x3f3d02){logger[_0x0cf7('0xb')]('CreateVoiceAgentReport',_0x5cf536);logger[_0x0cf7('0x19')](_0x0cf7('0x15'),_0x5cf536,JSON[_0x0cf7('0xf')](_0x3f3d02));_0x240486(_0x3f3d02);})[_0x0cf7('0x14')](function(_0x467f2f){logger[_0x0cf7('0x10')](_0x0cf7('0x15'),_0x467f2f['message'],_0x5cf536);_0x4a0eb9(_0x123a0a[_0x0cf7('0x10')](0x1f4,_0x467f2f[_0x0cf7('0x12')]));});});};exports[_0x0cf7('0x1a')]=function(_0x32061b){var _0x2b4a96=this;return new Promise(function(_0xa2068f,_0x138d4c){return db[_0x0cf7('0x16')][_0x0cf7('0x1b')](_0x32061b[_0x0cf7('0x1c')],{'raw':_0x32061b['options']?_0x32061b[_0x0cf7('0x18')][_0x0cf7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32061b[_0x0cf7('0x18')]?_0x32061b[_0x0cf7('0x18')][_0x0cf7('0x1e')]||null:null,'attributes':_0x32061b[_0x0cf7('0x18')]?_0x32061b['options'][_0x0cf7('0x1f')]||null:null,'limit':_0x32061b[_0x0cf7('0x18')]?_0x32061b[_0x0cf7('0x18')][_0x0cf7('0x20')]||null:null})[_0x0cf7('0xa')](function(_0xdec02e){logger[_0x0cf7('0xb')]('UpdateVoiceAgentReport',_0x32061b);logger[_0x0cf7('0x19')](_0x0cf7('0x1a'),_0x32061b,JSON['stringify'](_0xdec02e));_0xa2068f(_0xdec02e);})[_0x0cf7('0x14')](function(_0x15bfa9){logger['error'](_0x0cf7('0x1a'),_0x15bfa9[_0x0cf7('0x12')],_0x32061b);_0x138d4c(_0x2b4a96[_0x0cf7('0x10')](0x1f4,_0x15bfa9[_0x0cf7('0x12')]));});});}; \ No newline at end of file +var _0x621e=['stringify','code','error','message','VoiceAgentReport,\x20%s,\x20%s','result','CreateVoiceAgentReport','create','body','options','raw','then','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug'];(function(_0x392dc2,_0x47c3f3){var _0x14150f=function(_0x9f305a){while(--_0x9f305a){_0x392dc2['push'](_0x392dc2['shift']());}};_0x14150f(++_0x47c3f3);}(_0x621e,0xde));var _0xe621=function(_0x1cc02d,_0x3de19e){_0x1cc02d=_0x1cc02d-0x0;var _0x145423=_0x621e[_0x1cc02d];return _0x145423;};'use strict';var _=require(_0xe621('0x0'));var util=require(_0xe621('0x1'));var moment=require(_0xe621('0x2'));var BPromise=require(_0xe621('0x3'));var rs=require(_0xe621('0x4'));var fs=require('fs');var Redis=require(_0xe621('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe621('0x6'));var logger=require(_0xe621('0x7'))(_0xe621('0x8'));var config=require(_0xe621('0x9'));var jayson=require(_0xe621('0xa'));var client=jayson['client'][_0xe621('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49b86c,_0x2e4529,_0x330c8c){return new BPromise(function(_0x51d881,_0x43b666){return client[_0xe621('0xc')](_0x49b86c,_0x330c8c)['then'](function(_0x2eaa69){logger[_0xe621('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x2e4529,_0xe621('0xe'));logger[_0xe621('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x2e4529,_0xe621('0xe'),JSON[_0xe621('0x10')](_0x2eaa69));if(_0x2eaa69['error']){if(_0x2eaa69['error'][_0xe621('0x11')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x2e4529,_0x2eaa69[_0xe621('0x12')][_0xe621('0x13')]);return _0x43b666(_0x2eaa69[_0xe621('0x12')][_0xe621('0x13')]);}logger[_0xe621('0x12')](_0xe621('0x14'),_0x2e4529,_0x2eaa69[_0xe621('0x12')]['message']);return _0x51d881(_0x2eaa69[_0xe621('0x12')][_0xe621('0x13')]);}else{logger['info'](_0xe621('0x14'),_0x2e4529,_0xe621('0xe'));_0x51d881(_0x2eaa69[_0xe621('0x15')][_0xe621('0x13')]);}})['catch'](function(_0x61e850){logger[_0xe621('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x2e4529,_0x61e850);_0x43b666(_0x61e850);});});}exports[_0xe621('0x16')]=function(_0x4d630b){var _0x333089=this;return new Promise(function(_0xdbfa7b,_0x43df36){return db['VoiceAgentReport'][_0xe621('0x17')](_0x4d630b[_0xe621('0x18')],{'raw':_0x4d630b[_0xe621('0x19')]?_0x4d630b[_0xe621('0x19')][_0xe621('0x1a')]===undefined?!![]:![]:!![]})[_0xe621('0x1b')](function(_0x4de99f){logger[_0xe621('0xd')](_0xe621('0x16'),_0x4d630b);logger[_0xe621('0xf')]('CreateVoiceAgentReport',_0x4d630b,JSON[_0xe621('0x10')](_0x4de99f));_0xdbfa7b(_0x4de99f);})[_0xe621('0x1c')](function(_0x379efd){logger[_0xe621('0x12')](_0xe621('0x16'),_0x379efd[_0xe621('0x13')],_0x4d630b);_0x43df36(_0x333089['error'](0x1f4,_0x379efd[_0xe621('0x13')]));});});};exports[_0xe621('0x1d')]=function(_0x2b566b){var _0x70aba5=this;return new Promise(function(_0x40c4ba,_0x32aef2){return db[_0xe621('0x1e')][_0xe621('0x1f')](_0x2b566b[_0xe621('0x18')],{'raw':_0x2b566b[_0xe621('0x19')]?_0x2b566b[_0xe621('0x19')][_0xe621('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b566b[_0xe621('0x19')]?_0x2b566b[_0xe621('0x19')][_0xe621('0x20')]||null:null,'attributes':_0x2b566b[_0xe621('0x19')]?_0x2b566b[_0xe621('0x19')][_0xe621('0x21')]||null:null,'limit':_0x2b566b[_0xe621('0x19')]?_0x2b566b[_0xe621('0x19')]['limit']||null:null})['then'](function(_0x137ead){logger[_0xe621('0xd')](_0xe621('0x1d'),_0x2b566b);logger['debug'](_0xe621('0x1d'),_0x2b566b,JSON[_0xe621('0x10')](_0x137ead));_0x40c4ba(_0x137ead);})[_0xe621('0x1c')](function(_0x34eb97){logger[_0xe621('0x12')](_0xe621('0x1d'),_0x34eb97[_0xe621('0x13')],_0x2b566b);_0x32aef2(_0x70aba5[_0xe621('0x12')](0x1f4,_0x34eb97[_0xe621('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 24c8144..320d94d 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 _0x84aa=['destroy','exports','multer','util','path','connect-timeout','../../config/environment','./voiceCallReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x466a1a,_0x37933b){var _0x577165=function(_0x4c97b9){while(--_0x4c97b9){_0x466a1a['push'](_0x466a1a['shift']());}};_0x577165(++_0x37933b);}(_0x84aa,0x11a));var _0xa84a=function(_0x2d847,_0x5dbba3){_0x2d847=_0x2d847-0x0;var _0x4ab008=_0x84aa[_0x2d847];return _0x4ab008;};'use strict';var multer=require(_0xa84a('0x0'));var util=require(_0xa84a('0x1'));var path=require(_0xa84a('0x2'));var timeout=require(_0xa84a('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa84a('0x4'));var controller=require(_0xa84a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xa84a('0x6')]);router[_0xa84a('0x7')](_0xa84a('0x8'),auth[_0xa84a('0x9')](),controller[_0xa84a('0xa')]);router[_0xa84a('0x7')](_0xa84a('0xb'),auth[_0xa84a('0x9')](),controller[_0xa84a('0xc')]);router[_0xa84a('0xd')]('/',auth['isAuthenticated'](),controller[_0xa84a('0xe')]);router[_0xa84a('0xf')](_0xa84a('0xb'),auth[_0xa84a('0x9')](),controller[_0xa84a('0x10')]);router[_0xa84a('0x11')](_0xa84a('0xb'),auth[_0xa84a('0x9')](),controller[_0xa84a('0x12')]);module[_0xa84a('0x13')]=router; \ No newline at end of file +var _0x3a21=['Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a21,0x128));var _0x13a2=function(_0x39ba00,_0x369bfb){_0x39ba00=_0x39ba00-0x0;var _0x50488=_0x3a21[_0x39ba00];return _0x50488;};'use strict';var multer=require(_0x13a2('0x0'));var util=require(_0x13a2('0x1'));var path=require(_0x13a2('0x2'));var timeout=require(_0x13a2('0x3'));var express=require('express');var router=express[_0x13a2('0x4')]();var auth=require(_0x13a2('0x5'));var interaction=require(_0x13a2('0x6'));var config=require('../../config/environment');var controller=require(_0x13a2('0x7'));router[_0x13a2('0x8')]('/',auth[_0x13a2('0x9')](),controller['index']);router[_0x13a2('0x8')](_0x13a2('0xa'),auth['isAuthenticated'](),controller[_0x13a2('0xb')]);router[_0x13a2('0x8')](_0x13a2('0xc'),auth['isAuthenticated'](),controller[_0x13a2('0xd')]);router['post']('/',auth[_0x13a2('0x9')](),controller[_0x13a2('0xe')]);router[_0x13a2('0xf')]('/:id',auth[_0x13a2('0x9')](),controller[_0x13a2('0x10')]);router[_0x13a2('0x11')](_0x13a2('0xc'),auth[_0x13a2('0x9')](),controller[_0x13a2('0x12')]);module[_0x13a2('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 4fcb9c8..6ebaf98 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x516f7d,_0x2929e9){var _0x17771e=function(_0x3a2160){while(--_0x3a2160){_0x516f7d['push'](_0x516f7d['shift']());}};_0x17771e(++_0x2929e9);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x5b41b0,_0x291edf){var _0x2dc004=function(_0x43ab9b){while(--_0x43ab9b){_0x5b41b0['push'](_0x5b41b0['shift']());}};_0x2dc004(++_0x291edf);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 22070e4..4ae1a1a 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 _0x599b=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceCallReport','includeAll','fullname','alias','User','findAll','catch','params','include','create','body','find','describe','update','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x599b,0x1ef));var _0xb599=function(_0xbb5dd2,_0x142d00){_0xbb5dd2=_0xbb5dd2-0x0;var _0xe8c642=_0x599b[_0xbb5dd2];return _0xe8c642;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb599('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb599('0x1'));var jsonpatch=require(_0xb599('0x2'));var rp=require(_0xb599('0x3'));var moment=require(_0xb599('0x4'));var BPromise=require(_0xb599('0x5'));var Mustache=require(_0xb599('0x6'));var util=require('util');var path=require(_0xb599('0x7'));var sox=require(_0xb599('0x8'));var csv=require(_0xb599('0x9'));var ejs=require(_0xb599('0xa'));var fs=require('fs');var _=require(_0xb599('0xb'));var squel=require(_0xb599('0xc'));var crypto=require(_0xb599('0xd'));var jsforce=require(_0xb599('0xe'));var deskjs=require(_0xb599('0xf'));var toCsv=require(_0xb599('0x9'));var querystring=require(_0xb599('0x10'));var Papa=require(_0xb599('0x11'));var Redis=require(_0xb599('0x12'));var authService=require(_0xb599('0x13'));var qs=require(_0xb599('0x14'));var as=require(_0xb599('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb599('0x16'))(_0xb599('0x17'));var utils=require(_0xb599('0x18'));var config=require(_0xb599('0x19'));var db=require(_0xb599('0x1a'))['db'];function respondWithStatusCode(_0x1745ea,_0x42466b){_0x42466b=_0x42466b||0xcc;return function(_0x229163){if(_0x229163){return _0x1745ea[_0xb599('0x1b')](_0x42466b);}return _0x1745ea[_0xb599('0x1c')](_0x42466b)[_0xb599('0x1d')]();};}function respondWithResult(_0x30c6e5,_0x4e7a0b){_0x4e7a0b=_0x4e7a0b||0xc8;return function(_0x3995dd){if(_0x3995dd){return _0x30c6e5[_0xb599('0x1c')](_0x4e7a0b)[_0xb599('0x1e')](_0x3995dd);}};}function respondWithFilteredResult(_0x7273db,_0x533ac7){return function(_0x59b385){if(_0x59b385){var _0xa8cdf4=_0x59b385[_0xb599('0x1f')],_0xdc236a=_0x533ac7['offset'],_0xda028e=_0x533ac7[_0xb599('0x20')]+_0x533ac7[_0xb599('0x21')],_0x5c2562;if(_0xda028e>=_0xa8cdf4){_0xda028e=_0xa8cdf4;_0x5c2562=0xc8;}else{_0x5c2562=0xce;}_0x7273db[_0xb599('0x1c')](_0x5c2562);return _0x7273db['set']('Content-Range',_0xdc236a+'-'+_0xda028e+'/'+_0xa8cdf4)[_0xb599('0x1e')](_0x59b385);}return null;};}function patchUpdates(_0x2ba034){return function(_0x2f76d1){try{jsonpatch['apply'](_0x2f76d1,_0x2ba034,!![]);}catch(_0x378d51){return BPromise[_0xb599('0x22')](_0x378d51);}return _0x2f76d1[_0xb599('0x23')]();};}function saveUpdates(_0x209433,_0x521a3c){return function(_0x41ee75){if(_0x41ee75){return _0x41ee75['update'](_0x209433)[_0xb599('0x24')](function(_0x133309){return _0x133309;});}return null;};}function removeEntity(_0x108337,_0x40e690){return function(_0x2ea247){if(_0x2ea247){return _0x2ea247[_0xb599('0x25')]()['then'](function(){_0x108337['status'](0xcc)[_0xb599('0x1d')]();});}};}function handleEntityNotFound(_0x56f132,_0x1a854c){return function(_0x407c7d){if(!_0x407c7d){_0x56f132[_0xb599('0x1b')](0x194);}return _0x407c7d;};}function handleError(_0xae28cd,_0x2ac265){_0x2ac265=_0x2ac265||0x1f4;return function(_0xd90627){logger['error'](_0xd90627[_0xb599('0x26')]);if(_0xd90627[_0xb599('0x27')]){delete _0xd90627[_0xb599('0x27')];}_0xae28cd[_0xb599('0x1c')](_0x2ac265)[_0xb599('0x28')](_0xd90627);};}exports[_0xb599('0x29')]=function(_0x2e2957,_0x59a3f0){var _0x16fe29={},_0x246a07={},_0x5d05c4={'count':0x0,'rows':[]};var _0x35cea7=_[_0xb599('0x2a')](db['VoiceCallReport'][_0xb599('0x2b')],function(_0x1ec0a8){return{'name':_0x1ec0a8[_0xb599('0x2c')],'type':_0x1ec0a8[_0xb599('0x2d')]['key']};});_0x246a07[_0xb599('0x2e')]=_[_0xb599('0x2a')](_0x35cea7,_0xb599('0x27'));_0x246a07[_0xb599('0x2f')]=_[_0xb599('0x30')](_0x2e2957['query']);_0x246a07[_0xb599('0x31')]=_[_0xb599('0x32')](_0x246a07[_0xb599('0x2e')],_0x246a07[_0xb599('0x2f')]);_0x16fe29['attributes']=_[_0xb599('0x32')](_0x246a07[_0xb599('0x2e')],qs['fields'](_0x2e2957['query'][_0xb599('0x33')]));_0x16fe29['attributes']=_0x16fe29[_0xb599('0x34')][_0xb599('0x35')]?_0x16fe29[_0xb599('0x34')]:_0x246a07[_0xb599('0x2e')];if(!_0x2e2957['query'][_0xb599('0x36')](_0xb599('0x37'))){_0x16fe29[_0xb599('0x21')]=qs['limit'](_0x2e2957[_0xb599('0x2f')][_0xb599('0x21')]);_0x16fe29['offset']=qs['offset'](_0x2e2957[_0xb599('0x2f')][_0xb599('0x20')]);}_0x16fe29[_0xb599('0x38')]=qs[_0xb599('0x39')](_0x2e2957[_0xb599('0x2f')]['sort']);_0x16fe29[_0xb599('0x3a')]=qs['filters'](_['pick'](_0x2e2957[_0xb599('0x2f')],_0x246a07[_0xb599('0x31')]),_0x35cea7);if(_0x2e2957['query'][_0xb599('0x3b')]){_0x16fe29[_0xb599('0x3a')]=_[_0xb599('0x3c')](_0x16fe29['where'],{'$or':_[_0xb599('0x2a')](_0x35cea7,function(_0xaddfa){if(_0xaddfa[_0xb599('0x2d')]!==_0xb599('0x3d')){var _0x5823c6={};_0x5823c6[_0xaddfa[_0xb599('0x27')]]={'$like':'%'+_0x2e2957['query'][_0xb599('0x3b')]+'%'};return _0x5823c6;}})});}_0x16fe29=_['merge']({},_0x16fe29,_0x2e2957[_0xb599('0x3e')]);var _0x4b86f2={'where':_0x16fe29[_0xb599('0x3a')]};return db[_0xb599('0x3f')][_0xb599('0x1f')](_0x4b86f2)[_0xb599('0x24')](function(_0x3458f5){_0x5d05c4[_0xb599('0x1f')]=_0x3458f5;if(_0x2e2957[_0xb599('0x2f')][_0xb599('0x40')]){_0x16fe29['include']=[{'attributes':['id','name',_0xb599('0x41'),_0xb599('0x42')],'model':db[_0xb599('0x43')],'as':_0xb599('0x43')}];}return db[_0xb599('0x3f')][_0xb599('0x44')](_0x16fe29);})[_0xb599('0x24')](function(_0x4a9e3a){_0x5d05c4['rows']=_0x4a9e3a;return _0x5d05c4;})[_0xb599('0x24')](respondWithFilteredResult(_0x59a3f0,_0x16fe29))[_0xb599('0x45')](handleError(_0x59a3f0,null));};exports['show']=function(_0x3a0dce,_0x5769b9){var _0x484ec7={'raw':!![],'where':{'id':_0x3a0dce[_0xb599('0x46')]['id']}},_0x4de171={};_0x4de171[_0xb599('0x2e')]=_[_0xb599('0x30')](db[_0xb599('0x3f')][_0xb599('0x2b')]);_0x4de171[_0xb599('0x2f')]=_['keys'](_0x3a0dce[_0xb599('0x2f')]);_0x4de171[_0xb599('0x31')]=_[_0xb599('0x32')](_0x4de171[_0xb599('0x2e')],_0x4de171[_0xb599('0x2f')]);_0x484ec7[_0xb599('0x34')]=_['intersection'](_0x4de171[_0xb599('0x2e')],qs[_0xb599('0x33')](_0x3a0dce['query'][_0xb599('0x33')]));_0x484ec7[_0xb599('0x34')]=_0x484ec7[_0xb599('0x34')]['length']?_0x484ec7[_0xb599('0x34')]:_0x4de171[_0xb599('0x2e')];if(_0x3a0dce[_0xb599('0x2f')]['includeAll']){_0x484ec7[_0xb599('0x47')]=[{'all':!![]}];}_0x484ec7=_[_0xb599('0x3c')]({},_0x484ec7,_0x3a0dce['options']);return db[_0xb599('0x3f')]['find'](_0x484ec7)['then'](handleEntityNotFound(_0x5769b9,null))['then'](respondWithResult(_0x5769b9,null))[_0xb599('0x45')](handleError(_0x5769b9,null));};exports[_0xb599('0x48')]=function(_0x55c9a4,_0x3aac11){return db[_0xb599('0x3f')][_0xb599('0x48')](_0x55c9a4[_0xb599('0x49')],{})[_0xb599('0x24')](respondWithResult(_0x3aac11,0xc9))[_0xb599('0x45')](handleError(_0x3aac11,null));};exports[_0xb599('0x25')]=function(_0x3558e4,_0x228fd4){return db[_0xb599('0x3f')][_0xb599('0x4a')]({'where':{'id':_0x3558e4['params']['id']}})[_0xb599('0x24')](handleEntityNotFound(_0x228fd4,null))['then'](removeEntity(_0x228fd4,null))['catch'](handleError(_0x228fd4,null));};exports[_0xb599('0x4b')]=function(_0x4bd9de,_0x59c65a){return db[_0xb599('0x3f')][_0xb599('0x4b')]()[_0xb599('0x24')](respondWithResult(_0x59c65a,null))['catch'](handleError(_0x59c65a,null));};exports[_0xb599('0x4c')]=function(_0x2e2f91,_0x150556){if(_0x2e2f91[_0xb599('0x49')]['uniqueid']){delete _0x2e2f91['body'][_0xb599('0x4d')];}return db[_0xb599('0x3f')][_0xb599('0x4a')]({'where':{'uniqueid':_0x2e2f91[_0xb599('0x46')]['id'],'UserId':{'$or':[null,_0x2e2f91['user']['id']]}}})[_0xb599('0x24')](handleEntityNotFound(_0x150556,null))[_0xb599('0x24')](saveUpdates(_0x2e2f91[_0xb599('0x49')],null))[_0xb599('0x24')](respondWithResult(_0x150556,null))[_0xb599('0x45')](handleError(_0x150556,null));}; \ No newline at end of file +var _0xcebb=['intersection','attributes','fields','length','nolimit','limit','order','sort','where','merge','filter','options','include','fullname','alias','User','findAll','rows','catch','show','params','keys','includeAll','find','create','describe','body','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x309251,_0x59a3d3){var _0x3c6e84=function(_0x2c535){while(--_0x2c535){_0x309251['push'](_0x309251['shift']());}};_0x3c6e84(++_0x59a3d3);}(_0xcebb,0xfa));var _0xbceb=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xcebb[_0x2e4e19];return _0x9ba20b;};'use strict';var pdf=require(_0xbceb('0x0'));var emlformat=require(_0xbceb('0x1'));var rimraf=require(_0xbceb('0x2'));var zipdir=require(_0xbceb('0x3'));var jsonpatch=require(_0xbceb('0x4'));var rp=require(_0xbceb('0x5'));var moment=require('moment');var BPromise=require(_0xbceb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbceb('0x7'));var sox=require(_0xbceb('0x8'));var csv=require(_0xbceb('0x9'));var ejs=require(_0xbceb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbceb('0xb'));var jsforce=require(_0xbceb('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbceb('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbceb('0xe'));var qs=require(_0xbceb('0xf'));var as=require(_0xbceb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbceb('0x11'))(_0xbceb('0x12'));var utils=require('../../config/utils');var config=require(_0xbceb('0x13'));var db=require(_0xbceb('0x14'))['db'];function respondWithStatusCode(_0x4a667b,_0x368be7){_0x368be7=_0x368be7||0xcc;return function(_0x2b3aa9){if(_0x2b3aa9){return _0x4a667b['sendStatus'](_0x368be7);}return _0x4a667b[_0xbceb('0x15')](_0x368be7)[_0xbceb('0x16')]();};}function respondWithResult(_0x18ec03,_0x16268a){_0x16268a=_0x16268a||0xc8;return function(_0x35620d){if(_0x35620d){return _0x18ec03['status'](_0x16268a)['json'](_0x35620d);}};}function respondWithFilteredResult(_0x406491,_0x1f990b){return function(_0x4b3272){if(_0x4b3272){var _0x401244=_0x4b3272[_0xbceb('0x17')],_0x26b198=_0x1f990b[_0xbceb('0x18')],_0x2a602a=_0x1f990b[_0xbceb('0x18')]+_0x1f990b['limit'],_0x1ca2fb;if(_0x2a602a>=_0x401244){_0x2a602a=_0x401244;_0x1ca2fb=0xc8;}else{_0x1ca2fb=0xce;}_0x406491[_0xbceb('0x15')](_0x1ca2fb);return _0x406491[_0xbceb('0x19')](_0xbceb('0x1a'),_0x26b198+'-'+_0x2a602a+'/'+_0x401244)['json'](_0x4b3272);}return null;};}function patchUpdates(_0x304a1c){return function(_0x2e0e87){try{jsonpatch[_0xbceb('0x1b')](_0x2e0e87,_0x304a1c,!![]);}catch(_0x3d384f){return BPromise[_0xbceb('0x1c')](_0x3d384f);}return _0x2e0e87['save']();};}function saveUpdates(_0xfaccbf,_0x59f026){return function(_0x5c4b4c){if(_0x5c4b4c){return _0x5c4b4c[_0xbceb('0x1d')](_0xfaccbf)['then'](function(_0x5204ca){return _0x5204ca;});}return null;};}function removeEntity(_0x131112,_0x2c0ef7){return function(_0x551a7a){if(_0x551a7a){return _0x551a7a[_0xbceb('0x1e')]()[_0xbceb('0x1f')](function(){_0x131112[_0xbceb('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4449b5,_0x35695f){return function(_0x325483){if(!_0x325483){_0x4449b5[_0xbceb('0x20')](0x194);}return _0x325483;};}function handleError(_0x1a5475,_0x34aeba){_0x34aeba=_0x34aeba||0x1f4;return function(_0x1eea6b){logger[_0xbceb('0x21')](_0x1eea6b[_0xbceb('0x22')]);if(_0x1eea6b[_0xbceb('0x23')]){delete _0x1eea6b['name'];}_0x1a5475['status'](_0x34aeba)[_0xbceb('0x24')](_0x1eea6b);};}exports[_0xbceb('0x25')]=function(_0x924d5c,_0x34d634){var _0x1dab5f={},_0x49abb7={},_0x173205={'count':0x0,'rows':[]};var _0x204d0e=_['map'](db[_0xbceb('0x26')][_0xbceb('0x27')],function(_0x36685b){return{'name':_0x36685b[_0xbceb('0x28')],'type':_0x36685b[_0xbceb('0x29')][_0xbceb('0x2a')]};});_0x49abb7[_0xbceb('0x2b')]=_['map'](_0x204d0e,_0xbceb('0x23'));_0x49abb7[_0xbceb('0x2c')]=_['keys'](_0x924d5c[_0xbceb('0x2c')]);_0x49abb7[_0xbceb('0x2d')]=_[_0xbceb('0x2e')](_0x49abb7[_0xbceb('0x2b')],_0x49abb7['query']);_0x1dab5f[_0xbceb('0x2f')]=_[_0xbceb('0x2e')](_0x49abb7[_0xbceb('0x2b')],qs[_0xbceb('0x30')](_0x924d5c[_0xbceb('0x2c')][_0xbceb('0x30')]));_0x1dab5f[_0xbceb('0x2f')]=_0x1dab5f[_0xbceb('0x2f')][_0xbceb('0x31')]?_0x1dab5f[_0xbceb('0x2f')]:_0x49abb7[_0xbceb('0x2b')];if(!_0x924d5c['query']['hasOwnProperty'](_0xbceb('0x32'))){_0x1dab5f[_0xbceb('0x33')]=qs[_0xbceb('0x33')](_0x924d5c[_0xbceb('0x2c')][_0xbceb('0x33')]);_0x1dab5f[_0xbceb('0x18')]=qs[_0xbceb('0x18')](_0x924d5c['query'][_0xbceb('0x18')]);}_0x1dab5f[_0xbceb('0x34')]=qs[_0xbceb('0x35')](_0x924d5c[_0xbceb('0x2c')][_0xbceb('0x35')]);_0x1dab5f['where']=qs[_0xbceb('0x2d')](_['pick'](_0x924d5c[_0xbceb('0x2c')],_0x49abb7['filters']),_0x204d0e);if(_0x924d5c[_0xbceb('0x2c')]['filter']){_0x1dab5f[_0xbceb('0x36')]=_[_0xbceb('0x37')](_0x1dab5f[_0xbceb('0x36')],{'$or':_['map'](_0x204d0e,function(_0x351a68){if(_0x351a68['type']!=='VIRTUAL'){var _0x4e865b={};_0x4e865b[_0x351a68['name']]={'$like':'%'+_0x924d5c[_0xbceb('0x2c')][_0xbceb('0x38')]+'%'};return _0x4e865b;}})});}_0x1dab5f=_[_0xbceb('0x37')]({},_0x1dab5f,_0x924d5c[_0xbceb('0x39')]);var _0x56b7fe={'where':_0x1dab5f[_0xbceb('0x36')]};return db['VoiceCallReport'][_0xbceb('0x17')](_0x56b7fe)[_0xbceb('0x1f')](function(_0x3092e7){_0x173205[_0xbceb('0x17')]=_0x3092e7;if(_0x924d5c[_0xbceb('0x2c')]['includeAll']){_0x1dab5f[_0xbceb('0x3a')]=[{'attributes':['id',_0xbceb('0x23'),_0xbceb('0x3b'),_0xbceb('0x3c')],'model':db[_0xbceb('0x3d')],'as':_0xbceb('0x3d')}];}return db[_0xbceb('0x26')][_0xbceb('0x3e')](_0x1dab5f);})[_0xbceb('0x1f')](function(_0xc51eef){_0x173205[_0xbceb('0x3f')]=_0xc51eef;return _0x173205;})[_0xbceb('0x1f')](respondWithFilteredResult(_0x34d634,_0x1dab5f))[_0xbceb('0x40')](handleError(_0x34d634,null));};exports[_0xbceb('0x41')]=function(_0x49e8ec,_0x168e53){var _0x2d4767={'raw':!![],'where':{'id':_0x49e8ec[_0xbceb('0x42')]['id']}},_0x166bd0={};_0x166bd0['model']=_[_0xbceb('0x43')](db[_0xbceb('0x26')]['rawAttributes']);_0x166bd0[_0xbceb('0x2c')]=_[_0xbceb('0x43')](_0x49e8ec[_0xbceb('0x2c')]);_0x166bd0['filters']=_['intersection'](_0x166bd0[_0xbceb('0x2b')],_0x166bd0['query']);_0x2d4767[_0xbceb('0x2f')]=_[_0xbceb('0x2e')](_0x166bd0[_0xbceb('0x2b')],qs['fields'](_0x49e8ec[_0xbceb('0x2c')][_0xbceb('0x30')]));_0x2d4767[_0xbceb('0x2f')]=_0x2d4767[_0xbceb('0x2f')][_0xbceb('0x31')]?_0x2d4767[_0xbceb('0x2f')]:_0x166bd0['model'];if(_0x49e8ec['query'][_0xbceb('0x44')]){_0x2d4767['include']=[{'all':!![]}];}_0x2d4767=_[_0xbceb('0x37')]({},_0x2d4767,_0x49e8ec['options']);return db[_0xbceb('0x26')][_0xbceb('0x45')](_0x2d4767)[_0xbceb('0x1f')](handleEntityNotFound(_0x168e53,null))[_0xbceb('0x1f')](respondWithResult(_0x168e53,null))[_0xbceb('0x40')](handleError(_0x168e53,null));};exports[_0xbceb('0x46')]=function(_0x2051c4,_0xcfba8a){return db['VoiceCallReport'][_0xbceb('0x46')](_0x2051c4['body'],{})[_0xbceb('0x1f')](respondWithResult(_0xcfba8a,0xc9))[_0xbceb('0x40')](handleError(_0xcfba8a,null));};exports[_0xbceb('0x1e')]=function(_0x3b8985,_0xd0b175){return db[_0xbceb('0x26')][_0xbceb('0x45')]({'where':{'id':_0x3b8985[_0xbceb('0x42')]['id']}})[_0xbceb('0x1f')](handleEntityNotFound(_0xd0b175,null))[_0xbceb('0x1f')](removeEntity(_0xd0b175,null))[_0xbceb('0x40')](handleError(_0xd0b175,null));};exports[_0xbceb('0x47')]=function(_0x12ad28,_0x245f62){return db[_0xbceb('0x26')][_0xbceb('0x47')]()[_0xbceb('0x1f')](respondWithResult(_0x245f62,null))['catch'](handleError(_0x245f62,null));};exports[_0xbceb('0x1d')]=function(_0x513898,_0x3f3940){if(_0x513898[_0xbceb('0x48')][_0xbceb('0x49')]){delete _0x513898[_0xbceb('0x48')][_0xbceb('0x49')];}return db[_0xbceb('0x26')]['find']({'where':{'uniqueid':_0x513898[_0xbceb('0x42')]['id'],'UserId':{'$or':[null,_0x513898['user']['id']]}}})[_0xbceb('0x1f')](handleEntityNotFound(_0x3f3940,null))[_0xbceb('0x1f')](saveUpdates(_0x513898[_0xbceb('0x48')],null))['then'](respondWithResult(_0x3f3940,null))[_0xbceb('0x40')](handleError(_0x3f3940,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4b98d23..bf7497f 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 _0x1ce1=['define','VoiceCallReport','report_call','uniqueid','lodash','api','bluebird','path','rimraf'];(function(_0x2f8680,_0x51d9e3){var _0x432272=function(_0x35ee31){while(--_0x35ee31){_0x2f8680['push'](_0x2f8680['shift']());}};_0x432272(++_0x51d9e3);}(_0x1ce1,0x136));var _0x11ce=function(_0x281edd,_0x554bec){_0x281edd=_0x281edd-0x0;var _0x209b40=_0x1ce1[_0x281edd];return _0x209b40;};'use strict';var _=require(_0x11ce('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x11ce('0x1'));var moment=require('moment');var BPromise=require(_0x11ce('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11ce('0x3'));var rimraf=require(_0x11ce('0x4'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x1fbc6e,_0xf1bf82){return _0x1fbc6e[_0x11ce('0x5')](_0x11ce('0x6'),attributes,{'tableName':_0x11ce('0x7'),'paranoid':![],'indexes':[{'fields':[_0x11ce('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6006=['request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','uniqueid','lodash','util','bluebird'];(function(_0x20cfe7,_0x2360ef){var _0x4ff88a=function(_0x12a8fd){while(--_0x12a8fd){_0x20cfe7['push'](_0x20cfe7['shift']());}};_0x4ff88a(++_0x2360ef);}(_0x6006,0x16f));var _0x6600=function(_0x57224f,_0x98e44a){_0x57224f=_0x57224f-0x0;var _0x3b83a8=_0x6006[_0x57224f];return _0x3b83a8;};'use strict';var _=require(_0x6600('0x0'));var util=require(_0x6600('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6600('0x2'));var rp=require(_0x6600('0x3'));var fs=require('fs');var path=require(_0x6600('0x4'));var rimraf=require(_0x6600('0x5'));var config=require('../../config/environment');var attributes=require(_0x6600('0x6'));module[_0x6600('0x7')]=function(_0x2d35d0,_0x1a1ea1){return _0x2d35d0[_0x6600('0x8')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6600('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 3cdd531..501ce16 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 _0x03fa=['error','message','result','catch','GetVoiceCallReport','options','raw','attributes','limit','include','map','model','stringify','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x03fa,0xcc));var _0xa03f=function(_0x504653,_0x54fb83){_0x504653=_0x504653-0x0;var _0x48f553=_0x03fa[_0x504653];return _0x48f553;};'use strict';var _=require(_0xa03f('0x0'));var util=require(_0xa03f('0x1'));var moment=require(_0xa03f('0x2'));var BPromise=require(_0xa03f('0x3'));var rs=require(_0xa03f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa03f('0x5'))['db'];var utils=require(_0xa03f('0x6'));var logger=require(_0xa03f('0x7'))(_0xa03f('0x8'));var config=require(_0xa03f('0x9'));var jayson=require(_0xa03f('0xa'));var client=jayson[_0xa03f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1337e9,_0x59c2d9,_0xf93c27){return new BPromise(function(_0x190272,_0x112063){return client['request'](_0x1337e9,_0xf93c27)[_0xa03f('0xc')](function(_0x38ee92){logger[_0xa03f('0xd')](_0xa03f('0xe'),_0x59c2d9,_0xa03f('0xf'));logger[_0xa03f('0x10')](_0xa03f('0x11'),_0x59c2d9,'request\x20sent',JSON['stringify'](_0x38ee92));if(_0x38ee92[_0xa03f('0x12')]){if(_0x38ee92[_0xa03f('0x12')]['code']===0x1f4){logger[_0xa03f('0x12')](_0xa03f('0xe'),_0x59c2d9,_0x38ee92[_0xa03f('0x12')][_0xa03f('0x13')]);return _0x112063(_0x38ee92[_0xa03f('0x12')][_0xa03f('0x13')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x59c2d9,_0x38ee92[_0xa03f('0x12')][_0xa03f('0x13')]);return _0x190272(_0x38ee92[_0xa03f('0x12')][_0xa03f('0x13')]);}else{logger[_0xa03f('0xd')](_0xa03f('0xe'),_0x59c2d9,_0xa03f('0xf'));_0x190272(_0x38ee92[_0xa03f('0x14')][_0xa03f('0x13')]);}})[_0xa03f('0x15')](function(_0x5d60ab){logger[_0xa03f('0x12')](_0xa03f('0xe'),_0x59c2d9,_0x5d60ab);_0x112063(_0x5d60ab);});});}exports[_0xa03f('0x16')]=function(_0x1eed43){var _0x4880c8=this;return new Promise(function(_0x1bbc17,_0xd210c3){return db['VoiceCallReport']['findAll']({'raw':_0x1eed43[_0xa03f('0x17')]?_0x1eed43['options'][_0xa03f('0x18')]===undefined?!![]:![]:!![],'where':_0x1eed43['options']?_0x1eed43[_0xa03f('0x17')]['where']||null:null,'attributes':_0x1eed43[_0xa03f('0x17')]?_0x1eed43['options'][_0xa03f('0x19')]||null:null,'limit':_0x1eed43[_0xa03f('0x17')]?_0x1eed43[_0xa03f('0x17')][_0xa03f('0x1a')]||null:null,'include':_0x1eed43[_0xa03f('0x17')]?_0x1eed43['options'][_0xa03f('0x1b')]?_[_0xa03f('0x1c')](_0x1eed43[_0xa03f('0x17')][_0xa03f('0x1b')],function(_0x358012){return{'model':db[_0x358012[_0xa03f('0x1d')]],'as':_0x358012['as'],'attributes':_0x358012[_0xa03f('0x19')],'include':_0x358012[_0xa03f('0x1b')]?_[_0xa03f('0x1c')](_0x358012['include'],function(_0x464502){return{'model':db[_0x464502[_0xa03f('0x1d')]],'as':_0x464502['as'],'attributes':_0x464502[_0xa03f('0x19')],'include':_0x464502[_0xa03f('0x1b')]?_[_0xa03f('0x1c')](_0x464502[_0xa03f('0x1b')],function(_0x118bce){return{'model':db[_0x118bce['model']],'as':_0x118bce['as'],'attributes':_0x118bce[_0xa03f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa03f('0xc')](function(_0x351d1d){logger[_0xa03f('0xd')]('GetVoiceCallReport',_0x1eed43);logger[_0xa03f('0x10')](_0xa03f('0x16'),_0x1eed43,JSON[_0xa03f('0x1e')](_0x351d1d));_0x1bbc17(_0x351d1d);})['catch'](function(_0x16e8cc){logger['error']('GetVoiceCallReport',_0x16e8cc[_0xa03f('0x13')],_0x1eed43);_0xd210c3(_0x4880c8[_0xa03f('0x12')](0x1f4,_0x16e8cc[_0xa03f('0x13')]));});});};exports[_0xa03f('0x1f')]=function(_0x5294a3){var _0x1790fd=this;return new Promise(function(_0x4f0ef6,_0xd25458){return db[_0xa03f('0x20')][_0xa03f('0x21')](_0x5294a3[_0xa03f('0x22')],{'raw':_0x5294a3[_0xa03f('0x17')]?_0x5294a3[_0xa03f('0x17')][_0xa03f('0x18')]===undefined?!![]:![]:!![]})[_0xa03f('0xc')](function(_0x51ca4e){logger[_0xa03f('0xd')](_0xa03f('0x1f'),_0x5294a3);logger[_0xa03f('0x10')](_0xa03f('0x1f'),_0x5294a3,JSON[_0xa03f('0x1e')](_0x51ca4e));_0x4f0ef6(_0x51ca4e);})[_0xa03f('0x15')](function(_0x501cb3){logger[_0xa03f('0x12')]('CreateVoiceCallReport',_0x501cb3['message'],_0x5294a3);_0xd25458(_0x1790fd[_0xa03f('0x12')](0x1f4,_0x501cb3[_0xa03f('0x13')]));});});};exports[_0xa03f('0x23')]=function(_0x3c78cd){var _0x28dfd9=this;return new Promise(function(_0x177470,_0x233bf3){return db['VoiceCallReport'][_0xa03f('0x24')](_0x3c78cd['body'],{'raw':_0x3c78cd[_0xa03f('0x17')]?_0x3c78cd['options'][_0xa03f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c78cd[_0xa03f('0x17')]?_0x3c78cd[_0xa03f('0x17')]['where']||null:null,'attributes':_0x3c78cd[_0xa03f('0x17')]?_0x3c78cd[_0xa03f('0x17')][_0xa03f('0x19')]||null:null,'limit':_0x3c78cd['options']?_0x3c78cd[_0xa03f('0x17')]['limit']||null:null})[_0xa03f('0xc')](function(_0x4911ca){logger[_0xa03f('0xd')](_0xa03f('0x23'),_0x3c78cd);logger[_0xa03f('0x10')](_0xa03f('0x23'),_0x3c78cd,JSON['stringify'](_0x4911ca));_0x177470(_0x4911ca);})[_0xa03f('0x15')](function(_0x3a66c1){logger[_0xa03f('0x12')](_0xa03f('0x23'),_0x3a66c1[_0xa03f('0x13')],_0x3c78cd);_0x233bf3(_0x28dfd9[_0xa03f('0x12')](0x1f4,_0x3a66c1[_0xa03f('0x13')]));});});}; \ No newline at end of file +var _0x51eb=['request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','options','raw','where','attributes','include','model','map','catch','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x424a87,_0xac702c){var _0x4d22eb=function(_0xc32dec){while(--_0xc32dec){_0x424a87['push'](_0x424a87['shift']());}};_0x4d22eb(++_0xac702c);}(_0x51eb,0x14b));var _0xb51e=function(_0x282b54,_0x316738){_0x282b54=_0x282b54-0x0;var _0x3bd3e9=_0x51eb[_0x282b54];return _0x3bd3e9;};'use strict';var _=require(_0xb51e('0x0'));var util=require(_0xb51e('0x1'));var moment=require(_0xb51e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb51e('0x3'))['db'];var utils=require(_0xb51e('0x4'));var logger=require(_0xb51e('0x5'))(_0xb51e('0x6'));var config=require(_0xb51e('0x7'));var jayson=require(_0xb51e('0x8'));var client=jayson[_0xb51e('0x9')][_0xb51e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d59dc,_0x3a497f,_0x4014c2){return new BPromise(function(_0x35cd4f,_0x54743a){return client[_0xb51e('0xb')](_0x4d59dc,_0x4014c2)[_0xb51e('0xc')](function(_0x78ea3f){logger[_0xb51e('0xd')](_0xb51e('0xe'),_0x3a497f,_0xb51e('0xf'));logger[_0xb51e('0x10')](_0xb51e('0x11'),_0x3a497f,_0xb51e('0xf'),JSON[_0xb51e('0x12')](_0x78ea3f));if(_0x78ea3f[_0xb51e('0x13')]){if(_0x78ea3f[_0xb51e('0x13')][_0xb51e('0x14')]===0x1f4){logger[_0xb51e('0x13')](_0xb51e('0xe'),_0x3a497f,_0x78ea3f['error']['message']);return _0x54743a(_0x78ea3f[_0xb51e('0x13')][_0xb51e('0x15')]);}logger[_0xb51e('0x13')](_0xb51e('0xe'),_0x3a497f,_0x78ea3f['error'][_0xb51e('0x15')]);return _0x35cd4f(_0x78ea3f[_0xb51e('0x13')][_0xb51e('0x15')]);}else{logger[_0xb51e('0xd')](_0xb51e('0xe'),_0x3a497f,_0xb51e('0xf'));_0x35cd4f(_0x78ea3f[_0xb51e('0x16')][_0xb51e('0x15')]);}})['catch'](function(_0xc3238){logger[_0xb51e('0x13')](_0xb51e('0xe'),_0x3a497f,_0xc3238);_0x54743a(_0xc3238);});});}exports[_0xb51e('0x17')]=function(_0x3a2520){var _0x3d52a4=this;return new Promise(function(_0x30d7be,_0x2160a1){return db['VoiceCallReport']['findAll']({'raw':_0x3a2520[_0xb51e('0x18')]?_0x3a2520[_0xb51e('0x18')][_0xb51e('0x19')]===undefined?!![]:![]:!![],'where':_0x3a2520[_0xb51e('0x18')]?_0x3a2520[_0xb51e('0x18')][_0xb51e('0x1a')]||null:null,'attributes':_0x3a2520['options']?_0x3a2520['options'][_0xb51e('0x1b')]||null:null,'limit':_0x3a2520[_0xb51e('0x18')]?_0x3a2520[_0xb51e('0x18')]['limit']||null:null,'include':_0x3a2520[_0xb51e('0x18')]?_0x3a2520['options'][_0xb51e('0x1c')]?_['map'](_0x3a2520[_0xb51e('0x18')]['include'],function(_0x4c11b0){return{'model':db[_0x4c11b0[_0xb51e('0x1d')]],'as':_0x4c11b0['as'],'attributes':_0x4c11b0['attributes'],'include':_0x4c11b0[_0xb51e('0x1c')]?_[_0xb51e('0x1e')](_0x4c11b0[_0xb51e('0x1c')],function(_0x4f9fda){return{'model':db[_0x4f9fda[_0xb51e('0x1d')]],'as':_0x4f9fda['as'],'attributes':_0x4f9fda[_0xb51e('0x1b')],'include':_0x4f9fda[_0xb51e('0x1c')]?_[_0xb51e('0x1e')](_0x4f9fda['include'],function(_0xde839b){return{'model':db[_0xde839b[_0xb51e('0x1d')]],'as':_0xde839b['as'],'attributes':_0xde839b[_0xb51e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb51e('0xc')](function(_0x4eb3b2){logger['info']('GetVoiceCallReport',_0x3a2520);logger[_0xb51e('0x10')](_0xb51e('0x17'),_0x3a2520,JSON[_0xb51e('0x12')](_0x4eb3b2));_0x30d7be(_0x4eb3b2);})[_0xb51e('0x1f')](function(_0x3c6767){logger[_0xb51e('0x13')](_0xb51e('0x17'),_0x3c6767['message'],_0x3a2520);_0x2160a1(_0x3d52a4['error'](0x1f4,_0x3c6767['message']));});});};exports[_0xb51e('0x20')]=function(_0x3e8cb7){var _0x5201f=this;return new Promise(function(_0x3e64b6,_0x365d7e){return db[_0xb51e('0x21')][_0xb51e('0x22')](_0x3e8cb7[_0xb51e('0x23')],{'raw':_0x3e8cb7[_0xb51e('0x18')]?_0x3e8cb7['options']['raw']===undefined?!![]:![]:!![]})[_0xb51e('0xc')](function(_0x2032c0){logger[_0xb51e('0xd')]('CreateVoiceCallReport',_0x3e8cb7);logger['debug']('CreateVoiceCallReport',_0x3e8cb7,JSON[_0xb51e('0x12')](_0x2032c0));_0x3e64b6(_0x2032c0);})[_0xb51e('0x1f')](function(_0xbd2b71){logger['error'](_0xb51e('0x20'),_0xbd2b71[_0xb51e('0x15')],_0x3e8cb7);_0x365d7e(_0x5201f[_0xb51e('0x13')](0x1f4,_0xbd2b71[_0xb51e('0x15')]));});});};exports[_0xb51e('0x24')]=function(_0x1235df){var _0x1836a8=this;return new Promise(function(_0x169bd0,_0x3aab0a){return db[_0xb51e('0x21')][_0xb51e('0x25')](_0x1235df[_0xb51e('0x23')],{'raw':_0x1235df[_0xb51e('0x18')]?_0x1235df[_0xb51e('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1235df[_0xb51e('0x18')]?_0x1235df[_0xb51e('0x18')]['where']||null:null,'attributes':_0x1235df['options']?_0x1235df[_0xb51e('0x18')][_0xb51e('0x1b')]||null:null,'limit':_0x1235df[_0xb51e('0x18')]?_0x1235df['options']['limit']||null:null})[_0xb51e('0xc')](function(_0x2b6ab8){logger[_0xb51e('0xd')](_0xb51e('0x24'),_0x1235df);logger[_0xb51e('0x10')](_0xb51e('0x24'),_0x1235df,JSON['stringify'](_0x2b6ab8));_0x169bd0(_0x2b6ab8);})[_0xb51e('0x1f')](function(_0x2a6b88){logger[_0xb51e('0x13')]('UpdateVoiceCallReport',_0x2a6b88[_0xb51e('0x15')],_0x1235df);_0x3aab0a(_0x1836a8[_0xb51e('0x13')](0x1f4,_0x2a6b88['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 8b1d95f..57e34cd 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 _0x1c45=['isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','./voiceChanSpy.controller','get','index','/:id'];(function(_0x73301c,_0x3fd870){var _0x1f357b=function(_0x42e027){while(--_0x42e027){_0x73301c['push'](_0x73301c['shift']());}};_0x1f357b(++_0x3fd870);}(_0x1c45,0x7f));var _0x51c4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c45[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x51c4('0x0'));var util=require(_0x51c4('0x1'));var path=require(_0x51c4('0x2'));var timeout=require(_0x51c4('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x51c4('0x4'));router[_0x51c4('0x5')]('/',auth['isAuthenticated'](),controller[_0x51c4('0x6')]);router[_0x51c4('0x5')](_0x51c4('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x51c4('0x8')](),controller[_0x51c4('0x9')]);router[_0x51c4('0xa')](_0x51c4('0x7'),auth['isAuthenticated'](),controller[_0x51c4('0xb')]);router[_0x51c4('0xc')](_0x51c4('0x7'),auth[_0x51c4('0x8')](),controller[_0x51c4('0xd')]);module[_0x51c4('0xe')]=router; \ No newline at end of file +var _0xd9c8=['post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated'];(function(_0x29d705,_0x516c4c){var _0x3c4627=function(_0x2ad887){while(--_0x2ad887){_0x29d705['push'](_0x29d705['shift']());}};_0x3c4627(++_0x516c4c);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd9c8[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var path=require('path');var timeout=require(_0x8d9c('0x2'));var express=require(_0x8d9c('0x3'));var router=express[_0x8d9c('0x4')]();var auth=require(_0x8d9c('0x5'));var interaction=require(_0x8d9c('0x6'));var config=require(_0x8d9c('0x7'));var controller=require(_0x8d9c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8d9c('0x9')](_0x8d9c('0xa'),auth[_0x8d9c('0xb')](),controller['show']);router[_0x8d9c('0xc')]('/',auth[_0x8d9c('0xb')](),controller[_0x8d9c('0xd')]);router[_0x8d9c('0xe')](_0x8d9c('0xa'),auth[_0x8d9c('0xb')](),controller[_0x8d9c('0xf')]);router[_0x8d9c('0x10')]('/:id',auth[_0x8d9c('0xb')](),controller['destroy']);module[_0x8d9c('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 5ba6d03..448ff60 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 _0xb13e=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','getDataValue','options','split'];(function(_0xf7379b,_0x44ec77){var _0x96a568=function(_0x496b79){while(--_0x496b79){_0xf7379b['push'](_0xf7379b['shift']());}};_0x96a568(++_0x44ec77);}(_0xb13e,0xa3));var _0xeb13=function(_0x3846b9,_0x495363){_0x3846b9=_0x3846b9-0x0;var _0x5b7a18=_0xb13e[_0x3846b9];return _0x5b7a18;};'use strict';var Sequelize=require(_0xeb13('0x0'));module[_0xeb13('0x1')]={'name':{'type':Sequelize[_0xeb13('0x2')]},'prefix':{'type':Sequelize[_0xeb13('0x2')],'unique':_0xeb13('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xeb13('0x2')],'set':function(_0x536176){this[_0xeb13('0x4')]('options',_0x536176?_0x536176['join'](''):[]);},'get':function(){return this[_0xeb13('0x5')](_0xeb13('0x6'))?this[_0xeb13('0x5')](_0xeb13('0x6'))[_0xeb13('0x7')](''):[];}},'auth':{'type':Sequelize[_0xeb13('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xeb13('0x2')]},'record':{'type':Sequelize[_0xeb13('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb13('0x2')]}}; \ No newline at end of file +var _0xdf3e=['exports','STRING','name','getDataValue','options','BOOLEAN'];(function(_0x2d3711,_0x43d60d){var _0x477858=function(_0x4ffb1c){while(--_0x4ffb1c){_0x2d3711['push'](_0x2d3711['shift']());}};_0x477858(++_0x43d60d);}(_0xdf3e,0x72));var _0xedf3=function(_0x2886ff,_0x11e08f){_0x2886ff=_0x2886ff-0x0;var _0x19f515=_0xdf3e[_0x2886ff];return _0x19f515;};'use strict';var Sequelize=require('sequelize');module[_0xedf3('0x0')]={'name':{'type':Sequelize[_0xedf3('0x1')]},'prefix':{'type':Sequelize[_0xedf3('0x1')],'unique':_0xedf3('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xedf3('0x1')],'set':function(_0x3c84b5){this['setDataValue']('options',_0x3c84b5?_0x3c84b5['join'](''):[]);},'get':function(){return this[_0xedf3('0x3')](_0xedf3('0x4'))?this[_0xedf3('0x3')]('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xedf3('0x1')]},'record':{'type':Sequelize[_0xedf3('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xedf3('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a240ab5..8b6fcdf 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 _0xe08a=['fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','VoiceChanSpy','count','includeAll','include','catch','params','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','html-pdf','rimraf','zip-dir'];(function(_0x46ceb8,_0x59f368){var _0x4b109d=function(_0x5ddc47){while(--_0x5ddc47){_0x46ceb8['push'](_0x46ceb8['shift']());}};_0x4b109d(++_0x59f368);}(_0xe08a,0x1ef));var _0xae08=function(_0x443777,_0x2d05ef){_0x443777=_0x443777-0x0;var _0x2a4b6b=_0xe08a[_0x443777];return _0x2a4b6b;};'use strict';var pdf=require(_0xae08('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xae08('0x1'));var zipdir=require(_0xae08('0x2'));var jsonpatch=require(_0xae08('0x3'));var rp=require(_0xae08('0x4'));var moment=require(_0xae08('0x5'));var BPromise=require(_0xae08('0x6'));var Mustache=require('mustache');var util=require(_0xae08('0x7'));var path=require('path');var sox=require(_0xae08('0x8'));var csv=require(_0xae08('0x9'));var ejs=require(_0xae08('0xa'));var fs=require('fs');var _=require(_0xae08('0xb'));var squel=require(_0xae08('0xc'));var crypto=require('crypto');var jsforce=require(_0xae08('0xd'));var deskjs=require(_0xae08('0xe'));var toCsv=require(_0xae08('0x9'));var querystring=require(_0xae08('0xf'));var Papa=require(_0xae08('0x10'));var Redis=require('ioredis');var authService=require(_0xae08('0x11'));var qs=require(_0xae08('0x12'));var as=require(_0xae08('0x13'));var hardwareService=require(_0xae08('0x14'));var logger=require('../../config/logger')(_0xae08('0x15'));var utils=require(_0xae08('0x16'));var config=require(_0xae08('0x17'));var db=require(_0xae08('0x18'))['db'];function respondWithStatusCode(_0x34c06e,_0x46ead4){_0x46ead4=_0x46ead4||0xcc;return function(_0x307754){if(_0x307754){return _0x34c06e['sendStatus'](_0x46ead4);}return _0x34c06e['status'](_0x46ead4)[_0xae08('0x19')]();};}function respondWithResult(_0x3bec94,_0x2e9765){_0x2e9765=_0x2e9765||0xc8;return function(_0x12436f){if(_0x12436f){return _0x3bec94[_0xae08('0x1a')](_0x2e9765)[_0xae08('0x1b')](_0x12436f);}};}function respondWithFilteredResult(_0x42d400,_0x5ddf8b){return function(_0x5c7412){if(_0x5c7412){var _0x332bd7=_0x5c7412['count'],_0x411ca1=_0x5ddf8b[_0xae08('0x1c')],_0x3662af=_0x5ddf8b[_0xae08('0x1c')]+_0x5ddf8b[_0xae08('0x1d')],_0x287b99;if(_0x3662af>=_0x332bd7){_0x3662af=_0x332bd7;_0x287b99=0xc8;}else{_0x287b99=0xce;}_0x42d400[_0xae08('0x1a')](_0x287b99);return _0x42d400[_0xae08('0x1e')](_0xae08('0x1f'),_0x411ca1+'-'+_0x3662af+'/'+_0x332bd7)[_0xae08('0x1b')](_0x5c7412);}return null;};}function patchUpdates(_0x3e6a7b){return function(_0x3582dc){try{jsonpatch[_0xae08('0x20')](_0x3582dc,_0x3e6a7b,!![]);}catch(_0x11bcbc){return BPromise[_0xae08('0x21')](_0x11bcbc);}return _0x3582dc[_0xae08('0x22')]();};}function saveUpdates(_0x123a2b,_0x1f6095){return function(_0x4b35bc){if(_0x4b35bc){return _0x4b35bc[_0xae08('0x23')](_0x123a2b)['then'](function(_0x335ef1){return _0x335ef1;});}return null;};}function removeEntity(_0x5a711b,_0x10d4f5){return function(_0x3f00f3){if(_0x3f00f3){return _0x3f00f3[_0xae08('0x24')]()[_0xae08('0x25')](function(){var _0x32e950=_0x3f00f3[_0xae08('0x26')]({'plain':!![]});var _0x2dbbcd=_0xae08('0x27');return db[_0xae08('0x28')][_0xae08('0x24')]({'where':{'type':_0x2dbbcd,'resourceId':_0x32e950['id']}})[_0xae08('0x25')](function(){return _0x3f00f3;});})[_0xae08('0x25')](function(){_0x5a711b['status'](0xcc)[_0xae08('0x19')]();});}};}function handleEntityNotFound(_0x53eb8c,_0x21061f){return function(_0x4bea21){if(!_0x4bea21){_0x53eb8c[_0xae08('0x29')](0x194);}return _0x4bea21;};}function handleError(_0x405666,_0x3ab1bc){_0x3ab1bc=_0x3ab1bc||0x1f4;return function(_0x16d8c7){logger[_0xae08('0x2a')](_0x16d8c7[_0xae08('0x2b')]);if(_0x16d8c7[_0xae08('0x2c')]){delete _0x16d8c7['name'];}_0x405666[_0xae08('0x1a')](_0x3ab1bc)[_0xae08('0x2d')](_0x16d8c7);};}exports[_0xae08('0x2e')]=function(_0x74a0d3,_0x41bd3c){var _0x3b40a2={},_0x1c7639={},_0x38d04b={'count':0x0,'rows':[]};var _0x1f93f9=_['map'](db['VoiceChanSpy'][_0xae08('0x2f')],function(_0x1f8b01){return{'name':_0x1f8b01['fieldName'],'type':_0x1f8b01[_0xae08('0x30')][_0xae08('0x31')]};});_0x1c7639[_0xae08('0x32')]=_[_0xae08('0x33')](_0x1f93f9,_0xae08('0x2c'));_0x1c7639[_0xae08('0x34')]=_[_0xae08('0x35')](_0x74a0d3[_0xae08('0x34')]);_0x1c7639['filters']=_['intersection'](_0x1c7639[_0xae08('0x32')],_0x1c7639[_0xae08('0x34')]);_0x3b40a2['attributes']=_[_0xae08('0x36')](_0x1c7639[_0xae08('0x32')],qs[_0xae08('0x37')](_0x74a0d3['query'][_0xae08('0x37')]));_0x3b40a2[_0xae08('0x38')]=_0x3b40a2[_0xae08('0x38')][_0xae08('0x39')]?_0x3b40a2[_0xae08('0x38')]:_0x1c7639[_0xae08('0x32')];if(!_0x74a0d3['query']['hasOwnProperty'](_0xae08('0x3a'))){_0x3b40a2['limit']=qs[_0xae08('0x1d')](_0x74a0d3[_0xae08('0x34')][_0xae08('0x1d')]);_0x3b40a2['offset']=qs[_0xae08('0x1c')](_0x74a0d3[_0xae08('0x34')][_0xae08('0x1c')]);}_0x3b40a2[_0xae08('0x3b')]=qs[_0xae08('0x3c')](_0x74a0d3[_0xae08('0x34')][_0xae08('0x3c')]);_0x3b40a2[_0xae08('0x3d')]=qs[_0xae08('0x3e')](_['pick'](_0x74a0d3[_0xae08('0x34')],_0x1c7639[_0xae08('0x3e')]),_0x1f93f9);if(_0x74a0d3[_0xae08('0x34')]['filter']){_0x3b40a2['where']=_[_0xae08('0x3f')](_0x3b40a2[_0xae08('0x3d')],{'$or':_[_0xae08('0x33')](_0x1f93f9,function(_0x257ac7){if(_0x257ac7['type']!==_0xae08('0x40')){var _0x1ae05a={};_0x1ae05a[_0x257ac7['name']]={'$like':'%'+_0x74a0d3[_0xae08('0x34')][_0xae08('0x41')]+'%'};return _0x1ae05a;}})});}_0x3b40a2=_['merge']({},_0x3b40a2,_0x74a0d3[_0xae08('0x42')]);var _0x34931e={'where':_0x3b40a2[_0xae08('0x3d')]};return db[_0xae08('0x43')][_0xae08('0x44')](_0x34931e)[_0xae08('0x25')](function(_0x9e3a59){_0x38d04b['count']=_0x9e3a59;if(_0x74a0d3[_0xae08('0x34')][_0xae08('0x45')]){_0x3b40a2[_0xae08('0x46')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3b40a2);})['then'](function(_0x2d8a43){_0x38d04b['rows']=_0x2d8a43;return _0x38d04b;})[_0xae08('0x25')](respondWithFilteredResult(_0x41bd3c,_0x3b40a2))[_0xae08('0x47')](handleError(_0x41bd3c,null));};exports['show']=function(_0x457e9a,_0xdf19d3){var _0x2076ab={'raw':![],'where':{'id':_0x457e9a[_0xae08('0x48')]['id']}},_0x17bf31={};_0x17bf31[_0xae08('0x32')]=_[_0xae08('0x35')](db[_0xae08('0x43')][_0xae08('0x2f')]);_0x17bf31['query']=_[_0xae08('0x35')](_0x457e9a['query']);_0x17bf31[_0xae08('0x3e')]=_[_0xae08('0x36')](_0x17bf31[_0xae08('0x32')],_0x17bf31[_0xae08('0x34')]);_0x2076ab['attributes']=_[_0xae08('0x36')](_0x17bf31[_0xae08('0x32')],qs[_0xae08('0x37')](_0x457e9a[_0xae08('0x34')][_0xae08('0x37')]));_0x2076ab[_0xae08('0x38')]=_0x2076ab[_0xae08('0x38')]['length']?_0x2076ab[_0xae08('0x38')]:_0x17bf31[_0xae08('0x32')];if(_0x457e9a[_0xae08('0x34')][_0xae08('0x45')]){_0x2076ab[_0xae08('0x46')]=[{'all':!![]}];}_0x2076ab=_[_0xae08('0x3f')]({},_0x2076ab,_0x457e9a['options']);return db[_0xae08('0x43')][_0xae08('0x49')](_0x2076ab)[_0xae08('0x25')](handleEntityNotFound(_0xdf19d3,null))[_0xae08('0x25')](respondWithResult(_0xdf19d3,null))[_0xae08('0x47')](handleError(_0xdf19d3,null));};exports[_0xae08('0x4a')]=function(_0x58b623,_0x3f1735){return db[_0xae08('0x43')][_0xae08('0x4a')](_0x58b623[_0xae08('0x4b')],{})[_0xae08('0x25')](function(_0x2cd2f0){var _0x355881=_0x58b623[_0xae08('0x4c')]['get']({'plain':!![]});if(!_0x355881)throw new Error(_0xae08('0x4d'));if(_0x355881[_0xae08('0x4e')]===_0xae08('0x4c')){var _0x45aee5=_0x2cd2f0[_0xae08('0x26')]({'plain':!![]});var _0x1d077f=_0xae08('0x27');return db[_0xae08('0x4f')][_0xae08('0x49')]({'where':{'name':_0x1d077f,'userProfileId':_0x355881[_0xae08('0x50')]},'raw':!![]})[_0xae08('0x25')](function(_0x2a5bdb){if(_0x2a5bdb&&_0x2a5bdb[_0xae08('0x51')]===0x0){return db[_0xae08('0x28')]['create']({'name':_0x45aee5[_0xae08('0x2c')],'resourceId':_0x45aee5['id'],'type':_0x2a5bdb[_0xae08('0x2c')],'sectionId':_0x2a5bdb['id']},{})[_0xae08('0x25')](function(){return _0x2cd2f0;});}else{return _0x2cd2f0;}})[_0xae08('0x47')](function(_0x493d4c){logger['error'](_0xae08('0x52'),_0x493d4c);throw _0x493d4c;});}return _0x2cd2f0;})[_0xae08('0x25')](respondWithResult(_0x3f1735,0xc9))[_0xae08('0x47')](handleError(_0x3f1735,null));};exports[_0xae08('0x23')]=function(_0x17375f,_0x6855ff){if(_0x17375f[_0xae08('0x4b')]['id']){delete _0x17375f['body']['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x17375f['params']['id']}})[_0xae08('0x25')](handleEntityNotFound(_0x6855ff,null))[_0xae08('0x25')](saveUpdates(_0x17375f[_0xae08('0x4b')],null))[_0xae08('0x25')](respondWithResult(_0x6855ff,null))[_0xae08('0x47')](handleError(_0x6855ff,null));};exports['destroy']=function(_0x4b881c,_0x124cee){return db[_0xae08('0x43')][_0xae08('0x49')]({'where':{'id':_0x4b881c[_0xae08('0x48')]['id']}})[_0xae08('0x25')](handleEntityNotFound(_0x124cee,null))['then'](removeEntity(_0x124cee,null))[_0xae08('0x47')](handleError(_0x124cee,null));}; \ No newline at end of file +var _0xe925=['VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type'];(function(_0x44a970,_0x2b9f20){var _0x71c8e0=function(_0xd7d3c5){while(--_0xd7d3c5){_0x44a970['push'](_0x44a970['shift']());}};_0x71c8e0(++_0x2b9f20);}(_0xe925,0x111));var _0x5e92=function(_0x2ed90a,_0x41e450){_0x2ed90a=_0x2ed90a-0x0;var _0x3b7481=_0xe925[_0x2ed90a];return _0x3b7481;};'use strict';var pdf=require(_0x5e92('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5e92('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5e92('0x2'));var moment=require(_0x5e92('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5e92('0x4'));var util=require(_0x5e92('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5e92('0x6'));var ejs=require(_0x5e92('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5e92('0x8'));var crypto=require(_0x5e92('0x9'));var jsforce=require(_0x5e92('0xa'));var deskjs=require(_0x5e92('0xb'));var toCsv=require(_0x5e92('0x6'));var querystring=require(_0x5e92('0xc'));var Papa=require(_0x5e92('0xd'));var Redis=require(_0x5e92('0xe'));var authService=require(_0x5e92('0xf'));var qs=require(_0x5e92('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e92('0x11'));var logger=require(_0x5e92('0x12'))('api');var utils=require(_0x5e92('0x13'));var config=require(_0x5e92('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9db9f,_0xc84529){_0xc84529=_0xc84529||0xcc;return function(_0x542eb0){if(_0x542eb0){return _0x9db9f[_0x5e92('0x15')](_0xc84529);}return _0x9db9f[_0x5e92('0x16')](_0xc84529)[_0x5e92('0x17')]();};}function respondWithResult(_0x1e9219,_0x3c0d76){_0x3c0d76=_0x3c0d76||0xc8;return function(_0x19ce52){if(_0x19ce52){return _0x1e9219['status'](_0x3c0d76)['json'](_0x19ce52);}};}function respondWithFilteredResult(_0x3615b0,_0x3de705){return function(_0x11bb6f){if(_0x11bb6f){var _0x231565=_0x11bb6f[_0x5e92('0x18')],_0x373723=_0x3de705[_0x5e92('0x19')],_0x213ea8=_0x3de705[_0x5e92('0x19')]+_0x3de705['limit'],_0x51150c;if(_0x213ea8>=_0x231565){_0x213ea8=_0x231565;_0x51150c=0xc8;}else{_0x51150c=0xce;}_0x3615b0['status'](_0x51150c);return _0x3615b0[_0x5e92('0x1a')](_0x5e92('0x1b'),_0x373723+'-'+_0x213ea8+'/'+_0x231565)[_0x5e92('0x1c')](_0x11bb6f);}return null;};}function patchUpdates(_0x12765a){return function(_0x372e2d){try{jsonpatch[_0x5e92('0x1d')](_0x372e2d,_0x12765a,!![]);}catch(_0x264127){return BPromise[_0x5e92('0x1e')](_0x264127);}return _0x372e2d[_0x5e92('0x1f')]();};}function saveUpdates(_0x2b972e,_0xf0ac3e){return function(_0x166489){if(_0x166489){return _0x166489[_0x5e92('0x20')](_0x2b972e)[_0x5e92('0x21')](function(_0x54e5cd){return _0x54e5cd;});}return null;};}function removeEntity(_0x4b14eb,_0x1c6504){return function(_0x510ce2){if(_0x510ce2){return _0x510ce2[_0x5e92('0x22')]()[_0x5e92('0x21')](function(){var _0x43df91=_0x510ce2[_0x5e92('0x23')]({'plain':!![]});var _0x2a9523='ChanSpies';return db[_0x5e92('0x24')][_0x5e92('0x22')]({'where':{'type':_0x2a9523,'resourceId':_0x43df91['id']}})[_0x5e92('0x21')](function(){return _0x510ce2;});})[_0x5e92('0x21')](function(){_0x4b14eb['status'](0xcc)[_0x5e92('0x17')]();});}};}function handleEntityNotFound(_0x555308,_0x38417d){return function(_0x461e5f){if(!_0x461e5f){_0x555308[_0x5e92('0x15')](0x194);}return _0x461e5f;};}function handleError(_0x24559a,_0x1fe9a9){_0x1fe9a9=_0x1fe9a9||0x1f4;return function(_0x3225b8){logger[_0x5e92('0x25')](_0x3225b8[_0x5e92('0x26')]);if(_0x3225b8[_0x5e92('0x27')]){delete _0x3225b8[_0x5e92('0x27')];}_0x24559a[_0x5e92('0x16')](_0x1fe9a9)[_0x5e92('0x28')](_0x3225b8);};}exports[_0x5e92('0x29')]=function(_0x5326f5,_0x4b7cba){var _0x55842e={},_0x5e1b5e={},_0x223b72={'count':0x0,'rows':[]};var _0x288ca9=_[_0x5e92('0x2a')](db[_0x5e92('0x2b')]['rawAttributes'],function(_0x1f9e42){return{'name':_0x1f9e42[_0x5e92('0x2c')],'type':_0x1f9e42['type'][_0x5e92('0x2d')]};});_0x5e1b5e['model']=_['map'](_0x288ca9,_0x5e92('0x27'));_0x5e1b5e[_0x5e92('0x2e')]=_['keys'](_0x5326f5['query']);_0x5e1b5e[_0x5e92('0x2f')]=_[_0x5e92('0x30')](_0x5e1b5e['model'],_0x5e1b5e[_0x5e92('0x2e')]);_0x55842e[_0x5e92('0x31')]=_['intersection'](_0x5e1b5e[_0x5e92('0x32')],qs[_0x5e92('0x33')](_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x33')]));_0x55842e[_0x5e92('0x31')]=_0x55842e[_0x5e92('0x31')][_0x5e92('0x34')]?_0x55842e[_0x5e92('0x31')]:_0x5e1b5e[_0x5e92('0x32')];if(!_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x35')](_0x5e92('0x36'))){_0x55842e[_0x5e92('0x37')]=qs[_0x5e92('0x37')](_0x5326f5[_0x5e92('0x2e')]['limit']);_0x55842e['offset']=qs[_0x5e92('0x19')](_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x19')]);}_0x55842e[_0x5e92('0x38')]=qs[_0x5e92('0x39')](_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x39')]);_0x55842e[_0x5e92('0x3a')]=qs['filters'](_[_0x5e92('0x3b')](_0x5326f5['query'],_0x5e1b5e[_0x5e92('0x2f')]),_0x288ca9);if(_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x3c')]){_0x55842e[_0x5e92('0x3a')]=_[_0x5e92('0x3d')](_0x55842e[_0x5e92('0x3a')],{'$or':_[_0x5e92('0x2a')](_0x288ca9,function(_0xd40682){if(_0xd40682[_0x5e92('0x3e')]!==_0x5e92('0x3f')){var _0x54e01c={};_0x54e01c[_0xd40682['name']]={'$like':'%'+_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x3c')]+'%'};return _0x54e01c;}})});}_0x55842e=_[_0x5e92('0x3d')]({},_0x55842e,_0x5326f5[_0x5e92('0x40')]);var _0x397917={'where':_0x55842e[_0x5e92('0x3a')]};return db[_0x5e92('0x2b')]['count'](_0x397917)['then'](function(_0x295671){_0x223b72[_0x5e92('0x18')]=_0x295671;if(_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x41')]){_0x55842e[_0x5e92('0x42')]=[{'all':!![]}];}return db[_0x5e92('0x2b')][_0x5e92('0x43')](_0x55842e);})['then'](function(_0x1fb209){_0x223b72[_0x5e92('0x44')]=_0x1fb209;return _0x223b72;})['then'](respondWithFilteredResult(_0x4b7cba,_0x55842e))['catch'](handleError(_0x4b7cba,null));};exports[_0x5e92('0x45')]=function(_0x547c90,_0x4eecde){var _0x18e560={'raw':![],'where':{'id':_0x547c90['params']['id']}},_0x2cdb51={};_0x2cdb51[_0x5e92('0x32')]=_[_0x5e92('0x46')](db[_0x5e92('0x2b')]['rawAttributes']);_0x2cdb51['query']=_[_0x5e92('0x46')](_0x547c90[_0x5e92('0x2e')]);_0x2cdb51[_0x5e92('0x2f')]=_['intersection'](_0x2cdb51[_0x5e92('0x32')],_0x2cdb51[_0x5e92('0x2e')]);_0x18e560[_0x5e92('0x31')]=_['intersection'](_0x2cdb51['model'],qs['fields'](_0x547c90[_0x5e92('0x2e')][_0x5e92('0x33')]));_0x18e560[_0x5e92('0x31')]=_0x18e560[_0x5e92('0x31')][_0x5e92('0x34')]?_0x18e560[_0x5e92('0x31')]:_0x2cdb51['model'];if(_0x547c90[_0x5e92('0x2e')]['includeAll']){_0x18e560[_0x5e92('0x42')]=[{'all':!![]}];}_0x18e560=_[_0x5e92('0x3d')]({},_0x18e560,_0x547c90['options']);return db['VoiceChanSpy'][_0x5e92('0x47')](_0x18e560)['then'](handleEntityNotFound(_0x4eecde,null))[_0x5e92('0x21')](respondWithResult(_0x4eecde,null))['catch'](handleError(_0x4eecde,null));};exports[_0x5e92('0x48')]=function(_0x4326a6,_0x2337f8){return db[_0x5e92('0x2b')][_0x5e92('0x48')](_0x4326a6[_0x5e92('0x49')],{})[_0x5e92('0x21')](function(_0x3228df){var _0x4f03ac=_0x4326a6['user']['get']({'plain':!![]});if(!_0x4f03ac)throw new Error(_0x5e92('0x4a'));if(_0x4f03ac[_0x5e92('0x4b')]===_0x5e92('0x4c')){var _0x1513da=_0x3228df[_0x5e92('0x23')]({'plain':!![]});var _0x51dadd=_0x5e92('0x4d');return db[_0x5e92('0x4e')][_0x5e92('0x47')]({'where':{'name':_0x51dadd,'userProfileId':_0x4f03ac[_0x5e92('0x4f')]},'raw':!![]})[_0x5e92('0x21')](function(_0x383bf1){if(_0x383bf1&&_0x383bf1[_0x5e92('0x50')]===0x0){return db[_0x5e92('0x24')]['create']({'name':_0x1513da[_0x5e92('0x27')],'resourceId':_0x1513da['id'],'type':_0x383bf1[_0x5e92('0x27')],'sectionId':_0x383bf1['id']},{})[_0x5e92('0x21')](function(){return _0x3228df;});}else{return _0x3228df;}})[_0x5e92('0x51')](function(_0x3b97a6){logger[_0x5e92('0x25')](_0x5e92('0x52'),_0x3b97a6);throw _0x3b97a6;});}return _0x3228df;})[_0x5e92('0x21')](respondWithResult(_0x2337f8,0xc9))[_0x5e92('0x51')](handleError(_0x2337f8,null));};exports[_0x5e92('0x20')]=function(_0x295c34,_0x49a43){if(_0x295c34[_0x5e92('0x49')]['id']){delete _0x295c34[_0x5e92('0x49')]['id'];}return db[_0x5e92('0x2b')]['find']({'where':{'id':_0x295c34[_0x5e92('0x53')]['id']}})[_0x5e92('0x21')](handleEntityNotFound(_0x49a43,null))[_0x5e92('0x21')](saveUpdates(_0x295c34[_0x5e92('0x49')],null))['then'](respondWithResult(_0x49a43,null))['catch'](handleError(_0x49a43,null));};exports[_0x5e92('0x22')]=function(_0x5b5ee5,_0x38b5f0){return db['VoiceChanSpy'][_0x5e92('0x47')]({'where':{'id':_0x5b5ee5[_0x5e92('0x53')]['id']}})[_0x5e92('0x21')](handleEntityNotFound(_0x38b5f0,null))[_0x5e92('0x21')](removeEntity(_0x38b5f0,null))[_0x5e92('0x51')](handleError(_0x38b5f0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 8172d55..9e41781 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 _0x4bcc=['record','StopMixMonitor','concat','internal','User','catch','exports','models','define','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','merge','Set','format','CDR(type)=%s','chanspy','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join'];(function(_0xa9293d,_0x320042){var _0x1890c8=function(_0x58d6a4){while(--_0x58d6a4){_0xa9293d['push'](_0xa9293d['shift']());}};_0x1890c8(++_0x320042);}(_0x4bcc,0x1a6));var _0xc4bc=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x4bcc[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xc4bc('0x0'));var util=require(_0xc4bc('0x1'));var BPromise=require(_0xc4bc('0x2'));var attributes=require(_0xc4bc('0x3'));var getUserApplications=function(_0x5a8454,_0xe9107f,_0x222c2b){var _0x5df112=0x1;var _0x28064a=[];var _0x2bcb80={'context':_0xe9107f['context']||_0xc4bc('0x4'),'exten':util['format'](_0xc4bc('0x5'),_0x5a8454['prefix'],_0x222c2b),'type':'system','isApp':![],'ChanSpyId':_0x5a8454['id'],'UserId':_0xe9107f['id']};_0x28064a['push'](_[_0xc4bc('0x6')]({'app':_0xc4bc('0x7'),'appdata':util[_0xc4bc('0x8')](_0xc4bc('0x9'),_0xc4bc('0xa')),'priority':_0x5df112++},_0x2bcb80));if(_0x5a8454['record']){_0x28064a[_0xc4bc('0xb')](_[_0xc4bc('0x6')]({'app':_0xc4bc('0xc'),'appdata':util['format'](_0xc4bc('0xd'),_0x5a8454['recordingFormat']),'priority':_0x5df112++},_0x2bcb80));}if(_0x5a8454[_0xc4bc('0xe')]){_0x28064a[_0xc4bc('0xb')](_[_0xc4bc('0x6')]({'app':_0xc4bc('0xf'),'appdata':_0x5a8454[_0xc4bc('0x10')],'priority':_0x5df112++},_0x2bcb80));}_0x28064a[_0xc4bc('0xb')](_['merge']({'app':_0xc4bc('0x11'),'appdata':util[_0xc4bc('0x8')](_0xc4bc('0x12'),_0xe9107f[_0xc4bc('0x13')],_0x5a8454[_0xc4bc('0x14')]?_0x5a8454['options'][_0xc4bc('0x15')](''):''),'priority':_0x5df112++},_0x2bcb80));if(_0x5a8454[_0xc4bc('0x16')]){_0x28064a[_0xc4bc('0xb')](_['merge']({'app':_0xc4bc('0x17'),'priority':_0x5df112++},_0x2bcb80));}return _0x28064a;};var getChanSpyApplications=function(_0x3c5b38,_0xcb204a){var _0x59223f=[];for(var _0x55ddb1=0x0,_0x1493cb=0x1;_0x55ddb1<_0xcb204a['length'];_0x55ddb1++,_0x1493cb=0x1){_0x59223f=_0x59223f[_0xc4bc('0x18')](getUserApplications(_0x3c5b38,_0xcb204a[_0x55ddb1],_0xcb204a[_0x55ddb1][_0xc4bc('0x19')]));if(_0xcb204a[_0x55ddb1][_0xc4bc('0x19')]!=_0xcb204a[_0x55ddb1][_0xc4bc('0x13')]){_0x59223f=_0x59223f[_0xc4bc('0x18')](getUserApplications(_0x3c5b38,_0xcb204a[_0x55ddb1],_0xcb204a[_0x55ddb1][_0xc4bc('0x13')]));}}return _0x59223f;};var getChanSpyPromise=function(_0x569928,_0x155002){return new BPromise(function(_0x2eea18,_0x16bd95){return _0x569928[_0xc4bc('0x1a')]['findAll']({'attributes':['id',_0xc4bc('0x13'),_0xc4bc('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x58b833){if(_0x58b833){return _0x2eea18(getChanSpyApplications(_0x155002,_0x58b833));}return _0x2eea18([]);})[_0xc4bc('0x1b')](function(_0x43df19){_0x16bd95(_0x43df19);});});};module[_0xc4bc('0x1c')]=function(_0x52a460,_0x2cd602){var _0x28f044=_0x52a460[_0xc4bc('0x1d')];return _0x52a460[_0xc4bc('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0xc4bc('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x403907,_0x102eb3,_0x19dfd5){return getChanSpyPromise(_0x28f044,_0x403907)[_0xc4bc('0x20')](function(_0x6da23e){if(_0x6da23e&&_0x6da23e[_0xc4bc('0x21')]){return _0x28f044[_0xc4bc('0x22')][_0xc4bc('0x23')](_0x6da23e);}})['then'](function(){_0x19dfd5();})[_0xc4bc('0x1b')](function(_0x40dad3){_0x19dfd5(_0x40dad3);});},'afterUpdate':function(_0xe8e49e,_0x283bd1,_0x96f97){return _0x28f044[_0xc4bc('0x22')][_0xc4bc('0x24')]({'where':{'ChanSpyId':_0xe8e49e['id']}})[_0xc4bc('0x20')](function(){return getChanSpyPromise(_0x28f044,_0xe8e49e);})['then'](function(_0x5431dc){if(_0x5431dc&&_0x5431dc[_0xc4bc('0x21')]){return _0x28f044['VoiceExtension'][_0xc4bc('0x23')](_0x5431dc);}})['then'](function(){_0x96f97();})[_0xc4bc('0x1b')](function(_0x111ab5){_0x96f97(_0x111ab5);});},'afterDestroy':function(_0x1604f1,_0x2c9f9b,_0x5e9520){return _0x28f044['VoiceExtension'][_0xc4bc('0x24')]({'where':{'ChanSpyId':_0x1604f1['id']}})['then'](function(){_0x5e9520();})[_0xc4bc('0x1b')](function(_0x56b6d0){_0x5e9520(_0x56b6d0);});}}});}; \ No newline at end of file +var _0xac4a=['auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','then','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','prefix','push','merge','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x1ce71c,_0x1f2369){var _0x38c215=function(_0x2777b7){while(--_0x2777b7){_0x1ce71c['push'](_0x1ce71c['shift']());}};_0x38c215(++_0x1f2369);}(_0xac4a,0x13f));var _0xaac4=function(_0x2cdd4c,_0x580c06){_0x2cdd4c=_0x2cdd4c-0x0;var _0xbc21c0=_0xac4a[_0x2cdd4c];return _0xbc21c0;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var BPromise=require(_0xaac4('0x2'));var attributes=require(_0xaac4('0x3'));var getUserApplications=function(_0x38f4f4,_0x1dc251,_0x5aeb7d){var _0x58626e=0x1;var _0x2af0f6=[];var _0x2a5762={'context':_0x1dc251[_0xaac4('0x4')]||'from-sip','exten':util[_0xaac4('0x5')]('%s%s',_0x38f4f4[_0xaac4('0x6')],_0x5aeb7d),'type':'system','isApp':![],'ChanSpyId':_0x38f4f4['id'],'UserId':_0x1dc251['id']};_0x2af0f6[_0xaac4('0x7')](_[_0xaac4('0x8')]({'app':'Set','appdata':util['format'](_0xaac4('0x9'),'chanspy'),'priority':_0x58626e++},_0x2a5762));if(_0x38f4f4[_0xaac4('0xa')]){_0x2af0f6['push'](_['merge']({'app':_0xaac4('0xb'),'appdata':util[_0xaac4('0x5')](_0xaac4('0xc'),_0x38f4f4[_0xaac4('0xd')]),'priority':_0x58626e++},_0x2a5762));}if(_0x38f4f4[_0xaac4('0xe')]){_0x2af0f6['push'](_['merge']({'app':_0xaac4('0xf'),'appdata':_0x38f4f4[_0xaac4('0x10')],'priority':_0x58626e++},_0x2a5762));}_0x2af0f6[_0xaac4('0x7')](_['merge']({'app':_0xaac4('0x11'),'appdata':util[_0xaac4('0x5')]('SIP/%s,%s',_0x1dc251[_0xaac4('0x12')],_0x38f4f4[_0xaac4('0x13')]?_0x38f4f4[_0xaac4('0x13')][_0xaac4('0x14')](''):''),'priority':_0x58626e++},_0x2a5762));if(_0x38f4f4[_0xaac4('0xa')]){_0x2af0f6[_0xaac4('0x7')](_[_0xaac4('0x8')]({'app':_0xaac4('0x15'),'priority':_0x58626e++},_0x2a5762));}return _0x2af0f6;};var getChanSpyApplications=function(_0x233278,_0xb8466e){var _0x35bc32=[];for(var _0x1766c2=0x0,_0x3f643c=0x1;_0x1766c2<_0xb8466e['length'];_0x1766c2++,_0x3f643c=0x1){_0x35bc32=_0x35bc32[_0xaac4('0x16')](getUserApplications(_0x233278,_0xb8466e[_0x1766c2],_0xb8466e[_0x1766c2]['internal']));if(_0xb8466e[_0x1766c2][_0xaac4('0x17')]!=_0xb8466e[_0x1766c2]['name']){_0x35bc32=_0x35bc32[_0xaac4('0x16')](getUserApplications(_0x233278,_0xb8466e[_0x1766c2],_0xb8466e[_0x1766c2][_0xaac4('0x12')]));}}return _0x35bc32;};var getChanSpyPromise=function(_0xa22b76,_0x271bcb){return new BPromise(function(_0x3cbcb1,_0x2f3deb){return _0xa22b76[_0xaac4('0x18')][_0xaac4('0x19')]({'attributes':['id',_0xaac4('0x12'),'internal'],'where':{'role':_0xaac4('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x3303f1){if(_0x3303f1){return _0x3cbcb1(getChanSpyApplications(_0x271bcb,_0x3303f1));}return _0x3cbcb1([]);})[_0xaac4('0x1b')](function(_0x43625c){_0x2f3deb(_0x43625c);});});};module[_0xaac4('0x1c')]=function(_0x17140f,_0x383a8c){var _0x590905=_0x17140f[_0xaac4('0x1d')];return _0x17140f[_0xaac4('0x1e')](_0xaac4('0x1f'),attributes,{'tableName':_0xaac4('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dd059,_0x2dcc59,_0xb2577b){return getChanSpyPromise(_0x590905,_0x3dd059)['then'](function(_0x24186b){if(_0x24186b&&_0x24186b['length']){return _0x590905['VoiceExtension']['bulkCreate'](_0x24186b);}})['then'](function(){_0xb2577b();})[_0xaac4('0x1b')](function(_0x17d25f){_0xb2577b(_0x17d25f);});},'afterUpdate':function(_0x22cda2,_0xe93120,_0x3c1445){return _0x590905[_0xaac4('0x21')][_0xaac4('0x22')]({'where':{'ChanSpyId':_0x22cda2['id']}})[_0xaac4('0x23')](function(){return getChanSpyPromise(_0x590905,_0x22cda2);})[_0xaac4('0x23')](function(_0x386c9b){if(_0x386c9b&&_0x386c9b['length']){return _0x590905[_0xaac4('0x21')][_0xaac4('0x24')](_0x386c9b);}})[_0xaac4('0x23')](function(){_0x3c1445();})[_0xaac4('0x1b')](function(_0x669b34){_0x3c1445(_0x669b34);});},'afterDestroy':function(_0x442b87,_0x5e469a,_0xcf6c1){return _0x590905['VoiceExtension'][_0xaac4('0x22')]({'where':{'ChanSpyId':_0x442b87['id']}})[_0xaac4('0x23')](function(){_0xcf6c1();})[_0xaac4('0x1b')](function(_0x2aaa68){_0xcf6c1(_0x2aaa68);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index d1c99b7..f3875c6 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 _0xca6e=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','result'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xca6e,0x12b));var _0xeca6=function(_0x34a05a,_0x3ae3e8){_0x34a05a=_0x34a05a-0x0;var _0x2e883f=_0xca6e[_0x34a05a];return _0x2e883f;};'use strict';var _=require(_0xeca6('0x0'));var util=require(_0xeca6('0x1'));var moment=require(_0xeca6('0x2'));var BPromise=require(_0xeca6('0x3'));var rs=require(_0xeca6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeca6('0x5'))['db'];var utils=require(_0xeca6('0x6'));var logger=require(_0xeca6('0x7'))(_0xeca6('0x8'));var config=require(_0xeca6('0x9'));var jayson=require(_0xeca6('0xa'));var client=jayson[_0xeca6('0xb')][_0xeca6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eb354,_0x4654ea,_0x280520){return new BPromise(function(_0x1566aa,_0x406dbb){return client[_0xeca6('0xd')](_0x5eb354,_0x280520)[_0xeca6('0xe')](function(_0x5504b2){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x4654ea,_0xeca6('0xf'));logger[_0xeca6('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4654ea,'request\x20sent',JSON[_0xeca6('0x11')](_0x5504b2));if(_0x5504b2[_0xeca6('0x12')]){if(_0x5504b2['error'][_0xeca6('0x13')]===0x1f4){logger[_0xeca6('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x4654ea,_0x5504b2[_0xeca6('0x12')][_0xeca6('0x14')]);return _0x406dbb(_0x5504b2['error']['message']);}logger[_0xeca6('0x12')](_0xeca6('0x15'),_0x4654ea,_0x5504b2[_0xeca6('0x12')]['message']);return _0x1566aa(_0x5504b2[_0xeca6('0x12')][_0xeca6('0x14')]);}else{logger['info'](_0xeca6('0x15'),_0x4654ea,_0xeca6('0xf'));_0x1566aa(_0x5504b2[_0xeca6('0x16')][_0xeca6('0x14')]);}})['catch'](function(_0x270546){logger['error'](_0xeca6('0x15'),_0x4654ea,_0x270546);_0x406dbb(_0x270546);});});} \ No newline at end of file +var _0xf268=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird'];(function(_0x186f69,_0x5def7c){var _0x23acec=function(_0x6e476c){while(--_0x6e476c){_0x186f69['push'](_0x186f69['shift']());}};_0x23acec(++_0x5def7c);}(_0xf268,0x123));var _0x8f26=function(_0x44d902,_0x376b4e){_0x44d902=_0x44d902-0x0;var _0x27aa72=_0xf268[_0x44d902];return _0x27aa72;};'use strict';var _=require(_0x8f26('0x0'));var util=require(_0x8f26('0x1'));var moment=require('moment');var BPromise=require(_0x8f26('0x2'));var rs=require(_0x8f26('0x3'));var fs=require('fs');var Redis=require(_0x8f26('0x4'));var db=require(_0x8f26('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f26('0x6'))(_0x8f26('0x7'));var config=require('../../config/environment');var jayson=require(_0x8f26('0x8'));var client=jayson['client'][_0x8f26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c75c0,_0x55b045,_0x39228c){return new BPromise(function(_0x5aa41e,_0x407cab){return client[_0x8f26('0xa')](_0x4c75c0,_0x39228c)[_0x8f26('0xb')](function(_0x3448d8){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x55b045,_0x8f26('0xc'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x55b045,_0x8f26('0xc'),JSON[_0x8f26('0xd')](_0x3448d8));if(_0x3448d8[_0x8f26('0xe')]){if(_0x3448d8[_0x8f26('0xe')][_0x8f26('0xf')]===0x1f4){logger[_0x8f26('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x55b045,_0x3448d8[_0x8f26('0xe')][_0x8f26('0x10')]);return _0x407cab(_0x3448d8[_0x8f26('0xe')][_0x8f26('0x10')]);}logger[_0x8f26('0xe')](_0x8f26('0x11'),_0x55b045,_0x3448d8['error']['message']);return _0x5aa41e(_0x3448d8[_0x8f26('0xe')]['message']);}else{logger[_0x8f26('0x12')](_0x8f26('0x11'),_0x55b045,'request\x20sent');_0x5aa41e(_0x3448d8[_0x8f26('0x13')][_0x8f26('0x10')]);}})[_0x8f26('0x14')](function(_0x329bd7){logger[_0x8f26('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x55b045,_0x329bd7);_0x407cab(_0x329bd7);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index dd2b9d1..130f716 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 _0x077a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1e1131,_0x4a7ab4){var _0xa73eaf=function(_0xec5ced){while(--_0xec5ced){_0x1e1131['push'](_0x1e1131['shift']());}};_0xa73eaf(++_0x4a7ab4);}(_0x077a,0xfb));var _0xa077=function(_0x1a3488,_0x3874b0){_0x1a3488=_0x1a3488-0x0;var _0x8398da=_0x077a[_0x1a3488];return _0x8398da;};'use strict';var multer=require(_0xa077('0x0'));var util=require(_0xa077('0x1'));var path=require(_0xa077('0x2'));var timeout=require(_0xa077('0x3'));var express=require(_0xa077('0x4'));var router=express[_0xa077('0x5')]();var auth=require(_0xa077('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa077('0x7'));var controller=require(_0xa077('0x8'));router[_0xa077('0x9')]('/',auth[_0xa077('0xa')](),controller[_0xa077('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa077('0xc')]);router[_0xa077('0xd')]('/',auth[_0xa077('0xa')](),controller[_0xa077('0xe')]);router[_0xa077('0xf')](_0xa077('0x10'),auth[_0xa077('0xa')](),controller[_0xa077('0x11')]);router[_0xa077('0x12')](_0xa077('0x10'),auth[_0xa077('0xa')](),controller[_0xa077('0x13')]);module[_0xa077('0x14')]=router; \ No newline at end of file +var _0x8599=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id'];(function(_0x5ec8be,_0x1280c5){var _0x5a4ff2=function(_0x57fe6e){while(--_0x57fe6e){_0x5ec8be['push'](_0x5ec8be['shift']());}};_0x5a4ff2(++_0x1280c5);}(_0x8599,0xbc));var _0x9859=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8599[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9859('0x0'));var util=require(_0x9859('0x1'));var path=require(_0x9859('0x2'));var timeout=require(_0x9859('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9859('0x4'));var interaction=require(_0x9859('0x5'));var config=require(_0x9859('0x6'));var controller=require(_0x9859('0x7'));router[_0x9859('0x8')]('/',auth[_0x9859('0x9')](),controller[_0x9859('0xa')]);router['get'](_0x9859('0xb'),auth[_0x9859('0x9')](),controller[_0x9859('0xc')]);router[_0x9859('0xd')]('/',auth['isAuthenticated'](),controller[_0x9859('0xe')]);router[_0x9859('0xf')]('/:id',auth[_0x9859('0x9')](),controller[_0x9859('0x10')]);router[_0x9859('0x11')](_0x9859('0xb'),auth[_0x9859('0x9')](),controller[_0x9859('0x12')]);module[_0x9859('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ecbe659..6c679e0 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x5e319f,_0x12e95a){var _0x15be36=function(_0x4bcdda){while(--_0x4bcdda){_0x5e319f['push'](_0x5e319f['shift']());}};_0x15be36(++_0x12e95a);}(_0x34e8,0x12c));var _0x834e=function(_0x53db62,_0x21d138){_0x53db62=_0x53db62-0x0;var _0x5d2f3b=_0x34e8[_0x53db62];return _0x5d2f3b;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['BOOLEAN','STRING','name'];(function(_0x5497ef,_0x54ae44){var _0x136100=function(_0x516382){while(--_0x516382){_0x5497ef['push'](_0x5497ef['shift']());}};_0x136100(++_0x54ae44);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 7b15bf6..05fb327 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 _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file +var _0x55ca=['ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','name','index','map','VoiceContext','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','render','chan_sip.so','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x423724,_0x1357d6){var _0x2e960e=function(_0x3d4e6f){while(--_0x3d4e6f){_0x423724['push'](_0x423724['shift']());}};_0x2e960e(++_0x1357d6);}(_0x55ca,0x126));var _0xa55c=function(_0x5ae350,_0x24edc7){_0x5ae350=_0x5ae350-0x0;var _0x4e3073=_0x55ca[_0x5ae350];return _0x4e3073;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var db=require(_0xa55c('0x16'))['db'];var jayson=require(_0xa55c('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2a35be,_0x576044,_0x5a3672){if(_0x5a3672){var _0x59ea8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59ea8d[_0xa55c('0x18')](_0x576044)){return _0x2a35be;}else{throw new db[(_0xa55c('0x19'))][(_0xa55c('0x1a'))](_0xa55c('0x1b'));}}else{return _0x2a35be;}}function respondWithRpcPromise(_0x458480,_0x247e77,_0x4e0b2f,_0x3ccf65){return new BPromise(function(_0x3dcf4f,_0x25934f){var _0x31e10d=_0x3ccf65||client;return _0x31e10d[_0xa55c('0x1c')](_0x458480,_0x4e0b2f)[_0xa55c('0x1d')](function(_0x51590e){logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x247e77,'request\x20sent');logger[_0xa55c('0x20')](_0xa55c('0x21'),_0x247e77,_0xa55c('0x22'),JSON[_0xa55c('0x23')](_0x51590e));if(_0x51590e[_0xa55c('0x24')]){if(_0x51590e[_0xa55c('0x24')]['code']===0x1f4){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x25934f(_0x51590e['error'][_0xa55c('0x25')]);}logger[_0xa55c('0x24')]('VoiceContext,\x20%s,\x20%s',_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x3dcf4f(_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);}else{logger[_0xa55c('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x247e77,_0xa55c('0x22'));_0x3dcf4f(_0x51590e['result']['message']);}})['catch'](function(_0x19ae88){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x19ae88);_0x25934f(_0x19ae88);});});}function respondWithStatusCode(_0x190757,_0x3f64de){_0x3f64de=_0x3f64de||0xcc;return function(_0xf0e574){if(_0xf0e574){return _0x190757[_0xa55c('0x26')](_0x3f64de);}return _0x190757[_0xa55c('0x27')](_0x3f64de)[_0xa55c('0x28')]();};}function respondWithResult(_0x11e7f7,_0x192df2){_0x192df2=_0x192df2||0xc8;return function(_0x3cd152){if(_0x3cd152){return _0x11e7f7[_0xa55c('0x27')](_0x192df2)['json'](_0x3cd152);}};}function respondWithFilteredResult(_0x430d55,_0x28814f){return function(_0x1c9f6b){if(_0x1c9f6b){var _0x906caa=_0x1c9f6b[_0xa55c('0x29')],_0x5d940d=_0x28814f[_0xa55c('0x2a')],_0x1377b0=_0x28814f[_0xa55c('0x2a')]+_0x28814f[_0xa55c('0x2b')],_0x22f6b6;if(_0x1377b0>=_0x906caa){_0x1377b0=_0x906caa;_0x22f6b6=0xc8;}else{_0x22f6b6=0xce;}_0x430d55['status'](_0x22f6b6);return _0x430d55[_0xa55c('0x2c')]('Content-Range',_0x5d940d+'-'+_0x1377b0+'/'+_0x906caa)[_0xa55c('0x2d')](_0x1c9f6b);}return null;};}function patchUpdates(_0x1d730b){return function(_0x1cc53e){try{jsonpatch[_0xa55c('0x2e')](_0x1cc53e,_0x1d730b,!![]);}catch(_0x4d8416){return BPromise[_0xa55c('0x2f')](_0x4d8416);}return _0x1cc53e[_0xa55c('0x30')]();};}function saveUpdates(_0x331e58,_0x20da31){return function(_0x10f4b7){if(_0x10f4b7){return _0x10f4b7[_0xa55c('0x31')](_0x331e58)[_0xa55c('0x1d')](function(_0x24d44d){return _0x24d44d;});}return null;};}function removeEntity(_0x2808e9,_0xcbaf2e){return function(_0x197099){if(_0x197099){return _0x197099['destroy']()['then'](function(){var _0x4146f3=_0x197099[_0xa55c('0x32')]({'plain':!![]});var _0x4932d0=_0xa55c('0x33');return db[_0xa55c('0x34')][_0xa55c('0x35')]({'where':{'type':_0x4932d0,'resourceId':_0x4146f3['id']}})[_0xa55c('0x1d')](function(){return _0x197099;});})[_0xa55c('0x1d')](function(){_0x2808e9[_0xa55c('0x27')](0xcc)[_0xa55c('0x28')]();});}};}function handleEntityNotFound(_0x222d4b,_0x3959e3){return function(_0x53590c){if(!_0x53590c){_0x222d4b['sendStatus'](0x194);}return _0x53590c;};}function handleError(_0x4b23d3,_0x3fd75f){_0x3fd75f=_0x3fd75f||0x1f4;return function(_0x18e00e){logger[_0xa55c('0x24')](_0x18e00e['stack']);if(_0x18e00e[_0xa55c('0x36')]){delete _0x18e00e['name'];}_0x4b23d3[_0xa55c('0x27')](_0x3fd75f)['send'](_0x18e00e);};}exports[_0xa55c('0x37')]=function(_0x39267c,_0x3c0ec1){var _0x4d3eb5={},_0x7c4a47={},_0x30f23b={'count':0x0,'rows':[]};var _0x47e93c=_[_0xa55c('0x38')](db[_0xa55c('0x39')]['rawAttributes'],function(_0x529ff8){return{'name':_0x529ff8[_0xa55c('0x3a')],'type':_0x529ff8['type'][_0xa55c('0x3b')]};});_0x7c4a47[_0xa55c('0x3c')]=_['map'](_0x47e93c,'name');_0x7c4a47['query']=_['keys'](_0x39267c[_0xa55c('0x3d')]);_0x7c4a47[_0xa55c('0x3e')]=_[_0xa55c('0x3f')](_0x7c4a47[_0xa55c('0x3c')],_0x7c4a47[_0xa55c('0x3d')]);_0x4d3eb5['attributes']=_[_0xa55c('0x3f')](_0x7c4a47[_0xa55c('0x3c')],qs[_0xa55c('0x40')](_0x39267c[_0xa55c('0x3d')][_0xa55c('0x40')]));_0x4d3eb5[_0xa55c('0x41')]=_0x4d3eb5['attributes'][_0xa55c('0x42')]?_0x4d3eb5['attributes']:_0x7c4a47['model'];if(!_0x39267c[_0xa55c('0x3d')][_0xa55c('0x43')]('nolimit')){_0x4d3eb5[_0xa55c('0x2b')]=qs['limit'](_0x39267c['query'][_0xa55c('0x2b')]);_0x4d3eb5[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x39267c['query'][_0xa55c('0x2a')]);}_0x4d3eb5[_0xa55c('0x44')]=qs['sort'](_0x39267c[_0xa55c('0x3d')]['sort']);_0x4d3eb5[_0xa55c('0x45')]=qs[_0xa55c('0x3e')](_['pick'](_0x39267c[_0xa55c('0x3d')],_0x7c4a47[_0xa55c('0x3e')]),_0x47e93c);if(_0x39267c['query'][_0xa55c('0x46')]){_0x4d3eb5[_0xa55c('0x45')]=_[_0xa55c('0x47')](_0x4d3eb5['where'],{'$or':_[_0xa55c('0x38')](_0x47e93c,function(_0x582901){if(_0x582901[_0xa55c('0x48')]!==_0xa55c('0x49')){var _0x451269={};_0x451269[_0x582901['name']]={'$like':'%'+_0x39267c[_0xa55c('0x3d')][_0xa55c('0x46')]+'%'};return _0x451269;}})});}_0x4d3eb5=_['merge']({},_0x4d3eb5,_0x39267c[_0xa55c('0x4a')]);var _0x931907={'where':_0x4d3eb5['where']};return db[_0xa55c('0x39')][_0xa55c('0x29')](_0x931907)['then'](function(_0x46f839){_0x30f23b[_0xa55c('0x29')]=_0x46f839;if(_0x39267c[_0xa55c('0x3d')][_0xa55c('0x4b')]){_0x4d3eb5['include']=[{'all':!![]}];}return db[_0xa55c('0x39')]['findAll'](_0x4d3eb5);})[_0xa55c('0x1d')](function(_0x213100){_0x30f23b[_0xa55c('0x4c')]=_0x213100;return _0x30f23b;})['then'](respondWithFilteredResult(_0x3c0ec1,_0x4d3eb5))[_0xa55c('0x4d')](handleError(_0x3c0ec1,null));};exports[_0xa55c('0x4e')]=function(_0x574fe9,_0x5be06){var _0x34de95={'raw':![],'where':{'id':_0x574fe9[_0xa55c('0x4f')]['id']}},_0x3822b7={};_0x3822b7[_0xa55c('0x3c')]=_[_0xa55c('0x50')](db[_0xa55c('0x39')][_0xa55c('0x51')]);_0x3822b7[_0xa55c('0x3d')]=_[_0xa55c('0x50')](_0x574fe9['query']);_0x3822b7[_0xa55c('0x3e')]=_[_0xa55c('0x3f')](_0x3822b7[_0xa55c('0x3c')],_0x3822b7['query']);_0x34de95[_0xa55c('0x41')]=_[_0xa55c('0x3f')](_0x3822b7['model'],qs[_0xa55c('0x40')](_0x574fe9['query'][_0xa55c('0x40')]));_0x34de95[_0xa55c('0x41')]=_0x34de95[_0xa55c('0x41')][_0xa55c('0x42')]?_0x34de95[_0xa55c('0x41')]:_0x3822b7['model'];if(_0x574fe9[_0xa55c('0x3d')][_0xa55c('0x4b')]){_0x34de95['include']=[{'all':!![]}];}_0x34de95=_[_0xa55c('0x47')]({},_0x34de95,_0x574fe9[_0xa55c('0x4a')]);return db[_0xa55c('0x39')][_0xa55c('0x52')](_0x34de95)['then'](handleEntityNotFound(_0x5be06,null))['then'](respondWithResult(_0x5be06,null))[_0xa55c('0x4d')](handleError(_0x5be06,null));};exports[_0xa55c('0x53')]=function(_0x3ca5b8,_0x44ac57,_0x54cbde){var _0x30c0c9;return db['VoiceContext'][_0xa55c('0x53')](_0x3ca5b8[_0xa55c('0x54')],{'raw':!![]})[_0xa55c('0x1d')](function(_0x2ccfb1){_0x30c0c9=_0x2ccfb1;return db[_0xa55c('0x39')]['findAll']({'raw':!![]});})[_0xa55c('0x1d')](function(_0x54f776){var _0x23f67f=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],_0xa55c('0x58')),_0xa55c('0x59'));var _0x5d14e0=ejs['render'](_0x23f67f,{'contexts':_0x54f776||[]});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x5d14e0);})[_0xa55c('0x1d')](function(){return respondWithRpcPromise(_0xa55c('0x5c'),_0xa55c('0x53'),{'module':'chan_sip.so'});})[_0xa55c('0x1d')](function(){var _0x3cd40d=_0x3ca5b8[_0xa55c('0x5d')][_0xa55c('0x32')]({'plain':!![]});if(!_0x3cd40d)throw new Error(_0xa55c('0x5e'));if(_0x3cd40d['role']===_0xa55c('0x5d')){var _0x21725b=_0x30c0c9[_0xa55c('0x32')]({'plain':!![]});return db[_0xa55c('0x5f')][_0xa55c('0x52')]({'where':{'name':'Contexts','userProfileId':_0x3cd40d[_0xa55c('0x60')]},'raw':!![]})['then'](function(_0x2e482a){if(_0x2e482a&&_0x2e482a['autoAssociation']===0x0){return db[_0xa55c('0x34')]['create']({'name':_0x21725b[_0xa55c('0x36')],'resourceId':_0x21725b['id'],'type':_0x2e482a[_0xa55c('0x36')],'sectionId':_0x2e482a['id']},{})[_0xa55c('0x1d')](function(){return _0x30c0c9;});}else{return _0x30c0c9;}})[_0xa55c('0x4d')](function(_0x4cb38c){logger[_0xa55c('0x24')](_0xa55c('0x61'),_0x4cb38c);throw _0x4cb38c;});}return _0x30c0c9;})[_0xa55c('0x1d')](respondWithResult(_0x44ac57,0xc9))[_0xa55c('0x4d')](handleError(_0x44ac57,null));};exports[_0xa55c('0x31')]=function(_0x51c736,_0x150a07,_0x311bb9){var _0x4ef914;return db[_0xa55c('0x39')][_0xa55c('0x52')]({'where':{'id':_0x51c736[_0xa55c('0x4f')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x150a07,null))[_0xa55c('0x1d')](saveUpdates(_0x51c736[_0xa55c('0x54')],null))[_0xa55c('0x1d')](function(_0x202191){if(_0x202191){_0x4ef914=_0x202191;return db['VoiceContext'][_0xa55c('0x62')]({'raw':!![]});}})[_0xa55c('0x1d')](function(_0x39861f){var _0xd309a9=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],_0xa55c('0x58')),_0xa55c('0x59'));var _0x4a08ca=ejs[_0xa55c('0x63')](_0xd309a9,{'contexts':_0x39861f||[]});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x4a08ca);})[_0xa55c('0x1d')](function(){return respondWithRpcPromise(_0xa55c('0x5c'),_0xa55c('0x31'),{'module':_0xa55c('0x64')});})[_0xa55c('0x1d')](function(){return _0x4ef914;})[_0xa55c('0x1d')](respondWithResult(_0x150a07,null))[_0xa55c('0x4d')](handleError(_0x150a07,null));};exports[_0xa55c('0x35')]=function(_0x5c598a,_0xe42233,_0x531eee){var _0x1228a4;return db[_0xa55c('0x39')][_0xa55c('0x52')]({'where':{'id':_0x5c598a['params']['id']}})['then'](handleEntityNotFound(_0xe42233,null))[_0xa55c('0x1d')](removeEntity(_0xe42233,null))[_0xa55c('0x1d')](function(){return db[_0xa55c('0x39')][_0xa55c('0x62')]({'raw':!![]});})['then'](function(_0x149cb9){var _0xd02251=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x3f7fca=ejs[_0xa55c('0x63')](_0xd02251,{'contexts':_0x149cb9});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x3f7fca);return respondWithRpcPromise(_0xa55c('0x5c'),'destroy',{'module':_0xa55c('0x64')});})[_0xa55c('0x4d')](handleError(_0xe42233,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e82bc51..795f082 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4c0fce,_0x606b3a){var _0x377d2a=function(_0x77adf6){while(--_0x77adf6){_0x4c0fce['push'](_0x4c0fce['shift']());}};_0x377d2a(++_0x606b3a);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3a89ce,_0x15f9da){var _0x1cacc6=function(_0x5ec551){while(--_0x5ec551){_0x3a89ce['push'](_0x3a89ce['shift']());}};_0x1cacc6(++_0x15f9da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 2bdfd79..4ab6e05 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 _0xab61=['request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','VoiceContext,\x20%s,\x20%s'];(function(_0x4c41c4,_0x75bc8a){var _0x2bdc48=function(_0x2ea5e8){while(--_0x2ea5e8){_0x4c41c4['push'](_0x4c41c4['shift']());}};_0x2bdc48(++_0x75bc8a);}(_0xab61,0x196));var _0x1ab6=function(_0x5cf28f,_0x1b6a0b){_0x5cf28f=_0x5cf28f-0x0;var _0x496403=_0xab61[_0x5cf28f];return _0x496403;};'use strict';var _=require(_0x1ab6('0x0'));var util=require(_0x1ab6('0x1'));var moment=require(_0x1ab6('0x2'));var BPromise=require(_0x1ab6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ab6('0x4'));var db=require(_0x1ab6('0x5'))['db'];var utils=require(_0x1ab6('0x6'));var logger=require(_0x1ab6('0x7'))(_0x1ab6('0x8'));var config=require(_0x1ab6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ab6('0xa')][_0x1ab6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1284ef,_0x2be323,_0x3b9791){return new BPromise(function(_0x589228,_0x19f995){return client['request'](_0x1284ef,_0x3b9791)[_0x1ab6('0xc')](function(_0x17e10d){logger['info'](_0x1ab6('0xd'),_0x2be323,_0x1ab6('0xe'));logger['debug'](_0x1ab6('0xf'),_0x2be323,_0x1ab6('0xe'),JSON[_0x1ab6('0x10')](_0x17e10d));if(_0x17e10d[_0x1ab6('0x11')]){if(_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x12')]===0x1f4){logger[_0x1ab6('0x11')](_0x1ab6('0xd'),_0x2be323,_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x13')]);return _0x19f995(_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x13')]);}logger['error'](_0x1ab6('0xd'),_0x2be323,_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x13')]);return _0x589228(_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x13')]);}else{logger['info'](_0x1ab6('0xd'),_0x2be323,'request\x20sent');_0x589228(_0x17e10d[_0x1ab6('0x14')][_0x1ab6('0x13')]);}})['catch'](function(_0x2a705e){logger[_0x1ab6('0x11')](_0x1ab6('0xd'),_0x2be323,_0x2a705e);_0x19f995(_0x2a705e);});});} \ No newline at end of file +var _0xc026=['debug','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0x47cb15,_0x30289e){var _0xa62dbe=function(_0x3250ff){while(--_0x3250ff){_0x47cb15['push'](_0x47cb15['shift']());}};_0xa62dbe(++_0x30289e);}(_0xc026,0x111));var _0x6c02=function(_0x3ac035,_0x40f232){_0x3ac035=_0x3ac035-0x0;var _0x4f9c43=_0xc026[_0x3ac035];return _0x4f9c43;};'use strict';var _=require('lodash');var util=require(_0x6c02('0x0'));var moment=require(_0x6c02('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c02('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c02('0x3'))['db'];var utils=require(_0x6c02('0x4'));var logger=require(_0x6c02('0x5'))(_0x6c02('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6c02('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc39db0,_0x42976c,_0x10c8de){return new BPromise(function(_0x28ab72,_0x1458c3){return client[_0x6c02('0x8')](_0xc39db0,_0x10c8de)['then'](function(_0x4198f3){logger[_0x6c02('0x9')](_0x6c02('0xa'),_0x42976c,_0x6c02('0xb'));logger[_0x6c02('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x42976c,_0x6c02('0xb'),JSON[_0x6c02('0xd')](_0x4198f3));if(_0x4198f3['error']){if(_0x4198f3[_0x6c02('0xe')][_0x6c02('0xf')]===0x1f4){logger[_0x6c02('0xe')](_0x6c02('0xa'),_0x42976c,_0x4198f3[_0x6c02('0xe')]['message']);return _0x1458c3(_0x4198f3['error']['message']);}logger[_0x6c02('0xe')]('VoiceContext,\x20%s,\x20%s',_0x42976c,_0x4198f3[_0x6c02('0xe')][_0x6c02('0x10')]);return _0x28ab72(_0x4198f3[_0x6c02('0xe')][_0x6c02('0x10')]);}else{logger[_0x6c02('0x9')]('VoiceContext,\x20%s,\x20%s',_0x42976c,_0x6c02('0xb'));_0x28ab72(_0x4198f3[_0x6c02('0x11')][_0x6c02('0x10')]);}})[_0x6c02('0x12')](function(_0x443192){logger[_0x6c02('0xe')](_0x6c02('0xa'),_0x42976c,_0x443192);_0x1458c3(_0x443192);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 188aff9..ea52845 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 _0x954a=['show','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x18aa9b,_0x4a8fc9){var _0x92ca21=function(_0x4dcabe){while(--_0x4dcabe){_0x18aa9b['push'](_0x18aa9b['shift']());}};_0x92ca21(++_0x4a8fc9);}(_0x954a,0x83));var _0xa954=function(_0x4d771c,_0x1e930e){_0x4d771c=_0x4d771c-0x0;var _0x3600bc=_0x954a[_0x4d771c];return _0x3600bc;};'use strict';var multer=require(_0xa954('0x0'));var util=require(_0xa954('0x1'));var path=require(_0xa954('0x2'));var timeout=require(_0xa954('0x3'));var express=require(_0xa954('0x4'));var router=express[_0xa954('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa954('0x6'));var config=require(_0xa954('0x7'));var controller=require('./voiceDialReport.controller');router[_0xa954('0x8')]('/',auth[_0xa954('0x9')](),controller[_0xa954('0xa')]);router[_0xa954('0x8')]('/describe',auth[_0xa954('0x9')](),controller[_0xa954('0xb')]);router['get'](_0xa954('0xc'),auth['isAuthenticated'](),controller[_0xa954('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa954('0xc'),auth['isAuthenticated'](),controller[_0xa954('0xe')]);router['delete'](_0xa954('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa954('0xf')]=router; \ No newline at end of file +var _0x399c=['./voiceDialReport.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23c2a1,_0x4e8bb6){var _0x49896f=function(_0x49d387){while(--_0x49d387){_0x23c2a1['push'](_0x23c2a1['shift']());}};_0x49896f(++_0x4e8bb6);}(_0x399c,0x7c));var _0xc399=function(_0x3cdbe0,_0x14e477){_0x3cdbe0=_0x3cdbe0-0x0;var _0x151269=_0x399c[_0x3cdbe0];return _0x151269;};'use strict';var multer=require(_0xc399('0x0'));var util=require(_0xc399('0x1'));var path=require(_0xc399('0x2'));var timeout=require(_0xc399('0x3'));var express=require(_0xc399('0x4'));var router=express[_0xc399('0x5')]();var auth=require(_0xc399('0x6'));var interaction=require(_0xc399('0x7'));var config=require(_0xc399('0x8'));var controller=require(_0xc399('0x9'));router[_0xc399('0xa')]('/',auth[_0xc399('0xb')](),controller['index']);router[_0xc399('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc399('0xa')](_0xc399('0xc'),auth[_0xc399('0xb')](),controller[_0xc399('0xd')]);router[_0xc399('0xe')]('/',auth[_0xc399('0xb')](),controller[_0xc399('0xf')]);router['put']('/:id',auth[_0xc399('0xb')](),controller[_0xc399('0x10')]);router[_0xc399('0x11')](_0xc399('0xc'),auth[_0xc399('0xb')](),controller[_0xc399('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 85291bb..65085d1 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 _0x504d=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x1a84c1,_0x30a2ae){var _0x103098=function(_0xc5453f){while(--_0xc5453f){_0x1a84c1['push'](_0x1a84c1['shift']());}};_0x103098(++_0x30a2ae);}(_0x504d,0xca));var _0xd504=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x504d[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xd504('0x0')]={'privilege':{'type':Sequelize[_0xd504('0x1')]},'channel':{'type':Sequelize[_0xd504('0x1')]},'channelstate':{'type':Sequelize[_0xd504('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd504('0x1')]},'calleridname':{'type':Sequelize[_0xd504('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd504('0x1')]},'language':{'type':Sequelize[_0xd504('0x1')]},'accountcode':{'type':Sequelize[_0xd504('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd504('0x1')]},'priority':{'type':Sequelize[_0xd504('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd504('0x1')]},'destchannelstate':{'type':Sequelize[_0xd504('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd504('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd504('0x1')]},'destcalleridname':{'type':Sequelize[_0xd504('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd504('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd504('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd504('0x2')]},'destuniqueid':{'type':Sequelize[_0xd504('0x1')]},'destlinkedid':{'type':Sequelize[_0xd504('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd504('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd504('0x3')]},'lastevent':{'type':Sequelize[_0xd504('0x1')],'comment':_0xd504('0x4')},'routeId':{'type':Sequelize[_0xd504('0x2')]},'duration':{'type':Sequelize[_0xd504('0x2')]},'holdtime':{'type':Sequelize[_0xd504('0x2')]},'billableseconds':{'type':Sequelize[_0xd504('0x2')]}}; \ No newline at end of file +var _0x61f2=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0x61f2,0xbb));var _0x261f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f2[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x261f('0x0'));module[_0x261f('0x1')]={'privilege':{'type':Sequelize[_0x261f('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x261f('0x3')]},'channelstatedesc':{'type':Sequelize[_0x261f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x261f('0x2')]},'connectedlinename':{'type':Sequelize[_0x261f('0x2')]},'language':{'type':Sequelize[_0x261f('0x2')]},'accountcode':{'type':Sequelize[_0x261f('0x2')]},'context':{'type':Sequelize[_0x261f('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x261f('0x3')]},'uniqueid':{'type':Sequelize[_0x261f('0x2')]},'linkedid':{'type':Sequelize[_0x261f('0x2')]},'destchannel':{'type':Sequelize[_0x261f('0x2')]},'destchannelstate':{'type':Sequelize[_0x261f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x261f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x261f('0x2')]},'destcalleridname':{'type':Sequelize[_0x261f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x261f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x261f('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x261f('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x261f('0x2')]},'destpriority':{'type':Sequelize[_0x261f('0x3')]},'destuniqueid':{'type':Sequelize[_0x261f('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x261f('0x4')]},'answertime':{'type':Sequelize[_0x261f('0x4')]},'endtime':{'type':Sequelize[_0x261f('0x4')]},'lastevent':{'type':Sequelize[_0x261f('0x2')],'comment':_0x261f('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x261f('0x3')]},'holdtime':{'type':Sequelize[_0x261f('0x3')]},'billableseconds':{'type':Sequelize[_0x261f('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index daac0a9..333f7a3 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 _0xcd16=['destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xcd16,0x13e));var _0x6cd1=function(_0x415e30,_0x33e944){_0x415e30=_0x415e30-0x0;var _0x401aaa=_0xcd16[_0x415e30];return _0x401aaa;};'use strict';var pdf=require(_0x6cd1('0x0'));var emlformat=require(_0x6cd1('0x1'));var rimraf=require(_0x6cd1('0x2'));var zipdir=require(_0x6cd1('0x3'));var jsonpatch=require(_0x6cd1('0x4'));var rp=require(_0x6cd1('0x5'));var moment=require(_0x6cd1('0x6'));var BPromise=require(_0x6cd1('0x7'));var Mustache=require(_0x6cd1('0x8'));var util=require(_0x6cd1('0x9'));var path=require(_0x6cd1('0xa'));var sox=require(_0x6cd1('0xb'));var csv=require(_0x6cd1('0xc'));var ejs=require(_0x6cd1('0xd'));var fs=require('fs');var _=require(_0x6cd1('0xe'));var squel=require(_0x6cd1('0xf'));var crypto=require(_0x6cd1('0x10'));var jsforce=require(_0x6cd1('0x11'));var deskjs=require(_0x6cd1('0x12'));var toCsv=require('to-csv');var querystring=require(_0x6cd1('0x13'));var Papa=require(_0x6cd1('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cd1('0x15'));var as=require(_0x6cd1('0x16'));var hardwareService=require(_0x6cd1('0x17'));var logger=require(_0x6cd1('0x18'))(_0x6cd1('0x19'));var utils=require('../../config/utils');var config=require(_0x6cd1('0x1a'));var db=require(_0x6cd1('0x1b'))['db'];function respondWithStatusCode(_0x5a274f,_0x1651c3){_0x1651c3=_0x1651c3||0xcc;return function(_0x1b328f){if(_0x1b328f){return _0x5a274f[_0x6cd1('0x1c')](_0x1651c3);}return _0x5a274f['status'](_0x1651c3)[_0x6cd1('0x1d')]();};}function respondWithResult(_0x233b6f,_0x221831){_0x221831=_0x221831||0xc8;return function(_0x34b401){if(_0x34b401){return _0x233b6f[_0x6cd1('0x1e')](_0x221831)[_0x6cd1('0x1f')](_0x34b401);}};}function respondWithFilteredResult(_0x51eba0,_0x4c50dd){return function(_0x59b4bb){if(_0x59b4bb){var _0x228153=_0x59b4bb[_0x6cd1('0x20')],_0x414262=_0x4c50dd[_0x6cd1('0x21')],_0x430385=_0x4c50dd['offset']+_0x4c50dd[_0x6cd1('0x22')],_0x55a6cc;if(_0x430385>=_0x228153){_0x430385=_0x228153;_0x55a6cc=0xc8;}else{_0x55a6cc=0xce;}_0x51eba0[_0x6cd1('0x1e')](_0x55a6cc);return _0x51eba0['set'](_0x6cd1('0x23'),_0x414262+'-'+_0x430385+'/'+_0x228153)[_0x6cd1('0x1f')](_0x59b4bb);}return null;};}function patchUpdates(_0x525757){return function(_0x22809d){try{jsonpatch[_0x6cd1('0x24')](_0x22809d,_0x525757,!![]);}catch(_0x19d7df){return BPromise['reject'](_0x19d7df);}return _0x22809d[_0x6cd1('0x25')]();};}function saveUpdates(_0x59b7dd,_0x2017df){return function(_0x36aa39){if(_0x36aa39){return _0x36aa39[_0x6cd1('0x26')](_0x59b7dd)[_0x6cd1('0x27')](function(_0x19da03){return _0x19da03;});}return null;};}function removeEntity(_0x5e1e28,_0x41ce38){return function(_0x3c6416){if(_0x3c6416){return _0x3c6416['destroy']()[_0x6cd1('0x27')](function(){_0x5e1e28[_0x6cd1('0x1e')](0xcc)[_0x6cd1('0x1d')]();});}};}function handleEntityNotFound(_0x1c34e2,_0x2c4825){return function(_0x3b11d1){if(!_0x3b11d1){_0x1c34e2[_0x6cd1('0x1c')](0x194);}return _0x3b11d1;};}function handleError(_0x2e6511,_0x22b6d2){_0x22b6d2=_0x22b6d2||0x1f4;return function(_0x581d9e){logger[_0x6cd1('0x28')](_0x581d9e[_0x6cd1('0x29')]);if(_0x581d9e[_0x6cd1('0x2a')]){delete _0x581d9e[_0x6cd1('0x2a')];}_0x2e6511[_0x6cd1('0x1e')](_0x22b6d2)[_0x6cd1('0x2b')](_0x581d9e);};}exports['index']=function(_0x59d6a6,_0x27dc32){var _0x2f28b1={},_0x4536ad={},_0x954fb={'count':0x0,'rows':[]};var _0xc3cd5a=_[_0x6cd1('0x2c')](db[_0x6cd1('0x2d')][_0x6cd1('0x2e')],function(_0x5e2956){return{'name':_0x5e2956[_0x6cd1('0x2f')],'type':_0x5e2956['type'][_0x6cd1('0x30')]};});_0x4536ad[_0x6cd1('0x31')]=_[_0x6cd1('0x2c')](_0xc3cd5a,_0x6cd1('0x2a'));_0x4536ad['query']=_[_0x6cd1('0x32')](_0x59d6a6[_0x6cd1('0x33')]);_0x4536ad[_0x6cd1('0x34')]=_[_0x6cd1('0x35')](_0x4536ad[_0x6cd1('0x31')],_0x4536ad[_0x6cd1('0x33')]);_0x2f28b1[_0x6cd1('0x36')]=_['intersection'](_0x4536ad[_0x6cd1('0x31')],qs[_0x6cd1('0x37')](_0x59d6a6[_0x6cd1('0x33')]['fields']));_0x2f28b1[_0x6cd1('0x36')]=_0x2f28b1[_0x6cd1('0x36')][_0x6cd1('0x38')]?_0x2f28b1[_0x6cd1('0x36')]:_0x4536ad[_0x6cd1('0x31')];if(!_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x39')]('nolimit')){_0x2f28b1[_0x6cd1('0x22')]=qs[_0x6cd1('0x22')](_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x22')]);_0x2f28b1[_0x6cd1('0x21')]=qs['offset'](_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x21')]);}_0x2f28b1[_0x6cd1('0x3a')]=qs[_0x6cd1('0x3b')](_0x59d6a6[_0x6cd1('0x33')]['sort']);_0x2f28b1[_0x6cd1('0x3c')]=qs[_0x6cd1('0x34')](_[_0x6cd1('0x3d')](_0x59d6a6['query'],_0x4536ad[_0x6cd1('0x34')]),_0xc3cd5a);if(_0x59d6a6['query']['filter']){_0x2f28b1['where']=_['merge'](_0x2f28b1[_0x6cd1('0x3c')],{'$or':_['map'](_0xc3cd5a,function(_0x1cf5cf){if(_0x1cf5cf[_0x6cd1('0x3e')]!==_0x6cd1('0x3f')){var _0x5a70da={};_0x5a70da[_0x1cf5cf['name']]={'$like':'%'+_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x40')]+'%'};return _0x5a70da;}})});}_0x2f28b1=_[_0x6cd1('0x41')]({},_0x2f28b1,_0x59d6a6[_0x6cd1('0x42')]);var _0x220ee5={'where':_0x2f28b1['where']};return db[_0x6cd1('0x2d')][_0x6cd1('0x20')](_0x220ee5)[_0x6cd1('0x27')](function(_0x3f7438){_0x954fb[_0x6cd1('0x20')]=_0x3f7438;if(_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x43')]){_0x2f28b1[_0x6cd1('0x44')]=[{'all':!![]}];}return db[_0x6cd1('0x2d')][_0x6cd1('0x45')](_0x2f28b1);})['then'](function(_0x2d524a){_0x954fb[_0x6cd1('0x46')]=_0x2d524a;return _0x954fb;})['then'](respondWithFilteredResult(_0x27dc32,_0x2f28b1))[_0x6cd1('0x47')](handleError(_0x27dc32,null));};exports[_0x6cd1('0x48')]=function(_0x3f457f,_0x568fc4){var _0x1bfdd0={'raw':!![],'where':{'id':_0x3f457f[_0x6cd1('0x49')]['id']}},_0x5be2f9={};_0x5be2f9[_0x6cd1('0x31')]=_[_0x6cd1('0x32')](db['VoiceDialReport'][_0x6cd1('0x2e')]);_0x5be2f9[_0x6cd1('0x33')]=_[_0x6cd1('0x32')](_0x3f457f['query']);_0x5be2f9[_0x6cd1('0x34')]=_[_0x6cd1('0x35')](_0x5be2f9[_0x6cd1('0x31')],_0x5be2f9['query']);_0x1bfdd0['attributes']=_[_0x6cd1('0x35')](_0x5be2f9[_0x6cd1('0x31')],qs[_0x6cd1('0x37')](_0x3f457f[_0x6cd1('0x33')]['fields']));_0x1bfdd0[_0x6cd1('0x36')]=_0x1bfdd0[_0x6cd1('0x36')]['length']?_0x1bfdd0[_0x6cd1('0x36')]:_0x5be2f9[_0x6cd1('0x31')];if(_0x3f457f[_0x6cd1('0x33')][_0x6cd1('0x43')]){_0x1bfdd0[_0x6cd1('0x44')]=[{'all':!![]}];}_0x1bfdd0=_[_0x6cd1('0x41')]({},_0x1bfdd0,_0x3f457f[_0x6cd1('0x42')]);return db[_0x6cd1('0x2d')][_0x6cd1('0x4a')](_0x1bfdd0)['then'](handleEntityNotFound(_0x568fc4,null))[_0x6cd1('0x27')](respondWithResult(_0x568fc4,null))[_0x6cd1('0x47')](handleError(_0x568fc4,null));};exports[_0x6cd1('0x4b')]=function(_0x588e01,_0x48ab0d){return db['VoiceDialReport'][_0x6cd1('0x4b')](_0x588e01['body'],{})[_0x6cd1('0x27')](respondWithResult(_0x48ab0d,0xc9))[_0x6cd1('0x47')](handleError(_0x48ab0d,null));};exports['update']=function(_0x59067c,_0x147b35){if(_0x59067c[_0x6cd1('0x4c')]['id']){delete _0x59067c[_0x6cd1('0x4c')]['id'];}return db[_0x6cd1('0x2d')]['find']({'where':{'id':_0x59067c['params']['id']}})[_0x6cd1('0x27')](handleEntityNotFound(_0x147b35,null))[_0x6cd1('0x27')](saveUpdates(_0x59067c['body'],null))['then'](respondWithResult(_0x147b35,null))['catch'](handleError(_0x147b35,null));};exports[_0x6cd1('0x4d')]=function(_0xa1ae6e,_0x18df46){return db[_0x6cd1('0x2d')][_0x6cd1('0x4a')]({'where':{'id':_0xa1ae6e['params']['id']}})[_0x6cd1('0x27')](handleEntityNotFound(_0x18df46,null))[_0x6cd1('0x27')](removeEntity(_0x18df46,null))[_0x6cd1('0x47')](handleError(_0x18df46,null));};exports[_0x6cd1('0x4e')]=function(_0x3a578a,_0x22d34b){return db[_0x6cd1('0x2d')][_0x6cd1('0x4e')]()['then'](respondWithResult(_0x22d34b,null))[_0x6cd1('0x47')](handleError(_0x22d34b,null));}; \ No newline at end of file +var _0x2a3a=['show','params','length','includeAll','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','name','send','map','VoiceDialReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','type','options','include','findAll','rows','catch'];(function(_0x15984e,_0x419d99){var _0x17428c=function(_0x472fae){while(--_0x472fae){_0x15984e['push'](_0x15984e['shift']());}};_0x17428c(++_0x419d99);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x343083,_0x1f88da){_0x343083=_0x343083-0x0;var _0x28560b=_0x2a3a[_0x343083];return _0x28560b;};'use strict';var pdf=require(_0xa2a3('0x0'));var emlformat=require(_0xa2a3('0x1'));var rimraf=require(_0xa2a3('0x2'));var zipdir=require(_0xa2a3('0x3'));var jsonpatch=require(_0xa2a3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa2a3('0x5'));var Mustache=require(_0xa2a3('0x6'));var util=require(_0xa2a3('0x7'));var path=require(_0xa2a3('0x8'));var sox=require(_0xa2a3('0x9'));var csv=require(_0xa2a3('0xa'));var ejs=require(_0xa2a3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa2a3('0xc'));var crypto=require(_0xa2a3('0xd'));var jsforce=require(_0xa2a3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa2a3('0xf'));var Redis=require(_0xa2a3('0x10'));var authService=require(_0xa2a3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa2a3('0x12'));var hardwareService=require(_0xa2a3('0x13'));var logger=require(_0xa2a3('0x14'))(_0xa2a3('0x15'));var utils=require(_0xa2a3('0x16'));var config=require('../../config/environment');var db=require(_0xa2a3('0x17'))['db'];function respondWithStatusCode(_0x49870e,_0x80ac46){_0x80ac46=_0x80ac46||0xcc;return function(_0x3cf976){if(_0x3cf976){return _0x49870e['sendStatus'](_0x80ac46);}return _0x49870e[_0xa2a3('0x18')](_0x80ac46)[_0xa2a3('0x19')]();};}function respondWithResult(_0x2030c9,_0x45da20){_0x45da20=_0x45da20||0xc8;return function(_0x3ebb1b){if(_0x3ebb1b){return _0x2030c9[_0xa2a3('0x18')](_0x45da20)[_0xa2a3('0x1a')](_0x3ebb1b);}};}function respondWithFilteredResult(_0x4e21e5,_0xe91715){return function(_0x481505){if(_0x481505){var _0x507ff7=_0x481505[_0xa2a3('0x1b')],_0x3debd2=_0xe91715[_0xa2a3('0x1c')],_0x239716=_0xe91715['offset']+_0xe91715[_0xa2a3('0x1d')],_0x19c3c5;if(_0x239716>=_0x507ff7){_0x239716=_0x507ff7;_0x19c3c5=0xc8;}else{_0x19c3c5=0xce;}_0x4e21e5[_0xa2a3('0x18')](_0x19c3c5);return _0x4e21e5[_0xa2a3('0x1e')](_0xa2a3('0x1f'),_0x3debd2+'-'+_0x239716+'/'+_0x507ff7)[_0xa2a3('0x1a')](_0x481505);}return null;};}function patchUpdates(_0x4f4494){return function(_0x258d57){try{jsonpatch[_0xa2a3('0x20')](_0x258d57,_0x4f4494,!![]);}catch(_0x3d2231){return BPromise[_0xa2a3('0x21')](_0x3d2231);}return _0x258d57['save']();};}function saveUpdates(_0x40a787,_0x13bf25){return function(_0x1e36b6){if(_0x1e36b6){return _0x1e36b6['update'](_0x40a787)[_0xa2a3('0x22')](function(_0x487a20){return _0x487a20;});}return null;};}function removeEntity(_0x2d8478,_0x10ddae){return function(_0x37330c){if(_0x37330c){return _0x37330c[_0xa2a3('0x23')]()[_0xa2a3('0x22')](function(){_0x2d8478[_0xa2a3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x419d77,_0x164c13){return function(_0x203644){if(!_0x203644){_0x419d77[_0xa2a3('0x24')](0x194);}return _0x203644;};}function handleError(_0x120e1a,_0x42086f){_0x42086f=_0x42086f||0x1f4;return function(_0x414d74){logger[_0xa2a3('0x25')](_0x414d74['stack']);if(_0x414d74[_0xa2a3('0x26')]){delete _0x414d74['name'];}_0x120e1a[_0xa2a3('0x18')](_0x42086f)[_0xa2a3('0x27')](_0x414d74);};}exports['index']=function(_0x347824,_0x2edd1e){var _0xddf7cb={},_0x350d43={},_0x16d5c0={'count':0x0,'rows':[]};var _0x2cb498=_[_0xa2a3('0x28')](db[_0xa2a3('0x29')][_0xa2a3('0x2a')],function(_0x26c058){return{'name':_0x26c058[_0xa2a3('0x2b')],'type':_0x26c058['type'][_0xa2a3('0x2c')]};});_0x350d43['model']=_[_0xa2a3('0x28')](_0x2cb498,_0xa2a3('0x26'));_0x350d43[_0xa2a3('0x2d')]=_[_0xa2a3('0x2e')](_0x347824[_0xa2a3('0x2d')]);_0x350d43[_0xa2a3('0x2f')]=_[_0xa2a3('0x30')](_0x350d43[_0xa2a3('0x31')],_0x350d43[_0xa2a3('0x2d')]);_0xddf7cb['attributes']=_[_0xa2a3('0x30')](_0x350d43['model'],qs[_0xa2a3('0x32')](_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x32')]));_0xddf7cb['attributes']=_0xddf7cb[_0xa2a3('0x33')]['length']?_0xddf7cb[_0xa2a3('0x33')]:_0x350d43['model'];if(!_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x34')]('nolimit')){_0xddf7cb['limit']=qs[_0xa2a3('0x1d')](_0x347824['query'][_0xa2a3('0x1d')]);_0xddf7cb[_0xa2a3('0x1c')]=qs['offset'](_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x1c')]);}_0xddf7cb[_0xa2a3('0x35')]=qs['sort'](_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x36')]);_0xddf7cb[_0xa2a3('0x37')]=qs['filters'](_['pick'](_0x347824[_0xa2a3('0x2d')],_0x350d43[_0xa2a3('0x2f')]),_0x2cb498);if(_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x38')]){_0xddf7cb[_0xa2a3('0x37')]=_[_0xa2a3('0x39')](_0xddf7cb['where'],{'$or':_[_0xa2a3('0x28')](_0x2cb498,function(_0x193cf2){if(_0x193cf2[_0xa2a3('0x3a')]!=='VIRTUAL'){var _0x12a674={};_0x12a674[_0x193cf2['name']]={'$like':'%'+_0x347824[_0xa2a3('0x2d')]['filter']+'%'};return _0x12a674;}})});}_0xddf7cb=_[_0xa2a3('0x39')]({},_0xddf7cb,_0x347824[_0xa2a3('0x3b')]);var _0x78b28e={'where':_0xddf7cb[_0xa2a3('0x37')]};return db[_0xa2a3('0x29')][_0xa2a3('0x1b')](_0x78b28e)[_0xa2a3('0x22')](function(_0x488323){_0x16d5c0[_0xa2a3('0x1b')]=_0x488323;if(_0x347824['query']['includeAll']){_0xddf7cb[_0xa2a3('0x3c')]=[{'all':!![]}];}return db[_0xa2a3('0x29')][_0xa2a3('0x3d')](_0xddf7cb);})[_0xa2a3('0x22')](function(_0x2599cf){_0x16d5c0[_0xa2a3('0x3e')]=_0x2599cf;return _0x16d5c0;})[_0xa2a3('0x22')](respondWithFilteredResult(_0x2edd1e,_0xddf7cb))[_0xa2a3('0x3f')](handleError(_0x2edd1e,null));};exports[_0xa2a3('0x40')]=function(_0x13e28a,_0x584229){var _0x2e74c7={'raw':!![],'where':{'id':_0x13e28a[_0xa2a3('0x41')]['id']}},_0x228f79={};_0x228f79[_0xa2a3('0x31')]=_[_0xa2a3('0x2e')](db[_0xa2a3('0x29')][_0xa2a3('0x2a')]);_0x228f79[_0xa2a3('0x2d')]=_['keys'](_0x13e28a[_0xa2a3('0x2d')]);_0x228f79[_0xa2a3('0x2f')]=_[_0xa2a3('0x30')](_0x228f79[_0xa2a3('0x31')],_0x228f79['query']);_0x2e74c7[_0xa2a3('0x33')]=_[_0xa2a3('0x30')](_0x228f79[_0xa2a3('0x31')],qs[_0xa2a3('0x32')](_0x13e28a[_0xa2a3('0x2d')][_0xa2a3('0x32')]));_0x2e74c7[_0xa2a3('0x33')]=_0x2e74c7[_0xa2a3('0x33')][_0xa2a3('0x42')]?_0x2e74c7[_0xa2a3('0x33')]:_0x228f79[_0xa2a3('0x31')];if(_0x13e28a['query'][_0xa2a3('0x43')]){_0x2e74c7[_0xa2a3('0x3c')]=[{'all':!![]}];}_0x2e74c7=_['merge']({},_0x2e74c7,_0x13e28a[_0xa2a3('0x3b')]);return db[_0xa2a3('0x29')][_0xa2a3('0x44')](_0x2e74c7)[_0xa2a3('0x22')](handleEntityNotFound(_0x584229,null))[_0xa2a3('0x22')](respondWithResult(_0x584229,null))[_0xa2a3('0x3f')](handleError(_0x584229,null));};exports[_0xa2a3('0x45')]=function(_0x191525,_0x4c3534){return db[_0xa2a3('0x29')][_0xa2a3('0x45')](_0x191525[_0xa2a3('0x46')],{})['then'](respondWithResult(_0x4c3534,0xc9))['catch'](handleError(_0x4c3534,null));};exports[_0xa2a3('0x47')]=function(_0x1d40a5,_0x52586c){if(_0x1d40a5['body']['id']){delete _0x1d40a5[_0xa2a3('0x46')]['id'];}return db[_0xa2a3('0x29')][_0xa2a3('0x44')]({'where':{'id':_0x1d40a5[_0xa2a3('0x41')]['id']}})[_0xa2a3('0x22')](handleEntityNotFound(_0x52586c,null))[_0xa2a3('0x22')](saveUpdates(_0x1d40a5['body'],null))[_0xa2a3('0x22')](respondWithResult(_0x52586c,null))['catch'](handleError(_0x52586c,null));};exports['destroy']=function(_0x462f30,_0x5754ea){return db[_0xa2a3('0x29')][_0xa2a3('0x44')]({'where':{'id':_0x462f30[_0xa2a3('0x41')]['id']}})['then'](handleEntityNotFound(_0x5754ea,null))[_0xa2a3('0x22')](removeEntity(_0x5754ea,null))[_0xa2a3('0x3f')](handleError(_0x5754ea,null));};exports[_0xa2a3('0x48')]=function(_0x305e27,_0x5475f3){return db[_0xa2a3('0x29')][_0xa2a3('0x48')]()[_0xa2a3('0x22')](respondWithResult(_0x5475f3,null))[_0xa2a3('0x3f')](handleError(_0x5475f3,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1764a02..0b170fe 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 _0x8228=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','report_dial','uniqueid','util','../../config/logger'];(function(_0x4019c9,_0x1762ac){var _0x49cf80=function(_0x591f1a){while(--_0x591f1a){_0x4019c9['push'](_0x4019c9['shift']());}};_0x49cf80(++_0x1762ac);}(_0x8228,0x1de));var _0x8822=function(_0x240257,_0x567545){_0x240257=_0x240257-0x0;var _0x4315ea=_0x8228[_0x240257];return _0x4315ea;};'use strict';var _=require('lodash');var util=require(_0x8822('0x0'));var logger=require(_0x8822('0x1'))(_0x8822('0x2'));var moment=require(_0x8822('0x3'));var BPromise=require('bluebird');var rp=require(_0x8822('0x4'));var fs=require('fs');var path=require(_0x8822('0x5'));var rimraf=require(_0x8822('0x6'));var config=require(_0x8822('0x7'));var attributes=require(_0x8822('0x8'));module['exports']=function(_0x2185a3,_0x3d6725){return _0x2185a3[_0x8822('0x9')]('VoiceDialReport',attributes,{'tableName':_0x8822('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8822('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe262=['uniqueid','lodash','api','moment','bluebird','request-promise','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x2783e9,_0x1c55f4){var _0x35f85e=function(_0x5606eb){while(--_0x5606eb){_0x2783e9['push'](_0x2783e9['shift']());}};_0x35f85e(++_0x1c55f4);}(_0xe262,0x1d5));var _0x2e26=function(_0x147b8a,_0x2a12c5){_0x147b8a=_0x147b8a-0x0;var _0xf842f=_0xe262[_0x147b8a];return _0xf842f;};'use strict';var _=require(_0x2e26('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2e26('0x1'));var moment=require(_0x2e26('0x2'));var BPromise=require(_0x2e26('0x3'));var rp=require(_0x2e26('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e26('0x5'));var config=require('../../config/environment');var attributes=require(_0x2e26('0x6'));module[_0x2e26('0x7')]=function(_0x343043,_0x3ec8a8){return _0x343043[_0x2e26('0x8')](_0x2e26('0x9'),attributes,{'tableName':_0x2e26('0xa'),'paranoid':![],'indexes':[{'fields':[_0x2e26('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 27bcb72..e86167e 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 _0x8e94=['error','code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','debug','update','limit','UpdateVoiceDialReport','lodash','util','bluebird','ioredis','../../config/utils','jayson/promise','client','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8e94,0xf8));var _0x48e9=function(_0x25c92b,_0x41b368){_0x25c92b=_0x25c92b-0x0;var _0xc59d85=_0x8e94[_0x25c92b];return _0xc59d85;};'use strict';var _=require(_0x48e9('0x0'));var util=require(_0x48e9('0x1'));var moment=require('moment');var BPromise=require(_0x48e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x48e9('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x48e9('0x5'));var client=jayson[_0x48e9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ac9d7,_0x58332f,_0x409f7b){return new BPromise(function(_0x50124c,_0x2e3df6){return client[_0x48e9('0x7')](_0x3ac9d7,_0x409f7b)[_0x48e9('0x8')](function(_0x371e53){logger['info'](_0x48e9('0x9'),_0x58332f,_0x48e9('0xa'));logger['debug'](_0x48e9('0xb'),_0x58332f,'request\x20sent',JSON[_0x48e9('0xc')](_0x371e53));if(_0x371e53[_0x48e9('0xd')]){if(_0x371e53[_0x48e9('0xd')][_0x48e9('0xe')]===0x1f4){logger[_0x48e9('0xd')](_0x48e9('0x9'),_0x58332f,_0x371e53['error'][_0x48e9('0xf')]);return _0x2e3df6(_0x371e53[_0x48e9('0xd')][_0x48e9('0xf')]);}logger['error'](_0x48e9('0x9'),_0x58332f,_0x371e53[_0x48e9('0xd')][_0x48e9('0xf')]);return _0x50124c(_0x371e53[_0x48e9('0xd')][_0x48e9('0xf')]);}else{logger[_0x48e9('0x10')](_0x48e9('0x9'),_0x58332f,_0x48e9('0xa'));_0x50124c(_0x371e53[_0x48e9('0x11')][_0x48e9('0xf')]);}})[_0x48e9('0x12')](function(_0x18135a){logger[_0x48e9('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x58332f,_0x18135a);_0x2e3df6(_0x18135a);});});}exports[_0x48e9('0x13')]=function(_0x421508){var _0x2c0c31=this;return new Promise(function(_0x51ab2d,_0xdb0db){return db[_0x48e9('0x14')][_0x48e9('0x15')](_0x421508[_0x48e9('0x16')],{'raw':_0x421508[_0x48e9('0x17')]?_0x421508[_0x48e9('0x17')][_0x48e9('0x18')]===undefined?!![]:![]:!![]})[_0x48e9('0x8')](function(_0x54f07d){logger[_0x48e9('0x10')](_0x48e9('0x13'),_0x421508);logger[_0x48e9('0x19')]('CreateVoiceDialReport',_0x421508,JSON['stringify'](_0x54f07d));_0x51ab2d(_0x54f07d);})[_0x48e9('0x12')](function(_0x5fa95d){logger[_0x48e9('0xd')](_0x48e9('0x13'),_0x5fa95d['message'],_0x421508);_0xdb0db(_0x2c0c31[_0x48e9('0xd')](0x1f4,_0x5fa95d[_0x48e9('0xf')]));});});};exports['UpdateVoiceDialReport']=function(_0x2035dd){var _0x213472=this;return new Promise(function(_0x3047fa,_0x49216a){return db[_0x48e9('0x14')][_0x48e9('0x1a')](_0x2035dd['body'],{'raw':_0x2035dd['options']?_0x2035dd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2035dd[_0x48e9('0x17')]?_0x2035dd[_0x48e9('0x17')]['where']||null:null,'attributes':_0x2035dd[_0x48e9('0x17')]?_0x2035dd[_0x48e9('0x17')]['attributes']||null:null,'limit':_0x2035dd[_0x48e9('0x17')]?_0x2035dd[_0x48e9('0x17')][_0x48e9('0x1b')]||null:null})[_0x48e9('0x8')](function(_0x976ae1){logger['info'](_0x48e9('0x1c'),_0x2035dd);logger[_0x48e9('0x19')]('UpdateVoiceDialReport',_0x2035dd,JSON[_0x48e9('0xc')](_0x976ae1));_0x3047fa(_0x976ae1);})[_0x48e9('0x12')](function(_0x36b27f){logger['error'](_0x48e9('0x1c'),_0x36b27f['message'],_0x2035dd);_0x49216a(_0x213472[_0x48e9('0xd')](0x1f4,_0x36b27f[_0x48e9('0xf')]));});});}; \ No newline at end of file +var _0x0f9f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','body','options','raw','CreateVoiceDialReport','VoiceDialReport','update','UpdateVoiceDialReport','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0xd8b89f,_0x6312f4){_0xd8b89f=_0xd8b89f-0x0;var _0x3c6e90=_0x0f9f[_0xd8b89f];return _0x3c6e90;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));var BPromise=require(_0xf0f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f9('0x3'));var db=require(_0xf0f9('0x4'))['db'];var utils=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var config=require(_0xf0f9('0x8'));var jayson=require(_0xf0f9('0x9'));var client=jayson[_0xf0f9('0xa')][_0xf0f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45694e,_0x51a0ed,_0x448cf5){return new BPromise(function(_0x294b42,_0x5d1753){return client[_0xf0f9('0xc')](_0x45694e,_0x448cf5)[_0xf0f9('0xd')](function(_0x2d72c9){logger['info'](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));logger[_0xf0f9('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x51a0ed,'request\x20sent',JSON[_0xf0f9('0x11')](_0x2d72c9));if(_0x2d72c9[_0xf0f9('0x12')]){if(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x13')]===0x1f4){logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x5d1753(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x294b42(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}else{logger[_0xf0f9('0x15')](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));_0x294b42(_0x2d72c9[_0xf0f9('0x16')][_0xf0f9('0x14')]);}})[_0xf0f9('0x17')](function(_0x677b32){logger[_0xf0f9('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x51a0ed,_0x677b32);_0x5d1753(_0x677b32);});});}exports['CreateVoiceDialReport']=function(_0x350a48){var _0x3227cf=this;return new Promise(function(_0x4c4e17,_0x178e16){return db['VoiceDialReport']['create'](_0x350a48[_0xf0f9('0x18')],{'raw':_0x350a48[_0xf0f9('0x19')]?_0x350a48[_0xf0f9('0x19')][_0xf0f9('0x1a')]===undefined?!![]:![]:!![]})[_0xf0f9('0xd')](function(_0x4ed9ff){logger['info']('CreateVoiceDialReport',_0x350a48);logger[_0xf0f9('0x10')](_0xf0f9('0x1b'),_0x350a48,JSON[_0xf0f9('0x11')](_0x4ed9ff));_0x4c4e17(_0x4ed9ff);})['catch'](function(_0x4a8726){logger[_0xf0f9('0x12')]('CreateVoiceDialReport',_0x4a8726[_0xf0f9('0x14')],_0x350a48);_0x178e16(_0x3227cf[_0xf0f9('0x12')](0x1f4,_0x4a8726[_0xf0f9('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x33dfca){var _0x1061ca=this;return new Promise(function(_0xa4f459,_0x49a2dd){return db[_0xf0f9('0x1c')][_0xf0f9('0x1d')](_0x33dfca[_0xf0f9('0x18')],{'raw':_0x33dfca[_0xf0f9('0x19')]?_0x33dfca[_0xf0f9('0x19')][_0xf0f9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33dfca['options']?_0x33dfca[_0xf0f9('0x19')]['where']||null:null,'attributes':_0x33dfca[_0xf0f9('0x19')]?_0x33dfca[_0xf0f9('0x19')]['attributes']||null:null,'limit':_0x33dfca['options']?_0x33dfca[_0xf0f9('0x19')]['limit']||null:null})[_0xf0f9('0xd')](function(_0x3f236e){logger[_0xf0f9('0x15')](_0xf0f9('0x1e'),_0x33dfca);logger[_0xf0f9('0x10')](_0xf0f9('0x1e'),_0x33dfca,JSON[_0xf0f9('0x11')](_0x3f236e));_0xa4f459(_0x3f236e);})[_0xf0f9('0x17')](function(_0x37c093){logger['error'](_0xf0f9('0x1e'),_0x37c093[_0xf0f9('0x14')],_0x33dfca);_0x49a2dd(_0x1061ca['error'](0x1f4,_0x37c093['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 97a513c..ae71bc0 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 _0x28f1=['isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','update','destroy','exports','path','express','../../components/interaction/service','./voiceExtension.controller','get'];(function(_0x5e0e90,_0x1c8363){var _0x33cfe3=function(_0x44f842){while(--_0x44f842){_0x5e0e90['push'](_0x5e0e90['shift']());}};_0x33cfe3(++_0x1c8363);}(_0x28f1,0x1db));var _0x128f=function(_0x50e2f0,_0x4197f8){_0x50e2f0=_0x50e2f0-0x0;var _0x3612e1=_0x28f1[_0x50e2f0];return _0x3612e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x128f('0x0'));var timeout=require('connect-timeout');var express=require(_0x128f('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x128f('0x2'));var config=require('../../config/environment');var controller=require(_0x128f('0x3'));router[_0x128f('0x4')]('/',auth[_0x128f('0x5')](),controller[_0x128f('0x6')]);router[_0x128f('0x4')](_0x128f('0x7'),auth[_0x128f('0x5')](),controller[_0x128f('0x8')]);router[_0x128f('0x9')]('/',auth[_0x128f('0x5')](),controller[_0x128f('0xa')]);router['post'](_0x128f('0xb'),auth[_0x128f('0x5')](),controller[_0x128f('0xc')]);router['put'](_0x128f('0x7'),auth[_0x128f('0x5')](),controller[_0x128f('0xd')]);router['delete']('/:id',auth[_0x128f('0x5')](),controller[_0x128f('0xe')]);module[_0x128f('0xf')]=router; \ No newline at end of file +var _0xbd79=['./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xbd79,0x1af));var _0x9bd7=function(_0x5aee17,_0x7859ca){_0x5aee17=_0x5aee17-0x0;var _0x1c4ba=_0xbd79[_0x5aee17];return _0x1c4ba;};'use strict';var multer=require(_0x9bd7('0x0'));var util=require(_0x9bd7('0x1'));var path=require(_0x9bd7('0x2'));var timeout=require(_0x9bd7('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9bd7('0x4'));var interaction=require(_0x9bd7('0x5'));var config=require('../../config/environment');var controller=require(_0x9bd7('0x6'));router[_0x9bd7('0x7')]('/',auth[_0x9bd7('0x8')](),controller[_0x9bd7('0x9')]);router['get'](_0x9bd7('0xa'),auth[_0x9bd7('0x8')](),controller['show']);router[_0x9bd7('0xb')]('/',auth[_0x9bd7('0x8')](),controller[_0x9bd7('0xc')]);router[_0x9bd7('0xb')](_0x9bd7('0xd'),auth[_0x9bd7('0x8')](),controller[_0x9bd7('0xe')]);router[_0x9bd7('0xf')]('/:id',auth[_0x9bd7('0x8')](),controller[_0x9bd7('0x10')]);router['delete'](_0x9bd7('0xa'),auth[_0x9bd7('0x8')](),controller[_0x9bd7('0x11')]);module[_0x9bd7('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f0e3390..21735e0 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(_0x5a952b,_0x2c673d){var _0x4fe808=function(_0x12f682){while(--_0x12f682){_0x5a952b['push'](_0x5a952b['shift']());}};_0x4fe808(++_0x2c673d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x3aad93,_0x57e40e){var _0x5b181a=function(_0x4c8386){while(--_0x4c8386){_0x3aad93['push'](_0x3aad93['shift']());}};_0x5b181a(++_0x57e40e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 8395360..ae82c27 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 _0xc2c7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','then','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','options','includeAll','include','params','intersection','merge','catch','startsWith','exten','concat','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x1a107f,_0xea772b){var _0x443fda=function(_0x411f45){while(--_0x411f45){_0x1a107f['push'](_0x1a107f['shift']());}};_0x443fda(++_0xea772b);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1f95df,_0x297772){_0x1f95df=_0x1f95df-0x0;var _0xda32c3=_0xc2c7[_0x1f95df];return _0xda32c3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7c2c('0x0'));var rimraf=require(_0x7c2c('0x1'));var zipdir=require(_0x7c2c('0x2'));var jsonpatch=require(_0x7c2c('0x3'));var rp=require(_0x7c2c('0x4'));var moment=require(_0x7c2c('0x5'));var BPromise=require(_0x7c2c('0x6'));var Mustache=require(_0x7c2c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7c2c('0x8'));var csv=require(_0x7c2c('0x9'));var ejs=require(_0x7c2c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x9'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var db=require(_0x7c2c('0x17'))['db'];config[_0x7c2c('0x18')]=_[_0x7c2c('0x19')](config[_0x7c2c('0x18')],{'host':_0x7c2c('0x1a'),'port':0x18eb});var socket=require(_0x7c2c('0x1b'))(new Redis(config[_0x7c2c('0x18')]));require(_0x7c2c('0x1c'))['register'](socket);function respondWithStatusCode(_0x5b5729,_0x102778){_0x102778=_0x102778||0xcc;return function(_0xd1a3db){if(_0xd1a3db){return _0x5b5729[_0x7c2c('0x1d')](_0x102778);}return _0x5b5729['status'](_0x102778)[_0x7c2c('0x1e')]();};}function respondWithResult(_0x206ecd,_0x5e55e0){_0x5e55e0=_0x5e55e0||0xc8;return function(_0x88f54b){if(_0x88f54b){return _0x206ecd['status'](_0x5e55e0)[_0x7c2c('0x1f')](_0x88f54b);}};}function respondWithFilteredResult(_0x51b73c,_0x342ea2){return function(_0x3c948a){if(_0x3c948a){var _0x14453f=_0x3c948a[_0x7c2c('0x20')],_0x2a9539=_0x342ea2[_0x7c2c('0x21')],_0x17df4a=_0x342ea2[_0x7c2c('0x21')]+_0x342ea2[_0x7c2c('0x22')],_0x26be0f;if(_0x17df4a>=_0x14453f){_0x17df4a=_0x14453f;_0x26be0f=0xc8;}else{_0x26be0f=0xce;}_0x51b73c[_0x7c2c('0x23')](_0x26be0f);return _0x51b73c[_0x7c2c('0x24')]('Content-Range',_0x2a9539+'-'+_0x17df4a+'/'+_0x14453f)[_0x7c2c('0x1f')](_0x3c948a);}return null;};}function patchUpdates(_0x4adb62){return function(_0x506d47){try{jsonpatch[_0x7c2c('0x25')](_0x506d47,_0x4adb62,!![]);}catch(_0x3a71d7){return BPromise[_0x7c2c('0x26')](_0x3a71d7);}return _0x506d47[_0x7c2c('0x27')]();};}function saveUpdates(_0x41552f,_0x1883b5){return function(_0xa84620){if(_0xa84620){return _0xa84620['update'](_0x41552f)[_0x7c2c('0x28')](function(_0x4dedd8){return _0x4dedd8;});}return null;};}function removeEntity(_0x302c93,_0x57f510){return function(_0x3d4387){if(_0x3d4387){return _0x3d4387[_0x7c2c('0x29')]()[_0x7c2c('0x28')](function(){var _0x481867=_0x3d4387['get']({'plain':!![]});var _0x31a50c=[{'name':_0x7c2c('0x2a'),'value':_0x7c2c('0x2b'),'ignore':![]},{'name':_0x7c2c('0x2c'),'value':_0x7c2c('0x2d'),'ignore':![]},{'name':_0x7c2c('0x2e'),'value':_0x7c2c('0x2f'),'ignore':![]}];var _0x4b1dd0=_(_0x31a50c)[_0x7c2c('0x30')](_0x7c2c('0x31'))[_0x7c2c('0x32')](_0x7c2c('0x33'))[_0x7c2c('0x33')]();if(_[_0x7c2c('0x34')](_0x4b1dd0,_0x481867[_0x7c2c('0x35')])){return;}var _0x26f472=_[_0x7c2c('0x36')](_0x31a50c,['value',_0x481867[_0x7c2c('0x35')]])[_0x7c2c('0x37')];return db[_0x7c2c('0x38')][_0x7c2c('0x29')]({'where':{'type':_0x26f472,'resourceId':_0x481867['id']}})['then'](function(){return _0x3d4387;});})[_0x7c2c('0x28')](function(){_0x302c93[_0x7c2c('0x23')](0xcc)[_0x7c2c('0x1e')]();});}};}function handleEntityNotFound(_0x1ef88b,_0x1859c2){return function(_0x3ad837){if(!_0x3ad837){_0x1ef88b[_0x7c2c('0x1d')](0x194);}return _0x3ad837;};}function handleError(_0x57af44,_0x1969f4){_0x1969f4=_0x1969f4||0x1f4;return function(_0x1acf75){logger[_0x7c2c('0x39')](_0x1acf75[_0x7c2c('0x3a')]);if(_0x1acf75[_0x7c2c('0x37')]){delete _0x1acf75['name'];}_0x57af44['status'](_0x1969f4)[_0x7c2c('0x3b')](_0x1acf75);};}exports['index']=function(_0x4b97bb,_0x15ee13){var _0x31b1f2={},_0x199b13={},_0x156c03={'count':0x0,'rows':[]};var _0x536dcf=_[_0x7c2c('0x32')](db[_0x7c2c('0x3c')][_0x7c2c('0x3d')],function(_0x19783d){return{'name':_0x19783d[_0x7c2c('0x3e')],'type':_0x19783d[_0x7c2c('0x35')][_0x7c2c('0x3f')]};});_0x199b13[_0x7c2c('0x40')]=_[_0x7c2c('0x32')](_0x536dcf,_0x7c2c('0x37'));_0x199b13[_0x7c2c('0x41')]=_[_0x7c2c('0x42')](_0x4b97bb[_0x7c2c('0x41')]);_0x199b13['filters']=_['intersection'](_0x199b13[_0x7c2c('0x40')],_0x199b13['query']);_0x31b1f2['attributes']=_['intersection'](_0x199b13[_0x7c2c('0x40')],qs[_0x7c2c('0x43')](_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x43')]));_0x31b1f2[_0x7c2c('0x44')]=_0x31b1f2[_0x7c2c('0x44')][_0x7c2c('0x45')]?_0x31b1f2[_0x7c2c('0x44')]:_0x199b13[_0x7c2c('0x40')];if(!_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x46')]('nolimit')){_0x31b1f2['limit']=qs[_0x7c2c('0x22')](_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x22')]);_0x31b1f2[_0x7c2c('0x21')]=qs['offset'](_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x21')]);}_0x31b1f2[_0x7c2c('0x47')]=qs[_0x7c2c('0x48')](_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x48')]);_0x31b1f2[_0x7c2c('0x49')]=qs[_0x7c2c('0x4a')](_[_0x7c2c('0x4b')](_0x4b97bb['query'],_0x199b13[_0x7c2c('0x4a')]),_0x536dcf);if(_0x4b97bb['query'][_0x7c2c('0x30')]){_0x31b1f2[_0x7c2c('0x49')]=_['merge'](_0x31b1f2[_0x7c2c('0x49')],{'$or':_['map'](_0x536dcf,function(_0x3014fb){if(_0x3014fb[_0x7c2c('0x35')]!==_0x7c2c('0x4c')){var _0x26351e={};_0x26351e[_0x3014fb['name']]={'$like':'%'+_0x4b97bb[_0x7c2c('0x41')]['filter']+'%'};return _0x26351e;}})});}_0x31b1f2=_['merge']({},_0x31b1f2,_0x4b97bb[_0x7c2c('0x4d')]);var _0xd0a1d3={'where':_0x31b1f2[_0x7c2c('0x49')]};return db['VoiceExtension'][_0x7c2c('0x20')](_0xd0a1d3)[_0x7c2c('0x28')](function(_0x5a1c93){_0x156c03[_0x7c2c('0x20')]=_0x5a1c93;if(_0x4b97bb['query'][_0x7c2c('0x4e')]){_0x31b1f2[_0x7c2c('0x4f')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x31b1f2);})[_0x7c2c('0x28')](function(_0x1c7c2b){_0x156c03['rows']=_0x1c7c2b;return _0x156c03;})[_0x7c2c('0x28')](respondWithFilteredResult(_0x15ee13,_0x31b1f2))['catch'](handleError(_0x15ee13,null));};exports['show']=function(_0x1e3e31,_0x2ca193){var _0x45bda3={'raw':![],'where':{'id':_0x1e3e31[_0x7c2c('0x50')]['id']}},_0x2dbfc8={};_0x2dbfc8[_0x7c2c('0x40')]=_[_0x7c2c('0x42')](db[_0x7c2c('0x3c')][_0x7c2c('0x3d')]);_0x2dbfc8['query']=_['keys'](_0x1e3e31[_0x7c2c('0x41')]);_0x2dbfc8[_0x7c2c('0x4a')]=_[_0x7c2c('0x51')](_0x2dbfc8['model'],_0x2dbfc8['query']);_0x45bda3[_0x7c2c('0x44')]=_[_0x7c2c('0x51')](_0x2dbfc8[_0x7c2c('0x40')],qs[_0x7c2c('0x43')](_0x1e3e31['query']['fields']));_0x45bda3['attributes']=_0x45bda3[_0x7c2c('0x44')][_0x7c2c('0x45')]?_0x45bda3[_0x7c2c('0x44')]:_0x2dbfc8[_0x7c2c('0x40')];if(_0x1e3e31[_0x7c2c('0x41')]['includeAll']){_0x45bda3[_0x7c2c('0x4f')]=[{'all':!![]}];}_0x45bda3=_[_0x7c2c('0x52')]({},_0x45bda3,_0x1e3e31['options']);return db[_0x7c2c('0x3c')]['find'](_0x45bda3)[_0x7c2c('0x28')](handleEntityNotFound(_0x2ca193,null))[_0x7c2c('0x28')](respondWithResult(_0x2ca193,null))[_0x7c2c('0x53')](handleError(_0x2ca193,null));};exports['destroy']=function(_0x5835cd,_0x327f3a){return db['VoiceExtension'][_0x7c2c('0x36')]({'where':{'id':_0x5835cd[_0x7c2c('0x50')]['id']}})['then'](handleEntityNotFound(_0x327f3a,null))[_0x7c2c('0x28')](removeEntity(_0x327f3a,null))[_0x7c2c('0x53')](handleError(_0x327f3a,null));};exports['create']=function(_0x25e278,_0x5d4d02){if(_0x25e278['body'][_0x7c2c('0x35')]===_0x7c2c('0x2d')&&!_[_0x7c2c('0x54')](_0x25e278['body'][_0x7c2c('0x55')],'_')){_0x25e278['body'][_0x7c2c('0x55')]='_'[_0x7c2c('0x56')](_0x25e278['body'][_0x7c2c('0x55')]);}return db[_0x7c2c('0x3c')][_0x7c2c('0x57')](_0x25e278[_0x7c2c('0x58')],{'raw':![]})['then'](function(_0xaa7a47){var _0x330be6=_0x25e278['user'][_0x7c2c('0x59')]({'plain':!![]});if(!_0x330be6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x330be6[_0x7c2c('0x5a')]===_0x7c2c('0x5b')){var _0x26b557=_0xaa7a47[_0x7c2c('0x59')]({'plain':!![]});var _0x35fcba=[{'name':'InboundRoutes','value':_0x7c2c('0x2b')},{'name':_0x7c2c('0x2c'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x1da746=_['find'](_0x35fcba,[_0x7c2c('0x33'),_0x26b557['type']])[_0x7c2c('0x37')];return db[_0x7c2c('0x5c')][_0x7c2c('0x36')]({'where':{'name':_0x1da746,'userProfileId':_0x330be6[_0x7c2c('0x5d')]},'raw':!![]})[_0x7c2c('0x28')](function(_0x1ee34d){if(_0x1ee34d&&_0x1ee34d[_0x7c2c('0x5e')]===0x0){return db[_0x7c2c('0x38')]['create']({'name':_0x26b557['name'],'resourceId':_0x26b557['id'],'type':_0x1ee34d['name'],'sectionId':_0x1ee34d['id']},{})[_0x7c2c('0x28')](function(){return _0xaa7a47;});}else{return _0xaa7a47;}})[_0x7c2c('0x53')](function(_0x233e9c){logger[_0x7c2c('0x39')](_0x7c2c('0x5f'),_0x233e9c);throw _0x233e9c;});}return _0xaa7a47;})[_0x7c2c('0x28')](respondWithResult(_0x5d4d02,0xc9))[_0x7c2c('0x53')](handleError(_0x5d4d02,null));};exports[_0x7c2c('0x60')]=function(_0x4c50c8,_0x54990d){if(_0x4c50c8[_0x7c2c('0x58')]['id']){delete _0x4c50c8[_0x7c2c('0x58')]['id'];}return db['VoiceExtension'][_0x7c2c('0x36')]({'where':{'id':_0x4c50c8['params']['id']}})['then'](handleEntityNotFound(_0x54990d,null))[_0x7c2c('0x28')](function(_0x118728){if(_0x118728){return db[_0x7c2c('0x3c')][_0x7c2c('0x60')](_[_0x7c2c('0x4b')](_0x4c50c8[_0x7c2c('0x58')],[_0x7c2c('0x55'),_0x7c2c('0x61'),_0x7c2c('0x62'),_0x7c2c('0x63'),_0x7c2c('0x64'),_0x7c2c('0x65')]),{'where':{'context':_0x118728[_0x7c2c('0x61')],'exten':_0x118728[_0x7c2c('0x55')]},'individualHooks':!![]})['then'](function(_0x1af153){return _0x1af153;});}return null;})['then'](respondWithStatusCode(_0x54990d,null))['catch'](handleError(_0x54990d,null));};exports['addApplications']=function(_0x4c0d0f,_0x719aa4,_0x34984b){return db[_0x7c2c('0x3c')][_0x7c2c('0x66')]({'where':{'id':_0x4c0d0f[_0x7c2c('0x50')]['id']}})[_0x7c2c('0x28')](handleEntityNotFound(_0x719aa4,null))['then'](function(_0x26fea7){if(_0x26fea7){return db[_0x7c2c('0x67')][_0x7c2c('0x68')](function(_0x21c5ff){return db[_0x7c2c('0x3c')][_0x7c2c('0x29')]({'where':{'VoiceExtensionId':_0x4c0d0f['params']['id']},'transaction':_0x21c5ff})[_0x7c2c('0x28')](function(_0x1935bf){var _0x49872b=_[_0x7c2c('0x32')](_0x4c0d0f[_0x7c2c('0x58')],function(_0x53e81e){_0x53e81e[_0x7c2c('0x69')]=_0x4c0d0f[_0x7c2c('0x50')]['id'];return _0x53e81e;});return db['VoiceExtension']['bulkCreate'](_0x49872b,{'transaction':_0x21c5ff});});})[_0x7c2c('0x28')](function(){return db['VoiceExtension'][_0x7c2c('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4c0d0f['params']['id']},'order':_0x7c2c('0x6b')});});}})[_0x7c2c('0x28')](respondWithResult(_0x719aa4,null))['catch'](handleError(_0x719aa4,null));}; \ No newline at end of file +var _0x7a54=['then','get','inbound','outbound','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','error','name','index','VoiceExtension','rawAttributes','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','rows','catch','show','params','keys','includeAll','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','UserProfileSection','userProfileId','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x7a54,0x106));var _0x47a5=function(_0x1bf128,_0x4e61f2){_0x1bf128=_0x1bf128-0x0;var _0x4a365c=_0x7a54[_0x1bf128];return _0x4a365c;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){var _0x129ce5=_0x28747d[_0x47a5('0x27')]({'plain':!![]});var _0x50bf17=[{'name':'InboundRoutes','value':_0x47a5('0x28'),'ignore':![]},{'name':'OutboundRoutes','value':_0x47a5('0x29'),'ignore':![]},{'name':'InternalRoutes','value':_0x47a5('0x2a'),'ignore':![]}];var _0x378208=_(_0x50bf17)[_0x47a5('0x2b')](_0x47a5('0x2c'))[_0x47a5('0x2d')](_0x47a5('0x2e'))[_0x47a5('0x2e')]();if(_[_0x47a5('0x2f')](_0x378208,_0x129ce5[_0x47a5('0x30')])){return;}var _0x361bfa=_[_0x47a5('0x31')](_0x50bf17,[_0x47a5('0x2e'),_0x129ce5[_0x47a5('0x30')]])['name'];return db[_0x47a5('0x32')]['destroy']({'where':{'type':_0x361bfa,'resourceId':_0x129ce5['id']}})[_0x47a5('0x26')](function(){return _0x28747d;});})[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256650,_0x625952){return function(_0x39b50b){if(!_0x39b50b){_0x256650[_0x47a5('0x1a')](0x194);}return _0x39b50b;};}function handleError(_0x51cc81,_0x50d875){_0x50d875=_0x50d875||0x1f4;return function(_0x6f9a12){logger[_0x47a5('0x33')](_0x6f9a12['stack']);if(_0x6f9a12['name']){delete _0x6f9a12[_0x47a5('0x34')];}_0x51cc81[_0x47a5('0x1c')](_0x50d875)['send'](_0x6f9a12);};}exports[_0x47a5('0x35')]=function(_0x53119b,_0x122ed6){var _0xd972c={},_0x5c5162={},_0x4843c0={'count':0x0,'rows':[]};var _0x274e34=_['map'](db[_0x47a5('0x36')][_0x47a5('0x37')],function(_0xf269a8){return{'name':_0xf269a8['fieldName'],'type':_0xf269a8[_0x47a5('0x30')]['key']};});_0x5c5162['model']=_[_0x47a5('0x2d')](_0x274e34,'name');_0x5c5162[_0x47a5('0x38')]=_['keys'](_0x53119b[_0x47a5('0x38')]);_0x5c5162[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5c5162[_0x47a5('0x3b')],_0x5c5162[_0x47a5('0x38')]);_0xd972c[_0x47a5('0x3c')]=_[_0x47a5('0x3a')](_0x5c5162[_0x47a5('0x3b')],qs[_0x47a5('0x3d')](_0x53119b['query'][_0x47a5('0x3d')]));_0xd972c[_0x47a5('0x3c')]=_0xd972c['attributes'][_0x47a5('0x3e')]?_0xd972c[_0x47a5('0x3c')]:_0x5c5162[_0x47a5('0x3b')];if(!_0x53119b['query'][_0x47a5('0x3f')](_0x47a5('0x40'))){_0xd972c['limit']=qs[_0x47a5('0x1f')](_0x53119b[_0x47a5('0x38')]['limit']);_0xd972c['offset']=qs['offset'](_0x53119b[_0x47a5('0x38')]['offset']);}_0xd972c[_0x47a5('0x41')]=qs[_0x47a5('0x42')](_0x53119b[_0x47a5('0x38')][_0x47a5('0x42')]);_0xd972c[_0x47a5('0x43')]=qs[_0x47a5('0x39')](_[_0x47a5('0x44')](_0x53119b[_0x47a5('0x38')],_0x5c5162[_0x47a5('0x39')]),_0x274e34);if(_0x53119b[_0x47a5('0x38')][_0x47a5('0x2b')]){_0xd972c[_0x47a5('0x43')]=_[_0x47a5('0x45')](_0xd972c['where'],{'$or':_[_0x47a5('0x2d')](_0x274e34,function(_0x1c36fa){if(_0x1c36fa[_0x47a5('0x30')]!==_0x47a5('0x46')){var _0x586f4f={};_0x586f4f[_0x1c36fa[_0x47a5('0x34')]]={'$like':'%'+_0x53119b['query']['filter']+'%'};return _0x586f4f;}})});}_0xd972c=_['merge']({},_0xd972c,_0x53119b['options']);var _0x27dd5d={'where':_0xd972c['where']};return db[_0x47a5('0x36')][_0x47a5('0x1d')](_0x27dd5d)[_0x47a5('0x26')](function(_0x494526){_0x4843c0[_0x47a5('0x1d')]=_0x494526;if(_0x53119b[_0x47a5('0x38')]['includeAll']){_0xd972c['include']=[{'all':!![]}];}return db[_0x47a5('0x36')]['findAll'](_0xd972c);})[_0x47a5('0x26')](function(_0x4703b2){_0x4843c0[_0x47a5('0x47')]=_0x4703b2;return _0x4843c0;})[_0x47a5('0x26')](respondWithFilteredResult(_0x122ed6,_0xd972c))[_0x47a5('0x48')](handleError(_0x122ed6,null));};exports[_0x47a5('0x49')]=function(_0x434227,_0x17cc42){var _0xac9c15={'raw':![],'where':{'id':_0x434227[_0x47a5('0x4a')]['id']}},_0x162fa0={};_0x162fa0[_0x47a5('0x3b')]=_[_0x47a5('0x4b')](db[_0x47a5('0x36')][_0x47a5('0x37')]);_0x162fa0[_0x47a5('0x38')]=_['keys'](_0x434227[_0x47a5('0x38')]);_0x162fa0[_0x47a5('0x39')]=_['intersection'](_0x162fa0['model'],_0x162fa0[_0x47a5('0x38')]);_0xac9c15['attributes']=_[_0x47a5('0x3a')](_0x162fa0[_0x47a5('0x3b')],qs['fields'](_0x434227['query'][_0x47a5('0x3d')]));_0xac9c15['attributes']=_0xac9c15[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0xac9c15[_0x47a5('0x3c')]:_0x162fa0[_0x47a5('0x3b')];if(_0x434227[_0x47a5('0x38')][_0x47a5('0x4c')]){_0xac9c15[_0x47a5('0x4d')]=[{'all':!![]}];}_0xac9c15=_['merge']({},_0xac9c15,_0x434227['options']);return db[_0x47a5('0x36')][_0x47a5('0x31')](_0xac9c15)[_0x47a5('0x26')](handleEntityNotFound(_0x17cc42,null))[_0x47a5('0x26')](respondWithResult(_0x17cc42,null))[_0x47a5('0x48')](handleError(_0x17cc42,null));};exports[_0x47a5('0x25')]=function(_0x249de5,_0x492cf7){return db[_0x47a5('0x36')][_0x47a5('0x31')]({'where':{'id':_0x249de5[_0x47a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x492cf7,null))[_0x47a5('0x26')](removeEntity(_0x492cf7,null))['catch'](handleError(_0x492cf7,null));};exports[_0x47a5('0x4e')]=function(_0xe31817,_0x46e90b){if(_0xe31817[_0x47a5('0x4f')]['type']===_0x47a5('0x29')&&!_[_0x47a5('0x50')](_0xe31817[_0x47a5('0x4f')][_0x47a5('0x51')],'_')){_0xe31817[_0x47a5('0x4f')][_0x47a5('0x51')]='_'[_0x47a5('0x52')](_0xe31817['body'][_0x47a5('0x51')]);}return db[_0x47a5('0x36')][_0x47a5('0x4e')](_0xe31817[_0x47a5('0x4f')],{'raw':![]})[_0x47a5('0x26')](function(_0x1ab0bf){var _0x572233=_0xe31817[_0x47a5('0x53')][_0x47a5('0x27')]({'plain':!![]});if(!_0x572233)throw new Error(_0x47a5('0x54'));if(_0x572233['role']===_0x47a5('0x53')){var _0x3c78b7=_0x1ab0bf[_0x47a5('0x27')]({'plain':!![]});var _0x5d8d4a=[{'name':'InboundRoutes','value':_0x47a5('0x28')},{'name':_0x47a5('0x55'),'value':'outbound'},{'name':'InternalRoutes','value':_0x47a5('0x2a')}];var _0x4d6a82=_[_0x47a5('0x31')](_0x5d8d4a,['value',_0x3c78b7['type']])[_0x47a5('0x34')];return db[_0x47a5('0x56')]['find']({'where':{'name':_0x4d6a82,'userProfileId':_0x572233[_0x47a5('0x57')]},'raw':!![]})[_0x47a5('0x26')](function(_0x4b706a){if(_0x4b706a&&_0x4b706a['autoAssociation']===0x0){return db[_0x47a5('0x32')][_0x47a5('0x4e')]({'name':_0x3c78b7[_0x47a5('0x34')],'resourceId':_0x3c78b7['id'],'type':_0x4b706a[_0x47a5('0x34')],'sectionId':_0x4b706a['id']},{})['then'](function(){return _0x1ab0bf;});}else{return _0x1ab0bf;}})[_0x47a5('0x48')](function(_0x2b4255){logger[_0x47a5('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4255);throw _0x2b4255;});}return _0x1ab0bf;})[_0x47a5('0x26')](respondWithResult(_0x46e90b,0xc9))['catch'](handleError(_0x46e90b,null));};exports[_0x47a5('0x24')]=function(_0x470da6,_0x943a15){if(_0x470da6[_0x47a5('0x4f')]['id']){delete _0x470da6[_0x47a5('0x4f')]['id'];}return db['VoiceExtension'][_0x47a5('0x31')]({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))['then'](function(_0x4f8564){if(_0x4f8564){return db[_0x47a5('0x36')][_0x47a5('0x24')](_[_0x47a5('0x44')](_0x470da6['body'],['exten',_0x47a5('0x58'),_0x47a5('0x59'),_0x47a5('0x5a'),_0x47a5('0x5b'),_0x47a5('0x5c')]),{'where':{'context':_0x4f8564['context'],'exten':_0x4f8564[_0x47a5('0x51')]},'individualHooks':!![]})['then'](function(_0x22c886){return _0x22c886;});}return null;})[_0x47a5('0x26')](respondWithStatusCode(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports[_0x47a5('0x5d')]=function(_0x345104,_0x132854,_0x3e8274){return db[_0x47a5('0x36')][_0x47a5('0x5e')]({'where':{'id':_0x345104[_0x47a5('0x4a')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x132854,null))['then'](function(_0x2dcc3b){if(_0x2dcc3b){return db[_0x47a5('0x5f')][_0x47a5('0x60')](function(_0x26e7fc){return db[_0x47a5('0x36')]['destroy']({'where':{'VoiceExtensionId':_0x345104[_0x47a5('0x4a')]['id']},'transaction':_0x26e7fc})[_0x47a5('0x26')](function(_0x1224bc){var _0x144aaa=_[_0x47a5('0x2d')](_0x345104[_0x47a5('0x4f')],function(_0x453191){_0x453191[_0x47a5('0x61')]=_0x345104[_0x47a5('0x4a')]['id'];return _0x453191;});return db[_0x47a5('0x36')][_0x47a5('0x62')](_0x144aaa,{'transaction':_0x26e7fc});});})[_0x47a5('0x26')](function(){return db[_0x47a5('0x36')][_0x47a5('0x63')]({'where':{'isApp':!![],'VoiceExtensionId':_0x345104[_0x47a5('0x4a')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x47a5('0x26')](respondWithResult(_0x132854,null))[_0x47a5('0x48')](handleError(_0x132854,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f9de119..a6d28b9 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 _0x84bb=['../../mysqldb','VoiceExtension','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x20830b,_0x3c5859){var _0x2bc4af=function(_0x5980f8){while(--_0x5980f8){_0x20830b['push'](_0x20830b['shift']());}};_0x2bc4af(++_0x3c5859);}(_0x84bb,0x1d7));var _0xb84b=function(_0x26f68f,_0x125079){_0x26f68f=_0x26f68f-0x0;var _0x3047dd=_0x84bb[_0x26f68f];return _0x3047dd;};'use strict';var EventEmitter=require(_0xb84b('0x0'));var VoiceExtension=require(_0xb84b('0x1'))['db'][_0xb84b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb84b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb84b('0x4')};function emitEvent(_0x3213c8){return function(_0x257657,_0x112af5,_0x2136e3){VoiceExtensionEvents[_0xb84b('0x5')](_0x3213c8+':'+_0x257657['id'],_0x257657);VoiceExtensionEvents[_0xb84b('0x5')](_0x3213c8,_0x257657);_0x2136e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb84b('0x6')](e,emitEvent(event));}}module[_0xb84b('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0d0a=['hook','exports','../../mysqldb','save','remove','emit'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x0d0a,0xda));var _0xa0d0=function(_0x58c67a,_0x1fdf49){_0x58c67a=_0x58c67a-0x0;var _0x2ada00=_0x0d0a[_0x58c67a];return _0x2ada00;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xa0d0('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa0d0('0x1'),'afterUpdate':'update','afterDestroy':_0xa0d0('0x2')};function emitEvent(_0xd07aa9){return function(_0x336927,_0xd15ffc,_0x17e2f5){VoiceExtensionEvents['emit'](_0xd07aa9+':'+_0x336927['id'],_0x336927);VoiceExtensionEvents[_0xa0d0('0x3')](_0xd07aa9,_0x336927);_0x17e2f5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xa0d0('0x4')](e,emitEvent(event));}}module[_0xa0d0('0x5')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index fd46470..da5816c 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 _0x2ef3=['exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceExtension.attributes'];(function(_0x585ba0,_0x2836e3){var _0xa4e968=function(_0x4ff9a6){while(--_0x4ff9a6){_0x585ba0['push'](_0x585ba0['shift']());}};_0xa4e968(++_0x2836e3);}(_0x2ef3,0xba));var _0x32ef=function(_0x12f457,_0xa9b466){_0x12f457=_0x12f457-0x0;var _0x596059=_0x2ef3[_0x12f457];return _0x596059;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','VoiceExtension','voice_extensions','util','api','moment'];(function(_0x416dd0,_0x14a79e){var _0x447f78=function(_0x5daefb){while(--_0x5daefb){_0x416dd0['push'](_0x416dd0['shift']());}};_0x447f78(++_0x14a79e);}(_0xadb5,0xad));var _0x5adb=function(_0x3ff7ec,_0x45f2b1){_0x3ff7ec=_0x3ff7ec-0x0;var _0xd817b6=_0xadb5[_0x3ff7ec];return _0xd817b6;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./voiceExtension.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 0e77703..c8c98f4 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 _0x6f1f=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','map','include','model','catch','lodash'];(function(_0x4159e9,_0x1714ff){var _0x30a9ae=function(_0x47465a){while(--_0x47465a){_0x4159e9['push'](_0x4159e9['shift']());}};_0x30a9ae(++_0x1714ff);}(_0x6f1f,0x185));var _0xf6f1=function(_0xf0dbc3,_0x52926f){_0xf0dbc3=_0xf0dbc3-0x0;var _0xa95a79=_0x6f1f[_0xf0dbc3];return _0xa95a79;};'use strict';var _=require(_0xf6f1('0x0'));var util=require(_0xf6f1('0x1'));var moment=require(_0xf6f1('0x2'));var BPromise=require('bluebird');var rs=require(_0xf6f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf6f1('0x4'));var logger=require(_0xf6f1('0x5'))(_0xf6f1('0x6'));var config=require('../../config/environment');var jayson=require(_0xf6f1('0x7'));var client=jayson[_0xf6f1('0x8')][_0xf6f1('0x9')]({'port':0x232a});config[_0xf6f1('0xa')]=_[_0xf6f1('0xb')](config['redis'],{'host':_0xf6f1('0xc'),'port':0x18eb});var socket=require(_0xf6f1('0xd'))(new Redis(config[_0xf6f1('0xa')]));require(_0xf6f1('0xe'))['register'](socket);function respondWithRpcPromise(_0x5d18e0,_0x2db8ed,_0x3f6d1f){return new BPromise(function(_0x593e94,_0x447539){return client[_0xf6f1('0xf')](_0x5d18e0,_0x3f6d1f)[_0xf6f1('0x10')](function(_0x468453){logger[_0xf6f1('0x11')](_0xf6f1('0x12'),_0x2db8ed,_0xf6f1('0x13'));logger[_0xf6f1('0x14')](_0xf6f1('0x15'),_0x2db8ed,'request\x20sent',JSON[_0xf6f1('0x16')](_0x468453));if(_0x468453[_0xf6f1('0x17')]){if(_0x468453[_0xf6f1('0x17')][_0xf6f1('0x18')]===0x1f4){logger[_0xf6f1('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x2db8ed,_0x468453['error'][_0xf6f1('0x19')]);return _0x447539(_0x468453[_0xf6f1('0x17')][_0xf6f1('0x19')]);}logger[_0xf6f1('0x17')](_0xf6f1('0x12'),_0x2db8ed,_0x468453[_0xf6f1('0x17')]['message']);return _0x593e94(_0x468453[_0xf6f1('0x17')]['message']);}else{logger[_0xf6f1('0x11')](_0xf6f1('0x12'),_0x2db8ed,_0xf6f1('0x13'));_0x593e94(_0x468453[_0xf6f1('0x1a')][_0xf6f1('0x19')]);}})['catch'](function(_0x49747a){logger[_0xf6f1('0x17')](_0xf6f1('0x12'),_0x2db8ed,_0x49747a);_0x447539(_0x49747a);});});}exports[_0xf6f1('0x1b')]=function(_0x30d6f2){var _0x4fbf70=this;return new Promise(function(_0x5fcdab,_0x1c5d9e){return db[_0xf6f1('0x1c')][_0xf6f1('0x1d')]({'raw':_0x30d6f2[_0xf6f1('0x1e')]?_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x1f')]===undefined?!![]:![]:!![],'where':_0x30d6f2[_0xf6f1('0x1e')]?_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x20')]||null:null,'attributes':_0x30d6f2['options']?_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x21')]||null:null,'limit':_0x30d6f2[_0xf6f1('0x1e')]?_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x22')]||null:null,'include':_0x30d6f2[_0xf6f1('0x1e')]?_0x30d6f2[_0xf6f1('0x1e')]['include']?_[_0xf6f1('0x23')](_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x24')],function(_0x499828){return{'model':db[_0x499828['model']],'as':_0x499828['as'],'attributes':_0x499828['attributes'],'include':_0x499828[_0xf6f1('0x24')]?_[_0xf6f1('0x23')](_0x499828[_0xf6f1('0x24')],function(_0x2d6a76){return{'model':db[_0x2d6a76['model']],'as':_0x2d6a76['as'],'attributes':_0x2d6a76[_0xf6f1('0x21')],'include':_0x2d6a76['include']?_[_0xf6f1('0x23')](_0x2d6a76[_0xf6f1('0x24')],function(_0x10f721){return{'model':db[_0x10f721[_0xf6f1('0x25')]],'as':_0x10f721['as'],'attributes':_0x10f721[_0xf6f1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf6f1('0x10')](function(_0x17eef3){logger[_0xf6f1('0x11')](_0xf6f1('0x1b'),_0x30d6f2);logger[_0xf6f1('0x14')](_0xf6f1('0x1b'),_0x30d6f2,JSON[_0xf6f1('0x16')](_0x17eef3));_0x5fcdab(_0x17eef3);})[_0xf6f1('0x26')](function(_0x49a578){logger['error'](_0xf6f1('0x1b'),_0x49a578[_0xf6f1('0x19')],_0x30d6f2);_0x1c5d9e(_0x4fbf70[_0xf6f1('0x17')](0x1f4,_0x49a578[_0xf6f1('0x19')]));});});}; \ No newline at end of file +var _0xc244=['client','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x49d392,_0x2a3071){var _0x195e32=function(_0x4d755a){while(--_0x4d755a){_0x49d392['push'](_0x49d392['shift']());}};_0x195e32(++_0x2a3071);}(_0xc244,0x88));var _0x4c24=function(_0xc85173,_0x4a3205){_0xc85173=_0xc85173-0x0;var _0x108400=_0xc244[_0xc85173];return _0x108400;};'use strict';var _=require(_0x4c24('0x0'));var util=require('util');var moment=require(_0x4c24('0x1'));var BPromise=require(_0x4c24('0x2'));var rs=require(_0x4c24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c24('0x4'))['db'];var utils=require(_0x4c24('0x5'));var logger=require('../../config/logger')(_0x4c24('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c24('0x7'));var client=jayson[_0x4c24('0x8')]['http']({'port':0x232a});config[_0x4c24('0x9')]=_['defaults'](config[_0x4c24('0x9')],{'host':_0x4c24('0xa'),'port':0x18eb});var socket=require(_0x4c24('0xb'))(new Redis(config[_0x4c24('0x9')]));require(_0x4c24('0xc'))[_0x4c24('0xd')](socket);function respondWithRpcPromise(_0x1852ac,_0x5414be,_0xe02baa){return new BPromise(function(_0x19c88b,_0xd9921){return client[_0x4c24('0xe')](_0x1852ac,_0xe02baa)[_0x4c24('0xf')](function(_0x26ae8a){logger[_0x4c24('0x10')](_0x4c24('0x11'),_0x5414be,_0x4c24('0x12'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x5414be,_0x4c24('0x12'),JSON[_0x4c24('0x13')](_0x26ae8a));if(_0x26ae8a[_0x4c24('0x14')]){if(_0x26ae8a[_0x4c24('0x14')][_0x4c24('0x15')]===0x1f4){logger[_0x4c24('0x14')](_0x4c24('0x11'),_0x5414be,_0x26ae8a[_0x4c24('0x14')][_0x4c24('0x16')]);return _0xd9921(_0x26ae8a[_0x4c24('0x14')][_0x4c24('0x16')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5414be,_0x26ae8a[_0x4c24('0x14')][_0x4c24('0x16')]);return _0x19c88b(_0x26ae8a['error'][_0x4c24('0x16')]);}else{logger['info'](_0x4c24('0x11'),_0x5414be,_0x4c24('0x12'));_0x19c88b(_0x26ae8a[_0x4c24('0x17')][_0x4c24('0x16')]);}})['catch'](function(_0x31171f){logger[_0x4c24('0x14')](_0x4c24('0x11'),_0x5414be,_0x31171f);_0xd9921(_0x31171f);});});}exports[_0x4c24('0x18')]=function(_0x5ec49a){var _0x32d15d=this;return new Promise(function(_0x612027,_0x5ad14c){return db[_0x4c24('0x19')][_0x4c24('0x1a')]({'raw':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a[_0x4c24('0x1b')][_0x4c24('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a['options'][_0x4c24('0x1d')]||null:null,'attributes':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a[_0x4c24('0x1b')][_0x4c24('0x1e')]||null:null,'limit':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a['options'][_0x4c24('0x1f')]||null:null,'include':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a[_0x4c24('0x1b')][_0x4c24('0x20')]?_[_0x4c24('0x21')](_0x5ec49a[_0x4c24('0x1b')][_0x4c24('0x20')],function(_0x19fcd0){return{'model':db[_0x19fcd0['model']],'as':_0x19fcd0['as'],'attributes':_0x19fcd0[_0x4c24('0x1e')],'include':_0x19fcd0[_0x4c24('0x20')]?_[_0x4c24('0x21')](_0x19fcd0[_0x4c24('0x20')],function(_0x297b24){return{'model':db[_0x297b24['model']],'as':_0x297b24['as'],'attributes':_0x297b24[_0x4c24('0x1e')],'include':_0x297b24[_0x4c24('0x20')]?_[_0x4c24('0x21')](_0x297b24['include'],function(_0x11388e){return{'model':db[_0x11388e['model']],'as':_0x11388e['as'],'attributes':_0x11388e['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c24('0xf')](function(_0xb2b170){logger['info'](_0x4c24('0x18'),_0x5ec49a);logger[_0x4c24('0x22')]('GetVoiceExtension',_0x5ec49a,JSON[_0x4c24('0x13')](_0xb2b170));_0x612027(_0xb2b170);})[_0x4c24('0x23')](function(_0x5defc9){logger[_0x4c24('0x14')](_0x4c24('0x18'),_0x5defc9[_0x4c24('0x16')],_0x5ec49a);_0x5ad14c(_0x32d15d[_0x4c24('0x14')](0x1f4,_0x5defc9[_0x4c24('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c2cda1d..10455c7 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 _0x299c=['register','length','voiceExtension:','./voiceExtension.events','remove','update'];(function(_0x251678,_0x51067b){var _0x2da780=function(_0x281c11){while(--_0x281c11){_0x251678['push'](_0x251678['shift']());}};_0x2da780(++_0x51067b);}(_0x299c,0xe1));var _0xc299=function(_0x246dd5,_0x514b86){_0x246dd5=_0x246dd5-0x0;var _0xaffcba=_0x299c[_0x246dd5];return _0xaffcba;};'use strict';var VoiceExtensionEvents=require(_0xc299('0x0'));var events=['save',_0xc299('0x1'),_0xc299('0x2')];function createListener(_0x114921,_0x5c3e3d){return function(_0x48d2e4){_0x5c3e3d['emit'](_0x114921,_0x48d2e4);};}function removeListener(_0x35c10b,_0x22c480){return function(){VoiceExtensionEvents['removeListener'](_0x35c10b,_0x22c480);};}exports[_0xc299('0x3')]=function(_0x15c662){for(var _0x12d279=0x0,_0x5ac5c=events[_0xc299('0x4')];_0x12d279<_0x5ac5c;_0x12d279++){var _0x1b843f=events[_0x12d279];var _0x5cb191=createListener(_0xc299('0x5')+_0x1b843f,_0x15c662);VoiceExtensionEvents['on'](_0x1b843f,_0x5cb191);}}; \ No newline at end of file +var _0xd769=['register','length','./voiceExtension.events','save','remove','update','removeListener'];(function(_0x2d4e41,_0x1f1b7f){var _0x31f398=function(_0x49636d){while(--_0x49636d){_0x2d4e41['push'](_0x2d4e41['shift']());}};_0x31f398(++_0x1f1b7f);}(_0xd769,0x1ad));var _0x9d76=function(_0x5f3da8,_0x4eb6ea){_0x5f3da8=_0x5f3da8-0x0;var _0x4eaf62=_0xd769[_0x5f3da8];return _0x4eaf62;};'use strict';var VoiceExtensionEvents=require(_0x9d76('0x0'));var events=[_0x9d76('0x1'),_0x9d76('0x2'),_0x9d76('0x3')];function createListener(_0xed08b9,_0x2dcbdd){return function(_0x57f957){_0x2dcbdd['emit'](_0xed08b9,_0x57f957);};}function removeListener(_0x5ef62c,_0x45202d){return function(){VoiceExtensionEvents[_0x9d76('0x4')](_0x5ef62c,_0x45202d);};}exports[_0x9d76('0x5')]=function(_0x3fc24b){for(var _0x49fb1e=0x0,_0x307d7d=events[_0x9d76('0x6')];_0x49fb1e<_0x307d7d;_0x49fb1e++){var _0x510082=events[_0x49fb1e];var _0x4ca89c=createListener('voiceExtension:'+_0x510082,_0x3fc24b);VoiceExtensionEvents['on'](_0x510082,_0x4ca89c);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 575dda0..35722a9 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 _0xa13c=['isAuthenticated','index','/:id','show','/:id/messages','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../config/environment','./voiceMail.controller','get'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0xa13c,0xad));var _0xca13=function(_0x3311a8,_0x687538){_0x3311a8=_0x3311a8-0x0;var _0x596ee6=_0xa13c[_0x3311a8];return _0x596ee6;};'use strict';var multer=require('multer');var util=require(_0xca13('0x0'));var path=require('path');var timeout=require(_0xca13('0x1'));var express=require(_0xca13('0x2'));var router=express[_0xca13('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xca13('0x4'));var controller=require(_0xca13('0x5'));router[_0xca13('0x6')]('/',auth[_0xca13('0x7')](),controller[_0xca13('0x8')]);router[_0xca13('0x6')](_0xca13('0x9'),auth['isAuthenticated'](),controller[_0xca13('0xa')]);router[_0xca13('0x6')](_0xca13('0xb'),auth[_0xca13('0x7')](),controller['getMessages']);router[_0xca13('0xc')]('/',auth['isAuthenticated'](),controller[_0xca13('0xd')]);router['put'](_0xca13('0x9'),auth[_0xca13('0x7')](),controller[_0xca13('0xe')]);router[_0xca13('0xf')](_0xca13('0x9'),auth[_0xca13('0x7')](),controller[_0xca13('0x10')]);module[_0xca13('0x11')]=router; \ No newline at end of file +var _0xf04f=['exports','util','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','post','create','put','/:id','update','delete'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0xf04f,0xb5));var _0xff04=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf04f[_0x46698a];return _0x356db0;};'use strict';var multer=require('multer');var util=require(_0xff04('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff04('0x1')]();var auth=require(_0xff04('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xff04('0x3'));var controller=require(_0xff04('0x4'));router[_0xff04('0x5')]('/',auth[_0xff04('0x6')](),controller[_0xff04('0x7')]);router['get']('/:id',auth[_0xff04('0x6')](),controller[_0xff04('0x8')]);router[_0xff04('0x5')](_0xff04('0x9'),auth['isAuthenticated'](),controller[_0xff04('0xa')]);router[_0xff04('0xb')]('/',auth['isAuthenticated'](),controller[_0xff04('0xc')]);router[_0xff04('0xd')](_0xff04('0xe'),auth[_0xff04('0x6')](),controller[_0xff04('0xf')]);router[_0xff04('0x10')](_0xff04('0xe'),auth[_0xff04('0x6')](),controller['destroy']);module[_0xff04('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 1fd2a6f..9f7d45b 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 _0x8603=['exports','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x36153d,_0x4fed67){var _0xfdacff=function(_0x2ad55d){while(--_0x2ad55d){_0x36153d['push'](_0x36153d['shift']());}};_0xfdacff(++_0x4fed67);}(_0x8603,0x190));var _0x3860=function(_0x533984,_0x55d0c4){_0x533984=_0x533984-0x0;var _0x533873=_0x8603[_0x533984];return _0x533873;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'customer_id':{'type':Sequelize[_0x3860('0x1')]},'context':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3860('0x2')},'password':{'type':Sequelize[_0x3860('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3860('0x1')],'validate':{'isEmail':!![]},'set':function(_0x56f8c5){this[_0x3860('0x3')](_0x3860('0x4'),typeof _0x56f8c5===_0x3860('0x5')&&_0x56f8c5[_0x3860('0x6')]()?_0x56f8c5[_0x3860('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3860('0x1')]},'callback':{'type':Sequelize[_0x3860('0x1')]},'review':{'type':Sequelize['ENUM'](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3860('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'stamp':{'type':_0x3860('0xa')},'emailsubject':{'type':Sequelize[_0x3860('0x1')]},'emailbody':{'type':Sequelize[_0x3860('0x1')]},'maxsecs':{'type':Sequelize[_0x3860('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3860('0xc')](_0x3860('0xd'))+_0x3860('0xe')+this['getDataValue'](_0x3860('0xf'));}}}; \ No newline at end of file +var _0x4cf8=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue'];(function(_0x3b1602,_0x165349){var _0x50103d=function(_0x271f2f){while(--_0x271f2f){_0x3b1602['push'](_0x3b1602['shift']());}};_0x50103d(++_0x165349);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x4cf8[_0x671369];return _0x33f2b4;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'customer_id':{'type':Sequelize[_0x84cf('0x2')]},'context':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':_0x84cf('0x3'),'unique':_0x84cf('0x4')},'mailbox':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':'','allowNull':![],'unique':_0x84cf('0x4')},'password':{'type':Sequelize[_0x84cf('0x2')]},'fullname':{'type':Sequelize[_0x84cf('0x2')]},'email':{'type':Sequelize[_0x84cf('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2c613d){this['setDataValue']('email',typeof _0x2c613d===_0x84cf('0x5')&&_0x2c613d['trim']()?_0x2c613d[_0x84cf('0x6')]():null);}},'pager':{'type':Sequelize[_0x84cf('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x84cf('0x7')},'attach':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x84cf('0x2')]},'review':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x84cf('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x84cf('0xb')},'emailsubject':{'type':Sequelize[_0x84cf('0x2')]},'emailbody':{'type':Sequelize[_0x84cf('0x2')]},'maxsecs':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x84cf('0xd')],'get':function(){return this[_0x84cf('0xe')]('fullname')+'\x20-\x20'+this[_0x84cf('0xe')](_0x84cf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f15dade..aea8a81 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 _0x8fea=['status','json','count','offset','set','apply','save','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','VoiceMail','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','options','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x8fea,0x8c));var _0xa8fe=function(_0x47ab21,_0x3907b6){_0x47ab21=_0x47ab21-0x0;var _0x1104e3=_0x8fea[_0x47ab21];return _0x1104e3;};'use strict';var pdf=require(_0xa8fe('0x0'));var emlformat=require(_0xa8fe('0x1'));var rimraf=require(_0xa8fe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8fe('0x3'));var rp=require(_0xa8fe('0x4'));var moment=require(_0xa8fe('0x5'));var BPromise=require(_0xa8fe('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa8fe('0x7'));var sox=require(_0xa8fe('0x8'));var csv=require('to-csv');var ejs=require(_0xa8fe('0x9'));var fs=require('fs');var _=require(_0xa8fe('0xa'));var squel=require(_0xa8fe('0xb'));var crypto=require(_0xa8fe('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa8fe('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa8fe('0xe'));var Papa=require('papaparse');var Redis=require(_0xa8fe('0xf'));var authService=require(_0xa8fe('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa8fe('0x11'));var hardwareService=require(_0xa8fe('0x12'));var logger=require('../../config/logger')(_0xa8fe('0x13'));var utils=require(_0xa8fe('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ae854,_0x574829){_0x574829=_0x574829||0xcc;return function(_0x103a70){if(_0x103a70){return _0x5ae854[_0xa8fe('0x15')](_0x574829);}return _0x5ae854[_0xa8fe('0x16')](_0x574829)['end']();};}function respondWithResult(_0x142a0d,_0x5b1acc){_0x5b1acc=_0x5b1acc||0xc8;return function(_0x212165){if(_0x212165){return _0x142a0d[_0xa8fe('0x16')](_0x5b1acc)[_0xa8fe('0x17')](_0x212165);}};}function respondWithFilteredResult(_0x158178,_0x33329b){return function(_0x487443){if(_0x487443){var _0x596f7b=_0x487443[_0xa8fe('0x18')],_0x1594d4=_0x33329b[_0xa8fe('0x19')],_0x36cf96=_0x33329b['offset']+_0x33329b['limit'],_0x9231dd;if(_0x36cf96>=_0x596f7b){_0x36cf96=_0x596f7b;_0x9231dd=0xc8;}else{_0x9231dd=0xce;}_0x158178['status'](_0x9231dd);return _0x158178[_0xa8fe('0x1a')]('Content-Range',_0x1594d4+'-'+_0x36cf96+'/'+_0x596f7b)[_0xa8fe('0x17')](_0x487443);}return null;};}function patchUpdates(_0x29115f){return function(_0x5b9989){try{jsonpatch[_0xa8fe('0x1b')](_0x5b9989,_0x29115f,!![]);}catch(_0x4b58c6){return BPromise['reject'](_0x4b58c6);}return _0x5b9989[_0xa8fe('0x1c')]();};}function saveUpdates(_0x336d16,_0x467d7c){return function(_0x2ff329){if(_0x2ff329){return _0x2ff329['update'](_0x336d16)[_0xa8fe('0x1d')](function(_0x442c0c){return _0x442c0c;});}return null;};}function removeEntity(_0x5a6bfb,_0x4fd70a){return function(_0x3c7fa9){if(_0x3c7fa9){return _0x3c7fa9['destroy']()[_0xa8fe('0x1d')](function(){var _0x40f758=_0x3c7fa9[_0xa8fe('0x1e')]({'plain':!![]});var _0x3f70ff=_0xa8fe('0x1f');return db[_0xa8fe('0x20')][_0xa8fe('0x21')]({'where':{'type':_0x3f70ff,'resourceId':_0x40f758['id']}})[_0xa8fe('0x1d')](function(){return _0x3c7fa9;});})[_0xa8fe('0x1d')](function(){_0x5a6bfb[_0xa8fe('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f3cdc,_0x5a37b1){return function(_0x3fc680){if(!_0x3fc680){_0x5f3cdc[_0xa8fe('0x15')](0x194);}return _0x3fc680;};}function handleError(_0x3d4965,_0x1ab0df){_0x1ab0df=_0x1ab0df||0x1f4;return function(_0x5c29bc){logger[_0xa8fe('0x22')](_0x5c29bc[_0xa8fe('0x23')]);if(_0x5c29bc[_0xa8fe('0x24')]){delete _0x5c29bc[_0xa8fe('0x24')];}_0x3d4965[_0xa8fe('0x16')](_0x1ab0df)[_0xa8fe('0x25')](_0x5c29bc);};}exports['index']=function(_0x17d1e5,_0x2221a7){var _0x1d2dd4={},_0x5ecedd={},_0x9e3113={'count':0x0,'rows':[]};var _0x51ff25=_['map'](db[_0xa8fe('0x26')][_0xa8fe('0x27')],function(_0x4b5aa2){return{'name':_0x4b5aa2[_0xa8fe('0x28')],'type':_0x4b5aa2['type'][_0xa8fe('0x29')]};});_0x5ecedd[_0xa8fe('0x2a')]=_[_0xa8fe('0x2b')](_0x51ff25,_0xa8fe('0x24'));_0x5ecedd[_0xa8fe('0x2c')]=_[_0xa8fe('0x2d')](_0x17d1e5[_0xa8fe('0x2c')]);_0x5ecedd[_0xa8fe('0x2e')]=_['intersection'](_0x5ecedd[_0xa8fe('0x2a')],_0x5ecedd['query']);_0x1d2dd4[_0xa8fe('0x2f')]=_[_0xa8fe('0x30')](_0x5ecedd[_0xa8fe('0x2a')],qs['fields'](_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x31')]));_0x1d2dd4['attributes']=_0x1d2dd4['attributes'][_0xa8fe('0x32')]?_0x1d2dd4[_0xa8fe('0x2f')]:_0x5ecedd[_0xa8fe('0x2a')];if(!_0x17d1e5[_0xa8fe('0x2c')]['hasOwnProperty']('nolimit')){_0x1d2dd4['limit']=qs[_0xa8fe('0x33')](_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x33')]);_0x1d2dd4['offset']=qs['offset'](_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x19')]);}_0x1d2dd4['order']=qs[_0xa8fe('0x34')](_0x17d1e5['query'][_0xa8fe('0x34')]);_0x1d2dd4[_0xa8fe('0x35')]=qs[_0xa8fe('0x2e')](_[_0xa8fe('0x36')](_0x17d1e5[_0xa8fe('0x2c')],_0x5ecedd[_0xa8fe('0x2e')]),_0x51ff25);if(_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x37')]){_0x1d2dd4[_0xa8fe('0x35')]=_[_0xa8fe('0x38')](_0x1d2dd4[_0xa8fe('0x35')],{'$or':_[_0xa8fe('0x2b')](_0x51ff25,function(_0x39e16b){if(_0x39e16b['type']!==_0xa8fe('0x39')){var _0x46b6e6={};_0x46b6e6[_0x39e16b['name']]={'$like':'%'+_0x17d1e5['query'][_0xa8fe('0x37')]+'%'};return _0x46b6e6;}})});}_0x1d2dd4=_[_0xa8fe('0x38')]({},_0x1d2dd4,_0x17d1e5['options']);var _0x3977dd={'where':_0x1d2dd4['where']};return db[_0xa8fe('0x26')][_0xa8fe('0x18')](_0x3977dd)[_0xa8fe('0x1d')](function(_0x41e333){_0x9e3113['count']=_0x41e333;if(_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x3a')]){_0x1d2dd4[_0xa8fe('0x3b')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x1d2dd4);})[_0xa8fe('0x1d')](function(_0x44c8a5){_0x9e3113[_0xa8fe('0x3c')]=_0x44c8a5;return _0x9e3113;})[_0xa8fe('0x1d')](respondWithFilteredResult(_0x2221a7,_0x1d2dd4))[_0xa8fe('0x3d')](handleError(_0x2221a7,null));};exports['show']=function(_0x5e099e,_0x150b18){var _0x5e34e3={'raw':!![],'where':{'id':_0x5e099e[_0xa8fe('0x3e')]['id']}},_0x430a60={};_0x430a60['model']=_['keys'](db[_0xa8fe('0x26')][_0xa8fe('0x27')]);_0x430a60[_0xa8fe('0x2c')]=_[_0xa8fe('0x2d')](_0x5e099e['query']);_0x430a60['filters']=_[_0xa8fe('0x30')](_0x430a60[_0xa8fe('0x2a')],_0x430a60[_0xa8fe('0x2c')]);_0x5e34e3['attributes']=_[_0xa8fe('0x30')](_0x430a60[_0xa8fe('0x2a')],qs[_0xa8fe('0x31')](_0x5e099e[_0xa8fe('0x2c')][_0xa8fe('0x31')]));_0x5e34e3[_0xa8fe('0x2f')]=_0x5e34e3['attributes']['length']?_0x5e34e3['attributes']:_0x430a60[_0xa8fe('0x2a')];if(_0x5e099e[_0xa8fe('0x2c')][_0xa8fe('0x3a')]){_0x5e34e3['include']=[{'all':!![]}];}_0x5e34e3=_['merge']({},_0x5e34e3,_0x5e099e['options']);return db[_0xa8fe('0x26')][_0xa8fe('0x3f')](_0x5e34e3)[_0xa8fe('0x1d')](handleEntityNotFound(_0x150b18,null))[_0xa8fe('0x1d')](respondWithResult(_0x150b18,null))[_0xa8fe('0x3d')](handleError(_0x150b18,null));};exports['create']=function(_0x3021d2,_0x320b32){return db[_0xa8fe('0x26')]['create'](_0x3021d2[_0xa8fe('0x40')],{})[_0xa8fe('0x1d')](function(_0x44bff6){var _0xf2b9af=_0x3021d2[_0xa8fe('0x41')]['get']({'plain':!![]});if(!_0xf2b9af)throw new Error(_0xa8fe('0x42'));if(_0xf2b9af[_0xa8fe('0x43')]===_0xa8fe('0x41')){var _0x3e883d=_0x44bff6[_0xa8fe('0x1e')]({'plain':!![]});var _0x144cd9=_0xa8fe('0x1f');return db[_0xa8fe('0x44')][_0xa8fe('0x3f')]({'where':{'name':_0x144cd9,'userProfileId':_0xf2b9af[_0xa8fe('0x45')]},'raw':!![]})[_0xa8fe('0x1d')](function(_0x32cfca){if(_0x32cfca&&_0x32cfca[_0xa8fe('0x46')]===0x0){return db[_0xa8fe('0x20')][_0xa8fe('0x47')]({'name':_0x3e883d[_0xa8fe('0x24')],'resourceId':_0x3e883d['id'],'type':_0x32cfca[_0xa8fe('0x24')],'sectionId':_0x32cfca['id']},{})[_0xa8fe('0x1d')](function(){return _0x44bff6;});}else{return _0x44bff6;}})['catch'](function(_0x3e2883){logger[_0xa8fe('0x22')](_0xa8fe('0x48'),_0x3e2883);throw _0x3e2883;});}return _0x44bff6;})['then'](respondWithResult(_0x320b32,0xc9))[_0xa8fe('0x3d')](handleError(_0x320b32,null));};exports[_0xa8fe('0x49')]=function(_0xa83fc5,_0x339863){if(_0xa83fc5[_0xa8fe('0x40')]['id']){delete _0xa83fc5[_0xa8fe('0x40')]['id'];}return db[_0xa8fe('0x26')][_0xa8fe('0x3f')]({'where':{'id':_0xa83fc5[_0xa8fe('0x3e')]['id']}})[_0xa8fe('0x1d')](handleEntityNotFound(_0x339863,null))['then'](saveUpdates(_0xa83fc5[_0xa8fe('0x40')],null))[_0xa8fe('0x1d')](respondWithResult(_0x339863,null))[_0xa8fe('0x3d')](handleError(_0x339863,null));};exports[_0xa8fe('0x21')]=function(_0x9c116,_0x1afc23){return db[_0xa8fe('0x26')][_0xa8fe('0x3f')]({'where':{'id':_0x9c116[_0xa8fe('0x3e')]['id']}})[_0xa8fe('0x1d')](handleEntityNotFound(_0x1afc23,null))['then'](removeEntity(_0x1afc23,null))[_0xa8fe('0x3d')](handleError(_0x1afc23,null));};exports[_0xa8fe('0x4a')]=function(_0x2e8c39,_0x2ceba5,_0x5149ae){return db[_0xa8fe('0x26')][_0xa8fe('0x4b')]({'where':{'id':_0x2e8c39[_0xa8fe('0x3e')]['id']}})[_0xa8fe('0x1d')](handleEntityNotFound(_0x2ceba5,null))[_0xa8fe('0x1d')](function(_0x972c95){var _0x2b9093;var _0x2f0a05={},_0xedbf1d={};_0xedbf1d[_0xa8fe('0x2a')]=_[_0xa8fe('0x2d')](db[_0xa8fe('0x4c')][_0xa8fe('0x27')]);_0xedbf1d['query']=_['keys'](_0x2e8c39[_0xa8fe('0x2c')]);_0xedbf1d[_0xa8fe('0x2e')]=_[_0xa8fe('0x30')](_0xedbf1d['model'],_0xedbf1d['query']);_0x2f0a05[_0xa8fe('0x2f')]=_['intersection'](_0xedbf1d[_0xa8fe('0x2a')],qs[_0xa8fe('0x31')](_0x2e8c39[_0xa8fe('0x2c')][_0xa8fe('0x31')]));_0x2f0a05[_0xa8fe('0x2f')]=_0x2f0a05[_0xa8fe('0x2f')]['length']?_0x2f0a05[_0xa8fe('0x2f')]:_0xedbf1d[_0xa8fe('0x2a')];if(!_0x2e8c39[_0xa8fe('0x2c')]['hasOwnProperty'](_0xa8fe('0x4d'))){_0x2f0a05['limit']=qs[_0xa8fe('0x33')](_0x2e8c39['query'][_0xa8fe('0x33')]);_0x2f0a05[_0xa8fe('0x19')]=qs[_0xa8fe('0x19')](_0x2e8c39[_0xa8fe('0x2c')][_0xa8fe('0x19')]);}_0x2f0a05['order']=qs[_0xa8fe('0x34')](_0x2e8c39[_0xa8fe('0x2c')]['sort']);_0x2f0a05['where']=qs[_0xa8fe('0x2e')](_[_0xa8fe('0x36')](_0x2e8c39[_0xa8fe('0x2c')],_0xedbf1d['filters']));if(_0x2e8c39[_0xa8fe('0x2c')][_0xa8fe('0x37')]){_0x2f0a05[_0xa8fe('0x35')]=_[_0xa8fe('0x38')](_0x2f0a05[_0xa8fe('0x35')],{'$or':_[_0xa8fe('0x2b')](_0x2f0a05[_0xa8fe('0x2f')],function(_0x5f03bb){var _0x13a429={};_0x13a429[_0x5f03bb]={'$like':'%'+_0x2e8c39[_0xa8fe('0x2c')][_0xa8fe('0x37')]+'%'};return _0x13a429;})});}_0x2f0a05[_0xa8fe('0x35')]=_[_0xa8fe('0x38')](_0x2f0a05['where'],{'mailboxuser':_0x972c95[_0xa8fe('0x4e')]});_0x2f0a05=_[_0xa8fe('0x38')]({},_0x2f0a05,_0x2e8c39[_0xa8fe('0x4f')]);return db['VoiceMailMessage'][_0xa8fe('0x50')](_0x2f0a05)[_0xa8fe('0x1d')](respondWithFilteredResult(_0x2ceba5,_0x2f0a05));})['catch'](handleError(_0x2ceba5,null));}; \ No newline at end of file +var _0x1cd3=['intersection','fields','length','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','findOne','VoiceMailMessage','pick','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','limit','Content-Range','json','apply','reject','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x8884aa,_0x5102c2){var _0x1f8a0f=function(_0x55d250){while(--_0x55d250){_0x8884aa['push'](_0x8884aa['shift']());}};_0x1f8a0f(++_0x5102c2);}(_0x1cd3,0xc9));var _0x31cd=function(_0x2f9a3f,_0x4bd09f){_0x2f9a3f=_0x2f9a3f-0x0;var _0x2735ab=_0x1cd3[_0x2f9a3f];return _0x2735ab;};'use strict';var pdf=require(_0x31cd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x31cd('0x1'));var zipdir=require(_0x31cd('0x2'));var jsonpatch=require(_0x31cd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x31cd('0x4'));var Mustache=require(_0x31cd('0x5'));var util=require('util');var path=require(_0x31cd('0x6'));var sox=require('sox');var csv=require(_0x31cd('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x31cd('0x8'));var squel=require(_0x31cd('0x9'));var crypto=require('crypto');var jsforce=require(_0x31cd('0xa'));var deskjs=require(_0x31cd('0xb'));var toCsv=require('to-csv');var querystring=require(_0x31cd('0xc'));var Papa=require('papaparse');var Redis=require(_0x31cd('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x31cd('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31cd('0xf'))(_0x31cd('0x10'));var utils=require(_0x31cd('0x11'));var config=require(_0x31cd('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39789d,_0xa347d6){_0xa347d6=_0xa347d6||0xcc;return function(_0x1a807f){if(_0x1a807f){return _0x39789d[_0x31cd('0x13')](_0xa347d6);}return _0x39789d[_0x31cd('0x14')](_0xa347d6)[_0x31cd('0x15')]();};}function respondWithResult(_0x2e8224,_0x4ac316){_0x4ac316=_0x4ac316||0xc8;return function(_0x3aacf1){if(_0x3aacf1){return _0x2e8224[_0x31cd('0x14')](_0x4ac316)['json'](_0x3aacf1);}};}function respondWithFilteredResult(_0x2dfca4,_0x16540d){return function(_0x52b992){if(_0x52b992){var _0x3641e2=_0x52b992['count'],_0x52cc8b=_0x16540d['offset'],_0x21d638=_0x16540d['offset']+_0x16540d[_0x31cd('0x16')],_0x339bb8;if(_0x21d638>=_0x3641e2){_0x21d638=_0x3641e2;_0x339bb8=0xc8;}else{_0x339bb8=0xce;}_0x2dfca4[_0x31cd('0x14')](_0x339bb8);return _0x2dfca4['set'](_0x31cd('0x17'),_0x52cc8b+'-'+_0x21d638+'/'+_0x3641e2)[_0x31cd('0x18')](_0x52b992);}return null;};}function patchUpdates(_0x456b9d){return function(_0x4f0331){try{jsonpatch[_0x31cd('0x19')](_0x4f0331,_0x456b9d,!![]);}catch(_0xd853b5){return BPromise[_0x31cd('0x1a')](_0xd853b5);}return _0x4f0331['save']();};}function saveUpdates(_0x3b0980,_0x2b6808){return function(_0x47bbc2){if(_0x47bbc2){return _0x47bbc2[_0x31cd('0x1b')](_0x3b0980)[_0x31cd('0x1c')](function(_0x4c0269){return _0x4c0269;});}return null;};}function removeEntity(_0x11fd5,_0x2b7a76){return function(_0xcdfc6a){if(_0xcdfc6a){return _0xcdfc6a[_0x31cd('0x1d')]()[_0x31cd('0x1c')](function(){var _0x42fc74=_0xcdfc6a[_0x31cd('0x1e')]({'plain':!![]});var _0x2d86ec=_0x31cd('0x1f');return db[_0x31cd('0x20')][_0x31cd('0x1d')]({'where':{'type':_0x2d86ec,'resourceId':_0x42fc74['id']}})[_0x31cd('0x1c')](function(){return _0xcdfc6a;});})['then'](function(){_0x11fd5['status'](0xcc)[_0x31cd('0x15')]();});}};}function handleEntityNotFound(_0x45eda5,_0x118ede){return function(_0x34fd02){if(!_0x34fd02){_0x45eda5[_0x31cd('0x13')](0x194);}return _0x34fd02;};}function handleError(_0x14732a,_0x35c898){_0x35c898=_0x35c898||0x1f4;return function(_0x4231df){logger[_0x31cd('0x21')](_0x4231df[_0x31cd('0x22')]);if(_0x4231df[_0x31cd('0x23')]){delete _0x4231df[_0x31cd('0x23')];}_0x14732a[_0x31cd('0x14')](_0x35c898)[_0x31cd('0x24')](_0x4231df);};}exports[_0x31cd('0x25')]=function(_0x3d5b46,_0x1a1d9f){var _0x5ac5f6={},_0x395d84={},_0x32abd5={'count':0x0,'rows':[]};var _0x3294e8=_[_0x31cd('0x26')](db[_0x31cd('0x27')][_0x31cd('0x28')],function(_0x657462){return{'name':_0x657462[_0x31cd('0x29')],'type':_0x657462[_0x31cd('0x2a')][_0x31cd('0x2b')]};});_0x395d84[_0x31cd('0x2c')]=_['map'](_0x3294e8,'name');_0x395d84[_0x31cd('0x2d')]=_[_0x31cd('0x2e')](_0x3d5b46[_0x31cd('0x2d')]);_0x395d84[_0x31cd('0x2f')]=_[_0x31cd('0x30')](_0x395d84[_0x31cd('0x2c')],_0x395d84[_0x31cd('0x2d')]);_0x5ac5f6['attributes']=_[_0x31cd('0x30')](_0x395d84[_0x31cd('0x2c')],qs[_0x31cd('0x31')](_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x31')]));_0x5ac5f6['attributes']=_0x5ac5f6['attributes'][_0x31cd('0x32')]?_0x5ac5f6[_0x31cd('0x33')]:_0x395d84['model'];if(!_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x34')](_0x31cd('0x35'))){_0x5ac5f6['limit']=qs[_0x31cd('0x16')](_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x16')]);_0x5ac5f6['offset']=qs['offset'](_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x36')]);}_0x5ac5f6[_0x31cd('0x37')]=qs[_0x31cd('0x38')](_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x38')]);_0x5ac5f6[_0x31cd('0x39')]=qs['filters'](_['pick'](_0x3d5b46[_0x31cd('0x2d')],_0x395d84[_0x31cd('0x2f')]),_0x3294e8);if(_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x3a')]){_0x5ac5f6[_0x31cd('0x39')]=_['merge'](_0x5ac5f6[_0x31cd('0x39')],{'$or':_[_0x31cd('0x26')](_0x3294e8,function(_0x217875){if(_0x217875['type']!==_0x31cd('0x3b')){var _0x4a8e11={};_0x4a8e11[_0x217875['name']]={'$like':'%'+_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x3a')]+'%'};return _0x4a8e11;}})});}_0x5ac5f6=_['merge']({},_0x5ac5f6,_0x3d5b46[_0x31cd('0x3c')]);var _0x83597d={'where':_0x5ac5f6[_0x31cd('0x39')]};return db[_0x31cd('0x27')][_0x31cd('0x3d')](_0x83597d)['then'](function(_0x2ef9d3){_0x32abd5[_0x31cd('0x3d')]=_0x2ef9d3;if(_0x3d5b46['query'][_0x31cd('0x3e')]){_0x5ac5f6[_0x31cd('0x3f')]=[{'all':!![]}];}return db[_0x31cd('0x27')][_0x31cd('0x40')](_0x5ac5f6);})['then'](function(_0x2b7cf1){_0x32abd5[_0x31cd('0x41')]=_0x2b7cf1;return _0x32abd5;})[_0x31cd('0x1c')](respondWithFilteredResult(_0x1a1d9f,_0x5ac5f6))[_0x31cd('0x42')](handleError(_0x1a1d9f,null));};exports[_0x31cd('0x43')]=function(_0x6e29e3,_0x4175bc){var _0x842a8c={'raw':!![],'where':{'id':_0x6e29e3[_0x31cd('0x44')]['id']}},_0x3374c1={};_0x3374c1[_0x31cd('0x2c')]=_[_0x31cd('0x2e')](db['VoiceMail']['rawAttributes']);_0x3374c1[_0x31cd('0x2d')]=_['keys'](_0x6e29e3[_0x31cd('0x2d')]);_0x3374c1[_0x31cd('0x2f')]=_[_0x31cd('0x30')](_0x3374c1[_0x31cd('0x2c')],_0x3374c1[_0x31cd('0x2d')]);_0x842a8c[_0x31cd('0x33')]=_[_0x31cd('0x30')](_0x3374c1['model'],qs[_0x31cd('0x31')](_0x6e29e3[_0x31cd('0x2d')][_0x31cd('0x31')]));_0x842a8c[_0x31cd('0x33')]=_0x842a8c[_0x31cd('0x33')][_0x31cd('0x32')]?_0x842a8c[_0x31cd('0x33')]:_0x3374c1[_0x31cd('0x2c')];if(_0x6e29e3[_0x31cd('0x2d')][_0x31cd('0x3e')]){_0x842a8c[_0x31cd('0x3f')]=[{'all':!![]}];}_0x842a8c=_[_0x31cd('0x45')]({},_0x842a8c,_0x6e29e3[_0x31cd('0x3c')]);return db[_0x31cd('0x27')][_0x31cd('0x46')](_0x842a8c)['then'](handleEntityNotFound(_0x4175bc,null))[_0x31cd('0x1c')](respondWithResult(_0x4175bc,null))[_0x31cd('0x42')](handleError(_0x4175bc,null));};exports['create']=function(_0x2fa0a1,_0x136175){return db[_0x31cd('0x27')][_0x31cd('0x47')](_0x2fa0a1['body'],{})[_0x31cd('0x1c')](function(_0x2cab58){var _0x2437e8=_0x2fa0a1[_0x31cd('0x48')][_0x31cd('0x1e')]({'plain':!![]});if(!_0x2437e8)throw new Error(_0x31cd('0x49'));if(_0x2437e8[_0x31cd('0x4a')]===_0x31cd('0x48')){var _0x4af2e8=_0x2cab58['get']({'plain':!![]});var _0x4bec21=_0x31cd('0x1f');return db[_0x31cd('0x4b')][_0x31cd('0x46')]({'where':{'name':_0x4bec21,'userProfileId':_0x2437e8[_0x31cd('0x4c')]},'raw':!![]})[_0x31cd('0x1c')](function(_0x3c2f4e){if(_0x3c2f4e&&_0x3c2f4e[_0x31cd('0x4d')]===0x0){return db[_0x31cd('0x20')][_0x31cd('0x47')]({'name':_0x4af2e8[_0x31cd('0x23')],'resourceId':_0x4af2e8['id'],'type':_0x3c2f4e['name'],'sectionId':_0x3c2f4e['id']},{})[_0x31cd('0x1c')](function(){return _0x2cab58;});}else{return _0x2cab58;}})[_0x31cd('0x42')](function(_0x5a36de){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a36de);throw _0x5a36de;});}return _0x2cab58;})['then'](respondWithResult(_0x136175,0xc9))[_0x31cd('0x42')](handleError(_0x136175,null));};exports[_0x31cd('0x1b')]=function(_0x5e0ef2,_0xb36bc5){if(_0x5e0ef2['body']['id']){delete _0x5e0ef2[_0x31cd('0x4e')]['id'];}return db[_0x31cd('0x27')][_0x31cd('0x46')]({'where':{'id':_0x5e0ef2['params']['id']}})['then'](handleEntityNotFound(_0xb36bc5,null))[_0x31cd('0x1c')](saveUpdates(_0x5e0ef2[_0x31cd('0x4e')],null))[_0x31cd('0x1c')](respondWithResult(_0xb36bc5,null))[_0x31cd('0x42')](handleError(_0xb36bc5,null));};exports[_0x31cd('0x1d')]=function(_0x3fc2ff,_0x38114e){return db[_0x31cd('0x27')][_0x31cd('0x46')]({'where':{'id':_0x3fc2ff[_0x31cd('0x44')]['id']}})[_0x31cd('0x1c')](handleEntityNotFound(_0x38114e,null))[_0x31cd('0x1c')](removeEntity(_0x38114e,null))[_0x31cd('0x42')](handleError(_0x38114e,null));};exports['getMessages']=function(_0x37980b,_0x964c37,_0x44e3db){return db[_0x31cd('0x27')][_0x31cd('0x4f')]({'where':{'id':_0x37980b[_0x31cd('0x44')]['id']}})['then'](handleEntityNotFound(_0x964c37,null))['then'](function(_0x81b19e){var _0x2f5839;var _0x3449cc={},_0x4ceafa={};_0x4ceafa['model']=_[_0x31cd('0x2e')](db[_0x31cd('0x50')][_0x31cd('0x28')]);_0x4ceafa[_0x31cd('0x2d')]=_['keys'](_0x37980b[_0x31cd('0x2d')]);_0x4ceafa['filters']=_[_0x31cd('0x30')](_0x4ceafa[_0x31cd('0x2c')],_0x4ceafa['query']);_0x3449cc[_0x31cd('0x33')]=_['intersection'](_0x4ceafa['model'],qs['fields'](_0x37980b[_0x31cd('0x2d')][_0x31cd('0x31')]));_0x3449cc[_0x31cd('0x33')]=_0x3449cc['attributes'][_0x31cd('0x32')]?_0x3449cc[_0x31cd('0x33')]:_0x4ceafa['model'];if(!_0x37980b[_0x31cd('0x2d')][_0x31cd('0x34')](_0x31cd('0x35'))){_0x3449cc['limit']=qs[_0x31cd('0x16')](_0x37980b[_0x31cd('0x2d')][_0x31cd('0x16')]);_0x3449cc['offset']=qs[_0x31cd('0x36')](_0x37980b[_0x31cd('0x2d')][_0x31cd('0x36')]);}_0x3449cc[_0x31cd('0x37')]=qs[_0x31cd('0x38')](_0x37980b[_0x31cd('0x2d')][_0x31cd('0x38')]);_0x3449cc[_0x31cd('0x39')]=qs[_0x31cd('0x2f')](_[_0x31cd('0x51')](_0x37980b[_0x31cd('0x2d')],_0x4ceafa[_0x31cd('0x2f')]));if(_0x37980b[_0x31cd('0x2d')]['filter']){_0x3449cc[_0x31cd('0x39')]=_['merge'](_0x3449cc[_0x31cd('0x39')],{'$or':_[_0x31cd('0x26')](_0x3449cc[_0x31cd('0x33')],function(_0x3395ed){var _0x5e6297={};_0x5e6297[_0x3395ed]={'$like':'%'+_0x37980b[_0x31cd('0x2d')][_0x31cd('0x3a')]+'%'};return _0x5e6297;})});}_0x3449cc['where']=_['merge'](_0x3449cc[_0x31cd('0x39')],{'mailboxuser':_0x81b19e['mailbox']});_0x3449cc=_[_0x31cd('0x45')]({},_0x3449cc,_0x37980b[_0x31cd('0x3c')]);return db[_0x31cd('0x50')][_0x31cd('0x52')](_0x3449cc)[_0x31cd('0x1c')](respondWithFilteredResult(_0x964c37,_0x3449cc));})[_0x31cd('0x42')](handleError(_0x964c37,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3dd6c05..d3d0f3f 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 _0x90d5=['mailbox_context','mailbox','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail'];(function(_0x4b0bb1,_0x35fb68){var _0x50ee3a=function(_0x1350d1){while(--_0x1350d1){_0x4b0bb1['push'](_0x4b0bb1['shift']());}};_0x50ee3a(++_0x35fb68);}(_0x90d5,0x152));var _0x590d=function(_0x5b77fc,_0xf10e52){_0x5b77fc=_0x5b77fc-0x0;var _0x5afaea=_0x90d5[_0x5b77fc];return _0x5afaea;};'use strict';var _=require(_0x590d('0x0'));var util=require(_0x590d('0x1'));var logger=require('../../config/logger')(_0x590d('0x2'));var moment=require(_0x590d('0x3'));var BPromise=require(_0x590d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x590d('0x5'));var config=require(_0x590d('0x6'));var attributes=require(_0x590d('0x7'));module[_0x590d('0x8')]=function(_0x3bcfee,_0x24e9da){return _0x3bcfee[_0x590d('0x9')](_0x590d('0xa'),attributes,{'tableName':_0x590d('0xb'),'paranoid':![],'indexes':[{'name':_0x590d('0xc'),'fields':[_0x590d('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e74=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail','mailbox_context','mailbox','lodash','util'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x5e74,0xc1));var _0x45e7=function(_0x30345a,_0x2575ed){_0x30345a=_0x30345a-0x0;var _0x1eb8b2=_0x5e74[_0x30345a];return _0x1eb8b2;};'use strict';var _=require(_0x45e7('0x0'));var util=require(_0x45e7('0x1'));var logger=require(_0x45e7('0x2'))(_0x45e7('0x3'));var moment=require(_0x45e7('0x4'));var BPromise=require(_0x45e7('0x5'));var rp=require(_0x45e7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45e7('0x7'));var config=require(_0x45e7('0x8'));var attributes=require(_0x45e7('0x9'));module['exports']=function(_0x82c29c,_0x3a2527){return _0x82c29c['define'](_0x45e7('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x45e7('0xb'),'fields':[_0x45e7('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index b19e5c1..68d70f3 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 _0x7e8b=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x50da8a,_0x311832){var _0x177d43=function(_0x568e08){while(--_0x568e08){_0x50da8a['push'](_0x50da8a['shift']());}};_0x177d43(++_0x311832);}(_0x7e8b,0x1a7));var _0xb7e8=function(_0x229be5,_0x9156f6){_0x229be5=_0x229be5-0x0;var _0x326189=_0x7e8b[_0x229be5];return _0x326189;};'use strict';var _=require('lodash');var util=require(_0xb7e8('0x0'));var moment=require(_0xb7e8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7e8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb7e8('0x3'));var config=require(_0xb7e8('0x4'));var jayson=require(_0xb7e8('0x5'));var client=jayson[_0xb7e8('0x6')][_0xb7e8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f901a,_0x9039bc,_0x592d11){return new BPromise(function(_0x53fe28,_0x3f04e8){return client[_0xb7e8('0x8')](_0x2f901a,_0x592d11)['then'](function(_0x4466e9){logger[_0xb7e8('0x9')](_0xb7e8('0xa'),_0x9039bc,_0xb7e8('0xb'));logger['debug'](_0xb7e8('0xc'),_0x9039bc,_0xb7e8('0xb'),JSON[_0xb7e8('0xd')](_0x4466e9));if(_0x4466e9[_0xb7e8('0xe')]){if(_0x4466e9[_0xb7e8('0xe')]['code']===0x1f4){logger['error'](_0xb7e8('0xa'),_0x9039bc,_0x4466e9[_0xb7e8('0xe')][_0xb7e8('0xf')]);return _0x3f04e8(_0x4466e9[_0xb7e8('0xe')][_0xb7e8('0xf')]);}logger[_0xb7e8('0xe')](_0xb7e8('0xa'),_0x9039bc,_0x4466e9[_0xb7e8('0xe')][_0xb7e8('0xf')]);return _0x53fe28(_0x4466e9[_0xb7e8('0xe')][_0xb7e8('0xf')]);}else{logger[_0xb7e8('0x9')](_0xb7e8('0xa'),_0x9039bc,_0xb7e8('0xb'));_0x53fe28(_0x4466e9[_0xb7e8('0x10')][_0xb7e8('0xf')]);}})[_0xb7e8('0x11')](function(_0x33397d){logger[_0xb7e8('0xe')](_0xb7e8('0xa'),_0x9039bc,_0x33397d);_0x3f04e8(_0x33397d);});});} \ No newline at end of file +var _0x9005=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4d9ca0,_0x2e8a06){var _0x5cfe93=function(_0x40f0c6){while(--_0x40f0c6){_0x4d9ca0['push'](_0x4d9ca0['shift']());}};_0x5cfe93(++_0x2e8a06);}(_0x9005,0x72));var _0x5900=function(_0x498e17,_0x4ab0ee){_0x498e17=_0x498e17-0x0;var _0x73957b=_0x9005[_0x498e17];return _0x73957b;};'use strict';var _=require(_0x5900('0x0'));var util=require(_0x5900('0x1'));var moment=require('moment');var BPromise=require(_0x5900('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5900('0x3'));var db=require(_0x5900('0x4'))['db'];var utils=require(_0x5900('0x5'));var logger=require(_0x5900('0x6'))('rpc');var config=require(_0x5900('0x7'));var jayson=require(_0x5900('0x8'));var client=jayson[_0x5900('0x9')][_0x5900('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x80f801,_0x28aee5,_0x2f58ce){return new BPromise(function(_0x1b45fb,_0x38470f){return client['request'](_0x80f801,_0x2f58ce)[_0x5900('0xb')](function(_0x171ddb){logger['info'](_0x5900('0xc'),_0x28aee5,_0x5900('0xd'));logger[_0x5900('0xe')](_0x5900('0xf'),_0x28aee5,'request\x20sent',JSON[_0x5900('0x10')](_0x171ddb));if(_0x171ddb[_0x5900('0x11')]){if(_0x171ddb[_0x5900('0x11')][_0x5900('0x12')]===0x1f4){logger['error'](_0x5900('0xc'),_0x28aee5,_0x171ddb[_0x5900('0x11')]['message']);return _0x38470f(_0x171ddb[_0x5900('0x11')][_0x5900('0x13')]);}logger[_0x5900('0x11')](_0x5900('0xc'),_0x28aee5,_0x171ddb['error'][_0x5900('0x13')]);return _0x1b45fb(_0x171ddb['error'][_0x5900('0x13')]);}else{logger[_0x5900('0x14')](_0x5900('0xc'),_0x28aee5,_0x5900('0xd'));_0x1b45fb(_0x171ddb[_0x5900('0x15')]['message']);}})[_0x5900('0x16')](function(_0x55a9d7){logger[_0x5900('0x11')]('VoiceMail,\x20%s,\x20%s',_0x28aee5,_0x55a9d7);_0x38470f(_0x55a9d7);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 77cc193..8160c18 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 _0x687b=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x687b,0x14a));var _0xb687=function(_0x5dc927,_0x49f4a1){_0x5dc927=_0x5dc927-0x0;var _0x416440=_0x687b[_0x5dc927];return _0x416440;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0x8')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0xe')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xf')]);router[_0xb687('0x10')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x11')]);router[_0xb687('0x12')]('/:id',auth[_0xb687('0x9')](),controller[_0xb687('0x13')]);module[_0xb687('0x14')]=router; \ No newline at end of file +var _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x51f9bf,_0x24d5b7){var _0x2986e3=function(_0x1fcc2f){while(--_0x1fcc2f){_0x51f9bf['push'](_0x51f9bf['shift']());}};_0x2986e3(++_0x24d5b7);}(_0x4819,0xcd));var _0x9481=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0x4819[_0x56d1ed];return _0x1b282b;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['download']);router[_0x9481('0xe')]('/',auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 1648f3f..b2fea96 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 _0xd395=['STRING','BLOB','TIMESTAMP','sequelize','exports','getDataValue','INTEGER'];(function(_0x2ff980,_0xf5e589){var _0x3e4a63=function(_0xd40f69){while(--_0xd40f69){_0x2ff980['push'](_0x2ff980['shift']());}};_0x3e4a63(++_0xf5e589);}(_0xd395,0x1a7));var _0x5d39=function(_0x355dfc,_0xd28c0d){_0x355dfc=_0x355dfc-0x0;var _0x4ac428=_0xd395[_0x355dfc];return _0x4ac428;};'use strict';var Sequelize=require(_0x5d39('0x0'));module[_0x5d39('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x582c0d){return this[_0x5d39('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x5d39('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5d39('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'stamp':{'type':_0x5d39('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x3736=['getDataValue','INTEGER','STRING','BLOB','long','sequelize','exports','VIRTUAL'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3736,0x1bd));var _0x6373=function(_0x1e3daa,_0x2d1211){_0x1e3daa=_0x1e3daa-0x0;var _0x563a1f=_0x3736[_0x1e3daa];return _0x563a1f;};'use strict';var Sequelize=require(_0x6373('0x0'));module[_0x6373('0x1')]={'name':{'type':Sequelize[_0x6373('0x2')],'get':function(_0xb72f93){return this[_0x6373('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x6373('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x6373('0x6')](_0x6373('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3e3670d..5825497 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 _0x6308=['count','includeAll','include','findAll','rows','catch','params','create','body','find','download','recording','msg_id','Sequelize','ValidationError','audio/wav','Content-Disposition','attachment;\x20filename=\x22','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options'];(function(_0x1bfdd0,_0x1f8767){var _0x14ab46=function(_0x3793ae){while(--_0x3793ae){_0x1bfdd0['push'](_0x1bfdd0['shift']());}};_0x14ab46(++_0x1f8767);}(_0x6308,0x1f2));var _0x8630=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x6308[_0x266618];return _0x54dbf5;};'use strict';var pdf=require(_0x8630('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8630('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8630('0x2'));var moment=require(_0x8630('0x3'));var BPromise=require(_0x8630('0x4'));var Mustache=require(_0x8630('0x5'));var util=require(_0x8630('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8630('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8630('0x8'));var squel=require(_0x8630('0x9'));var crypto=require(_0x8630('0xa'));var jsforce=require(_0x8630('0xb'));var deskjs=require(_0x8630('0xc'));var toCsv=require(_0x8630('0x7'));var querystring=require('querystring');var Papa=require(_0x8630('0xd'));var Redis=require('ioredis');var authService=require(_0x8630('0xe'));var qs=require(_0x8630('0xf'));var as=require(_0x8630('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8630('0x11'))(_0x8630('0x12'));var utils=require(_0x8630('0x13'));var config=require('../../config/environment');var db=require(_0x8630('0x14'))['db'];function respondWithStatusCode(_0x2cef7e,_0x5b6d75){_0x5b6d75=_0x5b6d75||0xcc;return function(_0x54073b){if(_0x54073b){return _0x2cef7e[_0x8630('0x15')](_0x5b6d75);}return _0x2cef7e[_0x8630('0x16')](_0x5b6d75)['end']();};}function respondWithResult(_0x3040be,_0x4db686){_0x4db686=_0x4db686||0xc8;return function(_0xf31c17){if(_0xf31c17){return _0x3040be['status'](_0x4db686)[_0x8630('0x17')](_0xf31c17);}};}function respondWithFilteredResult(_0x594e75,_0x53f236){return function(_0x29a42d){if(_0x29a42d){var _0x86c262=_0x29a42d['count'],_0x49fce1=_0x53f236[_0x8630('0x18')],_0x5c0ba0=_0x53f236[_0x8630('0x18')]+_0x53f236[_0x8630('0x19')],_0x3ea754;if(_0x5c0ba0>=_0x86c262){_0x5c0ba0=_0x86c262;_0x3ea754=0xc8;}else{_0x3ea754=0xce;}_0x594e75[_0x8630('0x16')](_0x3ea754);return _0x594e75[_0x8630('0x1a')](_0x8630('0x1b'),_0x49fce1+'-'+_0x5c0ba0+'/'+_0x86c262)[_0x8630('0x17')](_0x29a42d);}return null;};}function patchUpdates(_0x39edd5){return function(_0xe1ecd0){try{jsonpatch['apply'](_0xe1ecd0,_0x39edd5,!![]);}catch(_0x59bda7){return BPromise[_0x8630('0x1c')](_0x59bda7);}return _0xe1ecd0[_0x8630('0x1d')]();};}function saveUpdates(_0x557e74,_0x5cff5c){return function(_0x1325dc){if(_0x1325dc){return _0x1325dc[_0x8630('0x1e')](_0x557e74)[_0x8630('0x1f')](function(_0x491c65){return _0x491c65;});}return null;};}function removeEntity(_0x5ce487,_0xcc7454){return function(_0x58c0b5){if(_0x58c0b5){return _0x58c0b5[_0x8630('0x20')]()[_0x8630('0x1f')](function(){_0x5ce487[_0x8630('0x16')](0xcc)[_0x8630('0x21')]();});}};}function handleEntityNotFound(_0x4c2851,_0x37c224){return function(_0xf24c11){if(!_0xf24c11){_0x4c2851[_0x8630('0x15')](0x194);}return _0xf24c11;};}function handleError(_0x3d1eec,_0x41871a){_0x41871a=_0x41871a||0x1f4;return function(_0x309d04){logger[_0x8630('0x22')](_0x309d04['stack']);if(_0x309d04['name']){delete _0x309d04[_0x8630('0x23')];}_0x3d1eec[_0x8630('0x16')](_0x41871a)[_0x8630('0x24')](_0x309d04);};}exports[_0x8630('0x25')]=function(_0x2b1196,_0x1c012d){var _0x149a8e={},_0x349c4d={},_0x306ca2={'count':0x0,'rows':[]};var _0x357c15=_[_0x8630('0x26')](db[_0x8630('0x27')][_0x8630('0x28')],function(_0x4285ee){return{'name':_0x4285ee[_0x8630('0x29')],'type':_0x4285ee[_0x8630('0x2a')][_0x8630('0x2b')]};});_0x349c4d['model']=_[_0x8630('0x2c')](_[_0x8630('0x26')](_0x357c15,_0x8630('0x23')),[_0x8630('0x23')]);_0x349c4d['query']=_[_0x8630('0x2d')](_0x2b1196[_0x8630('0x2e')]);_0x349c4d[_0x8630('0x2f')]=_[_0x8630('0x30')](_0x349c4d[_0x8630('0x31')],_0x349c4d[_0x8630('0x2e')]);_0x149a8e['attributes']=_[_0x8630('0x30')](_0x349c4d[_0x8630('0x31')],qs[_0x8630('0x32')](_0x2b1196['query'][_0x8630('0x32')]));_0x149a8e[_0x8630('0x33')]=_0x149a8e[_0x8630('0x33')][_0x8630('0x34')]?_0x149a8e[_0x8630('0x33')]:_0x349c4d[_0x8630('0x31')];if(!_0x2b1196['query'][_0x8630('0x35')](_0x8630('0x36'))){_0x149a8e[_0x8630('0x19')]=qs[_0x8630('0x19')](_0x2b1196[_0x8630('0x2e')][_0x8630('0x19')]);_0x149a8e[_0x8630('0x18')]=qs[_0x8630('0x18')](_0x2b1196[_0x8630('0x2e')][_0x8630('0x18')]);}_0x149a8e[_0x8630('0x37')]=qs[_0x8630('0x38')](_0x2b1196[_0x8630('0x2e')][_0x8630('0x38')]);_0x149a8e[_0x8630('0x39')]=qs[_0x8630('0x2f')](_[_0x8630('0x3a')](_0x2b1196['query'],_0x349c4d[_0x8630('0x2f')]),_0x357c15);if(_0x2b1196[_0x8630('0x2e')]['filter']){_0x149a8e['where']=_[_0x8630('0x3b')](_0x149a8e[_0x8630('0x39')],{'$or':_[_0x8630('0x26')](_0x357c15,function(_0x580fd){if(_0x580fd[_0x8630('0x2a')]!=='VIRTUAL'){var _0x21e879={};_0x21e879[_0x580fd[_0x8630('0x23')]]={'$like':'%'+_0x2b1196[_0x8630('0x2e')][_0x8630('0x3c')]+'%'};return _0x21e879;}})});}_0x149a8e=_['merge']({},_0x149a8e,_0x2b1196[_0x8630('0x3d')]);var _0x437fde={'where':_0x149a8e[_0x8630('0x39')]};return db[_0x8630('0x27')][_0x8630('0x3e')](_0x437fde)[_0x8630('0x1f')](function(_0x2fbb8c){_0x306ca2['count']=_0x2fbb8c;if(_0x2b1196[_0x8630('0x2e')][_0x8630('0x3f')]){_0x149a8e[_0x8630('0x40')]=[{'all':!![]}];}return db[_0x8630('0x27')][_0x8630('0x41')](_0x149a8e);})[_0x8630('0x1f')](function(_0x25cb36){_0x306ca2[_0x8630('0x42')]=_0x25cb36;return _0x306ca2;})[_0x8630('0x1f')](respondWithFilteredResult(_0x1c012d,_0x149a8e))[_0x8630('0x43')](handleError(_0x1c012d,null));};exports['show']=function(_0x358431,_0x53882a){var _0x8b40e1={'raw':!![],'where':{'id':_0x358431[_0x8630('0x44')]['id']}},_0x475bb4={};_0x475bb4[_0x8630('0x31')]=_[_0x8630('0x2d')](db[_0x8630('0x27')]['rawAttributes']);_0x475bb4[_0x8630('0x2e')]=_[_0x8630('0x2d')](_0x358431[_0x8630('0x2e')]);_0x475bb4['filters']=_[_0x8630('0x30')](_0x475bb4[_0x8630('0x31')],_0x475bb4[_0x8630('0x2e')]);_0x8b40e1[_0x8630('0x33')]=_[_0x8630('0x30')](_0x475bb4[_0x8630('0x31')],qs['fields'](_0x358431[_0x8630('0x2e')][_0x8630('0x32')]));_0x8b40e1[_0x8630('0x33')]=_0x8b40e1['attributes'][_0x8630('0x34')]?_0x8b40e1[_0x8630('0x33')]:_0x475bb4['model'];if(_0x358431[_0x8630('0x2e')][_0x8630('0x3f')]){_0x8b40e1[_0x8630('0x40')]=[{'all':!![]}];}_0x8b40e1=_['merge']({},_0x8b40e1,_0x358431['options']);return db[_0x8630('0x27')]['find'](_0x8b40e1)['then'](handleEntityNotFound(_0x53882a,null))[_0x8630('0x1f')](respondWithResult(_0x53882a,null))['catch'](handleError(_0x53882a,null));};exports[_0x8630('0x45')]=function(_0x35a3c8,_0x4892f2){return db[_0x8630('0x27')][_0x8630('0x45')](_0x35a3c8[_0x8630('0x46')],{})[_0x8630('0x1f')](respondWithResult(_0x4892f2,0xc9))[_0x8630('0x43')](handleError(_0x4892f2,null));};exports['update']=function(_0x40c47d,_0x231289){if(_0x40c47d['body']['id']){delete _0x40c47d[_0x8630('0x46')]['id'];}return db[_0x8630('0x27')][_0x8630('0x47')]({'where':{'id':_0x40c47d['params']['id']}})[_0x8630('0x1f')](handleEntityNotFound(_0x231289,null))[_0x8630('0x1f')](saveUpdates(_0x40c47d[_0x8630('0x46')],null))[_0x8630('0x1f')](respondWithResult(_0x231289,null))[_0x8630('0x43')](handleError(_0x231289,null));};exports[_0x8630('0x20')]=function(_0xf70c93,_0x1fbf26){return db[_0x8630('0x27')]['find']({'where':{'id':_0xf70c93['params']['id']}})[_0x8630('0x1f')](handleEntityNotFound(_0x1fbf26,null))[_0x8630('0x1f')](removeEntity(_0x1fbf26,null))[_0x8630('0x43')](handleError(_0x1fbf26,null));};exports[_0x8630('0x48')]=function(_0x40cdec,_0x24a363,_0x4436aa){return db['VoiceMailMessage'][_0x8630('0x47')]({'where':{'id':_0x40cdec[_0x8630('0x44')]['id']},'attributes':['id',_0x8630('0x49'),_0x8630('0x4a')]})[_0x8630('0x1f')](handleEntityNotFound(_0x24a363,null))['then'](function(_0x398ea7){if(_0x398ea7){if(!_0x398ea7[_0x8630('0x49')]){throw new db[(_0x8630('0x4b'))][(_0x8630('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x250dd8={'Content-Type':_0x8630('0x4d'),'Content-Disposition':'attachment'};if(_0x398ea7[_0x8630('0x4a')]){_0x250dd8[_0x8630('0x4e')]=_0x8630('0x4f')+_0x398ea7[_0x8630('0x4a')]+'.wav\x22';}_0x24a363[_0x8630('0x1a')](_0x250dd8);return _0x24a363[_0x8630('0x24')](new Buffer(_0x398ea7['recording']));}})['catch'](handleError(_0x24a363,null));}; \ No newline at end of file +var _0x9434=['intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters'];(function(_0x503197,_0x425026){var _0xc2557c=function(_0x176366){while(--_0x176366){_0x503197['push'](_0x503197['shift']());}};_0xc2557c(++_0x425026);}(_0x9434,0x168));var _0x4943=function(_0x3d6f24,_0x1aefdb){_0x3d6f24=_0x3d6f24-0x0;var _0xb656d2=_0x9434[_0x3d6f24];return _0xb656d2;};'use strict';var pdf=require(_0x4943('0x0'));var emlformat=require(_0x4943('0x1'));var rimraf=require(_0x4943('0x2'));var zipdir=require(_0x4943('0x3'));var jsonpatch=require(_0x4943('0x4'));var rp=require(_0x4943('0x5'));var moment=require('moment');var BPromise=require(_0x4943('0x6'));var Mustache=require(_0x4943('0x7'));var util=require('util');var path=require(_0x4943('0x8'));var sox=require(_0x4943('0x9'));var csv=require('to-csv');var ejs=require(_0x4943('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0xe'));var querystring=require(_0x4943('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0x10'));var qs=require(_0x4943('0x11'));var as=require(_0x4943('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x13'))(_0x4943('0x14'));var utils=require('../../config/utils');var config=require(_0x4943('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x590f41,_0x943461){_0x943461=_0x943461||0xcc;return function(_0x1e95be){if(_0x1e95be){return _0x590f41[_0x4943('0x16')](_0x943461);}return _0x590f41[_0x4943('0x17')](_0x943461)[_0x4943('0x18')]();};}function respondWithResult(_0x24bdd7,_0x4077f1){_0x4077f1=_0x4077f1||0xc8;return function(_0x524c8a){if(_0x524c8a){return _0x24bdd7[_0x4943('0x17')](_0x4077f1)[_0x4943('0x19')](_0x524c8a);}};}function respondWithFilteredResult(_0x2ae9b5,_0x13d758){return function(_0x37c843){if(_0x37c843){var _0x39b4e3=_0x37c843[_0x4943('0x1a')],_0x4b075e=_0x13d758['offset'],_0x26b707=_0x13d758['offset']+_0x13d758[_0x4943('0x1b')],_0x407485;if(_0x26b707>=_0x39b4e3){_0x26b707=_0x39b4e3;_0x407485=0xc8;}else{_0x407485=0xce;}_0x2ae9b5['status'](_0x407485);return _0x2ae9b5[_0x4943('0x1c')](_0x4943('0x1d'),_0x4b075e+'-'+_0x26b707+'/'+_0x39b4e3)['json'](_0x37c843);}return null;};}function patchUpdates(_0x156c8c){return function(_0x12c0c4){try{jsonpatch[_0x4943('0x1e')](_0x12c0c4,_0x156c8c,!![]);}catch(_0x494bef){return BPromise[_0x4943('0x1f')](_0x494bef);}return _0x12c0c4['save']();};}function saveUpdates(_0x2833ed,_0x52fa3b){return function(_0x258079){if(_0x258079){return _0x258079[_0x4943('0x20')](_0x2833ed)[_0x4943('0x21')](function(_0x44bbe4){return _0x44bbe4;});}return null;};}function removeEntity(_0x508c36,_0x1ceb6f){return function(_0x205eb2){if(_0x205eb2){return _0x205eb2[_0x4943('0x22')]()[_0x4943('0x21')](function(){_0x508c36[_0x4943('0x17')](0xcc)[_0x4943('0x18')]();});}};}function handleEntityNotFound(_0x793d18,_0x340077){return function(_0x5dd061){if(!_0x5dd061){_0x793d18['sendStatus'](0x194);}return _0x5dd061;};}function handleError(_0x315c7f,_0x127a53){_0x127a53=_0x127a53||0x1f4;return function(_0x426543){logger['error'](_0x426543[_0x4943('0x23')]);if(_0x426543[_0x4943('0x24')]){delete _0x426543['name'];}_0x315c7f[_0x4943('0x17')](_0x127a53)[_0x4943('0x25')](_0x426543);};}exports[_0x4943('0x26')]=function(_0x24e6e1,_0x35f393){var _0x16eba6={},_0x307478={},_0x169ced={'count':0x0,'rows':[]};var _0x3c1c15=_[_0x4943('0x27')](db[_0x4943('0x28')][_0x4943('0x29')],function(_0xa71fec){return{'name':_0xa71fec[_0x4943('0x2a')],'type':_0xa71fec[_0x4943('0x2b')][_0x4943('0x2c')]};});_0x307478[_0x4943('0x2d')]=_[_0x4943('0x2e')](_['map'](_0x3c1c15,_0x4943('0x24')),['name']);_0x307478[_0x4943('0x2f')]=_[_0x4943('0x30')](_0x24e6e1[_0x4943('0x2f')]);_0x307478[_0x4943('0x31')]=_[_0x4943('0x32')](_0x307478[_0x4943('0x2d')],_0x307478[_0x4943('0x2f')]);_0x16eba6[_0x4943('0x33')]=_['intersection'](_0x307478[_0x4943('0x2d')],qs[_0x4943('0x34')](_0x24e6e1['query'][_0x4943('0x34')]));_0x16eba6[_0x4943('0x33')]=_0x16eba6['attributes'][_0x4943('0x35')]?_0x16eba6[_0x4943('0x33')]:_0x307478[_0x4943('0x2d')];if(!_0x24e6e1['query'][_0x4943('0x36')](_0x4943('0x37'))){_0x16eba6[_0x4943('0x1b')]=qs[_0x4943('0x1b')](_0x24e6e1[_0x4943('0x2f')]['limit']);_0x16eba6[_0x4943('0x38')]=qs[_0x4943('0x38')](_0x24e6e1[_0x4943('0x2f')][_0x4943('0x38')]);}_0x16eba6[_0x4943('0x39')]=qs[_0x4943('0x3a')](_0x24e6e1[_0x4943('0x2f')][_0x4943('0x3a')]);_0x16eba6[_0x4943('0x3b')]=qs[_0x4943('0x31')](_[_0x4943('0x3c')](_0x24e6e1['query'],_0x307478[_0x4943('0x31')]),_0x3c1c15);if(_0x24e6e1[_0x4943('0x2f')][_0x4943('0x3d')]){_0x16eba6[_0x4943('0x3b')]=_[_0x4943('0x3e')](_0x16eba6['where'],{'$or':_['map'](_0x3c1c15,function(_0x4ac894){if(_0x4ac894[_0x4943('0x2b')]!==_0x4943('0x3f')){var _0x5876f6={};_0x5876f6[_0x4ac894[_0x4943('0x24')]]={'$like':'%'+_0x24e6e1['query'][_0x4943('0x3d')]+'%'};return _0x5876f6;}})});}_0x16eba6=_[_0x4943('0x3e')]({},_0x16eba6,_0x24e6e1[_0x4943('0x40')]);var _0x3d49d5={'where':_0x16eba6[_0x4943('0x3b')]};return db[_0x4943('0x28')][_0x4943('0x1a')](_0x3d49d5)[_0x4943('0x21')](function(_0x41eaff){_0x169ced[_0x4943('0x1a')]=_0x41eaff;if(_0x24e6e1[_0x4943('0x2f')][_0x4943('0x41')]){_0x16eba6[_0x4943('0x42')]=[{'all':!![]}];}return db[_0x4943('0x28')][_0x4943('0x43')](_0x16eba6);})[_0x4943('0x21')](function(_0xbe0e00){_0x169ced[_0x4943('0x44')]=_0xbe0e00;return _0x169ced;})[_0x4943('0x21')](respondWithFilteredResult(_0x35f393,_0x16eba6))[_0x4943('0x45')](handleError(_0x35f393,null));};exports[_0x4943('0x46')]=function(_0x11ee4a,_0x44f32a){var _0x32785c={'raw':!![],'where':{'id':_0x11ee4a[_0x4943('0x47')]['id']}},_0x32e4c1={};_0x32e4c1[_0x4943('0x2d')]=_['keys'](db[_0x4943('0x28')][_0x4943('0x29')]);_0x32e4c1['query']=_['keys'](_0x11ee4a[_0x4943('0x2f')]);_0x32e4c1['filters']=_[_0x4943('0x32')](_0x32e4c1['model'],_0x32e4c1[_0x4943('0x2f')]);_0x32785c['attributes']=_[_0x4943('0x32')](_0x32e4c1['model'],qs[_0x4943('0x34')](_0x11ee4a[_0x4943('0x2f')][_0x4943('0x34')]));_0x32785c['attributes']=_0x32785c['attributes'][_0x4943('0x35')]?_0x32785c['attributes']:_0x32e4c1[_0x4943('0x2d')];if(_0x11ee4a['query'][_0x4943('0x41')]){_0x32785c[_0x4943('0x42')]=[{'all':!![]}];}_0x32785c=_[_0x4943('0x3e')]({},_0x32785c,_0x11ee4a[_0x4943('0x40')]);return db['VoiceMailMessage']['find'](_0x32785c)[_0x4943('0x21')](handleEntityNotFound(_0x44f32a,null))['then'](respondWithResult(_0x44f32a,null))['catch'](handleError(_0x44f32a,null));};exports[_0x4943('0x48')]=function(_0x457821,_0xd5e1b3){return db[_0x4943('0x28')][_0x4943('0x48')](_0x457821[_0x4943('0x49')],{})[_0x4943('0x21')](respondWithResult(_0xd5e1b3,0xc9))['catch'](handleError(_0xd5e1b3,null));};exports[_0x4943('0x20')]=function(_0x10aa6a,_0x55ce10){if(_0x10aa6a[_0x4943('0x49')]['id']){delete _0x10aa6a[_0x4943('0x49')]['id'];}return db[_0x4943('0x28')]['find']({'where':{'id':_0x10aa6a[_0x4943('0x47')]['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x55ce10,null))['then'](saveUpdates(_0x10aa6a[_0x4943('0x49')],null))[_0x4943('0x21')](respondWithResult(_0x55ce10,null))['catch'](handleError(_0x55ce10,null));};exports[_0x4943('0x22')]=function(_0x346a6d,_0x289af4){return db['VoiceMailMessage'][_0x4943('0x4a')]({'where':{'id':_0x346a6d['params']['id']}})['then'](handleEntityNotFound(_0x289af4,null))[_0x4943('0x21')](removeEntity(_0x289af4,null))[_0x4943('0x45')](handleError(_0x289af4,null));};exports[_0x4943('0x4b')]=function(_0x5bca66,_0x582156,_0x4d9968){return db[_0x4943('0x28')]['find']({'where':{'id':_0x5bca66['params']['id']},'attributes':['id',_0x4943('0x4c'),'msg_id']})['then'](handleEntityNotFound(_0x582156,null))['then'](function(_0x40e75f){if(_0x40e75f){if(!_0x40e75f[_0x4943('0x4c')]){throw new db[(_0x4943('0x4d'))]['ValidationError'](_0x4943('0x4e'));}var _0x2d8c47={'Content-Type':_0x4943('0x4f'),'Content-Disposition':'attachment'};if(_0x40e75f[_0x4943('0x50')]){_0x2d8c47[_0x4943('0x51')]='attachment;\x20filename=\x22'+_0x40e75f['msg_id']+'.wav\x22';}_0x582156['set'](_0x2d8c47);return _0x582156[_0x4943('0x25')](new Buffer(_0x40e75f[_0x4943('0x4c')]));}})[_0x4943('0x45')](handleError(_0x582156,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 742800a..f7f7e26 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 _0x0ffc=['voice_voicemail_messages','dir','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x10681c,_0x2ca74a){var _0x26aa5e=function(_0x211078){while(--_0x211078){_0x10681c['push'](_0x10681c['shift']());}};_0x26aa5e(++_0x2ca74a);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x46b1d0,_0x15ad34){_0x46b1d0=_0x46b1d0-0x0;var _0x29e368=_0x0ffc[_0x46b1d0];return _0x29e368;};'use strict';var _=require('lodash');var util=require(_0xc0ff('0x0'));var logger=require(_0xc0ff('0x1'))('api');var moment=require(_0xc0ff('0x2'));var BPromise=require('bluebird');var rp=require(_0xc0ff('0x3'));var fs=require('fs');var path=require(_0xc0ff('0x4'));var rimraf=require(_0xc0ff('0x5'));var config=require(_0xc0ff('0x6'));var attributes=require(_0xc0ff('0x7'));module[_0xc0ff('0x8')]=function(_0x2fe7a2,_0x1b69a1){return _0x2fe7a2[_0xc0ff('0x9')]('VoiceMailMessage',attributes,{'tableName':_0xc0ff('0xa'),'paranoid':![],'indexes':[{'name':_0xc0ff('0xb'),'fields':[_0xc0ff('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1beb=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0xbc22a3,_0x5e295c){var _0x141b85=function(_0x2dba61){while(--_0x2dba61){_0xbc22a3['push'](_0xbc22a3['shift']());}};_0x141b85(++_0x5e295c);}(_0x1beb,0x165));var _0xb1be=function(_0xd66922,_0x54da93){_0xd66922=_0xd66922-0x0;var _0xe23243=_0x1beb[_0xd66922];return _0xe23243;};'use strict';var _=require(_0xb1be('0x0'));var util=require(_0xb1be('0x1'));var logger=require('../../config/logger')(_0xb1be('0x2'));var moment=require(_0xb1be('0x3'));var BPromise=require(_0xb1be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1be('0x5'));var rimraf=require(_0xb1be('0x6'));var config=require('../../config/environment');var attributes=require(_0xb1be('0x7'));module[_0xb1be('0x8')]=function(_0x116394,_0xe36555){return _0x116394[_0xb1be('0x9')](_0xb1be('0xa'),attributes,{'tableName':_0xb1be('0xb'),'paranoid':![],'indexes':[{'name':_0xb1be('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ef5ba0b..c283c5e 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x109bbf,_0x382eed){var _0x36aac4=function(_0x1b300c){while(--_0x1b300c){_0x109bbf['push'](_0x109bbf['shift']());}};_0x36aac4(++_0x382eed);}(_0x1a85,0x178));var _0x51a8=function(_0x4d209b,_0x1a05e8){_0x4d209b=_0x4d209b-0x0;var _0xc5e693=_0x1a85[_0x4d209b];return _0xc5e693;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash'];(function(_0x562da6,_0x40c67c){var _0x4eec62=function(_0x50f694){while(--_0x50f694){_0x562da6['push'](_0x562da6['shift']());}};_0x4eec62(++_0x40c67c);}(_0x66fa,0x117));var _0xa66f=function(_0x3f8571,_0x33fe42){_0x3f8571=_0x3f8571-0x0;var _0x4fb83e=_0x66fa[_0x3f8571];return _0x4fb83e;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ffe3eda..81ef087 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 _0x47a5=['put','update','delete','/:id/sounds/:id2','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','post','create','/:id/sounds'];(function(_0x467578,_0x3ed8c7){var _0x52427f=function(_0x49c184){while(--_0x49c184){_0x467578['push'](_0x467578['shift']());}};_0x52427f(++_0x3ed8c7);}(_0x47a5,0x15a));var _0x547a=function(_0x25726d,_0x5b40ce){_0x25726d=_0x25726d-0x0;var _0x2f7b01=_0x47a5[_0x25726d];return _0x2f7b01;};'use strict';var multer=require(_0x547a('0x0'));var util=require(_0x547a('0x1'));var path=require('path');var timeout=require(_0x547a('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x547a('0x3'));var interaction=require(_0x547a('0x4'));var config=require(_0x547a('0x5'));var controller=require(_0x547a('0x6'));router[_0x547a('0x7')]('/',auth[_0x547a('0x8')](),controller['index']);router[_0x547a('0x7')](_0x547a('0x9'),auth[_0x547a('0x8')](),controller[_0x547a('0xa')]);router[_0x547a('0x7')]('/:id/sounds',auth[_0x547a('0x8')](),controller['getSounds']);router[_0x547a('0xb')]('/',auth[_0x547a('0x8')](),controller[_0x547a('0xc')]);router['post'](_0x547a('0xd'),auth[_0x547a('0x8')](),controller['addSound']);router[_0x547a('0xe')](_0x547a('0x9'),auth[_0x547a('0x8')](),controller[_0x547a('0xf')]);router[_0x547a('0x10')]('/:id',auth[_0x547a('0x8')](),controller['destroy']);router[_0x547a('0x10')](_0x547a('0x11'),auth[_0x547a('0x8')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0x98c3=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','/:id/sounds','isAuthenticated','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0x98c3,0xab));var _0x398c=function(_0x259e66,_0x11c49f){_0x259e66=_0x259e66-0x0;var _0x10e8ca=_0x98c3[_0x259e66];return _0x10e8ca;};'use strict';var multer=require(_0x398c('0x0'));var util=require(_0x398c('0x1'));var path=require(_0x398c('0x2'));var timeout=require(_0x398c('0x3'));var express=require(_0x398c('0x4'));var router=express[_0x398c('0x5')]();var auth=require(_0x398c('0x6'));var interaction=require(_0x398c('0x7'));var config=require(_0x398c('0x8'));var controller=require(_0x398c('0x9'));router[_0x398c('0xa')]('/',auth['isAuthenticated'](),controller[_0x398c('0xb')]);router['get'](_0x398c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x398c('0xa')](_0x398c('0xd'),auth[_0x398c('0xe')](),controller['getSounds']);router[_0x398c('0xf')]('/',auth[_0x398c('0xe')](),controller[_0x398c('0x10')]);router[_0x398c('0xf')](_0x398c('0xd'),auth[_0x398c('0xe')](),controller[_0x398c('0x11')]);router[_0x398c('0x12')]('/:id',auth[_0x398c('0xe')](),controller[_0x398c('0x13')]);router[_0x398c('0x14')]('/:id',auth[_0x398c('0xe')](),controller[_0x398c('0x15')]);router[_0x398c('0x14')](_0x398c('0x16'),auth['isAuthenticated'](),controller[_0x398c('0x17')]);module[_0x398c('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 484cc16..d3fe92c 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 _0x8bd5=['STRING','ENUM','files','mp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x343f84,_0x2723a4){var _0x434f34=function(_0x21ee02){while(--_0x21ee02){_0x343f84['push'](_0x343f84['shift']());}};_0x434f34(++_0x2723a4);}(_0x8bd5,0xd7));var _0x58bd=function(_0x18f58b,_0x91084a){_0x18f58b=_0x18f58b-0x0;var _0x2d9f69=_0x8bd5[_0x18f58b];return _0x2d9f69;};'use strict';var Sequelize=require(_0x58bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x58bd('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x58bd('0x2')]('custom',_0x58bd('0x3'),_0x58bd('0x4'),'quietmp3nb','quietmp3',_0x58bd('0x5')),'allowNull':!![],'defaultValue':_0x58bd('0x3')},'directory':{'type':Sequelize[_0x58bd('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x58bd('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x58bd('0x1')],'allowNull':!![],'defaultValue':_0x58bd('0x6')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x58bd('0x7')},'defaultEntry':{'type':Sequelize[_0x58bd('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdf7a=['mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf7a,0x18b));var _0xadf7=function(_0x131712,_0x2ed068){_0x131712=_0x131712-0x0;var _0x292b97=_0xdf7a[_0x131712];return _0x292b97;};'use strict';var Sequelize=require(_0xadf7('0x0'));module[_0xadf7('0x1')]={'name':{'type':Sequelize[_0xadf7('0x2')],'allowNull':![],'unique':_0xadf7('0x3')},'mode':{'type':Sequelize[_0xadf7('0x4')]('custom','files',_0xadf7('0x5'),_0xadf7('0x6'),_0xadf7('0x7'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xadf7('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xadf7('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xadf7('0x2')],'allowNull':!![],'defaultValue':_0xadf7('0x8')},'format':{'type':Sequelize[_0xadf7('0x2')],'allowNull':!![]},'stamp':{'type':_0xadf7('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index d4e9a95..942fc43 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x23ceda,_0x2314f9){var _0x19dfbf=function(_0xa80357){while(--_0xa80357){_0x23ceda['push'](_0x23ceda['shift']());}};_0x19dfbf(++_0x2314f9);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a5e11,_0x346470){_0x3a5e11=_0x3a5e11-0x0;var _0x2ca2ba=_0xb10b[_0x3a5e11];return _0x2ca2ba;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file +var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x64e803,_0x373f26){var _0x14a7dc=function(_0x156787){while(--_0x156787){_0x64e803['push'](_0x64e803['shift']());}};_0x14a7dc(++_0x373f26);}(_0xb10b,0x12a));var _0xbb10=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0xb10b[_0xf4d05];return _0x47c971;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b4caed1..8f59d59 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 _0xda2a=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xda2a,0x143));var _0xada2=function(_0x2dbb87,_0x437249){_0x2dbb87=_0x2dbb87-0x0;var _0x41d28a=_0xda2a[_0x2dbb87];return _0x41d28a;};'use strict';var _=require(_0xada2('0x0'));var util=require('util');var logger=require(_0xada2('0x1'))(_0xada2('0x2'));var moment=require('moment');var BPromise=require(_0xada2('0x3'));var rp=require(_0xada2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xada2('0x5'));var config=require(_0xada2('0x6'));var attributes=require(_0xada2('0x7'));module[_0xada2('0x8')]=function(_0xf99488,_0xfc6052){return _0xf99488[_0xada2('0x9')](_0xada2('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50e8=['define','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xbf1fbd,_0x10939a){var _0x17f0e4=function(_0x431e4d){while(--_0x431e4d){_0xbf1fbd['push'](_0xbf1fbd['shift']());}};_0x17f0e4(++_0x10939a);}(_0x50e8,0x91));var _0x850e=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x50e8[_0x187d80];return _0x498a77;};'use strict';var _=require(_0x850e('0x0'));var util=require(_0x850e('0x1'));var logger=require(_0x850e('0x2'))(_0x850e('0x3'));var moment=require(_0x850e('0x4'));var BPromise=require(_0x850e('0x5'));var rp=require(_0x850e('0x6'));var fs=require('fs');var path=require(_0x850e('0x7'));var rimraf=require(_0x850e('0x8'));var config=require(_0x850e('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x850e('0xa')]=function(_0x56605b,_0x29d993){return _0x56605b[_0x850e('0xb')](_0x850e('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 8bfe7dd..7de2914 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 _0x658d=['request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x3d7e4a,_0x405640){var _0x43b14=function(_0x105ff4){while(--_0x105ff4){_0x3d7e4a['push'](_0x3d7e4a['shift']());}};_0x43b14(++_0x405640);}(_0x658d,0x6a));var _0xd658=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x658d[_0x125ff8];return _0x2d9ef;};'use strict';var _=require(_0xd658('0x0'));var util=require('util');var moment=require(_0xd658('0x1'));var BPromise=require(_0xd658('0x2'));var rs=require(_0xd658('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd658('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd658('0x5'));var config=require(_0xd658('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd658('0x7')][_0xd658('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38324a,_0x19c2ee,_0x1049db){return new BPromise(function(_0x37c7e1,_0x59c525){return client[_0xd658('0x9')](_0x38324a,_0x1049db)[_0xd658('0xa')](function(_0x591b7e){logger[_0xd658('0xb')](_0xd658('0xc'),_0x19c2ee,'request\x20sent');logger['debug'](_0xd658('0xd'),_0x19c2ee,_0xd658('0xe'),JSON[_0xd658('0xf')](_0x591b7e));if(_0x591b7e['error']){if(_0x591b7e[_0xd658('0x10')][_0xd658('0x11')]===0x1f4){logger['error'](_0xd658('0xc'),_0x19c2ee,_0x591b7e[_0xd658('0x10')][_0xd658('0x12')]);return _0x59c525(_0x591b7e[_0xd658('0x10')]['message']);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x19c2ee,_0x591b7e[_0xd658('0x10')][_0xd658('0x12')]);return _0x37c7e1(_0x591b7e[_0xd658('0x10')]['message']);}else{logger[_0xd658('0xb')](_0xd658('0xc'),_0x19c2ee,_0xd658('0xe'));_0x37c7e1(_0x591b7e['result'][_0xd658('0x12')]);}})[_0xd658('0x13')](function(_0x391894){logger['error'](_0xd658('0xc'),_0x19c2ee,_0x391894);_0x59c525(_0x391894);});});} \ No newline at end of file +var _0x3631=['request\x20sent','stringify','error','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3631,0x109));var _0x1363=function(_0x16bc92,_0x1b0935){_0x16bc92=_0x16bc92-0x0;var _0x27a2d2=_0x3631[_0x16bc92];return _0x27a2d2;};'use strict';var _=require('lodash');var util=require(_0x1363('0x0'));var moment=require(_0x1363('0x1'));var BPromise=require('bluebird');var rs=require(_0x1363('0x2'));var fs=require('fs');var Redis=require(_0x1363('0x3'));var db=require(_0x1363('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1363('0x5'))(_0x1363('0x6'));var config=require(_0x1363('0x7'));var jayson=require(_0x1363('0x8'));var client=jayson[_0x1363('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a1c1d,_0x459e90,_0x1ac0a9){return new BPromise(function(_0x1417e9,_0x299c70){return client[_0x1363('0xa')](_0x5a1c1d,_0x1ac0a9)['then'](function(_0x3665c7){logger[_0x1363('0xb')](_0x1363('0xc'),_0x459e90,'request\x20sent');logger[_0x1363('0xd')](_0x1363('0xe'),_0x459e90,_0x1363('0xf'),JSON[_0x1363('0x10')](_0x3665c7));if(_0x3665c7['error']){if(_0x3665c7[_0x1363('0x11')]['code']===0x1f4){logger[_0x1363('0x11')](_0x1363('0xc'),_0x459e90,_0x3665c7[_0x1363('0x11')][_0x1363('0x12')]);return _0x299c70(_0x3665c7[_0x1363('0x11')]['message']);}logger['error'](_0x1363('0xc'),_0x459e90,_0x3665c7[_0x1363('0x11')][_0x1363('0x12')]);return _0x1417e9(_0x3665c7[_0x1363('0x11')][_0x1363('0x12')]);}else{logger[_0x1363('0xb')](_0x1363('0xc'),_0x459e90,'request\x20sent');_0x1417e9(_0x3665c7[_0x1363('0x13')][_0x1363('0x12')]);}})['catch'](function(_0x125252){logger[_0x1363('0x11')](_0x1363('0xc'),_0x459e90,_0x125252);_0x299c70(_0x125252);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 095c2e2..3ffc19b 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 _0x6e80=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','/:id/users','addAgents'];(function(_0x45fd31,_0xd821b0){var _0x3e887f=function(_0x1c190c){while(--_0x1c190c){_0x45fd31['push'](_0x45fd31['shift']());}};_0x3e887f(++_0xd821b0);}(_0x6e80,0x1cd));var _0x06e8=function(_0xc4b034,_0x3eb4fa){_0xc4b034=_0xc4b034-0x0;var _0x55f2c1=_0x6e80[_0xc4b034];return _0x55f2c1;};'use strict';var multer=require(_0x06e8('0x0'));var util=require(_0x06e8('0x1'));var path=require(_0x06e8('0x2'));var timeout=require(_0x06e8('0x3'));var express=require(_0x06e8('0x4'));var router=express['Router']();var auth=require(_0x06e8('0x5'));var interaction=require(_0x06e8('0x6'));var config=require(_0x06e8('0x7'));var controller=require('./voicePrefix.controller');router[_0x06e8('0x8')]('/',auth[_0x06e8('0x9')](),controller[_0x06e8('0xa')]);router[_0x06e8('0x8')](_0x06e8('0xb'),auth[_0x06e8('0x9')](),controller[_0x06e8('0xc')]);router['get'](_0x06e8('0xd'),auth[_0x06e8('0x9')](),controller[_0x06e8('0xe')]);router[_0x06e8('0x8')]('/:id/users',auth[_0x06e8('0x9')](),controller['getAgents']);router[_0x06e8('0xf')]('/',auth['isAuthenticated'](),controller[_0x06e8('0x10')]);router[_0x06e8('0xf')](_0x06e8('0x11'),auth['isAuthenticated'](),controller[_0x06e8('0x12')]);router[_0x06e8('0x13')](_0x06e8('0xd'),auth[_0x06e8('0x9')](),controller[_0x06e8('0x14')]);router[_0x06e8('0x15')]('/:id',auth[_0x06e8('0x9')](),controller[_0x06e8('0x16')]);router[_0x06e8('0x15')](_0x06e8('0x11'),auth[_0x06e8('0x9')](),controller['removeAgents']);module[_0x06e8('0x17')]=router; \ No newline at end of file +var _0x3d4f=['path','connect-timeout','express','Router','../../components/interaction/service','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','show','post','create','/:id/users','addAgents','put','/:id','update','delete','destroy','multer','util'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0x3d4f,0x9f));var _0xf3d4=function(_0x3de6c1,_0x4cb097){_0x3de6c1=_0x3de6c1-0x0;var _0x4453c8=_0x3d4f[_0x3de6c1];return _0x4453c8;};'use strict';var multer=require(_0xf3d4('0x0'));var util=require(_0xf3d4('0x1'));var path=require(_0xf3d4('0x2'));var timeout=require(_0xf3d4('0x3'));var express=require(_0xf3d4('0x4'));var router=express[_0xf3d4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf3d4('0x6'));var config=require('../../config/environment');var controller=require(_0xf3d4('0x7'));router[_0xf3d4('0x8')]('/',auth['isAuthenticated'](),controller[_0xf3d4('0x9')]);router['get'](_0xf3d4('0xa'),auth[_0xf3d4('0xb')](),controller[_0xf3d4('0xc')]);router[_0xf3d4('0x8')]('/:id',auth[_0xf3d4('0xb')](),controller[_0xf3d4('0xd')]);router[_0xf3d4('0x8')]('/:id/users',auth[_0xf3d4('0xb')](),controller['getAgents']);router[_0xf3d4('0xe')]('/',auth[_0xf3d4('0xb')](),controller[_0xf3d4('0xf')]);router[_0xf3d4('0xe')](_0xf3d4('0x10'),auth[_0xf3d4('0xb')](),controller[_0xf3d4('0x11')]);router[_0xf3d4('0x12')](_0xf3d4('0x13'),auth[_0xf3d4('0xb')](),controller[_0xf3d4('0x14')]);router[_0xf3d4('0x15')](_0xf3d4('0x13'),auth[_0xf3d4('0xb')](),controller[_0xf3d4('0x16')]);router[_0xf3d4('0x15')](_0xf3d4('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 28c3198..734aaf1 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 _0x2964=['sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0xfea00d,_0x2f9177){var _0xa901f0=function(_0x4fad25){while(--_0x4fad25){_0xfea00d['push'](_0xfea00d['shift']());}};_0xa901f0(++_0x2f9177);}(_0x2964,0x108));var _0x4296=function(_0x113493,_0x17821d){_0x113493=_0x113493-0x0;var _0x2dd269=_0x2964[_0x113493];return _0x2dd269;};'use strict';var Sequelize=require(_0x4296('0x0'));module[_0x4296('0x1')]={'name':{'type':Sequelize[_0x4296('0x2')],'allowNull':![],'unique':_0x4296('0x3')},'prefix':{'type':Sequelize[_0x4296('0x4')],'get':function(_0x1d5ab8){return _0x4296('0x5')+this[_0x4296('0x6')](_0x4296('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x4296('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x4296('0x7')]}}; \ No newline at end of file +var _0x9b8c=['INTEGER','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0x9b8c,0x16f));var _0xc9b8=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0x9b8c[_0x21ecc8];return _0x510c1d;};'use strict';var Sequelize=require(_0xc9b8('0x0'));module[_0xc9b8('0x1')]={'name':{'type':Sequelize[_0xc9b8('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xc9b8('0x3')],'get':function(_0x301299){return'system-'+this[_0xc9b8('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0xc9b8('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xc9b8('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 89ece40..c36a8e4 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 _0x1816=['destroy','error','stack','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','pick','where','VIRTUAL','filter','merge','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','length','find','describe','create','sequelize','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','goto','charAt','findById','addAgents','omit','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','rawAttributes','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','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','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get'];(function(_0x3d0c55,_0x141639){var _0x2f5712=function(_0x1f3ce1){while(--_0x1f3ce1){_0x3d0c55['push'](_0x3d0c55['shift']());}};_0x2f5712(++_0x141639);}(_0x1816,0x1c3));var _0x6181=function(_0x46bb1c,_0x127bcf){_0x46bb1c=_0x46bb1c-0x0;var _0x476450=_0x1816[_0x46bb1c];return _0x476450;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6181('0x0'));var zipdir=require(_0x6181('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6181('0x2'));var BPromise=require(_0x6181('0x3'));var Mustache=require(_0x6181('0x4'));var util=require(_0x6181('0x5'));var path=require(_0x6181('0x6'));var sox=require('sox');var csv=require(_0x6181('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6181('0x8'));var squel=require('squel');var crypto=require(_0x6181('0x9'));var jsforce=require(_0x6181('0xa'));var deskjs=require(_0x6181('0xb'));var toCsv=require(_0x6181('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6181('0xc'));var authService=require(_0x6181('0xd'));var qs=require(_0x6181('0xe'));var as=require(_0x6181('0xf'));var hardwareService=require(_0x6181('0x10'));var logger=require(_0x6181('0x11'))(_0x6181('0x12'));var utils=require(_0x6181('0x13'));var config=require(_0x6181('0x14'));var db=require(_0x6181('0x15'))['db'];config[_0x6181('0x16')]=_['defaults'](config['redis'],{'host':_0x6181('0x17'),'port':0x18eb});var socket=require(_0x6181('0x18'))(new Redis(config[_0x6181('0x16')]));require(_0x6181('0x19'))[_0x6181('0x1a')](socket);function respondWithStatusCode(_0xb1a14f,_0x2afbae){_0x2afbae=_0x2afbae||0xcc;return function(_0x1a2c5d){if(_0x1a2c5d){return _0xb1a14f[_0x6181('0x1b')](_0x2afbae);}return _0xb1a14f[_0x6181('0x1c')](_0x2afbae)[_0x6181('0x1d')]();};}function respondWithResult(_0x24530d,_0x3c1f95){_0x3c1f95=_0x3c1f95||0xc8;return function(_0x2d8d37){if(_0x2d8d37){return _0x24530d['status'](_0x3c1f95)[_0x6181('0x1e')](_0x2d8d37);}};}function respondWithFilteredResult(_0x27bc9b,_0x2363e8){return function(_0x1f0292){if(_0x1f0292){var _0x1d7376=_0x1f0292[_0x6181('0x1f')],_0x4313bd=_0x2363e8[_0x6181('0x20')],_0x1f3831=_0x2363e8[_0x6181('0x20')]+_0x2363e8['limit'],_0x27b35d;if(_0x1f3831>=_0x1d7376){_0x1f3831=_0x1d7376;_0x27b35d=0xc8;}else{_0x27b35d=0xce;}_0x27bc9b[_0x6181('0x1c')](_0x27b35d);return _0x27bc9b[_0x6181('0x21')](_0x6181('0x22'),_0x4313bd+'-'+_0x1f3831+'/'+_0x1d7376)[_0x6181('0x1e')](_0x1f0292);}return null;};}function patchUpdates(_0x10acaf){return function(_0x46597b){try{jsonpatch[_0x6181('0x23')](_0x46597b,_0x10acaf,!![]);}catch(_0x336885){return BPromise[_0x6181('0x24')](_0x336885);}return _0x46597b[_0x6181('0x25')]();};}function saveUpdates(_0x30bd21,_0xee3e9c){return function(_0x2dde1a){if(_0x2dde1a){return _0x2dde1a[_0x6181('0x26')](_0x30bd21)[_0x6181('0x27')](function(_0x4eab2e){return _0x4eab2e;});}return null;};}function removeEntity(_0x8e643a,_0x277815){return function(_0x166e34){if(_0x166e34){return _0x166e34['destroy']()[_0x6181('0x27')](function(){var _0x1851e8=_0x166e34[_0x6181('0x28')]({'plain':!![]});var _0x535c69='VoicePrefixes';return db['UserProfileResource'][_0x6181('0x29')]({'where':{'type':_0x535c69,'resourceId':_0x1851e8['id']}})[_0x6181('0x27')](function(){return _0x166e34;});})['then'](function(){_0x8e643a[_0x6181('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6e2396,_0x18d254){return function(_0x5e780d){if(!_0x5e780d){_0x6e2396[_0x6181('0x1b')](0x194);}return _0x5e780d;};}function handleError(_0x5c37d1,_0x48a355){_0x48a355=_0x48a355||0x1f4;return function(_0x432102){logger[_0x6181('0x2a')](_0x432102[_0x6181('0x2b')]);if(_0x432102[_0x6181('0x2c')]){delete _0x432102[_0x6181('0x2c')];}_0x5c37d1[_0x6181('0x1c')](_0x48a355)[_0x6181('0x2d')](_0x432102);};}exports[_0x6181('0x2e')]=function(_0x309951,_0x24e80e){var _0x23badd={},_0x4e583c={},_0x492674={'count':0x0,'rows':[]};var _0x138732=_[_0x6181('0x2f')](db['VoicePrefix']['rawAttributes'],function(_0x2f0046){return{'name':_0x2f0046[_0x6181('0x30')],'type':_0x2f0046[_0x6181('0x31')]['key']};});_0x4e583c[_0x6181('0x32')]=_[_0x6181('0x2f')](_0x138732,'name');_0x4e583c['query']=_[_0x6181('0x33')](_0x309951[_0x6181('0x34')]);_0x4e583c[_0x6181('0x35')]=_['intersection'](_0x4e583c[_0x6181('0x32')],_0x4e583c[_0x6181('0x34')]);_0x23badd['attributes']=_[_0x6181('0x36')](_0x4e583c[_0x6181('0x32')],qs[_0x6181('0x37')](_0x309951[_0x6181('0x34')]['fields']));_0x23badd[_0x6181('0x38')]=_0x23badd[_0x6181('0x38')]['length']?_0x23badd[_0x6181('0x38')]:_0x4e583c[_0x6181('0x32')];if(!_0x309951[_0x6181('0x34')][_0x6181('0x39')]('nolimit')){_0x23badd[_0x6181('0x3a')]=qs[_0x6181('0x3a')](_0x309951[_0x6181('0x34')][_0x6181('0x3a')]);_0x23badd[_0x6181('0x20')]=qs[_0x6181('0x20')](_0x309951[_0x6181('0x34')][_0x6181('0x20')]);}_0x23badd[_0x6181('0x3b')]=qs[_0x6181('0x3c')](_0x309951[_0x6181('0x34')][_0x6181('0x3c')]);_0x23badd['where']=qs[_0x6181('0x35')](_[_0x6181('0x3d')](_0x309951[_0x6181('0x34')],_0x4e583c[_0x6181('0x35')]),_0x138732);if(_0x309951[_0x6181('0x34')]['filter']){_0x23badd['where']=_['merge'](_0x23badd[_0x6181('0x3e')],{'$or':_[_0x6181('0x2f')](_0x138732,function(_0x3938da){if(_0x3938da[_0x6181('0x31')]!==_0x6181('0x3f')){var _0x5282a6={};_0x5282a6[_0x3938da[_0x6181('0x2c')]]={'$like':'%'+_0x309951[_0x6181('0x34')][_0x6181('0x40')]+'%'};return _0x5282a6;}})});}_0x23badd=_[_0x6181('0x41')]({},_0x23badd,_0x309951[_0x6181('0x42')]);var _0x97732a={'where':_0x23badd[_0x6181('0x3e')]};return db[_0x6181('0x43')][_0x6181('0x1f')](_0x97732a)[_0x6181('0x27')](function(_0x5359c1){_0x492674['count']=_0x5359c1;if(_0x309951['query'][_0x6181('0x44')]){_0x23badd[_0x6181('0x45')]=[{'all':!![]}];}return db[_0x6181('0x43')][_0x6181('0x46')](_0x23badd);})[_0x6181('0x27')](function(_0x4bfb1b){_0x492674[_0x6181('0x47')]=_0x4bfb1b;return _0x492674;})[_0x6181('0x27')](respondWithFilteredResult(_0x24e80e,_0x23badd))[_0x6181('0x48')](handleError(_0x24e80e,null));};exports[_0x6181('0x49')]=function(_0x9ff42f,_0x4481db){var _0x22ed45={'raw':![],'where':{'id':_0x9ff42f[_0x6181('0x4a')]['id']}},_0x2cc138={};_0x2cc138[_0x6181('0x32')]=_[_0x6181('0x33')](db['VoicePrefix']['rawAttributes']);_0x2cc138[_0x6181('0x34')]=_[_0x6181('0x33')](_0x9ff42f['query']);_0x2cc138[_0x6181('0x35')]=_['intersection'](_0x2cc138['model'],_0x2cc138['query']);_0x22ed45[_0x6181('0x38')]=_[_0x6181('0x36')](_0x2cc138[_0x6181('0x32')],qs['fields'](_0x9ff42f[_0x6181('0x34')][_0x6181('0x37')]));_0x22ed45[_0x6181('0x38')]=_0x22ed45[_0x6181('0x38')][_0x6181('0x4b')]?_0x22ed45[_0x6181('0x38')]:_0x2cc138[_0x6181('0x32')];if(_0x9ff42f[_0x6181('0x34')][_0x6181('0x44')]){_0x22ed45[_0x6181('0x45')]=[{'all':!![]}];}_0x22ed45=_[_0x6181('0x41')]({},_0x22ed45,_0x9ff42f[_0x6181('0x42')]);return db[_0x6181('0x43')]['find'](_0x22ed45)['then'](handleEntityNotFound(_0x4481db,null))[_0x6181('0x27')](respondWithResult(_0x4481db,null))[_0x6181('0x48')](handleError(_0x4481db,null));};exports[_0x6181('0x29')]=function(_0x50d024,_0x558384){return db['VoicePrefix'][_0x6181('0x4c')]({'where':{'id':_0x50d024[_0x6181('0x4a')]['id']}})[_0x6181('0x27')](handleEntityNotFound(_0x558384,null))[_0x6181('0x27')](removeEntity(_0x558384,null))['catch'](handleError(_0x558384,null));};exports[_0x6181('0x4d')]=function(_0x3e9800,_0x2e50a){return db[_0x6181('0x43')][_0x6181('0x4d')]()['then'](respondWithResult(_0x2e50a,null))[_0x6181('0x48')](handleError(_0x2e50a,null));};exports[_0x6181('0x4e')]=function(_0x14b3c5,_0x2176b5){var _0x41d4e4;return db[_0x6181('0x4f')][_0x6181('0x50')](function(_0x13afa6){return db['VoicePrefix'][_0x6181('0x4e')](_0x14b3c5[_0x6181('0x51')],{'transaction':_0x13afa6})[_0x6181('0x27')](function(_0x1a7352){_0x41d4e4=_0x1a7352[_0x6181('0x28')]({'plain':!![]});return db[_0x6181('0x52')]['find']({'where':{'id':_0x41d4e4['VoiceExtensionId']},'raw':!![]})[_0x6181('0x27')](function(_0x8ed0da){return createVoicePrefixExtensions(_0x41d4e4,_0x8ed0da,_0x13afa6);});});})[_0x6181('0x27')](function(){var _0x106c96=_0x14b3c5[_0x6181('0x53')][_0x6181('0x28')]({'plain':!![]});if(!_0x106c96)throw new Error(_0x6181('0x54'));if(_0x106c96['role']==='user'){var _0x13edfe=_0x41d4e4;return db[_0x6181('0x55')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x106c96[_0x6181('0x56')]},'raw':!![]})[_0x6181('0x27')](function(_0x308ce4){if(_0x308ce4&&_0x308ce4[_0x6181('0x57')]===0x0){return db[_0x6181('0x58')][_0x6181('0x4e')]({'name':_0x13edfe[_0x6181('0x2c')],'resourceId':_0x13edfe['id'],'type':_0x308ce4[_0x6181('0x2c')],'sectionId':_0x308ce4['id']},{})[_0x6181('0x27')](function(){return _0x41d4e4;});}else{return _0x41d4e4;}})[_0x6181('0x48')](function(_0x283d0d){logger['error'](_0x6181('0x59'),_0x283d0d);throw _0x283d0d;});}return _0x41d4e4;})[_0x6181('0x27')](respondWithResult(_0x2176b5,null))[_0x6181('0x48')](handleError(_0x2176b5,null));};function Extension(_0xca8e09,_0x40b53e,_0x461e41,_0x39ffbd){this[_0x6181('0x5a')]=_0x6181('0x5b');this[_0x6181('0x5c')]=_0xca8e09;this['app']=_0x461e41;this[_0x6181('0x31')]=_0x6181('0x5d');this['description']=_0x6181('0x5e');this[_0x6181('0x5f')]=_0x40b53e;this['appdata']=_0x39ffbd;}function createVoicePrefixExtensions(_0x2bed3b,_0x42761e,_0x5622d5){return new BPromise(function(_0xde8d67,_0x5b2b52){var _0x1f0453=new Extension(formatPrefixName(_0x2bed3b[_0x6181('0x60')]),0x1,_0x6181('0x61'),_0x6181('0x62'));_0x1f0453[_0x6181('0x63')]=_0x2bed3b['id'];return db['VoiceExtension']['create'](_0x1f0453,{'transaction':_0x5622d5})[_0x6181('0x27')](function(_0x4ada29){var _0x42dc4a=_0x4ada29[_0x6181('0x28')]({'plain':!![]});var _0x31c335=_[_0x6181('0x2f')](addVoicePrefixExtensions(_0x2bed3b,_0x42761e),function(_0x1cadb7){_0x1cadb7[_0x6181('0x64')]=_0x42dc4a['id'];_0x1cadb7[_0x6181('0x63')]=_0x2bed3b['id'];return _0x1cadb7;});return db[_0x6181('0x52')][_0x6181('0x65')](_0x31c335,{'transaction':_0x5622d5})[_0x6181('0x27')](function(_0xd0ca40){if(!_0xd0ca40){return _0x5b2b52(_0x6181('0x66'));}else{return _0xde8d67(_0xd0ca40);}})[_0x6181('0x48')](function(_0x463cb4){return _0x5b2b52(_0x463cb4);});});;});};function addVoicePrefixExtensions(_0x1aba9e,_0x3d7fee){var _0x571ce9=[];var _0x372b88=formatPrefixName(_0x1aba9e[_0x6181('0x60')]);_0x571ce9[_0x6181('0x67')](new Extension(_0x372b88,0x2,_0x6181('0x68'),_0x6181('0x69')+_0x1aba9e[_0x6181('0x2c')]));if(_0x1aba9e[_0x6181('0x6a')]){_0x571ce9['push'](new Extension(_0x372b88,0x3,_0x6181('0x68'),'PREFIX-CALLERIDALL='+_0x1aba9e[_0x6181('0x6a')]));}else{_0x571ce9[_0x6181('0x67')](new Extension(_0x372b88,0x3,_0x6181('0x61'),'No\x20callerid\x20available'));}_0x571ce9[_0x6181('0x67')](new Extension(_0x372b88,0x4,_0x6181('0x6b'),_0x3d7fee[_0x6181('0x5a')]+','+'${EXTEN:'+(0x8+_0x1aba9e[_0x6181('0x2c')][_0x6181('0x4b')])+'}'+','+0x1));return _0x571ce9;}function formatPrefixName(_0x2091a6){var _0x12478b='_';for(var _0x5cb79d=0x0;_0x5cb79d<_0x2091a6[_0x6181('0x4b')];_0x5cb79d++){if(_0x2091a6[_0x6181('0x6c')](_0x5cb79d)=='-'){_0x12478b+=_0x2091a6[_0x6181('0x6c')](_0x5cb79d);}else{_0x12478b+='['+_0x2091a6[_0x6181('0x6c')](_0x5cb79d)+']';}}_0x12478b+='.';return _0x12478b;}exports[_0x6181('0x26')]=function(_0x48777c,_0x1eb1ad,_0x41ce3a){var _0x5d34c3=_0x48777c[_0x6181('0x51')];_0x5d34c3[_0x6181('0x60')]='system-'+_0x5d34c3[_0x6181('0x2c')]+'-';return db['sequelize']['transaction'](function(_0x15a645){return db[_0x6181('0x43')][_0x6181('0x26')](_0x5d34c3,{'where':{'id':_0x5d34c3['id']},'transaction':_0x15a645})['then'](function(){return db[_0x6181('0x52')][_0x6181('0x29')]({'where':{'VoicePrefixId':_0x5d34c3['id']},'transaction':_0x15a645})[_0x6181('0x27')](function(){return db[_0x6181('0x52')][_0x6181('0x4c')]({'where':{'id':_0x5d34c3[_0x6181('0x64')]},'raw':!![]})[_0x6181('0x27')](function(_0x1cc1aa){return createVoicePrefixExtensions(_0x5d34c3,_0x1cc1aa,_0x15a645);});});});})['then'](function(){return db[_0x6181('0x43')][_0x6181('0x6d')](_0x5d34c3['id']);})['then'](respondWithResult(_0x1eb1ad,null))[_0x6181('0x48')](handleError(_0x1eb1ad,null));};exports['addAgents']=function(_0x580e3e,_0x350403,_0x2cab5a){return db['VoicePrefix'][_0x6181('0x4c')]({'where':{'id':_0x580e3e['params']['id']}})[_0x6181('0x27')](handleEntityNotFound(_0x350403,null))[_0x6181('0x27')](function(_0x4b20ce){if(_0x4b20ce){return _0x4b20ce[_0x6181('0x6e')](_0x580e3e['body']['ids'],_[_0x6181('0x6f')](_0x580e3e[_0x6181('0x51')],[_0x6181('0x70'),'id'])||{})[_0x6181('0x71')](function(_0x504aac){for(var _0xe1e2a8=0x0;_0xe1e2a8<_0x580e3e['body'][_0x6181('0x70')]['length'];_0xe1e2a8+=0x1){socket['emit'](_0x6181('0x72'),{'UserId':_0x580e3e['body']['ids'][_0xe1e2a8],'VoicePrefixId':_0x580e3e[_0x6181('0x4a')]['id']});}return _0x504aac;});}})[_0x6181('0x27')](respondWithResult(_0x350403,null))[_0x6181('0x48')](handleError(_0x350403,null));};exports[_0x6181('0x73')]=function(_0x195aa0,_0x3b166f,_0x52be47){return db[_0x6181('0x43')][_0x6181('0x4c')]({'where':{'id':_0x195aa0[_0x6181('0x4a')]['id']}})[_0x6181('0x27')](handleEntityNotFound(_0x3b166f,null))[_0x6181('0x27')](function(_0x8985de){if(_0x8985de){return _0x8985de[_0x6181('0x73')](_0x195aa0[_0x6181('0x34')][_0x6181('0x70')])[_0x6181('0x27')](function(){if(_[_0x6181('0x74')](_0x195aa0[_0x6181('0x34')][_0x6181('0x70')])){for(var _0x19f427=0x0;_0x19f427<_0x195aa0['query'][_0x6181('0x70')][_0x6181('0x4b')];_0x19f427+=0x1){socket[_0x6181('0x75')](_0x6181('0x76'),{'UserId':Number(_0x195aa0[_0x6181('0x34')][_0x6181('0x70')][_0x19f427]),'VoicePrefixId':Number(_0x195aa0[_0x6181('0x4a')]['id'])});}}else{socket[_0x6181('0x75')](_0x6181('0x76'),{'UserId':Number(_0x195aa0[_0x6181('0x34')][_0x6181('0x70')]),'VoicePrefixId':Number(_0x195aa0[_0x6181('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b166f,null))[_0x6181('0x48')](handleError(_0x3b166f,null));};exports[_0x6181('0x77')]=function(_0x55bfbe,_0xf61ce9,_0x58c7ba){var _0x25cf79={};var _0x5add56={};var _0x52534;var _0x3884b2;return db['VoicePrefix'][_0x6181('0x78')]({'where':{'id':_0x55bfbe[_0x6181('0x4a')]['id']}})[_0x6181('0x27')](handleEntityNotFound(_0xf61ce9,null))[_0x6181('0x27')](function(_0x536e62){if(_0x536e62){_0x52534=_0x536e62;_0x5add56['model']=_['keys'](db[_0x6181('0x79')][_0x6181('0x7a')]);_0x5add56[_0x6181('0x34')]=_[_0x6181('0x33')](_0x55bfbe['query']);_0x5add56['filters']=_[_0x6181('0x36')](_0x5add56['model'],_0x5add56[_0x6181('0x34')]);_0x25cf79[_0x6181('0x38')]=_[_0x6181('0x36')](_0x5add56[_0x6181('0x32')],qs[_0x6181('0x37')](_0x55bfbe[_0x6181('0x34')][_0x6181('0x37')]));_0x25cf79[_0x6181('0x38')]=_0x25cf79[_0x6181('0x38')][_0x6181('0x4b')]?_0x25cf79['attributes']:_0x5add56[_0x6181('0x32')];_0x25cf79[_0x6181('0x3b')]=qs[_0x6181('0x3c')](_0x55bfbe[_0x6181('0x34')][_0x6181('0x3c')]);_0x25cf79[_0x6181('0x3e')]=qs[_0x6181('0x35')](_[_0x6181('0x3d')](_0x55bfbe['query'],_0x5add56['filters']));if(_0x55bfbe[_0x6181('0x34')][_0x6181('0x40')]){_0x25cf79[_0x6181('0x3e')]=_[_0x6181('0x41')](_0x25cf79[_0x6181('0x3e')],{'$or':_[_0x6181('0x2f')](_0x25cf79[_0x6181('0x38')],function(_0x49bfc6){var _0x445307={};_0x445307[_0x49bfc6]={'$like':'%'+_0x55bfbe[_0x6181('0x34')]['filter']+'%'};return _0x445307;})});}_0x25cf79=_[_0x6181('0x41')]({},_0x25cf79,_0x55bfbe[_0x6181('0x42')]);return _0x52534['getAgents'](_0x25cf79);}})['then'](function(_0x5b934a){if(_0x5b934a){_0x3884b2=_0x5b934a[_0x6181('0x4b')];if(!_0x55bfbe[_0x6181('0x34')][_0x6181('0x39')]('nolimit')){_0x25cf79[_0x6181('0x3a')]=qs[_0x6181('0x3a')](_0x55bfbe[_0x6181('0x34')][_0x6181('0x3a')]);_0x25cf79[_0x6181('0x20')]=qs['offset'](_0x55bfbe[_0x6181('0x34')][_0x6181('0x20')]);}return _0x52534[_0x6181('0x77')](_0x25cf79);}})[_0x6181('0x27')](function(_0x5cbeb4){if(_0x5cbeb4){return _0x5cbeb4?{'count':_0x3884b2,'rows':_0x5cbeb4}:null;}})[_0x6181('0x27')](respondWithResult(_0xf61ce9,null))[_0x6181('0x48')](handleError(_0xf61ce9,null));}; \ No newline at end of file +var _0x6d79=['offset','limit','reject','save','update','then','destroy','get','VoicePrefixes','end','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','transaction','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Set','CDR(prefix)=','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','count'];(function(_0x402223,_0x212f03){var _0x5928b7=function(_0x520196){while(--_0x520196){_0x402223['push'](_0x402223['shift']());}};_0x5928b7(++_0x212f03);}(_0x6d79,0x159));var _0x96d7=function(_0x390cc8,_0x2b3972){_0x390cc8=_0x390cc8-0x0;var _0x12c6b7=_0x6d79[_0x390cc8];return _0x12c6b7;};'use strict';var pdf=require(_0x96d7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x96d7('0x1'));var jsonpatch=require(_0x96d7('0x2'));var rp=require('request-promise');var moment=require(_0x96d7('0x3'));var BPromise=require(_0x96d7('0x4'));var Mustache=require(_0x96d7('0x5'));var util=require(_0x96d7('0x6'));var path=require(_0x96d7('0x7'));var sox=require(_0x96d7('0x8'));var csv=require(_0x96d7('0x9'));var ejs=require(_0x96d7('0xa'));var fs=require('fs');var _=require(_0x96d7('0xb'));var squel=require(_0x96d7('0xc'));var crypto=require('crypto');var jsforce=require(_0x96d7('0xd'));var deskjs=require(_0x96d7('0xe'));var toCsv=require(_0x96d7('0x9'));var querystring=require(_0x96d7('0xf'));var Papa=require(_0x96d7('0x10'));var Redis=require(_0x96d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x96d7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x96d7('0x13'))(_0x96d7('0x14'));var utils=require(_0x96d7('0x15'));var config=require(_0x96d7('0x16'));var db=require(_0x96d7('0x17'))['db'];config['redis']=_[_0x96d7('0x18')](config[_0x96d7('0x19')],{'host':_0x96d7('0x1a'),'port':0x18eb});var socket=require(_0x96d7('0x1b'))(new Redis(config[_0x96d7('0x19')]));require(_0x96d7('0x1c'))[_0x96d7('0x1d')](socket);function respondWithStatusCode(_0x232a4e,_0x2e975a){_0x2e975a=_0x2e975a||0xcc;return function(_0x438be3){if(_0x438be3){return _0x232a4e[_0x96d7('0x1e')](_0x2e975a);}return _0x232a4e['status'](_0x2e975a)['end']();};}function respondWithResult(_0x5c13e7,_0xd29419){_0xd29419=_0xd29419||0xc8;return function(_0x2b875f){if(_0x2b875f){return _0x5c13e7[_0x96d7('0x1f')](_0xd29419)['json'](_0x2b875f);}};}function respondWithFilteredResult(_0x19efe5,_0x57dece){return function(_0x3ad357){if(_0x3ad357){var _0x1db141=_0x3ad357[_0x96d7('0x20')],_0x85e7d8=_0x57dece[_0x96d7('0x21')],_0x12ad80=_0x57dece['offset']+_0x57dece[_0x96d7('0x22')],_0x5a5816;if(_0x12ad80>=_0x1db141){_0x12ad80=_0x1db141;_0x5a5816=0xc8;}else{_0x5a5816=0xce;}_0x19efe5[_0x96d7('0x1f')](_0x5a5816);return _0x19efe5['set']('Content-Range',_0x85e7d8+'-'+_0x12ad80+'/'+_0x1db141)['json'](_0x3ad357);}return null;};}function patchUpdates(_0x524117){return function(_0x96618c){try{jsonpatch['apply'](_0x96618c,_0x524117,!![]);}catch(_0x181f9d){return BPromise[_0x96d7('0x23')](_0x181f9d);}return _0x96618c[_0x96d7('0x24')]();};}function saveUpdates(_0x5c488a,_0x4ed80c){return function(_0x4c4145){if(_0x4c4145){return _0x4c4145[_0x96d7('0x25')](_0x5c488a)[_0x96d7('0x26')](function(_0x1d6731){return _0x1d6731;});}return null;};}function removeEntity(_0x5c98c4,_0x1613f5){return function(_0x1c4e01){if(_0x1c4e01){return _0x1c4e01[_0x96d7('0x27')]()[_0x96d7('0x26')](function(){var _0x50c183=_0x1c4e01[_0x96d7('0x28')]({'plain':!![]});var _0x462595=_0x96d7('0x29');return db['UserProfileResource'][_0x96d7('0x27')]({'where':{'type':_0x462595,'resourceId':_0x50c183['id']}})[_0x96d7('0x26')](function(){return _0x1c4e01;});})[_0x96d7('0x26')](function(){_0x5c98c4[_0x96d7('0x1f')](0xcc)[_0x96d7('0x2a')]();});}};}function handleEntityNotFound(_0x32ed83,_0x39434b){return function(_0x238567){if(!_0x238567){_0x32ed83[_0x96d7('0x1e')](0x194);}return _0x238567;};}function handleError(_0x1b4bef,_0x12f644){_0x12f644=_0x12f644||0x1f4;return function(_0x935141){logger[_0x96d7('0x2b')](_0x935141[_0x96d7('0x2c')]);if(_0x935141[_0x96d7('0x2d')]){delete _0x935141[_0x96d7('0x2d')];}_0x1b4bef[_0x96d7('0x1f')](_0x12f644)[_0x96d7('0x2e')](_0x935141);};}exports[_0x96d7('0x2f')]=function(_0x50ac41,_0x3c73d1){var _0x1ea7fc={},_0x2fe515={},_0x21a441={'count':0x0,'rows':[]};var _0x10fb4c=_['map'](db[_0x96d7('0x30')][_0x96d7('0x31')],function(_0x564b39){return{'name':_0x564b39[_0x96d7('0x32')],'type':_0x564b39[_0x96d7('0x33')]['key']};});_0x2fe515[_0x96d7('0x34')]=_[_0x96d7('0x35')](_0x10fb4c,'name');_0x2fe515[_0x96d7('0x36')]=_[_0x96d7('0x37')](_0x50ac41[_0x96d7('0x36')]);_0x2fe515[_0x96d7('0x38')]=_[_0x96d7('0x39')](_0x2fe515[_0x96d7('0x34')],_0x2fe515['query']);_0x1ea7fc['attributes']=_[_0x96d7('0x39')](_0x2fe515[_0x96d7('0x34')],qs['fields'](_0x50ac41[_0x96d7('0x36')][_0x96d7('0x3a')]));_0x1ea7fc['attributes']=_0x1ea7fc[_0x96d7('0x3b')][_0x96d7('0x3c')]?_0x1ea7fc[_0x96d7('0x3b')]:_0x2fe515[_0x96d7('0x34')];if(!_0x50ac41['query'][_0x96d7('0x3d')](_0x96d7('0x3e'))){_0x1ea7fc[_0x96d7('0x22')]=qs['limit'](_0x50ac41[_0x96d7('0x36')]['limit']);_0x1ea7fc['offset']=qs['offset'](_0x50ac41[_0x96d7('0x36')][_0x96d7('0x21')]);}_0x1ea7fc[_0x96d7('0x3f')]=qs[_0x96d7('0x40')](_0x50ac41[_0x96d7('0x36')][_0x96d7('0x40')]);_0x1ea7fc[_0x96d7('0x41')]=qs[_0x96d7('0x38')](_[_0x96d7('0x42')](_0x50ac41['query'],_0x2fe515[_0x96d7('0x38')]),_0x10fb4c);if(_0x50ac41[_0x96d7('0x36')][_0x96d7('0x43')]){_0x1ea7fc[_0x96d7('0x41')]=_[_0x96d7('0x44')](_0x1ea7fc[_0x96d7('0x41')],{'$or':_[_0x96d7('0x35')](_0x10fb4c,function(_0x5963d1){if(_0x5963d1[_0x96d7('0x33')]!==_0x96d7('0x45')){var _0x3f9bb4={};_0x3f9bb4[_0x5963d1['name']]={'$like':'%'+_0x50ac41[_0x96d7('0x36')][_0x96d7('0x43')]+'%'};return _0x3f9bb4;}})});}_0x1ea7fc=_[_0x96d7('0x44')]({},_0x1ea7fc,_0x50ac41[_0x96d7('0x46')]);var _0x3e1180={'where':_0x1ea7fc[_0x96d7('0x41')]};return db[_0x96d7('0x30')]['count'](_0x3e1180)[_0x96d7('0x26')](function(_0x866196){_0x21a441[_0x96d7('0x20')]=_0x866196;if(_0x50ac41[_0x96d7('0x36')][_0x96d7('0x47')]){_0x1ea7fc[_0x96d7('0x48')]=[{'all':!![]}];}return db[_0x96d7('0x30')][_0x96d7('0x49')](_0x1ea7fc);})['then'](function(_0x399a35){_0x21a441[_0x96d7('0x4a')]=_0x399a35;return _0x21a441;})['then'](respondWithFilteredResult(_0x3c73d1,_0x1ea7fc))[_0x96d7('0x4b')](handleError(_0x3c73d1,null));};exports[_0x96d7('0x4c')]=function(_0x43a345,_0x4f93f7){var _0x3a2f29={'raw':![],'where':{'id':_0x43a345[_0x96d7('0x4d')]['id']}},_0x34232e={};_0x34232e[_0x96d7('0x34')]=_[_0x96d7('0x37')](db[_0x96d7('0x30')]['rawAttributes']);_0x34232e[_0x96d7('0x36')]=_[_0x96d7('0x37')](_0x43a345[_0x96d7('0x36')]);_0x34232e[_0x96d7('0x38')]=_[_0x96d7('0x39')](_0x34232e[_0x96d7('0x34')],_0x34232e[_0x96d7('0x36')]);_0x3a2f29[_0x96d7('0x3b')]=_[_0x96d7('0x39')](_0x34232e[_0x96d7('0x34')],qs[_0x96d7('0x3a')](_0x43a345[_0x96d7('0x36')][_0x96d7('0x3a')]));_0x3a2f29[_0x96d7('0x3b')]=_0x3a2f29[_0x96d7('0x3b')][_0x96d7('0x3c')]?_0x3a2f29[_0x96d7('0x3b')]:_0x34232e[_0x96d7('0x34')];if(_0x43a345[_0x96d7('0x36')][_0x96d7('0x47')]){_0x3a2f29[_0x96d7('0x48')]=[{'all':!![]}];}_0x3a2f29=_[_0x96d7('0x44')]({},_0x3a2f29,_0x43a345[_0x96d7('0x46')]);return db[_0x96d7('0x30')][_0x96d7('0x4e')](_0x3a2f29)[_0x96d7('0x26')](handleEntityNotFound(_0x4f93f7,null))[_0x96d7('0x26')](respondWithResult(_0x4f93f7,null))[_0x96d7('0x4b')](handleError(_0x4f93f7,null));};exports[_0x96d7('0x27')]=function(_0x569967,_0x8f4be2){return db['VoicePrefix'][_0x96d7('0x4e')]({'where':{'id':_0x569967[_0x96d7('0x4d')]['id']}})[_0x96d7('0x26')](handleEntityNotFound(_0x8f4be2,null))[_0x96d7('0x26')](removeEntity(_0x8f4be2,null))[_0x96d7('0x4b')](handleError(_0x8f4be2,null));};exports['describe']=function(_0x119d3b,_0x2cf529){return db[_0x96d7('0x30')][_0x96d7('0x4f')]()[_0x96d7('0x26')](respondWithResult(_0x2cf529,null))[_0x96d7('0x4b')](handleError(_0x2cf529,null));};exports['create']=function(_0x3b8e7e,_0x2eb944){var _0x5b9dda;return db['sequelize'][_0x96d7('0x50')](function(_0x25f57e){return db[_0x96d7('0x30')][_0x96d7('0x51')](_0x3b8e7e[_0x96d7('0x52')],{'transaction':_0x25f57e})[_0x96d7('0x26')](function(_0x242138){_0x5b9dda=_0x242138[_0x96d7('0x28')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x5b9dda[_0x96d7('0x53')]},'raw':!![]})[_0x96d7('0x26')](function(_0xed94d){return createVoicePrefixExtensions(_0x5b9dda,_0xed94d,_0x25f57e);});});})[_0x96d7('0x26')](function(){var _0x255e36=_0x3b8e7e[_0x96d7('0x54')][_0x96d7('0x28')]({'plain':!![]});if(!_0x255e36)throw new Error(_0x96d7('0x55'));if(_0x255e36[_0x96d7('0x56')]==='user'){var _0x3806da=_0x5b9dda;return db[_0x96d7('0x57')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x255e36['userProfileId']},'raw':!![]})[_0x96d7('0x26')](function(_0x2f12c3){if(_0x2f12c3&&_0x2f12c3[_0x96d7('0x58')]===0x0){return db['UserProfileResource'][_0x96d7('0x51')]({'name':_0x3806da[_0x96d7('0x2d')],'resourceId':_0x3806da['id'],'type':_0x2f12c3[_0x96d7('0x2d')],'sectionId':_0x2f12c3['id']},{})['then'](function(){return _0x5b9dda;});}else{return _0x5b9dda;}})['catch'](function(_0x114e79){logger[_0x96d7('0x2b')](_0x96d7('0x59'),_0x114e79);throw _0x114e79;});}return _0x5b9dda;})[_0x96d7('0x26')](respondWithResult(_0x2eb944,null))[_0x96d7('0x4b')](handleError(_0x2eb944,null));};function Extension(_0x585a28,_0x467008,_0x5cca8f,_0x5bce6d){this[_0x96d7('0x5a')]=_0x96d7('0x5b');this[_0x96d7('0x5c')]=_0x585a28;this['app']=_0x5cca8f;this[_0x96d7('0x33')]=_0x96d7('0x5d');this[_0x96d7('0x5e')]=_0x96d7('0x5f');this[_0x96d7('0x60')]=_0x467008;this[_0x96d7('0x61')]=_0x5bce6d;}function createVoicePrefixExtensions(_0x30cb7f,_0xe04928,_0x367876){return new BPromise(function(_0x2baafb,_0x4b6250){var _0x2d0690=new Extension(formatPrefixName(_0x30cb7f[_0x96d7('0x62')]),0x1,_0x96d7('0x63'),_0x96d7('0x64'));_0x2d0690[_0x96d7('0x65')]=_0x30cb7f['id'];return db[_0x96d7('0x66')][_0x96d7('0x51')](_0x2d0690,{'transaction':_0x367876})['then'](function(_0x462bcf){var _0x59f19f=_0x462bcf['get']({'plain':!![]});var _0x390867=_[_0x96d7('0x35')](addVoicePrefixExtensions(_0x30cb7f,_0xe04928),function(_0x23fc4d){_0x23fc4d['VoiceExtensionId']=_0x59f19f['id'];_0x23fc4d[_0x96d7('0x65')]=_0x30cb7f['id'];return _0x23fc4d;});return db[_0x96d7('0x66')][_0x96d7('0x67')](_0x390867,{'transaction':_0x367876})[_0x96d7('0x26')](function(_0x8d91db){if(!_0x8d91db){return _0x4b6250('Extensions\x20creation\x20failed');}else{return _0x2baafb(_0x8d91db);}})[_0x96d7('0x4b')](function(_0x530d48){return _0x4b6250(_0x530d48);});});;});};function addVoicePrefixExtensions(_0x592d94,_0x5dea9c){var _0x5a6780=[];var _0x3b71cc=formatPrefixName(_0x592d94[_0x96d7('0x62')]);_0x5a6780['push'](new Extension(_0x3b71cc,0x2,_0x96d7('0x68'),_0x96d7('0x69')+_0x592d94['name']));if(_0x592d94['callerIdAll']){_0x5a6780[_0x96d7('0x6a')](new Extension(_0x3b71cc,0x3,_0x96d7('0x68'),_0x96d7('0x6b')+_0x592d94['callerIdAll']));}else{_0x5a6780[_0x96d7('0x6a')](new Extension(_0x3b71cc,0x3,_0x96d7('0x63'),_0x96d7('0x6c')));}_0x5a6780[_0x96d7('0x6a')](new Extension(_0x3b71cc,0x4,_0x96d7('0x6d'),_0x5dea9c['context']+','+_0x96d7('0x6e')+(0x8+_0x592d94[_0x96d7('0x2d')]['length'])+'}'+','+0x1));return _0x5a6780;}function formatPrefixName(_0x535aa9){var _0x1c6eab='_';for(var _0x26b427=0x0;_0x26b427<_0x535aa9[_0x96d7('0x3c')];_0x26b427++){if(_0x535aa9[_0x96d7('0x6f')](_0x26b427)=='-'){_0x1c6eab+=_0x535aa9[_0x96d7('0x6f')](_0x26b427);}else{_0x1c6eab+='['+_0x535aa9['charAt'](_0x26b427)+']';}}_0x1c6eab+='.';return _0x1c6eab;}exports[_0x96d7('0x25')]=function(_0xcfa2f4,_0x145ccc,_0x14d52f){var _0x221696=_0xcfa2f4[_0x96d7('0x52')];_0x221696[_0x96d7('0x62')]=_0x96d7('0x70')+_0x221696[_0x96d7('0x2d')]+'-';return db[_0x96d7('0x71')][_0x96d7('0x50')](function(_0x56e2a1){return db[_0x96d7('0x30')]['update'](_0x221696,{'where':{'id':_0x221696['id']},'transaction':_0x56e2a1})[_0x96d7('0x26')](function(){return db[_0x96d7('0x66')][_0x96d7('0x27')]({'where':{'VoicePrefixId':_0x221696['id']},'transaction':_0x56e2a1})[_0x96d7('0x26')](function(){return db[_0x96d7('0x66')][_0x96d7('0x4e')]({'where':{'id':_0x221696['VoiceExtensionId']},'raw':!![]})[_0x96d7('0x26')](function(_0x5275cf){return createVoicePrefixExtensions(_0x221696,_0x5275cf,_0x56e2a1);});});});})[_0x96d7('0x26')](function(){return db[_0x96d7('0x30')][_0x96d7('0x72')](_0x221696['id']);})[_0x96d7('0x26')](respondWithResult(_0x145ccc,null))[_0x96d7('0x4b')](handleError(_0x145ccc,null));};exports['addAgents']=function(_0x1f7ac7,_0x46a214,_0x16f20b){return db[_0x96d7('0x30')][_0x96d7('0x4e')]({'where':{'id':_0x1f7ac7[_0x96d7('0x4d')]['id']}})[_0x96d7('0x26')](handleEntityNotFound(_0x46a214,null))[_0x96d7('0x26')](function(_0x240b8e){if(_0x240b8e){return _0x240b8e[_0x96d7('0x73')](_0x1f7ac7['body'][_0x96d7('0x74')],_[_0x96d7('0x75')](_0x1f7ac7[_0x96d7('0x52')],[_0x96d7('0x74'),'id'])||{})[_0x96d7('0x76')](function(_0x528268){for(var _0x85d142=0x0;_0x85d142<_0x1f7ac7[_0x96d7('0x52')]['ids']['length'];_0x85d142+=0x1){socket[_0x96d7('0x77')](_0x96d7('0x78'),{'UserId':_0x1f7ac7[_0x96d7('0x52')][_0x96d7('0x74')][_0x85d142],'VoicePrefixId':_0x1f7ac7[_0x96d7('0x4d')]['id']});}return _0x528268;});}})['then'](respondWithResult(_0x46a214,null))[_0x96d7('0x4b')](handleError(_0x46a214,null));};exports[_0x96d7('0x79')]=function(_0x519be4,_0x477b89,_0x5a10d1){return db[_0x96d7('0x30')]['find']({'where':{'id':_0x519be4[_0x96d7('0x4d')]['id']}})[_0x96d7('0x26')](handleEntityNotFound(_0x477b89,null))['then'](function(_0x440870){if(_0x440870){return _0x440870[_0x96d7('0x79')](_0x519be4[_0x96d7('0x36')][_0x96d7('0x74')])['then'](function(){if(_['isArray'](_0x519be4[_0x96d7('0x36')][_0x96d7('0x74')])){for(var _0xc21d4a=0x0;_0xc21d4a<_0x519be4[_0x96d7('0x36')][_0x96d7('0x74')]['length'];_0xc21d4a+=0x1){socket[_0x96d7('0x77')](_0x96d7('0x7a'),{'UserId':Number(_0x519be4[_0x96d7('0x36')][_0x96d7('0x74')][_0xc21d4a]),'VoicePrefixId':Number(_0x519be4[_0x96d7('0x4d')]['id'])});}}else{socket[_0x96d7('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x519be4['query'][_0x96d7('0x74')]),'VoicePrefixId':Number(_0x519be4[_0x96d7('0x4d')]['id'])});}});}})[_0x96d7('0x26')](respondWithStatusCode(_0x477b89,null))[_0x96d7('0x4b')](handleError(_0x477b89,null));};exports[_0x96d7('0x7b')]=function(_0x337751,_0x198aec,_0x55ce8b){var _0x4503e2={};var _0xb2df55={};var _0x5be318;var _0x59e582;return db[_0x96d7('0x30')][_0x96d7('0x7c')]({'where':{'id':_0x337751[_0x96d7('0x4d')]['id']}})[_0x96d7('0x26')](handleEntityNotFound(_0x198aec,null))[_0x96d7('0x26')](function(_0x264393){if(_0x264393){_0x5be318=_0x264393;_0xb2df55[_0x96d7('0x34')]=_[_0x96d7('0x37')](db[_0x96d7('0x7d')][_0x96d7('0x31')]);_0xb2df55[_0x96d7('0x36')]=_['keys'](_0x337751[_0x96d7('0x36')]);_0xb2df55[_0x96d7('0x38')]=_['intersection'](_0xb2df55[_0x96d7('0x34')],_0xb2df55[_0x96d7('0x36')]);_0x4503e2['attributes']=_[_0x96d7('0x39')](_0xb2df55[_0x96d7('0x34')],qs[_0x96d7('0x3a')](_0x337751[_0x96d7('0x36')][_0x96d7('0x3a')]));_0x4503e2['attributes']=_0x4503e2[_0x96d7('0x3b')]['length']?_0x4503e2[_0x96d7('0x3b')]:_0xb2df55[_0x96d7('0x34')];_0x4503e2[_0x96d7('0x3f')]=qs[_0x96d7('0x40')](_0x337751[_0x96d7('0x36')][_0x96d7('0x40')]);_0x4503e2['where']=qs['filters'](_[_0x96d7('0x42')](_0x337751[_0x96d7('0x36')],_0xb2df55[_0x96d7('0x38')]));if(_0x337751[_0x96d7('0x36')][_0x96d7('0x43')]){_0x4503e2['where']=_[_0x96d7('0x44')](_0x4503e2[_0x96d7('0x41')],{'$or':_[_0x96d7('0x35')](_0x4503e2['attributes'],function(_0x237a57){var _0x128ca={};_0x128ca[_0x237a57]={'$like':'%'+_0x337751[_0x96d7('0x36')][_0x96d7('0x43')]+'%'};return _0x128ca;})});}_0x4503e2=_[_0x96d7('0x44')]({},_0x4503e2,_0x337751['options']);return _0x5be318[_0x96d7('0x7b')](_0x4503e2);}})[_0x96d7('0x26')](function(_0x49dc65){if(_0x49dc65){_0x59e582=_0x49dc65[_0x96d7('0x3c')];if(!_0x337751[_0x96d7('0x36')][_0x96d7('0x3d')]('nolimit')){_0x4503e2['limit']=qs['limit'](_0x337751[_0x96d7('0x36')][_0x96d7('0x22')]);_0x4503e2['offset']=qs[_0x96d7('0x21')](_0x337751['query'][_0x96d7('0x21')]);}return _0x5be318[_0x96d7('0x7b')](_0x4503e2);}})[_0x96d7('0x26')](function(_0x94a6d0){if(_0x94a6d0){return _0x94a6d0?{'count':_0x59e582,'rows':_0x94a6d0}:null;}})['then'](respondWithResult(_0x198aec,null))[_0x96d7('0x4b')](handleError(_0x198aec,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 51cb816..84ff6e2 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x4d84b8,_0x11645f){var _0x179857=function(_0x2a23b9){while(--_0x2a23b9){_0x4d84b8['push'](_0x4d84b8['shift']());}};_0x179857(++_0x11645f);}(_0x008c,0x188));var _0xc008=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0x008c[_0x4c06ac];return _0x2333cb;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x5964b2,_0x35b4cd){var _0x3dea9b=function(_0x3dab50){while(--_0x3dab50){_0x5964b2['push'](_0x5964b2['shift']());}};_0x3dea9b(++_0x35b4cd);}(_0x70e0,0x17b));var _0x070e=function(_0x5df8e8,_0x122cd1){_0x5df8e8=_0x5df8e8-0x0;var _0x3e9b96=_0x70e0[_0x5df8e8];return _0x3e9b96;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 33ec691..10f4ecd 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 _0x9559=['util','../../config/logger','api','bluebird','path','../../config/environment','exports','define','VoicePrefix'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x9559,0xcf));var _0x9955=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0x9559[_0x107f10];return _0x811cab;};'use strict';var _=require('lodash');var util=require(_0x9955('0x0'));var logger=require(_0x9955('0x1'))(_0x9955('0x2'));var moment=require('moment');var BPromise=require(_0x9955('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9955('0x4'));var rimraf=require('rimraf');var config=require(_0x9955('0x5'));var attributes=require('./voicePrefix.attributes');module[_0x9955('0x6')]=function(_0x2bda7c,_0x41eca4){return _0x2bda7c[_0x9955('0x7')](_0x9955('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b51=['bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','voice_prefixes','lodash','util','../../config/logger','moment'];(function(_0x5f35c5,_0x48949c){var _0x5e5d64=function(_0x3e968f){while(--_0x3e968f){_0x5f35c5['push'](_0x5f35c5['shift']());}};_0x5e5d64(++_0x48949c);}(_0x9b51,0x167));var _0x19b5=function(_0x34954b,_0x525aec){_0x34954b=_0x34954b-0x0;var _0x245230=_0x9b51[_0x34954b];return _0x245230;};'use strict';var _=require(_0x19b5('0x0'));var util=require(_0x19b5('0x1'));var logger=require(_0x19b5('0x2'))('api');var moment=require(_0x19b5('0x3'));var BPromise=require(_0x19b5('0x4'));var rp=require(_0x19b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19b5('0x6'));var config=require(_0x19b5('0x7'));var attributes=require(_0x19b5('0x8'));module[_0x19b5('0x9')]=function(_0x5ef7c8,_0x165e92){return _0x5ef7c8['define']('VoicePrefix',attributes,{'tableName':_0x19b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index badef6b..c8c0521 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 _0x6094=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voicePrefix.socket','register','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x36625f,_0x727bd6){var _0x135981=function(_0x1d8f24){while(--_0x1d8f24){_0x36625f['push'](_0x36625f['shift']());}};_0x135981(++_0x727bd6);}(_0x6094,0x9c));var _0x4609=function(_0x5ceff9,_0x366c83){_0x5ceff9=_0x5ceff9-0x0;var _0x4a95cc=_0x6094[_0x5ceff9];return _0x4a95cc;};'use strict';var _=require(_0x4609('0x0'));var util=require(_0x4609('0x1'));var moment=require(_0x4609('0x2'));var BPromise=require('bluebird');var rs=require(_0x4609('0x3'));var fs=require('fs');var Redis=require(_0x4609('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4609('0x5'));var logger=require(_0x4609('0x6'))(_0x4609('0x7'));var config=require(_0x4609('0x8'));var jayson=require(_0x4609('0x9'));var client=jayson[_0x4609('0xa')][_0x4609('0xb')]({'port':0x232a});config[_0x4609('0xc')]=_['defaults'](config[_0x4609('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4609('0xd'))(new Redis(config[_0x4609('0xc')]));require(_0x4609('0xe'))[_0x4609('0xf')](socket);function respondWithRpcPromise(_0x4cef76,_0x2d9650,_0x481fe6){return new BPromise(function(_0x41857a,_0x2f1884){return client['request'](_0x4cef76,_0x481fe6)['then'](function(_0x214ded){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2d9650,_0x4609('0x10'));logger[_0x4609('0x11')](_0x4609('0x12'),_0x2d9650,_0x4609('0x10'),JSON[_0x4609('0x13')](_0x214ded));if(_0x214ded[_0x4609('0x14')]){if(_0x214ded['error'][_0x4609('0x15')]===0x1f4){logger[_0x4609('0x14')](_0x4609('0x16'),_0x2d9650,_0x214ded['error'][_0x4609('0x17')]);return _0x2f1884(_0x214ded[_0x4609('0x14')]['message']);}logger['error'](_0x4609('0x16'),_0x2d9650,_0x214ded[_0x4609('0x14')][_0x4609('0x17')]);return _0x41857a(_0x214ded[_0x4609('0x14')][_0x4609('0x17')]);}else{logger[_0x4609('0x18')](_0x4609('0x16'),_0x2d9650,_0x4609('0x10'));_0x41857a(_0x214ded[_0x4609('0x19')][_0x4609('0x17')]);}})[_0x4609('0x1a')](function(_0x364268){logger[_0x4609('0x14')](_0x4609('0x16'),_0x2d9650,_0x364268);_0x2f1884(_0x364268);});});} \ No newline at end of file +var _0xaf5a=['./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xaf5a,0x71));var _0xaaf5=function(_0x3789b9,_0x5c2f00){_0x3789b9=_0x3789b9-0x0;var _0x4d020d=_0xaf5a[_0x3789b9];return _0x4d020d;};'use strict';var _=require('lodash');var util=require(_0xaaf5('0x0'));var moment=require(_0xaaf5('0x1'));var BPromise=require('bluebird');var rs=require(_0xaaf5('0x2'));var fs=require('fs');var Redis=require(_0xaaf5('0x3'));var db=require(_0xaaf5('0x4'))['db'];var utils=require(_0xaaf5('0x5'));var logger=require('../../config/logger')(_0xaaf5('0x6'));var config=require('../../config/environment');var jayson=require(_0xaaf5('0x7'));var client=jayson[_0xaaf5('0x8')][_0xaaf5('0x9')]({'port':0x232a});config[_0xaaf5('0xa')]=_['defaults'](config[_0xaaf5('0xa')],{'host':_0xaaf5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaaf5('0xa')]));require(_0xaaf5('0xc'))[_0xaaf5('0xd')](socket);function respondWithRpcPromise(_0x33a477,_0x311c8f,_0x517503){return new BPromise(function(_0xdad35b,_0x2b0c4d){return client['request'](_0x33a477,_0x517503)[_0xaaf5('0xe')](function(_0x356908){logger['info'](_0xaaf5('0xf'),_0x311c8f,_0xaaf5('0x10'));logger[_0xaaf5('0x11')](_0xaaf5('0x12'),_0x311c8f,_0xaaf5('0x10'),JSON[_0xaaf5('0x13')](_0x356908));if(_0x356908[_0xaaf5('0x14')]){if(_0x356908[_0xaaf5('0x14')]['code']===0x1f4){logger['error'](_0xaaf5('0xf'),_0x311c8f,_0x356908[_0xaaf5('0x14')][_0xaaf5('0x15')]);return _0x2b0c4d(_0x356908[_0xaaf5('0x14')][_0xaaf5('0x15')]);}logger[_0xaaf5('0x14')](_0xaaf5('0xf'),_0x311c8f,_0x356908[_0xaaf5('0x14')][_0xaaf5('0x15')]);return _0xdad35b(_0x356908[_0xaaf5('0x14')][_0xaaf5('0x15')]);}else{logger[_0xaaf5('0x16')](_0xaaf5('0xf'),_0x311c8f,'request\x20sent');_0xdad35b(_0x356908[_0xaaf5('0x17')][_0xaaf5('0x15')]);}})[_0xaaf5('0x18')](function(_0x1d56d5){logger[_0xaaf5('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x311c8f,_0x1d56d5);_0x2b0c4d(_0x1d56d5);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index e584da4..4cc9bdf 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 _0x1f13=['./voicePrefix.events','save','remove','emit','removeListener','length','voicePrefix:'];(function(_0x596722,_0x118ded){var _0x39aece=function(_0x23c09c){while(--_0x23c09c){_0x596722['push'](_0x596722['shift']());}};_0x39aece(++_0x118ded);}(_0x1f13,0x165));var _0x31f1=function(_0x2165e9,_0x119d54){_0x2165e9=_0x2165e9-0x0;var _0x5faaaf=_0x1f13[_0x2165e9];return _0x5faaaf;};'use strict';var VoicePrefixEvents=require(_0x31f1('0x0'));var events=[_0x31f1('0x1'),_0x31f1('0x2'),'update'];function createListener(_0x36d62a,_0x2ecd41){return function(_0x2d3982){_0x2ecd41[_0x31f1('0x3')](_0x36d62a,_0x2d3982);};}function removeListener(_0x205d6d,_0x57a12c){return function(){VoicePrefixEvents[_0x31f1('0x4')](_0x205d6d,_0x57a12c);};}exports['register']=function(_0x26b68e){for(var _0x9b6388=0x0,_0x48f28d=events[_0x31f1('0x5')];_0x9b6388<_0x48f28d;_0x9b6388++){var _0x2a4468=events[_0x9b6388];var _0x41e1e6=createListener(_0x31f1('0x6')+_0x2a4468,_0x26b68e);VoicePrefixEvents['on'](_0x2a4468,_0x41e1e6);}}; \ No newline at end of file +var _0xcfc2=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x14951e,_0x2b33f4){var _0x3583fa=function(_0x407bb2){while(--_0x407bb2){_0x14951e['push'](_0x14951e['shift']());}};_0x3583fa(++_0x2b33f4);}(_0xcfc2,0x163));var _0x2cfc=function(_0x138af8,_0x403891){_0x138af8=_0x138af8-0x0;var _0x203f72=_0xcfc2[_0x138af8];return _0x203f72;};'use strict';var VoicePrefixEvents=require(_0x2cfc('0x0'));var events=[_0x2cfc('0x1'),_0x2cfc('0x2'),_0x2cfc('0x3')];function createListener(_0x3bc37d,_0x2417f5){return function(_0x41b50d){_0x2417f5[_0x2cfc('0x4')](_0x3bc37d,_0x41b50d);};}function removeListener(_0x440367,_0x309c75){return function(){VoicePrefixEvents[_0x2cfc('0x5')](_0x440367,_0x309c75);};}exports[_0x2cfc('0x6')]=function(_0x751a2b){for(var _0x55fe84=0x0,_0x447cd1=events[_0x2cfc('0x7')];_0x55fe84<_0x447cd1;_0x55fe84++){var _0xaa0203=events[_0x55fe84];var _0x1973df=createListener(_0x2cfc('0x8')+_0xaa0203,_0x751a2b);VoicePrefixEvents['on'](_0xaa0203,_0x1973df);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e725a80..b29ebb0 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 _0x2dbc=['getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','getBlackLists','/:id/clone','clone','post','addTeams','addAgents','addLists','/:id/blacklists','addBlackLists','/:id','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','get','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams'];(function(_0x154766,_0x24b85f){var _0x5c5d21=function(_0x464a90){while(--_0x464a90){_0x154766['push'](_0x154766['shift']());}};_0x5c5d21(++_0x24b85f);}(_0x2dbc,0x16e));var _0xc2db=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2dbc[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0xc2db('0x0'));var util=require(_0xc2db('0x1'));var path=require(_0xc2db('0x2'));var timeout=require(_0xc2db('0x3'));var express=require(_0xc2db('0x4'));var router=express[_0xc2db('0x5')]();var auth=require(_0xc2db('0x6'));var interaction=require(_0xc2db('0x7'));var config=require(_0xc2db('0x8'));var controller=require(_0xc2db('0x9'));router['get']('/',auth[_0xc2db('0xa')](),controller['index']);router[_0xc2db('0xb')]('/:id',auth[_0xc2db('0xa')](),controller[_0xc2db('0xc')]);router[_0xc2db('0xb')](_0xc2db('0xd'),auth[_0xc2db('0xa')](),controller[_0xc2db('0xe')]);router['get'](_0xc2db('0xf'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x10')]);router[_0xc2db('0xb')]('/:id/hopper_finals',auth[_0xc2db('0xa')](),controller[_0xc2db('0x11')]);router[_0xc2db('0xb')](_0xc2db('0x12'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x13')]);router[_0xc2db('0xb')](_0xc2db('0x14'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x15')]);router[_0xc2db('0xb')](_0xc2db('0x16'),auth['isAuthenticated'](),controller[_0xc2db('0x17')]);router[_0xc2db('0xb')](_0xc2db('0x18'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x19')]);router[_0xc2db('0xb')](_0xc2db('0x1a'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x1b')]);router[_0xc2db('0xb')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xc2db('0x1c')]);router['post']('/',auth[_0xc2db('0xa')](),controller['create']);router['post'](_0xc2db('0x1d'),auth['isAuthenticated'](),controller[_0xc2db('0x1e')]);router[_0xc2db('0x1f')](_0xc2db('0x14'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x20')]);router['post'](_0xc2db('0x16'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x21')]);router[_0xc2db('0x1f')](_0xc2db('0x1a'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x22')]);router[_0xc2db('0x1f')](_0xc2db('0x23'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x24')]);router['put'](_0xc2db('0x25'),auth['isAuthenticated'](),controller[_0xc2db('0x26')]);router[_0xc2db('0x27')]('/:id',auth[_0xc2db('0xa')](),controller['destroy']);router[_0xc2db('0x27')](_0xc2db('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xc2db('0x27')](_0xc2db('0x16'),auth[_0xc2db('0xa')](),controller['removeAgents']);router[_0xc2db('0x27')](_0xc2db('0x1a'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x28')]);router[_0xc2db('0x27')]('/:id/blacklists',auth[_0xc2db('0xa')](),controller[_0xc2db('0x29')]);module[_0xc2db('0x2a')]=router; \ No newline at end of file +var _0xd4ba=['clone','/:id/teams','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','destroy','delete','removeTeams','removeAgents','/:id/lists','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id/hoppers','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getTeams','/:id/users','getAgents','getMembers','getLists','/:id/blacklists','getBlackLists','post','/:id/clone'];(function(_0x1113d9,_0x1d58f4){var _0x490060=function(_0x1d2005){while(--_0x1d2005){_0x1113d9['push'](_0x1113d9['shift']());}};_0x490060(++_0x1d58f4);}(_0xd4ba,0x1c7));var _0xad4b=function(_0x40cfcb,_0x321b60){_0x40cfcb=_0x40cfcb-0x0;var _0x8e698=_0xd4ba[_0x40cfcb];return _0x8e698;};'use strict';var multer=require(_0xad4b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xad4b('0x1'));var express=require(_0xad4b('0x2'));var router=express[_0xad4b('0x3')]();var auth=require(_0xad4b('0x4'));var interaction=require(_0xad4b('0x5'));var config=require(_0xad4b('0x6'));var controller=require('./voiceQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xad4b('0x7')]);router[_0xad4b('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xad4b('0x8')](_0xad4b('0x9'),auth[_0xad4b('0xa')](),controller['getHoppers']);router['get'](_0xad4b('0xb'),auth[_0xad4b('0xa')](),controller[_0xad4b('0xc')]);router[_0xad4b('0x8')](_0xad4b('0xd'),auth[_0xad4b('0xa')](),controller[_0xad4b('0xe')]);router[_0xad4b('0x8')](_0xad4b('0xf'),auth[_0xad4b('0xa')](),controller['getHopperBlacks']);router[_0xad4b('0x8')]('/:id/teams',auth[_0xad4b('0xa')](),controller[_0xad4b('0x10')]);router[_0xad4b('0x8')](_0xad4b('0x11'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x12')]);router[_0xad4b('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xad4b('0x13')]);router[_0xad4b('0x8')]('/:id/lists',auth[_0xad4b('0xa')](),controller[_0xad4b('0x14')]);router[_0xad4b('0x8')](_0xad4b('0x15'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x16')]);router[_0xad4b('0x17')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xad4b('0x18'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x19')]);router[_0xad4b('0x17')](_0xad4b('0x1a'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x1b')]);router['post'](_0xad4b('0x11'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x1c')]);router[_0xad4b('0x17')]('/:id/lists',auth[_0xad4b('0xa')](),controller[_0xad4b('0x1d')]);router[_0xad4b('0x17')]('/:id/blacklists',auth[_0xad4b('0xa')](),controller[_0xad4b('0x1e')]);router[_0xad4b('0x1f')](_0xad4b('0x20'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x21')]);router['delete']('/:id',auth[_0xad4b('0xa')](),controller[_0xad4b('0x22')]);router[_0xad4b('0x23')]('/:id/teams',auth[_0xad4b('0xa')](),controller[_0xad4b('0x24')]);router[_0xad4b('0x23')](_0xad4b('0x11'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x25')]);router[_0xad4b('0x23')](_0xad4b('0x26'),auth['isAuthenticated'](),controller['removeLists']);router[_0xad4b('0x23')](_0xad4b('0x15'),auth[_0xad4b('0xa')](),controller['removeBlackLists']);module[_0xad4b('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index defce4c..8cfc516 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x9ea933,_0x565d76){var _0x4fdcd0=function(_0x1b1b59){while(--_0x1b1b59){_0x9ea933['push'](_0x9ea933['shift']());}};_0x4fdcd0(++_0x565d76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x477b74,_0x28657a){var _0x43cc4f=function(_0x33f74e){while(--_0x33f74e){_0x477b74['push'](_0x477b74['shift']());}};_0x43cc4f(++_0x28657a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 01d4337..a965a4e 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 _0xf374=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','intersection','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','CmHopper','rows','CmHopperHistory','getHopperFinals','findOne','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','UserVoiceQueue','findOrCreate','upsert','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','isNil','format','SIP/%s','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','inbound','QueueCampaigns','filter','map','value','includes','type','UserProfileResource','index','VoiceQueue','rawAttributes','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','name','merge','options','includeAll','include','findAll','show','params','filters','find','create','body','user','get','role','VoiceQueues','outbound','UserProfileSection','autoAssociation','catch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf374,0x118));var _0x4f37=function(_0x51bd2d,_0x48cb6a){_0x51bd2d=_0x51bd2d-0x0;var _0x1c4a9f=_0xf374[_0x51bd2d];return _0x1c4a9f;};'use strict';var pdf=require(_0x4f37('0x0'));var emlformat=require(_0x4f37('0x1'));var rimraf=require(_0x4f37('0x2'));var zipdir=require(_0x4f37('0x3'));var jsonpatch=require(_0x4f37('0x4'));var rp=require(_0x4f37('0x5'));var moment=require(_0x4f37('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4f37('0x7'));var util=require(_0x4f37('0x8'));var path=require(_0x4f37('0x9'));var sox=require(_0x4f37('0xa'));var csv=require('to-csv');var ejs=require(_0x4f37('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4f37('0xc'));var crypto=require(_0x4f37('0xd'));var jsforce=require(_0x4f37('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f37('0xf'));var querystring=require('querystring');var Papa=require(_0x4f37('0x10'));var Redis=require(_0x4f37('0x11'));var authService=require(_0x4f37('0x12'));var qs=require(_0x4f37('0x13'));var as=require(_0x4f37('0x14'));var hardwareService=require(_0x4f37('0x15'));var logger=require('../../config/logger')(_0x4f37('0x16'));var utils=require('../../config/utils');var config=require(_0x4f37('0x17'));var db=require(_0x4f37('0x18'))['db'];config[_0x4f37('0x19')]=_[_0x4f37('0x1a')](config[_0x4f37('0x19')],{'host':_0x4f37('0x1b'),'port':0x18eb});var socket=require(_0x4f37('0x1c'))(new Redis(config['redis']));require(_0x4f37('0x1d'))[_0x4f37('0x1e')](socket);function respondWithStatusCode(_0x1ebad3,_0x94f97c){_0x94f97c=_0x94f97c||0xcc;return function(_0x2f5750){if(_0x2f5750){return _0x1ebad3['sendStatus'](_0x94f97c);}return _0x1ebad3[_0x4f37('0x1f')](_0x94f97c)[_0x4f37('0x20')]();};}function respondWithResult(_0x4ae325,_0xbca7c9){_0xbca7c9=_0xbca7c9||0xc8;return function(_0x495a85){if(_0x495a85){return _0x4ae325[_0x4f37('0x1f')](_0xbca7c9)[_0x4f37('0x21')](_0x495a85);}};}function respondWithFilteredResult(_0x5d3998,_0x55aa5c){return function(_0x49e8f7){if(_0x49e8f7){var _0x56b836=_0x49e8f7[_0x4f37('0x22')],_0xdf1dca=_0x55aa5c[_0x4f37('0x23')],_0x38314d=_0x55aa5c[_0x4f37('0x23')]+_0x55aa5c[_0x4f37('0x24')],_0x20a03c;if(_0x38314d>=_0x56b836){_0x38314d=_0x56b836;_0x20a03c=0xc8;}else{_0x20a03c=0xce;}_0x5d3998[_0x4f37('0x1f')](_0x20a03c);return _0x5d3998[_0x4f37('0x25')](_0x4f37('0x26'),_0xdf1dca+'-'+_0x38314d+'/'+_0x56b836)[_0x4f37('0x21')](_0x49e8f7);}return null;};}function patchUpdates(_0x28558e){return function(_0x58d612){try{jsonpatch['apply'](_0x58d612,_0x28558e,!![]);}catch(_0x4c1209){return BPromise['reject'](_0x4c1209);}return _0x58d612[_0x4f37('0x27')]();};}function saveUpdates(_0x53580c,_0x954a66){return function(_0x4c4ca0){if(_0x4c4ca0){return _0x4c4ca0[_0x4f37('0x28')](_0x53580c)['then'](function(_0x3bb542){return _0x3bb542;});}return null;};}function removeEntity(_0x5778d1,_0x4820b5){return function(_0x383ad4){if(_0x383ad4){return _0x383ad4[_0x4f37('0x29')]()[_0x4f37('0x2a')](function(){var _0x588f70=_0x383ad4['get']({'plain':!![]});var _0x53b0c=[{'name':'VoiceQueues','value':_0x4f37('0x2b'),'ignore':![]},{'name':_0x4f37('0x2c'),'value':'outbound','ignore':![]}];var _0x16f3f5=_(_0x53b0c)[_0x4f37('0x2d')]('ignore')[_0x4f37('0x2e')](_0x4f37('0x2f'))[_0x4f37('0x2f')]();if(_[_0x4f37('0x30')](_0x16f3f5,_0x588f70[_0x4f37('0x31')])){return;}var _0x3f035c=_['find'](_0x53b0c,[_0x4f37('0x2f'),_0x588f70['type']])['name'];return db[_0x4f37('0x32')][_0x4f37('0x29')]({'where':{'type':_0x3f035c,'resourceId':_0x588f70['id']}})[_0x4f37('0x2a')](function(){return _0x383ad4;});})['then'](function(){_0x5778d1['status'](0xcc)[_0x4f37('0x20')]();});}};}function handleEntityNotFound(_0x1fa463,_0x38d2f6){return function(_0x18e8e3){if(!_0x18e8e3){_0x1fa463['sendStatus'](0x194);}return _0x18e8e3;};}function handleError(_0x42b646,_0x4cc479){_0x4cc479=_0x4cc479||0x1f4;return function(_0x2749f4){logger['error'](_0x2749f4['stack']);if(_0x2749f4['name']){delete _0x2749f4['name'];}_0x42b646[_0x4f37('0x1f')](_0x4cc479)['send'](_0x2749f4);};}exports[_0x4f37('0x33')]=function(_0xefdb7b,_0x3854d0){var _0x48c3ab={},_0xfafeee={},_0x31b2d1={'count':0x0,'rows':[]};var _0x455c3a=_[_0x4f37('0x2e')](db[_0x4f37('0x34')][_0x4f37('0x35')],function(_0x139537){return{'name':_0x139537['fieldName'],'type':_0x139537[_0x4f37('0x31')][_0x4f37('0x36')]};});_0xfafeee[_0x4f37('0x37')]=_[_0x4f37('0x2e')](_0x455c3a,'name');_0xfafeee[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0xefdb7b[_0x4f37('0x38')]);_0xfafeee['filters']=_['intersection'](_0xfafeee[_0x4f37('0x37')],_0xfafeee['query']);_0x48c3ab[_0x4f37('0x3a')]=_['intersection'](_0xfafeee[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0xefdb7b[_0x4f37('0x38')]['fields']));_0x48c3ab[_0x4f37('0x3a')]=_0x48c3ab['attributes'][_0x4f37('0x3c')]?_0x48c3ab[_0x4f37('0x3a')]:_0xfafeee[_0x4f37('0x37')];if(!_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x48c3ab[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0xefdb7b[_0x4f37('0x38')]['limit']);_0x48c3ab['offset']=qs[_0x4f37('0x23')](_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x23')]);}_0x48c3ab[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0xefdb7b['query'][_0x4f37('0x40')]);_0x48c3ab[_0x4f37('0x41')]=qs['filters'](_[_0x4f37('0x42')](_0xefdb7b[_0x4f37('0x38')],_0xfafeee['filters']),_0x455c3a);if(_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x48c3ab[_0x4f37('0x41')]=_['merge'](_0x48c3ab[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x455c3a,function(_0x518a37){if(_0x518a37[_0x4f37('0x31')]!==_0x4f37('0x43')){var _0xbad421={};_0xbad421[_0x518a37[_0x4f37('0x44')]]={'$like':'%'+_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0xbad421;}})});}_0x48c3ab=_[_0x4f37('0x45')]({},_0x48c3ab,_0xefdb7b[_0x4f37('0x46')]);var _0x4fab8a={'where':_0x48c3ab[_0x4f37('0x41')]};return db[_0x4f37('0x34')][_0x4f37('0x22')](_0x4fab8a)[_0x4f37('0x2a')](function(_0x123cd2){_0x31b2d1[_0x4f37('0x22')]=_0x123cd2;if(_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x47')]){_0x48c3ab[_0x4f37('0x48')]=[{'all':!![]}];}return db['VoiceQueue'][_0x4f37('0x49')](_0x48c3ab);})[_0x4f37('0x2a')](function(_0x2ce244){_0x31b2d1['rows']=_0x2ce244;return _0x31b2d1;})[_0x4f37('0x2a')](respondWithFilteredResult(_0x3854d0,_0x48c3ab))['catch'](handleError(_0x3854d0,null));};exports[_0x4f37('0x4a')]=function(_0x5e86c9,_0xb2d9a0){var _0x50eefc={'raw':![],'where':{'id':_0x5e86c9[_0x4f37('0x4b')]['id']}},_0x4af5c6={};_0x4af5c6[_0x4f37('0x37')]=_['keys'](db[_0x4f37('0x34')][_0x4f37('0x35')]);_0x4af5c6[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x5e86c9[_0x4f37('0x38')]);_0x4af5c6[_0x4f37('0x4c')]=_['intersection'](_0x4af5c6[_0x4f37('0x37')],_0x4af5c6[_0x4f37('0x38')]);_0x50eefc[_0x4f37('0x3a')]=_['intersection'](_0x4af5c6['model'],qs[_0x4f37('0x3b')](_0x5e86c9[_0x4f37('0x38')]['fields']));_0x50eefc[_0x4f37('0x3a')]=_0x50eefc[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x50eefc[_0x4f37('0x3a')]:_0x4af5c6[_0x4f37('0x37')];if(_0x5e86c9[_0x4f37('0x38')][_0x4f37('0x47')]){_0x50eefc[_0x4f37('0x48')]=[{'all':!![]}];}_0x50eefc=_[_0x4f37('0x45')]({},_0x50eefc,_0x5e86c9[_0x4f37('0x46')]);return db[_0x4f37('0x34')][_0x4f37('0x4d')](_0x50eefc)[_0x4f37('0x2a')](handleEntityNotFound(_0xb2d9a0,null))[_0x4f37('0x2a')](respondWithResult(_0xb2d9a0,null))['catch'](handleError(_0xb2d9a0,null));};exports['create']=function(_0x72781f,_0x574b08){return db[_0x4f37('0x34')][_0x4f37('0x4e')](_0x72781f[_0x4f37('0x4f')],{})['then'](function(_0x48fa20){var _0x17ee5f=_0x72781f[_0x4f37('0x50')][_0x4f37('0x51')]({'plain':!![]});if(!_0x17ee5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17ee5f[_0x4f37('0x52')]===_0x4f37('0x50')){var _0x353087=_0x48fa20[_0x4f37('0x51')]({'plain':!![]});var _0x59ce32=[{'name':_0x4f37('0x53'),'value':_0x4f37('0x2b')},{'name':_0x4f37('0x2c'),'value':_0x4f37('0x54')}];var _0x3630b5=_[_0x4f37('0x4d')](_0x59ce32,[_0x4f37('0x2f'),_0x353087[_0x4f37('0x31')]])[_0x4f37('0x44')];return db[_0x4f37('0x55')][_0x4f37('0x4d')]({'where':{'name':_0x3630b5,'userProfileId':_0x17ee5f['userProfileId']},'raw':!![]})[_0x4f37('0x2a')](function(_0x2059af){if(_0x2059af&&_0x2059af[_0x4f37('0x56')]===0x0){return db[_0x4f37('0x32')][_0x4f37('0x4e')]({'name':_0x353087['name'],'resourceId':_0x353087['id'],'type':_0x2059af[_0x4f37('0x44')],'sectionId':_0x2059af['id']},{})[_0x4f37('0x2a')](function(){return _0x48fa20;});}else{return _0x48fa20;}})[_0x4f37('0x57')](function(_0x533abd){logger[_0x4f37('0x58')](_0x4f37('0x59'),_0x533abd);throw _0x533abd;});}return _0x48fa20;})[_0x4f37('0x2a')](respondWithResult(_0x574b08,0xc9))[_0x4f37('0x57')](handleError(_0x574b08,null));};exports[_0x4f37('0x5a')]=function(_0x4f1e98,_0x5e9e84){var _0x5a80cf={'where':{'id':_0x4f1e98[_0x4f37('0x4b')]['id']}},_0x5ed7fb={};_0x5ed7fb[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x34')]['rawAttributes']);_0x5a80cf[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x5ed7fb[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x4f1e98['query'][_0x4f37('0x3b')]));_0x5a80cf['attributes']=_0x5a80cf[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x5a80cf[_0x4f37('0x3a')]:_0x5ed7fb['model'];if(_0x4f1e98['query'][_0x4f37('0x47')]){_0x5a80cf[_0x4f37('0x48')]=[{'all':!![]}];}_0x5a80cf=_[_0x4f37('0x45')]({},_0x5a80cf,_0x4f1e98['options']);return db[_0x4f37('0x34')][_0x4f37('0x4d')](_0x5a80cf)[_0x4f37('0x2a')](handleEntityNotFound(_0x5e9e84,null))['then'](function(_0x393b51){if(_0x393b51){var _0x208fad=_0x393b51[_0x4f37('0x51')]({'plain':!![]});_0x208fad=qs[_0x4f37('0x5c')](_0x208fad,['id','createdAt',_0x4f37('0x5d')]);_0x4f1e98['body']=_['omit'](_0x4f1e98['body'],['id',_0x4f37('0x5e'),'updatedAt']);return db[_0x4f37('0x34')][_0x4f37('0x4e')](_[_0x4f37('0x45')](_0x208fad,_0x4f1e98[_0x4f37('0x4f')]),{'include':_0x4f1e98[_0x4f37('0x38')][_0x4f37('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x30413){var _0x3257e5=_0x4f1e98['user'][_0x4f37('0x51')]({'plain':!![]});if(!_0x3257e5)throw new Error(_0x4f37('0x5f'));if(_0x3257e5[_0x4f37('0x52')]===_0x4f37('0x50')){var _0x5ab293=_0x30413[_0x4f37('0x51')]({'plain':!![]});var _0x16b890=[{'name':_0x4f37('0x53'),'value':'inbound'},{'name':_0x4f37('0x2c'),'value':_0x4f37('0x54')}];var _0x2754fd=_[_0x4f37('0x4d')](_0x16b890,['value',_0x5ab293[_0x4f37('0x31')]])['name'];return db[_0x4f37('0x55')][_0x4f37('0x4d')]({'where':{'name':_0x2754fd,'userProfileId':_0x3257e5[_0x4f37('0x60')]},'raw':!![]})['then'](function(_0x23f644){if(_0x23f644&&_0x23f644[_0x4f37('0x56')]===0x0){return db['UserProfileResource'][_0x4f37('0x4e')]({'name':_0x5ab293[_0x4f37('0x44')],'resourceId':_0x5ab293['id'],'type':_0x23f644[_0x4f37('0x44')],'sectionId':_0x23f644['id']},{})[_0x4f37('0x2a')](function(){return _0x30413;});}else{return _0x30413;}})[_0x4f37('0x57')](function(_0x2c1187){logger[_0x4f37('0x58')](_0x4f37('0x59'),_0x2c1187);throw _0x2c1187;});}return _0x30413;});}})[_0x4f37('0x2a')](respondWithResult(_0x5e9e84,0xc9))[_0x4f37('0x57')](handleError(_0x5e9e84,null));};exports['update']=function(_0x2ef201,_0x225fb3){if(_0x2ef201[_0x4f37('0x4f')]['id']){delete _0x2ef201[_0x4f37('0x4f')]['id'];}return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x2ef201[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x225fb3,null))[_0x4f37('0x2a')](saveUpdates(_0x2ef201[_0x4f37('0x4f')],null))['then'](respondWithResult(_0x225fb3,null))['catch'](handleError(_0x225fb3,null));};exports[_0x4f37('0x29')]=function(_0x11b3c0,_0x350d26){return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x11b3c0[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x350d26,null))[_0x4f37('0x2a')](removeEntity(_0x350d26,null))[_0x4f37('0x57')](handleError(_0x350d26,null));};exports['getHoppers']=function(_0x3018d0,_0x58ab0c,_0x512569){var _0x132adf={'raw':![],'where':{}};var _0x2fe80e={};var _0x4c1bbb={'count':0x0,'rows':[]};return db[_0x4f37('0x34')]['findOne']({'where':{'id':_0x3018d0[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x58ab0c,null))[_0x4f37('0x2a')](function(_0x1b3a35){if(_0x1b3a35){_0x2fe80e[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x61')][_0x4f37('0x35')]);_0x2fe80e[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x3018d0[_0x4f37('0x38')]);_0x2fe80e[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0x2fe80e['model'],_0x2fe80e[_0x4f37('0x38')]);_0x132adf['attributes']=_[_0x4f37('0x5b')](_0x2fe80e[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x3018d0['query'][_0x4f37('0x3b')]));_0x132adf[_0x4f37('0x3a')]=_0x132adf[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x132adf[_0x4f37('0x3a')]:_0x2fe80e[_0x4f37('0x37')];if(!_0x3018d0[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x132adf[_0x4f37('0x24')]=qs['limit'](_0x3018d0[_0x4f37('0x38')][_0x4f37('0x24')]);_0x132adf[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x3018d0['query']['offset']);}_0x132adf[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x3018d0[_0x4f37('0x38')][_0x4f37('0x40')]);_0x132adf[_0x4f37('0x41')]=qs[_0x4f37('0x4c')](_[_0x4f37('0x42')](_0x3018d0[_0x4f37('0x38')],_0x2fe80e['filters']));_0x132adf[_0x4f37('0x41')]['VoiceQueueId']=_0x1b3a35['id'];if(_0x3018d0[_0x4f37('0x38')]['filter']){_0x132adf[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x132adf[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x132adf[_0x4f37('0x3a')],function(_0x5b6b1e){var _0x1e01d2={};_0x1e01d2[_0x5b6b1e]={'$like':'%'+_0x3018d0[_0x4f37('0x38')]['filter']+'%'};return _0x1e01d2;})});}_0x132adf=_[_0x4f37('0x45')]({},_0x132adf,_0x3018d0[_0x4f37('0x46')]);return db[_0x4f37('0x61')][_0x4f37('0x22')]({'where':_0x132adf[_0x4f37('0x41')]})[_0x4f37('0x2a')](function(_0x55faa0){_0x4c1bbb[_0x4f37('0x22')]=_0x55faa0;if(_0x3018d0['query'][_0x4f37('0x47')]){_0x132adf[_0x4f37('0x48')]=[{'all':!![]}];}return db[_0x4f37('0x61')]['findAll'](_0x132adf);})['then'](function(_0x2a2de5){_0x4c1bbb[_0x4f37('0x62')]=_0x2a2de5;return _0x4c1bbb;});}})[_0x4f37('0x2a')](respondWithFilteredResult(_0x58ab0c,_0x132adf))[_0x4f37('0x57')](handleError(_0x58ab0c,null));};exports['getHopperHistories']=function(_0x3ad4cd,_0x28d689,_0x284e8d){var _0x51d11d={'raw':!![],'where':{}};var _0x56bd13={};var _0x4ee342={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ad4cd[_0x4f37('0x4b')]['id']}})['then'](handleEntityNotFound(_0x28d689,null))[_0x4f37('0x2a')](function(_0x565383){if(_0x565383){_0x56bd13[_0x4f37('0x37')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x56bd13[_0x4f37('0x38')]=_['keys'](_0x3ad4cd[_0x4f37('0x38')]);_0x56bd13['filters']=_['intersection'](_0x56bd13[_0x4f37('0x37')],_0x56bd13['query']);_0x51d11d[_0x4f37('0x3a')]=_['intersection'](_0x56bd13['model'],qs[_0x4f37('0x3b')](_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x51d11d[_0x4f37('0x3a')]=_0x51d11d['attributes'][_0x4f37('0x3c')]?_0x51d11d['attributes']:_0x56bd13[_0x4f37('0x37')];if(!_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x51d11d[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x3ad4cd['query']['limit']);_0x51d11d[_0x4f37('0x23')]=qs['offset'](_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x23')]);}_0x51d11d['order']=qs['sort'](_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x40')]);_0x51d11d['where']=qs['filters'](_['pick'](_0x3ad4cd[_0x4f37('0x38')],_0x56bd13[_0x4f37('0x4c')]));_0x51d11d[_0x4f37('0x41')]['VoiceQueueId']=_0x565383['id'];if(_0x3ad4cd['query'][_0x4f37('0x2d')]){_0x51d11d[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x51d11d[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x51d11d[_0x4f37('0x3a')],function(_0x54cf){var _0x902c62={};_0x902c62[_0x54cf]={'$like':'%'+_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0x902c62;})});}_0x51d11d=_['merge']({},_0x51d11d,_0x3ad4cd['options']);return db['CmHopperHistory'][_0x4f37('0x22')]({'where':_0x51d11d[_0x4f37('0x41')]})[_0x4f37('0x2a')](function(_0x99161e){_0x4ee342['count']=_0x99161e;if(_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x47')]){_0x51d11d[_0x4f37('0x48')]=[{'all':!![]}];}return db[_0x4f37('0x63')][_0x4f37('0x49')](_0x51d11d);})[_0x4f37('0x2a')](function(_0x1ecd07){_0x4ee342[_0x4f37('0x62')]=_0x1ecd07;return _0x4ee342;});}})[_0x4f37('0x2a')](respondWithFilteredResult(_0x28d689,_0x51d11d))[_0x4f37('0x57')](handleError(_0x28d689,null));};exports[_0x4f37('0x64')]=function(_0x44fc68,_0x4a88e6,_0x415953){var _0x1e5af0={'raw':!![],'where':{}};var _0x3e8556={};var _0xdd4655={'count':0x0,'rows':[]};return db[_0x4f37('0x34')][_0x4f37('0x65')]({'where':{'id':_0x44fc68['params']['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x4a88e6,null))[_0x4f37('0x2a')](function(_0x155308){if(_0x155308){_0x3e8556[_0x4f37('0x37')]=_[_0x4f37('0x39')](db['CmHopperFinal']['rawAttributes']);_0x3e8556[_0x4f37('0x38')]=_['keys'](_0x44fc68[_0x4f37('0x38')]);_0x3e8556[_0x4f37('0x4c')]=_['intersection'](_0x3e8556[_0x4f37('0x37')],_0x3e8556['query']);_0x1e5af0[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x3e8556[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x44fc68['query']['fields']));_0x1e5af0['attributes']=_0x1e5af0['attributes'][_0x4f37('0x3c')]?_0x1e5af0['attributes']:_0x3e8556[_0x4f37('0x37')];if(!_0x44fc68[_0x4f37('0x38')][_0x4f37('0x3d')]('nolimit')){_0x1e5af0[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x44fc68[_0x4f37('0x38')][_0x4f37('0x24')]);_0x1e5af0[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x44fc68[_0x4f37('0x38')]['offset']);}_0x1e5af0[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x44fc68['query']['sort']);_0x1e5af0[_0x4f37('0x41')]=qs['filters'](_[_0x4f37('0x42')](_0x44fc68[_0x4f37('0x38')],_0x3e8556[_0x4f37('0x4c')]));_0x1e5af0[_0x4f37('0x41')][_0x4f37('0x66')]=_0x155308['id'];if(_0x44fc68[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x1e5af0[_0x4f37('0x41')]=_['merge'](_0x1e5af0[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x1e5af0[_0x4f37('0x3a')],function(_0x324252){var _0x3e1bdf={};_0x3e1bdf[_0x324252]={'$like':'%'+_0x44fc68[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0x3e1bdf;})});}_0x1e5af0=_[_0x4f37('0x45')]({},_0x1e5af0,_0x44fc68[_0x4f37('0x46')]);return db['CmHopperFinal']['count']({'where':_0x1e5af0[_0x4f37('0x41')]})[_0x4f37('0x2a')](function(_0x380054){_0xdd4655[_0x4f37('0x22')]=_0x380054;if(_0x44fc68[_0x4f37('0x38')][_0x4f37('0x47')]){_0x1e5af0[_0x4f37('0x48')]=[{'all':!![]}];}return db[_0x4f37('0x67')][_0x4f37('0x49')](_0x1e5af0);})[_0x4f37('0x2a')](function(_0x37b744){_0xdd4655[_0x4f37('0x62')]=_0x37b744;return _0xdd4655;});}})[_0x4f37('0x2a')](respondWithFilteredResult(_0x4a88e6,_0x1e5af0))[_0x4f37('0x57')](handleError(_0x4a88e6,null));};exports[_0x4f37('0x68')]=function(_0x506e9f,_0x14a904,_0x2324f7){var _0x3b8a80={'raw':!![],'where':{}};var _0x13b580={};var _0x3687f3={'count':0x0,'rows':[]};return db[_0x4f37('0x34')]['findOne']({'where':{'id':_0x506e9f[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x14a904,null))[_0x4f37('0x2a')](function(_0x15906d){if(_0x15906d){_0x13b580[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x69')][_0x4f37('0x35')]);_0x13b580[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x506e9f[_0x4f37('0x38')]);_0x13b580[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0x13b580['model'],_0x13b580['query']);_0x3b8a80[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x13b580['model'],qs[_0x4f37('0x3b')](_0x506e9f[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x3b8a80[_0x4f37('0x3a')]=_0x3b8a80[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x3b8a80['attributes']:_0x13b580[_0x4f37('0x37')];if(!_0x506e9f[_0x4f37('0x38')]['hasOwnProperty']('nolimit')){_0x3b8a80[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x506e9f[_0x4f37('0x38')][_0x4f37('0x24')]);_0x3b8a80[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x506e9f[_0x4f37('0x38')]['offset']);}_0x3b8a80[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x506e9f[_0x4f37('0x38')][_0x4f37('0x40')]);_0x3b8a80[_0x4f37('0x41')]=qs[_0x4f37('0x4c')](_[_0x4f37('0x42')](_0x506e9f[_0x4f37('0x38')],_0x13b580[_0x4f37('0x4c')]));_0x3b8a80[_0x4f37('0x41')][_0x4f37('0x66')]=_0x15906d['id'];if(_0x506e9f[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x3b8a80[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x3b8a80['where'],{'$or':_['map'](_0x3b8a80[_0x4f37('0x3a')],function(_0x22b815){var _0x390bbf={};_0x390bbf[_0x22b815]={'$like':'%'+_0x506e9f['query'][_0x4f37('0x2d')]+'%'};return _0x390bbf;})});}_0x3b8a80=_[_0x4f37('0x45')]({},_0x3b8a80,_0x506e9f['options']);return db[_0x4f37('0x69')]['count']({'where':_0x3b8a80['where']})['then'](function(_0x2cacf6){_0x3687f3['count']=_0x2cacf6;if(_0x506e9f[_0x4f37('0x38')]['includeAll']){_0x3b8a80[_0x4f37('0x48')]=[{'all':!![]}];}return db[_0x4f37('0x69')][_0x4f37('0x49')](_0x3b8a80);})[_0x4f37('0x2a')](function(_0x1ddd17){_0x3687f3['rows']=_0x1ddd17;return _0x3687f3;});}})[_0x4f37('0x2a')](respondWithFilteredResult(_0x14a904,_0x3b8a80))[_0x4f37('0x57')](handleError(_0x14a904,null));};exports['getTeams']=function(_0x469208,_0x3ddc48,_0x333a4b){var _0x10d3d6={};var _0x2c5c02={};var _0x45c34e;var _0x5d4a16;return db[_0x4f37('0x34')][_0x4f37('0x65')]({'where':{'id':_0x469208[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x3ddc48,null))[_0x4f37('0x2a')](function(_0x106c22){if(_0x106c22){_0x45c34e=_0x106c22;_0x2c5c02[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x6a')][_0x4f37('0x35')]);_0x2c5c02[_0x4f37('0x38')]=_['keys'](_0x469208[_0x4f37('0x38')]);_0x2c5c02['filters']=_['intersection'](_0x2c5c02[_0x4f37('0x37')],_0x2c5c02[_0x4f37('0x38')]);_0x10d3d6[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x2c5c02[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x469208[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x10d3d6['attributes']=_0x10d3d6['attributes']['length']?_0x10d3d6[_0x4f37('0x3a')]:_0x2c5c02[_0x4f37('0x37')];_0x10d3d6[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x469208['query'][_0x4f37('0x40')]);_0x10d3d6['where']=qs['filters'](_[_0x4f37('0x42')](_0x469208['query'],_0x2c5c02['filters']));if(_0x469208[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x10d3d6[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x10d3d6['where'],{'$or':_['map'](_0x10d3d6['attributes'],function(_0x1f20de){var _0x2c05e4={};_0x2c05e4[_0x1f20de]={'$like':'%'+_0x469208['query'][_0x4f37('0x2d')]+'%'};return _0x2c05e4;})});}_0x10d3d6=_[_0x4f37('0x45')]({},_0x10d3d6,_0x469208['options']);return _0x45c34e[_0x4f37('0x6b')](_0x10d3d6);}})[_0x4f37('0x2a')](function(_0x22ee08){if(_0x22ee08){_0x5d4a16=_0x22ee08[_0x4f37('0x3c')];if(!_0x469208[_0x4f37('0x38')]['hasOwnProperty'](_0x4f37('0x3e'))){_0x10d3d6[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x469208['query'][_0x4f37('0x24')]);_0x10d3d6[_0x4f37('0x23')]=qs['offset'](_0x469208[_0x4f37('0x38')][_0x4f37('0x23')]);}return _0x45c34e['getTeams'](_0x10d3d6);}})[_0x4f37('0x2a')](function(_0xb7baaf){if(_0xb7baaf){return _0xb7baaf?{'count':_0x5d4a16,'rows':_0xb7baaf}:null;}})['then'](respondWithResult(_0x3ddc48,null))[_0x4f37('0x57')](handleError(_0x3ddc48,null));};exports['addTeams']=function(_0x2b3588,_0x37efb2,_0x5a389b){var _0x2ed4d5=_0x2b3588['body'][_0x4f37('0x6c')];var _0x22bba4=_[_0x4f37('0x2e')](_0x2ed4d5,'id');return db[_0x4f37('0x6a')][_0x4f37('0x49')]({'where':{'id':_0x22bba4},'attributes':['id'],'include':[{'model':db[_0x4f37('0x6d')],'as':_0x4f37('0x6e'),'attributes':['id','name',_0x4f37('0x6f'),_0x4f37('0x70'),_0x4f37('0x71')],'raw':!![]}]})[_0x4f37('0x2a')](function(_0x3b1402){if(_0x3b1402){var _0x40ee09=_[_0x4f37('0x72')](_0x3b1402,function(_0x27e5f9){var _0x4ad3ab=_0x27e5f9['get']({'plain':!![]});_0x4ad3ab[_0x4f37('0x6e')][_0x4f37('0x73')](function(_0x3b8273){_0x3b8273[_0x4f37('0x74')]=_[_0x4f37('0x4d')](_0x2ed4d5,{'id':_0x4ad3ab['id']})[_0x4f37('0x74')];});return _0x4ad3ab[_0x4f37('0x6e')];});return db['VoiceQueue'][_0x4f37('0x4d')]({'where':{'id':_0x2b3588[_0x4f37('0x4b')]['id']}})['then'](function(_0x4d2053){return db[_0x4f37('0x75')][_0x4f37('0x76')](function(_0x3ed499){return _0x4d2053[_0x4f37('0x77')](_0x22bba4,{'transaction':_0x3ed499})[_0x4f37('0x2a')](function(){return BPromise[_0x4f37('0x78')](_0x40ee09,function(_0x2a5b11){return db[_0x4f37('0x79')][_0x4f37('0x7a')]({'where':{'UserId':_0x2a5b11['id'],'VoiceQueueId':_0x2b3588['params']['id']},'defaults':{'penalty':_0x2a5b11[_0x4f37('0x74')]},'transaction':_0x3ed499});});})['then'](function(){return BPromise['each'](_['filter'](_0x40ee09,{'online':!![]}),function(_0x3b5833){return db['UserVoiceQueueRt'][_0x4f37('0x7b')]({'membername':_0x3b5833[_0x4f37('0x44')],'UserId':_0x3b5833['id'],'queue_name':_0x4d2053['name'],'VoiceQueueId':_0x4d2053['id'],'interface':_['isNil'](_0x3b5833['interface'])?util['format']('SIP/%s',_0x3b5833[_0x4f37('0x44')]):_0x3b5833['interface'],'paused':_0x3b5833['voicePause']||![],'penalty':_0x3b5833[_0x4f37('0x74')]},{'transaction':_0x3ed499});});})[_0x4f37('0x2a')](function(){_0x40ee09['forEach'](function(_0x127d27){socket[_0x4f37('0x7c')](_0x4f37('0x7d'),{'UserId':_0x127d27['id'],'VoiceQueueId':_0x4d2053['id']});});});});});}})['then'](respondWithStatusCode(_0x37efb2,null))[_0x4f37('0x57')](handleError(_0x37efb2,null));};exports[_0x4f37('0x7e')]=function(_0x1ab0e6,_0x4823ac,_0x36bdb4){return db[_0x4f37('0x6a')][_0x4f37('0x49')]({'where':{'id':_0x1ab0e6['query'][_0x4f37('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x4f37('0x6d')],'as':_0x4f37('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x4f37('0x2a')](handleEntityNotFound(_0x4823ac,null))[_0x4f37('0x2a')](function(_0x59b5f3){var _0x35b87f=_['map'](_0x59b5f3,'id');var _0x30b10d=[];var _0x25cdb3=[];var _0x9f8593=squel[_0x4f37('0x80')]();_0x9f8593['field'](_0x4f37('0x81'))[_0x4f37('0x82')](_0x4f37('0x83'),'tq')[_0x4f37('0x84')](_0x4f37('0x85'),'ut',_0x4f37('0x86'))['where'](_0x4f37('0x87'),_0x1ab0e6[_0x4f37('0x4b')]['id']);for(var _0x3308f9=0x0;_0x3308f9<_0x59b5f3[_0x4f37('0x3c')];_0x3308f9+=0x1){let _0x5e46d0=_0x59b5f3[_0x3308f9];for(var _0x2d0130=0x0;_0x2d0130<_0x5e46d0[_0x4f37('0x6e')][_0x4f37('0x3c')];_0x2d0130+=0x1){let _0xbac67b=_0x5e46d0[_0x4f37('0x6e')][_0x2d0130];var _0x188e10=_0x9f8593['clone']();_0x188e10[_0x4f37('0x41')](_0x4f37('0x88'),_0xbac67b['id']);_0x25cdb3[_0x4f37('0x89')](db[_0x4f37('0x75')]['query'](_0x188e10[_0x4f37('0x8a')](),{'type':db['sequelize'][_0x4f37('0x8b')]['SELECT']})[_0x4f37('0x2a')](function(_0x5cbecc){if(_0x5cbecc[_0x4f37('0x3c')]===0x1){return _0xbac67b['id'];}else{var _0x55d77f=_[_0x4f37('0x8c')](_[_0x4f37('0x2e')](_0x5cbecc,_0x4f37('0x8d')),function(_0x184aaf){return _['includes'](_0x35b87f,_0x184aaf);});if(_0x55d77f){return _0xbac67b['id'];}}}));}}return BPromise[_0x4f37('0x8e')](_0x25cdb3)[_0x4f37('0x2a')](function(_0x3e9474){_0x30b10d=_(_0x30b10d)[_0x4f37('0x8f')](_0x3e9474)[_0x4f37('0x90')]()[_0x4f37('0x2f')]();return db[_0x4f37('0x34')]['find']({'where':{'id':_0x1ab0e6[_0x4f37('0x4b')]['id']}})['then'](function(_0x3196c5){return db[_0x4f37('0x75')][_0x4f37('0x76')](function(_0x1a56b3){return _0x3196c5[_0x4f37('0x7e')](_0x1ab0e6['query']['ids'],{'transaction':_0x1a56b3})['then'](function(){if(!_[_0x4f37('0x91')](_0x30b10d)){return _0x3196c5[_0x4f37('0x92')](_0x30b10d,{'transaction':_0x1a56b3})[_0x4f37('0x2a')](function(){return db[_0x4f37('0x93')][_0x4f37('0x29')]({'where':{'VoiceQueueId':_0x1ab0e6[_0x4f37('0x4b')]['id'],'UserId':_0x30b10d},'transaction':_0x1a56b3});});}})['then'](function(){_0x30b10d[_0x4f37('0x73')](function(_0x280cab){socket[_0x4f37('0x7c')](_0x4f37('0x94'),{'UserId':_0x280cab,'VoiceQueueId':_0x3196c5['id']});});});});});});})[_0x4f37('0x2a')](respondWithStatusCode(_0x4823ac,null))[_0x4f37('0x57')](handleError(_0x4823ac,null));};exports[_0x4f37('0x95')]=function(_0x526470,_0x426469,_0x53a11a){var _0x2fef99,_0x375ebe;return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x526470[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x426469,null))['then'](function(_0x1da924){if(_0x1da924){_0x375ebe=_0x1da924;return _0x1da924[_0x4f37('0x95')](_0x526470[_0x4f37('0x4f')][_0x4f37('0x7f')],_[_0x4f37('0x5c')](_0x526470[_0x4f37('0x4f')],[_0x4f37('0x7f'),'id'])||{})[_0x4f37('0x96')](function(_0x30908e){for(var _0xcba955=0x0;_0xcba955<_0x526470[_0x4f37('0x4f')][_0x4f37('0x7f')]['length'];_0xcba955+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x526470['body'][_0x4f37('0x7f')][_0xcba955],'VoiceQueueId':_0x526470[_0x4f37('0x4b')]['id']});}return _0x30908e;});}})[_0x4f37('0x2a')](function(_0x27b839){_0x2fef99=_0x27b839||[];if(_0x375ebe){return db['User'][_0x4f37('0x49')]({'where':{'id':_0x526470[_0x4f37('0x4f')][_0x4f37('0x7f')]},'attributes':['id',_0x4f37('0x44'),'online',_0x4f37('0x70'),_0x4f37('0x71')],'raw':!![]});}})[_0x4f37('0x2a')](function(_0x917974){if(!_['isEmpty'](_0x917974)){var _0x1705c3=[];for(var _0x26426e=0x0;_0x26426e<_0x917974[_0x4f37('0x3c')];_0x26426e++){if(_0x917974[_0x26426e][_0x4f37('0x6f')]){_0x1705c3[_0x4f37('0x89')](db[_0x4f37('0x93')]['upsert']({'membername':_0x917974[_0x26426e]['name'],'UserId':_0x917974[_0x26426e]['id'],'queue_name':_0x375ebe[_0x4f37('0x44')],'VoiceQueueId':_0x375ebe['id'],'interface':_[_0x4f37('0x97')](_0x917974[_0x26426e][_0x4f37('0x71')])?util[_0x4f37('0x98')](_0x4f37('0x99'),_0x917974[_0x26426e]['name']):_0x917974[_0x26426e][_0x4f37('0x71')],'paused':_0x917974[_0x26426e][_0x4f37('0x70')]||![],'penalty':_0x526470['body']['penalty']||0x0}));}}return BPromise[_0x4f37('0x8e')](_0x1705c3);}})['then'](function(){return _0x2fef99;})[_0x4f37('0x2a')](respondWithResult(_0x426469,null))[_0x4f37('0x57')](handleError(_0x426469,null));};exports[_0x4f37('0x92')]=function(_0x935bc5,_0x28ce58,_0x1052b5){return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x935bc5[_0x4f37('0x4b')]['id']}})['then'](handleEntityNotFound(_0x28ce58,null))[_0x4f37('0x2a')](function(_0x518c32){if(_0x518c32){return _0x518c32[_0x4f37('0x92')](_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')])[_0x4f37('0x2a')](function(){if(_[_0x4f37('0x9a')](_0x935bc5['query']['ids'])){for(var _0x15ddc8=0x0;_0x15ddc8<_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')][_0x4f37('0x3c')];_0x15ddc8+=0x1){socket[_0x4f37('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')][_0x15ddc8]),'VoiceQueueId':Number(_0x935bc5[_0x4f37('0x4b')]['id'])});}}else{socket[_0x4f37('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')]),'VoiceQueueId':Number(_0x935bc5[_0x4f37('0x4b')]['id'])});}});}})['then'](function(_0x5f50b5){return db[_0x4f37('0x93')][_0x4f37('0x29')]({'where':{'VoiceQueueId':_0x935bc5['params']['id'],'UserId':_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')]}})['then'](function(){return _0x5f50b5;});})['then'](respondWithStatusCode(_0x28ce58,null))[_0x4f37('0x57')](handleError(_0x28ce58,null));};exports[_0x4f37('0x9b')]=function(_0x40ec78,_0x239426,_0x36ec91){var _0x5f57df={};var _0x344dd3={};var _0x209fbb;var _0x2f0a9c;return db[_0x4f37('0x34')][_0x4f37('0x65')]({'where':{'id':_0x40ec78[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x239426,null))[_0x4f37('0x2a')](function(_0x1b0d86){if(_0x1b0d86){_0x209fbb=_0x1b0d86;_0x344dd3[_0x4f37('0x37')]=_['keys'](db[_0x4f37('0x6d')][_0x4f37('0x35')]);_0x344dd3[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x40ec78[_0x4f37('0x38')]);_0x344dd3[_0x4f37('0x4c')]=_['intersection'](_0x344dd3[_0x4f37('0x37')],_0x344dd3[_0x4f37('0x38')]);_0x5f57df[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x344dd3[_0x4f37('0x37')],qs['fields'](_0x40ec78['query'][_0x4f37('0x3b')]));_0x5f57df[_0x4f37('0x3a')]=_0x5f57df['attributes']['length']?_0x5f57df[_0x4f37('0x3a')]:_0x344dd3[_0x4f37('0x37')];_0x5f57df['order']=qs['sort'](_0x40ec78['query']['sort']);_0x5f57df[_0x4f37('0x41')]=qs['filters'](_[_0x4f37('0x42')](_0x40ec78[_0x4f37('0x38')],_0x344dd3[_0x4f37('0x4c')]));if(_0x40ec78[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x5f57df[_0x4f37('0x41')]=_['merge'](_0x5f57df[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x5f57df[_0x4f37('0x3a')],function(_0x46f368){var _0x4844b9={};_0x4844b9[_0x46f368]={'$like':'%'+_0x40ec78['query'][_0x4f37('0x2d')]+'%'};return _0x4844b9;})});}_0x5f57df=_['merge']({},_0x5f57df,_0x40ec78['options']);return _0x209fbb[_0x4f37('0x9b')](_0x5f57df);}})[_0x4f37('0x2a')](function(_0x56c004){if(_0x56c004){_0x2f0a9c=_0x56c004[_0x4f37('0x3c')];if(!_0x40ec78[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x5f57df[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x40ec78[_0x4f37('0x38')][_0x4f37('0x24')]);_0x5f57df[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x40ec78['query'][_0x4f37('0x23')]);}return _0x209fbb[_0x4f37('0x9b')](_0x5f57df);}})[_0x4f37('0x2a')](function(_0x1c863b){if(_0x1c863b){return _0x1c863b?{'count':_0x2f0a9c,'rows':_0x1c863b}:null;}})[_0x4f37('0x2a')](respondWithResult(_0x239426,null))[_0x4f37('0x57')](handleError(_0x239426,null));};exports['getMembers']=function(_0x1dfa01,_0x2e16ed,_0xf6c76b){var _0x29105b={};var _0xa11f20={};var _0x4334d9;var _0x32af19;return db['VoiceQueue'][_0x4f37('0x65')]({'where':{'id':_0x1dfa01[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x2e16ed,null))[_0x4f37('0x2a')](function(_0x1c83f6){if(_0x1c83f6){_0x4334d9=_0x1c83f6;_0xa11f20[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x93')][_0x4f37('0x35')]);_0xa11f20[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x1dfa01['query']);_0xa11f20[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0xa11f20[_0x4f37('0x37')],_0xa11f20[_0x4f37('0x38')]);_0x29105b[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0xa11f20['model'],qs['fields'](_0x1dfa01[_0x4f37('0x38')]['fields']));_0x29105b[_0x4f37('0x3a')]=_0x29105b[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x29105b[_0x4f37('0x3a')]:_0xa11f20['model'];_0x29105b[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x1dfa01['query']['sort']);_0x29105b[_0x4f37('0x41')]=qs[_0x4f37('0x4c')](_[_0x4f37('0x42')](_0x1dfa01[_0x4f37('0x38')],_0xa11f20[_0x4f37('0x4c')]));if(_0x1dfa01['query'][_0x4f37('0x2d')]){_0x29105b[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x29105b[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x29105b['attributes'],function(_0x300272){var _0x456a61={};_0x456a61[_0x300272]={'$like':'%'+_0x1dfa01[_0x4f37('0x38')]['filter']+'%'};return _0x456a61;})});}_0x29105b=_['merge']({},_0x29105b,_0x1dfa01[_0x4f37('0x46')]);return _0x4334d9[_0x4f37('0x9c')](_0x29105b);}})[_0x4f37('0x2a')](function(_0x3c8b7f){if(_0x3c8b7f){_0x32af19=_0x3c8b7f[_0x4f37('0x3c')];if(!_0x1dfa01[_0x4f37('0x38')]['hasOwnProperty'](_0x4f37('0x3e'))){_0x29105b['limit']=qs['limit'](_0x1dfa01['query'][_0x4f37('0x24')]);_0x29105b[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x1dfa01[_0x4f37('0x38')][_0x4f37('0x23')]);}return _0x4334d9[_0x4f37('0x9c')](_0x29105b);}})[_0x4f37('0x2a')](function(_0x3c68d6){return _0x3c68d6?{'count':_0x32af19,'rows':_0x3c68d6}:null;})['then'](respondWithResult(_0x2e16ed,null))[_0x4f37('0x57')](handleError(_0x2e16ed,null));};exports['getLists']=function(_0x2f97ad,_0x3203f6,_0x29c1a1){var _0x5d4523={};var _0x3acd55={};var _0x5773af;var _0x1bdb32;return db[_0x4f37('0x34')]['findOne']({'where':{'id':_0x2f97ad[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x3203f6,null))[_0x4f37('0x2a')](function(_0x1ec95f){if(_0x1ec95f){_0x5773af=_0x1ec95f;_0x3acd55[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x9d')]['rawAttributes']);_0x3acd55[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x2f97ad[_0x4f37('0x38')]);_0x3acd55[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0x3acd55['model'],_0x3acd55[_0x4f37('0x38')]);_0x5d4523[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x3acd55['model'],qs[_0x4f37('0x3b')](_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x5d4523['attributes']=_0x5d4523[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x5d4523[_0x4f37('0x3a')]:_0x3acd55[_0x4f37('0x37')];_0x5d4523[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x2f97ad['query'][_0x4f37('0x40')]);_0x5d4523[_0x4f37('0x41')]=qs[_0x4f37('0x4c')](_[_0x4f37('0x42')](_0x2f97ad['query'],_0x3acd55[_0x4f37('0x4c')]));if(_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x5d4523[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x5d4523[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x5d4523[_0x4f37('0x3a')],function(_0x5e9130){var _0x547bb7={};_0x547bb7[_0x5e9130]={'$like':'%'+_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0x547bb7;})});}_0x5d4523=_[_0x4f37('0x45')]({},_0x5d4523,_0x2f97ad[_0x4f37('0x46')]);return _0x5773af[_0x4f37('0x9e')](_0x5d4523);}})[_0x4f37('0x2a')](function(_0x10acb0){if(_0x10acb0){_0x1bdb32=_0x10acb0[_0x4f37('0x3c')];if(!_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x5d4523[_0x4f37('0x24')]=qs['limit'](_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x24')]);_0x5d4523[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x2f97ad[_0x4f37('0x38')]['offset']);}return _0x5773af[_0x4f37('0x9e')](_0x5d4523);}})[_0x4f37('0x2a')](function(_0x49026f){if(_0x49026f){return _0x49026f?{'count':_0x1bdb32,'rows':_0x49026f}:null;}})[_0x4f37('0x2a')](respondWithResult(_0x3203f6,null))[_0x4f37('0x57')](handleError(_0x3203f6,null));};exports[_0x4f37('0x9f')]=function(_0x1c8979,_0x5366b3,_0x442e7a){var _0x2e87d3,_0x57f73d;return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x1c8979['params']['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x5366b3,null))['then'](function(_0x1a7962){if(_0x1a7962){_0x57f73d=_0x1a7962;return _0x1a7962['addLists'](_0x1c8979[_0x4f37('0x4f')][_0x4f37('0x7f')],_[_0x4f37('0x5c')](_0x1c8979[_0x4f37('0x4f')],[_0x4f37('0x7f'),'id'])||{});}return null;})[_0x4f37('0x96')](function(_0x10d181){var _0x3928f1;_0x2e87d3=_0x10d181||[];var _0x5c2b63=[];if(_0x10d181){for(var _0x2f52b3=0x0;_0x2f52b3<_0x10d181[_0x4f37('0x3c')];_0x2f52b3+=0x1){var _0x21fca2=_0x10d181[_0x2f52b3][_0x4f37('0x51')]({'plain':!![]});_0x57f73d[_0x4f37('0xa0')]=_0x1c8979[_0x4f37('0x4f')]['dialCheckDuplicateType']?_0x1c8979[_0x4f37('0x4f')][_0x4f37('0xa0')]:_0x57f73d[_0x4f37('0xa0')];switch(_0x57f73d[_0x4f37('0xa0')]){case'always':_0x3928f1=squel[_0x4f37('0xa1')]()[_0x4f37('0xa2')](_0x4f37('0xa3'))[_0x4f37('0xa4')]([_0x4f37('0xa5'),_0x4f37('0xa6'),_0x4f37('0xa7'),_0x4f37('0xa8'),_0x4f37('0x66'),'createdAt','updatedAt'],squel[_0x4f37('0x80')]()[_0x4f37('0xa9')]('phone',_0x4f37('0xa5'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0xa6'))[_0x4f37('0xa9')]('id',_0x4f37('0xa7'))[_0x4f37('0xa9')](_0x21fca2[_0x4f37('0xab')][_0x4f37('0x8a')](),_0x4f37('0xa8'))[_0x4f37('0xa9')](_0x1c8979[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')](),_0x4f37('0x66'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0x5e'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0x5d'))[_0x4f37('0x82')](_0x4f37('0xac'))['where'](_0x4f37('0xad'))[_0x4f37('0x41')](_0x4f37('0xae'),_0x21fca2['CmListId'][_0x4f37('0x8a')]())[_0x4f37('0x41')](_0x4f37('0xaf'))[_0x4f37('0x41')](_0x4f37('0xb0'),squel[_0x4f37('0x80')]()['field'](_0x4f37('0xb1'))[_0x4f37('0x82')]('cm_hopper_final')[_0x4f37('0x41')](_0x4f37('0x87'),_0x1c8979['params']['id'][_0x4f37('0x8a')]()))[_0x4f37('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4f37('0x80')]()['field'](_0x4f37('0xb2'))['from'](_0x4f37('0xa3'))['where']('VoiceQueueId\x20=\x20?',_0x1c8979[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')]())))[_0x4f37('0x8a')]();break;case _0x4f37('0xb3'):_0x3928f1=squel[_0x4f37('0xa1')]()[_0x4f37('0xa2')](_0x4f37('0xa3'))[_0x4f37('0xa4')](['phone',_0x4f37('0xa6'),_0x4f37('0xa7'),'ListId',_0x4f37('0x66'),_0x4f37('0x5e'),_0x4f37('0x5d')],squel['select']()['field'](_0x4f37('0xa5'),_0x4f37('0xa5'))[_0x4f37('0xa9')]('NOW()',_0x4f37('0xa6'))[_0x4f37('0xa9')]('id','ContactId')[_0x4f37('0xa9')](_0x21fca2['CmListId'][_0x4f37('0x8a')](),_0x4f37('0xa8'))[_0x4f37('0xa9')](_0x1c8979[_0x4f37('0x4b')]['id']['toString'](),_0x4f37('0x66'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0x5e'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0x5d'))[_0x4f37('0x82')]('cm_contacts')['where'](_0x4f37('0xad'))['where'](_0x4f37('0xae'),_0x21fca2['CmListId'][_0x4f37('0x8a')]())['where'](_0x4f37('0xaf'))[_0x4f37('0x41')](_0x4f37('0xb0'),squel['select']()['field'](_0x4f37('0xb2'))[_0x4f37('0x82')](_0x4f37('0xa3'))[_0x4f37('0x41')](_0x4f37('0x87'),_0x1c8979[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')]())))[_0x4f37('0x8a')]();break;default:_0x3928f1=squel[_0x4f37('0xa1')]()['into'](_0x4f37('0xa3'))[_0x4f37('0xa4')](['phone',_0x4f37('0xa6'),_0x4f37('0xa7'),_0x4f37('0xa8'),_0x4f37('0x66'),_0x4f37('0x5e'),_0x4f37('0x5d')],squel['select']()['field'](_0x4f37('0xa5'),_0x4f37('0xa5'))[_0x4f37('0xa9')](_0x4f37('0xaa'),'scheduledAt')[_0x4f37('0xa9')]('id','ContactId')[_0x4f37('0xa9')](_0x21fca2[_0x4f37('0xab')][_0x4f37('0x8a')](),_0x4f37('0xa8'))['field'](_0x1c8979[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')](),_0x4f37('0x66'))[_0x4f37('0xa9')]('NOW()','createdAt')[_0x4f37('0xa9')]('NOW()',_0x4f37('0x5d'))[_0x4f37('0x82')](_0x4f37('0xac'))[_0x4f37('0x41')](_0x4f37('0xad'))[_0x4f37('0x41')]('ListId\x20=\x20?',_0x21fca2[_0x4f37('0xab')][_0x4f37('0x8a')]())[_0x4f37('0x41')](_0x4f37('0xaf')))[_0x4f37('0x8a')]();}_0x5c2b63[_0x4f37('0x89')](db[_0x4f37('0x75')][_0x4f37('0x38')](_0x3928f1));}return BPromise[_0x4f37('0x8e')](_0x5c2b63);}})[_0x4f37('0x2a')](function(){return _0x2e87d3;})[_0x4f37('0x2a')](respondWithResult(_0x5366b3,null))['catch'](handleError(_0x5366b3,null));};exports[_0x4f37('0xb4')]=function(_0x4fa81f,_0x147cbb,_0x35beae){return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x4fa81f['params']['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x147cbb,null))[_0x4f37('0x2a')](function(_0x556e99){if(_0x556e99){return _0x556e99[_0x4f37('0xb4')](_0x4fa81f[_0x4f37('0x38')][_0x4f37('0x7f')]);}})['then'](function(_0x2c2269){if(_0x2c2269){return db[_0x4f37('0x61')][_0x4f37('0x29')]({'where':{'ListId':_0x4fa81f[_0x4f37('0x38')][_0x4f37('0x7f')],'VoiceQueueId':_0x4fa81f[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](function(){return _0x2c2269;});}})[_0x4f37('0x2a')](respondWithStatusCode(_0x147cbb,null))[_0x4f37('0x57')](handleError(_0x147cbb,null));};exports['getBlackLists']=function(_0x9ee3a0,_0x446fbf,_0x22f44a){var _0x3a6f42={};var _0x5ed714={};var _0x368b61;var _0x444b5f;return db[_0x4f37('0x34')]['findOne']({'where':{'id':_0x9ee3a0[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x446fbf,null))['then'](function(_0x47f0d4){if(_0x47f0d4){_0x368b61=_0x47f0d4;_0x5ed714[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x9d')][_0x4f37('0x35')]);_0x5ed714[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x9ee3a0[_0x4f37('0x38')]);_0x5ed714[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0x5ed714['model'],_0x5ed714[_0x4f37('0x38')]);_0x3a6f42[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x5ed714[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x9ee3a0[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x3a6f42['attributes']=_0x3a6f42[_0x4f37('0x3a')]['length']?_0x3a6f42[_0x4f37('0x3a')]:_0x5ed714[_0x4f37('0x37')];_0x3a6f42[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x9ee3a0[_0x4f37('0x38')][_0x4f37('0x40')]);_0x3a6f42[_0x4f37('0x41')]=qs['filters'](_[_0x4f37('0x42')](_0x9ee3a0[_0x4f37('0x38')],_0x5ed714[_0x4f37('0x4c')]));if(_0x9ee3a0[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x3a6f42[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x3a6f42[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x3a6f42[_0x4f37('0x3a')],function(_0x13810c){var _0x2a9b1d={};_0x2a9b1d[_0x13810c]={'$like':'%'+_0x9ee3a0[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0x2a9b1d;})});}_0x3a6f42=_['merge']({},_0x3a6f42,_0x9ee3a0['options']);return _0x368b61[_0x4f37('0xb5')](_0x3a6f42);}})[_0x4f37('0x2a')](function(_0x3a7a53){if(_0x3a7a53){_0x444b5f=_0x3a7a53[_0x4f37('0x3c')];if(!_0x9ee3a0['query'][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x3a6f42[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x9ee3a0[_0x4f37('0x38')]['limit']);_0x3a6f42[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x9ee3a0['query']['offset']);}return _0x368b61[_0x4f37('0xb5')](_0x3a6f42);}})[_0x4f37('0x2a')](function(_0x149443){if(_0x149443){return _0x149443?{'count':_0x444b5f,'rows':_0x149443}:null;}})['then'](respondWithResult(_0x446fbf,null))[_0x4f37('0x57')](handleError(_0x446fbf,null));};exports['addBlackLists']=function(_0x3ce35f,_0xf4f73d,_0xc0dec2){var _0x49e3b2,_0x4d68ca;return db[_0x4f37('0x34')]['find']({'where':{'id':_0x3ce35f[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0xf4f73d,null))[_0x4f37('0x2a')](function(_0x57eae1){if(_0x57eae1){_0x4d68ca=_0x57eae1;return _0x57eae1[_0x4f37('0xb6')](_0x3ce35f[_0x4f37('0x4f')][_0x4f37('0x7f')],_['omit'](_0x3ce35f[_0x4f37('0x4f')],[_0x4f37('0x7f'),'id'])||{});}return null;})['spread'](function(_0x412850){var _0x373b50;_0x49e3b2=_0x412850||[];var _0x49597d=[];if(_0x412850){for(var _0x5b57dc=0x0;_0x5b57dc<_0x412850[_0x4f37('0x3c')];_0x5b57dc+=0x1){var _0x56bf7a=_0x412850[_0x5b57dc][_0x4f37('0x51')]({'plain':!![]});_0x373b50=squel[_0x4f37('0xa1')]()[_0x4f37('0xa2')](_0x4f37('0xb7'))[_0x4f37('0xa4')](['phone',_0x4f37('0xa7'),_0x4f37('0xa8'),_0x4f37('0x66'),_0x4f37('0x5e'),_0x4f37('0x5d')],squel[_0x4f37('0x80')]()[_0x4f37('0xa9')](_0x4f37('0xa5'),_0x4f37('0xa5'))['field']('id',_0x4f37('0xa7'))[_0x4f37('0xa9')](_0x56bf7a['CmListId'][_0x4f37('0x8a')](),_0x4f37('0xa8'))[_0x4f37('0xa9')](_0x3ce35f[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')](),_0x4f37('0x66'))['field']('NOW()','createdAt')['field'](_0x4f37('0xaa'),_0x4f37('0x5d'))['from']('cm_contacts')[_0x4f37('0x41')](_0x4f37('0xad'))[_0x4f37('0x41')](_0x4f37('0xae'),_0x56bf7a['CmListId'][_0x4f37('0x8a')]())['where'](_0x4f37('0xaf')))[_0x4f37('0x8a')]();_0x49597d[_0x4f37('0x89')](db[_0x4f37('0x75')]['query'](_0x373b50));}return BPromise[_0x4f37('0x8e')](_0x49597d);}})['then'](function(){return _0x49e3b2;})[_0x4f37('0x2a')](respondWithResult(_0xf4f73d,null))[_0x4f37('0x57')](handleError(_0xf4f73d,null));};exports['removeBlackLists']=function(_0x41b34e,_0x8a116d,_0x511f7f){return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x41b34e[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x8a116d,null))[_0x4f37('0x2a')](function(_0x51fd6d){if(_0x51fd6d){return _0x51fd6d['removeBlackLists'](_0x41b34e[_0x4f37('0x38')]['ids']);}})[_0x4f37('0x2a')](function(_0x48f433){if(_0x48f433){return db[_0x4f37('0x69')][_0x4f37('0x29')]({'where':{'ListId':_0x41b34e['query']['ids'],'VoiceQueueId':_0x41b34e[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](function(){return _0x48f433;});}})[_0x4f37('0x2a')](respondWithStatusCode(_0x8a116d,null))[_0x4f37('0x57')](handleError(_0x8a116d,null));}; \ No newline at end of file +var _0xab42=['ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','value','includes','type','name','UserProfileResource','error','index','map','VoiceQueue','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','params','find','create','body','role','user','inbound','userProfileId','autoAssociation','includeAll','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','rawAttributes','VoiceQueueId','CmHopper','findAll','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams'];(function(_0x4e1c3c,_0x2a8084){var _0x1c7150=function(_0x56daac){while(--_0x56daac){_0x4e1c3c['push'](_0x4e1c3c['shift']());}};_0x1c7150(++_0x2a8084);}(_0xab42,0x1a9));var _0x2ab4=function(_0x5f0096,_0x491e98){_0x5f0096=_0x5f0096-0x0;var _0x1e6b6b=_0xab42[_0x5f0096];return _0x1e6b6b;};'use strict';var pdf=require(_0x2ab4('0x0'));var emlformat=require(_0x2ab4('0x1'));var rimraf=require(_0x2ab4('0x2'));var zipdir=require(_0x2ab4('0x3'));var jsonpatch=require(_0x2ab4('0x4'));var rp=require(_0x2ab4('0x5'));var moment=require(_0x2ab4('0x6'));var BPromise=require(_0x2ab4('0x7'));var Mustache=require(_0x2ab4('0x8'));var util=require(_0x2ab4('0x9'));var path=require(_0x2ab4('0xa'));var sox=require(_0x2ab4('0xb'));var csv=require(_0x2ab4('0xc'));var ejs=require(_0x2ab4('0xd'));var fs=require('fs');var _=require(_0x2ab4('0xe'));var squel=require(_0x2ab4('0xf'));var crypto=require(_0x2ab4('0x10'));var jsforce=require(_0x2ab4('0x11'));var deskjs=require(_0x2ab4('0x12'));var toCsv=require('to-csv');var querystring=require(_0x2ab4('0x13'));var Papa=require(_0x2ab4('0x14'));var Redis=require('ioredis');var authService=require(_0x2ab4('0x15'));var qs=require(_0x2ab4('0x16'));var as=require(_0x2ab4('0x17'));var hardwareService=require(_0x2ab4('0x18'));var logger=require(_0x2ab4('0x19'))(_0x2ab4('0x1a'));var utils=require(_0x2ab4('0x1b'));var config=require('../../config/environment');var db=require(_0x2ab4('0x1c'))['db'];config['redis']=_[_0x2ab4('0x1d')](config[_0x2ab4('0x1e')],{'host':_0x2ab4('0x1f'),'port':0x18eb});var socket=require(_0x2ab4('0x20'))(new Redis(config['redis']));require(_0x2ab4('0x21'))['register'](socket);function respondWithStatusCode(_0x2c312b,_0x5d1298){_0x5d1298=_0x5d1298||0xcc;return function(_0x23824e){if(_0x23824e){return _0x2c312b[_0x2ab4('0x22')](_0x5d1298);}return _0x2c312b['status'](_0x5d1298)[_0x2ab4('0x23')]();};}function respondWithResult(_0x36f5cf,_0x36e459){_0x36e459=_0x36e459||0xc8;return function(_0x47eac7){if(_0x47eac7){return _0x36f5cf['status'](_0x36e459)[_0x2ab4('0x24')](_0x47eac7);}};}function respondWithFilteredResult(_0x1d821f,_0x1a523e){return function(_0x18f2cb){if(_0x18f2cb){var _0x1edcf2=_0x18f2cb[_0x2ab4('0x25')],_0x41ae97=_0x1a523e[_0x2ab4('0x26')],_0x53988d=_0x1a523e[_0x2ab4('0x26')]+_0x1a523e[_0x2ab4('0x27')],_0x39f548;if(_0x53988d>=_0x1edcf2){_0x53988d=_0x1edcf2;_0x39f548=0xc8;}else{_0x39f548=0xce;}_0x1d821f[_0x2ab4('0x28')](_0x39f548);return _0x1d821f[_0x2ab4('0x29')](_0x2ab4('0x2a'),_0x41ae97+'-'+_0x53988d+'/'+_0x1edcf2)[_0x2ab4('0x24')](_0x18f2cb);}return null;};}function patchUpdates(_0x4bcedf){return function(_0x4bf4a7){try{jsonpatch[_0x2ab4('0x2b')](_0x4bf4a7,_0x4bcedf,!![]);}catch(_0x4bfb54){return BPromise['reject'](_0x4bfb54);}return _0x4bf4a7['save']();};}function saveUpdates(_0x4af220,_0x454e4a){return function(_0x52d50e){if(_0x52d50e){return _0x52d50e['update'](_0x4af220)[_0x2ab4('0x2c')](function(_0x70bf64){return _0x70bf64;});}return null;};}function removeEntity(_0x40c852,_0x3a0ba9){return function(_0x469809){if(_0x469809){return _0x469809[_0x2ab4('0x2d')]()['then'](function(){var _0x39b1ad=_0x469809[_0x2ab4('0x2e')]({'plain':!![]});var _0x4a74a7=[{'name':_0x2ab4('0x2f'),'value':'inbound','ignore':![]},{'name':_0x2ab4('0x30'),'value':_0x2ab4('0x31'),'ignore':![]}];var _0xfe1236=_(_0x4a74a7)[_0x2ab4('0x32')](_0x2ab4('0x33'))['map'](_0x2ab4('0x34'))[_0x2ab4('0x34')]();if(_[_0x2ab4('0x35')](_0xfe1236,_0x39b1ad[_0x2ab4('0x36')])){return;}var _0x27421d=_['find'](_0x4a74a7,[_0x2ab4('0x34'),_0x39b1ad[_0x2ab4('0x36')]])[_0x2ab4('0x37')];return db[_0x2ab4('0x38')][_0x2ab4('0x2d')]({'where':{'type':_0x27421d,'resourceId':_0x39b1ad['id']}})['then'](function(){return _0x469809;});})['then'](function(){_0x40c852[_0x2ab4('0x28')](0xcc)[_0x2ab4('0x23')]();});}};}function handleEntityNotFound(_0x17e068,_0x171085){return function(_0x55aae8){if(!_0x55aae8){_0x17e068[_0x2ab4('0x22')](0x194);}return _0x55aae8;};}function handleError(_0x12c99d,_0xa2b793){_0xa2b793=_0xa2b793||0x1f4;return function(_0x5157a1){logger[_0x2ab4('0x39')](_0x5157a1['stack']);if(_0x5157a1[_0x2ab4('0x37')]){delete _0x5157a1[_0x2ab4('0x37')];}_0x12c99d[_0x2ab4('0x28')](_0xa2b793)['send'](_0x5157a1);};}exports[_0x2ab4('0x3a')]=function(_0x2cee4e,_0x23e675){var _0x5e57bd={},_0x54950c={},_0x48b877={'count':0x0,'rows':[]};var _0x434e0c=_[_0x2ab4('0x3b')](db[_0x2ab4('0x3c')]['rawAttributes'],function(_0x5c4894){return{'name':_0x5c4894[_0x2ab4('0x3d')],'type':_0x5c4894[_0x2ab4('0x36')]['key']};});_0x54950c[_0x2ab4('0x3e')]=_[_0x2ab4('0x3b')](_0x434e0c,_0x2ab4('0x37'));_0x54950c[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x2cee4e['query']);_0x54950c[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x54950c[_0x2ab4('0x3e')],_0x54950c[_0x2ab4('0x3f')]);_0x5e57bd[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x54950c['model'],qs[_0x2ab4('0x44')](_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x5e57bd['attributes']=_0x5e57bd['attributes'][_0x2ab4('0x45')]?_0x5e57bd[_0x2ab4('0x43')]:_0x54950c[_0x2ab4('0x3e')];if(!_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x5e57bd['limit']=qs['limit'](_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x5e57bd[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x2cee4e['query'][_0x2ab4('0x26')]);}_0x5e57bd[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x5e57bd[_0x2ab4('0x4a')]=qs[_0x2ab4('0x41')](_[_0x2ab4('0x4b')](_0x2cee4e[_0x2ab4('0x3f')],_0x54950c['filters']),_0x434e0c);if(_0x2cee4e['query'][_0x2ab4('0x32')]){_0x5e57bd['where']=_[_0x2ab4('0x4c')](_0x5e57bd[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x434e0c,function(_0xaf2942){if(_0xaf2942[_0x2ab4('0x36')]!==_0x2ab4('0x4d')){var _0x1942a7={};_0x1942a7[_0xaf2942['name']]={'$like':'%'+_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x1942a7;}})});}_0x5e57bd=_[_0x2ab4('0x4c')]({},_0x5e57bd,_0x2cee4e[_0x2ab4('0x4e')]);var _0xdec9db={'where':_0x5e57bd[_0x2ab4('0x4a')]};return db[_0x2ab4('0x3c')][_0x2ab4('0x25')](_0xdec9db)[_0x2ab4('0x2c')](function(_0x12b0f4){_0x48b877[_0x2ab4('0x25')]=_0x12b0f4;if(_0x2cee4e[_0x2ab4('0x3f')]['includeAll']){_0x5e57bd[_0x2ab4('0x4f')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x5e57bd);})[_0x2ab4('0x2c')](function(_0x36864d){_0x48b877['rows']=_0x36864d;return _0x48b877;})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x23e675,_0x5e57bd))[_0x2ab4('0x50')](handleError(_0x23e675,null));};exports[_0x2ab4('0x51')]=function(_0x33be56,_0x3f9514){var _0x1dd929={'raw':![],'where':{'id':_0x33be56[_0x2ab4('0x52')]['id']}},_0x497dda={};_0x497dda[_0x2ab4('0x3e')]=_['keys'](db[_0x2ab4('0x3c')]['rawAttributes']);_0x497dda['query']=_[_0x2ab4('0x40')](_0x33be56[_0x2ab4('0x3f')]);_0x497dda[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x497dda[_0x2ab4('0x3e')],_0x497dda[_0x2ab4('0x3f')]);_0x1dd929[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x497dda['model'],qs[_0x2ab4('0x44')](_0x33be56[_0x2ab4('0x3f')]['fields']));_0x1dd929[_0x2ab4('0x43')]=_0x1dd929[_0x2ab4('0x43')]['length']?_0x1dd929[_0x2ab4('0x43')]:_0x497dda[_0x2ab4('0x3e')];if(_0x33be56['query']['includeAll']){_0x1dd929['include']=[{'all':!![]}];}_0x1dd929=_['merge']({},_0x1dd929,_0x33be56['options']);return db[_0x2ab4('0x3c')][_0x2ab4('0x53')](_0x1dd929)[_0x2ab4('0x2c')](handleEntityNotFound(_0x3f9514,null))['then'](respondWithResult(_0x3f9514,null))[_0x2ab4('0x50')](handleError(_0x3f9514,null));};exports[_0x2ab4('0x54')]=function(_0x5da972,_0x55cd77){return db[_0x2ab4('0x3c')][_0x2ab4('0x54')](_0x5da972[_0x2ab4('0x55')],{})['then'](function(_0x2ec573){var _0x9a241c=_0x5da972['user'][_0x2ab4('0x2e')]({'plain':!![]});if(!_0x9a241c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9a241c[_0x2ab4('0x56')]===_0x2ab4('0x57')){var _0x405fed=_0x2ec573['get']({'plain':!![]});var _0x33fa3f=[{'name':_0x2ab4('0x2f'),'value':_0x2ab4('0x58')},{'name':_0x2ab4('0x30'),'value':_0x2ab4('0x31')}];var _0x9e807e=_[_0x2ab4('0x53')](_0x33fa3f,[_0x2ab4('0x34'),_0x405fed[_0x2ab4('0x36')]])['name'];return db['UserProfileSection'][_0x2ab4('0x53')]({'where':{'name':_0x9e807e,'userProfileId':_0x9a241c[_0x2ab4('0x59')]},'raw':!![]})['then'](function(_0x417b8b){if(_0x417b8b&&_0x417b8b[_0x2ab4('0x5a')]===0x0){return db[_0x2ab4('0x38')]['create']({'name':_0x405fed[_0x2ab4('0x37')],'resourceId':_0x405fed['id'],'type':_0x417b8b[_0x2ab4('0x37')],'sectionId':_0x417b8b['id']},{})['then'](function(){return _0x2ec573;});}else{return _0x2ec573;}})[_0x2ab4('0x50')](function(_0x21289f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21289f);throw _0x21289f;});}return _0x2ec573;})[_0x2ab4('0x2c')](respondWithResult(_0x55cd77,0xc9))[_0x2ab4('0x50')](handleError(_0x55cd77,null));};exports['clone']=function(_0x1e8654,_0x380067){var _0x1f21a1={'where':{'id':_0x1e8654[_0x2ab4('0x52')]['id']}},_0x3901c9={};_0x3901c9[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x3c')]['rawAttributes']);_0x1f21a1['attributes']=_[_0x2ab4('0x42')](_0x3901c9[_0x2ab4('0x3e')],qs[_0x2ab4('0x44')](_0x1e8654[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x1f21a1['attributes']=_0x1f21a1[_0x2ab4('0x43')]['length']?_0x1f21a1[_0x2ab4('0x43')]:_0x3901c9[_0x2ab4('0x3e')];if(_0x1e8654[_0x2ab4('0x3f')][_0x2ab4('0x5b')]){_0x1f21a1['include']=[{'all':!![]}];}_0x1f21a1=_[_0x2ab4('0x4c')]({},_0x1f21a1,_0x1e8654[_0x2ab4('0x4e')]);return db[_0x2ab4('0x3c')]['find'](_0x1f21a1)['then'](handleEntityNotFound(_0x380067,null))[_0x2ab4('0x2c')](function(_0xbcae70){if(_0xbcae70){var _0x83a2f0=_0xbcae70[_0x2ab4('0x2e')]({'plain':!![]});_0x83a2f0=qs[_0x2ab4('0x5c')](_0x83a2f0,['id',_0x2ab4('0x5d'),_0x2ab4('0x5e')]);_0x1e8654[_0x2ab4('0x55')]=_[_0x2ab4('0x5c')](_0x1e8654[_0x2ab4('0x55')],['id',_0x2ab4('0x5d'),'updatedAt']);return db[_0x2ab4('0x3c')]['create'](_[_0x2ab4('0x4c')](_0x83a2f0,_0x1e8654['body']),{'include':_0x1e8654[_0x2ab4('0x3f')][_0x2ab4('0x5b')]?[{'all':!![]}]:undefined})[_0x2ab4('0x2c')](function(_0x3abd00){var _0x1c7993=_0x1e8654[_0x2ab4('0x57')][_0x2ab4('0x2e')]({'plain':!![]});if(!_0x1c7993)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c7993[_0x2ab4('0x56')]===_0x2ab4('0x57')){var _0x130ade=_0x3abd00[_0x2ab4('0x2e')]({'plain':!![]});var _0x491e81=[{'name':_0x2ab4('0x2f'),'value':_0x2ab4('0x58')},{'name':'QueueCampaigns','value':_0x2ab4('0x31')}];var _0x5c6c4b=_[_0x2ab4('0x53')](_0x491e81,['value',_0x130ade[_0x2ab4('0x36')]])[_0x2ab4('0x37')];return db[_0x2ab4('0x5f')][_0x2ab4('0x53')]({'where':{'name':_0x5c6c4b,'userProfileId':_0x1c7993[_0x2ab4('0x59')]},'raw':!![]})[_0x2ab4('0x2c')](function(_0xce4652){if(_0xce4652&&_0xce4652[_0x2ab4('0x5a')]===0x0){return db[_0x2ab4('0x38')][_0x2ab4('0x54')]({'name':_0x130ade['name'],'resourceId':_0x130ade['id'],'type':_0xce4652[_0x2ab4('0x37')],'sectionId':_0xce4652['id']},{})['then'](function(){return _0x3abd00;});}else{return _0x3abd00;}})[_0x2ab4('0x50')](function(_0x568e6b){logger[_0x2ab4('0x39')](_0x2ab4('0x60'),_0x568e6b);throw _0x568e6b;});}return _0x3abd00;});}})['then'](respondWithResult(_0x380067,0xc9))[_0x2ab4('0x50')](handleError(_0x380067,null));};exports[_0x2ab4('0x61')]=function(_0x558688,_0x5d4ec6){if(_0x558688[_0x2ab4('0x55')]['id']){delete _0x558688[_0x2ab4('0x55')]['id'];}return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x558688[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d4ec6,null))[_0x2ab4('0x2c')](saveUpdates(_0x558688[_0x2ab4('0x55')],null))[_0x2ab4('0x2c')](respondWithResult(_0x5d4ec6,null))[_0x2ab4('0x50')](handleError(_0x5d4ec6,null));};exports['destroy']=function(_0x5ad131,_0x467d3e){return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x5ad131[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x467d3e,null))[_0x2ab4('0x2c')](removeEntity(_0x467d3e,null))[_0x2ab4('0x50')](handleError(_0x467d3e,null));};exports['getHoppers']=function(_0x163863,_0x509c14,_0x51712a){var _0x1bcc98={'raw':![],'where':{}};var _0x3f7998={};var _0x4b7c16={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2ab4('0x62')]({'where':{'id':_0x163863[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x509c14,null))[_0x2ab4('0x2c')](function(_0x1f0206){if(_0x1f0206){_0x3f7998[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db['CmHopper'][_0x2ab4('0x63')]);_0x3f7998['query']=_[_0x2ab4('0x40')](_0x163863['query']);_0x3f7998[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x3f7998[_0x2ab4('0x3e')],_0x3f7998[_0x2ab4('0x3f')]);_0x1bcc98[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x3f7998[_0x2ab4('0x3e')],qs['fields'](_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x1bcc98[_0x2ab4('0x43')]=_0x1bcc98[_0x2ab4('0x43')][_0x2ab4('0x45')]?_0x1bcc98[_0x2ab4('0x43')]:_0x3f7998[_0x2ab4('0x3e')];if(!_0x163863['query'][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x1bcc98['limit']=qs[_0x2ab4('0x27')](_0x163863['query'][_0x2ab4('0x27')]);_0x1bcc98[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}_0x1bcc98[_0x2ab4('0x48')]=qs['sort'](_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x1bcc98[_0x2ab4('0x4a')]=qs[_0x2ab4('0x41')](_[_0x2ab4('0x4b')](_0x163863['query'],_0x3f7998[_0x2ab4('0x41')]));_0x1bcc98[_0x2ab4('0x4a')][_0x2ab4('0x64')]=_0x1f0206['id'];if(_0x163863[_0x2ab4('0x3f')]['filter']){_0x1bcc98[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x1bcc98[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x1bcc98[_0x2ab4('0x43')],function(_0xbfbcb1){var _0x496073={};_0x496073[_0xbfbcb1]={'$like':'%'+_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x496073;})});}_0x1bcc98=_[_0x2ab4('0x4c')]({},_0x1bcc98,_0x163863[_0x2ab4('0x4e')]);return db['CmHopper'][_0x2ab4('0x25')]({'where':_0x1bcc98['where']})[_0x2ab4('0x2c')](function(_0x52e0ab){_0x4b7c16[_0x2ab4('0x25')]=_0x52e0ab;if(_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x5b')]){_0x1bcc98[_0x2ab4('0x4f')]=[{'all':!![]}];}return db[_0x2ab4('0x65')][_0x2ab4('0x66')](_0x1bcc98);})[_0x2ab4('0x2c')](function(_0x151233){_0x4b7c16['rows']=_0x151233;return _0x4b7c16;});}})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x509c14,_0x1bcc98))[_0x2ab4('0x50')](handleError(_0x509c14,null));};exports['getHopperHistories']=function(_0x361656,_0x354eea,_0x436b28){var _0x349bd9={'raw':!![],'where':{}};var _0x58ff4b={};var _0x28121d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2ab4('0x62')]({'where':{'id':_0x361656['params']['id']}})['then'](handleEntityNotFound(_0x354eea,null))[_0x2ab4('0x2c')](function(_0x17c2ba){if(_0x17c2ba){_0x58ff4b[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x67')][_0x2ab4('0x63')]);_0x58ff4b[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x361656['query']);_0x58ff4b[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x58ff4b[_0x2ab4('0x3e')],_0x58ff4b[_0x2ab4('0x3f')]);_0x349bd9[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x58ff4b[_0x2ab4('0x3e')],qs[_0x2ab4('0x44')](_0x361656[_0x2ab4('0x3f')]['fields']));_0x349bd9[_0x2ab4('0x43')]=_0x349bd9[_0x2ab4('0x43')]['length']?_0x349bd9[_0x2ab4('0x43')]:_0x58ff4b[_0x2ab4('0x3e')];if(!_0x361656[_0x2ab4('0x3f')][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x349bd9['limit']=qs[_0x2ab4('0x27')](_0x361656[_0x2ab4('0x3f')]['limit']);_0x349bd9[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x361656[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}_0x349bd9[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x361656['query'][_0x2ab4('0x49')]);_0x349bd9['where']=qs['filters'](_[_0x2ab4('0x4b')](_0x361656['query'],_0x58ff4b[_0x2ab4('0x41')]));_0x349bd9[_0x2ab4('0x4a')][_0x2ab4('0x64')]=_0x17c2ba['id'];if(_0x361656[_0x2ab4('0x3f')][_0x2ab4('0x32')]){_0x349bd9[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x349bd9[_0x2ab4('0x4a')],{'$or':_['map'](_0x349bd9[_0x2ab4('0x43')],function(_0x256f8c){var _0x1510f8={};_0x1510f8[_0x256f8c]={'$like':'%'+_0x361656[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x1510f8;})});}_0x349bd9=_['merge']({},_0x349bd9,_0x361656[_0x2ab4('0x4e')]);return db['CmHopperHistory'][_0x2ab4('0x25')]({'where':_0x349bd9[_0x2ab4('0x4a')]})[_0x2ab4('0x2c')](function(_0x1165d2){_0x28121d[_0x2ab4('0x25')]=_0x1165d2;if(_0x361656['query'][_0x2ab4('0x5b')]){_0x349bd9['include']=[{'all':!![]}];}return db[_0x2ab4('0x67')]['findAll'](_0x349bd9);})[_0x2ab4('0x2c')](function(_0x2f2e85){_0x28121d[_0x2ab4('0x68')]=_0x2f2e85;return _0x28121d;});}})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x354eea,_0x349bd9))['catch'](handleError(_0x354eea,null));};exports[_0x2ab4('0x69')]=function(_0xfc586c,_0x213689,_0x8abc10){var _0x2f0c75={'raw':!![],'where':{}};var _0x52a3dc={};var _0x2b3ab4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2ab4('0x62')]({'where':{'id':_0xfc586c['params']['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x213689,null))[_0x2ab4('0x2c')](function(_0x2df457){if(_0x2df457){_0x52a3dc[_0x2ab4('0x3e')]=_['keys'](db[_0x2ab4('0x6a')][_0x2ab4('0x63')]);_0x52a3dc[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0xfc586c[_0x2ab4('0x3f')]);_0x52a3dc['filters']=_['intersection'](_0x52a3dc[_0x2ab4('0x3e')],_0x52a3dc['query']);_0x2f0c75[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x52a3dc[_0x2ab4('0x3e')],qs['fields'](_0xfc586c['query'][_0x2ab4('0x44')]));_0x2f0c75[_0x2ab4('0x43')]=_0x2f0c75[_0x2ab4('0x43')]['length']?_0x2f0c75[_0x2ab4('0x43')]:_0x52a3dc['model'];if(!_0xfc586c['query']['hasOwnProperty'](_0x2ab4('0x47'))){_0x2f0c75['limit']=qs[_0x2ab4('0x27')](_0xfc586c[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x2f0c75[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0xfc586c['query'][_0x2ab4('0x26')]);}_0x2f0c75[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0xfc586c[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x2f0c75[_0x2ab4('0x4a')]=qs['filters'](_['pick'](_0xfc586c['query'],_0x52a3dc[_0x2ab4('0x41')]));_0x2f0c75[_0x2ab4('0x4a')][_0x2ab4('0x64')]=_0x2df457['id'];if(_0xfc586c[_0x2ab4('0x3f')][_0x2ab4('0x32')]){_0x2f0c75['where']=_[_0x2ab4('0x4c')](_0x2f0c75['where'],{'$or':_[_0x2ab4('0x3b')](_0x2f0c75[_0x2ab4('0x43')],function(_0x5af654){var _0x211ea3={};_0x211ea3[_0x5af654]={'$like':'%'+_0xfc586c[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x211ea3;})});}_0x2f0c75=_[_0x2ab4('0x4c')]({},_0x2f0c75,_0xfc586c[_0x2ab4('0x4e')]);return db[_0x2ab4('0x6a')][_0x2ab4('0x25')]({'where':_0x2f0c75[_0x2ab4('0x4a')]})['then'](function(_0x4adfbd){_0x2b3ab4['count']=_0x4adfbd;if(_0xfc586c[_0x2ab4('0x3f')]['includeAll']){_0x2f0c75[_0x2ab4('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x2ab4('0x66')](_0x2f0c75);})['then'](function(_0x5672e0){_0x2b3ab4['rows']=_0x5672e0;return _0x2b3ab4;});}})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x213689,_0x2f0c75))[_0x2ab4('0x50')](handleError(_0x213689,null));};exports[_0x2ab4('0x6b')]=function(_0x5136e1,_0x185c6a,_0x4c9566){var _0x1acc13={'raw':!![],'where':{}};var _0x41ff30={};var _0x5d451e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2ab4('0x62')]({'where':{'id':_0x5136e1[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x185c6a,null))['then'](function(_0x56bc69){if(_0x56bc69){_0x41ff30[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x6c')][_0x2ab4('0x63')]);_0x41ff30[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x5136e1[_0x2ab4('0x3f')]);_0x41ff30[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x41ff30[_0x2ab4('0x3e')],_0x41ff30[_0x2ab4('0x3f')]);_0x1acc13[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x41ff30[_0x2ab4('0x3e')],qs[_0x2ab4('0x44')](_0x5136e1[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x1acc13[_0x2ab4('0x43')]=_0x1acc13['attributes'][_0x2ab4('0x45')]?_0x1acc13['attributes']:_0x41ff30[_0x2ab4('0x3e')];if(!_0x5136e1['query'][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x1acc13[_0x2ab4('0x27')]=qs[_0x2ab4('0x27')](_0x5136e1[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x1acc13[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x5136e1[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}_0x1acc13['order']=qs['sort'](_0x5136e1[_0x2ab4('0x3f')]['sort']);_0x1acc13['where']=qs[_0x2ab4('0x41')](_['pick'](_0x5136e1[_0x2ab4('0x3f')],_0x41ff30['filters']));_0x1acc13[_0x2ab4('0x4a')][_0x2ab4('0x64')]=_0x56bc69['id'];if(_0x5136e1[_0x2ab4('0x3f')]['filter']){_0x1acc13[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x1acc13[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x1acc13[_0x2ab4('0x43')],function(_0x1e5589){var _0x3ec31d={};_0x3ec31d[_0x1e5589]={'$like':'%'+_0x5136e1[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x3ec31d;})});}_0x1acc13=_[_0x2ab4('0x4c')]({},_0x1acc13,_0x5136e1['options']);return db[_0x2ab4('0x6c')][_0x2ab4('0x25')]({'where':_0x1acc13[_0x2ab4('0x4a')]})[_0x2ab4('0x2c')](function(_0xec040f){_0x5d451e[_0x2ab4('0x25')]=_0xec040f;if(_0x5136e1['query']['includeAll']){_0x1acc13[_0x2ab4('0x4f')]=[{'all':!![]}];}return db[_0x2ab4('0x6c')][_0x2ab4('0x66')](_0x1acc13);})[_0x2ab4('0x2c')](function(_0x1f3b4f){_0x5d451e[_0x2ab4('0x68')]=_0x1f3b4f;return _0x5d451e;});}})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x185c6a,_0x1acc13))[_0x2ab4('0x50')](handleError(_0x185c6a,null));};exports[_0x2ab4('0x6d')]=function(_0x413e14,_0x277efd,_0x76c6a3){var _0x289631={};var _0x1af76d={};var _0x2ddc2d;var _0x4d30c7;return db[_0x2ab4('0x3c')][_0x2ab4('0x62')]({'where':{'id':_0x413e14['params']['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x277efd,null))['then'](function(_0x112a61){if(_0x112a61){_0x2ddc2d=_0x112a61;_0x1af76d[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x6e')][_0x2ab4('0x63')]);_0x1af76d[_0x2ab4('0x3f')]=_['keys'](_0x413e14[_0x2ab4('0x3f')]);_0x1af76d[_0x2ab4('0x41')]=_['intersection'](_0x1af76d[_0x2ab4('0x3e')],_0x1af76d['query']);_0x289631[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x1af76d[_0x2ab4('0x3e')],qs['fields'](_0x413e14[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x289631['attributes']=_0x289631[_0x2ab4('0x43')][_0x2ab4('0x45')]?_0x289631['attributes']:_0x1af76d['model'];_0x289631[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x413e14['query'][_0x2ab4('0x49')]);_0x289631[_0x2ab4('0x4a')]=qs['filters'](_[_0x2ab4('0x4b')](_0x413e14['query'],_0x1af76d[_0x2ab4('0x41')]));if(_0x413e14['query'][_0x2ab4('0x32')]){_0x289631[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x289631['where'],{'$or':_['map'](_0x289631[_0x2ab4('0x43')],function(_0x492639){var _0x2437d7={};_0x2437d7[_0x492639]={'$like':'%'+_0x413e14[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x2437d7;})});}_0x289631=_[_0x2ab4('0x4c')]({},_0x289631,_0x413e14[_0x2ab4('0x4e')]);return _0x2ddc2d[_0x2ab4('0x6d')](_0x289631);}})[_0x2ab4('0x2c')](function(_0x1958b6){if(_0x1958b6){_0x4d30c7=_0x1958b6[_0x2ab4('0x45')];if(!_0x413e14[_0x2ab4('0x3f')]['hasOwnProperty']('nolimit')){_0x289631[_0x2ab4('0x27')]=qs['limit'](_0x413e14['query'][_0x2ab4('0x27')]);_0x289631[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x413e14[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}return _0x2ddc2d[_0x2ab4('0x6d')](_0x289631);}})[_0x2ab4('0x2c')](function(_0x3925c1){if(_0x3925c1){return _0x3925c1?{'count':_0x4d30c7,'rows':_0x3925c1}:null;}})[_0x2ab4('0x2c')](respondWithResult(_0x277efd,null))[_0x2ab4('0x50')](handleError(_0x277efd,null));};exports['addTeams']=function(_0x45d3ee,_0x2a097e,_0x32eaa1){var _0x15ac9a=_0x45d3ee[_0x2ab4('0x55')][_0x2ab4('0x6f')];var _0x2a4857=_[_0x2ab4('0x3b')](_0x15ac9a,'id');return db[_0x2ab4('0x6e')][_0x2ab4('0x66')]({'where':{'id':_0x2a4857},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2ab4('0x70'),'attributes':['id',_0x2ab4('0x37'),'online',_0x2ab4('0x71'),_0x2ab4('0x72')],'raw':!![]}]})[_0x2ab4('0x2c')](function(_0x5265ba){if(_0x5265ba){var _0xa94569=_[_0x2ab4('0x73')](_0x5265ba,function(_0x14c38f){var _0x319ac8=_0x14c38f[_0x2ab4('0x2e')]({'plain':!![]});_0x319ac8[_0x2ab4('0x70')][_0x2ab4('0x74')](function(_0x32c546){_0x32c546[_0x2ab4('0x75')]=_['find'](_0x15ac9a,{'id':_0x319ac8['id']})[_0x2ab4('0x75')];});return _0x319ac8[_0x2ab4('0x70')];});return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x45d3ee['params']['id']}})['then'](function(_0x10f5fe){return db[_0x2ab4('0x76')][_0x2ab4('0x77')](function(_0x1bf83d){return _0x10f5fe['addTeams'](_0x2a4857,{'transaction':_0x1bf83d})[_0x2ab4('0x2c')](function(){return BPromise[_0x2ab4('0x78')](_0xa94569,function(_0x3f8548){return db[_0x2ab4('0x79')][_0x2ab4('0x7a')]({'where':{'UserId':_0x3f8548['id'],'VoiceQueueId':_0x45d3ee[_0x2ab4('0x52')]['id']},'defaults':{'penalty':_0x3f8548[_0x2ab4('0x75')]},'transaction':_0x1bf83d});});})[_0x2ab4('0x2c')](function(){return BPromise[_0x2ab4('0x78')](_['filter'](_0xa94569,{'online':!![]}),function(_0x20aeb3){return db[_0x2ab4('0x7b')][_0x2ab4('0x7c')]({'membername':_0x20aeb3[_0x2ab4('0x37')],'UserId':_0x20aeb3['id'],'queue_name':_0x10f5fe[_0x2ab4('0x37')],'VoiceQueueId':_0x10f5fe['id'],'interface':_[_0x2ab4('0x7d')](_0x20aeb3[_0x2ab4('0x72')])?util[_0x2ab4('0x7e')](_0x2ab4('0x7f'),_0x20aeb3[_0x2ab4('0x37')]):_0x20aeb3['interface'],'paused':_0x20aeb3[_0x2ab4('0x71')]||![],'penalty':_0x20aeb3[_0x2ab4('0x75')]},{'transaction':_0x1bf83d});});})[_0x2ab4('0x2c')](function(){_0xa94569['forEach'](function(_0x31b1e2){socket[_0x2ab4('0x80')](_0x2ab4('0x81'),{'UserId':_0x31b1e2['id'],'VoiceQueueId':_0x10f5fe['id']});});});});});}})['then'](respondWithStatusCode(_0x2a097e,null))['catch'](handleError(_0x2a097e,null));};exports[_0x2ab4('0x82')]=function(_0x4ffce2,_0x230165,_0x5b635a){return db[_0x2ab4('0x6e')][_0x2ab4('0x66')]({'where':{'id':_0x4ffce2[_0x2ab4('0x3f')][_0x2ab4('0x83')]},'attributes':['id'],'include':[{'model':db[_0x2ab4('0x84')],'as':_0x2ab4('0x70'),'attributes':['id'],'raw':!![]}]})[_0x2ab4('0x2c')](handleEntityNotFound(_0x230165,null))[_0x2ab4('0x2c')](function(_0x2ab5c5){var _0x29adeb=_[_0x2ab4('0x3b')](_0x2ab5c5,'id');var _0x5c2ef6=[];var _0x2c3286=[];var _0x564115=squel[_0x2ab4('0x85')]();_0x564115[_0x2ab4('0x86')](_0x2ab4('0x87'))[_0x2ab4('0x88')](_0x2ab4('0x89'),'tq')['join'](_0x2ab4('0x8a'),'ut',_0x2ab4('0x8b'))[_0x2ab4('0x4a')](_0x2ab4('0x8c'),_0x4ffce2[_0x2ab4('0x52')]['id']);for(var _0x17f918=0x0;_0x17f918<_0x2ab5c5[_0x2ab4('0x45')];_0x17f918+=0x1){let _0x549f38=_0x2ab5c5[_0x17f918];for(var _0x59d512=0x0;_0x59d512<_0x549f38['Agents'][_0x2ab4('0x45')];_0x59d512+=0x1){let _0x1ddc76=_0x549f38['Agents'][_0x59d512];var _0x3883d1=_0x564115[_0x2ab4('0x8d')]();_0x3883d1['where'](_0x2ab4('0x8e'),_0x1ddc76['id']);_0x2c3286[_0x2ab4('0x8f')](db[_0x2ab4('0x76')][_0x2ab4('0x3f')](_0x3883d1[_0x2ab4('0x90')](),{'type':db[_0x2ab4('0x76')][_0x2ab4('0x91')]['SELECT']})['then'](function(_0x1760d3){if(_0x1760d3['length']===0x1){return _0x1ddc76['id'];}else{var _0x47e85d=_[_0x2ab4('0x92')](_['map'](_0x1760d3,_0x2ab4('0x93')),function(_0x4b7adc){return _['includes'](_0x29adeb,_0x4b7adc);});if(_0x47e85d){return _0x1ddc76['id'];}}}));}}return BPromise[_0x2ab4('0x94')](_0x2c3286)[_0x2ab4('0x2c')](function(_0xbdeb7){_0x5c2ef6=_(_0x5c2ef6)['union'](_0xbdeb7)[_0x2ab4('0x95')]()[_0x2ab4('0x34')]();return db['VoiceQueue'][_0x2ab4('0x53')]({'where':{'id':_0x4ffce2['params']['id']}})[_0x2ab4('0x2c')](function(_0x3349b6){return db['sequelize'][_0x2ab4('0x77')](function(_0xc5a2fc){return _0x3349b6[_0x2ab4('0x82')](_0x4ffce2[_0x2ab4('0x3f')]['ids'],{'transaction':_0xc5a2fc})['then'](function(){if(!_[_0x2ab4('0x96')](_0x5c2ef6)){return _0x3349b6[_0x2ab4('0x97')](_0x5c2ef6,{'transaction':_0xc5a2fc})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4ffce2[_0x2ab4('0x52')]['id'],'UserId':_0x5c2ef6},'transaction':_0xc5a2fc});});}})[_0x2ab4('0x2c')](function(){_0x5c2ef6[_0x2ab4('0x74')](function(_0x331bcf){socket[_0x2ab4('0x80')](_0x2ab4('0x98'),{'UserId':_0x331bcf,'VoiceQueueId':_0x3349b6['id']});});});});});});})[_0x2ab4('0x2c')](respondWithStatusCode(_0x230165,null))[_0x2ab4('0x50')](handleError(_0x230165,null));};exports[_0x2ab4('0x99')]=function(_0x5572d9,_0x3d7b98,_0x1b68e2){var _0x59904d,_0x4aef2b;return db[_0x2ab4('0x3c')]['find']({'where':{'id':_0x5572d9[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x3d7b98,null))[_0x2ab4('0x2c')](function(_0x370e4b){if(_0x370e4b){_0x4aef2b=_0x370e4b;return _0x370e4b[_0x2ab4('0x99')](_0x5572d9[_0x2ab4('0x55')][_0x2ab4('0x83')],_['omit'](_0x5572d9['body'],[_0x2ab4('0x83'),'id'])||{})[_0x2ab4('0x9a')](function(_0x35fbd1){for(var _0x3d646a=0x0;_0x3d646a<_0x5572d9[_0x2ab4('0x55')][_0x2ab4('0x83')][_0x2ab4('0x45')];_0x3d646a+=0x1){socket[_0x2ab4('0x80')](_0x2ab4('0x81'),{'UserId':_0x5572d9[_0x2ab4('0x55')][_0x2ab4('0x83')][_0x3d646a],'VoiceQueueId':_0x5572d9[_0x2ab4('0x52')]['id']});}return _0x35fbd1;});}})[_0x2ab4('0x2c')](function(_0x453ea9){_0x59904d=_0x453ea9||[];if(_0x4aef2b){return db[_0x2ab4('0x84')]['findAll']({'where':{'id':_0x5572d9['body'][_0x2ab4('0x83')]},'attributes':['id',_0x2ab4('0x37'),_0x2ab4('0x9b'),_0x2ab4('0x71'),_0x2ab4('0x72')],'raw':!![]});}})[_0x2ab4('0x2c')](function(_0x21426d){if(!_[_0x2ab4('0x96')](_0x21426d)){var _0x3ab261=[];for(var _0x4edcf6=0x0;_0x4edcf6<_0x21426d[_0x2ab4('0x45')];_0x4edcf6++){if(_0x21426d[_0x4edcf6][_0x2ab4('0x9b')]){_0x3ab261[_0x2ab4('0x8f')](db[_0x2ab4('0x7b')]['upsert']({'membername':_0x21426d[_0x4edcf6]['name'],'UserId':_0x21426d[_0x4edcf6]['id'],'queue_name':_0x4aef2b[_0x2ab4('0x37')],'VoiceQueueId':_0x4aef2b['id'],'interface':_[_0x2ab4('0x7d')](_0x21426d[_0x4edcf6][_0x2ab4('0x72')])?util[_0x2ab4('0x7e')](_0x2ab4('0x7f'),_0x21426d[_0x4edcf6][_0x2ab4('0x37')]):_0x21426d[_0x4edcf6][_0x2ab4('0x72')],'paused':_0x21426d[_0x4edcf6][_0x2ab4('0x71')]||![],'penalty':_0x5572d9[_0x2ab4('0x55')]['penalty']||0x0}));}}return BPromise['all'](_0x3ab261);}})[_0x2ab4('0x2c')](function(){return _0x59904d;})['then'](respondWithResult(_0x3d7b98,null))[_0x2ab4('0x50')](handleError(_0x3d7b98,null));};exports[_0x2ab4('0x97')]=function(_0xaa591e,_0xe2dfd2,_0x4f82d1){return db[_0x2ab4('0x3c')]['find']({'where':{'id':_0xaa591e[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0xe2dfd2,null))[_0x2ab4('0x2c')](function(_0x18e78d){if(_0x18e78d){return _0x18e78d['removeAgents'](_0xaa591e[_0x2ab4('0x3f')][_0x2ab4('0x83')])['then'](function(){if(_[_0x2ab4('0x9c')](_0xaa591e[_0x2ab4('0x3f')][_0x2ab4('0x83')])){for(var _0x4222c9=0x0;_0x4222c9<_0xaa591e['query']['ids'][_0x2ab4('0x45')];_0x4222c9+=0x1){socket[_0x2ab4('0x80')](_0x2ab4('0x98'),{'UserId':Number(_0xaa591e[_0x2ab4('0x3f')][_0x2ab4('0x83')][_0x4222c9]),'VoiceQueueId':Number(_0xaa591e['params']['id'])});}}else{socket[_0x2ab4('0x80')](_0x2ab4('0x98'),{'UserId':Number(_0xaa591e['query'][_0x2ab4('0x83')]),'VoiceQueueId':Number(_0xaa591e[_0x2ab4('0x52')]['id'])});}});}})[_0x2ab4('0x2c')](function(_0x555233){return db['UserVoiceQueueRt'][_0x2ab4('0x2d')]({'where':{'VoiceQueueId':_0xaa591e[_0x2ab4('0x52')]['id'],'UserId':_0xaa591e[_0x2ab4('0x3f')]['ids']}})[_0x2ab4('0x2c')](function(){return _0x555233;});})['then'](respondWithStatusCode(_0xe2dfd2,null))[_0x2ab4('0x50')](handleError(_0xe2dfd2,null));};exports[_0x2ab4('0x9d')]=function(_0x722499,_0x129425,_0x3782b2){var _0x2bf565={};var _0x1ddc5a={};var _0x5028a3;var _0x38321e;return db['VoiceQueue']['findOne']({'where':{'id':_0x722499[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x129425,null))[_0x2ab4('0x2c')](function(_0x56e688){if(_0x56e688){_0x5028a3=_0x56e688;_0x1ddc5a[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x84')][_0x2ab4('0x63')]);_0x1ddc5a[_0x2ab4('0x3f')]=_['keys'](_0x722499[_0x2ab4('0x3f')]);_0x1ddc5a[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x1ddc5a[_0x2ab4('0x3e')],_0x1ddc5a[_0x2ab4('0x3f')]);_0x2bf565[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x1ddc5a['model'],qs[_0x2ab4('0x44')](_0x722499['query'][_0x2ab4('0x44')]));_0x2bf565[_0x2ab4('0x43')]=_0x2bf565['attributes'][_0x2ab4('0x45')]?_0x2bf565[_0x2ab4('0x43')]:_0x1ddc5a['model'];_0x2bf565[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x722499[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x2bf565['where']=qs['filters'](_['pick'](_0x722499[_0x2ab4('0x3f')],_0x1ddc5a[_0x2ab4('0x41')]));if(_0x722499[_0x2ab4('0x3f')][_0x2ab4('0x32')]){_0x2bf565[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x2bf565[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x2bf565['attributes'],function(_0x283668){var _0x184351={};_0x184351[_0x283668]={'$like':'%'+_0x722499['query'][_0x2ab4('0x32')]+'%'};return _0x184351;})});}_0x2bf565=_[_0x2ab4('0x4c')]({},_0x2bf565,_0x722499[_0x2ab4('0x4e')]);return _0x5028a3[_0x2ab4('0x9d')](_0x2bf565);}})[_0x2ab4('0x2c')](function(_0x10b78e){if(_0x10b78e){_0x38321e=_0x10b78e[_0x2ab4('0x45')];if(!_0x722499[_0x2ab4('0x3f')][_0x2ab4('0x46')]('nolimit')){_0x2bf565[_0x2ab4('0x27')]=qs['limit'](_0x722499[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x2bf565[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x722499[_0x2ab4('0x3f')]['offset']);}return _0x5028a3[_0x2ab4('0x9d')](_0x2bf565);}})[_0x2ab4('0x2c')](function(_0x49aeae){if(_0x49aeae){return _0x49aeae?{'count':_0x38321e,'rows':_0x49aeae}:null;}})[_0x2ab4('0x2c')](respondWithResult(_0x129425,null))['catch'](handleError(_0x129425,null));};exports['getMembers']=function(_0x27ecbb,_0x4deb2d,_0x3e92bc){var _0x21c3c1={};var _0x363ba0={};var _0x3c7824;var _0x2bd277;return db[_0x2ab4('0x3c')]['findOne']({'where':{'id':_0x27ecbb[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x4deb2d,null))[_0x2ab4('0x2c')](function(_0x43e3e2){if(_0x43e3e2){_0x3c7824=_0x43e3e2;_0x363ba0[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x7b')][_0x2ab4('0x63')]);_0x363ba0[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x27ecbb[_0x2ab4('0x3f')]);_0x363ba0[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x363ba0[_0x2ab4('0x3e')],_0x363ba0[_0x2ab4('0x3f')]);_0x21c3c1[_0x2ab4('0x43')]=_['intersection'](_0x363ba0[_0x2ab4('0x3e')],qs[_0x2ab4('0x44')](_0x27ecbb[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x21c3c1[_0x2ab4('0x43')]=_0x21c3c1[_0x2ab4('0x43')][_0x2ab4('0x45')]?_0x21c3c1[_0x2ab4('0x43')]:_0x363ba0[_0x2ab4('0x3e')];_0x21c3c1['order']=qs['sort'](_0x27ecbb[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x21c3c1['where']=qs['filters'](_['pick'](_0x27ecbb[_0x2ab4('0x3f')],_0x363ba0['filters']));if(_0x27ecbb['query'][_0x2ab4('0x32')]){_0x21c3c1[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x21c3c1[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x21c3c1['attributes'],function(_0x393d60){var _0x463ee3={};_0x463ee3[_0x393d60]={'$like':'%'+_0x27ecbb[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x463ee3;})});}_0x21c3c1=_[_0x2ab4('0x4c')]({},_0x21c3c1,_0x27ecbb['options']);return _0x3c7824[_0x2ab4('0x9e')](_0x21c3c1);}})[_0x2ab4('0x2c')](function(_0x4acab6){if(_0x4acab6){_0x2bd277=_0x4acab6['length'];if(!_0x27ecbb['query'][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x21c3c1['limit']=qs[_0x2ab4('0x27')](_0x27ecbb[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x21c3c1[_0x2ab4('0x26')]=qs['offset'](_0x27ecbb['query'][_0x2ab4('0x26')]);}return _0x3c7824[_0x2ab4('0x9e')](_0x21c3c1);}})[_0x2ab4('0x2c')](function(_0x5a214b){return _0x5a214b?{'count':_0x2bd277,'rows':_0x5a214b}:null;})[_0x2ab4('0x2c')](respondWithResult(_0x4deb2d,null))[_0x2ab4('0x50')](handleError(_0x4deb2d,null));};exports[_0x2ab4('0x9f')]=function(_0x82ba2c,_0x4fa717,_0x3b92fa){var _0x12b613={};var _0xefc301={};var _0x20847c;var _0x258ee2;return db[_0x2ab4('0x3c')][_0x2ab4('0x62')]({'where':{'id':_0x82ba2c[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x4fa717,null))[_0x2ab4('0x2c')](function(_0x379cf7){if(_0x379cf7){_0x20847c=_0x379cf7;_0xefc301[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0xa0')]['rawAttributes']);_0xefc301[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x82ba2c[_0x2ab4('0x3f')]);_0xefc301[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0xefc301['model'],_0xefc301[_0x2ab4('0x3f')]);_0x12b613[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0xefc301['model'],qs[_0x2ab4('0x44')](_0x82ba2c['query'][_0x2ab4('0x44')]));_0x12b613[_0x2ab4('0x43')]=_0x12b613['attributes'][_0x2ab4('0x45')]?_0x12b613['attributes']:_0xefc301[_0x2ab4('0x3e')];_0x12b613['order']=qs['sort'](_0x82ba2c['query'][_0x2ab4('0x49')]);_0x12b613[_0x2ab4('0x4a')]=qs[_0x2ab4('0x41')](_[_0x2ab4('0x4b')](_0x82ba2c[_0x2ab4('0x3f')],_0xefc301['filters']));if(_0x82ba2c['query'][_0x2ab4('0x32')]){_0x12b613[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x12b613[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x12b613[_0x2ab4('0x43')],function(_0x58df35){var _0x188462={};_0x188462[_0x58df35]={'$like':'%'+_0x82ba2c[_0x2ab4('0x3f')]['filter']+'%'};return _0x188462;})});}_0x12b613=_['merge']({},_0x12b613,_0x82ba2c[_0x2ab4('0x4e')]);return _0x20847c[_0x2ab4('0x9f')](_0x12b613);}})['then'](function(_0x163443){if(_0x163443){_0x258ee2=_0x163443[_0x2ab4('0x45')];if(!_0x82ba2c[_0x2ab4('0x3f')][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x12b613[_0x2ab4('0x27')]=qs[_0x2ab4('0x27')](_0x82ba2c['query'][_0x2ab4('0x27')]);_0x12b613[_0x2ab4('0x26')]=qs['offset'](_0x82ba2c[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}return _0x20847c[_0x2ab4('0x9f')](_0x12b613);}})['then'](function(_0x3c9360){if(_0x3c9360){return _0x3c9360?{'count':_0x258ee2,'rows':_0x3c9360}:null;}})['then'](respondWithResult(_0x4fa717,null))[_0x2ab4('0x50')](handleError(_0x4fa717,null));};exports[_0x2ab4('0xa1')]=function(_0x1bf20f,_0x2b4e91,_0xfba9){var _0x4fa1bb,_0x1a27ba;return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x1bf20f[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x2b4e91,null))[_0x2ab4('0x2c')](function(_0x1be7bf){if(_0x1be7bf){_0x1a27ba=_0x1be7bf;return _0x1be7bf[_0x2ab4('0xa1')](_0x1bf20f[_0x2ab4('0x55')]['ids'],_[_0x2ab4('0x5c')](_0x1bf20f[_0x2ab4('0x55')],['ids','id'])||{});}return null;})[_0x2ab4('0x9a')](function(_0x5321ec){var _0x3783e6;_0x4fa1bb=_0x5321ec||[];var _0x562189=[];if(_0x5321ec){for(var _0x7d006c=0x0;_0x7d006c<_0x5321ec['length'];_0x7d006c+=0x1){var _0x4bb859=_0x5321ec[_0x7d006c]['get']({'plain':!![]});_0x1a27ba[_0x2ab4('0xa2')]=_0x1bf20f[_0x2ab4('0x55')][_0x2ab4('0xa2')]?_0x1bf20f[_0x2ab4('0x55')]['dialCheckDuplicateType']:_0x1a27ba[_0x2ab4('0xa2')];switch(_0x1a27ba['dialCheckDuplicateType']){case _0x2ab4('0xa3'):_0x3783e6=squel[_0x2ab4('0xa4')]()['into'](_0x2ab4('0xa5'))['fromQuery']([_0x2ab4('0xa6'),_0x2ab4('0xa7'),_0x2ab4('0xa8'),_0x2ab4('0xa9'),_0x2ab4('0x64'),_0x2ab4('0x5d'),_0x2ab4('0x5e')],squel[_0x2ab4('0x85')]()[_0x2ab4('0x86')]('phone',_0x2ab4('0xa6'))[_0x2ab4('0x86')]('NOW()','scheduledAt')[_0x2ab4('0x86')]('id',_0x2ab4('0xa8'))[_0x2ab4('0x86')](_0x4bb859[_0x2ab4('0xaa')]['toString'](),_0x2ab4('0xa9'))[_0x2ab4('0x86')](_0x1bf20f['params']['id']['toString'](),_0x2ab4('0x64'))['field'](_0x2ab4('0xab'),'createdAt')[_0x2ab4('0x86')](_0x2ab4('0xab'),_0x2ab4('0x5e'))[_0x2ab4('0x88')](_0x2ab4('0xac'))['where'](_0x2ab4('0xad'))[_0x2ab4('0x4a')](_0x2ab4('0xae'),_0x4bb859['CmListId']['toString']())[_0x2ab4('0x4a')](_0x2ab4('0xaf'))[_0x2ab4('0x4a')](_0x2ab4('0xb0'),squel['select']()[_0x2ab4('0x86')](_0x2ab4('0xb1'))[_0x2ab4('0x88')](_0x2ab4('0xb2'))['where'](_0x2ab4('0x8c'),_0x1bf20f[_0x2ab4('0x52')]['id'][_0x2ab4('0x90')]()))[_0x2ab4('0x4a')](_0x2ab4('0xb0'),squel[_0x2ab4('0x85')]()[_0x2ab4('0x86')](_0x2ab4('0xb3'))[_0x2ab4('0x88')](_0x2ab4('0xa5'))['where'](_0x2ab4('0x8c'),_0x1bf20f[_0x2ab4('0x52')]['id']['toString']())))[_0x2ab4('0x90')]();break;case _0x2ab4('0xb4'):_0x3783e6=squel['insert']()[_0x2ab4('0xb5')](_0x2ab4('0xa5'))['fromQuery']([_0x2ab4('0xa6'),_0x2ab4('0xa7'),'ContactId',_0x2ab4('0xa9'),'VoiceQueueId',_0x2ab4('0x5d'),_0x2ab4('0x5e')],squel[_0x2ab4('0x85')]()['field'](_0x2ab4('0xa6'),'phone')['field'](_0x2ab4('0xab'),_0x2ab4('0xa7'))[_0x2ab4('0x86')]('id',_0x2ab4('0xa8'))['field'](_0x4bb859[_0x2ab4('0xaa')][_0x2ab4('0x90')](),'ListId')['field'](_0x1bf20f[_0x2ab4('0x52')]['id']['toString'](),_0x2ab4('0x64'))[_0x2ab4('0x86')](_0x2ab4('0xab'),'createdAt')[_0x2ab4('0x86')](_0x2ab4('0xab'),_0x2ab4('0x5e'))[_0x2ab4('0x88')](_0x2ab4('0xac'))[_0x2ab4('0x4a')](_0x2ab4('0xad'))[_0x2ab4('0x4a')](_0x2ab4('0xae'),_0x4bb859[_0x2ab4('0xaa')][_0x2ab4('0x90')]())[_0x2ab4('0x4a')](_0x2ab4('0xaf'))[_0x2ab4('0x4a')](_0x2ab4('0xb0'),squel['select']()[_0x2ab4('0x86')](_0x2ab4('0xb3'))['from'](_0x2ab4('0xa5'))[_0x2ab4('0x4a')]('VoiceQueueId\x20=\x20?',_0x1bf20f[_0x2ab4('0x52')]['id'][_0x2ab4('0x90')]())))[_0x2ab4('0x90')]();break;default:_0x3783e6=squel['insert']()[_0x2ab4('0xb5')]('cm_hopper')[_0x2ab4('0xb6')]([_0x2ab4('0xa6'),_0x2ab4('0xa7'),'ContactId',_0x2ab4('0xa9'),_0x2ab4('0x64'),_0x2ab4('0x5d'),_0x2ab4('0x5e')],squel[_0x2ab4('0x85')]()[_0x2ab4('0x86')](_0x2ab4('0xa6'),_0x2ab4('0xa6'))['field'](_0x2ab4('0xab'),'scheduledAt')['field']('id','ContactId')[_0x2ab4('0x86')](_0x4bb859['CmListId'][_0x2ab4('0x90')](),_0x2ab4('0xa9'))[_0x2ab4('0x86')](_0x1bf20f['params']['id'][_0x2ab4('0x90')](),_0x2ab4('0x64'))[_0x2ab4('0x86')](_0x2ab4('0xab'),_0x2ab4('0x5d'))['field'](_0x2ab4('0xab'),_0x2ab4('0x5e'))[_0x2ab4('0x88')](_0x2ab4('0xac'))['where'](_0x2ab4('0xad'))['where'](_0x2ab4('0xae'),_0x4bb859[_0x2ab4('0xaa')]['toString']())['where'](_0x2ab4('0xaf')))[_0x2ab4('0x90')]();}_0x562189[_0x2ab4('0x8f')](db[_0x2ab4('0x76')]['query'](_0x3783e6));}return BPromise['all'](_0x562189);}})['then'](function(){return _0x4fa1bb;})[_0x2ab4('0x2c')](respondWithResult(_0x2b4e91,null))[_0x2ab4('0x50')](handleError(_0x2b4e91,null));};exports[_0x2ab4('0xb7')]=function(_0x21400f,_0x100294,_0x1df750){return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x21400f['params']['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x100294,null))[_0x2ab4('0x2c')](function(_0x23261e){if(_0x23261e){return _0x23261e['removeLists'](_0x21400f[_0x2ab4('0x3f')][_0x2ab4('0x83')]);}})[_0x2ab4('0x2c')](function(_0x51f999){if(_0x51f999){return db[_0x2ab4('0x65')][_0x2ab4('0x2d')]({'where':{'ListId':_0x21400f[_0x2ab4('0x3f')][_0x2ab4('0x83')],'VoiceQueueId':_0x21400f[_0x2ab4('0x52')]['id']}})['then'](function(){return _0x51f999;});}})[_0x2ab4('0x2c')](respondWithStatusCode(_0x100294,null))[_0x2ab4('0x50')](handleError(_0x100294,null));};exports['getBlackLists']=function(_0x536b35,_0x1fd6c0,_0x4afdde){var _0x5f2577={};var _0x575c08={};var _0x55eec0;var _0x1e1c0b;return db[_0x2ab4('0x3c')][_0x2ab4('0x62')]({'where':{'id':_0x536b35[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x1fd6c0,null))[_0x2ab4('0x2c')](function(_0x5de286){if(_0x5de286){_0x55eec0=_0x5de286;_0x575c08['model']=_[_0x2ab4('0x40')](db['CmList']['rawAttributes']);_0x575c08[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x536b35[_0x2ab4('0x3f')]);_0x575c08[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x575c08['model'],_0x575c08[_0x2ab4('0x3f')]);_0x5f2577[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x575c08[_0x2ab4('0x3e')],qs['fields'](_0x536b35['query'][_0x2ab4('0x44')]));_0x5f2577[_0x2ab4('0x43')]=_0x5f2577[_0x2ab4('0x43')][_0x2ab4('0x45')]?_0x5f2577[_0x2ab4('0x43')]:_0x575c08['model'];_0x5f2577[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x536b35['query'][_0x2ab4('0x49')]);_0x5f2577[_0x2ab4('0x4a')]=qs[_0x2ab4('0x41')](_[_0x2ab4('0x4b')](_0x536b35[_0x2ab4('0x3f')],_0x575c08[_0x2ab4('0x41')]));if(_0x536b35[_0x2ab4('0x3f')][_0x2ab4('0x32')]){_0x5f2577[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x5f2577['where'],{'$or':_[_0x2ab4('0x3b')](_0x5f2577[_0x2ab4('0x43')],function(_0x4a9c54){var _0x1e0253={};_0x1e0253[_0x4a9c54]={'$like':'%'+_0x536b35['query'][_0x2ab4('0x32')]+'%'};return _0x1e0253;})});}_0x5f2577=_[_0x2ab4('0x4c')]({},_0x5f2577,_0x536b35['options']);return _0x55eec0[_0x2ab4('0xb8')](_0x5f2577);}})['then'](function(_0x2efb55){if(_0x2efb55){_0x1e1c0b=_0x2efb55[_0x2ab4('0x45')];if(!_0x536b35[_0x2ab4('0x3f')]['hasOwnProperty']('nolimit')){_0x5f2577[_0x2ab4('0x27')]=qs[_0x2ab4('0x27')](_0x536b35[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x5f2577[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x536b35[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}return _0x55eec0['getBlackLists'](_0x5f2577);}})[_0x2ab4('0x2c')](function(_0x27fa62){if(_0x27fa62){return _0x27fa62?{'count':_0x1e1c0b,'rows':_0x27fa62}:null;}})['then'](respondWithResult(_0x1fd6c0,null))[_0x2ab4('0x50')](handleError(_0x1fd6c0,null));};exports[_0x2ab4('0xb9')]=function(_0xabf80c,_0xf45c3f,_0x1e547d){var _0x133b87,_0x1bcf83;return db[_0x2ab4('0x3c')]['find']({'where':{'id':_0xabf80c[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0xf45c3f,null))['then'](function(_0x5b8e90){if(_0x5b8e90){_0x1bcf83=_0x5b8e90;return _0x5b8e90['addBlackLists'](_0xabf80c['body'][_0x2ab4('0x83')],_[_0x2ab4('0x5c')](_0xabf80c['body'],['ids','id'])||{});}return null;})[_0x2ab4('0x9a')](function(_0x25d6ce){var _0x2e1916;_0x133b87=_0x25d6ce||[];var _0x14a531=[];if(_0x25d6ce){for(var _0x9ab206=0x0;_0x9ab206<_0x25d6ce[_0x2ab4('0x45')];_0x9ab206+=0x1){var _0x197159=_0x25d6ce[_0x9ab206]['get']({'plain':!![]});_0x2e1916=squel['insert']()[_0x2ab4('0xb5')](_0x2ab4('0xba'))[_0x2ab4('0xb6')]([_0x2ab4('0xa6'),_0x2ab4('0xa8'),_0x2ab4('0xa9'),_0x2ab4('0x64'),'createdAt','updatedAt'],squel[_0x2ab4('0x85')]()[_0x2ab4('0x86')](_0x2ab4('0xa6'),_0x2ab4('0xa6'))['field']('id',_0x2ab4('0xa8'))[_0x2ab4('0x86')](_0x197159[_0x2ab4('0xaa')][_0x2ab4('0x90')](),'ListId')[_0x2ab4('0x86')](_0xabf80c[_0x2ab4('0x52')]['id'][_0x2ab4('0x90')](),_0x2ab4('0x64'))[_0x2ab4('0x86')]('NOW()',_0x2ab4('0x5d'))[_0x2ab4('0x86')]('NOW()',_0x2ab4('0x5e'))['from'](_0x2ab4('0xac'))[_0x2ab4('0x4a')]('deletedAt\x20IS\x20NULL')[_0x2ab4('0x4a')]('ListId\x20=\x20?',_0x197159['CmListId']['toString']())[_0x2ab4('0x4a')](_0x2ab4('0xaf')))[_0x2ab4('0x90')]();_0x14a531[_0x2ab4('0x8f')](db[_0x2ab4('0x76')][_0x2ab4('0x3f')](_0x2e1916));}return BPromise[_0x2ab4('0x94')](_0x14a531);}})[_0x2ab4('0x2c')](function(){return _0x133b87;})['then'](respondWithResult(_0xf45c3f,null))[_0x2ab4('0x50')](handleError(_0xf45c3f,null));};exports[_0x2ab4('0xbb')]=function(_0x5297ad,_0x3ce039,_0x32b863){return db['VoiceQueue'][_0x2ab4('0x53')]({'where':{'id':_0x5297ad['params']['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x3ce039,null))[_0x2ab4('0x2c')](function(_0x2efa0d){if(_0x2efa0d){return _0x2efa0d[_0x2ab4('0xbb')](_0x5297ad['query']['ids']);}})[_0x2ab4('0x2c')](function(_0x39cd8b){if(_0x39cd8b){return db[_0x2ab4('0x6c')]['destroy']({'where':{'ListId':_0x5297ad[_0x2ab4('0x3f')][_0x2ab4('0x83')],'VoiceQueueId':_0x5297ad['params']['id']}})['then'](function(){return _0x39cd8b;});}})['then'](respondWithStatusCode(_0x3ce039,null))[_0x2ab4('0x50')](handleError(_0x3ce039,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 938478a..b0eedc1 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 _0x308f=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1d74be,_0x3fdda7){var _0x1535db=function(_0x516b31){while(--_0x516b31){_0x1d74be['push'](_0x1d74be['shift']());}};_0x1535db(++_0x3fdda7);}(_0x308f,0x70));var _0xf308=function(_0x5d94cd,_0x8a495b){_0x5d94cd=_0x5d94cd-0x0;var _0x4a7533=_0x308f[_0x5d94cd];return _0x4a7533;};'use strict';var EventEmitter=require(_0xf308('0x0'));var VoiceQueue=require(_0xf308('0x1'))['db'][_0xf308('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf308('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf308('0x4'),'afterDestroy':_0xf308('0x5')};function emitEvent(_0x3fe2d4){return function(_0x3f2799,_0xd6c95f,_0x29e69e){VoiceQueueEvents[_0xf308('0x6')](_0x3fe2d4+':'+_0x3f2799['id'],_0x3f2799);VoiceQueueEvents['emit'](_0x3fe2d4,_0x3f2799);_0x29e69e(null);};}for(var e in events){if(events[_0xf308('0x7')](e)){var event=events[e];VoiceQueue[_0xf308('0x8')](e,emitEvent(event));}}module[_0xf308('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x8448=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit'];(function(_0x3de728,_0x418639){var _0x1299b7=function(_0x31409e){while(--_0x31409e){_0x3de728['push'](_0x3de728['shift']());}};_0x1299b7(++_0x418639);}(_0x8448,0x126));var _0x8844=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x8448[_0x3457b4];return _0xaa8fa9;};'use strict';var EventEmitter=require(_0x8844('0x0'));var VoiceQueue=require(_0x8844('0x1'))['db'][_0x8844('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8844('0x3')](0x0);var events={'afterCreate':_0x8844('0x4'),'afterUpdate':'update','afterDestroy':_0x8844('0x5')};function emitEvent(_0x275c7a){return function(_0x365efd,_0xfe7214,_0x191e04){VoiceQueueEvents[_0x8844('0x6')](_0x275c7a+':'+_0x365efd['id'],_0x365efd);VoiceQueueEvents[_0x8844('0x6')](_0x275c7a,_0x365efd);_0x191e04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 7d5a146..85f4f65 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 _0xe718=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe718,0x88));var _0x8e71=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0xe718[_0x587693];return _0x510a1a;};'use strict';var _=require(_0x8e71('0x0'));var util=require(_0x8e71('0x1'));var logger=require(_0x8e71('0x2'))(_0x8e71('0x3'));var moment=require(_0x8e71('0x4'));var BPromise=require(_0x8e71('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e71('0x6'));var config=require(_0x8e71('0x7'));var attributes=require(_0x8e71('0x8'));module[_0x8e71('0x9')]=function(_0x213d2e,_0x1b55f8){return _0x213d2e[_0x8e71('0xa')]('VoiceQueue',attributes,{'tableName':_0x8e71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc06=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash'];(function(_0x17ede9,_0x27d731){var _0x35b71d=function(_0x30f681){while(--_0x30f681){_0x17ede9['push'](_0x17ede9['shift']());}};_0x35b71d(++_0x27d731);}(_0xcc06,0x117));var _0x6cc0=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xcc06[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x6cc0('0x0'));var util=require('util');var logger=require(_0x6cc0('0x1'))(_0x6cc0('0x2'));var moment=require(_0x6cc0('0x3'));var BPromise=require(_0x6cc0('0x4'));var rp=require(_0x6cc0('0x5'));var fs=require('fs');var path=require(_0x6cc0('0x6'));var rimraf=require(_0x6cc0('0x7'));var config=require(_0x6cc0('0x8'));var attributes=require(_0x6cc0('0x9'));module[_0x6cc0('0xa')]=function(_0x2558af,_0x225717){return _0x2558af[_0x6cc0('0xb')](_0x6cc0('0xc'),attributes,{'tableName':_0x6cc0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index bb5d350..52063d1 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 _0x8699=['catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x8699,0x193));var _0x9869=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x8699[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require('lodash');var util=require(_0x9869('0x0'));var moment=require(_0x9869('0x1'));var BPromise=require(_0x9869('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9869('0x3'));var db=require(_0x9869('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9869('0x5'))(_0x9869('0x6'));var config=require('../../config/environment');var jayson=require(_0x9869('0x7'));var client=jayson[_0x9869('0x8')]['http']({'port':0x232a});config['redis']=_[_0x9869('0x9')](config[_0x9869('0xa')],{'host':_0x9869('0xb'),'port':0x18eb});var socket=require(_0x9869('0xc'))(new Redis(config[_0x9869('0xa')]));require(_0x9869('0xd'))['register'](socket);function respondWithRpcPromise(_0x41ba6e,_0x400a6a,_0x11489c){return new BPromise(function(_0x9ff368,_0x12d7f7){return client[_0x9869('0xe')](_0x41ba6e,_0x11489c)[_0x9869('0xf')](function(_0x37a00e){logger[_0x9869('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x400a6a,_0x9869('0x11'));logger[_0x9869('0x12')](_0x9869('0x13'),_0x400a6a,_0x9869('0x11'),JSON[_0x9869('0x14')](_0x37a00e));if(_0x37a00e[_0x9869('0x15')]){if(_0x37a00e[_0x9869('0x15')][_0x9869('0x16')]===0x1f4){logger['error'](_0x9869('0x17'),_0x400a6a,_0x37a00e[_0x9869('0x15')][_0x9869('0x18')]);return _0x12d7f7(_0x37a00e[_0x9869('0x15')]['message']);}logger['error'](_0x9869('0x17'),_0x400a6a,_0x37a00e[_0x9869('0x15')][_0x9869('0x18')]);return _0x9ff368(_0x37a00e['error'][_0x9869('0x18')]);}else{logger[_0x9869('0x10')](_0x9869('0x17'),_0x400a6a,_0x9869('0x11'));_0x9ff368(_0x37a00e[_0x9869('0x19')][_0x9869('0x18')]);}})[_0x9869('0x1a')](function(_0x1afbf0){logger['error'](_0x9869('0x17'),_0x400a6a,_0x1afbf0);_0x12d7f7(_0x1afbf0);});});}exports['GetVoiceQueue']=function(_0x213278){var _0x4b112c=this;return new Promise(function(_0x501635,_0x4e65e8){return db[_0x9869('0x1b')][_0x9869('0x1c')]({'raw':_0x213278[_0x9869('0x1d')]?_0x213278[_0x9869('0x1d')][_0x9869('0x1e')]===undefined?!![]:![]:!![],'where':_0x213278[_0x9869('0x1d')]?_0x213278[_0x9869('0x1d')][_0x9869('0x1f')]||null:null,'attributes':_0x213278['options']?_0x213278[_0x9869('0x1d')][_0x9869('0x20')]||null:null,'limit':_0x213278[_0x9869('0x1d')]?_0x213278[_0x9869('0x1d')][_0x9869('0x21')]||null:null,'include':_0x213278[_0x9869('0x1d')]?_0x213278[_0x9869('0x1d')][_0x9869('0x22')]?_['map'](_0x213278[_0x9869('0x1d')]['include'],function(_0x18a76e){return{'model':db[_0x18a76e['model']],'as':_0x18a76e['as'],'attributes':_0x18a76e[_0x9869('0x20')],'include':_0x18a76e['include']?_[_0x9869('0x23')](_0x18a76e[_0x9869('0x22')],function(_0x1e88ab){return{'model':db[_0x1e88ab[_0x9869('0x24')]],'as':_0x1e88ab['as'],'attributes':_0x1e88ab['attributes'],'include':_0x1e88ab['include']?_[_0x9869('0x23')](_0x1e88ab[_0x9869('0x22')],function(_0xcf27b4){return{'model':db[_0xcf27b4[_0x9869('0x24')]],'as':_0xcf27b4['as'],'attributes':_0xcf27b4[_0x9869('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9869('0xf')](function(_0x1e0be2){logger[_0x9869('0x10')](_0x9869('0x25'),_0x213278);logger[_0x9869('0x12')](_0x9869('0x25'),_0x213278,JSON[_0x9869('0x14')](_0x1e0be2));_0x501635(_0x1e0be2);})[_0x9869('0x1a')](function(_0x48fdda){logger[_0x9869('0x15')]('GetVoiceQueue',_0x48fdda[_0x9869('0x18')],_0x213278);_0x4e65e8(_0x4b112c['error'](0x1f4,_0x48fdda['message']));});});};exports[_0x9869('0x26')]=function(_0x45637a){var _0x2cbaef=this;return new Promise(function(_0x30247a,_0x439b5c){return db[_0x9869('0x1b')]['find']({'raw':_0x45637a[_0x9869('0x1d')]?_0x45637a[_0x9869('0x1d')][_0x9869('0x1e')]===undefined?!![]:![]:!![],'where':_0x45637a[_0x9869('0x1d')]?_0x45637a[_0x9869('0x1d')][_0x9869('0x1f')]||null:null,'attributes':_0x45637a['options']?_0x45637a[_0x9869('0x1d')][_0x9869('0x20')]||null:null,'include':_0x45637a[_0x9869('0x1d')]?_0x45637a['options'][_0x9869('0x22')]?_['map'](_0x45637a[_0x9869('0x1d')]['include'],function(_0x1b224c){return{'model':db[_0x1b224c['model']],'as':_0x1b224c['as'],'attributes':_0x1b224c[_0x9869('0x20')],'include':_0x1b224c['include']?_[_0x9869('0x23')](_0x1b224c[_0x9869('0x22')],function(_0x28b87d){return{'model':db[_0x28b87d[_0x9869('0x24')]],'as':_0x28b87d['as'],'attributes':_0x28b87d[_0x9869('0x20')],'include':_0x28b87d[_0x9869('0x22')]?_[_0x9869('0x23')](_0x28b87d[_0x9869('0x22')],function(_0x2dfbd8){return{'model':db[_0x2dfbd8[_0x9869('0x24')]],'as':_0x2dfbd8['as'],'attributes':_0x2dfbd8[_0x9869('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f0e7e){logger[_0x9869('0x10')](_0x9869('0x26'),_0x45637a);logger[_0x9869('0x12')](_0x9869('0x26'),_0x45637a,JSON[_0x9869('0x14')](_0x3f0e7e));_0x30247a(_0x3f0e7e);})[_0x9869('0x1a')](function(_0x3fb9dd){logger[_0x9869('0x15')](_0x9869('0x26'),_0x3fb9dd['message'],_0x45637a);_0x439b5c(_0x2cbaef[_0x9869('0x15')](0x1f4,_0x3fb9dd[_0x9869('0x18')]));});});}; \ No newline at end of file +var _0x7aa5=['where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','map','include','model','ShowVoiceQueue','find'];(function(_0x872dfa,_0x4ff880){var _0xc3de9c=function(_0x1f6deb){while(--_0x1f6deb){_0x872dfa['push'](_0x872dfa['shift']());}};_0xc3de9c(++_0x4ff880);}(_0x7aa5,0x10b));var _0x57aa=function(_0x222e2d,_0x4cff0c){_0x222e2d=_0x222e2d-0x0;var _0x3dbbac=_0x7aa5[_0x222e2d];return _0x3dbbac;};'use strict';var _=require(_0x57aa('0x0'));var util=require(_0x57aa('0x1'));var moment=require('moment');var BPromise=require(_0x57aa('0x2'));var rs=require(_0x57aa('0x3'));var fs=require('fs');var Redis=require(_0x57aa('0x4'));var db=require(_0x57aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x57aa('0x6'))(_0x57aa('0x7'));var config=require('../../config/environment');var jayson=require(_0x57aa('0x8'));var client=jayson[_0x57aa('0x9')]['http']({'port':0x232a});config[_0x57aa('0xa')]=_[_0x57aa('0xb')](config[_0x57aa('0xa')],{'host':_0x57aa('0xc'),'port':0x18eb});var socket=require(_0x57aa('0xd'))(new Redis(config[_0x57aa('0xa')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x256766,_0x10f859,_0x23c43e){return new BPromise(function(_0x77465,_0x4c969f){return client[_0x57aa('0xe')](_0x256766,_0x23c43e)[_0x57aa('0xf')](function(_0x5f1c16){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x10f859,_0x57aa('0x10'));logger[_0x57aa('0x11')](_0x57aa('0x12'),_0x10f859,'request\x20sent',JSON[_0x57aa('0x13')](_0x5f1c16));if(_0x5f1c16[_0x57aa('0x14')]){if(_0x5f1c16[_0x57aa('0x14')][_0x57aa('0x15')]===0x1f4){logger[_0x57aa('0x14')](_0x57aa('0x16'),_0x10f859,_0x5f1c16[_0x57aa('0x14')][_0x57aa('0x17')]);return _0x4c969f(_0x5f1c16[_0x57aa('0x14')]['message']);}logger[_0x57aa('0x14')](_0x57aa('0x16'),_0x10f859,_0x5f1c16['error'][_0x57aa('0x17')]);return _0x77465(_0x5f1c16[_0x57aa('0x14')][_0x57aa('0x17')]);}else{logger[_0x57aa('0x18')](_0x57aa('0x16'),_0x10f859,_0x57aa('0x10'));_0x77465(_0x5f1c16['result'][_0x57aa('0x17')]);}})['catch'](function(_0x299f5b){logger[_0x57aa('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x10f859,_0x299f5b);_0x4c969f(_0x299f5b);});});}exports[_0x57aa('0x19')]=function(_0x347649){var _0x1d1d42=this;return new Promise(function(_0x4781f3,_0xa86852){return db[_0x57aa('0x1a')][_0x57aa('0x1b')]({'raw':_0x347649[_0x57aa('0x1c')]?_0x347649['options'][_0x57aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x347649[_0x57aa('0x1c')]?_0x347649[_0x57aa('0x1c')]['where']||null:null,'attributes':_0x347649['options']?_0x347649[_0x57aa('0x1c')][_0x57aa('0x1e')]||null:null,'limit':_0x347649['options']?_0x347649[_0x57aa('0x1c')][_0x57aa('0x1f')]||null:null,'include':_0x347649[_0x57aa('0x1c')]?_0x347649[_0x57aa('0x1c')]['include']?_[_0x57aa('0x20')](_0x347649[_0x57aa('0x1c')][_0x57aa('0x21')],function(_0x4406e9){return{'model':db[_0x4406e9[_0x57aa('0x22')]],'as':_0x4406e9['as'],'attributes':_0x4406e9[_0x57aa('0x1e')],'include':_0x4406e9[_0x57aa('0x21')]?_[_0x57aa('0x20')](_0x4406e9[_0x57aa('0x21')],function(_0x4b00cd){return{'model':db[_0x4b00cd['model']],'as':_0x4b00cd['as'],'attributes':_0x4b00cd[_0x57aa('0x1e')],'include':_0x4b00cd['include']?_[_0x57aa('0x20')](_0x4b00cd[_0x57aa('0x21')],function(_0x220e7e){return{'model':db[_0x220e7e[_0x57aa('0x22')]],'as':_0x220e7e['as'],'attributes':_0x220e7e[_0x57aa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x57aa('0xf')](function(_0x262118){logger[_0x57aa('0x18')](_0x57aa('0x19'),_0x347649);logger[_0x57aa('0x11')](_0x57aa('0x19'),_0x347649,JSON[_0x57aa('0x13')](_0x262118));_0x4781f3(_0x262118);})['catch'](function(_0x87759d){logger['error'](_0x57aa('0x19'),_0x87759d[_0x57aa('0x17')],_0x347649);_0xa86852(_0x1d1d42[_0x57aa('0x14')](0x1f4,_0x87759d['message']));});});};exports[_0x57aa('0x23')]=function(_0x28a4fc){var _0x3bf9d1=this;return new Promise(function(_0x34fea6,_0x488893){return db[_0x57aa('0x1a')][_0x57aa('0x24')]({'raw':_0x28a4fc[_0x57aa('0x1c')]?_0x28a4fc[_0x57aa('0x1c')][_0x57aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x28a4fc[_0x57aa('0x1c')]?_0x28a4fc[_0x57aa('0x1c')][_0x57aa('0x25')]||null:null,'attributes':_0x28a4fc[_0x57aa('0x1c')]?_0x28a4fc[_0x57aa('0x1c')][_0x57aa('0x1e')]||null:null,'include':_0x28a4fc[_0x57aa('0x1c')]?_0x28a4fc[_0x57aa('0x1c')][_0x57aa('0x21')]?_[_0x57aa('0x20')](_0x28a4fc['options'][_0x57aa('0x21')],function(_0x40784e){return{'model':db[_0x40784e[_0x57aa('0x22')]],'as':_0x40784e['as'],'attributes':_0x40784e[_0x57aa('0x1e')],'include':_0x40784e[_0x57aa('0x21')]?_[_0x57aa('0x20')](_0x40784e[_0x57aa('0x21')],function(_0x13a533){return{'model':db[_0x13a533[_0x57aa('0x22')]],'as':_0x13a533['as'],'attributes':_0x13a533['attributes'],'include':_0x13a533[_0x57aa('0x21')]?_[_0x57aa('0x20')](_0x13a533['include'],function(_0x36407f){return{'model':db[_0x36407f[_0x57aa('0x22')]],'as':_0x36407f['as'],'attributes':_0x36407f[_0x57aa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x57aa('0xf')](function(_0x273e98){logger[_0x57aa('0x18')](_0x57aa('0x23'),_0x28a4fc);logger[_0x57aa('0x11')](_0x57aa('0x23'),_0x28a4fc,JSON[_0x57aa('0x13')](_0x273e98));_0x34fea6(_0x273e98);})['catch'](function(_0x3fa8e4){logger[_0x57aa('0x14')](_0x57aa('0x23'),_0x3fa8e4[_0x57aa('0x17')],_0x28a4fc);_0x488893(_0x3bf9d1['error'](0x1f4,_0x3fa8e4[_0x57aa('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f7ad3e1..1b91fc2 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 _0xe664=['length','voiceQueue:','./voiceQueue.events','save','removeListener'];(function(_0x1f2b31,_0x3d43e8){var _0x158043=function(_0x555558){while(--_0x555558){_0x1f2b31['push'](_0x1f2b31['shift']());}};_0x158043(++_0x3d43e8);}(_0xe664,0x1c4));var _0x4e66=function(_0x1b3229,_0x58511d){_0x1b3229=_0x1b3229-0x0;var _0x56ca84=_0xe664[_0x1b3229];return _0x56ca84;};'use strict';var VoiceQueueEvents=require(_0x4e66('0x0'));var events=[_0x4e66('0x1'),'remove','update'];function createListener(_0x15a987,_0x1401b7){return function(_0x58431d){_0x1401b7['emit'](_0x15a987,_0x58431d);};}function removeListener(_0x51f2bb,_0x36aed5){return function(){VoiceQueueEvents[_0x4e66('0x2')](_0x51f2bb,_0x36aed5);};}exports['register']=function(_0xc60168){for(var _0x5dab08=0x0,_0x531df6=events[_0x4e66('0x3')];_0x5dab08<_0x531df6;_0x5dab08++){var _0x42365f=events[_0x5dab08];var _0x2c645a=createListener(_0x4e66('0x4')+_0x42365f,_0xc60168);VoiceQueueEvents['on'](_0x42365f,_0x2c645a);}}; \ No newline at end of file +var _0x1543=['remove','update','removeListener','register','length','./voiceQueue.events','save'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x1543,0x1c5));var _0x3154=function(_0x15e450,_0xedaefc){_0x15e450=_0x15e450-0x0;var _0x55ed61=_0x1543[_0x15e450];return _0x55ed61;};'use strict';var VoiceQueueEvents=require(_0x3154('0x0'));var events=[_0x3154('0x1'),_0x3154('0x2'),_0x3154('0x3')];function createListener(_0x32a740,_0x3841cb){return function(_0xda6c70){_0x3841cb['emit'](_0x32a740,_0xda6c70);};}function removeListener(_0x2306a0,_0x33ccfd){return function(){VoiceQueueEvents[_0x3154('0x4')](_0x2306a0,_0x33ccfd);};}exports[_0x3154('0x5')]=function(_0x37c77d){for(var _0x331b37=0x0,_0xa8b04a=events[_0x3154('0x6')];_0x331b37<_0xa8b04a;_0x331b37++){var _0x3fe198=events[_0x331b37];var _0xcb65f7=createListener('voiceQueue:'+_0x3fe198,_0x37c77d);VoiceQueueEvents['on'](_0x3fe198,_0xcb65f7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d144f5a..6005785 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 _0x627e=['describe','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated'];(function(_0x21bede,_0x542949){var _0x38fbee=function(_0x4d3319){while(--_0x4d3319){_0x21bede['push'](_0x21bede['shift']());}};_0x38fbee(++_0x542949);}(_0x627e,0x14a));var _0xe627=function(_0x1f331f,_0x1c21a6){_0x1f331f=_0x1f331f-0x0;var _0x4a5002=_0x627e[_0x1f331f];return _0x4a5002;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var auth=require(_0xe627('0x5'));var interaction=require(_0xe627('0x6'));var config=require(_0xe627('0x7'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe627('0x8')]);router[_0xe627('0x9')](_0xe627('0xa'),auth[_0xe627('0xb')](),controller[_0xe627('0xc')]);router[_0xe627('0x9')]('/index',auth[_0xe627('0xb')](),controller['getVoiceQueuesReport']);router['get'](_0xe627('0xd'),auth[_0xe627('0xb')](),controller['show']);router['post']('/',auth[_0xe627('0xb')](),controller[_0xe627('0xe')]);router[_0xe627('0xf')](_0xe627('0xd'),auth[_0xe627('0xb')](),controller[_0xe627('0x10')]);router[_0xe627('0x11')](_0xe627('0xd'),auth[_0xe627('0xb')](),controller['destroy']);module[_0xe627('0x12')]=router; \ No newline at end of file +var _0x1115=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe','/index','getVoiceQueuesReport','show','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x4b84ae,_0x26f981){var _0x3325f8=function(_0x242b05){while(--_0x242b05){_0x4b84ae['push'](_0x4b84ae['shift']());}};_0x3325f8(++_0x26f981);}(_0x1115,0x1b6));var _0x5111=function(_0x19cd5a,_0xc3525c){_0x19cd5a=_0x19cd5a-0x0;var _0x237fa6=_0x1115[_0x19cd5a];return _0x237fa6;};'use strict';var multer=require('multer');var util=require(_0x5111('0x0'));var path=require(_0x5111('0x1'));var timeout=require(_0x5111('0x2'));var express=require(_0x5111('0x3'));var router=express[_0x5111('0x4')]();var auth=require(_0x5111('0x5'));var interaction=require(_0x5111('0x6'));var config=require(_0x5111('0x7'));var controller=require(_0x5111('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5111('0x9')]);router[_0x5111('0xa')]('/describe',auth[_0x5111('0xb')](),controller[_0x5111('0xc')]);router['get'](_0x5111('0xd'),auth['isAuthenticated'](),controller[_0x5111('0xe')]);router[_0x5111('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5111('0xf')]);router['post']('/',auth[_0x5111('0xb')](),controller['create']);router[_0x5111('0x10')](_0x5111('0x11'),auth[_0x5111('0xb')](),controller[_0x5111('0x12')]);router[_0x5111('0x13')](_0x5111('0x11'),auth[_0x5111('0xb')](),controller[_0x5111('0x14')]);module[_0x5111('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b8bc0bd..475ae76 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 _0x2275=['getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2275,0xfa));var _0x5227=function(_0x350803,_0x4ffe67){_0x350803=_0x350803-0x0;var _0xeb8039=_0x2275[_0x350803];return _0xeb8039;};'use strict';var Sequelize=require(_0x5227('0x0'));var moment=require(_0x5227('0x1'));module[_0x5227('0x2')]={'type':{'type':Sequelize[_0x5227('0x3')]},'uniqueid':{'type':Sequelize[_0x5227('0x3')]},'calleridnum':{'type':Sequelize[_0x5227('0x3')]},'calleridname':{'type':Sequelize[_0x5227('0x3')]},'queue':{'type':Sequelize[_0x5227('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x5227('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x5227('0x4')],'set':function(_0x1dec7a){var _0x2aa9ea=moment(_0x1dec7a);var _0x351ad1=moment(this[_0x5227('0x5')]('queuecallerjoinAt'))[_0x5227('0x6')](_0x5227('0x7'));var _0x2d9323=_0x2aa9ea[_0x5227('0x8')](_0x351ad1,_0x5227('0x9'));this['setDataValue'](_0x5227('0xa'),_0x1dec7a);this[_0x5227('0xb')]('holdtime',_0x2d9323||null);}},'position':{'type':Sequelize[_0x5227('0xc')]},'count':{'type':Sequelize[_0x5227('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x5227('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5227('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5227('0x4')]},'queuecallerexit':{'type':Sequelize[_0x5227('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x5227('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5227('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5227('0x3')]},'context':{'type':Sequelize[_0x5227('0x3')]},'exten':{'type':Sequelize[_0x5227('0x3')]},'priority':{'type':Sequelize[_0x5227('0x3')]},'holdtime':{'type':Sequelize[_0x5227('0xc')]},'mohtime':{'type':Sequelize[_0x5227('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5227('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5227('0x3')]},'transfer':{'type':Sequelize[_0x5227('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5227('0x3')],'comment':_0x5227('0xe')},'transferexten':{'type':Sequelize[_0x5227('0x3')]},'transferuniqueid':{'type':Sequelize[_0x5227('0x3')]},'disposition':{'type':Sequelize[_0x5227('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x5227('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5527=['format','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5527,0x13f));var _0x7552=function(_0x4e94bf,_0x1e19a6){_0x4e94bf=_0x4e94bf-0x0;var _0x54bc9f=_0x5527[_0x4e94bf];return _0x54bc9f;};'use strict';var Sequelize=require(_0x7552('0x0'));var moment=require(_0x7552('0x1'));module[_0x7552('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7552('0x3')]},'calleridname':{'type':Sequelize[_0x7552('0x3')]},'queue':{'type':Sequelize[_0x7552('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x7552('0x4')],'set':function(_0x20202b){var _0x2f9b59=moment(_0x20202b);var _0x1f8ffa=moment(this[_0x7552('0x5')]('queuecallerjoinAt'))[_0x7552('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x39f9c7=_0x2f9b59['diff'](_0x1f8ffa,_0x7552('0x7'));this[_0x7552('0x8')]('queuecallerleaveAt',_0x20202b);this[_0x7552('0x8')](_0x7552('0x9'),_0x39f9c7||null);}},'position':{'type':Sequelize[_0x7552('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x7552('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7552('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x7552('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7552('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7552('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x7552('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x7552('0xa')]},'channel':{'type':Sequelize[_0x7552('0x3')]},'connectedlinenum':{'type':Sequelize[_0x7552('0x3')]},'connectedlinename':{'type':Sequelize[_0x7552('0x3')]},'accountcode':{'type':Sequelize[_0x7552('0x3')]},'context':{'type':Sequelize[_0x7552('0x3')]},'exten':{'type':Sequelize[_0x7552('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x7552('0xa')]},'mohtime':{'type':Sequelize[_0x7552('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7552('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7552('0x3')]},'transfer':{'type':Sequelize[_0x7552('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7552('0x3')],'comment':_0x7552('0xc')},'transferexten':{'type':Sequelize[_0x7552('0x3')]},'transferuniqueid':{'type':Sequelize[_0x7552('0x3')]},'disposition':{'type':Sequelize[_0x7552('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 3374154..7aac6ae 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x7a54,0x106));var _0x47a5=function(_0x481cf5,_0x2dc933){_0x481cf5=_0x481cf5-0x0;var _0x3ae4c7=_0x7a54[_0x481cf5];return _0x3ae4c7;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 7e20533..e0ed179 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 _0x0634=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','remove','emit'];(function(_0x4d7c91,_0xb6827e){var _0x1953e7=function(_0x328213){while(--_0x328213){_0x4d7c91['push'](_0x4d7c91['shift']());}};_0x1953e7(++_0xb6827e);}(_0x0634,0xc7));var _0x4063=function(_0x21331a,_0x57fc48){_0x21331a=_0x21331a-0x0;var _0x325c55=_0x0634[_0x21331a];return _0x325c55;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x4063('0x0'))['db'][_0x4063('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4063('0x2')};function emitEvent(_0x513c9f){return function(_0x3527fe,_0x51f29c,_0x8bc9ba){VoiceQueueReportEvents[_0x4063('0x3')](_0x513c9f+':'+_0x3527fe['id'],_0x3527fe);VoiceQueueReportEvents[_0x4063('0x3')](_0x513c9f,_0x3527fe);_0x8bc9ba(null);};}for(var e in events){if(events[_0x4063('0x4')](e)){var event=events[e];VoiceQueueReport[_0x4063('0x5')](e,emitEvent(event));}}module[_0x4063('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xc6d1=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x3502fd,_0xa33fcd){var _0x2a4c3d=function(_0x30d932){while(--_0x30d932){_0x3502fd['push'](_0x3502fd['shift']());}};_0x2a4c3d(++_0xa33fcd);}(_0xc6d1,0x1a1));var _0x1c6d=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xc6d1[_0x4b2863];return _0x567d67;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x1c6d('0x0'))['db'][_0x1c6d('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1c6d('0x2')](0x0);var events={'afterCreate':_0x1c6d('0x3'),'afterUpdate':_0x1c6d('0x4'),'afterDestroy':_0x1c6d('0x5')};function emitEvent(_0x2754b1){return function(_0x3f0cf5,_0x18accb,_0x39eb9c){VoiceQueueReportEvents['emit'](_0x2754b1+':'+_0x3f0cf5['id'],_0x3f0cf5);VoiceQueueReportEvents['emit'](_0x2754b1,_0x3f0cf5);_0x39eb9c(null);};}for(var e in events){if(events[_0x1c6d('0x6')](e)){var event=events[e];VoiceQueueReport[_0x1c6d('0x7')](e,emitEvent(event));}}module[_0x1c6d('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c911118..4556f68 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 _0x0739=['define','VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x1bb8c0,_0x422534){var _0x16b733=function(_0x24b01a){while(--_0x24b01a){_0x1bb8c0['push'](_0x1bb8c0['shift']());}};_0x16b733(++_0x422534);}(_0x0739,0xba));var _0x9073=function(_0x7064b2,_0x38300f){_0x7064b2=_0x7064b2-0x0;var _0x5e60ce=_0x0739[_0x7064b2];return _0x5e60ce;};'use strict';var _=require(_0x9073('0x0'));var util=require(_0x9073('0x1'));var logger=require(_0x9073('0x2'))(_0x9073('0x3'));var moment=require('moment');var BPromise=require(_0x9073('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9073('0x5'));var config=require(_0x9073('0x6'));var attributes=require(_0x9073('0x7'));module[_0x9073('0x8')]=function(_0x5511e2,_0x17adc2){return _0x5511e2[_0x9073('0x9')](_0x9073('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x9073('0xb')]},{'fields':[_0x9073('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb715=['rimraf','../../config/environment','report_queue','uniqueid','calleridnum','util','api','moment','request-promise'];(function(_0x529059,_0x294a33){var _0x156bc2=function(_0x9bc770){while(--_0x9bc770){_0x529059['push'](_0x529059['shift']());}};_0x156bc2(++_0x294a33);}(_0xb715,0x16d));var _0x5b71=function(_0x320a59,_0x2ece25){_0x320a59=_0x320a59-0x0;var _0x1cf207=_0xb715[_0x320a59];return _0x1cf207;};'use strict';var _=require('lodash');var util=require(_0x5b71('0x0'));var logger=require('../../config/logger')(_0x5b71('0x1'));var moment=require(_0x5b71('0x2'));var BPromise=require('bluebird');var rp=require(_0x5b71('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b71('0x4'));var config=require(_0x5b71('0x5'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x887674,_0x2a2950){return _0x887674['define']('VoiceQueueReport',attributes,{'tableName':_0x5b71('0x6'),'paranoid':![],'indexes':[{'fields':[_0x5b71('0x7')]},{'fields':[_0x5b71('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0e743d6..8614544 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 _0x583e=['info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request'];(function(_0x2c2c0d,_0x477f6c){var _0x556d2c=function(_0x2089dd){while(--_0x2089dd){_0x2c2c0d['push'](_0x2c2c0d['shift']());}};_0x556d2c(++_0x477f6c);}(_0x583e,0x18a));var _0xe583=function(_0x44210e,_0x1c76d6){_0x44210e=_0x44210e-0x0;var _0x2c6399=_0x583e[_0x44210e];return _0x2c6399;};'use strict';var _=require(_0xe583('0x0'));var util=require('util');var moment=require(_0xe583('0x1'));var BPromise=require('bluebird');var rs=require(_0xe583('0x2'));var fs=require('fs');var Redis=require(_0xe583('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe583('0x4'))(_0xe583('0x5'));var config=require(_0xe583('0x6'));var jayson=require(_0xe583('0x7'));var client=jayson[_0xe583('0x8')][_0xe583('0x9')]({'port':0x232a});config[_0xe583('0xa')]=_[_0xe583('0xb')](config[_0xe583('0xa')],{'host':_0xe583('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe583('0xa')]));require(_0xe583('0xd'))[_0xe583('0xe')](socket);function respondWithRpcPromise(_0x19a8b6,_0x2bbac1,_0x43059c){return new BPromise(function(_0x8c8c02,_0x1b1a82){return client[_0xe583('0xf')](_0x19a8b6,_0x43059c)['then'](function(_0x26b4ae){logger[_0xe583('0x10')](_0xe583('0x11'),_0x2bbac1,'request\x20sent');logger[_0xe583('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2bbac1,_0xe583('0x13'),JSON[_0xe583('0x14')](_0x26b4ae));if(_0x26b4ae[_0xe583('0x15')]){if(_0x26b4ae[_0xe583('0x15')]['code']===0x1f4){logger[_0xe583('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x2bbac1,_0x26b4ae['error']['message']);return _0x1b1a82(_0x26b4ae[_0xe583('0x15')][_0xe583('0x16')]);}logger[_0xe583('0x15')](_0xe583('0x11'),_0x2bbac1,_0x26b4ae['error'][_0xe583('0x16')]);return _0x8c8c02(_0x26b4ae['error']['message']);}else{logger[_0xe583('0x10')](_0xe583('0x11'),_0x2bbac1,'request\x20sent');_0x8c8c02(_0x26b4ae[_0xe583('0x17')][_0xe583('0x16')]);}})[_0xe583('0x18')](function(_0x30d3a7){logger[_0xe583('0x15')](_0xe583('0x11'),_0x2bbac1,_0x30d3a7);_0x1b1a82(_0x30d3a7);});});}exports[_0xe583('0x19')]=function(_0xcba8b1){var _0x2e874a=this;return new Promise(function(_0xb3dc97,_0x41491a){return db[_0xe583('0x1a')]['findAll']({'raw':_0xcba8b1[_0xe583('0x1b')]?_0xcba8b1[_0xe583('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xcba8b1[_0xe583('0x1b')]?_0xcba8b1[_0xe583('0x1b')][_0xe583('0x1c')]||null:null,'attributes':_0xcba8b1[_0xe583('0x1b')]?_0xcba8b1[_0xe583('0x1b')][_0xe583('0x1d')]||null:null,'limit':_0xcba8b1['options']?_0xcba8b1[_0xe583('0x1b')][_0xe583('0x1e')]||null:null,'include':_0xcba8b1[_0xe583('0x1b')]?_0xcba8b1['options'][_0xe583('0x1f')]?_[_0xe583('0x20')](_0xcba8b1['options'][_0xe583('0x1f')],function(_0x3b348c){return{'model':db[_0x3b348c[_0xe583('0x21')]],'as':_0x3b348c['as'],'attributes':_0x3b348c['attributes'],'include':_0x3b348c[_0xe583('0x1f')]?_[_0xe583('0x20')](_0x3b348c[_0xe583('0x1f')],function(_0x439dfe){return{'model':db[_0x439dfe[_0xe583('0x21')]],'as':_0x439dfe['as'],'attributes':_0x439dfe[_0xe583('0x1d')],'include':_0x439dfe[_0xe583('0x1f')]?_[_0xe583('0x20')](_0x439dfe[_0xe583('0x1f')],function(_0x39a3c7){return{'model':db[_0x39a3c7[_0xe583('0x21')]],'as':_0x39a3c7['as'],'attributes':_0x39a3c7['attributes']};}):[]};}):[]};}):[]:[]})[_0xe583('0x22')](function(_0x2cf0f2){logger[_0xe583('0x10')]('GetVoiceQueueReport',_0xcba8b1);logger['debug'](_0xe583('0x19'),_0xcba8b1,JSON[_0xe583('0x14')](_0x2cf0f2));_0xb3dc97(_0x2cf0f2);})[_0xe583('0x18')](function(_0x5d4421){logger[_0xe583('0x15')](_0xe583('0x19'),_0x5d4421['message'],_0xcba8b1);_0x41491a(_0x2e874a[_0xe583('0x15')](0x1f4,_0x5d4421[_0xe583('0x16')]));});});};exports[_0xe583('0x23')]=function(_0x2824f0){var _0x28a030=this;return new Promise(function(_0x2c5dab,_0x302b18){return db[_0xe583('0x1a')][_0xe583('0x24')](_0x2824f0[_0xe583('0x25')],{'raw':_0x2824f0[_0xe583('0x1b')]?_0x2824f0[_0xe583('0x1b')][_0xe583('0x26')]===undefined?!![]:![]:!![]})[_0xe583('0x22')](function(_0x165a24){logger[_0xe583('0x10')]('CreateVoiceQueueReport',_0x2824f0);logger['debug'](_0xe583('0x23'),_0x2824f0,JSON[_0xe583('0x14')](_0x165a24));_0x2c5dab(_0x165a24);})[_0xe583('0x18')](function(_0x2f9f03){logger[_0xe583('0x15')]('CreateVoiceQueueReport',_0x2f9f03[_0xe583('0x16')],_0x2824f0);_0x302b18(_0x28a030[_0xe583('0x15')](0x1f4,_0x2f9f03[_0xe583('0x16')]));});});};exports[_0xe583('0x27')]=function(_0x4e7998){var _0x259ca3=this;return new Promise(function(_0x31eeaf,_0x1caa0c){return db[_0xe583('0x1a')][_0xe583('0x28')](_0x4e7998[_0xe583('0x25')],{'raw':_0x4e7998[_0xe583('0x1b')]?_0x4e7998[_0xe583('0x1b')][_0xe583('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e7998[_0xe583('0x1b')]?_0x4e7998[_0xe583('0x1b')][_0xe583('0x1c')]||null:null,'attributes':_0x4e7998[_0xe583('0x1b')]?_0x4e7998['options'][_0xe583('0x1d')]||null:null,'limit':_0x4e7998[_0xe583('0x1b')]?_0x4e7998[_0xe583('0x1b')][_0xe583('0x1e')]||null:null})[_0xe583('0x22')](function(_0x422be5){logger[_0xe583('0x10')](_0xe583('0x27'),_0x4e7998);logger[_0xe583('0x12')](_0xe583('0x27'),_0x4e7998,JSON['stringify'](_0x422be5));_0x31eeaf(_0x422be5);})[_0xe583('0x18')](function(_0x114784){logger[_0xe583('0x15')](_0xe583('0x27'),_0x114784[_0xe583('0x16')],_0x4e7998);_0x1caa0c(_0x259ca3[_0xe583('0x15')](0x1f4,_0x114784['message']));});});}; \ No newline at end of file +var _0x8f29=['info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','map','model','debug','catch','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voiceQueueReport.socket','register','request','then'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x8f29,0x1a5));var _0x98f2=function(_0x4b8f1e,_0xe5acdc){_0x4b8f1e=_0x4b8f1e-0x0;var _0x852451=_0x8f29[_0x4b8f1e];return _0x852451;};'use strict';var _=require(_0x98f2('0x0'));var util=require('util');var moment=require(_0x98f2('0x1'));var BPromise=require(_0x98f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98f2('0x3'));var db=require(_0x98f2('0x4'))['db'];var utils=require(_0x98f2('0x5'));var logger=require(_0x98f2('0x6'))(_0x98f2('0x7'));var config=require(_0x98f2('0x8'));var jayson=require(_0x98f2('0x9'));var client=jayson[_0x98f2('0xa')][_0x98f2('0xb')]({'port':0x232a});config['redis']=_[_0x98f2('0xc')](config[_0x98f2('0xd')],{'host':_0x98f2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x98f2('0xf'))[_0x98f2('0x10')](socket);function respondWithRpcPromise(_0x143aec,_0x252e15,_0x533fc8){return new BPromise(function(_0x5ae9b4,_0x43b9f0){return client[_0x98f2('0x11')](_0x143aec,_0x533fc8)[_0x98f2('0x12')](function(_0x2b4f3a){logger[_0x98f2('0x13')](_0x98f2('0x14'),_0x252e15,_0x98f2('0x15'));logger['debug'](_0x98f2('0x16'),_0x252e15,_0x98f2('0x15'),JSON[_0x98f2('0x17')](_0x2b4f3a));if(_0x2b4f3a[_0x98f2('0x18')]){if(_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x19')]===0x1f4){logger[_0x98f2('0x18')](_0x98f2('0x14'),_0x252e15,_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x1a')]);return _0x43b9f0(_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x1a')]);}logger['error'](_0x98f2('0x14'),_0x252e15,_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x1a')]);return _0x5ae9b4(_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x1a')]);}else{logger[_0x98f2('0x13')](_0x98f2('0x14'),_0x252e15,'request\x20sent');_0x5ae9b4(_0x2b4f3a['result'][_0x98f2('0x1a')]);}})['catch'](function(_0x45a8ec){logger[_0x98f2('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x252e15,_0x45a8ec);_0x43b9f0(_0x45a8ec);});});}exports[_0x98f2('0x1b')]=function(_0x3808ed){var _0x5bf884=this;return new Promise(function(_0x23dd04,_0x46649a){return db[_0x98f2('0x1c')]['findAll']({'raw':_0x3808ed[_0x98f2('0x1d')]?_0x3808ed[_0x98f2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3808ed['options']?_0x3808ed['options'][_0x98f2('0x1e')]||null:null,'attributes':_0x3808ed[_0x98f2('0x1d')]?_0x3808ed[_0x98f2('0x1d')][_0x98f2('0x1f')]||null:null,'limit':_0x3808ed[_0x98f2('0x1d')]?_0x3808ed['options'][_0x98f2('0x20')]||null:null,'include':_0x3808ed[_0x98f2('0x1d')]?_0x3808ed[_0x98f2('0x1d')][_0x98f2('0x21')]?_[_0x98f2('0x22')](_0x3808ed[_0x98f2('0x1d')][_0x98f2('0x21')],function(_0x45faf7){return{'model':db[_0x45faf7[_0x98f2('0x23')]],'as':_0x45faf7['as'],'attributes':_0x45faf7[_0x98f2('0x1f')],'include':_0x45faf7[_0x98f2('0x21')]?_['map'](_0x45faf7['include'],function(_0x4fe190){return{'model':db[_0x4fe190[_0x98f2('0x23')]],'as':_0x4fe190['as'],'attributes':_0x4fe190[_0x98f2('0x1f')],'include':_0x4fe190['include']?_[_0x98f2('0x22')](_0x4fe190[_0x98f2('0x21')],function(_0x53e64f){return{'model':db[_0x53e64f[_0x98f2('0x23')]],'as':_0x53e64f['as'],'attributes':_0x53e64f['attributes']};}):[]};}):[]};}):[]:[]})[_0x98f2('0x12')](function(_0x4451d9){logger[_0x98f2('0x13')](_0x98f2('0x1b'),_0x3808ed);logger[_0x98f2('0x24')](_0x98f2('0x1b'),_0x3808ed,JSON['stringify'](_0x4451d9));_0x23dd04(_0x4451d9);})[_0x98f2('0x25')](function(_0x40394a){logger[_0x98f2('0x18')](_0x98f2('0x1b'),_0x40394a['message'],_0x3808ed);_0x46649a(_0x5bf884[_0x98f2('0x18')](0x1f4,_0x40394a[_0x98f2('0x1a')]));});});};exports[_0x98f2('0x26')]=function(_0x201a2d){var _0xec50fa=this;return new Promise(function(_0x512446,_0x2fdf84){return db[_0x98f2('0x1c')][_0x98f2('0x27')](_0x201a2d[_0x98f2('0x28')],{'raw':_0x201a2d[_0x98f2('0x1d')]?_0x201a2d[_0x98f2('0x1d')][_0x98f2('0x29')]===undefined?!![]:![]:!![]})[_0x98f2('0x12')](function(_0x180fc0){logger[_0x98f2('0x13')](_0x98f2('0x26'),_0x201a2d);logger[_0x98f2('0x24')](_0x98f2('0x26'),_0x201a2d,JSON[_0x98f2('0x17')](_0x180fc0));_0x512446(_0x180fc0);})['catch'](function(_0x200473){logger[_0x98f2('0x18')]('CreateVoiceQueueReport',_0x200473[_0x98f2('0x1a')],_0x201a2d);_0x2fdf84(_0xec50fa[_0x98f2('0x18')](0x1f4,_0x200473['message']));});});};exports[_0x98f2('0x2a')]=function(_0x2a61ef){var _0x3ed327=this;return new Promise(function(_0x3c5454,_0x22164b){return db[_0x98f2('0x1c')][_0x98f2('0x2b')](_0x2a61ef[_0x98f2('0x28')],{'raw':_0x2a61ef[_0x98f2('0x1d')]?_0x2a61ef[_0x98f2('0x1d')][_0x98f2('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a61ef[_0x98f2('0x1d')]?_0x2a61ef[_0x98f2('0x1d')][_0x98f2('0x1e')]||null:null,'attributes':_0x2a61ef[_0x98f2('0x1d')]?_0x2a61ef[_0x98f2('0x1d')][_0x98f2('0x1f')]||null:null,'limit':_0x2a61ef['options']?_0x2a61ef[_0x98f2('0x1d')]['limit']||null:null})['then'](function(_0xde44db){logger[_0x98f2('0x13')]('UpdateVoiceQueueReport',_0x2a61ef);logger['debug'](_0x98f2('0x2a'),_0x2a61ef,JSON['stringify'](_0xde44db));_0x3c5454(_0xde44db);})[_0x98f2('0x25')](function(_0x5475cc){logger[_0x98f2('0x18')](_0x98f2('0x2a'),_0x5475cc[_0x98f2('0x1a')],_0x2a61ef);_0x22164b(_0x3ed327[_0x98f2('0x18')](0x1f4,_0x5475cc[_0x98f2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index aeb7b36..be92980 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 _0x8872=['update','emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x1647a4,_0x160e79){var _0x60cb4a=function(_0x35a8e6){while(--_0x35a8e6){_0x1647a4['push'](_0x1647a4['shift']());}};_0x60cb4a(++_0x160e79);}(_0x8872,0x1d3));var _0x2887=function(_0x5567af,_0x545f4d){_0x5567af=_0x5567af-0x0;var _0x20c8b5=_0x8872[_0x5567af];return _0x20c8b5;};'use strict';var VoiceQueueReportEvents=require(_0x2887('0x0'));var events=[_0x2887('0x1'),'remove',_0x2887('0x2')];function createListener(_0x397849,_0x55520d){return function(_0x5dc871){_0x55520d[_0x2887('0x3')](_0x397849,_0x5dc871);};}function removeListener(_0x698437,_0x27c329){return function(){VoiceQueueReportEvents[_0x2887('0x4')](_0x698437,_0x27c329);};}exports[_0x2887('0x5')]=function(_0xf80700){for(var _0x417bfb=0x0,_0x5597a3=events['length'];_0x417bfb<_0x5597a3;_0x417bfb++){var _0x580d3b=events[_0x417bfb];var _0x5af2ed=createListener(_0x2887('0x6')+_0x580d3b,_0xf80700);VoiceQueueReportEvents['on'](_0x580d3b,_0x5af2ed);}}; \ No newline at end of file +var _0x9b46=['register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x9b46,0xea));var _0x69b4=function(_0x31a650,_0x556865){_0x31a650=_0x31a650-0x0;var _0x1a840e=_0x9b46[_0x31a650];return _0x1a840e;};'use strict';var VoiceQueueReportEvents=require(_0x69b4('0x0'));var events=[_0x69b4('0x1'),_0x69b4('0x2'),_0x69b4('0x3')];function createListener(_0x2c8ff1,_0x33a8ca){return function(_0x3a7d09){_0x33a8ca[_0x69b4('0x4')](_0x2c8ff1,_0x3a7d09);};}function removeListener(_0x5d49fc,_0x283ebc){return function(){VoiceQueueReportEvents[_0x69b4('0x5')](_0x5d49fc,_0x283ebc);};}exports[_0x69b4('0x6')]=function(_0x779dc8){for(var _0x487d4d=0x0,_0x53c366=events['length'];_0x487d4d<_0x53c366;_0x487d4d++){var _0x21f4b1=events[_0x487d4d];var _0x3fcd8e=createListener(_0x69b4('0x7')+_0x21f4b1,_0x779dc8);VoiceQueueReportEvents['on'](_0x21f4b1,_0x3fcd8e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 53d7a79..ff14102 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 _0x21f2=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0xf00af9,_0x3d3ae8){var _0xcdd1f4=function(_0x18a5ed){while(--_0x18a5ed){_0xf00af9['push'](_0xf00af9['shift']());}};_0xcdd1f4(++_0x3d3ae8);}(_0x21f2,0x158));var _0x221f=function(_0x35fced,_0x22a43a){_0x35fced=_0x35fced-0x0;var _0x3813c1=_0x21f2[_0x35fced];return _0x3813c1;};'use strict';var multer=require('multer');var util=require(_0x221f('0x0'));var path=require(_0x221f('0x1'));var timeout=require(_0x221f('0x2'));var express=require(_0x221f('0x3'));var router=express[_0x221f('0x4')]();var auth=require(_0x221f('0x5'));var interaction=require(_0x221f('0x6'));var config=require(_0x221f('0x7'));var controller=require(_0x221f('0x8'));router[_0x221f('0x9')]('/',auth[_0x221f('0xa')](),controller['index']);router[_0x221f('0x9')](_0x221f('0xb'),auth[_0x221f('0xa')](),controller[_0x221f('0xc')]);router[_0x221f('0xd')]('/',auth['isAuthenticated'](),controller[_0x221f('0xe')]);router[_0x221f('0xf')](_0x221f('0xb'),auth[_0x221f('0xa')](),controller[_0x221f('0x10')]);router[_0x221f('0x11')](_0x221f('0xb'),auth[_0x221f('0xa')](),controller[_0x221f('0x12')]);module[_0x221f('0x13')]=router; \ No newline at end of file +var _0xb41e=['get','isAuthenticated','index','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller'];(function(_0x535636,_0x424d47){var _0x3a2f7a=function(_0x39e107){while(--_0x39e107){_0x535636['push'](_0x535636['shift']());}};_0x3a2f7a(++_0x424d47);}(_0xb41e,0x1f0));var _0xeb41=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0xb41e[_0x1a1b6e];return _0x571e2c;};'use strict';var multer=require(_0xeb41('0x0'));var util=require('util');var path=require(_0xeb41('0x1'));var timeout=require(_0xeb41('0x2'));var express=require(_0xeb41('0x3'));var router=express[_0xeb41('0x4')]();var auth=require(_0xeb41('0x5'));var interaction=require(_0xeb41('0x6'));var config=require('../../config/environment');var controller=require(_0xeb41('0x7'));router[_0xeb41('0x8')]('/',auth[_0xeb41('0x9')](),controller[_0xeb41('0xa')]);router[_0xeb41('0x8')]('/:id',auth[_0xeb41('0x9')](),controller['show']);router[_0xeb41('0xb')]('/',auth[_0xeb41('0x9')](),controller[_0xeb41('0xc')]);router[_0xeb41('0xd')]('/:id',auth[_0xeb41('0x9')](),controller[_0xeb41('0xe')]);router[_0xeb41('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xeb41('0x10')]);module[_0xeb41('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 47eda5c..fdd1b8d 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 _0xd05a=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x156ee1,_0x4bcf10){var _0x72c113=function(_0x5034c4){while(--_0x5034c4){_0x156ee1['push'](_0x156ee1['shift']());}};_0x72c113(++_0x4bcf10);}(_0xd05a,0xdf));var _0xad05=function(_0x2b545d,_0xdb928e){_0x2b545d=_0x2b545d-0x0;var _0x44675b=_0xd05a[_0x2b545d];return _0x44675b;};'use strict';var Sequelize=require(_0xad05('0x0'));var moment=require(_0xad05('0x1'));module[_0xad05('0x2')]={'time':{'type':Sequelize[_0xad05('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xad05('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0xad05('0x5'))}}; \ No newline at end of file +var _0x9506=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x2e8763,_0x2dd77a){var _0x3e2f44=function(_0x18bfc9){while(--_0x18bfc9){_0x2e8763['push'](_0x2e8763['shift']());}};_0x3e2f44(++_0x2dd77a);}(_0x9506,0xa9));var _0x6950=function(_0x5ada40,_0x41803a){_0x5ada40=_0x5ada40-0x0;var _0x3dfb05=_0x9506[_0x5ada40];return _0x3dfb05;};'use strict';var Sequelize=require(_0x6950('0x0'));var moment=require(_0x6950('0x1'));module[_0x6950('0x2')]={'time':{'type':Sequelize[_0x6950('0x3')]},'callid':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6950('0x4')],'allowNull':![],'defaultValue':moment()[_0x6950('0x5')](_0x6950('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 155e6db..793c94e 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x353204,_0x3ea389){var _0x53b2a6=function(_0x217298){while(--_0x217298){_0x353204['push'](_0x353204['shift']());}};_0x53b2a6(++_0x3ea389);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x7b6ffe,_0x2bc84a){var _0x3822d0=function(_0x382b3d){while(--_0x382b3d){_0x7b6ffe['push'](_0x7b6ffe['shift']());}};_0x3822d0(++_0x2bc84a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6e85c12..6ab059a 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 _0x6f47=['VoiceQueuesLog','event_dtm','event','dtm','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x3727a9,_0x1c2edb){var _0xa16806=function(_0x3ac27c){while(--_0x3ac27c){_0x3727a9['push'](_0x3727a9['shift']());}};_0xa16806(++_0x1c2edb);}(_0x6f47,0xc7));var _0x76f4=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x6f47[_0xa6cc5c];return _0x44803d;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x76f4('0xa'),'fields':[_0x76f4('0xb'),_0x76f4('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3f8a=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1376cf,_0x5407dc){var _0x5bbeae=function(_0x79bce9){while(--_0x79bce9){_0x1376cf['push'](_0x1376cf['shift']());}};_0x5bbeae(++_0x5407dc);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xb51660,_0x453a1f){_0xb51660=_0xb51660-0x0;var _0x287b35=_0x3f8a[_0xb51660];return _0x287b35;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[{'name':_0xa3f8('0xe'),'fields':[_0xa3f8('0xf'),_0xa3f8('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 7af3807..a91230f 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 _0x7be1=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','stringify','error','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x7be1,0x165));var _0x17be=function(_0x55fe01,_0x12ed37){_0x55fe01=_0x55fe01-0x0;var _0x5b42f0=_0x7be1[_0x55fe01];return _0x5b42f0;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var moment=require(_0x17be('0x2'));var BPromise=require('bluebird');var rs=require(_0x17be('0x3'));var fs=require('fs');var Redis=require(_0x17be('0x4'));var db=require(_0x17be('0x5'))['db'];var utils=require(_0x17be('0x6'));var logger=require(_0x17be('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17be('0x8')][_0x17be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f5b0c,_0x326f4d,_0x23f19f){return new BPromise(function(_0x2c74b2,_0xfd9c5){return client[_0x17be('0xa')](_0x4f5b0c,_0x23f19f)[_0x17be('0xb')](function(_0x582848){logger[_0x17be('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x326f4d,_0x17be('0xd'));logger[_0x17be('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x326f4d,_0x17be('0xd'),JSON[_0x17be('0xf')](_0x582848));if(_0x582848[_0x17be('0x10')]){if(_0x582848[_0x17be('0x10')]['code']===0x1f4){logger[_0x17be('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x326f4d,_0x582848[_0x17be('0x10')]['message']);return _0xfd9c5(_0x582848[_0x17be('0x10')][_0x17be('0x11')]);}logger[_0x17be('0x10')](_0x17be('0x12'),_0x326f4d,_0x582848[_0x17be('0x10')]['message']);return _0x2c74b2(_0x582848[_0x17be('0x10')]['message']);}else{logger['info'](_0x17be('0x12'),_0x326f4d,'request\x20sent');_0x2c74b2(_0x582848[_0x17be('0x13')]['message']);}})[_0x17be('0x14')](function(_0x312b2e){logger['error'](_0x17be('0x12'),_0x326f4d,_0x312b2e);_0xfd9c5(_0x312b2e);});});} \ No newline at end of file +var _0xb921=['info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5c0163,_0x1fab63){var _0x3b9541=function(_0x3ebf4f){while(--_0x3ebf4f){_0x5c0163['push'](_0x5c0163['shift']());}};_0x3b9541(++_0x1fab63);}(_0xb921,0x16a));var _0x1b92=function(_0x5f22f8,_0x36500d){_0x5f22f8=_0x5f22f8-0x0;var _0xff89ad=_0xb921[_0x5f22f8];return _0xff89ad;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a6282,_0x7973df,_0x352406){return new BPromise(function(_0x1545f9,_0x64a3ed){return client[_0x1b92('0xc')](_0x8a6282,_0x352406)[_0x1b92('0xd')](function(_0x4567ab){logger['info'](_0x1b92('0xe'),_0x7973df,_0x1b92('0xf'));logger[_0x1b92('0x10')](_0x1b92('0x11'),_0x7973df,_0x1b92('0xf'),JSON[_0x1b92('0x12')](_0x4567ab));if(_0x4567ab[_0x1b92('0x13')]){if(_0x4567ab['error'][_0x1b92('0x14')]===0x1f4){logger[_0x1b92('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x7973df,_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);return _0x64a3ed(_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);}logger[_0x1b92('0x13')](_0x1b92('0xe'),_0x7973df,_0x4567ab[_0x1b92('0x13')]['message']);return _0x1545f9(_0x4567ab[_0x1b92('0x13')]['message']);}else{logger[_0x1b92('0x16')]('VoiceQueuesLog,\x20%s,\x20%s',_0x7973df,_0x1b92('0xf'));_0x1545f9(_0x4567ab['result'][_0x1b92('0x15')]);}})[_0x1b92('0x17')](function(_0x688aef){logger['error'](_0x1b92('0xe'),_0x7973df,_0x688aef);_0x64a3ed(_0x688aef);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 9c4d147..db8d59b 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0xf361a3,_0x438658){var _0x8db071=function(_0x5c54cf){while(--_0x5c54cf){_0xf361a3['push'](_0xf361a3['shift']());}};_0x8db071(++_0x438658);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x511a87,_0xa77c7){var _0x586bdd=function(_0x2b4e17){while(--_0x2b4e17){_0x511a87['push'](_0x511a87['shift']());}};_0x586bdd(++_0xa77c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 017a8c4..81abfb1 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 _0x54ce=['createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','FLOAT','BOOLEAN','DATE'];(function(_0x47d044,_0x1c8551){var _0x22052a=function(_0x54e010){while(--_0x54e010){_0x47d044['push'](_0x47d044['shift']());}};_0x22052a(++_0x1c8551);}(_0x54ce,0xe1));var _0xe54c=function(_0x4391d7,_0x2a1c93){_0x4391d7=_0x4391d7-0x0;var _0x4ab0f8=_0x54ce[_0x4391d7];return _0x4ab0f8;};'use strict';var Sequelize=require(_0xe54c('0x0'));var moment=require('moment');var path=require(_0xe54c('0x1'));module[_0xe54c('0x2')]={'format':{'type':Sequelize[_0xe54c('0x3')],'get':function(){return this[_0xe54c('0x4')](_0xe54c('0x5'))?path[_0xe54c('0x6')](this[_0xe54c('0x4')](_0xe54c('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xe54c('0x7')]},'channel':{'type':Sequelize[_0xe54c('0x7')],'set':function(_0x519dba){if(_0x519dba){this[_0xe54c('0x8')](_0xe54c('0x9'),_0x519dba);this['setDataValue'](_0xe54c('0xa'),_0x519dba[_0xe54c('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xe54c('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe54c('0x7')]},'connectedlinenum':{'type':Sequelize[_0xe54c('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe54c('0x7')]},'context':{'type':Sequelize[_0xe54c('0x7')]},'exten':{'type':Sequelize[_0xe54c('0x7')]},'value':{'type':Sequelize[_0xe54c('0x7')]},'type':{'type':Sequelize[_0xe54c('0x7')]},'rating':{'type':Sequelize[_0xe54c('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xe54c('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xe54c('0xd')]},'transcribeName':{'type':Sequelize[_0xe54c('0x7')]},'transcribeStatus':{'type':Sequelize[_0xe54c('0x7')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0xe54c('0xd')]},'fileText':{'type':Sequelize[_0xe54c('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0xe54c('0x7')]},'sPositive':{'type':Sequelize[_0xe54c('0xe')]},'sNegative':{'type':Sequelize[_0xe54c('0xe')]},'sNeutral':{'type':Sequelize[_0xe54c('0xe')]},'sMixed':{'type':Sequelize[_0xe54c('0xe')]},'tempSentiment':{'type':Sequelize[_0xe54c('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xe54c('0x10')],'get':function(){return moment(this[_0xe54c('0x4')](_0xe54c('0x11')))[_0xe54c('0x12')](_0xe54c('0x13'))[_0xe54c('0x14')]();}},'updatedAt':{'type':Sequelize[_0xe54c('0x10')],'get':function(){return moment(this['getDataValue'](_0xe54c('0x15')))['format'](_0xe54c('0x13'))[_0xe54c('0x14')]();}}}; \ No newline at end of file +var _0x7eea=['exports','VIRTUAL','getDataValue','value','STRING','setDataValue','channel','split','TEXT','FLOAT','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','sequelize','moment'];(function(_0x591896,_0x386bac){var _0x5eaa48=function(_0x10ca6a){while(--_0x10ca6a){_0x591896['push'](_0x591896['shift']());}};_0x5eaa48(++_0x386bac);}(_0x7eea,0xce));var _0xa7ee=function(_0x49df2d,_0x1a5ce8){_0x49df2d=_0x49df2d-0x0;var _0x47a263=_0x7eea[_0x49df2d];return _0x47a263;};'use strict';var Sequelize=require(_0xa7ee('0x0'));var moment=require(_0xa7ee('0x1'));var path=require('path');module[_0xa7ee('0x2')]={'format':{'type':Sequelize[_0xa7ee('0x3')],'get':function(){return this[_0xa7ee('0x4')](_0xa7ee('0x5'))?path['extname'](this[_0xa7ee('0x4')](_0xa7ee('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa7ee('0x6')],'set':function(_0x5af976){if(_0x5af976){this[_0xa7ee('0x7')](_0xa7ee('0x8'),_0x5af976);this['setDataValue']('membername',_0x5af976[_0xa7ee('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xa7ee('0x6')]},'calleridnum':{'type':Sequelize[_0xa7ee('0x6')]},'calleridname':{'type':Sequelize[_0xa7ee('0x6')]},'connectedlinenum':{'type':Sequelize[_0xa7ee('0x6')]},'connectedlinename':{'type':Sequelize[_0xa7ee('0x6')]},'accountcode':{'type':Sequelize[_0xa7ee('0x6')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa7ee('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xa7ee('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0xa7ee('0x6')]},'transcribeStatus':{'type':Sequelize[_0xa7ee('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0xa7ee('0xa')]},'sentiment':{'type':Sequelize[_0xa7ee('0x6')]},'sPositive':{'type':Sequelize[_0xa7ee('0xb')]},'sNegative':{'type':Sequelize[_0xa7ee('0xb')]},'sNeutral':{'type':Sequelize[_0xa7ee('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xa7ee('0xc')],'get':function(){return moment(this[_0xa7ee('0x4')](_0xa7ee('0xd')))[_0xa7ee('0xe')](_0xa7ee('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0xa7ee('0xc')],'get':function(){return moment(this[_0xa7ee('0x4')]('updatedAt'))[_0xa7ee('0xe')](_0xa7ee('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 6d0ee8f..416f816 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 _0x6738=['transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','secrets','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','then','stack','name','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','count','includeAll','findAll','rows','catch','show','params','keys','fields','length','include','find','create','update','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','sequelize','MD5','col','token','$and','push','ValidationError','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob'];(function(_0x344c9a,_0x11e5e8){var _0x55ffbf=function(_0x6e3a5d){while(--_0x6e3a5d){_0x344c9a['push'](_0x344c9a['shift']());}};_0x55ffbf(++_0x11e5e8);}(_0x6738,0xbf));var _0x8673=function(_0x23b2fc,_0x5f2ee2){_0x23b2fc=_0x23b2fc-0x0;var _0x30e1d1=_0x6738[_0x23b2fc];return _0x30e1d1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8673('0x0'));var rimraf=require(_0x8673('0x1'));var zipdir=require(_0x8673('0x2'));var jsonpatch=require(_0x8673('0x3'));var rp=require(_0x8673('0x4'));var moment=require(_0x8673('0x5'));var BPromise=require(_0x8673('0x6'));var Mustache=require(_0x8673('0x7'));var util=require('util');var path=require(_0x8673('0x8'));var sox=require(_0x8673('0x9'));var csv=require(_0x8673('0xa'));var ejs=require(_0x8673('0xb'));var fs=require('fs');var _=require(_0x8673('0xc'));var squel=require(_0x8673('0xd'));var crypto=require(_0x8673('0xe'));var jsforce=require(_0x8673('0xf'));var deskjs=require(_0x8673('0x10'));var toCsv=require(_0x8673('0xa'));var querystring=require(_0x8673('0x11'));var Papa=require(_0x8673('0x12'));var AWS=require(_0x8673('0x13'));var uuidv4=require(_0x8673('0x14'));var Redis=require('ioredis');var authService=require(_0x8673('0x15'));var qs=require(_0x8673('0x16'));var as=require(_0x8673('0x17'));var hardwareService=require(_0x8673('0x18'));var logger=require(_0x8673('0x19'))(_0x8673('0x1a'));var utils=require(_0x8673('0x1b'));var config=require(_0x8673('0x1c'));var db=require(_0x8673('0x1d'))['db'];function respondWithStatusCode(_0x5d26ca,_0x265695){_0x265695=_0x265695||0xcc;return function(_0x1ab17a){if(_0x1ab17a){return _0x5d26ca[_0x8673('0x1e')](_0x265695);}return _0x5d26ca[_0x8673('0x1f')](_0x265695)[_0x8673('0x20')]();};}function respondWithResult(_0x5b562b,_0x3e174a){_0x3e174a=_0x3e174a||0xc8;return function(_0x1da3db){if(_0x1da3db){return _0x5b562b['status'](_0x3e174a)[_0x8673('0x21')](_0x1da3db);}};}function respondWithFilteredResult(_0x3f9b3c,_0x581da5){return function(_0x5b0ae6){if(_0x5b0ae6){var _0x38353a=_0x5b0ae6['count'],_0xc615c8=_0x581da5[_0x8673('0x22')],_0x16f2c0=_0x581da5[_0x8673('0x22')]+_0x581da5[_0x8673('0x23')],_0x55a242;if(_0x16f2c0>=_0x38353a){_0x16f2c0=_0x38353a;_0x55a242=0xc8;}else{_0x55a242=0xce;}_0x3f9b3c['status'](_0x55a242);return _0x3f9b3c['set']('Content-Range',_0xc615c8+'-'+_0x16f2c0+'/'+_0x38353a)[_0x8673('0x21')](_0x5b0ae6);}return null;};}function patchUpdates(_0x35145e){return function(_0x1e13cb){try{jsonpatch[_0x8673('0x24')](_0x1e13cb,_0x35145e,!![]);}catch(_0x5d11ff){return BPromise[_0x8673('0x25')](_0x5d11ff);}return _0x1e13cb['save']();};}function saveUpdates(_0x45d250,_0x17f38e){return function(_0x2ac179){if(_0x2ac179){return _0x2ac179['update'](_0x45d250)[_0x8673('0x26')](function(_0x3bb0f1){return _0x3bb0f1;});}return null;};}function removeEntity(_0xa250ca,_0x385cff){return function(_0x1b4df8){if(_0x1b4df8){return _0x1b4df8['destroy']()[_0x8673('0x26')](function(){_0xa250ca[_0x8673('0x1f')](0xcc)[_0x8673('0x20')]();});}};}function handleEntityNotFound(_0x39b5f3,_0x401862){return function(_0x2e1cea){if(!_0x2e1cea){_0x39b5f3[_0x8673('0x1e')](0x194);}return _0x2e1cea;};}function handleError(_0x3dd6f0,_0x23481e){_0x23481e=_0x23481e||0x1f4;return function(_0x3b705c){logger['error'](_0x3b705c[_0x8673('0x27')]);if(_0x3b705c[_0x8673('0x28')]){delete _0x3b705c[_0x8673('0x28')];}_0x3dd6f0[_0x8673('0x1f')](_0x23481e)['send'](_0x3b705c);};}exports[_0x8673('0x29')]=function(_0x48f6f7,_0x3cb2f8){var _0x16f683={},_0x148259={},_0x35d4ab={'count':0x0,'rows':[]};var _0x19bdb8=_['map'](db[_0x8673('0x2a')][_0x8673('0x2b')],function(_0x40d976){return{'name':_0x40d976[_0x8673('0x2c')],'type':_0x40d976[_0x8673('0x2d')][_0x8673('0x2e')]};});_0x148259[_0x8673('0x2f')]=_[_0x8673('0x30')](_['map'](_0x19bdb8,_0x8673('0x28')),[_0x8673('0x31')]);_0x148259[_0x8673('0x32')]=_['keys'](_0x48f6f7[_0x8673('0x32')]);_0x148259[_0x8673('0x33')]=_[_0x8673('0x34')](_0x148259['model'],_0x148259[_0x8673('0x32')]);_0x16f683[_0x8673('0x35')]=_['intersection'](_0x148259[_0x8673('0x2f')],qs['fields'](_0x48f6f7['query']['fields']));_0x16f683[_0x8673('0x35')]=_0x16f683[_0x8673('0x35')]['length']?_0x16f683[_0x8673('0x35')]:_0x148259[_0x8673('0x2f')];if(!_0x48f6f7[_0x8673('0x32')][_0x8673('0x36')](_0x8673('0x37'))){_0x16f683[_0x8673('0x23')]=qs[_0x8673('0x23')](_0x48f6f7['query']['limit']);_0x16f683[_0x8673('0x22')]=qs['offset'](_0x48f6f7['query']['offset']);}_0x16f683[_0x8673('0x38')]=qs[_0x8673('0x39')](_0x48f6f7[_0x8673('0x32')][_0x8673('0x39')]);_0x16f683['where']=qs[_0x8673('0x33')](_[_0x8673('0x3a')](_0x48f6f7['query'],_0x148259[_0x8673('0x33')]),_0x19bdb8);if(_0x48f6f7[_0x8673('0x32')][_0x8673('0x3b')]){_0x16f683[_0x8673('0x3c')]=_[_0x8673('0x3d')](_0x16f683[_0x8673('0x3c')],{'$or':_[_0x8673('0x3e')](_0x19bdb8,function(_0x2990cc){if(_0x2990cc[_0x8673('0x2d')]!=='VIRTUAL'){var _0x3ce096={};_0x3ce096[_0x2990cc['name']]={'$like':'%'+_0x48f6f7[_0x8673('0x32')][_0x8673('0x3b')]+'%'};return _0x3ce096;}})});}_0x16f683=_[_0x8673('0x3d')]({},_0x16f683,_0x48f6f7[_0x8673('0x3f')]);var _0x29892a={'where':_0x16f683[_0x8673('0x3c')]};return db[_0x8673('0x2a')][_0x8673('0x40')](_0x29892a)[_0x8673('0x26')](function(_0x571b11){_0x35d4ab['count']=_0x571b11;if(_0x48f6f7[_0x8673('0x32')][_0x8673('0x41')]){_0x16f683['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x8673('0x42')](_0x16f683);})[_0x8673('0x26')](function(_0x3087f7){_0x35d4ab[_0x8673('0x43')]=_0x3087f7;return _0x35d4ab;})[_0x8673('0x26')](respondWithFilteredResult(_0x3cb2f8,_0x16f683))[_0x8673('0x44')](handleError(_0x3cb2f8,null));};exports[_0x8673('0x45')]=function(_0x26c8f9,_0x3a8a25){var _0x5d5422={'raw':![],'where':{'id':_0x26c8f9[_0x8673('0x46')]['id']}},_0x4a63b5={};_0x4a63b5[_0x8673('0x2f')]=_['keys'](db[_0x8673('0x2a')][_0x8673('0x2b')]);_0x4a63b5[_0x8673('0x32')]=_[_0x8673('0x47')](_0x26c8f9[_0x8673('0x32')]);_0x4a63b5[_0x8673('0x33')]=_[_0x8673('0x34')](_0x4a63b5[_0x8673('0x2f')],_0x4a63b5[_0x8673('0x32')]);_0x5d5422['attributes']=_[_0x8673('0x34')](_0x4a63b5['model'],qs[_0x8673('0x48')](_0x26c8f9[_0x8673('0x32')][_0x8673('0x48')]));_0x5d5422[_0x8673('0x35')]=_0x5d5422[_0x8673('0x35')][_0x8673('0x49')]?_0x5d5422['attributes']:_0x4a63b5[_0x8673('0x2f')];if(_0x26c8f9['query'][_0x8673('0x41')]){_0x5d5422[_0x8673('0x4a')]=[{'all':!![]}];}_0x5d5422=_['merge']({},_0x5d5422,_0x26c8f9['options']);return db['VoiceRecording'][_0x8673('0x4b')](_0x5d5422)[_0x8673('0x26')](handleEntityNotFound(_0x3a8a25,null))['then'](respondWithResult(_0x3a8a25,null))['catch'](handleError(_0x3a8a25,null));};exports['create']=function(_0x5d1444,_0x3b3877){return db[_0x8673('0x2a')][_0x8673('0x4c')](_0x5d1444['body'],{})[_0x8673('0x26')](respondWithResult(_0x3b3877,0xc9))[_0x8673('0x44')](handleError(_0x3b3877,null));};exports[_0x8673('0x4d')]=function(_0x43816c,_0x551316){if(_0x43816c[_0x8673('0x4e')]['id']){delete _0x43816c[_0x8673('0x4e')]['id'];}return db[_0x8673('0x2a')]['find']({'where':{'id':_0x43816c[_0x8673('0x46')]['id']}})[_0x8673('0x26')](handleEntityNotFound(_0x551316,null))[_0x8673('0x26')](saveUpdates(_0x43816c['body'],null))['then'](respondWithResult(_0x551316,null))[_0x8673('0x44')](handleError(_0x551316,null));};exports['describe']=function(_0x1a8096,_0x3b699d){return db[_0x8673('0x2a')][_0x8673('0x4f')]()['then'](respondWithResult(_0x3b699d,null))[_0x8673('0x44')](handleError(_0x3b699d,null));};exports[_0x8673('0x50')]=function(_0xe656d4,_0x54771a,_0x4b4339){var _0x177145=require(_0x8673('0x51'));var _0x18315f=![];var _0xda836d={};if(_0xe656d4[_0x8673('0x32')][_0x8673('0x2d')]&&_0xe656d4['query']['type']===_0x8673('0x52')){_0xda836d[_0x8673('0x52')]=_0xe656d4[_0x8673('0x46')]['id'];}else{_0xda836d['id']=_0xe656d4[_0x8673('0x46')]['id'];}return db[_0x8673('0x2a')][_0x8673('0x4b')]({'where':_0xda836d,'attributes':['id',_0x8673('0x53')],'raw':!![]})[_0x8673('0x26')](handleEntityNotFound(_0x54771a,null))[_0x8673('0x26')](function(_0xb97a3b){if(_0xb97a3b){var _0x60cbf5=_0xb97a3b[_0x8673('0x53')];var _0x520f5e=util[_0x8673('0x31')](_0x8673('0x54'),_0x60cbf5);if(fs[_0x8673('0x55')](_0x520f5e)){_0x18315f=!![];return _0x177145[_0x8673('0x56')](_0x520f5e,_0x60cbf5,config['secrets'][_0x8673('0x57')])[_0x8673('0x26')](function(){return _0xb97a3b;});}return _0xb97a3b;}})[_0x8673('0x26')](function(_0x1efca8){if(_0x1efca8){var _0x606449=_0x1efca8[_0x8673('0x53')];if(!fs[_0x8673('0x55')](_0x606449)){throw new db[(_0x8673('0x58'))]['ValidationError'](_0x8673('0x59'));}if(_0x1efca8[_0x8673('0x5a')]){return _0x54771a[_0x8673('0x50')](_0x606449,_0x1efca8[_0x8673('0x5a')]+path[_0x8673('0x5b')](_0x606449),function(){if(_0x18315f){fs['unlink'](_0x606449);}});}else{return _0x54771a['download'](_0x606449,function(_0x5a7d0d){if(_0x18315f){fs[_0x8673('0x5c')](_0x606449);}});}}})[_0x8673('0x44')](function(_0x486462){if(_0x486462[_0x8673('0x5d')]===_0x8673('0x59')){_0x54771a['status'](0x194)[_0x8673('0x5e')](_0x8673('0x5f'));}else{return handleError(_0x54771a,null);}});};exports['downloads']=function(_0x1816da,_0x9610b6,_0x34763f){var _0x3a92ad=require(_0x8673('0x51'));var _0x2abebf=![];var _0x2a8cff={'$and':[db[_0x8673('0x60')][_0x8673('0x3c')](db[_0x8673('0x60')]['fn'](_0x8673('0x61'),db[_0x8673('0x60')][_0x8673('0x62')](_0x8673('0x52'))),_0x1816da[_0x8673('0x32')][_0x8673('0x63')])]};if(_0x1816da[_0x8673('0x32')]['type']&&_0x1816da[_0x8673('0x32')][_0x8673('0x2d')]===_0x8673('0x52')){_0x2a8cff[_0x8673('0x64')][_0x8673('0x65')]({'uniqueid':_0x1816da[_0x8673('0x46')]['id']});}else{_0x2a8cff[_0x8673('0x64')][_0x8673('0x65')]({'id':_0x1816da[_0x8673('0x46')]['id']});}return db[_0x8673('0x2a')]['find']({'where':_0x2a8cff,'attributes':['id',_0x8673('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x9610b6,null))[_0x8673('0x26')](function(_0x1f4388){if(_0x1f4388){var _0x173f90=util[_0x8673('0x31')](_0x8673('0x54'),_0x1f4388['value']);if(fs[_0x8673('0x55')](_0x173f90)){_0x2abebf=!![];return _0x3a92ad[_0x8673('0x56')](_0x173f90,_0x1f4388[_0x8673('0x53')],config['secrets'][_0x8673('0x57')])[_0x8673('0x26')](function(){return _0x1f4388;});}return _0x1f4388;}})[_0x8673('0x26')](function(_0x5cf333){if(_0x5cf333){if(!fs[_0x8673('0x55')](_0x5cf333[_0x8673('0x53')])){throw new db[(_0x8673('0x58'))][(_0x8673('0x66'))](_0x8673('0x59'));}if(_0x5cf333['filename']){return _0x9610b6[_0x8673('0x50')](_0x5cf333['value'],_0x5cf333[_0x8673('0x5a')]+path['extname'](_0x5cf333[_0x8673('0x53')]),function(){if(_0x2abebf){fs['unlink'](_0x5cf333[_0x8673('0x53')]);}});}else{return _0x9610b6[_0x8673('0x50')](_0x5cf333['value'],function(_0x1ac7ce){if(_0x2abebf){fs[_0x8673('0x5c')](_0x5cf333[_0x8673('0x53')]);}});}}})[_0x8673('0x44')](handleError(_0x9610b6,null));};exports[_0x8673('0x67')]=function(_0x3691ed,_0x268cac){return db[_0x8673('0x2a')][_0x8673('0x4b')]({'where':{'id':_0x3691ed[_0x8673('0x46')]['id']}})[_0x8673('0x26')](function(_0x733d88){if(!_0x733d88)throw new ReferenceError(_0x8673('0x68'));return _0x733d88;})[_0x8673('0x26')](function(_0x258f81){var _0x551b48=_0x258f81[_0x8673('0x53')];logger['info'](_0x8673('0x69'),_0x551b48);if(!_[_0x8673('0x6a')](_0x258f81[_0x8673('0x53')])&&fs[_0x8673('0x55')](_0x551b48)){logger[_0x8673('0x6b')](_0x8673('0x6c')+_0x551b48+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x551b48);}_0x551b48=_0x551b48+_0x8673('0x6d');if(!_[_0x8673('0x6a')](_0x258f81[_0x8673('0x53')])&&fs['existsSync'](_0x551b48)){logger['info'](_0x8673('0x6c')+_0x551b48+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8673('0x6e')](_0x551b48);}return _0x258f81;})['then'](function(_0x3ef115){if(!_0x3ef115)throw new InternalError();return _0x3ef115['destroy']();})[_0x8673('0x26')](function(){_0x268cac[_0x8673('0x1f')](0xcc)[_0x8673('0x20')]();})[_0x8673('0x44')](handleError(_0x268cac,null));};function getBucketslist(_0x3ce808,_0xd22f94,_0x49fb5b){return new Promise(function(_0x4fdfa7,_0x50783f){var _0x492ca9=new AWS['S3']({'accessKeyId':_0xd22f94,'secretAccessKey':_0x3ce808,'region':_0x49fb5b});_0x492ca9[_0x8673('0x6f')]({},function(_0x508d91,_0x9a7a9e){if(_0x508d91){return _0x50783f(_0x508d91);}else{return _0x4fdfa7(_0x9a7a9e);}});});}function createBucket(_0x524b64,_0x2def4c,_0x28dc3a,_0x167d8a){return new Promise(function(_0x40d55c,_0x463b2f){var _0x3d2007=new AWS['S3']({'accessKeyId':_0x2def4c,'secretAccessKey':_0x524b64,'region':_0x28dc3a});_0x3d2007[_0x8673('0x70')]({'Bucket':_0x167d8a},function(_0x58bbab,_0x4591db){if(_0x58bbab){return _0x463b2f(_0x58bbab);}else{return _0x40d55c(_0x4591db);}});});}function uploadFile(_0x771d32,_0x21f29a,_0x3c6911,_0x4a78fe,_0x4b0ecb,_0x49b890){return new Promise(function(_0x4c9688,_0x383872){var _0x4ff5bc=new AWS['S3']({'accessKeyId':_0x21f29a,'secretAccessKey':_0x771d32,'region':_0x3c6911});_0x4ff5bc[_0x8673('0x71')]({'Bucket':_0x4a78fe,'Key':_0x4b0ecb,'Body':_0x49b890},function(_0x3ee828,_0x4e704f){if(_0x3ee828){return _0x383872(_0x3ee828);}else{return _0x4c9688(_0x4e704f);}});});}function startTranscribe(_0xed03a7,_0x3fb32d,_0x3585ba,_0x50002b,_0x2a6325,_0x18f2b0){return new Promise(function(_0x333853,_0x1dd1e7){var _0x1bbdd6=new AWS[(_0x8673('0x72'))]({'accessKeyId':_0x3fb32d,'secretAccessKey':_0xed03a7,'region':_0x3585ba});_0x1bbdd6['startTranscriptionJob']({'TranscriptionJobName':_0x50002b,'LanguageCode':_0x2a6325,'Media':{'MediaFileUri':_0x18f2b0}},function(_0x2e5ded,_0x35b83a){if(_0x2e5ded){return _0x1dd1e7(_0x2e5ded);}else{return _0x333853(_0x35b83a);}});});}function transcribe(_0x5bdba7,_0x20fc6c,_0x18d922,_0x5ded21,_0x479aa4,_0x491bef,_0x123d72){return new Promise(function(_0x3b67b5,_0x4bf64e){var _0x273447={};logger[_0x8673('0x6b')](util['format'](_0x8673('0x73'),_0x5bdba7,_0x479aa4));return uploadFile(_0x20fc6c,_0x18d922,_0x5ded21,_0x479aa4,path[_0x8673('0x74')](_0x491bef),fs[_0x8673('0x75')](_0x491bef))['then'](function(_0x2181e4){logger['info'](util[_0x8673('0x31')](_0x8673('0x76'),_0x5bdba7,_0x479aa4,_0x2181e4['Location']));_0x273447[_0x8673('0x77')]=_0x2181e4['Bucket'];_0x273447[_0x8673('0x78')]=_0x2181e4[_0x8673('0x79')];logger[_0x8673('0x6b')](util[_0x8673('0x31')](_0x8673('0x7a'),_0x5bdba7));return startTranscribe(_0x20fc6c,_0x18d922,_0x5ded21,uuidv4(),_0x123d72,_0x2181e4[_0x8673('0x79')]);})[_0x8673('0x26')](function(_0x22fd66){logger[_0x8673('0x6b')](util[_0x8673('0x31')](_0x8673('0x7b'),_0x5bdba7,_0x22fd66['TranscriptionJob'][_0x8673('0x7c')]));_0x273447[_0x8673('0x7d')]=_0x22fd66[_0x8673('0x7e')][_0x8673('0x7c')];_0x273447[_0x8673('0x7f')]=_0x22fd66[_0x8673('0x7e')][_0x8673('0x80')];return _0x3b67b5(_0x273447);})[_0x8673('0x44')](function(_0x24bbb2){return _0x4bf64e(_0x24bbb2);});});}exports[_0x8673('0x81')]=function(_0x59b24c,_0x2ce04c,_0x79936c){var _0x357834;var _0x2d6ad3;var _0x17c6b8;var _0x5d7d47=require('../../components/encryptor');return db[_0x8673('0x2a')][_0x8673('0x82')]({'where':{'id':_0x59b24c[_0x8673('0x46')]['id']}})['then'](function(_0x35d3fa){if(_0x35d3fa){var _0x9be2a1=util[_0x8673('0x31')](_0x8673('0x54'),_0x35d3fa['value']);if(fs[_0x8673('0x55')](_0x9be2a1)){cypher=!![];return _0x5d7d47['decryptFile'](_0x9be2a1,_0x35d3fa[_0x8673('0x53')],config[_0x8673('0x83')][_0x8673('0x57')])[_0x8673('0x26')](function(){return _0x35d3fa;});}return _0x35d3fa;}})[_0x8673('0x26')](function(_0x3a591f){if(!_0x3a591f){throw new db['Sequelize']['ValidationError'](_0x8673('0x84'));}_0x2d6ad3=_0x3a591f;return db[_0x8673('0x85')][_0x8673('0x82')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x2ce04c,null))[_0x8673('0x26')](function(_0x2338f8){if(_0x2338f8){_0x357834=_0x2338f8;if(!_0x357834['transcribe']||!_0x357834[_0x8673('0x86')]||!_0x357834[_0x8673('0x87')]||!_0x357834[_0x8673('0x88')]||!_0x357834['bucket']){throw new db[(_0x8673('0x58'))][(_0x8673('0x66'))](_0x8673('0x89'));}if(_0x59b24c[_0x8673('0x4e')]['runSentiment']&&(!_0x357834[_0x8673('0x8a')]||!_0x357834[_0x8673('0x8b')]||!_0x357834[_0x8673('0x8c')]||!_0x357834[_0x8673('0x88')]||!_0x357834[_0x8673('0x77')])){throw new db[(_0x8673('0x58'))][(_0x8673('0x66'))](_0x8673('0x8d'));}return db[_0x8673('0x8e')][_0x8673('0x82')]({'where':{'id':_0x357834[_0x8673('0x86')]}});}})['then'](function(_0x4f02d7){if(!_0x4f02d7){throw new db[(_0x8673('0x58'))]['ValidationError'](_0x8673('0x8f'));}if(!_0x4f02d7['data1']||!_0x4f02d7[_0x8673('0x90')]){throw new db[(_0x8673('0x58'))]['ValidationError'](_0x8673('0x91'));}_0x17c6b8=_0x4f02d7;return getBucketslist(_0x17c6b8['data1'],_0x17c6b8['data2'],_0x357834[_0x8673('0x87')]);})[_0x8673('0x26')](function(_0x625ae6){if(_0x625ae6&&_0x625ae6[_0x8673('0x92')]){var _0x2c357c=_[_0x8673('0x4b')](_0x625ae6[_0x8673('0x92')],function(_0x39e7c7){return _0x39e7c7[_0x8673('0x93')]===_0x357834['bucket'];});if(!_0x2c357c){logger[_0x8673('0x6b')](util[_0x8673('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x59b24c['params']['id'],_0x357834[_0x8673('0x77')]));return createBucket(_0x17c6b8[_0x8673('0x94')],_0x17c6b8[_0x8673('0x90')],_0x357834[_0x8673('0x87')],_0x357834[_0x8673('0x77')]);}logger[_0x8673('0x6b')](util[_0x8673('0x31')](_0x8673('0x95'),_0x59b24c[_0x8673('0x46')]['id'],_0x357834[_0x8673('0x77')]));return;}})['then'](function(_0x18124c){if(_0x2d6ad3['transcribeStatus']===_0x8673('0x96')){return transcribe(_0x59b24c['params']['id'],_0x17c6b8[_0x8673('0x94')],_0x17c6b8[_0x8673('0x90')],_0x357834[_0x8673('0x87')],_0x357834[_0x8673('0x77')],_0x2d6ad3[_0x8673('0x53')],_0x357834[_0x8673('0x88')]);}else{logger[_0x8673('0x6b')](util['format'](_0x8673('0x97'),_0x59b24c[_0x8673('0x46')]['id']));return{'transcribeStatus':_0x8673('0x98')};}})[_0x8673('0x26')](function(_0x1a926d){if(_0x1a926d){_0x1a926d['tempSentiment']=_0x59b24c[_0x8673('0x4e')]['runSentiment'];return _0x2d6ad3['updateAttributes'](_0x1a926d);}})[_0x8673('0x26')](respondWithResult(_0x2ce04c,null))['catch'](handleError(_0x2ce04c,null));};function writeFile(_0x48520c,_0x48b7d7){return new Promise(function(_0x24ff5d,_0x35c922){fs[_0x8673('0x99')](_0x48b7d7,_0x48520c,function(_0x3057b0,_0x13f3f5){if(_0x3057b0){return _0x35c922(_0x3057b0);}else{return _0x24ff5d(_0x13f3f5);}});});}exports[_0x8673('0x9a')]=function(_0xd769fd,_0x33d72e,_0x1a2972){return db['VoiceRecording'][_0x8673('0x82')]({'where':{'id':_0xd769fd[_0x8673('0x46')]['id']}})[_0x8673('0x26')](handleEntityNotFound(_0x33d72e))[_0x8673('0x26')](function(_0x2fd9c4){if(_0x2fd9c4&&_0x2fd9c4[_0x8673('0x9b')]){var _0x2ba75f=_0x2fd9c4[_0x8673('0x9b')];var _0x5167d4=config[_0x8673('0x9c')]+_0x8673('0x9d')+_0x2fd9c4['id']+'.txt';if(fs['existsSync'](_0x5167d4)){return _0x5167d4;}return writeFile(_0x2ba75f,_0x5167d4)[_0x8673('0x26')](function(){return _0x5167d4;});}else{throw new db['Sequelize'][(_0x8673('0x66'))](_0x8673('0x9e'));}})['then'](function(_0xa5e3be){return _0x33d72e[_0x8673('0x50')](_0xa5e3be);})[_0x8673('0x44')](handleError(_0x33d72e));}; \ No newline at end of file +var _0xb121=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','save','destroy','then','name','VoiceRecording','rawAttributes','fieldName','model','map','format','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','download','../../components/encryptor','value','%s.cypher','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','MD5','col','token','uniqueid','push','existsSync','ValidationError','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJob','runTranscribe','findOne','transcribe','transcribeRegion','language','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xd6d78b,_0x2a1ff2){var _0xa45a6e=function(_0xf6d04d){while(--_0xf6d04d){_0xd6d78b['push'](_0xd6d78b['shift']());}};_0xa45a6e(++_0x2a1ff2);}(_0xb121,0x81));var _0x1b12=function(_0x1832f1,_0x53e248){_0x1832f1=_0x1832f1-0x0;var _0x34acad=_0xb121[_0x1832f1];return _0x34acad;};'use strict';var pdf=require(_0x1b12('0x0'));var emlformat=require(_0x1b12('0x1'));var rimraf=require(_0x1b12('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b12('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1b12('0x4'));var Mustache=require(_0x1b12('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1b12('0x6'));var csv=require(_0x1b12('0x7'));var ejs=require(_0x1b12('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b12('0x9'));var deskjs=require(_0x1b12('0xa'));var toCsv=require(_0x1b12('0x7'));var querystring=require(_0x1b12('0xb'));var Papa=require(_0x1b12('0xc'));var AWS=require('aws-sdk');var uuidv4=require(_0x1b12('0xd'));var Redis=require('ioredis');var authService=require(_0x1b12('0xe'));var qs=require(_0x1b12('0xf'));var as=require(_0x1b12('0x10'));var hardwareService=require(_0x1b12('0x11'));var logger=require(_0x1b12('0x12'))(_0x1b12('0x13'));var utils=require(_0x1b12('0x14'));var config=require(_0x1b12('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe87cfd,_0x28abb0){_0x28abb0=_0x28abb0||0xcc;return function(_0x2e5edb){if(_0x2e5edb){return _0xe87cfd[_0x1b12('0x16')](_0x28abb0);}return _0xe87cfd[_0x1b12('0x17')](_0x28abb0)[_0x1b12('0x18')]();};}function respondWithResult(_0x4c987,_0x50e243){_0x50e243=_0x50e243||0xc8;return function(_0x20269c){if(_0x20269c){return _0x4c987['status'](_0x50e243)[_0x1b12('0x19')](_0x20269c);}};}function respondWithFilteredResult(_0x508344,_0x3e50bb){return function(_0x48a19c){if(_0x48a19c){var _0x3c2e47=_0x48a19c[_0x1b12('0x1a')],_0x58d01f=_0x3e50bb[_0x1b12('0x1b')],_0xfa82ca=_0x3e50bb[_0x1b12('0x1b')]+_0x3e50bb['limit'],_0x1a6848;if(_0xfa82ca>=_0x3c2e47){_0xfa82ca=_0x3c2e47;_0x1a6848=0xc8;}else{_0x1a6848=0xce;}_0x508344['status'](_0x1a6848);return _0x508344[_0x1b12('0x1c')](_0x1b12('0x1d'),_0x58d01f+'-'+_0xfa82ca+'/'+_0x3c2e47)[_0x1b12('0x19')](_0x48a19c);}return null;};}function patchUpdates(_0x299bc3){return function(_0x1a84df){try{jsonpatch['apply'](_0x1a84df,_0x299bc3,!![]);}catch(_0x1990e9){return BPromise['reject'](_0x1990e9);}return _0x1a84df[_0x1b12('0x1e')]();};}function saveUpdates(_0x5dd493,_0xfd8a4d){return function(_0x4ba6eb){if(_0x4ba6eb){return _0x4ba6eb['update'](_0x5dd493)['then'](function(_0x58cde9){return _0x58cde9;});}return null;};}function removeEntity(_0x4b797e,_0x48bf67){return function(_0x3600bf){if(_0x3600bf){return _0x3600bf[_0x1b12('0x1f')]()[_0x1b12('0x20')](function(){_0x4b797e[_0x1b12('0x17')](0xcc)[_0x1b12('0x18')]();});}};}function handleEntityNotFound(_0xf8c87f,_0x3d45b7){return function(_0x59de5c){if(!_0x59de5c){_0xf8c87f[_0x1b12('0x16')](0x194);}return _0x59de5c;};}function handleError(_0x26d97d,_0x4b7c05){_0x4b7c05=_0x4b7c05||0x1f4;return function(_0x2a3c6b){logger['error'](_0x2a3c6b['stack']);if(_0x2a3c6b['name']){delete _0x2a3c6b[_0x1b12('0x21')];}_0x26d97d[_0x1b12('0x17')](_0x4b7c05)['send'](_0x2a3c6b);};}exports['index']=function(_0x12cd73,_0x1a1d60){var _0x4979a6={},_0x49355e={},_0xd50e40={'count':0x0,'rows':[]};var _0x439bfe=_['map'](db[_0x1b12('0x22')][_0x1b12('0x23')],function(_0x46d6f4){return{'name':_0x46d6f4[_0x1b12('0x24')],'type':_0x46d6f4['type']['key']};});_0x49355e[_0x1b12('0x25')]=_['differenceBy'](_[_0x1b12('0x26')](_0x439bfe,_0x1b12('0x21')),[_0x1b12('0x27')]);_0x49355e[_0x1b12('0x28')]=_[_0x1b12('0x29')](_0x12cd73['query']);_0x49355e[_0x1b12('0x2a')]=_[_0x1b12('0x2b')](_0x49355e[_0x1b12('0x25')],_0x49355e['query']);_0x4979a6[_0x1b12('0x2c')]=_[_0x1b12('0x2b')](_0x49355e[_0x1b12('0x25')],qs['fields'](_0x12cd73[_0x1b12('0x28')][_0x1b12('0x2d')]));_0x4979a6['attributes']=_0x4979a6['attributes'][_0x1b12('0x2e')]?_0x4979a6[_0x1b12('0x2c')]:_0x49355e[_0x1b12('0x25')];if(!_0x12cd73[_0x1b12('0x28')]['hasOwnProperty'](_0x1b12('0x2f'))){_0x4979a6[_0x1b12('0x30')]=qs[_0x1b12('0x30')](_0x12cd73[_0x1b12('0x28')]['limit']);_0x4979a6[_0x1b12('0x1b')]=qs[_0x1b12('0x1b')](_0x12cd73[_0x1b12('0x28')][_0x1b12('0x1b')]);}_0x4979a6[_0x1b12('0x31')]=qs[_0x1b12('0x32')](_0x12cd73[_0x1b12('0x28')][_0x1b12('0x32')]);_0x4979a6[_0x1b12('0x33')]=qs['filters'](_[_0x1b12('0x34')](_0x12cd73[_0x1b12('0x28')],_0x49355e[_0x1b12('0x2a')]),_0x439bfe);if(_0x12cd73[_0x1b12('0x28')][_0x1b12('0x35')]){_0x4979a6['where']=_[_0x1b12('0x36')](_0x4979a6[_0x1b12('0x33')],{'$or':_[_0x1b12('0x26')](_0x439bfe,function(_0x5b4baf){if(_0x5b4baf[_0x1b12('0x37')]!==_0x1b12('0x38')){var _0x2073b8={};_0x2073b8[_0x5b4baf[_0x1b12('0x21')]]={'$like':'%'+_0x12cd73[_0x1b12('0x28')][_0x1b12('0x35')]+'%'};return _0x2073b8;}})});}_0x4979a6=_[_0x1b12('0x36')]({},_0x4979a6,_0x12cd73[_0x1b12('0x39')]);var _0x123e26={'where':_0x4979a6[_0x1b12('0x33')]};return db[_0x1b12('0x22')][_0x1b12('0x1a')](_0x123e26)[_0x1b12('0x20')](function(_0x33b6b0){_0xd50e40[_0x1b12('0x1a')]=_0x33b6b0;if(_0x12cd73[_0x1b12('0x28')][_0x1b12('0x3a')]){_0x4979a6[_0x1b12('0x3b')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1b12('0x3c')](_0x4979a6);})[_0x1b12('0x20')](function(_0x4b3fae){_0xd50e40[_0x1b12('0x3d')]=_0x4b3fae;return _0xd50e40;})[_0x1b12('0x20')](respondWithFilteredResult(_0x1a1d60,_0x4979a6))[_0x1b12('0x3e')](handleError(_0x1a1d60,null));};exports[_0x1b12('0x3f')]=function(_0x58fd0a,_0x24f102){var _0x5efd3d={'raw':![],'where':{'id':_0x58fd0a[_0x1b12('0x40')]['id']}},_0x30a8bf={};_0x30a8bf['model']=_['keys'](db[_0x1b12('0x22')][_0x1b12('0x23')]);_0x30a8bf['query']=_[_0x1b12('0x29')](_0x58fd0a[_0x1b12('0x28')]);_0x30a8bf[_0x1b12('0x2a')]=_[_0x1b12('0x2b')](_0x30a8bf['model'],_0x30a8bf[_0x1b12('0x28')]);_0x5efd3d[_0x1b12('0x2c')]=_[_0x1b12('0x2b')](_0x30a8bf[_0x1b12('0x25')],qs['fields'](_0x58fd0a[_0x1b12('0x28')][_0x1b12('0x2d')]));_0x5efd3d['attributes']=_0x5efd3d['attributes'][_0x1b12('0x2e')]?_0x5efd3d['attributes']:_0x30a8bf['model'];if(_0x58fd0a[_0x1b12('0x28')][_0x1b12('0x3a')]){_0x5efd3d[_0x1b12('0x3b')]=[{'all':!![]}];}_0x5efd3d=_['merge']({},_0x5efd3d,_0x58fd0a[_0x1b12('0x39')]);return db[_0x1b12('0x22')]['find'](_0x5efd3d)[_0x1b12('0x20')](handleEntityNotFound(_0x24f102,null))[_0x1b12('0x20')](respondWithResult(_0x24f102,null))[_0x1b12('0x3e')](handleError(_0x24f102,null));};exports['create']=function(_0x45d76f,_0x4ace43){return db[_0x1b12('0x22')][_0x1b12('0x41')](_0x45d76f[_0x1b12('0x42')],{})[_0x1b12('0x20')](respondWithResult(_0x4ace43,0xc9))[_0x1b12('0x3e')](handleError(_0x4ace43,null));};exports[_0x1b12('0x43')]=function(_0xfe226d,_0x15a3cc){if(_0xfe226d[_0x1b12('0x42')]['id']){delete _0xfe226d['body']['id'];}return db[_0x1b12('0x22')][_0x1b12('0x44')]({'where':{'id':_0xfe226d['params']['id']}})[_0x1b12('0x20')](handleEntityNotFound(_0x15a3cc,null))[_0x1b12('0x20')](saveUpdates(_0xfe226d[_0x1b12('0x42')],null))[_0x1b12('0x20')](respondWithResult(_0x15a3cc,null))[_0x1b12('0x3e')](handleError(_0x15a3cc,null));};exports[_0x1b12('0x45')]=function(_0x391560,_0x1783be){return db['VoiceRecording'][_0x1b12('0x45')]()['then'](respondWithResult(_0x1783be,null))[_0x1b12('0x3e')](handleError(_0x1783be,null));};exports[_0x1b12('0x46')]=function(_0x1d2795,_0x4ad284,_0x1ea3c4){var _0x483dce=require(_0x1b12('0x47'));var _0x4e5a2d=![];var _0x2e7a1a={};if(_0x1d2795[_0x1b12('0x28')]['type']&&_0x1d2795[_0x1b12('0x28')][_0x1b12('0x37')]==='uniqueid'){_0x2e7a1a['uniqueid']=_0x1d2795['params']['id'];}else{_0x2e7a1a['id']=_0x1d2795[_0x1b12('0x40')]['id'];}return db['VoiceRecording'][_0x1b12('0x44')]({'where':_0x2e7a1a,'attributes':['id',_0x1b12('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x4ad284,null))['then'](function(_0x2a0cff){if(_0x2a0cff){var _0xb7b4df=_0x2a0cff['value'];var _0x5977e9=util[_0x1b12('0x27')](_0x1b12('0x49'),_0xb7b4df);if(fs['existsSync'](_0x5977e9)){_0x4e5a2d=!![];return _0x483dce[_0x1b12('0x4a')](_0x5977e9,_0xb7b4df,config[_0x1b12('0x4b')][_0x1b12('0x4c')])['then'](function(){return _0x2a0cff;});}return _0x2a0cff;}})[_0x1b12('0x20')](function(_0x5eceb1){if(_0x5eceb1){var _0x5ea96b=_0x5eceb1[_0x1b12('0x48')];if(!fs['existsSync'](_0x5ea96b)){throw new db[(_0x1b12('0x4d'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x5eceb1[_0x1b12('0x4e')]){return _0x4ad284[_0x1b12('0x46')](_0x5ea96b,_0x5eceb1[_0x1b12('0x4e')]+path[_0x1b12('0x4f')](_0x5ea96b),function(){if(_0x4e5a2d){fs[_0x1b12('0x50')](_0x5ea96b);}});}else{return _0x4ad284[_0x1b12('0x46')](_0x5ea96b,function(_0x588855){if(_0x4e5a2d){fs['unlink'](_0x5ea96b);}});}}})[_0x1b12('0x3e')](function(_0x2f035b){if(_0x2f035b['message']===_0x1b12('0x51')){_0x4ad284[_0x1b12('0x17')](0x194)[_0x1b12('0x52')](_0x1b12('0x53'));}else{return handleError(_0x4ad284,null);}});};exports[_0x1b12('0x54')]=function(_0x32e300,_0x235ca8,_0x189228){var _0x1e09eb=require(_0x1b12('0x47'));var _0x5e109b=![];var _0x2ee7b6={'$and':[db[_0x1b12('0x55')]['where'](db[_0x1b12('0x55')]['fn'](_0x1b12('0x56'),db[_0x1b12('0x55')][_0x1b12('0x57')]('uniqueid')),_0x32e300[_0x1b12('0x28')][_0x1b12('0x58')])]};if(_0x32e300[_0x1b12('0x28')]['type']&&_0x32e300['query']['type']===_0x1b12('0x59')){_0x2ee7b6['$and'][_0x1b12('0x5a')]({'uniqueid':_0x32e300[_0x1b12('0x40')]['id']});}else{_0x2ee7b6['$and'][_0x1b12('0x5a')]({'id':_0x32e300['params']['id']});}return db[_0x1b12('0x22')][_0x1b12('0x44')]({'where':_0x2ee7b6,'attributes':['id','value'],'raw':!![]})[_0x1b12('0x20')](handleEntityNotFound(_0x235ca8,null))[_0x1b12('0x20')](function(_0x331d9b){if(_0x331d9b){var _0x44c64d=util[_0x1b12('0x27')](_0x1b12('0x49'),_0x331d9b[_0x1b12('0x48')]);if(fs['existsSync'](_0x44c64d)){_0x5e109b=!![];return _0x1e09eb[_0x1b12('0x4a')](_0x44c64d,_0x331d9b['value'],config[_0x1b12('0x4b')][_0x1b12('0x4c')])[_0x1b12('0x20')](function(){return _0x331d9b;});}return _0x331d9b;}})[_0x1b12('0x20')](function(_0x2765fa){if(_0x2765fa){if(!fs[_0x1b12('0x5b')](_0x2765fa[_0x1b12('0x48')])){throw new db[(_0x1b12('0x4d'))][(_0x1b12('0x5c'))](_0x1b12('0x51'));}if(_0x2765fa[_0x1b12('0x4e')]){return _0x235ca8['download'](_0x2765fa[_0x1b12('0x48')],_0x2765fa[_0x1b12('0x4e')]+path[_0x1b12('0x4f')](_0x2765fa['value']),function(){if(_0x5e109b){fs['unlink'](_0x2765fa['value']);}});}else{return _0x235ca8[_0x1b12('0x46')](_0x2765fa[_0x1b12('0x48')],function(_0x2a19f3){if(_0x5e109b){fs[_0x1b12('0x50')](_0x2765fa[_0x1b12('0x48')]);}});}}})[_0x1b12('0x3e')](handleError(_0x235ca8,null));};exports['destroy']=function(_0x1e42f1,_0x2ff519){return db[_0x1b12('0x22')]['find']({'where':{'id':_0x1e42f1[_0x1b12('0x40')]['id']}})[_0x1b12('0x20')](function(_0x57ec10){if(!_0x57ec10)throw new ReferenceError(_0x1b12('0x5d'));return _0x57ec10;})['then'](function(_0x42713c){var _0x4db1f4=_0x42713c[_0x1b12('0x48')];logger[_0x1b12('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x4db1f4);if(!_[_0x1b12('0x5f')](_0x42713c['value'])&&fs[_0x1b12('0x5b')](_0x4db1f4)){logger[_0x1b12('0x5e')](_0x1b12('0x60')+_0x4db1f4+_0x1b12('0x61'));fs[_0x1b12('0x62')](_0x4db1f4);}_0x4db1f4=_0x4db1f4+'.cypher';if(!_[_0x1b12('0x5f')](_0x42713c[_0x1b12('0x48')])&&fs[_0x1b12('0x5b')](_0x4db1f4)){logger['info'](_0x1b12('0x60')+_0x4db1f4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1b12('0x62')](_0x4db1f4);}return _0x42713c;})['then'](function(_0x4df541){if(!_0x4df541)throw new InternalError();return _0x4df541[_0x1b12('0x1f')]();})['then'](function(){_0x2ff519['status'](0xcc)[_0x1b12('0x18')]();})['catch'](handleError(_0x2ff519,null));};function getBucketslist(_0x354ae2,_0x216760,_0x5b21bf){return new Promise(function(_0x3e8eb8,_0x174339){var _0x5a5e6e=new AWS['S3']({'accessKeyId':_0x216760,'secretAccessKey':_0x354ae2,'region':_0x5b21bf});_0x5a5e6e[_0x1b12('0x63')]({},function(_0x3d83f0,_0x3007e4){if(_0x3d83f0){return _0x174339(_0x3d83f0);}else{return _0x3e8eb8(_0x3007e4);}});});}function createBucket(_0x4089eb,_0x36a8bb,_0x46c6ef,_0x5162b4){return new Promise(function(_0x323f85,_0x45e8c4){var _0x253122=new AWS['S3']({'accessKeyId':_0x36a8bb,'secretAccessKey':_0x4089eb,'region':_0x46c6ef});_0x253122[_0x1b12('0x64')]({'Bucket':_0x5162b4},function(_0x248443,_0x279ad5){if(_0x248443){return _0x45e8c4(_0x248443);}else{return _0x323f85(_0x279ad5);}});});}function uploadFile(_0x45eaa7,_0x2ca934,_0x4ba6dc,_0x35b057,_0xdebbb2,_0x5b62ad){return new Promise(function(_0x35b22e,_0x251eea){var _0x2c7f48=new AWS['S3']({'accessKeyId':_0x2ca934,'secretAccessKey':_0x45eaa7,'region':_0x4ba6dc});_0x2c7f48[_0x1b12('0x65')]({'Bucket':_0x35b057,'Key':_0xdebbb2,'Body':_0x5b62ad},function(_0x20a01a,_0xd4d053){if(_0x20a01a){return _0x251eea(_0x20a01a);}else{return _0x35b22e(_0xd4d053);}});});}function startTranscribe(_0x21e9ca,_0x41cc73,_0x585d49,_0x4c1f66,_0x452695,_0x1a5ead){return new Promise(function(_0x1d245d,_0x1306cb){var _0x284967=new AWS[(_0x1b12('0x66'))]({'accessKeyId':_0x41cc73,'secretAccessKey':_0x21e9ca,'region':_0x585d49});_0x284967[_0x1b12('0x67')]({'TranscriptionJobName':_0x4c1f66,'LanguageCode':_0x452695,'Media':{'MediaFileUri':_0x1a5ead}},function(_0x106f73,_0x1de7b7){if(_0x106f73){return _0x1306cb(_0x106f73);}else{return _0x1d245d(_0x1de7b7);}});});}function transcribe(_0x268003,_0xe5fe08,_0x3e1999,_0x1c09cf,_0x9f472f,_0x5635bc,_0x5a617e){return new Promise(function(_0x5c736e,_0x2d74e1){var _0x293042={};logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x68'),_0x268003,_0x9f472f));return uploadFile(_0xe5fe08,_0x3e1999,_0x1c09cf,_0x9f472f,path[_0x1b12('0x69')](_0x5635bc),fs[_0x1b12('0x6a')](_0x5635bc))[_0x1b12('0x20')](function(_0x5f974c){logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x6b'),_0x268003,_0x9f472f,_0x5f974c['Location']));_0x293042[_0x1b12('0x6c')]=_0x5f974c[_0x1b12('0x6d')];_0x293042[_0x1b12('0x6e')]=_0x5f974c[_0x1b12('0x6f')];logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x70'),_0x268003));return startTranscribe(_0xe5fe08,_0x3e1999,_0x1c09cf,uuidv4(),_0x5a617e,_0x5f974c[_0x1b12('0x6f')]);})[_0x1b12('0x20')](function(_0x257f3d){logger['info'](util[_0x1b12('0x27')](_0x1b12('0x71'),_0x268003,_0x257f3d['TranscriptionJob']['TranscriptionJobName']));_0x293042[_0x1b12('0x72')]=_0x257f3d['TranscriptionJob'][_0x1b12('0x73')];_0x293042[_0x1b12('0x74')]=_0x257f3d[_0x1b12('0x75')]['TranscriptionJobStatus'];return _0x5c736e(_0x293042);})[_0x1b12('0x3e')](function(_0x43678e){return _0x2d74e1(_0x43678e);});});}exports[_0x1b12('0x76')]=function(_0x4b99d8,_0x1c951f,_0x3a6ccb){var _0x28af43;var _0x52cce8;var _0x15e8d9;var _0x3b9679=require('../../components/encryptor');return db[_0x1b12('0x22')][_0x1b12('0x77')]({'where':{'id':_0x4b99d8[_0x1b12('0x40')]['id']}})[_0x1b12('0x20')](function(_0x3f0419){if(_0x3f0419){var _0x13fe99=util['format'](_0x1b12('0x49'),_0x3f0419[_0x1b12('0x48')]);if(fs[_0x1b12('0x5b')](_0x13fe99)){cypher=!![];return _0x3b9679[_0x1b12('0x4a')](_0x13fe99,_0x3f0419[_0x1b12('0x48')],config[_0x1b12('0x4b')][_0x1b12('0x4c')])[_0x1b12('0x20')](function(){return _0x3f0419;});}return _0x3f0419;}})[_0x1b12('0x20')](function(_0x7bcd20){if(!_0x7bcd20){throw new db[(_0x1b12('0x4d'))][(_0x1b12('0x5c'))]('Voice\x20Recording\x20not\x20found');}_0x52cce8=_0x7bcd20;return db['Setting'][_0x1b12('0x77')]({'where':{'id':0x1}});})[_0x1b12('0x20')](handleEntityNotFound(_0x1c951f,null))[_0x1b12('0x20')](function(_0x22b378){if(_0x22b378){_0x28af43=_0x22b378;if(!_0x28af43[_0x1b12('0x78')]||!_0x28af43['transcribeAccountId']||!_0x28af43[_0x1b12('0x79')]||!_0x28af43[_0x1b12('0x7a')]||!_0x28af43[_0x1b12('0x6c')]){throw new db[(_0x1b12('0x4d'))][(_0x1b12('0x5c'))]('Transcribe\x20not\x20configured');}if(_0x4b99d8['body']['runSentiment']&&(!_0x28af43[_0x1b12('0x7b')]||!_0x28af43[_0x1b12('0x7c')]||!_0x28af43[_0x1b12('0x7d')]||!_0x28af43['language']||!_0x28af43[_0x1b12('0x6c')])){throw new db[(_0x1b12('0x4d'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x1b12('0x7e')]['findOne']({'where':{'id':_0x28af43['transcribeAccountId']}});}})[_0x1b12('0x20')](function(_0x5d2b38){if(!_0x5d2b38){throw new db[(_0x1b12('0x4d'))]['ValidationError'](_0x1b12('0x7f'));}if(!_0x5d2b38['data1']||!_0x5d2b38[_0x1b12('0x80')]){throw new db[(_0x1b12('0x4d'))]['ValidationError'](_0x1b12('0x81'));}_0x15e8d9=_0x5d2b38;return getBucketslist(_0x15e8d9['data1'],_0x15e8d9['data2'],_0x28af43['transcribeRegion']);})['then'](function(_0x2182ce){if(_0x2182ce&&_0x2182ce['Buckets']){var _0x52608a=_[_0x1b12('0x44')](_0x2182ce[_0x1b12('0x82')],function(_0x3f0f23){return _0x3f0f23[_0x1b12('0x83')]===_0x28af43[_0x1b12('0x6c')];});if(!_0x52608a){logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x84'),_0x4b99d8[_0x1b12('0x40')]['id'],_0x28af43[_0x1b12('0x6c')]));return createBucket(_0x15e8d9[_0x1b12('0x85')],_0x15e8d9['data2'],_0x28af43['transcribeRegion'],_0x28af43[_0x1b12('0x6c')]);}logger['info'](util[_0x1b12('0x27')](_0x1b12('0x86'),_0x4b99d8[_0x1b12('0x40')]['id'],_0x28af43['bucket']));return;}})[_0x1b12('0x20')](function(_0x3e0165){if(_0x52cce8['transcribeStatus']===_0x1b12('0x87')){return transcribe(_0x4b99d8[_0x1b12('0x40')]['id'],_0x15e8d9[_0x1b12('0x85')],_0x15e8d9[_0x1b12('0x80')],_0x28af43['transcribeRegion'],_0x28af43['bucket'],_0x52cce8[_0x1b12('0x48')],_0x28af43[_0x1b12('0x7a')]);}else{logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x88'),_0x4b99d8[_0x1b12('0x40')]['id']));return{'transcribeStatus':_0x1b12('0x89')};}})[_0x1b12('0x20')](function(_0x5675a9){if(_0x5675a9){_0x5675a9[_0x1b12('0x8a')]=_0x4b99d8['body']['runSentiment'];return _0x52cce8['updateAttributes'](_0x5675a9);}})['then'](respondWithResult(_0x1c951f,null))[_0x1b12('0x3e')](handleError(_0x1c951f,null));};function writeFile(_0x409851,_0x49444a){return new Promise(function(_0x20341d,_0x33d9fa){fs[_0x1b12('0x8b')](_0x49444a,_0x409851,function(_0x31da22,_0x515f2b){if(_0x31da22){return _0x33d9fa(_0x31da22);}else{return _0x20341d(_0x515f2b);}});});}exports[_0x1b12('0x8c')]=function(_0x2afbd4,_0x2e67d2,_0x4ce96d){return db[_0x1b12('0x22')][_0x1b12('0x77')]({'where':{'id':_0x2afbd4['params']['id']}})[_0x1b12('0x20')](handleEntityNotFound(_0x2e67d2))[_0x1b12('0x20')](function(_0x293b1a){if(_0x293b1a&&_0x293b1a[_0x1b12('0x8d')]){var _0x152849=_0x293b1a['fileText'];var _0x27d189=config[_0x1b12('0x8e')]+_0x1b12('0x8f')+_0x293b1a['id']+_0x1b12('0x90');if(fs[_0x1b12('0x5b')](_0x27d189)){return _0x27d189;}return writeFile(_0x152849,_0x27d189)['then'](function(){return _0x27d189;});}else{throw new db['Sequelize'][(_0x1b12('0x5c'))](_0x1b12('0x91'));}})[_0x1b12('0x20')](function(_0x57fe5b){return _0x2e67d2['download'](_0x57fe5b);})[_0x1b12('0x3e')](handleError(_0x2e67d2));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 9d7fce6..3bb1b12 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 _0x078a=['rimraf','../../config/environment','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x078a,0x12d));var _0xa078=function(_0x58cf00,_0x4ac400){_0x58cf00=_0x58cf00-0x0;var _0x36dfbe=_0x078a[_0x58cf00];return _0x36dfbe;};'use strict';var _=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var logger=require(_0xa078('0x2'))(_0xa078('0x3'));var moment=require(_0xa078('0x4'));var BPromise=require(_0xa078('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa078('0x6'));var rimraf=require(_0xa078('0x7'));var config=require(_0xa078('0x8'));var attributes=require('./voiceRecording.attributes');module[_0xa078('0x9')]=function(_0x4a65f2,_0x453616){return _0x4a65f2[_0xa078('0xa')](_0xa078('0xb'),attributes,{'tableName':_0xa078('0xc'),'paranoid':![],'indexes':[{'name':_0xa078('0xd'),'fields':[_0xa078('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb2=['request-promise','rimraf','exports','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x2eb2,0x19f));var _0x22eb=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x2eb2[_0x40bffc];return _0x3007e9;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./voiceRecording.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[{'name':_0x22eb('0xb'),'fields':[_0x22eb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d27cbe7..6cfc731 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(_0x159f9b,_0x5b015c){var _0x5af408=function(_0x3d8a15){while(--_0x3d8a15){_0x159f9b['push'](_0x159f9b['shift']());}};_0x5af408(++_0x5b015c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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(_0x891b81,_0xfbb107){var _0x585932=function(_0x18e04d){while(--_0x18e04d){_0x891b81['push'](_0x891b81['shift']());}};_0x585932(++_0xfbb107);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 1b29861..cf0e562 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 _0x31f0=['../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0x31f0,0xb7));var _0x031f=function(_0x297ffb,_0x1d8003){_0x297ffb=_0x297ffb-0x0;var _0x2a7ee2=_0x31f0[_0x297ffb];return _0x2a7ee2;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0xa')]('/',auth[_0x031f('0xb')](),controller[_0x031f('0xc')]);router['put'](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file +var _0x1623=['../../components/interaction/service','get','index','isAuthenticated','show','post','create','put','/:id','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x46e235,_0xfa7407){var _0x157437=function(_0x56c4b0){while(--_0x56c4b0){_0x46e235['push'](_0x46e235['shift']());}};_0x157437(++_0xfa7407);}(_0x1623,0xab));var _0x3162=function(_0x3fadda,_0x5e2fd5){_0x3fadda=_0x3fadda-0x0;var _0x11217f=_0x1623[_0x3fadda];return _0x11217f;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var auth=require(_0x3162('0x4'));var interaction=require(_0x3162('0x5'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x3162('0x6')]('/',auth['isAuthenticated'](),controller[_0x3162('0x7')]);router[_0x3162('0x6')]('/:id',auth[_0x3162('0x8')](),controller[_0x3162('0x9')]);router[_0x3162('0xa')]('/',auth[_0x3162('0x8')](),controller[_0x3162('0xb')]);router[_0x3162('0xc')](_0x3162('0xd'),auth[_0x3162('0x8')](),controller['update']);router['delete'](_0x3162('0xd'),auth[_0x3162('0x8')](),controller[_0x3162('0xe')]);module[_0x3162('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index e49de9c..c50deb0 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 _0x9eaa=['blind','attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9eaa,0x13c));var _0xa9ea=function(_0x1aa474,_0x536aec){_0x1aa474=_0x1aa474-0x0;var _0x4a1191=_0x9eaa[_0x1aa474];return _0x4a1191;};'use strict';var Sequelize=require(_0xa9ea('0x0'));var moment=require(_0xa9ea('0x1'));module[_0xa9ea('0x2')]={'type':{'type':Sequelize[_0xa9ea('0x3')](_0xa9ea('0x4'),_0xa9ea('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xa9ea('0x6')]},'transferercalleridname':{'type':Sequelize[_0xa9ea('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xa9ea('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xa9ea('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xa9ea('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xa9ea('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xa9ea('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xa9ea('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa9ea('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xa9ea('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xa9ea('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xa9ea('0x6')]},'isexternal':{'type':Sequelize[_0xa9ea('0x3')](_0xa9ea('0x7'),'No')},'context':{'type':Sequelize[_0xa9ea('0x6')]},'extension':{'type':Sequelize[_0xa9ea('0x6')]}}; \ No newline at end of file +var _0x20e0=['STRING','Yes','sequelize','exports','ENUM','blind','attended'];(function(_0x397082,_0x26da28){var _0x7b1b02=function(_0x1dffb0){while(--_0x1dffb0){_0x397082['push'](_0x397082['shift']());}};_0x7b1b02(++_0x26da28);}(_0x20e0,0x128));var _0x020e=function(_0x4e19c8,_0x491ed4){_0x4e19c8=_0x4e19c8-0x0;var _0x1bc635=_0x20e0[_0x4e19c8];return _0x1bc635;};'use strict';var Sequelize=require(_0x020e('0x0'));var moment=require('moment');module[_0x020e('0x1')]={'type':{'type':Sequelize[_0x020e('0x2')](_0x020e('0x3'),_0x020e('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x020e('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x020e('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x020e('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x020e('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x020e('0x5')]},'transfereechannel':{'type':Sequelize[_0x020e('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x020e('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x020e('0x5')]},'transfereecontext':{'type':Sequelize[_0x020e('0x5')]},'transfereeexten':{'type':Sequelize[_0x020e('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x020e('0x5')]},'isexternal':{'type':Sequelize[_0x020e('0x2')](_0x020e('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x020e('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index aa92dec..a9d1496 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 _0x8b02=['mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','options','where','VoiceTransferReport','includeAll','include','findAll','rows','show','params','length','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8b02,0x89));var _0x28b0=function(_0x4efe04,_0x2dbc26){_0x4efe04=_0x4efe04-0x0;var _0x1004b2=_0x8b02[_0x4efe04];return _0x1004b2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x28b0('0x0'));var rimraf=require(_0x28b0('0x1'));var zipdir=require(_0x28b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28b0('0x3'));var moment=require(_0x28b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x28b0('0x5'));var util=require(_0x28b0('0x6'));var path=require('path');var sox=require(_0x28b0('0x7'));var csv=require('to-csv');var ejs=require(_0x28b0('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x28b0('0x9'));var crypto=require(_0x28b0('0xa'));var jsforce=require(_0x28b0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x28b0('0xc'));var querystring=require('querystring');var Papa=require(_0x28b0('0xd'));var Redis=require(_0x28b0('0xe'));var authService=require(_0x28b0('0xf'));var qs=require(_0x28b0('0x10'));var as=require(_0x28b0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x28b0('0x12'));var utils=require(_0x28b0('0x13'));var config=require('../../config/environment');var db=require(_0x28b0('0x14'))['db'];function respondWithStatusCode(_0x5380b6,_0x21c51b){_0x21c51b=_0x21c51b||0xcc;return function(_0x41289f){if(_0x41289f){return _0x5380b6['sendStatus'](_0x21c51b);}return _0x5380b6[_0x28b0('0x15')](_0x21c51b)[_0x28b0('0x16')]();};}function respondWithResult(_0x5c4772,_0x390484){_0x390484=_0x390484||0xc8;return function(_0x25f6cf){if(_0x25f6cf){return _0x5c4772[_0x28b0('0x15')](_0x390484)['json'](_0x25f6cf);}};}function respondWithFilteredResult(_0x13875d,_0x53c785){return function(_0x5a4247){if(_0x5a4247){var _0x1086c5=_0x5a4247[_0x28b0('0x17')],_0x2d19fa=_0x53c785[_0x28b0('0x18')],_0x22ce6e=_0x53c785[_0x28b0('0x18')]+_0x53c785[_0x28b0('0x19')],_0x814158;if(_0x22ce6e>=_0x1086c5){_0x22ce6e=_0x1086c5;_0x814158=0xc8;}else{_0x814158=0xce;}_0x13875d['status'](_0x814158);return _0x13875d[_0x28b0('0x1a')](_0x28b0('0x1b'),_0x2d19fa+'-'+_0x22ce6e+'/'+_0x1086c5)[_0x28b0('0x1c')](_0x5a4247);}return null;};}function patchUpdates(_0x17f0b4){return function(_0x35f718){try{jsonpatch[_0x28b0('0x1d')](_0x35f718,_0x17f0b4,!![]);}catch(_0x6564b2){return BPromise[_0x28b0('0x1e')](_0x6564b2);}return _0x35f718[_0x28b0('0x1f')]();};}function saveUpdates(_0xf21bc1,_0x263fc4){return function(_0x4b8e04){if(_0x4b8e04){return _0x4b8e04[_0x28b0('0x20')](_0xf21bc1)['then'](function(_0x1fea7c){return _0x1fea7c;});}return null;};}function removeEntity(_0x419885,_0x2b2d5f){return function(_0x155824){if(_0x155824){return _0x155824[_0x28b0('0x21')]()[_0x28b0('0x22')](function(){_0x419885[_0x28b0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24050c,_0x5b805a){return function(_0x187e8c){if(!_0x187e8c){_0x24050c[_0x28b0('0x23')](0x194);}return _0x187e8c;};}function handleError(_0x194c79,_0x23457d){_0x23457d=_0x23457d||0x1f4;return function(_0x199ef5){logger[_0x28b0('0x24')](_0x199ef5['stack']);if(_0x199ef5[_0x28b0('0x25')]){delete _0x199ef5[_0x28b0('0x25')];}_0x194c79[_0x28b0('0x15')](_0x23457d)[_0x28b0('0x26')](_0x199ef5);};}exports[_0x28b0('0x27')]=function(_0x1d5c64,_0x44f378){var _0x44a295={},_0x538d4f={},_0x212d3a={'count':0x0,'rows':[]};var _0x5d4f45=_[_0x28b0('0x28')](db['VoiceTransferReport'][_0x28b0('0x29')],function(_0x3f207e){return{'name':_0x3f207e[_0x28b0('0x2a')],'type':_0x3f207e[_0x28b0('0x2b')]['key']};});_0x538d4f[_0x28b0('0x2c')]=_['map'](_0x5d4f45,_0x28b0('0x25'));_0x538d4f[_0x28b0('0x2d')]=_[_0x28b0('0x2e')](_0x1d5c64['query']);_0x538d4f[_0x28b0('0x2f')]=_['intersection'](_0x538d4f[_0x28b0('0x2c')],_0x538d4f['query']);_0x44a295[_0x28b0('0x30')]=_[_0x28b0('0x31')](_0x538d4f[_0x28b0('0x2c')],qs[_0x28b0('0x32')](_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x32')]));_0x44a295[_0x28b0('0x30')]=_0x44a295[_0x28b0('0x30')]['length']?_0x44a295[_0x28b0('0x30')]:_0x538d4f[_0x28b0('0x2c')];if(!_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x33')](_0x28b0('0x34'))){_0x44a295['limit']=qs['limit'](_0x1d5c64['query']['limit']);_0x44a295['offset']=qs[_0x28b0('0x18')](_0x1d5c64[_0x28b0('0x2d')]['offset']);}_0x44a295['order']=qs[_0x28b0('0x35')](_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x35')]);_0x44a295['where']=qs['filters'](_[_0x28b0('0x36')](_0x1d5c64[_0x28b0('0x2d')],_0x538d4f[_0x28b0('0x2f')]),_0x5d4f45);if(_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x37')]){_0x44a295['where']=_[_0x28b0('0x38')](_0x44a295['where'],{'$or':_[_0x28b0('0x28')](_0x5d4f45,function(_0x1f25c9){if(_0x1f25c9['type']!=='VIRTUAL'){var _0x344a21={};_0x344a21[_0x1f25c9['name']]={'$like':'%'+_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x37')]+'%'};return _0x344a21;}})});}_0x44a295=_[_0x28b0('0x38')]({},_0x44a295,_0x1d5c64[_0x28b0('0x39')]);var _0x1e97af={'where':_0x44a295[_0x28b0('0x3a')]};return db[_0x28b0('0x3b')]['count'](_0x1e97af)[_0x28b0('0x22')](function(_0x7a41e1){_0x212d3a[_0x28b0('0x17')]=_0x7a41e1;if(_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x3c')]){_0x44a295[_0x28b0('0x3d')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x28b0('0x3e')](_0x44a295);})[_0x28b0('0x22')](function(_0xf9bff7){_0x212d3a[_0x28b0('0x3f')]=_0xf9bff7;return _0x212d3a;})[_0x28b0('0x22')](respondWithFilteredResult(_0x44f378,_0x44a295))['catch'](handleError(_0x44f378,null));};exports[_0x28b0('0x40')]=function(_0x5d400b,_0x2bf1c5){var _0x10b58f={'raw':!![],'where':{'id':_0x5d400b[_0x28b0('0x41')]['id']}},_0x143d29={};_0x143d29[_0x28b0('0x2c')]=_['keys'](db['VoiceTransferReport'][_0x28b0('0x29')]);_0x143d29[_0x28b0('0x2d')]=_[_0x28b0('0x2e')](_0x5d400b['query']);_0x143d29['filters']=_['intersection'](_0x143d29['model'],_0x143d29[_0x28b0('0x2d')]);_0x10b58f[_0x28b0('0x30')]=_[_0x28b0('0x31')](_0x143d29[_0x28b0('0x2c')],qs[_0x28b0('0x32')](_0x5d400b[_0x28b0('0x2d')][_0x28b0('0x32')]));_0x10b58f[_0x28b0('0x30')]=_0x10b58f[_0x28b0('0x30')][_0x28b0('0x42')]?_0x10b58f['attributes']:_0x143d29[_0x28b0('0x2c')];if(_0x5d400b['query'][_0x28b0('0x3c')]){_0x10b58f[_0x28b0('0x3d')]=[{'all':!![]}];}_0x10b58f=_[_0x28b0('0x38')]({},_0x10b58f,_0x5d400b[_0x28b0('0x39')]);return db[_0x28b0('0x3b')]['find'](_0x10b58f)[_0x28b0('0x22')](handleEntityNotFound(_0x2bf1c5,null))[_0x28b0('0x22')](respondWithResult(_0x2bf1c5,null))['catch'](handleError(_0x2bf1c5,null));};exports[_0x28b0('0x43')]=function(_0x170bae,_0x675495){return db[_0x28b0('0x3b')]['create'](_0x170bae[_0x28b0('0x44')],{})[_0x28b0('0x22')](respondWithResult(_0x675495,0xc9))[_0x28b0('0x45')](handleError(_0x675495,null));};exports[_0x28b0('0x20')]=function(_0xc2d793,_0x4bfc5b){if(_0xc2d793[_0x28b0('0x44')]['id']){delete _0xc2d793[_0x28b0('0x44')]['id'];}return db['VoiceTransferReport'][_0x28b0('0x46')]({'where':{'id':_0xc2d793[_0x28b0('0x41')]['id']}})[_0x28b0('0x22')](handleEntityNotFound(_0x4bfc5b,null))[_0x28b0('0x22')](saveUpdates(_0xc2d793[_0x28b0('0x44')],null))[_0x28b0('0x22')](respondWithResult(_0x4bfc5b,null))['catch'](handleError(_0x4bfc5b,null));};exports['destroy']=function(_0xf068aa,_0x2df73f){return db['VoiceTransferReport'][_0x28b0('0x46')]({'where':{'id':_0xf068aa[_0x28b0('0x41')]['id']}})[_0x28b0('0x22')](handleEntityNotFound(_0x2df73f,null))['then'](removeEntity(_0x2df73f,null))[_0x28b0('0x45')](handleError(_0x2df73f,null));}; \ No newline at end of file +var _0xd6a2=['length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','includeAll','catch','create','body','find','destroy','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x457e92,_0x3b624b){var _0x4fc1b8=function(_0x35d064){while(--_0x35d064){_0x457e92['push'](_0x457e92['shift']());}};_0x4fc1b8(++_0x3b624b);}(_0xd6a2,0xad));var _0x2d6a=function(_0x3fb026,_0x20bdd9){_0x3fb026=_0x3fb026-0x0;var _0x5d019a=_0xd6a2[_0x3fb026];return _0x5d019a;};'use strict';var pdf=require(_0x2d6a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2d6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6a('0x2'));var rp=require(_0x2d6a('0x3'));var moment=require(_0x2d6a('0x4'));var BPromise=require(_0x2d6a('0x5'));var Mustache=require(_0x2d6a('0x6'));var util=require(_0x2d6a('0x7'));var path=require(_0x2d6a('0x8'));var sox=require(_0x2d6a('0x9'));var csv=require('to-csv');var ejs=require(_0x2d6a('0xa'));var fs=require('fs');var _=require(_0x2d6a('0xb'));var squel=require('squel');var crypto=require(_0x2d6a('0xc'));var jsforce=require(_0x2d6a('0xd'));var deskjs=require(_0x2d6a('0xe'));var toCsv=require(_0x2d6a('0xf'));var querystring=require(_0x2d6a('0x10'));var Papa=require('papaparse');var Redis=require(_0x2d6a('0x11'));var authService=require(_0x2d6a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2d6a('0x13'));var hardwareService=require(_0x2d6a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2d6a('0x15'));var config=require(_0x2d6a('0x16'));var db=require(_0x2d6a('0x17'))['db'];function respondWithStatusCode(_0x4cce60,_0x21e88d){_0x21e88d=_0x21e88d||0xcc;return function(_0x33dcec){if(_0x33dcec){return _0x4cce60['sendStatus'](_0x21e88d);}return _0x4cce60[_0x2d6a('0x18')](_0x21e88d)[_0x2d6a('0x19')]();};}function respondWithResult(_0x198d25,_0x22f520){_0x22f520=_0x22f520||0xc8;return function(_0x1fa72d){if(_0x1fa72d){return _0x198d25[_0x2d6a('0x18')](_0x22f520)[_0x2d6a('0x1a')](_0x1fa72d);}};}function respondWithFilteredResult(_0x5be0ad,_0x14f273){return function(_0x4a2ce2){if(_0x4a2ce2){var _0x23fe29=_0x4a2ce2[_0x2d6a('0x1b')],_0x3d081b=_0x14f273[_0x2d6a('0x1c')],_0x1c8873=_0x14f273[_0x2d6a('0x1c')]+_0x14f273['limit'],_0x3999a3;if(_0x1c8873>=_0x23fe29){_0x1c8873=_0x23fe29;_0x3999a3=0xc8;}else{_0x3999a3=0xce;}_0x5be0ad[_0x2d6a('0x18')](_0x3999a3);return _0x5be0ad[_0x2d6a('0x1d')](_0x2d6a('0x1e'),_0x3d081b+'-'+_0x1c8873+'/'+_0x23fe29)[_0x2d6a('0x1a')](_0x4a2ce2);}return null;};}function patchUpdates(_0x305b1f){return function(_0x4c0bea){try{jsonpatch[_0x2d6a('0x1f')](_0x4c0bea,_0x305b1f,!![]);}catch(_0x282f9f){return BPromise[_0x2d6a('0x20')](_0x282f9f);}return _0x4c0bea[_0x2d6a('0x21')]();};}function saveUpdates(_0x17e354,_0x4456c0){return function(_0x40375e){if(_0x40375e){return _0x40375e[_0x2d6a('0x22')](_0x17e354)['then'](function(_0x281e48){return _0x281e48;});}return null;};}function removeEntity(_0x1ceb9e,_0x558bab){return function(_0x110960){if(_0x110960){return _0x110960['destroy']()[_0x2d6a('0x23')](function(){_0x1ceb9e[_0x2d6a('0x18')](0xcc)[_0x2d6a('0x19')]();});}};}function handleEntityNotFound(_0x3e1cb4,_0x542e6e){return function(_0x45da30){if(!_0x45da30){_0x3e1cb4['sendStatus'](0x194);}return _0x45da30;};}function handleError(_0x4348c3,_0x3bc9a9){_0x3bc9a9=_0x3bc9a9||0x1f4;return function(_0x1bd62e){logger[_0x2d6a('0x24')](_0x1bd62e[_0x2d6a('0x25')]);if(_0x1bd62e['name']){delete _0x1bd62e[_0x2d6a('0x26')];}_0x4348c3[_0x2d6a('0x18')](_0x3bc9a9)['send'](_0x1bd62e);};}exports[_0x2d6a('0x27')]=function(_0x1aeb62,_0x160865){var _0x224379={},_0x46dab4={},_0x34dcde={'count':0x0,'rows':[]};var _0x2512cb=_[_0x2d6a('0x28')](db[_0x2d6a('0x29')][_0x2d6a('0x2a')],function(_0x126c0c){return{'name':_0x126c0c[_0x2d6a('0x2b')],'type':_0x126c0c[_0x2d6a('0x2c')][_0x2d6a('0x2d')]};});_0x46dab4[_0x2d6a('0x2e')]=_[_0x2d6a('0x28')](_0x2512cb,'name');_0x46dab4[_0x2d6a('0x2f')]=_[_0x2d6a('0x30')](_0x1aeb62['query']);_0x46dab4['filters']=_[_0x2d6a('0x31')](_0x46dab4[_0x2d6a('0x2e')],_0x46dab4[_0x2d6a('0x2f')]);_0x224379[_0x2d6a('0x32')]=_[_0x2d6a('0x31')](_0x46dab4[_0x2d6a('0x2e')],qs[_0x2d6a('0x33')](_0x1aeb62['query'][_0x2d6a('0x33')]));_0x224379[_0x2d6a('0x32')]=_0x224379[_0x2d6a('0x32')][_0x2d6a('0x34')]?_0x224379[_0x2d6a('0x32')]:_0x46dab4[_0x2d6a('0x2e')];if(!_0x1aeb62['query'][_0x2d6a('0x35')](_0x2d6a('0x36'))){_0x224379[_0x2d6a('0x37')]=qs[_0x2d6a('0x37')](_0x1aeb62[_0x2d6a('0x2f')][_0x2d6a('0x37')]);_0x224379[_0x2d6a('0x1c')]=qs['offset'](_0x1aeb62['query'][_0x2d6a('0x1c')]);}_0x224379[_0x2d6a('0x38')]=qs[_0x2d6a('0x39')](_0x1aeb62['query'][_0x2d6a('0x39')]);_0x224379['where']=qs[_0x2d6a('0x3a')](_['pick'](_0x1aeb62[_0x2d6a('0x2f')],_0x46dab4[_0x2d6a('0x3a')]),_0x2512cb);if(_0x1aeb62[_0x2d6a('0x2f')][_0x2d6a('0x3b')]){_0x224379[_0x2d6a('0x3c')]=_['merge'](_0x224379['where'],{'$or':_[_0x2d6a('0x28')](_0x2512cb,function(_0xd85ce8){if(_0xd85ce8['type']!==_0x2d6a('0x3d')){var _0x53363b={};_0x53363b[_0xd85ce8[_0x2d6a('0x26')]]={'$like':'%'+_0x1aeb62[_0x2d6a('0x2f')][_0x2d6a('0x3b')]+'%'};return _0x53363b;}})});}_0x224379=_[_0x2d6a('0x3e')]({},_0x224379,_0x1aeb62[_0x2d6a('0x3f')]);var _0x1977f6={'where':_0x224379['where']};return db[_0x2d6a('0x29')][_0x2d6a('0x1b')](_0x1977f6)[_0x2d6a('0x23')](function(_0x120351){_0x34dcde[_0x2d6a('0x1b')]=_0x120351;if(_0x1aeb62[_0x2d6a('0x2f')]['includeAll']){_0x224379[_0x2d6a('0x40')]=[{'all':!![]}];}return db[_0x2d6a('0x29')][_0x2d6a('0x41')](_0x224379);})[_0x2d6a('0x23')](function(_0x38f4ba){_0x34dcde[_0x2d6a('0x42')]=_0x38f4ba;return _0x34dcde;})[_0x2d6a('0x23')](respondWithFilteredResult(_0x160865,_0x224379))['catch'](handleError(_0x160865,null));};exports[_0x2d6a('0x43')]=function(_0x147cd6,_0x4b1361){var _0x7a1d92={'raw':!![],'where':{'id':_0x147cd6['params']['id']}},_0x10d2a2={};_0x10d2a2[_0x2d6a('0x2e')]=_[_0x2d6a('0x30')](db[_0x2d6a('0x29')]['rawAttributes']);_0x10d2a2[_0x2d6a('0x2f')]=_['keys'](_0x147cd6[_0x2d6a('0x2f')]);_0x10d2a2[_0x2d6a('0x3a')]=_['intersection'](_0x10d2a2[_0x2d6a('0x2e')],_0x10d2a2[_0x2d6a('0x2f')]);_0x7a1d92[_0x2d6a('0x32')]=_[_0x2d6a('0x31')](_0x10d2a2[_0x2d6a('0x2e')],qs['fields'](_0x147cd6[_0x2d6a('0x2f')]['fields']));_0x7a1d92[_0x2d6a('0x32')]=_0x7a1d92['attributes'][_0x2d6a('0x34')]?_0x7a1d92[_0x2d6a('0x32')]:_0x10d2a2[_0x2d6a('0x2e')];if(_0x147cd6[_0x2d6a('0x2f')][_0x2d6a('0x44')]){_0x7a1d92[_0x2d6a('0x40')]=[{'all':!![]}];}_0x7a1d92=_[_0x2d6a('0x3e')]({},_0x7a1d92,_0x147cd6[_0x2d6a('0x3f')]);return db[_0x2d6a('0x29')]['find'](_0x7a1d92)['then'](handleEntityNotFound(_0x4b1361,null))['then'](respondWithResult(_0x4b1361,null))[_0x2d6a('0x45')](handleError(_0x4b1361,null));};exports[_0x2d6a('0x46')]=function(_0x33e04c,_0x306a1e){return db['VoiceTransferReport'][_0x2d6a('0x46')](_0x33e04c['body'],{})['then'](respondWithResult(_0x306a1e,0xc9))['catch'](handleError(_0x306a1e,null));};exports[_0x2d6a('0x22')]=function(_0x4ba698,_0x531043){if(_0x4ba698[_0x2d6a('0x47')]['id']){delete _0x4ba698[_0x2d6a('0x47')]['id'];}return db[_0x2d6a('0x29')][_0x2d6a('0x48')]({'where':{'id':_0x4ba698['params']['id']}})[_0x2d6a('0x23')](handleEntityNotFound(_0x531043,null))[_0x2d6a('0x23')](saveUpdates(_0x4ba698['body'],null))['then'](respondWithResult(_0x531043,null))[_0x2d6a('0x45')](handleError(_0x531043,null));};exports[_0x2d6a('0x49')]=function(_0x18f8e2,_0x1d6622){return db[_0x2d6a('0x29')][_0x2d6a('0x48')]({'where':{'id':_0x18f8e2[_0x2d6a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d6622,null))[_0x2d6a('0x23')](removeEntity(_0x1d6622,null))['catch'](handleError(_0x1d6622,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6eb7032..eb886a9 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 _0x5420=['util','api','moment','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','lodash'];(function(_0x56aa78,_0x1bc1dc){var _0x49bc2d=function(_0x11ab5b){while(--_0x11ab5b){_0x56aa78['push'](_0x56aa78['shift']());}};_0x49bc2d(++_0x1bc1dc);}(_0x5420,0x121));var _0x0542=function(_0x107a2a,_0x10f962){_0x107a2a=_0x107a2a-0x0;var _0xd2732a=_0x5420[_0x107a2a];return _0xd2732a;};'use strict';var _=require(_0x0542('0x0'));var util=require(_0x0542('0x1'));var logger=require('../../config/logger')(_0x0542('0x2'));var moment=require(_0x0542('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0542('0x4'));var rimraf=require(_0x0542('0x5'));var config=require(_0x0542('0x6'));var attributes=require(_0x0542('0x7'));module['exports']=function(_0x24b416,_0xb30d00){return _0x24b416[_0x0542('0x8')](_0x0542('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e60=['bluebird','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','moment'];(function(_0x3c14ec,_0xa850e9){var _0x12a2ff=function(_0x387165){while(--_0x387165){_0x3c14ec['push'](_0x3c14ec['shift']());}};_0x12a2ff(++_0xa850e9);}(_0x9e60,0x1dc));var _0x09e6=function(_0x4b64b1,_0x48e6ab){_0x4b64b1=_0x4b64b1-0x0;var _0x407a2f=_0x9e60[_0x4b64b1];return _0x407a2f;};'use strict';var _=require(_0x09e6('0x0'));var util=require(_0x09e6('0x1'));var logger=require(_0x09e6('0x2'))('api');var moment=require(_0x09e6('0x3'));var BPromise=require(_0x09e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09e6('0x5'));var rimraf=require('rimraf');var config=require(_0x09e6('0x6'));var attributes=require(_0x09e6('0x7'));module[_0x09e6('0x8')]=function(_0x4acd8f,_0x14f2d0){return _0x4acd8f[_0x09e6('0x9')](_0x09e6('0xa'),attributes,{'tableName':_0x09e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index f28cdd4..03fd8b8 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 _0xfbd7=['error','code','message','CreateVoiceTransferReport','VoiceTransferReport','create','raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e1f53,_0xa76472){var _0x2bfbd6=function(_0x461e63){while(--_0x461e63){_0x2e1f53['push'](_0x2e1f53['shift']());}};_0x2bfbd6(++_0xa76472);}(_0xfbd7,0x1cc));var _0x7fbd=function(_0x520236,_0x5c8564){_0x520236=_0x520236-0x0;var _0x4d6664=_0xfbd7[_0x520236];return _0x4d6664;};'use strict';var _=require(_0x7fbd('0x0'));var util=require(_0x7fbd('0x1'));var moment=require(_0x7fbd('0x2'));var BPromise=require(_0x7fbd('0x3'));var rs=require(_0x7fbd('0x4'));var fs=require('fs');var Redis=require(_0x7fbd('0x5'));var db=require(_0x7fbd('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7fbd('0x7'));var config=require('../../config/environment');var jayson=require(_0x7fbd('0x8'));var client=jayson['client'][_0x7fbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x404588,_0x3c8317,_0x423e73){return new BPromise(function(_0x2d1d02,_0x2b3b58){return client['request'](_0x404588,_0x423e73)['then'](function(_0x314c1a){logger[_0x7fbd('0xa')](_0x7fbd('0xb'),_0x3c8317,_0x7fbd('0xc'));logger['debug'](_0x7fbd('0xd'),_0x3c8317,_0x7fbd('0xc'),JSON[_0x7fbd('0xe')](_0x314c1a));if(_0x314c1a['error']){if(_0x314c1a[_0x7fbd('0xf')][_0x7fbd('0x10')]===0x1f4){logger[_0x7fbd('0xf')](_0x7fbd('0xb'),_0x3c8317,_0x314c1a[_0x7fbd('0xf')][_0x7fbd('0x11')]);return _0x2b3b58(_0x314c1a[_0x7fbd('0xf')]['message']);}logger['error'](_0x7fbd('0xb'),_0x3c8317,_0x314c1a[_0x7fbd('0xf')]['message']);return _0x2d1d02(_0x314c1a[_0x7fbd('0xf')][_0x7fbd('0x11')]);}else{logger[_0x7fbd('0xa')](_0x7fbd('0xb'),_0x3c8317,_0x7fbd('0xc'));_0x2d1d02(_0x314c1a['result'][_0x7fbd('0x11')]);}})['catch'](function(_0x200a73){logger[_0x7fbd('0xf')](_0x7fbd('0xb'),_0x3c8317,_0x200a73);_0x2b3b58(_0x200a73);});});}exports[_0x7fbd('0x12')]=function(_0x58281f){var _0x265ebc=this;return new Promise(function(_0x3aee61,_0x5ece44){return db[_0x7fbd('0x13')][_0x7fbd('0x14')](_0x58281f['body'],{'raw':_0x58281f['options']?_0x58281f['options'][_0x7fbd('0x15')]===undefined?!![]:![]:!![]})[_0x7fbd('0x16')](function(_0x2b15f6){logger[_0x7fbd('0xa')]('CreateVoiceTransferReport',_0x58281f);logger[_0x7fbd('0x17')](_0x7fbd('0x12'),_0x58281f,JSON['stringify'](_0x2b15f6));_0x3aee61(_0x2b15f6);})[_0x7fbd('0x18')](function(_0x2489df){logger[_0x7fbd('0xf')](_0x7fbd('0x12'),_0x2489df['message'],_0x58281f);_0x5ece44(_0x265ebc['error'](0x1f4,_0x2489df[_0x7fbd('0x11')]));});});}; \ No newline at end of file +var _0xd12e=['rpc','../../config/environment','jayson/promise','client','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','VoiceTransferReport,\x20%s,\x20%s','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x451901,_0x22758d){var _0x58d959=function(_0x5eb22a){while(--_0x5eb22a){_0x451901['push'](_0x451901['shift']());}};_0x58d959(++_0x22758d);}(_0xd12e,0x1b8));var _0xed12=function(_0x3fd500,_0x47f5ef){_0x3fd500=_0x3fd500-0x0;var _0xe9d738=_0xd12e[_0x3fd500];return _0xe9d738;};'use strict';var _=require('lodash');var util=require(_0xed12('0x0'));var moment=require(_0xed12('0x1'));var BPromise=require(_0xed12('0x2'));var rs=require(_0xed12('0x3'));var fs=require('fs');var Redis=require(_0xed12('0x4'));var db=require(_0xed12('0x5'))['db'];var utils=require(_0xed12('0x6'));var logger=require(_0xed12('0x7'))(_0xed12('0x8'));var config=require(_0xed12('0x9'));var jayson=require(_0xed12('0xa'));var client=jayson[_0xed12('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x566cea,_0xc1e80b,_0x59a934){return new BPromise(function(_0x5ee693,_0x10f602){return client['request'](_0x566cea,_0x59a934)['then'](function(_0x58b944){logger[_0xed12('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0xc1e80b,_0xed12('0xd'));logger['debug'](_0xed12('0xe'),_0xc1e80b,'request\x20sent',JSON['stringify'](_0x58b944));if(_0x58b944[_0xed12('0xf')]){if(_0x58b944[_0xed12('0xf')]['code']===0x1f4){logger[_0xed12('0xf')](_0xed12('0x10'),_0xc1e80b,_0x58b944[_0xed12('0xf')][_0xed12('0x11')]);return _0x10f602(_0x58b944[_0xed12('0xf')][_0xed12('0x11')]);}logger[_0xed12('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xc1e80b,_0x58b944[_0xed12('0xf')][_0xed12('0x11')]);return _0x5ee693(_0x58b944['error'][_0xed12('0x11')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0xc1e80b,_0xed12('0xd'));_0x5ee693(_0x58b944['result'][_0xed12('0x11')]);}})[_0xed12('0x12')](function(_0x1b343e){logger['error'](_0xed12('0x10'),_0xc1e80b,_0x1b343e);_0x10f602(_0x1b343e);});});}exports[_0xed12('0x13')]=function(_0x4eaea7){var _0x30092d=this;return new Promise(function(_0x43f764,_0x19fc27){return db[_0xed12('0x14')][_0xed12('0x15')](_0x4eaea7[_0xed12('0x16')],{'raw':_0x4eaea7[_0xed12('0x17')]?_0x4eaea7['options'][_0xed12('0x18')]===undefined?!![]:![]:!![]})[_0xed12('0x19')](function(_0x2a9e28){logger[_0xed12('0xc')](_0xed12('0x13'),_0x4eaea7);logger[_0xed12('0x1a')](_0xed12('0x13'),_0x4eaea7,JSON[_0xed12('0x1b')](_0x2a9e28));_0x43f764(_0x2a9e28);})[_0xed12('0x12')](function(_0x51c65d){logger[_0xed12('0xf')](_0xed12('0x13'),_0x51c65d[_0xed12('0x11')],_0x4eaea7);_0x19fc27(_0x30092d[_0xed12('0xf')](0x1f4,_0x51c65d['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index bbf6b2c..3cfdefb 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 _0x295f=['../../components/auth/service','./webbar.controller','/originate','isAuthenticated','post','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','unhold','calls','/transfer','transfer','exports','Router'];(function(_0x30537e,_0x458a27){var _0x12423b=function(_0x2e0a69){while(--_0x2e0a69){_0x30537e['push'](_0x30537e['shift']());}};_0x12423b(++_0x458a27);}(_0x295f,0x168));var _0xf295=function(_0x59b059,_0x1526ea){_0x59b059=_0x59b059-0x0;var _0x5c5028=_0x295f[_0x59b059];return _0x5c5028;};'use strict';var express=require('express');var router=express[_0xf295('0x0')]();var auth=require(_0xf295('0x1'));var controller=require(_0xf295('0x2'));router['post'](_0xf295('0x3'),auth[_0xf295('0x4')](),auth['canUpdate'](),controller['originate']);router[_0xf295('0x5')](_0xf295('0x6'),auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0x8')]);router['post'](_0xf295('0x9'),auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0xa')]);router[_0xf295('0x5')](_0xf295('0xb'),auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0xc')]);router[_0xf295('0x5')](_0xf295('0xd'),auth[_0xf295('0x4')](),auth['canUpdate'](),controller[_0xf295('0xe')]);router[_0xf295('0x5')]('/calls',auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0xf')]);router[_0xf295('0x5')](_0xf295('0x10'),auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0x11')]);module[_0xf295('0x12')]=router; \ No newline at end of file +var _0xd0d5=['/transfer','transfer','exports','/originate','isAuthenticated','canUpdate','/hangup','hangup','/answer','answer','post','hold','/unhold','unhold'];(function(_0x4ce080,_0x4a7661){var _0x2269c1=function(_0xd1b86d){while(--_0xd1b86d){_0x4ce080['push'](_0x4ce080['shift']());}};_0x2269c1(++_0x4a7661);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x14c4bd,_0x135cdb){_0x14c4bd=_0x14c4bd-0x0;var _0x34e78e=_0xd0d5[_0x14c4bd];return _0x34e78e;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0x5d0d('0x0'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller['originate']);router['post'](_0x5d0d('0x3'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller[_0x5d0d('0x4')]);router['post'](_0x5d0d('0x5'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller[_0x5d0d('0x6')]);router[_0x5d0d('0x7')]('/hold',auth[_0x5d0d('0x1')](),auth['canUpdate'](),controller[_0x5d0d('0x8')]);router[_0x5d0d('0x7')](_0x5d0d('0x9'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller[_0x5d0d('0xa')]);router[_0x5d0d('0x7')]('/calls',auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller['calls']);router['post'](_0x5d0d('0xb'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller[_0x5d0d('0xc')]);module[_0x5d0d('0xd')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index e6c0927..f6c4ca9 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 _0xd33b=['userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','length','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','client','http','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','stack','name','status','send','NotFound','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId\x20','originate','body','json'];(function(_0x5a3c43,_0x4a4ba0){var _0x4304ef=function(_0x4bf707){while(--_0x4bf707){_0x5a3c43['push'](_0x5a3c43['shift']());}};_0x4304ef(++_0x4a4ba0);}(_0xd33b,0x1af));var _0xbd33=function(_0x11d011,_0x1e2f64){_0x11d011=_0x11d011-0x0;var _0x490ab0=_0xd33b[_0x11d011];return _0x490ab0;};'use strict';var path=require(_0xbd33('0x0'));var fs=require('fs');var _=require(_0xbd33('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xbd33('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0xbd33('0x3')][_0xbd33('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xbd33('0x5'));var Redis=require(_0xbd33('0x6'));config[_0xbd33('0x7')]=_[_0xbd33('0x8')](config['redis'],{'host':_0xbd33('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd33('0x7')]));var Schema=require(_0xbd33('0xa'));var originateValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'callNumber':{'type':_0xbd33('0xd'),'required':[!![],_0xbd33('0xe')]},'callerId':{'type':_0xbd33('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':_0xbd33('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbd33('0xc')]},'sessionId':{'type':_0xbd33('0xd'),'required':[!![],_0xbd33('0xf')]},'transferNumber':{'type':_0xbd33('0xd'),'required':[!![],_0xbd33('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':_0xbd33('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x3f5964,_0x322341,_0x4ba160){logger[_0xbd33('0x11')](_0x3f5964,_0x322341,JSON[_0xbd33('0x12')](_0x4ba160));io['to'](_0x3f5964)['emit'](_0x322341,_0x4ba160);}function handleError(_0x13bcda){return function(_0x381a36){console[_0xbd33('0x13')](_0xbd33('0x14'),_0x381a36,_0x381a36 instanceof RangeError);logger['error'](_0x381a36[_0xbd33('0x15')]);if(_0x381a36 instanceof RangeError){if(_0x381a36[_0xbd33('0x16')]){delete _0x381a36[_0xbd33('0x16')];}_0x13bcda[_0xbd33('0x17')](0x194)[_0xbd33('0x18')](_0x381a36);}else{if(_0x381a36[_0xbd33('0x16')]){delete _0x381a36['name'];}_0x13bcda['status'](0x1f4)['send'](_0x381a36);}};}function checkError(){return function(_0x311c5b){if(!_0x311c5b){throw new RangeError(_0xbd33('0x19'));}return _0x311c5b;};}function respondWithRpcPromise(_0x500c80,_0x4a3be2){return new BPromise(function(_0x4d021a,_0x48f4af){var _0x9c2f99=amiClient;return _0x9c2f99['request'](_0x500c80,_0x4a3be2)[_0xbd33('0x1a')](function(_0x1a0dcd){if(_0x1a0dcd[_0xbd33('0x1b')]){if(_0x1a0dcd[_0xbd33('0x1b')][_0xbd33('0x1c')]===0x1f4){return _0x48f4af(_0x1a0dcd['error']['message']);}return _0x4d021a(_0x1a0dcd[_0xbd33('0x1b')][_0xbd33('0x1d')]);}else{_0x4d021a(_0x1a0dcd[_0xbd33('0x1e')]);}})[_0xbd33('0x1f')](function(_0x1be515){_0x48f4af(_0x1be515);});});}function getAgent(_0x463f36){return db[_0xbd33('0x20')][_0xbd33('0x21')]({'where':{'id':_0x463f36,'role':_0xbd33('0x22')}})[_0xbd33('0x1a')](checkError());}function getAgentCheckSession(_0x5a3e37,_0x5d51ab){return new BPromise(function(_0x4f4b63,_0x3f2c91){var _0x1d43bd=respondWithRpcPromise(_0xbd33('0x23'));var _0x22a9c9=getAgent(_0x5a3e37);Promise[_0xbd33('0x24')]([_0x1d43bd,_0x22a9c9])[_0xbd33('0x1a')](function(_0x47ce9f){var _0x30848c=_0x47ce9f[0x0];var _0x3806c3=_0x47ce9f[0x1];var _0x2cb9df=_[_0xbd33('0x25')](_0x30848c[_0xbd33('0x26')],function(_0x29204f){return _0x29204f['UserId']==_0x3806c3['id']&&_0x29204f['sessionId']==_0x5d51ab;});if(_0x2cb9df['length']==0x1){_0x4f4b63(_0x3806c3);}else{_0x3f2c91(new RangeError(_0xbd33('0x27')+_0x5d51ab+'\x20not\x20found!'));}});});}exports[_0xbd33('0x28')]=function(_0x1f82b4,_0x22c33f){logger[_0xbd33('0x11')]('originate\x20fired:',_0x1f82b4[_0xbd33('0x29')]);var _0x1d007e=originateValidation['validate'](_0x1f82b4[_0xbd33('0x29')]);if(_0x1d007e['length']>0x0){return _0x22c33f[_0xbd33('0x17')](0x190)[_0xbd33('0x2a')](_0x1d007e);}var _0x1b501b=_0x1f82b4[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x4bc639=_0x1f82b4[_0xbd33('0x29')]['callNumber'];var _0x2ffd45=_0x1f82b4[_0xbd33('0x29')][_0xbd33('0x2c')];var _0x483fa1=_0x1f82b4[_0xbd33('0x29')][_0xbd33('0x2d')];return getAgent(_0x1b501b)[_0xbd33('0x1a')](function(_0x1a2677){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x1a2677[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x1a2677['name']),_0xbd33('0x31'),{'callNumber':_0x4bc639,'callerId':_0x2ffd45,'callbackUrl':_0x483fa1});return _0x22c33f[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x32')});})['catch'](handleError(_0x22c33f));};exports[_0xbd33('0x33')]=function(_0x2eca01,_0x8f5a3){logger['info'](_0xbd33('0x34'),_0x2eca01['body']);var _0x5dffe1=hangupValidation[_0xbd33('0xa')](_0x2eca01[_0xbd33('0x29')]);if(_0x5dffe1[_0xbd33('0x35')]>0x0){return _0x8f5a3[_0xbd33('0x17')](0x190)['json'](_0x5dffe1);}var _0x1e978e=_0x2eca01[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x15056e=_0x2eca01[_0xbd33('0x29')][_0xbd33('0x36')];return getAgent(_0x1e978e)[_0xbd33('0x1a')](function(_0x411277){logger['info'](_0xbd33('0x2e'),_0x411277['name']);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x411277[_0xbd33('0x16')]),_0xbd33('0x37'),{'sessionId':_0x15056e});return _0x8f5a3[_0xbd33('0x17')](0xc8)['json']({'error':![],'message':_0xbd33('0x38')});})[_0xbd33('0x1f')](handleError(_0x8f5a3));};exports[_0xbd33('0x39')]=function(_0x2bca10,_0x1e70d2){logger[_0xbd33('0x11')](_0xbd33('0x3a'),_0x2bca10[_0xbd33('0x29')]);var _0x27250c=answerValidation['validate'](_0x2bca10[_0xbd33('0x29')]);if(_0x27250c['length']>0x0){return _0x1e70d2['status'](0x190)[_0xbd33('0x2a')](_0x27250c);}var _0xfb6776=_0x2bca10['body'][_0xbd33('0x2b')];var _0x2022cc=_0x2bca10['body'][_0xbd33('0x36')];return getAgent(_0xfb6776)[_0xbd33('0x1a')](function(_0x2c2aea){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x2c2aea[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')]('user:%s',_0x2c2aea['name']),_0xbd33('0x3b'),{'sessionId':_0x2022cc});return _0x1e70d2['status'](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x3c')});})['catch'](handleError(_0x1e70d2));};exports[_0xbd33('0x3d')]=function(_0x4ce968,_0x496835){logger[_0xbd33('0x11')](_0xbd33('0x3e'),_0x4ce968[_0xbd33('0x29')]);var _0x4ce9c7=holdValidation[_0xbd33('0xa')](_0x4ce968[_0xbd33('0x29')]);if(_0x4ce9c7[_0xbd33('0x35')]>0x0){return _0x496835[_0xbd33('0x17')](0x190)['json'](_0x4ce9c7);}var _0x29d55c=_0x4ce968[_0xbd33('0x29')]['userId'];var _0x3d5feb=_0x4ce968[_0xbd33('0x29')][_0xbd33('0x36')];return getAgent(_0x29d55c)[_0xbd33('0x1a')](function(_0x276ffb){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x276ffb[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x276ffb['name']),_0xbd33('0x3f'),{'sessionId':_0x3d5feb});return _0x496835[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x40')});})[_0xbd33('0x1f')](handleError(_0x496835));};exports[_0xbd33('0x41')]=function(_0x1dfcb7,_0x5850e8){logger[_0xbd33('0x11')](_0xbd33('0x42'),_0x1dfcb7[_0xbd33('0x29')]);var _0x2ddce4=unholdValidation['validate'](_0x1dfcb7[_0xbd33('0x29')]);if(_0x2ddce4[_0xbd33('0x35')]>0x0){return _0x5850e8[_0xbd33('0x17')](0x190)['json'](_0x2ddce4);}var _0x51d21a=_0x1dfcb7[_0xbd33('0x29')]['userId'];var _0x59819b=_0x1dfcb7[_0xbd33('0x29')][_0xbd33('0x36')];return getAgent(_0x51d21a)['then'](function(_0x26af0d){logger['info']('entityFound:',_0x26af0d[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')]('user:%s',_0x26af0d[_0xbd33('0x16')]),_0xbd33('0x43'),{'sessionId':_0x59819b});return _0x5850e8['status'](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x44')});})[_0xbd33('0x1f')](handleError(_0x5850e8));};exports['calls']=function(_0x1a64a8,_0x3e70b4){logger['info'](_0xbd33('0x45'),_0x3e70b4[_0xbd33('0x29')]);var _0x4bf784=callsValidation[_0xbd33('0xa')](_0x1a64a8[_0xbd33('0x29')]);if(_0x4bf784[_0xbd33('0x35')]>0x0){return _0x3e70b4[_0xbd33('0x17')](0x190)['json'](_0x4bf784);}var _0x40d030=_0x1a64a8[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x4ce0fd=respondWithRpcPromise('VoiceChannels');var _0x875a45=getAgent(_0x40d030);return Promise[_0xbd33('0x24')]([_0x4ce0fd,_0x875a45])[_0xbd33('0x1a')](function(_0x2ff73f){var _0x3fbd20=_0x2ff73f[0x0];var _0x3e4142=_0x2ff73f[0x1];var _0x527ea4=_[_0xbd33('0x25')](_0x3fbd20['rows'],function(_0xa92727){return _0xa92727[_0xbd33('0x46')]==_0x3e4142['id'];});return _0x3e70b4[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'count':_0x527ea4[_0xbd33('0x35')],'rows':_0x527ea4});})['catch'](handleError(_0x3e70b4));};exports[_0xbd33('0x47')]=function(_0x5b554e,_0x30c199){logger[_0xbd33('0x11')](_0xbd33('0x48'),_0x5b554e[_0xbd33('0x29')]);var _0x468a56=conferenceValidation[_0xbd33('0xa')](_0x5b554e[_0xbd33('0x29')]);if(_0x468a56[_0xbd33('0x35')]>0x0){return _0x30c199[_0xbd33('0x17')](0x190)[_0xbd33('0x2a')](_0x468a56);}var _0x42a3ee=_0x5b554e['body'][_0xbd33('0x2b')];return getAgent(_0x42a3ee)[_0xbd33('0x1a')](function(_0x11a675){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x11a675[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')]('user:%s',_0x11a675[_0xbd33('0x16')]),_0xbd33('0x49'));return _0x30c199[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0xbd33('0x1f')](handleError(_0x30c199));};exports[_0xbd33('0x4a')]=function(_0x18456a,_0x9b53bf){logger[_0xbd33('0x11')](_0xbd33('0x4b'),_0x18456a[_0xbd33('0x29')]);var _0x102af8=transferValidation['validate'](_0x18456a[_0xbd33('0x29')]);if(_0x102af8[_0xbd33('0x35')]>0x0){return _0x9b53bf[_0xbd33('0x17')](0x190)[_0xbd33('0x2a')](_0x102af8);}var _0x10790a=_0x18456a[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x20b3f2=_0x18456a[_0xbd33('0x29')][_0xbd33('0x36')];var _0x1fa444=_0x18456a[_0xbd33('0x29')][_0xbd33('0x4c')];return getAgent(_0x10790a)[_0xbd33('0x1a')](function(_0x2f7dd6){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x2f7dd6[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x2f7dd6[_0xbd33('0x16')]),_0xbd33('0x4d'),{'sessionId':_0x20b3f2,'transferNumber':_0x1fa444});return _0x9b53bf[_0xbd33('0x17')](0xc8)['json']({'error':![],'message':_0xbd33('0x4e')});})[_0xbd33('0x1f')](handleError(_0x9b53bf));}; \ No newline at end of file +var _0x9362=['format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','calls','calls\x20fired:','rows','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','jayson/promise','client','../../config/logger','ioredis','redis','defaults','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','error','stack','name','send','then','code','result','catch','User','findOne','VoiceChannels','all','filter','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','status','json','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','userId'];(function(_0x4e215b,_0x597fbc){var _0x56d77a=function(_0x349d7d){while(--_0x349d7d){_0x4e215b['push'](_0x4e215b['shift']());}};_0x56d77a(++_0x597fbc);}(_0x9362,0x169));var _0x2936=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9362[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0x2936('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x2936('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x2936('0x2'));var BPromise=require(_0x2936('0x3'));var jayson=require(_0x2936('0x4'));var amiClient=jayson[_0x2936('0x5')]['http']({'port':0x232a});var logger=require(_0x2936('0x6'))('webbarapi');var Redis=require(_0x2936('0x7'));config[_0x2936('0x8')]=_[_0x2936('0x9')](config[_0x2936('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2936('0x8')]));var Schema=require(_0x2936('0xa'));var originateValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x2936('0xc'),'required':[!![],_0x2936('0xd')]},'callerId':{'type':_0x2936('0xc')},'callbackUrl':{'type':_0x2936('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2936('0xe')]},'sessionId':{'type':_0x2936('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],_0x2936('0xe')]},'sessionId':{'type':_0x2936('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],_0x2936('0xe')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x2936('0xc'),'required':[!![],_0x2936('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2936('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],_0x2936('0xe')]},'sessionId':{'type':_0x2936('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],_0x2936('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x9fe85f,_0x31f440,_0x448b44){logger[_0x2936('0x10')](_0x9fe85f,_0x31f440,JSON[_0x2936('0x11')](_0x448b44));io['to'](_0x9fe85f)['emit'](_0x31f440,_0x448b44);}function handleError(_0x2a544e){return function(_0x51e948){console['log']('handleError:',_0x51e948,_0x51e948 instanceof RangeError);logger[_0x2936('0x12')](_0x51e948[_0x2936('0x13')]);if(_0x51e948 instanceof RangeError){if(_0x51e948[_0x2936('0x14')]){delete _0x51e948[_0x2936('0x14')];}_0x2a544e['status'](0x194)[_0x2936('0x15')](_0x51e948);}else{if(_0x51e948[_0x2936('0x14')]){delete _0x51e948[_0x2936('0x14')];}_0x2a544e['status'](0x1f4)[_0x2936('0x15')](_0x51e948);}};}function checkError(){return function(_0x4b5b46){if(!_0x4b5b46){throw new RangeError('NotFound');}return _0x4b5b46;};}function respondWithRpcPromise(_0x4d4976,_0x253ae3){return new BPromise(function(_0x81c228,_0x57110b){var _0x1c35ed=amiClient;return _0x1c35ed['request'](_0x4d4976,_0x253ae3)[_0x2936('0x16')](function(_0x280844){if(_0x280844[_0x2936('0x12')]){if(_0x280844[_0x2936('0x12')][_0x2936('0x17')]===0x1f4){return _0x57110b(_0x280844[_0x2936('0x12')]['message']);}return _0x81c228(_0x280844['error']['message']);}else{_0x81c228(_0x280844[_0x2936('0x18')]);}})[_0x2936('0x19')](function(_0x1c225a){_0x57110b(_0x1c225a);});});}function getAgent(_0x4f70b7){return db[_0x2936('0x1a')][_0x2936('0x1b')]({'where':{'id':_0x4f70b7,'role':'agent'}})[_0x2936('0x16')](checkError());}function getAgentCheckSession(_0x32b12c,_0x3687e9){return new BPromise(function(_0x2463bc,_0xca20e8){var _0x3bca1d=respondWithRpcPromise(_0x2936('0x1c'));var _0x15cf4e=getAgent(_0x32b12c);Promise[_0x2936('0x1d')]([_0x3bca1d,_0x15cf4e])[_0x2936('0x16')](function(_0x49aa57){var _0x19f81d=_0x49aa57[0x0];var _0x4fd4db=_0x49aa57[0x1];var _0x2164d6=_[_0x2936('0x1e')](_0x19f81d['rows'],function(_0xbef786){return _0xbef786['UserId']==_0x4fd4db['id']&&_0xbef786[_0x2936('0x1f')]==_0x3687e9;});if(_0x2164d6[_0x2936('0x20')]==0x1){_0x2463bc(_0x4fd4db);}else{_0xca20e8(new RangeError(_0x2936('0x21')+_0x3687e9+_0x2936('0x22')));}});});}exports[_0x2936('0x23')]=function(_0x27e847,_0x392ff2){logger['info'](_0x2936('0x24'),_0x27e847[_0x2936('0x25')]);var _0x12c523=originateValidation[_0x2936('0xa')](_0x27e847[_0x2936('0x25')]);if(_0x12c523[_0x2936('0x20')]>0x0){return _0x392ff2[_0x2936('0x26')](0x190)[_0x2936('0x27')](_0x12c523);}var _0x5bba65=_0x27e847[_0x2936('0x25')]['userId'];var _0x41ac4e=_0x27e847[_0x2936('0x25')]['callNumber'];var _0x47eb7b=_0x27e847[_0x2936('0x25')][_0x2936('0x28')];var _0x425dc4=_0x27e847[_0x2936('0x25')][_0x2936('0x29')];return getAgent(_0x5bba65)[_0x2936('0x16')](function(_0x1bd80a){logger[_0x2936('0x10')](_0x2936('0x2a'),_0x1bd80a['name']);emit(util['format'](_0x2936('0x2b'),_0x1bd80a[_0x2936('0x14')]),_0x2936('0x2c'),{'callNumber':_0x41ac4e,'callerId':_0x47eb7b,'callbackUrl':_0x425dc4});return _0x392ff2['status'](0xc8)[_0x2936('0x27')]({'error':![],'message':_0x2936('0x2d')});})[_0x2936('0x19')](handleError(_0x392ff2));};exports['hangup']=function(_0x3c39c4,_0x2868a5){logger[_0x2936('0x10')]('hangup\x20fired:',_0x3c39c4['body']);var _0x23f3a6=hangupValidation[_0x2936('0xa')](_0x3c39c4['body']);if(_0x23f3a6[_0x2936('0x20')]>0x0){return _0x2868a5[_0x2936('0x26')](0x190)[_0x2936('0x27')](_0x23f3a6);}var _0x38620f=_0x3c39c4[_0x2936('0x25')][_0x2936('0x2e')];var _0x419dbd=_0x3c39c4['body'][_0x2936('0x1f')];return getAgent(_0x38620f)[_0x2936('0x16')](function(_0x212e74){logger[_0x2936('0x10')](_0x2936('0x2a'),_0x212e74[_0x2936('0x14')]);emit(util[_0x2936('0x2f')](_0x2936('0x2b'),_0x212e74[_0x2936('0x14')]),_0x2936('0x30'),{'sessionId':_0x419dbd});return _0x2868a5[_0x2936('0x26')](0xc8)[_0x2936('0x27')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x2868a5));};exports[_0x2936('0x31')]=function(_0xd66fa5,_0x35dcb9){logger['info'](_0x2936('0x32'),_0xd66fa5['body']);var _0x472665=answerValidation[_0x2936('0xa')](_0xd66fa5[_0x2936('0x25')]);if(_0x472665[_0x2936('0x20')]>0x0){return _0x35dcb9[_0x2936('0x26')](0x190)['json'](_0x472665);}var _0x44a166=_0xd66fa5[_0x2936('0x25')]['userId'];var _0x5d7807=_0xd66fa5[_0x2936('0x25')][_0x2936('0x1f')];return getAgent(_0x44a166)[_0x2936('0x16')](function(_0xeb8042){logger[_0x2936('0x10')](_0x2936('0x2a'),_0xeb8042[_0x2936('0x14')]);emit(util['format'](_0x2936('0x2b'),_0xeb8042[_0x2936('0x14')]),_0x2936('0x33'),{'sessionId':_0x5d7807});return _0x35dcb9[_0x2936('0x26')](0xc8)['json']({'error':![],'message':_0x2936('0x34')});})['catch'](handleError(_0x35dcb9));};exports[_0x2936('0x35')]=function(_0x173472,_0x16ade3){logger[_0x2936('0x10')]('hold\x20fired:',_0x173472[_0x2936('0x25')]);var _0x2bebab=holdValidation[_0x2936('0xa')](_0x173472[_0x2936('0x25')]);if(_0x2bebab[_0x2936('0x20')]>0x0){return _0x16ade3['status'](0x190)[_0x2936('0x27')](_0x2bebab);}var _0x29c964=_0x173472[_0x2936('0x25')][_0x2936('0x2e')];var _0x3d83b7=_0x173472[_0x2936('0x25')][_0x2936('0x1f')];return getAgent(_0x29c964)[_0x2936('0x16')](function(_0x52496e){logger[_0x2936('0x10')]('entityFound:',_0x52496e[_0x2936('0x14')]);emit(util[_0x2936('0x2f')]('user:%s',_0x52496e[_0x2936('0x14')]),_0x2936('0x36'),{'sessionId':_0x3d83b7});return _0x16ade3[_0x2936('0x26')](0xc8)['json']({'error':![],'message':_0x2936('0x37')});})[_0x2936('0x19')](handleError(_0x16ade3));};exports['unhold']=function(_0x212538,_0x157ec8){logger[_0x2936('0x10')]('unhold\x20fired:',_0x212538[_0x2936('0x25')]);var _0x2cfca8=unholdValidation[_0x2936('0xa')](_0x212538[_0x2936('0x25')]);if(_0x2cfca8[_0x2936('0x20')]>0x0){return _0x157ec8['status'](0x190)[_0x2936('0x27')](_0x2cfca8);}var _0x51d124=_0x212538[_0x2936('0x25')][_0x2936('0x2e')];var _0x4ff53b=_0x212538['body'][_0x2936('0x1f')];return getAgent(_0x51d124)[_0x2936('0x16')](function(_0x4d8cfb){logger[_0x2936('0x10')](_0x2936('0x2a'),_0x4d8cfb[_0x2936('0x14')]);emit(util[_0x2936('0x2f')](_0x2936('0x2b'),_0x4d8cfb[_0x2936('0x14')]),'webbar:unhold',{'sessionId':_0x4ff53b});return _0x157ec8[_0x2936('0x26')](0xc8)[_0x2936('0x27')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x157ec8));};exports[_0x2936('0x38')]=function(_0xd188f1,_0x30dfc7){logger['info'](_0x2936('0x39'),_0x30dfc7[_0x2936('0x25')]);var _0x1179ae=callsValidation[_0x2936('0xa')](_0xd188f1[_0x2936('0x25')]);if(_0x1179ae[_0x2936('0x20')]>0x0){return _0x30dfc7[_0x2936('0x26')](0x190)['json'](_0x1179ae);}var _0x72433b=_0xd188f1['body'][_0x2936('0x2e')];var _0x29fc4a=respondWithRpcPromise(_0x2936('0x1c'));var _0x6f6274=getAgent(_0x72433b);return Promise['all']([_0x29fc4a,_0x6f6274])[_0x2936('0x16')](function(_0x282e26){var _0x37ccf3=_0x282e26[0x0];var _0x2f5c0f=_0x282e26[0x1];var _0x36a239=_[_0x2936('0x1e')](_0x37ccf3[_0x2936('0x3a')],function(_0x3e41e2){return _0x3e41e2[_0x2936('0x3b')]==_0x2f5c0f['id'];});return _0x30dfc7['status'](0xc8)['json']({'count':_0x36a239[_0x2936('0x20')],'rows':_0x36a239});})[_0x2936('0x19')](handleError(_0x30dfc7));};exports[_0x2936('0x3c')]=function(_0x25e9f2,_0x3d5b31){logger[_0x2936('0x10')](_0x2936('0x3d'),_0x25e9f2[_0x2936('0x25')]);var _0x5af069=conferenceValidation[_0x2936('0xa')](_0x25e9f2[_0x2936('0x25')]);if(_0x5af069[_0x2936('0x20')]>0x0){return _0x3d5b31[_0x2936('0x26')](0x190)[_0x2936('0x27')](_0x5af069);}var _0x1757cc=_0x25e9f2[_0x2936('0x25')]['userId'];return getAgent(_0x1757cc)[_0x2936('0x16')](function(_0xe111bf){logger[_0x2936('0x10')](_0x2936('0x2a'),_0xe111bf[_0x2936('0x14')]);emit(util[_0x2936('0x2f')](_0x2936('0x2b'),_0xe111bf[_0x2936('0x14')]),'webbar:conference');return _0x3d5b31[_0x2936('0x26')](0xc8)[_0x2936('0x27')]({'error':![],'message':_0x2936('0x3e')});})[_0x2936('0x19')](handleError(_0x3d5b31));};exports[_0x2936('0x3f')]=function(_0x1339c2,_0x5f2729){logger[_0x2936('0x10')](_0x2936('0x40'),_0x1339c2[_0x2936('0x25')]);var _0x1b1030=transferValidation['validate'](_0x1339c2[_0x2936('0x25')]);if(_0x1b1030[_0x2936('0x20')]>0x0){return _0x5f2729[_0x2936('0x26')](0x190)['json'](_0x1b1030);}var _0xc45c14=_0x1339c2[_0x2936('0x25')][_0x2936('0x2e')];var _0xacb62d=_0x1339c2[_0x2936('0x25')][_0x2936('0x1f')];var _0xb2b74e=_0x1339c2['body'][_0x2936('0x41')];return getAgent(_0xc45c14)[_0x2936('0x16')](function(_0x30ed8c){logger[_0x2936('0x10')](_0x2936('0x2a'),_0x30ed8c['name']);emit(util[_0x2936('0x2f')](_0x2936('0x2b'),_0x30ed8c[_0x2936('0x14')]),_0x2936('0x42'),{'sessionId':_0xacb62d,'transferNumber':_0xb2b74e});return _0x5f2729[_0x2936('0x26')](0xc8)[_0x2936('0x27')]({'error':![],'message':_0x2936('0x43')});})['catch'](handleError(_0x5f2729));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index be82026..7e4e5ed 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 _0x4534=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/applications','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path'];(function(_0x3bf720,_0x1510d6){var _0x2d2aab=function(_0x3d1459){while(--_0x3d1459){_0x3bf720['push'](_0x3bf720['shift']());}};_0x2d2aab(++_0x1510d6);}(_0x4534,0x141));var _0x4453=function(_0x4591ab,_0xa00f62){_0x4591ab=_0x4591ab-0x0;var _0x3b6d4f=_0x4534[_0x4591ab];return _0x3b6d4f;};'use strict';var multer=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var path=require(_0x4453('0x2'));var timeout=require(_0x4453('0x3'));var express=require('express');var router=express[_0x4453('0x4')]();var auth=require(_0x4453('0x5'));var interaction=require(_0x4453('0x6'));var config=require(_0x4453('0x7'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x4453('0x8')](),controller[_0x4453('0x9')]);router[_0x4453('0xa')](_0x4453('0xb'),auth[_0x4453('0x8')](),controller[_0x4453('0xc')]);router[_0x4453('0xa')](_0x4453('0xd'),auth['isAuthenticated'](),controller[_0x4453('0xe')]);router[_0x4453('0xa')](_0x4453('0xf'),auth[_0x4453('0x8')](),controller[_0x4453('0x10')]);router[_0x4453('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4453('0x11')]);router['get'](_0x4453('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4453('0xa')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x4453('0x13')]('/',auth[_0x4453('0x8')](),controller[_0x4453('0x14')]);router[_0x4453('0x13')](_0x4453('0xf'),auth[_0x4453('0x8')](),controller[_0x4453('0x15')]);router[_0x4453('0x13')](_0x4453('0x16'),auth['isAuthenticated'](),controller[_0x4453('0x17')]);router[_0x4453('0x13')](_0x4453('0x12'),auth['isAuthenticated'](),controller[_0x4453('0x18')]);router['post'](_0x4453('0x19'),auth[_0x4453('0x8')](),controller['addApplications']);router[_0x4453('0x13')](_0x4453('0x1a'),controller[_0x4453('0x1b')]);router[_0x4453('0x13')](_0x4453('0x1c'),auth[_0x4453('0x8')](),controller['send']);router[_0x4453('0x1d')](_0x4453('0xd'),auth[_0x4453('0x8')](),controller[_0x4453('0x1e')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4453('0x1f')]);router[_0x4453('0x20')](_0x4453('0xf'),auth[_0x4453('0x8')](),controller[_0x4453('0x21')]);router['delete'](_0x4453('0x16'),auth[_0x4453('0x8')](),controller[_0x4453('0x22')]);router[_0x4453('0x20')]('/:id/users',auth[_0x4453('0x8')](),controller['removeAgents']);module[_0x4453('0x23')]=router; \ No newline at end of file +var _0x2c37=['getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','express','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x5069ed,_0x383431){var _0x2924ec=function(_0x5b16d8){while(--_0x5b16d8){_0x5069ed['push'](_0x5069ed['shift']());}};_0x2924ec(++_0x383431);}(_0x2c37,0x175));var _0x72c3=function(_0x209e53,_0x24257e){_0x209e53=_0x209e53-0x0;var _0x1186b9=_0x2c37[_0x209e53];return _0x1186b9;};'use strict';var multer=require('multer');var util=require(_0x72c3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x72c3('0x1'));var router=express['Router']();var auth=require(_0x72c3('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x72c3('0x3'));var controller=require(_0x72c3('0x4'));router[_0x72c3('0x5')]('/',auth[_0x72c3('0x6')](),controller['index']);router[_0x72c3('0x5')](_0x72c3('0x7'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x8')]);router[_0x72c3('0x5')](_0x72c3('0x9'),auth[_0x72c3('0x6')](),controller[_0x72c3('0xa')]);router[_0x72c3('0x5')](_0x72c3('0xb'),auth['isAuthenticated'](),controller[_0x72c3('0xc')]);router[_0x72c3('0x5')](_0x72c3('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x72c3('0x5')](_0x72c3('0xe'),auth['isAuthenticated'](),controller[_0x72c3('0xf')]);router[_0x72c3('0x5')](_0x72c3('0x10'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x11')]);router[_0x72c3('0x12')]('/',auth[_0x72c3('0x6')](),controller[_0x72c3('0x13')]);router[_0x72c3('0x12')](_0x72c3('0xb'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x14')]);router[_0x72c3('0x12')](_0x72c3('0xd'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x15')]);router[_0x72c3('0x12')](_0x72c3('0xe'),auth['isAuthenticated'](),controller[_0x72c3('0x16')]);router[_0x72c3('0x12')](_0x72c3('0x10'),auth['isAuthenticated'](),controller[_0x72c3('0x17')]);router['post'](_0x72c3('0x18'),controller[_0x72c3('0x19')]);router['post'](_0x72c3('0x1a'),auth[_0x72c3('0x6')](),controller['send']);router[_0x72c3('0x1b')](_0x72c3('0x9'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x1c')]);router[_0x72c3('0x1d')](_0x72c3('0x9'),auth['isAuthenticated'](),controller[_0x72c3('0x1e')]);router[_0x72c3('0x1d')](_0x72c3('0xb'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x1f')]);router[_0x72c3('0x1d')]('/:id/canned_answers',auth[_0x72c3('0x6')](),controller[_0x72c3('0x20')]);router[_0x72c3('0x1d')]('/:id/users',auth[_0x72c3('0x6')](),controller[_0x72c3('0x21')]);module[_0x72c3('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 365094a..7c5c973 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 _0x2750=['mandatoryDisposition','exports','STRING','name','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x72445e,_0xfddac1){var _0x2bdf6e=function(_0x3e0db0){while(--_0x3e0db0){_0x72445e['push'](_0x72445e['shift']());}};_0x2bdf6e(++_0xfddac1);}(_0x2750,0x9b));var _0x0275=function(_0x80df57,_0x11390f){_0x80df57=_0x80df57-0x0;var _0x2d0c44=_0x2750[_0x80df57];return _0x2d0c44;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x0275('0x0')]={'name':{'type':Sequelize[_0x0275('0x1')],'unique':_0x0275('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0275('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x0275('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0275('0x3')]();}},'phone':{'type':Sequelize[_0x0275('0x1')]},'type':{'type':Sequelize['ENUM'](_0x0275('0x4'))},'accountSid':{'type':Sequelize[_0x0275('0x1')]},'authToken':{'type':Sequelize[_0x0275('0x1')]},'notificationTemplate':{'type':Sequelize[_0x0275('0x5')],'defaultValue':function(){return _0x0275('0x6');}},'notificationSound':{'type':Sequelize[_0x0275('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0275('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0275('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0275('0x8')],'comment':_0x0275('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x0275('0x7')],'defaultValue':![],'comment':_0x0275('0xa'),'set':function(_0x46dc62){if(!_0x46dc62){this['setDataValue'](_0x0275('0xb'),null);}this[_0x0275('0xc')](_0x0275('0xd'),_0x46dc62);}},'description':{'type':Sequelize[_0x0275('0x1')]}}; \ No newline at end of file +var _0x2736=['sequelize','randomstring','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x35cf88,_0x39d23e){var _0xe91b2d=function(_0x40bd12){while(--_0x40bd12){_0x35cf88['push'](_0x35cf88['shift']());}};_0xe91b2d(++_0x39d23e);}(_0x2736,0xe0));var _0x6273=function(_0x259cad,_0x3dae11){_0x259cad=_0x259cad-0x0;var _0x4e6a68=_0x2736[_0x259cad];return _0x4e6a68;};'use strict';var Sequelize=require(_0x6273('0x0'));var rs=require(_0x6273('0x1'));module['exports']={'name':{'type':Sequelize[_0x6273('0x2')],'unique':_0x6273('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6273('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6273('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6273('0x4')]();}},'phone':{'type':Sequelize[_0x6273('0x2')]},'type':{'type':Sequelize[_0x6273('0x5')](_0x6273('0x6'))},'accountSid':{'type':Sequelize[_0x6273('0x2')]},'authToken':{'type':Sequelize[_0x6273('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6273('0x7')],'defaultValue':function(){return _0x6273('0x8');}},'notificationSound':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6273('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6273('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6273('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6273('0xa')],'comment':_0x6273('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![],'comment':_0x6273('0xc'),'set':function(_0x1cbe5b){if(!_0x1cbe5b){this['setDataValue'](_0x6273('0xd'),null);}this[_0x6273('0xe')](_0x6273('0xf'),_0x1cbe5b);}},'description':{'type':Sequelize[_0x6273('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 1ea7da5..594a25f 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 _0xf109=['unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','info','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','WhatsappMessage','dataValues','Messages','html-pdf','eml-format','rimraf','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','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','set','reject','save','update','destroy','get','WhatsappAccounts','name','index','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','Pause','mandatoryDispositionPause','keys','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','Disposition','findOne','hasOwnProperty','order','WhatsappAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','messageId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','contact','WhatsappInteraction','interaction','created','autoclose','push','*,*,*,*','ContactId','AttachmentId','UserId'];(function(_0x4eca8b,_0xd59631){var _0xa77097=function(_0x4e3870){while(--_0x4e3870){_0x4eca8b['push'](_0x4eca8b['shift']());}};_0xa77097(++_0xd59631);}(_0xf109,0xce));var _0x9f10=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xf109[_0x35da42];return _0x370035;};'use strict';var pdf=require(_0x9f10('0x0'));var emlformat=require(_0x9f10('0x1'));var rimraf=require(_0x9f10('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f10('0x3'));var BPromise=require(_0x9f10('0x4'));var Mustache=require(_0x9f10('0x5'));var util=require(_0x9f10('0x6'));var path=require(_0x9f10('0x7'));var sox=require(_0x9f10('0x8'));var csv=require(_0x9f10('0x9'));var ejs=require(_0x9f10('0xa'));var fs=require('fs');var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x9'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var Redis=require(_0x9f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f10('0x12'));var as=require(_0x9f10('0x13'));var hardwareService=require(_0x9f10('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f10('0x15'));var config=require(_0x9f10('0x16'));var db=require(_0x9f10('0x17'))['db'];config['redis']=_[_0x9f10('0x18')](config[_0x9f10('0x19')],{'host':_0x9f10('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f10('0x19')]));require(_0x9f10('0x1b'))['register'](socket);var jayson=require(_0x9f10('0x1c'));var client=jayson[_0x9f10('0x1d')]['http']({'port':0x232c});function checkPasswordPattern(_0x59bcad,_0x2b6c4c,_0x177918){if(_0x177918){var _0x549217=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x549217[_0x9f10('0x1e')](_0x2b6c4c)){return _0x59bcad;}else{throw new db['Sequelize'][(_0x9f10('0x1f'))](_0x9f10('0x20'));}}else{return _0x59bcad;}}function respondWithRpcPromise(_0x4b1b8f,_0x11cc56,_0xd2950c,_0x509fba){return new BPromise(function(_0x150813,_0x53bfbd){var _0xe221d0=_0x509fba||client;return _0xe221d0['request'](_0x4b1b8f,_0xd2950c)[_0x9f10('0x21')](function(_0x56fb44){logger['info'](_0x9f10('0x22'),_0x11cc56,_0x9f10('0x23'));logger[_0x9f10('0x24')](_0x9f10('0x25'),_0x11cc56,_0x9f10('0x23'),JSON[_0x9f10('0x26')](_0x56fb44));if(_0x56fb44[_0x9f10('0x27')]){if(_0x56fb44['error'][_0x9f10('0x28')]===0x1f4){logger['error'](_0x9f10('0x22'),_0x11cc56,_0x56fb44[_0x9f10('0x27')][_0x9f10('0x29')]);return _0x53bfbd(_0x56fb44['error'][_0x9f10('0x29')]);}logger[_0x9f10('0x27')](_0x9f10('0x22'),_0x11cc56,_0x56fb44['error'][_0x9f10('0x29')]);return _0x150813(_0x56fb44[_0x9f10('0x27')][_0x9f10('0x29')]);}else{logger['info'](_0x9f10('0x22'),_0x11cc56,_0x9f10('0x23'));_0x150813(_0x56fb44[_0x9f10('0x2a')][_0x9f10('0x29')]);}})['catch'](function(_0x57539b){logger['error'](_0x9f10('0x22'),_0x11cc56,_0x57539b);_0x53bfbd(_0x57539b);});});}function respondWithStatusCode(_0x4a0407,_0x314794){_0x314794=_0x314794||0xcc;return function(_0x1de75a){if(_0x1de75a){return _0x4a0407[_0x9f10('0x2b')](_0x314794);}return _0x4a0407[_0x9f10('0x2c')](_0x314794)[_0x9f10('0x2d')]();};}function respondWithResult(_0x4f6b0c,_0x522805){_0x522805=_0x522805||0xc8;return function(_0x22814f){if(_0x22814f){return _0x4f6b0c[_0x9f10('0x2c')](_0x522805)[_0x9f10('0x2e')](_0x22814f);}};}function respondWithFilteredResult(_0x181aec,_0x2c4373){return function(_0x581b1d){if(_0x581b1d){var _0x358d3f=_0x581b1d['count'],_0x501ee=_0x2c4373[_0x9f10('0x2f')],_0x44207f=_0x2c4373[_0x9f10('0x2f')]+_0x2c4373[_0x9f10('0x30')],_0x1b03ee;if(_0x44207f>=_0x358d3f){_0x44207f=_0x358d3f;_0x1b03ee=0xc8;}else{_0x1b03ee=0xce;}_0x181aec['status'](_0x1b03ee);return _0x181aec[_0x9f10('0x31')]('Content-Range',_0x501ee+'-'+_0x44207f+'/'+_0x358d3f)[_0x9f10('0x2e')](_0x581b1d);}return null;};}function patchUpdates(_0x362cab){return function(_0x13532b){try{jsonpatch['apply'](_0x13532b,_0x362cab,!![]);}catch(_0x3ac139){return BPromise[_0x9f10('0x32')](_0x3ac139);}return _0x13532b[_0x9f10('0x33')]();};}function saveUpdates(_0x11f128,_0x148a5b){return function(_0x47bb88){if(_0x47bb88){return _0x47bb88[_0x9f10('0x34')](_0x11f128)['then'](function(_0x24d21d){return _0x24d21d;});}return null;};}function removeEntity(_0x17081c,_0x1990da){return function(_0x11ee9c){if(_0x11ee9c){return _0x11ee9c[_0x9f10('0x35')]()[_0x9f10('0x21')](function(){var _0x4b87b0=_0x11ee9c[_0x9f10('0x36')]({'plain':!![]});var _0x3a1601=_0x9f10('0x37');return db['UserProfileResource'][_0x9f10('0x35')]({'where':{'type':_0x3a1601,'resourceId':_0x4b87b0['id']}})[_0x9f10('0x21')](function(){return _0x11ee9c;});})['then'](function(){_0x17081c[_0x9f10('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x428bf0,_0x1b7a66){return function(_0x26df66){if(!_0x26df66){_0x428bf0[_0x9f10('0x2b')](0x194);}return _0x26df66;};}function handleError(_0x20605a,_0x1ba4be){_0x1ba4be=_0x1ba4be||0x1f4;return function(_0x12036c){logger[_0x9f10('0x27')](_0x12036c['stack']);if(_0x12036c[_0x9f10('0x38')]){delete _0x12036c[_0x9f10('0x38')];}_0x20605a[_0x9f10('0x2c')](_0x1ba4be)['send'](_0x12036c);};}exports[_0x9f10('0x39')]=function(_0x193b59,_0x52914c){var _0x30b04b={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x26f0ba={},_0x433c7a={'count':0x0,'rows':[]};var _0x2e4e2d=_[_0x9f10('0x3a')](db[_0x9f10('0x3b')][_0x9f10('0x3c')],function(_0x2e5e46){return{'name':_0x2e5e46[_0x9f10('0x3d')],'type':_0x2e5e46[_0x9f10('0x3e')][_0x9f10('0x3f')]};});_0x26f0ba[_0x9f10('0x40')]=_[_0x9f10('0x3a')](_0x2e4e2d,_0x9f10('0x38'));_0x26f0ba[_0x9f10('0x41')]=_['keys'](_0x193b59['query']);_0x26f0ba['filters']=_[_0x9f10('0x42')](_0x26f0ba['model'],_0x26f0ba[_0x9f10('0x41')]);_0x30b04b[_0x9f10('0x43')]=_[_0x9f10('0x42')](_0x26f0ba['model'],qs[_0x9f10('0x44')](_0x193b59[_0x9f10('0x41')][_0x9f10('0x44')]));_0x30b04b[_0x9f10('0x43')]=_0x30b04b[_0x9f10('0x43')]['length']?_0x30b04b['attributes']:_0x26f0ba['model'];if(!_0x193b59[_0x9f10('0x41')]['hasOwnProperty'](_0x9f10('0x45'))){_0x30b04b['limit']=qs[_0x9f10('0x30')](_0x193b59[_0x9f10('0x41')][_0x9f10('0x30')]);_0x30b04b[_0x9f10('0x2f')]=qs['offset'](_0x193b59[_0x9f10('0x41')][_0x9f10('0x2f')]);}_0x30b04b['order']=qs[_0x9f10('0x46')](_0x193b59[_0x9f10('0x41')][_0x9f10('0x46')]);_0x30b04b[_0x9f10('0x47')]=qs[_0x9f10('0x48')](_[_0x9f10('0x49')](_0x193b59[_0x9f10('0x41')],_0x26f0ba[_0x9f10('0x48')]),_0x2e4e2d);if(_0x193b59[_0x9f10('0x41')][_0x9f10('0x4a')]){_0x30b04b['where']=_[_0x9f10('0x4b')](_0x30b04b[_0x9f10('0x47')],{'$or':_['map'](_0x2e4e2d,function(_0x403ec6){if(_0x403ec6[_0x9f10('0x3e')]!==_0x9f10('0x4c')){var _0x1807b3={};_0x1807b3[_0x403ec6['name']]={'$like':'%'+_0x193b59[_0x9f10('0x41')][_0x9f10('0x4a')]+'%'};return _0x1807b3;}})});}_0x30b04b=_[_0x9f10('0x4b')]({},_0x30b04b,_0x193b59[_0x9f10('0x4d')]);var _0x26f39a={'where':_0x30b04b[_0x9f10('0x47')]};return db['WhatsappAccount'][_0x9f10('0x4e')](_0x26f39a)[_0x9f10('0x21')](function(_0x1ba49d){_0x433c7a[_0x9f10('0x4e')]=_0x1ba49d;if(_0x193b59[_0x9f10('0x41')][_0x9f10('0x4f')]){_0x30b04b['include']=[{'all':!![]}];}return db[_0x9f10('0x3b')][_0x9f10('0x50')](_0x30b04b);})[_0x9f10('0x21')](function(_0x14c808){_0x433c7a[_0x9f10('0x51')]=_0x14c808;return _0x433c7a;})[_0x9f10('0x21')](respondWithFilteredResult(_0x52914c,_0x30b04b))[_0x9f10('0x52')](handleError(_0x52914c,null));};exports[_0x9f10('0x53')]=function(_0x578fc6,_0xd1da11){var _0x59cf43={'raw':![],'where':{'id':_0x578fc6['params']['id']},'include':[{'model':db[_0x9f10('0x54')],'as':_0x9f10('0x55')}]},_0x26b1e8={};_0x26b1e8[_0x9f10('0x40')]=_[_0x9f10('0x56')](db[_0x9f10('0x3b')]['rawAttributes']);_0x26b1e8[_0x9f10('0x41')]=_[_0x9f10('0x56')](_0x578fc6[_0x9f10('0x41')]);_0x26b1e8[_0x9f10('0x48')]=_['intersection'](_0x26b1e8['model'],_0x26b1e8[_0x9f10('0x41')]);_0x59cf43[_0x9f10('0x43')]=_['intersection'](_0x26b1e8['model'],qs[_0x9f10('0x44')](_0x578fc6[_0x9f10('0x41')][_0x9f10('0x44')]));_0x59cf43['attributes']=_0x59cf43[_0x9f10('0x43')][_0x9f10('0x57')]?_0x59cf43[_0x9f10('0x43')]:_0x26b1e8['model'];if(_0x578fc6[_0x9f10('0x41')][_0x9f10('0x4f')]){_0x59cf43[_0x9f10('0x58')]=[{'all':!![]}];}_0x59cf43=_['merge']({},_0x59cf43,_0x578fc6[_0x9f10('0x4d')]);return db[_0x9f10('0x3b')]['find'](_0x59cf43)[_0x9f10('0x21')](handleEntityNotFound(_0xd1da11,null))[_0x9f10('0x21')](respondWithResult(_0xd1da11,null))[_0x9f10('0x52')](handleError(_0xd1da11,null));};exports[_0x9f10('0x59')]=function(_0x334ab4,_0x55cb99){return db[_0x9f10('0x3b')]['create'](_0x334ab4['body'],{})[_0x9f10('0x21')](function(_0x19b489){var _0x1f109a=_0x334ab4[_0x9f10('0x5a')][_0x9f10('0x36')]({'plain':!![]});if(!_0x1f109a)throw new Error(_0x9f10('0x5b'));if(_0x1f109a[_0x9f10('0x5c')]==='user'){var _0x53a80c=_0x19b489[_0x9f10('0x36')]({'plain':!![]});var _0x4e5e30=_0x9f10('0x37');return db[_0x9f10('0x5d')][_0x9f10('0x5e')]({'where':{'name':_0x4e5e30,'userProfileId':_0x1f109a[_0x9f10('0x5f')]},'raw':!![]})[_0x9f10('0x21')](function(_0x526184){if(_0x526184&&_0x526184[_0x9f10('0x60')]===0x0){return db[_0x9f10('0x61')]['create']({'name':_0x53a80c[_0x9f10('0x38')],'resourceId':_0x53a80c['id'],'type':_0x526184[_0x9f10('0x38')],'sectionId':_0x526184['id']},{})['then'](function(){return _0x19b489;});}else{return _0x19b489;}})[_0x9f10('0x52')](function(_0x3542ab){logger['error'](_0x9f10('0x62'),_0x3542ab);throw _0x3542ab;});}return _0x19b489;})['then'](respondWithResult(_0x55cb99,0xc9))[_0x9f10('0x52')](handleError(_0x55cb99,null));};exports[_0x9f10('0x34')]=function(_0x1a1f7b,_0x208d48){if(_0x1a1f7b[_0x9f10('0x63')]['id']){delete _0x1a1f7b['body']['id'];}return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x1a1f7b[_0x9f10('0x64')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x9f10('0x21')](handleEntityNotFound(_0x208d48,null))[_0x9f10('0x21')](saveUpdates(_0x1a1f7b[_0x9f10('0x63')],null))[_0x9f10('0x21')](respondWithResult(_0x208d48,null))[_0x9f10('0x52')](handleError(_0x208d48,null));};exports[_0x9f10('0x35')]=function(_0x2fd96b,_0x56e527){return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x2fd96b['params']['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x56e527,null))['then'](removeEntity(_0x56e527,null))[_0x9f10('0x52')](handleError(_0x56e527,null));};exports[_0x9f10('0x65')]=function(_0x5ebfc4,_0x3f669c){return db['WhatsappAccount'][_0x9f10('0x65')]()[_0x9f10('0x21')](respondWithResult(_0x3f669c,null))[_0x9f10('0x52')](handleError(_0x3f669c,null));};exports['addDisposition']=function(_0x35bfbd,_0x53e320,_0x2d704b){if(_0x35bfbd[_0x9f10('0x63')]['id']){delete _0x35bfbd[_0x9f10('0x63')]['id'];}return db['WhatsappAccount'][_0x9f10('0x5e')]({'where':{'id':_0x35bfbd['params']['id']}})['then'](handleEntityNotFound(_0x53e320,null))[_0x9f10('0x21')](function(_0x34520c){if(_0x34520c){_0x35bfbd[_0x9f10('0x63')]['WhatsappAccountId']=_0x34520c['id'];return db[_0x9f10('0x66')]['create'](_0x35bfbd['body']);}})[_0x9f10('0x21')](respondWithResult(_0x53e320,null))['catch'](handleError(_0x53e320,null));};exports['getDispositions']=function(_0x13a2cb,_0x5302d3,_0x1a08f5){var _0x9f6f4b={'raw':![],'where':{}};var _0x42f559={};var _0x5bc191={'count':0x0,'rows':[]};return db[_0x9f10('0x3b')][_0x9f10('0x67')]({'where':{'id':_0x13a2cb['params']['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x5302d3,null))['then'](function(_0x5bc6ce){if(_0x5bc6ce){_0x42f559[_0x9f10('0x40')]=_[_0x9f10('0x56')](db[_0x9f10('0x66')][_0x9f10('0x3c')]);_0x42f559[_0x9f10('0x41')]=_[_0x9f10('0x56')](_0x13a2cb[_0x9f10('0x41')]);_0x42f559['filters']=_[_0x9f10('0x42')](_0x42f559[_0x9f10('0x40')],_0x42f559[_0x9f10('0x41')]);_0x9f6f4b[_0x9f10('0x43')]=_[_0x9f10('0x42')](_0x42f559[_0x9f10('0x40')],qs[_0x9f10('0x44')](_0x13a2cb[_0x9f10('0x41')][_0x9f10('0x44')]));_0x9f6f4b['attributes']=_0x9f6f4b[_0x9f10('0x43')][_0x9f10('0x57')]?_0x9f6f4b[_0x9f10('0x43')]:_0x42f559[_0x9f10('0x40')];if(!_0x13a2cb['query'][_0x9f10('0x68')](_0x9f10('0x45'))){_0x9f6f4b[_0x9f10('0x30')]=qs[_0x9f10('0x30')](_0x13a2cb['query']['limit']);_0x9f6f4b[_0x9f10('0x2f')]=qs[_0x9f10('0x2f')](_0x13a2cb[_0x9f10('0x41')][_0x9f10('0x2f')]);}_0x9f6f4b[_0x9f10('0x69')]=qs[_0x9f10('0x46')](_0x13a2cb[_0x9f10('0x41')][_0x9f10('0x46')]);_0x9f6f4b[_0x9f10('0x47')]=qs[_0x9f10('0x48')](_[_0x9f10('0x49')](_0x13a2cb[_0x9f10('0x41')],_0x42f559[_0x9f10('0x48')]));_0x9f6f4b[_0x9f10('0x47')][_0x9f10('0x6a')]=_0x5bc6ce['id'];if(_0x13a2cb['query'][_0x9f10('0x4a')]){_0x9f6f4b[_0x9f10('0x47')]=_['merge'](_0x9f6f4b[_0x9f10('0x47')],{'$or':_[_0x9f10('0x3a')](_0x9f6f4b[_0x9f10('0x43')],function(_0x24118b){var _0x515b89={};_0x515b89[_0x24118b]={'$like':'%'+_0x13a2cb[_0x9f10('0x41')]['filter']+'%'};return _0x515b89;})});}_0x9f6f4b=_[_0x9f10('0x4b')]({},_0x9f6f4b,_0x13a2cb[_0x9f10('0x4d')]);return db[_0x9f10('0x66')]['count']({'where':_0x9f6f4b[_0x9f10('0x47')]})[_0x9f10('0x21')](function(_0x4139c6){_0x5bc191['count']=_0x4139c6;if(_0x13a2cb[_0x9f10('0x41')][_0x9f10('0x4f')]){_0x9f6f4b[_0x9f10('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x9f6f4b);})['then'](function(_0x5b78cd){_0x5bc191['rows']=_0x5b78cd;return _0x5bc191;});}})['then'](respondWithFilteredResult(_0x5302d3,_0x9f6f4b))['catch'](handleError(_0x5302d3,null));};exports[_0x9f10('0x6b')]=function(_0x2571a6,_0x4dc5d5,_0xa0988b){return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x2571a6[_0x9f10('0x64')]['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x4dc5d5,null))[_0x9f10('0x21')](function(_0x45ebcc){if(_0x45ebcc){return _0x45ebcc[_0x9f10('0x6b')](_0x2571a6[_0x9f10('0x41')][_0x9f10('0x6c')]);}})['then'](respondWithStatusCode(_0x4dc5d5,null))[_0x9f10('0x52')](handleError(_0x4dc5d5,null));};exports[_0x9f10('0x6d')]=function(_0x480978,_0x42a8bf,_0x5b2f86){if(_0x480978['body']['id']){delete _0x480978[_0x9f10('0x63')]['id'];}return db[_0x9f10('0x3b')]['find']({'where':{'id':_0x480978[_0x9f10('0x64')]['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x42a8bf,null))['then'](function(_0x3ef019){if(_0x3ef019){_0x480978[_0x9f10('0x63')][_0x9f10('0x6a')]=_0x3ef019['id'];return db['CannedAnswer'][_0x9f10('0x59')](_0x480978[_0x9f10('0x63')]);}})['then'](respondWithResult(_0x42a8bf,null))['catch'](handleError(_0x42a8bf,null));};exports[_0x9f10('0x6e')]=function(_0x3d64e8,_0x505e7a,_0x19b616){var _0x3f8cfd={'raw':![],'where':{}};var _0x4ceae4={};var _0x4db9be={'count':0x0,'rows':[]};return db[_0x9f10('0x3b')][_0x9f10('0x67')]({'where':{'id':_0x3d64e8['params']['id']}})['then'](handleEntityNotFound(_0x505e7a,null))[_0x9f10('0x21')](function(_0x13a8a8){if(_0x13a8a8){_0x4ceae4['model']=_[_0x9f10('0x56')](db[_0x9f10('0x6f')][_0x9f10('0x3c')]);_0x4ceae4[_0x9f10('0x41')]=_[_0x9f10('0x56')](_0x3d64e8['query']);_0x4ceae4['filters']=_['intersection'](_0x4ceae4[_0x9f10('0x40')],_0x4ceae4[_0x9f10('0x41')]);_0x3f8cfd[_0x9f10('0x43')]=_['intersection'](_0x4ceae4[_0x9f10('0x40')],qs['fields'](_0x3d64e8[_0x9f10('0x41')]['fields']));_0x3f8cfd['attributes']=_0x3f8cfd['attributes'][_0x9f10('0x57')]?_0x3f8cfd[_0x9f10('0x43')]:_0x4ceae4[_0x9f10('0x40')];if(!_0x3d64e8[_0x9f10('0x41')][_0x9f10('0x68')](_0x9f10('0x45'))){_0x3f8cfd[_0x9f10('0x30')]=qs[_0x9f10('0x30')](_0x3d64e8['query'][_0x9f10('0x30')]);_0x3f8cfd[_0x9f10('0x2f')]=qs[_0x9f10('0x2f')](_0x3d64e8['query'][_0x9f10('0x2f')]);}_0x3f8cfd[_0x9f10('0x69')]=qs[_0x9f10('0x46')](_0x3d64e8[_0x9f10('0x41')][_0x9f10('0x46')]);_0x3f8cfd['where']=qs[_0x9f10('0x48')](_['pick'](_0x3d64e8[_0x9f10('0x41')],_0x4ceae4[_0x9f10('0x48')]));_0x3f8cfd['where'][_0x9f10('0x6a')]=_0x13a8a8['id'];if(_0x3d64e8[_0x9f10('0x41')][_0x9f10('0x4a')]){_0x3f8cfd[_0x9f10('0x47')]=_['merge'](_0x3f8cfd[_0x9f10('0x47')],{'$or':_['map'](_0x3f8cfd[_0x9f10('0x43')],function(_0x40debc){var _0x4e0a49={};_0x4e0a49[_0x40debc]={'$like':'%'+_0x3d64e8['query'][_0x9f10('0x4a')]+'%'};return _0x4e0a49;})});}_0x3f8cfd=_['merge']({},_0x3f8cfd,_0x3d64e8['options']);return db['CannedAnswer'][_0x9f10('0x4e')]({'where':_0x3f8cfd[_0x9f10('0x47')]})['then'](function(_0x144567){_0x4db9be[_0x9f10('0x4e')]=_0x144567;if(_0x3d64e8[_0x9f10('0x41')][_0x9f10('0x4f')]){_0x3f8cfd[_0x9f10('0x58')]=[{'all':!![]}];}return db[_0x9f10('0x6f')][_0x9f10('0x50')](_0x3f8cfd);})[_0x9f10('0x21')](function(_0x15043f){_0x4db9be[_0x9f10('0x51')]=_0x15043f;return _0x4db9be;});}})['then'](respondWithFilteredResult(_0x505e7a,_0x3f8cfd))['catch'](handleError(_0x505e7a,null));};exports['removeAnswers']=function(_0x5bdcc3,_0x4222c6,_0xeaa529){return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x5bdcc3[_0x9f10('0x64')]['id']}})['then'](handleEntityNotFound(_0x4222c6,null))[_0x9f10('0x21')](function(_0x3dd01e){if(_0x3dd01e){return _0x3dd01e['removeAnswers'](_0x5bdcc3[_0x9f10('0x41')][_0x9f10('0x6c')]);}})[_0x9f10('0x21')](respondWithStatusCode(_0x4222c6,null))[_0x9f10('0x52')](handleError(_0x4222c6,null));};exports[_0x9f10('0x70')]=function(_0x2a9986,_0x4504bd,_0x405fca){return db[_0x9f10('0x3b')]['find']({'where':{'id':_0x2a9986['params']['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x4504bd,null))[_0x9f10('0x21')](function(_0x45c82c){if(_0x45c82c){return _0x45c82c[_0x9f10('0x70')](_0x2a9986['body'][_0x9f10('0x6c')],_[_0x9f10('0x71')](_0x2a9986[_0x9f10('0x63')],[_0x9f10('0x6c'),'id'])||{})[_0x9f10('0x72')](function(_0x2c4ce4){for(var _0x4cc25c=0x0;_0x4cc25c<_0x2a9986['body']['ids'][_0x9f10('0x57')];_0x4cc25c+=0x1){socket[_0x9f10('0x73')](_0x9f10('0x74'),{'UserId':_0x2a9986[_0x9f10('0x63')][_0x9f10('0x6c')][_0x4cc25c],'WhatsappAccountId':_0x2a9986[_0x9f10('0x64')]['id']});}return _0x2c4ce4;});}})[_0x9f10('0x21')](respondWithResult(_0x4504bd,null))[_0x9f10('0x52')](handleError(_0x4504bd,null));};exports[_0x9f10('0x75')]=function(_0x527cb4,_0x3fd751,_0x35a005){return db[_0x9f10('0x3b')]['find']({'where':{'id':_0x527cb4[_0x9f10('0x64')]['id']}})['then'](handleEntityNotFound(_0x3fd751,null))[_0x9f10('0x21')](function(_0x257daa){if(_0x257daa){return _0x257daa['removeAgents'](_0x527cb4[_0x9f10('0x41')][_0x9f10('0x6c')])[_0x9f10('0x21')](function(){if(_[_0x9f10('0x76')](_0x527cb4[_0x9f10('0x41')]['ids'])){for(var _0x442334=0x0;_0x442334<_0x527cb4['query'][_0x9f10('0x6c')]['length'];_0x442334+=0x1){socket['emit'](_0x9f10('0x77'),{'UserId':Number(_0x527cb4[_0x9f10('0x41')][_0x9f10('0x6c')][_0x442334]),'WhatsappAccountId':Number(_0x527cb4[_0x9f10('0x64')]['id'])});}}else{socket[_0x9f10('0x73')](_0x9f10('0x77'),{'UserId':Number(_0x527cb4['query'][_0x9f10('0x6c')]),'WhatsappAccountId':Number(_0x527cb4[_0x9f10('0x64')]['id'])});}});}})[_0x9f10('0x21')](respondWithStatusCode(_0x3fd751,null))[_0x9f10('0x52')](handleError(_0x3fd751,null));};exports[_0x9f10('0x78')]=function(_0x22add9,_0xf7c500,_0x4048ca){var _0x1ea477={};var _0x204b3e={};var _0x21b883;var _0x168bf3;return db['WhatsappAccount'][_0x9f10('0x67')]({'where':{'id':_0x22add9['params']['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0xf7c500,null))[_0x9f10('0x21')](function(_0x866476){if(_0x866476){_0x21b883=_0x866476;_0x204b3e['model']=_[_0x9f10('0x56')](db[_0x9f10('0x79')][_0x9f10('0x3c')]);_0x204b3e[_0x9f10('0x41')]=_[_0x9f10('0x56')](_0x22add9[_0x9f10('0x41')]);_0x204b3e['filters']=_[_0x9f10('0x42')](_0x204b3e[_0x9f10('0x40')],_0x204b3e['query']);_0x1ea477[_0x9f10('0x43')]=_[_0x9f10('0x42')](_0x204b3e[_0x9f10('0x40')],qs[_0x9f10('0x44')](_0x22add9['query']['fields']));_0x1ea477[_0x9f10('0x43')]=_0x1ea477['attributes'][_0x9f10('0x57')]?_0x1ea477[_0x9f10('0x43')]:_0x204b3e['model'];_0x1ea477[_0x9f10('0x69')]=qs[_0x9f10('0x46')](_0x22add9[_0x9f10('0x41')][_0x9f10('0x46')]);_0x1ea477['where']=qs[_0x9f10('0x48')](_[_0x9f10('0x49')](_0x22add9['query'],_0x204b3e[_0x9f10('0x48')]));if(_0x22add9['query']['filter']){_0x1ea477[_0x9f10('0x47')]=_[_0x9f10('0x4b')](_0x1ea477[_0x9f10('0x47')],{'$or':_[_0x9f10('0x3a')](_0x1ea477[_0x9f10('0x43')],function(_0x4e7496){var _0x3a1f83={};_0x3a1f83[_0x4e7496]={'$like':'%'+_0x22add9['query'][_0x9f10('0x4a')]+'%'};return _0x3a1f83;})});}_0x1ea477=_[_0x9f10('0x4b')]({},_0x1ea477,_0x22add9['options']);return _0x21b883[_0x9f10('0x78')](_0x1ea477);}})['then'](function(_0x3218b9){if(_0x3218b9){_0x168bf3=_0x3218b9[_0x9f10('0x57')];if(!_0x22add9[_0x9f10('0x41')][_0x9f10('0x68')](_0x9f10('0x45'))){_0x1ea477[_0x9f10('0x30')]=qs[_0x9f10('0x30')](_0x22add9[_0x9f10('0x41')]['limit']);_0x1ea477[_0x9f10('0x2f')]=qs[_0x9f10('0x2f')](_0x22add9[_0x9f10('0x41')][_0x9f10('0x2f')]);}return _0x21b883[_0x9f10('0x78')](_0x1ea477);}})[_0x9f10('0x21')](function(_0x21372c){if(_0x21372c){return _0x21372c?{'count':_0x168bf3,'rows':_0x21372c}:null;}})[_0x9f10('0x21')](respondWithResult(_0xf7c500,null))[_0x9f10('0x52')](handleError(_0xf7c500,null));};exports['addApplications']=function(_0x501562,_0x51a0db,_0xa2c256){return db['WhatsappAccount'][_0x9f10('0x67')]({'where':{'id':_0x501562[_0x9f10('0x64')]['id']}})['then'](handleEntityNotFound(_0x51a0db,null))[_0x9f10('0x21')](function(_0x1b48e0){if(_0x1b48e0){return db[_0x9f10('0x7a')][_0x9f10('0x7b')](function(_0x36d169){return db[_0x9f10('0x7c')][_0x9f10('0x35')]({'where':{'WhatsappAccountId':_0x501562[_0x9f10('0x64')]['id']},'transaction':_0x36d169})[_0x9f10('0x21')](function(_0x37eb7b){var _0x1bb7f5=_['map'](_0x501562[_0x9f10('0x63')],function(_0x195dca){_0x195dca[_0x9f10('0x6a')]=_0x501562[_0x9f10('0x64')]['id'];return _0x195dca;});return db['WhatsappApplication'][_0x9f10('0x7d')](_0x1bb7f5,{'transaction':_0x36d169});});})[_0x9f10('0x21')](function(){return db[_0x9f10('0x7c')][_0x9f10('0x7e')]({'where':{'WhatsappAccountId':_0x501562[_0x9f10('0x64')]['id']},'order':'priority'});});}})[_0x9f10('0x21')](respondWithResult(_0x51a0db,null))[_0x9f10('0x52')](handleError(_0x51a0db,null));};exports[_0x9f10('0x7f')]=function(_0xe1b053,_0x1e124e,_0x17bdee){var _0x12b9ec={};var _0x5da96e={};var _0x293341;var _0x5934ac;return db[_0x9f10('0x3b')][_0x9f10('0x67')]({'where':{'id':_0xe1b053[_0x9f10('0x64')]['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x1e124e,null))['then'](function(_0x4bb770){if(_0x4bb770){_0x293341=_0x4bb770;_0x5da96e[_0x9f10('0x40')]=_[_0x9f10('0x56')](db['WhatsappApplication'][_0x9f10('0x3c')]);_0x5da96e['query']=_[_0x9f10('0x56')](_0xe1b053[_0x9f10('0x41')]);_0x5da96e[_0x9f10('0x48')]=_[_0x9f10('0x42')](_0x5da96e[_0x9f10('0x40')],_0x5da96e[_0x9f10('0x41')]);_0x12b9ec[_0x9f10('0x43')]=_[_0x9f10('0x42')](_0x5da96e[_0x9f10('0x40')],qs[_0x9f10('0x44')](_0xe1b053['query']['fields']));_0x12b9ec['attributes']=_0x12b9ec[_0x9f10('0x43')][_0x9f10('0x57')]?_0x12b9ec[_0x9f10('0x43')]:_0x5da96e['model'];_0x12b9ec[_0x9f10('0x69')]=qs[_0x9f10('0x46')](_0xe1b053['query'][_0x9f10('0x46')]);_0x12b9ec[_0x9f10('0x47')]=qs[_0x9f10('0x48')](_[_0x9f10('0x49')](_0xe1b053[_0x9f10('0x41')],_0x5da96e[_0x9f10('0x48')]));if(_0xe1b053[_0x9f10('0x41')][_0x9f10('0x4a')]){_0x12b9ec[_0x9f10('0x47')]=_['merge'](_0x12b9ec[_0x9f10('0x47')],{'$or':_[_0x9f10('0x3a')](_0x12b9ec[_0x9f10('0x43')],function(_0x549b1f){var _0x1ae7e1={};_0x1ae7e1[_0x549b1f]={'$like':'%'+_0xe1b053[_0x9f10('0x41')][_0x9f10('0x4a')]+'%'};return _0x1ae7e1;})});}_0x12b9ec=_[_0x9f10('0x4b')]({},_0x12b9ec,_0xe1b053[_0x9f10('0x4d')]);return _0x293341[_0x9f10('0x7f')](_0x12b9ec);}})['then'](function(_0x30d249){if(_0x30d249){_0x5934ac=_0x30d249[_0x9f10('0x57')];if(!_0xe1b053['query'][_0x9f10('0x68')]('nolimit')){_0x12b9ec[_0x9f10('0x30')]=qs[_0x9f10('0x30')](_0xe1b053[_0x9f10('0x41')]['limit']);_0x12b9ec['offset']=qs[_0x9f10('0x2f')](_0xe1b053[_0x9f10('0x41')][_0x9f10('0x2f')]);}return _0x293341[_0x9f10('0x7f')](_0x12b9ec);}})[_0x9f10('0x21')](function(_0xe3cd33){if(_0xe3cd33){return _0xe3cd33?{'count':_0x5934ac,'rows':_0xe3cd33}:null;}})[_0x9f10('0x21')](respondWithResult(_0x1e124e,null))[_0x9f10('0x52')](handleError(_0x1e124e,null));};exports[_0x9f10('0x80')]=function(_0x598dd9,_0x2dc23f,_0x115b36){var _0x39087c={'channel':_0x9f10('0x81')};var _0x3f06ac=[];var _0xe1e75f=[];var _0xcd1fba={};return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x598dd9[_0x9f10('0x64')]['id']},'include':[{'model':db[_0x9f10('0x7c')],'as':_0x9f10('0x82')}]})['then'](handleEntityNotFound(_0x2dc23f,null))[_0x9f10('0x21')](function(_0x54900c){_0x39087c['account']=_0x54900c;_0x39087c[_0x9f10('0x83')]=_[_0x9f10('0x84')](_0x54900c[_0x9f10('0x82')],[_0x9f10('0x85')],[_0x9f10('0x86')]);if(_0x39087c['account']['Applications']){delete _0x39087c[_0x9f10('0x87')][_0x9f10('0x82')];}return db[_0x9f10('0x88')][_0x9f10('0x65')]();})['then'](function(_0x5bc74b){if(!_0x5bc74b){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0x8a'));}_0x3f06ac=_[_0x9f10('0x8b')](_[_0x9f10('0x56')](_0x5bc74b),[_0x9f10('0x8c'),'updatedAt']);_0xe1e75f=_[_0x9f10('0x8b')](_[_0x9f10('0x56')](_0x5bc74b),[_0x9f10('0x8c'),_0x9f10('0x8d'),'CompanyId',_0x9f10('0x8e')]);_0x39087c[_0x9f10('0x63')]={'mapKey':_0x9f10('0x8f')};if(_0x39087c[_0x9f10('0x87')][_0x9f10('0x3e')]&&_0x39087c[_0x9f10('0x87')][_0x9f10('0x3e')]===_0x9f10('0x90')){_0x39087c['body'][_0x9f10('0x91')]=_0x598dd9[_0x9f10('0x63')][_0x9f10('0x92')][_0x9f10('0x93')]('whatsapp:','');_0x39087c[_0x9f10('0x63')][_0x9f10('0x63')]=_0x598dd9[_0x9f10('0x63')]['Body'];_0x39087c[_0x9f10('0x63')][_0x9f10('0x94')]=_0x598dd9[_0x9f10('0x63')]['MessageSid'];}if(_0x39087c[_0x9f10('0x63')]['id']){delete _0x39087c[_0x9f10('0x63')]['id'];}if(_['isNil'](_0x39087c['body']['from'])){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0x95'));}if(_[_0x9f10('0x96')](_0x39087c[_0x9f10('0x63')]['body'])||_0x39087c[_0x9f10('0x63')]['body']===''){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9f10('0x96')](_0x39087c[_0x9f10('0x63')][_0x9f10('0x97')])){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0x98')+_0xe1e75f);}if(!_['includes'](_0xe1e75f,_0x39087c[_0x9f10('0x63')][_0x9f10('0x97')])){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0x99')+_0xe1e75f);}_0xcd1fba[_0x39087c[_0x9f10('0x63')][_0x9f10('0x97')]]=_0x39087c[_0x9f10('0x63')][_0x9f10('0x91')];return db['CmList'][_0x9f10('0x5e')]({'where':{'id':_0x39087c[_0x9f10('0x87')]['ListId']},'include':[{'model':db[_0x9f10('0x88')],'as':_0x9f10('0x9a'),'where':_0xcd1fba,'limit':0x1,'order':[[_0x9f10('0x8d'),'DESC']]}]});})[_0x9f10('0x21')](handleEntityNotFound(_0x2dc23f,null))[_0x9f10('0x21')](function(_0x2d2cc1){if(_0x2d2cc1){_0x39087c[_0x9f10('0x9b')]=_['omit'](_0x2d2cc1,['Contacts']);if(_0x2d2cc1['Contacts'][_0x9f10('0x57')]){return _0x2d2cc1[_0x9f10('0x9a')][0x0];}var _0x4ccd7a=_['defaults'](_0x39087c[_0x9f10('0x63')],{'firstName':_0x39087c['body']['from'],'ListId':_0x2d2cc1['id']});_0x4ccd7a[_0x39087c[_0x9f10('0x63')][_0x9f10('0x97')]]=_0x39087c[_0x9f10('0x63')][_0x9f10('0x91')];return db[_0x9f10('0x88')]['create'](_0x4ccd7a,{'fields':_0x3f06ac,'raw':!![]});}})[_0x9f10('0x21')](handleEntityNotFound(_0x2dc23f,null))['then'](function(_0x5782c2){if(_0x5782c2){_0x39087c[_0x9f10('0x9c')]=_0x5782c2;var _0xb658c8={'ContactId':_0x5782c2['id'],'phone':_0x39087c['body']['from'],'WhatsappAccountId':_0x598dd9[_0x9f10('0x64')]['id']};var _0xd36646={'ContactId':_0x5782c2['id'],'WhatsappAccountId':_0x598dd9[_0x9f10('0x64')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0xd36646})[_0x9f10('0x21')](function(_0x3bc4d9){if(_0x3bc4d9){return[_0x3bc4d9,![]];}return db[_0x9f10('0x9d')][_0x9f10('0x59')](_0xb658c8)[_0x9f10('0x21')](function(_0x4636fc){return[_0x4636fc,!![]];});});}})[_0x9f10('0x72')](function(_0x4853e0,_0x385f79){_0x39087c[_0x9f10('0x9e')]=_0x4853e0['get']({'plain':!![]});_0x39087c[_0x9f10('0x9e')][_0x9f10('0x9f')]=![];if(_0x385f79){if(_0x39087c['account'][_0x9f10('0xa0')]){_0x39087c[_0x9f10('0x83')][_0x9f10('0xa1')]({'id':0x0,'priority':_0x39087c[_0x9f10('0x83')][_0x9f10('0x57')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x9f10('0xa2')});}_0x39087c[_0x9f10('0x9e')][_0x9f10('0x9f')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x39087c[_0x9f10('0x63')][_0x9f10('0x91')],'messageId':_0x39087c['body']['messageId'],'body':_0x39087c['body']['body'],'WhatsappAccountId':_0x598dd9[_0x9f10('0x64')]['id'],'WhatsappInteractionId':_0x4853e0['id'],'direction':'in','ContactId':_0x4853e0[_0x9f10('0xa3')],'AttachmentId':_0x39087c[_0x9f10('0x63')][_0x9f10('0xa4')]});})[_0x9f10('0x21')](function(_0x1d49c1){_0x39087c['message']=_0x1d49c1;if(_0x39087c[_0x9f10('0x9e')][_0x9f10('0xa5')]){return db[_0x9f10('0x79')][_0x9f10('0x5e')]({'attributes':['id',_0x9f10('0x38')],'where':{'id':_0x39087c[_0x9f10('0x9e')][_0x9f10('0xa5')]}})[_0x9f10('0x21')](function(_0x162f72){if(_0x162f72){_0x39087c[_0x9f10('0x83')][_0x9f10('0xa6')]({'id':0x0,'priority':0x0,'app':_0x9f10('0xa7'),'appdata':_0x162f72[_0x9f10('0x38')]+','+(_0x39087c[_0x9f10('0x87')][_0x9f10('0xa8')]||0xa),'interval':_0x9f10('0xa2')});}return respondWithRpcPromise(_0x9f10('0xa9'),'startRouting',_0x39087c);});}return respondWithRpcPromise(_0x9f10('0xa9'),_0x9f10('0xaa'),_0x39087c);})[_0x9f10('0x21')](function(_0xad8d56){if(_0xad8d56){var _0x5a7bb8=0xc8;var _0x29465f=_0x9f10('0xab');logger[_0x9f10('0xac')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x29465f,_0x5a7bb8,_0x9f10('0xad'));logger['debug'](_0x9f10('0xae'),_0x29465f,_0x5a7bb8,'entity\x20found',JSON['stringify'](_0xad8d56));if(_0x39087c[_0x9f10('0x87')]['type']===_0x9f10('0x90')){return _0x2dc23f[_0x9f10('0x2c')](_0x5a7bb8)[_0x9f10('0x31')](_0x9f10('0xaf'),'text/xml')[_0x9f10('0xb0')](_0x9f10('0xb1'));}else{return _0x2dc23f[_0x9f10('0x2c')](_0x5a7bb8)['json'](_0xad8d56);}}})[_0x9f10('0x52')](handleError(_0x2dc23f,null));};exports[_0x9f10('0xb0')]=function(_0xe27bde,_0x136a3c,_0x3334fc){var _0x25ed02,_0x3a5932,_0x492f30;if(_['isNil'](_0xe27bde['body']['body'])||_0xe27bde[_0x9f10('0x63')][_0x9f10('0x63')]===''){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0xb2'));}if(_[_0x9f10('0x96')](_0xe27bde[_0x9f10('0x63')]['to'])){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0xb3'));}_0x25ed02=_0xe27bde[_0x9f10('0x63')]['to'];return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0xe27bde[_0x9f10('0x64')]['id']},'include':[{'model':db['CmList'],'as':_0x9f10('0xb4'),'include':[{'model':db[_0x9f10('0x88')],'as':_0x9f10('0x9a'),'where':{'mobile':_0x25ed02},'limit':0x1,'order':[[_0x9f10('0x8d'),_0x9f10('0xb5')]]}]}]})['then'](handleEntityNotFound(_0x136a3c,null))[_0x9f10('0x21')](function(_0x418e34){if(_0x418e34&&_0x418e34[_0x9f10('0xb4')]){_0x3a5932=_0x418e34[_0x9f10('0x36')]({'plain':!![]});if(_0x3a5932[_0x9f10('0xb4')]&&_0x3a5932[_0x9f10('0xb4')][_0x9f10('0x9a')][_0x9f10('0x57')]){return _0x3a5932[_0x9f10('0xb4')][_0x9f10('0x9a')][0x0];}return db[_0x9f10('0x88')][_0x9f10('0x59')](_[_0x9f10('0x18')](_0xe27bde[_0x9f10('0x63')],{'firstName':_0x25ed02,'mobile':_0x25ed02,'phone':_0x25ed02,'ListId':_0x3a5932[_0x9f10('0x8e')]}));}})[_0x9f10('0x21')](handleEntityNotFound(_0x136a3c,null))[_0x9f10('0x21')](function(_0x50d895){if(_0x50d895){_0x492f30=_0x50d895;return db[_0x9f10('0x9d')]['find']({'where':{'ContactId':_0x492f30['id'],'closed':![],'WhatsappAccountId':_0x3a5932['id']}})[_0x9f10('0x21')](function(_0xc4e595){if(_0xc4e595){return[_0xc4e595,![]];}return db[_0x9f10('0x9d')]['create']({'UserId':_0xe27bde[_0x9f10('0x5a')]['id'],'ContactId':_0x492f30['id'],'WhatsappAccountId':_0x3a5932['id'],'phone':_0x25ed02,'firstMsgDirection':_0x9f10('0xb6'),'Messages':[_[_0x9f10('0x4b')](_0xe27bde['body'],{'read':![],'body':_0xe27bde[_0x9f10('0x63')][_0x9f10('0x63')],'phone':_0x25ed02,'WhatsappAccountId':_0x3a5932['id'],'UserId':_0xe27bde[_0x9f10('0x5a')]['id'],'ContactId':_0x492f30['id']})]},{'include':[{'model':db[_0x9f10('0xb7')],'as':'Messages'}]})[_0x9f10('0x21')](function(_0x4aa55a){return[_0x4aa55a,!![]];});});}})[_0x9f10('0x72')](function(_0x1a843a,_0x18b8c1){if(_0x18b8c1){return _0x1a843a;}return db[_0x9f10('0xb7')]['create'](_[_0x9f10('0x4b')](_0xe27bde[_0x9f10('0x63')],{'read':![],'body':_0xe27bde[_0x9f10('0x63')][_0x9f10('0x63')],'phone':_0x25ed02,'WhatsappAccountId':_0x3a5932['id'],'WhatsappInteractionId':_0x1a843a['id'],'UserId':_0xe27bde[_0x9f10('0x5a')]['id'],'ContactId':_0x492f30['id']}))[_0x9f10('0x21')](function(_0x1ddcc2){_0x1a843a[_0x9f10('0xb8')][_0x9f10('0xb9')]=[];_0x1a843a['dataValues']['Messages'][_0x9f10('0xa1')](_0x1ddcc2[_0x9f10('0xb8')]);return _0x1a843a;});})[_0x9f10('0x21')](respondWithResult(_0x136a3c,null))['catch'](handleError(_0x136a3c,null));}; \ No newline at end of file +var _0xb62e=['filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','applications','orderBy','account','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','Body','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','get','stack','name','send','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','model','map','query','keys'];(function(_0x3ab2e2,_0x5bf6cb){var _0x365fe8=function(_0x40401b){while(--_0x40401b){_0x3ab2e2['push'](_0x3ab2e2['shift']());}};_0x365fe8(++_0x5bf6cb);}(_0xb62e,0x1de));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var as=require(_0xeb62('0x13'));var hardwareService=require(_0xeb62('0x14'));var logger=require(_0xeb62('0x15'))(_0xeb62('0x16'));var utils=require(_0xeb62('0x17'));var config=require(_0xeb62('0x18'));var db=require(_0xeb62('0x19'))['db'];config['redis']=_[_0xeb62('0x1a')](config[_0xeb62('0x1b')],{'host':_0xeb62('0x1c'),'port':0x18eb});var socket=require(_0xeb62('0x1d'))(new Redis(config['redis']));require(_0xeb62('0x1e'))[_0xeb62('0x1f')](socket);var jayson=require(_0xeb62('0x20'));var client=jayson['client'][_0xeb62('0x21')]({'port':0x232c});function checkPasswordPattern(_0x195837,_0x2fd4c7,_0x4ce9fa){if(_0x4ce9fa){var _0x1f6a1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f6a1f[_0xeb62('0x22')](_0x2fd4c7)){return _0x195837;}else{throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))](_0xeb62('0x25'));}}else{return _0x195837;}}function respondWithRpcPromise(_0x370474,_0x1fb460,_0x1324d7,_0x39b138){return new BPromise(function(_0x27fd84,_0x27efc8){var _0x11d516=_0x39b138||client;return _0x11d516[_0xeb62('0x26')](_0x370474,_0x1324d7)['then'](function(_0x38c5e4){logger[_0xeb62('0x27')](_0xeb62('0x28'),_0x1fb460,_0xeb62('0x29'));logger[_0xeb62('0x2a')](_0xeb62('0x2b'),_0x1fb460,_0xeb62('0x29'),JSON['stringify'](_0x38c5e4));if(_0x38c5e4['error']){if(_0x38c5e4[_0xeb62('0x2c')][_0xeb62('0x2d')]===0x1f4){logger[_0xeb62('0x2c')](_0xeb62('0x28'),_0x1fb460,_0x38c5e4[_0xeb62('0x2c')]['message']);return _0x27efc8(_0x38c5e4['error'][_0xeb62('0x2e')]);}logger[_0xeb62('0x2c')](_0xeb62('0x28'),_0x1fb460,_0x38c5e4[_0xeb62('0x2c')]['message']);return _0x27fd84(_0x38c5e4['error'][_0xeb62('0x2e')]);}else{logger['info'](_0xeb62('0x28'),_0x1fb460,'request\x20sent');_0x27fd84(_0x38c5e4[_0xeb62('0x2f')]['message']);}})[_0xeb62('0x30')](function(_0x6bfbbc){logger[_0xeb62('0x2c')]('WhatsappAccount,\x20%s,\x20%s',_0x1fb460,_0x6bfbbc);_0x27efc8(_0x6bfbbc);});});}function respondWithStatusCode(_0x3ef784,_0x3ae031){_0x3ae031=_0x3ae031||0xcc;return function(_0x5222f4){if(_0x5222f4){return _0x3ef784[_0xeb62('0x31')](_0x3ae031);}return _0x3ef784[_0xeb62('0x32')](_0x3ae031)[_0xeb62('0x33')]();};}function respondWithResult(_0x511202,_0x192517){_0x192517=_0x192517||0xc8;return function(_0x1616ee){if(_0x1616ee){return _0x511202['status'](_0x192517)[_0xeb62('0x34')](_0x1616ee);}};}function respondWithFilteredResult(_0x2b51b2,_0x2c967c){return function(_0x2c308c){if(_0x2c308c){var _0x235448=_0x2c308c[_0xeb62('0x35')],_0x5195bf=_0x2c967c[_0xeb62('0x36')],_0x4b58af=_0x2c967c[_0xeb62('0x36')]+_0x2c967c[_0xeb62('0x37')],_0x1248bb;if(_0x4b58af>=_0x235448){_0x4b58af=_0x235448;_0x1248bb=0xc8;}else{_0x1248bb=0xce;}_0x2b51b2[_0xeb62('0x32')](_0x1248bb);return _0x2b51b2[_0xeb62('0x38')]('Content-Range',_0x5195bf+'-'+_0x4b58af+'/'+_0x235448)[_0xeb62('0x34')](_0x2c308c);}return null;};}function patchUpdates(_0x47a94b){return function(_0x555db1){try{jsonpatch[_0xeb62('0x39')](_0x555db1,_0x47a94b,!![]);}catch(_0x286455){return BPromise['reject'](_0x286455);}return _0x555db1[_0xeb62('0x3a')]();};}function saveUpdates(_0x4bcfce,_0x1c2195){return function(_0xc0d2e4){if(_0xc0d2e4){return _0xc0d2e4['update'](_0x4bcfce)[_0xeb62('0x3b')](function(_0xe2589){return _0xe2589;});}return null;};}function removeEntity(_0x5914c9,_0x1b3a60){return function(_0x2a8087){if(_0x2a8087){return _0x2a8087[_0xeb62('0x3c')]()[_0xeb62('0x3b')](function(){var _0x513dd8=_0x2a8087[_0xeb62('0x3d')]({'plain':!![]});var _0x43685b='WhatsappAccounts';return db['UserProfileResource'][_0xeb62('0x3c')]({'where':{'type':_0x43685b,'resourceId':_0x513dd8['id']}})[_0xeb62('0x3b')](function(){return _0x2a8087;});})['then'](function(){_0x5914c9[_0xeb62('0x32')](0xcc)[_0xeb62('0x33')]();});}};}function handleEntityNotFound(_0x11eadb,_0x1f839a){return function(_0x21f604){if(!_0x21f604){_0x11eadb[_0xeb62('0x31')](0x194);}return _0x21f604;};}function handleError(_0x40106b,_0x4b22c8){_0x4b22c8=_0x4b22c8||0x1f4;return function(_0x54ea4b){logger[_0xeb62('0x2c')](_0x54ea4b[_0xeb62('0x3e')]);if(_0x54ea4b[_0xeb62('0x3f')]){delete _0x54ea4b[_0xeb62('0x3f')];}_0x40106b['status'](_0x4b22c8)[_0xeb62('0x40')](_0x54ea4b);};}exports['index']=function(_0x20fd7a,_0x1a007b){var _0x2dac2f={'include':[{'model':db[_0xeb62('0x41')],'as':_0xeb62('0x42')}]},_0x136c5a={},_0x1b133e={'count':0x0,'rows':[]};var _0x40e3a0=_['map'](db[_0xeb62('0x43')][_0xeb62('0x44')],function(_0x429fe4){return{'name':_0x429fe4[_0xeb62('0x45')],'type':_0x429fe4['type']['key']};});_0x136c5a[_0xeb62('0x46')]=_[_0xeb62('0x47')](_0x40e3a0,'name');_0x136c5a[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x20fd7a['query']);_0x136c5a[_0xeb62('0x4a')]=_['intersection'](_0x136c5a[_0xeb62('0x46')],_0x136c5a['query']);_0x2dac2f[_0xeb62('0x4b')]=_['intersection'](_0x136c5a[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x20fd7a[_0xeb62('0x48')]['fields']));_0x2dac2f['attributes']=_0x2dac2f[_0xeb62('0x4b')][_0xeb62('0x4d')]?_0x2dac2f[_0xeb62('0x4b')]:_0x136c5a[_0xeb62('0x46')];if(!_0x20fd7a[_0xeb62('0x48')]['hasOwnProperty'](_0xeb62('0x4e'))){_0x2dac2f['limit']=qs[_0xeb62('0x37')](_0x20fd7a['query'][_0xeb62('0x37')]);_0x2dac2f['offset']=qs[_0xeb62('0x36')](_0x20fd7a['query'][_0xeb62('0x36')]);}_0x2dac2f[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x20fd7a[_0xeb62('0x48')][_0xeb62('0x50')]);_0x2dac2f[_0xeb62('0x51')]=qs['filters'](_[_0xeb62('0x52')](_0x20fd7a[_0xeb62('0x48')],_0x136c5a['filters']),_0x40e3a0);if(_0x20fd7a['query']['filter']){_0x2dac2f['where']=_[_0xeb62('0x53')](_0x2dac2f[_0xeb62('0x51')],{'$or':_['map'](_0x40e3a0,function(_0x2fa41c){if(_0x2fa41c[_0xeb62('0x54')]!==_0xeb62('0x55')){var _0x16e262={};_0x16e262[_0x2fa41c[_0xeb62('0x3f')]]={'$like':'%'+_0x20fd7a['query'][_0xeb62('0x56')]+'%'};return _0x16e262;}})});}_0x2dac2f=_['merge']({},_0x2dac2f,_0x20fd7a[_0xeb62('0x57')]);var _0x2cf2b5={'where':_0x2dac2f[_0xeb62('0x51')]};return db[_0xeb62('0x43')][_0xeb62('0x35')](_0x2cf2b5)[_0xeb62('0x3b')](function(_0x321e55){_0x1b133e[_0xeb62('0x35')]=_0x321e55;if(_0x20fd7a[_0xeb62('0x48')][_0xeb62('0x58')]){_0x2dac2f[_0xeb62('0x59')]=[{'all':!![]}];}return db[_0xeb62('0x43')]['findAll'](_0x2dac2f);})[_0xeb62('0x3b')](function(_0x50bfec){_0x1b133e['rows']=_0x50bfec;return _0x1b133e;})[_0xeb62('0x3b')](respondWithFilteredResult(_0x1a007b,_0x2dac2f))[_0xeb62('0x30')](handleError(_0x1a007b,null));};exports['show']=function(_0x373505,_0x462760){var _0x5c8cb5={'raw':![],'where':{'id':_0x373505[_0xeb62('0x5a')]['id']},'include':[{'model':db[_0xeb62('0x41')],'as':_0xeb62('0x42')}]},_0x11297d={};_0x11297d[_0xeb62('0x46')]=_[_0xeb62('0x49')](db[_0xeb62('0x43')][_0xeb62('0x44')]);_0x11297d['query']=_[_0xeb62('0x49')](_0x373505['query']);_0x11297d[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x11297d[_0xeb62('0x46')],_0x11297d[_0xeb62('0x48')]);_0x5c8cb5[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x11297d[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x373505['query']['fields']));_0x5c8cb5['attributes']=_0x5c8cb5['attributes'][_0xeb62('0x4d')]?_0x5c8cb5['attributes']:_0x11297d[_0xeb62('0x46')];if(_0x373505['query'][_0xeb62('0x58')]){_0x5c8cb5[_0xeb62('0x59')]=[{'all':!![]}];}_0x5c8cb5=_[_0xeb62('0x53')]({},_0x5c8cb5,_0x373505['options']);return db[_0xeb62('0x43')][_0xeb62('0x5c')](_0x5c8cb5)['then'](handleEntityNotFound(_0x462760,null))[_0xeb62('0x3b')](respondWithResult(_0x462760,null))[_0xeb62('0x30')](handleError(_0x462760,null));};exports[_0xeb62('0x5d')]=function(_0x366312,_0x55370c){return db[_0xeb62('0x43')][_0xeb62('0x5d')](_0x366312['body'],{})[_0xeb62('0x3b')](function(_0x5d1415){var _0x10b1ef=_0x366312[_0xeb62('0x5e')][_0xeb62('0x3d')]({'plain':!![]});if(!_0x10b1ef)throw new Error(_0xeb62('0x5f'));if(_0x10b1ef[_0xeb62('0x60')]===_0xeb62('0x5e')){var _0x222d0c=_0x5d1415[_0xeb62('0x3d')]({'plain':!![]});var _0x130153=_0xeb62('0x61');return db[_0xeb62('0x62')][_0xeb62('0x5c')]({'where':{'name':_0x130153,'userProfileId':_0x10b1ef[_0xeb62('0x63')]},'raw':!![]})[_0xeb62('0x3b')](function(_0x5873c1){if(_0x5873c1&&_0x5873c1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x222d0c[_0xeb62('0x3f')],'resourceId':_0x222d0c['id'],'type':_0x5873c1['name'],'sectionId':_0x5873c1['id']},{})[_0xeb62('0x3b')](function(){return _0x5d1415;});}else{return _0x5d1415;}})[_0xeb62('0x30')](function(_0x5b8c4){logger[_0xeb62('0x2c')](_0xeb62('0x64'),_0x5b8c4);throw _0x5b8c4;});}return _0x5d1415;})[_0xeb62('0x3b')](respondWithResult(_0x55370c,0xc9))[_0xeb62('0x30')](handleError(_0x55370c,null));};exports[_0xeb62('0x65')]=function(_0x349916,_0x447e01){if(_0x349916['body']['id']){delete _0x349916[_0xeb62('0x66')]['id'];}return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x349916[_0xeb62('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xeb62('0x42')}]})[_0xeb62('0x3b')](handleEntityNotFound(_0x447e01,null))[_0xeb62('0x3b')](saveUpdates(_0x349916[_0xeb62('0x66')],null))[_0xeb62('0x3b')](respondWithResult(_0x447e01,null))[_0xeb62('0x30')](handleError(_0x447e01,null));};exports[_0xeb62('0x3c')]=function(_0x42af99,_0x2e1fb8){return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x42af99['params']['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x2e1fb8,null))[_0xeb62('0x3b')](removeEntity(_0x2e1fb8,null))[_0xeb62('0x30')](handleError(_0x2e1fb8,null));};exports[_0xeb62('0x67')]=function(_0x250294,_0x4363c2){return db[_0xeb62('0x43')][_0xeb62('0x67')]()[_0xeb62('0x3b')](respondWithResult(_0x4363c2,null))[_0xeb62('0x30')](handleError(_0x4363c2,null));};exports['addDisposition']=function(_0x106b8d,_0xedf007,_0xd96bbc){if(_0x106b8d[_0xeb62('0x66')]['id']){delete _0x106b8d['body']['id'];}return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x106b8d[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0xedf007,null))[_0xeb62('0x3b')](function(_0x32642f){if(_0x32642f){_0x106b8d['body'][_0xeb62('0x68')]=_0x32642f['id'];return db[_0xeb62('0x69')][_0xeb62('0x5d')](_0x106b8d[_0xeb62('0x66')]);}})[_0xeb62('0x3b')](respondWithResult(_0xedf007,null))[_0xeb62('0x30')](handleError(_0xedf007,null));};exports[_0xeb62('0x6a')]=function(_0x313d33,_0x233715,_0xf16846){var _0x1c3cb0={'raw':![],'where':{}};var _0x1bf4f2={};var _0x1cbf33={'count':0x0,'rows':[]};return db[_0xeb62('0x43')][_0xeb62('0x6b')]({'where':{'id':_0x313d33[_0xeb62('0x5a')]['id']}})['then'](handleEntityNotFound(_0x233715,null))[_0xeb62('0x3b')](function(_0x5cca51){if(_0x5cca51){_0x1bf4f2[_0xeb62('0x46')]=_[_0xeb62('0x49')](db['Disposition'][_0xeb62('0x44')]);_0x1bf4f2[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x313d33[_0xeb62('0x48')]);_0x1bf4f2[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x1bf4f2[_0xeb62('0x46')],_0x1bf4f2[_0xeb62('0x48')]);_0x1c3cb0[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x1bf4f2[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x313d33[_0xeb62('0x48')]['fields']));_0x1c3cb0[_0xeb62('0x4b')]=_0x1c3cb0[_0xeb62('0x4b')]['length']?_0x1c3cb0[_0xeb62('0x4b')]:_0x1bf4f2['model'];if(!_0x313d33[_0xeb62('0x48')][_0xeb62('0x6c')](_0xeb62('0x4e'))){_0x1c3cb0[_0xeb62('0x37')]=qs[_0xeb62('0x37')](_0x313d33[_0xeb62('0x48')]['limit']);_0x1c3cb0[_0xeb62('0x36')]=qs['offset'](_0x313d33[_0xeb62('0x48')][_0xeb62('0x36')]);}_0x1c3cb0[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x313d33[_0xeb62('0x48')]['sort']);_0x1c3cb0[_0xeb62('0x51')]=qs[_0xeb62('0x4a')](_[_0xeb62('0x52')](_0x313d33['query'],_0x1bf4f2[_0xeb62('0x4a')]));_0x1c3cb0[_0xeb62('0x51')][_0xeb62('0x68')]=_0x5cca51['id'];if(_0x313d33[_0xeb62('0x48')][_0xeb62('0x56')]){_0x1c3cb0[_0xeb62('0x51')]=_['merge'](_0x1c3cb0['where'],{'$or':_['map'](_0x1c3cb0['attributes'],function(_0x5bf6f6){var _0x1f8c00={};_0x1f8c00[_0x5bf6f6]={'$like':'%'+_0x313d33[_0xeb62('0x48')][_0xeb62('0x56')]+'%'};return _0x1f8c00;})});}_0x1c3cb0=_[_0xeb62('0x53')]({},_0x1c3cb0,_0x313d33[_0xeb62('0x57')]);return db[_0xeb62('0x69')][_0xeb62('0x35')]({'where':_0x1c3cb0[_0xeb62('0x51')]})[_0xeb62('0x3b')](function(_0x2c6bb3){_0x1cbf33[_0xeb62('0x35')]=_0x2c6bb3;if(_0x313d33[_0xeb62('0x48')]['includeAll']){_0x1c3cb0[_0xeb62('0x59')]=[{'all':!![]}];}return db[_0xeb62('0x69')][_0xeb62('0x6d')](_0x1c3cb0);})[_0xeb62('0x3b')](function(_0x25106d){_0x1cbf33[_0xeb62('0x6e')]=_0x25106d;return _0x1cbf33;});}})[_0xeb62('0x3b')](respondWithFilteredResult(_0x233715,_0x1c3cb0))[_0xeb62('0x30')](handleError(_0x233715,null));};exports[_0xeb62('0x6f')]=function(_0x33b16b,_0x124847,_0x17beef){return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x33b16b[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x124847,null))[_0xeb62('0x3b')](function(_0x2f5f2f){if(_0x2f5f2f){return _0x2f5f2f['removeDispositions'](_0x33b16b[_0xeb62('0x48')]['ids']);}})[_0xeb62('0x3b')](respondWithStatusCode(_0x124847,null))[_0xeb62('0x30')](handleError(_0x124847,null));};exports['addAnswer']=function(_0x1d909f,_0x4e3c6c,_0x51e954){if(_0x1d909f[_0xeb62('0x66')]['id']){delete _0x1d909f[_0xeb62('0x66')]['id'];}return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x1d909f['params']['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x4e3c6c,null))[_0xeb62('0x3b')](function(_0x4ca889){if(_0x4ca889){_0x1d909f[_0xeb62('0x66')][_0xeb62('0x68')]=_0x4ca889['id'];return db[_0xeb62('0x70')][_0xeb62('0x5d')](_0x1d909f[_0xeb62('0x66')]);}})[_0xeb62('0x3b')](respondWithResult(_0x4e3c6c,null))[_0xeb62('0x30')](handleError(_0x4e3c6c,null));};exports[_0xeb62('0x71')]=function(_0x59740f,_0x32ae8e,_0x2e57b2){var _0x5b1bfc={'raw':![],'where':{}};var _0x3c6de8={};var _0x5c83b8={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xeb62('0x6b')]({'where':{'id':_0x59740f[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x32ae8e,null))[_0xeb62('0x3b')](function(_0x25a646){if(_0x25a646){_0x3c6de8['model']=_[_0xeb62('0x49')](db[_0xeb62('0x70')][_0xeb62('0x44')]);_0x3c6de8[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x59740f[_0xeb62('0x48')]);_0x3c6de8[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x3c6de8['model'],_0x3c6de8['query']);_0x5b1bfc[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x3c6de8[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x59740f['query'][_0xeb62('0x4c')]));_0x5b1bfc['attributes']=_0x5b1bfc['attributes'][_0xeb62('0x4d')]?_0x5b1bfc[_0xeb62('0x4b')]:_0x3c6de8['model'];if(!_0x59740f[_0xeb62('0x48')]['hasOwnProperty'](_0xeb62('0x4e'))){_0x5b1bfc[_0xeb62('0x37')]=qs[_0xeb62('0x37')](_0x59740f['query']['limit']);_0x5b1bfc[_0xeb62('0x36')]=qs[_0xeb62('0x36')](_0x59740f[_0xeb62('0x48')]['offset']);}_0x5b1bfc[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x59740f[_0xeb62('0x48')][_0xeb62('0x50')]);_0x5b1bfc[_0xeb62('0x51')]=qs[_0xeb62('0x4a')](_['pick'](_0x59740f['query'],_0x3c6de8['filters']));_0x5b1bfc[_0xeb62('0x51')]['WhatsappAccountId']=_0x25a646['id'];if(_0x59740f['query'][_0xeb62('0x56')]){_0x5b1bfc['where']=_['merge'](_0x5b1bfc['where'],{'$or':_[_0xeb62('0x47')](_0x5b1bfc['attributes'],function(_0x2c9fe5){var _0x169b13={};_0x169b13[_0x2c9fe5]={'$like':'%'+_0x59740f[_0xeb62('0x48')][_0xeb62('0x56')]+'%'};return _0x169b13;})});}_0x5b1bfc=_[_0xeb62('0x53')]({},_0x5b1bfc,_0x59740f[_0xeb62('0x57')]);return db[_0xeb62('0x70')]['count']({'where':_0x5b1bfc['where']})[_0xeb62('0x3b')](function(_0x4037c9){_0x5c83b8[_0xeb62('0x35')]=_0x4037c9;if(_0x59740f[_0xeb62('0x48')][_0xeb62('0x58')]){_0x5b1bfc['include']=[{'all':!![]}];}return db[_0xeb62('0x70')][_0xeb62('0x6d')](_0x5b1bfc);})[_0xeb62('0x3b')](function(_0x4790e4){_0x5c83b8[_0xeb62('0x6e')]=_0x4790e4;return _0x5c83b8;});}})['then'](respondWithFilteredResult(_0x32ae8e,_0x5b1bfc))[_0xeb62('0x30')](handleError(_0x32ae8e,null));};exports[_0xeb62('0x72')]=function(_0x4ff08a,_0x50cb9a,_0x2efd4a){return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x4ff08a[_0xeb62('0x5a')]['id']}})['then'](handleEntityNotFound(_0x50cb9a,null))[_0xeb62('0x3b')](function(_0x19e57f){if(_0x19e57f){return _0x19e57f['removeAnswers'](_0x4ff08a['query'][_0xeb62('0x73')]);}})[_0xeb62('0x3b')](respondWithStatusCode(_0x50cb9a,null))[_0xeb62('0x30')](handleError(_0x50cb9a,null));};exports[_0xeb62('0x74')]=function(_0x396185,_0x3ce2da,_0x1a2427){return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x396185[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x3ce2da,null))[_0xeb62('0x3b')](function(_0x135565){if(_0x135565){return _0x135565[_0xeb62('0x74')](_0x396185[_0xeb62('0x66')][_0xeb62('0x73')],_['omit'](_0x396185[_0xeb62('0x66')],[_0xeb62('0x73'),'id'])||{})[_0xeb62('0x75')](function(_0x122478){for(var _0x3cfa34=0x0;_0x3cfa34<_0x396185['body']['ids'][_0xeb62('0x4d')];_0x3cfa34+=0x1){socket[_0xeb62('0x76')](_0xeb62('0x77'),{'UserId':_0x396185[_0xeb62('0x66')]['ids'][_0x3cfa34],'WhatsappAccountId':_0x396185[_0xeb62('0x5a')]['id']});}return _0x122478;});}})['then'](respondWithResult(_0x3ce2da,null))[_0xeb62('0x30')](handleError(_0x3ce2da,null));};exports[_0xeb62('0x78')]=function(_0x3409db,_0x13f8e2,_0x1fa174){return db['WhatsappAccount'][_0xeb62('0x5c')]({'where':{'id':_0x3409db[_0xeb62('0x5a')]['id']}})['then'](handleEntityNotFound(_0x13f8e2,null))[_0xeb62('0x3b')](function(_0x5357fe){if(_0x5357fe){return _0x5357fe[_0xeb62('0x78')](_0x3409db[_0xeb62('0x48')][_0xeb62('0x73')])[_0xeb62('0x3b')](function(){if(_[_0xeb62('0x79')](_0x3409db[_0xeb62('0x48')]['ids'])){for(var _0x506aaa=0x0;_0x506aaa<_0x3409db[_0xeb62('0x48')][_0xeb62('0x73')][_0xeb62('0x4d')];_0x506aaa+=0x1){socket[_0xeb62('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x3409db['query'][_0xeb62('0x73')][_0x506aaa]),'WhatsappAccountId':Number(_0x3409db['params']['id'])});}}else{socket[_0xeb62('0x76')](_0xeb62('0x7a'),{'UserId':Number(_0x3409db[_0xeb62('0x48')]['ids']),'WhatsappAccountId':Number(_0x3409db[_0xeb62('0x5a')]['id'])});}});}})[_0xeb62('0x3b')](respondWithStatusCode(_0x13f8e2,null))[_0xeb62('0x30')](handleError(_0x13f8e2,null));};exports[_0xeb62('0x7b')]=function(_0x37da44,_0x10731b,_0x369e59){var _0xb6826b={};var _0x4e25ac={};var _0x499b00;var _0x3fa8cf;return db[_0xeb62('0x43')][_0xeb62('0x6b')]({'where':{'id':_0x37da44['params']['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x10731b,null))[_0xeb62('0x3b')](function(_0xf3b5ac){if(_0xf3b5ac){_0x499b00=_0xf3b5ac;_0x4e25ac[_0xeb62('0x46')]=_[_0xeb62('0x49')](db['User'][_0xeb62('0x44')]);_0x4e25ac[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x37da44[_0xeb62('0x48')]);_0x4e25ac[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x4e25ac[_0xeb62('0x46')],_0x4e25ac[_0xeb62('0x48')]);_0xb6826b[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x4e25ac['model'],qs[_0xeb62('0x4c')](_0x37da44[_0xeb62('0x48')]['fields']));_0xb6826b['attributes']=_0xb6826b[_0xeb62('0x4b')][_0xeb62('0x4d')]?_0xb6826b[_0xeb62('0x4b')]:_0x4e25ac[_0xeb62('0x46')];_0xb6826b[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x37da44[_0xeb62('0x48')][_0xeb62('0x50')]);_0xb6826b[_0xeb62('0x51')]=qs['filters'](_['pick'](_0x37da44[_0xeb62('0x48')],_0x4e25ac[_0xeb62('0x4a')]));if(_0x37da44['query']['filter']){_0xb6826b[_0xeb62('0x51')]=_[_0xeb62('0x53')](_0xb6826b[_0xeb62('0x51')],{'$or':_['map'](_0xb6826b['attributes'],function(_0x17aeb5){var _0x57007e={};_0x57007e[_0x17aeb5]={'$like':'%'+_0x37da44[_0xeb62('0x48')][_0xeb62('0x56')]+'%'};return _0x57007e;})});}_0xb6826b=_[_0xeb62('0x53')]({},_0xb6826b,_0x37da44['options']);return _0x499b00['getAgents'](_0xb6826b);}})['then'](function(_0x198f63){if(_0x198f63){_0x3fa8cf=_0x198f63[_0xeb62('0x4d')];if(!_0x37da44[_0xeb62('0x48')][_0xeb62('0x6c')]('nolimit')){_0xb6826b[_0xeb62('0x37')]=qs[_0xeb62('0x37')](_0x37da44[_0xeb62('0x48')][_0xeb62('0x37')]);_0xb6826b[_0xeb62('0x36')]=qs[_0xeb62('0x36')](_0x37da44[_0xeb62('0x48')][_0xeb62('0x36')]);}return _0x499b00['getAgents'](_0xb6826b);}})[_0xeb62('0x3b')](function(_0x110a00){if(_0x110a00){return _0x110a00?{'count':_0x3fa8cf,'rows':_0x110a00}:null;}})[_0xeb62('0x3b')](respondWithResult(_0x10731b,null))[_0xeb62('0x30')](handleError(_0x10731b,null));};exports['addApplications']=function(_0x60237b,_0x1f84f0,_0x497cea){return db[_0xeb62('0x43')][_0xeb62('0x6b')]({'where':{'id':_0x60237b[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x1f84f0,null))[_0xeb62('0x3b')](function(_0x4653b6){if(_0x4653b6){return db[_0xeb62('0x7c')]['transaction'](function(_0x247bed){return db['WhatsappApplication'][_0xeb62('0x3c')]({'where':{'WhatsappAccountId':_0x60237b[_0xeb62('0x5a')]['id']},'transaction':_0x247bed})[_0xeb62('0x3b')](function(_0x4f8597){var _0x4b4358=_[_0xeb62('0x47')](_0x60237b[_0xeb62('0x66')],function(_0x2e27a5){_0x2e27a5[_0xeb62('0x68')]=_0x60237b[_0xeb62('0x5a')]['id'];return _0x2e27a5;});return db[_0xeb62('0x7d')][_0xeb62('0x7e')](_0x4b4358,{'transaction':_0x247bed});});})[_0xeb62('0x3b')](function(){return db[_0xeb62('0x7d')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x60237b[_0xeb62('0x5a')]['id']},'order':_0xeb62('0x7f')});});}})[_0xeb62('0x3b')](respondWithResult(_0x1f84f0,null))[_0xeb62('0x30')](handleError(_0x1f84f0,null));};exports[_0xeb62('0x80')]=function(_0x4dc827,_0x36a455,_0x47f64b){var _0x185d14={};var _0x2d2b3c={};var _0x129fbc;var _0x2814d2;return db['WhatsappAccount']['findOne']({'where':{'id':_0x4dc827['params']['id']}})['then'](handleEntityNotFound(_0x36a455,null))[_0xeb62('0x3b')](function(_0x5933a1){if(_0x5933a1){_0x129fbc=_0x5933a1;_0x2d2b3c[_0xeb62('0x46')]=_[_0xeb62('0x49')](db[_0xeb62('0x7d')][_0xeb62('0x44')]);_0x2d2b3c[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x4dc827[_0xeb62('0x48')]);_0x2d2b3c[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x2d2b3c[_0xeb62('0x46')],_0x2d2b3c['query']);_0x185d14[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x2d2b3c[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x4dc827[_0xeb62('0x48')][_0xeb62('0x4c')]));_0x185d14[_0xeb62('0x4b')]=_0x185d14[_0xeb62('0x4b')][_0xeb62('0x4d')]?_0x185d14['attributes']:_0x2d2b3c[_0xeb62('0x46')];_0x185d14[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x4dc827['query'][_0xeb62('0x50')]);_0x185d14['where']=qs[_0xeb62('0x4a')](_[_0xeb62('0x52')](_0x4dc827['query'],_0x2d2b3c[_0xeb62('0x4a')]));if(_0x4dc827['query'][_0xeb62('0x56')]){_0x185d14[_0xeb62('0x51')]=_[_0xeb62('0x53')](_0x185d14[_0xeb62('0x51')],{'$or':_[_0xeb62('0x47')](_0x185d14[_0xeb62('0x4b')],function(_0x38e8ab){var _0xc183c7={};_0xc183c7[_0x38e8ab]={'$like':'%'+_0x4dc827[_0xeb62('0x48')][_0xeb62('0x56')]+'%'};return _0xc183c7;})});}_0x185d14=_['merge']({},_0x185d14,_0x4dc827[_0xeb62('0x57')]);return _0x129fbc[_0xeb62('0x80')](_0x185d14);}})[_0xeb62('0x3b')](function(_0x4bb3cd){if(_0x4bb3cd){_0x2814d2=_0x4bb3cd[_0xeb62('0x4d')];if(!_0x4dc827['query']['hasOwnProperty']('nolimit')){_0x185d14['limit']=qs[_0xeb62('0x37')](_0x4dc827[_0xeb62('0x48')]['limit']);_0x185d14[_0xeb62('0x36')]=qs[_0xeb62('0x36')](_0x4dc827[_0xeb62('0x48')][_0xeb62('0x36')]);}return _0x129fbc[_0xeb62('0x80')](_0x185d14);}})[_0xeb62('0x3b')](function(_0xe5fbf){if(_0xe5fbf){return _0xe5fbf?{'count':_0x2814d2,'rows':_0xe5fbf}:null;}})[_0xeb62('0x3b')](respondWithResult(_0x36a455,null))[_0xeb62('0x30')](handleError(_0x36a455,null));};exports[_0xeb62('0x81')]=function(_0x15aa4e,_0x51146f,_0xc8c0dd){var _0x4c56a2={'channel':_0xeb62('0x82')};var _0xd33486=[];var _0x2750a9=[];var _0x4f045a={};return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x15aa4e[_0xeb62('0x5a')]['id']},'include':[{'model':db[_0xeb62('0x7d')],'as':_0xeb62('0x83')}]})[_0xeb62('0x3b')](handleEntityNotFound(_0x51146f,null))['then'](function(_0x5782de){_0x4c56a2['account']=_0x5782de;_0x4c56a2[_0xeb62('0x84')]=_[_0xeb62('0x85')](_0x5782de[_0xeb62('0x83')],[_0xeb62('0x7f')],['asc']);if(_0x4c56a2[_0xeb62('0x86')]['Applications']){delete _0x4c56a2[_0xeb62('0x86')]['Applications'];}return db['CmContact'][_0xeb62('0x67')]();})[_0xeb62('0x3b')](function(_0x21aef2){if(!_0x21aef2){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))](_0xeb62('0x87'));}_0xd33486=_[_0xeb62('0x88')](_[_0xeb62('0x49')](_0x21aef2),[_0xeb62('0x89'),_0xeb62('0x8a')]);_0x2750a9=_[_0xeb62('0x88')](_[_0xeb62('0x49')](_0x21aef2),['createdAt',_0xeb62('0x8a'),'CompanyId',_0xeb62('0x8b')]);_0x4c56a2[_0xeb62('0x66')]={'mapKey':_0xeb62('0x8c')};if(_0x4c56a2[_0xeb62('0x86')]['type']&&_0x4c56a2[_0xeb62('0x86')][_0xeb62('0x54')]===_0xeb62('0x8d')){_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x8e')]=_0x15aa4e['body'][_0xeb62('0x8f')][_0xeb62('0x90')]('whatsapp:','');_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x66')]=_0x15aa4e[_0xeb62('0x66')][_0xeb62('0x91')];_0x4c56a2['body']['messageId']=_0x15aa4e['body']['MessageSid'];}if(_0x4c56a2[_0xeb62('0x66')]['id']){delete _0x4c56a2[_0xeb62('0x66')]['id'];}if(_[_0xeb62('0x92')](_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x8e')])){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))]('from\x20is\x20mandatory');}if(_[_0xeb62('0x92')](_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x66')])||_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x66')]===''){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xeb62('0x92')](_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x93')])){throw new db[(_0xeb62('0x23'))]['ValidationError'](_0xeb62('0x94')+_0x2750a9);}if(!_[_0xeb62('0x95')](_0x2750a9,_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x93')])){throw new db['Sequelize'][(_0xeb62('0x24'))](_0xeb62('0x96')+_0x2750a9);}_0x4f045a[_0x4c56a2[_0xeb62('0x66')]['mapKey']]=_0x4c56a2[_0xeb62('0x66')]['from'];return db[_0xeb62('0x97')][_0xeb62('0x5c')]({'where':{'id':_0x4c56a2[_0xeb62('0x86')]['ListId']},'include':[{'model':db[_0xeb62('0x98')],'as':'Contacts','where':_0x4f045a,'limit':0x1,'order':[[_0xeb62('0x8a'),_0xeb62('0x99')]]}]});})['then'](handleEntityNotFound(_0x51146f,null))['then'](function(_0xa2aa96){if(_0xa2aa96){_0x4c56a2[_0xeb62('0x9a')]=_[_0xeb62('0x9b')](_0xa2aa96,['Contacts']);if(_0xa2aa96[_0xeb62('0x9c')][_0xeb62('0x4d')]){return _0xa2aa96[_0xeb62('0x9c')][0x0];}var _0x50476a=_[_0xeb62('0x1a')](_0x4c56a2[_0xeb62('0x66')],{'firstName':_0x4c56a2['body'][_0xeb62('0x8e')],'ListId':_0xa2aa96['id']});_0x50476a[_0x4c56a2['body'][_0xeb62('0x93')]]=_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x8e')];return db[_0xeb62('0x98')][_0xeb62('0x5d')](_0x50476a,{'fields':_0xd33486,'raw':!![]});}})[_0xeb62('0x3b')](handleEntityNotFound(_0x51146f,null))['then'](function(_0x25fa4b){if(_0x25fa4b){_0x4c56a2['contact']=_0x25fa4b;var _0x47ad09={'ContactId':_0x25fa4b['id'],'phone':_0x4c56a2['body'][_0xeb62('0x8e')],'WhatsappAccountId':_0x15aa4e[_0xeb62('0x5a')]['id']};var _0x14da9d={'ContactId':_0x25fa4b['id'],'WhatsappAccountId':_0x15aa4e[_0xeb62('0x5a')]['id'],'closed':![]};return db[_0xeb62('0x9d')][_0xeb62('0x5c')]({'where':_0x14da9d})[_0xeb62('0x3b')](function(_0x525068){if(_0x525068){return[_0x525068,![]];}return db[_0xeb62('0x9d')][_0xeb62('0x5d')](_0x47ad09)[_0xeb62('0x3b')](function(_0x31c8db){return[_0x31c8db,!![]];});});}})['spread'](function(_0x3b10aa,_0x4807d2){_0x4c56a2[_0xeb62('0x9e')]=_0x3b10aa[_0xeb62('0x3d')]({'plain':!![]});_0x4c56a2[_0xeb62('0x9e')][_0xeb62('0x9f')]=![];if(_0x4807d2){if(_0x4c56a2[_0xeb62('0x86')][_0xeb62('0xa0')]){_0x4c56a2['applications'][_0xeb62('0xa1')]({'id':0x0,'priority':_0x4c56a2[_0xeb62('0x84')][_0xeb62('0x4d')]+0x1,'app':_0xeb62('0xa2'),'appdata':_0xeb62('0xa3'),'interval':_0xeb62('0xa4')});}_0x4c56a2['interaction'][_0xeb62('0x9f')]=!![];}return db[_0xeb62('0xa5')][_0xeb62('0x5d')]({'phone':_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x8e')],'messageId':_0x4c56a2['body']['messageId'],'body':_0x4c56a2[_0xeb62('0x66')]['body'],'WhatsappAccountId':_0x15aa4e['params']['id'],'WhatsappInteractionId':_0x3b10aa['id'],'direction':'in','ContactId':_0x3b10aa['ContactId'],'AttachmentId':_0x4c56a2[_0xeb62('0x66')]['AttachmentId']});})[_0xeb62('0x3b')](function(_0x35d95b){_0x4c56a2[_0xeb62('0x2e')]=_0x35d95b;if(_0x4c56a2[_0xeb62('0x9e')]['UserId']){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x4c56a2[_0xeb62('0x9e')][_0xeb62('0xa6')]}})[_0xeb62('0x3b')](function(_0x38d61b){if(_0x38d61b){_0x4c56a2['applications'][_0xeb62('0xa7')]({'id':0x0,'priority':0x0,'app':_0xeb62('0xa8'),'appdata':_0x38d61b[_0xeb62('0x3f')]+','+(_0x4c56a2[_0xeb62('0x86')][_0xeb62('0xa9')]||0xa),'interval':_0xeb62('0xa4')});}return respondWithRpcPromise(_0xeb62('0xaa'),_0xeb62('0xab'),_0x4c56a2);});}return respondWithRpcPromise(_0xeb62('0xaa'),_0xeb62('0xab'),_0x4c56a2);})['then'](function(_0xf1d63e){if(_0xf1d63e){var _0x16d9a7=0xc8;var _0x4b0f92=_0xeb62('0xac');logger[_0xeb62('0x27')](_0xeb62('0x2b'),_0x4b0f92,_0x16d9a7,_0xeb62('0xad'));logger[_0xeb62('0x2a')](_0xeb62('0xae'),_0x4b0f92,_0x16d9a7,'entity\x20found',JSON[_0xeb62('0xaf')](_0xf1d63e));if(_0x4c56a2['account'][_0xeb62('0x54')]===_0xeb62('0x8d')){return _0x51146f['status'](_0x16d9a7)[_0xeb62('0x38')](_0xeb62('0xb0'),_0xeb62('0xb1'))[_0xeb62('0x40')](_0xeb62('0xb2'));}else{return _0x51146f['status'](_0x16d9a7)[_0xeb62('0x34')](_0xf1d63e);}}})[_0xeb62('0x30')](handleError(_0x51146f,null));};exports[_0xeb62('0x40')]=function(_0x580f2f,_0xad9214,_0x563133){var _0x37f856,_0x47c79b,_0x177937;if(_[_0xeb62('0x92')](_0x580f2f[_0xeb62('0x66')]['body'])||_0x580f2f['body'][_0xeb62('0x66')]===''){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))](_0xeb62('0xb3'));}if(_[_0xeb62('0x92')](_0x580f2f[_0xeb62('0x66')]['to'])){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))]('to\x20is\x20mandatory');}_0x37f856=_0x580f2f[_0xeb62('0x66')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x580f2f[_0xeb62('0x5a')]['id']},'include':[{'model':db[_0xeb62('0x97')],'as':'List','include':[{'model':db[_0xeb62('0x98')],'as':_0xeb62('0x9c'),'where':{'mobile':_0x37f856},'limit':0x1,'order':[[_0xeb62('0x8a'),_0xeb62('0x99')]]}]}]})[_0xeb62('0x3b')](handleEntityNotFound(_0xad9214,null))[_0xeb62('0x3b')](function(_0xf6a52c){if(_0xf6a52c&&_0xf6a52c[_0xeb62('0xb4')]){_0x47c79b=_0xf6a52c[_0xeb62('0x3d')]({'plain':!![]});if(_0x47c79b[_0xeb62('0xb4')]&&_0x47c79b[_0xeb62('0xb4')][_0xeb62('0x9c')][_0xeb62('0x4d')]){return _0x47c79b[_0xeb62('0xb4')][_0xeb62('0x9c')][0x0];}return db[_0xeb62('0x98')]['create'](_[_0xeb62('0x1a')](_0x580f2f[_0xeb62('0x66')],{'firstName':_0x37f856,'mobile':_0x37f856,'phone':_0x37f856,'ListId':_0x47c79b[_0xeb62('0x8b')]}));}})[_0xeb62('0x3b')](handleEntityNotFound(_0xad9214,null))[_0xeb62('0x3b')](function(_0x527b5b){if(_0x527b5b){_0x177937=_0x527b5b;return db[_0xeb62('0x9d')][_0xeb62('0x5c')]({'where':{'ContactId':_0x177937['id'],'closed':![],'WhatsappAccountId':_0x47c79b['id']}})[_0xeb62('0x3b')](function(_0x1f8355){if(_0x1f8355){return[_0x1f8355,![]];}return db['WhatsappInteraction'][_0xeb62('0x5d')]({'UserId':_0x580f2f['user']['id'],'ContactId':_0x177937['id'],'WhatsappAccountId':_0x47c79b['id'],'phone':_0x37f856,'firstMsgDirection':_0xeb62('0xb5'),'Messages':[_[_0xeb62('0x53')](_0x580f2f[_0xeb62('0x66')],{'read':![],'body':_0x580f2f[_0xeb62('0x66')][_0xeb62('0x66')],'phone':_0x37f856,'WhatsappAccountId':_0x47c79b['id'],'UserId':_0x580f2f[_0xeb62('0x5e')]['id'],'ContactId':_0x177937['id']})]},{'include':[{'model':db[_0xeb62('0xa5')],'as':_0xeb62('0xb6')}]})[_0xeb62('0x3b')](function(_0x1caab8){return[_0x1caab8,!![]];});});}})[_0xeb62('0x75')](function(_0x1a6ec1,_0x1a5dab){if(_0x1a5dab){return _0x1a6ec1;}return db[_0xeb62('0xa5')]['create'](_[_0xeb62('0x53')](_0x580f2f[_0xeb62('0x66')],{'read':![],'body':_0x580f2f['body']['body'],'phone':_0x37f856,'WhatsappAccountId':_0x47c79b['id'],'WhatsappInteractionId':_0x1a6ec1['id'],'UserId':_0x580f2f[_0xeb62('0x5e')]['id'],'ContactId':_0x177937['id']}))['then'](function(_0x5648c1){_0x1a6ec1[_0xeb62('0xb7')][_0xeb62('0xb6')]=[];_0x1a6ec1['dataValues'][_0xeb62('0xb6')][_0xeb62('0xa1')](_0x5648c1[_0xeb62('0xb7')]);return _0x1a6ec1;});})['then'](respondWithResult(_0xad9214,null))[_0xeb62('0x30')](handleError(_0xad9214,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a498a8a..18b187f 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 _0xf072=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save','remove'];(function(_0x50ecca,_0xc5e72d){var _0x44b43a=function(_0xe9fcde){while(--_0xe9fcde){_0x50ecca['push'](_0x50ecca['shift']());}};_0x44b43a(++_0xc5e72d);}(_0xf072,0x1cf));var _0x2f07=function(_0x36256a,_0x3aa9d1){_0x36256a=_0x36256a-0x0;var _0x4eab9d=_0xf072[_0x36256a];return _0x4eab9d;};'use strict';var EventEmitter=require(_0x2f07('0x0'));var WhatsappAccount=require(_0x2f07('0x1'))['db'][_0x2f07('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2f07('0x3'),'afterUpdate':'update','afterDestroy':_0x2f07('0x4')};function emitEvent(_0x432696){return function(_0x1536c3,_0x48d7b6,_0x1d5a33){WhatsappAccountEvents[_0x2f07('0x5')](_0x432696+':'+_0x1536c3['id'],_0x1536c3);WhatsappAccountEvents[_0x2f07('0x5')](_0x432696,_0x1536c3);_0x1d5a33(null);};}for(var e in events){if(events[_0x2f07('0x6')](e)){var event=events[e];WhatsappAccount[_0x2f07('0x7')](e,emitEvent(event));}}module[_0x2f07('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xdfa0=['exports','events','WhatsappAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x16e874,_0x154da0){var _0x5460d4=function(_0x464262){while(--_0x464262){_0x16e874['push'](_0x16e874['shift']());}};_0x5460d4(++_0x154da0);}(_0xdfa0,0x69));var _0x0dfa=function(_0x414db0,_0x10729a){_0x414db0=_0x414db0-0x0;var _0x1b1f54=_0xdfa0[_0x414db0];return _0x1b1f54;};'use strict';var EventEmitter=require(_0x0dfa('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x0dfa('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0dfa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0dfa('0x3'),'afterDestroy':_0x0dfa('0x4')};function emitEvent(_0x3691a7){return function(_0x4dbbab,_0x373c4e,_0x50b91e){WhatsappAccountEvents[_0x0dfa('0x5')](_0x3691a7+':'+_0x4dbbab['id'],_0x4dbbab);WhatsappAccountEvents[_0x0dfa('0x5')](_0x3691a7,_0x4dbbab);_0x50b91e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x0dfa('0x6')](e,emitEvent(event));}}module[_0x0dfa('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 75417e1..f51fbd0 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 _0x0374=['whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0374,0x169));var _0x4037=function(_0x2c25e1,_0x49a87a){_0x2c25e1=_0x2c25e1-0x0;var _0x49acfc=_0x0374[_0x2c25e1];return _0x49acfc;};'use strict';var _=require(_0x4037('0x0'));var util=require(_0x4037('0x1'));var logger=require(_0x4037('0x2'))(_0x4037('0x3'));var moment=require(_0x4037('0x4'));var BPromise=require(_0x4037('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4037('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4037('0x7'));module[_0x4037('0x8')]=function(_0x53874a,_0x7a72a){return _0x53874a[_0x4037('0x9')](_0x4037('0xa'),attributes,{'tableName':_0x4037('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6f5=['lodash','util','moment','path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0xbe83dc,_0x558915){var _0x56de2c=function(_0x5c7497){while(--_0x5c7497){_0xbe83dc['push'](_0xbe83dc['shift']());}};_0x56de2c(++_0x558915);}(_0xf6f5,0x10e));var _0x5f6f=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf6f5[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x5f6f('0x0'));var util=require(_0x5f6f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5f6f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f6f('0x3'));var rimraf=require(_0x5f6f('0x4'));var config=require(_0x5f6f('0x5'));var attributes=require('./whatsappAccount.attributes');module[_0x5f6f('0x6')]=function(_0x34b366,_0x404bb6){return _0x34b366[_0x5f6f('0x7')](_0x5f6f('0x8'),attributes,{'tableName':_0x5f6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index fd7322b..8afd8c6 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 _0xb5f5=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','info','lodash','util','moment','bluebird','ioredis'];(function(_0x441658,_0x5f555b){var _0x2918e7=function(_0x3f71ef){while(--_0x3f71ef){_0x441658['push'](_0x441658['shift']());}};_0x2918e7(++_0x5f555b);}(_0xb5f5,0x177));var _0x5b5f=function(_0x342028,_0x47ad85){_0x342028=_0x342028-0x0;var _0x571d82=_0xb5f5[_0x342028];return _0x571d82;};'use strict';var _=require(_0x5b5f('0x0'));var util=require(_0x5b5f('0x1'));var moment=require(_0x5b5f('0x2'));var BPromise=require(_0x5b5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b5f('0x4'));var db=require(_0x5b5f('0x5'))['db'];var utils=require(_0x5b5f('0x6'));var logger=require(_0x5b5f('0x7'))('rpc');var config=require(_0x5b5f('0x8'));var jayson=require(_0x5b5f('0x9'));var client=jayson[_0x5b5f('0xa')][_0x5b5f('0xb')]({'port':0x232a});config[_0x5b5f('0xc')]=_[_0x5b5f('0xd')](config[_0x5b5f('0xc')],{'host':_0x5b5f('0xe'),'port':0x18eb});var socket=require(_0x5b5f('0xf'))(new Redis(config[_0x5b5f('0xc')]));require('./whatsappAccount.socket')[_0x5b5f('0x10')](socket);function respondWithRpcPromise(_0x1ca179,_0x4aab45,_0x2c8f6a){return new BPromise(function(_0x4d9dba,_0x35bbf9){return client[_0x5b5f('0x11')](_0x1ca179,_0x2c8f6a)[_0x5b5f('0x12')](function(_0x47dab7){logger['info'](_0x5b5f('0x13'),_0x4aab45,_0x5b5f('0x14'));logger[_0x5b5f('0x15')](_0x5b5f('0x16'),_0x4aab45,_0x5b5f('0x14'),JSON[_0x5b5f('0x17')](_0x47dab7));if(_0x47dab7[_0x5b5f('0x18')]){if(_0x47dab7['error']['code']===0x1f4){logger[_0x5b5f('0x18')](_0x5b5f('0x13'),_0x4aab45,_0x47dab7[_0x5b5f('0x18')][_0x5b5f('0x19')]);return _0x35bbf9(_0x47dab7[_0x5b5f('0x18')][_0x5b5f('0x19')]);}logger[_0x5b5f('0x18')](_0x5b5f('0x13'),_0x4aab45,_0x47dab7[_0x5b5f('0x18')][_0x5b5f('0x19')]);return _0x4d9dba(_0x47dab7['error']['message']);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4aab45,'request\x20sent');_0x4d9dba(_0x47dab7[_0x5b5f('0x1a')]['message']);}})[_0x5b5f('0x1b')](function(_0x590b22){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4aab45,_0x590b22);_0x35bbf9(_0x590b22);});});}exports[_0x5b5f('0x1c')]=function(_0x3416e8){var _0x5d9455=this;return new Promise(function(_0x39e026,_0x5478cf){return db[_0x5b5f('0x1d')][_0x5b5f('0x1e')]({'raw':_0x3416e8[_0x5b5f('0x1f')]?_0x3416e8[_0x5b5f('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3416e8[_0x5b5f('0x1f')]?_0x3416e8['options'][_0x5b5f('0x20')]||null:null,'attributes':_0x3416e8['options']?_0x3416e8[_0x5b5f('0x1f')][_0x5b5f('0x21')]||null:null,'include':_0x3416e8[_0x5b5f('0x1f')]?_0x3416e8[_0x5b5f('0x1f')][_0x5b5f('0x22')]?_[_0x5b5f('0x23')](_0x3416e8[_0x5b5f('0x1f')][_0x5b5f('0x22')],function(_0x5e8970){return{'model':db[_0x5e8970[_0x5b5f('0x24')]],'as':_0x5e8970['as'],'attributes':_0x5e8970['attributes'],'include':_0x5e8970[_0x5b5f('0x22')]?_[_0x5b5f('0x23')](_0x5e8970[_0x5b5f('0x22')],function(_0x14f38b){return{'model':db[_0x14f38b[_0x5b5f('0x24')]],'as':_0x14f38b['as'],'attributes':_0x14f38b[_0x5b5f('0x21')],'include':_0x14f38b[_0x5b5f('0x22')]?_[_0x5b5f('0x23')](_0x14f38b[_0x5b5f('0x22')],function(_0x16a843){return{'model':db[_0x16a843[_0x5b5f('0x24')]],'as':_0x16a843['as'],'attributes':_0x16a843[_0x5b5f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5b5f('0x12')](function(_0x1df6cb){logger[_0x5b5f('0x25')](_0x5b5f('0x1c'),_0x3416e8);logger[_0x5b5f('0x15')](_0x5b5f('0x1c'),_0x3416e8,JSON[_0x5b5f('0x17')](_0x1df6cb));_0x39e026(_0x1df6cb);})[_0x5b5f('0x1b')](function(_0x2c7a3d){logger[_0x5b5f('0x18')](_0x5b5f('0x1c'),_0x2c7a3d[_0x5b5f('0x19')],_0x3416e8);_0x5478cf(_0x5d9455[_0x5b5f('0x18')](0x1f4,_0x2c7a3d['message']));});});}; \ No newline at end of file +var _0x0849=['client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','WhatsappAccount','find','options','raw','where','attributes','include','model','map','ShowWhatsappAccount','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x0849,0xca));var _0x9084=function(_0x58ce90,_0x3284ea){_0x58ce90=_0x58ce90-0x0;var _0x1cd178=_0x0849[_0x58ce90];return _0x1cd178;};'use strict';var _=require(_0x9084('0x0'));var util=require(_0x9084('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9084('0x2'));var fs=require('fs');var Redis=require(_0x9084('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9084('0x4'));var logger=require(_0x9084('0x5'))(_0x9084('0x6'));var config=require(_0x9084('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9084('0x8')][_0x9084('0x9')]({'port':0x232a});config[_0x9084('0xa')]=_[_0x9084('0xb')](config[_0x9084('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9084('0xc'))(new Redis(config['redis']));require(_0x9084('0xd'))['register'](socket);function respondWithRpcPromise(_0x5880d3,_0x115140,_0x125ab8){return new BPromise(function(_0x287559,_0x38ea05){return client[_0x9084('0xe')](_0x5880d3,_0x125ab8)[_0x9084('0xf')](function(_0x150988){logger[_0x9084('0x10')](_0x9084('0x11'),_0x115140,_0x9084('0x12'));logger[_0x9084('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x115140,_0x9084('0x12'),JSON[_0x9084('0x14')](_0x150988));if(_0x150988[_0x9084('0x15')]){if(_0x150988['error'][_0x9084('0x16')]===0x1f4){logger['error'](_0x9084('0x11'),_0x115140,_0x150988[_0x9084('0x15')]['message']);return _0x38ea05(_0x150988['error']['message']);}logger[_0x9084('0x15')](_0x9084('0x11'),_0x115140,_0x150988['error'][_0x9084('0x17')]);return _0x287559(_0x150988[_0x9084('0x15')][_0x9084('0x17')]);}else{logger[_0x9084('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x115140,_0x9084('0x12'));_0x287559(_0x150988['result']['message']);}})[_0x9084('0x18')](function(_0x341e9e){logger[_0x9084('0x15')](_0x9084('0x11'),_0x115140,_0x341e9e);_0x38ea05(_0x341e9e);});});}exports['ShowWhatsappAccount']=function(_0x11e1b6){var _0x42a84d=this;return new Promise(function(_0x23c691,_0xd7b6d3){return db[_0x9084('0x19')][_0x9084('0x1a')]({'raw':_0x11e1b6[_0x9084('0x1b')]?_0x11e1b6['options'][_0x9084('0x1c')]===undefined?!![]:![]:!![],'where':_0x11e1b6['options']?_0x11e1b6[_0x9084('0x1b')][_0x9084('0x1d')]||null:null,'attributes':_0x11e1b6[_0x9084('0x1b')]?_0x11e1b6['options'][_0x9084('0x1e')]||null:null,'include':_0x11e1b6['options']?_0x11e1b6[_0x9084('0x1b')][_0x9084('0x1f')]?_['map'](_0x11e1b6[_0x9084('0x1b')][_0x9084('0x1f')],function(_0x48d424){return{'model':db[_0x48d424[_0x9084('0x20')]],'as':_0x48d424['as'],'attributes':_0x48d424[_0x9084('0x1e')],'include':_0x48d424['include']?_['map'](_0x48d424['include'],function(_0x3edcfa){return{'model':db[_0x3edcfa[_0x9084('0x20')]],'as':_0x3edcfa['as'],'attributes':_0x3edcfa['attributes'],'include':_0x3edcfa['include']?_[_0x9084('0x21')](_0x3edcfa[_0x9084('0x1f')],function(_0x20ffa3){return{'model':db[_0x20ffa3[_0x9084('0x20')]],'as':_0x20ffa3['as'],'attributes':_0x20ffa3[_0x9084('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9084('0xf')](function(_0x1aab88){logger[_0x9084('0x10')](_0x9084('0x22'),_0x11e1b6);logger[_0x9084('0x13')]('ShowWhatsappAccount',_0x11e1b6,JSON[_0x9084('0x14')](_0x1aab88));_0x23c691(_0x1aab88);})['catch'](function(_0x472870){logger[_0x9084('0x15')]('ShowWhatsappAccount',_0x472870['message'],_0x11e1b6);_0xd7b6d3(_0x42a84d[_0x9084('0x15')](0x1f4,_0x472870[_0x9084('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 16d59ff..7eb5e14 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 _0xa3f9=['save','update','emit','register','whatsappAccount:','./whatsappAccount.events'];(function(_0x3a4bae,_0x1f9d18){var _0x4e6283=function(_0x5281fc){while(--_0x5281fc){_0x3a4bae['push'](_0x3a4bae['shift']());}};_0x4e6283(++_0x1f9d18);}(_0xa3f9,0x1b5));var _0x9a3f=function(_0x183259,_0x1d01ba){_0x183259=_0x183259-0x0;var _0x13fc5e=_0xa3f9[_0x183259];return _0x13fc5e;};'use strict';var WhatsappAccountEvents=require(_0x9a3f('0x0'));var events=[_0x9a3f('0x1'),'remove',_0x9a3f('0x2')];function createListener(_0x5e1126,_0x1c8f8e){return function(_0x77c485){_0x1c8f8e[_0x9a3f('0x3')](_0x5e1126,_0x77c485);};}function removeListener(_0x4145c3,_0x4b3c32){return function(){WhatsappAccountEvents['removeListener'](_0x4145c3,_0x4b3c32);};}exports[_0x9a3f('0x4')]=function(_0x1b2fb8){for(var _0x332d96=0x0,_0x5e79d1=events['length'];_0x332d96<_0x5e79d1;_0x332d96++){var _0x560214=events[_0x332d96];var _0x463bd2=createListener(_0x9a3f('0x5')+_0x560214,_0x1b2fb8);WhatsappAccountEvents['on'](_0x560214,_0x463bd2);}}; \ No newline at end of file +var _0xa671=['whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener','length'];(function(_0x1bfcfc,_0x140f5b){var _0x1041ff=function(_0x2d48fc){while(--_0x2d48fc){_0x1bfcfc['push'](_0x1bfcfc['shift']());}};_0x1041ff(++_0x140f5b);}(_0xa671,0x19e));var _0x1a67=function(_0x407751,_0x5ceffd){_0x407751=_0x407751-0x0;var _0xd7450e=_0xa671[_0x407751];return _0xd7450e;};'use strict';var WhatsappAccountEvents=require(_0x1a67('0x0'));var events=[_0x1a67('0x1'),_0x1a67('0x2'),'update'];function createListener(_0x5ad625,_0x22c587){return function(_0x108a41){_0x22c587[_0x1a67('0x3')](_0x5ad625,_0x108a41);};}function removeListener(_0xbdd576,_0x1d5457){return function(){WhatsappAccountEvents[_0x1a67('0x4')](_0xbdd576,_0x1d5457);};}exports['register']=function(_0xdda9a1){for(var _0x27b10b=0x0,_0x3c358c=events[_0x1a67('0x5')];_0x27b10b<_0x3c358c;_0x27b10b++){var _0x40ba1e=events[_0x27b10b];var _0x25d9af=createListener(_0x1a67('0x6')+_0x40ba1e,_0xdda9a1);WhatsappAccountEvents['on'](_0x40ba1e,_0x25d9af);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index d445f7a..203a2c1 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 _0xfee6=['./whatsappApplication.controller','get','index','/:id','show','isAuthenticated','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2fcda4,_0x5e9c40){var _0x4e0da3=function(_0xdba3d0){while(--_0xdba3d0){_0x2fcda4['push'](_0x2fcda4['shift']());}};_0x4e0da3(++_0x5e9c40);}(_0xfee6,0x1b9));var _0x6fee=function(_0x5789ec,_0x11aa96){_0x5789ec=_0x5789ec-0x0;var _0x30aacb=_0xfee6[_0x5789ec];return _0x30aacb;};'use strict';var multer=require('multer');var util=require(_0x6fee('0x0'));var path=require('path');var timeout=require(_0x6fee('0x1'));var express=require(_0x6fee('0x2'));var router=express[_0x6fee('0x3')]();var auth=require(_0x6fee('0x4'));var interaction=require(_0x6fee('0x5'));var config=require(_0x6fee('0x6'));var controller=require(_0x6fee('0x7'));router[_0x6fee('0x8')]('/',auth['isAuthenticated'](),controller[_0x6fee('0x9')]);router['get'](_0x6fee('0xa'),auth['isAuthenticated'](),controller[_0x6fee('0xb')]);router['post']('/',auth[_0x6fee('0xc')](),controller['create']);router['put'](_0x6fee('0xa'),auth[_0x6fee('0xc')](),controller['update']);router[_0x6fee('0xd')](_0x6fee('0xa'),auth[_0x6fee('0xc')](),controller[_0x6fee('0xe')]);module[_0x6fee('0xf')]=router; \ No newline at end of file +var _0xa207=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','put','delete','util','connect-timeout','express','Router'];(function(_0x214a2c,_0xdd2261){var _0x3f14d1=function(_0x12d32c){while(--_0x12d32c){_0x214a2c['push'](_0x214a2c['shift']());}};_0x3f14d1(++_0xdd2261);}(_0xa207,0x141));var _0x7a20=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa207[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x7a20('0x0'));var path=require('path');var timeout=require(_0x7a20('0x1'));var express=require(_0x7a20('0x2'));var router=express[_0x7a20('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7a20('0x4'));var config=require(_0x7a20('0x5'));var controller=require(_0x7a20('0x6'));router[_0x7a20('0x7')]('/',auth[_0x7a20('0x8')](),controller['index']);router[_0x7a20('0x7')](_0x7a20('0x9'),auth[_0x7a20('0x8')](),controller[_0x7a20('0xa')]);router['post']('/',auth[_0x7a20('0x8')](),controller['create']);router[_0x7a20('0xb')](_0x7a20('0x9'),auth[_0x7a20('0x8')](),controller['update']);router[_0x7a20('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index c682c96..713adb5 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 _0xb43c=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xb43c,0x191));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcb43('0x0'));module[_0xcb43('0x1')]={'priority':{'type':Sequelize[_0xcb43('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcb43('0x3')],'allowNull':![],'defaultValue':_0xcb43('0x4')},'appdata':{'type':Sequelize[_0xcb43('0x5')]()},'description':{'type':Sequelize[_0xcb43('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xcb43('0x6')}}; \ No newline at end of file +var _0x4a9e=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4a9e,0x1f0));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe4a9('0x0'));module[_0xe4a9('0x1')]={'priority':{'type':Sequelize[_0xe4a9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe4a9('0x3')],'allowNull':![],'defaultValue':_0xe4a9('0x4')},'appdata':{'type':Sequelize[_0xe4a9('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe4a9('0x3')],'defaultValue':_0xe4a9('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 63c48ad..4fc9867 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 _0x6d03=['where','filter','merge','options','includeAll','WhatsappApplication','rows','show','include','find','create','body','params','catch','html-pdf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','map','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x6d03,0x19a));var _0x36d0=function(_0x11c989,_0x48693f){_0x11c989=_0x11c989-0x0;var _0x1b988d=_0x6d03[_0x11c989];return _0x1b988d;};'use strict';var pdf=require(_0x36d0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x36d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36d0('0x2'));var moment=require(_0x36d0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x36d0('0x4'));var path=require(_0x36d0('0x5'));var sox=require(_0x36d0('0x6'));var csv=require(_0x36d0('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x36d0('0x8'));var squel=require(_0x36d0('0x9'));var crypto=require('crypto');var jsforce=require(_0x36d0('0xa'));var deskjs=require(_0x36d0('0xb'));var toCsv=require(_0x36d0('0x7'));var querystring=require('querystring');var Papa=require(_0x36d0('0xc'));var Redis=require(_0x36d0('0xd'));var authService=require(_0x36d0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x36d0('0xf'));var hardwareService=require(_0x36d0('0x10'));var logger=require(_0x36d0('0x11'))(_0x36d0('0x12'));var utils=require(_0x36d0('0x13'));var config=require(_0x36d0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58a546,_0x490f56){_0x490f56=_0x490f56||0xcc;return function(_0x55ede4){if(_0x55ede4){return _0x58a546['sendStatus'](_0x490f56);}return _0x58a546['status'](_0x490f56)['end']();};}function respondWithResult(_0x1efc93,_0x3d6d9e){_0x3d6d9e=_0x3d6d9e||0xc8;return function(_0x4257cd){if(_0x4257cd){return _0x1efc93[_0x36d0('0x15')](_0x3d6d9e)[_0x36d0('0x16')](_0x4257cd);}};}function respondWithFilteredResult(_0x31c899,_0x141560){return function(_0x31df8e){if(_0x31df8e){var _0xf1621c=_0x31df8e[_0x36d0('0x17')],_0x11db26=_0x141560[_0x36d0('0x18')],_0x183943=_0x141560['offset']+_0x141560[_0x36d0('0x19')],_0x155d9b;if(_0x183943>=_0xf1621c){_0x183943=_0xf1621c;_0x155d9b=0xc8;}else{_0x155d9b=0xce;}_0x31c899[_0x36d0('0x15')](_0x155d9b);return _0x31c899['set'](_0x36d0('0x1a'),_0x11db26+'-'+_0x183943+'/'+_0xf1621c)[_0x36d0('0x16')](_0x31df8e);}return null;};}function patchUpdates(_0x80e997){return function(_0x1d19f1){try{jsonpatch[_0x36d0('0x1b')](_0x1d19f1,_0x80e997,!![]);}catch(_0x2633e8){return BPromise[_0x36d0('0x1c')](_0x2633e8);}return _0x1d19f1[_0x36d0('0x1d')]();};}function saveUpdates(_0x4cb53b,_0x169560){return function(_0x45584d){if(_0x45584d){return _0x45584d[_0x36d0('0x1e')](_0x4cb53b)[_0x36d0('0x1f')](function(_0x386fd){return _0x386fd;});}return null;};}function removeEntity(_0x52c0ac,_0x524fd7){return function(_0x7284e8){if(_0x7284e8){return _0x7284e8[_0x36d0('0x20')]()['then'](function(){_0x52c0ac[_0x36d0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f6b6d,_0x30221c){return function(_0x961b41){if(!_0x961b41){_0x1f6b6d[_0x36d0('0x21')](0x194);}return _0x961b41;};}function handleError(_0x443488,_0x5d3385){_0x5d3385=_0x5d3385||0x1f4;return function(_0x15a2d8){logger[_0x36d0('0x22')](_0x15a2d8[_0x36d0('0x23')]);if(_0x15a2d8['name']){delete _0x15a2d8['name'];}_0x443488[_0x36d0('0x15')](_0x5d3385)['send'](_0x15a2d8);};}exports['index']=function(_0x4a4cf0,_0x3a3be7){var _0x1aeb95={},_0x3141da={},_0x30a3ba={'count':0x0,'rows':[]};var _0x28f942=_[_0x36d0('0x24')](db['WhatsappApplication'][_0x36d0('0x25')],function(_0x22c6db){return{'name':_0x22c6db[_0x36d0('0x26')],'type':_0x22c6db[_0x36d0('0x27')]['key']};});_0x3141da[_0x36d0('0x28')]=_[_0x36d0('0x24')](_0x28f942,_0x36d0('0x29'));_0x3141da['query']=_[_0x36d0('0x2a')](_0x4a4cf0['query']);_0x3141da[_0x36d0('0x2b')]=_[_0x36d0('0x2c')](_0x3141da[_0x36d0('0x28')],_0x3141da[_0x36d0('0x2d')]);_0x1aeb95[_0x36d0('0x2e')]=_[_0x36d0('0x2c')](_0x3141da['model'],qs['fields'](_0x4a4cf0['query'][_0x36d0('0x2f')]));_0x1aeb95['attributes']=_0x1aeb95['attributes'][_0x36d0('0x30')]?_0x1aeb95['attributes']:_0x3141da[_0x36d0('0x28')];if(!_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x31')](_0x36d0('0x32'))){_0x1aeb95['limit']=qs[_0x36d0('0x19')](_0x4a4cf0['query']['limit']);_0x1aeb95[_0x36d0('0x18')]=qs[_0x36d0('0x18')](_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x18')]);}_0x1aeb95['order']=qs['sort'](_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x33')]);_0x1aeb95[_0x36d0('0x34')]=qs[_0x36d0('0x2b')](_['pick'](_0x4a4cf0[_0x36d0('0x2d')],_0x3141da[_0x36d0('0x2b')]),_0x28f942);if(_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x35')]){_0x1aeb95['where']=_[_0x36d0('0x36')](_0x1aeb95[_0x36d0('0x34')],{'$or':_['map'](_0x28f942,function(_0x1a67d8){if(_0x1a67d8['type']!=='VIRTUAL'){var _0x86b9ef={};_0x86b9ef[_0x1a67d8[_0x36d0('0x29')]]={'$like':'%'+_0x4a4cf0['query']['filter']+'%'};return _0x86b9ef;}})});}_0x1aeb95=_[_0x36d0('0x36')]({},_0x1aeb95,_0x4a4cf0[_0x36d0('0x37')]);var _0x15000b={'where':_0x1aeb95[_0x36d0('0x34')]};return db['WhatsappApplication'][_0x36d0('0x17')](_0x15000b)[_0x36d0('0x1f')](function(_0x35ddd4){_0x30a3ba['count']=_0x35ddd4;if(_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x38')]){_0x1aeb95['include']=[{'all':!![]}];}return db[_0x36d0('0x39')]['findAll'](_0x1aeb95);})[_0x36d0('0x1f')](function(_0x1a8bec){_0x30a3ba[_0x36d0('0x3a')]=_0x1a8bec;return _0x30a3ba;})[_0x36d0('0x1f')](respondWithFilteredResult(_0x3a3be7,_0x1aeb95))['catch'](handleError(_0x3a3be7,null));};exports[_0x36d0('0x3b')]=function(_0x45aeb4,_0x2ff111){var _0x4580e2={'raw':!![],'where':{'id':_0x45aeb4['params']['id']}},_0x4162a0={};_0x4162a0[_0x36d0('0x28')]=_[_0x36d0('0x2a')](db[_0x36d0('0x39')][_0x36d0('0x25')]);_0x4162a0[_0x36d0('0x2d')]=_[_0x36d0('0x2a')](_0x45aeb4['query']);_0x4162a0[_0x36d0('0x2b')]=_[_0x36d0('0x2c')](_0x4162a0['model'],_0x4162a0['query']);_0x4580e2[_0x36d0('0x2e')]=_[_0x36d0('0x2c')](_0x4162a0['model'],qs[_0x36d0('0x2f')](_0x45aeb4['query'][_0x36d0('0x2f')]));_0x4580e2[_0x36d0('0x2e')]=_0x4580e2[_0x36d0('0x2e')][_0x36d0('0x30')]?_0x4580e2[_0x36d0('0x2e')]:_0x4162a0[_0x36d0('0x28')];if(_0x45aeb4['query'][_0x36d0('0x38')]){_0x4580e2[_0x36d0('0x3c')]=[{'all':!![]}];}_0x4580e2=_[_0x36d0('0x36')]({},_0x4580e2,_0x45aeb4[_0x36d0('0x37')]);return db[_0x36d0('0x39')][_0x36d0('0x3d')](_0x4580e2)[_0x36d0('0x1f')](handleEntityNotFound(_0x2ff111,null))[_0x36d0('0x1f')](respondWithResult(_0x2ff111,null))['catch'](handleError(_0x2ff111,null));};exports[_0x36d0('0x3e')]=function(_0x20edfd,_0x14e6bc){return db[_0x36d0('0x39')][_0x36d0('0x3e')](_0x20edfd['body'],{})['then'](respondWithResult(_0x14e6bc,0xc9))['catch'](handleError(_0x14e6bc,null));};exports[_0x36d0('0x1e')]=function(_0x174ab9,_0x959fa7){if(_0x174ab9['body']['id']){delete _0x174ab9[_0x36d0('0x3f')]['id'];}return db[_0x36d0('0x39')][_0x36d0('0x3d')]({'where':{'id':_0x174ab9[_0x36d0('0x40')]['id']}})['then'](handleEntityNotFound(_0x959fa7,null))[_0x36d0('0x1f')](saveUpdates(_0x174ab9[_0x36d0('0x3f')],null))[_0x36d0('0x1f')](respondWithResult(_0x959fa7,null))['catch'](handleError(_0x959fa7,null));};exports['destroy']=function(_0x1fe055,_0x2c3bdd){return db[_0x36d0('0x39')][_0x36d0('0x3d')]({'where':{'id':_0x1fe055[_0x36d0('0x40')]['id']}})[_0x36d0('0x1f')](handleEntityNotFound(_0x2c3bdd,null))['then'](removeEntity(_0x2c3bdd,null))[_0x36d0('0x41')](handleError(_0x2c3bdd,null));}; \ No newline at end of file +var _0x441b=['apply','reject','save','destroy','then','stack','name','send','map','WhatsappApplication','rawAttributes','type','model','query','keys','filters','fields','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','attributes','intersection','length','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set'];(function(_0x150cab,_0x4897c5){var _0x38ab54=function(_0x2f5cd2){while(--_0x2f5cd2){_0x150cab['push'](_0x150cab['shift']());}};_0x38ab54(++_0x4897c5);}(_0x441b,0xe9));var _0xb441=function(_0x54cf3b,_0x33fe35){_0x54cf3b=_0x54cf3b-0x0;var _0x2ce24a=_0x441b[_0x54cf3b];return _0x2ce24a;};'use strict';var pdf=require(_0xb441('0x0'));var emlformat=require(_0xb441('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb441('0x2'));var jsonpatch=require(_0xb441('0x3'));var rp=require(_0xb441('0x4'));var moment=require(_0xb441('0x5'));var BPromise=require(_0xb441('0x6'));var Mustache=require(_0xb441('0x7'));var util=require(_0xb441('0x8'));var path=require('path');var sox=require(_0xb441('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb441('0xa'));var squel=require(_0xb441('0xb'));var crypto=require(_0xb441('0xc'));var jsforce=require(_0xb441('0xd'));var deskjs=require(_0xb441('0xe'));var toCsv=require(_0xb441('0xf'));var querystring=require('querystring');var Papa=require(_0xb441('0x10'));var Redis=require('ioredis');var authService=require(_0xb441('0x11'));var qs=require(_0xb441('0x12'));var as=require(_0xb441('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb441('0x14'))(_0xb441('0x15'));var utils=require(_0xb441('0x16'));var config=require(_0xb441('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a35c2,_0x56aab8){_0x56aab8=_0x56aab8||0xcc;return function(_0x2c2c6e){if(_0x2c2c6e){return _0x2a35c2['sendStatus'](_0x56aab8);}return _0x2a35c2[_0xb441('0x18')](_0x56aab8)[_0xb441('0x19')]();};}function respondWithResult(_0x30489f,_0x15240d){_0x15240d=_0x15240d||0xc8;return function(_0x2a162a){if(_0x2a162a){return _0x30489f[_0xb441('0x18')](_0x15240d)[_0xb441('0x1a')](_0x2a162a);}};}function respondWithFilteredResult(_0x3e0ce2,_0xaed566){return function(_0xc925ab){if(_0xc925ab){var _0x3d10fc=_0xc925ab[_0xb441('0x1b')],_0x40d3de=_0xaed566[_0xb441('0x1c')],_0x5e7eae=_0xaed566[_0xb441('0x1c')]+_0xaed566[_0xb441('0x1d')],_0x4a1d8f;if(_0x5e7eae>=_0x3d10fc){_0x5e7eae=_0x3d10fc;_0x4a1d8f=0xc8;}else{_0x4a1d8f=0xce;}_0x3e0ce2[_0xb441('0x18')](_0x4a1d8f);return _0x3e0ce2[_0xb441('0x1e')]('Content-Range',_0x40d3de+'-'+_0x5e7eae+'/'+_0x3d10fc)[_0xb441('0x1a')](_0xc925ab);}return null;};}function patchUpdates(_0x5bee6e){return function(_0x4d8d1e){try{jsonpatch[_0xb441('0x1f')](_0x4d8d1e,_0x5bee6e,!![]);}catch(_0x3889aa){return BPromise[_0xb441('0x20')](_0x3889aa);}return _0x4d8d1e[_0xb441('0x21')]();};}function saveUpdates(_0x3ecff3,_0x384576){return function(_0x1d9e4e){if(_0x1d9e4e){return _0x1d9e4e['update'](_0x3ecff3)['then'](function(_0x99c39e){return _0x99c39e;});}return null;};}function removeEntity(_0x960256,_0x355f35){return function(_0x35c3ee){if(_0x35c3ee){return _0x35c3ee[_0xb441('0x22')]()[_0xb441('0x23')](function(){_0x960256[_0xb441('0x18')](0xcc)[_0xb441('0x19')]();});}};}function handleEntityNotFound(_0x9734dc,_0x4690d8){return function(_0x1593ad){if(!_0x1593ad){_0x9734dc['sendStatus'](0x194);}return _0x1593ad;};}function handleError(_0x4112ea,_0x2d5469){_0x2d5469=_0x2d5469||0x1f4;return function(_0x8f6eca){logger['error'](_0x8f6eca[_0xb441('0x24')]);if(_0x8f6eca['name']){delete _0x8f6eca[_0xb441('0x25')];}_0x4112ea[_0xb441('0x18')](_0x2d5469)[_0xb441('0x26')](_0x8f6eca);};}exports['index']=function(_0x2e045d,_0x2a0ba1){var _0x23a5d6={},_0x40c1f8={},_0x45303c={'count':0x0,'rows':[]};var _0x186cd3=_[_0xb441('0x27')](db[_0xb441('0x28')][_0xb441('0x29')],function(_0x5e61bd){return{'name':_0x5e61bd['fieldName'],'type':_0x5e61bd[_0xb441('0x2a')]['key']};});_0x40c1f8[_0xb441('0x2b')]=_[_0xb441('0x27')](_0x186cd3,_0xb441('0x25'));_0x40c1f8[_0xb441('0x2c')]=_[_0xb441('0x2d')](_0x2e045d[_0xb441('0x2c')]);_0x40c1f8[_0xb441('0x2e')]=_['intersection'](_0x40c1f8[_0xb441('0x2b')],_0x40c1f8[_0xb441('0x2c')]);_0x23a5d6['attributes']=_['intersection'](_0x40c1f8['model'],qs[_0xb441('0x2f')](_0x2e045d[_0xb441('0x2c')][_0xb441('0x2f')]));_0x23a5d6['attributes']=_0x23a5d6['attributes']['length']?_0x23a5d6['attributes']:_0x40c1f8[_0xb441('0x2b')];if(!_0x2e045d[_0xb441('0x2c')]['hasOwnProperty']('nolimit')){_0x23a5d6[_0xb441('0x1d')]=qs['limit'](_0x2e045d[_0xb441('0x2c')][_0xb441('0x1d')]);_0x23a5d6[_0xb441('0x1c')]=qs[_0xb441('0x1c')](_0x2e045d['query'][_0xb441('0x1c')]);}_0x23a5d6['order']=qs[_0xb441('0x30')](_0x2e045d[_0xb441('0x2c')][_0xb441('0x30')]);_0x23a5d6[_0xb441('0x31')]=qs['filters'](_[_0xb441('0x32')](_0x2e045d[_0xb441('0x2c')],_0x40c1f8[_0xb441('0x2e')]),_0x186cd3);if(_0x2e045d['query'][_0xb441('0x33')]){_0x23a5d6[_0xb441('0x31')]=_[_0xb441('0x34')](_0x23a5d6[_0xb441('0x31')],{'$or':_[_0xb441('0x27')](_0x186cd3,function(_0x5a904b){if(_0x5a904b[_0xb441('0x2a')]!==_0xb441('0x35')){var _0x529115={};_0x529115[_0x5a904b['name']]={'$like':'%'+_0x2e045d[_0xb441('0x2c')][_0xb441('0x33')]+'%'};return _0x529115;}})});}_0x23a5d6=_['merge']({},_0x23a5d6,_0x2e045d['options']);var _0x2a7c87={'where':_0x23a5d6[_0xb441('0x31')]};return db[_0xb441('0x28')]['count'](_0x2a7c87)[_0xb441('0x23')](function(_0x2a84e7){_0x45303c['count']=_0x2a84e7;if(_0x2e045d['query'][_0xb441('0x36')]){_0x23a5d6[_0xb441('0x37')]=[{'all':!![]}];}return db[_0xb441('0x28')][_0xb441('0x38')](_0x23a5d6);})[_0xb441('0x23')](function(_0x20e056){_0x45303c[_0xb441('0x39')]=_0x20e056;return _0x45303c;})[_0xb441('0x23')](respondWithFilteredResult(_0x2a0ba1,_0x23a5d6))['catch'](handleError(_0x2a0ba1,null));};exports[_0xb441('0x3a')]=function(_0x361503,_0x4343b4){var _0x3d7030={'raw':!![],'where':{'id':_0x361503[_0xb441('0x3b')]['id']}},_0x999825={};_0x999825[_0xb441('0x2b')]=_[_0xb441('0x2d')](db['WhatsappApplication']['rawAttributes']);_0x999825[_0xb441('0x2c')]=_[_0xb441('0x2d')](_0x361503[_0xb441('0x2c')]);_0x999825[_0xb441('0x2e')]=_['intersection'](_0x999825['model'],_0x999825['query']);_0x3d7030[_0xb441('0x3c')]=_[_0xb441('0x3d')](_0x999825[_0xb441('0x2b')],qs[_0xb441('0x2f')](_0x361503[_0xb441('0x2c')][_0xb441('0x2f')]));_0x3d7030[_0xb441('0x3c')]=_0x3d7030['attributes'][_0xb441('0x3e')]?_0x3d7030[_0xb441('0x3c')]:_0x999825[_0xb441('0x2b')];if(_0x361503[_0xb441('0x2c')]['includeAll']){_0x3d7030['include']=[{'all':!![]}];}_0x3d7030=_[_0xb441('0x34')]({},_0x3d7030,_0x361503['options']);return db[_0xb441('0x28')]['find'](_0x3d7030)['then'](handleEntityNotFound(_0x4343b4,null))[_0xb441('0x23')](respondWithResult(_0x4343b4,null))[_0xb441('0x3f')](handleError(_0x4343b4,null));};exports[_0xb441('0x40')]=function(_0x428010,_0x5d47c4){return db[_0xb441('0x28')][_0xb441('0x40')](_0x428010[_0xb441('0x41')],{})[_0xb441('0x23')](respondWithResult(_0x5d47c4,0xc9))[_0xb441('0x3f')](handleError(_0x5d47c4,null));};exports['update']=function(_0x2e9823,_0x1a7923){if(_0x2e9823[_0xb441('0x41')]['id']){delete _0x2e9823[_0xb441('0x41')]['id'];}return db[_0xb441('0x28')]['find']({'where':{'id':_0x2e9823[_0xb441('0x3b')]['id']}})[_0xb441('0x23')](handleEntityNotFound(_0x1a7923,null))[_0xb441('0x23')](saveUpdates(_0x2e9823['body'],null))[_0xb441('0x23')](respondWithResult(_0x1a7923,null))['catch'](handleError(_0x1a7923,null));};exports[_0xb441('0x22')]=function(_0x507e26,_0x386348){return db[_0xb441('0x28')]['find']({'where':{'id':_0x507e26[_0xb441('0x3b')]['id']}})[_0xb441('0x23')](handleEntityNotFound(_0x386348,null))[_0xb441('0x23')](removeEntity(_0x386348,null))[_0xb441('0x3f')](handleError(_0x386348,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 679089a..ec57044 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 _0x180d=['moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x532972,_0x23f2da){var _0x308435=function(_0x4d0ebc){while(--_0x4d0ebc){_0x532972['push'](_0x532972['shift']());}};_0x308435(++_0x23f2da);}(_0x180d,0xf9));var _0xd180=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x180d[_0x243b59];return _0x3e1676;};'use strict';var _=require('lodash');var util=require(_0xd180('0x0'));var logger=require(_0xd180('0x1'))(_0xd180('0x2'));var moment=require(_0xd180('0x3'));var BPromise=require(_0xd180('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd180('0x5'));var rimraf=require(_0xd180('0x6'));var config=require(_0xd180('0x7'));var attributes=require(_0xd180('0x8'));module[_0xd180('0x9')]=function(_0x44cf0b,_0x570b44){return _0x44cf0b['define'](_0xd180('0xa'),attributes,{'tableName':_0xd180('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd180('0xc'),'collate':_0xd180('0xd')});}; \ No newline at end of file +var _0x9a2d=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9a2d,0x123));var _0xd9a2=function(_0x1a8c66,_0x59e208){_0x1a8c66=_0x1a8c66-0x0;var _0x570d3b=_0x9a2d[_0x1a8c66];return _0x570d3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd9a2('0x0'))('api');var moment=require(_0xd9a2('0x1'));var BPromise=require(_0xd9a2('0x2'));var rp=require(_0xd9a2('0x3'));var fs=require('fs');var path=require(_0xd9a2('0x4'));var rimraf=require(_0xd9a2('0x5'));var config=require(_0xd9a2('0x6'));var attributes=require(_0xd9a2('0x7'));module[_0xd9a2('0x8')]=function(_0x2ff138,_0x11bc70){return _0x2ff138[_0xd9a2('0x9')](_0xd9a2('0xa'),attributes,{'tableName':_0xd9a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9a2('0xc'),'collate':_0xd9a2('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 03e292d..33d7ded 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 _0x37cc=['http','request','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x6ad834,_0x52a4aa){var _0x44c4d4=function(_0x175e14){while(--_0x175e14){_0x6ad834['push'](_0x6ad834['shift']());}};_0x44c4d4(++_0x52a4aa);}(_0x37cc,0x185));var _0xc37c=function(_0x3f66d8,_0xfccc95){_0x3f66d8=_0x3f66d8-0x0;var _0x3334dd=_0x37cc[_0x3f66d8];return _0x3334dd;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var moment=require(_0xc37c('0x2'));var BPromise=require(_0xc37c('0x3'));var rs=require(_0xc37c('0x4'));var fs=require('fs');var Redis=require(_0xc37c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc37c('0x6'))(_0xc37c('0x7'));var config=require(_0xc37c('0x8'));var jayson=require(_0xc37c('0x9'));var client=jayson[_0xc37c('0xa')][_0xc37c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd8f098,_0x1eaa97,_0x3c5c63){return new BPromise(function(_0x483c8d,_0x15a756){return client[_0xc37c('0xc')](_0xd8f098,_0x3c5c63)[_0xc37c('0xd')](function(_0x3526b5){logger[_0xc37c('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));logger[_0xc37c('0x10')](_0xc37c('0x11'),_0x1eaa97,_0xc37c('0xf'),JSON[_0xc37c('0x12')](_0x3526b5));if(_0x3526b5[_0xc37c('0x13')]){if(_0x3526b5[_0xc37c('0x13')][_0xc37c('0x14')]===0x1f4){logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')]['message']);return _0x15a756(_0x3526b5['error'][_0xc37c('0x16')]);}logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')][_0xc37c('0x16')]);return _0x483c8d(_0x3526b5[_0xc37c('0x13')]['message']);}else{logger[_0xc37c('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));_0x483c8d(_0x3526b5[_0xc37c('0x17')][_0xc37c('0x16')]);}})[_0xc37c('0x18')](function(_0x674ccf){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1eaa97,_0x674ccf);_0x15a756(_0x674ccf);});});} \ No newline at end of file +var _0xe928=['info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe928,0x145));var _0x8e92=function(_0x105c8e,_0xef41b1){_0x105c8e=_0x105c8e-0x0;var _0x4384d2=_0xe928[_0x105c8e];return _0x4384d2;};'use strict';var _=require(_0x8e92('0x0'));var util=require(_0x8e92('0x1'));var moment=require(_0x8e92('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e92('0x4'))['db'];var utils=require(_0x8e92('0x5'));var logger=require(_0x8e92('0x6'))(_0x8e92('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e92('0x8'));var client=jayson['client'][_0x8e92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe4eff3,_0x14811b,_0x76e11){return new BPromise(function(_0x59e109,_0x361fd2){return client['request'](_0xe4eff3,_0x76e11)[_0x8e92('0xa')](function(_0x8cc27a){logger[_0x8e92('0xb')](_0x8e92('0xc'),_0x14811b,_0x8e92('0xd'));logger[_0x8e92('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x14811b,_0x8e92('0xd'),JSON[_0x8e92('0xf')](_0x8cc27a));if(_0x8cc27a[_0x8e92('0x10')]){if(_0x8cc27a['error'][_0x8e92('0x11')]===0x1f4){logger[_0x8e92('0x10')](_0x8e92('0xc'),_0x14811b,_0x8cc27a[_0x8e92('0x10')][_0x8e92('0x12')]);return _0x361fd2(_0x8cc27a[_0x8e92('0x10')][_0x8e92('0x12')]);}logger['error'](_0x8e92('0xc'),_0x14811b,_0x8cc27a['error'][_0x8e92('0x12')]);return _0x59e109(_0x8cc27a[_0x8e92('0x10')]['message']);}else{logger[_0x8e92('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x14811b,_0x8e92('0xd'));_0x59e109(_0x8cc27a[_0x8e92('0x13')][_0x8e92('0x12')]);}})[_0x8e92('0x14')](function(_0x1c4b12){logger[_0x8e92('0x10')](_0x8e92('0xc'),_0x14811b,_0x1c4b12);_0x361fd2(_0x1c4b12);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e6f648f..3efca09 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 _0xf288=['destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','download','create','post','/:id/messages','addMessage','whatsapp','whatsappinteraction:addtags','put','tracked'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf288,0xf7));var _0x8f28=function(_0x279f6d,_0x122316){_0x279f6d=_0x279f6d-0x0;var _0x5874a5=_0xf288[_0x279f6d];return _0x5874a5;};'use strict';var multer=require(_0x8f28('0x0'));var util=require(_0x8f28('0x1'));var path=require(_0x8f28('0x2'));var timeout=require(_0x8f28('0x3'));var express=require(_0x8f28('0x4'));var router=express['Router']();var auth=require(_0x8f28('0x5'));var interaction=require(_0x8f28('0x6'));var config=require('../../config/environment');var controller=require(_0x8f28('0x7'));router['get']('/',auth[_0x8f28('0x8')](),controller[_0x8f28('0x9')]);router['get'](_0x8f28('0xa'),auth[_0x8f28('0x8')](),controller[_0x8f28('0xb')]);router[_0x8f28('0xc')](_0x8f28('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8f28('0xc')]('/:id/messages',auth[_0x8f28('0x8')](),controller['getMessages']);router[_0x8f28('0xc')]('/:id/download',auth['isAuthenticated'](),controller[_0x8f28('0xe')]);router['post']('/',auth[_0x8f28('0x8')](),controller[_0x8f28('0xf')]);router[_0x8f28('0x10')](_0x8f28('0x11'),auth[_0x8f28('0x8')](),controller[_0x8f28('0x12')]);router[_0x8f28('0x10')]('/:id/tags',auth[_0x8f28('0x8')](),interaction['tracked'](_0x8f28('0x13'),_0x8f28('0x14')),controller['addTags']);router[_0x8f28('0x15')](_0x8f28('0xd'),auth['isAuthenticated'](),interaction[_0x8f28('0x16')](_0x8f28('0x13'),'whatsappinteraction:update'),controller['update']);router['delete']('/:id',auth[_0x8f28('0x8')](),interaction['tracked'](_0x8f28('0x13'),'whatsappinteraction:destroy'),controller[_0x8f28('0x17')]);router[_0x8f28('0x18')]('/:id/tags',auth[_0x8f28('0x8')](),controller[_0x8f28('0x19')]);module[_0x8f28('0x1a')]=router; \ No newline at end of file +var _0x7852=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked','whatsapp','addTags','whatsappinteraction:update','delete','removeTags','multer'];(function(_0x3c5127,_0x393274){var _0xea714e=function(_0x446031){while(--_0x446031){_0x3c5127['push'](_0x3c5127['shift']());}};_0xea714e(++_0x393274);}(_0x7852,0x137));var _0x2785=function(_0x4b92d5,_0x4caf74){_0x4b92d5=_0x4b92d5-0x0;var _0x2369a6=_0x7852[_0x4b92d5];return _0x2369a6;};'use strict';var multer=require(_0x2785('0x0'));var util=require('util');var path=require(_0x2785('0x1'));var timeout=require(_0x2785('0x2'));var express=require('express');var router=express[_0x2785('0x3')]();var auth=require(_0x2785('0x4'));var interaction=require(_0x2785('0x5'));var config=require('../../config/environment');var controller=require(_0x2785('0x6'));router[_0x2785('0x7')]('/',auth[_0x2785('0x8')](),controller['index']);router['get'](_0x2785('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x2785('0x7')](_0x2785('0xa'),auth[_0x2785('0x8')](),controller[_0x2785('0xb')]);router[_0x2785('0x7')](_0x2785('0xc'),auth[_0x2785('0x8')](),controller[_0x2785('0xd')]);router[_0x2785('0x7')](_0x2785('0xe'),auth[_0x2785('0x8')](),controller['download']);router[_0x2785('0xf')]('/',auth[_0x2785('0x8')](),controller[_0x2785('0x10')]);router[_0x2785('0xf')](_0x2785('0xc'),auth[_0x2785('0x8')](),controller['addMessage']);router['post'](_0x2785('0x11'),auth[_0x2785('0x8')](),interaction[_0x2785('0x12')](_0x2785('0x13'),'whatsappinteraction:addtags'),controller[_0x2785('0x14')]);router['put']('/:id',auth[_0x2785('0x8')](),interaction['tracked'](_0x2785('0x13'),_0x2785('0x15')),controller['update']);router[_0x2785('0x16')](_0x2785('0xa'),auth['isAuthenticated'](),interaction[_0x2785('0x12')](_0x2785('0x13'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x2785('0x16')](_0x2785('0x11'),auth[_0x2785('0x8')](),controller[_0x2785('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 8bd1f5c..7da86a7 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 _0xa2a8=['STRING','DATE','ENUM','out','sequelize','moment','exports'];(function(_0x2e0015,_0x4c0e16){var _0x3aff01=function(_0x505a91){while(--_0x505a91){_0x2e0015['push'](_0x2e0015['shift']());}};_0x3aff01(++_0x4c0e16);}(_0xa2a8,0x18c));var _0x8a2a=function(_0x37fb26,_0x356172){_0x37fb26=_0x37fb26-0x0;var _0x5109eb=_0xa2a8[_0x37fb26];return _0x5109eb;};'use strict';var Sequelize=require(_0x8a2a('0x0'));var moment=require(_0x8a2a('0x1'));module[_0x8a2a('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8a2a('0x3')]},'note':{'type':Sequelize[_0x8a2a('0x3')]},'phone':{'type':Sequelize[_0x8a2a('0x3')]},'read1stAt':{'type':Sequelize[_0x8a2a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8a2a('0x5')]('in',_0x8a2a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a2a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8a2a('0x5')]('in',_0x8a2a('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x316c=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x3714ff,_0x54d34d){var _0x7535dd=function(_0x2d4a6d){while(--_0x2d4a6d){_0x3714ff['push'](_0x3714ff['shift']());}};_0x7535dd(++_0x54d34d);}(_0x316c,0x1d4));var _0xc316=function(_0x4ad5ec,_0x1c5088){_0x4ad5ec=_0x4ad5ec-0x0;var _0x39310e=_0x316c[_0x4ad5ec];return _0x39310e;};'use strict';var Sequelize=require(_0xc316('0x0'));var moment=require('moment');module[_0xc316('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc316('0x2')]},'disposition':{'type':Sequelize[_0xc316('0x3')]},'note':{'type':Sequelize[_0xc316('0x3')]},'phone':{'type':Sequelize[_0xc316('0x3')]},'read1stAt':{'type':Sequelize[_0xc316('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xc316('0x4')]('in',_0xc316('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc316('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ae11a69..6ec23d0 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x19cac7,_0x335437){var _0xc7f7c5=function(_0xba83b){while(--_0xba83b){_0x19cac7['push'](_0x19cac7['shift']());}};_0xc7f7c5(++_0x335437);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file +var _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7a54,0x106));var _0x47a5=function(_0x323bc7,_0x3526d7){_0x323bc7=_0x323bc7-0x0;var _0x5184e7=_0x7a54[_0x323bc7];return _0x5184e7;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index cf66abf..854c3be 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 _0x02b0=['catch','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','findAll','unreadMessages','length','emit'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x02b0,0x1cf));var _0x002b=function(_0x6ca7bb,_0x4ef1fd){_0x6ca7bb=_0x6ca7bb-0x0;var _0x1cf86d=_0x02b0[_0x6ca7bb];return _0x1cf86d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x002b('0x0'))['db'][_0x002b('0x1')];var WhatsappMessage=require(_0x002b('0x0'))['db'][_0x002b('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x002b('0x3')](0x0);var events={'afterCreate':_0x002b('0x4'),'afterUpdate':_0x002b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x10e0d4){return function(_0x53ef15,_0x3887fc,_0x3f44d7){_0x53ef15[_0x002b('0x6')]({'attributes':['id'],'raw':!![]})[_0x002b('0x7')](function(_0x5ed53e){_0x53ef15[_0x002b('0x8')]('Users',_0x5ed53e['map'](function(_0x2cff6d){return{'id':_0x2cff6d['id']};}));return WhatsappMessage[_0x002b('0x9')]({'where':{'WhatsappInteractionId':_0x53ef15['id'],'direction':'in','read':![]},'raw':!![]});})[_0x002b('0x7')](function(_0x1a5057){_0x53ef15['setDataValue'](_0x002b('0xa'),_0x1a5057[_0x002b('0xb')]);WhatsappInteractionEvents[_0x002b('0xc')](_0x10e0d4+':'+_0x53ef15['id'],_0x53ef15);WhatsappInteractionEvents[_0x002b('0xc')](_0x10e0d4,_0x53ef15);_0x3f44d7(null);})[_0x002b('0xd')](_0x3f44d7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xf62d=['emit','catch','hook','exports','events','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','length'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xf62d,0x1a4));var _0xdf62=function(_0x514a5c,_0xf57fc5){_0x514a5c=_0x514a5c-0x0;var _0x3f2b=_0xf62d[_0x514a5c];return _0x3f2b;};'use strict';var EventEmitter=require(_0xdf62('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xdf62('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xdf62('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xdf62('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdf62('0x4'),'afterDestroy':_0xdf62('0x5')};function emitEvent(_0x586b4b){return function(_0x32ae85,_0x25df24,_0x5775ac){_0x32ae85[_0xdf62('0x6')]({'attributes':['id'],'raw':!![]})[_0xdf62('0x7')](function(_0x1519e2){_0x32ae85[_0xdf62('0x8')]('Users',_0x1519e2['map'](function(_0xcc40d6){return{'id':_0xcc40d6['id']};}));return WhatsappMessage[_0xdf62('0x9')]({'where':{'WhatsappInteractionId':_0x32ae85['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d025e){_0x32ae85['setDataValue'](_0xdf62('0xa'),_0x4d025e[_0xdf62('0xb')]);WhatsappInteractionEvents[_0xdf62('0xc')](_0x586b4b+':'+_0x32ae85['id'],_0x32ae85);WhatsappInteractionEvents[_0xdf62('0xc')](_0x586b4b,_0x32ae85);_0x5775ac(null);})[_0xdf62('0xd')](_0x5775ac(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xdf62('0xe')](e,emitEvent(event));}}module[_0xdf62('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 46f755b..e103c66 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x43f58b,_0x223639){var _0x3c3572=function(_0x10a038){while(--_0x10a038){_0x43f58b['push'](_0x43f58b['shift']());}};_0x3c3572(++_0x223639);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file +var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x43ea48,_0x49c991){var _0x3a726c=function(_0x189821){while(--_0x189821){_0x43ea48['push'](_0x43ea48['shift']());}};_0x3a726c(++_0x49c991);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 2211b81..8a21489 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 _0x5c26=['result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x98ef49,_0x26da9d){var _0x18e506=function(_0x8416e3){while(--_0x8416e3){_0x98ef49['push'](_0x98ef49['shift']());}};_0x18e506(++_0x26da9d);}(_0x5c26,0x181));var _0x65c2=function(_0x72ab12,_0x896e1){_0x72ab12=_0x72ab12-0x0;var _0x3000af=_0x5c26[_0x72ab12];return _0x3000af;};'use strict';var _=require(_0x65c2('0x0'));var util=require(_0x65c2('0x1'));var moment=require('moment');var BPromise=require(_0x65c2('0x2'));var rs=require(_0x65c2('0x3'));var fs=require('fs');var Redis=require(_0x65c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x65c2('0x5'));var logger=require(_0x65c2('0x6'))(_0x65c2('0x7'));var config=require(_0x65c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x65c2('0x9')][_0x65c2('0xa')]({'port':0x232a});config[_0x65c2('0xb')]=_[_0x65c2('0xc')](config[_0x65c2('0xb')],{'host':_0x65c2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65c2('0xb')]));require('./whatsappInteraction.socket')[_0x65c2('0xe')](socket);function respondWithRpcPromise(_0x5208af,_0x4436dc,_0x494426){return new BPromise(function(_0x56974b,_0x25c667){return client[_0x65c2('0xf')](_0x5208af,_0x494426)[_0x65c2('0x10')](function(_0x520e11){logger['info'](_0x65c2('0x11'),_0x4436dc,_0x65c2('0x12'));logger[_0x65c2('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4436dc,_0x65c2('0x12'),JSON[_0x65c2('0x14')](_0x520e11));if(_0x520e11[_0x65c2('0x15')]){if(_0x520e11[_0x65c2('0x15')][_0x65c2('0x16')]===0x1f4){logger['error'](_0x65c2('0x11'),_0x4436dc,_0x520e11[_0x65c2('0x15')][_0x65c2('0x17')]);return _0x25c667(_0x520e11[_0x65c2('0x15')][_0x65c2('0x17')]);}logger['error'](_0x65c2('0x11'),_0x4436dc,_0x520e11[_0x65c2('0x15')][_0x65c2('0x17')]);return _0x56974b(_0x520e11[_0x65c2('0x15')][_0x65c2('0x17')]);}else{logger[_0x65c2('0x18')](_0x65c2('0x11'),_0x4436dc,'request\x20sent');_0x56974b(_0x520e11[_0x65c2('0x19')]['message']);}})[_0x65c2('0x1a')](function(_0x48f578){logger['error'](_0x65c2('0x11'),_0x4436dc,_0x48f578);_0x25c667(_0x48f578);});});}exports[_0x65c2('0x1b')]=function(_0x4666c1){var _0x372fd8=this;return new Promise(function(_0x5f4de6,_0x1e4020){return db[_0x65c2('0x1c')][_0x65c2('0x1d')](_0x4666c1[_0x65c2('0x1e')],{'raw':_0x4666c1[_0x65c2('0x1f')]?_0x4666c1[_0x65c2('0x1f')][_0x65c2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4666c1[_0x65c2('0x1f')]?_0x4666c1[_0x65c2('0x1f')][_0x65c2('0x21')]||null:null,'attributes':_0x4666c1[_0x65c2('0x1f')]?_0x4666c1[_0x65c2('0x1f')][_0x65c2('0x22')]||null:null,'limit':_0x4666c1[_0x65c2('0x1f')]?_0x4666c1[_0x65c2('0x1f')][_0x65c2('0x23')]||null:null})['then'](function(_0x14f890){logger[_0x65c2('0x18')](_0x65c2('0x1b'),_0x4666c1);logger[_0x65c2('0x13')](_0x65c2('0x1b'),_0x4666c1,JSON['stringify'](_0x14f890));_0x5f4de6(_0x14f890);})[_0x65c2('0x1a')](function(_0x77b1f){logger[_0x65c2('0x15')](_0x65c2('0x1b'),_0x77b1f[_0x65c2('0x17')],_0x4666c1);_0x1e4020(_0x372fd8['error'](0x1f4,_0x77b1f[_0x65c2('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x57a4c4){return new Promise(function(_0xfa114b,_0x276cde){return db[_0x65c2('0x1c')][_0x65c2('0x24')]({'where':_0x57a4c4[_0x65c2('0x1f')]?_0x57a4c4[_0x65c2('0x1f')][_0x65c2('0x21')]||null:null})[_0x65c2('0x10')](function(_0x44736f){if(_0x44736f){return _0x44736f[_0x65c2('0x25')](_0x57a4c4['body']['ids'],_['omit'](_0x57a4c4['body'],[_0x65c2('0x26'),'id'])||{});}})[_0x65c2('0x27')](function(_0x5d422a){logger['info'](_0x65c2('0x28'),_0x57a4c4);logger['debug'](_0x65c2('0x28'),_0x57a4c4,JSON['stringify'](_0x5d422a));_0xfa114b(_0x5d422a);})[_0x65c2('0x1a')](function(_0x1e2093){logger['error'](_0x65c2('0x28'),_0x1e2093[_0x65c2('0x17')],_0x57a4c4);_0x276cde(_this['error'](0x1f4,_0x1e2093[_0x65c2('0x17')]));});});}; \ No newline at end of file +var _0x8f18=['omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','WhatsappInteraction','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTags','ids'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x8f18,0x193));var _0x88f1=function(_0x2a4a34,_0x29da1a){_0x2a4a34=_0x2a4a34-0x0;var _0x14b35c=_0x8f18[_0x2a4a34];return _0x14b35c;};'use strict';var _=require(_0x88f1('0x0'));var util=require(_0x88f1('0x1'));var moment=require(_0x88f1('0x2'));var BPromise=require(_0x88f1('0x3'));var rs=require(_0x88f1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88f1('0x5'))['db'];var utils=require(_0x88f1('0x6'));var logger=require(_0x88f1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x88f1('0x8'));var client=jayson['client'][_0x88f1('0x9')]({'port':0x232a});config['redis']=_[_0x88f1('0xa')](config[_0x88f1('0xb')],{'host':_0x88f1('0xc'),'port':0x18eb});var socket=require(_0x88f1('0xd'))(new Redis(config[_0x88f1('0xb')]));require(_0x88f1('0xe'))['register'](socket);function respondWithRpcPromise(_0x32eb80,_0x20b479,_0x1182ac){return new BPromise(function(_0x194aae,_0x3e05c3){return client[_0x88f1('0xf')](_0x32eb80,_0x1182ac)[_0x88f1('0x10')](function(_0x293ebe){logger[_0x88f1('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x20b479,_0x88f1('0x12'));logger[_0x88f1('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x20b479,_0x88f1('0x12'),JSON[_0x88f1('0x14')](_0x293ebe));if(_0x293ebe[_0x88f1('0x15')]){if(_0x293ebe['error'][_0x88f1('0x16')]===0x1f4){logger[_0x88f1('0x15')](_0x88f1('0x17'),_0x20b479,_0x293ebe[_0x88f1('0x15')][_0x88f1('0x18')]);return _0x3e05c3(_0x293ebe[_0x88f1('0x15')][_0x88f1('0x18')]);}logger[_0x88f1('0x15')](_0x88f1('0x17'),_0x20b479,_0x293ebe[_0x88f1('0x15')][_0x88f1('0x18')]);return _0x194aae(_0x293ebe[_0x88f1('0x15')][_0x88f1('0x18')]);}else{logger[_0x88f1('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x20b479,_0x88f1('0x12'));_0x194aae(_0x293ebe['result'][_0x88f1('0x18')]);}})[_0x88f1('0x19')](function(_0x445e20){logger[_0x88f1('0x15')](_0x88f1('0x17'),_0x20b479,_0x445e20);_0x3e05c3(_0x445e20);});});}exports['UpdateWhatsappInteraction']=function(_0x59d991){var _0x4e668c=this;return new Promise(function(_0x596f65,_0x2e11ad){return db[_0x88f1('0x1a')]['update'](_0x59d991[_0x88f1('0x1b')],{'raw':_0x59d991[_0x88f1('0x1c')]?_0x59d991[_0x88f1('0x1c')][_0x88f1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d991['options']?_0x59d991[_0x88f1('0x1c')][_0x88f1('0x1e')]||null:null,'attributes':_0x59d991['options']?_0x59d991['options'][_0x88f1('0x1f')]||null:null,'limit':_0x59d991['options']?_0x59d991[_0x88f1('0x1c')][_0x88f1('0x20')]||null:null})[_0x88f1('0x10')](function(_0x36ebf7){logger[_0x88f1('0x11')](_0x88f1('0x21'),_0x59d991);logger[_0x88f1('0x13')](_0x88f1('0x21'),_0x59d991,JSON[_0x88f1('0x14')](_0x36ebf7));_0x596f65(_0x36ebf7);})[_0x88f1('0x19')](function(_0x57a48a){logger[_0x88f1('0x15')](_0x88f1('0x21'),_0x57a48a[_0x88f1('0x18')],_0x59d991);_0x2e11ad(_0x4e668c[_0x88f1('0x15')](0x1f4,_0x57a48a[_0x88f1('0x18')]));});});};exports[_0x88f1('0x22')]=function(_0x2056c0){return new Promise(function(_0xc9751,_0x377447){return db[_0x88f1('0x1a')]['find']({'where':_0x2056c0['options']?_0x2056c0[_0x88f1('0x1c')][_0x88f1('0x1e')]||null:null})[_0x88f1('0x10')](function(_0x3cfc39){if(_0x3cfc39){return _0x3cfc39[_0x88f1('0x23')](_0x2056c0[_0x88f1('0x1b')][_0x88f1('0x24')],_[_0x88f1('0x25')](_0x2056c0[_0x88f1('0x1b')],[_0x88f1('0x24'),'id'])||{});}})[_0x88f1('0x26')](function(_0xab6141){logger[_0x88f1('0x11')](_0x88f1('0x27'),_0x2056c0);logger[_0x88f1('0x13')](_0x88f1('0x27'),_0x2056c0,JSON[_0x88f1('0x14')](_0xab6141));_0xc9751(_0xab6141);})[_0x88f1('0x19')](function(_0x473bd6){logger[_0x88f1('0x15')](_0x88f1('0x27'),_0x473bd6[_0x88f1('0x18')],_0x2056c0);_0x377447(_this[_0x88f1('0x15')](0x1f4,_0x473bd6[_0x88f1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b3fa329..bb8f5b1 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 _0x9fca=['length','whatsappInteraction:','./whatsappInteraction.events','remove','register'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x9fca,0x16f));var _0xa9fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fca[_0x122ef9];return _0x42fba0;};'use strict';var WhatsappInteractionEvents=require(_0xa9fc('0x0'));var events=['save',_0xa9fc('0x1'),'update'];function createListener(_0x4858d8,_0x2aa0fd){return function(_0x2c5255){_0x2aa0fd['emit'](_0x4858d8,_0x2c5255);};}function removeListener(_0x26f7ff,_0x595667){return function(){WhatsappInteractionEvents['removeListener'](_0x26f7ff,_0x595667);};}exports[_0xa9fc('0x2')]=function(_0x5b0625){for(var _0x4958b3=0x0,_0x302f59=events[_0xa9fc('0x3')];_0x4958b3<_0x302f59;_0x4958b3++){var _0xa53d73=events[_0x4958b3];var _0x5535e8=createListener(_0xa9fc('0x4')+_0xa53d73,_0x5b0625);WhatsappInteractionEvents['on'](_0xa53d73,_0x5535e8);}}; \ No newline at end of file +var _0x0bc2=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x1c93be,_0x67b058){var _0x14b0e4=function(_0x1cbfb4){while(--_0x1cbfb4){_0x1c93be['push'](_0x1c93be['shift']());}};_0x14b0e4(++_0x67b058);}(_0x0bc2,0x9f));var _0x20bc=function(_0x3c9008,_0x2d89e1){_0x3c9008=_0x3c9008-0x0;var _0x7e20cd=_0x0bc2[_0x3c9008];return _0x7e20cd;};'use strict';var WhatsappInteractionEvents=require(_0x20bc('0x0'));var events=[_0x20bc('0x1'),_0x20bc('0x2'),_0x20bc('0x3')];function createListener(_0x38c0fb,_0x51f116){return function(_0x56d3ec){_0x51f116[_0x20bc('0x4')](_0x38c0fb,_0x56d3ec);};}function removeListener(_0x223589,_0x7d9f54){return function(){WhatsappInteractionEvents[_0x20bc('0x5')](_0x223589,_0x7d9f54);};}exports[_0x20bc('0x6')]=function(_0x230309){for(var _0x176515=0x0,_0x28762e=events[_0x20bc('0x7')];_0x176515<_0x28762e;_0x176515++){var _0x215c9c=events[_0x176515];var _0x4c6eeb=createListener(_0x20bc('0x8')+_0x215c9c,_0x230309);WhatsappInteractionEvents['on'](_0x215c9c,_0x4c6eeb);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2873153..7e9fa82 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 _0xa887=['get','isAuthenticated','index','/describe','show','post','tracked','whatsapp','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0x45743d,_0x136710){var _0x2c3680=function(_0x5f894b){while(--_0x5f894b){_0x45743d['push'](_0x45743d['shift']());}};_0x2c3680(++_0x136710);}(_0xa887,0x9a));var _0x7a88=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa887[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7a88('0x0'));var util=require('util');var path=require(_0x7a88('0x1'));var timeout=require(_0x7a88('0x2'));var express=require('express');var router=express[_0x7a88('0x3')]();var auth=require(_0x7a88('0x4'));var interaction=require(_0x7a88('0x5'));var config=require(_0x7a88('0x6'));var controller=require(_0x7a88('0x7'));router[_0x7a88('0x8')]('/',auth[_0x7a88('0x9')](),controller[_0x7a88('0xa')]);router[_0x7a88('0x8')](_0x7a88('0xb'),auth[_0x7a88('0x9')](),controller['describe']);router[_0x7a88('0x8')]('/:id',auth[_0x7a88('0x9')](),controller[_0x7a88('0xc')]);router[_0x7a88('0xd')]('/',auth[_0x7a88('0x9')](),interaction[_0x7a88('0xe')](_0x7a88('0xf'),'whatsappmessage:create'),controller[_0x7a88('0x10')]);router[_0x7a88('0xd')](_0x7a88('0x11'),controller[_0x7a88('0x12')]);router[_0x7a88('0x13')]('/:id',auth[_0x7a88('0x9')](),controller['update']);router[_0x7a88('0x13')](_0x7a88('0x14'),auth[_0x7a88('0x9')](),controller[_0x7a88('0x15')]);router[_0x7a88('0x13')](_0x7a88('0x16'),auth[_0x7a88('0x9')](),controller[_0x7a88('0x17')]);router[_0x7a88('0x18')](_0x7a88('0x19'),auth[_0x7a88('0x9')](),controller[_0x7a88('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x1400=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','describe','/:id','show','post','tracked','whatsapp','/:id/status','put','update','reject'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x1400,0x189));var _0x0140=function(_0x29e613,_0x44f310){_0x29e613=_0x29e613-0x0;var _0x44a5aa=_0x1400[_0x29e613];return _0x44a5aa;};'use strict';var multer=require(_0x0140('0x0'));var util=require(_0x0140('0x1'));var path=require(_0x0140('0x2'));var timeout=require(_0x0140('0x3'));var express=require(_0x0140('0x4'));var router=express[_0x0140('0x5')]();var auth=require(_0x0140('0x6'));var interaction=require(_0x0140('0x7'));var config=require(_0x0140('0x8'));var controller=require(_0x0140('0x9'));router['get']('/',auth[_0x0140('0xa')](),controller[_0x0140('0xb')]);router[_0x0140('0xc')]('/describe',auth[_0x0140('0xa')](),controller[_0x0140('0xd')]);router[_0x0140('0xc')](_0x0140('0xe'),auth['isAuthenticated'](),controller[_0x0140('0xf')]);router[_0x0140('0x10')]('/',auth[_0x0140('0xa')](),interaction[_0x0140('0x11')](_0x0140('0x12'),'whatsappmessage:create'),controller['create']);router[_0x0140('0x10')](_0x0140('0x13'),controller['status']);router[_0x0140('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0140('0x15')]);router['put']('/:id/accept',auth[_0x0140('0xa')](),controller['accept']);router['put']('/:id/reject',auth[_0x0140('0xa')](),controller[_0x0140('0x16')]);router[_0x0140('0x17')](_0x0140('0xe'),auth['isAuthenticated'](),controller[_0x0140('0x18')]);module[_0x0140('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 4bee5af..d0b6014 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 _0x0a2c=['medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x414027,_0x525a0c){var _0x82dec9=function(_0x4c424d){while(--_0x4c424d){_0x414027['push'](_0x414027['shift']());}};_0x82dec9(++_0x525a0c);}(_0x0a2c,0x1df));var _0xc0a2=function(_0x59c795,_0x138f0b){_0x59c795=_0x59c795-0x0;var _0x75028d=_0x0a2c[_0x59c795];return _0x75028d;};'use strict';var Sequelize=require(_0xc0a2('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xc0a2('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc0a2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc0a2('0x3')]('in','out'),'defaultValue':_0xc0a2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc0a2('0x5')](0xbe)},'phone':{'type':Sequelize[_0xc0a2('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x13ad=['STRING','DATE','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x591781,_0x8e0ed2){var _0x315bd9=function(_0x39166c){while(--_0x39166c){_0x591781['push'](_0x591781['shift']());}};_0x315bd9(++_0x8e0ed2);}(_0x13ad,0x142));var _0xd13a=function(_0x26fa61,_0x37f387){_0x26fa61=_0x26fa61-0x0;var _0x4a9da0=_0x13ad[_0x26fa61];return _0x4a9da0;};'use strict';var Sequelize=require(_0xd13a('0x0'));module[_0xd13a('0x1')]={'body':{'type':Sequelize['TEXT'](_0xd13a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd13a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd13a('0x4')]('in',_0xd13a('0x5')),'defaultValue':_0xd13a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xd13a('0x6')]},'readAt':{'type':Sequelize[_0xd13a('0x7')]},'secret':{'type':Sequelize[_0xd13a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 437dcaa..1de7c98 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 _0xd270=['request','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','code','error','WhatsappMessage,\x20%s,\x20%s','message','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','user','role','stringify','manual','interface','SIP/%s','channel','event','EventManager','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./whatsappMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x1cac3b,_0x344896){var _0x36c22b=function(_0x24ef81){while(--_0x24ef81){_0x1cac3b['push'](_0x1cac3b['shift']());}};_0x36c22b(++_0x344896);}(_0xd270,0x16f));var _0x0d27=function(_0x471ea3,_0x187175){_0x471ea3=_0x471ea3-0x0;var _0x5b835b=_0xd270[_0x471ea3];return _0x5b835b;};'use strict';var pdf=require(_0x0d27('0x0'));var emlformat=require(_0x0d27('0x1'));var rimraf=require(_0x0d27('0x2'));var zipdir=require(_0x0d27('0x3'));var jsonpatch=require(_0x0d27('0x4'));var rp=require(_0x0d27('0x5'));var moment=require(_0x0d27('0x6'));var BPromise=require(_0x0d27('0x7'));var Mustache=require(_0x0d27('0x8'));var util=require('util');var path=require(_0x0d27('0x9'));var sox=require(_0x0d27('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d27('0xb'));var squel=require(_0x0d27('0xc'));var crypto=require(_0x0d27('0xd'));var jsforce=require(_0x0d27('0xe'));var deskjs=require(_0x0d27('0xf'));var toCsv=require(_0x0d27('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0d27('0x11'));var qs=require(_0x0d27('0x12'));var as=require(_0x0d27('0x13'));var hardwareService=require(_0x0d27('0x14'));var logger=require(_0x0d27('0x15'))(_0x0d27('0x16'));var utils=require(_0x0d27('0x17'));var config=require('../../config/environment');var db=require(_0x0d27('0x18'))['db'];config[_0x0d27('0x19')]=_[_0x0d27('0x1a')](config[_0x0d27('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d27('0x19')]));require(_0x0d27('0x1b'))['register'](socket);var jayson=require(_0x0d27('0x1c'));var client=jayson[_0x0d27('0x1d')][_0x0d27('0x1e')]({'port':0x232c});var client9002=jayson[_0x0d27('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x16774d,_0x4ec813,_0x28af94){if(_0x28af94){var _0x2cfb18=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2cfb18[_0x0d27('0x1f')](_0x4ec813)){return _0x16774d;}else{throw new db[(_0x0d27('0x20'))][(_0x0d27('0x21'))](_0x0d27('0x22'));}}else{return _0x16774d;}}function respondWithRpcPromise(_0x560e93,_0x412559,_0x6cfd,_0x47ad25){return new BPromise(function(_0x4138c6,_0x4d6be1){var _0x245751=_0x47ad25||client;return _0x245751[_0x0d27('0x23')](_0x560e93,_0x6cfd)['then'](function(_0x52aac7){logger[_0x0d27('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x412559,_0x0d27('0x25'));logger['debug'](_0x0d27('0x26'),_0x412559,_0x0d27('0x25'),JSON['stringify'](_0x52aac7));if(_0x52aac7['error']){if(_0x52aac7['error'][_0x0d27('0x27')]===0x1f4){logger[_0x0d27('0x28')](_0x0d27('0x29'),_0x412559,_0x52aac7[_0x0d27('0x28')][_0x0d27('0x2a')]);return _0x4d6be1(_0x52aac7[_0x0d27('0x28')][_0x0d27('0x2a')]);}logger[_0x0d27('0x28')](_0x0d27('0x29'),_0x412559,_0x52aac7[_0x0d27('0x28')]['message']);return _0x4138c6(_0x52aac7[_0x0d27('0x28')]['message']);}else{logger[_0x0d27('0x24')](_0x0d27('0x29'),_0x412559,'request\x20sent');_0x4138c6(_0x52aac7['result'][_0x0d27('0x2a')]);}})['catch'](function(_0x48cc94){logger[_0x0d27('0x28')](_0x0d27('0x29'),_0x412559,_0x48cc94);_0x4d6be1(_0x48cc94);});});}function respondWithStatusCode(_0x2a60a7,_0x5069a7){_0x5069a7=_0x5069a7||0xcc;return function(_0x2c7153){if(_0x2c7153){return _0x2a60a7['sendStatus'](_0x5069a7);}return _0x2a60a7[_0x0d27('0x2b')](_0x5069a7)[_0x0d27('0x2c')]();};}function respondWithResult(_0x54a279,_0x3dfdd1){_0x3dfdd1=_0x3dfdd1||0xc8;return function(_0x2cd833){if(_0x2cd833){return _0x54a279[_0x0d27('0x2b')](_0x3dfdd1)[_0x0d27('0x2d')](_0x2cd833);}};}function respondWithFilteredResult(_0x200a39,_0x27c0e2){return function(_0x320b6d){if(_0x320b6d){var _0x6e77e3=_0x320b6d[_0x0d27('0x2e')],_0x183331=_0x27c0e2['offset'],_0x3ddac8=_0x27c0e2[_0x0d27('0x2f')]+_0x27c0e2['limit'],_0x4ac9b1;if(_0x3ddac8>=_0x6e77e3){_0x3ddac8=_0x6e77e3;_0x4ac9b1=0xc8;}else{_0x4ac9b1=0xce;}_0x200a39[_0x0d27('0x2b')](_0x4ac9b1);return _0x200a39[_0x0d27('0x30')](_0x0d27('0x31'),_0x183331+'-'+_0x3ddac8+'/'+_0x6e77e3)['json'](_0x320b6d);}return null;};}function patchUpdates(_0x29f734){return function(_0x442ea5){try{jsonpatch[_0x0d27('0x32')](_0x442ea5,_0x29f734,!![]);}catch(_0x557b19){return BPromise[_0x0d27('0x33')](_0x557b19);}return _0x442ea5[_0x0d27('0x34')]();};}function saveUpdates(_0xd9b84c,_0x2c3a5f){return function(_0x38594a){if(_0x38594a){return _0x38594a[_0x0d27('0x35')](_0xd9b84c)[_0x0d27('0x36')](function(_0x25e4eb){return _0x25e4eb;});}return null;};}function removeEntity(_0x55d37f,_0x43022f){return function(_0x4f5c83){if(_0x4f5c83){return _0x4f5c83[_0x0d27('0x37')]()['then'](function(){_0x55d37f[_0x0d27('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ac9fb,_0x6c1fb8){return function(_0x3c0f11){if(!_0x3c0f11){_0x1ac9fb['sendStatus'](0x194);}return _0x3c0f11;};}function handleError(_0x53fd31,_0x211d4b){_0x211d4b=_0x211d4b||0x1f4;return function(_0x473e1a){logger[_0x0d27('0x28')](_0x473e1a[_0x0d27('0x38')]);if(_0x473e1a[_0x0d27('0x39')]){delete _0x473e1a[_0x0d27('0x39')];}_0x53fd31[_0x0d27('0x2b')](_0x211d4b)[_0x0d27('0x3a')](_0x473e1a);};}exports[_0x0d27('0x3b')]=function(_0x407db8,_0x2969c2){var _0x4b1b5b={},_0x5c3a52={},_0x1e5884={'count':0x0,'rows':[]};var _0x191433=_[_0x0d27('0x3c')](db[_0x0d27('0x3d')][_0x0d27('0x3e')],function(_0x5829e5){return{'name':_0x5829e5[_0x0d27('0x3f')],'type':_0x5829e5['type'][_0x0d27('0x40')]};});_0x5c3a52[_0x0d27('0x41')]=_[_0x0d27('0x3c')](_0x191433,_0x0d27('0x39'));_0x5c3a52['query']=_[_0x0d27('0x42')](_0x407db8[_0x0d27('0x43')]);_0x5c3a52[_0x0d27('0x44')]=_['intersection'](_0x5c3a52[_0x0d27('0x41')],_0x5c3a52[_0x0d27('0x43')]);_0x4b1b5b[_0x0d27('0x45')]=_[_0x0d27('0x46')](_0x5c3a52[_0x0d27('0x41')],qs[_0x0d27('0x47')](_0x407db8[_0x0d27('0x43')][_0x0d27('0x47')]));_0x4b1b5b['attributes']=_0x4b1b5b[_0x0d27('0x45')][_0x0d27('0x48')]?_0x4b1b5b[_0x0d27('0x45')]:_0x5c3a52[_0x0d27('0x41')];if(!_0x407db8[_0x0d27('0x43')]['hasOwnProperty'](_0x0d27('0x49'))){_0x4b1b5b['limit']=qs['limit'](_0x407db8[_0x0d27('0x43')]['limit']);_0x4b1b5b['offset']=qs[_0x0d27('0x2f')](_0x407db8[_0x0d27('0x43')]['offset']);}_0x4b1b5b[_0x0d27('0x4a')]=qs[_0x0d27('0x4b')](_0x407db8[_0x0d27('0x43')][_0x0d27('0x4b')]);_0x4b1b5b['where']=qs[_0x0d27('0x44')](_[_0x0d27('0x4c')](_0x407db8['query'],_0x5c3a52[_0x0d27('0x44')]),_0x191433);if(_0x407db8['query'][_0x0d27('0x4d')]){_0x4b1b5b[_0x0d27('0x4e')]=_[_0x0d27('0x4f')](_0x4b1b5b[_0x0d27('0x4e')],{'$or':_[_0x0d27('0x3c')](_0x191433,function(_0x5a3592){if(_0x5a3592[_0x0d27('0x50')]!==_0x0d27('0x51')){var _0xa67130={};_0xa67130[_0x5a3592['name']]={'$like':'%'+_0x407db8[_0x0d27('0x43')][_0x0d27('0x4d')]+'%'};return _0xa67130;}})});}_0x4b1b5b=_[_0x0d27('0x4f')]({},_0x4b1b5b,_0x407db8[_0x0d27('0x52')]);var _0x275a95={'where':_0x4b1b5b[_0x0d27('0x4e')]};return db[_0x0d27('0x3d')][_0x0d27('0x2e')](_0x275a95)[_0x0d27('0x36')](function(_0x3b2d0a){_0x1e5884['count']=_0x3b2d0a;if(_0x407db8[_0x0d27('0x43')][_0x0d27('0x53')]){_0x4b1b5b[_0x0d27('0x54')]=[{'all':!![]}];}return db[_0x0d27('0x3d')][_0x0d27('0x55')](_0x4b1b5b);})[_0x0d27('0x36')](function(_0x34496b){_0x1e5884[_0x0d27('0x56')]=_0x34496b;return _0x1e5884;})[_0x0d27('0x36')](respondWithFilteredResult(_0x2969c2,_0x4b1b5b))[_0x0d27('0x57')](handleError(_0x2969c2,null));};exports[_0x0d27('0x58')]=function(_0xe614e3,_0x35e401){var _0x485e22={'raw':!![],'where':{'id':_0xe614e3[_0x0d27('0x59')]['id']}},_0x1a7348={};_0x1a7348['model']=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x1a7348['query']=_[_0x0d27('0x42')](_0xe614e3[_0x0d27('0x43')]);_0x1a7348[_0x0d27('0x44')]=_['intersection'](_0x1a7348[_0x0d27('0x41')],_0x1a7348[_0x0d27('0x43')]);_0x485e22[_0x0d27('0x45')]=_[_0x0d27('0x46')](_0x1a7348[_0x0d27('0x41')],qs['fields'](_0xe614e3[_0x0d27('0x43')][_0x0d27('0x47')]));_0x485e22['attributes']=_0x485e22[_0x0d27('0x45')]['length']?_0x485e22['attributes']:_0x1a7348[_0x0d27('0x41')];if(_0xe614e3[_0x0d27('0x43')][_0x0d27('0x53')]){_0x485e22['include']=[{'all':!![]}];}_0x485e22=_[_0x0d27('0x4f')]({},_0x485e22,_0xe614e3[_0x0d27('0x52')]);return db[_0x0d27('0x3d')][_0x0d27('0x5a')](_0x485e22)[_0x0d27('0x36')](handleEntityNotFound(_0x35e401,null))[_0x0d27('0x36')](respondWithResult(_0x35e401,null))['catch'](handleError(_0x35e401,null));};exports[_0x0d27('0x5b')]=function(_0x52a020,_0x5e0789){return db[_0x0d27('0x3d')][_0x0d27('0x5b')](_0x52a020['body'],{})[_0x0d27('0x36')](respondWithResult(_0x5e0789,0xc9))['catch'](handleError(_0x5e0789,null));};exports[_0x0d27('0x35')]=function(_0x311f10,_0x3aaaec){if(_0x311f10[_0x0d27('0x5c')]['id']){delete _0x311f10['body']['id'];}return db[_0x0d27('0x3d')]['find']({'where':{'id':_0x311f10['params']['id']}})[_0x0d27('0x36')](handleEntityNotFound(_0x3aaaec,null))[_0x0d27('0x36')](saveUpdates(_0x311f10[_0x0d27('0x5c')],null))[_0x0d27('0x36')](respondWithResult(_0x3aaaec,null))['catch'](handleError(_0x3aaaec,null));};exports[_0x0d27('0x37')]=function(_0x1af378,_0x1e92f3){return db[_0x0d27('0x3d')]['find']({'where':{'id':_0x1af378['params']['id']}})[_0x0d27('0x36')](handleEntityNotFound(_0x1e92f3,null))[_0x0d27('0x36')](removeEntity(_0x1e92f3,null))['catch'](handleError(_0x1e92f3,null));};exports[_0x0d27('0x5d')]=function(_0x3c626d,_0x4ac86f){return db['WhatsappMessage'][_0x0d27('0x5d')]()[_0x0d27('0x36')](respondWithResult(_0x4ac86f,null))['catch'](handleError(_0x4ac86f,null));};var interaction_log=require(_0x0d27('0x15'))(_0x0d27('0x5e'));exports[_0x0d27('0x5f')]=function(_0x8afda6,_0xa35bfd,_0x464c61){var _0x374f81={'channel':_0x0d27('0x60')};if(_0x8afda6[_0x0d27('0x5c')]['id']){delete _0x8afda6['body']['id'];}_0x8afda6[_0x0d27('0x5c')]['read']=!![];_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x61')]=moment()[_0x0d27('0x62')](_0x0d27('0x63'));_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x64')]=_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x64')]||_0x8afda6['user']['id'];return db[_0x0d27('0x3d')][_0x0d27('0x5a')]({'where':{'id':_0x8afda6[_0x0d27('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x0d27('0x65')],'as':_0x0d27('0x66')}]})[_0x0d27('0x36')](handleEntityNotFound(_0xa35bfd,null))['then'](saveUpdates(_0x8afda6[_0x0d27('0x5c')],null))['then'](function(_0x4c8cd9){if(_0x4c8cd9){_0x374f81[_0x0d27('0x2a')]=_0x4c8cd9[_0x0d27('0x67')]({'plain':!![]});return db[_0x0d27('0x68')][_0x0d27('0x5a')]({'where':{'id':_0x4c8cd9[_0x0d27('0x69')]}});}return null;})['then'](handleEntityNotFound(_0xa35bfd,null))[_0x0d27('0x36')](function(_0x49c369){if(_0x49c369){return _0x49c369[_0x0d27('0x35')]({'UserId':_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x64')],'read1stAt':_[_0x0d27('0x6a')](_0x49c369[_0x0d27('0x6b')])?moment()['format'](_0x0d27('0x63')):undefined});}return null;})[_0x0d27('0x36')](function(_0xe37c71){if(_0xe37c71){_0x374f81[_0x0d27('0x6c')]=_0xe37c71[_0x0d27('0x67')]({'plain':!![]});interaction_log[_0x0d27('0x24')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x8afda6[_0x0d27('0x6d')]['id'],_0x8afda6[_0x0d27('0x6d')][_0x0d27('0x39')],_0x8afda6['user'][_0x0d27('0x6e')],_0x374f81[_0x0d27('0x6c')]['id'],_0x8afda6[_0x0d27('0x5c')]?JSON[_0x0d27('0x6f')](_0x8afda6[_0x0d27('0x5c')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x374f81);}return null;})[_0x0d27('0x36')](function(_0x2fe9e5){if(_0x2fe9e5){if(_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x70')]){_0x374f81[_0x0d27('0x2a')][_0x0d27('0x71')]=util[_0x0d27('0x62')](_0x0d27('0x72'),_0x8afda6[_0x0d27('0x6d')][_0x0d27('0x39')]);_0x374f81['message']['channel']=_0x374f81[_0x0d27('0x73')];_0x374f81[_0x0d27('0x2a')][_0x0d27('0x74')]=_0x0d27('0x5f');return respondWithRpcPromise(_0x0d27('0x75'),'EventManager',{'event':'acceptmessage','message':_0x374f81[_0x0d27('0x2a')]},client9002)[_0x0d27('0x36')](function(){return _0x374f81;});}return _0x374f81;}return null;})[_0x0d27('0x36')](respondWithResult(_0xa35bfd,null))[_0x0d27('0x57')](handleError(_0xa35bfd,null));};var interaction_log=require(_0x0d27('0x15'))(_0x0d27('0x5e'));exports[_0x0d27('0x33')]=function(_0xca8ef1,_0x2c3048,_0x2ec6b6){var _0x1e1a16={'agent':{},'channel':_0x0d27('0x60')};if(_0xca8ef1['body']['id']){delete _0xca8ef1['body']['id'];}_0xca8ef1[_0x0d27('0x5c')][_0x0d27('0x64')]=_0xca8ef1[_0x0d27('0x5c')][_0x0d27('0x64')]||_0xca8ef1[_0x0d27('0x6d')]['id'];_0x1e1a16[_0x0d27('0x76')]['id']=_0xca8ef1[_0x0d27('0x5c')][_0x0d27('0x64')];return db[_0x0d27('0x3d')][_0x0d27('0x5a')]({'where':{'id':_0xca8ef1[_0x0d27('0x59')]['id'],'UserId':null}})[_0x0d27('0x36')](handleEntityNotFound(_0x2c3048,null))[_0x0d27('0x36')](function(_0x27467b){if(_0x27467b){_0x1e1a16['message']=_0x27467b[_0x0d27('0x67')]({'plain':!![]});return db[_0x0d27('0x68')][_0x0d27('0x5a')]({'where':{'id':_0x27467b[_0x0d27('0x69')]}});}return null;})[_0x0d27('0x36')](handleEntityNotFound(_0x2c3048,null))[_0x0d27('0x36')](function(_0xa95a35){if(_0xa95a35){_0x1e1a16['interaction']=_0xa95a35['get']({'plain':!![]});interaction_log[_0x0d27('0x24')](_0x0d27('0x77'),_0xca8ef1[_0x0d27('0x6d')]['id'],_0xca8ef1[_0x0d27('0x6d')]['name'],_0xca8ef1['user'][_0x0d27('0x6e')],_0x1e1a16[_0x0d27('0x6c')]['id'],_0xca8ef1['body']?JSON[_0x0d27('0x6f')](_0xca8ef1['body']):_0x0d27('0x78'));return respondWithRpcPromise(_0x0d27('0x79'),_0x0d27('0x7a'),_0x1e1a16);}return null;})[_0x0d27('0x36')](function(_0x1c10a0){if(_0x1c10a0){_0x1c10a0[_0x0d27('0x2a')][_0x0d27('0x71')]=util[_0x0d27('0x62')]('SIP/%s',_0xca8ef1[_0x0d27('0x6d')][_0x0d27('0x39')]);_0x1c10a0[_0x0d27('0x2a')][_0x0d27('0x73')]=_0x1e1a16[_0x0d27('0x73')];_0x1c10a0[_0x0d27('0x2a')]['event']=_0x0d27('0x33');respondWithRpcPromise('EventManager',_0x0d27('0x75'),{'event':'rejectmessage','message':_0x1c10a0['message']},client9002);return _0x1e1a16;}return null;})[_0x0d27('0x36')](respondWithResult(_0x2c3048,null))[_0x0d27('0x57')](handleError(_0x2c3048,null));};exports[_0x0d27('0x2b')]=function(_0x3d483d,_0x5731e7,_0x33a9c1){if(_0x3d483d[_0x0d27('0x5c')]['id']){delete _0x3d483d['body']['id'];}var _0x4df305;return db[_0x0d27('0x3d')][_0x0d27('0x5a')]({'where':{'id':_0x3d483d[_0x0d27('0x59')]['id']}})[_0x0d27('0x36')](handleEntityNotFound(_0x5731e7,null))[_0x0d27('0x36')](function(_0x5f1b54){if(_0x5f1b54){_0x4df305=_0x5f1b54;return db[_0x0d27('0x7b')]['find']({'where':{'id':_0x5f1b54[_0x0d27('0x7c')]}});}})[_0x0d27('0x36')](handleEntityNotFound(_0x5731e7,null))[_0x0d27('0x36')](function(_0x5b060e){if(_0x5b060e){logger[_0x0d27('0x7d')](_0x0d27('0x7e'),_0x0d27('0x2b'),'received\x20delivery\x20report\x20from',_0x5b060e[_0x0d27('0x50')],util[_0x0d27('0x7f')](_0x3d483d[_0x0d27('0x5c')],{'showHidden':![],'depth':null}));switch(_0x5b060e['type']){case _0x0d27('0x80'):if(_0x3d483d[_0x0d27('0x5c')][_0x0d27('0x81')]&&_0x3d483d['body'][_0x0d27('0x81')]===_0x4df305[_0x0d27('0x82')]&&_0x3d483d[_0x0d27('0x5c')][_0x0d27('0x83')]&&_0x3d483d[_0x0d27('0x5c')][_0x0d27('0x83')]===_0x0d27('0x84')){return _0x4df305[_0x0d27('0x35')]({'read':!![]});}else{logger[_0x0d27('0x28')](_0x0d27('0x85'),_0x0d27('0x2b'),_0x0d27('0x80'),util['inspect'](_0x3d483d['body'],{'showHidden':![],'depth':null}));}break;}return _0x4df305;}})[_0x0d27('0x36')](respondWithResult(_0x5731e7,null))['catch'](handleError(_0x5731e7,null));}; \ No newline at end of file +var _0x8e55=['where','merge','VIRTUAL','WhatsappMessage','includeAll','include','rows','catch','show','options','create','body','params','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','agent','rejectMessage','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','twilio','MessageSid','messageId','MessageStatus','read','inspect','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter'];(function(_0x290c25,_0x23c973){var _0x5a4d83=function(_0x4cebe3){while(--_0x4cebe3){_0x290c25['push'](_0x290c25['shift']());}};_0x5a4d83(++_0x23c973);}(_0x8e55,0x1c2));var _0x58e5=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x8e55[_0x559a80];return _0x42f555;};'use strict';var pdf=require(_0x58e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x58e5('0x1'));var zipdir=require(_0x58e5('0x2'));var jsonpatch=require(_0x58e5('0x3'));var rp=require(_0x58e5('0x4'));var moment=require(_0x58e5('0x5'));var BPromise=require(_0x58e5('0x6'));var Mustache=require(_0x58e5('0x7'));var util=require(_0x58e5('0x8'));var path=require(_0x58e5('0x9'));var sox=require(_0x58e5('0xa'));var csv=require(_0x58e5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x58e5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x58e5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x58e5('0xe'));var hardwareService=require(_0x58e5('0xf'));var logger=require(_0x58e5('0x10'))(_0x58e5('0x11'));var utils=require(_0x58e5('0x12'));var config=require(_0x58e5('0x13'));var db=require(_0x58e5('0x14'))['db'];config[_0x58e5('0x15')]=_[_0x58e5('0x16')](config[_0x58e5('0x15')],{'host':_0x58e5('0x17'),'port':0x18eb});var socket=require(_0x58e5('0x18'))(new Redis(config[_0x58e5('0x15')]));require('./whatsappMessage.socket')[_0x58e5('0x19')](socket);var jayson=require(_0x58e5('0x1a'));var client=jayson[_0x58e5('0x1b')][_0x58e5('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x58e5('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x128b53,_0x4c2fc2,_0xb2e05c){if(_0xb2e05c){var _0x5b8a13=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b8a13['test'](_0x4c2fc2)){return _0x128b53;}else{throw new db[(_0x58e5('0x1d'))][(_0x58e5('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x128b53;}}function respondWithRpcPromise(_0x2fab6b,_0x33c623,_0x37c9de,_0x143532){return new BPromise(function(_0x56a421,_0x452245){var _0x208ad1=_0x143532||client;return _0x208ad1[_0x58e5('0x1f')](_0x2fab6b,_0x37c9de)[_0x58e5('0x20')](function(_0x251260){logger[_0x58e5('0x21')](_0x58e5('0x22'),_0x33c623,'request\x20sent');logger[_0x58e5('0x23')](_0x58e5('0x24'),_0x33c623,'request\x20sent',JSON['stringify'](_0x251260));if(_0x251260['error']){if(_0x251260[_0x58e5('0x25')][_0x58e5('0x26')]===0x1f4){logger[_0x58e5('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x33c623,_0x251260[_0x58e5('0x25')][_0x58e5('0x27')]);return _0x452245(_0x251260[_0x58e5('0x25')][_0x58e5('0x27')]);}logger[_0x58e5('0x25')](_0x58e5('0x22'),_0x33c623,_0x251260[_0x58e5('0x25')][_0x58e5('0x27')]);return _0x56a421(_0x251260[_0x58e5('0x25')][_0x58e5('0x27')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x33c623,'request\x20sent');_0x56a421(_0x251260['result'][_0x58e5('0x27')]);}})['catch'](function(_0x111d18){logger[_0x58e5('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x33c623,_0x111d18);_0x452245(_0x111d18);});});}function respondWithStatusCode(_0x1b8bf1,_0x48d73e){_0x48d73e=_0x48d73e||0xcc;return function(_0xada233){if(_0xada233){return _0x1b8bf1['sendStatus'](_0x48d73e);}return _0x1b8bf1[_0x58e5('0x28')](_0x48d73e)[_0x58e5('0x29')]();};}function respondWithResult(_0xa95a34,_0x2eb242){_0x2eb242=_0x2eb242||0xc8;return function(_0x7186aa){if(_0x7186aa){return _0xa95a34['status'](_0x2eb242)[_0x58e5('0x2a')](_0x7186aa);}};}function respondWithFilteredResult(_0x22a779,_0x156d29){return function(_0x553b0d){if(_0x553b0d){var _0x3f4c00=_0x553b0d[_0x58e5('0x2b')],_0x15855a=_0x156d29['offset'],_0x4aef4f=_0x156d29[_0x58e5('0x2c')]+_0x156d29['limit'],_0x2cf3ea;if(_0x4aef4f>=_0x3f4c00){_0x4aef4f=_0x3f4c00;_0x2cf3ea=0xc8;}else{_0x2cf3ea=0xce;}_0x22a779[_0x58e5('0x28')](_0x2cf3ea);return _0x22a779[_0x58e5('0x2d')](_0x58e5('0x2e'),_0x15855a+'-'+_0x4aef4f+'/'+_0x3f4c00)[_0x58e5('0x2a')](_0x553b0d);}return null;};}function patchUpdates(_0xce7eb1){return function(_0x39ff88){try{jsonpatch[_0x58e5('0x2f')](_0x39ff88,_0xce7eb1,!![]);}catch(_0x3ccf28){return BPromise[_0x58e5('0x30')](_0x3ccf28);}return _0x39ff88[_0x58e5('0x31')]();};}function saveUpdates(_0x7fd77e,_0x1f7088){return function(_0x10f924){if(_0x10f924){return _0x10f924[_0x58e5('0x32')](_0x7fd77e)['then'](function(_0x31d609){return _0x31d609;});}return null;};}function removeEntity(_0x304f40,_0x501a62){return function(_0x23a0f6){if(_0x23a0f6){return _0x23a0f6[_0x58e5('0x33')]()[_0x58e5('0x20')](function(){_0x304f40[_0x58e5('0x28')](0xcc)[_0x58e5('0x29')]();});}};}function handleEntityNotFound(_0x2cbe60,_0x2bd41c){return function(_0x161ae1){if(!_0x161ae1){_0x2cbe60[_0x58e5('0x34')](0x194);}return _0x161ae1;};}function handleError(_0xd35c56,_0xb7179b){_0xb7179b=_0xb7179b||0x1f4;return function(_0x468944){logger['error'](_0x468944[_0x58e5('0x35')]);if(_0x468944[_0x58e5('0x36')]){delete _0x468944[_0x58e5('0x36')];}_0xd35c56[_0x58e5('0x28')](_0xb7179b)['send'](_0x468944);};}exports[_0x58e5('0x37')]=function(_0x4f8b54,_0x1d492d){var _0x342317={},_0x365e0d={},_0x53d83c={'count':0x0,'rows':[]};var _0x27d8e2=_[_0x58e5('0x38')](db['WhatsappMessage'][_0x58e5('0x39')],function(_0x2a1500){return{'name':_0x2a1500[_0x58e5('0x3a')],'type':_0x2a1500['type'][_0x58e5('0x3b')]};});_0x365e0d[_0x58e5('0x3c')]=_[_0x58e5('0x38')](_0x27d8e2,_0x58e5('0x36'));_0x365e0d['query']=_[_0x58e5('0x3d')](_0x4f8b54[_0x58e5('0x3e')]);_0x365e0d[_0x58e5('0x3f')]=_[_0x58e5('0x40')](_0x365e0d[_0x58e5('0x3c')],_0x365e0d[_0x58e5('0x3e')]);_0x342317[_0x58e5('0x41')]=_[_0x58e5('0x40')](_0x365e0d[_0x58e5('0x3c')],qs[_0x58e5('0x42')](_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x42')]));_0x342317[_0x58e5('0x41')]=_0x342317['attributes'][_0x58e5('0x43')]?_0x342317[_0x58e5('0x41')]:_0x365e0d[_0x58e5('0x3c')];if(!_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x44')](_0x58e5('0x45'))){_0x342317[_0x58e5('0x46')]=qs[_0x58e5('0x46')](_0x4f8b54[_0x58e5('0x3e')]['limit']);_0x342317['offset']=qs[_0x58e5('0x2c')](_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x2c')]);}_0x342317['order']=qs[_0x58e5('0x47')](_0x4f8b54['query'][_0x58e5('0x47')]);_0x342317['where']=qs['filters'](_[_0x58e5('0x48')](_0x4f8b54[_0x58e5('0x3e')],_0x365e0d[_0x58e5('0x3f')]),_0x27d8e2);if(_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x49')]){_0x342317[_0x58e5('0x4a')]=_[_0x58e5('0x4b')](_0x342317[_0x58e5('0x4a')],{'$or':_['map'](_0x27d8e2,function(_0x2def30){if(_0x2def30['type']!==_0x58e5('0x4c')){var _0x13e693={};_0x13e693[_0x2def30[_0x58e5('0x36')]]={'$like':'%'+_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x49')]+'%'};return _0x13e693;}})});}_0x342317=_[_0x58e5('0x4b')]({},_0x342317,_0x4f8b54['options']);var _0x5651c8={'where':_0x342317[_0x58e5('0x4a')]};return db[_0x58e5('0x4d')]['count'](_0x5651c8)[_0x58e5('0x20')](function(_0x47b191){_0x53d83c[_0x58e5('0x2b')]=_0x47b191;if(_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x4e')]){_0x342317[_0x58e5('0x4f')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x342317);})[_0x58e5('0x20')](function(_0x239311){_0x53d83c[_0x58e5('0x50')]=_0x239311;return _0x53d83c;})[_0x58e5('0x20')](respondWithFilteredResult(_0x1d492d,_0x342317))[_0x58e5('0x51')](handleError(_0x1d492d,null));};exports[_0x58e5('0x52')]=function(_0x1f4b23,_0x55f40e){var _0x1f4699={'raw':!![],'where':{'id':_0x1f4b23['params']['id']}},_0x4a98a6={};_0x4a98a6[_0x58e5('0x3c')]=_['keys'](db['WhatsappMessage'][_0x58e5('0x39')]);_0x4a98a6[_0x58e5('0x3e')]=_[_0x58e5('0x3d')](_0x1f4b23[_0x58e5('0x3e')]);_0x4a98a6['filters']=_[_0x58e5('0x40')](_0x4a98a6[_0x58e5('0x3c')],_0x4a98a6[_0x58e5('0x3e')]);_0x1f4699[_0x58e5('0x41')]=_[_0x58e5('0x40')](_0x4a98a6[_0x58e5('0x3c')],qs[_0x58e5('0x42')](_0x1f4b23[_0x58e5('0x3e')][_0x58e5('0x42')]));_0x1f4699[_0x58e5('0x41')]=_0x1f4699[_0x58e5('0x41')][_0x58e5('0x43')]?_0x1f4699[_0x58e5('0x41')]:_0x4a98a6[_0x58e5('0x3c')];if(_0x1f4b23['query'][_0x58e5('0x4e')]){_0x1f4699[_0x58e5('0x4f')]=[{'all':!![]}];}_0x1f4699=_[_0x58e5('0x4b')]({},_0x1f4699,_0x1f4b23[_0x58e5('0x53')]);return db[_0x58e5('0x4d')]['find'](_0x1f4699)[_0x58e5('0x20')](handleEntityNotFound(_0x55f40e,null))[_0x58e5('0x20')](respondWithResult(_0x55f40e,null))[_0x58e5('0x51')](handleError(_0x55f40e,null));};exports['create']=function(_0x16731d,_0x117f86){return db[_0x58e5('0x4d')][_0x58e5('0x54')](_0x16731d[_0x58e5('0x55')],{})[_0x58e5('0x20')](respondWithResult(_0x117f86,0xc9))[_0x58e5('0x51')](handleError(_0x117f86,null));};exports[_0x58e5('0x32')]=function(_0x10c117,_0x13bd1b){if(_0x10c117[_0x58e5('0x55')]['id']){delete _0x10c117[_0x58e5('0x55')]['id'];}return db[_0x58e5('0x4d')]['find']({'where':{'id':_0x10c117['params']['id']}})[_0x58e5('0x20')](handleEntityNotFound(_0x13bd1b,null))[_0x58e5('0x20')](saveUpdates(_0x10c117[_0x58e5('0x55')],null))['then'](respondWithResult(_0x13bd1b,null))[_0x58e5('0x51')](handleError(_0x13bd1b,null));};exports[_0x58e5('0x33')]=function(_0x1e6d78,_0x421cd0){return db[_0x58e5('0x4d')]['find']({'where':{'id':_0x1e6d78[_0x58e5('0x56')]['id']}})[_0x58e5('0x20')](handleEntityNotFound(_0x421cd0,null))['then'](removeEntity(_0x421cd0,null))['catch'](handleError(_0x421cd0,null));};exports[_0x58e5('0x57')]=function(_0x2610e7,_0x307290){return db['WhatsappMessage'][_0x58e5('0x57')]()[_0x58e5('0x20')](respondWithResult(_0x307290,null))[_0x58e5('0x51')](handleError(_0x307290,null));};var interaction_log=require(_0x58e5('0x10'))(_0x58e5('0x58'));exports[_0x58e5('0x59')]=function(_0x3775bc,_0x414cef,_0x35d763){var _0x126b07={'channel':_0x58e5('0x5a')};if(_0x3775bc[_0x58e5('0x55')]['id']){delete _0x3775bc['body']['id'];}_0x3775bc[_0x58e5('0x55')]['read']=!![];_0x3775bc['body'][_0x58e5('0x5b')]=moment()[_0x58e5('0x5c')](_0x58e5('0x5d'));_0x3775bc[_0x58e5('0x55')]['UserId']=_0x3775bc[_0x58e5('0x55')][_0x58e5('0x5e')]||_0x3775bc[_0x58e5('0x5f')]['id'];return db[_0x58e5('0x4d')][_0x58e5('0x60')]({'where':{'id':_0x3775bc[_0x58e5('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x58e5('0x61')],'as':_0x58e5('0x62')}]})[_0x58e5('0x20')](handleEntityNotFound(_0x414cef,null))['then'](saveUpdates(_0x3775bc[_0x58e5('0x55')],null))[_0x58e5('0x20')](function(_0x1db432){if(_0x1db432){_0x126b07[_0x58e5('0x27')]=_0x1db432['get']({'plain':!![]});return db[_0x58e5('0x63')]['find']({'where':{'id':_0x1db432[_0x58e5('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x414cef,null))[_0x58e5('0x20')](function(_0x4f7afc){if(_0x4f7afc){return _0x4f7afc[_0x58e5('0x32')]({'UserId':_0x3775bc[_0x58e5('0x55')][_0x58e5('0x5e')],'read1stAt':_[_0x58e5('0x65')](_0x4f7afc[_0x58e5('0x66')])?moment()[_0x58e5('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x58e5('0x20')](function(_0x3790de){if(_0x3790de){_0x126b07[_0x58e5('0x67')]=_0x3790de[_0x58e5('0x68')]({'plain':!![]});interaction_log[_0x58e5('0x21')](_0x58e5('0x69'),_0x3775bc['user']['id'],_0x3775bc[_0x58e5('0x5f')]['name'],_0x3775bc[_0x58e5('0x5f')][_0x58e5('0x6a')],_0x126b07['interaction']['id'],_0x3775bc[_0x58e5('0x55')]?JSON[_0x58e5('0x6b')](_0x3775bc['body']):_0x58e5('0x6c'));return respondWithRpcPromise(_0x58e5('0x6d'),_0x58e5('0x6e'),_0x126b07);}return null;})['then'](function(_0x23a163){if(_0x23a163){if(_0x3775bc['body'][_0x58e5('0x6f')]){_0x126b07['message']['interface']=util[_0x58e5('0x5c')](_0x58e5('0x70'),_0x3775bc['user'][_0x58e5('0x36')]);_0x126b07['message'][_0x58e5('0x71')]=_0x126b07[_0x58e5('0x71')];_0x126b07[_0x58e5('0x27')][_0x58e5('0x72')]=_0x58e5('0x59');return respondWithRpcPromise(_0x58e5('0x73'),_0x58e5('0x73'),{'event':'acceptmessage','message':_0x126b07[_0x58e5('0x27')]},client9002)['then'](function(){return _0x126b07;});}return _0x126b07;}return null;})[_0x58e5('0x20')](respondWithResult(_0x414cef,null))[_0x58e5('0x51')](handleError(_0x414cef,null));};var interaction_log=require('../../config/logger')(_0x58e5('0x58'));exports['reject']=function(_0x422c4e,_0x144352,_0x383d46){var _0x264543={'agent':{},'channel':_0x58e5('0x5a')};if(_0x422c4e[_0x58e5('0x55')]['id']){delete _0x422c4e['body']['id'];}_0x422c4e[_0x58e5('0x55')]['UserId']=_0x422c4e[_0x58e5('0x55')]['UserId']||_0x422c4e['user']['id'];_0x264543[_0x58e5('0x74')]['id']=_0x422c4e['body']['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x422c4e[_0x58e5('0x56')]['id'],'UserId':null}})[_0x58e5('0x20')](handleEntityNotFound(_0x144352,null))[_0x58e5('0x20')](function(_0x575607){if(_0x575607){_0x264543[_0x58e5('0x27')]=_0x575607['get']({'plain':!![]});return db[_0x58e5('0x63')][_0x58e5('0x60')]({'where':{'id':_0x575607['WhatsappInteractionId']}});}return null;})[_0x58e5('0x20')](handleEntityNotFound(_0x144352,null))[_0x58e5('0x20')](function(_0x581a63){if(_0x581a63){_0x264543['interaction']=_0x581a63['get']({'plain':!![]});interaction_log[_0x58e5('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x422c4e[_0x58e5('0x5f')]['id'],_0x422c4e[_0x58e5('0x5f')][_0x58e5('0x36')],_0x422c4e[_0x58e5('0x5f')]['role'],_0x264543[_0x58e5('0x67')]['id'],_0x422c4e[_0x58e5('0x55')]?JSON[_0x58e5('0x6b')](_0x422c4e[_0x58e5('0x55')]):_0x58e5('0x6c'));return respondWithRpcPromise('RejectMessage',_0x58e5('0x75'),_0x264543);}return null;})[_0x58e5('0x20')](function(_0x45d3e6){if(_0x45d3e6){_0x45d3e6[_0x58e5('0x27')][_0x58e5('0x76')]=util[_0x58e5('0x5c')](_0x58e5('0x70'),_0x422c4e[_0x58e5('0x5f')][_0x58e5('0x36')]);_0x45d3e6[_0x58e5('0x27')][_0x58e5('0x71')]=_0x264543[_0x58e5('0x71')];_0x45d3e6[_0x58e5('0x27')]['event']='reject';respondWithRpcPromise('EventManager',_0x58e5('0x73'),{'event':_0x58e5('0x77'),'message':_0x45d3e6[_0x58e5('0x27')]},client9002);return _0x264543;}return null;})['then'](respondWithResult(_0x144352,null))[_0x58e5('0x51')](handleError(_0x144352,null));};exports[_0x58e5('0x28')]=function(_0x458a5f,_0x2770ce,_0x11f467){if(_0x458a5f[_0x58e5('0x55')]['id']){delete _0x458a5f['body']['id'];}var _0x5f3a81;return db['WhatsappMessage'][_0x58e5('0x60')]({'where':{'id':_0x458a5f['params']['id']}})[_0x58e5('0x20')](handleEntityNotFound(_0x2770ce,null))['then'](function(_0x2778a7){if(_0x2778a7){_0x5f3a81=_0x2778a7;return db[_0x58e5('0x78')][_0x58e5('0x60')]({'where':{'id':_0x2778a7[_0x58e5('0x79')]}});}})['then'](handleEntityNotFound(_0x2770ce,null))['then'](function(_0x128107){if(_0x128107){logger[_0x58e5('0x23')](_0x58e5('0x7a'),_0x58e5('0x28'),_0x58e5('0x7b'),_0x128107['type'],util['inspect'](_0x458a5f[_0x58e5('0x55')],{'showHidden':![],'depth':null}));switch(_0x128107[_0x58e5('0x7c')]){case _0x58e5('0x7d'):if(_0x458a5f[_0x58e5('0x55')]['MessageSid']&&_0x458a5f[_0x58e5('0x55')][_0x58e5('0x7e')]===_0x5f3a81[_0x58e5('0x7f')]&&_0x458a5f['body'][_0x58e5('0x80')]&&_0x458a5f[_0x58e5('0x55')][_0x58e5('0x80')]===_0x58e5('0x81')){return _0x5f3a81[_0x58e5('0x32')]({'read':!![]});}else{logger[_0x58e5('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x58e5('0x28'),_0x58e5('0x7d'),util[_0x58e5('0x82')](_0x458a5f['body'],{'showHidden':![],'depth':null}));}break;}return _0x5f3a81;}})[_0x58e5('0x20')](respondWithResult(_0x2770ce,null))[_0x58e5('0x51')](handleError(_0x2770ce,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 688b61a..f13c44f 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x19950a,_0x48872f){var _0x37d31a=function(_0x4a6e76){while(--_0x4a6e76){_0x19950a['push'](_0x19950a['shift']());}};_0x37d31a(++_0x48872f);}(_0xb10b,0x12a));var _0xbb10=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xb10b[_0x17a32f];return _0x15a293;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x266d1c,_0x5a5afc){var _0x132d6a=function(_0x36759d){while(--_0x36759d){_0x266d1c['push'](_0x266d1c['shift']());}};_0x132d6a(++_0x5a5afc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x390002,_0x31e6f4){_0x390002=_0x390002-0x0;var _0x3855dc=_0x5f2f[_0x390002];return _0x3855dc;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 87a1244..e237f5b 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 _0xe23b=['WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','error','secret','WhatsappAccount','find','WhatsappAccountId','twilio','accountSid','authToken','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','then','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','../../config/environment','./whatsappMessage.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe23b,0x8a));var _0xbe23=function(_0x2a58f8,_0x18c18f){_0x2a58f8=_0x2a58f8-0x0;var _0x5262b6=_0xe23b[_0x2a58f8];return _0x5262b6;};'use strict';var _=require(_0xbe23('0x0'));var util=require(_0xbe23('0x1'));var logger=require('../../config/logger')(_0xbe23('0x2'));var moment=require('moment');var BPromise=require(_0xbe23('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe23('0x4'));var rimraf=require('rimraf');var config=require(_0xbe23('0x5'));var attributes=require(_0xbe23('0x6'));module[_0xbe23('0x7')]=function(_0x55b50c,_0x25e37c){return _0x55b50c[_0xbe23('0x8')](_0xbe23('0x9'),attributes,{'tableName':_0xbe23('0xa'),'paranoid':![],'indexes':[{'name':_0xbe23('0xb'),'fields':[_0xbe23('0xb')]},{'name':_0xbe23('0xc'),'fields':[_0xbe23('0xd')],'type':_0xbe23('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f23ae,_0x3d30f9,_0x2c979f){var _0x5e541c=_0x55b50c['models'];var _0x11559d=_0x3f23ae[_0xbe23('0xf')]({'plain':!![]});if(_0x11559d[_0xbe23('0x10')][_0xbe23('0x11')]()==='in'||_0x11559d['direction']['toLowerCase']()===_0xbe23('0x12')&&!_0x11559d['secret']&&!_[_0xbe23('0x13')](_0x11559d[_0xbe23('0x14')])){_0x5e541c[_0xbe23('0x15')][_0xbe23('0x16')]({'where':{'id':_0x11559d['WhatsappInteractionId']}})['then'](function(_0x59084f){if(_0x59084f){_0x59084f[_0xbe23('0x17')]({'lastMsgAt':_0x11559d[_0xbe23('0x18')],'lastMsgDirection':_0x11559d[_0xbe23('0x10')]['toLowerCase']()});}})['catch'](function(_0x156256){console[_0xbe23('0x19')](_0x156256);});}if(_0x11559d[_0xbe23('0x10')]==='out'&&!_0x11559d[_0xbe23('0x1a')]){var _0x3e6eb3;_0x5e541c[_0xbe23('0x1b')][_0xbe23('0x1c')]({'where':{'id':_0x11559d[_0xbe23('0x1d')]},'raw':!![]})['then'](function(_0x29e8ce){_0x3e6eb3=_0x29e8ce;if(_0x3e6eb3&&_0x3e6eb3['type']){switch(_0x3e6eb3['type']){case _0xbe23('0x1e'):var _0x4148c8=require(_0xbe23('0x1e'));if(_0x3e6eb3[_0xbe23('0x1f')]&&_0x3e6eb3[_0xbe23('0x20')]&&_0x3e6eb3['phone']){var _0x28a2a7=new _0x4148c8(_0x3e6eb3[_0xbe23('0x1f')],_0x3e6eb3['authToken']);_0x28a2a7['messages']['create']({'body':_0x11559d[_0xbe23('0xd')],'to':_0xbe23('0x21')+_0x11559d[_0xbe23('0x22')],'from':_0xbe23('0x21')+_0x3e6eb3[_0xbe23('0x22')],'statusCallback':_0x3e6eb3[_0xbe23('0x23')]+_0xbe23('0x24')+_0x11559d['id']+_0xbe23('0x25')+_0x3e6eb3[_0xbe23('0x26')]})[_0xbe23('0x27')](function(_0x3a04ff){if(_0x3a04ff[_0xbe23('0x28')]){return _0x3f23ae[_0xbe23('0x17')]({'messageId':_0x3a04ff[_0xbe23('0x28')]});}})[_0xbe23('0x29')](function(_0x2eeaa6){logger['error'](_0xbe23('0x2a'),'afterCreate','twilio',util[_0xbe23('0x2b')](_0x2eeaa6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbe23('0x2a'),_0xbe23('0x2c'),'twilio',_0xbe23('0x2d'));}break;}}})[_0xbe23('0x2e')](function(){_0x2c979f();});}else{_0x2c979f();}}},'charset':_0xbe23('0x2f'),'collate':_0xbe23('0x30')});}; \ No newline at end of file +var _0x3f4b=['error','out','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','create','whatsapp:','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','api','bluebird','path','rimraf','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','WhatsappInteraction','findOne','then','createdAt','catch'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x3f4b,0x98));var _0xb3f4=function(_0x4d0e1f,_0x2763e3){_0x4d0e1f=_0x4d0e1f-0x0;var _0x19f068=_0x3f4b[_0x4d0e1f];return _0x19f068;};'use strict';var _=require(_0xb3f4('0x0'));var util=require(_0xb3f4('0x1'));var logger=require('../../config/logger')(_0xb3f4('0x2'));var moment=require('moment');var BPromise=require(_0xb3f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3f4('0x4'));var rimraf=require(_0xb3f4('0x5'));var config=require('../../config/environment');var attributes=require(_0xb3f4('0x6'));module[_0xb3f4('0x7')]=function(_0x3460a0,_0x3898d1){return _0x3460a0[_0xb3f4('0x8')]('WhatsappMessage',attributes,{'tableName':_0xb3f4('0x9'),'paranoid':![],'indexes':[{'name':_0xb3f4('0xa'),'fields':['messageId']},{'name':_0xb3f4('0xb'),'fields':[_0xb3f4('0xc')],'type':_0xb3f4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3be42c,_0x1fbcd3,_0x5e3861){var _0x60710=_0x3460a0[_0xb3f4('0xe')];var _0xcbdb10=_0x3be42c[_0xb3f4('0xf')]({'plain':!![]});if(_0xcbdb10['direction']['toLowerCase']()==='in'||_0xcbdb10[_0xb3f4('0x10')][_0xb3f4('0x11')]()==='out'&&!_0xcbdb10['secret']&&!_['isNil'](_0xcbdb10[_0xb3f4('0x12')])){_0x60710[_0xb3f4('0x13')][_0xb3f4('0x14')]({'where':{'id':_0xcbdb10['WhatsappInteractionId']}})[_0xb3f4('0x15')](function(_0x56b039){if(_0x56b039){_0x56b039['update']({'lastMsgAt':_0xcbdb10[_0xb3f4('0x16')],'lastMsgDirection':_0xcbdb10['direction']['toLowerCase']()});}})[_0xb3f4('0x17')](function(_0x55dd8a){console[_0xb3f4('0x18')](_0x55dd8a);});}if(_0xcbdb10[_0xb3f4('0x10')]===_0xb3f4('0x19')&&!_0xcbdb10[_0xb3f4('0x1a')]){var _0x3f8f17;_0x60710[_0xb3f4('0x1b')][_0xb3f4('0x1c')]({'where':{'id':_0xcbdb10[_0xb3f4('0x1d')]},'raw':!![]})[_0xb3f4('0x15')](function(_0x3652d8){_0x3f8f17=_0x3652d8;if(_0x3f8f17&&_0x3f8f17[_0xb3f4('0x1e')]){switch(_0x3f8f17[_0xb3f4('0x1e')]){case _0xb3f4('0x1f'):var _0x59347d=require('twilio');if(_0x3f8f17['accountSid']&&_0x3f8f17[_0xb3f4('0x20')]&&_0x3f8f17[_0xb3f4('0x21')]){var _0x1622a6=new _0x59347d(_0x3f8f17[_0xb3f4('0x22')],_0x3f8f17['authToken']);_0x1622a6['messages'][_0xb3f4('0x23')]({'body':_0xcbdb10[_0xb3f4('0xc')],'to':'whatsapp:'+_0xcbdb10['phone'],'from':_0xb3f4('0x24')+_0x3f8f17[_0xb3f4('0x21')],'statusCallback':_0x3f8f17['remote']+'/api/whatsapp/messages/'+_0xcbdb10['id']+_0xb3f4('0x25')+_0x3f8f17['token']})[_0xb3f4('0x15')](function(_0x14de64){if(_0x14de64[_0xb3f4('0x26')]){return _0x3be42c['update']({'messageId':_0x14de64[_0xb3f4('0x26')]});}})[_0xb3f4('0x17')](function(_0x3c60ac){logger[_0xb3f4('0x18')](_0xb3f4('0x27'),_0xb3f4('0x28'),_0xb3f4('0x1f'),util['inspect'](_0x3c60ac,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb3f4('0x27'),_0xb3f4('0x28'),_0xb3f4('0x1f'),_0xb3f4('0x29'));}break;}}})[_0xb3f4('0x2a')](function(){_0x5e3861();});}else{_0x5e3861();}}},'charset':_0xb3f4('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1237aaa..da92fac 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 _0x99bd=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x99bd,0x116));var _0xd99b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x99bd[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd99b('0x0'));var util=require('util');var moment=require(_0xd99b('0x1'));var BPromise=require(_0xd99b('0x2'));var rs=require(_0xd99b('0x3'));var fs=require('fs');var Redis=require(_0xd99b('0x4'));var db=require(_0xd99b('0x5'))['db'];var utils=require(_0xd99b('0x6'));var logger=require(_0xd99b('0x7'))(_0xd99b('0x8'));var config=require(_0xd99b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd99b('0xa')]({'port':0x232a});config[_0xd99b('0xb')]=_[_0xd99b('0xc')](config[_0xd99b('0xb')],{'host':_0xd99b('0xd'),'port':0x18eb});var socket=require(_0xd99b('0xe'))(new Redis(config['redis']));require(_0xd99b('0xf'))['register'](socket);function respondWithRpcPromise(_0x515a37,_0x1f4814,_0x3079ad){return new BPromise(function(_0x14aea2,_0x59133e){return client[_0xd99b('0x10')](_0x515a37,_0x3079ad)['then'](function(_0xbc8a98){logger[_0xd99b('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x1f4814,_0xd99b('0x12'));logger[_0xd99b('0x13')](_0xd99b('0x14'),_0x1f4814,'request\x20sent',JSON[_0xd99b('0x15')](_0xbc8a98));if(_0xbc8a98[_0xd99b('0x16')]){if(_0xbc8a98[_0xd99b('0x16')]['code']===0x1f4){logger[_0xd99b('0x16')](_0xd99b('0x17'),_0x1f4814,_0xbc8a98[_0xd99b('0x16')][_0xd99b('0x18')]);return _0x59133e(_0xbc8a98['error'][_0xd99b('0x18')]);}logger[_0xd99b('0x16')](_0xd99b('0x17'),_0x1f4814,_0xbc8a98['error'][_0xd99b('0x18')]);return _0x14aea2(_0xbc8a98[_0xd99b('0x16')]['message']);}else{logger[_0xd99b('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x1f4814,_0xd99b('0x12'));_0x14aea2(_0xbc8a98[_0xd99b('0x19')][_0xd99b('0x18')]);}})[_0xd99b('0x1a')](function(_0x2b2cda){logger[_0xd99b('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x1f4814,_0x2b2cda);_0x59133e(_0x2b2cda);});});}exports[_0xd99b('0x1b')]=function(_0x56da19){var _0x4ccf85=this;return new Promise(function(_0x343dcf,_0x399f52){return db[_0xd99b('0x1c')][_0xd99b('0x1d')](_0x56da19['body'],{'raw':_0x56da19[_0xd99b('0x1e')]?_0x56da19[_0xd99b('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x56c16f){logger[_0xd99b('0x11')](_0xd99b('0x1b'),_0x56da19);logger[_0xd99b('0x13')](_0xd99b('0x1b'),_0x56da19,JSON[_0xd99b('0x15')](_0x56c16f));_0x343dcf(_0x56c16f);})[_0xd99b('0x1a')](function(_0x22c13a){logger['error'](_0xd99b('0x1b'),_0x22c13a[_0xd99b('0x18')],_0x56da19);_0x399f52(_0x4ccf85[_0xd99b('0x16')](0x1f4,_0x22c13a['message']));});});}; \ No newline at end of file +var _0xe9e3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','CreateWhatsappMessage','WhatsappMessage','body','options','raw','catch','lodash','moment','ioredis','../../mysqldb'];(function(_0x3a8b61,_0x317394){var _0x41bb0b=function(_0x1f5eef){while(--_0x1f5eef){_0x3a8b61['push'](_0x3a8b61['shift']());}};_0x41bb0b(++_0x317394);}(_0xe9e3,0x164));var _0x3e9e=function(_0x176308,_0x5b4d58){_0x176308=_0x176308-0x0;var _0x545160=_0xe9e3[_0x176308];return _0x545160;};'use strict';var _=require(_0x3e9e('0x0'));var util=require('util');var moment=require(_0x3e9e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e9e('0x2'));var db=require(_0x3e9e('0x3'))['db'];var utils=require(_0x3e9e('0x4'));var logger=require(_0x3e9e('0x5'))('rpc');var config=require(_0x3e9e('0x6'));var jayson=require(_0x3e9e('0x7'));var client=jayson[_0x3e9e('0x8')]['http']({'port':0x232a});config['redis']=_[_0x3e9e('0x9')](config[_0x3e9e('0xa')],{'host':_0x3e9e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3e9e('0xc'))[_0x3e9e('0xd')](socket);function respondWithRpcPromise(_0x513d46,_0x3df9d6,_0xb055fa){return new BPromise(function(_0x42a22d,_0x11924c){return client[_0x3e9e('0xe')](_0x513d46,_0xb055fa)[_0x3e9e('0xf')](function(_0x32d528){logger['info'](_0x3e9e('0x10'),_0x3df9d6,_0x3e9e('0x11'));logger[_0x3e9e('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3df9d6,_0x3e9e('0x11'),JSON[_0x3e9e('0x13')](_0x32d528));if(_0x32d528[_0x3e9e('0x14')]){if(_0x32d528[_0x3e9e('0x14')][_0x3e9e('0x15')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3df9d6,_0x32d528[_0x3e9e('0x14')][_0x3e9e('0x16')]);return _0x11924c(_0x32d528['error'][_0x3e9e('0x16')]);}logger[_0x3e9e('0x14')](_0x3e9e('0x10'),_0x3df9d6,_0x32d528[_0x3e9e('0x14')][_0x3e9e('0x16')]);return _0x42a22d(_0x32d528[_0x3e9e('0x14')][_0x3e9e('0x16')]);}else{logger[_0x3e9e('0x17')](_0x3e9e('0x10'),_0x3df9d6,'request\x20sent');_0x42a22d(_0x32d528['result'][_0x3e9e('0x16')]);}})['catch'](function(_0x5f0f58){logger[_0x3e9e('0x14')](_0x3e9e('0x10'),_0x3df9d6,_0x5f0f58);_0x11924c(_0x5f0f58);});});}exports[_0x3e9e('0x18')]=function(_0x6b35fd){var _0x245821=this;return new Promise(function(_0x335b06,_0x4bc854){return db[_0x3e9e('0x19')]['create'](_0x6b35fd[_0x3e9e('0x1a')],{'raw':_0x6b35fd[_0x3e9e('0x1b')]?_0x6b35fd[_0x3e9e('0x1b')][_0x3e9e('0x1c')]===undefined?!![]:![]:!![]})[_0x3e9e('0xf')](function(_0x3cba77){logger[_0x3e9e('0x17')](_0x3e9e('0x18'),_0x6b35fd);logger[_0x3e9e('0x12')](_0x3e9e('0x18'),_0x6b35fd,JSON['stringify'](_0x3cba77));_0x335b06(_0x3cba77);})[_0x3e9e('0x1d')](function(_0x2ed759){logger[_0x3e9e('0x14')](_0x3e9e('0x18'),_0x2ed759['message'],_0x6b35fd);_0x4bc854(_0x245821['error'](0x1f4,_0x2ed759[_0x3e9e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 9e431d1..748d8fb 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 _0x1737=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x1737,0x147));var _0x7173=function(_0x2eec52,_0x2a3f38){_0x2eec52=_0x2eec52-0x0;var _0x18547d=_0x1737[_0x2eec52];return _0x18547d;};'use strict';var WhatsappMessageEvents=require(_0x7173('0x0'));var events=[_0x7173('0x1'),'remove',_0x7173('0x2')];function createListener(_0x103b74,_0x5dbcfb){return function(_0x29c2e8){_0x5dbcfb[_0x7173('0x3')](_0x103b74,_0x29c2e8);};}function removeListener(_0x4db1c8,_0x11c18d){return function(){WhatsappMessageEvents['removeListener'](_0x4db1c8,_0x11c18d);};}exports[_0x7173('0x4')]=function(_0x415ad2){for(var _0x411706=0x0,_0x3029ee=events[_0x7173('0x5')];_0x411706<_0x3029ee;_0x411706++){var _0x3e1f34=events[_0x411706];var _0x3c97f9=createListener(_0x7173('0x6')+_0x3e1f34,_0x415ad2);WhatsappMessageEvents['on'](_0x3e1f34,_0x3c97f9);}}; \ No newline at end of file +var _0x5804=['whatsappMessage:','save','remove','update','emit','register','length'];(function(_0xec03b7,_0x5948d8){var _0x317fb8=function(_0x976723){while(--_0x976723){_0xec03b7['push'](_0xec03b7['shift']());}};_0x317fb8(++_0x5948d8);}(_0x5804,0x8d));var _0x4580=function(_0x496688,_0x2236bf){_0x496688=_0x496688-0x0;var _0x3caf1d=_0x5804[_0x496688];return _0x3caf1d;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x4580('0x0'),_0x4580('0x1'),_0x4580('0x2')];function createListener(_0x307fd7,_0x29f00f){return function(_0x482612){_0x29f00f[_0x4580('0x3')](_0x307fd7,_0x482612);};}function removeListener(_0x3220b0,_0xa09b0b){return function(){WhatsappMessageEvents['removeListener'](_0x3220b0,_0xa09b0b);};}exports[_0x4580('0x4')]=function(_0x33a3a3){for(var _0x2e6ec3=0x0,_0xd92c93=events[_0x4580('0x5')];_0x2e6ec3<_0xd92c93;_0x2e6ec3++){var _0x2c8cee=events[_0x2e6ec3];var _0x21623b=createListener(_0x4580('0x6')+_0x2c8cee,_0x33a3a3);WhatsappMessageEvents['on'](_0x2c8cee,_0x21623b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5ff35fe..6d3308d 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 _0x36c8=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer'];(function(_0x4f02ac,_0x5b385e){var _0x463598=function(_0x1bf373){while(--_0x1bf373){_0x4f02ac['push'](_0x4f02ac['shift']());}};_0x463598(++_0x5b385e);}(_0x36c8,0x13e));var _0x836c=function(_0x47d3a4,_0x5b1e1c){_0x47d3a4=_0x47d3a4-0x0;var _0x2650c5=_0x36c8[_0x47d3a4];return _0x2650c5;};'use strict';var multer=require(_0x836c('0x0'));var util=require(_0x836c('0x1'));var path=require(_0x836c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x836c('0x3')]();var auth=require(_0x836c('0x4'));var interaction=require(_0x836c('0x5'));var config=require(_0x836c('0x6'));var controller=require(_0x836c('0x7'));router[_0x836c('0x8')]('/',auth[_0x836c('0x9')](),controller['index']);router[_0x836c('0x8')](_0x836c('0xa'),auth[_0x836c('0x9')](),controller['describe']);router['get'](_0x836c('0xb'),auth[_0x836c('0x9')](),controller[_0x836c('0xc')]);router['get']('/:id/members',auth[_0x836c('0x9')](),controller[_0x836c('0xd')]);router[_0x836c('0x8')](_0x836c('0xe'),auth[_0x836c('0x9')](),controller[_0x836c('0xf')]);router[_0x836c('0x8')](_0x836c('0x10'),auth[_0x836c('0x9')](),controller[_0x836c('0x11')]);router[_0x836c('0x12')]('/',auth[_0x836c('0x9')](),controller[_0x836c('0x13')]);router['post']('/:id/teams',auth[_0x836c('0x9')](),controller[_0x836c('0x14')]);router[_0x836c('0x12')]('/:id/users',auth[_0x836c('0x9')](),controller[_0x836c('0x15')]);router[_0x836c('0x16')](_0x836c('0xb'),auth[_0x836c('0x9')](),controller[_0x836c('0x17')]);router['delete'](_0x836c('0xb'),auth['isAuthenticated'](),controller[_0x836c('0x18')]);router[_0x836c('0x19')](_0x836c('0xe'),auth[_0x836c('0x9')](),controller[_0x836c('0x1a')]);router[_0x836c('0x19')](_0x836c('0x10'),auth[_0x836c('0x9')](),controller[_0x836c('0x1b')]);module[_0x836c('0x1c')]=router; \ No newline at end of file +var _0x6239=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x5e7790,_0x29dd96){var _0x3716f6=function(_0x36a357){while(--_0x36a357){_0x5e7790['push'](_0x5e7790['shift']());}};_0x3716f6(++_0x29dd96);}(_0x6239,0xda));var _0x9623=function(_0x53b7c8,_0x2868fa){_0x53b7c8=_0x53b7c8-0x0;var _0x2c9b3e=_0x6239[_0x53b7c8];return _0x2c9b3e;};'use strict';var multer=require(_0x9623('0x0'));var util=require(_0x9623('0x1'));var path=require(_0x9623('0x2'));var timeout=require(_0x9623('0x3'));var express=require(_0x9623('0x4'));var router=express[_0x9623('0x5')]();var auth=require(_0x9623('0x6'));var interaction=require(_0x9623('0x7'));var config=require(_0x9623('0x8'));var controller=require(_0x9623('0x9'));router[_0x9623('0xa')]('/',auth[_0x9623('0xb')](),controller[_0x9623('0xc')]);router[_0x9623('0xa')](_0x9623('0xd'),auth[_0x9623('0xb')](),controller[_0x9623('0xe')]);router[_0x9623('0xa')](_0x9623('0xf'),auth[_0x9623('0xb')](),controller[_0x9623('0x10')]);router['get'](_0x9623('0x11'),auth[_0x9623('0xb')](),controller[_0x9623('0x12')]);router['get'](_0x9623('0x13'),auth[_0x9623('0xb')](),controller[_0x9623('0x14')]);router[_0x9623('0xa')](_0x9623('0x15'),auth[_0x9623('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x9623('0x16')]);router[_0x9623('0x17')]('/:id/teams',auth[_0x9623('0xb')](),controller[_0x9623('0x18')]);router[_0x9623('0x17')](_0x9623('0x15'),auth[_0x9623('0xb')](),controller['addAgents']);router['put'](_0x9623('0xf'),auth[_0x9623('0xb')](),controller[_0x9623('0x19')]);router[_0x9623('0x1a')](_0x9623('0xf'),auth[_0x9623('0xb')](),controller['destroy']);router[_0x9623('0x1a')]('/:id/teams',auth[_0x9623('0xb')](),controller[_0x9623('0x1b')]);router[_0x9623('0x1a')]('/:id/users',auth[_0x9623('0xb')](),controller['removeAgents']);module[_0x9623('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f941ad5..86e4f0c 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 _0x6e53=['sequelize','exports','ENUM','rrmemory','beepall','roundrobin'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x6e53,0x19e));var _0x36e5=function(_0xee0152,_0xfe1ea7){_0xee0152=_0xee0152-0x0;var _0x1a69d1=_0x6e53[_0xee0152];return _0x1a69d1;};'use strict';var Sequelize=require(_0x36e5('0x0'));module[_0x36e5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x36e5('0x2')](_0x36e5('0x3'),_0x36e5('0x4'),_0x36e5('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x72f7=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x3cf2ce,_0x4a34f6){var _0x47d881=function(_0x1fb7d3){while(--_0x1fb7d3){_0x3cf2ce['push'](_0x3cf2ce['shift']());}};_0x47d881(++_0x4a34f6);}(_0x72f7,0x12b));var _0x772f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x772f('0x0'));module[_0x772f('0x1')]={'name':{'type':Sequelize[_0x772f('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x772f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x772f('0x4')](_0x772f('0x5'),_0x772f('0x6'),_0x772f('0x7'))},'description':{'type':Sequelize[_0x772f('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9155513..206a8ed 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 _0x6dd6=['getAgents','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./whatsappQueue.socket','register','status','json','offset','set','Content-Range','apply','reject','save','update','then','WhatsappQueues','UserProfileResource','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','filter','options','WhatsappQueue','count','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','updatedAt','%s/%s','SIP','whatsappPause','createdAt','Team','getTeams','addTeams','Agents','online','voicePause','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','field','tq.TeamId','from','user_has_teams','WhatsappQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','all','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x6dd6,0x19c));var _0x66dd=function(_0x4f51f2,_0x277484){_0x4f51f2=_0x4f51f2-0x0;var _0x1cfdf3=_0x6dd6[_0x4f51f2];return _0x1cfdf3;};'use strict';var pdf=require(_0x66dd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66dd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66dd('0x2'));var moment=require(_0x66dd('0x3'));var BPromise=require(_0x66dd('0x4'));var Mustache=require(_0x66dd('0x5'));var util=require('util');var path=require(_0x66dd('0x6'));var sox=require(_0x66dd('0x7'));var csv=require(_0x66dd('0x8'));var ejs=require(_0x66dd('0x9'));var fs=require('fs');var _=require(_0x66dd('0xa'));var squel=require(_0x66dd('0xb'));var crypto=require(_0x66dd('0xc'));var jsforce=require(_0x66dd('0xd'));var deskjs=require(_0x66dd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x66dd('0xf'));var Papa=require(_0x66dd('0x10'));var Redis=require(_0x66dd('0x11'));var authService=require(_0x66dd('0x12'));var qs=require(_0x66dd('0x13'));var as=require(_0x66dd('0x14'));var hardwareService=require(_0x66dd('0x15'));var logger=require(_0x66dd('0x16'))(_0x66dd('0x17'));var utils=require(_0x66dd('0x18'));var config=require(_0x66dd('0x19'));var db=require('../../mysqldb')['db'];config[_0x66dd('0x1a')]=_[_0x66dd('0x1b')](config[_0x66dd('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x66dd('0x1a')]));require(_0x66dd('0x1c'))[_0x66dd('0x1d')](socket);function respondWithStatusCode(_0x46aec9,_0x341cfd){_0x341cfd=_0x341cfd||0xcc;return function(_0x407c36){if(_0x407c36){return _0x46aec9['sendStatus'](_0x341cfd);}return _0x46aec9['status'](_0x341cfd)['end']();};}function respondWithResult(_0x544335,_0x53a257){_0x53a257=_0x53a257||0xc8;return function(_0x5bfe48){if(_0x5bfe48){return _0x544335[_0x66dd('0x1e')](_0x53a257)[_0x66dd('0x1f')](_0x5bfe48);}};}function respondWithFilteredResult(_0x39051d,_0x284b30){return function(_0x40359e){if(_0x40359e){var _0x4341d4=_0x40359e['count'],_0x396638=_0x284b30[_0x66dd('0x20')],_0x4e2730=_0x284b30['offset']+_0x284b30['limit'],_0x4ce306;if(_0x4e2730>=_0x4341d4){_0x4e2730=_0x4341d4;_0x4ce306=0xc8;}else{_0x4ce306=0xce;}_0x39051d[_0x66dd('0x1e')](_0x4ce306);return _0x39051d[_0x66dd('0x21')](_0x66dd('0x22'),_0x396638+'-'+_0x4e2730+'/'+_0x4341d4)[_0x66dd('0x1f')](_0x40359e);}return null;};}function patchUpdates(_0xc7dc1d){return function(_0x270a56){try{jsonpatch[_0x66dd('0x23')](_0x270a56,_0xc7dc1d,!![]);}catch(_0x3bfffc){return BPromise[_0x66dd('0x24')](_0x3bfffc);}return _0x270a56[_0x66dd('0x25')]();};}function saveUpdates(_0x1f6373,_0x3ecd74){return function(_0x57eea2){if(_0x57eea2){return _0x57eea2[_0x66dd('0x26')](_0x1f6373)['then'](function(_0x923cc0){return _0x923cc0;});}return null;};}function removeEntity(_0x728fac,_0x1426f2){return function(_0x3a8413){if(_0x3a8413){return _0x3a8413['destroy']()[_0x66dd('0x27')](function(){var _0x1ffb35=_0x3a8413['get']({'plain':!![]});var _0x24b49b=_0x66dd('0x28');return db[_0x66dd('0x29')]['destroy']({'where':{'type':_0x24b49b,'resourceId':_0x1ffb35['id']}})[_0x66dd('0x27')](function(){return _0x3a8413;});})['then'](function(){_0x728fac[_0x66dd('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8a07,_0x2396ef){return function(_0x51a088){if(!_0x51a088){_0x3f8a07[_0x66dd('0x2a')](0x194);}return _0x51a088;};}function handleError(_0x1a2de3,_0xd28719){_0xd28719=_0xd28719||0x1f4;return function(_0x1fc66d){logger['error'](_0x1fc66d[_0x66dd('0x2b')]);if(_0x1fc66d['name']){delete _0x1fc66d['name'];}_0x1a2de3[_0x66dd('0x1e')](_0xd28719)[_0x66dd('0x2c')](_0x1fc66d);};}exports[_0x66dd('0x2d')]=function(_0x20c3be,_0x4ecf59){var _0x63132={},_0x4e07de={},_0x507149={'count':0x0,'rows':[]};var _0x54994b=_[_0x66dd('0x2e')](db['WhatsappQueue'][_0x66dd('0x2f')],function(_0x192b00){return{'name':_0x192b00[_0x66dd('0x30')],'type':_0x192b00[_0x66dd('0x31')][_0x66dd('0x32')]};});_0x4e07de[_0x66dd('0x33')]=_['map'](_0x54994b,_0x66dd('0x34'));_0x4e07de['query']=_['keys'](_0x20c3be[_0x66dd('0x35')]);_0x4e07de['filters']=_['intersection'](_0x4e07de['model'],_0x4e07de[_0x66dd('0x35')]);_0x63132[_0x66dd('0x36')]=_['intersection'](_0x4e07de[_0x66dd('0x33')],qs[_0x66dd('0x37')](_0x20c3be['query'][_0x66dd('0x37')]));_0x63132['attributes']=_0x63132['attributes'][_0x66dd('0x38')]?_0x63132[_0x66dd('0x36')]:_0x4e07de[_0x66dd('0x33')];if(!_0x20c3be[_0x66dd('0x35')][_0x66dd('0x39')](_0x66dd('0x3a'))){_0x63132['limit']=qs['limit'](_0x20c3be[_0x66dd('0x35')][_0x66dd('0x3b')]);_0x63132['offset']=qs['offset'](_0x20c3be[_0x66dd('0x35')][_0x66dd('0x20')]);}_0x63132[_0x66dd('0x3c')]=qs[_0x66dd('0x3d')](_0x20c3be[_0x66dd('0x35')][_0x66dd('0x3d')]);_0x63132[_0x66dd('0x3e')]=qs[_0x66dd('0x3f')](_[_0x66dd('0x40')](_0x20c3be[_0x66dd('0x35')],_0x4e07de['filters']),_0x54994b);if(_0x20c3be[_0x66dd('0x35')]['filter']){_0x63132[_0x66dd('0x3e')]=_[_0x66dd('0x41')](_0x63132['where'],{'$or':_[_0x66dd('0x2e')](_0x54994b,function(_0x11d32d){if(_0x11d32d[_0x66dd('0x31')]!=='VIRTUAL'){var _0x38c67c={};_0x38c67c[_0x11d32d[_0x66dd('0x34')]]={'$like':'%'+_0x20c3be['query'][_0x66dd('0x42')]+'%'};return _0x38c67c;}})});}_0x63132=_[_0x66dd('0x41')]({},_0x63132,_0x20c3be[_0x66dd('0x43')]);var _0x32b868={'where':_0x63132[_0x66dd('0x3e')]};return db[_0x66dd('0x44')][_0x66dd('0x45')](_0x32b868)[_0x66dd('0x27')](function(_0x13567a){_0x507149['count']=_0x13567a;if(_0x20c3be[_0x66dd('0x35')][_0x66dd('0x46')]){_0x63132[_0x66dd('0x47')]=[{'all':!![]}];}return db[_0x66dd('0x44')][_0x66dd('0x48')](_0x63132);})[_0x66dd('0x27')](function(_0x32a072){_0x507149[_0x66dd('0x49')]=_0x32a072;return _0x507149;})[_0x66dd('0x27')](respondWithFilteredResult(_0x4ecf59,_0x63132))[_0x66dd('0x4a')](handleError(_0x4ecf59,null));};exports[_0x66dd('0x4b')]=function(_0x3fd988,_0x409708){var _0x270923={'raw':!![],'where':{'id':_0x3fd988['params']['id']}},_0x28385a={};_0x28385a[_0x66dd('0x33')]=_[_0x66dd('0x4c')](db[_0x66dd('0x44')][_0x66dd('0x2f')]);_0x28385a['query']=_[_0x66dd('0x4c')](_0x3fd988[_0x66dd('0x35')]);_0x28385a[_0x66dd('0x3f')]=_['intersection'](_0x28385a[_0x66dd('0x33')],_0x28385a[_0x66dd('0x35')]);_0x270923[_0x66dd('0x36')]=_[_0x66dd('0x4d')](_0x28385a['model'],qs[_0x66dd('0x37')](_0x3fd988[_0x66dd('0x35')][_0x66dd('0x37')]));_0x270923['attributes']=_0x270923['attributes'][_0x66dd('0x38')]?_0x270923[_0x66dd('0x36')]:_0x28385a[_0x66dd('0x33')];if(_0x3fd988['query'][_0x66dd('0x46')]){_0x270923[_0x66dd('0x47')]=[{'all':!![]}];}_0x270923=_[_0x66dd('0x41')]({},_0x270923,_0x3fd988[_0x66dd('0x43')]);return db[_0x66dd('0x44')][_0x66dd('0x4e')](_0x270923)[_0x66dd('0x27')](handleEntityNotFound(_0x409708,null))[_0x66dd('0x27')](respondWithResult(_0x409708,null))[_0x66dd('0x4a')](handleError(_0x409708,null));};exports[_0x66dd('0x4f')]=function(_0x4529ef,_0x37519e){return db[_0x66dd('0x44')][_0x66dd('0x4f')](_0x4529ef[_0x66dd('0x50')],{})[_0x66dd('0x27')](function(_0xe2e24a){var _0x5a9001=_0x4529ef[_0x66dd('0x51')][_0x66dd('0x52')]({'plain':!![]});if(!_0x5a9001)throw new Error(_0x66dd('0x53'));if(_0x5a9001[_0x66dd('0x54')]==='user'){var _0xeae18a=_0xe2e24a[_0x66dd('0x52')]({'plain':!![]});var _0x32138f=_0x66dd('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x32138f,'userProfileId':_0x5a9001[_0x66dd('0x55')]},'raw':!![]})[_0x66dd('0x27')](function(_0x520e50){if(_0x520e50&&_0x520e50[_0x66dd('0x56')]===0x0){return db[_0x66dd('0x29')]['create']({'name':_0xeae18a[_0x66dd('0x34')],'resourceId':_0xeae18a['id'],'type':_0x520e50['name'],'sectionId':_0x520e50['id']},{})[_0x66dd('0x27')](function(){return _0xe2e24a;});}else{return _0xe2e24a;}})[_0x66dd('0x4a')](function(_0x2057d9){logger[_0x66dd('0x57')](_0x66dd('0x58'),_0x2057d9);throw _0x2057d9;});}return _0xe2e24a;})[_0x66dd('0x27')](respondWithResult(_0x37519e,0xc9))[_0x66dd('0x4a')](handleError(_0x37519e,null));};exports[_0x66dd('0x26')]=function(_0x5533cd,_0x2c05e5){if(_0x5533cd[_0x66dd('0x50')]['id']){delete _0x5533cd[_0x66dd('0x50')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x5533cd[_0x66dd('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c05e5,null))[_0x66dd('0x27')](saveUpdates(_0x5533cd[_0x66dd('0x50')],null))[_0x66dd('0x27')](respondWithResult(_0x2c05e5,null))[_0x66dd('0x4a')](handleError(_0x2c05e5,null));};exports[_0x66dd('0x5a')]=function(_0x1b9fa8,_0x2566ad){return db['WhatsappQueue'][_0x66dd('0x4e')]({'where':{'id':_0x1b9fa8[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](handleEntityNotFound(_0x2566ad,null))[_0x66dd('0x27')](removeEntity(_0x2566ad,null))[_0x66dd('0x4a')](handleError(_0x2566ad,null));};exports[_0x66dd('0x5b')]=function(_0x5604b1,_0x3ce4f1){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0x3ce4f1,null))['catch'](handleError(_0x3ce4f1,null));};exports[_0x66dd('0x5c')]=function(_0x26bb45,_0xdca0ff,_0x5e9473){var _0x59ac38={'raw':!![],'where':{}},_0x2289a5={},_0x38f6d7;return db[_0x66dd('0x44')][_0x66dd('0x5d')]({'where':{'id':_0x26bb45[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](handleEntityNotFound(_0xdca0ff,null))[_0x66dd('0x27')](function(_0x4bbfe6){if(_0x4bbfe6){_0x38f6d7=_0x4bbfe6[_0x66dd('0x52')]({'plain':!![]});_0x2289a5[_0x66dd('0x33')]=_[_0x66dd('0x4c')](db['UserWhatsappQueue']['rawAttributes']);_0x2289a5[_0x66dd('0x35')]=_[_0x66dd('0x4c')](_0x26bb45[_0x66dd('0x35')]);_0x2289a5[_0x66dd('0x3f')]=_['intersection'](_0x2289a5[_0x66dd('0x33')],_0x2289a5[_0x66dd('0x35')]);_0x59ac38[_0x66dd('0x36')]=_[_0x66dd('0x4d')](_0x2289a5[_0x66dd('0x33')],qs['fields'](_0x26bb45[_0x66dd('0x35')]['fields']));_0x59ac38['attributes']=_0x59ac38[_0x66dd('0x36')][_0x66dd('0x38')]?_0x59ac38[_0x66dd('0x36')]:_0x2289a5['model'];if(!_0x26bb45[_0x66dd('0x35')][_0x66dd('0x39')](_0x66dd('0x3a'))){_0x59ac38[_0x66dd('0x3b')]=qs[_0x66dd('0x3b')](_0x26bb45[_0x66dd('0x35')][_0x66dd('0x3b')]);_0x59ac38['offset']=qs[_0x66dd('0x20')](_0x26bb45[_0x66dd('0x35')][_0x66dd('0x20')]);}_0x59ac38[_0x66dd('0x3c')]=qs[_0x66dd('0x3d')](_0x26bb45[_0x66dd('0x35')][_0x66dd('0x3d')]);_0x59ac38['where']=qs[_0x66dd('0x3f')](_[_0x66dd('0x40')](_0x26bb45[_0x66dd('0x35')],_0x2289a5['filters']));_0x59ac38[_0x66dd('0x3e')][_0x66dd('0x5e')]=_0x4bbfe6['id'];if(_0x26bb45[_0x66dd('0x35')][_0x66dd('0x42')]){_0x59ac38[_0x66dd('0x3e')]=_[_0x66dd('0x41')](_0x59ac38['where'],{'$or':_[_0x66dd('0x2e')](_0x59ac38[_0x66dd('0x36')],function(_0x1762a8){var _0x5a7468={};_0x5a7468[_0x1762a8]={'$like':'%'+_0x26bb45[_0x66dd('0x35')][_0x66dd('0x42')]+'%'};return _0x5a7468;})});}_0x59ac38=_[_0x66dd('0x41')]({},_0x59ac38,_0x26bb45[_0x66dd('0x43')]);return db[_0x66dd('0x5f')][_0x66dd('0x48')](_0x59ac38);}})[_0x66dd('0x27')](function(_0x3c72fd){if(_0x3c72fd){return db[_0x66dd('0x60')][_0x66dd('0x61')]({'where':{'id':_[_0x66dd('0x2e')](_0x3c72fd,'UserId'),'role':'agent'},'attributes':['id','name','whatsappPause',_0x66dd('0x62'),'createdAt']});}})[_0x66dd('0x27')](function(_0x3f08e1){if(_0x3f08e1){return{'count':_0x3f08e1[_0x66dd('0x45')],'rows':_[_0x66dd('0x2e')](_0x3f08e1[_0x66dd('0x49')],function(_0x24ef84){return{'membername':_0x24ef84[_0x66dd('0x34')],'UserId':_0x24ef84['id'],'queue_name':_0x38f6d7[_0x66dd('0x34')],'WhatsappQueueId':_0x38f6d7['id'],'interface':util['format'](_0x66dd('0x63'),_0x66dd('0x64'),_0x24ef84[_0x66dd('0x34')]),'penalty':0x0,'paused':_0x24ef84[_0x66dd('0x65')],'createdAt':_0x24ef84[_0x66dd('0x66')],'updatedAt':_0x24ef84['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xdca0ff,_0x59ac38))[_0x66dd('0x4a')](handleError(_0xdca0ff,null));};exports['getTeams']=function(_0x14dfe7,_0x1aae61,_0x26e8e8){var _0x3244fa={};var _0x55e8da={};var _0x2fdc25;var _0x3944ae;return db[_0x66dd('0x44')][_0x66dd('0x5d')]({'where':{'id':_0x14dfe7[_0x66dd('0x59')]['id']}})['then'](handleEntityNotFound(_0x1aae61,null))[_0x66dd('0x27')](function(_0x5c9285){if(_0x5c9285){_0x2fdc25=_0x5c9285;_0x55e8da['model']=_[_0x66dd('0x4c')](db[_0x66dd('0x67')][_0x66dd('0x2f')]);_0x55e8da['query']=_['keys'](_0x14dfe7[_0x66dd('0x35')]);_0x55e8da[_0x66dd('0x3f')]=_['intersection'](_0x55e8da[_0x66dd('0x33')],_0x55e8da[_0x66dd('0x35')]);_0x3244fa[_0x66dd('0x36')]=_[_0x66dd('0x4d')](_0x55e8da[_0x66dd('0x33')],qs[_0x66dd('0x37')](_0x14dfe7[_0x66dd('0x35')][_0x66dd('0x37')]));_0x3244fa[_0x66dd('0x36')]=_0x3244fa[_0x66dd('0x36')][_0x66dd('0x38')]?_0x3244fa[_0x66dd('0x36')]:_0x55e8da['model'];_0x3244fa[_0x66dd('0x3c')]=qs[_0x66dd('0x3d')](_0x14dfe7['query'][_0x66dd('0x3d')]);_0x3244fa[_0x66dd('0x3e')]=qs[_0x66dd('0x3f')](_[_0x66dd('0x40')](_0x14dfe7['query'],_0x55e8da[_0x66dd('0x3f')]));if(_0x14dfe7[_0x66dd('0x35')][_0x66dd('0x42')]){_0x3244fa[_0x66dd('0x3e')]=_[_0x66dd('0x41')](_0x3244fa['where'],{'$or':_[_0x66dd('0x2e')](_0x3244fa[_0x66dd('0x36')],function(_0xbc977e){var _0x48d103={};_0x48d103[_0xbc977e]={'$like':'%'+_0x14dfe7[_0x66dd('0x35')][_0x66dd('0x42')]+'%'};return _0x48d103;})});}_0x3244fa=_['merge']({},_0x3244fa,_0x14dfe7[_0x66dd('0x43')]);return _0x2fdc25['getTeams'](_0x3244fa);}})['then'](function(_0x4282f0){if(_0x4282f0){_0x3944ae=_0x4282f0[_0x66dd('0x38')];if(!_0x14dfe7[_0x66dd('0x35')][_0x66dd('0x39')](_0x66dd('0x3a'))){_0x3244fa['limit']=qs[_0x66dd('0x3b')](_0x14dfe7[_0x66dd('0x35')]['limit']);_0x3244fa[_0x66dd('0x20')]=qs[_0x66dd('0x20')](_0x14dfe7['query'][_0x66dd('0x20')]);}return _0x2fdc25[_0x66dd('0x68')](_0x3244fa);}})[_0x66dd('0x27')](function(_0x4d6c88){if(_0x4d6c88){return _0x4d6c88?{'count':_0x3944ae,'rows':_0x4d6c88}:null;}})['then'](respondWithResult(_0x1aae61,null))['catch'](handleError(_0x1aae61,null));};exports[_0x66dd('0x69')]=function(_0x2265a4,_0x1df23e,_0x3ac90e){var _0x4c6b97=_0x2265a4['body']['ids'];return db[_0x66dd('0x67')][_0x66dd('0x48')]({'where':{'id':_0x4c6b97},'attributes':['id'],'include':[{'model':db['User'],'as':_0x66dd('0x6a'),'attributes':['id','name',_0x66dd('0x6b'),_0x66dd('0x6c'),'interface'],'raw':!![]}]})[_0x66dd('0x27')](function(_0x1eadc9){if(_0x1eadc9){var _0x374132=_['flatMap'](_0x1eadc9,function(_0x374da2){var _0x1ee3e1=_0x374da2[_0x66dd('0x52')]({'plain':!![]});return _0x1ee3e1[_0x66dd('0x6a')];});return db[_0x66dd('0x44')]['find']({'where':{'id':_0x2265a4[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](function(_0x1839c4){return db['sequelize'][_0x66dd('0x6d')](function(_0x23f827){return _0x1839c4['addTeams'](_0x4c6b97,{'transaction':_0x23f827})[_0x66dd('0x27')](function(){return BPromise[_0x66dd('0x6e')](_0x374132,function(_0x1827c3){return db[_0x66dd('0x5f')][_0x66dd('0x6f')]({'where':{'UserId':_0x1827c3['id'],'WhatsappQueueId':_0x2265a4[_0x66dd('0x59')]['id']},'transaction':_0x23f827});});})[_0x66dd('0x27')](function(){_0x374132[_0x66dd('0x70')](function(_0x15eba8){socket[_0x66dd('0x71')](_0x66dd('0x72'),{'UserId':_0x15eba8['id'],'WhatsappQueueId':_0x1839c4['id']});});});});});}})[_0x66dd('0x27')](respondWithStatusCode(_0x1df23e,null))['catch'](handleError(_0x1df23e,null));};exports[_0x66dd('0x73')]=function(_0x2ea43e,_0x3cef2f,_0x5841f1){return db[_0x66dd('0x67')][_0x66dd('0x48')]({'where':{'id':_0x2ea43e[_0x66dd('0x35')][_0x66dd('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x66dd('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x66dd('0x27')](handleEntityNotFound(_0x3cef2f,null))[_0x66dd('0x27')](function(_0x2d4efe){var _0x57843d=_[_0x66dd('0x2e')](_0x2d4efe,'id');var _0x106e65=[];var _0xd6a857=[];var _0x39e6e7=squel['select']();_0x39e6e7[_0x66dd('0x75')](_0x66dd('0x76'))[_0x66dd('0x77')]('team_has_whatsapp_queues','tq')['join'](_0x66dd('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x66dd('0x3e')](_0x66dd('0x79'),_0x2ea43e[_0x66dd('0x59')]['id']);for(var _0x2047d9=0x0;_0x2047d9<_0x2d4efe['length'];_0x2047d9+=0x1){let _0x5bccd4=_0x2d4efe[_0x2047d9];for(var _0x5ce2d8=0x0;_0x5ce2d8<_0x5bccd4[_0x66dd('0x6a')][_0x66dd('0x38')];_0x5ce2d8+=0x1){let _0xb433e4=_0x5bccd4[_0x66dd('0x6a')][_0x5ce2d8];var _0x141712=_0x39e6e7[_0x66dd('0x7a')]();_0x141712[_0x66dd('0x3e')]('ut.UserId\x20=\x20?',_0xb433e4['id']);_0xd6a857['push'](db[_0x66dd('0x7b')][_0x66dd('0x35')](_0x141712[_0x66dd('0x7c')](),{'type':db[_0x66dd('0x7b')][_0x66dd('0x7d')][_0x66dd('0x7e')]})['then'](function(_0x43373f){if(_0x43373f[_0x66dd('0x38')]===0x1){return _0xb433e4['id'];}else{var _0x16581e=_[_0x66dd('0x7f')](_[_0x66dd('0x2e')](_0x43373f,'TeamId'),function(_0xecbe21){return _['includes'](_0x57843d,_0xecbe21);});if(_0x16581e){return _0xb433e4['id'];}}}));}}return BPromise[_0x66dd('0x80')](_0xd6a857)[_0x66dd('0x27')](function(_0x201ac6){_0x106e65=_(_0x106e65)['union'](_0x201ac6)['compact']()[_0x66dd('0x81')]();return db[_0x66dd('0x44')][_0x66dd('0x4e')]({'where':{'id':_0x2ea43e[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](function(_0x3b87e7){return db[_0x66dd('0x7b')][_0x66dd('0x6d')](function(_0x1a6b6c){return _0x3b87e7[_0x66dd('0x73')](_0x2ea43e[_0x66dd('0x35')][_0x66dd('0x74')],{'transaction':_0x1a6b6c})['then'](function(){if(!_[_0x66dd('0x82')](_0x106e65)){return _0x3b87e7[_0x66dd('0x83')](_0x106e65,{'transaction':_0x1a6b6c});}})[_0x66dd('0x27')](function(){_0x106e65[_0x66dd('0x70')](function(_0x18c15c){socket[_0x66dd('0x71')](_0x66dd('0x84'),{'UserId':_0x18c15c,'WhatsappQueueId':_0x3b87e7['id']});});});});});});})[_0x66dd('0x27')](respondWithStatusCode(_0x3cef2f,null))['catch'](handleError(_0x3cef2f,null));};exports[_0x66dd('0x85')]=function(_0x9a789c,_0x400879,_0x17b51c){return db[_0x66dd('0x44')]['find']({'where':{'id':_0x9a789c[_0x66dd('0x59')]['id']}})['then'](handleEntityNotFound(_0x400879,null))[_0x66dd('0x27')](function(_0x4949a8){if(_0x4949a8){return _0x4949a8[_0x66dd('0x85')](_0x9a789c[_0x66dd('0x50')][_0x66dd('0x74')],_[_0x66dd('0x86')](_0x9a789c[_0x66dd('0x50')],['ids','id'])||{})['spread'](function(_0x415b8f){for(var _0x4df177=0x0;_0x4df177<_0x9a789c[_0x66dd('0x50')][_0x66dd('0x74')]['length'];_0x4df177+=0x1){socket['emit'](_0x66dd('0x72'),{'UserId':_0x9a789c[_0x66dd('0x50')]['ids'][_0x4df177],'WhatsappQueueId':_0x9a789c[_0x66dd('0x59')]['id']});}return _0x415b8f;});}})['then'](respondWithResult(_0x400879,null))[_0x66dd('0x4a')](handleError(_0x400879,null));};exports['removeAgents']=function(_0x2a4ebf,_0x53af3d,_0x28d185){return db['WhatsappQueue'][_0x66dd('0x4e')]({'where':{'id':_0x2a4ebf[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](handleEntityNotFound(_0x53af3d,null))['then'](function(_0x2b3827){if(_0x2b3827){return _0x2b3827[_0x66dd('0x83')](_0x2a4ebf['query']['ids'])[_0x66dd('0x27')](function(){if(_[_0x66dd('0x87')](_0x2a4ebf['query'][_0x66dd('0x74')])){for(var _0x54bd35=0x0;_0x54bd35<_0x2a4ebf[_0x66dd('0x35')][_0x66dd('0x74')][_0x66dd('0x38')];_0x54bd35+=0x1){socket['emit'](_0x66dd('0x84'),{'UserId':Number(_0x2a4ebf[_0x66dd('0x35')]['ids'][_0x54bd35]),'WhatsappQueueId':Number(_0x2a4ebf[_0x66dd('0x59')]['id'])});}}else{socket[_0x66dd('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x2a4ebf[_0x66dd('0x35')][_0x66dd('0x74')]),'WhatsappQueueId':Number(_0x2a4ebf[_0x66dd('0x59')]['id'])});}});}})[_0x66dd('0x27')](respondWithStatusCode(_0x53af3d,null))[_0x66dd('0x4a')](handleError(_0x53af3d,null));};exports[_0x66dd('0x88')]=function(_0x221e77,_0x4e9335,_0x5b00f0){var _0x27edd5={};var _0x17d0fc={};var _0x241033;var _0x25d347;return db[_0x66dd('0x44')][_0x66dd('0x5d')]({'where':{'id':_0x221e77[_0x66dd('0x59')]['id']}})['then'](handleEntityNotFound(_0x4e9335,null))['then'](function(_0x5b550f){if(_0x5b550f){_0x241033=_0x5b550f;_0x17d0fc[_0x66dd('0x33')]=_[_0x66dd('0x4c')](db['User'][_0x66dd('0x2f')]);_0x17d0fc['query']=_[_0x66dd('0x4c')](_0x221e77[_0x66dd('0x35')]);_0x17d0fc[_0x66dd('0x3f')]=_[_0x66dd('0x4d')](_0x17d0fc['model'],_0x17d0fc[_0x66dd('0x35')]);_0x27edd5[_0x66dd('0x36')]=_[_0x66dd('0x4d')](_0x17d0fc[_0x66dd('0x33')],qs[_0x66dd('0x37')](_0x221e77[_0x66dd('0x35')][_0x66dd('0x37')]));_0x27edd5[_0x66dd('0x36')]=_0x27edd5[_0x66dd('0x36')][_0x66dd('0x38')]?_0x27edd5['attributes']:_0x17d0fc['model'];_0x27edd5[_0x66dd('0x3c')]=qs['sort'](_0x221e77['query']['sort']);_0x27edd5['where']=qs['filters'](_[_0x66dd('0x40')](_0x221e77[_0x66dd('0x35')],_0x17d0fc[_0x66dd('0x3f')]));if(_0x221e77[_0x66dd('0x35')][_0x66dd('0x42')]){_0x27edd5[_0x66dd('0x3e')]=_[_0x66dd('0x41')](_0x27edd5['where'],{'$or':_[_0x66dd('0x2e')](_0x27edd5['attributes'],function(_0x18e307){var _0x54a9b0={};_0x54a9b0[_0x18e307]={'$like':'%'+_0x221e77[_0x66dd('0x35')][_0x66dd('0x42')]+'%'};return _0x54a9b0;})});}_0x27edd5=_['merge']({},_0x27edd5,_0x221e77[_0x66dd('0x43')]);return _0x241033[_0x66dd('0x88')](_0x27edd5);}})[_0x66dd('0x27')](function(_0x3367e4){if(_0x3367e4){_0x25d347=_0x3367e4[_0x66dd('0x38')];if(!_0x221e77[_0x66dd('0x35')][_0x66dd('0x39')](_0x66dd('0x3a'))){_0x27edd5['limit']=qs[_0x66dd('0x3b')](_0x221e77[_0x66dd('0x35')][_0x66dd('0x3b')]);_0x27edd5[_0x66dd('0x20')]=qs[_0x66dd('0x20')](_0x221e77[_0x66dd('0x35')][_0x66dd('0x20')]);}return _0x241033[_0x66dd('0x88')](_0x27edd5);}})[_0x66dd('0x27')](function(_0x26b50f){if(_0x26b50f){return _0x26b50f?{'count':_0x25d347,'rows':_0x26b50f}:null;}})[_0x66dd('0x27')](respondWithResult(_0x4e9335,null))[_0x66dd('0x4a')](handleError(_0x4e9335,null));}; \ No newline at end of file +var _0x43d9=['emit','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','WhatsappQueue','findAll','rows','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserWhatsappQueue','nolimit','order','WhatsappQueueId','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate'];(function(_0x15411f,_0x42bef8){var _0x555650=function(_0x215e4f){while(--_0x215e4f){_0x15411f['push'](_0x15411f['shift']());}};_0x555650(++_0x42bef8);}(_0x43d9,0x1aa));var _0x943d=function(_0x28796e,_0x22b201){_0x28796e=_0x28796e-0x0;var _0x25e5b3=_0x43d9[_0x28796e];return _0x25e5b3;};'use strict';var pdf=require(_0x943d('0x0'));var emlformat=require(_0x943d('0x1'));var rimraf=require(_0x943d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x943d('0x3'));var BPromise=require(_0x943d('0x4'));var Mustache=require(_0x943d('0x5'));var util=require('util');var path=require(_0x943d('0x6'));var sox=require(_0x943d('0x7'));var csv=require(_0x943d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x943d('0x9'));var squel=require(_0x943d('0xa'));var crypto=require(_0x943d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x943d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x943d('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x943d('0xd'));var logger=require('../../config/logger')(_0x943d('0xe'));var utils=require(_0x943d('0xf'));var config=require('../../config/environment');var db=require(_0x943d('0x10'))['db'];config['redis']=_['defaults'](config[_0x943d('0x11')],{'host':_0x943d('0x12'),'port':0x18eb});var socket=require(_0x943d('0x13'))(new Redis(config[_0x943d('0x11')]));require(_0x943d('0x14'))['register'](socket);function respondWithStatusCode(_0x100645,_0x199b7d){_0x199b7d=_0x199b7d||0xcc;return function(_0x4b10b2){if(_0x4b10b2){return _0x100645['sendStatus'](_0x199b7d);}return _0x100645['status'](_0x199b7d)['end']();};}function respondWithResult(_0x52134a,_0x10cd1d){_0x10cd1d=_0x10cd1d||0xc8;return function(_0x195a8a){if(_0x195a8a){return _0x52134a[_0x943d('0x15')](_0x10cd1d)[_0x943d('0x16')](_0x195a8a);}};}function respondWithFilteredResult(_0x270110,_0x42e84c){return function(_0xcf3b58){if(_0xcf3b58){var _0x51057e=_0xcf3b58[_0x943d('0x17')],_0x4fbae2=_0x42e84c[_0x943d('0x18')],_0x314c10=_0x42e84c[_0x943d('0x18')]+_0x42e84c[_0x943d('0x19')],_0x5db69a;if(_0x314c10>=_0x51057e){_0x314c10=_0x51057e;_0x5db69a=0xc8;}else{_0x5db69a=0xce;}_0x270110['status'](_0x5db69a);return _0x270110[_0x943d('0x1a')](_0x943d('0x1b'),_0x4fbae2+'-'+_0x314c10+'/'+_0x51057e)[_0x943d('0x16')](_0xcf3b58);}return null;};}function patchUpdates(_0x24e0ee){return function(_0x2cfe50){try{jsonpatch[_0x943d('0x1c')](_0x2cfe50,_0x24e0ee,!![]);}catch(_0x2ab409){return BPromise[_0x943d('0x1d')](_0x2ab409);}return _0x2cfe50[_0x943d('0x1e')]();};}function saveUpdates(_0x5cd385,_0x67c9f2){return function(_0x486495){if(_0x486495){return _0x486495['update'](_0x5cd385)[_0x943d('0x1f')](function(_0x3e8f74){return _0x3e8f74;});}return null;};}function removeEntity(_0x2c6018,_0x5d64f3){return function(_0x604f01){if(_0x604f01){return _0x604f01[_0x943d('0x20')]()['then'](function(){var _0x18ec61=_0x604f01[_0x943d('0x21')]({'plain':!![]});var _0x45aabf='WhatsappQueues';return db[_0x943d('0x22')][_0x943d('0x20')]({'where':{'type':_0x45aabf,'resourceId':_0x18ec61['id']}})['then'](function(){return _0x604f01;});})[_0x943d('0x1f')](function(){_0x2c6018[_0x943d('0x15')](0xcc)[_0x943d('0x23')]();});}};}function handleEntityNotFound(_0x11b20a,_0x786279){return function(_0x3be34f){if(!_0x3be34f){_0x11b20a[_0x943d('0x24')](0x194);}return _0x3be34f;};}function handleError(_0x43c684,_0x963b26){_0x963b26=_0x963b26||0x1f4;return function(_0x2a3213){logger[_0x943d('0x25')](_0x2a3213['stack']);if(_0x2a3213['name']){delete _0x2a3213[_0x943d('0x26')];}_0x43c684[_0x943d('0x15')](_0x963b26)[_0x943d('0x27')](_0x2a3213);};}exports[_0x943d('0x28')]=function(_0x4642e3,_0x59e7da){var _0x389b83={},_0x28edd3={},_0x430d1b={'count':0x0,'rows':[]};var _0x9af145=_['map'](db['WhatsappQueue'][_0x943d('0x29')],function(_0xcaf510){return{'name':_0xcaf510[_0x943d('0x2a')],'type':_0xcaf510[_0x943d('0x2b')][_0x943d('0x2c')]};});_0x28edd3[_0x943d('0x2d')]=_[_0x943d('0x2e')](_0x9af145,_0x943d('0x26'));_0x28edd3[_0x943d('0x2f')]=_[_0x943d('0x30')](_0x4642e3[_0x943d('0x2f')]);_0x28edd3[_0x943d('0x31')]=_[_0x943d('0x32')](_0x28edd3['model'],_0x28edd3[_0x943d('0x2f')]);_0x389b83['attributes']=_['intersection'](_0x28edd3[_0x943d('0x2d')],qs[_0x943d('0x33')](_0x4642e3[_0x943d('0x2f')][_0x943d('0x33')]));_0x389b83[_0x943d('0x34')]=_0x389b83[_0x943d('0x34')]['length']?_0x389b83[_0x943d('0x34')]:_0x28edd3[_0x943d('0x2d')];if(!_0x4642e3[_0x943d('0x2f')][_0x943d('0x35')]('nolimit')){_0x389b83['limit']=qs[_0x943d('0x19')](_0x4642e3[_0x943d('0x2f')][_0x943d('0x19')]);_0x389b83[_0x943d('0x18')]=qs['offset'](_0x4642e3['query']['offset']);}_0x389b83['order']=qs[_0x943d('0x36')](_0x4642e3[_0x943d('0x2f')][_0x943d('0x36')]);_0x389b83[_0x943d('0x37')]=qs[_0x943d('0x31')](_[_0x943d('0x38')](_0x4642e3[_0x943d('0x2f')],_0x28edd3['filters']),_0x9af145);if(_0x4642e3['query']['filter']){_0x389b83[_0x943d('0x37')]=_[_0x943d('0x39')](_0x389b83[_0x943d('0x37')],{'$or':_[_0x943d('0x2e')](_0x9af145,function(_0x5b5fe0){if(_0x5b5fe0[_0x943d('0x2b')]!==_0x943d('0x3a')){var _0x23a2c6={};_0x23a2c6[_0x5b5fe0[_0x943d('0x26')]]={'$like':'%'+_0x4642e3[_0x943d('0x2f')][_0x943d('0x3b')]+'%'};return _0x23a2c6;}})});}_0x389b83=_['merge']({},_0x389b83,_0x4642e3[_0x943d('0x3c')]);var _0x59e430={'where':_0x389b83['where']};return db['WhatsappQueue']['count'](_0x59e430)[_0x943d('0x1f')](function(_0x201d12){_0x430d1b[_0x943d('0x17')]=_0x201d12;if(_0x4642e3[_0x943d('0x2f')][_0x943d('0x3d')]){_0x389b83[_0x943d('0x3e')]=[{'all':!![]}];}return db[_0x943d('0x3f')][_0x943d('0x40')](_0x389b83);})[_0x943d('0x1f')](function(_0x478d9e){_0x430d1b[_0x943d('0x41')]=_0x478d9e;return _0x430d1b;})[_0x943d('0x1f')](respondWithFilteredResult(_0x59e7da,_0x389b83))[_0x943d('0x42')](handleError(_0x59e7da,null));};exports['show']=function(_0x51233a,_0x5502f4){var _0x42e60d={'raw':!![],'where':{'id':_0x51233a[_0x943d('0x43')]['id']}},_0x1ba29f={};_0x1ba29f[_0x943d('0x2d')]=_['keys'](db['WhatsappQueue']['rawAttributes']);_0x1ba29f[_0x943d('0x2f')]=_[_0x943d('0x30')](_0x51233a['query']);_0x1ba29f[_0x943d('0x31')]=_[_0x943d('0x32')](_0x1ba29f[_0x943d('0x2d')],_0x1ba29f[_0x943d('0x2f')]);_0x42e60d[_0x943d('0x34')]=_[_0x943d('0x32')](_0x1ba29f['model'],qs[_0x943d('0x33')](_0x51233a[_0x943d('0x2f')][_0x943d('0x33')]));_0x42e60d[_0x943d('0x34')]=_0x42e60d[_0x943d('0x34')][_0x943d('0x44')]?_0x42e60d[_0x943d('0x34')]:_0x1ba29f['model'];if(_0x51233a['query'][_0x943d('0x3d')]){_0x42e60d['include']=[{'all':!![]}];}_0x42e60d=_['merge']({},_0x42e60d,_0x51233a[_0x943d('0x3c')]);return db[_0x943d('0x3f')]['find'](_0x42e60d)[_0x943d('0x1f')](handleEntityNotFound(_0x5502f4,null))[_0x943d('0x1f')](respondWithResult(_0x5502f4,null))[_0x943d('0x42')](handleError(_0x5502f4,null));};exports['create']=function(_0x536225,_0x5eeb2b){return db['WhatsappQueue'][_0x943d('0x45')](_0x536225[_0x943d('0x46')],{})[_0x943d('0x1f')](function(_0x415d52){var _0x45c3d5=_0x536225[_0x943d('0x47')]['get']({'plain':!![]});if(!_0x45c3d5)throw new Error(_0x943d('0x48'));if(_0x45c3d5['role']===_0x943d('0x47')){var _0x2b205c=_0x415d52['get']({'plain':!![]});var _0x240671='WhatsappQueues';return db[_0x943d('0x49')]['find']({'where':{'name':_0x240671,'userProfileId':_0x45c3d5[_0x943d('0x4a')]},'raw':!![]})[_0x943d('0x1f')](function(_0x1205b7){if(_0x1205b7&&_0x1205b7[_0x943d('0x4b')]===0x0){return db[_0x943d('0x22')][_0x943d('0x45')]({'name':_0x2b205c[_0x943d('0x26')],'resourceId':_0x2b205c['id'],'type':_0x1205b7[_0x943d('0x26')],'sectionId':_0x1205b7['id']},{})[_0x943d('0x1f')](function(){return _0x415d52;});}else{return _0x415d52;}})[_0x943d('0x42')](function(_0x5b814a){logger[_0x943d('0x25')](_0x943d('0x4c'),_0x5b814a);throw _0x5b814a;});}return _0x415d52;})['then'](respondWithResult(_0x5eeb2b,0xc9))['catch'](handleError(_0x5eeb2b,null));};exports['update']=function(_0x4ffd8d,_0x4cc1ef){if(_0x4ffd8d['body']['id']){delete _0x4ffd8d[_0x943d('0x46')]['id'];}return db[_0x943d('0x3f')][_0x943d('0x4d')]({'where':{'id':_0x4ffd8d['params']['id']}})['then'](handleEntityNotFound(_0x4cc1ef,null))[_0x943d('0x1f')](saveUpdates(_0x4ffd8d[_0x943d('0x46')],null))[_0x943d('0x1f')](respondWithResult(_0x4cc1ef,null))[_0x943d('0x42')](handleError(_0x4cc1ef,null));};exports[_0x943d('0x20')]=function(_0x5befaf,_0x26ca6b){return db['WhatsappQueue'][_0x943d('0x4d')]({'where':{'id':_0x5befaf[_0x943d('0x43')]['id']}})['then'](handleEntityNotFound(_0x26ca6b,null))['then'](removeEntity(_0x26ca6b,null))[_0x943d('0x42')](handleError(_0x26ca6b,null));};exports['describe']=function(_0x401f7a,_0x364b81){return db[_0x943d('0x3f')][_0x943d('0x4e')]()[_0x943d('0x1f')](respondWithResult(_0x364b81,null))['catch'](handleError(_0x364b81,null));};exports['getMembers']=function(_0x416288,_0x5d6dcf,_0x471308){var _0x3f4b63={'raw':!![],'where':{}},_0xca8be={},_0x532824;return db['WhatsappQueue'][_0x943d('0x4f')]({'where':{'id':_0x416288[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x5d6dcf,null))[_0x943d('0x1f')](function(_0x1a7fd6){if(_0x1a7fd6){_0x532824=_0x1a7fd6['get']({'plain':!![]});_0xca8be[_0x943d('0x2d')]=_[_0x943d('0x30')](db[_0x943d('0x50')][_0x943d('0x29')]);_0xca8be['query']=_[_0x943d('0x30')](_0x416288[_0x943d('0x2f')]);_0xca8be[_0x943d('0x31')]=_[_0x943d('0x32')](_0xca8be[_0x943d('0x2d')],_0xca8be[_0x943d('0x2f')]);_0x3f4b63[_0x943d('0x34')]=_[_0x943d('0x32')](_0xca8be[_0x943d('0x2d')],qs[_0x943d('0x33')](_0x416288['query']['fields']));_0x3f4b63['attributes']=_0x3f4b63['attributes'][_0x943d('0x44')]?_0x3f4b63[_0x943d('0x34')]:_0xca8be[_0x943d('0x2d')];if(!_0x416288['query']['hasOwnProperty'](_0x943d('0x51'))){_0x3f4b63[_0x943d('0x19')]=qs[_0x943d('0x19')](_0x416288[_0x943d('0x2f')][_0x943d('0x19')]);_0x3f4b63[_0x943d('0x18')]=qs[_0x943d('0x18')](_0x416288['query'][_0x943d('0x18')]);}_0x3f4b63[_0x943d('0x52')]=qs[_0x943d('0x36')](_0x416288['query'][_0x943d('0x36')]);_0x3f4b63['where']=qs['filters'](_['pick'](_0x416288[_0x943d('0x2f')],_0xca8be[_0x943d('0x31')]));_0x3f4b63['where'][_0x943d('0x53')]=_0x1a7fd6['id'];if(_0x416288[_0x943d('0x2f')][_0x943d('0x3b')]){_0x3f4b63[_0x943d('0x37')]=_[_0x943d('0x39')](_0x3f4b63[_0x943d('0x37')],{'$or':_['map'](_0x3f4b63[_0x943d('0x34')],function(_0x58fdd1){var _0x45458a={};_0x45458a[_0x58fdd1]={'$like':'%'+_0x416288['query'][_0x943d('0x3b')]+'%'};return _0x45458a;})});}_0x3f4b63=_[_0x943d('0x39')]({},_0x3f4b63,_0x416288[_0x943d('0x3c')]);return db[_0x943d('0x50')]['findAll'](_0x3f4b63);}})[_0x943d('0x1f')](function(_0x50a522){if(_0x50a522){return db[_0x943d('0x54')]['findAndCountAll']({'where':{'id':_[_0x943d('0x2e')](_0x50a522,_0x943d('0x55')),'role':_0x943d('0x56')},'attributes':['id',_0x943d('0x26'),_0x943d('0x57'),_0x943d('0x58'),_0x943d('0x59')]});}})[_0x943d('0x1f')](function(_0x25de91){if(_0x25de91){return{'count':_0x25de91['count'],'rows':_[_0x943d('0x2e')](_0x25de91[_0x943d('0x41')],function(_0x3482ce){return{'membername':_0x3482ce[_0x943d('0x26')],'UserId':_0x3482ce['id'],'queue_name':_0x532824[_0x943d('0x26')],'WhatsappQueueId':_0x532824['id'],'interface':util[_0x943d('0x5a')](_0x943d('0x5b'),_0x943d('0x5c'),_0x3482ce[_0x943d('0x26')]),'penalty':0x0,'paused':_0x3482ce['whatsappPause'],'createdAt':_0x3482ce[_0x943d('0x59')],'updatedAt':_0x3482ce[_0x943d('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x943d('0x1f')](respondWithFilteredResult(_0x5d6dcf,_0x3f4b63))[_0x943d('0x42')](handleError(_0x5d6dcf,null));};exports[_0x943d('0x5d')]=function(_0xbe60cc,_0x40a1d4,_0x143f63){var _0x1193e1={};var _0x4c77d3={};var _0x226a13;var _0x45345a;return db[_0x943d('0x3f')][_0x943d('0x4f')]({'where':{'id':_0xbe60cc[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x40a1d4,null))[_0x943d('0x1f')](function(_0x5784fa){if(_0x5784fa){_0x226a13=_0x5784fa;_0x4c77d3[_0x943d('0x2d')]=_['keys'](db['Team'][_0x943d('0x29')]);_0x4c77d3[_0x943d('0x2f')]=_[_0x943d('0x30')](_0xbe60cc['query']);_0x4c77d3['filters']=_[_0x943d('0x32')](_0x4c77d3['model'],_0x4c77d3[_0x943d('0x2f')]);_0x1193e1[_0x943d('0x34')]=_[_0x943d('0x32')](_0x4c77d3[_0x943d('0x2d')],qs[_0x943d('0x33')](_0xbe60cc['query'][_0x943d('0x33')]));_0x1193e1[_0x943d('0x34')]=_0x1193e1[_0x943d('0x34')][_0x943d('0x44')]?_0x1193e1['attributes']:_0x4c77d3[_0x943d('0x2d')];_0x1193e1['order']=qs[_0x943d('0x36')](_0xbe60cc['query'][_0x943d('0x36')]);_0x1193e1['where']=qs[_0x943d('0x31')](_[_0x943d('0x38')](_0xbe60cc[_0x943d('0x2f')],_0x4c77d3[_0x943d('0x31')]));if(_0xbe60cc[_0x943d('0x2f')][_0x943d('0x3b')]){_0x1193e1[_0x943d('0x37')]=_[_0x943d('0x39')](_0x1193e1['where'],{'$or':_[_0x943d('0x2e')](_0x1193e1[_0x943d('0x34')],function(_0x520094){var _0x27cf28={};_0x27cf28[_0x520094]={'$like':'%'+_0xbe60cc[_0x943d('0x2f')][_0x943d('0x3b')]+'%'};return _0x27cf28;})});}_0x1193e1=_[_0x943d('0x39')]({},_0x1193e1,_0xbe60cc[_0x943d('0x3c')]);return _0x226a13['getTeams'](_0x1193e1);}})[_0x943d('0x1f')](function(_0x166df0){if(_0x166df0){_0x45345a=_0x166df0[_0x943d('0x44')];if(!_0xbe60cc[_0x943d('0x2f')][_0x943d('0x35')](_0x943d('0x51'))){_0x1193e1[_0x943d('0x19')]=qs[_0x943d('0x19')](_0xbe60cc[_0x943d('0x2f')]['limit']);_0x1193e1[_0x943d('0x18')]=qs[_0x943d('0x18')](_0xbe60cc['query']['offset']);}return _0x226a13[_0x943d('0x5d')](_0x1193e1);}})['then'](function(_0x44fcec){if(_0x44fcec){return _0x44fcec?{'count':_0x45345a,'rows':_0x44fcec}:null;}})[_0x943d('0x1f')](respondWithResult(_0x40a1d4,null))['catch'](handleError(_0x40a1d4,null));};exports[_0x943d('0x5e')]=function(_0x4af69e,_0x28cf61,_0x1a422d){var _0x3be1ee=_0x4af69e[_0x943d('0x46')][_0x943d('0x5f')];return db[_0x943d('0x60')]['findAll']({'where':{'id':_0x3be1ee},'attributes':['id'],'include':[{'model':db[_0x943d('0x54')],'as':_0x943d('0x61'),'attributes':['id','name',_0x943d('0x62'),_0x943d('0x63'),_0x943d('0x64')],'raw':!![]}]})[_0x943d('0x1f')](function(_0x4802d2){if(_0x4802d2){var _0x129692=_[_0x943d('0x65')](_0x4802d2,function(_0x1c5b2b){var _0xd67783=_0x1c5b2b['get']({'plain':!![]});return _0xd67783[_0x943d('0x61')];});return db[_0x943d('0x3f')][_0x943d('0x4d')]({'where':{'id':_0x4af69e[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](function(_0x573820){return db[_0x943d('0x66')][_0x943d('0x67')](function(_0x232c71){return _0x573820['addTeams'](_0x3be1ee,{'transaction':_0x232c71})[_0x943d('0x1f')](function(){return BPromise[_0x943d('0x68')](_0x129692,function(_0x28186d){return db[_0x943d('0x50')][_0x943d('0x69')]({'where':{'UserId':_0x28186d['id'],'WhatsappQueueId':_0x4af69e['params']['id']},'transaction':_0x232c71});});})['then'](function(){_0x129692['forEach'](function(_0x598de0){socket[_0x943d('0x6a')]('userWhatsappQueue:save',{'UserId':_0x598de0['id'],'WhatsappQueueId':_0x573820['id']});});});});});}})['then'](respondWithStatusCode(_0x28cf61,null))[_0x943d('0x42')](handleError(_0x28cf61,null));};exports[_0x943d('0x6b')]=function(_0x5bf3d8,_0x59eee8,_0x24547e){return db['Team'][_0x943d('0x40')]({'where':{'id':_0x5bf3d8[_0x943d('0x2f')][_0x943d('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x943d('0x61'),'attributes':['id'],'raw':!![]}]})[_0x943d('0x1f')](handleEntityNotFound(_0x59eee8,null))[_0x943d('0x1f')](function(_0x38e403){var _0x1bba08=_[_0x943d('0x2e')](_0x38e403,'id');var _0x41a272=[];var _0x74d859=[];var _0x361387=squel['select']();_0x361387['field'](_0x943d('0x6c'))[_0x943d('0x6d')]('team_has_whatsapp_queues','tq')[_0x943d('0x6e')]('user_has_teams','ut',_0x943d('0x6f'))['where'](_0x943d('0x70'),_0x5bf3d8['params']['id']);for(var _0x41e8d6=0x0;_0x41e8d6<_0x38e403[_0x943d('0x44')];_0x41e8d6+=0x1){let _0x1c6a81=_0x38e403[_0x41e8d6];for(var _0x599214=0x0;_0x599214<_0x1c6a81[_0x943d('0x61')]['length'];_0x599214+=0x1){let _0x582c93=_0x1c6a81['Agents'][_0x599214];var _0x493dc4=_0x361387[_0x943d('0x71')]();_0x493dc4[_0x943d('0x37')]('ut.UserId\x20=\x20?',_0x582c93['id']);_0x74d859[_0x943d('0x72')](db[_0x943d('0x66')]['query'](_0x493dc4[_0x943d('0x73')](),{'type':db[_0x943d('0x66')][_0x943d('0x74')][_0x943d('0x75')]})[_0x943d('0x1f')](function(_0x2c5b32){if(_0x2c5b32[_0x943d('0x44')]===0x1){return _0x582c93['id'];}else{var _0x6ea4c3=_[_0x943d('0x76')](_[_0x943d('0x2e')](_0x2c5b32,_0x943d('0x77')),function(_0xadc752){return _[_0x943d('0x78')](_0x1bba08,_0xadc752);});if(_0x6ea4c3){return _0x582c93['id'];}}}));}}return BPromise['all'](_0x74d859)[_0x943d('0x1f')](function(_0x27b425){_0x41a272=_(_0x41a272)[_0x943d('0x79')](_0x27b425)[_0x943d('0x7a')]()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0x5bf3d8[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](function(_0x482ae1){return db[_0x943d('0x66')][_0x943d('0x67')](function(_0x5eecd3){return _0x482ae1[_0x943d('0x6b')](_0x5bf3d8[_0x943d('0x2f')][_0x943d('0x5f')],{'transaction':_0x5eecd3})[_0x943d('0x1f')](function(){if(!_[_0x943d('0x7b')](_0x41a272)){return _0x482ae1[_0x943d('0x7c')](_0x41a272,{'transaction':_0x5eecd3});}})['then'](function(){_0x41a272[_0x943d('0x7d')](function(_0x5ec231){socket[_0x943d('0x6a')](_0x943d('0x7e'),{'UserId':_0x5ec231,'WhatsappQueueId':_0x482ae1['id']});});});});});});})[_0x943d('0x1f')](respondWithStatusCode(_0x59eee8,null))[_0x943d('0x42')](handleError(_0x59eee8,null));};exports[_0x943d('0x7f')]=function(_0x3c412a,_0x3dbb05,_0x479676){return db[_0x943d('0x3f')][_0x943d('0x4d')]({'where':{'id':_0x3c412a[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x3dbb05,null))[_0x943d('0x1f')](function(_0x3b3ae7){if(_0x3b3ae7){return _0x3b3ae7[_0x943d('0x7f')](_0x3c412a[_0x943d('0x46')][_0x943d('0x5f')],_[_0x943d('0x80')](_0x3c412a[_0x943d('0x46')],['ids','id'])||{})[_0x943d('0x81')](function(_0x4994e2){for(var _0x12ece0=0x0;_0x12ece0<_0x3c412a[_0x943d('0x46')][_0x943d('0x5f')][_0x943d('0x44')];_0x12ece0+=0x1){socket['emit'](_0x943d('0x82'),{'UserId':_0x3c412a[_0x943d('0x46')]['ids'][_0x12ece0],'WhatsappQueueId':_0x3c412a[_0x943d('0x43')]['id']});}return _0x4994e2;});}})[_0x943d('0x1f')](respondWithResult(_0x3dbb05,null))['catch'](handleError(_0x3dbb05,null));};exports[_0x943d('0x7c')]=function(_0x31a6e7,_0x2c543d,_0x47c38b){return db[_0x943d('0x3f')]['find']({'where':{'id':_0x31a6e7[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x2c543d,null))['then'](function(_0x13eaa2){if(_0x13eaa2){return _0x13eaa2[_0x943d('0x7c')](_0x31a6e7['query'][_0x943d('0x5f')])[_0x943d('0x1f')](function(){if(_[_0x943d('0x83')](_0x31a6e7[_0x943d('0x2f')]['ids'])){for(var _0x24b401=0x0;_0x24b401<_0x31a6e7[_0x943d('0x2f')][_0x943d('0x5f')][_0x943d('0x44')];_0x24b401+=0x1){socket['emit'](_0x943d('0x7e'),{'UserId':Number(_0x31a6e7[_0x943d('0x2f')][_0x943d('0x5f')][_0x24b401]),'WhatsappQueueId':Number(_0x31a6e7['params']['id'])});}}else{socket[_0x943d('0x6a')]('userWhatsappQueue:remove',{'UserId':Number(_0x31a6e7[_0x943d('0x2f')][_0x943d('0x5f')]),'WhatsappQueueId':Number(_0x31a6e7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2c543d,null))[_0x943d('0x42')](handleError(_0x2c543d,null));};exports[_0x943d('0x84')]=function(_0x3ea1fc,_0x34764c,_0x7bfe49){var _0x5d84e1={};var _0x5f4b4c={};var _0x327ede;var _0xc8de9b;return db['WhatsappQueue'][_0x943d('0x4f')]({'where':{'id':_0x3ea1fc[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x34764c,null))['then'](function(_0x5ad8c7){if(_0x5ad8c7){_0x327ede=_0x5ad8c7;_0x5f4b4c[_0x943d('0x2d')]=_[_0x943d('0x30')](db['User'][_0x943d('0x29')]);_0x5f4b4c['query']=_[_0x943d('0x30')](_0x3ea1fc[_0x943d('0x2f')]);_0x5f4b4c[_0x943d('0x31')]=_['intersection'](_0x5f4b4c['model'],_0x5f4b4c[_0x943d('0x2f')]);_0x5d84e1['attributes']=_[_0x943d('0x32')](_0x5f4b4c['model'],qs[_0x943d('0x33')](_0x3ea1fc[_0x943d('0x2f')]['fields']));_0x5d84e1['attributes']=_0x5d84e1[_0x943d('0x34')][_0x943d('0x44')]?_0x5d84e1['attributes']:_0x5f4b4c[_0x943d('0x2d')];_0x5d84e1['order']=qs[_0x943d('0x36')](_0x3ea1fc[_0x943d('0x2f')][_0x943d('0x36')]);_0x5d84e1[_0x943d('0x37')]=qs[_0x943d('0x31')](_[_0x943d('0x38')](_0x3ea1fc['query'],_0x5f4b4c[_0x943d('0x31')]));if(_0x3ea1fc['query']['filter']){_0x5d84e1[_0x943d('0x37')]=_[_0x943d('0x39')](_0x5d84e1[_0x943d('0x37')],{'$or':_[_0x943d('0x2e')](_0x5d84e1[_0x943d('0x34')],function(_0x5c4338){var _0x3b7966={};_0x3b7966[_0x5c4338]={'$like':'%'+_0x3ea1fc[_0x943d('0x2f')]['filter']+'%'};return _0x3b7966;})});}_0x5d84e1=_[_0x943d('0x39')]({},_0x5d84e1,_0x3ea1fc['options']);return _0x327ede[_0x943d('0x84')](_0x5d84e1);}})[_0x943d('0x1f')](function(_0x3d27b6){if(_0x3d27b6){_0xc8de9b=_0x3d27b6['length'];if(!_0x3ea1fc[_0x943d('0x2f')]['hasOwnProperty'](_0x943d('0x51'))){_0x5d84e1[_0x943d('0x19')]=qs[_0x943d('0x19')](_0x3ea1fc[_0x943d('0x2f')][_0x943d('0x19')]);_0x5d84e1[_0x943d('0x18')]=qs[_0x943d('0x18')](_0x3ea1fc['query']['offset']);}return _0x327ede[_0x943d('0x84')](_0x5d84e1);}})[_0x943d('0x1f')](function(_0x15e740){if(_0x15e740){return _0x15e740?{'count':_0xc8de9b,'rows':_0x15e740}:null;}})[_0x943d('0x1f')](respondWithResult(_0x34764c,null))[_0x943d('0x42')](handleError(_0x34764c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index a0d365e..5bf976c 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 _0x77ad=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x11a880,_0x7486ae){var _0x2e4e68=function(_0x9d62e0){while(--_0x9d62e0){_0x11a880['push'](_0x11a880['shift']());}};_0x2e4e68(++_0x7486ae);}(_0x77ad,0xd0));var _0xd77a=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x77ad[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require(_0xd77a('0x0'));var WhatsappQueue=require(_0xd77a('0x1'))['db'][_0xd77a('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd77a('0x3')](0x0);var events={'afterCreate':_0xd77a('0x4'),'afterUpdate':_0xd77a('0x5'),'afterDestroy':_0xd77a('0x6')};function emitEvent(_0x57b212){return function(_0x4973ad,_0x3e3613,_0x52731c){WhatsappQueueEvents[_0xd77a('0x7')](_0x57b212+':'+_0x4973ad['id'],_0x4973ad);WhatsappQueueEvents[_0xd77a('0x7')](_0x57b212,_0x4973ad);_0x52731c(null);};}for(var e in events){if(events[_0xd77a('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xd77a('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x512a=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x421657,_0x239a58){var _0x34ffde=function(_0x59deb7){while(--_0x59deb7){_0x421657['push'](_0x421657['shift']());}};_0x34ffde(++_0x239a58);}(_0x512a,0x1c6));var _0xa512=function(_0x491b61,_0x28c91b){_0x491b61=_0x491b61-0x0;var _0x2c5d9e=_0x512a[_0x491b61];return _0x2c5d9e;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xa512('0x0'))['db'][_0xa512('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa512('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa512('0x3'),'afterDestroy':_0xa512('0x4')};function emitEvent(_0x2b5375){return function(_0x8d4fd2,_0x5e0e81,_0x2764e3){WhatsappQueueEvents[_0xa512('0x5')](_0x2b5375+':'+_0x8d4fd2['id'],_0x8d4fd2);WhatsappQueueEvents[_0xa512('0x5')](_0x2b5375,_0x8d4fd2);_0x2764e3(null);};}for(var e in events){if(events[_0xa512('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 98ec950..80856d9 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 _0x3436=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x14a3a4,_0x301918){var _0x520315=function(_0x2f6762){while(--_0x2f6762){_0x14a3a4['push'](_0x14a3a4['shift']());}};_0x520315(++_0x301918);}(_0x3436,0x97));var _0x6343=function(_0x320c28,_0xb93600){_0x320c28=_0x320c28-0x0;var _0x3252=_0x3436[_0x320c28];return _0x3252;};'use strict';var _=require(_0x6343('0x0'));var util=require('util');var logger=require(_0x6343('0x1'))('api');var moment=require(_0x6343('0x2'));var BPromise=require(_0x6343('0x3'));var rp=require(_0x6343('0x4'));var fs=require('fs');var path=require(_0x6343('0x5'));var rimraf=require(_0x6343('0x6'));var config=require(_0x6343('0x7'));var attributes=require(_0x6343('0x8'));module[_0x6343('0x9')]=function(_0x2f589b,_0x5f4401){return _0x2f589b[_0x6343('0xa')](_0x6343('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a40=['bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','../../config/logger','api'];(function(_0x178164,_0x5bd858){var _0x4c84aa=function(_0x3a0597){while(--_0x3a0597){_0x178164['push'](_0x178164['shift']());}};_0x4c84aa(++_0x5bd858);}(_0x7a40,0x76));var _0x07a4=function(_0x38efe2,_0x1be7ae){_0x38efe2=_0x38efe2-0x0;var _0x5ef0f6=_0x7a40[_0x38efe2];return _0x5ef0f6;};'use strict';var _=require(_0x07a4('0x0'));var util=require('util');var logger=require(_0x07a4('0x1'))(_0x07a4('0x2'));var moment=require('moment');var BPromise=require(_0x07a4('0x3'));var rp=require(_0x07a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07a4('0x5'));var config=require(_0x07a4('0x6'));var attributes=require(_0x07a4('0x7'));module[_0x07a4('0x8')]=function(_0x20ea03,_0x3b0377){return _0x20ea03[_0x07a4('0x9')](_0x07a4('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 04b842d..30dcbbc 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 _0x2c50=['options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','catch','ShowWhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueue'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0x2c50,0x8a));var _0x02c5=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x2c50[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x02c5('0x0'));var util=require(_0x02c5('0x1'));var moment=require(_0x02c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x02c5('0x3'));var fs=require('fs');var Redis=require(_0x02c5('0x4'));var db=require(_0x02c5('0x5'))['db'];var utils=require(_0x02c5('0x6'));var logger=require(_0x02c5('0x7'))(_0x02c5('0x8'));var config=require(_0x02c5('0x9'));var jayson=require(_0x02c5('0xa'));var client=jayson[_0x02c5('0xb')]['http']({'port':0x232a});config[_0x02c5('0xc')]=_[_0x02c5('0xd')](config[_0x02c5('0xc')],{'host':_0x02c5('0xe'),'port':0x18eb});var socket=require(_0x02c5('0xf'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x02c5('0x10')](socket);function respondWithRpcPromise(_0x22c945,_0x3e8053,_0x26c67d){return new BPromise(function(_0x42094c,_0x3121c4){return client[_0x02c5('0x11')](_0x22c945,_0x26c67d)[_0x02c5('0x12')](function(_0x44ea4c){logger[_0x02c5('0x13')](_0x02c5('0x14'),_0x3e8053,_0x02c5('0x15'));logger[_0x02c5('0x16')](_0x02c5('0x17'),_0x3e8053,_0x02c5('0x15'),JSON[_0x02c5('0x18')](_0x44ea4c));if(_0x44ea4c[_0x02c5('0x19')]){if(_0x44ea4c[_0x02c5('0x19')][_0x02c5('0x1a')]===0x1f4){logger[_0x02c5('0x19')](_0x02c5('0x14'),_0x3e8053,_0x44ea4c[_0x02c5('0x19')][_0x02c5('0x1b')]);return _0x3121c4(_0x44ea4c[_0x02c5('0x19')]['message']);}logger[_0x02c5('0x19')](_0x02c5('0x14'),_0x3e8053,_0x44ea4c['error'][_0x02c5('0x1b')]);return _0x42094c(_0x44ea4c[_0x02c5('0x19')][_0x02c5('0x1b')]);}else{logger[_0x02c5('0x13')](_0x02c5('0x14'),_0x3e8053,_0x02c5('0x15'));_0x42094c(_0x44ea4c[_0x02c5('0x1c')]['message']);}})['catch'](function(_0x162708){logger[_0x02c5('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x3e8053,_0x162708);_0x3121c4(_0x162708);});});}exports['GetWhatsappQueue']=function(_0x5cb657){var _0x564906=this;return new Promise(function(_0x8b1ae0,_0x66768e){return db[_0x02c5('0x1d')]['findAll']({'raw':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657['options'][_0x02c5('0x1f')]===undefined?!![]:![]:!![],'where':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657[_0x02c5('0x1e')][_0x02c5('0x20')]||null:null,'attributes':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657[_0x02c5('0x1e')][_0x02c5('0x21')]||null:null,'limit':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657[_0x02c5('0x1e')][_0x02c5('0x22')]||null:null,'include':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657[_0x02c5('0x1e')][_0x02c5('0x23')]?_['map'](_0x5cb657[_0x02c5('0x1e')]['include'],function(_0x293ed0){return{'model':db[_0x293ed0['model']],'as':_0x293ed0['as'],'attributes':_0x293ed0['attributes'],'include':_0x293ed0['include']?_[_0x02c5('0x24')](_0x293ed0['include'],function(_0x3eb518){return{'model':db[_0x3eb518[_0x02c5('0x25')]],'as':_0x3eb518['as'],'attributes':_0x3eb518['attributes'],'include':_0x3eb518[_0x02c5('0x23')]?_['map'](_0x3eb518[_0x02c5('0x23')],function(_0x32781f){return{'model':db[_0x32781f[_0x02c5('0x25')]],'as':_0x32781f['as'],'attributes':_0x32781f[_0x02c5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x02c5('0x12')](function(_0x5d2ad0){logger[_0x02c5('0x13')](_0x02c5('0x26'),_0x5cb657);logger['debug']('GetWhatsappQueue',_0x5cb657,JSON['stringify'](_0x5d2ad0));_0x8b1ae0(_0x5d2ad0);})[_0x02c5('0x27')](function(_0x5614bb){logger[_0x02c5('0x19')](_0x02c5('0x26'),_0x5614bb[_0x02c5('0x1b')],_0x5cb657);_0x66768e(_0x564906['error'](0x1f4,_0x5614bb['message']));});});};exports[_0x02c5('0x28')]=function(_0x1b288d){var _0x346c0e=this;return new Promise(function(_0x427398,_0x1b7b50){return db['WhatsappQueue'][_0x02c5('0x29')]({'raw':_0x1b288d[_0x02c5('0x1e')]?_0x1b288d[_0x02c5('0x1e')][_0x02c5('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b288d[_0x02c5('0x1e')]?_0x1b288d[_0x02c5('0x1e')][_0x02c5('0x20')]||null:null,'attributes':_0x1b288d['options']?_0x1b288d['options']['attributes']||null:null,'include':_0x1b288d['options']?_0x1b288d[_0x02c5('0x1e')][_0x02c5('0x23')]?_[_0x02c5('0x24')](_0x1b288d[_0x02c5('0x1e')][_0x02c5('0x23')],function(_0x2cd11c){return{'model':db[_0x2cd11c['model']],'as':_0x2cd11c['as'],'attributes':_0x2cd11c[_0x02c5('0x21')],'include':_0x2cd11c['include']?_['map'](_0x2cd11c['include'],function(_0x4aaa7e){return{'model':db[_0x4aaa7e[_0x02c5('0x25')]],'as':_0x4aaa7e['as'],'attributes':_0x4aaa7e[_0x02c5('0x21')],'include':_0x4aaa7e[_0x02c5('0x23')]?_[_0x02c5('0x24')](_0x4aaa7e[_0x02c5('0x23')],function(_0x4b7e6f){return{'model':db[_0x4b7e6f[_0x02c5('0x25')]],'as':_0x4b7e6f['as'],'attributes':_0x4b7e6f[_0x02c5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x02c5('0x12')](function(_0x2cd2d6){logger[_0x02c5('0x13')](_0x02c5('0x28'),_0x1b288d);logger[_0x02c5('0x16')]('ShowWhatsappQueue',_0x1b288d,JSON['stringify'](_0x2cd2d6));_0x427398(_0x2cd2d6);})[_0x02c5('0x27')](function(_0x58956d){logger[_0x02c5('0x19')](_0x02c5('0x28'),_0x58956d['message'],_0x1b288d);_0x1b7b50(_0x346c0e[_0x02c5('0x19')](0x1f4,_0x58956d['message']));});});}; \ No newline at end of file +var _0x4ade=['include','map','model','attributes','GetWhatsappQueue','find','where','ShowWhatsappQueue','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','WhatsappQueue','findAll','options','raw'];(function(_0xe34c3d,_0x54be63){var _0x515aa2=function(_0x4dd1e2){while(--_0x4dd1e2){_0xe34c3d['push'](_0xe34c3d['shift']());}};_0x515aa2(++_0x54be63);}(_0x4ade,0xa0));var _0xe4ad=function(_0x38e076,_0x71d3d){_0x38e076=_0x38e076-0x0;var _0x4a49cb=_0x4ade[_0x38e076];return _0x4a49cb;};'use strict';var _=require(_0xe4ad('0x0'));var util=require(_0xe4ad('0x1'));var moment=require('moment');var BPromise=require(_0xe4ad('0x2'));var rs=require(_0xe4ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe4ad('0x4'));var logger=require('../../config/logger')(_0xe4ad('0x5'));var config=require(_0xe4ad('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe4ad('0x7')]({'port':0x232a});config['redis']=_[_0xe4ad('0x8')](config[_0xe4ad('0x9')],{'host':_0xe4ad('0xa'),'port':0x18eb});var socket=require(_0xe4ad('0xb'))(new Redis(config[_0xe4ad('0x9')]));require(_0xe4ad('0xc'))[_0xe4ad('0xd')](socket);function respondWithRpcPromise(_0x26a2f1,_0x4039eb,_0x31b877){return new BPromise(function(_0x32cabe,_0x1692c9){return client[_0xe4ad('0xe')](_0x26a2f1,_0x31b877)[_0xe4ad('0xf')](function(_0x1fa602){logger['info'](_0xe4ad('0x10'),_0x4039eb,'request\x20sent');logger[_0xe4ad('0x11')](_0xe4ad('0x12'),_0x4039eb,_0xe4ad('0x13'),JSON[_0xe4ad('0x14')](_0x1fa602));if(_0x1fa602['error']){if(_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x16')]===0x1f4){logger['error'](_0xe4ad('0x10'),_0x4039eb,_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x17')]);return _0x1692c9(_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x17')]);}logger['error'](_0xe4ad('0x10'),_0x4039eb,_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x17')]);return _0x32cabe(_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x17')]);}else{logger[_0xe4ad('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x4039eb,'request\x20sent');_0x32cabe(_0x1fa602['result'][_0xe4ad('0x17')]);}})[_0xe4ad('0x19')](function(_0x4801e5){logger[_0xe4ad('0x15')](_0xe4ad('0x10'),_0x4039eb,_0x4801e5);_0x1692c9(_0x4801e5);});});}exports['GetWhatsappQueue']=function(_0x4bcc1e){var _0xf182dd=this;return new Promise(function(_0x115780,_0x7825d9){return db[_0xe4ad('0x1a')][_0xe4ad('0x1b')]({'raw':_0x4bcc1e[_0xe4ad('0x1c')]?_0x4bcc1e[_0xe4ad('0x1c')][_0xe4ad('0x1d')]===undefined?!![]:![]:!![],'where':_0x4bcc1e[_0xe4ad('0x1c')]?_0x4bcc1e['options']['where']||null:null,'attributes':_0x4bcc1e['options']?_0x4bcc1e[_0xe4ad('0x1c')]['attributes']||null:null,'limit':_0x4bcc1e[_0xe4ad('0x1c')]?_0x4bcc1e[_0xe4ad('0x1c')]['limit']||null:null,'include':_0x4bcc1e[_0xe4ad('0x1c')]?_0x4bcc1e['options'][_0xe4ad('0x1e')]?_[_0xe4ad('0x1f')](_0x4bcc1e[_0xe4ad('0x1c')][_0xe4ad('0x1e')],function(_0xd45e9d){return{'model':db[_0xd45e9d[_0xe4ad('0x20')]],'as':_0xd45e9d['as'],'attributes':_0xd45e9d[_0xe4ad('0x21')],'include':_0xd45e9d['include']?_[_0xe4ad('0x1f')](_0xd45e9d[_0xe4ad('0x1e')],function(_0x353313){return{'model':db[_0x353313[_0xe4ad('0x20')]],'as':_0x353313['as'],'attributes':_0x353313[_0xe4ad('0x21')],'include':_0x353313[_0xe4ad('0x1e')]?_['map'](_0x353313[_0xe4ad('0x1e')],function(_0xfcd4ad){return{'model':db[_0xfcd4ad[_0xe4ad('0x20')]],'as':_0xfcd4ad['as'],'attributes':_0xfcd4ad[_0xe4ad('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x265c78){logger[_0xe4ad('0x18')]('GetWhatsappQueue',_0x4bcc1e);logger[_0xe4ad('0x11')]('GetWhatsappQueue',_0x4bcc1e,JSON[_0xe4ad('0x14')](_0x265c78));_0x115780(_0x265c78);})[_0xe4ad('0x19')](function(_0x17d63d){logger[_0xe4ad('0x15')](_0xe4ad('0x22'),_0x17d63d[_0xe4ad('0x17')],_0x4bcc1e);_0x7825d9(_0xf182dd[_0xe4ad('0x15')](0x1f4,_0x17d63d['message']));});});};exports['ShowWhatsappQueue']=function(_0x341685){var _0x193b8=this;return new Promise(function(_0x432b75,_0xb2dfc9){return db[_0xe4ad('0x1a')][_0xe4ad('0x23')]({'raw':_0x341685[_0xe4ad('0x1c')]?_0x341685[_0xe4ad('0x1c')][_0xe4ad('0x1d')]===undefined?!![]:![]:!![],'where':_0x341685[_0xe4ad('0x1c')]?_0x341685[_0xe4ad('0x1c')][_0xe4ad('0x24')]||null:null,'attributes':_0x341685[_0xe4ad('0x1c')]?_0x341685[_0xe4ad('0x1c')][_0xe4ad('0x21')]||null:null,'include':_0x341685[_0xe4ad('0x1c')]?_0x341685[_0xe4ad('0x1c')]['include']?_[_0xe4ad('0x1f')](_0x341685[_0xe4ad('0x1c')]['include'],function(_0x352f53){return{'model':db[_0x352f53[_0xe4ad('0x20')]],'as':_0x352f53['as'],'attributes':_0x352f53[_0xe4ad('0x21')],'include':_0x352f53['include']?_[_0xe4ad('0x1f')](_0x352f53[_0xe4ad('0x1e')],function(_0x522c80){return{'model':db[_0x522c80[_0xe4ad('0x20')]],'as':_0x522c80['as'],'attributes':_0x522c80[_0xe4ad('0x21')],'include':_0x522c80[_0xe4ad('0x1e')]?_[_0xe4ad('0x1f')](_0x522c80[_0xe4ad('0x1e')],function(_0x196aee){return{'model':db[_0x196aee[_0xe4ad('0x20')]],'as':_0x196aee['as'],'attributes':_0x196aee[_0xe4ad('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54b6e0){logger[_0xe4ad('0x18')](_0xe4ad('0x25'),_0x341685);logger[_0xe4ad('0x11')](_0xe4ad('0x25'),_0x341685,JSON[_0xe4ad('0x14')](_0x54b6e0));_0x432b75(_0x54b6e0);})[_0xe4ad('0x19')](function(_0x2285ef){logger[_0xe4ad('0x15')](_0xe4ad('0x25'),_0x2285ef['message'],_0x341685);_0xb2dfc9(_0x193b8['error'](0x1f4,_0x2285ef[_0xe4ad('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 59672db..313c31f 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 _0x1545=['length','./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x2060f8,_0x155202){var _0x533d1c=function(_0x42f71b){while(--_0x42f71b){_0x2060f8['push'](_0x2060f8['shift']());}};_0x533d1c(++_0x155202);}(_0x1545,0x1b3));var _0x5154=function(_0x166953,_0x214d3a){_0x166953=_0x166953-0x0;var _0x4a8baf=_0x1545[_0x166953];return _0x4a8baf;};'use strict';var WhatsappQueueEvents=require(_0x5154('0x0'));var events=[_0x5154('0x1'),_0x5154('0x2'),_0x5154('0x3')];function createListener(_0x2963bb,_0x4b7e9c){return function(_0x1f3362){_0x4b7e9c['emit'](_0x2963bb,_0x1f3362);};}function removeListener(_0x5f0757,_0x23c3c2){return function(){WhatsappQueueEvents[_0x5154('0x4')](_0x5f0757,_0x23c3c2);};}exports[_0x5154('0x5')]=function(_0x329b1e){for(var _0x2d17d8=0x0,_0x2498f9=events[_0x5154('0x6')];_0x2d17d8<_0x2498f9;_0x2d17d8++){var _0x273bd7=events[_0x2d17d8];var _0x13f56f=createListener('whatsappQueue:'+_0x273bd7,_0x329b1e);WhatsappQueueEvents['on'](_0x273bd7,_0x13f56f);}}; \ No newline at end of file +var _0x4f9d=['emit','register','length','./whatsappQueue.events','save','remove'];(function(_0x45937f,_0x256a25){var _0x5bf5d1=function(_0x4300bd){while(--_0x4300bd){_0x45937f['push'](_0x45937f['shift']());}};_0x5bf5d1(++_0x256a25);}(_0x4f9d,0x1b3));var _0xd4f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f9d[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require(_0xd4f9('0x0'));var events=[_0xd4f9('0x1'),_0xd4f9('0x2'),'update'];function createListener(_0x357191,_0x269039){return function(_0x30abe0){_0x269039[_0xd4f9('0x3')](_0x357191,_0x30abe0);};}function removeListener(_0x2d6634,_0x562996){return function(){WhatsappQueueEvents['removeListener'](_0x2d6634,_0x562996);};}exports[_0xd4f9('0x4')]=function(_0x39f445){for(var _0x5d4724=0x0,_0x33a055=events[_0xd4f9('0x5')];_0x5d4724<_0x33a055;_0x5d4724++){var _0x1bada0=events[_0x5d4724];var _0x151221=createListener('whatsappQueue:'+_0x1bada0,_0x39f445);WhatsappQueueEvents['on'](_0x1bada0,_0x151221);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d8f8ea0..1023185 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 _0xb145=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','put','update','delete'];(function(_0x292440,_0x1ca5d9){var _0x17db5f=function(_0x29fb04){while(--_0x29fb04){_0x292440['push'](_0x292440['shift']());}};_0x17db5f(++_0x1ca5d9);}(_0xb145,0xa3));var _0x5b14=function(_0x50e876,_0x29a6a5){_0x50e876=_0x50e876-0x0;var _0x4e9491=_0xb145[_0x50e876];return _0x4e9491;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var auth=require(_0x5b14('0x5'));var interaction=require(_0x5b14('0x6'));var config=require(_0x5b14('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x5b14('0x8')]('/',auth[_0x5b14('0x9')](),controller[_0x5b14('0xa')]);router[_0x5b14('0x8')]('/describe',auth[_0x5b14('0x9')](),controller[_0x5b14('0xb')]);router[_0x5b14('0x8')](_0x5b14('0xc'),auth[_0x5b14('0x9')](),controller['show']);router[_0x5b14('0xd')]('/',auth[_0x5b14('0x9')](),controller['create']);router[_0x5b14('0xe')](_0x5b14('0xc'),auth[_0x5b14('0x9')](),controller[_0x5b14('0xf')]);router[_0x5b14('0x10')]('/:id',auth[_0x5b14('0x9')](),controller['destroy']);module[_0x5b14('0x11')]=router; \ No newline at end of file +var _0xe511=['util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','post','put','update','delete','destroy','exports','multer'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe511,0x143));var _0x1e51=function(_0x3e29df,_0x42fdf8){_0x3e29df=_0x3e29df-0x0;var _0x3e3ba9=_0xe511[_0x3e29df];return _0x3e3ba9;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require(_0x1e51('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e51('0x3'));var router=express[_0x1e51('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x1e51('0x7')](),controller[_0x1e51('0x8')]);router[_0x1e51('0x9')]('/describe',auth[_0x1e51('0x7')](),controller[_0x1e51('0xa')]);router['get'](_0x1e51('0xb'),auth[_0x1e51('0x7')](),controller['show']);router[_0x1e51('0xc')]('/',auth[_0x1e51('0x7')](),controller['create']);router[_0x1e51('0xd')](_0x1e51('0xb'),auth['isAuthenticated'](),controller[_0x1e51('0xe')]);router[_0x1e51('0xf')](_0x1e51('0xb'),auth[_0x1e51('0x7')](),controller[_0x1e51('0x10')]);module[_0x1e51('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5c2a917..5e54502 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x77694d,_0x12531a){var _0x2f0cba=function(_0x4df11a){while(--_0x4df11a){_0x77694d['push'](_0x77694d['shift']());}};_0x2f0cba(++_0x12531a);}(_0x34e8,0x12c));var _0x834e=function(_0x348391,_0x1ed6d1){_0x348391=_0x348391-0x0;var _0x960d59=_0x34e8[_0x348391];return _0x960d59;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x24b773,_0x392c26){_0x24b773=_0x24b773-0x0;var _0x35f6c9=_0xf3cd[_0x24b773];return _0x35f6c9;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 33e0d8c..843a6ab 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 _0x6237=['then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','filter','options','WhatsappQueueReport','include','findAll','rows','catch','show','params','keys','length','includeAll','create','update','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save'];(function(_0x30bdff,_0x308063){var _0x1e7ca9=function(_0x1a6e16){while(--_0x1a6e16){_0x30bdff['push'](_0x30bdff['shift']());}};_0x1e7ca9(++_0x308063);}(_0x6237,0xc4));var _0x7623=function(_0x363618,_0x5ebf3a){_0x363618=_0x363618-0x0;var _0x496dee=_0x6237[_0x363618];return _0x496dee;};'use strict';var pdf=require(_0x7623('0x0'));var emlformat=require(_0x7623('0x1'));var rimraf=require(_0x7623('0x2'));var zipdir=require(_0x7623('0x3'));var jsonpatch=require(_0x7623('0x4'));var rp=require(_0x7623('0x5'));var moment=require('moment');var BPromise=require(_0x7623('0x6'));var Mustache=require(_0x7623('0x7'));var util=require(_0x7623('0x8'));var path=require('path');var sox=require(_0x7623('0x9'));var csv=require(_0x7623('0xa'));var ejs=require(_0x7623('0xb'));var fs=require('fs');var _=require(_0x7623('0xc'));var squel=require('squel');var crypto=require(_0x7623('0xd'));var jsforce=require(_0x7623('0xe'));var deskjs=require(_0x7623('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7623('0x10'));var Papa=require(_0x7623('0x11'));var Redis=require(_0x7623('0x12'));var authService=require(_0x7623('0x13'));var qs=require(_0x7623('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7623('0x15'));var logger=require('../../config/logger')(_0x7623('0x16'));var utils=require(_0x7623('0x17'));var config=require(_0x7623('0x18'));var db=require(_0x7623('0x19'))['db'];function respondWithStatusCode(_0x1d82bb,_0xc4c6ee){_0xc4c6ee=_0xc4c6ee||0xcc;return function(_0x545b45){if(_0x545b45){return _0x1d82bb[_0x7623('0x1a')](_0xc4c6ee);}return _0x1d82bb[_0x7623('0x1b')](_0xc4c6ee)['end']();};}function respondWithResult(_0x58b10d,_0xc1a820){_0xc1a820=_0xc1a820||0xc8;return function(_0x4ef92a){if(_0x4ef92a){return _0x58b10d['status'](_0xc1a820)[_0x7623('0x1c')](_0x4ef92a);}};}function respondWithFilteredResult(_0x2693ad,_0x14520f){return function(_0x57d2a9){if(_0x57d2a9){var _0x542cd8=_0x57d2a9[_0x7623('0x1d')],_0x26e536=_0x14520f[_0x7623('0x1e')],_0x1f4214=_0x14520f[_0x7623('0x1e')]+_0x14520f['limit'],_0xf1972e;if(_0x1f4214>=_0x542cd8){_0x1f4214=_0x542cd8;_0xf1972e=0xc8;}else{_0xf1972e=0xce;}_0x2693ad['status'](_0xf1972e);return _0x2693ad[_0x7623('0x1f')](_0x7623('0x20'),_0x26e536+'-'+_0x1f4214+'/'+_0x542cd8)[_0x7623('0x1c')](_0x57d2a9);}return null;};}function patchUpdates(_0x2c9ffa){return function(_0xd288d4){try{jsonpatch['apply'](_0xd288d4,_0x2c9ffa,!![]);}catch(_0x966f9b){return BPromise[_0x7623('0x21')](_0x966f9b);}return _0xd288d4[_0x7623('0x22')]();};}function saveUpdates(_0x238593,_0x4fe221){return function(_0x2d9bce){if(_0x2d9bce){return _0x2d9bce['update'](_0x238593)[_0x7623('0x23')](function(_0x1070be){return _0x1070be;});}return null;};}function removeEntity(_0x33f68a,_0x2e306d){return function(_0x2cb2d8){if(_0x2cb2d8){return _0x2cb2d8[_0x7623('0x24')]()[_0x7623('0x23')](function(){_0x33f68a[_0x7623('0x1b')](0xcc)[_0x7623('0x25')]();});}};}function handleEntityNotFound(_0x3916cf,_0x3cac7c){return function(_0x34cdd2){if(!_0x34cdd2){_0x3916cf[_0x7623('0x1a')](0x194);}return _0x34cdd2;};}function handleError(_0x405440,_0x5a88d9){_0x5a88d9=_0x5a88d9||0x1f4;return function(_0x58ea19){logger[_0x7623('0x26')](_0x58ea19[_0x7623('0x27')]);if(_0x58ea19[_0x7623('0x28')]){delete _0x58ea19[_0x7623('0x28')];}_0x405440['status'](_0x5a88d9)[_0x7623('0x29')](_0x58ea19);};}exports['index']=function(_0x555a2a,_0x1c73ff){var _0x3d5b90={},_0x253f48={},_0x2505cc={'count':0x0,'rows':[]};var _0x237ac7=_[_0x7623('0x2a')](db['WhatsappQueueReport'][_0x7623('0x2b')],function(_0xf6b458){return{'name':_0xf6b458[_0x7623('0x2c')],'type':_0xf6b458[_0x7623('0x2d')][_0x7623('0x2e')]};});_0x253f48[_0x7623('0x2f')]=_[_0x7623('0x2a')](_0x237ac7,_0x7623('0x28'));_0x253f48[_0x7623('0x30')]=_['keys'](_0x555a2a[_0x7623('0x30')]);_0x253f48['filters']=_['intersection'](_0x253f48[_0x7623('0x2f')],_0x253f48[_0x7623('0x30')]);_0x3d5b90[_0x7623('0x31')]=_[_0x7623('0x32')](_0x253f48[_0x7623('0x2f')],qs[_0x7623('0x33')](_0x555a2a[_0x7623('0x30')]['fields']));_0x3d5b90[_0x7623('0x31')]=_0x3d5b90[_0x7623('0x31')]['length']?_0x3d5b90[_0x7623('0x31')]:_0x253f48['model'];if(!_0x555a2a[_0x7623('0x30')][_0x7623('0x34')](_0x7623('0x35'))){_0x3d5b90['limit']=qs[_0x7623('0x36')](_0x555a2a[_0x7623('0x30')][_0x7623('0x36')]);_0x3d5b90[_0x7623('0x1e')]=qs['offset'](_0x555a2a['query'][_0x7623('0x1e')]);}_0x3d5b90[_0x7623('0x37')]=qs[_0x7623('0x38')](_0x555a2a[_0x7623('0x30')]['sort']);_0x3d5b90[_0x7623('0x39')]=qs[_0x7623('0x3a')](_[_0x7623('0x3b')](_0x555a2a[_0x7623('0x30')],_0x253f48['filters']),_0x237ac7);if(_0x555a2a[_0x7623('0x30')]['filter']){_0x3d5b90['where']=_[_0x7623('0x3c')](_0x3d5b90[_0x7623('0x39')],{'$or':_[_0x7623('0x2a')](_0x237ac7,function(_0x52074c){if(_0x52074c['type']!=='VIRTUAL'){var _0x4b3747={};_0x4b3747[_0x52074c['name']]={'$like':'%'+_0x555a2a[_0x7623('0x30')][_0x7623('0x3d')]+'%'};return _0x4b3747;}})});}_0x3d5b90=_[_0x7623('0x3c')]({},_0x3d5b90,_0x555a2a[_0x7623('0x3e')]);var _0x623ce3={'where':_0x3d5b90['where']};return db[_0x7623('0x3f')][_0x7623('0x1d')](_0x623ce3)[_0x7623('0x23')](function(_0x3d88b7){_0x2505cc['count']=_0x3d88b7;if(_0x555a2a['query']['includeAll']){_0x3d5b90[_0x7623('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x7623('0x41')](_0x3d5b90);})['then'](function(_0x43a1bf){_0x2505cc[_0x7623('0x42')]=_0x43a1bf;return _0x2505cc;})[_0x7623('0x23')](respondWithFilteredResult(_0x1c73ff,_0x3d5b90))[_0x7623('0x43')](handleError(_0x1c73ff,null));};exports[_0x7623('0x44')]=function(_0x40f6f4,_0x85766a){var _0x2d42df={'raw':!![],'where':{'id':_0x40f6f4[_0x7623('0x45')]['id']}},_0x591822={};_0x591822[_0x7623('0x2f')]=_[_0x7623('0x46')](db['WhatsappQueueReport'][_0x7623('0x2b')]);_0x591822[_0x7623('0x30')]=_['keys'](_0x40f6f4['query']);_0x591822[_0x7623('0x3a')]=_[_0x7623('0x32')](_0x591822[_0x7623('0x2f')],_0x591822[_0x7623('0x30')]);_0x2d42df[_0x7623('0x31')]=_['intersection'](_0x591822[_0x7623('0x2f')],qs[_0x7623('0x33')](_0x40f6f4[_0x7623('0x30')][_0x7623('0x33')]));_0x2d42df[_0x7623('0x31')]=_0x2d42df[_0x7623('0x31')][_0x7623('0x47')]?_0x2d42df[_0x7623('0x31')]:_0x591822['model'];if(_0x40f6f4[_0x7623('0x30')][_0x7623('0x48')]){_0x2d42df[_0x7623('0x40')]=[{'all':!![]}];}_0x2d42df=_['merge']({},_0x2d42df,_0x40f6f4[_0x7623('0x3e')]);return db['WhatsappQueueReport']['find'](_0x2d42df)[_0x7623('0x23')](handleEntityNotFound(_0x85766a,null))[_0x7623('0x23')](respondWithResult(_0x85766a,null))[_0x7623('0x43')](handleError(_0x85766a,null));};exports['create']=function(_0x2a6e87,_0x25947e){return db[_0x7623('0x3f')][_0x7623('0x49')](_0x2a6e87['body'],{})[_0x7623('0x23')](respondWithResult(_0x25947e,0xc9))[_0x7623('0x43')](handleError(_0x25947e,null));};exports[_0x7623('0x4a')]=function(_0x537dbe,_0x4d718f){if(_0x537dbe[_0x7623('0x4b')]['id']){delete _0x537dbe[_0x7623('0x4b')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x537dbe[_0x7623('0x45')]['id']}})[_0x7623('0x23')](handleEntityNotFound(_0x4d718f,null))[_0x7623('0x23')](saveUpdates(_0x537dbe[_0x7623('0x4b')],null))[_0x7623('0x23')](respondWithResult(_0x4d718f,null))[_0x7623('0x43')](handleError(_0x4d718f,null));};exports['destroy']=function(_0x277319,_0x595654){return db[_0x7623('0x3f')][_0x7623('0x4c')]({'where':{'id':_0x277319[_0x7623('0x45')]['id']}})[_0x7623('0x23')](handleEntityNotFound(_0x595654,null))[_0x7623('0x23')](removeEntity(_0x595654,null))[_0x7623('0x43')](handleError(_0x595654,null));};exports['describe']=function(_0x3ed8f0,_0x10e34a){return db[_0x7623('0x3f')]['describe']()[_0x7623('0x23')](respondWithResult(_0x10e34a,null))[_0x7623('0x43')](handleError(_0x10e34a,null));}; \ No newline at end of file +var _0x6455=['params','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x4f5b68,_0x3c50f3){var _0x4ad265=function(_0x4d83f6){while(--_0x4d83f6){_0x4f5b68['push'](_0x4f5b68['shift']());}};_0x4ad265(++_0x3c50f3);}(_0x6455,0x97));var _0x5645=function(_0x423f08,_0x5e38f2){_0x423f08=_0x423f08-0x0;var _0x39268=_0x6455[_0x423f08];return _0x39268;};'use strict';var pdf=require(_0x5645('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5645('0x1'));var zipdir=require(_0x5645('0x2'));var jsonpatch=require(_0x5645('0x3'));var rp=require(_0x5645('0x4'));var moment=require(_0x5645('0x5'));var BPromise=require(_0x5645('0x6'));var Mustache=require('mustache');var util=require(_0x5645('0x7'));var path=require(_0x5645('0x8'));var sox=require(_0x5645('0x9'));var csv=require(_0x5645('0xa'));var ejs=require(_0x5645('0xb'));var fs=require('fs');var _=require(_0x5645('0xc'));var squel=require(_0x5645('0xd'));var crypto=require(_0x5645('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5645('0xa'));var querystring=require(_0x5645('0xf'));var Papa=require(_0x5645('0x10'));var Redis=require(_0x5645('0x11'));var authService=require(_0x5645('0x12'));var qs=require(_0x5645('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5645('0x14'));var logger=require(_0x5645('0x15'))(_0x5645('0x16'));var utils=require(_0x5645('0x17'));var config=require('../../config/environment');var db=require(_0x5645('0x18'))['db'];function respondWithStatusCode(_0x5ecb2a,_0x42f5cd){_0x42f5cd=_0x42f5cd||0xcc;return function(_0x4014c5){if(_0x4014c5){return _0x5ecb2a[_0x5645('0x19')](_0x42f5cd);}return _0x5ecb2a[_0x5645('0x1a')](_0x42f5cd)[_0x5645('0x1b')]();};}function respondWithResult(_0x199a88,_0x45cbe8){_0x45cbe8=_0x45cbe8||0xc8;return function(_0x2270a1){if(_0x2270a1){return _0x199a88['status'](_0x45cbe8)[_0x5645('0x1c')](_0x2270a1);}};}function respondWithFilteredResult(_0x3e0ec6,_0x25863f){return function(_0x4cbd46){if(_0x4cbd46){var _0x4b3be6=_0x4cbd46[_0x5645('0x1d')],_0x439b55=_0x25863f[_0x5645('0x1e')],_0x361cfd=_0x25863f[_0x5645('0x1e')]+_0x25863f['limit'],_0x511aed;if(_0x361cfd>=_0x4b3be6){_0x361cfd=_0x4b3be6;_0x511aed=0xc8;}else{_0x511aed=0xce;}_0x3e0ec6[_0x5645('0x1a')](_0x511aed);return _0x3e0ec6[_0x5645('0x1f')](_0x5645('0x20'),_0x439b55+'-'+_0x361cfd+'/'+_0x4b3be6)[_0x5645('0x1c')](_0x4cbd46);}return null;};}function patchUpdates(_0x5ac9ee){return function(_0x1853a7){try{jsonpatch['apply'](_0x1853a7,_0x5ac9ee,!![]);}catch(_0x557ad2){return BPromise[_0x5645('0x21')](_0x557ad2);}return _0x1853a7[_0x5645('0x22')]();};}function saveUpdates(_0x2e3350,_0x59a491){return function(_0x35a672){if(_0x35a672){return _0x35a672['update'](_0x2e3350)[_0x5645('0x23')](function(_0x5f186f){return _0x5f186f;});}return null;};}function removeEntity(_0x4f82d0,_0x1ee2fb){return function(_0x53d763){if(_0x53d763){return _0x53d763[_0x5645('0x24')]()[_0x5645('0x23')](function(){_0x4f82d0['status'](0xcc)[_0x5645('0x1b')]();});}};}function handleEntityNotFound(_0x116bfc,_0xe83ed7){return function(_0x50fa82){if(!_0x50fa82){_0x116bfc[_0x5645('0x19')](0x194);}return _0x50fa82;};}function handleError(_0xc38038,_0x3f6929){_0x3f6929=_0x3f6929||0x1f4;return function(_0x46b33a){logger['error'](_0x46b33a['stack']);if(_0x46b33a['name']){delete _0x46b33a['name'];}_0xc38038[_0x5645('0x1a')](_0x3f6929)['send'](_0x46b33a);};}exports['index']=function(_0xfbe837,_0x12f43a){var _0x357388={},_0x308991={},_0x3a5c61={'count':0x0,'rows':[]};var _0x351cbb=_[_0x5645('0x25')](db[_0x5645('0x26')][_0x5645('0x27')],function(_0x30a5d0){return{'name':_0x30a5d0[_0x5645('0x28')],'type':_0x30a5d0[_0x5645('0x29')][_0x5645('0x2a')]};});_0x308991[_0x5645('0x2b')]=_['map'](_0x351cbb,_0x5645('0x2c'));_0x308991['query']=_[_0x5645('0x2d')](_0xfbe837[_0x5645('0x2e')]);_0x308991[_0x5645('0x2f')]=_[_0x5645('0x30')](_0x308991[_0x5645('0x2b')],_0x308991[_0x5645('0x2e')]);_0x357388['attributes']=_['intersection'](_0x308991[_0x5645('0x2b')],qs[_0x5645('0x31')](_0xfbe837[_0x5645('0x2e')][_0x5645('0x31')]));_0x357388[_0x5645('0x32')]=_0x357388[_0x5645('0x32')][_0x5645('0x33')]?_0x357388[_0x5645('0x32')]:_0x308991[_0x5645('0x2b')];if(!_0xfbe837[_0x5645('0x2e')][_0x5645('0x34')]('nolimit')){_0x357388['limit']=qs[_0x5645('0x35')](_0xfbe837['query'][_0x5645('0x35')]);_0x357388['offset']=qs[_0x5645('0x1e')](_0xfbe837['query'][_0x5645('0x1e')]);}_0x357388[_0x5645('0x36')]=qs[_0x5645('0x37')](_0xfbe837[_0x5645('0x2e')][_0x5645('0x37')]);_0x357388[_0x5645('0x38')]=qs['filters'](_[_0x5645('0x39')](_0xfbe837[_0x5645('0x2e')],_0x308991[_0x5645('0x2f')]),_0x351cbb);if(_0xfbe837[_0x5645('0x2e')][_0x5645('0x3a')]){_0x357388[_0x5645('0x38')]=_[_0x5645('0x3b')](_0x357388[_0x5645('0x38')],{'$or':_['map'](_0x351cbb,function(_0x178f6b){if(_0x178f6b['type']!==_0x5645('0x3c')){var _0x2aaf8f={};_0x2aaf8f[_0x178f6b[_0x5645('0x2c')]]={'$like':'%'+_0xfbe837[_0x5645('0x2e')][_0x5645('0x3a')]+'%'};return _0x2aaf8f;}})});}_0x357388=_['merge']({},_0x357388,_0xfbe837[_0x5645('0x3d')]);var _0x188565={'where':_0x357388[_0x5645('0x38')]};return db[_0x5645('0x26')][_0x5645('0x1d')](_0x188565)[_0x5645('0x23')](function(_0x18faea){_0x3a5c61[_0x5645('0x1d')]=_0x18faea;if(_0xfbe837[_0x5645('0x2e')][_0x5645('0x3e')]){_0x357388[_0x5645('0x3f')]=[{'all':!![]}];}return db[_0x5645('0x26')][_0x5645('0x40')](_0x357388);})[_0x5645('0x23')](function(_0x2e4246){_0x3a5c61[_0x5645('0x41')]=_0x2e4246;return _0x3a5c61;})['then'](respondWithFilteredResult(_0x12f43a,_0x357388))[_0x5645('0x42')](handleError(_0x12f43a,null));};exports[_0x5645('0x43')]=function(_0x488a72,_0xe1a1d5){var _0x3b835f={'raw':!![],'where':{'id':_0x488a72[_0x5645('0x44')]['id']}},_0x5e841a={};_0x5e841a[_0x5645('0x2b')]=_[_0x5645('0x2d')](db[_0x5645('0x26')][_0x5645('0x27')]);_0x5e841a[_0x5645('0x2e')]=_[_0x5645('0x2d')](_0x488a72['query']);_0x5e841a['filters']=_[_0x5645('0x30')](_0x5e841a[_0x5645('0x2b')],_0x5e841a[_0x5645('0x2e')]);_0x3b835f[_0x5645('0x32')]=_[_0x5645('0x30')](_0x5e841a[_0x5645('0x2b')],qs[_0x5645('0x31')](_0x488a72[_0x5645('0x2e')][_0x5645('0x31')]));_0x3b835f[_0x5645('0x32')]=_0x3b835f[_0x5645('0x32')][_0x5645('0x33')]?_0x3b835f[_0x5645('0x32')]:_0x5e841a[_0x5645('0x2b')];if(_0x488a72[_0x5645('0x2e')][_0x5645('0x3e')]){_0x3b835f[_0x5645('0x3f')]=[{'all':!![]}];}_0x3b835f=_['merge']({},_0x3b835f,_0x488a72['options']);return db['WhatsappQueueReport']['find'](_0x3b835f)[_0x5645('0x23')](handleEntityNotFound(_0xe1a1d5,null))[_0x5645('0x23')](respondWithResult(_0xe1a1d5,null))[_0x5645('0x42')](handleError(_0xe1a1d5,null));};exports[_0x5645('0x45')]=function(_0x12ca73,_0x5b9b00){return db[_0x5645('0x26')][_0x5645('0x45')](_0x12ca73[_0x5645('0x46')],{})[_0x5645('0x23')](respondWithResult(_0x5b9b00,0xc9))[_0x5645('0x42')](handleError(_0x5b9b00,null));};exports['update']=function(_0x1160f6,_0x18f49b){if(_0x1160f6[_0x5645('0x46')]['id']){delete _0x1160f6[_0x5645('0x46')]['id'];}return db[_0x5645('0x26')][_0x5645('0x47')]({'where':{'id':_0x1160f6[_0x5645('0x44')]['id']}})[_0x5645('0x23')](handleEntityNotFound(_0x18f49b,null))['then'](saveUpdates(_0x1160f6['body'],null))[_0x5645('0x23')](respondWithResult(_0x18f49b,null))[_0x5645('0x42')](handleError(_0x18f49b,null));};exports['destroy']=function(_0x4bf0e6,_0x467de4){return db['WhatsappQueueReport'][_0x5645('0x47')]({'where':{'id':_0x4bf0e6[_0x5645('0x44')]['id']}})[_0x5645('0x23')](handleEntityNotFound(_0x467de4,null))[_0x5645('0x23')](removeEntity(_0x467de4,null))[_0x5645('0x42')](handleError(_0x467de4,null));};exports['describe']=function(_0x2f4ab4,_0x513552){return db['WhatsappQueueReport'][_0x5645('0x48')]()[_0x5645('0x23')](respondWithResult(_0x513552,null))[_0x5645('0x42')](handleError(_0x513552,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e785270..e1c5f14 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 _0x7e7b=['WhatsappQueueReport','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define'];(function(_0x5f3bf3,_0x20b162){var _0x6fc2bf=function(_0xae927){while(--_0xae927){_0x5f3bf3['push'](_0x5f3bf3['shift']());}};_0x6fc2bf(++_0x20b162);}(_0x7e7b,0x1d0));var _0xb7e7=function(_0x42223e,_0x5b0d77){_0x42223e=_0x42223e-0x0;var _0x1fa5fb=_0x7e7b[_0x42223e];return _0x1fa5fb;};'use strict';var _=require(_0xb7e7('0x0'));var util=require('util');var logger=require(_0xb7e7('0x1'))('api');var moment=require(_0xb7e7('0x2'));var BPromise=require('bluebird');var rp=require(_0xb7e7('0x3'));var fs=require('fs');var path=require(_0xb7e7('0x4'));var rimraf=require(_0xb7e7('0x5'));var config=require(_0xb7e7('0x6'));var attributes=require(_0xb7e7('0x7'));module['exports']=function(_0xa101f9,_0x46f889){return _0xa101f9[_0xb7e7('0x8')](_0xb7e7('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xb7e7('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x51d8=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x51d8,0x6f));var _0x851d=function(_0x380c72,_0xfd3a8b){_0x380c72=_0x380c72-0x0;var _0x45daf3=_0x51d8[_0x380c72];return _0x45daf3;};'use strict';var _=require(_0x851d('0x0'));var util=require(_0x851d('0x1'));var logger=require(_0x851d('0x2'))(_0x851d('0x3'));var moment=require(_0x851d('0x4'));var BPromise=require('bluebird');var rp=require(_0x851d('0x5'));var fs=require('fs');var path=require(_0x851d('0x6'));var rimraf=require(_0x851d('0x7'));var config=require(_0x851d('0x8'));var attributes=require(_0x851d('0x9'));module[_0x851d('0xa')]=function(_0x55a265,_0x5763ef){return _0x55a265[_0x851d('0xb')](_0x851d('0xc'),attributes,{'tableName':_0x851d('0xd'),'paranoid':![],'indexes':[{'name':_0x851d('0xe'),'fields':[_0x851d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 956ef9b..0a61585 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 _0x8b47=['http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','create','body','options','CreateWhatsappQueueReport','catch','raw','where','attributes','limit','UpdateWhatsappQueueReport','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e30cf,_0x33f57){var _0x2357c9=function(_0x5c204d){while(--_0x5c204d){_0x3e30cf['push'](_0x3e30cf['shift']());}};_0x2357c9(++_0x33f57);}(_0x8b47,0x1d4));var _0x78b4=function(_0x23b876,_0x31804d){_0x23b876=_0x23b876-0x0;var _0x5230d5=_0x8b47[_0x23b876];return _0x5230d5;};'use strict';var _=require('lodash');var util=require(_0x78b4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78b4('0x1'));var db=require(_0x78b4('0x2'))['db'];var utils=require(_0x78b4('0x3'));var logger=require('../../config/logger')(_0x78b4('0x4'));var config=require(_0x78b4('0x5'));var jayson=require(_0x78b4('0x6'));var client=jayson[_0x78b4('0x7')][_0x78b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c44ba,_0x51ec41,_0x48f65f){return new BPromise(function(_0x185f2c,_0x34189b){return client['request'](_0x2c44ba,_0x48f65f)['then'](function(_0x1a8c39){logger[_0x78b4('0x9')](_0x78b4('0xa'),_0x51ec41,_0x78b4('0xb'));logger[_0x78b4('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x51ec41,_0x78b4('0xb'),JSON[_0x78b4('0xd')](_0x1a8c39));if(_0x1a8c39['error']){if(_0x1a8c39['error'][_0x78b4('0xe')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x51ec41,_0x1a8c39[_0x78b4('0xf')][_0x78b4('0x10')]);return _0x34189b(_0x1a8c39[_0x78b4('0xf')][_0x78b4('0x10')]);}logger[_0x78b4('0xf')](_0x78b4('0xa'),_0x51ec41,_0x1a8c39[_0x78b4('0xf')][_0x78b4('0x10')]);return _0x185f2c(_0x1a8c39[_0x78b4('0xf')][_0x78b4('0x10')]);}else{logger[_0x78b4('0x9')](_0x78b4('0xa'),_0x51ec41,'request\x20sent');_0x185f2c(_0x1a8c39[_0x78b4('0x11')][_0x78b4('0x10')]);}})['catch'](function(_0x2fbe00){logger[_0x78b4('0xf')](_0x78b4('0xa'),_0x51ec41,_0x2fbe00);_0x34189b(_0x2fbe00);});});}exports['CreateWhatsappQueueReport']=function(_0x5b9f97){var _0x34cd5b=this;return new Promise(function(_0x233d63,_0x56bdd3){return db['WhatsappQueueReport'][_0x78b4('0x12')](_0x5b9f97[_0x78b4('0x13')],{'raw':_0x5b9f97[_0x78b4('0x14')]?_0x5b9f97[_0x78b4('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3bf862){logger[_0x78b4('0x9')](_0x78b4('0x15'),_0x5b9f97);logger[_0x78b4('0xc')](_0x78b4('0x15'),_0x5b9f97,JSON[_0x78b4('0xd')](_0x3bf862));_0x233d63(_0x3bf862);})[_0x78b4('0x16')](function(_0x56f105){logger[_0x78b4('0xf')](_0x78b4('0x15'),_0x56f105['message'],_0x5b9f97);_0x56bdd3(_0x34cd5b[_0x78b4('0xf')](0x1f4,_0x56f105[_0x78b4('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x40b837){var _0x46f099=this;return new Promise(function(_0x3a30ba,_0xc13aaf){return db['WhatsappQueueReport']['update'](_0x40b837[_0x78b4('0x13')],{'raw':_0x40b837['options']?_0x40b837['options'][_0x78b4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40b837[_0x78b4('0x14')]?_0x40b837[_0x78b4('0x14')][_0x78b4('0x18')]||null:null,'attributes':_0x40b837[_0x78b4('0x14')]?_0x40b837[_0x78b4('0x14')][_0x78b4('0x19')]||null:null,'limit':_0x40b837[_0x78b4('0x14')]?_0x40b837[_0x78b4('0x14')][_0x78b4('0x1a')]||null:null})['then'](function(_0x15d3e6){logger[_0x78b4('0x9')](_0x78b4('0x1b'),_0x40b837);logger[_0x78b4('0xc')](_0x78b4('0x1b'),_0x40b837,JSON[_0x78b4('0xd')](_0x15d3e6));_0x3a30ba(_0x15d3e6);})[_0x78b4('0x16')](function(_0x11451d){logger[_0x78b4('0xf')](_0x78b4('0x1b'),_0x11451d[_0x78b4('0x10')],_0x40b837);_0xc13aaf(_0x46f099[_0x78b4('0xf')](0x1f4,_0x11451d[_0x78b4('0x10')]));});});}; \ No newline at end of file +var _0x12a1=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','where','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x12a1,0xb3));var _0x112a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x12a1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x112a('0x0'));var util=require(_0x112a('0x1'));var moment=require(_0x112a('0x2'));var BPromise=require(_0x112a('0x3'));var rs=require(_0x112a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x112a('0x5'));var logger=require(_0x112a('0x6'))(_0x112a('0x7'));var config=require('../../config/environment');var jayson=require(_0x112a('0x8'));var client=jayson[_0x112a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46773d,_0x420bf2,_0x15637d){return new BPromise(function(_0x3d6162,_0x78ffdc){return client[_0x112a('0xa')](_0x46773d,_0x15637d)[_0x112a('0xb')](function(_0x3e5240){logger[_0x112a('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x420bf2,'request\x20sent');logger[_0x112a('0xd')](_0x112a('0xe'),_0x420bf2,_0x112a('0xf'),JSON[_0x112a('0x10')](_0x3e5240));if(_0x3e5240[_0x112a('0x11')]){if(_0x3e5240[_0x112a('0x11')][_0x112a('0x12')]===0x1f4){logger['error'](_0x112a('0x13'),_0x420bf2,_0x3e5240['error'][_0x112a('0x14')]);return _0x78ffdc(_0x3e5240[_0x112a('0x11')][_0x112a('0x14')]);}logger[_0x112a('0x11')](_0x112a('0x13'),_0x420bf2,_0x3e5240['error'][_0x112a('0x14')]);return _0x3d6162(_0x3e5240['error'][_0x112a('0x14')]);}else{logger[_0x112a('0xc')](_0x112a('0x13'),_0x420bf2,_0x112a('0xf'));_0x3d6162(_0x3e5240[_0x112a('0x15')]['message']);}})[_0x112a('0x16')](function(_0x945858){logger['error'](_0x112a('0x13'),_0x420bf2,_0x945858);_0x78ffdc(_0x945858);});});}exports[_0x112a('0x17')]=function(_0x1ee702){var _0x31b0c2=this;return new Promise(function(_0x448dbb,_0xa60ff9){return db['WhatsappQueueReport'][_0x112a('0x18')](_0x1ee702[_0x112a('0x19')],{'raw':_0x1ee702[_0x112a('0x1a')]?_0x1ee702[_0x112a('0x1a')][_0x112a('0x1b')]===undefined?!![]:![]:!![]})[_0x112a('0xb')](function(_0x47c225){logger[_0x112a('0xc')](_0x112a('0x17'),_0x1ee702);logger[_0x112a('0xd')](_0x112a('0x17'),_0x1ee702,JSON['stringify'](_0x47c225));_0x448dbb(_0x47c225);})['catch'](function(_0x2d9c78){logger['error'](_0x112a('0x17'),_0x2d9c78['message'],_0x1ee702);_0xa60ff9(_0x31b0c2[_0x112a('0x11')](0x1f4,_0x2d9c78[_0x112a('0x14')]));});});};exports[_0x112a('0x1c')]=function(_0x286e8d){var _0x1cbe44=this;return new Promise(function(_0x4a496c,_0x190c48){return db[_0x112a('0x1d')]['update'](_0x286e8d[_0x112a('0x19')],{'raw':_0x286e8d[_0x112a('0x1a')]?_0x286e8d[_0x112a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x286e8d[_0x112a('0x1a')]?_0x286e8d['options'][_0x112a('0x1e')]||null:null,'attributes':_0x286e8d['options']?_0x286e8d[_0x112a('0x1a')]['attributes']||null:null,'limit':_0x286e8d[_0x112a('0x1a')]?_0x286e8d[_0x112a('0x1a')][_0x112a('0x1f')]||null:null})['then'](function(_0x57a158){logger[_0x112a('0xc')](_0x112a('0x1c'),_0x286e8d);logger[_0x112a('0xd')](_0x112a('0x1c'),_0x286e8d,JSON[_0x112a('0x10')](_0x57a158));_0x4a496c(_0x57a158);})[_0x112a('0x16')](function(_0x168614){logger['error'](_0x112a('0x1c'),_0x168614[_0x112a('0x14')],_0x286e8d);_0x190c48(_0x1cbe44[_0x112a('0x11')](0x1f4,_0x168614[_0x112a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7a614b0..77a1146 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 _0x297f=['create','update','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post'];(function(_0x41fed8,_0x168adf){var _0x5d6c66=function(_0x2d3fce){while(--_0x2d3fce){_0x41fed8['push'](_0x41fed8['shift']());}};_0x5d6c66(++_0x168adf);}(_0x297f,0x1f0));var _0xf297=function(_0x364f01,_0x440c65){_0x364f01=_0x364f01-0x0;var _0x4fbe6d=_0x297f[_0x364f01];return _0x4fbe6d;};'use strict';var multer=require(_0xf297('0x0'));var util=require(_0xf297('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf297('0x2'));var router=express[_0xf297('0x3')]();var auth=require(_0xf297('0x4'));var interaction=require(_0xf297('0x5'));var config=require('../../config/environment');var controller=require(_0xf297('0x6'));router['get']('/',auth[_0xf297('0x7')](),controller[_0xf297('0x8')]);router[_0xf297('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf297('0xa')]);router[_0xf297('0x9')](_0xf297('0xb'),auth['isAuthenticated'](),controller[_0xf297('0xc')]);router[_0xf297('0xd')]('/',auth['isAuthenticated'](),controller[_0xf297('0xe')]);router['put'](_0xf297('0xb'),auth[_0xf297('0x7')](),controller[_0xf297('0xf')]);router['delete'](_0xf297('0xb'),auth['isAuthenticated'](),controller[_0xf297('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6c33=['connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x21b95c,_0x35c39e){var _0x1ede2f=function(_0x40be0a){while(--_0x40be0a){_0x21b95c['push'](_0x21b95c['shift']());}};_0x1ede2f(++_0x35c39e);}(_0x6c33,0x82));var _0x36c3=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x6c33[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x36c3('0x0'));var util=require(_0x36c3('0x1'));var path=require(_0x36c3('0x2'));var timeout=require(_0x36c3('0x3'));var express=require(_0x36c3('0x4'));var router=express['Router']();var auth=require(_0x36c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x36c3('0x6'));var controller=require(_0x36c3('0x7'));router[_0x36c3('0x8')]('/',auth[_0x36c3('0x9')](),controller[_0x36c3('0xa')]);router[_0x36c3('0x8')](_0x36c3('0xb'),auth[_0x36c3('0x9')](),controller['describe']);router[_0x36c3('0x8')](_0x36c3('0xc'),auth[_0x36c3('0x9')](),controller[_0x36c3('0xd')]);router[_0x36c3('0xe')]('/',auth[_0x36c3('0x9')](),controller[_0x36c3('0xf')]);router[_0x36c3('0x10')](_0x36c3('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x36c3('0xc'),auth['isAuthenticated'](),controller[_0x36c3('0x11')]);module[_0x36c3('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index fcbac5d..a582512 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x4dc854,_0x3c6947){var _0x4e3456=function(_0x5926ad){while(--_0x5926ad){_0x4dc854['push'](_0x4dc854['shift']());}};_0x4e3456(++_0x3c6947);}(_0x2032,0xd9));var _0x2203=function(_0x44439c,_0xed5061){_0x44439c=_0x44439c-0x0;var _0x1fc7d4=_0x2032[_0x44439c];return _0x1fc7d4;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x757a=['queue','DATE','exports','STRING'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x757a,0xde));var _0xa757=function(_0x170b3e,_0x2bc885){_0x170b3e=_0x170b3e-0x0;var _0x25887a=_0x757a[_0x170b3e];return _0x25887a;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 5a2b8ea..0ddba86 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 _0xddd1=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','count','then','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','squel','jsforce','desk.js'];(function(_0x45faea,_0x575f86){var _0x4e27c2=function(_0x5034e4){while(--_0x5034e4){_0x45faea['push'](_0x45faea['shift']());}};_0x4e27c2(++_0x575f86);}(_0xddd1,0x10e));var _0x1ddd=function(_0x52f692,_0x57fd3c){_0x52f692=_0x52f692-0x0;var _0x37ace5=_0xddd1[_0x52f692];return _0x37ace5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1ddd('0x0'));var rimraf=require(_0x1ddd('0x1'));var zipdir=require(_0x1ddd('0x2'));var jsonpatch=require(_0x1ddd('0x3'));var rp=require('request-promise');var moment=require(_0x1ddd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ddd('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1ddd('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1ddd('0x7'));var crypto=require('crypto');var jsforce=require(_0x1ddd('0x8'));var deskjs=require(_0x1ddd('0x9'));var toCsv=require(_0x1ddd('0x6'));var querystring=require(_0x1ddd('0xa'));var Papa=require(_0x1ddd('0xb'));var Redis=require(_0x1ddd('0xc'));var authService=require(_0x1ddd('0xd'));var qs=require(_0x1ddd('0xe'));var as=require(_0x1ddd('0xf'));var hardwareService=require(_0x1ddd('0x10'));var logger=require(_0x1ddd('0x11'))(_0x1ddd('0x12'));var utils=require('../../config/utils');var config=require(_0x1ddd('0x13'));var db=require(_0x1ddd('0x14'))['db'];function respondWithStatusCode(_0x599f12,_0x4ac338){_0x4ac338=_0x4ac338||0xcc;return function(_0x31b232){if(_0x31b232){return _0x599f12['sendStatus'](_0x4ac338);}return _0x599f12['status'](_0x4ac338)[_0x1ddd('0x15')]();};}function respondWithResult(_0x3173ba,_0x28b40b){_0x28b40b=_0x28b40b||0xc8;return function(_0x72cc47){if(_0x72cc47){return _0x3173ba[_0x1ddd('0x16')](_0x28b40b)['json'](_0x72cc47);}};}function respondWithFilteredResult(_0x3d2782,_0x1cc8ef){return function(_0x110f71){if(_0x110f71){var _0x1e606d=_0x110f71['count'],_0x32301e=_0x1cc8ef[_0x1ddd('0x17')],_0x19db51=_0x1cc8ef[_0x1ddd('0x17')]+_0x1cc8ef[_0x1ddd('0x18')],_0x2c7b88;if(_0x19db51>=_0x1e606d){_0x19db51=_0x1e606d;_0x2c7b88=0xc8;}else{_0x2c7b88=0xce;}_0x3d2782[_0x1ddd('0x16')](_0x2c7b88);return _0x3d2782[_0x1ddd('0x19')](_0x1ddd('0x1a'),_0x32301e+'-'+_0x19db51+'/'+_0x1e606d)[_0x1ddd('0x1b')](_0x110f71);}return null;};}function patchUpdates(_0x2fc25c){return function(_0x476aec){try{jsonpatch[_0x1ddd('0x1c')](_0x476aec,_0x2fc25c,!![]);}catch(_0x1005e3){return BPromise[_0x1ddd('0x1d')](_0x1005e3);}return _0x476aec[_0x1ddd('0x1e')]();};}function saveUpdates(_0x517928,_0x21af2d){return function(_0x204201){if(_0x204201){return _0x204201[_0x1ddd('0x1f')](_0x517928)['then'](function(_0x181b3d){return _0x181b3d;});}return null;};}function removeEntity(_0x414140,_0x1ce3c0){return function(_0x54bff0){if(_0x54bff0){return _0x54bff0['destroy']()['then'](function(){_0x414140[_0x1ddd('0x16')](0xcc)[_0x1ddd('0x15')]();});}};}function handleEntityNotFound(_0x3c1e20,_0x24ced7){return function(_0x392856){if(!_0x392856){_0x3c1e20['sendStatus'](0x194);}return _0x392856;};}function handleError(_0x28eb54,_0x21bff7){_0x21bff7=_0x21bff7||0x1f4;return function(_0x14013b){logger['error'](_0x14013b['stack']);if(_0x14013b['name']){delete _0x14013b[_0x1ddd('0x20')];}_0x28eb54[_0x1ddd('0x16')](_0x21bff7)[_0x1ddd('0x21')](_0x14013b);};}exports[_0x1ddd('0x22')]=function(_0x1369f4,_0x2c9e54){var _0x4b4410={},_0x1b7290={},_0x536522={'count':0x0,'rows':[]};var _0x415709=_['map'](db[_0x1ddd('0x23')][_0x1ddd('0x24')],function(_0x42e4cd){return{'name':_0x42e4cd[_0x1ddd('0x25')],'type':_0x42e4cd['type'][_0x1ddd('0x26')]};});_0x1b7290[_0x1ddd('0x27')]=_[_0x1ddd('0x28')](_0x415709,_0x1ddd('0x20'));_0x1b7290['query']=_[_0x1ddd('0x29')](_0x1369f4[_0x1ddd('0x2a')]);_0x1b7290[_0x1ddd('0x2b')]=_[_0x1ddd('0x2c')](_0x1b7290['model'],_0x1b7290[_0x1ddd('0x2a')]);_0x4b4410['attributes']=_[_0x1ddd('0x2c')](_0x1b7290['model'],qs['fields'](_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x2d')]));_0x4b4410['attributes']=_0x4b4410['attributes'][_0x1ddd('0x2e')]?_0x4b4410[_0x1ddd('0x2f')]:_0x1b7290[_0x1ddd('0x27')];if(!_0x1369f4['query'][_0x1ddd('0x30')]('nolimit')){_0x4b4410[_0x1ddd('0x18')]=qs[_0x1ddd('0x18')](_0x1369f4['query'][_0x1ddd('0x18')]);_0x4b4410[_0x1ddd('0x17')]=qs['offset'](_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x17')]);}_0x4b4410[_0x1ddd('0x31')]=qs[_0x1ddd('0x32')](_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x32')]);_0x4b4410[_0x1ddd('0x33')]=qs[_0x1ddd('0x2b')](_[_0x1ddd('0x34')](_0x1369f4['query'],_0x1b7290[_0x1ddd('0x2b')]),_0x415709);if(_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x35')]){_0x4b4410['where']=_[_0x1ddd('0x36')](_0x4b4410[_0x1ddd('0x33')],{'$or':_[_0x1ddd('0x28')](_0x415709,function(_0x24fdf7){if(_0x24fdf7[_0x1ddd('0x37')]!==_0x1ddd('0x38')){var _0x26fdcb={};_0x26fdcb[_0x24fdf7[_0x1ddd('0x20')]]={'$like':'%'+_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x35')]+'%'};return _0x26fdcb;}})});}_0x4b4410=_['merge']({},_0x4b4410,_0x1369f4['options']);var _0x2eedb2={'where':_0x4b4410[_0x1ddd('0x33')]};return db[_0x1ddd('0x23')][_0x1ddd('0x39')](_0x2eedb2)[_0x1ddd('0x3a')](function(_0x2ee56d){_0x536522[_0x1ddd('0x39')]=_0x2ee56d;if(_0x1369f4[_0x1ddd('0x2a')]['includeAll']){_0x4b4410['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x1ddd('0x3b')](_0x4b4410);})[_0x1ddd('0x3a')](function(_0x5b2843){_0x536522[_0x1ddd('0x3c')]=_0x5b2843;return _0x536522;})[_0x1ddd('0x3a')](respondWithFilteredResult(_0x2c9e54,_0x4b4410))[_0x1ddd('0x3d')](handleError(_0x2c9e54,null));};exports[_0x1ddd('0x3e')]=function(_0x567e01,_0x31b14a){var _0x3d21f3={'raw':!![],'where':{'id':_0x567e01[_0x1ddd('0x3f')]['id']}},_0xa55d7c={};_0xa55d7c[_0x1ddd('0x27')]=_[_0x1ddd('0x29')](db[_0x1ddd('0x23')][_0x1ddd('0x24')]);_0xa55d7c[_0x1ddd('0x2a')]=_[_0x1ddd('0x29')](_0x567e01[_0x1ddd('0x2a')]);_0xa55d7c[_0x1ddd('0x2b')]=_['intersection'](_0xa55d7c[_0x1ddd('0x27')],_0xa55d7c[_0x1ddd('0x2a')]);_0x3d21f3[_0x1ddd('0x2f')]=_[_0x1ddd('0x2c')](_0xa55d7c[_0x1ddd('0x27')],qs[_0x1ddd('0x2d')](_0x567e01[_0x1ddd('0x2a')][_0x1ddd('0x2d')]));_0x3d21f3[_0x1ddd('0x2f')]=_0x3d21f3[_0x1ddd('0x2f')][_0x1ddd('0x2e')]?_0x3d21f3[_0x1ddd('0x2f')]:_0xa55d7c['model'];if(_0x567e01[_0x1ddd('0x2a')][_0x1ddd('0x40')]){_0x3d21f3[_0x1ddd('0x41')]=[{'all':!![]}];}_0x3d21f3=_[_0x1ddd('0x36')]({},_0x3d21f3,_0x567e01['options']);return db['WhatsappTransferReport'][_0x1ddd('0x42')](_0x3d21f3)[_0x1ddd('0x3a')](handleEntityNotFound(_0x31b14a,null))['then'](respondWithResult(_0x31b14a,null))[_0x1ddd('0x3d')](handleError(_0x31b14a,null));};exports[_0x1ddd('0x43')]=function(_0x1b9e41,_0x174c55){return db[_0x1ddd('0x23')][_0x1ddd('0x43')](_0x1b9e41[_0x1ddd('0x44')],{})[_0x1ddd('0x3a')](respondWithResult(_0x174c55,0xc9))[_0x1ddd('0x3d')](handleError(_0x174c55,null));};exports[_0x1ddd('0x1f')]=function(_0x56cd74,_0x10141a){if(_0x56cd74[_0x1ddd('0x44')]['id']){delete _0x56cd74[_0x1ddd('0x44')]['id'];}return db[_0x1ddd('0x23')][_0x1ddd('0x42')]({'where':{'id':_0x56cd74[_0x1ddd('0x3f')]['id']}})[_0x1ddd('0x3a')](handleEntityNotFound(_0x10141a,null))[_0x1ddd('0x3a')](saveUpdates(_0x56cd74[_0x1ddd('0x44')],null))[_0x1ddd('0x3a')](respondWithResult(_0x10141a,null))[_0x1ddd('0x3d')](handleError(_0x10141a,null));};exports['destroy']=function(_0x59318a,_0x4ee8c5){return db[_0x1ddd('0x23')][_0x1ddd('0x42')]({'where':{'id':_0x59318a[_0x1ddd('0x3f')]['id']}})[_0x1ddd('0x3a')](handleEntityNotFound(_0x4ee8c5,null))[_0x1ddd('0x3a')](removeEntity(_0x4ee8c5,null))['catch'](handleError(_0x4ee8c5,null));};exports[_0x1ddd('0x45')]=function(_0x5afb59,_0x4bda01){return db[_0x1ddd('0x23')][_0x1ddd('0x45')]()['then'](respondWithResult(_0x4bda01,null))[_0x1ddd('0x3d')](handleError(_0x4bda01,null));}; \ No newline at end of file +var _0xf928=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','catch','show','params','keys','includeAll','include','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','model','query','filters','intersection','fields'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xf928,0xb1));var _0x8f92=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf928[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8f92('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f92('0x1'));var jsonpatch=require(_0x8f92('0x2'));var rp=require(_0x8f92('0x3'));var moment=require(_0x8f92('0x4'));var BPromise=require(_0x8f92('0x5'));var Mustache=require(_0x8f92('0x6'));var util=require(_0x8f92('0x7'));var path=require(_0x8f92('0x8'));var sox=require(_0x8f92('0x9'));var csv=require(_0x8f92('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8f92('0xb'));var squel=require(_0x8f92('0xc'));var crypto=require(_0x8f92('0xd'));var jsforce=require(_0x8f92('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8f92('0xa'));var querystring=require(_0x8f92('0xf'));var Papa=require(_0x8f92('0x10'));var Redis=require(_0x8f92('0x11'));var authService=require(_0x8f92('0x12'));var qs=require(_0x8f92('0x13'));var as=require(_0x8f92('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f92('0x15'))(_0x8f92('0x16'));var utils=require(_0x8f92('0x17'));var config=require(_0x8f92('0x18'));var db=require(_0x8f92('0x19'))['db'];function respondWithStatusCode(_0x964923,_0x279c56){_0x279c56=_0x279c56||0xcc;return function(_0x4646ef){if(_0x4646ef){return _0x964923[_0x8f92('0x1a')](_0x279c56);}return _0x964923[_0x8f92('0x1b')](_0x279c56)['end']();};}function respondWithResult(_0x2a0ecb,_0x30f26c){_0x30f26c=_0x30f26c||0xc8;return function(_0xfcf88c){if(_0xfcf88c){return _0x2a0ecb[_0x8f92('0x1b')](_0x30f26c)[_0x8f92('0x1c')](_0xfcf88c);}};}function respondWithFilteredResult(_0x354cf5,_0x22bc67){return function(_0x428d1d){if(_0x428d1d){var _0xd4fb03=_0x428d1d[_0x8f92('0x1d')],_0x560ab0=_0x22bc67[_0x8f92('0x1e')],_0x4ddea1=_0x22bc67[_0x8f92('0x1e')]+_0x22bc67[_0x8f92('0x1f')],_0x4903db;if(_0x4ddea1>=_0xd4fb03){_0x4ddea1=_0xd4fb03;_0x4903db=0xc8;}else{_0x4903db=0xce;}_0x354cf5[_0x8f92('0x1b')](_0x4903db);return _0x354cf5['set'](_0x8f92('0x20'),_0x560ab0+'-'+_0x4ddea1+'/'+_0xd4fb03)[_0x8f92('0x1c')](_0x428d1d);}return null;};}function patchUpdates(_0x3dd6a4){return function(_0x2dbe6e){try{jsonpatch[_0x8f92('0x21')](_0x2dbe6e,_0x3dd6a4,!![]);}catch(_0xa6bd6c){return BPromise['reject'](_0xa6bd6c);}return _0x2dbe6e[_0x8f92('0x22')]();};}function saveUpdates(_0x530d84,_0x32245b){return function(_0xd65a70){if(_0xd65a70){return _0xd65a70['update'](_0x530d84)[_0x8f92('0x23')](function(_0x5835b0){return _0x5835b0;});}return null;};}function removeEntity(_0x24c4a5,_0x552e94){return function(_0xf195e6){if(_0xf195e6){return _0xf195e6[_0x8f92('0x24')]()['then'](function(){_0x24c4a5[_0x8f92('0x1b')](0xcc)[_0x8f92('0x25')]();});}};}function handleEntityNotFound(_0x523c70,_0x10b287){return function(_0x364501){if(!_0x364501){_0x523c70[_0x8f92('0x1a')](0x194);}return _0x364501;};}function handleError(_0x25e086,_0x5356db){_0x5356db=_0x5356db||0x1f4;return function(_0xc2b52f){logger[_0x8f92('0x26')](_0xc2b52f[_0x8f92('0x27')]);if(_0xc2b52f[_0x8f92('0x28')]){delete _0xc2b52f['name'];}_0x25e086[_0x8f92('0x1b')](_0x5356db)['send'](_0xc2b52f);};}exports[_0x8f92('0x29')]=function(_0x218551,_0x44afa9){var _0x137fe5={},_0x447489={},_0x1776dc={'count':0x0,'rows':[]};var _0x6265e5=_[_0x8f92('0x2a')](db[_0x8f92('0x2b')][_0x8f92('0x2c')],function(_0x5315f5){return{'name':_0x5315f5[_0x8f92('0x2d')],'type':_0x5315f5['type']['key']};});_0x447489[_0x8f92('0x2e')]=_['map'](_0x6265e5,_0x8f92('0x28'));_0x447489[_0x8f92('0x2f')]=_['keys'](_0x218551[_0x8f92('0x2f')]);_0x447489[_0x8f92('0x30')]=_[_0x8f92('0x31')](_0x447489['model'],_0x447489[_0x8f92('0x2f')]);_0x137fe5['attributes']=_[_0x8f92('0x31')](_0x447489[_0x8f92('0x2e')],qs[_0x8f92('0x32')](_0x218551[_0x8f92('0x2f')][_0x8f92('0x32')]));_0x137fe5[_0x8f92('0x33')]=_0x137fe5[_0x8f92('0x33')][_0x8f92('0x34')]?_0x137fe5[_0x8f92('0x33')]:_0x447489['model'];if(!_0x218551['query'][_0x8f92('0x35')](_0x8f92('0x36'))){_0x137fe5['limit']=qs[_0x8f92('0x1f')](_0x218551[_0x8f92('0x2f')][_0x8f92('0x1f')]);_0x137fe5[_0x8f92('0x1e')]=qs[_0x8f92('0x1e')](_0x218551[_0x8f92('0x2f')][_0x8f92('0x1e')]);}_0x137fe5[_0x8f92('0x37')]=qs[_0x8f92('0x38')](_0x218551[_0x8f92('0x2f')][_0x8f92('0x38')]);_0x137fe5[_0x8f92('0x39')]=qs[_0x8f92('0x30')](_[_0x8f92('0x3a')](_0x218551['query'],_0x447489[_0x8f92('0x30')]),_0x6265e5);if(_0x218551[_0x8f92('0x2f')]['filter']){_0x137fe5['where']=_[_0x8f92('0x3b')](_0x137fe5['where'],{'$or':_[_0x8f92('0x2a')](_0x6265e5,function(_0x26d0be){if(_0x26d0be[_0x8f92('0x3c')]!==_0x8f92('0x3d')){var _0x17975b={};_0x17975b[_0x26d0be[_0x8f92('0x28')]]={'$like':'%'+_0x218551[_0x8f92('0x2f')][_0x8f92('0x3e')]+'%'};return _0x17975b;}})});}_0x137fe5=_[_0x8f92('0x3b')]({},_0x137fe5,_0x218551[_0x8f92('0x3f')]);var _0x54b484={'where':_0x137fe5[_0x8f92('0x39')]};return db[_0x8f92('0x2b')][_0x8f92('0x1d')](_0x54b484)['then'](function(_0x49111a){_0x1776dc[_0x8f92('0x1d')]=_0x49111a;if(_0x218551['query']['includeAll']){_0x137fe5['include']=[{'all':!![]}];}return db[_0x8f92('0x2b')][_0x8f92('0x40')](_0x137fe5);})[_0x8f92('0x23')](function(_0x89457c){_0x1776dc['rows']=_0x89457c;return _0x1776dc;})[_0x8f92('0x23')](respondWithFilteredResult(_0x44afa9,_0x137fe5))[_0x8f92('0x41')](handleError(_0x44afa9,null));};exports[_0x8f92('0x42')]=function(_0x2d9b27,_0x205039){var _0xc69f5b={'raw':!![],'where':{'id':_0x2d9b27[_0x8f92('0x43')]['id']}},_0x21d08f={};_0x21d08f[_0x8f92('0x2e')]=_[_0x8f92('0x44')](db[_0x8f92('0x2b')][_0x8f92('0x2c')]);_0x21d08f['query']=_[_0x8f92('0x44')](_0x2d9b27[_0x8f92('0x2f')]);_0x21d08f[_0x8f92('0x30')]=_[_0x8f92('0x31')](_0x21d08f[_0x8f92('0x2e')],_0x21d08f['query']);_0xc69f5b[_0x8f92('0x33')]=_[_0x8f92('0x31')](_0x21d08f[_0x8f92('0x2e')],qs[_0x8f92('0x32')](_0x2d9b27[_0x8f92('0x2f')][_0x8f92('0x32')]));_0xc69f5b[_0x8f92('0x33')]=_0xc69f5b[_0x8f92('0x33')][_0x8f92('0x34')]?_0xc69f5b[_0x8f92('0x33')]:_0x21d08f[_0x8f92('0x2e')];if(_0x2d9b27[_0x8f92('0x2f')][_0x8f92('0x45')]){_0xc69f5b[_0x8f92('0x46')]=[{'all':!![]}];}_0xc69f5b=_[_0x8f92('0x3b')]({},_0xc69f5b,_0x2d9b27['options']);return db[_0x8f92('0x2b')]['find'](_0xc69f5b)[_0x8f92('0x23')](handleEntityNotFound(_0x205039,null))[_0x8f92('0x23')](respondWithResult(_0x205039,null))[_0x8f92('0x41')](handleError(_0x205039,null));};exports[_0x8f92('0x47')]=function(_0x13de2b,_0x28053d){return db[_0x8f92('0x2b')][_0x8f92('0x47')](_0x13de2b[_0x8f92('0x48')],{})[_0x8f92('0x23')](respondWithResult(_0x28053d,0xc9))[_0x8f92('0x41')](handleError(_0x28053d,null));};exports[_0x8f92('0x49')]=function(_0x5d900e,_0x123b8b){if(_0x5d900e[_0x8f92('0x48')]['id']){delete _0x5d900e[_0x8f92('0x48')]['id'];}return db['WhatsappTransferReport'][_0x8f92('0x4a')]({'where':{'id':_0x5d900e[_0x8f92('0x43')]['id']}})[_0x8f92('0x23')](handleEntityNotFound(_0x123b8b,null))[_0x8f92('0x23')](saveUpdates(_0x5d900e['body'],null))[_0x8f92('0x23')](respondWithResult(_0x123b8b,null))[_0x8f92('0x41')](handleError(_0x123b8b,null));};exports[_0x8f92('0x24')]=function(_0x4770a5,_0x37e89b){return db['WhatsappTransferReport'][_0x8f92('0x4a')]({'where':{'id':_0x4770a5[_0x8f92('0x43')]['id']}})[_0x8f92('0x23')](handleEntityNotFound(_0x37e89b,null))[_0x8f92('0x23')](removeEntity(_0x37e89b,null))['catch'](handleError(_0x37e89b,null));};exports[_0x8f92('0x4b')]=function(_0x862abb,_0x8a4ddf){return db[_0x8f92('0x2b')][_0x8f92('0x4b')]()[_0x8f92('0x23')](respondWithResult(_0x8a4ddf,null))[_0x8f92('0x41')](handleError(_0x8a4ddf,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index be528f9..4ffd4fe 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 _0xe1bc=['api','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x48ced2,_0x42d43c){var _0x185702=function(_0x11035f){while(--_0x11035f){_0x48ced2['push'](_0x48ced2['shift']());}};_0x185702(++_0x42d43c);}(_0xe1bc,0xbe));var _0xce1b=function(_0x45e629,_0x792656){_0x45e629=_0x45e629-0x0;var _0x43a2a7=_0xe1bc[_0x45e629];return _0x43a2a7;};'use strict';var _=require(_0xce1b('0x0'));var util=require(_0xce1b('0x1'));var logger=require('../../config/logger')(_0xce1b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xce1b('0x3'));var fs=require('fs');var path=require(_0xce1b('0x4'));var rimraf=require(_0xce1b('0x5'));var config=require(_0xce1b('0x6'));var attributes=require(_0xce1b('0x7'));module[_0xce1b('0x8')]=function(_0x2dfb7f,_0x2a238d){return _0x2dfb7f[_0xce1b('0x9')](_0xce1b('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xce1b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68c1=['exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68c1,0xd6));var _0x168c=function(_0x108d68,_0x9b39de){_0x108d68=_0x108d68-0x0;var _0x11476a=_0x68c1[_0x108d68];return _0x11476a;};'use strict';var _=require(_0x168c('0x0'));var util=require(_0x168c('0x1'));var logger=require(_0x168c('0x2'))(_0x168c('0x3'));var moment=require(_0x168c('0x4'));var BPromise=require(_0x168c('0x5'));var rp=require(_0x168c('0x6'));var fs=require('fs');var path=require(_0x168c('0x7'));var rimraf=require(_0x168c('0x8'));var config=require('../../config/environment');var attributes=require(_0x168c('0x9'));module[_0x168c('0xa')]=function(_0x401e7d,_0x4b8d61){return _0x401e7d['define'](_0x168c('0xb'),attributes,{'tableName':_0x168c('0xc'),'paranoid':![],'indexes':[{'name':_0x168c('0xd'),'fields':[_0x168c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 352e750..a3682e8 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(_0x1b9243,_0x5a388d){var _0x1f3b68=function(_0x1102d0){while(--_0x1102d0){_0x1b9243['push'](_0x1b9243['shift']());}};_0x1f3b68(++_0x5a388d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3efa8e,_0x1b249c){var _0x461a3c=function(_0x290eca){while(--_0x290eca){_0x3efa8e['push'](_0x3efa8e['shift']());}};_0x461a3c(++_0x1b249c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ed9122c..b2036b5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7bc=['listen','start','info','Online\x20apps:','map','filter','online','name','join','status','None','seedDB','default','./config/license','catch','exit','lodash','./mysqldb','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','sequelize','sync','then'];(function(_0x3e295d,_0x161bd7){var _0x5f17ae=function(_0xaf0437){while(--_0xaf0437){_0x3e295d['push'](_0x3e295d['shift']());}};_0x5f17ae(++_0x161bd7);}(_0xf7bc,0x78));var _0xcf7b=function(_0x5a11bb,_0x454dc5){_0x5a11bb=_0x5a11bb-0x0;var _0x137993=_0xf7bc[_0x5a11bb];return _0x137993;};'use strict';var _=require(_0xcf7b('0x0'));var mysqldb=require(_0xcf7b('0x1'));var rpc=require(_0xcf7b('0x2'));var config=require('./config/environment');var logger=require(_0xcf7b('0x3'))('app');var pm2=require(_0xcf7b('0x4'));var pm2Config=require(_0xcf7b('0x5'));var schedule=require('./config/schedule');var chat=require(_0xcf7b('0x6'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xcf7b('0x7')][_0xcf7b('0x8')]()[_0xcf7b('0x9')](function(){return rpc[_0xcf7b('0xa')]();})[_0xcf7b('0x9')](function(_0x5463a2){logger['info'](_0x5463a2);return chat[_0xcf7b('0xb')]();})['then'](function(){return schedule[_0xcf7b('0xb')]();})[_0xcf7b('0x9')](function(){return transcribe['start']();})[_0xcf7b('0x9')](function(_0xab6ee1){logger[_0xcf7b('0xc')](_0xab6ee1);return pm2[_0xcf7b('0xb')](pm2Config);})[_0xcf7b('0x9')](function(_0x10911f){logger[_0xcf7b('0xc')](_0xcf7b('0xd'),_[_0xcf7b('0xe')](_[_0xcf7b('0xf')](_0x10911f,{'status':_0xcf7b('0x10')}),_0xcf7b('0x11'))[_0xcf7b('0x12')]());logger[_0xcf7b('0xc')]('Offline\x20apps:',_[_0xcf7b('0xe')](_['filter'](_0x10911f,function(_0x1aee40){return _0x1aee40[_0xcf7b('0x13')]!=='online';}),_0xcf7b('0x11'))['join']()||_0xcf7b('0x14'));config[_0xcf7b('0x15')]&&require('./config/seedDB')[_0xcf7b('0x16')]();require(_0xcf7b('0x17'))[_0xcf7b('0x16')]();})[_0xcf7b('0x18')](function(_0x1ec992){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1ec992);process[_0xcf7b('0x19')](0x1);});}main(); \ No newline at end of file +var _0xb95e=['start','then','Online\x20apps:','map','online','join','Offline\x20apps:','filter','status','name','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','info'];(function(_0x3282ca,_0x3fae8f){var _0x40e690=function(_0x2d0af7){while(--_0x2d0af7){_0x3282ca['push'](_0x3282ca['shift']());}};_0x40e690(++_0x3fae8f);}(_0xb95e,0xa4));var _0xeb95=function(_0x2332e9,_0x402a7a){_0x2332e9=_0x2332e9-0x0;var _0x4cbf89=_0xb95e[_0x2332e9];return _0x4cbf89;};'use strict';var _=require('lodash');var mysqldb=require(_0xeb95('0x0'));var rpc=require(_0xeb95('0x1'));var config=require(_0xeb95('0x2'));var logger=require(_0xeb95('0x3'))(_0xeb95('0x4'));var pm2=require(_0xeb95('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xeb95('0x6'));var chat=require(_0xeb95('0x7'));var transcribe=require(_0xeb95('0x8'));function main(){return mysqldb['db']['sequelize']['sync']()['then'](function(){return rpc['listen']();})['then'](function(_0x1994a4){logger[_0xeb95('0x9')](_0x1994a4);return chat[_0xeb95('0xa')]();})[_0xeb95('0xb')](function(){return schedule[_0xeb95('0xa')]();})[_0xeb95('0xb')](function(){return transcribe[_0xeb95('0xa')]();})[_0xeb95('0xb')](function(_0x2383dc){logger[_0xeb95('0x9')](_0x2383dc);return pm2[_0xeb95('0xa')](pm2Config);})[_0xeb95('0xb')](function(_0x8d2fcb){logger[_0xeb95('0x9')](_0xeb95('0xc'),_[_0xeb95('0xd')](_['filter'](_0x8d2fcb,{'status':_0xeb95('0xe')}),'name')[_0xeb95('0xf')]());logger['info'](_0xeb95('0x10'),_['map'](_[_0xeb95('0x11')](_0x8d2fcb,function(_0x5c0d1b){return _0x5c0d1b[_0xeb95('0x12')]!==_0xeb95('0xe');}),_0xeb95('0x13'))[_0xeb95('0xf')]()||_0xeb95('0x14'));config[_0xeb95('0x15')]&&require(_0xeb95('0x16'))[_0xeb95('0x17')]();require(_0xeb95('0x18'))[_0xeb95('0x17')]();})[_0xeb95('0x19')](function(_0x4ae135){logger[_0xeb95('0x1a')](_0xeb95('0x1b'),_0x4ae135);process[_0xeb95('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 9a71f72..122663e 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 _0xc921=['pauseType','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','User','find','authenticate','pass','Bearer','query','apikey','getUuid','sub','isEqual','nonce','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','cookie','motion.token','redirect','/dashboards/general','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','promisify','sign','secret','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','openchannelPause'];(function(_0x3b1703,_0x38fb3a){var _0x58306b=function(_0x18455b){while(--_0x18455b){_0x3b1703['push'](_0x3b1703['shift']());}};_0x58306b(++_0x38fb3a);}(_0xc921,0xa9));var _0x1c92=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc921[_0x13d07a];return _0x5ee0ee;};'use strict';var db=require(_0x1c92('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x1c92('0x1'));var _=require(_0x1c92('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x1c92('0x3'));var compose=require(_0x1c92('0x4'));var basicAuth=require(_0x1c92('0x5'));var crypto=require(_0x1c92('0x6'));var BPromise=require(_0x1c92('0x7'));var validateJwt=expressJwt({'secret':config[_0x1c92('0x8')][_0x1c92('0x9')]});var userAttributes=['id',_0x1c92('0xa'),_0x1c92('0xb'),_0x1c92('0xc'),_0x1c92('0xd'),'email',_0x1c92('0xe'),_0x1c92('0xf'),_0x1c92('0x10'),_0x1c92('0x11'),_0x1c92('0x12'),_0x1c92('0x13'),'faxPause','smsPause',_0x1c92('0x14'),_0x1c92('0x15'),'showWebBar','lastLoginAt',_0x1c92('0x16'),_0x1c92('0x17'),_0x1c92('0x18'),_0x1c92('0x19'),'alias',_0x1c92('0x1a'),_0x1c92('0x1b'),_0x1c92('0x1c'),_0x1c92('0x1d'),_0x1c92('0x1e'),'phoneBarEnableSettings',_0x1c92('0x1f'),_0x1c92('0x20'),_0x1c92('0x21'),_0x1c92('0x22'),_0x1c92('0x23'),'interface',_0x1c92('0x24')];exports[_0x1c92('0x25')]=function(){return this['isAuthenticated'](!![])[_0x1c92('0x26')](function(_0x457d24,_0x1b0d1d,_0x2d0a4d){if(_0x457d24[_0x1c92('0x27')]){_0x2d0a4d();}else{return db[_0x1c92('0x28')][_0x1c92('0x29')]({'where':{'id':_0x457d24[_0x1c92('0x2a')]['id']},'attributes':['id',_0x1c92('0x2b'),_0x1c92('0x2c')],'raw':!![]})[_0x1c92('0x2d')](function(_0x636eec){if(_0x636eec&&_0x636eec[_0x1c92('0x2b')]){return _0x1b0d1d[_0x1c92('0x2e')](_0x636eec[_0x1c92('0x2c')]===_0x1c92('0x2f')?0x195:0x193)[_0x1c92('0x30')]({'message':_0x636eec['disposition']===_0x1c92('0x2f')?_0x1c92('0x31'):'Forbidden.'});}else{_0x2d0a4d();}})[_0x1c92('0x32')](function(_0x39e2b4){_0x2d0a4d(_0x39e2b4);});}});};exports['isAuthenticated']=function isAuthenticated(_0x32e16b){return compose()[_0x1c92('0x26')](function(_0x5d7598,_0xc47b72,_0x1adba9){if(_0x5d7598[_0x1c92('0x33')][_0x1c92('0x34')]){if(_[_0x1c92('0x35')](_0x5d7598[_0x1c92('0x33')][_0x1c92('0x34')],'Basic')){var _0x10dd41=basicAuth(_0x5d7598);db[_0x1c92('0x36')][_0x1c92('0x37')]({'where':{'name':_0x10dd41[_0x1c92('0xc')]}})[_0x1c92('0x2d')](function(_0x23cee7){if(!_0x23cee7||!_0x23cee7[_0x1c92('0x38')](_0x10dd41[_0x1c92('0x39')])){return _0xc47b72[_0x1c92('0x2e')](0x191)[_0x1c92('0x30')]({'message':'Wrong\x20credentials.'});}_0x5d7598[_0x1c92('0x27')]={'id':_0x23cee7['id']};_0x1adba9();})[_0x1c92('0x32')](function(_0x2968cd){_0x1adba9(_0x2968cd);});}else if(_['startsWith'](_0x5d7598['headers'][_0x1c92('0x34')],_0x1c92('0x3a'))){validateJwt(_0x5d7598,_0xc47b72,_0x1adba9);}else{if(_0x32e16b){_0x1adba9();}else{return _0xc47b72[_0x1c92('0x2e')](0x193)[_0x1c92('0x30')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d7598[_0x1c92('0x3b')][_0x1c92('0x3c')]){try{var _0x5391c4={'audience':hardwareConf[_0x1c92('0x3d')](),'issuer':hardwareConf[_0x1c92('0x3d')]()};verifyJwt(_0x5d7598[_0x1c92('0x3b')][_0x1c92('0x3c')],_0x5391c4)[_0x1c92('0x2d')](function(_0x53d2c5){return db[_0x1c92('0x36')]['find']({'where':{'id':_0x53d2c5[_0x1c92('0x3e')]}})[_0x1c92('0x2d')](function(_0x1d4a4d){if(!_0x1d4a4d||!_[_0x1c92('0x3f')](_0x1d4a4d['apiKeyNonce'],_0x53d2c5[_0x1c92('0x40')])){return _0xc47b72[_0x1c92('0x2e')](0x191)[_0x1c92('0x30')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x5d7598[_0x1c92('0x27')]={'id':_0x1d4a4d['id']};_0x1adba9();});})[_0x1c92('0x32')](function(){return _0xc47b72[_0x1c92('0x2e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1b53cb){_0x1adba9(_0x1b53cb);}}else if(_0x32e16b){_0x1adba9();}else{return _0xc47b72[_0x1c92('0x2e')](0x193)[_0x1c92('0x30')]({'message':_0x1c92('0x41')});}})[_0x1c92('0x26')](function(_0x24a0ff,_0x589fa5,_0x183aee){if(_0x24a0ff[_0x1c92('0x27')]){db['User'][_0x1c92('0x37')]({'where':{'id':_0x24a0ff[_0x1c92('0x27')]['id']},'attributes':userAttributes})['then'](function(_0x44fe1f){if(!_0x44fe1f){return _0x589fa5[_0x1c92('0x2e')](0x194)[_0x1c92('0x30')]({'message':_0x1c92('0x42')});}_0x24a0ff[_0x1c92('0x27')]=_0x44fe1f;_0x183aee();})[_0x1c92('0x32')](function(_0x38dfdc){_0x183aee(_0x38dfdc);});}else if(_0x32e16b){_0x183aee();}else{return _0x589fa5[_0x1c92('0x2e')](0x194)[_0x1c92('0x30')]({'message':_0x1c92('0x43')});}});};exports[_0x1c92('0x44')]=function canUpdate(){return compose()[_0x1c92('0x26')](function(_0x5afbb2,_0x3315c7,_0x2b79f7){return require(_0x1c92('0x45'))[_0x1c92('0x46')]()[_0x1c92('0x2d')](function(_0x19907b){if(_0x19907b[_0x1c92('0x47')]){_0x2b79f7();}else{return _0x3315c7['status'](0x193)[_0x1c92('0x30')]({'message':_0x1c92('0x48')});}})['catch'](function(_0x33b6ae){_0x2b79f7(_0x33b6ae);});});};exports['isMiddleware']=function(_0x1af500,_0x494921,_0x48b273){_0x1af500[_0x1c92('0x49')]=!![];return _0x48b273();};exports[_0x1c92('0x4a')]=function signToken(_0x2e576d){return signJwt(_0x2e576d);};exports['setTokenCookie']=function(_0x340ed2,_0x39d653){if(!_0x340ed2[_0x1c92('0x27')]){return _0x39d653[_0x1c92('0x2e')](0x194)[_0x1c92('0x30')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1e9d0e={'payload':{'id':_0x340ed2['user']['id'],'role':_0x340ed2['user'][_0x1c92('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1e9d0e)[_0x1c92('0x2d')](function(_0x21c529){_0x39d653[_0x1c92('0x4b')](_0x1c92('0x4c'),_0x21c529);_0x39d653[_0x1c92('0x4d')](_0x1c92('0x4e'));})[_0x1c92('0x32')](function(_0x5593ef){return _0x39d653[_0x1c92('0x2e')](0x1f4)['send'](_0x5593ef);});};exports['retrieveApiKey']=function(_0x5ecd43){if(_[_0x1c92('0x4f')](_0x5ecd43['apiKeyNonce'])||_['isNil'](_0x5ecd43[_0x1c92('0x50')])){return null;}else{return createJwt(_0x5ecd43);}};exports[_0x1c92('0x51')]=function(_0x12ba22){_0x12ba22[_0x1c92('0x52')]=generateNonce();_0x12ba22[_0x1c92('0x50')]=generateIssuedAt();return createJwt(_0x12ba22);};exports[_0x1c92('0x53')]=function(_0x3bace4,_0x74032){var _0xf983d6=_0x3bace4['query']['apikey'];if(_0xf983d6){var _0x2f29c8={'nonce':_0x74032['apiKeyNonce'],'iat':_0x74032['apiKeyIat'],'audience':hardwareConf[_0x1c92('0x3d')](),'issuer':hardwareConf[_0x1c92('0x3d')]()};return verifyJwt(_0xf983d6,_0x2f29c8)[_0x1c92('0x2d')](function(){return generateApiKey(_0x74032);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x1debed){var _0x2c1786=BPromise[_0x1c92('0x54')](jwt[_0x1c92('0x55')],{'context':jwt});var _0x497e1f=_0x1debed[_0x1c92('0x56')]||config[_0x1c92('0x8')][_0x1c92('0x9')];return new BPromise(function(_0x40c21d,_0x43d44d){_0x2c1786(_0x1debed[_0x1c92('0x57')],_0x497e1f,_0x1debed[_0x1c92('0x58')])['then'](function(_0x21ed36){_0x40c21d(_0x21ed36);})[_0x1c92('0x32')](function(_0x476a0c){_0x43d44d(_0x476a0c);});});}function verifyJwt(_0x1fa1ea,_0x3af690,_0x3886a5){var _0x2d7501=BPromise[_0x1c92('0x54')](jwt[_0x1c92('0x59')],{'context':jwt});var _0x100a8a=_0x3886a5||config[_0x1c92('0x8')][_0x1c92('0x9')];return new BPromise(function(_0x5d3113,_0x82133a){_0x2d7501(_0x1fa1ea,_0x100a8a,_0x3af690)[_0x1c92('0x2d')](function(_0xe34eb0){_0x5d3113(_0xe34eb0);})['catch'](function(_0x55f56c){_0x82133a(_0x55f56c);});});}function generateNonce(){return crypto[_0x1c92('0x5a')](0x10)[_0x1c92('0x5b')]('hex');}function generateIssuedAt(){return Math[_0x1c92('0x5c')](Date[_0x1c92('0x5d')]()/0x3e8)[_0x1c92('0x5b')]();}function createJwt(_0x4f80fb){var _0x1aa9e2={'payload':{'iat':_0x4f80fb['apiKeyIat'],'nonce':_0x4f80fb['apiKeyNonce']},'options':{'algorithm':_0x1c92('0x5e'),'subject':_0x4f80fb['id']['toString'](),'issuer':hardwareConf[_0x1c92('0x3d')](),'audience':hardwareConf[_0x1c92('0x3d')]()}};return signJwt(_0x1aa9e2)[_0x1c92('0x2d')](function(_0x4d01d0){return{'iat':_0x4f80fb[_0x1c92('0x50')],'nonce':_0x4f80fb[_0x1c92('0x52')],'token':_0x4d01d0};});} \ No newline at end of file +var _0x32cd=['interface','userProfileId','user','params','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','User','find','name','authenticate','pass','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','getUuid','sub','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','use','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','query','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secrets','payload','verify','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/environment','lodash','composable-middleware','basic-auth','crypto','bluebird','session','fullname','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32cd,0x1b2));var _0xd32c=function(_0x3153ed,_0x2dcfe7){_0x3153ed=_0x3153ed-0x0;var _0x2b9cdf=_0x32cd[_0x3153ed];return _0x2b9cdf;};'use strict';var db=require(_0xd32c('0x0'))['db'];var config=require(_0xd32c('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require(_0xd32c('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xd32c('0x3'));var basicAuth=require(_0xd32c('0x4'));var crypto=require(_0xd32c('0x5'));var BPromise=require(_0xd32c('0x6'));var validateJwt=expressJwt({'secret':config['secrets'][_0xd32c('0x7')]});var userAttributes=['id','role',_0xd32c('0x8'),'name',_0xd32c('0x9'),_0xd32c('0xa'),_0xd32c('0xb'),_0xd32c('0xc'),'md5secret',_0xd32c('0xd'),_0xd32c('0xe'),_0xd32c('0xf'),_0xd32c('0x10'),_0xd32c('0x11'),_0xd32c('0x12'),_0xd32c('0x13'),_0xd32c('0x14'),'lastLoginAt','lastPauseAt','crudPermissions','allowmessenger',_0xd32c('0x15'),_0xd32c('0x16'),_0xd32c('0x17'),_0xd32c('0x18'),_0xd32c('0x19'),'phoneBarEnableRecording',_0xd32c('0x1a'),_0xd32c('0x1b'),'phoneBarExpires',_0xd32c('0x1c'),_0xd32c('0x1d'),'phoneBarRemoteControlPort',_0xd32c('0x1e'),_0xd32c('0x1f'),_0xd32c('0x20')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x55cd52,_0x42894c,_0x2d679d){if(_0x55cd52[_0xd32c('0x21')]){_0x2d679d();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x55cd52[_0xd32c('0x22')]['id']},'attributes':['id',_0xd32c('0x23'),'disposition'],'raw':!![]})[_0xd32c('0x24')](function(_0x3d9244){if(_0x3d9244&&_0x3d9244[_0xd32c('0x23')]){return _0x42894c[_0xd32c('0x25')](_0x3d9244[_0xd32c('0x26')]===_0xd32c('0x27')?0x195:0x193)[_0xd32c('0x28')]({'message':_0x3d9244['disposition']==='unmanaged'?_0xd32c('0x29'):_0xd32c('0x2a')});}else{_0x2d679d();}})[_0xd32c('0x2b')](function(_0xedb8f3){_0x2d679d(_0xedb8f3);});}});};exports[_0xd32c('0x2c')]=function isAuthenticated(_0x1aa23a){return compose()['use'](function(_0x6f8afe,_0x44e6cc,_0x4fea67){if(_0x6f8afe[_0xd32c('0x2d')][_0xd32c('0x2e')]){if(_['startsWith'](_0x6f8afe[_0xd32c('0x2d')][_0xd32c('0x2e')],'Basic')){var _0x136d05=basicAuth(_0x6f8afe);db[_0xd32c('0x2f')][_0xd32c('0x30')]({'where':{'name':_0x136d05[_0xd32c('0x31')]}})[_0xd32c('0x24')](function(_0x1f2179){if(!_0x1f2179||!_0x1f2179[_0xd32c('0x32')](_0x136d05[_0xd32c('0x33')])){return _0x44e6cc[_0xd32c('0x25')](0x191)[_0xd32c('0x28')]({'message':_0xd32c('0x34')});}_0x6f8afe[_0xd32c('0x21')]={'id':_0x1f2179['id']};_0x4fea67();})[_0xd32c('0x2b')](function(_0x210ffc){_0x4fea67(_0x210ffc);});}else if(_[_0xd32c('0x35')](_0x6f8afe[_0xd32c('0x2d')][_0xd32c('0x2e')],_0xd32c('0x36'))){validateJwt(_0x6f8afe,_0x44e6cc,_0x4fea67);}else{if(_0x1aa23a){_0x4fea67();}else{return _0x44e6cc[_0xd32c('0x25')](0x193)[_0xd32c('0x28')]({'message':_0xd32c('0x37')});}}}else if(_0x6f8afe['query']['apikey']){try{var _0x3f5811={'audience':hardwareConf[_0xd32c('0x38')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x6f8afe['query']['apikey'],_0x3f5811)[_0xd32c('0x24')](function(_0x31eff0){return db['User'][_0xd32c('0x30')]({'where':{'id':_0x31eff0[_0xd32c('0x39')]}})[_0xd32c('0x24')](function(_0x5665cc){if(!_0x5665cc||!_[_0xd32c('0x3a')](_0x5665cc['apiKeyNonce'],_0x31eff0['nonce'])){return _0x44e6cc[_0xd32c('0x25')](0x191)[_0xd32c('0x28')]({'message':_0xd32c('0x3b')});}_0x6f8afe[_0xd32c('0x21')]={'id':_0x5665cc['id']};_0x4fea67();});})['catch'](function(){return _0x44e6cc[_0xd32c('0x25')](0x191)[_0xd32c('0x28')]({'message':_0xd32c('0x3c')});});}catch(_0x506e46){_0x4fea67(_0x506e46);}}else if(_0x1aa23a){_0x4fea67();}else{return _0x44e6cc[_0xd32c('0x25')](0x193)[_0xd32c('0x28')]({'message':_0xd32c('0x37')});}})[_0xd32c('0x3d')](function(_0xfffd90,_0x229f01,_0x416181){if(_0xfffd90[_0xd32c('0x21')]){db[_0xd32c('0x2f')][_0xd32c('0x30')]({'where':{'id':_0xfffd90[_0xd32c('0x21')]['id']},'attributes':userAttributes})[_0xd32c('0x24')](function(_0x532dba){if(!_0x532dba){return _0x229f01[_0xd32c('0x25')](0x194)[_0xd32c('0x28')]({'message':_0xd32c('0x3e')});}_0xfffd90[_0xd32c('0x21')]=_0x532dba;_0x416181();})[_0xd32c('0x2b')](function(_0x5237e0){_0x416181(_0x5237e0);});}else if(_0x1aa23a){_0x416181();}else{return _0x229f01[_0xd32c('0x25')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xd32c('0x3f')]=function canUpdate(){return compose()[_0xd32c('0x3d')](function(_0xf3888b,_0x18f8b9,_0x32da00){return require('../../config/license/util')[_0xd32c('0x40')]()[_0xd32c('0x24')](function(_0x4a0d46){if(_0x4a0d46['update']){_0x32da00();}else{return _0x18f8b9[_0xd32c('0x25')](0x193)[_0xd32c('0x28')]({'message':_0xd32c('0x41')});}})[_0xd32c('0x2b')](function(_0x3ce178){_0x32da00(_0x3ce178);});});};exports[_0xd32c('0x42')]=function(_0x2532c2,_0x11cf0c,_0xc15164){_0x2532c2[_0xd32c('0x42')]=!![];return _0xc15164();};exports[_0xd32c('0x43')]=function signToken(_0x75b0c5){return signJwt(_0x75b0c5);};exports[_0xd32c('0x44')]=function(_0x476e6a,_0x626cb1){if(!_0x476e6a[_0xd32c('0x21')]){return _0x626cb1[_0xd32c('0x25')](0x194)[_0xd32c('0x28')]({'message':_0xd32c('0x45')});}var _0x5e1628={'payload':{'id':_0x476e6a[_0xd32c('0x21')]['id'],'role':_0x476e6a[_0xd32c('0x21')][_0xd32c('0x46')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5e1628)[_0xd32c('0x24')](function(_0x161f10){_0x626cb1[_0xd32c('0x47')](_0xd32c('0x48'),_0x161f10);_0x626cb1['redirect'](_0xd32c('0x49'));})[_0xd32c('0x2b')](function(_0x3047e6){return _0x626cb1['status'](0x1f4)[_0xd32c('0x4a')](_0x3047e6);});};exports['retrieveApiKey']=function(_0x5bbf45){if(_[_0xd32c('0x4b')](_0x5bbf45[_0xd32c('0x4c')])||_['isNil'](_0x5bbf45[_0xd32c('0x4d')])){return null;}else{return createJwt(_0x5bbf45);}};exports[_0xd32c('0x4e')]=function(_0x4f2626){_0x4f2626['apiKeyNonce']=generateNonce();_0x4f2626[_0xd32c('0x4d')]=generateIssuedAt();return createJwt(_0x4f2626);};exports[_0xd32c('0x4f')]=function(_0x254fa1,_0x5e8f8c){var _0x493a94=_0x254fa1[_0xd32c('0x50')][_0xd32c('0x51')];if(_0x493a94){var _0x5b132e={'nonce':_0x5e8f8c[_0xd32c('0x4c')],'iat':_0x5e8f8c[_0xd32c('0x4d')],'audience':hardwareConf[_0xd32c('0x38')](),'issuer':hardwareConf[_0xd32c('0x38')]()};return verifyJwt(_0x493a94,_0x5b132e)[_0xd32c('0x24')](function(){return generateApiKey(_0x5e8f8c);});}else{throw{'message':_0xd32c('0x52')};}};function signJwt(_0x47175d){var _0x35a1bd=BPromise[_0xd32c('0x53')](jwt[_0xd32c('0x54')],{'context':jwt});var _0x447aff=_0x47175d['secret']||config[_0xd32c('0x55')][_0xd32c('0x7')];return new BPromise(function(_0x48cde4,_0x3c9e9f){_0x35a1bd(_0x47175d[_0xd32c('0x56')],_0x447aff,_0x47175d['options'])[_0xd32c('0x24')](function(_0x5c9fa9){_0x48cde4(_0x5c9fa9);})[_0xd32c('0x2b')](function(_0x151601){_0x3c9e9f(_0x151601);});});}function verifyJwt(_0x1f6001,_0x47ebac,_0xc9b610){var _0x55feef=BPromise[_0xd32c('0x53')](jwt[_0xd32c('0x57')],{'context':jwt});var _0x4cfd6f=_0xc9b610||config[_0xd32c('0x55')][_0xd32c('0x7')];return new BPromise(function(_0x5354fe,_0x5bd6b2){_0x55feef(_0x1f6001,_0x4cfd6f,_0x47ebac)['then'](function(_0x4d5e8b){_0x5354fe(_0x4d5e8b);})['catch'](function(_0x58b336){_0x5bd6b2(_0x58b336);});});}function generateNonce(){return crypto[_0xd32c('0x58')](0x10)[_0xd32c('0x59')](_0xd32c('0x5a'));}function generateIssuedAt(){return Math['floor'](Date[_0xd32c('0x5b')]()/0x3e8)[_0xd32c('0x59')]();}function createJwt(_0x3d9840){var _0x53888f={'payload':{'iat':_0x3d9840[_0xd32c('0x4d')],'nonce':_0x3d9840[_0xd32c('0x4c')]},'options':{'algorithm':_0xd32c('0x5c'),'subject':_0x3d9840['id']['toString'](),'issuer':hardwareConf[_0xd32c('0x38')](),'audience':hardwareConf[_0xd32c('0x38')]()}};return signJwt(_0x53888f)['then'](function(_0xab4a92){return{'iat':_0x3d9840['apiKeyIat'],'nonce':_0x3d9840[_0xd32c('0x4c')],'token':_0xab4a92};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index ddabb6e..e62246b 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 _0xcb91=['unlink','createReadStream','createWriteStream','createDecipher','update','aes192','hasOwnProperty','createCipher','algorithm','data','binary','write','end','final','close'];(function(_0x234014,_0x1f8591){var _0x2a66ff=function(_0x1e3d3f){while(--_0x1e3d3f){_0x234014['push'](_0x234014['shift']());}};_0x2a66ff(++_0x1f8591);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xcb91[_0x4c6d6f];return _0x2d4478;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x1cb9('0x0')};function combineOptions(_0xe4a5bf){var _0x17d4ec={};for(var _0x22c4b8 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x22c4b8)){_0x17d4ec[_0x22c4b8]=defaultOptions[_0x22c4b8];}}if(_0xe4a5bf){for(var _0x8c392f in _0xe4a5bf){if(_0xe4a5bf[_0x1cb9('0x1')](_0x8c392f)){_0x17d4ec[_0x8c392f]=_0xe4a5bf[_0x8c392f];}}}return _0x17d4ec;}exports['encryptFile']=function(_0x13d5fd,_0x1b26cd,_0x53ffbd,_0x226b69){return new BPromise(function(_0x3f7deb,_0x4ffe20){_0x226b69=combineOptions(_0x226b69);var _0x38737d=new Buffer(_0x53ffbd);var _0x12567c=fs['createReadStream'](_0x13d5fd);var _0x3ae0f1=fs['createWriteStream'](_0x1b26cd);var _0x567139=crypto[_0x1cb9('0x2')](_0x226b69[_0x1cb9('0x3')],_0x38737d);_0x12567c['on'](_0x1cb9('0x4'),function(_0x1f0eca){var _0x2fc627=new Buffer(_0x567139['update'](_0x1f0eca),_0x1cb9('0x5'));_0x3ae0f1[_0x1cb9('0x6')](_0x2fc627);});_0x12567c['on'](_0x1cb9('0x7'),function(){try{var _0x3fdd83=new Buffer(_0x567139[_0x1cb9('0x8')]('binary'),'binary');_0x3ae0f1['write'](_0x3fdd83);_0x3ae0f1[_0x1cb9('0x7')]();_0x3ae0f1['on'](_0x1cb9('0x9'),function(){return _0x3f7deb(_0x1b26cd);});}catch(_0x384496){fs[_0x1cb9('0xa')](_0x1b26cd);return _0x4ffe20(_0x384496);}});});};exports['decryptFile']=function(_0x397727,_0x6ef389,_0x1b3cd7,_0x8dfa55){return new BPromise(function(_0x3e2d11,_0x5806d8){_0x8dfa55=combineOptions(_0x8dfa55);var _0x5572cb=new Buffer(_0x1b3cd7);var _0xd446a3=fs[_0x1cb9('0xb')](_0x397727);var _0x3904b7=fs[_0x1cb9('0xc')](_0x6ef389);var _0x3e21e0=crypto[_0x1cb9('0xd')](_0x8dfa55[_0x1cb9('0x3')],_0x5572cb);_0xd446a3['on']('data',function(_0x479d43){var _0x1b2fa6=new Buffer(_0x3e21e0[_0x1cb9('0xe')](_0x479d43),_0x1cb9('0x5'));_0x3904b7[_0x1cb9('0x6')](_0x1b2fa6);});_0xd446a3['on'](_0x1cb9('0x7'),function(){try{var _0x4014de=new Buffer(_0x3e21e0[_0x1cb9('0x8')]('binary'),'binary');_0x3904b7[_0x1cb9('0x6')](_0x4014de);_0x3904b7['end']();_0x3904b7['on'](_0x1cb9('0x9'),function(){return _0x3e2d11(_0x6ef389);});}catch(_0x2265ea){fs['unlink'](_0x6ef389);return _0x5806d8(_0x2265ea);}});});}; \ No newline at end of file +var _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x4ad47c,_0x483d31){var _0x5062ea=function(_0x500dab){while(--_0x500dab){_0x4ad47c['push'](_0x4ad47c['shift']());}};_0x5062ea(++_0x483d31);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index bc2a027..1166e6a 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 _0xa8a8=['SELECT','Empty','length','num','push','query','dirname','basename','.csv','split','existsSync','mkdirSync','join','each','csv','writeFileSync','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','CSV','Setting','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x40f109,_0x1fb273){var _0x2c8974=function(_0x2044bc){while(--_0x2044bc){_0x40f109['push'](_0x40f109['shift']());}};_0x2c8974(++_0x1fb273);}(_0xa8a8,0xec));var _0x8a8a=function(_0x18fc3d,_0x55d75d){_0x18fc3d=_0x18fc3d-0x0;var _0x198f9e=_0xa8a8[_0x18fc3d];return _0x198f9e;};'use strict';var util=require(_0x8a8a('0x0'));var path=require(_0x8a8a('0x1'));var _=require(_0x8a8a('0x2'));var csv=require(_0x8a8a('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x8a8a('0x4'));var rimraf=require(_0x8a8a('0x5'));var db=require(_0x8a8a('0x6'))['db'];var dbH=require(_0x8a8a('0x6'))[_0x8a8a('0x7')];var logger=require(_0x8a8a('0x8'))(_0x8a8a('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8a8a('0xa')][0x2]);var QUERY=process[_0x8a8a('0xa')][0x3];var PATH=process[_0x8a8a('0xa')][0x4];function analyticExtractedReport(_0x1d7121,_0x8e7aa0){var _0x4225b9={'status':_0x1d7121};var _0xecaa6f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7aa0){_0x4225b9[_0x8a8a('0xb')]=_0x8e7aa0;}return db['AnalyticExtractedReport']['update'](_0x4225b9,_0xecaa6f);}function main(){var _0x3c01cd=0x1388;var _0x497b8a;logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8a8a('0xe')));return db[_0x8a8a('0xf')][_0x8a8a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8a8a('0x11')]})[_0x8a8a('0x12')](function(_0x330796){if(_0x330796){_0x497b8a=_0x330796;_0x3c01cd=_0x497b8a[_0x8a8a('0x11')]||0x1388;}})['then'](function(){return dbH[_0x8a8a('0x13')]['query'](util[_0x8a8a('0xd')](_0x8a8a('0x14'),QUERY),{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]});})[_0x8a8a('0x12')](function(_0x16d38d){if(!_0x16d38d[0x0]['num']){return analyticExtractedReport(_0x8a8a('0x17'));}var _0x568b83=[];var _0x1f36b6=0x0;var _0x3046ae=!![];if(_0x16d38d&&_0x16d38d[_0x8a8a('0x18')]){var _0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd);if(_0x497b8a['split']){for(;_0x3046ae;_0x1f36b6+=_0x3c01cd,_0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd)){if(_0x4291e9==0x0||_0x4291e9==_0x16d38d[0x0][_0x8a8a('0x19')]){_0x3046ae=![];}_0x568b83[_0x8a8a('0x1a')](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](util[_0x8a8a('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3c01cd,_0x1f36b6),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}else{_0x568b83['push'](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](QUERY,{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]}));}}var _0x2f6af2=path[_0x8a8a('0x1c')](PATH);var _0xe0321c=path[_0x8a8a('0x1d')](PATH,_0x8a8a('0x1e'));var _0xb9db78=_0x497b8a[_0x8a8a('0x1f')]&&_0x568b83[_0x8a8a('0x18')]>0x1;var _0x625c1b=[];if(!fs[_0x8a8a('0x20')](path['join'](_0x2f6af2,_0xe0321c))&&_0xb9db78){fs[_0x8a8a('0x21')](path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c));}return BPromise[_0x8a8a('0x23')](_0x568b83,function(_0x7662e){_0x625c1b[_0x8a8a('0x1a')](_0x7662e);})[_0x8a8a('0x12')](function(){for(var _0x3aa46d=0x0;_0x3aa46d<_0x625c1b['length'];_0x3aa46d+=0x1){var _0x31d21a;var _0x38c1e0=_0x625c1b[_0x3aa46d];if(_0xb9db78){_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c,util['format']('%s%d.%s',_0xe0321c,_0x3aa46d,_0x8a8a('0x24')));}else{_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,util['format']('%s.%s',_0xe0321c,'csv'));}fs[_0x8a8a('0x25')](_0x31d21a,csv(_0x38c1e0));}})['then'](function(){if(_0xb9db78){zipdir(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),{'saveTo':path[_0x8a8a('0x22')](_0x2f6af2,util['format'](_0x8a8a('0x26'),_0xe0321c,_0x8a8a('0x27')))},function(_0x250852,_0x8df0cb){});rimraf(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),function(){});}})[_0x8a8a('0x12')](function(){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0xb9db78?util[_0x8a8a('0xd')](_0x8a8a('0x26'),_0xe0321c,_0xb9db78?'zip':_0x8a8a('0x24')):null);});})[_0x8a8a('0x28')](function(_0x481e92){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')](_0x8a8a('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x481e92,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x8a8a('0x2a'));});}main(); \ No newline at end of file +var _0x5ff3=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Failed','path','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Setting','then','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','split','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x22ba28,_0x3b116f){var _0x51e2e9=function(_0x3c332e){while(--_0x3c332e){_0x22ba28['push'](_0x22ba28['shift']());}};_0x51e2e9(++_0x3b116f);}(_0x5ff3,0x17d));var _0x35ff=function(_0x342282,_0x590777){_0x342282=_0x342282-0x0;var _0xf1d6b5=_0x5ff3[_0x342282];return _0xf1d6b5;};'use strict';var util=require('util');var path=require(_0x35ff('0x0'));var _=require('lodash');var csv=require(_0x35ff('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x35ff('0x2'));var rimraf=require(_0x35ff('0x3'));var db=require(_0x35ff('0x4'))['db'];var dbH=require(_0x35ff('0x4'))['dbH'];var logger=require(_0x35ff('0x5'))(_0x35ff('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x35ff('0x7')][0x2]);var QUERY=process[_0x35ff('0x7')][0x3];var PATH=process[_0x35ff('0x7')][0x4];function analyticExtractedReport(_0x495c31,_0x92b403){var _0x4c9fab={'status':_0x495c31};var _0x2e7470={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x92b403){_0x4c9fab[_0x35ff('0x8')]=_0x92b403;}return db[_0x35ff('0x9')]['update'](_0x4c9fab,_0x2e7470);}function main(){var _0x20647e=0x1388;var _0x59ec4f;logger[_0x35ff('0xa')](util[_0x35ff('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x35ff('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x35ff('0xd')](function(_0x3c5f4b){if(_0x3c5f4b){_0x59ec4f=_0x3c5f4b;_0x20647e=_0x59ec4f[_0x35ff('0xe')]||0x1388;}})[_0x35ff('0xd')](function(){return dbH['sequelize'][_0x35ff('0xf')](util[_0x35ff('0xb')](_0x35ff('0x10'),QUERY),{'type':dbH['sequelize'][_0x35ff('0x11')][_0x35ff('0x12')]});})[_0x35ff('0xd')](function(_0x3e24dd){if(!_0x3e24dd[0x0][_0x35ff('0x13')]){return analyticExtractedReport(_0x35ff('0x14'));}var _0x2d4a88=[];var _0x28def2=0x0;var _0x30b5bf=!![];if(_0x3e24dd&&_0x3e24dd[_0x35ff('0x15')]){var _0x399169=_0x3e24dd[0x0][_0x35ff('0x13')]%(_0x28def2+_0x20647e);if(_0x59ec4f[_0x35ff('0x16')]){for(;_0x30b5bf;_0x28def2+=_0x20647e,_0x399169=_0x3e24dd[0x0][_0x35ff('0x13')]%(_0x28def2+_0x20647e)){if(_0x399169==0x0||_0x399169==_0x3e24dd[0x0][_0x35ff('0x13')]){_0x30b5bf=![];}_0x2d4a88['push'](dbH[_0x35ff('0x17')][_0x35ff('0xf')](util[_0x35ff('0xb')](_0x35ff('0x18'),QUERY,_0x20647e,_0x28def2),{'type':dbH['sequelize']['QueryTypes'][_0x35ff('0x12')]}));}}else{_0x2d4a88[_0x35ff('0x19')](dbH['sequelize'][_0x35ff('0xf')](QUERY,{'type':dbH[_0x35ff('0x17')][_0x35ff('0x11')][_0x35ff('0x12')]}));}}var _0x48f3bd=path[_0x35ff('0x1a')](PATH);var _0x55274b=path[_0x35ff('0x1b')](PATH,_0x35ff('0x1c'));var _0x29cd2e=_0x59ec4f[_0x35ff('0x16')]&&_0x2d4a88[_0x35ff('0x15')]>0x1;var _0x2b3782=[];if(!fs[_0x35ff('0x1d')](path['join'](_0x48f3bd,_0x55274b))&&_0x29cd2e){fs[_0x35ff('0x1e')](path[_0x35ff('0x1f')](_0x48f3bd,_0x55274b));}return BPromise['each'](_0x2d4a88,function(_0x426e4e){_0x2b3782['push'](_0x426e4e);})['then'](function(){for(var _0x186768=0x0;_0x186768<_0x2b3782[_0x35ff('0x15')];_0x186768+=0x1){var _0x95b9e2;var _0x11a5eb=_0x2b3782[_0x186768];if(_0x29cd2e){_0x95b9e2=path[_0x35ff('0x1f')](_0x48f3bd,_0x55274b,util['format'](_0x35ff('0x20'),_0x55274b,_0x186768,_0x35ff('0x21')));}else{_0x95b9e2=path[_0x35ff('0x1f')](_0x48f3bd,util['format'](_0x35ff('0x22'),_0x55274b,_0x35ff('0x21')));}fs[_0x35ff('0x23')](_0x95b9e2,csv(_0x11a5eb));}})[_0x35ff('0xd')](function(){if(_0x29cd2e){zipdir(path[_0x35ff('0x1f')](_0x48f3bd,_0x55274b),{'saveTo':path[_0x35ff('0x1f')](_0x48f3bd,util[_0x35ff('0xb')](_0x35ff('0x22'),_0x55274b,_0x35ff('0x24')))},function(_0x47d8fa,_0x3f9440){});rimraf(path['join'](_0x48f3bd,_0x55274b),function(){});}})[_0x35ff('0xd')](function(){logger[_0x35ff('0xa')](util[_0x35ff('0xb')](_0x35ff('0x25'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x35ff('0x26'),_0x29cd2e?util['format'](_0x35ff('0x22'),_0x55274b,_0x29cd2e?_0x35ff('0x24'):'csv'):null);});})['catch'](function(_0x3a39e5){logger[_0x35ff('0xa')](util['format'](_0x35ff('0x27'),EXTRACTED_REPORT_ID,_0x35ff('0x28')),util['inspect'](_0x3a39e5,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x35ff('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 8a8e155..fcdf061 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x5ad93d,_0x2ce502){var _0x53d505=function(_0xdb5119){while(--_0xdb5119){_0x5ad93d['push'](_0x5ad93d['shift']());}};_0x53d505(++_0x2ce502);}(_0xb10b,0x12a));var _0xbb10=function(_0x1427e2,_0x5a60ba){_0x1427e2=_0x1427e2-0x0;var _0x3b2772=_0xb10b[_0x1427e2];return _0x3b2772;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x5ccfc7,_0xbd7bd9){var _0x29d61f=function(_0x5bcc1b){while(--_0x5bcc1b){_0x5ccfc7['push'](_0x5ccfc7['shift']());}};_0x29d61f(++_0xbd7bd9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a5ad8,_0x34911c){_0x5a5ad8=_0x5a5ad8-0x0;var _0x5512e5=_0xb10b[_0x5a5ad8];return _0x5512e5;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 285d7c5..0b74614 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 _0xdaa3=['push','%s%d.%s','xlsx','binary','%s.%s','zip','info','catch','Failed','util','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','join','mkdirSync','each'];(function(_0x97ec0e,_0x10eb67){var _0x1fd9dd=function(_0x187652){while(--_0x187652){_0x97ec0e['push'](_0x97ec0e['shift']());}};_0x1fd9dd(++_0x10eb67);}(_0xdaa3,0xe0));var _0x3daa=function(_0x347f7a,_0x38663e){_0x347f7a=_0x347f7a-0x0;var _0x1d772d=_0xdaa3[_0x347f7a];return _0x1d772d;};'use strict';var util=require(_0x3daa('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x3daa('0x1'));var BPromise=require(_0x3daa('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x3daa('0x3'));var db=require(_0x3daa('0x4'))['db'];var dbH=require(_0x3daa('0x4'))[_0x3daa('0x5')];var logger=require(_0x3daa('0x6'))(_0x3daa('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x3daa('0x8')][0x2]);var QUERY=process[_0x3daa('0x8')][0x3];var PATH=process[_0x3daa('0x8')][0x4];function analyticExtractedReport(_0x15540a,_0x55a694){var _0x2b3ec4={'status':_0x15540a};var _0x56eb36={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x55a694){_0x2b3ec4[_0x3daa('0x9')]=_0x55a694;}return db[_0x3daa('0xa')][_0x3daa('0xb')](_0x2b3ec4,_0x56eb36);}function main(){var _0x4e1717=0x1388;var _0x1acb76;logger['info'](util[_0x3daa('0xc')](_0x3daa('0xd'),EXTRACTED_REPORT_ID,_0x3daa('0xe')));return db[_0x3daa('0xf')][_0x3daa('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3daa('0x11'),_0x3daa('0x12')]})['then'](function(_0x151c9b){if(_0x151c9b){_0x1acb76=_0x151c9b;_0x4e1717=_0x1acb76[_0x3daa('0x12')]||0x1388;}})[_0x3daa('0x13')](function(){return dbH[_0x3daa('0x14')][_0x3daa('0x15')](util['format'](_0x3daa('0x16'),QUERY),{'type':dbH[_0x3daa('0x14')]['QueryTypes']['SELECT']});})['then'](function(_0x3f25c1){if(!_0x3f25c1[0x0][_0x3daa('0x17')]){return analyticExtractedReport(_0x3daa('0x18'));}var _0x35afa7=[];var _0x4121e=0x0;var _0x3429ab=!![];if(_0x1acb76[_0x3daa('0x11')]){if(_0x3f25c1&&_0x3f25c1[_0x3daa('0x19')]){var _0x12974d=_0x3f25c1[0x0]['num']%(_0x4121e+_0x4e1717);for(;_0x3429ab;_0x4121e+=_0x4e1717,_0x12974d=_0x3f25c1[0x0][_0x3daa('0x17')]%(_0x4121e+_0x4e1717)){if(_0x12974d==0x0||_0x12974d==_0x3f25c1[0x0][_0x3daa('0x17')]){_0x3429ab=![];}_0x35afa7['push'](dbH[_0x3daa('0x14')][_0x3daa('0x15')](util['format'](_0x3daa('0x1a'),QUERY,_0x4e1717,_0x4121e),{'type':dbH[_0x3daa('0x14')][_0x3daa('0x1b')][_0x3daa('0x1c')]}));}}}else{_0x35afa7['push'](dbH[_0x3daa('0x14')][_0x3daa('0x15')](QUERY,{'type':dbH[_0x3daa('0x14')][_0x3daa('0x1b')][_0x3daa('0x1c')]}));}var _0x3a641b=path[_0x3daa('0x1d')](PATH);var _0x372073=path[_0x3daa('0x1e')](PATH,'.xlsx');var _0x5b9621=_0x1acb76[_0x3daa('0x11')]&&_0x35afa7[_0x3daa('0x19')]>0x1;var _0x5c44f2=[];if(!fs['existsSync'](path[_0x3daa('0x1f')](_0x3a641b,_0x372073))&&_0x5b9621){fs[_0x3daa('0x20')](path[_0x3daa('0x1f')](_0x3a641b,_0x372073));}return BPromise[_0x3daa('0x21')](_0x35afa7,function(_0x19f1cc){_0x5c44f2[_0x3daa('0x22')](_0x19f1cc);})['then'](function(){for(var _0x2f9dd5=0x0;_0x2f9dd5<_0x5c44f2['length'];_0x2f9dd5+=0x1){var _0x5aee17;var _0x39e3e2=_0x5c44f2[_0x2f9dd5];if(_0x5b9621){_0x5aee17=path[_0x3daa('0x1f')](_0x3a641b,_0x372073,util['format'](_0x3daa('0x23'),_0x372073,_0x2f9dd5,_0x3daa('0x24')));}else{_0x5aee17=path[_0x3daa('0x1f')](_0x3a641b,util[_0x3daa('0xc')]('%s.%s',_0x372073,'xlsx'));}fs['writeFileSync'](_0x5aee17,json2xls(_0x39e3e2),_0x3daa('0x25'));}})[_0x3daa('0x13')](function(){if(_0x5b9621){zipdir(path['join'](_0x3a641b,_0x372073),{'saveTo':path[_0x3daa('0x1f')](_0x3a641b,util[_0x3daa('0xc')](_0x3daa('0x26'),_0x372073,_0x3daa('0x27')))},function(_0x823e05,_0x508d15){});rimraf(path['join'](_0x3a641b,_0x372073),function(){});}})[_0x3daa('0x13')](function(){logger[_0x3daa('0x28')](util[_0x3daa('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x5b9621?util['format']('%s.%s',_0x372073,_0x5b9621?'zip':_0x3daa('0x24')):null);});})[_0x3daa('0x29')](function(_0x46a42f){logger[_0x3daa('0x28')](util[_0x3daa('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3daa('0xe')),util['inspect'](_0x46a42f,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x3daa('0x2a'));});}main(); \ No newline at end of file +var _0x9953=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','num','push','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','Failed','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format'];(function(_0x3fbb62,_0x1c30b4){var _0x1e2f61=function(_0x2ab8fc){while(--_0x2ab8fc){_0x3fbb62['push'](_0x3fbb62['shift']());}};_0x1e2f61(++_0x1c30b4);}(_0x9953,0x1d7));var _0x3995=function(_0x1afe3e,_0x4bf84a){_0x1afe3e=_0x1afe3e-0x0;var _0x25645f=_0x9953[_0x1afe3e];return _0x25645f;};'use strict';var util=require('util');var path=require(_0x3995('0x0'));var _=require(_0x3995('0x1'));var fs=require('fs');var json2xls=require(_0x3995('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x3995('0x3'));var rimraf=require(_0x3995('0x4'));var db=require(_0x3995('0x5'))['db'];var dbH=require(_0x3995('0x5'))[_0x3995('0x6')];var logger=require(_0x3995('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3995('0x8')][0x2]);var QUERY=process[_0x3995('0x8')][0x3];var PATH=process[_0x3995('0x8')][0x4];function analyticExtractedReport(_0x9ecd5b,_0x3cafcf){var _0x23c0f7={'status':_0x9ecd5b};var _0x473f1d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3cafcf){_0x23c0f7[_0x3995('0x9')]=_0x3cafcf;}return db['AnalyticExtractedReport'][_0x3995('0xa')](_0x23c0f7,_0x473f1d);}function main(){var _0x17a869=0x1388;var _0x42f6ad;logger[_0x3995('0xb')](util[_0x3995('0xc')](_0x3995('0xd'),EXTRACTED_REPORT_ID,_0x3995('0xe')));return db[_0x3995('0xf')][_0x3995('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3995('0x11'),_0x3995('0x12')]})[_0x3995('0x13')](function(_0x4f04cb){if(_0x4f04cb){_0x42f6ad=_0x4f04cb;_0x17a869=_0x42f6ad['splitSizeXlsx']||0x1388;}})[_0x3995('0x13')](function(){return dbH[_0x3995('0x14')][_0x3995('0x15')](util[_0x3995('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3995('0x14')][_0x3995('0x16')]['SELECT']});})['then'](function(_0x2574fe){if(!_0x2574fe[0x0][_0x3995('0x17')]){return analyticExtractedReport('Empty');}var _0x2ac176=[];var _0x5bb715=0x0;var _0x4bf976=!![];if(_0x42f6ad[_0x3995('0x11')]){if(_0x2574fe&&_0x2574fe['length']){var _0x5d778d=_0x2574fe[0x0][_0x3995('0x17')]%(_0x5bb715+_0x17a869);for(;_0x4bf976;_0x5bb715+=_0x17a869,_0x5d778d=_0x2574fe[0x0][_0x3995('0x17')]%(_0x5bb715+_0x17a869)){if(_0x5d778d==0x0||_0x5d778d==_0x2574fe[0x0][_0x3995('0x17')]){_0x4bf976=![];}_0x2ac176[_0x3995('0x18')](dbH['sequelize'][_0x3995('0x15')](util[_0x3995('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x17a869,_0x5bb715),{'type':dbH['sequelize'][_0x3995('0x16')]['SELECT']}));}}}else{_0x2ac176['push'](dbH[_0x3995('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0x3995('0x16')][_0x3995('0x19')]}));}var _0x55f3d1=path[_0x3995('0x1a')](PATH);var _0x1cce30=path[_0x3995('0x1b')](PATH,_0x3995('0x1c'));var _0x5b9818=_0x42f6ad['split']&&_0x2ac176['length']>0x1;var _0x4e0827=[];if(!fs[_0x3995('0x1d')](path[_0x3995('0x1e')](_0x55f3d1,_0x1cce30))&&_0x5b9818){fs[_0x3995('0x1f')](path['join'](_0x55f3d1,_0x1cce30));}return BPromise[_0x3995('0x20')](_0x2ac176,function(_0x38379c){_0x4e0827[_0x3995('0x18')](_0x38379c);})[_0x3995('0x13')](function(){for(var _0x1c3ce9=0x0;_0x1c3ce9<_0x4e0827[_0x3995('0x21')];_0x1c3ce9+=0x1){var _0x57ee9f;var _0x185289=_0x4e0827[_0x1c3ce9];if(_0x5b9818){_0x57ee9f=path[_0x3995('0x1e')](_0x55f3d1,_0x1cce30,util[_0x3995('0xc')](_0x3995('0x22'),_0x1cce30,_0x1c3ce9,_0x3995('0x23')));}else{_0x57ee9f=path[_0x3995('0x1e')](_0x55f3d1,util['format'](_0x3995('0x24'),_0x1cce30,_0x3995('0x23')));}fs[_0x3995('0x25')](_0x57ee9f,json2xls(_0x185289),_0x3995('0x26'));}})[_0x3995('0x13')](function(){if(_0x5b9818){zipdir(path['join'](_0x55f3d1,_0x1cce30),{'saveTo':path[_0x3995('0x1e')](_0x55f3d1,util[_0x3995('0xc')](_0x3995('0x24'),_0x1cce30,_0x3995('0x27')))},function(_0x10ef8e,_0x20004a){});rimraf(path[_0x3995('0x1e')](_0x55f3d1,_0x1cce30),function(){});}})[_0x3995('0x13')](function(){logger[_0x3995('0xb')](util[_0x3995('0xc')](_0x3995('0x28'),EXTRACTED_REPORT_ID,_0x3995('0xe')));return analyticExtractedReport(_0x3995('0x29'),_0x5b9818?util[_0x3995('0xc')](_0x3995('0x24'),_0x1cce30,_0x5b9818?_0x3995('0x27'):'xlsx'):null);});})['catch'](function(_0x2d3c40){logger[_0x3995('0xb')](util[_0x3995('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3995('0xe')),util[_0x3995('0x2a')](_0x2d3c40,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x3995('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f810f75..a6e94c8 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 _0xee5b=['CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','*,*,*,*','interval','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','destroy','bulkCreate','catch','error','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extension','push','type','Set','CDR(type)=%s','priority','VoiceExtensionId','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN:','context'];(function(_0x1d74ba,_0x35594e){var _0x407357=function(_0x17e68f){while(--_0x17e68f){_0x1d74ba['push'](_0x1d74ba['shift']());}};_0x407357(++_0x35594e);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1aa59c,_0x1f8f9a){_0x1aa59c=_0x1aa59c-0x0;var _0xfa71e4=_0xee5b[_0x1aa59c];return _0xfa71e4;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');function rewrite(_0x7b2344,_0x203bba){var _0x4f850a=this;return _0x7b2344[_0xbee5('0x1')][_0xbee5('0x2')][_0xbee5('0x3')]({'raw':!![]})[_0xbee5('0x4')](function(_0x4bd202){_0x4f850a['intervals']=_0x4bd202;return _0x7b2344[_0xbee5('0x1')][_0xbee5('0x5')][_0xbee5('0x3')]({'where':{'IntervalId':_0x203bba[_0xbee5('0x6')]},'raw':!![]});})['then'](function(_0x5505e3){return _0x7b2344['models']['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0xbee5('0x7')](_[_0xbee5('0x8')](_0x5505e3,_0xbee5('0x9')))}},'order':[{'raw':_0xbee5('0xa')}],'raw':!![]});})['then'](function(_0x143bd6){var _0x305921=_[_0xbee5('0xb')](_0x143bd6,{'priority':'1'});var _0x2edb3c=_[_0xbee5('0xb')](_0x143bd6,{'isApp':0x1});var _0x1509c7=_[_0xbee5('0xc')](_0x2edb3c,_0xbee5('0x9'));var _0xcef158=['queue',_0xbee5('0xd')];var _0x532a78=[];var _0x183877=[];for(var _0x180edd in _0x1509c7){if(_0x1509c7[_0xbee5('0xe')](_0x180edd)){_0x4f850a['priority']=0x2;_0x4f850a['extensions']=[];_0x4f850a[_0xbee5('0xf')]=_['find'](_0x305921,{'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')]});_0x4f850a['extensions'][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':util['format'](_0xbee5('0x13'),_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')]),'context':_0x1509c7[_0x180edd][0x0]['context'],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});if(_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')]===_0xbee5('0x16')){if(_0x4f850a[_0xbee5('0xf')]){_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x18')+(_0x4f850a[_0xbee5('0xf')][_0xbee5('0x19')]?_0xbee5('0x1a')+_0x4f850a[_0xbee5('0xf')]['cutdigits']+'}':'${EXTEN}'),'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});}_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x1c')+_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')],'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x4f850a['priority']++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0]['VoiceExtensionId']});var _0x519473=_0x4f850a['priority']++;_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x1d'),'appdata':_0xbee5('0x1e')+(_0x519473+0x2)+_0xbee5('0x1f')+(_0x519473+0x1)+')','context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x519473,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});if(_0x4f850a[_0xbee5('0xf')]){_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':'Set','appdata':_0x4f850a[_0xbee5('0xf')][_0xbee5('0x19')]?_0xbee5('0x20')+_0x4f850a[_0xbee5('0xf')][_0xbee5('0x19')]+'}':_0xbee5('0x21'),'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0]['VoiceExtensionId']});}_0x4f850a[_0xbee5('0x17')]['push']({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':'Set','appdata':_0xbee5('0x22')+_0x1509c7[_0x180edd][0x0]['VoiceExtensionId'],'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});if(_0x4f850a[_0xbee5('0xf')]&&_0x4f850a[_0xbee5('0xf')]['hasOwnProperty'](_0xbee5('0x23'))&&_0x4f850a[_0xbee5('0xf')][_0xbee5('0x23')]!==_0xbee5('0x24')){_0x4f850a['extensions'][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x25'),'context':_0x1509c7[_0x180edd][0x0]['context'],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});_0x4f850a[_0xbee5('0x17')]['push']({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':'Set','appdata':_0xbee5('0x26')+_0x4f850a['extension']['recordingFormat']||'wav','context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});}}_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0]['type'],'app':_0xbee5('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1509c7[_0x180edd][0x0]['context'],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});_0x4f850a[_0xbee5('0x17')]['push']({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x27'),'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});for(var _0x297294=0x0,_0x2b3f0=0x0;_0x297294<_0x1509c7[_0x180edd][_0xbee5('0x28')];_0x297294+=0x1,_0x2b3f0=0x0){var _0x5f3f8a=_0x1509c7[_0x180edd][_0x297294];if(_0x5f3f8a[_0xbee5('0x11')]){_0x5f3f8a[_0xbee5('0x11')]=_0x5f3f8a['type'][_0xbee5('0x29')]();}var _0xebbcc5=[];var _0x426934=[];delete _0x5f3f8a['id'];delete _0x5f3f8a[_0xbee5('0x2a')];delete _0x5f3f8a['updatedAt'];var _0x4cfe54=_0x5f3f8a['interval']!==_0xbee5('0x2b')?[_0x5f3f8a[_0xbee5('0x2c')]]:_0x5f3f8a[_0xbee5('0x6')]?_[_0xbee5('0x8')](_[_0xbee5('0xb')](_0x4f850a[_0xbee5('0x2d')],{'IntervalId':_0x5f3f8a[_0xbee5('0x6')]}),_0xbee5('0x2c')):[];if(_0x5f3f8a[_0xbee5('0xe')]('tag')){if(_0x5f3f8a['tag']&&_0x5f3f8a[_0xbee5('0x2e')]!=='--'){_0xebbcc5['push']({'type':_0x5f3f8a[_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':'CDR(tag)='+_0x5f3f8a[_0xbee5('0x2e')],'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a['exten'],'priority':_0x4cfe54['length']+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});}}if(_0x5f3f8a['type']===_0xbee5('0x16')&&_0x5f3f8a[_0xbee5('0xe')]('callerID')){if(_0x5f3f8a[_0xbee5('0x2f')]){_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a[_0xbee5('0x11')],'app':_0xbee5('0x1d'),'appdata':_0xbee5('0x30')+_0x5f3f8a[_0xbee5('0x2f')]+')','context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a['exten'],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});}else{_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a['type'],'app':_0xbee5('0x1d'),'appdata':_0xbee5('0x31'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a['exten'],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a['VoiceExtensionId']});}}if(_0x5f3f8a['hasOwnProperty']('answer')){if(_0xcef158[_0xbee5('0x32')](_0x5f3f8a['app'][_0xbee5('0x29')]())>=0x0&&_0x5f3f8a[_0xbee5('0x33')]!==_0xbee5('0x34')){if(_0x5f3f8a[_0xbee5('0x35')]){_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a[_0xbee5('0x11')],'app':'ExecIf','appdata':_0xbee5('0x36'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a[_0xbee5('0x9')],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a['priority']+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});_0xebbcc5['push']({'type':_0x5f3f8a[_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x37'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a[_0xbee5('0x9')],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});}else{_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a[_0xbee5('0x11')],'app':_0xbee5('0x1d'),'appdata':_0xbee5('0x38'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a[_0xbee5('0x9')],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a['priority']+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a[_0xbee5('0x11')],'app':'Set','appdata':_0xbee5('0x39'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a[_0xbee5('0x9')],'priority':_0x4cfe54['length']+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a['VoiceExtensionId']});}}}for(var _0x131c45=0x0;_0x131c45<_0x4cfe54['length'];_0x131c45+=0x1){var _0x91fb7a=_0x4f850a[_0xbee5('0x14')]+_0x4cfe54[_0xbee5('0x28')];var _0x594f87=_0x131c45===_0x4cfe54['length']-0x1?_0x4f850a['priority']+_0xebbcc5[_0xbee5('0x28')]+_0x426934[_0xbee5('0x28')]+0x2:_0x4f850a[_0xbee5('0x14')]+_0x131c45+0x1;_0xebbcc5['splice'](_0x131c45,0x0,{'type':_0x5f3f8a[_0xbee5('0x11')],'app':'GotoIfTime','appdata':_0x4cfe54[_0x131c45]+'?'+_0x5f3f8a[_0xbee5('0x1b')]+_0xbee5('0x3a')+_0x91fb7a+':'+_0x5f3f8a[_0xbee5('0x1b')]+',${EXTEN},'+_0x594f87,'exten':_0x5f3f8a[_0xbee5('0x9')],'context':_0x5f3f8a[_0xbee5('0x1b')],'priority':_0x4f850a[_0xbee5('0x14')]+_0x131c45,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});}_0x5f3f8a[_0xbee5('0x14')]=_0xebbcc5[_0xbee5('0x28')]?_[_0xbee5('0x3b')](_0xebbcc5)[_0xbee5('0x14')]+0x1:_0x4f850a[_0xbee5('0x14')];_0x4f850a[_0xbee5('0x14')]=(_0x426934[_0xbee5('0x28')]?_[_0xbee5('0x3b')](_0x426934)[_0xbee5('0x14')]:_0x5f3f8a[_0xbee5('0x14')])+0x1;_0x4f850a[_0xbee5('0x17')]=_[_0xbee5('0x3c')](_0x4f850a[_0xbee5('0x17')],_0xebbcc5,[_0x5f3f8a],_0x426934);}_0x4f850a['extensions'][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0]['type'],'app':'Hangup','exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'priority':_0x4f850a['priority'],'VoiceExtensionId':_0x1509c7[_0x180edd][0x0]['VoiceExtensionId']});_0x532a78[_0xbee5('0x10')](_0x1509c7[_0x180edd][0x0]['VoiceExtensionId']);_0x183877=_[_0xbee5('0x3c')](_0x183877,_0x4f850a[_0xbee5('0x17')]);}}return _0x7b2344['transaction'](function(_0x928e67){return _0x7b2344[_0xbee5('0x1')][_0xbee5('0x5')][_0xbee5('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x532a78}},'transaction':_0x928e67})['then'](function(_0x205784){return _0x7b2344['models'][_0xbee5('0x5')][_0xbee5('0x3e')](_['sortBy'](_0x183877,_0xbee5('0x14')),{'transaction':_0x928e67});});});})[_0xbee5('0x3f')](function(_0x4a5127){console[_0xbee5('0x40')](_0x4a5127);});}exports[_0xbee5('0x41')]=rewrite; \ No newline at end of file +var _0x4e81=['lodash','util','Interval','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','map','exten','filter','groupBy','playback','hasOwnProperty','extensions','find','push','Set','format','CDR(type)=%s','type','context','priority','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','createdAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4e81,0x1bc));var _0x14e8=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x4e81[_0x4fa291];return _0x506d9b;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));function rewrite(_0x354aac,_0x533fb3){var _0x4b9800=this;return _0x354aac['models'][_0x14e8('0x2')][_0x14e8('0x3')]({'raw':!![]})[_0x14e8('0x4')](function(_0x436444){_0x4b9800[_0x14e8('0x5')]=_0x436444;return _0x354aac[_0x14e8('0x6')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x533fb3[_0x14e8('0x7')]},'raw':!![]});})[_0x14e8('0x4')](function(_0x21f860){return _0x354aac[_0x14e8('0x6')][_0x14e8('0x8')][_0x14e8('0x3')]({'where':{'exten':{'$in':_[_0x14e8('0x9')](_[_0x14e8('0xa')](_0x21f860,_0x14e8('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x14e8('0x4')](function(_0x3c6bdd){var _0x43bfcd=_[_0x14e8('0xc')](_0x3c6bdd,{'priority':'1'});var _0x421fec=_[_0x14e8('0xc')](_0x3c6bdd,{'isApp':0x1});var _0x3bed91=_[_0x14e8('0xd')](_0x421fec,'exten');var _0x37eccb=['queue',_0x14e8('0xe')];var _0x341d40=[];var _0x32a01d=[];for(var _0x5a95b7 in _0x3bed91){if(_0x3bed91[_0x14e8('0xf')](_0x5a95b7)){_0x4b9800['priority']=0x2;_0x4b9800[_0x14e8('0x10')]=[];_0x4b9800['extension']=_[_0x14e8('0x11')](_0x43bfcd,{'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')]});_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0]['type'],'app':_0x14e8('0x13'),'appdata':util[_0x14e8('0x14')](_0x14e8('0x15'),_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')]),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});if(_0x3bed91[_0x5a95b7][0x0]['type']===_0x14e8('0x1a')){if(_0x4b9800[_0x14e8('0x1b')]){_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':'Set','appdata':_0x14e8('0x1c')+(_0x4b9800[_0x14e8('0x1b')][_0x14e8('0x1d')]?'${EXTEN:'+_0x4b9800[_0x14e8('0x1b')]['cutdigits']+'}':_0x14e8('0x1e')),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});}_0x4b9800['extensions'][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0]['type'],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x1f')+_0x3bed91[_0x5a95b7][0x0]['VoiceExtensionId'],'context':_0x3bed91[_0x5a95b7][0x0]['context'],'exten':_0x3bed91[_0x5a95b7][0x0]['exten'],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});var _0x3eae0b=_0x4b9800[_0x14e8('0x18')]++;_0x4b9800[_0x14e8('0x10')]['push']({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x20'),'appdata':_0x14e8('0x21')+(_0x3eae0b+0x2)+_0x14e8('0x22')+(_0x3eae0b+0x1)+')','context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x3eae0b,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});if(_0x4b9800['extension']){_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':'Set','appdata':_0x4b9800['extension']['cutdigits']?_0x14e8('0x23')+_0x4b9800[_0x14e8('0x1b')]['cutdigits']+'}':_0x14e8('0x24'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0]['VoiceExtensionId']});}_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x25')+_0x3bed91[_0x5a95b7][0x0]['VoiceExtensionId'],'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});if(_0x4b9800['extension']&&_0x4b9800[_0x14e8('0x1b')]['hasOwnProperty'](_0x14e8('0x26'))&&_0x4b9800[_0x14e8('0x1b')][_0x14e8('0x26')]!==_0x14e8('0x27')){_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x28'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0]['VoiceExtensionId']});_0x4b9800['extensions']['push']({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':'Set','appdata':_0x14e8('0x29')+_0x4b9800['extension'][_0x14e8('0x26')]||_0x14e8('0x2a'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800['priority']++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});}}_0x4b9800['extensions'][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x2b'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800['priority']++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});_0x4b9800['extensions'][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800['priority']++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x2c'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});for(var _0x11f0ee=0x0,_0x2f1904=0x0;_0x11f0ee<_0x3bed91[_0x5a95b7][_0x14e8('0x2d')];_0x11f0ee+=0x1,_0x2f1904=0x0){var _0x21e781=_0x3bed91[_0x5a95b7][_0x11f0ee];if(_0x21e781[_0x14e8('0x16')]){_0x21e781['type']=_0x21e781[_0x14e8('0x16')]['toLowerCase']();}var _0x555f70=[];var _0x5e323a=[];delete _0x21e781['id'];delete _0x21e781[_0x14e8('0x2e')];delete _0x21e781['updatedAt'];var _0x46a3c4=_0x21e781[_0x14e8('0x2f')]!==_0x14e8('0x30')?[_0x21e781[_0x14e8('0x2f')]]:_0x21e781[_0x14e8('0x7')]?_[_0x14e8('0xa')](_[_0x14e8('0xc')](_0x4b9800[_0x14e8('0x5')],{'IntervalId':_0x21e781[_0x14e8('0x7')]}),_0x14e8('0x2f')):[];if(_0x21e781[_0x14e8('0xf')]('tag')){if(_0x21e781[_0x14e8('0x31')]&&_0x21e781[_0x14e8('0x31')]!=='--'){_0x555f70[_0x14e8('0x12')]({'type':_0x21e781[_0x14e8('0x16')],'app':'Set','appdata':_0x14e8('0x32')+_0x21e781[_0x14e8('0x31')],'context':_0x21e781['context'],'exten':_0x21e781['exten'],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800['priority']+_0x2f1904++,'VoiceExtensionId':_0x21e781['VoiceExtensionId']});}}if(_0x21e781[_0x14e8('0x16')]===_0x14e8('0x1a')&&_0x21e781['hasOwnProperty'](_0x14e8('0x33'))){if(_0x21e781[_0x14e8('0x33')]){_0x555f70['push']({'type':_0x21e781[_0x14e8('0x16')],'app':_0x14e8('0x20'),'appdata':_0x14e8('0x34')+_0x21e781[_0x14e8('0x33')]+')','context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781[_0x14e8('0xb')],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});}else{_0x555f70[_0x14e8('0x12')]({'type':_0x21e781[_0x14e8('0x16')],'app':_0x14e8('0x20'),'appdata':_0x14e8('0x35'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781[_0x14e8('0xb')],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800['priority']+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});}}if(_0x21e781['hasOwnProperty'](_0x14e8('0x36'))){if(_0x37eccb[_0x14e8('0x37')](_0x21e781[_0x14e8('0x38')][_0x14e8('0x39')]())>=0x0&&_0x21e781['appType']!=='custom'){if(_0x21e781['answer']){_0x555f70[_0x14e8('0x12')]({'type':_0x21e781['type'],'app':'ExecIf','appdata':_0x14e8('0x3a'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781['exten'],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});_0x555f70[_0x14e8('0x12')]({'type':_0x21e781['type'],'app':'Set','appdata':_0x14e8('0x3b'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781[_0x14e8('0xb')],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});}else{_0x555f70['push']({'type':_0x21e781[_0x14e8('0x16')],'app':_0x14e8('0x20'),'appdata':_0x14e8('0x3c'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781['exten'],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});_0x555f70[_0x14e8('0x12')]({'type':_0x21e781['type'],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x3d'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781[_0x14e8('0xb')],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});}}}for(var _0x168b8a=0x0;_0x168b8a<_0x46a3c4['length'];_0x168b8a+=0x1){var _0x5a1f22=_0x4b9800[_0x14e8('0x18')]+_0x46a3c4[_0x14e8('0x2d')];var _0x238468=_0x168b8a===_0x46a3c4[_0x14e8('0x2d')]-0x1?_0x4b9800[_0x14e8('0x18')]+_0x555f70['length']+_0x5e323a['length']+0x2:_0x4b9800['priority']+_0x168b8a+0x1;_0x555f70[_0x14e8('0x3e')](_0x168b8a,0x0,{'type':_0x21e781[_0x14e8('0x16')],'app':_0x14e8('0x3f'),'appdata':_0x46a3c4[_0x168b8a]+'?'+_0x21e781['context']+_0x14e8('0x40')+_0x5a1f22+':'+_0x21e781[_0x14e8('0x17')]+_0x14e8('0x40')+_0x238468,'exten':_0x21e781['exten'],'context':_0x21e781[_0x14e8('0x17')],'priority':_0x4b9800[_0x14e8('0x18')]+_0x168b8a,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});}_0x21e781[_0x14e8('0x18')]=_0x555f70[_0x14e8('0x2d')]?_[_0x14e8('0x41')](_0x555f70)[_0x14e8('0x18')]+0x1:_0x4b9800[_0x14e8('0x18')];_0x4b9800[_0x14e8('0x18')]=(_0x5e323a[_0x14e8('0x2d')]?_[_0x14e8('0x41')](_0x5e323a)['priority']:_0x21e781[_0x14e8('0x18')])+0x1;_0x4b9800[_0x14e8('0x10')]=_[_0x14e8('0x42')](_0x4b9800[_0x14e8('0x10')],_0x555f70,[_0x21e781],_0x5e323a);}_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x43'),'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'priority':_0x4b9800[_0x14e8('0x18')],'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});_0x341d40['push'](_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]);_0x32a01d=_[_0x14e8('0x42')](_0x32a01d,_0x4b9800['extensions']);}}return _0x354aac[_0x14e8('0x44')](function(_0x2c2630){return _0x354aac[_0x14e8('0x6')][_0x14e8('0x8')][_0x14e8('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x341d40}},'transaction':_0x2c2630})[_0x14e8('0x4')](function(_0x139405){return _0x354aac['models']['VoiceExtension']['bulkCreate'](_[_0x14e8('0x46')](_0x32a01d,_0x14e8('0x18')),{'transaction':_0x2c2630});});});})[_0x14e8('0x47')](function(_0x2c6d33){console[_0x14e8('0x48')](_0x2c6d33);});}exports[_0x14e8('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 610900a..7c55da4 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 _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(_0x4d111a,_0x847227){var _0x3fa8f0=function(_0x3ddbb1){while(--_0x3ddbb1){_0x4d111a['push'](_0x4d111a['shift']());}};_0x3fa8f0(++_0x847227);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 +var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x566918,_0x1eba63){var _0x5073ff=function(_0x200275){while(--_0x200275){_0x566918['push'](_0x566918['shift']());}};_0x5073ff(++_0x1eba63);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xcb91[_0x16e57d];return _0x40239c;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 51c4baa..38dbaa1 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x7a54,0x106));var _0x47a5=function(_0x27bdee,_0x478485){_0x27bdee=_0x27bdee-0x0;var _0x26b28c=_0x7a54[_0x27bdee];return _0x26b28c;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x28b272,_0x1c67e9){var _0x1c90b6=function(_0x2d8b85){while(--_0x2d8b85){_0x28b272['push'](_0x28b272['shift']());}};_0x1c90b6(++_0x1c67e9);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 32e7ba5..c209c6f 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 _0x428f=['findOne','update','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','cm_hopper_black','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','toString','info','Received\x20SIGINT','exit','errors','code','catch','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','body','ContactItemType','findAll','name','header','writeFileSync','parse','createReadStream','data','rows','find','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','isValid','\x20not\x20specified','trim','replace','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactTypeId','orderBy','finish','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','phone','from','join','where','\x20=\x20','sequelize','query','spread','isNil','AdditionalPhones','push','then','error','message','split','length','all','filter','CmContactHasItem'];(function(_0x236c98,_0x522c76){var _0x53d653=function(_0x277c0d){while(--_0x277c0d){_0x236c98['push'](_0x236c98['shift']());}};_0x53d653(++_0x522c76);}(_0x428f,0x110));var _0xf428=function(_0x216da7,_0x30626d){_0x216da7=_0x216da7-0x0;var _0x2e106a=_0x428f[_0x216da7];return _0x2e106a;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xf428('0x0'));var Papa=require(_0xf428('0x1'));var util=require(_0xf428('0x2'));var BPromise=require(_0xf428('0x3'));var moment=require(_0xf428('0x4'));var squel=require(_0xf428('0x5'));var Redis=require('ioredis');var db=require(_0xf428('0x6'))['db'];var config=require(_0xf428('0x7'));var logger=require(_0xf428('0x8'))('import');config[_0xf428('0x9')]=_[_0xf428('0xa')](config[_0xf428('0x9')],{'host':_0xf428('0xb'),'port':0x18eb});var socket=require(_0xf428('0xc'))(new Redis(config[_0xf428('0x9')]));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()[_0xf428('0xd')](_0xf428('0xe'));var tempTableName=_0xf428('0xf')+moment()['format'](_0xf428('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x542b68){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))*$/[_0xf428('0x11')](_0x542b68);}function selectNotIn(_0x41456e,_0x222b17,_0x37ba7a,_0x566269,_0xc81c6){return squel['select']()[_0xf428('0x12')](_0xf428('0x13'))[_0xf428('0x14')](_0x566269)[_0xf428('0x15')](_0x222b17,null,_0x222b17+'.id\x20=\x20'+_0x566269+'.'+_0x37ba7a)[_0xf428('0x16')](_0x566269+'.'+_0x37ba7a+_0xf428('0x17')+_0x41456e+'.'+_0x37ba7a)[_0xf428('0x16')](_0x222b17+'.dialCheckDuplicateType\x20IN\x20('+_0xc81c6[_0xf428('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x32e4dd,_0x5a5be4){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf428('0x18')][_0xf428('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0xf428('0x1a')](function(_0x4e50e1){if(_0x4e50e1!==null){var _0x7e0a2d=[];for(var _0x51acd6=0x0;_0x51acd6<_0x4e50e1['length'];_0x51acd6++){var _0x4c05ce=_0x4e50e1[_0x51acd6];if(!_[_0xf428('0x1b')](_0x4c05ce[_0xf428('0x13')])){if(!_[_0xf428('0x1b')](_0x4c05ce[_0xf428('0x1c')]))_0x7e0a2d[_0xf428('0x1d')](insertAdditionalPhones(_0x4c05ce));promisesContact['push']({'contact':_0x4c05ce});}}}Promise['all'](_0x7e0a2d)[_0xf428('0x1e')](function(){_0x32e4dd({'val':0x1});});})['catch'](function(_0x4551b1){logger[_0xf428('0x1f')](_0x4551b1[_0xf428('0x20')]);});});}function insertAdditionalPhones(_0x251e36){return new Promise(function(_0x561a82,_0x52bf51){var _0x1b4b1b=_0x251e36['AdditionalPhones'];if(_[_0xf428('0x1b')](_0x1b4b1b))_0x52bf51({'val':0x0});else{var _0x155f01=_0x1b4b1b[_0xf428('0x21')](';');var _0x5bc400=[];orderBy=0x0;for(var _0x5e0a7e=0x0;_0x5e0a7e<_0x155f01[_0xf428('0x22')];_0x5e0a7e++){_0x5bc400[_0xf428('0x1d')](splitAdditionalPhone(_0x251e36['id'],_0x155f01[_0x5e0a7e]));}Promise[_0xf428('0x23')](_0x5bc400)[_0xf428('0x1e')](function(){_0x561a82({'val':_0x155f01[_0xf428('0x22')]});});}});}function splitAdditionalPhone(_0x3aea7e,_0x34211f){return new Promise(function(_0x4e6fa2,_0x409b09){var _0x1ef86a=_0x34211f['split'](':');var _0x4a25ed=_0x1ef86a[0x0];var _0x1a0446=_0x1ef86a[0x1];if(_0x1a0446!==''){var _0x155b49=_0x1a0446[_0xf428('0x21')]('|');var _0x10f5ce=[];for(var _0x15a74c=0x0;_0x15a74c<_0x155b49['length'];_0x15a74c++){if(_0x155b49[_0x15a74c]!==''){var _0x3d677b=_[_0xf428('0x24')](promisesAdditionalPhones,{'contactId':_0x3aea7e,'phone':_0x155b49[_0x15a74c]});if(_0x3d677b[_0xf428('0x22')]==0x0){orderBy++;promisesAdditionalPhones[_0xf428('0x1d')]({'contactId':_0x3aea7e,'contactTypeId':_0x4a25ed,'phone':_0x155b49[_0x15a74c],'orderBy':orderBy});}}}_0x4e6fa2({'ok':0x1});}else _0x4e6fa2({'res':0x0});});}function createAdditionalPhone(_0x5aeb3c,_0xa0942f,_0xf71970,_0x5cde78){return new Promise(function(_0x35bfab,_0x4020b2){return db[_0xf428('0x25')][_0xf428('0x26')]({'where':{'CmContactId':_0x5aeb3c,'item':_0xf71970}})[_0xf428('0x1e')](function(_0x2d5e82){if(_0x2d5e82){return db[_0xf428('0x25')][_0xf428('0x27')]({'ItemTypeId':_0xa0942f,'OrderBy':_0x5cde78},{'where':{'CmContactId':_0x5aeb3c,'item':_0xf71970}})[_0xf428('0x1e')](function(_0x1834d3){_0x35bfab({'res':'updated'});});}else{return db[_0xf428('0x25')]['create']({'CmContactId':_0x5aeb3c,'item':_0xf71970,'ItemTypeId':_0xa0942f,'OrderBy':_0x5cde78,'ItemClass':_0xf428('0x28')})[_0xf428('0x1e')](function(_0x5603d4){_0x35bfab({'res':_0xf428('0x29')});});}});});}function updateContact(_0x2e2ddf){return new Promise(function(_0x735378,_0x52ee4b){var _0x3f3c9b=_0x2e2ddf['id'];delete _0x2e2ddf['id'];return db[_0xf428('0x2a')]['update'](_0x2e2ddf,{'where':{'id':_0x3f3c9b}})[_0xf428('0x1e')](function(_0x30fcc7){updatedRows+=0x1;return db[_0xf428('0x2b')][_0xf428('0x27')]({'phone':_0x2e2ddf[_0xf428('0x13')]},{'where':{'ContactId':_0x3f3c9b}})[_0xf428('0x1e')](function(_0x4e6cc8){_0x735378({'ret':'OK'});});});});}function insertCmHopper(_0x213480,_0x44497b,_0x1cfc67,_0x47ae56,_0x4f2ad7){var _0x54aa77=[_0xf428('0x2c'),'cm_contacts.scheduledat',_0xf428('0x2d'),_0xf428('0x2e'),_0x44497b+'.'+_0x47ae56,'cm_contacts.createdAt',_0xf428('0x2f'),_0xf428('0x30'),_0xf428('0x31'),'\x22'+_0x4f2ad7+'\x22'];return squel[_0xf428('0x32')]()[_0xf428('0x33')]('cm_hopper')[_0xf428('0x34')](['phone',_0xf428('0x35'),_0xf428('0x36'),_0xf428('0x37'),_0x47ae56,_0xf428('0x38'),_0xf428('0x39'),_0xf428('0x3a'),'UserId',_0xf428('0x3b')],squel[_0xf428('0x3c')]()[_0xf428('0x3d')](_0x54aa77)[_0xf428('0x14')](_0x44497b)[_0xf428('0x15')](_0xf428('0x3e'),null,_0xf428('0x3f')+_0x44497b+_0xf428('0x40'))[_0xf428('0x15')](_0x1cfc67,null,_0x1cfc67+_0xf428('0x41')+_0x44497b+'.'+_0x47ae56)['where'](_0x44497b+'.CmListId\x20=\x20?',_0x213480)[_0xf428('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf428('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x44497b,_0x1cfc67,_0x47ae56,_0xf428('0x42'),[_0xf428('0x43'),_0xf428('0x44')]))[_0xf428('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x44497b,_0x1cfc67,_0x47ae56,_0xf428('0x42'),[_0xf428('0x43')])))['toString']();}function insertCmHopperBlack(_0x304413,_0x2bfe9b,_0xf4861b,_0x305f1f){var _0x121323=[_0xf428('0x2c'),'cm_contacts.id',_0xf428('0x2e'),_0x2bfe9b+'.'+_0x305f1f,_0xf428('0x45'),'cm_contacts.updatedAt'];return squel[_0xf428('0x32')]()[_0xf428('0x33')](_0xf428('0x46'))['fromQuery']([_0xf428('0x13'),'ContactId',_0xf428('0x37'),_0x305f1f,_0xf428('0x38'),'updatedAt'],squel[_0xf428('0x3c')]()[_0xf428('0x3d')](_0x121323)[_0xf428('0x14')](_0x2bfe9b)['join'](_0xf428('0x3e'),null,_0xf428('0x3f')+_0x2bfe9b+_0xf428('0x40'))[_0xf428('0x15')](_0xf4861b,null,_0xf4861b+'.id\x20=\x20'+_0x2bfe9b+'.'+_0x305f1f)[_0xf428('0x16')](_0x2bfe9b+_0xf428('0x47'),_0x304413)[_0xf428('0x16')](_0xf428('0x48'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xf428('0x12')]('phone')[_0xf428('0x14')](_0xf428('0x46'))[_0xf428('0x16')](_0xf428('0x49'),_0x304413)[_0xf428('0x16')](_0x305f1f+'\x20=\x20?',_0x2bfe9b+'.'+_0x305f1f)))['toString']();}function insertCmHopperAdditionalPhones(_0x4bc409){var _0x4b4402=[_0xf428('0x4a'),'cm_contact_has_items.item',_0xf428('0x4b'),_0xf428('0x4c'),_0xf428('0x4d')];return squel[_0xf428('0x32')]()[_0xf428('0x33')](_0xf428('0x4e'))[_0xf428('0x34')]([_0xf428('0x4f'),_0xf428('0x13'),'OrderBy',_0xf428('0x38'),'updatedAt'],squel[_0xf428('0x3c')]()['fields'](_0x4b4402)[_0xf428('0x14')](_0xf428('0x42'))[_0xf428('0x15')](_0xf428('0x3e'),null,_0xf428('0x50'))[_0xf428('0x15')](_0xf428('0x51'),null,_0xf428('0x52'))[_0xf428('0x16')](_0xf428('0x53'),_0x4bc409)[_0xf428('0x16')](_0xf428('0x48'),NOW))['toString']();}function insertCmContact(_0x50be98,_0xb2b6b6,_0x369ff0,_0x279679){var _0x31c645=_['concat'](_[_0xf428('0x54')](_0x279679),[_0xf428('0x37'),_0xf428('0x55'),_0xf428('0x38'),_0xf428('0x39')]);return squel[_0xf428('0x32')]()['into'](_0xf428('0x3e'))['fromQuery'](_0x31c645,squel[_0xf428('0x3c')]()['fields'](_0x31c645)[_0xf428('0x14')](_0xb2b6b6)[_0xf428('0x16')]('('+_0x369ff0[_0xf428('0x15')](',')+_0xf428('0x56'),squel[_0xf428('0x3c')]()[_0xf428('0x3d')](_0x369ff0)[_0xf428('0x14')](_0xf428('0x3e'))[_0xf428('0x16')](_0xf428('0x49'),_0x50be98))['where']('id\x20IN\x20?',squel[_0xf428('0x3c')]()[_0xf428('0x12')](_0xf428('0x57'),_0xf428('0x58'))[_0xf428('0x14')](_0xb2b6b6)[_0xf428('0x59')](_0x369ff0['join'](','))))[_0xf428('0x5a')]();}function handleStop(){logger[_0xf428('0x5b')](_0xf428('0x5c'));stopped=!![];}function handleUncaughtException(_0x325d48){logger['error'](_0x325d48[_0xf428('0x20')]);process[_0xf428('0x5d')](0x1);}function handleError(_0x1d3670,_0xed0b82){stats[_0xf428('0x5e')][_0xf428('0x1d')]({'name':_0xed0b82[_0xf428('0x5f')],'message':_0xed0b82[_0xf428('0x20')],'row':_0x1d3670});}function handleQuery(_0x4d4d49){logger['info'](_0x4d4d49);return db['sequelize'][_0xf428('0x19')](_0x4d4d49)['spread'](function(_0x1b4b27){results['push'](_0x1b4b27);})[_0xf428('0x60')](function(_0x521600){logger['error'](_0x521600[_0xf428('0x20')]);});}function main(_0x58ab30,_0x43d73c,_0x13c6b5,_0x2e47a3){logger[_0xf428('0x5b')](_0xf428('0x61'),_0x58ab30,JSON[_0xf428('0x62')](_0x43d73c));process[_0xf428('0x63')](_0xf428('0x64'));var _0x46e16c=_0x43d73c[_0xf428('0x65')];var _0x209fe4=_[_0xf428('0x66')](_0x46e16c);var _0x1f2a8d=_0x43d73c[_0xf428('0x67')];var _0x526edd=path[_0xf428('0x15')](config[_0xf428('0x68')],_0xf428('0x69'),_0x1f2a8d+'.csv');logger[_0xf428('0x5b')](_0xf428('0x6a'),_0x43d73c);db[_0xf428('0x6b')][_0xf428('0x6c')]({'raw':!![],'attributes':['id',_0xf428('0x6d')]})['then'](function(_0x5edcab){for(var _0x5ea7fc=0x0;_0x5ea7fc<_0x5edcab[_0xf428('0x22')];_0x5ea7fc++){if(_0x5edcab[_0x5ea7fc][_0xf428('0x6d')]in _0x46e16c){contactItemTypes[_0xf428('0x1d')](_0x5edcab[_0x5ea7fc]);delete _0x209fe4[_0x5edcab[_0x5ea7fc]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x209fe4[_0xf428('0x1c')]='';var _0x1fea89=_[_0xf428('0x54')](_0x209fe4)['join']();logger['info'](_0xf428('0x6e'),_0x1fea89);fs[_0xf428('0x6f')](_0x526edd,_0x1fea89+'\x0a');Papa[_0xf428('0x70')](fs[_0xf428('0x71')](_0x58ab30),{'header':!![],'skipEmptyLines':!![],'step':function(_0x177c48,_0x2e44bd){try{for(var _0x3127c8=0x0,_0xdddb4a=[];_0x3127c8<_0x177c48[_0xf428('0x72')][_0xf428('0x22')];_0x3127c8++){stats[_0xf428('0x73')]+=0x1;if(_0x177c48['errors'][_0x3127c8]){handleError(_0x177c48[_0xf428('0x72')][_0x3127c8],_0x177c48[_0xf428('0x5e')][_0x3127c8]);}else{var _0x54cbbd=[];var _0x1ff594=[];for(var _0x57fd2b in _0x46e16c){let _0x56d1d4=contactItemTypes[_0xf428('0x74')](_0x51eaed=>_0x51eaed[_0xf428('0x6d')]===_0x57fd2b);if(_['isNil'](_0x56d1d4)){if(_0x46e16c['hasOwnProperty'](_0x57fd2b)){if(_0x177c48[_0xf428('0x72')][_0x3127c8][_0x46e16c[_0x57fd2b]]){var _0x33bee9=_['trim'](_0x177c48[_0xf428('0x72')][_0x3127c8][_0x46e16c[_0x57fd2b]]['replace'](/"/g,'\x27'));switch(_0x57fd2b){case _0xf428('0x35'):var _0x6be48d=moment(_0x33bee9,_0xf428('0xe'),!![]);if(_0x6be48d['isValid']()){_0xdddb4a['push']('\x22'+_0x33bee9+'\x22');}else{_0x54cbbd[_0xf428('0x1d')](_0xf428('0x75'));}break;case _0xf428('0x3a'):var _0x1005be=parseInt(_0x33bee9);_0x33bee9=_[_0xf428('0x76')](_0x1005be)||_0x1005be<0x0||_0x1005be>0x4?_0x2e47a3?0x3:0x2:_0x1005be;_0xdddb4a[_0xf428('0x1d')]('\x22'+_0x33bee9+'\x22');break;case _0xf428('0x77'):var _0x119cfb=parseInt(_0x33bee9);if(_['isNumber'](_0x119cfb)&&_[_0xf428('0x78')](_0x13c6b5,_0x119cfb)){_0xdddb4a['push']('\x22'+_0x119cfb+'\x22');}else{_0x54cbbd[_0xf428('0x1d')](_0xf428('0x79'));}break;case'email':if(isEmail(_0x33bee9)){_0xdddb4a['push']('\x22'+_0x33bee9+'\x22');}else{_0x54cbbd[_0xf428('0x1d')](_0xf428('0x7a'));}break;case _0xf428('0x7b'):var _0x4566f8=moment(_0x33bee9,'YYYY-MM-DD',!![]);if(_0x4566f8[_0xf428('0x7c')]()){_0xdddb4a[_0xf428('0x1d')]('\x22'+_0x33bee9+'\x22');}else{_0x54cbbd[_0xf428('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0xdddb4a[_0xf428('0x1d')]('\x22'+_0x33bee9+'\x22');}}else{switch(_0x57fd2b){case'firstName':case _0xf428('0x13'):_0x54cbbd[_0xf428('0x1d')](_0x57fd2b+_0xf428('0x7d'));break;default:_0xdddb4a[_0xf428('0x1d')]('\x22\x22');}}}}else{var _0x29f32f='';for(var _0x2466f3=0x0;_0x2466f3<_0x46e16c[_0x57fd2b][_0xf428('0x22')];_0x2466f3++){var _0x33bee9=_[_0xf428('0x7e')](_0x177c48['data'][_0x3127c8][_0x46e16c[_0x57fd2b][_0x2466f3]][_0xf428('0x7f')](/"/g,'\x27'));if(_0x29f32f=='')_0x29f32f=_0x33bee9;else _0x29f32f+='|'+_0x33bee9;}_0x1ff594[_0xf428('0x1d')](_0x56d1d4['id']+':'+_0x29f32f);}}if(hasAdditionalPhones){_0xdddb4a['push']('\x22'+_0x1ff594['join'](';')+'\x22');}if(_0x54cbbd['length']){handleError(_0x177c48[_0xf428('0x72')][_0x3127c8],{'code':_0xf428('0x80'),'message':_0x54cbbd[_0xf428('0x15')]()});}else{fs[_0xf428('0x81')](_0x526edd,_0xdddb4a[_0xf428('0x15')]()+'\x0a');}_0xdddb4a=[];}if(!(stats[_0xf428('0x73')]%0xc8)){socket[_0xf428('0x82')](_0xf428('0x83')+_0x1f2a8d,stats);stats[_0xf428('0x5e')]=[];}}if(stopped){logger['info'](_0xf428('0x84'));_0x2e44bd['abort']();}}catch(_0x1e2d43){handleError(_0x177c48[_0xf428('0x72')][_0x3127c8],{'code':_0xf428('0x85'),'message':_0x1e2d43[_0xf428('0x20')]});logger[_0xf428('0x1f')](_0xf428('0x86'),_0x1e2d43[_0xf428('0x20')]);}},'complete':function(){try{var _0x222ad4=[];var _0x18f161=tempTableName;_0x222ad4[_0xf428('0x1d')](_0xf428('0x87')+_0x18f161+_0xf428('0x88'));logger[_0xf428('0x5b')](_0xf428('0x89'),contactItemTypes[_0xf428('0x22')]);var _0x5eda05=util[_0xf428('0xd')](_0xf428('0x8a'),_0x526edd,_0x18f161,_0x1fea89,_0x43d73c['ListId'],_0x43d73c[_0xf428('0x55')]||null,NOW,NOW);if(_[_0xf428('0x1b')](_0x46e16c['scheduledat'])){_0x5eda05+=_0xf428('0x8b');}_0x222ad4['push'](_0x5eda05);BPromise[_0xf428('0x8c')](_0x222ad4,handleQuery)['then'](function(_0x55cba2){BPromise[_0xf428('0x23')]([handleAdditionalPhones()])[_0xf428('0x1e')](function(){_0x222ad4=[];for(var _0x195753=0x0;_0x195753_0xc02ad8[_0xd7fe('0x6b')]===_0x10f8c0);if(_['isNil'](_0x4d22df)){if(_0x49b085[_0xd7fe('0x73')](_0x10f8c0)){if(_0x7a555b['data'][_0x2347e5][_0x49b085[_0x10f8c0]]){var _0x2ed839=_[_0xd7fe('0x74')](_0x7a555b['data'][_0x2347e5][_0x49b085[_0x10f8c0]][_0xd7fe('0x75')](/"/g,'\x27'));switch(_0x10f8c0){case _0xd7fe('0x3a'):var _0x5f3a7f=moment(_0x2ed839,_0xd7fe('0x76'),!![]);if(_0x5f3a7f[_0xd7fe('0x77')]()){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x2ed839+'\x22');}else{_0x46deb2[_0xd7fe('0x1f')](_0xd7fe('0x78'));}break;case _0xd7fe('0x3e'):var _0x16ae5e=parseInt(_0x2ed839);_0x2ed839=_[_0xd7fe('0x79')](_0x16ae5e)||_0x16ae5e<0x0||_0x16ae5e>0x4?_0x5ed0f4?0x3:0x2:_0x16ae5e;_0x117edd['push']('\x22'+_0x2ed839+'\x22');break;case'UserId':var _0xdbe66e=parseInt(_0x2ed839);if(_[_0xd7fe('0x7a')](_0xdbe66e)&&_[_0xd7fe('0x7b')](_0x36e513,_0xdbe66e)){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0xdbe66e+'\x22');}else{_0x46deb2[_0xd7fe('0x1f')](_0xd7fe('0x7c'));}break;case'email':if(isEmail(_0x2ed839)){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x2ed839+'\x22');}else{_0x46deb2[_0xd7fe('0x1f')](_0xd7fe('0x7d'));}break;case _0xd7fe('0x7e'):var _0xa906a9=moment(_0x2ed839,'YYYY-MM-DD',!![]);if(_0xa906a9['isValid']()){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x2ed839+'\x22');}else{_0x46deb2[_0xd7fe('0x1f')](_0xd7fe('0x7f'));}break;default:_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x2ed839+'\x22');}}else{switch(_0x10f8c0){case _0xd7fe('0x80'):case'phone':_0x46deb2[_0xd7fe('0x1f')](_0x10f8c0+_0xd7fe('0x81'));break;default:_0x117edd['push']('\x22\x22');}}}}else{var _0xb4d15='';for(var _0x2f7a90=0x0;_0x2f7a90<_0x49b085[_0x10f8c0][_0xd7fe('0x1c')];_0x2f7a90++){var _0x2ed839=_['trim'](_0x7a555b[_0xd7fe('0x70')][_0x2347e5][_0x49b085[_0x10f8c0][_0x2f7a90]][_0xd7fe('0x75')](/"/g,'\x27'));if(_0xb4d15=='')_0xb4d15=_0x2ed839;else _0xb4d15+='|'+_0x2ed839;}_0x266700[_0xd7fe('0x1f')](_0x4d22df['id']+':'+_0xb4d15);}}if(hasAdditionalPhones){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x266700['join'](';')+'\x22');}if(_0x46deb2[_0xd7fe('0x1c')]){handleError(_0x7a555b['data'][_0x2347e5],{'code':_0xd7fe('0x82'),'message':_0x46deb2['join']()});}else{fs[_0xd7fe('0x83')](_0x2285e5,_0x117edd[_0xd7fe('0x17')]()+'\x0a');}_0x117edd=[];}if(!(stats['rows']%0xc8)){socket[_0xd7fe('0x84')]('contact:import:'+_0x4c3df7,stats);stats['errors']=[];}}if(stopped){logger[_0xd7fe('0x5f')](_0xd7fe('0x85'));_0x1f01c0[_0xd7fe('0x86')]();}}catch(_0x14a01c){handleError(_0x7a555b[_0xd7fe('0x70')][_0x2347e5],{'code':_0xd7fe('0x87'),'message':_0x14a01c[_0xd7fe('0x60')]});logger['error']('step',_0x14a01c[_0xd7fe('0x60')]);}},'complete':function(){try{var _0x53d6d7=[];var _0x19c000=tempTableName;_0x53d6d7[_0xd7fe('0x1f')](_0xd7fe('0x88')+_0x19c000+'\x20LIKE\x20cm_contacts;');logger[_0xd7fe('0x5f')](_0xd7fe('0x89'),contactItemTypes[_0xd7fe('0x1c')]);var _0xfd1c7e=util[_0xd7fe('0xd')](_0xd7fe('0x8a'),_0x2285e5,_0x19c000,_0x246f01,_0x26ba4f[_0xd7fe('0x3c')],_0x26ba4f[_0xd7fe('0x8b')]||null,NOW,NOW);if(_[_0xd7fe('0x1d')](_0x49b085[_0xd7fe('0x3a')])){_0xfd1c7e+=_0xd7fe('0x8c');}_0x53d6d7[_0xd7fe('0x1f')](_0xfd1c7e);BPromise[_0xd7fe('0x8d')](_0x53d6d7,handleQuery)[_0xd7fe('0x21')](function(_0x35b375){BPromise[_0xd7fe('0x20')]([handleAdditionalPhones()])[_0xd7fe('0x21')](function(){_0x53d6d7=[];for(var _0x45f7b1=0x0;_0x45f7b1\x20\x20');}var _0x1606ad=path[_0xd7fe('0x17')](config[_0xd7fe('0x68')],_0xd7fe('0x97'),process[_0xd7fe('0x96')][0x2]);if(!fs[_0xd7fe('0x98')](_0x1606ad)){throw new Error(_0xd7fe('0x99'));}var _0x1c4415={};try{_0x1c4415=JSON['parse'](process['argv'][0x3]);if(!_0x1c4415[_0xd7fe('0x65')]){throw new Error(_0xd7fe('0x9a'));}var _0x304c5c=0x0;if(_0x1c4415['binding']['UserId']){_0x304c5c=0x1;}if(!_0x1c4415[_0xd7fe('0x3c')]){throw new Error(_0xd7fe('0x9b'));}}catch(_0x126ca0){throw new Error('body\x20id\x20mandatory');}var _0x501c37=[];try{_0x501c37=_[_0xd7fe('0x9c')](JSON['parse'](process[_0xd7fe('0x96')][0x4]),'id');}catch(_0x5a19f0){logger[_0xd7fe('0x5f')]('No\x20agent\x20available');}main(_0x1606ad,_0x1c4415,_0x501c37,_0x304c5c);}validate();process['on'](_0xd7fe('0x9d'),handleStop);process['on'](_0xd7fe('0x9e'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 3b01d0b..4d18098 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['destexten','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Called\x20Number','membername','starttime','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Call\x20To'];(function(_0x1b9cd5,_0x18edc7){var _0x3cf5c2=function(_0x226d85){while(--_0x226d85){_0x1b9cd5['push'](_0x1b9cd5['shift']());}};_0x3cf5c2(++_0x18edc7);}(_0xb688,0xcf));var _0x8b68=function(_0x21c19f,_0x17f66a){_0x21c19f=_0x21c19f-0x0;var _0x4d6dad=_0xb688[_0x21c19f];return _0x4d6dad;};'use strict';exports['getSubjects']=function(_0x39c8c5,_0x196cec){var _0x266285=[{'type':_0x8b68('0x0'),'content':_0x8b68('0x1'),'variableName':null}];switch(_0x39c8c5[_0x8b68('0x2')]()){case'voice':switch(_0x196cec[_0x8b68('0x2')]()){case _0x8b68('0x3'):_0x266285[_0x8b68('0x4')]({'type':_0x8b68('0x5'),'content':'','variableName':'queue'});_0x266285[_0x8b68('0x4')]({'type':'variable','content':'','variableName':_0x8b68('0x6')});break;case _0x8b68('0x7'):_0x266285[_0x8b68('0x4')]({'type':_0x8b68('0x0'),'content':_0x8b68('0x8'),'variableName':null});_0x266285[_0x8b68('0x4')]({'type':_0x8b68('0x5'),'content':'','variableName':_0x8b68('0x9')});break;}}return _0x266285;};exports[_0x8b68('0xa')]=function(_0x2f2e3c,_0x418775){var _0x317d01=[];switch(_0x2f2e3c[_0x8b68('0x2')]()){case'voice':switch(_0x418775[_0x8b68('0x2')]()){case _0x8b68('0x3'):_0x317d01=[{'type':_0x8b68('0x0'),'content':_0x8b68('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0xd'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x6')},{'type':_0x8b68('0xc'),'content':'','key':'Caller\x20Name','keyType':_0x8b68('0x5'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0x8b68('0xe'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0xf')},{'type':'keyValue','content':'','key':'Queue','keyType':_0x8b68('0x5'),'variableName':'queue'},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x10'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x11')},{'type':'keyValue','content':'','key':_0x8b68('0x12'),'keyType':_0x8b68('0x5'),'variableName':'agentcalledAt'},{'type':_0x8b68('0x0'),'content':_0x8b68('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x14'),'keyType':_0x8b68('0x5'),'variableName':'destcalleridname'},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x15'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x9')},{'type':_0x8b68('0x0'),'content':_0x8b68('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x8b68('0x5'),'variableName':'agentcalledAt'},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x17'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x18')},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x19'),'keyType':'variable','variableName':_0x8b68('0x1a')},{'type':_0x8b68('0xc'),'content':'','key':'Hold\x20Time','keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x1b')},{'type':_0x8b68('0xc'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':'talktime'}];break;case _0x8b68('0x7'):_0x317d01=[{'type':_0x8b68('0x0'),'content':_0x8b68('0xb'),'variableName':null},{'type':'keyValue','content':'','key':_0x8b68('0x1c'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0x8b68('0xc'),'content':'','key':'Member\x20Name','keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x1d')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x11')},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x12'),'keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x1e')},{'type':_0x8b68('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x8b68('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x1f')},{'type':'keyValue','content':'','key':_0x8b68('0x20'),'keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x21')},{'type':'keyValue','content':'','key':'Duration','keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x22')},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x23'),'keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x24')}];break;}}return _0x317d01;}; \ No newline at end of file +var _0x3423=['uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','talktime','membername','UniqueId','starttime','Answer\x20Time','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','getDescriptions','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten'];(function(_0x46bf3d,_0x1466f3){var _0x4c124f=function(_0x310985){while(--_0x310985){_0x46bf3d['push'](_0x46bf3d['shift']());}};_0x4c124f(++_0x1466f3);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';exports['getSubjects']=function(_0x4a04c7,_0x381e58){var _0x16bdb3=[{'type':_0x3342('0x0'),'content':_0x3342('0x1'),'variableName':null}];switch(_0x4a04c7[_0x3342('0x2')]()){case _0x3342('0x3'):switch(_0x381e58[_0x3342('0x2')]()){case _0x3342('0x4'):_0x16bdb3[_0x3342('0x5')]({'type':_0x3342('0x6'),'content':'','variableName':_0x3342('0x7')});_0x16bdb3[_0x3342('0x5')]({'type':_0x3342('0x6'),'content':'','variableName':_0x3342('0x8')});break;case _0x3342('0x9'):_0x16bdb3[_0x3342('0x5')]({'type':_0x3342('0x0'),'content':_0x3342('0xa'),'variableName':null});_0x16bdb3[_0x3342('0x5')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x16bdb3;};exports[_0x3342('0xb')]=function(_0x481a17,_0x5a1fba){var _0x51b276=[];switch(_0x481a17['toLowerCase']()){case _0x3342('0x3'):switch(_0x5a1fba[_0x3342('0x2')]()){case'inbound':_0x51b276=[{'type':_0x3342('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0xd'),'keyType':'variable','variableName':_0x3342('0x8')},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0xe'),'keyType':_0x3342('0x6'),'variableName':_0x3342('0xf')},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0x10'),'keyType':'variable','variableName':_0x3342('0x11')},{'type':_0x3342('0xc'),'content':'','key':'Queue','keyType':_0x3342('0x6'),'variableName':_0x3342('0x7')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x3342('0x6'),'variableName':_0x3342('0x12')},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0x13'),'keyType':_0x3342('0x6'),'variableName':_0x3342('0x14')},{'type':_0x3342('0x0'),'content':_0x3342('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x3342('0xc'),'content':'','key':'Agent\x20Name','keyType':_0x3342('0x6'),'variableName':_0x3342('0x16')},{'type':_0x3342('0xc'),'content':'','key':'Agent\x20Number','keyType':_0x3342('0x6'),'variableName':_0x3342('0x17')},{'type':'string','content':_0x3342('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x3342('0xc'),'content':'','key':'Agent\x20Ring','keyType':_0x3342('0x6'),'variableName':'agentcalledAt'},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0x19'),'keyType':_0x3342('0x6'),'variableName':_0x3342('0x1a')},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0x1b'),'keyType':_0x3342('0x6'),'variableName':_0x3342('0x1c')},{'type':'keyValue','content':'','key':_0x3342('0x1d'),'keyType':'variable','variableName':'holdtime'},{'type':_0x3342('0xc'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x3342('0x1e')}];break;case'outbound':_0x51b276=[{'type':_0x3342('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0x3342('0x6'),'keyContent':'','variableName':_0x3342('0x17')},{'type':_0x3342('0xc'),'content':'','key':'Member\x20Name','keyType':_0x3342('0x6'),'keyContent':'','variableName':_0x3342('0x1f')},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0x20'),'keyType':'variable','keyContent':'','variableName':_0x3342('0x12')},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0x13'),'keyType':_0x3342('0x6'),'keyContent':'','variableName':_0x3342('0x21')},{'type':_0x3342('0x0'),'content':_0x3342('0x18')},{'type':'keyValue','content':'','key':_0x3342('0x22'),'keyType':'variable','keyContent':'','variableName':_0x3342('0x23')},{'type':_0x3342('0xc'),'content':'','key':'Complete\x20Time','keyType':_0x3342('0x6'),'keyContent':'','variableName':_0x3342('0x24')},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0x25'),'keyType':'variable','keyContent':'','variableName':_0x3342('0x26')},{'type':_0x3342('0xc'),'content':'','key':_0x3342('0x27'),'keyType':_0x3342('0x6'),'keyContent':'','variableName':_0x3342('0x28')}];break;}}return _0x51b276;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index b97b939..e2f7186 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5b2=['../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','findOne','update','info','error','tracked','user','query','clone','body','omit','html','fax','mobile'];(function(_0x2ed7c4,_0x2b7bec){var _0x2a8c67=function(_0x1bd027){while(--_0x1bd027){_0x2ed7c4['push'](_0x2ed7c4['shift']());}};_0x2a8c67(++_0x2b7bec);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xd5b2[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var db=require(_0x2d5b('0x0'))['db'];var loggers={'openchannel':require(_0x2d5b('0x1'))('openchannel-interactions'),'mail':require(_0x2d5b('0x1'))(_0x2d5b('0x2')),'fax':require(_0x2d5b('0x1'))(_0x2d5b('0x3')),'sms':require(_0x2d5b('0x1'))(_0x2d5b('0x4')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require('../../config/logger')(_0x2d5b('0x5'))};function getInteractionId(_0x5e2a74,_0x394645,_0x4c7873){if(_0x5e2a74&&_0x5e2a74[_[_0x2d5b('0x6')](_0x4c7873)+'InteractionId']){return _0x5e2a74[_[_0x2d5b('0x6')](_0x4c7873)+_0x2d5b('0x7')];}else if(_0x5e2a74&&_0x5e2a74['id']){return _0x5e2a74['id'];}else if(_0x394645&&_0x394645['id']){return _0x394645['id'];}else{return _0x2d5b('0x8');}}function log(_0x253455,_0x15fdce,_0x4c65b7,_0x2c0edd,_0xa902be,_0x3e9d7a){loggers[_0xa902be[_0x2d5b('0x9')]()][_0x253455](_0x2d5b('0xa'),_0x3e9d7a[_0x2d5b('0xb')](),_0x15fdce?_0x15fdce['id']:null,_0x15fdce?_0x15fdce[_0x2d5b('0xc')]:null,_0x15fdce?_0x15fdce[_0x2d5b('0xd')]:null,getInteractionId(_0x4c65b7,_0x2c0edd,_0xa902be),_0x4c65b7?JSON['stringify'](_0x4c65b7):'null');}function updateUser(_0x327b75,_0x3dee67,_0x38a7c1,_0x21c6e2,_0x40ec2c){db[_[_0x2d5b('0x6')](_0x21c6e2)+'Interaction'][_0x2d5b('0xe')]({'where':{'id':getInteractionId(_0x3dee67,_0x38a7c1,_0x21c6e2)}})['then'](function(_0x1a5624){if(_0x1a5624){return _0x1a5624[_0x2d5b('0xf')]({'UserId':_0x327b75?_0x327b75['id']:null});}})['then'](function(_0x1c5ee6){if(_0x1c5ee6){log(_0x2d5b('0x10'),_0x327b75,_0x3dee67,_0x38a7c1,_0x21c6e2,_0x40ec2c);}})['catch'](function(){log(_0x2d5b('0x11'),_0x327b75,_0x3dee67,_0x38a7c1,_0x21c6e2,_0x40ec2c);});}exports[_0x2d5b('0x12')]=function(_0x4cecb5,_0x41d23f){return function(_0x2d4715,_0x4aa2d5,_0x8c32cc){var _0x292b8a=_0x2d4715[_0x2d5b('0x13')];var _0x3298ab={};var _0x4f81db=_0x2d4715[_0x2d5b('0x14')];if(_0x3298ab){_0x3298ab=_[_0x2d5b('0x15')](_0x2d4715[_0x2d5b('0x16')]);_0x3298ab=_[_0x2d5b('0x17')](_0x3298ab,['body',_0x2d5b('0x18'),'phone',_0x2d5b('0x19'),_0x2d5b('0x1a')]);}updateUser(_0x292b8a,_0x3298ab,_0x4f81db,_0x4cecb5,_0x41d23f);_0x8c32cc(null);};}; \ No newline at end of file +var _0xaeef=['body','omit','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','name','role','stringify','Interaction','findOne','then','update','catch','tracked','clone'];(function(_0x3d6125,_0x37c52c){var _0x30ca78=function(_0x5e68e5){while(--_0x5e68e5){_0x3d6125['push'](_0x3d6125['shift']());}};_0x30ca78(++_0x37c52c);}(_0xaeef,0x14a));var _0xfaee=function(_0x108dc2,_0x3e2c1b){_0x108dc2=_0x108dc2-0x0;var _0x3cbab6=_0xaeef[_0x108dc2];return _0x3cbab6;};'use strict';var _=require(_0xfaee('0x0'));var db=require(_0xfaee('0x1'))['db'];var loggers={'openchannel':require(_0xfaee('0x2'))('openchannel-interactions'),'mail':require(_0xfaee('0x2'))(_0xfaee('0x3')),'fax':require(_0xfaee('0x2'))(_0xfaee('0x4')),'sms':require(_0xfaee('0x2'))('sms-interactions'),'chat':require(_0xfaee('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xfaee('0x5'))};function getInteractionId(_0x4c28b1,_0x58db36,_0x310339){if(_0x4c28b1&&_0x4c28b1[_[_0xfaee('0x6')](_0x310339)+_0xfaee('0x7')]){return _0x4c28b1[_['upperFirst'](_0x310339)+'InteractionId'];}else if(_0x4c28b1&&_0x4c28b1['id']){return _0x4c28b1['id'];}else if(_0x58db36&&_0x58db36['id']){return _0x58db36['id'];}else{return _0xfaee('0x8');}}function log(_0x3a5f72,_0x5551c1,_0x3bd9ab,_0x3ee42d,_0x342392,_0x2487df){loggers[_0x342392[_0xfaee('0x9')]()][_0x3a5f72]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2487df['toUpperCase'](),_0x5551c1?_0x5551c1['id']:null,_0x5551c1?_0x5551c1[_0xfaee('0xa')]:null,_0x5551c1?_0x5551c1[_0xfaee('0xb')]:null,getInteractionId(_0x3bd9ab,_0x3ee42d,_0x342392),_0x3bd9ab?JSON[_0xfaee('0xc')](_0x3bd9ab):'null');}function updateUser(_0x4db935,_0x2b7915,_0x33d374,_0x298db5,_0x278a53){db[_[_0xfaee('0x6')](_0x298db5)+_0xfaee('0xd')][_0xfaee('0xe')]({'where':{'id':getInteractionId(_0x2b7915,_0x33d374,_0x298db5)}})[_0xfaee('0xf')](function(_0x5f0280){if(_0x5f0280){return _0x5f0280[_0xfaee('0x10')]({'UserId':_0x4db935?_0x4db935['id']:null});}})[_0xfaee('0xf')](function(_0x154bb2){if(_0x154bb2){log('info',_0x4db935,_0x2b7915,_0x33d374,_0x298db5,_0x278a53);}})[_0xfaee('0x11')](function(){log('error',_0x4db935,_0x2b7915,_0x33d374,_0x298db5,_0x278a53);});}exports[_0xfaee('0x12')]=function(_0x145e12,_0x52de36){return function(_0x143447,_0x306298,_0x4aa140){var _0x24e9ed=_0x143447['user'];var _0x4ed47c={};var _0xd976a=_0x143447['query'];if(_0x4ed47c){_0x4ed47c=_[_0xfaee('0x13')](_0x143447[_0xfaee('0x14')]);_0x4ed47c=_[_0xfaee('0x15')](_0x4ed47c,[_0xfaee('0x14'),'html',_0xfaee('0x16'),_0xfaee('0x17'),_0xfaee('0x18')]);}updateUser(_0x24e9ed,_0x4ed47c,_0xd976a,_0x145e12,_0x52de36);_0x4aa140(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 11f4215..fc9f51a 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb12=['User','admin','user','isUserLimit','crypto','util','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','update','base64','utf8','use','License','findOne','then','count','status','json','users'];(function(_0x4a8812,_0x430080){var _0x55a784=function(_0x4b25cf){while(--_0x4b25cf){_0x4a8812['push'](_0x4a8812['shift']());}};_0x55a784(++_0x430080);}(_0xcb12,0xf4));var _0x2cb1=function(_0x1a90d9,_0x54cd18){_0x1a90d9=_0x1a90d9-0x0;var _0x55a17d=_0xcb12[_0x1a90d9];return _0x55a17d;};'use strict';var crypto=require(_0x2cb1('0x0'));var util=require(_0x2cb1('0x1'));var compose=require('composable-middleware');var db=require(_0x2cb1('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x403379,_0x1ee080){if(_0x403379&&_0x1ee080){if(_0x1ee080[_0x2cb1('0x3')]&&_0x1ee080['license']){var _0x4a2777=_0x1ee080[_0x2cb1('0x3')];var _0x4b437b=_0x1ee080[_0x2cb1('0x4')];var _0x407292=_0x4a2777['split']('-')[0x4];var _0x234deb=_0x4a2777[_0x2cb1('0x5')]('-')[0x0];var _0x36b988=crypto[_0x2cb1('0x6')](_0x2cb1('0x7'),util[_0x2cb1('0x8')]('%s:%s:%s',_0x407292,_0x4a2777,_0x234deb));var _0x2ef81e=_0x36b988[_0x2cb1('0x9')](_0x4b437b,_0x2cb1('0xa'),_0x2cb1('0xb'));_0x2ef81e+=_0x36b988['final'](_0x2cb1('0xb'));var _0x438019=JSON['parse'](_0x2ef81e);return _0x438019['hasOwnProperty'](_0x403379)?_0x438019[_0x403379]:null;}}return null;}function isLimit(_0x24294c,_0x2a45cb,_0x30b0a4,_0x4df0db){var _0x5daf22=_0x2a45cb;return compose()[_0x2cb1('0xc')](function(_0x3219e7,_0x1fc485,_0x35a620){return db[_0x2cb1('0xd')][_0x2cb1('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x2cb1('0xf')](function(_0x1bef04){var _0x3340d2=getValueFromLicense(_0x24294c,_0x1bef04);return _0x3340d2?_0x3340d2:_0x5daf22;})[_0x2cb1('0xf')](function(_0x3bf21d){_0x5daf22=_0x3bf21d;return _0x30b0a4[_0x2cb1('0x10')](_0x4df0db);})[_0x2cb1('0xf')](function(_0x36d0f3){if(_0x36d0f3>=_0x5daf22){return _0x1fc485[_0x2cb1('0x11')](0x193)[_0x2cb1('0x12')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x24294c)});}_0x35a620();})['catch'](function(_0x4de19a){_0x35a620(_0x4de19a);});});}function isUserLimit(){return isLimit(_0x2cb1('0x13'),0x1,db[_0x2cb1('0x14')],{'where':{'$or':[{'role':_0x2cb1('0x15')},{'role':_0x2cb1('0x16')}]}});}exports[_0x2cb1('0x17')]=isUserLimit; \ No newline at end of file +var _0xe175=['parse','License','findOne','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','data1','license','split','createDecipher','aes-256-ctr','update','base64','utf8','final'];(function(_0x2798be,_0x528dff){var _0x13c704=function(_0x42fc2a){while(--_0x42fc2a){_0x2798be['push'](_0x2798be['shift']());}};_0x13c704(++_0x528dff);}(_0xe175,0x194));var _0x5e17=function(_0x3ca2cf,_0x3e1e26){_0x3ca2cf=_0x3ca2cf-0x0;var _0x48c2a2=_0xe175[_0x3ca2cf];return _0x48c2a2;};'use strict';var crypto=require(_0x5e17('0x0'));var util=require(_0x5e17('0x1'));var compose=require(_0x5e17('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x26d66a,_0x1d07cb){if(_0x26d66a&&_0x1d07cb){if(_0x1d07cb[_0x5e17('0x3')]&&_0x1d07cb[_0x5e17('0x4')]){var _0x21cd8a=_0x1d07cb['data1'];var _0x1fa2f3=_0x1d07cb[_0x5e17('0x4')];var _0x4b9a98=_0x21cd8a[_0x5e17('0x5')]('-')[0x4];var _0x4bb0e3=_0x21cd8a[_0x5e17('0x5')]('-')[0x0];var _0x5c6f43=crypto[_0x5e17('0x6')](_0x5e17('0x7'),util['format']('%s:%s:%s',_0x4b9a98,_0x21cd8a,_0x4bb0e3));var _0x385f67=_0x5c6f43[_0x5e17('0x8')](_0x1fa2f3,_0x5e17('0x9'),_0x5e17('0xa'));_0x385f67+=_0x5c6f43[_0x5e17('0xb')]('utf8');var _0x2e72e7=JSON[_0x5e17('0xc')](_0x385f67);return _0x2e72e7['hasOwnProperty'](_0x26d66a)?_0x2e72e7[_0x26d66a]:null;}}return null;}function isLimit(_0x83df27,_0x1a19c9,_0x3983da,_0x4ce421){var _0x39469d=_0x1a19c9;return compose()['use'](function(_0x180315,_0x413237,_0x314659){return db[_0x5e17('0xd')][_0x5e17('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x325536){var _0xca6e2e=getValueFromLicense(_0x83df27,_0x325536);return _0xca6e2e?_0xca6e2e:_0x39469d;})[_0x5e17('0xf')](function(_0x39a07c){_0x39469d=_0x39a07c;return _0x3983da[_0x5e17('0x10')](_0x4ce421);})[_0x5e17('0xf')](function(_0x44d48f){if(_0x44d48f>=_0x39469d){return _0x413237['status'](0x193)[_0x5e17('0x11')]({'message':util[_0x5e17('0x12')](_0x5e17('0x13'),_0x83df27)});}_0x314659();})[_0x5e17('0x14')](function(_0x19d4f5){_0x314659(_0x19d4f5);});});}function isUserLimit(){return isLimit(_0x5e17('0x15'),0x1,db[_0x5e17('0x16')],{'where':{'$or':[{'role':_0x5e17('0x17')},{'role':_0x5e17('0x18')}]}});}exports[_0x5e17('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 14590f1..69773bd 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 _0xfa7d=['[$or]','and','replace','split','forEach','shift','match','indexOf','map','conditions','buildExpression','DATE','$eq','operator','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','\x20AS\x20','text','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator'];(function(_0x29ac5d,_0x3df3e0){var _0xef6f60=function(_0x4cdf74){while(--_0x4cdf74){_0x29ac5d['push'](_0x29ac5d['shift']());}};_0xef6f60(++_0x3df3e0);}(_0xfa7d,0x146));var _0xdfa7=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xfa7d[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xdfa7('0x0'));var moment=require(_0xdfa7('0x1'));exports[_0xdfa7('0x2')]=function(_0x1c7c3f){var _0x52f9ae={'conditions':[]};_0x52f9ae[_0xdfa7('0x3')]=_['startsWith'](_0x1c7c3f,_0xdfa7('0x4'))?'or':_0xdfa7('0x5');var _0x250bc1=_0x1c7c3f[_0xdfa7('0x6')]('[$and]','')[_0xdfa7('0x6')](_0xdfa7('0x4'),'')[_0xdfa7('0x7')]('||');for(var _0x51df9f=0x0;_0x51df9f<_0x250bc1['length'];_0x51df9f++){var _0x4ccdbb=_0x250bc1[_0x51df9f]['split'](':=');var _0x3afce7=_0x4ccdbb[0x0];var _0x40e4ce=_0x4ccdbb['slice'](0x1);_0x40e4ce[_0xdfa7('0x8')](function(_0x3cf5b0){var _0x4bb050=_0x3cf5b0[_0xdfa7('0x7')]('[')[_0xdfa7('0x9')]();var _0x5241ba=_0x3cf5b0[_0xdfa7('0xa')](/\[(.*?)\]/g);_0x5241ba[_0xdfa7('0x8')](function(_0x1e631d){var _0x1c5914=_0x1e631d[_0xdfa7('0x7')]('[')['filter'](function(_0x307618){return _0x307618[_0xdfa7('0xb')](']')>-0x1;})[_0xdfa7('0xc')](function(_0x29a77b){return _0x29a77b[_0xdfa7('0x7')](']')[0x0];})[0x0];_0x52f9ae[_0xdfa7('0xd')]['push']({'field':_0x3afce7,'operator':_0x4bb050,'value':_0x1c5914});});});}return _0x52f9ae;};exports[_0xdfa7('0xe')]=function(_0x2dc8eb,_0x52d8ff,_0x42a169){var _0x3f0c40={};if(_0x52d8ff===_0xdfa7('0xf')){if(_0x42a169['operator']===_0xdfa7('0x10')){_0x42a169[_0xdfa7('0x11')]=_0xdfa7('0x12');_0x42a169[_0xdfa7('0x13')]+=','+_0x42a169[_0xdfa7('0x13')];}else if(_[_0xdfa7('0x14')](['$gt',_0xdfa7('0x15')],_0x42a169[_0xdfa7('0x11')])){_0x42a169['value']=moment(_0x42a169[_0xdfa7('0x13')])[_0xdfa7('0x16')](0x1,_0xdfa7('0x17'))[_0xdfa7('0x18')](_0xdfa7('0x19'));}}if(_0x42a169[_0xdfa7('0x1a')]){_0x52d8ff=_0x42a169[_0xdfa7('0x1a')];_0x3f0c40['text']='CAST('+_0x2dc8eb+'.'+_0x42a169['field']+_0xdfa7('0x1b')+_0x42a169[_0xdfa7('0x1a')]+')\x20'+parseOperator(_0x42a169[_0xdfa7('0x11')]);}else{_0x3f0c40[_0xdfa7('0x1c')]=_0x2dc8eb+'.'+_0x42a169[_0xdfa7('0x1d')]+'\x20'+parseOperator(_0x42a169[_0xdfa7('0x11')]);}if(_[_0xdfa7('0x14')]([_0xdfa7('0x1e'),_0xdfa7('0x1f')],_0x42a169[_0xdfa7('0x11')]))_0x3f0c40[_0xdfa7('0x1c')]='('+_0x3f0c40['text']+_0xdfa7('0x20')+_0x2dc8eb+'.'+_0x42a169[_0xdfa7('0x1d')]+_0xdfa7('0x21');_0x3f0c40[_0xdfa7('0x13')]=parseValue(_0x52d8ff,_0x42a169[_0xdfa7('0x11')],_0x42a169[_0xdfa7('0x13')]);return _0x3f0c40;};function parseOperator(_0x4418f4){var _0x3923de;switch(_0x4418f4){case _0xdfa7('0x22'):_0x3923de=_0xdfa7('0x23');break;case _0xdfa7('0x1f'):_0x3923de=_0xdfa7('0x24');break;case'$eq':_0x3923de=_0xdfa7('0x25');break;case'$ne':_0x3923de='<>\x20?';break;case _0xdfa7('0x26'):case _0xdfa7('0x27'):case _0xdfa7('0x28'):_0x3923de=_0xdfa7('0x29');break;case _0xdfa7('0x2a'):_0x3923de=_0xdfa7('0x2b');break;case _0xdfa7('0x2c'):_0x3923de=_0xdfa7('0x2d');break;case _0xdfa7('0x15'):_0x3923de=_0xdfa7('0x2e');break;case _0xdfa7('0x2f'):_0x3923de=_0xdfa7('0x30');break;case _0xdfa7('0x12'):_0x3923de=_0xdfa7('0x31');break;}return _0x3923de;}function parseValue(_0x1a4eb4,_0x256184,_0x17d713){var _0x251ceb={'start':undefined,'end':undefined};switch(_0x256184){case _0xdfa7('0x22'):case _0xdfa7('0x1f'):_0x251ceb['start']=_0x17d713['split'](',');break;case _0xdfa7('0x26'):_0x251ceb[_0xdfa7('0x32')]='%'+_0x17d713+'%';break;case _0xdfa7('0x27'):_0x251ceb[_0xdfa7('0x32')]=_0x17d713+'%';break;case _0xdfa7('0x28'):_0x251ceb[_0xdfa7('0x32')]='%'+_0x17d713;break;case _0xdfa7('0x12'):var _0x213baa=_0x17d713[_0xdfa7('0x7')](',');var _0x17d713=_0x213baa[_0xdfa7('0x9')]();var _0x563433=_0x213baa['pop']();if(_0x1a4eb4===_0xdfa7('0xf')){_0x17d713=moment(_0x17d713)['utcOffset'](0x0,!![])[_0xdfa7('0x18')]();_0x563433=moment(_0x563433)[_0xdfa7('0x33')](0x0,!![])[_0xdfa7('0x16')](0x17,_0xdfa7('0x34'))[_0xdfa7('0x16')](0x3b,_0xdfa7('0x35'))[_0xdfa7('0x16')](0x3b,_0xdfa7('0x36'))[_0xdfa7('0x18')]();}_0x251ceb={'start':_0x17d713,'end':_0x563433};break;default:_0x251ceb[_0xdfa7('0x32')]=_0x17d713;break;}return _0x251ceb;} \ No newline at end of file +var _0xeb1b=['$startsWith','shift','pop','utcOffset','hours','minutes','seconds','format','lodash','moment','startsWith','[$or]','and','replace','split','slice','forEach','match','filter','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','castTo','CAST(','\x20AS\x20','text','field','$ne','$notIn','$in','IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$substring','start'];(function(_0x38d9c2,_0x10fe14){var _0x5bf078=function(_0x585102){while(--_0x585102){_0x38d9c2['push'](_0x38d9c2['shift']());}};_0x5bf078(++_0x10fe14);}(_0xeb1b,0x6c));var _0xbeb1=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeb1b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xbeb1('0x0'));var moment=require(_0xbeb1('0x1'));exports['parseSearch']=function(_0x52f83b){var _0x2f4a92={'conditions':[]};_0x2f4a92['sqlOperator']=_[_0xbeb1('0x2')](_0x52f83b,_0xbeb1('0x3'))?'or':_0xbeb1('0x4');var _0x118397=_0x52f83b[_0xbeb1('0x5')]('[$and]','')[_0xbeb1('0x5')](_0xbeb1('0x3'),'')[_0xbeb1('0x6')]('||');for(var _0x454f14=0x0;_0x454f14<_0x118397['length'];_0x454f14++){var _0x444442=_0x118397[_0x454f14][_0xbeb1('0x6')](':=');var _0x2b7976=_0x444442[0x0];var _0x538732=_0x444442[_0xbeb1('0x7')](0x1);_0x538732[_0xbeb1('0x8')](function(_0x58e3b5){var _0x258b83=_0x58e3b5[_0xbeb1('0x6')]('[')['shift']();var _0x2f86c9=_0x58e3b5[_0xbeb1('0x9')](/\[(.*?)\]/g);_0x2f86c9[_0xbeb1('0x8')](function(_0x2d5af3){var _0x34f773=_0x2d5af3['split']('[')[_0xbeb1('0xa')](function(_0x5de01d){return _0x5de01d['indexOf'](']')>-0x1;})['map'](function(_0x5bafaf){return _0x5bafaf[_0xbeb1('0x6')](']')[0x0];})[0x0];_0x2f4a92[_0xbeb1('0xb')][_0xbeb1('0xc')]({'field':_0x2b7976,'operator':_0x258b83,'value':_0x34f773});});});}return _0x2f4a92;};exports[_0xbeb1('0xd')]=function(_0x33b4ab,_0x24ab94,_0x460167){var _0x4c9ba3={};if(_0x24ab94===_0xbeb1('0xe')){if(_0x460167[_0xbeb1('0xf')]===_0xbeb1('0x10')){_0x460167[_0xbeb1('0xf')]=_0xbeb1('0x11');_0x460167[_0xbeb1('0x12')]+=','+_0x460167[_0xbeb1('0x12')];}else if(_[_0xbeb1('0x13')]([_0xbeb1('0x14'),_0xbeb1('0x15')],_0x460167[_0xbeb1('0xf')])){_0x460167[_0xbeb1('0x12')]=moment(_0x460167[_0xbeb1('0x12')])[_0xbeb1('0x16')](0x1,'days')['format']('YYYY-MM-DD');}}if(_0x460167[_0xbeb1('0x17')]){_0x24ab94=_0x460167[_0xbeb1('0x17')];_0x4c9ba3['text']=_0xbeb1('0x18')+_0x33b4ab+'.'+_0x460167['field']+_0xbeb1('0x19')+_0x460167['castTo']+')\x20'+parseOperator(_0x460167[_0xbeb1('0xf')]);}else{_0x4c9ba3[_0xbeb1('0x1a')]=_0x33b4ab+'.'+_0x460167[_0xbeb1('0x1b')]+'\x20'+parseOperator(_0x460167['operator']);}if(_[_0xbeb1('0x13')]([_0xbeb1('0x1c'),_0xbeb1('0x1d')],_0x460167['operator']))_0x4c9ba3['text']='('+_0x4c9ba3['text']+'\x20OR\x20'+_0x33b4ab+'.'+_0x460167[_0xbeb1('0x1b')]+'\x20IS\x20NULL)';_0x4c9ba3[_0xbeb1('0x12')]=parseValue(_0x24ab94,_0x460167[_0xbeb1('0xf')],_0x460167['value']);return _0x4c9ba3;};function parseOperator(_0x50e01d){var _0x1fdb63;switch(_0x50e01d){case _0xbeb1('0x1e'):_0x1fdb63=_0xbeb1('0x1f');break;case _0xbeb1('0x1d'):_0x1fdb63='NOT\x20IN\x20?';break;case _0xbeb1('0x10'):_0x1fdb63=_0xbeb1('0x20');break;case'$ne':_0x1fdb63=_0xbeb1('0x21');break;case'$substring':case'$startsWith':case _0xbeb1('0x22'):_0x1fdb63=_0xbeb1('0x23');break;case'$lt':_0x1fdb63='<\x20?';break;case _0xbeb1('0x14'):_0x1fdb63=_0xbeb1('0x24');break;case _0xbeb1('0x15'):_0x1fdb63=_0xbeb1('0x25');break;case'$gte':_0x1fdb63=_0xbeb1('0x26');break;case _0xbeb1('0x11'):_0x1fdb63=_0xbeb1('0x27');break;}return _0x1fdb63;}function parseValue(_0xafa8c1,_0x54233c,_0x14dddb){var _0x21f98c={'start':undefined,'end':undefined};switch(_0x54233c){case _0xbeb1('0x1e'):case _0xbeb1('0x1d'):_0x21f98c['start']=_0x14dddb['split'](',');break;case _0xbeb1('0x28'):_0x21f98c[_0xbeb1('0x29')]='%'+_0x14dddb+'%';break;case _0xbeb1('0x2a'):_0x21f98c[_0xbeb1('0x29')]=_0x14dddb+'%';break;case _0xbeb1('0x22'):_0x21f98c[_0xbeb1('0x29')]='%'+_0x14dddb;break;case _0xbeb1('0x11'):var _0x85e9c1=_0x14dddb[_0xbeb1('0x6')](',');var _0x14dddb=_0x85e9c1[_0xbeb1('0x2b')]();var _0x1731d7=_0x85e9c1[_0xbeb1('0x2c')]();if(_0xafa8c1===_0xbeb1('0xe')){_0x14dddb=moment(_0x14dddb)[_0xbeb1('0x2d')](0x0,!![])['format']();_0x1731d7=moment(_0x1731d7)[_0xbeb1('0x2d')](0x0,!![])['add'](0x17,_0xbeb1('0x2e'))['add'](0x3b,_0xbeb1('0x2f'))[_0xbeb1('0x16')](0x3b,_0xbeb1('0x30'))[_0xbeb1('0x31')]();}_0x21f98c={'start':_0x14dddb,'end':_0x1731d7};break;default:_0x21f98c[_0xbeb1('0x29')]=_0x14dddb;break;}return _0x21f98c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 8c03d7d..afdc6d1 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 _0xedd8=['find','type','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','unset','match','^[0-9]*$','isEmail','push','toString','lodash','sequelize','moment','fields','split','isEmpty','forOwn'];(function(_0x338e66,_0x35c501){var _0x292c1e=function(_0x169f76){while(--_0x169f76){_0x338e66['push'](_0x338e66['shift']());}};_0x292c1e(++_0x35c501);}(_0xedd8,0xb2));var _0x8edd=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0xedd8[_0x55d911];return _0x3104c2;};'use strict';var _=require(_0x8edd('0x0'));var sequelize=require(_0x8edd('0x1'));var moment=require(_0x8edd('0x2'));var LIMIT_VALUE=0xfa;exports[_0x8edd('0x3')]=function(_0x1fdaf0){var _0x54a8bc=null;if(_0x1fdaf0){_0x54a8bc=_0x1fdaf0[_0x8edd('0x4')](',');}return _0x54a8bc;};exports['filters']=function(_0x240a71,_0x25050e){var _0x2be6d2={};if(!_[_0x8edd('0x5')](_0x240a71)){_[_0x8edd('0x6')](_0x240a71,function(_0x2a921d,_0x47f073){try{if(_0x25050e){var _0xb80de6=_[_0x8edd('0x7')](_0x25050e,{'name':_0x47f073})||{};if(_0xb80de6[_0x8edd('0x8')]==='DATE'&&_[_0x8edd('0x9')](_0x2a921d)){var _0x303e92=JSON[_0x8edd('0xa')](_0x2a921d);var _0x535790={'$gte':moment(moment(_0x303e92['$gte'])[_0x8edd('0xb')](_0x8edd('0xc')))[_0x8edd('0xd')]()[_0x8edd('0xb')](),'$lte':moment(moment(_0x303e92[_0x8edd('0xe')])[_0x8edd('0xb')](_0x8edd('0xc')))[_0x8edd('0xd')]()['subtract'](0x1,'s')[_0x8edd('0xb')]()};_0x2be6d2[_0x47f073]=_0x535790;}else{_0x2be6d2[_0x47f073]=_[_0x8edd('0xf')](_0x2a921d)?_0x2a921d:JSON[_0x8edd('0xa')](_0x2a921d);}}else{_0x2be6d2[_0x47f073]=_['isArray'](_0x2a921d)?_0x2a921d:JSON[_0x8edd('0xa')](_0x2a921d);}}catch(_0x1601f9){_0x2be6d2[_0x47f073]=_0x2a921d[_0x8edd('0x4')](',');}});}return _0x2be6d2;};exports[_0x8edd('0x10')]=function(_0x450471){_0x450471=parseInt(_0x450471,0xa);if(!_0x450471||_0x450471<0x0){_0x450471=LIMIT_VALUE;}return _0x450471;};exports[_0x8edd('0x11')]=function(_0x5aaace){_0x5aaace=parseInt(_0x5aaace,0xa);if(!_0x5aaace||_0x5aaace<0x0){_0x5aaace=0x0;}return _0x5aaace;};exports[_0x8edd('0x12')]=function(_0x463fb1){var _0x261cd9,_0x11240b=null;if(_0x463fb1){_0x261cd9=_0x463fb1['split'](',');_0x11240b=_[_0x8edd('0x13')](_0x261cd9,function(_0x1b19cc){if(_0x1b19cc[_0x8edd('0x14')]('-')===0x0){return[_0x1b19cc===_0x8edd('0x15')?sequelize[_0x8edd('0x16')](sequelize[_0x8edd('0x17')](_0x8edd('0x15')),_0x8edd('0x18')):_0x1b19cc[_0x8edd('0x19')](0x1),'DESC'];}else{return[_0x1b19cc==='priority'?sequelize[_0x8edd('0x16')](sequelize['col'](_0x8edd('0x15')),_0x8edd('0x18')):_0x1b19cc,_0x8edd('0x1a')];}});}return _0x11240b;};exports[_0x8edd('0x1b')]=function(_0x375a9e,_0x566a84){if(_[_0x8edd('0x5')](_0x375a9e)){return _0x375a9e;}if(_[_0x8edd('0xf')](_0x375a9e)){for(var _0x3e2c98=0x0;_0x3e2c98<_0x375a9e[_0x8edd('0x1c')];_0x3e2c98+=0x1){_0x375a9e[_0x3e2c98]=this[_0x8edd('0x1b')](_0x375a9e[_0x3e2c98],_0x566a84);}return _0x375a9e;}if(!_[_0x8edd('0x1d')](_0x375a9e)){return _0x375a9e;}if(_[_0x8edd('0x1e')](_0x566a84)){_0x566a84=[_0x566a84];}if(!_[_0x8edd('0xf')](_0x566a84)){return _0x375a9e;}for(var _0x1130c3=0x0;_0x1130c3<_0x566a84[_0x8edd('0x1c')];_0x1130c3+=0x1){_[_0x8edd('0x1f')](_0x375a9e,_0x566a84[_0x1130c3]);}for(var _0x50ca3b in _0x375a9e){if(_0x375a9e['hasOwnProperty'](_0x50ca3b)){_0x375a9e[_0x50ca3b]=this[_0x8edd('0x1b')](_0x375a9e[_0x50ca3b],_0x566a84);}}return _0x375a9e;};exports['isNumeric']=function(_0x3708a9){return _0x3708a9[_0x8edd('0x20')](RegExp(_0x8edd('0x21')))?!![]:![];};exports[_0x8edd('0x22')]=function(_0x741fec){return _0x741fec['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4447f9){var _0x5ee816=[];_0x4447f9[_0x8edd('0x4')]('\x20')['forEach'](function(_0x890349){_0x5ee816[_0x8edd('0x23')]('+'+_0x890349[_0x8edd('0x24')]()+'*');});return _0x5ee816['join']('\x20');}; \ No newline at end of file +var _0x547b=['^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','join','lodash','sequelize','split','filters','isEmpty','forOwn','find','type','DATE','parse','$gte','format','YYYY-MM-DD','utc','$lte','isArray','limit','offset','sort','map','indexOf','cast','col','priority','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match'];(function(_0x3ebcaa,_0x47cb0e){var _0x43fa28=function(_0x51300e){while(--_0x51300e){_0x3ebcaa['push'](_0x3ebcaa['shift']());}};_0x43fa28(++_0x47cb0e);}(_0x547b,0x1b5));var _0xb547=function(_0x1829ba,_0x5aa98a){_0x1829ba=_0x1829ba-0x0;var _0xf671ce=_0x547b[_0x1829ba];return _0xf671ce;};'use strict';var _=require(_0xb547('0x0'));var sequelize=require(_0xb547('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x1d3cea){var _0x56aebc=null;if(_0x1d3cea){_0x56aebc=_0x1d3cea[_0xb547('0x2')](',');}return _0x56aebc;};exports[_0xb547('0x3')]=function(_0x578a5d,_0xc6533d){var _0x378067={};if(!_[_0xb547('0x4')](_0x578a5d)){_[_0xb547('0x5')](_0x578a5d,function(_0x146eb7,_0x2b9508){try{if(_0xc6533d){var _0x3325b7=_[_0xb547('0x6')](_0xc6533d,{'name':_0x2b9508})||{};if(_0x3325b7[_0xb547('0x7')]===_0xb547('0x8')&&_['isPlainObject'](_0x146eb7)){var _0x33120c=JSON[_0xb547('0x9')](_0x146eb7);var _0x4529be={'$gte':moment(moment(_0x33120c[_0xb547('0xa')])[_0xb547('0xb')](_0xb547('0xc')))[_0xb547('0xd')]()[_0xb547('0xb')](),'$lte':moment(moment(_0x33120c[_0xb547('0xe')])['format']('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0xb547('0xb')]()};_0x378067[_0x2b9508]=_0x4529be;}else{_0x378067[_0x2b9508]=_[_0xb547('0xf')](_0x146eb7)?_0x146eb7:JSON[_0xb547('0x9')](_0x146eb7);}}else{_0x378067[_0x2b9508]=_[_0xb547('0xf')](_0x146eb7)?_0x146eb7:JSON['parse'](_0x146eb7);}}catch(_0x2135d8){_0x378067[_0x2b9508]=_0x146eb7[_0xb547('0x2')](',');}});}return _0x378067;};exports[_0xb547('0x10')]=function(_0x21a40d){_0x21a40d=parseInt(_0x21a40d,0xa);if(!_0x21a40d||_0x21a40d<0x0){_0x21a40d=LIMIT_VALUE;}return _0x21a40d;};exports[_0xb547('0x11')]=function(_0x194380){_0x194380=parseInt(_0x194380,0xa);if(!_0x194380||_0x194380<0x0){_0x194380=0x0;}return _0x194380;};exports[_0xb547('0x12')]=function(_0x11b352){var _0x3ca4ac,_0x32798c=null;if(_0x11b352){_0x3ca4ac=_0x11b352[_0xb547('0x2')](',');_0x32798c=_[_0xb547('0x13')](_0x3ca4ac,function(_0x271f9a){if(_0x271f9a[_0xb547('0x14')]('-')===0x0){return[_0x271f9a==='priority'?sequelize[_0xb547('0x15')](sequelize[_0xb547('0x16')](_0xb547('0x17')),_0xb547('0x18')):_0x271f9a[_0xb547('0x19')](0x1),_0xb547('0x1a')];}else{return[_0x271f9a==='priority'?sequelize[_0xb547('0x15')](sequelize[_0xb547('0x16')](_0xb547('0x17')),_0xb547('0x18')):_0x271f9a,_0xb547('0x1b')];}});}return _0x32798c;};exports[_0xb547('0x1c')]=function(_0x4f54f0,_0x563960){if(_['isEmpty'](_0x4f54f0)){return _0x4f54f0;}if(_['isArray'](_0x4f54f0)){for(var _0x1f219d=0x0;_0x1f219d<_0x4f54f0[_0xb547('0x1d')];_0x1f219d+=0x1){_0x4f54f0[_0x1f219d]=this[_0xb547('0x1c')](_0x4f54f0[_0x1f219d],_0x563960);}return _0x4f54f0;}if(!_[_0xb547('0x1e')](_0x4f54f0)){return _0x4f54f0;}if(_[_0xb547('0x1f')](_0x563960)){_0x563960=[_0x563960];}if(!_[_0xb547('0xf')](_0x563960)){return _0x4f54f0;}for(var _0x58fa0f=0x0;_0x58fa0f<_0x563960[_0xb547('0x1d')];_0x58fa0f+=0x1){_[_0xb547('0x20')](_0x4f54f0,_0x563960[_0x58fa0f]);}for(var _0x9ed5bc in _0x4f54f0){if(_0x4f54f0[_0xb547('0x21')](_0x9ed5bc)){_0x4f54f0[_0x9ed5bc]=this[_0xb547('0x1c')](_0x4f54f0[_0x9ed5bc],_0x563960);}}return _0x4f54f0;};exports[_0xb547('0x22')]=function(_0x2caef3){return _0x2caef3[_0xb547('0x23')](RegExp(_0xb547('0x24')))?!![]:![];};exports[_0xb547('0x25')]=function(_0x3254f7){return _0x3254f7['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xb547('0x26')]=function(_0x4d3424){var _0x51a883=[];_0x4d3424[_0xb547('0x2')]('\x20')[_0xb547('0x27')](function(_0x46f6b8){_0x51a883[_0xb547('0x28')]('+'+_0x46f6b8[_0xb547('0x29')]()+'*');});return _0x51a883[_0xb547('0x2a')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 06234e5..5bd09bd 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f49=['50mb','json','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','cors','moment','./environment','default','get','env','production','set','appPath','join','public','development','test','root','client','use','json\x20replacer','toISOString','split','views','/server/views','ejs','renderFile','view\x20engine','urlencoded'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x8f49,0x1df));var _0x98f4=function(_0x2482c0,_0x2caade){_0x2482c0=_0x2482c0-0x0;var _0x4eb983=_0x8f49[_0x2482c0];return _0x4eb983;};'use strict';var express=require(_0x98f4('0x0'));var favicon=require(_0x98f4('0x1'));var bodyParser=require(_0x98f4('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x98f4('0x3'));var errorHandler=require(_0x98f4('0x4'));var path=require(_0x98f4('0x5'));var passport=require('passport');var cors=require(_0x98f4('0x6'));var moment=require(_0x98f4('0x7'));var config=require(_0x98f4('0x8'));var db=require('../mysqldb')['db'];exports[_0x98f4('0x9')]=function(_0x3d614a){var _0x59d7b6=_0x3d614a[_0x98f4('0xa')](_0x98f4('0xb'));if(_0x59d7b6===_0x98f4('0xc')){_0x3d614a[_0x98f4('0xd')](_0x98f4('0xe'),path[_0x98f4('0xf')](config['root'],_0x98f4('0x10')));}if(_0x59d7b6===_0x98f4('0x11')||_0x59d7b6===_0x98f4('0x12')){_0x3d614a[_0x98f4('0xd')](_0x98f4('0xe'),path[_0x98f4('0xf')](config[_0x98f4('0x13')],_0x98f4('0x14')));_0x3d614a[_0x98f4('0x15')](errorHandler());}_0x3d614a[_0x98f4('0xd')](_0x98f4('0x16'),function(_0x23c294,_0x170d40){if(this[_0x23c294]instanceof Date){_0x170d40=this[_0x23c294][_0x98f4('0x17')]()[_0x98f4('0x18')]('.')[0x0]+'Z';}return _0x170d40;});_0x3d614a['use'](express['static'](_0x3d614a[_0x98f4('0xa')](_0x98f4('0xe'))));_0x3d614a[_0x98f4('0xd')](_0x98f4('0x19'),config[_0x98f4('0x13')]+_0x98f4('0x1a'));_0x3d614a['engine']('html',require(_0x98f4('0x1b'))[_0x98f4('0x1c')]);_0x3d614a[_0x98f4('0xd')](_0x98f4('0x1d'),'html');_0x3d614a[_0x98f4('0x15')](bodyParser[_0x98f4('0x1e')]({'limit':_0x98f4('0x1f'),'extended':!![]}));_0x3d614a['use'](bodyParser[_0x98f4('0x20')]({'limit':_0x98f4('0x1f')}));_0x3d614a['use'](cors());_0x3d614a[_0x98f4('0x15')](methodOverride());_0x3d614a[_0x98f4('0x15')](cookieParser());_0x3d614a[_0x98f4('0x15')](passport[_0x98f4('0x21')]());}; \ No newline at end of file +var _0x9350=['moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','development','json\x20replacer','toISOString','split','use','static','/server/views','engine','ejs','view\x20engine','html','json','50mb','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9350,0xdf));var _0x0935=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x9350[_0x5b561d];return _0x431060;};'use strict';var express=require(_0x0935('0x0'));var favicon=require(_0x0935('0x1'));var bodyParser=require(_0x0935('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x0935('0x3'));var errorHandler=require(_0x0935('0x4'));var path=require(_0x0935('0x5'));var passport=require(_0x0935('0x6'));var cors=require(_0x0935('0x7'));var moment=require(_0x0935('0x8'));var config=require(_0x0935('0x9'));var db=require(_0x0935('0xa'))['db'];exports[_0x0935('0xb')]=function(_0x24bbbc){var _0x1e525b=_0x24bbbc[_0x0935('0xc')](_0x0935('0xd'));if(_0x1e525b===_0x0935('0xe')){_0x24bbbc[_0x0935('0xf')](_0x0935('0x10'),path[_0x0935('0x11')](config[_0x0935('0x12')],'public'));}if(_0x1e525b===_0x0935('0x13')||_0x1e525b==='test'){_0x24bbbc['set'](_0x0935('0x10'),path[_0x0935('0x11')](config[_0x0935('0x12')],'client'));_0x24bbbc['use'](errorHandler());}_0x24bbbc[_0x0935('0xf')](_0x0935('0x14'),function(_0x1da8b2,_0x40f4ed){if(this[_0x1da8b2]instanceof Date){_0x40f4ed=this[_0x1da8b2][_0x0935('0x15')]()[_0x0935('0x16')]('.')[0x0]+'Z';}return _0x40f4ed;});_0x24bbbc[_0x0935('0x17')](express[_0x0935('0x18')](_0x24bbbc[_0x0935('0xc')](_0x0935('0x10'))));_0x24bbbc['set']('views',config[_0x0935('0x12')]+_0x0935('0x19'));_0x24bbbc[_0x0935('0x1a')]('html',require(_0x0935('0x1b'))['renderFile']);_0x24bbbc[_0x0935('0xf')](_0x0935('0x1c'),_0x0935('0x1d'));_0x24bbbc[_0x0935('0x17')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x24bbbc['use'](bodyParser[_0x0935('0x1e')]({'limit':_0x0935('0x1f')}));_0x24bbbc['use'](cors());_0x24bbbc[_0x0935('0x17')](methodOverride());_0x24bbbc[_0x0935('0x17')](cookieParser());_0x24bbbc[_0x0935('0x17')](passport[_0x0935('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 73aa932..02d2490 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 _0x394e=['127.0.0.1','getFirstInterface','cpus','map','md5','update','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','digest','substring','lodash','crypto','child_process','execSync','orderBy','keys','length','filter','family','IPv4','internal','mac','00:00:00:00:00:00','address'];(function(_0x24ad48,_0x31c1d6){var _0x6b5cc1=function(_0x597f57){while(--_0x597f57){_0x24ad48['push'](_0x24ad48['shift']());}};_0x6b5cc1(++_0x31c1d6);}(_0x394e,0x88));var _0xe394=function(_0xb3a764,_0x22fdc0){_0xb3a764=_0xb3a764-0x0;var _0x2de877=_0x394e[_0xb3a764];return _0x2de877;};'use strict';var _=require(_0xe394('0x0'));var os=require('os');var crypto=require(_0xe394('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xe394('0x2'))[_0xe394('0x3')];function getInterfaces(){var _0x373028=[];var _0x1a96cc=os['networkInterfaces']();var _0x4269f4=_[_0xe394('0x4')](_[_0xe394('0x5')](_0x1a96cc));for(var _0x322cd4=0x0;_0x322cd4<_0x4269f4[_0xe394('0x6')];_0x322cd4++){var _0x272c30=_0x1a96cc[_0x4269f4[_0x322cd4]][_0xe394('0x7')](function(_0x169910){return _0x169910[_0xe394('0x8')]===_0xe394('0x9')&&_0x169910[_0xe394('0xa')]===![];});_0x373028=_0x373028['concat'](_0x272c30);}return _0x373028;}function getFirstInterface(){var _0x50c6c1=_['head'](getInterfaces());return{'macAddress':_0x50c6c1&&_0x50c6c1[_0xe394('0xb')]?_0x50c6c1[_0xe394('0xb')]:_0xe394('0xc'),'ipAddress':_0x50c6c1&&_0x50c6c1[_0xe394('0xd')]?_0x50c6c1[_0xe394('0xd')]:_0xe394('0xe')};}exports[_0xe394('0xf')]=getFirstInterface;function getCPUhash(){var _0x4706bb=_[_0xe394('0x4')](os[_0xe394('0x10')]()[_0xe394('0x11')](function(_0x383e2c){return _0x383e2c['model'];}))['join'](':');return crypto['createHash'](_0xe394('0x12'))[_0xe394('0x13')](_0x4706bb)['digest'](_0xe394('0x14'));}exports[_0xe394('0x15')]=function(){switch(os[_0xe394('0x16')]()){case _0xe394('0x17'):return exec(_0xe394('0x18'),{'encoding':_0xe394('0x19')})['replace']('\x0d\x0a','');default:var _0x47afc4=getFirstInterface();var _0x1b8777=getCPUhash();var _0x3196d0=_0x1b8777+'|'+os[_0xe394('0x1a')]()+'|'+_0x47afc4[_0xe394('0x1b')]+'|'+_0x47afc4['ipAddress'];var _0x507392=crypto['createHash'](_0xe394('0x12'))[_0xe394('0x13')](_0x3196d0)[_0xe394('0x1c')]('hex');return _0x507392[_0xe394('0x1d')](0x0,0x8)+'-'+_0x507392[_0xe394('0x1d')](0x8,0xc)+'-'+_0x507392[_0xe394('0x1d')](0xc,0x10)+'-'+_0x507392['substring'](0x10,0x14)+'-'+_0x507392[_0xe394('0x1d')](0x14);}}; \ No newline at end of file +var _0xea81=['lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','filter','family','IPv4','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','model','join','md5','update','digest','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','substring'];(function(_0x57ac7c,_0x13eb14){var _0x52d72c=function(_0x3a223e){while(--_0x3a223e){_0x57ac7c['push'](_0x57ac7c['shift']());}};_0x52d72c(++_0x13eb14);}(_0xea81,0x1ed));var _0x1ea8=function(_0x1b7c0b,_0x1e9a6c){_0x1b7c0b=_0x1b7c0b-0x0;var _0x466423=_0xea81[_0x1b7c0b];return _0x466423;};'use strict';var _=require(_0x1ea8('0x0'));var os=require('os');var crypto=require(_0x1ea8('0x1'));var machine=require(_0x1ea8('0x2'));var exec=require(_0x1ea8('0x3'))['execSync'];function getInterfaces(){var _0x483fce=[];var _0x3ca664=os[_0x1ea8('0x4')]();var _0x2e6a47=_[_0x1ea8('0x5')](_[_0x1ea8('0x6')](_0x3ca664));for(var _0x562bb0=0x0;_0x562bb0<_0x2e6a47['length'];_0x562bb0++){var _0x5f4538=_0x3ca664[_0x2e6a47[_0x562bb0]][_0x1ea8('0x7')](function(_0x372fdc){return _0x372fdc[_0x1ea8('0x8')]===_0x1ea8('0x9')&&_0x372fdc['internal']===![];});_0x483fce=_0x483fce[_0x1ea8('0xa')](_0x5f4538);}return _0x483fce;}function getFirstInterface(){var _0x2c48ce=_[_0x1ea8('0xb')](getInterfaces());return{'macAddress':_0x2c48ce&&_0x2c48ce[_0x1ea8('0xc')]?_0x2c48ce[_0x1ea8('0xc')]:'00:00:00:00:00:00','ipAddress':_0x2c48ce&&_0x2c48ce[_0x1ea8('0xd')]?_0x2c48ce['address']:_0x1ea8('0xe')};}exports[_0x1ea8('0xf')]=getFirstInterface;function getCPUhash(){var _0x5a327=_[_0x1ea8('0x5')](os[_0x1ea8('0x10')]()['map'](function(_0x5a1f3e){return _0x5a1f3e[_0x1ea8('0x11')];}))[_0x1ea8('0x12')](':');return crypto['createHash'](_0x1ea8('0x13'))[_0x1ea8('0x14')](_0x5a327)[_0x1ea8('0x15')](_0x1ea8('0x16'));}exports[_0x1ea8('0x17')]=function(){switch(os['platform']()){case _0x1ea8('0x18'):return exec(_0x1ea8('0x19'),{'encoding':_0x1ea8('0x1a')})['replace']('\x0d\x0a','');default:var _0x2d5b07=getFirstInterface();var _0x3a600c=getCPUhash();var _0x4c8228=_0x3a600c+'|'+os['hostname']()+'|'+_0x2d5b07[_0x1ea8('0x1b')]+'|'+_0x2d5b07['ipAddress'];var _0x46c78a=crypto['createHash'](_0x1ea8('0x13'))[_0x1ea8('0x14')](_0x4c8228)[_0x1ea8('0x15')](_0x1ea8('0x16'));return _0x46c78a[_0x1ea8('0x1c')](0x0,0x8)+'-'+_0x46c78a[_0x1ea8('0x1c')](0x8,0xc)+'-'+_0x46c78a[_0x1ea8('0x1c')](0xc,0x10)+'-'+_0x46c78a[_0x1ea8('0x1c')](0x10,0x14)+'-'+_0x46c78a['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index d129451..dd37a43 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 _0xdeb3=['./hardware','../logger','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','createCipher','update','utf8','final','base64','createDecipher','secrets','||FIELD||VALUE||\x0a','User','admin','fullname','email','|uuid|','|machineUuid|','|name|','|email|','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','crypto','moment','request-promise','version','../../mysqldb','../environment'];(function(_0x56e37a,_0x2440bb){var _0x2cbfd4=function(_0xa17c43){while(--_0xa17c43){_0x56e37a['push'](_0x56e37a['shift']());}};_0x2cbfd4(++_0x2440bb);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var util=require('util');var crypto=require(_0x3deb('0x0'));var moment=require(_0x3deb('0x1'));var rp=require(_0x3deb('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x3deb('0x3'));var db=require(_0x3deb('0x4'))['db'];var config=require(_0x3deb('0x5'));var hardware=require(_0x3deb('0x6'));var logger=require(_0x3deb('0x7'))('license');var jira=require(_0x3deb('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x469e98){return new BPromise(function(_0x5455e4,_0x37db86){var _0x1bf486=util[_0x3deb('0x9')](_0x3deb('0xa'),HOST,_0x469e98,module[_0x3deb('0xb')][_0x3deb('0x3')]);if(oldToken){_0x1bf486=util[_0x3deb('0x9')](_0x3deb('0xc'),HOST,_0x469e98,module[_0x3deb('0xb')]['version'],oldToken);}var _0x5a50f5={'uri':_0x1bf486,'method':_0x3deb('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x5a50f5)[_0x3deb('0xe')](function(_0x756238){_0x5455e4(_0x756238);})['catch'](function(_0x435ae5){_0x37db86(_0x435ae5);});});}function encryptDate(_0x2bc594){var _0xc65b64=crypto[_0x3deb('0xf')]('aes-256-ctr',config['secrets']['session']);var _0x258d26=_0xc65b64[_0x3deb('0x10')](_0x2bc594,_0x3deb('0x11'),'base64');_0x258d26+=_0xc65b64[_0x3deb('0x12')](_0x3deb('0x13'));return _0x258d26;}function decryptDate(_0x55c13c){var _0x24b516=crypto[_0x3deb('0x14')]('aes-256-ctr',config[_0x3deb('0x15')]['session']);var _0x465f33=_0x24b516['update'](_0x55c13c,'base64',_0x3deb('0x11'));_0x465f33+=_0x24b516[_0x3deb('0x12')](_0x3deb('0x11'));return _0x465f33;}function sendJiraAlert(_0x9ba4f,_0x8b65f,_0x145d16){var _0x4c8242=_0x3deb('0x16');return db[_0x3deb('0x17')]['findOne']({'where':{'role':_0x3deb('0x18')},'attributes':[_0x3deb('0x19'),_0x3deb('0x1a')],'raw':!![]})[_0x3deb('0xe')](function(_0xe1e928){ADMIN=_0xe1e928;_0x4c8242+='|reason|'+_0x145d16+'|\x0a';_0x4c8242+=_0x3deb('0x1b')+_0x9ba4f+'|\x0a';_0x4c8242+=_0x3deb('0x1c')+_0x8b65f+'|\x0a';_0x4c8242+=_0x3deb('0x1d')+ADMIN[_0x3deb('0x19')]+'|\x0a';_0x4c8242+=_0x3deb('0x1e')+ADMIN[_0x3deb('0x1a')]+'|\x0a';return _0x4c8242;})[_0x3deb('0xe')](function(_0x1f535e){var _0x42a8d5=hardware['getFirstInterface']()[_0x3deb('0x1f')];return jira['openIssue']({'key':_0x3deb('0x20'),'summary':_0x3deb('0x21'),'description':_0x1f535e,'issuetype':_0x3deb('0x22'),'oldToken':_0x9ba4f,'newToken':_0x8b65f,'email':ADMIN[_0x3deb('0x1a')],'name':ADMIN[_0x3deb('0x19')],'reason':GRAY_PERIOD_REASON,'ip':_0x42a8d5});});}function manageLicense(_0x245544,_0x297946){var _0x255fa5=_0x297946[_0x3deb('0x23')]({'plain':!![]});httpRequest(_0x245544)[_0x3deb('0xe')](function(_0x27a6f9){if(oldToken){oldToken=undefined;}if(_0x27a6f9[_0x3deb('0x24')]){if(!_0x255fa5[_0x3deb('0x25')]&&_0x255fa5[_0x3deb('0x25')]!=_0x27a6f9[_0x3deb('0x25')]||_0x255fa5[_0x3deb('0x25')]&&_0x255fa5[_0x3deb('0x26')]){logger[_0x3deb('0x27')](_0x3deb('0x28'));}if(_0x255fa5[_0x3deb('0x25')]&&!_0x255fa5['data2']&&_0x255fa5[_0x3deb('0x25')]!=_0x27a6f9[_0x3deb('0x25')]){logger['info'](_0x3deb('0x29'));}if(_0x255fa5['license']&&!_0x255fa5[_0x3deb('0x26')]&&_0x255fa5[_0x3deb('0x25')]==_0x27a6f9[_0x3deb('0x25')]){return _0x297946;}return _0x297946[_0x3deb('0x10')]({'data1':_0x245544,'data2':null,'license':_0x27a6f9[_0x3deb('0x25')]});}else{if(_0x27a6f9[_0x3deb('0x25')]||_0x255fa5['license']){if(!_0x255fa5[_0x3deb('0x26')]){if(_0x255fa5[_0x3deb('0x2a')]==_0x245544){GRAY_PERIOD_REASON=_0x3deb('0x2b');logger[_0x3deb('0x27')](_0x3deb('0x2c'));}else{GRAY_PERIOD_REASON=_0x3deb('0x2d');oldToken=_0x255fa5[_0x3deb('0x2a')];logger[_0x3deb('0x27')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x255fa5[_0x3deb('0x2a')],_0x245544);}sendJiraAlert(_0x255fa5[_0x3deb('0x2a')],_0x27a6f9[_0x3deb('0x2e')],GRAY_PERIOD_REASON);logger[_0x3deb('0x27')](_0x3deb('0x2f'),GRAY_PERIOD_REASON[_0x3deb('0x30')](),moment()[_0x3deb('0x9')](_0x3deb('0x31')));return _0x297946[_0x3deb('0x10')]({'data2':encryptDate(moment()[_0x3deb('0x9')](_0x3deb('0x31')))});}else{if(moment()[_0x3deb('0x32')](decryptDate(_0x255fa5[_0x3deb('0x26')]),_0x3deb('0x33'))>DAYS){logger[_0x3deb('0x27')](_0x3deb('0x34'),moment()[_0x3deb('0x9')](_0x3deb('0x31')));return _0x297946[_0x3deb('0x10')]({'data1':_0x245544,'data2':null,'license':null});}}}else{if(_0x255fa5['data1']!=_0x245544){logger[_0x3deb('0x27')](_0x3deb('0x35'),_0x255fa5[_0x3deb('0x2a')],_0x245544);return _0x297946[_0x3deb('0x10')]({'data1':_0x245544,'data2':null,'license':null});}}}return _0x297946;})['then'](function(_0x42d09b){_0x297946=_0x42d09b;})[_0x3deb('0x36')](function(_0x22d13d){logger[_0x3deb('0x37')](_0x22d13d[_0x3deb('0x38')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x297946);},TIME);});}function defaultLicense(){var _0x2953d8=hardware[_0x3deb('0x39')]();if(_0x2953d8){return db[_0x3deb('0x3a')][_0x3deb('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0x2953d8}})[_0x3deb('0x3c')](function(_0xf875e6,_0x27499b){logger[_0x3deb('0x27')](_0x3deb('0x3d'),_0x2953d8);manageLicense(_0x2953d8,_0xf875e6);})[_0x3deb('0x36')](function(_0x218159){logger['error'](_0x218159[_0x3deb('0x38')]);});}}exports[_0x3deb('0x3e')]=defaultLicense; \ No newline at end of file +var _0x6b1b=['moment','request-promise','pkginfo','version','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','exports','format','GET','then','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','final','||FIELD||VALUE||\x0a','User','findOne','email','|uuid|','fullname','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Alert','get','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','crypto'];(function(_0x1a378b,_0x32b1a7){var _0x3adbcc=function(_0x5a7af0){while(--_0x5a7af0){_0x1a378b['push'](_0x1a378b['shift']());}};_0x3adbcc(++_0x32b1a7);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x6b1b[_0x1cfa0d];return _0xe33279;};'use strict';var util=require('util');var crypto=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var rp=require(_0xb6b1('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xb6b1('0x3'))(module,_0xb6b1('0x4'));var db=require(_0xb6b1('0x5'))['db'];var config=require(_0xb6b1('0x6'));var hardware=require(_0xb6b1('0x7'));var logger=require(_0xb6b1('0x8'))(_0xb6b1('0x9'));var jira=require(_0xb6b1('0xa'));var HOST=_0xb6b1('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x13334e){return new BPromise(function(_0x1a4cd0,_0x5b440a){var _0x2734cc=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x13334e,module[_0xb6b1('0xc')]['version']);if(oldToken){_0x2734cc=util[_0xb6b1('0xd')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x13334e,module['exports']['version'],oldToken);}var _0x593218={'uri':_0x2734cc,'method':_0xb6b1('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x593218)[_0xb6b1('0xf')](function(_0x5d806b){_0x1a4cd0(_0x5d806b);})[_0xb6b1('0x10')](function(_0x59831e){_0x5b440a(_0x59831e);});});}function encryptDate(_0x5c5837){var _0x406dce=crypto[_0xb6b1('0x11')](_0xb6b1('0x12'),config[_0xb6b1('0x13')][_0xb6b1('0x14')]);var _0x18f6b5=_0x406dce[_0xb6b1('0x15')](_0x5c5837,_0xb6b1('0x16'),_0xb6b1('0x17'));_0x18f6b5+=_0x406dce[_0xb6b1('0x18')](_0xb6b1('0x17'));return _0x18f6b5;}function decryptDate(_0x14fef6){var _0x4f770a=crypto['createDecipher']('aes-256-ctr',config['secrets'][_0xb6b1('0x14')]);var _0x12c595=_0x4f770a[_0xb6b1('0x15')](_0x14fef6,_0xb6b1('0x17'),_0xb6b1('0x16'));_0x12c595+=_0x4f770a[_0xb6b1('0x18')]('utf8');return _0x12c595;}function sendJiraAlert(_0x581e28,_0x1bdf63,_0x15456d){var _0x16d969=_0xb6b1('0x19');return db[_0xb6b1('0x1a')][_0xb6b1('0x1b')]({'where':{'role':'admin'},'attributes':['fullname',_0xb6b1('0x1c')],'raw':!![]})[_0xb6b1('0xf')](function(_0x5ce41c){ADMIN=_0x5ce41c;_0x16d969+='|reason|'+_0x15456d+'|\x0a';_0x16d969+=_0xb6b1('0x1d')+_0x581e28+'|\x0a';_0x16d969+='|machineUuid|'+_0x1bdf63+'|\x0a';_0x16d969+='|name|'+ADMIN[_0xb6b1('0x1e')]+'|\x0a';_0x16d969+=_0xb6b1('0x1f')+ADMIN[_0xb6b1('0x1c')]+'|\x0a';return _0x16d969;})[_0xb6b1('0xf')](function(_0x164952){var _0x3d0864=hardware[_0xb6b1('0x20')]()[_0xb6b1('0x21')];return jira[_0xb6b1('0x22')]({'key':_0xb6b1('0x23'),'summary':'Motion\x20License\x20Alert','description':_0x164952,'issuetype':_0xb6b1('0x24'),'oldToken':_0x581e28,'newToken':_0x1bdf63,'email':ADMIN['email'],'name':ADMIN[_0xb6b1('0x1e')],'reason':GRAY_PERIOD_REASON,'ip':_0x3d0864});});}function manageLicense(_0x5864d6,_0xdbcb77){var _0x48c1d2=_0xdbcb77[_0xb6b1('0x25')]({'plain':!![]});httpRequest(_0x5864d6)[_0xb6b1('0xf')](function(_0xac4256){if(oldToken){oldToken=undefined;}if(_0xac4256[_0xb6b1('0x26')]){if(!_0x48c1d2[_0xb6b1('0x9')]&&_0x48c1d2[_0xb6b1('0x9')]!=_0xac4256[_0xb6b1('0x9')]||_0x48c1d2[_0xb6b1('0x9')]&&_0x48c1d2[_0xb6b1('0x27')]){logger['info'](_0xb6b1('0x28'));}if(_0x48c1d2['license']&&!_0x48c1d2[_0xb6b1('0x27')]&&_0x48c1d2[_0xb6b1('0x9')]!=_0xac4256[_0xb6b1('0x9')]){logger[_0xb6b1('0x29')](_0xb6b1('0x2a'));}if(_0x48c1d2[_0xb6b1('0x9')]&&!_0x48c1d2[_0xb6b1('0x27')]&&_0x48c1d2['license']==_0xac4256[_0xb6b1('0x9')]){return _0xdbcb77;}return _0xdbcb77[_0xb6b1('0x15')]({'data1':_0x5864d6,'data2':null,'license':_0xac4256[_0xb6b1('0x9')]});}else{if(_0xac4256['license']||_0x48c1d2[_0xb6b1('0x9')]){if(!_0x48c1d2[_0xb6b1('0x27')]){if(_0x48c1d2['data1']==_0x5864d6){GRAY_PERIOD_REASON=_0xb6b1('0x2b');logger[_0xb6b1('0x29')](_0xb6b1('0x2c'));}else{GRAY_PERIOD_REASON=_0xb6b1('0x2d');oldToken=_0x48c1d2[_0xb6b1('0x2e')];logger[_0xb6b1('0x29')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x48c1d2[_0xb6b1('0x2e')],_0x5864d6);}sendJiraAlert(_0x48c1d2[_0xb6b1('0x2e')],_0xac4256['uuid'],GRAY_PERIOD_REASON);logger[_0xb6b1('0x29')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xb6b1('0x2f')](),moment()[_0xb6b1('0xd')](_0xb6b1('0x30')));return _0xdbcb77[_0xb6b1('0x15')]({'data2':encryptDate(moment()[_0xb6b1('0xd')](_0xb6b1('0x30')))});}else{if(moment()['diff'](decryptDate(_0x48c1d2[_0xb6b1('0x27')]),_0xb6b1('0x31'))>DAYS){logger[_0xb6b1('0x29')](_0xb6b1('0x32'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0xdbcb77['update']({'data1':_0x5864d6,'data2':null,'license':null});}}}else{if(_0x48c1d2[_0xb6b1('0x2e')]!=_0x5864d6){logger[_0xb6b1('0x29')](_0xb6b1('0x33'),_0x48c1d2[_0xb6b1('0x2e')],_0x5864d6);return _0xdbcb77[_0xb6b1('0x15')]({'data1':_0x5864d6,'data2':null,'license':null});}}}return _0xdbcb77;})[_0xb6b1('0xf')](function(_0xedb6ba){_0xdbcb77=_0xedb6ba;})[_0xb6b1('0x10')](function(_0x206008){logger[_0xb6b1('0x34')](_0x206008[_0xb6b1('0x35')]);})[_0xb6b1('0x36')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0xdbcb77);},TIME);});}function defaultLicense(){var _0x17f529=hardware[_0xb6b1('0x37')]();if(_0x17f529){return db[_0xb6b1('0x38')][_0xb6b1('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x17f529}})[_0xb6b1('0x3a')](function(_0x1dc258,_0xfe126){logger[_0xb6b1('0x29')](_0xb6b1('0x3b'),_0x17f529);manageLicense(_0x17f529,_0x1dc258);})[_0xb6b1('0x10')](function(_0x44a61a){logger['error'](_0x44a61a[_0xb6b1('0x35')]);});}}exports[_0xb6b1('0x3c')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 993a7d5..06e5b68 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 _0xe4eb=['session','gray','deadline','add','days','grayReason','uuid','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','find','defaults','then','checkLicense','crypto','util','moment','./hardware','../environment','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','format','update','base64','utf8','parse','demo','machineUuid','getUuid','createDecipher'];(function(_0x323970,_0x5bde6f){var _0x3217da=function(_0x4dcdf3){while(--_0x4dcdf3){_0x323970['push'](_0x323970['shift']());}};_0x3217da(++_0x5bde6f);}(_0xe4eb,0x9b));var _0xbe4e=function(_0x433e3f,_0x41fb31){_0x433e3f=_0x433e3f-0x0;var _0x1c6c05=_0xe4eb[_0x433e3f];return _0x1c6c05;};'use strict';var crypto=require(_0xbe4e('0x0'));var util=require(_0xbe4e('0x1'));var _=require('lodash');var moment=require(_0xbe4e('0x2'));var hardware=require(_0xbe4e('0x3'));var config=require(_0xbe4e('0x4'));var db=require('../../mysqldb')['db'];function checkLicense(_0x253fbb,_0x9a14a9){if(_0x253fbb){try{var _0x3b2b21=_0x9a14a9||_0x253fbb['license'];if(_[_0xbe4e('0x5')](_0x3b2b21)){throw new Error(_0xbe4e('0x6'));}var _0x2e4bd6=_0x253fbb[_0xbe4e('0x7')];var _0x36c131=_0x253fbb[_0xbe4e('0x8')];var _0x3ad104=_0x2e4bd6[_0xbe4e('0x9')]('-')[0x4];var _0x2ac40e=_0x2e4bd6[_0xbe4e('0x9')]('-')[0x0];var _0x335d22=crypto['createDecipher'](_0xbe4e('0xa'),util[_0xbe4e('0xb')]('%s:%s:%s',_0x3ad104,_0x2e4bd6,_0x2ac40e));var _0x49f82e=_0x335d22[_0xbe4e('0xc')](_0x3b2b21,_0xbe4e('0xd'),_0xbe4e('0xe'));_0x49f82e+=_0x335d22['final'](_0xbe4e('0xe'));var _0x116a2a=JSON[_0xbe4e('0xf')](_0x49f82e);_0x116a2a[_0xbe4e('0x10')]=![];_0x116a2a['uuid']=_0x2e4bd6;_0x116a2a[_0xbe4e('0x11')]=hardware[_0xbe4e('0x12')]();if(_0x36c131){var _0x3c7a95=crypto[_0xbe4e('0x13')]('aes-256-ctr',config['secrets'][_0xbe4e('0x14')]);var _0x485a0e=_0x3c7a95[_0xbe4e('0xc')](_0x36c131,_0xbe4e('0xd'),_0xbe4e('0xe'));_0x485a0e+=_0x3c7a95['final']('utf8');_0x116a2a[_0xbe4e('0x15')]=_0x485a0e;_0x116a2a[_0xbe4e('0x16')]=moment(_0x485a0e)[_0xbe4e('0x17')](0x7,_0xbe4e('0x18'))[_0xbe4e('0xb')]();_0x116a2a[_0xbe4e('0x19')]=_0x116a2a[_0xbe4e('0x1a')]!=_0x116a2a[_0xbe4e('0x11')]?'changed':_0xbe4e('0x1b');}return _0x116a2a;}catch(_0x3b196d){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbe4e('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbe4e('0x1d'),'uuid':_0x253fbb['data1'],'machineUuid':hardware[_0xbe4e('0x12')](),'message':_0x3b196d[_0xbe4e('0x1e')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbe4e('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x253fbb['data1'],'machineUuid':hardware[_0xbe4e('0x12')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x1caa8c){return db['License'][_0xbe4e('0x1f')](_[_0xbe4e('0x20')](_0x1caa8c,{'raw':!![],'where':{'id':0x1}}))[_0xbe4e('0x21')](function(_0x3efb46){return checkLicense(_0x3efb46,null);});};exports[_0xbe4e('0x22')]=checkLicense; \ No newline at end of file +var _0x2a76=['../../mysqldb','license','License\x20key\x20value\x20not\x20found','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','parse','demo','machineUuid','getUuid','secrets','session','gray','deadline','add','days','grayReason','uuid','disabled','2027-01-01T00:00:00.000Z','message','Demo\x20license','getLicense','License','find','then','crypto','util','lodash','moment','./hardware','../environment'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x2a76,0xde));var _0x62a7=function(_0x346517,_0x4691d4){_0x346517=_0x346517-0x0;var _0x5102dc=_0x2a76[_0x346517];return _0x5102dc;};'use strict';var crypto=require(_0x62a7('0x0'));var util=require(_0x62a7('0x1'));var _=require(_0x62a7('0x2'));var moment=require(_0x62a7('0x3'));var hardware=require(_0x62a7('0x4'));var config=require(_0x62a7('0x5'));var db=require(_0x62a7('0x6'))['db'];function checkLicense(_0x27a284,_0x44abef){if(_0x27a284){try{var _0x28e476=_0x44abef||_0x27a284[_0x62a7('0x7')];if(_['isEmpty'](_0x28e476)){throw new Error(_0x62a7('0x8'));}var _0x5a2c8f=_0x27a284[_0x62a7('0x9')];var _0x2f031e=_0x27a284['data2'];var _0x5af567=_0x5a2c8f[_0x62a7('0xa')]('-')[0x4];var _0x75bf6d=_0x5a2c8f[_0x62a7('0xa')]('-')[0x0];var _0x5e0048=crypto[_0x62a7('0xb')](_0x62a7('0xc'),util[_0x62a7('0xd')](_0x62a7('0xe'),_0x5af567,_0x5a2c8f,_0x75bf6d));var _0x3dcf20=_0x5e0048[_0x62a7('0xf')](_0x28e476,_0x62a7('0x10'),'utf8');_0x3dcf20+=_0x5e0048[_0x62a7('0x11')]('utf8');var _0x28a052=JSON[_0x62a7('0x12')](_0x3dcf20);_0x28a052[_0x62a7('0x13')]=![];_0x28a052['uuid']=_0x5a2c8f;_0x28a052[_0x62a7('0x14')]=hardware[_0x62a7('0x15')]();if(_0x2f031e){var _0x793958=crypto['createDecipher'](_0x62a7('0xc'),config[_0x62a7('0x16')][_0x62a7('0x17')]);var _0x5c02d7=_0x793958[_0x62a7('0xf')](_0x2f031e,_0x62a7('0x10'),'utf8');_0x5c02d7+=_0x793958[_0x62a7('0x11')]('utf8');_0x28a052[_0x62a7('0x18')]=_0x5c02d7;_0x28a052[_0x62a7('0x19')]=moment(_0x5c02d7)[_0x62a7('0x1a')](0x7,_0x62a7('0x1b'))[_0x62a7('0xd')]();_0x28a052[_0x62a7('0x1c')]=_0x28a052[_0x62a7('0x1d')]!=_0x28a052[_0x62a7('0x14')]?'changed':_0x62a7('0x1e');}return _0x28a052;}catch(_0x2f2f9d){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x62a7('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x27a284[_0x62a7('0x9')],'machineUuid':hardware[_0x62a7('0x15')](),'message':_0x2f2f9d[_0x62a7('0x20')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x62a7('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x62a7('0x21'),'uuid':_0x27a284[_0x62a7('0x9')],'machineUuid':hardware[_0x62a7('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x62a7('0x22')]=function(_0x556573){return db[_0x62a7('0x23')][_0x62a7('0x24')](_['defaults'](_0x556573,{'raw':!![],'where':{'id':0x1}}))[_0x62a7('0x25')](function(_0x320df9){return checkLicense(_0x320df9,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 50f735f..a171060 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 _0x5dc7=['exports','http://localhost:9000','app-id','secret'];(function(_0x46361c,_0x5e8a98){var _0x244ad8=function(_0x5f0463){while(--_0x5f0463){_0x46361c['push'](_0x46361c['shift']());}};_0x244ad8(++_0x5e8a98);}(_0x5dc7,0x148));var _0x75dc=function(_0x396e58,_0x3524a3){_0x396e58=_0x396e58-0x0;var _0x51a876=_0x5dc7[_0x396e58];return _0x51a876;};'use strict';module[_0x75dc('0x0')]={'DOMAIN':_0x75dc('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x75dc('0x2'),'GOOGLE_SECRET':_0x75dc('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x3f2b=['exports','myappanuglar-secret','app-id','secret'];(function(_0x3d0dd4,_0x166606){var _0x4b179f=function(_0x5097d6){while(--_0x5097d6){_0x3d0dd4['push'](_0x3d0dd4['shift']());}};_0x4b179f(++_0x166606);}(_0x3f2b,0x1f4));var _0xb3f2=function(_0xdd232b,_0x431359){_0xdd232b=_0xdd232b-0x0;var _0x396801=_0x3f2b[_0xdd232b];return _0x396801;};'use strict';module[_0xb3f2('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xb3f2('0x1'),'GOOGLE_ID':_0xb3f2('0x2'),'GOOGLE_SECRET':_0xb3f2('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8acf91c..7d7f8bd 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbc2=['transports','File','%s-%s','error','info','Console','env','debugLevel','moment','util','path','/var','log','xcally','%s-%s.log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','Logger'];(function(_0x3d592c,_0x4856fd){var _0x43e287=function(_0x2315dd){while(--_0x2315dd){_0x3d592c['push'](_0x3d592c['shift']());}};_0x43e287(++_0x4856fd);}(_0xdbc2,0xb0));var _0x2dbc=function(_0x590caa,_0x19e924){_0x590caa=_0x590caa-0x0;var _0x508f6f=_0xdbc2[_0x590caa];return _0x508f6f;};'use strict';var moment=require(_0x2dbc('0x0'));var winston=require('winston');var util=require(_0x2dbc('0x1'));var path=require(_0x2dbc('0x2'));var debugLevel='INFO';function filename(_0x55d22e,_0x3f0ded){return path['join'](_0x2dbc('0x3'),_0x2dbc('0x4'),_0x2dbc('0x5'),util['format'](_0x2dbc('0x6'),_0x55d22e,_0x3f0ded));}function formatter(_0x3f1942,_0xb6ec1a){return util[_0x2dbc('0x7')](_0x2dbc('0x8'),moment()[_0x2dbc('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0xb6ec1a[_0x2dbc('0x9')][_0x2dbc('0xa')](),_0x3f1942,_0xb6ec1a[_0x2dbc('0xb')]);}module['exports']=function(_0x22e98d){return new winston[(_0x2dbc('0xc'))]({'transports':[new winston[(_0x2dbc('0xd'))][(_0x2dbc('0xe'))]({'name':util[_0x2dbc('0x7')](_0x2dbc('0xf'),_0x22e98d,_0x2dbc('0x10')),'filename':filename(_0x22e98d,_0x2dbc('0x10')),'level':_0x2dbc('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xe3ee8c){return formatter(_0x22e98d,_0xe3ee8c);}}),new winston[(_0x2dbc('0xd'))][(_0x2dbc('0xe'))]({'name':util[_0x2dbc('0x7')]('%s-%s',_0x22e98d,'info'),'filename':filename(_0x22e98d,'info'),'level':_0x2dbc('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x16de2e){return formatter(_0x22e98d,_0x16de2e);}}),new winston['transports'][(_0x2dbc('0x12'))]({'level':process[_0x2dbc('0x13')][_0x2dbc('0x14')]||debugLevel,'json':![],'formatter':function(_0x118639){return formatter(_0x22e98d,_0x118639);}})]});}; \ No newline at end of file +var _0xeca6=['debugLevel','moment','winston','util','INFO','join','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console'];(function(_0x37bb40,_0x259deb){var _0x598fb0=function(_0x49795d){while(--_0x49795d){_0x37bb40['push'](_0x37bb40['shift']());}};_0x598fb0(++_0x259deb);}(_0xeca6,0x1e5));var _0x6eca=function(_0xc50ae8,_0x31b18e){_0xc50ae8=_0xc50ae8-0x0;var _0x21a9ed=_0xeca6[_0xc50ae8];return _0x21a9ed;};'use strict';var moment=require(_0x6eca('0x0'));var winston=require(_0x6eca('0x1'));var util=require(_0x6eca('0x2'));var path=require('path');var debugLevel=_0x6eca('0x3');function filename(_0x5ee6c7,_0x306351){return path[_0x6eca('0x4')]('/var',_0x6eca('0x5'),_0x6eca('0x6'),util[_0x6eca('0x7')](_0x6eca('0x8'),_0x5ee6c7,_0x306351));}function formatter(_0x5a2108,_0x2eb22d){return util['format'](_0x6eca('0x9'),moment()[_0x6eca('0x7')](_0x6eca('0xa')),_0x2eb22d[_0x6eca('0xb')][_0x6eca('0xc')](),_0x5a2108,_0x2eb22d['message']);}module[_0x6eca('0xd')]=function(_0xc712fd){return new winston[(_0x6eca('0xe'))]({'transports':[new winston[(_0x6eca('0xf'))][(_0x6eca('0x10'))]({'name':util[_0x6eca('0x7')](_0x6eca('0x11'),_0xc712fd,_0x6eca('0x12')),'filename':filename(_0xc712fd,_0x6eca('0x12')),'level':_0x6eca('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x123784){return formatter(_0xc712fd,_0x123784);}}),new winston[(_0x6eca('0xf'))][(_0x6eca('0x10'))]({'name':util[_0x6eca('0x7')]('%s-%s',_0xc712fd,_0x6eca('0x13')),'filename':filename(_0xc712fd,_0x6eca('0x13')),'level':_0x6eca('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4eb846){return formatter(_0xc712fd,_0x4eb846);}}),new winston[(_0x6eca('0xf'))][(_0x6eca('0x14'))]({'level':process['env'][_0x6eca('0x15')]||debugLevel,'json':![],'formatter':function(_0x283213){return formatter(_0xc712fd,_0x283213);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a68fdb0..0a1c10b 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 _0xb223=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','express','ami','join','../../services/ami/index.js','agi','email'];(function(_0x3276b6,_0x472d15){var _0x5530f0=function(_0x7003e1){while(--_0x7003e1){_0x3276b6['push'](_0x3276b6['shift']());}};_0x5530f0(++_0x472d15);}(_0xb223,0x194));var _0x3b22=function(_0x485d66,_0x6f04c){_0x485d66=_0x485d66-0x0;var _0x416fe2=_0xb223[_0x485d66];return _0x416fe2;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x3b22('0x0'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x3b22('0x1'),'script':path[_0x3b22('0x2')](__dirname,_0x3b22('0x3'))},{'name':_0x3b22('0x4'),'script':path[_0x3b22('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x3b22('0x5'),'script':path[_0x3b22('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x3b22('0x6'),'script':path[_0x3b22('0x2')](__dirname,_0x3b22('0x7'))},{'name':_0x3b22('0x8'),'script':path[_0x3b22('0x2')](__dirname,_0x3b22('0x9'))}]};module['exports']=config; \ No newline at end of file +var _0x43e4=['../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami'];(function(_0x35140b,_0x1ba1fe){var _0x507a20=function(_0x4fc12a){while(--_0x4fc12a){_0x35140b['push'](_0x35140b['shift']());}};_0x507a20(++_0x1ba1fe);}(_0x43e4,0x68));var _0x443e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x43e4[_0xbd08b4];return _0x314f1e;};'use strict';var path=require(_0x443e('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x443e('0x1')](__dirname,_0x443e('0x2'))},{'name':_0x443e('0x3'),'script':path[_0x443e('0x1')](__dirname,_0x443e('0x4'))},{'name':_0x443e('0x5'),'script':path['join'](__dirname,_0x443e('0x6'))},{'name':'email','script':path[_0x443e('0x1')](__dirname,_0x443e('0x7'))},{'name':'routing','script':path[_0x443e('0x1')](__dirname,_0x443e('0x8'))},{'name':_0x443e('0x9'),'script':path[_0x443e('0x1')](__dirname,_0x443e('0xa'))}]};module[_0x443e('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c097a89..a57908b 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 _0x952a=['bluebird','connect','connected','then','start','stop','restart','disconnect','list','describe','delete','dump','saved','pm2'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x952a,0x1b1));var _0xa952=function(_0x4848c5,_0x2d28c3){_0x4848c5=_0x4848c5-0x0;var _0x74a692=_0x952a[_0x4848c5];return _0x74a692;};'use strict';var pm2=require(_0xa952('0x0'));var BPromise=require(_0xa952('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x413ad6,_0xce2283){return pm2[_0xa952('0x2')](function(_0x26678b){if(_0x26678b){return _0xce2283(_0x26678b);}return _0x413ad6(_0xa952('0x3'));});});};exports['start']=function(_0x427f80){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0x2c41db,_0xdd66b6){return pm2[_0xa952('0x5')](_0x427f80,function(_0x2f727c,_0x5dbb1b){if(_0x2f727c){return _0xdd66b6(_0x2f727c);}pm2['disconnect']();return _0x2c41db(_0x5dbb1b);});});});};exports[_0xa952('0x6')]=function(_0x4d6df9){return connect()['then'](function(){return new BPromise(function(_0x2129e7,_0x4c21c6){return pm2['stop'](_0x4d6df9,function(_0x5977a2,_0x2d114f){if(_0x5977a2){return _0x4c21c6(_0x5977a2);}pm2['disconnect']();return _0x2129e7(_0x2d114f);});});});};exports[_0xa952('0x7')]=function(_0x49a864){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0x2ffdf3,_0x537c41){return pm2[_0xa952('0x7')](_0x49a864,function(_0x165579,_0x261be3){if(_0x165579){return _0x537c41(_0x165579);}pm2[_0xa952('0x8')]();return _0x2ffdf3(_0x261be3);});});});};exports['list']=function(){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0x3ccf0a,_0x2c9f2c){return pm2[_0xa952('0x9')](function(_0xa4c827,_0x44dfbf){if(_0xa4c827){return _0x2c9f2c(_0xa4c827);}pm2[_0xa952('0x8')]();return _0x3ccf0a(_0x44dfbf);});});});};exports['describe']=function(_0x4aa17e){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0xa89509,_0x2cc488){return pm2[_0xa952('0xa')](_0x4aa17e,function(_0x50d733,_0x31e997){if(_0x50d733){return _0x2cc488(_0x50d733);}pm2['disconnect']();return _0xa89509(_0x31e997);});});});};exports[_0xa952('0xb')]=function(_0x153d55){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0x47fb31,_0x20e920){return pm2[_0xa952('0xb')](_0x153d55,function(_0x305c19,_0x3edf9d){if(_0x305c19){return _0x20e920(_0x305c19);}pm2[_0xa952('0x8')]();return _0x47fb31(_0x3edf9d);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x2848b3,_0x2484c4){return pm2[_0xa952('0xc')](function(_0x1ac470){if(_0x1ac470){return _0x2484c4(_0x1ac470);}return _0x2848b3(_0xa952('0xd'));});});});}; \ No newline at end of file +var _0xc21e=['delete','dump','bluebird','./config','connect','start','then','stop','disconnect','restart','list','describe'];(function(_0x5b1db5,_0x559cd7){var _0x39995c=function(_0x18c72f){while(--_0x18c72f){_0x5b1db5['push'](_0x5b1db5['shift']());}};_0x39995c(++_0x559cd7);}(_0xc21e,0x1ca));var _0xec21=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc21e[_0x59ee6f];return _0x4c0979;};'use strict';var pm2=require('pm2');var BPromise=require(_0xec21('0x0'));var config=require(_0xec21('0x1'));function connect(){return new BPromise(function(_0x1aa991,_0x2ad2c0){return pm2[_0xec21('0x2')](function(_0x3af221){if(_0x3af221){return _0x2ad2c0(_0x3af221);}return _0x1aa991('connected');});});};exports[_0xec21('0x3')]=function(_0x3524f1){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0xd94b5d,_0x7fce38){return pm2[_0xec21('0x3')](_0x3524f1,function(_0x406b66,_0x2f15e7){if(_0x406b66){return _0x7fce38(_0x406b66);}pm2['disconnect']();return _0xd94b5d(_0x2f15e7);});});});};exports[_0xec21('0x5')]=function(_0x3d74a2){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0xfbab77,_0x4d478){return pm2['stop'](_0x3d74a2,function(_0x110420,_0x1d5e4b){if(_0x110420){return _0x4d478(_0x110420);}pm2[_0xec21('0x6')]();return _0xfbab77(_0x1d5e4b);});});});};exports['restart']=function(_0x5f059d){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0x276437,_0x53772e){return pm2[_0xec21('0x7')](_0x5f059d,function(_0x2efc12,_0xd9232e){if(_0x2efc12){return _0x53772e(_0x2efc12);}pm2[_0xec21('0x6')]();return _0x276437(_0xd9232e);});});});};exports[_0xec21('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x179b89,_0x55e74e){return pm2[_0xec21('0x8')](function(_0x1987f4,_0x34e6af){if(_0x1987f4){return _0x55e74e(_0x1987f4);}pm2['disconnect']();return _0x179b89(_0x34e6af);});});});};exports[_0xec21('0x9')]=function(_0x3ee6f7){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0x2c3124,_0x324853){return pm2[_0xec21('0x9')](_0x3ee6f7,function(_0x3e538c,_0x350a53){if(_0x3e538c){return _0x324853(_0x3e538c);}pm2['disconnect']();return _0x2c3124(_0x350a53);});});});};exports[_0xec21('0xa')]=function(_0x2f805b){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0x121624,_0x3ab226){return pm2[_0xec21('0xa')](_0x2f805b,function(_0x90c3f5,_0x2aff55){if(_0x90c3f5){return _0x3ab226(_0x90c3f5);}pm2[_0xec21('0x6')]();return _0x121624(_0x2aff55);});});});};exports[_0xec21('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4c244b,_0x127afa){return pm2[_0xec21('0xb')](function(_0x5ab97e){if(_0x5ab97e){return _0x127afa(_0x5ab97e);}return _0x4c244b('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index de28853..be31861 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 _0x138b=['chatInteraction:update','error','moment','ioredis','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','system','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit'];(function(_0x3bc3df,_0x3c19ff){var _0x258ac5=function(_0x2f9a36){while(--_0x2f9a36){_0x3bc3df['push'](_0x3bc3df['shift']());}};_0x258ac5(++_0x3c19ff);}(_0x138b,0x13a));var _0xb138=function(_0x215fe9,_0x493d04){_0x215fe9=_0x215fe9-0x0;var _0x5a196b=_0x138b[_0x215fe9];return _0x5a196b;};'use strict';var _=require('lodash');var moment=require(_0xb138('0x0'));var Redis=require(_0xb138('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xb138('0x2'));config[_0xb138('0x3')]=_[_0xb138('0x4')](config[_0xb138('0x3')],{'host':_0xb138('0x5'),'port':0x18eb});var io=require(_0xb138('0x6'))(new Redis(config['redis']));function closeInteractions(){var _0x2151f1=0x0;var _0x46e517=[];return db[_0xb138('0x7')][_0xb138('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xb138('0x9')](function(_0x31de33){_0x2151f1=_0x31de33[_0xb138('0xa')];if(_0x2151f1){return db[_0xb138('0xb')][_0xb138('0xc')]({'raw':!![],'attributes':['id',_0xb138('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb138('0xe')](_0x31de33[_0xb138('0xa')],_0xb138('0xf'))}}});}else{return[];}})[_0xb138('0x9')](function(_0x51c033){_0x46e517=_0x51c033;if(_0x2151f1){return db[_0xb138('0xb')]['update']({'closeReason':_0xb138('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xb138('0x11')](_0xb138('0x12'))},{'where':{'id':_[_0xb138('0x13')](_0x46e517||[],'id')}});}})['then'](function(_0x28b7d7){for(var _0x5d9476=0x0;_0x5d9476<_0x46e517[_0xb138('0x14')];_0x5d9476++){io[_0xb138('0x15')](_0xb138('0x16'),{'id':_0x46e517[_0x5d9476]['id'],'closed':!![]});}})['catch'](function(_0x2d35ad){console[_0xb138('0x17')](_0x2d35ad);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5396=['update','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','subtract'];(function(_0x1a1932,_0x29b372){var _0x23fdb9=function(_0x3d05e2){while(--_0x3d05e2){_0x1a1932['push'](_0x1a1932['shift']());}};_0x23fdb9(++_0x29b372);}(_0x5396,0x1e6));var _0x6539=function(_0x5a18a5,_0x3957e9){_0x5a18a5=_0x5a18a5-0x0;var _0x308a59=_0x5396[_0x5a18a5];return _0x308a59;};'use strict';var _=require(_0x6539('0x0'));var moment=require(_0x6539('0x1'));var Redis=require(_0x6539('0x2'));var db=require(_0x6539('0x3'))['db'];var config=require(_0x6539('0x4'));config[_0x6539('0x5')]=_[_0x6539('0x6')](config['redis'],{'host':_0x6539('0x7'),'port':0x18eb});var io=require(_0x6539('0x8'))(new Redis(config[_0x6539('0x5')]));function closeInteractions(){var _0xeb57a5=0x0;var _0x188191=[];return db[_0x6539('0x9')]['find']({'raw':!![],'attributes':['id',_0x6539('0xa')],'where':{'id':0x1}})['then'](function(_0x24d96a){_0xeb57a5=_0x24d96a[_0x6539('0xa')];if(_0xeb57a5){return db[_0x6539('0xb')][_0x6539('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6539('0xd')](_0x24d96a['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0x5cae6f){_0x188191=_0x5cae6f;if(_0xeb57a5){return db[_0x6539('0xb')][_0x6539('0xe')]({'closeReason':_0x6539('0xf'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6539('0x10')](_0x6539('0x11'))},{'where':{'id':_['map'](_0x188191||[],'id')}});}})['then'](function(_0x4a426f){for(var _0x43cf6f=0x0;_0x43cf6f<_0x188191['length'];_0x43cf6f++){io[_0x6539('0x12')](_0x6539('0x13'),{'id':_0x188191[_0x43cf6f]['id'],'closed':!![]});}})['catch'](function(_0x2ef944){console['error'](_0x2ef944);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index ba0e89d..4883cf3 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 _0x400b=['info','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','keyBy','difference','intersection','length','toString','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','stop\x20cron','active','update','update\x20cron','run','start','util','path','jayson/promise','bluebird','../logger','schedule','../../mysqldb','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','format','%s.%s','basename','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','error\x20mail','stringify'];(function(_0x534fa5,_0x2d904c){var _0x51c992=function(_0x2f342a){while(--_0x2f342a){_0x534fa5['push'](_0x534fa5['shift']());}};_0x51c992(++_0x2d904c);}(_0x400b,0x7f));var _0xb400=function(_0xf6c441,_0x3b068e){_0xf6c441=_0xf6c441-0x0;var _0x2e073e=_0x400b[_0xf6c441];return _0x2e073e;};'use strict';var fs=require('fs');var util=require(_0xb400('0x0'));var path=require(_0xb400('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0xb400('0x2'));var BPromise=require(_0xb400('0x3'));var logger=require(_0xb400('0x4'))(_0xb400('0x5'));var db=require(_0xb400('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xb400('0x7')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2ba702,_0x1b6b57){return function(){logger['info'](_0xb400('0x8'),_0x2ba702[_0xb400('0x9')]);var _0x216bf5=!![];var _0xba4f4a={'tls':{'rejectUnauthorized':![]}};if(_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0xc')]){_0xba4f4a[_0xb400('0xc')]=_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0xc')];}else{_0xba4f4a[_0xb400('0xd')]=_0x2ba702[_0xb400('0xa')][_0xb400('0xb')]['host'];_0xba4f4a[_0xb400('0xe')]=_0x2ba702[_0xb400('0xa')]['Smtp'][_0xb400('0xe')];_0xba4f4a[_0xb400('0xf')]=_0x2ba702[_0xb400('0xa')]['Smtp'][_0xb400('0xf')];}if(_0x2ba702['MailAccount']['Smtp'][_0xb400('0x10')]){_0xba4f4a[_0xb400('0x11')]={'user':_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0x12')],'pass':_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0x13')]};}var _0xb08797={'account':_0xba4f4a,'message':{'from':util['format'](_0xb400('0x14'),_0x2ba702['MailAccount'][_0xb400('0x15')],_0x2ba702[_0xb400('0xa')]['email']||_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0x12')]),'to':_0x2ba702[_0xb400('0x9')],'cc':_0x2ba702['cc'],'bcc':_0x2ba702[_0xb400('0x16')],'subject':util['format'](_0xb400('0x17'),_0x1b6b57['name'],_0x2ba702[_0xb400('0x18')],_0x2ba702['subtractUnit'])}};var _0x4a61b6=path[_0xb400('0x19')](__dirname,_0xb400('0x1a'));var _0x635fd4=_0x1b6b57[_0xb400('0x1b')];var _0x4380fb=util[_0xb400('0x1c')](_0xb400('0x1d'),path[_0xb400('0x1e')](_0x1b6b57[_0xb400('0x1b')],path['extname'](_0x1b6b57[_0xb400('0x1b')])),_0xb400('0x1f'));var _0x1c0efe=path['join'](_0x4a61b6,_0x635fd4);var _0x33ae40=path[_0xb400('0x19')](_0x4a61b6,_0x4380fb);if(fs[_0xb400('0x20')](_0x1c0efe)){_0x1b6b57['status']=_0xb400('0x21');_0xb08797[_0xb400('0x22')][_0xb400('0x23')]=[{'filename':_0x635fd4,'path':_0x1c0efe}];_0xb08797[_0xb400('0x22')][_0xb400('0x24')]=util[_0xb400('0x1c')](_0xb400('0x25'),JSON['stringify'](_0x1b6b57,null,0x2));}else if(fs[_0xb400('0x20')](_0x33ae40)){_0x1b6b57['status']=_0xb400('0x21');_0xb08797['message'][_0xb400('0x23')]=[{'filename':_0x4380fb,'path':_0x33ae40}];}else{_0xb08797['message'][_0xb400('0x24')]=_0xb400('0x26');if(!_0x2ba702[_0xb400('0x27')]){_0x216bf5=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x216bf5){return client[_0xb400('0x28')]('SendMail',_0xb08797)[_0xb400('0x29')](function(_0x49c622){if(_0x49c622[_0xb400('0x2a')]){return logger[_0xb400('0x2a')](_0xb400('0x2b'),JSON[_0xb400('0x2c')](_0x49c622));}return logger[_0xb400('0x2d')]('email\x20sent');})[_0xb400('0x2e')](function(_0x20ea0e){return logger[_0xb400('0x2a')]('error\x20mail',JSON[_0xb400('0x2c')](_0x20ea0e));});}};}function handleError(){return function(_0x5d9529){return logger[_0xb400('0x2a')](JSON[_0xb400('0x2c')](_0x5d9529));};}function handleResult(_0x2f01a1){return function(_0x3ef401){logger[_0xb400('0x2d')](_0xb400('0x2f'),JSON['stringify'](_0x3ef401));if(_0x2f01a1[_0xb400('0xa')]&&_0x2f01a1[_0xb400('0xa')][_0xb400('0xb')]&&!_[_0xb400('0x30')](_0x2f01a1[_0xb400('0x9')])){setTimeout(handleSendEmail(_0x2f01a1,_0x3ef401),0x3c*0x3e8);}};}function handleJob(_0x3a3388){return function(){try{if(_[_0xb400('0x30')](_0x3a3388[_0xb400('0x18')])){return logger[_0xb400('0x2d')](_0xb400('0x31'));}if(_[_0xb400('0x30')](_0x3a3388[_0xb400('0x32')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x4fec20={'startDate':moment()[_0xb400('0x33')](_0x3a3388[_0xb400('0x18')],_0x3a3388['subtractUnit'])[_0xb400('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xb400('0x34')),'type':'scheduled','output':_0x3a3388[_0xb400('0x35')],'name':_0x3a3388[_0xb400('0x15')]};if(!_[_0xb400('0x30')](_0x3a3388[_0xb400('0x36')])){logger[_0xb400('0x2d')]('exec\x20defaul\x20report\x20id:%s',_0x3a3388[_0xb400('0x36')]);return analyticDefaultReportController[_0xb400('0x37')]({'id':_0x3a3388[_0xb400('0x36')]},_0x4fec20)[_0xb400('0x29')](handleResult(_0x3a3388))[_0xb400('0x2e')](handleError());}if(!_[_0xb400('0x30')](_0x3a3388[_0xb400('0x38')])){logger[_0xb400('0x2d')]('exec\x20custom\x20report\x20id:%s',_0x3a3388[_0xb400('0x38')]);return analyticCustomReportController[_0xb400('0x37')]({'id':_0x3a3388[_0xb400('0x38')]},_0x4fec20)['then'](handleResult(_0x3a3388))[_0xb400('0x2e')](handleError());}}catch(_0x53ef24){logger[_0xb400('0x2a')](JSON['stringify'](_0x53ef24));}return logger[_0xb400('0x2d')](_0xb400('0x39'));};}function getJobs(_0x316960){var _0x447c5a={};if(_0x316960){_0x447c5a['id']=_0x316960;}return db[_0xb400('0x3a')][_0xb400('0x3b')]({'where':_0x447c5a,'include':[{'model':db[_0xb400('0xa')],'attributes':['id',_0xb400('0x15'),'email'],'include':[{'model':db[_0xb400('0x3c')],'as':_0xb400('0xb')}]}]})[_0xb400('0x29')](function(_0x266c89){var _0x459d2c=_['keys'](manager[_0xb400('0x3d')]);var _0x5c165c=_[_0xb400('0x3e')](_0x266c89,function(_0x6c710d){return _0x6c710d['id']['toString']();});var _0x20d8bd=_[_0xb400('0x3f')](_0x266c89,function(_0x1f775a){return _0x1f775a['id']['toString']();});var _0x1e8fde=_0x316960?_0x5c165c:_[_0xb400('0x40')](_0x5c165c,_0x459d2c);var _0x808a65=_[_0xb400('0x41')](_0x5c165c,_0x459d2c);var _0x32f34b=_[_0xb400('0x40')](_0x459d2c,_0x5c165c);var _0xd2bea3;var _0xad99d8;for(_0xd2bea3=0x0;_0xd2bea3<_0x32f34b[_0xb400('0x42')]&&!_0x316960;_0xd2bea3+=0x1){_0xad99d8=_0x32f34b[_0xd2bea3][_0xb400('0x43')]();if(manager[_0xb400('0x44')](_0xad99d8)){manager[_0xb400('0x45')](_0xad99d8);manager[_0xb400('0x46')](_0xad99d8);logger[_0xb400('0x2d')](_0xb400('0x47'),_0xad99d8);}}logger[_0xb400('0x2d')]('toRun',JSON['stringify'](_0x1e8fde));for(_0xd2bea3=0x0;_0xd2bea3<_0x1e8fde[_0xb400('0x42')];_0xd2bea3+=0x1){_0xad99d8=_0x1e8fde[_0xd2bea3][_0xb400('0x43')]();logger[_0xb400('0x2d')](_0xb400('0x48'),_0xad99d8);if(_0x316960){logger[_0xb400('0x2d')](_0xb400('0x49'),_0x316960);logger['info'](JSON[_0xb400('0x2c')](_0x20d8bd[_0xad99d8]));BPromise[_0xb400('0x4a')]()['then'](handleJob(_0x20d8bd[_0xad99d8]));logger['info'](_0xb400('0x4b'),_0x20d8bd[_0xad99d8]['name'],_0x20d8bd[_0xad99d8][_0xb400('0x4c')]);}else if(_0x20d8bd[_0xad99d8][_0xb400('0x4c')]&&_0x20d8bd[_0xad99d8]['active']&&moment()[_0xb400('0x4d')](_0x20d8bd[_0xad99d8][_0xb400('0x4e')],_0x20d8bd[_0xad99d8][_0xb400('0x4f')])){manager['add'](_0xad99d8,_0x20d8bd[_0xad99d8][_0xb400('0x4c')],handleJob(_0x20d8bd[_0xad99d8]));manager['start'](_0xad99d8);logger['info']('add\x20cron',_0x20d8bd[_0xad99d8][_0xb400('0x15')],_0x20d8bd[_0xad99d8][_0xb400('0x4c')]);}else if(manager[_0xb400('0x44')](_0xad99d8)){manager[_0xb400('0x45')](_0xad99d8);manager[_0xb400('0x46')](_0xad99d8);logger[_0xb400('0x2d')](_0xb400('0x50'),_0x20d8bd[_0xad99d8][_0xb400('0x15')],_0x20d8bd[_0xad99d8][_0xb400('0x4c')]);}}for(_0xd2bea3=0x0,_0xad99d8;_0xd2bea3<_0x808a65['length']&&!_0x316960;_0xd2bea3+=0x1){_0xad99d8=_0x808a65[_0xd2bea3][_0xb400('0x43')]();if(manager[_0xb400('0x44')](_0xad99d8)){if(_0x20d8bd[_0xad99d8][_0xb400('0x4c')]&&_0x20d8bd[_0xad99d8][_0xb400('0x51')]&&moment()[_0xb400('0x4d')](_0x20d8bd[_0xad99d8][_0xb400('0x4e')],_0x20d8bd[_0xad99d8][_0xb400('0x4f')])){manager[_0xb400('0x52')](_0xad99d8,_0x20d8bd[_0xad99d8][_0xb400('0x4c')],handleJob(_0x20d8bd[_0xad99d8]));logger[_0xb400('0x2d')](_0xb400('0x53'),_0x20d8bd[_0xad99d8][_0xb400('0x15')],_0x20d8bd[_0xad99d8][_0xb400('0x4c')]);}else{manager[_0xb400('0x45')](_0xad99d8);manager[_0xb400('0x46')](_0xad99d8);logger[_0xb400('0x2d')](_0xb400('0x50'),_0x20d8bd[_0xad99d8][_0xb400('0x15')],_0x20d8bd[_0xad99d8]['cron']);}}}})[_0xb400('0x2e')](function(_0x1ac1b1){logger[_0xb400('0x2a')](JSON[_0xb400('0x2c')](_0x1ac1b1));});}exports[_0xb400('0x54')]=function(_0x4c536b){return getJobs(_0x4c536b);};exports[_0xb400('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x48c9=['exec\x20custom\x20report\x20id:%s','no\x20report\x20id','MailServerOut','jobs','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','endAt','add','start','add\x20cron','isBetween','startAt','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','auth','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','%s.%s','extname','savename','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x48c9,0x76));var _0x948c=function(_0x385fed,_0x3a4757){_0x385fed=_0x385fed-0x0;var _0x52fa25=_0x48c9[_0x385fed];return _0x52fa25;};'use strict';var fs=require('fs');var util=require(_0x948c('0x0'));var path=require(_0x948c('0x1'));var _=require(_0x948c('0x2'));var moment=require('moment');var CronJobManager=require(_0x948c('0x3'));var jayson=require(_0x948c('0x4'));var BPromise=require('bluebird');var logger=require(_0x948c('0x5'))(_0x948c('0x6'));var db=require(_0x948c('0x7'))['db'];var analyticCustomReportController=require(_0x948c('0x8'));var analyticDefaultReportController=require(_0x948c('0x9'));var client=jayson[_0x948c('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4b224e,_0x33a2ca){return function(){logger[_0x948c('0xb')](_0x948c('0xc'),_0x4b224e[_0x948c('0xd')]);var _0x2e682f=!![];var _0x4c4f28={'tls':{'rejectUnauthorized':![]}};if(_0x4b224e['MailAccount'][_0x948c('0xe')][_0x948c('0xf')]){_0x4c4f28[_0x948c('0xf')]=_0x4b224e[_0x948c('0x10')][_0x948c('0xe')]['service'];}else{_0x4c4f28[_0x948c('0x11')]=_0x4b224e[_0x948c('0x10')][_0x948c('0xe')][_0x948c('0x11')];_0x4c4f28[_0x948c('0x12')]=_0x4b224e[_0x948c('0x10')]['Smtp'][_0x948c('0x12')];_0x4c4f28[_0x948c('0x13')]=_0x4b224e[_0x948c('0x10')][_0x948c('0xe')]['secure'];}if(_0x4b224e[_0x948c('0x10')][_0x948c('0xe')]['authentication']){_0x4c4f28[_0x948c('0x14')]={'user':_0x4b224e['MailAccount'][_0x948c('0xe')]['user'],'pass':_0x4b224e[_0x948c('0x10')][_0x948c('0xe')][_0x948c('0x15')]};}var _0x126dd6={'account':_0x4c4f28,'message':{'from':util[_0x948c('0x16')](_0x948c('0x17'),_0x4b224e['MailAccount'][_0x948c('0x18')],_0x4b224e['MailAccount']['email']||_0x4b224e['MailAccount'][_0x948c('0xe')]['user']),'to':_0x4b224e[_0x948c('0xd')],'cc':_0x4b224e['cc'],'bcc':_0x4b224e[_0x948c('0x19')],'subject':util[_0x948c('0x16')](_0x948c('0x1a'),_0x33a2ca[_0x948c('0x18')],_0x4b224e['subtractNumber'],_0x4b224e[_0x948c('0x1b')])}};var _0x3a616b=path[_0x948c('0x1c')](__dirname,'../../files/reports');var _0x5e6e5d=_0x33a2ca['savename'];var _0x5be3bc=util[_0x948c('0x16')](_0x948c('0x1d'),path['basename'](_0x33a2ca['savename'],path[_0x948c('0x1e')](_0x33a2ca[_0x948c('0x1f')])),_0x948c('0x20'));var _0x1d8f9c=path[_0x948c('0x1c')](_0x3a616b,_0x5e6e5d);var _0xab0cb6=path[_0x948c('0x1c')](_0x3a616b,_0x5be3bc);if(fs[_0x948c('0x21')](_0x1d8f9c)){_0x33a2ca[_0x948c('0x22')]=_0x948c('0x23');_0x126dd6[_0x948c('0x24')][_0x948c('0x25')]=[{'filename':_0x5e6e5d,'path':_0x1d8f9c}];_0x126dd6[_0x948c('0x24')]['text']=util[_0x948c('0x16')](_0x948c('0x26'),JSON[_0x948c('0x27')](_0x33a2ca,null,0x2));}else if(fs['existsSync'](_0xab0cb6)){_0x33a2ca[_0x948c('0x22')]=_0x948c('0x23');_0x126dd6[_0x948c('0x24')][_0x948c('0x25')]=[{'filename':_0x5be3bc,'path':_0xab0cb6}];}else{_0x126dd6[_0x948c('0x24')][_0x948c('0x28')]=_0x948c('0x29');if(!_0x4b224e['sendIfEmpty']){_0x2e682f=![];logger[_0x948c('0xb')](_0x948c('0x2a'));}}if(_0x2e682f){return client[_0x948c('0x2b')](_0x948c('0x2c'),_0x126dd6)[_0x948c('0x2d')](function(_0x32f56e){if(_0x32f56e['error']){return logger[_0x948c('0x2e')]('error\x20mail',JSON[_0x948c('0x27')](_0x32f56e));}return logger[_0x948c('0xb')](_0x948c('0x2f'));})[_0x948c('0x30')](function(_0x3cd0b2){return logger[_0x948c('0x2e')]('error\x20mail',JSON[_0x948c('0x27')](_0x3cd0b2));});}};}function handleError(){return function(_0x403c4d){return logger[_0x948c('0x2e')](JSON['stringify'](_0x403c4d));};}function handleResult(_0x466bab){return function(_0x4cc3b4){logger['info'](_0x948c('0x31'),JSON[_0x948c('0x27')](_0x4cc3b4));if(_0x466bab[_0x948c('0x10')]&&_0x466bab[_0x948c('0x10')][_0x948c('0xe')]&&!_[_0x948c('0x32')](_0x466bab[_0x948c('0xd')])){setTimeout(handleSendEmail(_0x466bab,_0x4cc3b4),0x3c*0x3e8);}};}function handleJob(_0x32e6f9){return function(){try{if(_[_0x948c('0x32')](_0x32e6f9[_0x948c('0x33')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x32e6f9[_0x948c('0x1b')])){return logger[_0x948c('0xb')](_0x948c('0x34'));}var _0x8a5fa={'startDate':moment()['subtract'](_0x32e6f9[_0x948c('0x33')],_0x32e6f9[_0x948c('0x1b')])[_0x948c('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x948c('0x16')](_0x948c('0x35')),'type':_0x948c('0x36'),'output':_0x32e6f9[_0x948c('0x37')],'name':_0x32e6f9[_0x948c('0x18')]};if(!_[_0x948c('0x32')](_0x32e6f9['DefaultReportId'])){logger[_0x948c('0xb')](_0x948c('0x38'),_0x32e6f9[_0x948c('0x39')]);return analyticDefaultReportController[_0x948c('0x3a')]({'id':_0x32e6f9[_0x948c('0x39')]},_0x8a5fa)[_0x948c('0x2d')](handleResult(_0x32e6f9))[_0x948c('0x30')](handleError());}if(!_[_0x948c('0x32')](_0x32e6f9[_0x948c('0x3b')])){logger['info'](_0x948c('0x3c'),_0x32e6f9[_0x948c('0x3b')]);return analyticCustomReportController[_0x948c('0x3a')]({'id':_0x32e6f9[_0x948c('0x3b')]},_0x8a5fa)[_0x948c('0x2d')](handleResult(_0x32e6f9))[_0x948c('0x30')](handleError());}}catch(_0x296acf){logger[_0x948c('0x2e')](JSON['stringify'](_0x296acf));}return logger['info'](_0x948c('0x3d'));};}function getJobs(_0x41713b){var _0x6aa7b7={};if(_0x41713b){_0x6aa7b7['id']=_0x41713b;}return db['Schedule']['findAll']({'where':_0x6aa7b7,'include':[{'model':db[_0x948c('0x10')],'attributes':['id',_0x948c('0x18'),'email'],'include':[{'model':db[_0x948c('0x3e')],'as':_0x948c('0xe')}]}]})['then'](function(_0x3f34e9){var _0x25fc44=_['keys'](manager[_0x948c('0x3f')]);var _0x405a02=_[_0x948c('0x40')](_0x3f34e9,function(_0x3adaf2){return _0x3adaf2['id'][_0x948c('0x41')]();});var _0xc636e3=_[_0x948c('0x42')](_0x3f34e9,function(_0x529f54){return _0x529f54['id']['toString']();});var _0x54ab57=_0x41713b?_0x405a02:_['difference'](_0x405a02,_0x25fc44);var _0xe3a825=_[_0x948c('0x43')](_0x405a02,_0x25fc44);var _0x22478a=_[_0x948c('0x44')](_0x25fc44,_0x405a02);var _0x444873;var _0xde17f9;for(_0x444873=0x0;_0x444873<_0x22478a[_0x948c('0x45')]&&!_0x41713b;_0x444873+=0x1){_0xde17f9=_0x22478a[_0x444873]['toString']();if(manager[_0x948c('0x46')](_0xde17f9)){manager[_0x948c('0x47')](_0xde17f9);manager[_0x948c('0x48')](_0xde17f9);logger[_0x948c('0xb')](_0x948c('0x49'),_0xde17f9);}}logger[_0x948c('0xb')]('toRun',JSON[_0x948c('0x27')](_0x54ab57));for(_0x444873=0x0;_0x444873<_0x54ab57[_0x948c('0x45')];_0x444873+=0x1){_0xde17f9=_0x54ab57[_0x444873][_0x948c('0x41')]();logger['info'](_0x948c('0x4a'),_0xde17f9);if(_0x41713b){logger[_0x948c('0xb')](_0x948c('0x4b'),_0x41713b);logger[_0x948c('0xb')](JSON[_0x948c('0x27')](_0xc636e3[_0xde17f9]));BPromise[_0x948c('0x4c')]()['then'](handleJob(_0xc636e3[_0xde17f9]));logger[_0x948c('0xb')](_0x948c('0x4d'),_0xc636e3[_0xde17f9][_0x948c('0x18')],_0xc636e3[_0xde17f9][_0x948c('0x4e')]);}else if(_0xc636e3[_0xde17f9][_0x948c('0x4e')]&&_0xc636e3[_0xde17f9][_0x948c('0x4f')]&&moment()['isBetween'](_0xc636e3[_0xde17f9]['startAt'],_0xc636e3[_0xde17f9][_0x948c('0x50')])){manager[_0x948c('0x51')](_0xde17f9,_0xc636e3[_0xde17f9]['cron'],handleJob(_0xc636e3[_0xde17f9]));manager[_0x948c('0x52')](_0xde17f9);logger['info'](_0x948c('0x53'),_0xc636e3[_0xde17f9][_0x948c('0x18')],_0xc636e3[_0xde17f9][_0x948c('0x4e')]);}else if(manager['exists'](_0xde17f9)){manager[_0x948c('0x47')](_0xde17f9);manager[_0x948c('0x48')](_0xde17f9);logger[_0x948c('0xb')]('stop\x20cron',_0xc636e3[_0xde17f9][_0x948c('0x18')],_0xc636e3[_0xde17f9][_0x948c('0x4e')]);}}for(_0x444873=0x0,_0xde17f9;_0x444873<_0xe3a825[_0x948c('0x45')]&&!_0x41713b;_0x444873+=0x1){_0xde17f9=_0xe3a825[_0x444873]['toString']();if(manager[_0x948c('0x46')](_0xde17f9)){if(_0xc636e3[_0xde17f9]['cron']&&_0xc636e3[_0xde17f9][_0x948c('0x4f')]&&moment()[_0x948c('0x54')](_0xc636e3[_0xde17f9][_0x948c('0x55')],_0xc636e3[_0xde17f9]['endAt'])){manager[_0x948c('0x56')](_0xde17f9,_0xc636e3[_0xde17f9]['cron'],handleJob(_0xc636e3[_0xde17f9]));logger[_0x948c('0xb')](_0x948c('0x57'),_0xc636e3[_0xde17f9]['name'],_0xc636e3[_0xde17f9][_0x948c('0x4e')]);}else{manager[_0x948c('0x47')](_0xde17f9);manager[_0x948c('0x48')](_0xde17f9);logger[_0x948c('0xb')]('stop\x20cron',_0xc636e3[_0xde17f9][_0x948c('0x18')],_0xc636e3[_0xde17f9]['cron']);}}}})[_0x948c('0x30')](function(_0x5dea8b){logger[_0x948c('0x2e')](JSON[_0x948c('0x27')](_0x5dea8b));});}exports[_0x948c('0x58')]=function(_0x1b42b1){return getJobs(_0x1b42b1);};exports[_0x948c('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index ebb57dd..51271f6 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 _0xe24b=['request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','Cloud\x20Provider\x20not\x20configured','catch','SequelizeValidationError','error','VoiceRecording','findAll','Setting','transcribeAccountId','forEach','push','name','start','lodash','aws-sdk'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xe24b,0x1da));var _0xbe24=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xe24b[_0x2f5a22];return _0x326b70;};var _=require(_0xbe24('0x0'));var AWS=require(_0xbe24('0x1'));var rp=require(_0xbe24('0x2'));var util=require(_0xbe24('0x3'));var BPromise=require(_0xbe24('0x4'));var db=require(_0xbe24('0x5'))['db'];var logger=require(_0xbe24('0x6'))(_0xbe24('0x7'));function getTranscriptionJob(_0x1b5d11,_0x4b1419,_0x5cb582,_0x24da15){return new Promise(function(_0x55d723,_0xd16ea5){var _0x317e46=new AWS[(_0xbe24('0x8'))]({'accessKeyId':_0x4b1419,'secretAccessKey':_0x1b5d11,'region':_0x5cb582});_0x317e46['getTranscriptionJob']({'TranscriptionJobName':_0x24da15},function(_0x2e6970,_0x3721b2){if(_0x2e6970){return _0xd16ea5(_0x2e6970);}else{return _0x55d723(_0x3721b2);}});});}function sentiment(_0x9f707d,_0x43f898,_0x1d11d6,_0x2d11b7,_0x4ff4ec){return new Promise(function(_0x3a4d1f,_0x4e878f){var _0x56cd73=new AWS['Comprehend']({'accessKeyId':_0x43f898,'secretAccessKey':_0x9f707d,'region':_0x1d11d6});_0x56cd73[_0xbe24('0x9')]({'Text':_0x2d11b7,'LanguageCode':_0x4ff4ec[_0xbe24('0xa')](0x0,0x2)},function(_0x1d7afa,_0xa300d5){if(_0x1d7afa){return _0x4e878f(_0x1d7afa);}else{return _0x3a4d1f(_0xa300d5);}});});}function checkTranscribeJob(_0x2c4bff,_0x2962cb,_0x436928){var _0x2281a8;return new BPromise(function(_0x215291,_0x1d485d){logger['info'](util[_0xbe24('0xb')](_0xbe24('0xc'),_0x2c4bff['id'],_0x2c4bff[_0xbe24('0xd')]));return getTranscriptionJob(_0x436928[_0xbe24('0xe')],_0x436928[_0xbe24('0xf')],_0x2962cb[_0xbe24('0x10')],_0x2c4bff['transcribeName'])[_0xbe24('0x11')](function(_0x5dbad6){logger['info'](util[_0xbe24('0xb')](_0xbe24('0x12'),_0x2c4bff['id'],_0x2c4bff[_0xbe24('0xd')],_0x5dbad6[_0xbe24('0x13')][_0xbe24('0x14')]));if(!_0x2c4bff[_0xbe24('0x15')]){switch(_0x5dbad6[_0xbe24('0x13')][_0xbe24('0x14')]){case _0xbe24('0x16'):var _0x3aafa9={'transcribeStatus':_0x5dbad6[_0xbe24('0x13')][_0xbe24('0x14')],'fileUri':_0x5dbad6[_0xbe24('0x13')]['Transcript'][_0xbe24('0x17')]};logger[_0xbe24('0x18')](util[_0xbe24('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x2c4bff['id']));return rp({'uri':_0x5dbad6[_0xbe24('0x13')]['Transcript'][_0xbe24('0x17')],'json':!![]})[_0xbe24('0x11')](function(_0x64aa44){logger[_0xbe24('0x18')](util[_0xbe24('0xb')](_0xbe24('0x19'),_0x2c4bff['id']));if(_0x64aa44&&_0x64aa44['results']&&_0x64aa44[_0xbe24('0x1a')][_0xbe24('0x1b')]&&_0x64aa44[_0xbe24('0x1a')][_0xbe24('0x1b')][_0xbe24('0x1c')]){_0x3aafa9[_0xbe24('0x15')]='';for(var _0x1ac651=0x0;_0x1ac651<_0x64aa44[_0xbe24('0x1a')][_0xbe24('0x1b')][_0xbe24('0x1c')];_0x1ac651++){_0x3aafa9[_0xbe24('0x15')]+=_0x64aa44[_0xbe24('0x1a')][_0xbe24('0x1b')][_0x1ac651][_0xbe24('0x1d')]+'';}}return _0x2c4bff['update'](_0x3aafa9);})['then'](function(){logger[_0xbe24('0x18')](util['format'](_0xbe24('0x1e'),_0x2c4bff['id']));if(!_0x2c4bff[_0xbe24('0x1f')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2962cb[_0xbe24('0x22')]||!_0x2962cb['sentimentAccountId']||!_0x2962cb['sentimentRegion']||!_0x2962cb['language']||!_0x2962cb[_0xbe24('0x23')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x24'));}if(!_0x3aafa9[_0xbe24('0x15')]){throw new Error(_0xbe24('0x25'));}if(_0x2962cb['sentimentAccountId']===_0x436928['id']){return _0x436928;}else{return db[_0xbe24('0x26')][_0xbe24('0x27')]({'where':{'id':_settings[_0xbe24('0x28')]}});}})['then'](function(_0x4d6441){if(!_0x4d6441){throw new db[(_0xbe24('0x20'))]['ValidationError'](_0xbe24('0x29'));}if(!_0x4d6441[_0xbe24('0xe')]||!_0x4d6441[_0xbe24('0xf')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x2281a8=_0x4d6441;logger[_0xbe24('0x18')](util[_0xbe24('0xb')](_0xbe24('0x2a'),_0x2c4bff['id']));return sentiment(_0x2281a8[_0xbe24('0xe')],_0x2281a8[_0xbe24('0xf')],_0x2962cb[_0xbe24('0x2b')],_0x3aafa9['fileText'],_0x2962cb[_0xbe24('0x2c')]);})[_0xbe24('0x11')](function(_0x3af21f){logger['info'](util['format'](_0xbe24('0x2d'),_0x2c4bff['id']));return _0x2c4bff[_0xbe24('0x2e')]({'sentiment':_0x3af21f[_0xbe24('0x2f')],'sPositive':_0x3af21f[_0xbe24('0x30')]['Positive'],'sNegative':_0x3af21f[_0xbe24('0x30')][_0xbe24('0x31')],'sMixed':_0x3af21f[_0xbe24('0x30')][_0xbe24('0x32')],'sNeutral':_0x3af21f[_0xbe24('0x30')][_0xbe24('0x33')]});})[_0xbe24('0x11')](function(){logger[_0xbe24('0x18')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2c4bff['id']));_0x215291();});case _0xbe24('0x34'):return _0x2c4bff[_0xbe24('0x2e')]({'transcribeStatus':_0xbe24('0x34'),'failureReason':_0x5dbad6[_0xbe24('0x13')][_0xbe24('0x35')]})[_0xbe24('0x11')](function(){logger['info'](util['format'](_0xbe24('0x1e'),_0x2c4bff['id']));_0x215291();});default:logger['info'](util[_0xbe24('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2c4bff['id']));break;}}else{return BPromise[_0xbe24('0x36')]()['then'](function(){if(!_0x2c4bff[_0xbe24('0x1f')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x37'));}if(!_0x2962cb['sentiment']||!_0x2962cb['sentimentAccountId']||!_0x2962cb[_0xbe24('0x2b')]||!_0x2962cb['language']||!_0x2962cb[_0xbe24('0x23')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x24'));}if(!_0x2c4bff[_0xbe24('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x2962cb[_0xbe24('0x28')]===_0x436928['id']){return _0x436928;}else{return db[_0xbe24('0x26')][_0xbe24('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xbe24('0x11')](function(_0x1907fe){if(!_0x1907fe){throw new db['Sequelize']['ValidationError'](_0xbe24('0x29'));}if(!_0x1907fe[_0xbe24('0xe')]||!_0x1907fe[_0xbe24('0xf')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x38'));}_0x2281a8=_0x1907fe;logger[_0xbe24('0x18')](util[_0xbe24('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2c4bff['id']));return sentiment(_0x2281a8[_0xbe24('0xe')],_0x2281a8['data2'],_0x2962cb['sentimentRegion'],_0x2c4bff[_0xbe24('0x15')],_0x2962cb['language']);})[_0xbe24('0x11')](function(_0x3a31cd){logger[_0xbe24('0x18')](util[_0xbe24('0xb')](_0xbe24('0x2d'),_0x2c4bff['id']));return _0x2c4bff['update']({'sentiment':_0x3a31cd[_0xbe24('0x2f')],'sPositive':_0x3a31cd[_0xbe24('0x30')]['Positive'],'sNegative':_0x3a31cd[_0xbe24('0x30')][_0xbe24('0x31')],'sMixed':_0x3a31cd[_0xbe24('0x30')][_0xbe24('0x32')],'sNeutral':_0x3a31cd['SentimentScore']['Neutral'],'transcribeStatus':'COMPLETED'});})[_0xbe24('0x11')](function(){logger[_0xbe24('0x18')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2c4bff['id']));_0x215291();});}})[_0xbe24('0x39')](function(_0x89837f){if(_0x89837f){if(!_0x89837f['name']||_0x89837f['name']!==_0xbe24('0x3a')){logger[_0xbe24('0x3b')](util[_0xbe24('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2c4bff['id']),util['inspect'](_0x89837f,{'showHidden':![],'depth':null}));}}_0x215291();});});}function checkTranscribe(){var _0x2dee5e;var _0xeaed72;var _0x30db39;return db[_0xbe24('0x3c')][_0xbe24('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x2d7670){if(!_0x2d7670||!_0x2d7670['length']){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2dee5e=_0x2d7670;return db[_0xbe24('0x3e')][_0xbe24('0x27')]({'where':{'id':0x1}});})[_0xbe24('0x11')](function(_0x410c22){if(!_0x410c22){throw new db['Sequelize'][(_0xbe24('0x21'))]('Settings\x20not\x20available');}_0xeaed72=_0x410c22;if(!_0xeaed72[_0xbe24('0x7')]||!_0xeaed72[_0xbe24('0x3f')]||!_0xeaed72[_0xbe24('0x10')]||!_0xeaed72[_0xbe24('0x2c')]||!_0xeaed72[_0xbe24('0x23')]){throw new db['Sequelize'][(_0xbe24('0x21'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xbe24('0x27')]({'where':{'id':_0xeaed72['transcribeAccountId']}});})[_0xbe24('0x11')](function(_0x831c86){if(!_0x831c86){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x29'));}if(!_0x831c86[_0xbe24('0xe')]||!_0x831c86[_0xbe24('0xf')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x30db39=_0x831c86;var _0x1bbd0b=[];_0x2dee5e[_0xbe24('0x40')](function(_0x444411){_0x1bbd0b[_0xbe24('0x41')](checkTranscribeJob(_0x444411,_0xeaed72,_0x30db39));});return BPromise['all'](_0x1bbd0b);})[_0xbe24('0x39')](function(_0x12cbef){if(_0x12cbef){if(!_0x12cbef[_0xbe24('0x42')]||_0x12cbef[_0xbe24('0x42')]!==_0xbe24('0x3a')){logger[_0xbe24('0x3b')](util['inspect'](_0x12cbef,{'showHidden':![],'depth':null}));}}});}exports[_0xbe24('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0a8f=['bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','data1','data2','transcribeRegion','transcribeName','then','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','TranscriptionJob','Transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','Sequelize','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','bucket','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','all','catch','start','lodash','aws-sdk','request-promise'];(function(_0x32f506,_0x5742dc){var _0x4facc8=function(_0x17049d){while(--_0x17049d){_0x32f506['push'](_0x32f506['shift']());}};_0x4facc8(++_0x5742dc);}(_0x0a8f,0xe1));var _0xf0a8=function(_0x138c78,_0x1e93fe){_0x138c78=_0x138c78-0x0;var _0x3135d3=_0x0a8f[_0x138c78];return _0x3135d3;};var _=require(_0xf0a8('0x0'));var AWS=require(_0xf0a8('0x1'));var rp=require(_0xf0a8('0x2'));var util=require('util');var BPromise=require(_0xf0a8('0x3'));var db=require(_0xf0a8('0x4'))['db'];var logger=require(_0xf0a8('0x5'))(_0xf0a8('0x6'));function getTranscriptionJob(_0x4dbc86,_0x3d5e53,_0x451e09,_0x1cc983){return new Promise(function(_0xe84e97,_0x3e297f){var _0xbd4617=new AWS[(_0xf0a8('0x7'))]({'accessKeyId':_0x3d5e53,'secretAccessKey':_0x4dbc86,'region':_0x451e09});_0xbd4617[_0xf0a8('0x8')]({'TranscriptionJobName':_0x1cc983},function(_0x407f8f,_0x26632f){if(_0x407f8f){return _0x3e297f(_0x407f8f);}else{return _0xe84e97(_0x26632f);}});});}function sentiment(_0x91e23a,_0x13c970,_0x4e54a0,_0x124bce,_0x4f2d90){return new Promise(function(_0x5bf883,_0x4ada49){var _0x1b26c3=new AWS['Comprehend']({'accessKeyId':_0x13c970,'secretAccessKey':_0x91e23a,'region':_0x4e54a0});_0x1b26c3[_0xf0a8('0x9')]({'Text':_0x124bce,'LanguageCode':_0x4f2d90[_0xf0a8('0xa')](0x0,0x2)},function(_0x3e533f,_0x2a73ab){if(_0x3e533f){return _0x4ada49(_0x3e533f);}else{return _0x5bf883(_0x2a73ab);}});});}function checkTranscribeJob(_0x55ac9b,_0xb833ff,_0x2652d7){var _0x44e4b3;return new BPromise(function(_0x320f50,_0x106241){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x55ac9b['id'],_0x55ac9b['transcribeName']));return getTranscriptionJob(_0x2652d7[_0xf0a8('0xd')],_0x2652d7[_0xf0a8('0xe')],_0xb833ff[_0xf0a8('0xf')],_0x55ac9b[_0xf0a8('0x10')])[_0xf0a8('0x11')](function(_0x5a7f9c){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x55ac9b['id'],_0x55ac9b[_0xf0a8('0x10')],_0x5a7f9c['TranscriptionJob'][_0xf0a8('0x12')]));if(!_0x55ac9b[_0xf0a8('0x13')]){switch(_0x5a7f9c['TranscriptionJob']['TranscriptionJobStatus']){case _0xf0a8('0x14'):var _0x4de3dc={'transcribeStatus':_0x5a7f9c['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x5a7f9c['TranscriptionJob']['Transcript'][_0xf0a8('0x15')]};logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x16'),_0x55ac9b['id']));return rp({'uri':_0x5a7f9c[_0xf0a8('0x17')][_0xf0a8('0x18')][_0xf0a8('0x15')],'json':!![]})[_0xf0a8('0x11')](function(_0x224e88){logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x55ac9b['id']));if(_0x224e88&&_0x224e88[_0xf0a8('0x19')]&&_0x224e88[_0xf0a8('0x19')][_0xf0a8('0x1a')]&&_0x224e88[_0xf0a8('0x19')][_0xf0a8('0x1a')]['length']){_0x4de3dc[_0xf0a8('0x13')]='';for(var _0x18ad0e=0x0;_0x18ad0e<_0x224e88[_0xf0a8('0x19')][_0xf0a8('0x1a')][_0xf0a8('0x1b')];_0x18ad0e++){_0x4de3dc[_0xf0a8('0x13')]+=_0x224e88['results']['transcripts'][_0x18ad0e][_0xf0a8('0x1c')]+'';}}return _0x55ac9b[_0xf0a8('0x1d')](_0x4de3dc);})[_0xf0a8('0x11')](function(){logger[_0xf0a8('0xb')](util['format'](_0xf0a8('0x1e'),_0x55ac9b['id']));if(!_0x55ac9b[_0xf0a8('0x1f')]){throw new db['Sequelize'][(_0xf0a8('0x20'))](_0xf0a8('0x21'));}if(!_0xb833ff[_0xf0a8('0x22')]||!_0xb833ff['sentimentAccountId']||!_0xb833ff[_0xf0a8('0x23')]||!_0xb833ff[_0xf0a8('0x24')]||!_0xb833ff['bucket']){throw new db['Sequelize'][(_0xf0a8('0x20'))](_0xf0a8('0x25'));}if(!_0x4de3dc[_0xf0a8('0x13')]){throw new Error(_0xf0a8('0x26'));}if(_0xb833ff[_0xf0a8('0x27')]===_0x2652d7['id']){return _0x2652d7;}else{return db[_0xf0a8('0x28')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf0a8('0x11')](function(_0x55d965){if(!_0x55d965){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x2a'));}if(!_0x55d965['data1']||!_0x55d965[_0xf0a8('0xe')]){throw new db['Sequelize'][(_0xf0a8('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x44e4b3=_0x55d965;logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x2b'),_0x55ac9b['id']));return sentiment(_0x44e4b3[_0xf0a8('0xd')],_0x44e4b3[_0xf0a8('0xe')],_0xb833ff[_0xf0a8('0x23')],_0x4de3dc[_0xf0a8('0x13')],_0xb833ff[_0xf0a8('0x24')]);})[_0xf0a8('0x11')](function(_0x1a8b3d){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x2c'),_0x55ac9b['id']));return _0x55ac9b[_0xf0a8('0x1d')]({'sentiment':_0x1a8b3d[_0xf0a8('0x2d')],'sPositive':_0x1a8b3d[_0xf0a8('0x2e')][_0xf0a8('0x2f')],'sNegative':_0x1a8b3d[_0xf0a8('0x2e')][_0xf0a8('0x30')],'sMixed':_0x1a8b3d[_0xf0a8('0x2e')][_0xf0a8('0x31')],'sNeutral':_0x1a8b3d['SentimentScore'][_0xf0a8('0x32')]});})[_0xf0a8('0x11')](function(){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x1e'),_0x55ac9b['id']));_0x320f50();});case'FAILED':return _0x55ac9b['update']({'transcribeStatus':_0xf0a8('0x33'),'failureReason':_0x5a7f9c[_0xf0a8('0x17')][_0xf0a8('0x34')]})[_0xf0a8('0x11')](function(){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x1e'),_0x55ac9b['id']));_0x320f50();});default:logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x35'),_0x55ac9b['id']));break;}}else{return BPromise[_0xf0a8('0x36')]()[_0xf0a8('0x11')](function(){if(!_0x55ac9b[_0xf0a8('0x1f')]){throw new db[(_0xf0a8('0x29'))]['ValidationError'](_0xf0a8('0x21'));}if(!_0xb833ff[_0xf0a8('0x22')]||!_0xb833ff[_0xf0a8('0x27')]||!_0xb833ff['sentimentRegion']||!_0xb833ff[_0xf0a8('0x24')]||!_0xb833ff['bucket']){throw new db[(_0xf0a8('0x29'))]['ValidationError'](_0xf0a8('0x25'));}if(!_0x55ac9b[_0xf0a8('0x13')]){throw new Error(_0xf0a8('0x26'));}if(_0xb833ff[_0xf0a8('0x27')]===_0x2652d7['id']){return _0x2652d7;}else{return db[_0xf0a8('0x28')][_0xf0a8('0x37')]({'where':{'id':_settings[_0xf0a8('0x27')]}});}})[_0xf0a8('0x11')](function(_0xba3dc1){if(!_0xba3dc1){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x2a'));}if(!_0xba3dc1[_0xf0a8('0xd')]||!_0xba3dc1['data2']){throw new db[(_0xf0a8('0x29'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x44e4b3=_0xba3dc1;logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x55ac9b['id']));return sentiment(_0x44e4b3[_0xf0a8('0xd')],_0x44e4b3[_0xf0a8('0xe')],_0xb833ff[_0xf0a8('0x23')],_0x55ac9b[_0xf0a8('0x13')],_0xb833ff['language']);})[_0xf0a8('0x11')](function(_0x25f36b){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x2c'),_0x55ac9b['id']));return _0x55ac9b[_0xf0a8('0x1d')]({'sentiment':_0x25f36b[_0xf0a8('0x2d')],'sPositive':_0x25f36b[_0xf0a8('0x2e')]['Positive'],'sNegative':_0x25f36b[_0xf0a8('0x2e')][_0xf0a8('0x30')],'sMixed':_0x25f36b[_0xf0a8('0x2e')]['Mixed'],'sNeutral':_0x25f36b[_0xf0a8('0x2e')]['Neutral'],'transcribeStatus':_0xf0a8('0x14')});})[_0xf0a8('0x11')](function(){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x1e'),_0x55ac9b['id']));_0x320f50();});}})['catch'](function(_0x1a8f26){if(_0x1a8f26){if(!_0x1a8f26['name']||_0x1a8f26[_0xf0a8('0x38')]!==_0xf0a8('0x39')){logger[_0xf0a8('0x3a')](util['format'](_0xf0a8('0x3b'),_0x55ac9b['id']),util[_0xf0a8('0x3c')](_0x1a8f26,{'showHidden':![],'depth':null}));}}_0x320f50();});});}function checkTranscribe(){var _0x58e7f2;var _0x11b55e;var _0x41ddfc;return db[_0xf0a8('0x3d')][_0xf0a8('0x3e')]({'where':{'transcribeStatus':_0xf0a8('0x3f')}})[_0xf0a8('0x11')](function(_0x3ecc02){if(!_0x3ecc02||!_0x3ecc02[_0xf0a8('0x1b')]){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x40'));}_0x58e7f2=_0x3ecc02;return db[_0xf0a8('0x41')]['findOne']({'where':{'id':0x1}});})[_0xf0a8('0x11')](function(_0x1e3c47){if(!_0x1e3c47){throw new db['Sequelize'][(_0xf0a8('0x20'))](_0xf0a8('0x42'));}_0x11b55e=_0x1e3c47;if(!_0x11b55e[_0xf0a8('0x6')]||!_0x11b55e[_0xf0a8('0x43')]||!_0x11b55e[_0xf0a8('0xf')]||!_0x11b55e[_0xf0a8('0x24')]||!_0x11b55e[_0xf0a8('0x44')]){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x45'));}return db['CloudProvider'][_0xf0a8('0x37')]({'where':{'id':_0x11b55e[_0xf0a8('0x43')]}});})[_0xf0a8('0x11')](function(_0xa5f919){if(!_0xa5f919){throw new db['Sequelize'][(_0xf0a8('0x20'))](_0xf0a8('0x2a'));}if(!_0xa5f919[_0xf0a8('0xd')]||!_0xa5f919[_0xf0a8('0xe')]){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x46'));}_0x41ddfc=_0xa5f919;var _0x37df8f=[];_0x58e7f2[_0xf0a8('0x47')](function(_0x2702ef){_0x37df8f[_0xf0a8('0x48')](checkTranscribeJob(_0x2702ef,_0x11b55e,_0x41ddfc));});return BPromise[_0xf0a8('0x49')](_0x37df8f);})[_0xf0a8('0x4a')](function(_0xe2362a){if(_0xe2362a){if(!_0xe2362a['name']||_0xe2362a[_0xf0a8('0x38')]!==_0xf0a8('0x39')){logger[_0xf0a8('0x3a')](util[_0xf0a8('0x3c')](_0xe2362a,{'showHidden':![],'depth':null}));}}});}exports[_0xf0a8('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 7b3942c..16472e9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0801=['CmContact','destroy','bulkCreate','then','log','finished\x20populating','hopper1','CmHopper','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now'];(function(_0x77a260,_0x407209){var _0x30e22a=function(_0xb6c00a){while(--_0xb6c00a){_0x77a260['push'](_0x77a260['shift']());}};_0x30e22a(++_0x407209);}(_0x0801,0xb4));var _0x1080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0801[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x1080('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1080('0x1')]({'id':i,'firstName':_0x1080('0x2')+i,'lastName':_0x1080('0x3')+i,'phone':0xf879fb460+i,'email':_0x1080('0x4')+i+_0x1080('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1080('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1080('0x6')](),'updatedAt':Date[_0x1080('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x1080('0x2')+i,'lastName':_0x1080('0x3')+i,'phone':0xf879fb460+i,'email':_0x1080('0x4')+i+_0x1080('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1080('0x6')](),'updatedAt':Date[_0x1080('0x6')]()});}db[_0x1080('0x7')][_0x1080('0x8')]({'where':{}})['then'](function(){return db[_0x1080('0x7')][_0x1080('0x9')](contacts);})[_0x1080('0xa')](function(){console[_0x1080('0xb')](_0x1080('0xc'),'contacts1');return db['CmHopper']['destroy']({'where':{}});})[_0x1080('0xa')](function(){return db['CmHopper'][_0x1080('0x9')](hopper);})['then'](function(){console[_0x1080('0xb')](_0x1080('0xc'),_0x1080('0xd'));return db[_0x1080('0x7')]['bulkCreate'](contacts2);})[_0x1080('0xa')](function(){console[_0x1080('0xb')](_0x1080('0xc'),'contacts2');return db[_0x1080('0xe')]['bulkCreate'](hopper2);})['then'](function(){console[_0x1080('0xb')](_0x1080('0xc'),_0x1080('0xf'));})[_0x1080('0x10')](function(_0x1d9145){console[_0x1080('0xb')](_0x1d9145);}); \ No newline at end of file +var _0xb909=['Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','hopper1','bulkCreate','contacts2','hopper2','util','push','Innocenzo'];(function(_0x345584,_0x2d5cbf){var _0x1bdf33=function(_0x51c696){while(--_0x51c696){_0x345584['push'](_0x345584['shift']());}};_0x1bdf33(++_0x2d5cbf);}(_0xb909,0xe7));var _0x9b90=function(_0xc5dc29,_0x29c165){_0xc5dc29=_0xc5dc29-0x0;var _0x52d1f8=_0xb909[_0xc5dc29];return _0x52d1f8;};'use strict';var util=require(_0x9b90('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9b90('0x1')]({'id':i,'firstName':_0x9b90('0x2')+i,'lastName':_0x9b90('0x3')+i,'phone':0xf879fb460+i,'email':_0x9b90('0x4')+i+_0x9b90('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x9b90('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9b90('0x6')](),'updatedAt':Date[_0x9b90('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x9b90('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x9b90('0x4')+i+_0x9b90('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9b90('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9b90('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9b90('0x6')]()});}db[_0x9b90('0x7')][_0x9b90('0x8')]({'where':{}})[_0x9b90('0x9')](function(){return db[_0x9b90('0x7')]['bulkCreate'](contacts);})[_0x9b90('0x9')](function(){console[_0x9b90('0xa')](_0x9b90('0xb'),_0x9b90('0xc'));return db[_0x9b90('0xd')][_0x9b90('0x8')]({'where':{}});})[_0x9b90('0x9')](function(){return db[_0x9b90('0xd')]['bulkCreate'](hopper);})['then'](function(){console[_0x9b90('0xa')]('finished\x20populating',_0x9b90('0xe'));return db[_0x9b90('0x7')][_0x9b90('0xf')](contacts2);})[_0x9b90('0x9')](function(){console[_0x9b90('0xa')](_0x9b90('0xb'),_0x9b90('0x10'));return db['CmHopper'][_0x9b90('0xf')](hopper2);})[_0x9b90('0x9')](function(){console[_0x9b90('0xa')](_0x9b90('0xb'),_0x9b90('0x11'));})['catch'](function(_0xd51307){console[_0x9b90('0xa')](_0xd51307);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d9e2d04..04c87c8 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34b1=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','../mysqldb','%s%s','format','agent','%s%s@xcally.com','password','friend','udp','wss'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x34b1,0x83));var _0x134b=function(_0x4e0d45,_0x55f937){_0x4e0d45=_0x4e0d45-0x0;var _0xb25758=_0x34b1[_0x4e0d45];return _0xb25758;};'use strict';var util=require('util');var db=require(_0x134b('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x134b('0x1'),'agent',i),'fullname':util[_0x134b('0x2')](_0x134b('0x1'),_0x134b('0x3'),i),'email':util['format'](_0x134b('0x4'),_0x134b('0x3'),i),'role':_0x134b('0x3'),'password':_0x134b('0x5'),'internal':0xfa0+i,'type':_0x134b('0x6'),'transport':[_0x134b('0x7'),'ws',_0x134b('0x8')],'disallow':[_0x134b('0x9')],'allow':[_0x134b('0xa')],'defaultuser':util[_0x134b('0x2')](_0x134b('0x1'),_0x134b('0x3'),i),'encryption':_0x134b('0xb'),'avpf':'yes','force_avp':_0x134b('0xb'),'icesupport':_0x134b('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x134b('0xc'),'dtlsprivatekey':_0x134b('0xd'),'dtlssetup':_0x134b('0xe'),'callerid':util[_0x134b('0x2')](_0x134b('0xf'),util[_0x134b('0x2')](_0x134b('0x1'),_0x134b('0x3'),i),0xfa0+i)});}db[_0x134b('0x10')][_0x134b('0x11')](users)[_0x134b('0x12')](function(){console[_0x134b('0x13')]('add\x20user');})['catch'](function(_0x4272ed){console['log'](_0x4272ed);}); \ No newline at end of file +var _0x75f2=['agent','%s%s@xcally.com','password','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format'];(function(_0x5501e3,_0x38150d){var _0xe0b1fb=function(_0x47c045){while(--_0x47c045){_0x5501e3['push'](_0x5501e3['shift']());}};_0xe0b1fb(++_0x38150d);}(_0x75f2,0x155));var _0x275f=function(_0x2d1bf7,_0x27194c){_0x2d1bf7=_0x2d1bf7-0x0;var _0x59a33c=_0x75f2[_0x2d1bf7];return _0x59a33c;};'use strict';var util=require(_0x275f('0x0'));var db=require(_0x275f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x275f('0x2')]({'name':util[_0x275f('0x3')]('%s%s',_0x275f('0x4'),i),'fullname':util[_0x275f('0x3')]('%s%s','agent',i),'email':util[_0x275f('0x3')](_0x275f('0x5'),_0x275f('0x4'),i),'role':_0x275f('0x4'),'password':_0x275f('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x275f('0x7'),'ws',_0x275f('0x8')],'disallow':[_0x275f('0x9')],'allow':[_0x275f('0xa')],'defaultuser':util['format'](_0x275f('0xb'),_0x275f('0x4'),i),'encryption':_0x275f('0xc'),'avpf':_0x275f('0xc'),'force_avp':_0x275f('0xc'),'icesupport':_0x275f('0xc'),'dtlsenable':_0x275f('0xc'),'dtlsverify':'no','dtlscertfile':_0x275f('0xd'),'dtlsprivatekey':_0x275f('0xe'),'dtlssetup':_0x275f('0xf'),'callerid':util[_0x275f('0x3')](_0x275f('0x10'),util[_0x275f('0x3')](_0x275f('0xb'),'agent',i),0xfa0+i)});}db[_0x275f('0x11')][_0x275f('0x12')](users)[_0x275f('0x13')](function(){console[_0x275f('0x14')](_0x275f('0x15'));})[_0x275f('0x16')](function(_0x5ddbe5){console[_0x275f('0x14')](_0x5ddbe5);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 99a9d38..ed0e51e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8646=['include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','FaxQueue','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','map','where','Campaign','type','length','format','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound'];(function(_0x1cc2fb,_0x5e51ae){var _0x160ee9=function(_0xabd69c){while(--_0xabd69c){_0x1cc2fb['push'](_0x1cc2fb['shift']());}};_0x160ee9(++_0x5e51ae);}(_0x8646,0xf1));var _0x6864=function(_0x5e2caa,_0x527b88){_0x5e2caa=_0x5e2caa-0x0;var _0x3b6216=_0x8646[_0x5e2caa];return _0x3b6216;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x6864('0x0'));var db=require(_0x6864('0x1'))['db'];var config=require(_0x6864('0x2'));var queryQueues={'attributes':['id',_0x6864('0x3')],'include':[{'as':_0x6864('0x4'),'model':db[_0x6864('0x5')],'attributes':['id',_0x6864('0x3'),_0x6864('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x6864('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6864('0x3')],'where':{'role':_0x6864('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6864('0x3'),'type'],'where':{'type':_0x6864('0x9')}};function getAssociatedResources(_0x142780,_0xfbc65f,_0x280c00){return db[_0x6864('0xa')][_0x6864('0xb')]({'where':{'name':_0x142780,'userProfileId':_0xfbc65f},'raw':!![]})[_0x6864('0xc')](function(_0x31b709){if(_0x31b709){if(_0x31b709['autoAssociation']){switch(_0x142780){case _0x6864('0xd'):case _0x6864('0xe'):case _0x6864('0xf'):case'SmsQueues':case _0x6864('0x10'):case'OpenchannelQueues':case _0x6864('0x11'):return db[_0x280c00][_0x6864('0x12')](queryQueues);case'Telephones':return db[_0x280c00][_0x6864('0x12')](queryTelephones);case _0x6864('0x13'):return db[_0x280c00]['findAll'](queryTrunks);case _0x6864('0x14'):return db[_0x280c00][_0x6864('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0x6864('0x12')]({'attributes':[_0x6864('0x15')],'where':{'sectionId':_0x31b709['id']},'raw':!![]})['then'](function(_0x5cf9f2){if(_0x5cf9f2){var _0x2b5fec={'where':{'id':_[_0x6864('0x16')](_0x5cf9f2,_0x6864('0x15'))},'raw':!![]};switch(_0x280c00){case'User':_0x2b5fec[_0x6864('0x17')][_0x6864('0x6')]=_0x6864('0x7');break;case _0x6864('0x18'):_0x2b5fec[_0x6864('0x17')][_0x6864('0x19')]='ivr';break;}return db[_0x280c00][_0x6864('0x12')](_0x2b5fec);}else{return[];}});}}else{return[];}})['then'](function(_0x1efd18){return _0x1efd18;});}function joinOrLeaveQueues(_0x33654b,_0x562c87,_0x280431,_0x512b0f){_0x33654b[_0x562c87](util['format']('%s:queue:%s',_0x280431,_0x512b0f[_0x6864('0x3')]));if(_0x512b0f['Agents']){for(var _0x4ee39b=0x0;_0x4ee39b<_0x512b0f[_0x6864('0x4')][_0x6864('0x1a')];_0x4ee39b+=0x1){_0x33654b[_0x562c87](util[_0x6864('0x1b')](_0x6864('0x1c'),_0x512b0f[_0x6864('0x4')][_0x4ee39b]['name']));}}}function joinOrLeave(_0x1d5ac2,_0x32bb00,_0x4b7f68){var _0x47b287;if(_0x1d5ac2[_0x6864('0x1d')][_0x6864('0x1e')]['id']){db[_0x6864('0x5')][_0x6864('0x1f')]({'attributes':['id',_0x6864('0x3'),'role','userProfileId'],'where':{'id':_0x1d5ac2[_0x6864('0x1d')][_0x6864('0x1e')]['id']},'include':[{'model':db[_0x6864('0x20')],'as':_0x6864('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x22')],'as':_0x6864('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x24')],'as':_0x6864('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x26')],'as':_0x6864('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x28')],'as':_0x6864('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x2a')],'as':_0x6864('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x6864('0xc')](function(_0x4c670f){if(_0x4c670f){_0x47b287=_0x4c670f;_0x1d5ac2[_0x32bb00](util['format'](_0x6864('0x1c'),_0x4c670f['name']));var _0x1df9a3=[];switch(_0x4c670f[_0x6864('0x6')]){case _0x6864('0x2c'):_0x1d5ac2[_0x32bb00](_0x6864('0x2d'));_0x1d5ac2[_0x32bb00](_0x6864('0x2e'));if(queryQueues['hasOwnProperty'](_0x6864('0x2f'))){delete queryQueues[_0x6864('0x2f')];}_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x31')][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x32')][_0x6864('0x12')](queryQueues));_0x1df9a3['push'](db['FaxQueue'][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x33')][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x34')][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x35')][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x36')]['findAll'](queryQueues));_0x1df9a3['push'](db['User']['findAll'](queryTelephones));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x37')][_0x6864('0x12')](queryTrunks));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x18')]['findAll'](queryCampaigns));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x5')][_0x6864('0x12')](queryAgents));break;case _0x6864('0x38'):_0x1d5ac2[_0x32bb00](_0x6864('0x2d'));_0x1d5ac2[_0x32bb00](_0x6864('0x2e'));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0xd'),_0x4c670f['userProfileId'],'VoiceQueue'));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0xe'),_0x4c670f['userProfileId'],_0x6864('0x32')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0xf'),_0x4c670f[_0x6864('0x39')],_0x6864('0x3a')));_0x1df9a3['push'](getAssociatedResources('SmsQueues',_0x4c670f[_0x6864('0x39')],'SmsQueue'));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0x10'),_0x4c670f['userProfileId'],_0x6864('0x34')));_0x1df9a3['push'](getAssociatedResources('OpenchannelQueues',_0x4c670f[_0x6864('0x39')],_0x6864('0x35')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0x11'),_0x4c670f['userProfileId'],_0x6864('0x36')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources('Telephones',_0x4c670f[_0x6864('0x39')],_0x6864('0x5')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources('Trunks',_0x4c670f[_0x6864('0x39')],_0x6864('0x37')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources('IvrCampaigns',_0x4c670f[_0x6864('0x39')],_0x6864('0x18')));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x5')][_0x6864('0x12')](queryAgents));break;case _0x6864('0x8'):_0x1d5ac2[_0x32bb00](_0x6864('0x2d'));_0x1d5ac2[_0x32bb00](_0x6864('0x2e'));_0x1df9a3[_0x6864('0x30')](_0x4c670f['getVoiceQueues']({'attributes':['id','name']}));_0x1df9a3['push'](_0x4c670f['getChatQueues']({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3['push'](_0x4c670f[_0x6864('0x3b')]({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3[_0x6864('0x30')](_0x4c670f['getSmsQueues']({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3[_0x6864('0x30')](_0x4c670f['getMailQueues']({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3[_0x6864('0x30')](_0x4c670f[_0x6864('0x3c')]({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3[_0x6864('0x30')](_0x4c670f[_0x6864('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0x6864('0x3e')](_0x1df9a3);}})[_0x6864('0xc')](function(_0x7d9c68){if(_0x7d9c68&&_0x7d9c68['length']){for(var _0x499c7b=0x0;_0x499c7b<_0x7d9c68[_0x6864('0x1a')];_0x499c7b+=0x1){for(var _0x5866fc=0x0;_0x5866fc<_0x7d9c68[_0x499c7b][_0x6864('0x1a')];_0x5866fc+=0x1){switch(_0x499c7b){case 0x0:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,'voice',_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x1:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x3f'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x2:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x40'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x3:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x41'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x4:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x42'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x5:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x43'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x6:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,'whatsapp',_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x7:_0x1d5ac2[_0x32bb00](util[_0x6864('0x1b')]('telephone:%s',_0x7d9c68[_0x499c7b][_0x5866fc][_0x6864('0x3')]));break;case 0x8:_0x1d5ac2[_0x32bb00](util['format'](_0x6864('0x44'),_0x7d9c68[_0x499c7b][_0x5866fc]['name']));break;case 0x9:_0x1d5ac2[_0x32bb00](util['format']('campaign:%s:%s',_0x7d9c68[_0x499c7b][_0x5866fc][_0x6864('0x19')],_0x7d9c68[_0x499c7b][_0x5866fc]['name']));break;case 0xa:_0x1d5ac2[_0x32bb00](util[_0x6864('0x1b')](_0x6864('0x1c'),_0x7d9c68[_0x499c7b][_0x5866fc][_0x6864('0x3')]));break;}}}}})['then'](function(){if(_0x32bb00===_0x6864('0x45')){var _0x415820=_[_0x6864('0x16')](_0x47b287[_0x6864('0x21')],'id');return _0x47b287[_0x6864('0x46')](_0x415820)[_0x6864('0xc')](function(){for(var _0x3a843f=0x0;_0x3a843f<_0x415820[_0x6864('0x1a')];_0x3a843f+=0x1){_0x4b7f68['emit'](_0x6864('0x47'),{'ChatInteractionId':Number(_0x415820[_0x3a843f]),'UserId':Number(_0x47b287['id'])});}});}})[_0x6864('0xc')](function(){if(_0x32bb00===_0x6864('0x45')){var _0x8e4eb8=_[_0x6864('0x16')](_0x47b287[_0x6864('0x23')],'id');return _0x47b287[_0x6864('0x48')](_0x8e4eb8)[_0x6864('0xc')](function(){for(var _0x4aafd0=0x0;_0x4aafd0<_0x8e4eb8[_0x6864('0x1a')];_0x4aafd0+=0x1){_0x4b7f68[_0x6864('0x49')](_0x6864('0x4a'),{'MailInteractionId':Number(_0x8e4eb8[_0x4aafd0]),'UserId':Number(_0x47b287['id'])});}});}})['then'](function(){if(_0x32bb00==='leave'){var _0x48723e=_[_0x6864('0x16')](_0x47b287[_0x6864('0x25')],'id');return _0x47b287[_0x6864('0x4b')](_0x48723e)[_0x6864('0xc')](function(){for(var _0x56ff7b=0x0;_0x56ff7b<_0x48723e[_0x6864('0x1a')];_0x56ff7b+=0x1){_0x4b7f68['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x48723e[_0x56ff7b]),'UserId':Number(_0x47b287['id'])});}});}})[_0x6864('0xc')](function(){if(_0x32bb00===_0x6864('0x45')){var _0x577ea5=_['map'](_0x47b287[_0x6864('0x27')],'id');return _0x47b287[_0x6864('0x4c')](_0x577ea5)[_0x6864('0xc')](function(){for(var _0xac9e36=0x0;_0xac9e36<_0x577ea5[_0x6864('0x1a')];_0xac9e36+=0x1){_0x4b7f68[_0x6864('0x49')](_0x6864('0x4d'),{'SmsInteractionId':Number(_0x577ea5[_0xac9e36]),'UserId':Number(_0x47b287['id'])});}});}})['then'](function(){if(_0x32bb00===_0x6864('0x45')){var _0x3d482d=_['map'](_0x47b287[_0x6864('0x29')],'id');return _0x47b287['removeOpenchannelInteractions'](_0x3d482d)[_0x6864('0xc')](function(){for(var _0x2e0058=0x0;_0x2e0058<_0x3d482d[_0x6864('0x1a')];_0x2e0058+=0x1){_0x4b7f68[_0x6864('0x49')](_0x6864('0x4e'),{'OpenchannelInteractionId':Number(_0x3d482d[_0x2e0058]),'UserId':Number(_0x47b287['id'])});}});}})[_0x6864('0xc')](function(){if(_0x32bb00===_0x6864('0x45')){var _0x42a3e4=_[_0x6864('0x16')](_0x47b287[_0x6864('0x2b')],'id');return _0x47b287[_0x6864('0x4f')](_0x42a3e4)[_0x6864('0xc')](function(){for(var _0x4c8fd2=0x0;_0x4c8fd2<_0x42a3e4[_0x6864('0x1a')];_0x4c8fd2+=0x1){_0x4b7f68['emit'](_0x6864('0x50'),{'WhatsappInteractionId':Number(_0x42a3e4[_0x4c8fd2]),'UserId':Number(_0x47b287['id'])});}});}})[_0x6864('0x51')](function(_0x26e07e){_0x1d5ac2['log'](_0x26e07e);});}}function onDisconnect(_0x340d04,_0x24603e){joinOrLeave(_0x340d04,_0x6864('0x45'),_0x24603e);}function onConnect(_0x118676){joinOrLeave(_0x118676,_0x6864('0x52'));}exports[_0x6864('0x53')]=function(_0x5aec39){_0x5aec39['on']('connection',function(_0x9da6d3){_0x9da6d3[_0x6864('0x54')](0x0);_0x9da6d3[_0x6864('0x55')]=_0x9da6d3[_0x6864('0x56')][_0x6864('0x57')][_0x6864('0x58')]+':'+_0x9da6d3['request'][_0x6864('0x57')][_0x6864('0x59')];_0x9da6d3['connectedAt']=new Date();_0x9da6d3['log']=function(_0x1bf745){console[_0x6864('0x5a')](_0x6864('0x5b')+_0x9da6d3[_0x6864('0x5c')][_0x6864('0x3')]+'['+_0x9da6d3['address']+']',_0x1bf745);};_0x9da6d3['on'](_0x6864('0x5d'),function(){onDisconnect(_0x9da6d3,_0x5aec39);_0x9da6d3[_0x6864('0x5a')](_0x6864('0x5e'));});onConnect(_0x9da6d3);_0x9da6d3[_0x6864('0x5a')](_0x6864('0x5f'));});}; \ No newline at end of file +var _0x74f0=['ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','userProfileId','Trunks','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','DISCONNECTED','CONNECTED','util','./environment','name','Agents','User','agent','telephone','ivr','UserProfileSection','findOne','then','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','map','where','Campaign','type','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction'];(function(_0x42099b,_0x302849){var _0x811c40=function(_0xe11569){while(--_0xe11569){_0x42099b['push'](_0x42099b['shift']());}};_0x811c40(++_0x302849);}(_0x74f0,0xf3));var _0x074f=function(_0x53417c,_0x126dee){_0x53417c=_0x53417c-0x0;var _0x49407d=_0x74f0[_0x53417c];return _0x49407d;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x074f('0x1'));var queryQueues={'attributes':['id',_0x074f('0x2')],'include':[{'as':_0x074f('0x3'),'model':db[_0x074f('0x4')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x074f('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x074f('0x2')],'where':{'role':_0x074f('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x074f('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x074f('0x2')],'where':{'role':_0x074f('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x074f('0x2'),'type'],'where':{'type':_0x074f('0x7')}};function getAssociatedResources(_0xc853e0,_0x58588c,_0x252a2e){return db[_0x074f('0x8')][_0x074f('0x9')]({'where':{'name':_0xc853e0,'userProfileId':_0x58588c},'raw':!![]})[_0x074f('0xa')](function(_0x40179d){if(_0x40179d){if(_0x40179d['autoAssociation']){switch(_0xc853e0){case'VoiceQueues':case _0x074f('0xb'):case _0x074f('0xc'):case _0x074f('0xd'):case _0x074f('0xe'):case _0x074f('0xf'):case _0x074f('0x10'):return db[_0x252a2e][_0x074f('0x11')](queryQueues);case _0x074f('0x12'):return db[_0x252a2e][_0x074f('0x11')](queryTelephones);case'Trunks':return db[_0x252a2e][_0x074f('0x11')](queryTrunks);case'IvrCampaigns':return db[_0x252a2e][_0x074f('0x11')](queryCampaigns);}}else{return db[_0x074f('0x13')][_0x074f('0x11')]({'attributes':[_0x074f('0x14')],'where':{'sectionId':_0x40179d['id']},'raw':!![]})[_0x074f('0xa')](function(_0x237960){if(_0x237960){var _0x7e19fe={'where':{'id':_[_0x074f('0x15')](_0x237960,_0x074f('0x14'))},'raw':!![]};switch(_0x252a2e){case _0x074f('0x4'):_0x7e19fe[_0x074f('0x16')]['role']=_0x074f('0x6');break;case _0x074f('0x17'):_0x7e19fe[_0x074f('0x16')][_0x074f('0x18')]=_0x074f('0x7');break;}return db[_0x252a2e][_0x074f('0x11')](_0x7e19fe);}else{return[];}});}}else{return[];}})['then'](function(_0x568a50){return _0x568a50;});}function joinOrLeaveQueues(_0x1d241d,_0x5d8c10,_0x567f82,_0x38f21b){_0x1d241d[_0x5d8c10](util[_0x074f('0x19')](_0x074f('0x1a'),_0x567f82,_0x38f21b[_0x074f('0x2')]));if(_0x38f21b[_0x074f('0x3')]){for(var _0x210221=0x0;_0x210221<_0x38f21b[_0x074f('0x3')][_0x074f('0x1b')];_0x210221+=0x1){_0x1d241d[_0x5d8c10](util[_0x074f('0x19')](_0x074f('0x1c'),_0x38f21b[_0x074f('0x3')][_0x210221][_0x074f('0x2')]));}}}function joinOrLeave(_0x307f0f,_0x2fc5b0,_0x39e502){var _0x1bd2c7;if(_0x307f0f[_0x074f('0x1d')][_0x074f('0x1e')]['id']){db[_0x074f('0x4')][_0x074f('0x1f')]({'attributes':['id','name','role','userProfileId'],'where':{'id':_0x307f0f[_0x074f('0x1d')][_0x074f('0x1e')]['id']},'include':[{'model':db[_0x074f('0x20')],'as':_0x074f('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x074f('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x074f('0x23')],'as':_0x074f('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x074f('0x25')],'as':_0x074f('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x074f('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x074f('0x28')],'as':_0x074f('0x29'),'attributes':['id'],'raw':!![]}]})[_0x074f('0xa')](function(_0x53b76d){if(_0x53b76d){_0x1bd2c7=_0x53b76d;_0x307f0f[_0x2fc5b0](util[_0x074f('0x19')]('user:%s',_0x53b76d['name']));var _0x28cb12=[];switch(_0x53b76d['role']){case _0x074f('0x2a'):_0x307f0f[_0x2fc5b0](_0x074f('0x2b'));_0x307f0f[_0x2fc5b0](_0x074f('0x2c'));if(queryQueues[_0x074f('0x2d')]('include')){delete queryQueues[_0x074f('0x2e')];}_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x30')]['findAll'](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x31')][_0x074f('0x11')](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x32')]['findAll'](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x33')]['findAll'](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x34')][_0x074f('0x11')](queryQueues));_0x28cb12['push'](db[_0x074f('0x35')][_0x074f('0x11')](queryQueues));_0x28cb12['push'](db[_0x074f('0x36')][_0x074f('0x11')](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x4')][_0x074f('0x11')](queryTelephones));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x37')][_0x074f('0x11')](queryTrunks));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x17')]['findAll'](queryCampaigns));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x4')]['findAll'](queryAgents));break;case _0x074f('0x38'):_0x307f0f[_0x2fc5b0](_0x074f('0x2b'));_0x307f0f[_0x2fc5b0](_0x074f('0x2c'));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0x39'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x30')));_0x28cb12['push'](getAssociatedResources(_0x074f('0xb'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x31')));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0xc'),_0x53b76d[_0x074f('0x3a')],'FaxQueue'));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0xd'),_0x53b76d['userProfileId'],_0x074f('0x33')));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0xe'),_0x53b76d['userProfileId'],'MailQueue'));_0x28cb12['push'](getAssociatedResources(_0x074f('0xf'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x35')));_0x28cb12['push'](getAssociatedResources(_0x074f('0x10'),_0x53b76d[_0x074f('0x3a')],'WhatsappQueue'));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0x12'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x4')));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0x3b'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x37')));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0x3c'),_0x53b76d['userProfileId'],_0x074f('0x17')));_0x28cb12['push'](db[_0x074f('0x4')]['findAll'](queryAgents));break;case _0x074f('0x5'):_0x307f0f[_0x2fc5b0]('voice:inbound');_0x307f0f[_0x2fc5b0](_0x074f('0x2c'));_0x28cb12['push'](_0x53b76d[_0x074f('0x3d')]({'attributes':['id',_0x074f('0x2')]}));_0x28cb12[_0x074f('0x2f')](_0x53b76d[_0x074f('0x3e')]({'attributes':['id',_0x074f('0x2')]}));_0x28cb12[_0x074f('0x2f')](_0x53b76d[_0x074f('0x3f')]({'attributes':['id','name']}));_0x28cb12[_0x074f('0x2f')](_0x53b76d[_0x074f('0x40')]({'attributes':['id',_0x074f('0x2')]}));_0x28cb12[_0x074f('0x2f')](_0x53b76d['getMailQueues']({'attributes':['id',_0x074f('0x2')]}));_0x28cb12['push'](_0x53b76d[_0x074f('0x41')]({'attributes':['id',_0x074f('0x2')]}));_0x28cb12[_0x074f('0x2f')](_0x53b76d['getWhatsappQueues']({'attributes':['id',_0x074f('0x2')]}));break;}return BPromise['all'](_0x28cb12);}})[_0x074f('0xa')](function(_0x2ed08a){if(_0x2ed08a&&_0x2ed08a['length']){for(var _0x37e864=0x0;_0x37e864<_0x2ed08a['length'];_0x37e864+=0x1){for(var _0x45492a=0x0;_0x45492a<_0x2ed08a[_0x37e864][_0x074f('0x1b')];_0x45492a+=0x1){switch(_0x37e864){case 0x0:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,'voice',_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x1:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,'chat',_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x2:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,'fax',_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x3:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,'sms',_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x4:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,_0x074f('0x42'),_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x5:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,_0x074f('0x43'),_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x6:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,_0x074f('0x44'),_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x7:_0x307f0f[_0x2fc5b0](util[_0x074f('0x19')]('telephone:%s',_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x2')]));break;case 0x8:_0x307f0f[_0x2fc5b0](util[_0x074f('0x19')](_0x074f('0x45'),_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x2')]));break;case 0x9:_0x307f0f[_0x2fc5b0](util[_0x074f('0x19')](_0x074f('0x46'),_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x18')],_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x2')]));break;case 0xa:_0x307f0f[_0x2fc5b0](util['format'](_0x074f('0x1c'),_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x2')]));break;}}}}})[_0x074f('0xa')](function(){if(_0x2fc5b0===_0x074f('0x47')){var _0x522777=_[_0x074f('0x15')](_0x1bd2c7[_0x074f('0x21')],'id');return _0x1bd2c7['removeChatInteractions'](_0x522777)['then'](function(){for(var _0x3ac2ea=0x0;_0x3ac2ea<_0x522777[_0x074f('0x1b')];_0x3ac2ea+=0x1){_0x39e502[_0x074f('0x48')](_0x074f('0x49'),{'ChatInteractionId':Number(_0x522777[_0x3ac2ea]),'UserId':Number(_0x1bd2c7['id'])});}});}})['then'](function(){if(_0x2fc5b0==='leave'){var _0x3db639=_[_0x074f('0x15')](_0x1bd2c7[_0x074f('0x22')],'id');return _0x1bd2c7[_0x074f('0x4a')](_0x3db639)[_0x074f('0xa')](function(){for(var _0x151c90=0x0;_0x151c90<_0x3db639[_0x074f('0x1b')];_0x151c90+=0x1){_0x39e502[_0x074f('0x48')](_0x074f('0x4b'),{'MailInteractionId':Number(_0x3db639[_0x151c90]),'UserId':Number(_0x1bd2c7['id'])});}});}})['then'](function(){if(_0x2fc5b0===_0x074f('0x47')){var _0x3aa992=_[_0x074f('0x15')](_0x1bd2c7[_0x074f('0x24')],'id');return _0x1bd2c7[_0x074f('0x4c')](_0x3aa992)[_0x074f('0xa')](function(){for(var _0x47ba30=0x0;_0x47ba30<_0x3aa992[_0x074f('0x1b')];_0x47ba30+=0x1){_0x39e502[_0x074f('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3aa992[_0x47ba30]),'UserId':Number(_0x1bd2c7['id'])});}});}})[_0x074f('0xa')](function(){if(_0x2fc5b0===_0x074f('0x47')){var _0x1096b3=_[_0x074f('0x15')](_0x1bd2c7[_0x074f('0x26')],'id');return _0x1bd2c7[_0x074f('0x4d')](_0x1096b3)[_0x074f('0xa')](function(){for(var _0x141660=0x0;_0x141660<_0x1096b3[_0x074f('0x1b')];_0x141660+=0x1){_0x39e502[_0x074f('0x48')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1096b3[_0x141660]),'UserId':Number(_0x1bd2c7['id'])});}});}})[_0x074f('0xa')](function(){if(_0x2fc5b0==='leave'){var _0x572912=_[_0x074f('0x15')](_0x1bd2c7['OpenchannelInteractions'],'id');return _0x1bd2c7['removeOpenchannelInteractions'](_0x572912)[_0x074f('0xa')](function(){for(var _0x183c51=0x0;_0x183c51<_0x572912[_0x074f('0x1b')];_0x183c51+=0x1){_0x39e502[_0x074f('0x48')](_0x074f('0x4e'),{'OpenchannelInteractionId':Number(_0x572912[_0x183c51]),'UserId':Number(_0x1bd2c7['id'])});}});}})[_0x074f('0xa')](function(){if(_0x2fc5b0===_0x074f('0x47')){var _0x3afacd=_['map'](_0x1bd2c7['WhatsappInteractions'],'id');return _0x1bd2c7[_0x074f('0x4f')](_0x3afacd)[_0x074f('0xa')](function(){for(var _0x28fedf=0x0;_0x28fedf<_0x3afacd['length'];_0x28fedf+=0x1){_0x39e502[_0x074f('0x48')](_0x074f('0x50'),{'WhatsappInteractionId':Number(_0x3afacd[_0x28fedf]),'UserId':Number(_0x1bd2c7['id'])});}});}})['catch'](function(_0x54c348){_0x307f0f[_0x074f('0x51')](_0x54c348);});}}function onDisconnect(_0x4e06cb,_0x76c609){joinOrLeave(_0x4e06cb,_0x074f('0x47'),_0x76c609);}function onConnect(_0x5b1f41){joinOrLeave(_0x5b1f41,_0x074f('0x52'));}exports[_0x074f('0x53')]=function(_0x1d19a3){_0x1d19a3['on'](_0x074f('0x54'),function(_0x19475b){_0x19475b[_0x074f('0x55')](0x0);_0x19475b[_0x074f('0x56')]=_0x19475b[_0x074f('0x57')][_0x074f('0x54')][_0x074f('0x58')]+':'+_0x19475b[_0x074f('0x57')][_0x074f('0x54')]['remotePort'];_0x19475b['connectedAt']=new Date();_0x19475b['log']=function(_0x3766f0){console['log'](_0x074f('0x59')+_0x19475b['nsp'][_0x074f('0x2')]+'['+_0x19475b[_0x074f('0x56')]+']',_0x3766f0);};_0x19475b['on']('disconnect',function(){onDisconnect(_0x19475b,_0x1d19a3);_0x19475b[_0x074f('0x51')](_0x074f('0x5a'));});onConnect(_0x19475b);_0x19475b[_0x074f('0x51')](_0x074f('0x5b'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index c4fe44e..fe81535 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 _0x185e=['channel','event','direction','UserId','User','find','name','interface','format','incomingmessage','outgoingmessage','opened','changed','closed','SIP/%s','default','hasOwnProperty','model','hook','util','../../mysqldb','jayson/promise','triggers','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get'];(function(_0x3b4709,_0xfa5d78){var _0x2557da=function(_0x3b23c7){while(--_0x3b23c7){_0x3b4709['push'](_0x3b4709['shift']());}};_0x2557da(++_0xfa5d78);}(_0x185e,0xf3));var _0xe185=function(_0x166bfa,_0x10908f){_0x166bfa=_0x166bfa-0x0;var _0x36c878=_0x185e[_0x166bfa];return _0x36c878;};'use strict';var util=require(_0xe185('0x0'));var db=require(_0xe185('0x1'))['db'];var jayson=require(_0xe185('0x2'));var logger=require('../logger')(_0xe185('0x3'));var client=jayson['client'][_0xe185('0x4')]({'port':0x232a});var triggers=[{'channel':_0xe185('0x5'),'model':_0xe185('0x6'),'event':_0xe185('0x7'),'condition':_0xe185('0x8'),'callback':afterCreate},{'channel':_0xe185('0x5'),'model':_0xe185('0x6'),'event':_0xe185('0x9'),'condition':_0xe185('0xa'),'callback':afterUpdate},{'channel':_0xe185('0x5'),'model':_0xe185('0xb'),'event':_0xe185('0x7'),'condition':_0xe185('0xc'),'callback':afterCreateMessage},{'channel':_0xe185('0xd'),'model':_0xe185('0xe'),'event':'afterCreate','condition':_0xe185('0x8'),'callback':afterCreate},{'channel':_0xe185('0xd'),'model':_0xe185('0xe'),'event':_0xe185('0x9'),'condition':_0xe185('0xa'),'callback':afterUpdate},{'channel':'Sms','model':_0xe185('0xf'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe185('0x10'),'model':_0xe185('0x11'),'event':_0xe185('0x7'),'condition':_0xe185('0x8'),'callback':afterCreate},{'channel':_0xe185('0x10'),'model':'WhatsappInteraction','event':_0xe185('0x9'),'condition':_0xe185('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xe185('0x12'),'event':_0xe185('0x7'),'condition':_0xe185('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xe185('0x13'),'event':_0xe185('0x7'),'condition':_0xe185('0x8'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0xe185('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe185('0x14'),'model':_0xe185('0x15'),'event':_0xe185('0x7'),'condition':_0xe185('0xc'),'callback':afterCreateMessage},{'channel':_0xe185('0x16'),'model':_0xe185('0x17'),'event':_0xe185('0x7'),'condition':_0xe185('0x8'),'callback':afterCreate},{'channel':_0xe185('0x16'),'model':_0xe185('0x17'),'event':_0xe185('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe185('0x16'),'model':_0xe185('0x18'),'event':_0xe185('0x7'),'condition':_0xe185('0xc'),'callback':afterCreateMessage},{'channel':_0xe185('0x19'),'model':_0xe185('0x1a'),'event':_0xe185('0x7'),'condition':_0xe185('0x8'),'callback':afterCreate},{'channel':_0xe185('0x19'),'model':_0xe185('0x1a'),'event':_0xe185('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe185('0x19'),'model':_0xe185('0x1b'),'event':'afterCreate','condition':_0xe185('0xc'),'callback':afterCreateMessage}];function request(_0x3e6da8){return client[_0xe185('0x1c')](_0xe185('0x1d'),_0x3e6da8)[_0xe185('0x1e')](function(_0x2f4efe){logger[_0xe185('0x1f')](_0xe185('0x20'),_0xe185('0x1d'),_0x2f4efe);if(_0x2f4efe[_0xe185('0x21')]){if(_0x2f4efe['error'][_0xe185('0x22')]===0x1f4){logger['error'](_0xe185('0x20'),_0xe185('0x1d'),_0x2f4efe['error']);}}})[_0xe185('0x23')](function(_0x2e7158){logger[_0xe185('0x21')](_0xe185('0x20'),'EventManager',_0x2e7158);});}function afterCreateMessage(_0x1dfa82,_0x500861){return function(_0x2d4de5,_0x311aa6){_0x2d4de5=_0x2d4de5[_0xe185('0x24')]({'plain':!![]});_0x2d4de5[_0xe185('0x25')]=_0x1dfa82;_0x2d4de5[_0xe185('0x26')]=_0x2d4de5[_0xe185('0x27')];if(_0x2d4de5[_0xe185('0x28')]){return db[_0xe185('0x29')][_0xe185('0x2a')]({'where':{'id':_0x2d4de5[_0xe185('0x28')]},'attributes':['id',_0xe185('0x2b')],'raw':!![]})[_0xe185('0x1e')](function(_0x505391){_0x2d4de5[_0xe185('0x2c')]=util[_0xe185('0x2d')]('SIP/%s',_0x505391[_0xe185('0x2b')]);_0x2d4de5[_0xe185('0x25')]=_0x1dfa82;return request({'event':_0xe185('0x2e'),'message':_0x2d4de5});})[_0xe185('0x23')](function(_0xca3424){console[_0xe185('0x21')](_0xca3424);});}else{return request({'event':_0xe185('0x2f'),'message':_0x2d4de5});}};}function afterCreate(_0x2c519b,_0x4082d1){return function(_0x2a80e5,_0x485961){_0x2a80e5=_0x2a80e5[_0xe185('0x24')]({'plain':!![]});_0x2a80e5[_0xe185('0x25')]=_0x2c519b;_0x2a80e5['event']=_0xe185('0x30');return request({'event':_0x4082d1,'message':_0x2a80e5});};}function afterUpdate(_0xc19b19,_0x53f90c){return function(_0x488f89,_0xb84376){if(_0x488f89[_0xe185('0x31')]('closed')&&_0x488f89[_0xe185('0x32')]){_0x488f89=_0x488f89[_0xe185('0x24')]({'plain':!![]});_0x488f89[_0xe185('0x25')]=_0xc19b19;_0x488f89[_0xe185('0x26')]=_0xe185('0x32');if(_0x488f89['UserId']){return db[_0xe185('0x29')]['find']({'where':{'id':_0x488f89[_0xe185('0x28')]},'attributes':['id',_0xe185('0x2b')],'raw':!![]})['then'](function(_0x3337d4){_0x488f89[_0xe185('0x2c')]=util[_0xe185('0x2d')](_0xe185('0x33'),_0x3337d4[_0xe185('0x2b')]);return request({'event':_0x53f90c,'message':_0x488f89});})[_0xe185('0x23')](function(_0x2b171e){console[_0xe185('0x21')](_0x2b171e);});}else{return request({'event':_0x53f90c,'message':_0x488f89});}}};}exports[_0xe185('0x34')]=function(){for(var _0x50aa81=0x0;_0x50aa81=_0x255dc0[_0x47ed('0x15')]){throw Error(_0x47ed('0x16'));}_0x5525b1(_0xbf7f81);})['catch'](function(_0x41e784){_0xad3ca5(_0x41e784);});});}; \ No newline at end of file +var _0xe1df=['catch','lodash','bluebird','../mysqldb','voice','chat','fax','sms','getChannels','isValidChannel','toLowerCase','includes','blockedAt','updateAttributes','User','count','agent','getLicense','then','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0xe1df,0xd3));var _0xfe1d=function(_0x4ad26f,_0x21539a){_0x4ad26f=_0x4ad26f-0x0;var _0x4b5791=_0xe1df[_0x4ad26f];return _0x4b5791;};'use strict';var _=require(_0xfe1d('0x0'));var BPromise=require(_0xfe1d('0x1'));var db=require(_0xfe1d('0x2'))['db'];var util=require('./license/util');var channels=[_0xfe1d('0x3'),'mail',_0xfe1d('0x4'),_0xfe1d('0x5'),_0xfe1d('0x6'),'whatsapp','openchannel'];exports[_0xfe1d('0x7')]=function(){return channels;};exports[_0xfe1d('0x8')]=function(_0x241b1){_0x241b1=_0x241b1[_0xfe1d('0x9')]();return _[_0xfe1d('0xa')](channels,_0x241b1);};exports['clearBlockUser']=function(_0x3bbf6e,_0x1de425,_0x3b39f9,_0x9e9c5e){var _0x196f91={'loginAttempts':_0x1de425,'blocked':_0x3b39f9};if(!_['isUndefined'](_0x9e9c5e)){_0x196f91[_0xfe1d('0xb')]=_0x9e9c5e;}return _0x3bbf6e[_0xfe1d('0xc')](_0x196f91);};exports['getLicense']=function(_0x3d9dae){return new BPromise(function(_0x42c34e,_0x19a37d){var _0x51e895=0x0;if(_0x3d9dae['role']!=='agent'){_0x42c34e(_0x3d9dae);}db[_0xfe1d('0xd')][_0xfe1d('0xe')]({'where':{'role':_0xfe1d('0xf'),'online':!![],'id':{'$ne':_0x3d9dae['id']}}})['then'](function(_0x3edbc8){_0x51e895=_0x3edbc8;return util[_0xfe1d('0x10')]();})[_0xfe1d('0x11')](function(_0x56f2a2){if(_0x56f2a2&&_0x56f2a2[_0xfe1d('0x12')]&&_0x51e895>=_0x56f2a2[_0xfe1d('0x12')]){throw Error(_0xfe1d('0x13'));}_0x42c34e(_0x3d9dae);})[_0xfe1d('0x14')](function(_0x4f600c){_0x19a37d(_0x4f600c);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 3882328..7610d89 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa55a=['status','json','send','exports','404'];(function(_0x2f1908,_0x5d837d){var _0x357795=function(_0x5bf606){while(--_0x5bf606){_0x2f1908['push'](_0x2f1908['shift']());}};_0x357795(++_0x5d837d);}(_0xa55a,0x170));var _0xaa55=function(_0xfaa7a8,_0x55aea0){_0xfaa7a8=_0xfaa7a8-0x0;var _0xc47bee=_0xa55a[_0xfaa7a8];return _0xc47bee;};'use strict';module[_0xaa55('0x0')][0x194]=function pageNotFound(_0x3e71a8,_0x20fabd){var _0x2d89ae=_0xaa55('0x1');var _0x29fad0=0x194;var _0xc393b5={'status':_0x29fad0};_0x20fabd[_0xaa55('0x2')](_0xc393b5['status']);_0x20fabd['render'](_0x2d89ae,{},function(_0x45e67a,_0x5c3d9b){if(_0x45e67a){return _0x20fabd[_0xaa55('0x2')](_0xc393b5[_0xaa55('0x2')])[_0xaa55('0x3')](_0xc393b5);}_0x20fabd[_0xaa55('0x4')](_0x5c3d9b);});}; \ No newline at end of file +var _0x3aeb=['send','exports','404','status','render','json'];(function(_0x37ed66,_0x3dcf56){var _0x1f9872=function(_0x247a6d){while(--_0x247a6d){_0x37ed66['push'](_0x37ed66['shift']());}};_0x1f9872(++_0x3dcf56);}(_0x3aeb,0x115));var _0xb3ae=function(_0x342186,_0x24596f){_0x342186=_0x342186-0x0;var _0x58fd4a=_0x3aeb[_0x342186];return _0x58fd4a;};'use strict';module[_0xb3ae('0x0')][0x194]=function pageNotFound(_0x1f8f46,_0x45acab){var _0x5c8746=_0xb3ae('0x1');var _0x520a27=0x194;var _0x46ff58={'status':_0x520a27};_0x45acab['status'](_0x46ff58[_0xb3ae('0x2')]);_0x45acab[_0xb3ae('0x3')](_0x5c8746,{},function(_0x2aa7cf,_0x1db963){if(_0x2aa7cf){return _0x45acab[_0xb3ae('0x2')](_0x46ff58[_0xb3ae('0x2')])[_0xb3ae('0x4')](_0x46ff58);}_0x45acab[_0xb3ae('0x5')](_0x1db963);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 99d2608..18730f7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dd1=['License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','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','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','Notifications','SenderId','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Team','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','WhatsappInteractions','user_has_whatsapp_interactions','MailQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','Applications','Sounds','CmHopper','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','Trunk','TrunkId','TrunkBackup','Interval','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','Messages','Interactions','List','ListId','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','MailQueue','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','restrict','IntervalId','TagId','FaxAccountId','Exntensions','FaxQueue','FaxInteractionId','fax_interaction_has_tags','Tags','AttachmentId','SmsAccountId','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsMessage','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelMessage','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatWebsiteId','ChatInteractionId','team_has_chat_queues','ChatGroupId','Members','CompanyId','Hoppers','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','Any','OneAny','Actions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','AnalyticMetric','MetricId','SalesforceAccount','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','Variable','VariableId','SugarcrmAccount','SugarcrmConfiguration','Configurations','SugarcrmField','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Configuration','FromId','ToId','JscriptyAnswerReport','SessionId','ProjectId','team_has_fax_queues','team_has_openchannel_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatQueueId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToUserId','ToSmsQueueId','ToSmsAccountId','CustomFields','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','sequelize','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','sequelizeHistory','utf8','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6dd1,0x111));var _0x16dd=function(_0x26019f,_0x264a38){_0x26019f=_0x26019f-0x0;var _0x211f44=_0x6dd1[_0x26019f];return _0x211f44;};'use strict';var path=require(_0x16dd('0x0'));var config=require('../config/environment');var Sequelize=require(_0x16dd('0x1'));var _=require(_0x16dd('0x2'));var jstz=require('jstz');var timezone=jstz[_0x16dd('0x3')]();config[_0x16dd('0x1')]=_[_0x16dd('0x4')](config[_0x16dd('0x1')],{'database':_0x16dd('0x5'),'username':_0x16dd('0x6'),'password':_0x16dd('0x7'),'options':{'host':_0x16dd('0x8'),'port':0xcea,'dialect':_0x16dd('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x16dd('0xa')]=_[_0x16dd('0x4')](config[_0x16dd('0xa')],{'database':_0x16dd('0x5'),'username':'xcall','password':_0x16dd('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x16dd('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x16dd('0xb'),'collate':_0x16dd('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x16dd('0xd')],config[_0x16dd('0x1')][_0x16dd('0xe')],config['sequelize'][_0x16dd('0xf')],config[_0x16dd('0x1')][_0x16dd('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x16dd('0xa')][_0x16dd('0xd')],config['sequelizeHistory']['username'],config[_0x16dd('0xa')]['password'],config[_0x16dd('0xa')][_0x16dd('0x10')])};db[_0x16dd('0x11')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x13'));db[_0x16dd('0x14')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x15'));db[_0x16dd('0x16')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x17'));db['VoiceExtension']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x18'));db[_0x16dd('0x19')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x1a'));db[_0x16dd('0x1b')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0x16dd('0x1c')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x1d'));db[_0x16dd('0x1e')]=db['sequelize']['import'](_0x16dd('0x1f'));db[_0x16dd('0x20')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x21'));db[_0x16dd('0x22')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x23'));db[_0x16dd('0x24')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x25'));db[_0x16dd('0x26')]=db['sequelize']['import'](_0x16dd('0x27'));db[_0x16dd('0x28')]=db['sequelize']['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x16dd('0x29')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x16dd('0x2a')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x2b'));db['Trunk']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/trunk/trunk.model');db[_0x16dd('0x2c')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x2d'));db['UserVoiceQueueRt']=db[_0x16dd('0x1')]['import'](_0x16dd('0x2e'));db[_0x16dd('0x2f')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x30'));db[_0x16dd('0x31')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x32'));db[_0x16dd('0x33')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x34'));db[_0x16dd('0x35')]=db['sequelize'][_0x16dd('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0x16dd('0x36')]=db[_0x16dd('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x16dd('0x37')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x38'));db[_0x16dd('0x39')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x3a'));db[_0x16dd('0x3b')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x3c'));db[_0x16dd('0x3d')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x3e'));db[_0x16dd('0x3f')]=db[_0x16dd('0x1')]['import']('../api/mailAccount/mailAccount.model');db['MailQueue']=db['sequelize'][_0x16dd('0x12')]('../api/mailQueue/mailQueue.model');db[_0x16dd('0x40')]=db['sequelize'][_0x16dd('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0x16dd('0x41')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x42'));db[_0x16dd('0x43')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x44'));db[_0x16dd('0x45')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x46'));db[_0x16dd('0x47')]=db['sequelize']['import'](_0x16dd('0x48'));db['Dashboard']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x49'));db[_0x16dd('0x4a')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x4b'));db[_0x16dd('0x4c')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x4d'));db[_0x16dd('0x4e')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x4f'));db[_0x16dd('0x50')]=db[_0x16dd('0x1')]['import']('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x51'));db[_0x16dd('0x52')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x53'));db[_0x16dd('0x54')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/smsAccount/smsAccount.model');db[_0x16dd('0x55')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x56'));db[_0x16dd('0x57')]=db['sequelize']['import'](_0x16dd('0x58'));db['SmsMessage']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x59'));db[_0x16dd('0x5a')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x5b'));db[_0x16dd('0x5c')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x5d'));db[_0x16dd('0x5e')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x5f'));db[_0x16dd('0x60')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x61'));db['OpenchannelMessage']=db[_0x16dd('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0x16dd('0x62')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x63'));db['ChatWebsite']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x64'));db[_0x16dd('0x65')]=db['sequelize'][_0x16dd('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x16dd('0x66')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x67'));db['ChatInteraction']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x68'));db['ChatMessage']=db[_0x16dd('0x1')]['import'](_0x16dd('0x69'));db[_0x16dd('0x6a')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x6b'));db[_0x16dd('0x6c')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x6d'));db['ChatGroup']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/chatGroup/chatGroup.model');db[_0x16dd('0x6e')]=db['sequelize']['import'](_0x16dd('0x6f'));db[_0x16dd('0x70')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x71'));db[_0x16dd('0x72')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x73'));db['CmHopper']=db[_0x16dd('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x16dd('0x74')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x75'));db[_0x16dd('0x76')]=db[_0x16dd('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x16dd('0x1')]['import'](_0x16dd('0x77'));db['ReportAgentPreview']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x78'));db[_0x16dd('0x79')]=db[_0x16dd('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x16dd('0x7a')]=db[_0x16dd('0x1')]['import']('../api/action/action.model');db[_0x16dd('0x7b')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x7c'));db[_0x16dd('0x7d')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x7e'));db['Disposition']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x7f'));db[_0x16dd('0x80')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x81'));db['Interval']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x82'));db[_0x16dd('0x83')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x84'));db['Cdr']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x85'));db['VoiceQueuesLog']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x16dd('0x86')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x87'));db[_0x16dd('0x88')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x89'));db[_0x16dd('0x8a')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x8b'));db[_0x16dd('0x8c')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x8d'));db[_0x16dd('0x8e')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x8f'));db['Variable']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x90'));db[_0x16dd('0x91')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x92'));db[_0x16dd('0x93')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x94'));db['AnalyticCustomReport']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x95'));db[_0x16dd('0x96')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x97'));db['AnalyticExtractedReport']=db['sequelize']['import'](_0x16dd('0x98'));db['AnalyticMetric']=db['sequelize']['import']('../api/analyticMetric/analyticMetric.model');db[_0x16dd('0x99')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x9a'));db[_0x16dd('0x9b')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x9c'));db['SalesforceAccount']=db[_0x16dd('0x1')]['import'](_0x16dd('0x9d'));db[_0x16dd('0x9e')]=db[_0x16dd('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x16dd('0x1')]['import'](_0x16dd('0x9f'));db['SugarcrmAccount']=db[_0x16dd('0x1')]['import'](_0x16dd('0xa0'));db['SugarcrmConfiguration']=db['sequelize']['import'](_0x16dd('0xa1'));db['SugarcrmField']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xa2'));db[_0x16dd('0xa3')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xa4'));db[_0x16dd('0xa5')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xa6'));db[_0x16dd('0xa7')]=db['sequelize'][_0x16dd('0x12')]('../api/intDeskField/intDeskField.model');db[_0x16dd('0xa8')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xa9'));db['ZohoConfiguration']=db[_0x16dd('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x16dd('0xaa')]=db['sequelize']['import'](_0x16dd('0xab'));db[_0x16dd('0xac')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xad'));db[_0x16dd('0xae')]=db['sequelize'][_0x16dd('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x16dd('0xaf')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xb0'));db[_0x16dd('0xb1')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xb2'));db['FreshdeskConfiguration']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xb3'));db[_0x16dd('0xb4')]=db['sequelize']['import']('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xb5'));db[_0x16dd('0xb6')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x16dd('0xb7')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xb8'));db[_0x16dd('0xb9')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x16dd('0xba')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xbb'));db[_0x16dd('0xbc')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xbd'));db['Dynamics365Configuration']=db['sequelize']['import'](_0x16dd('0xbe'));db[_0x16dd('0xbf')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x16dd('0xc0')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xc1'));db[_0x16dd('0xc2')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xc3'));db[_0x16dd('0xc4')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xc5'));db[_0x16dd('0x91')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/integration/integration.model');db['Network']=db['sequelize']['import'](_0x16dd('0xc6'));db[_0x16dd('0xc7')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xc8'));db[_0x16dd('0xc9')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xca'));db['JscriptyAnswerReport']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x16dd('0xcb')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xcc'));db[_0x16dd('0xcd')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x16dd('0xce')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xcf'));db[_0x16dd('0xd0')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xd1'));db[_0x16dd('0xd2')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xd3'));db[_0x16dd('0xd4')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xd5'));db[_0x16dd('0xd6')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xd7'));db['SquareProject']=db['sequelize']['import']('../api/squareProject/squareProject.model');db['SquareRecording']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xd8'));db['SquareMessage']=db[_0x16dd('0x1')]['import'](_0x16dd('0xd9'));db['Team']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/team/team.model');db[_0x16dd('0xda')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/license/license.model');db[_0x16dd('0xdb')]=db['sequelize']['import'](_0x16dd('0xdc'));db['Migration']=db[_0x16dd('0x1')]['import'](_0x16dd('0xdd'));db[_0x16dd('0xde')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/attachment/attachment.model');db[_0x16dd('0xdf')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xe0'));db[_0x16dd('0xe1')]=db['sequelize']['import'](_0x16dd('0xe2'));db[_0x16dd('0xe3')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x16dd('0x1')]['import'](_0x16dd('0xe4'));db[_0x16dd('0xe5')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xe6'));db[_0x16dd('0xe7')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xe8'));db[_0x16dd('0xe9')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xea'));db[_0x16dd('0xeb')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xec'));db[_0x16dd('0xed')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xee'));db[_0x16dd('0xef')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xf0'));db[_0x16dd('0xf1')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xf2'));db[_0x16dd('0xf3')]=db[_0x16dd('0x1')]['import']('../api/notification/notification.model');db[_0x16dd('0xf4')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xf5'));db[_0x16dd('0xf6')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xf7'));db[_0x16dd('0xf8')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xf9'));db[_0x16dd('0xfa')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xfb'));db[_0x16dd('0xfc')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xfd'));db[_0x16dd('0xfe')]=db['sequelize']['import'](_0x16dd('0xff'));db[_0x16dd('0x100')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x101'));db[_0x16dd('0x11')][_0x16dd('0x102')](db['VoiceMail'],{'as':_0x16dd('0x20'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x104')});db['User'][_0x16dd('0x105')](db['VoiceRecording'],{'as':_0x16dd('0x106'),'foreignKey':'UserId'});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x107')],{'as':_0x16dd('0x108'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')]['hasMany'](db[_0x16dd('0x109')],{'as':_0x16dd('0x10a'),'onDelete':_0x16dd('0x103'),'hooks':!![]});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x76')],{'as':_0x16dd('0x10b'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')]['hasMany'](db[_0x16dd('0x10c')],{'as':_0x16dd('0x10d'),'foreignKey':'UserId'});db['User'][_0x16dd('0x105')](db[_0x16dd('0x10e')],{'as':_0x16dd('0x10e'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x60')],{'as':_0x16dd('0x10f'),'foreignKey':'UserId'});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x110')],{'as':_0x16dd('0x111'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x57')],{'as':_0x16dd('0x112'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')]['hasMany'](db['FaxInteraction'],{'as':_0x16dd('0x113'),'foreignKey':'UserId'});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x41')],{'as':_0x16dd('0x114'),'foreignKey':'UserId'});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0xf8')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x16dd('0x11')]['hasMany'](db['Notification'],{'as':_0x16dd('0x115'),'foreignKey':_0x16dd('0x116')});db[_0x16dd('0x11')]['belongsTo'](db[_0x16dd('0xed')],{'as':'UserProfile','foreignKey':_0x16dd('0x117')});db['User'][_0x16dd('0x118')](db[_0x16dd('0x119')],{'as':_0x16dd('0x11a'),'through':_0x16dd('0x11b')});db[_0x16dd('0x11')][_0x16dd('0x118')](db['CmContact'],{'as':_0x16dd('0x11c'),'through':_0x16dd('0x11d')});db[_0x16dd('0x11')][_0x16dd('0x118')](db[_0x16dd('0xe9')],{'as':'Lists','through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0x16dd('0x11e')],{'through':_0x16dd('0x11f')});db['User']['belongsToMany'](db[_0x16dd('0x41')],{'as':_0x16dd('0x114'),'through':'user_has_mail_interactions'});db[_0x16dd('0x11')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x16dd('0x120')});db[_0x16dd('0x11')][_0x16dd('0x118')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x16dd('0x121')});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x57')],{'as':_0x16dd('0x112'),'through':'user_has_sms_interactions'});db[_0x16dd('0x11')][_0x16dd('0x118')](db['OpenchannelInteraction'],{'as':_0x16dd('0x10f'),'through':'user_has_openchannel_interactions'});db['User'][_0x16dd('0x118')](db['WhatsappInteraction'],{'as':_0x16dd('0x122'),'through':_0x16dd('0x123')});db[_0x16dd('0x11')][_0x16dd('0x118')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x16dd('0x2f'),'required':![]});db['User'][_0x16dd('0x118')](db['MailQueue'],{'as':_0x16dd('0x124'),'through':_0x16dd('0x33'),'required':![]});db['User'][_0x16dd('0x118')](db[_0x16dd('0x6c')],{'as':'ChatQueues','through':_0x16dd('0x31'),'required':![],'hooks':!![]});db['User'][_0x16dd('0x118')](db['FaxQueue'],{'as':_0x16dd('0x125'),'through':_0x16dd('0x35'),'required':![]});db[_0x16dd('0x11')][_0x16dd('0x118')](db[_0x16dd('0x5a')],{'as':'SmsQueues','through':_0x16dd('0x36'),'required':![]});db['User'][_0x16dd('0x118')](db[_0x16dd('0x62')],{'as':_0x16dd('0x126'),'through':_0x16dd('0x37'),'required':![]});db['User'][_0x16dd('0x118')](db[_0x16dd('0x100')],{'as':_0x16dd('0x127'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x16dd('0x118')](db['CmList'],{'through':_0x16dd('0x128')});db['User'][_0x16dd('0x118')](db[_0x16dd('0xeb')],{'as':_0x16dd('0x129'),'through':_0x16dd('0x12a'),'required':![]});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x12b')],{'as':_0x16dd('0x12c'),'through':_0x16dd('0x12d')});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x12e')],{'as':_0x16dd('0x12f'),'through':_0x16dd('0x130')});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x3f')],{'as':_0x16dd('0x131'),'through':'user_has_mail_accounts'});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x5c')],{'as':_0x16dd('0x132'),'through':_0x16dd('0x133')});db[_0x16dd('0x11')][_0x16dd('0x118')](db[_0x16dd('0x54')],{'as':_0x16dd('0x134'),'through':_0x16dd('0x135')});db[_0x16dd('0x11')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x16dd('0x136'),'through':_0x16dd('0x137')});db[_0x16dd('0x11')][_0x16dd('0x118')](db[_0x16dd('0x138')],{'as':_0x16dd('0x139'),'through':_0x16dd('0x13a')});db[_0x16dd('0x14')][_0x16dd('0x105')](db[_0x16dd('0x109')],{'as':_0x16dd('0x13b'),'onDelete':_0x16dd('0x103'),'foreignKey':'ChanSpyId'});db[_0x16dd('0x16')]['hasMany'](db[_0x16dd('0x109')],{'onDelete':_0x16dd('0x103')});db[_0x16dd('0x109')][_0x16dd('0x105')](db[_0x16dd('0x109')],{'as':_0x16dd('0x13c'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x19')][_0x16dd('0x118')](db[_0x16dd('0x88')],{'as':_0x16dd('0x13d'),'through':'moh_has_sounds'});db[_0x16dd('0x1b')]['hasMany'](db[_0x16dd('0x107')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x16dd('0x1b')][_0x16dd('0x105')](db[_0x16dd('0x13e')],{'as':'Hoppers','foreignKey':_0x16dd('0x13f')});db['VoiceQueue'][_0x16dd('0x105')](db[_0x16dd('0x76')],{'as':_0x16dd('0x10b'),'foreignKey':_0x16dd('0x13f')});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':_0x16dd('0x140'),'foreignKey':_0x16dd('0x13f')});db[_0x16dd('0x1b')][_0x16dd('0x105')](db[_0x16dd('0x10e')],{'as':_0x16dd('0x10e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x16dd('0x105')](db[_0x16dd('0x74')],{'as':_0x16dd('0x141'),'foreignKey':_0x16dd('0x13f')});db[_0x16dd('0x1b')]['hasMany'](db[_0x16dd('0xcd')],{'as':_0x16dd('0x142'),'foreignKey':_0x16dd('0x13f')});db[_0x16dd('0x1b')][_0x16dd('0x143')](db[_0x16dd('0x144')],{'as':'Trunk','foreignKey':_0x16dd('0x145')});db['VoiceQueue'][_0x16dd('0x143')](db[_0x16dd('0x144')],{'as':_0x16dd('0x146'),'foreignKey':'TrunkBackupId'});db[_0x16dd('0x1b')][_0x16dd('0x143')](db['Interval'],{'as':_0x16dd('0x147'),'foreignKey':'IntervalId'});db[_0x16dd('0x1b')][_0x16dd('0x143')](db[_0x16dd('0x83')],{'as':_0x16dd('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x16dd('0x1b')]['belongsToMany'](db[_0x16dd('0xe9')],{'as':_0x16dd('0x149'),'through':_0x16dd('0x14a')});db[_0x16dd('0x1b')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x2f')});db['VoiceQueue'][_0x16dd('0x118')](db[_0x16dd('0x11e')],{'as':_0x16dd('0x14c'),'through':_0x16dd('0x14d')});db[_0x16dd('0x1b')][_0x16dd('0x118')](db[_0x16dd('0xe9')],{'as':'BlackLists','through':_0x16dd('0x14e')});db['VoiceRecording']['belongsTo'](db[_0x16dd('0x11')],{'as':_0x16dd('0x11'),'foreignKey':'UserId'});db[_0x16dd('0x1e')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x11'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x20')][_0x16dd('0x105')](db['VoiceMailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x16dd('0x14f'),'sourceKey':_0x16dd('0x150')});db[_0x16dd('0x22')][_0x16dd('0x143')](db[_0x16dd('0x20')],{'foreignKey':_0x16dd('0x14f'),'targetKey':_0x16dd('0x150')});db[_0x16dd('0x24')][_0x16dd('0x105')](db[_0x16dd('0x29')],{'as':_0x16dd('0x151'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x16dd('0x105')](db[_0x16dd('0x28')],{'as':_0x16dd('0x152'),'foreignKey':_0x16dd('0x153'),'constraints':![]});db[_0x16dd('0x24')]['belongsTo'](db[_0x16dd('0x11')],{'as':_0x16dd('0x11'),'foreignKey':_0x16dd('0x104')});db['VoiceCallReport'][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':'Contact','foreignKey':_0x16dd('0x154')});db[_0x16dd('0x3b')]['belongsTo'](db['MailAccount'],{'as':_0x16dd('0x3f'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x3d')][_0x16dd('0x143')](db[_0x16dd('0x3f')],{'as':_0x16dd('0x3f'),'foreignKey':_0x16dd('0x155')});db['MailAccount']['hasOne'](db['MailServerIn'],{'as':_0x16dd('0x156'),'onDelete':_0x16dd('0x103')});db['MailAccount'][_0x16dd('0x102')](db[_0x16dd('0x3d')],{'as':_0x16dd('0x157'),'onDelete':'cascade'});db[_0x16dd('0x3f')][_0x16dd('0x105')](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x3f')][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x3f')][_0x16dd('0x105')](db[_0x16dd('0x43')],{'as':_0x16dd('0x15b'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x3f')]['hasMany'](db[_0x16dd('0x41')],{'as':_0x16dd('0x15c')});db[_0x16dd('0x3f')][_0x16dd('0x105')](db[_0x16dd('0x45')],{'as':'Applications'});db['MailAccount'][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0x3f')][_0x16dd('0x143')](db[_0x16dd('0x8c')],{'as':_0x16dd('0x8c'),'foreignKey':_0x16dd('0x15f')});db['MailAccount'][_0x16dd('0x143')](db[_0x16dd('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x16dd('0x160')});db[_0x16dd('0x3f')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x161')});db[_0x16dd('0x162')]['belongsToMany'](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x33')});db[_0x16dd('0x162')][_0x16dd('0x118')](db['Team'],{'through':_0x16dd('0x163'),'as':'Teams'});db[_0x16dd('0x41')][_0x16dd('0x105')](db[_0x16dd('0x43')],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x164')});db[_0x16dd('0x41')]['belongsTo'](db[_0x16dd('0x3f')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x155')});db['MailInteraction']['belongsTo'](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x41')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x167'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x41')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x168'),'as':'Tags'});db[_0x16dd('0x41')][_0x16dd('0x118')](db['Tag'],{'through':_0x16dd('0x168'),'as':_0x16dd('0x169')});db['MailInteraction'][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x16b'),'foreignKey':_0x16dd('0x164')});db[_0x16dd('0x43')][_0x16dd('0x105')](db[_0x16dd('0xde')],{'as':_0x16dd('0x16c'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x43')][_0x16dd('0x143')](db['User'],{'as':_0x16dd('0x11')});db[_0x16dd('0x43')]['belongsTo'](db['CmContact'],{'onDelete':_0x16dd('0x103'),'as':'Contact'});db[_0x16dd('0x43')]['belongsTo'](db[_0x16dd('0x41')],{'as':_0x16dd('0x16d'),'foreignKey':_0x16dd('0x164')});db['MailMessage']['belongsTo'](db[_0x16dd('0x3f')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x45')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':'restrict'});db[_0x16dd('0x45')]['belongsTo'](db['MailQueue'],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x45')][_0x16dd('0x143')](db[_0x16dd('0x3f')],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x45')][_0x16dd('0x143')](db['Interval'],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x45')][_0x16dd('0x143')](db[_0x16dd('0x8a')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db['MailQueueReport']['belongsTo'](db[_0x16dd('0x3f')],{});db[_0x16dd('0x47')][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0x47')]['belongsTo'](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db[_0x16dd('0x47')][_0x16dd('0x143')](db['MailInteraction'],{});db['MailQueueReport'][_0x16dd('0x143')](db['MailMessage'],{});db[_0x16dd('0x47')][_0x16dd('0x143')](db[_0x16dd('0x11')],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db['Dashboard'][_0x16dd('0x105')](db['DashboardItem'],{'as':'Items','onDelete':_0x16dd('0x103')});db['FaxAccount']['hasMany'](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x171')});db[_0x16dd('0x12e')][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':_0x16dd('0x171')});db['FaxAccount'][_0x16dd('0x105')](db[_0x16dd('0x4e')],{'as':_0x16dd('0x15c')});db[_0x16dd('0x12e')]['hasMany'](db[_0x16dd('0x4c')],{'as':_0x16dd('0x13c')});db[_0x16dd('0x12e')][_0x16dd('0x105')](db['VoiceExtension'],{'as':_0x16dd('0x172'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x12e')][_0x16dd('0x105')](db['FaxMessage'],{'as':'Messages'});db[_0x16dd('0x12e')][_0x16dd('0x143')](db[_0x16dd('0x144')],{'as':'Trunk'});db[_0x16dd('0x12e')][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':'ListId'});db[_0x16dd('0x12e')]['belongsTo'](db[_0x16dd('0x83')],{'as':_0x16dd('0x148'),'foreignKey':_0x16dd('0x160')});db[_0x16dd('0x12e')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':'Agents','through':_0x16dd('0x130')});db[_0x16dd('0x4c')][_0x16dd('0x143')](db['User'],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x4c')]['belongsTo'](db[_0x16dd('0x173')],{'onDelete':'restrict'});db[_0x16dd('0x4c')][_0x16dd('0x143')](db[_0x16dd('0x12e')],{'onDelete':'restrict'});db[_0x16dd('0x4c')]['belongsTo'](db[_0x16dd('0x8a')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db[_0x16dd('0x4e')][_0x16dd('0x105')](db[_0x16dd('0x50')],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x174')});db[_0x16dd('0x4e')][_0x16dd('0x143')](db['FaxAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x171')});db[_0x16dd('0x4e')][_0x16dd('0x143')](db['CmContact'],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x4e')][_0x16dd('0x143')](db['User'],{'as':_0x16dd('0x167'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x4e')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x175'),'as':_0x16dd('0x176')});db[_0x16dd('0x4e')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x175'),'as':_0x16dd('0x169')});db['FaxInteraction'][_0x16dd('0x118')](db['User'],{'as':'Users','through':_0x16dd('0x121'),'foreignKey':_0x16dd('0x174')});db[_0x16dd('0x50')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':'cascade','as':_0x16dd('0x11')});db[_0x16dd('0x50')]['belongsTo'](db[_0x16dd('0x4e')],{'as':_0x16dd('0x16d'),'foreignKey':_0x16dd('0x174')});db[_0x16dd('0x50')]['belongsTo'](db['CmContact'],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166')});db[_0x16dd('0x50')]['belongsTo'](db[_0x16dd('0xde')],{'as':_0x16dd('0xde'),'foreignKey':_0x16dd('0x177')});db[_0x16dd('0x50')]['belongsTo'](db[_0x16dd('0x12e')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x171')});db[_0x16dd('0x173')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x14b'),'through':'UserFaxQueue'});db[_0x16dd('0x173')][_0x16dd('0x118')](db['Team'],{'through':'team_has_fax_queues','as':_0x16dd('0x14c')});db[_0x16dd('0x52')]['belongsTo'](db[_0x16dd('0x12e')],{});db[_0x16dd('0x52')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':'ListId'});db[_0x16dd('0x52')]['belongsTo'](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db[_0x16dd('0x52')]['belongsTo'](db[_0x16dd('0x4e')],{});db['FaxQueueReport'][_0x16dd('0x143')](db[_0x16dd('0x50')],{});db[_0x16dd('0x52')][_0x16dd('0x143')](db[_0x16dd('0x11')],{});db[_0x16dd('0x52')][_0x16dd('0x143')](db[_0x16dd('0x173')],{});db['SmsAccount'][_0x16dd('0x105')](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x178')});db[_0x16dd('0x54')][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':_0x16dd('0x178')});db[_0x16dd('0x54')][_0x16dd('0x105')](db['SmsMessage'],{'as':_0x16dd('0x15b'),'foreignKey':_0x16dd('0x178')});db[_0x16dd('0x54')][_0x16dd('0x105')](db[_0x16dd('0x57')],{'as':'Interactions'});db[_0x16dd('0x54')][_0x16dd('0x105')](db[_0x16dd('0x55')],{'as':'Applications'});db[_0x16dd('0x54')]['belongsTo'](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db['SmsAccount'][_0x16dd('0x143')](db[_0x16dd('0x83')],{'as':_0x16dd('0x148'),'foreignKey':_0x16dd('0x160')});db[_0x16dd('0x54')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x14b'),'through':'user_has_sms_accounts'});db[_0x16dd('0x55')]['belongsTo'](db['User'],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x55')]['belongsTo'](db[_0x16dd('0x5a')],{'onDelete':'restrict'});db['SmsApplication'][_0x16dd('0x143')](db[_0x16dd('0x54')],{'onDelete':'restrict'});db[_0x16dd('0x55')][_0x16dd('0x143')](db[_0x16dd('0x147')],{'onDelete':_0x16dd('0x16e'),'foreignKey':'IntervalId'});db[_0x16dd('0x55')]['belongsTo'](db['Tag'],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db['SmsInteraction']['hasMany'](db['SmsMessage'],{'as':'Messages','onDelete':_0x16dd('0x103'),'foreignKey':'SmsInteractionId'});db[_0x16dd('0x57')][_0x16dd('0x143')](db['SmsAccount'],{'as':_0x16dd('0x165'),'foreignKey':'SmsAccountId'});db[_0x16dd('0x57')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x57')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':'Owner','foreignKey':_0x16dd('0x104')});db[_0x16dd('0x57')][_0x16dd('0x118')](db['Tag'],{'through':_0x16dd('0x179'),'as':_0x16dd('0x176')});db[_0x16dd('0x57')]['belongsToMany'](db[_0x16dd('0x8a')],{'through':'sms_interaction_has_tags','as':_0x16dd('0x169')});db[_0x16dd('0x57')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x17a'),'foreignKey':_0x16dd('0x17b')});db[_0x16dd('0x17c')][_0x16dd('0x143')](db['User'],{'as':_0x16dd('0x11')});db[_0x16dd('0x17c')]['belongsTo'](db[_0x16dd('0x72')],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166')});db[_0x16dd('0x17c')][_0x16dd('0x143')](db[_0x16dd('0x57')],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x16d'),'foreignKey':_0x16dd('0x17b')});db[_0x16dd('0x17c')][_0x16dd('0x143')](db[_0x16dd('0x54')],{'as':'Account','foreignKey':_0x16dd('0x178')});db[_0x16dd('0x5a')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x36'),'foreignKey':'SmsQueueId'});db[_0x16dd('0x5a')]['belongsToMany'](db[_0x16dd('0x11e')],{'through':_0x16dd('0x17d'),'as':_0x16dd('0x14c')});db[_0x16dd('0x5c')][_0x16dd('0x105')](db['Disposition'],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x17e')});db['OpenchannelAccount'][_0x16dd('0x105')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x16dd('0x17e')});db[_0x16dd('0x5c')][_0x16dd('0x105')](db[_0x16dd('0x60')],{'as':_0x16dd('0x15c'),'foreignKey':_0x16dd('0x17e')});db[_0x16dd('0x5c')][_0x16dd('0x105')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x16dd('0x17e')});db[_0x16dd('0x5c')][_0x16dd('0x105')](db['OpenchannelApplication'],{'as':_0x16dd('0x13c'),'foreignKey':_0x16dd('0x17e')});db['OpenchannelAccount'][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0x5c')][_0x16dd('0x143')](db['Pause'],{'as':_0x16dd('0x148'),'foreignKey':_0x16dd('0x160')});db[_0x16dd('0x5c')]['belongsToMany'](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':'user_has_openchannel_accounts'});db[_0x16dd('0x5e')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x5e')][_0x16dd('0x143')](db['OpenchannelQueue'],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x17f')});db[_0x16dd('0x5e')][_0x16dd('0x143')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x16dd('0x17e')});db[_0x16dd('0x5e')]['belongsTo'](db[_0x16dd('0x147')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x16f')});db['OpenchannelApplication'][_0x16dd('0x143')](db['Tag'],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db['OpenchannelInteraction'][_0x16dd('0x105')](db[_0x16dd('0x180')],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':'OpenchannelInteractionId'});db[_0x16dd('0x60')][_0x16dd('0x143')](db['OpenchannelAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x17e')});db['OpenchannelInteraction'][_0x16dd('0x143')](db['CmContact'],{'as':'Contact','foreignKey':_0x16dd('0x154')});db[_0x16dd('0x60')]['belongsTo'](db[_0x16dd('0x11')],{'as':'Owner','foreignKey':_0x16dd('0x104')});db[_0x16dd('0x60')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x181'),'as':_0x16dd('0x176')});db[_0x16dd('0x60')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':'openchannel_interaction_has_tags','as':_0x16dd('0x169')});db[_0x16dd('0x60')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x182'),'foreignKey':_0x16dd('0x183')});db[_0x16dd('0x180')][_0x16dd('0x143')](db['User'],{'onDelete':'cascade','as':_0x16dd('0x11')});db['OpenchannelMessage'][_0x16dd('0x143')](db[_0x16dd('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0x16dd('0x180')][_0x16dd('0x143')](db[_0x16dd('0x60')],{'onDelete':'cascade','as':_0x16dd('0x16d'),'foreignKey':'OpenchannelInteractionId'});db[_0x16dd('0x180')][_0x16dd('0x143')](db[_0x16dd('0xde')],{'as':'Attachment','foreignKey':_0x16dd('0x177')});db['OpenchannelMessage'][_0x16dd('0x143')](db[_0x16dd('0x5c')],{'as':_0x16dd('0x165'),'foreignKey':'OpenchannelAccountId'});db[_0x16dd('0x62')]['belongsToMany'](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x37'),'foreignKey':'OpenchannelQueueId'});db[_0x16dd('0x62')][_0x16dd('0x118')](db['Team'],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x16dd('0x12b')][_0x16dd('0x105')](db['Disposition'],{'as':_0x16dd('0x159'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':'ChatWebsiteId'});db[_0x16dd('0x12b')][_0x16dd('0x105')](db[_0x16dd('0x6e')],{'as':_0x16dd('0x184')});db[_0x16dd('0x12b')][_0x16dd('0x105')](db[_0x16dd('0x110')],{'as':_0x16dd('0x15c')});db[_0x16dd('0x12b')][_0x16dd('0x105')](db[_0x16dd('0x66')],{'as':'Applications'});db['ChatWebsite'][_0x16dd('0x105')](db[_0x16dd('0x185')],{'as':'Messages'});db['ChatWebsite']['belongsTo'](db[_0x16dd('0xe9')],{'as':'List','foreignKey':_0x16dd('0x15e')});db['ChatWebsite'][_0x16dd('0x143')](db[_0x16dd('0x147')],{'as':_0x16dd('0x147'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x12b')][_0x16dd('0x143')](db[_0x16dd('0x83')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite']['belongsToMany'](db['User'],{'as':_0x16dd('0x14b'),'through':'user_has_chat_websites'});db[_0x16dd('0x65')][_0x16dd('0x143')](db[_0x16dd('0x5c')],{});db[_0x16dd('0x65')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':'ListId'});db[_0x16dd('0x65')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db['OpenchannelQueueReport']['belongsTo'](db[_0x16dd('0x60')],{});db[_0x16dd('0x65')][_0x16dd('0x143')](db[_0x16dd('0x180')],{});db[_0x16dd('0x65')]['belongsTo'](db[_0x16dd('0x11')],{});db['OpenchannelQueueReport'][_0x16dd('0x143')](db[_0x16dd('0x62')],{});db['ChatApplication']['belongsTo'](db['User'],{'as':_0x16dd('0x186'),'foreignKey':_0x16dd('0x104'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x66')][_0x16dd('0x143')](db[_0x16dd('0x6c')],{'as':_0x16dd('0x187'),'foreignKey':_0x16dd('0x188'),'onDelete':_0x16dd('0x16e')});db['ChatApplication']['belongsTo'](db[_0x16dd('0x12b')],{'as':_0x16dd('0x189'),'foreignKey':_0x16dd('0x18a'),'onDelete':_0x16dd('0x16e')});db['ChatApplication'][_0x16dd('0x143')](db[_0x16dd('0x8a')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db[_0x16dd('0x110')][_0x16dd('0x105')](db[_0x16dd('0x185')],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x18b')});db[_0x16dd('0x110')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x16dd('0x18a')});db[_0x16dd('0x110')][_0x16dd('0x143')](db['CmContact'],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db['ChatInteraction'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x167'),'foreignKey':_0x16dd('0x104')});db['ChatInteraction'][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':'chat_interaction_has_tags','as':_0x16dd('0x176')});db[_0x16dd('0x110')][_0x16dd('0x118')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x16dd('0x169')});db[_0x16dd('0x110')][_0x16dd('0x118')](db['User'],{'as':'Users','through':_0x16dd('0x120'),'foreignKey':'ChatInteractionId'});db[_0x16dd('0x185')][_0x16dd('0x143')](db['User'],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x11')});db[_0x16dd('0x185')]['belongsTo'](db[_0x16dd('0x72')],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db['ChatMessage'][_0x16dd('0x143')](db['ChatInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x16dd('0x18b')});db[_0x16dd('0x185')][_0x16dd('0x143')](db[_0x16dd('0xde')],{'as':_0x16dd('0xde'),'foreignKey':_0x16dd('0x177')});db['ChatMessage'][_0x16dd('0x143')](db[_0x16dd('0x12b')],{'as':_0x16dd('0x165'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x16dd('0x143')](db['CmContact'],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db[_0x16dd('0x6a')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x16dd('0x18a')});db[_0x16dd('0x6c')]['belongsToMany'](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x31'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x16dd('0x11e')],{'through':_0x16dd('0x18c'),'as':_0x16dd('0x14c')});db[_0x16dd('0x119')]['hasMany'](db[_0x16dd('0xc9')],{'as':_0x16dd('0x15b'),'foreignKey':_0x16dd('0x18d'),'onDelete':'cascade'});db['ChatGroup']['belongsToMany'](db[_0x16dd('0x11')],{'as':_0x16dd('0x18e'),'through':_0x16dd('0x11b')});db[_0x16dd('0x6e')]['belongsTo'](db[_0x16dd('0x12b')],{'as':_0x16dd('0x189'),'foreignKey':_0x16dd('0x18a')});db[_0x16dd('0x70')][_0x16dd('0x105')](db[_0x16dd('0x72')],{'as':'Contacts','foreignKey':_0x16dd('0x18f')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x13e')],{'as':_0x16dd('0x190'),'foreignKey':'ContactId'});db[_0x16dd('0x72')]['hasMany'](db[_0x16dd('0x76')],{'as':'HopperFinals','foreignKey':_0x16dd('0x154')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x10c')],{'as':_0x16dd('0x140'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x10e')],{'as':_0x16dd('0x10e'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0xcd')],{'as':_0x16dd('0x142'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x60')],{'as':_0x16dd('0x10f'),'foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x16e')});db['CmContact'][_0x16dd('0x105')](db[_0x16dd('0x110')],{'as':_0x16dd('0x111'),'foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x57')],{'as':'SmsInteractions','foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x4e')],{'as':_0x16dd('0x113'),'foreignKey':'ContactId','onDelete':_0x16dd('0x16e')});db[_0x16dd('0x72')]['hasMany'](db[_0x16dd('0x41')],{'as':_0x16dd('0x114'),'foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x72')][_0x16dd('0x143')](db[_0x16dd('0x70')],{'as':'Company','foreignKey':_0x16dd('0x18f')});db[_0x16dd('0x72')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x72')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x11d')});db[_0x16dd('0x72')][_0x16dd('0x118')](db['Tag'],{'as':_0x16dd('0x176'),'through':'cm_contact_has_tags'});db[_0x16dd('0x72')][_0x16dd('0x118')](db['Tag'],{'through':_0x16dd('0x191'),'as':'ThroughTags'});db['CmHopper'][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db['User'],{'as':'Agent','foreignKey':_0x16dd('0x104')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db[_0x16dd('0x1b')],{'as':_0x16dd('0x187'),'foreignKey':_0x16dd('0x13f'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db[_0x16dd('0xdb')],{'as':'Campaign','foreignKey':_0x16dd('0x192'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x167'),'foreignKey':_0x16dd('0x193')});db[_0x16dd('0x74')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154'),'onDelete':'cascade'});db[_0x16dd('0x74')][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e'),'onDelete':'cascade'});db['CmHopperBlack'][_0x16dd('0x143')](db[_0x16dd('0x1b')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x16dd('0x103')});db[_0x16dd('0x74')][_0x16dd('0x143')](db[_0x16dd('0xdb')],{'as':_0x16dd('0xdb'),'foreignKey':_0x16dd('0x192'),'onDelete':_0x16dd('0x103')});db['Automation'][_0x16dd('0x105')](db[_0x16dd('0x80')],{'as':{'plural':_0x16dd('0x194'),'singular':_0x16dd('0x195')},'foreignKey':'AutomationAllId','onDelete':_0x16dd('0x103'),'hooks':!![]});db[_0x16dd('0x7b')][_0x16dd('0x105')](db['Condition'],{'as':{'plural':_0x16dd('0x196'),'singular':_0x16dd('0x197')},'foreignKey':'AutomationAnyId','onDelete':_0x16dd('0x103'),'hooks':!![]});db[_0x16dd('0x7b')]['hasMany'](db[_0x16dd('0x7a')],{'as':_0x16dd('0x198'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x16dd('0x147')]['hasMany'](db[_0x16dd('0x147')],{'as':'Intervals','foreignKey':_0x16dd('0x16f'),'onDelete':_0x16dd('0x103'),'hooks':!![],'required':![]});db[_0x16dd('0x147')][_0x16dd('0x105')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x16dd('0x16f'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x147')]['hasMany'](db[_0x16dd('0x45')],{'as':_0x16dd('0x199'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x147')]['hasMany'](db[_0x16dd('0x66')],{'as':_0x16dd('0x19a'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x147')][_0x16dd('0x105')](db[_0x16dd('0x4c')],{'as':_0x16dd('0x19b'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x147')][_0x16dd('0x105')](db['SmsApplication'],{'as':_0x16dd('0x19c'),'foreignKey':'IntervalId'});db[_0x16dd('0x86')]['belongsTo'](db[_0x16dd('0x3f')],{});db[_0x16dd('0x86')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0x16dd('0x19d')});db[_0x16dd('0x86')][_0x16dd('0x143')](db[_0x16dd('0x19e')],{'foreignKey':'CustomReportId'});db[_0x16dd('0x88')]['belongsToMany'](db[_0x16dd('0x19')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x16dd('0x16e')});db['Tag'][_0x16dd('0x118')](db[_0x16dd('0x72')],{'through':_0x16dd('0x191')});db[_0x16dd('0x8a')][_0x16dd('0x118')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x16dd('0x8a')][_0x16dd('0x118')](db[_0x16dd('0x41')],{'through':'mail_interaction_has_tags'});db[_0x16dd('0x8a')][_0x16dd('0x118')](db['SmsInteraction'],{'through':_0x16dd('0x179')});db[_0x16dd('0x8a')][_0x16dd('0x118')](db['FaxInteraction'],{'through':_0x16dd('0x175')});db[_0x16dd('0x8a')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x16dd('0x181')});db['Tag'][_0x16dd('0x118')](db[_0x16dd('0xf8')],{'through':_0x16dd('0x19f')});db[_0x16dd('0x8e')][_0x16dd('0x105')](db[_0x16dd('0x80')],{'as':{'plural':_0x16dd('0x1a0'),'singular':_0x16dd('0x1a1')},'foreignKey':_0x16dd('0x1a2'),'onDelete':_0x16dd('0x103'),'hooks':!![]});db['Trigger'][_0x16dd('0x105')](db[_0x16dd('0x80')],{'as':{'plural':'AnyConditions','singular':_0x16dd('0x1a3')},'foreignKey':_0x16dd('0x1a4'),'onDelete':_0x16dd('0x103'),'hooks':!![]});db['Trigger'][_0x16dd('0x105')](db[_0x16dd('0x7a')],{'as':_0x16dd('0x198'),'foreignKey':_0x16dd('0x1a5'),'onDelete':_0x16dd('0x103'),'hooks':!![]});db[_0x16dd('0x19e')][_0x16dd('0x105')](db[_0x16dd('0x99')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1a7'),'hooks':!![]});db[_0x16dd('0x96')][_0x16dd('0x105')](db[_0x16dd('0x99')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x16dd('0x105')](db[_0x16dd('0x99')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':'MetricId'});db[_0x16dd('0x99')][_0x16dd('0x143')](db[_0x16dd('0x1a8')],{'foreignKey':_0x16dd('0x1a9')});db[_0x16dd('0x1aa')][_0x16dd('0x105')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x9e')][_0x16dd('0x105')](db[_0x16dd('0x1ac')],{'as':_0x16dd('0x1ad'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ae')});db['SalesforceConfiguration'][_0x16dd('0x105')](db['SalesforceField'],{'as':_0x16dd('0x1af'),'onDelete':_0x16dd('0x103'),'foreignKey':'DescriptionId'});db[_0x16dd('0x9e')][_0x16dd('0x105')](db[_0x16dd('0x1ac')],{'as':'Fields','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x9e')][_0x16dd('0x143')](db[_0x16dd('0x1aa')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x1ac')][_0x16dd('0x105')](db[_0x16dd('0x1ac')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0x1ac')]['hasMany'](db[_0x16dd('0x1ac')],{'as':_0x16dd('0x1b2'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1ac')][_0x16dd('0x105')](db[_0x16dd('0x1ac')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x1ac')][_0x16dd('0x143')](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0x1b7')]['hasMany'](db[_0x16dd('0x1b8')],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x1b8')]['hasMany'](db[_0x16dd('0x1ba')],{'as':_0x16dd('0x1ad'),'onDelete':_0x16dd('0x103'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x16dd('0x105')](db[_0x16dd('0x1ba')],{'as':_0x16dd('0x1af'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1b8')][_0x16dd('0x105')](db[_0x16dd('0x1ba')],{'as':'Fields','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x1b8')][_0x16dd('0x143')](db[_0x16dd('0x1b7')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db['SugarcrmField']['hasMany'](db[_0x16dd('0x1ba')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db['SugarcrmField']['hasMany'](db[_0x16dd('0x1ba')],{'as':'Description','foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1ba')][_0x16dd('0x105')](db[_0x16dd('0x1ba')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db['SugarcrmField'][_0x16dd('0x143')](db['Variable'],{'as':'Variable','foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0xa3')]['hasMany'](db[_0x16dd('0xa5')],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xa5')][_0x16dd('0x105')](db[_0x16dd('0xa7')],{'as':'Subjects','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xa5')]['hasMany'](db[_0x16dd('0xa7')],{'as':_0x16dd('0x1af'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xa5')][_0x16dd('0x105')](db['DeskField'],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':'FieldId'});db[_0x16dd('0xa5')]['belongsTo'](db[_0x16dd('0xa3')],{'as':'Account','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xa5')][_0x16dd('0x118')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x16dd('0xa7')]['hasMany'](db['DeskField'],{'as':'Subject','foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xa7')]['hasMany'](db[_0x16dd('0xa7')],{'as':_0x16dd('0x1b2'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xa7')][_0x16dd('0x105')](db[_0x16dd('0xa7')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xa7')][_0x16dd('0x143')](db['Variable'],{'as':_0x16dd('0x1b5'),'foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0xa8')][_0x16dd('0x105')](db[_0x16dd('0x1bb')],{'as':_0x16dd('0x1b9'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ab')});db['ZohoConfiguration'][_0x16dd('0x105')](db['ZohoField'],{'as':_0x16dd('0x1ad'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ae')});db['ZohoConfiguration'][_0x16dd('0x105')](db[_0x16dd('0xaa')],{'as':'Descriptions','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1bb')][_0x16dd('0x105')](db[_0x16dd('0xaa')],{'as':'Fields','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x1bb')][_0x16dd('0x143')](db['ZohoAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xaa')][_0x16dd('0x105')](db[_0x16dd('0xaa')],{'as':'Subject','foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xaa')][_0x16dd('0x105')](db[_0x16dd('0xaa')],{'as':_0x16dd('0x1b2'),'foreignKey':'DescriptionId'});db[_0x16dd('0xaa')]['hasMany'](db[_0x16dd('0xaa')],{'as':_0x16dd('0x1b4'),'foreignKey':'FieldId'});db[_0x16dd('0xaa')][_0x16dd('0x143')](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':'VariableId'});db[_0x16dd('0xac')][_0x16dd('0x105')](db[_0x16dd('0xae')],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xae')]['hasMany'](db[_0x16dd('0xaf')],{'as':_0x16dd('0x1ad'),'foreignKey':'SubjectId'});db[_0x16dd('0xae')][_0x16dd('0x105')](db[_0x16dd('0xaf')],{'as':'Descriptions','foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xae')][_0x16dd('0x105')](db[_0x16dd('0xaf')],{'as':_0x16dd('0x1a6'),'foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db[_0x16dd('0xac')],{'as':_0x16dd('0x165'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['belongsToMany'](db[_0x16dd('0x8a')],{'through':_0x16dd('0x1bc')});db['ZendeskField'][_0x16dd('0x105')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x16dd('0x1ae')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':_0x16dd('0x1b3')});db['ZendeskField'][_0x16dd('0x105')](db[_0x16dd('0xaf')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db['ZendeskField']['belongsTo'](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':'VariableId'});db[_0x16dd('0xb1')][_0x16dd('0x105')](db[_0x16dd('0x1bd')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x1bd')]['hasMany'](db[_0x16dd('0xb4')],{'as':_0x16dd('0x1ad'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0x1bd')][_0x16dd('0x105')](db['FreshdeskField'],{'as':_0x16dd('0x1af'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1bd')][_0x16dd('0x105')](db[_0x16dd('0xb4')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db['FreshdeskConfiguration'][_0x16dd('0x143')](db[_0x16dd('0xb1')],{'as':_0x16dd('0x165'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x1be')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db['FreshdeskField']['hasMany'](db[_0x16dd('0xb4')],{'as':_0x16dd('0x1b2'),'foreignKey':'DescriptionId'});db[_0x16dd('0xb4')]['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xb4')]['belongsTo'](db[_0x16dd('0x1b5')],{'as':'Variable','foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0x1bf')]['hasMany'](db[_0x16dd('0xb6')],{'as':_0x16dd('0x1b9'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xb6')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1ad'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xb6')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1af'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xb6')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1a6'),'foreignKey':'FieldId'});db[_0x16dd('0xb6')][_0x16dd('0x143')](db[_0x16dd('0x1bf')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xb7')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xb7')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':'Description','foreignKey':_0x16dd('0x1b3')});db['VtigerField'][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xb7')][_0x16dd('0x143')](db['Variable'],{'as':_0x16dd('0x1b5'),'foreignKey':_0x16dd('0x1b6')});db['ServicenowAccount'][_0x16dd('0x105')](db['ServicenowConfiguration'],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x16dd('0xb9')]['hasMany'](db[_0x16dd('0xba')],{'as':_0x16dd('0x1ad'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xb9')][_0x16dd('0x105')](db[_0x16dd('0xba')],{'as':_0x16dd('0x1af'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xb9')][_0x16dd('0x105')](db[_0x16dd('0xba')],{'as':_0x16dd('0x1a6'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xb9')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xba')]['hasMany'](db[_0x16dd('0xba')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xba')][_0x16dd('0x105')](db[_0x16dd('0xba')],{'as':_0x16dd('0x1b2'),'foreignKey':'DescriptionId'});db[_0x16dd('0xba')][_0x16dd('0x105')](db['ServicenowField'],{'as':'Field','foreignKey':_0x16dd('0x1b0')});db['ServicenowField'][_0x16dd('0x143')](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0xbc')]['hasMany'](db[_0x16dd('0x1c0')],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x1c0')][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1ad'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ae')});db['Dynamics365Configuration'][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':'Descriptions','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db['Dynamics365Configuration'][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x1c0')]['belongsTo'](db[_0x16dd('0xbc')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db['Dynamics365Field'][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xbf')][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1b2'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xbf')][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xbf')][_0x16dd('0x143')](db['Variable'],{'as':_0x16dd('0x1b5'),'foreignKey':'VariableId'});db[_0x16dd('0xc0')]['hasMany'](db[_0x16dd('0xc2')],{'as':_0x16dd('0x1b9'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ab')});db['FreshsalesConfiguration'][_0x16dd('0x105')](db[_0x16dd('0xc4')],{'as':_0x16dd('0x1ad'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xc2')][_0x16dd('0x105')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x16dd('0x105')](db[_0x16dd('0xc4')],{'as':'Fields','foreignKey':_0x16dd('0x1b0')});db['FreshsalesConfiguration'][_0x16dd('0x143')](db['FreshsalesAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xc4')]['hasMany'](db[_0x16dd('0xc4')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xc4')][_0x16dd('0x105')](db[_0x16dd('0xc4')],{'as':_0x16dd('0x1b2'),'foreignKey':_0x16dd('0x1b3')});db['FreshsalesField']['hasMany'](db[_0x16dd('0xc4')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xc4')][_0x16dd('0x143')](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':'VariableId'});db[_0x16dd('0xc7')][_0x16dd('0x143')](db[_0x16dd('0x12b')],{});db[_0x16dd('0xc7')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':'List','foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xc7')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0xc7')]['belongsTo'](db['ChatInteraction'],{});db[_0x16dd('0xc7')]['belongsTo'](db[_0x16dd('0x185')],{});db['ChatQueueReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{});db[_0x16dd('0xc7')][_0x16dd('0x143')](db[_0x16dd('0x6c')],{});db[_0x16dd('0xc9')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1c1')});db['ChatInternalMessage'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1c2')});db[_0x16dd('0xcd')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x16dd('0x103')});db['JscriptySessionReport'][_0x16dd('0x105')](db[_0x16dd('0x1c3')],{'foreignKey':_0x16dd('0x1c4'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0xce')]['belongsTo'](db['SmsAccount'],{});db[_0x16dd('0xce')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xce')]['belongsTo'](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db[_0x16dd('0xce')][_0x16dd('0x143')](db['SmsInteraction'],{});db[_0x16dd('0xce')][_0x16dd('0x143')](db[_0x16dd('0x17c')],{});db['SmsQueueReport']['belongsTo'](db[_0x16dd('0x11')],{});db[_0x16dd('0xce')][_0x16dd('0x143')](db[_0x16dd('0x5a')],{});db[_0x16dd('0xd2')]['hasMany'](db[_0x16dd('0xcd')],{'foreignKey':_0x16dd('0x1c5')});db[_0x16dd('0xd2')]['hasMany'](db[_0x16dd('0xcb')],{'foreignKey':_0x16dd('0x1c5')});db['JscriptyProject'][_0x16dd('0x105')](db[_0x16dd('0x1c3')],{'foreignKey':_0x16dd('0x1c5')});db[_0x16dd('0x138')]['belongsToMany'](db['User'],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x13a')});db[_0x16dd('0x11e')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x11f')});db['Team'][_0x16dd('0x118')](db[_0x16dd('0x1b')],{'through':_0x16dd('0x14d'),'as':'VoiceQueues'});db[_0x16dd('0x11e')]['belongsToMany'](db['MailQueue'],{'through':_0x16dd('0x163'),'as':_0x16dd('0x124')});db['Team'][_0x16dd('0x118')](db[_0x16dd('0x6c')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x16dd('0x11e')][_0x16dd('0x118')](db[_0x16dd('0x173')],{'through':_0x16dd('0x1c6'),'as':'FaxQueues'});db[_0x16dd('0x11e')][_0x16dd('0x118')](db[_0x16dd('0x5a')],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team']['belongsToMany'](db[_0x16dd('0x62')],{'through':_0x16dd('0x1c7'),'as':_0x16dd('0x126')});db['Team'][_0x16dd('0x118')](db[_0x16dd('0x100')],{'through':'team_has_whatsapp_queues','as':_0x16dd('0x127')});db[_0x16dd('0xdb')][_0x16dd('0x105')](db['CmHopper'],{'as':_0x16dd('0x190'),'foreignKey':'CampaignId'});db['Campaign'][_0x16dd('0x105')](db[_0x16dd('0x76')],{'as':_0x16dd('0x10b'),'foreignKey':_0x16dd('0x192')});db[_0x16dd('0xdb')]['hasMany'](db[_0x16dd('0x10c')],{'as':_0x16dd('0x140'),'foreignKey':_0x16dd('0x192')});db[_0x16dd('0xdb')][_0x16dd('0x105')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x16dd('0x192')});db[_0x16dd('0xdb')]['belongsTo'](db['Trunk'],{'as':_0x16dd('0x144'),'foreignKey':_0x16dd('0x145')});db['Campaign']['belongsTo'](db[_0x16dd('0x144')],{'as':_0x16dd('0x146'),'foreignKey':_0x16dd('0x1c8')});db['Campaign']['belongsTo'](db[_0x16dd('0x147')],{'as':'Interval','foreignKey':_0x16dd('0x16f')});db[_0x16dd('0xdb')][_0x16dd('0x143')](db[_0x16dd('0x138')],{'as':_0x16dd('0x138'),'foreignKey':_0x16dd('0x1c9')});db[_0x16dd('0xdb')][_0x16dd('0x118')](db[_0x16dd('0xe9')],{'as':'Lists','through':_0x16dd('0x1ca')});db['Campaign'][_0x16dd('0x118')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x1cb'),'through':_0x16dd('0x1cc')});db[_0x16dd('0xe1')][_0x16dd('0x143')](db[_0x16dd('0x43')],{});db[_0x16dd('0xe1')]['belongsTo'](db['MailInteraction'],{});db[_0x16dd('0xe1')][_0x16dd('0x143')](db['MailAccount'],{'foreignKey':_0x16dd('0x1cd'),'as':_0x16dd('0x1ce')});db['MailTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db[_0x16dd('0xe1')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x16dd('0xe1')][_0x16dd('0x143')](db[_0x16dd('0x162')],{'foreignKey':_0x16dd('0x1d1'),'as':_0x16dd('0x1d2')});db['MailTransferReport']['belongsTo'](db[_0x16dd('0x3f')],{'foreignKey':_0x16dd('0x1d3'),'as':_0x16dd('0x1d4')});db[_0x16dd('0xe3')]['belongsTo'](db[_0x16dd('0x185')],{});db[_0x16dd('0xe3')]['belongsTo'](db['ChatInteraction'],{});db[_0x16dd('0xe3')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x16dd('0x1ce')});db[_0x16dd('0xe3')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db[_0x16dd('0xe3')][_0x16dd('0x143')](db['User'],{'foreignKey':'ToUserId','as':_0x16dd('0x1d5')});db['ChatTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x6c')],{'foreignKey':_0x16dd('0x1d6'),'as':_0x16dd('0x1d2')});db[_0x16dd('0xe3')]['belongsTo'](db[_0x16dd('0x12b')],{'foreignKey':'ToChatWebsiteId','as':_0x16dd('0x1d4')});db['FaxTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x50')],{});db['FaxTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x4e')],{});db[_0x16dd('0x1d7')][_0x16dd('0x143')](db[_0x16dd('0x12e')],{'foreignKey':_0x16dd('0x1d8'),'as':_0x16dd('0x1ce')});db[_0x16dd('0x1d7')][_0x16dd('0x143')](db['User'],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db['FaxTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':'ToUserId','as':_0x16dd('0x1d5')});db[_0x16dd('0x1d7')]['belongsTo'](db[_0x16dd('0x173')],{'foreignKey':'ToFaxQueueId','as':_0x16dd('0x1d2')});db[_0x16dd('0x1d7')][_0x16dd('0x143')](db[_0x16dd('0x12e')],{'foreignKey':_0x16dd('0x1d9'),'as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x16dd('0x180')],{});db[_0x16dd('0xe5')][_0x16dd('0x143')](db[_0x16dd('0x60')],{});db[_0x16dd('0xe5')][_0x16dd('0x143')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x16dd('0x1ce')});db[_0x16dd('0xe5')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':'FromUserId','as':_0x16dd('0x1d0')});db[_0x16dd('0xe5')]['belongsTo'](db[_0x16dd('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x62')],{'foreignKey':_0x16dd('0x1da'),'as':'ToQueue'});db[_0x16dd('0xe5')][_0x16dd('0x143')](db[_0x16dd('0x5c')],{'foreignKey':_0x16dd('0x1db'),'as':_0x16dd('0x1d4')});db[_0x16dd('0xe7')][_0x16dd('0x143')](db[_0x16dd('0x17c')],{});db[_0x16dd('0xe7')]['belongsTo'](db[_0x16dd('0x57')],{});db[_0x16dd('0xe7')][_0x16dd('0x143')](db[_0x16dd('0x54')],{'foreignKey':_0x16dd('0x1dc'),'as':'FromAccount'});db['SmsTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db[_0x16dd('0xe7')][_0x16dd('0x143')](db['User'],{'foreignKey':_0x16dd('0x1dd'),'as':_0x16dd('0x1d5')});db[_0x16dd('0xe7')][_0x16dd('0x143')](db['SmsQueue'],{'foreignKey':_0x16dd('0x1de'),'as':_0x16dd('0x1d2')});db[_0x16dd('0xe7')][_0x16dd('0x143')](db['SmsAccount'],{'foreignKey':_0x16dd('0x1df'),'as':_0x16dd('0x1d4')});db['CmList'][_0x16dd('0x105')](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db[_0x16dd('0x79')],{'as':_0x16dd('0x1e0'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db[_0x16dd('0x72')],{'as':_0x16dd('0x11c'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db['CmHopperFinal'],{'as':_0x16dd('0x10b'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db[_0x16dd('0x10c')],{'as':_0x16dd('0x10d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db[_0x16dd('0x10e')],{'as':'ReportAgentPreview','foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x118')](db[_0x16dd('0x1b')],{'as':'Queues','through':_0x16dd('0x14a')});db[_0x16dd('0xe9')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x128')});db['VoicePrefix'][_0x16dd('0x105')](db[_0x16dd('0x109')],{'as':_0x16dd('0x10a'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0xeb')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x12a')});db[_0x16dd('0xed')][_0x16dd('0x105')](db[_0x16dd('0x11')],{'as':'Users','foreignKey':'userProfileId'});db[_0x16dd('0xed')]['hasMany'](db[_0x16dd('0xef')],{'as':'UserProfileSections','foreignKey':_0x16dd('0x117'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0xef')][_0x16dd('0x105')](db[_0x16dd('0xf1')],{'as':_0x16dd('0x1e1'),'foreignKey':_0x16dd('0x1e2'),'onDelete':'cascade'});db[_0x16dd('0xf4')][_0x16dd('0x105')](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x1e3')});db[_0x16dd('0xf4')][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':_0x16dd('0x1e3')});db['WhatsappAccount']['hasMany'](db[_0x16dd('0xfa')],{'as':_0x16dd('0x15b'),'foreignKey':_0x16dd('0x1e3')});db[_0x16dd('0xf4')][_0x16dd('0x105')](db['WhatsappInteraction'],{'as':_0x16dd('0x15c')});db[_0x16dd('0xf4')]['hasMany'](db[_0x16dd('0xf6')],{'as':_0x16dd('0x13c')});db['WhatsappAccount'][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':'ListId'});db[_0x16dd('0xf4')][_0x16dd('0x143')](db['Pause'],{'as':_0x16dd('0x148'),'foreignKey':_0x16dd('0x160')});db[_0x16dd('0xf4')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x16dd('0xf6')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0xf6')][_0x16dd('0x143')](db[_0x16dd('0x100')],{'onDelete':'restrict'});db[_0x16dd('0xf6')][_0x16dd('0x143')](db[_0x16dd('0xf4')],{'onDelete':_0x16dd('0x16e')});db['WhatsappApplication']['belongsTo'](db[_0x16dd('0x147')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x16f')});db['WhatsappApplication'][_0x16dd('0x143')](db[_0x16dd('0x8a')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db[_0x16dd('0xf8')][_0x16dd('0x105')](db['WhatsappMessage'],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':'WhatsappInteractionId'});db[_0x16dd('0xf8')]['belongsTo'](db['WhatsappAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1e3')});db[_0x16dd('0xf8')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':'Owner','foreignKey':_0x16dd('0x104')});db[_0x16dd('0xf8')][_0x16dd('0x118')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x16dd('0xf8')]['belongsToMany'](db[_0x16dd('0x8a')],{'through':_0x16dd('0x19f'),'as':_0x16dd('0x169')});db['WhatsappInteraction']['belongsToMany'](db[_0x16dd('0x11')],{'as':'Users','through':_0x16dd('0x123'),'foreignKey':_0x16dd('0x1e4')});db[_0x16dd('0xfa')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x11')});db[_0x16dd('0xfa')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166')});db[_0x16dd('0xfa')][_0x16dd('0x143')](db['WhatsappInteraction'],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x16d'),'foreignKey':'WhatsappInteractionId'});db[_0x16dd('0xfa')][_0x16dd('0x143')](db[_0x16dd('0xf4')],{'as':'Account','foreignKey':_0x16dd('0x1e3')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappAccount'],{});db[_0x16dd('0xfc')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xfc')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0xfc')]['belongsTo'](db[_0x16dd('0xf8')],{});db[_0x16dd('0xfc')][_0x16dd('0x143')](db[_0x16dd('0x100')],{});db[_0x16dd('0xfc')][_0x16dd('0x143')](db[_0x16dd('0xfa')],{});db['WhatsappQueueReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{});db[_0x16dd('0xfe')][_0x16dd('0x143')](db[_0x16dd('0xfa')],{});db['WhatsappTransferReport'][_0x16dd('0x143')](db[_0x16dd('0xf8')],{});db[_0x16dd('0xfe')][_0x16dd('0x143')](db[_0x16dd('0xf4')],{'foreignKey':_0x16dd('0x1e5'),'as':_0x16dd('0x1ce')});db[_0x16dd('0xfe')][_0x16dd('0x143')](db[_0x16dd('0xf4')],{'foreignKey':_0x16dd('0x1e6'),'as':'ToAccount'});db[_0x16dd('0xfe')]['belongsTo'](db[_0x16dd('0x100')],{'foreignKey':_0x16dd('0x1e7'),'as':_0x16dd('0x1d2')});db['WhatsappTransferReport']['belongsTo'](db[_0x16dd('0x11')],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db['WhatsappTransferReport'][_0x16dd('0x143')](db['User'],{'foreignKey':'ToUserId','as':_0x16dd('0x1d5')});db[_0x16dd('0x100')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x39'),'foreignKey':_0x16dd('0x1e8')});db[_0x16dd('0x100')][_0x16dd('0x118')](db[_0x16dd('0x11e')],{'through':_0x16dd('0x1e9'),'as':_0x16dd('0x14c')});module[_0x16dd('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x5334=['IntervalId','TagId','ListId','FaxAccountId','Interactions','Exntensions','FaxInteractionId','Tags','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatWebsiteId','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessage','ChatGroupId','Contacts','CompanyId','CmHopper','Company','cm_contact_has_tags','OwnerId','CampaignId','Automation','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','Trigger','AnyCondition','TriggerId','Fields','CustomReportId','AnalyticDefaultReport','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','FieldId','Variable','VariableId','Field','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Configuration','FreshsalesConfiguration','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','MailQueues','team_has_chat_queues','team_has_openchannel_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','FromOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','HopperHistory','Queues','user_has_voice_prefixes','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappMessage','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','exports','path','../config/environment','sequelize','lodash','jstz','motion2','mysql','utf8_general_ci','sequelizeHistory','defaultsDeep','xcall','xC@LL1234','utf8mb4','name','utf8','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','VoiceQueuesLog','Schedule','Sound','../api/sound/sound.model','Tag','Template','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','UserId','Recordings','hasMany','VoiceQueuesRt','VoiceExtension','cascade','HopperFinals','CmHopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','Notifications','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','VoicePrefix','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_square_projects','SpiedAgents','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','Smtp','Disposition','Dispositions','Answers','Messages','List','TemplateId','team_has_mail_queues','Account','ContactId','Owner','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','restrict'];(function(_0x3c5b84,_0xaa08b8){var _0x340d3c=function(_0x24d687){while(--_0x24d687){_0x3c5b84['push'](_0x3c5b84['shift']());}};_0x340d3c(++_0xaa08b8);}(_0x5334,0x84));var _0x4533=function(_0x476226,_0x3e9ac5){_0x476226=_0x476226-0x0;var _0x1ff67e=_0x5334[_0x476226];return _0x1ff67e;};'use strict';var path=require(_0x4533('0x0'));var config=require(_0x4533('0x1'));var Sequelize=require(_0x4533('0x2'));var _=require(_0x4533('0x3'));var jstz=require(_0x4533('0x4'));var timezone=jstz['determine']();config[_0x4533('0x2')]=_['defaultsDeep'](config[_0x4533('0x2')],{'database':_0x4533('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4533('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x4533('0x7')}}});config[_0x4533('0x8')]=_[_0x4533('0x9')](config[_0x4533('0x8')],{'database':_0x4533('0x5'),'username':_0x4533('0xa'),'password':_0x4533('0xb'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4533('0x6'),'dialectOptions':{'charset':_0x4533('0xc')},'logging':![],'timezone':timezone[_0x4533('0xd')](),'define':{'charset':_0x4533('0xe'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4533('0x2')]['database'],config[_0x4533('0x2')][_0x4533('0xf')],config[_0x4533('0x2')][_0x4533('0x10')],config['sequelize'][_0x4533('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4533('0x8')][_0x4533('0x12')],config[_0x4533('0x8')]['username'],config[_0x4533('0x8')]['password'],config['sequelizeHistory'][_0x4533('0x11')])};db[_0x4533('0x13')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x15'));db[_0x4533('0x16')]=db['sequelize'][_0x4533('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x4533('0x17')]=db[_0x4533('0x2')]['import'](_0x4533('0x18'));db['VoiceExtension']=db['sequelize'][_0x4533('0x14')](_0x4533('0x19'));db['VoiceMusicOnHold']=db['sequelize'][_0x4533('0x14')](_0x4533('0x1a'));db[_0x4533('0x1b')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x1c'));db[_0x4533('0x1d')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x1e'));db[_0x4533('0x1f')]=db['sequelize']['import'](_0x4533('0x20'));db[_0x4533('0x21')]=db['sequelize']['import'](_0x4533('0x22'));db[_0x4533('0x23')]=db[_0x4533('0x2')]['import'](_0x4533('0x24'));db[_0x4533('0x25')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x26'));db[_0x4533('0x27')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x28'));db['VoiceAgentReport']=db['sequelize'][_0x4533('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x4533('0x29')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x2a'));db[_0x4533('0x2b')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x2c'));db[_0x4533('0x2d')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x2e'));db[_0x4533('0x2f')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x4533('0x30')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x31'));db[_0x4533('0x32')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x33'));db[_0x4533('0x34')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x35'));db[_0x4533('0x36')]=db[_0x4533('0x2')]['import'](_0x4533('0x37'));db[_0x4533('0x38')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x39'));db['UserSmsQueue']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x3a'));db[_0x4533('0x3b')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x4533('0x3c')]=db[_0x4533('0x2')]['import'](_0x4533('0x3d'));db[_0x4533('0x3e')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x3f'));db[_0x4533('0x40')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x41'));db[_0x4533('0x42')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x43'));db[_0x4533('0x44')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x45'));db[_0x4533('0x46')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x47'));db[_0x4533('0x48')]=db[_0x4533('0x2')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x4533('0x49')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x4a'));db[_0x4533('0x4b')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x4c'));db[_0x4533('0x4d')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x4e'));db[_0x4533('0x4f')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/dashboard/dashboard.model');db[_0x4533('0x50')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x51'));db[_0x4533('0x52')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x53'));db[_0x4533('0x54')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x55'));db[_0x4533('0x56')]=db['sequelize'][_0x4533('0x14')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x57'));db[_0x4533('0x58')]=db['sequelize']['import'](_0x4533('0x59'));db['SmsAccount']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize']['import']('../api/smsApplication/smsApplication.model');db[_0x4533('0x5a')]=db['sequelize'][_0x4533('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0x4533('0x5b')]=db['sequelize']['import'](_0x4533('0x5c'));db['SmsQueue']=db[_0x4533('0x2')]['import'](_0x4533('0x5d'));db[_0x4533('0x5e')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x5f'));db[_0x4533('0x60')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0x4533('0x61')]=db[_0x4533('0x2')]['import'](_0x4533('0x62'));db[_0x4533('0x63')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x64'));db[_0x4533('0x65')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x66'));db[_0x4533('0x67')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x68'));db[_0x4533('0x69')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x4533('0x6a')]=db['sequelize']['import'](_0x4533('0x6b'));db[_0x4533('0x6c')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0x4533('0x6d')]=db['sequelize']['import'](_0x4533('0x6e'));db['ChatOfflineMessage']=db[_0x4533('0x2')]['import'](_0x4533('0x6f'));db[_0x4533('0x70')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x71'));db['ChatGroup']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x72'));db['ChatProactiveAction']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x4533('0x73')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x74'));db[_0x4533('0x75')]=db['sequelize'][_0x4533('0x14')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x76'));db[_0x4533('0x77')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x78'));db[_0x4533('0x79')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x7a'));db['CmHopperHistory']=db[_0x4533('0x2')]['import'](_0x4533('0x7b'));db['ReportAgentPreview']=db[_0x4533('0x2')]['import'](_0x4533('0x7c'));db[_0x4533('0x7d')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x7e'));db[_0x4533('0x7f')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/action/action.model');db['Automation']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/automation/automation.model');db[_0x4533('0x80')]=db[_0x4533('0x2')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0x4533('0x14')](_0x4533('0x81'));db[_0x4533('0x82')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x83'));db[_0x4533('0x84')]=db[_0x4533('0x2')]['import'](_0x4533('0x85'));db[_0x4533('0x86')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/pause/pause.model');db['Cdr']=db['sequelize'][_0x4533('0x14')]('../api/cdr/cdr.model');db[_0x4533('0x87')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x4533('0x88')]=db['sequelize'][_0x4533('0x14')]('../api/schedule/schedule.model');db[_0x4533('0x89')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x8a'));db[_0x4533('0x8b')]=db['sequelize'][_0x4533('0x14')]('../api/tag/tag.model');db[_0x4533('0x8c')]=db[_0x4533('0x2')]['import']('../api/template/template.model');db['Trigger']=db['sequelize'][_0x4533('0x14')](_0x4533('0x8d'));db['Variable']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x8e'));db[_0x4533('0x8f')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x90'));db[_0x4533('0x91')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x92'));db[_0x4533('0x93')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x94'));db['AnalyticDefaultReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x95'));db['AnalyticExtractedReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x96'));db[_0x4533('0x97')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x98'));db[_0x4533('0x99')]=db['sequelize']['import'](_0x4533('0x9a'));db[_0x4533('0x9b')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x9c'));db[_0x4533('0x9d')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x9e'));db['SalesforceConfiguration']=db['sequelize']['import'](_0x4533('0x9f'));db[_0x4533('0xa0')]=db[_0x4533('0x2')]['import'](_0x4533('0xa1'));db[_0x4533('0xa2')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xa3'));db[_0x4533('0xa4')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xa5'));db[_0x4533('0xa6')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xa7'));db[_0x4533('0xa8')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xa9'));db['DeskConfiguration']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xaa'));db['DeskField']=db[_0x4533('0x2')]['import'](_0x4533('0xab'));db[_0x4533('0xac')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xad'));db[_0x4533('0xae')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x4533('0xaf')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb0'));db['ZendeskAccount']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb1'));db[_0x4533('0xb2')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x4533('0xb3')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb4'));db[_0x4533('0xb5')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x4533('0xb6')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb7'));db['FreshdeskField']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb8'));db[_0x4533('0xb9')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xba'));db[_0x4533('0xbb')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xbc'));db[_0x4533('0xbd')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xbe'));db[_0x4533('0xbf')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xc0'));db[_0x4533('0xc1')]=db[_0x4533('0x2')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x4533('0xc2')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xc3'));db['Dynamics365Configuration']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xc4'));db[_0x4533('0xc5')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x4533('0xc6')]=db['sequelize'][_0x4533('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x4533('0x8f')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x90'));db[_0x4533('0xc7')]=db[_0x4533('0x2')]['import'](_0x4533('0xc8'));db[_0x4533('0xc9')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x4533('0xca')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x4533('0xcb')]=db[_0x4533('0x2')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xcc'));db[_0x4533('0xcd')]=db[_0x4533('0x2')]['import'](_0x4533('0xce'));db['SmsQueueReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xcf'));db[_0x4533('0xd0')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xd1'));db[_0x4533('0xd2')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xd3'));db[_0x4533('0xd4')]=db[_0x4533('0x2')]['import'](_0x4533('0xd5'));db[_0x4533('0xd6')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xd7'));db[_0x4533('0xd8')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xd9'));db[_0x4533('0xda')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xdb'));db[_0x4533('0xdc')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xdd'));db[_0x4533('0xde')]=db['sequelize'][_0x4533('0x14')]('../api/squareMessage/squareMessage.model');db[_0x4533('0xdf')]=db[_0x4533('0x2')]['import'](_0x4533('0xe0'));db[_0x4533('0xe1')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xe2'));db[_0x4533('0xe3')]=db[_0x4533('0x2')]['import'](_0x4533('0xe4'));db[_0x4533('0xe5')]=db[_0x4533('0x2')]['import']('../api/migration/migration.model');db[_0x4533('0xe6')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xe7'));db[_0x4533('0xe8')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xe9'));db[_0x4533('0xea')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db['sequelize'][_0x4533('0x14')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x4533('0x2')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x4533('0xeb')]=db[_0x4533('0x2')]['import'](_0x4533('0xec'));db[_0x4533('0xed')]=db[_0x4533('0x2')]['import'](_0x4533('0xee'));db[_0x4533('0xef')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xf0'));db['VoicePrefix']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xf1'));db[_0x4533('0xf2')]=db[_0x4533('0x2')]['import'](_0x4533('0xf3'));db[_0x4533('0xf4')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xf5'));db[_0x4533('0xf6')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x4533('0xf7')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/notification/notification.model');db['WhatsappAccount']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xf8'));db[_0x4533('0xf9')]=db['sequelize']['import'](_0x4533('0xfa'));db[_0x4533('0xfb')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xfc'));db['WhatsappMessage']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xfd'));db['WhatsappQueueReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xfe'));db[_0x4533('0xff')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x100'));db['WhatsappQueue']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x101'));db[_0x4533('0x102')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x103'));db['User'][_0x4533('0x104')](db['VoiceMail'],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x1d')],{'as':_0x4533('0x106'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')][_0x4533('0x107')](db['UserVoiceQueueRt'],{'as':_0x4533('0x108'),'foreignKey':_0x4533('0x105')});db['User'][_0x4533('0x107')](db[_0x4533('0x109')],{'as':'Extensions','onDelete':_0x4533('0x10a'),'hooks':!![]});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x79')],{'as':_0x4533('0x10b'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x10c')],{'as':'HopperHistory','foreignKey':'UserId'});db['User'][_0x4533('0x107')](db[_0x4533('0x10d')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db['User'][_0x4533('0x107')](db[_0x4533('0x61')],{'as':_0x4533('0x10e'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')][_0x4533('0x107')](db[_0x4533('0x6c')],{'as':_0x4533('0x10f'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x5a')],{'as':_0x4533('0x110'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x54')],{'as':'FaxInteractions','foreignKey':_0x4533('0x105')});db[_0x4533('0x13')][_0x4533('0x107')](db['MailInteraction'],{'as':_0x4533('0x111'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x4533('0x105')});db['User']['hasMany'](db[_0x4533('0xf7')],{'as':_0x4533('0x112'),'foreignKey':'SenderId'});db[_0x4533('0x13')][_0x4533('0x113')](db[_0x4533('0xf2')],{'as':_0x4533('0xf2'),'foreignKey':_0x4533('0x114')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x116')],{'as':'Groups','through':_0x4533('0x117')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x75')],{'as':'Contacts','through':_0x4533('0x118')});db['User'][_0x4533('0x115')](db[_0x4533('0xef')],{'as':_0x4533('0x119'),'through':_0x4533('0x11a')});db[_0x4533('0x13')]['belongsToMany'](db[_0x4533('0xdf')],{'through':_0x4533('0x11b')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x48')],{'as':_0x4533('0x111'),'through':_0x4533('0x11c')});db[_0x4533('0x13')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x4533('0x13')]['belongsToMany'](db['FaxInteraction'],{'as':_0x4533('0x11d'),'through':_0x4533('0x11e')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x5a')],{'as':_0x4533('0x110'),'through':'user_has_sms_interactions'});db[_0x4533('0x13')]['belongsToMany'](db[_0x4533('0x61')],{'as':_0x4533('0x10e'),'through':_0x4533('0x11f')});db['User'][_0x4533('0x115')](db['WhatsappInteraction'],{'as':_0x4533('0x120'),'through':_0x4533('0x121')});db[_0x4533('0x13')][_0x4533('0x115')](db['VoiceQueue'],{'as':_0x4533('0x122'),'through':_0x4533('0x32'),'required':![]});db[_0x4533('0x13')][_0x4533('0x115')](db['MailQueue'],{'as':'MailQueues','through':_0x4533('0x36'),'required':![]});db[_0x4533('0x13')]['belongsToMany'](db[_0x4533('0x70')],{'as':_0x4533('0x123'),'through':_0x4533('0x34'),'required':![],'hooks':!![]});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x124')],{'as':_0x4533('0x125'),'through':_0x4533('0x38'),'required':![]});db['User']['belongsToMany'](db['SmsQueue'],{'as':_0x4533('0x126'),'through':_0x4533('0x127'),'required':![]});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x65')],{'as':_0x4533('0x128'),'through':_0x4533('0x3b'),'required':![]});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x129')],{'as':_0x4533('0x12a'),'through':_0x4533('0x3c'),'required':![]});db['User'][_0x4533('0x115')](db['CmList'],{'through':_0x4533('0x11a')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x12b')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x67')],{'as':'ChatWebsites','through':_0x4533('0x12c')});db[_0x4533('0x13')]['belongsToMany'](db[_0x4533('0x12d')],{'as':_0x4533('0x12e'),'through':_0x4533('0x12f')});db[_0x4533('0x13')][_0x4533('0x115')](db['MailAccount'],{'as':_0x4533('0x130'),'through':_0x4533('0x131')});db['User']['belongsToMany'](db[_0x4533('0x5e')],{'as':'OpenchannelAccounts','through':_0x4533('0x132')});db['User'][_0x4533('0x115')](db[_0x4533('0x133')],{'as':_0x4533('0x134'),'through':_0x4533('0x135')});db[_0x4533('0x13')][_0x4533('0x115')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0xda')],{'as':'SquareProjects','through':_0x4533('0x136')});db['VoiceChanSpy'][_0x4533('0x107')](db[_0x4533('0x109')],{'as':_0x4533('0x137'),'onDelete':_0x4533('0x10a'),'foreignKey':'ChanSpyId'});db[_0x4533('0x17')][_0x4533('0x107')](db[_0x4533('0x109')],{'onDelete':_0x4533('0x10a')});db[_0x4533('0x109')]['hasMany'](db[_0x4533('0x109')],{'as':_0x4533('0x138'),'onDelete':'cascade'});db[_0x4533('0x139')][_0x4533('0x115')](db[_0x4533('0x89')],{'as':_0x4533('0x13a'),'through':_0x4533('0x13b')});db[_0x4533('0x1b')]['hasMany'](db[_0x4533('0x30')],{'as':_0x4533('0x13c'),'foreignKey':_0x4533('0x13d')});db[_0x4533('0x1b')]['hasMany'](db['CmHopper'],{'as':_0x4533('0x13e'),'foreignKey':'VoiceQueueId'});db[_0x4533('0x1b')][_0x4533('0x107')](db[_0x4533('0x79')],{'as':_0x4533('0x10b'),'foreignKey':_0x4533('0x13d')});db[_0x4533('0x1b')][_0x4533('0x107')](db[_0x4533('0x10c')],{'as':_0x4533('0x13f'),'foreignKey':'VoiceQueueId'});db[_0x4533('0x1b')][_0x4533('0x107')](db[_0x4533('0x10d')],{'as':_0x4533('0x10d'),'foreignKey':_0x4533('0x13d')});db['VoiceQueue'][_0x4533('0x107')](db['CmHopperBlack'],{'as':_0x4533('0x140'),'foreignKey':_0x4533('0x13d')});db[_0x4533('0x1b')]['hasMany'](db[_0x4533('0xcd')],{'as':_0x4533('0x141'),'foreignKey':_0x4533('0x13d')});db[_0x4533('0x1b')][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':_0x4533('0x2d'),'foreignKey':_0x4533('0x142')});db['VoiceQueue'][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':'TrunkBackup','foreignKey':_0x4533('0x143')});db[_0x4533('0x1b')][_0x4533('0x113')](db[_0x4533('0x84')],{'as':_0x4533('0x84'),'foreignKey':'IntervalId'});db[_0x4533('0x1b')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x1b')]['belongsToMany'](db[_0x4533('0xef')],{'as':_0x4533('0x119'),'through':_0x4533('0x146')});db[_0x4533('0x1b')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x147'),'through':_0x4533('0x32')});db['VoiceQueue']['belongsToMany'](db[_0x4533('0xdf')],{'as':_0x4533('0x148'),'through':_0x4533('0x149')});db[_0x4533('0x1b')][_0x4533('0x115')](db[_0x4533('0xef')],{'as':_0x4533('0x14a'),'through':_0x4533('0x14b')});db[_0x4533('0x1d')]['belongsTo'](db['User'],{'as':_0x4533('0x13'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x1f')]['belongsTo'](db[_0x4533('0x13')],{'as':_0x4533('0x13'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x21')][_0x4533('0x107')](db[_0x4533('0x23')],{'as':'Messages','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x14c'),'sourceKey':_0x4533('0x14d')});db[_0x4533('0x23')][_0x4533('0x113')](db[_0x4533('0x21')],{'foreignKey':'mailboxuser','targetKey':_0x4533('0x14d')});db[_0x4533('0x25')]['hasMany'](db[_0x4533('0x29')],{'as':_0x4533('0x14e'),'foreignKey':_0x4533('0x14f'),'constraints':![]});db[_0x4533('0x25')]['hasMany'](db['VoiceAgentReport'],{'as':_0x4533('0x150'),'foreignKey':_0x4533('0x14f'),'constraints':![]});db[_0x4533('0x25')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x13'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x25')][_0x4533('0x113')](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db[_0x4533('0x3e')][_0x4533('0x113')](db[_0x4533('0x42')],{'as':_0x4533('0x42'),'foreignKey':'MailAccountId'});db[_0x4533('0x40')]['belongsTo'](db['MailAccount'],{'as':_0x4533('0x42'),'foreignKey':_0x4533('0x152')});db['MailAccount']['hasOne'](db['MailServerIn'],{'as':'Imap','onDelete':_0x4533('0x10a')});db[_0x4533('0x42')]['hasOne'](db[_0x4533('0x40')],{'as':_0x4533('0x153'),'onDelete':_0x4533('0x10a')});db['MailAccount'][_0x4533('0x107')](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x152')});db[_0x4533('0x42')][_0x4533('0x107')](db[_0x4533('0x80')],{'as':_0x4533('0x156'),'foreignKey':_0x4533('0x152')});db['MailAccount'][_0x4533('0x107')](db[_0x4533('0x49')],{'as':_0x4533('0x157'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x4533('0x107')](db[_0x4533('0x48')],{'as':'Interactions'});db['MailAccount']['hasMany'](db['MailApplication'],{'as':_0x4533('0x138')});db[_0x4533('0x42')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':'ListId'});db[_0x4533('0x42')][_0x4533('0x113')](db[_0x4533('0x8c')],{'as':_0x4533('0x8c'),'foreignKey':_0x4533('0x159')});db[_0x4533('0x42')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x42')]['belongsToMany'](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':_0x4533('0x131')});db['MailQueue'][_0x4533('0x115')](db['User'],{'as':_0x4533('0x147'),'through':_0x4533('0x36')});db[_0x4533('0x44')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':_0x4533('0x15a'),'as':_0x4533('0x148')});db[_0x4533('0x48')][_0x4533('0x107')](db[_0x4533('0x49')],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x4533('0x48')][_0x4533('0x113')](db[_0x4533('0x42')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x152')});db[_0x4533('0x48')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':'Contact','foreignKey':_0x4533('0x15c')});db['MailInteraction'][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x15d'),'foreignKey':'UserId'});db[_0x4533('0x48')][_0x4533('0x115')](db['Tag'],{'through':_0x4533('0x15e'),'as':'Tags'});db[_0x4533('0x48')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x15e'),'as':_0x4533('0x15f')});db[_0x4533('0x48')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x160'),'through':_0x4533('0x11c'),'foreignKey':_0x4533('0x161')});db[_0x4533('0x49')][_0x4533('0x107')](db[_0x4533('0xe6')],{'as':_0x4533('0x162'),'onDelete':_0x4533('0x10a')});db['MailMessage'][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x13')});db['MailMessage'][_0x4533('0x113')](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':'Contact'});db[_0x4533('0x49')]['belongsTo'](db[_0x4533('0x48')],{'as':_0x4533('0x163'),'foreignKey':_0x4533('0x161')});db[_0x4533('0x49')][_0x4533('0x113')](db[_0x4533('0x42')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x152')});db[_0x4533('0x4b')][_0x4533('0x113')](db['User'],{'onDelete':_0x4533('0x164')});db[_0x4533('0x4b')][_0x4533('0x113')](db['MailQueue'],{'onDelete':_0x4533('0x164')});db[_0x4533('0x4b')]['belongsTo'](db[_0x4533('0x42')],{'onDelete':'restrict'});db[_0x4533('0x4b')][_0x4533('0x113')](db[_0x4533('0x84')],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x165')});db['MailApplication']['belongsTo'](db['Tag'],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x166')});db[_0x4533('0x4d')][_0x4533('0x113')](db[_0x4533('0x42')],{});db[_0x4533('0x4d')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':'List','foreignKey':_0x4533('0x167')});db[_0x4533('0x4d')][_0x4533('0x113')](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db[_0x4533('0x4d')]['belongsTo'](db[_0x4533('0x48')],{});db['MailQueueReport'][_0x4533('0x113')](db[_0x4533('0x49')],{});db['MailQueueReport'][_0x4533('0x113')](db['User'],{});db[_0x4533('0x4d')]['belongsTo'](db[_0x4533('0x44')],{});db[_0x4533('0x4f')]['hasMany'](db[_0x4533('0x50')],{'as':'Items','onDelete':'cascade'});db[_0x4533('0x12d')][_0x4533('0x107')](db['Disposition'],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x168')});db[_0x4533('0x12d')][_0x4533('0x107')](db[_0x4533('0x80')],{'as':_0x4533('0x156'),'foreignKey':_0x4533('0x168')});db[_0x4533('0x12d')]['hasMany'](db[_0x4533('0x54')],{'as':_0x4533('0x169')});db[_0x4533('0x12d')][_0x4533('0x107')](db[_0x4533('0x52')],{'as':_0x4533('0x138')});db[_0x4533('0x12d')][_0x4533('0x107')](db[_0x4533('0x109')],{'as':_0x4533('0x16a'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x12d')][_0x4533('0x107')](db[_0x4533('0x56')],{'as':_0x4533('0x157')});db[_0x4533('0x12d')][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':_0x4533('0x2d')});db[_0x4533('0x12d')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':'ListId'});db[_0x4533('0x12d')]['belongsTo'](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db['FaxAccount']['belongsToMany'](db['User'],{'as':'Agents','through':_0x4533('0x12f')});db['FaxApplication']['belongsTo'](db[_0x4533('0x13')],{'onDelete':_0x4533('0x164')});db['FaxApplication'][_0x4533('0x113')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x4533('0x52')][_0x4533('0x113')](db[_0x4533('0x12d')],{'onDelete':_0x4533('0x164')});db['FaxApplication'][_0x4533('0x113')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x4533('0x166')});db[_0x4533('0x54')][_0x4533('0x107')](db[_0x4533('0x56')],{'as':_0x4533('0x157'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x16b')});db['FaxInteraction'][_0x4533('0x113')](db['FaxAccount'],{'as':_0x4533('0x15b'),'foreignKey':'FaxAccountId'});db[_0x4533('0x54')]['belongsTo'](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x54')][_0x4533('0x113')](db['User'],{'as':_0x4533('0x15d'),'foreignKey':'UserId'});db[_0x4533('0x54')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':'fax_interaction_has_tags','as':_0x4533('0x16c')});db[_0x4533('0x54')]['belongsToMany'](db[_0x4533('0x8b')],{'through':_0x4533('0x16d'),'as':_0x4533('0x15f')});db[_0x4533('0x54')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':_0x4533('0x11e'),'foreignKey':'FaxInteractionId'});db[_0x4533('0x56')][_0x4533('0x113')](db['User'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x13')});db[_0x4533('0x56')]['belongsTo'](db[_0x4533('0x54')],{'as':_0x4533('0x163'),'foreignKey':_0x4533('0x16b')});db[_0x4533('0x56')][_0x4533('0x113')](db['CmContact'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x151')});db[_0x4533('0x56')][_0x4533('0x113')](db['Attachment'],{'as':_0x4533('0xe6'),'foreignKey':_0x4533('0x16e')});db['FaxMessage'][_0x4533('0x113')](db['FaxAccount'],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x168')});db['FaxQueue'][_0x4533('0x115')](db[_0x4533('0x13')],{'as':'Agents','through':'UserFaxQueue'});db[_0x4533('0x124')]['belongsToMany'](db[_0x4533('0xdf')],{'through':'team_has_fax_queues','as':_0x4533('0x148')});db[_0x4533('0x58')]['belongsTo'](db['FaxAccount'],{});db['FaxQueueReport']['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x58')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':'Contact','foreignKey':_0x4533('0x15c')});db[_0x4533('0x58')][_0x4533('0x113')](db[_0x4533('0x54')],{});db['FaxQueueReport']['belongsTo'](db[_0x4533('0x56')],{});db[_0x4533('0x58')][_0x4533('0x113')](db[_0x4533('0x13')],{});db['FaxQueueReport'][_0x4533('0x113')](db[_0x4533('0x124')],{});db[_0x4533('0x133')][_0x4533('0x107')](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x16f')});db['SmsAccount'][_0x4533('0x107')](db[_0x4533('0x80')],{'as':'Answers','foreignKey':_0x4533('0x16f')});db[_0x4533('0x133')][_0x4533('0x107')](db[_0x4533('0x5b')],{'as':_0x4533('0x157'),'foreignKey':'SmsAccountId'});db[_0x4533('0x133')][_0x4533('0x107')](db['SmsInteraction'],{'as':_0x4533('0x169')});db[_0x4533('0x133')][_0x4533('0x107')](db['SmsApplication'],{'as':_0x4533('0x138')});db[_0x4533('0x133')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x133')]['belongsTo'](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x133')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':'user_has_sms_accounts'});db[_0x4533('0x170')][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x164')});db['SmsApplication'][_0x4533('0x113')](db['SmsQueue'],{'onDelete':_0x4533('0x164')});db['SmsApplication'][_0x4533('0x113')](db[_0x4533('0x133')],{'onDelete':_0x4533('0x164')});db[_0x4533('0x170')][_0x4533('0x113')](db[_0x4533('0x84')],{'onDelete':'restrict','foreignKey':_0x4533('0x165')});db[_0x4533('0x170')][_0x4533('0x113')](db[_0x4533('0x8b')],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x166')});db[_0x4533('0x5a')][_0x4533('0x107')](db['SmsMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x4533('0x5a')][_0x4533('0x113')](db[_0x4533('0x133')],{'as':_0x4533('0x15b'),'foreignKey':'SmsAccountId'});db[_0x4533('0x5a')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4533('0x5a')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x4533('0x5a')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x171'),'as':_0x4533('0x16c')});db[_0x4533('0x5a')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x171'),'as':_0x4533('0x15f')});db[_0x4533('0x5a')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x160'),'through':'user_has_sms_interactions','foreignKey':_0x4533('0x172')});db['SmsMessage']['belongsTo'](db[_0x4533('0x13')],{'as':_0x4533('0x13')});db[_0x4533('0x5b')][_0x4533('0x113')](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':'Contact'});db[_0x4533('0x5b')][_0x4533('0x113')](db['SmsInteraction'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x163'),'foreignKey':_0x4533('0x172')});db[_0x4533('0x5b')][_0x4533('0x113')](db['SmsAccount'],{'as':'Account','foreignKey':_0x4533('0x16f')});db[_0x4533('0x173')]['belongsToMany'](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':_0x4533('0x127'),'foreignKey':_0x4533('0x174')});db[_0x4533('0x173')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':_0x4533('0x175'),'as':_0x4533('0x148')});db[_0x4533('0x5e')][_0x4533('0x107')](db['Disposition'],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x176')});db[_0x4533('0x5e')][_0x4533('0x107')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4533('0x176')});db[_0x4533('0x5e')][_0x4533('0x107')](db[_0x4533('0x61')],{'as':_0x4533('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0x4533('0x5e')][_0x4533('0x107')](db[_0x4533('0x63')],{'as':'Messages','foreignKey':_0x4533('0x176')});db['OpenchannelAccount']['hasMany'](db[_0x4533('0x60')],{'as':_0x4533('0x138'),'foreignKey':_0x4533('0x176')});db[_0x4533('0x5e')]['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x5e')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x5e')]['belongsToMany'](db[_0x4533('0x13')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x4533('0x60')]['belongsTo'](db[_0x4533('0x13')],{'onDelete':'restrict'});db[_0x4533('0x60')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x177')});db[_0x4533('0x60')][_0x4533('0x113')](db[_0x4533('0x5e')],{'onDelete':_0x4533('0x164'),'foreignKey':'OpenchannelAccountId'});db[_0x4533('0x60')][_0x4533('0x113')](db[_0x4533('0x84')],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x165')});db['OpenchannelApplication']['belongsTo'](db[_0x4533('0x8b')],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x166')});db[_0x4533('0x61')]['hasMany'](db['OpenchannelMessage'],{'as':_0x4533('0x157'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x4533('0x61')][_0x4533('0x113')](db[_0x4533('0x5e')],{'as':_0x4533('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0x4533('0x61')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x61')][_0x4533('0x113')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x4533('0x61')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x178'),'as':_0x4533('0x16c')});db['OpenchannelInteraction'][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x178'),'as':_0x4533('0x15f')});db[_0x4533('0x61')]['belongsToMany'](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':_0x4533('0x11f'),'foreignKey':_0x4533('0x179')});db[_0x4533('0x63')][_0x4533('0x113')](db['User'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x13')});db[_0x4533('0x63')]['belongsTo'](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':'Contact'});db['OpenchannelMessage'][_0x4533('0x113')](db[_0x4533('0x61')],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x163'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x4533('0x113')](db[_0x4533('0xe6')],{'as':'Attachment','foreignKey':_0x4533('0x16e')});db[_0x4533('0x63')][_0x4533('0x113')](db[_0x4533('0x5e')],{'as':_0x4533('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0x4533('0x65')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x4533('0x3b'),'foreignKey':_0x4533('0x177')});db[_0x4533('0x65')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':'team_has_openchannel_queues','as':_0x4533('0x148')});db[_0x4533('0x67')]['hasMany'](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x17a')});db[_0x4533('0x67')][_0x4533('0x107')](db[_0x4533('0x80')],{'as':_0x4533('0x156'),'foreignKey':_0x4533('0x17a')});db[_0x4533('0x67')][_0x4533('0x107')](db[_0x4533('0x17b')],{'as':_0x4533('0x17c')});db['ChatWebsite'][_0x4533('0x107')](db[_0x4533('0x6c')],{'as':'Interactions'});db[_0x4533('0x67')][_0x4533('0x107')](db[_0x4533('0x6a')],{'as':'Applications'});db[_0x4533('0x67')]['hasMany'](db[_0x4533('0x6d')],{'as':'Messages'});db[_0x4533('0x67')][_0x4533('0x113')](db['CmList'],{'as':_0x4533('0x158'),'foreignKey':'ListId'});db[_0x4533('0x67')][_0x4533('0x113')](db[_0x4533('0x84')],{'as':_0x4533('0x84'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x67')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4533('0x67')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':'user_has_chat_websites'});db[_0x4533('0x69')][_0x4533('0x113')](db[_0x4533('0x5e')],{});db[_0x4533('0x69')]['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x69')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db[_0x4533('0x69')][_0x4533('0x113')](db[_0x4533('0x61')],{});db[_0x4533('0x69')][_0x4533('0x113')](db[_0x4533('0x63')],{});db[_0x4533('0x69')]['belongsTo'](db[_0x4533('0x13')],{});db['OpenchannelQueueReport'][_0x4533('0x113')](db[_0x4533('0x65')],{});db[_0x4533('0x6a')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x17d'),'foreignKey':_0x4533('0x105'),'onDelete':_0x4533('0x164')});db[_0x4533('0x6a')][_0x4533('0x113')](db[_0x4533('0x70')],{'as':_0x4533('0x17e'),'foreignKey':_0x4533('0x17f'),'onDelete':_0x4533('0x164')});db[_0x4533('0x6a')]['belongsTo'](db[_0x4533('0x67')],{'as':'Website','foreignKey':_0x4533('0x17a'),'onDelete':_0x4533('0x164')});db['ChatApplication'][_0x4533('0x113')](db['Tag'],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x166')});db[_0x4533('0x6c')][_0x4533('0x107')](db[_0x4533('0x6d')],{'as':_0x4533('0x157'),'onDelete':_0x4533('0x10a'),'foreignKey':'ChatInteractionId'});db[_0x4533('0x6c')][_0x4533('0x113')](db[_0x4533('0x67')],{'as':'Account','foreignKey':_0x4533('0x17a')});db['ChatInteraction'][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x6c')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x15d'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x6c')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x180'),'as':_0x4533('0x16c')});db[_0x4533('0x6c')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x180'),'as':_0x4533('0x15f')});db[_0x4533('0x6c')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x160'),'through':_0x4533('0x181'),'foreignKey':'ChatInteractionId'});db[_0x4533('0x6d')][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x10a'),'as':'User'});db[_0x4533('0x6d')][_0x4533('0x113')](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x6d')][_0x4533('0x113')](db[_0x4533('0x6c')],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x163'),'foreignKey':'ChatInteractionId'});db[_0x4533('0x6d')]['belongsTo'](db[_0x4533('0xe6')],{'as':'Attachment','foreignKey':_0x4533('0x16e')});db[_0x4533('0x6d')][_0x4533('0x113')](db[_0x4533('0x67')],{'as':'Account','foreignKey':_0x4533('0x17a')});db[_0x4533('0x182')][_0x4533('0x113')](db['CmContact'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db['ChatOfflineMessage']['belongsTo'](db[_0x4533('0x67')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x17a')});db['ChatQueue'][_0x4533('0x115')](db[_0x4533('0x13')],{'as':'Agents','through':_0x4533('0x34'),'hooks':!![]});db[_0x4533('0x70')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x4533('0x116')][_0x4533('0x107')](db['ChatInternalMessage'],{'as':_0x4533('0x157'),'foreignKey':_0x4533('0x183'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x116')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':'Members','through':_0x4533('0x117')});db[_0x4533('0x17b')][_0x4533('0x113')](db[_0x4533('0x67')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x4533('0x73')][_0x4533('0x107')](db[_0x4533('0x75')],{'as':_0x4533('0x184'),'foreignKey':_0x4533('0x185')});db[_0x4533('0x75')][_0x4533('0x107')](db[_0x4533('0x186')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x4533('0x75')][_0x4533('0x107')](db[_0x4533('0x79')],{'as':'HopperFinals','foreignKey':_0x4533('0x15c')});db['CmContact']['hasMany'](db['CmHopperHistory'],{'as':_0x4533('0x13f'),'foreignKey':'ContactId'});db[_0x4533('0x75')][_0x4533('0x107')](db[_0x4533('0x10d')],{'as':_0x4533('0x10d'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x75')]['hasMany'](db['JscriptySessionReport'],{'as':_0x4533('0x141'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x75')][_0x4533('0x107')](db['OpenchannelInteraction'],{'as':_0x4533('0x10e'),'foreignKey':_0x4533('0x15c'),'onDelete':_0x4533('0x164')});db[_0x4533('0x75')][_0x4533('0x107')](db['ChatInteraction'],{'as':_0x4533('0x10f'),'foreignKey':_0x4533('0x15c'),'onDelete':'restrict'});db['CmContact'][_0x4533('0x107')](db[_0x4533('0x5a')],{'as':_0x4533('0x110'),'foreignKey':_0x4533('0x15c'),'onDelete':_0x4533('0x164')});db[_0x4533('0x75')][_0x4533('0x107')](db[_0x4533('0x54')],{'as':'FaxInteractions','foreignKey':_0x4533('0x15c'),'onDelete':'restrict'});db['CmContact'][_0x4533('0x107')](db[_0x4533('0x48')],{'as':_0x4533('0x111'),'foreignKey':_0x4533('0x15c'),'onDelete':_0x4533('0x164')});db[_0x4533('0x75')][_0x4533('0x113')](db[_0x4533('0x73')],{'as':_0x4533('0x187'),'foreignKey':_0x4533('0x185')});db['CmContact'][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x75')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':'cm_user_has_contacts'});db[_0x4533('0x75')]['belongsToMany'](db[_0x4533('0x8b')],{'as':_0x4533('0x16c'),'through':_0x4533('0x188')});db[_0x4533('0x75')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':'cm_contact_has_tags','as':_0x4533('0x15f')});db[_0x4533('0x186')][_0x4533('0x113')](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c'),'onDelete':'cascade'});db['CmHopper'][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167'),'onDelete':_0x4533('0x10a')});db['CmHopper'][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x17d'),'foreignKey':'UserId'});db[_0x4533('0x186')][_0x4533('0x113')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x4533('0x13d'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x186')][_0x4533('0x113')](db[_0x4533('0xe3')],{'as':_0x4533('0xe3'),'foreignKey':'CampaignId','onDelete':_0x4533('0x10a')});db['CmHopper']['belongsTo'](db['User'],{'as':_0x4533('0x15d'),'foreignKey':_0x4533('0x189')});db[_0x4533('0x77')]['belongsTo'](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':'ContactId','onDelete':_0x4533('0x10a')});db['CmHopperBlack']['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x77')][_0x4533('0x113')](db[_0x4533('0x1b')],{'as':_0x4533('0x17e'),'foreignKey':_0x4533('0x13d'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x77')][_0x4533('0x113')](db[_0x4533('0xe3')],{'as':'Campaign','foreignKey':_0x4533('0x18a'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x18b')][_0x4533('0x107')](db[_0x4533('0x82')],{'as':{'plural':_0x4533('0x18c'),'singular':_0x4533('0x18d')},'foreignKey':_0x4533('0x18e'),'onDelete':_0x4533('0x10a'),'hooks':!![]});db['Automation'][_0x4533('0x107')](db['Condition'],{'as':{'plural':'Any','singular':_0x4533('0x18f')},'foreignKey':_0x4533('0x190'),'onDelete':_0x4533('0x10a'),'hooks':!![]});db[_0x4533('0x18b')][_0x4533('0x107')](db[_0x4533('0x7f')],{'as':_0x4533('0x191'),'foreignKey':'AutomationId','onDelete':_0x4533('0x10a'),'hooks':!![]});db[_0x4533('0x84')][_0x4533('0x107')](db[_0x4533('0x84')],{'as':_0x4533('0x192'),'foreignKey':_0x4533('0x165'),'onDelete':_0x4533('0x10a'),'hooks':!![],'required':![]});db[_0x4533('0x84')][_0x4533('0x107')](db['VoiceExtension'],{'as':_0x4533('0x193'),'foreignKey':_0x4533('0x165'),'onDelete':_0x4533('0x164')});db[_0x4533('0x84')]['hasMany'](db['MailApplication'],{'as':_0x4533('0x194'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x84')][_0x4533('0x107')](db[_0x4533('0x6a')],{'as':_0x4533('0x195'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x84')][_0x4533('0x107')](db['FaxApplication'],{'as':_0x4533('0x196'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x84')][_0x4533('0x107')](db[_0x4533('0x170')],{'as':_0x4533('0x197'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x88')][_0x4533('0x113')](db['MailAccount'],{});db[_0x4533('0x88')][_0x4533('0x113')](db['AnalyticDefaultReport'],{'foreignKey':_0x4533('0x198')});db[_0x4533('0x88')][_0x4533('0x113')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db['Sound'][_0x4533('0x115')](db[_0x4533('0x139')],{'as':_0x4533('0x199'),'through':_0x4533('0x13b'),'onDelete':_0x4533('0x164')});db[_0x4533('0x8b')][_0x4533('0x115')](db[_0x4533('0x75')],{'through':_0x4533('0x188')});db[_0x4533('0x8b')][_0x4533('0x115')](db[_0x4533('0x6c')],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x4533('0x48')],{'through':_0x4533('0x15e')});db['Tag'][_0x4533('0x115')](db['SmsInteraction'],{'through':_0x4533('0x171')});db[_0x4533('0x8b')][_0x4533('0x115')](db[_0x4533('0x54')],{'through':_0x4533('0x16d')});db[_0x4533('0x8b')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x4533('0x178')});db['Tag'][_0x4533('0x115')](db['WhatsappInteraction'],{'through':_0x4533('0x19a')});db['Trigger'][_0x4533('0x107')](db[_0x4533('0x82')],{'as':{'plural':_0x4533('0x19b'),'singular':'AllCondition'},'foreignKey':_0x4533('0x19c'),'onDelete':_0x4533('0x10a'),'hooks':!![]});db[_0x4533('0x19d')][_0x4533('0x107')](db[_0x4533('0x82')],{'as':{'plural':'AnyConditions','singular':_0x4533('0x19e')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x4533('0x19d')][_0x4533('0x107')](db[_0x4533('0x7f')],{'as':_0x4533('0x191'),'foreignKey':_0x4533('0x19f'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x4533('0x99')],{'as':_0x4533('0x1a0'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a1'),'hooks':!![]});db[_0x4533('0x1a2')][_0x4533('0x107')](db[_0x4533('0x99')],{'as':_0x4533('0x1a0'),'onDelete':_0x4533('0x10a'),'foreignKey':'DefaultReportId'});db[_0x4533('0x97')]['hasMany'](db[_0x4533('0x99')],{'as':_0x4533('0x1a0'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x4533('0x99')]['belongsTo'](db[_0x4533('0x97')],{'foreignKey':_0x4533('0x1a3')});db[_0x4533('0x9d')]['hasMany'](db[_0x4533('0x1a4')],{'as':_0x4533('0x1a5'),'onDelete':'cascade','foreignKey':_0x4533('0x1a6')});db['SalesforceConfiguration'][_0x4533('0x107')](db[_0x4533('0xa0')],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0x1a4')][_0x4533('0x107')](db[_0x4533('0xa0')],{'as':_0x4533('0x1a9'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1aa')});db['SalesforceConfiguration'][_0x4533('0x107')](db[_0x4533('0xa0')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x4533('0x1a4')]['belongsTo'](db[_0x4533('0x9d')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db['SalesforceField']['hasMany'](db[_0x4533('0xa0')],{'as':_0x4533('0x1ab'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xa0')]['hasMany'](db[_0x4533('0xa0')],{'as':_0x4533('0x1ac'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x4533('0xa0')],{'as':'Field','foreignKey':_0x4533('0x1ad')});db[_0x4533('0xa0')]['belongsTo'](db[_0x4533('0x1ae')],{'as':'Variable','foreignKey':_0x4533('0x1af')});db['SugarcrmAccount'][_0x4533('0x107')](db[_0x4533('0xa4')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':'AccountId'});db[_0x4533('0xa4')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xa4')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1a9'),'onDelete':'cascade','foreignKey':_0x4533('0x1aa')});db[_0x4533('0xa4')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1a0'),'onDelete':'cascade','foreignKey':_0x4533('0x1ad')});db['SugarcrmConfiguration'][_0x4533('0x113')](db[_0x4533('0xa2')],{'as':_0x4533('0x15b'),'foreignKey':'AccountId'});db[_0x4533('0xa6')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1ab'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xa6')][_0x4533('0x107')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x4533('0x1aa')});db[_0x4533('0xa6')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db['SugarcrmField'][_0x4533('0x113')](db['Variable'],{'as':_0x4533('0x1ae'),'foreignKey':_0x4533('0x1af')});db[_0x4533('0xa8')]['hasMany'](db[_0x4533('0x1b1')],{'as':_0x4533('0x1a5'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db['DeskConfiguration'][_0x4533('0x107')](db['DeskField'],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0x1b1')][_0x4533('0x107')](db[_0x4533('0x1b2')],{'as':_0x4533('0x1a9'),'onDelete':'cascade','foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1b1')][_0x4533('0x107')](db['DeskField'],{'as':_0x4533('0x1a0'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x4533('0x1b1')][_0x4533('0x113')](db[_0x4533('0xa8')],{'as':_0x4533('0x15b'),'foreignKey':'AccountId'});db[_0x4533('0x1b1')][_0x4533('0x115')](db['Tag'],{'through':_0x4533('0x1b3')});db[_0x4533('0x1b2')][_0x4533('0x107')](db[_0x4533('0x1b2')],{'as':_0x4533('0x1ab'),'foreignKey':'SubjectId'});db['DeskField'][_0x4533('0x107')](db['DeskField'],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1b2')][_0x4533('0x107')](db[_0x4533('0x1b2')],{'as':'Field','foreignKey':_0x4533('0x1ad')});db[_0x4533('0x1b2')][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':_0x4533('0x1ae'),'foreignKey':_0x4533('0x1af')});db[_0x4533('0xac')]['hasMany'](db[_0x4533('0xae')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db['ZohoConfiguration'][_0x4533('0x107')](db[_0x4533('0xaf')],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xae')][_0x4533('0x107')](db[_0x4533('0xaf')],{'as':_0x4533('0x1a9'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1aa')});db['ZohoConfiguration']['hasMany'](db[_0x4533('0xaf')],{'as':_0x4533('0x1a0'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xae')][_0x4533('0x113')](db['ZohoAccount'],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xaf')]['hasMany'](db[_0x4533('0xaf')],{'as':'Subject','foreignKey':_0x4533('0x1a8')});db[_0x4533('0xaf')][_0x4533('0x107')](db['ZohoField'],{'as':_0x4533('0x1ac'),'foreignKey':'DescriptionId'});db[_0x4533('0xaf')][_0x4533('0x107')](db[_0x4533('0xaf')],{'as':_0x4533('0x1b0'),'foreignKey':'FieldId'});db[_0x4533('0xaf')][_0x4533('0x113')](db['Variable'],{'as':'Variable','foreignKey':_0x4533('0x1af')});db[_0x4533('0x1b4')][_0x4533('0x107')](db[_0x4533('0xb2')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':'AccountId'});db[_0x4533('0xb2')]['hasMany'](db[_0x4533('0xb3')],{'as':_0x4533('0x1a7'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xb2')][_0x4533('0x107')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x4533('0x1aa')});db[_0x4533('0xb2')]['hasMany'](db[_0x4533('0xb3')],{'as':_0x4533('0x1a0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xb2')][_0x4533('0x113')](db[_0x4533('0x1b4')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db['ZendeskConfiguration'][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x1b5')});db[_0x4533('0xb3')][_0x4533('0x107')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x4533('0x1a8')});db[_0x4533('0xb3')][_0x4533('0x107')](db[_0x4533('0xb3')],{'as':'Description','foreignKey':_0x4533('0x1aa')});db[_0x4533('0xb3')]['hasMany'](db[_0x4533('0xb3')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xb3')][_0x4533('0x113')](db['Variable'],{'as':_0x4533('0x1ae'),'foreignKey':'VariableId'});db[_0x4533('0xb5')]['hasMany'](db[_0x4533('0xb6')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xb6')][_0x4533('0x107')](db['FreshdeskField'],{'as':_0x4533('0x1a7'),'onDelete':'cascade','foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x4533('0x107')](db[_0x4533('0x1b6')],{'as':_0x4533('0x1a9'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0xb6')]['hasMany'](db[_0x4533('0x1b6')],{'as':_0x4533('0x1a0'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xb6')][_0x4533('0x113')](db[_0x4533('0xb5')],{'as':_0x4533('0x15b'),'foreignKey':'AccountId'});db[_0x4533('0xb6')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x1b7')});db[_0x4533('0x1b6')][_0x4533('0x107')](db[_0x4533('0x1b6')],{'as':_0x4533('0x1ab'),'foreignKey':'SubjectId'});db[_0x4533('0x1b6')][_0x4533('0x107')](db[_0x4533('0x1b6')],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1b6')]['hasMany'](db[_0x4533('0x1b6')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0x1b6')][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':_0x4533('0x1ae'),'foreignKey':_0x4533('0x1af')});db[_0x4533('0x1b8')]['hasMany'](db[_0x4533('0xb9')],{'as':_0x4533('0x1a5'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xb9')]['hasMany'](db[_0x4533('0xbb')],{'as':_0x4533('0x1a7'),'foreignKey':_0x4533('0x1a8')});db['VtigerConfiguration'][_0x4533('0x107')](db[_0x4533('0xbb')],{'as':_0x4533('0x1a9'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0xb9')][_0x4533('0x107')](db[_0x4533('0xbb')],{'as':'Fields','foreignKey':_0x4533('0x1ad')});db[_0x4533('0xb9')][_0x4533('0x113')](db['VtigerAccount'],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xbb')][_0x4533('0x107')](db['VtigerField'],{'as':_0x4533('0x1ab'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xbb')][_0x4533('0x107')](db[_0x4533('0xbb')],{'as':_0x4533('0x1ac'),'foreignKey':'DescriptionId'});db[_0x4533('0xbb')][_0x4533('0x107')](db[_0x4533('0xbb')],{'as':_0x4533('0x1b0'),'foreignKey':'FieldId'});db['VtigerField'][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':'Variable','foreignKey':_0x4533('0x1af')});db[_0x4533('0xbd')][_0x4533('0x107')](db[_0x4533('0xbf')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xbf')]['hasMany'](db[_0x4533('0xc1')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x4533('0x107')](db[_0x4533('0xc1')],{'as':_0x4533('0x1a9'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0xbf')][_0x4533('0x107')](db[_0x4533('0xc1')],{'as':_0x4533('0x1a0'),'foreignKey':_0x4533('0x1ad')});db['ServicenowConfiguration'][_0x4533('0x113')](db[_0x4533('0xbd')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db['ServicenowField']['hasMany'](db[_0x4533('0xc1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4533('0xc1')][_0x4533('0x107')](db[_0x4533('0xc1')],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db['ServicenowField'][_0x4533('0x107')](db[_0x4533('0xc1')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xc1')][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':_0x4533('0x1ae'),'foreignKey':_0x4533('0x1af')});db[_0x4533('0xc2')][_0x4533('0x107')](db[_0x4533('0x1b9')],{'as':_0x4533('0x1a5'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x4533('0x1b9')][_0x4533('0x107')](db[_0x4533('0xc5')],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0x1b9')][_0x4533('0x107')](db['Dynamics365Field'],{'as':_0x4533('0x1a9'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1aa')});db['Dynamics365Configuration'][_0x4533('0x107')](db[_0x4533('0xc5')],{'as':'Fields','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0x1b9')]['belongsTo'](db[_0x4533('0xc2')],{'as':'Account','foreignKey':_0x4533('0x1a6')});db[_0x4533('0xc5')]['hasMany'](db[_0x4533('0xc5')],{'as':_0x4533('0x1ab'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xc5')][_0x4533('0x107')](db[_0x4533('0xc5')],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db['Dynamics365Field'][_0x4533('0x107')](db[_0x4533('0xc5')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xc5')][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':'Variable','foreignKey':_0x4533('0x1af')});db[_0x4533('0xc6')][_0x4533('0x107')](db[_0x4533('0x1ba')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0x1ba')][_0x4533('0x107')](db[_0x4533('0x1bb')],{'as':_0x4533('0x1a7'),'foreignKey':'SubjectId'});db[_0x4533('0x1ba')]['hasMany'](db[_0x4533('0x1bb')],{'as':'Descriptions','foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1ba')][_0x4533('0x107')](db[_0x4533('0x1bb')],{'as':_0x4533('0x1a0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0x1ba')][_0x4533('0x113')](db[_0x4533('0xc6')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0x1bb')][_0x4533('0x107')](db[_0x4533('0x1bb')],{'as':_0x4533('0x1ab'),'foreignKey':'SubjectId'});db[_0x4533('0x1bb')][_0x4533('0x107')](db['FreshsalesField'],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1bb')][_0x4533('0x107')](db[_0x4533('0x1bb')],{'as':_0x4533('0x1b0'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db[_0x4533('0x1ae')],{'as':_0x4533('0x1ae'),'foreignKey':'VariableId'});db['ChatQueueReport']['belongsTo'](db[_0x4533('0x67')],{});db[_0x4533('0xc9')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0xc9')][_0x4533('0x113')](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0x4533('0x113')](db[_0x4533('0x6c')],{});db['ChatQueueReport'][_0x4533('0x113')](db[_0x4533('0x6d')],{});db[_0x4533('0xc9')][_0x4533('0x113')](db[_0x4533('0x13')],{});db[_0x4533('0xc9')]['belongsTo'](db[_0x4533('0x70')],{});db['ChatInternalMessage'][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1bc')});db[_0x4533('0xca')][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1bd')});db[_0x4533('0xcd')][_0x4533('0x107')](db[_0x4533('0x1be')],{'foreignKey':_0x4533('0x1bf'),'onDelete':'cascade'});db[_0x4533('0xcd')][_0x4533('0x107')](db[_0x4533('0xcb')],{'foreignKey':_0x4533('0x1bf'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x1c0')][_0x4533('0x113')](db['SmsAccount'],{});db[_0x4533('0x1c0')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x1c0')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db[_0x4533('0x1c0')][_0x4533('0x113')](db[_0x4533('0x5a')],{});db[_0x4533('0x1c0')][_0x4533('0x113')](db[_0x4533('0x5b')],{});db[_0x4533('0x1c0')]['belongsTo'](db[_0x4533('0x13')],{});db[_0x4533('0x1c0')]['belongsTo'](db[_0x4533('0x173')],{});db[_0x4533('0xd4')][_0x4533('0x107')](db['JscriptySessionReport'],{'foreignKey':_0x4533('0x1c1')});db[_0x4533('0xd4')][_0x4533('0x107')](db['JscriptyQuestionReport'],{'foreignKey':_0x4533('0x1c1')});db[_0x4533('0xd4')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x4533('0x1c1')});db[_0x4533('0xda')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':'user_has_square_projects'});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':_0x4533('0x11b')});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x1b')],{'through':_0x4533('0x149'),'as':_0x4533('0x122')});db['Team'][_0x4533('0x115')](db[_0x4533('0x44')],{'through':_0x4533('0x15a'),'as':_0x4533('0x1c2')});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x70')],{'through':_0x4533('0x1c3'),'as':_0x4533('0x123')});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x124')],{'through':'team_has_fax_queues','as':_0x4533('0x125')});db[_0x4533('0xdf')][_0x4533('0x115')](db['SmsQueue'],{'through':_0x4533('0x175'),'as':_0x4533('0x126')});db[_0x4533('0xdf')][_0x4533('0x115')](db['OpenchannelQueue'],{'through':_0x4533('0x1c4'),'as':'OpenchannelQueues'});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x129')],{'through':'team_has_whatsapp_queues','as':_0x4533('0x12a')});db[_0x4533('0xe3')]['hasMany'](db['CmHopper'],{'as':_0x4533('0x13e'),'foreignKey':_0x4533('0x18a')});db[_0x4533('0xe3')][_0x4533('0x107')](db[_0x4533('0x79')],{'as':_0x4533('0x10b'),'foreignKey':'CampaignId'});db[_0x4533('0xe3')][_0x4533('0x107')](db['CmHopperHistory'],{'as':_0x4533('0x13f'),'foreignKey':_0x4533('0x18a')});db[_0x4533('0xe3')][_0x4533('0x107')](db['CmHopperBlack'],{'as':_0x4533('0x140'),'foreignKey':_0x4533('0x18a')});db[_0x4533('0xe3')][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':_0x4533('0x2d'),'foreignKey':_0x4533('0x142')});db['Campaign'][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x4533('0xe3')][_0x4533('0x113')](db[_0x4533('0x84')],{'as':_0x4533('0x84'),'foreignKey':_0x4533('0x165')});db['Campaign']['belongsTo'](db['SquareProject'],{'as':_0x4533('0xda'),'foreignKey':_0x4533('0x1c5')});db['Campaign']['belongsToMany'](db[_0x4533('0xef')],{'as':_0x4533('0x119'),'through':'campaigns_has_cm_lists'});db[_0x4533('0xe3')][_0x4533('0x115')](db[_0x4533('0xef')],{'as':_0x4533('0x14a'),'through':_0x4533('0x1c6')});db[_0x4533('0xea')]['belongsTo'](db[_0x4533('0x49')],{});db[_0x4533('0xea')][_0x4533('0x113')](db[_0x4533('0x48')],{});db[_0x4533('0xea')][_0x4533('0x113')](db[_0x4533('0x42')],{'foreignKey':_0x4533('0x1c7'),'as':_0x4533('0x1c8')});db[_0x4533('0xea')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':'FromUserId','as':_0x4533('0x1c9')});db[_0x4533('0xea')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db['MailTransferReport'][_0x4533('0x113')](db[_0x4533('0x44')],{'foreignKey':'ToMailQueueId','as':_0x4533('0x1cc')});db[_0x4533('0xea')]['belongsTo'](db[_0x4533('0x42')],{'foreignKey':_0x4533('0x1cd'),'as':_0x4533('0x1ce')});db[_0x4533('0x1cf')][_0x4533('0x113')](db['ChatMessage'],{});db[_0x4533('0x1cf')][_0x4533('0x113')](db[_0x4533('0x6c')],{});db[_0x4533('0x1cf')][_0x4533('0x113')](db['ChatWebsite'],{'foreignKey':_0x4533('0x1d0'),'as':'FromAccount'});db[_0x4533('0x1cf')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1d1'),'as':_0x4533('0x1c9')});db[_0x4533('0x1cf')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db[_0x4533('0x1cf')][_0x4533('0x113')](db[_0x4533('0x70')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x4533('0x1cf')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x4533('0x1d2'),'as':'ToAccount'});db[_0x4533('0x1d3')][_0x4533('0x113')](db[_0x4533('0x56')],{});db[_0x4533('0x1d3')][_0x4533('0x113')](db[_0x4533('0x54')],{});db[_0x4533('0x1d3')][_0x4533('0x113')](db[_0x4533('0x12d')],{'foreignKey':'FromFaxAccountId','as':_0x4533('0x1c8')});db['FaxTransferReport']['belongsTo'](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1d1'),'as':_0x4533('0x1c9')});db[_0x4533('0x1d3')]['belongsTo'](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db[_0x4533('0x1d3')][_0x4533('0x113')](db[_0x4533('0x124')],{'foreignKey':_0x4533('0x1d4'),'as':_0x4533('0x1cc')});db[_0x4533('0x1d3')][_0x4533('0x113')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x4533('0xeb')][_0x4533('0x113')](db['OpenchannelMessage'],{});db[_0x4533('0xeb')][_0x4533('0x113')](db[_0x4533('0x61')],{});db[_0x4533('0xeb')][_0x4533('0x113')](db[_0x4533('0x5e')],{'foreignKey':_0x4533('0x1d5'),'as':'FromAccount'});db[_0x4533('0xeb')]['belongsTo'](db['User'],{'foreignKey':_0x4533('0x1d1'),'as':_0x4533('0x1c9')});db[_0x4533('0xeb')]['belongsTo'](db[_0x4533('0x13')],{'foreignKey':'ToUserId','as':_0x4533('0x1cb')});db[_0x4533('0xeb')][_0x4533('0x113')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x4533('0x1cc')});db[_0x4533('0xeb')][_0x4533('0x113')](db[_0x4533('0x5e')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x4533('0x5b')],{});db[_0x4533('0xed')][_0x4533('0x113')](db[_0x4533('0x5a')],{});db[_0x4533('0xed')][_0x4533('0x113')](db[_0x4533('0x133')],{'foreignKey':_0x4533('0x1d6'),'as':'FromAccount'});db['SmsTransferReport'][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1d1'),'as':_0x4533('0x1c9')});db['SmsTransferReport'][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db['SmsTransferReport']['belongsTo'](db[_0x4533('0x173')],{'foreignKey':_0x4533('0x1d7'),'as':_0x4533('0x1cc')});db['SmsTransferReport'][_0x4533('0x113')](db[_0x4533('0x133')],{'foreignKey':'ToSmsAccountId','as':_0x4533('0x1ce')});db[_0x4533('0xef')]['hasMany'](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x167')});db[_0x4533('0xef')][_0x4533('0x107')](db[_0x4533('0x7d')],{'as':'CustomFields','foreignKey':'ListId'});db[_0x4533('0xef')]['hasMany'](db[_0x4533('0x75')],{'as':_0x4533('0x184'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x167')});db[_0x4533('0xef')][_0x4533('0x107')](db[_0x4533('0x79')],{'as':'HopperFinals','foreignKey':_0x4533('0x167')});db[_0x4533('0xef')][_0x4533('0x107')](db[_0x4533('0x10c')],{'as':_0x4533('0x1d8'),'foreignKey':_0x4533('0x167')});db['CmList'][_0x4533('0x107')](db['ReportAgentPreview'],{'as':_0x4533('0x10d'),'foreignKey':_0x4533('0x167')});db[_0x4533('0xef')][_0x4533('0x115')](db['VoiceQueue'],{'as':_0x4533('0x1d9'),'through':'voice_queues_has_cm_lists'});db[_0x4533('0xef')]['belongsToMany'](db['User'],{'as':_0x4533('0x147'),'through':_0x4533('0x11a')});db[_0x4533('0x12b')][_0x4533('0x107')](db[_0x4533('0x109')],{'as':_0x4533('0x193'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x12b')][_0x4533('0x115')](db['User'],{'as':'Agents','through':_0x4533('0x1da')});db[_0x4533('0xf2')]['hasMany'](db['User'],{'as':_0x4533('0x160'),'foreignKey':_0x4533('0x114')});db['UserProfile'][_0x4533('0x107')](db[_0x4533('0xf4')],{'as':_0x4533('0x1db'),'foreignKey':_0x4533('0x114'),'onDelete':_0x4533('0x10a')});db['UserProfileSection']['hasMany'](db[_0x4533('0xf6')],{'as':_0x4533('0x1dc'),'foreignKey':_0x4533('0x1dd'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x1de')]['hasMany'](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x1df')});db[_0x4533('0x1de')][_0x4533('0x107')](db[_0x4533('0x80')],{'as':_0x4533('0x156'),'foreignKey':_0x4533('0x1df')});db[_0x4533('0x1de')][_0x4533('0x107')](db['WhatsappMessage'],{'as':_0x4533('0x157'),'foreignKey':_0x4533('0x1df')});db[_0x4533('0x1de')][_0x4533('0x107')](db[_0x4533('0xfb')],{'as':_0x4533('0x169')});db[_0x4533('0x1de')][_0x4533('0x107')](db[_0x4533('0xf9')],{'as':_0x4533('0x138')});db[_0x4533('0x1de')]['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':'ListId'});db[_0x4533('0x1de')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x1de')][_0x4533('0x115')](db['User'],{'as':'Agents','through':_0x4533('0x1e0')});db[_0x4533('0xf9')][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x164')});db[_0x4533('0xf9')]['belongsTo'](db[_0x4533('0x129')],{'onDelete':_0x4533('0x164')});db[_0x4533('0xf9')][_0x4533('0x113')](db[_0x4533('0x1de')],{'onDelete':_0x4533('0x164')});db[_0x4533('0xf9')][_0x4533('0x113')](db['Interval'],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x165')});db[_0x4533('0xf9')][_0x4533('0x113')](db[_0x4533('0x8b')],{'onDelete':'restrict','foreignKey':_0x4533('0x166')});db[_0x4533('0xfb')][_0x4533('0x107')](db['WhatsappMessage'],{'as':_0x4533('0x157'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1e1')});db[_0x4533('0xfb')][_0x4533('0x113')](db[_0x4533('0x1de')],{'as':_0x4533('0x15b'),'foreignKey':'WhatsappAccountId'});db[_0x4533('0xfb')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db['WhatsappInteraction']['belongsTo'](db[_0x4533('0x13')],{'as':_0x4533('0x15d'),'foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0x4533('0x8b')],{'through':_0x4533('0x19a'),'as':_0x4533('0x16c')});db['WhatsappInteraction'][_0x4533('0x115')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x4533('0x15f')});db[_0x4533('0xfb')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':_0x4533('0x121'),'foreignKey':'WhatsappInteractionId'});db[_0x4533('0x1e2')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':'User'});db[_0x4533('0x1e2')][_0x4533('0x113')](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':'Contact'});db[_0x4533('0x1e2')][_0x4533('0x113')](db['WhatsappInteraction'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x163'),'foreignKey':_0x4533('0x1e1')});db[_0x4533('0x1e2')][_0x4533('0x113')](db[_0x4533('0x1de')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1df')});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0x1de')],{});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x1e3')]['belongsTo'](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0xfb')],{});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0x129')],{});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0x1e2')],{});db['WhatsappQueueReport']['belongsTo'](db['User'],{});db[_0x4533('0xff')][_0x4533('0x113')](db[_0x4533('0x1e2')],{});db[_0x4533('0xff')][_0x4533('0x113')](db['WhatsappInteraction'],{});db[_0x4533('0xff')]['belongsTo'](db[_0x4533('0x1de')],{'foreignKey':_0x4533('0x1e4'),'as':_0x4533('0x1c8')});db[_0x4533('0xff')]['belongsTo'](db[_0x4533('0x1de')],{'foreignKey':_0x4533('0x1e5'),'as':_0x4533('0x1ce')});db[_0x4533('0xff')][_0x4533('0x113')](db[_0x4533('0x129')],{'foreignKey':_0x4533('0x1e6'),'as':_0x4533('0x1cc')});db['WhatsappTransferReport'][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':'FromUserId','as':_0x4533('0x1c9')});db[_0x4533('0xff')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db[_0x4533('0x129')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x147'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x4533('0x129')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':_0x4533('0x1e7'),'as':_0x4533('0x148')});module[_0x4533('0x1e8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b97d688..5696543 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ad3=['/api/templates','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','express-winston','./errors','./config/environment','./config/logger','auth','use','logger','format','method','x-forwarded-for','connection','url','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','remoteAddress','statusCode','device','agent_name','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','./api/tag'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x3ad3,0x1b1));var _0x33ad=function(_0x420bc0,_0x4bd574){_0x420bc0=_0x420bc0-0x0;var _0x458a7b=_0x3ad3[_0x420bc0];return _0x458a7b;};'use strict';var path=require(_0x33ad('0x0'));var express=require('express');var ewinston=require(_0x33ad('0x1'));var util=require('util');var errors=require(_0x33ad('0x2'));var config=require(_0x33ad('0x3'));var logger=require('./config/logger')('api');var authLogger=require(_0x33ad('0x4'))(_0x33ad('0x5'));exports['default']=function(_0x98e338){_0x98e338[_0x33ad('0x6')](ewinston[_0x33ad('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xa434a7,_0x3036ef){return util[_0x33ad('0x8')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0xa434a7[_0x33ad('0x9')],_0xa434a7['headers'][_0x33ad('0xa')]?_0xa434a7['headers'][_0x33ad('0xa')]:_0xa434a7[_0x33ad('0xb')]['remoteAddress']||_0xa434a7['ip'],_0xa434a7[_0x33ad('0xc')],_0x3036ef['statusCode'],_0x3036ef[_0x33ad('0xd')],_0xa434a7[_0x33ad('0xe')]?_0xa434a7[_0x33ad('0xe')]['id']:null,_0xa434a7[_0x33ad('0xe')]?_0xa434a7[_0x33ad('0xe')][_0x33ad('0xf')]:null,_0xa434a7[_0x33ad('0xe')]?_0xa434a7[_0x33ad('0xe')][_0x33ad('0x10')]:null);}}));_0x98e338[_0x33ad('0x6')](ewinston[_0x33ad('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x536b09,_0x7ecfe5){var _0x19d8be=_0x33ad('0x11');if(_0x536b09['body']&&_0x536b09[_0x33ad('0x12')]['device']&&_0x536b09[_0x33ad('0x12')][_0x33ad('0x13')]){_0x19d8be=_0x33ad('0x14');}return util[_0x33ad('0x8')](_0x19d8be,_0x536b09[_0x33ad('0x9')],_0x536b09[_0x33ad('0x15')][_0x33ad('0xa')]?_0x536b09[_0x33ad('0x15')][_0x33ad('0xa')]:_0x536b09[_0x33ad('0xb')][_0x33ad('0x16')]||_0x536b09['ip'],_0x536b09[_0x33ad('0xc')],_0x7ecfe5[_0x33ad('0x17')],_0x7ecfe5['responseTime'],_0x536b09[_0x33ad('0xe')]?_0x536b09[_0x33ad('0xe')]['id']:null,_0x536b09[_0x33ad('0xe')]?_0x536b09[_0x33ad('0xe')][_0x33ad('0xf')]:null,_0x536b09[_0x33ad('0xe')]?_0x536b09[_0x33ad('0xe')]['role']:null,_0x536b09['body']&&_0x536b09['body']['device']?_0x536b09['body'][_0x33ad('0x18')]:'other',_0x536b09[_0x33ad('0x12')]&&_0x536b09[_0x33ad('0x12')][_0x33ad('0x13')]?_0x536b09['body']['agent_id']:'',_0x536b09[_0x33ad('0x12')]&&_0x536b09[_0x33ad('0x12')]['agent_name']?_0x536b09[_0x33ad('0x12')][_0x33ad('0x19')]:'');},'ignoreRoute':function(_0x3dcbb7){var _0x29882e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x29882e['test'](_0x3dcbb7[_0x33ad('0xc')]);}}));_0x98e338['use']('/api/users',require(_0x33ad('0x1a')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x1b'),require('./api/voiceChanSpy'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x1c'),require(_0x33ad('0x1d')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x1e'),require(_0x33ad('0x1f')));_0x98e338[_0x33ad('0x6')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x20'),require(_0x33ad('0x21')));_0x98e338['use'](_0x33ad('0x22'),require(_0x33ad('0x23')));_0x98e338['use']('/api/screen/recordings',require(_0x33ad('0x24')));_0x98e338[_0x33ad('0x6')]('/api/voice/mails',require('./api/voiceMail'));_0x98e338['use'](_0x33ad('0x25'),require(_0x33ad('0x26')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x27'),require(_0x33ad('0x28')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x29'),require('./api/voiceDialReport'));_0x98e338['use'](_0x33ad('0x2a'),require(_0x33ad('0x2b')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x2c'),require(_0x33ad('0x2d')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x2e'),require(_0x33ad('0x2f')));_0x98e338['use'](_0x33ad('0x30'),require(_0x33ad('0x31')));_0x98e338[_0x33ad('0x6')]('/api/voice/transfers/reports',require(_0x33ad('0x32')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x33'),require(_0x33ad('0x34')));_0x98e338['use']('/api/mail/accounts',require('./api/mailAccount'));_0x98e338['use'](_0x33ad('0x35'),require('./api/mailQueue'));_0x98e338[_0x33ad('0x6')]('/api/mail/substatuses',require(_0x33ad('0x36')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x37'),require(_0x33ad('0x38')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x39'),require(_0x33ad('0x3a')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x3b'),require('./api/mailApplication'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x3c'),require(_0x33ad('0x3d')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x3e'),require(_0x33ad('0x3f')));_0x98e338[_0x33ad('0x6')]('/api/dashboards/items',require(_0x33ad('0x40')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x41'),require(_0x33ad('0x42')));_0x98e338[_0x33ad('0x6')]('/api/fax/applications',require(_0x33ad('0x43')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x44'),require(_0x33ad('0x45')));_0x98e338[_0x33ad('0x6')]('/api/fax/messages',require(_0x33ad('0x46')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x47'),require(_0x33ad('0x48')));_0x98e338['use'](_0x33ad('0x49'),require('./api/faxQueueReport'));_0x98e338['use']('/api/sms/accounts',require(_0x33ad('0x4a')));_0x98e338['use'](_0x33ad('0x4b'),require(_0x33ad('0x4c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x4d'),require(_0x33ad('0x4e')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x4f'),require(_0x33ad('0x50')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x51'),require(_0x33ad('0x52')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x53'),require(_0x33ad('0x54')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x55'),require(_0x33ad('0x56')));_0x98e338[_0x33ad('0x6')]('/api/openchannel/interactions',require(_0x33ad('0x57')));_0x98e338['use'](_0x33ad('0x58'),require(_0x33ad('0x59')));_0x98e338[_0x33ad('0x6')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x98e338['use']('/api/chat/websites',require(_0x33ad('0x5a')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x5b'),require(_0x33ad('0x5c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x5d'),require(_0x33ad('0x5e')));_0x98e338['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x98e338['use'](_0x33ad('0x5f'),require(_0x33ad('0x60')));_0x98e338[_0x33ad('0x6')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x98e338['use'](_0x33ad('0x61'),require(_0x33ad('0x62')));_0x98e338[_0x33ad('0x6')]('/api/chat/groups',require(_0x33ad('0x63')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x64'),require(_0x33ad('0x65')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x66'),require(_0x33ad('0x67')));_0x98e338['use'](_0x33ad('0x68'),require(_0x33ad('0x69')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x6a'),require(_0x33ad('0x6b')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x6c'),require(_0x33ad('0x6d')));_0x98e338['use']('/api/cm/hopper_final',require(_0x33ad('0x6e')));_0x98e338[_0x33ad('0x6')]('/api/cm/hopper_history',require(_0x33ad('0x6f')));_0x98e338['use'](_0x33ad('0x70'),require('./api/cmCustomField'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x71'),require(_0x33ad('0x72')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x73'),require(_0x33ad('0x74')));_0x98e338['use'](_0x33ad('0x75'),require('./api/cannedAnswer'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x76'),require(_0x33ad('0x77')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x78'),require(_0x33ad('0x79')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x7a'),require(_0x33ad('0x7b')));_0x98e338[_0x33ad('0x6')]('/api/pauses',require(_0x33ad('0x7c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x7d'),require(_0x33ad('0x7e')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x7f'),require(_0x33ad('0x80')));_0x98e338[_0x33ad('0x6')]('/api/schedules',require('./api/schedule'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x81'),require(_0x33ad('0x82')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x83'),require(_0x33ad('0x84')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x85'),require(_0x33ad('0x86')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x87'),require(_0x33ad('0x88')));_0x98e338[_0x33ad('0x6')]('/api/variables',require('./api/variable'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x89'),require(_0x33ad('0x8a')));_0x98e338['use']('/api/integrations/reports',require(_0x33ad('0x8b')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x8c'),require(_0x33ad('0x8d')));_0x98e338['use'](_0x33ad('0x8e'),require('./api/analyticDefaultReport'));_0x98e338[_0x33ad('0x6')]('/api/analytics/extracted_reports',require(_0x33ad('0x8f')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x90'),require(_0x33ad('0x91')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x92'),require(_0x33ad('0x93')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x94'),require(_0x33ad('0x95')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x96'),require(_0x33ad('0x97')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x98'),require(_0x33ad('0x99')));_0x98e338[_0x33ad('0x6')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x9a'),require('./api/intSugarcrmAccount'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x9b'),require(_0x33ad('0x9c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x9d'),require(_0x33ad('0x9e')));_0x98e338['use'](_0x33ad('0x9f'),require(_0x33ad('0xa0')));_0x98e338[_0x33ad('0x6')]('/api/integrations/desk/configurations',require(_0x33ad('0xa1')));_0x98e338[_0x33ad('0x6')]('/api/integrations/desk/fields',require(_0x33ad('0xa2')));_0x98e338['use'](_0x33ad('0xa3'),require(_0x33ad('0xa4')));_0x98e338[_0x33ad('0x6')]('/api/integrations/zoho/configurations',require(_0x33ad('0xa5')));_0x98e338['use']('/api/integrations/zoho/fields',require(_0x33ad('0xa6')));_0x98e338[_0x33ad('0x6')]('/api/integrations/zendesk/accounts',require(_0x33ad('0xa7')));_0x98e338['use'](_0x33ad('0xa8'),require(_0x33ad('0xa9')));_0x98e338['use'](_0x33ad('0xaa'),require(_0x33ad('0xab')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xac'),require(_0x33ad('0xad')));_0x98e338['use'](_0x33ad('0xae'),require('./api/intFreshdeskConfiguration'));_0x98e338['use'](_0x33ad('0xaf'),require(_0x33ad('0xb0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb1'),require('./api/intVtigerAccount'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb2'),require(_0x33ad('0xb3')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb4'),require(_0x33ad('0xb5')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb6'),require(_0x33ad('0xb7')));_0x98e338[_0x33ad('0x6')]('/api/integrations/servicenow/configurations',require(_0x33ad('0xb8')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb9'),require(_0x33ad('0xba')));_0x98e338['use'](_0x33ad('0xbb'),require(_0x33ad('0xbc')));_0x98e338['use'](_0x33ad('0xbd'),require(_0x33ad('0xbe')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xbf'),require(_0x33ad('0xc0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xc1'),require(_0x33ad('0xc2')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xc3'),require(_0x33ad('0xc4')));_0x98e338[_0x33ad('0x6')]('/api/integrations/freshsales/fields',require(_0x33ad('0xc5')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xc6'),require('./api/network'));_0x98e338[_0x33ad('0x6')]('/api/chat/reports/queue',require(_0x33ad('0xc7')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xc8'),require('./api/chatInternalMessage'));_0x98e338['use'](_0x33ad('0xc9'),require('./api/jscriptyAnswerReport'));_0x98e338[_0x33ad('0x6')]('/api/jscripty/questions/reports',require(_0x33ad('0xca')));_0x98e338['use']('/api/jscripty/sessions/reports',require(_0x33ad('0xcb')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xcc'),require(_0x33ad('0xcd')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xce'),require('./api/squareReport'));_0x98e338['use'](_0x33ad('0xcf'),require('./api/squareReportDetail'));_0x98e338[_0x33ad('0x6')]('/api/jscripty/projects',require(_0x33ad('0xd0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xd1'),require(_0x33ad('0xd2')));_0x98e338[_0x33ad('0x6')]('/api/square/odbc',require(_0x33ad('0xd3')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xd4'),require(_0x33ad('0xd5')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xd6'),require(_0x33ad('0xd7')));_0x98e338['use'](_0x33ad('0xd8'),require(_0x33ad('0xd9')));_0x98e338['use'](_0x33ad('0xda'),require(_0x33ad('0xdb')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xdc'),require(_0x33ad('0xdd')));_0x98e338['use']('/api/campaigns',require(_0x33ad('0xde')));_0x98e338['use'](_0x33ad('0xdf'),require(_0x33ad('0xe0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xe1'),require(_0x33ad('0xe2')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xe3'),require(_0x33ad('0xe4')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xe5'),require(_0x33ad('0xe6')));_0x98e338[_0x33ad('0x6')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x98e338['use'](_0x33ad('0xe7'),require(_0x33ad('0xe8')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xe9'),require('./api/openchannelTransferReport'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xea'),require('./api/smsTransferReport'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xeb'),require('./api/cmList'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xec'),require('./api/voicePrefix'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xed'),require(_0x33ad('0xee')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xef'),require(_0x33ad('0xf0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf1'),require('./api/userProfileResource'));_0x98e338[_0x33ad('0x6')]('/api/notifications',require(_0x33ad('0xf2')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf3'),require(_0x33ad('0xf4')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf5'),require('./api/whatsappApplication'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf6'),require(_0x33ad('0xf7')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf8'),require(_0x33ad('0xf9')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xfa'),require(_0x33ad('0xfb')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xfc'),require(_0x33ad('0xfd')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xfe'),require(_0x33ad('0xff')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x100'),require(_0x33ad('0x101')));_0x98e338[_0x33ad('0x6')]('/api/auth/local',require(_0x33ad('0x102')));_0x98e338['use'](_0x33ad('0x103'),require(_0x33ad('0x104')));_0x98e338[_0x33ad('0x6')]('/api/jira',require(_0x33ad('0x105')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x106'),require('./api/rpc'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x107'),require(_0x33ad('0x108')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x109'),require(_0x33ad('0x10a')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x10b'),require('./api/pm2'));_0x98e338['use']('/api/webbar',require(_0x33ad('0x10c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x10d'),express[_0x33ad('0x10e')](path[_0x33ad('0x10f')](config[_0x33ad('0x110')],_0x33ad('0x10d'))));_0x98e338[_0x33ad('0x6')](_0x33ad('0x111'),express[_0x33ad('0x10e')](path[_0x33ad('0x10f')](config[_0x33ad('0x110')],_0x33ad('0x111'))));_0x98e338['use']('/demo',express['static'](path[_0x33ad('0x10f')](config[_0x33ad('0x110')],_0x33ad('0x112'))));_0x98e338[_0x33ad('0x6')](_0x33ad('0x113'),express[_0x33ad('0x10e')](path[_0x33ad('0x10f')](config[_0x33ad('0x110')],'snippet',_0x33ad('0x114'))));_0x98e338[_0x33ad('0x6')]('/plugins',express[_0x33ad('0x10e')](path['join'](config[_0x33ad('0x110')],_0x33ad('0x115'))));_0x98e338[_0x33ad('0x116')](_0x33ad('0x117'))['get'](errors[0x194]);_0x98e338['route']('/*')['get'](function(_0x200264,_0x56633b){_0x56633b['sendFile'](path['resolve'](_0x98e338[_0x33ad('0x118')](_0x33ad('0x119'))+_0x33ad('0x11a')));});}; \ No newline at end of file +var _0x280b=['/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','name','role','body','connection','device','other','agent_id','agent_name','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x280b,0xb6));var _0xb280=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x280b[_0x6c993a];return _0x27f547;};'use strict';var path=require(_0xb280('0x0'));var express=require(_0xb280('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0xb280('0x2'));var config=require(_0xb280('0x3'));var logger=require(_0xb280('0x4'))('api');var authLogger=require('./config/logger')(_0xb280('0x5'));exports[_0xb280('0x6')]=function(_0x2f3fce){_0x2f3fce[_0xb280('0x7')](ewinston[_0xb280('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x140576,_0x4251a9){return util[_0xb280('0x9')](_0xb280('0xa'),_0x140576[_0xb280('0xb')],_0x140576[_0xb280('0xc')][_0xb280('0xd')]?_0x140576[_0xb280('0xc')][_0xb280('0xd')]:_0x140576['connection'][_0xb280('0xe')]||_0x140576['ip'],_0x140576[_0xb280('0xf')],_0x4251a9[_0xb280('0x10')],_0x4251a9[_0xb280('0x11')],_0x140576[_0xb280('0x12')]?_0x140576[_0xb280('0x12')]['id']:null,_0x140576[_0xb280('0x12')]?_0x140576[_0xb280('0x12')][_0xb280('0x13')]:null,_0x140576[_0xb280('0x12')]?_0x140576[_0xb280('0x12')][_0xb280('0x14')]:null);}}));_0x2f3fce[_0xb280('0x7')](ewinston[_0xb280('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2d1196,_0x310d7c){var _0x2a3518='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2d1196[_0xb280('0x15')]&&_0x2d1196[_0xb280('0x15')]['device']&&_0x2d1196[_0xb280('0x15')]['agent_id']){_0x2a3518='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x2a3518,_0x2d1196[_0xb280('0xb')],_0x2d1196['headers'][_0xb280('0xd')]?_0x2d1196[_0xb280('0xc')][_0xb280('0xd')]:_0x2d1196[_0xb280('0x16')]['remoteAddress']||_0x2d1196['ip'],_0x2d1196['url'],_0x310d7c[_0xb280('0x10')],_0x310d7c['responseTime'],_0x2d1196[_0xb280('0x12')]?_0x2d1196['user']['id']:null,_0x2d1196['user']?_0x2d1196[_0xb280('0x12')]['name']:null,_0x2d1196[_0xb280('0x12')]?_0x2d1196[_0xb280('0x12')][_0xb280('0x14')]:null,_0x2d1196['body']&&_0x2d1196[_0xb280('0x15')][_0xb280('0x17')]?_0x2d1196['body'][_0xb280('0x17')]:_0xb280('0x18'),_0x2d1196[_0xb280('0x15')]&&_0x2d1196['body']['agent_id']?_0x2d1196[_0xb280('0x15')][_0xb280('0x19')]:'',_0x2d1196[_0xb280('0x15')]&&_0x2d1196[_0xb280('0x15')][_0xb280('0x1a')]?_0x2d1196[_0xb280('0x15')][_0xb280('0x1a')]:'');},'ignoreRoute':function(_0x30ef31){var _0x18c575=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x18c575['test'](_0x30ef31['url']);}}));_0x2f3fce[_0xb280('0x7')](_0xb280('0x1b'),require(_0xb280('0x1c')));_0x2f3fce['use']('/api/voice/chanspy',require(_0xb280('0x1d')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x1e'),require(_0xb280('0x1f')));_0x2f3fce[_0xb280('0x7')]('/api/voice/extensions',require(_0xb280('0x20')));_0x2f3fce['use'](_0xb280('0x21'),require(_0xb280('0x22')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x23'),require(_0xb280('0x24')));_0x2f3fce[_0xb280('0x7')]('/api/voice/recordings',require(_0xb280('0x25')));_0x2f3fce[_0xb280('0x7')]('/api/screen/recordings',require(_0xb280('0x26')));_0x2f3fce[_0xb280('0x7')]('/api/voice/mails',require(_0xb280('0x27')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x28'),require('./api/voiceMailMessage'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x29'),require(_0xb280('0x2a')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x2b'),require(_0xb280('0x2c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x2d'),require(_0xb280('0x2e')));_0x2f3fce[_0xb280('0x7')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x2f3fce['use'](_0xb280('0x2f'),require(_0xb280('0x30')));_0x2f3fce['use']('/api/trunks',require('./api/trunk'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x31'),require(_0xb280('0x32')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x33'),require('./api/mailServerOut'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x34'),require('./api/mailAccount'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x35'),require(_0xb280('0x36')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x37'),require('./api/mailSubstatus'));_0x2f3fce[_0xb280('0x7')]('/api/mail/interactions',require(_0xb280('0x38')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x39'),require(_0xb280('0x3a')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x3b'),require(_0xb280('0x3c')));_0x2f3fce[_0xb280('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x3d'),require(_0xb280('0x3e')));_0x2f3fce['use']('/api/dashboards/items',require(_0xb280('0x3f')));_0x2f3fce['use']('/api/fax/accounts',require(_0xb280('0x40')));_0x2f3fce['use'](_0xb280('0x41'),require(_0xb280('0x42')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x43'),require(_0xb280('0x44')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x45'),require(_0xb280('0x46')));_0x2f3fce['use'](_0xb280('0x47'),require(_0xb280('0x48')));_0x2f3fce['use'](_0xb280('0x49'),require(_0xb280('0x4a')));_0x2f3fce[_0xb280('0x7')]('/api/sms/accounts',require(_0xb280('0x4b')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x4c'),require(_0xb280('0x4d')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x4e'),require('./api/smsInteraction'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x4f'),require(_0xb280('0x50')));_0x2f3fce['use'](_0xb280('0x51'),require(_0xb280('0x52')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x53'),require(_0xb280('0x54')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x55'),require(_0xb280('0x56')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x57'),require(_0xb280('0x58')));_0x2f3fce[_0xb280('0x7')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x59'),require('./api/openchannelQueue'));_0x2f3fce['use'](_0xb280('0x5a'),require(_0xb280('0x5b')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x5c'),require(_0xb280('0x5d')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x5e'),require('./api/chatApplication'));_0x2f3fce[_0xb280('0x7')]('/api/chat/interactions',require(_0xb280('0x5f')));_0x2f3fce[_0xb280('0x7')]('/api/chat/messages',require(_0xb280('0x60')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x61'),require('./api/chatOfflineMessage'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x62'),require(_0xb280('0x63')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x64'),require(_0xb280('0x65')));_0x2f3fce[_0xb280('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x66'),require('./api/cmCompany'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x67'),require('./api/cmContact'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x68'),require('./api/cmHopper'));_0x2f3fce['use'](_0xb280('0x69'),require('./api/cmHopperBlack'));_0x2f3fce['use'](_0xb280('0x6a'),require('./api/cmHopperFinal'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x6b'),require(_0xb280('0x6c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x6d'),require(_0xb280('0x6e')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x6f'),require(_0xb280('0x70')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x71'),require('./api/automation'));_0x2f3fce['use'](_0xb280('0x72'),require(_0xb280('0x73')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x74'),require(_0xb280('0x75')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x76'),require(_0xb280('0x77')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x78'),require('./api/interval'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x79'),require(_0xb280('0x7a')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x7b'),require(_0xb280('0x7c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x7d'),require('./api/voiceQueuesLog'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x7e'),require(_0xb280('0x7f')));_0x2f3fce['use'](_0xb280('0x80'),require(_0xb280('0x81')));_0x2f3fce['use'](_0xb280('0x82'),require('./api/tag'));_0x2f3fce[_0xb280('0x7')]('/api/templates',require(_0xb280('0x83')));_0x2f3fce['use'](_0xb280('0x84'),require(_0xb280('0x85')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x86'),require(_0xb280('0x87')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x88'),require(_0xb280('0x89')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x8a'),require(_0xb280('0x8b')));_0x2f3fce[_0xb280('0x7')]('/api/analytics/custom_reports',require(_0xb280('0x8c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x8d'),require('./api/analyticDefaultReport'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x8e'),require(_0xb280('0x8f')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x90'),require('./api/analyticMetric'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x91'),require(_0xb280('0x92')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x93'),require(_0xb280('0x94')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/salesforce/accounts',require(_0xb280('0x95')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x96'),require('./api/intSalesforceConfiguration'));_0x2f3fce[_0xb280('0x7')]('/api/integrations/salesforce/fields',require(_0xb280('0x97')));_0x2f3fce['use']('/api/integrations/sugarcrm/accounts',require(_0xb280('0x98')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xb280('0x99')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x9a'),require(_0xb280('0x9b')));_0x2f3fce['use'](_0xb280('0x9c'),require(_0xb280('0x9d')));_0x2f3fce['use'](_0xb280('0x9e'),require(_0xb280('0x9f')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xa0'),require(_0xb280('0xa1')));_0x2f3fce['use'](_0xb280('0xa2'),require(_0xb280('0xa3')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xa4'),require(_0xb280('0xa5')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/zendesk/accounts',require(_0xb280('0xa6')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xa7'),require(_0xb280('0xa8')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xa9'),require(_0xb280('0xaa')));_0x2f3fce['use'](_0xb280('0xab'),require(_0xb280('0xac')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xad'),require('./api/intFreshdeskConfiguration'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xae'),require(_0xb280('0xaf')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb0'),require(_0xb280('0xb1')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb2'),require(_0xb280('0xb3')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb4'),require(_0xb280('0xb5')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb6'),require(_0xb280('0xb7')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb8'),require(_0xb280('0xb9')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xba'),require(_0xb280('0xbb')));_0x2f3fce['use'](_0xb280('0xbc'),require(_0xb280('0xbd')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/dynamics365/configurations',require(_0xb280('0xbe')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xbf'),require(_0xb280('0xc0')));_0x2f3fce['use'](_0xb280('0xc1'),require(_0xb280('0xc2')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc3'),require('./api/intFreshsalesConfiguration'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc4'),require(_0xb280('0xc5')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc6'),require('./api/network'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc7'),require(_0xb280('0xc8')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc9'),require(_0xb280('0xca')));_0x2f3fce['use'](_0xb280('0xcb'),require(_0xb280('0xcc')));_0x2f3fce[_0xb280('0x7')]('/api/jscripty/questions/reports',require(_0xb280('0xcd')));_0x2f3fce[_0xb280('0x7')]('/api/jscripty/sessions/reports',require(_0xb280('0xce')));_0x2f3fce[_0xb280('0x7')]('/api/sms/reports/queue',require(_0xb280('0xcf')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xd0'),require(_0xb280('0xd1')));_0x2f3fce['use'](_0xb280('0xd2'),require(_0xb280('0xd3')));_0x2f3fce[_0xb280('0x7')]('/api/jscripty/projects',require(_0xb280('0xd4')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xd5'),require('./api/setting'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xd6'),require(_0xb280('0xd7')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xd8'),require(_0xb280('0xd9')));_0x2f3fce['use'](_0xb280('0xda'),require('./api/squareRecording'));_0x2f3fce['use'](_0xb280('0xdb'),require(_0xb280('0xdc')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xdd'),require(_0xb280('0xde')));_0x2f3fce['use'](_0xb280('0xdf'),require(_0xb280('0xe0')));_0x2f3fce['use'](_0xb280('0xe1'),require(_0xb280('0xe2')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xe3'),require(_0xb280('0xe4')));_0x2f3fce[_0xb280('0x7')]('/api/attachments',require(_0xb280('0xe5')));_0x2f3fce['use'](_0xb280('0xe6'),require('./api/plugin'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xe7'),require(_0xb280('0xe8')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xe9'),require(_0xb280('0xea')));_0x2f3fce[_0xb280('0x7')]('/api/fax/reports/transfer',require(_0xb280('0xeb')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xec'),require(_0xb280('0xed')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xee'),require(_0xb280('0xef')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xf0'),require(_0xb280('0xf1')));_0x2f3fce[_0xb280('0x7')]('/api/voice/prefixes',require(_0xb280('0xf2')));_0x2f3fce['use'](_0xb280('0xf3'),require(_0xb280('0xf4')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xf5'),require(_0xb280('0xf6')));_0x2f3fce[_0xb280('0x7')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xf7'),require(_0xb280('0xf8')));_0x2f3fce['use'](_0xb280('0xf9'),require(_0xb280('0xfa')));_0x2f3fce['use'](_0xb280('0xfb'),require(_0xb280('0xfc')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xfd'),require('./api/whatsappInteraction'));_0x2f3fce[_0xb280('0x7')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xfe'),require(_0xb280('0xff')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x100'),require('./api/whatsappTransferReport'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x101'),require(_0xb280('0x102')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x103'),require(_0xb280('0x104')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x105'),require(_0xb280('0x106')));_0x2f3fce['use'](_0xb280('0x107'),require('./api/authGoogle'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x108'),require(_0xb280('0x109')));_0x2f3fce['use']('/api/rpc',require(_0xb280('0x10a')));_0x2f3fce['use'](_0xb280('0x10b'),require(_0xb280('0x10c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x10d'),require(_0xb280('0x10e')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x10f'),require(_0xb280('0x110')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x111'),require(_0xb280('0x112')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x113'),express[_0xb280('0x114')](path[_0xb280('0x115')](config[_0xb280('0x116')],_0xb280('0x113'))));_0x2f3fce[_0xb280('0x7')]('/www',express[_0xb280('0x114')](path['join'](config[_0xb280('0x116')],_0xb280('0x117'))));_0x2f3fce[_0xb280('0x7')](_0xb280('0x118'),express[_0xb280('0x114')](path[_0xb280('0x115')](config[_0xb280('0x116')],_0xb280('0x118'))));_0x2f3fce['use'](_0xb280('0x119'),express[_0xb280('0x114')](path['join'](config[_0xb280('0x116')],'snippet','1.0.16')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x11a'),express[_0xb280('0x114')](path['join'](config[_0xb280('0x116')],_0xb280('0x11b'))));_0x2f3fce[_0xb280('0x11c')](_0xb280('0x11d'))[_0xb280('0x11e')](errors[0x194]);_0x2f3fce[_0xb280('0x11c')]('/*')[_0xb280('0x11e')](function(_0x3bacfa,_0x51d7ab){_0x51d7ab[_0xb280('0x11f')](path[_0xb280('0x120')](_0x2f3fce[_0xb280('0x11e')](_0xb280('0x121'))+_0xb280('0x122')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a42b6b3..c4dcbd7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11bd=['../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/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!','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc'];(function(_0x382a21,_0x2e5174){var _0x6b1aac=function(_0x2967ad){while(--_0x2967ad){_0x382a21['push'](_0x382a21['shift']());}};_0x6b1aac(++_0x2e5174);}(_0x11bd,0xfe));var _0xd11b=function(_0x4f2bec,_0x3819ff){_0x4f2bec=_0x4f2bec-0x0;var _0x146e80=_0x11bd[_0x4f2bec];return _0x146e80;};'use strict';var jayson=require(_0xd11b('0x0'));var BPromise=require(_0xd11b('0x1'));var _=require(_0xd11b('0x2'));var config=require(_0xd11b('0x3'));exports[_0xd11b('0x4')]=function(){return new BPromise(function(_0x4701b8,_0x2d54da){var _0x1e1894={};_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x6')));_0x1e1894=_['merge'](_0x1e1894,require('../api/voiceExtension/voiceExtension.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x7')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x8')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x9')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0xa')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0xb')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0xc')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0xd')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0xe')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0xf')));_0x1e1894=_['merge'](_0x1e1894,require('../api/mailServerIn/mailServerIn.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x10')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x11')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x12')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x13')));_0x1e1894=_['merge'](_0x1e1894,require('../api/mailApplication/mailApplication.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x14')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x15')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x16')));_0x1e1894=_['merge'](_0x1e1894,require('../api/faxInteraction/faxInteraction.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x17')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/faxQueue/faxQueue.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x18')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x19')));_0x1e1894=_['merge'](_0x1e1894,require('../api/smsInteraction/smsInteraction.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/smsMessage/smsMessage.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1a')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1b')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1c')));_0x1e1894=_['merge'](_0x1e1894,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1d')));_0x1e1894=_['merge'](_0x1e1894,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1e')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1f')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/chatQueue/chatQueue.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x20')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x21')));_0x1e1894=_['merge'](_0x1e1894,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x22')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x23')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x24')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/interval/interval.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x25')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x26')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/template/template.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/trigger/trigger.rpc'));_0x1e1894=_['merge'](_0x1e1894,require('../api/variable/variable.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x27')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x28')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x29')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x2a')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x2b')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x2c')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x2d')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x2e')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x2f')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x30')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x31')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x32')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/squareProject/squareProject.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x33')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x34')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x35')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x36')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x37')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x38')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x39')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x3a')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x3b')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x3c')));var _0x1916b0=jayson[_0xd11b('0x3d')](_0x1e1894)[_0xd11b('0x3e')]();var _0x528881=config[_0xd11b('0x3f')]['port']||config[_0xd11b('0x40')]+0x1;var _0x948ef0=config[_0xd11b('0x3f')]['ip']||_0xd11b('0x41');_0x1916b0['on']('error',function(_0xd4c3f3){return _0x2d54da(_0xd4c3f3);});_0x1916b0[_0xd11b('0x4')](_0x528881,_0x948ef0,function(){console[_0xd11b('0x42')](_0xd11b('0x43'),_0x948ef0,_0x528881);require('../config/triggers')['default']();return _0x4701b8('RPC\x20listening\x20on\x20'+_0x948ef0+':'+_0x528881);});});}; \ No newline at end of file +var _0x8e88=['../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc'];(function(_0x5ea8f7,_0x3ae5ab){var _0x5e5dee=function(_0x4fb557){while(--_0x4fb557){_0x5ea8f7['push'](_0x5ea8f7['shift']());}};_0x5e5dee(++_0x3ae5ab);}(_0x8e88,0x1c5));var _0x88e8=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x8e88[_0x4191bc];return _0x1ffd4e;};'use strict';var jayson=require(_0x88e8('0x0'));var BPromise=require(_0x88e8('0x1'));var _=require(_0x88e8('0x2'));var config=require(_0x88e8('0x3'));exports[_0x88e8('0x4')]=function(){return new BPromise(function(_0x3dda58,_0x476a70){var _0x47ac78={};_0x47ac78=_['merge'](_0x47ac78,require('../api/user/user.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x6')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x7')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x8')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x9')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xa')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xb')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xc')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0xd')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xe')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xf')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x10')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/mailServerIn/mailServerIn.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/mailAccount/mailAccount.rpc'));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x11')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x12')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/mailMessage/mailMessage.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x13')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x14')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x15')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x16')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x17')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x18')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/faxQueue/faxQueue.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x19')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1a')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1b')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x1c')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1d')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1e')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1f')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x20')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x21')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x22')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x23')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x24')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x25')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x26')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x27')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x28')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x29')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x2a')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x2b')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x2c')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x2d')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x2e')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/variable/variable.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x2f')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x30')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x31')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x32')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x33')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x34')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x35')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x36')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x37')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/squareReport/squareReport.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x38')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/squareOdbc/squareOdbc.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x39')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x3a')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x3b')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x3c')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x3d')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x3e')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x3f')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x40')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x41')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x42')));var _0xe88181=jayson[_0x88e8('0x43')](_0x47ac78)[_0x88e8('0x44')]();var _0x43a8c6=config[_0x88e8('0x45')][_0x88e8('0x46')]||config['port']+0x1;var _0x3cca07=config['rpc']['ip']||_0x88e8('0x47');_0xe88181['on'](_0x88e8('0x48'),function(_0x4e4ac4){return _0x476a70(_0x4e4ac4);});_0xe88181['listen'](_0x43a8c6,_0x3cca07,function(){console[_0x88e8('0x49')](_0x88e8('0x4a'),_0x3cca07,_0x43a8c6);require(_0x88e8('0x4b'))[_0x88e8('0x4c')]();return _0x3dda58(_0x88e8('0x4d')+_0x3cca07+':'+_0x43a8c6);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 03f012c..629a9d9 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 _0xd462=['exec','join','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','line','toLowerCase','emit','hangup','520-Invalid','search','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','log','command=','write','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','format','VERBOSE\x20\x22%s\x22'];(function(_0x1948d0,_0x47d637){var _0x43280c=function(_0x25a865){while(--_0x25a865){_0x1948d0['push'](_0x1948d0['shift']());}};_0x43280c(++_0x47d637);}(_0xd462,0x6f));var _0x2d46=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0xd462[_0x380e75];return _0x444d96;};'use strict';var util=require('util');var _=require(_0x2d46('0x0'));var EventEmitter=require('events')[_0x2d46('0x1')];var AGIReply=require(_0x2d46('0x2'));var AGIError=require(_0x2d46('0x3'));function AGIChannel(_0x15fafb){var _0x3abdde=this,_0x2f377b=new AGIReply(),_0x3b5707=![],_0x4fb122={};EventEmitter[_0x2d46('0x4')](_0x3abdde);_0x15fafb[_0x2d46('0x5')](_0x2d46('0x6'));_0x15fafb['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2f377b[_0x2d46('0x5')](_0x2d46('0x6'));_0x2f377b['on'](_0x2d46('0x7'),function(_0x2bb6f4){for(var _0x46ff8c in _0x2bb6f4){_0x3abdde[_0x46ff8c]=_0x2bb6f4[_0x46ff8c];}_0x3abdde['emit']('ready');});_0x2f377b['on'](_0x2d46('0x8'),function(_0x5d093f){if(_0x5d093f[_0x2d46('0x9')]()=='hangup'){_0x3abdde[_0x2d46('0xa')](_0x2d46('0xb'));return;}if(_0x5d093f['substring'](0x0,0xb)==_0x2d46('0xc')){_0x3b5707=!![];}if(_0x3b5707){_0x4fb122['rx']+=_0x5d093f+'\x0a';if(_0x5d093f[_0x2d46('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x3b5707=![];}}else{_0x4fb122['rx']=_0x5d093f;}if(_0x3b5707){return;}if(typeof _0x4fb122['cb']==_0x2d46('0xe')){var _0x5c25ef=_0x4fb122['rx'][_0x2d46('0xf')](0x0,0x3),_0x2dcb6e=null,_0x11ecb2=null;_0x5c25ef=parseInt(_0x5c25ef);if(isNaN(_0x5c25ef)){_0x4fb122['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2d46('0x10')});return;}if(_0x5c25ef!=0xc8){_0x4fb122['cb'](null,{'code':_0x5c25ef,'result':-0x1,'extra':'KO'});return;}_0x2dcb6e=_0x4fb122['rx'][_0x2d46('0xf')](0x4)[_0x2d46('0x11')](_0x2d46('0x12'),'');if(_0x2dcb6e[_0x2d46('0x13')]('\x20')!=-0x1){_0x2dcb6e=_0x2dcb6e[_0x2d46('0x14')](0x0,_0x2dcb6e[_0x2d46('0x13')]('\x20'));}if(_[_0x2d46('0x15')](_0x2dcb6e,'-1')){_0x2dcb6e=parseInt(_0x2dcb6e);}_0x11ecb2=_0x4fb122['rx']['split']('\x20');if(_0x11ecb2[_0x2d46('0x16')]==0x3){_0x11ecb2=_0x11ecb2[0x2][_0x2d46('0xf')](0x1,_0x11ecb2[0x2][_0x2d46('0x16')]-0x1);}else if(_0x11ecb2[_0x2d46('0x16')]>0x3){var _0x3fcb18=/\((.+)\)/;var _0xf49f6b=_0x4fb122['rx']['match'](_0x3fcb18);if(_0xf49f6b){_0x11ecb2=_0xf49f6b[0x1];}else{_0x11ecb2=null;}}else{_0x11ecb2=null;}_0x4fb122['cb'](null,{'code':_0x5c25ef,'result':_0x2dcb6e,'extra':_0x11ecb2});}});_0x15fafb['on'](_0x2d46('0x17'),function(_0x1983d4){_0x3abdde['emit']('error',new AGIError(_0x2d46('0x18'),_0x1983d4['code']));});_0x15fafb['on'](_0x2d46('0x19'),function(){_0x3abdde[_0x2d46('0xa')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x15fafb['on'](_0x2d46('0x1a'),function(){_0x3abdde[_0x2d46('0xa')](_0x2d46('0x1a'),new AGIError(_0x2d46('0x1b')));_0x15fafb[_0x2d46('0x1c')]();});_0x15fafb[_0x2d46('0x1d')](_0x2f377b);this[_0x2d46('0x1e')]=function(_0x3b5c91,_0x4e4048){console[_0x2d46('0x1f')](_0x2d46('0x20'),_0x3b5c91);var _0x3b5c91=_0x3b5c91||'',_0x4e4048=typeof _0x4e4048=='function'?_0x4e4048:new Function();_0x4fb122={'tx':_0x3b5c91,'rx':'','cb':_0x4e4048};_0x15fafb[_0x2d46('0x21')](_0x3b5c91+'\x0a');},this[_0x2d46('0x19')]=function(){_0x15fafb[_0x2d46('0x1c')]();};}util[_0x2d46('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x2d46('0x23')]['sendRequest']=function(_0x595efb){return this[_0x2d46('0x1e')][_0x2d46('0x24')](this,_0x595efb);};AGIChannel['prototype'][_0x2d46('0x25')]=function(){return this[_0x2d46('0x26')](_0x2d46('0x27'));};AGIChannel['prototype'][_0x2d46('0x28')]=function(_0x14e387,_0x5ecd6b,_0x1428c3){_0x14e387=_0x14e387===undefined?'beep':_0x14e387;_0x5ecd6b=_0x5ecd6b===undefined?'5':_0x5ecd6b;_0x1428c3=_0x1428c3===undefined?'1':_0x1428c3;return this[_0x2d46('0x26')](util['format'](_0x2d46('0x29'),_0x14e387,_0x5ecd6b*0x3e8,_0x1428c3));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x2a')]=function(_0x4a1b59){_0x4a1b59=_0x4a1b59||'NO\x20MESSAGE';return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x2c'),_0x4a1b59));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x2d')]=function(_0x384ad,_0xd65ca5){if(_['isArray'](_0xd65ca5)){return this[_0x2d46('0x26')](util[_0x2d46('0x2b')]('EXEC\x20%s\x20%s',_0x384ad,_0xd65ca5[_0x2d46('0x2e')](',')));}return this[_0x2d46('0x26')](util['format'](_0x2d46('0x2f'),_0x384ad,_0xd65ca5));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x30')]=function(_0x2e1602){return this[_0x2d46('0x26')](util['format']('SET\x20CONTEXT\x20%s',_0x2e1602));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x31')]=function(_0x451081){return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x32'),_0x451081));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x33')]=function(_0x416cf1){return this[_0x2d46('0x26')](util['format'](_0x2d46('0x34'),_0x416cf1));};AGIChannel[_0x2d46('0x23')][_0x2d46('0xb')]=function(){return this[_0x2d46('0x26')](_0x2d46('0x35'));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x36')]=function(_0x46a8d7,_0x5bc4da){var _0x1ff41f=_[_0x2d46('0x37')](_0x5bc4da)||_[_0x2d46('0x38')](_0x5bc4da)?_0x5bc4da[_0x2d46('0x39')]():_0x5bc4da;return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x3a'),_0x46a8d7,_0x1ff41f?_0x1ff41f[_0x2d46('0x39')]()[_0x2d46('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x3b')]=function(_0xf583d0,_0x4ea926){return this[_0x2d46('0x26')](util['format'](_0x2d46('0x3c'),_0xf583d0,_0x4ea926));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x3d')]=function(_0x531e0c,_0x262059){return this['sendRequest'](util['format'](_0x2d46('0x3e'),_0x531e0c,_0x262059));};AGIChannel['prototype'][_0x2d46('0x3f')]=function(_0x572092,_0x445579){return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x40'),_0x572092,_0x445579));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x41')]=function(_0x1f61ba,_0x1f5b79,_0x2581b3){_0x1f5b79=_0x1f5b79||this[_0x2d46('0x42')];_0x2581b3=_0x2581b3||0x1;this[_0x2d46('0x30')](_0x1f61ba);this['setExtension'](_0x1f5b79);this[_0x2d46('0x33')](_0x2581b3);return this['noop'](util[_0x2d46('0x2b')](_0x2d46('0x43'),_0x1f61ba,_0x1f5b79,_0x2581b3));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x44')]=function(_0x3fee04){console['log'](_0x2d46('0x45'),_0x3fee04);return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x46'),_0x3fee04));};AGIChannel[_0x2d46('0x23')]['recordFile']=function(_0x705eb6,_0x3d9c6b,_0x58f44c,_0x1403b0,_0x1b4478,_0x852d3c){_0x3d9c6b=_0x3d9c6b||'wav';_0x58f44c=_0x58f44c||'';_0x1403b0=_0x1403b0===undefined?-0x1:_0x1403b0==='-1'?-0x1:_0x1403b0*0x3e8;_0x1b4478=_0x1b4478===undefined?'':'s='+_0x1b4478;_0x852d3c=_0x852d3c?_0x2d46('0x47'):'';return this['sendRequest'](util[_0x2d46('0x2b')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x705eb6,_0x3d9c6b,_0x58f44c,_0x1403b0,_0x852d3c,_0x1b4478));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x48')]=function(_0x134982,_0x3586eb){_0x3586eb=_0x3586eb||'';return this[_0x2d46('0x26')](util[_0x2d46('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x134982,_0x3586eb));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x49')]=function(_0x1b737d){return this[_0x2d46('0x2d')](_0x2d46('0x4a'),_0x1b737d);};AGIChannel[_0x2d46('0x23')][_0x2d46('0x4b')]=function(_0x3d9816){return this[_0x2d46('0x2d')](_0x2d46('0x4c'),_0x3d9816);};AGIChannel[_0x2d46('0x23')][_0x2d46('0x17')]=function(_0x430418,_0x16ecaa){this['noop'](util[_0x2d46('0x2b')](_0x2d46('0x4d'),_0x430418['id'],_0x430418['label'],_0x16ecaa));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xdcdb=['SET\x20EXTENSION\x20%s','HANGUP','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','exports','util','lodash','events','EventEmitter','./reply','call','setEncoding','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','no\x20code','substr','indexOf','startsWith','split','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','log','command=','function','write','prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension'];(function(_0x1b6621,_0x105c12){var _0x12cad9=function(_0x523cf2){while(--_0x523cf2){_0x1b6621['push'](_0x1b6621['shift']());}};_0x12cad9(++_0x105c12);}(_0xdcdb,0xab));var _0xbdcd=function(_0x1424ef,_0x4f0eda){_0x1424ef=_0x1424ef-0x0;var _0x2478c3=_0xdcdb[_0x1424ef];return _0x2478c3;};'use strict';var util=require(_0xbdcd('0x0'));var _=require(_0xbdcd('0x1'));var EventEmitter=require(_0xbdcd('0x2'))[_0xbdcd('0x3')];var AGIReply=require(_0xbdcd('0x4'));var AGIError=require('./error');function AGIChannel(_0x1ede78){var _0x3ec1c3=this,_0x309eb3=new AGIReply(),_0x147134=![],_0x27f33c={};EventEmitter[_0xbdcd('0x5')](_0x3ec1c3);_0x1ede78[_0xbdcd('0x6')]('utf8');_0x1ede78['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x309eb3[_0xbdcd('0x6')]('utf8');_0x309eb3['on'](_0xbdcd('0x7'),function(_0xd46201){for(var _0x1aeee6 in _0xd46201){_0x3ec1c3[_0x1aeee6]=_0xd46201[_0x1aeee6];}_0x3ec1c3[_0xbdcd('0x8')]('ready');});_0x309eb3['on'](_0xbdcd('0x9'),function(_0x355c22){if(_0x355c22[_0xbdcd('0xa')]()==_0xbdcd('0xb')){_0x3ec1c3[_0xbdcd('0x8')]('hangup');return;}if(_0x355c22[_0xbdcd('0xc')](0x0,0xb)==_0xbdcd('0xd')){_0x147134=!![];}if(_0x147134){_0x27f33c['rx']+=_0x355c22+'\x0a';if(_0x355c22[_0xbdcd('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x147134=![];}}else{_0x27f33c['rx']=_0x355c22;}if(_0x147134){return;}if(typeof _0x27f33c['cb']=='function'){var _0x42b559=_0x27f33c['rx'][_0xbdcd('0xc')](0x0,0x3),_0x2cb72a=null,_0x36a92b=null;_0x42b559=parseInt(_0x42b559);if(isNaN(_0x42b559)){_0x27f33c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xbdcd('0xf')});return;}if(_0x42b559!=0xc8){_0x27f33c['cb'](null,{'code':_0x42b559,'result':-0x1,'extra':'KO'});return;}_0x2cb72a=_0x27f33c['rx'][_0xbdcd('0xc')](0x4)['replace']('result=','');if(_0x2cb72a['indexOf']('\x20')!=-0x1){_0x2cb72a=_0x2cb72a[_0xbdcd('0x10')](0x0,_0x2cb72a[_0xbdcd('0x11')]('\x20'));}if(_[_0xbdcd('0x12')](_0x2cb72a,'-1')){_0x2cb72a=parseInt(_0x2cb72a);}_0x36a92b=_0x27f33c['rx'][_0xbdcd('0x13')]('\x20');if(_0x36a92b['length']==0x3){_0x36a92b=_0x36a92b[0x2][_0xbdcd('0xc')](0x1,_0x36a92b[0x2]['length']-0x1);}else if(_0x36a92b['length']>0x3){var _0x20a1d8=/\((.+)\)/;var _0x57d6ba=_0x27f33c['rx'][_0xbdcd('0x14')](_0x20a1d8);if(_0x57d6ba){_0x36a92b=_0x57d6ba[0x1];}else{_0x36a92b=null;}}else{_0x36a92b=null;}_0x27f33c['cb'](null,{'code':_0x42b559,'result':_0x2cb72a,'extra':_0x36a92b});}});_0x1ede78['on'](_0xbdcd('0x15'),function(_0x4b1d78){_0x3ec1c3[_0xbdcd('0x8')]('error',new AGIError(_0xbdcd('0x16'),_0x4b1d78[_0xbdcd('0x17')]));});_0x1ede78['on'](_0xbdcd('0x18'),function(){_0x3ec1c3[_0xbdcd('0x8')](_0xbdcd('0x18'),new AGIError(_0xbdcd('0x19')));});_0x1ede78['on']('timeout',function(){_0x3ec1c3[_0xbdcd('0x8')]('timeout',new AGIError(_0xbdcd('0x1a')));_0x1ede78[_0xbdcd('0x1b')]();});_0x1ede78[_0xbdcd('0x1c')](_0x309eb3);this[_0xbdcd('0x1d')]=function(_0x4be259,_0x24ced7){console[_0xbdcd('0x1e')](_0xbdcd('0x1f'),_0x4be259);var _0x4be259=_0x4be259||'',_0x24ced7=typeof _0x24ced7==_0xbdcd('0x20')?_0x24ced7:new Function();_0x27f33c={'tx':_0x4be259,'rx':'','cb':_0x24ced7};_0x1ede78[_0xbdcd('0x21')](_0x4be259+'\x0a');},this['close']=function(){_0x1ede78[_0xbdcd('0x1b')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x23')]=function(_0x5a4657){return this[_0xbdcd('0x1d')][_0xbdcd('0x24')](this,_0x5a4657);};AGIChannel[_0xbdcd('0x22')]['answer']=function(){return this['sendRequest'](_0xbdcd('0x25'));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x26')]=function(_0x3ad328,_0x3405ae,_0x221b11){_0x3ad328=_0x3ad328===undefined?_0xbdcd('0x27'):_0x3ad328;_0x3405ae=_0x3405ae===undefined?'5':_0x3405ae;_0x221b11=_0x221b11===undefined?'1':_0x221b11;return this['sendRequest'](util[_0xbdcd('0x28')](_0xbdcd('0x29'),_0x3ad328,_0x3405ae*0x3e8,_0x221b11));};AGIChannel['prototype'][_0xbdcd('0x2a')]=function(_0x2cf61f){_0x2cf61f=_0x2cf61f||_0xbdcd('0x2b');return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')](_0xbdcd('0x2c'),_0x2cf61f));};AGIChannel['prototype'][_0xbdcd('0x2d')]=function(_0x5e984a,_0x2b7bcb){if(_[_0xbdcd('0x2e')](_0x2b7bcb)){return this['sendRequest'](util[_0xbdcd('0x28')](_0xbdcd('0x2f'),_0x5e984a,_0x2b7bcb['join'](',')));}return this['sendRequest'](util[_0xbdcd('0x28')](_0xbdcd('0x2f'),_0x5e984a,_0x2b7bcb));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x30')]=function(_0x38d9cc){return this[_0xbdcd('0x23')](util['format'](_0xbdcd('0x31'),_0x38d9cc));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x32')]=function(_0x533f88){return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')](_0xbdcd('0x33'),_0x533f88));};AGIChannel[_0xbdcd('0x22')]['setPriority']=function(_0x24eca4){return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')]('SET\x20PRIORITY\x20%s',_0x24eca4));};AGIChannel['prototype'][_0xbdcd('0xb')]=function(){return this[_0xbdcd('0x23')](_0xbdcd('0x34'));};AGIChannel[_0xbdcd('0x22')]['setVariable']=function(_0x4c1253,_0x5d1e31){var _0x25776c=_['isBoolean'](_0x5d1e31)||_[_0xbdcd('0x35')](_0x5d1e31)?_0x5d1e31[_0xbdcd('0x36')]():_0x5d1e31;return this[_0xbdcd('0x23')](util['format'](_0xbdcd('0x37'),_0x4c1253,_0x25776c?_0x25776c[_0xbdcd('0x36')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x38')]=function(_0x4357be,_0x1fa632){return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')]('SAY\x20NUMBER\x20%s\x20%s',_0x4357be,_0x1fa632));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x39')]=function(_0x11bcd2,_0x2cd90d){return this['sendRequest'](util[_0xbdcd('0x28')](_0xbdcd('0x3a'),_0x11bcd2,_0x2cd90d));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x3b')]=function(_0x2233aa,_0x1c8517){return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2233aa,_0x1c8517));};AGIChannel[_0xbdcd('0x22')]['continueAt']=function(_0x285d34,_0x2f9faf,_0x27d512){_0x2f9faf=_0x2f9faf||this[_0xbdcd('0x3c')];_0x27d512=_0x27d512||0x1;this['setContext'](_0x285d34);this[_0xbdcd('0x32')](_0x2f9faf);this[_0xbdcd('0x3d')](_0x27d512);return this['noop'](util['format'](_0xbdcd('0x3e'),_0x285d34,_0x2f9faf,_0x27d512));};AGIChannel['prototype'][_0xbdcd('0x3f')]=function(_0x1ec687){console[_0xbdcd('0x1e')](_0xbdcd('0x40'),_0x1ec687);return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x1ec687));};AGIChannel[_0xbdcd('0x22')]['recordFile']=function(_0x30e18a,_0x13df20,_0x7c9d75,_0x1497da,_0xa72d2e,_0x33fc09){_0x13df20=_0x13df20||_0xbdcd('0x41');_0x7c9d75=_0x7c9d75||'';_0x1497da=_0x1497da===undefined?-0x1:_0x1497da==='-1'?-0x1:_0x1497da*0x3e8;_0xa72d2e=_0xa72d2e===undefined?'':'s='+_0xa72d2e;_0x33fc09=_0x33fc09?_0xbdcd('0x42'):'';return this['sendRequest'](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x30e18a,_0x13df20,_0x7c9d75,_0x1497da,_0x33fc09,_0xa72d2e));};AGIChannel['prototype'][_0xbdcd('0x43')]=function(_0x2006cf,_0x184ce9){_0x184ce9=_0x184ce9||'';return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')](_0xbdcd('0x44'),_0x2006cf,_0x184ce9));};AGIChannel['prototype'][_0xbdcd('0x45')]=function(_0x3376ca){return this['exec'](_0xbdcd('0x46'),_0x3376ca);};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x47')]=function(_0x4dc4f3){return this[_0xbdcd('0x2d')](_0xbdcd('0x48'),_0x4dc4f3);};AGIChannel['prototype'][_0xbdcd('0x15')]=function(_0x2ca1cf,_0x56a7f2){this[_0xbdcd('0x2a')](util[_0xbdcd('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2ca1cf['id'],_0x2ca1cf['label'],_0x56a7f2));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xbdcd('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 362515e..3bff1de 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 _0x89fe=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x89fe,0x83));var _0xe89f=function(_0x141eb9,_0x41985d){_0x141eb9=_0x141eb9-0x0;var _0x4ca294=_0x89fe[_0x141eb9];return _0x4ca294;};'use strict';var util=require(_0xe89f('0x0'));var error={'E_AGI_UNDEFINED':_0xe89f('0x1'),'E_AGI_ARGUMENT_PORT':_0xe89f('0x2'),'E_AGI_SERVER_ERROR':_0xe89f('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xe89f('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xe89f('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xe89f('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xe89f('0x7'),'E_AGI_COMMAND_EMPTY':_0xe89f('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe89f('0x9'),'E_AGI_IVR_ENTRY':_0xe89f('0xa')};function AGIError(_0x2d5020){var _0x2d5020=_0x2d5020||null,_0x5427d2=_0x5427d2||[],_0x4639f0=0x1,_0x3e9998='';if(!error[_0x2d5020]){_0x2d5020=_0xe89f('0xb');}_0x5427d2[_0xe89f('0xc')](error[_0x2d5020]);while(arguments[_0x4639f0]){_0x5427d2[_0xe89f('0xc')](arguments[_0x4639f0]);_0x4639f0++;}_0x3e9998=util['format'][_0xe89f('0xd')](util,_0x5427d2);this[_0xe89f('0xe')]=_0x3e9998;this[_0xe89f('0xf')]=_0x2d5020;}module[_0xe89f('0x10')]=AGIError; \ No newline at end of file +var _0x60c2=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','Undefined\x20error.'];(function(_0x280905,_0x362610){var _0x211dab=function(_0x5dcb13){while(--_0x5dcb13){_0x280905['push'](_0x280905['shift']());}};_0x211dab(++_0x362610);}(_0x60c2,0x8f));var _0x260c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x60c2[_0x17d9e3];return _0x14192d;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x260c('0x0'),'E_AGI_ARGUMENT_PORT':_0x260c('0x1'),'E_AGI_SERVER_ERROR':_0x260c('0x2'),'E_AGI_SERVER_CLOSE':_0x260c('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x260c('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x260c('0x5'),'E_AGI_SOCKET_ERROR':_0x260c('0x6'),'E_AGI_SOCKET_CLOSE':_0x260c('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x260c('0x8'),'E_AGI_COMMAND_EMPTY':_0x260c('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x260c('0xa'),'E_AGI_IVR_ENTRY':_0x260c('0xb')};function AGIError(_0x558b0c){var _0x558b0c=_0x558b0c||null,_0x2c2cd8=_0x2c2cd8||[],_0x3b432d=0x1,_0xf22c37='';if(!error[_0x558b0c]){_0x558b0c='E_AGI_UNDEFINED';}_0x2c2cd8[_0x260c('0xc')](error[_0x558b0c]);while(arguments[_0x3b432d]){_0x2c2cd8[_0x260c('0xc')](arguments[_0x3b432d]);_0x3b432d++;}_0xf22c37=util[_0x260c('0xd')][_0x260c('0xe')](util,_0x2c2cd8);this[_0x260c('0xf')]=_0xf22c37;this[_0x260c('0x10')]=_0x558b0c;}module[_0x260c('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 4b82e70..b06b3eb 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 _0x7894=['vertices','prototype','addEdge','size','relations','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','split','agicommand','vswitch','target','default','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','addVertex'];(function(_0x43869b,_0x25c761){var _0x5a2d2a=function(_0x3bb69b){while(--_0x3bb69b){_0x43869b['push'](_0x43869b['shift']());}};_0x5a2d2a(++_0x25c761);}(_0x7894,0x170));var _0x4789=function(_0x24855b,_0x233dd0){_0x24855b=_0x24855b-0x0;var _0x21f80f=_0x7894[_0x24855b];return _0x21f80f;};'use strict';var _=require(_0x4789('0x0'));var logger=require(_0x4789('0x1'))(_0x4789('0x2'));var verticesWithRetry=[_0x4789('0x3'),_0x4789('0x4'),_0x4789('0x5')];var Graph=function(){this['vertices']={};this[_0x4789('0x6')]={};this[_0x4789('0x7')]=0x0;};Graph['prototype'][_0x4789('0x8')]=function(_0x4bfe85){this[_0x4789('0x9')][_0x4bfe85['id']]=_0x4bfe85;this[_0x4789('0x6')][_0x4bfe85['id']]=[];};Graph[_0x4789('0xa')][_0x4789('0xb')]=function(_0x13b7f6,_0x5a45ae,_0x49d256){this[_0x4789('0x6')][_0x13b7f6]['push']({'target':_0x5a45ae,'condition':_0x49d256});this[_0x4789('0x7')]+=0x1;};Graph[_0x4789('0xa')][_0x4789('0xc')]=function(){return _['size'](this[_0x4789('0x9')]);};Graph['prototype'][_0x4789('0xd')]=function(){return this[_0x4789('0x7')];};Graph[_0x4789('0xa')]['getVertex']=function(_0x4db727){return this[_0x4789('0x9')][_0x4db727];};Graph['prototype'][_0x4789('0xe')]=function(_0x58743a,_0x25a4a9){if(!this[_0x4789('0x9')][_0x58743a]){return logger['info'](_0x4789('0xf'));}var _0x4e0fde=_0x25a4a9(this[_0x4789('0x9')][_0x58743a]);if(!_0x4e0fde){return logger[_0x4789('0x10')](_0x4789('0x11'));}if(this['edges'][_0x58743a][_0x4789('0x12')]===0x0){return logger[_0x4789('0x10')]('no\x20edge/s\x20available');}for(var _0x30dee9=0x0,_0x527656=[],_0x118f97=![];_0x30dee9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','start','clear','vertex','VERTEX','context','extension','priority','vresponse','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./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','name','message','error','[%s]\x20%s','[ERROR]\x20%s','uniqueid','arg_1','calleridname','dnid','toJson','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','indexOf','agi_','substring','stringify','callerid','close','timeout','hangup','sync','production'];(function(_0x283e4d,_0xd4043c){var _0x3ee73a=function(_0x3aaaaa){while(--_0x3aaaaa){_0x283e4d['push'](_0x283e4d['shift']());}};_0x3ee73a(++_0xd4043c);}(_0x18c9,0x13c));var _0x918c=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x18c9[_0xe66cf2];return _0x2d84e7;};'use strict';var parser=require(_0x918c('0x0'));var _=require(_0x918c('0x1'));var syncho=require(_0x918c('0x2'));var util=require(_0x918c('0x3'));var moment=require(_0x918c('0x4'));var config=require(_0x918c('0x5'));var logger=require('../../config/logger')(_0x918c('0x6'));var utilLicense=require(_0x918c('0x7'));var rpc=require('./rpc');var mailRpc=require(_0x918c('0x8'));var Graph=require('./graph');var Vertices=require(_0x918c('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x918c('0x6')]=_[_0x918c('0xa')](config[_0x918c('0x6')],{'ip':_0x918c('0xb'),'port':0x11dd});function connectionHandler(_0x4ad426){process[_0x918c('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4ad426);agiHandler(_0x4ad426);}catch(_0x542f92){logger['error'](_0x542f92[_0x918c('0xd')]);}});});}function listeningHandler(){console[_0x918c('0xe')](_0x918c('0xf'),config[_0x918c('0x6')][_0x918c('0x10')]);logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x13'),config['agi']['ip'],config['agi'][_0x918c('0x10')]));}function errorHandler(_0x114f0c){if(_0x114f0c&&_0x114f0c[_0x918c('0x14')]&&_0x114f0c[_0x918c('0x15')]){logger[_0x918c('0x16')](util['format'](_0x918c('0x17'),_0x114f0c[_0x918c('0x14')],_0x114f0c[_0x918c('0x15')]));}else{logger[_0x918c('0x16')](util[_0x918c('0x12')](_0x918c('0x18'),_0x114f0c[_0x918c('0xd')]));}}function closeHandler(){logger[_0x918c('0x11')](util[_0x918c('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this[_0x918c('0x19')]));try{createSquareReport(this);}catch(_0x54f9fa){logger[_0x918c('0x16')](_0x54f9fa[_0x918c('0xd')]);}}function timeoutHandler(){logger[_0x918c('0x11')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this['callerid'],this[_0x918c('0x1c')],this[_0x918c('0x19')]));}function hangupHandler(){logger[_0x918c('0x11')](util[_0x918c('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this['callerid'],this['dnid'],this[_0x918c('0x19')]));this['evtHangup']=!![];}function getRoot(_0x5c27d1){return parser[_0x918c('0x1d')](_0x5c27d1,{'object':!![]})['mxGraphModel'][_0x918c('0x1e')];}function addVertex(_0xf3252,_0x4f97be,_0x3780db){_0x4f97be[_0x918c('0x1f')]=_0x3780db;if(_0x4f97be[_0x918c('0x20')](_0x918c('0x21'))){_0x4f97be['maxRetry']=parseInt(_0x4f97be[_0x918c('0x21')],0xa);}_0xf3252[_0x918c('0x22')](_[_0x918c('0x23')](_0x4f97be,_0x918c('0x24')));}function initGraph(_0x124e3d,_0xebf958){var _0x4cf95c=new Graph();for(var _0xed8db9 in _0x124e3d){if(_0x124e3d[_0x918c('0x20')](_0xed8db9)){if(_[_0x918c('0x25')](_0x124e3d[_0xed8db9])){for(var _0x11e8bf=0x0;_0x11e8bf<_0x124e3d[_0xed8db9]['length'];_0x11e8bf+=0x1){addVertex(_0x4cf95c,_0x124e3d[_0xed8db9][_0x11e8bf],_0xed8db9);}}else{addVertex(_0x4cf95c,_0x124e3d[_0xed8db9],_0xed8db9);}}}for(var _0x194e7e=0x0;_0x194e7e<_0xebf958[_0x918c('0x26')];_0x194e7e+=0x1){if(_0xebf958[_0x194e7e]['source']&&_0xebf958[_0x194e7e][_0x918c('0x27')]){_0x4cf95c[_0x918c('0x28')](_0xebf958[_0x194e7e][_0x918c('0x29')],_0xebf958[_0x194e7e][_0x918c('0x27')],_0xebf958[_0x194e7e][_0x918c('0x2a')]);}}return _0x4cf95c;}function getSquareProject(_0x2a1a7e,_0xdf5735){rpc[_0x918c('0x2b')](_0x2a1a7e)[_0x918c('0x2c')](function(_0x344bbb){_0xdf5735(null,_0x344bbb);})['catch'](function(_0x183d31){_0xdf5735(null,_0x183d31);});}function createSquareReport(_0x38c253,_0x4e7981){rpc['createSquareReport'](_0x38c253)[_0x918c('0x2c')](function(_0x2cba74){if(_0x4e7981){_0x4e7981(null,_0x2cba74);}})[_0x918c('0x2d')](function(_0x4ba726){if(_0x4e7981){_0x4e7981(null,_0x4ba726);}});}function setChannelVariables(_0x1c9341){for(var _0x551f56 in _0x1c9341){if(_0x1c9341[_0x918c('0x20')](_0x551f56)){if(_0x551f56[_0x918c('0x2e')](_0x918c('0x2f'))===0x0){_0x1c9341[_0x551f56[_0x918c('0x30')](0x4)]=_0x1c9341[_0x551f56];delete _0x1c9341[_0x551f56];}}}}function getLogFromObject(_0x1476cb){return util['inspect'](_0x1476cb,{'showHidden':![],'depth':null});}function agiHandler(_0x18b46a){var _0x593c0e,_0x46555a,_0x132ccd,_0x90222e,_0x1cff82;logger['debug']('variables',JSON[_0x918c('0x31')](_0x18b46a,null,0x2));logger['info'](util[_0x918c('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x18b46a['arg_1'],_0x18b46a[_0x918c('0x1b')],_0x18b46a[_0x918c('0x32')],_0x18b46a[_0x918c('0x1c')],_0x18b46a['uniqueid']));_0x18b46a['on']('error',errorHandler);_0x18b46a['on'](_0x918c('0x33'),closeHandler);_0x18b46a['on'](_0x918c('0x34'),timeoutHandler);_0x18b46a['evtHangup']=![];_0x18b46a['on'](_0x918c('0x35'),hangupHandler);var _0x1f10a3=getSquareProject[_0x918c('0x36')](null,_0x18b46a[_0x918c('0x1a')]);if(_0x1f10a3){if(_0x1f10a3[_0x918c('0x37')]){_0x593c0e=getRoot(_0x1f10a3['production']);console[_0x918c('0xe')](_0x918c('0x38'),_0x593c0e);if(_0x593c0e&&_0x593c0e['start']){logger[_0x918c('0x39')]('root',JSON[_0x918c('0x31')](_0x593c0e,null,0x2));_0x18b46a[_0x918c('0x3a')]=moment()['format'](_0x918c('0x3b'));_0x46555a=initGraph(_[_0x918c('0x23')](_0x593c0e,_0x918c('0x24')),_0x593c0e[_0x918c('0x24')]);_0x132ccd=new Vertices(_0x18b46a,rpc,mailRpc);console[_0x918c('0xe')](_0x918c('0x3c'),_0x132ccd);logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x3d'),_0x18b46a[_0x918c('0x1a')],_0x18b46a['calleridname'],_0x18b46a[_0x918c('0x32')],_0x18b46a[_0x918c('0x1c')],_0x18b46a[_0x918c('0x19')]));console[_0x918c('0xe')](_0x918c('0x3e'));_0x46555a['traverseBFS'](_0x593c0e[_0x918c('0x3f')]['id'],function(_0x3b39e2){try{_0x3b39e2=_0x132ccd[_0x918c('0x40')](_0x3b39e2);logger[_0x918c('0x39')](_0x918c('0x41'),JSON['stringify'](_0x3b39e2,null,0x2));console[_0x918c('0xe')](_0x918c('0x42'),_0x3b39e2);if(_0x3b39e2[_0x918c('0x1f')]==='gotoc'){logger[_0x918c('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x18b46a[_0x918c('0x43')]=_0x3b39e2[_0x918c('0x43')]||_0x18b46a[_0x918c('0x43')];_0x18b46a[_0x918c('0x44')]=_0x3b39e2['extension'];_0x18b46a[_0x918c('0x45')]=_0x3b39e2[_0x918c('0x45')]?_0x3b39e2[_0x918c('0x45')]-0x1:0x1;return null;}else if(_0x3b39e2&&_0x132ccd[_0x3b39e2[_0x918c('0x1f')]]){_0x1cff82=_0x132ccd[_0x3b39e2['agicommand']](_0x3b39e2);console[_0x918c('0xe')](_0x918c('0x46'),_0x1cff82);logger[_0x918c('0x11')]('response',JSON[_0x918c('0x31')](_0x1cff82,null,0x2));if(_0x1cff82&&_0x1cff82['code']===AGI_CODE_SUCCESS&&_0x1cff82[_0x918c('0x47')]!==AGI_RESULT_ERROR&&!_0x18b46a[_0x918c('0x48')]){logger[_0x918c('0x39')](_0x918c('0x49'),getLogFromObject(_0x1cff82));return _[_0x918c('0x4a')](_0x1cff82[_0x918c('0x47')])?null:_0x1cff82[_0x918c('0x47')][_0x918c('0x4b')]();}else{logger[_0x918c('0x16')]('response',getLogFromObject(_0x1cff82));return null;}}else{logger[_0x918c('0x16')](_0x918c('0x4c'));return null;}}catch(_0x3d363f){logger[_0x918c('0x16')](_0x3d363f[_0x918c('0xd')]);return null;}});if(_0x593c0e[_0x918c('0x4d')]){logger['info'](util[_0x918c('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x18b46a[_0x918c('0x1a')],_0x18b46a[_0x918c('0x1b')],_0x18b46a[_0x918c('0x32')],_0x18b46a[_0x918c('0x1c')],_0x18b46a[_0x918c('0x19')]));_0x46555a[_0x918c('0x4e')](_0x593c0e[_0x918c('0x4d')]['id'],function(_0x23bc40){try{_0x23bc40=_0x132ccd[_0x918c('0x40')](_0x23bc40);logger[_0x918c('0x39')]('vertex',JSON[_0x918c('0x31')](_0x23bc40,null,0x2));if(_0x23bc40&&_0x132ccd[_0x23bc40[_0x918c('0x1f')]]){_0x1cff82=_0x132ccd[_0x23bc40['agicommand']](_0x23bc40);if(_0x1cff82){logger[_0x918c('0x39')](_0x918c('0x49'),getLogFromObject(_0x1cff82));return _[_0x918c('0x4a')](_0x1cff82[_0x918c('0x47')])?null:_0x1cff82[_0x918c('0x47')]['toString']();}else{logger['error'](_0x918c('0x49'),getLogFromObject(_0x1cff82));return null;}}else{logger[_0x918c('0x16')](_0x918c('0x4c'));return null;}}catch(_0x44a0de){logger['error'](_0x44a0de[_0x918c('0xd')]);return null;}});}logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x4f'),_0x18b46a['arg_1'],_0x18b46a[_0x918c('0x1b')],_0x18b46a['callerid'],_0x18b46a['dnid'],_0x18b46a[_0x918c('0x19')]));logger['info'](util[_0x918c('0x12')](_0x918c('0x50'),_0x18b46a['context'],_0x18b46a['extension'],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1));_0x18b46a['continueAt'](_0x18b46a[_0x918c('0x43')],_0x18b46a['extension'],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1);_0x18b46a[_0x918c('0x33')]();}}else{logger[_0x918c('0x16')](util[_0x918c('0x12')]('Project\x20%s\x20not\x20published',_0x18b46a[_0x918c('0x1a')]));_0x18b46a[_0x918c('0x51')](_0x18b46a['context'],_0x18b46a[_0x918c('0x44')],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1);_0x18b46a[_0x918c('0x33')]();}}else{logger[_0x918c('0x16')](util['format'](_0x918c('0x52'),_0x18b46a[_0x918c('0x1a')]));_0x18b46a[_0x918c('0x51')](_0x18b46a[_0x918c('0x43')],_0x18b46a[_0x918c('0x44')],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1);_0x18b46a[_0x918c('0x33')]();}}function main(){var _0x1d194f;return utilLicense[_0x918c('0x53')]()['then'](function(_0x291eb0){if(_0x291eb0){if(_0x291eb0[_0x918c('0x54')]){if(_0x291eb0[_0x918c('0x55')]&&_0x291eb0['callysquare']>0x0){logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x56'),_0x291eb0[_0x918c('0x55')]));_0x1d194f=_0x291eb0[_0x918c('0x55')];}else{logger[_0x918c('0x11')](_0x918c('0x57'));}}else{logger['info'](_0x918c('0x58'));_0x1d194f=-0x1;}}})['catch'](function(_0x50fdda){logger[_0x918c('0x16')](_0x918c('0x59'),_0x50fdda[_0x918c('0xd')]);})['finally'](function(){var _0x190c3e=require(_0x918c('0x5a'))(config['agi'][_0x918c('0x10')],config[_0x918c('0x6')]['ip'],_0x1d194f);_0x190c3e['on']('error',errorHandler);_0x190c3e['on'](_0x918c('0x5b'),listeningHandler);_0x190c3e['on'](_0x918c('0x5c'),connectionHandler);_0x190c3e['on'](_0x918c('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0xf1a7=['then','indexOf','agi_','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','SQUAREROOT','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','traverseBFS','clear','vertex','VERTEX','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','result','toString','agicommand\x20not\x20found','finally','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','value','getSquareProject','catch'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xf1a7,0x8f));var _0x7f1a=function(_0x1221a5,_0x52a8ae){_0x1221a5=_0x1221a5-0x0;var _0x3dd82b=_0xf1a7[_0x1221a5];return _0x3dd82b;};'use strict';var parser=require('xml2json');var _=require(_0x7f1a('0x0'));var syncho=require('syncho');var util=require(_0x7f1a('0x1'));var moment=require(_0x7f1a('0x2'));var config=require(_0x7f1a('0x3'));var logger=require(_0x7f1a('0x4'))(_0x7f1a('0x5'));var utilLicense=require(_0x7f1a('0x6'));var rpc=require(_0x7f1a('0x7'));var mailRpc=require(_0x7f1a('0x8'));var Graph=require(_0x7f1a('0x9'));var Vertices=require(_0x7f1a('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7f1a('0x5')]=_['defaults'](config[_0x7f1a('0x5')],{'ip':_0x7f1a('0xb'),'port':0x11dd});function connectionHandler(_0x213f7e){process[_0x7f1a('0xc')](function(){syncho(function(){try{setChannelVariables(_0x213f7e);agiHandler(_0x213f7e);}catch(_0x2197f3){logger[_0x7f1a('0xd')](_0x2197f3[_0x7f1a('0xe')]);}});});}function listeningHandler(){console[_0x7f1a('0xf')](_0x7f1a('0x10'),config[_0x7f1a('0x5')][_0x7f1a('0x11')]);logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x14'),config['agi']['ip'],config[_0x7f1a('0x5')][_0x7f1a('0x11')]));}function errorHandler(_0x39865){if(_0x39865&&_0x39865[_0x7f1a('0x15')]&&_0x39865[_0x7f1a('0x16')]){logger['error'](util['format']('[%s]\x20%s',_0x39865[_0x7f1a('0x15')],_0x39865['message']));}else{logger[_0x7f1a('0xd')](util[_0x7f1a('0x13')]('[ERROR]\x20%s',_0x39865[_0x7f1a('0xe')]));}}function closeHandler(){logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x17'),this[_0x7f1a('0x18')],this[_0x7f1a('0x19')],this[_0x7f1a('0x1a')],this[_0x7f1a('0x1b')],this[_0x7f1a('0x1c')]));try{createSquareReport(this);}catch(_0x110ddf){logger[_0x7f1a('0xd')](_0x110ddf['stack']);}}function timeoutHandler(){logger['info'](util[_0x7f1a('0x13')](_0x7f1a('0x1d'),this[_0x7f1a('0x18')],this[_0x7f1a('0x19')],this['callerid'],this[_0x7f1a('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x1e'),this[_0x7f1a('0x18')],this[_0x7f1a('0x19')],this[_0x7f1a('0x1a')],this[_0x7f1a('0x1b')],this['uniqueid']));this[_0x7f1a('0x1f')]=!![];}function getRoot(_0x177f70){return parser[_0x7f1a('0x20')](_0x177f70,{'object':!![]})[_0x7f1a('0x21')][_0x7f1a('0x22')];}function addVertex(_0x5b3c63,_0x3e4055,_0x5be3e5){_0x3e4055['agicommand']=_0x5be3e5;if(_0x3e4055[_0x7f1a('0x23')](_0x7f1a('0x24'))){_0x3e4055[_0x7f1a('0x25')]=parseInt(_0x3e4055[_0x7f1a('0x24')],0xa);}_0x5b3c63[_0x7f1a('0x26')](_['omit'](_0x3e4055,_0x7f1a('0x27')));}function initGraph(_0x9b985c,_0x229a98){var _0x415082=new Graph();for(var _0x560b66 in _0x9b985c){if(_0x9b985c[_0x7f1a('0x23')](_0x560b66)){if(_[_0x7f1a('0x28')](_0x9b985c[_0x560b66])){for(var _0x968932=0x0;_0x968932<_0x9b985c[_0x560b66][_0x7f1a('0x29')];_0x968932+=0x1){addVertex(_0x415082,_0x9b985c[_0x560b66][_0x968932],_0x560b66);}}else{addVertex(_0x415082,_0x9b985c[_0x560b66],_0x560b66);}}}for(var _0x466314=0x0;_0x466314<_0x229a98[_0x7f1a('0x29')];_0x466314+=0x1){if(_0x229a98[_0x466314][_0x7f1a('0x2a')]&&_0x229a98[_0x466314][_0x7f1a('0x2b')]){_0x415082['addEdge'](_0x229a98[_0x466314][_0x7f1a('0x2a')],_0x229a98[_0x466314][_0x7f1a('0x2b')],_0x229a98[_0x466314][_0x7f1a('0x2c')]);}}return _0x415082;}function getSquareProject(_0x2bcdf4,_0x29040f){rpc[_0x7f1a('0x2d')](_0x2bcdf4)['then'](function(_0x2fe5ab){_0x29040f(null,_0x2fe5ab);})[_0x7f1a('0x2e')](function(_0xbc4616){_0x29040f(null,_0xbc4616);});}function createSquareReport(_0x1667f3,_0xb4d5f8){rpc['createSquareReport'](_0x1667f3)[_0x7f1a('0x2f')](function(_0x3dcabc){if(_0xb4d5f8){_0xb4d5f8(null,_0x3dcabc);}})[_0x7f1a('0x2e')](function(_0x28105c){if(_0xb4d5f8){_0xb4d5f8(null,_0x28105c);}});}function setChannelVariables(_0x1a8d18){for(var _0x130e40 in _0x1a8d18){if(_0x1a8d18[_0x7f1a('0x23')](_0x130e40)){if(_0x130e40[_0x7f1a('0x30')](_0x7f1a('0x31'))===0x0){_0x1a8d18[_0x130e40['substring'](0x4)]=_0x1a8d18[_0x130e40];delete _0x1a8d18[_0x130e40];}}}}function getLogFromObject(_0x595cd2){return util[_0x7f1a('0x32')](_0x595cd2,{'showHidden':![],'depth':null});}function agiHandler(_0x5ae2a5){var _0x240b28,_0x5a0b44,_0x330f2f,_0x156a2e,_0x5c936b;logger[_0x7f1a('0x33')](_0x7f1a('0x34'),JSON['stringify'](_0x5ae2a5,null,0x2));logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x35'),_0x5ae2a5[_0x7f1a('0x18')],_0x5ae2a5[_0x7f1a('0x19')],_0x5ae2a5[_0x7f1a('0x1a')],_0x5ae2a5[_0x7f1a('0x1b')],_0x5ae2a5['uniqueid']));_0x5ae2a5['on'](_0x7f1a('0xd'),errorHandler);_0x5ae2a5['on'](_0x7f1a('0x36'),closeHandler);_0x5ae2a5['on'](_0x7f1a('0x37'),timeoutHandler);_0x5ae2a5[_0x7f1a('0x1f')]=![];_0x5ae2a5['on'](_0x7f1a('0x38'),hangupHandler);var _0x130174=getSquareProject[_0x7f1a('0x39')](null,_0x5ae2a5[_0x7f1a('0x18')]);if(_0x130174){if(_0x130174[_0x7f1a('0x3a')]){_0x240b28=getRoot(_0x130174['production']);console[_0x7f1a('0xf')](_0x7f1a('0x3b'),_0x240b28);if(_0x240b28&&_0x240b28[_0x7f1a('0x3c')]){logger[_0x7f1a('0x33')](_0x7f1a('0x22'),JSON[_0x7f1a('0x3d')](_0x240b28,null,0x2));_0x5ae2a5[_0x7f1a('0x3e')]=moment()[_0x7f1a('0x13')](_0x7f1a('0x3f'));_0x5a0b44=initGraph(_[_0x7f1a('0x40')](_0x240b28,_0x7f1a('0x27')),_0x240b28[_0x7f1a('0x27')]);_0x330f2f=new Vertices(_0x5ae2a5,rpc,mailRpc);console[_0x7f1a('0xf')](_0x7f1a('0x41'),_0x330f2f);logger['info'](util[_0x7f1a('0x13')](_0x7f1a('0x42'),_0x5ae2a5[_0x7f1a('0x18')],_0x5ae2a5[_0x7f1a('0x19')],_0x5ae2a5['callerid'],_0x5ae2a5['dnid'],_0x5ae2a5['uniqueid']));console['log'](_0x7f1a('0x43'));_0x5a0b44[_0x7f1a('0x44')](_0x240b28[_0x7f1a('0x3c')]['id'],function(_0x5a8fe2){try{_0x5a8fe2=_0x330f2f[_0x7f1a('0x45')](_0x5a8fe2);logger[_0x7f1a('0x33')](_0x7f1a('0x46'),JSON[_0x7f1a('0x3d')](_0x5a8fe2,null,0x2));console[_0x7f1a('0xf')](_0x7f1a('0x47'),_0x5a8fe2);if(_0x5a8fe2[_0x7f1a('0x48')]==='gotoc'){logger[_0x7f1a('0x12')](_0x7f1a('0x49'));_0x5ae2a5[_0x7f1a('0x4a')]=_0x5a8fe2[_0x7f1a('0x4a')]||_0x5ae2a5[_0x7f1a('0x4a')];_0x5ae2a5['extension']=_0x5a8fe2[_0x7f1a('0x4b')];_0x5ae2a5['priority']=_0x5a8fe2[_0x7f1a('0x4c')]?_0x5a8fe2[_0x7f1a('0x4c')]-0x1:0x1;return null;}else if(_0x5a8fe2&&_0x330f2f[_0x5a8fe2[_0x7f1a('0x48')]]){_0x5c936b=_0x330f2f[_0x5a8fe2['agicommand']](_0x5a8fe2);console[_0x7f1a('0xf')](_0x7f1a('0x4d'),_0x5c936b);logger[_0x7f1a('0x12')](_0x7f1a('0x4e'),JSON[_0x7f1a('0x3d')](_0x5c936b,null,0x2));if(_0x5c936b&&_0x5c936b['code']===AGI_CODE_SUCCESS&&_0x5c936b[_0x7f1a('0x4f')]!==AGI_RESULT_ERROR&&!_0x5ae2a5[_0x7f1a('0x1f')]){logger[_0x7f1a('0x33')]('response',getLogFromObject(_0x5c936b));return _['isUndefined'](_0x5c936b[_0x7f1a('0x4f')])?null:_0x5c936b[_0x7f1a('0x4f')][_0x7f1a('0x50')]();}else{logger[_0x7f1a('0xd')]('response',getLogFromObject(_0x5c936b));return null;}}else{logger['error'](_0x7f1a('0x51'));return null;}}catch(_0x28af44){logger[_0x7f1a('0xd')](_0x28af44[_0x7f1a('0xe')]);return null;}});if(_0x240b28[_0x7f1a('0x52')]){logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5ae2a5[_0x7f1a('0x18')],_0x5ae2a5[_0x7f1a('0x19')],_0x5ae2a5[_0x7f1a('0x1a')],_0x5ae2a5[_0x7f1a('0x1b')],_0x5ae2a5[_0x7f1a('0x1c')]));_0x5a0b44[_0x7f1a('0x44')](_0x240b28[_0x7f1a('0x52')]['id'],function(_0x55453b){try{_0x55453b=_0x330f2f[_0x7f1a('0x45')](_0x55453b);logger[_0x7f1a('0x33')](_0x7f1a('0x46'),JSON[_0x7f1a('0x3d')](_0x55453b,null,0x2));if(_0x55453b&&_0x330f2f[_0x55453b[_0x7f1a('0x48')]]){_0x5c936b=_0x330f2f[_0x55453b[_0x7f1a('0x48')]](_0x55453b);if(_0x5c936b){logger[_0x7f1a('0x33')](_0x7f1a('0x4e'),getLogFromObject(_0x5c936b));return _[_0x7f1a('0x53')](_0x5c936b[_0x7f1a('0x4f')])?null:_0x5c936b['result'][_0x7f1a('0x50')]();}else{logger[_0x7f1a('0xd')](_0x7f1a('0x4e'),getLogFromObject(_0x5c936b));return null;}}else{logger[_0x7f1a('0xd')](_0x7f1a('0x51'));return null;}}catch(_0xe099a1){logger[_0x7f1a('0xd')](_0xe099a1[_0x7f1a('0xe')]);return null;}});}logger[_0x7f1a('0x12')](util['format'](_0x7f1a('0x54'),_0x5ae2a5[_0x7f1a('0x18')],_0x5ae2a5[_0x7f1a('0x19')],_0x5ae2a5[_0x7f1a('0x1a')],_0x5ae2a5[_0x7f1a('0x1b')],_0x5ae2a5['uniqueid']));logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x55'),_0x5ae2a5[_0x7f1a('0x4a')],_0x5ae2a5[_0x7f1a('0x4b')],parseInt(_0x5ae2a5[_0x7f1a('0x4c')],0xa)+0x1));_0x5ae2a5[_0x7f1a('0x56')](_0x5ae2a5['context'],_0x5ae2a5[_0x7f1a('0x4b')],parseInt(_0x5ae2a5['priority'],0xa)+0x1);_0x5ae2a5[_0x7f1a('0x36')]();}}else{logger[_0x7f1a('0xd')](util[_0x7f1a('0x13')]('Project\x20%s\x20not\x20published',_0x5ae2a5[_0x7f1a('0x18')]));_0x5ae2a5['continueAt'](_0x5ae2a5[_0x7f1a('0x4a')],_0x5ae2a5[_0x7f1a('0x4b')],parseInt(_0x5ae2a5[_0x7f1a('0x4c')],0xa)+0x1);_0x5ae2a5[_0x7f1a('0x36')]();}}else{logger['error'](util[_0x7f1a('0x13')]('Project\x20%s\x20not\x20found',_0x5ae2a5['arg_1']));_0x5ae2a5['continueAt'](_0x5ae2a5[_0x7f1a('0x4a')],_0x5ae2a5[_0x7f1a('0x4b')],parseInt(_0x5ae2a5['priority'],0xa)+0x1);_0x5ae2a5[_0x7f1a('0x36')]();}}function main(){var _0x129587;return utilLicense[_0x7f1a('0x57')]()[_0x7f1a('0x2f')](function(_0x5e7224){if(_0x5e7224){if(_0x5e7224[_0x7f1a('0x58')]){if(_0x5e7224['callysquare']&&_0x5e7224[_0x7f1a('0x59')]>0x0){logger['info'](util[_0x7f1a('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5e7224[_0x7f1a('0x59')]));_0x129587=_0x5e7224[_0x7f1a('0x59')];}else{logger['info'](_0x7f1a('0x5a'));}}else{logger[_0x7f1a('0x12')](_0x7f1a('0x5b'));_0x129587=-0x1;}}})[_0x7f1a('0x2e')](function(_0x26ac9e){logger[_0x7f1a('0xd')](_0x7f1a('0x5c'),_0x26ac9e[_0x7f1a('0xe')]);})[_0x7f1a('0x52')](function(){var _0x2b46c9=require(_0x7f1a('0x5d'))(config['agi'][_0x7f1a('0x11')],config[_0x7f1a('0x5')]['ip'],_0x129587);_0x2b46c9['on'](_0x7f1a('0xd'),errorHandler);_0x2b46c9['on']('listening',listeningHandler);_0x2b46c9['on'](_0x7f1a('0x5e'),connectionHandler);_0x2b46c9['on'](_0x7f1a('0x36'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index cd7905f..d86501a 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x4e0c5e,_0x47612a){var _0xf3627a=function(_0x309bff){while(--_0x309bff){_0x4e0c5e['push'](_0x4e0c5e['shift']());}};_0xf3627a(++_0x47612a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x162505,_0x21226a){var _0x2cbab4=function(_0x574d18){while(--_0x574d18){_0x162505['push'](_0x162505['shift']());}};_0x2cbab4(++_0x21226a);}(_0x814b,0x1a2));var _0xb814=function(_0x16cf9e,_0x3d3cfd){_0x16cf9e=_0x16cf9e-0x0;var _0x56aefd=_0x814b[_0x16cf9e];return _0x56aefd;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6d4c809..2427b4f 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(_0x167281,_0x1cbdcf){var _0x175151=function(_0x46229d){while(--_0x46229d){_0x167281['push'](_0x167281['shift']());}};_0x175151(++_0x1cbdcf);}(_0x7a54,0x106));var _0x47a5=function(_0x294d3b,_0x497e61){_0x294d3b=_0x294d3b-0x0;var _0x3dcc8e=_0x7a54[_0x294d3b];return _0x3dcc8e;};'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(_0x156877,_0x1b99b2){var _0x161036=function(_0x5a303b){while(--_0x5a303b){_0x156877['push'](_0x156877['shift']());}};_0x161036(++_0x1b99b2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20ba94,_0x2718b3){_0x20ba94=_0x20ba94-0x0;var _0x17f044=_0x5f2f[_0x20ba94];return _0x17f044;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index b8909ae..aff85d9 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 _0xe2de=['Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','rpcreq','GetContactByPhone','getTrunkById','ShowTrunk','ShowSound','ShowInterval'];(function(_0x5f3aba,_0x2bcab7){var _0x3aafec=function(_0x294123){while(--_0x294123){_0x5f3aba['push'](_0x5f3aba['shift']());}};_0x3aafec(++_0x2bcab7);}(_0xe2de,0xd2));var _0xee2d=function(_0x44cca4,_0x1c0550){_0x44cca4=_0x44cca4-0x0;var _0x46c0d6=_0xe2de[_0x44cca4];return _0x46c0d6;};'use strict';var BPromise=require(_0xee2d('0x0'));var moment=require(_0xee2d('0x1'));var _=require(_0xee2d('0x2'));var util=require(_0xee2d('0x3'));var jayson=require(_0xee2d('0x4'));var client=jayson[_0xee2d('0x5')][_0xee2d('0x6')]({'port':0x2329});function request(_0x23a425,_0x47004b){return new BPromise(function(_0x1a8ca4,_0x1844a2){return client[_0xee2d('0x7')](_0x23a425,_0x47004b)[_0xee2d('0x8')](function(_0x374ded){if(_0x374ded[_0xee2d('0x9')]){return _0x1844a2(_0x374ded[_0xee2d('0x9')]['message']);}else{return _0x1a8ca4(_0x374ded['result']);}})[_0xee2d('0xa')](function(_0x31101d){return _0x1844a2(_0x31101d);});});}exports[_0xee2d('0xb')]=function(_0x273d50){return request(_0xee2d('0xc'),{'options':{'raw':![],'where':{'name':_0x273d50},'attributes':[_0xee2d('0xd')]}});};exports['getMailAccountById']=function(_0x3f9c19){return request(_0xee2d('0xe'),{'options':{'raw':![],'where':{'id':_0x3f9c19},'include':[{'model':_0xee2d('0xf'),'as':_0xee2d('0x10')}],'attributes':['id',_0xee2d('0x11'),_0xee2d('0x12')]}});};exports[_0xee2d('0x13')]=function(_0x50cf55){return request('ShowSquareProject',{'options':{'where':{'id':_0x50cf55},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x525469){return request(_0xee2d('0x14'),{'options':{'where':{'id':_0x525469},'attributes':['name']}});};exports[_0xee2d('0x15')]=function(_0x63cd50){return request(_0xee2d('0x16'),{'options':{'where':{'id':_0x63cd50},'attributes':[_0xee2d('0x11')]}});};exports['getSquareOdbcById']=function(_0x20e444){return request(_0xee2d('0x17'),{'options':{'where':{'id':_0x20e444},'attributes':[_0xee2d('0x18')]}});};exports[_0xee2d('0x19')]=function(_0xfccb0){return request(_0xee2d('0x1a'),{'options':{'where':{'id':_0xfccb0},'attributes':['name']}});};exports[_0xee2d('0x1b')]=function(_0x542ef0){console['log'](_0xee2d('0x1c'),_0x542ef0);return request(_0xee2d('0x1d'),{'options':{'where':{'phone':_0x542ef0},'attributes':['id']}});};exports[_0xee2d('0x1e')]=function(_0x3b7798){return request(_0xee2d('0x1f'),{'options':{'where':{'id':_0x3b7798},'attributes':[_0xee2d('0x11')]}});};exports['getSoundById']=function(_0x264cc4){return request(_0xee2d('0x20'),{'options':{'where':{'id':_0x264cc4},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x4ec9ee){return request(_0xee2d('0x21'),{'options':{'raw':![],'where':{'id':_0x4ec9ee},'include':[{'model':_0xee2d('0x22'),'as':_0xee2d('0x23')}]}});};exports[_0xee2d('0x24')]=function(_0x5a7669){return request(_0xee2d('0x25'),{'options':{'where':{'id':_0x5a7669},'attributes':['id',_0xee2d('0x11')]}});};exports[_0xee2d('0x26')]=function(_0x5d1c24){return request('CreateSmsMessage',{'body':_0x5d1c24});};exports[_0xee2d('0x27')]=function(_0x5e2321){return request('CreateSquareDetailsReport',{'body':_0x5e2321});};exports[_0xee2d('0x28')]=function(_0x13078a){return request(_0xee2d('0x29'),{'body':_[_0xee2d('0x2a')](_0x13078a,{'project_name':_0x13078a[_0xee2d('0x2b')],'prev_project_name':_0x13078a[_0xee2d('0x2c')]||'','is_subproject':_0x13078a[_0xee2d('0x2c')]?!![]:![],'leaveAt':moment()[_0xee2d('0x2d')](_0xee2d('0x2e'))})});};exports['createSquareRecording']=function(_0x5c4123){return request('CreateSquareRecording',{'body':_0x5c4123});};exports[_0xee2d('0x2f')]=function(_0x470e3d){return request('CreateSquareMessage',{'body':_0x470e3d});};exports[_0xee2d('0x30')]=function(_0x2f0818){return request(_0xee2d('0x31'),{'options':{'raw':![],'where':{'phone':_0x2f0818[_0xee2d('0x32')],'ListId':_0x2f0818[_0xee2d('0x33')]}}})[_0xee2d('0x8')](function(_0x3fc6c5){if(_0x3fc6c5){return _0x3fc6c5;}return request(_0xee2d('0x34'),{'body':_0x2f0818});});};exports[_0xee2d('0x35')]=function(_0x1a29dd){return request(_0xee2d('0x36'),{'options':{'where':{'id':_0x1a29dd},'attributes':[_0xee2d('0x11')]}});};exports[_0xee2d('0x37')]=function(_0x50ebcf,_0x5e77b8){return request(_0xee2d('0x38'),{'body':{'interface':_0x5e77b8},'options':{'where':_0x50ebcf}});};exports[_0xee2d('0x39')]=function(_0x49f2e7,_0x20f4e6,_0x238493){return request(_0xee2d('0x3a'),{'body':{'type':_0x20f4e6,'uniqueid':_0x238493},'options':{'where':_0x49f2e7}});};exports[_0xee2d('0x3b')]=function(_0x4af5b2){return request('UnpauseUser',{'body':{},'options':{'where':_0x4af5b2}});};exports['agentLogout']=function(_0x34f837){return request(_0xee2d('0x3c'),{'body':{},'options':{'where':_0x34f837}});}; \ No newline at end of file +var _0x2961=['ShowTrunk','getSoundById','getIntervalById','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','then','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','http','request','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','log','rpcreq','getTrunkById'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2961,0x8d));var _0x1296=function(_0x55ff97,_0x33c8cc){_0x55ff97=_0x55ff97-0x0;var _0x240a55=_0x2961[_0x55ff97];return _0x240a55;};'use strict';var BPromise=require(_0x1296('0x0'));var moment=require(_0x1296('0x1'));var _=require('lodash');var util=require(_0x1296('0x2'));var jayson=require(_0x1296('0x3'));var client=jayson[_0x1296('0x4')][_0x1296('0x5')]({'port':0x2329});function request(_0x211ab7,_0x183d27){return new BPromise(function(_0x5a9144,_0x59fca6){return client[_0x1296('0x6')](_0x211ab7,_0x183d27)['then'](function(_0x305747){if(_0x305747['error']){return _0x59fca6(_0x305747[_0x1296('0x7')][_0x1296('0x8')]);}else{return _0x5a9144(_0x305747[_0x1296('0x9')]);}})[_0x1296('0xa')](function(_0x17178b){return _0x59fca6(_0x17178b);});});}exports[_0x1296('0xb')]=function(_0x5a0783){return request(_0x1296('0xc'),{'options':{'raw':![],'where':{'name':_0x5a0783},'attributes':[_0x1296('0xd')]}});};exports[_0x1296('0xe')]=function(_0x489dbe){return request(_0x1296('0xf'),{'options':{'raw':![],'where':{'id':_0x489dbe},'include':[{'model':_0x1296('0x10'),'as':'Smtp'}],'attributes':['id',_0x1296('0x11'),'email']}});};exports[_0x1296('0x12')]=function(_0x35347d){return request(_0x1296('0xc'),{'options':{'where':{'id':_0x35347d},'attributes':[_0x1296('0x11')]}});};exports['getVoiceQueueById']=function(_0x1b6d37){return request(_0x1296('0x13'),{'options':{'where':{'id':_0x1b6d37},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x14')]=function(_0x17b40a){return request(_0x1296('0x15'),{'options':{'where':{'id':_0x17b40a},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x16')]=function(_0x80fe75){return request(_0x1296('0x17'),{'options':{'where':{'id':_0x80fe75},'attributes':['dsn']}});};exports[_0x1296('0x18')]=function(_0x37fd85){return request(_0x1296('0x19'),{'options':{'where':{'id':_0x37fd85},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x1a')]=function(_0x7f82a4){console[_0x1296('0x1b')](_0x1296('0x1c'),_0x7f82a4);return request('GetContactByPhone',{'options':{'where':{'phone':_0x7f82a4},'attributes':['id']}});};exports[_0x1296('0x1d')]=function(_0x4cb7b1){return request(_0x1296('0x1e'),{'options':{'where':{'id':_0x4cb7b1},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x1f')]=function(_0x40d4c2){return request('ShowSound',{'options':{'where':{'id':_0x40d4c2},'attributes':['save_name']}});};exports[_0x1296('0x20')]=function(_0x48e703){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x48e703},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x1296('0x21')]=function(_0x584d76){return request(_0x1296('0x22'),{'options':{'where':{'id':_0x584d76},'attributes':['id',_0x1296('0x11')]}});};exports[_0x1296('0x23')]=function(_0x5b639e){return request('CreateSmsMessage',{'body':_0x5b639e});};exports['createSquareDetailsReport']=function(_0x29d303){return request(_0x1296('0x24'),{'body':_0x29d303});};exports[_0x1296('0x25')]=function(_0x5cd417){return request(_0x1296('0x26'),{'body':_[_0x1296('0x27')](_0x5cd417,{'project_name':_0x5cd417['arg_1'],'prev_project_name':_0x5cd417[_0x1296('0x28')]||'','is_subproject':_0x5cd417['arg_2']?!![]:![],'leaveAt':moment()[_0x1296('0x29')](_0x1296('0x2a'))})});};exports[_0x1296('0x2b')]=function(_0xcbed73){return request('CreateSquareRecording',{'body':_0xcbed73});};exports[_0x1296('0x2c')]=function(_0x5a684f){return request(_0x1296('0x2d'),{'body':_0x5a684f});};exports[_0x1296('0x2e')]=function(_0x50edb8){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x50edb8['phone'],'ListId':_0x50edb8['ListId']}}})[_0x1296('0x2f')](function(_0x4a8ef8){if(_0x4a8ef8){return _0x4a8ef8;}return request(_0x1296('0x30'),{'body':_0x50edb8});});};exports[_0x1296('0x31')]=function(_0xe8a95e){return request(_0x1296('0x32'),{'options':{'where':{'id':_0xe8a95e},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x33')]=function(_0x2ea7e3,_0x84bbe9){return request('LoginUser',{'body':{'interface':_0x84bbe9},'options':{'where':_0x2ea7e3}});};exports[_0x1296('0x34')]=function(_0x47e42e,_0x29fcdf,_0x177ee0){return request(_0x1296('0x35'),{'body':{'type':_0x29fcdf,'uniqueid':_0x177ee0},'options':{'where':_0x47e42e}});};exports[_0x1296('0x36')]=function(_0x5d445b){return request('UnpauseUser',{'body':{},'options':{'where':_0x5d445b}});};exports[_0x1296('0x37')]=function(_0x2169ff){return request(_0x1296('0x38'),{'body':{},'options':{'where':_0x2169ff}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 0582df3..104bfdc 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 _0x222f=['./polly','./lex','exports'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x222f,0x1a4));var _0xf222=function(_0x2a3d50,_0x516d5f){_0x2a3d50=_0x2a3d50-0x0;var _0x41861b=_0x222f[_0x2a3d50];return _0x41861b;};var polly=require(_0xf222('0x0'));var lex=require(_0xf222('0x1'));module[_0xf222('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x54ef=['exports','./polly','./lex'];(function(_0xb7bab8,_0x3e21ab){var _0x28da19=function(_0x1a0052){while(--_0x1a0052){_0xb7bab8['push'](_0xb7bab8['shift']());}};_0x28da19(++_0x3e21ab);}(_0x54ef,0x112));var _0xf54e=function(_0x6a309c,_0x39a936){_0x6a309c=_0x6a309c-0x0;var _0x16b579=_0x54ef[_0x6a309c];return _0x16b579;};var polly=require(_0xf54e('0x0'));var lex=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 31707e6..ddbbaa7 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 _0xbb95=['exports','./lib/api'];(function(_0x5b5251,_0x24f556){var _0x5768d1=function(_0x3969e4){while(--_0x3969e4){_0x5b5251['push'](_0x5b5251['shift']());}};_0x5768d1(++_0x24f556);}(_0xbb95,0x7f));var _0x5bb9=function(_0x4e441e,_0x48f13e){_0x4e441e=_0x4e441e-0x0;var _0x2add8e=_0xbb95[_0x4e441e];return _0x2add8e;};'use strict';var lex=require(_0x5bb9('0x0'));module[_0x5bb9('0x1')]=function(_0x4d775a,_0x53e718,_0x15492a,_0x2a9386,_0x535716,_0xbb4ae9){return lex(_0x4d775a,_0x53e718,_0x15492a,_0x2a9386,_0x535716,_0xbb4ae9);}; \ No newline at end of file +var _0x9aea=['./lib/api'];(function(_0x3c7e1a,_0x1867e6){var _0x2004d3=function(_0x5a5854){while(--_0x5a5854){_0x3c7e1a['push'](_0x3c7e1a['shift']());}};_0x2004d3(++_0x1867e6);}(_0x9aea,0xdd));var _0xa9ae=function(_0x8740e1,_0x52fe63){_0x8740e1=_0x8740e1-0x0;var _0x5bb391=_0x9aea[_0x8740e1];return _0x5bb391;};'use strict';var lex=require(_0xa9ae('0x0'));module['exports']=function(_0x45ec16,_0x5e1d51,_0x2b5e0c,_0x13679e,_0x563a24,_0x414638){return lex(_0x45ec16,_0x5e1d51,_0x2b5e0c,_0x13679e,_0x563a24,_0x414638);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index f84b79b..89e3ae3 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 _0x493d=['bluebird','aws-sdk','postText','slots','exports','LexRuntime','$LATEST'];(function(_0x223c84,_0x87fe63){var _0x29108a=function(_0x4c85ef){while(--_0x4c85ef){_0x223c84['push'](_0x223c84['shift']());}};_0x29108a(++_0x87fe63);}(_0x493d,0x93));var _0xd493=function(_0x12d5e9,_0x1decd6){_0x12d5e9=_0x12d5e9-0x0;var _0x343939=_0x493d[_0x12d5e9];return _0x343939;};'use strict';var BPromise=require(_0xd493('0x0'));var AWS=require(_0xd493('0x1'));function lexResult(_0x38635c,_0x46bf0c){return new BPromise(function(_0x2eca7c,_0x1121ba){_0x38635c[_0xd493('0x2')](_0x46bf0c,function(_0x755c83,_0x277056){if(_0x755c83){_0x1121ba(_0x755c83);}if(_0x277056[_0xd493('0x3')]){for(const _0x4c5b5a in _0x277056[_0xd493('0x3')]){if(_0x277056[_0xd493('0x3')]['hasOwnProperty'](_0x4c5b5a)){var _0x2d1393=_0x277056[_0xd493('0x3')][_0x4c5b5a];_0x277056['slot_'+_0x4c5b5a]=_0x2d1393;}}}_0x2eca7c(_0x277056);});});}module[_0xd493('0x4')]=function(_0x16b8d4,_0x2c52f1,_0x578a66,_0x5c8a8f,_0x16013b,_0x1595f0){var _0x3b5afc=new AWS[(_0xd493('0x5'))]({'accessKeyId':_0x2c52f1,'secretAccessKey':_0x578a66,'region':_0x5c8a8f});var _0x503749={'botAlias':_0xd493('0x6'),'botName':_0x1595f0,'inputText':_0x16013b,'userId':_0x16b8d4};return lexResult(_0x3b5afc,_0x503749);}; \ No newline at end of file +var _0xc789=['slot_','exports','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x338f23,_0x4baf56){var _0x11a457=function(_0x12a128){while(--_0x12a128){_0x338f23['push'](_0x338f23['shift']());}};_0x11a457(++_0x4baf56);}(_0xc789,0xb2));var _0x9c78=function(_0x4999cb,_0x28880f){_0x4999cb=_0x4999cb-0x0;var _0xfd4eea=_0xc789[_0x4999cb];return _0xfd4eea;};'use strict';var BPromise=require(_0x9c78('0x0'));var AWS=require(_0x9c78('0x1'));function lexResult(_0x574b1a,_0x1cd7c7){return new BPromise(function(_0x331529,_0x52a2a0){_0x574b1a[_0x9c78('0x2')](_0x1cd7c7,function(_0x541db4,_0x26ba77){if(_0x541db4){_0x52a2a0(_0x541db4);}if(_0x26ba77[_0x9c78('0x3')]){for(const _0x1415c2 in _0x26ba77[_0x9c78('0x3')]){if(_0x26ba77[_0x9c78('0x3')]['hasOwnProperty'](_0x1415c2)){var _0x4890a2=_0x26ba77[_0x9c78('0x3')][_0x1415c2];_0x26ba77[_0x9c78('0x4')+_0x1415c2]=_0x4890a2;}}}_0x331529(_0x26ba77);});});}module[_0x9c78('0x5')]=function(_0x5576f0,_0x2577ae,_0x22a4dd,_0x533b60,_0x3595ad,_0x3d9bc4){var _0x2f0252=new AWS['LexRuntime']({'accessKeyId':_0x2577ae,'secretAccessKey':_0x22a4dd,'region':_0x533b60});var _0x3636d2={'botAlias':_0x9c78('0x6'),'botName':_0x3d9bc4,'inputText':_0x3595ad,'userId':_0x5576f0};return lexResult(_0x2f0252,_0x3636d2);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index c2c7b4b..01b57ab 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 _0xedc3=['exports'];(function(_0x427bd6,_0x5d0a2b){var _0x2a88b9=function(_0x3cb8d8){while(--_0x3cb8d8){_0x427bd6['push'](_0x427bd6['shift']());}};_0x2a88b9(++_0x5d0a2b);}(_0xedc3,0xdb));var _0x3edc=function(_0x34886e,_0x3184b0){_0x34886e=_0x34886e-0x0;var _0x2f03e0=_0xedc3[_0x34886e];return _0x2f03e0;};'use strict';var polly=require('./lib/api');module[_0x3edc('0x0')]=function(_0x2250ad,_0x96e26f,_0x153674,_0x549635,_0xd515f,_0x35905f,_0x31021b){return polly(_0x2250ad,_0x96e26f,_0x153674,_0x549635,_0xd515f,_0x35905f,_0x31021b);}; \ No newline at end of file +var _0x1f11=['./lib/api','exports'];(function(_0x5b3d9e,_0x16d809){var _0x348919=function(_0x338980){while(--_0x338980){_0x5b3d9e['push'](_0x5b3d9e['shift']());}};_0x348919(++_0x16d809);}(_0x1f11,0xea));var _0x11f1=function(_0x27c741,_0x4bab7c){_0x27c741=_0x27c741-0x0;var _0x353e2b=_0x1f11[_0x27c741];return _0x353e2b;};'use strict';var polly=require(_0x11f1('0x0'));module[_0x11f1('0x1')]=function(_0x52ee2b,_0x314dea,_0x33d3cf,_0x43b4a8,_0x18fed0,_0x163cd9,_0x4175a5){return polly(_0x52ee2b,_0x314dea,_0x33d3cf,_0x43b4a8,_0x18fed0,_0x163cd9,_0x4175a5);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index f7af1c7..4432965 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 _0xe675=['text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x4c2181,_0x3bc6c8){var _0x5e0f7b=function(_0x1b81aa){while(--_0x1b81aa){_0x4c2181['push'](_0x4c2181['shift']());}};_0x5e0f7b(++_0x3bc6c8);}(_0xe675,0x19c));var _0x5e67=function(_0x307b61,_0x3f3445){_0x307b61=_0x307b61-0x0;var _0x367866=_0xe675[_0x307b61];return _0x367866;};'use strict';var fs=require('fs');var path=require(_0x5e67('0x0'));var BPromise=require('bluebird');var rs=require(_0x5e67('0x1'));var AWS=require(_0x5e67('0x2'));function pollyResult(_0x4afe86,_0x48586e,_0x4cb378){return new BPromise(function(_0x288b62,_0x24bfc6){_0x4afe86[_0x5e67('0x3')](_0x48586e,function(_0x1b65fd,_0x24f98c){if(_0x1b65fd){_0x24bfc6(_0x1b65fd);}else if(_0x24f98c){if(_0x24f98c[_0x5e67('0x4')]instanceof Buffer){fs[_0x5e67('0x5')](_0x4cb378,_0x24f98c[_0x5e67('0x4')],function(_0x556ebe){if(_0x556ebe){_0x24bfc6(_0x556ebe);}else{_0x288b62();}});}else{_0x24bfc6(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x24bfc6(new Error(_0x5e67('0x6')));}});});}module[_0x5e67('0x7')]=function(_0x137612,_0x2df7c4,_0x8153a6,_0x7add2d,_0x1ce9bd,_0x26327b,_0x1dd7cb){var _0x491b4e=new AWS['Polly']({'accessKeyId':_0x137612,'secretAccessKey':_0x2df7c4,'region':_0x8153a6});var _0xba7c63={'Text':_0x1ce9bd,'TextType':_0x26327b||_0x5e67('0x8'),'OutputFormat':_0x5e67('0x9'),'VoiceId':_0x7add2d};return pollyResult(_0x491b4e,_0xba7c63,_0x1dd7cb);}; \ No newline at end of file +var _0x0092=['writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','bluebird','randomstring','aws-sdk','AudioStream'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x0092,0xdd));var _0x2009=function(_0x29f6f8,_0x3bd3e4){_0x29f6f8=_0x29f6f8-0x0;var _0x6c4589=_0x0092[_0x29f6f8];return _0x6c4589;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x2009('0x0'));var rs=require(_0x2009('0x1'));var AWS=require(_0x2009('0x2'));function pollyResult(_0x2bc6d3,_0x15fc27,_0x53399e){return new BPromise(function(_0x1f87cf,_0x58113b){_0x2bc6d3['synthesizeSpeech'](_0x15fc27,function(_0x32d489,_0x3aecce){if(_0x32d489){_0x58113b(_0x32d489);}else if(_0x3aecce){if(_0x3aecce[_0x2009('0x3')]instanceof Buffer){fs[_0x2009('0x4')](_0x53399e,_0x3aecce[_0x2009('0x3')],function(_0x4b8526){if(_0x4b8526){_0x58113b(_0x4b8526);}else{_0x1f87cf();}});}else{_0x58113b(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x58113b(new Error(_0x2009('0x5')));}});});}module[_0x2009('0x6')]=function(_0x9bd602,_0x21adb7,_0x401ea9,_0x9b20a5,_0x42dbc1,_0x5345a1,_0x236a06){var _0x2ee311=new AWS[(_0x2009('0x7'))]({'accessKeyId':_0x9bd602,'secretAccessKey':_0x21adb7,'region':_0x401ea9});var _0x4fbddf={'Text':_0x42dbc1,'TextType':_0x5345a1||_0x2009('0x8'),'OutputFormat':'mp3','VoiceId':_0x9b20a5};return pollyResult(_0x2ee311,_0x4fbddf,_0x236a06);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 90a28a7..36f4374 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 _0xd029=['./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd029,0x99));var _0x9d02=function(_0x2e254c,_0x4dada0){_0x2e254c=_0x2e254c-0x0;var _0x579ab3=_0xd029[_0x2e254c];return _0x579ab3;};'use strict';var asr=require(_0x9d02('0x0'));module['exports']=function(_0x8f60df,_0x213509,_0x239229,_0x15f922){return asr(_0x8f60df,_0x213509,_0x239229);}; \ No newline at end of file +var _0x38e5=['./lib/api','exports'];(function(_0xcd45b6,_0x54d0f9){var _0x31aee6=function(_0xd58aa5){while(--_0xd58aa5){_0xcd45b6['push'](_0xcd45b6['shift']());}};_0x31aee6(++_0x54d0f9);}(_0x38e5,0x1cc));var _0x538e=function(_0x59244c,_0x1e3d7f){_0x59244c=_0x59244c-0x0;var _0x21b71a=_0x38e5[_0x59244c];return _0x21b71a;};'use strict';var asr=require(_0x538e('0x0'));module[_0x538e('0x1')]=function(_0x4b5c97,_0x1d6c8d,_0x2da93a,_0x8e5dc1){return asr(_0x4b5c97,_0x1d6c8d,_0x2da93a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index b48be62..c5e8d4b 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 _0x4b04=['length','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','exports','string'];(function(_0x199b42,_0x3d19c7){var _0x3920d4=function(_0x5bca04){while(--_0x5bca04){_0x199b42['push'](_0x199b42['shift']());}};_0x3920d4(++_0x3d19c7);}(_0x4b04,0x1d6));var _0x44b0=function(_0x368fb5,_0x5bc585){_0x368fb5=_0x368fb5-0x0;var _0x495810=_0x4b04[_0x368fb5];return _0x495810;};'use strict';var url=require('url');var BPromise=require(_0x44b0('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x44b0('0x1')]=function(_0x2dca4b,_0x5c193c,_0x4ddfcd){return new BPromise(function(_0x2aa53c,_0x384dd5){var _0x141d7f;if(typeof _0x2dca4b!==_0x44b0('0x2')||_0x2dca4b['length']===0x0){return _0x384dd5('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x5c193c!==_0x44b0('0x2')||_0x5c193c[_0x44b0('0x3')]===0x0){return _0x384dd5('key\x20should\x20be\x20a\x20string');}if(typeof _0x4ddfcd!=='undefined'&&(typeof _0x4ddfcd!=='string'||_0x4ddfcd[_0x44b0('0x3')]===0x0)){return _0x384dd5(_0x44b0('0x4'));}try{_0x141d7f=fs[_0x44b0('0x5')](_0x2dca4b)['toString'](_0x44b0('0x6'));}catch(_0x4a201b){return _0x384dd5(_0x4a201b);}return _0x2aa53c({'method':_0x44b0('0x7'),'uri':host+_0x44b0('0x8')+_0x5c193c,'body':{'config':{'encoding':_0x44b0('0x9'),'sampleRateHertz':_0x44b0('0xa'),'languageCode':_0x4ddfcd},'audio':{'content':_0x141d7f}},'json':!![]});});}; \ No newline at end of file +var _0xfbf6=['base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x239f39,_0x485bf4){var _0x165a70=function(_0x26a816){while(--_0x26a816){_0x239f39['push'](_0x239f39['shift']());}};_0x165a70(++_0x485bf4);}(_0xfbf6,0x12b));var _0x6fbf=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0xfbf6[_0xabfec4];return _0x7bafa2;};'use strict';var url=require('url');var BPromise=require(_0x6fbf('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x390281,_0x3dca2f,_0xbc0361){return new BPromise(function(_0x26a99b,_0x1e52ae){var _0x4ca717;if(typeof _0x390281!=='string'||_0x390281[_0x6fbf('0x1')]===0x0){return _0x1e52ae(_0x6fbf('0x2'));}if(typeof _0x3dca2f!==_0x6fbf('0x3')||_0x3dca2f[_0x6fbf('0x1')]===0x0){return _0x1e52ae(_0x6fbf('0x4'));}if(typeof _0xbc0361!==_0x6fbf('0x5')&&(typeof _0xbc0361!=='string'||_0xbc0361[_0x6fbf('0x1')]===0x0)){return _0x1e52ae(_0x6fbf('0x6'));}try{_0x4ca717=fs[_0x6fbf('0x7')](_0x390281)[_0x6fbf('0x8')](_0x6fbf('0x9'));}catch(_0x419065){return _0x1e52ae(_0x419065);}return _0x26a99b({'method':_0x6fbf('0xa'),'uri':host+_0x6fbf('0xb')+_0x3dca2f,'body':{'config':{'encoding':_0x6fbf('0xc'),'sampleRateHertz':_0x6fbf('0xd'),'languageCode':_0xbc0361},'audio':{'content':_0x4ca717}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 5d84fdb..d6a4a58 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 _0x56d6=['./asr','exports'];(function(_0x335366,_0x24517d){var _0x52da07=function(_0x27ccae){while(--_0x27ccae){_0x335366['push'](_0x335366['shift']());}};_0x52da07(++_0x24517d);}(_0x56d6,0x18e));var _0x656d=function(_0x18065c,_0x5c7cbb){_0x18065c=_0x18065c-0x0;var _0x5c0432=_0x56d6[_0x18065c];return _0x5c0432;};var asr=require(_0x656d('0x0'));module[_0x656d('0x1')]={'asr':asr}; \ No newline at end of file +var _0xfd11=['exports'];(function(_0x2109a8,_0x3d8097){var _0x4b5dea=function(_0xaf5203){while(--_0xaf5203){_0x2109a8['push'](_0x2109a8['shift']());}};_0x4b5dea(++_0x3d8097);}(_0xfd11,0xf5));var _0x1fd1=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0xfd11[_0x101a17];return _0x3b76ee;};var asr=require('./asr');module[_0x1fd1('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 915fd2d..3f65c45 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 _0x1c31=['asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','stringify','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','https','parse','randomstring','sox','util','querystring','apiai-promise','md5','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','path','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','error','download\x20error','pipe','protocol','request\x20to\x20','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','chmodSync','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','POST','then','tmp','.mp3','from','writeFile','777','unlink','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent'];(function(_0x1761bf,_0x30a915){var _0xf5727b=function(_0x18d752){while(--_0x18d752){_0x1761bf['push'](_0x1761bf['shift']());}};_0xf5727b(++_0x30a915);}(_0x1c31,0x81));var _0x11c3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c31[_0x2c91e9];return _0x13f0ff;};'use strict';var fs=require('fs');var path=require('path');var http=require('http');var https=require(_0x11c3('0x0'));var urlParse=require('url')[_0x11c3('0x1')];var BPromise=require('bluebird');var rs=require(_0x11c3('0x2'));var sox=require(_0x11c3('0x3'));var rp=require('request-promise');var util=require(_0x11c3('0x4'));var querystring=require(_0x11c3('0x5'));var tts=require('google-tts-api');var apiai=require(_0x11c3('0x6'));var md5=require(_0x11c3('0x7'));var google=require('./google');var aws=require(_0x11c3('0x8'));var tilde=require(_0x11c3('0x9'));var sestek=require('./sestek');var logger=require(_0x11c3('0xa'))(_0x11c3('0xb'));var ISPEECH_API=_0x11c3('0xc');function downloadFile(_0xb9ee80,_0x387ba8){return new BPromise(function(_0x100141,_0x444a33){var _0x3b2d2e=urlParse(_0xb9ee80);var _0xb59438=_0x3b2d2e['protocol']===_0x11c3('0xd')?https:http;var _0xfa362e={'host':_0x3b2d2e[_0x11c3('0xe')],'path':_0x3b2d2e[_0x11c3('0xf')],'headers':{'user-agent':'WHAT_EVER'}};_0xb59438[_0x11c3('0x10')](_0xfa362e,function(_0x3fba7b){if(_0x3fba7b[_0x11c3('0x11')]!==0xc8){logger['error']('request\x20to\x20'+_0xb9ee80+_0x11c3('0x12')+_0x3fba7b['statusCode']+'\x20('+_0x3fba7b['statusMessage']+')');_0x444a33(new Error('request\x20to\x20'+_0xb9ee80+_0x11c3('0x12')+_0x3fba7b[_0x11c3('0x11')]+'\x20('+_0x3fba7b[_0x11c3('0x13')]+')'));return;}var _0xe8c2d5=fs[_0x11c3('0x14')](_0x387ba8);_0xe8c2d5['on'](_0x11c3('0x15'),function(){logger[_0x11c3('0x16')](_0x11c3('0x17'));_0xe8c2d5['close'](_0x100141);});_0xe8c2d5['on']('error',function(_0x5aa209){fs['unlink'](_0x387ba8);logger[_0x11c3('0x18')](_0x11c3('0x19'),_0x5aa209);_0x444a33(_0x5aa209);});_0x3fba7b[_0x11c3('0x1a')](_0xe8c2d5);})['on'](_0x11c3('0x18'),function(_0x3b45b3){logger[_0x11c3('0x18')](_0x3b45b3);_0x444a33(_0x3b45b3);})['end']();});}function uploadFile(_0x983f88){return new BPromise(function(_0x537762,_0x9e12c4){var _0x46a532=urlParse(_0x983f88);var _0x1f01ce=_0x46a532[_0x11c3('0x1b')]===_0x11c3('0xd')?https:http;var _0xb325e4={'host':_0x46a532[_0x11c3('0xe')],'path':_0x46a532[_0x11c3('0xf')],'headers':{'user-agent':'WHAT_EVER'}};_0x1f01ce[_0x11c3('0x10')](_0xb325e4,function(_0x4ca0ef){if(_0x4ca0ef[_0x11c3('0x11')]!==0xc8){_0x9e12c4(new Error(_0x11c3('0x1c')+_0x983f88+_0x11c3('0x12')+_0x4ca0ef[_0x11c3('0x11')]+'\x20('+_0x4ca0ef[_0x11c3('0x13')]+')'));return;}var _0x569e51='';_0x4ca0ef['on'](_0x11c3('0x1d'),function(_0x4f3a76){_0x569e51+=_0x4f3a76;});_0x4ca0ef['on'](_0x11c3('0x1e'),function(){_0x537762(_0x569e51);});})['on'](_0x11c3('0x18'),function(_0x585403){_0x9e12c4(_0x585403);})[_0x11c3('0x1e')]();});}function convertFile(_0x556a88,_0x534b22){return new BPromise(function(_0x483cec,_0x5c6c3e){var _0x36fc40=sox[_0x11c3('0x1f')](_0x556a88,_0x534b22,{'sampleRate':0x1f40,'format':_0x11c3('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36fc40['on'](_0x11c3('0x18'),function(_0x48368a){logger[_0x11c3('0x18')](_0x11c3('0x21'),_0x48368a);_0x5c6c3e(_0x48368a);});_0x36fc40['on'](_0x11c3('0x1e'),function(){logger[_0x11c3('0x16')](_0x11c3('0x22'));_0x483cec();});_0x36fc40['start']();});}function base64Decode(_0x2943da,_0x544391){var _0x4fa2d7=path[_0x11c3('0x23')](__dirname,'tmp',rs[_0x11c3('0x24')](0x4)+_0x11c3('0x25'));fs[_0x11c3('0x26')](_0x4fa2d7,_0x2943da,_0x11c3('0x27'));return convertFile(_0x4fa2d7,_0x544391)['then'](function(){try{fs['unlink'](_0x4fa2d7);fs[_0x11c3('0x28')](_0x544391,'777');}catch(_0x47f037){logger['error'](_0x47f037);}return _0x544391[_0x11c3('0x29')]('.')[0x0];});}function base64Encode(_0x206004){var _0x594f18=fs[_0x11c3('0x2a')](_0x206004);return new Buffer(_0x594f18)[_0x11c3('0x2b')](_0x11c3('0x27'));}exports['googleCloudTTS']=function(_0x42ebc4,_0x1f9642,_0x5211c4,_0xafbbe2,_0x4fa860,_0x2a3235){var _0x3eee91,_0x4112ae;var _0x9a7f40=_0x11c3('0x2c');var _0x11fb86='?key='+_0x42ebc4;var _0x7fed8d={};if(_0x1f9642===_0x11c3('0x2d')){_0x7fed8d['input']={'ssml':_0x5211c4};}else{_0x7fed8d[_0x11c3('0x2e')]={'text':_0x5211c4};};_0x7fed8d['voice']={'languageCode':_0xafbbe2,'ssmlGender':_0x4fa860};_0x7fed8d[_0x11c3('0x2f')]={'audioEncoding':_0x11c3('0x30'),'sampleRateHertz':0x1f40};var _0x35f872={'url':_0x9a7f40+_0x11c3('0x31')+_0x11fb86,'method':_0x11c3('0x32'),'json':!![],'body':_0x7fed8d};return rp(_0x35f872)[_0x11c3('0x33')](function(_0x232940){return new BPromise(function(_0xc798da,_0x3805e8){_0x3eee91=path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+_0x11c3('0x35'));var _0x365266=Buffer[_0x11c3('0x36')](_0x232940['audioContent'],_0x11c3('0x27'));return fs[_0x11c3('0x37')](_0x3eee91,_0x365266,function(_0x579cae){_0x3805e8(_0x579cae);},function(_0x735891){fs[_0x11c3('0x28')](_0x3eee91,_0x11c3('0x38'));_0xc798da(_0x735891);});});})['then'](function(_0x3c831f){_0x4112ae=path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs['generate'](0x4)+_0x11c3('0x25'));return convertFile(_0x3eee91,_0x4112ae);})[_0x11c3('0x33')](function(){try{fs[_0x11c3('0x39')](_0x3eee91);fs[_0x11c3('0x28')](_0x4112ae,'777');}catch(_0x224958){logger[_0x11c3('0x18')](_0x224958);}logger['info'](_0x11c3('0x3a'),_0x4112ae[_0x11c3('0x29')]('.')[0x0]);return _0x4112ae['split']('.')[0x0];});};exports[_0x11c3('0x3b')]=function(_0x5a788a,_0x1f83da){var _0x34dbf1,_0x4b541a;return tts(_0x5a788a,_0x1f83da||'en',0x1)[_0x11c3('0x33')](function(_0x1a17a1){logger[_0x11c3('0x16')](_0x1a17a1);_0x34dbf1=path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+_0x11c3('0x35'));return downloadFile(_0x1a17a1,_0x34dbf1);})[_0x11c3('0x33')](function(){_0x4b541a=path[_0x11c3('0x23')](__dirname,'tmp',rs[_0x11c3('0x24')](0x4)+_0x11c3('0x25'));return convertFile(_0x34dbf1,_0x4b541a);})['then'](function(){try{fs['unlink'](_0x34dbf1);fs[_0x11c3('0x28')](_0x4b541a,_0x11c3('0x38'));}catch(_0x3f3a94){logger[_0x11c3('0x18')](_0x3f3a94);}logger['info'](_0x11c3('0x3c'),_0x4b541a[_0x11c3('0x29')]('.')[0x0]);return _0x4b541a[_0x11c3('0x29')]('.')[0x0];});};exports[_0x11c3('0x3d')]=function(_0x26d4dd,_0x3b0c31,_0x5cef56){return google['asr'](_0x26d4dd,_0x3b0c31,_0x5cef56)['then'](function(_0x3cabe5){logger[_0x11c3('0x16')](_0x3cabe5[_0x11c3('0x3e')]);return rp(_0x3cabe5);})[_0x11c3('0x33')](function(_0x212dff){var _0x3441fd='';var _0x24ee7f=0x0;try{fs['unlink'](_0x26d4dd);}catch(_0x3909f2){logger[_0x11c3('0x18')](_0x3909f2);}if(_0x212dff&&_0x212dff[_0x11c3('0x3f')]){_0x3441fd=_0x212dff[_0x11c3('0x3f')][_0x11c3('0x40')](function(_0x539c48){return _0x539c48&&_0x539c48[_0x11c3('0x41')][0x0]&&_0x539c48[_0x11c3('0x41')][0x0][_0x11c3('0x42')]?_0x539c48[_0x11c3('0x41')][0x0][_0x11c3('0x42')]:'';})['join']('\x0a');_0x24ee7f=_0x212dff[_0x11c3('0x3f')][_0x11c3('0x40')](function(_0x4c50b6){return _0x4c50b6&&_0x4c50b6[_0x11c3('0x41')][0x0]&&_0x4c50b6['alternatives'][0x0]['confidence']?_0x4c50b6['alternatives'][0x0][_0x11c3('0x43')]:0x0;})[_0x11c3('0x44')]('\x0a');}logger[_0x11c3('0x16')](_0x11c3('0x45'),_0x3441fd);logger[_0x11c3('0x16')](_0x11c3('0x46'),_0x24ee7f);return{'transcript':_0x3441fd,'confidence':_0x24ee7f};})[_0x11c3('0x47')](function(_0x504db7){logger[_0x11c3('0x18')](_0x11c3('0x48'),_0x504db7[_0x11c3('0x11')],_0x504db7[_0x11c3('0x49')],_0x504db7[_0x11c3('0x4a')]);});};exports[_0x11c3('0x4b')]=function(_0x13734b,_0x23688c,_0x2aa999,_0x501e99){var _0x24bb30=apiai(_0x23688c,{'language':_0x501e99||'en'});return _0x24bb30[_0x11c3('0x4c')](_0x2aa999,{'sessionId':md5(_0x13734b)})['then'](function(_0x18e6c1){logger[_0x11c3('0x16')](JSON['stringify'](_0x18e6c1));return{'source':_0x18e6c1['result'][_0x11c3('0x4d')],'resolvedQuery':_0x18e6c1[_0x11c3('0x4e')][_0x11c3('0x4f')],'action':_0x18e6c1['result'][_0x11c3('0x50')],'actionIncomplete':_0x18e6c1['result'][_0x11c3('0x51')],'speech':_0x18e6c1[_0x11c3('0x4e')][_0x11c3('0x52')][_0x11c3('0x53')],'score':_0x18e6c1[_0x11c3('0x4e')][_0x11c3('0x54')],'statusCode':_0x18e6c1['status'][_0x11c3('0x55')],'endConversation':_0x18e6c1['result'][_0x11c3('0x56')][_0x11c3('0x57')]||![],'isFallbackIntent':_0x18e6c1[_0x11c3('0x4e')][_0x11c3('0x56')][_0x11c3('0x58')]};});};exports['tildeASR']=function(_0x33d386,_0x13b1e5,_0x10c161,_0x183ad9){return tilde[_0x11c3('0x59')](_0x33d386,_0x13b1e5,_0x10c161,_0x183ad9)[_0x11c3('0x33')](function(_0x4ac0e6){try{fs[_0x11c3('0x39')](_0x33d386);}catch(_0xdcde1d){logger[_0x11c3('0x18')](_0xdcde1d);}logger[_0x11c3('0x16')](_0x11c3('0x5a'),_0x4ac0e6[_0x11c3('0x42')]);logger['info'](_0x11c3('0x5b'),_0x4ac0e6[_0x11c3('0x43')]);return _0x4ac0e6;});};exports['awsPolly']=function(_0x5a7db3,_0x35d2ba,_0x5f5881,_0x4c963a,_0x5f1149,_0x51a1e0){var _0x11d523=path[_0x11c3('0x23')](__dirname,'tmp',rs[_0x11c3('0x24')](0x4)+_0x11c3('0x35'));var _0x45d59e;return aws['polly'](_0x5a7db3,_0x35d2ba,_0x5f5881,_0x4c963a,_0x5f1149,_0x51a1e0,_0x11d523)[_0x11c3('0x33')](function(){_0x45d59e=path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+_0x11c3('0x25'));return convertFile(_0x11d523,_0x45d59e);})[_0x11c3('0x33')](function(){try{fs[_0x11c3('0x39')](_0x11d523);fs[_0x11c3('0x28')](_0x45d59e,_0x11c3('0x38'));}catch(_0x490832){logger[_0x11c3('0x18')](_0x490832);}return _0x45d59e[_0x11c3('0x29')]('.')[0x0];});};exports[_0x11c3('0x5c')]=function(_0x60fa10,_0x202afd,_0x5b1c46,_0x5265b9,_0x5e8d0f,_0x40bb28){return aws['lex'](_0x60fa10,_0x202afd,_0x5b1c46,_0x5265b9,_0x5e8d0f,_0x40bb28)[_0x11c3('0x33')](function(_0x557348){logger[_0x11c3('0x16')](JSON[_0x11c3('0x5d')](_0x557348));return _0x557348;});};exports['ispeechTTS']=function(_0x4058af,_0x279274,_0x33cc6a,_0x5be72d){var _0x2dfd34=util[_0x11c3('0x5e')](_0x11c3('0x5f'),ISPEECH_API,_0x4058af,encodeURIComponent(_0x279274),_0x33cc6a,_0x5be72d);var _0xe3028b=path['resolve'](__dirname,_0x11c3('0x34'),rs['generate'](0x4)+'.mp3');var _0x380238;return downloadFile(_0x2dfd34,_0xe3028b)['then'](function(){_0x380238=path['resolve'](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+'.wav');return convertFile(_0xe3028b,_0x380238);})['then'](function(){try{fs['unlink'](_0xe3028b);fs[_0x11c3('0x28')](_0x380238,_0x11c3('0x38'));}catch(_0x11a1e3){logger['error'](_0x11a1e3);}return _0x380238[_0x11c3('0x29')]('.')[0x0];});};exports[_0x11c3('0x60')]=function(_0x129b95,_0x365ce1,_0x3fca73,_0x48de33){var _0x159871=util[_0x11c3('0x5e')](_0x11c3('0x61'),ISPEECH_API,_0x365ce1,_0x3fca73,base64Encode(_0x129b95),_0x48de33?util['format']('model=%s',encodeURIComponent(_0x48de33)):_0x11c3('0x62'));return uploadFile(_0x159871)[_0x11c3('0x33')](function(_0xec5590){return querystring[_0x11c3('0x1')](_0xec5590);});};exports[_0x11c3('0x63')]=function(_0x24d873,_0xdf6441){return sestek[_0x11c3('0x64')](_0x24d873,_0xdf6441)['then'](function(_0x4e5f17){logger[_0x11c3('0x16')](JSON[_0x11c3('0x5d')](_0x4e5f17));var _0x1535db={'speech':_0x4e5f17[_0x11c3('0x65')],'action':_0x4e5f17['channelData']?_0x4e5f17[_0x11c3('0x66')][_0x11c3('0x67')]:undefined,'actiondata':_0x4e5f17[_0x11c3('0x66')]?_0x4e5f17[_0x11c3('0x66')][_0x11c3('0x68')]:undefined};if(_0x4e5f17[_0x11c3('0x66')]&&_0x4e5f17[_0x11c3('0x66')][_0x11c3('0x69')]){return base64Decode(_0x4e5f17[_0x11c3('0x66')][_0x11c3('0x69')][_0x11c3('0x6a')],path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+_0x11c3('0x25')))[_0x11c3('0x33')](function(_0x2fb7c7){_0x1535db[_0x11c3('0x6b')]=_0x2fb7c7;return _0x1535db;});}return _0x1535db;});};exports[_0x11c3('0x6c')]=function(){return __dirname;}; \ No newline at end of file +var _0xfb65=['googleDialogflow','textRequest','stringify','result','actionIncomplete','fulfillment','score','status','code','metadata','isFallbackIntent','tildeASR','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','https','parse','bluebird','randomstring','request-promise','util','apiai-promise','./aws','./tilde','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','statusMessage','request\x20to\x20','createWriteStream','info','finish\x20download\x20file','close','pipe','end','host','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','toString','?key=','ssml','input','voice','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message'];(function(_0x3d38e3,_0x438498){var _0x5b77a7=function(_0x26a381){while(--_0x26a381){_0x3d38e3['push'](_0x3d38e3['shift']());}};_0x5b77a7(++_0x438498);}(_0xfb65,0x1c3));var _0x5fb6=function(_0x442b31,_0x278d58){_0x442b31=_0x442b31-0x0;var _0x2c1151=_0xfb65[_0x442b31];return _0x2c1151;};'use strict';var fs=require('fs');var path=require(_0x5fb6('0x0'));var http=require('http');var https=require(_0x5fb6('0x1'));var urlParse=require('url')[_0x5fb6('0x2')];var BPromise=require(_0x5fb6('0x3'));var rs=require(_0x5fb6('0x4'));var sox=require('sox');var rp=require(_0x5fb6('0x5'));var util=require(_0x5fb6('0x6'));var querystring=require('querystring');var tts=require('google-tts-api');var apiai=require(_0x5fb6('0x7'));var md5=require('md5');var google=require('./google');var aws=require(_0x5fb6('0x8'));var tilde=require(_0x5fb6('0x9'));var sestek=require(_0x5fb6('0xa'));var logger=require('../../../config/logger')(_0x5fb6('0xb'));var ISPEECH_API=_0x5fb6('0xc');function downloadFile(_0x5ef553,_0x572943){return new BPromise(function(_0x52c8df,_0x182111){var _0x59c95a=urlParse(_0x5ef553);var _0x137ad9=_0x59c95a[_0x5fb6('0xd')]===_0x5fb6('0xe')?https:http;var _0x44b862={'host':_0x59c95a['host'],'path':_0x59c95a[_0x5fb6('0x0')],'headers':{'user-agent':_0x5fb6('0xf')}};_0x137ad9[_0x5fb6('0x10')](_0x44b862,function(_0x46f1d5){if(_0x46f1d5[_0x5fb6('0x11')]!==0xc8){logger[_0x5fb6('0x12')]('request\x20to\x20'+_0x5ef553+'\x20failed,\x20status\x20code\x20=\x20'+_0x46f1d5[_0x5fb6('0x11')]+'\x20('+_0x46f1d5[_0x5fb6('0x13')]+')');_0x182111(new Error(_0x5fb6('0x14')+_0x5ef553+'\x20failed,\x20status\x20code\x20=\x20'+_0x46f1d5[_0x5fb6('0x11')]+'\x20('+_0x46f1d5[_0x5fb6('0x13')]+')'));return;}var _0x10e3f0=fs[_0x5fb6('0x15')](_0x572943);_0x10e3f0['on']('finish',function(){logger[_0x5fb6('0x16')](_0x5fb6('0x17'));_0x10e3f0[_0x5fb6('0x18')](_0x52c8df);});_0x10e3f0['on'](_0x5fb6('0x12'),function(_0xe7ce87){fs['unlink'](_0x572943);logger[_0x5fb6('0x12')]('download\x20error',_0xe7ce87);_0x182111(_0xe7ce87);});_0x46f1d5[_0x5fb6('0x19')](_0x10e3f0);})['on'](_0x5fb6('0x12'),function(_0x2aeabb){logger[_0x5fb6('0x12')](_0x2aeabb);_0x182111(_0x2aeabb);})[_0x5fb6('0x1a')]();});}function uploadFile(_0x3d31b5){return new BPromise(function(_0x300b4f,_0x4f96c3){var _0x4711a3=urlParse(_0x3d31b5);var _0x8182dd=_0x4711a3[_0x5fb6('0xd')]===_0x5fb6('0xe')?https:http;var _0x4f835b={'host':_0x4711a3[_0x5fb6('0x1b')],'path':_0x4711a3['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x8182dd[_0x5fb6('0x10')](_0x4f835b,function(_0x50e24f){if(_0x50e24f[_0x5fb6('0x11')]!==0xc8){_0x4f96c3(new Error(_0x5fb6('0x14')+_0x3d31b5+_0x5fb6('0x1c')+_0x50e24f[_0x5fb6('0x11')]+'\x20('+_0x50e24f[_0x5fb6('0x13')]+')'));return;}var _0x34121e='';_0x50e24f['on'](_0x5fb6('0x1d'),function(_0x210d25){_0x34121e+=_0x210d25;});_0x50e24f['on']('end',function(){_0x300b4f(_0x34121e);});})['on'](_0x5fb6('0x12'),function(_0x59b45b){_0x4f96c3(_0x59b45b);})[_0x5fb6('0x1a')]();});}function convertFile(_0x2c7ed4,_0x35696c){return new BPromise(function(_0x32557a,_0x20b688){var _0x256fde=sox[_0x5fb6('0x1e')](_0x2c7ed4,_0x35696c,{'sampleRate':0x1f40,'format':_0x5fb6('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x256fde['on'](_0x5fb6('0x12'),function(_0x5bf974){logger[_0x5fb6('0x12')](_0x5fb6('0x20'),_0x5bf974);_0x20b688(_0x5bf974);});_0x256fde['on'](_0x5fb6('0x1a'),function(){logger['info'](_0x5fb6('0x21'));_0x32557a();});_0x256fde['start']();});}function base64Decode(_0x5956bf,_0x1d2b52){var _0x1e4409=path[_0x5fb6('0x22')](__dirname,'tmp',rs[_0x5fb6('0x23')](0x4)+_0x5fb6('0x24'));fs[_0x5fb6('0x25')](_0x1e4409,_0x5956bf,_0x5fb6('0x26'));return convertFile(_0x1e4409,_0x1d2b52)[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x1e4409);fs[_0x5fb6('0x29')](_0x1d2b52,_0x5fb6('0x2a'));}catch(_0x463056){logger[_0x5fb6('0x12')](_0x463056);}return _0x1d2b52[_0x5fb6('0x2b')]('.')[0x0];});}function base64Encode(_0x3bb6c6){var _0x1bf39e=fs[_0x5fb6('0x2c')](_0x3bb6c6);return new Buffer(_0x1bf39e)[_0x5fb6('0x2d')](_0x5fb6('0x26'));}exports['googleCloudTTS']=function(_0x266e11,_0xafcc80,_0x4b5078,_0x4250de,_0x471734,_0x483655){var _0x3fce77,_0x1e5352;var _0x28bf2a='https://texttospeech.googleapis.com/v1/';var _0x2e3904=_0x5fb6('0x2e')+_0x266e11;var _0x42448a={};if(_0xafcc80===_0x5fb6('0x2f')){_0x42448a[_0x5fb6('0x30')]={'ssml':_0x4b5078};}else{_0x42448a[_0x5fb6('0x30')]={'text':_0x4b5078};};_0x42448a[_0x5fb6('0x31')]={'languageCode':_0x4250de,'ssmlGender':_0x471734};_0x42448a['audioConfig']={'audioEncoding':_0x5fb6('0x32'),'sampleRateHertz':0x1f40};var _0x5b5f7d={'url':_0x28bf2a+_0x5fb6('0x33')+_0x2e3904,'method':_0x5fb6('0x34'),'json':!![],'body':_0x42448a};return rp(_0x5b5f7d)[_0x5fb6('0x27')](function(_0x532930){return new BPromise(function(_0x5502c7,_0x2562ac){_0x3fce77=path['resolve'](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+_0x5fb6('0x36'));var _0x184b8b=Buffer[_0x5fb6('0x37')](_0x532930[_0x5fb6('0x38')],'base64');return fs[_0x5fb6('0x39')](_0x3fce77,_0x184b8b,function(_0x478cbc){_0x2562ac(_0x478cbc);},function(_0x1c3348){fs['chmodSync'](_0x3fce77,_0x5fb6('0x2a'));_0x5502c7(_0x1c3348);});});})[_0x5fb6('0x27')](function(_0x41a60d){_0x1e5352=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs['generate'](0x4)+_0x5fb6('0x24'));return convertFile(_0x3fce77,_0x1e5352);})[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x3fce77);fs[_0x5fb6('0x29')](_0x1e5352,_0x5fb6('0x2a'));}catch(_0xc2ffca){logger['error'](_0xc2ffca);}logger['info'](_0x5fb6('0x3a'),_0x1e5352[_0x5fb6('0x2b')]('.')[0x0]);return _0x1e5352[_0x5fb6('0x2b')]('.')[0x0];});};exports[_0x5fb6('0x3b')]=function(_0xfb2ed1,_0x2de791){var _0x3b12d6,_0x2379b9;return tts(_0xfb2ed1,_0x2de791||'en',0x1)['then'](function(_0x32af45){logger[_0x5fb6('0x16')](_0x32af45);_0x3b12d6=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+_0x5fb6('0x36'));return downloadFile(_0x32af45,_0x3b12d6);})[_0x5fb6('0x27')](function(){_0x2379b9=path['resolve'](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+'.wav');return convertFile(_0x3b12d6,_0x2379b9);})[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x3b12d6);fs['chmodSync'](_0x2379b9,_0x5fb6('0x2a'));}catch(_0x304a50){logger[_0x5fb6('0x12')](_0x304a50);}logger[_0x5fb6('0x16')](_0x5fb6('0x3c'),_0x2379b9['split']('.')[0x0]);return _0x2379b9[_0x5fb6('0x2b')]('.')[0x0];});};exports[_0x5fb6('0x3d')]=function(_0x237503,_0x22ba5e,_0x35ff90){return google[_0x5fb6('0x3e')](_0x237503,_0x22ba5e,_0x35ff90)['then'](function(_0x20e0aa){logger[_0x5fb6('0x16')](_0x20e0aa['uri']);return rp(_0x20e0aa);})['then'](function(_0x282b21){var _0x427de1='';var _0x1ac67b=0x0;try{fs['unlink'](_0x237503);}catch(_0x57039e){logger[_0x5fb6('0x12')](_0x57039e);}if(_0x282b21&&_0x282b21[_0x5fb6('0x3f')]){_0x427de1=_0x282b21['results'][_0x5fb6('0x40')](function(_0x2fc5a3){return _0x2fc5a3&&_0x2fc5a3[_0x5fb6('0x41')][0x0]&&_0x2fc5a3[_0x5fb6('0x41')][0x0][_0x5fb6('0x42')]?_0x2fc5a3['alternatives'][0x0][_0x5fb6('0x42')]:'';})[_0x5fb6('0x43')]('\x0a');_0x1ac67b=_0x282b21[_0x5fb6('0x3f')][_0x5fb6('0x40')](function(_0x34f3a){return _0x34f3a&&_0x34f3a[_0x5fb6('0x41')][0x0]&&_0x34f3a['alternatives'][0x0][_0x5fb6('0x44')]?_0x34f3a[_0x5fb6('0x41')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x5fb6('0x16')](_0x5fb6('0x45'),_0x427de1);logger[_0x5fb6('0x16')]('googleASR\x20confidence',_0x1ac67b);return{'transcript':_0x427de1,'confidence':_0x1ac67b};})[_0x5fb6('0x46')](function(_0x2be8ff){logger[_0x5fb6('0x12')](_0x5fb6('0x47'),_0x2be8ff[_0x5fb6('0x11')],_0x2be8ff[_0x5fb6('0x48')],_0x2be8ff[_0x5fb6('0x49')]);});};exports[_0x5fb6('0x4a')]=function(_0x5bd17b,_0x153845,_0xed9b2e,_0x29bece){var _0x3240d3=apiai(_0x153845,{'language':_0x29bece||'en'});return _0x3240d3[_0x5fb6('0x4b')](_0xed9b2e,{'sessionId':md5(_0x5bd17b)})['then'](function(_0x4062a9){logger['info'](JSON[_0x5fb6('0x4c')](_0x4062a9));return{'source':_0x4062a9[_0x5fb6('0x4d')]['source'],'resolvedQuery':_0x4062a9[_0x5fb6('0x4d')]['resolvedQuery'],'action':_0x4062a9[_0x5fb6('0x4d')]['action'],'actionIncomplete':_0x4062a9['result'][_0x5fb6('0x4e')],'speech':_0x4062a9[_0x5fb6('0x4d')][_0x5fb6('0x4f')]['speech'],'score':_0x4062a9[_0x5fb6('0x4d')][_0x5fb6('0x50')],'statusCode':_0x4062a9[_0x5fb6('0x51')][_0x5fb6('0x52')],'endConversation':_0x4062a9[_0x5fb6('0x4d')][_0x5fb6('0x53')]['endConversation']||![],'isFallbackIntent':_0x4062a9[_0x5fb6('0x4d')][_0x5fb6('0x53')][_0x5fb6('0x54')]};});};exports[_0x5fb6('0x55')]=function(_0x2e6138,_0xa58f56,_0x2b5f6d,_0x25a523){return tilde[_0x5fb6('0x3e')](_0x2e6138,_0xa58f56,_0x2b5f6d,_0x25a523)[_0x5fb6('0x27')](function(_0xb5180){try{fs[_0x5fb6('0x28')](_0x2e6138);}catch(_0x31c7b0){logger[_0x5fb6('0x12')](_0x31c7b0);}logger[_0x5fb6('0x16')]('Tilde\x20ASR\x20transcription',_0xb5180[_0x5fb6('0x42')]);logger[_0x5fb6('0x16')]('Tilde\x20ASR\x20confidence',_0xb5180['confidence']);return _0xb5180;});};exports[_0x5fb6('0x56')]=function(_0xe1be20,_0x23587b,_0x47f963,_0x29e5f3,_0x5da3b5,_0xad1773){var _0x2c8d12=path['resolve'](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+_0x5fb6('0x36'));var _0x1408b7;return aws[_0x5fb6('0x57')](_0xe1be20,_0x23587b,_0x47f963,_0x29e5f3,_0x5da3b5,_0xad1773,_0x2c8d12)['then'](function(){_0x1408b7=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs['generate'](0x4)+_0x5fb6('0x24'));return convertFile(_0x2c8d12,_0x1408b7);})[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x2c8d12);fs[_0x5fb6('0x29')](_0x1408b7,_0x5fb6('0x2a'));}catch(_0x1d9a31){logger[_0x5fb6('0x12')](_0x1d9a31);}return _0x1408b7[_0x5fb6('0x2b')]('.')[0x0];});};exports[_0x5fb6('0x58')]=function(_0x24f06d,_0xb16ab3,_0x1dc086,_0x434156,_0x3690f4,_0x52d97a){return aws[_0x5fb6('0x59')](_0x24f06d,_0xb16ab3,_0x1dc086,_0x434156,_0x3690f4,_0x52d97a)[_0x5fb6('0x27')](function(_0x7a2b04){logger[_0x5fb6('0x16')](JSON[_0x5fb6('0x4c')](_0x7a2b04));return _0x7a2b04;});};exports[_0x5fb6('0x5a')]=function(_0x14aa05,_0x57402d,_0x4275fd,_0x4afed3){var _0x1fc873=util[_0x5fb6('0x5b')](_0x5fb6('0x5c'),ISPEECH_API,_0x14aa05,encodeURIComponent(_0x57402d),_0x4275fd,_0x4afed3);var _0x3be401=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs['generate'](0x4)+_0x5fb6('0x36'));var _0x1f72dd;return downloadFile(_0x1fc873,_0x3be401)[_0x5fb6('0x27')](function(){_0x1f72dd=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs['generate'](0x4)+_0x5fb6('0x24'));return convertFile(_0x3be401,_0x1f72dd);})[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x3be401);fs[_0x5fb6('0x29')](_0x1f72dd,_0x5fb6('0x2a'));}catch(_0x87a885){logger[_0x5fb6('0x12')](_0x87a885);}return _0x1f72dd[_0x5fb6('0x2b')]('.')[0x0];});};exports[_0x5fb6('0x5d')]=function(_0x4b4411,_0x3aff03,_0x517f7e,_0x4e33ba){var _0x3b2f21=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3aff03,_0x517f7e,base64Encode(_0x4b4411),_0x4e33ba?util[_0x5fb6('0x5b')](_0x5fb6('0x5e'),encodeURIComponent(_0x4e33ba)):_0x5fb6('0x5f'));return uploadFile(_0x3b2f21)['then'](function(_0x245342){return querystring['parse'](_0x245342);});};exports['sestekNDA']=function(_0x513479,_0x2ac539){return sestek[_0x5fb6('0x60')](_0x513479,_0x2ac539)[_0x5fb6('0x27')](function(_0x5bf375){logger[_0x5fb6('0x16')](JSON[_0x5fb6('0x4c')](_0x5bf375));var _0x2a42e6={'speech':_0x5bf375[_0x5fb6('0x61')],'action':_0x5bf375[_0x5fb6('0x62')]?_0x5bf375[_0x5fb6('0x62')][_0x5fb6('0x63')]:undefined,'actiondata':_0x5bf375[_0x5fb6('0x62')]?_0x5bf375[_0x5fb6('0x62')][_0x5fb6('0x64')]:undefined};if(_0x5bf375[_0x5fb6('0x62')]&&_0x5bf375['channelData'][_0x5fb6('0x65')]){return base64Decode(_0x5bf375['channelData'][_0x5fb6('0x65')][_0x5fb6('0x66')],path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+'.wav'))[_0x5fb6('0x27')](function(_0x37f7ab){_0x2a42e6[_0x5fb6('0x67')]=_0x37f7ab;return _0x2a42e6;});}return _0x2a42e6;});};exports[_0x5fb6('0x68')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index fccb99c..8f34e03 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 _0xd8e3=['exports'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0xd8e3,0x1e0));var _0x3d8e=function(_0x510909,_0x38f9fe){_0x510909=_0x510909-0x0;var _0x2faa1a=_0xd8e3[_0x510909];return _0x2faa1a;};var nda=require('./nda');module[_0x3d8e('0x0')]={'nda':nda}; \ No newline at end of file +var nda=require('./nda');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 5022392..41bfdc0 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 _0x4d0f=['calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','request-promise','url','agi','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x4d0f,0x13a));var _0xf4d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d0f[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xf4d0('0x0'));var url=require(_0xf4d0('0x1'));var logger=require('../../../../../config/logger')(_0xf4d0('0x2'));module['exports']=function(_0x323ea8,_0x49c830){var _0x255075={'method':'POST','uri':url[_0xf4d0('0x3')](_0x49c830[_0xf4d0('0x4')],_0xf4d0('0x5')),'form':{'grant_type':_0xf4d0('0x6'),'username':_0x49c830[_0xf4d0('0x7')],'password':_0x49c830[_0xf4d0('0x6')]},'json':!![]};return rp(_0x255075)[_0xf4d0('0x8')](function(_0x35c2b6){var _0x383e2d={'method':_0xf4d0('0x9'),'uri':url[_0xf4d0('0x3')](_0x49c830[_0xf4d0('0xa')],_0xf4d0('0xb')),'body':{'type':_0x49c830[_0xf4d0('0xc')]||_0xf4d0('0xd'),'channelId':_0xf4d0('0xe'),'conversation':{'id':_0x323ea8['uniqueid']},'from':{'id':_0x323ea8[_0xf4d0('0xf')],'name':_0x323ea8[_0xf4d0('0x10')]},'recipient':{'id':_0x323ea8[_0xf4d0('0x11')],'name':_0x323ea8['extension']},'text':_0x49c830[_0xf4d0('0x12')],'channelData':{}},'headers':{'Authorization':_0xf4d0('0x13')+_0x35c2b6[_0xf4d0('0x14')]},'json':!![]};if(_0x49c830[_0xf4d0('0x15')]){_0x383e2d[_0xf4d0('0x16')][_0xf4d0('0x17')][_0xf4d0('0x18')]=_0x49c830[_0xf4d0('0x15')];}if(_0x49c830[_0xf4d0('0x19')]=='1'){_0x383e2d[_0xf4d0('0x16')][_0xf4d0('0x17')][_0xf4d0('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf4d0('0x1b')};}if(_0x49c830['custom_action']){_0x383e2d[_0xf4d0('0x16')][_0xf4d0('0x17')][_0xf4d0('0x1c')]=_0x49c830[_0xf4d0('0x1d')];if(_0x49c830[_0xf4d0('0x1e')]){_0x383e2d[_0xf4d0('0x16')][_0xf4d0('0x17')][_0xf4d0('0x1f')]=_0x49c830['custom_action_data'];}}logger[_0xf4d0('0x20')](JSON['stringify'](_0x383e2d));return rp(_0x383e2d);});}; \ No newline at end of file +var _0x9d70=['CustomActionData','info','request-promise','../../../../../config/logger','agi','exports','/token','password','username','POST','resolve','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data'];(function(_0x5dc2f3,_0x2481c9){var _0x5f0b04=function(_0x5d3139){while(--_0x5d3139){_0x5dc2f3['push'](_0x5dc2f3['shift']());}};_0x5f0b04(++_0x2481c9);}(_0x9d70,0xa4));var _0x09d7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9d70[_0x40a045];return _0x1a687c;};'use strict';var rp=require(_0x09d7('0x0'));var url=require('url');var logger=require(_0x09d7('0x1'))(_0x09d7('0x2'));module[_0x09d7('0x3')]=function(_0x257f27,_0x591d28){var _0x232325={'method':'POST','uri':url['resolve'](_0x591d28['ndauth_url'],_0x09d7('0x4')),'form':{'grant_type':_0x09d7('0x5'),'username':_0x591d28[_0x09d7('0x6')],'password':_0x591d28[_0x09d7('0x5')]},'json':!![]};return rp(_0x232325)['then'](function(_0x180fc3){var _0xc398ee={'method':_0x09d7('0x7'),'uri':url[_0x09d7('0x8')](_0x591d28[_0x09d7('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x591d28[_0x09d7('0xa')]||_0x09d7('0xb'),'channelId':'Nda','conversation':{'id':_0x257f27[_0x09d7('0xc')]},'from':{'id':_0x257f27[_0x09d7('0xd')],'name':_0x257f27[_0x09d7('0xe')]},'recipient':{'id':_0x257f27[_0x09d7('0xf')],'name':_0x257f27['extension']},'text':_0x591d28[_0x09d7('0x10')],'channelData':{}},'headers':{'Authorization':_0x09d7('0x11')+_0x180fc3[_0x09d7('0x12')]},'json':!![]};if(_0x591d28[_0x09d7('0x13')]){_0xc398ee['body'][_0x09d7('0x14')]['ProjectName']=_0x591d28[_0x09d7('0x13')];}if(_0x591d28['ndagenerate_audio']=='1'){_0xc398ee['body']['channelData'][_0x09d7('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x09d7('0x16')};}if(_0x591d28[_0x09d7('0x17')]){_0xc398ee['body'][_0x09d7('0x14')]['CustomAction']=_0x591d28[_0x09d7('0x17')];if(_0x591d28[_0x09d7('0x18')]){_0xc398ee['body']['channelData'][_0x09d7('0x19')]=_0x591d28[_0x09d7('0x18')];}}logger[_0x09d7('0x1a')](JSON['stringify'](_0xc398ee));return rp(_0xc398ee);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index c7c8721..393c063 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xccf1=['./lib/api','exports'];(function(_0x40971a,_0x5cf1d9){var _0x393040=function(_0x5a498d){while(--_0x5a498d){_0x40971a['push'](_0x40971a['shift']());}};_0x393040(++_0x5cf1d9);}(_0xccf1,0xf8));var _0x1ccf=function(_0x3b500a,_0xbbeb08){_0x3b500a=_0x3b500a-0x0;var _0x230eda=_0xccf1[_0x3b500a];return _0x230eda;};'use strict';var asr=require(_0x1ccf('0x0'));module[_0x1ccf('0x1')]=function(_0x4f8d82,_0x2543aa,_0x1cf18d,_0x17a3fd){return asr(_0x4f8d82,_0x2543aa,_0x1cf18d,_0x17a3fd);}; \ No newline at end of file +var _0xd1ba=['./lib/api'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0xd1ba,0x9e));var _0xad1b=function(_0xc111f,_0x22e566){_0xc111f=_0xc111f-0x0;var _0x29c036=_0xd1ba[_0xc111f];return _0x29c036;};'use strict';var asr=require(_0xad1b('0x0'));module['exports']=function(_0x21fd13,_0x86c9f2,_0x1d63bd,_0x20cbfb){return asr(_0x21fd13,_0x86c9f2,_0x1d63bd,_0x20cbfb);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 1f599b4..2a1fd90 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 _0xbe60=['exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript','likelihood','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','close','bluebird','lodash','moment','crypto'];(function(_0x421a10,_0x2465aa){var _0x589ca0=function(_0x4cd6ca){while(--_0x4cd6ca){_0x421a10['push'](_0x421a10['shift']());}};_0x589ca0(++_0x2465aa);}(_0xbe60,0x1dc));var _0x0be6=function(_0x155940,_0xd01433){_0x155940=_0x155940-0x0;var _0x51aa9e=_0xbe60[_0x155940];return _0x51aa9e;};'use strict';var BPromise=require(_0x0be6('0x0'));var _=require(_0x0be6('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0be6('0x2'));var crypto=require(_0x0be6('0x3'));var logger=require('../../../../../../config/logger')('agi');module[_0x0be6('0x4')]=function(_0x17719b,_0x1c4c86,_0x551e05,_0x4d72eb){return new BPromise(function(_0x20c395,_0x283cf3){logger[_0x0be6('0x5')](_0x0be6('0x6'),_0x4d72eb||_0x0be6('0x7'));var _0x22090e=new WebSocket(_0x4d72eb||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2b7ef5='';var _0x36bc76='0';var _0x55fc02='1';var _0x4772b1='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3e8b62(_0x909c8d){var _0x37274f=crypto[_0x0be6('0x8')](_0x0be6('0x9'));_0x37274f[_0x0be6('0xa')](_0x909c8d);return _0x37274f[_0x0be6('0xb')](_0x0be6('0xc'));}function _0x391ee8(){try{logger[_0x0be6('0x5')](_0x0be6('0xd'));var _0x4b473b=moment()[_0x0be6('0xe')]();var _0x2317e3=_0x3e8b62(_0x4b473b+_0x1c4c86+_0x551e05);_0x22090e[_0x0be6('0xf')](JSON['stringify']({'appID':_0x1c4c86,'timestamp':_0x4b473b,'appKey':_0x2317e3}));var _0x5bc51d=fs[_0x0be6('0x10')](_0x17719b);_0x5bc51d['on'](_0x0be6('0x11'),function(_0x3480c3){_0x22090e['send'](_0x3480c3);});_0x5bc51d['on']('close',function(){_0x22090e[_0x0be6('0xf')](_0x0be6('0x12'));});}catch(_0x5e5243){logger[_0x0be6('0x13')](_0x0be6('0x14'),JSON['stringify'](_0x5e5243));_0x22090e['terminate']();}}function _0x7f194(_0x276aa7){try{if(_0x276aa7){var _0x273e54=JSON[_0x0be6('0x15')](_0x276aa7);switch(_0x273e54['status']){case 0x0:if(_0x273e54['result']){if(_0x273e54[_0x0be6('0x16')][_0x0be6('0x17')]){logger['info'](_0x0be6('0x18'),JSON[_0x0be6('0x19')](_0x273e54['result'][_0x0be6('0x1a')]));_0x2b7ef5=_0x273e54[_0x0be6('0x16')][_0x0be6('0x1a')][0x0][_0x0be6('0x1b')];_0x36bc76=_0x273e54[_0x0be6('0x16')][_0x0be6('0x1a')][0x0][_0x0be6('0x1c')];_0x55fc02='0';_0x4772b1='Success.';_0x22090e[_0x0be6('0x1d')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x55fc02='1';_0x4772b1=_0x0be6('0x1e');break;case 0x2:logger['info'](_0x0be6('0x1f'));_0x55fc02='2';_0x4772b1=_0x0be6('0x1f');break;case 0x9:logger[_0x0be6('0x5')](_0x0be6('0x20'));_0x55fc02='9';_0x4772b1=_0x0be6('0x20');break;case 0xa:logger['info']('Authentication\x20failed.');_0x55fc02='10';_0x4772b1=_0x0be6('0x21');break;case 0xb:logger[_0x0be6('0x5')](_0x0be6('0x22'));_0x55fc02='11';_0x4772b1='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x494c12){logger[_0x0be6('0x13')](_0x0be6('0x23'),JSON[_0x0be6('0x19')](_0x494c12));_0x22090e[_0x0be6('0x1d')]();}}function _0x4347e8(){logger[_0x0be6('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x20c395({'transcript':_0x2b7ef5,'confidence':_0x36bc76,'status':_0x55fc02,'status_message':_0x4772b1});}function _0x595b0e(_0x48acb9){logger[_0x0be6('0x13')](_0x0be6('0x24'));if(!_[_0x0be6('0x25')](_0x48acb9)){logger[_0x0be6('0x13')](_[_0x0be6('0x26')](_0x48acb9)?JSON[_0x0be6('0x19')](_0x48acb9):_0x48acb9);}}_0x22090e['on']('open',_0x391ee8);_0x22090e['on']('message',_0x7f194);_0x22090e['on'](_0x0be6('0x27'),_0x4347e8);_0x22090e['on'](_0x0be6('0x13'),_0x595b0e);});}; \ No newline at end of file +var _0x0b15=['Tilde\x20ASR\x20send\x20error','terminate','status','final','result','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error'];(function(_0xc451a0,_0x45b19b){var _0x445be7=function(_0x563cfd){while(--_0x563cfd){_0xc451a0['push'](_0xc451a0['shift']());}};_0x445be7(++_0x45b19b);}(_0x0b15,0x1a2));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x50b1('0x0'));var _=require(_0x50b1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x50b1('0x2'));var crypto=require(_0x50b1('0x3'));var logger=require(_0x50b1('0x4'))(_0x50b1('0x5'));module[_0x50b1('0x6')]=function(_0x3d10dc,_0x45080a,_0x4131cb,_0x288e06){return new BPromise(function(_0x3a6ab6,_0x902956){logger[_0x50b1('0x7')](_0x50b1('0x8'),_0x288e06||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x35b385=new WebSocket(_0x288e06||_0x50b1('0x9'),{'perMessageDeflate':![]});var _0x390330='';var _0x601a7='0';var _0x26f1d2='1';var _0x395cb6=_0x50b1('0xa');function _0x4ac64a(_0x2da2f0){var _0x5de155=crypto[_0x50b1('0xb')]('sha1');_0x5de155[_0x50b1('0xc')](_0x2da2f0);return _0x5de155['digest']('hex');}function _0x10ba1a(){try{logger[_0x50b1('0x7')](_0x50b1('0xd'));var _0x286d09=moment()[_0x50b1('0xe')]();var _0x5a87db=_0x4ac64a(_0x286d09+_0x45080a+_0x4131cb);_0x35b385['send'](JSON[_0x50b1('0xf')]({'appID':_0x45080a,'timestamp':_0x286d09,'appKey':_0x5a87db}));var _0x196247=fs[_0x50b1('0x10')](_0x3d10dc);_0x196247['on'](_0x50b1('0x11'),function(_0xac9c96){_0x35b385[_0x50b1('0x12')](_0xac9c96);});_0x196247['on'](_0x50b1('0x13'),function(){_0x35b385[_0x50b1('0x12')](_0x50b1('0x14'));});}catch(_0x136cf6){logger[_0x50b1('0x15')](_0x50b1('0x16'),JSON[_0x50b1('0xf')](_0x136cf6));_0x35b385[_0x50b1('0x17')]();}}function _0x2eb99d(_0x1cacc5){try{if(_0x1cacc5){var _0x7a1902=JSON['parse'](_0x1cacc5);switch(_0x7a1902[_0x50b1('0x18')]){case 0x0:if(_0x7a1902['result']){if(_0x7a1902['result'][_0x50b1('0x19')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x7a1902[_0x50b1('0x1a')][_0x50b1('0x1b')]));_0x390330=_0x7a1902['result']['hypotheses'][0x0][_0x50b1('0x1c')];_0x601a7=_0x7a1902['result'][_0x50b1('0x1b')][0x0][_0x50b1('0x1d')];_0x26f1d2='0';_0x395cb6='Success.';_0x35b385[_0x50b1('0x17')]();}}break;case 0x1:logger['info'](_0x50b1('0xa'));_0x26f1d2='1';_0x395cb6=_0x50b1('0xa');break;case 0x2:logger['info'](_0x50b1('0x1e'));_0x26f1d2='2';_0x395cb6=_0x50b1('0x1e');break;case 0x9:logger[_0x50b1('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x26f1d2='9';_0x395cb6=_0x50b1('0x1f');break;case 0xa:logger[_0x50b1('0x7')]('Authentication\x20failed.');_0x26f1d2='10';_0x395cb6=_0x50b1('0x20');break;case 0xb:logger[_0x50b1('0x7')](_0x50b1('0x21'));_0x26f1d2='11';_0x395cb6='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2c8809){logger[_0x50b1('0x15')](_0x50b1('0x22'),JSON[_0x50b1('0xf')](_0x2c8809));_0x35b385[_0x50b1('0x17')]();}}function _0x435820(){logger[_0x50b1('0x7')](_0x50b1('0x23'));_0x3a6ab6({'transcript':_0x390330,'confidence':_0x601a7,'status':_0x26f1d2,'status_message':_0x395cb6});}function _0x38e637(_0x5c945e){logger[_0x50b1('0x15')](_0x50b1('0x24'));if(!_['isNil'](_0x5c945e)){logger[_0x50b1('0x15')](_[_0x50b1('0x25')](_0x5c945e)?JSON['stringify'](_0x5c945e):_0x5c945e);}}_0x35b385['on'](_0x50b1('0x26'),_0x10ba1a);_0x35b385['on'](_0x50b1('0x27'),_0x2eb99d);_0x35b385['on'](_0x50b1('0x13'),_0x435820);_0x35b385['on'](_0x50b1('0x15'),_0x38e637);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 4865560..e7e8a3f 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 _0xb7db=['exports','./asr'];(function(_0x1ecc7a,_0x1e3d77){var _0x40aa20=function(_0x128147){while(--_0x128147){_0x1ecc7a['push'](_0x1ecc7a['shift']());}};_0x40aa20(++_0x1e3d77);}(_0xb7db,0x1e7));var _0xbb7d=function(_0x56679b,_0x4fd310){_0x56679b=_0x56679b-0x0;var _0x211abf=_0xb7db[_0x56679b];return _0x211abf;};var asr=require(_0xbb7d('0x0'));module[_0xbb7d('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd8a2=['./asr','exports'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0xd8a2,0x128));var _0x2d8a=function(_0x590f2a,_0x49f22c){_0x590f2a=_0x590f2a-0x0;var _0x59a1c9=_0xd8a2[_0x590f2a];return _0x59a1c9;};var asr=require(_0x2d8a('0x0'));module[_0x2d8a('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 6e501d3..bc8f733 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 _0x9f3e=['createServer','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT'];(function(_0x13ff4f,_0x4defc2){var _0xd04dee=function(_0x516beb){while(--_0x516beb){_0x13ff4f['push'](_0x13ff4f['shift']());}};_0xd04dee(++_0x4defc2);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x117f4b,_0x56b75f){_0x117f4b=_0x117f4b-0x0;var _0x5903ec=_0x9f3e[_0x117f4b];return _0x5903ec;};'use strict';var util=require(_0xe9f3('0x0'));var net=require(_0xe9f3('0x1'));var EventEmitter=require(_0xe9f3('0x2'))[_0xe9f3('0x3')];var AGIError=require(_0xe9f3('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x597538,_0x4c3a39,_0x1ea33c){var _0x4bc414=this,_0x597538=_0x597538||0x11dd,_0x4c3a39=_0x4c3a39||_0xe9f3('0x5'),_0x46f926=null,_0x3693ef=0x0;EventEmitter[_0xe9f3('0x6')](_0x4bc414);function _0x407123(){if(!_0x597538){_0x4bc414[_0xe9f3('0x7')](_0xe9f3('0x8'),new AGIError(_0xe9f3('0x9')));return![];}_0x46f926=net[_0xe9f3('0xa')]();_0x46f926[_0xe9f3('0xb')](_0x597538,_0x4c3a39);_0x46f926['on'](_0xe9f3('0xc'),function(){_0x4bc414['emit'](_0xe9f3('0xc'));});_0x46f926['on'](_0xe9f3('0xd'),function(_0x250599){_0x46f926[_0xe9f3('0xe')](function(_0x22ed98,_0x48ae22){if(_0x22ed98){_0x4bc414[_0xe9f3('0x7')](_0xe9f3('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x22ed98));}else if(_0x1ea33c&&_0x1ea33c<0x0){_0x4bc414[_0xe9f3('0x7')]('error',new AGIError(_0xe9f3('0xf')));_0x250599[_0xe9f3('0x10')]();}else if(_0x1ea33c&&_0x1ea33c>0x0&&_0x1ea33c<_0x48ae22){_0x3693ef+=0x1;_0x4bc414[_0xe9f3('0x7')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3693ef));_0x250599[_0xe9f3('0x10')]();}else{var _0x158f4c=new AGIChannel(_0x250599);_0x158f4c['on']('ready',function(){_0x4bc414[_0xe9f3('0x7')](_0xe9f3('0xd'),_0x158f4c);});}});});_0x46f926['on'](_0xe9f3('0x8'),function(_0x25abdc){_0x4bc414[_0xe9f3('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x25abdc[_0xe9f3('0x11')]));});_0x46f926['on'](_0xe9f3('0x12'),function(){_0x4bc414[_0xe9f3('0x7')](_0xe9f3('0x12'),new AGIError(_0xe9f3('0x13')));});}process['nextTick'](function(){_0x407123();});};util[_0xe9f3('0x14')](AGIServer,EventEmitter);module[_0xe9f3('0x15')]=function(_0x570dc0,_0x2b21b9,_0x679a80){return new AGIServer(_0x570dc0,_0x2b21b9,_0x679a80);}; \ No newline at end of file +var _0x98e1=['listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','error','E_AGI_SERVER_MAXCONNECTION','destroy','close','E_AGI_SERVER_CLOSE','nextTick','inherits','net','events','EventEmitter','./error','call','emit','E_AGI_ARGUMENT_PORT','createServer'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x98e1,0x160));var _0x198e=function(_0x5b1bbc,_0x98e6c3){_0x5b1bbc=_0x5b1bbc-0x0;var _0x424fb4=_0x98e1[_0x5b1bbc];return _0x424fb4;};'use strict';var util=require('util');var net=require(_0x198e('0x0'));var EventEmitter=require(_0x198e('0x1'))[_0x198e('0x2')];var AGIError=require(_0x198e('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x300c4b,_0x4e997a,_0x4a102f){var _0x3bd989=this,_0x300c4b=_0x300c4b||0x11dd,_0x4e997a=_0x4e997a||'127.0.0.1',_0x317209=null,_0x551d31=0x0;EventEmitter[_0x198e('0x4')](_0x3bd989);function _0x4d45d6(){if(!_0x300c4b){_0x3bd989[_0x198e('0x5')]('error',new AGIError(_0x198e('0x6')));return![];}_0x317209=net[_0x198e('0x7')]();_0x317209[_0x198e('0x8')](_0x300c4b,_0x4e997a);_0x317209['on'](_0x198e('0x9'),function(){_0x3bd989[_0x198e('0x5')](_0x198e('0x9'));});_0x317209['on'](_0x198e('0xa'),function(_0x162604){_0x317209[_0x198e('0xb')](function(_0x5be755,_0x33e0a5){if(_0x5be755){_0x3bd989[_0x198e('0x5')]('error',new AGIError(_0x198e('0xc'),_0x5be755));}else if(_0x4a102f&&_0x4a102f<0x0){_0x3bd989['emit'](_0x198e('0xd'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x162604['destroy']();}else if(_0x4a102f&&_0x4a102f>0x0&&_0x4a102f<_0x33e0a5){_0x551d31+=0x1;_0x3bd989['emit']('error',new AGIError(_0x198e('0xe'),_0x551d31));_0x162604[_0x198e('0xf')]();}else{var _0x10d24e=new AGIChannel(_0x162604);_0x10d24e['on']('ready',function(){_0x3bd989[_0x198e('0x5')](_0x198e('0xa'),_0x10d24e);});}});});_0x317209['on'](_0x198e('0xd'),function(_0x5035de){_0x3bd989['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x5035de['code']));});_0x317209['on'](_0x198e('0x10'),function(){_0x3bd989['emit']('close',new AGIError(_0x198e('0x11')));});}process[_0x198e('0x12')](function(){_0x4d45d6();});};util[_0x198e('0x13')](AGIServer,EventEmitter);module['exports']=function(_0x7742f1,_0x3679aa,_0x2fdc34){return new AGIServer(_0x7742f1,_0x3679aa,_0x2fdc34);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 1612ec1..12b83ba 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 _0xb0b9=['Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','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','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','success','voicemail','VOICEMAIL','mailbox','vswitch','path','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','rpc','prototype','getVariable','then','name','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isNil','dialTimezone','VALUE\x20TZ','CALLERID(dialTimezone)','isEmpty','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','agentPause','agent','error','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','nextbracket','replaceAll','extra','getAndSetVariable','result','setVariable','isConfigured','sync','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','no\x20list\x20selected','delay','add','before\x20createcmcontact','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','sestektts','no\x20text\x20configured','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','opts','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','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','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getdigits','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','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','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','subject','service','host','port','secure','authentication','auth','user','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','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'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x497037,_0x38d1d7){_0x497037=_0x497037-0x0;var _0x53d6ef=_0xb0b9[_0x497037];return _0x53d6ef;};'use strict';var fs=require('fs');var path=require(_0x9b0b('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0x9b0b('0x1'));var odbc=require(_0x9b0b('0x2'))();var rs=require(_0x9b0b('0x3'));var moment=require(_0x9b0b('0x4'));var Mustache=require(_0x9b0b('0x5'));var rp=require(_0x9b0b('0x6'));var logger=require(_0x9b0b('0x7'))(_0x9b0b('0x8'));var config=require(_0x9b0b('0x9'));var shared=require(_0x9b0b('0xa'));var scripts=require(_0x9b0b('0xb'));var FILES_PATH=_0x9b0b('0xc');var recursiveMapAttributes=[_0x9b0b('0xd'),_0x9b0b('0xe')];var verticesWithRetry=['menu','getdigits',_0x9b0b('0xf')];var AGIVertices=function(_0x40c5e6,_0x22e8bd,_0x2b0384){this[_0x9b0b('0x10')]=_0x40c5e6;this[_0x9b0b('0x11')]=_0x22e8bd;this['mailRpc']=_0x2b0384;};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x13')]=function(_0x2ae7a2,_0x40c06b){this['rpc']['getVariableById'](_0x2ae7a2)[_0x9b0b('0x14')](function(_0x4b3ed5){_0x40c06b(null,_0x4b3ed5?_0x4b3ed5[_0x9b0b('0x15')]:![]);})['catch'](function(_0x235d28){_0x40c06b(_0x235d28);});};AGIVertices[_0x9b0b('0x12')]['getVoiceQueue']=function(_0x5974af,_0x5f0555){this[_0x9b0b('0x11')][_0x9b0b('0x16')](_0x5974af)['then'](function(_0x248ff9){_0x5f0555(null,_0x248ff9?_0x248ff9[_0x9b0b('0x15')]:![]);})[_0x9b0b('0x17')](function(_0x1e92c1){_0x5f0555(_0x1e92c1);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x18')]=function(_0x8ed071,_0x39e3d0){this[_0x9b0b('0x11')][_0x9b0b('0x19')](_0x8ed071)[_0x9b0b('0x14')](function(_0x3f2733){_0x39e3d0(null,_0x3f2733?_0x3f2733[_0x9b0b('0x15')]:![]);})[_0x9b0b('0x17')](function(_0x51277a){_0x39e3d0(_0x51277a);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1a')]=function(_0x7cf37c,_0x57117b){this[_0x9b0b('0x11')][_0x9b0b('0x1b')](_0x7cf37c)[_0x9b0b('0x14')](function(_0x565d35){_0x57117b(null,_0x565d35?_0x565d35[_0x9b0b('0x1c')]:![]);})[_0x9b0b('0x17')](function(_0x27b8e3){_0x57117b(_0x27b8e3);});};AGIVertices[_0x9b0b('0x12')]['getUser']=function(_0x30bfe8,_0x408f70){this['rpc'][_0x9b0b('0x1d')](_0x30bfe8)[_0x9b0b('0x14')](function(_0x3f433c){_0x408f70(null,_0x3f433c?_0x3f433c[_0x9b0b('0x15')]:![]);})[_0x9b0b('0x17')](function(_0x29b39c){_0x408f70(_0x29b39c);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1e')]=function(_0x1067be,_0x5771fd){this[_0x9b0b('0x11')][_0x9b0b('0x1f')](_0x1067be)[_0x9b0b('0x14')](function(_0x476482){_0x5771fd(null,_0x476482?_0x476482['name']:![]);})[_0x9b0b('0x17')](function(_0xb31c25){_0x5771fd(_0xb31c25);});};AGIVertices['prototype'][_0x9b0b('0x20')]=function(_0x1e25fb,_0x1a31ba){var _0x47a135=this;this[_0x9b0b('0x11')][_0x9b0b('0x21')](_0x1e25fb)[_0x9b0b('0x14')](function(_0x5507e1){_0x1a31ba(null,_0x5507e1?_0x47a135[_0x9b0b('0x22')](_0x5507e1[_0x9b0b('0x23')]):![]);})[_0x9b0b('0x17')](function(_0x22ce12){_0x1a31ba(_0x22ce12);});};AGIVertices['prototype'][_0x9b0b('0x24')]=function(_0xfa71df,_0x48d324){this[_0x9b0b('0x11')][_0x9b0b('0x25')](_0xfa71df)[_0x9b0b('0x14')](function(_0x976095){_0x48d324(null,_0x976095?_0x976095:![]);})[_0x9b0b('0x17')](function(_0x26e90c){_0x48d324(_0x26e90c);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x26')]=function(_0x4ef44d,_0x4afc53,_0x3fcf01){this['mailRpc'][_0x9b0b('0x26')](_0x4ef44d,_0x4afc53)['then'](function(){_0x3fcf01(null);})['catch'](function(_0x597d46){_0x3fcf01(_0x597d46);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x27')]=function(_0xff3528,_0x212b85){this[_0x9b0b('0x11')][_0x9b0b('0x28')](_0xff3528)[_0x9b0b('0x14')](function(_0x305169){if(_0x305169){if(_0x305169[_0x9b0b('0x29')]){_0x212b85(null,[_0x305169[_0x9b0b('0x2a')]]);}else{_0x212b85(null,_[_0x9b0b('0x2b')](_0x305169[_0x9b0b('0x2c')],_0x9b0b('0x2a')));}}else{_0x212b85(null,![]);}})['catch'](function(_0x2a4135){_0x212b85(_0x2a4135);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x22')]=function(_0x405f6a){return util[_0x9b0b('0x2d')](_0x9b0b('0x2e'),FILES_PATH,_0x405f6a);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x2f')]=function(_0x37007e,_0x23c47b,_0x37569e){odbc[_0x9b0b('0x30')](_0x37007e,function(_0x97d73a){if(_0x97d73a){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x97d73a);_0x37569e(_0x97d73a);}else{logger[_0x9b0b('0x31')](_0x9b0b('0x32'));odbc[_0x9b0b('0x33')](_0x23c47b,function(_0x141563,_0x3ff876){if(_0x141563){logger['info'](_0x9b0b('0x34'),_0x23c47b);_0x37569e(_0x141563);}else{logger[_0x9b0b('0x31')](_0x9b0b('0x35'),_0x23c47b);odbc[_0x9b0b('0x36')](function(_0x4d32b5){if(_0x4d32b5){logger['error'](_0x9b0b('0x37'),_0x4d32b5);}_0x37569e(null,_0x3ff876);});}});}});};AGIVertices['prototype'][_0x9b0b('0x38')]=function(_0x316d86,_0x17a764){this[_0x9b0b('0x11')][_0x9b0b('0x39')](_0x316d86)[_0x9b0b('0x14')](function(_0x4486ed){_0x17a764(null,_0x4486ed?_0x4486ed:![]);})[_0x9b0b('0x17')](function(_0x1e42bd){_0x17a764(_0x1e42bd);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x3a')]=function(_0x33c539,_0x4049ad){this[_0x9b0b('0x11')][_0x9b0b('0x3a')](_0x33c539)['then'](function(_0x5123f4){_0x4049ad(null,_0x5123f4);})['catch'](function(_0x42bf3f){_0x4049ad(_0x42bf3f);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x3b')]=function(_0x424d9b,_0x161871,_0x52d8db){this['rpc'][_0x9b0b('0x3b')]({'uniqueid':this[_0x9b0b('0x10')][_0x9b0b('0x3c')],'node':_0x424d9b[_0x9b0b('0x3d')],'application':_0x424d9b['agicommand'],'data':_0x161871||null,'project_name':this[_0x9b0b('0x10')][_0x9b0b('0x3e')],'callerid':this[_0x9b0b('0x10')][_0x9b0b('0x3f')]})[_0x9b0b('0x14')](function(_0x5c86ba){if(_0x52d8db){_0x52d8db(null,_0x5c86ba);}})[_0x9b0b('0x17')](function(_0x1d9b96){if(_0x52d8db){_0x52d8db(_0x1d9b96);}});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x40')]=function(_0x14e8a2,_0x1a4dbb,_0x444d95,_0x37a27a){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x9b0b('0x3c')],'callerid':this[_0x9b0b('0x10')][_0x9b0b('0x3f')],'calleridname':this[_0x9b0b('0x10')][_0x9b0b('0x41')],'context':this[_0x9b0b('0x10')][_0x9b0b('0x42')],'extension':this[_0x9b0b('0x10')][_0x9b0b('0x43')],'priority':this[_0x9b0b('0x10')][_0x9b0b('0x44')],'accountcode':this['channel'][_0x9b0b('0x45')],'dnid':this[_0x9b0b('0x10')]['dnid'],'projectName':this['channel'][_0x9b0b('0x3e')],'saveName':_0x1a4dbb,'filename':_0x14e8a2[_0x9b0b('0x46')]||_0x1a4dbb,'savePath':_0x444d95})[_0x9b0b('0x14')](function(_0x1ea242){_0x37a27a(null,_0x1ea242);})['catch'](function(_0x3c9675){_0x37a27a(_0x3c9675);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x47')]=function(_0x2ed8b4,_0x21f4c1,_0x1bfdca){this[_0x9b0b('0x11')][_0x9b0b('0x47')]({'uniqueid':this[_0x9b0b('0x10')]['uniqueid'],'body':_0x2ed8b4,'direction':_0x21f4c1})[_0x9b0b('0x14')](function(_0x5383d9){if(_0x1bfdca){_0x1bfdca(null,_0x5383d9);}})[_0x9b0b('0x17')](function(_0x5eb636){if(_0x1bfdca){_0x1bfdca(_0x5eb636);}});};AGIVertices['prototype'][_0x9b0b('0x48')]=function(_0x2238d1,_0x369752){console[_0x9b0b('0x49')](_0x9b0b('0x4a'),_0x2238d1);console[_0x9b0b('0x49')](_0x9b0b('0x4b'),_0x369752);var _0x495b3e=0x0;if(_['has'](_0x2238d1,'dialTimezone')){if(!_[_0x9b0b('0x4c')](_0x2238d1[_0x9b0b('0x4d')])){var _0x2a2420=_0x2238d1[_0x9b0b('0x4d')];console[_0x9b0b('0x49')](_0x9b0b('0x4e'),_0x2a2420);if(_0x2238d1['dialTimezone']==_0x9b0b('0x4f')){this[_0x9b0b('0x11')]['getContactByPhone']({'phone':_0x2238d1['phone']})['then'](function(_0x8f664e){console[_0x9b0b('0x49')]('RETVALRPC',_0x8f664e);_0x369752(null,_0x8f664e);});}else{console['log']('TZ\x20found\x20in\x20shared:',shared[_0x2a2420]);}}}this[_0x9b0b('0x11')][_0x9b0b('0x48')]({'firstName':_[_0x9b0b('0x50')](_0x2238d1[_0x9b0b('0x15')])||_[_0x9b0b('0x4c')](_0x2238d1[_0x9b0b('0x15')])?_0x9b0b('0x51')+Math[_0x9b0b('0x52')]():_0x2238d1[_0x9b0b('0x15')],'lastName':_[_0x9b0b('0x50')](_0x2238d1[_0x9b0b('0x53')])||_['isNil'](_0x2238d1[_0x9b0b('0x53')])?null:_0x2238d1[_0x9b0b('0x53')],'phone':_0x2238d1['phone'],'ListId':_0x2238d1[_0x9b0b('0x54')],'scheduledat':_0x2238d1[_0x9b0b('0x55')],'callbackUniqueid':this['channel'][_0x9b0b('0x3c')],'tags':_0x9b0b('0x56'),'description':_0x9b0b('0x57')+_0x2238d1[_0x9b0b('0x55')][_0x9b0b('0x58')](),'priority':_0x2238d1['callback_priority']})[_0x9b0b('0x14')](function(_0x26852a){_0x369752(null,_0x26852a);})[_0x9b0b('0x17')](function(_0x24270e){_0x369752(_0x24270e);});};AGIVertices['prototype']['getPause']=function(_0x25553d,_0xebf21a){this['rpc']['getPauseById'](_0x25553d)[_0x9b0b('0x14')](function(_0x3b714c){_0xebf21a(null,_0x3b714c?_0x3b714c[_0x9b0b('0x15')]:![]);})[_0x9b0b('0x17')](function(_0x36654a){_0xebf21a(_0x36654a);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x59')]=function(_0x18f35a,_0x4aa3a4,_0x53af3){var _0x38ff6d={'role':_0x9b0b('0x5a')};_0x38ff6d[_0x18f35a]=this[_0x9b0b('0x10')]['callerid'];this[_0x9b0b('0x11')]['agentPause'](_0x38ff6d,_0x4aa3a4,this[_0x9b0b('0x10')][_0x9b0b('0x3c')])[_0x9b0b('0x14')](function(_0x269991){_0x53af3(null,_[_0x9b0b('0x4c')](_0x269991)?![]:!![]);})['catch'](function(_0x168253){logger[_0x9b0b('0x5b')](_0x168253);_0x53af3(null,![]);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x5c')]=function(_0x56b8cd,_0x2b2196){var _0x259340={'role':_0x9b0b('0x5a')};_0x259340[_0x56b8cd]=this[_0x9b0b('0x10')][_0x9b0b('0x3f')];this['rpc'][_0x9b0b('0x5c')](_0x259340)[_0x9b0b('0x14')](function(_0x51914d){_0x2b2196(null,_[_0x9b0b('0x4c')](_0x51914d)?![]:!![]);})[_0x9b0b('0x17')](function(_0x2f4de3){logger[_0x9b0b('0x5b')](_0x2f4de3);_0x2b2196(null,![]);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x5d')]=function(_0x51b955,_0x23efce){var _0x1c0192={'role':_0x9b0b('0x5a')};_0x1c0192[_0x51b955]=this[_0x9b0b('0x10')][_0x9b0b('0x3f')];this[_0x9b0b('0x11')]['agentLogout'](_0x1c0192)[_0x9b0b('0x14')](function(_0x107595){_0x23efce(null,_['isNil'](_0x107595)?![]:!![]);})['catch'](function(_0x27e1f2){logger['error'](_0x27e1f2);_0x23efce(null,![]);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x5e')]=function(_0x3024e6,_0x1572be){var _0x1d4eb2={'role':_0x9b0b('0x5a')};_0x1d4eb2[_0x3024e6]=this['channel'][_0x9b0b('0x3f')];var _0x1b73b8=_0x3024e6!=_0x9b0b('0x5f')?util[_0x9b0b('0x2d')](_0x9b0b('0x60'),_0x9b0b('0x61'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')]):undefined;this[_0x9b0b('0x11')][_0x9b0b('0x5e')](_0x1d4eb2,_0x1b73b8)[_0x9b0b('0x14')](function(_0x4479cf){_0x1572be(null,_[_0x9b0b('0x4c')](_0x4479cf)?![]:!![]);})[_0x9b0b('0x17')](function(_0x4b3558){logger[_0x9b0b('0x5b')](_0x4b3558);_0x1572be(null,![]);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x62')]=function(_0x1b232b,_0x33ab52){sh[_0x9b0b('0x63')](_[_0x9b0b('0x64')](_0x1b232b),function(_0x20c546,_0x44e368){var _0x127ee4=_0x44e368[_0x9b0b('0x65')](/(\r\n|\n|\r)/gm,'');_0x33ab52(null,_0x127ee4);});};AGIVertices['prototype'][_0x9b0b('0x66')]=function(_0x40bb40,_0x5f30bd){scripts['googleCloudTTS'](_0x40bb40[_0x9b0b('0x67')],_0x40bb40[_0x9b0b('0x68')]||_0x9b0b('0x69'),_0x40bb40[_0x9b0b('0x69')],_0x40bb40[_0x9b0b('0x6a')]||_0x9b0b('0x6b'),_0x40bb40['ssmlGender']||_0x9b0b('0x6c'),_0x40bb40[_0x9b0b('0x6d')]||_0x9b0b('0x6e'))['then'](function(_0x4a0c50){_0x5f30bd(null,_0x4a0c50);})[_0x9b0b('0x17')](function(_0x1872fe){_0x5f30bd(_0x1872fe);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x6f')]=function(_0x306dd9,_0x2db4fc){scripts['googleTTS'](_0x306dd9['text'],_0x306dd9['google_tts_language']||'en',0x1)['then'](function(_0x35edf3){_0x2db4fc(null,_0x35edf3);})['catch'](function(_0x2c3737){_0x2db4fc(_0x2c3737);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x70')]=function(_0x3fc983,_0x2efcc3){var _0x341b17={'uri':_0x3fc983[_0x9b0b('0x71')],'method':_0x3fc983[_0x9b0b('0x72')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3fc983['timeout'])===_0x9b0b('0x73')&&parseInt(_0x3fc983['timeout'])>=0x1?parseInt(_0x3fc983[_0x9b0b('0x74')])*0x3e8:0x5*0x3e8};if(_[_0x9b0b('0x75')]([_0x9b0b('0x76'),_0x9b0b('0x77')],_0x341b17[_0x9b0b('0x72')][_0x9b0b('0x78')]())){try{_0x341b17[_0x9b0b('0x79')]=_0x3fc983[_0x9b0b('0xe')]?JSON[_0x9b0b('0x7a')](_0x3fc983[_0x9b0b('0xe')]):{};}catch(_0xe502b){logger[_0x9b0b('0x5b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0xe502b);}}try{_0x341b17[_0x9b0b('0x7b')]=_0x3fc983[_0x9b0b('0xd')]?JSON['parse'](_0x3fc983['rawHeaders']):{};}catch(_0x2049c9){logger[_0x9b0b('0x5b')](_0x9b0b('0x7c'),_0x2049c9);}if(_0x3fc983['computedVariables']){try{var _0x39cec7=require(_0x3fc983[_0x9b0b('0x7d')])['sync'](this,_0x341b17);_0x341b17[_0x9b0b('0x7e')]=Mustache[_0x9b0b('0x7f')](_0x3fc983[_0x9b0b('0x71')],_0x39cec7,{},['$$','$$']);if(_0x341b17['headers']){_0x341b17[_0x9b0b('0x7b')]=JSON[_0x9b0b('0x7a')](Mustache[_0x9b0b('0x7f')](JSON['stringify'](_0x341b17[_0x9b0b('0x7b')]),_0x39cec7,{},['$$','$$']));}if(_0x341b17[_0x9b0b('0x79')]){_0x341b17['body']=JSON[_0x9b0b('0x7a')](Mustache[_0x9b0b('0x7f')](JSON[_0x9b0b('0x80')](_0x341b17[_0x9b0b('0x79')]),_0x39cec7,{},['$$','$$']));}}catch(_0x27d00b){logger[_0x9b0b('0x5b')](_0x9b0b('0x81'),_0x27d00b);}}rp(_0x341b17)[_0x9b0b('0x14')](function(_0x40c624){var _0x4c4085={'statusCode':_0x40c624[_0x9b0b('0x82')]||0xc8,'statusMessage':_0x40c624[_0x9b0b('0x83')]||'OK','headers':_0x40c624[_0x9b0b('0x7b')]||{},'body':_0x40c624[_0x9b0b('0x79')]||{}};_0x2efcc3(null,_0x4c4085);})[_0x9b0b('0x17')](function(_0x2d3833){var _0x43e3a3={'statusCode':_0x2d3833[_0x9b0b('0x82')]||0x1f4,'statusMessage':_0x2d3833[_0x9b0b('0x84')]||_0x9b0b('0x85'),'headers':_0x2d3833['options'][_0x9b0b('0x7b')]||{},'body':_0x2d3833[_0x9b0b('0x86')]['body']||{}};_0x2efcc3(null,_0x43e3a3);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x87')]=function(_0xd104fe,_0x5e9e82){scripts['googleDialogflow'](this['channel']['uniqueid'],_0xd104fe[_0x9b0b('0x88')],_0xd104fe[_0x9b0b('0x69')],_0xd104fe[_0x9b0b('0x89')]||'en')[_0x9b0b('0x14')](function(_0x1050ec){_0x5e9e82(null,_0x1050ec);})['catch'](function(_0x153311){_0x5e9e82(_0x153311);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x8a')]=function(_0xd6ef98,_0x3e44e8){scripts['sestekNDA'](this['channel'],_0xd6ef98)[_0x9b0b('0x14')](function(_0x217a8d){_0x3e44e8(null,_0x217a8d);})[_0x9b0b('0x17')](function(_0x426ea9){_0x3e44e8(_0x426ea9);});};AGIVertices[_0x9b0b('0x12')]['ispeechTTS']=function(_0x30ebb9,_0x503cb2){scripts[_0x9b0b('0x8b')](_0x30ebb9[_0x9b0b('0x88')],_0x30ebb9[_0x9b0b('0x69')],_0x30ebb9[_0x9b0b('0x8c')]||'en-US',_0x30ebb9[_0x9b0b('0x8d')])['then'](function(_0x5dd1d5){_0x503cb2(null,_0x5dd1d5);})[_0x9b0b('0x17')](function(_0x465c5f){_0x503cb2(_0x465c5f);});};AGIVertices[_0x9b0b('0x12')]['ispeechASR']=function(_0x5d4ed2,_0x244e35,_0x370a7a){scripts[_0x9b0b('0x8e')](_0x244e35,_0x5d4ed2['key'],_0x5d4ed2[_0x9b0b('0x8f')]||_0x9b0b('0x6b'),this['isConfigured'](_0x5d4ed2[_0x9b0b('0x90')])?_0x5d4ed2[_0x9b0b('0x90')]:undefined)[_0x9b0b('0x14')](function(_0x39720d){_0x370a7a(null,_0x39720d);})[_0x9b0b('0x17')](function(_0xad8bd0){_0x370a7a(_0xad8bd0);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x91')]=function(_0x44ca9f,_0x361fd9){scripts[_0x9b0b('0x91')](_0x44ca9f[_0x9b0b('0x92')],_0x44ca9f[_0x9b0b('0x93')],_0x44ca9f['aws_polly_region'],_0x44ca9f[_0x9b0b('0x94')]||_0x9b0b('0x95'),_0x44ca9f[_0x9b0b('0x69')],_0x44ca9f['aws_text_type']||_0x9b0b('0x69'))[_0x9b0b('0x14')](function(_0x167cc3){_0x361fd9(null,_0x167cc3);})[_0x9b0b('0x17')](function(_0x2d6523){_0x361fd9(_0x2d6523);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x96')]=function(_0x32cd4b,_0x5771e7){scripts[_0x9b0b('0x96')](this['channel'][_0x9b0b('0x3c')],_0x32cd4b[_0x9b0b('0x92')],_0x32cd4b[_0x9b0b('0x93')],_0x32cd4b['aws_lex_region'],_0x32cd4b[_0x9b0b('0x69')],_0x32cd4b['aws_bot_name'])[_0x9b0b('0x14')](function(_0x42c19e){_0x5771e7(null,_0x42c19e);})[_0x9b0b('0x17')](function(_0x3b9c3c){_0x5771e7(_0x3b9c3c);});};AGIVertices['prototype'][_0x9b0b('0x97')]=function(_0x1fa8b3,_0x3a89e2,_0x105a58){scripts[_0x9b0b('0x97')](_0x3a89e2,_0x1fa8b3['key'],_0x1fa8b3[_0x9b0b('0x98')]||_0x9b0b('0x6b'))[_0x9b0b('0x14')](function(_0x2494fe){_0x105a58(null,_0x2494fe);})[_0x9b0b('0x17')](function(_0x2f38e2){_0x105a58(_0x2f38e2);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x99')]=function(_0x299e60,_0x38cb2e,_0x51fe92){scripts[_0x9b0b('0x99')](_0x38cb2e,_0x299e60[_0x9b0b('0x9a')],_0x299e60[_0x9b0b('0x9b')],_0x299e60[_0x9b0b('0x7e')])[_0x9b0b('0x14')](function(_0x2a74f6){_0x51fe92(null,_0x2a74f6);})[_0x9b0b('0x17')](function(_0x453c36){_0x51fe92(_0x453c36);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x9c')]=function(_0x51d212){var _0x132428=_[_0x9b0b('0x75')](verticesWithRetry,_0x51d212[_0x9b0b('0x9d')])?_0x51d212:_[_0x9b0b('0x9e')](_0x51d212);for(var _0x23c6ef in _0x132428){if(_0x132428['hasOwnProperty'](_0x23c6ef)){if(_0x132428[_0x23c6ef]&&_[_0x9b0b('0x9f')](_0x132428[_0x23c6ef])){if(_[_0x9b0b('0x75')](recursiveMapAttributes,_0x23c6ef)){_0x132428[_0x23c6ef]=this[_0x9b0b('0xa0')](_0x132428[_0x23c6ef]);}else{_0x132428[_0x23c6ef]=this[_0x9b0b('0xa1')](_0x132428[_0x23c6ef]);}}}}return _0x132428;};AGIVertices['prototype'][_0x9b0b('0xa2')]=function(_0x121d0d){for(var _0x14615d in _0x121d0d){if(_0x121d0d[_0x9b0b('0xa3')](_0x14615d)){if(_[_0x9b0b('0xa4')](_0x121d0d[_0x14615d])){this[_0x9b0b('0xa2')](_0x121d0d[_0x14615d]);}else if(_[_0x9b0b('0xa5')](_0x121d0d[_0x14615d])){for(var _0x2c6839=0x0;_0x2c6839<_0x121d0d[_0x14615d][_0x9b0b('0xa6')];_0x2c6839++){this[_0x9b0b('0xa2')](_0x121d0d[_0x14615d][_0x2c6839]);}}else if(_['isString'](_0x121d0d[_0x14615d])){_0x121d0d[_0x14615d]=this[_0x9b0b('0xa1')](_0x121d0d[_0x14615d]);}}}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xa7')]=function(_0x1f67a7,_0x4d3ccd){for(var _0x2272bb in _0x1f67a7){if(_0x1f67a7['hasOwnProperty'](_0x2272bb)){if(_[_0x9b0b('0xa4')](_0x1f67a7[_0x2272bb])){if(!_[_0x9b0b('0x50')](_0x1f67a7[_0x2272bb])){this[_0x9b0b('0xa7')](_0x1f67a7[_0x2272bb],util['format']('%s.%s',_0x4d3ccd,_0x2272bb));}}else if(_[_0x9b0b('0xa5')](_0x1f67a7[_0x2272bb])){for(var _0x37f3ca=0x0;_0x37f3ca<_0x1f67a7[_0x2272bb][_0x9b0b('0xa6')];_0x37f3ca++){this[_0x9b0b('0xa7')](_0x1f67a7[_0x2272bb][_0x37f3ca],util[_0x9b0b('0x2d')](_0x9b0b('0xa8'),_0x4d3ccd,_0x2272bb+'['+_0x37f3ca+']'));}}else{if(!_['isNil'](_0x1f67a7[_0x2272bb])){this['channel']['setVariable'](util['format'](_0x9b0b('0xa8'),_0x4d3ccd,_0x2272bb),_0x1f67a7[_0x2272bb]);}}}}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xa0')]=function(_0x772f82){try{var _0xc1d278=JSON[_0x9b0b('0x7a')](_0x772f82);this['recursiveNodeIndex'](_0xc1d278);return JSON['stringify'](_0xc1d278);}catch(_0x9a642){return this[_0x9b0b('0xa1')](_0x772f82);}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xa1')]=function(_0x32d1f5){console[_0x9b0b('0x49')]('replaceall\x20init',_0x32d1f5);var _0xb76b66=_0x32d1f5[_0x9b0b('0xa9')]('{');for(var _0x191c44=0x1;_0x191c44<_0xb76b66['length'];_0x191c44+=0x1){var _0x106e5e=_0xb76b66[_0x191c44][_0x9b0b('0xa9')]('}');console[_0x9b0b('0x49')](_0x9b0b('0xaa'),_0x106e5e);if(_0x106e5e[_0x9b0b('0xa6')]>0x1){_0x32d1f5=_0x32d1f5[_0x9b0b('0xab')]('{'+_0x106e5e[0x0]+'}',this[_0x9b0b('0x10')]['getVariable'](_0x106e5e[0x0])[_0x9b0b('0xac')]||_0x106e5e[0x0]);}}if(_0xb76b66[_0x9b0b('0xa6')]===0x1){return _0x32d1f5[_0x9b0b('0x58')]();}console[_0x9b0b('0x49')]('replaceall\x20end',_0x32d1f5);return this[_0x9b0b('0xa1')](_0x32d1f5);};AGIVertices['prototype'][_0x9b0b('0xad')]=function(_0x1de769,_0x2538be){var _0x50d0e4=this[_0x9b0b('0x10')]['getVariable'](_0x1de769);if(_0x50d0e4[_0x9b0b('0xae')]===-0x1){return _0x50d0e4;}logger['info'](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2538be,_0x50d0e4['extra']));return this['channel'][_0x9b0b('0xaf')](_0x2538be,_0x50d0e4[_0x9b0b('0xac')]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xb0')]=function(_0x474d4b){return _0x474d4b&&_0x474d4b!=='0'&&_0x474d4b!=='-1'&&_0x474d4b!=='';};AGIVertices[_0x9b0b('0x12')]['maxRetry']=function(_0x8c8728){this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x8c8728,'-');_0x8c8728['retry']=_0x8c8728[_0x9b0b('0xb2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x9b0b('0xb3')]=function(_0x91ac83){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xb4'),_0x91ac83[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x91ac83['text'])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('no\x20text\x20configured');}var _0x53f4dc='\x22'+_0x91ac83[_0x9b0b('0x69')]+'\x22';if(this['isConfigured'](_0x91ac83[_0x9b0b('0x86')])){_0x53f4dc+=','+_0x91ac83[_0x9b0b('0x86')];}var _0x2a85a5=this[_0x9b0b('0x10')][_0x9b0b('0x63')](_0x9b0b('0xb6'),_0x53f4dc);if(_0x2a85a5[_0x9b0b('0xae')]===-0x1){return _0x2a85a5;}return this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xb7'),_0x53f4dc));};AGIVertices['prototype'][_0x9b0b('0xb8')]=function(_0x3b4eb5){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xb9'),_0x3b4eb5[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x3b4eb5['grammar'])){return this['channel'][_0x9b0b('0xb5')](_0x9b0b('0xba'));}var _0x557926=_0x3b4eb5[_0x9b0b('0xbb')];if(this[_0x9b0b('0xb0')](_0x3b4eb5[_0x9b0b('0x86')])){_0x557926+=','+_0x3b4eb5[_0x9b0b('0x86')];}var _0x514269=this['channel']['exec'](_0x9b0b('0xbc'),_0x557926);if(_0x514269[_0x9b0b('0xae')]===-0x1){return _0x514269;}var _0x469f80=this[_0x9b0b('0xad')](_0x9b0b('0xbd'),'MRCP_RECOG_CONFIDENCE');if(_0x469f80[_0x9b0b('0xae')]===-0x1){return _0x469f80;}var _0x163294=this['getAndSetVariable'](_0x9b0b('0xbe'),'MRCP_RECOG_TRANSCRIPT');if(_0x163294[_0x9b0b('0xae')]===-0x1){return _0x163294;}var _0x46c103=this[_0x9b0b('0xad')](_0x9b0b('0xbf'),_0x9b0b('0xc0'));if(_0x46c103[_0x9b0b('0xae')]===-0x1){return _0x46c103;}return this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xc1'),_0x557926));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x8')]=function(_0x5566f3){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0xc2'),_0x5566f3['label']));return this['channel'][_0x9b0b('0x8')]([_0x5566f3['command'],_0x5566f3[_0x9b0b('0xc3')]]);};AGIVertices['prototype'][_0x9b0b('0xc4')]=function(_0x3c6910){logger['info'](util['format'](_0x9b0b('0xc5'),_0x3c6910[_0x9b0b('0x3d')]));if(this['isConfigured'](_0x3c6910['timeout'])){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0xc6'),_0x3c6910['timeout']));var _0x5956d3=this['channel'][_0x9b0b('0xc7')](_0x3c6910['timeout']);if(_0x5956d3[_0x9b0b('0xae')]===-0x1){return _0x5956d3;}}return this[_0x9b0b('0x10')][_0x9b0b('0xc4')]();};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x56')]=function(_0x59597a){console[_0x9b0b('0x49')](_0x9b0b('0xc8'),_0x59597a);logger['info'](util[_0x9b0b('0x2d')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x59597a[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x59597a[_0x9b0b('0x54')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x59597a,_0x9b0b('0xc9'));}_0x59597a[_0x9b0b('0x55')]=moment();if(this['isConfigured'](_0x59597a[_0x9b0b('0xca')])){_0x59597a[_0x9b0b('0x55')]=moment()[_0x9b0b('0xcb')](_0x59597a['delay'],'minutes');}if(!this[_0x9b0b('0xb0')](_0x59597a['callback_priority'])){_0x59597a['callback_priority']=0x2;}console[_0x9b0b('0x49')](_0x9b0b('0xcc'),_0x59597a);this[_0x9b0b('0x48')][_0x9b0b('0xb1')](this,_0x59597a);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x59597a[_0x9b0b('0xcd')],_0x59597a[_0x9b0b('0x54')],_0x59597a[_0x9b0b('0x55')]));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xce')]=function(_0x3e88e0){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xcf'),_0x3e88e0[_0x9b0b('0x3d')]));var _0x4474d6=this[_0x9b0b('0x10')]['exec'](_0x3e88e0['application'],_0x3e88e0[_0x9b0b('0x86')]);if(_0x4474d6[_0x9b0b('0xae')]===-0x1){return _0x4474d6;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xd0'),_0x3e88e0[_0x9b0b('0xd1')],_0x3e88e0['options']));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xd2')]=function(_0x577163){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x577163['label']));if(!this[_0x9b0b('0xb0')](_0x577163[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')]['noop']('no\x20text\x20configured');}var _0xbe5d21='\x22'+_0x577163[_0x9b0b('0x69')]+'\x22';if(this[_0x9b0b('0xb0')](_0x577163[_0x9b0b('0x86')])){_0xbe5d21+=','+_0x577163[_0x9b0b('0x86')];}var _0x1fa49f=this[_0x9b0b('0x10')][_0x9b0b('0x63')]('MRCPSynth',_0xbe5d21);if(_0x1fa49f[_0x9b0b('0xae')]===-0x1){return _0x1fa49f;}return this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xb7'),_0xbe5d21));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xd3')]=function(_0x3b5c8a){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3b5c8a['label']));if(!this[_0x9b0b('0xb0')](_0x3b5c8a[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}var _0x19efcd='\x22'+_0x3b5c8a[_0x9b0b('0x69')]+'\x22';if(this[_0x9b0b('0xb0')](_0x3b5c8a['options'])){_0x19efcd+=','+_0x3b5c8a['options'];}var _0x4fd8ee=this[_0x9b0b('0x10')]['exec'](_0x9b0b('0xb6'),_0x19efcd);if(_0x4fd8ee[_0x9b0b('0xae')]===-0x1){return _0x4fd8ee;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x19efcd));};AGIVertices[_0x9b0b('0x12')]['lumenvoxasr']=function(_0x1ee6ca){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0xd5'),_0x1ee6ca[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x1ee6ca[_0x9b0b('0xbb')])){return this[_0x9b0b('0x10')]['noop'](_0x9b0b('0xba'));}var _0x42043f=_0x1ee6ca['grammar'];if(this[_0x9b0b('0xb0')](_0x1ee6ca[_0x9b0b('0x86')])){_0x42043f+=','+_0x1ee6ca[_0x9b0b('0x86')];}var _0x557af8=this[_0x9b0b('0x10')]['exec'](_0x9b0b('0xbc'),_0x42043f);if(_0x557af8['result']===-0x1){return _0x557af8;}var _0x46daa2=this[_0x9b0b('0xad')](_0x9b0b('0xbd'),_0x9b0b('0xd6'));if(_0x46daa2['result']===-0x1){return _0x46daa2;}var _0xf10cbe=this['getAndSetVariable'](_0x9b0b('0xbe'),_0x9b0b('0xd7'));if(_0xf10cbe[_0x9b0b('0xae')]===-0x1){return _0xf10cbe;}var _0x35ad3e=this[_0x9b0b('0xad')](_0x9b0b('0xbf'),_0x9b0b('0xd8'));if(_0x35ad3e[_0x9b0b('0xae')]===-0x1){return _0x35ad3e;}return this['channel'][_0x9b0b('0xb5')](util['format'](_0x9b0b('0xc1'),_0x42043f));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xd9')]=function(_0x57d3df){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x57d3df['label']));if(!this[_0x9b0b('0xb0')](_0x57d3df['grammar'])){return this[_0x9b0b('0x10')]['noop']('no\x20grammar\x20configured');}var _0x2d2c1b=_0x57d3df[_0x9b0b('0xbb')];if(this[_0x9b0b('0xb0')](_0x57d3df[_0x9b0b('0x86')])){_0x2d2c1b+=','+_0x57d3df[_0x9b0b('0x86')];}var _0x5738bc=this[_0x9b0b('0x10')][_0x9b0b('0x63')](_0x9b0b('0xbc'),_0x2d2c1b);if(_0x5738bc[_0x9b0b('0xae')]===-0x1){return _0x5738bc;}var _0x425d68=this[_0x9b0b('0xad')](_0x9b0b('0xbd'),_0x9b0b('0xda'));if(_0x425d68['result']===-0x1){return _0x425d68;}var _0x349496=this[_0x9b0b('0xad')](_0x9b0b('0xbe'),_0x9b0b('0xdb'));if(_0x349496[_0x9b0b('0xae')]===-0x1){return _0x349496;}var _0x52c63d=this[_0x9b0b('0xad')](_0x9b0b('0xbf'),_0x9b0b('0xdc'));if(_0x52c63d[_0x9b0b('0xae')]===-0x1){return _0x52c63d;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0xc1'),_0x2d2c1b));};AGIVertices['prototype'][_0x9b0b('0xdd')]=function(_0x3e20bd){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0xde'),_0x3e20bd['label']));if(!this['isConfigured'](_0x3e20bd[_0x9b0b('0xdf')])){return this['channel'][_0x9b0b('0x5b')](_0x3e20bd,_0x9b0b('0xe0'));}var _0x3481cc=this[_0x9b0b('0x1a')][_0x9b0b('0xb1')](this,_0x3e20bd[_0x9b0b('0xdf')]);if(!_0x3481cc){return this[_0x9b0b('0x10')]['error'](_0x3e20bd,'no\x20odbc\x20database\x20found');}if(!this[_0x9b0b('0xb0')](_0x3e20bd[_0x9b0b('0x33')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x3e20bd,_0x9b0b('0xe1'));}var _0x21e382=_0x3e20bd[_0x9b0b('0x33')][_0x9b0b('0x65')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format']('query:\x20%s',_0x21e382));var _0x35dd17=this['getQueryOdbc'][_0x9b0b('0xb1')](this,_0x3481cc,_0x21e382);this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x3e20bd,_0x21e382);if(!this[_0x9b0b('0xb0')](_0x3e20bd[_0x9b0b('0xe2')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xe3'));}var _0x35bb4d=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x3e20bd[_0x9b0b('0xe2')]);if(!_0x35bb4d){return this['channel'][_0x9b0b('0x5b')](_0x3e20bd,_0x9b0b('0xe4'));}var _0x927f8d=this;_0x35dd17['forEach'](function(_0x1b3f74,_0x5b301b){Object[_0x9b0b('0xe5')](_0x1b3f74)['forEach'](function(_0x5ce2cb){_0x927f8d[_0x9b0b('0x10')][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0xe6'),_0x35bb4d,_0x5b301b,_0x5ce2cb),_0x1b3f74[_0x5ce2cb]);});});this[_0x9b0b('0x10')]['setVariable'](util[_0x9b0b('0x2d')]('%s_ROWS_COUNT',_0x35bb4d),_0x35dd17['length']);return this['channel']['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xe7'),_0x35bb4d));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xe8')]=function(_0x289ba8){logger['debug'](util['format'](_0x9b0b('0xe9'),_0x289ba8[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x289ba8[_0x9b0b('0xea')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x289ba8,'no\x20user\x20selected');}var _0x343d50=this['getUser'][_0x9b0b('0xb1')](this,_0x289ba8[_0x9b0b('0xea')]);if(!_0x343d50){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x289ba8,'no\x20user\x20found');}var _0x3d58a3=this[_0x9b0b('0x10')][_0x9b0b('0x63')]('DIAL',[util['format']('SIP/%s',_0x343d50),_0x289ba8[_0x9b0b('0x74')],_0x289ba8[_0x9b0b('0xeb')],_0x289ba8['url']]);if(_0x3d58a3['result']===-0x1){return _0x3d58a3;}return this[_0x9b0b('0x10')]['noop'](util['format']('Executed\x20command\x20%s',_0x9b0b('0xec')));};AGIVertices['prototype']['dialogflow']=function(_0x7abd4c){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xed'),_0x7abd4c[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x7abd4c['key'])){return this['channel'][_0x9b0b('0xb5')](_0x9b0b('0xee'));}if(!this[_0x9b0b('0xb0')](_0x7abd4c[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('no\x20text\x20configured');}this['channel'][_0x9b0b('0xef')]=!![];this[_0x9b0b('0x3b')](_0x7abd4c);this['createSquareMessage'](_0x7abd4c[_0x9b0b('0x69')],'in');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xf0'),_0x7abd4c['text']));var _0xeab0b1=this[_0x9b0b('0x87')]['sync'](this,_0x7abd4c);if(_0xeab0b1){for(var _0x28f9b3 in _0xeab0b1){if(_0xeab0b1[_0x9b0b('0xa3')](_0x28f9b3)){this['channel'][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0xf1'),_0x28f9b3[_0x9b0b('0x78')]()),_0xeab0b1[_0x28f9b3]);}}this['createSquareMessage'](_0xeab0b1[_0x9b0b('0xf2')],_0x9b0b('0xf3'));return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xf4'),_0xeab0b1[_0x9b0b('0xf2')]));}return this[_0x9b0b('0x10')]['error'](_0x7abd4c,_0x9b0b('0xf5'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xf6')]=function(_0x2bbaf9){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xf7'),_0x2bbaf9[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x2bbaf9[_0x9b0b('0xf8')])){return this[_0x9b0b('0x10')]['noop'](_0x9b0b('0xf9'));}if(!this[_0x9b0b('0xb0')](_0x2bbaf9[_0x9b0b('0xfa')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xfb'));}if(!this['isConfigured'](_0x2bbaf9[_0x9b0b('0xfc')])){return this[_0x9b0b('0x10')]['noop']('no\x20password\x20configured');}if(!this[_0x9b0b('0xb0')](_0x2bbaf9[_0x9b0b('0xfd')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}this[_0x9b0b('0x10')][_0x9b0b('0xef')]=!![];this['createSquareDetailsReport'](_0x2bbaf9);this['createSquareMessage'](_0x2bbaf9['text'],'in');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xfe'),_0x2bbaf9[_0x9b0b('0x69')]));var _0x47c833=this[_0x9b0b('0x8a')][_0x9b0b('0xb1')](this,_0x2bbaf9);if(_0x47c833){for(var _0x530f33 in _0x47c833){if(_0x47c833[_0x9b0b('0xa3')](_0x530f33)){this[_0x9b0b('0x10')][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0xff'),_0x530f33[_0x9b0b('0x78')]()),_0x47c833[_0x530f33]);}}this[_0x9b0b('0x47')](_0x47c833[_0x9b0b('0xf2')],_0x9b0b('0xf3'));if(_0x47c833[_0x9b0b('0x100')]){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x101'),_0x47c833[_0x9b0b('0x100')]));var _0x33d1cf=this[_0x9b0b('0x10')][_0x9b0b('0x102')](_0x47c833[_0x9b0b('0x100')]);try{fs[_0x9b0b('0x103')](_0x47c833[_0x9b0b('0x100')]+_0x9b0b('0x104'));}catch(_0x1ec712){logger[_0x9b0b('0x5b')](_0x1ec712);}return _0x33d1cf;}else{return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x105'),_0x47c833[_0x9b0b('0xf2')]));}}return this['channel'][_0x9b0b('0x5b')](_0x2bbaf9,_0x9b0b('0x106'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x107')]=function(_0x2217a7){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x108'),_0x2217a7['label']));return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('end');};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x109')]=function(_0x567267){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x10a'),_0x567267[_0x9b0b('0x3d')]));var _0x2405b7='';if(_0x567267['trunk_id']){if(!this[_0x9b0b('0xb0')](_0x567267[_0x9b0b('0x10b')])){return this['channel'][_0x9b0b('0x5b')](_0x567267,_0x9b0b('0x10c'));}else{var _0x2df181=parseInt(_0x567267[_0x9b0b('0x10b')],0xa);if(isNaN(_0x2df181)){_0x2405b7=_0x567267[_0x9b0b('0x10b')];}else{_0x2405b7=this['getTrunk'][_0x9b0b('0xb1')](this,_0x567267['trunk_id']);if(!_0x2405b7){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x567267,_0x9b0b('0x10d'));}}}}else if(_0x567267[_0x9b0b('0x10e')]){_0x2405b7=_0x567267[_0x9b0b('0x10e')];}else{return this['channel'][_0x9b0b('0x5b')](_0x567267,_0x9b0b('0x10c'));}var _0x62e97d=this[_0x9b0b('0x10')][_0x9b0b('0x63')](_0x9b0b('0xec'),[util[_0x9b0b('0x2d')](_0x9b0b('0x10f'),_0x2405b7,_0x567267[_0x9b0b('0xcd')]),_0x567267[_0x9b0b('0x74')],_0x567267[_0x9b0b('0xeb')],_0x567267[_0x9b0b('0x71')]]);if(_0x62e97d[_0x9b0b('0xae')]===-0x1){return _0x62e97d;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x110'),_0x9b0b('0xec')));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x111')]=function(_0x10ada9){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x112'),_0x10ada9['label']));return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('finally');};AGIVertices[_0x9b0b('0x12')]['getdigits']=function(_0x2b7f9b){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x113'),_0x2b7f9b[_0x9b0b('0x3d')]));if(_0x2b7f9b[_0x9b0b('0x114')]===0x0){return this[_0x9b0b('0xb2')](_0x2b7f9b);}_0x2b7f9b[_0x9b0b('0x114')]-=0x1;if(!this[_0x9b0b('0xb0')](_0x2b7f9b[_0x9b0b('0x115')])){return this['channel'][_0x9b0b('0x5b')](_0x2b7f9b,_0x9b0b('0x116'));}var _0x1e4386=this[_0x9b0b('0x20')][_0x9b0b('0xb1')](this,_0x2b7f9b['file_id']);if(!_0x1e4386){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x2b7f9b,_0x9b0b('0x117'));}if(!this[_0x9b0b('0xb0')](_0x2b7f9b[_0x9b0b('0xe2')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x9b0b('0xe3'));}var _0x5eb1c9=this[_0x9b0b('0x10')]['getData'](_0x1e4386,_0x2b7f9b['response'],_0x2b7f9b[_0x9b0b('0x118')]);var _0x325607=_0x5eb1c9[_0x9b0b('0xae')]?_0x5eb1c9[_0x9b0b('0xae')][_0x9b0b('0x58')]():'';logger[_0x9b0b('0x31')](_0x9b0b('0x119'),JSON[_0x9b0b('0x80')](_0x5eb1c9));if(_0x5eb1c9[_0x9b0b('0xae')]===-0x1){this[_0x9b0b('0x3b')]['sync'](this,_0x2b7f9b,_0x325607);return _0x5eb1c9;}else if(_0x5eb1c9[_0x9b0b('0xac')]===_0x9b0b('0x74')){_0x5eb1c9[_0x9b0b('0xae')]=_0x325607[_0x9b0b('0xa6')]>=parseInt(_0x2b7f9b[_0x9b0b('0x11a')])?'x':'i';}else{_0x5eb1c9[_0x9b0b('0xae')]=_0x325607[_0x9b0b('0xa6')]>=parseInt(_0x2b7f9b[_0x9b0b('0x11a')])&&_0x325607['length']<=parseInt(_0x2b7f9b[_0x9b0b('0x118')])?'x':'i';}var _0x1e5bdb=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x2b7f9b[_0x9b0b('0xe2')]);if(!_0x1e5bdb){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x2b7f9b,_0x9b0b('0xe4'));}this[_0x9b0b('0x10')][_0x9b0b('0xaf')](_0x1e5bdb,_0x325607);if(this['isConfigured'](_0x2b7f9b['hiddendigitsnum'])){var _0x250129=parseInt(_0x2b7f9b[_0x9b0b('0x11b')],0xa);var _0x19e3be=rs[_0x9b0b('0x11c')]({'charset':'*','length':_0x250129});var _0x1659e0=_0x325607['length'];if(_0x1659e0>0x0){if(_0x1659e0>_0x250129){this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x2b7f9b,_0x2b7f9b[_0x9b0b('0x11d')]===_0x9b0b('0x11e')?_0x19e3be+_0x325607[_0x9b0b('0x11f')](_0x250129):_0x325607[_0x9b0b('0x11f')](0x0,_0x1659e0-_0x250129)+_0x19e3be);}else{this['createSquareDetailsReport']['sync'](this,_0x2b7f9b,rs[_0x9b0b('0x11c')]({'charset':'*','length':_0x1659e0}));}}else{this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x2b7f9b,'');}}else{this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x2b7f9b,_0x325607);}return _0x5eb1c9;};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xf')]=function(_0x1272b1){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1272b1[_0x9b0b('0x3d')]));return this[_0x9b0b('0x120')](_0x1272b1);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x121')]=function(_0x57c996){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x57c996['label']));this['createSquareDetailsReport'][_0x9b0b('0xb1')](this,_0x57c996,_0x57c996[_0x9b0b('0x122')]);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format']('GOAL\x20%s',_0x57c996[_0x9b0b('0x122')]));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x123')]=function(_0x3dd3fe){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x124'),_0x3dd3fe[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x3dd3fe[_0x9b0b('0x92')])||!this[_0x9b0b('0xb0')](_0x3dd3fe[_0x9b0b('0x93')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x125'));}if(!this[_0x9b0b('0xb0')](_0x3dd3fe[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x126'),_0x3dd3fe[_0x9b0b('0x69')]));var _0x59f865=this['awsPolly']['sync'](this,_0x3dd3fe);if(_0x59f865){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x127'),_0x59f865));var _0x32e4fc=this[_0x9b0b('0x10')][_0x9b0b('0x102')](_0x59f865);try{fs[_0x9b0b('0x103')](_0x59f865+_0x9b0b('0x104'));}catch(_0x37fd63){logger['error'](_0x37fd63);}return _0x32e4fc;}return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x3dd3fe,_0x9b0b('0x128'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x129')]=function(_0x26c5c6){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x12a'),_0x26c5c6[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x26c5c6[_0x9b0b('0x92')])||!this[_0x9b0b('0xb0')](_0x26c5c6[_0x9b0b('0x93')])){return this[_0x9b0b('0x10')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x26c5c6[_0x9b0b('0x12b')])){return this['channel'][_0x9b0b('0xb5')]('no\x20bot\x20name\x20configured');}if(!this[_0x9b0b('0xb0')](_0x26c5c6[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}this[_0x9b0b('0x10')]['bot']=!![];this[_0x9b0b('0x3b')](_0x26c5c6);this[_0x9b0b('0x47')](_0x26c5c6[_0x9b0b('0x69')],'in');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x12c'),_0x26c5c6[_0x9b0b('0x69')]));var _0x2b4bc0=this[_0x9b0b('0x96')][_0x9b0b('0xb1')](this,_0x26c5c6);if(_0x2b4bc0){for(var _0x4d3795 in _0x2b4bc0){if(_0x2b4bc0['hasOwnProperty'](_0x4d3795)&&_[_0x9b0b('0x9f')](_0x2b4bc0[_0x4d3795])){this[_0x9b0b('0x10')][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0x12d'),_0x4d3795[_0x9b0b('0x78')]()),_0x2b4bc0[_0x4d3795]);}}if(_[_0x9b0b('0x4c')](_0x2b4bc0[_0x9b0b('0x84')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x12e'));}else{this[_0x9b0b('0x47')](_0x2b4bc0[_0x9b0b('0x84')],_0x9b0b('0xf3'));return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x12f'),_0x2b4bc0[_0x9b0b('0x84')]));}}return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x26c5c6,_0x9b0b('0x130'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x131')]=function(_0x1ea04f){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x132'),_0x1ea04f['label'],_0x1ea04f['timeout']));if(!this['isConfigured'](_0x1ea04f[_0x9b0b('0x88')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('no\x20key\x20configured');}var _0x1ed0f9='wav';var _0x12c9b7=util['format'](_0x9b0b('0x133'),FILES_PATH,rs['generate'](0x4));var _0x5e4115=util[_0x9b0b('0x2d')](_0x9b0b('0xa8'),_0x12c9b7,_0x1ed0f9);var _0x37d522=!![];if(_0x1ea04f[_0x9b0b('0x134')]===_0x9b0b('0x135')){_0x37d522=![];}var _0x13a796=this[_0x9b0b('0x10')][_0x9b0b('0x136')](_0x12c9b7,_0x1ed0f9,_0x1ea04f[_0x9b0b('0x137')],_0x1ea04f[_0x9b0b('0x74')],undefined,_0x37d522);if(_0x13a796[_0x9b0b('0xae')]!==-0x1){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x138'),_0x5e4115));var _0x2e6330=this['googleASR'][_0x9b0b('0xb1')](this,_0x1ea04f,_0x5e4115);if(_0x2e6330){for(var _0x1b4951 in _0x2e6330){if(_0x2e6330[_0x9b0b('0xa3')](_0x1b4951)){this[_0x9b0b('0x10')][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')]('GOOGLE_ASR_%s',_0x1b4951[_0x9b0b('0x78')]()),_0x2e6330[_0x1b4951]);}}return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x139'),JSON['stringify'](_0x2e6330)));}}return _0x13a796;};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x13a')]=function(_0x467845){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x13b'),_0x467845[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x467845[_0x9b0b('0x9a')])){return this['channel'][_0x9b0b('0xb5')](_0x9b0b('0x13c'));}if(!this[_0x9b0b('0xb0')](_0x467845[_0x9b0b('0x9b')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x13d'));}var _0x582b7a='wav';var _0x41c0eb=util[_0x9b0b('0x2d')](_0x9b0b('0x133'),FILES_PATH,rs[_0x9b0b('0x11c')](0x4));var _0x4972cf=util[_0x9b0b('0x2d')](_0x9b0b('0xa8'),_0x41c0eb,_0x582b7a);var _0x237dca=!![];if(_0x467845[_0x9b0b('0x134')]===_0x9b0b('0x135')){_0x237dca=![];}var _0x447c2e=this[_0x9b0b('0x10')][_0x9b0b('0x136')](_0x41c0eb,_0x582b7a,_0x467845[_0x9b0b('0x137')],_0x467845['timeout'],undefined,_0x237dca);if(_0x447c2e[_0x9b0b('0xae')]!==-0x1){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('tilde\x20%s\x20file\x20created',_0x4972cf));var _0x49b34e=this[_0x9b0b('0x99')][_0x9b0b('0xb1')](this,_0x467845,_0x4972cf);if(_0x49b34e){for(var _0x3b0c0f in _0x49b34e){if(_0x49b34e[_0x9b0b('0xa3')](_0x3b0c0f)){this['channel'][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0x13e'),_0x3b0c0f['toUpperCase']()),_0x49b34e[_0x3b0c0f]);}}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x13f'),JSON[_0x9b0b('0x80')](_0x49b34e)));}}return _0x447c2e;};AGIVertices[_0x9b0b('0x12')]['gotoc']=function(_0x15adaa){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x140'),_0x15adaa[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0x141')](_0x15adaa[_0x9b0b('0x42')],_0x15adaa[_0x9b0b('0x43')],_0x15adaa['priority']);};AGIVertices[_0x9b0b('0x12')]['gotoif']=function(_0x5e903d){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x5e903d[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x5e903d[_0x9b0b('0x142')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x5e903d,_0x9b0b('0x143'));}try{var _0x5df7ef=eval(_0x5e903d['condition'])?_0x9b0b('0x144'):_0x9b0b('0x145');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x146'),_0x5e903d['condition'],_0x5df7ef));return{'code':0xc8,'result':_0x5df7ef};}catch(_0x4404ec){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x147')]=function(_0x54975d){logger[_0x9b0b('0x31')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x54975d[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x54975d[_0x9b0b('0x148')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x54975d,_0x9b0b('0x149'));}var _0x2494a2=this[_0x9b0b('0x27')]['sync'](this,_0x54975d[_0x9b0b('0x148')]);if(!_0x2494a2){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x54975d,_0x9b0b('0x14a'));}for(var _0x85799c=0x0;_0x85799c<_0x2494a2[_0x9b0b('0xa6')];_0x85799c+=0x1){var _0xed918=this[_0x9b0b('0x10')][_0x9b0b('0x13')](util['format'](_0x9b0b('0x14b'),_0x2494a2[_0x85799c]));if(_0xed918[_0x9b0b('0xae')]===-0x1){return _0xed918;}logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x14c'),_0x2494a2[_0x85799c],_0xed918[_0x9b0b('0xac')]));if(_0xed918[_0x9b0b('0xac')]===_0x9b0b('0x144')){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x14c'),_0x2494a2[_0x85799c],'true'));this['channel']['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0x14c'),_0x2494a2[_0x85799c],'true'));return{'code':0xc8,'result':_0x9b0b('0x144')};}else{logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x14c'),_0x2494a2[_0x85799c],_0x9b0b('0x145')));this[_0x9b0b('0x10')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x2494a2[_0x85799c],_0x9b0b('0x145')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x14d')]=function(_0x1c95cc){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x14e'),_0x1c95cc[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0x14d')]();};AGIVertices[_0x9b0b('0x12')]['ispeechasr']=function(_0x21d18d){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x14f'),_0x21d18d[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x21d18d[_0x9b0b('0x88')])){return this['channel'][_0x9b0b('0xb5')]('no\x20key\x20configured');}var _0x4512d2=_0x9b0b('0x150');var _0x27c46d=util[_0x9b0b('0x2d')](_0x9b0b('0x133'),FILES_PATH,rs[_0x9b0b('0x11c')](0x4));var _0x208116=util[_0x9b0b('0x2d')](_0x9b0b('0xa8'),_0x27c46d,_0x4512d2);var _0x188059=!![];if(_0x21d18d[_0x9b0b('0x134')]===_0x9b0b('0x135')){_0x188059=![];}var _0x2cea64=this[_0x9b0b('0x10')][_0x9b0b('0x136')](_0x27c46d,_0x4512d2,_0x21d18d[_0x9b0b('0x137')],_0x21d18d['timeout'],undefined,_0x188059);if(_0x2cea64['result']!==-0x1){this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x151'),_0x208116));var _0x179a77=this[_0x9b0b('0x8e')][_0x9b0b('0xb1')](this,_0x21d18d,_0x208116);if(_0x179a77){for(var _0x31c672 in _0x179a77){if(_0x179a77[_0x9b0b('0xa3')](_0x31c672)){this[_0x9b0b('0x10')]['setVariable'](util[_0x9b0b('0x2d')](_0x9b0b('0x152'),_0x31c672['toUpperCase']()),_0x179a77[_0x31c672]);}}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x153'),JSON[_0x9b0b('0x80')](_0x179a77)));}}return _0x2cea64;};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x154')]=function(_0x341b68){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x155'),_0x341b68['label']));if(!this[_0x9b0b('0xb0')](_0x341b68[_0x9b0b('0x88')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xee'));}if(!this[_0x9b0b('0xb0')](_0x341b68[_0x9b0b('0x69')])){return this['channel'][_0x9b0b('0xb5')]('no\x20text\x20configured');}this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x156'),_0x341b68[_0x9b0b('0x69')]));var _0x2e057c=this['ispeechTTS'][_0x9b0b('0xb1')](this,_0x341b68);if(_0x2e057c){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x151'),_0x2e057c));var _0x7287ff=this['channel'][_0x9b0b('0x102')](_0x2e057c,_0x341b68[_0x9b0b('0x137')]);try{fs[_0x9b0b('0x103')](_0x2e057c+_0x9b0b('0x104'));}catch(_0x3bae3e){logger[_0x9b0b('0x5b')](_0x3bae3e);}return _0x7287ff;}return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x341b68,_0x9b0b('0x157'));};AGIVertices['prototype'][_0x9b0b('0x158')]=function(_0xc2ec96){logger[_0x9b0b('0x31')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xc2ec96['label']));if(!this[_0x9b0b('0xb0')](_0xc2ec96[_0x9b0b('0x159')])){return this['channel'][_0x9b0b('0x5b')](_0xc2ec96,_0x9b0b('0x15a'));}logger[_0x9b0b('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9b0b('0x10')]['callerid'],_0xc2ec96[_0x9b0b('0x159')]));var _0x2ebfcf=this[_0x9b0b('0x5e')][_0x9b0b('0xb1')](this,_0xc2ec96[_0x9b0b('0x159')]);if(_0x2ebfcf){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0xc2ec96['findBy']));this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0x15b'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0xc2ec96[_0x9b0b('0x159')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0xc2ec96[_0x9b0b('0x159')]));this['channel']['noop'](util['format'](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0xc2ec96['findBy']));return{'code':0xc8,'result':_0x9b0b('0x15d')};}};AGIVertices[_0x9b0b('0x12')]['logout']=function(_0x3ea5cb){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x15e'),_0x3ea5cb['label']));if(!this[_0x9b0b('0xb0')](_0x3ea5cb[_0x9b0b('0x159')])){return this['channel']['error'](_0x3ea5cb,_0x9b0b('0x15a'));}logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x15f'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x3ea5cb['findBy']));var _0x40acf4=this[_0x9b0b('0x5d')][_0x9b0b('0xb1')](this,_0x3ea5cb[_0x9b0b('0x159')]);if(_0x40acf4){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x15b'),this[_0x9b0b('0x10')]['callerid'],_0x3ea5cb[_0x9b0b('0x159')]));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x15b'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x3ea5cb[_0x9b0b('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x3ea5cb['findBy']));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x3ea5cb[_0x9b0b('0x159')]));return{'code':0xc8,'result':_0x9b0b('0x15d')};}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x160')]=function(_0x357435){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x161'),_0x357435[_0x9b0b('0x3d')]));if(!this['isConfigured'](_0x357435[_0x9b0b('0x162')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x357435,_0x9b0b('0x163'));}this[_0x9b0b('0x10')]['noop'](util['format'](_0x9b0b('0x164'),_0x357435[_0x9b0b('0x162')]));var _0x26a2a9=eval(_0x357435['operation']);if(!this[_0x9b0b('0xb0')](_0x357435[_0x9b0b('0xe2')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xe3'));}var _0x27873d=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x357435['variable_id']);if(!_0x27873d){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x357435,_0x9b0b('0xe4'));}if(_[_0x9b0b('0xa5')](_0x26a2a9)){var _0xbe0fd6=this;_0x26a2a9[_0x9b0b('0x165')](function(_0x3f2f4e,_0x381464){_0xbe0fd6[_0x9b0b('0x10')][_0x9b0b('0xaf')](util['format'](_0x9b0b('0x166'),_0x27873d,_0x381464),_0x3f2f4e);});return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x167'),_0x27873d));}else{return this[_0x9b0b('0x10')]['setVariable'](_0x27873d,_0x26a2a9);}};AGIVertices['prototype'][_0x9b0b('0x168')]=function(_0xffd521){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x169'),_0xffd521[_0x9b0b('0x3d')]));if(_0xffd521[_0x9b0b('0x114')]===0x0){return this[_0x9b0b('0xb2')](_0xffd521);}_0xffd521[_0x9b0b('0x114')]-=0x1;if(!this[_0x9b0b('0xb0')](_0xffd521[_0x9b0b('0x115')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0xffd521,'no\x20file\x20audio\x20selected');}var _0x3431fd=this[_0x9b0b('0x20')]['sync'](this,_0xffd521[_0x9b0b('0x115')]);if(!_0x3431fd){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0xffd521,_0x9b0b('0x117'));}var _0x576337=this[_0x9b0b('0x10')][_0x9b0b('0x16a')](_0x3431fd,_0xffd521['response'],_0xffd521[_0x9b0b('0x16b')]);var _0x1cd5e3=_0x576337[_0x9b0b('0xae')];if(_0x576337['result']===-0x1){this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0xffd521,'-1');return _0x576337;}else if(_0x576337[_0x9b0b('0xac')]===_0x9b0b('0x74')){_0x576337['result']=_0x576337[_0x9b0b('0xae')][_0x9b0b('0xa6')]>0x0?_0x576337[_0x9b0b('0xae')]:'t';}else if(_[_0x9b0b('0x50')](_0x576337['result'])){_0x576337[_0x9b0b('0xae')]='#';_0x1cd5e3='#';}if(!this[_0x9b0b('0xb0')](_0xffd521[_0x9b0b('0xe2')])){this[_0x9b0b('0x10')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x24aa05=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0xffd521[_0x9b0b('0xe2')]);if(!_0x24aa05){return this['channel'][_0x9b0b('0x5b')](_0xffd521,_0x9b0b('0xe4'));}this['channel']['setVariable'](_0x24aa05,_0x1cd5e3);}this['createSquareDetailsReport'][_0x9b0b('0xb1')](this,_0xffd521,_0x1cd5e3);return _0x576337;};AGIVertices[_0x9b0b('0x12')]['noop']=function(_0x4187fa){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x16c'),_0x4187fa[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x4187fa[_0x9b0b('0x16d')]||_0x4187fa[_0x9b0b('0x3d')]);};AGIVertices[_0x9b0b('0x12')]['pause']=function(_0x465c58){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x16e'),_0x465c58[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x465c58[_0x9b0b('0x159')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x465c58,_0x9b0b('0x15a'));}logger['info'](util[_0x9b0b('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x465c58['findBy']));var _0x26b9cb=this[_0x9b0b('0x16f')]['sync'](this,_0x465c58[_0x9b0b('0x170')]);var _0x3b6a8c=this['agentPause']['sync'](this,_0x465c58[_0x9b0b('0x159')],_0x26b9cb);if(_0x3b6a8c){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x465c58[_0x9b0b('0x159')]));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x15b'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x465c58[_0x9b0b('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x465c58[_0x9b0b('0x159')]));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x465c58[_0x9b0b('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x9b0b('0x171')]=function(_0x134d15){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x172'),_0x134d15[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x134d15[_0x9b0b('0x115')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x134d15,_0x9b0b('0x116'));}var _0x3d40f7=this[_0x9b0b('0x20')][_0x9b0b('0xb1')](this,_0x134d15[_0x9b0b('0x115')]);if(!_0x3d40f7){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x134d15,'no\x20file\x20audio\x20found');}var _0x41c33e=this[_0x9b0b('0x10')]['exec'](_0x9b0b('0x173'),[_0x3d40f7,_0x134d15['opts']]);if(_0x41c33e[_0x9b0b('0xae')]===-0x1){return _0x41c33e;}return this['channel']['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xd0'),_0x9b0b('0x173'),_0x3d40f7));};AGIVertices['prototype'][_0x9b0b('0x174')]=function(_0x47e693){logger[_0x9b0b('0x31')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x47e693[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x47e693[_0x9b0b('0x175')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x47e693,'no\x20queue\x20selected');}var _0x47ec14='';var _0x247ecb=parseInt(_0x47e693[_0x9b0b('0x175')],0xa);if(isNaN(_0x247ecb)){_0x47ec14=_0x47e693[_0x9b0b('0x175')];}else{_0x47ec14=this[_0x9b0b('0x176')][_0x9b0b('0xb1')](this,_0x47e693[_0x9b0b('0x175')]);if(!_0x47ec14){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x47e693,_0x9b0b('0x177'));}}var _0x43b623='';if(this[_0x9b0b('0xb0')](_0x47e693[_0x9b0b('0x115')])){var _0x4e0748=this[_0x9b0b('0x20')]['sync'](this,_0x47e693[_0x9b0b('0x115')]);if(_0x4e0748){_0x43b623=_0x4e0748;}}this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x47e693,_0x47ec14);if(_0x47e693[_0x9b0b('0xeb')][_0x9b0b('0x178')]('x')<0x0){_0x47e693['opts']+='x';}if(_0x47e693[_0x9b0b('0xeb')][_0x9b0b('0x178')]('X')<0x0){_0x47e693['opts']+='X';}this[_0x9b0b('0x10')][_0x9b0b('0xaf')]('XMCS-QUEUE',_0x47ec14?_0x47ec14[_0x9b0b('0x179')]():'');var _0x3d77e0=this[_0x9b0b('0x10')][_0x9b0b('0x63')]('QUEUE',[_0x47ec14,_0x47e693[_0x9b0b('0xeb')],_0x47e693['url'],_0x43b623,_0x47e693[_0x9b0b('0x74')],_0x47e693[_0x9b0b('0x8')],_0x47e693['macro'],_0x47e693[_0x9b0b('0x17a')],'',_0x47e693[_0x9b0b('0x17b')]]);if(_0x3d77e0['result']===-0x1){return _0x3d77e0;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xd0'),'QUEUE',_0x47ec14));};AGIVertices[_0x9b0b('0x12')]['record']=function(_0x436c8f){logger['info'](util['format'](_0x9b0b('0x17c'),_0x436c8f[_0x9b0b('0x3d')]));var _0x3c4c9c=_0x436c8f[_0x9b0b('0x17d')]||_0x9b0b('0x150');var _0x3a8099=util[_0x9b0b('0x2d')](_0x9b0b('0x17e'),this[_0x9b0b('0x10')]['uniqueid'],rs[_0x9b0b('0x11c')](0x5));var _0x2d42f1=util['format'](_0x9b0b('0x17f'),FILES_PATH,_0x3a8099,_0x3c4c9c);var _0x12d441=util[_0x9b0b('0x2d')](_0x9b0b('0x133'),FILES_PATH,_0x3a8099);this[_0x9b0b('0x40')][_0x9b0b('0xb1')](this,_0x436c8f,_0x3a8099,_0x2d42f1);this[_0x9b0b('0x10')][_0x9b0b('0xaf')](_0x9b0b('0x180'),_0x3a8099);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x12d441,_0x3c4c9c,_0x436c8f[_0x9b0b('0x181')],_0x436c8f[_0x9b0b('0x74')]);return this['channel']['recordFile'](_0x12d441,_0x3c4c9c,_0x436c8f[_0x9b0b('0x181')],_0x436c8f['timeout'],undefined,!![]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x182')]=function(_0x35b5e6){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x183'),_0x35b5e6[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x35b5e6[_0x9b0b('0x71')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x184'));}var _0xfa5435=this[_0x9b0b('0x70')][_0x9b0b('0xb1')](this,_0x35b5e6);logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x185'),util[_0x9b0b('0x186')](_0xfa5435,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x35b5e6['variable_id'])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x187'));}var _0x5dcae=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x35b5e6[_0x9b0b('0xe2')]);if(!_0x5dcae){return this['channel'][_0x9b0b('0x5b')](_0x35b5e6,'no\x20variable\x20found');}this['channel']['setVariable'](util[_0x9b0b('0x2d')]('%s_STATUS_CODE',_0x5dcae),_0xfa5435[_0x9b0b('0x82')]?_0xfa5435[_0x9b0b('0x82')]:_0x9b0b('0x188'));this[_0x9b0b('0x10')]['setVariable'](util[_0x9b0b('0x2d')](_0x9b0b('0x189'),_0x5dcae),_0xfa5435['statusMessage']?_0xfa5435['statusMessage']:'OK');if(_0xfa5435[_0x9b0b('0x79')]){try{this[_0x9b0b('0xa7')](_0xfa5435['body'],_0x5dcae);}catch(_0x20bd21){logger['error'](util['format'](_0x9b0b('0x18a'),_0x5dcae));}}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('variable\x20%s\x20set',_0x5dcae));};AGIVertices['prototype']['saydigits']=function(_0x150514){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x18b'),_0x150514[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0x18c')](_0x150514[_0x9b0b('0x18d')][_0x9b0b('0x65')](/\s+/g,''),_0x150514[_0x9b0b('0x181')]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x18e')]=function(_0x3ec32f){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x18f'),_0x3ec32f[_0x9b0b('0x3d')]));return this['channel'][_0x9b0b('0x190')](_0x3ec32f[_0x9b0b('0x73')][_0x9b0b('0x65')](/\s+/g,''),_0x3ec32f['escape_digits']);};AGIVertices[_0x9b0b('0x12')]['sayphonetic']=function(_0x5ce9ff){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x191'),_0x5ce9ff[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0x192')](_0x5ce9ff[_0x9b0b('0x69')],_0x5ce9ff[_0x9b0b('0x181')]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x193')]=function(_0x5cef28){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x194'),_0x5cef28[_0x9b0b('0x3d')]));if(!this['isConfigured'](_0x5cef28[_0x9b0b('0x195')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x196'));}var _0xd8ac5f=this[_0x9b0b('0x24')][_0x9b0b('0xb1')](this,_0x5cef28[_0x9b0b('0x195')]);if(!_0xd8ac5f||!_0xd8ac5f[_0x9b0b('0x197')]){return this['channel'][_0x9b0b('0x5b')](_0x5cef28,_0x9b0b('0x198'));}var _0x1a55ef={'from':util[_0x9b0b('0x2d')](_0x9b0b('0x199'),_0xd8ac5f['name'],_0xd8ac5f['email']||_0xd8ac5f['Smtp']['user']),'to':_0x5cef28['to']||'','cc':_0x5cef28['cc']||'','bcc':_0x5cef28['bcc']||'','subject':_0x5cef28[_0x9b0b('0x19a')],'html':_0x5cef28[_0x9b0b('0x69')],'text':_0x5cef28[_0x9b0b('0x69')]};var _0x4a7501={'tls':{'rejectUnauthorized':![]}};if(_0xd8ac5f[_0x9b0b('0x197')][_0x9b0b('0x19b')]){_0x4a7501[_0x9b0b('0x19b')]=_0xd8ac5f['Smtp'][_0x9b0b('0x19b')];}else{_0x4a7501[_0x9b0b('0x19c')]=_0xd8ac5f[_0x9b0b('0x197')][_0x9b0b('0x19c')];_0x4a7501[_0x9b0b('0x19d')]=_0xd8ac5f[_0x9b0b('0x197')]['port'];_0x4a7501[_0x9b0b('0x19e')]=_0xd8ac5f[_0x9b0b('0x197')][_0x9b0b('0x19e')];}if(_0xd8ac5f[_0x9b0b('0x197')][_0x9b0b('0x19f')]){_0x4a7501[_0x9b0b('0x1a0')]={'user':_0xd8ac5f['Smtp'][_0x9b0b('0x1a1')],'pass':_0xd8ac5f[_0x9b0b('0x197')]['pass']};}if(this[_0x9b0b('0xb0')](_0x5cef28['template_id'])){}logger[_0x9b0b('0x1a2')](_0x9b0b('0x1a3'),JSON[_0x9b0b('0x80')](_0x1a55ef));this['createSquareDetailsReport'][_0x9b0b('0xb1')](this,_0x5cef28,_0x5cef28[_0x9b0b('0x195')]);this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1a4'),_0xd8ac5f[_0x9b0b('0x15')]));this[_0x9b0b('0x26')]['sync'](this,_0x4a7501,_0x1a55ef);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['sendFax']=function(_0x3d395e){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x1a5'),_0x3d395e['label']));return this[_0x9b0b('0x10')]['noop'](_0x9b0b('0x1a6'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1a7')]=function(_0x4c80f4){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x1a8'),_0x4c80f4['label']));if(!this[_0x9b0b('0xb0')](_0x4c80f4[_0x9b0b('0x1a9')])){return this['channel']['noop'](_0x9b0b('0x1aa'));}var _0xafe5e1=this[_0x9b0b('0x38')][_0x9b0b('0xb1')](this,_0x4c80f4[_0x9b0b('0x1a9')]);if(!_0xafe5e1){return this['channel'][_0x9b0b('0x5b')](_0x4c80f4,'no\x20sms\x20account\x20found');}var _0x3e4e70={'body':_0x4c80f4[_0x9b0b('0x1ab')],'phone':_0x4c80f4['to']||'','SmsAccountId':_0xafe5e1['id']};logger['debug'](_0x9b0b('0x1ac'),JSON['stringify'](_0x3e4e70));this[_0x9b0b('0x3b')]['sync'](this,_0x4c80f4,_0x4c80f4[_0x9b0b('0x1a9')]);this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xafe5e1[_0x9b0b('0x15')]));this[_0x9b0b('0x3a')][_0x9b0b('0xb1')](this,_0x3e4e70);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x1ad'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1ae')]=function(_0x2c275f){logger['info'](util['format'](_0x9b0b('0x1af'),_0x2c275f[_0x9b0b('0x3d')]));if(!this['isConfigured'](_0x2c275f[_0x9b0b('0xe2')])){return this['channel'][_0x9b0b('0x5b')](_0x2c275f,_0x9b0b('0x1b0'));}var _0x57a339=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x2c275f[_0x9b0b('0xe2')]);if(!_0x57a339){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x2c275f,_0x9b0b('0xe4'));}return this[_0x9b0b('0x10')][_0x9b0b('0xaf')](_0x57a339,_0x2c275f[_0x9b0b('0x1b1')]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1b2')]=function(_0x3134f7){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3134f7[_0x9b0b('0x3d')]));this['channel']['noop'](_0x9b0b('0x1b3'));if(_0x3134f7[_0x9b0b('0xc4')]===_0x9b0b('0x1b4')){this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('Answer');return this[_0x9b0b('0x10')]['answer']();}return this['channel'][_0x9b0b('0xb5')](_0x9b0b('0x1b5'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1b6')]=function(_0x4f7ded){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x1b7'),_0x4f7ded[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x4f7ded[_0x9b0b('0x1b8')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x4f7ded,_0x9b0b('0x1b9'));}var _0x370037=this[_0x9b0b('0x18')][_0x9b0b('0xb1')](this,_0x4f7ded['project_id']);if(!this[_0x9b0b('0xb0')](_0x370037)){return this[_0x9b0b('0x10')]['error'](_0x4f7ded,util[_0x9b0b('0x2d')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4f7ded['project_id']));}if(_0x370037===this[_0x9b0b('0x10')][_0x9b0b('0x3e')]){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x4f7ded,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x4f7ded,_0x370037);var _0x341762=this[_0x9b0b('0x10')]['exec']('AGI',util[_0x9b0b('0x2d')](_0x9b0b('0x1ba'),config[_0x9b0b('0x8')][_0x9b0b('0x19c')]||_0x9b0b('0x1bb'),_0x370037,this[_0x9b0b('0x10')]['arg_1']));if(_0x341762[_0x9b0b('0xae')]===-0x1){return _0x341762;}return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xd0'),_0x9b0b('0x1bc'),_0x370037));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1bd')]=function(_0x105b69){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x1be'),_0x105b69[_0x9b0b('0x3d')]));var _0x27efce=this[_0x9b0b('0x62')][_0x9b0b('0xb1')](this,_0x105b69[_0x9b0b('0x1bf')]);this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x105b69,_0x105b69[_0x9b0b('0x1bf')]);if(this[_0x9b0b('0xb0')](_0x105b69[_0x9b0b('0xe2')])){var _0xe5bc76=this['getVariable'][_0x9b0b('0xb1')](this,_0x105b69[_0x9b0b('0xe2')]);if(_0xe5bc76){this[_0x9b0b('0x10')]['setVariable'](_0xe5bc76,_0x27efce);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x1c0'),_0x105b69[_0x9b0b('0x1bf')],_0xe5bc76));}}return this['channel']['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0x1c1'),_0x105b69[_0x9b0b('0x1bf')]));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1c2')]=function(_0x588e72){logger[_0x9b0b('0x31')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x588e72[_0x9b0b('0x3d')]));_0x588e72[_0x9b0b('0x69')]=_0x588e72[_0x9b0b('0x69')][_0x9b0b('0x65')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9b0b('0xb0')](_0x588e72['apiKey'])){return this[_0x9b0b('0x10')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x9b0b('0xb0')](_0x588e72[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1c3'),_0x588e72[_0x9b0b('0x69')]));var _0x207cff=this[_0x9b0b('0x66')][_0x9b0b('0xb1')](this,_0x588e72);if(_0x207cff){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1c4'),_0x207cff));var _0x47cd18=this[_0x9b0b('0x10')]['streamFile'](_0x207cff);try{fs['unlink'](_0x207cff+_0x9b0b('0x104'));}catch(_0xc90b55){logger[_0x9b0b('0x5b')](_0xc90b55);}return _0x47cd18;}return this[_0x9b0b('0x10')]['error'](_0x588e72,_0x9b0b('0x1c5'));};AGIVertices[_0x9b0b('0x12')]['tts']=function(_0x35aae8){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x35aae8[_0x9b0b('0x3d')]));_0x35aae8['text']=_0x35aae8[_0x9b0b('0x69')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9b0b('0xb0')](_0x35aae8[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')]['noop'](_0x9b0b('0xd4'));}this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1c6'),_0x35aae8[_0x9b0b('0x69')]));var _0x35261c=this[_0x9b0b('0x6f')][_0x9b0b('0xb1')](this,_0x35aae8);if(_0x35261c){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1c7'),_0x35261c));var _0x37fa60=this[_0x9b0b('0x10')][_0x9b0b('0x102')](_0x35261c);try{fs[_0x9b0b('0x103')](_0x35261c+_0x9b0b('0x104'));}catch(_0x5b8ff1){logger[_0x9b0b('0x5b')](_0x5b8ff1);}return _0x37fa60;}return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x35aae8,_0x9b0b('0x1c8'));};AGIVertices['prototype'][_0x9b0b('0x1c9')]=function(_0x4dac39){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x1ca'),_0x4dac39[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x4dac39[_0x9b0b('0x159')])){return this['channel']['error'](_0x4dac39,_0x9b0b('0x15a'));}logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x9b0b('0x3f')],_0x4dac39['findBy']));var _0x2d8271=this[_0x9b0b('0x5c')][_0x9b0b('0xb1')](this,_0x4dac39[_0x9b0b('0x159')]);if(_0x2d8271){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x15b'),this[_0x9b0b('0x10')]['callerid'],_0x4dac39[_0x9b0b('0x159')]));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x4dac39[_0x9b0b('0x159')]));return{'code':0xc8,'result':_0x9b0b('0x1cb')};}else{logger['info'](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x4dac39[_0x9b0b('0x159')]));this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x4dac39[_0x9b0b('0x159')]));return{'code':0xc8,'result':_0x9b0b('0x15d')};}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1cc')]=function(_0x285a29){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x285a29[_0x9b0b('0x3d')]));var _0x585bf8=this[_0x9b0b('0x10')][_0x9b0b('0x63')](_0x9b0b('0x1cd'),[_0x285a29[_0x9b0b('0x1ce')],_0x285a29[_0x9b0b('0x86')]]);if(_0x585bf8[_0x9b0b('0xae')]===-0x1){return _0x585bf8;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('Executed\x20command\x20%s\x20%s',_0x9b0b('0x1cd'),_0x285a29[_0x9b0b('0x1ce')]));};AGIVertices['prototype'][_0x9b0b('0x1cf')]=function(_0x38f50a){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x38f50a['label']));if(!this['isConfigured'](_0x38f50a[_0x9b0b('0xe2')])){return this['channel']['error'](_0x38f50a,'no\x20variable\x20selected');}var _0x126ca7=this['getVariable']['sync'](this,_0x38f50a[_0x9b0b('0xe2')]);if(!_0x126ca7){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x38f50a,_0x9b0b('0xe4'));}var _0x5bc0fc=this['channel'][_0x9b0b('0x13')](_0x126ca7);return{'code':0xc8,'result':_0x5bc0fc[_0x9b0b('0xac')]?_0x5bc0fc['extra']:'-'};};String[_0x9b0b('0x12')]['replaceAll']=function(_0x76465c,_0x425297){return this[_0x9b0b('0xa9')](_0x76465c)['join'](_0x425297);};module['exports']=AGIVertices; \ No newline at end of file +var _0xe617=['Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','isString','saveRestApiResult','%s.%s','length','setVariable','replaceall\x20init','split','nextbracket','replaceAll','extra','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','list_id','no\x20list\x20selected','add','delay','minutes','callback_priority','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','sayNumber','number','sayphonetic','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','127.0.0.1','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','util','shelljs','randomstring','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','has','dialTimezone','isNil','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','phone','RETVALRPC','TZ\x20found\x20in\x20shared:','isEmpty','callback_','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','en-US','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','includes','PUT','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','parse','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','text','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_polly_voice'];(function(_0x22d11c,_0x54433f){var _0xce6637=function(_0x212182){while(--_0x212182){_0x22d11c['push'](_0x22d11c['shift']());}};_0xce6637(++_0x54433f);}(_0xe617,0x13f));var _0x7e61=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe617[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0x7e61('0x0'));var util=require(_0x7e61('0x1'));var _=require('lodash');var sh=require(_0x7e61('0x2'));var odbc=require('odbc')();var rs=require(_0x7e61('0x3'));var moment=require('moment');var Mustache=require(_0x7e61('0x4'));var rp=require('request-promise');var logger=require(_0x7e61('0x5'))(_0x7e61('0x6'));var config=require(_0x7e61('0x7'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0x7e61('0x8');var recursiveMapAttributes=[_0x7e61('0x9'),_0x7e61('0xa')];var verticesWithRetry=[_0x7e61('0xb'),_0x7e61('0xc'),_0x7e61('0xd')];var AGIVertices=function(_0x496825,_0x4c328c,_0x3eebb3){this[_0x7e61('0xe')]=_0x496825;this[_0x7e61('0xf')]=_0x4c328c;this['mailRpc']=_0x3eebb3;};AGIVertices[_0x7e61('0x10')][_0x7e61('0x11')]=function(_0xeca44a,_0x29ab46){this[_0x7e61('0xf')][_0x7e61('0x12')](_0xeca44a)['then'](function(_0x2ca227){_0x29ab46(null,_0x2ca227?_0x2ca227[_0x7e61('0x13')]:![]);})[_0x7e61('0x14')](function(_0x15fe52){_0x29ab46(_0x15fe52);});};AGIVertices['prototype'][_0x7e61('0x15')]=function(_0x41c665,_0xe2e3ef){this['rpc'][_0x7e61('0x16')](_0x41c665)['then'](function(_0x180d8e){_0xe2e3ef(null,_0x180d8e?_0x180d8e[_0x7e61('0x13')]:![]);})[_0x7e61('0x14')](function(_0x39f6df){_0xe2e3ef(_0x39f6df);});};AGIVertices['prototype']['getSquareProject']=function(_0x4cc495,_0x46cec6){this[_0x7e61('0xf')]['getSquareProjectById'](_0x4cc495)[_0x7e61('0x17')](function(_0x5d40a2){_0x46cec6(null,_0x5d40a2?_0x5d40a2[_0x7e61('0x13')]:![]);})['catch'](function(_0x49e1b7){_0x46cec6(_0x49e1b7);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x18')]=function(_0x2f8236,_0x2063d3){this[_0x7e61('0xf')][_0x7e61('0x19')](_0x2f8236)['then'](function(_0x429f5b){_0x2063d3(null,_0x429f5b?_0x429f5b[_0x7e61('0x1a')]:![]);})[_0x7e61('0x14')](function(_0x53fb98){_0x2063d3(_0x53fb98);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1b')]=function(_0x340b9c,_0x56bb63){this[_0x7e61('0xf')][_0x7e61('0x1c')](_0x340b9c)['then'](function(_0x5f1a01){_0x56bb63(null,_0x5f1a01?_0x5f1a01[_0x7e61('0x13')]:![]);})['catch'](function(_0x3a5509){_0x56bb63(_0x3a5509);});};AGIVertices['prototype'][_0x7e61('0x1d')]=function(_0x49c558,_0x4e581d){this[_0x7e61('0xf')][_0x7e61('0x1e')](_0x49c558)[_0x7e61('0x17')](function(_0xc3f1b8){_0x4e581d(null,_0xc3f1b8?_0xc3f1b8[_0x7e61('0x13')]:![]);})['catch'](function(_0x4f509f){_0x4e581d(_0x4f509f);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1f')]=function(_0x450ecb,_0x1fde9a){var _0x155afe=this;this[_0x7e61('0xf')]['getSoundById'](_0x450ecb)[_0x7e61('0x17')](function(_0x4e6da9){_0x1fde9a(null,_0x4e6da9?_0x155afe[_0x7e61('0x20')](_0x4e6da9[_0x7e61('0x21')]):![]);})['catch'](function(_0x47da8d){_0x1fde9a(_0x47da8d);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x22')]=function(_0x1f115a,_0x502c92){this[_0x7e61('0xf')][_0x7e61('0x23')](_0x1f115a)[_0x7e61('0x17')](function(_0x4b212e){_0x502c92(null,_0x4b212e?_0x4b212e:![]);})[_0x7e61('0x14')](function(_0x1cef05){_0x502c92(_0x1cef05);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x24')]=function(_0x1508cd,_0x33f52c,_0x2bbfe7){this['mailRpc'][_0x7e61('0x24')](_0x1508cd,_0x33f52c)['then'](function(){_0x2bbfe7(null);})[_0x7e61('0x14')](function(_0x21107a){_0x2bbfe7(_0x21107a);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x25')]=function(_0x33ff03,_0x252705){this[_0x7e61('0xf')][_0x7e61('0x26')](_0x33ff03)['then'](function(_0x2500b3){if(_0x2500b3){if(_0x2500b3[_0x7e61('0x27')]){_0x252705(null,[_0x2500b3[_0x7e61('0x28')]]);}else{_0x252705(null,_[_0x7e61('0x29')](_0x2500b3[_0x7e61('0x2a')],_0x7e61('0x28')));}}else{_0x252705(null,![]);}})[_0x7e61('0x14')](function(_0x4e6d65){_0x252705(_0x4e6d65);});};AGIVertices['prototype'][_0x7e61('0x20')]=function(_0x37d9d8){return util[_0x7e61('0x2b')](_0x7e61('0x2c'),FILES_PATH,_0x37d9d8);};AGIVertices[_0x7e61('0x10')][_0x7e61('0x2d')]=function(_0x5c0b8e,_0x115006,_0x3ceb83){odbc[_0x7e61('0x2e')](_0x5c0b8e,function(_0x1df36e){if(_0x1df36e){logger[_0x7e61('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x1df36e);_0x3ceb83(_0x1df36e);}else{logger[_0x7e61('0x30')]('ODBC\x20connection\x20successfully');odbc[_0x7e61('0x31')](_0x115006,function(_0x2da972,_0x20acc4){if(_0x2da972){logger[_0x7e61('0x30')]('Error\x20executing\x20query\x20%s',_0x115006);_0x3ceb83(_0x2da972);}else{logger[_0x7e61('0x30')](_0x7e61('0x32'),_0x115006);odbc[_0x7e61('0x33')](function(_0x358fd2){if(_0x358fd2){logger['error'](_0x7e61('0x34'),_0x358fd2);}_0x3ceb83(null,_0x20acc4);});}});}});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x35')]=function(_0x394e3d,_0x4d9a07){this['rpc']['getSmsAccountById'](_0x394e3d)[_0x7e61('0x17')](function(_0x2096ff){_0x4d9a07(null,_0x2096ff?_0x2096ff:![]);})[_0x7e61('0x14')](function(_0x1f522d){_0x4d9a07(_0x1f522d);});};AGIVertices[_0x7e61('0x10')]['createSmsMessage']=function(_0x53b075,_0x146a89){this[_0x7e61('0xf')][_0x7e61('0x36')](_0x53b075)[_0x7e61('0x17')](function(_0x59f64a){_0x146a89(null,_0x59f64a);})[_0x7e61('0x14')](function(_0x273ba6){_0x146a89(_0x273ba6);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x37')]=function(_0x236519,_0x523b70,_0x5695a3){this[_0x7e61('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0x7e61('0xe')][_0x7e61('0x38')],'node':_0x236519['label'],'application':_0x236519[_0x7e61('0x39')],'data':_0x523b70||null,'project_name':this[_0x7e61('0xe')][_0x7e61('0x3a')],'callerid':this[_0x7e61('0xe')][_0x7e61('0x3b')]})[_0x7e61('0x17')](function(_0x16f876){if(_0x5695a3){_0x5695a3(null,_0x16f876);}})['catch'](function(_0x2a74cb){if(_0x5695a3){_0x5695a3(_0x2a74cb);}});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x3c')]=function(_0x47ee07,_0x4d378e,_0x298be1,_0x3c0e4d){this[_0x7e61('0xf')]['createSquareRecording']({'uniqueid':this[_0x7e61('0xe')][_0x7e61('0x38')],'callerid':this['channel'][_0x7e61('0x3b')],'calleridname':this['channel'][_0x7e61('0x3d')],'context':this[_0x7e61('0xe')][_0x7e61('0x3e')],'extension':this[_0x7e61('0xe')][_0x7e61('0x3f')],'priority':this[_0x7e61('0xe')]['priority'],'accountcode':this[_0x7e61('0xe')][_0x7e61('0x40')],'dnid':this['channel'][_0x7e61('0x41')],'projectName':this[_0x7e61('0xe')][_0x7e61('0x3a')],'saveName':_0x4d378e,'filename':_0x47ee07[_0x7e61('0x42')]||_0x4d378e,'savePath':_0x298be1})['then'](function(_0x47b9b2){_0x3c0e4d(null,_0x47b9b2);})[_0x7e61('0x14')](function(_0x25be6c){_0x3c0e4d(_0x25be6c);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x43')]=function(_0x394519,_0x3496e1,_0x15fab4){this[_0x7e61('0xf')][_0x7e61('0x43')]({'uniqueid':this[_0x7e61('0xe')]['uniqueid'],'body':_0x394519,'direction':_0x3496e1})['then'](function(_0x1938c4){if(_0x15fab4){_0x15fab4(null,_0x1938c4);}})['catch'](function(_0x197e4f){if(_0x15fab4){_0x15fab4(_0x197e4f);}});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x44')]=function(_0x21b001,_0x4fe577){console[_0x7e61('0x45')](_0x7e61('0x46'),_0x21b001);console[_0x7e61('0x45')]('in\x20createcmcontact\x20callback',_0x4fe577);var _0x5cd631=0x0;if(_[_0x7e61('0x47')](_0x21b001,_0x7e61('0x48'))){if(!_[_0x7e61('0x49')](_0x21b001[_0x7e61('0x48')])){var _0x5011f1=_0x21b001[_0x7e61('0x48')];console[_0x7e61('0x45')](_0x7e61('0x4a'),_0x5011f1);if(_0x21b001[_0x7e61('0x48')]==_0x7e61('0x4b')){this[_0x7e61('0xf')][_0x7e61('0x4c')]({'phone':_0x21b001[_0x7e61('0x4d')]})[_0x7e61('0x17')](function(_0x1528fb){console[_0x7e61('0x45')](_0x7e61('0x4e'),_0x1528fb);_0x4fe577(null,_0x1528fb);});}else{console[_0x7e61('0x45')](_0x7e61('0x4f'),shared[_0x5011f1]);}}}this['rpc'][_0x7e61('0x44')]({'firstName':_[_0x7e61('0x50')](_0x21b001[_0x7e61('0x13')])||_[_0x7e61('0x49')](_0x21b001[_0x7e61('0x13')])?_0x7e61('0x51')+Math[_0x7e61('0x52')]():_0x21b001[_0x7e61('0x13')],'lastName':_[_0x7e61('0x50')](_0x21b001[_0x7e61('0x53')])||_[_0x7e61('0x49')](_0x21b001[_0x7e61('0x53')])?null:_0x21b001['lastName'],'phone':_0x21b001[_0x7e61('0x4d')],'ListId':_0x21b001['list_id'],'scheduledat':_0x21b001[_0x7e61('0x54')],'callbackUniqueid':this[_0x7e61('0xe')]['uniqueid'],'tags':_0x7e61('0x55'),'description':_0x7e61('0x56')+_0x21b001[_0x7e61('0x54')][_0x7e61('0x57')](),'priority':_0x21b001['callback_priority']})[_0x7e61('0x17')](function(_0xc42603){_0x4fe577(null,_0xc42603);})['catch'](function(_0xaee97a){_0x4fe577(_0xaee97a);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x58')]=function(_0x3afeec,_0x165f91){this['rpc'][_0x7e61('0x59')](_0x3afeec)['then'](function(_0x17787a){_0x165f91(null,_0x17787a?_0x17787a[_0x7e61('0x13')]:![]);})[_0x7e61('0x14')](function(_0x4de728){_0x165f91(_0x4de728);});};AGIVertices[_0x7e61('0x10')]['agentPause']=function(_0x56b5e3,_0x58a495,_0x208c94){var _0x195b9d={'role':_0x7e61('0x5a')};_0x195b9d[_0x56b5e3]=this[_0x7e61('0xe')][_0x7e61('0x3b')];this['rpc'][_0x7e61('0x5b')](_0x195b9d,_0x58a495,this[_0x7e61('0xe')][_0x7e61('0x38')])[_0x7e61('0x17')](function(_0x57fe0c){_0x208c94(null,_[_0x7e61('0x49')](_0x57fe0c)?![]:!![]);})[_0x7e61('0x14')](function(_0x35c590){logger[_0x7e61('0x2f')](_0x35c590);_0x208c94(null,![]);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x5c')]=function(_0x8a6358,_0x3ae80b){var _0xc9fd15={'role':_0x7e61('0x5a')};_0xc9fd15[_0x8a6358]=this[_0x7e61('0xe')][_0x7e61('0x3b')];this[_0x7e61('0xf')]['agentUnpause'](_0xc9fd15)['then'](function(_0x937587){_0x3ae80b(null,_[_0x7e61('0x49')](_0x937587)?![]:!![]);})[_0x7e61('0x14')](function(_0x1f36df){logger[_0x7e61('0x2f')](_0x1f36df);_0x3ae80b(null,![]);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x5d')]=function(_0x348528,_0xa12503){var _0x1db8d2={'role':'agent'};_0x1db8d2[_0x348528]=this['channel'][_0x7e61('0x3b')];this[_0x7e61('0xf')][_0x7e61('0x5d')](_0x1db8d2)['then'](function(_0x2ef11e){_0xa12503(null,_['isNil'](_0x2ef11e)?![]:!![]);})[_0x7e61('0x14')](function(_0x58acae){logger[_0x7e61('0x2f')](_0x58acae);_0xa12503(null,![]);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x5e')]=function(_0x1f6da5,_0x1d1548){var _0x3655b2={'role':'agent'};_0x3655b2[_0x1f6da5]=this[_0x7e61('0xe')][_0x7e61('0x3b')];var _0x3918ed=_0x1f6da5!=_0x7e61('0x5f')?util[_0x7e61('0x2b')](_0x7e61('0x60'),_0x7e61('0x61'),this[_0x7e61('0xe')][_0x7e61('0x3b')]):undefined;this['rpc']['agentLogin'](_0x3655b2,_0x3918ed)[_0x7e61('0x17')](function(_0x350ff8){_0x1d1548(null,_['isNil'](_0x350ff8)?![]:!![]);})['catch'](function(_0x3fddee){logger['error'](_0x3fddee);_0x1d1548(null,![]);});};AGIVertices[_0x7e61('0x10')]['shellCommand']=function(_0xfd80f1,_0x59d909){sh[_0x7e61('0x62')](_[_0x7e61('0x63')](_0xfd80f1),function(_0x32d602,_0x353ab8){var _0x46e5aa=_0x353ab8[_0x7e61('0x64')](/(\r\n|\n|\r)/gm,'');_0x59d909(null,_0x46e5aa);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x65')]=function(_0x351c84,_0x852e8c){scripts[_0x7e61('0x65')](_0x351c84['apiKey'],_0x351c84[_0x7e61('0x66')]||'text',_0x351c84['text'],_0x351c84['languageCode']||_0x7e61('0x67'),_0x351c84['ssmlGender']||_0x7e61('0x68'),_0x351c84[_0x7e61('0x69')]||_0x7e61('0x6a'))[_0x7e61('0x17')](function(_0x450188){_0x852e8c(null,_0x450188);})[_0x7e61('0x14')](function(_0x4e9eb3){_0x852e8c(_0x4e9eb3);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x6b')]=function(_0x29e882,_0x5d34c7){scripts[_0x7e61('0x6b')](_0x29e882['text'],_0x29e882['google_tts_language']||'en',0x1)[_0x7e61('0x17')](function(_0x2af03e){_0x5d34c7(null,_0x2af03e);})[_0x7e61('0x14')](function(_0x404c55){_0x5d34c7(_0x404c55);});};AGIVertices['prototype'][_0x7e61('0x6c')]=function(_0x23b739,_0x39f5b0){var _0x4bfa67={'uri':_0x23b739[_0x7e61('0x6d')],'method':_0x23b739[_0x7e61('0x6e')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x23b739[_0x7e61('0x6f')])==='number'&&parseInt(_0x23b739[_0x7e61('0x6f')])>=0x1?parseInt(_0x23b739[_0x7e61('0x6f')])*0x3e8:0x5*0x3e8};if(_[_0x7e61('0x70')](['POST',_0x7e61('0x71')],_0x4bfa67['method']['toUpperCase']())){try{_0x4bfa67['body']=_0x23b739['rawBody']?JSON['parse'](_0x23b739['rawBody']):{};}catch(_0x5aaca9){logger[_0x7e61('0x2f')](_0x7e61('0x72'),_0x5aaca9);}}try{_0x4bfa67[_0x7e61('0x73')]=_0x23b739[_0x7e61('0x9')]?JSON['parse'](_0x23b739[_0x7e61('0x9')]):{};}catch(_0x52cac8){logger['error'](_0x7e61('0x74'),_0x52cac8);}if(_0x23b739[_0x7e61('0x75')]){try{var _0x5507e8=require(_0x23b739[_0x7e61('0x75')])[_0x7e61('0x76')](this,_0x4bfa67);_0x4bfa67[_0x7e61('0x77')]=Mustache['render'](_0x23b739[_0x7e61('0x6d')],_0x5507e8,{},['$$','$$']);if(_0x4bfa67[_0x7e61('0x73')]){_0x4bfa67[_0x7e61('0x73')]=JSON['parse'](Mustache[_0x7e61('0x78')](JSON[_0x7e61('0x79')](_0x4bfa67[_0x7e61('0x73')]),_0x5507e8,{},['$$','$$']));}if(_0x4bfa67['body']){_0x4bfa67['body']=JSON[_0x7e61('0x7a')](Mustache['render'](JSON[_0x7e61('0x79')](_0x4bfa67[_0x7e61('0x7b')]),_0x5507e8,{},['$$','$$']));}}catch(_0x3f556d){logger[_0x7e61('0x2f')](_0x7e61('0x7c'),_0x3f556d);}}rp(_0x4bfa67)['then'](function(_0x25dedc){var _0x41711c={'statusCode':_0x25dedc[_0x7e61('0x7d')]||0xc8,'statusMessage':_0x25dedc['statusMessage']||'OK','headers':_0x25dedc['headers']||{},'body':_0x25dedc[_0x7e61('0x7b')]||{}};_0x39f5b0(null,_0x41711c);})['catch'](function(_0xa955ab){var _0x4b95f9={'statusCode':_0xa955ab['statusCode']||0x1f4,'statusMessage':_0xa955ab[_0x7e61('0x7e')]||_0x7e61('0x7f'),'headers':_0xa955ab[_0x7e61('0x80')][_0x7e61('0x73')]||{},'body':_0xa955ab[_0x7e61('0x80')]['body']||{}};_0x39f5b0(null,_0x4b95f9);});};AGIVertices[_0x7e61('0x10')]['googleDialogflow']=function(_0x501775,_0x402fb2){scripts[_0x7e61('0x81')](this[_0x7e61('0xe')][_0x7e61('0x38')],_0x501775[_0x7e61('0x82')],_0x501775['text'],_0x501775[_0x7e61('0x83')]||'en')[_0x7e61('0x17')](function(_0x542f3f){_0x402fb2(null,_0x542f3f);})['catch'](function(_0x570ca7){_0x402fb2(_0x570ca7);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x84')]=function(_0x40bce7,_0x446eb8){scripts[_0x7e61('0x84')](this[_0x7e61('0xe')],_0x40bce7)[_0x7e61('0x17')](function(_0xdb4653){_0x446eb8(null,_0xdb4653);})['catch'](function(_0x1701e8){_0x446eb8(_0x1701e8);});};AGIVertices[_0x7e61('0x10')]['ispeechTTS']=function(_0x1a2845,_0x12fb05){scripts[_0x7e61('0x85')](_0x1a2845['key'],_0x1a2845[_0x7e61('0x86')],_0x1a2845['ispeech_tts_language']||_0x7e61('0x67'),_0x1a2845[_0x7e61('0x87')])['then'](function(_0x14202b){_0x12fb05(null,_0x14202b);})[_0x7e61('0x14')](function(_0x260f76){_0x12fb05(_0x260f76);});};AGIVertices['prototype'][_0x7e61('0x88')]=function(_0x2b879d,_0xe2c451,_0x171470){scripts[_0x7e61('0x88')](_0xe2c451,_0x2b879d[_0x7e61('0x82')],_0x2b879d[_0x7e61('0x89')]||'en-US',this['isConfigured'](_0x2b879d[_0x7e61('0x8a')])?_0x2b879d[_0x7e61('0x8a')]:undefined)[_0x7e61('0x17')](function(_0x4c9586){_0x171470(null,_0x4c9586);})[_0x7e61('0x14')](function(_0x3491b6){_0x171470(_0x3491b6);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x8b')]=function(_0x12da4,_0x34e222){scripts[_0x7e61('0x8b')](_0x12da4['aws_access_key_id'],_0x12da4['aws_secret_access_key'],_0x12da4['aws_polly_region'],_0x12da4[_0x7e61('0x8c')]||_0x7e61('0x8d'),_0x12da4[_0x7e61('0x86')],_0x12da4[_0x7e61('0x8e')]||_0x7e61('0x86'))[_0x7e61('0x17')](function(_0x4ab5a3){_0x34e222(null,_0x4ab5a3);})['catch'](function(_0x1a9fdf){_0x34e222(_0x1a9fdf);});};AGIVertices[_0x7e61('0x10')]['awsLex']=function(_0x47e8b3,_0x1eb46e){scripts[_0x7e61('0x8f')](this[_0x7e61('0xe')][_0x7e61('0x38')],_0x47e8b3[_0x7e61('0x90')],_0x47e8b3[_0x7e61('0x91')],_0x47e8b3[_0x7e61('0x92')],_0x47e8b3[_0x7e61('0x86')],_0x47e8b3[_0x7e61('0x93')])[_0x7e61('0x17')](function(_0x81414d){_0x1eb46e(null,_0x81414d);})[_0x7e61('0x14')](function(_0x4c52a4){_0x1eb46e(_0x4c52a4);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x94')]=function(_0x4a3820,_0x4fcda5,_0x337203){scripts[_0x7e61('0x94')](_0x4fcda5,_0x4a3820[_0x7e61('0x82')],_0x4a3820[_0x7e61('0x95')]||_0x7e61('0x67'))[_0x7e61('0x17')](function(_0x417d53){_0x337203(null,_0x417d53);})[_0x7e61('0x14')](function(_0x237b67){_0x337203(_0x237b67);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x96')]=function(_0x311e36,_0x493dec,_0x41cc2e){scripts[_0x7e61('0x96')](_0x493dec,_0x311e36['appid'],_0x311e36['appsecret'],_0x311e36[_0x7e61('0x77')])[_0x7e61('0x17')](function(_0x43a6bd){_0x41cc2e(null,_0x43a6bd);})['catch'](function(_0x31bffa){_0x41cc2e(_0x31bffa);});};AGIVertices['prototype'][_0x7e61('0x97')]=function(_0x22b36b){var _0x412dcd=_[_0x7e61('0x70')](verticesWithRetry,_0x22b36b[_0x7e61('0x39')])?_0x22b36b:_[_0x7e61('0x98')](_0x22b36b);for(var _0x5b2f35 in _0x412dcd){if(_0x412dcd[_0x7e61('0x99')](_0x5b2f35)){if(_0x412dcd[_0x5b2f35]&&_['isString'](_0x412dcd[_0x5b2f35])){if(_[_0x7e61('0x70')](recursiveMapAttributes,_0x5b2f35)){_0x412dcd[_0x5b2f35]=this[_0x7e61('0x9a')](_0x412dcd[_0x5b2f35]);}else{_0x412dcd[_0x5b2f35]=this[_0x7e61('0x9b')](_0x412dcd[_0x5b2f35]);}}}}return _0x412dcd;};AGIVertices[_0x7e61('0x10')]['recursiveNodeIndex']=function(_0x31b373){for(var _0x26a348 in _0x31b373){if(_0x31b373['hasOwnProperty'](_0x26a348)){if(_['isPlainObject'](_0x31b373[_0x26a348])){this[_0x7e61('0x9c')](_0x31b373[_0x26a348]);}else if(_[_0x7e61('0x9d')](_0x31b373[_0x26a348])){for(var _0x198550=0x0;_0x198550<_0x31b373[_0x26a348]['length'];_0x198550++){this[_0x7e61('0x9c')](_0x31b373[_0x26a348][_0x198550]);}}else if(_[_0x7e61('0x9e')](_0x31b373[_0x26a348])){_0x31b373[_0x26a348]=this[_0x7e61('0x9b')](_0x31b373[_0x26a348]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x452d01,_0x515a29){for(var _0x487cae in _0x452d01){if(_0x452d01[_0x7e61('0x99')](_0x487cae)){if(_['isPlainObject'](_0x452d01[_0x487cae])){if(!_[_0x7e61('0x50')](_0x452d01[_0x487cae])){this[_0x7e61('0x9f')](_0x452d01[_0x487cae],util['format'](_0x7e61('0xa0'),_0x515a29,_0x487cae));}}else if(_[_0x7e61('0x9d')](_0x452d01[_0x487cae])){for(var _0x2ae9ce=0x0;_0x2ae9ce<_0x452d01[_0x487cae][_0x7e61('0xa1')];_0x2ae9ce++){this[_0x7e61('0x9f')](_0x452d01[_0x487cae][_0x2ae9ce],util['format'](_0x7e61('0xa0'),_0x515a29,_0x487cae+'['+_0x2ae9ce+']'));}}else{if(!_[_0x7e61('0x49')](_0x452d01[_0x487cae])){this[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0xa0'),_0x515a29,_0x487cae),_0x452d01[_0x487cae]);}}}}};AGIVertices['prototype'][_0x7e61('0x9a')]=function(_0x2d3658){try{var _0x141903=JSON[_0x7e61('0x7a')](_0x2d3658);this[_0x7e61('0x9c')](_0x141903);return JSON['stringify'](_0x141903);}catch(_0x58e0bb){return this[_0x7e61('0x9b')](_0x2d3658);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x5ad594){console['log'](_0x7e61('0xa3'),_0x5ad594);var _0x548fba=_0x5ad594[_0x7e61('0xa4')]('{');for(var _0x3215c3=0x1;_0x3215c3<_0x548fba[_0x7e61('0xa1')];_0x3215c3+=0x1){var _0x4c5d31=_0x548fba[_0x3215c3]['split']('}');console[_0x7e61('0x45')](_0x7e61('0xa5'),_0x4c5d31);if(_0x4c5d31['length']>0x1){_0x5ad594=_0x5ad594[_0x7e61('0xa6')]('{'+_0x4c5d31[0x0]+'}',this[_0x7e61('0xe')][_0x7e61('0x11')](_0x4c5d31[0x0])[_0x7e61('0xa7')]||_0x4c5d31[0x0]);}}if(_0x548fba['length']===0x1){return _0x5ad594[_0x7e61('0x57')]();}console['log'](_0x7e61('0xa8'),_0x5ad594);return this[_0x7e61('0x9b')](_0x5ad594);};AGIVertices[_0x7e61('0x10')][_0x7e61('0xa9')]=function(_0x2391e3,_0x1ed2d2){var _0x54f671=this[_0x7e61('0xe')]['getVariable'](_0x2391e3);if(_0x54f671[_0x7e61('0xaa')]===-0x1){return _0x54f671;}logger['info'](util[_0x7e61('0x2b')](_0x7e61('0xab'),_0x1ed2d2,_0x54f671['extra']));return this[_0x7e61('0xe')][_0x7e61('0xa2')](_0x1ed2d2,_0x54f671[_0x7e61('0xa7')]);};AGIVertices[_0x7e61('0x10')][_0x7e61('0xac')]=function(_0xdee612){return _0xdee612&&_0xdee612!=='0'&&_0xdee612!=='-1'&&_0xdee612!=='';};AGIVertices[_0x7e61('0x10')][_0x7e61('0xad')]=function(_0x43a3c6){this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x43a3c6,'-');_0x43a3c6[_0x7e61('0xae')]=_0x43a3c6[_0x7e61('0xad')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7e61('0x10')]['mrcpsynth']=function(_0x32820f){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0xaf'),_0x32820f[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x32820f['text'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}var _0x234498='\x22'+_0x32820f[_0x7e61('0x86')]+'\x22';if(this[_0x7e61('0xac')](_0x32820f[_0x7e61('0x80')])){_0x234498+=','+_0x32820f[_0x7e61('0x80')];}var _0x1fab6c=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0xb3'),_0x234498);if(_0x1fab6c['result']===-0x1){return _0x1fab6c;}return this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0xb4'),_0x234498));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xb5')]=function(_0x4ebfc8){logger[_0x7e61('0x30')](util['format'](_0x7e61('0xb6'),_0x4ebfc8[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x4ebfc8[_0x7e61('0xb7')])){return this[_0x7e61('0xe')]['noop']('no\x20grammar\x20configured');}var _0x4b9feb=_0x4ebfc8[_0x7e61('0xb7')];if(this['isConfigured'](_0x4ebfc8[_0x7e61('0x80')])){_0x4b9feb+=','+_0x4ebfc8[_0x7e61('0x80')];}var _0x17b7b8=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0xb8'),_0x4b9feb);if(_0x17b7b8[_0x7e61('0xaa')]===-0x1){return _0x17b7b8;}var _0x3805b2=this['getAndSetVariable'](_0x7e61('0xb9'),_0x7e61('0xba'));if(_0x3805b2[_0x7e61('0xaa')]===-0x1){return _0x3805b2;}var _0x1df3af=this[_0x7e61('0xa9')](_0x7e61('0xbb'),'MRCP_RECOG_TRANSCRIPT');if(_0x1df3af[_0x7e61('0xaa')]===-0x1){return _0x1df3af;}var _0x3fc0a0=this[_0x7e61('0xa9')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x3fc0a0[_0x7e61('0xaa')]===-0x1){return _0x3fc0a0;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xbc'),_0x4b9feb));};AGIVertices[_0x7e61('0x10')]['agi']=function(_0x3587c2){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3587c2[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0x6')]([_0x3587c2[_0x7e61('0xbd')],_0x3587c2[_0x7e61('0xbe')]]);};AGIVertices[_0x7e61('0x10')][_0x7e61('0xbf')]=function(_0x9fa10f){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xc0'),_0x9fa10f[_0x7e61('0xb0')]));if(this[_0x7e61('0xac')](_0x9fa10f[_0x7e61('0x6f')])){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xc1'),_0x9fa10f[_0x7e61('0x6f')]));var _0x239498=this['channel'][_0x7e61('0xc2')](_0x9fa10f[_0x7e61('0x6f')]);if(_0x239498['result']===-0x1){return _0x239498;}}return this[_0x7e61('0xe')][_0x7e61('0xbf')]();};AGIVertices['prototype'][_0x7e61('0x55')]=function(_0x48ace2){console['log'](_0x7e61('0xc3'),_0x48ace2);logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x48ace2[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x48ace2[_0x7e61('0xc4')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x48ace2,_0x7e61('0xc5'));}_0x48ace2[_0x7e61('0x54')]=moment();if(this['isConfigured'](_0x48ace2['delay'])){_0x48ace2[_0x7e61('0x54')]=moment()[_0x7e61('0xc6')](_0x48ace2[_0x7e61('0xc7')],_0x7e61('0xc8'));}if(!this[_0x7e61('0xac')](_0x48ace2[_0x7e61('0xc9')])){_0x48ace2[_0x7e61('0xc9')]=0x2;}console[_0x7e61('0x45')](_0x7e61('0xca'),_0x48ace2);this[_0x7e61('0x44')][_0x7e61('0x76')](this,_0x48ace2);return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xcb'),_0x48ace2['phone'],_0x48ace2[_0x7e61('0xc4')],_0x48ace2[_0x7e61('0x54')]));};AGIVertices['prototype']['custom_app']=function(_0x45b13d){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0xcc'),_0x45b13d[_0x7e61('0xb0')]));var _0x2e775b=this[_0x7e61('0xe')]['exec'](_0x45b13d[_0x7e61('0xcd')],_0x45b13d['options']);if(_0x2e775b['result']===-0x1){return _0x2e775b;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xce'),_0x45b13d[_0x7e61('0xcd')],_0x45b13d[_0x7e61('0x80')]));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xcf')]=function(_0xafbe79){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xd0'),_0xafbe79[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0xafbe79[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20text\x20configured');}var _0x431186='\x22'+_0xafbe79[_0x7e61('0x86')]+'\x22';if(this[_0x7e61('0xac')](_0xafbe79[_0x7e61('0x80')])){_0x431186+=','+_0xafbe79['options'];}var _0x4626d1=this['channel'][_0x7e61('0x62')]('MRCPSynth',_0x431186);if(_0x4626d1[_0x7e61('0xaa')]===-0x1){return _0x4626d1;}return this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xb4'),_0x431186));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xd1')]=function(_0x3a4a6b){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xd2'),_0x3a4a6b['label']));if(!this[_0x7e61('0xac')](_0x3a4a6b[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}var _0x778ba6='\x22'+_0x3a4a6b[_0x7e61('0x86')]+'\x22';if(this[_0x7e61('0xac')](_0x3a4a6b['options'])){_0x778ba6+=','+_0x3a4a6b[_0x7e61('0x80')];}var _0x431f41=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0xb3'),_0x778ba6);if(_0x431f41['result']===-0x1){return _0x431f41;}return this[_0x7e61('0xe')]['noop'](util['format'](_0x7e61('0xb4'),_0x778ba6));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xd3')]=function(_0x2eb24d){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xd4'),_0x2eb24d[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x2eb24d['grammar'])){return this['channel'][_0x7e61('0xb1')]('no\x20grammar\x20configured');}var _0x4283f5=_0x2eb24d[_0x7e61('0xb7')];if(this[_0x7e61('0xac')](_0x2eb24d[_0x7e61('0x80')])){_0x4283f5+=','+_0x2eb24d[_0x7e61('0x80')];}var _0x209c73=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0xb8'),_0x4283f5);if(_0x209c73[_0x7e61('0xaa')]===-0x1){return _0x209c73;}var _0x2acc73=this[_0x7e61('0xa9')](_0x7e61('0xb9'),_0x7e61('0xd5'));if(_0x2acc73[_0x7e61('0xaa')]===-0x1){return _0x2acc73;}var _0x5242f6=this['getAndSetVariable'](_0x7e61('0xbb'),_0x7e61('0xd6'));if(_0x5242f6[_0x7e61('0xaa')]===-0x1){return _0x5242f6;}var _0x3f2667=this['getAndSetVariable'](_0x7e61('0xd7'),_0x7e61('0xd8'));if(_0x3f2667['result']===-0x1){return _0x3f2667;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4283f5));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xd9')]=function(_0x4333cd){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xda'),_0x4333cd[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x4333cd[_0x7e61('0xb7')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xdb'));}var _0x5d450e=_0x4333cd[_0x7e61('0xb7')];if(this[_0x7e61('0xac')](_0x4333cd[_0x7e61('0x80')])){_0x5d450e+=','+_0x4333cd[_0x7e61('0x80')];}var _0x54af8f=this[_0x7e61('0xe')]['exec'](_0x7e61('0xb8'),_0x5d450e);if(_0x54af8f[_0x7e61('0xaa')]===-0x1){return _0x54af8f;}var _0x16d7d6=this[_0x7e61('0xa9')](_0x7e61('0xb9'),_0x7e61('0xdc'));if(_0x16d7d6[_0x7e61('0xaa')]===-0x1){return _0x16d7d6;}var _0xf881cc=this['getAndSetVariable'](_0x7e61('0xbb'),_0x7e61('0xdd'));if(_0xf881cc[_0x7e61('0xaa')]===-0x1){return _0xf881cc;}var _0x1b5c11=this[_0x7e61('0xa9')](_0x7e61('0xd7'),_0x7e61('0xde'));if(_0x1b5c11[_0x7e61('0xaa')]===-0x1){return _0x1b5c11;}return this['channel'][_0x7e61('0xb1')](util['format'](_0x7e61('0xbc'),_0x5d450e));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xdf')]=function(_0xc5675c){logger[_0x7e61('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0xc5675c[_0x7e61('0xb0')]));if(!this['isConfigured'](_0xc5675c['odbc_id'])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0xc5675c,_0x7e61('0xe0'));}var _0x4f5c0b=this['getSquareOdbc']['sync'](this,_0xc5675c[_0x7e61('0xe1')]);if(!_0x4f5c0b){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0xc5675c,_0x7e61('0xe2'));}if(!this[_0x7e61('0xac')](_0xc5675c[_0x7e61('0x31')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0xc5675c,'no\x20query\x20configured');}var _0x4637c6=_0xc5675c[_0x7e61('0x31')][_0x7e61('0x64')](/(\r\n|\n|\r)/gm,'\x20');this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0xe3'),_0x4637c6));var _0x2e164b=this[_0x7e61('0x2d')][_0x7e61('0x76')](this,_0x4f5c0b,_0x4637c6);this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0xc5675c,_0x4637c6);if(!this['isConfigured'](_0xc5675c[_0x7e61('0xe4')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xe5'));}var _0x4e423c=this['getVariable'][_0x7e61('0x76')](this,_0xc5675c['variable_id']);if(!_0x4e423c){return this[_0x7e61('0xe')]['error'](_0xc5675c,'no\x20variable\x20found');}var _0x403642=this;_0x2e164b[_0x7e61('0xe6')](function(_0x200f57,_0x39c58b){Object[_0x7e61('0xe7')](_0x200f57)['forEach'](function(_0x12f50f){_0x403642[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0xe8'),_0x4e423c,_0x39c58b,_0x12f50f),_0x200f57[_0x12f50f]);});});this[_0x7e61('0xe')]['setVariable'](util['format'](_0x7e61('0xe9'),_0x4e423c),_0x2e164b[_0x7e61('0xa1')]);return this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0xea'),_0x4e423c));};AGIVertices[_0x7e61('0x10')]['dial']=function(_0x275f81){logger[_0x7e61('0xeb')](util[_0x7e61('0x2b')](_0x7e61('0xec'),_0x275f81['label']));if(!this['isConfigured'](_0x275f81[_0x7e61('0xed')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x275f81,'no\x20user\x20selected');}var _0x1fc51a=this[_0x7e61('0x1b')][_0x7e61('0x76')](this,_0x275f81[_0x7e61('0xed')]);if(!_0x1fc51a){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x275f81,_0x7e61('0xee'));}var _0x2178bf=this[_0x7e61('0xe')][_0x7e61('0x62')]('DIAL',[util[_0x7e61('0x2b')](_0x7e61('0xef'),_0x1fc51a),_0x275f81[_0x7e61('0x6f')],_0x275f81[_0x7e61('0xf0')],_0x275f81[_0x7e61('0x6d')]]);if(_0x2178bf[_0x7e61('0xaa')]===-0x1){return _0x2178bf;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xf1'),_0x7e61('0xf2')));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xf3')]=function(_0x13c1b6){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x13c1b6['label']));if(!this[_0x7e61('0xac')](_0x13c1b6[_0x7e61('0x82')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xf4'));}if(!this[_0x7e61('0xac')](_0x13c1b6[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x13c1b6);this[_0x7e61('0x43')](_0x13c1b6['text'],'in');this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0xf5'),_0x13c1b6[_0x7e61('0x86')]));var _0x13fc8e=this['googleDialogflow'][_0x7e61('0x76')](this,_0x13c1b6);if(_0x13fc8e){for(var _0x5d5a07 in _0x13fc8e){if(_0x13fc8e[_0x7e61('0x99')](_0x5d5a07)){this['channel']['setVariable'](util[_0x7e61('0x2b')]('DIALOGFLOW_%s',_0x5d5a07[_0x7e61('0xf6')]()),_0x13fc8e[_0x5d5a07]);}}this[_0x7e61('0x43')](_0x13fc8e[_0x7e61('0xf7')],_0x7e61('0xf8'));return this['channel'][_0x7e61('0xb1')](util['format']('Dialogflow\x20Result\x20%s',_0x13fc8e[_0x7e61('0xf7')]));}return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x13c1b6,_0x7e61('0xf9'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xfa')]=function(_0x43931e){logger[_0x7e61('0x30')](util['format'](_0x7e61('0xfb'),_0x43931e[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x43931e[_0x7e61('0xfc')])){return this[_0x7e61('0xe')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x7e61('0xac')](_0x43931e[_0x7e61('0xfd')])){return this['channel'][_0x7e61('0xb1')](_0x7e61('0xfe'));}if(!this[_0x7e61('0xac')](_0x43931e['password'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x43931e['ndassistant_url'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')][_0x7e61('0xff')]=!![];this[_0x7e61('0x37')](_0x43931e);this[_0x7e61('0x43')](_0x43931e[_0x7e61('0x86')],'in');this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x100'),_0x43931e[_0x7e61('0x86')]));var _0x506752=this[_0x7e61('0x84')][_0x7e61('0x76')](this,_0x43931e);if(_0x506752){for(var _0x4e71af in _0x506752){if(_0x506752[_0x7e61('0x99')](_0x4e71af)){this[_0x7e61('0xe')][_0x7e61('0xa2')](util['format'](_0x7e61('0x101'),_0x4e71af[_0x7e61('0xf6')]()),_0x506752[_0x4e71af]);}}this[_0x7e61('0x43')](_0x506752[_0x7e61('0xf7')],_0x7e61('0xf8'));if(_0x506752[_0x7e61('0x102')]){this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x103'),_0x506752[_0x7e61('0x102')]));var _0x5e4b05=this['channel'][_0x7e61('0x104')](_0x506752[_0x7e61('0x102')]);try{fs[_0x7e61('0x105')](_0x506752['audiofile']+_0x7e61('0x106'));}catch(_0x16d60d){logger['error'](_0x16d60d);}return _0x5e4b05;}else{return this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format']('SestekNDA\x20Result\x20%s',_0x506752['speech']));}}return this[_0x7e61('0xe')]['error'](_0x43931e,_0x7e61('0x107'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x108')]=function(_0x23b7b0){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x23b7b0[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x108'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x109')]=function(_0x134aa1){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x10a'),_0x134aa1[_0x7e61('0xb0')]));var _0x2b227b='';if(_0x134aa1[_0x7e61('0x10b')]){if(!this[_0x7e61('0xac')](_0x134aa1[_0x7e61('0x10b')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x134aa1,'no\x20trunk\x20selected');}else{var _0x33a5bb=parseInt(_0x134aa1[_0x7e61('0x10b')],0xa);if(isNaN(_0x33a5bb)){_0x2b227b=_0x134aa1[_0x7e61('0x10b')];}else{_0x2b227b=this[_0x7e61('0x1d')]['sync'](this,_0x134aa1[_0x7e61('0x10b')]);if(!_0x2b227b){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x134aa1,_0x7e61('0x10c'));}}}}else if(_0x134aa1[_0x7e61('0x10d')]){_0x2b227b=_0x134aa1[_0x7e61('0x10d')];}else{return this['channel'][_0x7e61('0x2f')](_0x134aa1,_0x7e61('0x10e'));}var _0x292bc4=this[_0x7e61('0xe')]['exec'](_0x7e61('0xf2'),[util[_0x7e61('0x2b')](_0x7e61('0x10f'),_0x2b227b,_0x134aa1[_0x7e61('0x4d')]),_0x134aa1[_0x7e61('0x6f')],_0x134aa1['opts'],_0x134aa1[_0x7e61('0x6d')]]);if(_0x292bc4[_0x7e61('0xaa')]===-0x1){return _0x292bc4;}return this['channel']['noop'](util[_0x7e61('0x2b')](_0x7e61('0xf1'),'DIAL'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x110')]=function(_0x3f17fe){logger[_0x7e61('0x30')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x3f17fe['label']));return this[_0x7e61('0xe')]['noop']('finally');};AGIVertices[_0x7e61('0x10')][_0x7e61('0xc')]=function(_0x4540ec){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4540ec[_0x7e61('0xb0')]));if(_0x4540ec[_0x7e61('0xae')]===0x0){return this['maxRetry'](_0x4540ec);}_0x4540ec[_0x7e61('0xae')]-=0x1;if(!this[_0x7e61('0xac')](_0x4540ec[_0x7e61('0x111')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4540ec,_0x7e61('0x112'));}var _0x12a4b0=this[_0x7e61('0x1f')][_0x7e61('0x76')](this,_0x4540ec['file_id']);if(!_0x12a4b0){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4540ec,'no\x20file\x20audio\x20found');}if(!this[_0x7e61('0xac')](_0x4540ec[_0x7e61('0xe4')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x7e61('0xe5'));}var _0x215cb2=this[_0x7e61('0xe')][_0x7e61('0x113')](_0x12a4b0,_0x4540ec[_0x7e61('0x114')],_0x4540ec[_0x7e61('0x115')]);var _0x4acedf=_0x215cb2[_0x7e61('0xaa')]?_0x215cb2[_0x7e61('0xaa')][_0x7e61('0x57')]():'';logger[_0x7e61('0x30')]('test',JSON[_0x7e61('0x79')](_0x215cb2));if(_0x215cb2[_0x7e61('0xaa')]===-0x1){this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4540ec,_0x4acedf);return _0x215cb2;}else if(_0x215cb2[_0x7e61('0xa7')]==='timeout'){_0x215cb2[_0x7e61('0xaa')]=_0x4acedf[_0x7e61('0xa1')]>=parseInt(_0x4540ec[_0x7e61('0x116')])?'x':'i';}else{_0x215cb2[_0x7e61('0xaa')]=_0x4acedf[_0x7e61('0xa1')]>=parseInt(_0x4540ec[_0x7e61('0x116')])&&_0x4acedf[_0x7e61('0xa1')]<=parseInt(_0x4540ec['maxdigit'])?'x':'i';}var _0x15b449=this[_0x7e61('0x11')]['sync'](this,_0x4540ec[_0x7e61('0xe4')]);if(!_0x15b449){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4540ec,_0x7e61('0x117'));}this[_0x7e61('0xe')][_0x7e61('0xa2')](_0x15b449,_0x4acedf);if(this[_0x7e61('0xac')](_0x4540ec[_0x7e61('0x118')])){var _0x2318f8=parseInt(_0x4540ec[_0x7e61('0x118')],0xa);var _0x4fc92d=rs[_0x7e61('0x119')]({'charset':'*','length':_0x2318f8});var _0xc20f1e=_0x4acedf[_0x7e61('0xa1')];if(_0xc20f1e>0x0){if(_0xc20f1e>_0x2318f8){this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4540ec,_0x4540ec[_0x7e61('0x11a')]==='first'?_0x4fc92d+_0x4acedf[_0x7e61('0x11b')](_0x2318f8):_0x4acedf[_0x7e61('0x11b')](0x0,_0xc20f1e-_0x2318f8)+_0x4fc92d);}else{this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4540ec,rs[_0x7e61('0x119')]({'charset':'*','length':_0xc20f1e}));}}else{this['createSquareDetailsReport'][_0x7e61('0x76')](this,_0x4540ec,'');}}else{this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4540ec,_0x4acedf);}return _0x215cb2;};AGIVertices[_0x7e61('0x10')]['getsecretdigits']=function(_0x47a213){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x11c'),_0x47a213[_0x7e61('0xb0')]));return this[_0x7e61('0xc')](_0x47a213);};AGIVertices[_0x7e61('0x10')]['goal']=function(_0x50d76d){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x11d'),_0x50d76d[_0x7e61('0xb0')]));this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x50d76d,_0x50d76d['goalname']);return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x11e'),_0x50d76d[_0x7e61('0x11f')]));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x120')]=function(_0x4a6f64){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x121'),_0x4a6f64[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x4a6f64[_0x7e61('0x90')])||!this[_0x7e61('0xac')](_0x4a6f64[_0x7e61('0x91')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x4a6f64['text'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x122'),_0x4a6f64[_0x7e61('0x86')]));var _0x1aa195=this[_0x7e61('0x8b')][_0x7e61('0x76')](this,_0x4a6f64);if(_0x1aa195){this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0x123'),_0x1aa195));var _0x5b34e2=this[_0x7e61('0xe')]['streamFile'](_0x1aa195);try{fs[_0x7e61('0x105')](_0x1aa195+_0x7e61('0x106'));}catch(_0x3f7c8e){logger[_0x7e61('0x2f')](_0x3f7c8e);}return _0x5b34e2;}return this[_0x7e61('0xe')]['error'](_0x4a6f64,_0x7e61('0x124'));};AGIVertices[_0x7e61('0x10')]['awslex']=function(_0x1dd267){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x125'),_0x1dd267[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x1dd267[_0x7e61('0x90')])||!this['isConfigured'](_0x1dd267[_0x7e61('0x91')])){return this['channel'][_0x7e61('0xb1')](_0x7e61('0x126'));}if(!this[_0x7e61('0xac')](_0x1dd267[_0x7e61('0x93')])){return this['channel'][_0x7e61('0xb1')](_0x7e61('0x127'));}if(!this[_0x7e61('0xac')](_0x1dd267[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')]['bot']=!![];this[_0x7e61('0x37')](_0x1dd267);this[_0x7e61('0x43')](_0x1dd267[_0x7e61('0x86')],'in');this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1dd267[_0x7e61('0x86')]));var _0x302f50=this[_0x7e61('0x8f')][_0x7e61('0x76')](this,_0x1dd267);if(_0x302f50){for(var _0x2645e3 in _0x302f50){if(_0x302f50[_0x7e61('0x99')](_0x2645e3)&&_[_0x7e61('0x9e')](_0x302f50[_0x2645e3])){this[_0x7e61('0xe')]['setVariable'](util[_0x7e61('0x2b')](_0x7e61('0x128'),_0x2645e3[_0x7e61('0xf6')]()),_0x302f50[_0x2645e3]);}}if(_[_0x7e61('0x49')](_0x302f50[_0x7e61('0x7e')])){return this[_0x7e61('0xe')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x302f50[_0x7e61('0x7e')],_0x7e61('0xf8'));return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x129'),_0x302f50[_0x7e61('0x7e')]));}}return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x1dd267,_0x7e61('0x12a'));};AGIVertices['prototype']['googleasr']=function(_0x3a163a){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x12b'),_0x3a163a[_0x7e61('0xb0')],_0x3a163a[_0x7e61('0x6f')]));if(!this['isConfigured'](_0x3a163a['key'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xf4'));}var _0x24c191=_0x7e61('0x12c');var _0x2301e8=util[_0x7e61('0x2b')](_0x7e61('0x12d'),FILES_PATH,rs[_0x7e61('0x119')](0x4));var _0x315414=util[_0x7e61('0x2b')](_0x7e61('0xa0'),_0x2301e8,_0x24c191);var _0xd3835f=!![];if(_0x3a163a[_0x7e61('0x12e')]===_0x7e61('0x12f')){_0xd3835f=![];}var _0x7db782=this['channel'][_0x7e61('0x130')](_0x2301e8,_0x24c191,_0x3a163a[_0x7e61('0x131')],_0x3a163a[_0x7e61('0x6f')],undefined,_0xd3835f);if(_0x7db782['result']!==-0x1){this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x132'),_0x315414));var _0x1e4eaa=this['googleASR'][_0x7e61('0x76')](this,_0x3a163a,_0x315414);if(_0x1e4eaa){for(var _0x47c629 in _0x1e4eaa){if(_0x1e4eaa[_0x7e61('0x99')](_0x47c629)){this[_0x7e61('0xe')]['setVariable'](util[_0x7e61('0x2b')](_0x7e61('0x133'),_0x47c629[_0x7e61('0xf6')]()),_0x1e4eaa[_0x47c629]);}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x134'),JSON[_0x7e61('0x79')](_0x1e4eaa)));}}return _0x7db782;};AGIVertices[_0x7e61('0x10')][_0x7e61('0x135')]=function(_0x11a5dd){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x11a5dd[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x11a5dd[_0x7e61('0x136')])){return this[_0x7e61('0xe')]['noop']('no\x20appid\x20configured');}if(!this[_0x7e61('0xac')](_0x11a5dd[_0x7e61('0x137')])){return this[_0x7e61('0xe')]['noop'](_0x7e61('0x138'));}var _0x461731=_0x7e61('0x12c');var _0x54605c=util[_0x7e61('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x7e61('0x119')](0x4));var _0x30587d=util[_0x7e61('0x2b')]('%s.%s',_0x54605c,_0x461731);var _0x12cb0c=!![];if(_0x11a5dd[_0x7e61('0x12e')]===_0x7e61('0x12f')){_0x12cb0c=![];}var _0x15ac70=this[_0x7e61('0xe')]['recordFile'](_0x54605c,_0x461731,_0x11a5dd[_0x7e61('0x131')],_0x11a5dd[_0x7e61('0x6f')],undefined,_0x12cb0c);if(_0x15ac70['result']!==-0x1){this[_0x7e61('0xe')]['noop'](util['format'](_0x7e61('0x139'),_0x30587d));var _0x10a798=this[_0x7e61('0x96')][_0x7e61('0x76')](this,_0x11a5dd,_0x30587d);if(_0x10a798){for(var _0x320299 in _0x10a798){if(_0x10a798[_0x7e61('0x99')](_0x320299)){this[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0x13a'),_0x320299['toUpperCase']()),_0x10a798[_0x320299]);}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('TildeASR\x20Result\x20%s',JSON[_0x7e61('0x79')](_0x10a798)));}}return _0x15ac70;};AGIVertices[_0x7e61('0x10')][_0x7e61('0x13b')]=function(_0x254579){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x13c'),_0x254579[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0x13d')](_0x254579[_0x7e61('0x3e')],_0x254579[_0x7e61('0x3f')],_0x254579['priority']);};AGIVertices['prototype'][_0x7e61('0x13e')]=function(_0x4b9841){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x13f'),_0x4b9841['label']));if(!this[_0x7e61('0xac')](_0x4b9841[_0x7e61('0x140')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4b9841,_0x7e61('0x141'));}try{var _0x580df8=eval(_0x4b9841[_0x7e61('0x140')])?_0x7e61('0x142'):_0x7e61('0x143');this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0x144'),_0x4b9841[_0x7e61('0x140')],_0x580df8));return{'code':0xc8,'result':_0x580df8};}catch(_0x5304bb){return{'code':0xc8,'result':_0x7e61('0x143')};}};AGIVertices[_0x7e61('0x10')][_0x7e61('0x145')]=function(_0x5612f4){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5612f4[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x5612f4[_0x7e61('0x146')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x5612f4,'no\x20interval\x20configured');}var _0x427711=this[_0x7e61('0x25')]['sync'](this,_0x5612f4['interval_id']);if(!_0x427711){return this['channel']['error'](_0x5612f4,_0x7e61('0x147'));}for(var _0xed7cf8=0x0;_0xed7cf8<_0x427711[_0x7e61('0xa1')];_0xed7cf8+=0x1){var _0x31cbfb=this[_0x7e61('0xe')]['getVariable'](util[_0x7e61('0x2b')]('IFTIME(%s?true:false)',_0x427711[_0xed7cf8]));if(_0x31cbfb['result']===-0x1){return _0x31cbfb;}logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x148'),_0x427711[_0xed7cf8],_0x31cbfb[_0x7e61('0xa7')]));if(_0x31cbfb[_0x7e61('0xa7')]==='true'){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x148'),_0x427711[_0xed7cf8],'true'));this['channel'][_0x7e61('0xb1')](util['format']('IFTIME\x20%s\x20%s',_0x427711[_0xed7cf8],_0x7e61('0x142')));return{'code':0xc8,'result':_0x7e61('0x142')};}else{logger[_0x7e61('0x30')](util['format'](_0x7e61('0x148'),_0x427711[_0xed7cf8],_0x7e61('0x143')));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x148'),_0x427711[_0xed7cf8],_0x7e61('0x143')));}}return{'code':0xc8,'result':_0x7e61('0x143')};};AGIVertices['prototype'][_0x7e61('0x149')]=function(_0x346274){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x14a'),_0x346274[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0x149')]();};AGIVertices[_0x7e61('0x10')][_0x7e61('0x14b')]=function(_0x5ca520){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x14c'),_0x5ca520[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x5ca520[_0x7e61('0x82')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20key\x20configured');}var _0x448f56=_0x7e61('0x12c');var _0x91e48d=util[_0x7e61('0x2b')](_0x7e61('0x12d'),FILES_PATH,rs[_0x7e61('0x119')](0x4));var _0x28a3f2=util[_0x7e61('0x2b')](_0x7e61('0xa0'),_0x91e48d,_0x448f56);var _0x2d4f94=!![];if(_0x5ca520[_0x7e61('0x12e')]===_0x7e61('0x12f')){_0x2d4f94=![];}var _0x4df5c7=this[_0x7e61('0xe')][_0x7e61('0x130')](_0x91e48d,_0x448f56,_0x5ca520['intKey'],_0x5ca520[_0x7e61('0x6f')],undefined,_0x2d4f94);if(_0x4df5c7[_0x7e61('0xaa')]!==-0x1){this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0x14d'),_0x28a3f2));var _0xc4fde3=this['ispeechASR'][_0x7e61('0x76')](this,_0x5ca520,_0x28a3f2);if(_0xc4fde3){for(var _0x10a463 in _0xc4fde3){if(_0xc4fde3[_0x7e61('0x99')](_0x10a463)){this[_0x7e61('0xe')][_0x7e61('0xa2')](util['format'](_0x7e61('0x14e'),_0x10a463[_0x7e61('0xf6')]()),_0xc4fde3[_0x10a463]);}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x14f'),JSON[_0x7e61('0x79')](_0xc4fde3)));}}return _0x4df5c7;};AGIVertices[_0x7e61('0x10')][_0x7e61('0x150')]=function(_0x367899){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x151'),_0x367899[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x367899[_0x7e61('0x82')])){return this['channel'][_0x7e61('0xb1')](_0x7e61('0xf4'));}if(!this[_0x7e61('0xac')](_0x367899[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this['channel'][_0x7e61('0xb1')](util['format'](_0x7e61('0x152'),_0x367899[_0x7e61('0x86')]));var _0xf0ce2f=this['ispeechTTS'][_0x7e61('0x76')](this,_0x367899);if(_0xf0ce2f){this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format']('ispeech\x20%s\x20file\x20created',_0xf0ce2f));var _0x677b37=this['channel'][_0x7e61('0x104')](_0xf0ce2f,_0x367899['intKey']);try{fs[_0x7e61('0x105')](_0xf0ce2f+_0x7e61('0x106'));}catch(_0x390320){logger[_0x7e61('0x2f')](_0x390320);}return _0x677b37;}return this[_0x7e61('0xe')]['error'](_0x367899,_0x7e61('0x153'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x154')]=function(_0xbd5d63){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x155'),_0xbd5d63[_0x7e61('0xb0')]));if(!this['isConfigured'](_0xbd5d63['findBy'])){return this[_0x7e61('0xe')]['error'](_0xbd5d63,_0x7e61('0x156'));}logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x157'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0xbd5d63[_0x7e61('0x158')]));var _0x533268=this[_0x7e61('0x5e')][_0x7e61('0x76')](this,_0xbd5d63[_0x7e61('0x158')]);if(_0x533268){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x159'),this['channel'][_0x7e61('0x3b')],_0xbd5d63[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0xbd5d63[_0x7e61('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x7e61('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7e61('0xe')]['callerid'],_0xbd5d63[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0xbd5d63[_0x7e61('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7e61('0x10')][_0x7e61('0x15b')]=function(_0x399105){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x15c'),_0x399105['label']));if(!this[_0x7e61('0xac')](_0x399105[_0x7e61('0x158')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x399105,_0x7e61('0x156'));}logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x157'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x399105['findBy']));var _0x554a04=this[_0x7e61('0x5d')]['sync'](this,_0x399105[_0x7e61('0x158')]);if(_0x554a04){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')]['callerid'],_0x399105[_0x7e61('0x158')]));this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x399105[_0x7e61('0x158')]));return{'code':0xc8,'result':_0x7e61('0x15d')};}else{logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x399105['findBy']));this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x399105[_0x7e61('0x158')]));return{'code':0xc8,'result':_0x7e61('0x15e')};}};AGIVertices[_0x7e61('0x10')][_0x7e61('0x15f')]=function(_0xd8773d){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x160'),_0xd8773d[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0xd8773d['operation'])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0xd8773d,'no\x20operation\x20configured');}this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('math\x20%s',_0xd8773d[_0x7e61('0x161')]));var _0xf8742=eval(_0xd8773d[_0x7e61('0x161')]);if(!this['isConfigured'](_0xd8773d[_0x7e61('0xe4')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xe5'));}var _0x364d7a=this[_0x7e61('0x11')]['sync'](this,_0xd8773d[_0x7e61('0xe4')]);if(!_0x364d7a){return this['channel']['error'](_0xd8773d,_0x7e61('0x117'));}if(_[_0x7e61('0x9d')](_0xf8742)){var _0x2cbfe3=this;_0xf8742['forEach'](function(_0x352484,_0x1486f2){_0x2cbfe3[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0x162'),_0x364d7a,_0x1486f2),_0x352484);});return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x163'),_0x364d7a));}else{return this[_0x7e61('0xe')]['setVariable'](_0x364d7a,_0xf8742);}};AGIVertices[_0x7e61('0x10')][_0x7e61('0xb')]=function(_0x4bf770){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x164'),_0x4bf770['label']));if(_0x4bf770[_0x7e61('0xae')]===0x0){return this[_0x7e61('0xad')](_0x4bf770);}_0x4bf770[_0x7e61('0xae')]-=0x1;if(!this['isConfigured'](_0x4bf770[_0x7e61('0x111')])){return this['channel']['error'](_0x4bf770,_0x7e61('0x112'));}var _0x46b6a8=this[_0x7e61('0x1f')][_0x7e61('0x76')](this,_0x4bf770[_0x7e61('0x111')]);if(!_0x46b6a8){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4bf770,_0x7e61('0x165'));}var _0x18ab28=this[_0x7e61('0xe')][_0x7e61('0x113')](_0x46b6a8,_0x4bf770['response'],_0x4bf770[_0x7e61('0x166')]);var _0x48e2c2=_0x18ab28[_0x7e61('0xaa')];if(_0x18ab28['result']===-0x1){this[_0x7e61('0x37')]['sync'](this,_0x4bf770,'-1');return _0x18ab28;}else if(_0x18ab28[_0x7e61('0xa7')]==='timeout'){_0x18ab28[_0x7e61('0xaa')]=_0x18ab28[_0x7e61('0xaa')][_0x7e61('0xa1')]>0x0?_0x18ab28[_0x7e61('0xaa')]:'t';}else if(_[_0x7e61('0x50')](_0x18ab28[_0x7e61('0xaa')])){_0x18ab28[_0x7e61('0xaa')]='#';_0x48e2c2='#';}if(!this[_0x7e61('0xac')](_0x4bf770[_0x7e61('0xe4')])){this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xe5'));}else{var _0x4f8916=this[_0x7e61('0x11')][_0x7e61('0x76')](this,_0x4bf770[_0x7e61('0xe4')]);if(!_0x4f8916){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4bf770,_0x7e61('0x117'));}this['channel']['setVariable'](_0x4f8916,_0x48e2c2);}this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4bf770,_0x48e2c2);return _0x18ab28;};AGIVertices[_0x7e61('0x10')][_0x7e61('0xb1')]=function(_0x58e197){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x167'),_0x58e197[_0x7e61('0xb0')]));return this[_0x7e61('0xe')]['noop'](_0x58e197[_0x7e61('0x168')]||_0x58e197[_0x7e61('0xb0')]);};AGIVertices[_0x7e61('0x10')][_0x7e61('0x169')]=function(_0x5a71d8){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x16a'),_0x5a71d8[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x5a71d8[_0x7e61('0x158')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x5a71d8,_0x7e61('0x156'));}logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x157'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x5a71d8[_0x7e61('0x158')]));var _0x4edadc=this['getPause'][_0x7e61('0x76')](this,_0x5a71d8[_0x7e61('0x16b')]);var _0x47f5d1=this[_0x7e61('0x5b')]['sync'](this,_0x5a71d8['findBy'],_0x4edadc);if(_0x47f5d1){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')]['callerid'],_0x5a71d8['findBy']));this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x5a71d8[_0x7e61('0x158')]));return{'code':0xc8,'result':_0x7e61('0x15d')};}else{logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this['channel'][_0x7e61('0x3b')],_0x5a71d8[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x5a71d8[_0x7e61('0x158')]));return{'code':0xc8,'result':_0x7e61('0x15e')};}};AGIVertices['prototype']['playback']=function(_0x3fb505){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3fb505['label']));if(!this[_0x7e61('0xac')](_0x3fb505[_0x7e61('0x111')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3fb505,_0x7e61('0x112'));}var _0x15bc9f=this['getSound'][_0x7e61('0x76')](this,_0x3fb505[_0x7e61('0x111')]);if(!_0x15bc9f){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3fb505,_0x7e61('0x165'));}var _0x14ec77=this['channel']['exec'](_0x7e61('0x16c'),[_0x15bc9f,_0x3fb505[_0x7e61('0xf0')]]);if(_0x14ec77[_0x7e61('0xaa')]===-0x1){return _0x14ec77;}return this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xce'),_0x7e61('0x16c'),_0x15bc9f));};AGIVertices[_0x7e61('0x10')]['queue']=function(_0x3a1310){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x16d'),_0x3a1310[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x3a1310[_0x7e61('0x16e')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3a1310,_0x7e61('0x16f'));}var _0x486980='';var _0x37ddb8=parseInt(_0x3a1310[_0x7e61('0x16e')],0xa);if(isNaN(_0x37ddb8)){_0x486980=_0x3a1310[_0x7e61('0x16e')];}else{_0x486980=this['getVoiceQueue'][_0x7e61('0x76')](this,_0x3a1310[_0x7e61('0x16e')]);if(!_0x486980){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3a1310,_0x7e61('0x170'));}}var _0x5b5a07='';if(this['isConfigured'](_0x3a1310['file_id'])){var _0x389988=this['getSound'][_0x7e61('0x76')](this,_0x3a1310[_0x7e61('0x111')]);if(_0x389988){_0x5b5a07=_0x389988;}}this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x3a1310,_0x486980);if(_0x3a1310[_0x7e61('0xf0')][_0x7e61('0x171')]('x')<0x0){_0x3a1310[_0x7e61('0xf0')]+='x';}if(_0x3a1310['opts'][_0x7e61('0x171')]('X')<0x0){_0x3a1310[_0x7e61('0xf0')]+='X';}this['channel'][_0x7e61('0xa2')](_0x7e61('0x172'),_0x486980?_0x486980[_0x7e61('0x173')]():'');var _0x19f48b=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0x174'),[_0x486980,_0x3a1310[_0x7e61('0xf0')],_0x3a1310['url'],_0x5b5a07,_0x3a1310['timeout'],_0x3a1310['agi'],_0x3a1310[_0x7e61('0x175')],_0x3a1310[_0x7e61('0x176')],'',_0x3a1310[_0x7e61('0x177')]]);if(_0x19f48b['result']===-0x1){return _0x19f48b;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xce'),_0x7e61('0x174'),_0x486980));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x178')]=function(_0x311c2c){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x179'),_0x311c2c[_0x7e61('0xb0')]));var _0x1a5ce2=_0x311c2c[_0x7e61('0x17a')]||_0x7e61('0x12c');var _0x2d5c72=util[_0x7e61('0x2b')](_0x7e61('0x17b'),this[_0x7e61('0xe')][_0x7e61('0x38')],rs[_0x7e61('0x119')](0x5));var _0x4ef61b=util[_0x7e61('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x2d5c72,_0x1a5ce2);var _0x11873f=util[_0x7e61('0x2b')]('%s/recordings/%s',FILES_PATH,_0x2d5c72);this[_0x7e61('0x3c')][_0x7e61('0x76')](this,_0x311c2c,_0x2d5c72,_0x4ef61b);this[_0x7e61('0xe')][_0x7e61('0xa2')](_0x7e61('0x17c'),_0x2d5c72);logger[_0x7e61('0x30')](_0x7e61('0x17d'),_0x11873f,_0x1a5ce2,_0x311c2c[_0x7e61('0x17e')],_0x311c2c[_0x7e61('0x6f')]);return this[_0x7e61('0xe')][_0x7e61('0x130')](_0x11873f,_0x1a5ce2,_0x311c2c[_0x7e61('0x17e')],_0x311c2c[_0x7e61('0x6f')],undefined,!![]);};AGIVertices[_0x7e61('0x10')][_0x7e61('0x17f')]=function(_0x400f73){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x180'),_0x400f73[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x400f73[_0x7e61('0x6d')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20url\x20configured');}var _0x287252=this[_0x7e61('0x6c')][_0x7e61('0x76')](this,_0x400f73);logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Response:',util['inspect'](_0x287252,{'showHidden':![],'depth':null})));if(!this[_0x7e61('0xac')](_0x400f73['variable_id'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x181'));}var _0xdc34c5=this['getVariable'][_0x7e61('0x76')](this,_0x400f73[_0x7e61('0xe4')]);if(!_0xdc34c5){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x400f73,_0x7e61('0x117'));}this[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0x182'),_0xdc34c5),_0x287252[_0x7e61('0x7d')]?_0x287252[_0x7e61('0x7d')]:'200');this[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')]('%s_STATUS_MESSAGE',_0xdc34c5),_0x287252[_0x7e61('0x183')]?_0x287252[_0x7e61('0x183')]:'OK');if(_0x287252['body']){try{this[_0x7e61('0x9f')](_0x287252[_0x7e61('0x7b')],_0xdc34c5);}catch(_0x12ebc0){logger['error'](util['format'](_0x7e61('0x184'),_0xdc34c5));}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xea'),_0xdc34c5));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x185')]=function(_0x2be27e){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2be27e['label']));return this[_0x7e61('0xe')][_0x7e61('0x186')](_0x2be27e[_0x7e61('0x187')][_0x7e61('0x64')](/\s+/g,''),_0x2be27e['escape_digits']);};AGIVertices['prototype'][_0x7e61('0x188')]=function(_0x56e119){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x56e119[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0x189')](_0x56e119[_0x7e61('0x18a')]['replace'](/\s+/g,''),_0x56e119['escape_digits']);};AGIVertices['prototype'][_0x7e61('0x18b')]=function(_0x1172e4){logger[_0x7e61('0x30')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1172e4[_0x7e61('0xb0')]));return this['channel']['sayPhonetic'](_0x1172e4[_0x7e61('0x86')],_0x1172e4['escape_digits']);};AGIVertices[_0x7e61('0x10')]['sendMail']=function(_0x28bba9){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x28bba9['label']));if(!this['isConfigured'](_0x28bba9[_0x7e61('0x18c')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x18d'));}var _0x2b4f2b=this['getMailAccount'][_0x7e61('0x76')](this,_0x28bba9[_0x7e61('0x18c')]);if(!_0x2b4f2b||!_0x2b4f2b[_0x7e61('0x18e')]){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x28bba9,_0x7e61('0x18f'));}var _0x68763f={'from':util['format'](_0x7e61('0x190'),_0x2b4f2b[_0x7e61('0x13')],_0x2b4f2b[_0x7e61('0x191')]||_0x2b4f2b['Smtp'][_0x7e61('0x192')]),'to':_0x28bba9['to']||'','cc':_0x28bba9['cc']||'','bcc':_0x28bba9['bcc']||'','subject':_0x28bba9[_0x7e61('0x193')],'html':_0x28bba9['text'],'text':_0x28bba9['text']};var _0xff7325={'tls':{'rejectUnauthorized':![]}};if(_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x194')]){_0xff7325['service']=_0x2b4f2b[_0x7e61('0x18e')]['service'];}else{_0xff7325[_0x7e61('0x195')]=_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x195')];_0xff7325[_0x7e61('0x196')]=_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x196')];_0xff7325[_0x7e61('0x197')]=_0x2b4f2b['Smtp'][_0x7e61('0x197')];}if(_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x198')]){_0xff7325[_0x7e61('0x199')]={'user':_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x192')],'pass':_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x19a')]};}if(this[_0x7e61('0xac')](_0x28bba9[_0x7e61('0x19b')])){}logger[_0x7e61('0xeb')](_0x7e61('0x19c'),JSON[_0x7e61('0x79')](_0x68763f));this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x28bba9,_0x28bba9[_0x7e61('0x18c')]);this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0x19d'),_0x2b4f2b[_0x7e61('0x13')]));this[_0x7e61('0x24')]['sync'](this,_0xff7325,_0x68763f);return this['channel'][_0x7e61('0xb1')](_0x7e61('0x19e'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x19f')]=function(_0x3adb50){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x1a0'),_0x3adb50[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x1a1'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1a2')]=function(_0x48d366){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1a3'),_0x48d366[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x48d366[_0x7e61('0x1a4')])){return this['channel'][_0x7e61('0xb1')]('no\x20sms\x20account\x20configured');}var _0x58ecda=this[_0x7e61('0x35')][_0x7e61('0x76')](this,_0x48d366['sms_account_id']);if(!_0x58ecda){return this['channel'][_0x7e61('0x2f')](_0x48d366,_0x7e61('0x1a5'));}var _0x1ae30e={'body':_0x48d366['sms_text'],'phone':_0x48d366['to']||'','SmsAccountId':_0x58ecda['id']};logger[_0x7e61('0xeb')](_0x7e61('0x1a6'),JSON[_0x7e61('0x79')](_0x1ae30e));this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x48d366,_0x48d366[_0x7e61('0x1a4')]);this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1a7'),_0x58ecda[_0x7e61('0x13')]));this[_0x7e61('0x36')][_0x7e61('0x76')](this,_0x1ae30e);return this[_0x7e61('0xe')]['noop'](_0x7e61('0x1a8'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1a9')]=function(_0x3aae17){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1aa'),_0x3aae17[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x3aae17['variable_id'])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3aae17,'no\x20variable\x20selected');}var _0x5d34e0=this[_0x7e61('0x11')][_0x7e61('0x76')](this,_0x3aae17[_0x7e61('0xe4')]);if(!_0x5d34e0){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3aae17,'no\x20variable\x20found');}return this['channel']['setVariable'](_0x5d34e0,_0x3aae17['variable_value']);};AGIVertices[_0x7e61('0x10')]['start']=function(_0x527bb1){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x1ab'),_0x527bb1[_0x7e61('0xb0')]));this[_0x7e61('0xe')]['noop'](_0x7e61('0x1ac'));if(_0x527bb1['answer']===_0x7e61('0x1ad')){this['channel']['noop'](_0x7e61('0x1ae'));return this[_0x7e61('0xe')][_0x7e61('0xbf')]();}return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x1af'));};AGIVertices[_0x7e61('0x10')]['subproject']=function(_0x359f5b){logger['info'](util['format'](_0x7e61('0x1b0'),_0x359f5b[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x359f5b['project_id'])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x359f5b,'no\x20subproject\x20selected');}var _0x43228e=this[_0x7e61('0x1b1')][_0x7e61('0x76')](this,_0x359f5b[_0x7e61('0x1b2')]);if(!this['isConfigured'](_0x43228e)){return this['channel'][_0x7e61('0x2f')](_0x359f5b,util[_0x7e61('0x2b')](_0x7e61('0x1b3'),_0x359f5b[_0x7e61('0x1b2')]));}if(_0x43228e===this[_0x7e61('0xe')][_0x7e61('0x3a')]){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x359f5b,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x359f5b,_0x43228e);var _0x343b3f=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0x1b4'),util[_0x7e61('0x2b')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x7e61('0x195')]||_0x7e61('0x1b5'),_0x43228e,this[_0x7e61('0xe')]['arg_1']));if(_0x343b3f[_0x7e61('0xaa')]===-0x1){return _0x343b3f;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('Executed\x20command\x20%s\x20%s',_0x7e61('0x1b4'),_0x43228e));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1b6')]=function(_0x3d9d6a){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x3d9d6a[_0x7e61('0xb0')]));var _0x8f1a44=this[_0x7e61('0x1b7')][_0x7e61('0x76')](this,_0x3d9d6a[_0x7e61('0xbd')]);this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x3d9d6a,_0x3d9d6a['command']);if(this[_0x7e61('0xac')](_0x3d9d6a[_0x7e61('0xe4')])){var _0x4418cd=this[_0x7e61('0x11')][_0x7e61('0x76')](this,_0x3d9d6a[_0x7e61('0xe4')]);if(_0x4418cd){this[_0x7e61('0xe')]['setVariable'](_0x4418cd,_0x8f1a44);return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1b8'),_0x3d9d6a['command'],_0x4418cd));}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1b9'),_0x3d9d6a['command']));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1ba')]=function(_0x213995){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1bb'),_0x213995[_0x7e61('0xb0')]));_0x213995[_0x7e61('0x86')]=_0x213995[_0x7e61('0x86')][_0x7e61('0x64')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7e61('0xac')](_0x213995[_0x7e61('0x1bc')])){return this[_0x7e61('0xe')]['noop'](_0x7e61('0x1bd'));}if(!this['isConfigured'](_0x213995['text'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this['channel']['noop'](util[_0x7e61('0x2b')](_0x7e61('0x1be'),_0x213995['text']));var _0x18fd98=this['googleCloudTTS'][_0x7e61('0x76')](this,_0x213995);if(_0x18fd98){this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1bf'),_0x18fd98));var _0xfaca46=this[_0x7e61('0xe')][_0x7e61('0x104')](_0x18fd98);try{fs['unlink'](_0x18fd98+'.wav');}catch(_0x405697){logger[_0x7e61('0x2f')](_0x405697);}return _0xfaca46;}return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x213995,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1c0')]=function(_0x4b9e57){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1c1'),_0x4b9e57[_0x7e61('0xb0')]));_0x4b9e57[_0x7e61('0x86')]=_0x4b9e57[_0x7e61('0x86')][_0x7e61('0x64')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7e61('0xac')](_0x4b9e57['text'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0x1c2'),_0x4b9e57['text']));var _0x3ed9f0=this[_0x7e61('0x6b')][_0x7e61('0x76')](this,_0x4b9e57);if(_0x3ed9f0){this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1c3'),_0x3ed9f0));var _0x128cf6=this[_0x7e61('0xe')][_0x7e61('0x104')](_0x3ed9f0);try{fs['unlink'](_0x3ed9f0+'.wav');}catch(_0x5d7d6d){logger[_0x7e61('0x2f')](_0x5d7d6d);}return _0x128cf6;}return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4b9e57,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7e61('0x10')]['unpause']=function(_0x3f8402){logger['info'](util['format'](_0x7e61('0x1c4'),_0x3f8402[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x3f8402[_0x7e61('0x158')])){return this['channel'][_0x7e61('0x2f')](_0x3f8402,'no\x20find\x20by\x20configured');}logger[_0x7e61('0x30')](util['format'](_0x7e61('0x157'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x3f8402[_0x7e61('0x158')]));var _0x4f5fd7=this[_0x7e61('0x5c')][_0x7e61('0x76')](this,_0x3f8402[_0x7e61('0x158')]);if(_0x4f5fd7){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')]['callerid'],_0x3f8402[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x3f8402[_0x7e61('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x3f8402[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x3f8402[_0x7e61('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7e61('0x10')]['voicemail']=function(_0x3148ad){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1c5'),_0x3148ad[_0x7e61('0xb0')]));var _0x4c619d=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0x1c6'),[_0x3148ad['mailbox'],_0x3148ad[_0x7e61('0x80')]]);if(_0x4c619d[_0x7e61('0xaa')]===-0x1){return _0x4c619d;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x3148ad['mailbox']));};AGIVertices['prototype'][_0x7e61('0x1c7')]=function(_0x164830){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1c8'),_0x164830[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x164830[_0x7e61('0xe4')])){return this['channel'][_0x7e61('0x2f')](_0x164830,_0x7e61('0x1c9'));}var _0xa009ce=this['getVariable']['sync'](this,_0x164830[_0x7e61('0xe4')]);if(!_0xa009ce){return this['channel'][_0x7e61('0x2f')](_0x164830,_0x7e61('0x117'));}var _0x4b72bb=this['channel'][_0x7e61('0x11')](_0xa009ce);return{'code':0xc8,'result':_0x4b72bb[_0x7e61('0xa7')]?_0x4b72bb['extra']:'-'};};String[_0x7e61('0x10')][_0x7e61('0xa6')]=function(_0x33cc65,_0x12a72b){return this['split'](_0x33cc65)[_0x7e61('0x1ca')](_0x12a72b);};module[_0x7e61('0x1cb')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e722519..3e47723 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 _0x5fd1=['../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','message','stopAcw','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami'];(function(_0x13f186,_0xd8356d){var _0x93fcb0=function(_0x2f6ba4){while(--_0x2f6ba4){_0x13f186['push'](_0x13f186['shift']());}};_0x93fcb0(++_0xd8356d);}(_0x5fd1,0x155));var _0x15fd=function(_0x206959,_0x3ed81f){_0x206959=_0x206959-0x0;var _0x4d04b1=_0x5fd1[_0x206959];return _0x4d04b1;};'use strict';var util=require(_0x15fd('0x0'));var _=require('lodash');var moment=require(_0x15fd('0x1'));var ami=require(_0x15fd('0x2'));var logger=require(_0x15fd('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x15fd('0x4'));function Acw(_0x3138f3){this[_0x15fd('0x5')]=_0x3138f3['voiceQueues'];this[_0x15fd('0x6')]=_0x3138f3[_0x15fd('0x6')];this[_0x15fd('0x7')]=_0x3138f3[_0x15fd('0x7')];this[_0x15fd('0x8')]={};ami['on']('agentconnect',this[_0x15fd('0x9')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xb'),this['syncHangupRequest'][_0x15fd('0xa')](this));ami['on']('hangup',this[_0x15fd('0xc')][_0x15fd('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x15fd('0xd'),this[_0x15fd('0xe')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xf'),this[_0x15fd('0x10')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0x11'),this[_0x15fd('0x12')][_0x15fd('0xa')](this));}function getDiff(_0x4cb391){var _0x5b7af0=moment()['milliseconds'](0x0);var _0x3fda60=moment(_0x4cb391)[_0x15fd('0x13')](0x0);return _0x5b7af0[_0x15fd('0x14')](_0x3fda60,_0x15fd('0x15'));}Acw[_0x15fd('0x16')][_0x15fd('0x17')]=function(_0x2c5375){try{var _0x44a63a=this;var _0x5aae13=this['channels'][_0x2c5375][_0x15fd('0x18')];var _0x5ca5a2=this[_0x15fd('0x8')][_0x2c5375]['queue'];var _0x917fe4=this[_0x15fd('0x5')][_0x5ca5a2];var _0x855bae=![];var _0x49ceac=_0x15fd('0x19');if(_0x917fe4[_0x15fd('0x1a')]){if(_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')]){_0x855bae=!![];_0x49ceac=_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')];}}ami[_0x15fd('0x1d')]({'action':_0x15fd('0x1e'),'interface':_0x5aae13,'paused':!![],'reason':_0x49ceac})[_0x15fd('0x1f')](function(_0x1eab55){if(_0x44a63a[_0x15fd('0x6')][_0x5aae13]){return RpcUser['getAgent'](_0x44a63a['agents'][_0x5aae13]['id'])[_0x15fd('0x1f')](function(_0x36b21e){if(_0x36b21e&&!_0x36b21e[_0x15fd('0x20')]){logger[_0x15fd('0x21')](_0x15fd('0x22'),_0x2c5375,_0x5aae13,_0x5ca5a2);var _0x11496a=_0x44a63a[_0x15fd('0x8')][_0x2c5375]['attended']&&_0x44a63a[_0x15fd('0x8')][_0x2c5375][_0x15fd('0x23')]?_0x44a63a[_0x15fd('0x8')][_0x2c5375]['destlinkedid']:_0x2c5375;return RpcUser[_0x15fd('0x24')](_0x44a63a['agents'][_0x5aae13],_0x49ceac,_0x11496a)[_0x15fd('0x1f')](function(_0x1fc24f){if(!_0x855bae){_0x44a63a[_0x15fd('0x7')][_0x5aae13]={};logger['info'](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')],_0x5aae13,_0x5ca5a2);_0x44a63a['timers'][_0x5aae13][_0x15fd('0x27')]=setTimeout(_0x44a63a['stopAcw'][_0x15fd('0xa')](_0x44a63a,_0x5aae13),_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')]*0x3e8);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x28')]=moment()[_0x15fd('0x29')](_0x15fd('0x2a'));_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')]=_0x2c5375;_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2c')]=_0x5ca5a2;_0x44a63a['timers'][_0x5aae13][_0x15fd('0x2d')]=function(){var _0x2fe61e=getDiff(_0x44a63a['timers'][_0x5aae13][_0x15fd('0x28')]);clearTimeout(_0x44a63a[_0x15fd('0x7')][_0x5aae13]['timer']);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2fe61e},_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')],_0x5aae13)[_0x15fd('0x1f')](function(_0x476828){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x2c5375,_0x2fe61e,_0x476828);})['catch'](function(_0x2d647c){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x2c5375,_0x2d647c);});delete _0x44a63a[_0x15fd('0x7')][_0x5aae13];};}});}else{logger['info'](_0x15fd('0x31'),_0x2c5375,_0x5aae13,_0x5ca5a2);}});}})[_0x15fd('0x32')](function(_0x11b3a1){logger[_0x15fd('0x2f')](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2]['acwTimeout'],_0x5aae13,_0x5ca5a2);})[_0x15fd('0x33')](function(){delete _0x44a63a[_0x15fd('0x8')][_0x2c5375];});}catch(_0x57c118){logger[_0x15fd('0x2f')](_0x15fd('0x34'),_0x57c118[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0x36')]=function(_0x309851){try{var _0x1732bc=this;if(_0x1732bc[_0x15fd('0x7')][_0x309851]){_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x27')]=![];var _0x4d7259=_0x1732bc['timers'][_0x309851]['uniqueid'];var _0x340d17=_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x2c')];var _0x4e608d=_0x1732bc['voiceQueues'][_0x340d17][_0x15fd('0x26')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x309851);RpcUser['saveUnpause'](this[_0x15fd('0x6')][_0x309851]);RpcVoiceAgentReport[_0x15fd('0x37')]({'acwtime':_0x4e608d,'agentacw':!![]},_0x4d7259,_0x309851)[_0x15fd('0x1f')](function(_0x59d0d7){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x4d7259,_0x4e608d,_0x59d0d7);})[_0x15fd('0x32')](function(_0x5beb6e){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x4d7259,_0x5beb6e);});}else{logger[_0x15fd('0x2f')](_0x15fd('0x38'),_0x309851);if(_0x1732bc[_0x15fd('0x7')]){logger[_0x15fd('0x21')](_0x15fd('0x39'),JSON[_0x15fd('0x3a')](_0x1732bc[_0x15fd('0x7')]));}}}catch(_0x5dd3c4){logger[_0x15fd('0x2f')](_0x15fd('0x3b'),_0x5dd3c4[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x9')]=function(_0x5f9429){try{if(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]]&&(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x5f9429['interface']]){this[_0x15fd('0x8')][_0x5f9429[_0x15fd('0x2b')]]={'queue':_0x5f9429[_0x15fd('0x2c')],'interface':_0x5f9429[_0x15fd('0x18')],'destlinkedid':_0x5f9429[_0x15fd('0x23')]};}}}catch(_0x44d08b){logger[_0x15fd('0x2f')](_0x15fd('0x3d'),_0x44d08b['message']);}};Acw['prototype'][_0x15fd('0x12')]=function(_0x57bbd5){try{if(this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]]&&(this['voiceQueues'][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x57bbd5['interface']]){this[_0x15fd('0x8')][_0x57bbd5[_0x15fd('0x2b')]]={'queue':_0x57bbd5[_0x15fd('0x2c')],'interface':_0x57bbd5[_0x15fd('0x18')]};}}}catch(_0xcce802){logger[_0x15fd('0x2f')](_0x15fd('0x3e'),_0xcce802[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x3f')]=function(_0x16b4f5){try{if(this[_0x15fd('0x8')][_0x16b4f5['uniqueid']]&&_[_0x15fd('0x40')](this['channels'][_0x16b4f5[_0x15fd('0x2b')]][_0x15fd('0x41')])){logger[_0x15fd('0x21')]('[%s][HANGUP:UNIQUEID]',_0x16b4f5[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x16b4f5[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x16b4f5['linkedid']]&&_[_0x15fd('0x40')](this[_0x15fd('0x8')][_0x16b4f5[_0x15fd('0x42')]][_0x15fd('0x41')])){logger['info'](_0x15fd('0x43'),_0x16b4f5[_0x15fd('0x42')]);this['startAcw'](_0x16b4f5['linkedid']);}}catch(_0x5da44c){logger[_0x15fd('0x2f')](_0x15fd('0x44'),_0x5da44c[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0xc')]=function(_0x33a128){try{if(this['channels'][_0x33a128[_0x15fd('0x2b')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x2b')]]['attended']){logger[_0x15fd('0x21')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x33a128[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]][_0x15fd('0x41')]){logger[_0x15fd('0x21')](_0x15fd('0x45'),_0x33a128[_0x15fd('0x42')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x42')]);}}catch(_0x5343b8){logger[_0x15fd('0x2f')]('[ACW][syncHangup]\x20%s',_0x5343b8[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0xe')]=function(_0x1fac7f){try{if(!_[_0x15fd('0x46')](this['channels'][_0x1fac7f['transfereeuniqueid']])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x47')]);if(this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]]){this['channels'][_0x1fac7f[_0x15fd('0x48')]][_0x15fd('0x41')]=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]]=this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]];delete this['channels'][_0x1fac7f[_0x15fd('0x48')]];}}else if(!_[_0x15fd('0x46')](this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x49')]);if(this['channels'][_0x1fac7f['origtransfereruniqueid']]){this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]]['attended']=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x47')]]=this['channels'][_0x1fac7f[_0x15fd('0x4a')]];delete this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]];}}}catch(_0x53bfd7){logger[_0x15fd('0x2f')](_0x15fd('0x4b'),_0x53bfd7[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x10')]=function(_0x1f4581){try{if(this[_0x15fd('0x8')][_0x1f4581[_0x15fd('0x4c')]]){logger[_0x15fd('0x21')](_0x15fd('0x4d'),JSON['stringify'](_0x1f4581[_0x15fd('0x4c')]));this[_0x15fd('0x17')](_0x1f4581['transfereruniqueid']);}else if(this['channels'][_0x1f4581[_0x15fd('0x4e')]]){logger[_0x15fd('0x21')](_0x15fd('0x4f'),JSON[_0x15fd('0x3a')](_0x1f4581[_0x15fd('0x4e')]));this[_0x15fd('0x17')](_0x1f4581['transfererlinkedid']);}}catch(_0x41d398){logger[_0x15fd('0x2f')](_0x15fd('0x50'),_0x41d398[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x51')]=function(_0xf27ab4){try{if(this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]&&this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]['autopause']==='all'){if(this[_0x15fd('0x6')][_0xf27ab4[_0x15fd('0x18')]]){logger[_0x15fd('0x21')](_0x15fd('0x52'),_0xf27ab4[_0x15fd('0x2b')],_0xf27ab4[_0x15fd('0x18')],_0xf27ab4[_0x15fd('0x2c')]);return RpcUser['savePause'](this[_0x15fd('0x6')][_0xf27ab4['interface']],_0x15fd('0x53'),_0xf27ab4['uniqueid']);}}}catch(_0x1c2828){logger['error'](_0x15fd('0x54'),_0x1c2828[_0x15fd('0x35')]);}};module[_0x15fd('0x55')]=Acw; \ No newline at end of file +var _0xd0bb=['name','mandatoryDispositionPause','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','startAcw','queue','mandatoryDisposition'];(function(_0x2dd593,_0x4a1d22){var _0x37bde9=function(_0x2037bc){while(--_0x2037bc){_0x2dd593['push'](_0x2dd593['shift']());}};_0x37bde9(++_0x4a1d22);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x1eed52,_0x1bb3c1){_0x1eed52=_0x1eed52-0x0;var _0x57782a=_0xd0bb[_0x1eed52];return _0x57782a;};'use strict';var util=require(_0xbd0b('0x0'));var _=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var ami=require('../ami');var logger=require(_0xbd0b('0x3'))('acw');var RpcUser=require(_0xbd0b('0x4'));var RpcVoiceAgentReport=require(_0xbd0b('0x5'));function Acw(_0x53e6ce){this[_0xbd0b('0x6')]=_0x53e6ce['voiceQueues'];this[_0xbd0b('0x7')]=_0x53e6ce[_0xbd0b('0x7')];this[_0xbd0b('0x8')]=_0x53e6ce[_0xbd0b('0x8')];this[_0xbd0b('0x9')]={};ami['on']('agentconnect',this[_0xbd0b('0xa')][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xc'),this[_0xbd0b('0xd')][_0xbd0b('0xb')](this));ami['on']('hangup',this['syncHangup'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xe'),this['syncAgentRingNoAnswer'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xf'),this['syncAttendedTransfer'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0x10'),this[_0xbd0b('0x11')][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0x12'),this[_0xbd0b('0x13')][_0xbd0b('0xb')](this));}function getDiff(_0x1f25b6){var _0x1a55ab=moment()[_0xbd0b('0x14')](0x0);var _0x2d4664=moment(_0x1f25b6)['milliseconds'](0x0);return _0x1a55ab[_0xbd0b('0x15')](_0x2d4664,'seconds');}Acw['prototype'][_0xbd0b('0x16')]=function(_0x4c0e52){try{var _0x3183cf=this;var _0x40b075=this[_0xbd0b('0x9')][_0x4c0e52]['interface'];var _0x55e0a1=this[_0xbd0b('0x9')][_0x4c0e52][_0xbd0b('0x17')];var _0x1f2a6e=this[_0xbd0b('0x6')][_0x55e0a1];var _0x1c0a7c=![];var _0x40b798='ACW';if(_0x1f2a6e[_0xbd0b('0x18')]){if(_0x1f2a6e['mandatoryDispositionPause'][_0xbd0b('0x19')]){_0x1c0a7c=!![];_0x40b798=_0x1f2a6e[_0xbd0b('0x1a')][_0xbd0b('0x19')];}}ami[_0xbd0b('0x1b')]({'action':'QueuePause','interface':_0x40b075,'paused':!![],'reason':_0x40b798})[_0xbd0b('0x1c')](function(_0x38c27f){if(_0x3183cf[_0xbd0b('0x7')][_0x40b075]){return RpcUser['getAgent'](_0x3183cf[_0xbd0b('0x7')][_0x40b075]['id'])['then'](function(_0xc66b8){if(_0xc66b8&&!_0xc66b8[_0xbd0b('0x1d')]){logger[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x4c0e52,_0x40b075,_0x55e0a1);var _0x297c85=_0x3183cf['channels'][_0x4c0e52][_0xbd0b('0x20')]&&_0x3183cf['channels'][_0x4c0e52][_0xbd0b('0x21')]?_0x3183cf[_0xbd0b('0x9')][_0x4c0e52][_0xbd0b('0x21')]:_0x4c0e52;return RpcUser[_0xbd0b('0x22')](_0x3183cf[_0xbd0b('0x7')][_0x40b075],_0x40b798,_0x297c85)[_0xbd0b('0x1c')](function(_0x4fe9ed){if(!_0x1c0a7c){_0x3183cf[_0xbd0b('0x8')][_0x40b075]={};logger[_0xbd0b('0x1e')](_0xbd0b('0x23'),_0x4c0e52,_0x3183cf[_0xbd0b('0x6')][_0x55e0a1][_0xbd0b('0x24')],_0x40b075,_0x55e0a1);_0x3183cf[_0xbd0b('0x8')][_0x40b075]['timer']=setTimeout(_0x3183cf[_0xbd0b('0x25')][_0xbd0b('0xb')](_0x3183cf,_0x40b075),_0x3183cf[_0xbd0b('0x6')][_0x55e0a1]['acwTimeout']*0x3e8);_0x3183cf['timers'][_0x40b075][_0xbd0b('0x26')]=moment()[_0xbd0b('0x27')](_0xbd0b('0x28'));_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x29')]=_0x4c0e52;_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x17')]=_0x55e0a1;_0x3183cf['timers'][_0x40b075][_0xbd0b('0x2a')]=function(){var _0x3b70b4=getDiff(_0x3183cf['timers'][_0x40b075]['lastPauseAt']);clearTimeout(_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x2b')]);_0x3183cf['timers'][_0x40b075][_0xbd0b('0x2b')]=![];RpcVoiceAgentReport[_0xbd0b('0x2c')]({'acwtime':_0x3b70b4},_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x29')],_0x40b075)[_0xbd0b('0x1c')](function(_0x27c478){logger['info'](_0xbd0b('0x2d'),_0x4c0e52,_0x3b70b4,_0x27c478);})[_0xbd0b('0x2e')](function(_0x32572e){logger[_0xbd0b('0x2f')](_0xbd0b('0x30'),_0x4c0e52,_0x32572e);});delete _0x3183cf[_0xbd0b('0x8')][_0x40b075];};}});}else{logger[_0xbd0b('0x1e')](_0xbd0b('0x31'),_0x4c0e52,_0x40b075,_0x55e0a1);}});}})[_0xbd0b('0x2e')](function(_0x3ac75f){logger[_0xbd0b('0x2f')](_0xbd0b('0x23'),_0x4c0e52,_0x3183cf[_0xbd0b('0x6')][_0x55e0a1][_0xbd0b('0x24')],_0x40b075,_0x55e0a1);})['finally'](function(){delete _0x3183cf[_0xbd0b('0x9')][_0x4c0e52];});}catch(_0x23b0fa){logger['error'](_0xbd0b('0x32'),_0x23b0fa[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x25')]=function(_0x27ad8b){try{var _0x288715=this;if(_0x288715['timers'][_0x27ad8b]){_0x288715[_0xbd0b('0x8')][_0x27ad8b][_0xbd0b('0x2b')]=![];var _0x3b5098=_0x288715[_0xbd0b('0x8')][_0x27ad8b][_0xbd0b('0x29')];var _0x47c961=_0x288715['timers'][_0x27ad8b][_0xbd0b('0x17')];var _0x8db305=_0x288715[_0xbd0b('0x6')][_0x47c961][_0xbd0b('0x24')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x27ad8b);RpcUser[_0xbd0b('0x35')](this['agents'][_0x27ad8b]);RpcVoiceAgentReport[_0xbd0b('0x2c')]({'acwtime':_0x8db305,'agentacw':!![]},_0x3b5098,_0x27ad8b)[_0xbd0b('0x1c')](function(_0x3f34dc){logger[_0xbd0b('0x1e')](_0xbd0b('0x2d'),_0x3b5098,_0x8db305,_0x3f34dc);})[_0xbd0b('0x2e')](function(_0x43115e){logger[_0xbd0b('0x2f')](_0xbd0b('0x30'),_0x3b5098,_0x43115e);});}else{logger[_0xbd0b('0x2f')](_0xbd0b('0x36'),_0x27ad8b);if(_0x288715[_0xbd0b('0x8')]){logger[_0xbd0b('0x1e')](_0xbd0b('0x37'),JSON[_0xbd0b('0x38')](_0x288715[_0xbd0b('0x8')]));}}}catch(_0x16c77c){logger[_0xbd0b('0x2f')]('[ACW][STOP]\x20%s',_0x16c77c[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0xa')]=function(_0x3f4d9b){try{if(this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]]&&(this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]][_0xbd0b('0x39')]||this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]][_0xbd0b('0x18')])){if(this['agents'][_0x3f4d9b[_0xbd0b('0x3a')]]){this['channels'][_0x3f4d9b['uniqueid']]={'queue':_0x3f4d9b[_0xbd0b('0x17')],'interface':_0x3f4d9b[_0xbd0b('0x3a')],'destlinkedid':_0x3f4d9b[_0xbd0b('0x21')]};}}}catch(_0x580fa2){logger[_0xbd0b('0x2f')](_0xbd0b('0x3b'),_0x580fa2[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x13')]=function(_0x4f1e3a){try{if(this[_0xbd0b('0x6')][_0x4f1e3a[_0xbd0b('0x17')]]&&(this[_0xbd0b('0x6')][_0x4f1e3a[_0xbd0b('0x17')]][_0xbd0b('0x39')]||this[_0xbd0b('0x6')][_0x4f1e3a['queue']][_0xbd0b('0x18')])){if(this[_0xbd0b('0x7')][_0x4f1e3a[_0xbd0b('0x3a')]]){this[_0xbd0b('0x9')][_0x4f1e3a[_0xbd0b('0x29')]]={'queue':_0x4f1e3a[_0xbd0b('0x17')],'interface':_0x4f1e3a[_0xbd0b('0x3a')]};}}}catch(_0x563c64){logger[_0xbd0b('0x2f')](_0xbd0b('0x3c'),_0x563c64[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0xd')]=function(_0x30f77e){try{if(this[_0xbd0b('0x9')][_0x30f77e[_0xbd0b('0x29')]]&&_[_0xbd0b('0x3d')](this[_0xbd0b('0x9')][_0x30f77e[_0xbd0b('0x29')]][_0xbd0b('0x20')])){logger[_0xbd0b('0x1e')](_0xbd0b('0x3e'),_0x30f77e[_0xbd0b('0x29')]);this['startAcw'](_0x30f77e[_0xbd0b('0x29')]);}else if(this[_0xbd0b('0x9')][_0x30f77e['linkedid']]&&_['isUndefined'](this['channels'][_0x30f77e[_0xbd0b('0x3f')]]['attended'])){logger[_0xbd0b('0x1e')](_0xbd0b('0x40'),_0x30f77e[_0xbd0b('0x3f')]);this[_0xbd0b('0x16')](_0x30f77e['linkedid']);}}catch(_0x2d2e58){logger['error'](_0xbd0b('0x41'),_0x2d2e58['message']);}};Acw['prototype'][_0xbd0b('0x42')]=function(_0x22f741){try{if(this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x29')]]&&this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x29')]][_0xbd0b('0x20')]){logger[_0xbd0b('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x22f741['uniqueid']);this[_0xbd0b('0x16')](_0x22f741[_0xbd0b('0x29')]);}else if(this['channels'][_0x22f741['linkedid']]&&this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x3f')]][_0xbd0b('0x20')]){logger[_0xbd0b('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x22f741[_0xbd0b('0x3f')]);this[_0xbd0b('0x16')](_0x22f741[_0xbd0b('0x3f')]);}}catch(_0x183029){logger['error'](_0xbd0b('0x43'),_0x183029[_0xbd0b('0x33')]);}};Acw['prototype'][_0xbd0b('0x44')]=function(_0x1ea443){try{if(!_[_0xbd0b('0x45')](this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x46')]])){this[_0xbd0b('0x16')](_0x1ea443[_0xbd0b('0x46')]);if(this[_0xbd0b('0x9')][_0x1ea443['secondtransfereruniqueid']]){this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x47')]][_0xbd0b('0x20')]=!![];this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x48')]]=this[_0xbd0b('0x9')][_0x1ea443['secondtransfereruniqueid']];delete this['channels'][_0x1ea443[_0xbd0b('0x47')]];}}else if(!_[_0xbd0b('0x45')](this['channels'][_0x1ea443[_0xbd0b('0x48')]])){this[_0xbd0b('0x16')](_0x1ea443[_0xbd0b('0x48')]);if(this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]]){this['channels'][_0x1ea443[_0xbd0b('0x49')]][_0xbd0b('0x20')]=!![];this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x46')]]=this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]];delete this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]];}}}catch(_0x429534){logger[_0xbd0b('0x2f')](_0xbd0b('0x4a'),_0x429534[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x11')]=function(_0x164a2e){try{if(this[_0xbd0b('0x9')][_0x164a2e[_0xbd0b('0x4b')]]){logger['info'](_0xbd0b('0x4c'),JSON[_0xbd0b('0x38')](_0x164a2e[_0xbd0b('0x4b')]));this[_0xbd0b('0x16')](_0x164a2e['transfereruniqueid']);}else if(this['channels'][_0x164a2e[_0xbd0b('0x4d')]]){logger[_0xbd0b('0x1e')](_0xbd0b('0x4e'),JSON[_0xbd0b('0x38')](_0x164a2e[_0xbd0b('0x4d')]));this['startAcw'](_0x164a2e[_0xbd0b('0x4d')]);}}catch(_0x4d3664){logger[_0xbd0b('0x2f')](_0xbd0b('0x4f'),_0x4d3664[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x50')]=function(_0x463db8){try{if(this['voiceQueues'][_0x463db8[_0xbd0b('0x17')]]&&this[_0xbd0b('0x6')][_0x463db8[_0xbd0b('0x17')]][_0xbd0b('0x51')]==='all'){if(this[_0xbd0b('0x7')][_0x463db8[_0xbd0b('0x3a')]]){logger[_0xbd0b('0x1e')](_0xbd0b('0x52'),_0x463db8[_0xbd0b('0x29')],_0x463db8['interface'],_0x463db8['queue']);return RpcUser[_0xbd0b('0x22')](this['agents'][_0x463db8[_0xbd0b('0x3a')]],_0xbd0b('0x53'),_0x463db8[_0xbd0b('0x29')]);}}}catch(_0x1876ae){logger[_0xbd0b('0x2f')](_0xbd0b('0x54'),_0x1876ae['message']);}};module[_0xbd0b('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 195eaba..29d0efb 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 _0xaaa7=['then','actionSipShowRegistry','actionSipPeerStatus','catch','log','exports','asterisk-manager','bluebird','moment','util','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','inspect','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','info','fullybooted','resolve'];(function(_0x5d54f1,_0x213f3e){var _0x3273e8=function(_0x1cf975){while(--_0x1cf975){_0x5d54f1['push'](_0x5d54f1['shift']());}};_0x3273e8(++_0x213f3e);}(_0xaaa7,0x1c2));var _0x7aaa=function(_0x20fa8a,_0x262756){_0x20fa8a=_0x20fa8a-0x0;var _0x5d2c93=_0xaaa7[_0x20fa8a];return _0x5d2c93;};'use strict';var Manager=require(_0x7aaa('0x0'));var BPromise=require(_0x7aaa('0x1'));var moment=require(_0x7aaa('0x2'));var util=require(_0x7aaa('0x3'));var _=require('lodash');var logger=require(_0x7aaa('0x4'))('ami');var config=require(_0x7aaa('0x5'));var ami=new Manager(config[_0x7aaa('0x6')][_0x7aaa('0x7')],config[_0x7aaa('0x6')]['ip'],config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')][_0x7aaa('0x9')],!![]);ami[_0x7aaa('0xa')]();ami[_0x7aaa('0xb')]=BPromise[_0x7aaa('0xc')](ami[_0x7aaa('0xd')]);function error(_0x22f6f3){logger[_0x7aaa('0xe')](util[_0x7aaa('0xf')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x7aaa('0x6')][_0x7aaa('0x8')],config['asterisk']['ip'],config[_0x7aaa('0x6')]['port'],util[_0x7aaa('0x10')](_0x22f6f3,![],null)));}function close(){logger[_0x7aaa('0xe')](util[_0x7aaa('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')]['ip'],config[_0x7aaa('0x6')][_0x7aaa('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x7aaa('0x11')]=function(){return function(){return ami[_0x7aaa('0xb')]({'action':_0x7aaa('0x12')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x7aaa('0x13')});};};ami[_0x7aaa('0x14')]=function(){return function(){return ami[_0x7aaa('0xb')]({'action':'queuesummary'});};};ami[_0x7aaa('0x15')]=function(){return function(){return ami[_0x7aaa('0xb')]({'action':_0x7aaa('0x16')});};};function connect(_0x25b3c8){logger['info'](util[_0x7aaa('0xf')](_0x7aaa('0x17'),config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')]['ip'],config[_0x7aaa('0x6')][_0x7aaa('0x7')]));ami[_0x7aaa('0x18')]('error',error);ami['once'](_0x7aaa('0x19'),close);}ami['on'](_0x7aaa('0x1a'),connect);ami['on'](_0x7aaa('0x1b'),function(_0x24069f){logger[_0x7aaa('0x1c')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')]['ip'],config[_0x7aaa('0x6')][_0x7aaa('0x7')],util[_0x7aaa('0x10')](_0x24069f,![],null)));});ami['on'](_0x7aaa('0x1d'),function(_0x135584){logger[_0x7aaa('0x1c')](util[_0x7aaa('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')]['ip'],config['asterisk']['port']));return BPromise[_0x7aaa('0x1e')]()[_0x7aaa('0x1f')](ami[_0x7aaa('0x20')]())['then'](ami[_0x7aaa('0x11')]())[_0x7aaa('0x1f')](ami[_0x7aaa('0x21')]())['then'](ami['actionQueueSummary']())[_0x7aaa('0x1f')](ami[_0x7aaa('0x15')]())[_0x7aaa('0x22')](function(_0x3647c4){console[_0x7aaa('0x23')](_0x3647c4);});});ami[_0x7aaa('0x18')]('error',error);ami[_0x7aaa('0x18')](_0x7aaa('0x19'),close);module[_0x7aaa('0x24')]=ami; \ No newline at end of file +var _0x544e=['username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','exports','bluebird','moment','lodash','ami','../../config/environment','asterisk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x544e,0xef));var _0xe544=function(_0x401af1,_0x1bc315){_0x401af1=_0x401af1-0x0;var _0x2ed7cb=_0x544e[_0x401af1];return _0x2ed7cb;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xe544('0x0'));var moment=require(_0xe544('0x1'));var util=require('util');var _=require(_0xe544('0x2'));var logger=require('../../config/logger')(_0xe544('0x3'));var config=require(_0xe544('0x4'));var ami=new Manager(config[_0xe544('0x5')]['port'],config[_0xe544('0x5')]['ip'],config[_0xe544('0x5')][_0xe544('0x6')],config[_0xe544('0x5')][_0xe544('0x7')],!![]);ami[_0xe544('0x8')]();ami[_0xe544('0x9')]=BPromise[_0xe544('0xa')](ami[_0xe544('0xb')]);function error(_0x328bdf){logger[_0xe544('0xc')](util[_0xe544('0xd')](_0xe544('0xe'),config[_0xe544('0x5')][_0xe544('0x6')],config['asterisk']['ip'],config[_0xe544('0x5')][_0xe544('0xf')],util[_0xe544('0x10')](_0x328bdf,![],null)));}function close(){logger[_0xe544('0xc')](util[_0xe544('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xe544('0x6')],config[_0xe544('0x5')]['ip'],config['asterisk'][_0xe544('0xf')]));}ami[_0xe544('0x11')]=function(){return function(){return ami[_0xe544('0x9')]({'action':_0xe544('0x12')});};};ami[_0xe544('0x13')]=function(){return function(){return ami[_0xe544('0x9')]({'action':_0xe544('0x14')});};};ami[_0xe544('0x15')]=function(){return function(){return ami[_0xe544('0x9')]({'action':_0xe544('0x16')});};};ami[_0xe544('0x17')]=function(){return function(){return ami[_0xe544('0x9')]({'action':'queuesummary'});};};ami[_0xe544('0x18')]=function(){return function(){return ami[_0xe544('0x9')]({'action':_0xe544('0x19')});};};function connect(_0x2106db){logger[_0xe544('0x1a')](util[_0xe544('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xe544('0x5')][_0xe544('0x6')],config['asterisk']['ip'],config[_0xe544('0x5')][_0xe544('0xf')]));ami['once'](_0xe544('0xc'),error);ami[_0xe544('0x1b')](_0xe544('0x1c'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x54ab2e){logger[_0xe544('0x1a')](util[_0xe544('0xd')](_0xe544('0x1d'),config[_0xe544('0x5')][_0xe544('0x6')],config[_0xe544('0x5')]['ip'],config[_0xe544('0x5')][_0xe544('0xf')],util[_0xe544('0x10')](_0x54ab2e,![],null)));});ami['on']('fullybooted',function(_0x4fd794){logger[_0xe544('0x1a')](util[_0xe544('0xd')](_0xe544('0x1e'),config[_0xe544('0x5')][_0xe544('0x6')],config['asterisk']['ip'],config[_0xe544('0x5')][_0xe544('0xf')]));return BPromise[_0xe544('0x1f')]()['then'](ami[_0xe544('0x11')]())['then'](ami['actionDeviceStateList']())['then'](ami[_0xe544('0x15')]())[_0xe544('0x20')](ami[_0xe544('0x17')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x3d470e){console[_0xe544('0x21')](_0x3d470e);});});ami[_0xe544('0x1b')]('error',error);ami[_0xe544('0x1b')](_0xe544('0x1c'),close);module[_0xe544('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 488f28b..3be65bc 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 _0xa250=['then','debug','rpc','memberReport','error','message','result','jayson/promise','bluebird','../../config/logger','ami','client','http','Request'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa250,0x1b9));var _0x0a25=function(_0x3a90b6,_0x782086){_0x3a90b6=_0x3a90b6-0x0;var _0x56f71a=_0xa250[_0x3a90b6];return _0x56f71a;};'use strict';var jayson=require(_0x0a25('0x0'));var BPromise=require(_0x0a25('0x1'));var logger=require(_0x0a25('0x2'))(_0x0a25('0x3'));var client=jayson[_0x0a25('0x4')][_0x0a25('0x5')]({'port':0x2329});client[_0x0a25('0x6')]=function(_0x59c29a,_0x2b7633){return new BPromise(function(_0x505766,_0x50ee06){return client['request'](_0x59c29a,_0x2b7633)[_0x0a25('0x7')](function(_0x4d0feb){logger[_0x0a25('0x8')](_0x0a25('0x9'),_0x0a25('0xa'),_0x59c29a,_0x2b7633,_0x4d0feb);if(_0x4d0feb['error']){logger[_0x0a25('0xb')](_0x0a25('0x9'),_0x0a25('0xa'),_0x59c29a,_0x4d0feb[_0x0a25('0xb')][_0x0a25('0xc')],_0x2b7633);return _0x50ee06(_0x4d0feb['error']['message']);}else{return _0x505766(_0x4d0feb[_0x0a25('0xd')]);}})['catch'](function(_0x3e8684){logger[_0x0a25('0xb')](_0x0a25('0x9'),_0x0a25('0xa'),_0x59c29a,_0x3e8684,_0x2b7633);return _0x50ee06(_0x3e8684);});});};module['exports']=client; \ No newline at end of file +var _0xe10d=['../../config/logger','ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','catch','exports'];(function(_0x5191ab,_0x57d57){var _0x593659=function(_0x3976cb){while(--_0x3976cb){_0x5191ab['push'](_0x5191ab['shift']());}};_0x593659(++_0x57d57);}(_0xe10d,0x118));var _0xde10=function(_0x28e9ce,_0x353d40){_0x28e9ce=_0x28e9ce-0x0;var _0x118e71=_0xe10d[_0x28e9ce];return _0x118e71;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xde10('0x0'))(_0xde10('0x1'));var client=jayson[_0xde10('0x2')][_0xde10('0x3')]({'port':0x2329});client[_0xde10('0x4')]=function(_0x1d2c8b,_0x4a10af){return new BPromise(function(_0x52e8d3,_0x514bf6){return client['request'](_0x1d2c8b,_0x4a10af)[_0xde10('0x5')](function(_0xa38225){logger[_0xde10('0x6')](_0xde10('0x7'),_0xde10('0x8'),_0x1d2c8b,_0x4a10af,_0xa38225);if(_0xa38225['error']){logger['error']('rpc',_0xde10('0x8'),_0x1d2c8b,_0xa38225[_0xde10('0x9')]['message'],_0x4a10af);return _0x514bf6(_0xa38225[_0xde10('0x9')][_0xde10('0xa')]);}else{return _0x52e8d3(_0xa38225[_0xde10('0xb')]);}})[_0xde10('0xc')](function(_0x17de6b){logger[_0xde10('0x9')](_0xde10('0x7'),_0xde10('0x8'),_0x1d2c8b,_0x17de6b,_0x4a10af);return _0x514bf6(_0x17de6b);});});};module[_0xde10('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index c02c8c8..c6e933c 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 _0x9354=['VoiceQueueId','CampaignId','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','lastName','number','phone','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x2ffb08,_0x5eeb5c){var _0x3f51d6=function(_0x1bcbbc){while(--_0x1bcbbc){_0x2ffb08['push'](_0x2ffb08['shift']());}};_0x3f51d6(++_0x5eeb5c);}(_0x9354,0x96));var _0x4935=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x9354[_0x30e004];return _0x5ca247;};'use strict';var util=require('util');var _=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));function checkNameSurname(_0x4896da,_0x263dd5,_0x2a4993){var _0x29d1eb='';if(!_[_0x4935('0x2')](_0x263dd5)&&'string'===typeof _0x263dd5){_0x29d1eb+=_0x263dd5;}if(!_[_0x4935('0x2')](_0x2a4993)&&_0x4935('0x3')===typeof _0x2a4993){_0x29d1eb+='\x20'+_0x2a4993;}if(_0x29d1eb!==''){return _0x29d1eb;}return _0x4896da;}function Action(_0x127226,_0x2d518a,_0x263864){this[_0x4935('0x4')]=_0x127226;this[_0x4935('0x5')]=_0x263864||undefined;this[_0x4935('0x6')]=checkNameSurname(_0x2d518a[_0x4935('0x7')]['phone'],_0x2d518a[_0x4935('0x7')]['firstName'],_0x2d518a[_0x4935('0x7')][_0x4935('0x8')]);this[_0x4935('0x9')]=_0x2d518a[_0x4935('0x7')][_0x4935('0xa')];this[_0x4935('0xb')]=_0x127226['name'];this['active']=_0x2d518a[_0x4935('0xc')]||![];this['type']=_0x127226['type'];this[_0x4935('0xd')]=_0x127226[_0x4935('0xd')]||0x3;this[_0x4935('0xe')]=_0x2d518a[_0x4935('0xe')];this[_0x4935('0xf')]=_0x2d518a[_0x4935('0xf')];this[_0x4935('0x10')]=_0x2d518a[_0x4935('0x10')];this[_0x4935('0x11')]=_0x2d518a[_0x4935('0x11')];this[_0x4935('0x12')]=_0x2d518a[_0x4935('0x12')];this[_0x4935('0x13')]=_0x2d518a[_0x4935('0x13')];this[_0x4935('0x14')]=_0x2d518a[_0x4935('0x14')];this['countmachineretry']=_0x2d518a[_0x4935('0x15')];this[_0x4935('0x16')]=_0x2d518a[_0x4935('0x16')];this[_0x4935('0x17')]=_0x2d518a[_0x4935('0x17')];this[_0x4935('0x18')]=_0x2d518a['ListId'];this[_0x4935('0x19')]=_0x2d518a[_0x4935('0x19')];this['VoiceQueueId']=_0x2d518a[_0x4935('0x1a')];this[_0x4935('0x1b')]=_0x2d518a[_0x4935('0x1b')];this['idHopper']=_0x2d518a['id'];this['ContactFirstName']=_0x2d518a[_0x4935('0x7')][_0x4935('0x1c')]||'';this[_0x4935('0x1d')]=moment()[_0x4935('0x1e')](_0x4935('0x1f'));this[_0x4935('0x20')]=_0x2d518a[_0x4935('0x20')];this[_0x4935('0x21')]=_0x2d518a['callbackuniqueid'];this[_0x4935('0x22')]=_0x2d518a[_0x4935('0x22')];this[_0x4935('0x23')]=_0x2d518a[_0x4935('0x23')];this[_0x4935('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0x4935('0x25')]=function(){return util[_0x4935('0x1e')](_0x4935('0x26'),this[_0x4935('0x6')],this[_0x4935('0x4')][_0x4935('0x27')]>0x0?this[_0x4935('0x9')][_0x4935('0x28')](this[_0x4935('0x4')][_0x4935('0x27')]):this[_0x4935('0x9')]);};Action[_0x4935('0x29')][_0x4935('0x2a')]=function(){return this[_0x4935('0xb')];};module[_0x4935('0x2b')]=Action; \ No newline at end of file +var _0x3cfb=['CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','firstName','lastName','number','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1e0e8e,_0x30b41c){var _0x5dfbd3=function(_0x42805f){while(--_0x42805f){_0x1e0e8e['push'](_0x1e0e8e['shift']());}};_0x5dfbd3(++_0x30b41c);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x2b2f5c,_0x4df326){_0x2b2f5c=_0x2b2f5c-0x0;var _0x287d11=_0x3cfb[_0x2b2f5c];return _0x287d11;};'use strict';var util=require(_0xb3cf('0x0'));var _=require(_0xb3cf('0x1'));var moment=require(_0xb3cf('0x2'));function checkNameSurname(_0x3d8fa3,_0xa3584d,_0x147066){var _0x3112c1='';if(!_[_0xb3cf('0x3')](_0xa3584d)&&'string'===typeof _0xa3584d){_0x3112c1+=_0xa3584d;}if(!_[_0xb3cf('0x3')](_0x147066)&&_0xb3cf('0x4')===typeof _0x147066){_0x3112c1+='\x20'+_0x147066;}if(_0x3112c1!==''){return _0x3112c1;}return _0x3d8fa3;}function Action(_0x19e5e5,_0x59c604,_0x2e5c00){this[_0xb3cf('0x5')]=_0x19e5e5;this[_0xb3cf('0x6')]=_0x2e5c00||undefined;this['name']=checkNameSurname(_0x59c604[_0xb3cf('0x7')]['phone'],_0x59c604['Contact'][_0xb3cf('0x8')],_0x59c604[_0xb3cf('0x7')][_0xb3cf('0x9')]);this[_0xb3cf('0xa')]=_0x59c604[_0xb3cf('0x7')][_0xb3cf('0xb')];this[_0xb3cf('0xc')]=_0x19e5e5[_0xb3cf('0xd')];this[_0xb3cf('0xe')]=_0x59c604[_0xb3cf('0xe')]||![];this[_0xb3cf('0xf')]=_0x19e5e5[_0xb3cf('0xf')];this[_0xb3cf('0x10')]=_0x19e5e5[_0xb3cf('0x10')]||0x3;this[_0xb3cf('0x11')]=_0x59c604['scheduledat'];this['countbusyretry']=_0x59c604[_0xb3cf('0x12')];this[_0xb3cf('0x13')]=_0x59c604['countcongestionretry'];this[_0xb3cf('0x14')]=_0x59c604['countnoanswerretry'];this['countnosuchnumberretry']=_0x59c604[_0xb3cf('0x15')];this[_0xb3cf('0x16')]=_0x59c604[_0xb3cf('0x16')];this['countabandonedretry']=_0x59c604[_0xb3cf('0x17')];this[_0xb3cf('0x18')]=_0x59c604[_0xb3cf('0x18')];this[_0xb3cf('0x19')]=_0x59c604[_0xb3cf('0x19')];this[_0xb3cf('0x1a')]=_0x59c604[_0xb3cf('0x1a')];this[_0xb3cf('0x1b')]=_0x59c604[_0xb3cf('0x1b')];this[_0xb3cf('0x1c')]=_0x59c604['UserId'];this[_0xb3cf('0x1d')]=_0x59c604[_0xb3cf('0x1d')];this[_0xb3cf('0x1e')]=_0x59c604[_0xb3cf('0x1e')];this['idHopper']=_0x59c604['id'];this[_0xb3cf('0x1f')]=_0x59c604[_0xb3cf('0x7')][_0xb3cf('0x8')]||'';this[_0xb3cf('0x20')]=moment()[_0xb3cf('0x21')](_0xb3cf('0x22'));this[_0xb3cf('0x23')]=_0x59c604[_0xb3cf('0x23')];this[_0xb3cf('0x24')]=_0x59c604[_0xb3cf('0x24')];this['callbackat']=_0x59c604[_0xb3cf('0x25')];this[_0xb3cf('0x26')]=_0x59c604[_0xb3cf('0x26')];this[_0xb3cf('0x27')]='';this[_0xb3cf('0x28')]='';}Action[_0xb3cf('0x29')][_0xb3cf('0x2a')]=function(){return util[_0xb3cf('0x21')](_0xb3cf('0x2b'),this[_0xb3cf('0xd')],this['voiceQueue'][_0xb3cf('0x2c')]>0x0?this[_0xb3cf('0xa')][_0xb3cf('0x2d')](this['voiceQueue']['dialCutDigit']):this[_0xb3cf('0xa')]);};Action[_0xb3cf('0x29')]['getQueue']=function(){return this['queue'];};module[_0xb3cf('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 99d703f..3c1d770 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 _0x9ec0=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','name','calleridnum','number','starttime','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x14301d,_0x70dde9){var _0x1638dc=function(_0x22bf3c){while(--_0x22bf3c){_0x14301d['push'](_0x14301d['shift']());}};_0x1638dc(++_0x70dde9);}(_0x9ec0,0x73));var _0x09ec=function(_0x45cb89,_0x99520e){_0x45cb89=_0x45cb89-0x0;var _0x5948c1=_0x9ec0[_0x45cb89];return _0x5948c1;};'use strict';var util=require(_0x09ec('0x0'));var _=require(_0x09ec('0x1'));var moment=require(_0x09ec('0x2'));function getSeconds(_0x51e531,_0x2e35c7){var _0x18dded=moment(_0x51e531)[_0x09ec('0x3')](0x0);var _0x4965cf=moment(_0x2e35c7)[_0x09ec('0x3')](0x0);return _0x18dded['diff'](_0x4965cf,_0x09ec('0x4'));}function AdditionalPhone(_0x16875c){this['uniqueid']=_0x16875c[_0x09ec('0x5')];this[_0x09ec('0x6')]=_0x16875c['scheduledat']||undefined;this[_0x09ec('0x7')]=_0x16875c['type'];this[_0x09ec('0x8')]=_0x16875c[_0x09ec('0x7')]===_0x09ec('0x9')?_0x09ec('0xa'):_0x16875c[_0x09ec('0x7')];this[_0x09ec('0xb')]=_0x16875c[_0x09ec('0xb')];this[_0x09ec('0xc')]=_0x16875c['countcongestionretry'];this['countnoanswerretry']=_0x16875c[_0x09ec('0xd')];this['countglobal']=_0x16875c[_0x09ec('0xb')]+_0x16875c['countcongestionretry']+_0x16875c[_0x09ec('0xd')]+_0x16875c[_0x09ec('0xe')]+_0x16875c[_0x09ec('0xf')]+_0x16875c['countabandonedretry']+_0x16875c['countmachineretry']+_0x16875c[_0x09ec('0x10')];this['countnosuchnumberretry']=_0x16875c[_0x09ec('0xe')];this['countdropretry']=_0x16875c[_0x09ec('0xf')];this['countabandonedretry']=_0x16875c[_0x09ec('0x11')];this[_0x09ec('0x12')]=_0x16875c[_0x09ec('0x12')];this[_0x09ec('0x10')]=_0x16875c[_0x09ec('0x10')];this[_0x09ec('0xa')]=_0x16875c[_0x09ec('0xa')];this['calleridname']=_0x16875c[_0x09ec('0x13')];this[_0x09ec('0x14')]=_0x16875c[_0x09ec('0x15')];this[_0x09ec('0x16')]=_0x16875c[_0x09ec('0x16')];this['responsetime']=_0x16875c[_0x09ec('0x17')];this['endtime']=_0x16875c[_0x09ec('0x17')];this['ringtime']=getSeconds(_0x16875c[_0x09ec('0x17')],_0x16875c[_0x09ec('0x16')]);this['holdtime']=0x0;this[_0x09ec('0x18')]=0x0;this[_0x09ec('0x19')]=_0x16875c[_0x09ec('0x19')];this[_0x09ec('0x1a')]=_0x16875c[_0x09ec('0x1a')];this[_0x09ec('0x1b')]=_0x16875c[_0x09ec('0x1b')];this[_0x09ec('0x1c')]=_0x16875c[_0x09ec('0x1c')];this[_0x09ec('0x1d')]=_0x16875c[_0x09ec('0x1d')];this[_0x09ec('0x1e')]=_0x16875c[_0x09ec('0x1e')];this[_0x09ec('0x1f')]=_0x16875c[_0x09ec('0x1f')];this[_0x09ec('0x20')]=_0x16875c['VoiceQueueId'];this[_0x09ec('0x21')]=_0x16875c[_0x09ec('0x21')];this[_0x09ec('0x22')]=_0x16875c['originatecalleridnum']||'';this[_0x09ec('0x23')]=_0x16875c[_0x09ec('0x23')]||'';}module[_0x09ec('0x24')]=History; \ No newline at end of file +var _0x6b12=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x5dcbf8,_0x4bbe65){var _0x4fa1ad=function(_0x103ac8){while(--_0x103ac8){_0x5dcbf8['push'](_0x5dcbf8['shift']());}};_0x4fa1ad(++_0x4bbe65);}(_0x6b12,0xbf));var _0x26b1=function(_0x292c5c,_0x360a2a){_0x292c5c=_0x292c5c-0x0;var _0x49b1c5=_0x6b12[_0x292c5c];return _0x49b1c5;};'use strict';var util=require(_0x26b1('0x0'));var _=require(_0x26b1('0x1'));var moment=require(_0x26b1('0x2'));function getSeconds(_0x5979de,_0x1c76ad){var _0x3f2b0f=moment(_0x5979de)[_0x26b1('0x3')](0x0);var _0x513f25=moment(_0x1c76ad)[_0x26b1('0x3')](0x0);return _0x3f2b0f['diff'](_0x513f25,_0x26b1('0x4'));}function AdditionalPhone(_0x14176b){this[_0x26b1('0x5')]=_0x14176b[_0x26b1('0x5')];this[_0x26b1('0x6')]=_0x14176b[_0x26b1('0x6')]||undefined;this[_0x26b1('0x7')]=_0x14176b[_0x26b1('0x7')];this[_0x26b1('0x8')]=_0x14176b[_0x26b1('0x7')]===_0x26b1('0x9')?'queue':_0x14176b[_0x26b1('0x7')];this[_0x26b1('0xa')]=_0x14176b['countbusyretry'];this[_0x26b1('0xb')]=_0x14176b[_0x26b1('0xb')];this[_0x26b1('0xc')]=_0x14176b[_0x26b1('0xc')];this['countglobal']=_0x14176b['countbusyretry']+_0x14176b[_0x26b1('0xb')]+_0x14176b[_0x26b1('0xc')]+_0x14176b[_0x26b1('0xd')]+_0x14176b['countdropretry']+_0x14176b[_0x26b1('0xe')]+_0x14176b[_0x26b1('0xf')]+_0x14176b[_0x26b1('0x10')];this[_0x26b1('0xd')]=_0x14176b[_0x26b1('0xd')];this[_0x26b1('0x11')]=_0x14176b[_0x26b1('0x11')];this['countabandonedretry']=_0x14176b[_0x26b1('0xe')];this['countmachineretry']=_0x14176b[_0x26b1('0xf')];this[_0x26b1('0x10')]=_0x14176b[_0x26b1('0x10')];this[_0x26b1('0x12')]=_0x14176b['queue'];this['calleridname']=_0x14176b['name'];this['calleridnum']=_0x14176b[_0x26b1('0x13')];this[_0x26b1('0x14')]=_0x14176b[_0x26b1('0x14')];this['responsetime']=_0x14176b[_0x26b1('0x15')];this[_0x26b1('0x16')]=_0x14176b[_0x26b1('0x15')];this['ringtime']=getSeconds(_0x14176b[_0x26b1('0x15')],_0x14176b['starttime']);this[_0x26b1('0x17')]=0x0;this[_0x26b1('0x18')]=0x0;this[_0x26b1('0x19')]=_0x14176b[_0x26b1('0x19')];this[_0x26b1('0x1a')]=_0x14176b[_0x26b1('0x1a')];this[_0x26b1('0x1b')]=_0x14176b[_0x26b1('0x1b')];this[_0x26b1('0x1c')]=_0x14176b[_0x26b1('0x1c')];this[_0x26b1('0x1d')]=_0x14176b[_0x26b1('0x1d')];this[_0x26b1('0x1e')]=_0x14176b['ListId'];this[_0x26b1('0x1f')]=_0x14176b[_0x26b1('0x1f')];this[_0x26b1('0x20')]=_0x14176b[_0x26b1('0x20')];this['CampaignId']=_0x14176b[_0x26b1('0x21')];this[_0x26b1('0x22')]=_0x14176b[_0x26b1('0x22')]||'';this['originatecalleridname']=_0x14176b[_0x26b1('0x23')]||'';}module[_0x26b1('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 743affb..948cb21 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 _0xa1c3=['holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','ringtime'];(function(_0x2865ce,_0x29e4e2){var _0x149a6a=function(_0x5826b6){while(--_0x5826b6){_0x2865ce['push'](_0x2865ce['shift']());}};_0x149a6a(++_0x29e4e2);}(_0xa1c3,0x1ad));var _0x3a1c=function(_0x59ec65,_0x33e455){_0x59ec65=_0x59ec65-0x0;var _0x2f560c=_0xa1c3[_0x59ec65];return _0x2f560c;};'use strict';var util=require('util');var _=require(_0x3a1c('0x0'));var moment=require(_0x3a1c('0x1'));function getSeconds(_0x4646a9,_0x5ab896){var _0x2ccc12=moment(_0x4646a9)['milliseconds'](0x0);var _0x4a7f0b=moment(_0x5ab896)[_0x3a1c('0x2')](0x0);return _0x2ccc12['diff'](_0x4a7f0b,_0x3a1c('0x3'));}function AgentComplete(_0x12d575,_0x1c2278){this[_0x3a1c('0x4')]=0x4;this[_0x3a1c('0x5')]=_0x3a1c('0x6');this[_0x3a1c('0x7')]=_0x12d575[_0x3a1c('0x7')];this[_0x3a1c('0x8')]=_0x12d575[_0x3a1c('0x8')];this[_0x3a1c('0x9')]=_0x12d575[_0x3a1c('0x8')]===_0x3a1c('0xa')?_0x3a1c('0xb'):_0x12d575[_0x3a1c('0x8')];this['countbusyretry']=_0x12d575[_0x3a1c('0xc')];this[_0x3a1c('0xd')]=_0x12d575[_0x3a1c('0xd')];this['countnoanswerretry']=_0x12d575[_0x3a1c('0xe')];this[_0x3a1c('0xf')]=_0x12d575[_0x3a1c('0xc')]+_0x12d575[_0x3a1c('0xd')]+_0x12d575[_0x3a1c('0xe')]+_0x12d575[_0x3a1c('0x10')]+_0x12d575[_0x3a1c('0x11')]+_0x12d575[_0x3a1c('0x12')]+_0x12d575[_0x3a1c('0x13')]+_0x12d575[_0x3a1c('0x14')];this['countnosuchnumberretry']=_0x12d575[_0x3a1c('0x10')];this[_0x3a1c('0x11')]=_0x12d575['countdropretry'];this['countabandonedretry']=_0x12d575[_0x3a1c('0x12')];this[_0x3a1c('0x13')]=_0x12d575[_0x3a1c('0x13')];this[_0x3a1c('0x14')]=_0x12d575[_0x3a1c('0x14')];this[_0x3a1c('0x15')]=_0x1c2278['uniqueid'];this[_0x3a1c('0x16')]=_0x12d575[_0x3a1c('0x17')];this[_0x3a1c('0x18')]=_0x12d575[_0x3a1c('0x19')];this[_0x3a1c('0x1a')]=_0x12d575[_0x3a1c('0x1a')];this[_0x3a1c('0x1b')]=_0x12d575[_0x3a1c('0x1b')];this[_0x3a1c('0x1c')]=_0x12d575[_0x3a1c('0x1c')];this[_0x3a1c('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3a1c('0x1e')]=getSeconds(_0x12d575[_0x3a1c('0x1b')],_0x12d575[_0x3a1c('0x1a')]);this[_0x3a1c('0x1f')]=getSeconds(_0x12d575[_0x3a1c('0x1c')],_0x12d575[_0x3a1c('0x1b')]);this[_0x3a1c('0x20')]=getSeconds(this[_0x3a1c('0x1d')],_0x12d575[_0x3a1c('0x1c')]);this[_0x3a1c('0xb')]=_0x1c2278[_0x3a1c('0xb')];this[_0x3a1c('0x21')]=_0x1c2278['membername'];this[_0x3a1c('0x22')]=_0x1c2278[_0x3a1c('0x22')];this[_0x3a1c('0x23')]=_0x12d575[_0x3a1c('0x23')];this[_0x3a1c('0x24')]=_0x12d575[_0x3a1c('0x24')];this['callbackat']=_0x12d575[_0x3a1c('0x25')];this[_0x3a1c('0x26')]=_0x12d575[_0x3a1c('0x26')];this[_0x3a1c('0x27')]=_0x12d575[_0x3a1c('0x27')];this[_0x3a1c('0x28')]=_0x12d575[_0x3a1c('0x28')];this[_0x3a1c('0x29')]=_0x12d575['UserId'];this['VoiceQueueId']=_0x12d575['VoiceQueueId'];this[_0x3a1c('0x2a')]=_0x12d575[_0x3a1c('0x2a')];this[_0x3a1c('0x2b')]=_0x12d575['originatecalleridnum']||'';this[_0x3a1c('0x2c')]=_0x12d575['originatecalleridname']||'';}module[_0x3a1c('0x2d')]=AgentComplete; \ No newline at end of file +var _0xe176=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','state','Answer','scheduledat','type'];(function(_0x3c59c5,_0x527f24){var _0x271aad=function(_0x44b9c6){while(--_0x44b9c6){_0x3c59c5['push'](_0x3c59c5['shift']());}};_0x271aad(++_0x527f24);}(_0xe176,0x1dc));var _0x6e17=function(_0x3bce39,_0x3edeff){_0x3bce39=_0x3bce39-0x0;var _0x424c8f=_0xe176[_0x3bce39];return _0x424c8f;};'use strict';var util=require('util');var _=require(_0x6e17('0x0'));var moment=require(_0x6e17('0x1'));function getSeconds(_0x2da40b,_0xbbf0b5){var _0x51f7a8=moment(_0x2da40b)[_0x6e17('0x2')](0x0);var _0x5d2fa3=moment(_0xbbf0b5)['milliseconds'](0x0);return _0x51f7a8['diff'](_0x5d2fa3,_0x6e17('0x3'));}function AgentComplete(_0x33cdf6,_0x1762a5){this[_0x6e17('0x4')]=0x4;this['statedesc']=_0x6e17('0x5');this[_0x6e17('0x6')]=_0x33cdf6[_0x6e17('0x6')];this[_0x6e17('0x7')]=_0x33cdf6[_0x6e17('0x7')];this[_0x6e17('0x8')]=_0x33cdf6[_0x6e17('0x7')]===_0x6e17('0x9')?_0x6e17('0xa'):_0x33cdf6['type'];this['countbusyretry']=_0x33cdf6[_0x6e17('0xb')];this['countcongestionretry']=_0x33cdf6[_0x6e17('0xc')];this[_0x6e17('0xd')]=_0x33cdf6[_0x6e17('0xd')];this[_0x6e17('0xe')]=_0x33cdf6[_0x6e17('0xb')]+_0x33cdf6[_0x6e17('0xc')]+_0x33cdf6['countnoanswerretry']+_0x33cdf6[_0x6e17('0xf')]+_0x33cdf6[_0x6e17('0x10')]+_0x33cdf6[_0x6e17('0x11')]+_0x33cdf6[_0x6e17('0x12')]+_0x33cdf6[_0x6e17('0x13')];this[_0x6e17('0xf')]=_0x33cdf6[_0x6e17('0xf')];this[_0x6e17('0x10')]=_0x33cdf6[_0x6e17('0x10')];this[_0x6e17('0x11')]=_0x33cdf6[_0x6e17('0x11')];this[_0x6e17('0x12')]=_0x33cdf6[_0x6e17('0x12')];this['countagentrejectretry']=_0x33cdf6[_0x6e17('0x13')];this['uniqueid']=_0x1762a5[_0x6e17('0x14')];this[_0x6e17('0x15')]=_0x33cdf6[_0x6e17('0x16')];this[_0x6e17('0x17')]=_0x33cdf6['number'];this[_0x6e17('0x18')]=_0x33cdf6[_0x6e17('0x18')];this['responsetime']=_0x33cdf6[_0x6e17('0x19')];this[_0x6e17('0x1a')]=_0x33cdf6[_0x6e17('0x1a')];this[_0x6e17('0x1b')]=moment()['format'](_0x6e17('0x1c'));this[_0x6e17('0x1d')]=getSeconds(_0x33cdf6[_0x6e17('0x19')],_0x33cdf6[_0x6e17('0x18')]);this[_0x6e17('0x1e')]=getSeconds(_0x33cdf6['answertime'],_0x33cdf6[_0x6e17('0x19')]);this[_0x6e17('0x1f')]=getSeconds(this['endtime'],_0x33cdf6[_0x6e17('0x1a')]);this[_0x6e17('0xa')]=_0x1762a5['queue'];this[_0x6e17('0x20')]=_0x1762a5['membername'];this[_0x6e17('0x21')]=_0x1762a5[_0x6e17('0x21')];this[_0x6e17('0x22')]=_0x33cdf6['callback'];this['callbackuniqueid']=_0x33cdf6['callbackuniqueid'];this[_0x6e17('0x23')]=_0x33cdf6[_0x6e17('0x23')];this[_0x6e17('0x24')]=_0x33cdf6[_0x6e17('0x24')];this[_0x6e17('0x25')]=_0x33cdf6[_0x6e17('0x25')];this['ListId']=_0x33cdf6[_0x6e17('0x26')];this['UserId']=_0x33cdf6['UserId'];this[_0x6e17('0x27')]=_0x33cdf6[_0x6e17('0x27')];this[_0x6e17('0x28')]=_0x33cdf6['CampaignId'];this['originatecalleridnum']=_0x33cdf6[_0x6e17('0x29')]||'';this[_0x6e17('0x2a')]=_0x33cdf6[_0x6e17('0x2a')]||'';}module[_0x6e17('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index d59900a..4e0693a 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 _0x1c4e=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridnum'];(function(_0x322f23,_0x357d82){var _0x426660=function(_0x53de8c){while(--_0x53de8c){_0x322f23['push'](_0x322f23['shift']());}};_0x426660(++_0x357d82);}(_0x1c4e,0x1b4));var _0xe1c4=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x1c4e[_0xabfec4];return _0x7bafa2;};'use strict';var util=require('util');var _=require(_0xe1c4('0x0'));var moment=require(_0xe1c4('0x1'));function getSeconds(_0x1096cd,_0x4b913e){var _0x46e568=moment(_0x1096cd)[_0xe1c4('0x2')](0x0);var _0x194615=moment(_0x4b913e)[_0xe1c4('0x2')](0x0);return _0x46e568[_0xe1c4('0x3')](_0x194615,_0xe1c4('0x4'));}function Final(_0x5437f1){this[_0xe1c4('0x5')]=_0x5437f1[_0xe1c4('0x5')];this['scheduledat']=_0x5437f1[_0xe1c4('0x6')];this[_0xe1c4('0x7')]=_0x5437f1[_0xe1c4('0x7')];this['campaigntype']=_0x5437f1[_0xe1c4('0x7')]===_0xe1c4('0x8')?'queue':_0x5437f1[_0xe1c4('0x7')];this[_0xe1c4('0x9')]=_0x5437f1[_0xe1c4('0x9')];this[_0xe1c4('0xa')]=_0x5437f1[_0xe1c4('0xa')];this[_0xe1c4('0xb')]=_0x5437f1[_0xe1c4('0xb')];this[_0xe1c4('0xc')]=_0x5437f1['countbusyretry']+_0x5437f1[_0xe1c4('0xa')]+_0x5437f1[_0xe1c4('0xb')]+_0x5437f1['countnosuchnumberretry']+_0x5437f1[_0xe1c4('0xd')]+_0x5437f1[_0xe1c4('0xe')]+_0x5437f1[_0xe1c4('0xf')]+_0x5437f1[_0xe1c4('0x10')];this['countnosuchnumberretry']=_0x5437f1[_0xe1c4('0x11')];this['countdropretry']=_0x5437f1[_0xe1c4('0xd')];this[_0xe1c4('0xe')]=_0x5437f1[_0xe1c4('0xe')];this['countmachineretry']=_0x5437f1['countmachineretry'];this[_0xe1c4('0x10')]=_0x5437f1[_0xe1c4('0x10')];this[_0xe1c4('0x12')]=_0x5437f1[_0xe1c4('0x12')];this['calleridname']=_0x5437f1['calleridname'];this[_0xe1c4('0x13')]=_0x5437f1[_0xe1c4('0x13')];this['starttime']=_0x5437f1[_0xe1c4('0x14')];this['responsetime']=_0x5437f1[_0xe1c4('0x15')];this[_0xe1c4('0x16')]=_0x5437f1[_0xe1c4('0x15')];this[_0xe1c4('0x17')]=_0x5437f1['ringtime']||0x0;this[_0xe1c4('0x18')]=_0x5437f1['holdtime']||0x0;this[_0xe1c4('0x19')]=_0x5437f1[_0xe1c4('0x19')]||0x0;this[_0xe1c4('0x1a')]=_0x5437f1[_0xe1c4('0x1a')];this[_0xe1c4('0x1b')]=_0x5437f1[_0xe1c4('0x1b')];this[_0xe1c4('0x1c')]=_0x5437f1[_0xe1c4('0x1c')];this[_0xe1c4('0x1d')]=_0x5437f1['recallme'];this[_0xe1c4('0x1e')]=_0x5437f1[_0xe1c4('0x1e')];this[_0xe1c4('0x1f')]=_0x5437f1['ListId'];this[_0xe1c4('0x20')]=_0x5437f1[_0xe1c4('0x20')];this[_0xe1c4('0x21')]=_0x5437f1[_0xe1c4('0x21')];this[_0xe1c4('0x22')]=_0x5437f1[_0xe1c4('0x22')];this[_0xe1c4('0x23')]=_0x5437f1['originatecalleridnum']||'';this[_0xe1c4('0x24')]=_0x5437f1[_0xe1c4('0x24')]||'';}module[_0xe1c4('0x25')]=Final; \ No newline at end of file +var _0x9f34=['ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x206116,_0x1089f9){var _0x2851d3=function(_0x3f08d9){while(--_0x3f08d9){_0x206116['push'](_0x206116['shift']());}};_0x2851d3(++_0x1089f9);}(_0x9f34,0x1c3));var _0x49f3=function(_0x30c28c,_0x49c10d){_0x30c28c=_0x30c28c-0x0;var _0x40074d=_0x9f34[_0x30c28c];return _0x40074d;};'use strict';var util=require('util');var _=require(_0x49f3('0x0'));var moment=require(_0x49f3('0x1'));function getSeconds(_0x3aef4a,_0x56dfad){var _0xb82d44=moment(_0x3aef4a)[_0x49f3('0x2')](0x0);var _0x643377=moment(_0x56dfad)[_0x49f3('0x2')](0x0);return _0xb82d44[_0x49f3('0x3')](_0x643377,_0x49f3('0x4'));}function Final(_0x1c4418){this[_0x49f3('0x5')]=_0x1c4418[_0x49f3('0x5')];this[_0x49f3('0x6')]=_0x1c4418[_0x49f3('0x6')];this[_0x49f3('0x7')]=_0x1c4418[_0x49f3('0x7')];this[_0x49f3('0x8')]=_0x1c4418[_0x49f3('0x7')]==='outbound'?'queue':_0x1c4418[_0x49f3('0x7')];this[_0x49f3('0x9')]=_0x1c4418['countbusyretry'];this['countcongestionretry']=_0x1c4418['countcongestionretry'];this['countnoanswerretry']=_0x1c4418['countnoanswerretry'];this['countglobal']=_0x1c4418[_0x49f3('0x9')]+_0x1c4418[_0x49f3('0xa')]+_0x1c4418[_0x49f3('0xb')]+_0x1c4418[_0x49f3('0xc')]+_0x1c4418[_0x49f3('0xd')]+_0x1c4418[_0x49f3('0xe')]+_0x1c4418[_0x49f3('0xf')]+_0x1c4418['countagentrejectretry'];this[_0x49f3('0xc')]=_0x1c4418[_0x49f3('0xc')];this[_0x49f3('0xd')]=_0x1c4418['countdropretry'];this[_0x49f3('0xe')]=_0x1c4418[_0x49f3('0xe')];this[_0x49f3('0xf')]=_0x1c4418[_0x49f3('0xf')];this[_0x49f3('0x10')]=_0x1c4418[_0x49f3('0x10')];this[_0x49f3('0x11')]=_0x1c4418[_0x49f3('0x11')];this[_0x49f3('0x12')]=_0x1c4418[_0x49f3('0x12')];this[_0x49f3('0x13')]=_0x1c4418[_0x49f3('0x13')];this['starttime']=_0x1c4418[_0x49f3('0x14')];this[_0x49f3('0x15')]=_0x1c4418[_0x49f3('0x15')];this[_0x49f3('0x16')]=_0x1c4418[_0x49f3('0x15')];this[_0x49f3('0x17')]=_0x1c4418[_0x49f3('0x17')]||0x0;this[_0x49f3('0x18')]=_0x1c4418['holdtime']||0x0;this[_0x49f3('0x19')]=_0x1c4418[_0x49f3('0x19')]||0x0;this['callback']=_0x1c4418[_0x49f3('0x1a')];this['callbackuniqueid']=_0x1c4418[_0x49f3('0x1b')];this[_0x49f3('0x1c')]=_0x1c4418[_0x49f3('0x1c')];this[_0x49f3('0x1d')]=_0x1c4418[_0x49f3('0x1d')];this[_0x49f3('0x1e')]=_0x1c4418[_0x49f3('0x1e')];this[_0x49f3('0x1f')]=_0x1c4418['ListId'];this['UserId']=_0x1c4418['UserId'];this[_0x49f3('0x20')]=_0x1c4418[_0x49f3('0x20')];this[_0x49f3('0x21')]=_0x1c4418[_0x49f3('0x21')];this[_0x49f3('0x22')]=_0x1c4418['originatecalleridnum']||'';this[_0x49f3('0x23')]=_0x1c4418[_0x49f3('0x23')]||'';}module[_0x49f3('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index b0a8794..04084de 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 _0x6f4e=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry'];(function(_0x38bb9a,_0x28c1ca){var _0x113665=function(_0x5e4cca){while(--_0x5e4cca){_0x38bb9a['push'](_0x38bb9a['shift']());}};_0x113665(++_0x28c1ca);}(_0x6f4e,0x7c));var _0xe6f4=function(_0x5bb6c4,_0x5a9767){_0x5bb6c4=_0x5bb6c4-0x0;var _0x20035f=_0x6f4e[_0x5bb6c4];return _0x20035f;};'use strict';var util=require(_0xe6f4('0x0'));var _=require(_0xe6f4('0x1'));var moment=require(_0xe6f4('0x2'));function getSeconds(_0xca5dca,_0x189b75){var _0x16d23b=moment(_0xca5dca)[_0xe6f4('0x3')](0x0);var _0x3ffa70=moment(_0x189b75)['milliseconds'](0x0);return _0x16d23b[_0xe6f4('0x4')](_0x3ffa70,_0xe6f4('0x5'));}function Hangup(_0xe2f1ca,_0x52f615){this[_0xe6f4('0x6')]=0x4;this[_0xe6f4('0x7')]='Answer';this['scheduledat']=_0xe2f1ca[_0xe6f4('0x8')];this['type']=_0xe2f1ca[_0xe6f4('0x9')];this[_0xe6f4('0xa')]=_0xe2f1ca[_0xe6f4('0x9')]==='outbound'?_0xe6f4('0xb'):_0xe2f1ca[_0xe6f4('0x9')];this[_0xe6f4('0xc')]=_0xe2f1ca[_0xe6f4('0xc')];this['countcongestionretry']=_0xe2f1ca[_0xe6f4('0xd')];this[_0xe6f4('0xe')]=_0xe2f1ca[_0xe6f4('0xe')];this[_0xe6f4('0xf')]=_0xe2f1ca[_0xe6f4('0xc')]+_0xe2f1ca[_0xe6f4('0xd')]+_0xe2f1ca[_0xe6f4('0xe')]+_0xe2f1ca[_0xe6f4('0x10')]+_0xe2f1ca[_0xe6f4('0x11')]+_0xe2f1ca['countabandonedretry']+_0xe2f1ca[_0xe6f4('0x12')]+_0xe2f1ca[_0xe6f4('0x13')];this[_0xe6f4('0x10')]=_0xe2f1ca[_0xe6f4('0x10')];this['countdropretry']=_0xe2f1ca[_0xe6f4('0x11')];this[_0xe6f4('0x14')]=_0xe2f1ca[_0xe6f4('0x14')];this[_0xe6f4('0x12')]=_0xe2f1ca[_0xe6f4('0x12')];this[_0xe6f4('0x13')]=_0xe2f1ca[_0xe6f4('0x13')];this[_0xe6f4('0x15')]=_0x52f615[_0xe6f4('0x15')];this[_0xe6f4('0x16')]=_0xe2f1ca[_0xe6f4('0x17')];this[_0xe6f4('0x18')]=_0xe2f1ca[_0xe6f4('0x19')];this['starttime']=_0xe2f1ca[_0xe6f4('0x1a')];this[_0xe6f4('0x1b')]=_0xe2f1ca[_0xe6f4('0x1b')];this[_0xe6f4('0x1c')]=moment()[_0xe6f4('0x1d')](_0xe6f4('0x1e'));this[_0xe6f4('0x1f')]=getSeconds(_0xe2f1ca[_0xe6f4('0x1b')],_0xe2f1ca[_0xe6f4('0x1a')]);this[_0xe6f4('0x20')]=0x0;this[_0xe6f4('0x21')]=getSeconds(this['endtime'],_0xe2f1ca[_0xe6f4('0x1b')]);this[_0xe6f4('0xb')]=_0xe2f1ca[_0xe6f4('0xb')];this[_0xe6f4('0x22')]=_0xe6f4('0x23');this['reason']=_0x52f615[_0xe6f4('0x24')];this[_0xe6f4('0x25')]=_0xe2f1ca[_0xe6f4('0x25')];this[_0xe6f4('0x26')]=_0xe2f1ca[_0xe6f4('0x26')];this[_0xe6f4('0x27')]=_0xe2f1ca['callbackat'];this[_0xe6f4('0x28')]=_0xe2f1ca[_0xe6f4('0x28')];this[_0xe6f4('0x29')]=_0xe2f1ca[_0xe6f4('0x29')];this[_0xe6f4('0x2a')]=_0xe2f1ca[_0xe6f4('0x2a')];this['UserId']=_0xe2f1ca['UserId'];this[_0xe6f4('0x2b')]=_0xe2f1ca[_0xe6f4('0x2b')];this[_0xe6f4('0x2c')]=_0xe2f1ca[_0xe6f4('0x2c')];}module[_0xe6f4('0x2d')]=Hangup; \ No newline at end of file +var _0x2d0e=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','number','starttime','responsetime'];(function(_0x387b3f,_0x582b55){var _0x358e90=function(_0x5d1f79){while(--_0x5d1f79){_0x387b3f['push'](_0x387b3f['shift']());}};_0x358e90(++_0x582b55);}(_0x2d0e,0x8f));var _0xe2d0=function(_0x3491cc,_0x45d472){_0x3491cc=_0x3491cc-0x0;var _0xe4b072=_0x2d0e[_0x3491cc];return _0xe4b072;};'use strict';var util=require(_0xe2d0('0x0'));var _=require(_0xe2d0('0x1'));var moment=require('moment');function getSeconds(_0x31c034,_0x16b6b3){var _0x59852d=moment(_0x31c034)[_0xe2d0('0x2')](0x0);var _0x1297bb=moment(_0x16b6b3)[_0xe2d0('0x2')](0x0);return _0x59852d[_0xe2d0('0x3')](_0x1297bb,'seconds');}function Hangup(_0x1552eb,_0x3e84f1){this[_0xe2d0('0x4')]=0x4;this[_0xe2d0('0x5')]=_0xe2d0('0x6');this[_0xe2d0('0x7')]=_0x1552eb[_0xe2d0('0x7')];this[_0xe2d0('0x8')]=_0x1552eb[_0xe2d0('0x8')];this[_0xe2d0('0x9')]=_0x1552eb[_0xe2d0('0x8')]===_0xe2d0('0xa')?'queue':_0x1552eb[_0xe2d0('0x8')];this[_0xe2d0('0xb')]=_0x1552eb[_0xe2d0('0xb')];this[_0xe2d0('0xc')]=_0x1552eb[_0xe2d0('0xc')];this[_0xe2d0('0xd')]=_0x1552eb['countnoanswerretry'];this[_0xe2d0('0xe')]=_0x1552eb[_0xe2d0('0xb')]+_0x1552eb[_0xe2d0('0xc')]+_0x1552eb['countnoanswerretry']+_0x1552eb[_0xe2d0('0xf')]+_0x1552eb[_0xe2d0('0x10')]+_0x1552eb[_0xe2d0('0x11')]+_0x1552eb['countmachineretry']+_0x1552eb[_0xe2d0('0x12')];this[_0xe2d0('0xf')]=_0x1552eb[_0xe2d0('0xf')];this[_0xe2d0('0x10')]=_0x1552eb[_0xe2d0('0x10')];this['countabandonedretry']=_0x1552eb[_0xe2d0('0x11')];this[_0xe2d0('0x13')]=_0x1552eb[_0xe2d0('0x13')];this['countagentrejectretry']=_0x1552eb[_0xe2d0('0x12')];this[_0xe2d0('0x14')]=_0x3e84f1['uniqueid'];this[_0xe2d0('0x15')]=_0x1552eb['name'];this['calleridnum']=_0x1552eb[_0xe2d0('0x16')];this[_0xe2d0('0x17')]=_0x1552eb[_0xe2d0('0x17')];this[_0xe2d0('0x18')]=_0x1552eb['responsetime'];this[_0xe2d0('0x19')]=moment()[_0xe2d0('0x1a')](_0xe2d0('0x1b'));this['ringtime']=getSeconds(_0x1552eb[_0xe2d0('0x18')],_0x1552eb[_0xe2d0('0x17')]);this[_0xe2d0('0x1c')]=0x0;this['talktime']=getSeconds(this[_0xe2d0('0x19')],_0x1552eb[_0xe2d0('0x18')]);this['queue']=_0x1552eb[_0xe2d0('0x1d')];this[_0xe2d0('0x1e')]='IVR';this[_0xe2d0('0x1f')]=_0x3e84f1[_0xe2d0('0x20')];this[_0xe2d0('0x21')]=_0x1552eb[_0xe2d0('0x21')];this['callbackuniqueid']=_0x1552eb[_0xe2d0('0x22')];this[_0xe2d0('0x23')]=_0x1552eb['callbackat'];this['recallme']=_0x1552eb[_0xe2d0('0x24')];this[_0xe2d0('0x25')]=_0x1552eb['ContactId'];this['ListId']=_0x1552eb[_0xe2d0('0x26')];this[_0xe2d0('0x27')]=_0x1552eb[_0xe2d0('0x27')];this[_0xe2d0('0x28')]=_0x1552eb[_0xe2d0('0x28')];this['CampaignId']=_0x1552eb['CampaignId'];}module[_0xe2d0('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 26090db..4084e3e 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 _0x2463=['countagentrejectretry','calleridname','name','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry'];(function(_0x114891,_0x2a24a4){var _0x5be30b=function(_0x2e8637){while(--_0x2e8637){_0x114891['push'](_0x114891['shift']());}};_0x5be30b(++_0x2a24a4);}(_0x2463,0xf7));var _0x3246=function(_0x197fd1,_0x5b9c02){_0x197fd1=_0x197fd1-0x0;var _0x16c692=_0x2463[_0x197fd1];return _0x16c692;};'use strict';var util=require(_0x3246('0x0'));var _=require(_0x3246('0x1'));var moment=require(_0x3246('0x2'));function getSeconds(_0x4557f7,_0x3adc5c){var _0xeaeb35=moment(_0x4557f7)[_0x3246('0x3')](0x0);var _0x26900b=moment(_0x3adc5c)['milliseconds'](0x0);return _0xeaeb35[_0x3246('0x4')](_0x26900b,'seconds');}function History(_0x48b0c9){this[_0x3246('0x5')]=_0x48b0c9[_0x3246('0x5')];this[_0x3246('0x6')]=_0x48b0c9[_0x3246('0x6')]||undefined;this['type']=_0x48b0c9[_0x3246('0x7')];this[_0x3246('0x8')]=_0x48b0c9[_0x3246('0x7')]===_0x3246('0x9')?_0x3246('0xa'):_0x48b0c9['type'];this[_0x3246('0xb')]=_0x48b0c9[_0x3246('0xb')];this[_0x3246('0xc')]=_0x48b0c9[_0x3246('0xc')];this[_0x3246('0xd')]=_0x48b0c9[_0x3246('0xd')];this[_0x3246('0xe')]=_0x48b0c9['countbusyretry']+_0x48b0c9[_0x3246('0xc')]+_0x48b0c9['countnoanswerretry']+_0x48b0c9[_0x3246('0xf')]+_0x48b0c9[_0x3246('0x10')]+_0x48b0c9['countabandonedretry']+_0x48b0c9[_0x3246('0x11')]+_0x48b0c9['countagentrejectretry'];this[_0x3246('0xf')]=_0x48b0c9[_0x3246('0xf')];this[_0x3246('0x10')]=_0x48b0c9[_0x3246('0x10')];this[_0x3246('0x12')]=_0x48b0c9['countabandonedretry'];this[_0x3246('0x11')]=_0x48b0c9[_0x3246('0x11')];this[_0x3246('0x13')]=_0x48b0c9[_0x3246('0x13')];this[_0x3246('0xa')]=_0x48b0c9[_0x3246('0xa')];this[_0x3246('0x14')]=_0x48b0c9[_0x3246('0x15')];this['calleridnum']=_0x48b0c9['number'];this[_0x3246('0x16')]=_0x48b0c9['starttime'];this[_0x3246('0x17')]=_0x48b0c9[_0x3246('0x17')];this[_0x3246('0x18')]=_0x48b0c9[_0x3246('0x17')];this[_0x3246('0x19')]=getSeconds(_0x48b0c9[_0x3246('0x17')],_0x48b0c9['starttime']);this[_0x3246('0x1a')]=0x0;this['talktime']=0x0;this[_0x3246('0x1b')]=_0x48b0c9[_0x3246('0x1b')];this['callbackuniqueid']=_0x48b0c9[_0x3246('0x1c')];this[_0x3246('0x1d')]=_0x48b0c9['callbackat'];this[_0x3246('0x1e')]=_0x48b0c9[_0x3246('0x1e')];this['ContactId']=_0x48b0c9[_0x3246('0x1f')];this[_0x3246('0x20')]=_0x48b0c9['ListId'];this[_0x3246('0x21')]=_0x48b0c9[_0x3246('0x21')];this[_0x3246('0x22')]=_0x48b0c9[_0x3246('0x22')];this[_0x3246('0x23')]=_0x48b0c9[_0x3246('0x23')];this[_0x3246('0x24')]=_0x48b0c9['originatecalleridnum']||'';this['originatecalleridname']=_0x48b0c9[_0x3246('0x25')]||'';}module['exports']=History; \ No newline at end of file +var _0x40c6=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x40c6,0xf5));var _0x640c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x40c6[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x640c('0x0'));var _=require(_0x640c('0x1'));var moment=require(_0x640c('0x2'));function getSeconds(_0x15fa87,_0x333ff5){var _0x18ec13=moment(_0x15fa87)[_0x640c('0x3')](0x0);var _0x48e206=moment(_0x333ff5)['milliseconds'](0x0);return _0x18ec13[_0x640c('0x4')](_0x48e206,_0x640c('0x5'));}function History(_0xc28ea9){this[_0x640c('0x6')]=_0xc28ea9[_0x640c('0x6')];this['scheduledat']=_0xc28ea9['scheduledat']||undefined;this[_0x640c('0x7')]=_0xc28ea9['type'];this['campaigntype']=_0xc28ea9[_0x640c('0x7')]===_0x640c('0x8')?'queue':_0xc28ea9['type'];this[_0x640c('0x9')]=_0xc28ea9[_0x640c('0x9')];this[_0x640c('0xa')]=_0xc28ea9[_0x640c('0xa')];this['countnoanswerretry']=_0xc28ea9[_0x640c('0xb')];this[_0x640c('0xc')]=_0xc28ea9[_0x640c('0x9')]+_0xc28ea9[_0x640c('0xa')]+_0xc28ea9[_0x640c('0xb')]+_0xc28ea9['countnosuchnumberretry']+_0xc28ea9[_0x640c('0xd')]+_0xc28ea9[_0x640c('0xe')]+_0xc28ea9['countmachineretry']+_0xc28ea9['countagentrejectretry'];this['countnosuchnumberretry']=_0xc28ea9[_0x640c('0xf')];this[_0x640c('0xd')]=_0xc28ea9['countdropretry'];this[_0x640c('0xe')]=_0xc28ea9['countabandonedretry'];this[_0x640c('0x10')]=_0xc28ea9[_0x640c('0x10')];this[_0x640c('0x11')]=_0xc28ea9[_0x640c('0x11')];this['queue']=_0xc28ea9['queue'];this[_0x640c('0x12')]=_0xc28ea9[_0x640c('0x13')];this[_0x640c('0x14')]=_0xc28ea9['number'];this[_0x640c('0x15')]=_0xc28ea9[_0x640c('0x15')];this[_0x640c('0x16')]=_0xc28ea9[_0x640c('0x16')];this[_0x640c('0x17')]=_0xc28ea9[_0x640c('0x16')];this[_0x640c('0x18')]=getSeconds(_0xc28ea9[_0x640c('0x16')],_0xc28ea9['starttime']);this[_0x640c('0x19')]=0x0;this[_0x640c('0x1a')]=0x0;this['callback']=_0xc28ea9[_0x640c('0x1b')];this['callbackuniqueid']=_0xc28ea9[_0x640c('0x1c')];this['callbackat']=_0xc28ea9[_0x640c('0x1d')];this['recallme']=_0xc28ea9[_0x640c('0x1e')];this['ContactId']=_0xc28ea9[_0x640c('0x1f')];this[_0x640c('0x20')]=_0xc28ea9[_0x640c('0x20')];this[_0x640c('0x21')]=_0xc28ea9[_0x640c('0x21')];this['VoiceQueueId']=_0xc28ea9[_0x640c('0x22')];this['CampaignId']=_0xc28ea9['CampaignId'];this[_0x640c('0x23')]=_0xc28ea9[_0x640c('0x23')]||'';this[_0x640c('0x24')]=_0xc28ea9[_0x640c('0x24')]||'';}module[_0x640c('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index b6593c4..b086339 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 _0x1322=['NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','loggerHandler','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\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','exports','util','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','newexten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','type','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','voice:queue:%s','voice_queue:save','ivr','format','-----\x20Stats\x20Predictive\x20---','info','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Total\x20Calls\x20are\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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','enqueue','isNil','Action','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','checkIsBlackList','resolve','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','status','reachable','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','outboundAnswerCallsDay','countnoanswerretry','reason\x2019\x20machine....','syncHangup','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','CampaignId','[rescheduleContact][Abandoned]','syncNewExten','actionid','locked','paused','stateinterface','push','queueStatusComplete','[booked][unlockQueueStatus]','run','idHopper','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','command','iftime\x20%s,%s','interval','indexOf','true','timezones','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Failure','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','pow','replace','random','match','object','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','originate','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....'];(function(_0x292b74,_0x431bf1){var _0x33490d=function(_0xbbcc38){while(--_0xbbcc38){_0x292b74['push'](_0x292b74['shift']());}};_0x33490d(++_0x431bf1);}(_0x1322,0x72));var _0x2132=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1322[_0x40220a];return _0x3903cc;};'use strict';var util=require(_0x2132('0x0'));var _=require('lodash');var BPromise=require(_0x2132('0x1'));var uuid=require(_0x2132('0x2'));var moment=require(_0x2132('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x2132('0x4'));var ut=require(_0x2132('0x5'));var config=require(_0x2132('0x6'));var logger=require(_0x2132('0x7'))('dialer');var loggerBooked=require(_0x2132('0x7'))('booked');var loggerPredictive=require(_0x2132('0x7'))(_0x2132('0x8'));var loggerPredictiveCalls=require(_0x2132('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x2132('0x9'));var ami=require(_0x2132('0xa'));config[_0x2132('0xb')]=_[_0x2132('0xc')](config[_0x2132('0xb')],{'host':_0x2132('0xd'),'port':0x18eb});var io=require(_0x2132('0xe'))(new Redis(config[_0x2132('0xb')]));var cmHopper=require(_0x2132('0xf'));var cmHopperFinal=require(_0x2132('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2132('0x11'));var voiceQueueRt=require(_0x2132('0x12'));var Action=require(_0x2132('0x13'));var History=require(_0x2132('0x14'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x2132('0x15'));var Hangup=require(_0x2132('0x16'));var ipAgi=process[_0x2132('0x17')][_0x2132('0x18')]||_0x2132('0x19');var strategy={'rrmemory':_0x2132('0x1a'),'roundrobin':_0x2132('0x1b')};var Sequence=function(){};Sequence[_0x2132('0x1c')]['enqueue']=function(_0x5b8a6b){this[_0x2132('0x1d')]=this[_0x2132('0x1d')]?this[_0x2132('0x1d')][_0x2132('0x1e')](_0x5b8a6b):_0x5b8a6b();};function Dialer(_0x519ee8,_0x40fff4){this['sequence']=new Sequence();this[_0x2132('0x1f')]=_0x40fff4;this[_0x2132('0x20')]=_0x519ee8[_0x2132('0x20')];this['campaigns']=_0x519ee8[_0x2132('0x21')];this[_0x2132('0x22')]=_0x519ee8[_0x2132('0x22')];this[_0x2132('0x23')]=_0x519ee8[_0x2132('0x23')];this[_0x2132('0x24')]=config['maxNumberOriginate']||0x2;this[_0x2132('0x25')]={};this['actions']={};this['contactsId']={};this[_0x2132('0x26')]={};this[_0x2132('0x27')]={};this[_0x2132('0x28')]={};this[_0x2132('0x29')]={};this[_0x2132('0x2a')]={};this[_0x2132('0x2b')]={};this[_0x2132('0x2c')]={};ami['on'](_0x2132('0x2d'),this['syncAgentConnect'][_0x2132('0x2e')](this));ami['on']('queuecallerabandon',this[_0x2132('0x2f')]['bind'](this));ami['on'](_0x2132('0x30'),this[_0x2132('0x31')]['bind'](this));ami['on'](_0x2132('0x32'),this[_0x2132('0x33')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x2132('0x2e')](this));ami['on'](_0x2132('0x34'),this['syncHangup'][_0x2132('0x2e')](this));ami['on'](_0x2132('0x35'),this['syncNewExten']['bind'](this));ami['on'](_0x2132('0x36'),this[_0x2132('0x37')][_0x2132('0x2e')](this));ami['on']('queuemember',this[_0x2132('0x38')]['bind'](this));ami['on'](_0x2132('0x39'),this[_0x2132('0x3a')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x38b7e0){return _0x38b7e0!==null&&!_[_0x2132('0x3b')](_0x38b7e0);}function checkIsLoggedIn(_0x7f35b4,_0x53da8f){return function(){if(_0x53da8f<=0x0){_0x7f35b4[_0x2132('0x3c')]=_0x2132('0x3d');throw _0x7f35b4[_0x2132('0x3e')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x5b0ad8){return _0x5b0ad8;}function checkIsActive(_0x188935,_0xee0f22){return function(){if(!isActive(_0xee0f22)){_0x188935[_0x2132('0x3c')]=_0x2132('0x3f');throw _0x188935['name']+_0x2132('0x40');}};}function checkInterval(_0x4a0ade){return function(){if(!isNotNull(_0x4a0ade[_0x2132('0x41')])){_0x4a0ade[_0x2132('0x3c')]=_0x2132('0x42');throw _0x4a0ade[_0x2132('0x3e')]+_0x2132('0x43');}if(!isNotNull(_0x4a0ade[_0x2132('0x41')][_0x2132('0x44')])){_0x4a0ade[_0x2132('0x3c')]=_0x2132('0x42');throw _0x4a0ade['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x2132('0x45')](_0x4a0ade[_0x2132('0x41')]['Intervals']))){_0x4a0ade[_0x2132('0x3c')]='INTERVAL_IS_NULL';throw _0x4a0ade[_0x2132('0x3e')]+_0x2132('0x43');}};}function msgResponse(_0x2a3cd2,_0x3c28f4,_0xa5ab09){return{'action':_0x2a3cd2,'response':_0x3c28f4,'message':_0xa5ab09,'stack':_0xa5ab09};}function myreject(_0x1f0599){return function(_0x3506c5){return _0x1f0599(msgResponse(_0x2132('0x46'),_0x2132('0x47'),JSON[_0x2132('0x48')](_0x3506c5)));};}function getSeconds(_0x486459,_0x51c4f1){var _0x3dbf81=moment(_0x486459)[_0x2132('0x49')](0x0);var _0x6a3e24=moment(_0x51c4f1)['milliseconds'](0x0);return _0x3dbf81[_0x2132('0x4a')](_0x6a3e24,'seconds');}function emit(_0x295f77,_0x318a29,_0x5780a9){io['to'](_0x295f77)[_0x2132('0x4b')](_0x318a29,_0x5780a9);}function emitVoiceQueueSummary(_0x57b0c2){if(_0x57b0c2[_0x2132('0x4c')]==='outbound'){var _0x45477f={'id':_0x57b0c2['id'],'name':_0x57b0c2['name'],'strategy':_0x57b0c2[_0x2132('0x4d')],'answered':_0x57b0c2['answered'],'available':_0x57b0c2['available'],'loggedIn':_0x57b0c2[_0x2132('0x4e')],'pTalking':_0x57b0c2[_0x2132('0x4f')],'sumBillable':_0x57b0c2[_0x2132('0x50')],'sumDuration':_0x57b0c2[_0x2132('0x51')],'sumHoldTime':_0x57b0c2[_0x2132('0x52')]||0x0,'talking':_0x57b0c2[_0x2132('0x53')],'total':_0x57b0c2['total'],'type':_0x57b0c2[_0x2132('0x4c')],'unmanaged':_0x57b0c2[_0x2132('0x54')],'abandoned':_0x57b0c2['abandoned'],'waiting':_0x57b0c2[_0x2132('0x55')],'loggedInDb':_0x57b0c2['loggedInDb'],'dialActive':_0x57b0c2[_0x2132('0x56')],'dialMethod':_0x57b0c2[_0x2132('0x57')],'dialOriginateCallerIdName':_0x57b0c2[_0x2132('0x58')],'dialOriginateCallerIdNumber':_0x57b0c2[_0x2132('0x59')],'dialOriginateTimeout':_0x57b0c2[_0x2132('0x5a')],'dialPrefix':_0x57b0c2[_0x2132('0x5b')],'outboundAnswerAgiCallsDay':_0x57b0c2['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x57b0c2['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x57b0c2[_0x2132('0x5c')],'outboundBusyCallsDay':_0x57b0c2[_0x2132('0x5d')],'outboundCongestionCallsDay':_0x57b0c2['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x57b0c2[_0x2132('0x5e')],'outboundDropCallsDayCallersExit':_0x57b0c2[_0x2132('0x5f')],'outboundDropCallsDayTimeout':_0x57b0c2[_0x2132('0x60')],'outboundNoAnswerCallsDay':_0x57b0c2[_0x2132('0x61')],'outboundNoSuchCallsDay':_0x57b0c2[_0x2132('0x62')],'outboundOriginateFailureCallsDay':_0x57b0c2[_0x2132('0x63')],'outboundReCallsDay':_0x57b0c2[_0x2132('0x64')],'outboundRejectCallsDay':_0x57b0c2[_0x2132('0x65')],'outboundUnknownCallsDay':_0x57b0c2['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x57b0c2[_0x2132('0x66')],'predictiveIntervalAvgHoldtime':_0x57b0c2[_0x2132('0x67')],'predictiveIntervalAvgTalktime':_0x57b0c2[_0x2132('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x57b0c2[_0x2132('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x57b0c2[_0x2132('0x6a')],'predictiveIntervalErlangCalls':_0x57b0c2[_0x2132('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x57b0c2[_0x2132('0x6c')],'predictiveIntervalHitRate':_0x57b0c2[_0x2132('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x57b0c2[_0x2132('0x6e')],'predictiveIntervalPauses':_0x57b0c2[_0x2132('0x6f')],'predictiveIntervalAvailable':_0x57b0c2[_0x2132('0x70')],'predictiveIntervalTotalCalls':_0x57b0c2[_0x2132('0x71')],'message':_0x57b0c2[_0x2132('0x3c')],'originated':_0x57b0c2[_0x2132('0x72')],'erlangCalls':_0x57b0c2['erlangCalls'],'erlangCallToSecond':_0x57b0c2[_0x2132('0x73')],'erlangAbandonmentRate':_0x57b0c2[_0x2132('0x74')],'erlangBusyFactor':_0x57b0c2[_0x2132('0x75')],'startPredictive':_0x57b0c2['startPredictive'],'startProgressive':_0x57b0c2[_0x2132('0x29')]};if(_0x57b0c2['Trunk']){_0x45477f['Trunk']={'id':_0x57b0c2['Trunk']['id'],'name':_0x57b0c2[_0x2132('0x76')][_0x2132('0x3e')],'active':_0x57b0c2['Trunk']['active'],'callerid':_0x57b0c2[_0x2132('0x76')][_0x2132('0x77')]};}if(_0x57b0c2[_0x2132('0x41')]){_0x45477f['Interval']={'id':_0x57b0c2[_0x2132('0x41')]['id'],'name':_0x57b0c2[_0x2132('0x41')][_0x2132('0x3e')]};}var _0x2c8e8e=md5(JSON['stringify'](_0x45477f));if(_0x57b0c2[_0x2132('0x78')]!==_0x2c8e8e){_0x57b0c2[_0x2132('0x78')]=_0x2c8e8e;emit(util['format'](_0x2132('0x79'),_0x45477f[_0x2132('0x3e')]),_0x2132('0x7a'),_0x45477f);}}}function emitCampaignSummary(_0x1ee572){if(_0x1ee572[_0x2132('0x4c')]===_0x2132('0x7b')){emit(util[_0x2132('0x7c')]('campaign:ivr:%s',_0x1ee572[_0x2132('0x3e')]),'campaign:save',_0x1ee572);}}function checkGetDataPredictive(_0x3a89f7){if(isNotNull(_0x3a89f7)){if(!_[_0x2132('0x45')](_0x3a89f7)){loggerPredictive['info'](_0x2132('0x7d'));loggerPredictive[_0x2132('0x7e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a89f7[_0x2132('0x71')]);loggerPredictive[_0x2132('0x7e')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a89f7[_0x2132('0x66')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a89f7[_0x2132('0x6a')]);loggerPredictive[_0x2132('0x7e')](_0x2132('0x7f'),_0x3a89f7['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a89f7[_0x2132('0x67')]);loggerPredictive[_0x2132('0x7e')](_0x2132('0x80'),_0x3a89f7[_0x2132('0x68')]);loggerPredictive[_0x2132('0x7e')]('---------------------------');if(_0x3a89f7['predictiveIntervalTotalCalls']>0x0){if(!_[_0x2132('0x3b')](_0x3a89f7['predictiveIntervalAvgTalktime'])&&_0x3a89f7[_0x2132('0x68')]>0x0){return!![];}else{loggerPredictive[_0x2132('0x7e')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0x2132('0x3b')](_0x3a89f7['predictiveIntervalAvgHoldtime'])&&_0x3a89f7[_0x2132('0x67')]>0x0){return!![];}else{loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x2132('0x7e')](_0x2132('0x81'));}}else{loggerPredictive[_0x2132('0x7e')]('History\x20information\x20are\x20empty');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x310cc1){return function(_0x3d725b){loggerPredictive[_0x2132('0x7e')](_0x2132('0x82'));loggerPredictive[_0x2132('0x7e')](_0x2132('0x83'),_0x3d725b['erlangCalls']);loggerPredictive['info'](_0x2132('0x84'),_0x3d725b[_0x2132('0x73')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d725b[_0x2132('0x74')]);loggerPredictive['info'](_0x2132('0x85'),_0x3d725b[_0x2132('0x75')]);loggerPredictive[_0x2132('0x7e')](_0x2132('0x86'),_0x3d725b[_0x2132('0x74')]);loggerPredictive['info']('---------------------------');_[_0x2132('0x87')](_0x310cc1,_0x3d725b);};}function getDiff(_0x3b41b6){var _0x1497e7=moment()['milliseconds'](0x0);var _0xfacd59=moment(_0x3b41b6)[_0x2132('0x49')](0x0);return _0x1497e7[_0x2132('0x4a')](_0xfacd59,'seconds');}function ifInterval(_0x8ad88e,_0x1d4199){if(_[_0x2132('0x3b')](_0x1d4199)){return![];}if(getDiff(_0x1d4199)<_0x8ad88e*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3bd555){if(isNotNull(_0x3bd555)){if(!_[_0x2132('0x3b')](_0x3bd555['startProgressive'])){_0x3bd555[_0x2132('0x29')]=undefined;loggerPredictive[_0x2132('0x7e')](_0x3bd555[_0x2132('0x3e')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x3bd555[_0x2132('0x28')])){_0x3bd555[_0x2132('0x28')]=undefined;loggerPredictive['info'](_0x3bd555[_0x2132('0x3e')],_0x2132('0x88'));}if(!_[_0x2132('0x3b')](_0x3bd555[_0x2132('0x89')])){clearInterval(_0x3bd555[_0x2132('0x89')]);_0x3bd555[_0x2132('0x89')]=undefined;loggerPredictive[_0x2132('0x7e')](_0x3bd555[_0x2132('0x3e')],_0x2132('0x8a'));}}}function erlangb(_0x4bdcae,_0x28ac0f){if(_0x28ac0f===0x0){return 0x0;}var _0x1da9e0=0x1;for(var _0x585092=0x1;_0x585092<=_0x28ac0f;_0x585092+=0x1){_0x1da9e0=0x1+_0x1da9e0*_0x585092/_0x4bdcae;}return 0x1/_0x1da9e0;}function isVoiceQueueOutbound(_0x47a37a){return _0x47a37a===_0x2132('0x8b');}function isNotPreview(_0x220afa){return _0x220afa!==_0x2132('0x1f');}function isCampaignIvr(_0x34d538){return _0x34d538==='ivr';}function getCallerId(_0x444605,_0x3b53bf,_0x4e4a0c){if(!_[_0x2132('0x3b')](_0x4e4a0c)&&'string'===typeof _0x4e4a0c&&!_['isEmpty'](_0x4e4a0c)){if(!_[_0x2132('0x3b')](_0x3b53bf)&&_0x2132('0x8c')===typeof _0x3b53bf&&!_['isEmpty'](_0x3b53bf)){return util[_0x2132('0x7c')](_0x2132('0x8d'),_0x3b53bf,_0x4e4a0c);}return util[_0x2132('0x7c')](_0x2132('0x8d'),_0x4e4a0c,_0x4e4a0c);}if(!_[_0x2132('0x3b')](_0x444605)&&_0x2132('0x8c')===typeof _0x444605&&!_['isEmpty'](_0x444605)){return _0x444605;}return _0x2132('0x8e');}function loggerCatchQueueSummary(_0xa80375,_0x387b69){return function(_0x5a2f1a){freeVariablesPredictive(_0x387b69);emitVoiceQueueSummary(_0x387b69);emitCampaignSummary(_0x387b69);loggerSyncQueueSummary['error'](_0xa80375,util[_0x2132('0x8f')](_0x5a2f1a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x439d07,_0x5afc26){return function(_0x1bb661){loggerPredictive[_0x2132('0x90')](_0x5afc26[_0x2132('0x3e')],_0x439d07);loggerPredictive[_0x2132('0x90')](_0x1bb661[_0x2132('0x91')]);freeVariablesPredictive(_0x5afc26);};}function loggerCatch(_0x14d73b){return function(_0x32ef87){logger['error'](_0x14d73b,util['inspect'](_0x32ef87,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3b52d){return _0x3b52d&&!_[_0x2132('0x3b')](_0x3b52d)&&_0x3b52d[_0x2132('0x92')]>0x0;}function decremetOriginate(_0x305935){if(!_['isUndefined'](_0x305935)&&_0x305935!==null){if(_0x305935[_0x2132('0x93')](_0x2132('0x72'))){if(_0x305935['originated']>0x0){_0x305935[_0x2132('0x72')]-=0x1;}else{logger[_0x2132('0x90')](_0x2132('0x94'));}}}else{logger[_0x2132('0x90')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2de5d4,_0x3cd683,_0x16bff1){if(_0x3cd683>_0x16bff1){for(var _0x160ffc=0x0;_0x160ffc<_0x3cd683-_0x16bff1;_0x160ffc+=0x1){decremetOriginate(_0x2de5d4);}}}function loggerGetContactDialer(_0x5b601a,_0x2382b5,_0x414edb){return function(_0xdb26d5){checkContactLowerLimitOriginate(_0x2382b5,_0x414edb,0x0);logger[_0x2132('0x90')](_0x5b601a,util[_0x2132('0x8f')](_0xdb26d5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1b710e){return function(_0x5a27a6){if(isNotNull(_0x5a27a6)&&isNotNull(_0x5a27a6[0x0])){if(_0x5a27a6[0x0]['contactsRescheduled']>0x0){_0x1b710e[_0x2132('0x3c')]=_0x2132('0x95');logger[_0x2132('0x7e')](_0x2132('0x96')+_0x1b710e[_0x2132('0x3e')],_0x5a27a6[0x0][_0x2132('0x97')],_0x2132('0x98'));}else{_0x1b710e['message']=_0x2132('0x99');logger[_0x2132('0x7e')]('[getContactDialer2][Empty]'+_0x1b710e[_0x2132('0x3e')]);}}};}function notSendMessagesQueue(_0x2b8073){if(_0x2b8073[_0x2132('0x9a')]){freeVariablesPredictive(_0x2b8073);if(_0x2b8073[_0x2132('0x72')]===0x0&&_0x2b8073[_0x2132('0x53')]===0x0&&_0x2b8073['waiting']===0x0&&(_0x2b8073[_0x2132('0x4f')]||0x0)===0x0){_0x2b8073[_0x2132('0x9a')]=![];_0x2b8073[_0x2132('0x9b')]=0x0;_0x2b8073[_0x2132('0x3c')]=_0x2132('0x3f');loggerSyncQueueSummary[_0x2132('0x90')](_0x2132('0x9c'),_0x2b8073[_0x2132('0x3e')],'is\x20not\x20active');}else{_0x2b8073[_0x2132('0x3c')]=_0x2132('0x9d');loggerSyncQueueSummary[_0x2132('0x90')](_0x2132('0x9c'),_0x2b8073[_0x2132('0x3e')],_0x2132('0x9e'));}emitVoiceQueueSummary(_0x2b8073);}}function notSendMessagesCampaign(_0xd9f47f){if(_0xd9f47f[_0x2132('0x9a')]){if(_0xd9f47f['originated']===0x0){_0xd9f47f[_0x2132('0x9a')]=![];_0xd9f47f[_0x2132('0x3c')]=_0x2132('0x3f');loggerSyncQueueSummary['error'](_0x2132('0x9f'),_0xd9f47f[_0x2132('0x3e')],_0x2132('0xa0'));}else{_0xd9f47f[_0x2132('0x3c')]=_0x2132('0x9d');loggerSyncQueueSummary[_0x2132('0x90')](_0x2132('0x9f'),_0xd9f47f[_0x2132('0x3e')],_0x2132('0x9e'));}emitCampaignSummary(_0xd9f47f);}}function createObjHistory(_0x3f815e,_0x44dcda,_0x4e5aa3,_0xbeb47,_0x21d835){_0x3f815e[_0x2132('0x3c')]=_0x4e5aa3;var _0x23f810=new Action(_0x3f815e,_0x44dcda);var _0x128c0e=new History(_0x23f810);_0x128c0e[_0x2132('0xa1')]=_0xbeb47;_0x128c0e[_0x2132('0xa2')]=_0x21d835;_0x128c0e[_0x2132('0xa3')]=_0x23f810[_0x2132('0xa4')];return _0x128c0e;}Dialer[_0x2132('0x1c')][_0x2132('0xa5')]=function(){var _0x11e9c8=this;setInterval(function(){_0x11e9c8[_0x2132('0xa6')](_0x11e9c8[_0x2132('0x26')],_0x2132('0xa7'));_0x11e9c8['clearZombieChannels'](_0x11e9c8[_0x2132('0xa8')],_0x2132('0xa9'));},0x32c8);};Dialer['prototype'][_0x2132('0xa6')]=function(_0x49f658,_0x2489ab){var _0x2afdec=this;for(var _0x6d8989 in _0x49f658){if(_0x49f658[_0x2132('0x93')](_0x6d8989)){this[_0x2132('0xaa')][_0x2132('0xab')](function(){if(!_[_0x2132('0xac')](_0x49f658[_0x6d8989])){return ami[_0x2132('0xad')]({'action':'status','channel':_0x49f658[_0x6d8989][_0x2132('0xae')]})[_0x2132('0xaf')](function(_0x4f4a18){if(_0x4f4a18['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x49f658[_0x6d8989]&&_0x49f658[_0x6d8989][_0x2132('0x4c')]!==_0x2132('0x7b')){_0x2afdec[_0x2132('0xb0')](_0x2afdec['voiceQueues'][_0x49f658[_0x6d8989][_0x2132('0xb1')]]);logger['error']('[Dialer][checkChannel]',_0x2489ab,_0x6d8989,_0x49f658[_0x6d8989][_0x2132('0xb1')]);delete _0x49f658[_0x6d8989];}if(_0x49f658[_0x6d8989]&&_0x49f658[_0x6d8989]['type']===_0x2132('0x7b')){_0x2afdec[_0x2132('0xb0')](_0x2afdec[_0x2132('0x21')][_0x49f658[_0x6d8989][_0x2132('0xb1')]]);logger[_0x2132('0x90')](_0x2132('0xb2'),_0x2489ab,_0x6d8989,_0x49f658[_0x6d8989][_0x2132('0xb1')]);delete _0x49f658[_0x6d8989];}},0x2328);}});}});}}};Dialer[_0x2132('0x1c')][_0x2132('0xb3')]=function(_0x32b3d7){return BPromise['resolve']()['then'](cmHopper[_0x2132('0xb3')](_0x32b3d7))[_0x2132('0xaf')](loggerCatch(_0x2132('0xb4')));};Dialer[_0x2132('0x1c')][_0x2132('0xb5')]=function(_0x4eaf9c){return BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](cmHopperBlack['checkIsBlackList'](_0x4eaf9c))[_0x2132('0xaf')](loggerCatch(_0x2132('0xb8')));};Dialer[_0x2132('0x1c')][_0x2132('0xb9')]=function(_0x2462a4){return BPromise[_0x2132('0xb6')]()['then'](cmHopperBlack[_0x2132('0xb9')](_0x2462a4))[_0x2132('0xaf')](loggerCatch(_0x2132('0xba')));};Dialer[_0x2132('0x1c')]['averageHandleTime']=function(_0x5cdc6f){return BPromise['resolve']()[_0x2132('0xb7')](cmHopperHistory[_0x2132('0xbb')](_0x5cdc6f))[_0x2132('0xaf')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x2132('0x1c')][_0x2132('0xbc')]=function(_0x17b261){return BPromise[_0x2132('0xb6')]()['then'](cmHopper[_0x2132('0xbc')](_0x17b261))[_0x2132('0xaf')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x2132('0x1c')][_0x2132('0xbd')]=function(_0x2b9599,_0x39eb34,_0x24034b){return BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](cmHopper[_0x2132('0xbd')](_0x2b9599,_0x39eb34,_0x24034b))[_0x2132('0xaf')](loggerCatch(_0x2132('0xbe')));};Dialer[_0x2132('0x1c')][_0x2132('0xbf')]=function(_0x497cee,_0x157704,_0x392064,_0xf8b373){return BPromise[_0x2132('0xb6')]()['then'](cmHopper['getContactDialer'](_0x497cee,_0x157704,_0x392064,_0xf8b373))[_0x2132('0xaf')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x2132('0x1c')]['getContactDialerIvr']=function(_0x7c4961,_0x16e1d6,_0x13355f){return BPromise[_0x2132('0xb6')]()['then'](cmHopper[_0x2132('0xc0')](_0x7c4961,_0x16e1d6,_0x13355f))[_0x2132('0xaf')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x13d16b){return BPromise[_0x2132('0xb6')]()['then'](voiceQueueRt[_0x2132('0xc1')](_0x13d16b))[_0x2132('0xaf')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x2132('0x1c')][_0x2132('0xc2')]=function(_0xbe8c0a){return BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](cmHopper[_0x2132('0xc2')](_0xbe8c0a))[_0x2132('0xaf')](loggerCatch(_0x2132('0xc3')));};Dialer['prototype'][_0x2132('0xc4')]=function(_0x290811){return BPromise['resolve']()[_0x2132('0xb7')](cmHopperHistory[_0x2132('0xc4')](_0x290811))[_0x2132('0xaf')](loggerCatch(_0x2132('0xc5')));};Dialer[_0x2132('0x1c')][_0x2132('0xb0')]=function(_0x29ddc0){if(!_[_0x2132('0x3b')](_0x29ddc0)&&_0x29ddc0!==null){if(_0x29ddc0['hasOwnProperty'](_0x2132('0x72'))){if(_0x29ddc0['originated']>0x0){_0x29ddc0[_0x2132('0x72')]-=0x1;}else{logger[_0x2132('0x90')](_0x2132('0xc6'));}}}else{logger[_0x2132('0x90')](_0x2132('0xc7'));}};Dialer[_0x2132('0x1c')]['loggerHandler']=function(_0x291e68,_0x2cfb92){var _0x1c267a=this;return function(_0x148a24){_0x1c267a[_0x2132('0xb0')](_0x2cfb92);logger[_0x2132('0x90')](_0x291e68,util[_0x2132('0x8f')](_0x148a24,{'showHidden':![],'depth':null}));};};Dialer[_0x2132('0x1c')][_0x2132('0xc8')]=function(_0x5b55f6,_0x5789d2,_0x36925c){var _0x1592f2={'state':0x19,'statedesc':_0x2132('0xc9')};this[_0x2132('0xb0')](_0x5789d2);this['saveInDb'](_[_0x2132('0x87')](_0x1592f2,_[_0x2132('0xca')](_0x36925c,[_0x2132('0xcb'),_0x2132('0xcc'),_0x2132('0xcd'),_0x2132('0xce'),'CampaignId'])),_0x2132('0xcf'),_0x2132('0xd0'));logger['error'](_0x5b55f6);};Dialer[_0x2132('0x1c')][_0x2132('0xd1')]=function(_0x1ee1ee){return _0x1ee1ee===_0x2132('0xd2');};Dialer['prototype'][_0x2132('0xd3')]=function(_0x2e5bf5){return!_['isUndefined'](_0x2e5bf5)&&_0x2e5bf5&&!_[_0x2132('0x3b')](_0x2e5bf5[_0x2132('0x3e')])&&!_[_0x2132('0x3b')](_0x2e5bf5[_0x2132('0xd4')])&&_0x2e5bf5[_0x2132('0xd4')]&&(this[_0x2132('0x23')][util[_0x2132('0x7c')](_0x2132('0xd5'),_0x2e5bf5['name'])][_0x2132('0xd6')]===_0x2132('0xd7')||this[_0x2132('0x23')][util[_0x2132('0x7c')](_0x2132('0xd5'),_0x2e5bf5[_0x2132('0x3e')])][_0x2132('0xd6')]==='unmonitored');};Dialer[_0x2132('0x1c')][_0x2132('0xd8')]=function(_0x3ed506,_0x209b76,_0x4f8656){this[_0x2132('0xc4')](_0x3ed506)[_0x2132('0xaf')](loggerCatch(_0x209b76));this[_0x2132('0xc2')](_0x3ed506)[_0x2132('0xaf')](loggerCatch(_0x4f8656));};Dialer[_0x2132('0x1c')][_0x2132('0x37')]=function(_0x38ae77){var _0x256f59=this[_0x2132('0x26')][_0x38ae77[_0x2132('0xd9')]];var _0x255ce3;if(!_['isNil'](_0x38ae77)&&!_[_0x2132('0xac')](_0x38ae77[_0x2132('0xda')])&&!_['isNil'](_0x38ae77[_0x2132('0xda')][_0x2132('0xdb')])&&_0x38ae77[_0x2132('0xdc')]===_0x2132('0xdd')&&_0x256f59){if(_0x256f59[_0x2132('0x4c')]!==_0x2132('0x7b')&&this[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]][_0x2132('0xde')]&&_0x38ae77[_0x2132('0xdf')]==='HANGUP'){delete this['uniqueId'][_0x38ae77[_0x2132('0xd9')]];this[_0x2132('0xb0')](this['voiceQueues'][_0x256f59['queue']]);this['voiceQueues'][_0x256f59[_0x2132('0xb1')]]['outboundAnswerCallsDay']+=0x1;this[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]][_0x2132('0xe0')]+=0x1;_0x255ce3=new Hangup(_0x256f59,_0x38ae77);_0x255ce3['state']=0x12;_0x255ce3['statedesc']=_0x2132('0xe1');_0x255ce3[_0x2132('0xe2')]=_0x2132('0xe3');this[_0x2132('0xd8')](_0x255ce3,_0x2132('0xe4'),_0x2132('0xe5'));}if(_0x256f59[_0x2132('0x4c')]!=='ivr'&&this[_0x2132('0x20')][_0x256f59['queue']][_0x2132('0xde')]&&_0x38ae77[_0x2132('0xdf')]===_0x2132('0xe6')){var _0x15d3c1=this;return new BPromise(function(_0x447876,_0xdd2d68){delete _0x15d3c1[_0x2132('0x26')][_0x38ae77['uniqueid']];_0x15d3c1['updateOriginated'](_0x15d3c1['voiceQueues'][_0x256f59[_0x2132('0xb1')]]);_0x15d3c1[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x15d3c1[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]][_0x2132('0xe0')]+=0x1;var _0x592fb0=_0x15d3c1[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]];var _0x38227e=new Hangup(_0x256f59,_0x38ae77);_0x38227e[_0x2132('0xa1')]=0x13;_0x38227e['statedesc']='Machine';_0x38227e[_0x2132('0xe2')]=_0x2132('0xe3');_0x38227e[_0x2132('0xe7')]+=0x1;_0x38227e[_0x2132('0xe8')]+=0x1;_0x38227e[_0x2132('0xe9')]=!![];_0x15d3c1['createHistory'](_0x38227e)[_0x2132('0xaf')](loggerCatch(_0x2132('0xea')));if(_0x38227e[_0x2132('0xeb')]+_0x38227e[_0x2132('0xec')]+_0x38227e['countnoanswerretry']+_0x38227e[_0x2132('0xed')]+_0x38227e[_0x2132('0xee')]+_0x38227e[_0x2132('0xef')]+_0x38227e[_0x2132('0xe7')]+_0x38227e[_0x2132('0xf0')]>=_0x592fb0[_0x2132('0xf1')]){_0x15d3c1[_0x2132('0xf2')](_0x38227e,_0x447876,_0xdd2d68,_0x2132('0xf3'));}else{if(_0x38227e[_0x2132('0xe7')]>=_0x592fb0[_0x2132('0xf4')]){_0x15d3c1[_0x2132('0xf5')](_0x38227e,_0x447876,_0xdd2d68,'reason\x2019\x20machine....');}else{_0x15d3c1[_0x2132('0xbc')]({'active':![],'countmachineretry':_0x38227e[_0x2132('0xe7')],'scheduledat':moment()[_0x2132('0xf6')](_0x592fb0[_0x2132('0xf7')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x38227e['ContactId'],'ListId':_0x38227e[_0x2132('0xcc')],'VoiceQueueId':_0x38227e[_0x2132('0xce')]||undefined,'CampaignId':_0x38227e['CampaignId']||undefined})[_0x2132('0xaf')](loggerCatch('[rescheduleContact][Machine]'));_0x447876({'reschedule':0x1});}}});}if(_0x256f59[_0x2132('0x4c')]===_0x2132('0x7b')&&this[_0x2132('0x21')][_0x256f59['queue']][_0x2132('0xde')]&&_0x38ae77[_0x2132('0xdf')]==='HANGUP'){delete this[_0x2132('0x26')][_0x38ae77[_0x2132('0xd9')]];this[_0x2132('0xb0')](this[_0x2132('0x21')][_0x256f59[_0x2132('0xb1')]]);_0x255ce3=new Hangup(_0x256f59,_0x38ae77);_0x255ce3['state']=0x12;_0x255ce3[_0x2132('0xa2')]=_0x2132('0xe1');_0x255ce3[_0x2132('0xe2')]=_0x2132('0xe3');this[_0x2132('0xd8')](_0x255ce3,_0x2132('0xfa'),_0x2132('0xfb'));}if(_0x256f59[_0x2132('0x4c')]===_0x2132('0x7b')&&this[_0x2132('0x21')][_0x256f59['queue']][_0x2132('0xde')]&&_0x38ae77[_0x2132('0xdf')]===_0x2132('0xe6')){var _0x15d3c1=this;return new BPromise(function(_0xf599e1,_0x40e5fb){delete _0x15d3c1[_0x2132('0x26')][_0x38ae77[_0x2132('0xd9')]];_0x15d3c1[_0x2132('0xb0')](_0x15d3c1[_0x2132('0x21')][_0x256f59[_0x2132('0xb1')]]);_0x15d3c1[_0x2132('0x21')][_0x256f59['queue']][_0x2132('0xfc')]+=0x1;_0x15d3c1[_0x2132('0x21')][_0x256f59[_0x2132('0xb1')]][_0x2132('0xe0')]+=0x1;var _0x5cbb1d=_0x15d3c1[_0x2132('0x21')][_0x256f59['queue']];var _0x235ba1=new Hangup(_0x256f59,_0x38ae77);_0x235ba1[_0x2132('0xa1')]=0x13;_0x235ba1[_0x2132('0xa2')]='Machine';_0x235ba1[_0x2132('0xe2')]=_0x2132('0xe3');_0x235ba1['countmachineretry']+=0x1;_0x235ba1[_0x2132('0xe8')]+=0x1;_0x235ba1[_0x2132('0xe9')]=!![];_0x15d3c1[_0x2132('0xc4')](_0x235ba1)[_0x2132('0xaf')](loggerCatch(_0x2132('0xea')));if(_0x235ba1[_0x2132('0xeb')]+_0x235ba1[_0x2132('0xec')]+_0x235ba1[_0x2132('0xfd')]+_0x235ba1[_0x2132('0xed')]+_0x235ba1[_0x2132('0xee')]+_0x235ba1[_0x2132('0xef')]+_0x235ba1[_0x2132('0xe7')]+_0x235ba1[_0x2132('0xf0')]>=_0x5cbb1d[_0x2132('0xf1')]){_0x15d3c1[_0x2132('0xf2')](_0x235ba1,_0xf599e1,_0x40e5fb,_0x2132('0xf3'));}else{if(_0x235ba1[_0x2132('0xe7')]>=_0x5cbb1d['dialMachineMaxRetry']){_0x15d3c1['createStateFinal'](_0x235ba1,_0xf599e1,_0x40e5fb,_0x2132('0xfe'));}else{_0x15d3c1['rescheduleContact']({'active':![],'countmachineretry':_0x235ba1['countmachineretry'],'scheduledat':moment()[_0x2132('0xf6')](_0x5cbb1d[_0x2132('0xf7')],_0x2132('0xf8'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x235ba1[_0x2132('0xcb')],'ListId':_0x235ba1[_0x2132('0xcc')],'VoiceQueueId':_0x235ba1[_0x2132('0xce')]||undefined,'CampaignId':_0x235ba1['CampaignId']||undefined})[_0x2132('0xaf')](loggerCatch('[rescheduleContact][Machine]'));_0xf599e1({'reschedule':0x1});}}});}}};Dialer[_0x2132('0x1c')][_0x2132('0xff')]=function(_0x33e9df){var _0xc4d798=this[_0x2132('0x26')][_0x33e9df[_0x2132('0xd9')]];var _0x5cfc96=this;var _0x1a73b4;if(_0xc4d798&&_0xc4d798['type']===_0x2132('0x7b')){delete this['uniqueId'][_0x33e9df[_0x2132('0xd9')]];this['updateOriginated'](this[_0x2132('0x21')][_0xc4d798['queue']]);this[_0x2132('0x21')][_0xc4d798['queue']]['ivrAnswerCallsDay']+=0x1;_0x1a73b4=new Hangup(_0xc4d798,_0x33e9df);this[_0x2132('0xc4')](_0x1a73b4)[_0x2132('0xaf')](loggerCatch(_0x2132('0x100')));this[_0x2132('0xc2')](_0x1a73b4)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xc4d798&&_0xc4d798['type']!==_0x2132('0x7b')&&isNotNull(this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]][_0x2132('0x101')])){delete this[_0x2132('0x26')][_0x33e9df[_0x2132('0xd9')]];this['updateOriginated'](this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]]);this['voiceQueues'][_0xc4d798[_0x2132('0xb1')]][_0x2132('0xfc')]+=0x1;this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]][_0x2132('0xe0')]+=0x1;_0x1a73b4=new Hangup(_0xc4d798,_0x33e9df);_0x1a73b4[_0x2132('0xa1')]=0x10;_0x1a73b4[_0x2132('0xa2')]=_0x2132('0x102');_0x1a73b4['membername']=_0x2132('0x103');this[_0x2132('0xc4')](_0x1a73b4)['catch'](loggerCatch(_0x2132('0x100')));this[_0x2132('0xc2')](_0x1a73b4)[_0x2132('0xaf')](loggerCatch(_0x2132('0x104')));}if(_0xc4d798&&_0xc4d798[_0x2132('0x4c')]!==_0x2132('0x7b')&&!isNotNull(this[_0x2132('0x20')][_0xc4d798['queue']]['dialQueueProject'])){delete this[_0x2132('0x26')][_0x33e9df[_0x2132('0xd9')]];this[_0x2132('0xb0')](this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]]);this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]]['outboundUnknownCallsDay']+=0x1;_0x1a73b4=new Hangup(_0xc4d798,_0x33e9df);_0x1a73b4[_0x2132('0xa1')]=0xc;_0x1a73b4['statedesc']=_0x33e9df[_0x2132('0x105')];_0x1a73b4[_0x2132('0xe2')]=_0x2132('0x106');this['createHistory'](_0x1a73b4)['catch'](loggerCatch(_0x2132('0x100')));this['moveContactManagedDialer'](_0x1a73b4)['catch'](loggerCatch(_0x2132('0x104')));}};Dialer[_0x2132('0x1c')][_0x2132('0x33')]=function(_0x1882f8){var _0x191eb1=this['uniqueId'][_0x1882f8[_0x2132('0xd9')]];var _0x177842=this;if(this[_0x2132('0x20')][_0x1882f8['queue']]){if(_0x191eb1&&_0x191eb1[_0x2132('0x4c')]!==_0x2132('0x7b')){delete this['uniqueId'][_0x1882f8[_0x2132('0xd9')]];this[_0x2132('0x20')][_0x1882f8[_0x2132('0xb1')]][_0x2132('0xfc')]+=0x1;var _0x5f2cad=new AgentComplete(_0x191eb1,_0x1882f8);if(_0x1882f8[_0x2132('0x107')]==='agent'){_0x5f2cad[_0x2132('0x108')]=this[_0x2132('0x20')][_0x1882f8[_0x2132('0xb1')]][_0x2132('0x109')]&&this[_0x2132('0x20')][_0x1882f8[_0x2132('0xb1')]][_0x2132('0x10a')]?moment()[_0x2132('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x2132('0xc4')](_0x5f2cad)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x2132('0xc2')](_0x5f2cad)[_0x2132('0xaf')](loggerCatch(_0x2132('0x10b')));}}};Dialer[_0x2132('0x1c')][_0x2132('0x10c')]=function(_0x3f5a51){if(this[_0x2132('0x20')][_0x3f5a51[_0x2132('0xb1')]]){if(this[_0x2132('0x26')][_0x3f5a51[_0x2132('0xd9')]]&&this[_0x2132('0x26')][_0x3f5a51[_0x2132('0xd9')]][_0x2132('0x4c')]!==_0x2132('0x7b')){this['updateOriginated'](this[_0x2132('0x20')][_0x3f5a51[_0x2132('0xb1')]]);this[_0x2132('0x26')][_0x3f5a51[_0x2132('0xd9')]][_0x2132('0x10d')]=moment()[_0x2132('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x2132('0x1c')][_0x2132('0x10e')]=function(_0x1be001){this[_0x2132('0xc4')](_0x1be001)[_0x2132('0xaf')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x1be001)['catch'](loggerCatch(_0x2132('0x10f')));};Dialer['prototype'][_0x2132('0x2f')]=function(_0x13270c){var _0x2b6381=this[_0x2132('0x26')][_0x13270c[_0x2132('0xd9')]];var _0x3dcfc1=this;if(this[_0x2132('0x20')][_0x13270c[_0x2132('0xb1')]]){if(_0x2b6381&&_0x2b6381['type']!==_0x2132('0x7b')){delete this['uniqueId'][_0x13270c[_0x2132('0xd9')]];this[_0x2132('0xb0')](this[_0x2132('0x20')][_0x13270c['queue']]);_0x2b6381[_0x2132('0x110')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4ed68c=new QueueCallerAbandon(_0x2b6381,_0x13270c);if(getSeconds(_0x2b6381[_0x2132('0x110')],_0x2b6381[_0x2132('0x111')])>=_0x2b6381[_0x2132('0x112')]){this[_0x2132('0x20')][_0x13270c[_0x2132('0xb1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2132('0x20')][_0x13270c[_0x2132('0xb1')]][_0x2132('0x60')]+=0x1;this['voiceQueues'][_0x13270c[_0x2132('0xb1')]][_0x2132('0x6c')]+=0x1;_0x4ed68c[_0x2132('0xa1')]=0xa;_0x4ed68c[_0x2132('0xa2')]=_0x2132('0x113');_0x4ed68c[_0x2132('0x114')]=_0x2132('0x115');_0x4ed68c[_0x2132('0x108')]=this[_0x2132('0x20')][_0x13270c[_0x2132('0xb1')]][_0x2132('0x109')]?moment()[_0x2132('0x7c')](_0x2132('0xf9')):undefined;_0x4ed68c['countdropretry']+=0x1;_0x4ed68c[_0x2132('0xe8')]+=0x1;if(_0x4ed68c[_0x2132('0xee')]>=this[_0x2132('0x20')][_0x13270c['queue']][_0x2132('0x116')]){this[_0x2132('0x10e')](_0x4ed68c);}else{this[_0x2132('0xbc')]({'active':![],'countdropretry':_0x4ed68c[_0x2132('0xee')],'scheduledat':moment()[_0x2132('0xf6')](this['voiceQueues'][_0x13270c[_0x2132('0xb1')]][_0x2132('0x117')],'minutes')[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x2b6381[_0x2132('0xcb')],'ListId':_0x2b6381[_0x2132('0xcc')],'VoiceQueueId':_0x2b6381['VoiceQueueId']||undefined,'CampaignId':_0x2b6381['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x3dbfdb=new History(_0x4ed68c);_0x3dbfdb['state']=0xa;_0x3dbfdb[_0x2132('0xa2')]='Drop';_0x3dbfdb[_0x2132('0xa4')]=moment()[_0x2132('0x7c')](_0x2132('0xf9'));_0x3dbfdb[_0x2132('0xa3')]=_0x3dbfdb[_0x2132('0xa4')];_0x3dbfdb[_0x2132('0x118')]=_0x4ed68c[_0x2132('0x118')];_0x3dbfdb[_0x2132('0x119')]=_0x4ed68c[_0x2132('0x119')];this[_0x2132('0xc4')](_0x3dbfdb)[_0x2132('0xaf')](loggerCatch(_0x2132('0x11a')));}}else{this['voiceQueues'][_0x13270c[_0x2132('0xb1')]][_0x2132('0x69')]+=0x1;this['voiceQueues'][_0x13270c[_0x2132('0xb1')]][_0x2132('0x5f')]+=0x1;_0x4ed68c['state']=0xb;_0x4ed68c[_0x2132('0xa2')]=_0x2132('0x11b');_0x4ed68c[_0x2132('0x114')]=_0x2132('0x11c');_0x4ed68c['countabandonedretry']+=0x1;_0x4ed68c[_0x2132('0xe8')]+=0x1;if(_0x4ed68c[_0x2132('0xef')]>=this[_0x2132('0x20')][_0x13270c['queue']][_0x2132('0x11d')]){this[_0x2132('0x10e')](_0x4ed68c);}else{this[_0x2132('0xbc')]({'active':![],'countabandonedretry':_0x4ed68c[_0x2132('0xef')],'scheduledat':moment()['add'](this[_0x2132('0x20')][_0x13270c['queue']]['dialAbandonedRetryFrequency'],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x2b6381['ContactId'],'ListId':_0x2b6381[_0x2132('0xcc')],'VoiceQueueId':_0x2b6381['VoiceQueueId']||undefined,'CampaignId':_0x2b6381[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x11f')));var _0x3dbfdb=new History(_0x4ed68c);_0x3dbfdb[_0x2132('0xa1')]=0xb;_0x3dbfdb[_0x2132('0xa2')]='Abandoned';_0x3dbfdb['starttime']=moment()['format'](_0x2132('0xf9'));_0x3dbfdb['endtime']=_0x3dbfdb[_0x2132('0xa4')];_0x3dbfdb[_0x2132('0x118')]=_0x4ed68c['calleridname'];_0x3dbfdb[_0x2132('0x119')]=_0x4ed68c[_0x2132('0x119')];this[_0x2132('0xc4')](_0x3dbfdb)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x2132('0x1c')][_0x2132('0x120')]=function(_0x3b8ef2){if(this['actions'][_0x3b8ef2[_0x2132('0xd9')]]){this[_0x2132('0xa8')][_0x3b8ef2['uniqueid']][_0x2132('0xae')]=_0x3b8ef2[_0x2132('0xae')];}if(this['uniqueId'][_0x3b8ef2[_0x2132('0xd9')]]){this[_0x2132('0x26')][_0x3b8ef2[_0x2132('0xd9')]][_0x2132('0xae')]=_0x3b8ef2[_0x2132('0xae')];}};Dialer[_0x2132('0x1c')][_0x2132('0x38')]=function(_0x4d385d){if(strategy[this['voiceQueues'][this['actions'][_0x4d385d[_0x2132('0x121')]]['queue']][_0x2132('0x4d')]]===_0x2132('0x1b')){if(this['actions'][_0x4d385d[_0x2132('0x121')]]&&_[_0x2132('0xac')](this['actions'][_0x4d385d['actionid']][_0x2132('0x122')])&&_0x4d385d[_0x2132('0xd6')]==='1'&&_0x4d385d[_0x2132('0x123')]==='0'){if(this['agents'][_0x4d385d['stateinterface']]){if(!this[_0x2132('0x22')][_0x4d385d['stateinterface']][_0x2132('0x122')]){this[_0x2132('0x22')][_0x4d385d[_0x2132('0x124')]]['locked']=!![];this[_0x2132('0xa8')][_0x4d385d[_0x2132('0x121')]]['locked']=!![];this['actions'][_0x4d385d[_0x2132('0x121')]][_0x2132('0x124')]=_0x4d385d[_0x2132('0x124')];}}}}else if((strategy[this[_0x2132('0x20')][this['actions'][_0x4d385d[_0x2132('0x121')]][_0x2132('0xb1')]][_0x2132('0x4d')]]||'rrmemory')===_0x2132('0x1a')){if(this['actions'][_0x4d385d[_0x2132('0x121')]]){if(this[_0x2132('0x22')][_0x4d385d[_0x2132('0x124')]]){this['actions'][_0x4d385d[_0x2132('0x121')]][_0x2132('0x124')]=_0x4d385d[_0x2132('0x124')];if(_['isNil'](this['queueBooked'][this['actions'][_0x4d385d[_0x2132('0x121')]][_0x2132('0xb1')]])){this[_0x2132('0x2b')][this[_0x2132('0xa8')][_0x4d385d['actionid']]['queue']]=[];}this[_0x2132('0x2b')][this[_0x2132('0xa8')][_0x4d385d['actionid']][_0x2132('0xb1')]][_0x2132('0x125')](_[_0x2132('0x87')](_[_0x2132('0xca')](this[_0x2132('0xa8')][_0x4d385d[_0x2132('0x121')]],['idHopper',_0x2132('0x124')]),{'status':_0x4d385d[_0x2132('0xd6')],'paused':_0x4d385d[_0x2132('0x123')]}));}}}};function unlockQueueStatus(_0x250d72,_0x5cb00d){setTimeout(function(){if(_[_0x2132('0x3b')](_0x250d72['queueStatusComplete'])){loggerBooked[_0x2132('0x90')]('[unlockQueueStatus][undefined]',_0x5cb00d);}_0x250d72[_0x2132('0x126')]=!![];loggerBooked[_0x2132('0x7e')](_0x2132('0x127'),_0x5cb00d,JSON[_0x2132('0x48')](_[_0x2132('0xca')](_0x250d72,['name',_0x2132('0x126')])));},0x1f3);}Dialer[_0x2132('0x1c')][_0x2132('0x3a')]=function(_0x2485c1){var _0x3b816d=this;var _0x22ae72=_0x3b816d[_0x2132('0x20')][_0x3b816d[_0x2132('0xa8')][_0x2485c1['actionid']][_0x2132('0xb1')]];if(strategy[this[_0x2132('0x20')][this['actions'][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]][_0x2132('0x4d')]]===_0x2132('0x1b')){if(this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]&&this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0x124')]){this['preview'][_0x2132('0x128')](this['actions'][_0x2485c1[_0x2132('0x121')]][_0x2132('0x129')],this[_0x2132('0xa8')][_0x2485c1['actionid']][_0x2132('0x124')])['catch'](function(_0x39eb48){logger[_0x2132('0x90')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x39eb48,{'showHidden':![],'depth':null}));})[_0x2132('0x1e')](function(){_0x3b816d[_0x2132('0xb0')](_0x3b816d[_0x2132('0x20')][_0x3b816d[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]['queue']]);_0x3b816d['agents'][_0x3b816d[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0x124')]][_0x2132('0x122')]=![];delete _0x3b816d[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]];unlockQueueStatus(_0x22ae72);});}else{this[_0x2132('0xb0')](this[_0x2132('0x20')][this['actions'][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]]);this[_0x2132('0xbc')]({'active':![],'ContactId':this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xcb')],'ListId':this['actions'][_0x2485c1[_0x2132('0x121')]]['ListId'],'VoiceQueueId':this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xce')]||undefined,'CampaignId':this['actions'][_0x2485c1['actionid']][_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x12a')));delete this[_0x2132('0xa8')][_0x2485c1['actionid']];unlockQueueStatus(_0x22ae72);}}else if((strategy[this['voiceQueues'][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]]['strategy']]||_0x2132('0x1a'))==='rrmemory'){var _0x31b848;if(this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]&&!_['isEmpty'](this[_0x2132('0x2b')][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]])){if(this[_0x2132('0x2c')][_0x3b816d[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]['queue']]){this['queueBookedRR'][_0x3b816d[_0x2132('0xa8')][_0x2485c1['actionid']][_0x2132('0xb1')]]=this['queueBookedRR'][this['actions'][_0x2485c1[_0x2132('0x121')]]['queue']]?this[_0x2132('0x2c')][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]['queue']]:this[_0x2132('0x2b')][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]]?this[_0x2132('0x2b')][this['actions'][_0x2485c1['actionid']]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]][_0x2132('0x12b')]=this[_0x2132('0x2c')][this['actions'][_0x2485c1['actionid']][_0x2132('0xb1')]];for(var _0x33d77c=0x0;_0x33d77c=0x0?!![]:![];})[_0x2132('0xaf')](myreject(_0x2978bd)));}}else{_0x2a66d3['push'](ami[_0x2132('0xad')]({'action':'command','command':util[_0x2132('0x7c')](_0x2132('0x141'),_0x188d3b,!_['isUndefined'](config[_0x2132('0x145')][_0x46f034])?_0x46f034:'')})[_0x2132('0xb7')](function(_0x2c89f2){return _0x2c89f2[_0x2132('0x146')]['indexOf'](_0x2132('0x144'))>=0x0?!![]:![];})[_0x2132('0xaf')](myreject(_0x2978bd)));}BPromise[_0x2132('0x147')](_0x2a66d3)['then'](function(_0x479589){var _0x39e1a5=_[_0x2132('0x148')](_0x479589);if(_0x39e1a5){return _0x1a0cdf(_0x39e1a5);}else{_0x3192aa[_0x2132('0x3c')]=_0x3033a5?_0x2132('0x149'):'INTERVAL_IS_OVERTIME';return _0x2978bd(msgResponse(_0x2132('0x14a'),_0x2132('0x14b'),_0x2132('0x14c')+_0x3033a5+'\x20'+_0x36c33c+_0x2132('0x14d')+util['inspect'](_0x188d3b,{'showHidden':![],'depth':null})+_0x2132('0x14e')+_0x46f034));}})[_0x2132('0xaf')](function(_0x9c82cc){return _0x2978bd(msgResponse(_0x2132('0x13c'),_0x2132('0x14b'),JSON['stringify'](_0x9c82cc)));});});};Dialer[_0x2132('0x1c')][_0x2132('0x14f')]=function(_0x3be92d){var _0x19c5a3=this;return function(){switch(_0x3be92d['dialMethod']){case _0x2132('0x150'):freeVariablesPredictive(_0x3be92d);_0x19c5a3[_0x2132('0x151')](_0x3be92d,0x1);break;case _0x2132('0x152'):freeVariablesPredictive(_0x3be92d);_0x19c5a3[_0x2132('0x151')](_0x3be92d,_0x3be92d['dialPowerLevel']);break;case _0x2132('0x8'):_0x19c5a3['predictive'](_0x3be92d);break;case _0x2132('0x153'):freeVariablesPredictive(_0x3be92d);_0x19c5a3[_0x2132('0x151')](_0x3be92d,0x1);break;default:freeVariablesPredictive(_0x3be92d);logger['error'](_0x2132('0x154'),_0x3be92d[_0x2132('0x3e')],_0x2132('0x155'));}};};Dialer[_0x2132('0x1c')][_0x2132('0x156')]=function(_0x55b34){var _0x2c1e48=this;return function(){_0x2c1e48[_0x2132('0x157')](_0x55b34);};};Dialer['prototype'][_0x2132('0x9')]=function(_0x2b3166){var _0x461071=this;if(isNotPreview(_0x2b3166[_0x2132('0x57')])){if(isVoiceQueueOutbound(_0x2b3166[_0x2132('0x4c')])&&isActive(_0x2b3166[_0x2132('0x56')])){_0x2b3166[_0x2132('0x9a')]=!![];BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](checkIsLoggedIn(_0x2b3166,_0x2b3166[_0x2132('0x4e')]))[_0x2132('0xb7')](checkIsActive(_0x2b3166,_0x2b3166[_0x2132('0x56')]))[_0x2132('0xb7')](checkInterval(_0x2b3166))[_0x2132('0xb7')](_0x461071[_0x2132('0x138')](_0x2b3166))[_0x2132('0xb7')](_0x461071[_0x2132('0x13b')](_0x2b3166[_0x2132('0x158')],_0x2b3166[_0x2132('0x159')],_0x2b3166[_0x2132('0x3e')],_0x2b3166))[_0x2132('0xb7')](_0x461071['checkIfTimeIntervals'](_0x2b3166[_0x2132('0x41')],_0x2b3166[_0x2132('0x159')],_0x2b3166[_0x2132('0x3e')],_0x2b3166))[_0x2132('0xb7')](_0x461071[_0x2132('0x14f')](_0x2b3166))[_0x2132('0xaf')](loggerCatchQueueSummary(_0x2132('0x15a'),_0x2b3166));}else{notSendMessagesQueue(_0x2b3166);}}else{freeVariablesPredictive(_0x2b3166);}};Dialer[_0x2132('0x1c')][_0x2132('0x137')]=function(){var _0x44e175=this;var _0x593200;for(var _0x3a22a in this[_0x2132('0x21')]){if(this[_0x2132('0x21')]['hasOwnProperty'](_0x3a22a)){_0x593200=this[_0x2132('0x21')][_0x3a22a];if(isCampaignIvr(_0x593200[_0x2132('0x4c')])&&isActive(_0x593200[_0x2132('0xd4')])){_0x593200['sendMessageOneNotActive']=!![];BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](checkIsActive(_0x593200,_0x593200[_0x2132('0xd4')]))['then'](checkInterval(_0x593200))[_0x2132('0xb7')](_0x44e175['checkIsTrunkReachable'](_0x593200))['then'](_0x44e175[_0x2132('0x13b')](_0x593200['dialGlobalInterval'],_0x593200['dialTimezone'],_0x593200[_0x2132('0x3e')],_0x593200))['then'](_0x44e175[_0x2132('0x15b')](_0x593200['Interval'],_0x593200[_0x2132('0x159')],_0x593200[_0x2132('0x3e')],_0x593200))[_0x2132('0xb7')](_0x44e175[_0x2132('0x156')](_0x593200))['catch'](loggerCatchQueueSummary(_0x2132('0x15c'),_0x593200));}else{notSendMessagesCampaign(_0x593200);}}}};function getCallerIdRandom(_0x3bdf39,_0x5e1ee2){var _0x633742,_0x49e10a,_0x2a3a1a;if(_0x5e1ee2<=0x0){_0x5e1ee2=0x1;}_0x633742=new RegExp('\x5cw{0,'+_0x5e1ee2+'}$');_0x49e10a=Math[_0x2132('0x15d')](0xa,_0x5e1ee2-0x1);_0x2a3a1a=Math[_0x2132('0x15d')](0xa,_0x5e1ee2)-0x1;return util['format']('%s',_[_0x2132('0x15e')](_0x3bdf39,_0x633742,_[_0x2132('0x15f')](_0x49e10a,_0x2a3a1a)));}function extractCalleridName(_0x2d144d){var _0x4d0856=_0x2d144d[_0x2132('0x160')](/"(.*?)"/);return _0x4d0856?_0x4d0856[0x1]:_0x2d144d;}function extractCalleridNumber(_0x4d3c89){var _0x5359f9=_0x4d3c89['match'](/<(.*?)>/);return _0x5359f9?_0x5359f9[0x1]:_0x4d3c89;}Dialer[_0x2132('0x1c')]['actionOriginate']=function(_0x54a510,_0x194b8b){var _0xa6a50e=this;var _0xe64cb1=uuid['v4']();this[_0x2132('0xa8')][_0xe64cb1]=new Action(_0x54a510,_0x194b8b,_0xe64cb1);return new BPromise(function(_0x5b04d8,_0x284744){if(_['isUndefined'](_0x54a510)&&_0x2132('0x161')!==typeof _0x54a510){return _0x284744(msgResponse('originate',_0x2132('0x14b'),_0x2132('0x162')));}if(_[_0x2132('0x3b')](_0x194b8b[_0x2132('0x163')][_0x2132('0x164')])||_0x194b8b[_0x2132('0x163')]['phone']===null){return _0x284744(msgResponse('originate',_0x2132('0x14b'),_0x2132('0x165')));}var _0x59de78={'XMD-CALLERID':_0xa6a50e[_0x2132('0xa8')][_0xe64cb1]['getCaller'](),'XMD-AGI':_0x54a510[_0x2132('0x101')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x54a510[_0x2132('0x101')]):_0x2132('0x166'),'XMD-AGIAFTER':_0x54a510[_0x2132('0x109')]?util[_0x2132('0x7c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x54a510[_0x2132('0x109')]):'NONE','XMD-QUEUE':_0x54a510['type']===_0x2132('0x8b')?util[_0x2132('0x7c')](_0x2132('0x167'),_0x54a510[_0x2132('0x3e')],_0x54a510[_0x2132('0x168')]||'',_0x54a510[_0x2132('0x10a')]?'c':'',_0x54a510[_0x2132('0x112')]||0x3):_0x2132('0x166'),'XMD-CONTACTID':_0x194b8b['ContactId'],'XMD-CDRTYPE':_0x2132('0x169'),'CALLERID(all)':_0xa6a50e[_0x2132('0xa8')][_0xe64cb1]['getCaller'](),'XMD-AMD':_0x54a510[_0x2132('0xde')]?_0x2132('0x16a'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x54a510[_0x2132('0xde')]){_0x59de78['XMD-AMDINITIALSILENCE']=_0x54a510[_0x2132('0x16b')]||0x9c4;_0x59de78['XMD-AMDGREETING']=_0x54a510[_0x2132('0x16c')]||0x5dc;_0x59de78['XMD-AMDAFTERGREETINGSILENCE']=_0x54a510[_0x2132('0x16d')]||0x320;_0x59de78['XMD-AMDTOTALANALYSISTIME']=_0x54a510[_0x2132('0x16e')]||0x1388;_0x59de78[_0x2132('0x16f')]=_0x54a510[_0x2132('0x170')]||0x64;_0x59de78[_0x2132('0x171')]=_0x54a510[_0x2132('0x172')]||0x32;_0x59de78[_0x2132('0x173')]=_0x54a510[_0x2132('0x174')]||0x3;_0x59de78[_0x2132('0x175')]=_0x54a510[_0x2132('0x176')]||0x100;_0x59de78['XMD-AMDMAXIMUMWORDLENGTH']=_0x54a510[_0x2132('0x177')]||0x1388;}if(_0x54a510[_0x2132('0x4c')]===_0x2132('0x8b')){_0x59de78[_0x2132('0x178')]=_0x194b8b['VoiceQueueId'];}else{_0x59de78[_0x2132('0x179')]=_0x194b8b['CampaignId'];}for(var _0x4910f6 in _0x194b8b[_0x2132('0x163')]){if(_0x194b8b[_0x2132('0x163')][_0x2132('0x93')](_0x4910f6)){if(isNotNull(_0x194b8b[_0x2132('0x163')][_0x4910f6])&&_0x4910f6!=='id'&&_0x4910f6!==_0x2132('0x17a')&&_0x4910f6!==_0x2132('0x17b')&&_0x4910f6!==_0x2132('0x17c')){_0x59de78[util['format']('%s%s',_0x2132('0x17d'),_[_0x2132('0x17e')](_0x4910f6))]=_0x194b8b[_0x2132('0x163')][_0x4910f6];}}}var _0x188884=_0xa6a50e['isTrunkReachable'](_0x54a510['Trunk'])?getCallerId(_0x54a510[_0x2132('0x76')]['callerid'],_0x54a510['dialOriginateCallerIdName'],_0x54a510[_0x2132('0x17f')]>0x0?getCallerIdRandom(_0x54a510['dialOriginateCallerIdNumber'],_0x54a510[_0x2132('0x17f')]):_0x54a510[_0x2132('0x59')]):getCallerId(_['isNil'](_0x54a510[_0x2132('0x180')])?_0x54a510[_0x2132('0x76')][_0x2132('0x77')]:_0x54a510['TrunkBackup'][_0x2132('0x77')],_0x54a510[_0x2132('0x58')],_0x54a510['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x54a510['dialOriginateCallerIdNumber'],_0x54a510['dialRandomLastDigitCallerIdNumber']):_0x54a510['dialOriginateCallerIdNumber']);if(_0x188884){_0x59de78[_0x2132('0x181')]=_0xa6a50e[_0x2132('0xa8')][_0xe64cb1][_0x2132('0x182')]=extractCalleridName(_0x188884);_0x59de78[_0x2132('0x183')]=_0xa6a50e[_0x2132('0xa8')][_0xe64cb1][_0x2132('0x184')]=extractCalleridNumber(_0x188884);}return ami[_0x2132('0xad')]({'actionid':_0xe64cb1,'action':_0x2132('0x185'),'channel':_0xa6a50e[_0x2132('0xd3')](_0x54a510['Trunk'])?util[_0x2132('0x7c')](_0x2132('0x186'),_0x54a510[_0x2132('0x76')][_0x2132('0x3e')],isNotNull(_0x54a510[_0x2132('0x5b')])?_0x54a510['dialPrefix'][_0x2132('0x187')]()||'':'',_0x54a510[_0x2132('0x188')]>0x0?_0x194b8b[_0x2132('0x163')]['phone'][_0x2132('0x189')](_0x54a510[_0x2132('0x188')]):_0x194b8b['Contact'][_0x2132('0x164')]):util[_0x2132('0x7c')]('SIP/%s/%s%s',_[_0x2132('0xac')](_0x54a510['TrunkBackup'])?_0x54a510[_0x2132('0x76')][_0x2132('0x3e')]:_0x54a510['TrunkBackup']['name'],isNotNull(_0x54a510[_0x2132('0x5b')])?_0x54a510[_0x2132('0x5b')]['trim']()||'':'',_0x54a510[_0x2132('0x188')]>0x0?_0x194b8b[_0x2132('0x163')]['phone'][_0x2132('0x189')](_0x54a510[_0x2132('0x188')]):_0x194b8b[_0x2132('0x163')][_0x2132('0x164')]),'callerid':_0x188884,'Exten':_0x2132('0xdd'),'Context':_0x2132('0x18a'),'Priority':'1','variable':_0x59de78,'timeout':(_0x54a510[_0x2132('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0xe64cb1})[_0x2132('0xb7')](function(_0x5ea1fa){return _0x5b04d8(_0x5ea1fa);})[_0x2132('0xaf')](function(_0x2f3376){_0x54a510[_0x2132('0x63')]+=0x1;var _0xfaf91=new History(_0xa6a50e[_0x2132('0xa8')][_0xe64cb1]);logger[_0x2132('0x90')](util['format'](_0x2132('0x18b'),JSON[_0x2132('0x48')](_0x2f3376)));_0xfaf91['state']=0xe;_0xfaf91[_0x2132('0xa2')]=_0x2132('0x18c');_0xfaf91[_0x2132('0xa4')]=moment()['format'](_0x2132('0xf9'));_0xfaf91[_0x2132('0xa3')]=_0xfaf91[_0x2132('0xa4')];_0xa6a50e[_0x2132('0xc4')](_0xfaf91)[_0x2132('0xaf')](loggerCatch(_0x2132('0x18d')));_0xa6a50e['moveContactManagedDialer'](_0xfaf91)[_0x2132('0xaf')](loggerCatch(_0x2132('0x18d')))[_0x2132('0x1e')](function(){delete _0xa6a50e[_0x2132('0xa8')][_0xe64cb1];return _0x284744(msgResponse(_0x2132('0x185'),_0x2132('0x47'),_0x2132('0x18e')));});});});};Dialer[_0x2132('0x1c')][_0x2132('0x31')]=function(_0x3ed06d){var _0x3f8fd3=this[_0x2132('0xa8')][_0x3ed06d[_0x2132('0x121')]];var _0x59b5b7=this;if(_0x3f8fd3){delete this[_0x2132('0xa8')][_0x3ed06d['actionid']];_0x3f8fd3['responsetime']=moment()[_0x2132('0x7c')](_0x2132('0xf9'));var _0x336d09=_0x3f8fd3['type']==='ivr'?this[_0x2132('0x21')][_0x3f8fd3['queue']]:this['voiceQueues'][_0x3f8fd3['getQueue']()];if(!this['isSuccess'](_0x3ed06d[_0x2132('0x18f')])){this[_0x2132('0xb0')](_0x336d09);return this['callProgressDetecting'](_0x3f8fd3,_0x336d09,_0x3ed06d)[_0x2132('0xb7')](function(_0xa094f6){})[_0x2132('0xaf')](loggerCatch(_0x2132('0x190')));}else{this[_0x2132('0x26')][_0x3ed06d[_0x2132('0xd9')]]=_0x3f8fd3;}}};Dialer[_0x2132('0x1c')]['checkRetriveMax']=function(_0x2aaf2d,_0x10395f,_0x1b6746){var _0x573b76=new History(_0x10395f);if(_0x573b76[_0x2132('0xeb')]+_0x573b76[_0x2132('0xec')]+_0x573b76[_0x2132('0xfd')]+_0x573b76[_0x2132('0xed')]+_0x573b76[_0x2132('0xee')]+_0x573b76['countabandonedretry']+_0x573b76[_0x2132('0xe7')]+_0x573b76['countagentrejectretry']>=_0x1b6746[_0x2132('0xf1')]-0x1){return!![];}switch(_0x2aaf2d){case 0x3:if(_0x573b76['countnoanswerretry']>=_0x1b6746[_0x2132('0x191')]-0x1){return!![];}else{this[_0x2132('0xbc')]({'active':![],'countnoanswerretry':_0x573b76['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746[_0x2132('0x192')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x193')));}break;case 0x5:if(_0x573b76['countbusyretry']>=_0x1b6746[_0x2132('0x194')]-0x1){return!![];}else{this[_0x2132('0xbc')]({'active':![],'countbusyretry':_0x573b76[_0x2132('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x1b6746[_0x2132('0x195')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x573b76[_0x2132('0xec')]>=_0x1b6746[_0x2132('0x196')]-0x1){return!![];}else{this[_0x2132('0xbc')]({'active':![],'countcongestionretry':_0x573b76[_0x2132('0xec')]+=0x1,'scheduledat':moment()['add'](_0x1b6746[_0x2132('0x197')],'minutes')[_0x2132('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x573b76[_0x2132('0xed')]>=_0x1b6746[_0x2132('0x198')]-0x1){return!![];}else{this[_0x2132('0xbc')]({'active':![],'countnosuchnumberretry':_0x573b76[_0x2132('0xed')]+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746[_0x2132('0x199')],_0x2132('0xf8'))['format'](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x19a')));}break;case 0xa:if(_0x573b76['countdropretry']>=_0x1b6746[_0x2132('0x116')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x573b76[_0x2132('0xee')]+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746[_0x2132('0x117')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76['ListId'],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})['catch'](loggerCatch(_0x2132('0x19b')));}break;case 0xb:if(_0x573b76[_0x2132('0xef')]>=_0x1b6746[_0x2132('0x11d')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x573b76['countabandonedretry']+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746['dialAbandonedRetryFrequency'],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76['VoiceQueueId']||undefined,'CampaignId':_0x573b76['CampaignId']||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x11f')));}break;case 0x13:if(_0x573b76[_0x2132('0xe7')]>=_0x1b6746[_0x2132('0xf4')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x573b76['countmachineretry']+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746[_0x2132('0xf7')],_0x2132('0xf8'))['format'](_0x2132('0xf9')),'ContactId':_0x573b76['ContactId'],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76['VoiceQueueId']||undefined,'CampaignId':_0x573b76['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x573b76['countagentrejectretry']>=_0x1b6746[_0x2132('0x19c')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x573b76[_0x2132('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x1b6746[_0x2132('0x19d')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76['ListId'],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x19e')));}break;default:return!![];}};Dialer[_0x2132('0x1c')][_0x2132('0x19f')]=function(_0x3d7d54,_0x339783,_0x375fd6){var _0x51ae55=this;var _0xcf0d27=new History(_0x3d7d54);return new BPromise(function(_0x2784f8,_0x5c611a){if(_['isUndefined'](_0x339783)&&_0x2132('0x161')!==typeof _0x339783){return _0x5c611a(msgResponse(_0x2132('0x1a0'),'Failure',_0x2132('0x1a1')));}if(_[_0x2132('0x3b')](_0x375fd6)&&'object'!==typeof _0x375fd6){return _0x5c611a(msgResponse(_0x2132('0x1a0'),'Failure',_0x2132('0x1a2')));}switch(_0x375fd6[_0x2132('0x107')]){case'0':_0x339783['outboundNoSuchCallsDay']+=0x1;_0xcf0d27[_0x2132('0xa1')]=0x0;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1a3');_0xcf0d27[_0x2132('0xed')]+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1a4'),ut[_0x2132('0x1a5')](_0x3d7d54,_0x2132('0x1a6')));_0x51ae55['createHistory'](_0xcf0d27)['catch'](loggerCatch(_0x2132('0xea')));if(_0x51ae55[_0x2132('0x1a7')](0x0,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xed')]>=_0x339783[_0x2132('0x198')]){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1a8'));}else{_0x51ae55[_0x2132('0xf2')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1a8'));}}break;case'3':_0x339783[_0x2132('0x61')]+=0x1;_0xcf0d27['state']=0x3;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1a9');_0xcf0d27[_0x2132('0xfd')]+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1aa'),ut['buildObj'](_0x3d7d54,_0x2132('0x1ab')));_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1ac')));if(_0x51ae55['checkRetriveMax'](0x3,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xfd')]>=_0x339783['dialNoAnswerMaxRetry']){_0x51ae55['createStateFinal'](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1ad'));}else{_0x51ae55['stateGlobal'](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x339783[_0x2132('0x5d')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0x5;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1ae');_0xcf0d27['countbusyretry']+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1af'),ut[_0x2132('0x1a5')](_0x3d7d54,_0x2132('0x1b0')));_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1b1')));if(_0x51ae55[_0x2132('0x1a7')](0x5,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xeb')]>=_0x339783[_0x2132('0x194')]){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1b2'));}else{_0x51ae55[_0x2132('0xf2')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1b2'));}}break;case'8':_0x339783[_0x2132('0x1b3')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0x8;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1b4');_0xcf0d27[_0x2132('0xec')]+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1b5'),ut['buildObj'](_0x3d7d54,'congestion'));_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x51ae55[_0x2132('0x1a7')](0x8,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xec')]>=_0x339783[_0x2132('0x196')]){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x208\x20congestion');}else{_0x51ae55[_0x2132('0xf2')](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x208\x20congestion');}}break;case'11':_0x339783[_0x2132('0x1b6')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0xb;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x11b');_0xcf0d27[_0x2132('0xef')]+=0x1;_0xcf0d27['countglobal']+=0x1;_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1b7')));if(_0x51ae55['checkRetriveMax'](0xb,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xef')]>=_0x339783['dialAbandonedMaxRetry']){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x2011\x20abandoned');}else{_0x51ae55[_0x2132('0xf2')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1b8'));}}break;case'20':_0x339783[_0x2132('0x65')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0x14;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1b9');_0xcf0d27[_0x2132('0xf0')]+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1ba'),ut[_0x2132('0x1a5')](_0x3d7d54,_0x2132('0x1bb')));_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1bc')));if(_0x51ae55['checkRetriveMax'](0x14,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xf0')]>=_0x339783[_0x2132('0x19c')]){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1bd'));}else{_0x51ae55['stateGlobal'](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x2020\x20agentreject');}}break;default:_0x339783[_0x2132('0x1be')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0xc;_0xcf0d27['statedesc']=_0x375fd6['reason'];_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1bf')));if(_0x51ae55[_0x2132('0x1a7')](_0x375fd6[_0x2132('0x107')],_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xeb')]+_0xcf0d27[_0x2132('0xec')]+_0xcf0d27[_0x2132('0xfd')]+_0xcf0d27['countnosuchnumberretry']+_0xcf0d27[_0x2132('0xee')]+_0xcf0d27['countabandonedretry']+_0xcf0d27['countmachineretry']+_0xcf0d27[_0x2132('0xf0')]>=_0x339783[_0x2132('0xf1')]){_0x51ae55['stateGlobal'](_0xcf0d27,_0x2784f8,_0x5c611a,_0x375fd6['reason']);}else{_0x51ae55['createStateFinal'](_0xcf0d27,_0x2784f8,_0x5c611a,_0x375fd6[_0x2132('0x107')]);}}}});};Dialer[_0x2132('0x1c')][_0x2132('0xf2')]=function(_0x2dc90b,_0x39596e,_0x201f8a,_0x19a768){var _0x42805c=new Final(_0x2dc90b);_0x42805c[_0x2132('0xa1')]=0xf;_0x42805c[_0x2132('0xa2')]=_0x2132('0x1c0');this['createStateFinal'](_0x42805c,_0x39596e,_0x201f8a,_0x19a768);};Dialer['prototype']['createStateFinal']=function(_0x2605b9,_0x3d99ba,_0x15d192,_0x2c26f7){this[_0x2132('0xc2')](_0x2605b9)['then'](function(_0x426088){return _0x3d99ba(msgResponse(_0x2132('0x1a0'),_0x2132('0xd2'),_0x2c26f7));})[_0x2132('0xaf')](function(_0xfbd3d5){return _0x15d192(msgResponse(_0x2132('0x1c1'),'Failure',_0x2132('0x1c2')));});};Dialer[_0x2132('0x1c')]['predictive']=function(_0x118676){var _0x7184be=this;var _0x293790=_0x118676['dialPredictiveOptimizationPercentage']/0x64;var _0x5c42c7=_0x118676[_0x2132('0x60')]/(_0x118676[_0x2132('0x60')]+_0x118676['outboundAnswerCallsDay']);var _0x28cb5b=Math[_0x2132('0x1c3')](_0x118676[_0x2132('0x70')]*(_0x118676[_0x2132('0x1c4')]/0x64));var _0x47e77=Math[_0x2132('0x1c3')](_0x118676[_0x2132('0x70')]*(_0x118676[_0x2132('0x1c5')]/0x64));var _0xa47ac0=_0x118676['available']+_0x118676[_0x2132('0x53')];var _0x2ab38a=Math[_0x2132('0x1c6')](_0x118676[_0x2132('0x1c7')]*_0x118676[_0x2132('0x74')]*_0x118676[_0x2132('0x6d')]*_0x118676['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x118676[_0x2132('0x29')])){if(!_[_0x2132('0x3b')](_0x118676[_0x2132('0x28')])){_0x118676[_0x2132('0x28')]=undefined;loggerPredictive[_0x2132('0x90')](_0x2132('0x1c8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x2132('0x3b')](_0x118676[_0x2132('0x89')])){loggerPredictive[_0x2132('0x90')](_0x2132('0x1c8'),_0x2132('0x1c9'));clearInterval(_0x118676['handlePredictive']);_0x118676[_0x2132('0x89')]=undefined;}_0x118676[_0x2132('0x29')]=moment()[_0x2132('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2132('0x7e')](_0x118676['name'],'collection\x20data\x20in\x20progressive\x20at',_0x118676[_0x2132('0x29')]);this['handlePower'](_0x118676,0x1);}else if(ifInterval(_0x118676[_0x2132('0x1ca')],_0x118676[_0x2132('0x29')])){this['handlePower'](_0x118676,0x1);loggerPredictiveCalls[_0x2132('0x7e')](_0x2132('0x1cb'),_0x118676['startProgressive'],_0x118676[_0x2132('0x3e')]);_0x118676[_0x2132('0x1c7')]=0x0;_0x118676[_0x2132('0x6c')]=0x0;}else if(_0x293790<_0x5c42c7&&_0x118676[_0x2132('0x1cc')]===_0x2132('0x1cd')){freeVariablesPredictive(_0x118676);loggerPredictive[_0x2132('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x5c42c7,_0x2132('0x29'),_0x118676['name']);}else if(_0x2ab38a<_0x118676[_0x2132('0x6c')]&&_0x118676['dialPredictiveOptimization']===_0x2132('0x1cd')){freeVariablesPredictive(_0x118676);loggerPredictive[_0x2132('0x7e')](_0x2132('0x1ce'),_0x2132('0x1cf'),_0x2ab38a,'Drop\x20in\x20this\x20interval',_0x118676[_0x2132('0x6c')],'startProgressive',_0x118676[_0x2132('0x3e')]);}else if(!ifInterval(_0x118676[_0x2132('0x1ca')],_0x118676[_0x2132('0x29')])&&_['isUndefined'](_0x118676['startPredictive'])&&!_[_0x2132('0x3b')](_0x118676['startProgressive'])){_0x118676[_0x2132('0x28')]=moment()[_0x2132('0x7c')](_0x2132('0xf9'));loggerPredictive[_0x2132('0x7e')](_0x118676[_0x2132('0x3e')],_0x2132('0x1d0'),_0x118676[_0x2132('0x28')]);this[_0x2132('0x1d1')](_0x118676['dialPredictiveInterval'])[_0x2132('0xb7')](this[_0x2132('0x1d2')](_0x118676))[_0x2132('0xb7')](mergeDataErlangB(_0x118676))[_0x2132('0xb7')](this[_0x2132('0x1d3')](_0x118676))[_0x2132('0xaf')](loggerCatchPredictive(_0x2132('0x1d4'),_0x118676));}else if(!ifInterval(_0x118676['dialPredictiveInterval'],_0x118676[_0x2132('0x28')])){_0x118676[_0x2132('0x6c')]=0x0;_0x118676[_0x2132('0x28')]=moment()['format'](_0x2132('0xf9'));loggerPredictive[_0x2132('0x7e')](_0x118676['name'],'recalculate\x20predictive\x20at',_0x118676[_0x2132('0x28')]);clearInterval(_0x118676[_0x2132('0x89')]);_0x118676['handlePredictive']=undefined;this[_0x2132('0x1d1')](_0x118676[_0x2132('0x1ca')])[_0x2132('0xb7')](this[_0x2132('0x1d2')](_0x118676))[_0x2132('0xb7')](mergeDataErlangB(_0x118676))[_0x2132('0xb7')](this[_0x2132('0x1d3')](_0x118676))[_0x2132('0xaf')](loggerCatchPredictive(_0x2132('0x1d5'),_0x118676));}else if(_0x118676[_0x2132('0x70')]&&_0xa47ac0<_0x118676[_0x2132('0x70')]-_0x47e77){freeVariablesPredictive(_0x118676);loggerPredictive[_0x2132('0x7e')](_0x118676[_0x2132('0x3e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xa47ac0,_0x2132('0x1d6'),_0x118676['predictiveIntervalAvailable'],'-',_0x47e77,'=',_0x118676[_0x2132('0x70')]-_0x47e77,')');}else if(_0x118676[_0x2132('0x70')]&&_0xa47ac0>_0x118676['predictiveIntervalAvailable']+_0x28cb5b){freeVariablesPredictive(_0x118676);loggerPredictive[_0x2132('0x7e')](_0x118676[_0x2132('0x3e')],_0x2132('0x1d7'),_0xa47ac0,')\x20are\x20more\x20than\x20threshold\x20(',_0x118676[_0x2132('0x70')],'+',_0x28cb5b,'=',_0x118676[_0x2132('0x70')]+_0x28cb5b,')');}};Dialer[_0x2132('0x1c')]['getDataPredictive']=function(_0x4ce645){var _0x546504=this;return function(_0x4b7e14){return new BPromise(function(_0x545481,_0x8df18a){_[_0x2132('0x87')](_0x4ce645,_0x4b7e14[0x0]);if(checkGetDataPredictive(_0x4b7e14[0x0])){var _0x260179=_0x4ce645[_0x2132('0x70')]=_0x4ce645[_0x2132('0x53')]+_0x4ce645[_0x2132('0x9b')];var _0x7fe419=_0x4ce645['dialPredictiveInterval']*0x3c;var _0x237566=_0x4b7e14[0x0]['predictiveIntervalAvgTalktime']+_0x4b7e14[0x0][_0x2132('0x67')];var _0x129fdf=(_0x4b7e14[0x0][_0x2132('0x66')]+_0x4b7e14[0x0][_0x2132('0x6a')]+_0x4b7e14[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4b7e14[0x0][_0x2132('0x71')];_0x4ce645[_0x2132('0x6d')]=_0x129fdf>0x0?_0x129fdf:0x1;switch(_0x4ce645[_0x2132('0x1cc')]){case'dropRate':var _0x2903de=_0x4ce645['dialPredictiveOptimizationPercentage']/0x64;return _0x546504['abandonmentRate'](_0x260179,_0x7fe419,_0x237566,_0x129fdf,_0x2903de)[_0x2132('0xb7')](function(_0x4deeab){return _0x545481(_0x4deeab);});case _0x2132('0x1d8'):var _0x53285a=_0x4ce645[_0x2132('0x1d9')]/0x64;return _0x546504[_0x2132('0x1da')](_0x260179,_0x7fe419,_0x237566,_0x129fdf,_0x53285a)[_0x2132('0xb7')](function(_0x18a0f2){return _0x545481(_0x18a0f2);});default:return _0x8df18a(msgResponse(_0x2132('0x1db'),_0x2132('0x14b'),_0x2132('0x1dc')));}}else{return _0x8df18a(msgResponse('[getDataPredictive]','Failure',_0x2132('0x1dd')));}});};};Dialer['prototype'][_0x2132('0x1de')]=function(_0x2799ea){var _0x52cde2=this;return function(_0xb15804){return new BPromise(function(_0x36daee,_0x39c63a){_[_0x2132('0x87')](_0x2799ea,_0xb15804[0x0]);if(checkGetDataPredictive(_0xb15804[0x0])){loggerPredictive['info'](JSON[_0x2132('0x48')](_0xb15804[0x0]));if(_0x2799ea['dialPredictiveOptimization']===_0x2132('0x1cd')){return _0x52cde2['getVoiceQueueRtPauses'](_0x2799ea['id'])[_0x2132('0xb7')](function(_0x99cb1b){var _0x179eb8=_0x2799ea['loggedIn']-_0x99cb1b[0x0][_0x2132('0x1df')];var _0xade7ee=_0x2799ea[_0x2132('0x1ca')]*0x3c;var _0x84f71a=_0xb15804[0x0][_0x2132('0x68')]+_0xb15804[0x0]['predictiveIntervalAvgHoldtime'];var _0x4c6188=(_0xb15804[0x0]['predictiveIntervalAnsweredCalls']+_0xb15804[0x0][_0x2132('0x6a')]+_0xb15804[0x0][_0x2132('0x69')])/_0xb15804[0x0][_0x2132('0x71')];var _0x3f6a5a=_0x2799ea[_0x2132('0x1d9')]/0x64;_0x2799ea[_0x2132('0x6f')]=_0x99cb1b[0x0][_0x2132('0x1df')]||0x0;_0x2799ea['predictiveIntervalHitRate']=_0x4c6188>0x0?_0x4c6188:0x1;return _0x52cde2[_0x2132('0x1e0')](_0x179eb8,_0xade7ee,_0x84f71a,_0x4c6188,_0x3f6a5a);})[_0x2132('0xb7')](function(_0x3d0e44){return _0x36daee(_0x3d0e44);})[_0x2132('0xaf')](function(_0x5adce0){return _0x39c63a(msgResponse(_0x2132('0x1e1'),_0x2132('0x14b'),JSON[_0x2132('0x48')](_0x5adce0)));});}if(_0x2799ea[_0x2132('0x1cc')]===_0x2132('0x1d8')){return _0x52cde2[_0x2132('0xc1')](_0x2799ea['id'])[_0x2132('0xb7')](function(_0x2150bc){var _0x5e63e1=_0x2799ea[_0x2132('0x4e')]-_0x2150bc[0x0][_0x2132('0x1df')];var _0x5c6722=_0x2799ea[_0x2132('0x1ca')]*0x3c;var _0x50a649=_0xb15804[0x0][_0x2132('0x68')]+_0xb15804[0x0]['predictiveIntervalAvgHoldtime'];var _0x26b8ca=(_0xb15804[0x0][_0x2132('0x66')]+_0xb15804[0x0][_0x2132('0x6a')]+_0xb15804[0x0][_0x2132('0x69')])/_0xb15804[0x0]['predictiveIntervalTotalCalls'];var _0x5404f6=_0x2799ea[_0x2132('0x1d9')]/0x64;_0x2799ea[_0x2132('0x6f')]=_0x2150bc[0x0][_0x2132('0x1df')]||0x0;_0x2799ea[_0x2132('0x6d')]=_0x26b8ca>0x0?_0x26b8ca:0x1;return _0x52cde2[_0x2132('0x1da')](_0x5e63e1,_0x5c6722,_0x50a649,_0x26b8ca,_0x5404f6);})[_0x2132('0xb7')](function(_0x2b0ebc){return _0x36daee(_0x2b0ebc);})[_0x2132('0xaf')](function(_0x1a75cb){return _0x39c63a(msgResponse(_0x2132('0x1e1'),'Failure',JSON[_0x2132('0x48')](_0x1a75cb)));});}}else{return _0x39c63a(msgResponse(_0x2132('0x1db'),_0x2132('0x14b'),_0x2132('0x1dd')));}});};};Dialer[_0x2132('0x1c')][_0x2132('0x1d3')]=function(_0x285af3){var _0x4a323e=this;return function(){var _0x161c2e=0x0;var _0x11eaef=Math['floor'](_0x285af3[_0x2132('0x73')]*0x3e8);if(_0x11eaef>0x0){_0x11eaef=_0x11eaef<0x64?0x64:_0x11eaef;loggerPredictive[_0x2132('0x7e')](_0x285af3[_0x2132('0x3e')],_0x2132('0x1e2'),_0x11eaef,_0x2132('0x49'));_0x285af3['handlePredictive']=setInterval(function(){_0x4a323e[_0x2132('0x89')](_0x285af3);loggerPredictiveCalls[_0x2132('0x7e')]('[handlePredictive]',_0x161c2e+=0x1);},_0x11eaef);}else{loggerPredictive[_0x2132('0x7e')](_0x285af3[_0x2132('0x3e')],_0x2132('0x1e3'));}};};Dialer[_0x2132('0x1c')]['checkContactBlack']=function(_0x1cfc79,_0xb8a89a){var _0x5979b7=this;return function(_0x4063e2){if(_['isEmpty'](_0x4063e2)){if(_[_0x2132('0xac')](_0xb8a89a[_0x2132('0xcd')])||!_0xb8a89a[_0x2132('0x1e4')]){if(_0x1cfc79[_0x2132('0x57')]===_0x2132('0x153')){_0x1cfc79[_0x2132('0x126')]=_[_0x2132('0x3b')](_0x1cfc79[_0x2132('0x126')])?!![]:_0x1cfc79[_0x2132('0x126')];var _0x597f58=uuid['v4']();_0x5979b7[_0x2132('0xa8')][_0x597f58]=new Action(_0x1cfc79,_0xb8a89a,_0x597f58);loggerBooked['info']('[booked][checkContactBlack]',_0x597f58,_0x2132('0x1e5'),JSON[_0x2132('0x48')](_0x1cfc79[_0x2132('0x126')]),'Queue:\x20',_0x1cfc79[_0x2132('0x3e')]);if(_0x1cfc79[_0x2132('0x126')]){_0x1cfc79[_0x2132('0x126')]=![];_0x5979b7['queueBooked'][_0x5979b7[_0x2132('0xa8')][_0x597f58]['queue']]=[];ami[_0x2132('0xad')]({'actionid':_0x597f58,'action':_0x2132('0x1e6'),'queue':_0x1cfc79[_0x2132('0x3e')]})[_0x2132('0xaf')](function(_0x5e4016){_0x5979b7['updateOriginated'](_0x1cfc79);_0x5979b7[_0x2132('0xbc')]({'active':![],'ContactId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0xcb')],'ListId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0xcc')],'VoiceQueueId':_0x5979b7['actions'][_0x597f58][_0x2132('0xce')]||undefined,'CampaignId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x1e7')));delete _0x5979b7['actions'][_0x597f58];});}else{loggerBooked[_0x2132('0x7e')](_0x2132('0x1e8'),JSON[_0x2132('0x48')](_0x1cfc79[_0x2132('0x126')]),'Queue:\x20',_0x1cfc79[_0x2132('0x3e')]);_0x5979b7[_0x2132('0xb0')](_0x1cfc79);_0x5979b7[_0x2132('0xbc')]({'active':![],'ContactId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0xcb')],'ListId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0xcc')],'VoiceQueueId':_0x5979b7[_0x2132('0xa8')][_0x597f58]['VoiceQueueId']||undefined,'CampaignId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x1e7')));delete _0x5979b7[_0x2132('0xa8')][_0x597f58];}}else{return _0x5979b7['actionOriginate'](_0x1cfc79,_0xb8a89a);}}else{if(getDiff(_0xb8a89a[_0x2132('0x1e9')])<_0x1cfc79[_0x2132('0x1ea')]*0x3c){if(_0xb8a89a[_0x2132('0x1eb')]&&!_0xb8a89a[_0x2132('0x1eb')][_0x2132('0x1ec')]){_0x5979b7[_0x2132('0x1f')][_0x2132('0x128')](_0xb8a89a['id'])[_0x2132('0x1e')](function(){_0x5979b7[_0x2132('0xb0')](_0x1cfc79);});}else{_0x5979b7[_0x2132('0xbd')]({'active':![]},_0xb8a89a['id'],0x1)[_0x2132('0x1e')](function(){console[_0x2132('0x1ed')]('Contact\x20updated');_0x5979b7[_0x2132('0xb0')](_0x1cfc79);});}}else{_0x1cfc79[_0x2132('0x64')]+=0x1;_0x5979b7[_0x2132('0xb0')](_0x1cfc79);if(_0x1cfc79[_0x2132('0x1ee')]){_0x5979b7[_0x2132('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xb8a89a[_0x2132('0xcb')],'ListId':_0xb8a89a['ListId'],'VoiceQueueId':_0xb8a89a[_0x2132('0xce')]||undefined,'CampaignId':_0xb8a89a[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x1ef')));_0x5979b7[_0x2132('0xc4')](createObjHistory(_0x1cfc79,_0xb8a89a,_0x2132('0x1f0'),0x17,_0x2132('0x1f1')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5979b7[_0x2132('0xd8')](createObjHistory(_0x1cfc79,_0xb8a89a,_0x2132('0x1f2'),0x16,_0x2132('0x1f3')),_0x2132('0x1f4'),_0x2132('0x1f5'));}}}}else{_0x1cfc79[_0x2132('0x5c')]+=0x1;_0x5979b7[_0x2132('0xd8')](createObjHistory(_0x1cfc79,_0xb8a89a,_0x2132('0x1f6'),0xd,_0x2132('0x1f7')),_0x2132('0x1f8'),_0x2132('0x1f9'));throw'inBlackList';}};};Dialer[_0x2132('0x1c')]['handleIvr']=function(_0x149706){var _0x5c26f9=this;var _0x40284f=[];var _0x36e080=_0x149706['limitCalls']-_0x149706[_0x2132('0x72')]-_0x149706[_0x2132('0x1fa')];emitCampaignSummary(_0x149706);if(_0x36e080>0x0){if(_0x36e080>this[_0x2132('0x24')]){_0x36e080=this[_0x2132('0x24')];}_0x149706[_0x2132('0x1fa')]+=_0x36e080;this[_0x2132('0xc0')](_0x149706['id'],_0x36e080,_0x149706[_0x2132('0x1fb')])[_0x2132('0xb7')](function(_0x282833){_0x149706[_0x2132('0x1fa')]-=_0x36e080;_0x149706[_0x2132('0x1fa')]=_0x149706[_0x2132('0x1fa')]>0x0?_0x149706[_0x2132('0x1fa')]:0x0;if(!checkContactEmpty(_0x282833)){_0x149706[_0x2132('0x3c')]=_0x2132('0x99');logger[_0x2132('0x7e')](_0x2132('0x1fc')+_0x149706[_0x2132('0x3e')]);}else{_0x149706[_0x2132('0x72')]+=_0x282833[_0x2132('0x92')];_0x149706[_0x2132('0x3c')]=_0x2132('0x1fd');for(var _0x4b1afa=0x0;_0x4b1afa<_0x282833[_0x2132('0x92')];_0x4b1afa+=0x1){_0x149706[_0x2132('0x1fe')]+=0x1;if(_['isNil'](_0x282833[_0x4b1afa])||_[_0x2132('0xac')](_0x282833[_0x4b1afa][_0x2132('0x163')])||_['isNil'](_0x282833[_0x4b1afa][_0x2132('0x163')][_0x2132('0x164')])){_0x5c26f9[_0x2132('0xc8')](_0x2132('0x1ff'),_0x149706,_0x282833[_0x4b1afa]);}else{_0x5c26f9[_0x2132('0xb9')](_[_0x2132('0xca')](_0x282833[_0x4b1afa],[_0x2132('0x11e'),'Contact.phone']))['then'](_0x5c26f9[_0x2132('0x200')](_0x149706,_0x282833[_0x4b1afa]))[_0x2132('0xaf')](_0x5c26f9[_0x2132('0x201')]('[actionOriginateIvr]\x20',_0x149706));}}}})[_0x2132('0xaf')](loggerGetContactDialer(_0x2132('0x202'),_0x149706,_0x36e080));}};Dialer[_0x2132('0x1c')][_0x2132('0x151')]=function(_0x240db2,_0xf90f1a){var _0xad695=this;var _0x13a687=[];var _0xb1db03=_0xf90f1a>=0x1?_0xf90f1a:0x1;var _0x5227b8=[];if(_0x240db2[_0x2132('0x57')]===_0x2132('0x153')){_0xb1db03=0x1;}var _0x54d9a6=Math[_0x2132('0x1c6')](_0x240db2[_0x2132('0x9b')]*_0xb1db03)-_0x240db2[_0x2132('0x72')]-_0x240db2[_0x2132('0x1fa')];emitVoiceQueueSummary(_0x240db2);if(_0x240db2['dialLimitQueue']>0x0){var _0x4a495b=_0x240db2[_0x2132('0x203')]-_0x240db2[_0x2132('0x72')]-_0x240db2[_0x2132('0x53')]-_0x240db2[_0x2132('0x1fa')]-_0x240db2['pTalking'];if(_0x54d9a6>_0x4a495b){_0x54d9a6=_0x4a495b;}}if(_0x54d9a6>0x0){if(_0x240db2[_0x2132('0x57')]===_0x2132('0x153')){_0x54d9a6=0x1;}if(_0x54d9a6>this['maxNumberOriginate']){_0x54d9a6=this[_0x2132('0x24')];}_0x240db2[_0x2132('0x1fa')]+=_0x54d9a6;for(var _0x1d6530 in this['agents']){if(this[_0x2132('0x22')]['hasOwnProperty'](_0x1d6530)){if(this[_0x2132('0x22')][_0x1d6530]['state']===_0x2132('0x204')&&this[_0x2132('0x22')][_0x1d6530][_0x2132('0xd6')]===_0x2132('0xd7')){_0x13a687[_0x2132('0x125')](this[_0x2132('0x22')][_0x1d6530]['id']);}}}this[_0x2132('0xbf')](_0x240db2['id'],_0x13a687,_0x54d9a6,_0x240db2[_0x2132('0x1fb')])[_0x2132('0xb7')](function(_0x2fd263){_0x240db2['temp']-=_0x54d9a6;_0x240db2[_0x2132('0x1fa')]=_0x240db2['temp']>0x0?_0x240db2[_0x2132('0x1fa')]:0x0;if(!checkContactEmpty(_0x2fd263)){_0xad695['countReScheduled'](_0x240db2)[_0x2132('0xb7')](sendMessageReschedule(_0x240db2))[_0x2132('0xaf')](loggerCatch(_0x2132('0xb4')));}else{_0x240db2['originated']+=_0x2fd263['length'];_0x240db2[_0x2132('0x3c')]=_0x240db2[_0x2132('0x57')]===_0x2132('0x153')?_0x2132('0x16a'):'RUNNING';for(var _0xfd43d9=0x0;_0xfd43d9<_0x2fd263[_0x2132('0x92')];_0xfd43d9+=0x1){if(_[_0x2132('0xac')](_0x2fd263[_0xfd43d9])||_[_0x2132('0xac')](_0x2fd263[_0xfd43d9][_0x2132('0x163')])||_[_0x2132('0xac')](_0x2fd263[_0xfd43d9][_0x2132('0x163')]['phone'])){_0xad695[_0x2132('0xc8')](_0x2132('0x1ff'),_0x240db2,_0x2fd263[_0xfd43d9]);}else{_0xad695[_0x2132('0xb5')](_['pick'](_0x2fd263[_0xfd43d9],['VoiceQueueId',_0x2132('0x205')]))['then'](_0xad695[_0x2132('0x200')](_0x240db2,_0x2fd263[_0xfd43d9]))[_0x2132('0xaf')](_0xad695[_0x2132('0x201')]('[actionOriginate]\x20',_0x240db2));}}}})[_0x2132('0xaf')](loggerGetContactDialer(_0x2132('0x206'),_0x240db2,_0x54d9a6));}};Dialer['prototype'][_0x2132('0x89')]=function(_0x175620){var _0x25f861=this;if(_0x175620[_0x2132('0x203')]>0x0){var _0x4b9658=_0x175620[_0x2132('0x203')]-_0x175620[_0x2132('0x72')]-_0x175620[_0x2132('0x53')];if(_0x4b9658>0x0){this[_0x2132('0x207')](_0x175620);}else{loggerPredictiveCalls[_0x2132('0x7e')]('[handlePredictive][limitChannel]');}}else{this[_0x2132('0x207')](_0x175620);}};Dialer['prototype'][_0x2132('0x207')]=function(_0x5e870b){var _0x5ad920=this;var _0x8cf1f=[];_0x5e870b[_0x2132('0x72')]+=0x1;for(var _0x132abe in this[_0x2132('0x22')]){if(this[_0x2132('0x22')]['hasOwnProperty'](_0x132abe)){if(this[_0x2132('0x22')][_0x132abe][_0x2132('0xa1')]===_0x2132('0x204')&&this[_0x2132('0x22')][_0x132abe]['status']===_0x2132('0xd7')){_0x8cf1f[_0x2132('0x125')](this[_0x2132('0x22')][_0x132abe]['id']);}}}this[_0x2132('0xbf')](_0x5e870b['id'],_0x8cf1f,0x1,_0x5e870b[_0x2132('0x1fb')])[_0x2132('0xb7')](function(_0x3afdb6){if(!checkContactEmpty(_0x3afdb6)){checkContactLowerLimitOriginate(_0x5e870b,0x1,0x0);_0x5ad920[_0x2132('0xb3')](_0x5e870b)[_0x2132('0xb7')](sendMessageReschedule(_0x5e870b))['catch'](loggerCatch(_0x2132('0xb4')));}else{_0x5e870b[_0x2132('0x3c')]=_0x2132('0x1fd');if(_[_0x2132('0xac')](_0x3afdb6[0x0])||_[_0x2132('0xac')](_0x3afdb6[0x0]['Contact'])||_[_0x2132('0xac')](_0x3afdb6[0x0][_0x2132('0x163')][_0x2132('0x164')])){_0x5ad920[_0x2132('0xc8')](_0x2132('0x1ff'),_0x5e870b,_0x3afdb6[0x0]);}else{_0x5ad920[_0x2132('0xb5')](_[_0x2132('0xca')](_0x3afdb6[0x0],[_0x2132('0xce'),'Contact.phone']))[_0x2132('0xb7')](_0x5ad920[_0x2132('0x200')](_0x5e870b,_0x3afdb6[0x0]))['catch'](_0x5ad920['loggerHandler'](_0x2132('0x208'),_0x5e870b));}}})[_0x2132('0xaf')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5e870b,0x1));emitVoiceQueueSummary(_0x5e870b);};Dialer[_0x2132('0x1c')][_0x2132('0x1e0')]=function(_0x4bf0b6,_0x436525,_0x4f7a5b,_0x2e860d,_0x1d52d7,_0x5cffe9){loggerPredictive[_0x2132('0x7e')](_0x2132('0x209'));loggerPredictive['info'](_0x2132('0x20a'),_0x4bf0b6);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20b'),_0x436525);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20c'),_0x4f7a5b);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20d'),_0x2e860d);loggerPredictive['info'](_0x2132('0x20e'),_0x1d52d7);loggerPredictive[_0x2132('0x7e')]('---------------------------');return new BPromise(function(_0x383720,_0x1dc552){if(_0x4bf0b6<=0x0||isNaN(_0x4bf0b6)){return _0x1dc552(msgResponse(_0x2132('0x20f'),_0x2132('0x47'),_0x2132('0x210')+_0x4bf0b6));}if(_0x4f7a5b<=0x0||isNaN(_0x4f7a5b)){return _0x1dc552(msgResponse(_0x2132('0x20f'),_0x2132('0x47'),_0x2132('0x211')+_0x4f7a5b));}if(_0x2e860d<=0x0||isNaN(_0x2e860d)){return _0x1dc552(msgResponse(_0x2132('0x20f'),_0x2132('0x47'),_0x2132('0x212')+_0x2e860d));}if(_0x436525<=0x0||isNaN(_0x436525)){return _0x1dc552(msgResponse('[abandonmentRate]',_0x2132('0x47'),_0x2132('0x213')+_0x436525));}if(_0x1d52d7<=0x0||isNaN(_0x1d52d7)){return _0x1dc552(msgResponse(_0x2132('0x20f'),_0x2132('0x47'),_0x2132('0x214')+_0x1d52d7));}_0x5cffe9=_0x5cffe9||0x0;var _0x348012=0x1/_0x4f7a5b;var _0x2dd6f4=0x0;var _0x2cef3c=0x0;var _0x1c876b=0x0;var _0x264cfc=0x0;for(var _0x40c293=0x0;_0x1c876b<_0x1d52d7;_0x40c293+=0x1){_0x2cef3c=_0x40c293/_0x436525;_0x2dd6f4=(_0x2e860d*_0x2cef3c+_0x5cffe9)/_0x348012;_0x1c876b=erlangb(_0x2dd6f4,_0x4bf0b6);_0x264cfc=_0x2dd6f4/_0x4bf0b6*(0x1-erlangb(_0x2dd6f4,_0x4bf0b6));}return _0x383720({'erlangCalls':_0x40c293,'erlangCallToSecond':_0x436525/_0x40c293,'erlangAbandonmentRate':_0x1c876b,'erlangBusyFactor':_0x264cfc});});};Dialer[_0x2132('0x1c')][_0x2132('0x1da')]=function(_0x4be64b,_0x543ec2,_0x1d54f3,_0x2b7fe2,_0x1b5a2a,_0x3d033d){loggerPredictive[_0x2132('0x7e')](_0x2132('0x215'));loggerPredictive[_0x2132('0x7e')]('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',_0x4be64b);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20b'),_0x543ec2);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20c'),_0x1d54f3);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20d'),_0x2b7fe2);loggerPredictive[_0x2132('0x7e')](_0x2132('0x216'),_0x1b5a2a);loggerPredictive[_0x2132('0x7e')](_0x2132('0x217'));return new BPromise(function(_0x4215a7,_0x12ed5a){if(_0x4be64b<=0x0||isNaN(_0x4be64b)){return _0x12ed5a(msgResponse(_0x2132('0x218'),_0x2132('0x47'),_0x2132('0x210')+_0x4be64b));}if(_0x1d54f3<=0x0||isNaN(_0x1d54f3)){return _0x12ed5a(msgResponse('[busyFactor]',_0x2132('0x47'),'Ts\x20=\x20'+_0x1d54f3));}if(_0x2b7fe2<=0x0||isNaN(_0x2b7fe2)){return _0x12ed5a(msgResponse(_0x2132('0x218'),'Error','p\x20=\x20'+_0x2b7fe2));}if(_0x543ec2<=0x0||isNaN(_0x543ec2)){return _0x12ed5a(msgResponse(_0x2132('0x218'),'Error',_0x2132('0x213')+_0x543ec2));}if(_0x1b5a2a<=0x0||isNaN(_0x1b5a2a)){return _0x12ed5a(msgResponse(_0x2132('0x218'),_0x2132('0x47'),_0x2132('0x219')+_0x1b5a2a));}_0x3d033d=_0x3d033d||0x0;var _0x5b5809=0x1/_0x1d54f3;var _0x147ea7=0x0;var _0x5eeb5c=0x0;var _0x4778d0=0x0;var _0x3ae44c=0x0;for(var _0x2a418a=0x0;_0x3ae44c<_0x1b5a2a;_0x2a418a+=0x1){_0x5eeb5c=_0x2a418a/_0x543ec2;_0x147ea7=(_0x2b7fe2*_0x5eeb5c+_0x3d033d)/_0x5b5809;_0x4778d0=erlangb(_0x147ea7,_0x4be64b);_0x3ae44c=_0x147ea7/_0x4be64b*(0x1-erlangb(_0x147ea7,_0x4be64b));}return _0x4215a7({'erlangCalls':_0x2a418a,'erlangCallToSecond':_0x543ec2/_0x2a418a,'erlangAbandonmentRate':_0x4778d0,'erlangBusyFactor':_0x3ae44c});});};module[_0x2132('0x21a')]=Dialer; \ No newline at end of file +var _0x8e5c=['checkIsBlackListIvr','then','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','reachable','SIP/%s','unmonitored','saveInDb','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','uniqueid','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','AMD','[syncHangupInAMDIvr][createHistory]','amd','countcongestionretry','reason\x2019\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','AGI','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','reason','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','agiafterat','dialQueueProject2','[rescheduleContact][Drop]','calleridname','calleridnum','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','countabandonedretry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','interval','indexOf','iftime\x20%s,%s','content','all','some','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','checkIfTime','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','trim','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','object','[callProgressDetecting]','evt\x20is\x20undefine','emit','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','buildObj','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','check\x20failure','startMethodPredictive','one\x20call\x20every:','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialMethod','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','seconds','outbound','strategy','answered','available','loggedIn','sumBillable','talking','type','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','active','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','starttime','uniqueId','[uniqueid]','clearZombieChannels','isNil','Action','status','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20'];(function(_0x5a404a,_0x48458a){var _0xd5f363=function(_0x3ad6af){while(--_0x3ad6af){_0x5a404a['push'](_0x5a404a['shift']());}};_0xd5f363(++_0x48458a);}(_0x8e5c,0x167));var _0xc8e5=function(_0x2156ef,_0x3f36ea){_0x2156ef=_0x2156ef-0x0;var _0x418795=_0x8e5c[_0x2156ef];return _0x418795;};'use strict';var util=require(_0xc8e5('0x0'));var _=require(_0xc8e5('0x1'));var BPromise=require(_0xc8e5('0x2'));var uuid=require('uuid');var moment=require(_0xc8e5('0x3'));var rr=require('rr');var md5=require(_0xc8e5('0x4'));var Redis=require(_0xc8e5('0x5'));var ut=require(_0xc8e5('0x6'));var config=require(_0xc8e5('0x7'));var logger=require(_0xc8e5('0x8'))(_0xc8e5('0x9'));var loggerBooked=require(_0xc8e5('0x8'))('booked');var loggerPredictive=require(_0xc8e5('0x8'))(_0xc8e5('0xa'));var loggerPredictiveCalls=require(_0xc8e5('0x8'))(_0xc8e5('0xb'));var loggerSyncQueueSummary=require(_0xc8e5('0x8'))(_0xc8e5('0xc'));var ami=require(_0xc8e5('0xd'));config[_0xc8e5('0xe')]=_[_0xc8e5('0xf')](config[_0xc8e5('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc8e5('0xe')]));var cmHopper=require(_0xc8e5('0x10'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xc8e5('0x11'));var cmHopperBlack=require(_0xc8e5('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require('./history');var Final=require(_0xc8e5('0x13'));var AgentComplete=require(_0xc8e5('0x14'));var QueueCallerAbandon=require(_0xc8e5('0x15'));var Hangup=require(_0xc8e5('0x16'));var ipAgi=process[_0xc8e5('0x17')]['XCALLY_IP_AGI']||_0xc8e5('0x18');var strategy={'rrmemory':_0xc8e5('0x19'),'roundrobin':_0xc8e5('0x1a')};var Sequence=function(){};Sequence[_0xc8e5('0x1b')][_0xc8e5('0x1c')]=function(_0x51d685){this['tail']=this[_0xc8e5('0x1d')]?this[_0xc8e5('0x1d')][_0xc8e5('0x1e')](_0x51d685):_0x51d685();};function Dialer(_0x466bca,_0x5942d3){this[_0xc8e5('0x1f')]=new Sequence();this[_0xc8e5('0x20')]=_0x5942d3;this[_0xc8e5('0x21')]=_0x466bca['voiceQueues'];this['campaigns']=_0x466bca[_0xc8e5('0x22')];this['agents']=_0x466bca[_0xc8e5('0x23')];this[_0xc8e5('0x24')]=_0x466bca[_0xc8e5('0x24')];this[_0xc8e5('0x25')]=config['maxNumberOriginate']||0x2;this[_0xc8e5('0x26')]={};this[_0xc8e5('0x27')]={};this[_0xc8e5('0x28')]={};this['uniqueId']={};this[_0xc8e5('0x29')]={};this[_0xc8e5('0x2a')]={};this['startProgressive']={};this[_0xc8e5('0x2b')]={};this[_0xc8e5('0x2c')]={};this[_0xc8e5('0x2d')]={};ami['on'](_0xc8e5('0x2e'),this['syncAgentConnect'][_0xc8e5('0x2f')](this));ami['on']('queuecallerabandon',this[_0xc8e5('0x30')][_0xc8e5('0x2f')](this));ami['on'](_0xc8e5('0x31'),this[_0xc8e5('0x32')][_0xc8e5('0x2f')](this));ami['on']('agentcomplete',this[_0xc8e5('0x33')][_0xc8e5('0x2f')](this));ami['on'](_0xc8e5('0x34'),this[_0xc8e5('0xc')][_0xc8e5('0x2f')](this));ami['on'](_0xc8e5('0x35'),this[_0xc8e5('0x36')][_0xc8e5('0x2f')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xc8e5('0x37'),this[_0xc8e5('0x38')][_0xc8e5('0x2f')](this));ami['on'](_0xc8e5('0x39'),this[_0xc8e5('0x3a')]['bind'](this));ami['on'](_0xc8e5('0x3b'),this[_0xc8e5('0x3c')][_0xc8e5('0x2f')](this));this[_0xc8e5('0x3d')]();this['loopClearZombieChannels']();}function isNotNull(_0x1ff59f){return _0x1ff59f!==null&&!_[_0xc8e5('0x3e')](_0x1ff59f);}function checkIsLoggedIn(_0x2d0f13,_0x3b8a1f){return function(){if(_0x3b8a1f<=0x0){_0x2d0f13[_0xc8e5('0x3f')]=_0xc8e5('0x40');throw _0x2d0f13[_0xc8e5('0x41')]+_0xc8e5('0x42');}};}function isActive(_0x56aa89){return _0x56aa89;}function checkIsActive(_0x473ade,_0x5a7c6b){return function(){if(!isActive(_0x5a7c6b)){_0x473ade[_0xc8e5('0x3f')]='NOT_ACTIVE';throw _0x473ade['name']+_0xc8e5('0x43');}};}function checkInterval(_0xa80b5){return function(){if(!isNotNull(_0xa80b5[_0xc8e5('0x44')])){_0xa80b5[_0xc8e5('0x3f')]=_0xc8e5('0x45');throw _0xa80b5[_0xc8e5('0x41')]+_0xc8e5('0x46');}if(!isNotNull(_0xa80b5[_0xc8e5('0x44')][_0xc8e5('0x47')])){_0xa80b5['message']=_0xc8e5('0x45');throw _0xa80b5[_0xc8e5('0x41')]+_0xc8e5('0x46');}if(!isNotNull(_[_0xc8e5('0x48')](_0xa80b5[_0xc8e5('0x44')][_0xc8e5('0x47')]))){_0xa80b5['message']=_0xc8e5('0x45');throw _0xa80b5[_0xc8e5('0x41')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x4026e1,_0x1b5b41,_0x28a1fe){return{'action':_0x4026e1,'response':_0x1b5b41,'message':_0x28a1fe,'stack':_0x28a1fe};}function myreject(_0x58c85a){return function(_0x4af60a){return _0x58c85a(msgResponse(_0xc8e5('0x49'),_0xc8e5('0x4a'),JSON[_0xc8e5('0x4b')](_0x4af60a)));};}function getSeconds(_0x30e471,_0x5c7761){var _0x19cf1a=moment(_0x30e471)[_0xc8e5('0x4c')](0x0);var _0x6310b9=moment(_0x5c7761)[_0xc8e5('0x4c')](0x0);return _0x19cf1a['diff'](_0x6310b9,_0xc8e5('0x4d'));}function emit(_0x45250c,_0x3b9944,_0x27b6d5){io['to'](_0x45250c)['emit'](_0x3b9944,_0x27b6d5);}function emitVoiceQueueSummary(_0x339b9d){if(_0x339b9d['type']===_0xc8e5('0x4e')){var _0x19c16a={'id':_0x339b9d['id'],'name':_0x339b9d[_0xc8e5('0x41')],'strategy':_0x339b9d[_0xc8e5('0x4f')],'answered':_0x339b9d[_0xc8e5('0x50')],'available':_0x339b9d[_0xc8e5('0x51')],'loggedIn':_0x339b9d[_0xc8e5('0x52')],'pTalking':_0x339b9d['pTalking'],'sumBillable':_0x339b9d[_0xc8e5('0x53')],'sumDuration':_0x339b9d['sumDuration'],'sumHoldTime':_0x339b9d['sumHoldTime']||0x0,'talking':_0x339b9d[_0xc8e5('0x54')],'total':_0x339b9d['total'],'type':_0x339b9d[_0xc8e5('0x55')],'unmanaged':_0x339b9d['unmanaged'],'abandoned':_0x339b9d[_0xc8e5('0x56')],'waiting':_0x339b9d['waiting'],'loggedInDb':_0x339b9d[_0xc8e5('0x57')],'dialActive':_0x339b9d[_0xc8e5('0x58')],'dialMethod':_0x339b9d['dialMethod'],'dialOriginateCallerIdName':_0x339b9d[_0xc8e5('0x59')],'dialOriginateCallerIdNumber':_0x339b9d['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x339b9d[_0xc8e5('0x5a')],'dialPrefix':_0x339b9d[_0xc8e5('0x5b')],'outboundAnswerAgiCallsDay':_0x339b9d[_0xc8e5('0x5c')],'outboundAnswerCallsDay':_0x339b9d[_0xc8e5('0x5d')],'outboundBlacklistCallsDay':_0x339b9d[_0xc8e5('0x5e')],'outboundBusyCallsDay':_0x339b9d[_0xc8e5('0x5f')],'outboundCongestionCallsDay':_0x339b9d[_0xc8e5('0x60')],'outboundDropCallsDayACS':_0x339b9d[_0xc8e5('0x61')],'outboundDropCallsDayCallersExit':_0x339b9d['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x339b9d[_0xc8e5('0x62')],'outboundNoAnswerCallsDay':_0x339b9d['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x339b9d[_0xc8e5('0x63')],'outboundOriginateFailureCallsDay':_0x339b9d[_0xc8e5('0x64')],'outboundReCallsDay':_0x339b9d[_0xc8e5('0x65')],'outboundRejectCallsDay':_0x339b9d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x339b9d[_0xc8e5('0x66')],'predictiveIntervalAnsweredCalls':_0x339b9d[_0xc8e5('0x67')],'predictiveIntervalAvgHoldtime':_0x339b9d[_0xc8e5('0x68')],'predictiveIntervalAvgTalktime':_0x339b9d[_0xc8e5('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x339b9d[_0xc8e5('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x339b9d[_0xc8e5('0x6b')],'predictiveIntervalErlangCalls':_0x339b9d[_0xc8e5('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x339b9d['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x339b9d[_0xc8e5('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x339b9d[_0xc8e5('0x6e')],'predictiveIntervalPauses':_0x339b9d[_0xc8e5('0x6f')],'predictiveIntervalAvailable':_0x339b9d['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x339b9d['predictiveIntervalTotalCalls'],'message':_0x339b9d[_0xc8e5('0x3f')],'originated':_0x339b9d[_0xc8e5('0x70')],'erlangCalls':_0x339b9d[_0xc8e5('0x71')],'erlangCallToSecond':_0x339b9d[_0xc8e5('0x72')],'erlangAbandonmentRate':_0x339b9d[_0xc8e5('0x73')],'erlangBusyFactor':_0x339b9d['erlangBusyFactor'],'startPredictive':_0x339b9d[_0xc8e5('0x2a')],'startProgressive':_0x339b9d[_0xc8e5('0x74')]};if(_0x339b9d[_0xc8e5('0x75')]){_0x19c16a[_0xc8e5('0x75')]={'id':_0x339b9d[_0xc8e5('0x75')]['id'],'name':_0x339b9d[_0xc8e5('0x75')]['name'],'active':_0x339b9d[_0xc8e5('0x75')][_0xc8e5('0x76')],'callerid':_0x339b9d[_0xc8e5('0x75')][_0xc8e5('0x77')]};}if(_0x339b9d[_0xc8e5('0x44')]){_0x19c16a['Interval']={'id':_0x339b9d[_0xc8e5('0x44')]['id'],'name':_0x339b9d[_0xc8e5('0x44')][_0xc8e5('0x41')]};}var _0x364e1c=md5(JSON['stringify'](_0x19c16a));if(_0x339b9d[_0xc8e5('0x4')]!==_0x364e1c){_0x339b9d[_0xc8e5('0x4')]=_0x364e1c;emit(util[_0xc8e5('0x78')]('voice:queue:%s',_0x19c16a[_0xc8e5('0x41')]),_0xc8e5('0x79'),_0x19c16a);}}}function emitCampaignSummary(_0x3478d1){if(_0x3478d1[_0xc8e5('0x55')]===_0xc8e5('0x7a')){emit(util[_0xc8e5('0x78')](_0xc8e5('0x7b'),_0x3478d1[_0xc8e5('0x41')]),_0xc8e5('0x7c'),_0x3478d1);}}function checkGetDataPredictive(_0x4b7cc8){if(isNotNull(_0x4b7cc8)){if(!_['isEmpty'](_0x4b7cc8)){loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x7e'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b7cc8[_0xc8e5('0x7f')]);loggerPredictive[_0xc8e5('0x7d')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b7cc8[_0xc8e5('0x67')]);loggerPredictive['info'](_0xc8e5('0x80'),_0x4b7cc8[_0xc8e5('0x6b')]);loggerPredictive[_0xc8e5('0x7d')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b7cc8['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x81'),_0x4b7cc8[_0xc8e5('0x68')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b7cc8[_0xc8e5('0x69')]);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x82'));if(_0x4b7cc8[_0xc8e5('0x7f')]>0x0){if(!_['isUndefined'](_0x4b7cc8[_0xc8e5('0x69')])&&_0x4b7cc8['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x83'));}if(!_[_0xc8e5('0x3e')](_0x4b7cc8[_0xc8e5('0x68')])&&_0x4b7cc8['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive['info'](_0xc8e5('0x84'));}}else{loggerPredictive[_0xc8e5('0x7d')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}}else{loggerPredictive['info'](_0xc8e5('0x85'));}return![];}function mergeDataErlangB(_0x4d9571){return function(_0xc3032b){loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x86'));loggerPredictive['info'](_0xc8e5('0x87'),_0xc3032b[_0xc8e5('0x71')]);loggerPredictive['info'](_0xc8e5('0x88'),_0xc3032b[_0xc8e5('0x72')]);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x89'),_0xc3032b[_0xc8e5('0x73')]);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x8a'),_0xc3032b[_0xc8e5('0x8b')]);loggerPredictive[_0xc8e5('0x7d')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc3032b[_0xc8e5('0x73')]);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x82'));_[_0xc8e5('0x8c')](_0x4d9571,_0xc3032b);};}function getDiff(_0x5e2609){var _0x22d4bc=moment()[_0xc8e5('0x4c')](0x0);var _0x26b769=moment(_0x5e2609)['milliseconds'](0x0);return _0x22d4bc[_0xc8e5('0x8d')](_0x26b769,_0xc8e5('0x4d'));}function ifInterval(_0x15c039,_0x522740){if(_[_0xc8e5('0x3e')](_0x522740)){return![];}if(getDiff(_0x522740)<_0x15c039*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xef0f4e){if(isNotNull(_0xef0f4e)){if(!_[_0xc8e5('0x3e')](_0xef0f4e[_0xc8e5('0x74')])){_0xef0f4e[_0xc8e5('0x74')]=undefined;loggerPredictive[_0xc8e5('0x7d')](_0xef0f4e[_0xc8e5('0x41')],_0xc8e5('0x8e'));}if(!_['isUndefined'](_0xef0f4e[_0xc8e5('0x2a')])){_0xef0f4e['startPredictive']=undefined;loggerPredictive['info'](_0xef0f4e[_0xc8e5('0x41')],_0xc8e5('0x8f'));}if(!_['isUndefined'](_0xef0f4e['handlePredictive'])){clearInterval(_0xef0f4e[_0xc8e5('0x90')]);_0xef0f4e[_0xc8e5('0x90')]=undefined;loggerPredictive[_0xc8e5('0x7d')](_0xef0f4e[_0xc8e5('0x41')],_0xc8e5('0x91'));}}}function erlangb(_0x5340b7,_0x3b01f0){if(_0x3b01f0===0x0){return 0x0;}var _0x306cc2=0x1;for(var _0x4028e0=0x1;_0x4028e0<=_0x3b01f0;_0x4028e0+=0x1){_0x306cc2=0x1+_0x306cc2*_0x4028e0/_0x5340b7;}return 0x1/_0x306cc2;}function isVoiceQueueOutbound(_0x3534df){return _0x3534df==='outbound';}function isNotPreview(_0x388199){return _0x388199!==_0xc8e5('0x20');}function isCampaignIvr(_0x1e4855){return _0x1e4855===_0xc8e5('0x7a');}function getCallerId(_0x4c3cb7,_0x356968,_0x310aab){if(!_[_0xc8e5('0x3e')](_0x310aab)&&_0xc8e5('0x92')===typeof _0x310aab&&!_[_0xc8e5('0x48')](_0x310aab)){if(!_['isUndefined'](_0x356968)&&'string'===typeof _0x356968&&!_[_0xc8e5('0x48')](_0x356968)){return util[_0xc8e5('0x78')](_0xc8e5('0x93'),_0x356968,_0x310aab);}return util['format'](_0xc8e5('0x93'),_0x310aab,_0x310aab);}if(!_[_0xc8e5('0x3e')](_0x4c3cb7)&&_0xc8e5('0x92')===typeof _0x4c3cb7&&!_[_0xc8e5('0x48')](_0x4c3cb7)){return _0x4c3cb7;}return _0xc8e5('0x94');}function loggerCatchQueueSummary(_0x2b412f,_0x3cb83a){return function(_0x50e84a){freeVariablesPredictive(_0x3cb83a);emitVoiceQueueSummary(_0x3cb83a);emitCampaignSummary(_0x3cb83a);loggerSyncQueueSummary[_0xc8e5('0x95')](_0x2b412f,util['inspect'](_0x50e84a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x52ec54,_0x25df2c){return function(_0x309bcf){loggerPredictive[_0xc8e5('0x95')](_0x25df2c['name'],_0x52ec54);loggerPredictive[_0xc8e5('0x95')](_0x309bcf[_0xc8e5('0x96')]);freeVariablesPredictive(_0x25df2c);};}function loggerCatch(_0x43be69){return function(_0x10710b){logger[_0xc8e5('0x95')](_0x43be69,util['inspect'](_0x10710b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2126c7){return _0x2126c7&&!_[_0xc8e5('0x3e')](_0x2126c7)&&_0x2126c7[_0xc8e5('0x97')]>0x0;}function decremetOriginate(_0x5e971e){if(!_[_0xc8e5('0x3e')](_0x5e971e)&&_0x5e971e!==null){if(_0x5e971e[_0xc8e5('0x98')](_0xc8e5('0x70'))){if(_0x5e971e[_0xc8e5('0x70')]>0x0){_0x5e971e['originated']-=0x1;}else{logger[_0xc8e5('0x95')](_0xc8e5('0x99'));}}}else{logger[_0xc8e5('0x95')](_0xc8e5('0x9a'));}}function checkContactLowerLimitOriginate(_0x40d3aa,_0x5e1bb7,_0xbd4afb){if(_0x5e1bb7>_0xbd4afb){for(var _0x19e9a4=0x0;_0x19e9a4<_0x5e1bb7-_0xbd4afb;_0x19e9a4+=0x1){decremetOriginate(_0x40d3aa);}}}function loggerGetContactDialer(_0x3a8e62,_0x350068,_0x47c83c){return function(_0x543c25){checkContactLowerLimitOriginate(_0x350068,_0x47c83c,0x0);logger[_0xc8e5('0x95')](_0x3a8e62,util[_0xc8e5('0x9b')](_0x543c25,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x661957){return function(_0x384105){if(isNotNull(_0x384105)&&isNotNull(_0x384105[0x0])){if(_0x384105[0x0]['contactsRescheduled']>0x0){_0x661957[_0xc8e5('0x3f')]=_0xc8e5('0x9c');logger[_0xc8e5('0x7d')](_0xc8e5('0x9d')+_0x661957['name'],_0x384105[0x0][_0xc8e5('0x9e')],'contacts');}else{_0x661957['message']=_0xc8e5('0x9f');logger['info']('[getContactDialer2][Empty]'+_0x661957[_0xc8e5('0x41')]);}}};}function notSendMessagesQueue(_0x511883){if(_0x511883[_0xc8e5('0xa0')]){freeVariablesPredictive(_0x511883);if(_0x511883['originated']===0x0&&_0x511883[_0xc8e5('0x54')]===0x0&&_0x511883[_0xc8e5('0xa1')]===0x0&&(_0x511883[_0xc8e5('0xa2')]||0x0)===0x0){_0x511883[_0xc8e5('0xa0')]=![];_0x511883['available']=0x0;_0x511883[_0xc8e5('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xc8e5('0x95')](_0xc8e5('0xa3'),_0x511883['name'],_0xc8e5('0xa4'));}else{_0x511883[_0xc8e5('0x3f')]=_0xc8e5('0xa5');loggerSyncQueueSummary['error'](_0xc8e5('0xa3'),_0x511883[_0xc8e5('0x41')],_0xc8e5('0xa6'));}emitVoiceQueueSummary(_0x511883);}}function notSendMessagesCampaign(_0x91bf7e){if(_0x91bf7e[_0xc8e5('0xa0')]){if(_0x91bf7e[_0xc8e5('0x70')]===0x0){_0x91bf7e[_0xc8e5('0xa0')]=![];_0x91bf7e[_0xc8e5('0x3f')]=_0xc8e5('0xa7');loggerSyncQueueSummary['error'](_0xc8e5('0xa8'),_0x91bf7e['name'],_0xc8e5('0xa4'));}else{_0x91bf7e[_0xc8e5('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xc8e5('0x95')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x91bf7e[_0xc8e5('0x41')],'is\x20disactive');}emitCampaignSummary(_0x91bf7e);}}function createObjHistory(_0x44dad4,_0xca9060,_0x5419f6,_0x5cfa00,_0x2f3753){_0x44dad4[_0xc8e5('0x3f')]=_0x5419f6;var _0x5f5c0f=new Action(_0x44dad4,_0xca9060);var _0x515109=new History(_0x5f5c0f);_0x515109[_0xc8e5('0xa9')]=_0x5cfa00;_0x515109[_0xc8e5('0xaa')]=_0x2f3753;_0x515109['endtime']=_0x5f5c0f[_0xc8e5('0xab')];return _0x515109;}Dialer[_0xc8e5('0x1b')]['loopClearZombieChannels']=function(){var _0x47b022=this;setInterval(function(){_0x47b022['clearZombieChannels'](_0x47b022[_0xc8e5('0xac')],_0xc8e5('0xad'));_0x47b022[_0xc8e5('0xae')](_0x47b022[_0xc8e5('0x27')],'[actions]');},0x32c8);};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xae')]=function(_0x1ae0c9,_0x4273e4){var _0x218c70=this;for(var _0x1e5886 in _0x1ae0c9){if(_0x1ae0c9['hasOwnProperty'](_0x1e5886)){this[_0xc8e5('0x1f')][_0xc8e5('0x1c')](function(){if(!_[_0xc8e5('0xaf')](_0x1ae0c9[_0x1e5886])){return ami[_0xc8e5('0xb0')]({'action':_0xc8e5('0xb1'),'channel':_0x1ae0c9[_0x1e5886]['channel']})['catch'](function(_0x2d62f3){if(_0x2d62f3[_0xc8e5('0x3f')]===_0xc8e5('0xb2')){setTimeout(function(){if(_0x1ae0c9[_0x1e5886]&&_0x1ae0c9[_0x1e5886]['type']!=='ivr'){_0x218c70[_0xc8e5('0xb3')](_0x218c70['voiceQueues'][_0x1ae0c9[_0x1e5886][_0xc8e5('0xb4')]]);logger[_0xc8e5('0x95')](_0xc8e5('0xb5'),_0x4273e4,_0x1e5886,_0x1ae0c9[_0x1e5886]['queue']);delete _0x1ae0c9[_0x1e5886];}if(_0x1ae0c9[_0x1e5886]&&_0x1ae0c9[_0x1e5886]['type']===_0xc8e5('0x7a')){_0x218c70['updateOriginated'](_0x218c70['campaigns'][_0x1ae0c9[_0x1e5886]['queue']]);logger['error']('[Dialer][checkChannel][ivr]',_0x4273e4,_0x1e5886,_0x1ae0c9[_0x1e5886]['queue']);delete _0x1ae0c9[_0x1e5886];}},0x2328);}});}});}}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xb6')]=function(_0x306f25){return BPromise[_0xc8e5('0xb7')]()['then'](cmHopper[_0xc8e5('0xb6')](_0x306f25))['catch'](loggerCatch(_0xc8e5('0xb8')));};Dialer[_0xc8e5('0x1b')]['checkIsBlackList']=function(_0x3ffb86){return BPromise['resolve']()['then'](cmHopperBlack[_0xc8e5('0xb9')](_0x3ffb86))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xbb')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xbc')]=function(_0x4b6b37){return BPromise['resolve']()[_0xc8e5('0xbd')](cmHopperBlack['checkIsBlackListIvr'](_0x4b6b37))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xbe')));};Dialer['prototype']['averageHandleTime']=function(_0x58419d){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopperHistory[_0xc8e5('0xbf')](_0x58419d))['catch'](loggerCatch(_0xc8e5('0xc0')));};Dialer['prototype'][_0xc8e5('0xc1')]=function(_0x182381){return BPromise['resolve']()[_0xc8e5('0xbd')](cmHopper['rescheduleContact'](_0x182381))['catch'](loggerCatch(_0xc8e5('0xc2')));};Dialer[_0xc8e5('0x1b')]['unlockContact']=function(_0x51073e,_0x4c2ad9,_0x159389){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopper[_0xc8e5('0xc3')](_0x51073e,_0x4c2ad9,_0x159389))['catch'](loggerCatch(_0xc8e5('0xc4')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xc5')]=function(_0x4bc0bc,_0x371e69,_0x59cf6b,_0x442618){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopper[_0xc8e5('0xc5')](_0x4bc0bc,_0x371e69,_0x59cf6b,_0x442618))['catch'](loggerCatch(_0xc8e5('0xc6')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xc7')]=function(_0x39183f,_0xfc2d72,_0x46cb86){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopper[_0xc8e5('0xc7')](_0x39183f,_0xfc2d72,_0x46cb86))['catch'](loggerCatch(_0xc8e5('0xc6')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xc8')]=function(_0x35cb30){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](voiceQueueRt[_0xc8e5('0xc8')](_0x35cb30))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xc9')));};Dialer['prototype'][_0xc8e5('0xca')]=function(_0x1a793e){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopper['moveContactManagedDialer'](_0x1a793e))[_0xc8e5('0xba')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xc8e5('0x1b')]['createHistory']=function(_0x3bab4f){return BPromise[_0xc8e5('0xb7')]()['then'](cmHopperHistory[_0xc8e5('0xcb')](_0x3bab4f))['catch'](loggerCatch(_0xc8e5('0xcc')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xb3')]=function(_0x4f76ee){if(!_['isUndefined'](_0x4f76ee)&&_0x4f76ee!==null){if(_0x4f76ee[_0xc8e5('0x98')](_0xc8e5('0x70'))){if(_0x4f76ee[_0xc8e5('0x70')]>0x0){_0x4f76ee['originated']-=0x1;}else{logger[_0xc8e5('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xc8e5('0x95')](_0xc8e5('0xcd'));}};Dialer['prototype']['loggerHandler']=function(_0x1b73e0,_0x457a88){var _0x3aef7e=this;return function(_0xa1caad){_0x3aef7e[_0xc8e5('0xb3')](_0x457a88);logger[_0xc8e5('0x95')](_0x1b73e0,util[_0xc8e5('0x9b')](_0xa1caad,{'showHidden':![],'depth':null}));};};Dialer[_0xc8e5('0x1b')]['emptyContact']=function(_0x2af8a0,_0x534097,_0x393da4){var _0x3e4726={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x534097);this['saveInDb'](_['merge'](_0x3e4726,_[_0xc8e5('0xce')](_0x393da4,[_0xc8e5('0xcf'),_0xc8e5('0xd0'),'UserId',_0xc8e5('0xd1'),_0xc8e5('0xd2')])),_0xc8e5('0xd3'),_0xc8e5('0xd4'));logger[_0xc8e5('0x95')](_0x2af8a0);};Dialer[_0xc8e5('0x1b')]['isSuccess']=function(_0x51dba8){return _0x51dba8==='Success';};Dialer[_0xc8e5('0x1b')]['isTrunkReachable']=function(_0x7534ff){return!_['isUndefined'](_0x7534ff)&&_0x7534ff&&!_[_0xc8e5('0x3e')](_0x7534ff[_0xc8e5('0x41')])&&!_[_0xc8e5('0x3e')](_0x7534ff['active'])&&_0x7534ff[_0xc8e5('0x76')]&&(this['trunks'][util[_0xc8e5('0x78')]('SIP/%s',_0x7534ff[_0xc8e5('0x41')])][_0xc8e5('0xb1')]===_0xc8e5('0xd5')||this[_0xc8e5('0x24')][util[_0xc8e5('0x78')](_0xc8e5('0xd6'),_0x7534ff['name'])]['status']===_0xc8e5('0xd7'));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xd8')]=function(_0x15bce3,_0x2bd65d,_0x249d90){this[_0xc8e5('0xcb')](_0x15bce3)[_0xc8e5('0xba')](loggerCatch(_0x2bd65d));this[_0xc8e5('0xca')](_0x15bce3)['catch'](loggerCatch(_0x249d90));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x38')]=function(_0x58b76f){var _0x3f245c=this[_0xc8e5('0xac')][_0x58b76f['uniqueid']];var _0x5f2283;if(!_['isNil'](_0x58b76f)&&!_[_0xc8e5('0xaf')](_0x58b76f[_0xc8e5('0xd9')])&&!_[_0xc8e5('0xaf')](_0x58b76f['variable'][_0xc8e5('0xda')])&&_0x58b76f[_0xc8e5('0xdb')]===_0xc8e5('0xdc')&&_0x3f245c){if(_0x3f245c['type']!=='ivr'&&this[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0xdd')]&&_0x58b76f['value']===_0xc8e5('0xde')){delete this['uniqueId'][_0x58b76f[_0xc8e5('0xdf')]];this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]]);this[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;this['voiceQueues'][_0x3f245c[_0xc8e5('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x5f2283=new Hangup(_0x3f245c,_0x58b76f);_0x5f2283[_0xc8e5('0xa9')]=0x12;_0x5f2283['statedesc']=_0xc8e5('0xe0');_0x5f2283[_0xc8e5('0xe1')]='AMD';this[_0xc8e5('0xd8')](_0x5f2283,_0xc8e5('0xe2'),_0xc8e5('0xe3'));}if(_0x3f245c['type']!==_0xc8e5('0x7a')&&this[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0xdd')]&&_0x58b76f[_0xc8e5('0xe4')]===_0xc8e5('0xe5')){var _0x582249=this;return new BPromise(function(_0x3f88ea,_0x3f834d){delete _0x582249[_0xc8e5('0xac')][_0x58b76f[_0xc8e5('0xdf')]];_0x582249[_0xc8e5('0xb3')](_0x582249[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]]);_0x582249['voiceQueues'][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;_0x582249[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0x5c')]+=0x1;var _0x223397=_0x582249[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]];var _0x1e0026=new Hangup(_0x3f245c,_0x58b76f);_0x1e0026[_0xc8e5('0xa9')]=0x13;_0x1e0026[_0xc8e5('0xaa')]=_0xc8e5('0xe6');_0x1e0026[_0xc8e5('0xe1')]='AMD';_0x1e0026['countmachineretry']+=0x1;_0x1e0026[_0xc8e5('0xe7')]+=0x1;_0x1e0026['amd']=!![];_0x582249[_0xc8e5('0xcb')](_0x1e0026)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xe8')));if(_0x1e0026[_0xc8e5('0xe9')]+_0x1e0026['countcongestionretry']+_0x1e0026[_0xc8e5('0xea')]+_0x1e0026[_0xc8e5('0xeb')]+_0x1e0026[_0xc8e5('0xec')]+_0x1e0026['countabandonedretry']+_0x1e0026[_0xc8e5('0xed')]+_0x1e0026[_0xc8e5('0xee')]>=_0x223397[_0xc8e5('0xef')]){_0x582249[_0xc8e5('0xf0')](_0x1e0026,_0x3f88ea,_0x3f834d,_0xc8e5('0xf1'));}else{if(_0x1e0026[_0xc8e5('0xed')]>=_0x223397[_0xc8e5('0xf2')]){_0x582249[_0xc8e5('0xf3')](_0x1e0026,_0x3f88ea,_0x3f834d,'reason\x2019\x20machine....');}else{_0x582249[_0xc8e5('0xc1')]({'active':![],'countmachineretry':_0x1e0026['countmachineretry'],'scheduledat':moment()[_0xc8e5('0xf4')](_0x223397['dialMachineRetryFrequency'],_0xc8e5('0xf5'))['format'](_0xc8e5('0xf6')),'ContactId':_0x1e0026[_0xc8e5('0xcf')],'ListId':_0x1e0026['ListId'],'VoiceQueueId':_0x1e0026[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x1e0026[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xf7')));_0x3f88ea({'reschedule':0x1});}}});}if(_0x3f245c['type']===_0xc8e5('0x7a')&&this[_0xc8e5('0x22')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0xdd')]&&_0x58b76f['value']===_0xc8e5('0xde')){delete this['uniqueId'][_0x58b76f[_0xc8e5('0xdf')]];this['updateOriginated'](this['campaigns'][_0x3f245c[_0xc8e5('0xb4')]]);_0x5f2283=new Hangup(_0x3f245c,_0x58b76f);_0x5f2283['state']=0x12;_0x5f2283['statedesc']='HangupInAMD';_0x5f2283[_0xc8e5('0xe1')]=_0xc8e5('0xf8');this[_0xc8e5('0xd8')](_0x5f2283,_0xc8e5('0xf9'),'[syncHangupInAMDIvr]');}if(_0x3f245c['type']===_0xc8e5('0x7a')&&this[_0xc8e5('0x22')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0xdd')]&&_0x58b76f['value']===_0xc8e5('0xe5')){var _0x582249=this;return new BPromise(function(_0xfaa75,_0x368744){delete _0x582249['uniqueId'][_0x58b76f[_0xc8e5('0xdf')]];_0x582249[_0xc8e5('0xb3')](_0x582249['campaigns'][_0x3f245c[_0xc8e5('0xb4')]]);_0x582249[_0xc8e5('0x22')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;_0x582249[_0xc8e5('0x22')][_0x3f245c['queue']][_0xc8e5('0x5c')]+=0x1;var _0x35d6dd=_0x582249[_0xc8e5('0x22')][_0x3f245c[_0xc8e5('0xb4')]];var _0xb9a34d=new Hangup(_0x3f245c,_0x58b76f);_0xb9a34d['state']=0x13;_0xb9a34d[_0xc8e5('0xaa')]=_0xc8e5('0xe6');_0xb9a34d[_0xc8e5('0xe1')]=_0xc8e5('0xf8');_0xb9a34d[_0xc8e5('0xed')]+=0x1;_0xb9a34d[_0xc8e5('0xe7')]+=0x1;_0xb9a34d[_0xc8e5('0xfa')]=!![];_0x582249[_0xc8e5('0xcb')](_0xb9a34d)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xe8')));if(_0xb9a34d[_0xc8e5('0xe9')]+_0xb9a34d[_0xc8e5('0xfb')]+_0xb9a34d[_0xc8e5('0xea')]+_0xb9a34d[_0xc8e5('0xeb')]+_0xb9a34d['countdropretry']+_0xb9a34d['countabandonedretry']+_0xb9a34d['countmachineretry']+_0xb9a34d['countagentrejectretry']>=_0x35d6dd['dialGlobalMaxRetry']){_0x582249[_0xc8e5('0xf0')](_0xb9a34d,_0xfaa75,_0x368744,_0xc8e5('0xf1'));}else{if(_0xb9a34d['countmachineretry']>=_0x35d6dd[_0xc8e5('0xf2')]){_0x582249[_0xc8e5('0xf3')](_0xb9a34d,_0xfaa75,_0x368744,_0xc8e5('0xfc'));}else{_0x582249['rescheduleContact']({'active':![],'countmachineretry':_0xb9a34d['countmachineretry'],'scheduledat':moment()['add'](_0x35d6dd[_0xc8e5('0xfd')],_0xc8e5('0xf5'))[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb9a34d[_0xc8e5('0xcf')],'ListId':_0xb9a34d[_0xc8e5('0xd0')],'VoiceQueueId':_0xb9a34d[_0xc8e5('0xd1')]||undefined,'CampaignId':_0xb9a34d[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch('[rescheduleContact][Machine]'));_0xfaa75({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xc8e5('0x36')]=function(_0xf03a78){var _0x3c84a4=this['uniqueId'][_0xf03a78[_0xc8e5('0xdf')]];var _0x3143d6=this;var _0x14d1b3;if(_0x3c84a4&&_0x3c84a4[_0xc8e5('0x55')]===_0xc8e5('0x7a')){delete this['uniqueId'][_0xf03a78['uniqueid']];this[_0xc8e5('0xb3')](this[_0xc8e5('0x22')][_0x3c84a4[_0xc8e5('0xb4')]]);this[_0xc8e5('0x22')][_0x3c84a4['queue']][_0xc8e5('0xfe')]+=0x1;_0x14d1b3=new Hangup(_0x3c84a4,_0xf03a78);this[_0xc8e5('0xcb')](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xff')));this[_0xc8e5('0xca')](_0x14d1b3)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x3c84a4&&_0x3c84a4[_0xc8e5('0x55')]!==_0xc8e5('0x7a')&&isNotNull(this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]]['dialQueueProject'])){delete this[_0xc8e5('0xac')][_0xf03a78[_0xc8e5('0xdf')]];this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]]);this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]][_0xc8e5('0x5c')]+=0x1;_0x14d1b3=new Hangup(_0x3c84a4,_0xf03a78);_0x14d1b3[_0xc8e5('0xa9')]=0x10;_0x14d1b3[_0xc8e5('0xaa')]=_0xc8e5('0x100');_0x14d1b3[_0xc8e5('0xe1')]=_0xc8e5('0x101');this[_0xc8e5('0xcb')](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xff')));this[_0xc8e5('0xca')](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x102')));}if(_0x3c84a4&&_0x3c84a4[_0xc8e5('0x55')]!=='ivr'&&!isNotNull(this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]][_0xc8e5('0x103')])){delete this['uniqueId'][_0xf03a78[_0xc8e5('0xdf')]];this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]]);this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0x14d1b3=new Hangup(_0x3c84a4,_0xf03a78);_0x14d1b3[_0xc8e5('0xa9')]=0xc;_0x14d1b3[_0xc8e5('0xaa')]=_0xf03a78[_0xc8e5('0x104')];_0x14d1b3[_0xc8e5('0xe1')]=_0xc8e5('0x105');this['createHistory'](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xff')));this[_0xc8e5('0xca')](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x102')));}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x33')]=function(_0xf53f83){var _0x370dcf=this['uniqueId'][_0xf53f83[_0xc8e5('0xdf')]];var _0x5eada8=this;if(this[_0xc8e5('0x21')][_0xf53f83[_0xc8e5('0xb4')]]){if(_0x370dcf&&_0x370dcf[_0xc8e5('0x55')]!==_0xc8e5('0x7a')){delete this['uniqueId'][_0xf53f83['uniqueid']];this[_0xc8e5('0x21')][_0xf53f83[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;var _0x9c4c1f=new AgentComplete(_0x370dcf,_0xf53f83);if(_0xf53f83[_0xc8e5('0x106')]==='agent'){_0x9c4c1f['agiafterat']=this['voiceQueues'][_0xf53f83[_0xc8e5('0xb4')]]['dialQueueProject2']&&this[_0xc8e5('0x21')][_0xf53f83[_0xc8e5('0xb4')]][_0xc8e5('0x107')]?moment()[_0xc8e5('0x78')](_0xc8e5('0xf6')):undefined;}this['createHistory'](_0x9c4c1f)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x108')));this[_0xc8e5('0xca')](_0x9c4c1f)[_0xc8e5('0xba')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xc8e5('0x1b')]['syncAgentConnect']=function(_0x4269e1){if(this['voiceQueues'][_0x4269e1['queue']]){if(this[_0xc8e5('0xac')][_0x4269e1[_0xc8e5('0xdf')]]&&this[_0xc8e5('0xac')][_0x4269e1[_0xc8e5('0xdf')]]['type']!==_0xc8e5('0x7a')){this['updateOriginated'](this[_0xc8e5('0x21')][_0x4269e1[_0xc8e5('0xb4')]]);this[_0xc8e5('0xac')][_0x4269e1[_0xc8e5('0xdf')]][_0xc8e5('0x109')]=moment()['format'](_0xc8e5('0xf6'));}}};Dialer['prototype'][_0xc8e5('0x10a')]=function(_0x52bde1){this[_0xc8e5('0xcb')](_0x52bde1)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x108')));this['moveContactManagedDialer'](_0x52bde1)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x10b')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x30')]=function(_0x6b3ff7){var _0x5768c8=this[_0xc8e5('0xac')][_0x6b3ff7[_0xc8e5('0xdf')]];var _0x5dc830=this;if(this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]]){if(_0x5768c8&&_0x5768c8[_0xc8e5('0x55')]!==_0xc8e5('0x7a')){delete this[_0xc8e5('0xac')][_0x6b3ff7['uniqueid']];this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]]);_0x5768c8['droptime']=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));var _0x1aa1c8=new QueueCallerAbandon(_0x5768c8,_0x6b3ff7);if(getSeconds(_0x5768c8[_0xc8e5('0x10c')],_0x5768c8[_0xc8e5('0x10d')])>=_0x5768c8['dialQueueTimeout']){this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]][_0xc8e5('0x6b')]+=0x1;this['voiceQueues'][_0x6b3ff7[_0xc8e5('0xb4')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]][_0xc8e5('0x10e')]+=0x1;_0x1aa1c8['state']=0xa;_0x1aa1c8[_0xc8e5('0xaa')]=_0xc8e5('0x10f');_0x1aa1c8['dropreason']='TIMEOUT';_0x1aa1c8[_0xc8e5('0x110')]=this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]][_0xc8e5('0x111')]?moment()['format'](_0xc8e5('0xf6')):undefined;_0x1aa1c8[_0xc8e5('0xec')]+=0x1;_0x1aa1c8[_0xc8e5('0xe7')]+=0x1;if(_0x1aa1c8['countdropretry']>=this[_0xc8e5('0x21')][_0x6b3ff7['queue']]['dialDropMaxRetry']){this[_0xc8e5('0x10a')](_0x1aa1c8);}else{this[_0xc8e5('0xc1')]({'active':![],'countdropretry':_0x1aa1c8['countdropretry'],'scheduledat':moment()[_0xc8e5('0xf4')](this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]]['dialDropRetryFrequency'],_0xc8e5('0xf5'))[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5768c8[_0xc8e5('0xcf')],'ListId':_0x5768c8[_0xc8e5('0xd0')],'VoiceQueueId':_0x5768c8[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x5768c8[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x112')));var _0x3fc625=new History(_0x1aa1c8);_0x3fc625['state']=0xa;_0x3fc625[_0xc8e5('0xaa')]=_0xc8e5('0x10f');_0x3fc625['starttime']=moment()[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x3fc625['endtime']=_0x3fc625[_0xc8e5('0xab')];_0x3fc625[_0xc8e5('0x113')]=_0x1aa1c8[_0xc8e5('0x113')];_0x3fc625[_0xc8e5('0x114')]=_0x1aa1c8[_0xc8e5('0x114')];this[_0xc8e5('0xcb')](_0x3fc625)[_0xc8e5('0xba')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xc8e5('0x21')][_0x6b3ff7['queue']][_0xc8e5('0x6a')]+=0x1;this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]][_0xc8e5('0x115')]+=0x1;_0x1aa1c8['state']=0xb;_0x1aa1c8[_0xc8e5('0xaa')]=_0xc8e5('0x116');_0x1aa1c8[_0xc8e5('0x117')]=_0xc8e5('0x118');_0x1aa1c8['countabandonedretry']+=0x1;_0x1aa1c8['countglobal']+=0x1;if(_0x1aa1c8['countabandonedretry']>=this[_0xc8e5('0x21')][_0x6b3ff7['queue']][_0xc8e5('0x119')]){this['queueCallerAbandonCreateState'](_0x1aa1c8);}else{this[_0xc8e5('0xc1')]({'active':![],'countabandonedretry':_0x1aa1c8[_0xc8e5('0x11a')],'scheduledat':moment()[_0xc8e5('0xf4')](this[_0xc8e5('0x21')][_0x6b3ff7['queue']][_0xc8e5('0x11b')],_0xc8e5('0xf5'))[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5768c8[_0xc8e5('0xcf')],'ListId':_0x5768c8[_0xc8e5('0xd0')],'VoiceQueueId':_0x5768c8[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x5768c8[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x11c')));var _0x3fc625=new History(_0x1aa1c8);_0x3fc625['state']=0xb;_0x3fc625['statedesc']=_0xc8e5('0x116');_0x3fc625[_0xc8e5('0xab')]=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));_0x3fc625[_0xc8e5('0x11d')]=_0x3fc625[_0xc8e5('0xab')];_0x3fc625[_0xc8e5('0x113')]=_0x1aa1c8[_0xc8e5('0x113')];_0x3fc625[_0xc8e5('0x114')]=_0x1aa1c8['calleridnum'];this[_0xc8e5('0xcb')](_0x3fc625)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x11e')));}}}}};Dialer['prototype'][_0xc8e5('0x11f')]=function(_0xb45599){if(this['actions'][_0xb45599[_0xc8e5('0xdf')]]){this[_0xc8e5('0x27')][_0xb45599[_0xc8e5('0xdf')]][_0xc8e5('0x120')]=_0xb45599[_0xc8e5('0x120')];}if(this[_0xc8e5('0xac')][_0xb45599[_0xc8e5('0xdf')]]){this[_0xc8e5('0xac')][_0xb45599[_0xc8e5('0xdf')]][_0xc8e5('0x120')]=_0xb45599[_0xc8e5('0x120')];}};Dialer[_0xc8e5('0x1b')]['syncQueueMember']=function(_0xa477a3){if(strategy[this[_0xc8e5('0x21')][this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0xb4')]][_0xc8e5('0x4f')]]==='roundrobin'){if(this['actions'][_0xa477a3[_0xc8e5('0x121')]]&&_['isNil'](this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0x122')])&&_0xa477a3[_0xc8e5('0xb1')]==='1'&&_0xa477a3[_0xc8e5('0x123')]==='0'){if(this['agents'][_0xa477a3['stateinterface']]){if(!this['agents'][_0xa477a3['stateinterface']][_0xc8e5('0x122')]){this['agents'][_0xa477a3[_0xc8e5('0x124')]]['locked']=!![];this[_0xc8e5('0x27')][_0xa477a3[_0xc8e5('0x121')]]['locked']=!![];this['actions'][_0xa477a3[_0xc8e5('0x121')]]['stateinterface']=_0xa477a3[_0xc8e5('0x124')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]['strategy']]||'rrmemory')===_0xc8e5('0x19')){if(this[_0xc8e5('0x27')][_0xa477a3[_0xc8e5('0x121')]]){if(this['agents'][_0xa477a3[_0xc8e5('0x124')]]){this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0x124')]=_0xa477a3[_0xc8e5('0x124')];if(_[_0xc8e5('0xaf')](this[_0xc8e5('0x2c')][this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0xb4')]])){this['queueBooked'][this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]=[];}this[_0xc8e5('0x2c')][this[_0xc8e5('0x27')][_0xa477a3[_0xc8e5('0x121')]]['queue']][_0xc8e5('0x125')](_['merge'](_[_0xc8e5('0xce')](this[_0xc8e5('0x27')][_0xa477a3[_0xc8e5('0x121')]],[_0xc8e5('0x126'),'stateinterface']),{'status':_0xa477a3['status'],'paused':_0xa477a3[_0xc8e5('0x123')]}));}}}};function unlockQueueStatus(_0x586e7b,_0x58107c){setTimeout(function(){if(_[_0xc8e5('0x3e')](_0x586e7b[_0xc8e5('0x127')])){loggerBooked[_0xc8e5('0x95')](_0xc8e5('0x128'),_0x58107c);}_0x586e7b[_0xc8e5('0x127')]=!![];loggerBooked[_0xc8e5('0x7d')](_0xc8e5('0x129'),_0x58107c,JSON[_0xc8e5('0x4b')](_[_0xc8e5('0xce')](_0x586e7b,[_0xc8e5('0x41'),_0xc8e5('0x127')])));},0x1f3);}Dialer[_0xc8e5('0x1b')][_0xc8e5('0x3c')]=function(_0x1c8eaf){var _0x212af0=this;var _0x1594aa=_0x212af0[_0xc8e5('0x21')][_0x212af0[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]];if(strategy[this['voiceQueues'][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]][_0xc8e5('0x4f')]]===_0xc8e5('0x1a')){if(this['actions'][_0x1c8eaf[_0xc8e5('0x121')]]&&this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0x124')]){this[_0xc8e5('0x20')][_0xc8e5('0x12a')](this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0x126')],this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0x124')])[_0xc8e5('0xba')](function(_0x16c1ee){logger[_0xc8e5('0x95')](_0xc8e5('0x12b'),util[_0xc8e5('0x9b')](_0x16c1ee,{'showHidden':![],'depth':null}));})[_0xc8e5('0x1e')](function(){_0x212af0[_0xc8e5('0xb3')](_0x212af0[_0xc8e5('0x21')][_0x212af0[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]);_0x212af0[_0xc8e5('0x23')][_0x212af0['actions'][_0x1c8eaf[_0xc8e5('0x121')]]['stateinterface']][_0xc8e5('0x122')]=![];delete _0x212af0[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]];unlockQueueStatus(_0x1594aa);});}else{this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]);this[_0xc8e5('0xc1')]({'active':![],'ContactId':this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]]['ContactId'],'ListId':this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0xd0')],'VoiceQueueId':this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xd1')]||undefined,'CampaignId':this['actions'][_0x1c8eaf['actionid']][_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]];unlockQueueStatus(_0x1594aa);}}else if((strategy[this[_0xc8e5('0x21')][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]['strategy']]||_0xc8e5('0x19'))===_0xc8e5('0x19')){var _0x3468d8;if(this[_0xc8e5('0x27')][_0x1c8eaf['actionid']]&&!_[_0xc8e5('0x48')](this[_0xc8e5('0x2c')][this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0xb4')]])){if(this[_0xc8e5('0x2d')][_0x212af0[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]){this[_0xc8e5('0x2d')][_0x212af0['actions'][_0x1c8eaf['actionid']][_0xc8e5('0xb4')]]=this[_0xc8e5('0x2d')][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]?this[_0xc8e5('0x2d')][this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0xb4')]]:this[_0xc8e5('0x2c')][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]]['queue']]?this['queueBooked'][this['actions'][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]][_0xc8e5('0x12c')]||0x0:0x0;}this[_0xc8e5('0x2c')][this['actions'][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]['_rr']=this[_0xc8e5('0x2d')][this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0xb4')]];for(var _0x5b706d=0x0;_0x5b706d=0x0?!![]:![];})[_0xc8e5('0xba')](myreject(_0x4330f2)));}}else{_0x4e477e[_0xc8e5('0x125')](ami[_0xc8e5('0xb0')]({'action':'command','command':util[_0xc8e5('0x78')](_0xc8e5('0x147'),_0x55b6ef,!_[_0xc8e5('0x3e')](config[_0xc8e5('0x142')][_0x31e00d])?_0x31e00d:'')})[_0xc8e5('0xbd')](function(_0x5c6678){return _0x5c6678[_0xc8e5('0x148')][_0xc8e5('0x146')]('true')>=0x0?!![]:![];})[_0xc8e5('0xba')](myreject(_0x4330f2)));}BPromise[_0xc8e5('0x149')](_0x4e477e)[_0xc8e5('0xbd')](function(_0x3a0cda){var _0x5055b2=_[_0xc8e5('0x14a')](_0x3a0cda);if(_0x5055b2){return _0x3354cf(_0x5055b2);}else{_0x1bd3ac[_0xc8e5('0x3f')]=_0x3f2dd0?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x4330f2(msgResponse(_0xc8e5('0x14b'),'Failure',_0xc8e5('0x14c')+_0x3f2dd0+'\x20'+_0x5de835+_0xc8e5('0x14d')+util[_0xc8e5('0x9b')](_0x55b6ef,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x31e00d));}})[_0xc8e5('0xba')](function(_0x22ec80){return _0x4330f2(msgResponse(_0xc8e5('0x13d'),_0xc8e5('0x13e'),JSON[_0xc8e5('0x4b')](_0x22ec80)));});});};Dialer['prototype']['checkDialMethod']=function(_0x4f5459){var _0x2cbfef=this;return function(){switch(_0x4f5459['dialMethod']){case'progressive':freeVariablesPredictive(_0x4f5459);_0x2cbfef[_0xc8e5('0x14e')](_0x4f5459,0x1);break;case _0xc8e5('0x14f'):freeVariablesPredictive(_0x4f5459);_0x2cbfef[_0xc8e5('0x14e')](_0x4f5459,_0x4f5459[_0xc8e5('0x150')]);break;case'predictive':_0x2cbfef['predictive'](_0x4f5459);break;case _0xc8e5('0x151'):freeVariablesPredictive(_0x4f5459);_0x2cbfef[_0xc8e5('0x14e')](_0x4f5459,0x1);break;default:freeVariablesPredictive(_0x4f5459);logger['error'](_0xc8e5('0x152'),_0x4f5459[_0xc8e5('0x41')],_0xc8e5('0x153'));}};};Dialer[_0xc8e5('0x1b')]['launchHandleIvr']=function(_0x14cf40){var _0x4ef13e=this;return function(){_0x4ef13e[_0xc8e5('0x154')](_0x14cf40);};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xc')]=function(_0x2b32da){var _0x2520f5=this;if(isNotPreview(_0x2b32da['dialMethod'])){if(isVoiceQueueOutbound(_0x2b32da[_0xc8e5('0x55')])&&isActive(_0x2b32da[_0xc8e5('0x58')])){_0x2b32da['sendMessageOneNotActive']=!![];BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](checkIsLoggedIn(_0x2b32da,_0x2b32da[_0xc8e5('0x52')]))[_0xc8e5('0xbd')](checkIsActive(_0x2b32da,_0x2b32da['dialActive']))[_0xc8e5('0xbd')](checkInterval(_0x2b32da))['then'](_0x2520f5[_0xc8e5('0x138')](_0x2b32da))[_0xc8e5('0xbd')](_0x2520f5['checkIfTime'](_0x2b32da[_0xc8e5('0x155')],_0x2b32da[_0xc8e5('0x156')],_0x2b32da['name'],_0x2b32da))[_0xc8e5('0xbd')](_0x2520f5['checkIfTimeIntervals'](_0x2b32da[_0xc8e5('0x44')],_0x2b32da['dialTimezone'],_0x2b32da['name'],_0x2b32da))[_0xc8e5('0xbd')](_0x2520f5[_0xc8e5('0x157')](_0x2b32da))['catch'](loggerCatchQueueSummary(_0xc8e5('0x158'),_0x2b32da));}else{notSendMessagesQueue(_0x2b32da);}}else{freeVariablesPredictive(_0x2b32da);}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x137')]=function(){var _0x39ab45=this;var _0x486cd2;for(var _0x535e49 in this['campaigns']){if(this[_0xc8e5('0x22')][_0xc8e5('0x98')](_0x535e49)){_0x486cd2=this['campaigns'][_0x535e49];if(isCampaignIvr(_0x486cd2[_0xc8e5('0x55')])&&isActive(_0x486cd2['active'])){_0x486cd2[_0xc8e5('0xa0')]=!![];BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](checkIsActive(_0x486cd2,_0x486cd2[_0xc8e5('0x76')]))[_0xc8e5('0xbd')](checkInterval(_0x486cd2))[_0xc8e5('0xbd')](_0x39ab45[_0xc8e5('0x138')](_0x486cd2))[_0xc8e5('0xbd')](_0x39ab45[_0xc8e5('0x159')](_0x486cd2['dialGlobalInterval'],_0x486cd2[_0xc8e5('0x156')],_0x486cd2['name'],_0x486cd2))[_0xc8e5('0xbd')](_0x39ab45[_0xc8e5('0x13c')](_0x486cd2[_0xc8e5('0x44')],_0x486cd2[_0xc8e5('0x156')],_0x486cd2['name'],_0x486cd2))[_0xc8e5('0xbd')](_0x39ab45[_0xc8e5('0x15a')](_0x486cd2))['catch'](loggerCatchQueueSummary(_0xc8e5('0x15b'),_0x486cd2));}else{notSendMessagesCampaign(_0x486cd2);}}}};function getCallerIdRandom(_0xaacf69,_0x24c884){var _0x166129,_0x158233,_0x1d2c43;if(_0x24c884<=0x0){_0x24c884=0x1;}_0x166129=new RegExp('\x5cw{0,'+_0x24c884+'}$');_0x158233=Math[_0xc8e5('0x15c')](0xa,_0x24c884-0x1);_0x1d2c43=Math[_0xc8e5('0x15c')](0xa,_0x24c884)-0x1;return util[_0xc8e5('0x78')]('%s',_[_0xc8e5('0x15d')](_0xaacf69,_0x166129,_[_0xc8e5('0x15e')](_0x158233,_0x1d2c43)));}function extractCalleridName(_0x580f98){var _0x197883=_0x580f98[_0xc8e5('0x15f')](/"(.*?)"/);return _0x197883?_0x197883[0x1]:_0x580f98;}function extractCalleridNumber(_0x4da194){var _0x36a85c=_0x4da194['match'](/<(.*?)>/);return _0x36a85c?_0x36a85c[0x1]:_0x4da194;}Dialer['prototype'][_0xc8e5('0x160')]=function(_0x583b8b,_0x51ff75){var _0x2d2166=this;var _0x31eaeb=uuid['v4']();this[_0xc8e5('0x27')][_0x31eaeb]=new Action(_0x583b8b,_0x51ff75,_0x31eaeb);return new BPromise(function(_0xfa4311,_0x121b06){if(_['isUndefined'](_0x583b8b)&&'object'!==typeof _0x583b8b){return _0x121b06(msgResponse(_0xc8e5('0x161'),_0xc8e5('0x13e'),_0xc8e5('0x162')));}if(_[_0xc8e5('0x3e')](_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')])||_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')]===null){return _0x121b06(msgResponse('originate',_0xc8e5('0x13e'),'contact\x20is\x20undefine'));}var _0x2f4368={'XMD-CALLERID':_0x2d2166['actions'][_0x31eaeb][_0xc8e5('0x165')](),'XMD-AGI':_0x583b8b[_0xc8e5('0x103')]?util[_0xc8e5('0x78')](_0xc8e5('0x166'),ipAgi,_0x583b8b[_0xc8e5('0x103')]):_0xc8e5('0x167'),'XMD-AGIAFTER':_0x583b8b[_0xc8e5('0x111')]?util[_0xc8e5('0x78')](_0xc8e5('0x166'),ipAgi,_0x583b8b[_0xc8e5('0x111')]):'NONE','XMD-QUEUE':_0x583b8b[_0xc8e5('0x55')]===_0xc8e5('0x4e')?util['format'](_0xc8e5('0x168'),_0x583b8b[_0xc8e5('0x41')],_0x583b8b['dialQueueOptions']||'',_0x583b8b[_0xc8e5('0x107')]?'c':'',_0x583b8b[_0xc8e5('0x169')]||0x3):_0xc8e5('0x167'),'XMD-CONTACTID':_0x51ff75['ContactId'],'XMD-CDRTYPE':_0xc8e5('0x9'),'CALLERID(all)':_0x2d2166[_0xc8e5('0x27')][_0x31eaeb][_0xc8e5('0x165')](),'XMD-AMD':_0x583b8b[_0xc8e5('0xdd')]?_0xc8e5('0x16a'):_0xc8e5('0x167'),'XMD-DESTINATION':_0xc8e5('0xdc')};if(_0x583b8b[_0xc8e5('0xdd')]){_0x2f4368[_0xc8e5('0x16b')]=_0x583b8b[_0xc8e5('0x16c')]||0x9c4;_0x2f4368[_0xc8e5('0x16d')]=_0x583b8b[_0xc8e5('0x16e')]||0x5dc;_0x2f4368['XMD-AMDAFTERGREETINGSILENCE']=_0x583b8b[_0xc8e5('0x16f')]||0x320;_0x2f4368[_0xc8e5('0x170')]=_0x583b8b[_0xc8e5('0x171')]||0x1388;_0x2f4368['XMD-AMDMINWORDLENGTH']=_0x583b8b['dialAMDMinWordLength']||0x64;_0x2f4368[_0xc8e5('0x172')]=_0x583b8b[_0xc8e5('0x173')]||0x32;_0x2f4368[_0xc8e5('0x174')]=_0x583b8b[_0xc8e5('0x175')]||0x3;_0x2f4368[_0xc8e5('0x176')]=_0x583b8b[_0xc8e5('0x177')]||0x100;_0x2f4368['XMD-AMDMAXIMUMWORDLENGTH']=_0x583b8b[_0xc8e5('0x178')]||0x1388;}if(_0x583b8b[_0xc8e5('0x55')]===_0xc8e5('0x4e')){_0x2f4368[_0xc8e5('0x179')]=_0x51ff75[_0xc8e5('0xd1')];}else{_0x2f4368[_0xc8e5('0x17a')]=_0x51ff75['CampaignId'];}for(var _0x2dfbf7 in _0x51ff75[_0xc8e5('0x163')]){if(_0x51ff75['Contact'][_0xc8e5('0x98')](_0x2dfbf7)){if(isNotNull(_0x51ff75[_0xc8e5('0x163')][_0x2dfbf7])&&_0x2dfbf7!=='id'&&_0x2dfbf7!=='tags'&&_0x2dfbf7!==_0xc8e5('0x17b')&&_0x2dfbf7!=='updatedAt'){_0x2f4368[util[_0xc8e5('0x78')](_0xc8e5('0x17c'),_0xc8e5('0x17d'),_[_0xc8e5('0x17e')](_0x2dfbf7))]=_0x51ff75[_0xc8e5('0x163')][_0x2dfbf7];}}}var _0x53d661=_0x2d2166[_0xc8e5('0x139')](_0x583b8b['Trunk'])?getCallerId(_0x583b8b['Trunk'][_0xc8e5('0x77')],_0x583b8b[_0xc8e5('0x59')],_0x583b8b[_0xc8e5('0x17f')]>0x0?getCallerIdRandom(_0x583b8b['dialOriginateCallerIdNumber'],_0x583b8b[_0xc8e5('0x17f')]):_0x583b8b[_0xc8e5('0x180')]):getCallerId(_[_0xc8e5('0xaf')](_0x583b8b[_0xc8e5('0x13a')])?_0x583b8b[_0xc8e5('0x75')]['callerid']:_0x583b8b[_0xc8e5('0x13a')]['callerid'],_0x583b8b[_0xc8e5('0x59')],_0x583b8b[_0xc8e5('0x17f')]>0x0?getCallerIdRandom(_0x583b8b[_0xc8e5('0x180')],_0x583b8b['dialRandomLastDigitCallerIdNumber']):_0x583b8b[_0xc8e5('0x180')]);if(_0x53d661){_0x2f4368['XMD-ORIGINATECALLERIDNAME']=_0x2d2166[_0xc8e5('0x27')][_0x31eaeb]['originatecalleridname']=extractCalleridName(_0x53d661);_0x2f4368[_0xc8e5('0x181')]=_0x2d2166[_0xc8e5('0x27')][_0x31eaeb][_0xc8e5('0x182')]=extractCalleridNumber(_0x53d661);}return ami['Action']({'actionid':_0x31eaeb,'action':_0xc8e5('0x161'),'channel':_0x2d2166['isTrunkReachable'](_0x583b8b[_0xc8e5('0x75')])?util[_0xc8e5('0x78')](_0xc8e5('0x183'),_0x583b8b['Trunk'][_0xc8e5('0x41')],isNotNull(_0x583b8b[_0xc8e5('0x5b')])?_0x583b8b['dialPrefix']['trim']()||'':'',_0x583b8b[_0xc8e5('0x184')]>0x0?_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')][_0xc8e5('0x185')](_0x583b8b[_0xc8e5('0x184')]):_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')]):util[_0xc8e5('0x78')](_0xc8e5('0x183'),_[_0xc8e5('0xaf')](_0x583b8b[_0xc8e5('0x13a')])?_0x583b8b['Trunk'][_0xc8e5('0x41')]:_0x583b8b['TrunkBackup'][_0xc8e5('0x41')],isNotNull(_0x583b8b[_0xc8e5('0x5b')])?_0x583b8b[_0xc8e5('0x5b')][_0xc8e5('0x186')]()||'':'',_0x583b8b['dialCutDigit']>0x0?_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')][_0xc8e5('0x185')](_0x583b8b[_0xc8e5('0x184')]):_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')]),'callerid':_0x53d661,'Exten':_0xc8e5('0xdc'),'Context':_0xc8e5('0x187'),'Priority':'1','variable':_0x2f4368,'timeout':(_0x583b8b[_0xc8e5('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x31eaeb})[_0xc8e5('0xbd')](function(_0x4a0ea0){return _0xfa4311(_0x4a0ea0);})[_0xc8e5('0xba')](function(_0x4fc2d5){_0x583b8b[_0xc8e5('0x64')]+=0x1;var _0x223545=new History(_0x2d2166[_0xc8e5('0x27')][_0x31eaeb]);logger[_0xc8e5('0x95')](util[_0xc8e5('0x78')](_0xc8e5('0x188'),JSON[_0xc8e5('0x4b')](_0x4fc2d5)));_0x223545['state']=0xe;_0x223545[_0xc8e5('0xaa')]=_0xc8e5('0x189');_0x223545[_0xc8e5('0xab')]=moment()['format'](_0xc8e5('0xf6'));_0x223545[_0xc8e5('0x11d')]=_0x223545[_0xc8e5('0xab')];_0x2d2166[_0xc8e5('0xcb')](_0x223545)[_0xc8e5('0xba')](loggerCatch('[originate][error]'));_0x2d2166[_0xc8e5('0xca')](_0x223545)['catch'](loggerCatch(_0xc8e5('0x18a')))[_0xc8e5('0x1e')](function(){delete _0x2d2166[_0xc8e5('0x27')][_0x31eaeb];return _0x121b06(msgResponse(_0xc8e5('0x161'),_0xc8e5('0x4a'),_0xc8e5('0x18b')));});});});};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x32')]=function(_0x5aa4f1){var _0x9a522a=this[_0xc8e5('0x27')][_0x5aa4f1[_0xc8e5('0x121')]];var _0x27af21=this;if(_0x9a522a){delete this['actions'][_0x5aa4f1[_0xc8e5('0x121')]];_0x9a522a[_0xc8e5('0x10d')]=moment()['format'](_0xc8e5('0xf6'));var _0x489e43=_0x9a522a[_0xc8e5('0x55')]===_0xc8e5('0x7a')?this[_0xc8e5('0x22')][_0x9a522a[_0xc8e5('0xb4')]]:this[_0xc8e5('0x21')][_0x9a522a['getQueue']()];if(!this[_0xc8e5('0x18c')](_0x5aa4f1[_0xc8e5('0x18d')])){this[_0xc8e5('0xb3')](_0x489e43);return this[_0xc8e5('0x18e')](_0x9a522a,_0x489e43,_0x5aa4f1)[_0xc8e5('0xbd')](function(_0x5c8454){})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x18f')));}else{this[_0xc8e5('0xac')][_0x5aa4f1[_0xc8e5('0xdf')]]=_0x9a522a;}}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x190')]=function(_0x4fbf92,_0x35649c,_0x4b3f40){var _0x271c4f=new History(_0x35649c);if(_0x271c4f[_0xc8e5('0xe9')]+_0x271c4f[_0xc8e5('0xfb')]+_0x271c4f[_0xc8e5('0xea')]+_0x271c4f['countnosuchnumberretry']+_0x271c4f[_0xc8e5('0xec')]+_0x271c4f[_0xc8e5('0x11a')]+_0x271c4f[_0xc8e5('0xed')]+_0x271c4f['countagentrejectretry']>=_0x4b3f40['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4fbf92){case 0x3:if(_0x271c4f['countnoanswerretry']>=_0x4b3f40[_0xc8e5('0x191')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x271c4f['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0x192')],'minutes')['format'](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x193')));}break;case 0x5:if(_0x271c4f[_0xc8e5('0xe9')]>=_0x4b3f40[_0xc8e5('0x194')]-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countbusyretry':_0x271c4f[_0xc8e5('0xe9')]+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0x195')],'minutes')['format'](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f['ListId'],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f['CampaignId']||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x196')));}break;case 0x8:if(_0x271c4f[_0xc8e5('0xfb')]>=_0x4b3f40[_0xc8e5('0x197')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x271c4f[_0xc8e5('0xfb')]+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40['dialCongestionRetryFrequency'],_0xc8e5('0xf5'))[_0xc8e5('0x78')](_0xc8e5('0xf6')),'ContactId':_0x271c4f['ContactId'],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f['VoiceQueueId']||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})['catch'](loggerCatch(_0xc8e5('0x198')));}break;case 0x0:if(_0x271c4f[_0xc8e5('0xeb')]>=_0x4b3f40[_0xc8e5('0x199')]-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countnosuchnumberretry':_0x271c4f[_0xc8e5('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x4b3f40[_0xc8e5('0x19a')],_0xc8e5('0xf5'))[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f['CampaignId']||undefined})['catch'](loggerCatch(_0xc8e5('0x19b')));}break;case 0xa:if(_0x271c4f[_0xc8e5('0xec')]>=_0x4b3f40['dialDropMaxRetry']-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countdropretry':_0x271c4f[_0xc8e5('0xec')]+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0x19c')],'minutes')['format'](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x112')));}break;case 0xb:if(_0x271c4f[_0xc8e5('0x11a')]>=_0x4b3f40[_0xc8e5('0x119')]-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countabandonedretry':_0x271c4f[_0xc8e5('0x11a')]+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0x11b')],_0xc8e5('0xf5'))[_0xc8e5('0x78')](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f['CampaignId']||undefined})['catch'](loggerCatch(_0xc8e5('0x11c')));}break;case 0x13:if(_0x271c4f['countmachineretry']>=_0x4b3f40['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countmachineretry':_0x271c4f['countmachineretry']+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0xfd')],_0xc8e5('0xf5'))[_0xc8e5('0x78')](_0xc8e5('0xf6')),'ContactId':_0x271c4f['ContactId'],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})['catch'](loggerCatch(_0xc8e5('0xf7')));}break;case 0x14:if(_0x271c4f[_0xc8e5('0xee')]>=_0x4b3f40[_0xc8e5('0x19d')]-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countagentrejectretry':_0x271c4f['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40['dialAgentRejectRetryFrequency'],'minutes')[_0xc8e5('0x78')](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x19e')));}break;default:return!![];}};Dialer[_0xc8e5('0x1b')]['callProgressDetecting']=function(_0x19dd7d,_0x767ddd,_0x56fbef){var _0x2c01e1=this;var _0x37b05d=new History(_0x19dd7d);return new BPromise(function(_0x3f235b,_0x206d96){if(_[_0xc8e5('0x3e')](_0x767ddd)&&'object'!==typeof _0x767ddd){return _0x206d96(msgResponse('[callProgressDetecting]',_0xc8e5('0x13e'),_0xc8e5('0x19f')));}if(_[_0xc8e5('0x3e')](_0x56fbef)&&_0xc8e5('0x1a0')!==typeof _0x56fbef){return _0x206d96(msgResponse(_0xc8e5('0x1a1'),_0xc8e5('0x13e'),_0xc8e5('0x1a2')));}switch(_0x56fbef[_0xc8e5('0x106')]){case'0':_0x767ddd['outboundNoSuchCallsDay']+=0x1;_0x37b05d['state']=0x0;_0x37b05d[_0xc8e5('0xaa')]='NoSuchNumber';_0x37b05d['countnosuchnumberretry']+=0x1;_0x37b05d[_0xc8e5('0xe7')]+=0x1;ami[_0xc8e5('0x1a3')]('custom:agentnosuchnumber',ut['buildObj'](_0x19dd7d,_0xc8e5('0x1a4')));_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)['catch'](loggerCatch(_0xc8e5('0xe8')));if(_0x2c01e1[_0xc8e5('0x190')](0x0,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xeb')]>=_0x767ddd[_0xc8e5('0x199')]){_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1a5'));}else{_0x2c01e1[_0xc8e5('0xf0')](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1a5'));}}break;case'3':_0x767ddd[_0xc8e5('0x1a6')]+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0x3;_0x37b05d['statedesc']=_0xc8e5('0x1a7');_0x37b05d[_0xc8e5('0xea')]+=0x1;_0x37b05d[_0xc8e5('0xe7')]+=0x1;ami[_0xc8e5('0x1a3')](_0xc8e5('0x1a8'),ut[_0xc8e5('0x1a9')](_0x19dd7d,_0xc8e5('0x1aa')));_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)[_0xc8e5('0xba')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2c01e1[_0xc8e5('0x190')](0x3,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xea')]>=_0x767ddd[_0xc8e5('0x191')]){_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1ab'));}}break;case'5':_0x767ddd['outboundBusyCallsDay']+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0x5;_0x37b05d[_0xc8e5('0xaa')]=_0xc8e5('0x1ac');_0x37b05d['countbusyretry']+=0x1;_0x37b05d['countglobal']+=0x1;ami[_0xc8e5('0x1a3')](_0xc8e5('0x1ad'),ut[_0xc8e5('0x1a9')](_0x19dd7d,_0xc8e5('0x1ae')));_0x2c01e1['createHistory'](_0x37b05d)['catch'](loggerCatch(_0xc8e5('0x1af')));if(_0x2c01e1[_0xc8e5('0x190')](0x5,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xe9')]>=_0x767ddd[_0xc8e5('0x194')]){_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b0'));}else{_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b0'));}}break;case'8':_0x767ddd[_0xc8e5('0x60')]+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0x8;_0x37b05d[_0xc8e5('0xaa')]=_0xc8e5('0x1b1');_0x37b05d[_0xc8e5('0xfb')]+=0x1;_0x37b05d['countglobal']+=0x1;ami[_0xc8e5('0x1a3')](_0xc8e5('0x1b2'),ut[_0xc8e5('0x1a9')](_0x19dd7d,'congestion'));_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1b3')));if(_0x2c01e1[_0xc8e5('0x190')](0x8,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xfb')]>=_0x767ddd[_0xc8e5('0x197')]){_0x2c01e1['createStateFinal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b4'));}else{_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b4'));}}break;case'11':_0x767ddd[_0xc8e5('0x1b5')]+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0xb;_0x37b05d[_0xc8e5('0xaa')]='Abandoned';_0x37b05d[_0xc8e5('0x11a')]+=0x1;_0x37b05d[_0xc8e5('0xe7')]+=0x1;_0x2c01e1['createHistory'](_0x37b05d)['catch'](loggerCatch(_0xc8e5('0x11e')));if(_0x2c01e1[_0xc8e5('0x190')](0xb,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0x11a')]>=_0x767ddd[_0xc8e5('0x119')]){_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b6'));}else{_0x2c01e1[_0xc8e5('0xf0')](_0x37b05d,_0x3f235b,_0x206d96,'reason\x2011\x20abandoned');}}break;case'20':_0x767ddd[_0xc8e5('0x1b7')]+=0x1;_0x37b05d['state']=0x14;_0x37b05d[_0xc8e5('0xaa')]=_0xc8e5('0x1b8');_0x37b05d['countagentrejectretry']+=0x1;_0x37b05d[_0xc8e5('0xe7')]+=0x1;ami['emit']('custom:agentreject',ut[_0xc8e5('0x1a9')](_0x19dd7d,_0xc8e5('0x1b9')));_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1ba')));if(_0x2c01e1[_0xc8e5('0x190')](0x14,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xee')]>=_0x767ddd[_0xc8e5('0x19d')]){_0x2c01e1['createStateFinal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1bb'));}else{_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1bb'));}}break;default:_0x767ddd[_0xc8e5('0x66')]+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0xc;_0x37b05d[_0xc8e5('0xaa')]=_0x56fbef['reason'];_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1bc')));if(_0x2c01e1[_0xc8e5('0x190')](_0x56fbef['reason'],_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xe9')]+_0x37b05d[_0xc8e5('0xfb')]+_0x37b05d[_0xc8e5('0xea')]+_0x37b05d[_0xc8e5('0xeb')]+_0x37b05d[_0xc8e5('0xec')]+_0x37b05d[_0xc8e5('0x11a')]+_0x37b05d[_0xc8e5('0xed')]+_0x37b05d['countagentrejectretry']>=_0x767ddd[_0xc8e5('0xef')]){_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0x56fbef['reason']);}else{_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,_0x56fbef[_0xc8e5('0x106')]);}}}});};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xf0')]=function(_0x3d7a1e,_0x369885,_0x2a53f8,_0x17a325){var _0x5b06b2=new Final(_0x3d7a1e);_0x5b06b2[_0xc8e5('0xa9')]=0xf;_0x5b06b2[_0xc8e5('0xaa')]=_0xc8e5('0x1bd');this[_0xc8e5('0xf3')](_0x5b06b2,_0x369885,_0x2a53f8,_0x17a325);};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xf3')]=function(_0x18057f,_0x1ab3b4,_0x5e1084,_0x3b85e8){this[_0xc8e5('0xca')](_0x18057f)[_0xc8e5('0xbd')](function(_0x5217d7){return _0x1ab3b4(msgResponse(_0xc8e5('0x1a1'),_0xc8e5('0x1be'),_0x3b85e8));})['catch'](function(_0x4e295a){return _0x5e1084(msgResponse('[moveContactManagedDialer][0]',_0xc8e5('0x13e'),_0xc8e5('0x1bf')));});};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xa')]=function(_0x51e1af){var _0x3c2da5=this;var _0x23e0e1=_0x51e1af[_0xc8e5('0x1c0')]/0x64;var _0x6edaa7=_0x51e1af['outboundDropCallsDayTimeout']/(_0x51e1af[_0xc8e5('0x62')]+_0x51e1af[_0xc8e5('0x5d')]);var _0x41cfb7=Math[_0xc8e5('0x1c1')](_0x51e1af[_0xc8e5('0x1c2')]*(_0x51e1af[_0xc8e5('0x1c3')]/0x64));var _0x2d9c8e=Math['round'](_0x51e1af[_0xc8e5('0x1c2')]*(_0x51e1af[_0xc8e5('0x1c4')]/0x64));var _0x4e6751=_0x51e1af[_0xc8e5('0x51')]+_0x51e1af[_0xc8e5('0x54')];var _0x285afa=Math[_0xc8e5('0x1c5')](_0x51e1af['erlangCalls']*_0x51e1af[_0xc8e5('0x73')]*_0x51e1af[_0xc8e5('0x6d')]*_0x51e1af[_0xc8e5('0x6e')]);if(_[_0xc8e5('0x3e')](_0x51e1af[_0xc8e5('0x74')])){if(!_[_0xc8e5('0x3e')](_0x51e1af[_0xc8e5('0x2a')])){_0x51e1af[_0xc8e5('0x2a')]=undefined;loggerPredictive[_0xc8e5('0x95')](_0xc8e5('0x1c6'),_0xc8e5('0x1c7'));}if(!_['isUndefined'](_0x51e1af[_0xc8e5('0x90')])){loggerPredictive[_0xc8e5('0x95')](_0xc8e5('0x1c6'),_0xc8e5('0x1c8'));clearInterval(_0x51e1af[_0xc8e5('0x90')]);_0x51e1af[_0xc8e5('0x90')]=undefined;}_0x51e1af[_0xc8e5('0x74')]=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));loggerPredictive[_0xc8e5('0x7d')](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1c9'),_0x51e1af['startProgressive']);this[_0xc8e5('0x14e')](_0x51e1af,0x1);}else if(ifInterval(_0x51e1af[_0xc8e5('0x1ca')],_0x51e1af['startProgressive'])){this['handlePower'](_0x51e1af,0x1);loggerPredictiveCalls[_0xc8e5('0x7d')](_0xc8e5('0x1cb'),_0x51e1af['startProgressive'],_0x51e1af[_0xc8e5('0x41')]);_0x51e1af[_0xc8e5('0x71')]=0x0;_0x51e1af['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x23e0e1<_0x6edaa7&&_0x51e1af['dialPredictiveOptimization']===_0xc8e5('0x1cc')){freeVariablesPredictive(_0x51e1af);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x1cd'),_0xc8e5('0x1ce'),_0x6edaa7,_0xc8e5('0x74'),_0x51e1af[_0xc8e5('0x41')]);}else if(_0x285afa<_0x51e1af[_0xc8e5('0x10e')]&&_0x51e1af[_0xc8e5('0x1cf')]===_0xc8e5('0x1cc')){freeVariablesPredictive(_0x51e1af);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x1d0'),_0xc8e5('0x1d1'),_0x285afa,_0xc8e5('0x1d2'),_0x51e1af['predictiveIntervalErlangCallsDroppedCalls'],_0xc8e5('0x74'),_0x51e1af[_0xc8e5('0x41')]);}else if(!ifInterval(_0x51e1af[_0xc8e5('0x1ca')],_0x51e1af[_0xc8e5('0x74')])&&_[_0xc8e5('0x3e')](_0x51e1af['startPredictive'])&&!_[_0xc8e5('0x3e')](_0x51e1af[_0xc8e5('0x74')])){_0x51e1af[_0xc8e5('0x2a')]=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));loggerPredictive[_0xc8e5('0x7d')](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1d3'),_0x51e1af[_0xc8e5('0x2a')]);this[_0xc8e5('0x1d4')](_0x51e1af[_0xc8e5('0x1ca')])[_0xc8e5('0xbd')](this[_0xc8e5('0x1d5')](_0x51e1af))[_0xc8e5('0xbd')](mergeDataErlangB(_0x51e1af))[_0xc8e5('0xbd')](this['startMethodPredictive'](_0x51e1af))[_0xc8e5('0xba')](loggerCatchPredictive(_0xc8e5('0x1d6'),_0x51e1af));}else if(!ifInterval(_0x51e1af[_0xc8e5('0x1ca')],_0x51e1af[_0xc8e5('0x2a')])){_0x51e1af[_0xc8e5('0x10e')]=0x0;_0x51e1af[_0xc8e5('0x2a')]=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));loggerPredictive[_0xc8e5('0x7d')](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1d7'),_0x51e1af[_0xc8e5('0x2a')]);clearInterval(_0x51e1af['handlePredictive']);_0x51e1af[_0xc8e5('0x90')]=undefined;this[_0xc8e5('0x1d4')](_0x51e1af[_0xc8e5('0x1ca')])[_0xc8e5('0xbd')](this[_0xc8e5('0x1d5')](_0x51e1af))[_0xc8e5('0xbd')](mergeDataErlangB(_0x51e1af))[_0xc8e5('0xbd')](this['startMethodPredictive'](_0x51e1af))[_0xc8e5('0xba')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x51e1af));}else if(_0x51e1af[_0xc8e5('0x1c2')]&&_0x4e6751<_0x51e1af[_0xc8e5('0x1c2')]-_0x2d9c8e){freeVariablesPredictive(_0x51e1af);loggerPredictive[_0xc8e5('0x7d')](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1d8'),_0x4e6751,_0xc8e5('0x1d9'),_0x51e1af[_0xc8e5('0x1c2')],'-',_0x2d9c8e,'=',_0x51e1af['predictiveIntervalAvailable']-_0x2d9c8e,')');}else if(_0x51e1af['predictiveIntervalAvailable']&&_0x4e6751>_0x51e1af[_0xc8e5('0x1c2')]+_0x41cfb7){freeVariablesPredictive(_0x51e1af);loggerPredictive['info'](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1d8'),_0x4e6751,_0xc8e5('0x1da'),_0x51e1af[_0xc8e5('0x1c2')],'+',_0x41cfb7,'=',_0x51e1af[_0xc8e5('0x1c2')]+_0x41cfb7,')');}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1d5')]=function(_0x48e85d){var _0x1f8618=this;return function(_0x1bdb99){return new BPromise(function(_0x22d3c0,_0x47365d){_[_0xc8e5('0x8c')](_0x48e85d,_0x1bdb99[0x0]);if(checkGetDataPredictive(_0x1bdb99[0x0])){var _0x28f264=_0x48e85d[_0xc8e5('0x1c2')]=_0x48e85d[_0xc8e5('0x54')]+_0x48e85d[_0xc8e5('0x51')];var _0x3c9099=_0x48e85d['dialPredictiveInterval']*0x3c;var _0x29fb28=_0x1bdb99[0x0][_0xc8e5('0x69')]+_0x1bdb99[0x0][_0xc8e5('0x68')];var _0x186bef=(_0x1bdb99[0x0][_0xc8e5('0x67')]+_0x1bdb99[0x0][_0xc8e5('0x6b')]+_0x1bdb99[0x0][_0xc8e5('0x6a')])/_0x1bdb99[0x0]['predictiveIntervalTotalCalls'];_0x48e85d[_0xc8e5('0x6d')]=_0x186bef>0x0?_0x186bef:0x1;switch(_0x48e85d[_0xc8e5('0x1cf')]){case _0xc8e5('0x1cc'):var _0x2141b0=_0x48e85d[_0xc8e5('0x1c0')]/0x64;return _0x1f8618[_0xc8e5('0x1db')](_0x28f264,_0x3c9099,_0x29fb28,_0x186bef,_0x2141b0)[_0xc8e5('0xbd')](function(_0x3c1601){return _0x22d3c0(_0x3c1601);});case _0xc8e5('0x1dc'):var _0x23a4a3=_0x48e85d[_0xc8e5('0x1c0')]/0x64;return _0x1f8618[_0xc8e5('0x1dd')](_0x28f264,_0x3c9099,_0x29fb28,_0x186bef,_0x23a4a3)['then'](function(_0x10965b){return _0x22d3c0(_0x10965b);});default:return _0x47365d(msgResponse(_0xc8e5('0x1de'),'Failure',_0xc8e5('0x1df')));}}else{return _0x47365d(msgResponse(_0xc8e5('0x1de'),'Failure','check\x20failure'));}});};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1e0')]=function(_0xfd4e){var _0x1b9a46=this;return function(_0x137dba){return new BPromise(function(_0x3ff1b1,_0x52f028){_[_0xc8e5('0x8c')](_0xfd4e,_0x137dba[0x0]);if(checkGetDataPredictive(_0x137dba[0x0])){loggerPredictive['info'](JSON['stringify'](_0x137dba[0x0]));if(_0xfd4e[_0xc8e5('0x1cf')]===_0xc8e5('0x1cc')){return _0x1b9a46[_0xc8e5('0xc8')](_0xfd4e['id'])[_0xc8e5('0xbd')](function(_0x35c3b4){var _0x8eaa1f=_0xfd4e['loggedIn']-_0x35c3b4[0x0][_0xc8e5('0x1e1')];var _0x466889=_0xfd4e[_0xc8e5('0x1ca')]*0x3c;var _0x2b70e7=_0x137dba[0x0][_0xc8e5('0x69')]+_0x137dba[0x0][_0xc8e5('0x68')];var _0x4a5f9a=(_0x137dba[0x0][_0xc8e5('0x67')]+_0x137dba[0x0][_0xc8e5('0x6b')]+_0x137dba[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x137dba[0x0][_0xc8e5('0x7f')];var _0x5899b1=_0xfd4e['dialPredictiveOptimizationPercentage']/0x64;_0xfd4e['predictiveIntervalPauses']=_0x35c3b4[0x0][_0xc8e5('0x1e1')]||0x0;_0xfd4e[_0xc8e5('0x6d')]=_0x4a5f9a>0x0?_0x4a5f9a:0x1;return _0x1b9a46[_0xc8e5('0x1db')](_0x8eaa1f,_0x466889,_0x2b70e7,_0x4a5f9a,_0x5899b1);})[_0xc8e5('0xbd')](function(_0x50b15d){return _0x3ff1b1(_0x50b15d);})[_0xc8e5('0xba')](function(_0x1488d6){return _0x52f028(msgResponse(_0xc8e5('0x1e2'),_0xc8e5('0x13e'),JSON['stringify'](_0x1488d6)));});}if(_0xfd4e[_0xc8e5('0x1cf')]==='agentBusyFactor'){return _0x1b9a46[_0xc8e5('0xc8')](_0xfd4e['id'])['then'](function(_0x64ba23){var _0x401b3c=_0xfd4e[_0xc8e5('0x52')]-_0x64ba23[0x0][_0xc8e5('0x1e1')];var _0x2c1148=_0xfd4e[_0xc8e5('0x1ca')]*0x3c;var _0x4b75f3=_0x137dba[0x0]['predictiveIntervalAvgTalktime']+_0x137dba[0x0][_0xc8e5('0x68')];var _0x496027=(_0x137dba[0x0][_0xc8e5('0x67')]+_0x137dba[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x137dba[0x0][_0xc8e5('0x6a')])/_0x137dba[0x0][_0xc8e5('0x7f')];var _0x5e25b7=_0xfd4e[_0xc8e5('0x1c0')]/0x64;_0xfd4e[_0xc8e5('0x6f')]=_0x64ba23[0x0][_0xc8e5('0x1e1')]||0x0;_0xfd4e[_0xc8e5('0x6d')]=_0x496027>0x0?_0x496027:0x1;return _0x1b9a46[_0xc8e5('0x1dd')](_0x401b3c,_0x2c1148,_0x4b75f3,_0x496027,_0x5e25b7);})[_0xc8e5('0xbd')](function(_0x5ec48d){return _0x3ff1b1(_0x5ec48d);})['catch'](function(_0x2d0a69){return _0x52f028(msgResponse('[CatchErlangB]','Failure',JSON[_0xc8e5('0x4b')](_0x2d0a69)));});}}else{return _0x52f028(msgResponse(_0xc8e5('0x1de'),_0xc8e5('0x13e'),_0xc8e5('0x1e3')));}});};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1e4')]=function(_0x48a549){var _0x2a38bc=this;return function(){var _0x3644aa=0x0;var _0x27de7a=Math['floor'](_0x48a549[_0xc8e5('0x72')]*0x3e8);if(_0x27de7a>0x0){_0x27de7a=_0x27de7a<0x64?0x64:_0x27de7a;loggerPredictive['info'](_0x48a549[_0xc8e5('0x41')],_0xc8e5('0x1e5'),_0x27de7a,_0xc8e5('0x4c'));_0x48a549[_0xc8e5('0x90')]=setInterval(function(){_0x2a38bc[_0xc8e5('0x90')](_0x48a549);loggerPredictiveCalls['info'](_0xc8e5('0x1e6'),_0x3644aa+=0x1);},_0x27de7a);}else{loggerPredictive['info'](_0x48a549[_0xc8e5('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1e7')]=function(_0x29b672,_0x122353){var _0x40d9b0=this;return function(_0x170479){if(_[_0xc8e5('0x48')](_0x170479)){if(_[_0xc8e5('0xaf')](_0x122353[_0xc8e5('0x1e8')])||!_0x122353[_0xc8e5('0x1e9')]){if(_0x29b672['dialMethod']===_0xc8e5('0x151')){_0x29b672[_0xc8e5('0x127')]=_[_0xc8e5('0x3e')](_0x29b672[_0xc8e5('0x127')])?!![]:_0x29b672[_0xc8e5('0x127')];var _0x4da064=uuid['v4']();_0x40d9b0[_0xc8e5('0x27')][_0x4da064]=new Action(_0x29b672,_0x122353,_0x4da064);loggerBooked['info'](_0xc8e5('0x1ea'),_0x4da064,'queueStatusComplete:\x20',JSON['stringify'](_0x29b672[_0xc8e5('0x127')]),_0xc8e5('0x1eb'),_0x29b672[_0xc8e5('0x41')]);if(_0x29b672[_0xc8e5('0x127')]){_0x29b672['queueStatusComplete']=![];_0x40d9b0[_0xc8e5('0x2c')][_0x40d9b0['actions'][_0x4da064][_0xc8e5('0xb4')]]=[];ami[_0xc8e5('0xb0')]({'actionid':_0x4da064,'action':_0xc8e5('0x1ec'),'queue':_0x29b672[_0xc8e5('0x41')]})['catch'](function(_0xc5973a){_0x40d9b0[_0xc8e5('0xb3')](_0x29b672);_0x40d9b0[_0xc8e5('0xc1')]({'active':![],'ContactId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xcf')],'ListId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xd0')],'VoiceQueueId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064]['VoiceQueueId']||undefined,'CampaignId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1ed')));delete _0x40d9b0[_0xc8e5('0x27')][_0x4da064];});}else{loggerBooked[_0xc8e5('0x7d')](_0xc8e5('0x1ee'),JSON[_0xc8e5('0x4b')](_0x29b672[_0xc8e5('0x127')]),_0xc8e5('0x1eb'),_0x29b672['name']);_0x40d9b0[_0xc8e5('0xb3')](_0x29b672);_0x40d9b0[_0xc8e5('0xc1')]({'active':![],'ContactId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xcf')],'ListId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064]['ListId'],'VoiceQueueId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xd1')]||undefined,'CampaignId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1ed')));delete _0x40d9b0[_0xc8e5('0x27')][_0x4da064];}}else{return _0x40d9b0[_0xc8e5('0x160')](_0x29b672,_0x122353);}}else{if(getDiff(_0x122353[_0xc8e5('0x1ef')])<_0x29b672[_0xc8e5('0x1f0')]*0x3c){if(_0x122353[_0xc8e5('0x1f1')]&&!_0x122353[_0xc8e5('0x1f1')]['voicePause']){_0x40d9b0['preview'][_0xc8e5('0x12a')](_0x122353['id'])['finally'](function(){_0x40d9b0['updateOriginated'](_0x29b672);});}else{_0x40d9b0[_0xc8e5('0xc3')]({'active':![]},_0x122353['id'],0x1)[_0xc8e5('0x1e')](function(){console[_0xc8e5('0x1f2')](_0xc8e5('0x1f3'));_0x40d9b0['updateOriginated'](_0x29b672);});}}else{_0x29b672[_0xc8e5('0x65')]+=0x1;_0x40d9b0[_0xc8e5('0xb3')](_0x29b672);if(_0x29b672[_0xc8e5('0x1f4')]){_0x40d9b0['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x122353[_0xc8e5('0xcf')],'ListId':_0x122353[_0xc8e5('0xd0')],'VoiceQueueId':_0x122353[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x122353[_0xc8e5('0xd2')]||undefined})['catch'](loggerCatch(_0xc8e5('0x1f5')));_0x40d9b0['createHistory'](createObjHistory(_0x29b672,_0x122353,_0xc8e5('0x1f6'),0x17,_0xc8e5('0x1f7')))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1f8')));}else{_0x40d9b0[_0xc8e5('0xd8')](createObjHistory(_0x29b672,_0x122353,_0xc8e5('0x1f9'),0x16,_0xc8e5('0x1fa')),'[Originate][HistoryRecallClose][historyCatch]',_0xc8e5('0x1fb'));}}}}else{_0x29b672[_0xc8e5('0x5e')]+=0x1;_0x40d9b0[_0xc8e5('0xd8')](createObjHistory(_0x29b672,_0x122353,_0xc8e5('0x1fc'),0xd,_0xc8e5('0x1fd')),_0xc8e5('0x1fe'),_0xc8e5('0x1ff'));throw _0xc8e5('0x200');}};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x154')]=function(_0x111fc2){var _0x12ecc1=this;var _0x24a7ed=[];var _0x281772=_0x111fc2[_0xc8e5('0x201')]-_0x111fc2[_0xc8e5('0x70')]-_0x111fc2[_0xc8e5('0x202')];emitCampaignSummary(_0x111fc2);if(_0x281772>0x0){if(_0x281772>this[_0xc8e5('0x25')]){_0x281772=this['maxNumberOriginate'];}_0x111fc2[_0xc8e5('0x202')]+=_0x281772;this['getContactDialerIvr'](_0x111fc2['id'],_0x281772,_0x111fc2[_0xc8e5('0x203')])[_0xc8e5('0xbd')](function(_0x19c71b){_0x111fc2[_0xc8e5('0x202')]-=_0x281772;_0x111fc2[_0xc8e5('0x202')]=_0x111fc2[_0xc8e5('0x202')]>0x0?_0x111fc2['temp']:0x0;if(!checkContactEmpty(_0x19c71b)){_0x111fc2['message']=_0xc8e5('0x9f');logger[_0xc8e5('0x7d')](_0xc8e5('0x204')+_0x111fc2[_0xc8e5('0x41')]);}else{_0x111fc2[_0xc8e5('0x70')]+=_0x19c71b['length'];_0x111fc2[_0xc8e5('0x3f')]='RUNNING';for(var _0x1395e6=0x0;_0x1395e6<_0x19c71b[_0xc8e5('0x97')];_0x1395e6+=0x1){_0x111fc2[_0xc8e5('0x205')]+=0x1;if(_[_0xc8e5('0xaf')](_0x19c71b[_0x1395e6])||_[_0xc8e5('0xaf')](_0x19c71b[_0x1395e6]['Contact'])||_[_0xc8e5('0xaf')](_0x19c71b[_0x1395e6][_0xc8e5('0x163')]['phone'])){_0x12ecc1[_0xc8e5('0x206')](_0xc8e5('0x207'),_0x111fc2,_0x19c71b[_0x1395e6]);}else{_0x12ecc1['checkIsBlackListIvr'](_['pick'](_0x19c71b[_0x1395e6],[_0xc8e5('0xd2'),_0xc8e5('0x208')]))['then'](_0x12ecc1['checkContactBlack'](_0x111fc2,_0x19c71b[_0x1395e6]))[_0xc8e5('0xba')](_0x12ecc1[_0xc8e5('0x209')](_0xc8e5('0x20a'),_0x111fc2));}}}})[_0xc8e5('0xba')](loggerGetContactDialer(_0xc8e5('0x20b'),_0x111fc2,_0x281772));}};Dialer[_0xc8e5('0x1b')]['handlePower']=function(_0x143ed2,_0x5addd3){var _0x2c51a0=this;var _0x59c977=[];var _0x45f06c=_0x5addd3>=0x1?_0x5addd3:0x1;var _0x6d8967=[];if(_0x143ed2['dialMethod']==='booked'){_0x45f06c=0x1;}var _0x5ef336=Math[_0xc8e5('0x1c5')](_0x143ed2['available']*_0x45f06c)-_0x143ed2[_0xc8e5('0x70')]-_0x143ed2[_0xc8e5('0x202')];emitVoiceQueueSummary(_0x143ed2);if(_0x143ed2[_0xc8e5('0x20c')]>0x0){var _0x27dd0c=_0x143ed2[_0xc8e5('0x20c')]-_0x143ed2[_0xc8e5('0x70')]-_0x143ed2[_0xc8e5('0x54')]-_0x143ed2[_0xc8e5('0x202')]-_0x143ed2[_0xc8e5('0xa2')];if(_0x5ef336>_0x27dd0c){_0x5ef336=_0x27dd0c;}}if(_0x5ef336>0x0){if(_0x143ed2[_0xc8e5('0x20d')]===_0xc8e5('0x151')){_0x5ef336=0x1;}if(_0x5ef336>this[_0xc8e5('0x25')]){_0x5ef336=this[_0xc8e5('0x25')];}_0x143ed2['temp']+=_0x5ef336;for(var _0x41d383 in this[_0xc8e5('0x23')]){if(this[_0xc8e5('0x23')][_0xc8e5('0x98')](_0x41d383)){if(this['agents'][_0x41d383][_0xc8e5('0xa9')]==='not_inuse'&&this[_0xc8e5('0x23')][_0x41d383][_0xc8e5('0xb1')]===_0xc8e5('0xd5')){_0x59c977[_0xc8e5('0x125')](this[_0xc8e5('0x23')][_0x41d383]['id']);}}}this['getContactDialer'](_0x143ed2['id'],_0x59c977,_0x5ef336,_0x143ed2['dialOrderByScheduledAt'])[_0xc8e5('0xbd')](function(_0x563a7f){_0x143ed2[_0xc8e5('0x202')]-=_0x5ef336;_0x143ed2[_0xc8e5('0x202')]=_0x143ed2[_0xc8e5('0x202')]>0x0?_0x143ed2[_0xc8e5('0x202')]:0x0;if(!checkContactEmpty(_0x563a7f)){_0x2c51a0[_0xc8e5('0xb6')](_0x143ed2)['then'](sendMessageReschedule(_0x143ed2))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xb8')));}else{_0x143ed2[_0xc8e5('0x70')]+=_0x563a7f[_0xc8e5('0x97')];_0x143ed2[_0xc8e5('0x3f')]=_0x143ed2[_0xc8e5('0x20d')]==='booked'?'ACTIVE':_0xc8e5('0x20e');for(var _0x424f9f=0x0;_0x424f9f<_0x563a7f[_0xc8e5('0x97')];_0x424f9f+=0x1){if(_['isNil'](_0x563a7f[_0x424f9f])||_[_0xc8e5('0xaf')](_0x563a7f[_0x424f9f][_0xc8e5('0x163')])||_[_0xc8e5('0xaf')](_0x563a7f[_0x424f9f]['Contact'][_0xc8e5('0x164')])){_0x2c51a0[_0xc8e5('0x206')](_0xc8e5('0x207'),_0x143ed2,_0x563a7f[_0x424f9f]);}else{_0x2c51a0[_0xc8e5('0xb9')](_[_0xc8e5('0xce')](_0x563a7f[_0x424f9f],[_0xc8e5('0xd1'),'Contact.phone']))[_0xc8e5('0xbd')](_0x2c51a0[_0xc8e5('0x1e7')](_0x143ed2,_0x563a7f[_0x424f9f]))[_0xc8e5('0xba')](_0x2c51a0[_0xc8e5('0x209')]('[actionOriginate]\x20',_0x143ed2));}}}})[_0xc8e5('0xba')](loggerGetContactDialer(_0xc8e5('0x20f'),_0x143ed2,_0x5ef336));}};Dialer[_0xc8e5('0x1b')]['handlePredictive']=function(_0x5bf7e3){var _0x42e3e5=this;if(_0x5bf7e3[_0xc8e5('0x20c')]>0x0){var _0x5b23f8=_0x5bf7e3[_0xc8e5('0x20c')]-_0x5bf7e3['originated']-_0x5bf7e3[_0xc8e5('0x54')];if(_0x5b23f8>0x0){this[_0xc8e5('0x210')](_0x5bf7e3);}else{loggerPredictiveCalls[_0xc8e5('0x7d')](_0xc8e5('0x211'));}}else{this[_0xc8e5('0x210')](_0x5bf7e3);}};Dialer[_0xc8e5('0x1b')]['tryOriginatePredictive']=function(_0x44318b){var _0x37b065=this;var _0x54c044=[];_0x44318b['originated']+=0x1;for(var _0x4dd5bf in this[_0xc8e5('0x23')]){if(this[_0xc8e5('0x23')]['hasOwnProperty'](_0x4dd5bf)){if(this['agents'][_0x4dd5bf][_0xc8e5('0xa9')]==='not_inuse'&&this['agents'][_0x4dd5bf][_0xc8e5('0xb1')]===_0xc8e5('0xd5')){_0x54c044[_0xc8e5('0x125')](this['agents'][_0x4dd5bf]['id']);}}}this[_0xc8e5('0xc5')](_0x44318b['id'],_0x54c044,0x1,_0x44318b[_0xc8e5('0x203')])[_0xc8e5('0xbd')](function(_0x28f0af){if(!checkContactEmpty(_0x28f0af)){checkContactLowerLimitOriginate(_0x44318b,0x1,0x0);_0x37b065[_0xc8e5('0xb6')](_0x44318b)[_0xc8e5('0xbd')](sendMessageReschedule(_0x44318b))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xb8')));}else{_0x44318b[_0xc8e5('0x3f')]='RUNNING';if(_[_0xc8e5('0xaf')](_0x28f0af[0x0])||_['isNil'](_0x28f0af[0x0][_0xc8e5('0x163')])||_[_0xc8e5('0xaf')](_0x28f0af[0x0][_0xc8e5('0x163')]['phone'])){_0x37b065[_0xc8e5('0x206')](_0xc8e5('0x207'),_0x44318b,_0x28f0af[0x0]);}else{_0x37b065['checkIsBlackList'](_[_0xc8e5('0xce')](_0x28f0af[0x0],['VoiceQueueId',_0xc8e5('0x208')]))[_0xc8e5('0xbd')](_0x37b065['checkContactBlack'](_0x44318b,_0x28f0af[0x0]))['catch'](_0x37b065['loggerHandler']('[actionOriginatePredictive]\x20',_0x44318b));}}})['catch'](loggerGetContactDialer(_0xc8e5('0x212'),_0x44318b,0x1));emitVoiceQueueSummary(_0x44318b);};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1db')]=function(_0x40187e,_0xa1bb45,_0x2fe9,_0x3745de,_0x366fc6,_0x3b102b){loggerPredictive[_0xc8e5('0x7d')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xc8e5('0x213'),_0x40187e);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x214'),_0xa1bb45);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x215'),_0x2fe9);loggerPredictive['info'](_0xc8e5('0x216'),_0x3745de);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x217'),_0x366fc6);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x82'));return new BPromise(function(_0x234734,_0x2ca5b4){if(_0x40187e<=0x0||isNaN(_0x40187e)){return _0x2ca5b4(msgResponse('[abandonmentRate]',_0xc8e5('0x4a'),_0xc8e5('0x218')+_0x40187e));}if(_0x2fe9<=0x0||isNaN(_0x2fe9)){return _0x2ca5b4(msgResponse(_0xc8e5('0x219'),_0xc8e5('0x4a'),_0xc8e5('0x21a')+_0x2fe9));}if(_0x3745de<=0x0||isNaN(_0x3745de)){return _0x2ca5b4(msgResponse(_0xc8e5('0x219'),'Error',_0xc8e5('0x21b')+_0x3745de));}if(_0xa1bb45<=0x0||isNaN(_0xa1bb45)){return _0x2ca5b4(msgResponse(_0xc8e5('0x219'),_0xc8e5('0x4a'),'interval\x20=\x20'+_0xa1bb45));}if(_0x366fc6<=0x0||isNaN(_0x366fc6)){return _0x2ca5b4(msgResponse(_0xc8e5('0x219'),_0xc8e5('0x4a'),_0xc8e5('0x21c')+_0x366fc6));}_0x3b102b=_0x3b102b||0x0;var _0x457cd0=0x1/_0x2fe9;var _0x2f256d=0x0;var _0x157abb=0x0;var _0x47ad97=0x0;var _0x582279=0x0;for(var _0x599fe4=0x0;_0x47ad97<_0x366fc6;_0x599fe4+=0x1){_0x157abb=_0x599fe4/_0xa1bb45;_0x2f256d=(_0x3745de*_0x157abb+_0x3b102b)/_0x457cd0;_0x47ad97=erlangb(_0x2f256d,_0x40187e);_0x582279=_0x2f256d/_0x40187e*(0x1-erlangb(_0x2f256d,_0x40187e));}return _0x234734({'erlangCalls':_0x599fe4,'erlangCallToSecond':_0xa1bb45/_0x599fe4,'erlangAbandonmentRate':_0x47ad97,'erlangBusyFactor':_0x582279});});};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1dd')]=function(_0x12ebdf,_0x2ed9c5,_0x4dba1c,_0x44e284,_0x3cb34b,_0x48022e){loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x21d'));loggerPredictive['info'](_0xc8e5('0x213'),_0x12ebdf);loggerPredictive['info'](_0xc8e5('0x214'),_0x2ed9c5);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x215'),_0x4dba1c);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x216'),_0x44e284);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x21e'),_0x3cb34b);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x82'));return new BPromise(function(_0x7559ce,_0x5ca1b8){if(_0x12ebdf<=0x0||isNaN(_0x12ebdf)){return _0x5ca1b8(msgResponse(_0xc8e5('0x21f'),'Error',_0xc8e5('0x218')+_0x12ebdf));}if(_0x4dba1c<=0x0||isNaN(_0x4dba1c)){return _0x5ca1b8(msgResponse('[busyFactor]','Error',_0xc8e5('0x21a')+_0x4dba1c));}if(_0x44e284<=0x0||isNaN(_0x44e284)){return _0x5ca1b8(msgResponse(_0xc8e5('0x21f'),_0xc8e5('0x4a'),_0xc8e5('0x21b')+_0x44e284));}if(_0x2ed9c5<=0x0||isNaN(_0x2ed9c5)){return _0x5ca1b8(msgResponse(_0xc8e5('0x21f'),_0xc8e5('0x4a'),_0xc8e5('0x220')+_0x2ed9c5));}if(_0x3cb34b<=0x0||isNaN(_0x3cb34b)){return _0x5ca1b8(msgResponse(_0xc8e5('0x21f'),_0xc8e5('0x4a'),_0xc8e5('0x221')+_0x3cb34b));}_0x48022e=_0x48022e||0x0;var _0x4c490a=0x1/_0x4dba1c;var _0x5251f2=0x0;var _0x236573=0x0;var _0x2ed7b5=0x0;var _0x5d68f4=0x0;for(var _0x15d06b=0x0;_0x5d68f4<_0x3cb34b;_0x15d06b+=0x1){_0x236573=_0x15d06b/_0x2ed9c5;_0x5251f2=(_0x44e284*_0x236573+_0x48022e)/_0x4c490a;_0x2ed7b5=erlangb(_0x5251f2,_0x12ebdf);_0x5d68f4=_0x5251f2/_0x12ebdf*(0x1-erlangb(_0x5251f2,_0x12ebdf));}return _0x7559ce({'erlangCalls':_0x15d06b,'erlangCallToSecond':_0x2ed9c5/_0x15d06b,'erlangAbandonmentRate':_0x2ed7b5,'erlangBusyFactor':_0x5d68f4});});};module[_0xc8e5('0x222')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 737178d..ba9df5b 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 _0x3539=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countglobal'];(function(_0x34a904,_0x23af96){var _0x23d658=function(_0x4c3177){while(--_0x4c3177){_0x34a904['push'](_0x34a904['shift']());}};_0x23d658(++_0x23af96);}(_0x3539,0x145));var _0x9353=function(_0xa8ca73,_0x1bf155){_0xa8ca73=_0xa8ca73-0x0;var _0x223616=_0x3539[_0xa8ca73];return _0x223616;};'use strict';var util=require(_0x9353('0x0'));var _=require('lodash');var moment=require(_0x9353('0x1'));function getSeconds(_0x505a66,_0x45461f){var _0x2273df=moment(_0x505a66)[_0x9353('0x2')](0x0);var _0x3a0b26=moment(_0x45461f)[_0x9353('0x2')](0x0);return _0x2273df[_0x9353('0x3')](_0x3a0b26,'seconds');}function QueueCallerAbandon(_0x16126e,_0x56fef5){this[_0x9353('0x4')]=_0x16126e['scheduledat'];this[_0x9353('0x5')]=_0x16126e[_0x9353('0x5')];this[_0x9353('0x6')]=_0x16126e['type']===_0x9353('0x7')?_0x9353('0x8'):_0x16126e[_0x9353('0x5')];this['countbusyretry']=_0x16126e[_0x9353('0x9')];this['countcongestionretry']=_0x16126e['countcongestionretry'];this['countnoanswerretry']=_0x16126e['countnoanswerretry'];this[_0x9353('0xa')]=_0x16126e['countbusyretry']+_0x16126e[_0x9353('0xb')]+_0x16126e[_0x9353('0xc')]+_0x16126e[_0x9353('0xd')]+_0x16126e['countdropretry']+_0x16126e[_0x9353('0xe')]+_0x16126e[_0x9353('0xf')]+_0x16126e[_0x9353('0x10')];this[_0x9353('0xd')]=_0x16126e[_0x9353('0xd')];this['countdropretry']=_0x16126e[_0x9353('0x11')];this[_0x9353('0xe')]=_0x16126e[_0x9353('0xe')];this[_0x9353('0xf')]=_0x16126e[_0x9353('0xf')];this[_0x9353('0x10')]=_0x16126e[_0x9353('0x10')];this[_0x9353('0x12')]=_0x56fef5[_0x9353('0x12')];this[_0x9353('0x13')]=_0x16126e[_0x9353('0x14')];this[_0x9353('0x15')]=_0x16126e[_0x9353('0x16')];this[_0x9353('0x17')]=_0x16126e[_0x9353('0x17')];this[_0x9353('0x18')]=_0x16126e[_0x9353('0x18')];this[_0x9353('0x19')]=_0x16126e[_0x9353('0x19')];this['endtime']=this[_0x9353('0x19')];this['ringtime']=getSeconds(_0x16126e[_0x9353('0x18')],_0x16126e['starttime']);this[_0x9353('0x1a')]=getSeconds(this[_0x9353('0x19')],_0x16126e['responsetime']);this[_0x9353('0x1b')]=0x0;this[_0x9353('0x8')]=_0x56fef5['queue'];this[_0x9353('0x1c')]=_0x56fef5[_0x9353('0x1d')];this[_0x9353('0x1e')]=_0x56fef5[_0x9353('0x1e')];this[_0x9353('0x1f')]=_0x16126e[_0x9353('0x1f')];this[_0x9353('0x20')]=_0x16126e[_0x9353('0x20')];this[_0x9353('0x21')]=_0x16126e[_0x9353('0x21')];this[_0x9353('0x22')]=_0x16126e[_0x9353('0x22')];this[_0x9353('0x23')]=_0x16126e['ContactId'];this['ListId']=_0x16126e[_0x9353('0x24')];this[_0x9353('0x25')]=_0x16126e['UserId'];this['VoiceQueueId']=_0x16126e[_0x9353('0x26')];this[_0x9353('0x27')]=_0x16126e[_0x9353('0x27')];this[_0x9353('0x28')]=_0x16126e[_0x9353('0x28')]||'';this['originatecalleridname']=_0x16126e[_0x9353('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x1181=['diff','seconds','scheduledat','campaigntype','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x144d5f,_0x4d0b19){var _0x31e036=function(_0x1e47ec){while(--_0x1e47ec){_0x144d5f['push'](_0x144d5f['shift']());}};_0x31e036(++_0x4d0b19);}(_0x1181,0x191));var _0x1118=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x1181[_0x1d39f6];return _0x3dbd7a;};'use strict';var util=require(_0x1118('0x0'));var _=require(_0x1118('0x1'));var moment=require(_0x1118('0x2'));function getSeconds(_0x16e651,_0x4b50ea){var _0xf12b6e=moment(_0x16e651)['milliseconds'](0x0);var _0x4b3afe=moment(_0x4b50ea)[_0x1118('0x3')](0x0);return _0xf12b6e[_0x1118('0x4')](_0x4b3afe,_0x1118('0x5'));}function QueueCallerAbandon(_0x1481c3,_0x3ff0b4){this[_0x1118('0x6')]=_0x1481c3['scheduledat'];this['type']=_0x1481c3['type'];this[_0x1118('0x7')]=_0x1481c3[_0x1118('0x8')]==='outbound'?_0x1118('0x9'):_0x1481c3['type'];this[_0x1118('0xa')]=_0x1481c3['countbusyretry'];this['countcongestionretry']=_0x1481c3[_0x1118('0xb')];this[_0x1118('0xc')]=_0x1481c3[_0x1118('0xc')];this[_0x1118('0xd')]=_0x1481c3[_0x1118('0xa')]+_0x1481c3['countcongestionretry']+_0x1481c3[_0x1118('0xc')]+_0x1481c3[_0x1118('0xe')]+_0x1481c3[_0x1118('0xf')]+_0x1481c3['countabandonedretry']+_0x1481c3[_0x1118('0x10')]+_0x1481c3['countagentrejectretry'];this['countnosuchnumberretry']=_0x1481c3['countnosuchnumberretry'];this['countdropretry']=_0x1481c3[_0x1118('0xf')];this[_0x1118('0x11')]=_0x1481c3[_0x1118('0x11')];this[_0x1118('0x10')]=_0x1481c3[_0x1118('0x10')];this[_0x1118('0x12')]=_0x1481c3[_0x1118('0x12')];this[_0x1118('0x13')]=_0x3ff0b4[_0x1118('0x13')];this['calleridname']=_0x1481c3[_0x1118('0x14')];this[_0x1118('0x15')]=_0x1481c3[_0x1118('0x16')];this['starttime']=_0x1481c3[_0x1118('0x17')];this[_0x1118('0x18')]=_0x1481c3[_0x1118('0x18')];this['droptime']=_0x1481c3[_0x1118('0x19')];this[_0x1118('0x1a')]=this[_0x1118('0x19')];this[_0x1118('0x1b')]=getSeconds(_0x1481c3[_0x1118('0x18')],_0x1481c3[_0x1118('0x17')]);this[_0x1118('0x1c')]=getSeconds(this[_0x1118('0x19')],_0x1481c3[_0x1118('0x18')]);this[_0x1118('0x1d')]=0x0;this[_0x1118('0x9')]=_0x3ff0b4[_0x1118('0x9')];this[_0x1118('0x1e')]=_0x3ff0b4[_0x1118('0x1f')];this[_0x1118('0x20')]=_0x3ff0b4['reason'];this[_0x1118('0x21')]=_0x1481c3[_0x1118('0x21')];this[_0x1118('0x22')]=_0x1481c3['callbackuniqueid'];this['callbackat']=_0x1481c3[_0x1118('0x23')];this[_0x1118('0x24')]=_0x1481c3[_0x1118('0x24')];this[_0x1118('0x25')]=_0x1481c3[_0x1118('0x25')];this['ListId']=_0x1481c3[_0x1118('0x26')];this[_0x1118('0x27')]=_0x1481c3['UserId'];this[_0x1118('0x28')]=_0x1481c3[_0x1118('0x28')];this[_0x1118('0x29')]=_0x1481c3['CampaignId'];this['originatecalleridnum']=_0x1481c3[_0x1118('0x2a')]||'';this['originatecalleridname']=_0x1481c3[_0x1118('0x2b')]||'';}module[_0x1118('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index b72fd43..ac0ef8e 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 _0xa78d=['headerinfo','AttachmentId','exports','moment','uniqueid','channel','format','%s/%s/%s','tech','name','localstationid'];(function(_0x5bdbff,_0x8bbf61){var _0x4734b4=function(_0x401224){while(--_0x401224){_0x5bdbff['push'](_0x5bdbff['shift']());}};_0x4734b4(++_0x8bbf61);}(_0xa78d,0xbe));var _0xda78=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa78d[_0x1d24eb];return _0x1dc576;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xda78('0x0'));function Action(_0x700abf,_0x411feb,_0x5eb438){this[_0xda78('0x1')]=_0x700abf||undefined;this[_0xda78('0x2')]=util[_0xda78('0x3')](_0xda78('0x4'),_0x411feb[_0xda78('0x5')],_0x411feb['Trunk'][_0xda78('0x6')],_0x5eb438['fax']);this[_0xda78('0x7')]=_0x411feb[_0xda78('0x7')];this[_0xda78('0x8')]=_0x411feb['headerinfo'];this['path']=_0x5eb438['path'];this[_0xda78('0x9')]=_0x5eb438[_0xda78('0x9')];}module[_0xda78('0xa')]=Action; \ No newline at end of file +var _0x53c0=['%s/%s/%s','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','uniqueid','channel','format'];(function(_0x262239,_0xa4e3bc){var _0x4ada31=function(_0x78e32b){while(--_0x78e32b){_0x262239['push'](_0x262239['shift']());}};_0x4ada31(++_0xa4e3bc);}(_0x53c0,0xf2));var _0x053c=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x53c0[_0x507c81];return _0x368a25;};'use strict';var util=require(_0x053c('0x0'));var _=require(_0x053c('0x1'));var moment=require('moment');function Action(_0x39716f,_0x462a47,_0x24a9e8){this[_0x053c('0x2')]=_0x39716f||undefined;this[_0x053c('0x3')]=util[_0x053c('0x4')](_0x053c('0x5'),_0x462a47['tech'],_0x462a47['Trunk'][_0x053c('0x6')],_0x24a9e8[_0x053c('0x7')]);this[_0x053c('0x8')]=_0x462a47[_0x053c('0x8')];this['headerinfo']=_0x462a47[_0x053c('0x9')];this[_0x053c('0xa')]=_0x24a9e8[_0x053c('0xa')];this[_0x053c('0xb')]=_0x24a9e8[_0x053c('0xb')];}module[_0x053c('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index be5f41b..1992f23 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 _0xadcb=['../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','bind','syncNewState','newexten','syncNewExten','faxstatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','notify','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','reason','AttachmentId','then','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20failed','checkAfterSend','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./action','../rpc/faxAccount','../rpc/attachment'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xadcb,0x1c1));var _0xbadc=function(_0x28c4d2,_0x17a999){_0x28c4d2=_0x28c4d2-0x0;var _0x3067d5=_0xadcb[_0x28c4d2];return _0x3067d5;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xbadc('0x0'));var uuid=require(_0xbadc('0x1'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xbadc('0x2'));var gs=require(_0xbadc('0x3'));var logger=require(_0xbadc('0x4'))(_0xbadc('0x5'));var ami=require(_0xbadc('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0xbadc('0x7'));var ut=require('./util/util');var Action=require(_0xbadc('0x8'));var faxAccount=require(_0xbadc('0x9'));var attachment=require(_0xbadc('0xa'));var faxMessage=require(_0xbadc('0xb'));function Fax(_0x4ff0c0){this[_0xbadc('0xc')]={};this[_0xbadc('0xd')]=_0x4ff0c0[_0xbadc('0xd')];this[_0xbadc('0xe')]=_0x4ff0c0[_0xbadc('0xe')];this[_0xbadc('0xf')]={};ami['on']('newchannel',this[_0xbadc('0x10')]['bind'](this));ami['on'](_0xbadc('0x11'),this[_0xbadc('0x12')][_0xbadc('0x13')](this));ami['on']('newstate',this[_0xbadc('0x14')][_0xbadc('0x13')](this));ami['on'](_0xbadc('0x15'),this[_0xbadc('0x16')][_0xbadc('0x13')](this));ami['on'](_0xbadc('0x17'),this['syncFaxStatus']['bind'](this));ami['on']('receivefax',this[_0xbadc('0x18')][_0xbadc('0x13')](this));ami['on']('hangup',this[_0xbadc('0x19')]['bind'](this));ami['on'](_0xbadc('0x1a'),this[_0xbadc('0x1b')][_0xbadc('0x13')](this));}Fax[_0xbadc('0x1c')][_0xbadc('0x10')]=function(_0x4d9117){if(_0x4d9117[_0xbadc('0x1d')]===_0xbadc('0x1e')){for(var _0x344d7c in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x344d7c)){if(_0x4d9117[_0xbadc('0x1f')]===this['faxAccounts'][_0x344d7c][_0xbadc('0x20')]){this[_0xbadc('0xc')][_0x4d9117[_0xbadc('0x21')]]={};this[_0xbadc('0xc')][_0x4d9117['uniqueid']][_0xbadc('0x22')]=_0x4d9117[_0xbadc('0x22')];this['channels'][_0x4d9117[_0xbadc('0x21')]]['id']=this[_0xbadc('0xd')][_0x344d7c]['id'];this['channels'][_0x4d9117[_0xbadc('0x21')]][_0xbadc('0x23')]=this[_0xbadc('0xd')][_0x344d7c]['name'];logger[_0xbadc('0x24')](_0x4d9117['uniqueid'],_0xbadc('0x25'));}}}}if(this[_0xbadc('0xf')][_0x4d9117[_0xbadc('0x21')]]){this[_0xbadc('0xc')][_0x4d9117[_0xbadc('0x21')]]={};this[_0xbadc('0xc')][_0x4d9117[_0xbadc('0x21')]]['channel']=_0x4d9117[_0xbadc('0x22')];logger[_0xbadc('0x24')](_0x4d9117[_0xbadc('0x21')],_0xbadc('0x25'));}};Fax[_0xbadc('0x1c')][_0xbadc('0x12')]=function(_0x3980c6){if(this['channels'][_0x3980c6[_0xbadc('0x21')]]){for(var _0x57e0c3 in _0x3980c6[_0xbadc('0x26')]){if(_0x3980c6[_0xbadc('0x26')][_0xbadc('0x27')](_0x57e0c3)){this[_0xbadc('0xc')][_0x3980c6['uniqueid']][_0x57e0c3]=_0x3980c6[_0xbadc('0x28')];}}}};Fax[_0xbadc('0x1c')][_0xbadc('0x14')]=function(_0x24edb9){if(this[_0xbadc('0xc')][_0x24edb9[_0xbadc('0x21')]]){this['channels'][_0x24edb9[_0xbadc('0x21')]][_0xbadc('0x29')]=_0x24edb9[_0xbadc('0x29')];this[_0xbadc('0xc')][_0x24edb9['uniqueid']][_0xbadc('0x2a')]=_0x24edb9[_0xbadc('0x2a')];}};Fax['prototype'][_0xbadc('0x16')]=function(_0x1a608a){if(this['channels'][_0x1a608a[_0xbadc('0x21')]]){for(var _0x363c04 in _0x1a608a['variable']){if(_0x1a608a['variable']['hasOwnProperty'](_0x363c04)){this[_0xbadc('0xc')][_0x1a608a[_0xbadc('0x21')]][_0x363c04]=_0x1a608a[_0xbadc('0x28')];}}}};Fax[_0xbadc('0x1c')][_0xbadc('0x2b')]=function(_0x2a61f7){if(this[_0xbadc('0xc')][_0x2a61f7[_0xbadc('0x21')]]){this[_0xbadc('0xc')][_0x2a61f7[_0xbadc('0x21')]][_0xbadc('0x2c')]=_0x2a61f7[_0xbadc('0x2c')];this[_0xbadc('0xc')][_0x2a61f7[_0xbadc('0x21')]][_0xbadc('0x2d')]=_0x2a61f7[_0xbadc('0x2d')];this[_0xbadc('0xc')][_0x2a61f7['uniqueid']][_0xbadc('0x20')]=_0x2a61f7[_0xbadc('0x20')];this[_0xbadc('0xc')][_0x2a61f7['uniqueid']][_0xbadc('0x2e')]=_0x2a61f7[_0xbadc('0x2e')];logger[_0xbadc('0x24')](_0x2a61f7[_0xbadc('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0xbadc('0x1c')][_0xbadc('0x18')]=function(_0x457c54){var _0x5122b3=this;if(this[_0xbadc('0xc')][_0x457c54['uniqueid']]){var _0x4d3f76=this[_0xbadc('0xc')][_0x457c54[_0xbadc('0x21')]]['id'];this['channels'][_0x457c54[_0xbadc('0x21')]]['remotestationid']=_0x457c54[_0xbadc('0x2f')];this['channels'][_0x457c54[_0xbadc('0x21')]][_0xbadc('0x30')]=_0x457c54[_0xbadc('0x30')];this[_0xbadc('0xc')][_0x457c54['uniqueid']]['localstationid']=_0x457c54[_0xbadc('0x20')];this[_0xbadc('0xc')][_0x457c54[_0xbadc('0x21')]][_0xbadc('0x31')]=_0x457c54['resolution'];this[_0xbadc('0xc')][_0x457c54[_0xbadc('0x21')]]['transferrate']=_0x457c54[_0xbadc('0x32')];this[_0xbadc('0xc')][_0x457c54['uniqueid']]['filename']=_0x457c54[_0xbadc('0x2e')];this['channels'][_0x457c54[_0xbadc('0x21')]]['calleridnum']=_0x457c54[_0xbadc('0x33')];if(this['channels'][_0x457c54[_0xbadc('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0x457c54['filename'],_0xbadc('0x34'),function(_0x25ff8d){logger['info'](_0x457c54[_0xbadc('0x21')],'\x20result\x20conversion\x20file\x20',_0x25ff8d['message']);attachment[_0xbadc('0x35')]({'name':path[_0xbadc('0x36')](_0x457c54[_0xbadc('0x2e')])[_0xbadc('0x23')],'basename':path[_0xbadc('0x36')](_0x457c54[_0xbadc('0x2e')])['name']+_0xbadc('0x37'),'type':_0xbadc('0x38')})['then'](function(_0x4cf7ac){faxAccount[_0xbadc('0x39')](_0x4d3f76,{'from':_0x457c54[_0xbadc('0x33')],'mapKey':'fax','body':path[_0xbadc('0x36')](_0x457c54[_0xbadc('0x2e')])[_0xbadc('0x23')]+'.pdf','AttachmentId':_0x4cf7ac['id']})['catch'](function(_0x4d9806){logger['error'](_0x457c54[_0xbadc('0x21')],_0xbadc('0x3a'),JSON[_0xbadc('0x3b')](_0x4d9806));});})['catch'](function(_0x5aca80){logger[_0xbadc('0x3c')](_0x457c54[_0xbadc('0x21')],_0xbadc('0x3d'),JSON[_0xbadc('0x3b')](_0x5aca80));});});}logger[_0xbadc('0x24')](_0x457c54['uniqueid'],_0xbadc('0x3d'));}};Fax[_0xbadc('0x1c')][_0xbadc('0x1b')]=function(_0x32773e){if(this[_0xbadc('0xf')][_0x32773e[_0xbadc('0x21')]]){_[_0xbadc('0x3e')](this[_0xbadc('0xc')][_0x32773e[_0xbadc('0x21')]],_[_0xbadc('0x3f')](_0x32773e,['response',_0xbadc('0x40')]));}};function updateStatus(_0x153610){if(_0x153610[_0xbadc('0x41')]){faxMessage['update'](_0x153610[_0xbadc('0x41')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xbadc('0x42')](function(_0x224b71){ut[_0xbadc('0x43')](_0xbadc('0x44'),_0x224b71);})[_0xbadc('0x45')](function(_0x24f9e8){ut[_0xbadc('0x43')](_0xbadc('0x46'),_0x24f9e8);});}else{ut[_0xbadc('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0xbadc('0x47')]=function(_0x27d620,_0x37bf48,_0x52b7e8){var _0x4ff8c2=this;var _0x4e45ec={};if(_0x37bf48){_0x4e45ec={'read':_0x37bf48};}else{_0x4e45ec={'failMessage':_0x52b7e8};}if(this[_0xbadc('0xf')][_0x27d620][_0xbadc('0x41')]){faxMessage['update'](this['actions'][_0x27d620][_0xbadc('0x41')],_0x4e45ec)[_0xbadc('0x42')](function(_0x247af8){ut['logger']('[Fax][Message][Updated]',_0x247af8);})[_0xbadc('0x45')](function(_0x394408){ut[_0xbadc('0x43')](_0xbadc('0x48'),_0x394408);})[_0xbadc('0x49')](function(){delete _0x4ff8c2[_0xbadc('0xc')][_0x27d620];delete _0x4ff8c2[_0xbadc('0xf')][_0x27d620];});}else{ut[_0xbadc('0x43')]('[Fax][Message][NoUpdate2]');delete this[_0xbadc('0xc')][_0x27d620];delete this[_0xbadc('0xf')][_0x27d620];}};Fax['prototype'][_0xbadc('0x19')]=function(_0x2b2309){var _0x3812fb=this;if(this['channels'][_0x2b2309[_0xbadc('0x21')]]){if(this[_0xbadc('0xf')][_0x2b2309[_0xbadc('0x21')]]){this[_0xbadc('0xc')][_0x2b2309['uniqueid']]['id']=this[_0xbadc('0xf')][_0x2b2309[_0xbadc('0x21')]]['id'];this[_0xbadc('0xc')][_0x2b2309[_0xbadc('0x21')]][_0xbadc('0x23')]=this[_0xbadc('0xf')][_0x2b2309[_0xbadc('0x21')]][_0xbadc('0x23')];}logger[_0xbadc('0x24')](_0x2b2309[_0xbadc('0x21')],this['actions'][_0x2b2309['uniqueid']]?_0xbadc('0x4a'):_0xbadc('0x4b'),JSON[_0xbadc('0x3b')](this[_0xbadc('0xc')][_0x2b2309[_0xbadc('0x21')]]));if(this[_0xbadc('0xf')][_0x2b2309[_0xbadc('0x21')]]){if(this['channels'][_0x2b2309[_0xbadc('0x21')]][_0xbadc('0x4c')]>0x0&&this[_0xbadc('0xc')][_0x2b2309['uniqueid']][_0xbadc('0x17')]===_0xbadc('0x4d')){this[_0xbadc('0x47')](_0x2b2309[_0xbadc('0x21')],!![]);}else{this[_0xbadc('0x47')](_0x2b2309['uniqueid'],![],this[_0xbadc('0xc')][_0x2b2309[_0xbadc('0x21')]]['faxstatusstring']?_0xbadc('0x4e')+this[_0xbadc('0xc')][_0x2b2309[_0xbadc('0x21')]]['faxstatusstring']:_0xbadc('0x4f'));}}}};Fax[_0xbadc('0x1c')][_0xbadc('0x50')]=function(_0x31fb3e){var _0x489784=this;return new BPromise(function(_0x353267,_0x5ee745){_0x489784['execOriginate'](_0x31fb3e,_0x489784[_0xbadc('0xd')][_0x31fb3e[_0xbadc('0x51')]])[_0xbadc('0x42')](function(_0x22d2cc){ut[_0xbadc('0x43')](_0xbadc('0x52'),_0x22d2cc);_0x353267(ut[_0xbadc('0x53')]('Fax\x20received'));})[_0xbadc('0x45')](function(_0x7f7098){ut[_0xbadc('0x43')]('[Fax][execOriginate][failure]',_0x7f7098);updateStatus(_0x31fb3e);_0x5ee745(ut['message'](_0xbadc('0x54')));});});};Fax[_0xbadc('0x1c')][_0xbadc('0x55')]=function(_0x46b553){var _0x5c4b7a=this;return new BPromise(function(_0x395906,_0x2899b4){var _0x132c9f=_0x5c4b7a['checkTrunk'](_0x5c4b7a[_0xbadc('0xd')][_0x46b553[_0xbadc('0x51')]][_0xbadc('0x56')],_0x46b553);if(_0x132c9f[_0xbadc('0x57')]){_0x395906(ut[_0xbadc('0x53')]('Trunk\x20Reachable'));}else{_0x2899b4(ut['message'](_0x132c9f[_0xbadc('0x53')]));}});};function originate(_0x40ee72,_0x3b22a6,_0x3dacac){return new BPromise(function(_0x433199,_0x2cbcf2){if(_0x3dacac){var _0x55fd3c=util['format'](_0xbadc('0x58'),path[_0xbadc('0x36')](_0x40ee72['path'])[_0xbadc('0x23')],_0x40ee72[_0xbadc('0x59')]);gs[_0xbadc('0x5a')](_0x55fd3c)['then'](function(){_0x40ee72['path']=util[_0xbadc('0x5b')](_0xbadc('0x5c'),path['parse'](_0x40ee72[_0xbadc('0x59')])[_0xbadc('0x5d')],path[_0xbadc('0x36')](_0x40ee72[_0xbadc('0x59')])['name']);_0x3b22a6[_0xbadc('0x5e')]=_0x40ee72[_0xbadc('0x59')];ut[_0xbadc('0x43')](_0xbadc('0x5f'),'');ami[_0xbadc('0x60')](ut['variablesAction'](_0x40ee72,_0x3b22a6))['then'](function(_0x1d4a24){_0x433199(_0x1d4a24);})['catch'](function(_0x416ee3){_0x2cbcf2(_0x416ee3);});})[_0xbadc('0x45')](function(_0x40dab4){_0x2cbcf2(_0x40dab4);});}else{ami['Action'](ut[_0xbadc('0x61')](_0x40ee72,_0x3b22a6))[_0xbadc('0x42')](function(_0x4f97c9){_0x433199(_0x4f97c9);})[_0xbadc('0x45')](function(_0x2ff851){_0x2cbcf2(_0x2ff851);});}});}Fax['prototype'][_0xbadc('0x62')]=function(_0x5227de,_0x8f41d7){var _0x19a6e6=this;return new BPromise(function(_0x5ebc4a,_0x5e32fc){var _0x5eff35=uuid['v4']();var _0x279b9b=ut[_0xbadc('0x63')](_0x5227de,_0x8f41d7);_0x19a6e6['actions'][_0x5eff35]=new Action(_0x5eff35,_0x8f41d7,_0x5227de);var _0x483b14=_0x19a6e6[_0xbadc('0xf')][_0x5eff35];if(path['parse'](_0x5227de[_0xbadc('0x59')])[_0xbadc('0x64')]===_0xbadc('0x37')){originate(_0x483b14,_0x279b9b,!![])[_0xbadc('0x42')](function(_0xab4bd7){_0x5ebc4a(_0xab4bd7);})[_0xbadc('0x45')](function(_0x340fdc){_0x5e32fc(_0x340fdc);});}else{originate(_0x483b14,_0x279b9b,![])[_0xbadc('0x42')](function(_0x25637b){_0x5ebc4a(_0x25637b);})[_0xbadc('0x45')](function(_0x125312){_0x5e32fc(_0x125312);});}});};Fax[_0xbadc('0x1c')][_0xbadc('0x65')]=function(_0x1ddca4){return!_[_0xbadc('0x66')](_0x1ddca4)&&!_[_0xbadc('0x66')](_0x1ddca4[_0xbadc('0x23')])&&!_[_0xbadc('0x66')](_0x1ddca4[_0xbadc('0x67')])&&_0x1ddca4[_0xbadc('0x67')]&&!_[_0xbadc('0x66')](this['trunks'][util[_0xbadc('0x5b')]('SIP/%s',_0x1ddca4['name'])])&&!_['isNil'](this[_0xbadc('0xe')][util[_0xbadc('0x5b')](_0xbadc('0x68'),_0x1ddca4[_0xbadc('0x23')])]['status'])&&(this[_0xbadc('0xe')][util[_0xbadc('0x5b')](_0xbadc('0x68'),_0x1ddca4[_0xbadc('0x23')])][_0xbadc('0x2d')]===_0xbadc('0x69')||this[_0xbadc('0xe')][util['format']('SIP/%s',_0x1ddca4[_0xbadc('0x23')])][_0xbadc('0x2d')]===_0xbadc('0x6a'));};Fax[_0xbadc('0x1c')][_0xbadc('0x6b')]=function(_0x108b15,_0x3b473a){if(!this[_0xbadc('0x65')](_0x108b15)){ut[_0xbadc('0x43')](_0xbadc('0x6c'),_[_0xbadc('0x66')](_0x108b15)?'':_0x108b15[_0xbadc('0x23')]+_0xbadc('0x6d'));return{'isValid':![],'message':_0xbadc('0x6e')};}if(_[_0xbadc('0x66')](_0x3b473a[_0xbadc('0x5')])){ut[_0xbadc('0x43')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x3b473a));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xbadc('0x66')](_0x3b473a[_0xbadc('0x59')])){ut[_0xbadc('0x43')](_0xbadc('0x6f'),JSON[_0xbadc('0x3b')](_0x3b473a));return{'isValid':![],'message':_0xbadc('0x70')};}return{'isValid':!![],'message':_0xbadc('0x71')};};module[_0xbadc('0x72')]=Fax; \ No newline at end of file +var _0x39c1=['[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','dir','Convert\x20pdf\x20to\x20tif','variablesAction','Action','execOriginate','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','uuid','moment','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','merge','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId'];(function(_0xf19a59,_0x56ada6){var _0x565d7b=function(_0x4059be){while(--_0x4059be){_0xf19a59['push'](_0xf19a59['shift']());}};_0x565d7b(++_0x56ada6);}(_0x39c1,0x177));var _0x139c=function(_0x527aaa,_0xe460f3){_0x527aaa=_0x527aaa-0x0;var _0x50061f=_0x39c1[_0x527aaa];return _0x50061f;};'use strict';var util=require(_0x139c('0x0'));var _=require(_0x139c('0x1'));var BPromise=require('bluebird');var uuid=require(_0x139c('0x2'));var moment=require(_0x139c('0x3'));var path=require('path');var tiff2pdf=require(_0x139c('0x4'));var gs=require(_0x139c('0x5'));var logger=require('../../../config/logger')(_0x139c('0x6'));var ami=require(_0x139c('0x7'));var rpcDb=require(_0x139c('0x8'));var Channel=require('./channel');var ut=require(_0x139c('0x9'));var Action=require('./action');var faxAccount=require(_0x139c('0xa'));var attachment=require(_0x139c('0xb'));var faxMessage=require(_0x139c('0xc'));function Fax(_0x1d907f){this['channels']={};this['faxAccounts']=_0x1d907f[_0x139c('0xd')];this['trunks']=_0x1d907f[_0x139c('0xe')];this['actions']={};ami['on']('newchannel',this[_0x139c('0xf')][_0x139c('0x10')](this));ami['on'](_0x139c('0x11'),this[_0x139c('0x12')]['bind'](this));ami['on'](_0x139c('0x13'),this[_0x139c('0x14')][_0x139c('0x10')](this));ami['on'](_0x139c('0x15'),this['syncNewExten'][_0x139c('0x10')](this));ami['on'](_0x139c('0x16'),this[_0x139c('0x17')]['bind'](this));ami['on'](_0x139c('0x18'),this[_0x139c('0x19')][_0x139c('0x10')](this));ami['on'](_0x139c('0x1a'),this['syncHangup'][_0x139c('0x10')](this));ami['on'](_0x139c('0x1b'),this[_0x139c('0x1c')][_0x139c('0x10')](this));}Fax[_0x139c('0x1d')][_0x139c('0xf')]=function(_0xe6c5dd){if(_0xe6c5dd[_0x139c('0x1e')]===_0x139c('0x1f')){for(var _0x264e04 in this['faxAccounts']){if(this['faxAccounts'][_0x139c('0x20')](_0x264e04)){if(_0xe6c5dd[_0x139c('0x21')]===this[_0x139c('0xd')][_0x264e04]['localstationid']){this['channels'][_0xe6c5dd[_0x139c('0x22')]]={};this[_0x139c('0x23')][_0xe6c5dd[_0x139c('0x22')]]['channel']=_0xe6c5dd[_0x139c('0x24')];this[_0x139c('0x23')][_0xe6c5dd[_0x139c('0x22')]]['id']=this[_0x139c('0xd')][_0x264e04]['id'];this['channels'][_0xe6c5dd['uniqueid']][_0x139c('0x25')]=this[_0x139c('0xd')][_0x264e04][_0x139c('0x25')];logger[_0x139c('0x26')](_0xe6c5dd['uniqueid'],_0x139c('0x27'));}}}}if(this[_0x139c('0x28')][_0xe6c5dd[_0x139c('0x22')]]){this['channels'][_0xe6c5dd[_0x139c('0x22')]]={};this[_0x139c('0x23')][_0xe6c5dd[_0x139c('0x22')]][_0x139c('0x24')]=_0xe6c5dd[_0x139c('0x24')];logger[_0x139c('0x26')](_0xe6c5dd[_0x139c('0x22')],_0x139c('0x27'));}};Fax[_0x139c('0x1d')][_0x139c('0x12')]=function(_0x5139c3){if(this['channels'][_0x5139c3[_0x139c('0x22')]]){for(var _0x37444f in _0x5139c3['variable']){if(_0x5139c3[_0x139c('0x29')]['hasOwnProperty'](_0x37444f)){this[_0x139c('0x23')][_0x5139c3[_0x139c('0x22')]][_0x37444f]=_0x5139c3[_0x139c('0x2a')];}}}};Fax['prototype'][_0x139c('0x14')]=function(_0x3c0a0c){if(this[_0x139c('0x23')][_0x3c0a0c[_0x139c('0x22')]]){this[_0x139c('0x23')][_0x3c0a0c[_0x139c('0x22')]]['channelstate']=_0x3c0a0c[_0x139c('0x2b')];this[_0x139c('0x23')][_0x3c0a0c['uniqueid']][_0x139c('0x2c')]=_0x3c0a0c[_0x139c('0x2c')];}};Fax['prototype'][_0x139c('0x2d')]=function(_0x1c6707){if(this[_0x139c('0x23')][_0x1c6707[_0x139c('0x22')]]){for(var _0x1879a8 in _0x1c6707['variable']){if(_0x1c6707[_0x139c('0x29')][_0x139c('0x20')](_0x1879a8)){this[_0x139c('0x23')][_0x1c6707[_0x139c('0x22')]][_0x1879a8]=_0x1c6707[_0x139c('0x2a')];}}}};Fax[_0x139c('0x1d')][_0x139c('0x17')]=function(_0xe030b1){if(this[_0x139c('0x23')][_0xe030b1[_0x139c('0x22')]]){this[_0x139c('0x23')][_0xe030b1[_0x139c('0x22')]]['operation']=_0xe030b1[_0x139c('0x2e')];this[_0x139c('0x23')][_0xe030b1['uniqueid']][_0x139c('0x2f')]=_0xe030b1[_0x139c('0x2f')];this['channels'][_0xe030b1['uniqueid']]['localstationid']=_0xe030b1[_0x139c('0x30')];this[_0x139c('0x23')][_0xe030b1[_0x139c('0x22')]][_0x139c('0x31')]=_0xe030b1[_0x139c('0x31')];logger[_0x139c('0x26')](_0xe030b1[_0x139c('0x22')],_0x139c('0x32'));}};Fax['prototype']['syncReceiveFax']=function(_0x550ce3){var _0x101137=this;if(this[_0x139c('0x23')][_0x550ce3['uniqueid']]){var _0x4750e4=this['channels'][_0x550ce3[_0x139c('0x22')]]['id'];this[_0x139c('0x23')][_0x550ce3[_0x139c('0x22')]][_0x139c('0x33')]=_0x550ce3[_0x139c('0x33')];this[_0x139c('0x23')][_0x550ce3['uniqueid']][_0x139c('0x34')]=_0x550ce3[_0x139c('0x34')];this[_0x139c('0x23')][_0x550ce3['uniqueid']][_0x139c('0x30')]=_0x550ce3[_0x139c('0x30')];this[_0x139c('0x23')][_0x550ce3['uniqueid']][_0x139c('0x35')]=_0x550ce3['resolution'];this[_0x139c('0x23')][_0x550ce3[_0x139c('0x22')]]['transferrate']=_0x550ce3[_0x139c('0x36')];this[_0x139c('0x23')][_0x550ce3[_0x139c('0x22')]]['filename']=_0x550ce3[_0x139c('0x31')];this[_0x139c('0x23')][_0x550ce3[_0x139c('0x22')]][_0x139c('0x37')]=_0x550ce3[_0x139c('0x37')];if(this['channels'][_0x550ce3['uniqueid']][_0x139c('0x34')]>0x0){tiff2pdf(_0x550ce3[_0x139c('0x31')],_0x139c('0x38'),function(_0xe1f58e){logger[_0x139c('0x26')](_0x550ce3[_0x139c('0x22')],'\x20result\x20conversion\x20file\x20',_0xe1f58e[_0x139c('0x39')]);attachment[_0x139c('0x3a')]({'name':path[_0x139c('0x3b')](_0x550ce3[_0x139c('0x31')])['name'],'basename':path[_0x139c('0x3b')](_0x550ce3[_0x139c('0x31')])[_0x139c('0x25')]+_0x139c('0x3c'),'type':_0x139c('0x3d')})[_0x139c('0x3e')](function(_0x53ee40){faxAccount[_0x139c('0x3f')](_0x4750e4,{'from':_0x550ce3[_0x139c('0x37')],'mapKey':_0x139c('0x6'),'body':path['parse'](_0x550ce3['filename'])[_0x139c('0x25')]+_0x139c('0x3c'),'AttachmentId':_0x53ee40['id']})[_0x139c('0x40')](function(_0x4a8a06){logger['error'](_0x550ce3[_0x139c('0x22')],_0x139c('0x41'),JSON['stringify'](_0x4a8a06));});})[_0x139c('0x40')](function(_0x2cdc8c){logger[_0x139c('0x42')](_0x550ce3[_0x139c('0x22')],_0x139c('0x43'),JSON[_0x139c('0x44')](_0x2cdc8c));});});}logger[_0x139c('0x26')](_0x550ce3[_0x139c('0x22')],_0x139c('0x43'));}};Fax['prototype']['syncOriginateResponse']=function(_0x19bb24){if(this[_0x139c('0x28')][_0x19bb24['uniqueid']]){_[_0x139c('0x45')](this[_0x139c('0x23')][_0x19bb24[_0x139c('0x22')]],_['pick'](_0x19bb24,['response',_0x139c('0x46')]));}};function updateStatus(_0x169e7f){if(_0x169e7f[_0x139c('0x47')]){faxMessage['update'](_0x169e7f['AttachmentId'],{'failMessage':_0x139c('0x48')})[_0x139c('0x3e')](function(_0x1dd1a6){ut[_0x139c('0x49')]('[Fax][Message][Error][Updated]',_0x1dd1a6);})[_0x139c('0x40')](function(_0x2b0a3a){ut[_0x139c('0x49')](_0x139c('0x4a'),_0x2b0a3a);});}else{ut['logger'](_0x139c('0x4b'));}}Fax[_0x139c('0x1d')][_0x139c('0x4c')]=function(_0x16610f,_0x4775cc,_0x4ecc93){var _0x309adb=this;var _0x5aa7af={};if(_0x4775cc){_0x5aa7af={'read':_0x4775cc};}else{_0x5aa7af={'failMessage':_0x4ecc93};}if(this[_0x139c('0x28')][_0x16610f][_0x139c('0x47')]){faxMessage[_0x139c('0x4d')](this[_0x139c('0x28')][_0x16610f][_0x139c('0x47')],_0x5aa7af)[_0x139c('0x3e')](function(_0x365345){ut[_0x139c('0x49')](_0x139c('0x4e'),_0x365345);})['catch'](function(_0x4d11f6){ut['logger']('[Fax][Message][NoUpdate1]',_0x4d11f6);})[_0x139c('0x4f')](function(){delete _0x309adb['channels'][_0x16610f];delete _0x309adb[_0x139c('0x28')][_0x16610f];});}else{ut['logger'](_0x139c('0x50'));delete this[_0x139c('0x23')][_0x16610f];delete this[_0x139c('0x28')][_0x16610f];}};Fax[_0x139c('0x1d')][_0x139c('0x51')]=function(_0x271031){var _0xdee3f=this;if(this['channels'][_0x271031[_0x139c('0x22')]]){if(this[_0x139c('0x28')][_0x271031['uniqueid']]){this[_0x139c('0x23')][_0x271031['uniqueid']]['id']=this[_0x139c('0x28')][_0x271031[_0x139c('0x22')]]['id'];this[_0x139c('0x23')][_0x271031['uniqueid']][_0x139c('0x25')]=this[_0x139c('0x28')][_0x271031[_0x139c('0x22')]][_0x139c('0x25')];}logger[_0x139c('0x26')](_0x271031[_0x139c('0x22')],this['actions'][_0x271031['uniqueid']]?_0x139c('0x52'):_0x139c('0x53'),JSON['stringify'](this[_0x139c('0x23')][_0x271031[_0x139c('0x22')]]));if(this[_0x139c('0x28')][_0x271031[_0x139c('0x22')]]){if(this[_0x139c('0x23')][_0x271031['uniqueid']]['faxpages']>0x0&&this[_0x139c('0x23')][_0x271031['uniqueid']][_0x139c('0x16')]==='SUCCESS'){this[_0x139c('0x4c')](_0x271031[_0x139c('0x22')],!![]);}else{this[_0x139c('0x4c')](_0x271031[_0x139c('0x22')],![],this[_0x139c('0x23')][_0x271031[_0x139c('0x22')]][_0x139c('0x54')]?_0x139c('0x55')+this[_0x139c('0x23')][_0x271031['uniqueid']][_0x139c('0x54')]:_0x139c('0x56'));}}}};Fax[_0x139c('0x1d')][_0x139c('0x57')]=function(_0x487260){var _0x4fcbab=this;return new BPromise(function(_0x1baa09,_0x39eeaf){_0x4fcbab['execOriginate'](_0x487260,_0x4fcbab['faxAccounts'][_0x487260[_0x139c('0x58')]])[_0x139c('0x3e')](function(_0x34cca8){ut[_0x139c('0x49')]('[Fax][execOriginate][success]',_0x34cca8);_0x1baa09(ut['message']('Fax\x20received'));})['catch'](function(_0x4dcf3a){ut['logger'](_0x139c('0x59'),_0x4dcf3a);updateStatus(_0x487260);_0x39eeaf(ut[_0x139c('0x39')](_0x139c('0x5a')));});});};Fax[_0x139c('0x1d')][_0x139c('0x5b')]=function(_0x305959){var _0x2db82b=this;return new BPromise(function(_0x36f6ef,_0x2238d5){var _0x50ceaa=_0x2db82b[_0x139c('0x5c')](_0x2db82b[_0x139c('0xd')][_0x305959['FaxAccountId']]['Trunk'],_0x305959);if(_0x50ceaa['isValid']){_0x36f6ef(ut['message'](_0x139c('0x5d')));}else{_0x2238d5(ut[_0x139c('0x39')](_0x50ceaa['message']));}});};function originate(_0x9a4bc9,_0x3a38ce,_0x2fd741){return new BPromise(function(_0x808008,_0x4258bc){if(_0x2fd741){var _0x6f0556=util[_0x139c('0x5e')](_0x139c('0x5f'),path[_0x139c('0x3b')](_0x9a4bc9[_0x139c('0x60')])[_0x139c('0x25')],_0x9a4bc9[_0x139c('0x60')]);gs[_0x139c('0x61')](_0x6f0556)['then'](function(){_0x9a4bc9['path']=util[_0x139c('0x5e')]('%s/%s.tif',path['parse'](_0x9a4bc9[_0x139c('0x60')])[_0x139c('0x62')],path[_0x139c('0x3b')](_0x9a4bc9[_0x139c('0x60')])[_0x139c('0x25')]);_0x3a38ce['XMF-PATH']=_0x9a4bc9[_0x139c('0x60')];ut[_0x139c('0x49')](_0x139c('0x63'),'');ami['Action'](ut[_0x139c('0x64')](_0x9a4bc9,_0x3a38ce))[_0x139c('0x3e')](function(_0x4880ff){_0x808008(_0x4880ff);})[_0x139c('0x40')](function(_0xe57ac6){_0x4258bc(_0xe57ac6);});})['catch'](function(_0xd62454){_0x4258bc(_0xd62454);});}else{ami[_0x139c('0x65')](ut[_0x139c('0x64')](_0x9a4bc9,_0x3a38ce))[_0x139c('0x3e')](function(_0x16e418){_0x808008(_0x16e418);})['catch'](function(_0x4f218b){_0x4258bc(_0x4f218b);});}});}Fax[_0x139c('0x1d')][_0x139c('0x66')]=function(_0x108b9b,_0x150c7f){var _0x112984=this;return new BPromise(function(_0x113344,_0x4c2499){var _0x554641=uuid['v4']();var _0x4009c9=ut['addVariables'](_0x108b9b,_0x150c7f);_0x112984[_0x139c('0x28')][_0x554641]=new Action(_0x554641,_0x150c7f,_0x108b9b);var _0x1fe2f7=_0x112984[_0x139c('0x28')][_0x554641];if(path[_0x139c('0x3b')](_0x108b9b[_0x139c('0x60')])[_0x139c('0x67')]==='.pdf'){originate(_0x1fe2f7,_0x4009c9,!![])[_0x139c('0x3e')](function(_0x319f7d){_0x113344(_0x319f7d);})[_0x139c('0x40')](function(_0x2f8793){_0x4c2499(_0x2f8793);});}else{originate(_0x1fe2f7,_0x4009c9,![])[_0x139c('0x3e')](function(_0x38512c){_0x113344(_0x38512c);})['catch'](function(_0x417095){_0x4c2499(_0x417095);});}});};Fax[_0x139c('0x1d')]['isTrunkReachable']=function(_0x54d275){return!_[_0x139c('0x68')](_0x54d275)&&!_[_0x139c('0x68')](_0x54d275[_0x139c('0x25')])&&!_[_0x139c('0x68')](_0x54d275['active'])&&_0x54d275[_0x139c('0x69')]&&!_[_0x139c('0x68')](this[_0x139c('0xe')][util[_0x139c('0x5e')](_0x139c('0x6a'),_0x54d275[_0x139c('0x25')])])&&!_[_0x139c('0x68')](this[_0x139c('0xe')][util[_0x139c('0x5e')]('SIP/%s',_0x54d275[_0x139c('0x25')])]['status'])&&(this['trunks'][util[_0x139c('0x5e')](_0x139c('0x6a'),_0x54d275[_0x139c('0x25')])]['status']===_0x139c('0x6b')||this[_0x139c('0xe')][util[_0x139c('0x5e')](_0x139c('0x6a'),_0x54d275['name'])]['status']===_0x139c('0x6c'));};Fax[_0x139c('0x1d')][_0x139c('0x5c')]=function(_0x52b6ef,_0x13f18f){if(!this['isTrunkReachable'](_0x52b6ef)){ut[_0x139c('0x49')](_0x139c('0x6d'),_[_0x139c('0x68')](_0x52b6ef)?'':_0x52b6ef[_0x139c('0x25')]+_0x139c('0x6e'));return{'isValid':![],'message':_0x139c('0x6f')};}if(_[_0x139c('0x68')](_0x13f18f[_0x139c('0x6')])){ut['logger'](_0x139c('0x70'),JSON[_0x139c('0x44')](_0x13f18f));return{'isValid':![],'message':_0x139c('0x71')};}if(_['isNil'](_0x13f18f[_0x139c('0x60')])){ut[_0x139c('0x49')](_0x139c('0x72'),JSON[_0x139c('0x44')](_0x13f18f));return{'isValid':![],'message':_0x139c('0x73')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 25dd54a..0bfaf75 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 _0x668c=['error','notify','util','bluebird','../../../config/logger','preview','../rpc/faxAccount'];(function(_0x11b710,_0x3805eb){var _0x565030=function(_0x5788de){while(--_0x5788de){_0x11b710['push'](_0x11b710['shift']());}};_0x565030(++_0x3805eb);}(_0x668c,0x1bb));var _0xc668=function(_0x1f3c56,_0x598757){_0x1f3c56=_0x1f3c56-0x0;var _0x569524=_0x668c[_0x1f3c56];return _0x569524;};'use strict';var util=require(_0xc668('0x0'));var BPromise=require(_0xc668('0x1'));var logger=require(_0xc668('0x2'))(_0xc668('0x3'));var _=require('lodash');var faxAccount=require(_0xc668('0x4'));function loggerCatch(_0x248445){return function(_0x1e39b3){logger[_0xc668('0x5')](_0x248445,util['inspect'](_0x1e39b3,{'showHidden':![],'depth':null}));};}exports[_0xc668('0x6')]=function(_0x207247,_0x17d143){return BPromise['resolve']()['then'](faxAccount[_0xc668('0x6')](_0x207247,_0x17d143))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x4240=['../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20','util','bluebird'];(function(_0x35bd6c,_0x585087){var _0x2f421d=function(_0x42ae70){while(--_0x42ae70){_0x35bd6c['push'](_0x35bd6c['shift']());}};_0x2f421d(++_0x585087);}(_0x4240,0x148));var _0x0424=function(_0x28f2db,_0x20cb8b){_0x28f2db=_0x28f2db-0x0;var _0x3d93b7=_0x4240[_0x28f2db];return _0x3d93b7;};'use strict';var util=require(_0x0424('0x0'));var BPromise=require(_0x0424('0x1'));var logger=require(_0x0424('0x2'))('preview');var _=require(_0x0424('0x3'));var faxAccount=require(_0x0424('0x4'));function loggerCatch(_0x3414e6){return function(_0x3adcf4){logger[_0x0424('0x5')](_0x3414e6,util[_0x0424('0x6')](_0x3adcf4,{'showHidden':![],'depth':null}));};}exports[_0x0424('0x7')]=function(_0x4818a4,_0x2025a0){return BPromise['resolve']()[_0x0424('0x8')](faxAccount[_0x0424('0x7')](_0x4818a4,_0x2025a0))[_0x0424('0x9')](loggerCatch(_0x0424('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index d45f876..7e20350 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 _0x42ac=['bluebird','child_process','exec','execute','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x4f62fd,_0x515bda){var _0x406878=function(_0x1975d2){while(--_0x1975d2){_0x4f62fd['push'](_0x4f62fd['shift']());}};_0x406878(++_0x515bda);}(_0x42ac,0x151));var _0xc42a=function(_0x178f2f,_0x40480e){_0x178f2f=_0x178f2f-0x0;var _0x4f890b=_0x42ac[_0x178f2f];return _0x4f890b;};'use strict';var util=require(_0xc42a('0x0'));var logger=require(_0xc42a('0x1'))(_0xc42a('0x2'));var BPromise=require(_0xc42a('0x3'));var exec=require(_0xc42a('0x4'))[_0xc42a('0x5')];exports[_0xc42a('0x6')]=function(_0x117350){return new BPromise(function(_0x1d883a,_0x4878a0){exec(_0x117350,function(_0xb944e8,_0x1765c8,_0x2a87df){logger['info'](_0xc42a('0x7'),_0x1765c8);if(_0xb944e8){logger['info'](_0xc42a('0x7'),_0xc42a('0x8'),util[_0xc42a('0x9')](_0xb944e8,{'showHidden':![],'depth':null}),_0x1765c8,_0x2a87df);_0x4878a0(_0xb944e8);}_0x1d883a(_0x1765c8);});});}; \ No newline at end of file +var _0x080b=['info','inspect','util','../../../../config/logger','fax','bluebird','child_process','execute','Exec\x20gs'];(function(_0x46b979,_0x3f0e9a){var _0x355217=function(_0x3c297d){while(--_0x3c297d){_0x46b979['push'](_0x46b979['shift']());}};_0x355217(++_0x3f0e9a);}(_0x080b,0xe3));var _0xb080=function(_0x369758,_0xe06da2){_0x369758=_0x369758-0x0;var _0x20aec7=_0x080b[_0x369758];return _0x20aec7;};'use strict';var util=require(_0xb080('0x0'));var logger=require(_0xb080('0x1'))(_0xb080('0x2'));var BPromise=require(_0xb080('0x3'));var exec=require(_0xb080('0x4'))['exec'];exports[_0xb080('0x5')]=function(_0x11a5e8){return new BPromise(function(_0x395b68,_0x2e0be0){exec(_0x11a5e8,function(_0x1b69b4,_0x56492e,_0x16b317){logger['info'](_0xb080('0x6'),_0x56492e);if(_0x1b69b4){logger[_0xb080('0x7')](_0xb080('0x6'),'\x20Error\x20:',util[_0xb080('0x8')](_0x1b69b4,{'showHidden':![],'depth':null}),_0x56492e,_0x16b317);_0x2e0be0(_0x1b69b4);}_0x395b68(_0x56492e);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 65cd831..79ff281 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 _0xc368=['from-sip','\x22%s\x22\x20<%s>','localstationid','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc368,0x7b));var _0x8c36=function(_0x234acb,_0x1f265b){_0x234acb=_0x234acb-0x0;var _0x463fab=_0xc368[_0x234acb];return _0x463fab;};'use strict';var util=require('util');var _=require(_0x8c36('0x0'));var moment=require('moment');var logger=require(_0x8c36('0x1'))(_0x8c36('0x2'));exports[_0x8c36('0x3')]=function(_0x2640c5){return{'message':_0x2640c5};};exports[_0x8c36('0x4')]=function(_0x5d3b27,_0x3e9034){logger[_0x8c36('0x5')](_0x5d3b27,util[_0x8c36('0x6')](_0x3e9034,{'showHidden':![],'depth':null}));};exports[_0x8c36('0x7')]=function(_0x5ebfc1,_0x554022){var _0x8ed437={'XMF-ECM':_0x554022[_0x8c36('0x8')],'XMF-HEADERINFO':_0x554022[_0x8c36('0x9')],'XMF-MINRATE':_0x554022[_0x8c36('0xa')],'XMF-MAXRATE':_0x554022[_0x8c36('0xb')],'XMF-MODEM':util[_0x8c36('0xc')]('\x22%s\x22',_0x554022['modem']),'XMF-GATEWAY':_0x554022['gateway'],'XMF-FAXDETECT':_0x554022[_0x8c36('0xd')],'XMF-T38TIMEOUT':_0x554022[_0x8c36('0xe')],'XMF-LOCALSTATIONID':_0x554022['localstationid'],'XMF-PATH':_0x5ebfc1[_0x8c36('0xf')]};return _0x8ed437;};exports[_0x8c36('0x10')]=function(_0x1d5c61,_0xe7857e){return{'actionid':_0x1d5c61[_0x8c36('0x11')],'action':_0x8c36('0x12'),'channel':_0x1d5c61[_0x8c36('0x13')],'Exten':_0x8c36('0x14'),'Context':_0x8c36('0x15'),'Priority':'1','callerid':util[_0x8c36('0xc')](_0x8c36('0x16'),_0x1d5c61[_0x8c36('0x9')]?_0x1d5c61[_0x8c36('0x9')]:'',_0x1d5c61[_0x8c36('0x17')]),'variable':_0xe7857e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1d5c61['uniqueid']};}; \ No newline at end of file +var _0xbdb7=['faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','from-sip','util','lodash','moment','../../../../config/logger','fax','message','logger','info','headerinfo','minrate','\x22%s\x22','modem','gateway'];(function(_0x1cf768,_0x3bb462){var _0x29bb54=function(_0x3b9ca9){while(--_0x3b9ca9){_0x1cf768['push'](_0x1cf768['shift']());}};_0x29bb54(++_0x3bb462);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x526818,_0x30c916){_0x526818=_0x526818-0x0;var _0x44c7e3=_0xbdb7[_0x526818];return _0x44c7e3;};'use strict';var util=require(_0x7bdb('0x0'));var _=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var logger=require(_0x7bdb('0x3'))(_0x7bdb('0x4'));exports[_0x7bdb('0x5')]=function(_0x4496ac){return{'message':_0x4496ac};};exports[_0x7bdb('0x6')]=function(_0x46c068,_0x47aec5){logger[_0x7bdb('0x7')](_0x46c068,util['inspect'](_0x47aec5,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0xffdc86,_0x1e23a3){var _0x493bde={'XMF-ECM':_0x1e23a3['ecm'],'XMF-HEADERINFO':_0x1e23a3[_0x7bdb('0x8')],'XMF-MINRATE':_0x1e23a3[_0x7bdb('0x9')],'XMF-MAXRATE':_0x1e23a3['maxrate'],'XMF-MODEM':util['format'](_0x7bdb('0xa'),_0x1e23a3[_0x7bdb('0xb')]),'XMF-GATEWAY':_0x1e23a3[_0x7bdb('0xc')],'XMF-FAXDETECT':_0x1e23a3[_0x7bdb('0xd')],'XMF-T38TIMEOUT':_0x1e23a3[_0x7bdb('0xe')],'XMF-LOCALSTATIONID':_0x1e23a3[_0x7bdb('0xf')],'XMF-PATH':_0xffdc86[_0x7bdb('0x10')]};return _0x493bde;};exports[_0x7bdb('0x11')]=function(_0x5462da,_0x4e5b8e){return{'actionid':_0x5462da['uniqueid'],'action':_0x7bdb('0x12'),'channel':_0x5462da[_0x7bdb('0x13')],'Exten':'xcally-motion-fax','Context':_0x7bdb('0x14'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x5462da[_0x7bdb('0x8')]?_0x5462da[_0x7bdb('0x8')]:'',_0x5462da['localstationid']),'variable':_0x4e5b8e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5462da['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 87289b5..fc9f26a 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 _0x8221=['initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','listen','sync','log','bluebird','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./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/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0x8221,0xaa));var _0x1822=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x8221[_0x1602ef];return _0x5870ee;};'use strict';var BPromise=require(_0x1822('0x0'));var util=require(_0x1822('0x1'));var moment=require(_0x1822('0x2'));var server=require(_0x1822('0x3'));var Realtime=require('./realtime');var Report=require(_0x1822('0x4'));var Acw=require(_0x1822('0x5'));var Trigger=require(_0x1822('0x6'));var Dialer=require(_0x1822('0x7'));var Preview=require(_0x1822('0x8'));var Fax=require(_0x1822('0x9'));var user=require(_0x1822('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x1822('0xb'));var voiceCallReport=require(_0x1822('0xc'));var trunk=require(_0x1822('0xd'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x1822('0xe'));var campaign=require(_0x1822('0xf'));var voiceExtension=require(_0x1822('0x10'));var faxAccount=require(_0x1822('0x11'));var zendesk=require(_0x1822('0x12'));var salesforce=require(_0x1822('0x13'));var sugarcrm=require(_0x1822('0x14'));var freshdesk=require(_0x1822('0x15'));var desk=require(_0x1822('0x16'));var zoho=require(_0x1822('0x17'));var vtiger=require(_0x1822('0x18'));var freshsales=require(_0x1822('0x19'));var servicenow=require(_0x1822('0x1a'));var dynamics365=require(_0x1822('0x1b'));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()[_0x1822('0x1c')](_0x1822('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1822('0x1e')]()[_0x1822('0x1f')](user['getAgents']())[_0x1822('0x1f')](realtime[_0x1822('0x20')]())[_0x1822('0x1f')](user[_0x1822('0x21')]())[_0x1822('0x1f')](realtime[_0x1822('0x22')]())[_0x1822('0x1f')](trunk[_0x1822('0x23')]())[_0x1822('0x1f')](realtime[_0x1822('0x24')]())[_0x1822('0x1f')](voiceQueue[_0x1822('0x25')]())['then'](realtime[_0x1822('0x26')]())['then'](trigger[_0x1822('0x27')]())['then'](realtime[_0x1822('0x28')]())[_0x1822('0x1f')](template[_0x1822('0x29')]())[_0x1822('0x1f')](realtime[_0x1822('0x2a')]())['then'](zendesk['getZendeskAccounts']())[_0x1822('0x1f')](realtime[_0x1822('0x2b')]())[_0x1822('0x1f')](salesforce[_0x1822('0x2c')]())[_0x1822('0x1f')](realtime[_0x1822('0x2d')]())[_0x1822('0x1f')](sugarcrm[_0x1822('0x2e')]())['then'](realtime[_0x1822('0x2f')]())['then'](freshdesk[_0x1822('0x30')]())['then'](realtime['initFreshdeskAccounts']())[_0x1822('0x1f')](desk[_0x1822('0x31')]())[_0x1822('0x1f')](realtime[_0x1822('0x32')]())[_0x1822('0x1f')](zoho[_0x1822('0x33')]())['then'](realtime[_0x1822('0x34')]())[_0x1822('0x1f')](vtiger[_0x1822('0x35')]())[_0x1822('0x1f')](realtime[_0x1822('0x36')]())[_0x1822('0x1f')](freshsales['getFreshsalesAccounts']())[_0x1822('0x1f')](realtime[_0x1822('0x37')]())[_0x1822('0x1f')](servicenow['getServicenowAccounts']())[_0x1822('0x1f')](realtime[_0x1822('0x38')]())[_0x1822('0x1f')](dynamics365['getDynamics365Accounts']())[_0x1822('0x1f')](realtime[_0x1822('0x39')]())[_0x1822('0x1f')](campaign[_0x1822('0x3a')]())[_0x1822('0x1f')](realtime['initCampaigns']())['then'](voiceExtension['getVoiceExtensions']())[_0x1822('0x1f')](realtime[_0x1822('0x3b')]())['then'](faxAccount[_0x1822('0x3c')]())[_0x1822('0x1f')](realtime[_0x1822('0x3d')]())[_0x1822('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0x1822('0x1e')]()[_0x1822('0x1f')](voiceQueueReport[_0x1822('0x3e')]())[_0x1822('0x1f')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x1822('0x3f')]())[_0x1822('0x1f')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x1822('0x40')]())[_0x1822('0x1f')](realtime[_0x1822('0x41')]())[_0x1822('0x1f')](voiceCallReport['getVoiceCallReports']())[_0x1822('0x1f')](realtime[_0x1822('0x42')]())[_0x1822('0x1f')](function(_0x370736){})[_0x1822('0x43')](function(_0x1b0ba8){console['log'](_0x1b0ba8);});}function main(){return server[_0x1822('0x44')](realtime,preview,fax)['then'](function(_0x18f2fe){return initRealtime();})[_0x1822('0x1f')](function(){return initParams();})[_0x1822('0x1f')](function(){report[_0x1822('0x45')]();setInterval(initRealtime,0x1388);})[_0x1822('0x43')](function(_0x1ecd59){console[_0x1822('0x46')](_0x1ecd59);});}main(); \ No newline at end of file +var _0xd1aa=['hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get'];(function(_0x4976eb,_0x4b09d1){var _0x5dd7b2=function(_0x4556a2){while(--_0x4556a2){_0x4976eb['push'](_0x4976eb['shift']());}};_0x5dd7b2(++_0x4b09d1);}(_0xd1aa,0x136));var _0xad1a=function(_0x923ab6,_0x200ec5){_0x923ab6=_0x923ab6-0x0;var _0x484752=_0xd1aa[_0x923ab6];return _0x484752;};'use strict';var BPromise=require(_0xad1a('0x0'));var util=require(_0xad1a('0x1'));var moment=require(_0xad1a('0x2'));var server=require(_0xad1a('0x3'));var Realtime=require(_0xad1a('0x4'));var Report=require(_0xad1a('0x5'));var Acw=require('./acw');var Trigger=require(_0xad1a('0x6'));var Dialer=require(_0xad1a('0x7'));var Preview=require(_0xad1a('0x8'));var Fax=require(_0xad1a('0x9'));var user=require(_0xad1a('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xad1a('0xb'));var trigger=require('./rpc/trigger');var template=require(_0xad1a('0xc'));var cmHopperHistory=require(_0xad1a('0xd'));var campaign=require(_0xad1a('0xe'));var voiceExtension=require(_0xad1a('0xf'));var faxAccount=require(_0xad1a('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xad1a('0x11'));var freshdesk=require(_0xad1a('0x12'));var desk=require(_0xad1a('0x13'));var zoho=require(_0xad1a('0x14'));var vtiger=require(_0xad1a('0x15'));var freshsales=require(_0xad1a('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xad1a('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xad1a('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xad1a('0x18')](_0xad1a('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xad1a('0x1a')]()[_0xad1a('0x1b')](user[_0xad1a('0x1c')]())[_0xad1a('0x1b')](realtime['initAgents']())[_0xad1a('0x1b')](user[_0xad1a('0x1d')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x1e')]())[_0xad1a('0x1b')](trunk[_0xad1a('0x1f')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x20')]())[_0xad1a('0x1b')](voiceQueue[_0xad1a('0x21')]())[_0xad1a('0x1b')](realtime['initVoiceQueues']())[_0xad1a('0x1b')](trigger[_0xad1a('0x22')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x23')]())['then'](template[_0xad1a('0x24')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x25')]())['then'](zendesk['getZendeskAccounts']())[_0xad1a('0x1b')](realtime[_0xad1a('0x26')]())[_0xad1a('0x1b')](salesforce[_0xad1a('0x27')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x28')]())[_0xad1a('0x1b')](sugarcrm[_0xad1a('0x29')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x2a')]())[_0xad1a('0x1b')](freshdesk[_0xad1a('0x2b')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x2c')]())[_0xad1a('0x1b')](desk[_0xad1a('0x2d')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x2e')]())[_0xad1a('0x1b')](zoho[_0xad1a('0x2f')]())['then'](realtime[_0xad1a('0x30')]())[_0xad1a('0x1b')](vtiger[_0xad1a('0x31')]())['then'](realtime['initVtigerAccounts']())['then'](freshsales[_0xad1a('0x32')]())['then'](realtime[_0xad1a('0x33')]())[_0xad1a('0x1b')](servicenow['getServicenowAccounts']())[_0xad1a('0x1b')](realtime[_0xad1a('0x34')]())[_0xad1a('0x1b')](dynamics365[_0xad1a('0x35')]())[_0xad1a('0x1b')](realtime['initDynamics365Accounts']())[_0xad1a('0x1b')](campaign[_0xad1a('0x36')]())[_0xad1a('0x1b')](realtime['initCampaigns']())[_0xad1a('0x1b')](voiceExtension[_0xad1a('0x37')]())[_0xad1a('0x1b')](realtime['initVoiceExtensions']())[_0xad1a('0x1b')](faxAccount[_0xad1a('0x38')]())[_0xad1a('0x1b')](realtime['initFaxAccounts']())[_0xad1a('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0xad1a('0x1a')]()[_0xad1a('0x1b')](voiceQueueReport[_0xad1a('0x39')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x3a')]())[_0xad1a('0x1b')](cmHopperHistory[_0xad1a('0x3b')]())['then'](realtime[_0xad1a('0x3c')]())[_0xad1a('0x1b')](cmHopperHistory['getCampaignHopperHistory']())[_0xad1a('0x1b')](realtime[_0xad1a('0x3d')]())[_0xad1a('0x1b')](voiceCallReport[_0xad1a('0x3e')]())[_0xad1a('0x1b')](realtime['initVoiceCallReports']())['then'](function(_0x30b683){})[_0xad1a('0x3f')](function(_0x1189f5){console[_0xad1a('0x40')](_0x1189f5);});}function main(){return server[_0xad1a('0x41')](realtime,preview,fax)[_0xad1a('0x1b')](function(_0x381745){return initRealtime();})['then'](function(){return initParams();})[_0xad1a('0x1b')](function(){report[_0xad1a('0x42')]();setInterval(initRealtime,0x1388);})[_0xad1a('0x3f')](function(_0x230a68){console['log'](_0x230a68);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index ed29c05..3ecba13 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 _0x7c02=['name','email','accountcode','fullname','state','unknown','stateTime','status','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','format','address','onhold','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter'];(function(_0xb34da7,_0x232e55){var _0x22c1c5=function(_0x36df2d){while(--_0x36df2d){_0xb34da7['push'](_0xb34da7['shift']());}};_0x22c1c5(++_0x232e55);}(_0x7c02,0x6f));var _0x27c0=function(_0x511630,_0x23f1f2){_0x511630=_0x511630-0x0;var _0x2b2d03=_0x7c02[_0x511630];return _0x2b2d03;};'use strict';var _=require(_0x27c0('0x0'));var util=require(_0x27c0('0x1'));var moment=require(_0x27c0('0x2'));var md5=require(_0x27c0('0x3'));var Redis=require(_0x27c0('0x4'));var config=require(_0x27c0('0x5'));config[_0x27c0('0x6')]=_['defaults'](config['redis'],{'host':_0x27c0('0x7'),'port':0x18eb});var io=require(_0x27c0('0x8'))(new Redis(config[_0x27c0('0x6')]));function Agent(_0x309486){this['id']=_0x309486['id']||0x0;this[_0x27c0('0x9')]=_0x309486[_0x27c0('0x9')]||'';this[_0x27c0('0xa')]=_0x309486[_0x27c0('0xa')]||'';this[_0x27c0('0xb')]=_0x309486[_0x27c0('0xb')]||'';this[_0x27c0('0xc')]=_0x309486[_0x27c0('0xc')]||'';this[_0x27c0('0xd')]=_0x27c0('0xe');this[_0x27c0('0xf')]=0x0;this[_0x27c0('0x10')]='unknown';this['address']='';this['phone']='';this[_0x27c0('0x11')]='';this['interface']='';this[_0x27c0('0x12')]=_0x309486['online']||![];this['voiceStatus']=_0x27c0('0xe');this[_0x27c0('0x13')]=0x0;this[_0x27c0('0x14')]='';this[_0x27c0('0x15')]='';this['onhold']=![];this[_0x27c0('0x16')]=![];this['md5']='';}Agent[_0x27c0('0x17')][_0x27c0('0x18')]=function(_0x38f564){var _0x2fb755;if(_0x38f564&&_0x38f564[_0x27c0('0xd')]){_0x2fb755=_0x38f564[_0x27c0('0xd')]['toLowerCase']();switch(_0x2fb755){case _0x27c0('0x19'):_0x2fb755=_0x27c0('0x1a');break;case _0x27c0('0x1b'):_0x2fb755=_0x27c0('0x1c');break;}}if(_0x2fb755&&this[_0x27c0('0x1d')]!==_0x2fb755||_0x38f564[_0x27c0('0x1e')]){this[_0x27c0('0x13')]=_[_0x27c0('0x1f')](moment()[_0x27c0('0x20')]('x'));}if(_0x2fb755){this[_0x27c0('0x1d')]=_0x2fb755;}var _0x479270={'id':this['id'],'name':this[_0x27c0('0x9')],'email':this[_0x27c0('0xa')],'accountcode':this[_0x27c0('0xb')],'fullname':this[_0x27c0('0xc')],'state':this[_0x27c0('0xd')],'stateTime':this[_0x27c0('0xf')],'status':this[_0x27c0('0x10')],'address':this[_0x27c0('0x21')],'online':this['online'],'voiceStatus':this[_0x27c0('0x1d')],'voiceStatusTime':this[_0x27c0('0x13')],'voiceStatusCallerIdNumber':this[_0x27c0('0x14')],'voiceStatusQueue':this[_0x27c0('0x15')],'interface':this['interface'],'onhold':this[_0x27c0('0x22')]};var _0x57c86c=md5(JSON[_0x27c0('0x23')](_0x479270));if(this[_0x27c0('0x3')]!==_0x57c86c){this[_0x27c0('0x3')]=_0x57c86c;io['to'](util[_0x27c0('0x20')](_0x27c0('0x24'),_0x479270['name']))[_0x27c0('0x25')](_0x27c0('0x26'),_0x479270);}};module[_0x27c0('0x27')]=Agent; \ No newline at end of file +var _0x26e1=['online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','voiceStatusTime','toNumber','format','status','user:%s','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','mobile','interface'];(function(_0xc6b011,_0x5d1f19){var _0x420171=function(_0x433751){while(--_0x433751){_0xc6b011['push'](_0xc6b011['shift']());}};_0x420171(++_0x5d1f19);}(_0x26e1,0xff));var _0x126e=function(_0x4037d7,_0x5a292f){_0x4037d7=_0x4037d7-0x0;var _0x2799b7=_0x26e1[_0x4037d7];return _0x2799b7;};'use strict';var _=require(_0x126e('0x0'));var util=require('util');var moment=require(_0x126e('0x1'));var md5=require(_0x126e('0x2'));var Redis=require(_0x126e('0x3'));var config=require(_0x126e('0x4'));config[_0x126e('0x5')]=_['defaults'](config[_0x126e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x126e('0x6'))(new Redis(config[_0x126e('0x5')]));function Agent(_0x495013){this['id']=_0x495013['id']||0x0;this[_0x126e('0x7')]=_0x495013['name']||'';this[_0x126e('0x8')]=_0x495013[_0x126e('0x8')]||'';this[_0x126e('0x9')]=_0x495013['accountcode']||'';this[_0x126e('0xa')]=_0x495013[_0x126e('0xa')]||'';this[_0x126e('0xb')]=_0x126e('0xc');this[_0x126e('0xd')]=0x0;this['status']=_0x126e('0xc');this[_0x126e('0xe')]='';this[_0x126e('0xf')]='';this[_0x126e('0x10')]='';this[_0x126e('0x11')]='';this[_0x126e('0x12')]=_0x495013[_0x126e('0x12')]||![];this[_0x126e('0x13')]='unknown';this['voiceStatusTime']=0x0;this[_0x126e('0x14')]='';this[_0x126e('0x15')]='';this[_0x126e('0x16')]=![];this[_0x126e('0x17')]=![];this['md5']='';}Agent['prototype'][_0x126e('0x18')]=function(_0x1db089){var _0x26f64a;if(_0x1db089&&_0x1db089[_0x126e('0xb')]){_0x26f64a=_0x1db089[_0x126e('0xb')][_0x126e('0x19')]();switch(_0x26f64a){case _0x126e('0x1a'):_0x26f64a=_0x126e('0x1b');break;case _0x126e('0x1c'):_0x26f64a=_0x126e('0x1d');break;}}if(_0x26f64a&&this[_0x126e('0x13')]!==_0x26f64a||_0x1db089[_0x126e('0x1e')]){this[_0x126e('0x1f')]=_[_0x126e('0x20')](moment()[_0x126e('0x21')]('x'));}if(_0x26f64a){this[_0x126e('0x13')]=_0x26f64a;}var _0x1cf30a={'id':this['id'],'name':this[_0x126e('0x7')],'email':this[_0x126e('0x8')],'accountcode':this[_0x126e('0x9')],'fullname':this['fullname'],'state':this[_0x126e('0xb')],'stateTime':this[_0x126e('0xd')],'status':this[_0x126e('0x22')],'address':this[_0x126e('0xe')],'online':this[_0x126e('0x12')],'voiceStatus':this[_0x126e('0x13')],'voiceStatusTime':this[_0x126e('0x1f')],'voiceStatusCallerIdNumber':this[_0x126e('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x126e('0x11')],'onhold':this[_0x126e('0x16')]};var _0x53bd21=md5(JSON['stringify'](_0x1cf30a));if(this[_0x126e('0x2')]!==_0x53bd21){this[_0x126e('0x2')]=_0x53bd21;io['to'](util[_0x126e('0x21')](_0x126e('0x23'),_0x1cf30a[_0x126e('0x7')]))[_0x126e('0x24')](_0x126e('0x25'),_0x1cf30a);}};module[_0x126e('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 67d086d..0895494 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 _0x4977=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x9afd90,_0x55b893){var _0x1c89df=function(_0x101249){while(--_0x101249){_0x9afd90['push'](_0x9afd90['shift']());}};_0x1c89df(++_0x55b893);}(_0x4977,0x103));var _0x7497=function(_0x445327,_0x4f51d4){_0x445327=_0x445327-0x0;var _0x5da98e=_0x4977[_0x445327];return _0x5da98e;};'use strict';function Campaign(_0x1c41eb){this['id']=_0x1c41eb['id']||0x0;this[_0x7497('0x0')]=_0x1c41eb[_0x7497('0x0')]||'';this['type']=_0x1c41eb['type']||_0x7497('0x1');this[_0x7497('0x2')]=0x0;this[_0x7497('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x7497('0x4')]='';this[_0x7497('0x5')]=!![];this[_0x7497('0x6')]=_0x1c41eb[_0x7497('0x6')];this['limitCalls']=_0x1c41eb[_0x7497('0x7')];this[_0x7497('0x8')]=_0x1c41eb[_0x7497('0x8')]||null;this[_0x7497('0x9')]=_0x1c41eb[_0x7497('0x9')]?_0x1c41eb[_0x7497('0x9')]:null;this[_0x7497('0xa')]=_0x1c41eb[_0x7497('0xa')];this[_0x7497('0xb')]=_0x1c41eb[_0x7497('0xb')];this[_0x7497('0xc')]=_0x1c41eb[_0x7497('0xc')]||0x1e;this[_0x7497('0xd')]=_0x1c41eb['dialCongestionMaxRetry'];this[_0x7497('0xe')]=_0x1c41eb[_0x7497('0xe')];this[_0x7497('0xf')]=_0x1c41eb[_0x7497('0xf')];this[_0x7497('0x10')]=_0x1c41eb[_0x7497('0x10')];this[_0x7497('0x11')]=_0x1c41eb[_0x7497('0x11')];this[_0x7497('0x12')]=_0x1c41eb['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x1c41eb[_0x7497('0x13')];this[_0x7497('0x14')]=_0x1c41eb['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1c41eb[_0x7497('0x15')]||0x96;this[_0x7497('0x16')]=_0x1c41eb[_0x7497('0x16')]||0x3;this[_0x7497('0x17')]=_0x1c41eb[_0x7497('0x17')]||0x96;this[_0x7497('0x18')]=_0x1c41eb[_0x7497('0x18')]||0x3;this[_0x7497('0x19')]=_0x1c41eb[_0x7497('0x19')]||0x96;this['dialMachineMaxRetry']=_0x1c41eb[_0x7497('0x1a')]||0x3;this[_0x7497('0x1b')]=_0x1c41eb[_0x7497('0x1b')]||0x96;this[_0x7497('0x1c')]=_0x1c41eb[_0x7497('0x1c')]||0x3;this[_0x7497('0x1d')]=_0x1c41eb[_0x7497('0x1d')]||0x96;this[_0x7497('0x1e')]=_0x1c41eb['dialOrderByScheduledAt']||_0x7497('0x1f');this[_0x7497('0x20')]=_0x1c41eb[_0x7497('0x20')]||undefined;this[_0x7497('0x21')]=_0x1c41eb[_0x7497('0x21')]||undefined;this[_0x7497('0x22')]=_0x1c41eb[_0x7497('0x22')]||undefined;this['TrunkBackup']=_0x1c41eb[_0x7497('0x23')]?_0x1c41eb[_0x7497('0x23')]:undefined;this[_0x7497('0x24')]=_0x1c41eb[_0x7497('0x24')]?_0x1c41eb[_0x7497('0x24')]:undefined;this[_0x7497('0x25')]=_0x1c41eb[_0x7497('0x25')]?_0x1c41eb[_0x7497('0x25')]:undefined;this[_0x7497('0x26')]=_0x1c41eb[_0x7497('0x26')]?_0x1c41eb[_0x7497('0x26')]:undefined;this['dialQueueProject']=_0x1c41eb[_0x7497('0x26')]?_0x1c41eb['SquareProject'][_0x7497('0x0')]:undefined;this[_0x7497('0x27')]=_0x1c41eb[_0x7497('0x27')]||![];this[_0x7497('0x28')]=_0x1c41eb[_0x7497('0x28')];this[_0x7497('0x29')]=_0x1c41eb[_0x7497('0x29')];this[_0x7497('0x2a')]=_0x1c41eb[_0x7497('0x2a')];this[_0x7497('0x2b')]=_0x1c41eb[_0x7497('0x2b')];this[_0x7497('0x2c')]=_0x1c41eb[_0x7497('0x2c')];this[_0x7497('0x2d')]=_0x1c41eb[_0x7497('0x2d')];this[_0x7497('0x2e')]=_0x1c41eb['dialAMDMaximumNumberOfWords'];this[_0x7497('0x2f')]=_0x1c41eb[_0x7497('0x2f')];this[_0x7497('0x30')]=_0x1c41eb['dialAMDMaximumWordLength'];}module[_0x7497('0x31')]=Campaign; \ No newline at end of file +var _0x248f=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x376d96,_0x4fe147){var _0x52a22b=function(_0x4b4837){while(--_0x4b4837){_0x376d96['push'](_0x376d96['shift']());}};_0x52a22b(++_0x4fe147);}(_0x248f,0xb8));var _0xf248=function(_0x2cc303,_0x2c4a2a){_0x2cc303=_0x2cc303-0x0;var _0x82a2ca=_0x248f[_0x2cc303];return _0x82a2ca;};'use strict';function Campaign(_0x14bc20){this['id']=_0x14bc20['id']||0x0;this['name']=_0x14bc20[_0xf248('0x0')]||'';this[_0xf248('0x1')]=_0x14bc20[_0xf248('0x1')]||_0xf248('0x2');this[_0xf248('0x3')]=0x0;this[_0xf248('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xf248('0x5')]=0x0;this['message']='';this[_0xf248('0x6')]=!![];this[_0xf248('0x7')]=_0x14bc20[_0xf248('0x7')];this[_0xf248('0x8')]=_0x14bc20['limitCalls'];this[_0xf248('0x9')]=_0x14bc20['dialTimezone']||null;this[_0xf248('0xa')]=_0x14bc20[_0xf248('0xa')]?_0x14bc20['dialGlobalInterval']:null;this[_0xf248('0xb')]=_0x14bc20[_0xf248('0xb')];this[_0xf248('0xc')]=_0x14bc20[_0xf248('0xc')];this[_0xf248('0xd')]=_0x14bc20['dialOriginateTimeout']||0x1e;this[_0xf248('0xe')]=_0x14bc20['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x14bc20[_0xf248('0xf')];this[_0xf248('0x10')]=_0x14bc20[_0xf248('0x10')];this[_0xf248('0x11')]=_0x14bc20[_0xf248('0x11')];this[_0xf248('0x12')]=_0x14bc20[_0xf248('0x12')];this['dialNoAnswerRetryFrequency']=_0x14bc20[_0xf248('0x13')];this[_0xf248('0x14')]=_0x14bc20[_0xf248('0x14')];this[_0xf248('0x15')]=_0x14bc20[_0xf248('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x14bc20[_0xf248('0x16')]||0x96;this['dialDropMaxRetry']=_0x14bc20[_0xf248('0x17')]||0x3;this[_0xf248('0x18')]=_0x14bc20[_0xf248('0x18')]||0x96;this[_0xf248('0x19')]=_0x14bc20[_0xf248('0x19')]||0x3;this[_0xf248('0x1a')]=_0x14bc20[_0xf248('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x14bc20[_0xf248('0x1b')]||0x3;this[_0xf248('0x1c')]=_0x14bc20[_0xf248('0x1c')]||0x96;this[_0xf248('0x1d')]=_0x14bc20[_0xf248('0x1d')]||0x3;this[_0xf248('0x1e')]=_0x14bc20[_0xf248('0x1e')]||0x96;this[_0xf248('0x1f')]=_0x14bc20[_0xf248('0x1f')]||_0xf248('0x20');this[_0xf248('0x21')]=_0x14bc20[_0xf248('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x14bc20[_0xf248('0x22')]||undefined;this[_0xf248('0x23')]=_0x14bc20[_0xf248('0x23')]||undefined;this[_0xf248('0x24')]=_0x14bc20['TrunkBackup']?_0x14bc20[_0xf248('0x24')]:undefined;this['Trunk']=_0x14bc20[_0xf248('0x25')]?_0x14bc20['Trunk']:undefined;this[_0xf248('0x26')]=_0x14bc20[_0xf248('0x26')]?_0x14bc20[_0xf248('0x26')]:undefined;this[_0xf248('0x27')]=_0x14bc20[_0xf248('0x27')]?_0x14bc20[_0xf248('0x27')]:undefined;this[_0xf248('0x28')]=_0x14bc20[_0xf248('0x27')]?_0x14bc20['SquareProject'][_0xf248('0x0')]:undefined;this[_0xf248('0x29')]=_0x14bc20[_0xf248('0x29')]||![];this[_0xf248('0x2a')]=_0x14bc20[_0xf248('0x2a')];this[_0xf248('0x2b')]=_0x14bc20[_0xf248('0x2b')];this['dialAMDAfterGreetingSilence']=_0x14bc20[_0xf248('0x2c')];this['dialAMDTotalAnalysisTime']=_0x14bc20[_0xf248('0x2d')];this[_0xf248('0x2e')]=_0x14bc20[_0xf248('0x2e')];this[_0xf248('0x2f')]=_0x14bc20[_0xf248('0x2f')];this[_0xf248('0x30')]=_0x14bc20['dialAMDMaximumNumberOfWords'];this[_0xf248('0x31')]=_0x14bc20[_0xf248('0x31')];this[_0xf248('0x32')]=_0x14bc20['dialAMDMaximumWordLength'];}module[_0xf248('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8346038..e6b6af8 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 _0x1c7c=['linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','context','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c7c,0x164));var _0xc1c7=function(_0x1e809f,_0x4fbeb1){_0x1e809f=_0x1e809f-0x0;var _0x46d1a9=_0x1c7c[_0x1e809f];return _0x46d1a9;};'use strict';function Channel(){this[_0xc1c7('0x0')]=null;this[_0xc1c7('0x1')]='';this[_0xc1c7('0x2')]='';this[_0xc1c7('0x3')]=0x0;this['calleridname']='';this[_0xc1c7('0x4')]=undefined;this['connectedlinename']=undefined;this[_0xc1c7('0x5')]=0x0;this[_0xc1c7('0x6')]='';this[_0xc1c7('0x7')]=0x0;this[_0xc1c7('0x8')]=0x0;this[_0xc1c7('0x9')]=0x0;this[_0xc1c7('0xa')]=![];this[_0xc1c7('0xb')]=null;this[_0xc1c7('0xc')]=null;this[_0xc1c7('0xd')]=![];this[_0xc1c7('0xe')]=![];this[_0xc1c7('0xf')]='';this[_0xc1c7('0x10')]='';this[_0xc1c7('0x11')]=0x0;this[_0xc1c7('0x12')]=0x0;this[_0xc1c7('0x13')]=0x0;this[_0xc1c7('0x14')]=null;this[_0xc1c7('0x15')]=null;this['disposition']=null;this[_0xc1c7('0x16')]=![];this[_0xc1c7('0x17')]=null;this['queue']=null;this[_0xc1c7('0x18')]=[];this[_0xc1c7('0x19')]=undefined;this[_0xc1c7('0x1a')]=undefined;this['mohtime']=0x0;}module[_0xc1c7('0x1b')]=Channel; \ No newline at end of file +var _0x8969=['monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime','type','disposition'];(function(_0x5ebba9,_0x3779f6){var _0x465602=function(_0x52da07){while(--_0x52da07){_0x5ebba9['push'](_0x5ebba9['shift']());}};_0x465602(++_0x3779f6);}(_0x8969,0x130));var _0x9896=function(_0x56d987,_0x59c364){_0x56d987=_0x56d987-0x0;var _0x8f40aa=_0x8969[_0x56d987];return _0x8f40aa;};'use strict';function Channel(){this[_0x9896('0x0')]=null;this['channel']='';this[_0x9896('0x1')]='';this[_0x9896('0x2')]=0x0;this[_0x9896('0x3')]='';this[_0x9896('0x4')]=undefined;this[_0x9896('0x5')]=undefined;this[_0x9896('0x6')]=0x0;this[_0x9896('0x7')]='';this['uniqueid']=0x0;this[_0x9896('0x8')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x9896('0x9')]=null;this[_0x9896('0xa')]=null;this[_0x9896('0xb')]=![];this['abandoned']=![];this[_0x9896('0xc')]='';this[_0x9896('0xd')]='';this[_0x9896('0xe')]=0x0;this['billableseconds']=0x0;this[_0x9896('0xf')]=0x0;this[_0x9896('0x10')]=null;this['tag']=null;this[_0x9896('0x11')]=null;this[_0x9896('0x12')]=![];this['monitorFilename']=null;this[_0x9896('0x13')]=null;this[_0x9896('0x14')]=[];this[_0x9896('0x15')]=undefined;this[_0x9896('0x16')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 8877223..8adb7bb 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 _0xb458=['token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerSecret'];(function(_0x39b7d4,_0x31d6c9){var _0x321014=function(_0x354974){while(--_0x354974){_0x39b7d4['push'](_0x39b7d4['shift']());}};_0x321014(++_0x31d6c9);}(_0xb458,0x103));var _0x8b45=function(_0x3907f1,_0x20eee7){_0x3907f1=_0x3907f1-0x0;var _0x37c3ae=_0xb458[_0x3907f1];return _0x37c3ae;};'use strict';function DeskAccount(_0x4c884c){this['id']=_0x4c884c['id']||0x0;this[_0x8b45('0x0')]=_0x4c884c[_0x8b45('0x0')]||'';this['username']=_0x4c884c['username']||'';this[_0x8b45('0x1')]=_0x4c884c[_0x8b45('0x1')]||'';this[_0x8b45('0x2')]=_0x4c884c[_0x8b45('0x2')]||'';this['password']=_0x4c884c[_0x8b45('0x3')]||'';this['consumerKey']=_0x4c884c['consumerKey']||'';this[_0x8b45('0x4')]=_0x4c884c[_0x8b45('0x4')]||'';this[_0x8b45('0x5')]=_0x4c884c[_0x8b45('0x5')]||'';this[_0x8b45('0x6')]=_0x4c884c['tokenSecret']||'';this[_0x8b45('0x7')]=_0x4c884c[_0x8b45('0x7')]||'';this[_0x8b45('0x8')]=_0x4c884c[_0x8b45('0x8')]||'';this[_0x8b45('0x9')]=_0x4c884c['Configurations']||{};}module[_0x8b45('0xa')]=DeskAccount; \ No newline at end of file +var _0xd7ce=['serverUrl','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x58d76a,_0x49404b){var _0x31dfba=function(_0x149756){while(--_0x149756){_0x58d76a['push'](_0x58d76a['shift']());}};_0x31dfba(++_0x49404b);}(_0xd7ce,0x16b));var _0xed7c=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0xd7ce[_0xb83ec2];return _0x4d2fbf;};'use strict';function DeskAccount(_0x9eb2f6){this['id']=_0x9eb2f6['id']||0x0;this[_0xed7c('0x0')]=_0x9eb2f6[_0xed7c('0x0')]||'';this[_0xed7c('0x1')]=_0x9eb2f6['username']||'';this['remoteUri']=_0x9eb2f6[_0xed7c('0x2')]||'';this['authType']=_0x9eb2f6['authType']||'';this['password']=_0x9eb2f6[_0xed7c('0x3')]||'';this[_0xed7c('0x4')]=_0x9eb2f6[_0xed7c('0x4')]||'';this[_0xed7c('0x5')]=_0x9eb2f6[_0xed7c('0x5')]||'';this[_0xed7c('0x6')]=_0x9eb2f6[_0xed7c('0x6')]||'';this[_0xed7c('0x7')]=_0x9eb2f6[_0xed7c('0x7')]||'';this[_0xed7c('0x8')]=_0x9eb2f6[_0xed7c('0x8')]||'';this[_0xed7c('0x9')]=_0x9eb2f6['serverUrl']||'';this[_0xed7c('0xa')]=_0x9eb2f6[_0xed7c('0xa')]||{};}module[_0xed7c('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d8344f0..edd561e 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 _0x5fde=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x3dac83,_0x2a89b7){var _0x5ab791=function(_0x593efc){while(--_0x593efc){_0x3dac83['push'](_0x3dac83['shift']());}};_0x5ab791(++_0x2a89b7);}(_0x5fde,0xc2));var _0xe5fd=function(_0x4bb632,_0x5176c9){_0x4bb632=_0x4bb632-0x0;var _0x39ec02=_0x5fde[_0x4bb632];return _0x39ec02;};'use strict';function Dynamics365Account(_0x5e6c8a){this['id']=_0x5e6c8a['id']||0x0;this[_0xe5fd('0x0')]=_0x5e6c8a['name']||'';this['username']=_0x5e6c8a[_0xe5fd('0x1')]||'';this['password']=_0x5e6c8a[_0xe5fd('0x2')]||'';this[_0xe5fd('0x3')]=_0x5e6c8a[_0xe5fd('0x3')]||'';this[_0xe5fd('0x4')]=_0x5e6c8a[_0xe5fd('0x4')]||'';this[_0xe5fd('0x5')]=_0x5e6c8a['clientId']||'';this[_0xe5fd('0x6')]=_0x5e6c8a['clientSecret']||{};this[_0xe5fd('0x7')]=_0x5e6c8a[_0xe5fd('0x7')]||'';this[_0xe5fd('0x8')]=_0x5e6c8a['Configurations']||{};}module[_0xe5fd('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x9225=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x27329d,_0x274e0a){var _0x4319fc=function(_0x3740a4){while(--_0x3740a4){_0x27329d['push'](_0x27329d['shift']());}};_0x4319fc(++_0x274e0a);}(_0x9225,0x171));var _0x5922=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9225[_0x5f09c5];return _0x426ad9;};'use strict';function Dynamics365Account(_0x3ae513){this['id']=_0x3ae513['id']||0x0;this[_0x5922('0x0')]=_0x3ae513['name']||'';this[_0x5922('0x1')]=_0x3ae513['username']||'';this[_0x5922('0x2')]=_0x3ae513[_0x5922('0x2')]||'';this[_0x5922('0x3')]=_0x3ae513[_0x5922('0x3')]||'';this[_0x5922('0x4')]=_0x3ae513[_0x5922('0x4')]||'';this[_0x5922('0x5')]=_0x3ae513[_0x5922('0x5')]||'';this[_0x5922('0x6')]=_0x3ae513[_0x5922('0x6')]||{};this[_0x5922('0x7')]=_0x3ae513[_0x5922('0x7')]||'';this[_0x5922('0x8')]=_0x3ae513['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 632e91d..9542354 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 _0x62a7=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x19eb57,_0x2cbd82){var _0x2abd76=function(_0x36b860){while(--_0x36b860){_0x19eb57['push'](_0x19eb57['shift']());}};_0x2abd76(++_0x2cbd82);}(_0x62a7,0x84));var _0x762a=function(_0x1bff41,_0x386880){_0x1bff41=_0x1bff41-0x0;var _0x4db66b=_0x62a7[_0x1bff41];return _0x4db66b;};'use strict';function FaxAccount(_0x303ad2){this['id']=_0x303ad2['id']||0x0;this[_0x762a('0x0')]=_0x303ad2[_0x762a('0x0')]||'';this[_0x762a('0x1')]=_0x303ad2[_0x762a('0x1')];this[_0x762a('0x2')]=_0x303ad2[_0x762a('0x2')];this[_0x762a('0x3')]=_0x303ad2[_0x762a('0x3')];this[_0x762a('0x4')]=_0x303ad2['localstationid'];this[_0x762a('0x5')]=_0x303ad2[_0x762a('0x5')]||0x960;this['maxrate']=_0x303ad2[_0x762a('0x6')]||0x3840;this[_0x762a('0x7')]=_0x303ad2[_0x762a('0x7')]||_0x762a('0x8');this[_0x762a('0x9')]=_0x303ad2[_0x762a('0x9')]||'no';this[_0x762a('0xa')]=_0x303ad2[_0x762a('0xa')]||'no';this['t38timeout']=_0x303ad2[_0x762a('0xb')]||0x1388;this['tech']=_0x303ad2[_0x762a('0xc')]||_0x762a('0xd');this[_0x762a('0xe')]=_0x303ad2[_0x762a('0xe')]?_0x303ad2[_0x762a('0xe')]:undefined;this[_0x762a('0xf')]=_0x303ad2[_0x762a('0xf')];this[_0x762a('0x10')]=_0x303ad2['key'];}module[_0x762a('0x11')]=FaxAccount; \ No newline at end of file +var _0x2af8=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x55f379,_0x165bd3){var _0x258f3c=function(_0x302223){while(--_0x302223){_0x55f379['push'](_0x55f379['shift']());}};_0x258f3c(++_0x165bd3);}(_0x2af8,0xf6));var _0x82af=function(_0x28bac5,_0x383975){_0x28bac5=_0x28bac5-0x0;var _0x2eae28=_0x2af8[_0x28bac5];return _0x2eae28;};'use strict';function FaxAccount(_0x2ac8a8){this['id']=_0x2ac8a8['id']||0x0;this['name']=_0x2ac8a8[_0x82af('0x0')]||'';this[_0x82af('0x1')]=_0x2ac8a8['description'];this[_0x82af('0x2')]=_0x2ac8a8[_0x82af('0x2')];this['headerinfo']=_0x2ac8a8[_0x82af('0x3')];this['localstationid']=_0x2ac8a8[_0x82af('0x4')];this[_0x82af('0x5')]=_0x2ac8a8['minrate']||0x960;this[_0x82af('0x6')]=_0x2ac8a8[_0x82af('0x6')]||0x3840;this['modem']=_0x2ac8a8[_0x82af('0x7')]||_0x82af('0x8');this[_0x82af('0x9')]=_0x2ac8a8[_0x82af('0x9')]||'no';this[_0x82af('0xa')]=_0x2ac8a8[_0x82af('0xa')]||'no';this[_0x82af('0xb')]=_0x2ac8a8[_0x82af('0xb')]||0x1388;this[_0x82af('0xc')]=_0x2ac8a8[_0x82af('0xc')]||_0x82af('0xd');this[_0x82af('0xe')]=_0x2ac8a8[_0x82af('0xe')]?_0x2ac8a8[_0x82af('0xe')]:undefined;this[_0x82af('0xf')]=_0x2ac8a8[_0x82af('0xf')];this[_0x82af('0x10')]=_0x2ac8a8[_0x82af('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 9ed36b4..cd93c76 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 _0x48de=['name','username','apiKey','remoteUri','serverUrl','exports'];(function(_0x10980b,_0x347714){var _0x11ff47=function(_0x1e22f3){while(--_0x1e22f3){_0x10980b['push'](_0x10980b['shift']());}};_0x11ff47(++_0x347714);}(_0x48de,0x10e));var _0xe48d=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x48de[_0x550d12];return _0x12103d;};'use strict';function FreshdeskAccount(_0x1f72a0){this['id']=_0x1f72a0['id']||0x0;this[_0xe48d('0x0')]=_0x1f72a0[_0xe48d('0x0')]||'';this['username']=_0x1f72a0[_0xe48d('0x1')]||'';this[_0xe48d('0x2')]=_0x1f72a0['token']||'';this[_0xe48d('0x3')]=_0x1f72a0[_0xe48d('0x3')]||'';this[_0xe48d('0x4')]=_0x1f72a0[_0xe48d('0x4')]||'';this['Configurations']=_0x1f72a0['Configurations']||{};}module[_0xe48d('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xadf1=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0xadf1,0x14c));var _0x1adf=function(_0x19e6ee,_0x5af0a5){_0x19e6ee=_0x19e6ee-0x0;var _0x32ea25=_0xadf1[_0x19e6ee];return _0x32ea25;};'use strict';function FreshdeskAccount(_0x118fb5){this['id']=_0x118fb5['id']||0x0;this[_0x1adf('0x0')]=_0x118fb5['name']||'';this[_0x1adf('0x1')]=_0x118fb5[_0x1adf('0x1')]||'';this['apiKey']=_0x118fb5[_0x1adf('0x2')]||'';this[_0x1adf('0x3')]=_0x118fb5[_0x1adf('0x3')]||'';this[_0x1adf('0x4')]=_0x118fb5[_0x1adf('0x4')]||'';this['Configurations']=_0x118fb5[_0x1adf('0x5')]||{};}module[_0x1adf('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 782593f..79377f3 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 _0xe597=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x4fdf94,_0x2c0b5d){var _0x99e069=function(_0x3d1d62){while(--_0x3d1d62){_0x4fdf94['push'](_0x4fdf94['shift']());}};_0x99e069(++_0x2c0b5d);}(_0xe597,0x157));var _0x7e59=function(_0x6863c,_0x590734){_0x6863c=_0x6863c-0x0;var _0x493c5b=_0xe597[_0x6863c];return _0x493c5b;};'use strict';function FreshsalesAccount(_0x49943e){this['id']=_0x49943e['id']||0x0;this[_0x7e59('0x0')]=_0x49943e[_0x7e59('0x0')]||'';this[_0x7e59('0x1')]=_0x49943e[_0x7e59('0x1')]||'';this[_0x7e59('0x2')]=_0x49943e[_0x7e59('0x3')]||'';this[_0x7e59('0x4')]=_0x49943e[_0x7e59('0x4')]||'';this[_0x7e59('0x5')]=_0x49943e['serverUrl']||'';this[_0x7e59('0x6')]=_0x49943e[_0x7e59('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x33eb=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x1b5838,_0x25ec5b){var _0x213065=function(_0xde01bf){while(--_0xde01bf){_0x1b5838['push'](_0x1b5838['shift']());}};_0x213065(++_0x25ec5b);}(_0x33eb,0x6d));var _0xb33e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33eb[_0x20a584];return _0x4b41a8;};'use strict';function FreshsalesAccount(_0xc6539){this['id']=_0xc6539['id']||0x0;this[_0xb33e('0x0')]=_0xc6539['name']||'';this['username']=_0xc6539[_0xb33e('0x1')]||'';this[_0xb33e('0x2')]=_0xc6539[_0xb33e('0x3')]||'';this[_0xb33e('0x4')]=_0xc6539[_0xb33e('0x4')]||'';this['serverUrl']=_0xc6539[_0xb33e('0x5')]||'';this[_0xb33e('0x6')]=_0xc6539[_0xb33e('0x6')]||{};}module[_0xb33e('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8b098ff..c67407b 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 _0xcfe7=['calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','assigned','variables','exports','type','inbound'];(function(_0x5b7ca3,_0xe2c9db){var _0x3f48d5=function(_0x137e8e){while(--_0x137e8e){_0x5b7ca3['push'](_0x5b7ca3['shift']());}};_0x3f48d5(++_0xe2c9db);}(_0xcfe7,0xfb));var _0x7cfe=function(_0x36e872,_0x2cbdf8){_0x36e872=_0x36e872-0x0;var _0x1601b6=_0xcfe7[_0x36e872];return _0x1601b6;};'use strict';function QueueReport(){this[_0x7cfe('0x0')]=_0x7cfe('0x1');this['uniqueid']='';this[_0x7cfe('0x2')]='';this[_0x7cfe('0x3')]='';this['queue']='';this[_0x7cfe('0x4')]=null;this[_0x7cfe('0x5')]=null;this[_0x7cfe('0x6')]=0x1;this['count']=0x1;this[_0x7cfe('0x7')]=![];this[_0x7cfe('0x8')]=null;this[_0x7cfe('0x9')]=![];this[_0x7cfe('0xa')]=null;this[_0x7cfe('0xb')]=![];this['queuecallerexitAt']=null;this[_0x7cfe('0xc')]=0x1;this[_0x7cfe('0xd')]='';this[_0x7cfe('0xe')]='';this[_0x7cfe('0xf')]='';this[_0x7cfe('0x10')]='';this[_0x7cfe('0x11')]='';this['exten']='';this[_0x7cfe('0x12')]='';this[_0x7cfe('0x13')]=0x0;this[_0x7cfe('0x14')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0x7cfe('0x15')]={};}module[_0x7cfe('0x16')]=QueueReport; \ No newline at end of file +var _0x119c=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','position','count','queuecallerabandon','queuecallerabandonAt'];(function(_0x1ca8f1,_0x2eb0b2){var _0x3a036f=function(_0x5a5dac){while(--_0x5a5dac){_0x1ca8f1['push'](_0x1ca8f1['shift']());}};_0x3a036f(++_0x2eb0b2);}(_0x119c,0x1a6));var _0xc119=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x119c[_0x2932cf];return _0x1711dd;};'use strict';function QueueReport(){this[_0xc119('0x0')]=_0xc119('0x1');this[_0xc119('0x2')]='';this[_0xc119('0x3')]='';this[_0xc119('0x4')]='';this[_0xc119('0x5')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xc119('0x6')]=0x1;this[_0xc119('0x7')]=0x1;this[_0xc119('0x8')]=![];this[_0xc119('0x9')]=null;this['queuecallercomplete']=![];this[_0xc119('0xa')]=null;this[_0xc119('0xb')]=![];this[_0xc119('0xc')]=null;this[_0xc119('0xd')]=0x1;this['channel']='';this[_0xc119('0xe')]='';this['connectedlinename']='';this[_0xc119('0xf')]='';this[_0xc119('0x10')]='';this[_0xc119('0x11')]='';this[_0xc119('0x12')]='';this[_0xc119('0x13')]=0x0;this[_0xc119('0x14')]=![];this[_0xc119('0x15')]='';this[_0xc119('0x16')]=0x0;this['variables']={};}module[_0xc119('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index a7fb9ac..2f21c48 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 _0x6d9a=['serverUrl','Configurations','exports','name','username','remoteUri','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x184b23,_0x20e9e9){var _0x155b6a=function(_0x47475e){while(--_0x47475e){_0x184b23['push'](_0x184b23['shift']());}};_0x155b6a(++_0x20e9e9);}(_0x6d9a,0x179));var _0xa6d9=function(_0x4263a2,_0x179e62){_0x4263a2=_0x4263a2-0x0;var _0x48e444=_0x6d9a[_0x4263a2];return _0x48e444;};'use strict';function SalesforceAccount(_0x5e557e){this['id']=_0x5e557e['id']||0x0;this[_0xa6d9('0x0')]=_0x5e557e[_0xa6d9('0x0')]||'';this[_0xa6d9('0x1')]=_0x5e557e['username']||'';this[_0xa6d9('0x2')]=_0x5e557e[_0xa6d9('0x2')]||'';this['password']=_0x5e557e['password']||'';this[_0xa6d9('0x3')]=_0x5e557e[_0xa6d9('0x3')]||'';this[_0xa6d9('0x4')]=_0x5e557e[_0xa6d9('0x4')]||'';this[_0xa6d9('0x5')]=_0x5e557e[_0xa6d9('0x5')]||'';this[_0xa6d9('0x6')]=_0x5e557e[_0xa6d9('0x6')]||_0xa6d9('0x7');this[_0xa6d9('0x8')]=_0x5e557e['serverUrl']||'';this[_0xa6d9('0x9')]=_0x5e557e['Configurations']||{};}module[_0xa6d9('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x4b11=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0xc9cd47,_0x35a546){var _0x26827e=function(_0x32d967){while(--_0x32d967){_0xc9cd47['push'](_0xc9cd47['shift']());}};_0x26827e(++_0x35a546);}(_0x4b11,0xf4));var _0x14b1=function(_0x27accc,_0x1dabb){_0x27accc=_0x27accc-0x0;var _0x4ff8eb=_0x4b11[_0x27accc];return _0x4ff8eb;};'use strict';function SalesforceAccount(_0x163516){this['id']=_0x163516['id']||0x0;this[_0x14b1('0x0')]=_0x163516[_0x14b1('0x0')]||'';this[_0x14b1('0x1')]=_0x163516['username']||'';this[_0x14b1('0x2')]=_0x163516[_0x14b1('0x2')]||'';this[_0x14b1('0x3')]=_0x163516['password']||'';this[_0x14b1('0x4')]=_0x163516[_0x14b1('0x4')]||'';this[_0x14b1('0x5')]=_0x163516[_0x14b1('0x5')]||'';this[_0x14b1('0x6')]=_0x163516[_0x14b1('0x6')]||'';this[_0x14b1('0x7')]=_0x163516[_0x14b1('0x7')]||_0x14b1('0x8');this[_0x14b1('0x9')]=_0x163516[_0x14b1('0x9')]||'';this[_0x14b1('0xa')]=_0x163516[_0x14b1('0xa')]||{};}module[_0x14b1('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 22361cd..2322906 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 _0xffac=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffac,0x179));var _0xcffa=function(_0x3f87c7,_0x1a0fca){_0x3f87c7=_0x3f87c7-0x0;var _0x28d7f9=_0xffac[_0x3f87c7];return _0x28d7f9;};'use strict';function ServicenowAccount(_0x257209){this['id']=_0x257209['id']||0x0;this[_0xcffa('0x0')]=_0x257209['name']||'';this['username']=_0x257209[_0xcffa('0x1')]||'';this[_0xcffa('0x2')]=_0x257209[_0xcffa('0x2')]||'';this[_0xcffa('0x3')]=_0x257209[_0xcffa('0x3')]||'';this[_0xcffa('0x4')]=_0x257209[_0xcffa('0x4')]||'';this[_0xcffa('0x5')]=_0x257209[_0xcffa('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x1aa7=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x48a4cf,_0x16e7b4){var _0x5503ee=function(_0x5a5c42){while(--_0x5a5c42){_0x48a4cf['push'](_0x48a4cf['shift']());}};_0x5503ee(++_0x16e7b4);}(_0x1aa7,0x172));var _0x71aa=function(_0x4d4db6,_0x43dabd){_0x4d4db6=_0x4d4db6-0x0;var _0x3ea9cd=_0x1aa7[_0x4d4db6];return _0x3ea9cd;};'use strict';function ServicenowAccount(_0x38ff55){this['id']=_0x38ff55['id']||0x0;this['name']=_0x38ff55[_0x71aa('0x0')]||'';this['username']=_0x38ff55['username']||'';this[_0x71aa('0x1')]=_0x38ff55[_0x71aa('0x1')]||'';this[_0x71aa('0x2')]=_0x38ff55[_0x71aa('0x2')]||'';this[_0x71aa('0x3')]=_0x38ff55[_0x71aa('0x3')]||'';this['Configurations']=_0x38ff55[_0x71aa('0x4')]||{};}module[_0x71aa('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 1f8d198..8c5528f 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 _0x041e=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x4fa820,_0x3a43b5){var _0x13b6da=function(_0x35ac51){while(--_0x35ac51){_0x4fa820['push'](_0x4fa820['shift']());}};_0x13b6da(++_0x3a43b5);}(_0x041e,0xc1));var _0xe041=function(_0xd33347,_0x110f93){_0xd33347=_0xd33347-0x0;var _0x5bf12a=_0x041e[_0xd33347];return _0x5bf12a;};'use strict';function SugarcrmAccount(_0x49fcfc){this['id']=_0x49fcfc['id']||0x0;this[_0xe041('0x0')]=_0x49fcfc[_0xe041('0x0')]||'';this['username']=_0x49fcfc[_0xe041('0x1')]||'';this['password']=_0x49fcfc[_0xe041('0x2')]||'';this[_0xe041('0x3')]=_0x49fcfc[_0xe041('0x3')]||'';this[_0xe041('0x4')]=_0x49fcfc[_0xe041('0x4')]||'';this[_0xe041('0x5')]=_0x49fcfc[_0xe041('0x5')]||{};}module[_0xe041('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xc636=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xc636,0xd7));var _0x6c63=function(_0x24a391,_0x436c7a){_0x24a391=_0x24a391-0x0;var _0x511efb=_0xc636[_0x24a391];return _0x511efb;};'use strict';function SugarcrmAccount(_0x4b1123){this['id']=_0x4b1123['id']||0x0;this[_0x6c63('0x0')]=_0x4b1123[_0x6c63('0x0')]||'';this[_0x6c63('0x1')]=_0x4b1123[_0x6c63('0x1')]||'';this['password']=_0x4b1123[_0x6c63('0x2')]||'';this[_0x6c63('0x3')]=_0x4b1123[_0x6c63('0x3')]||'';this[_0x6c63('0x4')]=_0x4b1123['serverUrl']||'';this[_0x6c63('0x5')]=_0x4b1123['Configurations']||{};}module[_0x6c63('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 8123a81..182685b 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 _0xca46=['unknown','stateTime','address','name','accountcode','state'];(function(_0x5f0703,_0xc91fd9){var _0x11c3da=function(_0x5ab71a){while(--_0x5ab71a){_0x5f0703['push'](_0x5f0703['shift']());}};_0x11c3da(++_0xc91fd9);}(_0xca46,0xab));var _0x6ca4=function(_0x2feb26,_0x44701e){_0x2feb26=_0x2feb26-0x0;var _0x4025ac=_0xca46[_0x2feb26];return _0x4025ac;};'use strict';function Telephone(_0x4a1ad0){this['id']=_0x4a1ad0['id']||0x0;this[_0x6ca4('0x0')]=_0x4a1ad0[_0x6ca4('0x0')]||'';this[_0x6ca4('0x1')]=_0x4a1ad0['accountcode']||'';this[_0x6ca4('0x2')]=_0x6ca4('0x3');this[_0x6ca4('0x4')]=0x0;this['status']=_0x6ca4('0x3');this[_0x6ca4('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x3889=['state','unknown','stateTime','address','exports','name','accountcode'];(function(_0x1d3815,_0x412c72){var _0x14450e=function(_0x1be266){while(--_0x1be266){_0x1d3815['push'](_0x1d3815['shift']());}};_0x14450e(++_0x412c72);}(_0x3889,0x155));var _0x9388=function(_0xa55744,_0x29c77b){_0xa55744=_0xa55744-0x0;var _0x4c0b5a=_0x3889[_0xa55744];return _0x4c0b5a;};'use strict';function Telephone(_0x31d82e){this['id']=_0x31d82e['id']||0x0;this[_0x9388('0x0')]=_0x31d82e[_0x9388('0x0')]||'';this[_0x9388('0x1')]=_0x31d82e[_0x9388('0x1')]||'';this[_0x9388('0x2')]=_0x9388('0x3');this[_0x9388('0x4')]=0x0;this['status']=_0x9388('0x3');this[_0x9388('0x5')]='';}module[_0x9388('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 34df453..68ebe4c 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 _0x92f6=['name','html','exports'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0x92f6,0x108));var _0x692f=function(_0x49a570,_0x522418){_0x49a570=_0x49a570-0x0;var _0x428d74=_0x92f6[_0x49a570];return _0x428d74;};'use strict';function template(_0x35d88d){this['id']=_0x35d88d['id']||0x0;this['name']=_0x35d88d[_0x692f('0x0')]||'';this['html']=_0x35d88d[_0x692f('0x1')]||'';}module[_0x692f('0x2')]=template; \ No newline at end of file +var _0xfbcb=['name','html'];(function(_0x29c533,_0x35e1a5){var _0x25a1ba=function(_0x18bb17){while(--_0x18bb17){_0x29c533['push'](_0x29c533['shift']());}};_0x25a1ba(++_0x35e1a5);}(_0xfbcb,0xd0));var _0xbfbc=function(_0x54d18a,_0x59fd02){_0x54d18a=_0x54d18a-0x0;var _0x404769=_0xfbcb[_0x54d18a];return _0x404769;};'use strict';function template(_0x49e538){this['id']=_0x49e538['id']||0x0;this[_0xbfbc('0x0')]=_0x49e538[_0xbfbc('0x0')]||'';this[_0xbfbc('0x1')]=_0x49e538[_0xbfbc('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 66f37df..897df4a 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 _0x00bb=['status','AllConditions','AnyConditions','exports','name','channel'];(function(_0x334cac,_0x502359){var _0x5c01ce=function(_0x12d850){while(--_0x12d850){_0x334cac['push'](_0x334cac['shift']());}};_0x5c01ce(++_0x502359);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x00bb[_0x5b644e];return _0x49c6bf;};'use strict';function Trigger(_0x4b870b){this['id']=_0x4b870b['id']||0x0;this[_0xb00b('0x0')]=_0x4b870b[_0xb00b('0x0')]||'';this['channel']=_0x4b870b[_0xb00b('0x1')]||'voice';this[_0xb00b('0x2')]=_0x4b870b[_0xb00b('0x2')]||![];this['AllConditions']=_0x4b870b[_0xb00b('0x3')]||[];this[_0xb00b('0x4')]=_0x4b870b['AnyConditions']||[];this['Actions']=_0x4b870b['Actions']||[];}module[_0xb00b('0x5')]=Trigger; \ No newline at end of file +var _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x55e412,_0x2f3739){var _0x2e1d05=function(_0x3fc17f){while(--_0x3fc17f){_0x55e412['push'](_0x55e412['shift']());}};_0x2e1d05(++_0x2f3739);}(_0x6aa7,0x178));var _0x76aa=function(_0x4ba437,_0x2fd8e){_0x4ba437=_0x4ba437-0x0;var _0x2c282a=_0x6aa7[_0x4ba437];return _0x2c282a;};'use strict';function Trigger(_0x8de1e4){this['id']=_0x8de1e4['id']||0x0;this['name']=_0x8de1e4[_0x76aa('0x0')]||'';this[_0x76aa('0x1')]=_0x8de1e4[_0x76aa('0x1')]||_0x76aa('0x2');this['status']=_0x8de1e4[_0x76aa('0x3')]||![];this[_0x76aa('0x4')]=_0x8de1e4[_0x76aa('0x4')]||[];this['AnyConditions']=_0x8de1e4['AnyConditions']||[];this[_0x76aa('0x5')]=_0x8de1e4['Actions']||[];}module[_0x76aa('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6968a5c..3b05fa8 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 _0x7a23=['stateTime','registry','split','host','domainport','stateRegistry','address','exports','active','name','state','unknown'];(function(_0x4a0c05,_0x3217de){var _0x54050b=function(_0x8a5cde){while(--_0x8a5cde){_0x4a0c05['push'](_0x4a0c05['shift']());}};_0x54050b(++_0x3217de);}(_0x7a23,0x170));var _0x37a2=function(_0x573810,_0x5a478c){_0x573810=_0x573810-0x0;var _0x234737=_0x7a23[_0x573810];return _0x234737;};'use strict';function Trunk(_0x2e444c){this['id']=_0x2e444c['id']||0x0;this['active']=_0x2e444c[_0x37a2('0x0')]||![];this[_0x37a2('0x1')]=_0x2e444c[_0x37a2('0x1')]||'';this[_0x37a2('0x2')]=_0x37a2('0x3');this[_0x37a2('0x4')]=0x0;this['status']=_0x37a2('0x3');this[_0x37a2('0x5')]=_0x2e444c[_0x37a2('0x5')]&&_0x2e444c['registry']['indexOf'](':')?_0x2e444c[_0x37a2('0x5')][_0x37a2('0x6')](':')[0x0]:'';this[_0x37a2('0x7')]='';this['port']='';this['domain']='';this[_0x37a2('0x8')]='';this['refresh']='';this[_0x37a2('0x9')]=_0x37a2('0x3');this['registrationtime']='';this[_0x37a2('0xa')]='';}module[_0x37a2('0xb')]=Trunk; \ No newline at end of file +var _0x6782=['active','name','unknown','stateTime','status','registry','indexOf','domain','domainport','refresh','stateRegistry','registrationtime','exports'];(function(_0x1eed89,_0x29ae4c){var _0xaf180c=function(_0x22c67b){while(--_0x22c67b){_0x1eed89['push'](_0x1eed89['shift']());}};_0xaf180c(++_0x29ae4c);}(_0x6782,0xdd));var _0x2678=function(_0x2af4bd,_0x55a732){_0x2af4bd=_0x2af4bd-0x0;var _0x43f931=_0x6782[_0x2af4bd];return _0x43f931;};'use strict';function Trunk(_0x497680){this['id']=_0x497680['id']||0x0;this[_0x2678('0x0')]=_0x497680['active']||![];this['name']=_0x497680[_0x2678('0x1')]||'';this['state']=_0x2678('0x2');this[_0x2678('0x3')]=0x0;this[_0x2678('0x4')]=_0x2678('0x2');this[_0x2678('0x5')]=_0x497680[_0x2678('0x5')]&&_0x497680[_0x2678('0x5')][_0x2678('0x6')](':')?_0x497680[_0x2678('0x5')]['split'](':')[0x0]:'';this['host']='';this['port']='';this[_0x2678('0x7')]='';this[_0x2678('0x8')]='';this[_0x2678('0x9')]='';this[_0x2678('0xa')]=_0x2678('0x2');this[_0x2678('0xb')]='';this['address']='';}module[_0x2678('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2b9bd41..1eaf47f 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 _0xfc2d=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x2f30f0,_0x56aa74){var _0x56a36a=function(_0x34c738){while(--_0x34c738){_0x2f30f0['push'](_0x2f30f0['shift']());}};_0x56a36a(++_0x56aa74);}(_0xfc2d,0xce));var _0xdfc2=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xfc2d[_0x1793de];return _0x4f0309;};'use strict';function voiceExtension(_0x1f4170){this['id']=_0x1f4170['id']||0x0;this[_0xdfc2('0x0')]=_0x1f4170[_0xdfc2('0x0')]||'';this['recordingFormat']=_0x1f4170[_0xdfc2('0x1')]||_0xdfc2('0x2');this[_0xdfc2('0x3')]=_0x1f4170[_0xdfc2('0x3')]||![];}module[_0xdfc2('0x4')]=voiceExtension; \ No newline at end of file +var _0xd036=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x517ff6,_0x41da79){var _0x5f3ce6=function(_0x1e2f7e){while(--_0x1e2f7e){_0x517ff6['push'](_0x517ff6['shift']());}};_0x5f3ce6(++_0x41da79);}(_0xd036,0xda));var _0x6d03=function(_0x1302cf,_0x388178){_0x1302cf=_0x1302cf-0x0;var _0x39729a=_0xd036[_0x1302cf];return _0x39729a;};'use strict';function voiceExtension(_0x29dcda){this['id']=_0x29dcda['id']||0x0;this['exten']=_0x29dcda[_0x6d03('0x0')]||'';this[_0x6d03('0x1')]=_0x29dcda[_0x6d03('0x1')]||_0x6d03('0x2');this[_0x6d03('0x3')]=_0x29dcda[_0x6d03('0x3')]||![];}module[_0x6d03('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6cab749..1e5e09c 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 _0xb8db=['type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','ringing','ringinuse','onhold','wav49','rrmemory','roundrobin','name','monitor_format'];(function(_0x22746d,_0x132884){var _0x3b19fd=function(_0x1aeeea){while(--_0x1aeeea){_0x22746d['push'](_0x22746d['shift']());}};_0x3b19fd(++_0x132884);}(_0xb8db,0x6b));var _0xbb8d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb8db[_0x14add3];return _0x4a174f;};'use strict';var statusDesc=[_0xbb8d('0x0'),'not_inuse',_0xbb8d('0x1'),_0xbb8d('0x2'),'invalid','unavailable',_0xbb8d('0x3'),_0xbb8d('0x4'),_0xbb8d('0x5')];var monitorFormat={'wav':'wav','wav49':_0xbb8d('0x6'),'gsm':'gsm'};var strategy={'rrmemory':_0xbb8d('0x7'),'roundrobin':_0xbb8d('0x8')};function VoiceQueue(_0x1cc354){this['id']=_0x1cc354['id']||0x0;this['name']=_0x1cc354[_0xbb8d('0x9')]||'';this[_0xbb8d('0xa')]=_0x1cc354['monitor_format']||'';this['type']=_0x1cc354[_0xbb8d('0xb')]||_0xbb8d('0xc');this[_0xbb8d('0xd')]=0x0;this['talking']=0x0;this[_0xbb8d('0xe')]=0x0;this['answered']=0x0;this[_0xbb8d('0xf')]=0x0;this[_0xbb8d('0x10')]=0x0;this[_0xbb8d('0x11')]=0x0;this[_0xbb8d('0x12')]=0x0;this['abandoned']=0x0;this[_0xbb8d('0x13')]=0x0;this[_0xbb8d('0x14')]=0x0;this[_0xbb8d('0x15')]=_0x1cc354['acw']||![];this['acwTimeout']=_0x1cc354[_0xbb8d('0x16')]||0xa;this[_0xbb8d('0x17')]=_0x1cc354[_0xbb8d('0x17')]||'no';this[_0xbb8d('0x18')]=!![];this['message']='';this[_0xbb8d('0x19')]=0x0;this[_0xbb8d('0x1a')]=0x0;this[_0xbb8d('0x1b')]=_0x1cc354[_0xbb8d('0x1b')]||null;this[_0xbb8d('0x1c')]=_0x1cc354[_0xbb8d('0x1c')]?_0x1cc354[_0xbb8d('0x1c')]:null;this[_0xbb8d('0x1d')]=_0x1cc354['dialActive'];this[_0xbb8d('0x1e')]=_0x1cc354[_0xbb8d('0x1e')]||_0xbb8d('0x1f');this[_0xbb8d('0x20')]=_0x1cc354[_0xbb8d('0x20')]||0x0;this['dialLimitQueue']=_0x1cc354[_0xbb8d('0x21')]||0x0;this[_0xbb8d('0x22')]=_0x1cc354[_0xbb8d('0x22')]||0x1;this[_0xbb8d('0x23')]=_0x1cc354[_0xbb8d('0x23')]||_0xbb8d('0x24');this[_0xbb8d('0x25')]=_0x1cc354[_0xbb8d('0x25')]||0.03;this['dialPredictiveInterval']=_0x1cc354[_0xbb8d('0x26')]||0x258;this[_0xbb8d('0x27')]=_0x1cc354[_0xbb8d('0x27')]||_0xbb8d('0x28');this[_0xbb8d('0x29')]=_0x1cc354[_0xbb8d('0x29')]||_0xbb8d('0x28');this[_0xbb8d('0x2a')]=_0x1cc354['dialOriginateTimeout']||0x1e;this[_0xbb8d('0x2b')]=_0x1cc354[_0xbb8d('0x2b')]||'tTxX';this[_0xbb8d('0x2c')]=_0x1cc354[_0xbb8d('0x2c')]||0x3;this[_0xbb8d('0x2d')]=_0x1cc354[_0xbb8d('0x2d')]||undefined;this[_0xbb8d('0x2e')]=_0x1cc354['dialCongestionMaxRetry']||0x3;this[_0xbb8d('0x2f')]=_0x1cc354[_0xbb8d('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x1cc354[_0xbb8d('0x30')]||0x3;this[_0xbb8d('0x31')]=_0x1cc354['dialBusyRetryFrequency']||0x96;this[_0xbb8d('0x32')]=_0x1cc354[_0xbb8d('0x32')]||0x3;this['dialNoAnswerRetryFrequency']=_0x1cc354[_0xbb8d('0x33')]||0x96;this[_0xbb8d('0x34')]=_0x1cc354['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1cc354[_0xbb8d('0x35')]||0x96;this[_0xbb8d('0x36')]=_0x1cc354[_0xbb8d('0x36')]||0x3;this[_0xbb8d('0x37')]=_0x1cc354[_0xbb8d('0x37')]||0x96;this[_0xbb8d('0x38')]=_0x1cc354['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x1cc354[_0xbb8d('0x39')]||0x96;this['dialMachineMaxRetry']=_0x1cc354[_0xbb8d('0x3a')]||0x3;this[_0xbb8d('0x3b')]=_0x1cc354[_0xbb8d('0x3b')]||0x96;this[_0xbb8d('0x3c')]=_0x1cc354['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x1cc354[_0xbb8d('0x3d')]||0x96;this[_0xbb8d('0x3e')]=_0x1cc354[_0xbb8d('0x3e')]||0x4;this[_0xbb8d('0x3f')]=_0x1cc354[_0xbb8d('0x3f')]?_0x1cc354[_0xbb8d('0x3f')]:undefined;this[_0xbb8d('0x40')]=_0x1cc354[_0xbb8d('0x40')]?_0x1cc354[_0xbb8d('0x40')]:undefined;this['dialPrefix']=_0x1cc354[_0xbb8d('0x41')]||undefined;this['Interval']=_0x1cc354['Interval']?_0x1cc354['Interval']:undefined;this[_0xbb8d('0x42')]=_0x1cc354[_0xbb8d('0x42')]||_0xbb8d('0x43');this[_0xbb8d('0x44')]=_0x1cc354[_0xbb8d('0x44')]||undefined;this[_0xbb8d('0x45')]=_0x1cc354[_0xbb8d('0x45')]||undefined;this[_0xbb8d('0x46')]=strategy[_0x1cc354[_0xbb8d('0x46')]]||_0xbb8d('0x7');this[_0xbb8d('0x47')]=!![];this['dialAMDActive']=_0x1cc354[_0xbb8d('0x48')]||![];this[_0xbb8d('0x49')]=_0x1cc354[_0xbb8d('0x49')];this['dialAMDGreeting']=_0x1cc354[_0xbb8d('0x4a')];this[_0xbb8d('0x4b')]=_0x1cc354[_0xbb8d('0x4b')];this[_0xbb8d('0x4c')]=_0x1cc354['dialAMDTotalAnalysisTime'];this[_0xbb8d('0x4d')]=_0x1cc354['dialAMDMinWordLength'];this[_0xbb8d('0x4e')]=_0x1cc354[_0xbb8d('0x4e')];this[_0xbb8d('0x4f')]=_0x1cc354[_0xbb8d('0x4f')];this[_0xbb8d('0x50')]=_0x1cc354['dialAMDSilenceThreshold'];this[_0xbb8d('0x51')]=_0x1cc354[_0xbb8d('0x51')];this['outboundRejectCallsDay']=0x0;this[_0xbb8d('0x52')]=0x0;this[_0xbb8d('0x53')]=_0x1cc354[_0xbb8d('0x53')];this[_0xbb8d('0x54')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xbb8d('0x55')]=0x0;this[_0xbb8d('0x56')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xbb8d('0x57')]=0x0;this[_0xbb8d('0x58')]=0x0;this[_0xbb8d('0x59')]=0x0;this[_0xbb8d('0x5a')]=0x0;this[_0xbb8d('0x5b')]=0x0;this[_0xbb8d('0x5c')]=0x0;this[_0xbb8d('0x5d')]=0x0;this['startProgressive']=undefined;this[_0xbb8d('0x5e')]=undefined;this[_0xbb8d('0x5f')]=undefined;this[_0xbb8d('0x60')]=1.05;this[_0xbb8d('0x61')]=0x0;this[_0xbb8d('0x62')]=0x0;this[_0xbb8d('0x63')]=0x0;this[_0xbb8d('0x64')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xbb8d('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xbb8d('0x66')]=0x0;this[_0xbb8d('0x67')]=_0x1cc354[_0xbb8d('0x68')]||0x14;this[_0xbb8d('0x69')]=_0x1cc354['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xbb8d('0x6a')]=0x0;this[_0xbb8d('0x6b')]=0x0;this[_0xbb8d('0x6c')]=0x1;this[_0xbb8d('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this[_0xbb8d('0x6e')]=0x0;this[_0xbb8d('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x1cc354['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x1cc354[_0xbb8d('0x70')]||![];this['dialQueueProject2']=_0x1cc354['dialQueueProject2']||undefined;this[_0xbb8d('0x71')]=_0x1cc354['dialAgiAfterHangupClient']||![];this[_0xbb8d('0x72')]=_0x1cc354[_0xbb8d('0x72')]||![];this[_0xbb8d('0xa')]=monitorFormat[_0x1cc354[_0xbb8d('0xa')]]?monitorFormat[_0x1cc354[_0xbb8d('0xa')]]:undefined;this[_0xbb8d('0x73')]=_0x1cc354[_0xbb8d('0x73')]||![];this[_0xbb8d('0x74')]=_0x1cc354[_0xbb8d('0x74')]?_0x1cc354['mandatoryDispositionPause']:undefined;}module[_0xbb8d('0x75')]=VoiceQueue; \ No newline at end of file +var _0x46e3=['rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','ringinuse','onhold','wav','wav49'];(function(_0x462e4d,_0x7ce6f7){var _0x49a7e5=function(_0x105b30){while(--_0x105b30){_0x462e4d['push'](_0x462e4d['shift']());}};_0x49a7e5(++_0x7ce6f7);}(_0x46e3,0x15d));var _0x346e=function(_0x248eac,_0x59b44a){_0x248eac=_0x248eac-0x0;var _0x5b6d06=_0x46e3[_0x248eac];return _0x5b6d06;};'use strict';var statusDesc=[_0x346e('0x0'),'not_inuse',_0x346e('0x1'),_0x346e('0x2'),_0x346e('0x3'),'unavailable','ringing',_0x346e('0x4'),_0x346e('0x5')];var monitorFormat={'wav':_0x346e('0x6'),'wav49':_0x346e('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x346e('0x8'),'roundrobin':_0x346e('0x9')};function VoiceQueue(_0x1b665a){this['id']=_0x1b665a['id']||0x0;this['name']=_0x1b665a[_0x346e('0xa')]||'';this[_0x346e('0xb')]=_0x1b665a[_0x346e('0xb')]||'';this['type']=_0x1b665a[_0x346e('0xc')]||_0x346e('0xd');this[_0x346e('0xe')]=0x0;this[_0x346e('0xf')]=0x0;this['total']=0x0;this[_0x346e('0x10')]=0x0;this['sumDuration']=0x0;this[_0x346e('0x11')]=0x0;this[_0x346e('0x12')]=0x0;this[_0x346e('0x13')]=0x0;this[_0x346e('0x14')]=0x0;this[_0x346e('0x15')]=0x0;this[_0x346e('0x16')]=0x0;this['acw']=_0x1b665a['acw']||![];this['acwTimeout']=_0x1b665a[_0x346e('0x17')]||0xa;this[_0x346e('0x18')]=_0x1b665a['autopause']||'no';this[_0x346e('0x19')]=!![];this[_0x346e('0x1a')]='';this[_0x346e('0x1b')]=0x0;this['temp']=0x0;this[_0x346e('0x1c')]=_0x1b665a[_0x346e('0x1c')]||null;this[_0x346e('0x1d')]=_0x1b665a['dialGlobalInterval']?_0x1b665a[_0x346e('0x1d')]:null;this[_0x346e('0x1e')]=_0x1b665a[_0x346e('0x1e')];this['dialMethod']=_0x1b665a[_0x346e('0x1f')]||'progressive';this['dialLimitChannel']=_0x1b665a[_0x346e('0x20')]||0x0;this[_0x346e('0x21')]=_0x1b665a['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x1b665a[_0x346e('0x22')]||0x1;this[_0x346e('0x23')]=_0x1b665a[_0x346e('0x23')]||_0x346e('0x24');this[_0x346e('0x25')]=_0x1b665a[_0x346e('0x25')]||0.03;this['dialPredictiveInterval']=_0x1b665a[_0x346e('0x26')]||0x258;this[_0x346e('0x27')]=_0x1b665a[_0x346e('0x27')]||_0x346e('0x28');this[_0x346e('0x29')]=_0x1b665a[_0x346e('0x29')]||_0x346e('0x28');this[_0x346e('0x2a')]=_0x1b665a['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x1b665a[_0x346e('0x2b')]||'tTxX';this['dialQueueTimeout']=_0x1b665a[_0x346e('0x2c')]||0x3;this[_0x346e('0x2d')]=_0x1b665a['dialQueueProject']||undefined;this[_0x346e('0x2e')]=_0x1b665a['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x1b665a[_0x346e('0x2f')]||0x96;this[_0x346e('0x30')]=_0x1b665a[_0x346e('0x30')]||0x3;this[_0x346e('0x31')]=_0x1b665a['dialBusyRetryFrequency']||0x96;this[_0x346e('0x32')]=_0x1b665a[_0x346e('0x32')]||0x3;this[_0x346e('0x33')]=_0x1b665a['dialNoAnswerRetryFrequency']||0x96;this[_0x346e('0x34')]=_0x1b665a[_0x346e('0x34')]||0x3;this[_0x346e('0x35')]=_0x1b665a[_0x346e('0x35')]||0x96;this[_0x346e('0x36')]=_0x1b665a['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x1b665a[_0x346e('0x37')]||0x96;this[_0x346e('0x38')]=_0x1b665a[_0x346e('0x38')]||0x3;this[_0x346e('0x39')]=_0x1b665a['dialAbandonedRetryFrequency']||0x96;this[_0x346e('0x3a')]=_0x1b665a[_0x346e('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x1b665a[_0x346e('0x3b')]||0x96;this[_0x346e('0x3c')]=_0x1b665a[_0x346e('0x3c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1b665a[_0x346e('0x3d')]||0x96;this[_0x346e('0x3e')]=_0x1b665a[_0x346e('0x3e')]||0x4;this['Trunk']=_0x1b665a[_0x346e('0x3f')]?_0x1b665a[_0x346e('0x3f')]:undefined;this[_0x346e('0x40')]=_0x1b665a[_0x346e('0x40')]?_0x1b665a[_0x346e('0x40')]:undefined;this[_0x346e('0x41')]=_0x1b665a[_0x346e('0x41')]||undefined;this[_0x346e('0x42')]=_0x1b665a[_0x346e('0x42')]?_0x1b665a['Interval']:undefined;this['dialOrderByScheduledAt']=_0x1b665a[_0x346e('0x43')]||_0x346e('0x44');this[_0x346e('0x45')]=_0x1b665a[_0x346e('0x45')]||undefined;this[_0x346e('0x46')]=_0x1b665a[_0x346e('0x46')]||undefined;this[_0x346e('0x47')]=strategy[_0x1b665a['strategy']]||_0x346e('0x8');this[_0x346e('0x48')]=!![];this[_0x346e('0x49')]=_0x1b665a[_0x346e('0x49')]||![];this[_0x346e('0x4a')]=_0x1b665a[_0x346e('0x4a')];this[_0x346e('0x4b')]=_0x1b665a['dialAMDGreeting'];this[_0x346e('0x4c')]=_0x1b665a['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x1b665a[_0x346e('0x4d')];this[_0x346e('0x4e')]=_0x1b665a[_0x346e('0x4e')];this[_0x346e('0x4f')]=_0x1b665a[_0x346e('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x1b665a[_0x346e('0x50')];this[_0x346e('0x51')]=_0x1b665a[_0x346e('0x51')];this['dialAMDMaximumWordLength']=_0x1b665a[_0x346e('0x52')];this['outboundRejectCallsDay']=0x0;this[_0x346e('0x53')]=0x0;this[_0x346e('0x54')]=_0x1b665a[_0x346e('0x54')];this[_0x346e('0x55')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x346e('0x56')]=0x0;this[_0x346e('0x57')]=0x0;this[_0x346e('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x346e('0x59')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x346e('0x5a')]=0x0;this[_0x346e('0x5b')]=0x0;this[_0x346e('0x5c')]=0x0;this[_0x346e('0x5d')]=0x0;this[_0x346e('0x5e')]=undefined;this[_0x346e('0x5f')]=undefined;this['handlePredictive']=undefined;this[_0x346e('0x60')]=1.05;this[_0x346e('0x61')]=0x0;this[_0x346e('0x62')]=0x0;this[_0x346e('0x63')]=0x0;this[_0x346e('0x64')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x346e('0x65')]=0x0;this[_0x346e('0x66')]=0x0;this[_0x346e('0x67')]=0x0;this[_0x346e('0x68')]=_0x1b665a[_0x346e('0x69')]||0x14;this[_0x346e('0x6a')]=_0x1b665a[_0x346e('0x69')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x346e('0x6b')]=0x0;this[_0x346e('0x6c')]=0x1;this['erlangCalls']=0x0;this[_0x346e('0x6d')]=0x0;this[_0x346e('0x6e')]=0x0;this[_0x346e('0x6f')]=0x0;this[_0x346e('0x70')]=_0x1b665a[_0x346e('0x70')]||0x1e;this[_0x346e('0x71')]=_0x1b665a[_0x346e('0x71')]||![];this['dialQueueProject2']=_0x1b665a[_0x346e('0x72')]||undefined;this['dialAgiAfterHangupClient']=_0x1b665a[_0x346e('0x73')]||![];this['dialAgiAfterHangupAgent']=_0x1b665a['dialAgiAfterHangupAgent']||![];this[_0x346e('0xb')]=monitorFormat[_0x1b665a[_0x346e('0xb')]]?monitorFormat[_0x1b665a['monitor_format']]:undefined;this[_0x346e('0x74')]=_0x1b665a[_0x346e('0x74')]||![];this['mandatoryDispositionPause']=_0x1b665a[_0x346e('0x75')]?_0x1b665a[_0x346e('0x75')]:undefined;}module[_0x346e('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3edd386..677a891 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 _0x6071=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x3645a5,_0x476d5c){var _0x1124a3=function(_0x2d3bb4){while(--_0x2d3bb4){_0x3645a5['push'](_0x3645a5['shift']());}};_0x1124a3(++_0x476d5c);}(_0x6071,0x72));var _0x1607=function(_0x30720e,_0x55753f){_0x30720e=_0x30720e-0x0;var _0x5674ac=_0x6071[_0x30720e];return _0x5674ac;};'use strict';function VtigerAccount(_0xdf7a01){this['id']=_0xdf7a01['id']||0x0;this[_0x1607('0x0')]=_0xdf7a01['name']||'';this[_0x1607('0x1')]=_0xdf7a01[_0x1607('0x1')]||'';this[_0x1607('0x2')]=_0xdf7a01[_0x1607('0x2')]||'';this['remoteUri']=_0xdf7a01[_0x1607('0x3')]||'';this[_0x1607('0x4')]=_0xdf7a01[_0x1607('0x4')]||'';this[_0x1607('0x5')]=_0xdf7a01['Configurations']||{};}module[_0x1607('0x6')]=VtigerAccount; \ No newline at end of file +var _0x22b5=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x4f5dbd,_0x531831){var _0x1d1d9e=function(_0x24fd60){while(--_0x24fd60){_0x4f5dbd['push'](_0x4f5dbd['shift']());}};_0x1d1d9e(++_0x531831);}(_0x22b5,0x131));var _0x522b=function(_0x104ae7,_0x5a1238){_0x104ae7=_0x104ae7-0x0;var _0x579279=_0x22b5[_0x104ae7];return _0x579279;};'use strict';function VtigerAccount(_0x158b46){this['id']=_0x158b46['id']||0x0;this[_0x522b('0x0')]=_0x158b46[_0x522b('0x0')]||'';this[_0x522b('0x1')]=_0x158b46[_0x522b('0x1')]||'';this[_0x522b('0x2')]=_0x158b46[_0x522b('0x2')]||'';this['remoteUri']=_0x158b46[_0x522b('0x3')]||'';this[_0x522b('0x4')]=_0x158b46[_0x522b('0x4')]||'';this[_0x522b('0x5')]=_0x158b46[_0x522b('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 9a1bee6..c3525a8 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x24007e,_0x4e2ba5){var _0x30e406=function(_0x197c71){while(--_0x197c71){_0x24007e['push'](_0x24007e['shift']());}};_0x30e406(++_0x4e2ba5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x2bb74e,_0xa4be8e){_0x2bb74e=_0x2bb74e-0x0;var _0x54cb65=_0xdb28[_0x2bb74e];return _0x54cb65;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a9eb411..b5a7c1c 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 _0x3f9b=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','clientId'];(function(_0x4133a8,_0x584733){var _0x1a62fe=function(_0x47f746){while(--_0x47f746){_0x4133a8['push'](_0x4133a8['shift']());}};_0x1a62fe(++_0x584733);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x3f9b[_0x56740a];return _0x257144;};'use strict';function ZohoAccount(_0x47caab){this['id']=_0x47caab['id']||0x0;this['name']=_0x47caab[_0xb3f9('0x0')]||'';this['description']=_0x47caab[_0xb3f9('0x1')]||'';this[_0xb3f9('0x2')]=_0x47caab['host']||'';this['zone']=_0x47caab['zone']||'';this[_0xb3f9('0x3')]=_0x47caab[_0xb3f9('0x3')]||'';this[_0xb3f9('0x4')]=_0x47caab['clientSecret']||'';this[_0xb3f9('0x5')]=_0x47caab[_0xb3f9('0x5')]||'';this[_0xb3f9('0x6')]=_0x47caab[_0xb3f9('0x6')]||'';this[_0xb3f9('0x7')]=_0x47caab['refreshToken']||'';this['Configurations']=_0x47caab[_0xb3f9('0x8')]||{};}module[_0xb3f9('0x9')]=ZohoAccount; \ No newline at end of file +var _0x2dd8=['code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x2de105,_0x274ce5){var _0x26b2ef=function(_0x5bcb03){while(--_0x5bcb03){_0x2de105['push'](_0x2de105['shift']());}};_0x26b2ef(++_0x274ce5);}(_0x2dd8,0x143));var _0x82dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2dd8[_0x19e35c];return _0x3e1fe8;};'use strict';function ZohoAccount(_0x202a72){this['id']=_0x202a72['id']||0x0;this[_0x82dd('0x0')]=_0x202a72['name']||'';this['description']=_0x202a72[_0x82dd('0x1')]||'';this[_0x82dd('0x2')]=_0x202a72[_0x82dd('0x2')]||'';this[_0x82dd('0x3')]=_0x202a72[_0x82dd('0x3')]||'';this[_0x82dd('0x4')]=_0x202a72[_0x82dd('0x4')]||'';this['clientSecret']=_0x202a72[_0x82dd('0x5')]||'';this[_0x82dd('0x6')]=_0x202a72[_0x82dd('0x6')]||'';this[_0x82dd('0x7')]=_0x202a72['code']||'';this[_0x82dd('0x8')]=_0x202a72[_0x82dd('0x8')]||'';this[_0x82dd('0x9')]=_0x202a72[_0x82dd('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 283145c..4d41960 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 _0xd5f9=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','number','exports','util','lodash','moment','isNil','string','idContact','queue','type','membername','Agent','name','format','SIP/%s','calleridname','Contact','phone','firstName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x4be573,_0x18ec20){var _0x2b6e0a=function(_0x43a80d){while(--_0x43a80d){_0x4be573['push'](_0x4be573['shift']());}};_0x2b6e0a(++_0x18ec20);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0xd5f9[_0x2b5b44];return _0x32cb66;};'use strict';var util=require(_0x9d5f('0x0'));var _=require(_0x9d5f('0x1'));var moment=require(_0x9d5f('0x2'));function checkNameSurname(_0xc76d42,_0x4ed934,_0x3f3bb1){var _0x3e73bf='';if(!_[_0x9d5f('0x3')](_0x4ed934)&&_0x9d5f('0x4')===typeof _0x4ed934){_0x3e73bf+=_0x4ed934;}if(!_[_0x9d5f('0x3')](_0x3f3bb1)&&_0x9d5f('0x4')===typeof _0x3f3bb1){_0x3e73bf+='\x20'+_0x3f3bb1;}if(_0x3e73bf!==''){return _0x3e73bf;}return _0xc76d42;}function Action(_0x530d09,_0x546c04,_0x58edae,_0x1dca4b,_0x2e1c4e){this['uniqueid']=_0x58edae||undefined;this[_0x9d5f('0x5')]=_0x530d09['id'];this[_0x9d5f('0x6')]=_0x546c04['name'];this[_0x9d5f('0x7')]=_0x546c04[_0x9d5f('0x7')];this['campaigntype']=_0x9d5f('0x6');this['dialAnswer']=![];this[_0x9d5f('0x8')]=_[_0x9d5f('0x3')](_0x530d09[_0x9d5f('0x9')])?undefined:_0x530d09[_0x9d5f('0x9')][_0x9d5f('0xa')];this['channelAgent']=this[_0x9d5f('0x8')]?util[_0x9d5f('0xb')](_0x9d5f('0xc'),this[_0x9d5f('0x8')]):_0x1dca4b||undefined;this[_0x9d5f('0xd')]=checkNameSurname(_0x530d09[_0x9d5f('0xe')][_0x9d5f('0xf')],_0x530d09[_0x9d5f('0xe')][_0x9d5f('0x10')],_0x530d09['Contact']['lastName']);this['active']=_0x530d09['active']||![];this[_0x9d5f('0x11')]=_0x530d09[_0x9d5f('0xe')]['phone'];this[_0x9d5f('0x12')]=_0x530d09[_0x9d5f('0x12')];this[_0x9d5f('0x13')]=_0x530d09[_0x9d5f('0x13')]||0x0;this[_0x9d5f('0x14')]=_0x530d09['countcongestionretry']||0x0;this[_0x9d5f('0x15')]=_0x530d09[_0x9d5f('0x15')]||0x0;this[_0x9d5f('0x16')]=(_0x530d09[_0x9d5f('0x13')]||0x0)+(_0x530d09[_0x9d5f('0x14')]||0x0)+(_0x530d09[_0x9d5f('0x15')]||0x0)+(_0x530d09[_0x9d5f('0x17')]||0x0)+(_0x530d09['countdropretry']||0x0)+(_0x530d09[_0x9d5f('0x18')]||0x0)+(_0x530d09[_0x9d5f('0x19')]||0x0)+(_0x530d09[_0x9d5f('0x1a')]||0x0);this['countnosuchnumberretry']=_0x530d09['countnosuchnumberretry']||0x0;this[_0x9d5f('0x1b')]=_0x530d09[_0x9d5f('0x1b')]||0x0;this[_0x9d5f('0x18')]=_0x530d09[_0x9d5f('0x18')]||0x0;this['countmachineretry']=_0x530d09[_0x9d5f('0x19')]||0x0;this['countagentrejectretry']=_0x530d09[_0x9d5f('0x1a')]||0x0;this['callback']=_0x530d09[_0x9d5f('0x1c')];this[_0x9d5f('0x1d')]=_0x530d09[_0x9d5f('0x1d')];this[_0x9d5f('0x1e')]=_0x530d09[_0x9d5f('0x1e')];this['recallme']=_0x530d09[_0x9d5f('0x1f')];this[_0x9d5f('0x20')]=_0x530d09['ContactId'];this[_0x9d5f('0x21')]=_0x530d09[_0x9d5f('0x21')];this[_0x9d5f('0x22')]=_[_0x9d5f('0x3')](_0x530d09[_0x9d5f('0x9')])?_0x530d09['UserId']:_0x530d09[_0x9d5f('0x9')]['id'];this[_0x9d5f('0x23')]=_0x530d09[_0x9d5f('0x23')];this['originatecalleridnum']='';this[_0x9d5f('0x24')]='';}Action['prototype'][_0x9d5f('0x25')]=function(){return util[_0x9d5f('0xb')]('\x22%s\x22\x20<%s>',this[_0x9d5f('0xd')],this[_0x9d5f('0x26')]);};module[_0x9d5f('0x27')]=Action; \ No newline at end of file +var _0xfebd=['calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active'];(function(_0x862df1,_0x217bb0){var _0x1dd5c2=function(_0x2ccbdd){while(--_0x2ccbdd){_0x862df1['push'](_0x862df1['shift']());}};_0x1dd5c2(++_0x217bb0);}(_0xfebd,0xa3));var _0xdfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebd[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xdfeb('0x0'));var _=require(_0xdfeb('0x1'));var moment=require(_0xdfeb('0x2'));function checkNameSurname(_0x4233b7,_0xcf47ea,_0x504113){var _0x4343bf='';if(!_[_0xdfeb('0x3')](_0xcf47ea)&&_0xdfeb('0x4')===typeof _0xcf47ea){_0x4343bf+=_0xcf47ea;}if(!_[_0xdfeb('0x3')](_0x504113)&&_0xdfeb('0x4')===typeof _0x504113){_0x4343bf+='\x20'+_0x504113;}if(_0x4343bf!==''){return _0x4343bf;}return _0x4233b7;}function Action(_0x83c7f,_0x459cf8,_0x492c12,_0x2c2751,_0x37ebdf){this['uniqueid']=_0x492c12||undefined;this[_0xdfeb('0x5')]=_0x83c7f['id'];this[_0xdfeb('0x6')]=_0x459cf8[_0xdfeb('0x7')];this[_0xdfeb('0x8')]=_0x459cf8[_0xdfeb('0x8')];this[_0xdfeb('0x9')]=_0xdfeb('0x6');this[_0xdfeb('0xa')]=![];this[_0xdfeb('0xb')]=_[_0xdfeb('0x3')](_0x83c7f[_0xdfeb('0xc')])?undefined:_0x83c7f[_0xdfeb('0xc')]['name'];this[_0xdfeb('0xd')]=this['membername']?util[_0xdfeb('0xe')](_0xdfeb('0xf'),this['membername']):_0x2c2751||undefined;this[_0xdfeb('0x10')]=checkNameSurname(_0x83c7f[_0xdfeb('0x11')][_0xdfeb('0x12')],_0x83c7f[_0xdfeb('0x11')][_0xdfeb('0x13')],_0x83c7f[_0xdfeb('0x11')]['lastName']);this[_0xdfeb('0x14')]=_0x83c7f[_0xdfeb('0x14')]||![];this[_0xdfeb('0x15')]=_0x83c7f[_0xdfeb('0x11')][_0xdfeb('0x12')];this[_0xdfeb('0x16')]=_0x83c7f['scheduledat'];this['countbusyretry']=_0x83c7f[_0xdfeb('0x17')]||0x0;this['countcongestionretry']=_0x83c7f['countcongestionretry']||0x0;this['countnoanswerretry']=_0x83c7f[_0xdfeb('0x18')]||0x0;this[_0xdfeb('0x19')]=(_0x83c7f['countbusyretry']||0x0)+(_0x83c7f[_0xdfeb('0x1a')]||0x0)+(_0x83c7f['countnoanswerretry']||0x0)+(_0x83c7f[_0xdfeb('0x1b')]||0x0)+(_0x83c7f[_0xdfeb('0x1c')]||0x0)+(_0x83c7f['countabandonedretry']||0x0)+(_0x83c7f[_0xdfeb('0x1d')]||0x0)+(_0x83c7f[_0xdfeb('0x1e')]||0x0);this[_0xdfeb('0x1b')]=_0x83c7f[_0xdfeb('0x1b')]||0x0;this['countdropretry']=_0x83c7f[_0xdfeb('0x1c')]||0x0;this['countabandonedretry']=_0x83c7f[_0xdfeb('0x1f')]||0x0;this[_0xdfeb('0x1d')]=_0x83c7f[_0xdfeb('0x1d')]||0x0;this[_0xdfeb('0x1e')]=_0x83c7f['countagentrejectretry']||0x0;this['callback']=_0x83c7f[_0xdfeb('0x20')];this[_0xdfeb('0x21')]=_0x83c7f[_0xdfeb('0x21')];this['callbackat']=_0x83c7f[_0xdfeb('0x22')];this['recallme']=_0x83c7f['recallme'];this['ContactId']=_0x83c7f[_0xdfeb('0x23')];this[_0xdfeb('0x24')]=_0x83c7f[_0xdfeb('0x24')];this[_0xdfeb('0x25')]=_[_0xdfeb('0x3')](_0x83c7f['Agent'])?_0x83c7f[_0xdfeb('0x25')]:_0x83c7f[_0xdfeb('0xc')]['id'];this[_0xdfeb('0x26')]=_0x83c7f[_0xdfeb('0x26')];this[_0xdfeb('0x27')]='';this[_0xdfeb('0x28')]='';}Action[_0xdfeb('0x29')][_0xdfeb('0x2a')]=function(){return util[_0xdfeb('0xe')](_0xdfeb('0x2b'),this[_0xdfeb('0x10')],this[_0xdfeb('0x2c')]);};module[_0xdfeb('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 7a5b190..5822eb7 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 _0x019d=['available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalAvailable','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','campaignsPreview','preview','booked','hasOwnProperty','setMessage','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','Agent','run','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','dialActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','createCustomerFinal','countnosuchnumberretry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','answertime','pTalking','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','rescheduleContact','dialBusyRetryFrequency','unlockAgent','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','addVariables','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','idContact','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','util','lodash','uuid','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','loopCampaigns','emit','type','outbound','name','strategy','answered'];(function(_0x32d861,_0xef1bac){var _0x181651=function(_0x2a4fab){while(--_0x2a4fab){_0x32d861['push'](_0x32d861['shift']());}};_0x181651(++_0xef1bac);}(_0x019d,0x129));var _0xd019=function(_0x32ab6e,_0x3b77ed){_0x32ab6e=_0x32ab6e-0x0;var _0x366c54=_0x019d[_0x32ab6e];return _0x366c54;};'use strict';var util=require(_0xd019('0x0'));var _=require(_0xd019('0x1'));var BPromise=require('bluebird');var uuid=require(_0xd019('0x2'));var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0xd019('0x3'));var logger=require(_0xd019('0x4'))('preview');var loggerAction=require(_0xd019('0x4'))(_0xd019('0x5'));var ami=require('../ami');var rpcDb=require(_0xd019('0x6'));var Action=require('./action');var ut=require(_0xd019('0x7'));config['redis']=_[_0xd019('0x8')](config[_0xd019('0x9')],{'host':_0xd019('0xa'),'port':0x18eb});var io=require(_0xd019('0xb'))(new Redis(config[_0xd019('0x9')]));var Sequence=function(){};Sequence[_0xd019('0xc')][_0xd019('0xd')]=function(_0x1191b1){this[_0xd019('0xe')]=this[_0xd019('0xe')]?this[_0xd019('0xe')][_0xd019('0xf')](_0x1191b1):_0x1191b1();};function Preview(_0x3b04a5){this[_0xd019('0x10')]=new Sequence();this['campaignsPreview']=_0x3b04a5[_0xd019('0x11')];this[_0xd019('0x12')]=_0x3b04a5[_0xd019('0x12')];this[_0xd019('0x13')]={};this['agents']=_0x3b04a5[_0xd019('0x14')];this[_0xd019('0x15')]=0x0;ami['on']('originateresponse',this[_0xd019('0x16')]['bind'](this));ami['on'](_0xd019('0x17'),this[_0xd019('0x18')][_0xd019('0x19')](this));ami['on'](_0xd019('0x1a'),this[_0xd019('0x1b')][_0xd019('0x19')](this));ami['on'](_0xd019('0x1c'),this[_0xd019('0x1d')]['bind'](this));ami['on'](_0xd019('0x1e'),this[_0xd019('0x1f')]['bind'](this));ami['on'](_0xd019('0x20'),this[_0xd019('0x21')]['bind'](this));ami['on'](_0xd019('0x22'),this['syncAttendedTransfer'][_0xd019('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0xd019('0x23')](this['campaignsPreview']);}function emit(_0x4bf138,_0x34ad7a,_0x444e09){io['to'](_0x4bf138)[_0xd019('0x24')](_0x34ad7a,_0x444e09);}function emitCampaignPreview(_0x225035){if(_0x225035[_0xd019('0x25')]===_0xd019('0x26')){var _0xf1fed4={'id':_0x225035['id'],'name':_0x225035[_0xd019('0x27')],'strategy':_0x225035[_0xd019('0x28')],'answered':_0x225035[_0xd019('0x29')],'available':_0x225035[_0xd019('0x2a')],'loggedIn':_0x225035[_0xd019('0x2b')],'pTalking':_0x225035['pTalking'],'sumBillable':_0x225035[_0xd019('0x2c')],'sumDuration':_0x225035[_0xd019('0x2d')],'sumHoldTime':_0x225035[_0xd019('0x2e')]||0x0,'talking':_0x225035[_0xd019('0x2f')],'total':_0x225035[_0xd019('0x30')],'type':_0x225035[_0xd019('0x25')],'unmanaged':_0x225035[_0xd019('0x31')],'abandoned':_0x225035['abandoned'],'waiting':_0x225035[_0xd019('0x32')],'loggedInDb':_0x225035[_0xd019('0x33')],'dialActive':_0x225035['dialActive'],'dialMethod':_0x225035[_0xd019('0x34')],'dialOriginateCallerIdName':_0x225035[_0xd019('0x35')],'dialOriginateCallerIdNumber':_0x225035[_0xd019('0x36')],'dialOriginateTimeout':_0x225035[_0xd019('0x37')],'dialPrefix':_0x225035[_0xd019('0x38')],'outboundAnswerAgiCallsDay':_0x225035[_0xd019('0x39')],'outboundAnswerCallsDay':_0x225035['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x225035[_0xd019('0x3a')],'outboundBusyCallsDay':_0x225035['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x225035['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x225035['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x225035[_0xd019('0x3b')],'outboundDropCallsDayTimeout':_0x225035[_0xd019('0x3c')],'outboundNoAnswerCallsDay':_0x225035[_0xd019('0x3d')],'outboundNoSuchCallsDay':_0x225035[_0xd019('0x3e')],'outboundOriginateFailureCallsDay':_0x225035[_0xd019('0x3f')],'outboundReCallsDay':_0x225035[_0xd019('0x40')],'outboundRejectCallsDay':_0x225035[_0xd019('0x41')],'outboundUnknownCallsDay':_0x225035['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x225035[_0xd019('0x42')],'predictiveIntervalAnsweredCalls':_0x225035[_0xd019('0x43')],'predictiveIntervalAvgHoldtime':_0x225035[_0xd019('0x44')],'predictiveIntervalAvgTalktime':_0x225035[_0xd019('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x225035['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x225035[_0xd019('0x46')],'predictiveIntervalErlangCalls':_0x225035[_0xd019('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x225035[_0xd019('0x48')],'predictiveIntervalHitRate':_0x225035['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x225035['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x225035['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x225035[_0xd019('0x49')],'predictiveIntervalTotalCalls':_0x225035['predictiveIntervalTotalCalls'],'message':_0x225035[_0xd019('0x4a')],'originated':_0x225035[_0xd019('0x4b')],'erlangCalls':_0x225035['erlangCalls'],'erlangCallToSecond':_0x225035[_0xd019('0x4c')],'erlangAbandonmentRate':_0x225035[_0xd019('0x4d')],'erlangBusyFactor':_0x225035[_0xd019('0x4e')],'startPredictive':_0x225035[_0xd019('0x4f')],'startProgressive':_0x225035[_0xd019('0x50')]};if(_0x225035[_0xd019('0x51')]){_0xf1fed4[_0xd019('0x51')]={'id':_0x225035[_0xd019('0x51')]['id'],'name':_0x225035[_0xd019('0x51')][_0xd019('0x27')],'active':_0x225035[_0xd019('0x51')][_0xd019('0x52')],'callerid':_0x225035[_0xd019('0x51')][_0xd019('0x53')]};}if(_0x225035[_0xd019('0x54')]){_0xf1fed4[_0xd019('0x54')]={'id':_0x225035[_0xd019('0x54')]['id'],'name':_0x225035[_0xd019('0x54')][_0xd019('0x27')]};}var _0x147b69=md5(JSON[_0xd019('0x55')](_0xf1fed4));if(_0x225035[_0xd019('0x56')]!==_0x147b69){_0x225035[_0xd019('0x56')]=_0x147b69;emit(util[_0xd019('0x57')]('voice:queue:%s',_0xf1fed4[_0xd019('0x27')]),_0xd019('0x58'),_0xf1fed4);}}}function emitVoiceQueueChannelRemove(_0x5edc6f){logger[_0xd019('0x59')](_0xd019('0x5a'),JSON[_0xd019('0x55')](_0x5edc6f));emit(util[_0xd019('0x57')](_0xd019('0x5b'),_0x5edc6f[_0xd019('0x27')]),_0xd019('0x5c'),_0x5edc6f);}function notSendMessagesQueue(_0x28c143){if(_0x28c143[_0xd019('0x5d')]){if(_0x28c143[_0xd019('0x4b')]===0x0&&_0x28c143['pTalking']===0x0){_0x28c143[_0xd019('0x5d')]=![];_0x28c143[_0xd019('0x2a')]=0x0;_0x28c143[_0xd019('0x5e')]=0x0;_0x28c143[_0xd019('0x4a')]=_0xd019('0x5f');ut['logger'](_0xd019('0x60'),_0x28c143[_0xd019('0x27')]+_0xd019('0x61'));}else{_0x28c143[_0xd019('0x4a')]=_0xd019('0x62');ut[_0xd019('0x63')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x28c143[_0xd019('0x27')]+_0xd019('0x64'));}emitCampaignPreview(_0x28c143);}}Preview['prototype'][_0xd019('0x23')]=function(){var _0x39811f=this;setInterval(function(){_0x39811f[_0xd019('0x65')]();},0x7cf);};Preview[_0xd019('0xc')][_0xd019('0x65')]=function(){var _0xc5876=this[_0xd019('0x66')];this[_0xd019('0x15')]+=0x1;for(var _0x36d98a in _0xc5876){if(_0xc5876['hasOwnProperty'](_0x36d98a)&&(_0xc5876[_0x36d98a]['dialMethod']===_0xd019('0x67')||_0xc5876[_0x36d98a][_0xd019('0x34')]===_0xd019('0x68'))&&_0xc5876[_0x36d98a][_0xd019('0x25')]===_0xd019('0x26')){if(this[_0xd019('0x15')]>0x7){this[_0xd019('0x15')]=0x0;this['clearZombieChannels']();}}if(_0xc5876[_0xd019('0x69')](_0x36d98a)&&_0xc5876[_0x36d98a][_0xd019('0x34')]===_0xd019('0x67')&&_0xc5876[_0x36d98a][_0xd019('0x25')]===_0xd019('0x26')){if(_0xc5876[_0x36d98a]['dialActive']){this[_0xd019('0x6a')](_0xc5876[_0x36d98a]);this['recallMe'](_0xc5876[_0x36d98a]);}else{notSendMessagesQueue(_0xc5876[_0x36d98a]);}}}};Preview[_0xd019('0xc')][_0xd019('0x6b')]=function(_0x36f51d){var _0x7ca41d=this;this[_0xd019('0x10')][_0xd019('0xd')](function(){if(!_['isNil'](_0x7ca41d[_0xd019('0x13')][_0x36f51d])){loggerAction[_0xd019('0x59')](_0xd019('0x6c'),_0x36f51d,_0xd019('0x6d'),_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x6e')],_0xd019('0x6f'),JSON[_0xd019('0x55')](_0x7ca41d[_0xd019('0x66')][_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x6e')]]['originated']),_0xd019('0x70'),JSON[_0xd019('0x55')](_0x7ca41d[_0xd019('0x66')][_0x7ca41d['actions'][_0x36f51d][_0xd019('0x6e')]]['pTalking']),JSON['stringify'](_0x7ca41d['actions'][_0x36f51d][_0xd019('0x71')]),JSON[_0xd019('0x55')](_[_0xd019('0x72')](_0x7ca41d['actions'][_0x36f51d],['contactId','UserId',_0xd019('0x73'),_0xd019('0x74')])));return ami[_0xd019('0x75')]({'action':_0xd019('0x76'),'channel':_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x77')]})[_0xd019('0x78')](function(_0x1438e3){if(_0x1438e3[_0xd019('0x4a')]===_0xd019('0x79')){setTimeout(function(){if(_0x7ca41d[_0xd019('0x13')][_0x36f51d]){ut['updateOriginated'](_0x7ca41d[_0xd019('0x66')][_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x6e')]],'[clearZombieChannel]');if(_0x7ca41d['actions'][_0x36f51d][_0xd019('0x71')]===!![]){ut[_0xd019('0x7a')](_0x7ca41d[_0xd019('0x66')][_0x7ca41d[_0xd019('0x13')][_0x36f51d]['queue']],_0xd019('0x7b'));ut[_0xd019('0x7c')](_0xd019('0x7d')+_0x36f51d,_0x7ca41d[_0xd019('0x13')][_0x36f51d]['queue']);}ut[_0xd019('0x7c')]('[Dialer][checkChannel][Preview]'+_0x36f51d,_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x6e')]);delete _0x7ca41d[_0xd019('0x13')][_0x36f51d];}},0x2328);}});}});};Preview[_0xd019('0xc')]['clearZombieChannels']=function(){var _0x241edd=this;loggerAction[_0xd019('0x59')](_0xd019('0x7e'),_[_0xd019('0x7f')](this['actions']));for(var _0x39af21 in this[_0xd019('0x13')]){if(_0x241edd[_0xd019('0x13')][_0xd019('0x69')](_0x39af21)){_0x241edd[_0xd019('0x6b')](_0x39af21);}}};Preview[_0xd019('0xc')][_0xd019('0x80')]=function(_0x5eef24){var _0x2944bf=this;rpcDb[_0xd019('0x81')](_0x5eef24['id'],ut[_0xd019('0x82')](this[_0xd019('0x14')]))[_0xd019('0x83')](function(_0x1ed144){if(!_['isNil'](_0x1ed144)){for(var _0x5b0def=0x0;_0x5b0def<_0x1ed144[_0xd019('0x84')];_0x5b0def+=0x1){if(ut[_0xd019('0x85')](_0x1ed144[_0x5b0def]['scheduledat'])<_0x5eef24['dialRecallMeTimeout']*0x3c){if(_0x1ed144[_0x5b0def][_0xd019('0x86')]&&!_0x1ed144[_0x5b0def][_0xd019('0x86')]['voicePause']){_0x2944bf[_0xd019('0x87')](_0x1ed144[_0x5b0def]['id'])[_0xd019('0x83')](ut['logger2']('[RecallMe]'))[_0xd019('0x78')](ut['logger2'](_0xd019('0x88')));}else{rpcDb[_0xd019('0x89')](_0x1ed144[_0x5b0def]['id']);}}else{var _0x48c726=new Action(_0x1ed144[_0x5b0def],_0x5eef24);_0x48c726[_0xd019('0x8a')]=moment()['format'](_0xd019('0x8b'));_0x5eef24[_0xd019('0x40')]+=0x1;ut[_0xd019('0x8c')](_0x48c726,0x17,_0xd019('0x8d'));if(_0x5eef24[_0xd019('0x8e')]){rpcDb[_0xd019('0x8f')](ut[_0xd019('0x90')](_0x1ed144[_0x5b0def]));rpcDb[_0xd019('0x91')](_0x48c726,_0xd019('0x92'));}else{ut[_0xd019('0x8c')](_0x48c726,0x16,_0xd019('0x93'));rpcDb['createCustomerHistory'](_0x48c726,_0xd019('0x94'));rpcDb['createCustomerFinal'](_0x48c726,_0xd019('0x94'));}}}}})[_0xd019('0x78')](ut['logger2'](_0xd019('0x95')));};Preview['prototype'][_0xd019('0x6a')]=function(_0x1cd2e7){_0x1cd2e7[_0xd019('0x5d')]=!![];if(ut[_0xd019('0x96')](_0x1cd2e7[_0xd019('0x2b')])){_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x97');}else if(!ut[_0xd019('0x98')](_0x1cd2e7[_0xd019('0x99')])){_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x5f');}else if(!this[_0xd019('0x9a')](_0x1cd2e7[_0xd019('0x51')])){if(!this[_0xd019('0x9a')](_0x1cd2e7[_0xd019('0x9b')])){_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x9c');}else{_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x9d');}}else{_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x9d');}emitCampaignPreview(_0x1cd2e7);};Preview[_0xd019('0xc')][_0xd019('0x9e')]=function(_0x5a1574,_0x9800fb,_0x12575e){var _0x37f291=this;var _0x12aa05=this[_0xd019('0x13')][_0x9800fb];var _0x2ffaea=this[_0xd019('0x66')][_0x12aa05[_0xd019('0x6e')]];var _0x5b196d;if(_0x2ffaea){switch(_0x12575e){case'1':_0x2ffaea['outboundNoSuchCallsDay']+=0x1;_0x12aa05['countnosuchnumberretry']+=0x1;_0x12aa05[_0xd019('0x9f')]=ut[_0xd019('0xa0')](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x0,_0xd019('0xa1'));ami[_0xd019('0x24')](_0xd019('0xa2'),ut[_0xd019('0xa3')](_0x12aa05,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x12aa05,_0xd019('0xa4'));if(ut['totalGlobal'](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut[_0xd019('0xa6')](_0x12aa05,0xf,'Global');rpcDb[_0xd019('0xa7')](_0x5b196d,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x12aa05[_0xd019('0xa8')]>=_0x2ffaea['dialNoSuchNumberMaxRetry']){rpcDb[_0xd019('0xa7')](_0x12aa05,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0xd019('0xa9')](_0x12aa05,_0xd019('0xa8'),_0x2ffaea[_0xd019('0xaa')]),_0x12aa05['unlockAgent'],_0x12aa05[_0xd019('0xab')]);}}delete this['actions'][_0x5a1574[_0xd019('0xac')]];break;case _0xd019('0xad'):var _0x502678=moment()['format'](_0xd019('0x8b'));_0x12aa05[_0xd019('0xae')]=_0x502678;_0x12aa05[_0xd019('0xaf')]=_0x502678;_0x12aa05[_0xd019('0x71')]=!![];_0x2ffaea[_0xd019('0xb0')]+=0x1;logger[_0xd019('0x59')](_0xd019('0xb1'),_0x12aa05[_0xd019('0xb2')],_0xd019('0xb3'),_0x2ffaea[_0xd019('0x27')],'pTalking:\x20',_0x2ffaea['pTalking']);ami[_0xd019('0x24')](_0xd019('0xb4'),ut['buildObj'](_0x12aa05,_0xd019('0xb5')));if(_0x2ffaea[_0xd019('0xb6')]){ami[_0xd019('0x24')](_0xd019('0xb7'),ut[_0xd019('0xb8')](_0x12aa05));}break;case'16':ami[_0xd019('0x24')](_0xd019('0xb9'),ut[_0xd019('0xa3')](_0x12aa05,'complete'));emitVoiceQueueChannelRemove(ut[_0xd019('0xa3')](_0x12aa05,'complete'));_0x2ffaea[_0xd019('0xba')]+=0x1;_0x2ffaea[_0xd019('0x30')]+=0x1;_0x2ffaea[_0xd019('0x29')]+=0x1;ut[_0xd019('0x7a')](_0x2ffaea,_0xd019('0xbb'));_0x12aa05[_0xd019('0x9f')]=ut[_0xd019('0xa0')](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x4,_0xd019('0xbc'));rpcDb['createCustomerHistory'](_0x12aa05,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xbd'));rpcDb[_0xd019('0xbe')](_0x12aa05);_0x2ffaea[_0xd019('0x2d')]+=_0x12aa05[_0xd019('0xbf')];_0x2ffaea[_0xd019('0x2c')]+=_0x12aa05[_0xd019('0xbf')];logger[_0xd019('0x59')](_0xd019('0xc0'),_0x12aa05[_0xd019('0xb2')],_0xd019('0xb3'),_0x2ffaea[_0xd019('0x27')],_0xd019('0x70'),_0x2ffaea[_0xd019('0xb0')]);delete this[_0xd019('0x13')][_0x5a1574[_0xd019('0xac')]];break;case'BUSY':_0x2ffaea['outboundBusyCallsDay']+=0x1;_0x12aa05[_0xd019('0xc1')]+=0x1;_0x12aa05[_0xd019('0x9f')]=ut[_0xd019('0xa0')](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x5,_0xd019('0xc2'));ami[_0xd019('0x24')](_0xd019('0xc3'),ut[_0xd019('0xa3')](_0x12aa05,_0xd019('0xc4')));rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xc5'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea['dialGlobalMaxRetry']){_0x5b196d=ut['cloneAction'](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb['createCustomerFinal'](_0x5b196d,_0xd019('0xc7'));}else{if(_0x12aa05[_0xd019('0xc1')]>=_0x2ffaea['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x12aa05,_0xd019('0xc5'));}else{rpcDb[_0xd019('0xc8')](ut[_0xd019('0xa9')](_0x12aa05,'countbusyretry',_0x2ffaea[_0xd019('0xc9')]),_0x12aa05[_0xd019('0xca')],_0x12aa05['activeContact']);}}break;case'NOANSWER':_0x2ffaea[_0xd019('0x3d')]+=0x1;_0x12aa05[_0xd019('0xcb')]+=0x1;_0x12aa05['countglobal']=ut['totalGlobal'](_0x12aa05);ut['logCustomer'](_0x12aa05,0x3,_0xd019('0xcc'));ami['emit'](_0xd019('0xcd'),ut[_0xd019('0xa3')](_0x12aa05,_0xd019('0xce')));rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xcf'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut['cloneAction'](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb[_0xd019('0xa7')](_0x5b196d,_0xd019('0xd0'));}else{if(_0x12aa05[_0xd019('0xcb')]>=_0x2ffaea[_0xd019('0xd1')]){rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xcf'));}else{rpcDb[_0xd019('0xc8')](ut['scheduledAt'](_0x12aa05,_0xd019('0xcb'),_0x2ffaea[_0xd019('0xd2')]),_0x12aa05[_0xd019('0xca')],_0x12aa05[_0xd019('0xab')]);}}break;case _0xd019('0xd3'):_0x2ffaea[_0xd019('0xd4')]+=0x1;_0x12aa05['countcongestionretry']+=0x1;_0x12aa05[_0xd019('0x9f')]=ut['totalGlobal'](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x8,_0xd019('0xd5'));ami['emit'](_0xd019('0xd6'),ut[_0xd019('0xa3')](_0x12aa05,_0xd019('0xd7')));rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xd8'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea['dialGlobalMaxRetry']){_0x5b196d=ut[_0xd019('0xa6')](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb[_0xd019('0xa7')](_0x5b196d,_0xd019('0xd9'));}else{if(_0x12aa05['countcongestionretry']>=_0x2ffaea[_0xd019('0xda')]){rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xd8'));}else{rpcDb[_0xd019('0xc8')](ut[_0xd019('0xa9')](_0x12aa05,_0xd019('0xdb'),_0x2ffaea[_0xd019('0xc9')]),_0x12aa05[_0xd019('0xca')],_0x12aa05[_0xd019('0xab')]);}}break;case _0xd019('0xdc'):_0x2ffaea[_0xd019('0x41')]+=0x1;_0x12aa05[_0xd019('0xdd')]+=0x1;_0x12aa05[_0xd019('0x9f')]=ut[_0xd019('0xa0')](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x14,'AgentReject');ami['emit'](_0xd019('0xde'),ut['buildObj'](_0x12aa05,_0xd019('0xdf')));rpcDb['createCustomerHistory'](_0x12aa05,_0xd019('0xe0'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut[_0xd019('0xa6')](_0x12aa05,0x14,_0xd019('0xe1'));rpcDb[_0xd019('0xa7')](_0x5b196d,_0xd019('0xe2'));}else{if(_0x12aa05[_0xd019('0xdd')]>=_0x2ffaea[_0xd019('0xe3')]){rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xe2'));}else{rpcDb['rescheduleContact'](ut[_0xd019('0xa9')](_0x12aa05,_0xd019('0xdd'),_0x2ffaea[_0xd019('0xe4')]),_0x12aa05[_0xd019('0xca')],_0x12aa05[_0xd019('0xab')]);}}break;case _0xd019('0xe5'):_0x2ffaea[_0xd019('0x42')]+=0x1;_0x12aa05['countabandonedretry']+=0x1;_0x12aa05['countglobal']=ut['totalGlobal'](_0x12aa05);ut['logCustomer'](_0x12aa05,0xb,_0xd019('0xe6'));rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xe7'));if(ut['totalGlobal'](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut['cloneAction'](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb[_0xd019('0xa7')](_0x5b196d,_0xd019('0xe7'));}else{if(_0x12aa05[_0xd019('0xe8')]>=_0x2ffaea[_0xd019('0xe9')]){rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xe7'));}else{rpcDb[_0xd019('0xc8')](ut[_0xd019('0xa9')](_0x12aa05,'countabandonedretry',_0x2ffaea[_0xd019('0xea')]),_0x12aa05[_0xd019('0xca')],_0x12aa05[_0xd019('0xab')]);}}break;default:if(_0x12aa05[_0xd019('0x71')]){ut[_0xd019('0x7a')](_0x2ffaea,_0xd019('0xeb'));ut[_0xd019('0x7c')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2ffaea['name'],_0x5a1574);}_0x2ffaea[_0xd019('0xec')]+=0x1;_0x12aa05[_0xd019('0x9f')]=ut['totalGlobal'](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0xc,_0x5a1574[_0xd019('0xed')]||_0x5a1574[_0xd019('0xee')]);rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xef'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut['cloneAction'](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb[_0xd019('0xa7')](_0x5b196d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xf0'));}delete this[_0xd019('0x13')][_0x5a1574[_0xd019('0xac')]];}if(!(_0x12aa05[_0xd019('0x71')]&&_0x12575e==='16')){ut['updateOriginated'](_0x2ffaea,'[callProgressDetectingCustomer]');logger['info'](_0xd019('0xf1'),_0x12aa05[_0xd019('0xb2')],_0xd019('0xb3'),_0x2ffaea[_0xd019('0x27')],'originated:\x20',_0x2ffaea[_0xd019('0x4b')]);}if(_0x12575e!==_0xd019('0xad')){delete this[_0xd019('0x13')][_0x5a1574['linkedid']];delete this[_0xd019('0x13')][_0x5a1574[_0xd019('0xf2')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x20c6ff,_0x47183b,_0x411a12){if(_['isUndefined'](_0x47183b)&&'object'!==typeof _0x47183b){return;}if(_[_0xd019('0xf3')](_0x411a12)&&_0xd019('0xf4')!==typeof _0x411a12){return;}switch(_0x411a12[_0xd019('0xf5')]){case'0':ut[_0xd019('0xf6')](_0x20c6ff,0x0,'NoSuchNumber');rpcDb[_0xd019('0xf7')](_0x20c6ff,_0xd019('0xf8'));break;case'3':ut['logAgent'](_0x20c6ff,0x3,_0xd019('0xcc'));rpcDb[_0xd019('0xf7')](_0x20c6ff,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x20c6ff,0x5,_0xd019('0xc2'));rpcDb[_0xd019('0xf7')](_0x20c6ff,_0xd019('0xf9'));break;case'8':ut['logAgent'](_0x20c6ff,0x8,_0xd019('0xd5'));rpcDb[_0xd019('0xf7')](_0x20c6ff,_0xd019('0xfa'));break;case'22':ut[_0xd019('0xf6')](_0x20c6ff,0x16,_0xd019('0xfb'));rpcDb['createAgentHistory'](_0x20c6ff,_0xd019('0xfc'));break;default:ut['logAgent'](_0x20c6ff,0xc,_0x411a12[_0xd019('0xf5')]);rpcDb['createAgentHistory'](_0x20c6ff,_0xd019('0xfa'));}ut[_0xd019('0xfd')](_0x47183b,_0xd019('0xfe'));logger[_0xd019('0x59')](_0xd019('0xff'),_0x20c6ff['uniqueid'],_0xd019('0xb3'),_0x47183b['name'],_0xd019('0x6f'),_0x47183b[_0xd019('0x4b')]);delete this[_0xd019('0x13')][_0x20c6ff[_0xd019('0xb2')]];};Preview[_0xd019('0xc')][_0xd019('0x100')]=function(_0x9b62cf,_0x3f8726,_0x517329,_0xad1ee,_0x42caa3){var _0x3543f9=this;return new BPromise(function(_0x545b6c,_0xb4a72a){if(_[_0xd019('0x101')](_0x3f8726)||_['isNil'](_0x3f8726[_0xd019('0x102')])||_[_0xd019('0x101')](_0x3f8726[_0xd019('0x102')]['phone'])||_[_0xd019('0x101')](_0x3f8726[_0xd019('0x73')])){_0xb4a72a(ut['message'](_0xd019('0x103'),_0xad1ee,_0x42caa3));return;}var _0x33bcb5=uuid['v4']();var _0x14cabb=_0x3543f9[_0xd019('0x66')][_0x3f8726[_0xd019('0x6d')][_0xd019('0x27')]];var _0x599f4b=_0x517329?_0x3543f9['agents'][_0x517329]['id']:undefined;_0x3543f9[_0xd019('0x13')][_0x33bcb5]=new Action(_0x3f8726,_0x14cabb,_0x33bcb5,_0x517329,_0x599f4b);var _0x39c972=_0x3543f9[_0xd019('0x13')][_0x33bcb5];_0x39c972[_0xd019('0xca')]=_0xad1ee;_0x39c972[_0xd019('0xab')]=_0x42caa3;_0x39c972[_0xd019('0x104')]=_0x517329;if(_[_0xd019('0x105')](_0x9b62cf)){_0x3543f9['execCall'](_0x39c972,_0x14cabb,_0x3f8726,_0x517329)[_0xd019('0x83')](function(_0x972636){logger[_0xd019('0x59')](_0xd019('0x106'),_0xd019('0x107')+_0x39c972[_0xd019('0x6e')]+_0xd019('0x108')+_0x39c972['idContact'],JSON[_0xd019('0x55')](_0x972636));ami['emit'](_0xd019('0x109'),ut[_0xd019('0xa3')](_0x39c972,'called'));_0x545b6c(ut[_0xd019('0x4a')]('Calling'));})[_0xd019('0x78')](function(_0xd8e057){ut[_0xd019('0x63')](_0xd019('0x10a'),_0xd8e057);_0xb4a72a(ut['message']('Call\x20failed',_0xad1ee,_0x42caa3));});}else{_0x14cabb[_0xd019('0x3a')]+=0x1;ut['logBlacklist'](_0x39c972);rpcDb[_0xd019('0x10b')](_0x39c972,_0xd019('0x10c'));delete _0x3543f9[_0xd019('0x13')][_0x33bcb5];_0xb4a72a(ut[_0xd019('0x4a')](_0xd019('0x10d'),_0xad1ee,_0x42caa3));}});};Preview[_0xd019('0xc')][_0xd019('0x9a')]=function(_0x3496a7){return!_[_0xd019('0x101')](_0x3496a7)&&!_[_0xd019('0x101')](_0x3496a7[_0xd019('0x27')])&&!_[_0xd019('0x101')](_0x3496a7[_0xd019('0x52')])&&_0x3496a7['active']&&!_[_0xd019('0x101')](this[_0xd019('0x12')][util[_0xd019('0x57')](_0xd019('0x10e'),_0x3496a7[_0xd019('0x27')])])&&!_[_0xd019('0x101')](this[_0xd019('0x12')][util[_0xd019('0x57')](_0xd019('0x10e'),_0x3496a7[_0xd019('0x27')])][_0xd019('0x76')])&&(this[_0xd019('0x12')][util[_0xd019('0x57')](_0xd019('0x10e'),_0x3496a7[_0xd019('0x27')])]['status']===_0xd019('0x10f')||this[_0xd019('0x12')][util['format'](_0xd019('0x10e'),_0x3496a7[_0xd019('0x27')])][_0xd019('0x76')]===_0xd019('0x110'));};Preview[_0xd019('0xc')][_0xd019('0x87')]=function(_0x4e7d0b,_0x5258ef){var _0x5c29e9=this;return new BPromise(function(_0x33eae1,_0x329852){_0x5c29e9[_0xd019('0x111')](_0x4e7d0b,_0x5258ef)[_0xd019('0x83')](function(_0x29c37a){_0x33eae1(_[_0xd019('0x72')](_0x29c37a,[_0xd019('0x4a')]));})[_0xd019('0x78')](function(_0x46889e){if(_0x46889e[_0xd019('0x112')]){rpcDb[_0xd019('0x113')](_0x4e7d0b);}if(_0x46889e[_0xd019('0x52')]){rpcDb[_0xd019('0x89')](_0x4e7d0b);}_0x329852(_['pick'](_0x46889e,[_0xd019('0x4a')]));});});};Preview[_0xd019('0xc')][_0xd019('0x111')]=function(_0x4c3cdf,_0x19b12f){var _0x45a35d=this;return new BPromise(function(_0x14ad1b,_0x1b7065){var _0x339289,_0x599e08;rpcDb[_0xd019('0x114')](_0x4c3cdf)[_0xd019('0x83')](function(_0x4ba511){if(!_[_0xd019('0x101')](_0x4ba511[0x0])){_0x599e08=_0x4ba511[0x0][_0xd019('0x115')]?![]:!![];_0x339289=_0x4ba511[0x0][_0xd019('0x115')]?!![]:![];_0x339289=_0x19b12f?!![]:_0x339289;}var _0x408fbc=_0x45a35d[_0xd019('0x116')](_0x4ba511);if(_0x408fbc[_0xd019('0x117')]){rpcDb[_0xd019('0x118')](_[_0xd019('0x72')](_0x4ba511[0x0],[_0xd019('0x73'),_0xd019('0x119')]))[_0xd019('0x83')](function(_0xe882cf){_0x45a35d[_0xd019('0x100')](_0xe882cf,_0x4ba511[0x0],_0x19b12f,_0x599e08,_0x339289)[_0xd019('0x83')](function(_0x1ed707){_0x14ad1b(_0x1ed707);})[_0xd019('0x78')](function(_0x5a7e81){_0x1b7065(_0x5a7e81);});})['catch'](function(_0x48bcbd){ut[_0xd019('0x63')](_0xd019('0x11a'),_0x48bcbd);_0x1b7065(ut['message'](_0xd019('0x11b'),_0x599e08,_0x339289));});}else{_0x1b7065(ut['message'](_0x408fbc[_0xd019('0x4a')],_0x599e08,_0x339289));}})[_0xd019('0x78')](function(_0x2c6a21){ut[_0xd019('0x63')](_0xd019('0x11c'),_0x2c6a21);_0x1b7065(ut['message'](_0xd019('0x11b'),![],!![]));});});};Preview[_0xd019('0xc')][_0xd019('0x116')]=function(_0x2345f8){if(_[_0xd019('0x101')](_0x2345f8)||_[_0xd019('0x105')](_0x2345f8)||!_[_0xd019('0x101')](_0x2345f8[0x0][_0xd019('0x86')])&&_['isNil'](_0x2345f8[0x0][_0xd019('0x86')][_0xd019('0x27')])){ut[_0xd019('0x63')](_0xd019('0x11d'),_0x2345f8);return{'isValid':![],'message':_0xd019('0x11e')};}var _0x57e64b=this['campaignsPreview'][_0x2345f8[0x0][_0xd019('0x6d')]['name']];_0x57e64b[_0xd019('0x4a')]=_0xd019('0x9d');if(_[_0xd019('0x101')](_0x57e64b)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x57e64b);return{'isValid':![],'message':_0xd019('0x11f')};}if(!this[_0xd019('0x9a')](_0x57e64b['Trunk'])){ut[_0xd019('0x63')](_0xd019('0x120'),_0xd019('0x121')+_0x57e64b[_0xd019('0x27')]+_0xd019('0x122'));if(!this[_0xd019('0x9a')](_0x57e64b[_0xd019('0x9b')])){ut[_0xd019('0x63')](_0xd019('0x120'),_0x57e64b[_0xd019('0x27')]+_0xd019('0x123'));return{'isValid':![],'message':_0xd019('0x124')};}}if(!ut[_0xd019('0x98')](_0x57e64b[_0xd019('0x99')])){ut[_0xd019('0x63')](_0xd019('0x125'),_0x57e64b[_0xd019('0x27')]+_0xd019('0x126'));return{'isValid':![],'message':_0xd019('0x121')+_0x57e64b['name']+_0xd019('0x126')};}return{'isValid':!![],'message':_0xd019('0x127')};};Preview[_0xd019('0xc')][_0xd019('0x128')]=function(_0x3e173f,_0x1c7da4,_0x262397,_0x43210b){var _0x357608=this;return new BPromise(function(_0x59986a,_0x1e85b4){var _0x430e32=_0x3e173f[_0xd019('0xb2')];var _0x3ebc4e=_0x357608[_0xd019('0x9a')](_0x1c7da4['Trunk'])?util[_0xd019('0x57')](_0xd019('0x129'),_0x1c7da4[_0xd019('0x51')]['name'],_[_0xd019('0x101')](_0x1c7da4[_0xd019('0x38')])?'':_0x1c7da4[_0xd019('0x38')][_0xd019('0x12a')]()||'',_0x1c7da4['dialCutDigit']>0x0?_0x262397['Contact']['phone']['substring'](_0x1c7da4[_0xd019('0x12b')]):_0x262397['Contact'][_0xd019('0x12c')]):util[_0xd019('0x57')](_0xd019('0x129'),_[_0xd019('0x101')](_0x1c7da4[_0xd019('0x9b')])?_0x1c7da4['Trunk'][_0xd019('0x27')]:_0x1c7da4[_0xd019('0x9b')][_0xd019('0x27')],_[_0xd019('0x101')](_0x1c7da4[_0xd019('0x38')])?'':_0x1c7da4['dialPrefix']['trim']()||'',_0x1c7da4[_0xd019('0x12b')]>0x0?_0x262397[_0xd019('0x102')][_0xd019('0x12c')][_0xd019('0x12d')](_0x1c7da4[_0xd019('0x12b')]):_0x262397[_0xd019('0x102')][_0xd019('0x12c')]);var _0xf332f2=_0x357608[_0xd019('0x9a')](_0x1c7da4['Trunk'])?ut[_0xd019('0x12e')](_0x1c7da4[_0xd019('0x51')][_0xd019('0x53')],_0x1c7da4[_0xd019('0x35')],_0x1c7da4[_0xd019('0x12f')]>0x0?ut['getCallerIdRandom'](_0x1c7da4[_0xd019('0x36')],_0x1c7da4[_0xd019('0x12f')]):_0x1c7da4[_0xd019('0x36')]):ut[_0xd019('0x12e')](_['isNil'](_0x1c7da4[_0xd019('0x9b')])?_0x1c7da4[_0xd019('0x51')]['callerid']:_0x1c7da4[_0xd019('0x9b')][_0xd019('0x53')],_0x1c7da4[_0xd019('0x35')],_0x1c7da4['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xd019('0x130')](_0x1c7da4['dialOriginateCallerIdNumber'],_0x1c7da4[_0xd019('0x12f')]):_0x1c7da4['dialOriginateCallerIdNumber']);if(_0xf332f2){_0x3e173f['originatecalleridname']=ut['extractCalleridName'](_0xf332f2);_0x3e173f['originatecalleridnum']=ut['extractCalleridNumber'](_0xf332f2);}var _0x232b3c=ut[_0xd019('0x131')](_0x1c7da4,_0x262397,_0x3ebc4e,_0xf332f2,_0x430e32,_0x3e173f);_['merge'](_0x3e173f,ut[_0xd019('0x132')](_0x232b3c));_0x3e173f[_0xd019('0x8a')]=moment()[_0xd019('0x57')](_0xd019('0x8b'));ami[_0xd019('0x75')](ut[_0xd019('0x133')](_0x3e173f,_0x1c7da4,_0x232b3c,_0x3e173f[_0xd019('0xab')],_0x43210b))[_0xd019('0x83')](function(_0x4f9c10){_0x1c7da4['originated']+=0x1;logger[_0xd019('0x59')](_0xd019('0x134'),_0x430e32,_0xd019('0xb3'),_0x1c7da4[_0xd019('0x27')],_0xd019('0x6f'),_0x1c7da4[_0xd019('0x4b')]);_0x59986a(_0x4f9c10);})['catch'](function(_0x3e5d4c){ut[_0xd019('0xf6')](_0x3e173f,0xe,_0xd019('0x135'));rpcDb[_0xd019('0xf7')](_0x3e173f,_0xd019('0x136'));_0x1e85b4(_0x3e5d4c);});});};Preview[_0xd019('0xc')]['syncNewExten']=function(_0x2886bb){if(this[_0xd019('0x13')][_0x2886bb[_0xd019('0xac')]]){this['actions'][_0x2886bb[_0xd019('0xac')]]['channel']=_0x2886bb[_0xd019('0x77')];}};Preview[_0xd019('0xc')][_0xd019('0x16')]=function(_0x30cc05){var _0x167bc0=this;var _0x119562=this[_0xd019('0x13')][_0x30cc05['actionid']];if(_0x119562){if(_0x119562[_0xd019('0x104')]&&this[_0xd019('0x14')][_0x119562['lookAgent']]){ut[_0xd019('0x137')](_0x119562,this[_0xd019('0x14')][_0x119562['lookAgent']][_0xd019('0x27')],this[_0xd019('0x14')][_0x119562[_0xd019('0x104')]]['id']);}var _0x5d6bb2=_[_0xd019('0x138')](_0x119562);_0x5d6bb2[_0xd019('0xae')]=moment()[_0xd019('0x57')](_0xd019('0x8b'));var _0x2a95a2=_0x167bc0[_0xd019('0x66')][_0x119562[_0xd019('0x6e')]];if(ut[_0xd019('0x139')](_0x30cc05[_0xd019('0x13a')])){if(_0x119562[_0xd019('0xca')]){rpcDb['unlockContact'](_0x119562[_0xd019('0x13b')]);}if(_0x119562[_0xd019('0xab')]){rpcDb[_0xd019('0x89')](_0x119562[_0xd019('0x13b')]);}ami[_0xd019('0x24')](_0xd019('0x13c'),ut['buildObj'](_0x119562,'rejected'));this[_0xd019('0x13d')](_0x5d6bb2,_0x2a95a2,_0x30cc05);}else{_0x119562[_0xd019('0x8a')]=moment()[_0xd019('0x57')](_0xd019('0x8b'));ut[_0xd019('0xf6')](_0x5d6bb2,0x4,_0xd019('0xbc'));rpcDb[_0xd019('0xf7')](_0x5d6bb2,_0xd019('0x13e'));}}};Preview['prototype'][_0xd019('0x18')]=function(_0x34ffff){var _0x1eede5=this;var _0xd252c7=this[_0xd019('0x13')][_0x34ffff['linkedid']];var _0x553e08;if(_0xd252c7){_0x553e08=this['campaignsPreview'][_0xd252c7[_0xd019('0x6e')]];logger[_0xd019('0x59')](_0xd019('0x13f'),_0x34ffff['linkedid'],_0xd019('0xb3'),_0x553e08[_0xd019('0x27')],_0xd019('0x70'),_0x553e08['pTalking']);}if(this['actions'][_0x34ffff[_0xd019('0xac')]]&&_0x34ffff[_0xd019('0xac')]!==_0x34ffff[_0xd019('0xb2')]){if(_0x34ffff[_0xd019('0x140')]==='16'&&this[_0xd019('0x13')][_0x34ffff[_0xd019('0xac')]][_0xd019('0x71')]){this[_0xd019('0x9e')](_0x34ffff,_0x34ffff[_0xd019('0xac')],_0x34ffff['cause']);}else if(this[_0xd019('0x13')][_0x34ffff[_0xd019('0xac')]][_0xd019('0x71')]){logger['info'](_0xd019('0x141'),_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')],'\x20Queue',_0x553e08[_0xd019('0x27')],_0xd019('0x70'),_0x553e08[_0xd019('0xb0')]);this[_0xd019('0x9e')](_0x34ffff,_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')]);}}else if(_0xd252c7&&_[_0xd019('0x101')](_0xd252c7['statedesc'])&&_0x553e08[_0xd019('0x142')]&&_0x34ffff[_0xd019('0xac')]===_0x34ffff['uniqueid']&&_[_0xd019('0x101')](_0x34ffff[_0xd019('0xf5')])&&_0x34ffff[_0xd019('0x140')]==='16'&&_0x34ffff[_0xd019('0x143')]==='6'&&_[_0xd019('0xf3')](_0xd252c7[_0xd019('0x144')])){if(_0xd252c7['unlockAgent']){rpcDb[_0xd019('0x113')](_0xd252c7[_0xd019('0x13b')]);}if(_0xd252c7['activeContact']){rpcDb[_0xd019('0x89')](_0xd252c7[_0xd019('0x13b')]);}_0x34ffff['reason']='22';this['callProgressDetectingAgent'](_0xd252c7,_0x553e08,_0x34ffff);}else if(_0xd252c7&&_0xd252c7[_0xd019('0x144')]){if(_0x34ffff['cause']==='16'&&this['actions'][_0x34ffff['linkedid']][_0xd019('0x71')]){logger['info'](_0xd019('0x145'),_0x34ffff['linkedid'],_0x34ffff[_0xd019('0x140')],_0xd019('0xb3'),_0x553e08['name'],_0xd019('0x70'),_0x553e08[_0xd019('0xb0')]);this[_0xd019('0x9e')](_0x34ffff,_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')]);}else if(this[_0xd019('0x13')][_0x34ffff['linkedid']]['dialAnswer']){logger[_0xd019('0x59')](_0xd019('0x141'),_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')],_0xd019('0xb3'),_0x553e08[_0xd019('0x27')],_0xd019('0x70'),_0x553e08[_0xd019('0xb0')]);this[_0xd019('0x9e')](_0x34ffff,_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')]);}}};Preview[_0xd019('0xc')][_0xd019('0x1d')]=function(_0x63e4d0){if(this[_0xd019('0x13')][_0x63e4d0[_0xd019('0xf2')]]&&_0x63e4d0['destlinkedid']!==_0x63e4d0[_0xd019('0x146')]){this['callProgressDetectingCustomer'](_0x63e4d0,_0x63e4d0[_0xd019('0xf2')],_0x63e4d0[_0xd019('0xee')]);}};Preview['prototype'][_0xd019('0x1b')]=function(_0x40662d){if(this['actions'][_0x40662d[_0xd019('0xac')]]&&_0x40662d[_0xd019('0xac')]!==_0x40662d[_0xd019('0xb2')]&&!this[_0xd019('0x13')][_0x40662d[_0xd019('0xac')]]['dialAnswer']){if(_0x40662d[_0xd019('0x140')]==='1'){this[_0xd019('0x9e')](_0x40662d,_0x40662d[_0xd019('0xac')],_0x40662d['cause']);}}};Preview[_0xd019('0xc')][_0xd019('0x147')]=function(_0x21c2e4,_0x1e5628,_0x147c92){if(this['actions'][_0x21c2e4]){if(_[_0xd019('0x101')](this[_0xd019('0x13')][_0x21c2e4][_0xd019('0x148')])){this['actions'][_0x21c2e4][_0xd019('0x148')]={};}this[_0xd019('0x13')][_0x21c2e4][_0xd019('0x148')][_0x1e5628]=_0x147c92;}};Preview['prototype'][_0xd019('0x21')]=function(_0x3ff09b){try{if(!_[_0xd019('0x101')](_0x3ff09b)){if(ut[_0xd019('0x149')](_[_0xd019('0x14a')](_0x3ff09b[_0xd019('0x14b')])[0x0])){this[_0xd019('0x147')](_0x3ff09b['uniqueid'],_[_0xd019('0x14a')](_0x3ff09b[_0xd019('0x14b')])[0x0],_0x3ff09b[_0xd019('0x14c')]);}}}catch(_0x5f58fb){logger[_0xd019('0x14d')](_0xd019('0x14e'),util[_0xd019('0x14f')](_0x5f58fb,{'showHidden':![],'depth':null}));}};Preview[_0xd019('0xc')][_0xd019('0x150')]=function(_0xde2ae6){if(_0xde2ae6){if(this[_0xd019('0x13')][_0xde2ae6[_0xd019('0x151')]]){this['actions'][_0xde2ae6[_0xd019('0x151')]][_0xd019('0x144')]=!![];}}};Preview[_0xd019('0xc')][_0xd019('0x152')]=function(_0x72a444){if(_0x72a444){if(this[_0xd019('0x13')][_0x72a444['transfererlinkedid']]){this['actions'][_0x72a444['transfererlinkedid']][_0xd019('0x144')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xddc9=['voiceQueues','trunks','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','rescheduleContactInQueue','createBody','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','countnosuchnumberretry','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','checkInBlack','phone','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','getContactPreview','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','Contact','substring','dialCutDigit','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdName','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','Action','variablesAction','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','dialstatus','variables','syncVarSet','filterKey','keys','variable','addVariable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview'];(function(_0xaa35da,_0x14ad01){var _0x3bf710=function(_0x1ab44e){while(--_0x1ab44e){_0xaa35da['push'](_0xaa35da['shift']());}};_0x3bf710(++_0x14ad01);}(_0xddc9,0x13e));var _0x9ddc=function(_0xeea85d,_0x23bbeb){_0xeea85d=_0xeea85d-0x0;var _0x130a58=_0xddc9[_0xeea85d];return _0x130a58;};'use strict';var util=require(_0x9ddc('0x0'));var _=require('lodash');var BPromise=require(_0x9ddc('0x1'));var uuid=require(_0x9ddc('0x2'));var moment=require(_0x9ddc('0x3'));var md5=require(_0x9ddc('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x9ddc('0x5'))('preview');var loggerAction=require(_0x9ddc('0x5'))(_0x9ddc('0x6'));var ami=require(_0x9ddc('0x7'));var rpcDb=require(_0x9ddc('0x8'));var Action=require(_0x9ddc('0x9'));var ut=require(_0x9ddc('0xa'));config[_0x9ddc('0xb')]=_[_0x9ddc('0xc')](config[_0x9ddc('0xb')],{'host':_0x9ddc('0xd'),'port':0x18eb});var io=require(_0x9ddc('0xe'))(new Redis(config[_0x9ddc('0xb')]));var Sequence=function(){};Sequence[_0x9ddc('0xf')][_0x9ddc('0x10')]=function(_0x4b7829){this[_0x9ddc('0x11')]=this[_0x9ddc('0x11')]?this[_0x9ddc('0x11')][_0x9ddc('0x12')](_0x4b7829):_0x4b7829();};function Preview(_0x3b23a8){this[_0x9ddc('0x13')]=new Sequence();this[_0x9ddc('0x14')]=_0x3b23a8[_0x9ddc('0x15')];this[_0x9ddc('0x16')]=_0x3b23a8[_0x9ddc('0x16')];this['actions']={};this[_0x9ddc('0x17')]=_0x3b23a8['agents'];this[_0x9ddc('0x18')]=0x0;ami['on']('originateresponse',this[_0x9ddc('0x19')][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x1b'),this[_0x9ddc('0x1c')]['bind'](this));ami['on'](_0x9ddc('0x1d'),this[_0x9ddc('0x1e')][_0x9ddc('0x1a')](this));ami['on']('dialend',this[_0x9ddc('0x1f')][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x20'),this['syncNewExten'][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x21'),this['syncVarSet'][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x22'),this[_0x9ddc('0x23')][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x24'),this[_0x9ddc('0x25')][_0x9ddc('0x1a')](this));this[_0x9ddc('0x26')](this[_0x9ddc('0x14')]);}function emit(_0x5e4b9a,_0x2d7a95,_0x1cedc2){io['to'](_0x5e4b9a)[_0x9ddc('0x27')](_0x2d7a95,_0x1cedc2);}function emitCampaignPreview(_0x51170a){if(_0x51170a[_0x9ddc('0x28')]===_0x9ddc('0x29')){var _0x3a672b={'id':_0x51170a['id'],'name':_0x51170a[_0x9ddc('0x2a')],'strategy':_0x51170a[_0x9ddc('0x2b')],'answered':_0x51170a[_0x9ddc('0x2c')],'available':_0x51170a['available'],'loggedIn':_0x51170a[_0x9ddc('0x2d')],'pTalking':_0x51170a[_0x9ddc('0x2e')],'sumBillable':_0x51170a[_0x9ddc('0x2f')],'sumDuration':_0x51170a[_0x9ddc('0x30')],'sumHoldTime':_0x51170a[_0x9ddc('0x31')]||0x0,'talking':_0x51170a['talking'],'total':_0x51170a[_0x9ddc('0x32')],'type':_0x51170a[_0x9ddc('0x28')],'unmanaged':_0x51170a[_0x9ddc('0x33')],'abandoned':_0x51170a[_0x9ddc('0x34')],'waiting':_0x51170a[_0x9ddc('0x35')],'loggedInDb':_0x51170a['loggedInDb'],'dialActive':_0x51170a['dialActive'],'dialMethod':_0x51170a[_0x9ddc('0x36')],'dialOriginateCallerIdName':_0x51170a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x51170a[_0x9ddc('0x37')],'dialOriginateTimeout':_0x51170a['dialOriginateTimeout'],'dialPrefix':_0x51170a[_0x9ddc('0x38')],'outboundAnswerAgiCallsDay':_0x51170a['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x51170a[_0x9ddc('0x39')],'outboundBlacklistCallsDay':_0x51170a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x51170a[_0x9ddc('0x3a')],'outboundCongestionCallsDay':_0x51170a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x51170a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x51170a['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x51170a[_0x9ddc('0x3b')],'outboundNoAnswerCallsDay':_0x51170a['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x51170a[_0x9ddc('0x3c')],'outboundOriginateFailureCallsDay':_0x51170a[_0x9ddc('0x3d')],'outboundReCallsDay':_0x51170a[_0x9ddc('0x3e')],'outboundRejectCallsDay':_0x51170a['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x51170a[_0x9ddc('0x3f')],'outboundAbandonedCallsDay':_0x51170a[_0x9ddc('0x40')],'predictiveIntervalAnsweredCalls':_0x51170a[_0x9ddc('0x41')],'predictiveIntervalAvgHoldtime':_0x51170a[_0x9ddc('0x42')],'predictiveIntervalAvgTalktime':_0x51170a[_0x9ddc('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x51170a['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x51170a[_0x9ddc('0x44')],'predictiveIntervalErlangCalls':_0x51170a[_0x9ddc('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x51170a[_0x9ddc('0x46')],'predictiveIntervalHitRate':_0x51170a['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x51170a[_0x9ddc('0x47')],'predictiveIntervalPauses':_0x51170a['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x51170a['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x51170a[_0x9ddc('0x48')],'message':_0x51170a[_0x9ddc('0x49')],'originated':_0x51170a[_0x9ddc('0x4a')],'erlangCalls':_0x51170a[_0x9ddc('0x4b')],'erlangCallToSecond':_0x51170a[_0x9ddc('0x4c')],'erlangAbandonmentRate':_0x51170a[_0x9ddc('0x4d')],'erlangBusyFactor':_0x51170a['erlangBusyFactor'],'startPredictive':_0x51170a['startPredictive'],'startProgressive':_0x51170a[_0x9ddc('0x4e')]};if(_0x51170a[_0x9ddc('0x4f')]){_0x3a672b['Trunk']={'id':_0x51170a[_0x9ddc('0x4f')]['id'],'name':_0x51170a[_0x9ddc('0x4f')][_0x9ddc('0x2a')],'active':_0x51170a['Trunk']['active'],'callerid':_0x51170a[_0x9ddc('0x4f')][_0x9ddc('0x50')]};}if(_0x51170a[_0x9ddc('0x51')]){_0x3a672b['Interval']={'id':_0x51170a[_0x9ddc('0x51')]['id'],'name':_0x51170a[_0x9ddc('0x51')][_0x9ddc('0x2a')]};}var _0x4e7e3b=md5(JSON[_0x9ddc('0x52')](_0x3a672b));if(_0x51170a[_0x9ddc('0x4')]!==_0x4e7e3b){_0x51170a[_0x9ddc('0x4')]=_0x4e7e3b;emit(util[_0x9ddc('0x53')]('voice:queue:%s',_0x3a672b[_0x9ddc('0x2a')]),_0x9ddc('0x54'),_0x3a672b);}}}function emitVoiceQueueChannelRemove(_0x151221){logger[_0x9ddc('0x55')](_0x9ddc('0x56'),JSON[_0x9ddc('0x52')](_0x151221));emit(util[_0x9ddc('0x53')](_0x9ddc('0x57'),_0x151221[_0x9ddc('0x2a')]),_0x9ddc('0x58'),_0x151221);}function notSendMessagesQueue(_0x5ba006){if(_0x5ba006[_0x9ddc('0x59')]){if(_0x5ba006[_0x9ddc('0x4a')]===0x0&&_0x5ba006[_0x9ddc('0x2e')]===0x0){_0x5ba006[_0x9ddc('0x59')]=![];_0x5ba006[_0x9ddc('0x5a')]=0x0;_0x5ba006[_0x9ddc('0x5b')]=0x0;_0x5ba006[_0x9ddc('0x49')]=_0x9ddc('0x5c');ut[_0x9ddc('0x5d')](_0x9ddc('0x5e'),_0x5ba006[_0x9ddc('0x2a')]+_0x9ddc('0x5f'));}else{_0x5ba006[_0x9ddc('0x49')]=_0x9ddc('0x60');ut[_0x9ddc('0x5d')](_0x9ddc('0x5e'),_0x5ba006[_0x9ddc('0x2a')]+_0x9ddc('0x61'));}emitCampaignPreview(_0x5ba006);}}Preview[_0x9ddc('0xf')][_0x9ddc('0x26')]=function(){var _0xf5bc66=this;setInterval(function(){_0xf5bc66[_0x9ddc('0x62')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x29b7e8=this[_0x9ddc('0x14')];this[_0x9ddc('0x18')]+=0x1;for(var _0xcd56 in _0x29b7e8){if(_0x29b7e8[_0x9ddc('0x63')](_0xcd56)&&(_0x29b7e8[_0xcd56][_0x9ddc('0x36')]===_0x9ddc('0x64')||_0x29b7e8[_0xcd56][_0x9ddc('0x36')]===_0x9ddc('0x65'))&&_0x29b7e8[_0xcd56][_0x9ddc('0x28')]===_0x9ddc('0x29')){if(this[_0x9ddc('0x18')]>0x7){this[_0x9ddc('0x18')]=0x0;this[_0x9ddc('0x66')]();}}if(_0x29b7e8[_0x9ddc('0x63')](_0xcd56)&&_0x29b7e8[_0xcd56][_0x9ddc('0x36')]===_0x9ddc('0x64')&&_0x29b7e8[_0xcd56][_0x9ddc('0x28')]===_0x9ddc('0x29')){if(_0x29b7e8[_0xcd56][_0x9ddc('0x67')]){this[_0x9ddc('0x68')](_0x29b7e8[_0xcd56]);this[_0x9ddc('0x69')](_0x29b7e8[_0xcd56]);}else{notSendMessagesQueue(_0x29b7e8[_0xcd56]);}}}};Preview[_0x9ddc('0xf')][_0x9ddc('0x6a')]=function(_0x264bf8){var _0x58fe0d=this;this[_0x9ddc('0x13')][_0x9ddc('0x10')](function(){if(!_[_0x9ddc('0x6b')](_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8])){loggerAction['info'](_0x9ddc('0x6d'),_0x264bf8,'Queue',_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')],'originated:\x20',JSON[_0x9ddc('0x52')](_0x58fe0d[_0x9ddc('0x14')][_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]][_0x9ddc('0x4a')]),_0x9ddc('0x6f'),JSON[_0x9ddc('0x52')](_0x58fe0d[_0x9ddc('0x14')][_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]][_0x9ddc('0x2e')]),JSON[_0x9ddc('0x52')](_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x70')]),JSON[_0x9ddc('0x52')](_[_0x9ddc('0x71')](_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8],['contactId',_0x9ddc('0x72'),_0x9ddc('0x73'),_0x9ddc('0x74')])));return ami['Action']({'action':_0x9ddc('0x75'),'channel':_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x76')]})[_0x9ddc('0x77')](function(_0x4527b0){if(_0x4527b0[_0x9ddc('0x49')]===_0x9ddc('0x78')){setTimeout(function(){if(_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8]){ut[_0x9ddc('0x79')](_0x58fe0d[_0x9ddc('0x14')][_0x58fe0d['actions'][_0x264bf8][_0x9ddc('0x6e')]],_0x9ddc('0x7a'));if(_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8]['dialAnswer']===!![]){ut['decrementTalkink'](_0x58fe0d[_0x9ddc('0x14')][_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]],_0x9ddc('0x7a'));ut[_0x9ddc('0x7b')](_0x9ddc('0x7c')+_0x264bf8,_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]);}ut[_0x9ddc('0x7b')](_0x9ddc('0x7d')+_0x264bf8,_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]);delete _0x58fe0d[_0x9ddc('0x6c')][_0x264bf8];}},0x2328);}});}});};Preview[_0x9ddc('0xf')][_0x9ddc('0x66')]=function(){var _0x4468d4=this;loggerAction[_0x9ddc('0x55')](_0x9ddc('0x7e'),_['size'](this[_0x9ddc('0x6c')]));for(var _0x44cebc in this[_0x9ddc('0x6c')]){if(_0x4468d4[_0x9ddc('0x6c')][_0x9ddc('0x63')](_0x44cebc)){_0x4468d4[_0x9ddc('0x6a')](_0x44cebc);}}};Preview['prototype'][_0x9ddc('0x69')]=function(_0x51f834){var _0x108fd1=this;rpcDb[_0x9ddc('0x7f')](_0x51f834['id'],ut[_0x9ddc('0x80')](this['agents']))[_0x9ddc('0x81')](function(_0x463c6b){if(!_[_0x9ddc('0x6b')](_0x463c6b)){for(var _0x1bc4cc=0x0;_0x1bc4cc<_0x463c6b[_0x9ddc('0x82')];_0x1bc4cc+=0x1){if(ut[_0x9ddc('0x83')](_0x463c6b[_0x1bc4cc][_0x9ddc('0x84')])<_0x51f834[_0x9ddc('0x85')]*0x3c){if(_0x463c6b[_0x1bc4cc][_0x9ddc('0x86')]&&!_0x463c6b[_0x1bc4cc][_0x9ddc('0x86')]['voicePause']){_0x108fd1[_0x9ddc('0x87')](_0x463c6b[_0x1bc4cc]['id'])['then'](ut[_0x9ddc('0x88')](_0x9ddc('0x89')))[_0x9ddc('0x77')](ut[_0x9ddc('0x88')](_0x9ddc('0x89')));}else{rpcDb[_0x9ddc('0x8a')](_0x463c6b[_0x1bc4cc]['id']);}}else{var _0x10eced=new Action(_0x463c6b[_0x1bc4cc],_0x51f834);_0x10eced[_0x9ddc('0x8b')]=moment()[_0x9ddc('0x53')](_0x9ddc('0x8c'));_0x51f834[_0x9ddc('0x3e')]+=0x1;ut['logCustomer'](_0x10eced,0x17,'RecallInQueue');if(_0x51f834['dialRecallInQueue']){rpcDb[_0x9ddc('0x8d')](ut[_0x9ddc('0x8e')](_0x463c6b[_0x1bc4cc]));rpcDb['createCustomerHistory'](_0x10eced,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x9ddc('0x8f')](_0x10eced,0x16,_0x9ddc('0x90'));rpcDb['createCustomerHistory'](_0x10eced,_0x9ddc('0x91'));rpcDb[_0x9ddc('0x92')](_0x10eced,_0x9ddc('0x91'));}}}}})['catch'](ut['logger2']('[getContactRecallMe]'));};Preview[_0x9ddc('0xf')][_0x9ddc('0x68')]=function(_0x5db33f){_0x5db33f[_0x9ddc('0x59')]=!![];if(ut['IsNotLoggedIn'](_0x5db33f[_0x9ddc('0x2d')])){_0x5db33f[_0x9ddc('0x49')]=_0x9ddc('0x93');}else if(!ut[_0x9ddc('0x94')](_0x5db33f[_0x9ddc('0x67')])){_0x5db33f[_0x9ddc('0x49')]=_0x9ddc('0x5c');}else if(!this[_0x9ddc('0x95')](_0x5db33f['Trunk'])){if(!this['isTrunkReachable'](_0x5db33f['TrunkBackup'])){_0x5db33f[_0x9ddc('0x49')]='TRUNK_IS_NOT_REACHABLE';}else{_0x5db33f['message']='ACTIVE';}}else{_0x5db33f[_0x9ddc('0x49')]=_0x9ddc('0x96');}emitCampaignPreview(_0x5db33f);};Preview[_0x9ddc('0xf')][_0x9ddc('0x97')]=function(_0x2a7168,_0x24f8b4,_0x3b55b3){var _0x16748a=this;var _0x240380=this[_0x9ddc('0x6c')][_0x24f8b4];var _0x44b2e9=this[_0x9ddc('0x14')][_0x240380[_0x9ddc('0x6e')]];var _0x17087a;if(_0x44b2e9){switch(_0x3b55b3){case'1':_0x44b2e9['outboundNoSuchCallsDay']+=0x1;_0x240380['countnosuchnumberretry']+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x0,_0x9ddc('0x9a'));ami[_0x9ddc('0x27')](_0x9ddc('0x9b'),ut[_0x9ddc('0x9c')](_0x240380,_0x9ddc('0x9d')));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0x9f'));if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut['cloneAction'](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb[_0x9ddc('0x92')](_0x17087a,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x240380[_0x9ddc('0xa2')]>=_0x44b2e9[_0x9ddc('0xa3')]){rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xa4'));}else{rpcDb[_0x9ddc('0xa5')](ut[_0x9ddc('0xa6')](_0x240380,_0x9ddc('0xa2'),_0x44b2e9['dialNoSuchNumberRetryFrequency']),_0x240380['unlockAgent'],_0x240380['activeContact']);}}delete this[_0x9ddc('0x6c')][_0x2a7168[_0x9ddc('0xa7')]];break;case'ANSWER':var _0x52c6ab=moment()['format'](_0x9ddc('0x8c'));_0x240380[_0x9ddc('0xa8')]=_0x52c6ab;_0x240380[_0x9ddc('0xa9')]=_0x52c6ab;_0x240380[_0x9ddc('0x70')]=!![];_0x44b2e9[_0x9ddc('0x2e')]+=0x1;logger[_0x9ddc('0x55')](_0x9ddc('0xaa'),_0x240380[_0x9ddc('0xab')],'\x20Queue',_0x44b2e9[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x44b2e9[_0x9ddc('0x2e')]);ami[_0x9ddc('0x27')](_0x9ddc('0xac'),ut['buildObj'](_0x240380,_0x9ddc('0xad')));if(_0x44b2e9[_0x9ddc('0xae')]){ami[_0x9ddc('0x27')]('custom:agentConnectPreview',ut[_0x9ddc('0xaf')](_0x240380));}break;case'16':ami[_0x9ddc('0x27')](_0x9ddc('0xb0'),ut[_0x9ddc('0x9c')](_0x240380,'complete'));emitVoiceQueueChannelRemove(ut[_0x9ddc('0x9c')](_0x240380,'complete'));_0x44b2e9[_0x9ddc('0x39')]+=0x1;_0x44b2e9['total']+=0x1;_0x44b2e9['answered']+=0x1;ut[_0x9ddc('0xb1')](_0x44b2e9,_0x9ddc('0xb2'));_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x4,'Answer');rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xb3'));rpcDb['createCustomerFinal'](_0x240380,_0x9ddc('0xb4'));rpcDb['crateCustomerReportQueue'](_0x240380);_0x44b2e9['sumDuration']+=_0x240380[_0x9ddc('0xb5')];_0x44b2e9[_0x9ddc('0x2f')]+=_0x240380[_0x9ddc('0xb5')];logger['info'](_0x9ddc('0xb6'),_0x240380['uniqueid'],_0x9ddc('0xb7'),_0x44b2e9[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x44b2e9['pTalking']);delete this[_0x9ddc('0x6c')][_0x2a7168[_0x9ddc('0xa7')]];break;case _0x9ddc('0xb8'):_0x44b2e9['outboundBusyCallsDay']+=0x1;_0x240380[_0x9ddc('0xb9')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x5,_0x9ddc('0xba'));ami[_0x9ddc('0x27')](_0x9ddc('0xbb'),ut['buildObj'](_0x240380,'busy'));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xbc'));if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut[_0x9ddc('0xbd')](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb[_0x9ddc('0x92')](_0x17087a,_0x9ddc('0xbe'));}else{if(_0x240380[_0x9ddc('0xb9')]>=_0x44b2e9['dialBusyMaxRetry']){rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xbc'));}else{rpcDb[_0x9ddc('0xa5')](ut[_0x9ddc('0xa6')](_0x240380,_0x9ddc('0xb9'),_0x44b2e9[_0x9ddc('0xbf')]),_0x240380[_0x9ddc('0xc0')],_0x240380[_0x9ddc('0xc1')]);}}break;case _0x9ddc('0xc2'):_0x44b2e9['outboundNoAnswerCallsDay']+=0x1;_0x240380[_0x9ddc('0xc3')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut['logCustomer'](_0x240380,0x3,_0x9ddc('0xc4'));ami[_0x9ddc('0x27')](_0x9ddc('0xc5'),ut[_0x9ddc('0x9c')](_0x240380,_0x9ddc('0xc6')));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xc7'));if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut[_0x9ddc('0xbd')](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb[_0x9ddc('0x92')](_0x17087a,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x240380[_0x9ddc('0xc3')]>=_0x44b2e9[_0x9ddc('0xc8')]){rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xc7'));}else{rpcDb[_0x9ddc('0xa5')](ut[_0x9ddc('0xa6')](_0x240380,'countnoanswerretry',_0x44b2e9[_0x9ddc('0xc9')]),_0x240380[_0x9ddc('0xc0')],_0x240380['activeContact']);}}break;case _0x9ddc('0xca'):_0x44b2e9[_0x9ddc('0xcb')]+=0x1;_0x240380[_0x9ddc('0xcc')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x8,_0x9ddc('0xcd'));ami[_0x9ddc('0x27')](_0x9ddc('0xce'),ut[_0x9ddc('0x9c')](_0x240380,_0x9ddc('0xcf')));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xd0'));if(ut['totalGlobal'](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut['cloneAction'](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb[_0x9ddc('0x92')](_0x17087a,_0x9ddc('0xd1'));}else{if(_0x240380[_0x9ddc('0xcc')]>=_0x44b2e9[_0x9ddc('0xd2')]){rpcDb[_0x9ddc('0x92')](_0x240380,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x9ddc('0xa5')](ut[_0x9ddc('0xa6')](_0x240380,'countcongestionretry',_0x44b2e9['dialBusyRetryFrequency']),_0x240380[_0x9ddc('0xc0')],_0x240380[_0x9ddc('0xc1')]);}}break;case _0x9ddc('0xd3'):_0x44b2e9[_0x9ddc('0xd4')]+=0x1;_0x240380[_0x9ddc('0xd5')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x14,_0x9ddc('0xd6'));ami[_0x9ddc('0x27')](_0x9ddc('0xd7'),ut['buildObj'](_0x240380,_0x9ddc('0xd8')));rpcDb['createCustomerHistory'](_0x240380,'[syncHangupRequest][logAgentReject]');if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut['cloneAction'](_0x240380,0x14,_0x9ddc('0xd6'));rpcDb['createCustomerFinal'](_0x17087a,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x240380[_0x9ddc('0xd5')]>=_0x44b2e9['dialAgentRejectMaxRetry']){rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xd9'));}else{rpcDb[_0x9ddc('0xa5')](ut['scheduledAt'](_0x240380,_0x9ddc('0xd5'),_0x44b2e9[_0x9ddc('0xda')]),_0x240380[_0x9ddc('0xc0')],_0x240380[_0x9ddc('0xc1')]);}}break;case _0x9ddc('0xdb'):_0x44b2e9[_0x9ddc('0x40')]+=0x1;_0x240380[_0x9ddc('0xdc')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut['totalGlobal'](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0xb,_0x9ddc('0xdd'));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xde'));if(ut['totalGlobal'](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut['cloneAction'](_0x240380,0xf,'Global');rpcDb['createCustomerFinal'](_0x17087a,_0x9ddc('0xde'));}else{if(_0x240380[_0x9ddc('0xdf')]>=_0x44b2e9[_0x9ddc('0xe0')]){rpcDb['createCustomerFinal'](_0x240380,_0x9ddc('0xde'));}else{rpcDb['rescheduleContact'](ut[_0x9ddc('0xa6')](_0x240380,_0x9ddc('0xdc'),_0x44b2e9[_0x9ddc('0xe1')]),_0x240380[_0x9ddc('0xc0')],_0x240380[_0x9ddc('0xc1')]);}}break;default:if(_0x240380[_0x9ddc('0x70')]){ut[_0x9ddc('0xb1')](_0x44b2e9,_0x9ddc('0xe2'));ut[_0x9ddc('0x7b')](_0x9ddc('0xe3')+_0x44b2e9[_0x9ddc('0x2a')],_0x2a7168);}_0x44b2e9['outboundUnknownCallsDay']+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut['logCustomer'](_0x240380,0xc,_0x2a7168['cause-txt']||_0x2a7168['dialstatus']);rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xe4'));if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut[_0x9ddc('0xbd')](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb['createCustomerFinal'](_0x17087a,_0x9ddc('0xe5'));}else{rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xe5'));}delete this[_0x9ddc('0x6c')][_0x2a7168['linkedid']];}if(!(_0x240380['dialAnswer']&&_0x3b55b3==='16')){ut[_0x9ddc('0x79')](_0x44b2e9,_0x9ddc('0xe6'));logger['info'](_0x9ddc('0xe7'),_0x240380[_0x9ddc('0xab')],_0x9ddc('0xb7'),_0x44b2e9[_0x9ddc('0x2a')],'originated:\x20',_0x44b2e9['originated']);}if(_0x3b55b3!==_0x9ddc('0xe8')){delete this[_0x9ddc('0x6c')][_0x2a7168['linkedid']];delete this['actions'][_0x2a7168[_0x9ddc('0xe9')]];}}};Preview['prototype'][_0x9ddc('0xea')]=function(_0x4052ec,_0x3f7c4c,_0x5b91e8){if(_[_0x9ddc('0xeb')](_0x3f7c4c)&&'object'!==typeof _0x3f7c4c){return;}if(_[_0x9ddc('0xeb')](_0x5b91e8)&&'object'!==typeof _0x5b91e8){return;}switch(_0x5b91e8['reason']){case'0':ut[_0x9ddc('0xec')](_0x4052ec,0x0,_0x9ddc('0x9a'));rpcDb[_0x9ddc('0xed')](_0x4052ec,_0x9ddc('0xee'));break;case'3':ut[_0x9ddc('0xec')](_0x4052ec,0x3,_0x9ddc('0xc4'));rpcDb[_0x9ddc('0xed')](_0x4052ec,_0x9ddc('0xef'));break;case'5':ut['logAgent'](_0x4052ec,0x5,'Busy');rpcDb[_0x9ddc('0xed')](_0x4052ec,_0x9ddc('0xf0'));break;case'8':ut[_0x9ddc('0xec')](_0x4052ec,0x8,_0x9ddc('0xcd'));rpcDb[_0x9ddc('0xed')](_0x4052ec,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x9ddc('0xec')](_0x4052ec,0x16,_0x9ddc('0xf1'));rpcDb['createAgentHistory'](_0x4052ec,_0x9ddc('0xf2'));break;default:ut['logAgent'](_0x4052ec,0xc,_0x5b91e8[_0x9ddc('0xf3')]);rpcDb['createAgentHistory'](_0x4052ec,_0x9ddc('0xf4'));}ut['updateOriginated'](_0x3f7c4c,_0x9ddc('0xf5'));logger[_0x9ddc('0x55')](_0x9ddc('0xf6'),_0x4052ec[_0x9ddc('0xab')],_0x9ddc('0xb7'),_0x3f7c4c[_0x9ddc('0x2a')],_0x9ddc('0xf7'),_0x3f7c4c[_0x9ddc('0x4a')]);delete this[_0x9ddc('0x6c')][_0x4052ec[_0x9ddc('0xab')]];};Preview[_0x9ddc('0xf')][_0x9ddc('0xf8')]=function(_0x58af1c,_0x56b750,_0x3feb01,_0x1bef52,_0x208104){var _0x58d00b=this;return new BPromise(function(_0x253e82,_0x1d2a9b){if(_[_0x9ddc('0x6b')](_0x56b750)||_[_0x9ddc('0x6b')](_0x56b750['Contact'])||_['isNil'](_0x56b750['Contact'][_0x9ddc('0xf9')])||_[_0x9ddc('0x6b')](_0x56b750[_0x9ddc('0x73')])){_0x1d2a9b(ut[_0x9ddc('0x49')](_0x9ddc('0xfa'),_0x1bef52,_0x208104));return;}var _0xed99df=uuid['v4']();var _0x2717cf=_0x58d00b[_0x9ddc('0x14')][_0x56b750[_0x9ddc('0xfb')][_0x9ddc('0x2a')]];var _0x2359d1=_0x3feb01?_0x58d00b[_0x9ddc('0x17')][_0x3feb01]['id']:undefined;_0x58d00b[_0x9ddc('0x6c')][_0xed99df]=new Action(_0x56b750,_0x2717cf,_0xed99df,_0x3feb01,_0x2359d1);var _0x12b461=_0x58d00b[_0x9ddc('0x6c')][_0xed99df];_0x12b461['unlockAgent']=_0x1bef52;_0x12b461[_0x9ddc('0xc1')]=_0x208104;_0x12b461[_0x9ddc('0xfc')]=_0x3feb01;if(_['isEmpty'](_0x58af1c)){_0x58d00b[_0x9ddc('0xfd')](_0x12b461,_0x2717cf,_0x56b750,_0x3feb01)[_0x9ddc('0x81')](function(_0x26b990){logger[_0x9ddc('0x55')](_0x9ddc('0xfe'),_0x9ddc('0xff')+_0x12b461['queue']+_0x9ddc('0x100')+_0x12b461[_0x9ddc('0x101')],JSON[_0x9ddc('0x52')](_0x26b990));ami[_0x9ddc('0x27')](_0x9ddc('0x102'),ut[_0x9ddc('0x9c')](_0x12b461,'called'));_0x253e82(ut[_0x9ddc('0x49')](_0x9ddc('0x103')));})[_0x9ddc('0x77')](function(_0xf0c5e0){ut[_0x9ddc('0x5d')](_0x9ddc('0x104'),_0xf0c5e0);_0x1d2a9b(ut['message'](_0x9ddc('0x105'),_0x1bef52,_0x208104));});}else{_0x2717cf[_0x9ddc('0x106')]+=0x1;ut[_0x9ddc('0x107')](_0x12b461);rpcDb[_0x9ddc('0x108')](_0x12b461,'[Blacklist][error]');delete _0x58d00b[_0x9ddc('0x6c')][_0xed99df];_0x1d2a9b(ut[_0x9ddc('0x49')](_0x9ddc('0x109'),_0x1bef52,_0x208104));}});};Preview[_0x9ddc('0xf')][_0x9ddc('0x95')]=function(_0x587168){return!_[_0x9ddc('0x6b')](_0x587168)&&!_[_0x9ddc('0x6b')](_0x587168[_0x9ddc('0x2a')])&&!_[_0x9ddc('0x6b')](_0x587168[_0x9ddc('0x10a')])&&_0x587168[_0x9ddc('0x10a')]&&!_[_0x9ddc('0x6b')](this[_0x9ddc('0x16')][util['format']('SIP/%s',_0x587168[_0x9ddc('0x2a')])])&&!_['isNil'](this[_0x9ddc('0x16')][util['format'](_0x9ddc('0x10b'),_0x587168[_0x9ddc('0x2a')])][_0x9ddc('0x75')])&&(this['trunks'][util[_0x9ddc('0x53')](_0x9ddc('0x10b'),_0x587168[_0x9ddc('0x2a')])]['status']===_0x9ddc('0x10c')||this[_0x9ddc('0x16')][util['format']('SIP/%s',_0x587168[_0x9ddc('0x2a')])][_0x9ddc('0x75')]===_0x9ddc('0x10d'));};Preview['prototype'][_0x9ddc('0x87')]=function(_0x5a3d67,_0x4b3256){var _0x26b551=this;return new BPromise(function(_0x48f4e1,_0x5e3888){_0x26b551['execRun'](_0x5a3d67,_0x4b3256)[_0x9ddc('0x81')](function(_0x1d1998){_0x48f4e1(_[_0x9ddc('0x71')](_0x1d1998,[_0x9ddc('0x49')]));})['catch'](function(_0x336fa4){if(_0x336fa4[_0x9ddc('0x10e')]){rpcDb[_0x9ddc('0x10f')](_0x5a3d67);}if(_0x336fa4['active']){rpcDb[_0x9ddc('0x8a')](_0x5a3d67);}_0x5e3888(_[_0x9ddc('0x71')](_0x336fa4,[_0x9ddc('0x49')]));});});};Preview[_0x9ddc('0xf')][_0x9ddc('0x110')]=function(_0x432f1a,_0x578074){var _0x55657c=this;return new BPromise(function(_0xb8dbca,_0xea9973){var _0x87c418,_0x1f9fa5;rpcDb[_0x9ddc('0x111')](_0x432f1a)[_0x9ddc('0x81')](function(_0x2bf4b7){if(!_[_0x9ddc('0x6b')](_0x2bf4b7[0x0])){_0x1f9fa5=_0x2bf4b7[0x0]['recallme']?![]:!![];_0x87c418=_0x2bf4b7[0x0]['recallme']?!![]:![];_0x87c418=_0x578074?!![]:_0x87c418;}var _0x54ef8e=_0x55657c[_0x9ddc('0x112')](_0x2bf4b7);if(_0x54ef8e[_0x9ddc('0x113')]){rpcDb[_0x9ddc('0x114')](_[_0x9ddc('0x71')](_0x2bf4b7[0x0],[_0x9ddc('0x73'),'Contact.phone']))[_0x9ddc('0x81')](function(_0xe15f5d){_0x55657c['checkInBlack'](_0xe15f5d,_0x2bf4b7[0x0],_0x578074,_0x1f9fa5,_0x87c418)[_0x9ddc('0x81')](function(_0x4339f1){_0xb8dbca(_0x4339f1);})[_0x9ddc('0x77')](function(_0x9a53a1){_0xea9973(_0x9a53a1);});})[_0x9ddc('0x77')](function(_0x42bc75){ut['logger'](_0x9ddc('0x115'),_0x42bc75);_0xea9973(ut[_0x9ddc('0x49')]('Call\x20unsuccessful',_0x1f9fa5,_0x87c418));});}else{_0xea9973(ut[_0x9ddc('0x49')](_0x54ef8e[_0x9ddc('0x49')],_0x1f9fa5,_0x87c418));}})[_0x9ddc('0x77')](function(_0x3525d1){ut[_0x9ddc('0x5d')](_0x9ddc('0x116'),_0x3525d1);_0xea9973(ut['message'](_0x9ddc('0x117'),![],!![]));});});};Preview[_0x9ddc('0xf')]['validateContact']=function(_0xa3a8eb){if(_[_0x9ddc('0x6b')](_0xa3a8eb)||_[_0x9ddc('0x118')](_0xa3a8eb)||!_[_0x9ddc('0x6b')](_0xa3a8eb[0x0][_0x9ddc('0x86')])&&_['isNil'](_0xa3a8eb[0x0][_0x9ddc('0x86')]['name'])){ut['logger'](_0x9ddc('0x119'),_0xa3a8eb);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x49e6ac=this['campaignsPreview'][_0xa3a8eb[0x0][_0x9ddc('0xfb')][_0x9ddc('0x2a')]];_0x49e6ac['message']='ACTIVE';if(_[_0x9ddc('0x6b')](_0x49e6ac)){ut[_0x9ddc('0x5d')](_0x9ddc('0x11a'),_0x49e6ac);return{'isValid':![],'message':_0x9ddc('0x11b')};}if(!this[_0x9ddc('0x95')](_0x49e6ac['Trunk'])){ut['logger'](_0x9ddc('0x11c'),_0x9ddc('0x11d')+_0x49e6ac[_0x9ddc('0x2a')]+_0x9ddc('0x11e'));if(!this[_0x9ddc('0x95')](_0x49e6ac[_0x9ddc('0x11f')])){ut[_0x9ddc('0x5d')](_0x9ddc('0x11c'),_0x49e6ac[_0x9ddc('0x2a')]+_0x9ddc('0x120'));return{'isValid':![],'message':_0x9ddc('0x121')};}}if(!ut['isActive'](_0x49e6ac[_0x9ddc('0x67')])){ut[_0x9ddc('0x5d')](_0x9ddc('0x122'),_0x49e6ac[_0x9ddc('0x2a')]+_0x9ddc('0x123'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x49e6ac[_0x9ddc('0x2a')]+_0x9ddc('0x123')};}return{'isValid':!![],'message':_0x9ddc('0x124')};};Preview[_0x9ddc('0xf')][_0x9ddc('0xfd')]=function(_0x197a0f,_0x3bef4d,_0x153ecf,_0x95efab){var _0xdb04e2=this;return new BPromise(function(_0xfde2b0,_0x2adf9d){var _0x400b44=_0x197a0f[_0x9ddc('0xab')];var _0x231d7b=_0xdb04e2['isTrunkReachable'](_0x3bef4d['Trunk'])?util[_0x9ddc('0x53')](_0x9ddc('0x125'),_0x3bef4d[_0x9ddc('0x4f')][_0x9ddc('0x2a')],_['isNil'](_0x3bef4d[_0x9ddc('0x38')])?'':_0x3bef4d[_0x9ddc('0x38')]['trim']()||'',_0x3bef4d['dialCutDigit']>0x0?_0x153ecf[_0x9ddc('0x126')][_0x9ddc('0xf9')][_0x9ddc('0x127')](_0x3bef4d[_0x9ddc('0x128')]):_0x153ecf[_0x9ddc('0x126')][_0x9ddc('0xf9')]):util[_0x9ddc('0x53')]('SIP/%s/%s%s',_['isNil'](_0x3bef4d[_0x9ddc('0x11f')])?_0x3bef4d[_0x9ddc('0x4f')][_0x9ddc('0x2a')]:_0x3bef4d[_0x9ddc('0x11f')][_0x9ddc('0x2a')],_[_0x9ddc('0x6b')](_0x3bef4d[_0x9ddc('0x38')])?'':_0x3bef4d['dialPrefix'][_0x9ddc('0x129')]()||'',_0x3bef4d[_0x9ddc('0x128')]>0x0?_0x153ecf[_0x9ddc('0x126')]['phone']['substring'](_0x3bef4d[_0x9ddc('0x128')]):_0x153ecf[_0x9ddc('0x126')][_0x9ddc('0xf9')]);var _0x5b0347=_0xdb04e2[_0x9ddc('0x95')](_0x3bef4d[_0x9ddc('0x4f')])?ut[_0x9ddc('0x12a')](_0x3bef4d[_0x9ddc('0x4f')][_0x9ddc('0x50')],_0x3bef4d['dialOriginateCallerIdName'],_0x3bef4d[_0x9ddc('0x12b')]>0x0?ut[_0x9ddc('0x12c')](_0x3bef4d['dialOriginateCallerIdNumber'],_0x3bef4d[_0x9ddc('0x12b')]):_0x3bef4d[_0x9ddc('0x37')]):ut[_0x9ddc('0x12a')](_[_0x9ddc('0x6b')](_0x3bef4d[_0x9ddc('0x11f')])?_0x3bef4d[_0x9ddc('0x4f')]['callerid']:_0x3bef4d[_0x9ddc('0x11f')][_0x9ddc('0x50')],_0x3bef4d[_0x9ddc('0x12d')],_0x3bef4d['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x9ddc('0x12c')](_0x3bef4d[_0x9ddc('0x37')],_0x3bef4d[_0x9ddc('0x12b')]):_0x3bef4d[_0x9ddc('0x37')]);if(_0x5b0347){_0x197a0f['originatecalleridname']=ut[_0x9ddc('0x12e')](_0x5b0347);_0x197a0f[_0x9ddc('0x12f')]=ut[_0x9ddc('0x130')](_0x5b0347);}var _0x25ffe4=ut[_0x9ddc('0x131')](_0x3bef4d,_0x153ecf,_0x231d7b,_0x5b0347,_0x400b44,_0x197a0f);_['merge'](_0x197a0f,ut[_0x9ddc('0x132')](_0x25ffe4));_0x197a0f[_0x9ddc('0x8b')]=moment()[_0x9ddc('0x53')](_0x9ddc('0x8c'));ami[_0x9ddc('0x133')](ut[_0x9ddc('0x134')](_0x197a0f,_0x3bef4d,_0x25ffe4,_0x197a0f[_0x9ddc('0xc1')],_0x95efab))['then'](function(_0xbac7e3){_0x3bef4d[_0x9ddc('0x4a')]+=0x1;logger[_0x9ddc('0x55')]('[originated][increment]',_0x400b44,_0x9ddc('0xb7'),_0x3bef4d['name'],_0x9ddc('0xf7'),_0x3bef4d[_0x9ddc('0x4a')]);_0xfde2b0(_0xbac7e3);})[_0x9ddc('0x77')](function(_0x396132){ut[_0x9ddc('0xec')](_0x197a0f,0xe,'OriginateError');rpcDb[_0x9ddc('0xed')](_0x197a0f,_0x9ddc('0x135'));_0x2adf9d(_0x396132);});});};Preview['prototype']['syncNewExten']=function(_0x9c53e1){if(this['actions'][_0x9c53e1[_0x9ddc('0xa7')]]){this[_0x9ddc('0x6c')][_0x9c53e1[_0x9ddc('0xa7')]][_0x9ddc('0x76')]=_0x9c53e1[_0x9ddc('0x76')];}};Preview['prototype'][_0x9ddc('0x19')]=function(_0x555ba8){var _0x150661=this;var _0x3cc631=this['actions'][_0x555ba8[_0x9ddc('0x136')]];if(_0x3cc631){if(_0x3cc631['lookAgent']&&this['agents'][_0x3cc631[_0x9ddc('0xfc')]]){ut[_0x9ddc('0x137')](_0x3cc631,this['agents'][_0x3cc631['lookAgent']][_0x9ddc('0x2a')],this['agents'][_0x3cc631[_0x9ddc('0xfc')]]['id']);}var _0x3168db=_[_0x9ddc('0x138')](_0x3cc631);_0x3168db['responsetime']=moment()[_0x9ddc('0x53')](_0x9ddc('0x8c'));var _0x543a79=_0x150661['campaignsPreview'][_0x3cc631[_0x9ddc('0x6e')]];if(ut['isFailure'](_0x555ba8[_0x9ddc('0x139')])){if(_0x3cc631[_0x9ddc('0xc0')]){rpcDb[_0x9ddc('0x10f')](_0x3cc631[_0x9ddc('0x101')]);}if(_0x3cc631['activeContact']){rpcDb[_0x9ddc('0x8a')](_0x3cc631[_0x9ddc('0x101')]);}ami[_0x9ddc('0x27')]('custom:agentringnoanswer',ut['buildObj'](_0x3cc631,_0x9ddc('0x13a')));this['callProgressDetectingAgent'](_0x3168db,_0x543a79,_0x555ba8);}else{_0x3cc631[_0x9ddc('0x8b')]=moment()[_0x9ddc('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x3168db,0x4,_0x9ddc('0x13b'));rpcDb['createAgentHistory'](_0x3168db,_0x9ddc('0x13c'));}}};Preview[_0x9ddc('0xf')][_0x9ddc('0x1c')]=function(_0x57625b){var _0x3a3c55=this;var _0xeea313=this['actions'][_0x57625b[_0x9ddc('0xa7')]];var _0x4fbfac;if(_0xeea313){_0x4fbfac=this[_0x9ddc('0x14')][_0xeea313[_0x9ddc('0x6e')]];logger['info'](_0x9ddc('0x13d'),_0x57625b[_0x9ddc('0xa7')],_0x9ddc('0xb7'),_0x4fbfac[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x4fbfac['pTalking']);}if(this['actions'][_0x57625b[_0x9ddc('0xa7')]]&&_0x57625b[_0x9ddc('0xa7')]!==_0x57625b[_0x9ddc('0xab')]){if(_0x57625b[_0x9ddc('0x13e')]==='16'&&this[_0x9ddc('0x6c')][_0x57625b[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){this[_0x9ddc('0x97')](_0x57625b,_0x57625b[_0x9ddc('0xa7')],_0x57625b['cause']);}else if(this['actions'][_0x57625b[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){logger[_0x9ddc('0x55')](_0x9ddc('0x13f'),_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')],_0x9ddc('0xb7'),_0x4fbfac[_0x9ddc('0x2a')],'pTalking:\x20',_0x4fbfac[_0x9ddc('0x2e')]);this[_0x9ddc('0x97')](_0x57625b,_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')]);}}else if(_0xeea313&&_[_0x9ddc('0x6b')](_0xeea313[_0x9ddc('0x140')])&&_0x4fbfac[_0x9ddc('0x141')]&&_0x57625b[_0x9ddc('0xa7')]===_0x57625b[_0x9ddc('0xab')]&&_[_0x9ddc('0x6b')](_0x57625b['reason'])&&_0x57625b[_0x9ddc('0x13e')]==='16'&&_0x57625b[_0x9ddc('0x142')]==='6'&&_['isUndefined'](_0xeea313[_0x9ddc('0x143')])){if(_0xeea313[_0x9ddc('0xc0')]){rpcDb[_0x9ddc('0x10f')](_0xeea313[_0x9ddc('0x101')]);}if(_0xeea313[_0x9ddc('0xc1')]){rpcDb[_0x9ddc('0x8a')](_0xeea313[_0x9ddc('0x101')]);}_0x57625b[_0x9ddc('0xf3')]='22';this['callProgressDetectingAgent'](_0xeea313,_0x4fbfac,_0x57625b);}else if(_0xeea313&&_0xeea313[_0x9ddc('0x143')]){if(_0x57625b[_0x9ddc('0x13e')]==='16'&&this[_0x9ddc('0x6c')][_0x57625b[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){logger['info'](_0x9ddc('0x144'),_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')],_0x9ddc('0xb7'),_0x4fbfac[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x4fbfac['pTalking']);this[_0x9ddc('0x97')](_0x57625b,_0x57625b['linkedid'],_0x57625b[_0x9ddc('0x13e')]);}else if(this[_0x9ddc('0x6c')][_0x57625b[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){logger[_0x9ddc('0x55')]('[syncHangup][talking][cause]',_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')],_0x9ddc('0xb7'),_0x4fbfac[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x4fbfac['pTalking']);this['callProgressDetectingCustomer'](_0x57625b,_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')]);}}};Preview['prototype'][_0x9ddc('0x1f')]=function(_0x17f8dd){if(this[_0x9ddc('0x6c')][_0x17f8dd[_0x9ddc('0xe9')]]&&_0x17f8dd[_0x9ddc('0xe9')]!==_0x17f8dd[_0x9ddc('0x145')]){this[_0x9ddc('0x97')](_0x17f8dd,_0x17f8dd[_0x9ddc('0xe9')],_0x17f8dd[_0x9ddc('0x146')]);}};Preview[_0x9ddc('0xf')][_0x9ddc('0x1e')]=function(_0x2eda9e){if(this['actions'][_0x2eda9e[_0x9ddc('0xa7')]]&&_0x2eda9e[_0x9ddc('0xa7')]!==_0x2eda9e[_0x9ddc('0xab')]&&!this['actions'][_0x2eda9e[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){if(_0x2eda9e[_0x9ddc('0x13e')]==='1'){this[_0x9ddc('0x97')](_0x2eda9e,_0x2eda9e[_0x9ddc('0xa7')],_0x2eda9e[_0x9ddc('0x13e')]);}}};Preview[_0x9ddc('0xf')]['addVariable']=function(_0x161b1a,_0x2c253c,_0x3df825){if(this['actions'][_0x161b1a]){if(_[_0x9ddc('0x6b')](this[_0x9ddc('0x6c')][_0x161b1a][_0x9ddc('0x147')])){this[_0x9ddc('0x6c')][_0x161b1a][_0x9ddc('0x147')]={};}this[_0x9ddc('0x6c')][_0x161b1a][_0x9ddc('0x147')][_0x2c253c]=_0x3df825;}};Preview['prototype'][_0x9ddc('0x148')]=function(_0x3c02dc){try{if(!_[_0x9ddc('0x6b')](_0x3c02dc)){if(ut[_0x9ddc('0x149')](_[_0x9ddc('0x14a')](_0x3c02dc[_0x9ddc('0x14b')])[0x0])){this[_0x9ddc('0x14c')](_0x3c02dc['uniqueid'],_[_0x9ddc('0x14a')](_0x3c02dc['variable'])[0x0],_0x3c02dc[_0x9ddc('0x14d')]);}}}catch(_0x5a034a){logger['error'](_0x9ddc('0x14e'),util[_0x9ddc('0x14f')](_0x5a034a,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x2eacef){if(_0x2eacef){if(this[_0x9ddc('0x6c')][_0x2eacef[_0x9ddc('0x150')]]){this[_0x9ddc('0x6c')][_0x2eacef[_0x9ddc('0x150')]][_0x9ddc('0x143')]=!![];}}};Preview[_0x9ddc('0xf')][_0x9ddc('0x25')]=function(_0xa43192){if(_0xa43192){if(this[_0x9ddc('0x6c')][_0xa43192['transfererlinkedid']]){this[_0x9ddc('0x6c')][_0xa43192[_0x9ddc('0x151')]]['transfer']=!![];}}};module[_0x9ddc('0x152')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 2996464..cc01c59 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 _0x7dfd=['then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect'];(function(_0x3147a6,_0x781a2a){var _0x517efd=function(_0x58cd1b){while(--_0x58cd1b){_0x3147a6['push'](_0x3147a6['shift']());}};_0x517efd(++_0x781a2a);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xd7df('0x0'));var BPromise=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var _=require(_0xd7df('0x4'));var cmHopper=require(_0xd7df('0x5'));var cmHopperFinal=require(_0xd7df('0x6'));var cmHopperHistory=require(_0xd7df('0x7'));var cmHopperBlack=require(_0xd7df('0x8'));var voiceQueueRt=require(_0xd7df('0x9'));var agentReportPreview=require(_0xd7df('0xa'));var voiceQueueReport=require(_0xd7df('0xb'));function loggerCatch(_0x36cf0f){return function(_0x39ce98){logger[_0xd7df('0xc')](_0x36cf0f,util[_0xd7df('0xd')](_0x39ce98,{'showHidden':![],'depth':null}));};}function create(_0x2c48a4){return BPromise['resolve']()[_0xd7df('0xe')](cmHopperHistory[_0xd7df('0xf')](_0x2c48a4))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x11')));}function createAgent(_0x5e59c3){return BPromise[_0xd7df('0x12')]()['then'](agentReportPreview[_0xd7df('0xf')](_0x5e59c3))['catch'](loggerCatch(_0xd7df('0x11')));}function moveContact(_0x82f1c0){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper[_0xd7df('0x13')](_0x82f1c0,!![]))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x14')));}exports[_0xd7df('0x15')]=function(_0x7ba3c){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopperBlack[_0xd7df('0x15')](_0x7ba3c))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x16')));};exports[_0xd7df('0x17')]=function(_0x202833){return BPromise[_0xd7df('0x12')]()['then'](cmHopper[_0xd7df('0x17')](_0x202833))[_0xd7df('0x10')](loggerCatch('[getContactPreview]\x20'));};exports[_0xd7df('0xf')]=function(_0xbe1c5e,_0x5d3beb){create(_0xbe1c5e)[_0xd7df('0x10')](loggerCatch(_0x5d3beb));moveContact(_0xbe1c5e)[_0xd7df('0x10')](loggerCatch(_0x5d3beb));};exports[_0xd7df('0x18')]=function(_0x5210e5,_0x40167d){createAgent(_0x5210e5)[_0xd7df('0x10')](loggerCatch(_0x40167d));};exports[_0xd7df('0x19')]=function(_0x5ba653,_0x96d86e){create(_0x5ba653)[_0xd7df('0x10')](loggerCatch(_0x96d86e));};exports[_0xd7df('0x1a')]=function(_0x5acb0a,_0x4188af){moveContact(_0x5acb0a)['catch'](loggerCatch(_0x4188af));};exports[_0xd7df('0x1b')]=function(_0x5ab737,_0x3ae7c3,_0x342b54){if(_0x3ae7c3){_0x5ab737[_0xd7df('0x1c')]=null;}if(_0x342b54){_0x5ab737['active']=![];}return BPromise[_0xd7df('0x12')]()['then'](cmHopper[_0xd7df('0x1b')](_0x5ab737))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x1d')));};exports[_0xd7df('0x1e')]=function(_0x1c774b){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper['countReScheduled'](_0x1c774b))['catch'](loggerCatch(_0xd7df('0x1f')));};exports[_0xd7df('0x20')]=function(_0x26047f){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper[_0xd7df('0x20')]({'UserId':null},_0x26047f,0x1))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x21')));};exports[_0xd7df('0x22')]=function(_0x5c4d17){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper[_0xd7df('0x20')]({'active':![]},_0x5c4d17,0x1))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x23')));};exports[_0xd7df('0x24')]=function(_0x3f78fa){var _0x36de76={};_0x36de76['type']=_0x3f78fa['type'];_0x36de76['uniqueid']=_0x3f78fa['uniqueid'];_0x36de76['calleridnum']=_0x3f78fa[_0xd7df('0x25')];_0x36de76['calleridname']=_0x3f78fa[_0xd7df('0x26')];_0x36de76[_0xd7df('0x27')]=_0x3f78fa['queue'];_0x36de76[_0xd7df('0x28')]=_0x3f78fa[_0xd7df('0x29')];_0x36de76['queuecallerleaveAt']=_0x3f78fa[_0xd7df('0x29')];_0x36de76[_0xd7df('0x2a')]=0x1;_0x36de76[_0xd7df('0x2b')]=_0x3f78fa[_0xd7df('0x2c')];_0x36de76[_0xd7df('0x2d')]=_0x3f78fa[_0xd7df('0x2e')];_0x36de76['context']=_0xd7df('0x2f');_0x36de76[_0xd7df('0x30')]=_0xd7df('0x31');_0x36de76[_0xd7df('0x32')]=0x0;_0x36de76[_0xd7df('0x33')]=0x1;_0x36de76[_0xd7df('0x34')]=_0x3f78fa[_0xd7df('0x2e')];_0x36de76[_0xd7df('0x35')]=_0xd7df('0x36');return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](voiceQueueReport['create'](_0x36de76))['catch'](loggerCatch(_0xd7df('0x37')));};exports['getContactRecallMe']=function(_0x2a3bcf,_0xab3dd8){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper['getContactRecallMe'](_0x2a3bcf,_0xab3dd8))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xd7df('0x38')]=function(_0x15e682){return BPromise['resolve']()[_0xd7df('0xe')](cmHopper[_0xd7df('0x1b')](_0x15e682,!![],!![]))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x39')));}; \ No newline at end of file +var _0xb4c7=['createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5b7ec6,_0x19e61f){_0x5b7ec6=_0x5b7ec6-0x0;var _0x13d2ef=_0xb4c7[_0x5b7ec6];return _0x13d2ef;};'use strict';var util=require(_0x7b4c('0x0'));var BPromise=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var _=require(_0x7b4c('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x7b4c('0x5'));var cmHopperHistory=require(_0x7b4c('0x6'));var cmHopperBlack=require(_0x7b4c('0x7'));var voiceQueueRt=require(_0x7b4c('0x8'));var agentReportPreview=require(_0x7b4c('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1b0f57){return function(_0x10e197){logger[_0x7b4c('0xa')](_0x1b0f57,util['inspect'](_0x10e197,{'showHidden':![],'depth':null}));};}function create(_0x2d7b7e){return BPromise[_0x7b4c('0xb')]()['then'](cmHopperHistory[_0x7b4c('0xc')](_0x2d7b7e))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0xe')));}function createAgent(_0x237e28){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](agentReportPreview[_0x7b4c('0xc')](_0x237e28))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0xe')));}function moveContact(_0x2adb51){return BPromise['resolve']()['then'](cmHopper[_0x7b4c('0x10')](_0x2adb51,!![]))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x11')));}exports[_0x7b4c('0x12')]=function(_0x3e1558){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopperBlack[_0x7b4c('0x12')](_0x3e1558))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x13')));};exports['getContactPreview']=function(_0x2edb77){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x14')](_0x2edb77))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x15')));};exports[_0x7b4c('0xc')]=function(_0x22c409,_0x4d3f5e){create(_0x22c409)[_0x7b4c('0xd')](loggerCatch(_0x4d3f5e));moveContact(_0x22c409)[_0x7b4c('0xd')](loggerCatch(_0x4d3f5e));};exports[_0x7b4c('0x16')]=function(_0x36c02a,_0x59ae96){createAgent(_0x36c02a)[_0x7b4c('0xd')](loggerCatch(_0x59ae96));};exports[_0x7b4c('0x17')]=function(_0x32110e,_0x380b79){create(_0x32110e)[_0x7b4c('0xd')](loggerCatch(_0x380b79));};exports[_0x7b4c('0x18')]=function(_0x237110,_0x445281){moveContact(_0x237110)[_0x7b4c('0xd')](loggerCatch(_0x445281));};exports['rescheduleContact']=function(_0x1f06ec,_0x331e24,_0x11996d){if(_0x331e24){_0x1f06ec[_0x7b4c('0x19')]=null;}if(_0x11996d){_0x1f06ec[_0x7b4c('0x1a')]=![];}return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1b')](_0x1f06ec))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x1c')));};exports['countReScheduled']=function(_0x45438c){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1d')](_0x45438c))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x1e')));};exports[_0x7b4c('0x1f')]=function(_0x459eb4){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1f')]({'UserId':null},_0x459eb4,0x1))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x20')));};exports['disableContact']=function(_0x27f361){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1f')]({'active':![]},_0x27f361,0x1))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x21')));};exports[_0x7b4c('0x22')]=function(_0x2552f9){var _0x3e4a46={};_0x3e4a46[_0x7b4c('0x23')]=_0x2552f9[_0x7b4c('0x23')];_0x3e4a46[_0x7b4c('0x24')]=_0x2552f9[_0x7b4c('0x24')];_0x3e4a46[_0x7b4c('0x25')]=_0x2552f9[_0x7b4c('0x25')];_0x3e4a46[_0x7b4c('0x26')]=_0x2552f9[_0x7b4c('0x26')];_0x3e4a46[_0x7b4c('0x27')]=_0x2552f9[_0x7b4c('0x27')];_0x3e4a46['queuecallerjoinAt']=_0x2552f9['answertime'];_0x3e4a46['queuecallerleaveAt']=_0x2552f9[_0x7b4c('0x28')];_0x3e4a46[_0x7b4c('0x29')]=0x1;_0x3e4a46[_0x7b4c('0x2a')]=_0x2552f9[_0x7b4c('0x2b')];_0x3e4a46['connectedlinename']=_0x2552f9[_0x7b4c('0x2c')];_0x3e4a46[_0x7b4c('0x2d')]='from-sip';_0x3e4a46[_0x7b4c('0x2e')]='xcally-motion-preview';_0x3e4a46[_0x7b4c('0x2f')]=0x0;_0x3e4a46[_0x7b4c('0x30')]=0x1;_0x3e4a46[_0x7b4c('0x31')]=_0x2552f9['membername'];_0x3e4a46[_0x7b4c('0x32')]=_0x7b4c('0x33');return BPromise['resolve']()[_0x7b4c('0xf')](voiceQueueReport[_0x7b4c('0x34')](_0x3e4a46))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x35')));};exports['getContactRecallMe']=function(_0x4d0355,_0x1325c1){return BPromise[_0x7b4c('0xb')]()['then'](cmHopper[_0x7b4c('0x36')](_0x4d0355,_0x1325c1))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7b4c('0x37')]=function(_0x16ae89){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper['rescheduleContact'](_0x16ae89,!![],!![]))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x38')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 7e6873b..a191d88 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 _0x032e=['status','push','createBody','ListId','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countglobal','callbackuniqueid','callbackat','recallme','UserId','xmd-voicequeueid','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','endtime','state','statedesc','ringtime','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','\x22%s\x22\x20<%s>','calleridnum','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','decrementTalkink','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','buildAcw','queue','agentReadyId','not_inuse'];(function(_0x224800,_0xb3f614){var _0x455662=function(_0x5bbd8c){while(--_0x5bbd8c){_0x224800['push'](_0x224800['shift']());}};_0x455662(++_0xb3f614);}(_0x032e,0x1cc));var _0xe032=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x032e[_0xbca1b1];return _0x4e1686;};'use strict';var util=require('util');var _=require(_0xe032('0x0'));var moment=require(_0xe032('0x1'));var logger=require(_0xe032('0x2'))(_0xe032('0x3'));var ipAgi=process[_0xe032('0x4')]['XCALLY_IP_AGI']||_0xe032('0x5');function getSeconds(_0x3c0e0a,_0x3d33f8){var _0x15430e=moment(_0x3c0e0a)[_0xe032('0x6')](0x0);var _0x43dc81=moment(_0x3d33f8)[_0xe032('0x6')](0x0);return _0x15430e['diff'](_0x43dc81,_0xe032('0x7'));}exports[_0xe032('0x8')]=function(_0x265677){return function(_0xa36fe0){logger[_0xe032('0x9')](_0x265677,util[_0xe032('0xa')](_0xa36fe0,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x359454,_0xfcdc67){logger[_0xe032('0xb')](_0x359454,util['inspect'](_0xfcdc67,{'showHidden':![],'depth':null}));};exports[_0xe032('0xc')]=function(_0x4d1170,_0x51031a){logger['error'](_0x4d1170,util[_0xe032('0xa')](_0x51031a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3c333b){return function(_0x48555b){logger[_0xe032('0xb')](_0x3c333b,util[_0xe032('0xa')](_0x48555b,{'showHidden':![],'depth':null}));};};exports[_0xe032('0xd')]=function(_0x3164ab,_0x34fd0b,_0x140e56){return{'message':_0x3164ab,'unlock':_0x34fd0b,'active':_0x140e56};};exports[_0xe032('0xe')]=function(_0x1cc0bb,_0x1bf9e3,_0xec005){if(!_[_0xe032('0xf')](_0xec005)&&_0xe032('0x10')===typeof _0xec005&&!_[_0xe032('0x11')](_0xec005)){if(!_[_0xe032('0xf')](_0x1bf9e3)&&_0xe032('0x10')===typeof _0x1bf9e3&&!_[_0xe032('0x11')](_0x1bf9e3)){return util['format']('\x22%s\x22\x20<%s>',_0x1bf9e3,_0xec005);}return util[_0xe032('0x12')]('\x22%s\x22\x20<%s>',_0xec005,_0xec005);}if(!_[_0xe032('0xf')](_0x1cc0bb)&&_0xe032('0x10')===typeof _0x1cc0bb&&!_[_0xe032('0x11')](_0x1cc0bb)){return _0x1cc0bb;}return _0xe032('0x13');};exports[_0xe032('0x14')]=function(_0x3ca2d0){if(_[_0xe032('0x15')](_0x3ca2d0)){return![];}return _0x3ca2d0;};exports[_0xe032('0x16')]=function(_0x1a6281,_0x4db18c,_0x31496e,_0x230656,_0x35093e,_0x3930a3){var _0x1a159d={'XMD-QUEUE':_0x4db18c[_0xe032('0x17')]?_0x4db18c[_0xe032('0x17')][_0xe032('0x18')]:'','XMD-CALLERID':_0x230656,'XMD-CALLERID-PREVIEW':_0x3930a3?util[_0xe032('0x12')]('\x22%s\x22\x20<%s>',_0x3930a3[_0xe032('0x19')],_0x3930a3['calleridnum']):_0x230656,'XMD-DIALID':_0x35093e,'XMD-CONTACTID':_0x4db18c[_0xe032('0x1a')],'XMD-CDRTYPE':_0xe032('0x1b'),'CALLERID(all)':_0x230656,'XMD-VOICEQUEUEID':_0x4db18c[_0xe032('0x1c')],'XMD-DIALCHANNEL':_0x31496e,'XMD-DIALTIMEOUT':_0x1a6281[_0xe032('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xe032('0x12')](_0xe032('0x1e'),_0x1a6281[_0xe032('0x1f')]?'g':'',_[_0xe032('0x11')](_0x1a6281['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1a6281[_0xe032('0x20')]||'','XMD-AGI':_0x1a6281[_0xe032('0x21')]?util[_0xe032('0x12')](_0xe032('0x22'),ipAgi,_0x1a6281[_0xe032('0x21')]):'NONE','XMD-AGIAFTER':_0x1a6281[_0xe032('0x1f')]?util[_0xe032('0x12')](_0xe032('0x22'),ipAgi,_0x1a6281['dialQueueProject2']):_0xe032('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x3930a3?_0x3930a3['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3930a3?_0x3930a3[_0xe032('0x24')]:'','XMD-DESTINATION':_0xe032('0x25')};if(!_[_0xe032('0x11')](_0x1a6281[_0xe032('0x26')])){_0x1a159d[util['format']('%s',_0xe032('0x27'))]=_0x1a6281['monitor_format'];_0x1a159d[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x35093e;}if(_0x4db18c&&_0x4db18c['Contact']){for(var _0x597b4c in _0x4db18c[_0xe032('0x28')]){if(_0x4db18c[_0xe032('0x28')][_0xe032('0x29')](_0x597b4c)){if(!_['isNil'](_0x4db18c['Contact'][_0x597b4c])&&_0x597b4c!=='id'&&_0x597b4c!==_0xe032('0x2a')&&_0x597b4c!==_0xe032('0x2b')&&_0x597b4c!==_0xe032('0x2c')){_0x1a159d[util[_0xe032('0x12')](_0xe032('0x2d'),_0xe032('0x2e'),_[_0xe032('0x2f')](_0x597b4c))]=_0x4db18c[_0xe032('0x28')][_0x597b4c];}}}}return _0x1a159d;};exports[_0xe032('0x30')]=function(_0x5d58de){var _0x4b3085={};for(var _0x162971 in _0x5d58de){if(_0x5d58de[_0xe032('0x29')](_0x162971)){_0x4b3085[util['format']('%s',_[_0xe032('0x31')](_0x162971))]=_0x5d58de[_0x162971];}}return{'variables':_0x4b3085};};exports[_0xe032('0x32')]=function(_0x11cfe7,_0x15691e){if(!_[_0xe032('0x15')](_0x11cfe7)){if(_0x11cfe7[_0xe032('0x29')](_0xe032('0x33'))){if(_0x11cfe7[_0xe032('0x33')]>0x0){_0x11cfe7[_0xe032('0x33')]-=0x1;}else{logger['error'](_0xe032('0x34'),_0x15691e);}}}else{logger[_0xe032('0x9')](_0xe032('0x35'),_0x15691e);}};exports[_0xe032('0x36')]=function(_0x5fc8b2){var _0x361bde=moment()[_0xe032('0x12')](_0xe032('0x37'));_0x5fc8b2['state']=0xd;_0x5fc8b2['statedesc']=_0xe032('0x38');_0x5fc8b2[_0xe032('0x39')]=_0x361bde;_0x5fc8b2[_0xe032('0x3a')]=_0x361bde;_0x5fc8b2[_0xe032('0x3b')]=_0x361bde;};exports['logAgent']=function(_0x32da10,_0x26fdac,_0x33807d){var _0x98d40c=moment()[_0xe032('0x12')](_0xe032('0x37'));_0x32da10[_0xe032('0x3c')]=_0x26fdac;_0x32da10[_0xe032('0x3d')]=_0x33807d;_0x32da10['responsetime']=_0x98d40c;_0x32da10[_0xe032('0x3e')]=getSeconds(_0x32da10['responsetime'],_0x32da10[_0xe032('0x39')]);};exports[_0xe032('0x3f')]=function(_0x13c3fd,_0x3fbca0,_0x2eb047){_0x13c3fd[_0xe032('0x40')]=_0x3fbca0;_0x13c3fd['UserId']=_0x2eb047;};exports[_0xe032('0x41')]=function(_0x51f196,_0x5cb79c,_0x315dc3){var _0x538d68=moment()[_0xe032('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x51f196['state']=_0x5cb79c;_0x51f196['statedesc']=_0x315dc3;_0x51f196[_0xe032('0x3a')]=_0x51f196[_0xe032('0x3a')]?_0x51f196[_0xe032('0x3a')]:_0x538d68;_0x51f196[_0xe032('0x3b')]=_0x51f196[_0xe032('0x3b')]?_0x51f196[_0xe032('0x3b')]:_0x538d68;_0x51f196[_0xe032('0x3e')]=getSeconds(_0x51f196[_0xe032('0x3a')]||0x0,_0x51f196[_0xe032('0x39')]||0x0);_0x51f196[_0xe032('0x42')]=_0x51f196[_0xe032('0x43')]?getSeconds(_0x51f196[_0xe032('0x3b')],_0x51f196[_0xe032('0x43')]):0x0;};exports[_0xe032('0x44')]=function(_0x2ab67d){return _0x2ab67d===_0xe032('0x45');};exports['variablesAction']=function(_0x55bea2,_0x311647,_0x290ecd,_0xf0513f,_0x39f559){var _0x393414=_0xf0513f?_0xe032('0x46'):_0x55bea2['calleridname'];_0x393414=_0x39f559?_0xe032('0x47'):_0x393414;return{'actionid':_0x55bea2[_0xe032('0x48')],'action':_0xe032('0x49'),'channel':_0x55bea2[_0xe032('0x4a')],'callerid':util[_0xe032('0x12')](_0xe032('0x4b'),_0x393414,_0x55bea2[_0xe032('0x4c')]),'Exten':_0xe032('0x25'),'Context':'from-sip','Priority':'1','variable':_0x290ecd,'timeout':(_0x311647['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x55bea2['uniqueid']};};exports[_0xe032('0x4d')]=function(_0x56015b){return _0x56015b[_0xe032('0x4e')]+_0x56015b[_0xe032('0x4f')]+_0x56015b[_0xe032('0x50')]+_0x56015b[_0xe032('0x51')]+_0x56015b[_0xe032('0x52')];};exports[_0xe032('0x53')]=function(_0x5cecec){var _0x1b8960=_[_0xe032('0x54')](_0x5cecec);_0x1b8960[_0xe032('0x3c')]=0xf;_0x1b8960[_0xe032('0x3d')]=_0xe032('0x55');return _0x1b8960;};exports['scheduledAt']=function(_0x523c92,_0x31fd6a,_0x28e919){var _0x23b656={};_0x23b656[_0x31fd6a]=_0x523c92[_0x31fd6a];_0x23b656[_0xe032('0x56')]=![];_0x23b656[_0xe032('0x57')]=moment()[_0xe032('0x58')](_0x28e919,_0xe032('0x59'))[_0xe032('0x12')](_0xe032('0x37'));_0x23b656['ContactId']=_0x523c92[_0xe032('0x1a')];_0x23b656['ListId']=_0x523c92['ListId'];_0x23b656['VoiceQueueId']=_0x523c92[_0xe032('0x1c')]||undefined;return _0x23b656;};exports[_0xe032('0x5a')]=function(_0x23f067,_0x5500d3){if(!_[_0xe032('0x15')](_0x23f067)){if(_0x23f067['pTalking']>0x0){_0x23f067['pTalking']-=0x1;}else{logger['error'](_0x5500d3,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xe032('0x9')](_0x5500d3,_0xe032('0x5b'));}};exports[_0xe032('0x5c')]=function(_0x4c2dae){if(_0x4c2dae<=0x0){return!![];}return![];};exports[_0xe032('0x5d')]=function(_0x51dd18,_0x2701f2){_0x51dd18[_0xe032('0x5e')]=_0x2701f2;_0x51dd18['name']=_0x51dd18['queue'];_0x51dd18[_0xe032('0x5f')]=_0x51dd18[_0xe032('0x4a')];return _0x51dd18;};exports[_0xe032('0x60')]=function(_0x13cb92){var _0x500df9={};_0x500df9[_0xe032('0x61')]=_0x13cb92[_0xe032('0x61')];_0x500df9[_0xe032('0x5f')]=_0x13cb92[_0xe032('0x4a')];_0x500df9['uniqueid']=_0x13cb92[_0xe032('0x48')];return _0x500df9;};exports[_0xe032('0x62')]=function(_0x3dc30d){var _0x225853=[];for(var _0x5abeba in _0x3dc30d){if(_0x3dc30d['hasOwnProperty'](_0x5abeba)){if(!_['isNil'](_0x3dc30d[_0x5abeba])&&_0x3dc30d[_0x5abeba]['state']===_0xe032('0x63')&&_0x3dc30d[_0x5abeba][_0xe032('0x64')]==='reachable'){_0x225853[_0xe032('0x65')](_0x3dc30d[_0x5abeba]['id']);}}}return _0x225853;};exports['getDiff']=function(_0x349d77){var _0x18e260=moment()[_0xe032('0x6')](0x0);var _0x908f0a=moment(_0x349d77)[_0xe032('0x6')](0x0);return _0x18e260['diff'](_0x908f0a,_0xe032('0x7'));};exports[_0xe032('0x66')]=function(_0x38a931){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x38a931[_0xe032('0x1a')],'ListId':_0x38a931[_0xe032('0x67')],'VoiceQueueId':_0x38a931[_0xe032('0x1c')]||undefined,'CampaignId':_0x38a931[_0xe032('0x68')]||undefined};};exports[_0xe032('0x69')]=function(_0x5cf6ad){if(_0x5cf6ad===_0xe032('0x48')||_0x5cf6ad===_0xe032('0x6a')||_0x5cf6ad===_0xe032('0x61')||_0x5cf6ad==='type'||_0x5cf6ad===_0xe032('0x6b')||_0x5cf6ad===_0xe032('0x6c')||_0x5cf6ad===_0xe032('0x40')||_0x5cf6ad===_0xe032('0x4a')||_0x5cf6ad===_0xe032('0x19')||_0x5cf6ad===_0xe032('0x56')||_0x5cf6ad===_0xe032('0x4c')||_0x5cf6ad==='scheduledat'||_0x5cf6ad==='countbusyretry'||_0x5cf6ad===_0xe032('0x4f')||_0x5cf6ad===_0xe032('0x50')||_0x5cf6ad===_0xe032('0x6d')||_0x5cf6ad==='callback'||_0x5cf6ad===_0xe032('0x6e')||_0x5cf6ad===_0xe032('0x6f')||_0x5cf6ad===_0xe032('0x70')||_0x5cf6ad==='ContactId'||_0x5cf6ad===_0xe032('0x67')||_0x5cf6ad===_0xe032('0x71')||_0x5cf6ad==='VoiceQueueId'||_0x5cf6ad==='sipcallid'||_0x5cf6ad===_0xe032('0x72')||_0x5cf6ad==='xmd-queue'||_0x5cf6ad==='xmd-phone'||_0x5cf6ad===_0xe032('0x73')||_0x5cf6ad==='xmd-dialurl'||_0x5cf6ad==='xmd-dialtimeout'||_0x5cf6ad===_0xe032('0x74')||_0x5cf6ad===_0xe032('0x75')||_0x5cf6ad==='xmd-dialchannel'||_0x5cf6ad==='xmd-contactid'||_0x5cf6ad===_0xe032('0x76')||_0x5cf6ad===_0xe032('0x77')||_0x5cf6ad===_0xe032('0x78')||_0x5cf6ad===_0xe032('0x79')||_0x5cf6ad==='rtpaudioqos'||_0x5cf6ad==='rtpaudioqosbridged'||_0x5cf6ad===_0xe032('0x7a')||_0x5cf6ad===_0xe032('0x7b')||_0x5cf6ad===_0xe032('0x7c')||_0x5cf6ad==='rtpaudioqoslossbridged'||_0x5cf6ad===_0xe032('0x7d')||_0x5cf6ad===_0xe032('0x7e')||_0x5cf6ad===_0xe032('0x7f')||_0x5cf6ad===_0xe032('0x80')||_0x5cf6ad==='rtpaudioqosjitter'||_0x5cf6ad===_0xe032('0x7b')||_0x5cf6ad===_0xe032('0x7c')||_0x5cf6ad===_0xe032('0x81')||_0x5cf6ad===_0xe032('0x7d')||_0x5cf6ad===_0xe032('0x7e')||_0x5cf6ad===_0xe032('0x82')||_0x5cf6ad===_0xe032('0x83')||_0x5cf6ad===_0xe032('0x3c')||_0x5cf6ad==='statedesc'){return![];}return!![];};exports[_0xe032('0x84')]=function(_0x4955a6,_0x155bf){var _0x180468,_0x33b92e,_0x3955ae;if(_0x155bf<=0x0){_0x155bf=0x1;}_0x180468=new RegExp(_0xe032('0x85')+_0x155bf+'}$');_0x33b92e=Math['pow'](0xa,_0x155bf-0x1);_0x3955ae=Math[_0xe032('0x86')](0xa,_0x155bf)-0x1;return util[_0xe032('0x12')]('%s',_[_0xe032('0x87')](_0x4955a6,_0x180468,_[_0xe032('0x88')](_0x33b92e,_0x3955ae)));};exports[_0xe032('0x89')]=function(_0x3d9aa7){var _0x140d43=_0x3d9aa7[_0xe032('0x8a')](/"(.*?)"/);return _0x140d43?_0x140d43[0x1]:_0x3d9aa7;};exports[_0xe032('0x8b')]=function(_0x533f6a){var _0x39005f=_0x533f6a[_0xe032('0x8a')](/<(.*?)>/);return _0x39005f?_0x39005f[0x1]:_0x533f6a;}; \ No newline at end of file +var _0x4201=['calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','ringtime','responsetime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','RECALL','BOOKED','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','queue','buildAcw','interface','uniqueid','agentReadyId','status','reachable','push','getDiff','ListId','CampaignId','filterKey','type','campaigntype','countglobal','callback','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','logger','info','inspect','logger2','getCallerId','isUndefined','format','\x22%s\x22\x20<%s>','string','isEmpty','\x22\x22\x20<>','isNil','addVariables','Queue','name'];(function(_0x487d93,_0x1443b2){var _0xa6ba2a=function(_0x6dfbb9){while(--_0x6dfbb9){_0x487d93['push'](_0x487d93['shift']());}};_0xa6ba2a(++_0x1443b2);}(_0x4201,0x71));var _0x1420=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x4201[_0x31a576];return _0x30b1d3;};'use strict';var util=require(_0x1420('0x0'));var _=require(_0x1420('0x1'));var moment=require('moment');var logger=require(_0x1420('0x2'))(_0x1420('0x3'));var ipAgi=process[_0x1420('0x4')][_0x1420('0x5')]||_0x1420('0x6');function getSeconds(_0x43d008,_0x59088c){var _0x485039=moment(_0x43d008)[_0x1420('0x7')](0x0);var _0x25590c=moment(_0x59088c)[_0x1420('0x7')](0x0);return _0x485039[_0x1420('0x8')](_0x25590c,_0x1420('0x9'));}exports['loggerCatch']=function(_0x5a925c){return function(_0x46d303){logger[_0x1420('0xa')](_0x5a925c,util['inspect'](_0x46d303,{'showHidden':![],'depth':null}));};};exports[_0x1420('0xb')]=function(_0x53199d,_0x4d8d95){logger[_0x1420('0xc')](_0x53199d,util[_0x1420('0xd')](_0x4d8d95,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x351778,_0x1a05fd){logger[_0x1420('0xa')](_0x351778,util[_0x1420('0xd')](_0x1a05fd,{'showHidden':![],'depth':null}));};exports[_0x1420('0xe')]=function(_0x1d1041){return function(_0x2435f4){logger[_0x1420('0xc')](_0x1d1041,util['inspect'](_0x2435f4,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x50cf50,_0x53c03d,_0x466d30){return{'message':_0x50cf50,'unlock':_0x53c03d,'active':_0x466d30};};exports[_0x1420('0xf')]=function(_0x121f70,_0x3b8e01,_0x3bc499){if(!_[_0x1420('0x10')](_0x3bc499)&&'string'===typeof _0x3bc499&&!_['isEmpty'](_0x3bc499)){if(!_[_0x1420('0x10')](_0x3b8e01)&&'string'===typeof _0x3b8e01&&!_['isEmpty'](_0x3b8e01)){return util[_0x1420('0x11')](_0x1420('0x12'),_0x3b8e01,_0x3bc499);}return util[_0x1420('0x11')](_0x1420('0x12'),_0x3bc499,_0x3bc499);}if(!_['isUndefined'](_0x121f70)&&_0x1420('0x13')===typeof _0x121f70&&!_[_0x1420('0x14')](_0x121f70)){return _0x121f70;}return _0x1420('0x15');};exports['isActive']=function(_0x261589){if(_[_0x1420('0x16')](_0x261589)){return![];}return _0x261589;};exports[_0x1420('0x17')]=function(_0x310454,_0x4f3c6b,_0x5535c0,_0x410abb,_0x5c6237,_0x278e77){var _0x3ca369={'XMD-QUEUE':_0x4f3c6b[_0x1420('0x18')]?_0x4f3c6b[_0x1420('0x18')][_0x1420('0x19')]:'','XMD-CALLERID':_0x410abb,'XMD-CALLERID-PREVIEW':_0x278e77?util['format'](_0x1420('0x12'),_0x278e77[_0x1420('0x1a')],_0x278e77[_0x1420('0x1b')]):_0x410abb,'XMD-DIALID':_0x5c6237,'XMD-CONTACTID':_0x4f3c6b[_0x1420('0x1c')],'XMD-CDRTYPE':_0x1420('0x1d'),'CALLERID(all)':_0x410abb,'XMD-VOICEQUEUEID':_0x4f3c6b[_0x1420('0x1e')],'XMD-DIALCHANNEL':_0x5535c0,'XMD-DIALTIMEOUT':_0x310454['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x310454[_0x1420('0x1f')]?'g':'',_[_0x1420('0x14')](_0x310454[_0x1420('0x20')])?'':_0x1420('0x21')),'XMD-DIALURL':_0x310454[_0x1420('0x22')]||'','XMD-AGI':_0x310454['dialQueueProject']?util['format'](_0x1420('0x23'),ipAgi,_0x310454[_0x1420('0x24')]):_0x1420('0x25'),'XMD-AGIAFTER':_0x310454[_0x1420('0x1f')]?util[_0x1420('0x11')](_0x1420('0x23'),ipAgi,_0x310454['dialQueueProject2']):_0x1420('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x278e77?_0x278e77[_0x1420('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x278e77?_0x278e77[_0x1420('0x27')]:'','XMD-DESTINATION':_0x1420('0x28')};if(!_['isEmpty'](_0x310454[_0x1420('0x20')])){_0x3ca369[util[_0x1420('0x11')]('%s',_0x1420('0x29'))]=_0x310454[_0x1420('0x20')];_0x3ca369[util['format']('%s',_0x1420('0x2a'))]=_0x5c6237;}if(_0x4f3c6b&&_0x4f3c6b[_0x1420('0x2b')]){for(var _0x8c3e84 in _0x4f3c6b[_0x1420('0x2b')]){if(_0x4f3c6b[_0x1420('0x2b')][_0x1420('0x2c')](_0x8c3e84)){if(!_[_0x1420('0x16')](_0x4f3c6b[_0x1420('0x2b')][_0x8c3e84])&&_0x8c3e84!=='id'&&_0x8c3e84!==_0x1420('0x2d')&&_0x8c3e84!==_0x1420('0x2e')&&_0x8c3e84!==_0x1420('0x2f')){_0x3ca369[util[_0x1420('0x11')]('%s%s',_0x1420('0x30'),_[_0x1420('0x31')](_0x8c3e84))]=_0x4f3c6b[_0x1420('0x2b')][_0x8c3e84];}}}}return _0x3ca369;};exports[_0x1420('0x32')]=function(_0x17873d){var _0x584f11={};for(var _0x2a812b in _0x17873d){if(_0x17873d[_0x1420('0x2c')](_0x2a812b)){_0x584f11[util['format']('%s',_[_0x1420('0x33')](_0x2a812b))]=_0x17873d[_0x2a812b];}}return{'variables':_0x584f11};};exports['updateOriginated']=function(_0x5a5066,_0x481ede){if(!_[_0x1420('0x16')](_0x5a5066)){if(_0x5a5066[_0x1420('0x2c')](_0x1420('0x34'))){if(_0x5a5066[_0x1420('0x34')]>0x0){_0x5a5066[_0x1420('0x34')]-=0x1;}else{logger[_0x1420('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x481ede);}}}else{logger[_0x1420('0xa')](_0x1420('0x35'),_0x481ede);}};exports['logBlacklist']=function(_0x940f8f){var _0x93bf5f=moment()[_0x1420('0x11')](_0x1420('0x36'));_0x940f8f[_0x1420('0x37')]=0xd;_0x940f8f[_0x1420('0x38')]=_0x1420('0x39');_0x940f8f[_0x1420('0x3a')]=_0x93bf5f;_0x940f8f['responsetime']=_0x93bf5f;_0x940f8f[_0x1420('0x3b')]=_0x93bf5f;};exports[_0x1420('0x3c')]=function(_0x3cddad,_0x156d15,_0x3b6f53){var _0x5c2cd4=moment()[_0x1420('0x11')](_0x1420('0x36'));_0x3cddad[_0x1420('0x37')]=_0x156d15;_0x3cddad[_0x1420('0x38')]=_0x3b6f53;_0x3cddad['responsetime']=_0x5c2cd4;_0x3cddad[_0x1420('0x3d')]=getSeconds(_0x3cddad[_0x1420('0x3e')],_0x3cddad[_0x1420('0x3a')]);};exports[_0x1420('0x3f')]=function(_0x1a9a6a,_0x5e88f5,_0x4e6f7c){_0x1a9a6a[_0x1420('0x40')]=_0x5e88f5;_0x1a9a6a[_0x1420('0x41')]=_0x4e6f7c;};exports[_0x1420('0x42')]=function(_0x29b19f,_0x52e8e1,_0x12e2eb){var _0x4d0957=moment()[_0x1420('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x29b19f['state']=_0x52e8e1;_0x29b19f[_0x1420('0x38')]=_0x12e2eb;_0x29b19f['responsetime']=_0x29b19f['responsetime']?_0x29b19f[_0x1420('0x3e')]:_0x4d0957;_0x29b19f[_0x1420('0x3b')]=_0x29b19f[_0x1420('0x3b')]?_0x29b19f['endtime']:_0x4d0957;_0x29b19f[_0x1420('0x3d')]=getSeconds(_0x29b19f['responsetime']||0x0,_0x29b19f['starttime']||0x0);_0x29b19f[_0x1420('0x43')]=_0x29b19f[_0x1420('0x44')]?getSeconds(_0x29b19f[_0x1420('0x3b')],_0x29b19f['answertime']):0x0;};exports['isFailure']=function(_0x2f2f77){return _0x2f2f77===_0x1420('0x45');};exports['variablesAction']=function(_0x315bfb,_0x2bbd5e,_0x20a2df,_0x1441e1,_0x4e5cb6){var _0x3ecee5=_0x1441e1?_0x1420('0x46'):_0x315bfb[_0x1420('0x1a')];_0x3ecee5=_0x4e5cb6?_0x1420('0x47'):_0x3ecee5;return{'actionid':_0x315bfb['uniqueid'],'action':_0x1420('0x48'),'channel':_0x315bfb[_0x1420('0x49')],'callerid':util[_0x1420('0x11')]('\x22%s\x22\x20<%s>',_0x3ecee5,_0x315bfb['calleridnum']),'Exten':_0x1420('0x28'),'Context':_0x1420('0x4a'),'Priority':'1','variable':_0x20a2df,'timeout':(_0x2bbd5e['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x315bfb['uniqueid']};};exports[_0x1420('0x4b')]=function(_0x211936){return _0x211936[_0x1420('0x4c')]+_0x211936[_0x1420('0x4d')]+_0x211936[_0x1420('0x4e')]+_0x211936['countagentrejectretry']+_0x211936[_0x1420('0x4f')];};exports[_0x1420('0x50')]=function(_0x2c7542){var _0x45f824=_[_0x1420('0x51')](_0x2c7542);_0x45f824['state']=0xf;_0x45f824[_0x1420('0x38')]=_0x1420('0x52');return _0x45f824;};exports[_0x1420('0x53')]=function(_0x2ee8c5,_0xaae370,_0x5f2106){var _0x5a2bcd={};_0x5a2bcd[_0xaae370]=_0x2ee8c5[_0xaae370];_0x5a2bcd[_0x1420('0x54')]=![];_0x5a2bcd[_0x1420('0x55')]=moment()[_0x1420('0x56')](_0x5f2106,_0x1420('0x57'))[_0x1420('0x11')](_0x1420('0x36'));_0x5a2bcd[_0x1420('0x1c')]=_0x2ee8c5[_0x1420('0x1c')];_0x5a2bcd['ListId']=_0x2ee8c5['ListId'];_0x5a2bcd[_0x1420('0x1e')]=_0x2ee8c5[_0x1420('0x1e')]||undefined;return _0x5a2bcd;};exports[_0x1420('0x58')]=function(_0x435d38,_0x2aa561){if(!_[_0x1420('0x16')](_0x435d38)){if(_0x435d38[_0x1420('0x59')]>0x0){_0x435d38[_0x1420('0x59')]-=0x1;}else{logger[_0x1420('0xa')](_0x2aa561,_0x1420('0x5a'));}}else{logger[_0x1420('0xa')](_0x2aa561,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x1420('0x5b')]=function(_0x25370e){if(_0x25370e<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1a4c5f,_0x2c5d62){_0x1a4c5f['lastevent']=_0x2c5d62;_0x1a4c5f[_0x1420('0x19')]=_0x1a4c5f[_0x1420('0x5c')];_0x1a4c5f['interface']=_0x1a4c5f['channelAgent'];return _0x1a4c5f;};exports[_0x1420('0x5d')]=function(_0x53672d){var _0x593de1={};_0x593de1[_0x1420('0x5c')]=_0x53672d[_0x1420('0x5c')];_0x593de1[_0x1420('0x5e')]=_0x53672d[_0x1420('0x49')];_0x593de1[_0x1420('0x5f')]=_0x53672d[_0x1420('0x5f')];return _0x593de1;};exports[_0x1420('0x60')]=function(_0x16426a){var _0x376768=[];for(var _0x784190 in _0x16426a){if(_0x16426a[_0x1420('0x2c')](_0x784190)){if(!_[_0x1420('0x16')](_0x16426a[_0x784190])&&_0x16426a[_0x784190]['state']==='not_inuse'&&_0x16426a[_0x784190][_0x1420('0x61')]===_0x1420('0x62')){_0x376768[_0x1420('0x63')](_0x16426a[_0x784190]['id']);}}}return _0x376768;};exports[_0x1420('0x64')]=function(_0x508ec9){var _0x184d63=moment()[_0x1420('0x7')](0x0);var _0x15f539=moment(_0x508ec9)[_0x1420('0x7')](0x0);return _0x184d63[_0x1420('0x8')](_0x15f539,'seconds');};exports['createBody']=function(_0x5ca065){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5ca065[_0x1420('0x1c')],'ListId':_0x5ca065[_0x1420('0x65')],'VoiceQueueId':_0x5ca065[_0x1420('0x1e')]||undefined,'CampaignId':_0x5ca065[_0x1420('0x66')]||undefined};};exports[_0x1420('0x67')]=function(_0x355c5c){if(_0x355c5c===_0x1420('0x5f')||_0x355c5c==='idContact'||_0x355c5c===_0x1420('0x5c')||_0x355c5c===_0x1420('0x68')||_0x355c5c===_0x1420('0x69')||_0x355c5c==='dialAnswer'||_0x355c5c===_0x1420('0x40')||_0x355c5c===_0x1420('0x49')||_0x355c5c===_0x1420('0x1a')||_0x355c5c===_0x1420('0x54')||_0x355c5c==='calleridnum'||_0x355c5c===_0x1420('0x55')||_0x355c5c===_0x1420('0x4c')||_0x355c5c===_0x1420('0x4d')||_0x355c5c==='countnoanswerretry'||_0x355c5c===_0x1420('0x6a')||_0x355c5c===_0x1420('0x6b')||_0x355c5c==='callbackuniqueid'||_0x355c5c===_0x1420('0x6c')||_0x355c5c===_0x1420('0x6d')||_0x355c5c===_0x1420('0x1c')||_0x355c5c==='ListId'||_0x355c5c===_0x1420('0x41')||_0x355c5c==='VoiceQueueId'||_0x355c5c===_0x1420('0x6e')||_0x355c5c==='xmd-voicequeueid'||_0x355c5c===_0x1420('0x6f')||_0x355c5c===_0x1420('0x70')||_0x355c5c===_0x1420('0x71')||_0x355c5c===_0x1420('0x72')||_0x355c5c===_0x1420('0x73')||_0x355c5c===_0x1420('0x74')||_0x355c5c==='xmd-dialid'||_0x355c5c===_0x1420('0x75')||_0x355c5c===_0x1420('0x76')||_0x355c5c===_0x1420('0x77')||_0x355c5c===_0x1420('0x78')||_0x355c5c===_0x1420('0x79')||_0x355c5c==='xmd-agi'||_0x355c5c===_0x1420('0x7a')||_0x355c5c===_0x1420('0x7b')||_0x355c5c===_0x1420('0x7c')||_0x355c5c==='rtpaudioqosjitterbridged'||_0x355c5c===_0x1420('0x7d')||_0x355c5c===_0x1420('0x7e')||_0x355c5c===_0x1420('0x7f')||_0x355c5c===_0x1420('0x80')||_0x355c5c==='rtpaudioqos'||_0x355c5c===_0x1420('0x7b')||_0x355c5c===_0x1420('0x7c')||_0x355c5c==='rtpaudioqosjitterbridged'||_0x355c5c==='rtpaudioqosloss'||_0x355c5c==='rtpaudioqoslossbridged'||_0x355c5c===_0x1420('0x7f')||_0x355c5c===_0x1420('0x80')||_0x355c5c===_0x1420('0x81')||_0x355c5c===_0x1420('0x82')||_0x355c5c===_0x1420('0x37')||_0x355c5c===_0x1420('0x38')){return![];}return!![];};exports[_0x1420('0x83')]=function(_0xa191f0,_0x2ae692){var _0x4eccb3,_0x5f1a2a,_0x274c02;if(_0x2ae692<=0x0){_0x2ae692=0x1;}_0x4eccb3=new RegExp(_0x1420('0x84')+_0x2ae692+'}$');_0x5f1a2a=Math[_0x1420('0x85')](0xa,_0x2ae692-0x1);_0x274c02=Math['pow'](0xa,_0x2ae692)-0x1;return util[_0x1420('0x11')]('%s',_[_0x1420('0x86')](_0xa191f0,_0x4eccb3,_[_0x1420('0x87')](_0x5f1a2a,_0x274c02)));};exports[_0x1420('0x88')]=function(_0x518214){var _0x744dc4=_0x518214['match'](/"(.*?)"/);return _0x744dc4?_0x744dc4[0x1]:_0x518214;};exports[_0x1420('0x89')]=function(_0x2a5dbd){var _0x84f03=_0x2a5dbd[_0x1420('0x8a')](/<(.*?)>/);return _0x84f03?_0x84f03[0x1]:_0x2a5dbd;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index aae8361..960bcec 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x8207e,_0x374d8c){var _0x2bc725=function(_0x4f75a8){while(--_0x4f75a8){_0x8207e['push'](_0x8207e['shift']());}};_0x2bc725(++_0x374d8c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x15891c,_0x19013f){_0x15891c=_0x15891c-0x0;var _0x578f6d=_0x5f2f[_0x15891c];return _0x578f6d;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x5685fc,_0x4a57c8){var _0x3a68a1=function(_0x151705){while(--_0x151705){_0x5685fc['push'](_0x5685fc['shift']());}};_0x3a68a1(++_0x4a57c8);}(_0xb10b,0x12a));var _0xbb10=function(_0x4257b6,_0x2348c7){_0x4257b6=_0x4257b6-0x0;var _0x4ad68c=_0xb10b[_0x4257b6];return _0x4ad68c;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d2c482c..7070c62 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 _0x365a=['zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','name','mapKeys','isNil','interface','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','telephones','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','uniqueid','queue','queuecallerexit','unmanaged','diff','seconds','queuecallerexitAt','queuecallercomplete','sumBillable','queuecallerleaveAt','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','bluebird','util','lodash','moment','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers'];(function(_0x3b5915,_0x50ac3c){var _0x19525d=function(_0x1beba5){while(--_0x1beba5){_0x3b5915['push'](_0x3b5915['shift']());}};_0x19525d(++_0x50ac3c);}(_0x365a,0x18d));var _0xa365=function(_0x1e8f52,_0x2254f3){_0x1e8f52=_0x1e8f52-0x0;var _0x1750b5=_0x365a[_0x1e8f52];return _0x1750b5;};'use strict';var BPromise=require(_0xa365('0x0'));var util=require(_0xa365('0x1'));var _=require(_0xa365('0x2'));var moment=require(_0xa365('0x3'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0xa365('0x4'));var VoiceQueue=require(_0xa365('0x5'));var Trigger=require('../model/trigger');var Template=require(_0xa365('0x6'));var Campaign=require(_0xa365('0x7'));var VoiceExtension=require(_0xa365('0x8'));var ZendeskAccount=require(_0xa365('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa365('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa365('0xb'));var VtigerAccount=require(_0xa365('0xc'));var ServicenowAccount=require(_0xa365('0xd'));var Dynamics365Account=require(_0xa365('0xe'));var FreshsalesAccount=require(_0xa365('0xf'));var FaxAccount=require(_0xa365('0x10'));var Realtime=function(){this[_0xa365('0x11')]={};this['telephones']={};this['trunks']={};this[_0xa365('0x12')]={};this[_0xa365('0x13')]={};this[_0xa365('0x14')]={};this[_0xa365('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa365('0x16')]={};this[_0xa365('0x17')]={};this[_0xa365('0x18')]={};this[_0xa365('0x19')]={};this[_0xa365('0x1a')]={};this[_0xa365('0x1b')]={};this[_0xa365('0x1c')]={};this[_0xa365('0x1d')]={};this[_0xa365('0x1e')]={};this['zohoAccounts']={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0xa365('0x1f')]={};this['dynamics365Accounts']={};this[_0xa365('0x20')]={};this[_0xa365('0x21')]={};};function freeIsNotKey(_0x5c09fc,_0x30fc1d,_0x5b0d0f){var _0x1d667d=_['mapKeys'](_0x5c09fc,function(_0xf235ce,_0x38beb3){return _0xf235ce[_0x5b0d0f];});for(var _0x5e823e in _0x30fc1d){if(_0x30fc1d[_0xa365('0x22')](_0x5e823e)){if(!_0x1d667d[_0x5e823e]){delete _0x30fc1d[_0x5e823e];}}}}function freeIsNotKeySip(_0x127efd,_0x193a48){var _0x5d51fb=_['mapKeys'](_0x127efd,function(_0x376c58,_0x3d5680){return util[_0xa365('0x23')](_0xa365('0x24'),_0x376c58[_0xa365('0x25')]);});for(var _0x3b5f2f in _0x193a48){if(_0x193a48[_0xa365('0x22')](_0x3b5f2f)){if(!_0x5d51fb[_0x3b5f2f]){delete _0x193a48[_0x3b5f2f];}}}}function freeIsNotKeyAgent(_0x1f8084,_0x574327){var _0x1f1917=_[_0xa365('0x26')](_0x1f8084,function(_0x5175ca,_0x15c873){var _0x1c3cfb=_[_0xa365('0x27')](_0x5175ca[_0xa365('0x28')])?util['format']('SIP/%s',_0x5175ca[_0xa365('0x25')]):_0x5175ca[_0xa365('0x28')];return _0x1c3cfb;});for(var _0x4ce0b2 in _0x574327){if(_0x574327[_0xa365('0x22')](_0x4ce0b2)){if(!_0x1f1917[_0x4ce0b2]){delete _0x574327[_0x4ce0b2];}}}}function clearVoiceCallReports(_0x8a9763){_0x8a9763['total']=0x0;_0x8a9763[_0xa365('0x29')]=0x0;_0x8a9763[_0xa365('0x2a')]=0x0;_0x8a9763[_0xa365('0x2b')]=0x0;_0x8a9763['sumBillable']=0x0;}function clearCampaigns(_0x6f65c0){if(!_[_0xa365('0x2c')](_0x6f65c0)){for(var _0x2236ed in _0x6f65c0){if(_0x6f65c0[_0xa365('0x22')](_0x2236ed)){_0x6f65c0[_0x2236ed][_0xa365('0x2d')]=0x0;_0x6f65c0[_0x2236ed][_0xa365('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x26a31e){if(!_['isEmpty'](_0x26a31e)){for(var _0xc84a19 in _0x26a31e){if(_0x26a31e[_0xa365('0x22')](_0xc84a19)){_0x26a31e[_0xc84a19][_0xa365('0x2f')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x29')]=0x0;_0x26a31e[_0xc84a19]['unmanaged']=0x0;_0x26a31e[_0xc84a19][_0xa365('0x30')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x2a')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x2b')]=0x0;_0x26a31e[_0xc84a19]['sumBillable']=0x0;_0x26a31e[_0xc84a19]['outboundAnswerAgiCallsDay']=0x0;_0x26a31e[_0xc84a19][_0xa365('0x31')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x32')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x33')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x34')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x35')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x36')]=0x0;_0x26a31e[_0xc84a19]['outboundDropCallsDayCallersExit']=0x0;_0x26a31e[_0xc84a19]['outboundBlacklistCallsDay']=0x0;_0x26a31e[_0xc84a19][_0xa365('0x37')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x38')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x39')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x3a')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x3b')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x3c')]=!![];}}}}Realtime[_0xa365('0x3d')][_0xa365('0x3e')]=function(_0x36f115,_0x4b6c30){for(var _0x32e2c5 in _0x4b6c30){if(_0x36f115[_0xa365('0x22')](_0x32e2c5)){_0x36f115[_0x32e2c5]=_0x4b6c30[_0x32e2c5];}}};Realtime[_0xa365('0x3d')][_0xa365('0x3f')]=function(){var _0x219b0f=this;return function(_0x5af081){if(_0x5af081){freeIsNotKeyAgent(_0x5af081,_0x219b0f[_0xa365('0x11')]);for(var _0x3bebd6=0x0,_0x5a7d15={},_0x13d147={};_0x3bebd6<_0x5af081[_0xa365('0x40')];_0x3bebd6+=0x1){_0x5a7d15=_0x5af081[_0x3bebd6];var _0x2a7f81=_[_0xa365('0x27')](_0x5a7d15[_0xa365('0x28')])?util['format'](_0xa365('0x24'),_0x5a7d15['name']):_0x5a7d15[_0xa365('0x28')];if(_[_0xa365('0x41')](_0x219b0f[_0xa365('0x11')][_0x2a7f81])){_0x219b0f['agents'][_0x2a7f81]=new Agent(_0x5a7d15);}else{_0x219b0f[_0xa365('0x3e')](_0x219b0f[_0xa365('0x11')][_0x2a7f81],_0x5a7d15);}}}return _0x219b0f[_0xa365('0x11')];};};Realtime['prototype'][_0xa365('0x42')]=function(){var _0x4cb571=this;return function(_0x39ab4a){if(_0x39ab4a){freeIsNotKeySip(_0x39ab4a,_0x4cb571[_0xa365('0x43')]);for(var _0xcae118=0x0,_0x5981b0={},_0x39c0e3={};_0xcae118<_0x39ab4a['length'];_0xcae118+=0x1){_0x5981b0=_0x39ab4a[_0xcae118];if(_[_0xa365('0x41')](_0x4cb571[_0xa365('0x43')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5981b0[_0xa365('0x25')])])){_0x4cb571[_0xa365('0x43')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5981b0[_0xa365('0x25')])]=new Telephone(_0x5981b0);}else{_0x4cb571[_0xa365('0x3e')](_0x4cb571[_0xa365('0x43')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5981b0[_0xa365('0x25')])],_0x5981b0);}}}return _0x4cb571[_0xa365('0x43')];};};Realtime[_0xa365('0x3d')][_0xa365('0x44')]=function(){var _0x4ebe48=this;return function(_0x2036c3){if(_0x2036c3){freeIsNotKeySip(_0x2036c3,_0x4ebe48[_0xa365('0x45')]);for(var _0x3dccd0=0x0,_0x5806f2={},_0x381611={};_0x3dccd0<_0x2036c3['length'];_0x3dccd0+=0x1){_0x5806f2=_0x2036c3[_0x3dccd0];if(_[_0xa365('0x41')](_0x4ebe48[_0xa365('0x45')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5806f2[_0xa365('0x25')])])){_0x4ebe48[_0xa365('0x45')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5806f2[_0xa365('0x25')])]=new Trunk(_0x5806f2);}else{_0x4ebe48['mergeFromDatabase'](_0x4ebe48[_0xa365('0x45')][util[_0xa365('0x23')]('SIP/%s',_0x5806f2[_0xa365('0x25')])],_0x5806f2);}}}return _0x4ebe48[_0xa365('0x45')];};};Realtime[_0xa365('0x3d')][_0xa365('0x46')]=function(){var _0x381329=this;return function(_0x516b0a){if(_0x516b0a){freeIsNotKey(_0x516b0a,_0x381329['voiceQueues'],_0xa365('0x25'));for(var _0x1dfc9e=0x0,_0x175049={},_0x459916={};_0x1dfc9e<_0x516b0a[_0xa365('0x40')];_0x1dfc9e+=0x1){_0x175049=_0x516b0a[_0x1dfc9e];if(_[_0xa365('0x41')](_0x381329[_0xa365('0x12')][_0x175049[_0xa365('0x25')]])){_0x381329[_0xa365('0x12')][_0x175049['name']]=new VoiceQueue(_0x175049);}else{_0x381329[_0xa365('0x3e')](_0x381329['voiceQueues'][_0x175049[_0xa365('0x25')]],_0x175049);}}}return _0x381329['voiceQueues'];};};Realtime[_0xa365('0x3d')][_0xa365('0x47')]=function(){var _0x5ec4e4=this;return function(_0x3c3f8c){if(_0x3c3f8c){freeIsNotKey(_0x3c3f8c,_0x5ec4e4['triggers'],'id');for(var _0x3d014f=0x0,_0x2364d0={},_0x50b05a={};_0x3d014f<_0x3c3f8c[_0xa365('0x40')];_0x3d014f+=0x1){_0x2364d0=_0x3c3f8c[_0x3d014f];if(_[_0xa365('0x41')](_0x5ec4e4[_0xa365('0x13')][_0x2364d0['id']])){_0x5ec4e4[_0xa365('0x13')][_0x2364d0['id']]=new Trigger(_0x2364d0);}else{_0x5ec4e4[_0xa365('0x3e')](_0x5ec4e4[_0xa365('0x13')][_0x2364d0['id']],_0x2364d0);}}}return _0x5ec4e4[_0xa365('0x13')];};};Realtime[_0xa365('0x3d')][_0xa365('0x48')]=function(){var _0x2fdf17=this;return function(_0x5b8467){if(_0x5b8467){freeIsNotKey(_0x5b8467,_0x2fdf17[_0xa365('0x15')],'id');for(var _0x4a31a1=0x0,_0x575c41={},_0x2d40dc={};_0x4a31a1<_0x5b8467['length'];_0x4a31a1+=0x1){_0x575c41=_0x5b8467[_0x4a31a1];if(_[_0xa365('0x41')](_0x2fdf17[_0xa365('0x15')][_0x575c41['id']])){_0x2fdf17[_0xa365('0x15')][_0x575c41['id']]=new Template(_0x575c41);}else{_0x2fdf17[_0xa365('0x3e')](_0x2fdf17[_0xa365('0x15')][_0x575c41['id']],_0x575c41);}}}return _0x2fdf17[_0xa365('0x15')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x1ab1e7=this;return function(_0x4ee26f){if(_0x4ee26f){freeIsNotKey(_0x4ee26f,_0x1ab1e7[_0xa365('0x1b')],'id');for(var _0x3d16dd=0x0,_0x179f67={},_0x52bf4e={};_0x3d16dd<_0x4ee26f[_0xa365('0x40')];_0x3d16dd+=0x1){_0x179f67=_0x4ee26f[_0x3d16dd];if(_[_0xa365('0x41')](_0x1ab1e7[_0xa365('0x1b')][_0x179f67['id']])){_0x1ab1e7[_0xa365('0x1b')][_0x179f67['id']]=new ZendeskAccount(_0x179f67);}else{_0x1ab1e7[_0xa365('0x3e')](_0x1ab1e7['zendeskAccounts'][_0x179f67['id']],_0x179f67);}}}return _0x1ab1e7[_0xa365('0x1b')];};};Realtime['prototype'][_0xa365('0x49')]=function(){var _0x27585d=this;return function(_0x350a88){if(_0x350a88){freeIsNotKey(_0x350a88,_0x27585d[_0xa365('0x1c')],'id');for(var _0x559355=0x0,_0x1375f9={},_0x35f921={};_0x559355<_0x350a88[_0xa365('0x40')];_0x559355+=0x1){_0x1375f9=_0x350a88[_0x559355];if(_[_0xa365('0x41')](_0x27585d['salesforceAccounts'][_0x1375f9['id']])){_0x27585d[_0xa365('0x1c')][_0x1375f9['id']]=new SalesforceAccount(_0x1375f9);}else{_0x27585d[_0xa365('0x3e')](_0x27585d[_0xa365('0x1c')][_0x1375f9['id']],_0x1375f9);}}}return _0x27585d[_0xa365('0x1c')];};};Realtime['prototype'][_0xa365('0x4a')]=function(){var _0x2ba13b=this;return function(_0xd497c6){if(_0xd497c6){freeIsNotKey(_0xd497c6,_0x2ba13b[_0xa365('0x1e')],'id');for(var _0x65f15c=0x0,_0x332bb6={},_0x236bcb={};_0x65f15c<_0xd497c6[_0xa365('0x40')];_0x65f15c+=0x1){_0x332bb6=_0xd497c6[_0x65f15c];if(_['isUndefined'](_0x2ba13b[_0xa365('0x1e')][_0x332bb6['id']])){_0x2ba13b[_0xa365('0x1e')][_0x332bb6['id']]=new FreshdeskAccount(_0x332bb6);}else{_0x2ba13b[_0xa365('0x3e')](_0x2ba13b[_0xa365('0x1e')][_0x332bb6['id']],_0x332bb6);}}}return _0x2ba13b[_0xa365('0x1e')];};};Realtime[_0xa365('0x3d')][_0xa365('0x4b')]=function(){var _0x30b229=this;return function(_0x355dd4){if(_0x355dd4){freeIsNotKey(_0x355dd4,_0x30b229[_0xa365('0x4c')],'id');for(var _0x3966e7=0x0,_0x32ccd7={},_0x101a3b={};_0x3966e7<_0x355dd4['length'];_0x3966e7+=0x1){_0x32ccd7=_0x355dd4[_0x3966e7];if(_['isUndefined'](_0x30b229[_0xa365('0x4c')][_0x32ccd7['id']])){_0x30b229[_0xa365('0x4c')][_0x32ccd7['id']]=new ZohoAccount(_0x32ccd7);}else{_0x30b229[_0xa365('0x3e')](_0x30b229['zohoAccounts'][_0x32ccd7['id']],_0x32ccd7);}}}return _0x30b229[_0xa365('0x4c')];};};Realtime[_0xa365('0x3d')][_0xa365('0x4d')]=function(){var _0x4c0772=this;return function(_0x584dc5){if(_0x584dc5){freeIsNotKey(_0x584dc5,_0x4c0772[_0xa365('0x4e')],'id');for(var _0x2de318=0x0,_0x22f6ac={},_0x4bfeef={};_0x2de318<_0x584dc5['length'];_0x2de318+=0x1){_0x22f6ac=_0x584dc5[_0x2de318];if(_[_0xa365('0x41')](_0x4c0772[_0xa365('0x4e')][_0x22f6ac['id']])){_0x4c0772[_0xa365('0x4e')][_0x22f6ac['id']]=new DeskAccount(_0x22f6ac);}else{_0x4c0772[_0xa365('0x3e')](_0x4c0772[_0xa365('0x4e')][_0x22f6ac['id']],_0x22f6ac);}}}return _0x4c0772[_0xa365('0x4e')];};};Realtime[_0xa365('0x3d')][_0xa365('0x4f')]=function(){var _0x5a332d=this;return function(_0x27c380){if(_0x27c380){freeIsNotKey(_0x27c380,_0x5a332d[_0xa365('0x1d')],'id');for(var _0x3a081b=0x0,_0x3da6f3={},_0xb75fb5={};_0x3a081b<_0x27c380[_0xa365('0x40')];_0x3a081b+=0x1){_0x3da6f3=_0x27c380[_0x3a081b];if(_[_0xa365('0x41')](_0x5a332d[_0xa365('0x1d')][_0x3da6f3['id']])){_0x5a332d[_0xa365('0x1d')][_0x3da6f3['id']]=new SugarcrmAccount(_0x3da6f3);}else{_0x5a332d['mergeFromDatabase'](_0x5a332d[_0xa365('0x1d')][_0x3da6f3['id']],_0x3da6f3);}}}return _0x5a332d['sugarcrmAccounts'];};};Realtime[_0xa365('0x3d')][_0xa365('0x50')]=function(){var _0x55a23f=this;return function(_0x56cc72){if(_0x56cc72){freeIsNotKey(_0x56cc72,_0x55a23f[_0xa365('0x51')],'id');for(var _0x33e72b=0x0,_0x300988={},_0x1080b6={};_0x33e72b<_0x56cc72[_0xa365('0x40')];_0x33e72b+=0x1){_0x300988=_0x56cc72[_0x33e72b];if(_[_0xa365('0x41')](_0x55a23f[_0xa365('0x51')][_0x300988['id']])){_0x55a23f['vtigerAccounts'][_0x300988['id']]=new VtigerAccount(_0x300988);}else{_0x55a23f[_0xa365('0x3e')](_0x55a23f[_0xa365('0x51')][_0x300988['id']],_0x300988);}}}return _0x55a23f['vtigerAccounts'];};};Realtime[_0xa365('0x3d')][_0xa365('0x52')]=function(){var _0x24acde=this;return function(_0x476436){if(_0x476436){freeIsNotKey(_0x476436,_0x24acde[_0xa365('0x1f')],'id');for(var _0x5d7470=0x0,_0x1eb581={},_0x5ce95a={};_0x5d7470<_0x476436['length'];_0x5d7470+=0x1){_0x1eb581=_0x476436[_0x5d7470];if(_[_0xa365('0x41')](_0x24acde[_0xa365('0x1f')][_0x1eb581['id']])){_0x24acde[_0xa365('0x1f')][_0x1eb581['id']]=new ServicenowAccount(_0x1eb581);}else{_0x24acde[_0xa365('0x3e')](_0x24acde[_0xa365('0x1f')][_0x1eb581['id']],_0x1eb581);}}}return _0x24acde['servicenowAccounts'];};};Realtime[_0xa365('0x3d')]['initDynamics365Accounts']=function(){var _0x3e59e0=this;return function(_0x368ef3){if(_0x368ef3){freeIsNotKey(_0x368ef3,_0x3e59e0[_0xa365('0x53')],'id');for(var _0x4123b6=0x0,_0x5021a4={},_0x540573={};_0x4123b6<_0x368ef3['length'];_0x4123b6+=0x1){_0x5021a4=_0x368ef3[_0x4123b6];if(_[_0xa365('0x41')](_0x3e59e0['dynamics365Accounts'][_0x5021a4['id']])){_0x3e59e0[_0xa365('0x53')][_0x5021a4['id']]=new Dynamics365Account(_0x5021a4);}else{_0x3e59e0[_0xa365('0x3e')](_0x3e59e0['dynamics365Accounts'][_0x5021a4['id']],_0x5021a4);}}}return _0x3e59e0[_0xa365('0x53')];};};Realtime['prototype'][_0xa365('0x54')]=function(){var _0x5d07ca=this;return function(_0x5f31f9){if(_0x5f31f9){freeIsNotKey(_0x5f31f9,_0x5d07ca[_0xa365('0x20')],'id');for(var _0x1c1d1c=0x0,_0x3336db={},_0x5098b2={};_0x1c1d1c<_0x5f31f9[_0xa365('0x40')];_0x1c1d1c+=0x1){_0x3336db=_0x5f31f9[_0x1c1d1c];if(_[_0xa365('0x41')](_0x5d07ca[_0xa365('0x20')][_0x3336db['id']])){_0x5d07ca['freshsalesAccounts'][_0x3336db['id']]=new FreshsalesAccount(_0x3336db);}else{_0x5d07ca['mergeFromDatabase'](_0x5d07ca[_0xa365('0x20')][_0x3336db['id']],_0x3336db);}}}return _0x5d07ca[_0xa365('0x20')];};};Realtime[_0xa365('0x3d')][_0xa365('0x55')]=function(){var _0x2f6327=this;return function(_0x2e306c){for(var _0x156c8a=0x0;_0x156c8a<_0x2e306c[_0xa365('0x40')];_0x156c8a+=0x1){_['merge'](_0x2f6327['voiceQueues'][_0x2e306c[_0x156c8a][_0xa365('0x25')]],_0x2e306c[_0x156c8a]);}return _0x2f6327[_0xa365('0x12')];};};Realtime[_0xa365('0x3d')]['initVoiceQueueReports']=function(){var _0x11afab=this;return function(_0x457009){clearVoiceQueues(_0x11afab[_0xa365('0x12')]);if(_0x457009){_0x457009=_['groupBy'](_0x457009,_0xa365('0x56'));for(var _0xde3b6c in _0x457009){if(_0x457009[_0xa365('0x22')](_0xde3b6c)){var _0x4931ce={};for(var _0x555386=0x0;_0x555386<_0x457009[_0xde3b6c][_0xa365('0x40')];_0x555386+=0x1){var _0x7cc5a4=_0x457009[_0xde3b6c][_0x555386][_0xa365('0x57')];if(_0x11afab['voiceQueues'][_0x7cc5a4]){if(_0x457009[_0xde3b6c][_0x555386][_0xa365('0x58')]){_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x59')]+=0x1;}if(_0x457009[_0xde3b6c][_0x555386]['queuecallerabandon']){_0x11afab['voiceQueues'][_0x7cc5a4][_0xa365('0x30')]+=0x1;}_0x11afab['voiceQueues'][_0x7cc5a4][_0xa365('0x2a')]+=moment(_0x457009[_0xde3b6c][_0x555386]['queuecallerleaveAt'])[_0xa365('0x5a')](moment(_0x457009[_0xde3b6c][_0x555386]['queuecallerjoinAt']),_0xa365('0x5b'))||0x0;if(_0x555386===_0x457009[_0xde3b6c][_0xa365('0x40')]-0x1){_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x2b')]+=moment(_0x457009[_0xde3b6c][_0x555386]['queuecallercompleteAt']||_0x457009[_0xde3b6c][_0x555386]['queuecallerabandonAt']||_0x457009[_0xde3b6c][_0x555386][_0xa365('0x5c')])[_0xa365('0x5a')](moment(_0x457009[_0xde3b6c][_0x555386]['queuecallerjoinAt']),'seconds')||0x0;_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x2f')]+=0x1;if(_0x457009[_0xde3b6c][_0x555386][_0xa365('0x5d')]){_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x29')]+=0x1;_0x11afab['voiceQueues'][_0x7cc5a4][_0xa365('0x5e')]+=moment(_0x457009[_0xde3b6c][_0x555386]['queuecallercompleteAt'])[_0xa365('0x5a')](moment(_0x457009[_0xde3b6c][_0x555386][_0xa365('0x5f')]),'seconds')||0x0;}}else{_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x2b')]+=_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x2a')]||0x0;}}}}}}return _0x11afab[_0xa365('0x12')];};};Realtime[_0xa365('0x3d')][_0xa365('0x60')]=function(){var _0x1992fc=this;return function(_0x3cd4b3){clearVoiceCallReports(_0x1992fc[_0xa365('0x61')]);if(_0x3cd4b3){for(var _0x35de49=0x0;_0x35de49<_0x3cd4b3[_0xa365('0x40')];_0x35de49+=0x1){_0x1992fc[_0xa365('0x61')]['total']+=0x1;_0x1992fc['outbound'][_0xa365('0x2b')]+=_0x3cd4b3[_0x35de49][_0xa365('0x62')];if(_0x3cd4b3[_0x35de49]['disposition']===_0xa365('0x63')){_0x1992fc['outbound'][_0xa365('0x29')]+=0x1;_0x1992fc[_0xa365('0x61')][_0xa365('0x2a')]+=_0x3cd4b3[_0x35de49]['duration']-_0x3cd4b3[_0x35de49]['billableseconds']||0x0;_0x1992fc[_0xa365('0x61')][_0xa365('0x5e')]+=_0x3cd4b3[_0x35de49][_0xa365('0x64')];}}}return _0x1992fc[_0xa365('0x61')];};};Realtime['prototype'][_0xa365('0x65')]=function(){var _0x34048a=this;return function(_0x311dc5){if(_0x311dc5){freeIsNotKey(_0x311dc5,_0x34048a[_0xa365('0x14')],'name');for(var _0x46d48d=0x0,_0x25b9fc={};_0x46d48d<_0x311dc5[_0xa365('0x40')];_0x46d48d+=0x1){_0x25b9fc=_0x311dc5[_0x46d48d];if(_[_0xa365('0x41')](_0x34048a[_0xa365('0x14')][_0x25b9fc[_0xa365('0x25')]])){_0x34048a[_0xa365('0x14')][_0x25b9fc[_0xa365('0x25')]]=new Campaign(_0x25b9fc);}else{_0x34048a[_0xa365('0x3e')](_0x34048a[_0xa365('0x14')][_0x25b9fc['name']],_0x25b9fc);_0x34048a[_0xa365('0x14')][_0x25b9fc[_0xa365('0x25')]][_0xa365('0x66')]=_0x25b9fc['SquareProject']?_0x25b9fc[_0xa365('0x67')][_0xa365('0x25')]:undefined;}}}return _0x34048a[_0xa365('0x14')];};};Realtime[_0xa365('0x3d')][_0xa365('0x68')]=function(){var _0x1071cd=this;return function(_0x517ffd){if(_0x517ffd){freeIsNotKey(_0x517ffd,_0x1071cd[_0xa365('0x16')],'id');for(var _0x467297=0x0,_0xc1fe0={};_0x467297<_0x517ffd[_0xa365('0x40')];_0x467297+=0x1){_0xc1fe0=_0x517ffd[_0x467297];if(_['isUndefined'](_0x1071cd[_0xa365('0x16')][_0xc1fe0['id']])){_0x1071cd[_0xa365('0x16')][_0xc1fe0['id']]=new VoiceExtension(_0xc1fe0);}else{_0x1071cd[_0xa365('0x3e')](_0x1071cd[_0xa365('0x16')][_0xc1fe0['id']],_0xc1fe0);}}}return _0x1071cd['voiceExtensions'];};};Realtime[_0xa365('0x3d')][_0xa365('0x69')]=function(){var _0x5b98ee=this;return function(_0x599980){clearCampaigns(_0x5b98ee[_0xa365('0x14')]);for(var _0x28155d=0x0;_0x28155d<_0x599980[_0xa365('0x40')];_0x28155d+=0x1){_['merge'](_0x5b98ee['campaigns'][_0x599980[_0x28155d][_0xa365('0x25')]],_0x599980[_0x28155d]);}return _0x5b98ee['campaigns'];};};Realtime[_0xa365('0x3d')]['initFaxAccounts']=function(){var _0xbd2d19=this;return function(_0x2a45b2){if(_0x2a45b2){freeIsNotKey(_0x2a45b2,_0xbd2d19['faxAccounts'],'id');for(var _0x59866c=0x0,_0x36d367={},_0x651421={};_0x59866c<_0x2a45b2[_0xa365('0x40')];_0x59866c+=0x1){_0x36d367=_0x2a45b2[_0x59866c];if(_[_0xa365('0x41')](_0xbd2d19[_0xa365('0x21')][_0x36d367['id']])){_0xbd2d19[_0xa365('0x21')][_0x36d367['id']]=new FaxAccount(_0x36d367);}else{_0xbd2d19[_0xa365('0x3e')](_0xbd2d19[_0xa365('0x21')][_0x36d367['id']],_0x36d367);}}}return _0xbd2d19[_0xa365('0x21')];};};module['exports']=Realtime; \ No newline at end of file +var _0x7d6f=['templates','zendeskAccounts','initFreshdeskAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','sumHoldTime','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','merge','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','outbound','channels','queueChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','SIP/%s','name','hasOwnProperty','isNil','interface','format','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','sumBillable','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','telephones','initVoiceQueues','initTriggers','initTemplates'];(function(_0x1898a2,_0x4a661f){var _0x493337=function(_0x4490c9){while(--_0x4490c9){_0x1898a2['push'](_0x1898a2['shift']());}};_0x493337(++_0x4a661f);}(_0x7d6f,0xf9));var _0xf7d6=function(_0x2dda85,_0x5c9ff5){_0x2dda85=_0x2dda85-0x0;var _0x11abf4=_0x7d6f[_0x2dda85];return _0x11abf4;};'use strict';var BPromise=require(_0xf7d6('0x0'));var util=require('util');var _=require(_0xf7d6('0x1'));var moment=require(_0xf7d6('0x2'));var Agent=require(_0xf7d6('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0xf7d6('0x4'));var VoiceQueue=require(_0xf7d6('0x5'));var Trigger=require(_0xf7d6('0x6'));var Template=require(_0xf7d6('0x7'));var Campaign=require(_0xf7d6('0x8'));var VoiceExtension=require(_0xf7d6('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xf7d6('0xa'));var SugarcrmAccount=require(_0xf7d6('0xb'));var ZohoAccount=require(_0xf7d6('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf7d6('0xd'));var ServicenowAccount=require(_0xf7d6('0xe'));var Dynamics365Account=require(_0xf7d6('0xf'));var FreshsalesAccount=require(_0xf7d6('0x10'));var FaxAccount=require(_0xf7d6('0x11'));var Realtime=function(){this[_0xf7d6('0x12')]={};this['telephones']={};this[_0xf7d6('0x13')]={};this[_0xf7d6('0x14')]={};this[_0xf7d6('0x15')]={};this[_0xf7d6('0x16')]={};this['templates']={};this[_0xf7d6('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf7d6('0x18')]={};this[_0xf7d6('0x19')]={};this['outboundChannels']={};this[_0xf7d6('0x1a')]={};this['zendeskAccounts']={};this[_0xf7d6('0x1b')]={};this[_0xf7d6('0x1c')]={};this[_0xf7d6('0x1d')]={};this[_0xf7d6('0x1e')]={};this['deskAccounts']={};this[_0xf7d6('0x1f')]={};this[_0xf7d6('0x20')]={};this[_0xf7d6('0x21')]={};this['freshsalesAccounts']={};this[_0xf7d6('0x22')]={};};function freeIsNotKey(_0x1a048a,_0x4ba7df,_0x82194b){var _0x390604=_['mapKeys'](_0x1a048a,function(_0xd90d83,_0x44657d){return _0xd90d83[_0x82194b];});for(var _0x3f52b7 in _0x4ba7df){if(_0x4ba7df['hasOwnProperty'](_0x3f52b7)){if(!_0x390604[_0x3f52b7]){delete _0x4ba7df[_0x3f52b7];}}}}function freeIsNotKeySip(_0x4ca16e,_0x44e3bd){var _0x3b747b=_[_0xf7d6('0x23')](_0x4ca16e,function(_0x18b9e7,_0x41d282){return util['format'](_0xf7d6('0x24'),_0x18b9e7[_0xf7d6('0x25')]);});for(var _0xcf5ce in _0x44e3bd){if(_0x44e3bd[_0xf7d6('0x26')](_0xcf5ce)){if(!_0x3b747b[_0xcf5ce]){delete _0x44e3bd[_0xcf5ce];}}}}function freeIsNotKeyAgent(_0x71f7da,_0x59d7e4){var _0x8e7300=_[_0xf7d6('0x23')](_0x71f7da,function(_0x5b1791,_0x151cce){var _0x429dfb=_[_0xf7d6('0x27')](_0x5b1791[_0xf7d6('0x28')])?util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x5b1791[_0xf7d6('0x25')]):_0x5b1791[_0xf7d6('0x28')];return _0x429dfb;});for(var _0x2e2dca in _0x59d7e4){if(_0x59d7e4[_0xf7d6('0x26')](_0x2e2dca)){if(!_0x8e7300[_0x2e2dca]){delete _0x59d7e4[_0x2e2dca];}}}}function clearVoiceCallReports(_0x2324f9){_0x2324f9['total']=0x0;_0x2324f9[_0xf7d6('0x2a')]=0x0;_0x2324f9['sumHoldTime']=0x0;_0x2324f9[_0xf7d6('0x2b')]=0x0;_0x2324f9['sumBillable']=0x0;}function clearCampaigns(_0x517020){if(!_[_0xf7d6('0x2c')](_0x517020)){for(var _0x489ebe in _0x517020){if(_0x517020[_0xf7d6('0x26')](_0x489ebe)){_0x517020[_0x489ebe][_0xf7d6('0x2d')]=0x0;_0x517020[_0x489ebe][_0xf7d6('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x141f3e){if(!_['isEmpty'](_0x141f3e)){for(var _0x37c508 in _0x141f3e){if(_0x141f3e['hasOwnProperty'](_0x37c508)){_0x141f3e[_0x37c508][_0xf7d6('0x2f')]=0x0;_0x141f3e[_0x37c508]['answered']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x30')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x31')]=0x0;_0x141f3e[_0x37c508]['sumHoldTime']=0x0;_0x141f3e[_0x37c508]['sumDuration']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x32')]=0x0;_0x141f3e[_0x37c508]['outboundAnswerAgiCallsDay']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x33')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x34')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x35')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x36')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x37')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x38')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x39')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x3a')]=0x0;_0x141f3e[_0x37c508]['outboundOriginateFailureCallsDay']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x3b')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x3c')]=0x0;_0x141f3e[_0x37c508]['outboundAnswerAgiCallsDay']=0x0;_0x141f3e[_0x37c508]['outboundAnswerCallsDay']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x3d')]=!![];}}}}Realtime[_0xf7d6('0x3e')][_0xf7d6('0x3f')]=function(_0x21eab4,_0x4d350b){for(var _0x402007 in _0x4d350b){if(_0x21eab4[_0xf7d6('0x26')](_0x402007)){_0x21eab4[_0x402007]=_0x4d350b[_0x402007];}}};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x40')]=function(){var _0x56768a=this;return function(_0x6c30ee){if(_0x6c30ee){freeIsNotKeyAgent(_0x6c30ee,_0x56768a['agents']);for(var _0x1792e9=0x0,_0x5c3d1d={},_0x143432={};_0x1792e9<_0x6c30ee[_0xf7d6('0x41')];_0x1792e9+=0x1){_0x5c3d1d=_0x6c30ee[_0x1792e9];var _0x35a7ae=_[_0xf7d6('0x27')](_0x5c3d1d[_0xf7d6('0x28')])?util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x5c3d1d['name']):_0x5c3d1d['interface'];if(_[_0xf7d6('0x42')](_0x56768a[_0xf7d6('0x12')][_0x35a7ae])){_0x56768a[_0xf7d6('0x12')][_0x35a7ae]=new Agent(_0x5c3d1d);}else{_0x56768a['mergeFromDatabase'](_0x56768a[_0xf7d6('0x12')][_0x35a7ae],_0x5c3d1d);}}}return _0x56768a[_0xf7d6('0x12')];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x43')]=function(){var _0x15ffd3=this;return function(_0x5c2380){if(_0x5c2380){freeIsNotKeySip(_0x5c2380,_0x15ffd3['telephones']);for(var _0x2b8211=0x0,_0x2c35f8={},_0xc08d94={};_0x2b8211<_0x5c2380[_0xf7d6('0x41')];_0x2b8211+=0x1){_0x2c35f8=_0x5c2380[_0x2b8211];if(_['isUndefined'](_0x15ffd3[_0xf7d6('0x44')][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x2c35f8[_0xf7d6('0x25')])])){_0x15ffd3[_0xf7d6('0x44')][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x2c35f8[_0xf7d6('0x25')])]=new Telephone(_0x2c35f8);}else{_0x15ffd3[_0xf7d6('0x3f')](_0x15ffd3['telephones'][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x2c35f8[_0xf7d6('0x25')])],_0x2c35f8);}}}return _0x15ffd3['telephones'];};};Realtime[_0xf7d6('0x3e')]['initTrunks']=function(){var _0x306d4e=this;return function(_0x2ddf41){if(_0x2ddf41){freeIsNotKeySip(_0x2ddf41,_0x306d4e[_0xf7d6('0x13')]);for(var _0x383c9d=0x0,_0x21f13b={},_0x59c662={};_0x383c9d<_0x2ddf41['length'];_0x383c9d+=0x1){_0x21f13b=_0x2ddf41[_0x383c9d];if(_[_0xf7d6('0x42')](_0x306d4e[_0xf7d6('0x13')][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x21f13b[_0xf7d6('0x25')])])){_0x306d4e[_0xf7d6('0x13')][util[_0xf7d6('0x29')]('SIP/%s',_0x21f13b['name'])]=new Trunk(_0x21f13b);}else{_0x306d4e[_0xf7d6('0x3f')](_0x306d4e[_0xf7d6('0x13')][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x21f13b[_0xf7d6('0x25')])],_0x21f13b);}}}return _0x306d4e[_0xf7d6('0x13')];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x45')]=function(){var _0x4d8396=this;return function(_0xe9969c){if(_0xe9969c){freeIsNotKey(_0xe9969c,_0x4d8396['voiceQueues'],'name');for(var _0xa7c305=0x0,_0x2d9ba7={},_0x24f3db={};_0xa7c305<_0xe9969c[_0xf7d6('0x41')];_0xa7c305+=0x1){_0x2d9ba7=_0xe9969c[_0xa7c305];if(_[_0xf7d6('0x42')](_0x4d8396[_0xf7d6('0x14')][_0x2d9ba7[_0xf7d6('0x25')]])){_0x4d8396[_0xf7d6('0x14')][_0x2d9ba7[_0xf7d6('0x25')]]=new VoiceQueue(_0x2d9ba7);}else{_0x4d8396['mergeFromDatabase'](_0x4d8396[_0xf7d6('0x14')][_0x2d9ba7[_0xf7d6('0x25')]],_0x2d9ba7);}}}return _0x4d8396[_0xf7d6('0x14')];};};Realtime['prototype'][_0xf7d6('0x46')]=function(){var _0x538864=this;return function(_0x5e18e2){if(_0x5e18e2){freeIsNotKey(_0x5e18e2,_0x538864[_0xf7d6('0x15')],'id');for(var _0x53ba47=0x0,_0x1807e3={},_0x2ae5b1={};_0x53ba47<_0x5e18e2[_0xf7d6('0x41')];_0x53ba47+=0x1){_0x1807e3=_0x5e18e2[_0x53ba47];if(_[_0xf7d6('0x42')](_0x538864[_0xf7d6('0x15')][_0x1807e3['id']])){_0x538864[_0xf7d6('0x15')][_0x1807e3['id']]=new Trigger(_0x1807e3);}else{_0x538864[_0xf7d6('0x3f')](_0x538864[_0xf7d6('0x15')][_0x1807e3['id']],_0x1807e3);}}}return _0x538864['triggers'];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x47')]=function(){var _0x706e16=this;return function(_0x115297){if(_0x115297){freeIsNotKey(_0x115297,_0x706e16[_0xf7d6('0x48')],'id');for(var _0x58eb34=0x0,_0x3cba1d={},_0x56ac37={};_0x58eb34<_0x115297[_0xf7d6('0x41')];_0x58eb34+=0x1){_0x3cba1d=_0x115297[_0x58eb34];if(_[_0xf7d6('0x42')](_0x706e16[_0xf7d6('0x48')][_0x3cba1d['id']])){_0x706e16[_0xf7d6('0x48')][_0x3cba1d['id']]=new Template(_0x3cba1d);}else{_0x706e16[_0xf7d6('0x3f')](_0x706e16[_0xf7d6('0x48')][_0x3cba1d['id']],_0x3cba1d);}}}return _0x706e16[_0xf7d6('0x48')];};};Realtime[_0xf7d6('0x3e')]['initZendeskAccounts']=function(){var _0x5c2000=this;return function(_0x4edb4f){if(_0x4edb4f){freeIsNotKey(_0x4edb4f,_0x5c2000['zendeskAccounts'],'id');for(var _0x40e5f2=0x0,_0x4cdfaf={},_0x39095a={};_0x40e5f2<_0x4edb4f[_0xf7d6('0x41')];_0x40e5f2+=0x1){_0x4cdfaf=_0x4edb4f[_0x40e5f2];if(_[_0xf7d6('0x42')](_0x5c2000[_0xf7d6('0x49')][_0x4cdfaf['id']])){_0x5c2000[_0xf7d6('0x49')][_0x4cdfaf['id']]=new ZendeskAccount(_0x4cdfaf);}else{_0x5c2000['mergeFromDatabase'](_0x5c2000[_0xf7d6('0x49')][_0x4cdfaf['id']],_0x4cdfaf);}}}return _0x5c2000['zendeskAccounts'];};};Realtime[_0xf7d6('0x3e')]['initSalesforceAccounts']=function(){var _0x4c7bec=this;return function(_0xa50606){if(_0xa50606){freeIsNotKey(_0xa50606,_0x4c7bec['salesforceAccounts'],'id');for(var _0xf197d4=0x0,_0x17743f={},_0x7df989={};_0xf197d4<_0xa50606[_0xf7d6('0x41')];_0xf197d4+=0x1){_0x17743f=_0xa50606[_0xf197d4];if(_[_0xf7d6('0x42')](_0x4c7bec[_0xf7d6('0x1b')][_0x17743f['id']])){_0x4c7bec['salesforceAccounts'][_0x17743f['id']]=new SalesforceAccount(_0x17743f);}else{_0x4c7bec['mergeFromDatabase'](_0x4c7bec['salesforceAccounts'][_0x17743f['id']],_0x17743f);}}}return _0x4c7bec[_0xf7d6('0x1b')];};};Realtime['prototype'][_0xf7d6('0x4a')]=function(){var _0x4546ba=this;return function(_0x3409ed){if(_0x3409ed){freeIsNotKey(_0x3409ed,_0x4546ba['freshdeskAccounts'],'id');for(var _0xcf1a8d=0x0,_0x5d3d53={},_0x20dff={};_0xcf1a8d<_0x3409ed[_0xf7d6('0x41')];_0xcf1a8d+=0x1){_0x5d3d53=_0x3409ed[_0xcf1a8d];if(_[_0xf7d6('0x42')](_0x4546ba['freshdeskAccounts'][_0x5d3d53['id']])){_0x4546ba[_0xf7d6('0x1d')][_0x5d3d53['id']]=new FreshdeskAccount(_0x5d3d53);}else{_0x4546ba['mergeFromDatabase'](_0x4546ba[_0xf7d6('0x1d')][_0x5d3d53['id']],_0x5d3d53);}}}return _0x4546ba[_0xf7d6('0x1d')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x30463b=this;return function(_0x5a40ec){if(_0x5a40ec){freeIsNotKey(_0x5a40ec,_0x30463b[_0xf7d6('0x1e')],'id');for(var _0x1cdc92=0x0,_0x2f53cd={},_0x173209={};_0x1cdc92<_0x5a40ec[_0xf7d6('0x41')];_0x1cdc92+=0x1){_0x2f53cd=_0x5a40ec[_0x1cdc92];if(_[_0xf7d6('0x42')](_0x30463b[_0xf7d6('0x1e')][_0x2f53cd['id']])){_0x30463b[_0xf7d6('0x1e')][_0x2f53cd['id']]=new ZohoAccount(_0x2f53cd);}else{_0x30463b[_0xf7d6('0x3f')](_0x30463b['zohoAccounts'][_0x2f53cd['id']],_0x2f53cd);}}}return _0x30463b[_0xf7d6('0x1e')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x3c11e2=this;return function(_0x69b242){if(_0x69b242){freeIsNotKey(_0x69b242,_0x3c11e2[_0xf7d6('0x4b')],'id');for(var _0x103fbb=0x0,_0x35d58a={},_0x3aa5d6={};_0x103fbb<_0x69b242[_0xf7d6('0x41')];_0x103fbb+=0x1){_0x35d58a=_0x69b242[_0x103fbb];if(_[_0xf7d6('0x42')](_0x3c11e2[_0xf7d6('0x4b')][_0x35d58a['id']])){_0x3c11e2[_0xf7d6('0x4b')][_0x35d58a['id']]=new DeskAccount(_0x35d58a);}else{_0x3c11e2[_0xf7d6('0x3f')](_0x3c11e2[_0xf7d6('0x4b')][_0x35d58a['id']],_0x35d58a);}}}return _0x3c11e2[_0xf7d6('0x4b')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x30777f=this;return function(_0x174d3a){if(_0x174d3a){freeIsNotKey(_0x174d3a,_0x30777f['sugarcrmAccounts'],'id');for(var _0x2034ac=0x0,_0x20018d={},_0x40e096={};_0x2034ac<_0x174d3a[_0xf7d6('0x41')];_0x2034ac+=0x1){_0x20018d=_0x174d3a[_0x2034ac];if(_[_0xf7d6('0x42')](_0x30777f[_0xf7d6('0x1c')][_0x20018d['id']])){_0x30777f['sugarcrmAccounts'][_0x20018d['id']]=new SugarcrmAccount(_0x20018d);}else{_0x30777f['mergeFromDatabase'](_0x30777f['sugarcrmAccounts'][_0x20018d['id']],_0x20018d);}}}return _0x30777f['sugarcrmAccounts'];};};Realtime['prototype'][_0xf7d6('0x4c')]=function(){var _0x4688d5=this;return function(_0x318599){if(_0x318599){freeIsNotKey(_0x318599,_0x4688d5[_0xf7d6('0x1f')],'id');for(var _0x2e2777=0x0,_0x9f491c={},_0x308a35={};_0x2e2777<_0x318599[_0xf7d6('0x41')];_0x2e2777+=0x1){_0x9f491c=_0x318599[_0x2e2777];if(_[_0xf7d6('0x42')](_0x4688d5[_0xf7d6('0x1f')][_0x9f491c['id']])){_0x4688d5[_0xf7d6('0x1f')][_0x9f491c['id']]=new VtigerAccount(_0x9f491c);}else{_0x4688d5[_0xf7d6('0x3f')](_0x4688d5[_0xf7d6('0x1f')][_0x9f491c['id']],_0x9f491c);}}}return _0x4688d5[_0xf7d6('0x1f')];};};Realtime['prototype'][_0xf7d6('0x4d')]=function(){var _0x4d2580=this;return function(_0x37b875){if(_0x37b875){freeIsNotKey(_0x37b875,_0x4d2580[_0xf7d6('0x20')],'id');for(var _0x1087c5=0x0,_0x1c2e64={},_0x3ed2bb={};_0x1087c5<_0x37b875[_0xf7d6('0x41')];_0x1087c5+=0x1){_0x1c2e64=_0x37b875[_0x1087c5];if(_[_0xf7d6('0x42')](_0x4d2580['servicenowAccounts'][_0x1c2e64['id']])){_0x4d2580[_0xf7d6('0x20')][_0x1c2e64['id']]=new ServicenowAccount(_0x1c2e64);}else{_0x4d2580[_0xf7d6('0x3f')](_0x4d2580['servicenowAccounts'][_0x1c2e64['id']],_0x1c2e64);}}}return _0x4d2580[_0xf7d6('0x20')];};};Realtime['prototype'][_0xf7d6('0x4e')]=function(){var _0x5efa04=this;return function(_0x4a3a72){if(_0x4a3a72){freeIsNotKey(_0x4a3a72,_0x5efa04['dynamics365Accounts'],'id');for(var _0x18d7cb=0x0,_0x3aabca={},_0x598577={};_0x18d7cb<_0x4a3a72[_0xf7d6('0x41')];_0x18d7cb+=0x1){_0x3aabca=_0x4a3a72[_0x18d7cb];if(_['isUndefined'](_0x5efa04[_0xf7d6('0x21')][_0x3aabca['id']])){_0x5efa04[_0xf7d6('0x21')][_0x3aabca['id']]=new Dynamics365Account(_0x3aabca);}else{_0x5efa04['mergeFromDatabase'](_0x5efa04[_0xf7d6('0x21')][_0x3aabca['id']],_0x3aabca);}}}return _0x5efa04['dynamics365Accounts'];};};Realtime[_0xf7d6('0x3e')]['initFreshsalesAccounts']=function(){var _0x10a7e2=this;return function(_0x2f956d){if(_0x2f956d){freeIsNotKey(_0x2f956d,_0x10a7e2[_0xf7d6('0x4f')],'id');for(var _0x218d86=0x0,_0x3343b7={},_0xdff99a={};_0x218d86<_0x2f956d[_0xf7d6('0x41')];_0x218d86+=0x1){_0x3343b7=_0x2f956d[_0x218d86];if(_['isUndefined'](_0x10a7e2[_0xf7d6('0x4f')][_0x3343b7['id']])){_0x10a7e2['freshsalesAccounts'][_0x3343b7['id']]=new FreshsalesAccount(_0x3343b7);}else{_0x10a7e2['mergeFromDatabase'](_0x10a7e2[_0xf7d6('0x4f')][_0x3343b7['id']],_0x3343b7);}}}return _0x10a7e2['freshsalesAccounts'];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x50')]=function(){var _0x878ad6=this;return function(_0x50c57c){for(var _0x4d2f4c=0x0;_0x4d2f4c<_0x50c57c[_0xf7d6('0x41')];_0x4d2f4c+=0x1){_['merge'](_0x878ad6[_0xf7d6('0x14')][_0x50c57c[_0x4d2f4c]['name']],_0x50c57c[_0x4d2f4c]);}return _0x878ad6['voiceQueues'];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x51')]=function(){var _0x4ce9f6=this;return function(_0x1965d9){clearVoiceQueues(_0x4ce9f6['voiceQueues']);if(_0x1965d9){_0x1965d9=_[_0xf7d6('0x52')](_0x1965d9,_0xf7d6('0x53'));for(var _0x3cd67c in _0x1965d9){if(_0x1965d9[_0xf7d6('0x26')](_0x3cd67c)){var _0x1f2ce7={};for(var _0x35c649=0x0;_0x35c649<_0x1965d9[_0x3cd67c][_0xf7d6('0x41')];_0x35c649+=0x1){var _0x102dc6=_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x54')];if(_0x4ce9f6['voiceQueues'][_0x102dc6]){if(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x55')]){_0x4ce9f6[_0xf7d6('0x14')][_0x102dc6]['unmanaged']+=0x1;}if(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x56')]){_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x31')]+=0x1;}_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x57')]+=moment(_0x1965d9[_0x3cd67c][_0x35c649]['queuecallerleaveAt'])[_0xf7d6('0x58')](moment(_0x1965d9[_0x3cd67c][_0x35c649]['queuecallerjoinAt']),_0xf7d6('0x59'))||0x0;if(_0x35c649===_0x1965d9[_0x3cd67c][_0xf7d6('0x41')]-0x1){_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x2b')]+=moment(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5a')]||_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5b')]||_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5c')])[_0xf7d6('0x58')](moment(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5d')]),'seconds')||0x0;_0x4ce9f6[_0xf7d6('0x14')][_0x102dc6]['total']+=0x1;if(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5e')]){_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x2a')]+=0x1;_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x32')]+=moment(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5a')])[_0xf7d6('0x58')](moment(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5f')]),'seconds')||0x0;}}else{_0x4ce9f6[_0xf7d6('0x14')][_0x102dc6]['sumDuration']+=_0x4ce9f6[_0xf7d6('0x14')][_0x102dc6][_0xf7d6('0x57')]||0x0;}}}}}}return _0x4ce9f6['voiceQueues'];};};Realtime[_0xf7d6('0x3e')]['initVoiceCallReports']=function(){var _0x23a1fa=this;return function(_0x36fbb3){clearVoiceCallReports(_0x23a1fa[_0xf7d6('0x17')]);if(_0x36fbb3){for(var _0x4464ad=0x0;_0x4464ad<_0x36fbb3[_0xf7d6('0x41')];_0x4464ad+=0x1){_0x23a1fa[_0xf7d6('0x17')][_0xf7d6('0x2f')]+=0x1;_0x23a1fa[_0xf7d6('0x17')][_0xf7d6('0x2b')]+=_0x36fbb3[_0x4464ad][_0xf7d6('0x60')];if(_0x36fbb3[_0x4464ad][_0xf7d6('0x61')]===_0xf7d6('0x62')){_0x23a1fa[_0xf7d6('0x17')]['answered']+=0x1;_0x23a1fa[_0xf7d6('0x17')][_0xf7d6('0x57')]+=_0x36fbb3[_0x4464ad][_0xf7d6('0x60')]-_0x36fbb3[_0x4464ad][_0xf7d6('0x63')]||0x0;_0x23a1fa[_0xf7d6('0x17')][_0xf7d6('0x32')]+=_0x36fbb3[_0x4464ad][_0xf7d6('0x63')];}}}return _0x23a1fa[_0xf7d6('0x17')];};};Realtime[_0xf7d6('0x3e')]['initCampaigns']=function(){var _0x3b8b46=this;return function(_0x20945e){if(_0x20945e){freeIsNotKey(_0x20945e,_0x3b8b46[_0xf7d6('0x16')],'name');for(var _0x2355ba=0x0,_0x4da8f4={};_0x2355ba<_0x20945e[_0xf7d6('0x41')];_0x2355ba+=0x1){_0x4da8f4=_0x20945e[_0x2355ba];if(_[_0xf7d6('0x42')](_0x3b8b46[_0xf7d6('0x16')][_0x4da8f4[_0xf7d6('0x25')]])){_0x3b8b46[_0xf7d6('0x16')][_0x4da8f4[_0xf7d6('0x25')]]=new Campaign(_0x4da8f4);}else{_0x3b8b46[_0xf7d6('0x3f')](_0x3b8b46[_0xf7d6('0x16')][_0x4da8f4[_0xf7d6('0x25')]],_0x4da8f4);_0x3b8b46[_0xf7d6('0x16')][_0x4da8f4[_0xf7d6('0x25')]][_0xf7d6('0x64')]=_0x4da8f4[_0xf7d6('0x65')]?_0x4da8f4[_0xf7d6('0x65')][_0xf7d6('0x25')]:undefined;}}}return _0x3b8b46['campaigns'];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x66')]=function(){var _0x31223a=this;return function(_0x42d874){if(_0x42d874){freeIsNotKey(_0x42d874,_0x31223a[_0xf7d6('0x67')],'id');for(var _0x26791a=0x0,_0x3e955={};_0x26791a<_0x42d874['length'];_0x26791a+=0x1){_0x3e955=_0x42d874[_0x26791a];if(_[_0xf7d6('0x42')](_0x31223a[_0xf7d6('0x67')][_0x3e955['id']])){_0x31223a[_0xf7d6('0x67')][_0x3e955['id']]=new VoiceExtension(_0x3e955);}else{_0x31223a[_0xf7d6('0x3f')](_0x31223a[_0xf7d6('0x67')][_0x3e955['id']],_0x3e955);}}}return _0x31223a['voiceExtensions'];};};Realtime[_0xf7d6('0x3e')]['initCampaignHopperHistory']=function(){var _0x3eaa4d=this;return function(_0x5c2d63){clearCampaigns(_0x3eaa4d[_0xf7d6('0x16')]);for(var _0x2f2961=0x0;_0x2f2961<_0x5c2d63[_0xf7d6('0x41')];_0x2f2961+=0x1){_[_0xf7d6('0x68')](_0x3eaa4d['campaigns'][_0x5c2d63[_0x2f2961][_0xf7d6('0x25')]],_0x5c2d63[_0x2f2961]);}return _0x3eaa4d[_0xf7d6('0x16')];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x69')]=function(){var _0x1d46d8=this;return function(_0x1d5a02){if(_0x1d5a02){freeIsNotKey(_0x1d5a02,_0x1d46d8[_0xf7d6('0x22')],'id');for(var _0x5510e2=0x0,_0x9f418c={},_0xe375ab={};_0x5510e2<_0x1d5a02[_0xf7d6('0x41')];_0x5510e2+=0x1){_0x9f418c=_0x1d5a02[_0x5510e2];if(_['isUndefined'](_0x1d46d8['faxAccounts'][_0x9f418c['id']])){_0x1d46d8[_0xf7d6('0x22')][_0x9f418c['id']]=new FaxAccount(_0x9f418c);}else{_0x1d46d8[_0xf7d6('0x3f')](_0x1d46d8['faxAccounts'][_0x9f418c['id']],_0x9f418c);}}}return _0x1d46d8[_0xf7d6('0x22')];};};module[_0xf7d6('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 68f2590..1c87fe1 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 _0x05c6=['custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','format','SIP/%s','length','assigned','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','connectedlinenum','calleridname','monitor','monitors','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','forEach','startsWith','Local','substring','indexOf','mobile','phone','findAgent','exports','bluebird','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport'];(function(_0x698afe,_0x3841f9){var _0x49865f=function(_0xe2d368){while(--_0xe2d368){_0x698afe['push'](_0x698afe['shift']());}};_0x49865f(++_0x3841f9);}(_0x05c6,0x1c2));var _0x605c=function(_0x13e22c,_0x4786fc){_0x13e22c=_0x13e22c-0x0;var _0x20b332=_0x05c6[_0x13e22c];return _0x20b332;};'use strict';var BPromise=require(_0x605c('0x0'));var _=require('lodash');var moment=require('moment');var util=require(_0x605c('0x1'));var config=require(_0x605c('0x2'));var logger=require(_0x605c('0x3'))(_0x605c('0x4'));var ami=require(_0x605c('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x605c('0x6'));var RpcVoiceDialReport=require(_0x605c('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x605c('0x8'));var RpcVoiceRecording=require(_0x605c('0x9'));var RpcVoiceTransferReport=require(_0x605c('0xa'));var VoiceQueueReport=require(_0x605c('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x605c('0xc'));var VoiceDialReport=require(_0x605c('0xd'));var UserReport=require('./userReport');function Report(_0x19d137){this[_0x605c('0xe')]=_0x19d137;this[_0x605c('0xf')]=_0x19d137['agents'];this[_0x605c('0x10')]=_0x19d137['telephones'];}Report[_0x605c('0x11')]['sync']=function(_0x31ba8d){var _0x19fbdb=new VoiceQueueReport(this[_0x605c('0xe')]);var _0x34ca15=new VoiceAgentReport(this[_0x605c('0xe')]);var _0x3055ff=new VoiceDialReport(this[_0x605c('0xe')]);var _0x7e9d85=new VoiceCallReport(this[_0x605c('0xe')]);var _0x5a66ca=new UserReport(this[_0x605c('0xe')]);if(config[_0x605c('0x12')]&&config[_0x605c('0x12')][_0x605c('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x605c('0x14')][_0x605c('0x15')](this));ami['on'](_0x605c('0x16'),this[_0x605c('0x17')][_0x605c('0x15')](this));ami['on'](_0x605c('0x18'),this['voiceAgentReport'][_0x605c('0x15')](this));ami['on'](_0x605c('0x19'),this[_0x605c('0x1a')][_0x605c('0x15')](this));ami['on'](_0x605c('0x1b'),this[_0x605c('0x1c')][_0x605c('0x15')](this));ami['on'](_0x605c('0x1d'),this[_0x605c('0x1e')][_0x605c('0x15')](this));}};Report[_0x605c('0x11')]['findAgent']=function(_0x5c86a4){var _0x4b28ee=undefined;_0x4b28ee=_[_0x605c('0x1f')](this[_0x605c('0xf')],function(_0x574417){return _0x574417[_0x605c('0x20')]==_0x5c86a4||_0x574417[_0x605c('0x21')]==_0x5c86a4;});if(_[_0x605c('0x22')](_0x4b28ee)){var _0x5c94a3=_[_0x605c('0x1f')](this['telephones'],function(_0x2c3170){return _0x2c3170[_0x605c('0x20')]==_0x5c86a4||_0x2c3170[_0x605c('0x21')]==_0x5c86a4;});if(_0x5c94a3){_0x4b28ee=_['find'](this[_0x605c('0xf')],function(_0x251522){return _0x251522['interface']==util[_0x605c('0x23')](_0x605c('0x24'),_0x5c94a3[_0x605c('0x21')]);});}}return _0x4b28ee;};Report[_0x605c('0x11')][_0x605c('0x14')]=function(_0x363343){for(var _0x22e988=0x0;_0x22e988<_0x363343[_0x605c('0x25')];_0x22e988+=0x1){var _0xe03d6b=this['findAgent'](_0x363343[_0x22e988]['connectedlinenum']);if(_0xe03d6b){_0x363343[_0x22e988][_0x605c('0x20')]=_0xe03d6b['accountcode'];_0x363343[_0x22e988][_0x605c('0x26')]=!![];_0x363343[_0x22e988]['lastAssignedTo']=_0xe03d6b[_0x605c('0x21')];_0x363343[_0x22e988]['interface']=_[_0x605c('0x22')](_0xe03d6b[_0x605c('0x27')])?util[_0x605c('0x23')](_0x605c('0x24'),_0xe03d6b[_0x605c('0x21')]):_0xe03d6b[_0x605c('0x27')];if(_0x363343[_0x22e988][_0x605c('0x28')]){_0x363343[_0x22e988][_0x605c('0x29')]=moment()[_0x605c('0x23')](_0x605c('0x2a'));}if(_0x363343[_0x22e988][_0x605c('0x2b')]){_0x363343[_0x22e988]['queuecallerexitAt']=moment()[_0x605c('0x23')](_0x605c('0x2a'));}RpcMemberReport[_0x605c('0x14')](_0x363343[_0x22e988]);}RpcVoiceQueueReport[_0x605c('0x2c')](_0x363343[_0x22e988]);}};function extractCalleridNumber(_0x1dd179){var _0x168c51=_0x1dd179[_0x605c('0x2d')](/<(.*?)>/);return _0x168c51?_0x168c51[0x1]:_0x1dd179;}Report[_0x605c('0x11')][_0x605c('0x17')]=function(_0x4175ee){_0x4175ee[_0x605c('0x2e')]=_0x4175ee[_0x605c('0x2e')]||_0x4175ee['exten'];if(_0x4175ee['type']=='dialer'){_0x4175ee['lastapplication']=_0x605c('0x2f');_0x4175ee[_0x605c('0x30')]=_0x4175ee[_0x605c('0x2f')];if(_0x4175ee[_0x605c('0x31')]==_0x605c('0x32')){_0x4175ee[_0x605c('0x20')]='';_0x4175ee[_0x605c('0x2e')]=extractCalleridNumber(_0x4175ee[_0x605c('0x33')]);}else if(_0x4175ee[_0x605c('0x31')]==_0x605c('0x34')){if(_0x4175ee['destination']==_0x605c('0x35')){_0x4175ee[_0x605c('0x2e')]=extractCalleridNumber(_0x4175ee[_0x605c('0x36')]);_0x4175ee[_0x605c('0x37')]=_0x4175ee[_0x605c('0x38')];_0x4175ee[_0x605c('0x39')]=[_0x4175ee['channel'],_0x4175ee[_0x605c('0x3a')]=_0x4175ee[_0x605c('0x39')]][0x0];_0x4175ee[_0x605c('0x33')]=_0x4175ee[_0x605c('0x36')];}else{_0x4175ee[_0x605c('0x2e')]=_0x4175ee['calleridnum'];_0x4175ee[_0x605c('0x37')]=_0x4175ee[_0x605c('0x38')];if(_0x4175ee['disposition']==_0x605c('0x3b')){_0x4175ee[_0x605c('0x20')]=_0x4175ee[_0x605c('0x3c')];}else{_0x4175ee['accountcode']='';}}}}else{_0x4175ee['callerid']=util[_0x605c('0x23')]('\x22%s\x22\x20<%s>',_0x4175ee[_0x605c('0x3d')],_0x4175ee['calleridnum']);}RpcVoiceCallReport[_0x605c('0x2c')](_0x4175ee);if(_0x4175ee[_0x605c('0x3e')]){for(var _0x45f84c=0x0;_0x45f84c<_0x4175ee['monitors']['length'];_0x45f84c+=0x1){_0x4175ee['monitorFilename']=_0x4175ee[_0x605c('0x3f')][_0x45f84c]['filename'];_0x4175ee[_0x605c('0x40')]=_0x4175ee[_0x605c('0x3f')][_0x45f84c]['createdAt'];if(_0x4175ee[_0x605c('0x41')]==_0x605c('0x35')){_0x4175ee[_0x605c('0x37')]=_0x4175ee[_0x605c('0x3c')];_0x4175ee['calleridname']=_0x4175ee[_0x605c('0x42')];_0x4175ee[_0x605c('0x3c')]=_0x4175ee[_0x605c('0x20')];_0x4175ee[_0x605c('0x42')]=_0x4175ee[_0x605c('0x43')];_0x4175ee[_0x605c('0x41')]=_0x4175ee['originatecalleridnum'];}else if(_0x4175ee['exten']==_0x605c('0x44')){_0x4175ee['calleridnum']=_0x4175ee[_0x605c('0x2e')];_0x4175ee[_0x605c('0x41')]=_0x4175ee[_0x605c('0x38')];}RpcVoiceRecording[_0x605c('0x2c')](_0x4175ee);}}};Report[_0x605c('0x11')][_0x605c('0x45')]=function(_0x4d43a8){if(_['isArray'](_0x4d43a8)){_0x4d43a8[_0x605c('0x46')](function(_0x4550ac){RpcVoiceAgentReport[_0x605c('0x2c')](_0x4550ac);});}else{RpcVoiceAgentReport[_0x605c('0x2c')](_0x4d43a8);}};Report[_0x605c('0x11')][_0x605c('0x1a')]=function(_0x4af057){RpcVoiceDialReport[_0x605c('0x2c')](_0x4af057);var _0x454a63=undefined;var _0xd0b86a=_0x4af057[_0x605c('0x3a')];if(_[_0x605c('0x47')](_0xd0b86a,_0x605c('0x48'))){var _0x8f403c=_0xd0b86a[_0x605c('0x49')](_0xd0b86a[_0x605c('0x4a')]('/')+0x1,_0xd0b86a[_0x605c('0x4a')]('@'));_0x454a63=_[_0x605c('0x1f')](this[_0x605c('0xf')],function(_0x53dd21){return _0x53dd21[_0x605c('0x4b')]==_0x8f403c||_0x53dd21[_0x605c('0x4c')]==_0x8f403c||_0x53dd21['accountcode']==_0x8f403c;});}else{var _0x8f403c=_0xd0b86a[_0x605c('0x49')](_0xd0b86a[_0x605c('0x4a')]('/')+0x1,_0xd0b86a['lastIndexOf']('-'));_0x454a63=this[_0x605c('0x4d')](_0x8f403c);}if(_0x454a63){_0x4af057[_0x605c('0x27')]=_[_0x605c('0x22')](_0x454a63['interface'])?util[_0x605c('0x23')]('SIP/%s',_0x454a63[_0x605c('0x21')]):_0x454a63[_0x605c('0x27')];_0x4af057['membername']=_0x454a63[_0x605c('0x21')];_0x4af057[_0x605c('0x20')]=_0x454a63[_0x605c('0x20')];RpcMemberReport[_0x605c('0x1a')](_0x4af057);}};Report[_0x605c('0x11')]['blindTransfer']=function(_0x134654){RpcVoiceTransferReport[_0x605c('0x1c')](_0x134654);};Report[_0x605c('0x11')][_0x605c('0x1e')]=function(_0x16cbed){RpcVoiceTransferReport[_0x605c('0x1e')](_0x16cbed);};module[_0x605c('0x4e')]=Report; \ No newline at end of file +var _0x027c=['moment','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','findAgent','find','accountcode','isNil','interface','format','SIP/%s','name','length','connectedlinenum','assigned','lastAssignedTo','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','type','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','destinationchannel','channel','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','monitors','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceDialReport','startsWith','Local','indexOf','mobile','phone','lastIndexOf','attendedTransfer','exports','lodash'];(function(_0x1dda86,_0x1262df){var _0xda5a78=function(_0xe59f63){while(--_0xe59f63){_0x1dda86['push'](_0x1dda86['shift']());}};_0xda5a78(++_0x1262df);}(_0x027c,0x1e5));var _0xc027=function(_0xa86109,_0xade7cf){_0xa86109=_0xa86109-0x0;var _0x13af7e=_0x027c[_0xa86109];return _0x13af7e;};'use strict';var BPromise=require('bluebird');var _=require(_0xc027('0x0'));var moment=require(_0xc027('0x1'));var util=require(_0xc027('0x2'));var config=require(_0xc027('0x3'));var logger=require(_0xc027('0x4'))('ami');var ami=require(_0xc027('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc027('0x6'));var RpcMemberReport=require(_0xc027('0x7'));var RpcVoiceQueueReport=require(_0xc027('0x8'));var RpcVoiceRecording=require(_0xc027('0x9'));var RpcVoiceTransferReport=require(_0xc027('0xa'));var VoiceQueueReport=require(_0xc027('0xb'));var VoiceCallReport=require(_0xc027('0xc'));var VoiceAgentReport=require(_0xc027('0xd'));var VoiceDialReport=require(_0xc027('0xe'));var UserReport=require(_0xc027('0xf'));function Report(_0x978c01){this[_0xc027('0x10')]=_0x978c01;this[_0xc027('0x11')]=_0x978c01[_0xc027('0x11')];this[_0xc027('0x12')]=_0x978c01[_0xc027('0x12')];}Report[_0xc027('0x13')][_0xc027('0x14')]=function(_0x794e8d){var _0x2c6de1=new VoiceQueueReport(this[_0xc027('0x10')]);var _0x55611e=new VoiceAgentReport(this['realtime']);var _0x22e37f=new VoiceDialReport(this['realtime']);var _0x1bc3da=new VoiceCallReport(this['realtime']);var _0x1ffa9f=new UserReport(this[_0xc027('0x10')]);if(config[_0xc027('0x15')]&&config[_0xc027('0x15')][_0xc027('0x16')]){ami['on']('custom:voiceQueueReport',this[_0xc027('0x17')][_0xc027('0x18')](this));ami['on'](_0xc027('0x19'),this[_0xc027('0x1a')][_0xc027('0x18')](this));ami['on'](_0xc027('0x1b'),this[_0xc027('0x1c')][_0xc027('0x18')](this));ami['on'](_0xc027('0x1d'),this['voiceDialReport']['bind'](this));ami['on'](_0xc027('0x1e'),this[_0xc027('0x1f')][_0xc027('0x18')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xc027('0x18')](this));}};Report[_0xc027('0x13')][_0xc027('0x20')]=function(_0x3b904b){var _0x728a4d=undefined;_0x728a4d=_[_0xc027('0x21')](this[_0xc027('0x11')],function(_0x5dbb49){return _0x5dbb49[_0xc027('0x22')]==_0x3b904b||_0x5dbb49['name']==_0x3b904b;});if(_[_0xc027('0x23')](_0x728a4d)){var _0x1a8a1e=_[_0xc027('0x21')](this['telephones'],function(_0x5348f7){return _0x5348f7[_0xc027('0x22')]==_0x3b904b||_0x5348f7['name']==_0x3b904b;});if(_0x1a8a1e){_0x728a4d=_[_0xc027('0x21')](this[_0xc027('0x11')],function(_0x231182){return _0x231182[_0xc027('0x24')]==util[_0xc027('0x25')](_0xc027('0x26'),_0x1a8a1e[_0xc027('0x27')]);});}}return _0x728a4d;};Report['prototype']['voiceQueueReport']=function(_0x345d13){for(var _0x100128=0x0;_0x100128<_0x345d13[_0xc027('0x28')];_0x100128+=0x1){var _0x56cb4c=this[_0xc027('0x20')](_0x345d13[_0x100128][_0xc027('0x29')]);if(_0x56cb4c){_0x345d13[_0x100128][_0xc027('0x22')]=_0x56cb4c['accountcode'];_0x345d13[_0x100128][_0xc027('0x2a')]=!![];_0x345d13[_0x100128][_0xc027('0x2b')]=_0x56cb4c[_0xc027('0x27')];_0x345d13[_0x100128][_0xc027('0x24')]=_[_0xc027('0x23')](_0x56cb4c[_0xc027('0x24')])?util['format'](_0xc027('0x26'),_0x56cb4c[_0xc027('0x27')]):_0x56cb4c['interface'];if(_0x345d13[_0x100128]['queuecallercomplete']){_0x345d13[_0x100128]['queuecallercompleteAt']=moment()['format'](_0xc027('0x2c'));}if(_0x345d13[_0x100128][_0xc027('0x2d')]){_0x345d13[_0x100128][_0xc027('0x2e')]=moment()[_0xc027('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc027('0x17')](_0x345d13[_0x100128]);}RpcVoiceQueueReport[_0xc027('0x2f')](_0x345d13[_0x100128]);}};function extractCalleridNumber(_0x3c5ec4){var _0x3adc4c=_0x3c5ec4[_0xc027('0x30')](/<(.*?)>/);return _0x3adc4c?_0x3adc4c[0x1]:_0x3c5ec4;}Report[_0xc027('0x13')]['voiceCallReport']=function(_0x302f2a){_0x302f2a[_0xc027('0x31')]=_0x302f2a['destination']||_0x302f2a['exten'];if(_0x302f2a[_0xc027('0x32')]=='dialer'){_0x302f2a['lastapplication']=_0xc027('0x33');_0x302f2a[_0xc027('0x34')]=_0x302f2a[_0xc027('0x33')];if(_0x302f2a[_0xc027('0x35')]==_0xc027('0x36')){_0x302f2a[_0xc027('0x22')]='';_0x302f2a[_0xc027('0x31')]=extractCalleridNumber(_0x302f2a[_0xc027('0x37')]);}else if(_0x302f2a[_0xc027('0x35')]==_0xc027('0x38')){if(_0x302f2a[_0xc027('0x31')]==_0xc027('0x39')){_0x302f2a[_0xc027('0x31')]=extractCalleridNumber(_0x302f2a['calleridpreview']);_0x302f2a[_0xc027('0x3a')]=_0x302f2a['originatecalleridnum'];_0x302f2a[_0xc027('0x3b')]=[_0x302f2a[_0xc027('0x3c')],_0x302f2a['channel']=_0x302f2a[_0xc027('0x3b')]][0x0];_0x302f2a[_0xc027('0x37')]=_0x302f2a['calleridpreview'];}else{_0x302f2a[_0xc027('0x31')]=_0x302f2a[_0xc027('0x3a')];_0x302f2a['calleridnum']=_0x302f2a[_0xc027('0x3d')];if(_0x302f2a[_0xc027('0x3e')]=='ANSWERED'){_0x302f2a[_0xc027('0x22')]=_0x302f2a[_0xc027('0x29')];}else{_0x302f2a[_0xc027('0x22')]='';}}}}else{_0x302f2a['callerid']=util[_0xc027('0x25')](_0xc027('0x3f'),_0x302f2a[_0xc027('0x40')],_0x302f2a[_0xc027('0x3a')]);}RpcVoiceCallReport['create'](_0x302f2a);if(_0x302f2a['monitor']){for(var _0xdbdf4b=0x0;_0xdbdf4b<_0x302f2a[_0xc027('0x41')]['length'];_0xdbdf4b+=0x1){_0x302f2a['monitorFilename']=_0x302f2a[_0xc027('0x41')][_0xdbdf4b][_0xc027('0x42')];_0x302f2a[_0xc027('0x43')]=_0x302f2a[_0xc027('0x41')][_0xdbdf4b][_0xc027('0x43')];if(_0x302f2a[_0xc027('0x44')]==_0xc027('0x39')){_0x302f2a[_0xc027('0x3a')]=_0x302f2a[_0xc027('0x29')];_0x302f2a[_0xc027('0x40')]=_0x302f2a[_0xc027('0x45')];_0x302f2a[_0xc027('0x29')]=_0x302f2a[_0xc027('0x22')];_0x302f2a[_0xc027('0x45')]=_0x302f2a[_0xc027('0x46')];_0x302f2a['exten']=_0x302f2a['originatecalleridnum'];}else if(_0x302f2a[_0xc027('0x44')]==_0xc027('0x47')){_0x302f2a['calleridnum']=_0x302f2a[_0xc027('0x31')];_0x302f2a[_0xc027('0x44')]=_0x302f2a[_0xc027('0x3d')];}RpcVoiceRecording[_0xc027('0x2f')](_0x302f2a);}}};Report['prototype'][_0xc027('0x1c')]=function(_0x2f9e87){if(_['isArray'](_0x2f9e87)){_0x2f9e87['forEach'](function(_0xd8349f){RpcVoiceAgentReport['create'](_0xd8349f);});}else{RpcVoiceAgentReport[_0xc027('0x2f')](_0x2f9e87);}};Report[_0xc027('0x13')][_0xc027('0x48')]=function(_0x2bb4c4){RpcVoiceDialReport[_0xc027('0x2f')](_0x2bb4c4);var _0x1b233e=undefined;var _0x2e3117=_0x2bb4c4['channel'];if(_[_0xc027('0x49')](_0x2e3117,_0xc027('0x4a'))){var _0x2b48a7=_0x2e3117['substring'](_0x2e3117[_0xc027('0x4b')]('/')+0x1,_0x2e3117[_0xc027('0x4b')]('@'));_0x1b233e=_[_0xc027('0x21')](this['agents'],function(_0x2e645e){return _0x2e645e[_0xc027('0x4c')]==_0x2b48a7||_0x2e645e[_0xc027('0x4d')]==_0x2b48a7||_0x2e645e[_0xc027('0x22')]==_0x2b48a7;});}else{var _0x2b48a7=_0x2e3117['substring'](_0x2e3117[_0xc027('0x4b')]('/')+0x1,_0x2e3117[_0xc027('0x4e')]('-'));_0x1b233e=this[_0xc027('0x20')](_0x2b48a7);}if(_0x1b233e){_0x2bb4c4['interface']=_[_0xc027('0x23')](_0x1b233e[_0xc027('0x24')])?util['format'](_0xc027('0x26'),_0x1b233e[_0xc027('0x27')]):_0x1b233e[_0xc027('0x24')];_0x2bb4c4[_0xc027('0x46')]=_0x1b233e[_0xc027('0x27')];_0x2bb4c4[_0xc027('0x22')]=_0x1b233e['accountcode'];RpcMemberReport[_0xc027('0x48')](_0x2bb4c4);}};Report[_0xc027('0x13')][_0xc027('0x1f')]=function(_0x4914c1){RpcVoiceTransferReport[_0xc027('0x1f')](_0x4914c1);};Report[_0xc027('0x13')][_0xc027('0x4f')]=function(_0x5ed29c){RpcVoiceTransferReport[_0xc027('0x4f')](_0x5ed29c);};module[_0xc027('0x50')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 2d6d753..ad71148 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 _0x557b=['format','telephone:%s','startsWith','Queue','Local','substring','indexOf','mobile','phone','updateStatusRealtime','[syncDeviceState][UserReport]','peer','registered','status','address','name','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','isNotNull','isUndefined','emit','find','username','stateRegistry','merge','actionid','state','trunk:%s','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','toNumber'];(function(_0xb4947e,_0x39de27){var _0x2af6df=function(_0x308271){while(--_0x308271){_0xb4947e['push'](_0xb4947e['shift']());}};_0x2af6df(++_0x39de27);}(_0x557b,0x97));var _0xb557=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x557b[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0xb557('0x0'));var moment=require(_0xb557('0x1'));var BPromise=require(_0xb557('0x2'));var util=require(_0xb557('0x3'));var Redis=require(_0xb557('0x4'));var config=require('../../../config/environment');var logger=require(_0xb557('0x5'))(_0xb557('0x6'));var ami=require('../ami');config[_0xb557('0x7')]=_[_0xb557('0x8')](config[_0xb557('0x7')],{'host':_0xb557('0x9'),'port':0x18eb});var io=require(_0xb557('0xa'))(new Redis(config[_0xb557('0x7')]));function UserReport(_0x1b5178){this['trunks']=_0x1b5178[_0xb557('0xb')];this[_0xb557('0xc')]=_0x1b5178[_0xb557('0xc')];this[_0xb557('0xd')]=_0x1b5178[_0xb557('0xd')];ami['on']('registryentry',this[_0xb557('0xe')][_0xb557('0xf')](this));ami['on'](_0xb557('0x10'),this[_0xb557('0xe')][_0xb557('0xf')](this));ami['on'](_0xb557('0x11'),this[_0xb557('0x12')][_0xb557('0xf')](this));ami['on'](_0xb557('0x13'),this[_0xb557('0x14')][_0xb557('0xf')](this));this[_0xb557('0x15')]();return BPromise[_0xb557('0x16')]()[_0xb557('0x17')](ami[_0xb557('0x18')]())[_0xb557('0x17')](ami[_0xb557('0x19')]())[_0xb557('0x17')](ami[_0xb557('0x1a')]())[_0xb557('0x1b')](loggerCatch(_0xb557('0x1c')));}function loggerCatch(_0x50c6dc){return function(_0x2d1749){logger[_0xb557('0x1d')](_0x50c6dc,util[_0xb557('0x1e')](_0x2d1749,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0xb557('0x15')]=function(){setInterval(function(){BPromise[_0xb557('0x16')]()['then'](ami[_0xb557('0x18')]())[_0xb557('0x17')](ami[_0xb557('0x19')]())[_0xb557('0x17')](ami['actionSipPeerStatus']())[_0xb557('0x1b')](loggerCatch(_0xb557('0x1c')));},0x32c8);};UserReport[_0xb557('0x1f')][_0xb557('0x20')]=function(_0x497ccd){return _0x497ccd!==null&&!_[_0xb557('0x21')](_0x497ccd);};UserReport['prototype'][_0xb557('0x22')]=function(_0x2b1ab3,_0x4c2f80,_0xa28f6d){io['to'](_0x2b1ab3)[_0xb557('0x22')](_0x4c2f80,_0xa28f6d);};UserReport[_0xb557('0x1f')]['syncRegistry']=function(_0x59958e){try{if(this[_0xb557('0x20')](_0x59958e)){var _0x67d527=_[_0xb557('0x23')](this['trunks'],{'registry':_0x59958e[_0xb557('0x24')]});if(_0x67d527){_0x59958e[_0xb557('0x25')]=_0x59958e['state'];_[_0xb557('0x26')](_0x67d527,_['omit'](_0x59958e,['event',_0xb557('0x27'),_0xb557('0x24'),_0xb557('0x28')]));this['emit'](util['format'](_0xb557('0x29'),_0x67d527['name']),_0xb557('0x2a'),_0x67d527);}}}catch(_0x5762e5){logger[_0xb557('0x1d')](_0xb557('0x2b'),util[_0xb557('0x1e')](_0x5762e5,{'showHidden':![],'depth':null}));}};UserReport[_0xb557('0x1f')][_0xb557('0x12')]=function(_0x4ec5d6){try{if(this[_0xb557('0x20')](_0x4ec5d6)){if(this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]]){if(!this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x2d')]||_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()==_0xb557('0x2f')){this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x2d')]=![];if(this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x28')]!==_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()){this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x30')]=_[_0xb557('0x31')](moment()['format']('x'));}this['agents'][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x28')]=_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]();this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]]['updateStatusRealtime'](_0x4ec5d6);}}else if(this['telephones'][_0x4ec5d6['device']]){if(this[_0xb557('0xd')][_0x4ec5d6['device']][_0xb557('0x28')]!==_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()){this[_0xb557('0xd')][_0x4ec5d6[_0xb557('0x2c')]]['stateTime']=_['toNumber'](moment()[_0xb557('0x32')]('x'));}this[_0xb557('0xd')][_0x4ec5d6[_0xb557('0x2c')]]['state']=_0x4ec5d6[_0xb557('0x28')]['toLowerCase']();this[_0xb557('0x22')](util[_0xb557('0x32')](_0xb557('0x33'),this['telephones'][_0x4ec5d6['device']]['name']),'telephone:save',this['telephones'][_0x4ec5d6['device']]);}else if(this['trunks'][_0x4ec5d6[_0xb557('0x2c')]]){if(this[_0xb557('0xb')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x28')]!==_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()){this[_0xb557('0xb')][_0x4ec5d6['device']][_0xb557('0x30')]=_[_0xb557('0x31')](moment()[_0xb557('0x32')]('x'));}this[_0xb557('0xb')][_0x4ec5d6[_0xb557('0x2c')]]['state']=_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]();this[_0xb557('0x22')](util['format'](_0xb557('0x29'),this[_0xb557('0xb')][_0x4ec5d6['device']]['name']),_0xb557('0x2a'),this[_0xb557('0xb')][_0x4ec5d6[_0xb557('0x2c')]]);}else if(_[_0xb557('0x34')](_0x4ec5d6[_0xb557('0x2c')],_0xb557('0x35'))){}else if(_[_0xb557('0x34')](_0x4ec5d6[_0xb557('0x2c')],_0xb557('0x36'))){var _0xff831d=_0x4ec5d6['device'];var _0x34c2fb=_0xff831d[_0xb557('0x37')](_0xff831d['indexOf']('/')+0x1,_0xff831d[_0xb557('0x38')]('@'));var _0x43edf4=_['find'](this['agents'],function(_0x2cdbe1){return _0x2cdbe1[_0xb557('0x39')]==_0x34c2fb||_0x2cdbe1[_0xb557('0x3a')]==_0x34c2fb||_0x2cdbe1['accountcode']==_0x34c2fb;});if(_0x43edf4){if(_0x43edf4[_0xb557('0x28')]!==_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()){_0x43edf4[_0xb557('0x30')]=_[_0xb557('0x31')](moment()[_0xb557('0x32')]('x'));}_0x43edf4[_0xb557('0x28')]=_0x4ec5d6['state'][_0xb557('0x2e')]();_0x43edf4[_0xb557('0x2d')]=!![];_0x43edf4[_0xb557('0x3b')](_0x4ec5d6);}}else{}}}catch(_0x2a6222){logger[_0xb557('0x1d')](_0xb557('0x3c'),util[_0xb557('0x1e')](_0x2a6222,{'showHidden':![],'depth':null}));}};UserReport[_0xb557('0x1f')][_0xb557('0x14')]=function(_0x1623fc){try{if(this['isNotNull'](_0x1623fc)&&this[_0xb557('0x20')](_0x1623fc[_0xb557('0x13')])){if(this[_0xb557('0xc')][_0x1623fc['peer']]){if(!this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]]['local']||_0x1623fc[_0xb557('0x13')][_0xb557('0x2e')]()==_0xb557('0x3e')){this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x2d')]=![];this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x3f')]=_0x1623fc[_0xb557('0x13')][_0xb557('0x2e')]();this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x40')]=_0x1623fc[_0xb557('0x40')];this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x3b')](_0x1623fc);}}else if(this[_0xb557('0xd')][_0x1623fc['peer']]){this['telephones'][_0x1623fc['peer']][_0xb557('0x3f')]=_0x1623fc['peerstatus']['toLowerCase']();this[_0xb557('0xd')][_0x1623fc[_0xb557('0x3d')]]['address']=_0x1623fc[_0xb557('0x40')];this['emit'](util['format'](_0xb557('0x33'),this[_0xb557('0xd')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x41')]),'telephone:save',this[_0xb557('0xd')][_0x1623fc[_0xb557('0x3d')]]);}else if(this[_0xb557('0xb')][_0x1623fc['peer']]){this[_0xb557('0xb')][_0x1623fc[_0xb557('0x3d')]]['status']=_0x1623fc['peerstatus'][_0xb557('0x2e')]();this[_0xb557('0xb')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x40')]=_0x1623fc['address'];this[_0xb557('0x22')](util[_0xb557('0x32')](_0xb557('0x29'),this[_0xb557('0xb')][_0x1623fc[_0xb557('0x3d')]]['name']),_0xb557('0x2a'),this[_0xb557('0xb')][_0x1623fc[_0xb557('0x3d')]]);}else{}}}catch(_0x3405d3){logger[_0xb557('0x1d')](_0xb557('0x42'),util[_0xb557('0x1e')](_0x3405d3,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x3152=['redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','actionDeviceStateList','catch','prototype','isNotNull','isUndefined','emit','username','state','event','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','stateTime','toNumber','format','updateStatusRealtime','telephone:save','trunk:%s','startsWith','Queue','Local','substring','indexOf','find','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','telephone:%s','[syncPeerStatus][UserReport]','exports','moment','bluebird','util','ioredis','../../../config/logger','ami','../ami'];(function(_0x2bc2f8,_0x5d446f){var _0x4a839d=function(_0x114a89){while(--_0x114a89){_0x2bc2f8['push'](_0x2bc2f8['shift']());}};_0x4a839d(++_0x5d446f);}(_0x3152,0xb9));var _0x2315=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3152[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var moment=require(_0x2315('0x0'));var BPromise=require(_0x2315('0x1'));var util=require(_0x2315('0x2'));var Redis=require(_0x2315('0x3'));var config=require('../../../config/environment');var logger=require(_0x2315('0x4'))(_0x2315('0x5'));var ami=require(_0x2315('0x6'));config[_0x2315('0x7')]=_[_0x2315('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2315('0x9'))(new Redis(config[_0x2315('0x7')]));function UserReport(_0x2bde0b){this[_0x2315('0xa')]=_0x2bde0b['trunks'];this[_0x2315('0xb')]=_0x2bde0b[_0x2315('0xb')];this[_0x2315('0xc')]=_0x2bde0b[_0x2315('0xc')];ami['on'](_0x2315('0xd'),this[_0x2315('0xe')]['bind'](this));ami['on'](_0x2315('0xf'),this[_0x2315('0xe')]['bind'](this));ami['on'](_0x2315('0x10'),this[_0x2315('0x11')]['bind'](this));ami['on'](_0x2315('0x12'),this[_0x2315('0x13')]['bind'](this));this[_0x2315('0x14')]();return BPromise[_0x2315('0x15')]()[_0x2315('0x16')](ami[_0x2315('0x17')]())['then'](ami['actionDeviceStateList']())[_0x2315('0x16')](ami[_0x2315('0x18')]())['catch'](loggerCatch(_0x2315('0x19')));}function loggerCatch(_0x31dc7c){return function(_0x4441ce){logger[_0x2315('0x1a')](_0x31dc7c,util[_0x2315('0x1b')](_0x4441ce,{'showHidden':![],'depth':null}));};}UserReport['prototype']['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0x2315('0x15')]()[_0x2315('0x16')](ami[_0x2315('0x17')]())[_0x2315('0x16')](ami[_0x2315('0x1c')]())[_0x2315('0x16')](ami[_0x2315('0x18')]())[_0x2315('0x1d')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0x2315('0x1e')][_0x2315('0x1f')]=function(_0x13b365){return _0x13b365!==null&&!_[_0x2315('0x20')](_0x13b365);};UserReport[_0x2315('0x1e')][_0x2315('0x21')]=function(_0x4f9b32,_0x9ed065,_0xf66614){io['to'](_0x4f9b32)[_0x2315('0x21')](_0x9ed065,_0xf66614);};UserReport['prototype'][_0x2315('0xe')]=function(_0x41ff3a){try{if(this['isNotNull'](_0x41ff3a)){var _0x3ca418=_['find'](this['trunks'],{'registry':_0x41ff3a[_0x2315('0x22')]});if(_0x3ca418){_0x41ff3a['stateRegistry']=_0x41ff3a[_0x2315('0x23')];_['merge'](_0x3ca418,_['omit'](_0x41ff3a,[_0x2315('0x24'),'actionid',_0x2315('0x22'),'state']));this[_0x2315('0x21')](util['format']('trunk:%s',_0x3ca418[_0x2315('0x25')]),_0x2315('0x26'),_0x3ca418);}}}catch(_0x39d31c){logger[_0x2315('0x1a')](_0x2315('0x27'),util[_0x2315('0x1b')](_0x39d31c,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x2315('0x11')]=function(_0x13cec7){try{if(this[_0x2315('0x1f')](_0x13cec7)){if(this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]]){if(!this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x29')]||_0x13cec7[_0x2315('0x23')][_0x2315('0x2a')]()=='inuse'){this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x29')]=![];if(this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]]['state']!==_0x13cec7['state'][_0x2315('0x2a')]()){this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x2b')]=_[_0x2315('0x2c')](moment()[_0x2315('0x2d')]('x'));}this[_0x2315('0xb')][_0x13cec7['device']][_0x2315('0x23')]=_0x13cec7['state'][_0x2315('0x2a')]();this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x2e')](_0x13cec7);}}else if(this['telephones'][_0x13cec7['device']]){if(this[_0x2315('0xc')][_0x13cec7['device']][_0x2315('0x23')]!==_0x13cec7['state']['toLowerCase']()){this[_0x2315('0xc')][_0x13cec7[_0x2315('0x28')]]['stateTime']=_[_0x2315('0x2c')](moment()['format']('x'));}this[_0x2315('0xc')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x23')]=_0x13cec7[_0x2315('0x23')]['toLowerCase']();this[_0x2315('0x21')](util[_0x2315('0x2d')]('telephone:%s',this[_0x2315('0xc')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x25')]),_0x2315('0x2f'),this['telephones'][_0x13cec7['device']]);}else if(this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]]){if(this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x23')]!==_0x13cec7[_0x2315('0x23')][_0x2315('0x2a')]()){this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x2b')]=_[_0x2315('0x2c')](moment()[_0x2315('0x2d')]('x'));}this[_0x2315('0xa')][_0x13cec7['device']][_0x2315('0x23')]=_0x13cec7['state'][_0x2315('0x2a')]();this[_0x2315('0x21')](util[_0x2315('0x2d')](_0x2315('0x30'),this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x25')]),_0x2315('0x26'),this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]]);}else if(_[_0x2315('0x31')](_0x13cec7[_0x2315('0x28')],_0x2315('0x32'))){}else if(_[_0x2315('0x31')](_0x13cec7[_0x2315('0x28')],_0x2315('0x33'))){var _0x5b9b24=_0x13cec7['device'];var _0x355927=_0x5b9b24[_0x2315('0x34')](_0x5b9b24[_0x2315('0x35')]('/')+0x1,_0x5b9b24[_0x2315('0x35')]('@'));var _0x4a831f=_[_0x2315('0x36')](this[_0x2315('0xb')],function(_0x109ffd){return _0x109ffd['mobile']==_0x355927||_0x109ffd['phone']==_0x355927||_0x109ffd[_0x2315('0x37')]==_0x355927;});if(_0x4a831f){if(_0x4a831f[_0x2315('0x23')]!==_0x13cec7['state'][_0x2315('0x2a')]()){_0x4a831f['stateTime']=_[_0x2315('0x2c')](moment()[_0x2315('0x2d')]('x'));}_0x4a831f[_0x2315('0x23')]=_0x13cec7[_0x2315('0x23')]['toLowerCase']();_0x4a831f[_0x2315('0x29')]=!![];_0x4a831f['updateStatusRealtime'](_0x13cec7);}}else{}}}catch(_0x29da66){logger[_0x2315('0x1a')](_0x2315('0x38'),util[_0x2315('0x1b')](_0x29da66,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x2315('0x13')]=function(_0x28324a){try{if(this[_0x2315('0x1f')](_0x28324a)&&this[_0x2315('0x1f')](_0x28324a[_0x2315('0x12')])){if(this[_0x2315('0xb')][_0x28324a[_0x2315('0x39')]]){if(!this['agents'][_0x28324a['peer']][_0x2315('0x29')]||_0x28324a[_0x2315('0x12')]['toLowerCase']()==_0x2315('0x3a')){this['agents'][_0x28324a[_0x2315('0x39')]]['local']=![];this[_0x2315('0xb')][_0x28324a['peer']][_0x2315('0x3b')]=_0x28324a['peerstatus'][_0x2315('0x2a')]();this[_0x2315('0xb')][_0x28324a['peer']][_0x2315('0x3c')]=_0x28324a[_0x2315('0x3c')];this[_0x2315('0xb')][_0x28324a[_0x2315('0x39')]][_0x2315('0x2e')](_0x28324a);}}else if(this['telephones'][_0x28324a[_0x2315('0x39')]]){this['telephones'][_0x28324a[_0x2315('0x39')]][_0x2315('0x3b')]=_0x28324a[_0x2315('0x12')][_0x2315('0x2a')]();this[_0x2315('0xc')][_0x28324a[_0x2315('0x39')]][_0x2315('0x3c')]=_0x28324a['address'];this[_0x2315('0x21')](util['format'](_0x2315('0x3d'),this[_0x2315('0xc')][_0x28324a['peer']][_0x2315('0x25')]),'telephone:save',this['telephones'][_0x28324a[_0x2315('0x39')]]);}else if(this[_0x2315('0xa')][_0x28324a[_0x2315('0x39')]]){this['trunks'][_0x28324a[_0x2315('0x39')]][_0x2315('0x3b')]=_0x28324a[_0x2315('0x12')][_0x2315('0x2a')]();this[_0x2315('0xa')][_0x28324a[_0x2315('0x39')]][_0x2315('0x3c')]=_0x28324a[_0x2315('0x3c')];this[_0x2315('0x21')](util[_0x2315('0x2d')]('trunk:%s',this[_0x2315('0xa')][_0x28324a[_0x2315('0x39')]][_0x2315('0x25')]),_0x2315('0x26'),this[_0x2315('0xa')][_0x28324a[_0x2315('0x39')]]);}else{}}}catch(_0x1bd740){logger[_0x2315('0x1a')](_0x2315('0x3e'),util[_0x2315('0x1b')](_0x1bd740,{'showHidden':![],'depth':null}));}};module[_0x2315('0x3f')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 95c15d7..e71464e 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 _0x0df6=['membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','agentconnectAt','agentcompleteAt','complete','talktime','transfer','agent','acw','agentacw','acwtime','acwTimeout','destconnectedlinenum','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','variable','value','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','syncMusicOnHoldStart','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','privilege','custom:agentcalled','user:%s'];(function(_0x527712,_0xada768){var _0x38f82e=function(_0xd68bfd){while(--_0xd68bfd){_0x527712['push'](_0x527712['shift']());}};_0x38f82e(++_0xada768);}(_0x0df6,0x1d4));var _0x60df=function(_0x714d39,_0x26aa78){_0x714d39=_0x714d39-0x0;var _0x1f4e96=_0x0df6[_0x714d39];return _0x1f4e96;};'use strict';var _=require(_0x60df('0x0'));var moment=require(_0x60df('0x1'));var util=require(_0x60df('0x2'));var Redis=require(_0x60df('0x3'));var config=require('../../../config/environment');var logger=require(_0x60df('0x4'))(_0x60df('0x5'));var ami=require(_0x60df('0x6'));config[_0x60df('0x7')]=_[_0x60df('0x8')](config[_0x60df('0x7')],{'host':_0x60df('0x9'),'port':0x18eb});var io=require(_0x60df('0xa'))(new Redis(config[_0x60df('0x7')]));function VoiceAgentReport(_0x30fe76){this[_0x60df('0xb')]={};this[_0x60df('0xc')]=_0x30fe76[_0x60df('0xc')];this[_0x60df('0xd')]=_0x30fe76[_0x60df('0xd')];this[_0x60df('0xe')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x60df('0xf')](this));ami['on'](_0x60df('0x10'),this[_0x60df('0x11')][_0x60df('0xf')](this));ami['on'](_0x60df('0x12'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x60df('0x13'),this[_0x60df('0x14')]['bind'](this));ami['on'](_0x60df('0x15'),this[_0x60df('0x16')][_0x60df('0xf')](this));ami['on'](_0x60df('0x17'),this[_0x60df('0x18')]['bind'](this));ami['on']('hangup',this[_0x60df('0x19')][_0x60df('0xf')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x60df('0xf')](this));ami['on'](_0x60df('0x1a'),this[_0x60df('0x1b')][_0x60df('0xf')](this));ami['on']('attendedtransfer',this[_0x60df('0x1c')][_0x60df('0xf')](this));ami['on'](_0x60df('0x1d'),this[_0x60df('0x1e')][_0x60df('0xf')](this));}VoiceAgentReport[_0x60df('0x1f')]['emit']=function(_0x5c7efa,_0x2bf441,_0x13a627){io['to'](_0x5c7efa)[_0x60df('0x20')](_0x2bf441,_0x13a627);};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x21')]=function(_0xca8ee6){return _0xca8ee6!==null&&!_[_0x60df('0x22')](_0xca8ee6);};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x23')]=function(_0xfcb84c){try{if(this[_0x60df('0x21')](_0xfcb84c)){if(_[_0x60df('0x22')](this[_0x60df('0xb')][_0xfcb84c['uniqueid']])){this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]]={};}if(_[_0x60df('0x22')](this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c[_0x60df('0x25')]])){this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c[_0x60df('0x25')]]={'agentcalledAt':moment()[_0x60df('0x26')](_0x60df('0x27')),'lastevent':_0x60df('0x28'),'variables':this[_0x60df('0xe')][_0xfcb84c[_0x60df('0x24')]],'type':this['voiceQueues'][_0xfcb84c[_0x60df('0x29')]]?this[_0x60df('0xc')][_0xfcb84c['queue']]['type']||_0x60df('0x2a'):_0x60df('0x2a')};}_[_0x60df('0x2b')](this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c[_0x60df('0x25')]],_[_0x60df('0x2c')](_0xfcb84c,['event',_0x60df('0x2d')]));ami['emit'](_0x60df('0x2e'),this['channels'][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c['destuniqueid']]);this[_0x60df('0x20')](util['format'](_0x60df('0x2f'),_0xfcb84c[_0x60df('0x30')]),_0x60df('0x31'),this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c[_0x60df('0x25')]]);}}catch(_0x1ddb02){logger[_0x60df('0x32')](_0x60df('0x33'),util[_0x60df('0x34')](_0x1ddb02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x11')]=function(_0x11c7be){try{if(this[_0x60df('0x21')](_0x11c7be)){if(this[_0x60df('0xb')][_0x11c7be['uniqueid']]){for(var _0x3242b0 in this['channels'][_0x11c7be['uniqueid']]){if(this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]]['hasOwnProperty'](_0x3242b0)){if(_0x11c7be[_0x60df('0x25')]===_0x3242b0){this[_0x60df('0xb')][_0x11c7be['uniqueid']][_0x3242b0]['agentconnectAt']=moment()[_0x60df('0x26')](_0x60df('0x27'));this['channels'][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x35')]=_0x60df('0x36');this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x37')]=_0x11c7be[_0x60df('0x37')];this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x38')]=_0x11c7be[_0x60df('0x38')];this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x39')]=_0x11c7be[_0x60df('0x39')];this[_0x60df('0xb')][_0x11c7be['uniqueid']][_0x3242b0][_0x60df('0x3a')]=_0x11c7be[_0x60df('0x3a')];this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x3b')]=_0x11c7be[_0x60df('0x3b')];_[_0x60df('0x2b')](this['agents'][_0x11c7be[_0x60df('0x3c')]],_[_0x60df('0x3d')](_0x11c7be,[_0x60df('0x29'),'destconnectedlinenum']));this['emit'](util[_0x60df('0x26')](_0x60df('0x2f'),_0x11c7be['membername']),_0x60df('0x3e'),this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x11c7be[_0x60df('0x25')]]);ami[_0x60df('0x20')]('custom:agentconnect',this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0]);}else if(!this[_0x60df('0xb')][_0x11c7be['uniqueid']][_0x3242b0]['agentringnoanswer']&&!this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0]['agentcomplete']){this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0]['agentringnoanswer']=!![];this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x3f')]=moment()[_0x60df('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x60df('0xb')][_0x11c7be['uniqueid']][_0x3242b0][_0x60df('0x40')]='answered_elsewhere';this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x35')]=_0x60df('0x41');this['channels'][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x42')]=_0x11c7be[_0x60df('0x25')];this['channels'][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x43')]=_0x11c7be[_0x60df('0x30')];ami['emit'](_0x60df('0x44'),this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0]);}}}}}}catch(_0x3b3ad0){logger[_0x60df('0x32')](_0x60df('0x45'),util['inspect'](_0x3b3ad0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x60df('0x46')]=function(_0x394441){try{if(this['isNotNull'](_0x394441)){if(this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]]&&this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]][_0x394441['destuniqueid']]){this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]][_0x394441['destuniqueid']][_0x60df('0x12')]=!![];this['channels'][_0x394441[_0x60df('0x24')]][_0x394441[_0x60df('0x25')]][_0x60df('0x3f')]=moment()[_0x60df('0x26')](_0x60df('0x27'));this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]][_0x394441['destuniqueid']][_0x60df('0x40')]=_0x60df('0x47');this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]][_0x394441[_0x60df('0x25')]][_0x60df('0x35')]=_0x60df('0x47');ami[_0x60df('0x20')](_0x60df('0x48'),this['channels'][_0x394441['uniqueid']][_0x394441['destuniqueid']]);}}}catch(_0x2eccd3){logger[_0x60df('0x32')](_0x60df('0x49'),util[_0x60df('0x34')](_0x2eccd3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x14')]=function(_0x2cbb4c){try{if(this['isNotNull'](_0x2cbb4c)){if(this['channels'][_0x2cbb4c[_0x60df('0x24')]]){for(var _0x332247 in this['channels'][_0x2cbb4c[_0x60df('0x24')]]){if(this[_0x60df('0xb')][_0x2cbb4c['uniqueid']][_0x60df('0x4a')](_0x332247)&&!this['channels'][_0x2cbb4c[_0x60df('0x24')]][_0x332247]['agentringnoanswer']&&!this[_0x60df('0xb')][_0x2cbb4c[_0x60df('0x24')]][_0x332247][_0x60df('0x15')]){this[_0x60df('0xb')][_0x2cbb4c[_0x60df('0x24')]][_0x332247][_0x60df('0x12')]=!![];this['channels'][_0x2cbb4c[_0x60df('0x24')]][_0x332247][_0x60df('0x3f')]=moment()[_0x60df('0x26')](_0x60df('0x27'));this[_0x60df('0xb')][_0x2cbb4c['uniqueid']][_0x332247][_0x60df('0x40')]=_0x60df('0x4b');this[_0x60df('0xb')][_0x2cbb4c[_0x60df('0x24')]][_0x332247][_0x60df('0x35')]=_0x60df('0x4b');ami[_0x60df('0x20')]('custom:agentqueuecallerabandon',this['channels'][_0x2cbb4c['uniqueid']][_0x332247]);}}}}}catch(_0x470056){logger[_0x60df('0x32')](_0x60df('0x4c'),util[_0x60df('0x34')](_0x470056,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')]['syncAgentComplete']=function(_0x4c9712){try{if(this[_0x60df('0x21')](_0x4c9712)){if(this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]]){for(var _0x19bf8d in this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]]){if(this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x60df('0x4a')](_0x19bf8d)){if(this['channels'][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x4d')]&&!this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x15')]){this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x15')]=!![];this[_0x60df('0xb')][_0x4c9712['uniqueid']][_0x19bf8d][_0x60df('0x4e')]=moment()[_0x60df('0x26')](_0x60df('0x27'));this['channels'][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x35')]=_0x60df('0x4f');this['channels'][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x50')]=_0x4c9712[_0x60df('0x50')];this['channels'][_0x4c9712[_0x60df('0x24')]][_0x19bf8d]['reason']=_0x4c9712[_0x60df('0x40')]==_0x60df('0x51')?_0x60df('0x52'):_0x4c9712[_0x60df('0x40')];if(this[_0x60df('0xc')][_0x4c9712[_0x60df('0x29')]]&&this[_0x60df('0xc')][_0x4c9712[_0x60df('0x29')]][_0x60df('0x53')]){this[_0x60df('0xb')][_0x4c9712['uniqueid']][_0x19bf8d][_0x60df('0x54')]=!![];this['channels'][_0x4c9712['uniqueid']][_0x19bf8d][_0x60df('0x55')]=this[_0x60df('0xc')][_0x4c9712['queue']][_0x60df('0x56')];}this['agents'][_0x4c9712['interface']]=_[_0x60df('0x2c')](this[_0x60df('0xd')][_0x4c9712[_0x60df('0x3c')]],['queue',_0x60df('0x57')]);this[_0x60df('0x20')](util['format']('user:%s',_0x4c9712[_0x60df('0x30')]),_0x60df('0x58'),this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x19bf8d]);ami[_0x60df('0x20')]('custom:agentcomplete',this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x19bf8d]);}}}}}}catch(_0xfc1a23){logger['error'](_0x60df('0x59'),util[_0x60df('0x34')](_0xfc1a23,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x18')]=function(_0x94595d){try{if(this['isNotNull'](_0x94595d)){this['addVariable'](_0x94595d[_0x60df('0x24')],_[_0x60df('0x5a')](_0x94595d[_0x60df('0x5b')])[0x0],_0x94595d[_0x60df('0x5c')]);if(this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]]){for(var _0x5cd907 in this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]]){if(this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]][_0x60df('0x4a')](_0x5cd907)){if(_[_0x60df('0x22')](this[_0x60df('0xb')][_0x94595d['uniqueid']][_0x5cd907][_0x60df('0xe')])){this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]][_0x5cd907][_0x60df('0xe')]={};}this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]][_0x5cd907]['variables']=this['variables'][_0x94595d['uniqueid']];}}}}}catch(_0x47725c){logger['error']('[syncVarSet][VoiceAgentReport]',util[_0x60df('0x34')](_0x47725c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x5d')]=function(_0x2c7f14,_0x3e8c10,_0xabb907){var _0x5500ed=[_0x60df('0x5e'),_0x60df('0x5f'),_0x60df('0x60'),_0x60df('0x61'),_0x60df('0x62'),_0x60df('0x63'),_0x60df('0x64'),_0x60df('0x65'),_0x60df('0x66'),_0x60df('0x67'),_0x60df('0x68'),'bridgepvtcallid',_0x60df('0x69'),_0x60df('0x6a'),_0x60df('0x6b'),'memberlastcall',_0x60df('0x30'),_0x60df('0x6c'),'memberrealtime'];if(!_[_0x60df('0x6d')](_0x3e8c10)&&!_[_0x60df('0x6e')](_0x5500ed,_0x3e8c10)){if(_[_0x60df('0x22')](this['variables'][_0x2c7f14])){this[_0x60df('0xe')][_0x2c7f14]={};}this[_0x60df('0xe')][_0x2c7f14][_0x3e8c10]=_0xabb907;}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x19')]=function(_0x3ebb85){try{if(this[_0x60df('0x21')](_0x3ebb85)){if(this[_0x60df('0xb')][_0x3ebb85['uniqueid']]){for(var _0x2f3d5e in this[_0x60df('0xb')][_0x3ebb85[_0x60df('0x24')]]){if(this[_0x60df('0xb')][_0x3ebb85['uniqueid']]['hasOwnProperty'](_0x2f3d5e)){if(this[_0x60df('0xb')][_0x3ebb85['uniqueid']][_0x2f3d5e]['reason']==_0x60df('0x51')&&this[_0x60df('0xb')][_0x3ebb85[_0x60df('0x24')]][_0x2f3d5e]['agentcomplete']){this['channels'][_0x3ebb85['uniqueid']][_0x2f3d5e][_0x60df('0x4e')]=moment()[_0x60df('0x26')](_0x60df('0x27'));}}}ami[_0x60df('0x20')](_0x60df('0x6f'),_[_0x60df('0x70')](this[_0x60df('0xb')][_0x3ebb85['uniqueid']]));delete this[_0x60df('0xb')][_0x3ebb85['uniqueid']];}if(this[_0x60df('0xe')][_0x3ebb85['uniqueid']]){delete this[_0x60df('0xe')][_0x3ebb85[_0x60df('0x24')]];}}}catch(_0x140627){logger[_0x60df('0x32')](_0x60df('0x71'),util[_0x60df('0x34')](_0x140627,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x60df('0x1c')]=function(_0x47019e){try{if(this[_0x60df('0x21')](_0x47019e)){if(this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]]){for(var _0x2f17e3 in this['channels'][_0x47019e[_0x60df('0x72')]]){if(this[_0x60df('0xb')][_0x47019e['transfereeuniqueid']][_0x60df('0x4a')](_0x2f17e3)){if(_0x47019e[_0x60df('0x73')]===_0x2f17e3){var _0x34ec77=moment();this[_0x60df('0xb')][_0x47019e['transfereeuniqueid']][_0x2f17e3][_0x60df('0x15')]=!![];this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]][_0x2f17e3][_0x60df('0x4e')]=moment()[_0x60df('0x26')](_0x60df('0x27'));this['channels'][_0x47019e['transfereeuniqueid']][_0x2f17e3][_0x60df('0x40')]=_0x60df('0x51');this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]][_0x2f17e3][_0x60df('0x35')]='complete';this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]][_0x2f17e3]['talktime']=_0x34ec77[_0x60df('0x74')](this[_0x60df('0xb')][_0x47019e['transfereeuniqueid']][_0x2f17e3]['agentconnectAt'],_0x60df('0x75'));}}}}if(this[_0x60df('0xb')][_0x47019e[_0x60df('0x76')]]){var _0xc65ddc=this[_0x60df('0xb')][_0x47019e[_0x60df('0x76')]];this['channels'][_0x47019e['secondtransfereruniqueid']]=this['channels'][_0x47019e['transfereeuniqueid']];this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]]=_0xc65ddc;}}}catch(_0x52073f){logger['error'](_0x60df('0x77'),util['inspect'](_0x52073f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x1e')]=function(_0x29d552){try{if(this[_0x60df('0x21')](_0x29d552)){if(this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]]){for(var _0x105380 in this['channels'][_0x29d552[_0x60df('0x72')]]){if(this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x60df('0x4a')](_0x105380)){if(_0x29d552[_0x60df('0x78')]===_0x105380){var _0x579bd8=moment();this['channels'][_0x29d552['transfereeuniqueid']][_0x105380][_0x60df('0x15')]=!![];this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380]['agentcompleteAt']=_0x579bd8;this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380][_0x60df('0x40')]=_0x60df('0x51');this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380]['lastevent']='complete';this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380]['talktime']=_0x579bd8[_0x60df('0x74')](this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380][_0x60df('0x4d')],_0x60df('0x75'));}}}}}}catch(_0x104017){logger[_0x60df('0x32')]('[syncBlindTransfer][VoiceAgentReport]',util['inspect'](_0x104017,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x79')]=function(_0xe90749){var _0x47fd3f='';try{if(this[_0x60df('0x21')](_0xe90749)){if(_0xe90749[_0x60df('0x7a')]){_0x47fd3f=_0xe90749[_0x60df('0x7a')][_0x60df('0x7b')](0x0,_0xe90749[_0x60df('0x7a')]['lastIndexOf']('-'));if(this['agents'][_0x47fd3f]){this[_0x60df('0xd')][_0x47fd3f][_0x60df('0x7c')]=!![];}}}}catch(_0x4f8200){logger['error'](_0x60df('0x7d'),util[_0x60df('0x34')](_0x4f8200,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x1b')]=function(_0x4c971b){var _0x59811b='';try{if(this['isNotNull'](_0x4c971b)){if(_0x4c971b[_0x60df('0x7a')]){_0x59811b=_0x4c971b['channel'][_0x60df('0x7b')](0x0,_0x4c971b[_0x60df('0x7a')][_0x60df('0x7e')]('-'));if(this['agents'][_0x59811b]){this[_0x60df('0xd')][_0x59811b][_0x60df('0x7c')]=![];}}}}catch(_0x3553cc){logger['error'](_0x60df('0x7f'),util['inspect'](_0x3553cc,{'showHidden':![],'depth':null}));}};module[_0x60df('0x80')]=VoiceAgentReport; \ No newline at end of file +var _0x56da=['varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','queue','inbound','merge','omit','event','privilege','user:%s','user:called','inspect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','pick','membername','user:agentconnect','custom:agentconnect','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','error','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','complete','talktime','transfer','acw','agentacw','acwtime','acwTimeout','interface','user:agentcomplete','custom:agentcomplete','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','isNil','includes','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','agentcompleteAt','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','syncMusicOnHoldStart','channel','substring','lastIndexOf','onhold','exports','lodash','ioredis','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete'];(function(_0x340d72,_0x14f789){var _0x5e8885=function(_0x242d17){while(--_0x242d17){_0x340d72['push'](_0x340d72['shift']());}};_0x5e8885(++_0x14f789);}(_0x56da,0xdb));var _0xa56d=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x56da[_0x2d1971];return _0x4d7759;};'use strict';var _=require(_0xa56d('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0xa56d('0x1'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xa56d('0x2'));var ami=require(_0xa56d('0x3'));config['redis']=_['defaults'](config[_0xa56d('0x4')],{'host':_0xa56d('0x5'),'port':0x18eb});var io=require(_0xa56d('0x6'))(new Redis(config[_0xa56d('0x4')]));function VoiceAgentReport(_0x58808f){this[_0xa56d('0x7')]={};this[_0xa56d('0x8')]=_0x58808f['voiceQueues'];this['agents']=_0x58808f[_0xa56d('0x9')];this[_0xa56d('0xa')]={};ami['on'](_0xa56d('0xb'),this[_0xa56d('0xc')]['bind'](this));ami['on'](_0xa56d('0xd'),this[_0xa56d('0xe')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x10'),this['syncAgentRingNoAnswer'][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x11'),this[_0xa56d('0x12')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x13'),this[_0xa56d('0x14')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x15'),this[_0xa56d('0x16')][_0xa56d('0xf')](this));ami['on']('hangup',this[_0xa56d('0x17')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x18'),this['syncMusicOnHoldStart'][_0xa56d('0xf')](this));ami['on']('musiconholdstop',this[_0xa56d('0x19')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x1a'),this['syncAttendedTransfer'][_0xa56d('0xf')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xa56d('0xf')](this));}VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x1c')]=function(_0x10dc42,_0x5ddcdb,_0xcf53){io['to'](_0x10dc42)[_0xa56d('0x1c')](_0x5ddcdb,_0xcf53);};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x1d')]=function(_0x5a86ec){return _0x5a86ec!==null&&!_[_0xa56d('0x1e')](_0x5a86ec);};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0xc')]=function(_0x16e659){try{if(this[_0xa56d('0x1d')](_0x16e659)){if(_[_0xa56d('0x1e')](this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]])){this['channels'][_0x16e659[_0xa56d('0x1f')]]={};}if(_[_0xa56d('0x1e')](this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]][_0x16e659[_0xa56d('0x20')]])){this['channels'][_0x16e659[_0xa56d('0x1f')]][_0x16e659['destuniqueid']]={'agentcalledAt':moment()[_0xa56d('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','variables':this[_0xa56d('0xa')][_0x16e659[_0xa56d('0x1f')]],'type':this['voiceQueues'][_0x16e659[_0xa56d('0x22')]]?this[_0xa56d('0x8')][_0x16e659[_0xa56d('0x22')]]['type']||_0xa56d('0x23'):'inbound'};}_[_0xa56d('0x24')](this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]][_0x16e659[_0xa56d('0x20')]],_[_0xa56d('0x25')](_0x16e659,[_0xa56d('0x26'),_0xa56d('0x27')]));ami['emit']('custom:agentcalled',this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]][_0x16e659[_0xa56d('0x20')]]);this[_0xa56d('0x1c')](util[_0xa56d('0x21')](_0xa56d('0x28'),_0x16e659['membername']),_0xa56d('0x29'),this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]][_0x16e659[_0xa56d('0x20')]]);}}catch(_0x41b1e2){logger['error']('[syncAgentCalled][VoiceAgentReport]',util[_0xa56d('0x2a')](_0x41b1e2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0xe')]=function(_0x2627fa){try{if(this[_0xa56d('0x1d')](_0x2627fa)){if(this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]]){for(var _0x11cfe3 in this['channels'][_0x2627fa[_0xa56d('0x1f')]]){if(this[_0xa56d('0x7')][_0x2627fa['uniqueid']]['hasOwnProperty'](_0x11cfe3)){if(_0x2627fa[_0xa56d('0x20')]===_0x11cfe3){this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3][_0xa56d('0x2b')]=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x2d')]=_0xa56d('0x2e');this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x2f')]=_0x2627fa[_0xa56d('0x2f')];this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x30')]=_0x2627fa[_0xa56d('0x30')];this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x31')]=_0x2627fa[_0xa56d('0x31')];this['channels'][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x32')]=_0x2627fa[_0xa56d('0x32')];this['channels'][_0x2627fa['uniqueid']][_0x11cfe3]['destchannelstatedesc']=_0x2627fa['destchannelstatedesc'];_[_0xa56d('0x24')](this['agents'][_0x2627fa['interface']],_[_0xa56d('0x33')](_0x2627fa,[_0xa56d('0x22'),'destconnectedlinenum']));this[_0xa56d('0x1c')](util['format']('user:%s',_0x2627fa[_0xa56d('0x34')]),_0xa56d('0x35'),this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x2627fa[_0xa56d('0x20')]]);ami[_0xa56d('0x1c')](_0xa56d('0x36'),this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3]);}else if(!this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3][_0xa56d('0x10')]&&!this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x13')]){this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3]['agentringnoanswer']=!![];this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3]['agentringnoanswerAt']=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x37')]=_0xa56d('0x38');this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x2d')]=_0xa56d('0x38');this['channels'][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x39')]=_0x2627fa[_0xa56d('0x20')];this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x3a')]=_0x2627fa[_0xa56d('0x34')];ami[_0xa56d('0x1c')](_0xa56d('0x3b'),this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3]);}}}}}}catch(_0x27942d){logger[_0xa56d('0x3c')](_0xa56d('0x3d'),util[_0xa56d('0x2a')](_0x27942d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa56d('0x3e')]=function(_0x301e80){try{if(this['isNotNull'](_0x301e80)){if(this[_0xa56d('0x7')][_0x301e80['uniqueid']]&&this[_0xa56d('0x7')][_0x301e80['uniqueid']][_0x301e80[_0xa56d('0x20')]]){this[_0xa56d('0x7')][_0x301e80['uniqueid']][_0x301e80[_0xa56d('0x20')]][_0xa56d('0x10')]=!![];this[_0xa56d('0x7')][_0x301e80[_0xa56d('0x1f')]][_0x301e80[_0xa56d('0x20')]][_0xa56d('0x3f')]=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x301e80[_0xa56d('0x1f')]][_0x301e80[_0xa56d('0x20')]][_0xa56d('0x37')]=_0xa56d('0x40');this[_0xa56d('0x7')][_0x301e80[_0xa56d('0x1f')]][_0x301e80[_0xa56d('0x20')]][_0xa56d('0x2d')]=_0xa56d('0x40');ami[_0xa56d('0x1c')](_0xa56d('0x41'),this[_0xa56d('0x7')][_0x301e80[_0xa56d('0x1f')]][_0x301e80[_0xa56d('0x20')]]);}}}catch(_0x58c445){logger[_0xa56d('0x3c')](_0xa56d('0x42'),util[_0xa56d('0x2a')](_0x58c445,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa56d('0x12')]=function(_0x543434){try{if(this[_0xa56d('0x1d')](_0x543434)){if(this['channels'][_0x543434['uniqueid']]){for(var _0x4b51e9 in this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]]){if(this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0xa56d('0x43')](_0x4b51e9)&&!this['channels'][_0x543434[_0xa56d('0x1f')]][_0x4b51e9]['agentringnoanswer']&&!this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0x4b51e9][_0xa56d('0x13')]){this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0x4b51e9][_0xa56d('0x10')]=!![];this[_0xa56d('0x7')][_0x543434['uniqueid']][_0x4b51e9][_0xa56d('0x3f')]=moment()['format'](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0x4b51e9]['reason']=_0xa56d('0x44');this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0x4b51e9][_0xa56d('0x2d')]=_0xa56d('0x44');ami['emit'](_0xa56d('0x45'),this['channels'][_0x543434['uniqueid']][_0x4b51e9]);}}}}}catch(_0x40f5c2){logger[_0xa56d('0x3c')](_0xa56d('0x46'),util['inspect'](_0x40f5c2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x14')]=function(_0x4eddc5){try{if(this['isNotNull'](_0x4eddc5)){if(this['channels'][_0x4eddc5[_0xa56d('0x1f')]]){for(var _0x17771a in this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]]){if(this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0xa56d('0x43')](_0x17771a)){if(this['channels'][_0x4eddc5['uniqueid']][_0x17771a][_0xa56d('0x2b')]&&!this[_0xa56d('0x7')][_0x4eddc5['uniqueid']][_0x17771a]['agentcomplete']){this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a][_0xa56d('0x13')]=!![];this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a]['agentcompleteAt']=moment()[_0xa56d('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa56d('0x7')][_0x4eddc5['uniqueid']][_0x17771a][_0xa56d('0x2d')]=_0xa56d('0x47');this[_0xa56d('0x7')][_0x4eddc5['uniqueid']][_0x17771a][_0xa56d('0x48')]=_0x4eddc5[_0xa56d('0x48')];this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a][_0xa56d('0x37')]=_0x4eddc5[_0xa56d('0x37')]==_0xa56d('0x49')?'agent':_0x4eddc5['reason'];if(this[_0xa56d('0x8')][_0x4eddc5[_0xa56d('0x22')]]&&this['voiceQueues'][_0x4eddc5[_0xa56d('0x22')]][_0xa56d('0x4a')]){this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a][_0xa56d('0x4b')]=!![];this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a][_0xa56d('0x4c')]=this[_0xa56d('0x8')][_0x4eddc5['queue']][_0xa56d('0x4d')];}this[_0xa56d('0x9')][_0x4eddc5[_0xa56d('0x4e')]]=_[_0xa56d('0x25')](this[_0xa56d('0x9')][_0x4eddc5['interface']],['queue','destconnectedlinenum']);this[_0xa56d('0x1c')](util['format'](_0xa56d('0x28'),_0x4eddc5['membername']),_0xa56d('0x4f'),this[_0xa56d('0x7')][_0x4eddc5['uniqueid']][_0x17771a]);ami[_0xa56d('0x1c')](_0xa56d('0x50'),this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a]);}}}}}}catch(_0x355575){logger[_0xa56d('0x3c')]('[syncAgentComplete][VoiceAgentReport]',util[_0xa56d('0x2a')](_0x355575,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x16')]=function(_0x4f2f67){try{if(this[_0xa56d('0x1d')](_0x4f2f67)){this[_0xa56d('0x51')](_0x4f2f67[_0xa56d('0x1f')],_[_0xa56d('0x52')](_0x4f2f67[_0xa56d('0x53')])[0x0],_0x4f2f67[_0xa56d('0x54')]);if(this['channels'][_0x4f2f67[_0xa56d('0x1f')]]){for(var _0x35d138 in this[_0xa56d('0x7')][_0x4f2f67[_0xa56d('0x1f')]]){if(this[_0xa56d('0x7')][_0x4f2f67['uniqueid']]['hasOwnProperty'](_0x35d138)){if(_[_0xa56d('0x1e')](this[_0xa56d('0x7')][_0x4f2f67[_0xa56d('0x1f')]][_0x35d138][_0xa56d('0xa')])){this['channels'][_0x4f2f67[_0xa56d('0x1f')]][_0x35d138]['variables']={};}this[_0xa56d('0x7')][_0x4f2f67[_0xa56d('0x1f')]][_0x35d138][_0xa56d('0xa')]=this[_0xa56d('0xa')][_0x4f2f67[_0xa56d('0x1f')]];}}}}}catch(_0x24f8eb){logger['error'](_0xa56d('0x55'),util[_0xa56d('0x2a')](_0x24f8eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa56d('0x51')]=function(_0x223f8a,_0x1a20f9,_0x389f77){var _0x4b9a55=[_0xa56d('0x56'),_0xa56d('0x57'),_0xa56d('0x58'),_0xa56d('0x59'),_0xa56d('0x5a'),_0xa56d('0x5b'),_0xa56d('0x5c'),_0xa56d('0x5d'),_0xa56d('0x5e'),_0xa56d('0x5f'),'bridgepeer',_0xa56d('0x60'),_0xa56d('0x61'),_0xa56d('0x62'),'memberinterface',_0xa56d('0x63'),'membername',_0xa56d('0x64'),'memberrealtime'];if(!_[_0xa56d('0x65')](_0x1a20f9)&&!_[_0xa56d('0x66')](_0x4b9a55,_0x1a20f9)){if(_[_0xa56d('0x1e')](this[_0xa56d('0xa')][_0x223f8a])){this[_0xa56d('0xa')][_0x223f8a]={};}this[_0xa56d('0xa')][_0x223f8a][_0x1a20f9]=_0x389f77;}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x17')]=function(_0x3f2ad2){try{if(this[_0xa56d('0x1d')](_0x3f2ad2)){if(this[_0xa56d('0x7')][_0x3f2ad2[_0xa56d('0x1f')]]){for(var _0x19b5e0 in this[_0xa56d('0x7')][_0x3f2ad2['uniqueid']]){if(this[_0xa56d('0x7')][_0x3f2ad2['uniqueid']][_0xa56d('0x43')](_0x19b5e0)){if(this[_0xa56d('0x7')][_0x3f2ad2[_0xa56d('0x1f')]][_0x19b5e0][_0xa56d('0x37')]==_0xa56d('0x49')&&this[_0xa56d('0x7')][_0x3f2ad2['uniqueid']][_0x19b5e0][_0xa56d('0x13')]){this['channels'][_0x3f2ad2[_0xa56d('0x1f')]][_0x19b5e0]['agentcompleteAt']=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));}}}ami['emit']('custom:voiceAgentReport',_['values'](this['channels'][_0x3f2ad2[_0xa56d('0x1f')]]));delete this[_0xa56d('0x7')][_0x3f2ad2[_0xa56d('0x1f')]];}if(this[_0xa56d('0xa')][_0x3f2ad2[_0xa56d('0x1f')]]){delete this[_0xa56d('0xa')][_0x3f2ad2[_0xa56d('0x1f')]];}}}catch(_0x3347e5){logger[_0xa56d('0x3c')](_0xa56d('0x67'),util['inspect'](_0x3347e5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa56d('0x68')]=function(_0x103033){try{if(this[_0xa56d('0x1d')](_0x103033)){if(this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]]){for(var _0x243783 in this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]]){if(this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0xa56d('0x43')](_0x243783)){if(_0x103033[_0xa56d('0x6a')]===_0x243783){var _0x48c86d=moment();this['channels'][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x13')]=!![];this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x6b')]=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0x243783]['reason']=_0xa56d('0x49');this['channels'][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x2d')]=_0xa56d('0x47');this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x48')]=_0x48c86d[_0xa56d('0x6c')](this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x2b')],_0xa56d('0x6d'));}}}}if(this['channels'][_0x103033[_0xa56d('0x6e')]]){var _0x38f30f=this['channels'][_0x103033['secondtransfereruniqueid']];this[_0xa56d('0x7')][_0x103033[_0xa56d('0x6e')]]=this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]];this[_0xa56d('0x7')][_0x103033['transfereeuniqueid']]=_0x38f30f;}}}catch(_0xe9225c){logger[_0xa56d('0x3c')](_0xa56d('0x6f'),util['inspect'](_0xe9225c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x70')]=function(_0x47edee){try{if(this[_0xa56d('0x1d')](_0x47edee)){if(this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]]){for(var _0x70a592 in this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]]){if(this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]][_0xa56d('0x43')](_0x70a592)){if(_0x47edee[_0xa56d('0x71')]===_0x70a592){var _0x8a2230=moment();this['channels'][_0x47edee[_0xa56d('0x69')]][_0x70a592][_0xa56d('0x13')]=!![];this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]][_0x70a592]['agentcompleteAt']=_0x8a2230;this['channels'][_0x47edee[_0xa56d('0x69')]][_0x70a592][_0xa56d('0x37')]=_0xa56d('0x49');this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]][_0x70a592]['lastevent']=_0xa56d('0x47');this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]][_0x70a592]['talktime']=_0x8a2230[_0xa56d('0x6c')](this['channels'][_0x47edee['transfereeuniqueid']][_0x70a592][_0xa56d('0x2b')],_0xa56d('0x6d'));}}}}}}catch(_0x5bfad6){logger[_0xa56d('0x3c')]('[syncBlindTransfer][VoiceAgentReport]',util[_0xa56d('0x2a')](_0x5bfad6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x72')]=function(_0x41df2c){var _0x320ff7='';try{if(this[_0xa56d('0x1d')](_0x41df2c)){if(_0x41df2c['channel']){_0x320ff7=_0x41df2c[_0xa56d('0x73')][_0xa56d('0x74')](0x0,_0x41df2c[_0xa56d('0x73')][_0xa56d('0x75')]('-'));if(this[_0xa56d('0x9')][_0x320ff7]){this[_0xa56d('0x9')][_0x320ff7][_0xa56d('0x76')]=!![];}}}}catch(_0x424b63){logger[_0xa56d('0x3c')]('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0xa56d('0x2a')](_0x424b63,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x19')]=function(_0x5383a8){var _0x2630a1='';try{if(this[_0xa56d('0x1d')](_0x5383a8)){if(_0x5383a8[_0xa56d('0x73')]){_0x2630a1=_0x5383a8[_0xa56d('0x73')][_0xa56d('0x74')](0x0,_0x5383a8[_0xa56d('0x73')][_0xa56d('0x75')]('-'));if(this[_0xa56d('0x9')][_0x2630a1]){this[_0xa56d('0x9')][_0x2630a1][_0xa56d('0x76')]=![];}}}}catch(_0x4633e5){logger[_0xa56d('0x3c')]('[syncMusicOnHoldStop][VoiceAgentReport]',util['inspect'](_0x4633e5,{'showHidden':![],'depth':null}));}};module[_0xa56d('0x77')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 9ffb7fe..d15598f 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 _0xa306=['BlindTransfer','transfererchannel','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','playback','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','syncNewState','varset','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','resolve','then','actionCoreShowChannels','catch','isNotNull','isUndefined','prototype','emit','linkedid','uniqueid','keys','error','inspect','channel','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','merge','pick','context','split','destconnectedlinenum','exten','format','user:%s','[syncNewChannel][VoiceCallReport]','OutgoingSpoolFailed','application','appdata','applicationdata','toLowerCase','duration','seconds','lastapplication','startsWith','match','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','name','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','syncVarSet','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','answertime','from-sip','accountcode','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0xa306,0x1cf));var _0x6a30=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xa306[_0x5cb1af];return _0x8d7940;};'use strict';var BPromise=require(_0x6a30('0x0'));var _=require(_0x6a30('0x1'));var moment=require(_0x6a30('0x2'));var util=require('util');var path=require(_0x6a30('0x3'));var Redis=require('ioredis');var config=require(_0x6a30('0x4'));var logger=require(_0x6a30('0x5'))(_0x6a30('0x6'));var ami=require(_0x6a30('0x7'));var Channel=require(_0x6a30('0x8'));var statusDesc=[_0x6a30('0x9'),_0x6a30('0xa'),_0x6a30('0xb'),_0x6a30('0xc'),_0x6a30('0xd'),'unavailable',_0x6a30('0xe'),_0x6a30('0xf'),_0x6a30('0x10')];var applications=[_0x6a30('0x11'),_0x6a30('0x12'),_0x6a30('0x13'),'dial',_0x6a30('0x14'),_0x6a30('0x15')];var dispositions=['NO\x20ANSWER','FAILED',_0x6a30('0x16'),_0x6a30('0x17'),_0x6a30('0x17'),'NO\x20ANSWER','ANSWERED',_0x6a30('0x18'),'FAILED',_0x6a30('0x16'),'FAILED'];var actions={};config[_0x6a30('0x19')]=_['defaults'](config[_0x6a30('0x19')],{'host':_0x6a30('0x1a'),'port':0x18eb});var io=require(_0x6a30('0x1b'))(new Redis(config[_0x6a30('0x19')]));function VoiceCallReport(_0x499a2b){this['channels']=_0x499a2b[_0x6a30('0x1c')];this[_0x6a30('0x1d')]=_0x499a2b[_0x6a30('0x1d')];ami['on'](_0x6a30('0x1e'),this[_0x6a30('0x1f')][_0x6a30('0x20')](this));ami['on']('newexten',this[_0x6a30('0x1f')][_0x6a30('0x20')](this));ami['on'](_0x6a30('0x21'),this[_0x6a30('0x22')][_0x6a30('0x20')](this));ami['on']('newstate',this[_0x6a30('0x23')][_0x6a30('0x20')](this));ami['on'](_0x6a30('0x24'),this['syncVarSet'][_0x6a30('0x20')](this));ami['on']('hangup',this[_0x6a30('0x25')]['bind'](this));ami['on'](_0x6a30('0x26'),this[_0x6a30('0x27')]['bind'](this));ami['on'](_0x6a30('0x28'),this['syncAttendedTransfer'][_0x6a30('0x20')](this));ami['on']('blindtransfer',this[_0x6a30('0x29')]['bind'](this));ami['on'](_0x6a30('0x2a'),this[_0x6a30('0x2b')][_0x6a30('0x20')](this));ami['on'](_0x6a30('0x2c'),this['syncMusicOnHoldStop'][_0x6a30('0x20')](this));return BPromise[_0x6a30('0x2d')]()[_0x6a30('0x2e')](ami[_0x6a30('0x2f')]())[_0x6a30('0x30')](function(_0x9961c0){console['log'](_0x9961c0);});}VoiceCallReport['prototype'][_0x6a30('0x31')]=function(_0x1fc5ce){return _0x1fc5ce!==null&&!_[_0x6a30('0x32')](_0x1fc5ce);};VoiceCallReport[_0x6a30('0x33')]['emit']=function(_0x8ac750,_0x393241,_0x30d8a5){io['to'](_0x8ac750)[_0x6a30('0x34')](_0x393241,_0x30d8a5);};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x27')]=function(_0x528884){try{if(this[_0x6a30('0x31')](_0x528884)){if(_0x528884['uniqueid']===_0x528884[_0x6a30('0x35')]){if(!_['isUndefined'](this[_0x6a30('0x1c')][_0x528884[_0x6a30('0x36')]])){_['merge'](this[_0x6a30('0x1c')][_0x528884[_0x6a30('0x36')]],_['pick'](_0x528884,_[_0x6a30('0x37')](this[_0x6a30('0x1c')][_0x528884[_0x6a30('0x36')]])));}}}}catch(_0x55cae0){logger[_0x6a30('0x38')]('[syncNewCallerId][VoiceCallReport]',util[_0x6a30('0x39')](_0x55cae0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x22')]=function(_0x2d510e){try{if(this[_0x6a30('0x31')](_0x2d510e)){if(_0x2d510e[_0x6a30('0x36')]===_0x2d510e[_0x6a30('0x35')]&&_0x2d510e[_0x6a30('0x3a')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0x6a30('0x1c')][_0x2d510e['uniqueid']])){this[_0x6a30('0x1c')][_0x2d510e['uniqueid']]=new Channel();this[_0x6a30('0x1c')][_0x2d510e[_0x6a30('0x36')]][_0x6a30('0x3b')]=moment()['format'](_0x6a30('0x3c'));this[_0x6a30('0x1c')][_0x2d510e[_0x6a30('0x36')]][_0x6a30('0x3d')]=dispositions[_[_0x6a30('0x3e')](_0x2d510e[_0x6a30('0x3f')])];_[_0x6a30('0x40')](this[_0x6a30('0x1c')][_0x2d510e[_0x6a30('0x36')]],_[_0x6a30('0x41')](_0x2d510e,_[_0x6a30('0x37')](this[_0x6a30('0x1c')][_0x2d510e[_0x6a30('0x36')]])));if(_0x2d510e[_0x6a30('0x42')]==='from-sip'){if(this[_0x6a30('0x1d')][_0x2d510e[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]){this[_0x6a30('0x1d')][_0x2d510e['channel'][_0x6a30('0x43')]('-')[0x0]][_0x6a30('0x44')]=_0x2d510e[_0x6a30('0x45')];this[_0x6a30('0x34')](util[_0x6a30('0x46')](_0x6a30('0x47'),this['agents'][_0x2d510e[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0x6a30('0x1d')][_0x2d510e[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2d510e[_0x6a30('0x45')]});}}}}}}catch(_0x4ab403){logger[_0x6a30('0x38')](_0x6a30('0x48'),util[_0x6a30('0x39')](_0x4ab403,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x1f')]=function(_0x45374a){try{if(this[_0x6a30('0x31')](_0x45374a)){if(_0x45374a['uniqueid']===_0x45374a[_0x6a30('0x35')]&&_0x45374a[_0x6a30('0x45')]!='h'&&_0x45374a['channel']!=_0x6a30('0x49')){_0x45374a[_0x6a30('0x4a')]=_0x45374a[_0x6a30('0x4a')]['toLowerCase']();_0x45374a['applicationdata']=(_0x45374a[_0x6a30('0x4b')]||_0x45374a[_0x6a30('0x4c')])[_0x6a30('0x4d')]();if(_[_0x6a30('0x32')](this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]])){this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]]=new Channel();this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]][_0x6a30('0x3b')]=_0x45374a[_0x6a30('0x4e')]?moment()['subtract'](moment[_0x6a30('0x4e')](_0x45374a['duration'])[_0x6a30('0x4f')](),_0x6a30('0x4f'))[_0x6a30('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0x6a30('0x3c'));this['channels'][_0x45374a[_0x6a30('0x36')]]['disposition']='NO\x20ANSWER';}_[_0x6a30('0x40')](this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]],_[_0x6a30('0x41')](_0x45374a,_['keys'](this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]])));if(_['includes'](applications,_0x45374a[_0x6a30('0x4a')])){this['channels'][_0x45374a['uniqueid']][_0x6a30('0x50')]=_0x45374a[_0x6a30('0x4a')];this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]]['lastdata']=_0x45374a['applicationdata'];if(_0x45374a['application']===_0x6a30('0x11')&&_[_0x6a30('0x51')](_0x45374a['applicationdata'],'cdr(')){var _0x1df113=_0x45374a['applicationdata'][_0x6a30('0x43')]('=');var _0x28261f=_0x1df113[0x0][_0x6a30('0x52')](/cdr\((.*)\)/);if(_0x28261f){this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]][_0x28261f[0x1]]=_0x1df113[0x1];}}else if(_0x45374a[_0x6a30('0x4a')]===_0x6a30('0x12')){this[_0x6a30('0x1c')][_0x45374a['uniqueid']][_0x6a30('0x12')]=_0x45374a[_0x6a30('0x4c')][_0x6a30('0x43')](',')[0x0];}}}}}catch(_0x2e771d){logger[_0x6a30('0x38')](_0x6a30('0x53'),util[_0x6a30('0x39')](_0x2e771d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')]['syncNewState']=function(_0x14cf19){try{if(this[_0x6a30('0x31')](_0x14cf19)){if(_0x14cf19[_0x6a30('0x36')]!==_0x14cf19[_0x6a30('0x35')]){if(this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]]){if(_0x14cf19[_0x6a30('0x3f')]==='6'){if(!this[_0x6a30('0x1c')][_0x14cf19['linkedid']][_0x6a30('0x54')]){var _0x45c419=moment();this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x54')]=!![];this['channels'][_0x14cf19['linkedid']]['answertime']=_0x45c419[_0x6a30('0x46')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x6a30('0x1c')][_0x14cf19['linkedid']][_0x6a30('0x3b')]){this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x55')]=_0x45c419[_0x6a30('0x56')](this['channels'][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x3b')],'seconds');}}this[_0x6a30('0x1c')][_0x14cf19['linkedid']][_0x6a30('0x35')]=_0x14cf19['uniqueid'];if(_0x14cf19[_0x6a30('0x57')]!==_0x6a30('0x58')){this['channels'][_0x14cf19['linkedid']][_0x6a30('0x59')]=_0x14cf19[_0x6a30('0x57')];}this['channels'][_0x14cf19['linkedid']][_0x6a30('0x5a')]=_0x14cf19[_0x6a30('0x5b')];this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x5c')]=_0x14cf19[_0x6a30('0x3a')];this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x3d')]=dispositions[_[_0x6a30('0x3e')](_0x14cf19[_0x6a30('0x3f')])];if(this['agents'][_0x14cf19[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]){this['channels'][_0x14cf19['linkedid']][_0x6a30('0x5d')]=this[_0x6a30('0x1d')][_0x14cf19[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]['id'];this['channels'][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x5e')]=this['agents'][_0x14cf19[_0x6a30('0x3a')]['split']('-')[0x0]]['name'];}}}}else{if(this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x36')]]){if(_0x14cf19[_0x6a30('0x3f')]==='6'){if(this[_0x6a30('0x1d')][_0x14cf19['channel'][_0x6a30('0x43')]('-')[0x0]]){this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x36')]]['UserId']=this[_0x6a30('0x1d')][_0x14cf19[_0x6a30('0x3a')]['split']('-')[0x0]]['id'];this['channels'][_0x14cf19['uniqueid']][_0x6a30('0x5e')]=this[_0x6a30('0x1d')][_0x14cf19[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]][_0x6a30('0x5f')];}}}}}}catch(_0x486b08){logger[_0x6a30('0x38')](_0x6a30('0x60'),util[_0x6a30('0x39')](_0x486b08,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x61')]=function(_0x5b4732,_0x332e86){if(this[_0x6a30('0x1c')][_0x5b4732]){this[_0x6a30('0x1c')][_0x5b4732][_0x6a30('0x62')]=!![];if(_[_0x6a30('0x63')](_0x332e86,_0x6a30('0x64'))){_0x332e86=_0x332e86[_0x6a30('0x65')]('.wav49',_0x6a30('0x66'));}this[_0x6a30('0x1c')][_0x5b4732]['monitorFilename']=_0x332e86;var _0x3034f0=_[_0x6a30('0x67')](this[_0x6a30('0x1c')][_0x5b4732][_0x6a30('0x68')],{'filename':_0x332e86});if(_[_0x6a30('0x69')](_0x3034f0)){this[_0x6a30('0x1c')][_0x5b4732][_0x6a30('0x68')][_0x6a30('0x6a')]({'filename':_0x332e86,'createdAt':moment()[_0x6a30('0x46')](_0x6a30('0x3c')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x6b')]=function(_0x52e274){try{if(this[_0x6a30('0x31')](_0x52e274)){if(this[_0x6a30('0x1c')][_0x52e274[_0x6a30('0x36')]]&&_0x52e274[_0x6a30('0x3a')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')])){if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x6d')])){this[_0x6a30('0x61')](_0x52e274[_0x6a30('0x36')],_0x52e274[_0x6a30('0x6e')]);}else if(this['isNotNull'](_0x52e274['variable'][_0x6a30('0x6f')])){this[_0x6a30('0x1c')][_0x52e274[_0x6a30('0x36')]]['calleridnum']=_0x52e274[_0x6a30('0x6e')];}else if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x70')])){this[_0x6a30('0x1c')][_0x52e274[_0x6a30('0x36')]]['callerid']=_0x52e274[_0x6a30('0x6e')];}else if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x71')])){this['channels'][_0x52e274['uniqueid']][_0x6a30('0x72')]=_0x52e274[_0x6a30('0x6e')];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x73')])){this[_0x6a30('0x1c')][_0x52e274['uniqueid']][_0x6a30('0x12')]=_0x52e274[_0x6a30('0x6e')][_0x6a30('0x43')](',')[0x0];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x74')])){this['channels'][_0x52e274[_0x6a30('0x36')]][_0x6a30('0x75')]=_0x52e274[_0x6a30('0x6e')];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x76')])){this[_0x6a30('0x1c')][_0x52e274[_0x6a30('0x36')]][_0x6a30('0x77')]=_0x52e274[_0x6a30('0x6e')];}else if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x78')])){this['channels'][_0x52e274[_0x6a30('0x36')]][_0x6a30('0x79')]=_0x52e274[_0x6a30('0x6e')];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x7a')])){this['channels'][_0x52e274[_0x6a30('0x36')]][_0x6a30('0x12')]=_0x52e274[_0x6a30('0x6e')];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x7b')])){this[_0x6a30('0x1c')][_0x52e274['uniqueid']][_0x6a30('0x7c')]=_0x52e274['value'];}}}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')]['mixmonitor_filename'])){if(_0x52e274[_0x6a30('0x6e')]){var _0x3e880b=path[_0x6a30('0x7d')](_0x52e274[_0x6a30('0x6e')])[_0x6a30('0x5f')];this[_0x6a30('0x61')](_0x3e880b,_0x52e274[_0x6a30('0x6e')]);}}else if(this['channels'][_0x52e274[_0x6a30('0x35')]]){if(this['isNotNull'](_0x52e274['variable'])){if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x7b')])){this['channels'][_0x52e274[_0x6a30('0x35')]][_0x6a30('0x7e')]=_0x52e274[_0x6a30('0x6e')];}}}}}catch(_0xead73c){logger['error'](_0x6a30('0x7f'),util[_0x6a30('0x39')](_0xead73c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x25')]=function(_0x469a72){try{if(this[_0x6a30('0x31')](_0x469a72)){if(this['channels'][_0x469a72[_0x6a30('0x36')]]){var _0x7d3b4=moment();this['channels'][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x80')]=_0x7d3b4[_0x6a30('0x46')](_0x6a30('0x3c'));this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x4e')]=_0x7d3b4[_0x6a30('0x56')](this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]]['starttime'],'seconds');if(this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x54')]){this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x81')]=_0x7d3b4[_0x6a30('0x56')](this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x82')],'seconds');this[_0x6a30('0x1c')][_0x469a72['uniqueid']][_0x6a30('0x55')]=this[_0x6a30('0x1c')][_0x469a72['uniqueid']][_0x6a30('0x4e')]-this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x81')];}if(_0x469a72[_0x6a30('0x42')]===_0x6a30('0x83')){if(this['agents'][_0x469a72[_0x6a30('0x3a')]['split']('-')[0x0]]){this[_0x6a30('0x1d')][_0x469a72['channel'][_0x6a30('0x43')]('-')[0x0]]=_['omit'](this[_0x6a30('0x1d')][_0x469a72[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]],[_0x6a30('0x44')]);this['emit'](util[_0x6a30('0x46')](_0x6a30('0x47'),this[_0x6a30('0x1d')][_0x469a72[_0x6a30('0x3a')]['split']('-')[0x0]][_0x6a30('0x5f')]),'user:agentcomplete',{'destaccountcode':this['agents'][_0x469a72[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]][_0x6a30('0x84')]});}}ami[_0x6a30('0x34')](_0x6a30('0x85'),this['channels'][_0x469a72[_0x6a30('0x36')]]);delete this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]];}}}catch(_0x55420b){logger[_0x6a30('0x38')](_0x6a30('0x86'),util[_0x6a30('0x39')](_0x55420b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')]['syncAttendedTransfer']=function(_0x2e6897){try{if(this[_0x6a30('0x31')](_0x2e6897)){if(this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x87')]]){this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x87')]][_0x6a30('0x88')]=_0x2e6897[_0x6a30('0x89')];this['channels'][_0x2e6897[_0x6a30('0x87')]][_0x6a30('0x8a')]=_0x2e6897[_0x6a30('0x8b')];if(this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8c')]]){var _0x1e8f56=this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8c')]];this[_0x6a30('0x1c')][_0x2e6897['secondtransfereruniqueid']]=this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x87')]];this['channels'][_0x2e6897['transfereeuniqueid']]=_0x1e8f56;}}else if(this[_0x6a30('0x1c')][_0x2e6897['transfertargetuniqueid']]){this[_0x6a30('0x1c')][_0x2e6897['transfertargetuniqueid']][_0x6a30('0x88')]=_0x2e6897['origtransferercalleridnum'];this['channels'][_0x2e6897[_0x6a30('0x8d')]][_0x6a30('0x8a')]=_0x2e6897[_0x6a30('0x8b')];if(this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8e')]]){var _0x1e8f56=this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8e')]];this['channels'][_0x2e6897[_0x6a30('0x8e')]]=this['channels'][_0x2e6897[_0x6a30('0x8d')]];this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8d')]]=_0x1e8f56;}}}}catch(_0x3d9521){logger[_0x6a30('0x38')](_0x6a30('0x8f'),util[_0x6a30('0x39')](_0x3d9521,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x29')]=function(_0x151052){try{if(this[_0x6a30('0x31')](_0x151052)){if(this[_0x6a30('0x1c')][_0x151052[_0x6a30('0x87')]]){this[_0x6a30('0x1c')][_0x151052['transfereeuniqueid']]['transfercalleridnum']=_0x151052[_0x6a30('0x90')];this[_0x6a30('0x1c')][_0x151052['transfereeuniqueid']][_0x6a30('0x8a')]=_0x151052['extension'];this['syncHangup']({'event':_0x6a30('0x91'),'uniqueid':_0x151052[_0x6a30('0x87')],'context':_0x151052[_0x6a30('0x42')],'channel':_0x151052[_0x6a30('0x92')]});}}}catch(_0x48d13f){logger['error']('[syncBlindTransfer][VoiceCallReport]',util[_0x6a30('0x39')](_0x48d13f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x2b')]=function(_0xe11329){try{if(this[_0x6a30('0x31')](_0xe11329)){if(this['channels'][_0xe11329[_0x6a30('0x36')]]){if(!_[_0x6a30('0x69')](this[_0x6a30('0x1c')][_0xe11329['uniqueid']][_0x6a30('0x82')])){this['channels'][_0xe11329['uniqueid']][_0x6a30('0x93')]=moment()[_0x6a30('0x46')](_0x6a30('0x3c'));}}}}catch(_0x4d2db6){logger[_0x6a30('0x38')](_0x6a30('0x94'),util[_0x6a30('0x39')](_0x4d2db6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x95')]=function(_0x644af5){try{if(this[_0x6a30('0x31')](_0x644af5)){if(this[_0x6a30('0x1c')][_0x644af5[_0x6a30('0x36')]]){if(!_[_0x6a30('0x69')](this[_0x6a30('0x1c')][_0x644af5['uniqueid']][_0x6a30('0x93')])){this[_0x6a30('0x1c')][_0x644af5['uniqueid']]['mohtime']+=moment()['milliseconds'](0x0)['diff'](this[_0x6a30('0x1c')][_0x644af5[_0x6a30('0x36')]]['mohstarttime'],_0x6a30('0x4f'));delete this[_0x6a30('0x1c')][_0x644af5['uniqueid']][_0x6a30('0x93')];}}}}catch(_0x5dca5e){logger[_0x6a30('0x38')](_0x6a30('0x96'),util[_0x6a30('0x39')](_0x5dca5e,{'showHidden':![],'depth':null}));}};module[_0x6a30('0x97')]=VoiceCallReport; \ No newline at end of file +var _0xc130=['redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','pick','keys','error','channel','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','format','user:%s','user:agentconnect','exten','[syncNewChannel][VoiceCallReport]','inspect','application','appdata','applicationdata','toLowerCase','subtract','duration','seconds','merge','includes','lastapplication','lastdata','match','queue','[syncNewExten][VoiceCallReport]','syncNewState','answered','holdtime','diff','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','name','syncMixMonitorFilename','monitor','monitorFilename','find','isNil','monitors','push','rec','variable','mixmonitor_filename','value','xmd-phone','calleridnum','xmd-callerid','xmd-cdrtype','type','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfercalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','transfertargetcalleridnum','origtransfereruniqueid','transfereecalleridnum','extension','[syncBlindTransfer][VoiceCallReport]','answertime','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','set','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY'];(function(_0x3dac28,_0x345de7){var _0x139e69=function(_0x280912){while(--_0x280912){_0x3dac28['push'](_0x3dac28['shift']());}};_0x139e69(++_0x345de7);}(_0xc130,0x7c));var _0x0c13=function(_0x5abc4c,_0x27a870){_0x5abc4c=_0x5abc4c-0x0;var _0x499b0=_0xc130[_0x5abc4c];return _0x499b0;};'use strict';var BPromise=require(_0x0c13('0x0'));var _=require(_0x0c13('0x1'));var moment=require(_0x0c13('0x2'));var util=require(_0x0c13('0x3'));var path=require(_0x0c13('0x4'));var Redis=require(_0x0c13('0x5'));var config=require(_0x0c13('0x6'));var logger=require(_0x0c13('0x7'))(_0x0c13('0x8'));var ami=require(_0x0c13('0x9'));var Channel=require(_0x0c13('0xa'));var statusDesc=[_0x0c13('0xb'),_0x0c13('0xc'),_0x0c13('0xd'),_0x0c13('0xe'),_0x0c13('0xf'),_0x0c13('0x10'),_0x0c13('0x11'),'ringinuse',_0x0c13('0x12')];var applications=[_0x0c13('0x13'),'queue',_0x0c13('0x14'),_0x0c13('0x15'),_0x0c13('0x16'),'voicemail'];var dispositions=[_0x0c13('0x17'),'FAILED',_0x0c13('0x18'),_0x0c13('0x17'),_0x0c13('0x17'),_0x0c13('0x17'),_0x0c13('0x19'),_0x0c13('0x1a'),_0x0c13('0x18'),_0x0c13('0x18'),_0x0c13('0x18')];var actions={};config[_0x0c13('0x1b')]=_['defaults'](config['redis'],{'host':_0x0c13('0x1c'),'port':0x18eb});var io=require(_0x0c13('0x1d'))(new Redis(config[_0x0c13('0x1b')]));function VoiceCallReport(_0x4fc104){this[_0x0c13('0x1e')]=_0x4fc104[_0x0c13('0x1e')];this[_0x0c13('0x1f')]=_0x4fc104['agents'];ami['on'](_0x0c13('0x20'),this[_0x0c13('0x21')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x23'),this[_0x0c13('0x21')]['bind'](this));ami['on'](_0x0c13('0x24'),this[_0x0c13('0x25')]['bind'](this));ami['on']('newstate',this['syncNewState'][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x26'),this[_0x0c13('0x27')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x28'),this[_0x0c13('0x29')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x2a'),this[_0x0c13('0x2b')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x2c'),this['syncAttendedTransfer'][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x2d'),this[_0x0c13('0x2e')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x2f'),this[_0x0c13('0x30')]['bind'](this));ami['on'](_0x0c13('0x31'),this[_0x0c13('0x32')][_0x0c13('0x22')](this));return BPromise['resolve']()[_0x0c13('0x33')](ami[_0x0c13('0x34')]())[_0x0c13('0x35')](function(_0x2a1264){console[_0x0c13('0x36')](_0x2a1264);});}VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x38')]=function(_0x576ffa){return _0x576ffa!==null&&!_[_0x0c13('0x39')](_0x576ffa);};VoiceCallReport[_0x0c13('0x37')]['emit']=function(_0x2196bd,_0xf7214a,_0x651d75){io['to'](_0x2196bd)[_0x0c13('0x3a')](_0xf7214a,_0x651d75);};VoiceCallReport[_0x0c13('0x37')]['syncNewCallerId']=function(_0x3bebd5){try{if(this[_0x0c13('0x38')](_0x3bebd5)){if(_0x3bebd5[_0x0c13('0x3b')]===_0x3bebd5[_0x0c13('0x3c')]){if(!_['isUndefined'](this[_0x0c13('0x1e')][_0x3bebd5[_0x0c13('0x3b')]])){_['merge'](this[_0x0c13('0x1e')][_0x3bebd5['uniqueid']],_[_0x0c13('0x3d')](_0x3bebd5,_[_0x0c13('0x3e')](this[_0x0c13('0x1e')][_0x3bebd5[_0x0c13('0x3b')]])));}}}}catch(_0x4023e9){logger[_0x0c13('0x3f')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x4023e9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x25')]=function(_0x22754f){try{if(this[_0x0c13('0x38')](_0x22754f)){if(_0x22754f[_0x0c13('0x3b')]===_0x22754f[_0x0c13('0x3c')]&&_0x22754f[_0x0c13('0x40')]!=_0x0c13('0x41')){if(_['isUndefined'](this['channels'][_0x22754f['uniqueid']])){this[_0x0c13('0x1e')][_0x22754f['uniqueid']]=new Channel();this[_0x0c13('0x1e')][_0x22754f[_0x0c13('0x3b')]][_0x0c13('0x42')]=moment()['format'](_0x0c13('0x43'));this[_0x0c13('0x1e')][_0x22754f[_0x0c13('0x3b')]][_0x0c13('0x44')]=dispositions[_[_0x0c13('0x45')](_0x22754f[_0x0c13('0x46')])];_['merge'](this[_0x0c13('0x1e')][_0x22754f[_0x0c13('0x3b')]],_[_0x0c13('0x3d')](_0x22754f,_[_0x0c13('0x3e')](this[_0x0c13('0x1e')][_0x22754f['uniqueid']])));if(_0x22754f[_0x0c13('0x47')]===_0x0c13('0x48')){if(this['agents'][_0x22754f[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]){this['agents'][_0x22754f[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]][_0x0c13('0x4a')]=_0x22754f['exten'];this[_0x0c13('0x3a')](util[_0x0c13('0x4b')](_0x0c13('0x4c'),this[_0x0c13('0x1f')][_0x22754f[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]['name']),_0x0c13('0x4d'),{'destaccountcode':this[_0x0c13('0x1f')][_0x22754f['channel'][_0x0c13('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x22754f[_0x0c13('0x4e')]});}}}}}}catch(_0x8a4fa7){logger[_0x0c13('0x3f')](_0x0c13('0x4f'),util[_0x0c13('0x50')](_0x8a4fa7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x21')]=function(_0x2ae0d2){try{if(this[_0x0c13('0x38')](_0x2ae0d2)){if(_0x2ae0d2[_0x0c13('0x3b')]===_0x2ae0d2[_0x0c13('0x3c')]&&_0x2ae0d2[_0x0c13('0x4e')]!='h'&&_0x2ae0d2[_0x0c13('0x40')]!=_0x0c13('0x41')){_0x2ae0d2[_0x0c13('0x51')]=_0x2ae0d2[_0x0c13('0x51')]['toLowerCase']();_0x2ae0d2['applicationdata']=(_0x2ae0d2[_0x0c13('0x52')]||_0x2ae0d2[_0x0c13('0x53')])[_0x0c13('0x54')]();if(_['isUndefined'](this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]])){this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]]=new Channel();this[_0x0c13('0x1e')][_0x2ae0d2['uniqueid']]['starttime']=_0x2ae0d2['duration']?moment()[_0x0c13('0x55')](moment[_0x0c13('0x56')](_0x2ae0d2[_0x0c13('0x56')])[_0x0c13('0x57')](),_0x0c13('0x57'))[_0x0c13('0x4b')](_0x0c13('0x43')):moment()['format'](_0x0c13('0x43'));this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]]['disposition']='NO\x20ANSWER';}_[_0x0c13('0x58')](this[_0x0c13('0x1e')][_0x2ae0d2['uniqueid']],_['pick'](_0x2ae0d2,_[_0x0c13('0x3e')](this[_0x0c13('0x1e')][_0x2ae0d2['uniqueid']])));if(_[_0x0c13('0x59')](applications,_0x2ae0d2[_0x0c13('0x51')])){this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]][_0x0c13('0x5a')]=_0x2ae0d2['application'];this['channels'][_0x2ae0d2[_0x0c13('0x3b')]][_0x0c13('0x5b')]=_0x2ae0d2[_0x0c13('0x53')];if(_0x2ae0d2[_0x0c13('0x51')]===_0x0c13('0x13')&&_['startsWith'](_0x2ae0d2[_0x0c13('0x53')],'cdr(')){var _0x3656b2=_0x2ae0d2[_0x0c13('0x53')][_0x0c13('0x49')]('=');var _0x8d66e1=_0x3656b2[0x0][_0x0c13('0x5c')](/cdr\((.*)\)/);if(_0x8d66e1){this[_0x0c13('0x1e')][_0x2ae0d2['uniqueid']][_0x8d66e1[0x1]]=_0x3656b2[0x1];}}else if(_0x2ae0d2[_0x0c13('0x51')]===_0x0c13('0x5d')){this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]][_0x0c13('0x5d')]=_0x2ae0d2['applicationdata'][_0x0c13('0x49')](',')[0x0];}}}}}catch(_0x71dd4f){logger[_0x0c13('0x3f')](_0x0c13('0x5e'),util[_0x0c13('0x50')](_0x71dd4f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x5f')]=function(_0x28531b){try{if(this[_0x0c13('0x38')](_0x28531b)){if(_0x28531b[_0x0c13('0x3b')]!==_0x28531b[_0x0c13('0x3c')]){if(this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]]){if(_0x28531b[_0x0c13('0x46')]==='6'){if(!this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]]['answered']){var _0x24fb3e=moment();this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x60')]=!![];this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]]['answertime']=_0x24fb3e[_0x0c13('0x4b')](_0x0c13('0x43'));if(this[_0x0c13('0x1e')][_0x28531b['linkedid']][_0x0c13('0x42')]){this['channels'][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x61')]=_0x24fb3e[_0x0c13('0x62')](this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x42')],_0x0c13('0x57'));}}this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x3c')]=_0x28531b[_0x0c13('0x3b')];if(_0x28531b['calleridnum']!=='xcally-motion-preview'){this['channels'][_0x28531b['linkedid']][_0x0c13('0x63')]=_0x28531b['calleridnum'];}this[_0x0c13('0x1e')][_0x28531b['linkedid']][_0x0c13('0x64')]=_0x28531b[_0x0c13('0x65')];this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x66')]=_0x28531b[_0x0c13('0x40')];this['channels'][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x44')]=dispositions[_['toNumber'](_0x28531b[_0x0c13('0x46')])];if(this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]){this['channels'][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x67')]=this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]['id'];this['channels'][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x68')]=this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]][_0x0c13('0x69')];}}}}else{if(this[_0x0c13('0x1e')][_0x28531b['uniqueid']]){if(_0x28531b[_0x0c13('0x46')]==='6'){if(this['agents'][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]){this['channels'][_0x28531b['uniqueid']]['UserId']=this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]['id'];this[_0x0c13('0x1e')][_0x28531b['uniqueid']][_0x0c13('0x68')]=this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]][_0x0c13('0x69')];}}}}}}catch(_0x1c38d5){logger[_0x0c13('0x3f')]('[syncNewState][VoiceCallReport]',util[_0x0c13('0x50')](_0x1c38d5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x6a')]=function(_0xe472e7,_0x4c79fb){if(this[_0x0c13('0x1e')][_0xe472e7]){this[_0x0c13('0x1e')][_0xe472e7][_0x0c13('0x6b')]=!![];if(_['endsWith'](_0x4c79fb,'.wav49')){_0x4c79fb=_0x4c79fb['replace']('.wav49','.WAV');}this[_0x0c13('0x1e')][_0xe472e7][_0x0c13('0x6c')]=_0x4c79fb;var _0x555058=_[_0x0c13('0x6d')](this[_0x0c13('0x1e')][_0xe472e7]['monitors'],{'filename':_0x4c79fb});if(_[_0x0c13('0x6e')](_0x555058)){this[_0x0c13('0x1e')][_0xe472e7][_0x0c13('0x6f')][_0x0c13('0x70')]({'filename':_0x4c79fb,'createdAt':moment()[_0x0c13('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x0c13('0x71')});}}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x27')]=function(_0x186748){try{if(this[_0x0c13('0x38')](_0x186748)){if(this['channels'][_0x186748['uniqueid']]&&_0x186748[_0x0c13('0x40')]!=_0x0c13('0x41')){if(this['isNotNull'](_0x186748['variable'])){if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x73')])){this[_0x0c13('0x6a')](_0x186748[_0x0c13('0x3b')],_0x186748[_0x0c13('0x74')]);}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x75')])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x76')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x77')])){this['channels'][_0x186748['uniqueid']]['callerid']=_0x186748['value'];}else if(this[_0x0c13('0x38')](_0x186748['variable'][_0x0c13('0x78')])){this['channels'][_0x186748['uniqueid']][_0x0c13('0x79')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')]['xmd-queue'])){this['channels'][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x5d')]=_0x186748[_0x0c13('0x74')]['split'](',')[0x0];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')]['xmd-originatecalleridnum'])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x7a')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748['variable'][_0x0c13('0x7b')])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x7c')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x7d')])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x7e')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')]['xmcs-queue'])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x5d')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x7f')])){this['channels'][_0x186748['uniqueid']][_0x0c13('0x80')]=_0x186748['value'];}}}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x73')])){if(_0x186748['value']){var _0xb092ee=path[_0x0c13('0x81')](_0x186748[_0x0c13('0x74')])[_0x0c13('0x69')];this[_0x0c13('0x6a')](_0xb092ee,_0x186748[_0x0c13('0x74')]);}}else if(this[_0x0c13('0x1e')][_0x186748['linkedid']]){if(this[_0x0c13('0x38')](_0x186748['variable'])){if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')]['sipcallid'])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3c')]][_0x0c13('0x82')]=_0x186748['value'];}}}}}catch(_0x873c74){logger['error'](_0x0c13('0x83'),util[_0x0c13('0x50')](_0x873c74,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')]['syncHangup']=function(_0x3517eb){try{if(this[_0x0c13('0x38')](_0x3517eb)){if(this[_0x0c13('0x1e')][_0x3517eb['uniqueid']]){var _0x215b1f=moment();this['channels'][_0x3517eb[_0x0c13('0x3b')]]['endtime']=_0x215b1f[_0x0c13('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3517eb['uniqueid']][_0x0c13('0x56')]=_0x215b1f[_0x0c13('0x62')](this[_0x0c13('0x1e')][_0x3517eb['uniqueid']]['starttime'],_0x0c13('0x57'));if(this[_0x0c13('0x1e')][_0x3517eb['uniqueid']][_0x0c13('0x60')]){this['channels'][_0x3517eb[_0x0c13('0x3b')]][_0x0c13('0x84')]=_0x215b1f[_0x0c13('0x62')](this['channels'][_0x3517eb[_0x0c13('0x3b')]]['answertime'],_0x0c13('0x57'));this['channels'][_0x3517eb[_0x0c13('0x3b')]][_0x0c13('0x61')]=this[_0x0c13('0x1e')][_0x3517eb['uniqueid']]['duration']-this[_0x0c13('0x1e')][_0x3517eb[_0x0c13('0x3b')]]['billableseconds'];}if(_0x3517eb[_0x0c13('0x47')]===_0x0c13('0x48')){if(this[_0x0c13('0x1f')][_0x3517eb[_0x0c13('0x40')]['split']('-')[0x0]]){this[_0x0c13('0x1f')][_0x3517eb[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]=_['omit'](this[_0x0c13('0x1f')][_0x3517eb['channel']['split']('-')[0x0]],['destconnectedlinenum']);this[_0x0c13('0x3a')](util['format'](_0x0c13('0x4c'),this[_0x0c13('0x1f')][_0x3517eb[_0x0c13('0x40')]['split']('-')[0x0]][_0x0c13('0x69')]),'user:agentcomplete',{'destaccountcode':this[_0x0c13('0x1f')][_0x3517eb[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]['accountcode']});}}ami[_0x0c13('0x3a')]('custom:voiceCallReport',this[_0x0c13('0x1e')][_0x3517eb[_0x0c13('0x3b')]]);delete this[_0x0c13('0x1e')][_0x3517eb['uniqueid']];}}}catch(_0x408db9){logger[_0x0c13('0x3f')](_0x0c13('0x85'),util[_0x0c13('0x50')](_0x408db9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0c13('0x86')]=function(_0x1599f7){try{if(this[_0x0c13('0x38')](_0x1599f7)){if(this['channels'][_0x1599f7['transfereeuniqueid']]){this[_0x0c13('0x1e')][_0x1599f7['transfereeuniqueid']][_0x0c13('0x87')]=_0x1599f7['origtransferercalleridnum'];this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x88')]][_0x0c13('0x89')]=_0x1599f7['transfertargetcalleridnum'];if(this['channels'][_0x1599f7[_0x0c13('0x8a')]]){var _0xed5a77=this['channels'][_0x1599f7[_0x0c13('0x8a')]];this[_0x0c13('0x1e')][_0x1599f7['secondtransfereruniqueid']]=this['channels'][_0x1599f7[_0x0c13('0x88')]];this[_0x0c13('0x1e')][_0x1599f7['transfereeuniqueid']]=_0xed5a77;}}else if(this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8b')]]){this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8b')]][_0x0c13('0x87')]=_0x1599f7[_0x0c13('0x8c')];this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8b')]][_0x0c13('0x89')]=_0x1599f7[_0x0c13('0x8d')];if(this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8e')]]){var _0xed5a77=this['channels'][_0x1599f7['origtransfereruniqueid']];this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8e')]]=this['channels'][_0x1599f7[_0x0c13('0x8b')]];this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8b')]]=_0xed5a77;}}}}catch(_0x581f13){logger['error']('[syncAttendedTransfer][VoiceCallReport]',util[_0x0c13('0x50')](_0x581f13,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')]['syncBlindTransfer']=function(_0x147c39){try{if(this[_0x0c13('0x38')](_0x147c39)){if(this['channels'][_0x147c39['transfereeuniqueid']]){this[_0x0c13('0x1e')][_0x147c39[_0x0c13('0x88')]][_0x0c13('0x87')]=_0x147c39[_0x0c13('0x8f')];this[_0x0c13('0x1e')][_0x147c39[_0x0c13('0x88')]][_0x0c13('0x89')]=_0x147c39[_0x0c13('0x90')];this[_0x0c13('0x29')]({'event':'BlindTransfer','uniqueid':_0x147c39[_0x0c13('0x88')],'context':_0x147c39[_0x0c13('0x47')],'channel':_0x147c39['transfererchannel']});}}}catch(_0x4b5880){logger[_0x0c13('0x3f')](_0x0c13('0x91'),util['inspect'](_0x4b5880,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x30')]=function(_0x369320){try{if(this[_0x0c13('0x38')](_0x369320)){if(this[_0x0c13('0x1e')][_0x369320[_0x0c13('0x3b')]]){if(!_['isNil'](this[_0x0c13('0x1e')][_0x369320[_0x0c13('0x3b')]][_0x0c13('0x92')])){this[_0x0c13('0x1e')][_0x369320[_0x0c13('0x3b')]][_0x0c13('0x93')]=moment()[_0x0c13('0x4b')](_0x0c13('0x43'));}}}}catch(_0x427195){logger[_0x0c13('0x3f')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x0c13('0x50')](_0x427195,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0c13('0x32')]=function(_0x456267){try{if(this['isNotNull'](_0x456267)){if(this[_0x0c13('0x1e')][_0x456267[_0x0c13('0x3b')]]){if(!_[_0x0c13('0x6e')](this[_0x0c13('0x1e')][_0x456267[_0x0c13('0x3b')]][_0x0c13('0x93')])){this[_0x0c13('0x1e')][_0x456267[_0x0c13('0x3b')]][_0x0c13('0x94')]+=moment()['milliseconds'](0x0)[_0x0c13('0x62')](this['channels'][_0x456267[_0x0c13('0x3b')]][_0x0c13('0x93')],_0x0c13('0x57'));delete this[_0x0c13('0x1e')][_0x456267['uniqueid']][_0x0c13('0x93')];}}}}catch(_0x2132c0){logger['error'](_0x0c13('0x95'),util[_0x0c13('0x50')](_0x2132c0,{'showHidden':![],'depth':null}));}};module[_0x0c13('0x96')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 4856734..36cc1d9 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 _0xdedf=['sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','defaults','redis','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','custom:dialconnect','addVariable','keys','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','syncHangup','endtime','duration','diff','starttime','seconds','lastevent','complete','total','billableseconds','sumHoldTime','holdtime','sumBillable'];(function(_0x4cb322,_0x505daf){var _0x25be4b=function(_0x944c96){while(--_0x944c96){_0x4cb322['push'](_0x4cb322['shift']());}};_0x25be4b(++_0x505daf);}(_0xdedf,0x17a));var _0xfded=function(_0x2f0597,_0x269561){_0x2f0597=_0x2f0597-0x0;var _0x2a0882=_0xdedf[_0x2f0597];return _0x2a0882;};'use strict';var _=require(_0xfded('0x0'));var moment=require(_0xfded('0x1'));var util=require('util');var Redis=require(_0xfded('0x2'));var config=require(_0xfded('0x3'));var logger=require(_0xfded('0x4'))(_0xfded('0x5'));var ami=require('../ami');config['redis']=_[_0xfded('0x6')](config[_0xfded('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xfded('0x8'))(new Redis(config[_0xfded('0x7')]));function VoiceDialReport(_0x32fe31){this[_0xfded('0x9')]=_0x32fe31[_0xfded('0xa')];this[_0xfded('0xb')]=_0x32fe31['outbound'];this[_0xfded('0xc')]={};ami['on'](_0xfded('0xd'),this[_0xfded('0xe')][_0xfded('0xf')](this));ami['on']('dialend',this[_0xfded('0x10')][_0xfded('0xf')](this));ami['on'](_0xfded('0x11'),this[_0xfded('0x12')][_0xfded('0xf')](this));ami['on']('hangup',this['syncHangup']['bind'](this));}VoiceDialReport[_0xfded('0x13')][_0xfded('0x14')]=function(_0x488e1a){return _0x488e1a!==null&&!_[_0xfded('0x15')](_0x488e1a);};VoiceDialReport[_0xfded('0x13')][_0xfded('0x16')]=function(_0x116b69,_0x40932c,_0x16803a){io['to'](_0x116b69)[_0xfded('0x16')](_0x40932c,_0x16803a);};VoiceDialReport[_0xfded('0x13')][_0xfded('0xe')]=function(_0x34ad7f){try{if(this[_0xfded('0x14')](_0x34ad7f)){if(this[_0xfded('0x9')][_0x34ad7f[_0xfded('0x17')]]){_[_0xfded('0x18')](this[_0xfded('0x9')][_0x34ad7f[_0xfded('0x17')]],{'starttime':moment()[_0xfded('0x19')](_0xfded('0x1a')),'lastevent':_0xfded('0x1b'),'interface':_0x34ad7f[_0xfded('0x1c')][_0xfded('0x1d')](0x0,_0x34ad7f['channel'][_0xfded('0x1e')]('-')),'membername':_0x34ad7f[_0xfded('0x1c')][_0xfded('0x1d')](_0x34ad7f[_0xfded('0x1c')][_0xfded('0x1e')]('/')+0x1,_0x34ad7f[_0xfded('0x1c')][_0xfded('0x1e')]('-'))},_[_0xfded('0x1f')](_0x34ad7f,[_0xfded('0x20'),_0xfded('0x21')]));this[_0xfded('0x16')](_0xfded('0x22'),_0xfded('0x23'),this[_0xfded('0x9')][_0x34ad7f['uniqueid']]);ami[_0xfded('0x16')](_0xfded('0x24'),this[_0xfded('0x9')][_0x34ad7f[_0xfded('0x17')]]);}}}catch(_0x594b6e){logger[_0xfded('0x25')](_0xfded('0x26'),util[_0xfded('0x27')](_0x594b6e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfded('0x13')]['syncDialEnd']=function(_0x599346){try{if(this[_0xfded('0x14')](_0x599346)){if(this[_0xfded('0x9')][_0x599346['uniqueid']]){this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]]['dialstatus']=_0x599346[_0xfded('0x28')];if(_0x599346[_0xfded('0x28')]===_0xfded('0x29')){this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]][_0xfded('0x2a')]=_0x599346[_0xfded('0x2a')];this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]][_0xfded('0x2b')]=_0x599346['connectedlinename'];this['channels'][_0x599346['uniqueid']][_0xfded('0x2c')]=moment()[_0xfded('0x19')](_0xfded('0x1a'));this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]]['lastevent']=_0xfded('0x2d');ami[_0xfded('0x16')](_0xfded('0x2e'),this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]]);}this[_0xfded('0x16')](_0xfded('0x22'),_0xfded('0x23'),this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]]);}}}catch(_0x529500){logger['error']('[syncDialEnd][VoiceDialReport]',util[_0xfded('0x27')](_0x529500,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfded('0x13')][_0xfded('0x12')]=function(_0x2b7fef){try{if(this['isNotNull'](_0x2b7fef)){this[_0xfded('0x2f')](_0x2b7fef['uniqueid'],_[_0xfded('0x30')](_0x2b7fef[_0xfded('0x31')])[0x0],_0x2b7fef['value']);if(this[_0xfded('0x14')](_0x2b7fef[_0xfded('0x31')])&&this[_0xfded('0x14')](_0x2b7fef['variable']['outboundrouteid'])){if(_[_0xfded('0x15')](this['channels'][_0x2b7fef[_0xfded('0x17')]])){this[_0xfded('0x9')][_0x2b7fef[_0xfded('0x17')]]={'routeId':_0x2b7fef[_0xfded('0x32')],'variables':this['variables'][_0x2b7fef[_0xfded('0x17')]]};this[_0xfded('0x16')]('voice:outbound',_0xfded('0x23'),this[_0xfded('0x9')][_0x2b7fef['uniqueid']]);}}}}catch(_0x19a3e2){logger['error'](_0xfded('0x33'),util[_0xfded('0x27')](_0x19a3e2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfded('0x13')][_0xfded('0x2f')]=function(_0x11b114,_0x1275ac,_0x38712b){var _0x28d3eb=['rtpaudioqos',_0xfded('0x34'),'rtpaudioqosjitter',_0xfded('0x35'),_0xfded('0x36'),_0xfded('0x37'),_0xfded('0x38'),_0xfded('0x39'),_0xfded('0x3a'),'sipuri','bridgepeer',_0xfded('0x3b'),_0xfded('0x3c'),_0xfded('0x3d'),_0xfded('0x3e'),_0xfded('0x3f'),_0xfded('0x40'),_0xfded('0x41'),_0xfded('0x42')];if(!_[_0xfded('0x43')](_0x1275ac)&&!_[_0xfded('0x44')](_0x28d3eb,_0x1275ac)){if(_[_0xfded('0x15')](this[_0xfded('0xc')][_0x11b114])){this[_0xfded('0xc')][_0x11b114]={};}this['variables'][_0x11b114][_0x1275ac]=_0x38712b;}};VoiceDialReport['prototype'][_0xfded('0x45')]=function(_0x4b4c9e){try{if(this['isNotNull'](_0x4b4c9e)){if(this[_0xfded('0x9')][_0x4b4c9e['uniqueid']]){this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x46')]=moment()[_0xfded('0x19')](_0xfded('0x1a'));this[_0xfded('0x9')][_0x4b4c9e['uniqueid']][_0xfded('0x47')]=moment(this['channels'][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x46')])[_0xfded('0x48')](this['channels'][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x49')],_0xfded('0x4a'));this['channels'][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x4b')]=_0xfded('0x4c');this[_0xfded('0xb')][_0xfded('0x4d')]+=0x1;if(this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x2c')]){this[_0xfded('0xb')]['answered']+=0x1;this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]]['holdtime']=moment(this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x2c')])[_0xfded('0x48')](this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x49')],'seconds');this[_0xfded('0x9')][_0x4b4c9e['uniqueid']][_0xfded('0x4e')]=moment(this[_0xfded('0x9')][_0x4b4c9e['uniqueid']][_0xfded('0x46')])[_0xfded('0x48')](this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]]['answertime'],_0xfded('0x4a'));this['outbound'][_0xfded('0x4f')]+=this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x50')]||0x0;this[_0xfded('0xb')][_0xfded('0x51')]+=this[_0xfded('0x9')][_0x4b4c9e['uniqueid']][_0xfded('0x4e')];}this['outbound'][_0xfded('0x52')]+=this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x47')];ami[_0xfded('0x16')](_0xfded('0x53'),this['channels'][_0x4b4c9e[_0xfded('0x17')]]);ami['emit'](_0xfded('0x54'),this['channels'][_0x4b4c9e[_0xfded('0x17')]]);this[_0xfded('0x16')](_0xfded('0x22'),_0xfded('0x55'),this[_0xfded('0xb')]);logger[_0xfded('0x56')](_0xfded('0x57'),JSON[_0xfded('0x58')](this['channels'][_0x4b4c9e['uniqueid']]));this['emit']('voice:outbound',_0xfded('0x59'),this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]]);delete this[_0xfded('0x9')][_0x4b4c9e['uniqueid']];}if(this[_0xfded('0xc')][_0x4b4c9e[_0xfded('0x17')]]){delete this['variables'][_0x4b4c9e[_0xfded('0x17')]];}}}catch(_0x13d3ae){logger[_0xfded('0x25')](_0xfded('0x5a'),util['inspect'](_0x13d3ae,{'showHidden':![],'depth':null}));}};module[_0xfded('0x5b')]=VoiceDialReport; \ No newline at end of file +var _0xab29=['syncVarSet','hangup','syncHangup','isNotNull','isUndefined','emit','prototype','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','outboundrouteid','value','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','endtime','diff','starttime','seconds','lastevent','complete','total','answered','holdtime','sumHoldTime','sumBillable','billableseconds','duration','info','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset'];(function(_0x17f7d7,_0x525e08){var _0x4aaeb8=function(_0x1b3c3c){while(--_0x1b3c3c){_0x17f7d7['push'](_0x17f7d7['shift']());}};_0x4aaeb8(++_0x525e08);}(_0xab29,0x145));var _0x9ab2=function(_0x3912f1,_0x1fb101){_0x3912f1=_0x3912f1-0x0;var _0x4ccb95=_0xab29[_0x3912f1];return _0x4ccb95;};'use strict';var _=require(_0x9ab2('0x0'));var moment=require(_0x9ab2('0x1'));var util=require(_0x9ab2('0x2'));var Redis=require(_0x9ab2('0x3'));var config=require('../../../config/environment');var logger=require(_0x9ab2('0x4'))('ami');var ami=require(_0x9ab2('0x5'));config[_0x9ab2('0x6')]=_[_0x9ab2('0x7')](config[_0x9ab2('0x6')],{'host':_0x9ab2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ab2('0x6')]));function VoiceDialReport(_0x3739c8){this[_0x9ab2('0x9')]=_0x3739c8[_0x9ab2('0xa')];this[_0x9ab2('0xb')]=_0x3739c8['outbound'];this[_0x9ab2('0xc')]={};ami['on'](_0x9ab2('0xd'),this[_0x9ab2('0xe')][_0x9ab2('0xf')](this));ami['on'](_0x9ab2('0x10'),this[_0x9ab2('0x11')][_0x9ab2('0xf')](this));ami['on'](_0x9ab2('0x12'),this[_0x9ab2('0x13')]['bind'](this));ami['on'](_0x9ab2('0x14'),this[_0x9ab2('0x15')]['bind'](this));}VoiceDialReport['prototype'][_0x9ab2('0x16')]=function(_0x1b23ae){return _0x1b23ae!==null&&!_[_0x9ab2('0x17')](_0x1b23ae);};VoiceDialReport['prototype'][_0x9ab2('0x18')]=function(_0x314432,_0x55c9d6,_0x3a594f){io['to'](_0x314432)[_0x9ab2('0x18')](_0x55c9d6,_0x3a594f);};VoiceDialReport[_0x9ab2('0x19')][_0x9ab2('0xe')]=function(_0x24f858){try{if(this[_0x9ab2('0x16')](_0x24f858)){if(this[_0x9ab2('0x9')][_0x24f858[_0x9ab2('0x1a')]]){_['merge'](this[_0x9ab2('0x9')][_0x24f858[_0x9ab2('0x1a')]],{'starttime':moment()[_0x9ab2('0x1b')](_0x9ab2('0x1c')),'lastevent':_0x9ab2('0x1d'),'interface':_0x24f858[_0x9ab2('0x1e')]['substring'](0x0,_0x24f858['channel'][_0x9ab2('0x1f')]('-')),'membername':_0x24f858['channel'][_0x9ab2('0x20')](_0x24f858[_0x9ab2('0x1e')]['lastIndexOf']('/')+0x1,_0x24f858[_0x9ab2('0x1e')][_0x9ab2('0x1f')]('-'))},_['omit'](_0x24f858,[_0x9ab2('0x21'),_0x9ab2('0x22')]));this[_0x9ab2('0x18')](_0x9ab2('0x23'),_0x9ab2('0x24'),this[_0x9ab2('0x9')][_0x24f858[_0x9ab2('0x1a')]]);ami[_0x9ab2('0x18')](_0x9ab2('0x25'),this[_0x9ab2('0x9')][_0x24f858[_0x9ab2('0x1a')]]);}}}catch(_0x248cc6){logger[_0x9ab2('0x26')]('[syncDialBegin][VoiceDialReport]',util[_0x9ab2('0x27')](_0x248cc6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ab2('0x19')][_0x9ab2('0x11')]=function(_0x4cf7b8){try{if(this[_0x9ab2('0x16')](_0x4cf7b8)){if(this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]]){this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]][_0x9ab2('0x28')]=_0x4cf7b8[_0x9ab2('0x28')];if(_0x4cf7b8[_0x9ab2('0x28')]===_0x9ab2('0x29')){this['channels'][_0x4cf7b8['uniqueid']]['connectedlinenum']=_0x4cf7b8[_0x9ab2('0x2a')];this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]][_0x9ab2('0x2b')]=_0x4cf7b8[_0x9ab2('0x2b')];this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]][_0x9ab2('0x2c')]=moment()[_0x9ab2('0x1b')](_0x9ab2('0x1c'));this['channels'][_0x4cf7b8[_0x9ab2('0x1a')]]['lastevent']=_0x9ab2('0x2d');ami[_0x9ab2('0x18')]('custom:dialconnect',this[_0x9ab2('0x9')][_0x4cf7b8['uniqueid']]);}this[_0x9ab2('0x18')](_0x9ab2('0x23'),_0x9ab2('0x24'),this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]]);}}}catch(_0x30ab52){logger[_0x9ab2('0x26')](_0x9ab2('0x2e'),util[_0x9ab2('0x27')](_0x30ab52,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x78089a){try{if(this[_0x9ab2('0x16')](_0x78089a)){this[_0x9ab2('0x2f')](_0x78089a[_0x9ab2('0x1a')],_[_0x9ab2('0x30')](_0x78089a['variable'])[0x0],_0x78089a['value']);if(this[_0x9ab2('0x16')](_0x78089a['variable'])&&this[_0x9ab2('0x16')](_0x78089a[_0x9ab2('0x31')][_0x9ab2('0x32')])){if(_[_0x9ab2('0x17')](this[_0x9ab2('0x9')][_0x78089a[_0x9ab2('0x1a')]])){this[_0x9ab2('0x9')][_0x78089a[_0x9ab2('0x1a')]]={'routeId':_0x78089a[_0x9ab2('0x33')],'variables':this[_0x9ab2('0xc')][_0x78089a[_0x9ab2('0x1a')]]};this[_0x9ab2('0x18')](_0x9ab2('0x23'),_0x9ab2('0x24'),this[_0x9ab2('0x9')][_0x78089a['uniqueid']]);}}}}catch(_0x3e8ac2){logger[_0x9ab2('0x26')](_0x9ab2('0x34'),util[_0x9ab2('0x27')](_0x3e8ac2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ab2('0x19')][_0x9ab2('0x2f')]=function(_0xae1e7e,_0x4bfe06,_0x3df054){var _0x4a273=['rtpaudioqos',_0x9ab2('0x35'),_0x9ab2('0x36'),_0x9ab2('0x37'),_0x9ab2('0x38'),_0x9ab2('0x39'),_0x9ab2('0x3a'),_0x9ab2('0x3b'),_0x9ab2('0x3c'),_0x9ab2('0x3d'),_0x9ab2('0x3e'),_0x9ab2('0x3f'),_0x9ab2('0x40'),_0x9ab2('0x41'),'memberinterface',_0x9ab2('0x42'),'membername',_0x9ab2('0x43'),_0x9ab2('0x44')];if(!_['isNil'](_0x4bfe06)&&!_['includes'](_0x4a273,_0x4bfe06)){if(_[_0x9ab2('0x17')](this[_0x9ab2('0xc')][_0xae1e7e])){this['variables'][_0xae1e7e]={};}this[_0x9ab2('0xc')][_0xae1e7e][_0x4bfe06]=_0x3df054;}};VoiceDialReport['prototype'][_0x9ab2('0x15')]=function(_0xc5cefb){try{if(this[_0x9ab2('0x16')](_0xc5cefb)){if(this['channels'][_0xc5cefb[_0x9ab2('0x1a')]]){this['channels'][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x45')]=moment()[_0x9ab2('0x1b')](_0x9ab2('0x1c'));this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']]['duration']=moment(this['channels'][_0xc5cefb['uniqueid']][_0x9ab2('0x45')])[_0x9ab2('0x46')](this['channels'][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x47')],_0x9ab2('0x48'));this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']][_0x9ab2('0x49')]=_0x9ab2('0x4a');this['outbound'][_0x9ab2('0x4b')]+=0x1;if(this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x2c')]){this[_0x9ab2('0xb')][_0x9ab2('0x4c')]+=0x1;this['channels'][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x4d')]=moment(this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x2c')])[_0x9ab2('0x46')](this['channels'][_0xc5cefb[_0x9ab2('0x1a')]]['starttime'],_0x9ab2('0x48'));this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']]['billableseconds']=moment(this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']][_0x9ab2('0x45')])[_0x9ab2('0x46')](this['channels'][_0xc5cefb['uniqueid']]['answertime'],_0x9ab2('0x48'));this['outbound'][_0x9ab2('0x4e')]+=this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x4d')]||0x0;this['outbound'][_0x9ab2('0x4f')]+=this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x50')];}this[_0x9ab2('0xb')]['sumDuration']+=this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x51')];ami[_0x9ab2('0x18')]('custom:voiceDialReport',this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]]);ami['emit']('custom:dialend',this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]]);this[_0x9ab2('0x18')](_0x9ab2('0x23'),'voice_outbound:save',this[_0x9ab2('0xb')]);logger[_0x9ab2('0x52')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']]));this[_0x9ab2('0x18')](_0x9ab2('0x23'),_0x9ab2('0x53'),this['channels'][_0xc5cefb[_0x9ab2('0x1a')]]);delete this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']];}if(this[_0x9ab2('0xc')][_0xc5cefb['uniqueid']]){delete this['variables'][_0xc5cefb['uniqueid']];}}}catch(_0x524f14){logger[_0x9ab2('0x26')](_0x9ab2('0x54'),util[_0x9ab2('0x27')](_0x524f14,{'showHidden':![],'depth':null}));}};module[_0x9ab2('0x55')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 5ac7d1e..77f7769 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 _0xa780=['queuestatus','TIMEOUT','timeout','custom:timeout','queuecallerleaveAt','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberrealtime','includes','syncHangup','unmanaged','diff','queuecallerjoinAt','length','sumDuration','milliseconds','sumBillable','lastevent','custom:queuecallerunmanaged','custom:queuecallerabandon','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohtime','mohstarttime','lodash','moment','bluebird','util','md5','ioredis','../../../config/environment','ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','queueChannels','voiceQueues','campaigns','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncAgentComplete','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','clearZombieChannels','channels','switch','isNil','Action','status','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','sumHoldTime','total','abandoned','Trunk','active','Interval','stringify','voice_queue:save','isNotNull','isUndefined','queues','[queues]','flagQueueSummary','[queuesummary]','queue','countBy','callers','toNumber','loggedin','[syncQueueSummary][VoiceQueueReport]','uniqueid','YYYY-MM-DD\x20HH:mm:ss','count','merge','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','syncQueueCallerLeave','last','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','syncAgentConnect','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','queuecallerexit','queuecallerexitAt','reason','transfer','startsWith','channel','local/','linkedid','add','seconds','FORWARDTRANSFER','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value'];(function(_0x235bc5,_0x299e52){var _0x262bf1=function(_0x5f4485){while(--_0x5f4485){_0x235bc5['push'](_0x235bc5['shift']());}};_0x262bf1(++_0x299e52);}(_0xa780,0x1cd));var _0x0a78=function(_0x198a59,_0x182a87){_0x198a59=_0x198a59-0x0;var _0x7daf1e=_0xa780[_0x198a59];return _0x7daf1e;};'use strict';var _=require(_0x0a78('0x0'));var moment=require(_0x0a78('0x1'));var BPromise=require(_0x0a78('0x2'));var util=require(_0x0a78('0x3'));var md5=require(_0x0a78('0x4'));var Redis=require(_0x0a78('0x5'));var config=require(_0x0a78('0x6'));var logger=require('../../../config/logger')(_0x0a78('0x7'));var ami=require('../ami');var QueueReport=require(_0x0a78('0x8'));config[_0x0a78('0x9')]=_[_0x0a78('0xa')](config['redis'],{'host':_0x0a78('0xb'),'port':0x18eb});var io=require(_0x0a78('0xc'))(new Redis(config[_0x0a78('0x9')]));var Sequence=function(){};Sequence[_0x0a78('0xd')][_0x0a78('0xe')]=function(_0x1045a2){this[_0x0a78('0xf')]=this[_0x0a78('0xf')]?this[_0x0a78('0xf')]['finally'](_0x1045a2):_0x1045a2();};function VoiceQueueReport(_0x55ae76){this[_0x0a78('0x10')]=new Sequence();this[_0x0a78('0x11')]={};this[_0x0a78('0x12')]=_0x55ae76['agents'];this['channels']=_0x55ae76[_0x0a78('0x13')];this[_0x0a78('0x14')]=_0x55ae76[_0x0a78('0x14')];this['flagQueueSummary']=!![];this[_0x0a78('0x15')]=_0x55ae76[_0x0a78('0x15')];this[_0x0a78('0x16')]={};ami['on']('queuesummary',this[_0x0a78('0x17')][_0x0a78('0x18')](this));ami['on'](_0x0a78('0x19'),this[_0x0a78('0x1a')][_0x0a78('0x18')](this));ami['on'](_0x0a78('0x1b'),this[_0x0a78('0x1c')]['bind'](this));ami['on'](_0x0a78('0x1d'),this[_0x0a78('0x1e')][_0x0a78('0x18')](this));ami['on'](_0x0a78('0x1f'),this['syncQueueCallerLeave']['bind'](this));ami['on']('agentcomplete',this[_0x0a78('0x20')]['bind'](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x0a78('0x18')](this));ami['on'](_0x0a78('0x21'),this[_0x0a78('0x22')][_0x0a78('0x18')](this));ami['on'](_0x0a78('0x23'),this['syncHangup']['bind'](this));ami['on'](_0x0a78('0x24'),this[_0x0a78('0x25')]['bind'](this));ami['on'](_0x0a78('0x26'),this[_0x0a78('0x27')][_0x0a78('0x18')](this));ami['on'](_0x0a78('0x28'),this[_0x0a78('0x29')][_0x0a78('0x18')](this));ami['on']('attendedtransfer',this[_0x0a78('0x2a')][_0x0a78('0x18')](this));ami['on'](_0x0a78('0x2b'),this['syncBlindTransfer'][_0x0a78('0x18')](this));this[_0x0a78('0x2c')]();this[_0x0a78('0x2d')]();}function isNotNull(_0x878067){return _0x878067!==null&&!_['isUndefined'](_0x878067);}function clearChannels(_0x59a8f2){if(!_[_0x0a78('0x2e')](_0x59a8f2)){for(var _0x4bb22c in _0x59a8f2){if(_0x59a8f2[_0x0a78('0x2f')](_0x4bb22c)){delete _0x59a8f2[_0x4bb22c];}}}}function clearCampaigns(_0x374695){if(!_[_0x0a78('0x2e')](_0x374695)){for(var _0x284f0c in _0x374695){if(_0x374695[_0x0a78('0x2f')](_0x284f0c)){_0x374695[_0x284f0c][_0x0a78('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4e0718){if(!_[_0x0a78('0x2e')](_0x4e0718)){for(var _0x8e276f in _0x4e0718){if(_0x4e0718[_0x0a78('0x2f')](_0x8e276f)){_0x4e0718[_0x8e276f][_0x0a78('0x30')]=0x0;_0x4e0718[_0x8e276f][_0x0a78('0x31')]=0x0;_0x4e0718[_0x8e276f][_0x0a78('0x32')]=0x0;_0x4e0718[_0x8e276f][_0x0a78('0x33')]=0x0;_0x4e0718[_0x8e276f]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x53ea54){if(!_[_0x0a78('0x2e')](_0x53ea54)){for(var _0x5feb6c in _0x53ea54){if(_0x53ea54[_0x0a78('0x2f')](_0x5feb6c)){_0x53ea54[_0x5feb6c][_0x0a78('0x34')]=!![];}}}}VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x35')]=function(){var _0x35f2ef=this;for(var _0x2d4ab4 in this[_0x0a78('0x36')]){if(this[_0x0a78('0x36')][_0x0a78('0x2f')](_0x2d4ab4)&&!this[_0x0a78('0x36')][_0x2d4ab4][_0x0a78('0x37')]){this[_0x0a78('0x10')][_0x0a78('0xe')](function(){if(!_[_0x0a78('0x38')](_0x35f2ef[_0x0a78('0x36')][_0x2d4ab4])){return ami[_0x0a78('0x39')]({'action':_0x0a78('0x3a'),'channel':_0x35f2ef[_0x0a78('0x36')][_0x2d4ab4]['channel']})[_0x0a78('0x3b')](function(_0x4e898b){if(_0x4e898b[_0x0a78('0x3c')]===_0x0a78('0x3d')){setTimeout(function(){if(_0x35f2ef[_0x0a78('0x36')][_0x2d4ab4]){delete _0x35f2ef['channels'][_0x2d4ab4];logger[_0x0a78('0x3e')](_0x0a78('0x3f'),_0x2d4ab4);}if(_0x35f2ef[_0x0a78('0x11')][_0x2d4ab4]){delete _0x35f2ef['queueReports'][_0x2d4ab4];logger['error'](_0x0a78('0x40'),_0x2d4ab4);}if(_0x35f2ef['variables'][_0x2d4ab4]){delete _0x35f2ef['variables'][_0x2d4ab4];logger[_0x0a78('0x3e')](_0x0a78('0x41'),_0x2d4ab4);}},0x1f40);}});}});}}};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x25')]=function(){logger['error'](_0x0a78('0x42'));clearChannels(this[_0x0a78('0x36')]);this[_0x0a78('0x43')](this[_0x0a78('0x11')]);clearAgentBooked(this[_0x0a78('0x12')]);clearVoiceQueues(this[_0x0a78('0x14')]);clearCampaigns(this[_0x0a78('0x15')]);};VoiceQueueReport[_0x0a78('0xd')]['clearQueueReport']=function(_0x5c7d08){var _0x279349=this;if(!_[_0x0a78('0x2e')](_0x5c7d08)){for(var _0xb8dbbe in _0x5c7d08){if(_0x5c7d08[_0x0a78('0x2f')](_0xb8dbbe)){_0x279349[_0x0a78('0x44')](_0x5c7d08[_0xb8dbbe]);delete _0x5c7d08[_0xb8dbbe];}}}};function loggerCatch(_0x32efdd){return function(_0x4c7e6d){logger[_0x0a78('0x3e')](_0x32efdd,util[_0x0a78('0x45')](_0x4c7e6d,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x46')]=function(_0x4bd62a,_0x454e28,_0x262384){io['to'](_0x4bd62a)[_0x0a78('0x46')](_0x454e28,_0x262384);};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x47')]=function(_0x19def9){this[_0x0a78('0x46')](util[_0x0a78('0x48')](_0x0a78('0x49'),_0x19def9[_0x0a78('0x4a')]),_0x0a78('0x4b'),_0x19def9);};VoiceQueueReport['prototype'][_0x0a78('0x44')]=function(_0x5df0b5){logger[_0x0a78('0x4c')](_0x0a78('0x4d'),JSON['stringify'](_0x5df0b5));this[_0x0a78('0x46')](util['format'](_0x0a78('0x49'),_0x5df0b5[_0x0a78('0x4a')]),_0x0a78('0x4e'),_0x5df0b5);};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x4f')]=function(_0xe814f0){if(_0xe814f0[_0x0a78('0x50')]===_0x0a78('0x51')){var _0x55f67a={'id':_0xe814f0['id'],'name':_0xe814f0[_0x0a78('0x4a')],'strategy':_0xe814f0[_0x0a78('0x52')],'answered':_0xe814f0[_0x0a78('0x53')],'available':_0xe814f0[_0x0a78('0x54')],'loggedIn':_0xe814f0[_0x0a78('0x55')],'pTalking':_0xe814f0['pTalking'],'sumBillable':_0xe814f0['sumBillable'],'sumDuration':_0xe814f0['sumDuration'],'sumHoldTime':_0xe814f0[_0x0a78('0x56')]||0x0,'talking':_0xe814f0[_0x0a78('0x31')],'total':_0xe814f0[_0x0a78('0x57')],'type':_0xe814f0['type'],'unmanaged':_0xe814f0['unmanaged'],'abandoned':_0xe814f0[_0x0a78('0x58')],'waiting':_0xe814f0['waiting']};if(_0xe814f0[_0x0a78('0x59')]){_0x55f67a[_0x0a78('0x59')]={'id':_0xe814f0[_0x0a78('0x59')]['id'],'name':_0xe814f0['Trunk']['name'],'active':_0xe814f0[_0x0a78('0x59')][_0x0a78('0x5a')],'callerid':_0xe814f0[_0x0a78('0x59')]['callerid']};}if(_0xe814f0[_0x0a78('0x5b')]){_0x55f67a['Interval']={'id':_0xe814f0[_0x0a78('0x5b')]['id'],'name':_0xe814f0[_0x0a78('0x5b')][_0x0a78('0x4a')]};}var _0x30f3be=md5(JSON[_0x0a78('0x5c')](_0x55f67a));if(_0xe814f0[_0x0a78('0x4')]!==_0x30f3be){_0xe814f0[_0x0a78('0x4')]=_0x30f3be;this['emit'](util[_0x0a78('0x48')](_0x0a78('0x49'),_0x55f67a[_0x0a78('0x4a')]),_0x0a78('0x5d'),_0x55f67a);}}};VoiceQueueReport['prototype'][_0x0a78('0x5e')]=function(_0x42e5d1){return _0x42e5d1!==null&&!_[_0x0a78('0x5f')](_0x42e5d1);};VoiceQueueReport['prototype'][_0x0a78('0x2d')]=function(){var _0x2a3531=this;setInterval(function(){_0x2a3531[_0x0a78('0x35')]();ami[_0x0a78('0x39')]({'action':_0x0a78('0x60')})[_0x0a78('0x3b')](loggerCatch(_0x0a78('0x61')));},0x2710);};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x2c')]=function(){var _0x1c310b=this;setInterval(function(){if(_0x1c310b[_0x0a78('0x62')]){return ami[_0x0a78('0x39')]({'action':'queuesummary'})['then'](function(_0x5a9081){_0x1c310b[_0x0a78('0x62')]=![];})[_0x0a78('0x3b')](loggerCatch(_0x0a78('0x63')));}},0x3e8);};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x17')]=function(_0xc70373){try{if(this['isNotNull'](_0xc70373)&&this[_0x0a78('0x5e')](_0xc70373[_0x0a78('0x64')])){if(this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]]){var _0x2db159=_[_0x0a78('0x65')](this[_0x0a78('0x36')],'queue')[_0xc70373[_0x0a78('0x64')]]||0x0;var _0x45dd18=_0x2db159-_0xc70373[_0x0a78('0x66')];if(this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]]['waiting']!==_['toNumber'](_0xc70373[_0x0a78('0x66')])||this[_0x0a78('0x14')][_0xc70373['queue']][_0x0a78('0x55')]!==_[_0x0a78('0x67')](_0xc70373[_0x0a78('0x68')])||this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]][_0x0a78('0x54')]!==_[_0x0a78('0x67')](_0xc70373[_0x0a78('0x54')])||this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]][_0x0a78('0x31')]!==_0x45dd18){this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]][_0x0a78('0x33')]=_[_0x0a78('0x67')](_0xc70373['callers']);this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]]['loggedIn']=_[_0x0a78('0x67')](_0xc70373[_0x0a78('0x68')]);this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]][_0x0a78('0x54')]=_[_0x0a78('0x67')](_0xc70373[_0x0a78('0x54')]);this['voiceQueues'][_0xc70373['queue']]['talking']=_0x45dd18>0x0?_0x45dd18:0x0;this[_0x0a78('0x14')][_0xc70373['queue']][_0x0a78('0x31')]=this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]]['talking']>_['toNumber'](_0xc70373[_0x0a78('0x68')])?_[_0x0a78('0x67')](_0xc70373['loggedin']):this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]]['talking'];this[_0x0a78('0x4f')](this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]]);}ami[_0x0a78('0x46')]('custom:queuesummary',this[_0x0a78('0x14')][_0xc70373['queue']]);}}}catch(_0x15ff7d){logger['error'](_0x0a78('0x69'),util[_0x0a78('0x45')](_0x15ff7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')]['syncQueueSummaryComplete']=function(_0x42a97a){this[_0x0a78('0x62')]=!![];};VoiceQueueReport[_0x0a78('0xd')]['syncNewExten']=function(_0xdb95cd){};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x1c')]=function(_0x1eaaa3){try{if(this[_0x0a78('0x5e')](_0x1eaaa3)){if(_['isUndefined'](this['queueReports'][_0x1eaaa3[_0x0a78('0x6a')]])){this[_0x0a78('0x11')][_0x1eaaa3[_0x0a78('0x6a')]]=[];this['channels'][_0x1eaaa3['uniqueid']]={};}var _0x58c74c=new QueueReport();_0x58c74c[_0x0a78('0x4a')]=_0x1eaaa3[_0x0a78('0x64')];_0x58c74c[_0x0a78('0x50')]=this[_0x0a78('0x14')][_0x58c74c[_0x0a78('0x4a')]]&&this[_0x0a78('0x14')][_0x58c74c[_0x0a78('0x4a')]]['type']?this[_0x0a78('0x14')][_0x58c74c[_0x0a78('0x4a')]][_0x0a78('0x50')]||_0x0a78('0x51'):_0x0a78('0x51');_0x58c74c['queue']=_0x1eaaa3[_0x0a78('0x64')];_0x58c74c['queuecallerjoinAt']=moment()[_0x0a78('0x48')](_0x0a78('0x6b'));_0x58c74c['position']=_0x1eaaa3['position'];_0x58c74c[_0x0a78('0x6c')]=_0x1eaaa3[_0x0a78('0x6c')];_[_0x0a78('0x6d')](_0x58c74c,_['pick'](_0x1eaaa3,_[_0x0a78('0x6e')](_0x58c74c)));this['queueReports'][_0x1eaaa3[_0x0a78('0x6a')]][_0x0a78('0x6f')](_0x58c74c);this[_0x0a78('0x36')][_0x1eaaa3[_0x0a78('0x6a')]]=_0x58c74c;this[_0x0a78('0x47')](_0x58c74c);}}catch(_0x253a37){logger[_0x0a78('0x3e')](_0x0a78('0x70'),util[_0x0a78('0x45')](_0x253a37,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x1e')]=function(_0x4f58d){try{if(this[_0x0a78('0x5e')](_0x4f58d)){if(this['queueReports'][_0x4f58d[_0x0a78('0x6a')]]){var _0x95d7b6=_['last'](this['queueReports'][_0x4f58d[_0x0a78('0x6a')]]);_0x95d7b6[_0x0a78('0x71')]=![];_0x95d7b6[_0x0a78('0x72')]=null;_0x95d7b6[_0x0a78('0x73')]=_0x4f58d[_0x0a78('0x73')];_0x95d7b6[_0x0a78('0x74')]=_0x4f58d[_0x0a78('0x74')];_0x95d7b6[_0x0a78('0x1d')]=!![];_0x95d7b6[_0x0a78('0x75')]=moment()[_0x0a78('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x95d7b6[_0x0a78('0x76')]=_0x0a78('0x77');_0x95d7b6[_0x0a78('0x78')]=null;this[_0x0a78('0x36')][_0x4f58d['uniqueid']]=_0x95d7b6;this[_0x0a78('0x44')](_0x95d7b6);}}}catch(_0x1585c5){logger[_0x0a78('0x3e')](_0x0a78('0x79'),util[_0x0a78('0x45')](_0x1585c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x7a')]=function(_0x1a6f17){try{if(this[_0x0a78('0x5e')](_0x1a6f17)){if(this[_0x0a78('0x11')][_0x1a6f17['uniqueid']]){var _0x495184=_[_0x0a78('0x7b')](this[_0x0a78('0x11')][_0x1a6f17['uniqueid']]);_0x495184['queuecallerleaveAt']=moment()[_0x0a78('0x48')](_0x0a78('0x6b'));_0x495184[_0x0a78('0x7c')]=_0x1a6f17[_0x0a78('0x7c')];_0x495184['connectedlinename']=_0x1a6f17[_0x0a78('0x7d')];this[_0x0a78('0x36')][_0x1a6f17[_0x0a78('0x6a')]]=_0x495184;this[_0x0a78('0x47')](_0x495184);}}}catch(_0xa2e477){logger['error'](_0x0a78('0x7e'),util[_0x0a78('0x45')](_0xa2e477,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x7f')]=function(_0x43e2e9){try{if(this[_0x0a78('0x5e')](_0x43e2e9)){if(this['queueReports'][_0x43e2e9[_0x0a78('0x6a')]]){var _0x2a46f5=_[_0x0a78('0x7b')](this['queueReports'][_0x43e2e9['uniqueid']]);_0x2a46f5[_0x0a78('0x71')]=!![];_0x2a46f5[_0x0a78('0x76')]=_0x0a78('0x80');}}}catch(_0x452ce){logger[_0x0a78('0x3e')](_0x0a78('0x81'),util[_0x0a78('0x45')](_0x452ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0a78('0x20')]=function(_0x13e8fe){try{if(this[_0x0a78('0x5e')](_0x13e8fe)){if(this['queueReports'][_0x13e8fe[_0x0a78('0x6a')]]){var _0x351d86=_[_0x0a78('0x7b')](this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x6a')]]);_0x351d86['queuecallerabandon']=![];_0x351d86[_0x0a78('0x75')]=null;_0x351d86[_0x0a78('0x82')]=!![];_0x351d86['lastAssignedTo']=_0x13e8fe['membername'];_0x351d86[_0x0a78('0x73')]=_0x13e8fe['holdtime'];_0x351d86[_0x0a78('0x71')]=!![];_0x351d86[_0x0a78('0x83')]=![];_0x351d86[_0x0a78('0x84')]=null;if(!_0x351d86['transfer']){if(_0x13e8fe[_0x0a78('0x85')]==_0x0a78('0x86')){_0x351d86[_0x0a78('0x76')]='COMPLETED';}else{if(_[_0x0a78('0x87')](_0x13e8fe[_0x0a78('0x88')]['toLowerCase'](),_0x0a78('0x89'))){if(this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x8a')]]){var _0x1fcb7e=_[_0x0a78('0x7b')](this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x8a')]]);_0x1fcb7e[_0x0a78('0x71')]=![];_0x1fcb7e[_0x0a78('0x83')]=!![];_0x1fcb7e[_0x0a78('0x84')]=moment(_0x351d86['queuecallerjoinAt'])[_0x0a78('0x8b')](_0x13e8fe['holdtime'],_0x0a78('0x8c'))[_0x0a78('0x48')](_0x0a78('0x6b'));_0x1fcb7e[_0x0a78('0x76')]=_0x0a78('0x8d');_0x1fcb7e[_0x0a78('0x86')]=!![];_0x1fcb7e['transfertype']='FORWARD';_0x1fcb7e[_0x0a78('0x8e')]=_0x13e8fe[_0x0a78('0x8f')];_0x1fcb7e[_0x0a78('0x90')]=_0x13e8fe[_0x0a78('0x6a')];var _0x67109=this['queueReports'][_0x13e8fe[_0x0a78('0x8a')]];this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x8a')]]=this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x6a')]];this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x6a')]]=_0x67109;}}else{_0x351d86[_0x0a78('0x76')]=_0x0a78('0x91')+_0x13e8fe[_0x0a78('0x85')][_0x0a78('0x92')]();}}}this[_0x0a78('0x36')][_0x13e8fe[_0x0a78('0x6a')]]=_0x351d86;this[_0x0a78('0x44')](_0x351d86);}}}catch(_0x592492){logger[_0x0a78('0x3e')](_0x0a78('0x93'),util[_0x0a78('0x45')](_0x592492,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')]['syncVarSet']=function(_0x2cd199){try{if(this[_0x0a78('0x5e')](_0x2cd199)){this[_0x0a78('0x94')](_0x2cd199[_0x0a78('0x6a')],_['keys'](_0x2cd199[_0x0a78('0x95')])[0x0],_0x2cd199[_0x0a78('0x96')]);if(this['queueReports'][_0x2cd199[_0x0a78('0x6a')]]){var _0x4ef531=_[_0x0a78('0x7b')](this['queueReports'][_0x2cd199[_0x0a78('0x6a')]]);if(_0x4ef531){if(this[_0x0a78('0x5e')](_0x2cd199[_0x0a78('0x95')])&&this[_0x0a78('0x5e')](_0x2cd199[_0x0a78('0x95')][_0x0a78('0x97')])){switch(_0x2cd199[_0x0a78('0x96')]){case'CONTINUE':_0x4ef531[_0x0a78('0x83')]=![];_0x4ef531['queuecallerexitAt']=null;break;case _0x0a78('0x98'):_0x4ef531['lastevent']=_0x0a78('0x99');ami[_0x0a78('0x46')](_0x0a78('0x9a'),_0x4ef531);break;default:_0x4ef531[_0x0a78('0x83')]=!![];_0x4ef531[_0x0a78('0x84')]=moment()['format'](_0x0a78('0x6b'));_0x4ef531[_0x0a78('0x9b')]=moment()[_0x0a78('0x48')](_0x0a78('0x6b'));}_0x4ef531[_0x0a78('0x1d')]=![];_0x4ef531[_0x0a78('0x75')]=null;_0x4ef531[_0x0a78('0x76')]=_0x2cd199[_0x0a78('0x96')];this['channels'][_0x2cd199['uniqueid']]=_0x4ef531;this[_0x0a78('0x44')](_0x4ef531);}else if(this[_0x0a78('0x5e')](_0x2cd199[_0x0a78('0x95')])&&this[_0x0a78('0x5e')](_0x2cd199[_0x0a78('0x95')][_0x0a78('0x9c')])){if(!_0x4ef531[_0x0a78('0x1d')]){_0x4ef531['queuecallerexit']=!![];_0x4ef531[_0x0a78('0x84')]=moment()['format'](_0x0a78('0x6b'));_0x4ef531[_0x0a78('0x76')]=_0x0a78('0x9d');_0x4ef531['queuecallerleaveAt']=moment()[_0x0a78('0x48')](_0x0a78('0x6b'));this[_0x0a78('0x36')][_0x2cd199[_0x0a78('0x6a')]]=_0x4ef531;}}_0x4ef531[_0x0a78('0x16')]=this[_0x0a78('0x16')][_0x2cd199[_0x0a78('0x6a')]];}}}}catch(_0x59b8b1){logger[_0x0a78('0x3e')](_0x0a78('0x9e'),util[_0x0a78('0x45')](_0x59b8b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0a78('0x94')]=function(_0x1a926b,_0x459e75,_0x20d7cd){var _0x22f038=['rtpaudioqos',_0x0a78('0x9f'),_0x0a78('0xa0'),_0x0a78('0xa1'),_0x0a78('0xa2'),_0x0a78('0xa3'),_0x0a78('0xa4'),_0x0a78('0xa5'),_0x0a78('0xa6'),'sipuri',_0x0a78('0xa7'),_0x0a78('0xa8'),_0x0a78('0xa9'),_0x0a78('0xaa'),'memberinterface',_0x0a78('0xab'),_0x0a78('0xac'),'memberpenalty',_0x0a78('0xad')];if(!_[_0x0a78('0x38')](_0x459e75)&&!_[_0x0a78('0xae')](_0x22f038,_0x459e75)){if(_['isUndefined'](this[_0x0a78('0x16')][_0x1a926b])){this[_0x0a78('0x16')][_0x1a926b]={};}this[_0x0a78('0x16')][_0x1a926b][_0x459e75]=_0x20d7cd;}};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0xaf')]=function(_0x5a3539){try{if(this[_0x0a78('0x5e')](_0x5a3539)){if(this['queueReports'][_0x5a3539['uniqueid']]){for(var _0x2f2dac=0x0,_0x341164={};_0x2f2dac0x0?_0x243288:0x0;this['voiceQueues'][_0x3693d9[_0xa66c('0x5d')]][_0xa66c('0x32')]=this[_0xa66c('0x13')][_0x3693d9[_0xa66c('0x5d')]][_0xa66c('0x32')]>_[_0xa66c('0x60')](_0x3693d9[_0xa66c('0x61')])?_[_0xa66c('0x60')](_0x3693d9['loggedin']):this[_0xa66c('0x13')][_0x3693d9['queue']][_0xa66c('0x32')];this['emitVoiceQueueSummary'](this[_0xa66c('0x13')][_0x3693d9[_0xa66c('0x5d')]]);}ami[_0xa66c('0x45')](_0xa66c('0x62'),this[_0xa66c('0x13')][_0x3693d9[_0xa66c('0x5d')]]);}}}catch(_0x2c6d42){logger[_0xa66c('0x3d')]('[syncQueueSummary][VoiceQueueReport]',util[_0xa66c('0x43')](_0x2c6d42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa66c('0xc')]['syncQueueSummaryComplete']=function(_0x268003){this[_0xa66c('0x14')]=!![];};VoiceQueueReport[_0xa66c('0xc')]['syncNewExten']=function(_0x23947d){};VoiceQueueReport[_0xa66c('0xc')]['syncQueueCallerJoin']=function(_0x4157fe){try{if(this[_0xa66c('0x59')](_0x4157fe)){if(_[_0xa66c('0x2e')](this[_0xa66c('0xf')][_0x4157fe[_0xa66c('0x63')]])){this[_0xa66c('0xf')][_0x4157fe['uniqueid']]=[];this[_0xa66c('0x11')][_0x4157fe[_0xa66c('0x63')]]={};}var _0x181eaf=new QueueReport();_0x181eaf[_0xa66c('0x48')]=_0x4157fe[_0xa66c('0x5d')];_0x181eaf[_0xa66c('0x52')]=this[_0xa66c('0x13')][_0x181eaf[_0xa66c('0x48')]]&&this[_0xa66c('0x13')][_0x181eaf[_0xa66c('0x48')]]['type']?this[_0xa66c('0x13')][_0x181eaf[_0xa66c('0x48')]][_0xa66c('0x52')]||_0xa66c('0x4a'):_0xa66c('0x4a');_0x181eaf[_0xa66c('0x5d')]=_0x4157fe[_0xa66c('0x5d')];_0x181eaf['queuecallerjoinAt']=moment()[_0xa66c('0x46')](_0xa66c('0x64'));_0x181eaf['position']=_0x4157fe[_0xa66c('0x65')];_0x181eaf['count']=_0x4157fe[_0xa66c('0x66')];_[_0xa66c('0x67')](_0x181eaf,_[_0xa66c('0x68')](_0x4157fe,_[_0xa66c('0x69')](_0x181eaf)));this['queueReports'][_0x4157fe['uniqueid']][_0xa66c('0x6a')](_0x181eaf);this['channels'][_0x4157fe[_0xa66c('0x63')]]=_0x181eaf;this['emitVoiceQueueChannelSave'](_0x181eaf);}}catch(_0x48e2e3){logger['error']('[syncQueueCallerJoin][VoiceQueueReport]',util['inspect'](_0x48e2e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x1c')]=function(_0x108408){try{if(this[_0xa66c('0x59')](_0x108408)){if(this[_0xa66c('0xf')][_0x108408[_0xa66c('0x63')]]){var _0x5dd8cc=_[_0xa66c('0x6b')](this[_0xa66c('0xf')][_0x108408[_0xa66c('0x63')]]);_0x5dd8cc[_0xa66c('0x6c')]=![];_0x5dd8cc['queuecallercompleteAt']=null;_0x5dd8cc['holdtime']=_0x108408[_0xa66c('0x6d')];_0x5dd8cc['originalposition']=_0x108408[_0xa66c('0x6e')];_0x5dd8cc[_0xa66c('0x1b')]=!![];_0x5dd8cc[_0xa66c('0x6f')]=moment()['format'](_0xa66c('0x64'));_0x5dd8cc['queuecallerexitreason']=_0xa66c('0x70');_0x5dd8cc[_0xa66c('0x71')]=null;this['channels'][_0x108408[_0xa66c('0x63')]]=_0x5dd8cc;this['emitVoiceQueueChannelRemove'](_0x5dd8cc);}}}catch(_0x5d20de){logger[_0xa66c('0x3d')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0xa66c('0x43')](_0x5d20de,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa66c('0x1e')]=function(_0x32cbf6){try{if(this[_0xa66c('0x59')](_0x32cbf6)){if(this[_0xa66c('0xf')][_0x32cbf6[_0xa66c('0x63')]]){var _0x5f4059=_['last'](this[_0xa66c('0xf')][_0x32cbf6['uniqueid']]);_0x5f4059[_0xa66c('0x72')]=moment()[_0xa66c('0x46')](_0xa66c('0x64'));_0x5f4059[_0xa66c('0x73')]=_0x32cbf6[_0xa66c('0x73')];_0x5f4059[_0xa66c('0x74')]=_0x32cbf6['connectedlinename'];this[_0xa66c('0x11')][_0x32cbf6['uniqueid']]=_0x5f4059;this[_0xa66c('0x44')](_0x5f4059);}}}catch(_0xfa9fe0){logger[_0xa66c('0x3d')](_0xa66c('0x75'),util[_0xa66c('0x43')](_0xfa9fe0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x10e324){try{if(this[_0xa66c('0x59')](_0x10e324)){if(this[_0xa66c('0xf')][_0x10e324['uniqueid']]){var _0x5b29da=_[_0xa66c('0x6b')](this[_0xa66c('0xf')][_0x10e324[_0xa66c('0x63')]]);_0x5b29da[_0xa66c('0x6c')]=!![];_0x5b29da[_0xa66c('0x76')]=_0xa66c('0x77');}}}catch(_0x2a5362){logger[_0xa66c('0x3d')](_0xa66c('0x78'),util[_0xa66c('0x43')](_0x2a5362,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x1755ac){try{if(this[_0xa66c('0x59')](_0x1755ac)){if(this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x63')]]){var _0x137336=_['last'](this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x63')]]);_0x137336['queuecallerabandon']=![];_0x137336['queuecallerabandonAt']=null;_0x137336['assigned']=!![];_0x137336['lastAssignedTo']=_0x1755ac[_0xa66c('0x79')];_0x137336[_0xa66c('0x6d')]=_0x1755ac[_0xa66c('0x6d')];_0x137336[_0xa66c('0x6c')]=!![];_0x137336[_0xa66c('0x7a')]=![];_0x137336['queuecallerexitAt']=null;if(!_0x137336[_0xa66c('0x7b')]){if(_0x1755ac[_0xa66c('0x7c')]==_0xa66c('0x7b')){_0x137336[_0xa66c('0x76')]=_0xa66c('0x7d');}else{if(_['startsWith'](_0x1755ac[_0xa66c('0x3a')]['toLowerCase'](),_0xa66c('0x7e'))){if(this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x7f')]]){var _0x254648=_[_0xa66c('0x6b')](this[_0xa66c('0xf')][_0x1755ac['linkedid']]);_0x254648[_0xa66c('0x6c')]=![];_0x254648[_0xa66c('0x7a')]=!![];_0x254648['queuecallerexitAt']=moment(_0x137336['queuecallerjoinAt'])['add'](_0x1755ac[_0xa66c('0x6d')],'seconds')[_0xa66c('0x46')](_0xa66c('0x64'));_0x254648[_0xa66c('0x76')]=_0xa66c('0x80');_0x254648[_0xa66c('0x7b')]=!![];_0x254648[_0xa66c('0x81')]=_0xa66c('0x82');_0x254648['transferexten']=_0x1755ac[_0xa66c('0x83')];_0x254648[_0xa66c('0x84')]=_0x1755ac[_0xa66c('0x63')];var _0x5b0829=this[_0xa66c('0xf')][_0x1755ac['linkedid']];this[_0xa66c('0xf')][_0x1755ac['linkedid']]=this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x63')]];this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x63')]]=_0x5b0829;}}else{_0x137336[_0xa66c('0x76')]=_0xa66c('0x85')+_0x1755ac[_0xa66c('0x7c')]['toUpperCase']();}}}this[_0xa66c('0x11')][_0x1755ac['uniqueid']]=_0x137336;this[_0xa66c('0x42')](_0x137336);}}}catch(_0x1c161d){logger['error'](_0xa66c('0x86'),util['inspect'](_0x1c161d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x87')]=function(_0x45b051){try{if(this[_0xa66c('0x59')](_0x45b051)){this[_0xa66c('0x88')](_0x45b051[_0xa66c('0x63')],_[_0xa66c('0x69')](_0x45b051['variable'])[0x0],_0x45b051[_0xa66c('0x89')]);if(this['queueReports'][_0x45b051[_0xa66c('0x63')]]){var _0x46837f=_[_0xa66c('0x6b')](this[_0xa66c('0xf')][_0x45b051['uniqueid']]);if(_0x46837f){if(this[_0xa66c('0x59')](_0x45b051[_0xa66c('0x8a')])&&this[_0xa66c('0x59')](_0x45b051[_0xa66c('0x8a')][_0xa66c('0x8b')])){switch(_0x45b051['value']){case _0xa66c('0x8c'):_0x46837f[_0xa66c('0x7a')]=![];_0x46837f[_0xa66c('0x8d')]=null;break;case'TIMEOUT':_0x46837f[_0xa66c('0x8e')]=_0xa66c('0x8f');ami[_0xa66c('0x45')](_0xa66c('0x90'),_0x46837f);break;default:_0x46837f[_0xa66c('0x7a')]=!![];_0x46837f['queuecallerexitAt']=moment()[_0xa66c('0x46')](_0xa66c('0x64'));_0x46837f[_0xa66c('0x72')]=moment()[_0xa66c('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x46837f['queuecallerabandon']=![];_0x46837f['queuecallerabandonAt']=null;_0x46837f['queuecallerexitreason']=_0x45b051[_0xa66c('0x89')];this['channels'][_0x45b051[_0xa66c('0x63')]]=_0x46837f;this['emitVoiceQueueChannelRemove'](_0x46837f);}else if(this[_0xa66c('0x59')](_0x45b051['variable'])&&this[_0xa66c('0x59')](_0x45b051[_0xa66c('0x8a')][_0xa66c('0x91')])){if(!_0x46837f[_0xa66c('0x1b')]){_0x46837f['queuecallerexit']=!![];_0x46837f[_0xa66c('0x8d')]=moment()[_0xa66c('0x46')](_0xa66c('0x64'));_0x46837f[_0xa66c('0x76')]=_0xa66c('0x92');_0x46837f['queuecallerleaveAt']=moment()[_0xa66c('0x46')](_0xa66c('0x64'));this[_0xa66c('0x11')][_0x45b051['uniqueid']]=_0x46837f;}}_0x46837f[_0xa66c('0x16')]=this[_0xa66c('0x16')][_0x45b051[_0xa66c('0x63')]];}}}}catch(_0x5c5392){logger[_0xa66c('0x3d')]('[syncVarSet][VoiceQueueReport]',util[_0xa66c('0x43')](_0x5c5392,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x88')]=function(_0xed1e,_0x139384,_0x3d753a){var _0x6fc3d9=[_0xa66c('0x93'),_0xa66c('0x94'),_0xa66c('0x95'),'rtpaudioqosjitterbridged',_0xa66c('0x96'),_0xa66c('0x97'),_0xa66c('0x98'),'rtpaudioqosrttbridged',_0xa66c('0x99'),_0xa66c('0x9a'),'bridgepeer',_0xa66c('0x9b'),_0xa66c('0x9c'),'memberdynamic',_0xa66c('0x9d'),_0xa66c('0x9e'),_0xa66c('0x79'),_0xa66c('0x9f'),'memberrealtime'];if(!_['isNil'](_0x139384)&&!_[_0xa66c('0xa0')](_0x6fc3d9,_0x139384)){if(_[_0xa66c('0x2e')](this[_0xa66c('0x16')][_0xed1e])){this[_0xa66c('0x16')][_0xed1e]={};}this[_0xa66c('0x16')][_0xed1e][_0x139384]=_0x3d753a;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x56668f){try{if(this['isNotNull'](_0x56668f)){if(this['queueReports'][_0x56668f['uniqueid']]){for(var _0xdf820b=0x0,_0x5ed90c={};_0xdf820b=0x0?moment(_0xd028c3['endtime'])['diff'](_0xd028c3[_0x21cd('0x18')],_0x21cd('0xd')):null,'data1':_0x21cd('0x1a'),'data2':_0xd028c3[_0x21cd('0x13')],'data3':_0xd028c3[_0x21cd('0x10')],'data4':_0xd028c3[_0x21cd('0x1b')]||null,'role':_0x21cd('0x12'),'internal':_0xd028c3[_0x21cd('0x13')]?_[_0x21cd('0x14')](_0xd028c3[_0x21cd('0x13')]):undefined,'uniqueid':_0xd028c3[_0x21cd('0x15')]},'log':_0x21cd('0x5')});}; \ No newline at end of file +var _0x9ace=['isNil','interface','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','outbound','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice'];(function(_0x4a5bc5,_0x1b7986){var _0x471924=function(_0x23deb5){while(--_0x23deb5){_0x4a5bc5['push'](_0x4a5bc5['shift']());}};_0x471924(++_0x1b7986);}(_0x9ace,0x153));var _0xe9ac=function(_0x9c4cd3,_0x1f0c88){_0x9c4cd3=_0x9c4cd3-0x0;var _0x5ed84d=_0x9ace[_0x9c4cd3];return _0x5ed84d;};'use strict';var moment=require(_0xe9ac('0x0'));var _=require(_0xe9ac('0x1'));var util=require(_0xe9ac('0x2'));var client=require(_0xe9ac('0x3'));exports[_0xe9ac('0x4')]=function(_0x59f6d6){var _0x411304=_0x59f6d6[_0xe9ac('0x5')]||_0x59f6d6['queuecallerexitAt'];return client[_0xe9ac('0x6')](_0xe9ac('0x7'),{'body':{'channel':_0xe9ac('0x8'),'membername':_0x59f6d6['lastAssignedTo'],'interface':_[_0xe9ac('0x9')](_0x59f6d6[_0xe9ac('0xa')])?util['format'](_0xe9ac('0xb'),_0x59f6d6[_0xe9ac('0xc')]):_0x59f6d6[_0xe9ac('0xa')],'type':_0xe9ac('0xd'),'enterAt':_0x59f6d6[_0xe9ac('0xe')],'exitAt':_0x411304,'duration':moment(_0x411304)[_0xe9ac('0xf')](_0x59f6d6['queuecallerleaveAt'],_0xe9ac('0x10')),'data1':'inbound','data2':_0x59f6d6[_0xe9ac('0x11')],'data3':_0x59f6d6[_0xe9ac('0x12')],'data4':null,'data5':_0x59f6d6[_0xe9ac('0x13')],'role':_0xe9ac('0x14'),'internal':_0x59f6d6[_0xe9ac('0x15')]?_[_0xe9ac('0x16')](_0x59f6d6['accountcode']):undefined,'uniqueid':_0x59f6d6[_0xe9ac('0x17')]},'log':_0xe9ac('0x7')});};exports[_0xe9ac('0x18')]=function(_0x27565b){return client[_0xe9ac('0x6')](_0xe9ac('0x7'),{'body':{'channel':_0xe9ac('0x8'),'membername':_0x27565b[_0xe9ac('0x19')],'interface':_0x27565b[_0xe9ac('0xa')],'type':_0xe9ac('0xd'),'enterAt':_0x27565b['starttime'],'exitAt':_0x27565b['endtime'],'duration':moment(_0x27565b[_0xe9ac('0x1a')])[_0xe9ac('0xf')](_0x27565b[_0xe9ac('0x1b')],_0xe9ac('0x10'))>=0x0?moment(_0x27565b[_0xe9ac('0x1a')])['diff'](_0x27565b[_0xe9ac('0x1b')],'seconds'):null,'data1':_0xe9ac('0x1c'),'data2':_0x27565b[_0xe9ac('0x15')],'data3':_0x27565b[_0xe9ac('0x12')],'data4':_0x27565b['dialstring']||null,'role':'agent','internal':_0x27565b[_0xe9ac('0x15')]?_['toNumber'](_0x27565b[_0xe9ac('0x15')]):undefined,'uniqueid':_0x27565b[_0xe9ac('0x17')]},'log':_0xe9ac('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9f15a5f..de4635e 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 _0x2504=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x4281fd,_0x1a198f){var _0x41cf17=function(_0x36e097){while(--_0x36e097){_0x4281fd['push'](_0x4281fd['shift']());}};_0x41cf17(++_0x1a198f);}(_0x2504,0xee));var _0x4250=function(_0x50951a,_0xbe9010){_0x50951a=_0x50951a-0x0;var _0x162bd0=_0x2504[_0x50951a];return _0x162bd0;};'use strict';var client=require(_0x4250('0x0'));exports[_0x4250('0x1')]=function(_0x3e4ada){return function(_0xc1dec8){return client[_0x4250('0x2')](_0x4250('0x3'),{'options':{'raw':!![],'attributes':['id',_0x4250('0x4'),_0x4250('0x5')]},'log':_0x4250('0x3')});};}; \ No newline at end of file +var _0x373d=['GetTemplate','html','../client','Request'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x373d,0x1e2));var _0xd373=function(_0x154a27,_0x8fee08){_0x154a27=_0x154a27-0x0;var _0x201b9c=_0x373d[_0x154a27];return _0x201b9c;};'use strict';var client=require(_0xd373('0x0'));exports['getTemplates']=function(_0x3d3d31){return function(_0x53f3b7){return client[_0xd373('0x1')](_0xd373('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xd373('0x3')]},'log':_0xd373('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 6426617..e6a0427 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 _0x3acd=['data1','data3','data4','data5','data6','../client','GetTrigger','name','field','value','Condition','AnyConditions','operator','Actions','action'];(function(_0x5cdd4f,_0x5a3d00){var _0x2834da=function(_0xdf0d1e){while(--_0xdf0d1e){_0x5cdd4f['push'](_0x5cdd4f['shift']());}};_0x2834da(++_0x5a3d00);}(_0x3acd,0xe6));var _0xd3ac=function(_0x1a57b5,_0x5a6289){_0x1a57b5=_0x1a57b5-0x0;var _0x423238=_0x3acd[_0x1a57b5];return _0x423238;};'use strict';var client=require(_0xd3ac('0x0'));exports['getTriggers']=function(_0xd8172a){return function(_0x1c103f){return client['Request'](_0xd3ac('0x1'),{'options':{'raw':![],'attributes':['id',_0xd3ac('0x2'),'channel','status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xd3ac('0x3'),'operator',_0xd3ac('0x4')]},{'model':_0xd3ac('0x5'),'as':_0xd3ac('0x6'),'attributes':['id',_0xd3ac('0x3'),_0xd3ac('0x7'),_0xd3ac('0x4')]},{'model':'Action','as':_0xd3ac('0x8'),'attributes':['id',_0xd3ac('0x9'),_0xd3ac('0xa'),'data2',_0xd3ac('0xb'),_0xd3ac('0xc'),_0xd3ac('0xd'),_0xd3ac('0xe'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xc471=['value','Condition','AnyConditions','Action','Actions','data2','data3','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','AllConditions','field','operator'];(function(_0x51b648,_0x3af80d){var _0x58a6e5=function(_0x588c4d){while(--_0x588c4d){_0x51b648['push'](_0x51b648['shift']());}};_0x58a6e5(++_0x3af80d);}(_0xc471,0x76));var _0x1c47=function(_0x2720ce,_0x47d0a9){_0x2720ce=_0x2720ce-0x0;var _0x509ebb=_0xc471[_0x2720ce];return _0x509ebb;};'use strict';var client=require(_0x1c47('0x0'));exports[_0x1c47('0x1')]=function(_0x117a30){return function(_0x2fd029){return client['Request'](_0x1c47('0x2'),{'options':{'raw':![],'attributes':['id',_0x1c47('0x3'),_0x1c47('0x4'),'status'],'include':[{'model':'Condition','as':_0x1c47('0x5'),'attributes':['id',_0x1c47('0x6'),_0x1c47('0x7'),_0x1c47('0x8')]},{'model':_0x1c47('0x9'),'as':_0x1c47('0xa'),'attributes':['id',_0x1c47('0x6'),_0x1c47('0x7'),_0x1c47('0x8')]},{'model':_0x1c47('0xb'),'as':_0x1c47('0xc'),'attributes':['id','action','data1',_0x1c47('0xd'),_0x1c47('0xe'),'data4',_0x1c47('0xf'),_0x1c47('0x10'),_0x1c47('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5876585..9eb1b40 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 _0x9c96=['getTrunks','registry','GetTrunk'];(function(_0x60339a,_0x25e79c){var _0x2ea897=function(_0x3a47e7){while(--_0x3a47e7){_0x60339a['push'](_0x60339a['shift']());}};_0x2ea897(++_0x25e79c);}(_0x9c96,0x156));var _0x69c9=function(_0x2eee65,_0x4289ff){_0x2eee65=_0x2eee65-0x0;var _0x27cd03=_0x9c96[_0x2eee65];return _0x27cd03;};'use strict';var client=require('../client');exports[_0x69c9('0x0')]=function(_0xb0b8dd){return function(_0x58169e){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x69c9('0x1')]},'log':_0x69c9('0x2')});};}; \ No newline at end of file +var _0x2492=['GetTrunk','name','registry','getTrunks'];(function(_0x983d26,_0x49c775){var _0x452a0c=function(_0xa4f62c){while(--_0xa4f62c){_0x983d26['push'](_0x983d26['shift']());}};_0x452a0c(++_0x49c775);}(_0x2492,0xcb));var _0x2249=function(_0x343f8c,_0x30b366){_0x343f8c=_0x343f8c-0x0;var _0x380ebf=_0x2492[_0x343f8c];return _0x380ebf;};'use strict';var client=require('../client');exports[_0x2249('0x0')]=function(_0xf9d79f){return function(_0x8dcf57){return client['Request'](_0x2249('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2249('0x2'),_0x2249('0x3')]},'log':_0x2249('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 5b15b4c..e67dd47 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 _0x318d=['agent','email','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','telephone','accountcode','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','name','getAgent','getAgents','Request','GetUser'];(function(_0x574167,_0x5a8520){var _0x3fbcc8=function(_0xfef9bd){while(--_0xfef9bd){_0x574167['push'](_0x574167['shift']());}};_0x3fbcc8(++_0x5a8520);}(_0x318d,0x1c9));var _0xd318=function(_0x2b4835,_0x429677){_0x2b4835=_0x2b4835-0x0;var _0x39c81b=_0x318d[_0x2b4835];return _0x39c81b;};'use strict';var client=require('../client');exports[_0xd318('0x0')]=function(){return function(){return client[_0xd318('0x1')](_0xd318('0x2'),{'options':{'raw':![],'where':{'role':_0xd318('0x3')},'attributes':['id','name',_0xd318('0x4'),'accountcode',_0xd318('0x5'),'online',_0xd318('0x6'),_0xd318('0x7'),_0xd318('0x8'),_0xd318('0x9'),_0xd318('0xa'),_0xd318('0xb'),_0xd318('0xc')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0xd318('0x1')](_0xd318('0x2'),{'options':{'raw':!![],'where':{'role':_0xd318('0xd')},'attributes':['id','name',_0xd318('0xe'),'internal']},'log':_0xd318('0xf')});};};exports[_0xd318('0x10')]=function(_0x4c4c7d,_0x377847,_0x53ac84){return client[_0xd318('0x1')](_0xd318('0x11'),{'body':{'type':_0x377847,'uniqueid':_0x53ac84},'options':{'where':{'id':_0x4c4c7d['id']}},'log':'savePause'});};exports[_0xd318('0x12')]=function(_0x1c38f1){return client['Request'](_0xd318('0x13'),{'body':{},'options':{'where':{'id':_0x1c38f1['id']}},'log':_0xd318('0x10')});};exports['getAgent']=function(_0x5b4ddd){return client[_0xd318('0x1')](_0xd318('0x14'),{'options':{'raw':![],'where':{'role':_0xd318('0x3'),'id':_0x5b4ddd},'attributes':['id',_0xd318('0x15'),_0xd318('0x4'),_0xd318('0xe'),'fullname','online',_0xd318('0x6'),_0xd318('0x7'),_0xd318('0x8'),_0xd318('0x9'),_0xd318('0xc')]},'log':_0xd318('0x16')});}; \ No newline at end of file +var _0x41a2=['interface','../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','pauseType','voicePause','phone','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','lastLoginAt','lastPauseAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x41a2,0x143));var _0x241a=function(_0x3cf1dc,_0x1d3274){_0x3cf1dc=_0x3cf1dc-0x0;var _0xb97c58=_0x41a2[_0x3cf1dc];return _0xb97c58;};'use strict';var client=require(_0x241a('0x0'));exports[_0x241a('0x1')]=function(){return function(){return client[_0x241a('0x2')](_0x241a('0x3'),{'options':{'raw':![],'where':{'role':_0x241a('0x4')},'attributes':['id',_0x241a('0x5'),_0x241a('0x6'),_0x241a('0x7'),_0x241a('0x8'),_0x241a('0x9'),'lastLoginAt',_0x241a('0xa'),'lastPauseAt',_0x241a('0xb'),_0x241a('0xc'),'mobile','interface']},'log':_0x241a('0x1')});};};exports[_0x241a('0xd')]=function(){return function(){return client['Request'](_0x241a('0x3'),{'options':{'raw':!![],'where':{'role':_0x241a('0xe')},'attributes':['id',_0x241a('0x5'),_0x241a('0x7'),_0x241a('0xf')]},'log':_0x241a('0xd')});};};exports['savePause']=function(_0x3da48c,_0xa2e513,_0x31a5d9){return client[_0x241a('0x2')](_0x241a('0x10'),{'body':{'type':_0xa2e513,'uniqueid':_0x31a5d9},'options':{'where':{'id':_0x3da48c['id']}},'log':'savePause'});};exports['saveUnpause']=function(_0xe6216c){return client[_0x241a('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0xe6216c['id']}},'log':_0x241a('0x11')});};exports[_0x241a('0x12')]=function(_0x4af57c){return client[_0x241a('0x2')](_0x241a('0x13'),{'options':{'raw':![],'where':{'role':_0x241a('0x4'),'id':_0x4af57c},'attributes':['id','name',_0x241a('0x6'),'accountcode',_0x241a('0x8'),_0x241a('0x9'),_0x241a('0x14'),_0x241a('0xa'),_0x241a('0x15'),'voicePause',_0x241a('0x16')]},'log':_0x241a('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ba1c28e..bd0c5d3 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 _0x5bbd=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd5bb('0x0'));exports[_0xd5bb('0x1')]=function(_0x427a12){return client[_0xd5bb('0x2')](_0xd5bb('0x3'),{'body':_0x427a12,'log':_0xd5bb('0x3')});};exports[_0xd5bb('0x4')]=function(_0x480517,_0x5db64a,_0x4a4799){return client[_0xd5bb('0x2')](_0xd5bb('0x5'),{'body':_0x480517,'options':{'where':{'uniqueid':_0x5db64a,'interface':_0x4a4799,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xa858=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x3bb7b7,_0x5236ae){var _0x925e91=function(_0x281a8e){while(--_0x281a8e){_0x3bb7b7['push'](_0x3bb7b7['shift']());}};_0x925e91(++_0x5236ae);}(_0xa858,0x1f1));var _0x8a85=function(_0x513f9a,_0x27a11f){_0x513f9a=_0x513f9a-0x0;var _0x1bf32f=_0xa858[_0x513f9a];return _0x1bf32f;};'use strict';var client=require(_0x8a85('0x0'));exports[_0x8a85('0x1')]=function(_0x3c3d31){return client[_0x8a85('0x2')](_0x8a85('0x3'),{'body':_0x3c3d31,'log':_0x8a85('0x3')});};exports[_0x8a85('0x4')]=function(_0x493457,_0x23372a,_0x1940a4){return client[_0x8a85('0x2')](_0x8a85('0x5'),{'body':_0x493457,'options':{'where':{'uniqueid':_0x23372a,'interface':_0x1940a4,'agentcomplete':!![]}},'log':_0x8a85('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2aa2ab4..6fafb43 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 _0x919a=['../client','create','Request','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash'];(function(_0x253b32,_0x3b3c53){var _0x42b52e=function(_0x1008c1){while(--_0x1008c1){_0x253b32['push'](_0x253b32['shift']());}};_0x42b52e(++_0x3b3c53);}(_0x919a,0xb2));var _0xa919=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x919a[_0x5f0089];return _0x193892;};'use strict';var moment=require('moment');var util=require(_0xa919('0x0'));var _=require(_0xa919('0x1'));var client=require(_0xa919('0x2'));exports[_0xa919('0x3')]=function(_0x291f0f){return client[_0xa919('0x4')](_0xa919('0x5'),{'body':_[_0xa919('0x6')](_0x291f0f,{'source':_0x291f0f['calleridnum'],'destinationcontext':_0x291f0f['context'],'callerid':_0x291f0f[_0xa919('0x7')],'amaflags':_0xa919('0x8')}),'log':_0xa919('0x5')});};exports[_0xa919('0x9')]=function(){return function(){return client[_0xa919('0x4')](_0xa919('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xa919('0xb')](_0xa919('0xc'))[_0xa919('0xd')](_0xa919('0xe')),moment()['endOf'](_0xa919('0xc'))['format'](_0xa919('0xe'))]}},'attributes':[_0xa919('0xf'),_0xa919('0x10'),_0xa919('0x11'),_0xa919('0x12')]},'log':_0xa919('0x13')});};}; \ No newline at end of file +var _0x866e=['moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports'];(function(_0xbcb6,_0x8e00a9){var _0x58899b=function(_0x35e0c4){while(--_0x35e0c4){_0xbcb6['push'](_0xbcb6['shift']());}};_0x58899b(++_0x8e00a9);}(_0x866e,0xa8));var _0xe866=function(_0x277e7d,_0x54b29c){_0x277e7d=_0x277e7d-0x0;var _0x33568d=_0x866e[_0x277e7d];return _0x33568d;};'use strict';var moment=require(_0xe866('0x0'));var util=require(_0xe866('0x1'));var _=require(_0xe866('0x2'));var client=require(_0xe866('0x3'));exports[_0xe866('0x4')]=function(_0x5d8e1a){return client[_0xe866('0x5')](_0xe866('0x6'),{'body':_[_0xe866('0x7')](_0x5d8e1a,{'source':_0x5d8e1a['calleridnum'],'destinationcontext':_0x5d8e1a[_0xe866('0x8')],'callerid':_0x5d8e1a[_0xe866('0x9')],'amaflags':_0xe866('0xa')}),'log':_0xe866('0x6')});};exports[_0xe866('0xb')]=function(){return function(){return client['Request'](_0xe866('0xc'),{'options':{'where':{'type':[_0xe866('0xd')],'createdAt':{'$between':[moment()[_0xe866('0xe')](_0xe866('0xf'))[_0xe866('0x10')](_0xe866('0x11')),moment()[_0xe866('0x12')]('day')[_0xe866('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xe866('0x13'),_0xe866('0x14'),_0xe866('0x15'),_0xe866('0x16')]},'log':_0xe866('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f59c9de..0df3bbe 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 _0x8019=['../client','create','Request','CreateVoiceDialReport'];(function(_0x8afcc4,_0x139cb3){var _0x3c01c5=function(_0x171686){while(--_0x171686){_0x8afcc4['push'](_0x8afcc4['shift']());}};_0x3c01c5(++_0x139cb3);}(_0x8019,0xe0));var _0x9801=function(_0x504df6,_0x43699e){_0x504df6=_0x504df6-0x0;var _0x425a7d=_0x8019[_0x504df6];return _0x425a7d;};'use strict';var client=require(_0x9801('0x0'));exports[_0x9801('0x1')]=function(_0x48a225){return client[_0x9801('0x2')](_0x9801('0x3'),{'body':_0x48a225,'log':_0x9801('0x3')});}; \ No newline at end of file +var _0x5398=['CreateVoiceDialReport','../client','create','Request'];(function(_0x34a6eb,_0x537ebe){var _0x33510b=function(_0x36b71d){while(--_0x36b71d){_0x34a6eb['push'](_0x34a6eb['shift']());}};_0x33510b(++_0x537ebe);}(_0x5398,0x161));var _0x8539=function(_0x309edd,_0x45b3ed){_0x309edd=_0x309edd-0x0;var _0x97e361=_0x5398[_0x309edd];return _0x97e361;};'use strict';var client=require(_0x8539('0x0'));exports[_0x8539('0x1')]=function(_0x26709){return client[_0x8539('0x2')](_0x8539('0x3'),{'body':_0x26709,'log':_0x8539('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2561904..f1f6425 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 _0xc3b7=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0xa2c37d,_0x644ba2){var _0x469aca=function(_0x453997){while(--_0x453997){_0xa2c37d['push'](_0xa2c37d['shift']());}};_0x469aca(++_0x644ba2);}(_0xc3b7,0xb4));var _0x7c3b=function(_0xed2c2c,_0x3374ba){_0xed2c2c=_0xed2c2c-0x0;var _0x415329=_0xc3b7[_0xed2c2c];return _0x415329;};'use strict';var client=require('../client');exports[_0x7c3b('0x0')]=function(){return function(){return client[_0x7c3b('0x1')](_0x7c3b('0x2'),{'options':{'raw':!![],'attributes':['id',_0x7c3b('0x3'),_0x7c3b('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x7c3b('0x0')});};}; \ No newline at end of file +var _0xdc91=['getVoiceExtensions','../client'];(function(_0x107fbf,_0x5c9aa1){var _0x593974=function(_0x5cf487){while(--_0x5cf487){_0x107fbf['push'](_0x107fbf['shift']());}};_0x593974(++_0x5c9aa1);}(_0xdc91,0x8b));var _0x1dc9=function(_0x4b65c2,_0x562e9a){_0x4b65c2=_0x4b65c2-0x0;var _0xe9e29d=_0xdc91[_0x4b65c2];return _0xe9e29d;};'use strict';var client=require(_0x1dc9('0x0'));exports[_0x1dc9('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x1dc9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 09abf8f..58f305b 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 _0x47bb=['Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','TrunkBackup','callerid'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x47bb,0x1ca));var _0xb47b=function(_0x3a0f77,_0x39f605){_0x3a0f77=_0x3a0f77-0x0;var _0x54fd0c=_0x47bb[_0x3a0f77];return _0x54fd0c;};'use strict';var client=require('../client');exports[_0xb47b('0x0')]=function(){return function(){return client[_0xb47b('0x1')](_0xb47b('0x2'),{'options':{'raw':![],'attributes':['id',_0xb47b('0x3'),_0xb47b('0x4'),_0xb47b('0x5'),_0xb47b('0x6'),_0xb47b('0x7'),_0xb47b('0x8'),_0xb47b('0x9'),_0xb47b('0xa'),_0xb47b('0xb'),_0xb47b('0xc'),_0xb47b('0xd'),_0xb47b('0xe'),_0xb47b('0xf'),_0xb47b('0x10'),_0xb47b('0x11'),_0xb47b('0x12'),_0xb47b('0x13'),_0xb47b('0x14'),_0xb47b('0x15'),_0xb47b('0x16'),_0xb47b('0x17'),_0xb47b('0x18'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0xb47b('0x19'),_0xb47b('0x1a'),'dialGlobalMaxRetry',_0xb47b('0x1b'),_0xb47b('0x1c'),_0xb47b('0x1d'),'dialCheckDuplicateType',_0xb47b('0x1e'),_0xb47b('0x1f'),_0xb47b('0x20'),_0xb47b('0x21'),'dialAMDTotalAnalysisTime',_0xb47b('0x22'),_0xb47b('0x23'),_0xb47b('0x24'),_0xb47b('0x25'),'dialAMDMaximumWordLength',_0xb47b('0x26'),_0xb47b('0x27'),_0xb47b('0x28'),_0xb47b('0x29'),_0xb47b('0x2a'),_0xb47b('0x2b'),_0xb47b('0x2c'),'monitor_format','strategy',_0xb47b('0x2d'),_0xb47b('0x2e'),'dialNoSuchNumberMaxRetry',_0xb47b('0x2f'),_0xb47b('0x30'),'dialDropRetryFrequency',_0xb47b('0x31'),_0xb47b('0x32'),'dialMachineMaxRetry',_0xb47b('0x33'),_0xb47b('0x34'),_0xb47b('0x35'),_0xb47b('0x36'),_0xb47b('0x37'),_0xb47b('0x38')],'include':[{'model':_0xb47b('0x39'),'as':'Trunk','attributes':['id',_0xb47b('0x3'),'callerid',_0xb47b('0x3a')]},{'model':_0xb47b('0x3b'),'as':'mandatoryDispositionPause','attributes':['id',_0xb47b('0x3')]},{'model':_0xb47b('0x39'),'as':_0xb47b('0x3c'),'attributes':['id','name',_0xb47b('0x3d'),_0xb47b('0x3a')]},{'model':_0xb47b('0x3e'),'as':'Interval','attributes':['id',_0xb47b('0x3')],'include':[{'model':'Interval','as':_0xb47b('0x3f'),'attributes':['id',_0xb47b('0x3'),_0xb47b('0x40')]}]}]},'log':_0xb47b('0x0')});};}; \ No newline at end of file +var _0xac0d=['acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw'];(function(_0x25d8f4,_0x2f10ad){var _0x23e222=function(_0x12bed7){while(--_0x12bed7){_0x25d8f4['push'](_0x25d8f4['shift']());}};_0x23e222(++_0x2f10ad);}(_0xac0d,0x14c));var _0xdac0=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xac0d[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0xdac0('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xdac0('0x1'),{'options':{'raw':![],'attributes':['id',_0xdac0('0x2'),_0xdac0('0x3'),_0xdac0('0x4'),_0xdac0('0x5'),_0xdac0('0x6'),_0xdac0('0x7'),_0xdac0('0x8'),_0xdac0('0x9'),_0xdac0('0xa'),_0xdac0('0xb'),_0xdac0('0xc'),_0xdac0('0xd'),'dialPredictiveOptimizationPercentage',_0xdac0('0xe'),_0xdac0('0xf'),_0xdac0('0x10'),_0xdac0('0x11'),_0xdac0('0x12'),'dialQueueTimeout',_0xdac0('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0xdac0('0x14'),_0xdac0('0x15'),_0xdac0('0x16'),_0xdac0('0x17'),_0xdac0('0x18'),_0xdac0('0x19'),_0xdac0('0x1a'),_0xdac0('0x1b'),'dialAMDActive','dialAMDInitialSilence','dialAMDGreeting',_0xdac0('0x1c'),'dialAMDTotalAnalysisTime',_0xdac0('0x1d'),_0xdac0('0x1e'),_0xdac0('0x1f'),_0xdac0('0x20'),_0xdac0('0x21'),'timeout','dialRecallMeTimeout',_0xdac0('0x22'),'dialOrderByScheduledAt',_0xdac0('0x23'),'dialAgiAfterHangupClient',_0xdac0('0x24'),_0xdac0('0x6'),_0xdac0('0x25'),_0xdac0('0x26'),_0xdac0('0x27'),_0xdac0('0x28'),'dialNoSuchNumberRetryFrequency',_0xdac0('0x29'),_0xdac0('0x2a'),_0xdac0('0x2b'),'dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency',_0xdac0('0x2c'),_0xdac0('0x2d'),_0xdac0('0x2e'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xdac0('0x2f'),'as':_0xdac0('0x2f'),'attributes':['id','name',_0xdac0('0x30'),_0xdac0('0x31')]},{'model':_0xdac0('0x32'),'as':_0xdac0('0x33'),'attributes':['id',_0xdac0('0x2')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id','name',_0xdac0('0x30'),_0xdac0('0x31')]},{'model':'Interval','as':_0xdac0('0x34'),'attributes':['id','name'],'include':[{'model':_0xdac0('0x34'),'as':_0xdac0('0x35'),'attributes':['id',_0xdac0('0x2'),_0xdac0('0x36')]}]}]},'log':_0xdac0('0x37')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 8d9ad74..93f6a54 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 _0x8139=['queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon'];(function(_0x5beb45,_0x2cef68){var _0x29781d=function(_0x413e30){while(--_0x413e30){_0x5beb45['push'](_0x5beb45['shift']());}};_0x29781d(++_0x2cef68);}(_0x8139,0x113));var _0x9813=function(_0x500f94,_0x30e0fd){_0x500f94=_0x500f94-0x0;var _0x4ce260=_0x8139[_0x500f94];return _0x4ce260;};'use strict';var moment=require(_0x9813('0x0'));var _=require(_0x9813('0x1'));var client=require(_0x9813('0x2'));exports[_0x9813('0x3')]=function(_0x2efdfe){return client[_0x9813('0x4')](_0x9813('0x5'),{'body':_0x2efdfe,'log':'CreateVoiceQueueReport'});};exports[_0x9813('0x6')]=function(){return function(){return client[_0x9813('0x4')](_0x9813('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x9813('0x8')]('day')[_0x9813('0x9')](_0x9813('0xa')),moment()[_0x9813('0xb')]('day')[_0x9813('0x9')](_0x9813('0xa'))]}},'attributes':[_0x9813('0xc'),_0x9813('0xd'),_0x9813('0xe'),'queuecallerleaveAt',_0x9813('0xf'),_0x9813('0x10'),'queuecallerexit',_0x9813('0x11'),_0x9813('0x12'),_0x9813('0x13')]},'log':_0x9813('0x14')});};}; \ No newline at end of file +var _0x59b3=['YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','GetVoiceQueueReport','day','format'];(function(_0x12049f,_0x25f34f){var _0x23667e=function(_0x58f936){while(--_0x58f936){_0x12049f['push'](_0x12049f['shift']());}};_0x23667e(++_0x25f34f);}(_0x59b3,0x14e));var _0x359b=function(_0x491cf8,_0x8b5453){_0x491cf8=_0x491cf8-0x0;var _0x48a17d=_0x59b3[_0x491cf8];return _0x48a17d;};'use strict';var moment=require(_0x359b('0x0'));var _=require(_0x359b('0x1'));var client=require(_0x359b('0x2'));exports['create']=function(_0x78830){return client[_0x359b('0x3')](_0x359b('0x4'),{'body':_0x78830,'log':_0x359b('0x4')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x359b('0x3')](_0x359b('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x359b('0x6'))[_0x359b('0x7')](_0x359b('0x8')),moment()[_0x359b('0x9')](_0x359b('0x6'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid','queue',_0x359b('0xa'),'queuecallerleaveAt',_0x359b('0xb'),_0x359b('0xc'),_0x359b('0xd'),_0x359b('0xe'),_0x359b('0xf'),_0x359b('0x10')]},'log':_0x359b('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 7e5c47e..7cdd47d 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 _0x7758=['getVoiceQueueRtPauses','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7758,0x16d));var _0x8775=function(_0x3c1dd2,_0x291c26){_0x3c1dd2=_0x3c1dd2-0x0;var _0x13918b=_0x7758[_0x3c1dd2];return _0x13918b;};'use strict';var client=require(_0x8775('0x0'));exports[_0x8775('0x1')]=function(_0x151b7e){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x151b7e,'paused':!![]},'raw':!![]},'log':_0x8775('0x1')});};}; \ No newline at end of file +var _0xabd3=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x504a30,_0x237404){var _0x217c40=function(_0x101cd4){while(--_0x101cd4){_0x504a30['push'](_0x504a30['shift']());}};_0x217c40(++_0x237404);}(_0xabd3,0x10b));var _0x3abd=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xabd3[_0x25a42a];return _0x1129b1;};'use strict';var client=require(_0x3abd('0x0'));exports[_0x3abd('0x1')]=function(_0x2fd863){return function(){return client[_0x3abd('0x2')](_0x3abd('0x3'),{'options':{'where':{'VoiceQueueId':_0x2fd863,'paused':!![]},'raw':!![]},'log':_0x3abd('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index ffd84a1..57fb23a 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 _0x137c=['merge','monitorFilename','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x159106,_0x13f069){var _0x396ca7=function(_0x1e768b){while(--_0x1e768b){_0x159106['push'](_0x159106['shift']());}};_0x396ca7(++_0x13f069);}(_0x137c,0x13d));var _0xc137=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x137c[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xc137('0x0'));var client=require(_0xc137('0x1'));exports[_0xc137('0x2')]=function(_0x5e94e8){return client[_0xc137('0x3')](_0xc137('0x4'),{'body':_[_0xc137('0x5')](_0x5e94e8,{'value':_0x5e94e8[_0xc137('0x6')]}),'log':_0xc137('0x4')});}; \ No newline at end of file +var _0x9440=['lodash','create','Request','CreateVoiceRecording','merge','monitorFilename'];(function(_0x236a8d,_0x38c3e5){var _0x2d57f7=function(_0x42fbd9){while(--_0x42fbd9){_0x236a8d['push'](_0x236a8d['shift']());}};_0x2d57f7(++_0x38c3e5);}(_0x9440,0x120));var _0x0944=function(_0x5e6677,_0x4afaca){_0x5e6677=_0x5e6677-0x0;var _0x471af0=_0x9440[_0x5e6677];return _0x471af0;};'use strict';var _=require(_0x0944('0x0'));var client=require('../client');exports[_0x0944('0x1')]=function(_0x2d2597){return client[_0x0944('0x2')](_0x0944('0x3'),{'body':_[_0x0944('0x4')](_0x2d2597,{'value':_0x2d2597[_0x0944('0x5')]}),'log':_0x0944('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 3fe2097..81cc235 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 _0x335f=['result','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid','isexternal','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x1940ec,_0xf6db1e){var _0x4b6b22=function(_0x1461a2){while(--_0x1461a2){_0x1940ec['push'](_0x1940ec['shift']());}};_0x4b6b22(++_0xf6db1e);}(_0x335f,0x193));var _0xf335=function(_0x453dfd,_0x2c7796){_0x453dfd=_0x453dfd-0x0;var _0x32e914=_0x335f[_0x453dfd];return _0x32e914;};'use strict';var client=require(_0xf335('0x0'));exports[_0xf335('0x1')]=function(_0x2b5ce8){return client[_0xf335('0x2')](_0xf335('0x3'),{'body':{'result':_0x2b5ce8[_0xf335('0x4')],'transfererchannel':_0x2b5ce8['transfererchannel'],'transferercalleridnum':_0x2b5ce8['transferercalleridnum'],'transferercalleridname':_0x2b5ce8[_0xf335('0x5')],'transfererconnectedlinenum':_0x2b5ce8[_0xf335('0x6')],'transfererconnectedlinename':_0x2b5ce8['transfererconnectedlinename'],'transfereraccountcode':_0x2b5ce8[_0xf335('0x7')],'transferercontext':_0x2b5ce8['transferercontext'],'transfererexten':_0x2b5ce8[_0xf335('0x8')],'transfererlinkedid':_0x2b5ce8[_0xf335('0x9')],'transfereechannel':_0x2b5ce8[_0xf335('0xa')],'transfereecalleridnum':_0x2b5ce8[_0xf335('0xb')],'transfereecalleridname':_0x2b5ce8['transfereecalleridname'],'transfereeconnectedlinenum':_0x2b5ce8[_0xf335('0xc')],'transfereeconnectedlinename':_0x2b5ce8[_0xf335('0xd')],'transfereeaccountcode':_0x2b5ce8['transfereeaccountcode'],'transfereecontext':_0x2b5ce8[_0xf335('0xe')],'transfereeexten':_0x2b5ce8['transfereeexten'],'transfereelinkedid':_0x2b5ce8[_0xf335('0xf')],'isexternal':_0x2b5ce8[_0xf335('0x10')],'context':_0x2b5ce8['context'],'extension':_0x2b5ce8['extension'],'type':_0xf335('0x11')},'log':_0xf335('0x3')});};exports[_0xf335('0x12')]=function(_0x325bd3){return client['Request'](_0xf335('0x3'),{'body':{'result':_0x325bd3['result'],'transfererchannel':_0x325bd3[_0xf335('0x13')],'transferercalleridnum':_0x325bd3['origtransferercalleridnum'],'transferercalleridname':_0x325bd3[_0xf335('0x14')],'transfererconnectedlinenum':_0x325bd3[_0xf335('0x15')],'transfererconnectedlinename':_0x325bd3['secondtransfererconnectedlinename'],'transfereraccountcode':_0x325bd3[_0xf335('0x16')],'transferercontext':_0x325bd3[_0xf335('0x17')],'transfererexten':_0x325bd3[_0xf335('0x18')],'transfererlinkedid':_0x325bd3[_0xf335('0x19')],'transfereechannel':_0x325bd3[_0xf335('0x1a')],'transfereecalleridnum':_0x325bd3[_0xf335('0x1b')],'transfereecalleridname':_0x325bd3[_0xf335('0x1c')],'transfereeconnectedlinenum':_0x325bd3[_0xf335('0x1d')],'transfereeconnectedlinename':_0x325bd3[_0xf335('0x1e')],'transfereeaccountcode':_0x325bd3[_0xf335('0x1f')],'transfereecontext':_0x325bd3[_0xf335('0x20')],'transfereeexten':_0x325bd3[_0xf335('0x21')],'transfereelinkedid':_0x325bd3['transfertargetlinkedid'],'isexternal':_0x325bd3[_0xf335('0x10')],'context':_0x325bd3[_0xf335('0x22')],'extension':_0x325bd3[_0xf335('0x23')],'type':_0xf335('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xd66c=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','attended','../client','Request','transferercalleridnum','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','extension','CreateVoiceTransferReport','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x3dfefb,_0x1f86d8){var _0x5e25b8=function(_0x47e544){while(--_0x47e544){_0x3dfefb['push'](_0x3dfefb['shift']());}};_0x5e25b8(++_0x1f86d8);}(_0xd66c,0xb4));var _0xcd66=function(_0x285df9,_0xcf704c){_0x285df9=_0x285df9-0x0;var _0x2727bb=_0xd66c[_0x285df9];return _0x2727bb;};'use strict';var client=require(_0xcd66('0x0'));exports['blindTransfer']=function(_0x1d999e){return client[_0xcd66('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x1d999e['result'],'transfererchannel':_0x1d999e['transfererchannel'],'transferercalleridnum':_0x1d999e[_0xcd66('0x2')],'transferercalleridname':_0x1d999e['transferercalleridname'],'transfererconnectedlinenum':_0x1d999e[_0xcd66('0x3')],'transfererconnectedlinename':_0x1d999e['transfererconnectedlinename'],'transfereraccountcode':_0x1d999e['transfereraccountcode'],'transferercontext':_0x1d999e[_0xcd66('0x4')],'transfererexten':_0x1d999e[_0xcd66('0x5')],'transfererlinkedid':_0x1d999e[_0xcd66('0x6')],'transfereechannel':_0x1d999e['transfereechannel'],'transfereecalleridnum':_0x1d999e[_0xcd66('0x7')],'transfereecalleridname':_0x1d999e[_0xcd66('0x8')],'transfereeconnectedlinenum':_0x1d999e[_0xcd66('0x9')],'transfereeconnectedlinename':_0x1d999e[_0xcd66('0xa')],'transfereeaccountcode':_0x1d999e['transfereeaccountcode'],'transfereecontext':_0x1d999e['transfereecontext'],'transfereeexten':_0x1d999e[_0xcd66('0xb')],'transfereelinkedid':_0x1d999e[_0xcd66('0xc')],'isexternal':_0x1d999e[_0xcd66('0xd')],'context':_0x1d999e['context'],'extension':_0x1d999e[_0xcd66('0xe')],'type':'blind'},'log':_0xcd66('0xf')});};exports[_0xcd66('0x10')]=function(_0x27b76e){return client[_0xcd66('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x27b76e[_0xcd66('0x11')],'transfererchannel':_0x27b76e[_0xcd66('0x12')],'transferercalleridnum':_0x27b76e[_0xcd66('0x13')],'transferercalleridname':_0x27b76e['origtransferercalleridname'],'transfererconnectedlinenum':_0x27b76e[_0xcd66('0x14')],'transfererconnectedlinename':_0x27b76e[_0xcd66('0x15')],'transfereraccountcode':_0x27b76e[_0xcd66('0x16')],'transferercontext':_0x27b76e[_0xcd66('0x17')],'transfererexten':_0x27b76e[_0xcd66('0x18')],'transfererlinkedid':_0x27b76e[_0xcd66('0x19')],'transfereechannel':_0x27b76e[_0xcd66('0x1a')],'transfereecalleridnum':_0x27b76e[_0xcd66('0x1b')],'transfereecalleridname':_0x27b76e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x27b76e[_0xcd66('0x1c')],'transfereeconnectedlinename':_0x27b76e[_0xcd66('0x1d')],'transfereeaccountcode':_0x27b76e[_0xcd66('0x1e')],'transfereecontext':_0x27b76e['transfertargetcontext'],'transfereeexten':_0x27b76e[_0xcd66('0x1f')],'transfereelinkedid':_0x27b76e[_0xcd66('0x20')],'isexternal':_0x27b76e['isexternal'],'context':_0x27b76e['origtransferercontext'],'extension':_0x27b76e['origtransfererexten'],'type':_0xcd66('0x21')},'log':_0xcd66('0xf')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 59e1f2a..c1b51f2 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 _0x3aff=['send','checkAfterSend','server','http','127.0.0.1','log','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','join','command','Command','content','catch','message','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','push','values','channels','length','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','map','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts'];(function(_0x3f9943,_0x48d89d){var _0x58577c=function(_0x44fca0){while(--_0x44fca0){_0x3f9943['push'](_0x3f9943['shift']());}};_0x58577c(++_0x48d89d);}(_0x3aff,0x1ad));var _0xf3af=function(_0x47bea9,_0x342588){_0x47bea9=_0x47bea9-0x0;var _0x4d3750=_0x3aff[_0x47bea9];return _0x4d3750;};'use strict';var _=require(_0xf3af('0x0'));var util=require(_0xf3af('0x1'));var jayson=require(_0xf3af('0x2'));var schema=require(_0xf3af('0x3'));var BPromise=require(_0xf3af('0x4'));var moment=require(_0xf3af('0x5'));var config=require(_0xf3af('0x6'));var properties=require('../properties');var ami=require(_0xf3af('0x7'));exports[_0xf3af('0x8')]=function(_0x3fce7d,_0x4bfb91,_0x514ed6){return new BPromise(function(_0x264bed,_0x1e934a){var _0x18a88a={'QueuePause':function(_0x20ddab){return new Promise(function(_0x4282bc,_0x271f0b){var _0x1cd4d4=util[_0xf3af('0x9')](_0xf3af('0xa'),_0xf3af('0xb'),_0x20ddab[_0xf3af('0xc')]);if(_0x3fce7d[_0xf3af('0xd')]&&_0x3fce7d[_0xf3af('0xd')][_0x1cd4d4]&&_0x3fce7d[_0xf3af('0xd')][_0x1cd4d4][_0xf3af('0xe')]){_0x3fce7d[_0xf3af('0xd')][_0x1cd4d4][_0xf3af('0xf')]();}if(_0x3fce7d[_0xf3af('0x10')][_0x1cd4d4]){_0x3fce7d[_0xf3af('0x10')][_0x1cd4d4][_0xf3af('0x11')]({'statePause':_0x20ddab[_0xf3af('0x12')]?!![]:![]});}_0x4282bc({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1eadf9){var _0x5d7f7c=this;return new Promise(function(_0x1ac066,_0x36555d){if(ami[_0xf3af('0x13')]()==![]){return _0x36555d(_0x5d7f7c[_0xf3af('0x14')](0x1f4,[config[_0xf3af('0x15')]['ip'],config[_0xf3af('0x15')][_0xf3af('0x16')],_0xf3af('0x17')]['join']('\x20')));}_0x1eadf9=_[_0xf3af('0x18')](_0x1eadf9,_[_0xf3af('0x19')](properties[_0xf3af('0x1a')]));_0x1eadf9[_0xf3af('0x1b')]=_0xf3af('0x1c');return ami[_0xf3af('0x1d')](_0x1eadf9)[_0xf3af('0x1e')](function(_0x48b535){_0x1ac066({'code':0xc8,'message':_0x48b535['message']});})['catch'](function(_0x1a87e6){_0x36555d(_0x5d7f7c[_0xf3af('0x14')](0x1f5,_0x1a87e6['message']));});});},'Command':function(_0x1e6581){var _0xc9a51b=this;return new Promise(function(_0x974715,_0x59f904){if(ami[_0xf3af('0x13')]()==![]){return _0x59f904(_0xc9a51b[_0xf3af('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xf3af('0x15')]['username'],_0xf3af('0x17')][_0xf3af('0x1f')]('\x20')));}_0x1e6581=_[_0xf3af('0x18')](_0x1e6581,_0xf3af('0x20'));_0x1e6581['action']=_0xf3af('0x21');return ami[_0xf3af('0x1d')](_0x1e6581)[_0xf3af('0x1e')](function(_0x2d72b1){_0x974715({'code':0xc8,'message':_0x2d72b1[_0xf3af('0x22')]});})[_0xf3af('0x23')](function(_0x1e349d){_0x59f904(_0xc9a51b['error'](0x1f5,_0x1e349d[_0xf3af('0x24')]));});});},'VoiceQueues':function(_0xf596f0){return new Promise(function(_0x33d44,_0x1939d8){var _0x11dcbc=[];for(var _0x364f19 in _0x3fce7d[_0xf3af('0x25')]){if(_0x3fce7d[_0xf3af('0x25')][_0xf3af('0x26')](_0x364f19)){var _0x353fe0=_0x3fce7d[_0xf3af('0x25')][_0x364f19];var _0x1997ea={'id':_0x353fe0['id'],'name':_0x353fe0[_0xf3af('0xc')],'strategy':_0x353fe0[_0xf3af('0x27')],'answered':_0x353fe0[_0xf3af('0x28')],'available':_0x353fe0[_0xf3af('0x29')],'loggedIn':_0x353fe0[_0xf3af('0x2a')],'pTalking':_0x353fe0[_0xf3af('0x2b')],'sumBillable':_0x353fe0['sumBillable'],'sumDuration':_0x353fe0[_0xf3af('0x2c')],'sumHoldTime':_0x353fe0['sumHoldTime']||0x0,'talking':_0x353fe0['talking'],'total':_0x353fe0[_0xf3af('0x2d')],'type':_0x353fe0[_0xf3af('0x2e')],'unmanaged':_0x353fe0[_0xf3af('0x2f')],'abandoned':_0x353fe0[_0xf3af('0x30')],'waiting':_0x353fe0[_0xf3af('0x31')],'loggedInDb':_0x353fe0[_0xf3af('0x32')]};if(_0x353fe0[_0xf3af('0x2e')]===_0xf3af('0x33')){_0x1997ea[_0xf3af('0x34')]=_0x353fe0[_0xf3af('0x34')];_0x1997ea[_0xf3af('0x35')]=_0x353fe0['dialMethod'];_0x1997ea['dialOriginateCallerIdName']=_0x353fe0[_0xf3af('0x36')];_0x1997ea[_0xf3af('0x37')]=_0x353fe0[_0xf3af('0x37')];_0x1997ea[_0xf3af('0x38')]=_0x353fe0['dialOriginateTimeout'];_0x1997ea[_0xf3af('0x39')]=_0x353fe0['dialPrefix'];_0x1997ea[_0xf3af('0x3a')]=_0x353fe0[_0xf3af('0x3a')];_0x1997ea[_0xf3af('0x3b')]=_0x353fe0[_0xf3af('0x3b')];_0x1997ea['outboundBlacklistCallsDay']=_0x353fe0[_0xf3af('0x3c')];_0x1997ea[_0xf3af('0x3d')]=_0x353fe0[_0xf3af('0x3d')];_0x1997ea[_0xf3af('0x3e')]=_0x353fe0[_0xf3af('0x3e')];_0x1997ea[_0xf3af('0x3f')]=_0x353fe0[_0xf3af('0x3f')];_0x1997ea[_0xf3af('0x40')]=_0x353fe0[_0xf3af('0x40')];_0x1997ea[_0xf3af('0x41')]=_0x353fe0[_0xf3af('0x41')];_0x1997ea[_0xf3af('0x42')]=_0x353fe0[_0xf3af('0x42')];_0x1997ea[_0xf3af('0x43')]=_0x353fe0[_0xf3af('0x43')];_0x1997ea[_0xf3af('0x44')]=_0x353fe0[_0xf3af('0x44')];_0x1997ea['outboundReCallsDay']=_0x353fe0[_0xf3af('0x45')];_0x1997ea[_0xf3af('0x46')]=_0x353fe0['outboundRejectCallsDay'];_0x1997ea[_0xf3af('0x47')]=_0x353fe0[_0xf3af('0x47')];_0x1997ea[_0xf3af('0x48')]=_0x353fe0[_0xf3af('0x48')];_0x1997ea[_0xf3af('0x49')]=_0x353fe0[_0xf3af('0x49')];_0x1997ea[_0xf3af('0x4a')]=_0x353fe0['predictiveIntervalAvgTalktime'];_0x1997ea[_0xf3af('0x4b')]=_0x353fe0[_0xf3af('0x4b')];_0x1997ea[_0xf3af('0x4c')]=_0x353fe0[_0xf3af('0x4c')];_0x1997ea[_0xf3af('0x4d')]=_0x353fe0['predictiveIntervalErlangCalls'];_0x1997ea['predictiveIntervalErlangCallsDroppedCalls']=_0x353fe0[_0xf3af('0x4e')];_0x1997ea[_0xf3af('0x4f')]=_0x353fe0[_0xf3af('0x4f')];_0x1997ea['predictiveIntervalMultiplicativeFactor']=_0x353fe0[_0xf3af('0x50')];_0x1997ea[_0xf3af('0x51')]=_0x353fe0[_0xf3af('0x51')];_0x1997ea['predictiveIntervalAvailable']=_0x353fe0[_0xf3af('0x52')];_0x1997ea[_0xf3af('0x53')]=_0x353fe0[_0xf3af('0x53')];_0x1997ea[_0xf3af('0x24')]=_0x353fe0[_0xf3af('0x24')];_0x1997ea[_0xf3af('0x54')]=_0x353fe0[_0xf3af('0x54')];_0x1997ea[_0xf3af('0x55')]=_0x353fe0['erlangCalls'];_0x1997ea[_0xf3af('0x56')]=_0x353fe0[_0xf3af('0x56')];_0x1997ea[_0xf3af('0x57')]=_0x353fe0[_0xf3af('0x57')];_0x1997ea['erlangBusyFactor']=_0x353fe0[_0xf3af('0x58')];_0x1997ea[_0xf3af('0x59')]=_0x353fe0['startPredictive'];_0x1997ea['startProgressive']=_0x353fe0['startProgressive'];}if(_0x353fe0[_0xf3af('0x5a')]){_0x1997ea[_0xf3af('0x5a')]={'id':_0x353fe0['Trunk']['id'],'name':_0x353fe0[_0xf3af('0x5a')]['name'],'active':_0x353fe0[_0xf3af('0x5a')][_0xf3af('0x5b')],'callerid':_0x353fe0[_0xf3af('0x5a')]['callerid']};}if(_0x353fe0['Interval']){_0x1997ea[_0xf3af('0x5c')]={'id':_0x353fe0[_0xf3af('0x5c')]['id'],'name':_0x353fe0[_0xf3af('0x5c')]['name']};}_0x11dcbc[_0xf3af('0x5d')](_0x1997ea);}}_0x33d44({'count':_0x11dcbc['length'],'rows':_0x11dcbc});});},'VoiceChannels':function(_0x4c71a9){return new Promise(function(_0x5133f6,_0x3461d3){var _0xd91e48=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x5f')]);_0x5133f6({'count':_0xd91e48['length'],'rows':_0xd91e48});});},'VoiceChannelMixMonitor':function(_0x2c87c1){var _0x439ccc=this;return new Promise(function(_0x1fde3d,_0x45bc47){if(ami['isConnected']()==![]){return _0x45bc47(_0x439ccc[_0xf3af('0x14')](0x1f4,[config[_0xf3af('0x15')]['ip'],config[_0xf3af('0x15')][_0xf3af('0x16')],'ami\x20disconnected']['join']('\x20')));}var _0x51a293=schema(properties['voicechannel'])['validate'](_0x2c87c1);if(_0x51a293[_0xf3af('0x60')]>0x0){return _0x45bc47(_0x439ccc[_0xf3af('0x14')](0x1f4,_['map'](_0x51a293,_0xf3af('0x24'))[_0xf3af('0x1f')](',\x20')));}var _0x48895b=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x5f')],{'uniqueid':_0x2c87c1[_0xf3af('0x62')]});if(_0x48895b&&_0x48895b[_0xf3af('0x63')]){var _0x5b4f33=util[_0xf3af('0x9')](_0xf3af('0x64'),_0x2c87c1[_0xf3af('0x65')]||_0x2c87c1[_0xf3af('0x62')],_0x2c87c1[_0xf3af('0x9')]||_0xf3af('0x66'));return ami[_0xf3af('0x1d')]({'action':_0xf3af('0x67'),'channel':_0x48895b[_0xf3af('0x63')],'file':_0x5b4f33,'options':_0xf3af('0x68')})[_0xf3af('0x1e')](function(_0x2bc4da){var _0x1b68a7=_[_0xf3af('0x61')](_0x48895b[_0xf3af('0x69')],{'filename':_0xf3af('0x6a')+_0x5b4f33[_0xf3af('0x6b')]()});if(_[_0xf3af('0x6c')](_0x1b68a7)){_0x48895b[_0xf3af('0x69')][_0xf3af('0x5d')]({'filename':_0xf3af('0x6a')+_0x5b4f33[_0xf3af('0x6b')](),'createdAt':moment()[_0xf3af('0x9')](_0xf3af('0x6d')),'mixmonitorid':_0x2bc4da[_0xf3af('0x6e')],'status':_0xf3af('0x6f')});}else{_0x1b68a7['mixmonitorid']=_0x2bc4da[_0xf3af('0x6e')];_0x1b68a7[_0xf3af('0x70')]=_0xf3af('0x6f');}_0x1fde3d({'code':0xc8,'message':[_0x2c87c1[_0xf3af('0x62')],'MixMonitor\x20Success',_0x2bc4da[_0xf3af('0x6e')]][_0xf3af('0x1f')]('\x20'),'mixmonitorid':_0x2bc4da[_0xf3af('0x6e')]});})[_0xf3af('0x23')](function(_0x2a8cc8){_0x45bc47(_0x439ccc[_0xf3af('0x14')](0x1f5,[_0x2c87c1[_0xf3af('0x62')],_0x2a8cc8[_0xf3af('0x24')]['toLowerCase']()][_0xf3af('0x1f')]('\x20')));});}else{return _0x45bc47(_0x439ccc[_0xf3af('0x14')](0x1f5,_0xf3af('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x3de489){var _0x32aa96=this;return new Promise(function(_0x1a7b73,_0x451e5d){if(ami[_0xf3af('0x13')]()==![]){return _0x451e5d(_0x32aa96[_0xf3af('0x14')](0x1f4,[config[_0xf3af('0x15')]['ip'],config['asterisk'][_0xf3af('0x16')],'ami\x20disconnected'][_0xf3af('0x1f')]('\x20')));}var _0x5cd116=schema(properties['voicechannel'])['validate'](_0x3de489);if(_0x5cd116[_0xf3af('0x60')]>0x0){return _0x451e5d(_0x32aa96[_0xf3af('0x14')](0x1f4,_['map'](_0x5cd116,_0xf3af('0x24'))[_0xf3af('0x1f')](',\x20')));}var _0x5de315=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x5f')],{'uniqueid':_0x3de489[_0xf3af('0x62')]});if(_0x5de315){return BPromise['resolve']()[_0xf3af('0x1e')](function(){if(_0x5de315[_0xf3af('0x63')]){return ami['Action']({'action':_0xf3af('0x72'),'channel':_0x5de315[_0xf3af('0x63')],'mixmonitorid':_0x3de489[_0xf3af('0x6e')]})[_0xf3af('0x23')](function(_0x49c367){});}})[_0xf3af('0x1e')](function(){if(_0x5de315[_0xf3af('0x73')]){return ami[_0xf3af('0x1d')]({'action':_0xf3af('0x72'),'channel':_0x5de315[_0xf3af('0x73')],'mixmonitorid':_0x3de489[_0xf3af('0x6e')]})[_0xf3af('0x23')](function(_0x54ae17){});}})[_0xf3af('0x1e')](function(_0xfeb0f3){var _0x112ee5=_[_0xf3af('0x61')](_0x5de315[_0xf3af('0x69')],{'mixmonitorid':_0x3de489['mixmonitorid']});if(_0x112ee5){_0x112ee5[_0xf3af('0x70')]=_0xf3af('0x74');}})[_0xf3af('0x1e')](function(){var _0x4c5e16=util['format'](_0xf3af('0x64'),_0x3de489[_0xf3af('0x65')]||_0x3de489[_0xf3af('0x62')],_0x3de489[_0xf3af('0x9')]||_0xf3af('0x66'));var _0x4368a4=_[_0xf3af('0x61')](_0x5de315[_0xf3af('0x69')],{'filename':_0xf3af('0x6a')+_0x4c5e16['toLowerCase']()});if(_0x4368a4){_0x4368a4[_0xf3af('0x70')]=_0xf3af('0x74');}})[_0xf3af('0x1e')](function(){_0x1a7b73({'code':0xc8,'message':[_0x3de489[_0xf3af('0x62')],_0xf3af('0x75')]['join']('\x20')});})[_0xf3af('0x23')](function(_0x40bfba){_0x451e5d(_0x32aa96[_0xf3af('0x14')](0x1f5,[_0x3de489['uniqueid'],_0x40bfba[_0xf3af('0x24')][_0xf3af('0x6b')]()][_0xf3af('0x1f')]('\x20')));});}else{return _0x451e5d(_0x32aa96['error'](0x1f5,_0xf3af('0x71')));}});},'VoiceQueuesChannels':function(_0xd2693a){return new Promise(function(_0x4464f9,_0x489c2b){var _0x2e9b0e=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x76')]);_0x4464f9({'count':_0x2e9b0e[_0xf3af('0x60')],'rows':_0x2e9b0e});});},'VoiceQueuesChannel':function(_0x10944a){var _0x18c5e4=this;return new Promise(function(_0x4bc8d6,_0x3632e9){var _0x526200=schema(properties['voicequeuechannel'])['validate'](_0x10944a);if(_0x526200[_0xf3af('0x60')]>0x0){return _0x3632e9(_0x18c5e4[_0xf3af('0x14')](0x1f4,_[_0xf3af('0x77')](_0x526200,'message')[_0xf3af('0x1f')](',\x20')));}var _0x2a39da=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x76')],{'uniqueid':_0x10944a[_0xf3af('0x62')]});if(_0x2a39da){_0x4bc8d6(_0x2a39da);}else{return _0x3632e9(_0x18c5e4[_0xf3af('0x14')](0x1f5,_0xf3af('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x562e6c){var _0x5695fb=this;return new Promise(function(_0x288d11,_0xfd14a2){if(ami[_0xf3af('0x13')]()==![]){return _0xfd14a2(_0x5695fb[_0xf3af('0x14')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf3af('0x16')],_0xf3af('0x17')][_0xf3af('0x1f')]('\x20')));}var _0x33b62f=schema(properties[_0xf3af('0x78')])[_0xf3af('0x3')](_0x562e6c);if(_0x33b62f[_0xf3af('0x60')]>0x0){return _0xfd14a2(_0x5695fb[_0xf3af('0x14')](0x1f4,_[_0xf3af('0x77')](_0x33b62f,_0xf3af('0x24'))[_0xf3af('0x1f')](',\x20')));}var _0x3c2480=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x76')],{'uniqueid':_0x562e6c[_0xf3af('0x62')]});if(_0x3c2480&&_0x3c2480['channel']){return ami[_0xf3af('0x1d')]({'action':_0xf3af('0x79'),'channel':_0x3c2480[_0xf3af('0x63')]})[_0xf3af('0x1e')](function(_0x138084){_0x288d11({'code':0xc8,'message':[_0x562e6c[_0xf3af('0x62')],_0x138084[_0xf3af('0x24')][_0xf3af('0x6b')]()][_0xf3af('0x1f')]('\x20')});})['catch'](function(_0x512017){_0xfd14a2(_0x5695fb['error'](0x1f5,[_0x562e6c['uniqueid'],_0x512017[_0xf3af('0x24')][_0xf3af('0x6b')]()][_0xf3af('0x1f')]('\x20')));});}else{return _0xfd14a2(_0x5695fb[_0xf3af('0x14')](0x1f5,_0xf3af('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x24997c){var _0x1de176=this;return new Promise(function(_0x5387a0,_0x23fab8){if(ami[_0xf3af('0x13')]()==![]){return _0x23fab8(_0x1de176[_0xf3af('0x14')](0x1f4,[config[_0xf3af('0x15')]['ip'],config[_0xf3af('0x15')][_0xf3af('0x16')],_0xf3af('0x17')][_0xf3af('0x1f')]('\x20')));}var _0x4d3375=schema(properties[_0xf3af('0x7a')])[_0xf3af('0x3')](_0x24997c);if(_0x4d3375[_0xf3af('0x60')]>0x0){return _0x23fab8(_0x1de176['error'](0x1f4,_[_0xf3af('0x77')](_0x4d3375,_0xf3af('0x24'))[_0xf3af('0x1f')](',\x20')));}var _0xa3b59d=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x76')],{'uniqueid':_0x24997c[_0xf3af('0x62')]});if(_0xa3b59d&&_0xa3b59d['channel']){return ami[_0xf3af('0x1d')]({'action':_0xf3af('0x7b'),'channel':_0xa3b59d['channel'],'exten':_0x24997c[_0xf3af('0x7c')],'context':_0x24997c[_0xf3af('0x7d')]||_0xa3b59d[_0xf3af('0x7d')],'priority':0x1})[_0xf3af('0x1e')](function(_0x1799ee){_0x5387a0({'code':0xc8,'message':[_0x24997c[_0xf3af('0x62')],_0x1799ee[_0xf3af('0x24')][_0xf3af('0x6b')]()]['join']('\x20')});})[_0xf3af('0x23')](function(_0x6b38d3){_0x23fab8(_0x1de176[_0xf3af('0x14')](0x1f5,[_0x24997c[_0xf3af('0x62')],_0x6b38d3[_0xf3af('0x24')]['toLowerCase']()][_0xf3af('0x1f')]('\x20')));});}else{return _0x23fab8(_0x1de176[_0xf3af('0x14')](0x1f5,_0xf3af('0x71')));}});},'Agents':function(_0x16a424){return new Promise(function(_0x5a2d0f,_0x4c9c35){var _0x3e126b=_['values'](_0x3fce7d[_0xf3af('0x10')]);_0x5a2d0f({'count':_0x3e126b[_0xf3af('0x60')],'rows':_0x3e126b});});},'Telephones':function(_0x11968b){return new Promise(function(_0x134eaa,_0x4a1f14){var _0x4e17c1=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x7e')]);_0x134eaa({'count':_0x4e17c1[_0xf3af('0x60')],'rows':_0x4e17c1});});},'Trunks':function(_0x404c50){return new Promise(function(_0x48249f,_0x38770c){var _0x4aa5f9=_['values'](_0x3fce7d[_0xf3af('0x7f')]);_0x48249f({'count':_0x4aa5f9[_0xf3af('0x60')],'rows':_0x4aa5f9});});},'OutboundChannels':function(_0x4f6aa2){return new Promise(function(_0xcb3a2d,_0x50a75a){var _0x5b057a=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x80')]);_0xcb3a2d({'count':_0x5b057a[_0xf3af('0x60')],'rows':_0x5b057a});});},'Outbound':function(_0x246a3f){return new Promise(function(_0x1f5224,_0x5019aa){_0x1f5224(_0x3fce7d[_0xf3af('0x33')]);});},'Campaigns':function(_0x4edcfb){return new Promise(function(_0x55fdb7,_0x41e814){var _0x126f66=_['values'](_0x3fce7d[_0xf3af('0x81')]);_0x55fdb7({'count':_0x126f66[_0xf3af('0x60')],'rows':_0x126f66});});},'VoiceQueuesPreview':function(_0x5afdb3){var _0x105c94=this;return new Promise(function(_0x14720c,_0x274ef2){_0x4bfb91['run'](_0x5afdb3['id'])['then'](function(_0x2f954f){_0x14720c({'code':0xc8,'message':_0x2f954f[_0xf3af('0x24')]});})[_0xf3af('0x23')](function(_0x3fe135){_0x274ef2(_0x105c94[_0xf3af('0x14')](0x1f4,_0x3fe135[_0xf3af('0x24')]));});});},'EventManager':function(_0x30cd7f){var _0x3ad88d=this;return new Promise(function(_0x191806,_0xdd8171){if(!_0x30cd7f[_0xf3af('0x82')]){return _0xdd8171(_0x3ad88d[_0xf3af('0x14')](0x1f4,_0xf3af('0x83')));}ami[_0xf3af('0x84')](_0xf3af('0x85')+_0x30cd7f['event'],_0x30cd7f[_0xf3af('0x24')]);_0x191806({'code':0xc8,'message':_0x30cd7f});});},'FaxAccounts':function(_0x1c74d4){return new Promise(function(_0x2d7987,_0x51d6a3){var _0x27baf5=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x86')]);_0x2d7987({'count':_0x27baf5[_0xf3af('0x60')],'rows':_0x27baf5});});},'SendFax':function(_0x42bc28){var _0x1c9b50=this;return new Promise(function(_0x261072,_0x598de5){_0x514ed6[_0xf3af('0x87')](_0x42bc28)[_0xf3af('0x1e')](function(_0x10f59b){_0x261072({'code':0xc8,'message':_0x10f59b[_0xf3af('0x24')]});})[_0xf3af('0x23')](function(_0x205ce2){_0x598de5(_0x1c9b50[_0xf3af('0x14')](0x1f4,_0x205ce2[_0xf3af('0x24')]));});});},'CheckAfterSend':function(_0x1de028){var _0x400163=this;return new Promise(function(_0x3c2ec3,_0x5515c3){_0x514ed6[_0xf3af('0x88')](_0x1de028)[_0xf3af('0x1e')](function(_0x59e2fd){_0x3c2ec3({'code':0xc8,'message':_0x59e2fd[_0xf3af('0x24')]});})[_0xf3af('0x23')](function(_0x2672f1){_0x5515c3(_0x400163[_0xf3af('0x14')](0x1f4,_0x2672f1[_0xf3af('0x24')]));});});}};var _0x20e0b7=jayson[_0xf3af('0x89')](_0x18a88a)[_0xf3af('0x8a')]();_0x20e0b7['on']('error',function(_0x2ef8cd){return _0x1e934a(_0x2ef8cd);});_0x20e0b7[_0xf3af('0x8')](0x232a,_0xf3af('0x8b'),function(){console[_0xf3af('0x8c')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x264bed('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x06c8=['outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','length','channels','voicechannel','map','find','channel','%s.%s','filename','uniqueid','wav','Action','/var/spool/asterisk/monitor/','isNil','monitors','push','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','toLowerCase','stop','values','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outbound','campaigns','Event\x20name\x20mandatory','emit','send','checkAfterSend','server','http','listen','127.0.0.1','util','validate','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','message','catch','command','then','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix'];(function(_0x386f66,_0x2a4d4c){var _0x255ea2=function(_0x13ebbe){while(--_0x13ebbe){_0x386f66['push'](_0x386f66['shift']());}};_0x255ea2(++_0x2a4d4c);}(_0x06c8,0x1c6));var _0x806c=function(_0x4681b3,_0x19eb35){_0x4681b3=_0x4681b3-0x0;var _0x51c79e=_0x06c8[_0x4681b3];return _0x51c79e;};'use strict';var _=require('lodash');var util=require(_0x806c('0x0'));var jayson=require('jayson/promise');var schema=require(_0x806c('0x1'));var BPromise=require('bluebird');var moment=require(_0x806c('0x2'));var config=require(_0x806c('0x3'));var properties=require(_0x806c('0x4'));var ami=require(_0x806c('0x5'));exports['listen']=function(_0x90f8f6,_0x558cfb,_0x38f646){return new BPromise(function(_0x5ca964,_0x2da081){var _0x18d910={'QueuePause':function(_0x29d3f7){return new Promise(function(_0x138ed6,_0x48753b){var _0x1693e6=util[_0x806c('0x6')](_0x806c('0x7'),_0x806c('0x8'),_0x29d3f7[_0x806c('0x9')]);if(_0x90f8f6['timers']&&_0x90f8f6[_0x806c('0xa')][_0x1693e6]&&_0x90f8f6[_0x806c('0xa')][_0x1693e6][_0x806c('0xb')]){_0x90f8f6[_0x806c('0xa')][_0x1693e6][_0x806c('0xc')]();}if(_0x90f8f6[_0x806c('0xd')][_0x1693e6]){_0x90f8f6[_0x806c('0xd')][_0x1693e6][_0x806c('0xe')]({'statePause':_0x29d3f7['pause']?!![]:![]});}_0x138ed6({'code':0xc8,'message':_0x806c('0xf')});});},'Reload':function(_0x415b48){var _0xb9ccbf=this;return new Promise(function(_0x21ec35,_0x48d065){if(ami[_0x806c('0x10')]()==![]){return _0x48d065(_0xb9ccbf[_0x806c('0x11')](0x1f4,[config[_0x806c('0x12')]['ip'],config[_0x806c('0x12')][_0x806c('0x13')],_0x806c('0x14')][_0x806c('0x15')]('\x20')));}_0x415b48=_[_0x806c('0x16')](_0x415b48,_[_0x806c('0x17')](properties[_0x806c('0x18')]));_0x415b48[_0x806c('0x19')]=_0x806c('0x1a');return ami['Action'](_0x415b48)['then'](function(_0x5210e7){_0x21ec35({'code':0xc8,'message':_0x5210e7[_0x806c('0x1b')]});})[_0x806c('0x1c')](function(_0xeee9c1){_0x48d065(_0xb9ccbf['error'](0x1f5,_0xeee9c1[_0x806c('0x1b')]));});});},'Command':function(_0x10014b){var _0x19e32e=this;return new Promise(function(_0x2b20cd,_0x2ae7d3){if(ami[_0x806c('0x10')]()==![]){return _0x2ae7d3(_0x19e32e[_0x806c('0x11')](0x1f4,[config[_0x806c('0x12')]['ip'],config[_0x806c('0x12')][_0x806c('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x10014b=_[_0x806c('0x16')](_0x10014b,_0x806c('0x1d'));_0x10014b[_0x806c('0x19')]='Command';return ami['Action'](_0x10014b)[_0x806c('0x1e')](function(_0x1f3a67){_0x2b20cd({'code':0xc8,'message':_0x1f3a67[_0x806c('0x1f')]});})[_0x806c('0x1c')](function(_0x1d967c){_0x2ae7d3(_0x19e32e[_0x806c('0x11')](0x1f5,_0x1d967c[_0x806c('0x1b')]));});});},'VoiceQueues':function(_0x4f0fb9){return new Promise(function(_0x42a535,_0x1c772b){var _0x3aca39=[];for(var _0x874897 in _0x90f8f6[_0x806c('0x20')]){if(_0x90f8f6[_0x806c('0x20')][_0x806c('0x21')](_0x874897)){var _0x4084a5=_0x90f8f6[_0x806c('0x20')][_0x874897];var _0x403e65={'id':_0x4084a5['id'],'name':_0x4084a5[_0x806c('0x9')],'strategy':_0x4084a5['strategy'],'answered':_0x4084a5[_0x806c('0x22')],'available':_0x4084a5[_0x806c('0x23')],'loggedIn':_0x4084a5[_0x806c('0x24')],'pTalking':_0x4084a5[_0x806c('0x25')],'sumBillable':_0x4084a5[_0x806c('0x26')],'sumDuration':_0x4084a5[_0x806c('0x27')],'sumHoldTime':_0x4084a5['sumHoldTime']||0x0,'talking':_0x4084a5['talking'],'total':_0x4084a5[_0x806c('0x28')],'type':_0x4084a5['type'],'unmanaged':_0x4084a5['unmanaged'],'abandoned':_0x4084a5['abandoned'],'waiting':_0x4084a5[_0x806c('0x29')],'loggedInDb':_0x4084a5[_0x806c('0x2a')]};if(_0x4084a5[_0x806c('0x2b')]==='outbound'){_0x403e65[_0x806c('0x2c')]=_0x4084a5[_0x806c('0x2c')];_0x403e65[_0x806c('0x2d')]=_0x4084a5[_0x806c('0x2d')];_0x403e65[_0x806c('0x2e')]=_0x4084a5[_0x806c('0x2e')];_0x403e65['dialOriginateCallerIdNumber']=_0x4084a5[_0x806c('0x2f')];_0x403e65[_0x806c('0x30')]=_0x4084a5[_0x806c('0x30')];_0x403e65[_0x806c('0x31')]=_0x4084a5[_0x806c('0x31')];_0x403e65[_0x806c('0x32')]=_0x4084a5['outboundAnswerAgiCallsDay'];_0x403e65[_0x806c('0x33')]=_0x4084a5[_0x806c('0x33')];_0x403e65[_0x806c('0x34')]=_0x4084a5[_0x806c('0x34')];_0x403e65[_0x806c('0x35')]=_0x4084a5[_0x806c('0x35')];_0x403e65[_0x806c('0x36')]=_0x4084a5['outboundCongestionCallsDay'];_0x403e65[_0x806c('0x37')]=_0x4084a5[_0x806c('0x37')];_0x403e65[_0x806c('0x38')]=_0x4084a5[_0x806c('0x38')];_0x403e65[_0x806c('0x39')]=_0x4084a5[_0x806c('0x39')];_0x403e65[_0x806c('0x3a')]=_0x4084a5[_0x806c('0x3a')];_0x403e65[_0x806c('0x3b')]=_0x4084a5[_0x806c('0x3b')];_0x403e65[_0x806c('0x3c')]=_0x4084a5[_0x806c('0x3c')];_0x403e65[_0x806c('0x3d')]=_0x4084a5[_0x806c('0x3d')];_0x403e65[_0x806c('0x3e')]=_0x4084a5[_0x806c('0x3e')];_0x403e65['outboundUnknownCallsDay']=_0x4084a5[_0x806c('0x3f')];_0x403e65[_0x806c('0x40')]=_0x4084a5[_0x806c('0x40')];_0x403e65[_0x806c('0x41')]=_0x4084a5[_0x806c('0x41')];_0x403e65['predictiveIntervalAvgTalktime']=_0x4084a5['predictiveIntervalAvgTalktime'];_0x403e65[_0x806c('0x42')]=_0x4084a5[_0x806c('0x42')];_0x403e65[_0x806c('0x43')]=_0x4084a5[_0x806c('0x43')];_0x403e65[_0x806c('0x44')]=_0x4084a5[_0x806c('0x44')];_0x403e65[_0x806c('0x45')]=_0x4084a5[_0x806c('0x45')];_0x403e65[_0x806c('0x46')]=_0x4084a5[_0x806c('0x46')];_0x403e65[_0x806c('0x47')]=_0x4084a5[_0x806c('0x47')];_0x403e65['predictiveIntervalPauses']=_0x4084a5['predictiveIntervalPauses'];_0x403e65[_0x806c('0x48')]=_0x4084a5[_0x806c('0x48')];_0x403e65[_0x806c('0x49')]=_0x4084a5[_0x806c('0x49')];_0x403e65[_0x806c('0x1b')]=_0x4084a5['message'];_0x403e65[_0x806c('0x4a')]=_0x4084a5[_0x806c('0x4a')];_0x403e65[_0x806c('0x4b')]=_0x4084a5['erlangCalls'];_0x403e65[_0x806c('0x4c')]=_0x4084a5[_0x806c('0x4c')];_0x403e65[_0x806c('0x4d')]=_0x4084a5[_0x806c('0x4d')];_0x403e65[_0x806c('0x4e')]=_0x4084a5[_0x806c('0x4e')];_0x403e65[_0x806c('0x4f')]=_0x4084a5[_0x806c('0x4f')];_0x403e65['startProgressive']=_0x4084a5['startProgressive'];}if(_0x4084a5['Trunk']){_0x403e65[_0x806c('0x50')]={'id':_0x4084a5[_0x806c('0x50')]['id'],'name':_0x4084a5['Trunk']['name'],'active':_0x4084a5[_0x806c('0x50')]['active'],'callerid':_0x4084a5[_0x806c('0x50')][_0x806c('0x51')]};}if(_0x4084a5['Interval']){_0x403e65[_0x806c('0x52')]={'id':_0x4084a5['Interval']['id'],'name':_0x4084a5['Interval'][_0x806c('0x9')]};}_0x3aca39['push'](_0x403e65);}}_0x42a535({'count':_0x3aca39[_0x806c('0x53')],'rows':_0x3aca39});});},'VoiceChannels':function(_0x18efda){return new Promise(function(_0xacd15b,_0x26e7e6){var _0x409f41=_['values'](_0x90f8f6[_0x806c('0x54')]);_0xacd15b({'count':_0x409f41[_0x806c('0x53')],'rows':_0x409f41});});},'VoiceChannelMixMonitor':function(_0x49fe38){var _0x5a6bcb=this;return new Promise(function(_0x1f42f4,_0x1e1516){if(ami[_0x806c('0x10')]()==![]){return _0x1e1516(_0x5a6bcb['error'](0x1f4,[config[_0x806c('0x12')]['ip'],config['asterisk'][_0x806c('0x13')],'ami\x20disconnected'][_0x806c('0x15')]('\x20')));}var _0x39d98c=schema(properties[_0x806c('0x55')])['validate'](_0x49fe38);if(_0x39d98c['length']>0x0){return _0x1e1516(_0x5a6bcb[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x39d98c,_0x806c('0x1b'))[_0x806c('0x15')](',\x20')));}var _0x17eae6=_[_0x806c('0x57')](_0x90f8f6[_0x806c('0x54')],{'uniqueid':_0x49fe38['uniqueid']});if(_0x17eae6&&_0x17eae6[_0x806c('0x58')]){var _0x5fe663=util[_0x806c('0x6')](_0x806c('0x59'),_0x49fe38[_0x806c('0x5a')]||_0x49fe38[_0x806c('0x5b')],_0x49fe38[_0x806c('0x6')]||_0x806c('0x5c'));return ami[_0x806c('0x5d')]({'action':'MixMonitor','channel':_0x17eae6[_0x806c('0x58')],'file':_0x5fe663,'options':'ai(mixmonitorid)'})[_0x806c('0x1e')](function(_0x28370f){var _0x20bfb3=_[_0x806c('0x57')](_0x17eae6['monitors'],{'filename':_0x806c('0x5e')+_0x5fe663['toLowerCase']()});if(_[_0x806c('0x5f')](_0x20bfb3)){_0x17eae6[_0x806c('0x60')][_0x806c('0x61')]({'filename':'/var/spool/asterisk/monitor/'+_0x5fe663['toLowerCase'](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x28370f[_0x806c('0x62')],'status':'rec'});}else{_0x20bfb3[_0x806c('0x62')]=_0x28370f[_0x806c('0x62')];_0x20bfb3[_0x806c('0x63')]='rec';}_0x1f42f4({'code':0xc8,'message':[_0x49fe38[_0x806c('0x5b')],_0x806c('0x64'),_0x28370f['mixmonitorid']][_0x806c('0x15')]('\x20'),'mixmonitorid':_0x28370f[_0x806c('0x62')]});})[_0x806c('0x1c')](function(_0x556e6c){_0x1e1516(_0x5a6bcb[_0x806c('0x11')](0x1f5,[_0x49fe38['uniqueid'],_0x556e6c[_0x806c('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x1e1516(_0x5a6bcb[_0x806c('0x11')](0x1f5,_0x806c('0x65')));}});},'VoiceChannelStopMixMonitor':function(_0x2454c2){var _0x303fad=this;return new Promise(function(_0x318cbf,_0x3327fd){if(ami[_0x806c('0x10')]()==![]){return _0x3327fd(_0x303fad['error'](0x1f4,[config[_0x806c('0x12')]['ip'],config[_0x806c('0x12')][_0x806c('0x13')],'ami\x20disconnected']['join']('\x20')));}var _0x4a24f5=schema(properties['voicechannel'])['validate'](_0x2454c2);if(_0x4a24f5['length']>0x0){return _0x3327fd(_0x303fad[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x4a24f5,'message')[_0x806c('0x15')](',\x20')));}var _0xd3ccd4=_['find'](_0x90f8f6['channels'],{'uniqueid':_0x2454c2[_0x806c('0x5b')]});if(_0xd3ccd4){return BPromise[_0x806c('0x66')]()['then'](function(){if(_0xd3ccd4[_0x806c('0x58')]){return ami[_0x806c('0x5d')]({'action':_0x806c('0x67'),'channel':_0xd3ccd4[_0x806c('0x58')],'mixmonitorid':_0x2454c2[_0x806c('0x62')]})[_0x806c('0x1c')](function(_0x6856d5){});}})[_0x806c('0x1e')](function(){if(_0xd3ccd4[_0x806c('0x68')]){return ami[_0x806c('0x5d')]({'action':_0x806c('0x67'),'channel':_0xd3ccd4['destinationchannel'],'mixmonitorid':_0x2454c2['mixmonitorid']})[_0x806c('0x1c')](function(_0x46166a){});}})[_0x806c('0x1e')](function(_0x806407){var _0x225e17=_['find'](_0xd3ccd4[_0x806c('0x60')],{'mixmonitorid':_0x2454c2[_0x806c('0x62')]});if(_0x225e17){_0x225e17['status']='stop';}})[_0x806c('0x1e')](function(){var _0x4183ac=util['format'](_0x806c('0x59'),_0x2454c2[_0x806c('0x5a')]||_0x2454c2[_0x806c('0x5b')],_0x2454c2[_0x806c('0x6')]||_0x806c('0x5c'));var _0x733237=_[_0x806c('0x57')](_0xd3ccd4['monitors'],{'filename':_0x806c('0x5e')+_0x4183ac[_0x806c('0x69')]()});if(_0x733237){_0x733237[_0x806c('0x63')]=_0x806c('0x6a');}})['then'](function(){_0x318cbf({'code':0xc8,'message':[_0x2454c2[_0x806c('0x5b')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x806c('0x1c')](function(_0x5313a8){_0x3327fd(_0x303fad[_0x806c('0x11')](0x1f5,[_0x2454c2['uniqueid'],_0x5313a8['message'][_0x806c('0x69')]()][_0x806c('0x15')]('\x20')));});}else{return _0x3327fd(_0x303fad['error'](0x1f5,_0x806c('0x65')));}});},'VoiceQueuesChannels':function(_0x52baae){return new Promise(function(_0x15e499,_0x594f1c){var _0x5bb1c1=_[_0x806c('0x6b')](_0x90f8f6[_0x806c('0x6c')]);_0x15e499({'count':_0x5bb1c1[_0x806c('0x53')],'rows':_0x5bb1c1});});},'VoiceQueuesChannel':function(_0x56624b){var _0x116da6=this;return new Promise(function(_0x33fd35,_0x1e6b99){var _0x5a4936=schema(properties['voicequeuechannel'])['validate'](_0x56624b);if(_0x5a4936[_0x806c('0x53')]>0x0){return _0x1e6b99(_0x116da6[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x5a4936,'message')[_0x806c('0x15')](',\x20')));}var _0x56cf82=_['find'](_0x90f8f6['queueChannels'],{'uniqueid':_0x56624b[_0x806c('0x5b')]});if(_0x56cf82){_0x33fd35(_0x56cf82);}else{return _0x1e6b99(_0x116da6[_0x806c('0x11')](0x1f5,_0x806c('0x65')));}});},'VoiceQueuesChannelHangup':function(_0x5f29b6){var _0x4d83cc=this;return new Promise(function(_0xb13f78,_0x4f1920){if(ami['isConnected']()==![]){return _0x4f1920(_0x4d83cc['error'](0x1f4,[config['asterisk']['ip'],config[_0x806c('0x12')]['username'],_0x806c('0x14')][_0x806c('0x15')]('\x20')));}var _0x19a4a5=schema(properties[_0x806c('0x6d')])[_0x806c('0x1')](_0x5f29b6);if(_0x19a4a5[_0x806c('0x53')]>0x0){return _0x4f1920(_0x4d83cc[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x19a4a5,_0x806c('0x1b'))[_0x806c('0x15')](',\x20')));}var _0x4fd649=_[_0x806c('0x57')](_0x90f8f6['queueChannels'],{'uniqueid':_0x5f29b6[_0x806c('0x5b')]});if(_0x4fd649&&_0x4fd649[_0x806c('0x58')]){return ami[_0x806c('0x5d')]({'action':_0x806c('0x6e'),'channel':_0x4fd649[_0x806c('0x58')]})['then'](function(_0x4dd860){_0xb13f78({'code':0xc8,'message':[_0x5f29b6['uniqueid'],_0x4dd860[_0x806c('0x1b')]['toLowerCase']()][_0x806c('0x15')]('\x20')});})[_0x806c('0x1c')](function(_0x47f14a){_0x4f1920(_0x4d83cc[_0x806c('0x11')](0x1f5,[_0x5f29b6[_0x806c('0x5b')],_0x47f14a[_0x806c('0x1b')][_0x806c('0x69')]()][_0x806c('0x15')]('\x20')));});}else{return _0x4f1920(_0x4d83cc[_0x806c('0x11')](0x1f5,_0x806c('0x65')));}});},'VoiceQueuesChannelRedirect':function(_0xf33c6f){var _0xfa7ad5=this;return new Promise(function(_0x5422b1,_0x317234){if(ami['isConnected']()==![]){return _0x317234(_0xfa7ad5['error'](0x1f4,[config[_0x806c('0x12')]['ip'],config['asterisk'][_0x806c('0x13')],_0x806c('0x14')]['join']('\x20')));}var _0x37ea63=schema(properties[_0x806c('0x6f')])[_0x806c('0x1')](_0xf33c6f);if(_0x37ea63[_0x806c('0x53')]>0x0){return _0x317234(_0xfa7ad5[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x37ea63,_0x806c('0x1b'))['join'](',\x20')));}var _0x1abe42=_[_0x806c('0x57')](_0x90f8f6[_0x806c('0x6c')],{'uniqueid':_0xf33c6f[_0x806c('0x5b')]});if(_0x1abe42&&_0x1abe42[_0x806c('0x58')]){return ami['Action']({'action':_0x806c('0x70'),'channel':_0x1abe42[_0x806c('0x58')],'exten':_0xf33c6f[_0x806c('0x71')],'context':_0xf33c6f[_0x806c('0x72')]||_0x1abe42[_0x806c('0x72')],'priority':0x1})[_0x806c('0x1e')](function(_0x374348){_0x5422b1({'code':0xc8,'message':[_0xf33c6f[_0x806c('0x5b')],_0x374348[_0x806c('0x1b')][_0x806c('0x69')]()]['join']('\x20')});})[_0x806c('0x1c')](function(_0x4ce0dc){_0x317234(_0xfa7ad5['error'](0x1f5,[_0xf33c6f[_0x806c('0x5b')],_0x4ce0dc[_0x806c('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x317234(_0xfa7ad5[_0x806c('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x5c5730){return new Promise(function(_0x3b0f8f,_0x6ec693){var _0x197d11=_[_0x806c('0x6b')](_0x90f8f6['agents']);_0x3b0f8f({'count':_0x197d11['length'],'rows':_0x197d11});});},'Telephones':function(_0x4e7e00){return new Promise(function(_0x2ee73a,_0x142781){var _0x3fad5b=_[_0x806c('0x6b')](_0x90f8f6[_0x806c('0x73')]);_0x2ee73a({'count':_0x3fad5b[_0x806c('0x53')],'rows':_0x3fad5b});});},'Trunks':function(_0xfd1015){return new Promise(function(_0x364101,_0x592d9f){var _0x1a4397=_[_0x806c('0x6b')](_0x90f8f6['trunks']);_0x364101({'count':_0x1a4397[_0x806c('0x53')],'rows':_0x1a4397});});},'OutboundChannels':function(_0x3b2ed3){return new Promise(function(_0x2cba9e,_0xfb7494){var _0x2fe043=_['values'](_0x90f8f6['outboundChannels']);_0x2cba9e({'count':_0x2fe043['length'],'rows':_0x2fe043});});},'Outbound':function(_0x2a872b){return new Promise(function(_0x2f4959,_0x5aa1a9){_0x2f4959(_0x90f8f6[_0x806c('0x74')]);});},'Campaigns':function(_0x41a884){return new Promise(function(_0x362efa,_0x26a3c3){var _0x33ef3e=_['values'](_0x90f8f6[_0x806c('0x75')]);_0x362efa({'count':_0x33ef3e['length'],'rows':_0x33ef3e});});},'VoiceQueuesPreview':function(_0x488b86){var _0x5e884e=this;return new Promise(function(_0x3252b1,_0x75b2f3){_0x558cfb['run'](_0x488b86['id'])[_0x806c('0x1e')](function(_0x34b09f){_0x3252b1({'code':0xc8,'message':_0x34b09f[_0x806c('0x1b')]});})['catch'](function(_0xb5131d){_0x75b2f3(_0x5e884e['error'](0x1f4,_0xb5131d[_0x806c('0x1b')]));});});},'EventManager':function(_0x2e20fc){var _0x1266bc=this;return new Promise(function(_0x3ff49f,_0x1477fb){if(!_0x2e20fc['event']){return _0x1477fb(_0x1266bc[_0x806c('0x11')](0x1f4,_0x806c('0x76')));}ami[_0x806c('0x77')]('custom:'+_0x2e20fc['event'],_0x2e20fc[_0x806c('0x1b')]);_0x3ff49f({'code':0xc8,'message':_0x2e20fc});});},'FaxAccounts':function(_0x392634){return new Promise(function(_0x171652,_0x30080f){var _0x114797=_[_0x806c('0x6b')](_0x90f8f6['faxAccounts']);_0x171652({'count':_0x114797[_0x806c('0x53')],'rows':_0x114797});});},'SendFax':function(_0x1e0d51){var _0x3b8d60=this;return new Promise(function(_0x5a7d1e,_0x1d13d5){_0x38f646[_0x806c('0x78')](_0x1e0d51)[_0x806c('0x1e')](function(_0x307f81){_0x5a7d1e({'code':0xc8,'message':_0x307f81[_0x806c('0x1b')]});})['catch'](function(_0x272e21){_0x1d13d5(_0x3b8d60[_0x806c('0x11')](0x1f4,_0x272e21[_0x806c('0x1b')]));});});},'CheckAfterSend':function(_0x170a17){var _0x45651c=this;return new Promise(function(_0x2254f7,_0x3f5985){_0x38f646[_0x806c('0x79')](_0x170a17)[_0x806c('0x1e')](function(_0x27f869){_0x2254f7({'code':0xc8,'message':_0x27f869[_0x806c('0x1b')]});})['catch'](function(_0x5e3f8b){_0x3f5985(_0x45651c['error'](0x1f4,_0x5e3f8b[_0x806c('0x1b')]));});});}};var _0x4b6a24=jayson[_0x806c('0x7a')](_0x18d910)[_0x806c('0x7b')]();_0x4b6a24['on']('error',function(_0x55dd74){return _0x2da081(_0x55dd74);});_0x4b6a24[_0x806c('0x7c')](0x232a,_0x806c('0x7d'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5ca964('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index c60ece9..1745e63 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 _0xb0ee=['../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','','uniqueid','destcalleridname','destcalleridnum','phone','then','showContact','omit','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','name','format','action','toLowerCase','resolve','createContact','[%s][%s]\x20Contact\x20created:%s','user:%s','trigger:%s','merge','catch','error','[%s][%s]\x20Autocreate\x20disabled','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger'];(function(_0x3859fb,_0x316c6d){var _0x1d30f6=function(_0x3e7664){while(--_0x3e7664){_0x3859fb['push'](_0x3859fb['shift']());}};_0x1d30f6(++_0x316c6d);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb0ee[_0x413feb];return _0x40ee88;};'use strict';var BPromise=require('bluebird');var util=require(_0xeb0e('0x0'));var _=require(_0xeb0e('0x1'));var Redis=require(_0xeb0e('0x2'));var config=require(_0xeb0e('0x3'));var logger=require(_0xeb0e('0x4'))(_0xeb0e('0x5'));var cmContactRpc=require(_0xeb0e('0x6'));config[_0xeb0e('0x7')]=_[_0xeb0e('0x8')](config[_0xeb0e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xeb0e('0x9'))(new Redis(config[_0xeb0e('0x7')]));function emit(_0x423095,_0x3e7872,_0x572ee1,_0x3b3c6e){logger[_0xeb0e('0xa')](_0xeb0e('0xb'),_0x423095,'',_0x3e7872,_0x572ee1,JSON[_0xeb0e('0xc')](_0x3b3c6e));io['to'](_0x3e7872)[_0xeb0e('0xd')](_0x572ee1,_0x3b3c6e);}exports[_0xeb0e('0xe')]=function(_0x37cfa5,_0x2e3ec0,_0x29c41f){_0x29c41f[_0xeb0e('0xf')]=0x0;if(_0x2e3ec0[_0xeb0e('0x10')]&&parseInt(_0x2e3ec0[_0xeb0e('0x10')],0xa)){var _0x6c016e={'ListId':parseInt(_0x2e3ec0[_0xeb0e('0x11')],0xa),'phone':_0x29c41f[_0xeb0e('0x12')]};if(_[_0xeb0e('0x13')](_0x29c41f[_0xeb0e('0x14')])){_0x6c016e[_0xeb0e('0x15')]=_0x29c41f['calleridname']&&_0x29c41f['calleridname']!==_0xeb0e('0x16')?_0x29c41f['calleridname']:_0x29c41f['calleridnum']||_0x29c41f[_0xeb0e('0x17')];}else{_0x6c016e[_0xeb0e('0x15')]=_0x29c41f[_0xeb0e('0x18')]&&_0x29c41f[_0xeb0e('0x18')]!==''?_0x29c41f[_0xeb0e('0x18')]:_0x29c41f[_0xeb0e('0x19')]||_0x29c41f['uniqueid'];_0x6c016e[_0xeb0e('0x1a')]=_0x29c41f[_0xeb0e('0x18')]&&_0x29c41f[_0xeb0e('0x18')]!==_0xeb0e('0x16')?_0x29c41f[_0xeb0e('0x18')]:_0x29c41f[_0xeb0e('0x19')]||_0x29c41f[_0xeb0e('0x17')];}BPromise['resolve']()[_0xeb0e('0x1b')](cmContactRpc[_0xeb0e('0x1c')]({'where':_[_0xeb0e('0x1d')](_0x6c016e,[_0xeb0e('0x15')])}))[_0xeb0e('0x1b')](function(_0x42e8d2){if(_0x42e8d2){logger[_0xeb0e('0xa')](_0xeb0e('0x1e'),_0x29c41f['uniqueid'],'',_0x42e8d2['id']);if(_0x37cfa5){_0x29c41f[_0xeb0e('0x1f')]=_0x42e8d2['id'];emit(_0x29c41f[_0xeb0e('0x17')],util['format']('user:%s',_0x37cfa5[_0xeb0e('0x20')]),util[_0xeb0e('0x21')]('trigger:%s',_0x2e3ec0[_0xeb0e('0x22')][_0xeb0e('0x23')]()),_['merge'](_0x29c41f,{'ListId':parseInt(_0x2e3ec0[_0xeb0e('0x11')],0xa)}));}return;}else{logger['info']('[%s][%s]\x20Contact\x20not\x20found',_0x29c41f['uniqueid'],'');return BPromise[_0xeb0e('0x24')]()['then'](cmContactRpc[_0xeb0e('0x25')](_0x6c016e));}})[_0xeb0e('0x1b')](function(_0x2bd11d){if(_0x2bd11d){logger[_0xeb0e('0xa')](_0xeb0e('0x26'),_0x29c41f[_0xeb0e('0x17')],'',_0x2bd11d['id']);if(_0x37cfa5){_0x29c41f[_0xeb0e('0x1f')]=_0x2bd11d['id'];emit(_0x29c41f['uniqueid'],util['format'](_0xeb0e('0x27'),_0x37cfa5[_0xeb0e('0x20')]),util['format'](_0xeb0e('0x28'),_0x2e3ec0[_0xeb0e('0x22')][_0xeb0e('0x23')]()),_[_0xeb0e('0x29')](_0x29c41f,{'ListId':parseInt(_0x2e3ec0[_0xeb0e('0x11')],0xa)}));}}})[_0xeb0e('0x2a')](function(_0xfe0f73){logger[_0xeb0e('0x2b')]('[%s][%s]\x20Error\x20creating\x20contact',_0x29c41f[_0xeb0e('0x17')],'',JSON[_0xeb0e('0xc')](_0xfe0f73));});}else{if(_0x37cfa5){logger[_0xeb0e('0xa')](_0xeb0e('0x2c'),_0x29c41f['uniqueid'],'');emit(_0x29c41f['uniqueid'],util[_0xeb0e('0x21')]('user:%s',_0x37cfa5[_0xeb0e('0x20')]),util[_0xeb0e('0x21')](_0xeb0e('0x28'),_0x2e3ec0[_0xeb0e('0x22')][_0xeb0e('0x23')]()),_[_0xeb0e('0x29')]({'ListId':parseInt(_0x2e3ec0['data1'],0xa)},_0x29c41f));}}}; \ No newline at end of file +var _0x51f9=['../../rpc/cmContact','redis','localhost','socket.io-emitter','info','stringify','exec','data2','calleridnum','isNil','routeId','calleridname','firstName','destcalleridname','','uniqueid','destcalleridnum','resolve','then','showContact','omit','xmd-contactid2','format','user:%s','name','toLowerCase','data1','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','trigger:%s','action','merge','error','[%s][%s]\x20Error\x20creating\x20contact','bluebird','ioredis','trigger'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x51f9,0x1eb));var _0x951f=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x51f9[_0x7275e9];return _0x17b99d;};'use strict';var BPromise=require(_0x951f('0x0'));var util=require('util');var _=require('lodash');var Redis=require(_0x951f('0x1'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x951f('0x2'));var cmContactRpc=require(_0x951f('0x3'));config['redis']=_['defaults'](config[_0x951f('0x4')],{'host':_0x951f('0x5'),'port':0x18eb});var io=require(_0x951f('0x6'))(new Redis(config[_0x951f('0x4')]));function emit(_0x5813a1,_0x5ebdc5,_0x14f2a7,_0x14377b){logger[_0x951f('0x7')]('[%s][%s]',_0x5813a1,'',_0x5ebdc5,_0x14f2a7,JSON[_0x951f('0x8')](_0x14377b));io['to'](_0x5ebdc5)['emit'](_0x14f2a7,_0x14377b);}exports[_0x951f('0x9')]=function(_0x13d2d5,_0x5004ad,_0x5b128c){_0x5b128c['autoCreate']=0x0;if(_0x5004ad[_0x951f('0xa')]&&parseInt(_0x5004ad['data2'],0xa)){var _0x4a8b44={'ListId':parseInt(_0x5004ad['data1'],0xa),'phone':_0x5b128c[_0x951f('0xb')]};if(_[_0x951f('0xc')](_0x5b128c[_0x951f('0xd')])){_0x4a8b44['firstName']=_0x5b128c['calleridname']&&_0x5b128c[_0x951f('0xe')]!==''?_0x5b128c[_0x951f('0xe')]:_0x5b128c[_0x951f('0xb')]||_0x5b128c['uniqueid'];}else{_0x4a8b44[_0x951f('0xf')]=_0x5b128c[_0x951f('0x10')]&&_0x5b128c['destcalleridname']!==_0x951f('0x11')?_0x5b128c[_0x951f('0x10')]:_0x5b128c['destcalleridnum']||_0x5b128c[_0x951f('0x12')];_0x4a8b44['phone']=_0x5b128c['destcalleridname']&&_0x5b128c[_0x951f('0x10')]!==_0x951f('0x11')?_0x5b128c[_0x951f('0x10')]:_0x5b128c[_0x951f('0x13')]||_0x5b128c[_0x951f('0x12')];}BPromise[_0x951f('0x14')]()[_0x951f('0x15')](cmContactRpc[_0x951f('0x16')]({'where':_[_0x951f('0x17')](_0x4a8b44,['firstName'])}))['then'](function(_0x11168e){if(_0x11168e){logger[_0x951f('0x7')]('[%s][%s]\x20Contact\x20found:%s',_0x5b128c[_0x951f('0x12')],'',_0x11168e['id']);if(_0x13d2d5){_0x5b128c[_0x951f('0x18')]=_0x11168e['id'];emit(_0x5b128c[_0x951f('0x12')],util[_0x951f('0x19')](_0x951f('0x1a'),_0x13d2d5[_0x951f('0x1b')]),util['format']('trigger:%s',_0x5004ad['action'][_0x951f('0x1c')]()),_['merge'](_0x5b128c,{'ListId':parseInt(_0x5004ad[_0x951f('0x1d')],0xa)}));}return;}else{logger[_0x951f('0x7')](_0x951f('0x1e'),_0x5b128c[_0x951f('0x12')],'');return BPromise[_0x951f('0x14')]()[_0x951f('0x15')](cmContactRpc[_0x951f('0x1f')](_0x4a8b44));}})[_0x951f('0x15')](function(_0x429482){if(_0x429482){logger[_0x951f('0x7')](_0x951f('0x20'),_0x5b128c[_0x951f('0x12')],'',_0x429482['id']);if(_0x13d2d5){_0x5b128c[_0x951f('0x18')]=_0x429482['id'];emit(_0x5b128c[_0x951f('0x12')],util['format']('user:%s',_0x13d2d5[_0x951f('0x1b')]),util[_0x951f('0x19')](_0x951f('0x21'),_0x5004ad[_0x951f('0x22')][_0x951f('0x1c')]()),_[_0x951f('0x23')](_0x5b128c,{'ListId':parseInt(_0x5004ad[_0x951f('0x1d')],0xa)}));}}})['catch'](function(_0x4a20be){logger[_0x951f('0x24')](_0x951f('0x25'),_0x5b128c[_0x951f('0x12')],'',JSON[_0x951f('0x8')](_0x4a20be));});}else{if(_0x13d2d5){logger[_0x951f('0x7')]('[%s][%s]\x20Autocreate\x20disabled',_0x5b128c[_0x951f('0x12')],'');emit(_0x5b128c['uniqueid'],util[_0x951f('0x19')](_0x951f('0x1a'),_0x13d2d5[_0x951f('0x1b')]),util[_0x951f('0x19')](_0x951f('0x21'),_0x5004ad[_0x951f('0x22')]['toLowerCase']()),_[_0x951f('0x23')]({'ListId':parseInt(_0x5004ad[_0x951f('0x1d')],0xa)},_0x5b128c));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 1bf9ec5..cb2d5cd 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 _0x94dd=['operator','upperFirst','AccountId','interaction','message','event','value','queue','membername','lastevent','exports','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../rpc/cmContact','redis','localhost','socket.io-emitter','popup','triggers','voiceQueues','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','zendeskAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','agents','interface','hasOwnProperty','status','checkTrigger','merge','length','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','html','data2','render','uri','isNil','data3','data4','location','uriLocation','800','data5','windowHeight','data6','600','winapp','winArguments','user:%s','name','trigger:%s:%s','data1','format','trigger:%s','integration','exec','routeId','urlforward','script','buildUri','parse','query','search','replace','AllConditions','every','checkConditions','channel','AnyConditions','field','account','chat','ChatWebsiteId'];(function(_0x257c0e,_0x4631da){var _0x393c16=function(_0x5239b9){while(--_0x5239b9){_0x257c0e['push'](_0x257c0e['shift']());}};_0x393c16(++_0x4631da);}(_0x94dd,0x80));var _0xd94d=function(_0x24bd51,_0x68435d){_0x24bd51=_0x24bd51-0x0;var _0x581052=_0x94dd[_0x24bd51];return _0x581052;};'use strict';var util=require('util');var _=require(_0xd94d('0x0'));var url=require(_0xd94d('0x1'));var Mustache=require(_0xd94d('0x2'));var Redis=require(_0xd94d('0x3'));var urlforward=require('./urlforward');var integration=require(_0xd94d('0x4'));var cmContact=require(_0xd94d('0x5'));var script=require(_0xd94d('0x6'));var cmContactRpc=require(_0xd94d('0x7'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('trigger');var ami=require('../ami');config[_0xd94d('0x8')]=_['defaults'](config[_0xd94d('0x8')],{'host':_0xd94d('0x9'),'port':0x18eb});var io=require(_0xd94d('0xa'))(new Redis(config[_0xd94d('0x8')]));var operators={'equals':function(_0x473226,_0x5937d0){return _0x473226==_0x5937d0;},'not_equals':function(_0x49112d,_0x1c1de1){return _0x49112d!=_0x1c1de1;}};var barAndWebActions=[_0xd94d('0xb'),'url','winapp'];function Trigger(_0xcb20b4){this[_0xd94d('0xc')]=_0xcb20b4['triggers'];this['agents']=_0xcb20b4['agents'];this[_0xd94d('0xd')]=_0xcb20b4[_0xd94d('0xd')];this['templates']=_0xcb20b4[_0xd94d('0xe')];this[_0xd94d('0xf')]=_0xcb20b4['voiceExtensions'];this['zendeskAccounts']=_0xcb20b4['zendeskAccounts'];this[_0xd94d('0x10')]=_0xcb20b4[_0xd94d('0x10')];this['salesforceAccounts']=_0xcb20b4[_0xd94d('0x11')];this[_0xd94d('0x12')]=_0xcb20b4[_0xd94d('0x12')];this['zohoAccounts']=_0xcb20b4[_0xd94d('0x13')];this[_0xd94d('0x14')]=_0xcb20b4[_0xd94d('0x14')];this[_0xd94d('0x15')]=_0xcb20b4[_0xd94d('0x15')];this[_0xd94d('0x16')]=_0xcb20b4['servicenowAccounts'];this[_0xd94d('0x17')]=_0xcb20b4['dynamics365Accounts'];this['freshsalesAccounts']=_0xcb20b4[_0xd94d('0x18')];this['accounts']={'zendesk':this[_0xd94d('0x19')],'salesforce':this[_0xd94d('0x11')],'freshdesk':this[_0xd94d('0x10')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xd94d('0x13')],'desk':this[_0xd94d('0x14')],'vtiger':this[_0xd94d('0x15')],'dynamics365':this[_0xd94d('0x17')],'freshsales':this[_0xd94d('0x18')],'servicenow':this[_0xd94d('0x16')]};ami['on']('custom:agentcalled',this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x1c'),this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x1d'),this[_0xd94d('0x1a')]['bind'](this));ami['on'](_0xd94d('0x1e'),this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x1f'),this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x20'),this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x21'),this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x22'),this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));ami['on']('custom:agentreject',this[_0xd94d('0x1a')]['bind'](this));ami['on'](_0xd94d('0x23'),this[_0xd94d('0x1a')]['bind'](this));ami['on'](_0xd94d('0x24'),this[_0xd94d('0x1a')]['bind'](this));ami['on'](_0xd94d('0x25'),this[_0xd94d('0x26')]['bind'](this));ami['on'](_0xd94d('0x27'),this[_0xd94d('0x26')][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x28'),this['syncAgentDial']['bind'](this));ami['on'](_0xd94d('0x29'),this[_0xd94d('0x1a')]['bind'](this));ami['on'](_0xd94d('0x2a'),this['syncCustomEvent'][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x2b'),this['syncCustomEvent'][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x2c'),this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));ami['on']('custom:acceptmessage',this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));ami['on'](_0xd94d('0x2d'),this[_0xd94d('0x1a')][_0xd94d('0x1b')](this));}Trigger[_0xd94d('0x2e')][_0xd94d('0x2f')]=function(_0x700cc3,_0x29f7af,_0x8afe88){logger[_0xd94d('0x30')](_0x700cc3,_0x29f7af,JSON[_0xd94d('0x31')](_0x8afe88));io['to'](_0x700cc3)['emit'](_0x29f7af,_0x8afe88);};Trigger[_0xd94d('0x2e')][_0xd94d('0x1a')]=function(_0x41866f){var _0x115f3b=_[_0xd94d('0x32')](_0x41866f);this[_0xd94d('0x33')](_0x115f3b);};Trigger[_0xd94d('0x2e')]['syncAgentDial']=function(_0x18df48){if(this[_0xd94d('0x34')][_0x18df48[_0xd94d('0x35')]]){this[_0xd94d('0x1a')](_0x18df48);}};Trigger[_0xd94d('0x2e')]['checkTriggers']=function(_0x1c59ab){var _0x3ab3b7;for(var _0x1741af in this[_0xd94d('0xc')]){if(this[_0xd94d('0xc')][_0xd94d('0x36')](_0x1741af)){if(this[_0xd94d('0xc')][_0x1741af][_0xd94d('0x37')]){_0x3ab3b7=this[_0xd94d('0x38')](this[_0xd94d('0xc')][_0x1741af],_0x1c59ab);if(_0x3ab3b7){_[_0xd94d('0x39')](_0x1c59ab,_0x1c59ab['variables']);for(var _0x273d72=0x0,_0x14f4a5,_0x45b334,_0x47908a;_0x273d720x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f475ede..ffa4741 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 _0x9d88=[']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','username','access_token','catch','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','toUpperCase','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!','type','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','phonecalls','/contacts(','callDirection','queue','headers','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d88,0x169));var _0x89d8=function(_0x282b5e,_0x436203){_0x282b5e=_0x282b5e-0x0;var _0x5d08cc=_0x9d88[_0x282b5e];return _0x5d08cc;};'use strict';var _=require(_0x89d8('0x0'));var BPromise=require(_0x89d8('0x1'));var rp=require(_0x89d8('0x2'));var util=require(_0x89d8('0x3'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x89d8('0x4'))('dynamics365');var config=require('../../../../config/environment');config[_0x89d8('0x5')]=_[_0x89d8('0x6')](config['redis'],{'host':_0x89d8('0x7'),'port':0x18eb});var io=require(_0x89d8('0x8'))(new Redis(config[_0x89d8('0x5')]));function getAuthToken(_0x39166c,_0x349db4,_0x41ec30){var _0x5c05ad={'method':_0x89d8('0x9'),'uri':_0x349db4,'form':{'client_id':_0x39166c['clientId'],'resource':_0x39166c['remoteUri'],'username':_0x39166c[_0x89d8('0xa')],'password':_0x39166c['password'],'grant_type':'password','client_secret':_0x39166c['clientSecret']},'json':!![]};return rp(_0x5c05ad)['then'](function(_0x29117d){return _0x29117d[_0x89d8('0xb')];})[_0x89d8('0xc')](function(_0x4b5819){logger[_0x89d8('0xd')]('['+[_0x41ec30['toUpperCase']()]+_0x89d8('0xe'));return _0x4b5819[_0x89d8('0xf')];});}function getUser(_0x55aee1,_0x35050f,_0x1934d4,_0xa5f43a,_0x5e1589,_0xa954f1){return new BPromise(function(_0x5e63a8,_0x132b7a){return getAuthToken(_0x35050f,_0xa5f43a,_0xa954f1)['then'](function(_0x55d08d){var _0x28e3cc={'method':'GET','uri':_0x5e1589+_0x89d8('0x10'),'headers':{'Authorization':_0x89d8('0x11')+_0x55d08d,'OData-Version':_0x89d8('0x12')},'json':!![]};return rp(_0x28e3cc);})[_0x89d8('0x13')](function(_0x19a484){var _0x3b97e4=_0x19a484[_0x89d8('0x14')];var _0x1bfa6f=![];var _0x23d466=null;if(!_[_0x89d8('0x15')](_0x1934d4)){if(intUtil[_0x89d8('0x16')](_0x1934d4[_0x89d8('0x17')])){_0x55aee1[_0x89d8('0x18')]=_0x1934d4[_0x89d8('0x17')];for(_0x23d466=0x0;_0x23d466<_0x3b97e4[_0x89d8('0x19')];_0x23d466++){if(_0x3b97e4[_0x23d466][_0x89d8('0x1a')]===_0x1934d4[_0x89d8('0x17')]&&!_0x3b97e4[_0x23d466]['isdisabled']){_0x1bfa6f=!![];logger['info']('['+[_0xa954f1[_0x89d8('0x1b')]()]+']\x20Agent\x20found\x20'+_0x3b97e4[_0x23d466]['systemuserid']+'!');_0x55aee1[_0x89d8('0x1c')]=_0x3b97e4[_0x23d466]['systemuserid'];}}}}if(!_0x1bfa6f){logger[_0x89d8('0x1d')]('['+[_0xa954f1[_0x89d8('0x1b')]()]+_0x89d8('0x1e'));_0x55aee1['userEmail']=_0x35050f[_0x89d8('0xa')];for(_0x23d466=0x0;_0x23d466<_0x3b97e4[_0x89d8('0x19')];_0x23d466++){if(_0x3b97e4[_0x23d466][_0x89d8('0x1a')]===_0x35050f[_0x89d8('0xa')]){_0x55aee1[_0x89d8('0x1c')]=_0x3b97e4[_0x23d466][_0x89d8('0x1f')];}}}_0x5e63a8(_0x55aee1);})['catch'](function(_0x20922d){_0x132b7a(_0x20922d['message']);});});}function createEndUser(_0xb5196d,_0x51518a,_0x11f2ba,_0x3cadef,_0x204bdc,_0x1fe63f){return new BPromise(function(_0x252282,_0x4b2b43){return getAuthToken(_0x51518a,_0x11f2ba,_0x1fe63f)[_0x89d8('0x13')](function(_0x548c55){var _0x469be1=_0x1fe63f[_0x89d8('0x20')]()===_0x89d8('0x21')?_0x204bdc[_0x89d8('0x22')]:_0x204bdc[_0x89d8('0x23')];var _0xc50ffa={'method':_0x89d8('0x9'),'uri':_0x3cadef+_0x89d8('0x24'),'body':{'telephone1':_0x469be1,'fullname':_0x469be1,'firstname':_0x469be1,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x89d8('0x25')+_0xb5196d[_0x89d8('0x1c')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x548c55,'OData-Version':_0x89d8('0x12')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xc50ffa);})[_0x89d8('0x13')](function(_0x3747cd){var _0x534c6d=_0x3747cd['headers'][_0x89d8('0x26')];var _0x3a2832=_0x534c6d[_0x89d8('0x27')](_0x534c6d['lastIndexOf']('(')+0x1,_0x534c6d['lastIndexOf'](')'));_0xb5196d[_0x89d8('0x28')]=_0x3a2832;_0x252282(_0xb5196d);})[_0x89d8('0xc')](function(_0x4c322b){_0x4b2b43(_0x4c322b[_0x89d8('0xf')]);});});}function getEndUser(_0x17e923,_0x46a2b9,_0x2557c6,_0x301c2f,_0x376909,_0x72a9f6){return new BPromise(function(_0x3157ca,_0x1c3e0b){return getAuthToken(_0x46a2b9,_0x2557c6,_0x72a9f6)[_0x89d8('0x13')](function(_0x19ff36){var _0x97545c={'method':'GET','uri':_0x301c2f+_0x89d8('0x29'),'headers':{'Authorization':_0x89d8('0x11')+_0x19ff36,'If-None-Match':null,'OData-Version':_0x89d8('0x12')},'json':!![]};return rp(_0x97545c);})[_0x89d8('0x13')](function(_0x8969e8){var _0x332d2d=null;if(_0x8969e8){var _0x26dada=_0x8969e8['value'];var _0x56e57b=![];for(_0x332d2d=0x0;_0x332d2d<_0x26dada['length'];_0x332d2d++){var _0x1aac18=_0x72a9f6[_0x89d8('0x20')]()===_0x89d8('0x21')?_0x376909['destcalleridnum']:_0x376909[_0x89d8('0x23')];if(_0x26dada[_0x332d2d][_0x89d8('0x2a')]===_0x1aac18){_0x56e57b=!![];_0x17e923[_0x89d8('0x28')]=_0x26dada[_0x332d2d][_0x89d8('0x2b')];}}if(_0x56e57b){_0x3157ca(_0x17e923);}else{return createEndUser(_0x17e923,_0x46a2b9,_0x2557c6,_0x301c2f,_0x376909,_0x72a9f6)[_0x89d8('0x13')](function(_0x4f8f5b){logger['info']('['+[_0x72a9f6[_0x89d8('0x1b')]()]+_0x89d8('0x2c'),_0x4f8f5b['enduserId']);_0x3157ca(_0x4f8f5b);});}}else{return createEndUser(_0x17e923,_0x46a2b9,_0x2557c6,_0x301c2f,_0x376909,_0x72a9f6)[_0x89d8('0x13')](function(_0xd91b0){logger['info']('['+[_0x72a9f6['toUpperCase']()]+']\x20Enduser\x20Created!',_0xd91b0[_0x89d8('0x28')]);_0x3157ca(_0xd91b0);});}});});}function getCustomFields(_0x34fd10,_0x2697d0,_0x2b2b50){var _0x1a3a57={};if(_0x34fd10[_0x89d8('0x19')]>0x0){_['forEach'](_0x34fd10,function(_0x4a726b){if(_0x4a726b[_0x89d8('0x2d')]==='string'&&_0x4a726b[_0x89d8('0x2e')]&&!_0x4a726b[_0x89d8('0x2f')]){var _0xd7b470=_0x4a726b[_0x89d8('0x30')][_0x89d8('0x20')]();var _0x21b52b=_0xd7b470[_0x89d8('0x27')](0x0,_0xd7b470[_0x89d8('0x31')]('_'));var _0x69cc61=_0xd7b470[_0x89d8('0x27')](_0xd7b470['indexOf']('_')+0x1);if(_0x21b52b===_0x2b2b50){_0x1a3a57[_0x69cc61]=_0x4a726b[_0x89d8('0x32')];}}});}return _0x1a3a57;}function getTicket(_0x2b9e8d,_0x1df07d,_0x504055,_0x4af27f,_0x54d377,_0x5d9a78,_0x543458){return new BPromise(function(_0x369dfc,_0x192529){var _0x423bff;return getAuthToken(_0x1df07d,_0x504055,_0x543458)['then'](function(_0x492b53){if(_0x5d9a78[_0x89d8('0x33')]==='incident'){_0x423bff={'method':_0x89d8('0x9'),'uri':_0x4af27f+_0x89d8('0x34'),'body':Object[_0x89d8('0x35')]({},{'title':intUtil[_0x89d8('0x36')](_0x5d9a78[_0x89d8('0x37')],_0x54d377,'\x20'),'description':intUtil['getString'](_0x5d9a78[_0x89d8('0x38')],_0x54d377,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x2b9e8d[_0x89d8('0x28')]+')','ownerid@odata.bind':_0x89d8('0x25')+_0x2b9e8d[_0x89d8('0x1c')]+')','caseorigincode':'1'},getCustomFields(_0x5d9a78[_0x89d8('0x39')],_0x54d377,_0x5d9a78[_0x89d8('0x33')])),'headers':{'Authorization':_0x89d8('0x11')+_0x492b53,'OData-Version':_0x89d8('0x12')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5d9a78[_0x89d8('0x33')]===_0x89d8('0x3a')){_0x423bff={'method':_0x89d8('0x9'),'uri':_0x4af27f+_0x89d8('0x3b'),'body':Object['assign']({},{'subject':intUtil[_0x89d8('0x36')](_0x5d9a78[_0x89d8('0x37')],_0x54d377,'\x20'),'phonenumber':String(_0x54d377['calleridnum']),'description':intUtil[_0x89d8('0x36')](_0x5d9a78[_0x89d8('0x38')],_0x54d377,'\x0a'),'regardingobjectid_contact@odata.bind':_0x89d8('0x3c')+_0x2b9e8d[_0x89d8('0x28')]+')','ownerid@odata.bind':'/systemusers('+_0x2b9e8d[_0x89d8('0x1c')]+')','directioncode':_0x2b9e8d[_0x89d8('0x3d')]===_0x89d8('0x3e')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x89d8('0x25')+_0x2b9e8d['userId']+')','participationtypemask':_0x2b9e8d[_0x89d8('0x3d')]===_0x89d8('0x3e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x2b9e8d[_0x89d8('0x28')]+')','participationtypemask':_0x2b9e8d['callDirection']===_0x89d8('0x3e')?0x1:0x2}]},getCustomFields(_0x5d9a78['Fields'],_0x54d377,_0x5d9a78[_0x89d8('0x33')])),'headers':{'Authorization':_0x89d8('0x11')+_0x492b53,'OData-Version':_0x89d8('0x12')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x423bff);})['then'](function(_0x716537){var _0x444903=_0x716537[_0x89d8('0x3f')][_0x89d8('0x26')];var _0x50707a=_0x444903[_0x89d8('0x27')](_0x444903[_0x89d8('0x40')]('(')+0x1,_0x444903[_0x89d8('0x40')](')'));_0x2b9e8d[_0x89d8('0x41')]=_0x50707a;_0x369dfc(_0x2b9e8d);})[_0x89d8('0xc')](function(_0x2460af){_0x192529(_0x2460af[_0x89d8('0xf')]);});});}function emit(_0x345a44,_0x18fba2,_0x461e31,_0x41b2c4){var _0x47b7a6={'uri':util[_0x89d8('0x42')](_0x89d8('0x43'),_0x345a44,_0x461e31,_0x41b2c4)};io['to'](util['format'](_0x89d8('0x44'),_0x18fba2))['emit']('trigger:browser:url',_0x47b7a6);}exports['cs']=function(_0x4ddd85,_0x24bb53,_0x24a498,_0x1860a2,_0x424b3f,_0x379160,_0x224295,_0x4f1018){var _0x164315={};_0x379160[_0x89d8('0x45')]=intUtil[_0x89d8('0x46')](_0x379160[_0x89d8('0x45')]);_0x379160[_0x89d8('0x47')]=intUtil[_0x89d8('0x46')](_0x379160[_0x89d8('0x47')]);_0x164315[_0x89d8('0x3d')]=_0x4f1018===_0x89d8('0x3e')||_0x4f1018===_0x89d8('0x48')?_0x89d8('0x3e'):_0x89d8('0x21');var _0x5d91bd=util[_0x89d8('0x42')](_0x89d8('0x49'),_0x379160[_0x89d8('0x45')]);var _0x24ac78=util[_0x89d8('0x42')](_0x89d8('0x4a'),_0x379160[_0x89d8('0x4b')]);var _0x1595a9=util['format'](_0x89d8('0x4c'),_0x379160[_0x89d8('0x47')],_0x24bb53['uniqueid'],md5(_0x24bb53[_0x89d8('0x4d')]));if(_0x424b3f&&_0x424b3f['monitor_format']){logger[_0x89d8('0x1d')]('[QUEUE]','Recording\x20is\x20enabled!');_0x24bb53[_0x89d8('0x4e')]=_0x1595a9;}else if(_0x224295&&_0x224295[_0x89d8('0x4f')]&&_0x224295[_0x89d8('0x4f')]!==_0x89d8('0x50')){logger[_0x89d8('0x1d')]('[OUTBOUND]',_0x89d8('0x51'));_0x24bb53[_0x89d8('0x4e')]=_0x1595a9;}else{_0x24bb53[_0x89d8('0x4e')]='';}return getUser(_0x164315,_0x379160,_0x1860a2,_0x24ac78,_0x5d91bd,_0x4f1018)[_0x89d8('0x13')](function(_0x204025){logger['info']('['+_0x4f1018['toUpperCase']()+_0x89d8('0x52'),_0x204025[_0x89d8('0x1c')]);logger[_0x89d8('0x1d')]('['+_0x4f1018[_0x89d8('0x1b')]()+_0x89d8('0x53'),_0x204025[_0x89d8('0x18')]);return getEndUser(_0x204025,_0x379160,_0x24ac78,_0x5d91bd,_0x24bb53,_0x4f1018);})['then'](function(_0x1888f6){logger[_0x89d8('0x1d')]('['+_0x4f1018[_0x89d8('0x1b')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x1888f6['enduserId']);logger[_0x89d8('0x1d')]('['+_0x4f1018[_0x89d8('0x1b')]()+_0x89d8('0x54'),_0x24bb53[_0x89d8('0x23')]);return getTicket(_0x1888f6,_0x379160,_0x24ac78,_0x5d91bd,_0x24bb53,_0x24a498,_0x4f1018);})[_0x89d8('0x13')](function(_0x23c989){logger[_0x89d8('0x1d')](util[_0x89d8('0x42')]('['+_0x4f1018[_0x89d8('0x1b')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x24a498[_0x89d8('0x33')],_0x23c989[_0x89d8('0x41')]));logger[_0x89d8('0x1d')](util[_0x89d8('0x42')]('['+_0x4f1018['toUpperCase']()+_0x89d8('0x55'),_0x4f1018));if(_0x4f1018!==_0x89d8('0x48')){logger[_0x89d8('0x1d')]('['+_0x4f1018[_0x89d8('0x1b')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x379160['remoteUri'],_0x1860a2[_0x89d8('0x56')],_0x24a498[_0x89d8('0x33')],_0x23c989[_0x89d8('0x41')]);}})[_0x89d8('0xc')](function(_0x3f6db3){logger['error']('['+_0x4f1018[_0x89d8('0x1b')]()+_0x89d8('0x57'),util[_0x89d8('0x58')](_0x3f6db3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf78e=['util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','userEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','4.0','toLowerCase','outbound','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','indexOf','substring','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','callDirection','queue','ticketId','message','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','request-promise'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0xf78e,0x176));var _0xef78=function(_0x31826c,_0x1995c5){_0x31826c=_0x31826c-0x0;var _0x20bbd7=_0xf78e[_0x31826c];return _0x20bbd7;};'use strict';var _=require('lodash');var BPromise=require(_0xef78('0x0'));var rp=require(_0xef78('0x1'));var util=require(_0xef78('0x2'));var intUtil=require(_0xef78('0x3'));var md5=require(_0xef78('0x4'));var Redis=require(_0xef78('0x5'));var logger=require('../../../../config/logger')(_0xef78('0x6'));var config=require(_0xef78('0x7'));config[_0xef78('0x8')]=_[_0xef78('0x9')](config[_0xef78('0x8')],{'host':_0xef78('0xa'),'port':0x18eb});var io=require(_0xef78('0xb'))(new Redis(config[_0xef78('0x8')]));function getAuthToken(_0x753018,_0x150ddb,_0x4b4893){var _0x2bee21={'method':_0xef78('0xc'),'uri':_0x150ddb,'form':{'client_id':_0x753018[_0xef78('0xd')],'resource':_0x753018['remoteUri'],'username':_0x753018[_0xef78('0xe')],'password':_0x753018[_0xef78('0xf')],'grant_type':'password','client_secret':_0x753018[_0xef78('0x10')]},'json':!![]};return rp(_0x2bee21)[_0xef78('0x11')](function(_0x422027){return _0x422027[_0xef78('0x12')];})[_0xef78('0x13')](function(_0x4bac3d){logger[_0xef78('0x14')]('['+[_0x4b4893[_0xef78('0x15')]()]+_0xef78('0x16'));return _0x4bac3d['message'];});}function getUser(_0x4c9e09,_0x5513b9,_0x177e4d,_0x3d07f0,_0x1b03e1,_0x7d73e0){return new BPromise(function(_0x1695db,_0x5d68ae){return getAuthToken(_0x5513b9,_0x3d07f0,_0x7d73e0)[_0xef78('0x11')](function(_0x413818){var _0x6dff74={'method':_0xef78('0x17'),'uri':_0x1b03e1+_0xef78('0x18'),'headers':{'Authorization':_0xef78('0x19')+_0x413818,'OData-Version':'4.0'},'json':!![]};return rp(_0x6dff74);})['then'](function(_0x5bfd06){var _0x3cee10=_0x5bfd06[_0xef78('0x1a')];var _0x6f5bba=![];var _0x140b3f=null;if(!_['isNil'](_0x177e4d)){if(intUtil[_0xef78('0x1b')](_0x177e4d['email'])){_0x4c9e09[_0xef78('0x1c')]=_0x177e4d[_0xef78('0x1d')];for(_0x140b3f=0x0;_0x140b3f<_0x3cee10[_0xef78('0x1e')];_0x140b3f++){if(_0x3cee10[_0x140b3f]['internalemailaddress']===_0x177e4d['email']&&!_0x3cee10[_0x140b3f][_0xef78('0x1f')]){_0x6f5bba=!![];logger[_0xef78('0x20')]('['+[_0x7d73e0['toUpperCase']()]+_0xef78('0x21')+_0x3cee10[_0x140b3f]['systemuserid']+'!');_0x4c9e09[_0xef78('0x22')]=_0x3cee10[_0x140b3f]['systemuserid'];}}}}if(!_0x6f5bba){logger['info']('['+[_0x7d73e0[_0xef78('0x15')]()]+_0xef78('0x23'));_0x4c9e09[_0xef78('0x1c')]=_0x5513b9['username'];for(_0x140b3f=0x0;_0x140b3f<_0x3cee10[_0xef78('0x1e')];_0x140b3f++){if(_0x3cee10[_0x140b3f]['internalemailaddress']===_0x5513b9['username']){_0x4c9e09['userId']=_0x3cee10[_0x140b3f][_0xef78('0x24')];}}}_0x1695db(_0x4c9e09);})['catch'](function(_0x4d3d07){_0x5d68ae(_0x4d3d07['message']);});});}function createEndUser(_0x10d6a7,_0x2aeb62,_0xdd1552,_0x1d50ef,_0x224c35,_0x2e45a8){return new BPromise(function(_0x23816c,_0x257a7d){return getAuthToken(_0x2aeb62,_0xdd1552,_0x2e45a8)[_0xef78('0x11')](function(_0xe8f1ef){var _0x283997=_0x2e45a8['toLowerCase']()==='outbound'?_0x224c35[_0xef78('0x25')]:_0x224c35[_0xef78('0x26')];var _0x43e21e={'method':_0xef78('0xc'),'uri':_0x1d50ef+_0xef78('0x27'),'body':{'telephone1':_0x283997,'fullname':_0x283997,'firstname':_0x283997,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xef78('0x28')+_0x10d6a7['userId']+')'},'headers':{'Authorization':_0xef78('0x19')+_0xe8f1ef,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x43e21e);})[_0xef78('0x11')](function(_0x4e7bcc){var _0x71f799=_0x4e7bcc[_0xef78('0x29')][_0xef78('0x2a')];var _0xd56707=_0x71f799['substring'](_0x71f799[_0xef78('0x2b')]('(')+0x1,_0x71f799[_0xef78('0x2b')](')'));_0x10d6a7[_0xef78('0x2c')]=_0xd56707;_0x23816c(_0x10d6a7);})[_0xef78('0x13')](function(_0x40643b){_0x257a7d(_0x40643b['message']);});});}function getEndUser(_0x4994a4,_0x176e2e,_0x5527ac,_0x1da5bc,_0x1f4bdd,_0x55e40f){return new BPromise(function(_0x40a395,_0x52bdc6){return getAuthToken(_0x176e2e,_0x5527ac,_0x55e40f)[_0xef78('0x11')](function(_0x34a222){var _0x336bab={'method':_0xef78('0x17'),'uri':_0x1da5bc+_0xef78('0x2d'),'headers':{'Authorization':_0xef78('0x19')+_0x34a222,'If-None-Match':null,'OData-Version':_0xef78('0x2e')},'json':!![]};return rp(_0x336bab);})[_0xef78('0x11')](function(_0xae0cd9){var _0x2d3aef=null;if(_0xae0cd9){var _0x4997e0=_0xae0cd9[_0xef78('0x1a')];var _0x66e65=![];for(_0x2d3aef=0x0;_0x2d3aef<_0x4997e0[_0xef78('0x1e')];_0x2d3aef++){var _0xc19ae0=_0x55e40f[_0xef78('0x2f')]()===_0xef78('0x30')?_0x1f4bdd[_0xef78('0x25')]:_0x1f4bdd[_0xef78('0x26')];if(_0x4997e0[_0x2d3aef][_0xef78('0x31')]===_0xc19ae0){_0x66e65=!![];_0x4994a4[_0xef78('0x2c')]=_0x4997e0[_0x2d3aef][_0xef78('0x32')];}}if(_0x66e65){_0x40a395(_0x4994a4);}else{return createEndUser(_0x4994a4,_0x176e2e,_0x5527ac,_0x1da5bc,_0x1f4bdd,_0x55e40f)[_0xef78('0x11')](function(_0x23b471){logger[_0xef78('0x20')]('['+[_0x55e40f[_0xef78('0x15')]()]+_0xef78('0x33'),_0x23b471[_0xef78('0x2c')]);_0x40a395(_0x23b471);});}}else{return createEndUser(_0x4994a4,_0x176e2e,_0x5527ac,_0x1da5bc,_0x1f4bdd,_0x55e40f)['then'](function(_0x536e3f){logger[_0xef78('0x20')]('['+[_0x55e40f[_0xef78('0x15')]()]+_0xef78('0x34'),_0x536e3f['enduserId']);_0x40a395(_0x536e3f);});}});});}function getCustomFields(_0x1cc3fd,_0x103bbc,_0x22e33e){var _0x4c84de={};if(_0x1cc3fd['length']>0x0){_[_0xef78('0x35')](_0x1cc3fd,function(_0x1afcea){if(_0x1afcea['type']==='string'&&_0x1afcea['nameField']&&!_0x1afcea['customField']){var _0xaa9be5=_0x1afcea['idField']['toLowerCase']();var _0xd3ff68=_0xaa9be5['substring'](0x0,_0xaa9be5[_0xef78('0x36')]('_'));var _0x44d15=_0xaa9be5[_0xef78('0x37')](_0xaa9be5[_0xef78('0x36')]('_')+0x1);if(_0xd3ff68===_0x22e33e){_0x4c84de[_0x44d15]=_0x1afcea[_0xef78('0x38')];}}});}return _0x4c84de;}function getTicket(_0x370ae5,_0x484983,_0x2d6f31,_0x133d13,_0x3a93f3,_0x481b37,_0x3ea2b1){return new BPromise(function(_0x5d0ae4,_0x533f4e){var _0x5b9de7;return getAuthToken(_0x484983,_0x2d6f31,_0x3ea2b1)[_0xef78('0x11')](function(_0x13b3c5){if(_0x481b37['ticketType']===_0xef78('0x39')){_0x5b9de7={'method':_0xef78('0xc'),'uri':_0x133d13+_0xef78('0x3a'),'body':Object[_0xef78('0x3b')]({},{'title':intUtil[_0xef78('0x3c')](_0x481b37[_0xef78('0x3d')],_0x3a93f3,'\x20'),'description':intUtil[_0xef78('0x3c')](_0x481b37[_0xef78('0x3e')],_0x3a93f3,'\x0a'),'customerid_contact@odata.bind':_0xef78('0x3f')+_0x370ae5['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x370ae5[_0xef78('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x481b37[_0xef78('0x40')],_0x3a93f3,_0x481b37['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x13b3c5,'OData-Version':_0xef78('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x481b37[_0xef78('0x41')]===_0xef78('0x42')){_0x5b9de7={'method':_0xef78('0xc'),'uri':_0x133d13+_0xef78('0x43'),'body':Object[_0xef78('0x3b')]({},{'subject':intUtil[_0xef78('0x3c')](_0x481b37[_0xef78('0x3d')],_0x3a93f3,'\x20'),'phonenumber':String(_0x3a93f3[_0xef78('0x26')]),'description':intUtil[_0xef78('0x3c')](_0x481b37[_0xef78('0x3e')],_0x3a93f3,'\x0a'),'regardingobjectid_contact@odata.bind':_0xef78('0x3f')+_0x370ae5[_0xef78('0x2c')]+')','ownerid@odata.bind':_0xef78('0x28')+_0x370ae5['userId']+')','directioncode':_0x370ae5[_0xef78('0x44')]===_0xef78('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xef78('0x28')+_0x370ae5[_0xef78('0x22')]+')','participationtypemask':_0x370ae5['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xef78('0x3f')+_0x370ae5['enduserId']+')','participationtypemask':_0x370ae5[_0xef78('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x481b37[_0xef78('0x40')],_0x3a93f3,_0x481b37[_0xef78('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x13b3c5,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5b9de7);})['then'](function(_0x2c0dff){var _0xa1871a=_0x2c0dff[_0xef78('0x29')][_0xef78('0x2a')];var _0x2cf69d=_0xa1871a[_0xef78('0x37')](_0xa1871a['lastIndexOf']('(')+0x1,_0xa1871a[_0xef78('0x2b')](')'));_0x370ae5[_0xef78('0x46')]=_0x2cf69d;_0x5d0ae4(_0x370ae5);})[_0xef78('0x13')](function(_0x2e1314){_0x533f4e(_0x2e1314[_0xef78('0x47')]);});});}function emit(_0x1a321d,_0x180f81,_0x1a4ceb,_0x1288e1){var _0x31422c={'uri':util[_0xef78('0x48')](_0xef78('0x49'),_0x1a321d,_0x1a4ceb,_0x1288e1)};io['to'](util[_0xef78('0x48')](_0xef78('0x4a'),_0x180f81))[_0xef78('0x4b')](_0xef78('0x4c'),_0x31422c);}exports['cs']=function(_0x207e4f,_0x597e78,_0x33f5c0,_0x131c61,_0x15eba7,_0x237f31,_0x37bb0b,_0x4f74df){var _0x2d70f8={};_0x237f31['remoteUri']=intUtil[_0xef78('0x4d')](_0x237f31['remoteUri']);_0x237f31['serverUrl']=intUtil[_0xef78('0x4d')](_0x237f31['serverUrl']);_0x2d70f8['callDirection']=_0x4f74df==='queue'||_0x4f74df===_0xef78('0x4e')?'queue':_0xef78('0x30');var _0x2da571=util['format']('%s/api/data/v9.0/',_0x237f31['remoteUri']);var _0x1b0e05=util[_0xef78('0x48')]('https://login.microsoftonline.com/%s/oauth2/token',_0x237f31[_0xef78('0x4f')]);var _0x39b69d=util[_0xef78('0x48')](_0xef78('0x50'),_0x237f31['serverUrl'],_0x597e78[_0xef78('0x51')],md5(_0x597e78[_0xef78('0x51')]));if(_0x15eba7&&_0x15eba7['monitor_format']){logger[_0xef78('0x20')](_0xef78('0x52'),_0xef78('0x53'));_0x597e78[_0xef78('0x54')]=_0x39b69d;}else if(_0x37bb0b&&_0x37bb0b[_0xef78('0x55')]&&_0x37bb0b[_0xef78('0x55')]!=='none'){logger[_0xef78('0x20')](_0xef78('0x56'),_0xef78('0x53'));_0x597e78['recordingURL']=_0x39b69d;}else{_0x597e78[_0xef78('0x54')]='';}return getUser(_0x2d70f8,_0x237f31,_0x131c61,_0x1b0e05,_0x2da571,_0x4f74df)[_0xef78('0x11')](function(_0x59baf3){logger[_0xef78('0x20')]('['+_0x4f74df[_0xef78('0x15')]()+_0xef78('0x57'),_0x59baf3[_0xef78('0x22')]);logger[_0xef78('0x20')]('['+_0x4f74df[_0xef78('0x15')]()+_0xef78('0x58'),_0x59baf3[_0xef78('0x1c')]);return getEndUser(_0x59baf3,_0x237f31,_0x1b0e05,_0x2da571,_0x597e78,_0x4f74df);})[_0xef78('0x11')](function(_0x12c3c7){logger[_0xef78('0x20')]('['+_0x4f74df['toUpperCase']()+_0xef78('0x59'),_0x12c3c7[_0xef78('0x2c')]);logger[_0xef78('0x20')]('['+_0x4f74df[_0xef78('0x15')]()+_0xef78('0x5a'),_0x597e78[_0xef78('0x26')]);return getTicket(_0x12c3c7,_0x237f31,_0x1b0e05,_0x2da571,_0x597e78,_0x33f5c0,_0x4f74df);})[_0xef78('0x11')](function(_0x104a8f){logger[_0xef78('0x20')](util['format']('['+_0x4f74df[_0xef78('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x33f5c0[_0xef78('0x41')],_0x104a8f['ticketId']));logger[_0xef78('0x20')](util[_0xef78('0x48')]('['+_0x4f74df[_0xef78('0x15')]()+']\x20Call\x20direction:\x20%s',_0x4f74df));if(_0x4f74df!==_0xef78('0x4e')){logger[_0xef78('0x20')]('['+_0x4f74df['toUpperCase']()+']',_0xef78('0x5b'));emit(_0x237f31['remoteUri'],_0x131c61[_0xef78('0x5c')],_0x33f5c0[_0xef78('0x41')],_0x104a8f[_0xef78('0x46')]);}})[_0xef78('0x13')](function(_0x360fda){logger[_0xef78('0x14')]('['+_0x4f74df['toUpperCase']()+_0xef78('0x5d'),util['inspect'](_0x360fda,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 06e59c1..9a7a35c 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 _0xba77=['queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','user:%s','catch','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','format','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable'];(function(_0x1d5569,_0x15b4a1){var _0x1fa491=function(_0x37b147){while(--_0x37b147){_0x1d5569['push'](_0x1d5569['shift']());}};_0x1fa491(++_0x15b4a1);}(_0xba77,0xd0));var _0x7ba7=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0xba77[_0x5cabfd];return _0x4bc06c;};'use strict';var _=require(_0x7ba7('0x0'));var rp=require(_0x7ba7('0x1'));var md5=require(_0x7ba7('0x2'));var util=require(_0x7ba7('0x3'));var Redis=require(_0x7ba7('0x4'));var intUtil=require(_0x7ba7('0x5'));var config=require(_0x7ba7('0x6'));var logger=require('../../../../config/logger')(_0x7ba7('0x7'));config['redis']=_[_0x7ba7('0x8')](config[_0x7ba7('0x9')],{'host':_0x7ba7('0xa'),'port':0x18eb});var io=require(_0x7ba7('0xb'))(new Redis(config[_0x7ba7('0x9')]));var headers={'Content-Type':_0x7ba7('0xc'),'Accept':'application/json'};function emit(_0x33f1bc,_0x720e1f,_0x2ab1f5){io['to'](_0x33f1bc)[_0x7ba7('0xd')](_0x720e1f,_0x2ab1f5);}function getTicket(_0x26c0aa,_0x3bc1ad,_0x10658f,_0x56900e,_0x3c92e6){logger[_0x7ba7('0xe')]('Creating\x20new\x20ticket...');var _0x20b1da=_[_0x7ba7('0xf')]({'responder_id':_0x3bc1ad['id'],'requester_id':_0x10658f['id'],'name':util['format'](_0x7ba7('0x10'),_0x3c92e6[_0x7ba7('0x11')]),'phone':_0x3c92e6[_0x7ba7('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7ba7('0x13')](_0x56900e[_0x7ba7('0x14')],_0x3c92e6,'\x20'),'description':intUtil['getString'](_0x56900e[_0x7ba7('0x15')],_0x3c92e6,_0x7ba7('0x16')),'tags':getTags(_0x56900e[_0x7ba7('0x17')],_0x7ba7('0x18'))},getCustomFields(_0x56900e[_0x7ba7('0x19')],_0x3c92e6));_0x20b1da[_0x7ba7('0x1a')]=_[_0x7ba7('0x1b')](_['keyBy'](_0x20b1da['custom_fields'],'id'),_0x7ba7('0x1c'));return request({'uri':util[_0x7ba7('0x1d')]('%s/api/v2/tickets',_0x26c0aa[_0x7ba7('0x1e')]),'method':_0x7ba7('0x1f'),'body':_0x20b1da})[_0x7ba7('0x20')](function(_0x4802d2){logger[_0x7ba7('0xe')](_0x7ba7('0x21'));return _0x4802d2;});}function getUser(_0x15ef3d,_0x212897){if(intUtil[_0x7ba7('0x22')](_0x212897)){return request({'uri':util[_0x7ba7('0x1d')](_0x7ba7('0x23'),_0x15ef3d[_0x7ba7('0x1e')]),'qs':{'email':_0x212897}})['then'](function(_0x5db581){if(_0x5db581[_0x7ba7('0x24')]){logger[_0x7ba7('0xe')]('Agent\x20found!');return _[_0x7ba7('0x25')](_0x5db581,function(_0x3d84d9){return _0x3d84d9[_0x7ba7('0x26')]['email']===_0x212897;});}else{logger[_0x7ba7('0xe')](_0x7ba7('0x27'));return request({'uri':util[_0x7ba7('0x1d')]('%s/api/v2/agents/me',_0x15ef3d['remoteUri'])})[_0x7ba7('0x20')](function(_0x2339a4){logger[_0x7ba7('0xe')](_0x7ba7('0x28'));return _0x2339a4;});}});}else{logger['info'](_0x7ba7('0x29'));return request({'uri':util[_0x7ba7('0x1d')](_0x7ba7('0x2a'),_0x15ef3d[_0x7ba7('0x1e')])})['then'](function(_0x3e3d4a){logger[_0x7ba7('0xe')](_0x7ba7('0x28'));return _0x3e3d4a;});}}function getEndUser(_0x3b60ed,_0x2486de,_0x22fd2f){logger['info'](_0x7ba7('0x2b'),_0x22fd2f);return request({'uri':util[_0x7ba7('0x1d')](_0x7ba7('0x2c'),_0x3b60ed['remoteUri']),'qs':{'phone':_0x22fd2f}})[_0x7ba7('0x20')](function(_0x266094){if(_0x266094[_0x7ba7('0x24')]){logger[_0x7ba7('0xe')]('Enduser\x20found!');return _['find'](_0x266094,{'phone':_0x22fd2f});}else{logger[_0x7ba7('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7ba7('0x1d')]('%s/api/v2/contacts',_0x3b60ed[_0x7ba7('0x1e')]),'method':_0x7ba7('0x1f'),'body':{'name':_0x2486de,'phone':_0x22fd2f}})[_0x7ba7('0x20')](function(_0xc536ad){logger[_0x7ba7('0xe')](_0x7ba7('0x2d'));return _0xc536ad;});}});}function getAuth(_0x189267){return util['format']('Basic\x20%s',new Buffer(_0x189267[_0x7ba7('0x2e')]+':X')[_0x7ba7('0x2f')](_0x7ba7('0x30')));}function request(_0x40823c){logger['debug'](_0x7ba7('0x31'),JSON[_0x7ba7('0x32')](_0x40823c));return rp(_[_0x7ba7('0x8')](_0x40823c,{'method':_0x7ba7('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x376e87,_0x3298ba){var _0x3cdffd=[];if(_0x376e87&&_0x376e87[_0x7ba7('0x24')]>0x0){_0x3cdffd=_[_0x7ba7('0x34')](_0x376e87,_0x3298ba);}return _0x3cdffd;}function getCustomFields(_0x436828,_0x10dbb2){var _0x3341bc=[];var _0x2f9d94={'custom_fields':[]};if(_0x436828[_0x7ba7('0x24')]>0x0){_[_0x7ba7('0x35')](_0x436828,function(_0x5817e5){if(_0x5817e5[_0x7ba7('0x36')]===_0x7ba7('0x37')&&_0x5817e5[_0x7ba7('0x38')]&&!_0x5817e5[_0x7ba7('0x39')]){_0x2f9d94[_0x5817e5[_0x7ba7('0x38')][_0x7ba7('0x3a')]()]=_0x5817e5[_0x7ba7('0x3b')][_0x7ba7('0x2f')]();}else if(_0x5817e5[_0x7ba7('0x36')]===_0x7ba7('0x37')&&_0x5817e5[_0x7ba7('0x3c')]&&_0x5817e5['customField']){_0x2f9d94[_0x7ba7('0x1a')][_0x7ba7('0x3d')]({'id':_0x5817e5[_0x7ba7('0x3c')],'value':_0x5817e5['content'][_0x7ba7('0x2f')]()});}else if(_0x5817e5[_0x7ba7('0x36')]==='variable'&&_0x5817e5[_0x7ba7('0x3e')]&&_0x5817e5[_0x7ba7('0x3c')]&&_0x5817e5[_0x7ba7('0x39')]){_0x10dbb2[_0x5817e5[_0x7ba7('0x3e')]]&&_0x2f9d94[_0x7ba7('0x1a')]['push']({'id':_0x5817e5[_0x7ba7('0x3c')],'value':_0x10dbb2[_0x5817e5[_0x7ba7('0x3e')]][_0x7ba7('0x2f')]()});}else if(_0x5817e5[_0x7ba7('0x36')]===_0x7ba7('0x3f')&&_0x5817e5[_0x7ba7('0x40')]&&_0x5817e5[_0x7ba7('0x40')][_0x7ba7('0x18')]&&_0x5817e5[_0x7ba7('0x3c')]&&_0x5817e5[_0x7ba7('0x39')]){_0x10dbb2[_0x5817e5[_0x7ba7('0x40')][_0x7ba7('0x18')][_0x7ba7('0x3a')]()]&&_0x2f9d94[_0x7ba7('0x1a')][_0x7ba7('0x3d')]({'id':_0x5817e5[_0x7ba7('0x3c')],'value':_0x10dbb2[_0x5817e5[_0x7ba7('0x40')]['name'][_0x7ba7('0x3a')]()][_0x7ba7('0x2f')]()});}});}return _0x2f9d94;}exports[_0x7ba7('0x41')]=function(_0x1c591c,_0x2be1ef,_0x5b2394,_0x3e0800,_0x154e0e,_0x34f5a7){var _0x2eca28,_0x14ced6;_0x34f5a7[_0x7ba7('0x1e')]=intUtil[_0x7ba7('0x42')](_0x34f5a7[_0x7ba7('0x1e')]);_0x34f5a7[_0x7ba7('0x43')]=intUtil[_0x7ba7('0x42')](_0x34f5a7['serverUrl']);if(_0x154e0e&&_0x154e0e['monitor_format']){logger[_0x7ba7('0xe')]('[QUEUE]',_0x7ba7('0x44'));_0x2be1ef['recordingURL']=util[_0x7ba7('0x1d')](_0x7ba7('0x45'),_0x34f5a7[_0x7ba7('0x43')],_0x2be1ef[_0x7ba7('0x46')],md5(_0x2be1ef[_0x7ba7('0x46')]));}else{_0x2be1ef[_0x7ba7('0x47')]='';}headers[_0x7ba7('0x48')]=getAuth(_0x34f5a7);return getUser(_0x34f5a7,_0x3e0800[_0x7ba7('0x49')])[_0x7ba7('0x20')](function(_0x252022){_0x2eca28=_0x252022;logger[_0x7ba7('0xe')](_0x7ba7('0x4a'),_0x2eca28['id']);return getEndUser(_0x34f5a7,_0x2be1ef[_0x7ba7('0x11')],_0x2be1ef[_0x7ba7('0x12')]);})[_0x7ba7('0x20')](function(_0x229b1c){_0x14ced6=_0x229b1c;logger[_0x7ba7('0xe')](_0x7ba7('0x4b'),_0x14ced6['id']);return getTicket(_0x34f5a7,_0x2eca28,_0x14ced6,_0x5b2394,_0x2be1ef);})['then'](function(_0x234800){if(_0x234800&&_0x234800['id']){logger[_0x7ba7('0xe')]('Ticket\x20created!');logger[_0x7ba7('0xe')](_0x7ba7('0x4c'),_0x234800['id']);logger['info'](_0x7ba7('0x4d'),_0x7ba7('0x4e'));emit(util[_0x7ba7('0x1d')]('user:%s',_0x3e0800['name']),_0x7ba7('0x4f'),{'uri':util['format'](_0x7ba7('0x50'),_0x34f5a7[_0x7ba7('0x1e')],_0x234800['id'])});}})['catch'](function(_0x4e1c0b){logger['error'](_0x7ba7('0x4d'),JSON[_0x7ba7('0x32')](_0x4e1c0b));});};exports[_0x7ba7('0x51')]=function(_0x104d99,_0x293f35,_0x1c41af,_0x1ac098,_0xac469f,_0x4b9e7a,_0x1f3ea0){var _0x119b35,_0x416be8;_0x4b9e7a[_0x7ba7('0x1e')]=intUtil[_0x7ba7('0x42')](_0x4b9e7a[_0x7ba7('0x1e')]);_0x4b9e7a[_0x7ba7('0x43')]=intUtil[_0x7ba7('0x42')](_0x4b9e7a[_0x7ba7('0x43')]);if(_0x1f3ea0&&_0x1f3ea0['recordingFormat']&&_0x1f3ea0[_0x7ba7('0x52')]!==_0x7ba7('0x53')){logger[_0x7ba7('0xe')](_0x7ba7('0x54'),_0x7ba7('0x44'));_0x293f35[_0x7ba7('0x47')]=util[_0x7ba7('0x1d')](_0x7ba7('0x45'),_0x4b9e7a[_0x7ba7('0x43')],_0x293f35[_0x7ba7('0x46')],md5(_0x293f35[_0x7ba7('0x46')]));}headers['Authorization']=getAuth(_0x4b9e7a);return getUser(_0x4b9e7a,_0x1ac098[_0x7ba7('0x49')])[_0x7ba7('0x20')](function(_0x356007){_0x119b35=_0x356007;logger[_0x7ba7('0xe')](_0x7ba7('0x4a'),_0x119b35['id']);return getEndUser(_0x4b9e7a,_0x293f35['destcalleridname'],_0x293f35[_0x7ba7('0x55')]);})[_0x7ba7('0x20')](function(_0x299a40){_0x416be8=_0x299a40;logger[_0x7ba7('0xe')](_0x7ba7('0x4b'),_0x416be8['id']);return getTicket(_0x4b9e7a,_0x119b35,_0x416be8,_0x1c41af,_0x293f35);})[_0x7ba7('0x20')](function(_0x3beaf6){if(_0x3beaf6&&_0x3beaf6['id']){logger[_0x7ba7('0xe')](_0x7ba7('0x21'));logger[_0x7ba7('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3beaf6['id']);logger[_0x7ba7('0xe')](_0x7ba7('0x54'),_0x7ba7('0x4e'));emit(util[_0x7ba7('0x1d')](_0x7ba7('0x56'),_0x1ac098[_0x7ba7('0x18')]),_0x7ba7('0x4f'),{'uri':util[_0x7ba7('0x1d')](_0x7ba7('0x50'),_0x4b9e7a[_0x7ba7('0x1e')],_0x3beaf6['id'])});}})[_0x7ba7('0x57')](function(_0xbf83c3){logger['error'](_0x7ba7('0x54'),JSON[_0x7ba7('0x32')](_0xbf83c3));});};exports['unmanaged']=function(_0x39d889,_0x1712a6,_0x15c20d,_0x591112,_0x5cefdc,_0x3959ee){var _0x336f49,_0x190c99;_0x3959ee['remoteUri']=intUtil['stripTrailingSlash'](_0x3959ee['remoteUri']);_0x3959ee['serverUrl']=intUtil[_0x7ba7('0x42')](_0x3959ee[_0x7ba7('0x43')]);if(_0x5cefdc&&_0x5cefdc[_0x7ba7('0x58')]){logger[_0x7ba7('0xe')]('['+_0x1712a6[_0x7ba7('0x59')][_0x7ba7('0x5a')]()+']',_0x7ba7('0x44'));_0x1712a6[_0x7ba7('0x47')]=util[_0x7ba7('0x1d')](_0x7ba7('0x45'),_0x3959ee[_0x7ba7('0x43')],_0x1712a6[_0x7ba7('0x46')],md5(_0x1712a6['uniqueid']));}else{_0x1712a6['recordingURL']='';}headers['Authorization']=getAuth(_0x3959ee);return getUser(_0x3959ee,'')[_0x7ba7('0x20')](function(_0x2e340f){_0x336f49=_0x2e340f;logger[_0x7ba7('0xe')]('The\x20User\x20ID\x20is:',_0x336f49['id']);return getEndUser(_0x3959ee,_0x1712a6[_0x7ba7('0x11')],_0x1712a6[_0x7ba7('0x12')]);})[_0x7ba7('0x20')](function(_0xfda78b){_0x190c99=_0xfda78b;logger[_0x7ba7('0xe')](_0x7ba7('0x4b'),_0x190c99['id']);return getTicket(_0x3959ee,_0x336f49,_0x190c99,_0x15c20d,_0x1712a6);})[_0x7ba7('0x20')](function(_0x12f78b){if(_0x12f78b){logger[_0x7ba7('0xe')](_0x7ba7('0x21'));logger[_0x7ba7('0xe')](_0x7ba7('0x4c'),_0x12f78b['id']);}})[_0x7ba7('0x57')](function(_0x28a5ba){logger['error']('['+_0x1712a6[_0x7ba7('0x59')][_0x7ba7('0x5a')]()+']',JSON[_0x7ba7('0x32')](_0x28a5ba));});}; \ No newline at end of file +var _0xbdfb=['defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','format','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','type','string','customField','nameField','toLowerCase','content','idField','push','variable','customVariable','Variable','name','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk'];(function(_0x2fb447,_0x66b6ce){var _0x30d5a1=function(_0x1dbfcf){while(--_0x1dbfcf){_0x2fb447['push'](_0x2fb447['shift']());}};_0x30d5a1(++_0x66b6ce);}(_0xbdfb,0x10e));var _0xbbdf=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0xbdfb[_0x53f0db];return _0xae0a5c;};'use strict';var _=require(_0xbbdf('0x0'));var rp=require(_0xbbdf('0x1'));var md5=require(_0xbbdf('0x2'));var util=require(_0xbbdf('0x3'));var Redis=require(_0xbbdf('0x4'));var intUtil=require(_0xbbdf('0x5'));var config=require(_0xbbdf('0x6'));var logger=require(_0xbbdf('0x7'))(_0xbbdf('0x8'));config['redis']=_[_0xbbdf('0x9')](config[_0xbbdf('0xa')],{'host':_0xbbdf('0xb'),'port':0x18eb});var io=require(_0xbbdf('0xc'))(new Redis(config['redis']));var headers={'Content-Type':_0xbbdf('0xd'),'Accept':'application/json'};function emit(_0xd2c00a,_0x133236,_0x477702){io['to'](_0xd2c00a)[_0xbbdf('0xe')](_0x133236,_0x477702);}function getTicket(_0x30f7e5,_0x53f522,_0x2772cf,_0xe8c84d,_0x8c967d){logger[_0xbbdf('0xf')](_0xbbdf('0x10'));var _0x59a2e1=_[_0xbbdf('0x11')]({'responder_id':_0x53f522['id'],'requester_id':_0x2772cf['id'],'name':util['format']('Caller\x20-\x20%s',_0x8c967d[_0xbbdf('0x12')]),'phone':_0x8c967d[_0xbbdf('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0xe8c84d[_0xbbdf('0x14')],_0x8c967d,'\x20'),'description':intUtil['getString'](_0xe8c84d[_0xbbdf('0x15')],_0x8c967d,_0xbbdf('0x16')),'tags':getTags(_0xe8c84d[_0xbbdf('0x17')],'name')},getCustomFields(_0xe8c84d[_0xbbdf('0x18')],_0x8c967d));_0x59a2e1[_0xbbdf('0x19')]=_[_0xbbdf('0x1a')](_['keyBy'](_0x59a2e1[_0xbbdf('0x19')],'id'),'value');return request({'uri':util['format'](_0xbbdf('0x1b'),_0x30f7e5[_0xbbdf('0x1c')]),'method':_0xbbdf('0x1d'),'body':_0x59a2e1})[_0xbbdf('0x1e')](function(_0x226751){logger[_0xbbdf('0xf')]('Ticket\x20created!');return _0x226751;});}function getUser(_0xf34dd5,_0x2e34a4){if(intUtil[_0xbbdf('0x1f')](_0x2e34a4)){return request({'uri':util[_0xbbdf('0x20')]('%s/api/v2/agents',_0xf34dd5[_0xbbdf('0x1c')]),'qs':{'email':_0x2e34a4}})[_0xbbdf('0x1e')](function(_0x304d0e){if(_0x304d0e[_0xbbdf('0x21')]){logger['info'](_0xbbdf('0x22'));return _[_0xbbdf('0x23')](_0x304d0e,function(_0x40eae2){return _0x40eae2[_0xbbdf('0x24')][_0xbbdf('0x25')]===_0x2e34a4;});}else{logger[_0xbbdf('0xf')](_0xbbdf('0x26'));return request({'uri':util[_0xbbdf('0x20')](_0xbbdf('0x27'),_0xf34dd5[_0xbbdf('0x1c')])})[_0xbbdf('0x1e')](function(_0x5217f6){logger[_0xbbdf('0xf')](_0xbbdf('0x28'));return _0x5217f6;});}});}else{logger[_0xbbdf('0xf')](_0xbbdf('0x29'));return request({'uri':util[_0xbbdf('0x20')]('%s/api/v2/agents/me',_0xf34dd5[_0xbbdf('0x1c')])})['then'](function(_0x487fb0){logger[_0xbbdf('0xf')](_0xbbdf('0x28'));return _0x487fb0;});}}function getEndUser(_0x5a94fc,_0x1b5a99,_0x5f4cdf){logger['info'](_0xbbdf('0x2a'),_0x5f4cdf);return request({'uri':util[_0xbbdf('0x20')](_0xbbdf('0x2b'),_0x5a94fc[_0xbbdf('0x1c')]),'qs':{'phone':_0x5f4cdf}})[_0xbbdf('0x1e')](function(_0x52f0e3){if(_0x52f0e3[_0xbbdf('0x21')]){logger[_0xbbdf('0xf')](_0xbbdf('0x2c'));return _[_0xbbdf('0x23')](_0x52f0e3,{'phone':_0x5f4cdf});}else{logger['info'](_0xbbdf('0x2d'));return request({'uri':util[_0xbbdf('0x20')](_0xbbdf('0x2b'),_0x5a94fc[_0xbbdf('0x1c')]),'method':_0xbbdf('0x1d'),'body':{'name':_0x1b5a99,'phone':_0x5f4cdf}})['then'](function(_0x597f2a){logger[_0xbbdf('0xf')](_0xbbdf('0x2e'));return _0x597f2a;});}});}function getAuth(_0x44db6f){return util[_0xbbdf('0x20')](_0xbbdf('0x2f'),new Buffer(_0x44db6f[_0xbbdf('0x30')]+':X')[_0xbbdf('0x31')](_0xbbdf('0x32')));}function request(_0x32252b){logger[_0xbbdf('0x33')](_0xbbdf('0x34'),JSON[_0xbbdf('0x35')](_0x32252b));return rp(_[_0xbbdf('0x9')](_0x32252b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x79863e,_0x12046d){var _0x4ba508=[];if(_0x79863e&&_0x79863e['length']>0x0){_0x4ba508=_['map'](_0x79863e,_0x12046d);}return _0x4ba508;}function getCustomFields(_0x144632,_0x49c288){var _0x52ca35=[];var _0x3c3b06={'custom_fields':[]};if(_0x144632[_0xbbdf('0x21')]>0x0){_[_0xbbdf('0x36')](_0x144632,function(_0xcdea87){if(_0xcdea87[_0xbbdf('0x37')]===_0xbbdf('0x38')&&_0xcdea87['nameField']&&!_0xcdea87[_0xbbdf('0x39')]){_0x3c3b06[_0xcdea87[_0xbbdf('0x3a')][_0xbbdf('0x3b')]()]=_0xcdea87[_0xbbdf('0x3c')][_0xbbdf('0x31')]();}else if(_0xcdea87[_0xbbdf('0x37')]===_0xbbdf('0x38')&&_0xcdea87[_0xbbdf('0x3d')]&&_0xcdea87[_0xbbdf('0x39')]){_0x3c3b06[_0xbbdf('0x19')][_0xbbdf('0x3e')]({'id':_0xcdea87[_0xbbdf('0x3d')],'value':_0xcdea87[_0xbbdf('0x3c')][_0xbbdf('0x31')]()});}else if(_0xcdea87[_0xbbdf('0x37')]===_0xbbdf('0x3f')&&_0xcdea87['variableName']&&_0xcdea87['idField']&&_0xcdea87[_0xbbdf('0x39')]){_0x49c288[_0xcdea87['variableName']]&&_0x3c3b06[_0xbbdf('0x19')]['push']({'id':_0xcdea87[_0xbbdf('0x3d')],'value':_0x49c288[_0xcdea87['variableName']][_0xbbdf('0x31')]()});}else if(_0xcdea87['type']===_0xbbdf('0x40')&&_0xcdea87[_0xbbdf('0x41')]&&_0xcdea87[_0xbbdf('0x41')]['name']&&_0xcdea87['idField']&&_0xcdea87[_0xbbdf('0x39')]){_0x49c288[_0xcdea87[_0xbbdf('0x41')][_0xbbdf('0x42')][_0xbbdf('0x3b')]()]&&_0x3c3b06[_0xbbdf('0x19')][_0xbbdf('0x3e')]({'id':_0xcdea87['idField'],'value':_0x49c288[_0xcdea87['Variable'][_0xbbdf('0x42')][_0xbbdf('0x3b')]()][_0xbbdf('0x31')]()});}});}return _0x3c3b06;}exports['queue']=function(_0x40bbf2,_0xe23092,_0x389a15,_0x5c2790,_0x565a57,_0x3bc557){var _0x2dccd2,_0x45c878;_0x3bc557[_0xbbdf('0x1c')]=intUtil['stripTrailingSlash'](_0x3bc557['remoteUri']);_0x3bc557[_0xbbdf('0x43')]=intUtil[_0xbbdf('0x44')](_0x3bc557['serverUrl']);if(_0x565a57&&_0x565a57[_0xbbdf('0x45')]){logger[_0xbbdf('0xf')]('[QUEUE]',_0xbbdf('0x46'));_0xe23092[_0xbbdf('0x47')]=util[_0xbbdf('0x20')](_0xbbdf('0x48'),_0x3bc557[_0xbbdf('0x43')],_0xe23092[_0xbbdf('0x49')],md5(_0xe23092['uniqueid']));}else{_0xe23092[_0xbbdf('0x47')]='';}headers[_0xbbdf('0x4a')]=getAuth(_0x3bc557);return getUser(_0x3bc557,_0x5c2790[_0xbbdf('0x25')])['then'](function(_0x1c532c){_0x2dccd2=_0x1c532c;logger['info'](_0xbbdf('0x4b'),_0x2dccd2['id']);return getEndUser(_0x3bc557,_0xe23092[_0xbbdf('0x12')],_0xe23092['calleridnum']);})[_0xbbdf('0x1e')](function(_0xc1af83){_0x45c878=_0xc1af83;logger[_0xbbdf('0xf')]('The\x20Enduser\x20ID\x20is:',_0x45c878['id']);return getTicket(_0x3bc557,_0x2dccd2,_0x45c878,_0x389a15,_0xe23092);})[_0xbbdf('0x1e')](function(_0x4a0031){if(_0x4a0031&&_0x4a0031['id']){logger[_0xbbdf('0xf')](_0xbbdf('0x4c'));logger[_0xbbdf('0xf')](_0xbbdf('0x4d'),_0x4a0031['id']);logger[_0xbbdf('0xf')](_0xbbdf('0x4e'),_0xbbdf('0x4f'));emit(util['format'](_0xbbdf('0x50'),_0x5c2790[_0xbbdf('0x42')]),_0xbbdf('0x51'),{'uri':util[_0xbbdf('0x20')](_0xbbdf('0x52'),_0x3bc557[_0xbbdf('0x1c')],_0x4a0031['id'])});}})[_0xbbdf('0x53')](function(_0x199fa5){logger[_0xbbdf('0x54')](_0xbbdf('0x4e'),JSON[_0xbbdf('0x35')](_0x199fa5));});};exports['outbound']=function(_0x49f57b,_0x4c302e,_0x2983b5,_0x401730,_0x4a306c,_0x4652bc,_0x4aea81){var _0x11e010,_0x26eb77;_0x4652bc[_0xbbdf('0x1c')]=intUtil[_0xbbdf('0x44')](_0x4652bc['remoteUri']);_0x4652bc['serverUrl']=intUtil[_0xbbdf('0x44')](_0x4652bc['serverUrl']);if(_0x4aea81&&_0x4aea81[_0xbbdf('0x55')]&&_0x4aea81[_0xbbdf('0x55')]!==_0xbbdf('0x56')){logger[_0xbbdf('0xf')]('[OUTBOUND]',_0xbbdf('0x46'));_0x4c302e['recordingURL']=util['format'](_0xbbdf('0x48'),_0x4652bc['serverUrl'],_0x4c302e[_0xbbdf('0x49')],md5(_0x4c302e[_0xbbdf('0x49')]));}headers[_0xbbdf('0x4a')]=getAuth(_0x4652bc);return getUser(_0x4652bc,_0x401730['email'])[_0xbbdf('0x1e')](function(_0x56629a){_0x11e010=_0x56629a;logger['info'](_0xbbdf('0x4b'),_0x11e010['id']);return getEndUser(_0x4652bc,_0x4c302e[_0xbbdf('0x57')],_0x4c302e[_0xbbdf('0x58')]);})['then'](function(_0x26e45d){_0x26eb77=_0x26e45d;logger[_0xbbdf('0xf')](_0xbbdf('0x59'),_0x26eb77['id']);return getTicket(_0x4652bc,_0x11e010,_0x26eb77,_0x2983b5,_0x4c302e);})[_0xbbdf('0x1e')](function(_0x4aa785){if(_0x4aa785&&_0x4aa785['id']){logger[_0xbbdf('0xf')]('Ticket\x20created!');logger[_0xbbdf('0xf')](_0xbbdf('0x4d'),_0x4aa785['id']);logger[_0xbbdf('0xf')](_0xbbdf('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbbdf('0x20')]('user:%s',_0x401730[_0xbbdf('0x42')]),_0xbbdf('0x51'),{'uri':util[_0xbbdf('0x20')]('%s/helpdesk/tickets/%d',_0x4652bc[_0xbbdf('0x1c')],_0x4aa785['id'])});}})[_0xbbdf('0x53')](function(_0x3bb0cb){logger[_0xbbdf('0x54')]('[OUTBOUND]',JSON[_0xbbdf('0x35')](_0x3bb0cb));});};exports[_0xbbdf('0x5b')]=function(_0x1c3518,_0x5038ba,_0xa01d3,_0x556be3,_0x166f18,_0xc4f312){var _0x2e5b32,_0x10c8d2;_0xc4f312[_0xbbdf('0x1c')]=intUtil[_0xbbdf('0x44')](_0xc4f312[_0xbbdf('0x1c')]);_0xc4f312[_0xbbdf('0x43')]=intUtil[_0xbbdf('0x44')](_0xc4f312['serverUrl']);if(_0x166f18&&_0x166f18['monitor_format']){logger[_0xbbdf('0xf')]('['+_0x5038ba['lastevent'][_0xbbdf('0x5c')]()+']',_0xbbdf('0x46'));_0x5038ba[_0xbbdf('0x47')]=util[_0xbbdf('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc4f312[_0xbbdf('0x43')],_0x5038ba[_0xbbdf('0x49')],md5(_0x5038ba[_0xbbdf('0x49')]));}else{_0x5038ba[_0xbbdf('0x47')]='';}headers['Authorization']=getAuth(_0xc4f312);return getUser(_0xc4f312,'')[_0xbbdf('0x1e')](function(_0x5ec97f){_0x2e5b32=_0x5ec97f;logger[_0xbbdf('0xf')](_0xbbdf('0x4b'),_0x2e5b32['id']);return getEndUser(_0xc4f312,_0x5038ba['calleridname'],_0x5038ba['calleridnum']);})[_0xbbdf('0x1e')](function(_0x4b76f8){_0x10c8d2=_0x4b76f8;logger[_0xbbdf('0xf')]('The\x20Enduser\x20ID\x20is:',_0x10c8d2['id']);return getTicket(_0xc4f312,_0x2e5b32,_0x10c8d2,_0xa01d3,_0x5038ba);})['then'](function(_0x5bb2df){if(_0x5bb2df){logger['info'](_0xbbdf('0x4c'));logger[_0xbbdf('0xf')](_0xbbdf('0x4d'),_0x5bb2df['id']);}})[_0xbbdf('0x53')](function(_0x3678a4){logger[_0xbbdf('0x54')]('['+_0x5038ba['lastevent']['toUpperCase']()+']',JSON[_0xbbdf('0x35')](_0x3678a4));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 1d2769d..768c543 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 _0x8ef6=['error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','mobile_number','Contact\x20found:','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch'];(function(_0x5f4fc2,_0x16ac49){var _0x522a03=function(_0x7d781b){while(--_0x7d781b){_0x5f4fc2['push'](_0x5f4fc2['shift']());}};_0x522a03(++_0x16ac49);}(_0x8ef6,0x9b));var _0x68ef=function(_0x50bb4e,_0xaef60c){_0x50bb4e=_0x50bb4e-0x0;var _0x48f4a1=_0x8ef6[_0x50bb4e];return _0x48f4a1;};'use strict';var _=require(_0x68ef('0x0'));var rp=require('request-promise');var md5=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x68ef('0x3'));var intUtil=require(_0x68ef('0x4'));var config=require(_0x68ef('0x5'));var logger=require(_0x68ef('0x6'))(_0x68ef('0x7'));config[_0x68ef('0x8')]=_[_0x68ef('0x9')](config['redis'],{'host':_0x68ef('0xa'),'port':0x18eb});var io=require(_0x68ef('0xb'))(new Redis(config[_0x68ef('0x8')]));function getAdminId(_0x498edd,_0x2ce5b7,_0x347a0f,_0x2505ce){return new Promise(function(_0x46528f,_0x2d36e3){var _0x36530f=![];var _0x36036c={'method':_0x68ef('0xc'),'uri':_0x2505ce+_0x68ef('0xd'),'json':!![]};_0x36036c[_0x68ef('0xe')]=_0x347a0f;logger[_0x68ef('0xf')]('Getting\x20admin\x20information');return rp(_0x36036c)[_0x68ef('0x10')](function(_0x2b7d38){if(_0x2b7d38){var _0x36ec58=_0x2b7d38[_0x68ef('0x11')];var _0x212afc=null;for(_0x212afc=0x0;_0x212afc<_0x36ec58[_0x68ef('0x12')];_0x212afc++){if(_0x36ec58[_0x212afc][_0x68ef('0x13')]===_0x498edd[_0x68ef('0x14')]){_0x498edd[_0x68ef('0x15')]=_0x36ec58[_0x212afc]['id'];_0x36530f=!![];}}if(_0x36530f){logger[_0x68ef('0xf')](_0x68ef('0x16'),_0x498edd[_0x68ef('0x15')]);_0x46528f(_0x498edd);}else{_0x2d36e3({'statusCode':0x194,'message':_0x68ef('0x17')});}}else{_0x2d36e3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x68ef('0x18')](function(_0x380a4d){logger[_0x68ef('0x19')]('['+[_0x2ce5b7[_0x68ef('0x1a')]()]+']',_0x380a4d[_0x68ef('0x1b')]);_0x2d36e3(_0x380a4d);});});}function getUser(_0x193ff5,_0x2ecd51,_0x47a69c){return function(_0x276777){return new Promise(function(_0x36db3c,_0x110a4f){var _0x3101e9={'method':_0x68ef('0xc'),'uri':_0x47a69c+'/api/selector/owners','json':!![]};_0x3101e9[_0x68ef('0xe')]=_0x2ecd51;logger[_0x68ef('0xf')]('Getting\x20user\x20list');return rp(_0x3101e9)[_0x68ef('0x10')](function(_0x627725){if(_0x627725){var _0x39e0e9=_0x627725[_0x68ef('0x11')];var _0x42c6af=![];var _0x3ea367=null;if(_0x276777[_0x68ef('0x1c')]!==null){logger[_0x68ef('0xf')](_0x68ef('0x1d'),_0x276777['agentEmail']);_0x276777[_0x68ef('0x1e')]=_0x276777[_0x68ef('0x1c')];for(_0x3ea367=0x0;_0x3ea367<_0x39e0e9[_0x68ef('0x12')];_0x3ea367++){if(_0x39e0e9[_0x3ea367]['email']===_0x276777[_0x68ef('0x1c')]){_0x42c6af=!![];_0x276777[_0x68ef('0x1f')]=_0x39e0e9[_0x3ea367]['id'];logger[_0x68ef('0xf')]('User\x20found:',_0x276777['userId']);}}}if(!_0x42c6af){logger[_0x68ef('0xf')](_0x68ef('0x20'));_0x276777[_0x68ef('0x1e')]=_0x276777['adminEmail'];_0x276777[_0x68ef('0x1f')]=_0x276777[_0x68ef('0x15')];_0x42c6af=!![];}if(_0x42c6af){_0x36db3c(_0x276777);}else{_0x110a4f({'statusCode':0x194,'message':_0x68ef('0x17')});}}else{_0x110a4f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x55f6bf){logger[_0x68ef('0x19')]('['+[_0x193ff5['toUpperCase']()]+']',_0x55f6bf[_0x68ef('0x1b')]);_0x110a4f(_0x55f6bf);});});};}function getEndUser(_0x24b641,_0x1bf2b0,_0x391d1c){return function(_0x799430){return new Promise(function(_0x509b92,_0x5bb3e4){var _0x3cd13f=0x0;var _0xcf94f7={'method':_0x68ef('0xc'),'uri':_0x391d1c+_0x68ef('0x21'),'json':!![]};_0xcf94f7[_0x68ef('0xe')]=_0x1bf2b0;logger[_0x68ef('0xf')](_0x68ef('0x22'));return rp(_0xcf94f7)[_0x68ef('0x10')](function(_0x1f503a){_0x1f503a['filters']['forEach'](function(_0x50ffa4){if(_0x50ffa4['name']===_0x68ef('0x23')){_0x3cd13f=_0x50ffa4['id'];}});})[_0x68ef('0x10')](function(){logger[_0x68ef('0xf')](_0x68ef('0x24'));var _0x23471a={'method':_0x68ef('0xc'),'uri':_0x391d1c+_0x68ef('0x25')+_0x3cd13f,'json':!![]};_0x23471a['headers']=_0x1bf2b0;return rp(_0x23471a);})[_0x68ef('0x10')](function(_0x4a608e){logger[_0x68ef('0xf')](_0x68ef('0x26'),_0x799430[_0x68ef('0x27')]);if(_0x4a608e[_0x68ef('0x28')][_0x68ef('0x12')]>0x0){var _0x39d20a=_[_0x68ef('0x29')](_0x4a608e[_0x68ef('0x28')],function(_0x13a7f8){if(_0x13a7f8['work_number']===_0x799430['contactNumber']||_0x13a7f8[_0x68ef('0x2a')]===_0x799430[_0x68ef('0x27')]){return _0x13a7f8;}});if(_0x39d20a){_0x799430['endUserId']=_0x39d20a['id'];logger[_0x68ef('0xf')](_0x68ef('0x2b'),_0x799430[_0x68ef('0x2c')]);_0x509b92(_0x799430);}else{return createEndUser(_0x799430,_0x24b641,_0x1bf2b0,_0x391d1c)['then'](function(_0x4d44eb){logger[_0x68ef('0xf')](_0x68ef('0x2d'),_0x799430[_0x68ef('0x2c')]);_0x509b92(_0x4d44eb);});}}else{return createEndUser(_0x799430,_0x24b641,_0x1bf2b0,_0x391d1c)[_0x68ef('0x10')](function(_0x5c5d91){logger[_0x68ef('0xf')]('Contact\x20created:',_0x799430['endUserId']);_0x509b92(_0x5c5d91);});}})['catch'](function(_0x28fdd7){throw new Error(_0x28fdd7[_0x68ef('0x1b')]);});});};}function createEndUser(_0x399b4c,_0x8eb2c3,_0x10a12d,_0x724aca){return new Promise(function(_0x4e05c4,_0x30593d){var _0x4e5932=moment();var _0x53cd91={'method':_0x68ef('0x2e'),'uri':_0x724aca+_0x68ef('0x2f'),'body':{'contact':{'last_name':_0x399b4c[_0x68ef('0x27')],'work_number':_0x399b4c[_0x68ef('0x27')],'mobile_number':_0x399b4c[_0x68ef('0x27')],'owner_id':_0x399b4c['userId'],'created_at':_0x4e5932[_0x68ef('0x30')](_0x68ef('0x31'))}},'json':!![]};_0x53cd91['headers']=_0x10a12d;logger[_0x68ef('0xf')](_0x68ef('0x32'));return rp(_0x53cd91)[_0x68ef('0x10')](function(_0x2dc431){_0x399b4c['endUserId']=_0x2dc431[_0x68ef('0x33')]['id'];_0x4e05c4(_0x399b4c);})['catch'](function(_0x5e91f6){logger[_0x68ef('0x19')]('['+[_0x8eb2c3[_0x68ef('0x1a')]()]+']',_0x5e91f6[_0x68ef('0x1b')]);_0x30593d(_0x5e91f6[_0x68ef('0x1b')]);});});}function getTicket(_0x1d4294,_0x497b41,_0x3840fe,_0x44dae2,_0x12fefa){return function(_0xfca434){logger[_0x68ef('0xf')](_0x68ef('0x34'));return new Promise(function(_0x361c25,_0x4a59dc){var _0xa7a640=moment();var _0x414888={'method':'POST','uri':_0x3840fe+_0x68ef('0x35'),'body':{'title':intUtil['getString'](_0x44dae2[_0x68ef('0x36')],_0x12fefa,'\x20'),'description':intUtil[_0x68ef('0x37')](_0x44dae2[_0x68ef('0x38')],_0x12fefa,'\x0a'),'owner_id':_0xfca434[_0x68ef('0x1f')],'creater_id':_0xfca434['adminId'],'targetable_id':_0xfca434['endUserId'],'targetable_type':_0x68ef('0x39'),'created_at':_0xa7a640[_0x68ef('0x30')](_0x68ef('0x31')),'due_date':_0xa7a640[_0x68ef('0x3a')](0x1e,'m')[_0x68ef('0x30')](_0x68ef('0x31'))},'json':!![]};_0x414888['headers']=_0x497b41;return rp(_0x414888)[_0x68ef('0x10')](function(_0x1f3059){_0xfca434[_0x68ef('0x3b')]=_0x1f3059[_0x68ef('0x3c')]['id'];logger[_0x68ef('0xf')](_0x68ef('0x3d'),_0xfca434[_0x68ef('0x3b')]);_0x361c25(_0xfca434);})[_0x68ef('0x18')](function(_0x228de5){logger['error']('['+[_0x1d4294[_0x68ef('0x1a')]()]+']',_0x228de5[_0x68ef('0x1b')]);_0x4a59dc(_0x228de5['message']);});});};}function emit(_0x2a329d,_0x4f0077,_0x2afaa3){var _0x22f1e3={'uri':_0x2a329d+_0x68ef('0x3e')+_0x2afaa3};io['to'](util['format'](_0x68ef('0x3f'),_0x4f0077))[_0x68ef('0x40')](_0x68ef('0x41'),_0x22f1e3);}exports['cs']=function(_0x1a6951,_0x340f08,_0x56d923,_0x388704,_0x206cb7,_0x15905a,_0x4e1159,_0x2376be){var _0x5f65b8={};var _0x421255={'Authorization':_0x68ef('0x42')+_0x15905a[_0x68ef('0x43')]};_0x15905a['remoteUri']=intUtil['stripTrailingSlash'](_0x15905a[_0x68ef('0x44')]);_0x15905a[_0x68ef('0x45')]=intUtil[_0x68ef('0x46')](_0x15905a['serverUrl']);var _0x1034fc=_0x15905a[_0x68ef('0x44')];_0x5f65b8[_0x68ef('0x14')]=_0x15905a[_0x68ef('0x47')];_0x5f65b8[_0x68ef('0x27')]=_0x2376be[_0x68ef('0x48')]()===_0x68ef('0x49')?_0x340f08[_0x68ef('0x4a')]:_0x340f08[_0x68ef('0x4b')];_0x5f65b8['callDirection']=_0x2376be===_0x68ef('0x4c')||_0x2376be===_0x68ef('0x4d')?_0x68ef('0x4c'):_0x68ef('0x49');if(_0x388704){_0x5f65b8[_0x68ef('0x1c')]=_0x388704['email'];}var _0x18622d=util['format'](_0x68ef('0x4e'),_0x15905a[_0x68ef('0x45')],_0x340f08['uniqueid'],md5(_0x340f08['uniqueid']));if(_0x206cb7&&_0x206cb7[_0x68ef('0x4f')]){logger['info'](_0x68ef('0x50'),_0x68ef('0x51'));_0x340f08[_0x68ef('0x52')]=_0x18622d;}else if(_0x4e1159&&_0x4e1159[_0x68ef('0x53')]&&_0x4e1159[_0x68ef('0x53')]!==_0x68ef('0x54')){logger[_0x68ef('0xf')](_0x68ef('0x55'),'Recording\x20is\x20enabled!');_0x340f08['recordingURL']=_0x18622d;}else{_0x340f08['recordingURL']='';}return getAdminId(_0x5f65b8,_0x2376be,_0x421255,_0x1034fc)[_0x68ef('0x10')](getUser(_0x2376be,_0x421255,_0x1034fc))[_0x68ef('0x10')](getEndUser(_0x2376be,_0x421255,_0x1034fc))['then'](getTicket(_0x2376be,_0x421255,_0x1034fc,_0x56d923,_0x340f08))[_0x68ef('0x10')](function(_0x50156f){logger[_0x68ef('0xf')](util[_0x68ef('0x30')](_0x68ef('0x56'),_0x50156f[_0x68ef('0x3b')]));if(_0x2376be!==_0x68ef('0x4d')){logger['info']('['+[_0x2376be[_0x68ef('0x1a')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1034fc,_0x388704[_0x68ef('0x57')],_0x50156f['endUserId']);}})[_0x68ef('0x18')](function(_0x12a8c5){logger['error']('['+[_0x2376be[_0x68ef('0x1a')]()]+_0x68ef('0x58'),util[_0x68ef('0x59')](_0x12a8c5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x99fc=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','toUpperCase','Getting\x20contacts\x20filter','then','filters','forEach','All\x20Contacts','/api/contacts/view/','Searching\x20contact\x20with\x20phone','find','contacts','work_number','contactNumber','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0xd6c1bc,_0x50b1bf){var _0x83d630=function(_0x4e089b){while(--_0x4e089b){_0xd6c1bc['push'](_0xd6c1bc['shift']());}};_0x83d630(++_0x50b1bf);}(_0x99fc,0xb9));var _0xc99f=function(_0x5df51f,_0x287ebf){_0x5df51f=_0x5df51f-0x0;var _0x267990=_0x99fc[_0x5df51f];return _0x267990;};'use strict';var _=require(_0xc99f('0x0'));var rp=require('request-promise');var md5=require(_0xc99f('0x1'));var util=require(_0xc99f('0x2'));var moment=require('moment');var Promise=require(_0xc99f('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xc99f('0x4'));var logger=require('../../../../config/logger')('freshsales');config[_0xc99f('0x5')]=_[_0xc99f('0x6')](config[_0xc99f('0x5')],{'host':_0xc99f('0x7'),'port':0x18eb});var io=require(_0xc99f('0x8'))(new Redis(config[_0xc99f('0x5')]));function getAdminId(_0x486ca1,_0x427b5a,_0x51cdd8,_0x47327c){return new Promise(function(_0x53b0aa,_0x4c39a9){var _0x378605=![];var _0x239cc3={'method':'GET','uri':_0x47327c+_0xc99f('0x9'),'json':!![]};_0x239cc3[_0xc99f('0xa')]=_0x51cdd8;logger[_0xc99f('0xb')](_0xc99f('0xc'));return rp(_0x239cc3)['then'](function(_0x158955){if(_0x158955){var _0x1ac77b=_0x158955[_0xc99f('0xd')];var _0x2f0572=null;for(_0x2f0572=0x0;_0x2f0572<_0x1ac77b[_0xc99f('0xe')];_0x2f0572++){if(_0x1ac77b[_0x2f0572][_0xc99f('0xf')]===_0x486ca1[_0xc99f('0x10')]){_0x486ca1[_0xc99f('0x11')]=_0x1ac77b[_0x2f0572]['id'];_0x378605=!![];}}if(_0x378605){logger['info'](_0xc99f('0x12'),_0x486ca1[_0xc99f('0x11')]);_0x53b0aa(_0x486ca1);}else{_0x4c39a9({'statusCode':0x194,'message':_0xc99f('0x13')});}}else{_0x4c39a9({'statusCode':0x194,'message':_0xc99f('0x13')});}})[_0xc99f('0x14')](function(_0x58d219){logger[_0xc99f('0x15')]('['+[_0x427b5a['toUpperCase']()]+']',_0x58d219[_0xc99f('0x16')]);_0x4c39a9(_0x58d219);});});}function getUser(_0x2b4877,_0x3cb1a6,_0x511475){return function(_0x261a73){return new Promise(function(_0x20cafe,_0x5a867b){var _0x258931={'method':_0xc99f('0x17'),'uri':_0x511475+'/api/selector/owners','json':!![]};_0x258931[_0xc99f('0xa')]=_0x3cb1a6;logger[_0xc99f('0xb')](_0xc99f('0x18'));return rp(_0x258931)['then'](function(_0x3575ca){if(_0x3575ca){var _0x19e3a1=_0x3575ca[_0xc99f('0xd')];var _0x436d08=![];var _0x5330fb=null;if(_0x261a73[_0xc99f('0x19')]!==null){logger[_0xc99f('0xb')](_0xc99f('0x1a'),_0x261a73[_0xc99f('0x19')]);_0x261a73[_0xc99f('0x1b')]=_0x261a73[_0xc99f('0x19')];for(_0x5330fb=0x0;_0x5330fb<_0x19e3a1[_0xc99f('0xe')];_0x5330fb++){if(_0x19e3a1[_0x5330fb][_0xc99f('0xf')]===_0x261a73[_0xc99f('0x19')]){_0x436d08=!![];_0x261a73['userId']=_0x19e3a1[_0x5330fb]['id'];logger[_0xc99f('0xb')](_0xc99f('0x1c'),_0x261a73[_0xc99f('0x1d')]);}}}if(!_0x436d08){logger[_0xc99f('0xb')](_0xc99f('0x1e'));_0x261a73[_0xc99f('0x1b')]=_0x261a73['adminEmail'];_0x261a73[_0xc99f('0x1d')]=_0x261a73[_0xc99f('0x11')];_0x436d08=!![];}if(_0x436d08){_0x20cafe(_0x261a73);}else{_0x5a867b({'statusCode':0x194,'message':_0xc99f('0x13')});}}else{_0x5a867b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc99f('0x14')](function(_0x3d7baa){logger[_0xc99f('0x15')]('['+[_0x2b4877[_0xc99f('0x1f')]()]+']',_0x3d7baa[_0xc99f('0x16')]);_0x5a867b(_0x3d7baa);});});};}function getEndUser(_0x4bbca7,_0x3d5035,_0x12b731){return function(_0x152edb){return new Promise(function(_0x4b1d15,_0x6b91c3){var _0x48918e=0x0;var _0x268bea={'method':'GET','uri':_0x12b731+'/api/contacts/filters','json':!![]};_0x268bea[_0xc99f('0xa')]=_0x3d5035;logger[_0xc99f('0xb')](_0xc99f('0x20'));return rp(_0x268bea)[_0xc99f('0x21')](function(_0x5c9f29){_0x5c9f29[_0xc99f('0x22')][_0xc99f('0x23')](function(_0x2bbdb6){if(_0x2bbdb6['name']===_0xc99f('0x24')){_0x48918e=_0x2bbdb6['id'];}});})[_0xc99f('0x21')](function(){logger[_0xc99f('0xb')]('Getting\x20contact\x20list');var _0x3bac75={'method':_0xc99f('0x17'),'uri':_0x12b731+_0xc99f('0x25')+_0x48918e,'json':!![]};_0x3bac75[_0xc99f('0xa')]=_0x3d5035;return rp(_0x3bac75);})[_0xc99f('0x21')](function(_0x23afa0){logger[_0xc99f('0xb')](_0xc99f('0x26'),_0x152edb['contactNumber']);if(_0x23afa0['contacts'][_0xc99f('0xe')]>0x0){var _0x4de1f8=_[_0xc99f('0x27')](_0x23afa0[_0xc99f('0x28')],function(_0x373289){if(_0x373289[_0xc99f('0x29')]===_0x152edb[_0xc99f('0x2a')]||_0x373289[_0xc99f('0x2b')]===_0x152edb[_0xc99f('0x2a')]){return _0x373289;}});if(_0x4de1f8){_0x152edb[_0xc99f('0x2c')]=_0x4de1f8['id'];logger[_0xc99f('0xb')](_0xc99f('0x2d'),_0x152edb[_0xc99f('0x2c')]);_0x4b1d15(_0x152edb);}else{return createEndUser(_0x152edb,_0x4bbca7,_0x3d5035,_0x12b731)['then'](function(_0x45e460){logger[_0xc99f('0xb')](_0xc99f('0x2e'),_0x152edb[_0xc99f('0x2c')]);_0x4b1d15(_0x45e460);});}}else{return createEndUser(_0x152edb,_0x4bbca7,_0x3d5035,_0x12b731)[_0xc99f('0x21')](function(_0x3a9d8a){logger[_0xc99f('0xb')](_0xc99f('0x2e'),_0x152edb[_0xc99f('0x2c')]);_0x4b1d15(_0x3a9d8a);});}})[_0xc99f('0x14')](function(_0xce7cf6){throw new Error(_0xce7cf6['message']);});});};}function createEndUser(_0x325fb3,_0xedd14a,_0x5dd154,_0x1d45e1){return new Promise(function(_0x5f1c7d,_0x466100){var _0x522b1e=moment();var _0x2c75ec={'method':'POST','uri':_0x1d45e1+_0xc99f('0x2f'),'body':{'contact':{'last_name':_0x325fb3[_0xc99f('0x2a')],'work_number':_0x325fb3[_0xc99f('0x2a')],'mobile_number':_0x325fb3['contactNumber'],'owner_id':_0x325fb3[_0xc99f('0x1d')],'created_at':_0x522b1e[_0xc99f('0x30')](_0xc99f('0x31'))}},'json':!![]};_0x2c75ec['headers']=_0x5dd154;logger[_0xc99f('0xb')](_0xc99f('0x32'));return rp(_0x2c75ec)[_0xc99f('0x21')](function(_0x348ded){_0x325fb3['endUserId']=_0x348ded[_0xc99f('0x33')]['id'];_0x5f1c7d(_0x325fb3);})[_0xc99f('0x14')](function(_0x37b6c6){logger[_0xc99f('0x15')]('['+[_0xedd14a['toUpperCase']()]+']',_0x37b6c6[_0xc99f('0x16')]);_0x466100(_0x37b6c6[_0xc99f('0x16')]);});});}function getTicket(_0x377ad0,_0x5afcf8,_0x3ca9ca,_0x288bd8,_0x369b83){return function(_0x116f8a){logger['info'](_0xc99f('0x34'));return new Promise(function(_0x6c8133,_0x4d24fd){var _0x16ec79=moment();var _0xcb56c5={'method':_0xc99f('0x35'),'uri':_0x3ca9ca+_0xc99f('0x36'),'body':{'title':intUtil['getString'](_0x288bd8[_0xc99f('0x37')],_0x369b83,'\x20'),'description':intUtil[_0xc99f('0x38')](_0x288bd8[_0xc99f('0x39')],_0x369b83,'\x0a'),'owner_id':_0x116f8a[_0xc99f('0x1d')],'creater_id':_0x116f8a['adminId'],'targetable_id':_0x116f8a[_0xc99f('0x2c')],'targetable_type':_0xc99f('0x3a'),'created_at':_0x16ec79[_0xc99f('0x30')](_0xc99f('0x31')),'due_date':_0x16ec79['add'](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0xcb56c5[_0xc99f('0xa')]=_0x5afcf8;return rp(_0xcb56c5)[_0xc99f('0x21')](function(_0x22d9f9){_0x116f8a[_0xc99f('0x3b')]=_0x22d9f9[_0xc99f('0x3c')]['id'];logger[_0xc99f('0xb')](_0xc99f('0x3d'),_0x116f8a[_0xc99f('0x3b')]);_0x6c8133(_0x116f8a);})['catch'](function(_0x4078f5){logger[_0xc99f('0x15')]('['+[_0x377ad0['toUpperCase']()]+']',_0x4078f5[_0xc99f('0x16')]);_0x4d24fd(_0x4078f5['message']);});});};}function emit(_0x17f98a,_0x5d40fe,_0x3ebee7){var _0x32b77d={'uri':_0x17f98a+'/contacts/'+_0x3ebee7};io['to'](util[_0xc99f('0x30')](_0xc99f('0x3e'),_0x5d40fe))['emit'](_0xc99f('0x3f'),_0x32b77d);}exports['cs']=function(_0xde992c,_0x2a1e3d,_0xa5866a,_0x198af9,_0x3fa288,_0x5ae7f4,_0x1931ba,_0x2f949b){var _0x429c37={};var _0x5c25a1={'Authorization':_0xc99f('0x40')+_0x5ae7f4['apiKey']};_0x5ae7f4[_0xc99f('0x41')]=intUtil[_0xc99f('0x42')](_0x5ae7f4[_0xc99f('0x41')]);_0x5ae7f4[_0xc99f('0x43')]=intUtil[_0xc99f('0x42')](_0x5ae7f4[_0xc99f('0x43')]);var _0x241a9e=_0x5ae7f4[_0xc99f('0x41')];_0x429c37[_0xc99f('0x10')]=_0x5ae7f4['username'];_0x429c37[_0xc99f('0x2a')]=_0x2f949b[_0xc99f('0x44')]()===_0xc99f('0x45')?_0x2a1e3d[_0xc99f('0x46')]:_0x2a1e3d[_0xc99f('0x47')];_0x429c37['callDirection']=_0x2f949b===_0xc99f('0x48')||_0x2f949b===_0xc99f('0x49')?'queue':'outbound';if(_0x198af9){_0x429c37[_0xc99f('0x19')]=_0x198af9['email'];}var _0x2404b1=util['format'](_0xc99f('0x4a'),_0x5ae7f4['serverUrl'],_0x2a1e3d[_0xc99f('0x4b')],md5(_0x2a1e3d[_0xc99f('0x4b')]));if(_0x3fa288&&_0x3fa288[_0xc99f('0x4c')]){logger[_0xc99f('0xb')](_0xc99f('0x4d'),_0xc99f('0x4e'));_0x2a1e3d['recordingURL']=_0x2404b1;}else if(_0x1931ba&&_0x1931ba['recordingFormat']&&_0x1931ba[_0xc99f('0x4f')]!==_0xc99f('0x50')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2a1e3d[_0xc99f('0x51')]=_0x2404b1;}else{_0x2a1e3d[_0xc99f('0x51')]='';}return getAdminId(_0x429c37,_0x2f949b,_0x5c25a1,_0x241a9e)[_0xc99f('0x21')](getUser(_0x2f949b,_0x5c25a1,_0x241a9e))['then'](getEndUser(_0x2f949b,_0x5c25a1,_0x241a9e))[_0xc99f('0x21')](getTicket(_0x2f949b,_0x5c25a1,_0x241a9e,_0xa5866a,_0x2a1e3d))['then'](function(_0x1c5f90){logger['info'](util[_0xc99f('0x30')](_0xc99f('0x52'),_0x1c5f90[_0xc99f('0x3b')]));if(_0x2f949b!==_0xc99f('0x49')){logger[_0xc99f('0xb')]('['+[_0x2f949b['toUpperCase']()]+']',_0xc99f('0x53'));emit(_0x241a9e,_0x198af9[_0xc99f('0x54')],_0x1c5f90[_0xc99f('0x2c')]);}})[_0xc99f('0x14')](function(_0x10983f){logger[_0xc99f('0x15')]('['+[_0x2f949b[_0xc99f('0x1f')]()]+_0xc99f('0x55'),util[_0xc99f('0x56')](_0x10983f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index eaeb5c3..de96f98 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 _0x0972=['./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','EVENT\x20UNKNOWN','servicenow','log','unknown\x20integration','[EXEC]','format','data3','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','util','./salesforce'];(function(_0x20dbbb,_0x712626){var _0x1004ef=function(_0xcf5ff2){while(--_0xcf5ff2){_0x20dbbb['push'](_0x20dbbb['shift']());}};_0x1004ef(++_0x712626);}(_0x0972,0x64));var _0x2097=function(_0xd20879,_0xbf32ae){_0xd20879=_0xd20879-0x0;var _0x12bcf7=_0x0972[_0xd20879];return _0x12bcf7;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x2097('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x2097('0x2'));var zoho=require(_0x2097('0x3'));var desk=require('./desk');var vtiger=require(_0x2097('0x4'));var servicenow=require(_0x2097('0x5'));var dynamics365=require(_0x2097('0x6'));var freshsales=require(_0x2097('0x7'));var integrations=[_0x2097('0x8'),_0x2097('0x9'),_0x2097('0xa'),'freshdesk',_0x2097('0xb'),_0x2097('0xc'),_0x2097('0xd'),_0x2097('0xe'),_0x2097('0xf'),'servicenow'];exports[_0x2097('0x10')]=function(_0x3b8b76,_0x131f06,_0x430754,_0x7baeb3,_0x3b5847,_0x3d5519){if(_0x430754){if(_[_0x2097('0x11')](integrations,_0x3b8b76[_0x2097('0x12')][_0x2097('0x13')]())){try{var _0x2cc91c=null;var _0x3b2f94='';var _0x170005=_0x430754[_0x3b8b76[_0x2097('0x12')][_0x2097('0x13')]()];if(_0x170005){var _0x3e3fdc=_0x170005[_0x3b8b76[_0x2097('0x14')]];if(_0x3e3fdc){var _0x1c9ef9=_[_0x2097('0x15')](_0x3e3fdc[_0x2097('0x16')],{'id':parseInt(_0x3b8b76['data3'],0xa)});if(_0x1c9ef9){if(_0x7baeb3){if(_0x3b5847&&_0x131f06[_0x2097('0x17')]){_0x3b2f94=_0x2097('0x17');}else if(_0x131f06['routeId']){_0x3b2f94='outbound';}else{console['log'](_0x2097('0x18'),_0x131f06);}}else{_0x3b2f94='unmanaged';}switch(_0x3b8b76[_0x2097('0x12')][_0x2097('0x13')]()){case _0x2097('0x8'):zendesk[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0x9'):salesforce[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xa'):sugarcrm[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case'freshdesk':freshdesk[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xb'):zoho[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xc'):desk[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xd'):vtiger[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xf'):freshsales['cs'](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519,_0x3b2f94);break;case _0x2097('0x19'):servicenow['cs'](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519,_0x3b2f94);break;case _0x2097('0xe'):dynamics365['cs'](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519,_0x3b2f94);break;default:console[_0x2097('0x1a')](_0x2097('0x1b'));}}else{_0x2cc91c=require('../../../../config/logger')(_0x3b8b76['data1'][_0x2097('0x13')]());_0x2cc91c['error'](_0x2097('0x1c'),util[_0x2097('0x1d')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3b8b76[_0x2097('0x12')]['toLowerCase'](),_0x3b8b76[_0x2097('0x1e')]));}}else{_0x2cc91c=require(_0x2097('0x1f'))(_0x3b8b76[_0x2097('0x12')][_0x2097('0x13')]());_0x2cc91c[_0x2097('0x20')](_0x2097('0x1c'),util['format'](_0x2097('0x21'),_0x3b8b76['data1'][_0x2097('0x13')](),_0x3b8b76[_0x2097('0x14')]));}}else{}}catch(_0x345875){console[_0x2097('0x20')](_0x345875);}}}}; \ No newline at end of file +var _0x8952=['log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','freshdesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','find','data3','queue','routeId','outbound'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8952,0x17e));var _0x2895=function(_0x4f7d39,_0x134bec){_0x4f7d39=_0x4f7d39-0x0;var _0x3cc2ae=_0x8952[_0x4f7d39];return _0x3cc2ae;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var zendesk=require(_0x2895('0x1'));var salesforce=require(_0x2895('0x2'));var sugarcrm=require(_0x2895('0x3'));var freshdesk=require(_0x2895('0x4'));var zoho=require('./zoho');var desk=require(_0x2895('0x5'));var vtiger=require(_0x2895('0x6'));var servicenow=require(_0x2895('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x2895('0x8'));var integrations=[_0x2895('0x9'),_0x2895('0xa'),'sugarcrm','freshdesk',_0x2895('0xb'),_0x2895('0xc'),_0x2895('0xd'),_0x2895('0xe'),_0x2895('0xf'),'servicenow'];exports[_0x2895('0x10')]=function(_0x5f2632,_0x428772,_0x5af454,_0x5e66fc,_0x56c5b9,_0x9bb58c){if(_0x5af454){if(_[_0x2895('0x11')](integrations,_0x5f2632[_0x2895('0x12')]['toLowerCase']())){try{var _0x981298=null;var _0x3924be='';var _0x4b1342=_0x5af454[_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()];if(_0x4b1342){var _0x5abb23=_0x4b1342[_0x5f2632['data2']];if(_0x5abb23){var _0x1d1493=_[_0x2895('0x14')](_0x5abb23['Configurations'],{'id':parseInt(_0x5f2632[_0x2895('0x15')],0xa)});if(_0x1d1493){if(_0x5e66fc){if(_0x56c5b9&&_0x428772[_0x2895('0x16')]){_0x3924be=_0x2895('0x16');}else if(_0x428772[_0x2895('0x17')]){_0x3924be=_0x2895('0x18');}else{console[_0x2895('0x19')](_0x2895('0x1a'),_0x428772);}}else{_0x3924be=_0x2895('0x1b');}switch(_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()){case _0x2895('0x9'):zendesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xa'):salesforce[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1c'):sugarcrm[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1d'):freshdesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xb'):zoho[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xc'):desk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xd'):vtiger[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xf'):freshsales['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'servicenow':servicenow['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'dynamics365':dynamics365['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;default:console['log'](_0x2895('0x1e'));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632[_0x2895('0x12')]['toLowerCase']());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util[_0x2895('0x22')](_0x2895('0x23'),_0x5f2632[_0x2895('0x12')]['toLowerCase'](),_0x5f2632[_0x2895('0x15')]));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632['data1'][_0x2895('0x13')]());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x5f2632[_0x2895('0x12')][_0x2895('0x13')](),_0x5f2632[_0x2895('0x24')]));}}else{}}catch(_0x4a21cf){console[_0x2895('0x20')](_0x4a21cf);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 6b51958..2cd7947 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 _0xdd85=['uniqueid','email','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','destcalleridname','destcalleridnum','outbound','[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','lastevent','toUpperCase','recordingURL','isNil','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.','stringify','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','ticketType','Task','assign','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','User','find','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','concat','Connection','https://login.salesforce.com','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdd85,0x1d1));var _0x5dd8=function(_0x2ba899,_0x115ba1){_0x2ba899=_0x2ba899-0x0;var _0x4ba68a=_0xdd85[_0x2ba899];return _0x4ba68a;};'use strict';var _=require(_0x5dd8('0x0'));var rp=require(_0x5dd8('0x1'));var moment=require(_0x5dd8('0x2'));var BPromise=require(_0x5dd8('0x3'));var md5=require(_0x5dd8('0x4'));var jsforce=require(_0x5dd8('0x5'));var util=require(_0x5dd8('0x6'));var Redis=require(_0x5dd8('0x7'));var intUtil=require('./util');var config=require(_0x5dd8('0x8'));var logger=require(_0x5dd8('0x9'))('salesforce');config['redis']=_['defaults'](config[_0x5dd8('0xa')],{'host':_0x5dd8('0xb'),'port':0x18eb});var io=require(_0x5dd8('0xc'))(new Redis(config[_0x5dd8('0xa')]));function emit(_0x47d2fd,_0x4e4753,_0x370a8e){io['to'](_0x47d2fd)[_0x5dd8('0xd')](_0x4e4753,_0x370a8e);}function getTicket(_0xf063ba,_0xd198bf,_0x322f92,_0x2f6f0c,_0xa2eceb,_0x24855c,_0x56f7a4,_0x473a9a){var _0x49e991={};if(_0x2f6f0c[_0x5dd8('0xe')]===_0x5dd8('0xf')){_0x49e991=Object[_0x5dd8('0x10')]({},{'OwnerId':_0xd198bf['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x5dd8('0x11')](_0x2f6f0c[_0x5dd8('0x12')],_0xa2eceb,'\x20'),'Description':intUtil[_0x5dd8('0x11')](_0x2f6f0c[_0x5dd8('0x13')],_0xa2eceb,'\x0a')},getCustomFields(_0x24855c,_0xa2eceb));if(_0x322f92){_0x49e991[_0x5dd8('0x14')]=_0x322f92['id'];}}else if(_0x2f6f0c[_0x5dd8('0xe')]===_0x5dd8('0x15')){_0x49e991=Object['assign']({},{'OwnerId':_0xd198bf['id'],'Subject':intUtil[_0x5dd8('0x11')](_0x2f6f0c[_0x5dd8('0x12')],_0xa2eceb,'\x20'),'Description':intUtil['getString'](_0x2f6f0c[_0x5dd8('0x13')],_0xa2eceb,'\x0a')},getCustomFields(_0x24855c,_0xa2eceb));if(_0x322f92){_0x49e991[_0x5dd8('0x16')]=_0x322f92['id'];}}return _0x56f7a4[_0x5dd8('0x17')](_0x2f6f0c[_0x5dd8('0xe')])[_0x5dd8('0x18')](_0x49e991);}function getUser(_0x3ea47d,_0x239242,_0x1ca641){if(!_['isNil'](_0x239242)&&intUtil['validateEmail'](_0x239242)){var _0xab1c1={'Email':_0x239242};var _0xf08998={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1ca641[_0x5dd8('0x17')](_0x5dd8('0x19'))[_0x5dd8('0x1a')](_0xab1c1,_0xf08998)['execute']()['then'](function(_0x4a5eba){if(_0x4a5eba[_0x5dd8('0x1b')]){var _0x6f1dbb=_['find'](_0x4a5eba,function(_0x19bcd4){return _0x19bcd4[_0x5dd8('0x1c')]===_0x239242;});if(_0x6f1dbb){logger[_0x5dd8('0x1d')](_0x5dd8('0x1e'),_0x239242);return BPromise[_0x5dd8('0x1f')]({'id':_0x6f1dbb['Id'],'name':_0x6f1dbb[_0x5dd8('0x20')]});}}else{logger[_0x5dd8('0x1d')](_0x5dd8('0x21'),_0x239242);return _0x1ca641[_0x5dd8('0x22')]()['then'](function(_0x1ede9f){return BPromise[_0x5dd8('0x1f')]({'id':_0x1ede9f[_0x5dd8('0x23')],'name':_0x1ede9f[_0x5dd8('0x24')]});});}});}else{logger[_0x5dd8('0x1d')](_0x5dd8('0x21'),_0x239242);return _0x1ca641[_0x5dd8('0x22')]()[_0x5dd8('0x25')](function(_0x326f28){return BPromise[_0x5dd8('0x1f')]({'id':_0x326f28[_0x5dd8('0x23')],'name':_0x326f28['display_name']});});}}function getEndUser(_0x8731a9,_0x28d92e,_0x17bb61,_0x2c2e92,_0x4f5efe){var _0x3ed230={'Phone':_0x2c2e92};var _0x24a98a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5dd8('0x1f')]()[_0x5dd8('0x25')](function(){if(_0x28d92e[_0x5dd8('0xe')]===_0x5dd8('0xf')){logger['info'](_0x5dd8('0x26'),_0x2c2e92,_0x28d92e[_0x5dd8('0x27')]);switch(_0x28d92e[_0x5dd8('0x27')]){case _0x5dd8('0x28'):return _0x4f5efe[_0x5dd8('0x17')](_0x5dd8('0x29'))[_0x5dd8('0x1a')](_0x3ed230,_0x24a98a)[_0x5dd8('0x2a')]()[_0x5dd8('0x25')](function(_0x4c854f){if(_0x4c854f&&_0x4c854f[_0x5dd8('0x1b')]){return _0x4c854f;}else{return _0x4f5efe[_0x5dd8('0x17')](_0x5dd8('0x2b'))[_0x5dd8('0x1a')](_0x3ed230,_0x24a98a);}});case'contact':return _0x4f5efe['sobject']('Contact')['find'](_0x3ed230,_0x24a98a)[_0x5dd8('0x2a')]();case _0x5dd8('0x2c'):return _0x4f5efe[_0x5dd8('0x17')]('Lead')[_0x5dd8('0x1a')](_0x3ed230,_0x24a98a);default:return null;}}else if(_0x28d92e['ticketType']===_0x5dd8('0x15')){logger[_0x5dd8('0x1d')](_0x5dd8('0x26'),_0x2c2e92,_0x5dd8('0x2d'));return _0x4f5efe['sobject'](_0x5dd8('0x29'))[_0x5dd8('0x1a')](_0x3ed230,_0x24a98a)[_0x5dd8('0x2a')]();}})[_0x5dd8('0x25')](function(_0xcb220d){if(_0xcb220d&&_0xcb220d[_0x5dd8('0x1b')]){var _0x2a0ef0=_[_0x5dd8('0x1a')](_0xcb220d,function(_0x31b032){return _0x31b032[_0x5dd8('0x2e')]===_0x2c2e92;});if(_0x2a0ef0){return BPromise[_0x5dd8('0x1f')]({'id':_0x2a0ef0['Id'],'name':_0x2a0ef0[_0x5dd8('0x20')],'phone':_0x2a0ef0[_0x5dd8('0x2e')]});}}})['then'](function(_0x12cb70){if(_0x12cb70){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x2c2e92);return BPromise['resolve'](_0x12cb70);}else{logger[_0x5dd8('0x1d')](_0x5dd8('0x2f'),_0x2c2e92);var _0x3d5fdb={'LastName':_0x17bb61!==_0x5dd8('0x30')?_0x17bb61:util[_0x5dd8('0x31')]('Caller\x20-\x20%s',_0x2c2e92),'Phone':_0x2c2e92};if(_0x28d92e[_0x5dd8('0x32')]){if(_0x28d92e[_0x5dd8('0x32')]===_0x5dd8('0x2d')){logger[_0x5dd8('0x1d')](_0x5dd8('0x33'),_0x2c2e92,_0x28d92e['moduleCreate']);}else if(_0x28d92e[_0x5dd8('0x32')]===_0x5dd8('0x2c')&&_0x28d92e[_0x5dd8('0xe')]==='Task'){logger[_0x5dd8('0x1d')](_0x5dd8('0x33'),_0x2c2e92,_0x28d92e[_0x5dd8('0x32')]);_0x3d5fdb[_0x5dd8('0x34')]=_0x5dd8('0x35');}else{return null;}}return _0x4f5efe[_0x5dd8('0x17')](_[_0x5dd8('0x36')](_0x28d92e['moduleCreate']))['create'](_0x3d5fdb);}});}function getCustomFields(_0x2611a5,_0x71d236){var _0x3341e3={};if(_0x2611a5['length']>0x0){_[_0x5dd8('0x37')](_0x2611a5,function(_0x302a2c){if(_0x302a2c[_0x5dd8('0x38')]===_0x5dd8('0x39')&&_0x302a2c[_0x5dd8('0x3a')]){_0x3341e3[_0x302a2c[_0x5dd8('0x3a')]]=_0x302a2c[_0x5dd8('0x3b')]['toString']();}else if(_0x302a2c[_0x5dd8('0x38')]===_0x5dd8('0x3c')&&_0x302a2c[_0x5dd8('0x3d')]&&_0x302a2c[_0x5dd8('0x3a')]){_0x71d236[_0x302a2c[_0x5dd8('0x3d')]]&&(_0x3341e3[_0x302a2c['idField']]=_0x71d236[_0x302a2c[_0x5dd8('0x3d')]][_0x5dd8('0x3e')]());}else if(_0x302a2c[_0x5dd8('0x38')]===_0x5dd8('0x3f')&&_0x302a2c[_0x5dd8('0x40')]&&_0x302a2c[_0x5dd8('0x40')]['name']&&_0x302a2c[_0x5dd8('0x3a')]){_0x71d236[_0x302a2c[_0x5dd8('0x40')][_0x5dd8('0x41')][_0x5dd8('0x42')]()]&&(_0x3341e3[_0x302a2c[_0x5dd8('0x3a')]]=_0x71d236[_0x302a2c[_0x5dd8('0x40')][_0x5dd8('0x41')][_0x5dd8('0x42')]()][_0x5dd8('0x3e')]());}});}return _0x3341e3;}function getConnection(_0x1ebabf){var _0x4eee9c=_0x1ebabf['password'][_0x5dd8('0x43')](_0x1ebabf['securityToken']);var _0x33604c=new jsforce[(_0x5dd8('0x44'))]({'oauth2':{'loginUrl':_0x1ebabf['remoteUri']||_0x5dd8('0x45'),'clientId':_0x1ebabf['clientId'],'clientSecret':_0x1ebabf[_0x5dd8('0x46')]}});return _0x33604c['login'](_0x1ebabf[_0x5dd8('0x47')],_0x4eee9c)['then'](function(){logger['info'](_0x5dd8('0x48'));return _0x33604c;});}exports['queue']=function(_0x3a9766,_0x4687ae,_0x1e62bd,_0x2be1a9,_0x29c2a2,_0x2b38e4){var _0x10f59e,_0x29bc3f,_0x14b53a,_0xe293d4;_0x2b38e4[_0x5dd8('0x49')]=intUtil[_0x5dd8('0x4a')](_0x2b38e4[_0x5dd8('0x49')]);_0x2b38e4[_0x5dd8('0x4b')]=intUtil[_0x5dd8('0x4a')](_0x2b38e4[_0x5dd8('0x4b')]);if(_0x29c2a2&&_0x29c2a2[_0x5dd8('0x4c')]){logger[_0x5dd8('0x1d')](_0x5dd8('0x4d'),_0x5dd8('0x4e'));_0x4687ae['recordingURL']=util[_0x5dd8('0x31')](_0x5dd8('0x4f'),_0x2b38e4[_0x5dd8('0x49')],_0x4687ae[_0x5dd8('0x50')],md5(_0x4687ae[_0x5dd8('0x50')]));}else{_0x4687ae['recordingURL']='';}return getConnection(_0x2b38e4)['then'](function(_0x1b22f8){_0xe293d4=_0x1b22f8;return getUser(_0x2b38e4,_0x2be1a9[_0x5dd8('0x51')],_0xe293d4);})[_0x5dd8('0x25')](function(_0x149b14){_0x10f59e=_0x149b14;return getEndUser(_0x2b38e4,_0x1e62bd,_0x4687ae['calleridname'],_0x4687ae['calleridnum'],_0xe293d4);})['then'](function(_0x288e8c){_0x29bc3f=_0x288e8c;return getTicket(_0x2b38e4,_0x10f59e,_0x29bc3f,_0x1e62bd,_0x4687ae,_0x1e62bd['Fields'],_0xe293d4,_0x5dd8('0x52'));})[_0x5dd8('0x25')](function(_0x460231){_0x14b53a=_0x460231;logger['info'](_0x5dd8('0x53'),_0x14b53a['id']);logger[_0x5dd8('0x1d')](_0x5dd8('0x54'),_0x14b53a['id'],_0x2be1a9[_0x5dd8('0x41')],_0x2b38e4['type']);switch(_0x2b38e4[_0x5dd8('0x38')]){case _0x5dd8('0x55'):emit(util[_0x5dd8('0x31')](_0x5dd8('0x56'),_0x2be1a9[_0x5dd8('0x41')]),_0x5dd8('0x57'),{'recordId':_0x14b53a['id']});break;case _0x5dd8('0x58'):emit(util[_0x5dd8('0x31')](_0x5dd8('0x56'),_0x2be1a9[_0x5dd8('0x41')]),'trigger:browser:url',{'uri':util[_0x5dd8('0x31')](_0x5dd8('0x59'),_0xe293d4[_0x5dd8('0x5a')],_0x14b53a['id'])});break;default:logger[_0x5dd8('0x5b')](_0x5dd8('0x5c'));}})[_0x5dd8('0x5d')](function(_0x3d042b){logger[_0x5dd8('0x5b')]('[QUEUE]',JSON['stringify'](_0x3d042b));});};exports['outbound']=function(_0x19d91d,_0x255831,_0x536f95,_0x45f62b,_0x7d3c05,_0x37fd03,_0x5ed20e){var _0x270ccb,_0xe89bcd,_0x9ae6b3,_0x11ba49;_0x37fd03[_0x5dd8('0x49')]=intUtil[_0x5dd8('0x4a')](_0x37fd03[_0x5dd8('0x49')]);_0x37fd03[_0x5dd8('0x4b')]=intUtil[_0x5dd8('0x4a')](_0x37fd03[_0x5dd8('0x4b')]);if(_0x5ed20e&&_0x5ed20e['recordingFormat']&&_0x5ed20e['recordingFormat']!=='none'){logger[_0x5dd8('0x1d')]('[OUTBOUND]',_0x5dd8('0x4e'));_0x255831['recordingURL']=util[_0x5dd8('0x31')](_0x5dd8('0x4f'),_0x37fd03['serverUrl'],_0x255831[_0x5dd8('0x50')],md5(_0x255831[_0x5dd8('0x50')]));}return getConnection(_0x37fd03)[_0x5dd8('0x25')](function(_0xb716e9){_0x11ba49=_0xb716e9;return getUser(_0x37fd03,_0x45f62b[_0x5dd8('0x51')],_0x11ba49);})[_0x5dd8('0x25')](function(_0x197ebf){_0x270ccb=_0x197ebf;return getEndUser(_0x37fd03,_0x536f95,_0x255831[_0x5dd8('0x5e')],_0x255831[_0x5dd8('0x5f')],_0x11ba49);})['then'](function(_0x35cbfa){_0xe89bcd=_0x35cbfa;return getTicket(_0x37fd03,_0x270ccb,_0xe89bcd,_0x536f95,_0x255831,_0x536f95['Fields'],_0x11ba49,_0x5dd8('0x60'));})[_0x5dd8('0x25')](function(_0x5b4dfc){_0x9ae6b3=_0x5b4dfc;logger[_0x5dd8('0x1d')](_0x5dd8('0x61'),_0x9ae6b3['id']);logger[_0x5dd8('0x1d')](_0x5dd8('0x62'),_0x9ae6b3['id'],_0x45f62b[_0x5dd8('0x41')],_0x37fd03[_0x5dd8('0x38')]);switch(_0x37fd03['type']){case _0x5dd8('0x55'):emit(util['format']('user:%s',_0x45f62b[_0x5dd8('0x41')]),'trigger:salesforce:display',{'recordId':_0x9ae6b3['id']});break;case _0x5dd8('0x58'):emit(util[_0x5dd8('0x31')](_0x5dd8('0x56'),_0x45f62b[_0x5dd8('0x41')]),'trigger:browser:url',{'uri':util[_0x5dd8('0x31')](_0x5dd8('0x59'),_0x11ba49[_0x5dd8('0x5a')],_0x9ae6b3['id'])});break;default:logger['error'](_0x5dd8('0x63'),_0x5dd8('0x64'));}})[_0x5dd8('0x5d')](function(_0x2074c8){logger[_0x5dd8('0x5b')](_0x5dd8('0x63'),JSON['stringify'](_0x2074c8));});};exports['unmanaged']=function(_0x1ec47c,_0x3fb3cc,_0xdbcac4,_0x1f4a35,_0x475619,_0x44ef1d){var _0x423fdf,_0xf77b9c,_0x4237fd,_0x5e07d9;_0x44ef1d[_0x5dd8('0x49')]=intUtil[_0x5dd8('0x4a')](_0x44ef1d[_0x5dd8('0x49')]);_0x44ef1d['remoteUri']=intUtil[_0x5dd8('0x4a')](_0x44ef1d['remoteUri']);if(_0x475619&&_0x475619['monitor_format']){logger[_0x5dd8('0x1d')]('['+_0x3fb3cc[_0x5dd8('0x65')][_0x5dd8('0x66')]()+']',_0x5dd8('0x4e'));_0x3fb3cc['recordingURL']=util['format'](_0x5dd8('0x4f'),_0x44ef1d[_0x5dd8('0x49')],_0x3fb3cc['uniqueid'],md5(_0x3fb3cc[_0x5dd8('0x50')]));}else{_0x3fb3cc[_0x5dd8('0x67')]='';}return getConnection(_0x44ef1d)[_0x5dd8('0x25')](function(_0x29b65a){_0x5e07d9=_0x29b65a;if(!_[_0x5dd8('0x68')](_0x1f4a35)){return getUser(_0x44ef1d,_0x1f4a35[_0x5dd8('0x41')],_0x5e07d9);}else{return getUser(_0x44ef1d,null,_0x5e07d9);}})[_0x5dd8('0x25')](function(_0xf905cf){_0x423fdf=_0xf905cf;return getEndUser(_0x44ef1d,_0xdbcac4,_0x3fb3cc[_0x5dd8('0x69')],_0x3fb3cc[_0x5dd8('0x6a')],_0x5e07d9);})[_0x5dd8('0x25')](function(_0x113669){_0xf77b9c=_0x113669;return getTicket(_0x44ef1d,_0x423fdf,_0xf77b9c,_0xdbcac4,_0x3fb3cc,_0xdbcac4['Fields'],_0x5e07d9);})[_0x5dd8('0x25')](function(_0x3c1a8e){_0x4237fd=_0x3c1a8e;logger['info']('['+_0x3fb3cc[_0x5dd8('0x65')][_0x5dd8('0x66')]()+_0x5dd8('0x6b'),_0x4237fd['id']);logger[_0x5dd8('0x1d')]('['+_0x3fb3cc[_0x5dd8('0x65')][_0x5dd8('0x66')]()+']\x20Integration\x20account\x20type\x20%s.',_0x44ef1d[_0x5dd8('0x38')]);})[_0x5dd8('0x5d')](function(_0x5377d8){logger[_0x5dd8('0x5b')]('['+_0x3fb3cc[_0x5dd8('0x65')]['toUpperCase']()+']',JSON[_0x5dd8('0x6c')](_0x5377d8));});}; \ No newline at end of file +var _0x0722=['moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','No\x20Company','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','login','Connection\x20established.','queue','serverUrl','remoteUri','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','[OUTBOUND]','stringify','unmanaged','calleridname','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','Subjects','getString','Descriptions','WhoId','Case','assign','ContactId','create','isNil','validateEmail','sobject','User','find','then','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s'];(function(_0x4b3d10,_0x3da823){var _0x3f62cc=function(_0x366e9a){while(--_0x366e9a){_0x4b3d10['push'](_0x4b3d10['shift']());}};_0x3f62cc(++_0x3da823);}(_0x0722,0xa8));var _0x2072=function(_0x12fd69,_0x43d017){_0x12fd69=_0x12fd69-0x0;var _0x234d9e=_0x0722[_0x12fd69];return _0x234d9e;};'use strict';var _=require(_0x2072('0x0'));var rp=require(_0x2072('0x1'));var moment=require('moment');var BPromise=require(_0x2072('0x2'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x2072('0x3'));var Redis=require(_0x2072('0x4'));var intUtil=require(_0x2072('0x5'));var config=require(_0x2072('0x6'));var logger=require(_0x2072('0x7'))(_0x2072('0x8'));config[_0x2072('0x9')]=_[_0x2072('0xa')](config[_0x2072('0x9')],{'host':_0x2072('0xb'),'port':0x18eb});var io=require(_0x2072('0xc'))(new Redis(config[_0x2072('0x9')]));function emit(_0x2f7664,_0x1f98a8,_0x9f3aba){io['to'](_0x2f7664)[_0x2072('0xd')](_0x1f98a8,_0x9f3aba);}function getTicket(_0x497952,_0x4764c2,_0x4da489,_0x4309a1,_0x45ab63,_0x17c323,_0x543726,_0x345a95){var _0xd9d9a4={};if(_0x4309a1[_0x2072('0xe')]===_0x2072('0xf')){_0xd9d9a4=Object['assign']({},{'OwnerId':_0x4764c2['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x4309a1[_0x2072('0x10')],_0x45ab63,'\x20'),'Description':intUtil[_0x2072('0x11')](_0x4309a1[_0x2072('0x12')],_0x45ab63,'\x0a')},getCustomFields(_0x17c323,_0x45ab63));if(_0x4da489){_0xd9d9a4[_0x2072('0x13')]=_0x4da489['id'];}}else if(_0x4309a1['ticketType']===_0x2072('0x14')){_0xd9d9a4=Object[_0x2072('0x15')]({},{'OwnerId':_0x4764c2['id'],'Subject':intUtil[_0x2072('0x11')](_0x4309a1['Subjects'],_0x45ab63,'\x20'),'Description':intUtil[_0x2072('0x11')](_0x4309a1[_0x2072('0x12')],_0x45ab63,'\x0a')},getCustomFields(_0x17c323,_0x45ab63));if(_0x4da489){_0xd9d9a4[_0x2072('0x16')]=_0x4da489['id'];}}return _0x543726['sobject'](_0x4309a1[_0x2072('0xe')])[_0x2072('0x17')](_0xd9d9a4);}function getUser(_0x2e4557,_0x4c3857,_0x4dd205){if(!_[_0x2072('0x18')](_0x4c3857)&&intUtil[_0x2072('0x19')](_0x4c3857)){var _0x44500f={'Email':_0x4c3857};var _0x21f9d7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4dd205[_0x2072('0x1a')](_0x2072('0x1b'))[_0x2072('0x1c')](_0x44500f,_0x21f9d7)['execute']()[_0x2072('0x1d')](function(_0x57576e){if(_0x57576e[_0x2072('0x1e')]){var _0x4d4e93=_[_0x2072('0x1c')](_0x57576e,function(_0x4c5f35){return _0x4c5f35[_0x2072('0x1f')]===_0x4c3857;});if(_0x4d4e93){logger[_0x2072('0x20')]('Agent\x20%s\x20found.',_0x4c3857);return BPromise[_0x2072('0x21')]({'id':_0x4d4e93['Id'],'name':_0x4d4e93[_0x2072('0x22')]});}}else{logger['info'](_0x2072('0x23'),_0x4c3857);return _0x4dd205[_0x2072('0x24')]()[_0x2072('0x1d')](function(_0x4c77ec){return BPromise['resolve']({'id':_0x4c77ec['user_id'],'name':_0x4c77ec['display_name']});});}});}else{logger[_0x2072('0x20')](_0x2072('0x23'),_0x4c3857);return _0x4dd205['identity']()[_0x2072('0x1d')](function(_0x228468){return BPromise[_0x2072('0x21')]({'id':_0x228468[_0x2072('0x25')],'name':_0x228468[_0x2072('0x26')]});});}}function getEndUser(_0x16643b,_0xe4b895,_0x41b9a0,_0x30fab9,_0x4a54b3){var _0x11c9f2={'Phone':_0x30fab9};var _0x1c2efa={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2072('0x21')]()['then'](function(){if(_0xe4b895[_0x2072('0xe')]===_0x2072('0xf')){logger['info'](_0x2072('0x27'),_0x30fab9,_0xe4b895[_0x2072('0x28')]);switch(_0xe4b895[_0x2072('0x28')]){case _0x2072('0x29'):return _0x4a54b3['sobject'](_0x2072('0x2a'))[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa)[_0x2072('0x2b')]()[_0x2072('0x1d')](function(_0x787ec8){if(_0x787ec8&&_0x787ec8['length']){return _0x787ec8;}else{return _0x4a54b3[_0x2072('0x1a')](_0x2072('0x2c'))[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa);}});case _0x2072('0x2d'):return _0x4a54b3[_0x2072('0x1a')]('Contact')[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa)['execute']();case'lead':return _0x4a54b3['sobject'](_0x2072('0x2c'))[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa);default:return null;}}else if(_0xe4b895[_0x2072('0xe')]===_0x2072('0x14')){logger['info'](_0x2072('0x27'),_0x30fab9,_0x2072('0x2d'));return _0x4a54b3[_0x2072('0x1a')](_0x2072('0x2a'))[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa)[_0x2072('0x2b')]();}})[_0x2072('0x1d')](function(_0x26264e){if(_0x26264e&&_0x26264e[_0x2072('0x1e')]){var _0x1863f1=_[_0x2072('0x1c')](_0x26264e,function(_0x29dbef){return _0x29dbef[_0x2072('0x2e')]===_0x30fab9;});if(_0x1863f1){return BPromise[_0x2072('0x21')]({'id':_0x1863f1['Id'],'name':_0x1863f1[_0x2072('0x22')],'phone':_0x1863f1[_0x2072('0x2e')]});}}})['then'](function(_0x32af04){if(_0x32af04){logger[_0x2072('0x20')](_0x2072('0x2f'),_0x30fab9);return BPromise['resolve'](_0x32af04);}else{logger['info'](_0x2072('0x30'),_0x30fab9);var _0x15084b={'LastName':_0x41b9a0!==_0x2072('0x31')?_0x41b9a0:util[_0x2072('0x32')](_0x2072('0x33'),_0x30fab9),'Phone':_0x30fab9};if(_0xe4b895['moduleCreate']){if(_0xe4b895[_0x2072('0x34')]===_0x2072('0x2d')){logger['info'](_0x2072('0x35'),_0x30fab9,_0xe4b895[_0x2072('0x34')]);}else if(_0xe4b895[_0x2072('0x34')]===_0x2072('0x36')&&_0xe4b895[_0x2072('0xe')]==='Task'){logger[_0x2072('0x20')](_0x2072('0x35'),_0x30fab9,_0xe4b895[_0x2072('0x34')]);_0x15084b[_0x2072('0x37')]=_0x2072('0x38');}else{return null;}}return _0x4a54b3[_0x2072('0x1a')](_['upperFirst'](_0xe4b895[_0x2072('0x34')]))[_0x2072('0x17')](_0x15084b);}});}function getCustomFields(_0x2eceee,_0x22ce3f){var _0xbcff97={};if(_0x2eceee['length']>0x0){_[_0x2072('0x39')](_0x2eceee,function(_0x3935e6){if(_0x3935e6[_0x2072('0x3a')]===_0x2072('0x3b')&&_0x3935e6['idField']){_0xbcff97[_0x3935e6[_0x2072('0x3c')]]=_0x3935e6[_0x2072('0x3d')]['toString']();}else if(_0x3935e6[_0x2072('0x3a')]===_0x2072('0x3e')&&_0x3935e6[_0x2072('0x3f')]&&_0x3935e6[_0x2072('0x3c')]){_0x22ce3f[_0x3935e6['variableName']]&&(_0xbcff97[_0x3935e6[_0x2072('0x3c')]]=_0x22ce3f[_0x3935e6['variableName']][_0x2072('0x40')]());}else if(_0x3935e6[_0x2072('0x3a')]===_0x2072('0x41')&&_0x3935e6['Variable']&&_0x3935e6[_0x2072('0x42')][_0x2072('0x43')]&&_0x3935e6[_0x2072('0x3c')]){_0x22ce3f[_0x3935e6[_0x2072('0x42')][_0x2072('0x43')]['toLowerCase']()]&&(_0xbcff97[_0x3935e6[_0x2072('0x3c')]]=_0x22ce3f[_0x3935e6[_0x2072('0x42')][_0x2072('0x43')][_0x2072('0x44')]()][_0x2072('0x40')]());}});}return _0xbcff97;}function getConnection(_0x4f3ccd){var _0x2f78c4=_0x4f3ccd[_0x2072('0x45')]['concat'](_0x4f3ccd[_0x2072('0x46')]);var _0x176604=new jsforce[(_0x2072('0x47'))]({'oauth2':{'loginUrl':_0x4f3ccd['remoteUri']||'https://login.salesforce.com','clientId':_0x4f3ccd['clientId'],'clientSecret':_0x4f3ccd['clientSecret']}});return _0x176604[_0x2072('0x48')](_0x4f3ccd['username'],_0x2f78c4)[_0x2072('0x1d')](function(){logger[_0x2072('0x20')](_0x2072('0x49'));return _0x176604;});}exports[_0x2072('0x4a')]=function(_0x4a8322,_0x312d86,_0x196efd,_0x24140f,_0x1e591a,_0x342cb6){var _0x95f09e,_0x1a599a,_0x58281c,_0x3508ac;_0x342cb6[_0x2072('0x4b')]=intUtil['stripTrailingSlash'](_0x342cb6[_0x2072('0x4b')]);_0x342cb6[_0x2072('0x4c')]=intUtil[_0x2072('0x4d')](_0x342cb6[_0x2072('0x4c')]);if(_0x1e591a&&_0x1e591a['monitor_format']){logger[_0x2072('0x20')](_0x2072('0x4e'),_0x2072('0x4f'));_0x312d86[_0x2072('0x50')]=util[_0x2072('0x32')](_0x2072('0x51'),_0x342cb6[_0x2072('0x4b')],_0x312d86[_0x2072('0x52')],md5(_0x312d86[_0x2072('0x52')]));}else{_0x312d86['recordingURL']='';}return getConnection(_0x342cb6)[_0x2072('0x1d')](function(_0x5ee504){_0x3508ac=_0x5ee504;return getUser(_0x342cb6,_0x24140f[_0x2072('0x53')],_0x3508ac);})[_0x2072('0x1d')](function(_0x23345c){_0x95f09e=_0x23345c;return getEndUser(_0x342cb6,_0x196efd,_0x312d86['calleridname'],_0x312d86[_0x2072('0x54')],_0x3508ac);})[_0x2072('0x1d')](function(_0x23d7cb){_0x1a599a=_0x23d7cb;return getTicket(_0x342cb6,_0x95f09e,_0x1a599a,_0x196efd,_0x312d86,_0x196efd[_0x2072('0x55')],_0x3508ac,'queue');})[_0x2072('0x1d')](function(_0x1be811){_0x58281c=_0x1be811;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x58281c['id']);logger['info'](_0x2072('0x56'),_0x58281c['id'],_0x24140f[_0x2072('0x43')],_0x342cb6[_0x2072('0x3a')]);switch(_0x342cb6[_0x2072('0x3a')]){case'integrationTab':emit(util[_0x2072('0x32')](_0x2072('0x57'),_0x24140f['name']),_0x2072('0x58'),{'recordId':_0x58281c['id']});break;case _0x2072('0x59'):emit(util[_0x2072('0x32')]('user:%s',_0x24140f[_0x2072('0x43')]),_0x2072('0x5a'),{'uri':util[_0x2072('0x32')]('%s/%s/e',_0x3508ac[_0x2072('0x5b')],_0x58281c['id'])});break;default:logger[_0x2072('0x5c')](_0x2072('0x5d'));}})[_0x2072('0x5e')](function(_0x10bcbc){logger[_0x2072('0x5c')](_0x2072('0x4e'),JSON['stringify'](_0x10bcbc));});};exports[_0x2072('0x5f')]=function(_0x616601,_0x253036,_0x17afb6,_0x33aed4,_0x596120,_0x53f277,_0x49d3bb){var _0x2a82f5,_0x27ef11,_0x39b0dc,_0x27a104;_0x53f277[_0x2072('0x4b')]=intUtil[_0x2072('0x4d')](_0x53f277[_0x2072('0x4b')]);_0x53f277[_0x2072('0x4c')]=intUtil[_0x2072('0x4d')](_0x53f277[_0x2072('0x4c')]);if(_0x49d3bb&&_0x49d3bb['recordingFormat']&&_0x49d3bb[_0x2072('0x60')]!==_0x2072('0x61')){logger[_0x2072('0x20')]('[OUTBOUND]',_0x2072('0x4f'));_0x253036[_0x2072('0x50')]=util[_0x2072('0x32')](_0x2072('0x51'),_0x53f277[_0x2072('0x4b')],_0x253036[_0x2072('0x52')],md5(_0x253036[_0x2072('0x52')]));}return getConnection(_0x53f277)['then'](function(_0x5dd191){_0x27a104=_0x5dd191;return getUser(_0x53f277,_0x33aed4[_0x2072('0x53')],_0x27a104);})[_0x2072('0x1d')](function(_0x3ad0e3){_0x2a82f5=_0x3ad0e3;return getEndUser(_0x53f277,_0x17afb6,_0x253036[_0x2072('0x62')],_0x253036['destcalleridnum'],_0x27a104);})[_0x2072('0x1d')](function(_0xfb8596){_0x27ef11=_0xfb8596;return getTicket(_0x53f277,_0x2a82f5,_0x27ef11,_0x17afb6,_0x253036,_0x17afb6[_0x2072('0x55')],_0x27a104,_0x2072('0x5f'));})[_0x2072('0x1d')](function(_0x258881){_0x39b0dc=_0x258881;logger['info'](_0x2072('0x63'),_0x39b0dc['id']);logger[_0x2072('0x20')](_0x2072('0x64'),_0x39b0dc['id'],_0x33aed4[_0x2072('0x43')],_0x53f277['type']);switch(_0x53f277[_0x2072('0x3a')]){case _0x2072('0x65'):emit(util[_0x2072('0x32')](_0x2072('0x57'),_0x33aed4[_0x2072('0x43')]),_0x2072('0x58'),{'recordId':_0x39b0dc['id']});break;case _0x2072('0x59'):emit(util['format'](_0x2072('0x57'),_0x33aed4[_0x2072('0x43')]),_0x2072('0x5a'),{'uri':util[_0x2072('0x32')](_0x2072('0x66'),_0x27a104[_0x2072('0x5b')],_0x39b0dc['id'])});break;default:logger[_0x2072('0x5c')](_0x2072('0x67'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x148269){logger[_0x2072('0x5c')]('[OUTBOUND]',JSON[_0x2072('0x68')](_0x148269));});};exports[_0x2072('0x69')]=function(_0x9cba52,_0x56b865,_0x25d336,_0x205654,_0x6a540d,_0x36cb5a){var _0x262184,_0x3924ef,_0x51d931,_0xadc3aa;_0x36cb5a[_0x2072('0x4b')]=intUtil['stripTrailingSlash'](_0x36cb5a[_0x2072('0x4b')]);_0x36cb5a[_0x2072('0x4c')]=intUtil['stripTrailingSlash'](_0x36cb5a['remoteUri']);if(_0x6a540d&&_0x6a540d['monitor_format']){logger[_0x2072('0x20')]('['+_0x56b865['lastevent']['toUpperCase']()+']',_0x2072('0x4f'));_0x56b865['recordingURL']=util[_0x2072('0x32')](_0x2072('0x51'),_0x36cb5a[_0x2072('0x4b')],_0x56b865[_0x2072('0x52')],md5(_0x56b865[_0x2072('0x52')]));}else{_0x56b865[_0x2072('0x50')]='';}return getConnection(_0x36cb5a)[_0x2072('0x1d')](function(_0x41f3af){_0xadc3aa=_0x41f3af;if(!_['isNil'](_0x205654)){return getUser(_0x36cb5a,_0x205654[_0x2072('0x43')],_0xadc3aa);}else{return getUser(_0x36cb5a,null,_0xadc3aa);}})[_0x2072('0x1d')](function(_0x221a0c){_0x262184=_0x221a0c;return getEndUser(_0x36cb5a,_0x25d336,_0x56b865[_0x2072('0x6a')],_0x56b865['calleridnum'],_0xadc3aa);})[_0x2072('0x1d')](function(_0x52b8ad){_0x3924ef=_0x52b8ad;return getTicket(_0x36cb5a,_0x262184,_0x3924ef,_0x25d336,_0x56b865,_0x25d336[_0x2072('0x55')],_0xadc3aa);})['then'](function(_0x174bac){_0x51d931=_0x174bac;logger[_0x2072('0x20')]('['+_0x56b865[_0x2072('0x6b')][_0x2072('0x6c')]()+']\x20Ticket\x20%s\x20created.',_0x51d931['id']);logger[_0x2072('0x20')]('['+_0x56b865[_0x2072('0x6b')][_0x2072('0x6c')]()+_0x2072('0x6d'),_0x36cb5a[_0x2072('0x3a')]);})['catch'](function(_0x56ef9d){logger[_0x2072('0x5c')]('['+_0x56b865[_0x2072('0x6b')][_0x2072('0x6c')]()+']',JSON[_0x2072('0x68')](_0x56ef9d));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index fcf2399..fe9a74f 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 _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x365fe8,_0x5df6c8){var _0x59d121=function(_0x599557){while(--_0x599557){_0x365fe8['push'](_0x365fe8['shift']());}};_0x59d121(++_0x5df6c8);}(_0x326f,0xd1));var _0xf326=function(_0x1d4cea,_0x1cb158){_0x1d4cea=_0x1d4cea-0x0;var _0x41487d=_0x326f[_0x1d4cea];return _0x41487d;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0x526a3f,_0x148002){var _0x3a9587=function(_0x157028){while(--_0x157028){_0x526a3f['push'](_0x526a3f['shift']());}};_0x3a9587(++_0x148002);}(_0x2ef3,0xba));var _0x32ef=function(_0x39f12d,_0x2a0295){_0x39f12d=_0x39f12d-0x0;var _0x91e2a1=_0x2ef3[_0x39f12d];return _0x91e2a1;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 549b994..6d6dbbb 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 _0x2709=['sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','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','user:%s','catch','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','Outbound','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','lastevent','toUpperCase','recordingURL','isNil','calleridname','calleridnum','error','lodash','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_type','parent_name','name','direction','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','','Caller\x20-\x20%s','first_name','[HTTP]','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration'];(function(_0x398297,_0x388495){var _0x4c17af=function(_0x34d955){while(--_0x34d955){_0x398297['push'](_0x398297['shift']());}};_0x4c17af(++_0x388495);}(_0x2709,0x189));var _0x9270=function(_0x20e087,_0x29e797){_0x20e087=_0x20e087-0x0;var _0x5304bf=_0x2709[_0x20e087];return _0x5304bf;};'use strict';var _=require(_0x9270('0x0'));var rp=require('request-promise');var BPromise=require(_0x9270('0x1'));var md5=require(_0x9270('0x2'));var util=require('util');var Redis=require(_0x9270('0x3'));var intUtil=require('./util');var config=require(_0x9270('0x4'));var logger=require(_0x9270('0x5'))(_0x9270('0x6'));config[_0x9270('0x7')]=_[_0x9270('0x8')](config[_0x9270('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x9270('0x9'))(new Redis(config[_0x9270('0x7')]));var def={'method':_0x9270('0xa'),'json':!![]};function emit(_0x28e580,_0x4996ed,_0x2c33a9){io['to'](_0x28e580)[_0x9270('0xb')](_0x4996ed,_0x2c33a9);}function getTicket(_0xa28b35,_0xe68f8b,_0x623907,_0x78d773,_0x46ead1,_0x9a0421,_0x41a8a4,_0x3c6123){logger['info'](_0x9270('0xc'));var _0x403a95=new Date();var _0x25ac50=[{'name':'name','value':intUtil['getString'](_0x78d773[_0x9270('0xd')],_0x46ead1,'\x20')},{'name':_0x9270('0xe'),'value':_0xe68f8b['id']},{'name':_0x9270('0xf'),'value':_0xe68f8b['id']},{'name':'description','value':intUtil[_0x9270('0x10')](_0x78d773[_0x9270('0x11')],_0x46ead1,'\x0a')},{'name':_0x9270('0x12'),'value':_0x403a95[_0x9270('0x13')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x9270('0x14'),'value':'0'},{'name':_0x9270('0x15'),'value':'15'},{'name':'parent_id','value':_0x623907['id']},{'name':_0x9270('0x16'),'value':'Contacts'},{'name':_0x9270('0x17'),'value':_0x623907[_0x9270('0x18')]},{'name':_0x9270('0x19'),'value':_0x3c6123}];if(_0x9a0421['length']){_['forEach'](_0x9a0421,function(_0x3fdc6e){if(_0x46ead1[_0x3fdc6e[_0x9270('0x1a')]]){_0x25ac50[_0x9270('0x1b')]({'name':_0x3fdc6e['idField'],'value':_0x46ead1[_0x3fdc6e[_0x9270('0x1a')]]});}});}return request({'form':{'method':_0x9270('0x1c'),'input_type':_0x9270('0x1d'),'response_type':_0x9270('0x1d'),'rest_data':JSON[_0x9270('0x1e')]({'session':_0x41a8a4['id'],'module_name':_0x9270('0x1f'),'name_value_list':_0x25ac50})}});}function getAuth(_0x564865){return util[_0x9270('0x20')](_0x9270('0x21'),new Buffer(_0x564865[_0x9270('0x22')]+':X')[_0x9270('0x23')]('base64'));}function getServerInfo(_0xf01dbc){return request({'form':{'method':_0x9270('0x24'),'input_type':_0x9270('0x1d'),'response_type':_0x9270('0x1d'),'rest_data':JSON[_0x9270('0x1e')]({'session':_0xf01dbc['id']})}});}function getUser(_0x55ef1f,_0x24f5a1,_0x452ef9){if(!_['isNil'](_0x24f5a1)){logger[_0x9270('0x25')](_0x9270('0x26'),_0x24f5a1);return request({'form':{'method':_0x9270('0x27'),'input_type':_0x9270('0x1d'),'response_type':_0x9270('0x1d'),'rest_data':JSON[_0x9270('0x1e')]({'session':_0x452ef9['id'],'module_name':_0x9270('0x28'),'query':util[_0x9270('0x20')](_0x9270('0x29'),_0x24f5a1),'order_by':'','offset':'0','select_fields':['id',_0x9270('0x18'),_0x9270('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9270('0x2b')](function(_0x573e21){if(_0x573e21[_0x9270('0x2c')]['length']){var _0x4e5e15=_[_0x9270('0x2d')](_0x573e21[_0x9270('0x2c')],function(_0x4dba44){return _0x4dba44[_0x9270('0x2e')][_0x9270('0x2a')][_0x9270('0x2f')]===_0x24f5a1;});if(_0x4e5e15){logger[_0x9270('0x25')]('Agent\x20found!');return BPromise[_0x9270('0x30')]({'id':_0x4e5e15[_0x9270('0x2e')]['id']['value'],'name':_0x4e5e15[_0x9270('0x2e')][_0x9270('0x18')][_0x9270('0x2f')]});}}logger[_0x9270('0x25')](_0x9270('0x31'));return BPromise[_0x9270('0x30')]({'id':_0x452ef9['name_value_list'][_0x9270('0x32')]['value'],'name':_0x452ef9[_0x9270('0x2e')]['user_name']['value']});});}else{logger[_0x9270('0x25')](_0x9270('0x33'));return BPromise[_0x9270('0x30')]({'id':_0x452ef9[_0x9270('0x2e')][_0x9270('0x32')]['value'],'name':_0x452ef9[_0x9270('0x2e')]['user_name'][_0x9270('0x2f')]});}}function getEndUser(_0x287c2d,_0x3580ab,_0x193dd5,_0x55901a){logger['info']('Searching\x20enduser\x20with\x20phone',_0x193dd5);return request({'form':{'method':_0x9270('0x27'),'input_type':_0x9270('0x1d'),'response_type':_0x9270('0x1d'),'rest_data':JSON[_0x9270('0x1e')]({'session':_0x55901a['id'],'module_name':_0x9270('0x34'),'query':util[_0x9270('0x20')](_0x9270('0x35'),_0x193dd5),'order_by':'','offset':'0','select_fields':['id',_0x9270('0x18'),_0x9270('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xeb12d7){if(_0xeb12d7[_0x9270('0x2c')][_0x9270('0x37')]){var _0x495d0e=_[_0x9270('0x2d')](_0xeb12d7[_0x9270('0x2c')],function(_0x6c9ed9){return _0x6c9ed9['name_value_list']['phone_home'][_0x9270('0x2f')]===_0x193dd5;});if(_0x495d0e){logger[_0x9270('0x25')](_0x9270('0x38'));return BPromise[_0x9270('0x30')]({'id':_0x495d0e[_0x9270('0x2e')]['id'][_0x9270('0x2f')],'name':_0x495d0e[_0x9270('0x2e')][_0x9270('0x18')]['value'],'phone':_0x495d0e['name_value_list']['phone_home'][_0x9270('0x2f')]});}}else{logger[_0x9270('0x25')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x9270('0x1c'),'input_type':'JSON','response_type':_0x9270('0x1d'),'rest_data':JSON['stringify']({'session':_0x55901a['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x3580ab!==_0x9270('0x39')?_0x3580ab:util[_0x9270('0x20')](_0x9270('0x3a'),_0x193dd5)},{'name':_0x9270('0x36'),'value':_0x193dd5}]})}})['then'](function(_0x317e18){logger[_0x9270('0x25')]('Enduser\x20created.');return BPromise[_0x9270('0x30')]({'id':_0x317e18['id'],'name':_0x317e18[_0x9270('0x2c')][_0x9270('0x3b')][_0x9270('0x2f')],'phone':_0x317e18[_0x9270('0x2c')][_0x9270('0x36')][_0x9270('0x2f')]});});}});}function request(_0x2b45dc){logger['debug'](_0x9270('0x3c'),JSON['stringify'](_0x2b45dc));return rp(_['merge'](def,_0x2b45dc));}function getTags(_0x42d908,_0x2c3c07){var _0x53153d=[];if(_0x42d908&&_0x42d908[_0x9270('0x37')]>0x0){_0x53153d=_[_0x9270('0x3d')](_0x42d908,_0x2c3c07);}return _0x53153d;}function getCustomFields(_0x590acc,_0x406497){var _0x553daa=[];var _0x5821a9={'custom_fields':[]};if(_0x590acc['length']>0x0){_[_0x9270('0x3e')](_0x590acc,function(_0x2727b3){if(_0x2727b3[_0x9270('0x3f')]===_0x9270('0x40')&&_0x2727b3[_0x9270('0x41')]&&!_0x2727b3[_0x9270('0x42')]){_0x5821a9[_0x2727b3[_0x9270('0x41')][_0x9270('0x43')]()]=_0x2727b3[_0x9270('0x44')]['toString']();}else if(_0x2727b3[_0x9270('0x3f')]===_0x9270('0x40')&&_0x2727b3[_0x9270('0x45')]&&_0x2727b3['customField']){_0x5821a9[_0x9270('0x46')][_0x9270('0x1b')]({'id':_0x2727b3[_0x9270('0x45')],'value':_0x2727b3[_0x9270('0x44')]['toString']()});}else if(_0x2727b3[_0x9270('0x3f')]===_0x9270('0x47')&&_0x2727b3[_0x9270('0x1a')]&&_0x2727b3[_0x9270('0x45')]&&_0x2727b3[_0x9270('0x42')]){_0x406497[_0x2727b3['variableName']]&&_0x5821a9[_0x9270('0x46')]['push']({'id':_0x2727b3[_0x9270('0x45')],'value':_0x406497[_0x2727b3[_0x9270('0x1a')]][_0x9270('0x23')]()});}else if(_0x2727b3[_0x9270('0x3f')]===_0x9270('0x48')&&_0x2727b3['Variable']&&_0x2727b3[_0x9270('0x49')][_0x9270('0x18')]&&_0x2727b3[_0x9270('0x45')]&&_0x2727b3[_0x9270('0x42')]){_0x406497[_0x2727b3['Variable'][_0x9270('0x18')][_0x9270('0x43')]()]&&_0x5821a9[_0x9270('0x46')][_0x9270('0x1b')]({'id':_0x2727b3[_0x9270('0x45')],'value':_0x406497[_0x2727b3['Variable'][_0x9270('0x18')][_0x9270('0x43')]()][_0x9270('0x23')]()});}});}return _0x5821a9;}function getConnection(_0x4bfe48){return request({'method':_0x9270('0xa'),'form':{'method':_0x9270('0x4a'),'input_type':_0x9270('0x1d'),'response_type':'JSON','rest_data':JSON[_0x9270('0x1e')]({'user_auth':{'user_name':_0x4bfe48[_0x9270('0x4b')],'password':_0x4bfe48[_0x9270('0x4c')],'encryption':_0x9270('0x4d')},'application':_0x9270('0x4e')})}})[_0x9270('0x2b')](function(_0x13ddbe){var _0x67f9bd=_0x13ddbe;if(_0x67f9bd['id']){def[_0x9270('0x4f')]=_0x67f9bd['id'];return BPromise['resolve'](_0x67f9bd);}else{throw new Error(util[_0x9270('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x4bfe48['id']));}});}function setRelationship(_0x427bed,_0x4a4f13,_0x147a53,_0x3daf42){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9270('0x1e')]({'session':_0x427bed['id'],'module_name':_0x9270('0x1f'),'module_id':_0x147a53['id'],'link_field_name':_0x3daf42,'related_ids':[_0x4a4f13['id']]})}});}exports[_0x9270('0x50')]=function(_0x56211d,_0x563255,_0x4b0c12,_0x83042,_0x54db2e,_0x37018a){var _0x47e267,_0x46bfbc,_0x39dcb2,_0x4db673;_0x37018a[_0x9270('0x51')]=intUtil[_0x9270('0x52')](_0x37018a['remoteUri']);_0x37018a[_0x9270('0x53')]=intUtil['stripTrailingSlash'](_0x37018a[_0x9270('0x53')]);def[_0x9270('0x54')]=util[_0x9270('0x20')](_0x9270('0x55'),_0x37018a[_0x9270('0x51')]);if(_0x54db2e&&_0x54db2e[_0x9270('0x56')]){logger[_0x9270('0x25')]('[QUEUE]',_0x9270('0x57'));_0x563255['recordingURL']=util[_0x9270('0x20')](_0x9270('0x58'),_0x37018a[_0x9270('0x53')],_0x563255[_0x9270('0x59')],md5(_0x563255['uniqueid']));}else{_0x563255['recordingURL']='';}return getConnection(_0x37018a)['then'](function(_0x5efa79){_0x4db673=_0x5efa79;return getUser(_0x37018a,_0x83042[_0x9270('0x18')],_0x4db673);})[_0x9270('0x2b')](function(_0x4d9608){_0x47e267=_0x4d9608;logger['info']('The\x20User\x20ID\x20is:',_0x47e267['id']);return getEndUser(_0x37018a,_0x563255['calleridname'],_0x563255['calleridnum'],_0x4db673);})[_0x9270('0x2b')](function(_0x5325a8){_0x46bfbc=_0x5325a8;logger[_0x9270('0x25')](_0x9270('0x5a'),_0x46bfbc['id']);return getTicket(_0x37018a,_0x47e267,_0x46bfbc,_0x4b0c12,_0x563255,_0x4b0c12[_0x9270('0x5b')],_0x4db673,_0x9270('0x5c'));})[_0x9270('0x2b')](function(_0x60dc53){_0x39dcb2=_0x60dc53;logger['info'](_0x9270('0x5d'));logger[_0x9270('0x25')](_0x9270('0x5e'),_0x39dcb2['id']);return setRelationship(_0x4db673,_0x47e267,_0x39dcb2,_0x9270('0x5f'));})[_0x9270('0x2b')](function(){return setRelationship(_0x4db673,_0x46bfbc,_0x39dcb2,_0x9270('0x60'));})[_0x9270('0x2b')](function(){return getServerInfo(_0x4db673);})['then'](function(_0x3c74ed){var _0x34acd6=parseInt(_0x3c74ed[_0x9270('0x61')][_0x9270('0x62')](0x0));var _0x21c2aa=util['format'](_0x9270('0x63'),_0x37018a[_0x9270('0x51')],_0x39dcb2['id']);if(_0x34acd6>0x6){_0x21c2aa=util[_0x9270('0x20')](_0x9270('0x64'),_0x37018a['remoteUri'],_0x39dcb2['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9270('0x20')](_0x9270('0x65'),_0x83042[_0x9270('0x18')]),'trigger:browser:url',{'uri':_0x21c2aa});})[_0x9270('0x66')](function(_0x4a1e38){logger['error']('[QUEUE]',JSON['stringify'](_0x4a1e38));});};exports['outbound']=function(_0x4699b0,_0x2402f4,_0x5cbfd2,_0x5f2108,_0x44932d,_0x18f9a8,_0x1488d5){var _0x4ede5b,_0x58c532,_0x2b1e0c,_0x5cfe83;_0x18f9a8[_0x9270('0x51')]=intUtil[_0x9270('0x52')](_0x18f9a8[_0x9270('0x51')]);_0x18f9a8[_0x9270('0x53')]=intUtil[_0x9270('0x52')](_0x18f9a8['serverUrl']);def[_0x9270('0x54')]=util[_0x9270('0x20')]('%s/service/v4_1/rest.php',_0x18f9a8[_0x9270('0x51')]);if(_0x1488d5&&_0x1488d5['recordingFormat']&&_0x1488d5[_0x9270('0x67')]!==_0x9270('0x68')){logger['info']('[OUTBOUND]',_0x9270('0x57'));_0x2402f4['recordingURL']=util[_0x9270('0x20')](_0x9270('0x58'),_0x18f9a8[_0x9270('0x53')],_0x2402f4['uniqueid'],md5(_0x2402f4['uniqueid']));}return getConnection(_0x18f9a8)['then'](function(_0x135e93){_0x5cfe83=_0x135e93;return getUser(_0x18f9a8,_0x5f2108[_0x9270('0x18')],_0x5cfe83);})[_0x9270('0x2b')](function(_0x4481aa){_0x4ede5b=_0x4481aa;logger['info'](_0x9270('0x69'),_0x4ede5b['id']);return getEndUser(_0x18f9a8,_0x2402f4[_0x9270('0x6a')],_0x2402f4['destcalleridnum'],_0x5cfe83);})['then'](function(_0x41806c){_0x58c532=_0x41806c;logger[_0x9270('0x25')](_0x9270('0x5a'),_0x58c532['id']);return getTicket(_0x18f9a8,_0x4ede5b,_0x58c532,_0x5cbfd2,_0x2402f4,_0x5cbfd2[_0x9270('0x5b')],_0x5cfe83,_0x9270('0x6b'));})[_0x9270('0x2b')](function(_0x5d824f){_0x2b1e0c=_0x5d824f;logger['info']('Ticket\x20created!');logger[_0x9270('0x25')]('The\x20Ticket\x20ID\x20is:',_0x2b1e0c['id']);return setRelationship(_0x5cfe83,_0x4ede5b,_0x2b1e0c,'users');})[_0x9270('0x2b')](function(){return setRelationship(_0x5cfe83,_0x58c532,_0x2b1e0c,_0x9270('0x60'));})[_0x9270('0x2b')](function(){return getServerInfo(_0x5cfe83);})['then'](function(_0x460de9){var _0x5a5cc8=parseInt(_0x460de9[_0x9270('0x61')][_0x9270('0x62')](0x0));var _0x5c4e89=util['format'](_0x9270('0x63'),_0x18f9a8[_0x9270('0x51')],_0x2b1e0c['id']);if(_0x5a5cc8>0x6){_0x5c4e89=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x18f9a8['remoteUri'],_0x2b1e0c['id']);}logger['info'](_0x9270('0x6c'),_0x9270('0x6d'));emit(util['format'](_0x9270('0x65'),_0x5f2108[_0x9270('0x18')]),_0x9270('0x6e'),{'uri':_0x5c4e89});})['catch'](function(_0x4afb28){logger['error'](_0x9270('0x6c'),JSON[_0x9270('0x1e')](_0x4afb28));});};exports['unmanaged']=function(_0x3f831e,_0x486294,_0x3752c3,_0x3e2492,_0x18df2f,_0x5282f8){var _0x544828,_0x3ed384,_0x20f104,_0x4f542b;_0x5282f8[_0x9270('0x51')]=intUtil[_0x9270('0x52')](_0x5282f8['remoteUri']);_0x5282f8[_0x9270('0x53')]=intUtil[_0x9270('0x52')](_0x5282f8[_0x9270('0x53')]);def['uri']=util[_0x9270('0x20')](_0x9270('0x55'),_0x5282f8[_0x9270('0x51')]);if(_0x18df2f&&_0x18df2f[_0x9270('0x56')]){logger[_0x9270('0x25')]('['+_0x486294[_0x9270('0x6f')][_0x9270('0x70')]()+']',_0x9270('0x57'));_0x486294['recordingURL']=util[_0x9270('0x20')](_0x9270('0x58'),_0x5282f8[_0x9270('0x53')],_0x486294[_0x9270('0x59')],md5(_0x486294[_0x9270('0x59')]));}else{_0x486294[_0x9270('0x71')]='';}return getConnection(_0x5282f8)['then'](function(_0x34febb){_0x4f542b=_0x34febb;if(!_[_0x9270('0x72')](_0x3e2492)){return getUser(_0x5282f8,_0x3e2492[_0x9270('0x18')],_0x4f542b);}else{return getUser(_0x5282f8,null,_0x4f542b);}})[_0x9270('0x2b')](function(_0x307c7c){_0x544828=_0x307c7c;logger['info']('The\x20User\x20ID\x20is:',_0x544828['id']);return getEndUser(_0x5282f8,_0x486294[_0x9270('0x73')],_0x486294[_0x9270('0x74')],_0x4f542b);})[_0x9270('0x2b')](function(_0x3e6a99){_0x3ed384=_0x3e6a99;logger[_0x9270('0x25')](_0x9270('0x5a'),_0x3ed384['id']);return getTicket(_0x5282f8,_0x544828,_0x3ed384,_0x3752c3,_0x486294,_0x3752c3[_0x9270('0x5b')],_0x4f542b,_0x9270('0x5c'));})['then'](function(_0x32368a){_0x20f104=_0x32368a;logger[_0x9270('0x25')](_0x9270('0x5d'));logger['info'](_0x9270('0x5e'),_0x20f104['id']);return setRelationship(_0x4f542b,_0x544828,_0x20f104,_0x9270('0x5f'));})[_0x9270('0x2b')](function(){return setRelationship(_0x4f542b,_0x3ed384,_0x20f104,_0x9270('0x60'));})[_0x9270('0x2b')](function(){return getServerInfo(_0x4f542b);})[_0x9270('0x66')](function(_0x54d626){logger[_0x9270('0x75')]('['+_0x486294[_0x9270('0x6f')][_0x9270('0x70')]()+']',JSON['stringify'](_0x54d626));});}; \ No newline at end of file +var _0xa613=['none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','users','contacts','trigger:browser:url','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridname','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','toISOString','duration_hours','parent_id','Contacts','parent_name','direction','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','info','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','type','string','nameField','content','custom_fields','push','variable','Variable','customField','toLowerCase','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound'];(function(_0x340e23,_0x283003){var _0x34575b=function(_0x4ee0e9){while(--_0x4ee0e9){_0x340e23['push'](_0x340e23['shift']());}};_0x34575b(++_0x283003);}(_0xa613,0x8a));var _0x3a61=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0xa613[_0x4f5108];return _0x2d56ca;};'use strict';var _=require(_0x3a61('0x0'));var rp=require('request-promise');var BPromise=require(_0x3a61('0x1'));var md5=require(_0x3a61('0x2'));var util=require(_0x3a61('0x3'));var Redis=require(_0x3a61('0x4'));var intUtil=require(_0x3a61('0x5'));var config=require(_0x3a61('0x6'));var logger=require(_0x3a61('0x7'))(_0x3a61('0x8'));config[_0x3a61('0x9')]=_[_0x3a61('0xa')](config['redis'],{'host':_0x3a61('0xb'),'port':0x18eb});var io=require(_0x3a61('0xc'))(new Redis(config['redis']));var def={'method':_0x3a61('0xd'),'json':!![]};function emit(_0x255a69,_0x3c7bdd,_0x3040dd){io['to'](_0x255a69)[_0x3a61('0xe')](_0x3c7bdd,_0x3040dd);}function getTicket(_0x538238,_0x2ad63f,_0x357242,_0x5b0db1,_0x57be09,_0x56fbbc,_0x1c84c1,_0x3ab150){logger['info'](_0x3a61('0xf'));var _0x1a9226=new Date();var _0x425896=[{'name':_0x3a61('0x10'),'value':intUtil[_0x3a61('0x11')](_0x5b0db1[_0x3a61('0x12')],_0x57be09,'\x20')},{'name':'assigned_user_id','value':_0x2ad63f['id']},{'name':'created_by','value':_0x2ad63f['id']},{'name':_0x3a61('0x13'),'value':intUtil[_0x3a61('0x11')](_0x5b0db1[_0x3a61('0x14')],_0x57be09,'\x0a')},{'name':_0x3a61('0x15'),'value':_0x1a9226[_0x3a61('0x16')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x3a61('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x3a61('0x18'),'value':_0x357242['id']},{'name':'parent_type','value':_0x3a61('0x19')},{'name':_0x3a61('0x1a'),'value':_0x357242['name']},{'name':_0x3a61('0x1b'),'value':_0x3ab150}];if(_0x56fbbc['length']){_[_0x3a61('0x1c')](_0x56fbbc,function(_0x57e816){if(_0x57be09[_0x57e816[_0x3a61('0x1d')]]){_0x425896['push']({'name':_0x57e816[_0x3a61('0x1e')],'value':_0x57be09[_0x57e816[_0x3a61('0x1d')]]});}});}return request({'form':{'method':_0x3a61('0x1f'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'session':_0x1c84c1['id'],'module_name':_0x3a61('0x22'),'name_value_list':_0x425896})}});}function getAuth(_0x2186c7){return util[_0x3a61('0x23')](_0x3a61('0x24'),new Buffer(_0x2186c7[_0x3a61('0x25')]+':X')[_0x3a61('0x26')](_0x3a61('0x27')));}function getServerInfo(_0x188aaa){return request({'form':{'method':_0x3a61('0x28'),'input_type':'JSON','response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'session':_0x188aaa['id']})}});}function getUser(_0x4582e2,_0x1d649a,_0x5aaf73){if(!_[_0x3a61('0x29')](_0x1d649a)){logger['info'](_0x3a61('0x2a'),_0x1d649a);return request({'form':{'method':_0x3a61('0x2b'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'session':_0x5aaf73['id'],'module_name':_0x3a61('0x2c'),'query':util[_0x3a61('0x23')](_0x3a61('0x2d'),_0x1d649a),'order_by':'','offset':'0','select_fields':['id',_0x3a61('0x10'),_0x3a61('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3a61('0x2f')](function(_0x44b88b){if(_0x44b88b[_0x3a61('0x30')][_0x3a61('0x31')]){var _0x1baeb5=_[_0x3a61('0x32')](_0x44b88b[_0x3a61('0x30')],function(_0x13e7c1){return _0x13e7c1[_0x3a61('0x33')][_0x3a61('0x2e')]['value']===_0x1d649a;});if(_0x1baeb5){logger[_0x3a61('0x34')](_0x3a61('0x35'));return BPromise[_0x3a61('0x36')]({'id':_0x1baeb5[_0x3a61('0x33')]['id'][_0x3a61('0x37')],'name':_0x1baeb5[_0x3a61('0x33')][_0x3a61('0x10')][_0x3a61('0x37')]});}}logger[_0x3a61('0x34')](_0x3a61('0x38'));return BPromise[_0x3a61('0x36')]({'id':_0x5aaf73[_0x3a61('0x33')]['user_id'][_0x3a61('0x37')],'name':_0x5aaf73[_0x3a61('0x33')][_0x3a61('0x2e')][_0x3a61('0x37')]});});}else{logger[_0x3a61('0x34')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3a61('0x36')]({'id':_0x5aaf73['name_value_list'][_0x3a61('0x39')][_0x3a61('0x37')],'name':_0x5aaf73[_0x3a61('0x33')][_0x3a61('0x2e')][_0x3a61('0x37')]});}}function getEndUser(_0x4de980,_0x194428,_0x5988f4,_0x6322a5){logger[_0x3a61('0x34')]('Searching\x20enduser\x20with\x20phone',_0x5988f4);return request({'form':{'method':_0x3a61('0x2b'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON['stringify']({'session':_0x6322a5['id'],'module_name':_0x3a61('0x19'),'query':util[_0x3a61('0x23')](_0x3a61('0x3a'),_0x5988f4),'order_by':'','offset':'0','select_fields':['id',_0x3a61('0x10'),_0x3a61('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3a61('0x2f')](function(_0x10ea03){if(_0x10ea03[_0x3a61('0x30')][_0x3a61('0x31')]){var _0x2a126f=_[_0x3a61('0x32')](_0x10ea03['entry_list'],function(_0x18950a){return _0x18950a[_0x3a61('0x33')]['phone_home'][_0x3a61('0x37')]===_0x5988f4;});if(_0x2a126f){logger['info'](_0x3a61('0x3c'));return BPromise[_0x3a61('0x36')]({'id':_0x2a126f[_0x3a61('0x33')]['id'][_0x3a61('0x37')],'name':_0x2a126f[_0x3a61('0x33')][_0x3a61('0x10')][_0x3a61('0x37')],'phone':_0x2a126f[_0x3a61('0x33')][_0x3a61('0x3b')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x3a61('0x1f'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'session':_0x6322a5['id'],'module_name':_0x3a61('0x19'),'name_value_list':[{'name':'first_name','value':_0x194428!==_0x3a61('0x3d')?_0x194428:util[_0x3a61('0x23')](_0x3a61('0x3e'),_0x5988f4)},{'name':_0x3a61('0x3b'),'value':_0x5988f4}]})}})[_0x3a61('0x2f')](function(_0xa97ebe){logger[_0x3a61('0x34')](_0x3a61('0x3f'));return BPromise[_0x3a61('0x36')]({'id':_0xa97ebe['id'],'name':_0xa97ebe['entry_list'][_0x3a61('0x40')]['value'],'phone':_0xa97ebe[_0x3a61('0x30')]['phone_home'][_0x3a61('0x37')]});});}});}function request(_0xb0419c){logger[_0x3a61('0x41')](_0x3a61('0x42'),JSON[_0x3a61('0x21')](_0xb0419c));return rp(_[_0x3a61('0x43')](def,_0xb0419c));}function getTags(_0x290e82,_0x587304){var _0x36c0dc=[];if(_0x290e82&&_0x290e82[_0x3a61('0x31')]>0x0){_0x36c0dc=_['map'](_0x290e82,_0x587304);}return _0x36c0dc;}function getCustomFields(_0x371485,_0x482f5f){var _0x125d8e=[];var _0x4c29cf={'custom_fields':[]};if(_0x371485[_0x3a61('0x31')]>0x0){_[_0x3a61('0x1c')](_0x371485,function(_0x22056b){if(_0x22056b[_0x3a61('0x44')]===_0x3a61('0x45')&&_0x22056b['nameField']&&!_0x22056b['customField']){_0x4c29cf[_0x22056b[_0x3a61('0x46')]['toLowerCase']()]=_0x22056b[_0x3a61('0x47')][_0x3a61('0x26')]();}else if(_0x22056b[_0x3a61('0x44')]===_0x3a61('0x45')&&_0x22056b[_0x3a61('0x1e')]&&_0x22056b['customField']){_0x4c29cf[_0x3a61('0x48')][_0x3a61('0x49')]({'id':_0x22056b[_0x3a61('0x1e')],'value':_0x22056b[_0x3a61('0x47')][_0x3a61('0x26')]()});}else if(_0x22056b[_0x3a61('0x44')]===_0x3a61('0x4a')&&_0x22056b[_0x3a61('0x1d')]&&_0x22056b[_0x3a61('0x1e')]&&_0x22056b['customField']){_0x482f5f[_0x22056b[_0x3a61('0x1d')]]&&_0x4c29cf[_0x3a61('0x48')][_0x3a61('0x49')]({'id':_0x22056b['idField'],'value':_0x482f5f[_0x22056b['variableName']]['toString']()});}else if(_0x22056b['type']==='customVariable'&&_0x22056b[_0x3a61('0x4b')]&&_0x22056b[_0x3a61('0x4b')][_0x3a61('0x10')]&&_0x22056b[_0x3a61('0x1e')]&&_0x22056b[_0x3a61('0x4c')]){_0x482f5f[_0x22056b[_0x3a61('0x4b')][_0x3a61('0x10')][_0x3a61('0x4d')]()]&&_0x4c29cf['custom_fields'][_0x3a61('0x49')]({'id':_0x22056b[_0x3a61('0x1e')],'value':_0x482f5f[_0x22056b[_0x3a61('0x4b')][_0x3a61('0x10')][_0x3a61('0x4d')]()]['toString']()});}});}return _0x4c29cf;}function getConnection(_0x9247bf){return request({'method':'POST','form':{'method':_0x3a61('0x4e'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'user_auth':{'user_name':_0x9247bf[_0x3a61('0x4f')],'password':_0x9247bf[_0x3a61('0x50')],'encryption':_0x3a61('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x3a61('0x2f')](function(_0x187655){var _0x5bca42=_0x187655;if(_0x5bca42['id']){def[_0x3a61('0x52')]=_0x5bca42['id'];return BPromise[_0x3a61('0x36')](_0x5bca42);}else{throw new Error(util['format'](_0x3a61('0x53'),_0x9247bf['id']));}});}function setRelationship(_0x33d515,_0x1b0a73,_0x3c7fb2,_0x290407){return request({'form':{'method':_0x3a61('0x54'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON['stringify']({'session':_0x33d515['id'],'module_name':_0x3a61('0x22'),'module_id':_0x3c7fb2['id'],'link_field_name':_0x290407,'related_ids':[_0x1b0a73['id']]})}});}exports[_0x3a61('0x55')]=function(_0x59da8a,_0x5e573e,_0xde02c6,_0x3b7ee3,_0x19b4b0,_0x599806){var _0x15cf6e,_0x4d0b73,_0x513913,_0x516c7c;_0x599806[_0x3a61('0x56')]=intUtil[_0x3a61('0x57')](_0x599806[_0x3a61('0x56')]);_0x599806[_0x3a61('0x58')]=intUtil['stripTrailingSlash'](_0x599806['serverUrl']);def[_0x3a61('0x59')]=util[_0x3a61('0x23')](_0x3a61('0x5a'),_0x599806[_0x3a61('0x56')]);if(_0x19b4b0&&_0x19b4b0[_0x3a61('0x5b')]){logger[_0x3a61('0x34')](_0x3a61('0x5c'),'Recording\x20is\x20enabled!');_0x5e573e[_0x3a61('0x5d')]=util[_0x3a61('0x23')](_0x3a61('0x5e'),_0x599806[_0x3a61('0x58')],_0x5e573e[_0x3a61('0x5f')],md5(_0x5e573e[_0x3a61('0x5f')]));}else{_0x5e573e['recordingURL']='';}return getConnection(_0x599806)[_0x3a61('0x2f')](function(_0x21ad1a){_0x516c7c=_0x21ad1a;return getUser(_0x599806,_0x3b7ee3['name'],_0x516c7c);})[_0x3a61('0x2f')](function(_0x521c22){_0x15cf6e=_0x521c22;logger[_0x3a61('0x34')](_0x3a61('0x60'),_0x15cf6e['id']);return getEndUser(_0x599806,_0x5e573e['calleridname'],_0x5e573e[_0x3a61('0x61')],_0x516c7c);})[_0x3a61('0x2f')](function(_0x29877b){_0x4d0b73=_0x29877b;logger['info'](_0x3a61('0x62'),_0x4d0b73['id']);return getTicket(_0x599806,_0x15cf6e,_0x4d0b73,_0xde02c6,_0x5e573e,_0xde02c6['Fields'],_0x516c7c,_0x3a61('0x63'));})['then'](function(_0x26f23e){_0x513913=_0x26f23e;logger[_0x3a61('0x34')]('Ticket\x20created!');logger[_0x3a61('0x34')](_0x3a61('0x64'),_0x513913['id']);return setRelationship(_0x516c7c,_0x15cf6e,_0x513913,'users');})[_0x3a61('0x2f')](function(){return setRelationship(_0x516c7c,_0x4d0b73,_0x513913,'contacts');})[_0x3a61('0x2f')](function(){return getServerInfo(_0x516c7c);})[_0x3a61('0x2f')](function(_0x3c94f6){var _0x131a3e=parseInt(_0x3c94f6[_0x3a61('0x65')][_0x3a61('0x66')](0x0));var _0xbb0986=util[_0x3a61('0x23')](_0x3a61('0x67'),_0x599806[_0x3a61('0x56')],_0x513913['id']);if(_0x131a3e>0x6){_0xbb0986=util[_0x3a61('0x23')](_0x3a61('0x68'),_0x599806['remoteUri'],_0x513913['id']);}logger['info'](_0x3a61('0x5c'),_0x3a61('0x69'));emit(util['format'](_0x3a61('0x6a'),_0x3b7ee3['name']),'trigger:browser:url',{'uri':_0xbb0986});})[_0x3a61('0x6b')](function(_0x1e056b){logger[_0x3a61('0x6c')](_0x3a61('0x5c'),JSON[_0x3a61('0x21')](_0x1e056b));});};exports[_0x3a61('0x6d')]=function(_0x40daa9,_0x55cea4,_0x3582f2,_0x164039,_0x4440ce,_0x2815a6,_0x2d3ec7){var _0x5435e8,_0x323ecb,_0x8eb2ee,_0x5c4b2e;_0x2815a6['remoteUri']=intUtil[_0x3a61('0x57')](_0x2815a6['remoteUri']);_0x2815a6[_0x3a61('0x58')]=intUtil['stripTrailingSlash'](_0x2815a6[_0x3a61('0x58')]);def[_0x3a61('0x59')]=util[_0x3a61('0x23')]('%s/service/v4_1/rest.php',_0x2815a6[_0x3a61('0x56')]);if(_0x2d3ec7&&_0x2d3ec7['recordingFormat']&&_0x2d3ec7['recordingFormat']!==_0x3a61('0x6e')){logger['info'](_0x3a61('0x6f'),'Recording\x20is\x20enabled!');_0x55cea4[_0x3a61('0x5d')]=util[_0x3a61('0x23')](_0x3a61('0x5e'),_0x2815a6[_0x3a61('0x58')],_0x55cea4[_0x3a61('0x5f')],md5(_0x55cea4[_0x3a61('0x5f')]));}return getConnection(_0x2815a6)['then'](function(_0x2abc23){_0x5c4b2e=_0x2abc23;return getUser(_0x2815a6,_0x164039['name'],_0x5c4b2e);})[_0x3a61('0x2f')](function(_0x150ff0){_0x5435e8=_0x150ff0;logger['info'](_0x3a61('0x60'),_0x5435e8['id']);return getEndUser(_0x2815a6,_0x55cea4[_0x3a61('0x70')],_0x55cea4[_0x3a61('0x71')],_0x5c4b2e);})[_0x3a61('0x2f')](function(_0x55dc15){_0x323ecb=_0x55dc15;logger[_0x3a61('0x34')]('The\x20Enduser\x20ID\x20is:',_0x323ecb['id']);return getTicket(_0x2815a6,_0x5435e8,_0x323ecb,_0x3582f2,_0x55cea4,_0x3582f2['Fields'],_0x5c4b2e,_0x3a61('0x72'));})[_0x3a61('0x2f')](function(_0x14aabd){_0x8eb2ee=_0x14aabd;logger[_0x3a61('0x34')](_0x3a61('0x73'));logger[_0x3a61('0x34')](_0x3a61('0x64'),_0x8eb2ee['id']);return setRelationship(_0x5c4b2e,_0x5435e8,_0x8eb2ee,_0x3a61('0x74'));})[_0x3a61('0x2f')](function(){return setRelationship(_0x5c4b2e,_0x323ecb,_0x8eb2ee,_0x3a61('0x75'));})[_0x3a61('0x2f')](function(){return getServerInfo(_0x5c4b2e);})[_0x3a61('0x2f')](function(_0x4a58fe){var _0x342a9d=parseInt(_0x4a58fe[_0x3a61('0x65')][_0x3a61('0x66')](0x0));var _0x28175a=util['format'](_0x3a61('0x67'),_0x2815a6['remoteUri'],_0x8eb2ee['id']);if(_0x342a9d>0x6){_0x28175a=util[_0x3a61('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2815a6[_0x3a61('0x56')],_0x8eb2ee['id']);}logger[_0x3a61('0x34')]('[OUTBOUND]',_0x3a61('0x69'));emit(util[_0x3a61('0x23')]('user:%s',_0x164039[_0x3a61('0x10')]),_0x3a61('0x76'),{'uri':_0x28175a});})[_0x3a61('0x6b')](function(_0x1bf4cf){logger[_0x3a61('0x6c')](_0x3a61('0x6f'),JSON[_0x3a61('0x21')](_0x1bf4cf));});};exports[_0x3a61('0x77')]=function(_0x67adde,_0x2f3564,_0x18309b,_0x4f69f0,_0x4f8b35,_0x2a7aec){var _0x57e15f,_0x4edb35,_0x850075,_0x5d9a95;_0x2a7aec['remoteUri']=intUtil[_0x3a61('0x57')](_0x2a7aec[_0x3a61('0x56')]);_0x2a7aec[_0x3a61('0x58')]=intUtil[_0x3a61('0x57')](_0x2a7aec[_0x3a61('0x58')]);def['uri']=util[_0x3a61('0x23')]('%s/service/v4_1/rest.php',_0x2a7aec[_0x3a61('0x56')]);if(_0x4f8b35&&_0x4f8b35[_0x3a61('0x5b')]){logger[_0x3a61('0x34')]('['+_0x2f3564[_0x3a61('0x78')][_0x3a61('0x79')]()+']',_0x3a61('0x7a'));_0x2f3564['recordingURL']=util[_0x3a61('0x23')](_0x3a61('0x5e'),_0x2a7aec['serverUrl'],_0x2f3564[_0x3a61('0x5f')],md5(_0x2f3564[_0x3a61('0x5f')]));}else{_0x2f3564[_0x3a61('0x5d')]='';}return getConnection(_0x2a7aec)[_0x3a61('0x2f')](function(_0x4e1857){_0x5d9a95=_0x4e1857;if(!_[_0x3a61('0x29')](_0x4f69f0)){return getUser(_0x2a7aec,_0x4f69f0[_0x3a61('0x10')],_0x5d9a95);}else{return getUser(_0x2a7aec,null,_0x5d9a95);}})[_0x3a61('0x2f')](function(_0x7632ba){_0x57e15f=_0x7632ba;logger[_0x3a61('0x34')](_0x3a61('0x60'),_0x57e15f['id']);return getEndUser(_0x2a7aec,_0x2f3564[_0x3a61('0x7b')],_0x2f3564[_0x3a61('0x61')],_0x5d9a95);})[_0x3a61('0x2f')](function(_0xd2804){_0x4edb35=_0xd2804;logger[_0x3a61('0x34')](_0x3a61('0x62'),_0x4edb35['id']);return getTicket(_0x2a7aec,_0x57e15f,_0x4edb35,_0x18309b,_0x2f3564,_0x18309b['Fields'],_0x5d9a95,'Inbound');})[_0x3a61('0x2f')](function(_0x3d8f93){_0x850075=_0x3d8f93;logger['info']('Ticket\x20created!');logger[_0x3a61('0x34')](_0x3a61('0x64'),_0x850075['id']);return setRelationship(_0x5d9a95,_0x57e15f,_0x850075,'users');})['then'](function(){return setRelationship(_0x5d9a95,_0x4edb35,_0x850075,'contacts');})[_0x3a61('0x2f')](function(){return getServerInfo(_0x5d9a95);})[_0x3a61('0x6b')](function(_0x508921){logger['error']('['+_0x2f3564[_0x3a61('0x78')][_0x3a61('0x79')]()+']',JSON[_0x3a61('0x21')](_0x508921));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 09edd4f..d5b89de 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 _0x3109=['substring','lastIndexOf','isNil','test','util','length','sortBy','type','string','push','variable','variableName','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0x3109,0xea));var _0x9310=function(_0x3e633c,_0x277796){_0x3e633c=_0x3e633c-0x0;var _0x5b1f21=_0x3109[_0x3e633c];return _0x5b1f21;};'use strict';var _=require('lodash');var util=require(_0x9310('0x0'));exports['getString']=function(_0x288bea,_0x2d14fd,_0x50087e){var _0x392f78=[];if(_0x288bea[_0x9310('0x1')]>0x0){var _0x36e485=_[_0x9310('0x2')](_0x288bea,['id']);for(var _0x49ab3e=0x0;_0x49ab3e<_0x36e485[_0x9310('0x1')];_0x49ab3e++){var _0x5e8c8e=_0x36e485[_0x49ab3e];if(_0x5e8c8e[_0x9310('0x3')]===_0x9310('0x4')){_0x392f78[_0x9310('0x5')](_0x5e8c8e['content']);}else if(_0x5e8c8e[_0x9310('0x3')]===_0x9310('0x6')&&_0x5e8c8e[_0x9310('0x7')]){_0x2d14fd[_0x5e8c8e[_0x9310('0x7')]]&&_0x392f78[_0x9310('0x5')](_0x2d14fd[_0x5e8c8e[_0x9310('0x7')]]['toString']());}else if(_0x5e8c8e[_0x9310('0x3')]===_0x9310('0x8')&&_0x5e8c8e[_0x9310('0x9')]&&_0x5e8c8e[_0x9310('0x9')]['name']){_0x2d14fd[_0x5e8c8e['Variable'][_0x9310('0xa')]['toLowerCase']()]&&_0x392f78[_0x9310('0x5')](_0x2d14fd[_0x5e8c8e['Variable'][_0x9310('0xa')][_0x9310('0xb')]()]['toString']());}else if(_0x5e8c8e[_0x9310('0x3')]==='keyValue'){if(_0x5e8c8e[_0x9310('0xc')]===_0x9310('0x4')&&_0x5e8c8e[_0x9310('0xd')]){_0x392f78[_0x9310('0x5')](util[_0x9310('0xe')](_0x9310('0xf'),_0x5e8c8e[_0x9310('0xd')],_0x5e8c8e[_0x9310('0x10')]));}else if(_0x5e8c8e['keyType']===_0x9310('0x6')&&_0x5e8c8e[_0x9310('0x7')]&&_0x5e8c8e[_0x9310('0xd')]){_0x2d14fd[_0x5e8c8e[_0x9310('0x7')]]&&_0x392f78[_0x9310('0x5')](util[_0x9310('0xe')](_0x9310('0xf'),_0x5e8c8e[_0x9310('0xd')],_0x2d14fd[_0x5e8c8e[_0x9310('0x7')]]));}else if(_0x5e8c8e[_0x9310('0xc')]===_0x9310('0x8')&&_0x5e8c8e['Variable']&&_0x5e8c8e['Variable']['name']&&_0x5e8c8e[_0x9310('0xd')]){_0x2d14fd[_0x5e8c8e[_0x9310('0x9')][_0x9310('0xa')][_0x9310('0xb')]()]&&_0x392f78[_0x9310('0x5')](util[_0x9310('0xe')](_0x9310('0xf'),_0x5e8c8e[_0x9310('0xd')],_0x2d14fd[_0x5e8c8e[_0x9310('0x9')]['name'][_0x9310('0xb')]()]));}}}}return _0x392f78['join'](_0x50087e);};exports[_0x9310('0x11')]=function(_0xfa2a10){var _0x3efe2a=_0xfa2a10[_0x9310('0x12')](-0x1);if(_0x3efe2a==='/'){_0xfa2a10=_0xfa2a10[_0x9310('0x13')](0x0,_0xfa2a10[_0x9310('0x14')](_0x3efe2a));}return _0xfa2a10;};exports['validateEmail']=function(_0x4eb8d0){if(!_[_0x9310('0x15')](_0x4eb8d0)&&_0x4eb8d0!==''){var _0x576c39=/^(([^<>()\[\]\\.,;:\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 _0x576c39[_0x9310('0x16')](String(_0x4eb8d0)[_0x9310('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x022b=['keyContent','format','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','type','string','variable','variableName','push','Variable','name','toLowerCase','keyType','key','%s:\x20%s'];(function(_0x579b79,_0x5b57b2){var _0x41e899=function(_0x2c8b7){while(--_0x2c8b7){_0x579b79['push'](_0x579b79['shift']());}};_0x41e899(++_0x5b57b2);}(_0x022b,0x1bd));var _0xb022=function(_0xf2cc3c,_0x49518d){_0xf2cc3c=_0xf2cc3c-0x0;var _0x4cdbdd=_0x022b[_0xf2cc3c];return _0x4cdbdd;};'use strict';var _=require(_0xb022('0x0'));var util=require(_0xb022('0x1'));exports[_0xb022('0x2')]=function(_0x309639,_0x1ca766,_0x3a29eb){var _0x6a321f=[];if(_0x309639[_0xb022('0x3')]>0x0){var _0x620407=_['sortBy'](_0x309639,['id']);for(var _0x7634b2=0x0;_0x7634b2<_0x620407[_0xb022('0x3')];_0x7634b2++){var _0x4fbf4c=_0x620407[_0x7634b2];if(_0x4fbf4c[_0xb022('0x4')]===_0xb022('0x5')){_0x6a321f['push'](_0x4fbf4c['content']);}else if(_0x4fbf4c[_0xb022('0x4')]===_0xb022('0x6')&&_0x4fbf4c['variableName']){_0x1ca766[_0x4fbf4c[_0xb022('0x7')]]&&_0x6a321f[_0xb022('0x8')](_0x1ca766[_0x4fbf4c['variableName']]['toString']());}else if(_0x4fbf4c[_0xb022('0x4')]==='customVariable'&&_0x4fbf4c[_0xb022('0x9')]&&_0x4fbf4c['Variable'][_0xb022('0xa')]){_0x1ca766[_0x4fbf4c[_0xb022('0x9')]['name']['toLowerCase']()]&&_0x6a321f[_0xb022('0x8')](_0x1ca766[_0x4fbf4c['Variable'][_0xb022('0xa')][_0xb022('0xb')]()]['toString']());}else if(_0x4fbf4c[_0xb022('0x4')]==='keyValue'){if(_0x4fbf4c[_0xb022('0xc')]===_0xb022('0x5')&&_0x4fbf4c[_0xb022('0xd')]){_0x6a321f[_0xb022('0x8')](util['format'](_0xb022('0xe'),_0x4fbf4c[_0xb022('0xd')],_0x4fbf4c[_0xb022('0xf')]));}else if(_0x4fbf4c[_0xb022('0xc')]==='variable'&&_0x4fbf4c[_0xb022('0x7')]&&_0x4fbf4c[_0xb022('0xd')]){_0x1ca766[_0x4fbf4c[_0xb022('0x7')]]&&_0x6a321f[_0xb022('0x8')](util[_0xb022('0x10')](_0xb022('0xe'),_0x4fbf4c['key'],_0x1ca766[_0x4fbf4c[_0xb022('0x7')]]));}else if(_0x4fbf4c[_0xb022('0xc')]==='customVariable'&&_0x4fbf4c[_0xb022('0x9')]&&_0x4fbf4c[_0xb022('0x9')][_0xb022('0xa')]&&_0x4fbf4c[_0xb022('0xd')]){_0x1ca766[_0x4fbf4c[_0xb022('0x9')][_0xb022('0xa')][_0xb022('0xb')]()]&&_0x6a321f['push'](util[_0xb022('0x10')]('%s:\x20%s',_0x4fbf4c[_0xb022('0xd')],_0x1ca766[_0x4fbf4c[_0xb022('0x9')][_0xb022('0xa')][_0xb022('0xb')]()]));}}}}return _0x6a321f['join'](_0x3a29eb);};exports[_0xb022('0x11')]=function(_0x2adab9){var _0x29b63b=_0x2adab9[_0xb022('0x12')](-0x1);if(_0x29b63b==='/'){_0x2adab9=_0x2adab9[_0xb022('0x13')](0x0,_0x2adab9[_0xb022('0x14')](_0x29b63b));}return _0x2adab9;};exports[_0xb022('0x15')]=function(_0x1eaf93){if(!_[_0xb022('0x16')](_0x1eaf93)&&_0x1eaf93!==''){var _0x1c250a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x1c250a['test'](String(_0x1eaf93)[_0xb022('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index f589130..a45db4a 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 _0x16db=['statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','catch','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','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','outbound','stripTrailingSlash','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','calleridname','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','content','toString','variable','idField','variableName','name','Variable','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','Descriptions','POST','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x16db,0xa7));var _0xb16d=function(_0x5887c8,_0x4b2ac9){_0x5887c8=_0x5887c8-0x0;var _0x2f9bef=_0x16db[_0x5887c8];return _0x2f9bef;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0xb16d('0x0'));var md5=require(_0xb16d('0x1'));var util=require(_0xb16d('0x2'));var Redis=require(_0xb16d('0x3'));var intUtil=require(_0xb16d('0x4'));var config=require(_0xb16d('0x5'));var logger=require(_0xb16d('0x6'))(_0xb16d('0x7'));config[_0xb16d('0x8')]=_[_0xb16d('0x9')](config[_0xb16d('0x8')],{'host':_0xb16d('0xa'),'port':0x18eb});var io=require(_0xb16d('0xb'))(new Redis(config['redis']));function emit(_0x36a94d,_0x4f4ead,_0x2ac0c3){io['to'](_0x36a94d)[_0xb16d('0xc')](_0x4f4ead,_0x2ac0c3);}function getCustomFields(_0x3f7b92,_0x1fb402){var _0x40bc56={};if(_0x3f7b92[_0xb16d('0xd')]>0x0){_[_0xb16d('0xe')](_0x3f7b92,function(_0xbcb30a){if(_0xbcb30a[_0xb16d('0xf')]==='string'&&_0xbcb30a['idField']){_0x40bc56[_0xbcb30a['idField']]=_0xbcb30a[_0xb16d('0x10')][_0xb16d('0x11')]();}else if(_0xbcb30a['type']===_0xb16d('0x12')&&_0xbcb30a['variableName']&&_0xbcb30a[_0xb16d('0x13')]&&_0x1fb402[_0xbcb30a[_0xb16d('0x14')]]){_0x40bc56[_0xbcb30a[_0xb16d('0x13')]]=_0x1fb402[_0xbcb30a[_0xb16d('0x14')]][_0xb16d('0x11')]();}else if(_0xbcb30a[_0xb16d('0xf')]==='customVariable'&&_0xbcb30a['Variable']&&_0xbcb30a['Variable'][_0xb16d('0x15')]&&_0xbcb30a['idField']&&_0x1fb402[_0xbcb30a[_0xb16d('0x16')]['name'][_0xb16d('0x17')]()]){_0x40bc56[_0xbcb30a[_0xb16d('0x13')]]=_0x1fb402[_0xbcb30a[_0xb16d('0x16')][_0xb16d('0x15')]['toLowerCase']()][_0xb16d('0x11')]();}});}return _0x40bc56;}function createTicket(_0xc8acbd,_0x18b357,_0x210448,_0x443b4f,_0x373b40,_0x71bed9,_0xd2bc0d){logger[_0xb16d('0x18')](_0xb16d('0x19'));var _0x470011=_[_0xb16d('0x1a')]({'parent_id':'','assigned_user_id':_0x18b357['id'],'ticketpriorities':_0xb16d('0x1b'),'ticketstatus':'Open','ticket_title':intUtil[_0xb16d('0x1c')](_0x443b4f[_0xb16d('0x1d')],_0x373b40,'\x20'),'description':intUtil['getString'](_0x443b4f[_0xb16d('0x1e')],_0x373b40,'\x0a'),'contact_id':_0x210448['id']},getCustomFields(_0x71bed9,_0x373b40));var _0x23354e={'method':_0xb16d('0x1f'),'uri':util['format'](_0xb16d('0x20'),_0xc8acbd['remoteUri']),'form':{'operation':_0xb16d('0x21'),'username':_0xc8acbd[_0xb16d('0x22')],'sessionName':_0xd2bc0d[_0xb16d('0x23')],'elementType':_0xb16d('0x24'),'element':JSON[_0xb16d('0x25')](_0x470011)},'json':!![]};return request(_0x23354e)[_0xb16d('0x26')](function(_0x4f46d3){if(_0x4f46d3[_0xb16d('0x27')]){return BPromise[_0xb16d('0x28')]({'id':_0x4f46d3[_0xb16d('0x29')]['id']});}else{throw new Error(util[_0xb16d('0x2a')](_0xb16d('0x2b'),JSON[_0xb16d('0x25')](_0x4f46d3[_0xb16d('0x2c')])));}})['catch'](function(_0xdc8119){var _0xb1a0ad=_0xdc8119[_0xb16d('0x2d')]||0x1f4;logger[_0xb16d('0x2c')](_0xb16d('0x2e'),_0xb16d('0x2f'),_0xb1a0ad,JSON[_0xb16d('0x25')](_0xdc8119));});}function getUser(_0x2278e8,_0x1dfe0a,_0x44d9bf){if(intUtil['validateEmail'](_0x1dfe0a)){logger[_0xb16d('0x18')](_0xb16d('0x30'),_0x1dfe0a);return request({'method':_0xb16d('0x31'),'uri':util[_0xb16d('0x2a')](_0xb16d('0x20'),_0x2278e8[_0xb16d('0x32')]),'qs':{'operation':_0xb16d('0x33'),'username':_0x2278e8[_0xb16d('0x22')],'sessionName':_0x44d9bf['sessionName'],'query':util[_0xb16d('0x2a')](_0xb16d('0x34'),_0x1dfe0a)},'json':!![]})[_0xb16d('0x26')](function(_0x486546){if(_0x486546[_0xb16d('0x27')]&&_0x486546['result'][_0xb16d('0xd')]){logger[_0xb16d('0x18')](_0xb16d('0x35'));return BPromise[_0xb16d('0x28')]({'id':_0x486546[_0xb16d('0x29')][0x0]['id'],'email':_0x486546[_0xb16d('0x29')][0x0]['email1'],'name':_0x486546[_0xb16d('0x29')][0x0]['first_name']+'\x20'+_0x486546[_0xb16d('0x29')][_0xb16d('0x36')]});}else{logger['info'](_0xb16d('0x37'));return BPromise['resolve']({'id':_0x44d9bf[_0xb16d('0x38')],'email':_0x2278e8[_0xb16d('0x22')],'name':_0xb16d('0x39')});}})['catch'](function(_0x16782d){var _0x26ad4c=_0x16782d['statusCode']||0x1f4;logger[_0xb16d('0x2c')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xb16d('0x3a'),_0x26ad4c,JSON['stringify'](_0x16782d));});}else{logger[_0xb16d('0x18')](_0xb16d('0x37'));return BPromise['resolve']({'id':_0x44d9bf['userId'],'email':_0x2278e8[_0xb16d('0x22')],'name':_0xb16d('0x39')})[_0xb16d('0x3b')](function(_0xa63d11){var _0x4deb46=_0xa63d11[_0xb16d('0x2d')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x4deb46,JSON[_0xb16d('0x25')](_0xa63d11));});}}function getEndUser(_0x52e02f,_0x15acce,_0x19bc05,_0x333c71){logger[_0xb16d('0x18')]('Searching\x20end\x20user\x20with\x20phone',_0x19bc05);return request({'method':'GET','uri':util[_0xb16d('0x2a')](_0xb16d('0x20'),_0x52e02f[_0xb16d('0x32')]),'qs':{'operation':'query','username':_0x52e02f[_0xb16d('0x22')],'sessionName':_0x333c71[_0xb16d('0x23')],'query':util['format'](_0xb16d('0x3c'),_0x19bc05,_0x19bc05,_0x19bc05,_0x19bc05,_0x19bc05)},'json':!![]})['then'](function(_0x364b33){if(_0x364b33[_0xb16d('0x27')]&&_0x364b33['result']['length']){logger[_0xb16d('0x18')](_0xb16d('0x3d'));return BPromise[_0xb16d('0x28')]({'id':_0x364b33['result'][0x0]['id'],'name':_0x364b33[_0xb16d('0x29')][0x0][_0xb16d('0x3e')]+'\x20'+_0x364b33[_0xb16d('0x29')][0x0][_0xb16d('0x3f')],'phone':_0x19bc05});}else{logger[_0xb16d('0x18')](_0xb16d('0x40'));return request({'method':_0xb16d('0x1f'),'uri':util['format'](_0xb16d('0x20'),_0x52e02f[_0xb16d('0x32')]),'form':{'operation':'create','sessionName':_0x333c71[_0xb16d('0x23')],'elementType':_0xb16d('0x41'),'element':JSON[_0xb16d('0x25')]({'lastname':_0x15acce,'phone':_0x19bc05,'assigned_user_id':'\x20'})},'json':!![]})[_0xb16d('0x26')](function(_0x339742){logger['info'](_0xb16d('0x42'));return BPromise[_0xb16d('0x28')]({'id':_0x339742[_0xb16d('0x29')]['id'],'name':_0x339742[_0xb16d('0x29')][_0xb16d('0x3f')],'phone':_0x339742[_0xb16d('0x29')][_0xb16d('0x43')]});})[_0xb16d('0x3b')](function(_0x13d3ec){var _0xec0e12=_0x13d3ec[_0xb16d('0x2d')]||0x1f4;logger[_0xb16d('0x2c')](_0xb16d('0x2e'),_0xb16d('0x44'),_0xec0e12,JSON[_0xb16d('0x25')](_0x13d3ec));});}});}function getConnection(_0x158ce4){var _0x15f327=_0x158ce4[_0xb16d('0x22')];var _0x536fef=_0x158ce4[_0xb16d('0x45')];return request({'method':_0xb16d('0x31'),'uri':util[_0xb16d('0x2a')](_0xb16d('0x20'),_0x158ce4[_0xb16d('0x32')]),'qs':{'operation':_0xb16d('0x46'),'username':_0x15f327},'json':!![]})[_0xb16d('0x26')](function(_0x760187){if(_0x760187[_0xb16d('0x27')]){return request({'method':_0xb16d('0x1f'),'uri':util['format']('%s/webservice.php',_0x158ce4[_0xb16d('0x32')]),'form':{'operation':_0xb16d('0x47'),'username':_0x15f327,'accessKey':md5(_0x760187[_0xb16d('0x29')][_0xb16d('0x48')]+_0x536fef)},'json':!![]});}})[_0xb16d('0x26')](function(_0x1418a1){if(_0x1418a1[_0xb16d('0x27')]){return BPromise[_0xb16d('0x28')](_0x1418a1[_0xb16d('0x29')]);}else{throw new Error(util[_0xb16d('0x2a')](_0xb16d('0x49'),_0x158ce4['id']));}})['catch'](function(_0x5e357c){var _0x5ea673=_0x5e357c[_0xb16d('0x2d')]||0x1f4;logger['error'](_0xb16d('0x2e'),_0xb16d('0x4a'),_0x5ea673,JSON[_0xb16d('0x25')](_0x5e357c));});}function request(_0x2feaea){logger[_0xb16d('0x18')](_0xb16d('0x4b'),JSON[_0xb16d('0x25')](_0x2feaea));return rp(_0x2feaea);}exports['queue']=function(_0x6b0dc7,_0x5d6148,_0x4f94f5,_0x2b353a,_0x3eb54c,_0x396488){var _0x4aeaff,_0x373218,_0x31b7a4,_0x3793e2;_0x396488[_0xb16d('0x32')]=intUtil['stripTrailingSlash'](_0x396488['remoteUri']);if(_0x3eb54c&&_0x3eb54c[_0xb16d('0x4c')]){logger[_0xb16d('0x18')](_0xb16d('0x4d'),_0xb16d('0x4e'));_0x5d6148['recordingURL']=util[_0xb16d('0x2a')](_0xb16d('0x4f'),_0x396488['serverUrl'],_0x5d6148[_0xb16d('0x50')],md5(_0x5d6148[_0xb16d('0x50')]));}else{_0x5d6148[_0xb16d('0x51')]='';}return getConnection(_0x396488)[_0xb16d('0x26')](function(_0x1124d1){_0x3793e2=_0x1124d1;return getUser(_0x396488,_0x2b353a[_0xb16d('0x52')],_0x3793e2);})[_0xb16d('0x26')](function(_0x3f69e0){_0x4aeaff=_0x3f69e0;logger[_0xb16d('0x18')](_0xb16d('0x53'),_0x4aeaff['id']);return getEndUser(_0x396488,_0x5d6148['calleridname'],_0x5d6148[_0xb16d('0x54')],_0x3793e2);})['then'](function(_0x28e7f3){_0x373218=_0x28e7f3;logger[_0xb16d('0x18')](_0xb16d('0x55'),_0x373218['id']);return createTicket(_0x396488,_0x4aeaff,_0x373218,_0x4f94f5,_0x5d6148,_0x4f94f5[_0xb16d('0x56')],_0x3793e2);})[_0xb16d('0x26')](function(_0x4ef0bf){_0x31b7a4=_0x4ef0bf;logger[_0xb16d('0x18')](_0xb16d('0x57'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x31b7a4['id']);var _0x4419f3=util[_0xb16d('0x2a')](_0xb16d('0x58'),_0x396488['remoteUri'],_[_0xb16d('0x59')](_0x31b7a4['id'],'x')[0x1]);logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb16d('0x2a')](_0xb16d('0x5a'),_0x2b353a['name']),_0xb16d('0x5b'),{'uri':_0x4419f3});})['catch'](function(_0x459d1a){logger[_0xb16d('0x2c')](_0xb16d('0x4d'),JSON['stringify'](_0x459d1a));});};exports[_0xb16d('0x5c')]=function(_0x1053b8,_0x173f88,_0x172ae1,_0x2a5571,_0x19b966,_0x3eb4d1,_0x36cdcc){var _0x12379c,_0x4031d3,_0x5c6edd,_0x4ed9d4;_0x3eb4d1[_0xb16d('0x32')]=intUtil[_0xb16d('0x5d')](_0x3eb4d1[_0xb16d('0x32')]);_0x3eb4d1[_0xb16d('0x5e')]=intUtil[_0xb16d('0x5d')](_0x3eb4d1['serverUrl']);if(_0x36cdcc&&_0x36cdcc['recordingFormat']&&_0x36cdcc[_0xb16d('0x5f')]!==_0xb16d('0x60')){logger[_0xb16d('0x18')](_0xb16d('0x61'),_0xb16d('0x4e'));_0x173f88[_0xb16d('0x51')]=util[_0xb16d('0x2a')](_0xb16d('0x4f'),_0x3eb4d1['serverUrl'],_0x173f88[_0xb16d('0x50')],md5(_0x173f88[_0xb16d('0x50')]));}return getConnection(_0x3eb4d1)[_0xb16d('0x26')](function(_0xd7f204){_0x4ed9d4=_0xd7f204;return getUser(_0x3eb4d1,_0x2a5571[_0xb16d('0x52')],_0x4ed9d4);})['then'](function(_0x4278a9){_0x12379c=_0x4278a9;logger[_0xb16d('0x18')]('The\x20User\x20ID\x20is:',_0x12379c['id']);return getEndUser(_0x3eb4d1,_0x173f88[_0xb16d('0x62')],_0x173f88[_0xb16d('0x63')],_0x4ed9d4);})[_0xb16d('0x26')](function(_0x2441cd){_0x4031d3=_0x2441cd;logger[_0xb16d('0x18')](_0xb16d('0x55'),_0x4031d3['id']);return createTicket(_0x3eb4d1,_0x12379c,_0x4031d3,_0x172ae1,_0x173f88,_0x172ae1['Fields'],_0x4ed9d4);})[_0xb16d('0x26')](function(_0x523304){_0x5c6edd=_0x523304;logger[_0xb16d('0x18')](_0xb16d('0x57'));logger[_0xb16d('0x18')](_0xb16d('0x64'),_0x5c6edd['id']);var _0x34b2c8=util[_0xb16d('0x2a')](_0xb16d('0x58'),_0x3eb4d1[_0xb16d('0x32')],_['split'](_0x5c6edd['id'],'x')[0x1]);logger[_0xb16d('0x18')](_0xb16d('0x61'),_0xb16d('0x65'));emit(util[_0xb16d('0x2a')](_0xb16d('0x5a'),_0x2a5571[_0xb16d('0x15')]),_0xb16d('0x5b'),{'uri':_0x34b2c8});})['catch'](function(_0x547301){logger['error'](_0xb16d('0x61'),JSON[_0xb16d('0x25')](_0x547301));});};exports[_0xb16d('0x66')]=function(_0x4ad3d4,_0x12de1f,_0x608c36,_0x3ed621,_0x386e7c,_0x57d1e8){var _0x1c1316,_0x3d0ac8,_0x40a0cb,_0x22e223;_0x57d1e8[_0xb16d('0x32')]=intUtil['stripTrailingSlash'](_0x57d1e8[_0xb16d('0x32')]);_0x57d1e8['serverUrl']=intUtil[_0xb16d('0x5d')](_0x57d1e8['serverUrl']);if(_0x386e7c&&_0x386e7c['monitor_format']){logger[_0xb16d('0x18')]('['+_0x12de1f['lastevent'][_0xb16d('0x67')]()+']',_0xb16d('0x4e'));_0x12de1f['recordingURL']=util[_0xb16d('0x2a')](_0xb16d('0x4f'),_0x57d1e8[_0xb16d('0x5e')],_0x12de1f[_0xb16d('0x50')],md5(_0x12de1f['uniqueid']));}else{_0x12de1f[_0xb16d('0x51')]='';}return getConnection(_0x57d1e8)[_0xb16d('0x26')](function(_0x52221a){_0x22e223=_0x52221a;return getUser(_0x57d1e8,'',_0x22e223);})[_0xb16d('0x26')](function(_0x301a7a){_0x1c1316=_0x301a7a;logger[_0xb16d('0x18')]('The\x20User\x20ID\x20is:',_0x1c1316['id']);return getEndUser(_0x57d1e8,_0x12de1f[_0xb16d('0x68')],_0x12de1f['calleridnum'],_0x22e223);})[_0xb16d('0x26')](function(_0x589a78){_0x3d0ac8=_0x589a78;logger[_0xb16d('0x18')](_0xb16d('0x55'),_0x3d0ac8['id']);return createTicket(_0x57d1e8,_0x1c1316,_0x3d0ac8,_0x608c36,_0x12de1f,_0x608c36[_0xb16d('0x56')],_0x22e223);})[_0xb16d('0x26')](function(_0x44d44e){_0x40a0cb=_0x44d44e;logger['info'](_0xb16d('0x57'));logger[_0xb16d('0x18')](_0xb16d('0x64'),_0x40a0cb['id']);})[_0xb16d('0x3b')](function(_0xb42ef1){logger[_0xb16d('0x2c')]('['+_0x12de1f[_0xb16d('0x69')][_0xb16d('0x67')]()+']',JSON[_0xb16d('0x25')](_0xb42ef1));});}; \ No newline at end of file +var _0xc4b8=['info','Creating\x20new\x20ticket...','getString','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','createTicket','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','catch','getUser','[vTiger],\x20%s,\x20%s,\x20%s','Searching\x20end\x20user\x20with\x20phone','then','Enduser\x20found!','firstname','Contacts','Enduser\x20created.','lastname','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','recordingFormat','none','destcalleridname','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','monitor_format','lastevent','toUpperCase','bluebird','md5','util','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4b8,0x1d8));var _0x8c4b=function(_0x36f908,_0x4d7c36){_0x36f908=_0x36f908-0x0;var _0x42cec1=_0xc4b8[_0x36f908];return _0x42cec1;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x8c4b('0x0'));var md5=require(_0x8c4b('0x1'));var util=require(_0x8c4b('0x2'));var Redis=require(_0x8c4b('0x3'));var intUtil=require(_0x8c4b('0x4'));var config=require(_0x8c4b('0x5'));var logger=require('../../../../config/logger')(_0x8c4b('0x6'));config[_0x8c4b('0x7')]=_[_0x8c4b('0x8')](config[_0x8c4b('0x7')],{'host':_0x8c4b('0x9'),'port':0x18eb});var io=require(_0x8c4b('0xa'))(new Redis(config[_0x8c4b('0x7')]));function emit(_0x1e8c12,_0x155385,_0x178416){io['to'](_0x1e8c12)[_0x8c4b('0xb')](_0x155385,_0x178416);}function getCustomFields(_0x282ede,_0x5c9724){var _0x3cbb7d={};if(_0x282ede[_0x8c4b('0xc')]>0x0){_[_0x8c4b('0xd')](_0x282ede,function(_0xf30053){if(_0xf30053[_0x8c4b('0xe')]==='string'&&_0xf30053[_0x8c4b('0xf')]){_0x3cbb7d[_0xf30053[_0x8c4b('0xf')]]=_0xf30053[_0x8c4b('0x10')][_0x8c4b('0x11')]();}else if(_0xf30053[_0x8c4b('0xe')]==='variable'&&_0xf30053[_0x8c4b('0x12')]&&_0xf30053[_0x8c4b('0xf')]&&_0x5c9724[_0xf30053[_0x8c4b('0x12')]]){_0x3cbb7d[_0xf30053['idField']]=_0x5c9724[_0xf30053[_0x8c4b('0x12')]][_0x8c4b('0x11')]();}else if(_0xf30053['type']===_0x8c4b('0x13')&&_0xf30053[_0x8c4b('0x14')]&&_0xf30053[_0x8c4b('0x14')][_0x8c4b('0x15')]&&_0xf30053[_0x8c4b('0xf')]&&_0x5c9724[_0xf30053[_0x8c4b('0x14')][_0x8c4b('0x15')][_0x8c4b('0x16')]()]){_0x3cbb7d[_0xf30053['idField']]=_0x5c9724[_0xf30053[_0x8c4b('0x14')]['name']['toLowerCase']()][_0x8c4b('0x11')]();}});}return _0x3cbb7d;}function createTicket(_0x403c18,_0x27293c,_0x11efe6,_0x331587,_0x5bd056,_0x2ab05c,_0x1ebdc6){logger[_0x8c4b('0x17')](_0x8c4b('0x18'));var _0x306b1e=_['merge']({'parent_id':'','assigned_user_id':_0x27293c['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0x8c4b('0x19')](_0x331587[_0x8c4b('0x1a')],_0x5bd056,'\x20'),'description':intUtil['getString'](_0x331587['Descriptions'],_0x5bd056,'\x0a'),'contact_id':_0x11efe6['id']},getCustomFields(_0x2ab05c,_0x5bd056));var _0x2d9ec9={'method':_0x8c4b('0x1b'),'uri':util[_0x8c4b('0x1c')](_0x8c4b('0x1d'),_0x403c18[_0x8c4b('0x1e')]),'form':{'operation':_0x8c4b('0x1f'),'username':_0x403c18[_0x8c4b('0x20')],'sessionName':_0x1ebdc6[_0x8c4b('0x21')],'elementType':_0x8c4b('0x22'),'element':JSON[_0x8c4b('0x23')](_0x306b1e)},'json':!![]};return request(_0x2d9ec9)['then'](function(_0x58e836){if(_0x58e836[_0x8c4b('0x24')]){return BPromise[_0x8c4b('0x25')]({'id':_0x58e836[_0x8c4b('0x26')]['id']});}else{throw new Error(util[_0x8c4b('0x1c')](_0x8c4b('0x27'),JSON['stringify'](_0x58e836[_0x8c4b('0x28')])));}})['catch'](function(_0xbb48e8){var _0x4dd445=_0xbb48e8[_0x8c4b('0x29')]||0x1f4;logger[_0x8c4b('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x8c4b('0x2a'),_0x4dd445,JSON['stringify'](_0xbb48e8));});}function getUser(_0x3ae961,_0x43cf41,_0x18bf8e){if(intUtil['validateEmail'](_0x43cf41)){logger[_0x8c4b('0x17')](_0x8c4b('0x2b'),_0x43cf41);return request({'method':_0x8c4b('0x2c'),'uri':util[_0x8c4b('0x1c')]('%s/webservice.php',_0x3ae961[_0x8c4b('0x1e')]),'qs':{'operation':_0x8c4b('0x2d'),'username':_0x3ae961[_0x8c4b('0x20')],'sessionName':_0x18bf8e['sessionName'],'query':util[_0x8c4b('0x1c')](_0x8c4b('0x2e'),_0x43cf41)},'json':!![]})['then'](function(_0x555ea4){if(_0x555ea4['success']&&_0x555ea4['result'][_0x8c4b('0xc')]){logger[_0x8c4b('0x17')]('Agent\x20found!');return BPromise[_0x8c4b('0x25')]({'id':_0x555ea4[_0x8c4b('0x26')][0x0]['id'],'email':_0x555ea4['result'][0x0][_0x8c4b('0x2f')],'name':_0x555ea4['result'][0x0][_0x8c4b('0x30')]+'\x20'+_0x555ea4[_0x8c4b('0x26')][_0x8c4b('0x31')]});}else{logger[_0x8c4b('0x17')](_0x8c4b('0x32'));return BPromise[_0x8c4b('0x25')]({'id':_0x18bf8e[_0x8c4b('0x33')],'email':_0x3ae961['username'],'name':_0x8c4b('0x34')});}})[_0x8c4b('0x35')](function(_0x571a76){var _0x2d466d=_0x571a76[_0x8c4b('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x8c4b('0x36'),_0x2d466d,JSON[_0x8c4b('0x23')](_0x571a76));});}else{logger['info'](_0x8c4b('0x32'));return BPromise['resolve']({'id':_0x18bf8e[_0x8c4b('0x33')],'email':_0x3ae961[_0x8c4b('0x20')],'name':_0x8c4b('0x34')})['catch'](function(_0x16064f){var _0xc9b402=_0x16064f[_0x8c4b('0x29')]||0x1f4;logger[_0x8c4b('0x28')](_0x8c4b('0x37'),_0x8c4b('0x36'),_0xc9b402,JSON[_0x8c4b('0x23')](_0x16064f));});}}function getEndUser(_0x45c8d1,_0x4a1066,_0x4a1f07,_0x405598){logger[_0x8c4b('0x17')](_0x8c4b('0x38'),_0x4a1f07);return request({'method':_0x8c4b('0x2c'),'uri':util['format'](_0x8c4b('0x1d'),_0x45c8d1['remoteUri']),'qs':{'operation':_0x8c4b('0x2d'),'username':_0x45c8d1[_0x8c4b('0x20')],'sessionName':_0x405598[_0x8c4b('0x21')],'query':util[_0x8c4b('0x1c')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x4a1f07,_0x4a1f07,_0x4a1f07,_0x4a1f07,_0x4a1f07)},'json':!![]})[_0x8c4b('0x39')](function(_0x360d8e){if(_0x360d8e[_0x8c4b('0x24')]&&_0x360d8e[_0x8c4b('0x26')][_0x8c4b('0xc')]){logger[_0x8c4b('0x17')](_0x8c4b('0x3a'));return BPromise[_0x8c4b('0x25')]({'id':_0x360d8e[_0x8c4b('0x26')][0x0]['id'],'name':_0x360d8e['result'][0x0][_0x8c4b('0x3b')]+'\x20'+_0x360d8e['result'][0x0]['lastname'],'phone':_0x4a1f07});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x8c4b('0x1b'),'uri':util[_0x8c4b('0x1c')](_0x8c4b('0x1d'),_0x45c8d1['remoteUri']),'form':{'operation':_0x8c4b('0x1f'),'sessionName':_0x405598['sessionName'],'elementType':_0x8c4b('0x3c'),'element':JSON['stringify']({'lastname':_0x4a1066,'phone':_0x4a1f07,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x8ac26){logger[_0x8c4b('0x17')](_0x8c4b('0x3d'));return BPromise[_0x8c4b('0x25')]({'id':_0x8ac26[_0x8c4b('0x26')]['id'],'name':_0x8ac26[_0x8c4b('0x26')][_0x8c4b('0x3e')],'phone':_0x8ac26[_0x8c4b('0x26')][_0x8c4b('0x3f')]});})[_0x8c4b('0x35')](function(_0x1fce92){var _0x3648b0=_0x1fce92[_0x8c4b('0x29')]||0x1f4;logger[_0x8c4b('0x28')](_0x8c4b('0x37'),_0x8c4b('0x40'),_0x3648b0,JSON[_0x8c4b('0x23')](_0x1fce92));});}});}function getConnection(_0xd77c54){var _0x432377=_0xd77c54['username'];var _0x301160=_0xd77c54[_0x8c4b('0x41')];return request({'method':_0x8c4b('0x2c'),'uri':util[_0x8c4b('0x1c')](_0x8c4b('0x1d'),_0xd77c54[_0x8c4b('0x1e')]),'qs':{'operation':_0x8c4b('0x42'),'username':_0x432377},'json':!![]})[_0x8c4b('0x39')](function(_0x188032){if(_0x188032[_0x8c4b('0x24')]){return request({'method':_0x8c4b('0x1b'),'uri':util[_0x8c4b('0x1c')](_0x8c4b('0x1d'),_0xd77c54[_0x8c4b('0x1e')]),'form':{'operation':_0x8c4b('0x43'),'username':_0x432377,'accessKey':md5(_0x188032[_0x8c4b('0x26')][_0x8c4b('0x44')]+_0x301160)},'json':!![]});}})[_0x8c4b('0x39')](function(_0x10ee4e){if(_0x10ee4e[_0x8c4b('0x24')]){return BPromise['resolve'](_0x10ee4e[_0x8c4b('0x26')]);}else{throw new Error(util[_0x8c4b('0x1c')](_0x8c4b('0x45'),_0xd77c54['id']));}})[_0x8c4b('0x35')](function(_0x3559a0){var _0x1c9ee5=_0x3559a0[_0x8c4b('0x29')]||0x1f4;logger[_0x8c4b('0x28')](_0x8c4b('0x37'),_0x8c4b('0x46'),_0x1c9ee5,JSON['stringify'](_0x3559a0));});}function request(_0x7abc66){logger[_0x8c4b('0x17')](_0x8c4b('0x47'),JSON[_0x8c4b('0x23')](_0x7abc66));return rp(_0x7abc66);}exports[_0x8c4b('0x48')]=function(_0x5b75e7,_0x21b54f,_0xd3cbe0,_0x766e53,_0x2c82ad,_0xb3df62){var _0x326403,_0x13edbe,_0x225c69,_0x2d3e7c;_0xb3df62[_0x8c4b('0x1e')]=intUtil['stripTrailingSlash'](_0xb3df62[_0x8c4b('0x1e')]);if(_0x2c82ad&&_0x2c82ad['monitor_format']){logger[_0x8c4b('0x17')]('[QUEUE]',_0x8c4b('0x49'));_0x21b54f[_0x8c4b('0x4a')]=util[_0x8c4b('0x1c')](_0x8c4b('0x4b'),_0xb3df62['serverUrl'],_0x21b54f[_0x8c4b('0x4c')],md5(_0x21b54f[_0x8c4b('0x4c')]));}else{_0x21b54f[_0x8c4b('0x4a')]='';}return getConnection(_0xb3df62)[_0x8c4b('0x39')](function(_0x50797c){_0x2d3e7c=_0x50797c;return getUser(_0xb3df62,_0x766e53[_0x8c4b('0x4d')],_0x2d3e7c);})[_0x8c4b('0x39')](function(_0x55550c){_0x326403=_0x55550c;logger[_0x8c4b('0x17')](_0x8c4b('0x4e'),_0x326403['id']);return getEndUser(_0xb3df62,_0x21b54f['calleridname'],_0x21b54f[_0x8c4b('0x4f')],_0x2d3e7c);})[_0x8c4b('0x39')](function(_0x2006ad){_0x13edbe=_0x2006ad;logger[_0x8c4b('0x17')](_0x8c4b('0x50'),_0x13edbe['id']);return createTicket(_0xb3df62,_0x326403,_0x13edbe,_0xd3cbe0,_0x21b54f,_0xd3cbe0[_0x8c4b('0x51')],_0x2d3e7c);})['then'](function(_0x47f1bc){_0x225c69=_0x47f1bc;logger[_0x8c4b('0x17')](_0x8c4b('0x52'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x225c69['id']);var _0x4da4d0=util[_0x8c4b('0x1c')](_0x8c4b('0x53'),_0xb3df62['remoteUri'],_[_0x8c4b('0x54')](_0x225c69['id'],'x')[0x1]);logger['info'](_0x8c4b('0x55'),_0x8c4b('0x56'));emit(util[_0x8c4b('0x1c')](_0x8c4b('0x57'),_0x766e53[_0x8c4b('0x15')]),_0x8c4b('0x58'),{'uri':_0x4da4d0});})['catch'](function(_0x7a61f0){logger['error'](_0x8c4b('0x55'),JSON[_0x8c4b('0x23')](_0x7a61f0));});};exports['outbound']=function(_0x550cbb,_0x1c6604,_0x578b28,_0x3d0d9d,_0x4ee088,_0x43fc9d,_0x342db8){var _0x4d8271,_0x53d076,_0xa6c863,_0x2d510f;_0x43fc9d[_0x8c4b('0x1e')]=intUtil[_0x8c4b('0x59')](_0x43fc9d[_0x8c4b('0x1e')]);_0x43fc9d[_0x8c4b('0x5a')]=intUtil[_0x8c4b('0x59')](_0x43fc9d['serverUrl']);if(_0x342db8&&_0x342db8[_0x8c4b('0x5b')]&&_0x342db8[_0x8c4b('0x5b')]!==_0x8c4b('0x5c')){logger[_0x8c4b('0x17')]('[OUTBOUND]',_0x8c4b('0x49'));_0x1c6604[_0x8c4b('0x4a')]=util['format'](_0x8c4b('0x4b'),_0x43fc9d[_0x8c4b('0x5a')],_0x1c6604[_0x8c4b('0x4c')],md5(_0x1c6604[_0x8c4b('0x4c')]));}return getConnection(_0x43fc9d)[_0x8c4b('0x39')](function(_0x453b26){_0x2d510f=_0x453b26;return getUser(_0x43fc9d,_0x3d0d9d[_0x8c4b('0x4d')],_0x2d510f);})[_0x8c4b('0x39')](function(_0x547fdf){_0x4d8271=_0x547fdf;logger[_0x8c4b('0x17')](_0x8c4b('0x4e'),_0x4d8271['id']);return getEndUser(_0x43fc9d,_0x1c6604[_0x8c4b('0x5d')],_0x1c6604['destcalleridnum'],_0x2d510f);})['then'](function(_0x5a9c7d){_0x53d076=_0x5a9c7d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x53d076['id']);return createTicket(_0x43fc9d,_0x4d8271,_0x53d076,_0x578b28,_0x1c6604,_0x578b28[_0x8c4b('0x51')],_0x2d510f);})[_0x8c4b('0x39')](function(_0x129f63){_0xa6c863=_0x129f63;logger[_0x8c4b('0x17')](_0x8c4b('0x52'));logger['info'](_0x8c4b('0x5e'),_0xa6c863['id']);var _0x484f31=util[_0x8c4b('0x1c')](_0x8c4b('0x53'),_0x43fc9d[_0x8c4b('0x1e')],_[_0x8c4b('0x54')](_0xa6c863['id'],'x')[0x1]);logger[_0x8c4b('0x17')](_0x8c4b('0x5f'),_0x8c4b('0x56'));emit(util[_0x8c4b('0x1c')](_0x8c4b('0x57'),_0x3d0d9d['name']),_0x8c4b('0x58'),{'uri':_0x484f31});})[_0x8c4b('0x35')](function(_0x2a9e97){logger[_0x8c4b('0x28')](_0x8c4b('0x5f'),JSON[_0x8c4b('0x23')](_0x2a9e97));});};exports['unmanaged']=function(_0x34c0c2,_0xa2a3a6,_0x813317,_0x1ceb17,_0x11e84d,_0x4126d7){var _0xf3f385,_0x11c14d,_0x23f36f,_0x2b3a2a;_0x4126d7['remoteUri']=intUtil[_0x8c4b('0x59')](_0x4126d7[_0x8c4b('0x1e')]);_0x4126d7[_0x8c4b('0x5a')]=intUtil['stripTrailingSlash'](_0x4126d7['serverUrl']);if(_0x11e84d&&_0x11e84d[_0x8c4b('0x60')]){logger['info']('['+_0xa2a3a6[_0x8c4b('0x61')][_0x8c4b('0x62')]()+']',_0x8c4b('0x49'));_0xa2a3a6[_0x8c4b('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4126d7[_0x8c4b('0x5a')],_0xa2a3a6[_0x8c4b('0x4c')],md5(_0xa2a3a6[_0x8c4b('0x4c')]));}else{_0xa2a3a6[_0x8c4b('0x4a')]='';}return getConnection(_0x4126d7)[_0x8c4b('0x39')](function(_0x54b515){_0x2b3a2a=_0x54b515;return getUser(_0x4126d7,'',_0x2b3a2a);})[_0x8c4b('0x39')](function(_0x5050a4){_0xf3f385=_0x5050a4;logger['info'](_0x8c4b('0x4e'),_0xf3f385['id']);return getEndUser(_0x4126d7,_0xa2a3a6['calleridname'],_0xa2a3a6[_0x8c4b('0x4f')],_0x2b3a2a);})[_0x8c4b('0x39')](function(_0x11fcd6){_0x11c14d=_0x11fcd6;logger['info'](_0x8c4b('0x50'),_0x11c14d['id']);return createTicket(_0x4126d7,_0xf3f385,_0x11c14d,_0x813317,_0xa2a3a6,_0x813317[_0x8c4b('0x51')],_0x2b3a2a);})['then'](function(_0x1c6fbc){_0x23f36f=_0x1c6fbc;logger['info'](_0x8c4b('0x52'));logger[_0x8c4b('0x17')](_0x8c4b('0x5e'),_0x23f36f['id']);})[_0x8c4b('0x35')](function(_0x419840){logger[_0x8c4b('0x28')]('['+_0xa2a3a6['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x419840));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 9dfa900..c9dcfb6 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 _0x55e0=['toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','emit','application/json','info','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','%s:%s','username','password','authType','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','type','string','customField','nameField','content','idField','push','variable','variableName','Variable','toLowerCase','custom_fields','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\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','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','Recording\x20is\x20enabled!','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent'];(function(_0x595911,_0x4bc4f6){var _0x22aef9=function(_0x31850f){while(--_0x31850f){_0x595911['push'](_0x595911['shift']());}};_0x22aef9(++_0x4bc4f6);}(_0x55e0,0xdc));var _0x055e=function(_0x732e09,_0x4bd3f9){_0x732e09=_0x732e09-0x0;var _0x14c534=_0x55e0[_0x732e09];return _0x14c534;};'use strict';var _=require(_0x055e('0x0'));var rp=require(_0x055e('0x1'));var md5=require(_0x055e('0x2'));var util=require(_0x055e('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x055e('0x4'));var logger=require(_0x055e('0x5'))(_0x055e('0x6'));config[_0x055e('0x7')]=_[_0x055e('0x8')](config[_0x055e('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x055e('0x7')]));function emit(_0x4a442e,_0x8e7824,_0x3c4cf){io['to'](_0x4a442e)[_0x055e('0x9')](_0x8e7824,_0x3c4cf);}var headers={'Content-Type':_0x055e('0xa'),'Accept':_0x055e('0xa')};function getTicket(_0x49540c,_0x40779c,_0xd67814,_0xb816c,_0xa0d384){logger[_0x055e('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x055e('0xc'),_0x49540c['remoteUri']),'method':_0x055e('0xd'),'body':{'ticket':_[_0x055e('0xe')]({'requester_id':_0xd67814['id'],'submitter_id':_0x40779c?_0x40779c['id']:undefined,'assignee_id':_0x40779c?_0x40779c['id']:undefined,'tags':getTags(_0xb816c[_0x055e('0xf')],_0x055e('0x10')),'subject':intUtil[_0x055e('0x11')](_0xb816c[_0x055e('0x12')],_0xa0d384,'\x20'),'description':intUtil[_0x055e('0x11')](_0xb816c['Descriptions'],_0xa0d384,'\x0a'),'comment':{'public':![],'body':intUtil[_0x055e('0x11')](_0xb816c[_0x055e('0x13')],_0xa0d384,'\x0a')}},getCustomFields(_0xb816c[_0x055e('0x14')],_0xa0d384))}})[_0x055e('0x15')](function(_0x222817){logger['info'](_0x055e('0x16'));return _0x222817[_0x055e('0x17')];});}function getUser(_0x111cdb,_0x599533){if(intUtil[_0x055e('0x18')](_0x599533)){logger[_0x055e('0xb')](_0x055e('0x19'),_0x599533);return request({'uri':util[_0x055e('0x1a')](_0x055e('0x1b'),_0x111cdb['remoteUri']),'qs':{'query':util[_0x055e('0x1a')](_0x055e('0x1c'),_0x599533)}})[_0x055e('0x15')](function(_0x2ed6fb){if(_0x2ed6fb['count']){logger[_0x055e('0xb')](_0x055e('0x1d'));return _['find'](_0x2ed6fb[_0x055e('0x1e')],{'email':_0x599533,'role':_0x055e('0x1f')});}else{logger[_0x055e('0xb')](_0x055e('0x20'));return request({'uri':util[_0x055e('0x1a')](_0x055e('0x21'),_0x111cdb['remoteUri'])})[_0x055e('0x15')](function(_0x2f0346){logger[_0x055e('0xb')]('Admin\x20account\x20selected.');return _0x2f0346[_0x055e('0x22')];});}});}else{logger[_0x055e('0xb')](_0x055e('0x20'));return request({'uri':util[_0x055e('0x1a')]('%s/users/me.json',_0x111cdb[_0x055e('0x23')])})['then'](function(_0x33ffdf){logger[_0x055e('0xb')](_0x055e('0x24'));return _0x33ffdf[_0x055e('0x22')];});}}function getEndUser(_0x40c62a,_0x4c653c,_0x58caf9){logger[_0x055e('0xb')](_0x055e('0x25'),_0x58caf9);return request({'uri':util[_0x055e('0x1a')]('%s/search.json',_0x40c62a[_0x055e('0x23')]),'qs':{'query':util[_0x055e('0x1a')](_0x055e('0x26'),_0x58caf9)}})[_0x055e('0x15')](function(_0x59539d){var _0x27f81a;if(_0x59539d['results'][_0x055e('0x27')]){_0x59539d[_0x055e('0x1e')]=_[_0x055e('0x28')](_0x59539d[_0x055e('0x1e')],{'suspended':![],'role':_0x055e('0x29')});if(_0x59539d['results'][_0x055e('0x27')]){_0x27f81a=_[_0x055e('0x2a')](_0x59539d[_0x055e('0x1e')]);}}if(_0x27f81a){logger[_0x055e('0xb')](_0x055e('0x2b'));return _0x27f81a;}else{logger[_0x055e('0xb')](_0x055e('0x2c'));return request({'uri':util[_0x055e('0x1a')]('%s/users.json',_0x40c62a[_0x055e('0x23')]),'method':_0x055e('0xd'),'body':{'user':{'role':'end-user','name':util[_0x055e('0x1a')](_0x055e('0x2d'),_0x4c653c||_0x58caf9),'phone':_0x58caf9}}})[_0x055e('0x15')](function(_0x20717b){logger[_0x055e('0xb')](_0x055e('0x2e'));return _0x20717b['user'];});}});}function getAuth(_0x5ddf59){var _0x25d19d;if(_0x5ddf59['authType']==='password'){_0x25d19d=util['format'](_0x055e('0x2f'),_0x5ddf59[_0x055e('0x30')],_0x5ddf59[_0x055e('0x31')]);}else if(_0x5ddf59[_0x055e('0x32')]===_0x055e('0x33')){_0x25d19d=util[_0x055e('0x1a')](_0x055e('0x34'),_0x5ddf59[_0x055e('0x30')],_0x5ddf59[_0x055e('0x33')]);}return util[_0x055e('0x1a')](_0x055e('0x35'),new Buffer(_0x25d19d)[_0x055e('0x36')]('base64'));}function request(_0x571b75){logger[_0x055e('0x37')](_0x055e('0x38'),JSON[_0x055e('0x39')](_0x571b75));return rp(_[_0x055e('0x8')](_0x571b75,{'method':_0x055e('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x21aaad,_0xb08e29){var _0x4f24f8=[];if(_0x21aaad&&_0x21aaad[_0x055e('0x27')]>0x0){_0x4f24f8=_[_0x055e('0x3b')](_0x21aaad,_0xb08e29);}return _0x4f24f8;}function getCustomFields(_0x3e9d25,_0x14b6ab){var _0x44dbd1=[];var _0x585b8a={'custom_fields':[]};if(_0x3e9d25[_0x055e('0x27')]>0x0){_[_0x055e('0x3c')](_0x3e9d25,function(_0x5b7d16){if(_0x5b7d16[_0x055e('0x3d')]===_0x055e('0x3e')&&_0x5b7d16['nameField']&&!_0x5b7d16[_0x055e('0x3f')]){_0x585b8a[_0x5b7d16[_0x055e('0x40')]['toLowerCase']()]=_0x5b7d16[_0x055e('0x41')][_0x055e('0x36')]();}else if(_0x5b7d16['type']===_0x055e('0x3e')&&_0x5b7d16[_0x055e('0x42')]&&_0x5b7d16[_0x055e('0x3f')]){_0x585b8a['custom_fields'][_0x055e('0x43')]({'id':_0x5b7d16[_0x055e('0x42')],'value':_0x5b7d16['content'][_0x055e('0x36')]()});}else if(_0x5b7d16[_0x055e('0x3d')]===_0x055e('0x44')&&_0x5b7d16['variableName']&&_0x5b7d16[_0x055e('0x42')]&&_0x5b7d16[_0x055e('0x3f')]){_0x14b6ab[_0x5b7d16[_0x055e('0x45')]]&&_0x585b8a['custom_fields']['push']({'id':_0x5b7d16[_0x055e('0x42')],'value':_0x14b6ab[_0x5b7d16[_0x055e('0x45')]]['toString']()});}else if(_0x5b7d16[_0x055e('0x3d')]==='customVariable'&&_0x5b7d16[_0x055e('0x46')]&&_0x5b7d16['Variable'][_0x055e('0x10')]&&_0x5b7d16[_0x055e('0x42')]&&_0x5b7d16[_0x055e('0x3f')]){_0x14b6ab[_0x5b7d16['Variable']['name'][_0x055e('0x47')]()]&&_0x585b8a[_0x055e('0x48')][_0x055e('0x43')]({'id':_0x5b7d16[_0x055e('0x42')],'value':_0x14b6ab[_0x5b7d16['Variable']['name'][_0x055e('0x47')]()][_0x055e('0x36')]()});}});}return _0x585b8a;}exports['queue']=function(_0x42dde3,_0x412684,_0xcb7d81,_0x20eb76,_0x19e29c,_0x1f3c73){var _0x479f4e,_0x297edd;_0x1f3c73[_0x055e('0x23')]=intUtil['stripTrailingSlash'](_0x1f3c73[_0x055e('0x23')]);_0x1f3c73[_0x055e('0x49')]=intUtil[_0x055e('0x4a')](_0x1f3c73[_0x055e('0x49')]);if(_0x19e29c&&_0x19e29c[_0x055e('0x4b')]){logger[_0x055e('0xb')](_0x055e('0x4c'),'Recording\x20is\x20enabled!');_0x412684[_0x055e('0x4d')]=util['format'](_0x055e('0x4e'),_0x1f3c73[_0x055e('0x49')],_0x412684[_0x055e('0x4f')],md5(_0x412684['uniqueid']));}else{_0x412684['recordingURL']='';}headers[_0x055e('0x50')]=getAuth(_0x1f3c73);return getUser(_0x1f3c73,_0x20eb76[_0x055e('0x51')])[_0x055e('0x15')](function(_0x250cab){_0x479f4e=_0x250cab;logger[_0x055e('0xb')](_0x055e('0x52'),_0x479f4e['id']);return getEndUser(_0x1f3c73,_0x412684[_0x055e('0x53')],_0x412684[_0x055e('0x54')]);})[_0x055e('0x15')](function(_0x5437c1){_0x297edd=_0x5437c1;logger[_0x055e('0xb')](_0x055e('0x55'),_0x297edd['id']);return getTicket(_0x1f3c73,_0x479f4e,_0x297edd,_0xcb7d81,_0x412684);})[_0x055e('0x15')](function(_0x17695b){if(_0x17695b){logger[_0x055e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x17695b['id']);switch(_0x1f3c73[_0x055e('0x3d')]){case _0x055e('0x56'):logger[_0x055e('0xb')]('[QUEUE]',_0x055e('0x57'));return request({'uri':util['format'](_0x055e('0x58'),_0x1f3c73[_0x055e('0x23')],_0x479f4e['id'],_0x17695b['id']),'method':'POST'});case _0x055e('0x59'):logger[_0x055e('0xb')](_0x055e('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x055e('0x5a'),_0x20eb76[_0x055e('0x10')]),_0x055e('0x5b'),{'uri':util[_0x055e('0x1a')](_0x055e('0x5c'),_0x1f3c73[_0x055e('0x23')],_0x17695b['id'])});break;default:logger[_0x055e('0x5d')](_0x055e('0x4c'),_0x055e('0x5e'));}}})[_0x055e('0x5f')](function(_0x4d8698){logger[_0x055e('0x5d')](_0x055e('0x60'),util[_0x055e('0x61')](_0x4d8698,{'showHidden':!![],'depth':null}));});};exports[_0x055e('0x62')]=function(_0x57a9e4,_0x3dc39c,_0x302787,_0x214b14,_0x3eb1a1,_0x59fe11,_0x54dcf7){var _0x22bf74,_0xd3a451;_0x59fe11[_0x055e('0x23')]=intUtil[_0x055e('0x4a')](_0x59fe11[_0x055e('0x23')]);_0x59fe11[_0x055e('0x49')]=intUtil[_0x055e('0x4a')](_0x59fe11[_0x055e('0x49')]);if(_0x54dcf7&&_0x54dcf7['recordingFormat']&&_0x54dcf7['recordingFormat']!==_0x055e('0x63')){logger[_0x055e('0xb')]('[OUTBOUND]',_0x055e('0x64'));_0x3dc39c[_0x055e('0x4d')]=util[_0x055e('0x1a')](_0x055e('0x4e'),_0x59fe11['serverUrl'],_0x3dc39c[_0x055e('0x4f')],md5(_0x3dc39c[_0x055e('0x4f')]));}headers[_0x055e('0x50')]=getAuth(_0x59fe11);return getUser(_0x59fe11,_0x214b14[_0x055e('0x51')])[_0x055e('0x15')](function(_0x3f74fa){_0x22bf74=_0x3f74fa;logger[_0x055e('0xb')](_0x055e('0x52'),_0x22bf74['id']);return getEndUser(_0x59fe11,_0x3dc39c['destcalleridname'],_0x3dc39c[_0x055e('0x65')]);})[_0x055e('0x15')](function(_0x5bd8f0){_0xd3a451=_0x5bd8f0;logger[_0x055e('0xb')](_0x055e('0x55'),_0xd3a451['id']);return getTicket(_0x59fe11,_0x22bf74,_0xd3a451,_0x302787,_0x3dc39c);})[_0x055e('0x15')](function(_0xde3c89){if(_0xde3c89){logger['info'](_0x055e('0x66'),_0xde3c89['id']);switch(_0x59fe11[_0x055e('0x3d')]){case _0x055e('0x56'):logger['info'](_0x055e('0x67'),_0x055e('0x57'));return request({'uri':util[_0x055e('0x1a')](_0x055e('0x58'),_0x59fe11[_0x055e('0x23')],_0x22bf74['id'],_0xde3c89['id']),'method':'POST'});case _0x055e('0x59'):logger[_0x055e('0xb')](_0x055e('0x67'),_0x055e('0x68'));emit(util[_0x055e('0x1a')]('user:%s',_0x214b14[_0x055e('0x10')]),_0x055e('0x5b'),{'uri':util[_0x055e('0x1a')]('%s/agent/tickets/%s',_0x59fe11[_0x055e('0x23')],_0xde3c89['id'])});break;default:logger[_0x055e('0x5d')](_0x055e('0x67'),_0x055e('0x5e'));}}})[_0x055e('0x5f')](function(_0x553e16){logger[_0x055e('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x055e('0x61')](_0x553e16,{'showHidden':!![],'depth':null}));});};exports[_0x055e('0x69')]=function(_0x533c0a,_0x3137bb,_0x1954a3,_0x30602f,_0x2bdf06,_0x58c121){var _0x48afae,_0x4c1187;_0x58c121['remoteUri']=intUtil[_0x055e('0x4a')](_0x58c121[_0x055e('0x23')]);_0x58c121[_0x055e('0x49')]=intUtil[_0x055e('0x4a')](_0x58c121[_0x055e('0x49')]);if(_0x2bdf06&&_0x2bdf06[_0x055e('0x4b')]){logger[_0x055e('0xb')]('['+_0x3137bb[_0x055e('0x6a')][_0x055e('0x6b')]()+']',_0x055e('0x64'));_0x3137bb['recordingURL']=util['format'](_0x055e('0x4e'),_0x58c121[_0x055e('0x49')],_0x3137bb['uniqueid'],md5(_0x3137bb[_0x055e('0x4f')]));}else{_0x3137bb['recordingURL']='';}headers[_0x055e('0x50')]=getAuth(_0x58c121);return getUser(_0x58c121)[_0x055e('0x15')](function(_0x10093f){_0x48afae=_0x10093f;logger[_0x055e('0xb')](_0x055e('0x52'),_0x48afae['id']);return getEndUser(_0x58c121,_0x3137bb[_0x055e('0x53')],_0x3137bb[_0x055e('0x54')]);})[_0x055e('0x15')](function(_0x4dfdb0){_0x4c1187=_0x4dfdb0;logger[_0x055e('0xb')](_0x055e('0x55'),_0x4c1187['id']);return getTicket(_0x58c121,_0x48afae,_0x4c1187,_0x1954a3,_0x3137bb);})[_0x055e('0x15')](function(_0x1ff1fa){if(_0x1ff1fa){logger[_0x055e('0xb')](_0x055e('0x66'),_0x1ff1fa['id']);}})[_0x055e('0x5f')](function(_0x406bef){logger[_0x055e('0x5d')]('['+_0x3137bb['lastevent'][_0x055e('0x6b')]()+']'+_0x055e('0x6c'),util['inspect'](_0x406bef,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xaa88=['remoteUri','merge','Tags','name','Subjects','getString','Descriptions','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','results','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','user','password','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','base64','debug','GET','map','forEach','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','toString','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','outbound','recordingFormat','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xaa88,0x137));var _0x8aa8=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0xaa88[_0x5c4e16];return _0x36044a;};'use strict';var _=require(_0x8aa8('0x0'));var rp=require(_0x8aa8('0x1'));var md5=require(_0x8aa8('0x2'));var util=require(_0x8aa8('0x3'));var Redis=require('ioredis');var intUtil=require(_0x8aa8('0x4'));var config=require(_0x8aa8('0x5'));var logger=require(_0x8aa8('0x6'))(_0x8aa8('0x7'));config[_0x8aa8('0x8')]=_[_0x8aa8('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8aa8('0xa'))(new Redis(config['redis']));function emit(_0x449d2d,_0x1ed84d,_0x27c08d){io['to'](_0x449d2d)[_0x8aa8('0xb')](_0x1ed84d,_0x27c08d);}var headers={'Content-Type':'application/json','Accept':_0x8aa8('0xc')};function getTicket(_0x2d974c,_0x224f25,_0x5c94d4,_0x4702ab,_0x9f78f5){logger[_0x8aa8('0xd')](_0x8aa8('0xe'));return request({'uri':util['format'](_0x8aa8('0xf'),_0x2d974c[_0x8aa8('0x10')]),'method':'POST','body':{'ticket':_[_0x8aa8('0x11')]({'requester_id':_0x5c94d4['id'],'submitter_id':_0x224f25?_0x224f25['id']:undefined,'assignee_id':_0x224f25?_0x224f25['id']:undefined,'tags':getTags(_0x4702ab[_0x8aa8('0x12')],_0x8aa8('0x13')),'subject':intUtil['getString'](_0x4702ab[_0x8aa8('0x14')],_0x9f78f5,'\x20'),'description':intUtil[_0x8aa8('0x15')](_0x4702ab[_0x8aa8('0x16')],_0x9f78f5,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4702ab[_0x8aa8('0x16')],_0x9f78f5,'\x0a')}},getCustomFields(_0x4702ab['Fields'],_0x9f78f5))}})['then'](function(_0x433e95){logger[_0x8aa8('0xd')](_0x8aa8('0x17'));return _0x433e95[_0x8aa8('0x18')];});}function getUser(_0x42a6a4,_0x3778f4){if(intUtil[_0x8aa8('0x19')](_0x3778f4)){logger[_0x8aa8('0xd')](_0x8aa8('0x1a'),_0x3778f4);return request({'uri':util['format']('%s/search.json',_0x42a6a4[_0x8aa8('0x10')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x3778f4)}})[_0x8aa8('0x1b')](function(_0x5ac0d9){if(_0x5ac0d9[_0x8aa8('0x1c')]){logger[_0x8aa8('0xd')](_0x8aa8('0x1d'));return _[_0x8aa8('0x1e')](_0x5ac0d9['results'],{'email':_0x3778f4,'role':_0x8aa8('0x1f')});}else{logger[_0x8aa8('0xd')](_0x8aa8('0x20'));return request({'uri':util[_0x8aa8('0x21')](_0x8aa8('0x22'),_0x42a6a4[_0x8aa8('0x10')])})['then'](function(_0x26cf63){logger['info'](_0x8aa8('0x23'));return _0x26cf63['user'];});}});}else{logger[_0x8aa8('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8aa8('0x21')](_0x8aa8('0x22'),_0x42a6a4[_0x8aa8('0x10')])})['then'](function(_0x24f428){logger[_0x8aa8('0xd')](_0x8aa8('0x23'));return _0x24f428['user'];});}}function getEndUser(_0x57acd2,_0x2d1508,_0x44e2d8){logger[_0x8aa8('0xd')](_0x8aa8('0x24'),_0x44e2d8);return request({'uri':util[_0x8aa8('0x21')]('%s/search.json',_0x57acd2[_0x8aa8('0x10')]),'qs':{'query':util['format'](_0x8aa8('0x25'),_0x44e2d8)}})[_0x8aa8('0x1b')](function(_0x15ff33){var _0x519ac0;if(_0x15ff33['results'][_0x8aa8('0x26')]){_0x15ff33['results']=_[_0x8aa8('0x27')](_0x15ff33[_0x8aa8('0x28')],{'suspended':![],'role':_0x8aa8('0x29')});if(_0x15ff33[_0x8aa8('0x28')][_0x8aa8('0x26')]){_0x519ac0=_['first'](_0x15ff33[_0x8aa8('0x28')]);}}if(_0x519ac0){logger[_0x8aa8('0xd')]('Enduser\x20found!');return _0x519ac0;}else{logger[_0x8aa8('0xd')](_0x8aa8('0x2a'));return request({'uri':util[_0x8aa8('0x21')]('%s/users.json',_0x57acd2[_0x8aa8('0x10')]),'method':_0x8aa8('0x2b'),'body':{'user':{'role':_0x8aa8('0x29'),'name':util[_0x8aa8('0x21')](_0x8aa8('0x2c'),_0x2d1508||_0x44e2d8),'phone':_0x44e2d8}}})[_0x8aa8('0x1b')](function(_0x370401){logger[_0x8aa8('0xd')](_0x8aa8('0x2d'));return _0x370401[_0x8aa8('0x2e')];});}});}function getAuth(_0x3e069a){var _0x5bf1a7;if(_0x3e069a['authType']===_0x8aa8('0x2f')){_0x5bf1a7=util[_0x8aa8('0x21')](_0x8aa8('0x30'),_0x3e069a[_0x8aa8('0x31')],_0x3e069a[_0x8aa8('0x2f')]);}else if(_0x3e069a[_0x8aa8('0x32')]==='token'){_0x5bf1a7=util['format'](_0x8aa8('0x33'),_0x3e069a['username'],_0x3e069a[_0x8aa8('0x34')]);}return util[_0x8aa8('0x21')](_0x8aa8('0x35'),new Buffer(_0x5bf1a7)['toString'](_0x8aa8('0x36')));}function request(_0x38b8d4){logger[_0x8aa8('0x37')]('[HTTP]',JSON['stringify'](_0x38b8d4));return rp(_[_0x8aa8('0x9')](_0x38b8d4,{'method':_0x8aa8('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x52f87d,_0x24eb18){var _0x2e1f52=[];if(_0x52f87d&&_0x52f87d['length']>0x0){_0x2e1f52=_[_0x8aa8('0x39')](_0x52f87d,_0x24eb18);}return _0x2e1f52;}function getCustomFields(_0x48c3ba,_0x530a66){var _0x2f8f19=[];var _0x5537ff={'custom_fields':[]};if(_0x48c3ba[_0x8aa8('0x26')]>0x0){_[_0x8aa8('0x3a')](_0x48c3ba,function(_0x926ff2){if(_0x926ff2[_0x8aa8('0x3b')]==='string'&&_0x926ff2[_0x8aa8('0x3c')]&&!_0x926ff2[_0x8aa8('0x3d')]){_0x5537ff[_0x926ff2['nameField'][_0x8aa8('0x3e')]()]=_0x926ff2[_0x8aa8('0x3f')]['toString']();}else if(_0x926ff2[_0x8aa8('0x3b')]===_0x8aa8('0x40')&&_0x926ff2[_0x8aa8('0x41')]&&_0x926ff2[_0x8aa8('0x3d')]){_0x5537ff[_0x8aa8('0x42')][_0x8aa8('0x43')]({'id':_0x926ff2[_0x8aa8('0x41')],'value':_0x926ff2[_0x8aa8('0x3f')][_0x8aa8('0x44')]()});}else if(_0x926ff2[_0x8aa8('0x3b')]===_0x8aa8('0x45')&&_0x926ff2[_0x8aa8('0x46')]&&_0x926ff2[_0x8aa8('0x41')]&&_0x926ff2[_0x8aa8('0x3d')]){_0x530a66[_0x926ff2[_0x8aa8('0x46')]]&&_0x5537ff[_0x8aa8('0x42')]['push']({'id':_0x926ff2[_0x8aa8('0x41')],'value':_0x530a66[_0x926ff2['variableName']]['toString']()});}else if(_0x926ff2['type']===_0x8aa8('0x47')&&_0x926ff2['Variable']&&_0x926ff2['Variable'][_0x8aa8('0x13')]&&_0x926ff2['idField']&&_0x926ff2[_0x8aa8('0x3d')]){_0x530a66[_0x926ff2['Variable']['name'][_0x8aa8('0x3e')]()]&&_0x5537ff[_0x8aa8('0x42')][_0x8aa8('0x43')]({'id':_0x926ff2[_0x8aa8('0x41')],'value':_0x530a66[_0x926ff2[_0x8aa8('0x48')][_0x8aa8('0x13')][_0x8aa8('0x3e')]()]['toString']()});}});}return _0x5537ff;}exports[_0x8aa8('0x49')]=function(_0x53a7a4,_0x2aec13,_0x1367db,_0x44ba22,_0x2bc6d3,_0x2a0a14){var _0x44f2b4,_0x5adcda;_0x2a0a14['remoteUri']=intUtil[_0x8aa8('0x4a')](_0x2a0a14[_0x8aa8('0x10')]);_0x2a0a14['serverUrl']=intUtil[_0x8aa8('0x4a')](_0x2a0a14[_0x8aa8('0x4b')]);if(_0x2bc6d3&&_0x2bc6d3[_0x8aa8('0x4c')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x2aec13['recordingURL']=util[_0x8aa8('0x21')](_0x8aa8('0x4d'),_0x2a0a14['serverUrl'],_0x2aec13[_0x8aa8('0x4e')],md5(_0x2aec13[_0x8aa8('0x4e')]));}else{_0x2aec13[_0x8aa8('0x4f')]='';}headers[_0x8aa8('0x50')]=getAuth(_0x2a0a14);return getUser(_0x2a0a14,_0x44ba22[_0x8aa8('0x51')])[_0x8aa8('0x1b')](function(_0x4e6b80){_0x44f2b4=_0x4e6b80;logger['info'](_0x8aa8('0x52'),_0x44f2b4['id']);return getEndUser(_0x2a0a14,_0x2aec13['calleridname'],_0x2aec13[_0x8aa8('0x53')]);})['then'](function(_0x1b4843){_0x5adcda=_0x1b4843;logger[_0x8aa8('0xd')](_0x8aa8('0x54'),_0x5adcda['id']);return getTicket(_0x2a0a14,_0x44f2b4,_0x5adcda,_0x1367db,_0x2aec13);})[_0x8aa8('0x1b')](function(_0x36de37){if(_0x36de37){logger[_0x8aa8('0xd')](_0x8aa8('0x55'),_0x36de37['id']);switch(_0x2a0a14[_0x8aa8('0x3b')]){case _0x8aa8('0x56'):logger[_0x8aa8('0xd')](_0x8aa8('0x57'),_0x8aa8('0x58'));return request({'uri':util['format'](_0x8aa8('0x59'),_0x2a0a14['remoteUri'],_0x44f2b4['id'],_0x36de37['id']),'method':'POST'});case'newTab':logger[_0x8aa8('0xd')]('[QUEUE]',_0x8aa8('0x5a'));emit(util[_0x8aa8('0x21')](_0x8aa8('0x5b'),_0x44ba22['name']),_0x8aa8('0x5c'),{'uri':util[_0x8aa8('0x21')](_0x8aa8('0x5d'),_0x2a0a14[_0x8aa8('0x10')],_0x36de37['id'])});break;default:logger['error']('[QUEUE]',_0x8aa8('0x5e'));}}})[_0x8aa8('0x5f')](function(_0x45ef2d){logger[_0x8aa8('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x45ef2d,{'showHidden':!![],'depth':null}));});};exports[_0x8aa8('0x61')]=function(_0x1bd389,_0x26eb56,_0x4bf6bc,_0x33e9ae,_0x3a814f,_0x501805,_0x5aa8a5){var _0x4b6fd7,_0x55e186;_0x501805[_0x8aa8('0x10')]=intUtil['stripTrailingSlash'](_0x501805[_0x8aa8('0x10')]);_0x501805[_0x8aa8('0x4b')]=intUtil['stripTrailingSlash'](_0x501805['serverUrl']);if(_0x5aa8a5&&_0x5aa8a5[_0x8aa8('0x62')]&&_0x5aa8a5[_0x8aa8('0x62')]!=='none'){logger['info']('[OUTBOUND]',_0x8aa8('0x63'));_0x26eb56[_0x8aa8('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x501805[_0x8aa8('0x4b')],_0x26eb56[_0x8aa8('0x4e')],md5(_0x26eb56['uniqueid']));}headers[_0x8aa8('0x50')]=getAuth(_0x501805);return getUser(_0x501805,_0x33e9ae[_0x8aa8('0x51')])['then'](function(_0x4c8431){_0x4b6fd7=_0x4c8431;logger['info'](_0x8aa8('0x52'),_0x4b6fd7['id']);return getEndUser(_0x501805,_0x26eb56['destcalleridname'],_0x26eb56[_0x8aa8('0x64')]);})[_0x8aa8('0x1b')](function(_0x3e105e){_0x55e186=_0x3e105e;logger[_0x8aa8('0xd')](_0x8aa8('0x54'),_0x55e186['id']);return getTicket(_0x501805,_0x4b6fd7,_0x55e186,_0x4bf6bc,_0x26eb56);})['then'](function(_0x379c66){if(_0x379c66){logger[_0x8aa8('0xd')](_0x8aa8('0x55'),_0x379c66['id']);switch(_0x501805[_0x8aa8('0x3b')]){case'integrationTab':logger[_0x8aa8('0xd')](_0x8aa8('0x65'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8aa8('0x21')](_0x8aa8('0x59'),_0x501805[_0x8aa8('0x10')],_0x4b6fd7['id'],_0x379c66['id']),'method':_0x8aa8('0x2b')});case _0x8aa8('0x66'):logger[_0x8aa8('0xd')](_0x8aa8('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x33e9ae[_0x8aa8('0x13')]),_0x8aa8('0x5c'),{'uri':util[_0x8aa8('0x21')](_0x8aa8('0x5d'),_0x501805[_0x8aa8('0x10')],_0x379c66['id'])});break;default:logger[_0x8aa8('0x60')](_0x8aa8('0x65'),_0x8aa8('0x5e'));}}})[_0x8aa8('0x5f')](function(_0x3cc282){logger[_0x8aa8('0x60')](_0x8aa8('0x67'),util[_0x8aa8('0x68')](_0x3cc282,{'showHidden':!![],'depth':null}));});};exports[_0x8aa8('0x69')]=function(_0x3e80ac,_0x36523a,_0x84c520,_0x2f561d,_0x28cf8a,_0x57c6f5){var _0x3b0e4d,_0x233169;_0x57c6f5[_0x8aa8('0x10')]=intUtil[_0x8aa8('0x4a')](_0x57c6f5[_0x8aa8('0x10')]);_0x57c6f5[_0x8aa8('0x4b')]=intUtil[_0x8aa8('0x4a')](_0x57c6f5[_0x8aa8('0x4b')]);if(_0x28cf8a&&_0x28cf8a[_0x8aa8('0x4c')]){logger['info']('['+_0x36523a[_0x8aa8('0x6a')][_0x8aa8('0x6b')]()+']','Recording\x20is\x20enabled!');_0x36523a[_0x8aa8('0x4f')]=util['format'](_0x8aa8('0x4d'),_0x57c6f5[_0x8aa8('0x4b')],_0x36523a['uniqueid'],md5(_0x36523a[_0x8aa8('0x4e')]));}else{_0x36523a[_0x8aa8('0x4f')]='';}headers[_0x8aa8('0x50')]=getAuth(_0x57c6f5);return getUser(_0x57c6f5)[_0x8aa8('0x1b')](function(_0xd136db){_0x3b0e4d=_0xd136db;logger[_0x8aa8('0xd')](_0x8aa8('0x52'),_0x3b0e4d['id']);return getEndUser(_0x57c6f5,_0x36523a['calleridname'],_0x36523a[_0x8aa8('0x53')]);})[_0x8aa8('0x1b')](function(_0x300ab8){_0x233169=_0x300ab8;logger[_0x8aa8('0xd')]('The\x20Enduser\x20ID\x20is:',_0x233169['id']);return getTicket(_0x57c6f5,_0x3b0e4d,_0x233169,_0x84c520,_0x36523a);})['then'](function(_0x284600){if(_0x284600){logger[_0x8aa8('0xd')](_0x8aa8('0x55'),_0x284600['id']);}})[_0x8aa8('0x5f')](function(_0x486e83){logger['error']('['+_0x36523a['lastevent'][_0x8aa8('0x6b')]()+']'+_0x8aa8('0x6c'),util[_0x8aa8('0x68')](_0x486e83,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 3d549c7..3c45f14 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 _0xb5bf=['[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','destcalleridname','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','toUpperCase','lastevent','lodash','request-promise','md5','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','debug','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','err','queue','host','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','outbound','stripTrailingSlash','recordingFormat','none'];(function(_0x475be2,_0xf0639){var _0x4ff8b1=function(_0x4bccc9){while(--_0x4bccc9){_0x475be2['push'](_0x475be2['shift']());}};_0x4ff8b1(++_0xf0639);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xb5bf[_0x616290];return _0x453879;};'use strict';var _=require(_0xfb5b('0x0'));var rp=require(_0xfb5b('0x1'));var md5=require(_0xfb5b('0x2'));var util=require('util');var intUtil=require(_0xfb5b('0x3'));var moment=require('moment');var Redis=require(_0xfb5b('0x4'));var BPromise=require(_0xfb5b('0x5'));var config=require(_0xfb5b('0x6'));var logger=require(_0xfb5b('0x7'))(_0xfb5b('0x8'));config[_0xfb5b('0x9')]=_['defaults'](config[_0xfb5b('0x9')],{'host':_0xfb5b('0xa'),'port':0x18eb});var io=require(_0xfb5b('0xb'))(new Redis(config[_0xfb5b('0x9')]));function emit(_0x3ac378,_0x5bd4ce,_0x570b34){io['to'](_0x3ac378)['emit'](_0x5bd4ce,_0x570b34);}function request(_0x541c2d){logger[_0xfb5b('0xc')]('[HTTP]',JSON[_0xfb5b('0xd')](_0x541c2d));return rp(_0x541c2d);}function getCustomFields(_0x5a881c,_0x5af168){var _0x9989e8={};if(_0x5a881c[_0xfb5b('0xe')]>0x0){_[_0xfb5b('0xf')](_0x5a881c,function(_0x5cbffd){if(_0x5cbffd[_0xfb5b('0x10')]===_0xfb5b('0x11')&&_0x5cbffd[_0xfb5b('0x12')]){_0x9989e8[_0x5cbffd[_0xfb5b('0x12')]]=_0x5cbffd[_0xfb5b('0x13')][_0xfb5b('0x14')]();}else if(_0x5cbffd[_0xfb5b('0x10')]===_0xfb5b('0x15')&&_0x5cbffd['variableName']&&_0x5cbffd[_0xfb5b('0x12')]&&_0x5af168[_0x5cbffd[_0xfb5b('0x16')]]){_0x9989e8[_0x5cbffd[_0xfb5b('0x12')]]=_0x5af168[_0x5cbffd[_0xfb5b('0x16')]]['toString']();}else if(_0x5cbffd[_0xfb5b('0x10')]===_0xfb5b('0x17')&&_0x5cbffd[_0xfb5b('0x18')]&&_0x5cbffd['Variable'][_0xfb5b('0x19')]&&_0x5cbffd[_0xfb5b('0x12')]&&_0x5af168[_0x5cbffd[_0xfb5b('0x18')][_0xfb5b('0x19')][_0xfb5b('0x1a')]()]){_0x9989e8[_0x5cbffd[_0xfb5b('0x12')]]=_0x5af168[_0x5cbffd['Variable'][_0xfb5b('0x19')]['toLowerCase']()]['toString']();}});}return _0x9989e8;}function getName(_0x14a2fa){if(_0x14a2fa['indexOf']('\x20')>0x0){var _0x2a3fbc=_0x14a2fa[_0xfb5b('0x1b')](/ (.+)/);if(_0x2a3fbc[0x1]){return _0x2a3fbc;}}return[_0x14a2fa,_0x14a2fa];}var accountsTokens={};function getAccessToken(_0x2dd395){return new Promise(function(_0x17d942,_0x1bb368){if(!_[_0xfb5b('0x1c')](accountsTokens[_0x2dd395['id']])&&!_[_0xfb5b('0x1c')](accountsTokens[_0x2dd395['id']][_0xfb5b('0x1d')])){if(moment()[_0xfb5b('0x1e')](accountsTokens[_0x2dd395['id']][_0xfb5b('0x1f')])){_0x17d942(accountsTokens[_0x2dd395['id']]['access_token']);}}var _0x3a6ade;switch(_0x2dd395['zone']){case'US':_0x3a6ade=_0xfb5b('0x20');break;case'AU':_0x3a6ade=_0xfb5b('0x21');break;case'EU':_0x3a6ade='https://accounts.zoho.eu';break;case'IN':_0x3a6ade=_0xfb5b('0x22');break;case'CN':_0x3a6ade=_0xfb5b('0x23');break;default:_0x3a6ade='https://accounts.zoho.eu';break;}var _0x2cd4b9={'method':_0xfb5b('0x24'),'uri':_0x3a6ade+_0xfb5b('0x25'),'qs':{'refresh_token':_0x2dd395['refreshToken'],'client_id':_0x2dd395[_0xfb5b('0x26')],'client_secret':_0x2dd395[_0xfb5b('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2cd4b9)[_0xfb5b('0x28')](function(_0x53987a){accountsTokens[_0x2dd395['id']]={'access_token':_0x53987a[_0xfb5b('0x1d')],'expires_in':moment()[_0xfb5b('0x29')](_0x53987a[_0xfb5b('0x1f')],'seconds')};_0x17d942(_0x53987a['access_token']);})[_0xfb5b('0x2a')](function(_0xd0dbbc){logger[_0xfb5b('0x2b')](_0xfb5b('0x2c'),_0xd0dbbc[_0xfb5b('0x2d')]);_0x1bb368(_0xd0dbbc);});});}function getUser(_0x3281b5,_0x1bd64b,_0x57b3c1,_0x36e376){logger['info'](_0xfb5b('0x2e'));return request({'method':_0xfb5b('0x2f'),'uri':util[_0xfb5b('0x30')](_0xfb5b('0x31'),_0x1bd64b),'qs':{'type':_0xfb5b('0x32')},'headers':{'Authorization':_0xfb5b('0x33')+_0x3281b5},'json':!![]})[_0xfb5b('0x28')](function(_0x4d8f3c){if(_0x4d8f3c[_0xfb5b('0x34')]){var _0x5456f0=-0x1;if(_['isArrayLikeObject'](_0x4d8f3c[_0xfb5b('0x34')])){if(!_['isNil'](_0x36e376)){_0x5456f0=_[_0xfb5b('0x35')](_0x4d8f3c[_0xfb5b('0x34')],function(_0x2a95c4){return _0x2a95c4[_0xfb5b('0x36')]===_0x36e376;});}if(_0x5456f0>=0x0){logger[_0xfb5b('0x37')](_0xfb5b('0x38'));}else{logger[_0xfb5b('0x37')](_0xfb5b('0x39'));_0x5456f0=_[_0xfb5b('0x35')](_0x4d8f3c['users'],function(_0x44a309){return _0x44a309[_0xfb5b('0x3a')]['name']===_0xfb5b('0x3b');});}return _0x4d8f3c[_0xfb5b('0x34')][_0x5456f0];}else{if(_0x4d8f3c[_0xfb5b('0x3c')][_0xfb5b('0x3a')][_0xfb5b('0x19')]===_0xfb5b('0x3b')){logger[_0xfb5b('0x37')]('Using\x20the\x20admin\x20account!');user=_0x4d8f3c[_0xfb5b('0x3c')];return user;}else{logger['error'](_0xfb5b('0x3d'),JSON[_0xfb5b('0xd')](_0x4d8f3c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfb5b('0xd')](_0x4d8f3c));}}}else{logger[_0xfb5b('0x2b')](_0xfb5b('0x3d'),JSON[_0xfb5b('0xd')](_0x4d8f3c));throw new Error(_0xfb5b('0x3e')+JSON[_0xfb5b('0xd')](_0x4d8f3c));}})[_0xfb5b('0x2a')](function(_0x234bd4){console[_0xfb5b('0x2b')](_0x234bd4);});}function getZohoUser(_0x2a4a7d,_0x200795){return new BPromise(function(_0x29a5f6,_0x1a70b5){request(_0x2a4a7d)[_0xfb5b('0x28')](function(_0x357c7d){var _0x25b93d=null;if(_0x357c7d){_0x25b93d=_0x357c7d[_0xfb5b('0x3f')][0x0];_0x25b93d[_0xfb5b('0x40')]=_0x200795;}_0x29a5f6(_0x25b93d);})[_0xfb5b('0x2a')](function(_0x5f74a7){_0x1a70b5(_0x5f74a7);});});}function createEndUser(_0x474c2f,_0xe01a76,_0x4959e0,_0x123801,_0x1a7635,_0xb6d303){var _0x4959e0=getName(_0x4959e0);return request({'method':_0xfb5b('0x24'),'uri':_0xfb5b('0x41')+_0xe01a76+_0xfb5b('0x42')+_[_0xfb5b('0x43')](_0xb6d303[_0xfb5b('0x44')])+'s','body':{'data':[{'Last_Name':_0x4959e0[0x1],'First_Name':_0x4959e0[0x0],'Phone':_0x123801,'Owner':{'name':!_['isNil'](_0x1a7635['role'][_0xfb5b('0x19')])?_0x1a7635[_0xfb5b('0x45')]['name']:!_[_0xfb5b('0x1c')](_0x1a7635[_0xfb5b('0x46')])?_0x1a7635[_0xfb5b('0x46')]+'\x20'+_0x1a7635[_0xfb5b('0x47')]:_0x1a7635[_0xfb5b('0x47')],'id':_0x1a7635['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x474c2f},'json':!![]})[_0xfb5b('0x28')](function(_0x3e1b0b){if(_0x3e1b0b&&_0x3e1b0b['data'][0x0][_0xfb5b('0x48')]===_0xfb5b('0x49')){var _0x77f1b4=_0x3e1b0b['data'][0x0][_0xfb5b('0x4a')];_0x77f1b4[_0xfb5b('0x40')]=_[_0xfb5b('0x43')](_0xb6d303['moduleCreate'])+'s';return _0x77f1b4;}logger[_0xfb5b('0x2b')](_0xfb5b('0x3d'),JSON[_0xfb5b('0xd')](data));throw new Error(_0xfb5b('0x4b')+JSON[_0xfb5b('0xd')](data));})[_0xfb5b('0x2a')](function(_0x58d4a5){console[_0xfb5b('0x4c')](_0xfb5b('0x4d'),_0x58d4a5);});}function getEndUser(_0x405cc1,_0x40e0a3,_0x151295,_0x581df9,_0x26de0d,_0x15249d,_0x462907){var _0x43e2e7={'method':_0xfb5b('0x2f'),'uri':'','headers':{'Authorization':_0xfb5b('0x33')+_0x405cc1},'json':!![]};switch(_0x462907[_0xfb5b('0x4e')]){case _0xfb5b('0x4f'):_0x43e2e7[_0xfb5b('0x50')]=_0xfb5b('0x41')+_0x40e0a3+_0xfb5b('0x51')+_0x26de0d+'))';return getZohoUser(_0x43e2e7,_0xfb5b('0x52'))[_0xfb5b('0x28')](function(_0x3bd16e){if(_0x3bd16e)return _0x3bd16e;_0x43e2e7[_0xfb5b('0x50')]=_0xfb5b('0x41')+_0x40e0a3+_0xfb5b('0x53')+_0x26de0d+'))';return getZohoUser(_0x43e2e7,_0xfb5b('0x54'))[_0xfb5b('0x28')](function(_0x18cf14){if(_0x18cf14)return _0x18cf14;if(_0x462907[_0xfb5b('0x44')]!=_0xfb5b('0x55')){return createEndUser(_0x405cc1,_0x40e0a3,_0x581df9,_0x26de0d,_0x15249d,_0x462907);}else{return{};}});});break;case _0xfb5b('0x56'):_0x43e2e7[_0xfb5b('0x50')]=_0xfb5b('0x41')+_0x40e0a3+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x26de0d+'))';return getZohoUser(_0x43e2e7,_0xfb5b('0x52'))['then'](function(_0x1273d9){if(_0x1273d9)return _0x1273d9;if(_0x462907[_0xfb5b('0x44')]!=_0xfb5b('0x55')){return createEndUser(_0x405cc1,_0x40e0a3,_0x581df9,_0x26de0d,_0x15249d,_0x462907);}else{return{};}});break;case'lead':_0x43e2e7[_0xfb5b('0x50')]=_0xfb5b('0x41')+_0x40e0a3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x26de0d+'))';return getZohoUser(_0x43e2e7,_0xfb5b('0x54'))[_0xfb5b('0x28')](function(_0x5b7973){if(_0x5b7973)return _0x5b7973;if(_0x462907[_0xfb5b('0x44')]!=_0xfb5b('0x55')){return createEndUser(_0x405cc1,_0x40e0a3,_0x581df9,_0x26de0d,_0x15249d,_0x462907);}else{return{};}});break;}}function getCall(_0x52751e,_0x70fc56,_0x52eeda,_0x2e563a,_0x321815,_0x63be51,_0x4ae71c,_0x56b6e7){logger[_0xfb5b('0x37')](_0xfb5b('0x57'));var _0x502699={};_0x502699[_0xfb5b('0x58')]={'name':!_[_0xfb5b('0x1c')](_0x2e563a[_0xfb5b('0x45')][_0xfb5b('0x19')])&&!_[_0xfb5b('0x1c')](_0x2e563a[_0xfb5b('0x3a')][_0xfb5b('0x19')])&&_0x2e563a[_0xfb5b('0x3a')][_0xfb5b('0x19')]===_0xfb5b('0x59')?_0x2e563a[_0xfb5b('0x45')][_0xfb5b('0x19')]:!_[_0xfb5b('0x1c')](_0x2e563a[_0xfb5b('0x46')])?_0x2e563a[_0xfb5b('0x46')]+'\x20'+_0x2e563a[_0xfb5b('0x47')]:_0x2e563a[_0xfb5b('0x47')],'id':_0x2e563a['id']};_0x502699['Subject']=intUtil[_0xfb5b('0x5a')](_0x63be51[_0xfb5b('0x5b')],_0x4ae71c,'\x20');_0x502699[_0xfb5b('0x5c')]=intUtil[_0xfb5b('0x5a')](_0x63be51[_0xfb5b('0x5d')],_0x4ae71c,'\x0a');if(_0x321815[_0xfb5b('0x40')]===_0xfb5b('0x52')){_0x502699[_0xfb5b('0x5e')]={'name':!_[_0xfb5b('0x1c')](_0x321815[_0xfb5b('0x5f')])?_0x321815[_0xfb5b('0x5f')]:!_[_0xfb5b('0x1c')](_0x321815[_0xfb5b('0x60')])?_0x321815['First_Name']+'\x20'+_0x321815['Last_Name']:_0x321815[_0xfb5b('0x61')],'id':_0x321815['id']};}if(_0x321815[_0xfb5b('0x40')]===_0xfb5b('0x54')){_0x502699[_0xfb5b('0x62')]={'name':!_['isNil'](_0x321815[_0xfb5b('0x5f')])?_0x321815[_0xfb5b('0x5f')]:!_[_0xfb5b('0x1c')](_0x321815[_0xfb5b('0x60')])?_0x321815[_0xfb5b('0x60')]+'\x20'+_0x321815[_0xfb5b('0x61')]:_0x321815['Last_Name'],'id':_0x321815['id']};_0x502699['$se_module']=_[_0xfb5b('0x43')](_0x321815['enduserType']);}if(_0x4ae71c[_0xfb5b('0x63')]){_0x502699[_0xfb5b('0x64')]=moment[_0xfb5b('0x65')](parseInt(_0x4ae71c[_0xfb5b('0x63')])*0x3e8)[_0xfb5b('0x30')](_0xfb5b('0x66'));}else if(_0x4ae71c[_0xfb5b('0x67')]&&_0x4ae71c[_0xfb5b('0x68')]){_0x502699[_0xfb5b('0x64')]=moment[_0xfb5b('0x65')](moment(_0x4ae71c[_0xfb5b('0x68')],_0xfb5b('0x69'))[_0xfb5b('0x6a')](moment(_0x4ae71c[_0xfb5b('0x6b')],'YYYY-MM-DDTHH:mm:ss')))[_0xfb5b('0x30')](_0xfb5b('0x66'));}switch(_0x4ae71c['lastevent']){case _0xfb5b('0x6c'):_0x502699[_0xfb5b('0x6d')]=_0xfb5b('0x6e');break;case _0xfb5b('0x6f'):case _0xfb5b('0x70'):_0x502699['Call_Result']='Answered';break;case _0xfb5b('0x71'):_0x502699[_0xfb5b('0x6d')]=_0xfb5b('0x72');break;case _0xfb5b('0x73'):_0x502699[_0xfb5b('0x6d')]=_0xfb5b('0x74');break;case _0xfb5b('0x75'):_0x502699[_0xfb5b('0x6d')]=_0xfb5b('0x76');default:}_0x502699[_0xfb5b('0x77')]=(_0x56b6e7==='outbound'?moment(_0x4ae71c[_0xfb5b('0x6b')])[_0xfb5b('0x30')](_0xfb5b('0x69')):moment(_0x4ae71c[_0xfb5b('0x78')])[_0xfb5b('0x30')](_0xfb5b('0x69')))||moment()[_0xfb5b('0x30')](_0xfb5b('0x69'));_0x502699[_0xfb5b('0x79')]=_0x56b6e7||_0xfb5b('0x7a');_0x502699=_['merge'](_0x502699,getCustomFields(_0x63be51[_0xfb5b('0x7b')],_0x4ae71c));return request({'method':'POST','uri':_0xfb5b('0x41')+_0x70fc56+_0xfb5b('0x7c'),'headers':{'Authorization':_0xfb5b('0x33')+_0x52751e},'body':{'data':[_0x502699]},'json':!![]})[_0xfb5b('0x28')](function(_0x4b052d){if(_0x4b052d&&_0x4b052d['data'][0x0][_0xfb5b('0x48')]===_0xfb5b('0x49')){logger[_0xfb5b('0x37')]('Call\x20created!');return{'id':_0x4b052d[_0xfb5b('0x3f')][0x0][_0xfb5b('0x4a')]['id']};}})['catch'](function(_0x33002c){logger[_0xfb5b('0x37')](_0xfb5b('0x7d'),_0x33002c[_0xfb5b('0x2d')]);console[_0xfb5b('0x4c')](_0xfb5b('0x7d'),_0x33002c);});}exports[_0xfb5b('0x7e')]=function(_0xc09d52,_0x3207b9,_0x3b7a54,_0x2dc0e6,_0x1c5de0,_0x3b78a4){var _0x2b6b33,_0x3b8de1,_0x5d0fa3;_0x3b78a4['host']=intUtil['stripTrailingSlash'](_0x3b78a4[_0xfb5b('0x7f')]);_0x3b78a4[_0xfb5b('0x80')]=intUtil['stripTrailingSlash'](_0x3b78a4[_0xfb5b('0x80')]);if(_0x1c5de0&&_0x1c5de0[_0xfb5b('0x81')]){logger[_0xfb5b('0x37')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3207b9[_0xfb5b('0x82')]=_0x3b78a4[_0xfb5b('0x80')]+_0xfb5b('0x83')+_0x3207b9['uniqueid']+_0xfb5b('0x84')+md5(_0x3207b9[_0xfb5b('0x85')]);}else{_0x3207b9[_0xfb5b('0x82')]='';}var _0x53db4f=_0x3b78a4[_0xfb5b('0x7f')]==='zoho.eu'?'eu':_0xfb5b('0x86');return getAccessToken(_0x3b78a4)[_0xfb5b('0x28')](function(_0x5a0090){_0x5d0fa3=_0x5a0090;return getUser(_0x5d0fa3,_0x53db4f,_0x3b78a4,_0x2dc0e6[_0xfb5b('0x36')]);})[_0xfb5b('0x28')](function(_0x3a8d42){_0x2b6b33=_0x3a8d42;logger[_0xfb5b('0x37')](_0xfb5b('0x87'),_0x2b6b33['id']);return getEndUser(_0x5d0fa3,_0x53db4f,_0x3b78a4,_0x3207b9[_0xfb5b('0x88')],_0x3207b9[_0xfb5b('0x89')],_0x2b6b33,_0x3b7a54);})[_0xfb5b('0x28')](function(_0x3a6aa8){_0x3b8de1=_0x3a6aa8;return getCall(_0x5d0fa3,_0x53db4f,_0x3b78a4,_0x2b6b33,_0x3b8de1,_0x3b7a54,_0x3207b9,'Inbound');})[_0xfb5b('0x28')](function(_0x3367ec){if(_0x3367ec){logger[_0xfb5b('0x37')](_0xfb5b('0x8a'),_0x3367ec['id']);logger[_0xfb5b('0x37')](_0xfb5b('0x8b'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfb5b('0x30')](_0xfb5b('0x8c'),_0x2dc0e6[_0xfb5b('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x3b78a4[_0xfb5b('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3367ec['id']});}})['catch'](function(_0xaac273){logger[_0xfb5b('0x2b')](_0xfb5b('0x8b'),JSON['stringify'](_0xaac273));});};exports[_0xfb5b('0x8d')]=function(_0x3c5900,_0x33281e,_0x17a8b3,_0x505e0f,_0x135972,_0x384b3b,_0x5aa638){var _0x19f1fb,_0x390fb1,_0x48d4f2;_0x384b3b[_0xfb5b('0x7f')]=intUtil[_0xfb5b('0x8e')](_0x384b3b[_0xfb5b('0x7f')]);_0x384b3b[_0xfb5b('0x80')]=intUtil[_0xfb5b('0x8e')](_0x384b3b[_0xfb5b('0x80')]);if(_0x5aa638&&_0x5aa638[_0xfb5b('0x8f')]&&_0x5aa638[_0xfb5b('0x8f')]!==_0xfb5b('0x90')){logger[_0xfb5b('0x37')](_0xfb5b('0x91'),_0xfb5b('0x92'));_0x33281e[_0xfb5b('0x82')]=_0x384b3b[_0xfb5b('0x80')]+'/api/voice/recordings/'+_0x33281e['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x33281e['uniqueid']);}var _0x3212ee=_0x384b3b[_0xfb5b('0x7f')]===_0xfb5b('0x93')?'eu':_0xfb5b('0x86');return getAccessToken(_0x384b3b)[_0xfb5b('0x28')](function(_0x1f179e){_0x48d4f2=_0x1f179e;return getUser(_0x48d4f2,_0x3212ee,_0x384b3b,_0x505e0f['email']);})[_0xfb5b('0x28')](function(_0x140798){_0x19f1fb=_0x140798;logger[_0xfb5b('0x37')](_0xfb5b('0x87'),_0x19f1fb['id']);return getEndUser(_0x48d4f2,_0x3212ee,_0x384b3b,_0x33281e[_0xfb5b('0x94')],_0x33281e[_0xfb5b('0x95')],_0x19f1fb,_0x17a8b3);})[_0xfb5b('0x28')](function(_0x31060d){_0x390fb1=_0x31060d;return getCall(_0x48d4f2,_0x3212ee,_0x384b3b,_0x19f1fb,_0x390fb1,_0x17a8b3,_0x33281e,'Outbound');})[_0xfb5b('0x28')](function(_0x20ca59){if(_0x20ca59){logger[_0xfb5b('0x37')](_0xfb5b('0x8a'),_0x20ca59['id']);logger[_0xfb5b('0x37')](_0xfb5b('0x91'),_0xfb5b('0x96'));emit(util[_0xfb5b('0x30')]('user:%s',_0x505e0f[_0xfb5b('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x384b3b[_0xfb5b('0x7f')]+_0xfb5b('0x97')+_0x20ca59['id']});}})['catch'](function(_0x4b2f3b){logger[_0xfb5b('0x2b')](_0xfb5b('0x91'),JSON[_0xfb5b('0xd')](_0x4b2f3b));});};exports['unmanaged']=function(_0x4564de,_0x3a92c9,_0x57e3f3,_0x4f5450,_0x2d18c0,_0xa74865){var _0x369302,_0x5f369d,_0x20f0eb;_0xa74865[_0xfb5b('0x7f')]=intUtil['stripTrailingSlash'](_0xa74865[_0xfb5b('0x7f')]);_0xa74865[_0xfb5b('0x80')]=intUtil[_0xfb5b('0x8e')](_0xa74865[_0xfb5b('0x80')]);if(_0x2d18c0&&_0x2d18c0[_0xfb5b('0x81')]){logger[_0xfb5b('0x37')]('['+_0x3a92c9['lastevent'][_0xfb5b('0x98')]()+']',_0xfb5b('0x92'));_0x3a92c9[_0xfb5b('0x82')]=_0xa74865[_0xfb5b('0x80')]+_0xfb5b('0x83')+_0x3a92c9[_0xfb5b('0x85')]+_0xfb5b('0x84')+md5(_0x3a92c9[_0xfb5b('0x85')]);}else{_0x3a92c9[_0xfb5b('0x82')]='';}var _0x539506=_0xa74865[_0xfb5b('0x7f')]==='zoho.eu'?'eu':_0xfb5b('0x86');return getAccessToken(_0xa74865)[_0xfb5b('0x28')](function(_0x23dbee){_0x20f0eb=_0x23dbee;return getUser(_0x20f0eb,_0x539506,_0xa74865);})[_0xfb5b('0x28')](function(_0x89a7e4){_0x369302=_0x89a7e4;logger[_0xfb5b('0x37')](_0xfb5b('0x87'),_0x369302['id']);return getEndUser(_0x20f0eb,_0x539506,_0xa74865,_0x3a92c9[_0xfb5b('0x88')],_0x3a92c9['calleridnum'],_0x369302,_0x57e3f3);})[_0xfb5b('0x28')](function(_0x4a9779){_0x5f369d=_0x4a9779;return getCall(_0x20f0eb,_0x539506,_0xa74865,_0x369302,_0x5f369d,_0x57e3f3,_0x3a92c9,_0xfb5b('0x7a'));})[_0xfb5b('0x28')](function(_0x3404df){if(_0x3404df){logger['info']('The\x20Call\x20ID\x20is:',_0x3404df['id']);}})[_0xfb5b('0x2a')](function(_0x5659e9){logger['error']('['+_0x3a92c9[_0xfb5b('0x99')][_0xfb5b('0x98')]()+']',JSON[_0xfb5b('0xd')](_0x5659e9));});}; \ No newline at end of file +var _0x6002=['Administrator','user','profile','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','GET','Zoho-oauthtoken\x20','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','format','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Called','connect','Call_Result','Answered','rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','POST','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','string','idField','content','toString','variable','variableName','type','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!'];(function(_0x13c64e,_0x56a158){var _0x1de4c0=function(_0x261d39){while(--_0x261d39){_0x13c64e['push'](_0x13c64e['shift']());}};_0x1de4c0(++_0x56a158);}(_0x6002,0xfe));var _0x2600=function(_0x41db2d,_0x44b304){_0x41db2d=_0x41db2d-0x0;var _0x5a9136=_0x6002[_0x41db2d];return _0x5a9136;};'use strict';var _=require(_0x2600('0x0'));var rp=require(_0x2600('0x1'));var md5=require(_0x2600('0x2'));var util=require(_0x2600('0x3'));var intUtil=require(_0x2600('0x4'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x2600('0x5'));var config=require(_0x2600('0x6'));var logger=require(_0x2600('0x7'))(_0x2600('0x8'));config['redis']=_['defaults'](config[_0x2600('0x9')],{'host':_0x2600('0xa'),'port':0x18eb});var io=require(_0x2600('0xb'))(new Redis(config[_0x2600('0x9')]));function emit(_0x22de15,_0x5e101c,_0x596ac9){io['to'](_0x22de15)['emit'](_0x5e101c,_0x596ac9);}function request(_0x3a045a){logger[_0x2600('0xc')](_0x2600('0xd'),JSON[_0x2600('0xe')](_0x3a045a));return rp(_0x3a045a);}function getCustomFields(_0xf25b93,_0x3ffeda){var _0x2540f6={};if(_0xf25b93[_0x2600('0xf')]>0x0){_[_0x2600('0x10')](_0xf25b93,function(_0x321d11){if(_0x321d11['type']===_0x2600('0x11')&&_0x321d11[_0x2600('0x12')]){_0x2540f6[_0x321d11[_0x2600('0x12')]]=_0x321d11[_0x2600('0x13')][_0x2600('0x14')]();}else if(_0x321d11['type']===_0x2600('0x15')&&_0x321d11[_0x2600('0x16')]&&_0x321d11[_0x2600('0x12')]&&_0x3ffeda[_0x321d11[_0x2600('0x16')]]){_0x2540f6[_0x321d11['idField']]=_0x3ffeda[_0x321d11['variableName']][_0x2600('0x14')]();}else if(_0x321d11[_0x2600('0x17')]===_0x2600('0x18')&&_0x321d11['Variable']&&_0x321d11[_0x2600('0x19')][_0x2600('0x1a')]&&_0x321d11[_0x2600('0x12')]&&_0x3ffeda[_0x321d11[_0x2600('0x19')][_0x2600('0x1a')]['toLowerCase']()]){_0x2540f6[_0x321d11[_0x2600('0x12')]]=_0x3ffeda[_0x321d11[_0x2600('0x19')]['name'][_0x2600('0x1b')]()][_0x2600('0x14')]();}});}return _0x2540f6;}function getName(_0x55b1df){if(_0x55b1df[_0x2600('0x1c')]('\x20')>0x0){var _0x209f73=_0x55b1df[_0x2600('0x1d')](/ (.+)/);if(_0x209f73[0x1]){return _0x209f73;}}return[_0x55b1df,_0x55b1df];}var accountsTokens={};function getAccessToken(_0x5efd1e){return new Promise(function(_0x48735d,_0xe07271){if(!_[_0x2600('0x1e')](accountsTokens[_0x5efd1e['id']])&&!_[_0x2600('0x1e')](accountsTokens[_0x5efd1e['id']]['access_token'])){if(moment()[_0x2600('0x1f')](accountsTokens[_0x5efd1e['id']][_0x2600('0x20')])){_0x48735d(accountsTokens[_0x5efd1e['id']][_0x2600('0x21')]);}}var _0x497e96;switch(_0x5efd1e[_0x2600('0x22')]){case'US':_0x497e96='https://accounts.zoho.com';break;case'AU':_0x497e96=_0x2600('0x23');break;case'EU':_0x497e96='https://accounts.zoho.eu';break;case'IN':_0x497e96=_0x2600('0x24');break;case'CN':_0x497e96=_0x2600('0x25');break;default:_0x497e96=_0x2600('0x26');break;}var _0x2e4be9={'method':'POST','uri':_0x497e96+'/oauth/v2/token','qs':{'refresh_token':_0x5efd1e['refreshToken'],'client_id':_0x5efd1e[_0x2600('0x27')],'client_secret':_0x5efd1e[_0x2600('0x28')],'grant_type':_0x2600('0x29')},'json':!![]};return rp(_0x2e4be9)[_0x2600('0x2a')](function(_0xf53e08){accountsTokens[_0x5efd1e['id']]={'access_token':_0xf53e08[_0x2600('0x21')],'expires_in':moment()[_0x2600('0x2b')](_0xf53e08[_0x2600('0x20')],_0x2600('0x2c'))};_0x48735d(_0xf53e08[_0x2600('0x21')]);})[_0x2600('0x2d')](function(_0xf1c945){logger[_0x2600('0x2e')](_0x2600('0x2f'),_0xf1c945[_0x2600('0x30')]);_0xe07271(_0xf1c945);});});}function getUser(_0x32e22f,_0x24c4ed,_0x1b2c98,_0x4077a0){logger[_0x2600('0x31')](_0x2600('0x32'));return request({'method':'GET','uri':util['format'](_0x2600('0x33'),_0x24c4ed),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x32e22f},'json':!![]})[_0x2600('0x2a')](function(_0x8f19){if(_0x8f19[_0x2600('0x34')]){var _0x1d8375=-0x1;if(_[_0x2600('0x35')](_0x8f19[_0x2600('0x34')])){if(!_[_0x2600('0x1e')](_0x4077a0)){_0x1d8375=_[_0x2600('0x36')](_0x8f19['users'],function(_0x38f4d3){return _0x38f4d3[_0x2600('0x37')]===_0x4077a0;});}if(_0x1d8375>=0x0){logger[_0x2600('0x31')](_0x2600('0x38'));}else{logger[_0x2600('0x31')](_0x2600('0x39'));_0x1d8375=_[_0x2600('0x36')](_0x8f19[_0x2600('0x34')],function(_0x2e7750){return _0x2e7750['profile']['name']===_0x2600('0x3a');});}return _0x8f19[_0x2600('0x34')][_0x1d8375];}else{if(_0x8f19[_0x2600('0x3b')][_0x2600('0x3c')]['name']==='Administrator'){logger[_0x2600('0x31')](_0x2600('0x39'));user=_0x8f19[_0x2600('0x3b')];return user;}else{logger[_0x2600('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x2600('0xe')](_0x8f19));throw new Error(_0x2600('0x3d')+JSON[_0x2600('0xe')](_0x8f19));}}}else{logger[_0x2600('0x2e')](_0x2600('0x3e'),JSON['stringify'](_0x8f19));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x2600('0xe')](_0x8f19));}})[_0x2600('0x2d')](function(_0x1e9b91){console[_0x2600('0x2e')](_0x1e9b91);});}function getZohoUser(_0x5a3b4e,_0x29888b){return new BPromise(function(_0x7da7a4,_0x138a6c){request(_0x5a3b4e)[_0x2600('0x2a')](function(_0x5a995f){var _0x4434ba=null;if(_0x5a995f){_0x4434ba=_0x5a995f[_0x2600('0x3f')][0x0];_0x4434ba[_0x2600('0x40')]=_0x29888b;}_0x7da7a4(_0x4434ba);})['catch'](function(_0xfeeda5){_0x138a6c(_0xfeeda5);});});}function createEndUser(_0x4177b9,_0x367d22,_0x499cf9,_0x3da0cf,_0x22619d,_0x2e93f6){var _0x499cf9=getName(_0x499cf9);return request({'method':'POST','uri':_0x2600('0x41')+_0x367d22+_0x2600('0x42')+_[_0x2600('0x43')](_0x2e93f6[_0x2600('0x44')])+'s','body':{'data':[{'Last_Name':_0x499cf9[0x1],'First_Name':_0x499cf9[0x0],'Phone':_0x3da0cf,'Owner':{'name':!_[_0x2600('0x1e')](_0x22619d[_0x2600('0x45')]['name'])?_0x22619d['role'][_0x2600('0x1a')]:!_[_0x2600('0x1e')](_0x22619d['first_name'])?_0x22619d['first_name']+'\x20'+_0x22619d[_0x2600('0x46')]:_0x22619d['last_name'],'id':_0x22619d['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4177b9},'json':!![]})[_0x2600('0x2a')](function(_0x1564c8){if(_0x1564c8&&_0x1564c8[_0x2600('0x3f')][0x0][_0x2600('0x47')]===_0x2600('0x48')){var _0x3e7c18=_0x1564c8[_0x2600('0x3f')][0x0][_0x2600('0x49')];_0x3e7c18['enduserType']=_['startCase'](_0x2e93f6[_0x2600('0x44')])+'s';return _0x3e7c18;}logger['error'](_0x2600('0x3e'),JSON[_0x2600('0xe')](data));throw new Error('Error:\x20'+JSON[_0x2600('0xe')](data));})['catch'](function(_0xf0d3d4){console[_0x2600('0x4a')](_0x2600('0x4b'),_0xf0d3d4);});}function getEndUser(_0x4ccaba,_0x205962,_0x56b012,_0x1912e0,_0x52d845,_0x3e6b37,_0x21b946){var _0x1e6e22={'method':_0x2600('0x4c'),'uri':'','headers':{'Authorization':_0x2600('0x4d')+_0x4ccaba},'json':!![]};switch(_0x21b946[_0x2600('0x4e')]){case _0x2600('0x4f'):_0x1e6e22[_0x2600('0x50')]=_0x2600('0x41')+_0x205962+_0x2600('0x51')+_0x52d845+'))';return getZohoUser(_0x1e6e22,_0x2600('0x52'))['then'](function(_0x3f95f0){if(_0x3f95f0)return _0x3f95f0;_0x1e6e22[_0x2600('0x50')]=_0x2600('0x41')+_0x205962+_0x2600('0x53')+_0x52d845+'))';return getZohoUser(_0x1e6e22,_0x2600('0x54'))[_0x2600('0x2a')](function(_0x4779ab){if(_0x4779ab)return _0x4779ab;if(_0x21b946['moduleCreate']!=_0x2600('0x55')){return createEndUser(_0x4ccaba,_0x205962,_0x1912e0,_0x52d845,_0x3e6b37,_0x21b946);}else{return{};}});});break;case _0x2600('0x56'):_0x1e6e22[_0x2600('0x50')]=_0x2600('0x41')+_0x205962+_0x2600('0x51')+_0x52d845+'))';return getZohoUser(_0x1e6e22,'Contacts')[_0x2600('0x2a')](function(_0x429fcd){if(_0x429fcd)return _0x429fcd;if(_0x21b946['moduleCreate']!='nothing'){return createEndUser(_0x4ccaba,_0x205962,_0x1912e0,_0x52d845,_0x3e6b37,_0x21b946);}else{return{};}});break;case _0x2600('0x57'):_0x1e6e22[_0x2600('0x50')]='https://www.zohoapis.'+_0x205962+_0x2600('0x53')+_0x52d845+'))';return getZohoUser(_0x1e6e22,_0x2600('0x54'))[_0x2600('0x2a')](function(_0x291111){if(_0x291111)return _0x291111;if(_0x21b946['moduleCreate']!=_0x2600('0x55')){return createEndUser(_0x4ccaba,_0x205962,_0x1912e0,_0x52d845,_0x3e6b37,_0x21b946);}else{return{};}});break;}}function getCall(_0x15b495,_0x266fdc,_0x8abcb5,_0x1a81f5,_0x2792a9,_0x52672c,_0x23ddb3,_0x44279c){logger['info'](_0x2600('0x58'));var _0x3622af={};_0x3622af[_0x2600('0x59')]={'name':!_[_0x2600('0x1e')](_0x1a81f5[_0x2600('0x45')]['name'])&&!_[_0x2600('0x1e')](_0x1a81f5['profile'][_0x2600('0x1a')])&&_0x1a81f5[_0x2600('0x3c')][_0x2600('0x1a')]===_0x2600('0x5a')?_0x1a81f5[_0x2600('0x45')]['name']:!_[_0x2600('0x1e')](_0x1a81f5['first_name'])?_0x1a81f5['first_name']+'\x20'+_0x1a81f5[_0x2600('0x46')]:_0x1a81f5[_0x2600('0x46')],'id':_0x1a81f5['id']};_0x3622af[_0x2600('0x5b')]=intUtil[_0x2600('0x5c')](_0x52672c[_0x2600('0x5d')],_0x23ddb3,'\x20');_0x3622af[_0x2600('0x5e')]=intUtil[_0x2600('0x5c')](_0x52672c[_0x2600('0x5f')],_0x23ddb3,'\x0a');if(_0x2792a9[_0x2600('0x40')]===_0x2600('0x52')){_0x3622af[_0x2600('0x60')]={'name':!_['isNil'](_0x2792a9[_0x2600('0x61')])?_0x2792a9[_0x2600('0x61')]:!_['isNil'](_0x2792a9[_0x2600('0x62')])?_0x2792a9[_0x2600('0x62')]+'\x20'+_0x2792a9['Last_Name']:_0x2792a9[_0x2600('0x63')],'id':_0x2792a9['id']};}if(_0x2792a9[_0x2600('0x40')]===_0x2600('0x54')){_0x3622af[_0x2600('0x64')]={'name':!_[_0x2600('0x1e')](_0x2792a9['Full_Name'])?_0x2792a9[_0x2600('0x61')]:!_['isNil'](_0x2792a9[_0x2600('0x62')])?_0x2792a9['First_Name']+'\x20'+_0x2792a9[_0x2600('0x63')]:_0x2792a9[_0x2600('0x63')],'id':_0x2792a9['id']};_0x3622af[_0x2600('0x65')]=_[_0x2600('0x43')](_0x2792a9[_0x2600('0x40')]);}if(_0x23ddb3[_0x2600('0x66')]){_0x3622af['Call_Duration']=moment['utc'](parseInt(_0x23ddb3[_0x2600('0x66')])*0x3e8)[_0x2600('0x67')]('mm:ss');}else if(_0x23ddb3[_0x2600('0x68')]&&_0x23ddb3['endtime']){_0x3622af['Call_Duration']=moment['utc'](moment(_0x23ddb3[_0x2600('0x69')],_0x2600('0x6a'))[_0x2600('0x6b')](moment(_0x23ddb3['starttime'],_0x2600('0x6a'))))[_0x2600('0x67')]('mm:ss');}switch(_0x23ddb3['lastevent']){case _0x2600('0x6c'):_0x3622af['Call_Result']=_0x2600('0x6d');break;case'complete':case _0x2600('0x6e'):_0x3622af[_0x2600('0x6f')]=_0x2600('0x70');break;case _0x2600('0x71'):_0x3622af[_0x2600('0x6f')]='Rejected';break;case _0x2600('0x72'):_0x3622af[_0x2600('0x6f')]='Abandoned';break;case _0x2600('0x73'):_0x3622af['Call_Result']=_0x2600('0x74');default:}_0x3622af[_0x2600('0x75')]=(_0x44279c===_0x2600('0x76')?moment(_0x23ddb3[_0x2600('0x77')])[_0x2600('0x67')](_0x2600('0x6a')):moment(_0x23ddb3[_0x2600('0x78')])[_0x2600('0x67')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x2600('0x67')](_0x2600('0x6a'));_0x3622af[_0x2600('0x79')]=_0x44279c||_0x2600('0x7a');_0x3622af=_[_0x2600('0x7b')](_0x3622af,getCustomFields(_0x52672c[_0x2600('0x7c')],_0x23ddb3));return request({'method':_0x2600('0x7d'),'uri':'https://www.zohoapis.'+_0x266fdc+_0x2600('0x7e'),'headers':{'Authorization':_0x2600('0x4d')+_0x15b495},'body':{'data':[_0x3622af]},'json':!![]})['then'](function(_0xd7ab03){if(_0xd7ab03&&_0xd7ab03['data'][0x0][_0x2600('0x47')]===_0x2600('0x48')){logger[_0x2600('0x31')](_0x2600('0x7f'));return{'id':_0xd7ab03[_0x2600('0x3f')][0x0][_0x2600('0x49')]['id']};}})[_0x2600('0x2d')](function(_0x6b55ed){logger[_0x2600('0x31')](_0x2600('0x80'),_0x6b55ed[_0x2600('0x30')]);console['log']('err',_0x6b55ed);});}exports['queue']=function(_0x3b3015,_0x186c13,_0xe33104,_0x505d8a,_0x1c3f59,_0x1f8fe9){var _0x272654,_0x1e102e,_0x408367;_0x1f8fe9[_0x2600('0x81')]=intUtil[_0x2600('0x82')](_0x1f8fe9['host']);_0x1f8fe9['serverUrl']=intUtil['stripTrailingSlash'](_0x1f8fe9[_0x2600('0x83')]);if(_0x1c3f59&&_0x1c3f59[_0x2600('0x84')]){logger[_0x2600('0x31')](_0x2600('0x85'),_0x2600('0x86'));_0x186c13[_0x2600('0x87')]=_0x1f8fe9[_0x2600('0x83')]+_0x2600('0x88')+_0x186c13[_0x2600('0x89')]+_0x2600('0x8a')+md5(_0x186c13[_0x2600('0x89')]);}else{_0x186c13[_0x2600('0x87')]='';}var _0x387729=_0x1f8fe9[_0x2600('0x81')]===_0x2600('0x8b')?'eu':_0x2600('0x8c');return getAccessToken(_0x1f8fe9)[_0x2600('0x2a')](function(_0xc908d8){_0x408367=_0xc908d8;return getUser(_0x408367,_0x387729,_0x1f8fe9,_0x505d8a[_0x2600('0x37')]);})['then'](function(_0x30cb88){_0x272654=_0x30cb88;logger[_0x2600('0x31')](_0x2600('0x8d'),_0x272654['id']);return getEndUser(_0x408367,_0x387729,_0x1f8fe9,_0x186c13[_0x2600('0x8e')],_0x186c13[_0x2600('0x8f')],_0x272654,_0xe33104);})['then'](function(_0x12c103){_0x1e102e=_0x12c103;return getCall(_0x408367,_0x387729,_0x1f8fe9,_0x272654,_0x1e102e,_0xe33104,_0x186c13,_0x2600('0x7a'));})[_0x2600('0x2a')](function(_0x581889){if(_0x581889){logger[_0x2600('0x31')]('The\x20Call\x20ID\x20is:',_0x581889['id']);logger[_0x2600('0x31')]('[QUEUE]',_0x2600('0x90'));emit(util[_0x2600('0x67')](_0x2600('0x91'),_0x505d8a[_0x2600('0x1a')]),_0x2600('0x92'),{'uri':_0x2600('0x93')+_0x1f8fe9['host']+_0x2600('0x94')+_0x581889['id']});}})['catch'](function(_0x3f1589){logger[_0x2600('0x2e')](_0x2600('0x85'),JSON[_0x2600('0xe')](_0x3f1589));});};exports[_0x2600('0x76')]=function(_0xec3ee1,_0x58a68c,_0x9ea0a5,_0x2b4209,_0xd64cab,_0x3de445,_0x358f7b){var _0x523ad8,_0x3849c5,_0x5b55e2;_0x3de445[_0x2600('0x81')]=intUtil[_0x2600('0x82')](_0x3de445['host']);_0x3de445[_0x2600('0x83')]=intUtil[_0x2600('0x82')](_0x3de445[_0x2600('0x83')]);if(_0x358f7b&&_0x358f7b[_0x2600('0x95')]&&_0x358f7b[_0x2600('0x95')]!==_0x2600('0x96')){logger[_0x2600('0x31')](_0x2600('0x97'),'Recording\x20is\x20enabled!');_0x58a68c[_0x2600('0x87')]=_0x3de445['serverUrl']+_0x2600('0x88')+_0x58a68c[_0x2600('0x89')]+_0x2600('0x8a')+md5(_0x58a68c['uniqueid']);}var _0x51b43c=_0x3de445[_0x2600('0x81')]===_0x2600('0x8b')?'eu':_0x2600('0x8c');return getAccessToken(_0x3de445)[_0x2600('0x2a')](function(_0x2dac7e){_0x5b55e2=_0x2dac7e;return getUser(_0x5b55e2,_0x51b43c,_0x3de445,_0x2b4209['email']);})['then'](function(_0x1e01e2){_0x523ad8=_0x1e01e2;logger[_0x2600('0x31')](_0x2600('0x8d'),_0x523ad8['id']);return getEndUser(_0x5b55e2,_0x51b43c,_0x3de445,_0x58a68c[_0x2600('0x98')],_0x58a68c['destcalleridnum'],_0x523ad8,_0x9ea0a5);})[_0x2600('0x2a')](function(_0x1a912c){_0x3849c5=_0x1a912c;return getCall(_0x5b55e2,_0x51b43c,_0x3de445,_0x523ad8,_0x3849c5,_0x9ea0a5,_0x58a68c,_0x2600('0x99'));})[_0x2600('0x2a')](function(_0x3bc628){if(_0x3bc628){logger[_0x2600('0x31')]('The\x20Call\x20ID\x20is:',_0x3bc628['id']);logger[_0x2600('0x31')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2600('0x67')](_0x2600('0x91'),_0x2b4209[_0x2600('0x1a')]),_0x2600('0x92'),{'uri':_0x2600('0x93')+_0x3de445[_0x2600('0x81')]+_0x2600('0x94')+_0x3bc628['id']});}})['catch'](function(_0xd3b134){logger['error']('[OUTBOUND]',JSON[_0x2600('0xe')](_0xd3b134));});};exports['unmanaged']=function(_0x223a2a,_0x5cc7de,_0x400bbf,_0x432597,_0x2ba069,_0x54d8a5){var _0x4bafeb,_0x541059,_0x546d58;_0x54d8a5[_0x2600('0x81')]=intUtil['stripTrailingSlash'](_0x54d8a5[_0x2600('0x81')]);_0x54d8a5['serverUrl']=intUtil[_0x2600('0x82')](_0x54d8a5[_0x2600('0x83')]);if(_0x2ba069&&_0x2ba069[_0x2600('0x84')]){logger[_0x2600('0x31')]('['+_0x5cc7de[_0x2600('0x9a')][_0x2600('0x9b')]()+']',_0x2600('0x86'));_0x5cc7de[_0x2600('0x87')]=_0x54d8a5[_0x2600('0x83')]+'/api/voice/recordings/'+_0x5cc7de[_0x2600('0x89')]+_0x2600('0x8a')+md5(_0x5cc7de['uniqueid']);}else{_0x5cc7de[_0x2600('0x87')]='';}var _0x3b068b=_0x54d8a5[_0x2600('0x81')]==='zoho.eu'?'eu':_0x2600('0x8c');return getAccessToken(_0x54d8a5)['then'](function(_0x383f04){_0x546d58=_0x383f04;return getUser(_0x546d58,_0x3b068b,_0x54d8a5);})[_0x2600('0x2a')](function(_0x2868b1){_0x4bafeb=_0x2868b1;logger[_0x2600('0x31')](_0x2600('0x8d'),_0x4bafeb['id']);return getEndUser(_0x546d58,_0x3b068b,_0x54d8a5,_0x5cc7de[_0x2600('0x8e')],_0x5cc7de[_0x2600('0x8f')],_0x4bafeb,_0x400bbf);})[_0x2600('0x2a')](function(_0x5910ec){_0x541059=_0x5910ec;return getCall(_0x546d58,_0x3b068b,_0x54d8a5,_0x4bafeb,_0x541059,_0x400bbf,_0x5cc7de,'Inbound');})[_0x2600('0x2a')](function(_0x3a5236){if(_0x3a5236){logger[_0x2600('0x31')]('The\x20Call\x20ID\x20is:',_0x3a5236['id']);}})[_0x2600('0x2d')](function(_0x1c3802){logger[_0x2600('0x2e')]('['+_0x5cc7de[_0x2600('0x9a')]['toUpperCase']()+']',JSON['stringify'](_0x1c3802));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 6f46a6a..8ce9e4e 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(_0xa79b45,_0x5b2a24){var _0x10a5ee=function(_0x4561f8){while(--_0x4561f8){_0xa79b45['push'](_0xa79b45['shift']());}};_0x10a5ee(++_0x5b2a24);}(_0x7a54,0x106));var _0x47a5=function(_0x513d77,_0x3ab23d){_0x513d77=_0x513d77-0x0;var _0xcd9033=_0x7a54[_0x513d77];return _0xcd9033;};'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(_0x12e969,_0xd1bfa8){var _0x141ef3=function(_0x4d2431){while(--_0x4d2431){_0x12e969['push'](_0x12e969['shift']());}};_0x141ef3(++_0xd1bfa8);}(_0x7a54,0x106));var _0x47a5=function(_0x51ac49,_0x48a2f2){_0x51ac49=_0x51ac49-0x0;var _0x1357ab=_0x7a54[_0x51ac49];return _0x1357ab;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index b1ca38f..de67327 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x40fc2c,_0x434bc1){var _0x37d2f7=function(_0x5c3fe2){while(--_0x5c3fe2){_0x40fc2c['push'](_0x40fc2c['shift']());}};_0x37d2f7(++_0x434bc1);}(_0x7a54,0x106));var _0x47a5=function(_0xeb4716,_0x57acf6){_0xeb4716=_0xeb4716-0x0;var _0x5eb76a=_0x7a54[_0xeb4716];return _0x5eb76a;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x30ca3a,_0x2b1030){var _0x574a31=function(_0x141680){while(--_0x141680){_0x30ca3a['push'](_0x30ca3a['shift']());}};_0x574a31(++_0x2b1030);}(_0x7a54,0x106));var _0x47a5=function(_0x5b7afd,_0x24d6ae){_0x5b7afd=_0x5b7afd-0x0;var _0xffe7a9=_0x7a54[_0x5b7afd];return _0xffe7a9;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index e5f0d91..219c70e 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 _0xb90d=['exports','bluebird','../../config/logger','routing','client','http','Request','debug','rpc','error','message','result','catch'];(function(_0x5d5bbb,_0x50683a){var _0x56340d=function(_0x53efcd){while(--_0x53efcd){_0x5d5bbb['push'](_0x5d5bbb['shift']());}};_0x56340d(++_0x50683a);}(_0xb90d,0x17a));var _0xdb90=function(_0x7902d0,_0x378152){_0x7902d0=_0x7902d0-0x0;var _0x2ab4ac=_0xb90d[_0x7902d0];return _0x2ab4ac;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xdb90('0x0'));var logger=require(_0xdb90('0x1'))(_0xdb90('0x2'));var client=jayson[_0xdb90('0x3')][_0xdb90('0x4')]({'port':0x2329});client[_0xdb90('0x5')]=function(_0x4a9a1f,_0x3db22e){return new BPromise(function(_0x12db41,_0x1b7d75){return client['request'](_0x4a9a1f,_0x3db22e)['then'](function(_0x2cc7cd){logger[_0xdb90('0x6')](_0xdb90('0x7'),_0xdb90('0x2'),_0x4a9a1f,_0x3db22e,_0x2cc7cd);if(_0x2cc7cd['error']){logger[_0xdb90('0x8')](_0xdb90('0x7'),_0xdb90('0x2'),_0x4a9a1f,_0x2cc7cd['error'][_0xdb90('0x9')],_0x3db22e);return _0x1b7d75(_0x2cc7cd[_0xdb90('0x8')][_0xdb90('0x9')]);}else{return _0x12db41(_0x2cc7cd[_0xdb90('0xa')]);}})[_0xdb90('0xb')](function(_0x48eb30){logger['error']('rpc',_0xdb90('0x2'),_0x4a9a1f,_0x48eb30,_0x3db22e);return _0x1b7d75(_0x48eb30);});});};module[_0xdb90('0xc')]=client; \ No newline at end of file +var _0x43fd=['http','request','then','debug','rpc','routing','error','message','result','catch','exports','bluebird','client'];(function(_0x508474,_0x3ab4c7){var _0x3c1356=function(_0x5acdd4){while(--_0x5acdd4){_0x508474['push'](_0x508474['shift']());}};_0x3c1356(++_0x3ab4c7);}(_0x43fd,0x1ec));var _0xd43f=function(_0x3b00a4,_0x146989){_0x3b00a4=_0x3b00a4-0x0;var _0x156bd0=_0x43fd[_0x3b00a4];return _0x156bd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd43f('0x0'));var logger=require('../../config/logger')('routing');var client=jayson[_0xd43f('0x1')][_0xd43f('0x2')]({'port':0x2329});client['Request']=function(_0x3df2bd,_0x48f953){return new BPromise(function(_0x3c2af1,_0x3d21ab){return client[_0xd43f('0x3')](_0x3df2bd,_0x48f953)[_0xd43f('0x4')](function(_0x52e75f){logger[_0xd43f('0x5')](_0xd43f('0x6'),_0xd43f('0x7'),_0x3df2bd,_0x48f953,_0x52e75f);if(_0x52e75f[_0xd43f('0x8')]){logger['error'](_0xd43f('0x6'),_0xd43f('0x7'),_0x3df2bd,_0x52e75f['error'][_0xd43f('0x9')],_0x48f953);return _0x3d21ab(_0x52e75f[_0xd43f('0x8')][_0xd43f('0x9')]);}else{return _0x3c2af1(_0x52e75f[_0xd43f('0xa')]);}})[_0xd43f('0xb')](function(_0x5eb0bb){logger[_0xd43f('0x8')](_0xd43f('0x6'),_0xd43f('0x7'),_0x3df2bd,_0x5eb0bb,_0x48f953);return _0x3d21ab(_0x5eb0bb);});});};module[_0xd43f('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 20246df..1b23188 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 _0xb673=['./rpc/mailAccount','../../mysqldb','then','getMailAccounts','mailAccounts','listen','loginMailFrequency','catch','log','bluebird','./server','./lib/email'];(function(_0x3d381e,_0x2a72b1){var _0x5c3e38=function(_0x3e3a26){while(--_0x3e3a26){_0x3d381e['push'](_0x3d381e['shift']());}};_0x5c3e38(++_0x2a72b1);}(_0xb673,0xa5));var _0x3b67=function(_0x2c7643,_0x15ac43){_0x2c7643=_0x2c7643-0x0;var _0xb1b48c=_0xb673[_0x2c7643];return _0xb1b48c;};'use strict';var BPromise=require(_0x3b67('0x0'));var server=require(_0x3b67('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x3b67('0x2'));var mailAccount=require(_0x3b67('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x3b67('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0x3b67('0x5')](mailAccount[_0x3b67('0x6')]())[_0x3b67('0x5')](realtime['initMailAccounts']())[_0x3b67('0x5')](function(){email['refresh'](realtime[_0x3b67('0x7')]);return realtime;});}function main(){return server[_0x3b67('0x8')](realtime,email)[_0x3b67('0x5')](function(_0x329729){return initRealtime();})['then'](function(_0x4c63d3){return db['Setting']['findOne']({'attributes':['id',_0x3b67('0x9')],'raw':!![]});})['then'](function(_0x2571fe){return setInterval(initRealtime,_0x2571fe['loginMailFrequency']*0x3e8);})[_0x3b67('0xa')](function(_0x42cb21){console[_0x3b67('0xb')](_0x42cb21);});}main(); \ No newline at end of file +var _0x4312=['refresh','listen','Setting','loginMailFrequency','catch','log','./realtime','./lib/email','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x1a2a6a,_0x3e965d){var _0x4f5b82=function(_0x187706){while(--_0x187706){_0x1a2a6a['push'](_0x1a2a6a['shift']());}};_0x4f5b82(++_0x3e965d);}(_0x4312,0xaf));var _0x2431=function(_0x3ded9c,_0x1701f2){_0x3ded9c=_0x3ded9c-0x0;var _0x504742=_0x4312[_0x3ded9c];return _0x504742;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x2431('0x0'));var EmailChannel=require(_0x2431('0x1'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x2431('0x2'))['db'];function initRealtime(){return BPromise[_0x2431('0x3')]()[_0x2431('0x4')](mailAccount[_0x2431('0x5')]())[_0x2431('0x4')](realtime[_0x2431('0x6')]())['then'](function(){email[_0x2431('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2431('0x8')](realtime,email)[_0x2431('0x4')](function(_0x4e2eb2){return initRealtime();})[_0x2431('0x4')](function(_0x2cb734){return db[_0x2431('0x9')]['findOne']({'attributes':['id',_0x2431('0xa')],'raw':!![]});})[_0x2431('0x4')](function(_0xb751e){return setInterval(initRealtime,_0xb751e['loginMailFrequency']*0x3e8);})[_0x2431('0xb')](function(_0x4a71f2){console[_0x2431('0xc')](_0x4a71f2);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ccd4faf..ba1cea7 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 _0xb94d=['handleImapError','messageStatus','connected','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','lastSync','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','status','Imap','total','isNil','stringify','mailAccount:update','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error'];(function(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0xb94d,0x82));var _0xdb94=function(_0x565d34,_0x4176da){_0x565d34=_0x565d34-0x0;var _0x3751e7=_0xb94d[_0x565d34];return _0x3751e7;};'use strict';var _=require(_0xdb94('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xdb94('0x1'));var Redis=require(_0xdb94('0x2'));var config=require(_0xdb94('0x3'));var logger=require(_0xdb94('0x4'))(_0xdb94('0x5'));config[_0xdb94('0x6')]=_[_0xdb94('0x7')](config[_0xdb94('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xdb94('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xdb94('0x9'));var EmailSmtp=require(_0xdb94('0xa'));var mailAccount=require(_0xdb94('0xb'));var md5Accounts={};function EmailChannel(_0x5068b3){logger[_0xdb94('0xc')](_0xdb94('0xd'));this[_0xdb94('0xe')]=_0x5068b3[_0xdb94('0xe')];this[_0xdb94('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xdb94('0x10')][_0xdb94('0x11')]=function(_0x455dc5){var _0x2dfef6=this[_0xdb94('0xe')][_0x455dc5];var _0x56bda4={'id':_0x2dfef6['id'],'name':_0x2dfef6[_0xdb94('0x12')],'key':_0x2dfef6[_0xdb94('0x13')],'active':_0x2dfef6[_0xdb94('0x14')],'Imap':{'status':_0x2dfef6['Imap'][_0xdb94('0x15')],'messageStatus':_0x2dfef6[_0xdb94('0x16')]['messageStatus'],'total':_0x2dfef6[_0xdb94('0x16')][_0xdb94('0x17')]}};if(_[_0xdb94('0x18')](md5Accounts[_0x455dc5])){md5Accounts[_0x455dc5]={};}var _0x5b438c=md5(JSON[_0xdb94('0x19')](_0x56bda4));if(md5Accounts[_0x455dc5][_0xdb94('0x1')]!==_0x5b438c){md5Accounts[_0x455dc5][_0xdb94('0x1')]=_0x5b438c;io[_0xdb94('0x11')](_0xdb94('0x1a'),_0x56bda4);}};EmailChannel['prototype']['refresh']=function(_0x5120b5){for(var _0x5547e7 in _0x5120b5){if(_0x5120b5['hasOwnProperty'](_0x5547e7)){if(_0x5120b5[_0x5547e7][_0xdb94('0x16')]&&_0x5120b5[_0x5547e7][_0xdb94('0x14')]){var _0x9ccc80=_0x5120b5[_0x5547e7][_0xdb94('0x16')];if(!this['imapAccounts'][_0xdb94('0x1b')](_0x9ccc80['id'])){this[_0xdb94('0xf')][_0x9ccc80['id']]=new EmailImap(_0x9ccc80,_0x5120b5[_0x5547e7][_0xdb94('0x5')]);this['imapAccounts'][_0x9ccc80['id']]['on'](_0xdb94('0x1c'),this[_0xdb94('0x1d')][_0xdb94('0x1e')](this,_0x5547e7));this[_0xdb94('0xf')][_0x9ccc80['id']]['on']('email',this[_0xdb94('0x1f')][_0xdb94('0x1e')](this,_0x5547e7));this[_0xdb94('0xf')][_0x9ccc80['id']]['on'](_0xdb94('0x20'),this[_0xdb94('0x21')][_0xdb94('0x1e')](this,_0x5547e7));this['imapAccounts'][_0x9ccc80['id']]['on'](_0xdb94('0x22'),this[_0xdb94('0x23')][_0xdb94('0x1e')](this,_0x5547e7));}}else{if(_[_0xdb94('0x18')](this['mailAccounts'][_0x5547e7]['Imap'])){this[_0xdb94('0xe')][_0x5547e7][_0xdb94('0x16')]={};}this['mailAccounts'][_0x5547e7]['Imap']['status']='disabled';this[_0xdb94('0xe')][_0x5547e7][_0xdb94('0x16')][_0xdb94('0x24')]='';this[_0xdb94('0x11')](_0x5547e7);}}}};EmailChannel[_0xdb94('0x10')][_0xdb94('0x1d')]=function(_0xe9bfa4,_0x3f794b){if(this[_0xdb94('0xe')][_0xe9bfa4]){this[_0xdb94('0xe')][_0xe9bfa4][_0xdb94('0x16')]['status']=_0xdb94('0x25');this[_0xdb94('0xe')][_0xe9bfa4][_0xdb94('0x16')][_0xdb94('0x24')]=_0x3f794b[_0xdb94('0x12')];if(_0x3f794b[_0xdb94('0x26')]){this[_0xdb94('0xe')][_0xe9bfa4][_0xdb94('0x16')][_0xdb94('0x17')]=_0x3f794b[_0xdb94('0x26')][_0xdb94('0x17')];}return this[_0xdb94('0x11')](_0xe9bfa4);}};EmailChannel[_0xdb94('0x10')][_0xdb94('0x1f')]=function(_0x11d681,_0x59ab13){logger['info'](_0xdb94('0x27'),_0x59ab13[_0xdb94('0x28')],_0x59ab13[_0xdb94('0x29')],_0x59ab13[_0xdb94('0x2a')],_0x11d681);if(this[_0xdb94('0xe')][_0x11d681]){return mailAccount[_0xdb94('0x2b')](_0x11d681,_0x59ab13)[_0xdb94('0x2c')](function(_0x5e7648){if(_0x5e7648){logger['info'](_0xdb94('0x2d'));}})['catch'](function(_0x5ecf9b){logger[_0xdb94('0x22')](_0xdb94('0x2e'),JSON[_0xdb94('0x19')](_0x5ecf9b));});}};EmailChannel[_0xdb94('0x10')][_0xdb94('0x21')]=function(_0x331daa){if(this['mailAccounts'][_0x331daa]&&this['mailAccounts'][_0x331daa][_0xdb94('0x16')]){if(this['imapAccounts'][this['mailAccounts'][_0x331daa][_0xdb94('0x16')]['id']]){delete this[_0xdb94('0xf')][this[_0xdb94('0xe')][_0x331daa][_0xdb94('0x16')]['id']];}this[_0xdb94('0xe')][_0x331daa][_0xdb94('0x16')][_0xdb94('0x2f')]=moment();this['emit'](_0x331daa);}};EmailChannel[_0xdb94('0x10')]['handleImapError']=function(_0x367da0,_0x2ad08a){if(this[_0xdb94('0xe')][_0x367da0]){this[_0xdb94('0xe')][_0x367da0][_0xdb94('0x16')]['status']=_0xdb94('0x22');this[_0xdb94('0xe')][_0x367da0][_0xdb94('0x16')][_0xdb94('0x24')]=_0x2ad08a;return this[_0xdb94('0x11')](_0x367da0);}};EmailChannel['prototype']['sendMail']=function(_0x44d768,_0x4496dc){return this[_0xdb94('0x30')][_0xdb94('0x31')](_0x44d768,_0x4496dc);};EmailChannel[_0xdb94('0x10')][_0xdb94('0x32')]=function(_0x18f1c0){var _0x4f3477=this;if(this['mailAccounts'][_0x18f1c0['id']]){if(_[_0xdb94('0x18')](this['mailAccounts'][_0x18f1c0['id']][_0xdb94('0x33')])){this[_0xdb94('0xe')][_0x18f1c0['id']]['Smtp']={};}this[_0xdb94('0xe')][_0x18f1c0['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x11922d,_0x29fb8c){return _0x4f3477[_0xdb94('0x30')][_0xdb94('0x34')](_0x18f1c0)[_0xdb94('0x2c')](function(_0x24cf4a){_0x4f3477['mailAccounts'][_0x18f1c0['id']][_0xdb94('0x33')][_0xdb94('0x15')]=_0xdb94('0x35');_0x4f3477[_0xdb94('0xe')][_0x18f1c0['id']][_0xdb94('0x33')][_0xdb94('0x24')]='';_0x4f3477['emit'](_0x18f1c0['id']);_0x11922d(_0x24cf4a);})['catch'](function(_0x5c76b9){_0x4f3477[_0xdb94('0xe')][_0x18f1c0['id']][_0xdb94('0x33')][_0xdb94('0x15')]=_0xdb94('0x22');_0x4f3477['mailAccounts'][_0x18f1c0['id']][_0xdb94('0x33')][_0xdb94('0x24')]=_0x5c76b9;_0x4f3477[_0xdb94('0x11')](_0x18f1c0['id']);_0x29fb8c(_0x5c76b9);});});}return this[_0xdb94('0x30')]['verify'](_0x18f1c0);};module[_0xdb94('0x36')]=EmailChannel; \ No newline at end of file +var _0x3e40=['Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','error','sendMail','smtp','send','Smtp','verify','verified','lodash','moment','bluebird','ioredis','../../../config/environment','socket.io-emitter','redis','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','prototype','emit','key','active','Imap','status','messageStatus','total','isNil','md5','mailAccount:update','refresh','hasOwnProperty','imapAccounts','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','notify','then','Mail\x20accepted\x20from\x20routing','catch'];(function(_0x6e3332,_0x1e23b3){var _0xfdc8e9=function(_0x4c89c3){while(--_0x4c89c3){_0x6e3332['push'](_0x6e3332['shift']());}};_0xfdc8e9(++_0x1e23b3);}(_0x3e40,0x74));var _0x03e4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3e40[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x03e4('0x0'));var moment=require(_0x03e4('0x1'));var BPromise=require(_0x03e4('0x2'));var md5=require('md5');var Redis=require(_0x03e4('0x3'));var config=require(_0x03e4('0x4'));var logger=require('../../../config/logger')('email');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x03e4('0x5'))(new Redis(config[_0x03e4('0x6')]));var EmailImap=require(_0x03e4('0x7'));var EmailSmtp=require(_0x03e4('0x8'));var mailAccount=require(_0x03e4('0x9'));var md5Accounts={};function EmailChannel(_0x501518){logger[_0x03e4('0xa')](_0x03e4('0xb'));this[_0x03e4('0xc')]=_0x501518[_0x03e4('0xc')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x03e4('0xd')][_0x03e4('0xe')]=function(_0x463349){var _0x3f55f3=this[_0x03e4('0xc')][_0x463349];var _0x13ef46={'id':_0x3f55f3['id'],'name':_0x3f55f3['name'],'key':_0x3f55f3[_0x03e4('0xf')],'active':_0x3f55f3[_0x03e4('0x10')],'Imap':{'status':_0x3f55f3[_0x03e4('0x11')][_0x03e4('0x12')],'messageStatus':_0x3f55f3[_0x03e4('0x11')][_0x03e4('0x13')],'total':_0x3f55f3['Imap'][_0x03e4('0x14')]}};if(_[_0x03e4('0x15')](md5Accounts[_0x463349])){md5Accounts[_0x463349]={};}var _0x3510bc=md5(JSON['stringify'](_0x13ef46));if(md5Accounts[_0x463349][_0x03e4('0x16')]!==_0x3510bc){md5Accounts[_0x463349][_0x03e4('0x16')]=_0x3510bc;io[_0x03e4('0xe')](_0x03e4('0x17'),_0x13ef46);}};EmailChannel[_0x03e4('0xd')][_0x03e4('0x18')]=function(_0x2d87b0){for(var _0x36cd35 in _0x2d87b0){if(_0x2d87b0[_0x03e4('0x19')](_0x36cd35)){if(_0x2d87b0[_0x36cd35][_0x03e4('0x11')]&&_0x2d87b0[_0x36cd35][_0x03e4('0x10')]){var _0x192021=_0x2d87b0[_0x36cd35][_0x03e4('0x11')];if(!this['imapAccounts']['hasOwnProperty'](_0x192021['id'])){this[_0x03e4('0x1a')][_0x192021['id']]=new EmailImap(_0x192021,_0x2d87b0[_0x36cd35][_0x03e4('0x1b')]);this[_0x03e4('0x1a')][_0x192021['id']]['on'](_0x03e4('0x1c'),this[_0x03e4('0x1d')][_0x03e4('0x1e')](this,_0x36cd35));this['imapAccounts'][_0x192021['id']]['on'](_0x03e4('0x1b'),this[_0x03e4('0x1f')]['bind'](this,_0x36cd35));this[_0x03e4('0x1a')][_0x192021['id']]['on'](_0x03e4('0x20'),this[_0x03e4('0x21')][_0x03e4('0x1e')](this,_0x36cd35));this[_0x03e4('0x1a')][_0x192021['id']]['on']('error',this[_0x03e4('0x22')][_0x03e4('0x1e')](this,_0x36cd35));}}else{if(_[_0x03e4('0x15')](this['mailAccounts'][_0x36cd35][_0x03e4('0x11')])){this[_0x03e4('0xc')][_0x36cd35][_0x03e4('0x11')]={};}this[_0x03e4('0xc')][_0x36cd35][_0x03e4('0x11')][_0x03e4('0x12')]=_0x03e4('0x23');this['mailAccounts'][_0x36cd35][_0x03e4('0x11')]['messageStatus']='';this[_0x03e4('0xe')](_0x36cd35);}}}};EmailChannel[_0x03e4('0xd')]['handleImapBox']=function(_0x27f2c4,_0x4e1513){if(this[_0x03e4('0xc')][_0x27f2c4]){this[_0x03e4('0xc')][_0x27f2c4][_0x03e4('0x11')][_0x03e4('0x12')]=_0x03e4('0x24');this[_0x03e4('0xc')][_0x27f2c4][_0x03e4('0x11')][_0x03e4('0x13')]=_0x4e1513['name'];if(_0x4e1513[_0x03e4('0x25')]){this[_0x03e4('0xc')][_0x27f2c4]['Imap'][_0x03e4('0x14')]=_0x4e1513[_0x03e4('0x25')][_0x03e4('0x14')];}return this['emit'](_0x27f2c4);}};EmailChannel['prototype'][_0x03e4('0x1f')]=function(_0x12475a,_0x2baa33){logger[_0x03e4('0xa')](_0x03e4('0x26'),_0x2baa33['firstName'],_0x2baa33['lastName'],_0x2baa33['from'],_0x12475a);if(this[_0x03e4('0xc')][_0x12475a]){return mailAccount[_0x03e4('0x27')](_0x12475a,_0x2baa33)[_0x03e4('0x28')](function(_0x28a386){if(_0x28a386){logger[_0x03e4('0xa')](_0x03e4('0x29'));}})[_0x03e4('0x2a')](function(_0x4c2a6e){logger['error'](_0x03e4('0x2b'),JSON[_0x03e4('0x2c')](_0x4c2a6e));});}};EmailChannel[_0x03e4('0xd')][_0x03e4('0x21')]=function(_0xdf1f2d){if(this[_0x03e4('0xc')][_0xdf1f2d]&&this[_0x03e4('0xc')][_0xdf1f2d][_0x03e4('0x11')]){if(this[_0x03e4('0x1a')][this[_0x03e4('0xc')][_0xdf1f2d][_0x03e4('0x11')]['id']]){delete this[_0x03e4('0x1a')][this[_0x03e4('0xc')][_0xdf1f2d][_0x03e4('0x11')]['id']];}this[_0x03e4('0xc')][_0xdf1f2d][_0x03e4('0x11')][_0x03e4('0x2d')]=moment();this['emit'](_0xdf1f2d);}};EmailChannel[_0x03e4('0xd')][_0x03e4('0x22')]=function(_0x167dbc,_0x5ea3e8){if(this[_0x03e4('0xc')][_0x167dbc]){this[_0x03e4('0xc')][_0x167dbc][_0x03e4('0x11')][_0x03e4('0x12')]=_0x03e4('0x2e');this[_0x03e4('0xc')][_0x167dbc][_0x03e4('0x11')]['messageStatus']=_0x5ea3e8;return this[_0x03e4('0xe')](_0x167dbc);}};EmailChannel[_0x03e4('0xd')][_0x03e4('0x2f')]=function(_0x5e38ba,_0xf5193e){return this[_0x03e4('0x30')][_0x03e4('0x31')](_0x5e38ba,_0xf5193e);};EmailChannel['prototype']['verifySmtp']=function(_0x350701){var _0x1a1bf8=this;if(this[_0x03e4('0xc')][_0x350701['id']]){if(_[_0x03e4('0x15')](this['mailAccounts'][_0x350701['id']][_0x03e4('0x32')])){this[_0x03e4('0xc')][_0x350701['id']]['Smtp']={};}this[_0x03e4('0xc')][_0x350701['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x5442e1,_0x438664){return _0x1a1bf8['smtp'][_0x03e4('0x33')](_0x350701)['then'](function(_0x31ddf4){_0x1a1bf8[_0x03e4('0xc')][_0x350701['id']][_0x03e4('0x32')]['status']=_0x03e4('0x34');_0x1a1bf8[_0x03e4('0xc')][_0x350701['id']]['Smtp'][_0x03e4('0x13')]='';_0x1a1bf8[_0x03e4('0xe')](_0x350701['id']);_0x5442e1(_0x31ddf4);})[_0x03e4('0x2a')](function(_0x49cf45){_0x1a1bf8[_0x03e4('0xc')][_0x350701['id']][_0x03e4('0x32')][_0x03e4('0x12')]=_0x03e4('0x2e');_0x1a1bf8[_0x03e4('0xc')][_0x350701['id']]['Smtp'][_0x03e4('0x13')]=_0x49cf45;_0x1a1bf8['emit'](_0x350701['id']);_0x438664(_0x49cf45);});});}return this['smtp'][_0x03e4('0x33')](_0x350701);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index c9b5536..c3db9cb 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 _0x6e1d=['connect','getAccount','connTimeout','authTimeout','user','password','host','port','tls','required','getHost','service','anonymous@xcally.com','handleOpenBox','emit','readUnseen','prototype','handleCloseBox','end','search','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','lodash','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','ready','handleReady','bind','once','handleEnd','handleError'];(function(_0x568324,_0x11d7ea){var _0x261f1d=function(_0xc91bd4){while(--_0xc91bd4){_0x568324['push'](_0x568324['shift']());}};_0x261f1d(++_0x11d7ea);}(_0x6e1d,0x1bf));var _0xd6e1=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x6e1d[_0x2706da];return _0x3ba87e;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xd6e1('0x0'));var _=require(_0xd6e1('0x1'));var rs=require('randomstring');var simpleParser=require(_0xd6e1('0x2'))[_0xd6e1('0x3')];var Iconv=require('iconv')[_0xd6e1('0x4')];var EventEmitter=require(_0xd6e1('0x5'))[_0xd6e1('0x6')];var utils=require(_0xd6e1('0x7'));var logger=require(_0xd6e1('0x8'))(_0xd6e1('0x9'));function EmailImap(_0x262ad5,_0x1ca842){this[_0xd6e1('0xa')]='INBOX';this['account']=this['getAccount'](_0x262ad5,_0x1ca842);this[_0xd6e1('0x0')]=new Imap(this['account']);this['imap']['once'](_0xd6e1('0xb'),this[_0xd6e1('0xc')][_0xd6e1('0xd')](this));this[_0xd6e1('0x0')][_0xd6e1('0xe')]('end',this[_0xd6e1('0xf')][_0xd6e1('0xd')](this));this[_0xd6e1('0x0')]['on']('error',this[_0xd6e1('0x10')][_0xd6e1('0xd')](this));this[_0xd6e1('0x0')][_0xd6e1('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xd6e1('0x12')]=function(_0xca68c6,_0xc63f4a){var _0x4cab7b={'connTimeout':_0xca68c6[_0xd6e1('0x13')]?_0xca68c6[_0xd6e1('0x13')]*0x3e8:0x2710,'authTimeout':_0xca68c6[_0xd6e1('0x14')]?_0xca68c6[_0xd6e1('0x14')]*0x3e8:0x1388};if(_['isNil'](_0xca68c6['service'])){if(_0xca68c6['authentication']){_0x4cab7b[_0xd6e1('0x15')]=_0xca68c6[_0xd6e1('0x15')];_0x4cab7b[_0xd6e1('0x16')]=_0xca68c6[_0xd6e1('0x16')];}_0x4cab7b[_0xd6e1('0x17')]=_0xca68c6[_0xd6e1('0x17')];_0x4cab7b['port']=_0xca68c6[_0xd6e1('0x18')]||0x3e1;if(_0xca68c6['tls']){_0x4cab7b['tls']=!![];}else{_0x4cab7b[_0xd6e1('0x19')]=![];_0x4cab7b['autotls']=_0xd6e1('0x1a');}}else{_0x4cab7b['user']=_0xca68c6['user'];_0x4cab7b[_0xd6e1('0x16')]=_0xca68c6[_0xd6e1('0x16')];_0x4cab7b['host']=utils[_0xd6e1('0x1b')](_0xca68c6[_0xd6e1('0x1c')]);_0x4cab7b[_0xd6e1('0x18')]=0x3e1;_0x4cab7b[_0xd6e1('0x19')]=!![];}_0x4cab7b['email']=_0xc63f4a||_0xca68c6[_0xd6e1('0x15')]||_0xd6e1('0x1d');return _0x4cab7b;};EmailImap['prototype'][_0xd6e1('0xc')]=function(){this[_0xd6e1('0x0')]['openBox'](this[_0xd6e1('0xa')],![],this[_0xd6e1('0x1e')][_0xd6e1('0xd')](this));};EmailImap['prototype'][_0xd6e1('0x1e')]=function(_0x4d7acb,_0x43cad2){if(_0x4d7acb){this[_0xd6e1('0x10')](_0x4d7acb,!![]);}else{this[_0xd6e1('0x1f')]('box',_0x43cad2);this[_0xd6e1('0x20')]();}};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x22')]=function(_0xd37a09){if(_0xd37a09){this[_0xd6e1('0x10')](_0xd37a09,!![]);}else{this[_0xd6e1('0x0')][_0xd6e1('0x23')]();}};EmailImap[_0xd6e1('0x21')]['readUnseen']=function(){this[_0xd6e1('0x0')][_0xd6e1('0x24')](['UNSEEN'],this[_0xd6e1('0x25')][_0xd6e1('0xd')](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x25')]=function(_0x44f916,_0x54abe2){if(_0x44f916){this['handleError'](_0x44f916,!![]);}else{if(_0x54abe2[_0xd6e1('0x26')]){try{var _0x29895d=this[_0xd6e1('0x0')][_0xd6e1('0x27')](_0x54abe2,{'bodies':'','markSeen':!![]});_0x29895d['on'](_0xd6e1('0x28'),this[_0xd6e1('0x29')]['bind'](this));_0x29895d[_0xd6e1('0xe')](_0xd6e1('0x2a'),this[_0xd6e1('0x2b')][_0xd6e1('0xd')](this));_0x29895d[_0xd6e1('0xe')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x3236f5){logger[_0xd6e1('0x2a')](_0x3236f5);}}else{this[_0xd6e1('0x0')][_0xd6e1('0x2c')](!![],this[_0xd6e1('0x22')][_0xd6e1('0xd')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x23bd4a,_0x1ea0bf){_0x23bd4a['on'](_0xd6e1('0x2d'),this[_0xd6e1('0x2e')][_0xd6e1('0xd')](this));_0x23bd4a[_0xd6e1('0xe')]('attributes',this[_0xd6e1('0x2f')][_0xd6e1('0xd')](this));_0x23bd4a['once'](_0xd6e1('0x23'),this[_0xd6e1('0x30')][_0xd6e1('0xd')](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x2e')]=function(_0x360709,_0x6f0bdb){simpleParser(_0x360709,{'Iconv':Iconv},this[_0xd6e1('0x31')][_0xd6e1('0xd')](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x2f')]=function(_0x2e2132){};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x30')]=function(){};EmailImap[_0xd6e1('0x21')]['handleSimpleParser']=function(_0x1cc6d1,_0x551ee2){if(_0x1cc6d1){logger[_0xd6e1('0x2a')](_0x1cc6d1);}else{var _0xa89439=this;utils[_0xd6e1('0x32')](this[_0xd6e1('0x33')],_0x551ee2,function(_0x370fb7){_0xa89439['emit']('email',_0x370fb7);});}};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x34')]=function(){this[_0xd6e1('0x0')]['closeBox'](!![],this[_0xd6e1('0x22')]['bind'](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x2b')]=function(_0x35b3a6){this['handleError'](_0x35b3a6);this[_0xd6e1('0x0')]['closeBox'](!![],this['handleCloseBox'][_0xd6e1('0xd')](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0xf')]=function(){this[_0xd6e1('0x1f')](_0xd6e1('0x23'));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x10')]=function(_0xfb931,_0x5c0023){logger[_0xd6e1('0x2a')](_0xd6e1('0x10'),this['account'][_0xd6e1('0x9')],JSON[_0xd6e1('0x35')](_0xfb931));var _0xa71fe3='';if(_0xfb931){if(_0xfb931[_0xd6e1('0x36')]){_0xa71fe3=_0xfb931[_0xd6e1('0x36')];}else{for(var _0x427972 in _0xfb931){if(_0xfb931[_0xd6e1('0x37')](_0x427972)){_0xa71fe3+=_[_0xd6e1('0x38')](_0x427972)+':\x20'+_0xfb931[_0x427972]+'\x0a';}}}}if(_0x5c0023){this[_0xd6e1('0x0')]['end']();}else{this['emit'](_0xd6e1('0x2a'),_0xa71fe3);this['emit'](_0xd6e1('0x23'));}};module[_0xd6e1('0x39')]=EmailImap; \ No newline at end of file +var _0xf034=['util','lodash','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','handleReady','bind','imap','once','end','error','handleError','connect','inherits','connTimeout','authTimeout','service','user','password','host','port','tls','autotls','required','getHost','openBox','handleOpenBox','prototype','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','upperFirst','path'];(function(_0x242dd7,_0x3d81d9){var _0x30ae03=function(_0x545519){while(--_0x545519){_0x242dd7['push'](_0x242dd7['shift']());}};_0x30ae03(++_0x3d81d9);}(_0xf034,0x1ef));var _0x4f03=function(_0xb5be71,_0x402295){_0xb5be71=_0xb5be71-0x0;var _0x538c0a=_0xf034[_0xb5be71];return _0x538c0a;};'use strict';var fs=require('fs');var path=require(_0x4f03('0x0'));var util=require(_0x4f03('0x1'));var Imap=require('imap');var _=require(_0x4f03('0x2'));var rs=require('randomstring');var simpleParser=require(_0x4f03('0x3'))[_0x4f03('0x4')];var Iconv=require(_0x4f03('0x5'))['Iconv'];var EventEmitter=require(_0x4f03('0x6'))[_0x4f03('0x7')];var utils=require(_0x4f03('0x8'));var logger=require(_0x4f03('0x9'))(_0x4f03('0xa'));function EmailImap(_0x11a8dc,_0x1d0917){this[_0x4f03('0xb')]=_0x4f03('0xc');this[_0x4f03('0xd')]=this[_0x4f03('0xe')](_0x11a8dc,_0x1d0917);this['imap']=new Imap(this[_0x4f03('0xd')]);this['imap']['once']('ready',this[_0x4f03('0xf')][_0x4f03('0x10')](this));this[_0x4f03('0x11')][_0x4f03('0x12')](_0x4f03('0x13'),this['handleEnd'][_0x4f03('0x10')](this));this[_0x4f03('0x11')]['on'](_0x4f03('0x14'),this[_0x4f03('0x15')][_0x4f03('0x10')](this));this[_0x4f03('0x11')][_0x4f03('0x16')]();}util[_0x4f03('0x17')](EmailImap,EventEmitter);EmailImap['prototype'][_0x4f03('0xe')]=function(_0x3aada6,_0x1372c1){var _0x115f25={'connTimeout':_0x3aada6[_0x4f03('0x18')]?_0x3aada6[_0x4f03('0x18')]*0x3e8:0x2710,'authTimeout':_0x3aada6[_0x4f03('0x19')]?_0x3aada6[_0x4f03('0x19')]*0x3e8:0x1388};if(_['isNil'](_0x3aada6[_0x4f03('0x1a')])){if(_0x3aada6['authentication']){_0x115f25[_0x4f03('0x1b')]=_0x3aada6[_0x4f03('0x1b')];_0x115f25[_0x4f03('0x1c')]=_0x3aada6[_0x4f03('0x1c')];}_0x115f25[_0x4f03('0x1d')]=_0x3aada6[_0x4f03('0x1d')];_0x115f25[_0x4f03('0x1e')]=_0x3aada6[_0x4f03('0x1e')]||0x3e1;if(_0x3aada6[_0x4f03('0x1f')]){_0x115f25[_0x4f03('0x1f')]=!![];}else{_0x115f25[_0x4f03('0x1f')]=![];_0x115f25[_0x4f03('0x20')]=_0x4f03('0x21');}}else{_0x115f25[_0x4f03('0x1b')]=_0x3aada6[_0x4f03('0x1b')];_0x115f25['password']=_0x3aada6[_0x4f03('0x1c')];_0x115f25[_0x4f03('0x1d')]=utils[_0x4f03('0x22')](_0x3aada6[_0x4f03('0x1a')]);_0x115f25[_0x4f03('0x1e')]=0x3e1;_0x115f25['tls']=!![];}_0x115f25[_0x4f03('0xa')]=_0x1372c1||_0x3aada6[_0x4f03('0x1b')]||'anonymous@xcally.com';return _0x115f25;};EmailImap['prototype'][_0x4f03('0xf')]=function(){this['imap'][_0x4f03('0x23')](this[_0x4f03('0xb')],![],this[_0x4f03('0x24')][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')][_0x4f03('0x24')]=function(_0x38a234,_0x511e72){if(_0x38a234){this[_0x4f03('0x15')](_0x38a234,!![]);}else{this['emit'](_0x4f03('0x26'),_0x511e72);this[_0x4f03('0x27')]();}};EmailImap['prototype'][_0x4f03('0x28')]=function(_0x2b8319){if(_0x2b8319){this[_0x4f03('0x15')](_0x2b8319,!![]);}else{this[_0x4f03('0x11')][_0x4f03('0x13')]();}};EmailImap[_0x4f03('0x25')][_0x4f03('0x27')]=function(){this[_0x4f03('0x11')][_0x4f03('0x29')]([_0x4f03('0x2a')],this[_0x4f03('0x2b')][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')][_0x4f03('0x2b')]=function(_0x4ce987,_0x3b7719){if(_0x4ce987){this['handleError'](_0x4ce987,!![]);}else{if(_0x3b7719[_0x4f03('0x2c')]){try{var _0x42f18f=this[_0x4f03('0x11')][_0x4f03('0x2d')](_0x3b7719,{'bodies':'','markSeen':!![]});_0x42f18f['on'](_0x4f03('0x2e'),this[_0x4f03('0x2f')][_0x4f03('0x10')](this));_0x42f18f[_0x4f03('0x12')]('error',this[_0x4f03('0x30')]['bind'](this));_0x42f18f['once'](_0x4f03('0x13'),this[_0x4f03('0x31')]['bind'](this));}catch(_0x357f4a){logger[_0x4f03('0x14')](_0x357f4a);}}else{this[_0x4f03('0x11')][_0x4f03('0x32')](!![],this[_0x4f03('0x28')][_0x4f03('0x10')](this));}}};EmailImap['prototype'][_0x4f03('0x2f')]=function(_0xa11aae,_0x7696dd){_0xa11aae['on'](_0x4f03('0x33'),this[_0x4f03('0x34')][_0x4f03('0x10')](this));_0xa11aae['once'](_0x4f03('0x35'),this[_0x4f03('0x36')][_0x4f03('0x10')](this));_0xa11aae[_0x4f03('0x12')](_0x4f03('0x13'),this[_0x4f03('0x37')][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')][_0x4f03('0x34')]=function(_0x1043f8,_0x1c73df){simpleParser(_0x1043f8,{'Iconv':Iconv},this[_0x4f03('0x38')][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')][_0x4f03('0x36')]=function(_0x27e7d1){};EmailImap[_0x4f03('0x25')][_0x4f03('0x37')]=function(){};EmailImap[_0x4f03('0x25')][_0x4f03('0x38')]=function(_0x537f29,_0xd6f2b){if(_0x537f29){logger[_0x4f03('0x14')](_0x537f29);}else{var _0x398f40=this;utils[_0x4f03('0x39')](this[_0x4f03('0xd')],_0xd6f2b,function(_0x1d72f6){_0x398f40[_0x4f03('0x3a')](_0x4f03('0xa'),_0x1d72f6);});}};EmailImap[_0x4f03('0x25')][_0x4f03('0x31')]=function(){this[_0x4f03('0x11')]['closeBox'](!![],this[_0x4f03('0x28')][_0x4f03('0x10')](this));};EmailImap['prototype'][_0x4f03('0x30')]=function(_0xea9dba){this[_0x4f03('0x15')](_0xea9dba);this[_0x4f03('0x11')]['closeBox'](!![],this['handleCloseBox'][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')]['handleEnd']=function(){this[_0x4f03('0x3a')](_0x4f03('0x13'));};EmailImap['prototype'][_0x4f03('0x15')]=function(_0x54af0e,_0x4a4955){logger[_0x4f03('0x14')]('handleError',this['account'][_0x4f03('0xa')],JSON[_0x4f03('0x3b')](_0x54af0e));var _0x153605='';if(_0x54af0e){if(_0x54af0e['textCode']){_0x153605=_0x54af0e[_0x4f03('0x3c')];}else{for(var _0x26908a in _0x54af0e){if(_0x54af0e['hasOwnProperty'](_0x26908a)){_0x153605+=_[_0x4f03('0x3d')](_0x26908a)+':\x20'+_0x54af0e[_0x26908a]+'\x0a';}}}}if(_0x4a4955){this[_0x4f03('0x11')]['end']();}else{this[_0x4f03('0x3a')](_0x4f03('0x14'),_0x153605);this['emit'](_0x4f03('0x13'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 3c88046..f4bf07c 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 _0x13cb=['send','createTransport','use','compile','sendMail','toString','verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x13cb,0x1b8));var _0xb13c=function(_0x4b354f,_0x350965){_0x4b354f=_0x4b354f-0x0;var _0xe3f93c=_0x13cb[_0x4b354f];return _0xe3f93c;};'use strict';var nodemailer=require(_0xb13c('0x0'));var BPromise=require(_0xb13c('0x1'));var inlineBase64=require(_0xb13c('0x2'));function EmailSmtp(){}EmailSmtp[_0xb13c('0x3')][_0xb13c('0x4')]=function(_0x481816,_0x369dae){return new BPromise(function(_0x380a34,_0x4bb2a8){var _0x1412ff=nodemailer[_0xb13c('0x5')](_0x481816);_0x1412ff[_0xb13c('0x6')](_0xb13c('0x7'),inlineBase64());_0x1412ff[_0xb13c('0x8')](_0x369dae,function(_0x5e7f07,_0x67db83){if(_0x5e7f07){_0x4bb2a8(_0x5e7f07[_0xb13c('0x9')]());}else{_0x380a34(_0x67db83);}});});};EmailSmtp[_0xb13c('0x3')][_0xb13c('0xa')]=function(_0x49fec9){return new BPromise(function(_0x2e3c22,_0x1bbb0d){var _0x18d637=nodemailer[_0xb13c('0x5')](_0x49fec9);_0x18d637[_0xb13c('0xa')](function(_0x1b1551,_0x23bb10){if(_0x1b1551){_0x1bbb0d(_0x1b1551[_0xb13c('0x9')]());}else{if(_0x23bb10){_0x2e3c22(_0x23bb10);}else{_0x1bbb0d('Not\x20verifired');}}});});};module[_0xb13c('0xb')]=EmailSmtp; \ No newline at end of file +var _0xeed9=['createTransport','compile','sendMail','toString','verify','exports','nodemailer','bluebird','prototype','send'];(function(_0x36ff26,_0x40a6f8){var _0xf65dcd=function(_0x2af83f){while(--_0x2af83f){_0x36ff26['push'](_0x36ff26['shift']());}};_0xf65dcd(++_0x40a6f8);}(_0xeed9,0x1e6));var _0x9eed=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0xeed9[_0x4350c2];return _0x8b6406;};'use strict';var nodemailer=require(_0x9eed('0x0'));var BPromise=require(_0x9eed('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x9eed('0x2')][_0x9eed('0x3')]=function(_0x291ef8,_0x3fd67a){return new BPromise(function(_0x55efa9,_0x3742ad){var _0x5eee69=nodemailer[_0x9eed('0x4')](_0x291ef8);_0x5eee69['use'](_0x9eed('0x5'),inlineBase64());_0x5eee69[_0x9eed('0x6')](_0x3fd67a,function(_0x537abf,_0x37dbf7){if(_0x537abf){_0x3742ad(_0x537abf[_0x9eed('0x7')]());}else{_0x55efa9(_0x37dbf7);}});});};EmailSmtp['prototype'][_0x9eed('0x8')]=function(_0x3a6b16){return new BPromise(function(_0x19ce14,_0x3f1808){var _0x1ee23d=nodemailer[_0x9eed('0x4')](_0x3a6b16);_0x1ee23d[_0x9eed('0x8')](function(_0x10c544,_0x23d596){if(_0x10c544){_0x3f1808(_0x10c544[_0x9eed('0x7')]());}else{if(_0x23d596){_0x19ce14(_0x23d596);}else{_0x3f1808('Not\x20verifired');}}});});};module[_0x9eed('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 3e79455..d5dc5fc 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 _0x0e3e=['type','attachment','filename','format','%s-%s','now','root','server/files/attachments/','writeFileSync','contentType','parser','from','subject','messageId','YYYY-MM-DD\x20HH:mm:ss','filter','info','BodyHTML','

Empty\x20message

','Attachments','push','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','lodash','moment','path','node-tnef','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','slice','join','Anonymous','length','pop','html','replace','body','0x1?_0x4dc298[_0xe0e3('0x11')]():'';}return'';}function getMails(_0x56e441,_0x2eadd1){var _0x2fe74f='';for(var _0x49a9b0=0x0;_0x49a9b0<_0x2eadd1[_0xe0e3('0x6')]['length'];_0x49a9b0+=0x1){if(_0x2eadd1[_0xe0e3('0x6')][_0x49a9b0][_0xe0e3('0x7')]!==_0x56e441){if(!_['isEmpty'](_0x2fe74f)){_0x2fe74f+=',';}_0x2fe74f+=_0x2eadd1[_0xe0e3('0x6')][_0x49a9b0]['name']||_0x2eadd1['value'][_0x49a9b0][_0xe0e3('0x7')]||'';_0x2fe74f+='\x20<';_0x2fe74f+=_0x2eadd1[_0xe0e3('0x6')][_0x49a9b0]['address']?_0x2eadd1[_0xe0e3('0x6')][_0x49a9b0][_0xe0e3('0x7')]:_0xe0e3('0x8')+random[_0xe0e3('0x9')](0x6)+_0xe0e3('0xa');_0x2fe74f+='>';}}return _0x2fe74f;}function parseEmail(_0x24f59d,_0x10513e,_0x4205f2){if(_0x10513e[_0xe0e3('0x12')]){var _0x3c836e=/)<[^<]*)*<\/script>/gi;while(_0x3c836e['test'](_0x10513e[_0xe0e3('0x12')])){_0x10513e[_0xe0e3('0x12')]=_0x10513e[_0xe0e3('0x12')][_0xe0e3('0x13')](_0x3c836e,'');}_0x4205f2['body']=_0x10513e['html'];}else{_0x4205f2[_0xe0e3('0x14')]=_0x10513e['textAsHtml'];}if(_0x4205f2[_0xe0e3('0x14')]){_0x4205f2[_0xe0e3('0x14')]=_0x4205f2[_0xe0e3('0x14')][_0xe0e3('0x13')](/Empty\x20message

','Attachments','push','Title','Data','getHost'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x8d28,0x120));var _0x88d2=function(_0x5a432c,_0x33d35e){_0x5a432c=_0x5a432c-0x0;var _0x92bde0=_0x8d28[_0x5a432c];return _0x92bde0;};'use strict';var _=require(_0x88d2('0x0'));var moment=require(_0x88d2('0x1'));var random=require(_0x88d2('0x2'));var fs=require('fs');var path=require(_0x88d2('0x3'));var util=require(_0x88d2('0x4'));var tnef=require(_0x88d2('0x5'));var logger=require('../../../config/logger')('email');var config=require(_0x88d2('0x6'));function getAddress(_0x41bcb1){var _0x1b0fc8=_[_0x88d2('0x7')](_0x41bcb1[_0x88d2('0x8')]);return _0x1b0fc8&&_0x1b0fc8[_0x88d2('0x9')]?_0x1b0fc8['address']:_0x88d2('0xa')+random[_0x88d2('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x40f3ec){var _0x957420=_[_0x88d2('0x7')](_0x40f3ec[_0x88d2('0x8')]);if(_0x957420&&_0x957420[_0x88d2('0xc')]){var _0x32703c=_0x957420[_0x88d2('0xc')]['split'](/\s+/);return _0x32703c['length']?_0x32703c[_0x88d2('0xd')](0x0,-0x1)[_0x88d2('0xe')]('\x20'):_0x957420['name'];}return _0x88d2('0xf');}function getLastName(_0x1e08ef){var _0xe83864=_[_0x88d2('0x7')](_0x1e08ef[_0x88d2('0x8')]);if(_0xe83864&&_0xe83864[_0x88d2('0xc')]){var _0x3587a8=_0xe83864[_0x88d2('0xc')][_0x88d2('0x10')](/\s+/);return _0x3587a8[_0x88d2('0x11')]>0x1?_0x3587a8[_0x88d2('0x12')]():'';}return'';}function getMails(_0x37d09e,_0x26cd61){var _0x336262='';for(var _0x36761b=0x0;_0x36761b<_0x26cd61[_0x88d2('0x8')][_0x88d2('0x11')];_0x36761b+=0x1){if(_0x26cd61[_0x88d2('0x8')][_0x36761b][_0x88d2('0x9')]!==_0x37d09e){if(!_[_0x88d2('0x13')](_0x336262)){_0x336262+=',';}_0x336262+=_0x26cd61[_0x88d2('0x8')][_0x36761b][_0x88d2('0xc')]||_0x26cd61[_0x88d2('0x8')][_0x36761b][_0x88d2('0x9')]||'';_0x336262+='\x20<';_0x336262+=_0x26cd61[_0x88d2('0x8')][_0x36761b]['address']?_0x26cd61[_0x88d2('0x8')][_0x36761b][_0x88d2('0x9')]:_0x88d2('0xa')+random[_0x88d2('0xb')](0x6)+_0x88d2('0x14');_0x336262+='>';}}return _0x336262;}function parseEmail(_0x8d9f91,_0x401c41,_0x3332c3){if(_0x401c41[_0x88d2('0x15')]){var _0x3b5556=/)<[^<]*)*<\/script>/gi;while(_0x3b5556[_0x88d2('0x16')](_0x401c41['html'])){_0x401c41[_0x88d2('0x15')]=_0x401c41[_0x88d2('0x15')][_0x88d2('0x17')](_0x3b5556,'');}_0x3332c3[_0x88d2('0x18')]=_0x401c41[_0x88d2('0x15')];}else{_0x3332c3['body']=_0x401c41[_0x88d2('0x19')];}if(_0x3332c3['body']){_0x3332c3['body']=_0x3332c3[_0x88d2('0x18')][_0x88d2('0x17')](/0x0){if(this[_0x5c057a+_0x8ea2('0x2a')]>0x0&&this[_0x5c057a+_0x8ea2('0x29')]>=this[_0x5c057a+_0x8ea2('0x2a')]){return _0x8ea2('0x2b');}else{return _0x8ea2('0x2c');}}else{return _0x8ea2('0x2d');}};Agent[_0x8ea2('0x27')][_0x8ea2('0x2e')]=function(){var _0x4d5030=[_0x8ea2('0x2f'),'chat',_0x8ea2('0x30'),_0x8ea2('0x31'),_0x8ea2('0x32'),'whatsapp'];for(var _0x53ed43=0x0;_0x53ed43<_0x4d5030[_0x8ea2('0x33')];_0x53ed43+=0x1){var _0x4dc7bf=this[_0x8ea2('0x28')](_0x4d5030[_0x53ed43]);if(this[_0x4d5030[_0x53ed43]+'Status']!==_0x4dc7bf){this[_0x4d5030[_0x53ed43]+_0x8ea2('0x34')]=_[_0x8ea2('0x35')](moment()[_0x8ea2('0x36')]('x'));}this[_0x4d5030[_0x53ed43]+_0x8ea2('0x37')]=_0x4dc7bf;}var _0x4e1b90={'id':this['id'],'name':this['name'],'online':this[_0x8ea2('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x8ea2('0xb')],'mailPause':this[_0x8ea2('0xc')],'smsPause':this[_0x8ea2('0xe')],'faxPause':this[_0x8ea2('0xd')],'openchannelPause':this[_0x8ea2('0xf')],'chatStatus':this[_0x8ea2('0x10')],'chatStatusTime':this[_0x8ea2('0x38')],'chatCapacity':this[_0x8ea2('0x12')],'chatCurrentCapacity':this[_0x8ea2('0x13')],'mailStatus':this[_0x8ea2('0x14')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x8ea2('0x39')],'faxStatus':this[_0x8ea2('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x8ea2('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x8ea2('0x1b')],'smsCapacity':this[_0x8ea2('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x8ea2('0x1e')],'whatsappStatusTime':this[_0x8ea2('0x1f')],'whatsappCapacity':this[_0x8ea2('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x8ea2('0x24')],'openchannelCurrentCapacity':this[_0x8ea2('0x3a')],'busy':this[_0x8ea2('0x25')],'busyQueue':this['busyQueue']};var _0x456487=md5(JSON[_0x8ea2('0x3b')](_0x4e1b90));if(this[_0x8ea2('0x2')]!==_0x456487){this[_0x8ea2('0x2')]=_0x456487;io[_0x8ea2('0x3c')](_0x8ea2('0x3d'),_0x4e1b90);}};module[_0x8ea2('0x3e')]=Agent; \ No newline at end of file +var _0xefe2=['updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','faxPause','mailCapacity','faxStatusTime','whatsappStatus','md5','emit','user:save','lodash','moment','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue'];(function(_0xc80702,_0x18ef50){var _0x4c4c76=function(_0x24ee31){while(--_0x24ee31){_0xc80702['push'](_0xc80702['shift']());}};_0x4c4c76(++_0x18ef50);}(_0xefe2,0xd9));var _0x2efe=function(_0x180fa9,_0x5474d2){_0x180fa9=_0x180fa9-0x0;var _0x15c151=_0xefe2[_0x180fa9];return _0x15c151;};'use strict';var _=require(_0x2efe('0x0'));var moment=require(_0x2efe('0x1'));var md5=require('md5');var Redis=require(_0x2efe('0x2'));var config=require(_0x2efe('0x3'));config['redis']=_[_0x2efe('0x4')](config['redis'],{'host':_0x2efe('0x5'),'port':0x18eb});var io=require(_0x2efe('0x6'))(new Redis(config[_0x2efe('0x7')]));function Agent(_0x300cb7){this['id']=_0x300cb7['id']||0x0;this[_0x2efe('0x8')]=_0x300cb7['name']||'';this[_0x2efe('0x9')]=_0x300cb7[_0x2efe('0x9')]||!![];this[_0x2efe('0xa')]=_0x300cb7[_0x2efe('0xa')]||![];this['chatPause']=_0x300cb7[_0x2efe('0xb')]||![];this[_0x2efe('0xc')]=_0x300cb7[_0x2efe('0xc')]||![];this['faxPause']=_0x300cb7['faxPause']||![];this[_0x2efe('0xd')]=_0x300cb7['smsPause']||![];this['openchannelPause']=_0x300cb7[_0x2efe('0xe')]||![];this[_0x2efe('0xf')]=_0x2efe('0x10');this[_0x2efe('0x11')]=0x0;this[_0x2efe('0x12')]=_0x300cb7[_0x2efe('0x12')]||0x0;this[_0x2efe('0x13')]=0x0;this[_0x2efe('0x14')]=_0x2efe('0x10');this[_0x2efe('0x15')]=0x0;this['mailCapacity']=_0x300cb7['mailCapacity']||0x0;this[_0x2efe('0x16')]=0x0;this[_0x2efe('0x17')]='unknown';this['faxStatusTime']=0x0;this[_0x2efe('0x18')]=_0x300cb7['faxCapacity']||0x0;this[_0x2efe('0x19')]=0x0;this[_0x2efe('0x1a')]='unknown';this[_0x2efe('0x1b')]=0x0;this[_0x2efe('0x1c')]=_0x300cb7['smsCapacity']||0x0;this[_0x2efe('0x1d')]=0x0;this['whatsappStatus']='unknown';this[_0x2efe('0x1e')]=0x0;this[_0x2efe('0x1f')]=_0x300cb7[_0x2efe('0x1f')]||0x0;this[_0x2efe('0x20')]=0x0;this[_0x2efe('0x21')]=_0x2efe('0x10');this[_0x2efe('0x22')]=0x0;this[_0x2efe('0x23')]=_0x300cb7[_0x2efe('0x23')]||0x0;this[_0x2efe('0x24')]=0x0;this[_0x2efe('0x25')]=![];this[_0x2efe('0x26')]=undefined;this['md5']='';this[_0x2efe('0x27')]();}Agent['prototype'][_0x2efe('0x28')]=function(_0x6e7b56){if(this[_0x6e7b56+_0x2efe('0x29')]>0x0){if(this[_0x6e7b56+'Capacity']>0x0&&this[_0x6e7b56+_0x2efe('0x29')]>=this[_0x6e7b56+_0x2efe('0x2a')]){return'maxcapacity';}else{return _0x2efe('0x2b');}}else{return _0x2efe('0x2c');}};Agent[_0x2efe('0x2d')][_0x2efe('0x27')]=function(){var _0x29c7c2=[_0x2efe('0x2e'),_0x2efe('0x2f'),_0x2efe('0x30'),_0x2efe('0x31'),_0x2efe('0x32'),_0x2efe('0x33')];for(var _0x26080e=0x0;_0x26080e<_0x29c7c2[_0x2efe('0x34')];_0x26080e+=0x1){var _0x255330=this['getChannelStatus'](_0x29c7c2[_0x26080e]);if(this[_0x29c7c2[_0x26080e]+_0x2efe('0x35')]!==_0x255330){this[_0x29c7c2[_0x26080e]+_0x2efe('0x36')]=_[_0x2efe('0x37')](moment()[_0x2efe('0x38')]('x'));}this[_0x29c7c2[_0x26080e]+_0x2efe('0x35')]=_0x255330;}var _0x431394={'id':this['id'],'name':this[_0x2efe('0x8')],'online':this[_0x2efe('0x9')],'voicePause':this[_0x2efe('0xa')],'chatPause':this[_0x2efe('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0x2efe('0xd')],'faxPause':this[_0x2efe('0x39')],'openchannelPause':this[_0x2efe('0xe')],'chatStatus':this[_0x2efe('0xf')],'chatStatusTime':this[_0x2efe('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2efe('0x13')],'mailStatus':this[_0x2efe('0x14')],'mailStatusTime':this[_0x2efe('0x15')],'mailCapacity':this[_0x2efe('0x3a')],'mailCurrentCapacity':this[_0x2efe('0x16')],'faxStatus':this[_0x2efe('0x17')],'faxStatusTime':this[_0x2efe('0x3b')],'faxCapacity':this[_0x2efe('0x18')],'faxCurrentCapacity':this[_0x2efe('0x19')],'smsStatus':this[_0x2efe('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x2efe('0x1c')],'smsCurrentCapacity':this[_0x2efe('0x1d')],'whatsappStatus':this[_0x2efe('0x3c')],'whatsappStatusTime':this[_0x2efe('0x1e')],'whatsappCapacity':this[_0x2efe('0x1f')],'whatsappCurrentCapacity':this[_0x2efe('0x20')],'openchannelStatus':this[_0x2efe('0x21')],'openchannelStatusTime':this[_0x2efe('0x22')],'openchannelCapacity':this[_0x2efe('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x2efe('0x25')],'busyQueue':this[_0x2efe('0x26')]};var _0x52823d=md5(JSON['stringify'](_0x431394));if(this['md5']!==_0x52823d){this[_0x2efe('0x3d')]=_0x52823d;io[_0x2efe('0x3e')](_0x2efe('0x3f'),_0x431394);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ce24e83..6faf7d1 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 _0x0081=['defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','waiting','stringify','format','exports','lodash','util','ioredis','redis'];(function(_0x438eb6,_0x44d872){var _0x25c144=function(_0x4f18b9){while(--_0x4f18b9){_0x438eb6['push'](_0x438eb6['shift']());}};_0x25c144(++_0x44d872);}(_0x0081,0x1c7));var _0x1008=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x0081[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x1008('0x0'));var md5=require('md5');var util=require(_0x1008('0x1'));var Redis=require(_0x1008('0x2'));var config=require('../../../config/environment');config[_0x1008('0x3')]=_[_0x1008('0x4')](config[_0x1008('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1008('0x3')]));function ChatQueue(_0x2fe16b){this['id']=_0x2fe16b['id']||0x0;this[_0x1008('0x5')]=_0x2fe16b[_0x1008('0x5')]||'';this[_0x1008('0x6')]=_0x2fe16b[_0x1008('0x6')]||0xa;this[_0x1008('0x7')]=_0x2fe16b[_0x1008('0x7')]||_0x1008('0x8');this[_0x1008('0x9')]=_0x2fe16b[_0x1008('0x9')];this[_0x1008('0xa')]={};this['waiting']=0x0;this[_0x1008('0xb')]='';this[_0x1008('0xc')]();this[_0x1008('0xd')]();}ChatQueue[_0x1008('0xe')][_0x1008('0xc')]=function(){var _0x234ee5=this[_0x1008('0xa')][_0x1008('0xf')];this[_0x1008('0xa')]=_[_0x1008('0x10')](this[_0x1008('0x9')],'id');this[_0x1008('0xa')]['_rr']=_0x234ee5;};ChatQueue[_0x1008('0xe')][_0x1008('0xd')]=function(){this[_0x1008('0x11')]=0x0;this[_0x1008('0x12')]=0x0;for(var _0x2b1d19=0x0;_0x2b1d19=0x0?this['available']:0x0;var _0x4355fa={'id':this['id'],'available':this[_0x1008('0x16')],'loggedIn':this[_0x1008('0x11')],'name':this['name'],'paused':this[_0x1008('0x12')],'waiting':this[_0x1008('0x17')]};var _0x370272=md5(JSON[_0x1008('0x18')](_0x4355fa));if(this['md5']!==_0x370272){this[_0x1008('0xb')]=_0x370272;io['to'](util[_0x1008('0x19')]('chat:queue:%s',_0x4355fa[_0x1008('0x5')]))['emit']('chat_queue:save',_0x4355fa);}};module[_0x1008('0x1a')]=ChatQueue; \ No newline at end of file +var _0x6a0c=['chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','length','online','available','paused','stringify','chat:queue:%s','emit'];(function(_0xc7283d,_0x2083c7){var _0x226023=function(_0x43791a){while(--_0x43791a){_0xc7283d['push'](_0xc7283d['shift']());}};_0x226023(++_0x2083c7);}(_0x6a0c,0x1e2));var _0xc6a0=function(_0x44b317,_0x254776){_0x44b317=_0x44b317-0x0;var _0x390892=_0x6a0c[_0x44b317];return _0x390892;};'use strict';var _=require(_0xc6a0('0x0'));var md5=require(_0xc6a0('0x1'));var util=require(_0xc6a0('0x2'));var Redis=require(_0xc6a0('0x3'));var config=require(_0xc6a0('0x4'));config['redis']=_['defaults'](config[_0xc6a0('0x5')],{'host':_0xc6a0('0x6'),'port':0x18eb});var io=require(_0xc6a0('0x7'))(new Redis(config[_0xc6a0('0x5')]));function ChatQueue(_0x33b4d4){this['id']=_0x33b4d4['id']||0x0;this[_0xc6a0('0x8')]=_0x33b4d4[_0xc6a0('0x8')]||'';this[_0xc6a0('0x9')]=_0x33b4d4[_0xc6a0('0x9')]||0xa;this[_0xc6a0('0xa')]=_0x33b4d4['strategy']||_0xc6a0('0xb');this[_0xc6a0('0xc')]=_0x33b4d4[_0xc6a0('0xc')];this['mapAgentsId']={};this[_0xc6a0('0xd')]=0x0;this[_0xc6a0('0x1')]='';this[_0xc6a0('0xe')]();this[_0xc6a0('0xf')]();}ChatQueue[_0xc6a0('0x10')][_0xc6a0('0xe')]=function(){var _0x6d1299=this[_0xc6a0('0x11')]['_rr'];this['mapAgentsId']=_[_0xc6a0('0x12')](this[_0xc6a0('0xc')],'id');this[_0xc6a0('0x11')][_0xc6a0('0x13')]=_0x6d1299;};ChatQueue[_0xc6a0('0x10')][_0xc6a0('0xf')]=function(){this[_0xc6a0('0x14')]=0x0;this['paused']=0x0;for(var _0x3122fe=0x0;_0x3122fe=0x0?this[_0xc6a0('0x17')]:0x0;var _0x3de065={'id':this['id'],'available':this[_0xc6a0('0x17')],'loggedIn':this[_0xc6a0('0x14')],'name':this[_0xc6a0('0x8')],'paused':this['paused'],'waiting':this[_0xc6a0('0xd')]};var _0x1a702d=md5(JSON[_0xc6a0('0x19')](_0x3de065));if(this[_0xc6a0('0x1')]!==_0x1a702d){this[_0xc6a0('0x1')]=_0x1a702d;io['to'](util['format'](_0xc6a0('0x1a'),_0x3de065[_0xc6a0('0x8')]))[_0xc6a0('0x1b')](_0xc6a0('0x1c'),_0x3de065);}};module[_0xc6a0('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 52fcbc3..e54306f 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(_0x2e5250,_0x5e5597){var _0x376540=function(_0x1595e3){while(--_0x1595e3){_0x2e5250['push'](_0x2e5250['shift']());}};_0x376540(++_0x5e5597);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x5c3568,_0x4a428e){var _0x568605=function(_0x280b52){while(--_0x280b52){_0x5c3568['push'](_0x5c3568['shift']());}};_0x568605(++_0x4a428e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d61caff..a3f1ed2 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 _0xde17=['Intervals','exports','name'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xde17,0xec));var _0x7de1=function(_0x53c4a2,_0x2c60c4){_0x53c4a2=_0x53c4a2-0x0;var _0x2fd4b7=_0xde17[_0x53c4a2];return _0x2fd4b7;};'use strict';function Interval(_0x204d32){this['id']=_0x204d32['id']||0x0;this[_0x7de1('0x0')]=_0x204d32['name']||'';this[_0x7de1('0x1')]=_0x204d32['Intervals']||{};}module[_0x7de1('0x2')]=Interval; \ No newline at end of file +var _0x4231=['exports','name','Intervals'];(function(_0x1bd822,_0x1c8078){var _0x3c3a69=function(_0x565eb3){while(--_0x565eb3){_0x1bd822['push'](_0x1bd822['shift']());}};_0x3c3a69(++_0x1c8078);}(_0x4231,0x6d));var _0x1423=function(_0x2fe959,_0x351d77){_0x2fe959=_0x2fe959-0x0;var _0x2f6ace=_0x4231[_0x2fe959];return _0x2f6ace;};'use strict';function Interval(_0x15347a){this['id']=_0x15347a['id']||0x0;this['name']=_0x15347a[_0x1423('0x0')]||'';this[_0x1423('0x1')]=_0x15347a[_0x1423('0x1')]||{};}module[_0x1423('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 9c67d3e..4e3bab1 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 _0x8328=['updateRealtime','loggedIn','length','paused','available','md5','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','_rr','mapAgentsId','map'];(function(_0x3f9f2d,_0xd78f12){var _0x31be33=function(_0x38b133){while(--_0x38b133){_0x3f9f2d['push'](_0x3f9f2d['shift']());}};_0x31be33(++_0xd78f12);}(_0x8328,0xb3));var _0x8832=function(_0x416e83,_0x324c39){_0x416e83=_0x416e83-0x0;var _0x36724e=_0x8328[_0x416e83];return _0x36724e;};'use strict';var _=require(_0x8832('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x8832('0x1'));config[_0x8832('0x2')]=_[_0x8832('0x3')](config[_0x8832('0x2')],{'host':_0x8832('0x4'),'port':0x18eb});var io=require(_0x8832('0x5'))(new Redis(config['redis']));function MailQueue(_0x2f3e50){this['id']=_0x2f3e50['id']||0x0;this[_0x8832('0x6')]=_0x2f3e50['name']||'';this[_0x8832('0x7')]=_0x2f3e50[_0x8832('0x7')]||0xa;this['strategy']=_0x2f3e50[_0x8832('0x8')]||_0x8832('0x9');this[_0x8832('0xa')]=_0x2f3e50[_0x8832('0xa')];this['mapAgentsId']={};this[_0x8832('0xb')]=0x0;this['md5']='';this[_0x8832('0xc')]();this['updateRealtime']();}MailQueue[_0x8832('0xd')][_0x8832('0xc')]=function(){var _0x3d3817=this['mapAgentsId'][_0x8832('0xe')];this[_0x8832('0xf')]=_[_0x8832('0x10')](this[_0x8832('0xa')],'id');this['mapAgentsId']['_rr']=_0x3d3817;};MailQueue[_0x8832('0xd')][_0x8832('0x11')]=function(){this[_0x8832('0x12')]=0x0;this['paused']=0x0;for(var _0x494bfc=0x0;_0x494bfc=0x0?this['available']:0x0;var _0x38b96d={'id':this['id'],'available':this[_0x8832('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x8832('0x6')],'paused':this['paused'],'waiting':this[_0x8832('0xb')]};var _0x26a3b9=md5(JSON['stringify'](_0x38b96d));if(this[_0x8832('0x16')]!==_0x26a3b9){this['md5']=_0x26a3b9;io['to'](util[_0x8832('0x17')](_0x8832('0x18'),_0x38b96d[_0x8832('0x6')]))[_0x8832('0x19')](_0x8832('0x1a'),_0x38b96d);}};module[_0x8832('0x1b')]=MailQueue; \ No newline at end of file +var _0x6df4=['stringify','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','mailPause','paused','available','waiting'];(function(_0x20ef83,_0xea60f9){var _0x18c673=function(_0x57653d){while(--_0x57653d){_0x20ef83['push'](_0x20ef83['shift']());}};_0x18c673(++_0xea60f9);}(_0x6df4,0xa6));var _0x46df=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x6df4[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x46df('0x0'));var md5=require(_0x46df('0x1'));var util=require(_0x46df('0x2'));var Redis=require('ioredis');var config=require(_0x46df('0x3'));config['redis']=_['defaults'](config[_0x46df('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x2ac671){this['id']=_0x2ac671['id']||0x0;this[_0x46df('0x5')]=_0x2ac671[_0x46df('0x5')]||'';this[_0x46df('0x6')]=_0x2ac671[_0x46df('0x6')]||0xa;this[_0x46df('0x7')]=_0x2ac671[_0x46df('0x7')]||_0x46df('0x8');this['Agents']=_0x2ac671[_0x46df('0x9')];this[_0x46df('0xa')]={};this['waiting']=0x0;this[_0x46df('0x1')]='';this[_0x46df('0xb')]();this[_0x46df('0xc')]();}MailQueue['prototype']['updateRouting']=function(){var _0x463124=this[_0x46df('0xa')][_0x46df('0xd')];this[_0x46df('0xa')]=_[_0x46df('0xe')](this[_0x46df('0x9')],'id');this['mapAgentsId'][_0x46df('0xd')]=_0x463124;};MailQueue[_0x46df('0xf')][_0x46df('0xc')]=function(){this[_0x46df('0x10')]=0x0;this['paused']=0x0;for(var _0x350f37=0x0;_0x350f37=0x0?this[_0x46df('0x15')]:0x0;var _0x3ceb0f={'id':this['id'],'available':this[_0x46df('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x46df('0x5')],'paused':this['paused'],'waiting':this[_0x46df('0x16')]};var _0x2936f0=md5(JSON[_0x46df('0x17')](_0x3ceb0f));if(this[_0x46df('0x1')]!==_0x2936f0){this[_0x46df('0x1')]=_0x2936f0;io['to'](util['format'](_0x46df('0x18'),_0x3ceb0f[_0x46df('0x5')]))[_0x46df('0x19')](_0x46df('0x1a'),_0x3ceb0f);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 7883611..82b0970 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 _0x64e6=['mapAgentsId','updateRouting','_rr','map','Agents','prototype','updateRealtime','paused','length','online','available','loggedIn','waiting','format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall'];(function(_0x4b985b,_0xad0c8f){var _0x15b6b2=function(_0x361aea){while(--_0x361aea){_0x4b985b['push'](_0x4b985b['shift']());}};_0x15b6b2(++_0xad0c8f);}(_0x64e6,0xa4));var _0x664e=function(_0x4e6766,_0x52b8bb){_0x4e6766=_0x4e6766-0x0;var _0x3a0eb4=_0x64e6[_0x4e6766];return _0x3a0eb4;};'use strict';var _=require('lodash');var md5=require(_0x664e('0x0'));var util=require(_0x664e('0x1'));var Redis=require(_0x664e('0x2'));var config=require(_0x664e('0x3'));config[_0x664e('0x4')]=_[_0x664e('0x5')](config[_0x664e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x664e('0x6'))(new Redis(config[_0x664e('0x4')]));function OpenchannelQueue(_0x4abed6){this['id']=_0x4abed6['id']||0x0;this['name']=_0x4abed6['name']||'';this[_0x664e('0x7')]=_0x4abed6['timeout']||0xa;this[_0x664e('0x8')]=_0x4abed6['strategy']||_0x664e('0x9');this['Agents']=_0x4abed6['Agents'];this[_0x664e('0xa')]={};this['waiting']=0x0;this[_0x664e('0x0')]='';this[_0x664e('0xb')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x664e('0xb')]=function(){var _0x2141f8=this[_0x664e('0xa')][_0x664e('0xc')];this[_0x664e('0xa')]=_[_0x664e('0xd')](this[_0x664e('0xe')],'id');this[_0x664e('0xa')]['_rr']=_0x2141f8;};OpenchannelQueue[_0x664e('0xf')][_0x664e('0x10')]=function(){this['loggedIn']=0x0;this[_0x664e('0x11')]=0x0;for(var _0x493c73=0x0;_0x493c73=0x0?this[_0x664e('0x14')]:0x0;var _0x246b32={'id':this['id'],'available':this[_0x664e('0x14')],'loggedIn':this[_0x664e('0x15')],'name':this['name'],'paused':this[_0x664e('0x11')],'waiting':this[_0x664e('0x16')]};var _0x523f8b=md5(JSON['stringify'](_0x246b32));if(this['md5']!==_0x523f8b){this[_0x664e('0x0')]=_0x523f8b;io['to'](util[_0x664e('0x17')](_0x664e('0x18'),_0x246b32[_0x664e('0x19')]))[_0x664e('0x1a')](_0x664e('0x1b'),_0x246b32);}};module[_0x664e('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x25bc=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','prototype','map','mapAgentsId','_rr','loggedIn','paused','length','online','openchannelPause','available','stringify','openchannel:queue:%s','emit','exports','md5','util','ioredis'];(function(_0x39c28c,_0x3b06d0){var _0x57d332=function(_0x2a351d){while(--_0x2a351d){_0x39c28c['push'](_0x39c28c['shift']());}};_0x57d332(++_0x3b06d0);}(_0x25bc,0x185));var _0xc25b=function(_0x30be35,_0x1b6b24){_0x30be35=_0x30be35-0x0;var _0x50d2d8=_0x25bc[_0x30be35];return _0x50d2d8;};'use strict';var _=require('lodash');var md5=require(_0xc25b('0x0'));var util=require(_0xc25b('0x1'));var Redis=require(_0xc25b('0x2'));var config=require(_0xc25b('0x3'));config[_0xc25b('0x4')]=_[_0xc25b('0x5')](config[_0xc25b('0x4')],{'host':_0xc25b('0x6'),'port':0x18eb});var io=require(_0xc25b('0x7'))(new Redis(config[_0xc25b('0x4')]));function OpenchannelQueue(_0x1eb009){this['id']=_0x1eb009['id']||0x0;this['name']=_0x1eb009[_0xc25b('0x8')]||'';this['timeout']=_0x1eb009[_0xc25b('0x9')]||0xa;this['strategy']=_0x1eb009[_0xc25b('0xa')]||'beepall';this[_0xc25b('0xb')]=_0x1eb009['Agents'];this['mapAgentsId']={};this[_0xc25b('0xc')]=0x0;this[_0xc25b('0x0')]='';this[_0xc25b('0xd')]();this['updateRealtime']();}OpenchannelQueue[_0xc25b('0xe')][_0xc25b('0xd')]=function(){var _0x2d5b2d=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xc25b('0xf')](this['Agents'],'id');this[_0xc25b('0x10')][_0xc25b('0x11')]=_0x2d5b2d;};OpenchannelQueue[_0xc25b('0xe')]['updateRealtime']=function(){this[_0xc25b('0x12')]=0x0;this[_0xc25b('0x13')]=0x0;for(var _0x5d6d88=0x0;_0x5d6d88=0x0?this[_0xc25b('0x17')]:0x0;var _0x5d30ec={'id':this['id'],'available':this[_0xc25b('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xc25b('0x8')],'paused':this[_0xc25b('0x13')],'waiting':this[_0xc25b('0xc')]};var _0x45acf1=md5(JSON[_0xc25b('0x18')](_0x5d30ec));if(this[_0xc25b('0x0')]!==_0x45acf1){this['md5']=_0x45acf1;io['to'](util['format'](_0xc25b('0x19'),_0x5d30ec[_0xc25b('0x8')]))[_0xc25b('0x1a')]('openchannel_queue:save',_0x5d30ec);}};module[_0xc25b('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 2690a80..7b5d3ee 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 _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x4bf14c,_0x2fd00d){var _0x3423e6=function(_0x31af91){while(--_0x31af91){_0x4bf14c['push'](_0x4bf14c['shift']());}};_0x3423e6(++_0x2fd00d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x1b8318,_0x4984fc){var _0x400698=function(_0x3dba1d){while(--_0x3dba1d){_0x1b8318['push'](_0x1b8318['shift']());}};_0x400698(++_0x4984fc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7fcf2c6..fbbbed2 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 _0xea6a=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','_rr','map','updateRealtime','loggedIn','length','online','available','paused','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash'];(function(_0x20748a,_0x197d91){var _0x4296f8=function(_0x4ae51f){while(--_0x4ae51f){_0x20748a['push'](_0x20748a['shift']());}};_0x4296f8(++_0x197d91);}(_0xea6a,0x151));var _0xaea6=function(_0x2ff065,_0x5e96cb){_0x2ff065=_0x2ff065-0x0;var _0x834a38=_0xea6a[_0x2ff065];return _0x834a38;};'use strict';var _=require(_0xaea6('0x0'));var md5=require(_0xaea6('0x1'));var util=require('util');var Redis=require(_0xaea6('0x2'));var config=require(_0xaea6('0x3'));config[_0xaea6('0x4')]=_[_0xaea6('0x5')](config['redis'],{'host':_0xaea6('0x6'),'port':0x18eb});var io=require(_0xaea6('0x7'))(new Redis(config[_0xaea6('0x4')]));function WhatsappQueue(_0x473a38){this['id']=_0x473a38['id']||0x0;this[_0xaea6('0x8')]=_0x473a38['name']||'';this[_0xaea6('0x9')]=_0x473a38['timeout']||0xa;this['strategy']=_0x473a38['strategy']||'beepall';this[_0xaea6('0xa')]=_0x473a38[_0xaea6('0xa')];this[_0xaea6('0xb')]={};this[_0xaea6('0xc')]=0x0;this[_0xaea6('0x1')]='';this[_0xaea6('0xd')]();this['updateRealtime']();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x2e8940=this[_0xaea6('0xb')][_0xaea6('0xe')];this[_0xaea6('0xb')]=_[_0xaea6('0xf')](this[_0xaea6('0xa')],'id');this[_0xaea6('0xb')][_0xaea6('0xe')]=_0x2e8940;};WhatsappQueue['prototype'][_0xaea6('0x10')]=function(){this[_0xaea6('0x11')]=0x0;this['paused']=0x0;for(var _0x12bffa=0x0;_0x12bffa=0x0?this[_0xaea6('0x14')]:0x0;var _0x4d68ff={'id':this['id'],'available':this[_0xaea6('0x14')],'loggedIn':this[_0xaea6('0x11')],'name':this['name'],'paused':this[_0xaea6('0x15')],'waiting':this['waiting']};var _0x29b498=md5(JSON['stringify'](_0x4d68ff));if(this[_0xaea6('0x1')]!==_0x29b498){this['md5']=_0x29b498;io['to'](util[_0xaea6('0x16')](_0xaea6('0x17'),_0x4d68ff[_0xaea6('0x8')]))[_0xaea6('0x18')](_0xaea6('0x19'),_0x4d68ff);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xae24=['emit','whatsapp_queue:save','exports','util','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','whatsappPause','paused','available','stringify','md5','format','whatsapp:queue:%s'];(function(_0x352c6e,_0x2d7a58){var _0x78b56c=function(_0x2228e0){while(--_0x2228e0){_0x352c6e['push'](_0x352c6e['shift']());}};_0x78b56c(++_0x2d7a58);}(_0xae24,0x12c));var _0x4ae2=function(_0x7d4827,_0x14c2e4){_0x7d4827=_0x7d4827-0x0;var _0x45fc9e=_0xae24[_0x7d4827];return _0x45fc9e;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x4ae2('0x0'));var Redis=require('ioredis');var config=require(_0x4ae2('0x1'));config[_0x4ae2('0x2')]=_['defaults'](config[_0x4ae2('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4ae2('0x2')]));function WhatsappQueue(_0x473558){this['id']=_0x473558['id']||0x0;this[_0x4ae2('0x3')]=_0x473558[_0x4ae2('0x3')]||'';this[_0x4ae2('0x4')]=_0x473558[_0x4ae2('0x4')]||0xa;this[_0x4ae2('0x5')]=_0x473558[_0x4ae2('0x5')]||_0x4ae2('0x6');this[_0x4ae2('0x7')]=_0x473558['Agents'];this[_0x4ae2('0x8')]={};this[_0x4ae2('0x9')]=0x0;this['md5']='';this[_0x4ae2('0xa')]();this[_0x4ae2('0xb')]();}WhatsappQueue[_0x4ae2('0xc')]['updateRouting']=function(){var _0x429ba3=this[_0x4ae2('0x8')]['_rr'];this[_0x4ae2('0x8')]=_[_0x4ae2('0xd')](this['Agents'],'id');this[_0x4ae2('0x8')][_0x4ae2('0xe')]=_0x429ba3;};WhatsappQueue['prototype'][_0x4ae2('0xb')]=function(){this[_0x4ae2('0xf')]=0x0;this['paused']=0x0;for(var _0x2d2d21=0x0;_0x2d2d21=0x0?this['available']:0x0;var _0x43cc44={'id':this['id'],'available':this[_0x4ae2('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x4ae2('0x3')],'paused':this[_0x4ae2('0x12')],'waiting':this[_0x4ae2('0x9')]};var _0x22b073=md5(JSON[_0x4ae2('0x14')](_0x43cc44));if(this['md5']!==_0x22b073){this[_0x4ae2('0x15')]=_0x22b073;io['to'](util[_0x4ae2('0x16')](_0x4ae2('0x17'),_0x43cc44[_0x4ae2('0x3')]))[_0x4ae2('0x18')](_0x4ae2('0x19'),_0x43cc44);}};module[_0x4ae2('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1a661de..0d1846d 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 _0x8ef6=['mergeFromDatabase','initAgents','length','agents','intervals','isUndefined','updateRouting','initChatQueues','updateRealtime','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8ef6,0xf2));var _0x68ef=function(_0x39d7bf,_0x69ed35){_0x39d7bf=_0x39d7bf-0x0;var _0x3f6663=_0x8ef6[_0x39d7bf];return _0x3f6663;};'use strict';var BPromise=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var moment=require(_0x68ef('0x3'));var Agent=require(_0x68ef('0x4'));var Interval=require(_0x68ef('0x5'));var OpenchannelQueue=require(_0x68ef('0x6'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0x68ef('0x7'));var MailQueue=require(_0x68ef('0x8'));var FaxQueue=require(_0x68ef('0x9'));var WhatsappQueue=require(_0x68ef('0xa'));var Realtime=function(){this['agents']={};this['intervals']={};this[_0x68ef('0xb')]={};this[_0x68ef('0xc')]={};this[_0x68ef('0xd')]={};this['mailQueues']={};this[_0x68ef('0xe')]={};this[_0x68ef('0xf')]={};this[_0x68ef('0x10')]={};this[_0x68ef('0x11')]={};this[_0x68ef('0x12')]={};this[_0x68ef('0x13')]={};this[_0x68ef('0x14')]={};this[_0x68ef('0x15')]={};};function freeIsNotKey(_0x1f6747,_0x255c85,_0x3afc1d){var _0xfa6763=_['mapKeys'](_0x1f6747,function(_0x1aa045,_0x46356f){return _0x1aa045[_0x3afc1d];});for(var _0x1e117a in _0x255c85){if(_0x255c85[_0x68ef('0x16')](_0x1e117a)){if(!_0xfa6763[_0x1e117a]){delete _0x255c85[_0x1e117a];}}}}Realtime[_0x68ef('0x17')][_0x68ef('0x18')]=function(_0x508671,_0x3b48dd){for(var _0xc50cce in _0x3b48dd){if(_0x508671[_0x68ef('0x16')](_0xc50cce)){_0x508671[_0xc50cce]=_0x3b48dd[_0xc50cce];}}};Realtime['prototype'][_0x68ef('0x19')]=function(){var _0x1764de=this;return function(_0x24682d){if(_0x24682d){freeIsNotKey(_0x24682d,_0x1764de['agents'],'id');for(var _0x35493d=0x0,_0x37c4cc={},_0x3d1e90={};_0x35493d<_0x24682d[_0x68ef('0x1a')];_0x35493d+=0x1){_0x37c4cc=_0x24682d[_0x35493d];if(_['isUndefined'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']])){_0x1764de['agents'][_0x37c4cc['id']]=new Agent(_0x37c4cc);}else{_0x1764de['mergeFromDatabase'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']],_0x37c4cc);}}}return _0x1764de[_0x68ef('0x1b')];};};Realtime['prototype']['initIntervals']=function(){var _0x3c4c1f=this;return function(_0x2cd92c){if(_0x2cd92c){freeIsNotKey(_0x2cd92c,_0x3c4c1f[_0x68ef('0x1c')],'id');for(var _0x4fad1c=0x0,_0x1dc49c={},_0x36a4cb={};_0x4fad1c<_0x2cd92c[_0x68ef('0x1a')];_0x4fad1c+=0x1){_0x1dc49c=_0x2cd92c[_0x4fad1c];if(_['isUndefined'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']])){_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']]=new Interval(_0x1dc49c);}else{_0x3c4c1f['mergeFromDatabase'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']],_0x1dc49c);}}}return _0x3c4c1f[_0x68ef('0x1c')];};};Realtime[_0x68ef('0x17')]['initOpenchannelQueues']=function(){var _0x59723c=this;return function(_0x59bebc){if(_0x59bebc){freeIsNotKey(_0x59bebc,_0x59723c[_0x68ef('0xb')],'id');for(var _0x2023f2=0x0,_0x312cc9={},_0x2e6e39={};_0x2023f2<_0x59bebc[_0x68ef('0x1a')];_0x2023f2+=0x1){_0x312cc9=_0x59bebc[_0x2023f2];if(_[_0x68ef('0x1d')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']])){_0x59723c[_0x68ef('0xb')][_0x312cc9['id']]=new OpenchannelQueue(_0x312cc9);}else{_0x59723c[_0x68ef('0x18')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']],_0x312cc9);}_0x59723c['openchannelQueues'][_0x312cc9['id']][_0x68ef('0x1e')]();_0x59723c['openchannelQueues'][_0x312cc9['id']]['updateRealtime']();}}return _0x59723c['openchannelQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x1f')]=function(){var _0x123041=this;return function(_0x29518e){if(_0x29518e){freeIsNotKey(_0x29518e,_0x123041['chatQueues'],'id');for(var _0x4a0550=0x0,_0x1cbe4f={},_0x28907a={};_0x4a0550<_0x29518e[_0x68ef('0x1a')];_0x4a0550+=0x1){_0x1cbe4f=_0x29518e[_0x4a0550];if(_[_0x68ef('0x1d')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']])){_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']]=new ChatQueue(_0x1cbe4f);}else{_0x123041[_0x68ef('0x18')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']],_0x1cbe4f);}_0x123041['chatQueues'][_0x1cbe4f['id']][_0x68ef('0x1e')]();_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']][_0x68ef('0x20')]();}}return _0x123041['chatQueues'];};};Realtime[_0x68ef('0x17')]['initSmsQueues']=function(){var _0x133788=this;return function(_0x17588a){if(_0x17588a){freeIsNotKey(_0x17588a,_0x133788['smsQueues'],'id');for(var _0x5e1e1b=0x0,_0x159395={},_0x5fa72a={};_0x5e1e1b<_0x17588a['length'];_0x5e1e1b+=0x1){_0x159395=_0x17588a[_0x5e1e1b];if(_[_0x68ef('0x1d')](_0x133788[_0x68ef('0xd')][_0x159395['id']])){_0x133788[_0x68ef('0xd')][_0x159395['id']]=new SmsQueue(_0x159395);}else{_0x133788[_0x68ef('0x18')](_0x133788['smsQueues'][_0x159395['id']],_0x159395);}_0x133788[_0x68ef('0xd')][_0x159395['id']][_0x68ef('0x1e')]();_0x133788['smsQueues'][_0x159395['id']][_0x68ef('0x20')]();}}return _0x133788['smsQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x21')]=function(){var _0x4973c2=this;return function(_0x24c2c9){if(_0x24c2c9){freeIsNotKey(_0x24c2c9,_0x4973c2['mailQueues'],'id');for(var _0x38c2f8=0x0,_0x575f43={},_0x2fbb0d={};_0x38c2f8<_0x24c2c9[_0x68ef('0x1a')];_0x38c2f8+=0x1){_0x575f43=_0x24c2c9[_0x38c2f8];if(_[_0x68ef('0x1d')](_0x4973c2['mailQueues'][_0x575f43['id']])){_0x4973c2[_0x68ef('0x22')][_0x575f43['id']]=new MailQueue(_0x575f43);}else{_0x4973c2['mergeFromDatabase'](_0x4973c2[_0x68ef('0x22')][_0x575f43['id']],_0x575f43);}_0x4973c2['mailQueues'][_0x575f43['id']][_0x68ef('0x1e')]();_0x4973c2[_0x68ef('0x22')][_0x575f43['id']][_0x68ef('0x20')]();}}return _0x4973c2[_0x68ef('0x22')];};};Realtime[_0x68ef('0x17')][_0x68ef('0x23')]=function(){var _0x51ba3d=this;return function(_0x294fba){if(_0x294fba){freeIsNotKey(_0x294fba,_0x51ba3d[_0x68ef('0xe')],'id');for(var _0x32074a=0x0,_0x52a8b9={},_0x32eddd={};_0x32074a<_0x294fba[_0x68ef('0x1a')];_0x32074a+=0x1){_0x52a8b9=_0x294fba[_0x32074a];if(_[_0x68ef('0x1d')](_0x51ba3d['faxQueues'][_0x52a8b9['id']])){_0x51ba3d['faxQueues'][_0x52a8b9['id']]=new FaxQueue(_0x52a8b9);}else{_0x51ba3d[_0x68ef('0x18')](_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']],_0x52a8b9);}_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x1e')]();_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x20')]();}}return _0x51ba3d[_0x68ef('0xe')];};};Realtime['prototype'][_0x68ef('0x24')]=function(){var _0xd7f9ca=this;return function(_0x2f6ee0){if(_0x2f6ee0){freeIsNotKey(_0x2f6ee0,_0xd7f9ca[_0x68ef('0xf')],'id');for(var _0x492b74=0x0,_0x3cb156={},_0x3a2f53={};_0x492b74<_0x2f6ee0[_0x68ef('0x1a')];_0x492b74+=0x1){_0x3cb156=_0x2f6ee0[_0x492b74];if(_[_0x68ef('0x1d')](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']])){_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']]=new WhatsappQueue(_0x3cb156);}else{_0xd7f9ca['mergeFromDatabase'](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']],_0x3cb156);}_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x1e')]();_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x20')]();}}return _0xd7f9ca[_0x68ef('0xf')];};};module[_0x68ef('0x25')]=Realtime; \ No newline at end of file +var _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7217,0x19e));var _0x7721=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x7217[_0x3c2a69];return _0x596bc8;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index d4a1a33..1c3ccfa 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 _0x6e1d=['update','Request','updateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6e1d,0x161));var _0xd6e1=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x6e1d[_0x1cbcf1];return _0x3a06f0;};'use strict';var client=require(_0xd6e1('0x0'));exports[_0xd6e1('0x1')]=function(_0x614999,_0x31c368){return client[_0xd6e1('0x2')]('UpdateChatInteraction',{'body':_0x31c368,'options':{'where':{'id':_0x614999}},'log':_0xd6e1('0x3')});};exports[_0xd6e1('0x4')]=function(_0x307d7c,_0x2cc631){return client[_0xd6e1('0x2')]('AddTagsToChatInteraction',{'body':_0x2cc631,'options':{'where':{'id':_0x307d7c}},'log':_0xd6e1('0x5')});}; \ No newline at end of file +var _0xf261=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2730d7,_0x1d5313){var _0x404e58=function(_0x6818f8){while(--_0x6818f8){_0x2730d7['push'](_0x2730d7['shift']());}};_0x404e58(++_0x1d5313);}(_0xf261,0x191));var _0x1f26=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf261[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x1f26('0x0'));exports['update']=function(_0x51384b,_0x58e481){return client['Request']('UpdateChatInteraction',{'body':_0x58e481,'options':{'where':{'id':_0x51384b}},'log':_0x1f26('0x1')});};exports[_0x1f26('0x2')]=function(_0x2d7d75,_0x312a27){return client[_0x1f26('0x3')](_0x1f26('0x4'),{'body':_0x312a27,'options':{'where':{'id':_0x2d7d75}},'log':_0x1f26('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7d9ab51..b2521ec 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 _0x18de=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x277d74,_0x3bb7c8){var _0x3d18f8=function(_0x2ddac4){while(--_0x2ddac4){_0x277d74['push'](_0x277d74['shift']());}};_0x3d18f8(++_0x3bb7c8);}(_0x18de,0x1cf));var _0xe18d=function(_0x45d7a9,_0x21e348){_0x45d7a9=_0x45d7a9-0x0;var _0x3bce4a=_0x18de[_0x45d7a9];return _0x3bce4a;};'use strict';var client=require(_0xe18d('0x0'));exports[_0xe18d('0x1')]=function(_0xc5be51){return client[_0xe18d('0x2')](_0xe18d('0x3'),{'body':_0xc5be51,'log':_0xe18d('0x4')});}; \ No newline at end of file +var _0x6abc=['CreateChatMessage','../client','create'];(function(_0x22fbb5,_0x27bfeb){var _0x2cb1e9=function(_0x4625ad){while(--_0x4625ad){_0x22fbb5['push'](_0x22fbb5['shift']());}};_0x2cb1e9(++_0x27bfeb);}(_0x6abc,0x187));var _0xc6ab=function(_0x2671b0,_0x590fac){_0x2671b0=_0x2671b0-0x0;var _0x35624a=_0x6abc[_0x2671b0];return _0x35624a;};'use strict';var client=require(_0xc6ab('0x0'));exports[_0xc6ab('0x1')]=function(_0x576f8c){return client['Request'](_0xc6ab('0x2'),{'body':_0x576f8c,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 39a6922..a25f36b 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 _0xaeb5=['User','Agents','name','online','chatPause','getChatQueues','Request','GetChatQueue','timeout'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xaeb5,0xc3));var _0x5aeb=function(_0x24b66b,_0x149f2a){_0x24b66b=_0x24b66b-0x0;var _0x1eac23=_0xaeb5[_0x24b66b];return _0x1eac23;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x5aeb('0x0')](_0x5aeb('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x5aeb('0x2'),'strategy'],'include':[{'model':_0x5aeb('0x3'),'as':_0x5aeb('0x4'),'attributes':['id',_0x5aeb('0x5'),_0x5aeb('0x6'),_0x5aeb('0x7')]}]},'log':_0x5aeb('0x8')});};}; \ No newline at end of file +var _0xc439=['Request','GetChatQueue','name','strategy','User','online','chatPause','getChatQueues'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0xc439,0x127));var _0x9c43=function(_0xcd76c6,_0x17a0bc){_0xcd76c6=_0xcd76c6-0x0;var _0x191baf=_0xc439[_0xcd76c6];return _0x191baf;};'use strict';var client=require('../client');exports[_0x9c43('0x0')]=function(){return function(){return client[_0x9c43('0x1')](_0x9c43('0x2'),{'options':{'raw':![],'attributes':['id',_0x9c43('0x3'),'timeout',_0x9c43('0x4')],'include':[{'model':_0x9c43('0x5'),'as':'Agents','attributes':['id','name',_0x9c43('0x6'),_0x9c43('0x7')]}]},'log':_0x9c43('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 15aa299..0362baa 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 _0xf874=['update','UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x110596,_0x235052){var _0x581068=function(_0x46734f){while(--_0x46734f){_0x110596['push'](_0x110596['shift']());}};_0x581068(++_0x235052);}(_0xf874,0x177));var _0x4f87=function(_0x5ec384,_0x26d31c){_0x5ec384=_0x5ec384-0x0;var _0x35a620=_0xf874[_0x5ec384];return _0x35a620;};'use strict';var client=require(_0x4f87('0x0'));exports['create']=function(_0x391d9f){return client[_0x4f87('0x1')](_0x4f87('0x2'),{'body':_0x391d9f,'log':_0x4f87('0x2')});};exports[_0x4f87('0x3')]=function(_0xe4464e,_0x87123d){return client['Request'](_0x4f87('0x4'),{'body':_0x87123d,'options':{'where':{'uniqueid':_0xe4464e},'order':[['id',_0x4f87('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x9589=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x1ca750,_0x3e812e){var _0x30a6fa=function(_0x4e3ebd){while(--_0x4e3ebd){_0x1ca750['push'](_0x1ca750['shift']());}};_0x30a6fa(++_0x3e812e);}(_0x9589,0xbc));var _0x9958=function(_0x515316,_0x527431){_0x515316=_0x515316-0x0;var _0x2e640d=_0x9589[_0x515316];return _0x2e640d;};'use strict';var client=require(_0x9958('0x0'));exports[_0x9958('0x1')]=function(_0x220175){return client[_0x9958('0x2')](_0x9958('0x3'),{'body':_0x220175,'log':'CreateChatQueueReport'});};exports[_0x9958('0x4')]=function(_0x153116,_0xe7c0e){return client['Request'](_0x9958('0x5'),{'body':_0xe7c0e,'options':{'where':{'uniqueid':_0x153116},'order':[['id',_0x9958('0x6')]],'limit':0x1},'log':_0x9958('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index b24d76e..4ee1d5e 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 _0xefc4=['addTagsToFaxInteraction','update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5846b6,_0x299729){var _0x5b4ba4=function(_0x50357f){while(--_0x50357f){_0x5846b6['push'](_0x5846b6['shift']());}};_0x5b4ba4(++_0x299729);}(_0xefc4,0x181));var _0x4efc=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0xefc4[_0x5ef55a];return _0x20ae40;};'use strict';var client=require('../client');exports[_0x4efc('0x0')]=function(_0x16b2a2,_0x3ebc0e){return client[_0x4efc('0x1')](_0x4efc('0x2'),{'body':_0x3ebc0e,'options':{'where':{'id':_0x16b2a2}},'log':_0x4efc('0x3')});};exports[_0x4efc('0x4')]=function(_0x220c28,_0x592513){return client[_0x4efc('0x1')]('AddTagsToFaxInteraction',{'body':_0x592513,'options':{'where':{'id':_0x220c28}},'log':_0x4efc('0x5')});}; \ No newline at end of file +var _0x9c31=['../client','update','Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9c31,0x103));var _0x19c3=function(_0x2fe896,_0x2ee12b){_0x2fe896=_0x2fe896-0x0;var _0x2f98a0=_0x9c31[_0x2fe896];return _0x2f98a0;};'use strict';var client=require(_0x19c3('0x0'));exports[_0x19c3('0x1')]=function(_0xade4a6,_0x3cd8c6){return client[_0x19c3('0x2')](_0x19c3('0x3'),{'body':_0x3cd8c6,'options':{'where':{'id':_0xade4a6}},'log':'updateFaxInteraction'});};exports[_0x19c3('0x4')]=function(_0x1f6258,_0x202cfa){return client[_0x19c3('0x2')](_0x19c3('0x5'),{'body':_0x202cfa,'options':{'where':{'id':_0x1f6258}},'log':_0x19c3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index d57bea6..eef4449 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 _0xe256=['CreateFaxMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe256,0x8b));var _0x6e25=function(_0x5314b1,_0x45da01){_0x5314b1=_0x5314b1-0x0;var _0x302689=_0xe256[_0x5314b1];return _0x302689;};'use strict';var client=require(_0x6e25('0x0'));exports[_0x6e25('0x1')]=function(_0x32c138){return client['Request'](_0x6e25('0x2'),{'body':_0x32c138,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x7619=['CreateFaxMessage','createFaxMessage'];(function(_0x5057dc,_0x34ec48){var _0x26c08e=function(_0x2065ad){while(--_0x2065ad){_0x5057dc['push'](_0x5057dc['shift']());}};_0x26c08e(++_0x34ec48);}(_0x7619,0xc0));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x580b30){return client['Request'](_0x9761('0x0'),{'body':_0x580b30,'log':_0x9761('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index c8e3768..f19c509 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 _0xd87a=['Request','name','User','Agents','online','../client','getFaxQueues'];(function(_0x26a382,_0x3d54db){var _0x14f9c8=function(_0x1b69f6){while(--_0x1b69f6){_0x26a382['push'](_0x26a382['shift']());}};_0x14f9c8(++_0x3d54db);}(_0xd87a,0x7c));var _0xad87=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0xd87a[_0x83af7f];return _0x32d85c;};'use strict';var client=require(_0xad87('0x0'));exports[_0xad87('0x1')]=function(){return function(){return client[_0xad87('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xad87('0x3'),'timeout','strategy'],'include':[{'model':_0xad87('0x4'),'as':_0xad87('0x5'),'attributes':['id',_0xad87('0x3'),_0xad87('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xf9f5=['strategy','User','Agents','faxPause','../client','getFaxQueues','name'];(function(_0x25b068,_0xb6ac60){var _0xb9f40f=function(_0x28880b){while(--_0x28880b){_0x25b068['push'](_0x25b068['shift']());}};_0xb9f40f(++_0xb6ac60);}(_0xf9f5,0x13f));var _0x5f9f=function(_0x295023,_0x39df63){_0x295023=_0x295023-0x0;var _0x4dfd12=_0xf9f5[_0x295023];return _0x4dfd12;};'use strict';var client=require(_0x5f9f('0x0'));exports[_0x5f9f('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x5f9f('0x2'),'timeout',_0x5f9f('0x3')],'include':[{'model':_0x5f9f('0x4'),'as':_0x5f9f('0x5'),'attributes':['id',_0x5f9f('0x2'),'online',_0x5f9f('0x6')]}]},'log':_0x5f9f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 73540da..f129d79 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 _0x26bb=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x26bb,0x8e));var _0xb26b=function(_0x55944d,_0x3195f0){_0x55944d=_0x55944d-0x0;var _0x494a5b=_0x26bb[_0x55944d];return _0x494a5b;};'use strict';var client=require(_0xb26b('0x0'));exports[_0xb26b('0x1')]=function(_0x54aa3d){return client[_0xb26b('0x2')]('CreateFaxQueueReport',{'body':_0x54aa3d,'log':_0xb26b('0x3')});};exports[_0xb26b('0x4')]=function(_0x46c089,_0x5a5f31){return client[_0xb26b('0x2')](_0xb26b('0x5'),{'body':_0x5a5f31,'options':{'where':{'uniqueid':_0x46c089},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x97e5=['DESC','../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x223ca0,_0x1b5a4a){var _0x5558f3=function(_0x27bbe5){while(--_0x27bbe5){_0x223ca0['push'](_0x223ca0['shift']());}};_0x5558f3(++_0x1b5a4a);}(_0x97e5,0xcd));var _0x597e=function(_0x11e638,_0x553398){_0x11e638=_0x11e638-0x0;var _0x2be393=_0x97e5[_0x11e638];return _0x2be393;};'use strict';var client=require(_0x597e('0x0'));exports['create']=function(_0x199928){return client[_0x597e('0x1')](_0x597e('0x2'),{'body':_0x199928,'log':'CreateFaxQueueReport'});};exports[_0x597e('0x3')]=function(_0x123df8,_0x1f3b43){return client[_0x597e('0x1')](_0x597e('0x4'),{'body':_0x1f3b43,'options':{'where':{'uniqueid':_0x123df8},'order':[['id',_0x597e('0x5')]],'limit':0x1},'log':_0x597e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 1b2152c..f0536a0 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 _0xc2da=['name','Intervals','interval','getIntervals','../client','Request'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xc2da,0x124));var _0xac2d=function(_0x308bc6,_0x564ec7){_0x308bc6=_0x308bc6-0x0;var _0x422fcf=_0xc2da[_0x308bc6];return _0x422fcf;};'use strict';var client=require(_0xac2d('0x0'));exports['getIntervals']=function(){return function(){return client[_0xac2d('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xac2d('0x2')],'include':[{'model':'Interval','as':_0xac2d('0x3'),'attributes':['id',_0xac2d('0x2'),_0xac2d('0x4')]}]},'log':_0xac2d('0x5')});};}; \ No newline at end of file +var _0x1399=['../client','getIntervals','GetInterval','Interval','Intervals','name','interval'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x1399,0x16c));var _0x9139=function(_0x2f71c1,_0x319017){_0x2f71c1=_0x2f71c1-0x0;var _0x411bb7=_0x1399[_0x2f71c1];return _0x411bb7;};'use strict';var client=require(_0x9139('0x0'));exports[_0x9139('0x1')]=function(){return function(){return client['Request'](_0x9139('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x9139('0x3'),'as':_0x9139('0x4'),'attributes':['id',_0x9139('0x5'),_0x9139('0x6')]}]},'log':_0x9139('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index d0144d7..2caa03c 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 _0x630a=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x160ef0,_0x131e44){var _0x44d081=function(_0x1aa3ef){while(--_0x1aa3ef){_0x160ef0['push'](_0x160ef0['shift']());}};_0x44d081(++_0x131e44);}(_0x630a,0x166));var _0xa630=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x630a[_0x10291b];return _0x1d5fbe;};'use strict';var client=require(_0xa630('0x0'));exports[_0xa630('0x1')]=function(_0x418ac5,_0x55394e){return client[_0xa630('0x2')](_0xa630('0x3'),{'body':_0x55394e,'options':{'where':{'id':_0x418ac5}},'log':_0xa630('0x4')});};exports[_0xa630('0x5')]=function(_0x57ed67,_0x31eaea){return client['Request'](_0xa630('0x6'),{'body':_0x31eaea,'options':{'where':{'id':_0x57ed67}},'log':_0xa630('0x7')});}; \ No newline at end of file +var _0x8b23=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0xeb9f69,_0x34d75e){var _0x4a8d87=function(_0x4a5f73){while(--_0x4a5f73){_0xeb9f69['push'](_0xeb9f69['shift']());}};_0x4a8d87(++_0x34d75e);}(_0x8b23,0x191));var _0x38b2=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8b23[_0x29d94e];return _0x106237;};'use strict';var client=require(_0x38b2('0x0'));exports[_0x38b2('0x1')]=function(_0x44a896,_0x164a5e){return client[_0x38b2('0x2')](_0x38b2('0x3'),{'body':_0x164a5e,'options':{'where':{'id':_0x44a896}},'log':_0x38b2('0x4')});};exports[_0x38b2('0x5')]=function(_0x5cf9d6,_0x4a478d){return client[_0x38b2('0x2')](_0x38b2('0x6'),{'body':_0x4a478d,'options':{'where':{'id':_0x5cf9d6}},'log':_0x38b2('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f388c72..7bc4972 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 _0x686c=['create'];(function(_0x43e58c,_0x5efeb1){var _0x56f27e=function(_0x38f1f3){while(--_0x38f1f3){_0x43e58c['push'](_0x43e58c['shift']());}};_0x56f27e(++_0x5efeb1);}(_0x686c,0x113));var _0xc686=function(_0x1becf4,_0x54d2f0){_0x1becf4=_0x1becf4-0x0;var _0x4fedf2=_0x686c[_0x1becf4];return _0x4fedf2;};'use strict';var client=require('../client');exports[_0xc686('0x0')]=function(_0x113289){return client['Request']('CreateMailMessage',{'body':_0x113289,'log':'createMailMessage'});}; \ No newline at end of file +var _0xd93f=['create','Request','createMailMessage'];(function(_0x45198a,_0x3e79b4){var _0xb858db=function(_0x1fae6f){while(--_0x1fae6f){_0x45198a['push'](_0x45198a['shift']());}};_0xb858db(++_0x3e79b4);}(_0xd93f,0xc9));var _0xfd93=function(_0x27f154,_0x2c11d4){_0x27f154=_0x27f154-0x0;var _0x2b3005=_0xd93f[_0x27f154];return _0x2b3005;};'use strict';var client=require('../client');exports[_0xfd93('0x0')]=function(_0x22f042){return client[_0xfd93('0x1')]('CreateMailMessage',{'body':_0x22f042,'log':_0xfd93('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a441f7d..14ac659 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 _0xb394=['strategy','User','Agents','online','mailPause','getMailQueues','../client','Request','GetMailQueue','name','timeout'];(function(_0x59965c,_0x2a1658){var _0x58cf2d=function(_0x38027b){while(--_0x38027b){_0x59965c['push'](_0x59965c['shift']());}};_0x58cf2d(++_0x2a1658);}(_0xb394,0xe2));var _0x4b39=function(_0x2f2fe2,_0x55913d){_0x2f2fe2=_0x2f2fe2-0x0;var _0x49a79d=_0xb394[_0x2f2fe2];return _0x49a79d;};'use strict';var client=require(_0x4b39('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x4b39('0x1')](_0x4b39('0x2'),{'options':{'raw':![],'attributes':['id',_0x4b39('0x3'),_0x4b39('0x4'),_0x4b39('0x5')],'include':[{'model':_0x4b39('0x6'),'as':_0x4b39('0x7'),'attributes':['id','name',_0x4b39('0x8'),_0x4b39('0x9')]}]},'log':_0x4b39('0xa')});};}; \ No newline at end of file +var _0xf780=['GetMailQueue','name','timeout','strategy','Agents','online','../client','getMailQueues','Request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf780,0x192));var _0x0f78=function(_0x23d3e8,_0x37ff6a){_0x23d3e8=_0x23d3e8-0x0;var _0x4365fc=_0xf780[_0x23d3e8];return _0x4365fc;};'use strict';var client=require(_0x0f78('0x0'));exports[_0x0f78('0x1')]=function(){return function(){return client[_0x0f78('0x2')](_0x0f78('0x3'),{'options':{'raw':![],'attributes':['id',_0x0f78('0x4'),_0x0f78('0x5'),_0x0f78('0x6')],'include':[{'model':'User','as':_0x0f78('0x7'),'attributes':['id','name',_0x0f78('0x8'),'mailPause']}]},'log':_0x0f78('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 037771f..66655e4 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 _0xe8ea=['UpdateMailQueueReport','DESC','Request','CreateMailQueueReport','update'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xe8ea,0x1dd));var _0xae8e=function(_0x53dd23,_0x319c48){_0x53dd23=_0x53dd23-0x0;var _0x35671a=_0xe8ea[_0x53dd23];return _0x35671a;};'use strict';var client=require('../client');exports['create']=function(_0xf65414){return client[_0xae8e('0x0')](_0xae8e('0x1'),{'body':_0xf65414,'log':_0xae8e('0x1')});};exports[_0xae8e('0x2')]=function(_0x56c36b,_0x545f87){return client[_0xae8e('0x0')](_0xae8e('0x3'),{'body':_0x545f87,'options':{'where':{'uniqueid':_0x56c36b},'order':[['id',_0xae8e('0x4')]],'limit':0x1},'log':_0xae8e('0x3')});}; \ No newline at end of file +var _0x4f3b=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport','update'];(function(_0xb44291,_0x40eddd){var _0x580bad=function(_0x20aa05){while(--_0x20aa05){_0xb44291['push'](_0xb44291['shift']());}};_0x580bad(++_0x40eddd);}(_0x4f3b,0x183));var _0xb4f3=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x4f3b[_0x458363];return _0x4d0290;};'use strict';var client=require(_0xb4f3('0x0'));exports[_0xb4f3('0x1')]=function(_0x33d7e8){return client[_0xb4f3('0x2')](_0xb4f3('0x3'),{'body':_0x33d7e8,'log':_0xb4f3('0x3')});};exports[_0xb4f3('0x4')]=function(_0x398287,_0x13ad71){return client['Request'](_0xb4f3('0x5'),{'body':_0x13ad71,'options':{'where':{'uniqueid':_0x398287},'order':[['id',_0xb4f3('0x6')]],'limit':0x1},'log':_0xb4f3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index fc2e702..dab71d8 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 _0x1206=['addTagsToChatInteraction','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x176683,_0x168eb1){var _0x41ab61=function(_0x30b18e){while(--_0x30b18e){_0x176683['push'](_0x176683['shift']());}};_0x41ab61(++_0x168eb1);}(_0x1206,0xec));var _0x6120=function(_0x4bc156,_0x5ab86e){_0x4bc156=_0x4bc156-0x0;var _0x33c7da=_0x1206[_0x4bc156];return _0x33c7da;};'use strict';var client=require('../client');exports['update']=function(_0x13d227,_0x3e84a5){return client[_0x6120('0x0')](_0x6120('0x1'),{'body':_0x3e84a5,'options':{'where':{'id':_0x13d227}},'log':'updateOpenchannelInteraction'});};exports[_0x6120('0x2')]=function(_0x364691,_0x109d8a){return client[_0x6120('0x0')](_0x6120('0x3'),{'body':_0x109d8a,'options':{'where':{'id':_0x364691}},'log':_0x6120('0x4')});}; \ No newline at end of file +var _0x5592=['addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','updateOpenchannelInteraction'];(function(_0x5de963,_0x340318){var _0x3867de=function(_0xe0b8ea){while(--_0xe0b8ea){_0x5de963['push'](_0x5de963['shift']());}};_0x3867de(++_0x340318);}(_0x5592,0x1c0));var _0x2559=function(_0x426028,_0x4a44df){_0x426028=_0x426028-0x0;var _0x523cc7=_0x5592[_0x426028];return _0x523cc7;};'use strict';var client=require(_0x2559('0x0'));exports['update']=function(_0x55d5d3,_0xe684cd){return client['Request']('UpdateOpenchannelInteraction',{'body':_0xe684cd,'options':{'where':{'id':_0x55d5d3}},'log':_0x2559('0x1')});};exports[_0x2559('0x2')]=function(_0x91935c,_0x229e9d){return client[_0x2559('0x3')](_0x2559('0x4'),{'body':_0x229e9d,'options':{'where':{'id':_0x91935c}},'log':_0x2559('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 1b0ffb5..8f18e80 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(_0xc06a4e,_0x22d0c3){var _0x313fe7=function(_0x350b86){while(--_0x350b86){_0xc06a4e['push'](_0xc06a4e['shift']());}};_0x313fe7(++_0x22d0c3);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3ed430,_0x5fafab){_0x3ed430=_0x3ed430-0x0;var _0xae4a10=_0xbdb7[_0x3ed430];return _0xae4a10;};'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 _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x4fc5df,_0x3acaab){var _0x4a18f5=function(_0x241409){while(--_0x241409){_0x4fc5df['push'](_0x4fc5df['shift']());}};_0x4a18f5(++_0x3acaab);}(_0x70e0,0x17b));var _0x070e=function(_0x4bb45b,_0x1ca204){_0x4bb45b=_0x4bb45b-0x0;var _0x5d5f03=_0x70e0[_0x4bb45b];return _0x5d5f03;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateOpenchannelMessage',{'body':_0x198c2e,'log':_0x070e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2756be6..9e6b068 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 _0xd5ad=['strategy','name','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x511c6b,_0x24ece6){var _0x191672=function(_0x155920){while(--_0x155920){_0x511c6b['push'](_0x511c6b['shift']());}};_0x191672(++_0x24ece6);}(_0xd5ad,0x1f4));var _0xdd5a=function(_0x507523,_0x58488c){_0x507523=_0x507523-0x0;var _0x395885=_0xd5ad[_0x507523];return _0x395885;};'use strict';var client=require(_0xdd5a('0x0'));exports[_0xdd5a('0x1')]=function(){return function(){return client[_0xdd5a('0x2')](_0xdd5a('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xdd5a('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xdd5a('0x5'),_0xdd5a('0x6'),_0xdd5a('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xf534=['GetOpenchannelQueue','name','timeout','User','Agents','online','getOpenchannelQueues'];(function(_0x44fef1,_0x132cf4){var _0x3c3a04=function(_0x175a90){while(--_0x175a90){_0x44fef1['push'](_0x44fef1['shift']());}};_0x3c3a04(++_0x132cf4);}(_0xf534,0x134));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x4f53('0x0'),{'options':{'raw':![],'attributes':['id',_0x4f53('0x1'),_0x4f53('0x2'),'strategy'],'include':[{'model':_0x4f53('0x3'),'as':_0x4f53('0x4'),'attributes':['id',_0x4f53('0x1'),_0x4f53('0x5'),'openchannelPause']}]},'log':_0x4f53('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 37ba62a..2adae50 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 _0xa5a4=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa5a4,0x1ac));var _0x4a5a=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xa5a4[_0x3fba9f];return _0x192cf1;};'use strict';var client=require(_0x4a5a('0x0'));exports[_0x4a5a('0x1')]=function(_0x3946ce){return client[_0x4a5a('0x2')](_0x4a5a('0x3'),{'body':_0x3946ce,'log':'CreateOpenchannelQueueReport'});};exports[_0x4a5a('0x4')]=function(_0x36cea6,_0x5e91a7){return client[_0x4a5a('0x2')](_0x4a5a('0x5'),{'body':_0x5e91a7,'options':{'where':{'uniqueid':_0x36cea6},'order':[['id','DESC']],'limit':0x1},'log':_0x4a5a('0x5')});}; \ No newline at end of file +var _0x1a0f=['CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','Request'];(function(_0x4baaa2,_0x3a100a){var _0x5cfc61=function(_0x184610){while(--_0x184610){_0x4baaa2['push'](_0x4baaa2['shift']());}};_0x5cfc61(++_0x3a100a);}(_0x1a0f,0x12b));var _0xf1a0=function(_0x40b981,_0x48b308){_0x40b981=_0x40b981-0x0;var _0x58696b=_0x1a0f[_0x40b981];return _0x58696b;};'use strict';var client=require('../client');exports['create']=function(_0x269fb8){return client[_0xf1a0('0x0')]('CreateOpenchannelQueueReport',{'body':_0x269fb8,'log':_0xf1a0('0x1')});};exports[_0xf1a0('0x2')]=function(_0x2b77ca,_0xd89f6){return client[_0xf1a0('0x0')]('UpdateOpenchannelQueueReport',{'body':_0xd89f6,'options':{'where':{'uniqueid':_0x2b77ca},'order':[['id',_0xf1a0('0x3')]],'limit':0x1},'log':_0xf1a0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 126b906..2c8cace 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 _0x7c9d=['../client','update','Request','UpdateSmsInteraction','addTags'];(function(_0x502cbe,_0x5ef46b){var _0x306bd1=function(_0x3b456d){while(--_0x3b456d){_0x502cbe['push'](_0x502cbe['shift']());}};_0x306bd1(++_0x5ef46b);}(_0x7c9d,0x9b));var _0xd7c9=function(_0x4d13f4,_0x2d6953){_0x4d13f4=_0x4d13f4-0x0;var _0x2308a0=_0x7c9d[_0x4d13f4];return _0x2308a0;};'use strict';var client=require(_0xd7c9('0x0'));exports[_0xd7c9('0x1')]=function(_0x436a17,_0xfb4ff3){return client[_0xd7c9('0x2')](_0xd7c9('0x3'),{'body':_0xfb4ff3,'options':{'where':{'id':_0x436a17}},'log':'updateSmsInteraction'});};exports[_0xd7c9('0x4')]=function(_0x2360b9,_0x3c6dd2){return client[_0xd7c9('0x2')]('AddTagsToSmsInteraction',{'body':_0x3c6dd2,'options':{'where':{'id':_0x2360b9}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x9155=['AddTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x9db041,_0x25821e){var _0x28c133=function(_0x3fdd89){while(--_0x3fdd89){_0x9db041['push'](_0x9db041['shift']());}};_0x28c133(++_0x25821e);}(_0x9155,0x1ab));var _0x5915=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x9155[_0x5e9876];return _0x576c48;};'use strict';var client=require('../client');exports[_0x5915('0x0')]=function(_0x36cf38,_0x133db5){return client[_0x5915('0x1')](_0x5915('0x2'),{'body':_0x133db5,'options':{'where':{'id':_0x36cf38}},'log':_0x5915('0x3')});};exports[_0x5915('0x4')]=function(_0x1ba2e2,_0x1f47c5){return client['Request'](_0x5915('0x5'),{'body':_0x1f47c5,'options':{'where':{'id':_0x1ba2e2}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 36be5f7..70d3d21 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 _0xc212=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xc212,0x175));var _0x2c21=function(_0x15ec05,_0x51dd86){_0x15ec05=_0x15ec05-0x0;var _0x2a9659=_0xc212[_0x15ec05];return _0x2a9659;};'use strict';var client=require(_0x2c21('0x0'));exports['create']=function(_0x323295){return client[_0x2c21('0x1')](_0x2c21('0x2'),{'body':_0x323295,'log':_0x2c21('0x3')});}; \ No newline at end of file +var _0xd46f=['createSmsMessage','create','Request'];(function(_0x1cb4bc,_0x46e6e3){var _0x947248=function(_0x199e5a){while(--_0x199e5a){_0x1cb4bc['push'](_0x1cb4bc['shift']());}};_0x947248(++_0x46e6e3);}(_0xd46f,0x1d5));var _0xfd46=function(_0x4570d2,_0x5a0cf2){_0x4570d2=_0x4570d2-0x0;var _0x4f9299=_0xd46f[_0x4570d2];return _0x4f9299;};'use strict';var client=require('../client');exports[_0xfd46('0x0')]=function(_0x3793a5){return client[_0xfd46('0x1')]('CreateSmsMessage',{'body':_0x3793a5,'log':_0xfd46('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d6c5fe6..30e11bc 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 _0xf494=['User','Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy'];(function(_0xee5bcb,_0x28070a){var _0xe2cc6=function(_0x5d395c){while(--_0x5d395c){_0xee5bcb['push'](_0xee5bcb['shift']());}};_0xe2cc6(++_0x28070a);}(_0xf494,0x1c6));var _0x4f49=function(_0x89c40f,_0xd92eb2){_0x89c40f=_0x89c40f-0x0;var _0x17acbb=_0xf494[_0x89c40f];return _0x17acbb;};'use strict';var client=require(_0x4f49('0x0'));exports[_0x4f49('0x1')]=function(){return function(){return client[_0x4f49('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x4f49('0x3'),_0x4f49('0x4'),_0x4f49('0x5')],'include':[{'model':_0x4f49('0x6'),'as':_0x4f49('0x7'),'attributes':['id',_0x4f49('0x3'),_0x4f49('0x8'),_0x4f49('0x9')]}]},'log':_0x4f49('0x1')});};}; \ No newline at end of file +var _0x9c94=['online','../client','getSmsQueues','GetSmsQueue','timeout','strategy','Agents','name'];(function(_0x44249a,_0x24a4e6){var _0x2d7250=function(_0x383a09){while(--_0x383a09){_0x44249a['push'](_0x44249a['shift']());}};_0x2d7250(++_0x24a4e6);}(_0x9c94,0x99));var _0x49c9=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x9c94[_0x24f31b];return _0x488401;};'use strict';var client=require(_0x49c9('0x0'));exports[_0x49c9('0x1')]=function(){return function(){return client['Request'](_0x49c9('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x49c9('0x3'),_0x49c9('0x4')],'include':[{'model':'User','as':_0x49c9('0x5'),'attributes':['id',_0x49c9('0x6'),_0x49c9('0x7'),'smsPause']}]},'log':_0x49c9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index d7a3c75..369d7c2 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 _0xedca=['CreateSmsQueueReport','update','Request','DESC','UpdateSmsQueueReport','../client','create'];(function(_0x12c4cd,_0xdebe29){var _0x18a029=function(_0x4c4272){while(--_0x4c4272){_0x12c4cd['push'](_0x12c4cd['shift']());}};_0x18a029(++_0xdebe29);}(_0xedca,0xc9));var _0xaedc=function(_0x31d97b,_0x43f835){_0x31d97b=_0x31d97b-0x0;var _0x3edb97=_0xedca[_0x31d97b];return _0x3edb97;};'use strict';var client=require(_0xaedc('0x0'));exports[_0xaedc('0x1')]=function(_0x5c4803){return client['Request'](_0xaedc('0x2'),{'body':_0x5c4803,'log':'CreateSmsQueueReport'});};exports[_0xaedc('0x3')]=function(_0x31d9c6,_0xceee20){return client[_0xaedc('0x4')]('UpdateSmsQueueReport',{'body':_0xceee20,'options':{'where':{'uniqueid':_0x31d9c6},'order':[['id',_0xaedc('0x5')]],'limit':0x1},'log':_0xaedc('0x6')});}; \ No newline at end of file +var _0x9231=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','create','Request'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x9231,0x66));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1923('0x0'));exports[_0x1923('0x1')]=function(_0xc2d3af){return client[_0x1923('0x2')]('CreateSmsQueueReport',{'body':_0xc2d3af,'log':_0x1923('0x3')});};exports[_0x1923('0x4')]=function(_0x1b040e,_0x46fbd1){return client[_0x1923('0x2')](_0x1923('0x5'),{'body':_0x46fbd1,'options':{'where':{'uniqueid':_0x1b040e},'order':[['id',_0x1923('0x6')]],'limit':0x1},'log':_0x1923('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6e1eb72..82ec207 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 _0x192a=['Request','online','lastPauseAt','voicePause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','whatsappCapacity','../client','getAgents'];(function(_0x4ec6db,_0x393d10){var _0x5b46fc=function(_0x18d087){while(--_0x18d087){_0x4ec6db['push'](_0x4ec6db['shift']());}};_0x5b46fc(++_0x393d10);}(_0x192a,0x16a));var _0xa192=function(_0x13ae3f,_0x235b18){_0x13ae3f=_0x13ae3f-0x0;var _0x1d6e04=_0x192a[_0x13ae3f];return _0x1d6e04;};'use strict';var client=require(_0xa192('0x0'));exports[_0xa192('0x1')]=function(){return function(){return client[_0xa192('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name',_0xa192('0x3'),'pauseType',_0xa192('0x4'),_0xa192('0x5'),'chatPause','mailPause',_0xa192('0x6'),_0xa192('0x7'),_0xa192('0x8'),_0xa192('0x9'),_0xa192('0xa'),_0xa192('0xb'),_0xa192('0xc'),'smsCapacity',_0xa192('0xd'),'openchannelCapacity']},'log':_0xa192('0x1')});};}; \ No newline at end of file +var _0x3150=['getAgents','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCapacity'];(function(_0x3cc2ae,_0x21941a){var _0x5dcfdf=function(_0x2d4c47){while(--_0x2d4c47){_0x3cc2ae['push'](_0x3cc2ae['shift']());}};_0x5dcfdf(++_0x21941a);}(_0x3150,0x1a0));var _0x0315=function(_0x9d2bdc,_0x4f2b6a){_0x9d2bdc=_0x9d2bdc-0x0;var _0x410615=_0x3150[_0x9d2bdc];return _0x410615;};'use strict';var client=require('../client');exports[_0x0315('0x0')]=function(){return function(){return client['Request'](_0x0315('0x1'),{'options':{'raw':!![],'where':{'role':_0x0315('0x2')},'attributes':['id',_0x0315('0x3'),'online',_0x0315('0x4'),_0x0315('0x5'),_0x0315('0x6'),_0x0315('0x7'),'mailPause','faxPause',_0x0315('0x8'),_0x0315('0x9'),_0x0315('0xa'),_0x0315('0xb'),_0x0315('0xc'),'faxCapacity',_0x0315('0xd'),_0x0315('0xe'),_0x0315('0xf')]},'log':_0x0315('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 6e5b3ff..7c73969 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 _0x56e6=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x4d5d28,_0x26bd9b){var _0x2026b1=function(_0x1fe42c){while(--_0x1fe42c){_0x4d5d28['push'](_0x4d5d28['shift']());}};_0x2026b1(++_0x26bd9b);}(_0x56e6,0x6b));var _0x656e=function(_0x2d3134,_0x477c10){_0x2d3134=_0x2d3134-0x0;var _0x2dd03e=_0x56e6[_0x2d3134];return _0x2dd03e;};'use strict';var client=require(_0x656e('0x0'));exports[_0x656e('0x1')]=function(_0x27c324,_0x75e34c){return client[_0x656e('0x2')](_0x656e('0x3'),{'body':_0x75e34c,'options':{'where':{'id':_0x27c324}},'log':'updateWhatsappInteraction'});};exports[_0x656e('0x4')]=function(_0x23c947,_0xe7d540){return client[_0x656e('0x2')](_0x656e('0x5'),{'body':_0xe7d540,'options':{'where':{'id':_0x23c947}},'log':_0x656e('0x6')});}; \ No newline at end of file +var _0x3036=['updateWhatsappInteraction','addTagsToWhatsappInteraction','Request'];(function(_0x15ffcc,_0x9859df){var _0x63c91c=function(_0x20dba7){while(--_0x20dba7){_0x15ffcc['push'](_0x15ffcc['shift']());}};_0x63c91c(++_0x9859df);}(_0x3036,0x1a9));var _0x6303=function(_0x3181fe,_0x10e2f3){_0x3181fe=_0x3181fe-0x0;var _0xf3cba4=_0x3036[_0x3181fe];return _0xf3cba4;};'use strict';var client=require('../client');exports['update']=function(_0x7aa5f9,_0xd38168){return client[_0x6303('0x0')]('UpdateWhatsappInteraction',{'body':_0xd38168,'options':{'where':{'id':_0x7aa5f9}},'log':_0x6303('0x1')});};exports['addTags']=function(_0x48aa0c,_0x4d040b){return client[_0x6303('0x0')]('AddTagsToWhatsappInteraction',{'body':_0x4d040b,'options':{'where':{'id':_0x48aa0c}},'log':_0x6303('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 4395837..4d6116a 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 _0x7c24=['CreateWhatsappMessage','../client','Request'];(function(_0x551260,_0x39788a){var _0x5f257f=function(_0x4dcaef){while(--_0x4dcaef){_0x551260['push'](_0x551260['shift']());}};_0x5f257f(++_0x39788a);}(_0x7c24,0x1b7));var _0x47c2=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x7c24[_0x5f3f88];return _0xd08119;};'use strict';var client=require(_0x47c2('0x0'));exports['create']=function(_0x3ec61c){return client[_0x47c2('0x1')](_0x47c2('0x2'),{'body':_0x3ec61c,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x17f3=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x17f3,0x16b));var _0x317f=function(_0x317858,_0x2794e7){_0x317858=_0x317858-0x0;var _0x435ac6=_0x17f3[_0x317858];return _0x435ac6;};'use strict';var client=require(_0x317f('0x0'));exports[_0x317f('0x1')]=function(_0x479fb7){return client[_0x317f('0x2')](_0x317f('0x3'),{'body':_0x479fb7,'log':_0x317f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c9aee66..5f6e67b 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 _0x8cc8=['whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online'];(function(_0x50c8e4,_0xbd83c0){var _0x46a5ea=function(_0x371111){while(--_0x371111){_0x50c8e4['push'](_0x50c8e4['shift']());}};_0x46a5ea(++_0xbd83c0);}(_0x8cc8,0x177));var _0x88cc=function(_0x2741d0,_0x418a1f){_0x2741d0=_0x2741d0-0x0;var _0x259125=_0x8cc8[_0x2741d0];return _0x259125;};'use strict';var client=require(_0x88cc('0x0'));exports[_0x88cc('0x1')]=function(){return function(){return client[_0x88cc('0x2')](_0x88cc('0x3'),{'options':{'raw':![],'attributes':['id',_0x88cc('0x4'),_0x88cc('0x5'),_0x88cc('0x6')],'include':[{'model':_0x88cc('0x7'),'as':_0x88cc('0x8'),'attributes':['id',_0x88cc('0x4'),_0x88cc('0x9'),_0x88cc('0xa')]}]},'log':_0x88cc('0x1')});};}; \ No newline at end of file +var _0x02a7=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','getWhatsappQueues'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x02a7,0x1a6));var _0x702a=function(_0x1a302e,_0x55a2f8){_0x1a302e=_0x1a302e-0x0;var _0xeb198e=_0x02a7[_0x1a302e];return _0xeb198e;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'attributes':['id',_0x702a('0x3'),_0x702a('0x4'),_0x702a('0x5')],'include':[{'model':_0x702a('0x6'),'as':_0x702a('0x7'),'attributes':['id',_0x702a('0x3'),_0x702a('0x8'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e250eae..79bb63c 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 _0x1fe8=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x898e5d,_0x5e2b4d){var _0x4adf2f=function(_0x4fda53){while(--_0x4fda53){_0x898e5d['push'](_0x898e5d['shift']());}};_0x4adf2f(++_0x5e2b4d);}(_0x1fe8,0xbc));var _0x81fe=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x1fe8[_0x565ed7];return _0x183ad7;};'use strict';var client=require('../client');exports['create']=function(_0x3edd6a){return client[_0x81fe('0x0')](_0x81fe('0x1'),{'body':_0x3edd6a,'log':_0x81fe('0x1')});};exports[_0x81fe('0x2')]=function(_0x12d307,_0x302bb4){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x302bb4,'options':{'where':{'uniqueid':_0x12d307},'order':[['id','DESC']],'limit':0x1},'log':_0x81fe('0x3')});}; \ No newline at end of file +var _0x6931=['CreateWhatsappQueueReport','update','../client','create','Request'];(function(_0x114087,_0x51dfb0){var _0x2dd44e=function(_0xf57823){while(--_0xf57823){_0x114087['push'](_0x114087['shift']());}};_0x2dd44e(++_0x51dfb0);}(_0x6931,0x18d));var _0x1693=function(_0x180ca4,_0x5ed2aa){_0x180ca4=_0x180ca4-0x0;var _0x390ba1=_0x6931[_0x180ca4];return _0x390ba1;};'use strict';var client=require(_0x1693('0x0'));exports[_0x1693('0x1')]=function(_0x5ea302){return client[_0x1693('0x2')](_0x1693('0x3'),{'body':_0x5ea302,'log':'CreateWhatsappQueueReport'});};exports[_0x1693('0x4')]=function(_0x11fcf5,_0xb1d1d4){return client[_0x1693('0x2')]('UpdateWhatsappQueueReport',{'body':_0xb1d1d4,'options':{'where':{'uniqueid':_0x11fcf5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 74a3e5e..cd79acf 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 _0x849c=['rules','end','complete','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','join','stop','timeout','channel','START:%s'];(function(_0x1ae1cf,_0x495ec5){var _0x3f6779=function(_0x36be87){while(--_0x36be87){_0x1ae1cf['push'](_0x1ae1cf['shift']());}};_0x3f6779(++_0x495ec5);}(_0x849c,0x153));var _0xc849=function(_0x919947,_0x40a822){_0x919947=_0x919947-0x0;var _0x40bfb9=_0x849c[_0x919947];return _0x40bfb9;};'use strict';var schema=require(_0xc849('0x0'));var _=require(_0xc849('0x1'));var util=require(_0xc849('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xc849('0x3'))(_0xc849('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xc849('0x5'),'required':!![],'message':_0xc849('0x6')},'timeout':{'type':_0xc849('0x7'),'message':_0xc849('0x8')}});function writeLog(_0x4bac76,_0x430d43,_0x1ed908){return logger[_0xc849('0x9')](util[_0xc849('0xa')](_0xc849('0xb'),_0x4bac76,_0x430d43[_0xc849('0xc')],_0x1ed908));}function handleFindAgent(_0x1e593a){return function(_0x578c64){return _0x578c64[_0xc849('0xc')][_0xc849('0xd')]()===_0x1e593a[_0xc849('0xd')]();};}exports['consequence']=function(_0x3cb325,_0x4e934b,_0xb120ef,_0x4ec18a){return function(_0x316a27){try{var _0x5db035={'name':_0x4e934b[0x0],'timeout':_0x4e934b[0x1]};var _0x26055b=queue[_0xc849('0x0')](_0x5db035,{'typecast':!![]});if(_0x26055b[_0xc849('0xe')]){logger['error'](_0xc849('0xf'),_0x3cb325,_['map'](_0x26055b,'message')[_0xc849('0x10')](',\x20'));_0x316a27[_0xc849('0x11')]();}else{var _0x11cea3=_['find'](_0xb120ef['agents'],handleFindAgent(_0x5db035[_0xc849('0xc')]));if(_0x11cea3){var _0x43df43=(_0x5db035[_0xc849('0x12')]||0xa)*0x3e8;var _0x173f4f,_0x5589db;var _0x3cf2b2=seqqueue['createQueue'](_0x43df43);_0x3cf2b2['id']=_0x3cb325;_0x3cf2b2['atimeout']=_0x43df43;_0x3cf2b2[_0xc849('0x13')]=_0x4ec18a['channel'];writeLog(_0x3cb325,_0x11cea3,util[_0xc849('0xa')](_0xc849('0x14'),_0x43df43));_0xb120ef[_0xc849('0x15')][_0x3cb325]['on'](_0xc849('0x16'),function(){logger[_0xc849('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3cb325);clearTimeout(_0x5589db);_0x5589db=undefined;_0x3cf2b2['close']();if(_0xb120ef[_0xc849('0x15')][_0x3cb325]){delete _0xb120ef[_0xc849('0x15')][_0x3cb325];}_0x316a27[_0xc849('0x11')]();});_0xb120ef[_0xc849('0x15')][_0x3cb325]['on'](_0xc849('0x17'),function(){if(_0xb120ef['rules'][_0x3cb325]){delete _0xb120ef[_0xc849('0x15')][_0x3cb325];}});_0x5589db=setTimeout(function(){logger[_0xc849('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x3cb325);clearTimeout(_0x5589db);_0x3cf2b2[_0xc849('0x18')]();_0x316a27[_0xc849('0x19')]();},_0x43df43);strategy[_0xc849('0x1a')](_0x3cf2b2,_0x11cea3,_0xb120ef,_0x4ec18a);}else{logger['error'](_0xc849('0x1b'),_0x3cb325,_0x5db035[_0xc849('0xc')]);_0x316a27[_0xc849('0x11')]();}}}catch(_0x4195ce){console[_0xc849('0x1c')](_0x4195ce);logger['error'](_0xc849('0x1d'),_0x3cb325,_0x4195ce['stack']);_0x316a27[_0xc849('0x11')]();}};}; \ No newline at end of file +var _0x6139=['stack','util','seq-queue','../../../../config/logger','./strategy','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','stop','find','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','log','[%s][QUEUE]\x20%s'];(function(_0x59af24,_0x201f0e){var _0x5d79d4=function(_0x4cc3a4){while(--_0x4cc3a4){_0x59af24['push'](_0x59af24['shift']());}};_0x5d79d4(++_0x201f0e);}(_0x6139,0x18d));var _0x9613=function(_0x4fd0e1,_0x402971){_0x4fd0e1=_0x4fd0e1-0x0;var _0x536d96=_0x6139[_0x4fd0e1];return _0x536d96;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x9613('0x0'));var seqqueue=require(_0x9613('0x1'));var logger=require(_0x9613('0x2'))('routing');var strategy=require(_0x9613('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9613('0x4'),'message':_0x9613('0x5')}});function writeLog(_0x3dc423,_0x2a88f9,_0x2585c5){return logger[_0x9613('0x6')](util[_0x9613('0x7')](_0x9613('0x8'),_0x3dc423,_0x2a88f9[_0x9613('0x9')],_0x2585c5));}function handleFindAgent(_0x39b238){return function(_0x1127f2){return _0x1127f2[_0x9613('0x9')][_0x9613('0xa')]()===_0x39b238[_0x9613('0xa')]();};}exports[_0x9613('0xb')]=function(_0x12e415,_0x4157fc,_0x3b0cd9,_0x2e3703){return function(_0x52fbfe){try{var _0x55b288={'name':_0x4157fc[0x0],'timeout':_0x4157fc[0x1]};var _0xe1ae09=queue[_0x9613('0xc')](_0x55b288,{'typecast':!![]});if(_0xe1ae09[_0x9613('0xd')]){logger[_0x9613('0xe')](_0x9613('0xf'),_0x12e415,_['map'](_0xe1ae09,_0x9613('0x10'))['join'](',\x20'));_0x52fbfe[_0x9613('0x11')]();}else{var _0x138add=_[_0x9613('0x12')](_0x3b0cd9['agents'],handleFindAgent(_0x55b288['name']));if(_0x138add){var _0x40ac25=(_0x55b288['timeout']||0xa)*0x3e8;var _0x47b0cf,_0x56330a;var _0x4cd2b0=seqqueue[_0x9613('0x13')](_0x40ac25);_0x4cd2b0['id']=_0x12e415;_0x4cd2b0[_0x9613('0x14')]=_0x40ac25;_0x4cd2b0['channel']=_0x2e3703[_0x9613('0x15')];writeLog(_0x12e415,_0x138add,util[_0x9613('0x7')](_0x9613('0x16'),_0x40ac25));_0x3b0cd9[_0x9613('0x17')][_0x12e415]['on'](_0x9613('0x18'),function(){logger[_0x9613('0x6')](_0x9613('0x19'),_0x12e415);clearTimeout(_0x56330a);_0x56330a=undefined;_0x4cd2b0[_0x9613('0x1a')]();if(_0x3b0cd9['rules'][_0x12e415]){delete _0x3b0cd9[_0x9613('0x17')][_0x12e415];}_0x52fbfe[_0x9613('0x11')]();});_0x3b0cd9[_0x9613('0x17')][_0x12e415]['on'](_0x9613('0x1b'),function(){if(_0x3b0cd9[_0x9613('0x17')][_0x12e415]){delete _0x3b0cd9[_0x9613('0x17')][_0x12e415];}});_0x56330a=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x12e415);clearTimeout(_0x56330a);_0x4cd2b0['close']();_0x52fbfe[_0x9613('0x1c')]();},_0x40ac25);strategy[_0x9613('0x1d')](_0x4cd2b0,_0x138add,_0x3b0cd9,_0x2e3703);}else{logger[_0x9613('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x12e415,_0x55b288[_0x9613('0x9')]);_0x52fbfe[_0x9613('0x11')]();}}}catch(_0x11835a){console[_0x9613('0x1e')](_0x11835a);logger['error'](_0x9613('0x1f'),_0x12e415,_0x11835a[_0x9613('0x20')]);_0x52fbfe[_0x9613('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index a6c5392..b04f3eb 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 _0x31f0=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','amazonlex','dialogState','Failed','catch','error','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','Message','create','then','[%s][AMAZONLEX]\x20%s','body','stringify','finally'];(function(_0x4b4889,_0x41cc03){var _0x38aac9=function(_0x514501){while(--_0x514501){_0x4b4889['push'](_0x4b4889['shift']());}};_0x38aac9(++_0x41cc03);}(_0x31f0,0xb7));var _0x031f=function(_0x24221e,_0x3f8144){_0x24221e=_0x24221e-0x0;var _0x2acb89=_0x31f0[_0x24221e];return _0x2acb89;};'use strict';var _=require(_0x031f('0x0'));var moment=require('moment');var AWS=require(_0x031f('0x1'));var utils=require('./utils');var logger=require(_0x031f('0x2'))(_0x031f('0x3'));var rpc={'chatMessage':require(_0x031f('0x4')),'openchannelMessage':require(_0x031f('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x031f('0x6')),'faxMessage':require(_0x031f('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x56328c,_0x3dc98e){return function(_0x487e65){try{if(!_[_0x031f('0x8')](this[_0x031f('0x9')][_0x031f('0xa')])){logger[_0x031f('0xb')]('[%s][AMAZONLEX]\x20%s',_0x56328c,_0x031f('0xc'));return _0x487e65[_0x031f('0xd')]();}var _0x327f11={'ContactId':this[_0x031f('0xe')]['id'],'sentAt':moment()[_0x031f('0xf')](_0x031f('0x10')),'direction':_0x031f('0x11')};var _0x3fd541=this['channel'];if(_0x3fd541===_0x031f('0x12')){_0x327f11[_0x031f('0x13')]=this[_0x031f('0x14')]['id'];}else{_0x327f11[_[_0x031f('0x15')](_0x3fd541)+_0x031f('0x16')]=this[_0x031f('0x14')]['id'];}_0x327f11[_[_0x031f('0x15')](_0x3fd541)+'InteractionId']=this[_0x031f('0x9')]['id'];if(this[_0x031f('0x9')][_0x031f('0x17')]){var _0x2e3dfe=_0x3dc98e[0x4];if(!_[_0x031f('0x18')](_0x2e3dfe)){_0x327f11['body']=utils['getMustacheRender'](_0x2e3dfe,this);return rpc[_0x3fd541+_0x031f('0x19')][_0x031f('0x1a')](_0x327f11)[_0x031f('0x1b')](function(_0x286177){logger['info'](_0x031f('0x1c'),_0x56328c,_0x327f11[_0x031f('0x1d')]);})['catch'](function(_0xcdae16){logger['error'](_0x031f('0x1c'),_0x56328c,JSON[_0x031f('0x1e')](_0xcdae16));})[_0x031f('0x1f')](function(){logger[_0x031f('0xb')](_0x031f('0x20'),_0x56328c);_0x487e65[_0x031f('0x21')]();});}else{logger[_0x031f('0xb')](_0x031f('0x22'),_0x56328c);_0x487e65[_0x031f('0x21')]();}}else{var _0x345bde=this;var _0x29dd6e=new AWS['LexRuntime']({'accessKeyId':_0x3dc98e[0x0],'secretAccessKey':_0x3dc98e[0x1],'region':_0x3dc98e[0x2]});var _0xf72793={'botAlias':_0x031f('0x23'),'botName':_0x3dc98e[0x3],'inputText':this[_0x031f('0x24')]['body'],'userId':this['channel']+':'+this[_0x031f('0x9')]['id']['toString']()};_0x29dd6e[_0x031f('0x25')](_0xf72793,function(_0x57f6c4,_0x54d054){if(_0x57f6c4){logger['error'](_0x031f('0x1c'),_0x56328c,_0x57f6c4[_0x031f('0x24')]);_0x487e65[_0x031f('0xd')]();}else if(_0x54d054&&_0x54d054[_0x031f('0x24')]){_0x345bde['body'][_0x031f('0x26')]=_0x54d054;_0x327f11['body']=_0x54d054[_0x031f('0x24')];return rpc[_0x3fd541+_0x031f('0x19')][_0x031f('0x1a')](_0x327f11)['then'](function(_0x35af16){logger[_0x031f('0xb')]('[%s][AMAZONLEX]\x20%s',_0x56328c,_0x327f11[_0x031f('0x1d')]);if(_0x54d054[_0x031f('0x27')]==_0x031f('0x28')){_0x487e65['next']();}else{_0x487e65[_0x031f('0x21')]();}})[_0x031f('0x29')](function(_0xb6ed6c){logger[_0x031f('0x2a')](_0x031f('0x1c'),_0x56328c,JSON[_0x031f('0x1e')](_0xb6ed6c));_0x487e65['next']();});}else{_0x487e65[_0x031f('0xd')]();}});}}catch(_0xab24ad){logger[_0x031f('0x2a')](_0x031f('0x1c'),_0x56328c,JSON[_0x031f('0x1e')](_0xab24ad));_0x487e65[_0x031f('0x21')]();}};}; \ No newline at end of file +var _0x326f=['toString','postText','dialogState','Failed','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','ChatWebsiteId','upperFirst','AccountId','InteractionId','getMustacheRender','Message','create','then','info','[%s][AMAZONLEX]\x20%s','body','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message'];(function(_0x2b4e01,_0x6301b4){var _0x4e8ee7=function(_0x408547){while(--_0x408547){_0x2b4e01['push'](_0x2b4e01['shift']());}};_0x4e8ee7(++_0x6301b4);}(_0x326f,0xd1));var _0xf326=function(_0x5186e1,_0x573206){_0x5186e1=_0x5186e1-0x0;var _0x4a48a4=_0x326f[_0x5186e1];return _0x4a48a4;};'use strict';var _=require(_0xf326('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xf326('0x1'));var logger=require(_0xf326('0x2'))(_0xf326('0x3'));var rpc={'chatMessage':require(_0xf326('0x4')),'openchannelMessage':require(_0xf326('0x5')),'mailMessage':require(_0xf326('0x6')),'smsMessage':require(_0xf326('0x7')),'faxMessage':require(_0xf326('0x8')),'whatsappMessage':require(_0xf326('0x9'))};exports[_0xf326('0xa')]=function(_0x4c2249,_0x3c254d){return function(_0x3851eb){try{if(!_[_0xf326('0xb')](this[_0xf326('0xc')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4c2249,_0xf326('0xd'));return _0x3851eb[_0xf326('0xe')]();}var _0x163416={'ContactId':this[_0xf326('0xf')]['id'],'sentAt':moment()[_0xf326('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf326('0x11')};var _0x53cbcd=this[_0xf326('0x12')];if(_0x53cbcd==='chat'){_0x163416[_0xf326('0x13')]=this['account']['id'];}else{_0x163416[_[_0xf326('0x14')](_0x53cbcd)+_0xf326('0x15')]=this['account']['id'];}_0x163416[_[_0xf326('0x14')](_0x53cbcd)+_0xf326('0x16')]=this[_0xf326('0xc')]['id'];if(this[_0xf326('0xc')]['created']){var _0x45c1b6=_0x3c254d[0x4];if(!_['isEmpty'](_0x45c1b6)){_0x163416['body']=utils[_0xf326('0x17')](_0x45c1b6,this);return rpc[_0x53cbcd+_0xf326('0x18')][_0xf326('0x19')](_0x163416)[_0xf326('0x1a')](function(_0x292f4b){logger[_0xf326('0x1b')](_0xf326('0x1c'),_0x4c2249,_0x163416[_0xf326('0x1d')]);})['catch'](function(_0x3ad7da){logger[_0xf326('0x1e')](_0xf326('0x1c'),_0x4c2249,JSON[_0xf326('0x1f')](_0x3ad7da));})[_0xf326('0x20')](function(){logger[_0xf326('0x1b')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4c2249);_0x3851eb['stop']();});}else{logger['info'](_0xf326('0x21'),_0x4c2249);_0x3851eb[_0xf326('0x22')]();}}else{var _0x484cbe=this;var _0x4cabce=new AWS[(_0xf326('0x23'))]({'accessKeyId':_0x3c254d[0x0],'secretAccessKey':_0x3c254d[0x1],'region':_0x3c254d[0x2]});var _0x4dfa76={'botAlias':'$LATEST','botName':_0x3c254d[0x3],'inputText':this[_0xf326('0x24')][_0xf326('0x1d')],'userId':this['channel']+':'+this['interaction']['id'][_0xf326('0x25')]()};_0x4cabce[_0xf326('0x26')](_0x4dfa76,function(_0x5f21a2,_0x337ed5){if(_0x5f21a2){logger[_0xf326('0x1e')](_0xf326('0x1c'),_0x4c2249,_0x5f21a2[_0xf326('0x24')]);_0x3851eb[_0xf326('0xe')]();}else if(_0x337ed5&&_0x337ed5[_0xf326('0x24')]){_0x484cbe['body']['amazonlex']=_0x337ed5;_0x163416['body']=_0x337ed5[_0xf326('0x24')];return rpc[_0x53cbcd+_0xf326('0x18')][_0xf326('0x19')](_0x163416)[_0xf326('0x1a')](function(_0x148953){logger[_0xf326('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x4c2249,_0x163416[_0xf326('0x1d')]);if(_0x337ed5[_0xf326('0x27')]==_0xf326('0x28')){_0x3851eb['next']();}else{_0x3851eb[_0xf326('0x22')]();}})['catch'](function(_0x4a9abf){logger[_0xf326('0x1e')](_0xf326('0x1c'),_0x4c2249,JSON[_0xf326('0x1f')](_0x4a9abf));_0x3851eb['next']();});}else{_0x3851eb[_0xf326('0xe')]();}});}}catch(_0x292500){logger['error'](_0xf326('0x1c'),_0x4c2249,JSON[_0xf326('0x1f')](_0x292500));_0x3851eb[_0xf326('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index cf1166e..e04f7a8 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 _0x4a93=['format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','Smtp','service','host','port','secure','auth','user','inReplyTo','messageId','html','','replace','body','','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','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/whatsappMessage','isNil','interaction','channel','getMustacheRender'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4a93,0x15b));var _0x34a9=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x4a93[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x34a9('0x0'));var moment=require(_0x34a9('0x1'));var utils=require(_0x34a9('0x2'));var logger=require(_0x34a9('0x3'))('routing');var rpc={'chatMessage':require(_0x34a9('0x4')),'openchannelMessage':require(_0x34a9('0x5')),'mailMessage':require(_0x34a9('0x6')),'smsMessage':require(_0x34a9('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x34a9('0x8'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x129719,_0x2d31cb){return function(_0x3a5fd5){try{if(_0x2d31cb[0x0]==='1'&&(_[_0x34a9('0x9')](this[_0x34a9('0xa')]['created'])||!this[_0x34a9('0xa')]['created'])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x129719,'Autoreply\x20already\x20sent');return _0x3a5fd5['next']();}var _0x1fc9fa=this[_0x34a9('0xb')];var _0x4f2914={'body':utils[_0x34a9('0xc')](_0x2d31cb[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0x34a9('0xd')](_0x34a9('0xe')),'direction':_0x34a9('0xf')};if(this[_0x34a9('0x10')]){_0x4f2914['to']=this[_0x34a9('0x10')][_0x34a9('0x11')]||'';_0x4f2914['cc']=this['message']['cc']||'';_0x4f2914['from']=this['message']['to']||'';_0x4f2914[_0x34a9('0x12')]=this[_0x34a9('0x10')][_0x34a9('0x12')]||'';_0x4f2914[_0x34a9('0x13')]=!![];if(this[_0x34a9('0x10')]['subject']){_0x4f2914[_0x34a9('0x14')]='';_0x4f2914[_0x34a9('0x14')]+=_[_0x34a9('0x15')](this[_0x34a9('0x10')][_0x34a9('0x14')],_0x34a9('0x16'))?'':_0x34a9('0x17');_0x4f2914[_0x34a9('0x14')]+=this[_0x34a9('0x10')][_0x34a9('0x14')];}}if(this[_0x34a9('0xb')]===_0x34a9('0x18')){_0x4f2914[_0x34a9('0x19')]=this[_0x34a9('0x1a')]['id'];}else{_0x4f2914[_[_0x34a9('0x1b')](this[_0x34a9('0xb')])+_0x34a9('0x1c')]=this[_0x34a9('0x1a')]['id'];}_0x4f2914[_[_0x34a9('0x1b')](this[_0x34a9('0xb')])+_0x34a9('0x1d')]=this['interaction']['id'];if(rpc[this[_0x34a9('0xb')]+_0x34a9('0x1e')]){if(this[_0x34a9('0xb')]===_0x34a9('0x1f')){var _0x4d92ee={'tls':{'rejectUnauthorized':![]}};if(this[_0x34a9('0x1a')][_0x34a9('0x20')][_0x34a9('0x21')]){_0x4d92ee['service']=this[_0x34a9('0x1a')][_0x34a9('0x20')][_0x34a9('0x21')];}else{_0x4d92ee[_0x34a9('0x22')]=this[_0x34a9('0x1a')]['Smtp'][_0x34a9('0x22')];_0x4d92ee[_0x34a9('0x23')]=this[_0x34a9('0x1a')]['Smtp'][_0x34a9('0x23')];_0x4d92ee[_0x34a9('0x24')]=this[_0x34a9('0x1a')][_0x34a9('0x20')]['secure'];}if(this['account']['Smtp']['authentication']){_0x4d92ee[_0x34a9('0x25')]={'user':this[_0x34a9('0x1a')][_0x34a9('0x20')][_0x34a9('0x26')],'pass':this[_0x34a9('0x1a')][_0x34a9('0x20')]['pass']};}_0x4f2914[_0x34a9('0x27')]=this[_0x34a9('0x10')][_0x34a9('0x28')];_0x4f2914[_0x34a9('0x29')]=_0x34a9('0x2a')+_[_0x34a9('0x2b')](_0x4f2914[_0x34a9('0x2c')],_0x34a9('0x2d'),_0x34a9('0x2e'))+_0x34a9('0x2f');return mailRpc['sendMailMessage'](_0x4d92ee,_0x4f2914)[_0x34a9('0x30')](function(_0x46ac4f){logger[_0x34a9('0x31')](_0x34a9('0x32'),_0x129719);_0x4f2914[_0x34a9('0x28')]=_0x46ac4f['message'][_0x34a9('0x28')];return rpc[_0x1fc9fa+_0x34a9('0x1e')][_0x34a9('0x33')](_0x4f2914);})['then'](function(_0x2e1d59){logger[_0x34a9('0x31')](_0x34a9('0x34'),_0x129719,JSON[_0x34a9('0x35')](_0x2e1d59));})[_0x34a9('0x36')](function(_0xde0364){logger[_0x34a9('0x37')](_0x34a9('0x38'),_0x129719,JSON[_0x34a9('0x35')](_0xde0364));})[_0x34a9('0x39')](function(){_0x3a5fd5[_0x34a9('0x3a')]();});}else{return rpc[this[_0x34a9('0xb')]+_0x34a9('0x1e')][_0x34a9('0x33')](_0x4f2914)[_0x34a9('0x30')](function(_0x394524){logger[_0x34a9('0x31')](_0x34a9('0x34'),_0x129719,_0x4f2914[_0x34a9('0x2c')]);})['catch'](function(_0x12ef87){logger[_0x34a9('0x37')]('[%s][AUTOREPLY]\x20%s',_0x129719,JSON['stringify'](_0x12ef87));})[_0x34a9('0x39')](function(){_0x3a5fd5[_0x34a9('0x3a')]();});}}}catch(_0xa9a070){logger[_0x34a9('0x37')]('[%s][AUTOREPLY]\x20%s',_0x129719,JSON[_0x34a9('0x35')](_0xa9a070));_0x3a5fd5[_0x34a9('0x3b')]();}};}; \ No newline at end of file +var _0x18ea=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','created','interaction','info','[%s][AUTOREPLY]\x20%s','next','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','service','Smtp','host','port','authentication','pass','html','','replace','body','';return mailRpc[_0xa18e('0x2e')](_0x5e19d4,_0x2c54d8)[_0xa18e('0x2f')](function(_0xd3dbcb){logger[_0xa18e('0xc')](_0xa18e('0x30'),_0x39f6bc);_0x2c54d8[_0xa18e('0x31')]=_0xd3dbcb[_0xa18e('0x14')]['messageId'];return rpc[_0x467e46+_0xa18e('0x32')][_0xa18e('0x33')](_0x2c54d8);})[_0xa18e('0x2f')](function(_0x4e7684){logger[_0xa18e('0xc')](_0xa18e('0xd'),_0x39f6bc,JSON[_0xa18e('0x34')](_0x4e7684));})['catch'](function(_0x23fc96){logger[_0xa18e('0x35')]('[RPC][%s][AUTOREPLY]\x20%s',_0x39f6bc,JSON['stringify'](_0x23fc96));})[_0xa18e('0x36')](function(){_0x915e6[_0xa18e('0xe')]();});}else{return rpc[this[_0xa18e('0x1c')]+_0xa18e('0x32')][_0xa18e('0x33')](_0x2c54d8)[_0xa18e('0x2f')](function(_0x75b28a){logger[_0xa18e('0xc')](_0xa18e('0xd'),_0x39f6bc,_0x2c54d8['body']);})['catch'](function(_0x5b0184){logger[_0xa18e('0x35')]('[%s][AUTOREPLY]\x20%s',_0x39f6bc,JSON[_0xa18e('0x34')](_0x5b0184));})[_0xa18e('0x36')](function(){_0x915e6['next']();});}}}catch(_0x1b84f8){logger[_0xa18e('0x35')](_0xa18e('0xd'),_0x39f6bc,JSON[_0xa18e('0x34')](_0x1b84f8));_0x915e6[_0xa18e('0x37')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 0139902..ba0359f 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 _0xd8a7=['YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x3cf548,_0x322d92){_0x3cf548=_0x3cf548-0x0;var _0x207544=_0xd8a7[_0x3cf548];return _0x207544;};'use strict';var moment=require(_0x7d8a('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7d8a('0x1')),'smsInteraction':require(_0x7d8a('0x2')),'mailInteraction':require(_0x7d8a('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7d8a('0x4'))};exports['consequence']=function(_0x435491,_0x4906c5,_0x27ef8e,_0x530308){return function(_0x1cf673){try{logger[_0x7d8a('0x5')](_0x7d8a('0x6'),_0x435491,_0x4906c5[0x0]);var _0x58ead1={'closed':0x1,'closedAt':moment()[_0x7d8a('0x7')](_0x7d8a('0x8')),'closeReason':_0x7d8a('0x9'),'disposition':_0x4906c5[0x0]};if(rpc[_0x530308[_0x7d8a('0xa')]+_0x7d8a('0xb')]){rpc[_0x530308[_0x7d8a('0xa')]+_0x7d8a('0xb')][_0x7d8a('0xc')](_0x530308[_0x7d8a('0xd')]['id'],_0x58ead1)[_0x7d8a('0xe')](function(_0x32241e){logger[_0x7d8a('0x5')](_0x7d8a('0xf'),_0x435491,_0x530308['interaction']['id']);})[_0x7d8a('0x10')](function(_0xd57f7d){logger[_0x7d8a('0x11')](_0x7d8a('0x12'),_0x435491,JSON[_0x7d8a('0x13')](_0xd57f7d));})['finally'](function(){_0x1cf673[_0x7d8a('0x14')]();});}}catch(_0x5a9b2c){logger[_0x7d8a('0x11')]('[%s][CLOSE]\x20%s',_0x435491,JSON[_0x7d8a('0x13')](_0x5a9b2c));_0x1cf673['stop']();}};}; \ No newline at end of file +var _0xbd18=['../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing'];(function(_0x34d9b7,_0x40ff98){var _0xf5e297=function(_0x5e35c0){while(--_0x5e35c0){_0x34d9b7['push'](_0x34d9b7['shift']());}};_0xf5e297(++_0x40ff98);}(_0xbd18,0x195));var _0x8bd1=function(_0x1dddf7,_0x460b89){_0x1dddf7=_0x1dddf7-0x0;var _0x58cb90=_0xbd18[_0x1dddf7];return _0x58cb90;};'use strict';var moment=require(_0x8bd1('0x0'));var logger=require(_0x8bd1('0x1'))(_0x8bd1('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8bd1('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x8bd1('0x4'))};exports[_0x8bd1('0x5')]=function(_0x5abf07,_0x4da687,_0x205c76,_0x136254){return function(_0x325bed){try{logger[_0x8bd1('0x6')]('[%s][CLOSE]\x20reason\x20%s',_0x5abf07,_0x4da687[0x0]);var _0x13d571={'closed':0x1,'closedAt':moment()[_0x8bd1('0x7')](_0x8bd1('0x8')),'closeReason':'system','disposition':_0x4da687[0x0]};if(rpc[_0x136254[_0x8bd1('0x9')]+_0x8bd1('0xa')]){rpc[_0x136254[_0x8bd1('0x9')]+_0x8bd1('0xa')]['update'](_0x136254[_0x8bd1('0xb')]['id'],_0x13d571)['then'](function(_0xc299be){logger[_0x8bd1('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5abf07,_0x136254[_0x8bd1('0xb')]['id']);})['catch'](function(_0x186943){logger[_0x8bd1('0xc')](_0x8bd1('0xd'),_0x5abf07,JSON[_0x8bd1('0xe')](_0x186943));})[_0x8bd1('0xf')](function(){_0x325bed[_0x8bd1('0x10')]();});}}catch(_0x194812){logger[_0x8bd1('0xc')](_0x8bd1('0xd'),_0x5abf07,JSON['stringify'](_0x194812));_0x325bed[_0x8bd1('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index d151ef5..f4a06f9 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 _0xe1fc=['info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','metadata','endConversation','stop','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','create','then'];(function(_0x684730,_0x1b91e9){var _0x230593=function(_0x32377a){while(--_0x32377a){_0x684730['push'](_0x684730['shift']());}};_0x230593(++_0x1b91e9);}(_0xe1fc,0x143));var _0xce1f=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0xe1fc[_0x56756b];return _0xa3002;};'use strict';var _=require(_0xce1f('0x0'));var moment=require(_0xce1f('0x1'));var apiai=require(_0xce1f('0x2'));var md5=require(_0xce1f('0x3'));var utils=require(_0xce1f('0x4'));var logger=require('../../../../config/logger')(_0xce1f('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xce1f('0x6')),'mailMessage':require(_0xce1f('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xce1f('0x8'))};exports[_0xce1f('0x9')]=function(_0xaf1d4c,_0xc8a1de){return function(_0x4c661e){try{if(!_[_0xce1f('0xa')](this[_0xce1f('0xb')][_0xce1f('0xc')])){logger['info'](_0xce1f('0xd'),_0xaf1d4c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4c661e[_0xce1f('0xe')]();}var _0x1568d2={'ContactId':this[_0xce1f('0xf')]['id'],'sentAt':moment()[_0xce1f('0x10')](_0xce1f('0x11')),'direction':'out'};var _0x138e0b=this[_0xce1f('0x12')];if(_0x138e0b===_0xce1f('0x13')){_0x1568d2['ChatWebsiteId']=this[_0xce1f('0x14')]['id'];}else{_0x1568d2[_[_0xce1f('0x15')](_0x138e0b)+_0xce1f('0x16')]=this['account']['id'];}_0x1568d2[_[_0xce1f('0x15')](_0x138e0b)+'InteractionId']=this['interaction']['id'];if(this[_0xce1f('0xb')]['created']){var _0x40b401=_0xc8a1de[0x2];if(!_[_0xce1f('0x17')](_0x40b401)){_0x1568d2[_0xce1f('0x18')]=utils[_0xce1f('0x19')](_0x40b401,this);return rpc[_0x138e0b+_0xce1f('0x1a')][_0xce1f('0x1b')](_0x1568d2)[_0xce1f('0x1c')](function(_0x2723ae){logger[_0xce1f('0x1d')](_0xce1f('0xd'),_0xaf1d4c,_0x1568d2[_0xce1f('0x18')]);})[_0xce1f('0x1e')](function(_0x6cf4cf){logger[_0xce1f('0x1f')](_0xce1f('0xd'),_0xaf1d4c,JSON[_0xce1f('0x20')](_0x6cf4cf));})[_0xce1f('0x21')](function(){logger['info'](_0xce1f('0x22'),_0xaf1d4c);_0x4c661e['stop']();});}else{logger['info'](_0xce1f('0x23'),_0xaf1d4c);_0x4c661e['stop']();}}else{var _0x2d390d=this;var _0x5e8f84=apiai(_0xc8a1de[0x0],{'language':_0xc8a1de[0x1]||'en'});return _0x5e8f84[_0xce1f('0x24')](this[_0xce1f('0x25')][_0xce1f('0x18')],{'sessionId':md5(this[_0xce1f('0xb')]['id'])})['then'](function(_0x1d408a){_0x2d390d[_0xce1f('0x18')][_0xce1f('0x26')]=_0x1d408a;_0x1568d2['body']=_0x1d408a['result'][_0xce1f('0x27')][_0xce1f('0x28')];return rpc[_0x138e0b+_0xce1f('0x1a')][_0xce1f('0x1b')](_0x1568d2)[_0xce1f('0x1c')](function(_0x38ba54){logger[_0xce1f('0x1d')](_0xce1f('0xd'),_0xaf1d4c,_0x1568d2[_0xce1f('0x18')]);if(_0x1d408a['result'][_0xce1f('0x29')][_0xce1f('0x2a')]){_0x4c661e[_0xce1f('0xe')]();}else{_0x4c661e[_0xce1f('0x2b')]();}})[_0xce1f('0x1e')](function(_0x3848d4){logger[_0xce1f('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0xaf1d4c,JSON[_0xce1f('0x20')](_0x3848d4));_0x4c661e[_0xce1f('0xe')]();});})['catch'](function(_0x9e868e){logger['error'](_0xce1f('0xd'),_0xaf1d4c,_0x9e868e[_0xce1f('0x25')]);_0x4c661e[_0xce1f('0xe')]();});}}catch(_0x446e4f){logger[_0xce1f('0x1f')](_0xce1f('0xd'),_0xaf1d4c,JSON['stringify'](_0x446e4f));_0x4c661e[_0xce1f('0x2b')]();}};}; \ No newline at end of file +var _0x4daa=['message','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','created','getMustacheRender','Message','create','info','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','result','fulfillment','speech','metadata'];(function(_0x1b520f,_0x44a8ce){var _0x206297=function(_0x50eba6){while(--_0x50eba6){_0x1b520f['push'](_0x1b520f['shift']());}};_0x206297(++_0x44a8ce);}(_0x4daa,0xe7));var _0xa4da=function(_0x96cefd,_0x25cb5d){_0x96cefd=_0x96cefd-0x0;var _0x4310c1=_0x4daa[_0x96cefd];return _0x4310c1;};'use strict';var _=require(_0xa4da('0x0'));var moment=require('moment');var apiai=require(_0xa4da('0x1'));var md5=require(_0xa4da('0x2'));var utils=require(_0xa4da('0x3'));var logger=require(_0xa4da('0x4'))(_0xa4da('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa4da('0x6')),'mailMessage':require(_0xa4da('0x7')),'smsMessage':require(_0xa4da('0x8')),'faxMessage':require(_0xa4da('0x9')),'whatsappMessage':require(_0xa4da('0xa'))};exports['consequence']=function(_0x893bc0,_0x3e6819){return function(_0x25d5bc){try{if(!_[_0xa4da('0xb')](this[_0xa4da('0xc')][_0xa4da('0xd')])){logger['info'](_0xa4da('0xe'),_0x893bc0,_0xa4da('0xf'));return _0x25d5bc[_0xa4da('0x10')]();}var _0x2a6b2a={'ContactId':this[_0xa4da('0x11')]['id'],'sentAt':moment()[_0xa4da('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa4da('0x13')};var _0x2318eb=this[_0xa4da('0x14')];if(_0x2318eb===_0xa4da('0x15')){_0x2a6b2a[_0xa4da('0x16')]=this['account']['id'];}else{_0x2a6b2a[_[_0xa4da('0x17')](_0x2318eb)+_0xa4da('0x18')]=this[_0xa4da('0x19')]['id'];}_0x2a6b2a[_['upperFirst'](_0x2318eb)+'InteractionId']=this[_0xa4da('0xc')]['id'];if(this[_0xa4da('0xc')][_0xa4da('0x1a')]){var _0x135f78=_0x3e6819[0x2];if(!_['isEmpty'](_0x135f78)){_0x2a6b2a['body']=utils[_0xa4da('0x1b')](_0x135f78,this);return rpc[_0x2318eb+_0xa4da('0x1c')][_0xa4da('0x1d')](_0x2a6b2a)['then'](function(_0x86bd9d){logger[_0xa4da('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x893bc0,_0x2a6b2a[_0xa4da('0x1f')]);})[_0xa4da('0x20')](function(_0x30f73c){logger[_0xa4da('0x21')](_0xa4da('0xe'),_0x893bc0,JSON[_0xa4da('0x22')](_0x30f73c));})[_0xa4da('0x23')](function(){logger[_0xa4da('0x1e')](_0xa4da('0x24'),_0x893bc0);_0x25d5bc[_0xa4da('0x25')]();});}else{logger[_0xa4da('0x1e')](_0xa4da('0x26'),_0x893bc0);_0x25d5bc['stop']();}}else{var _0x15f873=this;var _0x5a68e3=apiai(_0x3e6819[0x0],{'language':_0x3e6819[0x1]||'en'});return _0x5a68e3[_0xa4da('0x27')](this['message'][_0xa4da('0x1f')],{'sessionId':md5(this[_0xa4da('0xc')]['id'])})[_0xa4da('0x28')](function(_0x81ce61){_0x15f873['body']['dialogflow']=_0x81ce61;_0x2a6b2a[_0xa4da('0x1f')]=_0x81ce61[_0xa4da('0x29')][_0xa4da('0x2a')][_0xa4da('0x2b')];return rpc[_0x2318eb+_0xa4da('0x1c')][_0xa4da('0x1d')](_0x2a6b2a)[_0xa4da('0x28')](function(_0x4e12f0){logger['info'](_0xa4da('0xe'),_0x893bc0,_0x2a6b2a[_0xa4da('0x1f')]);if(_0x81ce61[_0xa4da('0x29')][_0xa4da('0x2c')]['endConversation']){_0x25d5bc['next']();}else{_0x25d5bc[_0xa4da('0x25')]();}})[_0xa4da('0x20')](function(_0x3a1bc9){logger[_0xa4da('0x21')](_0xa4da('0xe'),_0x893bc0,JSON[_0xa4da('0x22')](_0x3a1bc9));_0x25d5bc['next']();});})['catch'](function(_0x1c64d4){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x893bc0,_0x1c64d4[_0xa4da('0x2d')]);_0x25d5bc[_0xa4da('0x10')]();});}}catch(_0x5c51c0){logger[_0xa4da('0x21')](_0xa4da('0xe'),_0x893bc0,JSON[_0xa4da('0x22')](_0x5c51c0));_0x25d5bc['stop']();}};}; \ 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 93a3c86..be58e62 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 _0x2834=['join','priorityTrue','priorityFalse','info','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message'];(function(_0x42879f,_0x3b68ed){var _0x328d93=function(_0x20e0ed){while(--_0x20e0ed){_0x42879f['push'](_0x42879f['shift']());}};_0x328d93(++_0x3b68ed);}(_0x2834,0x174));var _0x4283=function(_0x10bed5,_0x277d1e){_0x10bed5=_0x10bed5-0x0;var _0x198db7=_0x2834[_0x10bed5];return _0x198db7;};'use strict';var schema=require(_0x4283('0x0'));var _=require(_0x4283('0x1'));var htmlToText=require(_0x4283('0x2'));var utils=require(_0x4283('0x3'));var logger=require(_0x4283('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x4283('0x5'),'required':!![],'message':_0x4283('0x6')},'priorityTrue':{'type':_0x4283('0x7'),'message':_0x4283('0x8')},'priorityFalse':{'type':_0x4283('0x7'),'message':_0x4283('0x9')}});exports[_0x4283('0xa')]=function(_0x106851,_0x21a7cd){return function(_0x1d8d3f){try{var _0x43e9fa={'condition':htmlToText['fromString'](utils[_0x4283('0xb')](_0x21a7cd[0x0],this),{'wordwrap':![]})[_0x4283('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x21a7cd[0x1],'priorityFalse':_0x21a7cd[0x2]};var _0x272546=gotoif['validate'](_0x43e9fa,{'typecast':!![]});if(_0x272546[_0x4283('0xd')]){logger[_0x4283('0xe')](_0x4283('0xf'),_0x106851,_[_0x4283('0x10')](_0x272546,_0x4283('0x11'))[_0x4283('0x12')](',\x20'));_0x1d8d3f['stop']();}else{try{var _0x2f9edf=eval('('+_0x43e9fa['condition']+')');var _0x4d5148=_0x2f9edf?_0x43e9fa[_0x4283('0x13')]:_0x43e9fa[_0x4283('0x14')];logger[_0x4283('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x106851,_0x43e9fa[_0x4283('0x16')],_0x2f9edf,_0x4d5148||_0x4283('0x17'));if(_0x4d5148){var _0x39c45d=_[_0x4283('0x18')](_0x1d8d3f[_0x4283('0x19')](),{'p':_0x4d5148});if(_0x39c45d>=0x0){logger[_0x4283('0x15')](_0x4283('0x1a'),_0x106851,_0x4d5148||_0x4283('0x17'),_0x39c45d);_0x1d8d3f[_0x4283('0x17')](_0x39c45d);}else{logger[_0x4283('0x15')](_0x4283('0x1b'),_0x106851,_0x4d5148||_0x4283('0x17'));_0x1d8d3f['stop']();}}else{_0x1d8d3f[_0x4283('0x17')]();}}catch(_0x856a36){logger[_0x4283('0xe')](_0x4283('0x1c'),_0x106851,_0x856a36[_0x4283('0x11')]);_0x1d8d3f['stop']();}}}catch(_0x4f1ec6){logger['error'](_0x4283('0xf'),_0x106851,JSON[_0x4283('0x1d')](_0x4f1ec6));_0x1d8d3f['stop']();}};}; \ No newline at end of file +var _0xfa00=['lodash','html-to-text','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate'];(function(_0x62829a,_0x25e396){var _0xc8828e=function(_0x1e8626){while(--_0x1e8626){_0x62829a['push'](_0x62829a['shift']());}};_0xc8828e(++_0x25e396);}(_0xfa00,0x1df));var _0x0fa0=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xfa00[_0x4e676e];return _0x336a3c;};'use strict';var schema=require(_0x0fa0('0x0'));var _=require(_0x0fa0('0x1'));var htmlToText=require(_0x0fa0('0x2'));var utils=require(_0x0fa0('0x3'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x0fa0('0x4'),'required':!![],'message':_0x0fa0('0x5')},'priorityTrue':{'type':_0x0fa0('0x6'),'message':_0x0fa0('0x7')},'priorityFalse':{'type':_0x0fa0('0x6'),'message':_0x0fa0('0x8')}});exports[_0x0fa0('0x9')]=function(_0x3a4d97,_0x3bf2fb){return function(_0x526e5e){try{var _0x59cadf={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x3bf2fb[0x0],this),{'wordwrap':![]})[_0x0fa0('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3bf2fb[0x1],'priorityFalse':_0x3bf2fb[0x2]};var _0xdebf28=gotoif[_0x0fa0('0x0')](_0x59cadf,{'typecast':!![]});if(_0xdebf28[_0x0fa0('0xb')]){logger[_0x0fa0('0xc')](_0x0fa0('0xd'),_0x3a4d97,_[_0x0fa0('0xe')](_0xdebf28,_0x0fa0('0xf'))[_0x0fa0('0x10')](',\x20'));_0x526e5e[_0x0fa0('0x11')]();}else{try{var _0x5269ec=eval('('+_0x59cadf[_0x0fa0('0x12')]+')');var _0x9c59db=_0x5269ec?_0x59cadf[_0x0fa0('0x13')]:_0x59cadf[_0x0fa0('0x14')];logger[_0x0fa0('0x15')](_0x0fa0('0x16'),_0x3a4d97,_0x59cadf['condition'],_0x5269ec,_0x9c59db||_0x0fa0('0x17'));if(_0x9c59db){var _0xe88046=_[_0x0fa0('0x18')](_0x526e5e[_0x0fa0('0x19')](),{'p':_0x9c59db});if(_0xe88046>=0x0){logger['info'](_0x0fa0('0x1a'),_0x3a4d97,_0x9c59db||'next',_0xe88046);_0x526e5e[_0x0fa0('0x17')](_0xe88046);}else{logger['info'](_0x0fa0('0x1b'),_0x3a4d97,_0x9c59db||_0x0fa0('0x17'));_0x526e5e['stop']();}}else{_0x526e5e[_0x0fa0('0x17')]();}}catch(_0x1f3b66){logger[_0x0fa0('0xc')](_0x0fa0('0x1c'),_0x3a4d97,_0x1f3b66['message']);_0x526e5e[_0x0fa0('0x11')]();}}}catch(_0x1ee84e){logger[_0x0fa0('0xc')](_0x0fa0('0xd'),_0x3a4d97,JSON[_0x0fa0('0x1d')](_0x1ee84e));_0x526e5e[_0x0fa0('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index a83ab01..b993573 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 _0xeac3=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','message','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xeac3,0x1f3));var _0x3eac=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeac3[_0x2641f9];return _0x585741;};'use strict';var schema=require(_0x3eac('0x0'));var _=require('lodash');var logger=require(_0x3eac('0x1'))('routing');var gotop=schema({'priority':{'type':_0x3eac('0x2'),'required':!![],'message':_0x3eac('0x3')}});exports[_0x3eac('0x4')]=function(_0xec023c,_0x77f43e){return function(_0x26a12d){try{var _0x1ebdc4={'priority':_0x77f43e[0x0]};var _0x37184c=gotop[_0x3eac('0x0')](_0x1ebdc4,{'typecast':!![]});if(_0x37184c[_0x3eac('0x5')]){logger['error'](_0x3eac('0x6'),_0xec023c,_['map'](_0x37184c,_0x3eac('0x7'))['join'](',\x20'));_0x26a12d['stop']();}else{logger[_0x3eac('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0xec023c,_0x1ebdc4['priority']);if(_0x1ebdc4[_0x3eac('0x9')]){var _0x1fb78e=_[_0x3eac('0xa')](_0x26a12d['rules'](),{'p':_0x1ebdc4['priority']});if(_0x1fb78e>=0x0){logger[_0x3eac('0x8')](_0x3eac('0xb'),_0xec023c,_0x1ebdc4[_0x3eac('0x9')]||_0x3eac('0xc'),_0x1fb78e);_0x26a12d[_0x3eac('0xc')](_0x1fb78e);}else{logger[_0x3eac('0x8')](_0x3eac('0xd'),_0xec023c,_0x1ebdc4[_0x3eac('0x9')]||_0x3eac('0xc'));_0x26a12d[_0x3eac('0xe')]();}}else{_0x26a12d[_0x3eac('0xc')]();}}}catch(_0x544eea){logger['error']('[%s][GOTOP]\x20%s',_0xec023c,JSON[_0x3eac('0xf')](_0x544eea));_0x26a12d['stop']();}};}; \ No newline at end of file +var _0xe543=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','lodash','../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe543,0x10c));var _0x3e54=function(_0x5bc8c1,_0x24b525){_0x5bc8c1=_0x5bc8c1-0x0;var _0x14d4e4=_0xe543[_0x5bc8c1];return _0x14d4e4;};'use strict';var schema=require(_0x3e54('0x0'));var _=require(_0x3e54('0x1'));var logger=require(_0x3e54('0x2'))(_0x3e54('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x3e54('0x4')}});exports['consequence']=function(_0x5744ea,_0x900cb){return function(_0x43c5ff){try{var _0x10757a={'priority':_0x900cb[0x0]};var _0x100a9d=gotop[_0x3e54('0x0')](_0x10757a,{'typecast':!![]});if(_0x100a9d[_0x3e54('0x5')]){logger['error'](_0x3e54('0x6'),_0x5744ea,_[_0x3e54('0x7')](_0x100a9d,_0x3e54('0x8'))[_0x3e54('0x9')](',\x20'));_0x43c5ff[_0x3e54('0xa')]();}else{logger['info'](_0x3e54('0xb'),_0x5744ea,_0x10757a[_0x3e54('0xc')]);if(_0x10757a[_0x3e54('0xc')]){var _0x112ff0=_[_0x3e54('0xd')](_0x43c5ff['rules'](),{'p':_0x10757a[_0x3e54('0xc')]});if(_0x112ff0>=0x0){logger[_0x3e54('0xe')](_0x3e54('0xf'),_0x5744ea,_0x10757a[_0x3e54('0xc')]||_0x3e54('0x10'),_0x112ff0);_0x43c5ff[_0x3e54('0x10')](_0x112ff0);}else{logger[_0x3e54('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x5744ea,_0x10757a['priority']||_0x3e54('0x10'));_0x43c5ff[_0x3e54('0xa')]();}}else{_0x43c5ff['next']();}}}catch(_0x4ea150){logger['error'](_0x3e54('0x6'),_0x5744ea,JSON['stringify'](_0x4ea150));_0x43c5ff[_0x3e54('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 3b5cd14..5abd9c5 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 _0x1fa3=['upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','next','catch','error','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account'];(function(_0x2b3567,_0x4beff3){var _0x29f24a=function(_0x4eabc9){while(--_0x4eabc9){_0x2b3567['push'](_0x2b3567['shift']());}};_0x29f24a(++_0x4beff3);}(_0x1fa3,0xc9));var _0x31fa=function(_0x429369,_0x4a7df4){_0x429369=_0x429369-0x0;var _0x36f0c5=_0x1fa3[_0x429369];return _0x36f0c5;};'use strict';var _=require('lodash');var utils=require(_0x31fa('0x0'));var logger=require(_0x31fa('0x1'))(_0x31fa('0x2'));var rpc={'chatMessage':require(_0x31fa('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x31fa('0x4')),'smsMessage':require(_0x31fa('0x5')),'faxMessage':require(_0x31fa('0x6')),'whatsappMessage':require(_0x31fa('0x7'))};exports[_0x31fa('0x8')]=function(_0x1fa871,_0x4ee266){return function(_0x49c945){try{var _0x3de22e={'body':utils[_0x31fa('0x9')](_0x4ee266[0x0],this),'ContactId':this[_0x31fa('0xa')]['id']};if(this[_0x31fa('0xb')]===_0x31fa('0xc')){_0x3de22e[_0x31fa('0xd')]=this[_0x31fa('0xe')]['id'];}else{_0x3de22e[_[_0x31fa('0xf')](this[_0x31fa('0xb')])+_0x31fa('0x10')]=this[_0x31fa('0xe')]['id'];}_0x3de22e[_[_0x31fa('0xf')](this['channel'])+_0x31fa('0x11')]=this[_0x31fa('0x12')]['id'];if(rpc[this[_0x31fa('0xb')]+_0x31fa('0x13')]){return rpc[this['channel']+_0x31fa('0x13')][_0x31fa('0x14')](_0x3de22e)[_0x31fa('0x15')](function(_0x5c6282){logger[_0x31fa('0x16')]('[%s][MESSAGE]\x20%s',_0x1fa871,_0x3de22e['body']);_0x49c945[_0x31fa('0x17')]();})[_0x31fa('0x18')](function(_0x41d4b4){logger[_0x31fa('0x19')]('[%s][MESSAGE]\x20%s',_0x1fa871,JSON[_0x31fa('0x1a')](_0x41d4b4));_0x49c945['stop']();});}}catch(_0x1be720){logger[_0x31fa('0x19')]('[%s][MESSAGE]\x20%s',_0x1fa871,JSON['stringify'](_0x1be720));_0x49c945['stop']();}};}; \ No newline at end of file +var _0x5221=['stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5221,0xe3));var _0x1522=function(_0x5a8c75,_0x610dc4){_0x5a8c75=_0x5a8c75-0x0;var _0x32aeca=_0x5221[_0x5a8c75];return _0x32aeca;};'use strict';var _=require(_0x1522('0x0'));var utils=require(_0x1522('0x1'));var logger=require(_0x1522('0x2'))(_0x1522('0x3'));var rpc={'chatMessage':require(_0x1522('0x4')),'openchannelMessage':require(_0x1522('0x5')),'mailMessage':require(_0x1522('0x6')),'smsMessage':require(_0x1522('0x7')),'faxMessage':require(_0x1522('0x8')),'whatsappMessage':require(_0x1522('0x9'))};exports[_0x1522('0xa')]=function(_0x376bec,_0x132c85){return function(_0x431a8b){try{var _0x26962a={'body':utils[_0x1522('0xb')](_0x132c85[0x0],this),'ContactId':this[_0x1522('0xc')]['id']};if(this[_0x1522('0xd')]===_0x1522('0xe')){_0x26962a[_0x1522('0xf')]=this['account']['id'];}else{_0x26962a[_['upperFirst'](this['channel'])+_0x1522('0x10')]=this[_0x1522('0x11')]['id'];}_0x26962a[_[_0x1522('0x12')](this[_0x1522('0xd')])+_0x1522('0x13')]=this[_0x1522('0x14')]['id'];if(rpc[this[_0x1522('0xd')]+_0x1522('0x15')]){return rpc[this[_0x1522('0xd')]+_0x1522('0x15')][_0x1522('0x16')](_0x26962a)[_0x1522('0x17')](function(_0x529d85){logger[_0x1522('0x18')](_0x1522('0x19'),_0x376bec,_0x26962a[_0x1522('0x1a')]);_0x431a8b[_0x1522('0x1b')]();})[_0x1522('0x1c')](function(_0x511743){logger['error'](_0x1522('0x19'),_0x376bec,JSON[_0x1522('0x1d')](_0x511743));_0x431a8b[_0x1522('0x1e')]();});}}catch(_0x10e0a5){logger[_0x1522('0x1f')](_0x1522('0x19'),_0x376bec,JSON[_0x1522('0x1d')](_0x10e0a5));_0x431a8b[_0x1522('0x1e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 844e170..795c75b 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 _0xfcbf=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing','info','[%s][NOOP]\x20%s'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0xfcbf,0x8c));var _0xffcb=function(_0x405f3f,_0x2830cd){_0x405f3f=_0x405f3f-0x0;var _0x42cf3b=_0xfcbf[_0x405f3f];return _0x42cf3b;};'use strict';var utils=require('./utils');var logger=require(_0xffcb('0x0'))(_0xffcb('0x1'));exports['consequence']=function(_0x4c7788,_0x33c0e7){return function(_0x4c0972){try{logger[_0xffcb('0x2')](_0xffcb('0x3'),_0x4c7788,utils[_0xffcb('0x4')](_0x33c0e7[0x0],this));_0x4c0972[_0xffcb('0x5')]();}catch(_0x1d9f06){logger[_0xffcb('0x6')](_0xffcb('0x3'),_0x4c7788,JSON[_0xffcb('0x7')](_0x1d9f06));_0x4c0972[_0xffcb('0x8')]();}};}; \ No newline at end of file +var _0x0999=['info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','../../../../config/logger','routing','consequence'];(function(_0x47f8cb,_0x44459e){var _0x24a7d6=function(_0x33aa4e){while(--_0x33aa4e){_0x47f8cb['push'](_0x47f8cb['shift']());}};_0x24a7d6(++_0x44459e);}(_0x0999,0x85));var _0x9099=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x0999[_0x30faec];return _0x29484f;};'use strict';var utils=require('./utils');var logger=require(_0x9099('0x0'))(_0x9099('0x1'));exports[_0x9099('0x2')]=function(_0x4784cd,_0x3ccddc){return function(_0x293e32){try{logger[_0x9099('0x3')](_0x9099('0x4'),_0x4784cd,utils[_0x9099('0x5')](_0x3ccddc[0x0],this));_0x293e32[_0x9099('0x6')]();}catch(_0x291456){logger['error'](_0x9099('0x4'),_0x4784cd,JSON[_0x9099('0x7')](_0x291456));_0x293e32['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index c1132d5..6b685f4 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 _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x4dcded,_0x27b074){var _0x33c8c2=function(_0x15ba23){while(--_0x15ba23){_0x4dcded['push'](_0x4dcded['shift']());}};_0x33c8c2(++_0x27b074);}(_0xedd9,0xfc));var _0x9edd=function(_0x30f730,_0x5a1aad){_0x30f730=_0x30f730-0x0;var _0x4b3c3d=_0xedd9[_0x30f730];return _0x4b3c3d;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ No newline at end of file +var _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x3e74,0x175));var _0x43e7=function(_0x534935,_0xca551c){_0x534935=_0x534935-0x0;var _0x328b90=_0x3e74[_0x534935];return _0x328b90;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index f280878..615133e 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 _0x684c=['exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','isAgentAvailable','agents','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var uuid=require(_0xc684('0x1'));var util=require('./util');var logger=require(_0xc684('0x2'))(_0xc684('0x3'));var Agent=function(_0x313548,_0x1a0d37,_0x2c50cf,_0x4a3536){this[_0xc684('0x4')]=uuid['v4']();this[_0xc684('0x5')]=_0x313548;this[_0xc684('0x6')]=_0x1a0d37;this[_0xc684('0x7')]=_0x2c50cf;this[_0xc684('0x3')]=_0x4a3536;this[_0xc684('0x5')][_0xc684('0x8')](this[_0xc684('0x9')][_0xc684('0xa')](this),this[_0xc684('0xb')][_0xc684('0xa')](this));this[_0xc684('0x5')]['on'](_0xc684('0xc'),this[_0xc684('0xb')][_0xc684('0xa')](this));this[_0xc684('0x5')]['on'](_0xc684('0xd'),this['handleDrained'][_0xc684('0xa')](this));};Agent[_0xc684('0xe')][_0xc684('0x8')]=function(){this[_0xc684('0x5')][_0xc684('0x8')](this[_0xc684('0x9')]['bind'](this),this[_0xc684('0xb')][_0xc684('0xa')](this));};Agent['prototype']['handleDrained']=function(){this[_0xc684('0xb')](!![]);};Agent[_0xc684('0xe')][_0xc684('0x9')]=function(_0x2ad4f1){logger[_0xc684('0xf')](_0xc684('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xc684('0x11')](this['realtime']['agents'][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc684('0x5')]['id'],this[_0xc684('0x6')]['id']);setTimeout(this[_0xc684('0x8')][_0xc684('0xa')](this),0x3e8);}else{if(this[_0xc684('0x3')]['forcedOwnership']||util[_0xc684('0x12')](this[_0xc684('0x5')]['id'],this['realtime'][_0xc684('0x13')][this[_0xc684('0x6')]['id']],this[_0xc684('0x5')]['channel'],![])){this[_0xc684('0x7')][_0xc684('0x13')][this[_0xc684('0x6')]['id']][_0xc684('0x14')]=!![];this[_0xc684('0x7')]['agents'][this[_0xc684('0x6')]['id']][_0xc684('0x15')]=undefined;util[_0xc684('0x16')](this['notificationId'],this['squeue']['id'],this['realtime'][_0xc684('0x13')][this[_0xc684('0x6')]['id']],null,this[_0xc684('0x3')]);util['writeLog'](this['squeue']['id'],this['realtime']['agents'][this[_0xc684('0x6')]['id']],_0xc684('0x17')+(this[_0xc684('0x3')]['forcedOwnership']?_0xc684('0x18'):''));}else{logger['info'](_0xc684('0x19'),this[_0xc684('0x5')]['id'],this[_0xc684('0x6')]['id']);setTimeout(this['push'][_0xc684('0xa')](this),0x3e8);}}};Agent['prototype'][_0xc684('0xb')]=function(_0x640ca1){if(_[_0xc684('0x11')](this[_0xc684('0x7')]['agents'][this[_0xc684('0x6')]['id']])){return logger[_0xc684('0xf')](_0xc684('0x1a'),this[_0xc684('0x5')]['id'],this[_0xc684('0x6')]['id']);}else{logger[_0xc684('0xf')](_0xc684('0x1b'),this[_0xc684('0x5')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0xc684('0x5')]['id'],this[_0xc684('0x7')]['agents'][this['agent']['id']],null,this[_0xc684('0x3')]);this['realtime'][_0xc684('0x13')][this[_0xc684('0x6')]['id']][_0xc684('0x14')]=![];this['realtime']['agents'][this[_0xc684('0x6')]['id']][_0xc684('0x15')]=undefined;util['writeLog'](this['squeue']['id'],this[_0xc684('0x7')][_0xc684('0x13')][this[_0xc684('0x6')]['id']],_0x640ca1?_0xc684('0x1c'):_0xc684('0x1d'));}if(!_0x640ca1){setTimeout(this[_0xc684('0x8')]['bind'](this),0x3e8);}};function agent(_0x1a0b08,_0x4c2938,_0x5b25ec,_0x289116){return new Agent(_0x1a0b08,_0x4c2938,_0x5b25ec,_0x289116);}module[_0xc684('0x1e')]=agent; \ No newline at end of file +var _0xc757=['notificationId','squeue','agent','realtime','push','bind','timeout','handleTimeout','handleDrained','prototype','handleRun','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','busyQueue','showNotification',':FORCED','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0xb7592c,_0x90a099){var _0x4d88ee=function(_0x16b5fc){while(--_0x16b5fc){_0xb7592c['push'](_0xb7592c['shift']());}};_0x4d88ee(++_0x90a099);}(_0xc757,0xe3));var _0x7c75=function(_0x4950d7,_0x468f85){_0x4950d7=_0x4950d7-0x0;var _0x9f677b=_0xc757[_0x4950d7];return _0x9f677b;};'use strict';var _=require(_0x7c75('0x0'));var uuid=require(_0x7c75('0x1'));var util=require(_0x7c75('0x2'));var logger=require(_0x7c75('0x3'))(_0x7c75('0x4'));var Agent=function(_0x51c0dc,_0x1e47e6,_0x4f7a3b,_0x4d373a){this[_0x7c75('0x5')]=uuid['v4']();this[_0x7c75('0x6')]=_0x51c0dc;this[_0x7c75('0x7')]=_0x1e47e6;this[_0x7c75('0x8')]=_0x4f7a3b;this[_0x7c75('0x4')]=_0x4d373a;this[_0x7c75('0x6')][_0x7c75('0x9')](this['handleRun'][_0x7c75('0xa')](this),this['handleTimeout'][_0x7c75('0xa')](this));this[_0x7c75('0x6')]['on'](_0x7c75('0xb'),this[_0x7c75('0xc')][_0x7c75('0xa')](this));this[_0x7c75('0x6')]['on']('drained',this[_0x7c75('0xd')][_0x7c75('0xa')](this));};Agent['prototype']['push']=function(){this[_0x7c75('0x6')][_0x7c75('0x9')](this['handleRun'][_0x7c75('0xa')](this),this[_0x7c75('0xc')]['bind'](this));};Agent[_0x7c75('0xe')][_0x7c75('0xd')]=function(){this[_0x7c75('0xc')](!![]);};Agent['prototype'][_0x7c75('0xf')]=function(_0x439130){logger[_0x7c75('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x7c75('0x6')]['id'],this['agent']['id']);if(_[_0x7c75('0x11')](this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']])){logger[_0x7c75('0x10')](_0x7c75('0x13'),this[_0x7c75('0x6')]['id'],this[_0x7c75('0x7')]['id']);setTimeout(this[_0x7c75('0x9')]['bind'](this),0x3e8);}else{if(this[_0x7c75('0x4')][_0x7c75('0x14')]||util['isAgentAvailable'](this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this['agent']['id']],this['squeue']['channel'],![])){this[_0x7c75('0x8')]['agents'][this[_0x7c75('0x7')]['id']][_0x7c75('0x15')]=!![];this['realtime']['agents'][this['agent']['id']][_0x7c75('0x16')]=undefined;util[_0x7c75('0x17')](this[_0x7c75('0x5')],this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this['agent']['id']],null,this[_0x7c75('0x4')]);util['writeLog'](this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']],'RINGING'+(this[_0x7c75('0x4')][_0x7c75('0x14')]?_0x7c75('0x18'):''));}else{logger[_0x7c75('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x7c75('0x6')]['id'],this[_0x7c75('0x7')]['id']);setTimeout(this[_0x7c75('0x9')][_0x7c75('0xa')](this),0x3e8);}}};Agent['prototype'][_0x7c75('0xc')]=function(_0x5d6ee5){if(_['isNil'](this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']])){return logger['info'](_0x7c75('0x13'),this['squeue']['id'],this[_0x7c75('0x7')]['id']);}else{logger[_0x7c75('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x7c75('0x6')]['id'],this[_0x7c75('0x7')]['id']);util['hideNotification'](this[_0x7c75('0x5')],this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']],null,this[_0x7c75('0x4')]);this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']][_0x7c75('0x15')]=![];this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']][_0x7c75('0x16')]=undefined;util[_0x7c75('0x19')](this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this['agent']['id']],_0x5d6ee5?_0x7c75('0x1a'):_0x7c75('0x1b'));}if(!_0x5d6ee5){setTimeout(this[_0x7c75('0x9')][_0x7c75('0xa')](this),0x3e8);}};function agent(_0xc39653,_0x591648,_0x455df2,_0x490729){return new Agent(_0xc39653,_0x591648,_0x455df2,_0x490729);}module[_0x7c75('0x1c')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 54730bb..ad6ca28 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 _0x350e=['prototype','isNil','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','realtime','agents','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','lodash','uuid','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0x554774,_0x5ec6c2){var _0x3ac53a=function(_0x30f8e4){while(--_0x30f8e4){_0x554774['push'](_0x554774['shift']());}};_0x3ac53a(++_0x5ec6c2);}(_0x350e,0xad));var _0xe350=function(_0x361faf,_0x52cb9c){_0x361faf=_0x361faf-0x0;var _0xc00f8e=_0x350e[_0x361faf];return _0xc00f8e;};'use strict';var _=require(_0xe350('0x0'));var uuid=require(_0xe350('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xe350('0x2'));var Beepall=function(_0x4abe81,_0x2775f9,_0x43db0c,_0x5a0592){this[_0xe350('0x3')]=uuid['v4']();this[_0xe350('0x4')]=_0x4abe81;this[_0xe350('0x5')]=_0x2775f9;this['realtime']=_0x43db0c;this[_0xe350('0x2')]=_0x5a0592;this[_0xe350('0x4')][_0xe350('0x6')](this[_0xe350('0x7')][_0xe350('0x8')](this),this[_0xe350('0x9')]['bind'](this));this[_0xe350('0x4')]['on'](_0xe350('0xa'),this['handleTimeout'][_0xe350('0x8')](this));this[_0xe350('0x4')]['on'](_0xe350('0xb'),this[_0xe350('0xc')][_0xe350('0x8')](this));};Beepall[_0xe350('0xd')][_0xe350('0x6')]=function(){this[_0xe350('0x4')]['push'](this[_0xe350('0x7')][_0xe350('0x8')](this),this[_0xe350('0x9')][_0xe350('0x8')](this));};Beepall[_0xe350('0xd')]['handleDrained']=function(_0x1bb004){this['handleTimeout'](!![]);};Beepall['prototype']['handleRun']=function(_0x51a641){var _0x3dab5e=!![];if(!_[_0xe350('0xe')](this['queue'])&&!_[_0xe350('0xe')](this[_0xe350('0x5')]['Agents'])&&this['queue'][_0xe350('0xf')][_0xe350('0x10')]>0x0){for(var _0x2fb146=0x0,_0x48cb60;_0x2fb1460x0){for(var _0x76075e=0x0,_0xddc732;_0x76075e0x0&&_0x5733dc[_0x505d26+_0x5608('0x25')]>=_0x5733dc[_0x505d26+_0x5608('0x24')]){writeLog(_0x23f802,_0x5733dc,_0x505d26[_0x5608('0x26')]()+_0x5608('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x1953ef,_0x5bbe37,_0x171b39,_0x516683,_0x5961c4){return sendNotification(!![],_0x1953ef,_0x5bbe37,_0x171b39,_0x516683,_0x5961c4);};exports['hideNotification']=function(_0x269970,_0x1b34f7,_0x354e9f,_0x540bb6,_0x4e2f17){return sendNotification(![],_0x269970,_0x1b34f7,_0x354e9f,_0x540bb6,_0x4e2f17);};exports[_0x5608('0x28')]=writeLog; \ No newline at end of file +var _0xc4e6=['defaults','socket.io-emitter','emit','format','user:%s','name','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','notification:%s','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','redis'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0xc4e6[_0x1c208e];return _0x5104ff;};'use strict';var _=require(_0x6c4e('0x0'));var util=require(_0x6c4e('0x1'));var utils=require('../utils');var Mustache=require(_0x6c4e('0x2'));var Redis=require(_0x6c4e('0x3'));var config=require(_0x6c4e('0x4'));var logger=require(_0x6c4e('0x5'))('routing');config[_0x6c4e('0x6')]=_[_0x6c4e('0x7')](config[_0x6c4e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6c4e('0x8'))(new Redis(config['redis']));function emit(_0x56fec4,_0x3355f9,_0x394d8b){io['to'](_0x56fec4)[_0x6c4e('0x9')](_0x3355f9,_0x394d8b);}function sendNotification(_0x2f91ad,_0x3929d8,_0x25db1e,_0x58c1da,_0x2231a7,_0x190138){io['to'](util[_0x6c4e('0xa')](_0x6c4e('0xb'),_0x58c1da[_0x6c4e('0xc')]))['emit']('user:save',_0x58c1da);var _0x36e93f=_0x190138||{};var _0x2e205b=_0x25db1e[_0x6c4e('0xd')]('.');var _0x4e7b76={'uniqueid':_0x3929d8,'channel':_0x2e205b[0x0],'id':_0x2e205b[0x1],'title':_0x2e205b[0x0]+_0x6c4e('0xe'),'interactionId':_0x2e205b[0x2],'queue':_0x2231a7?_0x2231a7[_0x6c4e('0xc')]:null,'sound':_0x36e93f[_0x6c4e('0xf')][_0x6c4e('0x10')],'shake':_0x36e93f['account'][_0x6c4e('0x11')]};try{if(!_0x36e93f[_0x6c4e('0x12')]){_0x36e93f[_0x6c4e('0x12')]={};}if(_0x2231a7){_0x36e93f[_0x6c4e('0x12')][_0x6c4e('0x13')]=_0x2231a7;}else if(_0x36e93f['body'][_0x6c4e('0x13')]){delete _0x36e93f[_0x6c4e('0x12')][_0x6c4e('0x13')];}_0x4e7b76['msg']=utils['getMustacheRender'](_0x36e93f['account']['notificationTemplate'],_0x36e93f);}catch(_0xb0b06c){_0x4e7b76[_0x6c4e('0x14')]=_0x6c4e('0x15');logger['error'](util[_0x6c4e('0xa')](_0x6c4e('0x16'),_0x3929d8,_0xb0b06c['message']));}io['to'](util[_0x6c4e('0xa')]('user:%s',_0x58c1da[_0x6c4e('0xc')]))[_0x6c4e('0x9')](util[_0x6c4e('0xa')](_0x6c4e('0x17'),_0x2f91ad?'save':_0x6c4e('0x18')),_0x4e7b76);}function writeLog(_0x6b6a2,_0x541447,_0x112317){return logger[_0x6c4e('0x19')](util[_0x6c4e('0xa')](_0x6c4e('0x1a'),_0x6b6a2,_0x541447[_0x6c4e('0xc')],_0x112317));}exports['isAgentAvailable']=function(_0x266f7d,_0xd6bdad,_0x5c45f2,_0x5c2898){if(_0xd6bdad[_0x6c4e('0x1b')]){writeLog(_0x266f7d,_0xd6bdad,_0x6c4e('0x1c'));return![];}if(!_0xd6bdad[_0x6c4e('0x1d')]){writeLog(_0x266f7d,_0xd6bdad,_0x6c4e('0x1e'));return![];}if(_0xd6bdad[_0x5c45f2+_0x6c4e('0x1f')]){writeLog(_0x266f7d,_0xd6bdad,_0x6c4e('0x20'));return![];}if(_0x5c2898&&_0xd6bdad[_0x6c4e('0x21')](_0x5c45f2+'Capacity')&&_0xd6bdad[_0x6c4e('0x21')](_0x5c45f2+_0x6c4e('0x22'))){if(_0xd6bdad[_0x5c45f2+_0x6c4e('0x23')]>0x0&&_0xd6bdad[_0x5c45f2+_0x6c4e('0x22')]>=_0xd6bdad[_0x5c45f2+'Capacity']){writeLog(_0x266f7d,_0xd6bdad,_0x5c45f2[_0x6c4e('0x24')]()+_0x6c4e('0x25'));return![];}}return!![];};exports[_0x6c4e('0x26')]=function(_0x117f1a,_0x38d216,_0x14ccfc,_0x3681ee,_0x52c934){return sendNotification(!![],_0x117f1a,_0x38d216,_0x14ccfc,_0x3681ee,_0x52c934);};exports[_0x6c4e('0x27')]=function(_0x2f6f01,_0x5bd002,_0x169830,_0x3b738d,_0x5829c1){return sendNotification(![],_0x2f6f01,_0x5bd002,_0x169830,_0x3b738d,_0x5829c1);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 6909cd4..549cc3c 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 _0x9152=['exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x9152,0x19a));var _0x2915=function(_0x27b75b,_0x4f858c){_0x27b75b=_0x27b75b-0x0;var _0x4cfe27=_0x9152[_0x27b75b];return _0x4cfe27;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x2915('0x0'));var utils=require(_0x2915('0x1'));var logger=require(_0x2915('0x2'))(_0x2915('0x3'));var system=schema({'command':{'type':_0x2915('0x4'),'required':!![],'message':_0x2915('0x5')}});exports[_0x2915('0x6')]=function(_0x532a50,_0x37c925){return function(_0x32402f){try{var _0x3750e0={'command':_0x37c925[0x0]};var _0x160093=system['validate'](_0x3750e0,{'typecast':!![]});if(_0x160093[_0x2915('0x7')]){logger[_0x2915('0x8')](_0x2915('0x9'),_0x532a50,_[_0x2915('0xa')](_0x160093,_0x2915('0xb'))['join'](',\x20'));logger[_0x2915('0xc')](_0x2915('0xd'),_0x532a50);_0x32402f['next']();}else{var _0x329151=this;var _0x2e8f34=utils[_0x2915('0xe')](_0x37c925[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x532a50,_0x2e8f34);sh[_0x2915('0xf')](_[_0x2915('0x10')](_0x2e8f34),function(_0x53b7fb,_0x341bb9){logger[_0x2915('0xc')](_0x2915('0x11'),_0x532a50,_0x53b7fb);if(_0x53b7fb==0x0){var _0x86afe5=_0x341bb9[_0x2915('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x2915('0x13')](_0x37c925[0x1])||_[_0x2915('0x14')](_0x37c925[0x1])){logger[_0x2915('0xc')](_0x2915('0x15'),_0x532a50);_0x329151[_0x2915('0x16')][_0x37c925[0x1]]=_0x86afe5;}else{logger[_0x2915('0xc')](_0x2915('0x17'),_0x532a50,_0x37c925[0x1],_0x86afe5);_0x329151['body'][_0x37c925[0x1]]=_0x86afe5;}}_0x32402f[_0x2915('0x18')]();});}}catch(_0x42762a){logger[_0x2915('0x8')](_0x2915('0x9'),_0x532a50,_['isObject'](_0x42762a)?JSON['stringify'](_0x42762a):_0x42762a);logger[_0x2915('0xc')](_0x2915('0xd'),_0x532a50);_0x32402f[_0x2915('0x18')]();}};}; \ No newline at end of file +var _0xb359=['lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','map','message','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs'];(function(_0x26cead,_0x173476){var _0x466c3a=function(_0x2cd04e){while(--_0x2cd04e){_0x26cead['push'](_0x26cead['shift']());}};_0x466c3a(++_0x173476);}(_0xb359,0x143));var _0x9b35=function(_0x5e37f6,_0x508bde){_0x5e37f6=_0x5e37f6-0x0;var _0x1a5c73=_0xb359[_0x5e37f6];return _0x1a5c73;};'use strict';var schema=require('validate');var sh=require(_0x9b35('0x0'));var _=require(_0x9b35('0x1'));var utils=require(_0x9b35('0x2'));var logger=require(_0x9b35('0x3'))(_0x9b35('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x9b35('0x5')}});exports[_0x9b35('0x6')]=function(_0x4bce20,_0x421834){return function(_0x3e3a04){try{var _0xb4637e={'command':_0x421834[0x0]};var _0x37ed91=system[_0x9b35('0x7')](_0xb4637e,{'typecast':!![]});if(_0x37ed91[_0x9b35('0x8')]){logger['error'](_0x9b35('0x9'),_0x4bce20,_[_0x9b35('0xa')](_0x37ed91,_0x9b35('0xb'))['join'](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4bce20);_0x3e3a04[_0x9b35('0xc')]();}else{var _0x50fd84=this;var _0x1aaa56=utils[_0x9b35('0xd')](_0x421834[0x0],this);logger[_0x9b35('0xe')](_0x9b35('0xf'),_0x4bce20,_0x1aaa56);sh[_0x9b35('0x10')](_[_0x9b35('0x11')](_0x1aaa56),function(_0xe5680e,_0x31c815){logger[_0x9b35('0xe')](_0x9b35('0x12'),_0x4bce20,_0xe5680e);if(_0xe5680e==0x0){var _0x421c37=_0x31c815[_0x9b35('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x421834[0x1])||_[_0x9b35('0x14')](_0x421834[0x1])){logger[_0x9b35('0xe')](_0x9b35('0x15'),_0x4bce20);_0x50fd84[_0x9b35('0x16')][_0x421834[0x1]]=_0x421c37;}else{logger[_0x9b35('0xe')](_0x9b35('0x17'),_0x4bce20,_0x421834[0x1],_0x421c37);_0x50fd84[_0x9b35('0x16')][_0x421834[0x1]]=_0x421c37;}}_0x3e3a04[_0x9b35('0xc')]();});}}catch(_0x14eb68){logger[_0x9b35('0x18')](_0x9b35('0x9'),_0x4bce20,_['isObject'](_0x14eb68)?JSON[_0x9b35('0x19')](_0x14eb68):_0x14eb68);logger[_0x9b35('0xe')](_0x9b35('0x1a'),_0x4bce20);_0x3e3a04['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 4c4fc5a..c324d5f 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 _0xf3b2=['finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','validate','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify'];(function(_0x21eb04,_0x44cb7f){var _0x11b38a=function(_0x276fc6){while(--_0x276fc6){_0x21eb04['push'](_0x21eb04['shift']());}};_0x11b38a(++_0x44cb7f);}(_0xf3b2,0x110));var _0x2f3b=function(_0x3b8774,_0x301a46){_0x3b8774=_0x3b8774-0x0;var _0x5bcfcc=_0xf3b2[_0x3b8774];return _0x5bcfcc;};'use strict';var schema=require('validate');var _=require(_0x2f3b('0x0'));var rpc={'chatInteraction':require(_0x2f3b('0x1')),'openchannelInteraction':require(_0x2f3b('0x2')),'smsInteraction':require(_0x2f3b('0x3')),'mailInteraction':require(_0x2f3b('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x2f3b('0x5'))(_0x2f3b('0x6'));var tag=schema({'tag':{'type':_0x2f3b('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x33bd20,_0x504fb6,_0x27533d,_0x423326){return function(_0x5570d9){try{var _0x113358={'tag':_0x504fb6[0x0]};var _0x42d179=tag[_0x2f3b('0x8')](_0x113358,{'typecast':!![]});if(_0x42d179[_0x2f3b('0x9')]){logger[_0x2f3b('0xa')]('[%s][TAG]\x20%s',_0x33bd20,_[_0x2f3b('0xb')](_0x42d179,_0x2f3b('0xc'))[_0x2f3b('0xd')](',\x20'));logger[_0x2f3b('0xe')](_0x2f3b('0xf'),_0x33bd20);_0x5570d9[_0x2f3b('0x10')]();}else{var _0x46832c={'ids':[_0x504fb6[0x0]]};if(rpc[_0x423326[_0x2f3b('0x11')]+_0x2f3b('0x12')]){rpc[_0x423326['channel']+_0x2f3b('0x12')][_0x2f3b('0x13')](_0x423326['interaction']['id'],_0x46832c)['then'](function(_0x14c79c){logger[_0x2f3b('0xe')](_0x2f3b('0x14'),_0x33bd20,_0x504fb6[0x1],_0x423326[_0x2f3b('0x11')],_0x423326[_0x2f3b('0x15')]['id']);})[_0x2f3b('0x16')](function(_0xf1867c){logger[_0x2f3b('0xa')](_0x2f3b('0x17'),_0x33bd20,JSON[_0x2f3b('0x18')](_0xf1867c));logger[_0x2f3b('0xe')](_0x2f3b('0xf'),_0x33bd20);})[_0x2f3b('0x19')](function(){_0x5570d9['next']();});}}}catch(_0xf55008){logger[_0x2f3b('0xa')](_0x2f3b('0x17'),_0x33bd20,_[_0x2f3b('0x1a')](_0xf55008)?JSON['stringify'](_0xf55008):_0xf55008);logger['info'](_0x2f3b('0xf'),_0x33bd20);_0x5570d9[_0x2f3b('0x10')]();}};}; \ No newline at end of file +var _0xdedf=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','catch','stringify','finally','next','isObject','validate','lodash'];(function(_0x5c2713,_0x4191a9){var _0x48c267=function(_0xa8b78){while(--_0xa8b78){_0x5c2713['push'](_0x5c2713['shift']());}};_0x48c267(++_0x4191a9);}(_0xdedf,0x178));var _0xfded=function(_0x424adc,_0x214087){_0x424adc=_0x424adc-0x0;var _0x257932=_0xdedf[_0x424adc];return _0x257932;};'use strict';var schema=require(_0xfded('0x0'));var _=require(_0xfded('0x1'));var rpc={'chatInteraction':require(_0xfded('0x2')),'openchannelInteraction':require(_0xfded('0x3')),'smsInteraction':require(_0xfded('0x4')),'mailInteraction':require(_0xfded('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xfded('0x6'))};var logger=require(_0xfded('0x7'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0xfded('0x8')}});exports[_0xfded('0x9')]=function(_0x2a7c72,_0x529dfd,_0x6abebb,_0x1aa336){return function(_0x233955){try{var _0x1e572b={'tag':_0x529dfd[0x0]};var _0x19c17f=tag[_0xfded('0x0')](_0x1e572b,{'typecast':!![]});if(_0x19c17f[_0xfded('0xa')]){logger[_0xfded('0xb')](_0xfded('0xc'),_0x2a7c72,_['map'](_0x19c17f,_0xfded('0xd'))[_0xfded('0xe')](',\x20'));logger[_0xfded('0xf')](_0xfded('0x10'),_0x2a7c72);_0x233955['next']();}else{var _0x236aed={'ids':[_0x529dfd[0x0]]};if(rpc[_0x1aa336[_0xfded('0x11')]+_0xfded('0x12')]){rpc[_0x1aa336[_0xfded('0x11')]+_0xfded('0x12')][_0xfded('0x13')](_0x1aa336[_0xfded('0x14')]['id'],_0x236aed)[_0xfded('0x15')](function(_0x3ebf84){logger[_0xfded('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2a7c72,_0x529dfd[0x1],_0x1aa336[_0xfded('0x11')],_0x1aa336[_0xfded('0x14')]['id']);})[_0xfded('0x16')](function(_0x3c6eae){logger[_0xfded('0xb')](_0xfded('0xc'),_0x2a7c72,JSON[_0xfded('0x17')](_0x3c6eae));logger[_0xfded('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2a7c72);})[_0xfded('0x18')](function(){_0x233955[_0xfded('0x19')]();});}}}catch(_0x717121){logger[_0xfded('0xb')]('[%s][TAG]\x20%s',_0x2a7c72,_[_0xfded('0x1a')](_0x717121)?JSON['stringify'](_0x717121):_0x717121);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2a7c72);_0x233955[_0xfded('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 1fa3818..a5d539b 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 _0x579c=['interaction','list','mustache','lodash','exports','merge','contact','message','account'];(function(_0x40aeb4,_0x2047e0){var _0x2e29f5=function(_0x451e4b){while(--_0x451e4b){_0x40aeb4['push'](_0x40aeb4['shift']());}};_0x2e29f5(++_0x2047e0);}(_0x579c,0xda));var _0xc579=function(_0x5bf295,_0x16f26b){_0x5bf295=_0x5bf295-0x0;var _0x355f9a=_0x579c[_0x5bf295];return _0x355f9a;};'use strict';var Mustache=require(_0xc579('0x0'));var _=require(_0xc579('0x1'));module[_0xc579('0x2')]={'getMustacheRender':function(_0x1db849,_0x397136){return Mustache['render'](_0x1db849,_[_0xc579('0x3')](_0x397136['body'],{'contact':_0x397136[_0xc579('0x4')],'message':_0x397136[_0xc579('0x5')],'account':_0x397136[_0xc579('0x6')],'interaction':_0x397136[_0xc579('0x7')],'list':_0x397136[_0xc579('0x8')]}))||'';}}; \ No newline at end of file +var _0xa1fd=['list','mustache','lodash','exports','render','merge','body','contact','message','interaction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x17cb36,_0x3cfc3e){_0x17cb36=_0x17cb36-0x0;var _0x3ae236=_0xa1fd[_0x17cb36];return _0x3ae236;};'use strict';var Mustache=require(_0xda1f('0x0'));var _=require(_0xda1f('0x1'));module[_0xda1f('0x2')]={'getMustacheRender':function(_0x3feff6,_0x595195){return Mustache[_0xda1f('0x3')](_0x3feff6,_[_0xda1f('0x4')](_0x595195[_0xda1f('0x5')],{'contact':_0x595195[_0xda1f('0x6')],'message':_0x595195[_0xda1f('0x7')],'account':_0x595195['account'],'interaction':_0x595195[_0xda1f('0x8')],'list':_0x595195[_0xda1f('0x9')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 301ae19..2a58d37 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 _0x7380=['priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','interaction','end','QueueReport','update','UserId','catch','stack','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','applications','isArray','length','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','%s:%s:%s','./interval','intervals','consequence'];(function(_0x38c4ce,_0x611d14){var _0x4bda76=function(_0x4fc211){while(--_0x4fc211){_0x38c4ce['push'](_0x38c4ce['shift']());}};_0x4bda76(++_0x611d14);}(_0x7380,0x14f));var _0x0738=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x7380[_0x1ed116];return _0x574066;};'use strict';var _=require(_0x0738('0x0'));var util=require(_0x0738('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x0738('0x2'));var BPromise=require(_0x0738('0x3'));var uuid=require('uuid');var config=require(_0x0738('0x4'));var logger=require(_0x0738('0x5'))(_0x0738('0x6'));var rpc={'openchannelQueueReport':require(_0x0738('0x7')),'mailQueueReport':require(_0x0738('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x0738('0x9')),'faxQueueReport':require(_0x0738('0xa')),'whatsappQueueReport':require(_0x0738('0xb'))};var RuleEngine=require(_0x0738('0xc'));function getId(_0x310524,_0x41798a,_0x2f55f5){return util[_0x0738('0xd')](_0x0738('0xe'),_0x310524,_0x41798a||0x0,_0x2f55f5||0x0);}function getIntervals(_0x58cb3b,_0x430c67){var _0xbef535=[];if(!_[_0x0738('0xf')](_0x430c67[_0x0738('0x10')])&&!_[_0x0738('0xf')](_0x58cb3b[_0x430c67[_0x0738('0x10')]])&&!_['isNil'](_0x58cb3b[_0x430c67[_0x0738('0x10')]]['Intervals'])){_0xbef535=_[_0x0738('0x11')](_0x58cb3b[_0x430c67[_0x0738('0x10')]][_0x0738('0x12')],_0x0738('0x13'));}else if(!_[_0x0738('0xf')](_0x430c67[_0x0738('0x13')])){_0xbef535=[_0x430c67[_0x0738('0x13')]];}return _0xbef535;}exports['listen']=function(_0x369a4d){_0x369a4d[_0x0738('0x14')]={};return new BPromise(function(_0x41fb54,_0x91ceed){var _0x3eb43c={'Start':function(_0x5d4017){var _0x35a5da=this;return new Promise(function(_0x1d0b78,_0x3f5386){if(_0x5d4017){try{var _0x1c8b0f=[];var _0x48a3ff=getId(_0x5d4017[_0x0738('0x15')],_0x5d4017[_0x0738('0x16')]?_0x5d4017[_0x0738('0x16')]['id']:0x0,_0x5d4017['interaction']?_0x5d4017['interaction']['id']:0x0);if(_0x5d4017[_0x0738('0x17')]&&_[_0x0738('0x18')](_0x5d4017[_0x0738('0x17')])&&_0x5d4017['applications'][_0x0738('0x19')]){for(var _0x468d63=0x0;_0x468d63<_0x5d4017[_0x0738('0x17')][_0x0738('0x19')];_0x468d63+=0x1){var _0x1c7faa=_0x5d4017[_0x0738('0x17')][_0x468d63];if(fs['existsSync'](path[_0x0738('0x1a')](__dirname,'applications',_0x1c7faa[_0x0738('0x1b')]+'.js'))){var _0x3be2fd=[];switch(_0x1c7faa[_0x0738('0x1b')][_0x0738('0x1c')]()){case _0x0738('0x1d'):var _0x103c25=_0x1c7faa[_0x0738('0x1e')][_0x0738('0x1f')](',');_0x3be2fd[_0x0738('0x20')](_0x103c25[0x0]);_0x3be2fd[_0x0738('0x20')](_0x103c25[_0x0738('0x21')](0x1,_0x103c25['length'])['join'](','));break;case _0x0738('0x22'):var _0x3ee3f5=_0x1c7faa[_0x0738('0x1e')][_0x0738('0x1f')](',');_0x3be2fd[_0x0738('0x20')](_0x3ee3f5[0x0]);_0x3be2fd[_0x0738('0x20')](_0x3ee3f5[0x1]);_0x3be2fd['push'](_0x3ee3f5['slice'](0x2,_0x3ee3f5['length'])['join'](','));break;case _0x0738('0x23'):var _0x30a83a=_0x1c7faa['appdata'][_0x0738('0x1f')](',');_0x3be2fd[_0x0738('0x20')](_0x30a83a[0x0]);_0x3be2fd[_0x0738('0x20')](_0x30a83a[0x1]);_0x3be2fd[_0x0738('0x20')](_0x30a83a[0x2]);_0x3be2fd[_0x0738('0x20')](_0x30a83a[0x3]);_0x3be2fd[_0x0738('0x20')](_0x30a83a['slice'](0x4,_0x30a83a[_0x0738('0x19')])[_0x0738('0x1a')](','));break;case _0x0738('0x16'):_0x3be2fd[_0x0738('0x20')](_0x1c7faa[_0x0738('0x1e')]);break;case _0x0738('0x24'):_0x3be2fd[_0x0738('0x20')](_0x1c7faa['TagId']);_0x3be2fd[_0x0738('0x20')](_0x1c7faa[_0x0738('0x1e')]);break;default:_0x3be2fd=_[_0x0738('0xf')](_0x1c7faa['appdata'])?[]:_0x1c7faa['appdata'][_0x0738('0x1f')](',');}var _0x3bf6d9={'id':util[_0x0738('0xd')](_0x0738('0x25'),_0x48a3ff,_0x1c7faa['id'],_0x1c7faa[_0x0738('0x1b')]),'condition':require(_0x0738('0x26'))['condition'](_0x48a3ff,getIntervals(_0x369a4d[_0x0738('0x27')],_0x1c7faa),_0x369a4d),'consequence':require('./applications/'+_0x1c7faa[_0x0738('0x1b')])[_0x0738('0x28')](_0x48a3ff,_0x3be2fd,_0x369a4d,_0x5d4017),'p':_0x1c7faa[_0x0738('0x29')]||0x0};logger[_0x0738('0x2a')](_0x0738('0x2b'),_0x3bf6d9['id'],_0x0738('0x2c'),getIntervals(_0x369a4d['intervals'],_0x1c7faa)[_0x0738('0x1a')](_0x0738('0x2d')));_0x1c8b0f[_0x0738('0x20')](_0x3bf6d9);}else{logger['error'](_0x0738('0x2e'),path[_0x0738('0x1a')](__dirname,_0x0738('0x17'),_0x1c7faa['app']+_0x0738('0x2f')));}}_0x369a4d[_0x0738('0x14')][_0x48a3ff]=new RuleEngine(_0x1c8b0f);_0x369a4d[_0x0738('0x14')][_0x48a3ff]['execute'](_0x5d4017,function(_0x2b2a0a){logger[_0x0738('0x2a')](_0x0738('0x30'),JSON[_0x0738('0x31')](_0x2b2a0a[_0x0738('0x32')]));if(_0x369a4d[_0x0738('0x14')][_0x48a3ff]){_0x369a4d[_0x0738('0x14')][_0x48a3ff][_0x0738('0x33')](_0x0738('0x34'));}});return _0x1d0b78({'code':0xc8,'message':_0x5d4017});}else{logger[_0x0738('0x2a')](_0x0738('0x35'));return _0x1d0b78({'code':0xc8,'message':_0x5d4017});}}catch(_0x46736c){logger[_0x0738('0x36')](_0x46736c['stack']);return _0x3f5386(_0x35a5da[_0x0738('0x36')](0x1f4,_0x46736c));}}return _0x3f5386(_0x0738('0x37'));});},'AcceptMessage':function(_0x1bf096){var _0xcaed2b=this;return new Promise(function(_0x4939a9,_0x4d3dc4){if(_0x1bf096['message']&&_0x1bf096['message']['id']){try{var _0x820aa0=getId(_0x1bf096[_0x0738('0x15')],_0x1bf096[_0x0738('0x16')]?_0x1bf096[_0x0738('0x16')]['id']:0x0,_0x1bf096[_0x0738('0x38')]?_0x1bf096['interaction']['id']:0x0);if(_0x369a4d[_0x0738('0x14')][_0x820aa0]){_0x369a4d[_0x0738('0x14')][_0x820aa0][_0x0738('0x33')](_0x0738('0x39'));if(rpc[_0x1bf096[_0x0738('0x15')]+_0x0738('0x3a')]){rpc[_0x1bf096['channel']+_0x0738('0x3a')][_0x0738('0x3b')](_0x820aa0,{'UserId':_0x1bf096[_0x0738('0x16')][_0x0738('0x3c')]})[_0x0738('0x3d')](function(_0x65b263){logger[_0x0738('0x36')]('error\x20update\x20queue\x20report');});}}return _0x4939a9({'code':0xc8,'message':_0x1bf096});}catch(_0x4e07ab){logger[_0x0738('0x36')](_0x4e07ab[_0x0738('0x3e')]);return _0x4d3dc4(_0xcaed2b[_0x0738('0x36')](0x1f4,_0x4e07ab));}}logger[_0x0738('0x36')](_0x0738('0x3f'));return _0x4d3dc4(_0xcaed2b[_0x0738('0x36')](0x1f4,_0x0738('0x3f')));});},'RejectMessage':function(_0x4eb60c){var _0x26c044=this;return new Promise(function(_0x190bf5,_0x1d324d){if(_0x4eb60c[_0x0738('0x40')]&&_0x4eb60c[_0x0738('0x40')]['id']){try{if(_0x369a4d[_0x0738('0x41')][_0x4eb60c[_0x0738('0x40')]['id']]){_0x369a4d[_0x0738('0x41')][_0x4eb60c[_0x0738('0x40')]['id']]['busy']=![];_0x369a4d[_0x0738('0x41')][_0x4eb60c[_0x0738('0x40')]['id']][_0x0738('0x42')]=undefined;}return _0x190bf5({'code':0xc8,'message':_0x4eb60c});}catch(_0x4b09d4){logger[_0x0738('0x36')](_0x4b09d4[_0x0738('0x3e')]);return _0x1d324d(_0x26c044[_0x0738('0x36')](0x1f4,_0x4b09d4));}}logger['error'](_0x0738('0x3f'));return _0x1d324d(_0x26c044['error'](0x1f4,_0x0738('0x3f')));});},'AbandonInteraction':function(_0x383b2c){var _0xb6faa4=this;return new Promise(function(_0x5913bf,_0x9d1946){if(_0x383b2c['channel']&&_0x383b2c[_0x0738('0x38')]&&_0x383b2c[_0x0738('0x38')]['id']){try{var _0x27b055=getId(_0x383b2c[_0x0738('0x15')],_0x383b2c['message']?_0x383b2c['message']['id']:0x0,_0x383b2c['interaction']?_0x383b2c[_0x0738('0x38')]['id']:0x0);if(_0x369a4d[_0x0738('0x14')][_0x27b055]){_0x369a4d[_0x0738('0x14')][_0x27b055][_0x0738('0x33')](_0x0738('0x39'));}return _0x5913bf({'code':0xc8,'message':_0x383b2c});}catch(_0x1770a8){logger[_0x0738('0x36')](_0x1770a8[_0x0738('0x3e')]);return _0x9d1946(_0xb6faa4[_0x0738('0x36')](0x1f4,_0x1770a8));}}logger[_0x0738('0x36')](_0x0738('0x3f'));return _0x9d1946(_0xb6faa4[_0x0738('0x36')](0x1f4,_0x0738('0x3f')));});},'AgentCapacity':function(_0x17c0b2){var _0x1145c8=this;return new Promise(function(_0x53c82b,_0x2647f3){if(_0x369a4d[_0x0738('0x41')][_0x0738('0x43')](_0x17c0b2['id'])){for(var _0x6824c1 in _0x17c0b2[_0x0738('0x44')]){if(_0x17c0b2['capacity'][_0x0738('0x43')](_0x6824c1)){if(_0x369a4d[_0x0738('0x41')][_0x17c0b2['id']][_0x0738('0x43')](_0x6824c1+_0x0738('0x45'))){_0x369a4d[_0x0738('0x41')][_0x17c0b2['id']][_0x6824c1+'CurrentCapacity']=parseInt(_0x17c0b2['capacity'][_0x6824c1],0xa);}}}_0x369a4d[_0x0738('0x41')][_0x17c0b2['id']]['updateRealtime']();return _0x53c82b({'code':0xc8,'message':_0x369a4d['agents'][_0x17c0b2['id']]});}else{return _0x2647f3(_0x1145c8[_0x0738('0x36')](0x1f4,_0x0738('0x46')));}});},'Agents':function(_0x299404){return new Promise(function(_0xa426ee,_0x248ee9){var _0x38880f=_[_0x0738('0x47')](_0x369a4d[_0x0738('0x41')]);_0xa426ee({'count':_0x38880f[_0x0738('0x19')],'rows':_0x38880f});});},'ChatQueues':function(_0xc6d6a1){return new Promise(function(_0x295154,_0x372f27){var _0x448e9a=[];for(var _0x39b0c8 in _0x369a4d[_0x0738('0x48')]){if(_0x369a4d[_0x0738('0x48')][_0x0738('0x43')](_0x39b0c8)){var _0x350a56=_0x369a4d[_0x0738('0x48')][_0x39b0c8];var _0x59a71f={'id':_0x350a56['id'],'available':_0x350a56[_0x0738('0x49')],'loggedIn':_0x350a56[_0x0738('0x4a')],'name':_0x350a56['name'],'paused':_0x350a56[_0x0738('0x4b')],'waiting':_0x350a56[_0x0738('0x4c')]};_0x448e9a[_0x0738('0x20')](_0x59a71f);}}_0x295154({'count':_0x448e9a[_0x0738('0x19')],'rows':_0x448e9a});});},'MailQueues':function(_0x4d96a5){return new Promise(function(_0x4420fe,_0x204fbd){var _0x47bd4e=[];for(var _0x519844 in _0x369a4d[_0x0738('0x4d')]){if(_0x369a4d[_0x0738('0x4d')][_0x0738('0x43')](_0x519844)){var _0x592d30=_0x369a4d['mailQueues'][_0x519844];var _0x40c49c={'id':_0x592d30['id'],'available':_0x592d30[_0x0738('0x49')],'loggedIn':_0x592d30[_0x0738('0x4a')],'name':_0x592d30[_0x0738('0x4e')],'paused':_0x592d30['paused'],'waiting':_0x592d30['waiting']};_0x47bd4e[_0x0738('0x20')](_0x40c49c);}}_0x4420fe({'count':_0x47bd4e[_0x0738('0x19')],'rows':_0x47bd4e});});},'OpenchannelQueues':function(_0x8b385a){return new Promise(function(_0x49ee43,_0x571766){var _0x1d420e=[];for(var _0x362961 in _0x369a4d[_0x0738('0x4f')]){if(_0x369a4d[_0x0738('0x4f')][_0x0738('0x43')](_0x362961)){var _0x2a15ef=_0x369a4d[_0x0738('0x4f')][_0x362961];var _0x29b44c={'id':_0x2a15ef['id'],'available':_0x2a15ef['available'],'loggedIn':_0x2a15ef[_0x0738('0x4a')],'name':_0x2a15ef[_0x0738('0x4e')],'paused':_0x2a15ef[_0x0738('0x4b')],'waiting':_0x2a15ef[_0x0738('0x4c')]};_0x1d420e[_0x0738('0x20')](_0x29b44c);}}_0x49ee43({'count':_0x1d420e[_0x0738('0x19')],'rows':_0x1d420e});});},'SmsQueues':function(_0x2a1923){return new Promise(function(_0x30e273,_0x26cc7c){var _0x4fd9d5=[];for(var _0x96f007 in _0x369a4d[_0x0738('0x50')]){if(_0x369a4d[_0x0738('0x50')][_0x0738('0x43')](_0x96f007)){var _0x573a0b=_0x369a4d[_0x0738('0x50')][_0x96f007];var _0x1c1bf9={'id':_0x573a0b['id'],'available':_0x573a0b[_0x0738('0x49')],'loggedIn':_0x573a0b[_0x0738('0x4a')],'name':_0x573a0b[_0x0738('0x4e')],'paused':_0x573a0b[_0x0738('0x4b')],'waiting':_0x573a0b['waiting']};_0x4fd9d5['push'](_0x1c1bf9);}}_0x30e273({'count':_0x4fd9d5[_0x0738('0x19')],'rows':_0x4fd9d5});});},'FaxQueues':function(_0x33be02){return new Promise(function(_0x4bec40,_0x3cba39){var _0x2a4e9d=[];for(var _0x2e3074 in _0x369a4d[_0x0738('0x51')]){if(_0x369a4d['faxQueues'][_0x0738('0x43')](_0x2e3074)){var _0x30136a=_0x369a4d[_0x0738('0x51')][_0x2e3074];var _0xb91c2e={'id':_0x30136a['id'],'available':_0x30136a['available'],'loggedIn':_0x30136a[_0x0738('0x4a')],'name':_0x30136a[_0x0738('0x4e')],'paused':_0x30136a[_0x0738('0x4b')],'waiting':_0x30136a[_0x0738('0x4c')]};_0x2a4e9d[_0x0738('0x20')](_0xb91c2e);}}_0x4bec40({'count':_0x2a4e9d['length'],'rows':_0x2a4e9d});});},'WhatsappQueues':function(_0x4241ba){return new Promise(function(_0x559638,_0x3b7058){var _0x12765c=[];for(var _0x58e8ed in _0x369a4d['whatsappQueues']){if(_0x369a4d[_0x0738('0x52')][_0x0738('0x43')](_0x58e8ed)){var _0x2cd27b=_0x369a4d['whatsappQueues'][_0x58e8ed];var _0x2c8663={'id':_0x2cd27b['id'],'available':_0x2cd27b[_0x0738('0x49')],'loggedIn':_0x2cd27b[_0x0738('0x4a')],'name':_0x2cd27b[_0x0738('0x4e')],'paused':_0x2cd27b['paused'],'waiting':_0x2cd27b[_0x0738('0x4c')]};_0x12765c[_0x0738('0x20')](_0x2c8663);}}_0x559638({'count':_0x12765c[_0x0738('0x19')],'rows':_0x12765c});});},'ChatQueuesWaitingInteractions':function(_0x685433){return new Promise(function(_0x291fce,_0x4818a4){var _0x5915c7=_[_0x0738('0x47')](_0x369a4d[_0x0738('0x53')]);_0x291fce({'count':_0x5915c7['length'],'rows':_0x5915c7});});},'MailQueuesWaitingInteractions':function(_0x18724e){return new Promise(function(_0x5d82f5,_0x51bcab){var _0x4977c8=_['values'](_0x369a4d[_0x0738('0x54')]);_0x5d82f5({'count':_0x4977c8[_0x0738('0x19')],'rows':_0x4977c8});});},'OpenchannelQueuesWaitingInteractions':function(_0x4e490c){return new Promise(function(_0x5ef98b,_0x465d55){var _0x4c1d19=_['values'](_0x369a4d[_0x0738('0x55')]);_0x5ef98b({'count':_0x4c1d19[_0x0738('0x19')],'rows':_0x4c1d19});});},'SmsQueuesWaitingInteractions':function(_0x1d65c9){return new Promise(function(_0xb7b934,_0x38a1c0){var _0x10461e=_['values'](_0x369a4d['smsQueuesWaitingInteractions']);_0xb7b934({'count':_0x10461e[_0x0738('0x19')],'rows':_0x10461e});});},'FaxQueuesWaitingInteractions':function(_0x2c5b05){return new Promise(function(_0x23689f,_0x16f16f){var _0x3568f=_[_0x0738('0x47')](_0x369a4d[_0x0738('0x56')]);_0x23689f({'count':_0x3568f[_0x0738('0x19')],'rows':_0x3568f});});},'WhatsappQueuesWaitingInteractions':function(_0x1ee979){return new Promise(function(_0x420c04,_0xe7cf80){var _0x441af2=_[_0x0738('0x47')](_0x369a4d[_0x0738('0x57')]);_0x420c04({'count':_0x441af2['length'],'rows':_0x441af2});});}};var _0x5a7df8=jayson[_0x0738('0x58')](_0x3eb43c)[_0x0738('0x59')]();_0x5a7df8['on']('error',function(_0x2f5d6a){logger['error'](JSON[_0x0738('0x31')](_0x2f5d6a));return _0x91ceed(_0x2f5d6a);});_0x5a7df8[_0x0738('0x5a')](0x232c,'127.0.0.1',function(){console[_0x0738('0x5b')](_0x0738('0x5c'),0x232c);return _0x41fb54(_0x0738('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x3c38=['listen','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','dialogflow','amazonlex','slice','tag','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','matchPath','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','emit','end','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify'];(function(_0x499715,_0x4b9de1){var _0xd03283=function(_0x43d0c6){while(--_0x43d0c6){_0x499715['push'](_0x499715['shift']());}};_0xd03283(++_0x4b9de1);}(_0x3c38,0x1c9));var _0x83c3=function(_0x570954,_0x38a3e3){_0x570954=_0x570954-0x0;var _0x5cf058=_0x3c38[_0x570954];return _0x5cf058;};'use strict';var _=require(_0x83c3('0x0'));var util=require(_0x83c3('0x1'));var path=require(_0x83c3('0x2'));var fs=require('fs');var jayson=require(_0x83c3('0x3'));var BPromise=require(_0x83c3('0x4'));var uuid=require(_0x83c3('0x5'));var config=require('../../../config/environment');var logger=require(_0x83c3('0x6'))(_0x83c3('0x7'));var rpc={'openchannelQueueReport':require(_0x83c3('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x83c3('0x9')),'faxQueueReport':require(_0x83c3('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x83c3('0xb'));function getId(_0x3c85c,_0x4b3b57,_0x110204){return util[_0x83c3('0xc')](_0x83c3('0xd'),_0x3c85c,_0x4b3b57||0x0,_0x110204||0x0);}function getIntervals(_0x22cea8,_0x343f1b){var _0x228d8c=[];if(!_[_0x83c3('0xe')](_0x343f1b[_0x83c3('0xf')])&&!_['isNil'](_0x22cea8[_0x343f1b['IntervalId']])&&!_[_0x83c3('0xe')](_0x22cea8[_0x343f1b[_0x83c3('0xf')]][_0x83c3('0x10')])){_0x228d8c=_[_0x83c3('0x11')](_0x22cea8[_0x343f1b[_0x83c3('0xf')]][_0x83c3('0x10')],_0x83c3('0x12'));}else if(!_[_0x83c3('0xe')](_0x343f1b[_0x83c3('0x12')])){_0x228d8c=[_0x343f1b[_0x83c3('0x12')]];}return _0x228d8c;}exports['listen']=function(_0x2c3053){_0x2c3053[_0x83c3('0x13')]={};return new BPromise(function(_0x2acce9,_0x253db5){var _0x17fecd={'Start':function(_0x32b3d6){var _0x12b349=this;return new Promise(function(_0x2ab77c,_0x4952bc){if(_0x32b3d6){try{var _0x210eb7=[];var _0x54b31b=getId(_0x32b3d6[_0x83c3('0x14')],_0x32b3d6['message']?_0x32b3d6[_0x83c3('0x15')]['id']:0x0,_0x32b3d6[_0x83c3('0x16')]?_0x32b3d6[_0x83c3('0x16')]['id']:0x0);if(_0x32b3d6[_0x83c3('0x17')]&&_['isArray'](_0x32b3d6[_0x83c3('0x17')])&&_0x32b3d6[_0x83c3('0x17')][_0x83c3('0x18')]){for(var _0x2e9080=0x0;_0x2e9080<_0x32b3d6['applications'][_0x83c3('0x18')];_0x2e9080+=0x1){var _0x5368c1=_0x32b3d6[_0x83c3('0x17')][_0x2e9080];if(fs[_0x83c3('0x19')](path[_0x83c3('0x1a')](__dirname,_0x83c3('0x17'),_0x5368c1[_0x83c3('0x1b')]+_0x83c3('0x1c')))){var _0x169155=[];switch(_0x5368c1[_0x83c3('0x1b')][_0x83c3('0x1d')]()){case _0x83c3('0x1e'):var _0x3e3918=_0x5368c1[_0x83c3('0x1f')][_0x83c3('0x20')](',');_0x169155[_0x83c3('0x21')](_0x3e3918[0x0]);_0x169155['push'](_0x3e3918['slice'](0x1,_0x3e3918[_0x83c3('0x18')])[_0x83c3('0x1a')](','));break;case _0x83c3('0x22'):var _0x4567c=_0x5368c1[_0x83c3('0x1f')]['split'](',');_0x169155[_0x83c3('0x21')](_0x4567c[0x0]);_0x169155['push'](_0x4567c[0x1]);_0x169155['push'](_0x4567c['slice'](0x2,_0x4567c[_0x83c3('0x18')])[_0x83c3('0x1a')](','));break;case _0x83c3('0x23'):var _0x2a3196=_0x5368c1[_0x83c3('0x1f')][_0x83c3('0x20')](',');_0x169155[_0x83c3('0x21')](_0x2a3196[0x0]);_0x169155[_0x83c3('0x21')](_0x2a3196[0x1]);_0x169155['push'](_0x2a3196[0x2]);_0x169155[_0x83c3('0x21')](_0x2a3196[0x3]);_0x169155[_0x83c3('0x21')](_0x2a3196[_0x83c3('0x24')](0x4,_0x2a3196[_0x83c3('0x18')])[_0x83c3('0x1a')](','));break;case _0x83c3('0x15'):_0x169155['push'](_0x5368c1['appdata']);break;case _0x83c3('0x25'):_0x169155[_0x83c3('0x21')](_0x5368c1['TagId']);_0x169155[_0x83c3('0x21')](_0x5368c1['appdata']);break;default:_0x169155=_[_0x83c3('0xe')](_0x5368c1['appdata'])?[]:_0x5368c1['appdata'][_0x83c3('0x20')](',');}var _0x1eaab3={'id':util[_0x83c3('0xc')](_0x83c3('0x26'),_0x54b31b,_0x5368c1['id'],_0x5368c1['app']),'condition':require(_0x83c3('0x27'))[_0x83c3('0x28')](_0x54b31b,getIntervals(_0x2c3053[_0x83c3('0x29')],_0x5368c1),_0x2c3053),'consequence':require(_0x83c3('0x2a')+_0x5368c1['app'])[_0x83c3('0x2b')](_0x54b31b,_0x169155,_0x2c3053,_0x32b3d6),'p':_0x5368c1[_0x83c3('0x2c')]||0x0};logger[_0x83c3('0x2d')](_0x83c3('0x2e'),_0x1eaab3['id'],_0x83c3('0x2f'),getIntervals(_0x2c3053[_0x83c3('0x29')],_0x5368c1)[_0x83c3('0x1a')](_0x83c3('0x30')));_0x210eb7[_0x83c3('0x21')](_0x1eaab3);}else{logger['error'](_0x83c3('0x31'),path[_0x83c3('0x1a')](__dirname,_0x83c3('0x17'),_0x5368c1['app']+_0x83c3('0x1c')));}}_0x2c3053[_0x83c3('0x13')][_0x54b31b]=new RuleEngine(_0x210eb7);_0x2c3053['rules'][_0x54b31b][_0x83c3('0x32')](_0x32b3d6,function(_0x27378f){logger[_0x83c3('0x2d')]('Applications\x20executed',JSON['stringify'](_0x27378f[_0x83c3('0x33')]));if(_0x2c3053[_0x83c3('0x13')][_0x54b31b]){_0x2c3053[_0x83c3('0x13')][_0x54b31b]['emit']('complete');}});return _0x2ab77c({'code':0xc8,'message':_0x32b3d6});}else{logger[_0x83c3('0x2d')](_0x83c3('0x34'));return _0x2ab77c({'code':0xc8,'message':_0x32b3d6});}}catch(_0x704a02){logger[_0x83c3('0x35')](_0x704a02[_0x83c3('0x36')]);return _0x4952bc(_0x12b349['error'](0x1f4,_0x704a02));}}return _0x4952bc(_0x83c3('0x37'));});},'AcceptMessage':function(_0x5f0ed2){var _0x503965=this;return new Promise(function(_0x30b216,_0x1736db){if(_0x5f0ed2['message']&&_0x5f0ed2[_0x83c3('0x15')]['id']){try{var _0x491074=getId(_0x5f0ed2[_0x83c3('0x14')],_0x5f0ed2[_0x83c3('0x15')]?_0x5f0ed2[_0x83c3('0x15')]['id']:0x0,_0x5f0ed2[_0x83c3('0x16')]?_0x5f0ed2['interaction']['id']:0x0);if(_0x2c3053[_0x83c3('0x13')][_0x491074]){_0x2c3053[_0x83c3('0x13')][_0x491074][_0x83c3('0x38')](_0x83c3('0x39'));if(rpc[_0x5f0ed2[_0x83c3('0x14')]+_0x83c3('0x3a')]){rpc[_0x5f0ed2[_0x83c3('0x14')]+_0x83c3('0x3a')][_0x83c3('0x3b')](_0x491074,{'UserId':_0x5f0ed2['message'][_0x83c3('0x3c')]})[_0x83c3('0x3d')](function(_0x57a02f){logger['error']('error\x20update\x20queue\x20report');});}}return _0x30b216({'code':0xc8,'message':_0x5f0ed2});}catch(_0xba853c){logger['error'](_0xba853c[_0x83c3('0x36')]);return _0x1736db(_0x503965[_0x83c3('0x35')](0x1f4,_0xba853c));}}logger[_0x83c3('0x35')](_0x83c3('0x3e'));return _0x1736db(_0x503965[_0x83c3('0x35')](0x1f4,_0x83c3('0x3e')));});},'RejectMessage':function(_0x35f3cf){var _0x188279=this;return new Promise(function(_0x7c2c7d,_0x58e734){if(_0x35f3cf['agent']&&_0x35f3cf[_0x83c3('0x3f')]['id']){try{if(_0x2c3053[_0x83c3('0x40')][_0x35f3cf[_0x83c3('0x3f')]['id']]){_0x2c3053[_0x83c3('0x40')][_0x35f3cf[_0x83c3('0x3f')]['id']]['busy']=![];_0x2c3053[_0x83c3('0x40')][_0x35f3cf[_0x83c3('0x3f')]['id']][_0x83c3('0x41')]=undefined;}return _0x7c2c7d({'code':0xc8,'message':_0x35f3cf});}catch(_0x36fe78){logger[_0x83c3('0x35')](_0x36fe78[_0x83c3('0x36')]);return _0x58e734(_0x188279[_0x83c3('0x35')](0x1f4,_0x36fe78));}}logger['error'](_0x83c3('0x3e'));return _0x58e734(_0x188279[_0x83c3('0x35')](0x1f4,_0x83c3('0x3e')));});},'AbandonInteraction':function(_0x4b3a2a){var _0x4f574a=this;return new Promise(function(_0x16e324,_0x1d500c){if(_0x4b3a2a[_0x83c3('0x14')]&&_0x4b3a2a[_0x83c3('0x16')]&&_0x4b3a2a[_0x83c3('0x16')]['id']){try{var _0x203bb=getId(_0x4b3a2a[_0x83c3('0x14')],_0x4b3a2a[_0x83c3('0x15')]?_0x4b3a2a[_0x83c3('0x15')]['id']:0x0,_0x4b3a2a[_0x83c3('0x16')]?_0x4b3a2a[_0x83c3('0x16')]['id']:0x0);if(_0x2c3053['rules'][_0x203bb]){_0x2c3053[_0x83c3('0x13')][_0x203bb][_0x83c3('0x38')](_0x83c3('0x39'));}return _0x16e324({'code':0xc8,'message':_0x4b3a2a});}catch(_0x88a919){logger[_0x83c3('0x35')](_0x88a919['stack']);return _0x1d500c(_0x4f574a[_0x83c3('0x35')](0x1f4,_0x88a919));}}logger['error']('message\x20is\x20empty');return _0x1d500c(_0x4f574a[_0x83c3('0x35')](0x1f4,_0x83c3('0x3e')));});},'AgentCapacity':function(_0x16f5f6){var _0x333ef7=this;return new Promise(function(_0x524902,_0x4f3fa0){if(_0x2c3053[_0x83c3('0x40')][_0x83c3('0x42')](_0x16f5f6['id'])){for(var _0x40e82d in _0x16f5f6[_0x83c3('0x43')]){if(_0x16f5f6[_0x83c3('0x43')][_0x83c3('0x42')](_0x40e82d)){if(_0x2c3053[_0x83c3('0x40')][_0x16f5f6['id']][_0x83c3('0x42')](_0x40e82d+_0x83c3('0x44'))){_0x2c3053[_0x83c3('0x40')][_0x16f5f6['id']][_0x40e82d+'CurrentCapacity']=parseInt(_0x16f5f6[_0x83c3('0x43')][_0x40e82d],0xa);}}}_0x2c3053[_0x83c3('0x40')][_0x16f5f6['id']]['updateRealtime']();return _0x524902({'code':0xc8,'message':_0x2c3053['agents'][_0x16f5f6['id']]});}else{return _0x4f3fa0(_0x333ef7[_0x83c3('0x35')](0x1f4,_0x83c3('0x45')));}});},'Agents':function(_0x3f80b4){return new Promise(function(_0x413827,_0xb1345b){var _0x582a12=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x40')]);_0x413827({'count':_0x582a12['length'],'rows':_0x582a12});});},'ChatQueues':function(_0x4e4f15){return new Promise(function(_0x5646f7,_0x58d3e6){var _0xaea033=[];for(var _0x1484f0 in _0x2c3053[_0x83c3('0x47')]){if(_0x2c3053['chatQueues'][_0x83c3('0x42')](_0x1484f0)){var _0x1aa44b=_0x2c3053[_0x83c3('0x47')][_0x1484f0];var _0xe043dc={'id':_0x1aa44b['id'],'available':_0x1aa44b[_0x83c3('0x48')],'loggedIn':_0x1aa44b['loggedIn'],'name':_0x1aa44b[_0x83c3('0x49')],'paused':_0x1aa44b[_0x83c3('0x4a')],'waiting':_0x1aa44b['waiting']};_0xaea033[_0x83c3('0x21')](_0xe043dc);}}_0x5646f7({'count':_0xaea033[_0x83c3('0x18')],'rows':_0xaea033});});},'MailQueues':function(_0x903fc0){return new Promise(function(_0x1faf88,_0x259161){var _0x48d214=[];for(var _0x352087 in _0x2c3053[_0x83c3('0x4b')]){if(_0x2c3053['mailQueues'][_0x83c3('0x42')](_0x352087)){var _0x5e1e21=_0x2c3053['mailQueues'][_0x352087];var _0x4c9b8d={'id':_0x5e1e21['id'],'available':_0x5e1e21[_0x83c3('0x48')],'loggedIn':_0x5e1e21[_0x83c3('0x4c')],'name':_0x5e1e21[_0x83c3('0x49')],'paused':_0x5e1e21[_0x83c3('0x4a')],'waiting':_0x5e1e21[_0x83c3('0x4d')]};_0x48d214[_0x83c3('0x21')](_0x4c9b8d);}}_0x1faf88({'count':_0x48d214[_0x83c3('0x18')],'rows':_0x48d214});});},'OpenchannelQueues':function(_0x2db774){return new Promise(function(_0x4044e9,_0x4c64c4){var _0x4873cf=[];for(var _0x2754e9 in _0x2c3053[_0x83c3('0x4e')]){if(_0x2c3053[_0x83c3('0x4e')]['hasOwnProperty'](_0x2754e9)){var _0x1052e7=_0x2c3053[_0x83c3('0x4e')][_0x2754e9];var _0x451b1b={'id':_0x1052e7['id'],'available':_0x1052e7[_0x83c3('0x48')],'loggedIn':_0x1052e7[_0x83c3('0x4c')],'name':_0x1052e7[_0x83c3('0x49')],'paused':_0x1052e7[_0x83c3('0x4a')],'waiting':_0x1052e7['waiting']};_0x4873cf[_0x83c3('0x21')](_0x451b1b);}}_0x4044e9({'count':_0x4873cf['length'],'rows':_0x4873cf});});},'SmsQueues':function(_0x1ff005){return new Promise(function(_0xb2720c,_0xda114e){var _0x5730e9=[];for(var _0x4dee61 in _0x2c3053[_0x83c3('0x4f')]){if(_0x2c3053[_0x83c3('0x4f')][_0x83c3('0x42')](_0x4dee61)){var _0x532c12=_0x2c3053[_0x83c3('0x4f')][_0x4dee61];var _0x5a872a={'id':_0x532c12['id'],'available':_0x532c12[_0x83c3('0x48')],'loggedIn':_0x532c12[_0x83c3('0x4c')],'name':_0x532c12[_0x83c3('0x49')],'paused':_0x532c12[_0x83c3('0x4a')],'waiting':_0x532c12['waiting']};_0x5730e9[_0x83c3('0x21')](_0x5a872a);}}_0xb2720c({'count':_0x5730e9[_0x83c3('0x18')],'rows':_0x5730e9});});},'FaxQueues':function(_0x55783a){return new Promise(function(_0x5595e0,_0x4878a9){var _0x43129b=[];for(var _0x26301b in _0x2c3053[_0x83c3('0x50')]){if(_0x2c3053[_0x83c3('0x50')][_0x83c3('0x42')](_0x26301b)){var _0x4db307=_0x2c3053[_0x83c3('0x50')][_0x26301b];var _0x3101ea={'id':_0x4db307['id'],'available':_0x4db307[_0x83c3('0x48')],'loggedIn':_0x4db307['loggedIn'],'name':_0x4db307[_0x83c3('0x49')],'paused':_0x4db307[_0x83c3('0x4a')],'waiting':_0x4db307[_0x83c3('0x4d')]};_0x43129b[_0x83c3('0x21')](_0x3101ea);}}_0x5595e0({'count':_0x43129b[_0x83c3('0x18')],'rows':_0x43129b});});},'WhatsappQueues':function(_0x586558){return new Promise(function(_0x57aa93,_0x10fc16){var _0x5e9044=[];for(var _0x5f33df in _0x2c3053[_0x83c3('0x51')]){if(_0x2c3053[_0x83c3('0x51')]['hasOwnProperty'](_0x5f33df)){var _0x17c3f9=_0x2c3053['whatsappQueues'][_0x5f33df];var _0x2c73d4={'id':_0x17c3f9['id'],'available':_0x17c3f9[_0x83c3('0x48')],'loggedIn':_0x17c3f9[_0x83c3('0x4c')],'name':_0x17c3f9[_0x83c3('0x49')],'paused':_0x17c3f9[_0x83c3('0x4a')],'waiting':_0x17c3f9['waiting']};_0x5e9044[_0x83c3('0x21')](_0x2c73d4);}}_0x57aa93({'count':_0x5e9044[_0x83c3('0x18')],'rows':_0x5e9044});});},'ChatQueuesWaitingInteractions':function(_0x18ecff){return new Promise(function(_0x298435,_0x3683cb){var _0x2cabd4=_[_0x83c3('0x46')](_0x2c3053['chatQueuesWaitingInteractions']);_0x298435({'count':_0x2cabd4[_0x83c3('0x18')],'rows':_0x2cabd4});});},'MailQueuesWaitingInteractions':function(_0x5180e1){return new Promise(function(_0x3d159a,_0x4155da){var _0x234308=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x52')]);_0x3d159a({'count':_0x234308[_0x83c3('0x18')],'rows':_0x234308});});},'OpenchannelQueuesWaitingInteractions':function(_0x2e29e3){return new Promise(function(_0xfc2906,_0x530d68){var _0x3ee1de=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x53')]);_0xfc2906({'count':_0x3ee1de[_0x83c3('0x18')],'rows':_0x3ee1de});});},'SmsQueuesWaitingInteractions':function(_0x586aca){return new Promise(function(_0x43a13a,_0x1001bb){var _0x54cb9d=_['values'](_0x2c3053['smsQueuesWaitingInteractions']);_0x43a13a({'count':_0x54cb9d[_0x83c3('0x18')],'rows':_0x54cb9d});});},'FaxQueuesWaitingInteractions':function(_0x12ce51){return new Promise(function(_0x273393,_0x17d09c){var _0x1fd996=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x54')]);_0x273393({'count':_0x1fd996[_0x83c3('0x18')],'rows':_0x1fd996});});},'WhatsappQueuesWaitingInteractions':function(_0x311d79){return new Promise(function(_0x54d0b4,_0x7c5b70){var _0xe8c5a=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x55')]);_0x54d0b4({'count':_0xe8c5a[_0x83c3('0x18')],'rows':_0xe8c5a});});}};var _0x14a6ee=jayson[_0x83c3('0x56')](_0x17fecd)[_0x83c3('0x57')]();_0x14a6ee['on'](_0x83c3('0x35'),function(_0x3b9b8f){logger[_0x83c3('0x35')](JSON[_0x83c3('0x58')](_0x3b9b8f));return _0x253db5(_0x3b9b8f);});_0x14a6ee[_0x83c3('0x59')](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2acce9(_0x83c3('0x5a')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ad353be..1dcfa05 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 _0x0564=['log','stack','stop','bluebird','lodash','../../../config/logger','client','http','request','error','result','catch','rules','info','length','Command','format','message','true','all','then','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when'];(function(_0x275676,_0x2d49a0){var _0x2a6423=function(_0x3c2de4){while(--_0x3c2de4){_0x275676['push'](_0x275676['shift']());}};_0x2a6423(++_0x2d49a0);}(_0x0564,0xfd));var _0x4056=function(_0x3b45a1,_0x310aca){_0x3b45a1=_0x3b45a1-0x0;var _0x587eda=_0x0564[_0x3b45a1];return _0x587eda;};'use strict';var util=require('util');var BPromise=require(_0x4056('0x0'));var jayson=require('jayson/promise');var _=require(_0x4056('0x1'));var logger=require(_0x4056('0x2'))('routing');var client=jayson[_0x4056('0x3')][_0x4056('0x4')]({'port':0x232a});function request(_0x58bc53,_0x118607){return new BPromise(function(_0x4cd468,_0x496cd5){return client[_0x4056('0x5')](_0x58bc53,_0x118607)['then'](function(_0x44e0d8){if(_0x44e0d8[_0x4056('0x6')]){return _0x496cd5(_0x44e0d8['error']['message']);}else{return _0x4cd468(_0x44e0d8[_0x4056('0x7')]);}})[_0x4056('0x8')](function(_0x101d52){return _0x496cd5(_0x101d52);});});}exports['condition']=function(_0x47052d,_0x93653c,_0x3ec8fd){return function(_0x575dc2){if(_0x3ec8fd[_0x4056('0x9')]&&!_0x3ec8fd[_0x4056('0x9')][_0x47052d]){logger[_0x4056('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x47052d);return _0x575dc2['stop']();}var _0x1c95fc=[];for(var _0x3cfc4f=0x0;_0x3cfc4f<_0x93653c[_0x4056('0xb')];_0x3cfc4f+=0x1){_0x1c95fc['push'](request(_0x4056('0xc'),{'command':util[_0x4056('0xd')]('iftime\x20%s',_0x93653c[_0x3cfc4f])})['then'](function(_0x17d8b7){return _0x17d8b7&&_0x17d8b7[_0x4056('0xe')]&&_0x17d8b7[_0x4056('0xe')]['indexOf'](_0x4056('0xf'))>=0x0?!![]:![];})['catch'](function(_0x56e338){logger['error']('[%s][INTERVAL]\x20%s',_0x47052d,_0x93653c[_0x3cfc4f]);}));}BPromise[_0x4056('0x10')](_0x1c95fc)[_0x4056('0x11')](function(_0x1faf44){var _0x23dfe2=_[_0x4056('0x12')](_0x1faf44);logger[_0x4056('0xa')](_0x4056('0x13'),_0x47052d,_0x93653c['join'](_0x4056('0x14')),_0x23dfe2);_0x575dc2[_0x4056('0x15')](_0x23dfe2);})[_0x4056('0x8')](function(_0x13eebe){console[_0x4056('0x16')](_0x13eebe);logger[_0x4056('0x6')](_0x4056('0x13'),_0x47052d,_0x93653c['join'](_0x4056('0x14')),_0x13eebe[_0x4056('0x17')]);_0x575dc2[_0x4056('0x18')]();});};}; \ No newline at end of file +var _0x74e9=['iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','lodash','../../../config/logger','routing','client','http','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format'];(function(_0x30f84f,_0x15f853){var _0x55423f=function(_0x573900){while(--_0x573900){_0x30f84f['push'](_0x30f84f['shift']());}};_0x55423f(++_0x15f853);}(_0x74e9,0xac));var _0x974e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x74e9[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x974e('0x0'));var logger=require(_0x974e('0x1'))(_0x974e('0x2'));var client=jayson[_0x974e('0x3')][_0x974e('0x4')]({'port':0x232a});function request(_0x685486,_0x4d52c6){return new BPromise(function(_0x8a18ab,_0x4b9354){return client['request'](_0x685486,_0x4d52c6)['then'](function(_0x2525e7){if(_0x2525e7[_0x974e('0x5')]){return _0x4b9354(_0x2525e7[_0x974e('0x5')][_0x974e('0x6')]);}else{return _0x8a18ab(_0x2525e7[_0x974e('0x7')]);}})[_0x974e('0x8')](function(_0x2e1c6b){return _0x4b9354(_0x2e1c6b);});});}exports[_0x974e('0x9')]=function(_0x5e0ff7,_0x178978,_0x2a2890){return function(_0x563c68){if(_0x2a2890[_0x974e('0xa')]&&!_0x2a2890[_0x974e('0xa')][_0x5e0ff7]){logger[_0x974e('0xb')](_0x974e('0xc'),_0x5e0ff7);return _0x563c68[_0x974e('0xd')]();}var _0x37e75b=[];for(var _0x3fe48c=0x0;_0x3fe48c<_0x178978['length'];_0x3fe48c+=0x1){_0x37e75b[_0x974e('0xe')](request(_0x974e('0xf'),{'command':util[_0x974e('0x10')](_0x974e('0x11'),_0x178978[_0x3fe48c])})[_0x974e('0x12')](function(_0x30b02d){return _0x30b02d&&_0x30b02d['message']&&_0x30b02d[_0x974e('0x6')][_0x974e('0x13')](_0x974e('0x14'))>=0x0?!![]:![];})[_0x974e('0x8')](function(_0x4723c7){logger[_0x974e('0x5')](_0x974e('0x15'),_0x5e0ff7,_0x178978[_0x3fe48c]);}));}BPromise['all'](_0x37e75b)[_0x974e('0x12')](function(_0x42ca1e){var _0x2bec64=_[_0x974e('0x16')](_0x42ca1e);logger['info'](_0x974e('0x17'),_0x5e0ff7,_0x178978[_0x974e('0x18')]('\x20|\x20'),_0x2bec64);_0x563c68['when'](_0x2bec64);})[_0x974e('0x8')](function(_0x102625){console['log'](_0x102625);logger[_0x974e('0x5')](_0x974e('0x17'),_0x5e0ff7,_0x178978[_0x974e('0x18')](_0x974e('0x19')),_0x102625[_0x974e('0x1a')]);_0x563c68[_0x974e('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b4eba06..743eb05 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 _0xa0e5=['connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','connectedlinename','error','isNil','agentringnoanswerAt','now','timeout','ringtime','talktime','stack','queuecallerabandon','agentringnoanswer','abandoned','reason','holdtime','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','diffTime','agentcompleteAt','complete','transfereruniqueid','transfer','transfertype','transferexten','transferuniqueid','attendedtransfer','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','origtransfereruniqueid','transfereeuniqueid','agententerreason','calleridname','transfertargetuniqueid','clone','agentcalledAt','hangup','cause','rejected','indexOf','splice','agent','lodash','util','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','membername','interface','calleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0e5,0x193));var _0x5a0e=function(_0x1bf463,_0x4b6a97){_0x1bf463=_0x1bf463-0x0;var _0xcdf46b=_0xa0e5[_0x1bf463];return _0xcdf46b;};'use strict';var _=require(_0x5a0e('0x0'));var util=require(_0x5a0e('0x1'));var utils=require(_0x5a0e('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2efba7,_0x29d887){utils[_0x5a0e('0x3')](util[_0x5a0e('0x4')](_0x5a0e('0x5'),_0x2efba7[_0x5a0e('0x6')],_0x2efba7[_0x5a0e('0x7')],_0x2efba7['queue'],_0x2efba7[_0x5a0e('0x8')],_0x2efba7[_0x5a0e('0x9')],_0x2efba7[_0x5a0e('0xa')],_0x2efba7[_0x5a0e('0xb')],_0x2efba7[_0x5a0e('0xc')]));if(_0x2efba7['queue']){utils[_0x5a0e('0xd')](_0x2efba7['queue'])['then'](function(_0x1944bc){if(_0x1944bc){_0x2efba7[_0x5a0e('0xe')]=_0x1944bc[_0x5a0e('0xe')];_0x2efba7[_0x5a0e('0xf')]=_0x2efba7['agentcomplete']?_0x1944bc[_0x5a0e('0x10')]:![];_0x2efba7[_0x5a0e('0x11')]=_0x2efba7[_0x5a0e('0xf')]?_0x1944bc[_0x5a0e('0x12')]:0x0;}utils[_0x5a0e('0x13')](_0x5a0e('0x14'),_0x2efba7);});}else{utils[_0x5a0e('0x13')](_0x5a0e('0x14'),_0x2efba7);}if(_0x29d887){delete transfers[_0x2efba7[_0x5a0e('0x6')]];}else{delete agents[_0x2efba7['destuniqueid']];}}exports[_0x5a0e('0x15')]=function(_0x25d58b){try{agents[_0x25d58b[_0x5a0e('0x16')]]=_0x25d58b;agents[_0x25d58b[_0x5a0e('0x16')]]['agentcalledAt']=utils['now']();agents[_0x25d58b[_0x5a0e('0x16')]][_0x5a0e('0xc')]='called';agents[_0x25d58b['destuniqueid']][_0x5a0e('0xb')]=null;agents[_0x25d58b[_0x5a0e('0x16')]][_0x5a0e('0x17')]=null;}catch(_0x18eaf6){utils[_0x5a0e('0x18')](_0x18eaf6['stack']);}};exports['agentringnoanswer']=function(_0xb04097){try{if(!_[_0x5a0e('0x19')](agents[_0xb04097[_0x5a0e('0x16')]])){agents[_0xb04097[_0x5a0e('0x16')]]['agentringnoanswer']=!![];agents[_0xb04097[_0x5a0e('0x16')]][_0x5a0e('0x1a')]=utils[_0x5a0e('0x1b')]();agents[_0xb04097['destuniqueid']][_0x5a0e('0xc')]=_0x5a0e('0x1c');agents[_0xb04097['destuniqueid']]['reason']=_0x5a0e('0x1c');agents[_0xb04097['destuniqueid']]['holdtime']=_0xb04097[_0x5a0e('0x1d')]?parseInt(_0xb04097['ringtime'])/0x3e8:0x0;agents[_0xb04097[_0x5a0e('0x16')]][_0x5a0e('0x1e')]=0x0;unanswered['push'](_0xb04097[_0x5a0e('0x16')]);}}catch(_0x447c3c){utils[_0x5a0e('0x18')](_0x447c3c[_0x5a0e('0x1f')]);}};exports[_0x5a0e('0x20')]=function(_0xfee107){try{_['forIn'](agents,function(_0x40f374,_0x5e7d43){if(_0x40f374[_0x5a0e('0x6')]==_0xfee107['uniqueid']&&!_['includes'](unanswered,_0x40f374[_0x5a0e('0x16')])){_0x40f374[_0x5a0e('0x21')]=!![];_0x40f374[_0x5a0e('0x1a')]=utils[_0x5a0e('0x1b')]();_0x40f374[_0x5a0e('0xc')]=_0x5a0e('0x22');_0x40f374[_0x5a0e('0x23')]=_0x5a0e('0x22');_0x40f374['holdtime']=_0xfee107[_0x5a0e('0x24')];_0x40f374[_0x5a0e('0x1e')]=0x0;writeDB(_0x40f374);}});}catch(_0x11a93e){utils[_0x5a0e('0x18')](_0x11a93e[_0x5a0e('0x1f')]);}};exports['agentconnect']=function(_0xf03535){try{if(agents[_0xf03535[_0x5a0e('0x16')]]){agents[_0xf03535[_0x5a0e('0x16')]][_0x5a0e('0x25')]=utils[_0x5a0e('0x1b')]();agents[_0xf03535[_0x5a0e('0x16')]]['connectedlinenum']=_0xf03535[_0x5a0e('0xb')];agents[_0xf03535['destuniqueid']][_0x5a0e('0x17')]=_0xf03535[_0x5a0e('0x17')];agents[_0xf03535[_0x5a0e('0x16')]][_0x5a0e('0x24')]=_0xf03535[_0x5a0e('0x1d')];agents[_0xf03535['destuniqueid']][_0x5a0e('0xc')]='connect';_[_0x5a0e('0x26')](agents,function(_0x767643,_0x5c5d23){if(_0x767643[_0x5a0e('0x16')]!=_0xf03535[_0x5a0e('0x16')]&&_0x767643[_0x5a0e('0x6')]==_0xf03535[_0x5a0e('0x6')]){_0x767643['talktime']=0x0;_0x767643[_0x5a0e('0x24')]=_0xf03535[_0x5a0e('0x1d')];_0x767643['agentringnoanswer']=!![];_0x767643[_0x5a0e('0x1a')]=utils[_0x5a0e('0x1b')]();_0x767643[_0x5a0e('0xc')]=_0x5a0e('0x27');_0x767643[_0x5a0e('0x23')]=_0x5a0e('0x27');_0x767643[_0x5a0e('0x28')]=_0xf03535[_0x5a0e('0x16')];_0x767643[_0x5a0e('0x29')]=_0xf03535['membername'];writeDB(_0x767643);}});}}catch(_0x18d4e3){utils[_0x5a0e('0x18')](_0x18d4e3[_0x5a0e('0x1f')]);}};exports[_0x5a0e('0x2a')]=function(_0x3b58a8){try{if(!_['isNil'](agents[_0x3b58a8[_0x5a0e('0x16')]])){agents[_0x3b58a8[_0x5a0e('0x16')]][_0x5a0e('0x2a')]=!![];agents[_0x3b58a8[_0x5a0e('0x16')]]['agentcompleteAt']=utils[_0x5a0e('0x1b')]();agents[_0x3b58a8['destuniqueid']][_0x5a0e('0x1e')]=utils[_0x5a0e('0x2b')](agents[_0x3b58a8['destuniqueid']][_0x5a0e('0x2c')],agents[_0x3b58a8['destuniqueid']][_0x5a0e('0x25')]);agents[_0x3b58a8[_0x5a0e('0x16')]][_0x5a0e('0x23')]=_0x3b58a8[_0x5a0e('0x23')];agents[_0x3b58a8[_0x5a0e('0x16')]][_0x5a0e('0xc')]=_0x5a0e('0x2d');writeDB(agents[_0x3b58a8[_0x5a0e('0x16')]]);}}catch(_0x1f93f7){utils[_0x5a0e('0x18')](_0x1f93f7[_0x5a0e('0x1f')]);}};exports['blindtransfer']=function(_0x25c047){try{if(!_[_0x5a0e('0x19')](agents[_0x25c047['transfereruniqueid']])){agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x2f')]=!![];agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x30')]='blind';agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x31')]=_0x25c047['extension'];agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x32')]=agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x6')];}}catch(_0x38d114){utils[_0x5a0e('0x18')](_0x38d114['stack']);}};exports[_0x5a0e('0x33')]=function(_0x27a457){try{if(_0x27a457['origtransfereruniqueid']==_0x27a457[_0x5a0e('0x34')]){if(!_[_0x5a0e('0x19')](agents[_0x27a457[_0x5a0e('0x35')]])){agents[_0x27a457[_0x5a0e('0x35')]][_0x5a0e('0x2f')]=!![];agents[_0x27a457[_0x5a0e('0x35')]]['transfertype']=_0x5a0e('0x36');agents[_0x27a457['secondtransfereruniqueid']][_0x5a0e('0x31')]=_0x27a457[_0x5a0e('0x37')];agents[_0x27a457[_0x5a0e('0x35')]][_0x5a0e('0x32')]=_0x27a457[_0x5a0e('0x38')];}if(_0x27a457[_0x5a0e('0x39')]&&agents[_0x27a457[_0x5a0e('0x39')]]){agents[_0x27a457[_0x5a0e('0x39')]][_0x5a0e('0x3a')]=0x1;transfers[_0x27a457['transfereeuniqueid']]=_['clone'](agents[_0x27a457[_0x5a0e('0x39')]]);transfers[_0x27a457[_0x5a0e('0x39')]]['calleridnum']=agents[_0x27a457[_0x5a0e('0x35')]][_0x5a0e('0xa')];transfers[_0x27a457[_0x5a0e('0x39')]][_0x5a0e('0x3b')]=agents[_0x27a457['secondtransfereruniqueid']][_0x5a0e('0x3b')];transfers[_0x27a457[_0x5a0e('0x39')]]['agentcalledAt']=utils[_0x5a0e('0x1b')]();transfers[_0x27a457['transfereeuniqueid']][_0x5a0e('0x25')]=utils['now']();transfers[_0x27a457['transfereeuniqueid']][_0x5a0e('0x24')]=0x0;transfers[_0x27a457['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x27a457[_0x5a0e('0x35')]==_0x27a457['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x27a457['origtransfereruniqueid']])){agents[_0x27a457[_0x5a0e('0x38')]][_0x5a0e('0x2f')]=!![];agents[_0x27a457[_0x5a0e('0x38')]][_0x5a0e('0x30')]=_0x5a0e('0x36');agents[_0x27a457['origtransfereruniqueid']][_0x5a0e('0x31')]=_0x27a457['secondtransfererexten'];agents[_0x27a457[_0x5a0e('0x38')]][_0x5a0e('0x32')]=_0x27a457['secondtransfereruniqueid'];}if(_0x27a457[_0x5a0e('0x3c')]&&agents[_0x27a457[_0x5a0e('0x3c')]]){agents[_0x27a457['transfertargetuniqueid']][_0x5a0e('0x3a')]=0x1;transfers[_0x27a457['transfertargetuniqueid']]=_[_0x5a0e('0x3d')](agents[_0x27a457['transfertargetuniqueid']]);transfers[_0x27a457[_0x5a0e('0x3c')]][_0x5a0e('0xa')]=agents[_0x27a457[_0x5a0e('0x38')]][_0x5a0e('0xa')];transfers[_0x27a457[_0x5a0e('0x3c')]][_0x5a0e('0x3b')]=agents[_0x27a457[_0x5a0e('0x38')]]['calleridname'];transfers[_0x27a457['transfertargetuniqueid']][_0x5a0e('0x3e')]=utils[_0x5a0e('0x1b')]();transfers[_0x27a457[_0x5a0e('0x3c')]][_0x5a0e('0x25')]=utils[_0x5a0e('0x1b')]();transfers[_0x27a457[_0x5a0e('0x3c')]]['holdtime']=0x0;transfers[_0x27a457['transfertargetuniqueid']][_0x5a0e('0x3a')]=0x2;}}}catch(_0xa35301){utils['error'](_0xa35301[_0x5a0e('0x1f')]);}};exports[_0x5a0e('0x3f')]=function(_0x42a749){try{if(agents[_0x42a749[_0x5a0e('0x6')]]&&agents[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x23')]===_0x5a0e('0x1c')){if(_0x42a749[_0x5a0e('0x40')]==='21'){agents[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x23')]=_0x5a0e('0x41');agents[_0x42a749[_0x5a0e('0x6')]]['lastevent']=_0x5a0e('0x41');}writeDB(agents[_0x42a749['uniqueid']]);var _0x4c7889=unanswered[_0x5a0e('0x42')](_0x42a749[_0x5a0e('0x6')]);if(_0x4c7889>-0x1)unanswered[_0x5a0e('0x43')](_0x4c7889,0x1);}if(transfers[_0x42a749[_0x5a0e('0x6')]]){transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x2a')]=!![];transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x2c')]=utils[_0x5a0e('0x1b')]();transfers[_0x42a749[_0x5a0e('0x6')]]['talktime']=utils[_0x5a0e('0x2b')](transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x2c')],transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x25')]);transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x23')]=_0x5a0e('0x44');transfers[_0x42a749['uniqueid']]['lastevent']='complete';writeDB(transfers[_0x42a749[_0x5a0e('0x6')]],!![]);}if(agents[_0x42a749[_0x5a0e('0x6')]]&&agents[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x25')]){agents[_0x42a749['uniqueid']][_0x5a0e('0x2a')]=!![];agents[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x2c')]=utils[_0x5a0e('0x1b')]();agents[_0x42a749[_0x5a0e('0x6')]]['talktime']=utils['diffTime'](agents[_0x42a749[_0x5a0e('0x6')]]['agentcompleteAt'],agents[_0x42a749[_0x5a0e('0x6')]]['agentconnectAt']);agents[_0x42a749[_0x5a0e('0x6')]]['reason']=agents[_0x42a749['uniqueid']]['transfer']?_0x5a0e('0x2f'):_0x5a0e('0x44');agents[_0x42a749[_0x5a0e('0x6')]]['lastevent']='complete';writeDB(agents[_0x42a749[_0x5a0e('0x6')]]);}}catch(_0xb578b1){utils[_0x5a0e('0x18')](_0xb578b1[_0x5a0e('0x1f')]);}}; \ No newline at end of file +var _0x5c69=['clone','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice','agentcompleteAt','agent','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','destuniqueid','agentcalledAt','now','lastevent','connectedlinename','stack','agentringnoanswer','isNil','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','error','queuecallerabandon','forIn','includes','abandoned','agentconnect','agentconnectAt','connectedlinenum','connect','answered_elsewhere','answeredelsewheremembername','diffTime','complete','transfereruniqueid','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid'];(function(_0x2f9f80,_0x51aa43){var _0x2d690a=function(_0x594001){while(--_0x594001){_0x2f9f80['push'](_0x2f9f80['shift']());}};_0x2d690a(++_0x51aa43);}(_0x5c69,0xe9));var _0x95c6=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x5c69[_0xac151d];return _0x111dba;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x34c20d,_0x1b1420){utils[_0x95c6('0x0')](util[_0x95c6('0x1')](_0x95c6('0x2'),_0x34c20d[_0x95c6('0x3')],_0x34c20d[_0x95c6('0x4')],_0x34c20d[_0x95c6('0x5')],_0x34c20d[_0x95c6('0x6')],_0x34c20d[_0x95c6('0x7')],_0x34c20d['calleridnum'],_0x34c20d['connectedlinenum'],_0x34c20d['lastevent']));if(_0x34c20d[_0x95c6('0x5')]){utils[_0x95c6('0x8')](_0x34c20d[_0x95c6('0x5')])[_0x95c6('0x9')](function(_0x14a580){if(_0x14a580){_0x34c20d['type']=_0x14a580[_0x95c6('0xa')];_0x34c20d['agentacw']=_0x34c20d[_0x95c6('0xb')]?_0x14a580[_0x95c6('0xc')]:![];_0x34c20d[_0x95c6('0xd')]=_0x34c20d['agentacw']?_0x14a580[_0x95c6('0xe')]:0x0;}utils['request'](_0x95c6('0xf'),_0x34c20d);});}else{utils[_0x95c6('0x10')]('CreateVoiceAgentReport',_0x34c20d);}if(_0x1b1420){delete transfers[_0x34c20d[_0x95c6('0x3')]];}else{delete agents[_0x34c20d['destuniqueid']];}}exports[_0x95c6('0x11')]=function(_0x2c5bc1){try{agents[_0x2c5bc1[_0x95c6('0x12')]]=_0x2c5bc1;agents[_0x2c5bc1['destuniqueid']][_0x95c6('0x13')]=utils[_0x95c6('0x14')]();agents[_0x2c5bc1[_0x95c6('0x12')]][_0x95c6('0x15')]='called';agents[_0x2c5bc1[_0x95c6('0x12')]]['connectedlinenum']=null;agents[_0x2c5bc1[_0x95c6('0x12')]][_0x95c6('0x16')]=null;}catch(_0x47a520){utils['error'](_0x47a520[_0x95c6('0x17')]);}};exports[_0x95c6('0x18')]=function(_0x2fc371){try{if(!_[_0x95c6('0x19')](agents[_0x2fc371['destuniqueid']])){agents[_0x2fc371[_0x95c6('0x12')]]['agentringnoanswer']=!![];agents[_0x2fc371[_0x95c6('0x12')]][_0x95c6('0x1a')]=utils[_0x95c6('0x14')]();agents[_0x2fc371[_0x95c6('0x12')]]['lastevent']='timeout';agents[_0x2fc371[_0x95c6('0x12')]][_0x95c6('0x1b')]=_0x95c6('0x1c');agents[_0x2fc371[_0x95c6('0x12')]][_0x95c6('0x1d')]=_0x2fc371[_0x95c6('0x1e')]?parseInt(_0x2fc371['ringtime'])/0x3e8:0x0;agents[_0x2fc371['destuniqueid']][_0x95c6('0x1f')]=0x0;unanswered['push'](_0x2fc371[_0x95c6('0x12')]);}}catch(_0x16b236){utils[_0x95c6('0x20')](_0x16b236[_0x95c6('0x17')]);}};exports[_0x95c6('0x21')]=function(_0x432e16){try{_[_0x95c6('0x22')](agents,function(_0xcc82a5,_0x32a504){if(_0xcc82a5[_0x95c6('0x3')]==_0x432e16[_0x95c6('0x3')]&&!_[_0x95c6('0x23')](unanswered,_0xcc82a5[_0x95c6('0x12')])){_0xcc82a5['agentringnoanswer']=!![];_0xcc82a5[_0x95c6('0x1a')]=utils[_0x95c6('0x14')]();_0xcc82a5['lastevent']=_0x95c6('0x24');_0xcc82a5['reason']='abandoned';_0xcc82a5['holdtime']=_0x432e16[_0x95c6('0x1d')];_0xcc82a5[_0x95c6('0x1f')]=0x0;writeDB(_0xcc82a5);}});}catch(_0x52944e){utils['error'](_0x52944e[_0x95c6('0x17')]);}};exports[_0x95c6('0x25')]=function(_0x312946){try{if(agents[_0x312946['destuniqueid']]){agents[_0x312946[_0x95c6('0x12')]][_0x95c6('0x26')]=utils['now']();agents[_0x312946[_0x95c6('0x12')]][_0x95c6('0x27')]=_0x312946[_0x95c6('0x27')];agents[_0x312946[_0x95c6('0x12')]]['connectedlinename']=_0x312946['connectedlinename'];agents[_0x312946[_0x95c6('0x12')]]['holdtime']=_0x312946['ringtime'];agents[_0x312946[_0x95c6('0x12')]][_0x95c6('0x15')]=_0x95c6('0x28');_[_0x95c6('0x22')](agents,function(_0x43bbab,_0x321d96){if(_0x43bbab['destuniqueid']!=_0x312946['destuniqueid']&&_0x43bbab[_0x95c6('0x3')]==_0x312946[_0x95c6('0x3')]){_0x43bbab[_0x95c6('0x1f')]=0x0;_0x43bbab[_0x95c6('0x1d')]=_0x312946[_0x95c6('0x1e')];_0x43bbab['agentringnoanswer']=!![];_0x43bbab['agentringnoanswerAt']=utils[_0x95c6('0x14')]();_0x43bbab[_0x95c6('0x15')]=_0x95c6('0x29');_0x43bbab[_0x95c6('0x1b')]=_0x95c6('0x29');_0x43bbab['answeredelsewheredestinationuniqueid']=_0x312946[_0x95c6('0x12')];_0x43bbab[_0x95c6('0x2a')]=_0x312946[_0x95c6('0x6')];writeDB(_0x43bbab);}});}}catch(_0x131a99){utils[_0x95c6('0x20')](_0x131a99[_0x95c6('0x17')]);}};exports[_0x95c6('0xb')]=function(_0x734018){try{if(!_[_0x95c6('0x19')](agents[_0x734018[_0x95c6('0x12')]])){agents[_0x734018[_0x95c6('0x12')]][_0x95c6('0xb')]=!![];agents[_0x734018[_0x95c6('0x12')]]['agentcompleteAt']=utils[_0x95c6('0x14')]();agents[_0x734018[_0x95c6('0x12')]][_0x95c6('0x1f')]=utils[_0x95c6('0x2b')](agents[_0x734018[_0x95c6('0x12')]]['agentcompleteAt'],agents[_0x734018['destuniqueid']][_0x95c6('0x26')]);agents[_0x734018[_0x95c6('0x12')]][_0x95c6('0x1b')]=_0x734018[_0x95c6('0x1b')];agents[_0x734018[_0x95c6('0x12')]]['lastevent']=_0x95c6('0x2c');writeDB(agents[_0x734018[_0x95c6('0x12')]]);}}catch(_0x49e5fe){utils[_0x95c6('0x20')](_0x49e5fe[_0x95c6('0x17')]);}};exports['blindtransfer']=function(_0x829eb0){try{if(!_['isNil'](agents[_0x829eb0[_0x95c6('0x2d')]])){agents[_0x829eb0[_0x95c6('0x2d')]]['transfer']=!![];agents[_0x829eb0[_0x95c6('0x2d')]][_0x95c6('0x2e')]=_0x95c6('0x2f');agents[_0x829eb0[_0x95c6('0x2d')]][_0x95c6('0x30')]=_0x829eb0[_0x95c6('0x31')];agents[_0x829eb0['transfereruniqueid']]['transferuniqueid']=agents[_0x829eb0[_0x95c6('0x2d')]]['uniqueid'];}}catch(_0x2e2f21){utils['error'](_0x2e2f21[_0x95c6('0x17')]);}};exports[_0x95c6('0x32')]=function(_0x38c3f2){try{if(_0x38c3f2[_0x95c6('0x33')]==_0x38c3f2[_0x95c6('0x34')]){if(!_[_0x95c6('0x19')](agents[_0x38c3f2[_0x95c6('0x35')]])){agents[_0x38c3f2['secondtransfereruniqueid']][_0x95c6('0x36')]=!![];agents[_0x38c3f2[_0x95c6('0x35')]][_0x95c6('0x2e')]=_0x95c6('0x37');agents[_0x38c3f2[_0x95c6('0x35')]][_0x95c6('0x30')]=_0x38c3f2[_0x95c6('0x38')];agents[_0x38c3f2['secondtransfereruniqueid']][_0x95c6('0x39')]=_0x38c3f2[_0x95c6('0x33')];}if(_0x38c3f2[_0x95c6('0x3a')]&&agents[_0x38c3f2[_0x95c6('0x3a')]]){agents[_0x38c3f2[_0x95c6('0x3a')]]['agententerreason']=0x1;transfers[_0x38c3f2[_0x95c6('0x3a')]]=_[_0x95c6('0x3b')](agents[_0x38c3f2['transfereeuniqueid']]);transfers[_0x38c3f2[_0x95c6('0x3a')]]['calleridnum']=agents[_0x38c3f2[_0x95c6('0x35')]][_0x95c6('0x3c')];transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x3d')]=agents[_0x38c3f2['secondtransfereruniqueid']][_0x95c6('0x3d')];transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x13')]=utils[_0x95c6('0x14')]();transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x26')]=utils[_0x95c6('0x14')]();transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x1d')]=0x0;transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x3e')]=0x2;}}else if(_0x38c3f2[_0x95c6('0x35')]==_0x38c3f2[_0x95c6('0x3f')]){if(!_['isNil'](agents[_0x38c3f2[_0x95c6('0x33')]])){agents[_0x38c3f2[_0x95c6('0x33')]][_0x95c6('0x36')]=!![];agents[_0x38c3f2['origtransfereruniqueid']][_0x95c6('0x2e')]=_0x95c6('0x37');agents[_0x38c3f2['origtransfereruniqueid']][_0x95c6('0x30')]=_0x38c3f2[_0x95c6('0x40')];agents[_0x38c3f2['origtransfereruniqueid']][_0x95c6('0x39')]=_0x38c3f2[_0x95c6('0x35')];}if(_0x38c3f2[_0x95c6('0x41')]&&agents[_0x38c3f2[_0x95c6('0x41')]]){agents[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x3e')]=0x1;transfers[_0x38c3f2[_0x95c6('0x41')]]=_['clone'](agents[_0x38c3f2[_0x95c6('0x41')]]);transfers[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x3c')]=agents[_0x38c3f2[_0x95c6('0x33')]][_0x95c6('0x3c')];transfers[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x3d')]=agents[_0x38c3f2[_0x95c6('0x33')]][_0x95c6('0x3d')];transfers[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x13')]=utils['now']();transfers[_0x38c3f2[_0x95c6('0x41')]]['agentconnectAt']=utils[_0x95c6('0x14')]();transfers[_0x38c3f2['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x3e')]=0x2;}}}catch(_0x93bde7){utils['error'](_0x93bde7['stack']);}};exports[_0x95c6('0x42')]=function(_0x2123be){try{if(agents[_0x2123be[_0x95c6('0x3')]]&&agents[_0x2123be[_0x95c6('0x3')]]['reason']===_0x95c6('0x1c')){if(_0x2123be[_0x95c6('0x43')]==='21'){agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x1b')]=_0x95c6('0x44');agents[_0x2123be['uniqueid']]['lastevent']=_0x95c6('0x44');}writeDB(agents[_0x2123be[_0x95c6('0x3')]]);var _0x6c23e5=unanswered[_0x95c6('0x45')](_0x2123be[_0x95c6('0x3')]);if(_0x6c23e5>-0x1)unanswered[_0x95c6('0x46')](_0x6c23e5,0x1);}if(transfers[_0x2123be[_0x95c6('0x3')]]){transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0xb')]=!![];transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x47')]=utils['now']();transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x1f')]=utils[_0x95c6('0x2b')](transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x47')],transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x26')]);transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x1b')]=_0x95c6('0x48');transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x15')]=_0x95c6('0x2c');writeDB(transfers[_0x2123be[_0x95c6('0x3')]],!![]);}if(agents[_0x2123be[_0x95c6('0x3')]]&&agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x26')]){agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0xb')]=!![];agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x47')]=utils[_0x95c6('0x14')]();agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x1f')]=utils[_0x95c6('0x2b')](agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x47')],agents[_0x2123be[_0x95c6('0x3')]]['agentconnectAt']);agents[_0x2123be['uniqueid']]['reason']=agents[_0x2123be['uniqueid']][_0x95c6('0x36')]?'transfer':_0x95c6('0x48');agents[_0x2123be['uniqueid']][_0x95c6('0x15')]=_0x95c6('0x2c');writeDB(agents[_0x2123be[_0x95c6('0x3')]]);}}catch(_0xa35a10){utils['error'](_0xa35a10[_0x95c6('0x17')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 27322e4..1519026 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 _0x36ca=['newchannel','uniqueid','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION','error','newstate','isNil','channelstate','systemanswertime','destinationchannel','answertime','hangup','calleridname','diffTime','endtime','starttime','stack','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','variable','xmd-originatecalleridnum','source','value','xmd-phone','\x22\x20<','xmcs-queue','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','sipcallid','set','startsWith','toLowerCase','cdr','appdata','split','substring','lastIndexOf','includes','execif','gotoif','application','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','channel','accountcode','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport'];(function(_0x568d35,_0x5fe4b8){var _0x3bcdd0=function(_0x390d09){while(--_0x390d09){_0x568d35['push'](_0x568d35['shift']());}};_0x3bcdd0(++_0x5fe4b8);}(_0x36ca,0x8a));var _0xa36c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x36ca[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xa36c('0x0'));var util=require(_0xa36c('0x1'));var utils=require(_0xa36c('0x2'));var dispositions=[_0xa36c('0x3'),'FAILED','FAILED',_0xa36c('0x3'),_0xa36c('0x3'),_0xa36c('0x3'),_0xa36c('0x4'),_0xa36c('0x5'),'FAILED',_0xa36c('0x6'),_0xa36c('0x6')];var channels={};function writeDB(_0x382dda){utils[_0xa36c('0x7')](util['format']('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x382dda['uniqueid'],_0x382dda[_0xa36c('0x8')],_0x382dda['type'],_0x382dda[_0xa36c('0x9')],_0x382dda['source'],_0x382dda[_0xa36c('0xa')],_0x382dda[_0xa36c('0xb')],_0x382dda[_0xa36c('0xc')]));if(_0x382dda['accountcode']){utils[_0xa36c('0xd')](_0x382dda[_0xa36c('0x9')])[_0xa36c('0xe')](function(_0x63f64f){if(_0x63f64f){_0x382dda[_0xa36c('0xf')]=_0x63f64f['id'];}utils[_0xa36c('0x10')]('CreateVoiceCallReport',_0x382dda);});}else{utils['request'](_0xa36c('0x11'),_0x382dda);}if(channels[_0x382dda['uniqueid']]){delete channels[_0x382dda['uniqueid']];}}exports[_0xa36c('0x12')]=function(_0x268c9b){try{if(_0x268c9b[_0xa36c('0x13')]==_0x268c9b[_0xa36c('0x14')]&&_0x268c9b[_0xa36c('0x8')]!=_0xa36c('0x15')){channels[_0x268c9b['uniqueid']]={'uniqueid':_0x268c9b['uniqueid'],'accountcode':_0x268c9b['accountcode'],'source':_0x268c9b[_0xa36c('0x16')],'destination':_0x268c9b[_0xa36c('0x17')],'destinationcontext':_0x268c9b[_0xa36c('0x18')],'channel':_0x268c9b[_0xa36c('0x8')],'starttime':utils[_0xa36c('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xa36c('0x1a')};}}catch(_0x4b6bfa){utils[_0xa36c('0x1b')](_0x4b6bfa['stack']);}};exports[_0xa36c('0x1c')]=function(_0x2b4180){try{if(!_[_0xa36c('0x1d')](channels[_0x2b4180[_0xa36c('0x13')]])&&_0x2b4180[_0xa36c('0x1e')]==0x6){if(_[_0xa36c('0x1d')](channels[_0x2b4180['uniqueid']][_0xa36c('0x1f')])){channels[_0x2b4180[_0xa36c('0x13')]][_0xa36c('0x1f')]=utils['now']();}}else if(!_[_0xa36c('0x1d')](channels[_0x2b4180[_0xa36c('0x14')]])&&_0x2b4180['channelstate']==0x6&&_0x2b4180[_0xa36c('0x18')]!='transfer'){channels[_0x2b4180[_0xa36c('0x14')]][_0xa36c('0x9')]=_0x2b4180['accountcode'];channels[_0x2b4180['linkedid']][_0xa36c('0x20')]=_0x2b4180[_0xa36c('0x8')];if(_['isNil'](channels[_0x2b4180['linkedid']][_0xa36c('0x21')])){channels[_0x2b4180['linkedid']][_0xa36c('0x21')]=utils['now']();}channels[_0x2b4180[_0xa36c('0x14')]][_0xa36c('0xc')]=dispositions[_['toNumber'](_0x2b4180[_0xa36c('0x1e')])]||_0xa36c('0x4');}}catch(_0x1fb47c){utils[_0xa36c('0x1b')](_0x1fb47c['stack']);}};exports[_0xa36c('0x22')]=function(_0x4c6ae8){try{if(!_[_0xa36c('0x1d')](channels[_0x4c6ae8[_0xa36c('0x13')]])){if(_['isNil'](channels[_0x4c6ae8['uniqueid']][_0xa36c('0xb')])){channels[_0x4c6ae8[_0xa36c('0x13')]][_0xa36c('0xb')]=_0x4c6ae8[_0xa36c('0x23')]+'\x20<'+_0x4c6ae8[_0xa36c('0x16')]+'>';}channels[_0x4c6ae8[_0xa36c('0x13')]]['endtime']=utils[_0xa36c('0x19')]();channels[_0x4c6ae8[_0xa36c('0x13')]]['duration']=utils[_0xa36c('0x24')](channels[_0x4c6ae8['uniqueid']][_0xa36c('0x25')],channels[_0x4c6ae8[_0xa36c('0x13')]][_0xa36c('0x26')]);channels[_0x4c6ae8[_0xa36c('0x13')]]['billableseconds']=channels[_0x4c6ae8[_0xa36c('0x13')]][_0xa36c('0x21')]?utils['diffTime'](channels[_0x4c6ae8['uniqueid']][_0xa36c('0x25')],channels[_0x4c6ae8[_0xa36c('0x13')]]['answertime']):0x0;writeDB(channels[_0x4c6ae8['uniqueid']]);}}catch(_0x33aaeb){utils[_0xa36c('0x1b')](_0x33aaeb[_0xa36c('0x27')]);}};exports['attendedtransfer']=function(_0x4b8607){try{if(!_[_0xa36c('0x1d')](channels[_0x4b8607[_0xa36c('0x28')]])){if(channels[_0x4b8607['localtwolinkedid']][_0xa36c('0x8')]==_0x4b8607[_0xa36c('0x29')]){channels[_0x4b8607[_0xa36c('0x28')]][_0xa36c('0x20')]=_0x4b8607[_0xa36c('0x2a')];channels[_0x4b8607[_0xa36c('0x28')]][_0xa36c('0x2b')]='_attended';}else if(channels[_0x4b8607[_0xa36c('0x28')]][_0xa36c('0x8')]=_0x4b8607[_0xa36c('0x2c')]){channels[_0x4b8607['localtwolinkedid']][_0xa36c('0x20')]=_0x4b8607[_0xa36c('0x2d')];channels[_0x4b8607[_0xa36c('0x28')]][_0xa36c('0x2b')]=_0xa36c('0x2e');}}}catch(_0x7d7765){utils['error'](_0x7d7765[_0xa36c('0x27')]);}};exports[_0xa36c('0x2f')]=function(_0x24f55b){try{if(!_[_0xa36c('0x1d')](channels[_0x24f55b[_0xa36c('0x13')]])){channels[_0x24f55b[_0xa36c('0x13')]][_0xa36c('0x30')]=utils[_0xa36c('0x19')]();}}catch(_0x1dc4b5){utils[_0xa36c('0x1b')](_0x1dc4b5['stack']);}};exports[_0xa36c('0x31')]=function(_0x2cd600){try{if(!_[_0xa36c('0x1d')](channels[_0x2cd600[_0xa36c('0x13')]])){if(!_[_0xa36c('0x1d')](channels[_0x2cd600[_0xa36c('0x13')]]['musiconholdstartAt'])){channels[_0x2cd600[_0xa36c('0x13')]]['mohtime']+=utils[_0xa36c('0x24')](utils[_0xa36c('0x19')](),channels[_0x2cd600[_0xa36c('0x13')]][_0xa36c('0x30')]);delete channels[_0x2cd600[_0xa36c('0x13')]][_0xa36c('0x30')];}}}catch(_0xd21d1a){utils['error'](_0xd21d1a['stack']);}};exports['varset']=function(_0x4c4b6e){try{if(!_[_0xa36c('0x1d')](channels[_0x4c4b6e[_0xa36c('0x13')]])){if(!_['isNil'](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x33')])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x34')]=_0x4c4b6e[_0xa36c('0x35')];}if(!_['isNil'](_0x4c4b6e['variable'][_0xa36c('0x36')])){channels[_0x4c4b6e['uniqueid']][_0xa36c('0xa')]=_0x4c4b6e[_0xa36c('0x35')];channels[_0x4c4b6e[_0xa36c('0x13')]]['callerid']='\x22'+_0x4c4b6e[_0xa36c('0x35')]+_0xa36c('0x37')+_0x4c4b6e['value']+'>';}if(!_[_0xa36c('0x1d')](_0x4c4b6e[_0xa36c('0x32')]['xmd-callerid-preview'])||!_['isNil'](_0x4c4b6e[_0xa36c('0x32')]['xmd-callerid'])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0xb')]=_0x4c4b6e[_0xa36c('0x35')];}if(!_['isNil'](_0x4c4b6e['variable']['xmd-queue'])||!_['isNil'](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x38')])){channels[_0x4c4b6e['uniqueid']]['lastapplication']=_0xa36c('0x39');channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x3a')]=_0x4c4b6e[_0xa36c('0x35')];channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x3b')]=!![];}if(!_[_0xa36c('0x1d')](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x3c')])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x3d')]=_0x4c4b6e['value'];}if(!_[_0xa36c('0x1d')](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x3e')])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x3f')]=_0x4c4b6e[_0xa36c('0x35')];}if(!_[_0xa36c('0x1d')](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x40')])){channels[_0x4c4b6e[_0xa36c('0x13')]]['routeid']=_0x4c4b6e[_0xa36c('0x35')];}if(!_['isNil'](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x41')])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x41')]=_0x4c4b6e['value'];}}}catch(_0x2f8399){utils[_0xa36c('0x1b')](_0x2f8399['stack']);}};exports['newexten']=function(_0x3742e4){try{if(!_[_0xa36c('0x1d')](channels[_0x3742e4['uniqueid']])){if(_0x3742e4['application']['toLowerCase']()==_0xa36c('0x42')&&_[_0xa36c('0x43')](_0x3742e4['appdata'][_0xa36c('0x44')](),_0xa36c('0x45'))){var _0x2051eb=_0x3742e4[_0xa36c('0x46')][_0xa36c('0x47')]('=');var _0x16cbea=_0x2051eb[0x0][_0xa36c('0x48')](_0x2051eb[0x0][_0xa36c('0x49')]('(')+0x1,_0x2051eb[0x0][_0xa36c('0x49')](')'));var _0x8a3665=_0x2051eb[0x1];channels[_0x3742e4[_0xa36c('0x13')]][_0x16cbea]=_0x8a3665;}if(!_[_0xa36c('0x4a')]([_0xa36c('0x22'),'noop',_0xa36c('0x4b'),_0xa36c('0x42'),_0xa36c('0x4c')],_0x3742e4['application'][_0xa36c('0x44')]())){channels[_0x3742e4[_0xa36c('0x13')]]['lastapplication']=_0x3742e4[_0xa36c('0x4d')];channels[_0x3742e4[_0xa36c('0x13')]][_0xa36c('0x3a')]=_0x3742e4[_0xa36c('0x46')];}}}catch(_0x5e8b42){utils['error'](_0x5e8b42[_0xa36c('0x27')]);}}; \ No newline at end of file +var _0x8651=['xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','toLowerCase','set','startsWith','appdata','split','lastIndexOf','includes','hangup','noop','execif','application','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','destination','callerid','getUserByInternal','then','UserId','CreateVoiceCallReport','linkedid','calleridnum','context','now','DOCUMENTATION','stack','channelstate','isNil','systemanswertime','transfer','destinationchannel','answertime','disposition','error','calleridname','endtime','duration','billableseconds','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','variable','source','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue'];(function(_0x389121,_0x427e8e){var _0xad4d5c=function(_0x10a83f){while(--_0x10a83f){_0x389121['push'](_0x389121['shift']());}};_0xad4d5c(++_0x427e8e);}(_0x8651,0x14a));var _0x1865=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8651[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x1865('0x0'));var utils=require(_0x1865('0x1'));var dispositions=[_0x1865('0x2'),_0x1865('0x3'),_0x1865('0x3'),_0x1865('0x2'),'NO\x20ANSWER',_0x1865('0x2'),_0x1865('0x4'),_0x1865('0x5'),_0x1865('0x3'),'FAILED',_0x1865('0x3')];var channels={};function writeDB(_0x41dc5d){utils[_0x1865('0x6')](util[_0x1865('0x7')](_0x1865('0x8'),_0x41dc5d[_0x1865('0x9')],_0x41dc5d[_0x1865('0xa')],_0x41dc5d[_0x1865('0xb')],_0x41dc5d[_0x1865('0xc')],_0x41dc5d['source'],_0x41dc5d[_0x1865('0xd')],_0x41dc5d[_0x1865('0xe')],_0x41dc5d['disposition']));if(_0x41dc5d[_0x1865('0xc')]){utils[_0x1865('0xf')](_0x41dc5d[_0x1865('0xc')])[_0x1865('0x10')](function(_0x17ef05){if(_0x17ef05){_0x41dc5d[_0x1865('0x11')]=_0x17ef05['id'];}utils['request'](_0x1865('0x12'),_0x41dc5d);});}else{utils['request'](_0x1865('0x12'),_0x41dc5d);}if(channels[_0x41dc5d['uniqueid']]){delete channels[_0x41dc5d[_0x1865('0x9')]];}}exports['newchannel']=function(_0x2d9429){try{if(_0x2d9429['uniqueid']==_0x2d9429[_0x1865('0x13')]&&_0x2d9429['channel']!='OutgoingSpoolFailed'){channels[_0x2d9429[_0x1865('0x9')]]={'uniqueid':_0x2d9429[_0x1865('0x9')],'accountcode':_0x2d9429[_0x1865('0xc')],'source':_0x2d9429[_0x1865('0x14')],'destination':_0x2d9429['exten'],'destinationcontext':_0x2d9429[_0x1865('0x15')],'channel':_0x2d9429[_0x1865('0xa')],'starttime':utils[_0x1865('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x1865('0x17')};}}catch(_0x12aa3f){utils['error'](_0x12aa3f[_0x1865('0x18')]);}};exports['newstate']=function(_0x191c2d){try{if(!_['isNil'](channels[_0x191c2d[_0x1865('0x9')]])&&_0x191c2d[_0x1865('0x19')]==0x6){if(_[_0x1865('0x1a')](channels[_0x191c2d[_0x1865('0x9')]][_0x1865('0x1b')])){channels[_0x191c2d[_0x1865('0x9')]][_0x1865('0x1b')]=utils[_0x1865('0x16')]();}}else if(!_['isNil'](channels[_0x191c2d['linkedid']])&&_0x191c2d[_0x1865('0x19')]==0x6&&_0x191c2d[_0x1865('0x15')]!=_0x1865('0x1c')){channels[_0x191c2d[_0x1865('0x13')]][_0x1865('0xc')]=_0x191c2d[_0x1865('0xc')];channels[_0x191c2d[_0x1865('0x13')]][_0x1865('0x1d')]=_0x191c2d[_0x1865('0xa')];if(_[_0x1865('0x1a')](channels[_0x191c2d['linkedid']][_0x1865('0x1e')])){channels[_0x191c2d[_0x1865('0x13')]][_0x1865('0x1e')]=utils[_0x1865('0x16')]();}channels[_0x191c2d['linkedid']][_0x1865('0x1f')]=dispositions[_['toNumber'](_0x191c2d[_0x1865('0x19')])]||_0x1865('0x4');}}catch(_0x24f899){utils[_0x1865('0x20')](_0x24f899[_0x1865('0x18')]);}};exports['hangup']=function(_0x482c7c){try{if(!_[_0x1865('0x1a')](channels[_0x482c7c[_0x1865('0x9')]])){if(_[_0x1865('0x1a')](channels[_0x482c7c['uniqueid']][_0x1865('0xe')])){channels[_0x482c7c[_0x1865('0x9')]]['callerid']=_0x482c7c[_0x1865('0x21')]+'\x20<'+_0x482c7c[_0x1865('0x14')]+'>';}channels[_0x482c7c['uniqueid']][_0x1865('0x22')]=utils[_0x1865('0x16')]();channels[_0x482c7c[_0x1865('0x9')]][_0x1865('0x23')]=utils['diffTime'](channels[_0x482c7c[_0x1865('0x9')]]['endtime'],channels[_0x482c7c['uniqueid']]['starttime']);channels[_0x482c7c[_0x1865('0x9')]][_0x1865('0x24')]=channels[_0x482c7c[_0x1865('0x9')]]['answertime']?utils[_0x1865('0x25')](channels[_0x482c7c['uniqueid']][_0x1865('0x22')],channels[_0x482c7c['uniqueid']]['answertime']):0x0;writeDB(channels[_0x482c7c['uniqueid']]);}}catch(_0xbe0ea5){utils['error'](_0xbe0ea5[_0x1865('0x18')]);}};exports[_0x1865('0x26')]=function(_0x3d4e0f){try{if(!_[_0x1865('0x1a')](channels[_0x3d4e0f['localtwolinkedid']])){if(channels[_0x3d4e0f[_0x1865('0x27')]][_0x1865('0xa')]==_0x3d4e0f[_0x1865('0x28')]){channels[_0x3d4e0f[_0x1865('0x27')]][_0x1865('0x1d')]=_0x3d4e0f['secondtransfererchannel'];channels[_0x3d4e0f[_0x1865('0x27')]][_0x1865('0x29')]=_0x1865('0x2a');}else if(channels[_0x3d4e0f[_0x1865('0x27')]]['channel']=_0x3d4e0f[_0x1865('0x2b')]){channels[_0x3d4e0f[_0x1865('0x27')]]['destinationchannel']=_0x3d4e0f[_0x1865('0x2c')];channels[_0x3d4e0f[_0x1865('0x27')]][_0x1865('0x29')]=_0x1865('0x2a');}}}catch(_0x404306){utils[_0x1865('0x20')](_0x404306[_0x1865('0x18')]);}};exports[_0x1865('0x2d')]=function(_0x1d24c0){try{if(!_[_0x1865('0x1a')](channels[_0x1d24c0[_0x1865('0x9')]])){channels[_0x1d24c0['uniqueid']][_0x1865('0x2e')]=utils[_0x1865('0x16')]();}}catch(_0x491c9b){utils['error'](_0x491c9b[_0x1865('0x18')]);}};exports[_0x1865('0x2f')]=function(_0x344d9b){try{if(!_['isNil'](channels[_0x344d9b[_0x1865('0x9')]])){if(!_[_0x1865('0x1a')](channels[_0x344d9b[_0x1865('0x9')]][_0x1865('0x2e')])){channels[_0x344d9b[_0x1865('0x9')]]['mohtime']+=utils[_0x1865('0x25')](utils[_0x1865('0x16')](),channels[_0x344d9b[_0x1865('0x9')]][_0x1865('0x2e')]);delete channels[_0x344d9b[_0x1865('0x9')]]['musiconholdstartAt'];}}}catch(_0x113ac0){utils['error'](_0x113ac0[_0x1865('0x18')]);}};exports['varset']=function(_0x493390){try{if(!_[_0x1865('0x1a')](channels[_0x493390[_0x1865('0x9')]])){if(!_['isNil'](_0x493390[_0x1865('0x30')]['xmd-originatecalleridnum'])){channels[_0x493390[_0x1865('0x9')]][_0x1865('0x31')]=_0x493390[_0x1865('0x32')];}if(!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')]['xmd-phone'])){channels[_0x493390['uniqueid']]['destination']=_0x493390['value'];channels[_0x493390[_0x1865('0x9')]][_0x1865('0xe')]='\x22'+_0x493390[_0x1865('0x32')]+_0x1865('0x33')+_0x493390[_0x1865('0x32')]+'>';}if(!_[_0x1865('0x1a')](_0x493390['variable'][_0x1865('0x34')])||!_[_0x1865('0x1a')](_0x493390['variable'][_0x1865('0x35')])){channels[_0x493390['uniqueid']]['callerid']=_0x493390[_0x1865('0x32')];}if(!_['isNil'](_0x493390[_0x1865('0x30')][_0x1865('0x36')])||!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')][_0x1865('0x37')])){channels[_0x493390[_0x1865('0x9')]][_0x1865('0x38')]=_0x1865('0x39');channels[_0x493390['uniqueid']][_0x1865('0x3a')]=_0x493390['value'];channels[_0x493390[_0x1865('0x9')]][_0x1865('0x3b')]=!![];}if(!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')][_0x1865('0x3c')])){channels[_0x493390[_0x1865('0x9')]]['ContactId']=_0x493390[_0x1865('0x32')];}if(!_['isNil'](_0x493390['variable'][_0x1865('0x3d')])){channels[_0x493390[_0x1865('0x9')]][_0x1865('0xb')]=_0x493390[_0x1865('0x32')];}if(!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')][_0x1865('0x3e')])){channels[_0x493390[_0x1865('0x9')]][_0x1865('0x3f')]=_0x493390['value'];}if(!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')][_0x1865('0x40')])){channels[_0x493390[_0x1865('0x9')]]['sipcallid']=_0x493390[_0x1865('0x32')];}}}catch(_0x2653d1){utils[_0x1865('0x20')](_0x2653d1[_0x1865('0x18')]);}};exports[_0x1865('0x41')]=function(_0x4b84cd){try{if(!_['isNil'](channels[_0x4b84cd[_0x1865('0x9')]])){if(_0x4b84cd['application'][_0x1865('0x42')]()==_0x1865('0x43')&&_[_0x1865('0x44')](_0x4b84cd[_0x1865('0x45')][_0x1865('0x42')](),'cdr')){var _0x4ace93=_0x4b84cd[_0x1865('0x45')][_0x1865('0x46')]('=');var _0x464f61=_0x4ace93[0x0]['substring'](_0x4ace93[0x0][_0x1865('0x47')]('(')+0x1,_0x4ace93[0x0]['lastIndexOf'](')'));var _0x31e092=_0x4ace93[0x1];channels[_0x4b84cd['uniqueid']][_0x464f61]=_0x31e092;}if(!_[_0x1865('0x48')]([_0x1865('0x49'),_0x1865('0x4a'),_0x1865('0x4b'),'set','gotoif'],_0x4b84cd[_0x1865('0x4c')]['toLowerCase']())){channels[_0x4b84cd[_0x1865('0x9')]][_0x1865('0x38')]=_0x4b84cd[_0x1865('0x4c')];channels[_0x4b84cd[_0x1865('0x9')]][_0x1865('0x3a')]=_0x4b84cd[_0x1865('0x45')];}}}catch(_0x586eac){utils[_0x1865('0x20')](_0x586eac[_0x1865('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 53725c9..f94f784 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 _0x187d=['error','close','CLOSE','managerevent','./utils','connect','info','CONNECTED','shutdown','SHUTDOWN','FULLYBOOTED'];(function(_0x506de3,_0x209251){var _0x2e254a=function(_0x1b096e){while(--_0x1b096e){_0x506de3['push'](_0x506de3['shift']());}};_0x2e254a(++_0x209251);}(_0x187d,0x93));var _0xd187=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x187d[_0xae7c2f];return _0x5d7001;};'use strict';var utils=require(_0xd187('0x0'));var _=require('lodash');exports[_0xd187('0x1')]=function(){utils[_0xd187('0x2')](_0xd187('0x3'));};exports[_0xd187('0x4')]=function(){utils[_0xd187('0x2')](_0xd187('0x5'));};exports['fullybooted']=function(){utils[_0xd187('0x2')](_0xd187('0x6'));};exports['error']=function(_0x1d2533){utils[_0xd187('0x7')](_0x1d2533);};exports[_0xd187('0x8')]=function(){utils[_0xd187('0x2')](_0xd187('0x9'));};exports[_0xd187('0xa')]=function(_0x358c45){}; \ No newline at end of file +var _0x723e=['FULLYBOOTED','error','close','CLOSE','managerevent','lodash','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted'];(function(_0x6de811,_0x389a4c){var _0x26d735=function(_0x4a4e96){while(--_0x4a4e96){_0x6de811['push'](_0x6de811['shift']());}};_0x26d735(++_0x389a4c);}(_0x723e,0x179));var _0xe723=function(_0x2d9b4f,_0x597016){_0x2d9b4f=_0x2d9b4f-0x0;var _0x6c1c59=_0x723e[_0x2d9b4f];return _0x6c1c59;};'use strict';var utils=require('./utils');var _=require(_0xe723('0x0'));exports[_0xe723('0x1')]=function(){utils[_0xe723('0x2')](_0xe723('0x3'));};exports[_0xe723('0x4')]=function(){utils[_0xe723('0x2')](_0xe723('0x5'));};exports[_0xe723('0x6')]=function(){utils[_0xe723('0x2')](_0xe723('0x7'));};exports['error']=function(_0x32d689){utils[_0xe723('0x8')](_0x32d689);};exports[_0xe723('0x9')]=function(){utils[_0xe723('0x2')](_0xe723('0xa'));};exports[_0xe723('0xb')]=function(_0x1b46e0){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 8cd0ec6..3eba675 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 _0x6eb7=['format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','stack','dialbegin','assign','starttime','now','lastevent','called','dialend','answertime','connect','hangup','complete','duration','diffTime','endtime','util','info'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6eb7,0x1d2));var _0x76eb=function(_0x36c15d,_0x567797){_0x36c15d=_0x36c15d-0x0;var _0x4f9882=_0x6eb7[_0x36c15d];return _0x4f9882;};'use strict';var _=require('lodash');var util=require(_0x76eb('0x0'));var utils=require('./utils');var dials={};function writeDB(_0xd3fbcd){utils[_0x76eb('0x1')](util[_0x76eb('0x2')](_0x76eb('0x3'),_0xd3fbcd[_0x76eb('0x4')],_0xd3fbcd[_0x76eb('0x5')],_0xd3fbcd[_0x76eb('0x6')],_0xd3fbcd[_0x76eb('0x7')],_0xd3fbcd[_0x76eb('0x8')],_0xd3fbcd[_0x76eb('0x9')]));utils[_0x76eb('0xa')]('CreateVoiceDialReport',_0xd3fbcd);delete dials[_0xd3fbcd[_0x76eb('0x4')]];}exports[_0x76eb('0xb')]=function(_0x488f6){try{if(_0x488f6[_0x76eb('0xc')][_0x76eb('0xd')]()==_0x76eb('0xe')&&_[_0x76eb('0xf')](_0x488f6[_0x76eb('0x10')][_0x76eb('0xd')](),_0x76eb('0x11'))){var _0x285a36=_0x488f6[_0x76eb('0x10')][_0x76eb('0x12')]('=');dials[_0x488f6['uniqueid']]={'routeId':_0x285a36[0x1]};}}catch(_0x1e5b9f){utils[_0x76eb('0x13')](_0x1e5b9f['stack']);}};exports[_0x76eb('0x14')]=function(_0x350644){try{if(!_[_0x76eb('0x15')](_0x350644[_0x76eb('0x16')][_0x76eb('0x17')])){dials[_0x350644[_0x76eb('0x4')]]={'routeId':_0x350644['value']};}}catch(_0x5a435d){utils[_0x76eb('0x13')](_0x5a435d[_0x76eb('0x18')]);}};exports[_0x76eb('0x19')]=function(_0x2671b5){try{if(!_[_0x76eb('0x15')](dials[_0x2671b5[_0x76eb('0x4')]])){dials[_0x2671b5[_0x76eb('0x4')]]=_[_0x76eb('0x1a')](dials[_0x2671b5[_0x76eb('0x4')]],_0x2671b5);dials[_0x2671b5['uniqueid']][_0x76eb('0x1b')]=utils[_0x76eb('0x1c')]();dials[_0x2671b5[_0x76eb('0x4')]][_0x76eb('0x1d')]=_0x76eb('0x1e');}}catch(_0x164e07){utils[_0x76eb('0x13')](_0x164e07[_0x76eb('0x18')]);}};exports[_0x76eb('0x1f')]=function(_0x3ed9b5){try{if(!_[_0x76eb('0x15')](dials[_0x3ed9b5['uniqueid']])){dials[_0x3ed9b5['uniqueid']][_0x76eb('0x9')]=_0x3ed9b5[_0x76eb('0x9')];if(_0x3ed9b5[_0x76eb('0x9')]=='ANSWER'){dials[_0x3ed9b5[_0x76eb('0x4')]]=_['assign'](dials[_0x3ed9b5[_0x76eb('0x4')]],_0x3ed9b5);dials[_0x3ed9b5[_0x76eb('0x4')]][_0x76eb('0x20')]=utils[_0x76eb('0x1c')]();dials[_0x3ed9b5[_0x76eb('0x4')]][_0x76eb('0x1d')]=_0x76eb('0x21');}}}catch(_0x2ba457){utils[_0x76eb('0x13')](_0x2ba457[_0x76eb('0x18')]);}};exports[_0x76eb('0x22')]=function(_0x3d5f9e){try{if(!_['isNil'](dials[_0x3d5f9e[_0x76eb('0x4')]])){dials[_0x3d5f9e[_0x76eb('0x4')]]=_['assign'](dials[_0x3d5f9e[_0x76eb('0x4')]],{'endtime':utils['now'](),'lastevent':_0x76eb('0x23')});dials[_0x3d5f9e['uniqueid']][_0x76eb('0x24')]=utils[_0x76eb('0x25')](dials[_0x3d5f9e[_0x76eb('0x4')]]['endtime'],dials[_0x3d5f9e[_0x76eb('0x4')]][_0x76eb('0x1b')]);dials[_0x3d5f9e[_0x76eb('0x4')]]['holdtime']=utils[_0x76eb('0x25')](dials[_0x3d5f9e['uniqueid']][_0x76eb('0x20')]||dials[_0x3d5f9e['uniqueid']]['endtime'],dials[_0x3d5f9e[_0x76eb('0x4')]][_0x76eb('0x1b')]);dials[_0x3d5f9e[_0x76eb('0x4')]]['billableseconds']=dials[_0x3d5f9e[_0x76eb('0x4')]]['answertime']?utils[_0x76eb('0x25')](dials[_0x3d5f9e[_0x76eb('0x4')]][_0x76eb('0x26')],dials[_0x3d5f9e['uniqueid']][_0x76eb('0x20')]):0x0;writeDB(dials[_0x3d5f9e[_0x76eb('0x4')]]);}}catch(_0x25432e){utils[_0x76eb('0x13')](_0x25432e[_0x76eb('0x18')]);}}; \ No newline at end of file +var _0x52f1=['toLowerCase','appdata','cdr(routeid)','split','stack','variable','outboundrouteid','value','error','now','lastevent','called','dialend','dialstatus','ANSWER','assign','answertime','connect','hangup','isNil','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','uniqueid','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','application'];(function(_0x38c77f,_0x232e53){var _0x15c5e8=function(_0x28fd36){while(--_0x28fd36){_0x38c77f['push'](_0x38c77f['shift']());}};_0x15c5e8(++_0x232e53);}(_0x52f1,0x1ed));var _0x152f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x52f1[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x152f('0x0'));var util=require(_0x152f('0x1'));var utils=require(_0x152f('0x2'));var dials={};function writeDB(_0x2c64bc){utils[_0x152f('0x3')](util[_0x152f('0x4')]('DIAL|%s|%s|%s|%s|%s|%s',_0x2c64bc[_0x152f('0x5')],_0x2c64bc['channel'],_0x2c64bc['dialstring'],_0x2c64bc[_0x152f('0x6')],_0x2c64bc[_0x152f('0x7')],_0x2c64bc['dialstatus']));utils['request'](_0x152f('0x8'),_0x2c64bc);delete dials[_0x2c64bc[_0x152f('0x5')]];}exports[_0x152f('0x9')]=function(_0x1aa8fc){try{if(_0x1aa8fc[_0x152f('0xa')][_0x152f('0xb')]()=='set'&&_['startsWith'](_0x1aa8fc[_0x152f('0xc')][_0x152f('0xb')](),_0x152f('0xd'))){var _0x60eb20=_0x1aa8fc[_0x152f('0xc')][_0x152f('0xe')]('=');dials[_0x1aa8fc[_0x152f('0x5')]]={'routeId':_0x60eb20[0x1]};}}catch(_0x2ab134){utils['error'](_0x2ab134[_0x152f('0xf')]);}};exports['varset']=function(_0x5f4c2a){try{if(!_['isNil'](_0x5f4c2a[_0x152f('0x10')][_0x152f('0x11')])){dials[_0x5f4c2a[_0x152f('0x5')]]={'routeId':_0x5f4c2a[_0x152f('0x12')]};}}catch(_0x305da8){utils[_0x152f('0x13')](_0x305da8[_0x152f('0xf')]);}};exports['dialbegin']=function(_0x32abb6){try{if(!_['isNil'](dials[_0x32abb6[_0x152f('0x5')]])){dials[_0x32abb6['uniqueid']]=_['assign'](dials[_0x32abb6[_0x152f('0x5')]],_0x32abb6);dials[_0x32abb6[_0x152f('0x5')]]['starttime']=utils[_0x152f('0x14')]();dials[_0x32abb6[_0x152f('0x5')]][_0x152f('0x15')]=_0x152f('0x16');}}catch(_0xd1e96a){utils[_0x152f('0x13')](_0xd1e96a['stack']);}};exports[_0x152f('0x17')]=function(_0x2b9979){try{if(!_['isNil'](dials[_0x2b9979[_0x152f('0x5')]])){dials[_0x2b9979['uniqueid']][_0x152f('0x18')]=_0x2b9979[_0x152f('0x18')];if(_0x2b9979['dialstatus']==_0x152f('0x19')){dials[_0x2b9979['uniqueid']]=_[_0x152f('0x1a')](dials[_0x2b9979[_0x152f('0x5')]],_0x2b9979);dials[_0x2b9979[_0x152f('0x5')]][_0x152f('0x1b')]=utils[_0x152f('0x14')]();dials[_0x2b9979[_0x152f('0x5')]][_0x152f('0x15')]=_0x152f('0x1c');}}}catch(_0x2982fb){utils[_0x152f('0x13')](_0x2982fb['stack']);}};exports[_0x152f('0x1d')]=function(_0x420680){try{if(!_[_0x152f('0x1e')](dials[_0x420680['uniqueid']])){dials[_0x420680[_0x152f('0x5')]]=_['assign'](dials[_0x420680[_0x152f('0x5')]],{'endtime':utils['now'](),'lastevent':_0x152f('0x1f')});dials[_0x420680[_0x152f('0x5')]]['duration']=utils[_0x152f('0x20')](dials[_0x420680[_0x152f('0x5')]][_0x152f('0x21')],dials[_0x420680[_0x152f('0x5')]]['starttime']);dials[_0x420680['uniqueid']][_0x152f('0x22')]=utils[_0x152f('0x20')](dials[_0x420680['uniqueid']][_0x152f('0x1b')]||dials[_0x420680[_0x152f('0x5')]]['endtime'],dials[_0x420680[_0x152f('0x5')]]['starttime']);dials[_0x420680[_0x152f('0x5')]][_0x152f('0x23')]=dials[_0x420680[_0x152f('0x5')]][_0x152f('0x1b')]?utils[_0x152f('0x20')](dials[_0x420680[_0x152f('0x5')]]['endtime'],dials[_0x420680[_0x152f('0x5')]][_0x152f('0x1b')]):0x0;writeDB(dials[_0x420680[_0x152f('0x5')]]);}}catch(_0x2e21b9){utils[_0x152f('0x13')](_0x2e21b9[_0x152f('0xf')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 4806669..fd8b4ca 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 _0xa048=['username','password','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','asterisk-manager','asterisk','port'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa048,0x19f));var _0x8a04=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa048[_0x122ef9];return _0x42fba0;};var AsteriskManager=require(_0x8a04('0x0'));var config=require('../../config/environment');var utils=require('./utils');var ami=new AsteriskManager(config[_0x8a04('0x1')][_0x8a04('0x2')],config[_0x8a04('0x1')]['ip'],config[_0x8a04('0x1')][_0x8a04('0x3')],config[_0x8a04('0x1')][_0x8a04('0x4')],!![]);ami['keepConnected']();if(config[_0x8a04('0x5')]&&config[_0x8a04('0x5')]['disabled']){utils[_0x8a04('0x6')](_0x8a04('0x7'));}else{var agents=require(_0x8a04('0x8'));var calls=require(_0x8a04('0x9'));var queues=require('./queues.controller');var recordings=require(_0x8a04('0xa'));var members=require(_0x8a04('0xb'));var dials=require('./dials.controller');var transfers=require(_0x8a04('0xc'));var core=require(_0x8a04('0xd'));ami['on'](_0x8a04('0xe'),core[_0x8a04('0xe')]);ami['on'](_0x8a04('0xf'),core[_0x8a04('0xf')]);ami['on'](_0x8a04('0x10'),core[_0x8a04('0x10')]);ami['on'](_0x8a04('0x11'),core['error']);ami['on'](_0x8a04('0x12'),core[_0x8a04('0x12')]);ami['on'](_0x8a04('0x13'),core[_0x8a04('0x13')]);ami['on'](_0x8a04('0x14'),function(_0x5d9bfe){try{members[_0x8a04('0x14')](_0x5d9bfe);}catch(_0x469c5a){utils[_0x8a04('0x11')](_0x469c5a);}});ami['on'](_0x8a04('0x15'),function(_0x5c683){try{agents['agentcalled'](_0x5c683);}catch(_0x393207){utils['error'](_0x393207);}});ami['on'](_0x8a04('0x16'),function(_0x1401f6){try{agents['agentringnoanswer'](_0x1401f6);}catch(_0x6a1054){utils[_0x8a04('0x11')](_0x6a1054);}});ami['on'](_0x8a04('0x17'),function(_0x11a5be){try{agents['agentconnect'](_0x11a5be);queues[_0x8a04('0x17')](_0x11a5be);}catch(_0x391768){utils[_0x8a04('0x11')](_0x391768);}});ami['on']('agentcomplete',function(_0x24c6d0){try{agents[_0x8a04('0x18')](_0x24c6d0);queues[_0x8a04('0x18')](_0x24c6d0);members[_0x8a04('0x18')](_0x24c6d0);}catch(_0x3322fc){utils[_0x8a04('0x11')](_0x3322fc);}});ami['on'](_0x8a04('0x19'),function(_0x2acabd){try{agents[_0x8a04('0x19')](_0x2acabd);queues[_0x8a04('0x19')](_0x2acabd);}catch(_0x1c4cde){utils['error'](_0x1c4cde);}});ami['on'](_0x8a04('0x1a'),function(_0x56b516){try{queues['queuecallerjoin'](_0x56b516);recordings[_0x8a04('0x1a')](_0x56b516);}catch(_0x294b4a){utils[_0x8a04('0x11')](_0x294b4a);}});ami['on']('queuecallerleave',function(_0x21d984){try{queues['queuecallerleave'](_0x21d984);}catch(_0xd4ed7){utils['error'](_0xd4ed7);}});ami['on']('musiconholdstart',function(_0x1f535d){try{queues[_0x8a04('0x1b')](_0x1f535d);calls[_0x8a04('0x1b')](_0x1f535d);}catch(_0x3577b2){utils[_0x8a04('0x11')](_0x3577b2);}});ami['on'](_0x8a04('0x1c'),function(_0x4f0c9c){try{queues[_0x8a04('0x1c')](_0x4f0c9c);calls[_0x8a04('0x1c')](_0x4f0c9c);}catch(_0x5d2970){utils['error'](_0x5d2970);}});ami['on'](_0x8a04('0x1d'),function(_0x27cefd){try{calls[_0x8a04('0x1d')](_0x27cefd);recordings[_0x8a04('0x1d')](_0x27cefd);}catch(_0x4b851d){utils['error'](_0x4b851d);}});ami['on'](_0x8a04('0x1e'),function(_0x43f57f){try{calls[_0x8a04('0x1e')](_0x43f57f);recordings[_0x8a04('0x1e')](_0x43f57f);dials[_0x8a04('0x1e')](_0x43f57f);agents[_0x8a04('0x1e')](_0x43f57f);queues[_0x8a04('0x1e')](_0x43f57f);}catch(_0x1a8c3c){utils['error'](_0x1a8c3c);}});ami['on']('cdr',function(_0x5e0947){try{members[_0x8a04('0x1f')](_0x5e0947);}catch(_0x4e6c66){utils[_0x8a04('0x11')](_0x4e6c66);}});ami['on'](_0x8a04('0x20'),function(_0x59ce11){try{queues['blindtransfer'](_0x59ce11);agents['blindtransfer'](_0x59ce11);transfers['blindtransfer'](_0x59ce11);}catch(_0x343253){utils[_0x8a04('0x11')](_0x343253);}});ami['on']('attendedtransfer',function(_0x4c0f04){try{queues[_0x8a04('0x21')](_0x4c0f04);transfers[_0x8a04('0x21')](_0x4c0f04);agents[_0x8a04('0x21')](_0x4c0f04);calls[_0x8a04('0x21')](_0x4c0f04);}catch(_0x2d211c){utils['error'](_0x2d211c);}});ami['on']('varset',function(_0x202151){try{queues[_0x8a04('0x22')](_0x202151);recordings['varset'](_0x202151);calls['varset'](_0x202151);dials[_0x8a04('0x22')](_0x202151);}catch(_0x419a9d){utils[_0x8a04('0x11')](_0x419a9d);}});ami['on'](_0x8a04('0x23'),function(_0x7af917){try{calls[_0x8a04('0x23')](_0x7af917);recordings[_0x8a04('0x23')](_0x7af917);dials['newexten'](_0x7af917);}catch(_0x523623){utils[_0x8a04('0x11')](_0x523623);}});ami['on'](_0x8a04('0x24'),function(_0x5510cc){try{calls[_0x8a04('0x24')](_0x5510cc);recordings['newchannel'](_0x5510cc);}catch(_0x9fabbc){utils[_0x8a04('0x11')](_0x9fabbc);}});ami['on'](_0x8a04('0x25'),function(_0x947404){try{dials[_0x8a04('0x25')](_0x947404);}catch(_0x427828){utils[_0x8a04('0x11')](_0x427828);}});ami['on']('dialend',function(_0x3ab128){try{dials['dialend'](_0x3ab128);}catch(_0x4091ed){utils[_0x8a04('0x11')](_0x4091ed);}});} \ No newline at end of file +var _0x4f6a=['queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','asterisk','port','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','error','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon'];(function(_0x21c5bf,_0x305328){var _0x1f66cf=function(_0x26081a){while(--_0x26081a){_0x21c5bf['push'](_0x21c5bf['shift']());}};_0x1f66cf(++_0x305328);}(_0x4f6a,0xda));var _0xa4f6=function(_0x3cca3e,_0x950fc5){_0x3cca3e=_0x3cca3e-0x0;var _0x382338=_0x4f6a[_0x3cca3e];return _0x382338;};var AsteriskManager=require(_0xa4f6('0x0'));var config=require(_0xa4f6('0x1'));var utils=require('./utils');var ami=new AsteriskManager(config[_0xa4f6('0x2')][_0xa4f6('0x3')],config['asterisk']['ip'],config[_0xa4f6('0x2')][_0xa4f6('0x4')],config['asterisk'][_0xa4f6('0x5')],!![]);ami[_0xa4f6('0x6')]();if(config[_0xa4f6('0x7')]&&config['xdr']['disabled']){utils[_0xa4f6('0x8')](_0xa4f6('0x9'));}else{var agents=require(_0xa4f6('0xa'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0xa4f6('0xb'));var members=require(_0xa4f6('0xc'));var dials=require(_0xa4f6('0xd'));var transfers=require(_0xa4f6('0xe'));var core=require(_0xa4f6('0xf'));ami['on'](_0xa4f6('0x10'),core[_0xa4f6('0x10')]);ami['on'](_0xa4f6('0x11'),core[_0xa4f6('0x11')]);ami['on'](_0xa4f6('0x12'),core[_0xa4f6('0x12')]);ami['on']('error',core['error']);ami['on'](_0xa4f6('0x13'),core['close']);ami['on']('managerevent',core[_0xa4f6('0x14')]);ami['on'](_0xa4f6('0x15'),function(_0x4c9a85){try{members[_0xa4f6('0x15')](_0x4c9a85);}catch(_0x21dc31){utils[_0xa4f6('0x16')](_0x21dc31);}});ami['on']('agentcalled',function(_0x5c282a){try{agents[_0xa4f6('0x17')](_0x5c282a);}catch(_0x4cfa50){utils['error'](_0x4cfa50);}});ami['on'](_0xa4f6('0x18'),function(_0x11911a){try{agents[_0xa4f6('0x18')](_0x11911a);}catch(_0x324ec1){utils['error'](_0x324ec1);}});ami['on'](_0xa4f6('0x19'),function(_0x3fb8ac){try{agents[_0xa4f6('0x19')](_0x3fb8ac);queues['agentconnect'](_0x3fb8ac);}catch(_0x2143f3){utils[_0xa4f6('0x16')](_0x2143f3);}});ami['on'](_0xa4f6('0x1a'),function(_0x261b10){try{agents[_0xa4f6('0x1a')](_0x261b10);queues[_0xa4f6('0x1a')](_0x261b10);members[_0xa4f6('0x1a')](_0x261b10);}catch(_0x58b366){utils['error'](_0x58b366);}});ami['on']('queuecallerabandon',function(_0x460ffd){try{agents[_0xa4f6('0x1b')](_0x460ffd);queues['queuecallerabandon'](_0x460ffd);}catch(_0x27b77f){utils['error'](_0x27b77f);}});ami['on'](_0xa4f6('0x1c'),function(_0x32e304){try{queues[_0xa4f6('0x1c')](_0x32e304);recordings[_0xa4f6('0x1c')](_0x32e304);}catch(_0x4faf40){utils[_0xa4f6('0x16')](_0x4faf40);}});ami['on'](_0xa4f6('0x1d'),function(_0x4a3095){try{queues[_0xa4f6('0x1d')](_0x4a3095);}catch(_0x5929d6){utils['error'](_0x5929d6);}});ami['on']('musiconholdstart',function(_0x3488ff){try{queues['musiconholdstart'](_0x3488ff);calls[_0xa4f6('0x1e')](_0x3488ff);}catch(_0x8289f1){utils[_0xa4f6('0x16')](_0x8289f1);}});ami['on'](_0xa4f6('0x1f'),function(_0x44901e){try{queues['musiconholdstop'](_0x44901e);calls[_0xa4f6('0x1f')](_0x44901e);}catch(_0xc47931){utils[_0xa4f6('0x16')](_0xc47931);}});ami['on'](_0xa4f6('0x20'),function(_0x4cd505){try{calls['newstate'](_0x4cd505);recordings[_0xa4f6('0x20')](_0x4cd505);}catch(_0x127001){utils[_0xa4f6('0x16')](_0x127001);}});ami['on']('hangup',function(_0x1571b0){try{calls[_0xa4f6('0x21')](_0x1571b0);recordings['hangup'](_0x1571b0);dials[_0xa4f6('0x21')](_0x1571b0);agents['hangup'](_0x1571b0);queues[_0xa4f6('0x21')](_0x1571b0);}catch(_0x3f60ea){utils[_0xa4f6('0x16')](_0x3f60ea);}});ami['on']('cdr',function(_0x3de992){try{members['cdr'](_0x3de992);}catch(_0x26abc4){utils[_0xa4f6('0x16')](_0x26abc4);}});ami['on'](_0xa4f6('0x22'),function(_0x3798e8){try{queues[_0xa4f6('0x22')](_0x3798e8);agents[_0xa4f6('0x22')](_0x3798e8);transfers[_0xa4f6('0x22')](_0x3798e8);}catch(_0x486a46){utils[_0xa4f6('0x16')](_0x486a46);}});ami['on']('attendedtransfer',function(_0x11cbc8){try{queues['attendedtransfer'](_0x11cbc8);transfers[_0xa4f6('0x23')](_0x11cbc8);agents[_0xa4f6('0x23')](_0x11cbc8);calls[_0xa4f6('0x23')](_0x11cbc8);}catch(_0x2956c3){utils[_0xa4f6('0x16')](_0x2956c3);}});ami['on'](_0xa4f6('0x24'),function(_0x100201){try{queues[_0xa4f6('0x24')](_0x100201);recordings[_0xa4f6('0x24')](_0x100201);calls[_0xa4f6('0x24')](_0x100201);dials[_0xa4f6('0x24')](_0x100201);}catch(_0x5163b8){utils['error'](_0x5163b8);}});ami['on'](_0xa4f6('0x25'),function(_0xcf2c18){try{calls[_0xa4f6('0x25')](_0xcf2c18);recordings[_0xa4f6('0x25')](_0xcf2c18);dials[_0xa4f6('0x25')](_0xcf2c18);}catch(_0x552fd2){utils['error'](_0x552fd2);}});ami['on'](_0xa4f6('0x26'),function(_0x2374e1){try{calls[_0xa4f6('0x26')](_0x2374e1);recordings[_0xa4f6('0x26')](_0x2374e1);}catch(_0x1b60ff){utils[_0xa4f6('0x16')](_0x1b60ff);}});ami['on'](_0xa4f6('0x27'),function(_0x1b745f){try{dials['dialbegin'](_0x1b745f);}catch(_0x5ca534){utils[_0xa4f6('0x16')](_0x5ca534);}});ami['on'](_0xa4f6('0x28'),function(_0xa663d8){try{dials['dialend'](_0xa663d8);}catch(_0x5c38b8){utils[_0xa4f6('0x16')](_0x5c38b8);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 34a273a..3f67252 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 _0x5b01=['data1','data2','data3','destinationchannel','type','source','destination','lodash','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','membername','getUserByInterface','then','internal','request','getUserByName','split','CreateMemberReport','catch','error','some','startsWith','state','INUSE','BUSY','device','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','assign','queue'];(function(_0x2158a6,_0x11993c){var _0x4da6ed=function(_0xadf211){while(--_0xadf211){_0x2158a6['push'](_0x2158a6['shift']());}};_0x4da6ed(++_0x11993c);}(_0x5b01,0x1ab));var _0x15b0=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5b01[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x15b0('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x15b0('0x1'),_0x15b0('0x2')];function writeDB(_0x1522ae){utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x5'),_0x1522ae[_0x15b0('0x6')],_0x1522ae[_0x15b0('0x7')],_0x1522ae[_0x15b0('0x8')],_0x1522ae['data2'],_0x1522ae[_0x15b0('0x9')],_0x1522ae['type']));if(_0x1522ae[_0x15b0('0x7')]){utils[_0x15b0('0xa')](_0x1522ae[_0x15b0('0x7')])[_0x15b0('0xb')](function(_0x524ab2){if(_0x524ab2){_0x1522ae[_0x15b0('0x9')]=_0x524ab2['name'];_0x1522ae[_0x15b0('0xc')]=_0x524ab2['internal'];utils[_0x15b0('0xd')]('CreateMemberReport',_0x1522ae);}else{utils[_0x15b0('0xe')](_0x1522ae[_0x15b0('0x7')][_0x15b0('0xf')]('/')[0x1])[_0x15b0('0xb')](function(_0x244b59){if(_0x244b59){_0x1522ae[_0x15b0('0x9')]=_0x244b59['name'];_0x1522ae[_0x15b0('0xc')]=_0x244b59[_0x15b0('0xc')];utils[_0x15b0('0xd')](_0x15b0('0x10'),_0x1522ae);}});}})[_0x15b0('0x11')](function(_0x1cc47d){utils[_0x15b0('0x12')](_0x1cc47d);});}delete members[_0x1522ae[_0x15b0('0x7')]];}function startsWith(_0x2ff9eb,_0x190d48){return _[_0x15b0('0x13')](_0x2ff9eb,function(_0x54044c){return _[_0x15b0('0x14')](_0x190d48,_0x54044c);});}exports['devicestatechange']=function(_0x34a91f){switch(_0x34a91f[_0x15b0('0x15')]){case _0x15b0('0x16'):case _0x15b0('0x17'):if(!startsWith(exclude,_0x34a91f[_0x15b0('0x18')])){members[_0x34a91f['device']]={'channel':'voice','interface':_0x34a91f[_0x15b0('0x18')],'type':_0x15b0('0x19'),'enterAt':utils[_0x15b0('0x1a')](),'role':_0x15b0('0x1b')};}break;case _0x15b0('0x1c'):if(!_[_0x15b0('0x1d')](members[_0x34a91f['device']])){members[_0x34a91f[_0x15b0('0x18')]][_0x15b0('0x1e')]=utils[_0x15b0('0x1a')]();members[_0x34a91f['device']][_0x15b0('0x1f')]=utils['diffTime'](members[_0x34a91f[_0x15b0('0x18')]][_0x15b0('0x1e')],members[_0x34a91f[_0x15b0('0x18')]][_0x15b0('0x20')]);if(members[_0x34a91f[_0x15b0('0x18')]][_0x15b0('0x6')]){writeDB(members[_0x34a91f['device']]);}}default:break;}};exports['agentcomplete']=function(_0x2c5fe2){if(!_[_0x15b0('0x1d')](members[_0x2c5fe2[_0x15b0('0x7')]])){members[_0x2c5fe2[_0x15b0('0x7')]]=_[_0x15b0('0x21')](members[_0x2c5fe2[_0x15b0('0x7')]],{'data4':_0x2c5fe2[_0x15b0('0x22')],'uniqueid':_0x2c5fe2[_0x15b0('0x6')]});}};exports['cdr']=function(_0x411477){if(_0x411477[_0x15b0('0x8')]){var _0x4a296f=_0x411477[_0x15b0('0x8')][_0x15b0('0xf')]('-')[0x0];if(!_[_0x15b0('0x1d')](members[_0x4a296f])){members[_0x4a296f]=_[_0x15b0('0x21')](members[_0x4a296f],{'data1':members[_0x4a296f][_0x15b0('0x23')]||_0x411477['type'],'data2':members[_0x4a296f][_0x15b0('0x24')]||_0x411477['source'],'data3':members[_0x4a296f][_0x15b0('0x25')]||_0x411477['destination'],'uniqueid':members[_0x4a296f][_0x15b0('0x6')]||_0x411477[_0x15b0('0x6')]});if(members[_0x4a296f]['exitAt']){writeDB(members[_0x4a296f]);}}}if(_0x411477[_0x15b0('0x26')]){var _0x37a62d=_0x411477[_0x15b0('0x26')][_0x15b0('0xf')]('-')[0x0];if(!_['isNil'](members[_0x37a62d])){members[_0x37a62d]=_[_0x15b0('0x21')](members[_0x37a62d],{'data1':members[_0x37a62d][_0x15b0('0x23')]||_0x411477[_0x15b0('0x27')],'data2':members[_0x37a62d]['data2']||_0x411477[_0x15b0('0x28')],'data3':members[_0x37a62d][_0x15b0('0x25')]||_0x411477[_0x15b0('0x29')],'uniqueid':members[_0x37a62d][_0x15b0('0x6')]||_0x411477['uniqueid']});if(members[_0x37a62d][_0x15b0('0x1e')]){writeDB(members[_0x37a62d]);}}}}; \ No newline at end of file +var _0xfc92=['data2','source','data3','destinationchannel','data1','lodash','util','./utils','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','membername','type','getUserByInterface','then','internal','split','name','request','CreateMemberReport','catch','error','some','startsWith','state','INUSE','BUSY','device','TALKING','agent','isNil','exitAt','now','duration','diffTime','enterAt','assign','queue','cdr','channel'];(function(_0x3b71bd,_0x2237d5){var _0x90e893=function(_0x4751ce){while(--_0x4751ce){_0x3b71bd['push'](_0x3b71bd['shift']());}};_0x90e893(++_0x2237d5);}(_0xfc92,0x1a9));var _0x2fc9=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xfc92[_0x1e9424];return _0x1bd96c;};'use strict';var _=require(_0x2fc9('0x0'));var util=require(_0x2fc9('0x1'));var utils=require(_0x2fc9('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x2fc9('0x3')];function writeDB(_0x20ed34){utils['info'](util[_0x2fc9('0x4')](_0x2fc9('0x5'),_0x20ed34[_0x2fc9('0x6')],_0x20ed34[_0x2fc9('0x7')],_0x20ed34['channel'],_0x20ed34['data2'],_0x20ed34[_0x2fc9('0x8')],_0x20ed34[_0x2fc9('0x9')]));if(_0x20ed34[_0x2fc9('0x7')]){utils[_0x2fc9('0xa')](_0x20ed34[_0x2fc9('0x7')])[_0x2fc9('0xb')](function(_0x42abfb){if(_0x42abfb){_0x20ed34[_0x2fc9('0x8')]=_0x42abfb['name'];_0x20ed34[_0x2fc9('0xc')]=_0x42abfb[_0x2fc9('0xc')];utils['request']('CreateMemberReport',_0x20ed34);}else{utils['getUserByName'](_0x20ed34[_0x2fc9('0x7')][_0x2fc9('0xd')]('/')[0x1])['then'](function(_0x3db06d){if(_0x3db06d){_0x20ed34[_0x2fc9('0x8')]=_0x3db06d[_0x2fc9('0xe')];_0x20ed34[_0x2fc9('0xc')]=_0x3db06d[_0x2fc9('0xc')];utils[_0x2fc9('0xf')](_0x2fc9('0x10'),_0x20ed34);}});}})[_0x2fc9('0x11')](function(_0x5a4bdd){utils[_0x2fc9('0x12')](_0x5a4bdd);});}delete members[_0x20ed34[_0x2fc9('0x7')]];}function startsWith(_0x335b9d,_0x3625f8){return _[_0x2fc9('0x13')](_0x335b9d,function(_0x21ccd2){return _[_0x2fc9('0x14')](_0x3625f8,_0x21ccd2);});}exports['devicestatechange']=function(_0x4903b5){switch(_0x4903b5[_0x2fc9('0x15')]){case _0x2fc9('0x16'):case _0x2fc9('0x17'):if(!startsWith(exclude,_0x4903b5[_0x2fc9('0x18')])){members[_0x4903b5[_0x2fc9('0x18')]]={'channel':'voice','interface':_0x4903b5[_0x2fc9('0x18')],'type':_0x2fc9('0x19'),'enterAt':utils['now'](),'role':_0x2fc9('0x1a')};}break;case'NOT_INUSE':if(!_[_0x2fc9('0x1b')](members[_0x4903b5[_0x2fc9('0x18')]])){members[_0x4903b5['device']][_0x2fc9('0x1c')]=utils[_0x2fc9('0x1d')]();members[_0x4903b5['device']][_0x2fc9('0x1e')]=utils[_0x2fc9('0x1f')](members[_0x4903b5[_0x2fc9('0x18')]][_0x2fc9('0x1c')],members[_0x4903b5['device']][_0x2fc9('0x20')]);if(members[_0x4903b5[_0x2fc9('0x18')]][_0x2fc9('0x6')]){writeDB(members[_0x4903b5['device']]);}}default:break;}};exports['agentcomplete']=function(_0x2a8f12){if(!_[_0x2fc9('0x1b')](members[_0x2a8f12[_0x2fc9('0x7')]])){members[_0x2a8f12['interface']]=_[_0x2fc9('0x21')](members[_0x2a8f12[_0x2fc9('0x7')]],{'data4':_0x2a8f12[_0x2fc9('0x22')],'uniqueid':_0x2a8f12[_0x2fc9('0x6')]});}};exports[_0x2fc9('0x23')]=function(_0x31732a){if(_0x31732a[_0x2fc9('0x24')]){var _0x113a36=_0x31732a[_0x2fc9('0x24')][_0x2fc9('0xd')]('-')[0x0];if(!_[_0x2fc9('0x1b')](members[_0x113a36])){members[_0x113a36]=_['assign'](members[_0x113a36],{'data1':members[_0x113a36]['data1']||_0x31732a[_0x2fc9('0x9')],'data2':members[_0x113a36][_0x2fc9('0x25')]||_0x31732a[_0x2fc9('0x26')],'data3':members[_0x113a36][_0x2fc9('0x27')]||_0x31732a['destination'],'uniqueid':members[_0x113a36]['uniqueid']||_0x31732a[_0x2fc9('0x6')]});if(members[_0x113a36][_0x2fc9('0x1c')]){writeDB(members[_0x113a36]);}}}if(_0x31732a['destinationchannel']){var _0x4b5e46=_0x31732a[_0x2fc9('0x28')][_0x2fc9('0xd')]('-')[0x0];if(!_['isNil'](members[_0x4b5e46])){members[_0x4b5e46]=_[_0x2fc9('0x21')](members[_0x4b5e46],{'data1':members[_0x4b5e46][_0x2fc9('0x29')]||_0x31732a[_0x2fc9('0x9')],'data2':members[_0x4b5e46]['data2']||_0x31732a[_0x2fc9('0x26')],'data3':members[_0x4b5e46][_0x2fc9('0x27')]||_0x31732a['destination'],'uniqueid':members[_0x4b5e46]['uniqueid']||_0x31732a[_0x2fc9('0x6')]});if(members[_0x4b5e46]['exitAt']){writeDB(members[_0x4b5e46]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index aec93ce..3d3b190 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 _0x7366=['transfertype','ATTENDED','transferexten','transfereelinkedid','transfertargetuniqueid','calleridname','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','mohtime','error','stack','musiconholdstart','musiconholdstop','musiconholdstartAt','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','accountcode','queuecallerexitreason','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','position','now','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','queuecallerabandonAt','ABANDONED','queuecallerleave','holdtime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','connectedlinename','assigned','destaccountcode','membername','agentcomplete','lastAssignedTo','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','BLIND','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7366,0x192));var _0x6736=function(_0x10ed05,_0x6a2997){_0x10ed05=_0x10ed05-0x0;var _0x489ad4=_0x7366[_0x10ed05];return _0x489ad4;};'use strict';var _=require(_0x6736('0x0'));var util=require(_0x6736('0x1'));var utils=require(_0x6736('0x2'));var queues={};function writeDB(_0x4298a2){utils[_0x6736('0x3')](util[_0x6736('0x4')](_0x6736('0x5'),_0x4298a2[_0x6736('0x6')],_0x4298a2[_0x6736('0x7')],_0x4298a2['queue'],_0x4298a2['lastAssignedTo'],_0x4298a2[_0x6736('0x8')],_0x4298a2[_0x6736('0x9')],_0x4298a2[_0x6736('0xa')]));if(_0x4298a2[_0x6736('0xb')]){utils['getVoiceQueueByName'](_0x4298a2[_0x6736('0xb')])[_0x6736('0xc')](function(_0x232621){if(_0x232621){_0x4298a2[_0x6736('0xd')]=_0x232621['type'];}utils[_0x6736('0xe')](_0x6736('0xf'),_0x4298a2);});}else{utils['request'](_0x6736('0xf'),_0x4298a2);}if(_0x4298a2[_0x6736('0x10')]){delete queues[_0x4298a2[_0x6736('0x10')]];}else{delete queues[_0x4298a2[_0x6736('0x6')]];}}exports['queuecallerjoin']=function(_0x2179db){queues[_0x2179db[_0x6736('0x6')]]=_['assign'](_0x2179db,{'originalposition':_0x2179db[_0x6736('0x11')],'queuecallerjoinAt':utils[_0x6736('0x12')](),'mohtime':0x0});};exports[_0x6736('0x13')]=function(_0x37b2e0){if(!_[_0x6736('0x14')](queues[_0x37b2e0[_0x6736('0x6')]])){if(queues[_0x37b2e0[_0x6736('0x6')]]['queuecallerleaveAt']){if(!queues[_0x37b2e0['uniqueid']][_0x6736('0x15')]&&!queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x16')]){queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x17')]=!![];queues[_0x37b2e0['uniqueid']]['queuecallercompleteAt']=utils[_0x6736('0x12')]();queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0xa')]=_0x6736('0x18');}writeDB(queues[_0x37b2e0[_0x6736('0x6')]]);}else{if(queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x10')]){queues[queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x10')]]=queues[_0x37b2e0[_0x6736('0x6')]];queues[queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x10')]][_0x6736('0x19')]=0x2;delete queues[_0x37b2e0['uniqueid']];}}}};exports['varset']=function(_0x2994d0){if(!_[_0x6736('0x14')](_0x2994d0[_0x6736('0x1a')][_0x6736('0x1b')])&&_0x2994d0[_0x6736('0x1c')][_0x6736('0x1d')]()!==_0x6736('0x1e')){if(!_[_0x6736('0x14')](queues[_0x2994d0['uniqueid']])){queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x2994d0[_0x6736('0x6')]]['queuecallerabandonAt']=null;queues[_0x2994d0['uniqueid']]['queuecallerexit']=!![];queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x1f')]=utils[_0x6736('0x12')]();queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0xa')]=_0x2994d0[_0x6736('0x1c')][_0x6736('0x1d')]();writeDB(queues[_0x2994d0[_0x6736('0x6')]]);}}else if(!_[_0x6736('0x14')](_0x2994d0['variable'][_0x6736('0x20')])){if(!_[_0x6736('0x14')](queues[_0x2994d0[_0x6736('0x6')]])&&!queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x15')]){queues[_0x2994d0['uniqueid']]['queuecallerabandon']=![];queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x21')]=null;queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x16')]=!![];queues[_0x2994d0['uniqueid']][_0x6736('0x1f')]=utils[_0x6736('0x12')]();queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0xa')]='EXITWITHKEY';}}};exports['queuecallerabandon']=function(_0x5831f6){if(!_['isNil'](queues[_0x5831f6[_0x6736('0x6')]])){queues[_0x5831f6['uniqueid']][_0x6736('0x16')]=![];queues[_0x5831f6[_0x6736('0x6')]][_0x6736('0x1f')]=null;queues[_0x5831f6[_0x6736('0x6')]][_0x6736('0x15')]=!![];queues[_0x5831f6[_0x6736('0x6')]]['queuecallerabandonAt']=utils[_0x6736('0x12')]();queues[_0x5831f6['uniqueid']][_0x6736('0xa')]=_0x6736('0x22');}};exports[_0x6736('0x23')]=function(_0x85bdf){if(!_[_0x6736('0x14')](queues[_0x85bdf[_0x6736('0x6')]])){queues[_0x85bdf['uniqueid']][_0x6736('0x23')]=!![];queues[_0x85bdf['uniqueid']]['queuecallerleaveAt']=utils[_0x6736('0x12')]();queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x24')]=utils['diffTime'](queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x25')],queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x26')]);queues[_0x85bdf['uniqueid']][_0x6736('0x11')]=_0x85bdf['position'];queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x27')]=_0x85bdf['count'];queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x28')]=_0x85bdf[_0x6736('0x28')];queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x29')]=_0x85bdf['connectedlinename'];}};exports['agentconnect']=function(_0x27cc61){if(!_[_0x6736('0x14')](queues[_0x27cc61[_0x6736('0x6')]])){queues[_0x27cc61[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x27cc61[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x27cc61['uniqueid']][_0x6736('0x21')]=null;queues[_0x27cc61[_0x6736('0x6')]]['queuecallerexit']=![];queues[_0x27cc61[_0x6736('0x6')]]['queuecallerexitreason']=null;queues[_0x27cc61[_0x6736('0x6')]][_0x6736('0x1f')]=null;queues[_0x27cc61[_0x6736('0x6')]][_0x6736('0x2a')]=!![];queues[_0x27cc61['uniqueid']][_0x6736('0x9')]=_0x27cc61[_0x6736('0x2b')];queues[_0x27cc61[_0x6736('0x6')]]['lastAssignedTo']=_0x27cc61[_0x6736('0x2c')];}};exports[_0x6736('0x2d')]=function(_0x3fa0dc){if(!_[_0x6736('0x14')](queues[_0x3fa0dc[_0x6736('0x6')]])){if(queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x25')]){queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x21')]=null;queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x16')]=![];queues[_0x3fa0dc[_0x6736('0x6')]]['queuecallerexitAt']=null;queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x2a')]=!![];queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x2e')]=_0x3fa0dc[_0x6736('0x2c')];queues[_0x3fa0dc['uniqueid']][_0x6736('0x17')]=!![];queues[_0x3fa0dc[_0x6736('0x6')]]['queuecallercompleteAt']=utils[_0x6736('0x12')]();if(_0x3fa0dc[_0x6736('0x2f')]=='transfer'){if(!queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x30')]){queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0xa')]='TRANSFER';}}else{queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0xa')]=_0x6736('0x31')+_0x3fa0dc[_0x6736('0x2f')][_0x6736('0x1d')]();}writeDB(queues[_0x3fa0dc[_0x6736('0x6')]]);}}};exports[_0x6736('0x32')]=function(_0x30e582){if(!_[_0x6736('0x14')](queues[_0x30e582[_0x6736('0x33')]])){queues[_0x30e582['transfereeuniqueid']][_0x6736('0x30')]=!![];queues[_0x30e582[_0x6736('0x33')]]['transfertype']=_0x6736('0x34');queues[_0x30e582[_0x6736('0x33')]]['transferexten']=_0x30e582[_0x6736('0x35')];queues[_0x30e582[_0x6736('0x33')]][_0x6736('0x36')]=_0x30e582[_0x6736('0x33')];queues[_0x30e582[_0x6736('0x33')]][_0x6736('0xa')]=_0x6736('0x37');}};exports[_0x6736('0x38')]=function(_0x34e414){try{if(_0x34e414[_0x6736('0x39')]==_0x34e414[_0x6736('0x3a')]){if(!_[_0x6736('0x14')](queues[_0x34e414[_0x6736('0x3b')]])){queues[_0x34e414[_0x6736('0x3b')]]['transfer']=!![];queues[_0x34e414[_0x6736('0x3b')]][_0x6736('0x3c')]=_0x6736('0x3d');queues[_0x34e414[_0x6736('0x3b')]][_0x6736('0x3e')]=_0x34e414['origtransfererexten'];queues[_0x34e414['secondtransfererlinkedid']][_0x6736('0x36')]=_0x34e414['origtransfereruniqueid'];queues[_0x34e414[_0x6736('0x3b')]][_0x6736('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x6736('0x14')](queues[_0x34e414[_0x6736('0x3a')]])){if(_0x34e414['transfereelinkedid']&&queues[_0x34e414[_0x6736('0x3f')]]){queues[_0x34e414[_0x6736('0x3f')]]['queuecallerenterreason']=0x1;queues[_0x34e414[_0x6736('0x33')]]=_['clone'](queues[_0x34e414['transfereelinkedid']]);queues[_0x34e414['transfereeuniqueid']]['transfereduniqueid']=_0x34e414[_0x6736('0x40')];queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x19')]=0x2;queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x8')]=queues[_0x34e414[_0x6736('0x3b')]][_0x6736('0x8')];queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x41')]=queues[_0x34e414[_0x6736('0x3b')]]['calleridname'];queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x26')]=utils[_0x6736('0x12')]();queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x25')]=utils[_0x6736('0x12')]();queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x24')]=0x0;queues[_0x34e414[_0x6736('0x33')]]['mohtime']=0x0;}else{queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x10')]=_0x34e414[_0x6736('0x3b')];}}}else if(_0x34e414[_0x6736('0x42')]==_0x34e414['secondtransfererlinkedid']){if(!_[_0x6736('0x14')](queues[_0x34e414[_0x6736('0x3a')]])){queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x30')]=!![];queues[_0x34e414['origtransfererlinkedid']][_0x6736('0x3c')]='ATTENDED';queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x3e')]=_0x34e414[_0x6736('0x43')];queues[_0x34e414['origtransfererlinkedid']][_0x6736('0x36')]=_0x34e414[_0x6736('0x42')];queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0xa')]=_0x6736('0x44');}if(!_[_0x6736('0x14')](queues[_0x34e414[_0x6736('0x3b')]])){if(_0x34e414[_0x6736('0x45')]&&queues[_0x34e414['transfertargetlinkedid']]){queues[_0x34e414[_0x6736('0x45')]][_0x6736('0x19')]=0x1;queues[_0x34e414[_0x6736('0x40')]]=_[_0x6736('0x46')](queues[_0x34e414[_0x6736('0x45')]]);queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x10')]=_0x34e414[_0x6736('0x40')];queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x19')]=0x2;queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x8')]=queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x8')];queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x41')]=queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x41')];queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x26')]=utils[_0x6736('0x12')]();queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x25')]=utils[_0x6736('0x12')]();queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x24')]=0x0;queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x47')]=0x0;}else{queues[_0x34e414[_0x6736('0x3b')]]['transfereduniqueid']=_0x34e414['origtransfererlinkedid'];}}}}catch(_0x441792){utils[_0x6736('0x48')](_0x441792[_0x6736('0x49')]);}};exports[_0x6736('0x4a')]=function(_0x3b5e41){if(!_['isNil'](queues[_0x3b5e41[_0x6736('0x6')]])){queues[_0x3b5e41['uniqueid']]['musiconholdstartAt']=utils[_0x6736('0x12')]();}};exports[_0x6736('0x4b')]=function(_0x125967){if(!_[_0x6736('0x14')](queues[_0x125967[_0x6736('0x6')]])){if(!_[_0x6736('0x14')](queues[_0x125967[_0x6736('0x6')]]['musiconholdstartAt'])){queues[_0x125967['uniqueid']][_0x6736('0x47')]+=utils['diffTime'](utils[_0x6736('0x12')](),queues[_0x125967[_0x6736('0x6')]]['musiconholdstartAt']);delete queues[_0x125967[_0x6736('0x6')]][_0x6736('0x4c')];}}}; \ No newline at end of file +var _0xb925=['then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','now','isNil','queuecallerabandon','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','assigned','membername','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','transferuniqueid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','transfertargetlinkedid','clone','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName'];(function(_0x4ae398,_0x32eeaf){var _0xd56ae5=function(_0x521260){while(--_0x521260){_0x4ae398['push'](_0x4ae398['shift']());}};_0xd56ae5(++_0x32eeaf);}(_0xb925,0x121));var _0x5b92=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0xb925[_0x24a88e];return _0x232cbb;};'use strict';var _=require(_0x5b92('0x0'));var util=require('util');var utils=require(_0x5b92('0x1'));var queues={};function writeDB(_0x1af4e8){utils[_0x5b92('0x2')](util[_0x5b92('0x3')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x1af4e8[_0x5b92('0x4')],_0x1af4e8[_0x5b92('0x5')],_0x1af4e8[_0x5b92('0x6')],_0x1af4e8[_0x5b92('0x7')],_0x1af4e8[_0x5b92('0x8')],_0x1af4e8[_0x5b92('0x9')],_0x1af4e8['queuecallerexitreason']));if(_0x1af4e8['queue']){utils[_0x5b92('0xa')](_0x1af4e8['queue'])[_0x5b92('0xb')](function(_0x7577ef){if(_0x7577ef){_0x1af4e8['type']=_0x7577ef['type'];}utils[_0x5b92('0xc')]('CreateVoiceQueueReport',_0x1af4e8);});}else{utils['request'](_0x5b92('0xd'),_0x1af4e8);}if(_0x1af4e8[_0x5b92('0xe')]){delete queues[_0x1af4e8[_0x5b92('0xe')]];}else{delete queues[_0x1af4e8[_0x5b92('0x4')]];}}exports[_0x5b92('0xf')]=function(_0xe516c){queues[_0xe516c[_0x5b92('0x4')]]=_['assign'](_0xe516c,{'originalposition':_0xe516c['position'],'queuecallerjoinAt':utils[_0x5b92('0x10')](),'mohtime':0x0});};exports['hangup']=function(_0x1c46f9){if(!_[_0x5b92('0x11')](queues[_0x1c46f9['uniqueid']])){if(queues[_0x1c46f9['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0x12')]&&!queues[_0x1c46f9['uniqueid']]['queuecallerexit']){queues[_0x1c46f9['uniqueid']]['queuecallercomplete']=!![];queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0x13')]=utils[_0x5b92('0x10')]();queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0x14')]=_0x5b92('0x15');}writeDB(queues[_0x1c46f9[_0x5b92('0x4')]]);}else{if(queues[_0x1c46f9[_0x5b92('0x4')]]['transfereduniqueid']){queues[queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0xe')]]=queues[_0x1c46f9[_0x5b92('0x4')]];queues[queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0xe')]][_0x5b92('0x16')]=0x2;delete queues[_0x1c46f9['uniqueid']];}}}};exports['varset']=function(_0x42c068){if(!_[_0x5b92('0x11')](_0x42c068[_0x5b92('0x17')][_0x5b92('0x18')])&&_0x42c068[_0x5b92('0x19')][_0x5b92('0x1a')]()!=='CONTINUE'){if(!_[_0x5b92('0x11')](queues[_0x42c068['uniqueid']])){queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1b')]=null;queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1c')]=!![];queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1d')]=utils['now']();queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x14')]=_0x42c068[_0x5b92('0x19')]['toUpperCase']();writeDB(queues[_0x42c068[_0x5b92('0x4')]]);}}else if(!_['isNil'](_0x42c068[_0x5b92('0x17')]['queueposition'])){if(!_[_0x5b92('0x11')](queues[_0x42c068['uniqueid']])&&!queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x12')]){queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x42c068[_0x5b92('0x4')]]['queuecallerabandonAt']=null;queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1c')]=!![];queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1d')]=utils['now']();queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x14')]=_0x5b92('0x1e');}}};exports[_0x5b92('0x12')]=function(_0x3530b8){if(!_[_0x5b92('0x11')](queues[_0x3530b8['uniqueid']])){queues[_0x3530b8['uniqueid']][_0x5b92('0x1c')]=![];queues[_0x3530b8[_0x5b92('0x4')]][_0x5b92('0x1d')]=null;queues[_0x3530b8['uniqueid']][_0x5b92('0x12')]=!![];queues[_0x3530b8[_0x5b92('0x4')]][_0x5b92('0x1b')]=utils[_0x5b92('0x10')]();queues[_0x3530b8[_0x5b92('0x4')]]['queuecallerexitreason']=_0x5b92('0x1f');}};exports['queuecallerleave']=function(_0x586c49){if(!_['isNil'](queues[_0x586c49[_0x5b92('0x4')]])){queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x20')]=!![];queues[_0x586c49['uniqueid']][_0x5b92('0x21')]=utils[_0x5b92('0x10')]();queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x22')]=utils[_0x5b92('0x23')](queues[_0x586c49[_0x5b92('0x4')]]['queuecallerleaveAt'],queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x24')]);queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x25')]=_0x586c49['position'];queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x26')]=_0x586c49['count'];queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x27')]=_0x586c49['connectedlinenum'];queues[_0x586c49['uniqueid']]['connectedlinename']=_0x586c49[_0x5b92('0x28')];}};exports[_0x5b92('0x29')]=function(_0x59d47a){if(!_[_0x5b92('0x11')](queues[_0x59d47a[_0x5b92('0x4')]])){queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x1b')]=null;queues[_0x59d47a['uniqueid']]['queuecallerexit']=![];queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x14')]=null;queues[_0x59d47a['uniqueid']][_0x5b92('0x1d')]=null;queues[_0x59d47a['uniqueid']][_0x5b92('0x2a')]=!![];queues[_0x59d47a[_0x5b92('0x4')]]['accountcode']=_0x59d47a['destaccountcode'];queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x7')]=_0x59d47a[_0x5b92('0x2b')];}};exports[_0x5b92('0x2c')]=function(_0x486310){if(!_[_0x5b92('0x11')](queues[_0x486310[_0x5b92('0x4')]])){if(queues[_0x486310[_0x5b92('0x4')]]['queuecallerleaveAt']){queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x486310['uniqueid']][_0x5b92('0x1b')]=null;queues[_0x486310['uniqueid']][_0x5b92('0x1c')]=![];queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x1d')]=null;queues[_0x486310['uniqueid']]['assigned']=!![];queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x7')]=_0x486310[_0x5b92('0x2b')];queues[_0x486310['uniqueid']][_0x5b92('0x2d')]=!![];queues[_0x486310[_0x5b92('0x4')]]['queuecallercompleteAt']=utils[_0x5b92('0x10')]();if(_0x486310[_0x5b92('0x2e')]==_0x5b92('0x2f')){if(!queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x2f')]){queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x14')]=_0x5b92('0x30');}}else{queues[_0x486310[_0x5b92('0x4')]]['queuecallerexitreason']=_0x5b92('0x31')+_0x486310[_0x5b92('0x2e')]['toUpperCase']();}writeDB(queues[_0x486310['uniqueid']]);}}};exports['blindtransfer']=function(_0x312492){if(!_[_0x5b92('0x11')](queues[_0x312492[_0x5b92('0x32')]])){queues[_0x312492['transfereeuniqueid']][_0x5b92('0x2f')]=!![];queues[_0x312492[_0x5b92('0x32')]]['transfertype']=_0x5b92('0x33');queues[_0x312492[_0x5b92('0x32')]][_0x5b92('0x34')]=_0x312492[_0x5b92('0x35')];queues[_0x312492[_0x5b92('0x32')]]['transferuniqueid']=_0x312492[_0x5b92('0x32')];queues[_0x312492[_0x5b92('0x32')]][_0x5b92('0x14')]=_0x5b92('0x36');}};exports[_0x5b92('0x37')]=function(_0xc1dd82){try{if(_0xc1dd82[_0x5b92('0x38')]==_0xc1dd82[_0x5b92('0x39')]){if(!_['isNil'](queues[_0xc1dd82['secondtransfererlinkedid']])){queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0x2f')]=!![];queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0x3b')]=_0x5b92('0x3c');queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0x34')]=_0xc1dd82[_0x5b92('0x3d')];queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0x3e')]=_0xc1dd82[_0x5b92('0x38')];queues[_0xc1dd82[_0x5b92('0x3a')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0xc1dd82[_0x5b92('0x39')]])){if(_0xc1dd82[_0x5b92('0x3f')]&&queues[_0xc1dd82['transfereelinkedid']]){queues[_0xc1dd82['transfereelinkedid']][_0x5b92('0x16')]=0x1;queues[_0xc1dd82[_0x5b92('0x32')]]=_['clone'](queues[_0xc1dd82[_0x5b92('0x3f')]]);queues[_0xc1dd82[_0x5b92('0x32')]]['transfereduniqueid']=_0xc1dd82[_0x5b92('0x40')];queues[_0xc1dd82['transfereeuniqueid']][_0x5b92('0x16')]=0x2;queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x8')]=queues[_0xc1dd82['secondtransfererlinkedid']][_0x5b92('0x8')];queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x41')]=queues[_0xc1dd82['secondtransfererlinkedid']][_0x5b92('0x41')];queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x24')]=utils[_0x5b92('0x10')]();queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x21')]=utils['now']();queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x22')]=0x0;queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x42')]=0x0;}else{queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0xe')]=_0xc1dd82[_0x5b92('0x3a')];}}}else if(_0xc1dd82[_0x5b92('0x43')]==_0xc1dd82[_0x5b92('0x3a')]){if(!_['isNil'](queues[_0xc1dd82[_0x5b92('0x39')]])){queues[_0xc1dd82['origtransfererlinkedid']][_0x5b92('0x2f')]=!![];queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0x3b')]=_0x5b92('0x3c');queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0x34')]=_0xc1dd82['secondtransfererexten'];queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0x3e')]=_0xc1dd82[_0x5b92('0x43')];queues[_0xc1dd82[_0x5b92('0x39')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x5b92('0x11')](queues[_0xc1dd82['secondtransfererlinkedid']])){if(_0xc1dd82[_0x5b92('0x44')]&&queues[_0xc1dd82[_0x5b92('0x44')]]){queues[_0xc1dd82[_0x5b92('0x44')]][_0x5b92('0x16')]=0x1;queues[_0xc1dd82[_0x5b92('0x40')]]=_[_0x5b92('0x45')](queues[_0xc1dd82[_0x5b92('0x44')]]);queues[_0xc1dd82[_0x5b92('0x40')]][_0x5b92('0xe')]=_0xc1dd82[_0x5b92('0x40')];queues[_0xc1dd82[_0x5b92('0x40')]][_0x5b92('0x16')]=0x2;queues[_0xc1dd82[_0x5b92('0x40')]]['calleridnum']=queues[_0xc1dd82[_0x5b92('0x39')]]['calleridnum'];queues[_0xc1dd82[_0x5b92('0x40')]]['calleridname']=queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0x41')];queues[_0xc1dd82[_0x5b92('0x40')]][_0x5b92('0x24')]=utils['now']();queues[_0xc1dd82['transfertargetuniqueid']][_0x5b92('0x21')]=utils[_0x5b92('0x10')]();queues[_0xc1dd82[_0x5b92('0x40')]]['holdtime']=0x0;queues[_0xc1dd82[_0x5b92('0x40')]][_0x5b92('0x42')]=0x0;}else{queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0xe')]=_0xc1dd82[_0x5b92('0x39')];}}}}catch(_0x25a685){utils[_0x5b92('0x46')](_0x25a685[_0x5b92('0x47')]);}};exports[_0x5b92('0x48')]=function(_0x5bc790){if(!_[_0x5b92('0x11')](queues[_0x5bc790[_0x5b92('0x4')]])){queues[_0x5bc790[_0x5b92('0x4')]][_0x5b92('0x49')]=utils['now']();}};exports[_0x5b92('0x4a')]=function(_0x573c09){if(!_['isNil'](queues[_0x573c09[_0x5b92('0x4')]])){if(!_[_0x5b92('0x11')](queues[_0x573c09[_0x5b92('0x4')]][_0x5b92('0x49')])){queues[_0x573c09[_0x5b92('0x4')]][_0x5b92('0x42')]+=utils['diffTime'](utils['now'](),queues[_0x573c09[_0x5b92('0x4')]][_0x5b92('0x49')]);delete queues[_0x573c09['uniqueid']][_0x5b92('0x49')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c4104b5..dc6db2c 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x205ad8,_0x1c50ab){var _0x51f2b4=function(_0x398f25){while(--_0x398f25){_0x205ad8['push'](_0x205ad8['shift']());}};_0x51f2b4(++_0x1c50ab);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a09d6,_0x907173){_0x5a09d6=_0x5a09d6-0x0;var _0x339dff=_0xedd9[_0x5a09d6];return _0x339dff;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file +var _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x55403c,_0x38cdc0){var _0x1ff14e=function(_0x28a1fe){while(--_0x28a1fe){_0x55403c['push'](_0x55403c['shift']());}};_0x1ff14e(++_0x38cdc0);}(_0xedd9,0xfc));var _0x9edd=function(_0x392ad2,_0xf4c384){_0x392ad2=_0x392ad2-0x0;var _0x594d51=_0xedd9[_0x392ad2];return _0x594d51;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b4dc64e..3dd610e 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 _0xe77f=['origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','info','TRANSFER|%s','type','CreateVoiceTransferReport','blindtransfer','blind','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x5d8e11,_0x1b2574){var _0x25fa53=function(_0x5376ce){while(--_0x5376ce){_0x5d8e11['push'](_0x5d8e11['shift']());}};_0x25fa53(++_0x1b2574);}(_0xe77f,0xba));var _0xfe77=function(_0x309725,_0x593bc7){_0x309725=_0x309725-0x0;var _0x2d9d03=_0xe77f[_0x309725];return _0x2d9d03;};'use strict';var _=require(_0xfe77('0x0'));var util=require(_0xfe77('0x1'));var utils=require('./utils');function writeDB(_0x397a5c){utils[_0xfe77('0x2')](util['format'](_0xfe77('0x3'),_0x397a5c[_0xfe77('0x4')]));utils['request'](_0xfe77('0x5'),_0x397a5c);}exports[_0xfe77('0x6')]=function(_0xaad04a){try{_0xaad04a[_0xfe77('0x4')]=_0xfe77('0x7');writeDB(_0xaad04a);}catch(_0x51d137){utils['error'](_0x51d137[_0xfe77('0x8')]);}};exports[_0xfe77('0x9')]=function(_0x1bb5e0){try{_0x1bb5e0=_[_0xfe77('0xa')](_0x1bb5e0,{'transfererchannel':_0x1bb5e0[_0xfe77('0xb')],'transferercalleridnum':_0x1bb5e0[_0xfe77('0xc')],'transferercalleridname':_0x1bb5e0['origtransferercalleridname'],'transfererconnectedlinenum':_0x1bb5e0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1bb5e0[_0xfe77('0xd')],'transfereraccountcode':_0x1bb5e0[_0xfe77('0xe')],'transferercontext':_0x1bb5e0[_0xfe77('0xf')],'transfererexten':_0x1bb5e0[_0xfe77('0x10')],'transfererlinkedid':_0x1bb5e0['origtransfererlinkedid'],'context':_0x1bb5e0[_0xfe77('0x11')],'extension':_0x1bb5e0[_0xfe77('0x12')],'type':_0xfe77('0x13')});if(_[_0xfe77('0x14')](_0x1bb5e0['transfereechannel'])){_0x1bb5e0=_[_0xfe77('0xa')](_0x1bb5e0,{'transfereechannel':_0x1bb5e0[_0xfe77('0x15')],'transfereecalleridnum':_0x1bb5e0[_0xfe77('0x16')],'transfereecalleridname':_0x1bb5e0['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1bb5e0[_0xfe77('0x17')],'transfereeconnectedlinename':_0x1bb5e0[_0xfe77('0x18')],'transfereeaccountcode':_0x1bb5e0['transfertargetaccountcode'],'transfereecontext':_0x1bb5e0[_0xfe77('0x19')],'transfereeexten':_0x1bb5e0[_0xfe77('0x1a')],'transfereelinkedid':_0x1bb5e0[_0xfe77('0x1b')]});}writeDB(_0x1bb5e0);}catch(_0x28366f){utils[_0xfe77('0x1c')](_0x28366f[_0xfe77('0x8')]);}}; \ No newline at end of file +var _0x8323=['transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','info','TRANSFER|%s','type','request','CreateVoiceTransferReport','blind','error','stack','attendedtransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','isNil','transfereechannel','assign'];(function(_0x8c4b82,_0x308158){var _0x20e8b9=function(_0x5f5ad2){while(--_0x5f5ad2){_0x8c4b82['push'](_0x8c4b82['shift']());}};_0x20e8b9(++_0x308158);}(_0x8323,0x8f));var _0x3832=function(_0x3a8d90,_0xe96556){_0x3a8d90=_0x3a8d90-0x0;var _0x34fb54=_0x8323[_0x3a8d90];return _0x34fb54;};'use strict';var _=require(_0x3832('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x5336f7){utils[_0x3832('0x1')](util['format'](_0x3832('0x2'),_0x5336f7[_0x3832('0x3')]));utils[_0x3832('0x4')](_0x3832('0x5'),_0x5336f7);}exports['blindtransfer']=function(_0x2b32fd){try{_0x2b32fd[_0x3832('0x3')]=_0x3832('0x6');writeDB(_0x2b32fd);}catch(_0x2cda3a){utils[_0x3832('0x7')](_0x2cda3a[_0x3832('0x8')]);}};exports[_0x3832('0x9')]=function(_0x1f938c){try{_0x1f938c=_['assign'](_0x1f938c,{'transfererchannel':_0x1f938c[_0x3832('0xa')],'transferercalleridnum':_0x1f938c['origtransferercalleridnum'],'transferercalleridname':_0x1f938c[_0x3832('0xb')],'transfererconnectedlinenum':_0x1f938c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1f938c[_0x3832('0xc')],'transfereraccountcode':_0x1f938c[_0x3832('0xd')],'transferercontext':_0x1f938c[_0x3832('0xe')],'transfererexten':_0x1f938c['secondtransfererexten'],'transfererlinkedid':_0x1f938c['origtransfererlinkedid'],'context':_0x1f938c[_0x3832('0xf')],'extension':_0x1f938c['origtransfererexten'],'type':'attended'});if(_[_0x3832('0x10')](_0x1f938c[_0x3832('0x11')])){_0x1f938c=_[_0x3832('0x12')](_0x1f938c,{'transfereechannel':_0x1f938c[_0x3832('0x13')],'transfereecalleridnum':_0x1f938c[_0x3832('0x14')],'transfereecalleridname':_0x1f938c[_0x3832('0x15')],'transfereeconnectedlinenum':_0x1f938c[_0x3832('0x16')],'transfereeconnectedlinename':_0x1f938c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1f938c[_0x3832('0x17')],'transfereecontext':_0x1f938c[_0x3832('0x18')],'transfereeexten':_0x1f938c[_0x3832('0x19')],'transfereelinkedid':_0x1f938c[_0x3832('0x1a')]});}writeDB(_0x1f938c);}catch(_0x2d9d7b){utils[_0x3832('0x7')](_0x2d9d7b[_0x3832('0x8')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 85c5306..1ada880 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 _0xd478=['YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','debug','error','stack','request','GetUser','internal','then','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','catch','getUserByName','GetVoiceQueue','name','type','acw','acwTimeout','info','GETVOICEQUEUEBYNAME|','add','seconds','subtract','format'];(function(_0x54cfaf,_0x59f305){var _0x4e80e3=function(_0x4ee6b7){while(--_0x4ee6b7){_0x54cfaf['push'](_0x54cfaf['shift']());}};_0x4e80e3(++_0x59f305);}(_0xd478,0x117));var _0x8d47=function(_0x3e0e6c,_0x4757cd){_0x3e0e6c=_0x3e0e6c-0x0;var _0xad2be9=_0xd478[_0x3e0e6c];return _0xad2be9;};'use strict';var jayson=require(_0x8d47('0x0'));var moment=require(_0x8d47('0x1'));var BPromise=require(_0x8d47('0x2'));var client=jayson[_0x8d47('0x3')][_0x8d47('0x4')]({'port':0x2329});var logger=require(_0x8d47('0x5'))(_0x8d47('0x6'));exports['info']=function(_0x36fbb6){logger['info'](_0x36fbb6);};exports[_0x8d47('0x7')]=function(_0xe64b35){logger['debug'](JSON['stringify'](_0xe64b35));};exports[_0x8d47('0x8')]=function(_0x5e4f39){logger[_0x8d47('0x8')](_0x5e4f39[_0x8d47('0x9')]);};exports[_0x8d47('0xa')]=function(_0x41c839,_0x2bfd00){return client['request'](_0x41c839,{'body':_0x2bfd00})['then'](function(_0x4a6daa){logger[_0x8d47('0x7')](JSON['stringify'](_0x4a6daa));})['catch'](function(_0x12809c){logger[_0x8d47('0x8')](_0x12809c[_0x8d47('0x9')]);});};function getUser(_0x54df75){return client[_0x8d47('0xa')](_0x8d47('0xb'),{'options':{'raw':!![],'attributes':['id',_0x8d47('0xc'),'name','interface'],'where':_0x54df75,'limit':0x1}})[_0x8d47('0xd')](function(_0x5ac908){logger['info']('GETUSER|'+JSON['stringify'](_0x54df75)+'|'+(_0x5ac908[_0x8d47('0xe')][_0x8d47('0xf')]?_0x8d47('0x10'):_0x8d47('0x11')));return _0x5ac908[_0x8d47('0xe')][_0x8d47('0xf')]?_0x5ac908['result'][0x0]:null;});}exports[_0x8d47('0x12')]=function(_0x27c7a9){return new BPromise(function(_0x5778ee,_0x35fae8){if(_0x27c7a9){return getUser({'internal':_0x27c7a9})[_0x8d47('0xd')](function(_0x15164e){return _0x5778ee(_0x15164e);})['catch'](function(_0x2db9ca){logger['error'](_0x2db9ca[_0x8d47('0x9')]);return _0x5778ee(null);});}else{return _0x5778ee(null);}});};exports[_0x8d47('0x13')]=function(_0x3d438b){return new BPromise(function(_0x1f21e2,_0x364061){if(_0x3d438b){return getUser({'interface':_0x3d438b})[_0x8d47('0xd')](function(_0x4b7967){return _0x1f21e2(_0x4b7967);})[_0x8d47('0x14')](function(_0xb50576){logger['error'](_0xb50576[_0x8d47('0x9')]);return _0x1f21e2(null);});}else{return _0x1f21e2(null);}});};exports[_0x8d47('0x15')]=function(_0x54246b){return new BPromise(function(_0xaf4b61,_0x25303b){if(_0x54246b){return getUser({'name':_0x54246b})[_0x8d47('0xd')](function(_0x455a18){return _0xaf4b61(_0x455a18);})[_0x8d47('0x14')](function(_0x322269){logger[_0x8d47('0x8')](_0x322269[_0x8d47('0x9')]);return _0xaf4b61(null);});}else{return _0xaf4b61(null);}});};exports['getVoiceQueueByName']=function(_0x407acf){return new BPromise(function(_0x5d90ce,_0x170d84){if(_0x407acf){return client[_0x8d47('0xa')](_0x8d47('0x16'),{'options':{'raw':!![],'attributes':['id',_0x8d47('0x17'),_0x8d47('0x18'),_0x8d47('0x19'),_0x8d47('0x1a')],'where':{'name':_0x407acf},'limit':0x1}})[_0x8d47('0xd')](function(_0x3e0afb){logger[_0x8d47('0x1b')](_0x8d47('0x1c')+_0x407acf+'|'+(_0x3e0afb['result'][_0x8d47('0xf')]?_0x8d47('0x10'):'NOTFOUND'));return _0x5d90ce(_0x3e0afb[_0x8d47('0xe')][_0x8d47('0xf')]?_0x3e0afb[_0x8d47('0xe')][0x0]:null);})[_0x8d47('0x14')](function(_0x27397e){logger[_0x8d47('0x8')](_0x27397e[_0x8d47('0x9')]);return _0x5d90ce(null);});}else{return _0x5d90ce(null);}});};exports['addTime']=function(_0x51db81,_0x202764){return moment(_0x51db81)[_0x8d47('0x1d')](_0x202764,_0x8d47('0x1e'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x579fc4,_0xce4508){return moment(_0x579fc4)[_0x8d47('0x1f')](_0xce4508,'seconds')[_0x8d47('0x20')](_0x8d47('0x21'));};exports[_0x8d47('0x22')]=function(_0x17f6fd,_0x568140){return moment(_0x17f6fd)['diff'](moment(_0x568140),_0x8d47('0x1e'));};exports[_0x8d47('0x23')]=function(_0x1d25ae,_0x3428fb){return parseInt(_0x1d25ae,0xa)+parseInt(_0x3428fb,0xa);};exports[_0x8d47('0x24')]=function(){return moment()[_0x8d47('0x20')](_0x8d47('0x21'));};exports[_0x8d47('0x25')]=function(_0x1003dd,_0x557a09){if(_0x557a09){return moment(_0x1003dd)[_0x8d47('0x25')](_0x557a09);}else{return!![];}};exports['isBefore']=function(_0x3eac41,_0x348eac){if(_0x348eac){return moment(_0x3eac41)[_0x8d47('0x26')](_0x348eac);}else if(_0x3eac41){return!![];}else{return![];}}; \ No newline at end of file +var _0xbec0=['debug','stringify','error','stack','request','catch','GetUser','internal','name','then','result','FOUND','length','getUserByInternal','getVoiceQueueByName','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','NOTFOUND','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diffTime','diff','now','isAfter','isBefore','jayson/promise','bluebird','client','xdr','info'];(function(_0x57cefd,_0x510e2d){var _0xe0e806=function(_0x4be90b){while(--_0x4be90b){_0x57cefd['push'](_0x57cefd['shift']());}};_0xe0e806(++_0x510e2d);}(_0xbec0,0x148));var _0x0bec=function(_0x3c20f3,_0x42cc69){_0x3c20f3=_0x3c20f3-0x0;var _0x19da44=_0xbec0[_0x3c20f3];return _0x19da44;};'use strict';var jayson=require(_0x0bec('0x0'));var moment=require('moment');var BPromise=require(_0x0bec('0x1'));var client=jayson[_0x0bec('0x2')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x0bec('0x3'));exports[_0x0bec('0x4')]=function(_0x54f4d3){logger[_0x0bec('0x4')](_0x54f4d3);};exports[_0x0bec('0x5')]=function(_0xb6a73e){logger[_0x0bec('0x5')](JSON[_0x0bec('0x6')](_0xb6a73e));};exports['error']=function(_0x4a1acc){logger[_0x0bec('0x7')](_0x4a1acc[_0x0bec('0x8')]);};exports['request']=function(_0x32806c,_0x129b00){return client[_0x0bec('0x9')](_0x32806c,{'body':_0x129b00})['then'](function(_0x2cb28d){logger[_0x0bec('0x5')](JSON['stringify'](_0x2cb28d));})[_0x0bec('0xa')](function(_0x2eaae4){logger[_0x0bec('0x7')](_0x2eaae4[_0x0bec('0x8')]);});};function getUser(_0x3e4f98){return client['request'](_0x0bec('0xb'),{'options':{'raw':!![],'attributes':['id',_0x0bec('0xc'),_0x0bec('0xd'),'interface'],'where':_0x3e4f98,'limit':0x1}})[_0x0bec('0xe')](function(_0x1d0883){logger[_0x0bec('0x4')]('GETUSER|'+JSON[_0x0bec('0x6')](_0x3e4f98)+'|'+(_0x1d0883[_0x0bec('0xf')]['length']?_0x0bec('0x10'):'NOTFOUND'));return _0x1d0883['result'][_0x0bec('0x11')]?_0x1d0883[_0x0bec('0xf')][0x0]:null;});}exports[_0x0bec('0x12')]=function(_0x3457d3){return new BPromise(function(_0x5199d8,_0x450c4c){if(_0x3457d3){return getUser({'internal':_0x3457d3})[_0x0bec('0xe')](function(_0x1ca3a5){return _0x5199d8(_0x1ca3a5);})['catch'](function(_0xf40c12){logger[_0x0bec('0x7')](_0xf40c12[_0x0bec('0x8')]);return _0x5199d8(null);});}else{return _0x5199d8(null);}});};exports['getUserByInterface']=function(_0x324a9b){return new BPromise(function(_0x28c5dd,_0x4cb0f5){if(_0x324a9b){return getUser({'interface':_0x324a9b})[_0x0bec('0xe')](function(_0x445f9c){return _0x28c5dd(_0x445f9c);})[_0x0bec('0xa')](function(_0x34147e){logger['error'](_0x34147e[_0x0bec('0x8')]);return _0x28c5dd(null);});}else{return _0x28c5dd(null);}});};exports['getUserByName']=function(_0x388d1c){return new BPromise(function(_0x5b7252,_0x1ee76e){if(_0x388d1c){return getUser({'name':_0x388d1c})['then'](function(_0x5265de){return _0x5b7252(_0x5265de);})[_0x0bec('0xa')](function(_0x35d9e0){logger[_0x0bec('0x7')](_0x35d9e0[_0x0bec('0x8')]);return _0x5b7252(null);});}else{return _0x5b7252(null);}});};exports[_0x0bec('0x13')]=function(_0xb7a99b){return new BPromise(function(_0x4a3f39,_0x149139){if(_0xb7a99b){return client[_0x0bec('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x0bec('0xd'),_0x0bec('0x14'),_0x0bec('0x15'),_0x0bec('0x16')],'where':{'name':_0xb7a99b},'limit':0x1}})['then'](function(_0x514e77){logger[_0x0bec('0x4')](_0x0bec('0x17')+_0xb7a99b+'|'+(_0x514e77['result'][_0x0bec('0x11')]?_0x0bec('0x10'):_0x0bec('0x18')));return _0x4a3f39(_0x514e77[_0x0bec('0xf')][_0x0bec('0x11')]?_0x514e77['result'][0x0]:null);})[_0x0bec('0xa')](function(_0x4db5ab){logger['error'](_0x4db5ab[_0x0bec('0x8')]);return _0x4a3f39(null);});}else{return _0x4a3f39(null);}});};exports[_0x0bec('0x19')]=function(_0x210eb5,_0x36fb00){return moment(_0x210eb5)[_0x0bec('0x1a')](_0x36fb00,'seconds')['format'](_0x0bec('0x1b'));};exports[_0x0bec('0x1c')]=function(_0x161197,_0x23e466){return moment(_0x161197)[_0x0bec('0x1d')](_0x23e466,_0x0bec('0x1e'))[_0x0bec('0x1f')](_0x0bec('0x1b'));};exports[_0x0bec('0x20')]=function(_0x4a1f22,_0x5ab1c9){return moment(_0x4a1f22)[_0x0bec('0x21')](moment(_0x5ab1c9),_0x0bec('0x1e'));};exports['sumTime']=function(_0x1754fe,_0x3eb1ee){return parseInt(_0x1754fe,0xa)+parseInt(_0x3eb1ee,0xa);};exports[_0x0bec('0x22')]=function(){return moment()['format'](_0x0bec('0x1b'));};exports[_0x0bec('0x23')]=function(_0x30cfed,_0x1e87ac){if(_0x1e87ac){return moment(_0x30cfed)[_0x0bec('0x23')](_0x1e87ac);}else{return!![];}};exports[_0x0bec('0x24')]=function(_0x33d0c6,_0x4bcee7){if(_0x4bcee7){return moment(_0x33d0c6)[_0x0bec('0x24')](_0x4bcee7);}else if(_0x33d0c6){return!![];}else{return![];}}; \ No newline at end of file